diff --git a/.azure-pipelines/docs.yml b/.azure-pipelines/docs.yml index f83f220ff14d..a66d7513ec1d 100644 --- a/.azure-pipelines/docs.yml +++ b/.azure-pipelines/docs.yml @@ -11,7 +11,7 @@ jobs: skipComponentGovernanceDetection: true timeoutInMinutes: 120 pool: - vmImage: 'vs2017-win2016' + vmImage: 'windows-2019' steps: - powershell: | @@ -79,7 +79,7 @@ jobs: skipComponentGovernanceDetection: true timeoutInMinutes: 120 pool: - vmImage: 'vs2017-win2016' + vmImage: 'windows-2019' steps: # We `install` separately from running `site:site site:stage` so that the `install` brings in the non-shipping-modules, @@ -96,6 +96,18 @@ jobs: publishJUnitResults: false goals: 'install' + - task: Maven@3 + displayName: 'Install azure-sdk-parent' + inputs: + mavenPomFile: parent/pom.xml + options: '$(DefaultOptions) -DskipTests -Dgpg.skip' + mavenOptions: '$(LoggingOptions)' + javaHomeOption: 'JDKVersion' + jdkVersionOption: '1.11' + jdkArchitectureOption: 'x64' + publishJUnitResults: false + goals: 'install' + - task: Maven@3 displayName: 'Install Data Packages' inputs: diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 3352c4744a3b..f3a1a4beab5d 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -10,6 +10,7 @@ # Service teams /sdk/appconfiguration/ @alzimmermsft @conniey @sima-zhu +/sdk/batch/ @xingwu1 @bgklein @matthchr /sdk/core/ @alzimmermsft @jianghaolu @srnagar @hemanttanwar /sdk/cosmos/ @moderakh @christopheranderson @kushagraThapar /sdk/eventhubs/ @conniey @srnagar @mssfang @@ -18,7 +19,7 @@ /sdk/servicebus/ @yvgopal @nemakam /sdk/tracing/ @samvaity @alzimmermsft -/sdk/storage/ @rickle-msft @jaschrep-msft @alzimmermsft @sima-zhu +/sdk/storage/ @rickle-msft @jaschrep-msft @gapra-msft @alzimmermsft @sima-zhu # Management Plane /**/resource-manager/ @yaohaizh @@ -28,5 +29,8 @@ ########### /eng/ @weshaggard @mitchdenny @danieljurek /eng/code-quality-reports/ @mssfang @JonathanGiles +/eng/jacoco-test-coverage/ @srnagar @JonathanGiles +/eng/spotbugs-aggregate-report/ @srnagar @JonathanGiles + /**/tests.yml @danieljurek /**/ci.yml @mitchdenny diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2ef9810e8c56..f3baa1c0ba4a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,5 +1,49 @@ # How to contribute -If you encounter any bugs with the library please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-java/issues) section of the project. +Thank you for your interest in contributing to Azure SDK for Java. -If you would like to become an active contributor to this project please follow the instructions provided in [Microsoft Azure Projects Contribution Guidelines](http://azure.github.com/guidelines.html). \ No newline at end of file +## About Azure SDK for java project + +- For reporting bugs, requesting features or asking for support, please file an issue in the [issues](https://github.com/Azure/azure-sdk-for-java/issues) section of the project. + +- If you would like to become an active contributor to this project please follow the instructions provided in [Microsoft Azure Projects Contribution Guidelines](http://azure.github.com/guidelines.html). + +- To make code changes, or contribute something new, please follow the [GitHub Forks / Pull requests model](https://help.github.com/articles/fork-a-repo/): Fork the repo, make the change and propose it back by submitting a pull request. + +- Refer to the [wiki](https://github.com/Azure/azure-sdk-for-java/wiki/Building#testing-for-spotbugs-and-checkstyle-issues) to learn about how Azure SDK for java generates CheckStyle, SpotBugs, Jacoco, and JavaDoc reports. + +- There are two Maven projects in the repo. Refer to the [wiki](https://github.com/Azure/azure-sdk-for-java/wiki/Building#pomclientxml-vs-pomdataxml) to learn about project structure for each. + +## Developer Guide + +### Pre-requisites +- Install Java Development Kit 8 + - add `JAVA_HOME` to environment variables +- Install [Maven](http://maven.apache.org/download.cgi) + - add `MAVEN_HOME` to environment variables + + +>**Note:** If you are on `Windows`, enable paths longer than 260 characters by:

+1.- Run this as Administrator on a command prompt:
+`REG ADD HKLM\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1`
*(might need to type `yes` to override key if it already exists)*

+2.- Set up `git` by running:
`git config --system core.longpaths true` + +### Building and Testing +The easiest way to build is by running the following command from the root folder: +``` +mvn -f pom.client.xml -Dgpg.skip -DskipTests clean install +``` +- `-f pom.client.xml`: tells maven to target latest Azure SDK for Java project. +- `-Dgpg.skip`: disables [gpg](https://mran.microsoft.com/snapshot/2016-12-19/web/packages/gpg/vignettes/intro.html) signing. +- `-DskipTests:` Building without running unit tests would speed operation up, however, make sure all tests pass before creating a new PR. +- `clean:` will remove any previous generated output. +- `install:` compiles project and installs it in the local Maven cache. + +>**Note**: Refer to [wiki](https://github.com/Azure/azure-sdk-for-java/wiki/Building) for learning about how to build using Java 11 + +### Compiling one project only +``` +mvn -f sdk/{projectForlderDir}/pom.xml -Dgpg.skip clean install + +//example: mvn -f sdk/keyvault/azure-keyvault-keys/pom.xml clean install +``` diff --git a/README.md b/README.md index 3a89fec4d97e..8d01aaa910b2 100644 --- a/README.md +++ b/README.md @@ -14,27 +14,31 @@ To get started with a specific library, see the **README.md** file located in th For tutorials, samples, quick starts and other documentation, visit [Azure for Java Developers](https://docs.microsoft.com/java/azure/). ### Prerequisites -Java 8 or later is required to use the July 2019 client preview libraries, otherwise Java 7 or later is required. +Java 8 or later is required to use the September 2019 client preview libraries, otherwise Java 7 or later is required. ## Packages available Each service might have a number of libraries available from each of the following categories: -* [Client - July 2019 Preview](#Client-July-2019-Preview) +* [Client - September 2019 Preview](#Client-September-2019-Preview) * [Client - Stable](#Client-Stable) * [Management](#Management) -### Client: July 2019 Preview -New wave of packages that we are currently releasing in **preview**. These libraries follow the [Azure SDK Design Guidelines for Java](https://azuresdkspecs.z5.web.core.windows.net/JavaSpec.html) and share a number of core features such as HTTP retries, logging, transport protocols, authentication protocols, etc., so that once you learn how to use these features in one client library, you will know how to use them in other client libraries. You can learn about these shared features [here](core). +### Client: September 2019 Preview +New wave of packages that we are currently releasing in **preview**. These libraries follow the [Azure SDK Design Guidelines for Java](https://azure.github.io/azure-sdk/java/guidelines/) and share a number of core features such as HTTP retries, logging, transport protocols, authentication protocols, etc., so that once you learn how to use these features in one client library, you will know how to use them in other client libraries. You can learn about these shared features [here](core). These preview libraries can be easily identified by their folder, package, and namespaces names starting with `azure-`, e.g. `azure-keyvault`. -The libraries released in the July 2019 preview: +The libraries released in the September 2019 preview: - [App Configuration](sdk/appconfiguration/azure-data-appconfiguration/README.md) - [Event Hubs](sdk/eventhubs/azure-messaging-eventhubs/README.md) +- [Event Hubs Checkpoint Store](sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md) - [Identity](sdk/identity/azure-identity/README.md) +- [Key Vault Certificates](sdk/keyvault/azure-keyvault-certificates/README.md) - [Key Vault Keys](sdk/keyvault/azure-keyvault-keys/README.md) -- [Key Vault Secrets](sdk/keyvault/client/azure-keyvault-secrets/README.md) +- [Key Vault Secrets](sdk/keyvault/azure-keyvault-secrets/README.md) - [Storage Blobs](sdk/storage/azure-storage-blob/README.md) +- [Storage Files](sdk/storage/azure-storage-file/README.md) +- [Storage Queues](sdk/storage/azure-storage-queue/README.md) >NOTE: If you need to ensure your code is ready for production, use one of the stable libraries. diff --git a/api-specs.json b/api-specs.json index bd963d00995b..0166ab5c4fdb 100644 --- a/api-specs.json +++ b/api-specs.json @@ -34,6 +34,10 @@ "source": "specification/authorization/resource-manager/readme.md", "args": "--multiapi --fluent" }, + "azure-kusto/resource-manager": { + "source": "specification/azure-kusto/resource-manager/readme.md", + "args": "--multiapi --fluent" + }, "azurestack/resource-manager": { "source": "specification/azurestack/resource-manager/readme.md", "args": "--multiapi --fluent" @@ -272,6 +276,10 @@ "source": "specification/storage/resource-manager/readme.md", "args": "--multiapi --fluent" }, + "storagecache/resource-manager": { + "source": "specification/storagecache/resource-manager/readme.md", + "args": "--multiapi --fluent" + }, "storageimportexport/resource-manager": { "source": "specification/storageimportexport/resource-manager/readme.md", "args": "--multiapi --fluent" diff --git a/compute/resource-manager/v2017_03_30/pom.xml b/compute/resource-manager/v2017_03_30/pom.xml index bde76009bbb7..309bcef2f7b4 100644 --- a/compute/resource-manager/v2017_03_30/pom.xml +++ b/compute/resource-manager/v2017_03_30/pom.xml @@ -11,15 +11,15 @@ com.microsoft.azure azure-arm-parent - 1.1.0 - ../../../pom.management.xml + 0.0.3-beta + ../../../pom.xml azure-mgmt-compute - 1.0.0-beta-1 + 1.0.0-beta jar Microsoft Azure SDK for Compute Management This package contains Microsoft Compute Management SDK. - https://github.com/Azure/azure-libraries-for-java + https://github.com/Azure/azure-sdk-for-java The MIT License (MIT) @@ -28,8 +28,8 @@ - scm:git:https://github.com/Azure/azure-libraries-for-java - scm:git:git@github.com:Azure/azure-libraries-for-java.git + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git HEAD diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/AdditionalUnattendContent.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/AdditionalUnattendContent.java index 1e021a425f3b..d54b7d653c4f 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/AdditionalUnattendContent.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/AdditionalUnattendContent.java @@ -49,7 +49,7 @@ public class AdditionalUnattendContent { private String content; /** - * Get the passName value. + * Get the pass name. Currently, the only allowable value is OobeSystem. Possible values include: 'OobeSystem'. * * @return the passName value */ @@ -58,7 +58,7 @@ public PassNames passName() { } /** - * Set the passName value. + * Set the pass name. Currently, the only allowable value is OobeSystem. Possible values include: 'OobeSystem'. * * @param passName the passName value to set * @return the AdditionalUnattendContent object itself. @@ -69,7 +69,7 @@ public AdditionalUnattendContent withPassName(PassNames passName) { } /** - * Get the componentName value. + * Get the component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. Possible values include: 'Microsoft-Windows-Shell-Setup'. * * @return the componentName value */ @@ -78,7 +78,7 @@ public ComponentNames componentName() { } /** - * Set the componentName value. + * Set the component name. Currently, the only allowable value is Microsoft-Windows-Shell-Setup. Possible values include: 'Microsoft-Windows-Shell-Setup'. * * @param componentName the componentName value to set * @return the AdditionalUnattendContent object itself. @@ -89,7 +89,7 @@ public AdditionalUnattendContent withComponentName(ComponentNames componentName) } /** - * Get the settingName value. + * Get specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. Possible values include: 'AutoLogon', 'FirstLogonCommands'. * * @return the settingName value */ @@ -98,7 +98,7 @@ public SettingNames settingName() { } /** - * Set the settingName value. + * Set specifies the name of the setting to which the content applies. Possible values are: FirstLogonCommands and AutoLogon. Possible values include: 'AutoLogon', 'FirstLogonCommands'. * * @param settingName the settingName value to set * @return the AdditionalUnattendContent object itself. @@ -109,7 +109,7 @@ public AdditionalUnattendContent withSettingName(SettingNames settingName) { } /** - * Get the content value. + * Get specifies the XML formatted content that is added to the unattend.xml file for the specified path and component. The XML must be less than 4KB and must include the root element for the setting or feature that is being inserted. * * @return the content value */ @@ -118,7 +118,7 @@ public String content() { } /** - * Set the content value. + * Set specifies the XML formatted content that is added to the unattend.xml file for the specified path and component. The XML must be less than 4KB and must include the root element for the setting or feature that is being inserted. * * @param content the content value to set * @return the AdditionalUnattendContent object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ApiEntityReference.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ApiEntityReference.java index 780f20fac6e4..48ba515e8bae 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ApiEntityReference.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ApiEntityReference.java @@ -16,13 +16,13 @@ public class ApiEntityReference { /** * The ARM resource id in the form of - * /subscriptions/{SubcriptionId}/resourceGroups/{ResourceGroupName}/... + * /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... */ @JsonProperty(value = "id") private String id; /** - * Get the id value. + * Get the ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... * * @return the id value */ @@ -31,7 +31,7 @@ public String id() { } /** - * Set the id value. + * Set the ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... * * @param id the id value to set * @return the ApiEntityReference object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ApiError.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ApiError.java index 6d60d80ef4bc..d9e3d34b5427 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ApiError.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ApiError.java @@ -46,7 +46,7 @@ public class ApiError { private String message; /** - * Get the details value. + * Get the Api error details. * * @return the details value */ @@ -55,7 +55,7 @@ public List details() { } /** - * Set the details value. + * Set the Api error details. * * @param details the details value to set * @return the ApiError object itself. @@ -66,7 +66,7 @@ public ApiError withDetails(List details) { } /** - * Get the innererror value. + * Get the Api inner error. * * @return the innererror value */ @@ -75,7 +75,7 @@ public InnerError innererror() { } /** - * Set the innererror value. + * Set the Api inner error. * * @param innererror the innererror value to set * @return the ApiError object itself. @@ -86,7 +86,7 @@ public ApiError withInnererror(InnerError innererror) { } /** - * Get the code value. + * Get the error code. * * @return the code value */ @@ -95,7 +95,7 @@ public String code() { } /** - * Set the code value. + * Set the error code. * * @param code the code value to set * @return the ApiError object itself. @@ -106,7 +106,7 @@ public ApiError withCode(String code) { } /** - * Get the target value. + * Get the target of the particular error. * * @return the target value */ @@ -115,7 +115,7 @@ public String target() { } /** - * Set the target value. + * Set the target of the particular error. * * @param target the target value to set * @return the ApiError object itself. @@ -126,7 +126,7 @@ public ApiError withTarget(String target) { } /** - * Get the message value. + * Get the error message. * * @return the message value */ @@ -135,7 +135,7 @@ public String message() { } /** - * Set the message value. + * Set the error message. * * @param message the message value to set * @return the ApiError object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ApiErrorBase.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ApiErrorBase.java index 111d1f884f01..4d7b8373f048 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ApiErrorBase.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ApiErrorBase.java @@ -33,7 +33,7 @@ public class ApiErrorBase { private String message; /** - * Get the code value. + * Get the error code. * * @return the code value */ @@ -42,7 +42,7 @@ public String code() { } /** - * Set the code value. + * Set the error code. * * @param code the code value to set * @return the ApiErrorBase object itself. @@ -53,7 +53,7 @@ public ApiErrorBase withCode(String code) { } /** - * Get the target value. + * Get the target of the particular error. * * @return the target value */ @@ -62,7 +62,7 @@ public String target() { } /** - * Set the target value. + * Set the target of the particular error. * * @param target the target value to set * @return the ApiErrorBase object itself. @@ -73,7 +73,7 @@ public ApiErrorBase withTarget(String target) { } /** - * Get the message value. + * Get the error message. * * @return the message value */ @@ -82,7 +82,7 @@ public String message() { } /** - * Set the message value. + * Set the error message. * * @param message the message value to set * @return the ApiErrorBase object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/AvailabilitySet.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/AvailabilitySet.java index 8f3e1454ca0f..1cae631f1077 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/AvailabilitySet.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/AvailabilitySet.java @@ -10,12 +10,12 @@ import com.microsoft.azure.arm.model.HasInner; import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; import com.microsoft.azure.arm.resources.models.HasResourceGroup; import com.microsoft.azure.arm.model.Refreshable; import com.microsoft.azure.arm.model.Updatable; import com.microsoft.azure.arm.model.Appliable; import com.microsoft.azure.arm.model.Creatable; -import com.microsoft.azure.arm.resources.models.GroupableResourceCore; import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.compute.v2017_03_30.implementation.ComputeManager; import java.util.List; @@ -74,41 +74,49 @@ interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup virtualMachines); } @@ -132,41 +140,49 @@ interface Update extends Appliable, Resource.UpdateWithTags virtualMachines); } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/AvailabilitySets.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/AvailabilitySets.java index 53614f2f2fc2..72768dbcb96c 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/AvailabilitySets.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/AvailabilitySets.java @@ -14,6 +14,7 @@ import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; import rx.Observable; import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; import com.microsoft.azure.management.compute.v2017_03_30.implementation.AvailabilitySetsInner; import com.microsoft.azure.arm.model.HasInner; import com.microsoft.azure.management.compute.v2017_03_30.AvailabilitySetVirtualMachineSize; @@ -21,7 +22,7 @@ /** * Type representing AvailabilitySets. */ -public interface AvailabilitySets extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, HasInner { +public interface AvailabilitySets extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { /** * Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. * diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/BootDiagnostics.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/BootDiagnostics.java index 2ef3ec5f9be0..9c8704fffeb5 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/BootDiagnostics.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/BootDiagnostics.java @@ -12,9 +12,8 @@ /** * Boot Diagnostics is a debugging feature which allows you to view Console - * Output and Screenshot to diagnose VM status. <br><br> For Linux - * Virtual Machines, you can easily view the output of your console log. - * <br><br> For both Windows and Linux virtual machines, Azure also + * Output and Screenshot to diagnose VM status. <br><br> You can + * easily view the output of your console log. <br><br> Azure also * enables you to see a screenshot of the VM from the hypervisor. */ public class BootDiagnostics { @@ -32,7 +31,7 @@ public class BootDiagnostics { private String storageUri; /** - * Get the enabled value. + * Get whether boot diagnostics should be enabled on the Virtual Machine. * * @return the enabled value */ @@ -41,7 +40,7 @@ public Boolean enabled() { } /** - * Set the enabled value. + * Set whether boot diagnostics should be enabled on the Virtual Machine. * * @param enabled the enabled value to set * @return the BootDiagnostics object itself. @@ -52,7 +51,7 @@ public BootDiagnostics withEnabled(Boolean enabled) { } /** - * Get the storageUri value. + * Get uri of the storage account to use for placing the console output and screenshot. * * @return the storageUri value */ @@ -61,7 +60,7 @@ public String storageUri() { } /** - * Set the storageUri value. + * Set uri of the storage account to use for placing the console output and screenshot. * * @param storageUri the storageUri value to set * @return the BootDiagnostics object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/BootDiagnosticsInstanceView.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/BootDiagnosticsInstanceView.java index 197d6f4747b7..f400de777263 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/BootDiagnosticsInstanceView.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/BootDiagnosticsInstanceView.java @@ -17,17 +17,17 @@ public class BootDiagnosticsInstanceView { /** * The console screenshot blob URI. */ - @JsonProperty(value = "consoleScreenshotBlobUri") + @JsonProperty(value = "consoleScreenshotBlobUri", access = JsonProperty.Access.WRITE_ONLY) private String consoleScreenshotBlobUri; /** * The Linux serial console log blob Uri. */ - @JsonProperty(value = "serialConsoleLogBlobUri") + @JsonProperty(value = "serialConsoleLogBlobUri", access = JsonProperty.Access.WRITE_ONLY) private String serialConsoleLogBlobUri; /** - * Get the consoleScreenshotBlobUri value. + * Get the console screenshot blob URI. * * @return the consoleScreenshotBlobUri value */ @@ -36,18 +36,7 @@ public String consoleScreenshotBlobUri() { } /** - * Set the consoleScreenshotBlobUri value. - * - * @param consoleScreenshotBlobUri the consoleScreenshotBlobUri value to set - * @return the BootDiagnosticsInstanceView object itself. - */ - public BootDiagnosticsInstanceView withConsoleScreenshotBlobUri(String consoleScreenshotBlobUri) { - this.consoleScreenshotBlobUri = consoleScreenshotBlobUri; - return this; - } - - /** - * Get the serialConsoleLogBlobUri value. + * Get the Linux serial console log blob Uri. * * @return the serialConsoleLogBlobUri value */ @@ -55,15 +44,4 @@ public String serialConsoleLogBlobUri() { return this.serialConsoleLogBlobUri; } - /** - * Set the serialConsoleLogBlobUri value. - * - * @param serialConsoleLogBlobUri the serialConsoleLogBlobUri value to set - * @return the BootDiagnosticsInstanceView object itself. - */ - public BootDiagnosticsInstanceView withSerialConsoleLogBlobUri(String serialConsoleLogBlobUri) { - this.serialConsoleLogBlobUri = serialConsoleLogBlobUri; - return this; - } - } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ComputeLongRunningOperationProperties.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ComputeLongRunningOperationProperties.java index 1e80ed94605b..7b67cde1e6b7 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ComputeLongRunningOperationProperties.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ComputeLongRunningOperationProperties.java @@ -21,7 +21,7 @@ public class ComputeLongRunningOperationProperties { private Object output; /** - * Get the output value. + * Get operation output data (raw JSON). * * @return the output value */ @@ -30,7 +30,7 @@ public Object output() { } /** - * Set the output value. + * Set operation output data (raw JSON). * * @param output the output value to set * @return the ComputeLongRunningOperationProperties object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/CreationData.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/CreationData.java index 5527b2a627b1..4971c717a92b 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/CreationData.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/CreationData.java @@ -50,7 +50,7 @@ public class CreationData { private String sourceResourceId; /** - * Get the createOption value. + * Get this enumerates the possible sources of a disk's creation. Possible values include: 'Empty', 'Attach', 'FromImage', 'Import', 'Copy'. * * @return the createOption value */ @@ -59,7 +59,7 @@ public DiskCreateOption createOption() { } /** - * Set the createOption value. + * Set this enumerates the possible sources of a disk's creation. Possible values include: 'Empty', 'Attach', 'FromImage', 'Import', 'Copy'. * * @param createOption the createOption value to set * @return the CreationData object itself. @@ -70,7 +70,7 @@ public CreationData withCreateOption(DiskCreateOption createOption) { } /** - * Get the storageAccountId value. + * Get if createOption is Import, the Azure Resource Manager identifier of the storage account containing the blob to import as a disk. Required only if the blob is in a different subscription. * * @return the storageAccountId value */ @@ -79,7 +79,7 @@ public String storageAccountId() { } /** - * Set the storageAccountId value. + * Set if createOption is Import, the Azure Resource Manager identifier of the storage account containing the blob to import as a disk. Required only if the blob is in a different subscription. * * @param storageAccountId the storageAccountId value to set * @return the CreationData object itself. @@ -90,7 +90,7 @@ public CreationData withStorageAccountId(String storageAccountId) { } /** - * Get the imageReference value. + * Get disk source information. * * @return the imageReference value */ @@ -99,7 +99,7 @@ public ImageDiskReference imageReference() { } /** - * Set the imageReference value. + * Set disk source information. * * @param imageReference the imageReference value to set * @return the CreationData object itself. @@ -110,7 +110,7 @@ public CreationData withImageReference(ImageDiskReference imageReference) { } /** - * Get the sourceUri value. + * Get if createOption is Import, this is the URI of a blob to be imported into a managed disk. * * @return the sourceUri value */ @@ -119,7 +119,7 @@ public String sourceUri() { } /** - * Set the sourceUri value. + * Set if createOption is Import, this is the URI of a blob to be imported into a managed disk. * * @param sourceUri the sourceUri value to set * @return the CreationData object itself. @@ -130,7 +130,7 @@ public CreationData withSourceUri(String sourceUri) { } /** - * Get the sourceResourceId value. + * Get if createOption is Copy, this is the ARM id of the source snapshot or disk. * * @return the sourceResourceId value */ @@ -139,7 +139,7 @@ public String sourceResourceId() { } /** - * Set the sourceResourceId value. + * Set if createOption is Copy, this is the ARM id of the source snapshot or disk. * * @param sourceResourceId the sourceResourceId value to set * @return the CreationData object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DataDisk.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DataDisk.java index d7e81c850def..67c3d8fd1c7f 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DataDisk.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DataDisk.java @@ -68,7 +68,7 @@ public class DataDisk { /** * Specifies the size of an empty data disk in gigabytes. This element can - * be used to overwrite the name of the disk in a virtual machine image. + * be used to overwrite the size of the disk in a virtual machine image. * <br><br> This value cannot be larger than 1023 GB. */ @JsonProperty(value = "diskSizeGB") @@ -81,7 +81,7 @@ public class DataDisk { private ManagedDiskParameters managedDisk; /** - * Get the lun value. + * Get specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. * * @return the lun value */ @@ -90,7 +90,7 @@ public int lun() { } /** - * Set the lun value. + * Set specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. * * @param lun the lun value to set * @return the DataDisk object itself. @@ -101,7 +101,7 @@ public DataDisk withLun(int lun) { } /** - * Get the name value. + * Get the disk name. * * @return the name value */ @@ -110,7 +110,7 @@ public String name() { } /** - * Set the name value. + * Set the disk name. * * @param name the name value to set * @return the DataDisk object itself. @@ -121,7 +121,7 @@ public DataDisk withName(String name) { } /** - * Get the vhd value. + * Get the virtual hard disk. * * @return the vhd value */ @@ -130,7 +130,7 @@ public VirtualHardDisk vhd() { } /** - * Set the vhd value. + * Set the virtual hard disk. * * @param vhd the vhd value to set * @return the DataDisk object itself. @@ -141,7 +141,7 @@ public DataDisk withVhd(VirtualHardDisk vhd) { } /** - * Get the image value. + * Get the source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist. * * @return the image value */ @@ -150,7 +150,7 @@ public VirtualHardDisk image() { } /** - * Set the image value. + * Set the source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist. * * @param image the image value to set * @return the DataDisk object itself. @@ -161,7 +161,7 @@ public DataDisk withImage(VirtualHardDisk image) { } /** - * Get the caching value. + * Get specifies the caching requirements. <br><br> Possible values are: <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'None', 'ReadOnly', 'ReadWrite'. * * @return the caching value */ @@ -170,7 +170,7 @@ public CachingTypes caching() { } /** - * Set the caching value. + * Set specifies the caching requirements. <br><br> Possible values are: <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'None', 'ReadOnly', 'ReadWrite'. * * @param caching the caching value to set * @return the DataDisk object itself. @@ -181,7 +181,7 @@ public DataDisk withCaching(CachingTypes caching) { } /** - * Get the createOption value. + * Get specifies how the virtual machine should be created.<br><br> Possible values are:<br><br> **Attach** \u2013 This value is used when you are using a specialized disk to create the virtual machine.<br><br> **FromImage** \u2013 This value is used when you are using an image to create the virtual machine. If you are using a platform image, you also use the imageReference element described above. If you are using a marketplace image, you also use the plan element previously described. Possible values include: 'FromImage', 'Empty', 'Attach'. * * @return the createOption value */ @@ -190,7 +190,7 @@ public DiskCreateOptionTypes createOption() { } /** - * Set the createOption value. + * Set specifies how the virtual machine should be created.<br><br> Possible values are:<br><br> **Attach** \u2013 This value is used when you are using a specialized disk to create the virtual machine.<br><br> **FromImage** \u2013 This value is used when you are using an image to create the virtual machine. If you are using a platform image, you also use the imageReference element described above. If you are using a marketplace image, you also use the plan element previously described. Possible values include: 'FromImage', 'Empty', 'Attach'. * * @param createOption the createOption value to set * @return the DataDisk object itself. @@ -201,7 +201,7 @@ public DataDisk withCreateOption(DiskCreateOptionTypes createOption) { } /** - * Get the diskSizeGB value. + * Get specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image. <br><br> This value cannot be larger than 1023 GB. * * @return the diskSizeGB value */ @@ -210,7 +210,7 @@ public Integer diskSizeGB() { } /** - * Set the diskSizeGB value. + * Set specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image. <br><br> This value cannot be larger than 1023 GB. * * @param diskSizeGB the diskSizeGB value to set * @return the DataDisk object itself. @@ -221,7 +221,7 @@ public DataDisk withDiskSizeGB(Integer diskSizeGB) { } /** - * Get the managedDisk value. + * Get the managed disk parameters. * * @return the managedDisk value */ @@ -230,7 +230,7 @@ public ManagedDiskParameters managedDisk() { } /** - * Set the managedDisk value. + * Set the managed disk parameters. * * @param managedDisk the managedDisk value to set * @return the DataDisk object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DataDiskImage.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DataDiskImage.java index 117db573ad1c..d9deb1cb81f1 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DataDiskImage.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DataDiskImage.java @@ -23,7 +23,7 @@ public class DataDiskImage { private Integer lun; /** - * Get the lun value. + * Get specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. * * @return the lun value */ diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiagnosticsProfile.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiagnosticsProfile.java index 82a8085f79fb..ad1efe83282e 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiagnosticsProfile.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiagnosticsProfile.java @@ -17,9 +17,8 @@ public class DiagnosticsProfile { /** * Boot Diagnostics is a debugging feature which allows you to view Console - * Output and Screenshot to diagnose VM status. <br><br> For - * Linux Virtual Machines, you can easily view the output of your console - * log. <br><br> For both Windows and Linux virtual machines, + * Output and Screenshot to diagnose VM status. <br><br> You + * can easily view the output of your console log. <br><br> * Azure also enables you to see a screenshot of the VM from the * hypervisor. */ @@ -27,7 +26,7 @@ public class DiagnosticsProfile { private BootDiagnostics bootDiagnostics; /** - * Get the bootDiagnostics value. + * Get boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. <br><br> You can easily view the output of your console log. <br><br> Azure also enables you to see a screenshot of the VM from the hypervisor. * * @return the bootDiagnostics value */ @@ -36,7 +35,7 @@ public BootDiagnostics bootDiagnostics() { } /** - * Set the bootDiagnostics value. + * Set boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. <br><br> You can easily view the output of your console log. <br><br> Azure also enables you to see a screenshot of the VM from the hypervisor. * * @param bootDiagnostics the bootDiagnostics value to set * @return the DiagnosticsProfile object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/Disk.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/Disk.java index ef32cc00e56d..ce7957d9555a 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/Disk.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/Disk.java @@ -10,12 +10,12 @@ import com.microsoft.azure.arm.model.HasInner; import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; import com.microsoft.azure.arm.resources.models.HasResourceGroup; import com.microsoft.azure.arm.model.Refreshable; import com.microsoft.azure.arm.model.Updatable; import com.microsoft.azure.arm.model.Appliable; import com.microsoft.azure.arm.model.Creatable; -import com.microsoft.azure.arm.resources.models.GroupableResourceCore; import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.compute.v2017_03_30.implementation.ComputeManager; import java.util.List; @@ -99,56 +99,68 @@ interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup zones); } @@ -172,41 +184,49 @@ interface Update extends Appliable, Resource.UpdateWithTags, Updat */ interface UpdateStages { /** - * The stage of the disk {0} allowing to specify DiskSizeGB. + * The stage of the disk update allowing to specify DiskSizeGB. */ interface WithDiskSizeGB { /** * Specifies diskSizeGB. + * @param diskSizeGB If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size + * @return the next update stage */ Update withDiskSizeGB(Integer diskSizeGB); } /** - * The stage of the disk {0} allowing to specify EncryptionSettings. + * The stage of the disk update allowing to specify EncryptionSettings. */ interface WithEncryptionSettings { /** * Specifies encryptionSettings. + * @param encryptionSettings Encryption settings for disk or snapshot + * @return the next update stage */ Update withEncryptionSettings(EncryptionSettings encryptionSettings); } /** - * The stage of the disk {0} allowing to specify OsType. + * The stage of the disk update allowing to specify OsType. */ interface WithOsType { /** * Specifies osType. + * @param osType the Operating System type. Possible values include: 'Windows', 'Linux' + * @return the next update stage */ Update withOsType(OperatingSystemTypes osType); } /** - * The stage of the disk {0} allowing to specify Sku. + * The stage of the disk update allowing to specify Sku. */ interface WithSku { /** * Specifies sku. + * @param sku the sku parameter value + * @return the next update stage */ Update withSku(DiskSku sku); } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiskEncryptionSettings.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiskEncryptionSettings.java index c620e1103b1e..a5fcaf8f01d4 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiskEncryptionSettings.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiskEncryptionSettings.java @@ -35,7 +35,7 @@ public class DiskEncryptionSettings { private Boolean enabled; /** - * Get the diskEncryptionKey value. + * Get specifies the location of the disk encryption key, which is a Key Vault Secret. * * @return the diskEncryptionKey value */ @@ -44,7 +44,7 @@ public KeyVaultSecretReference diskEncryptionKey() { } /** - * Set the diskEncryptionKey value. + * Set specifies the location of the disk encryption key, which is a Key Vault Secret. * * @param diskEncryptionKey the diskEncryptionKey value to set * @return the DiskEncryptionSettings object itself. @@ -55,7 +55,7 @@ public DiskEncryptionSettings withDiskEncryptionKey(KeyVaultSecretReference disk } /** - * Get the keyEncryptionKey value. + * Get specifies the location of the key encryption key in Key Vault. * * @return the keyEncryptionKey value */ @@ -64,7 +64,7 @@ public KeyVaultKeyReference keyEncryptionKey() { } /** - * Set the keyEncryptionKey value. + * Set specifies the location of the key encryption key in Key Vault. * * @param keyEncryptionKey the keyEncryptionKey value to set * @return the DiskEncryptionSettings object itself. @@ -75,7 +75,7 @@ public DiskEncryptionSettings withKeyEncryptionKey(KeyVaultKeyReference keyEncry } /** - * Get the enabled value. + * Get specifies whether disk encryption should be enabled on the virtual machine. * * @return the enabled value */ @@ -84,7 +84,7 @@ public Boolean enabled() { } /** - * Set the enabled value. + * Set specifies whether disk encryption should be enabled on the virtual machine. * * @param enabled the enabled value to set * @return the DiskEncryptionSettings object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiskInstanceView.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiskInstanceView.java index c29354e3b09f..f8930bf6e40a 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiskInstanceView.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiskInstanceView.java @@ -35,7 +35,7 @@ public class DiskInstanceView { private List statuses; /** - * Get the name value. + * Get the disk name. * * @return the name value */ @@ -44,7 +44,7 @@ public String name() { } /** - * Set the name value. + * Set the disk name. * * @param name the name value to set * @return the DiskInstanceView object itself. @@ -55,7 +55,7 @@ public DiskInstanceView withName(String name) { } /** - * Get the encryptionSettings value. + * Get specifies the encryption settings for the OS Disk. <br><br> Minimum api-version: 2015-06-15. * * @return the encryptionSettings value */ @@ -64,7 +64,7 @@ public List encryptionSettings() { } /** - * Set the encryptionSettings value. + * Set specifies the encryption settings for the OS Disk. <br><br> Minimum api-version: 2015-06-15. * * @param encryptionSettings the encryptionSettings value to set * @return the DiskInstanceView object itself. @@ -75,7 +75,7 @@ public DiskInstanceView withEncryptionSettings(List encr } /** - * Get the statuses value. + * Get the resource status information. * * @return the statuses value */ @@ -84,7 +84,7 @@ public List statuses() { } /** - * Set the statuses value. + * Set the resource status information. * * @param statuses the statuses value to set * @return the DiskInstanceView object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiskSku.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiskSku.java index 4553fd7a1ae6..c7a47a286bc0 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiskSku.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiskSku.java @@ -27,7 +27,7 @@ public class DiskSku { private String tier; /** - * Get the name value. + * Get the sku name. Possible values include: 'Standard_LRS', 'Premium_LRS'. * * @return the name value */ @@ -36,7 +36,7 @@ public StorageAccountTypes name() { } /** - * Set the name value. + * Set the sku name. Possible values include: 'Standard_LRS', 'Premium_LRS'. * * @param name the name value to set * @return the DiskSku object itself. @@ -47,7 +47,7 @@ public DiskSku withName(StorageAccountTypes name) { } /** - * Get the tier value. + * Get the sku tier. * * @return the tier value */ diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiskUpdate.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiskUpdate.java index 3343d8e881d7..df2cd2561b24 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiskUpdate.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiskUpdate.java @@ -39,7 +39,7 @@ public class DiskUpdate extends ResourceUpdate { private EncryptionSettings encryptionSettings; /** - * Get the osType value. + * Get the Operating System type. Possible values include: 'Windows', 'Linux'. * * @return the osType value */ @@ -48,7 +48,7 @@ public OperatingSystemTypes osType() { } /** - * Set the osType value. + * Set the Operating System type. Possible values include: 'Windows', 'Linux'. * * @param osType the osType value to set * @return the DiskUpdate object itself. @@ -59,7 +59,7 @@ public DiskUpdate withOsType(OperatingSystemTypes osType) { } /** - * Get the diskSizeGB value. + * Get if creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. * * @return the diskSizeGB value */ @@ -68,7 +68,7 @@ public Integer diskSizeGB() { } /** - * Set the diskSizeGB value. + * Set if creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. * * @param diskSizeGB the diskSizeGB value to set * @return the DiskUpdate object itself. @@ -79,7 +79,7 @@ public DiskUpdate withDiskSizeGB(Integer diskSizeGB) { } /** - * Get the encryptionSettings value. + * Get encryption settings for disk or snapshot. * * @return the encryptionSettings value */ @@ -88,7 +88,7 @@ public EncryptionSettings encryptionSettings() { } /** - * Set the encryptionSettings value. + * Set encryption settings for disk or snapshot. * * @param encryptionSettings the encryptionSettings value to set * @return the DiskUpdate object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/EncryptionSettings.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/EncryptionSettings.java index e2533114f0d5..c8a747e8ac2e 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/EncryptionSettings.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/EncryptionSettings.java @@ -37,7 +37,7 @@ public class EncryptionSettings { private KeyVaultAndKeyReference keyEncryptionKey; /** - * Get the enabled value. + * Get set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged. * * @return the enabled value */ @@ -46,7 +46,7 @@ public Boolean enabled() { } /** - * Set the enabled value. + * Set set this flag to true and provide DiskEncryptionKey and optional KeyEncryptionKey to enable encryption. Set this flag to false and remove DiskEncryptionKey and KeyEncryptionKey to disable encryption. If EncryptionSettings is null in the request object, the existing settings remain unchanged. * * @param enabled the enabled value to set * @return the EncryptionSettings object itself. @@ -57,7 +57,7 @@ public EncryptionSettings withEnabled(Boolean enabled) { } /** - * Get the diskEncryptionKey value. + * Get key Vault Secret Url and vault id of the disk encryption key. * * @return the diskEncryptionKey value */ @@ -66,7 +66,7 @@ public KeyVaultAndSecretReference diskEncryptionKey() { } /** - * Set the diskEncryptionKey value. + * Set key Vault Secret Url and vault id of the disk encryption key. * * @param diskEncryptionKey the diskEncryptionKey value to set * @return the EncryptionSettings object itself. @@ -77,7 +77,7 @@ public EncryptionSettings withDiskEncryptionKey(KeyVaultAndSecretReference diskE } /** - * Get the keyEncryptionKey value. + * Get key Vault Key Url and vault id of the key encryption key. * * @return the keyEncryptionKey value */ @@ -86,7 +86,7 @@ public KeyVaultAndKeyReference keyEncryptionKey() { } /** - * Set the keyEncryptionKey value. + * Set key Vault Key Url and vault id of the key encryption key. * * @param keyEncryptionKey the keyEncryptionKey value to set * @return the EncryptionSettings object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/GrantAccessData.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/GrantAccessData.java index 269f3bd389ae..aabb7590b9c6 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/GrantAccessData.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/GrantAccessData.java @@ -27,7 +27,7 @@ public class GrantAccessData { private int durationInSeconds; /** - * Get the access value. + * Get possible values include: 'None', 'Read'. * * @return the access value */ @@ -36,7 +36,7 @@ public AccessLevel access() { } /** - * Set the access value. + * Set possible values include: 'None', 'Read'. * * @param access the access value to set * @return the GrantAccessData object itself. @@ -47,7 +47,7 @@ public GrantAccessData withAccess(AccessLevel access) { } /** - * Get the durationInSeconds value. + * Get time duration in seconds until the SAS access expires. * * @return the durationInSeconds value */ @@ -56,7 +56,7 @@ public int durationInSeconds() { } /** - * Set the durationInSeconds value. + * Set time duration in seconds until the SAS access expires. * * @param durationInSeconds the durationInSeconds value to set * @return the GrantAccessData object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/HardwareProfile.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/HardwareProfile.java index a79d590dffa3..10ad2d87388a 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/HardwareProfile.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/HardwareProfile.java @@ -21,13 +21,14 @@ public class HardwareProfile { * <br><br> The available VM sizes depend on region and * availability set. For a list of available sizes use these APIs: * <br><br> [List all available virtual machine sizes in an - * availability set](virtualmachines-list-sizes-availability-set.md) + * availability + * set](https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes) * <br><br> [List all available virtual machine sizes in a - * region](virtualmachines-list-sizes-region.md) <br><br> [List - * all available virtual machine sizes for - * resizing](virtualmachines-list-sizes-for-resizing.md). Possible values - * include: 'Basic_A0', 'Basic_A1', 'Basic_A2', 'Basic_A3', 'Basic_A4', - * 'Standard_A0', 'Standard_A1', 'Standard_A2', 'Standard_A3', + * region](https://docs.microsoft.com/rest/api/compute/virtualmachinesizes/list) + * <br><br> [List all available virtual machine sizes for + * resizing](https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes). + * Possible values include: 'Basic_A0', 'Basic_A1', 'Basic_A2', 'Basic_A3', + * 'Basic_A4', 'Standard_A0', 'Standard_A1', 'Standard_A2', 'Standard_A3', * 'Standard_A4', 'Standard_A5', 'Standard_A6', 'Standard_A7', * 'Standard_A8', 'Standard_A9', 'Standard_A10', 'Standard_A11', * 'Standard_A1_v2', 'Standard_A2_v2', 'Standard_A4_v2', 'Standard_A8_v2', @@ -56,7 +57,7 @@ public class HardwareProfile { private VirtualMachineSizeTypes vmSize; /** - * Get the vmSize value. + * Get specifies the size of the virtual machine. For more information about virtual machine sizes, see [Sizes for virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-sizes?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). <br><br> The available VM sizes depend on region and availability set. For a list of available sizes use these APIs: <br><br> [List all available virtual machine sizes in an availability set](https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes) <br><br> [List all available virtual machine sizes in a region](https://docs.microsoft.com/rest/api/compute/virtualmachinesizes/list) <br><br> [List all available virtual machine sizes for resizing](https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes). Possible values include: 'Basic_A0', 'Basic_A1', 'Basic_A2', 'Basic_A3', 'Basic_A4', 'Standard_A0', 'Standard_A1', 'Standard_A2', 'Standard_A3', 'Standard_A4', 'Standard_A5', 'Standard_A6', 'Standard_A7', 'Standard_A8', 'Standard_A9', 'Standard_A10', 'Standard_A11', 'Standard_A1_v2', 'Standard_A2_v2', 'Standard_A4_v2', 'Standard_A8_v2', 'Standard_A2m_v2', 'Standard_A4m_v2', 'Standard_A8m_v2', 'Standard_D1', 'Standard_D2', 'Standard_D3', 'Standard_D4', 'Standard_D11', 'Standard_D12', 'Standard_D13', 'Standard_D14', 'Standard_D1_v2', 'Standard_D2_v2', 'Standard_D3_v2', 'Standard_D4_v2', 'Standard_D5_v2', 'Standard_D11_v2', 'Standard_D12_v2', 'Standard_D13_v2', 'Standard_D14_v2', 'Standard_D15_v2', 'Standard_DS1', 'Standard_DS2', 'Standard_DS3', 'Standard_DS4', 'Standard_DS11', 'Standard_DS12', 'Standard_DS13', 'Standard_DS14', 'Standard_DS1_v2', 'Standard_DS2_v2', 'Standard_DS3_v2', 'Standard_DS4_v2', 'Standard_DS5_v2', 'Standard_DS11_v2', 'Standard_DS12_v2', 'Standard_DS13_v2', 'Standard_DS14_v2', 'Standard_DS15_v2', 'Standard_F1', 'Standard_F2', 'Standard_F4', 'Standard_F8', 'Standard_F16', 'Standard_F1s', 'Standard_F2s', 'Standard_F4s', 'Standard_F8s', 'Standard_F16s', 'Standard_G1', 'Standard_G2', 'Standard_G3', 'Standard_G4', 'Standard_G5', 'Standard_GS1', 'Standard_GS2', 'Standard_GS3', 'Standard_GS4', 'Standard_GS5', 'Standard_H8', 'Standard_H16', 'Standard_H8m', 'Standard_H16m', 'Standard_H16r', 'Standard_H16mr', 'Standard_L4s', 'Standard_L8s', 'Standard_L16s', 'Standard_L32s', 'Standard_NC6', 'Standard_NC12', 'Standard_NC24', 'Standard_NC24r', 'Standard_NV6', 'Standard_NV12', 'Standard_NV24'. * * @return the vmSize value */ @@ -65,7 +66,7 @@ public VirtualMachineSizeTypes vmSize() { } /** - * Set the vmSize value. + * Set specifies the size of the virtual machine. For more information about virtual machine sizes, see [Sizes for virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-sizes?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). <br><br> The available VM sizes depend on region and availability set. For a list of available sizes use these APIs: <br><br> [List all available virtual machine sizes in an availability set](https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes) <br><br> [List all available virtual machine sizes in a region](https://docs.microsoft.com/rest/api/compute/virtualmachinesizes/list) <br><br> [List all available virtual machine sizes for resizing](https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes). Possible values include: 'Basic_A0', 'Basic_A1', 'Basic_A2', 'Basic_A3', 'Basic_A4', 'Standard_A0', 'Standard_A1', 'Standard_A2', 'Standard_A3', 'Standard_A4', 'Standard_A5', 'Standard_A6', 'Standard_A7', 'Standard_A8', 'Standard_A9', 'Standard_A10', 'Standard_A11', 'Standard_A1_v2', 'Standard_A2_v2', 'Standard_A4_v2', 'Standard_A8_v2', 'Standard_A2m_v2', 'Standard_A4m_v2', 'Standard_A8m_v2', 'Standard_D1', 'Standard_D2', 'Standard_D3', 'Standard_D4', 'Standard_D11', 'Standard_D12', 'Standard_D13', 'Standard_D14', 'Standard_D1_v2', 'Standard_D2_v2', 'Standard_D3_v2', 'Standard_D4_v2', 'Standard_D5_v2', 'Standard_D11_v2', 'Standard_D12_v2', 'Standard_D13_v2', 'Standard_D14_v2', 'Standard_D15_v2', 'Standard_DS1', 'Standard_DS2', 'Standard_DS3', 'Standard_DS4', 'Standard_DS11', 'Standard_DS12', 'Standard_DS13', 'Standard_DS14', 'Standard_DS1_v2', 'Standard_DS2_v2', 'Standard_DS3_v2', 'Standard_DS4_v2', 'Standard_DS5_v2', 'Standard_DS11_v2', 'Standard_DS12_v2', 'Standard_DS13_v2', 'Standard_DS14_v2', 'Standard_DS15_v2', 'Standard_F1', 'Standard_F2', 'Standard_F4', 'Standard_F8', 'Standard_F16', 'Standard_F1s', 'Standard_F2s', 'Standard_F4s', 'Standard_F8s', 'Standard_F16s', 'Standard_G1', 'Standard_G2', 'Standard_G3', 'Standard_G4', 'Standard_G5', 'Standard_GS1', 'Standard_GS2', 'Standard_GS3', 'Standard_GS4', 'Standard_GS5', 'Standard_H8', 'Standard_H16', 'Standard_H8m', 'Standard_H16m', 'Standard_H16r', 'Standard_H16mr', 'Standard_L4s', 'Standard_L8s', 'Standard_L16s', 'Standard_L32s', 'Standard_NC6', 'Standard_NC12', 'Standard_NC24', 'Standard_NC24r', 'Standard_NV6', 'Standard_NV12', 'Standard_NV24'. * * @param vmSize the vmSize value to set * @return the HardwareProfile object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/Image.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/Image.java index cbc15ae9573e..bfc47b8b1353 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/Image.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/Image.java @@ -10,12 +10,12 @@ import com.microsoft.azure.arm.model.HasInner; import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; import com.microsoft.azure.arm.resources.models.HasResourceGroup; import com.microsoft.azure.arm.model.Refreshable; import com.microsoft.azure.arm.model.Updatable; import com.microsoft.azure.arm.model.Appliable; import com.microsoft.azure.arm.model.Creatable; -import com.microsoft.azure.arm.resources.models.GroupableResourceCore; import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.compute.v2017_03_30.implementation.ComputeManager; import com.microsoft.azure.SubResource; @@ -63,21 +63,25 @@ interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup, Resource.UpdateWithTags, Upda */ interface UpdateStages { /** - * The stage of the image {0} allowing to specify SourceVirtualMachine. + * The stage of the image update allowing to specify SourceVirtualMachine. */ interface WithSourceVirtualMachine { /** * Specifies sourceVirtualMachine. + * @param sourceVirtualMachine The source virtual machine from which Image is created + * @return the next update stage */ Update withSourceVirtualMachine(SubResource sourceVirtualMachine); } /** - * The stage of the image {0} allowing to specify StorageProfile. + * The stage of the image update allowing to specify StorageProfile. */ interface WithStorageProfile { /** * Specifies storageProfile. + * @param storageProfile Specifies the storage settings for the virtual machine disks + * @return the next update stage */ Update withStorageProfile(ImageStorageProfile storageProfile); } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ImageDataDisk.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ImageDataDisk.java index fc5113466878..6c150b5f2e92 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ImageDataDisk.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ImageDataDisk.java @@ -68,7 +68,7 @@ public class ImageDataDisk { private StorageAccountTypes storageAccountType; /** - * Get the lun value. + * Get specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. * * @return the lun value */ @@ -77,7 +77,7 @@ public int lun() { } /** - * Set the lun value. + * Set specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. * * @param lun the lun value to set * @return the ImageDataDisk object itself. @@ -88,7 +88,7 @@ public ImageDataDisk withLun(int lun) { } /** - * Get the snapshot value. + * Get the snapshot. * * @return the snapshot value */ @@ -97,7 +97,7 @@ public SubResource snapshot() { } /** - * Set the snapshot value. + * Set the snapshot. * * @param snapshot the snapshot value to set * @return the ImageDataDisk object itself. @@ -108,7 +108,7 @@ public ImageDataDisk withSnapshot(SubResource snapshot) { } /** - * Get the managedDisk value. + * Get the managedDisk. * * @return the managedDisk value */ @@ -117,7 +117,7 @@ public SubResource managedDisk() { } /** - * Set the managedDisk value. + * Set the managedDisk. * * @param managedDisk the managedDisk value to set * @return the ImageDataDisk object itself. @@ -128,7 +128,7 @@ public ImageDataDisk withManagedDisk(SubResource managedDisk) { } /** - * Get the blobUri value. + * Get the Virtual Hard Disk. * * @return the blobUri value */ @@ -137,7 +137,7 @@ public String blobUri() { } /** - * Set the blobUri value. + * Set the Virtual Hard Disk. * * @param blobUri the blobUri value to set * @return the ImageDataDisk object itself. @@ -148,7 +148,7 @@ public ImageDataDisk withBlobUri(String blobUri) { } /** - * Get the caching value. + * Get specifies the caching requirements. <br><br> Possible values are: <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'None', 'ReadOnly', 'ReadWrite'. * * @return the caching value */ @@ -157,7 +157,7 @@ public CachingTypes caching() { } /** - * Set the caching value. + * Set specifies the caching requirements. <br><br> Possible values are: <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'None', 'ReadOnly', 'ReadWrite'. * * @param caching the caching value to set * @return the ImageDataDisk object itself. @@ -168,7 +168,7 @@ public ImageDataDisk withCaching(CachingTypes caching) { } /** - * Get the diskSizeGB value. + * Get specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image. <br><br> This value cannot be larger than 1023 GB. * * @return the diskSizeGB value */ @@ -177,7 +177,7 @@ public Integer diskSizeGB() { } /** - * Set the diskSizeGB value. + * Set specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image. <br><br> This value cannot be larger than 1023 GB. * * @param diskSizeGB the diskSizeGB value to set * @return the ImageDataDisk object itself. @@ -188,7 +188,7 @@ public ImageDataDisk withDiskSizeGB(Integer diskSizeGB) { } /** - * Get the storageAccountType value. + * Get specifies the storage account type for the managed disk. Possible values are: Standard_LRS or Premium_LRS. Possible values include: 'Standard_LRS', 'Premium_LRS'. * * @return the storageAccountType value */ @@ -197,7 +197,7 @@ public StorageAccountTypes storageAccountType() { } /** - * Set the storageAccountType value. + * Set specifies the storage account type for the managed disk. Possible values are: Standard_LRS or Premium_LRS. Possible values include: 'Standard_LRS', 'Premium_LRS'. * * @param storageAccountType the storageAccountType value to set * @return the ImageDataDisk object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ImageDiskReference.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ImageDiskReference.java index d2f6c55e2be0..20bcf8095041 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ImageDiskReference.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ImageDiskReference.java @@ -15,7 +15,7 @@ */ public class ImageDiskReference { /** - * A relative uri containing either a Platform Imgage Repository or user + * A relative uri containing either a Platform Image Repository or user * image reference. */ @JsonProperty(value = "id", required = true) @@ -30,7 +30,7 @@ public class ImageDiskReference { private Integer lun; /** - * Get the id value. + * Get a relative uri containing either a Platform Image Repository or user image reference. * * @return the id value */ @@ -39,7 +39,7 @@ public String id() { } /** - * Set the id value. + * Set a relative uri containing either a Platform Image Repository or user image reference. * * @param id the id value to set * @return the ImageDiskReference object itself. @@ -50,7 +50,7 @@ public ImageDiskReference withId(String id) { } /** - * Get the lun value. + * Get if the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null. * * @return the lun value */ @@ -59,7 +59,7 @@ public Integer lun() { } /** - * Set the lun value. + * Set if the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null. * * @param lun the lun value to set * @return the ImageDiskReference object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ImageOSDisk.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ImageOSDisk.java index 0cd5387b9591..60b3b601e782 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ImageOSDisk.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ImageOSDisk.java @@ -76,7 +76,7 @@ public class ImageOSDisk { private StorageAccountTypes storageAccountType; /** - * Get the osType value. + * Get this property allows you to specify the type of the OS that is included in the disk if creating a VM from a custom image. <br><br> Possible values are: <br><br> **Windows** <br><br> **Linux**. Possible values include: 'Windows', 'Linux'. * * @return the osType value */ @@ -85,7 +85,7 @@ public OperatingSystemTypes osType() { } /** - * Set the osType value. + * Set this property allows you to specify the type of the OS that is included in the disk if creating a VM from a custom image. <br><br> Possible values are: <br><br> **Windows** <br><br> **Linux**. Possible values include: 'Windows', 'Linux'. * * @param osType the osType value to set * @return the ImageOSDisk object itself. @@ -96,7 +96,7 @@ public ImageOSDisk withOsType(OperatingSystemTypes osType) { } /** - * Get the osState value. + * Get the OS State. Possible values include: 'Generalized', 'Specialized'. * * @return the osState value */ @@ -105,7 +105,7 @@ public OperatingSystemStateTypes osState() { } /** - * Set the osState value. + * Set the OS State. Possible values include: 'Generalized', 'Specialized'. * * @param osState the osState value to set * @return the ImageOSDisk object itself. @@ -116,7 +116,7 @@ public ImageOSDisk withOsState(OperatingSystemStateTypes osState) { } /** - * Get the snapshot value. + * Get the snapshot. * * @return the snapshot value */ @@ -125,7 +125,7 @@ public SubResource snapshot() { } /** - * Set the snapshot value. + * Set the snapshot. * * @param snapshot the snapshot value to set * @return the ImageOSDisk object itself. @@ -136,7 +136,7 @@ public ImageOSDisk withSnapshot(SubResource snapshot) { } /** - * Get the managedDisk value. + * Get the managedDisk. * * @return the managedDisk value */ @@ -145,7 +145,7 @@ public SubResource managedDisk() { } /** - * Set the managedDisk value. + * Set the managedDisk. * * @param managedDisk the managedDisk value to set * @return the ImageOSDisk object itself. @@ -156,7 +156,7 @@ public ImageOSDisk withManagedDisk(SubResource managedDisk) { } /** - * Get the blobUri value. + * Get the Virtual Hard Disk. * * @return the blobUri value */ @@ -165,7 +165,7 @@ public String blobUri() { } /** - * Set the blobUri value. + * Set the Virtual Hard Disk. * * @param blobUri the blobUri value to set * @return the ImageOSDisk object itself. @@ -176,7 +176,7 @@ public ImageOSDisk withBlobUri(String blobUri) { } /** - * Get the caching value. + * Get specifies the caching requirements. <br><br> Possible values are: <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'None', 'ReadOnly', 'ReadWrite'. * * @return the caching value */ @@ -185,7 +185,7 @@ public CachingTypes caching() { } /** - * Set the caching value. + * Set specifies the caching requirements. <br><br> Possible values are: <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'None', 'ReadOnly', 'ReadWrite'. * * @param caching the caching value to set * @return the ImageOSDisk object itself. @@ -196,7 +196,7 @@ public ImageOSDisk withCaching(CachingTypes caching) { } /** - * Get the diskSizeGB value. + * Get specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image. <br><br> This value cannot be larger than 1023 GB. * * @return the diskSizeGB value */ @@ -205,7 +205,7 @@ public Integer diskSizeGB() { } /** - * Set the diskSizeGB value. + * Set specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image. <br><br> This value cannot be larger than 1023 GB. * * @param diskSizeGB the diskSizeGB value to set * @return the ImageOSDisk object itself. @@ -216,7 +216,7 @@ public ImageOSDisk withDiskSizeGB(Integer diskSizeGB) { } /** - * Get the storageAccountType value. + * Get specifies the storage account type for the managed disk. Possible values are: Standard_LRS or Premium_LRS. Possible values include: 'Standard_LRS', 'Premium_LRS'. * * @return the storageAccountType value */ @@ -225,7 +225,7 @@ public StorageAccountTypes storageAccountType() { } /** - * Set the storageAccountType value. + * Set specifies the storage account type for the managed disk. Possible values are: Standard_LRS or Premium_LRS. Possible values include: 'Standard_LRS', 'Premium_LRS'. * * @param storageAccountType the storageAccountType value to set * @return the ImageOSDisk object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ImageReference.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ImageReference.java index f4628da56b02..8cbce35a6a9d 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ImageReference.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ImageReference.java @@ -50,7 +50,7 @@ public class ImageReference extends SubResource { private String version; /** - * Get the publisher value. + * Get the image publisher. * * @return the publisher value */ @@ -59,7 +59,7 @@ public String publisher() { } /** - * Set the publisher value. + * Set the image publisher. * * @param publisher the publisher value to set * @return the ImageReference object itself. @@ -70,7 +70,7 @@ public ImageReference withPublisher(String publisher) { } /** - * Get the offer value. + * Get specifies the offer of the platform image or marketplace image used to create the virtual machine. * * @return the offer value */ @@ -79,7 +79,7 @@ public String offer() { } /** - * Set the offer value. + * Set specifies the offer of the platform image or marketplace image used to create the virtual machine. * * @param offer the offer value to set * @return the ImageReference object itself. @@ -90,7 +90,7 @@ public ImageReference withOffer(String offer) { } /** - * Get the sku value. + * Get the image SKU. * * @return the sku value */ @@ -99,7 +99,7 @@ public String sku() { } /** - * Set the sku value. + * Set the image SKU. * * @param sku the sku value to set * @return the ImageReference object itself. @@ -110,7 +110,7 @@ public ImageReference withSku(String sku) { } /** - * Get the version value. + * Get specifies the version of the platform image or marketplace image used to create the virtual machine. The allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. Specify 'latest' to use the latest version of an image available at deploy time. Even if you use 'latest', the VM image will not automatically update after deploy time even if a new version becomes available. * * @return the version value */ @@ -119,7 +119,7 @@ public String version() { } /** - * Set the version value. + * Set specifies the version of the platform image or marketplace image used to create the virtual machine. The allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and Build are decimal numbers. Specify 'latest' to use the latest version of an image available at deploy time. Even if you use 'latest', the VM image will not automatically update after deploy time even if a new version becomes available. * * @param version the version value to set * @return the ImageReference object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ImageStorageProfile.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ImageStorageProfile.java index 19ab4673d975..7ea1e6e2d336 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ImageStorageProfile.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ImageStorageProfile.java @@ -34,7 +34,7 @@ public class ImageStorageProfile { private List dataDisks; /** - * Get the osDisk value. + * Get specifies information about the operating system disk used by the virtual machine. <br><br> For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). * * @return the osDisk value */ @@ -43,7 +43,7 @@ public ImageOSDisk osDisk() { } /** - * Set the osDisk value. + * Set specifies information about the operating system disk used by the virtual machine. <br><br> For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). * * @param osDisk the osDisk value to set * @return the ImageStorageProfile object itself. @@ -54,7 +54,7 @@ public ImageStorageProfile withOsDisk(ImageOSDisk osDisk) { } /** - * Get the dataDisks value. + * Get specifies the parameters that are used to add a data disk to a virtual machine. <br><br> For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). * * @return the dataDisks value */ @@ -63,7 +63,7 @@ public List dataDisks() { } /** - * Set the dataDisks value. + * Set specifies the parameters that are used to add a data disk to a virtual machine. <br><br> For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). * * @param dataDisks the dataDisks value to set * @return the ImageStorageProfile object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/InnerError.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/InnerError.java index ef2224356287..39686b773ebb 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/InnerError.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/InnerError.java @@ -27,7 +27,7 @@ public class InnerError { private String errordetail; /** - * Get the exceptiontype value. + * Get the exception type. * * @return the exceptiontype value */ @@ -36,7 +36,7 @@ public String exceptiontype() { } /** - * Set the exceptiontype value. + * Set the exception type. * * @param exceptiontype the exceptiontype value to set * @return the InnerError object itself. @@ -47,7 +47,7 @@ public InnerError withExceptiontype(String exceptiontype) { } /** - * Get the errordetail value. + * Get the internal error message or exception dump. * * @return the errordetail value */ @@ -56,7 +56,7 @@ public String errordetail() { } /** - * Set the errordetail value. + * Set the internal error message or exception dump. * * @param errordetail the errordetail value to set * @return the InnerError object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/InstanceViewStatus.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/InstanceViewStatus.java index 83146dedc4c6..240eb74005ed 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/InstanceViewStatus.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/InstanceViewStatus.java @@ -46,7 +46,7 @@ public class InstanceViewStatus { private DateTime time; /** - * Get the code value. + * Get the status code. * * @return the code value */ @@ -55,7 +55,7 @@ public String code() { } /** - * Set the code value. + * Set the status code. * * @param code the code value to set * @return the InstanceViewStatus object itself. @@ -66,7 +66,7 @@ public InstanceViewStatus withCode(String code) { } /** - * Get the level value. + * Get the level code. Possible values include: 'Info', 'Warning', 'Error'. * * @return the level value */ @@ -75,7 +75,7 @@ public StatusLevelTypes level() { } /** - * Set the level value. + * Set the level code. Possible values include: 'Info', 'Warning', 'Error'. * * @param level the level value to set * @return the InstanceViewStatus object itself. @@ -86,7 +86,7 @@ public InstanceViewStatus withLevel(StatusLevelTypes level) { } /** - * Get the displayStatus value. + * Get the short localizable label for the status. * * @return the displayStatus value */ @@ -95,7 +95,7 @@ public String displayStatus() { } /** - * Set the displayStatus value. + * Set the short localizable label for the status. * * @param displayStatus the displayStatus value to set * @return the InstanceViewStatus object itself. @@ -106,7 +106,7 @@ public InstanceViewStatus withDisplayStatus(String displayStatus) { } /** - * Get the message value. + * Get the detailed status message, including for alerts and error messages. * * @return the message value */ @@ -115,7 +115,7 @@ public String message() { } /** - * Set the message value. + * Set the detailed status message, including for alerts and error messages. * * @param message the message value to set * @return the InstanceViewStatus object itself. @@ -126,7 +126,7 @@ public InstanceViewStatus withMessage(String message) { } /** - * Get the time value. + * Get the time of the status. * * @return the time value */ @@ -135,7 +135,7 @@ public DateTime time() { } /** - * Set the time value. + * Set the time of the status. * * @param time the time value to set * @return the InstanceViewStatus object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/KeyVaultAndKeyReference.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/KeyVaultAndKeyReference.java index 8a0588625b98..fb07a9fba56d 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/KeyVaultAndKeyReference.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/KeyVaultAndKeyReference.java @@ -28,7 +28,7 @@ public class KeyVaultAndKeyReference { private String keyUrl; /** - * Get the sourceVault value. + * Get resource id of the KeyVault containing the key or secret. * * @return the sourceVault value */ @@ -37,7 +37,7 @@ public SourceVault sourceVault() { } /** - * Set the sourceVault value. + * Set resource id of the KeyVault containing the key or secret. * * @param sourceVault the sourceVault value to set * @return the KeyVaultAndKeyReference object itself. @@ -48,7 +48,7 @@ public KeyVaultAndKeyReference withSourceVault(SourceVault sourceVault) { } /** - * Get the keyUrl value. + * Get url pointing to a key or secret in KeyVault. * * @return the keyUrl value */ @@ -57,7 +57,7 @@ public String keyUrl() { } /** - * Set the keyUrl value. + * Set url pointing to a key or secret in KeyVault. * * @param keyUrl the keyUrl value to set * @return the KeyVaultAndKeyReference object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/KeyVaultAndSecretReference.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/KeyVaultAndSecretReference.java index 70aa42302d47..c46874bc4134 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/KeyVaultAndSecretReference.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/KeyVaultAndSecretReference.java @@ -27,7 +27,7 @@ public class KeyVaultAndSecretReference { private String secretUrl; /** - * Get the sourceVault value. + * Get resource id of the KeyVault containing the key or secret. * * @return the sourceVault value */ @@ -36,7 +36,7 @@ public SourceVault sourceVault() { } /** - * Set the sourceVault value. + * Set resource id of the KeyVault containing the key or secret. * * @param sourceVault the sourceVault value to set * @return the KeyVaultAndSecretReference object itself. @@ -47,7 +47,7 @@ public KeyVaultAndSecretReference withSourceVault(SourceVault sourceVault) { } /** - * Get the secretUrl value. + * Get url pointing to a key or secret in KeyVault. * * @return the secretUrl value */ @@ -56,7 +56,7 @@ public String secretUrl() { } /** - * Set the secretUrl value. + * Set url pointing to a key or secret in KeyVault. * * @param secretUrl the secretUrl value to set * @return the KeyVaultAndSecretReference object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/KeyVaultKeyReference.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/KeyVaultKeyReference.java index f8b4d8c2c1f9..30736bb82e39 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/KeyVaultKeyReference.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/KeyVaultKeyReference.java @@ -28,7 +28,7 @@ public class KeyVaultKeyReference { private SubResource sourceVault; /** - * Get the keyUrl value. + * Get the URL referencing a key encryption key in Key Vault. * * @return the keyUrl value */ @@ -37,7 +37,7 @@ public String keyUrl() { } /** - * Set the keyUrl value. + * Set the URL referencing a key encryption key in Key Vault. * * @param keyUrl the keyUrl value to set * @return the KeyVaultKeyReference object itself. @@ -48,7 +48,7 @@ public KeyVaultKeyReference withKeyUrl(String keyUrl) { } /** - * Get the sourceVault value. + * Get the relative URL of the Key Vault containing the key. * * @return the sourceVault value */ @@ -57,7 +57,7 @@ public SubResource sourceVault() { } /** - * Set the sourceVault value. + * Set the relative URL of the Key Vault containing the key. * * @param sourceVault the sourceVault value to set * @return the KeyVaultKeyReference object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/KeyVaultSecretReference.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/KeyVaultSecretReference.java index d0cbec1e2153..0a197e6eee37 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/KeyVaultSecretReference.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/KeyVaultSecretReference.java @@ -28,7 +28,7 @@ public class KeyVaultSecretReference { private SubResource sourceVault; /** - * Get the secretUrl value. + * Get the URL referencing a secret in a Key Vault. * * @return the secretUrl value */ @@ -37,7 +37,7 @@ public String secretUrl() { } /** - * Set the secretUrl value. + * Set the URL referencing a secret in a Key Vault. * * @param secretUrl the secretUrl value to set * @return the KeyVaultSecretReference object itself. @@ -48,7 +48,7 @@ public KeyVaultSecretReference withSecretUrl(String secretUrl) { } /** - * Get the sourceVault value. + * Get the relative URL of the Key Vault containing the secret. * * @return the sourceVault value */ @@ -57,7 +57,7 @@ public SubResource sourceVault() { } /** - * Set the sourceVault value. + * Set the relative URL of the Key Vault containing the secret. * * @param sourceVault the sourceVault value to set * @return the KeyVaultSecretReference object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/LinuxConfiguration.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/LinuxConfiguration.java index d7056f9e7d77..c0a4276fa73c 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/LinuxConfiguration.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/LinuxConfiguration.java @@ -33,7 +33,7 @@ public class LinuxConfiguration { private SshConfiguration ssh; /** - * Get the disablePasswordAuthentication value. + * Get specifies whether password authentication should be disabled. * * @return the disablePasswordAuthentication value */ @@ -42,7 +42,7 @@ public Boolean disablePasswordAuthentication() { } /** - * Set the disablePasswordAuthentication value. + * Set specifies whether password authentication should be disabled. * * @param disablePasswordAuthentication the disablePasswordAuthentication value to set * @return the LinuxConfiguration object itself. @@ -53,7 +53,7 @@ public LinuxConfiguration withDisablePasswordAuthentication(Boolean disablePassw } /** - * Get the ssh value. + * Get specifies the ssh key configuration for a Linux OS. * * @return the ssh value */ @@ -62,7 +62,7 @@ public SshConfiguration ssh() { } /** - * Set the ssh value. + * Set specifies the ssh key configuration for a Linux OS. * * @param ssh the ssh value to set * @return the LinuxConfiguration object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/MaintenanceRedeployStatus.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/MaintenanceRedeployStatus.java index fa0a4b0a5f13..17ec8ba75fa0 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/MaintenanceRedeployStatus.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/MaintenanceRedeployStatus.java @@ -59,7 +59,7 @@ public class MaintenanceRedeployStatus { private String lastOperationMessage; /** - * Get the isCustomerInitiatedMaintenanceAllowed value. + * Get true, if customer is allowed to perform Maintenance. * * @return the isCustomerInitiatedMaintenanceAllowed value */ @@ -68,7 +68,7 @@ public Boolean isCustomerInitiatedMaintenanceAllowed() { } /** - * Set the isCustomerInitiatedMaintenanceAllowed value. + * Set true, if customer is allowed to perform Maintenance. * * @param isCustomerInitiatedMaintenanceAllowed the isCustomerInitiatedMaintenanceAllowed value to set * @return the MaintenanceRedeployStatus object itself. @@ -79,7 +79,7 @@ public MaintenanceRedeployStatus withIsCustomerInitiatedMaintenanceAllowed(Boole } /** - * Get the preMaintenanceWindowStartTime value. + * Get start Time for the Pre Maintenance Window. * * @return the preMaintenanceWindowStartTime value */ @@ -88,7 +88,7 @@ public DateTime preMaintenanceWindowStartTime() { } /** - * Set the preMaintenanceWindowStartTime value. + * Set start Time for the Pre Maintenance Window. * * @param preMaintenanceWindowStartTime the preMaintenanceWindowStartTime value to set * @return the MaintenanceRedeployStatus object itself. @@ -99,7 +99,7 @@ public MaintenanceRedeployStatus withPreMaintenanceWindowStartTime(DateTime preM } /** - * Get the preMaintenanceWindowEndTime value. + * Get end Time for the Pre Maintenance Window. * * @return the preMaintenanceWindowEndTime value */ @@ -108,7 +108,7 @@ public DateTime preMaintenanceWindowEndTime() { } /** - * Set the preMaintenanceWindowEndTime value. + * Set end Time for the Pre Maintenance Window. * * @param preMaintenanceWindowEndTime the preMaintenanceWindowEndTime value to set * @return the MaintenanceRedeployStatus object itself. @@ -119,7 +119,7 @@ public MaintenanceRedeployStatus withPreMaintenanceWindowEndTime(DateTime preMai } /** - * Get the maintenanceWindowStartTime value. + * Get start Time for the Maintenance Window. * * @return the maintenanceWindowStartTime value */ @@ -128,7 +128,7 @@ public DateTime maintenanceWindowStartTime() { } /** - * Set the maintenanceWindowStartTime value. + * Set start Time for the Maintenance Window. * * @param maintenanceWindowStartTime the maintenanceWindowStartTime value to set * @return the MaintenanceRedeployStatus object itself. @@ -139,7 +139,7 @@ public MaintenanceRedeployStatus withMaintenanceWindowStartTime(DateTime mainten } /** - * Get the maintenanceWindowEndTime value. + * Get end Time for the Maintenance Window. * * @return the maintenanceWindowEndTime value */ @@ -148,7 +148,7 @@ public DateTime maintenanceWindowEndTime() { } /** - * Set the maintenanceWindowEndTime value. + * Set end Time for the Maintenance Window. * * @param maintenanceWindowEndTime the maintenanceWindowEndTime value to set * @return the MaintenanceRedeployStatus object itself. @@ -159,7 +159,7 @@ public MaintenanceRedeployStatus withMaintenanceWindowEndTime(DateTime maintenan } /** - * Get the lastOperationResultCode value. + * Get the Last Maintenance Operation Result Code. Possible values include: 'None', 'RetryLater', 'MaintenanceAborted', 'MaintenanceCompleted'. * * @return the lastOperationResultCode value */ @@ -168,7 +168,7 @@ public MaintenanceOperationResultCodeTypes lastOperationResultCode() { } /** - * Set the lastOperationResultCode value. + * Set the Last Maintenance Operation Result Code. Possible values include: 'None', 'RetryLater', 'MaintenanceAborted', 'MaintenanceCompleted'. * * @param lastOperationResultCode the lastOperationResultCode value to set * @return the MaintenanceRedeployStatus object itself. @@ -179,7 +179,7 @@ public MaintenanceRedeployStatus withLastOperationResultCode(MaintenanceOperatio } /** - * Get the lastOperationMessage value. + * Get message returned for the last Maintenance Operation. * * @return the lastOperationMessage value */ @@ -188,7 +188,7 @@ public String lastOperationMessage() { } /** - * Set the lastOperationMessage value. + * Set message returned for the last Maintenance Operation. * * @param lastOperationMessage the lastOperationMessage value to set * @return the MaintenanceRedeployStatus object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ManagedDiskParameters.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ManagedDiskParameters.java index 6d69039603bb..36f65fc88c69 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ManagedDiskParameters.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ManagedDiskParameters.java @@ -24,7 +24,7 @@ public class ManagedDiskParameters extends SubResource { private StorageAccountTypes storageAccountType; /** - * Get the storageAccountType value. + * Get specifies the storage account type for the managed disk. Possible values are: Standard_LRS or Premium_LRS. Possible values include: 'Standard_LRS', 'Premium_LRS'. * * @return the storageAccountType value */ @@ -33,7 +33,7 @@ public StorageAccountTypes storageAccountType() { } /** - * Set the storageAccountType value. + * Set specifies the storage account type for the managed disk. Possible values are: Standard_LRS or Premium_LRS. Possible values include: 'Standard_LRS', 'Premium_LRS'. * * @param storageAccountType the storageAccountType value to set * @return the ManagedDiskParameters object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/NetworkInterfaceReference.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/NetworkInterfaceReference.java index 8553d6aa81d4..5225efaa0f5b 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/NetworkInterfaceReference.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/NetworkInterfaceReference.java @@ -25,7 +25,7 @@ public class NetworkInterfaceReference extends SubResource { private Boolean primary; /** - * Get the primary value. + * Get specifies the primary network interface in case the virtual machine has more than 1 network interface. * * @return the primary value */ @@ -34,7 +34,7 @@ public Boolean primary() { } /** - * Set the primary value. + * Set specifies the primary network interface in case the virtual machine has more than 1 network interface. * * @param primary the primary value to set * @return the NetworkInterfaceReference object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/NetworkProfile.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/NetworkProfile.java index e8edfe4a7620..d36ed30525f7 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/NetworkProfile.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/NetworkProfile.java @@ -23,7 +23,7 @@ public class NetworkProfile { private List networkInterfaces; /** - * Get the networkInterfaces value. + * Get specifies the list of resource Ids for the network interfaces associated with the virtual machine. * * @return the networkInterfaces value */ @@ -32,7 +32,7 @@ public List networkInterfaces() { } /** - * Set the networkInterfaces value. + * Set specifies the list of resource Ids for the network interfaces associated with the virtual machine. * * @param networkInterfaces the networkInterfaces value to set * @return the NetworkProfile object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/OSDisk.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/OSDisk.java index a0d129ab063f..0f9e8bbf9876 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/OSDisk.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/OSDisk.java @@ -80,7 +80,7 @@ public class OSDisk { /** * Specifies the size of an empty data disk in gigabytes. This element can - * be used to overwrite the name of the disk in a virtual machine image. + * be used to overwrite the size of the disk in a virtual machine image. * <br><br> This value cannot be larger than 1023 GB. */ @JsonProperty(value = "diskSizeGB") @@ -93,7 +93,7 @@ public class OSDisk { private ManagedDiskParameters managedDisk; /** - * Get the osType value. + * Get this property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD. <br><br> Possible values are: <br><br> **Windows** <br><br> **Linux**. Possible values include: 'Windows', 'Linux'. * * @return the osType value */ @@ -102,7 +102,7 @@ public OperatingSystemTypes osType() { } /** - * Set the osType value. + * Set this property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD. <br><br> Possible values are: <br><br> **Windows** <br><br> **Linux**. Possible values include: 'Windows', 'Linux'. * * @param osType the osType value to set * @return the OSDisk object itself. @@ -113,7 +113,7 @@ public OSDisk withOsType(OperatingSystemTypes osType) { } /** - * Get the encryptionSettings value. + * Get specifies the encryption settings for the OS Disk. <br><br> Minimum api-version: 2015-06-15. * * @return the encryptionSettings value */ @@ -122,7 +122,7 @@ public DiskEncryptionSettings encryptionSettings() { } /** - * Set the encryptionSettings value. + * Set specifies the encryption settings for the OS Disk. <br><br> Minimum api-version: 2015-06-15. * * @param encryptionSettings the encryptionSettings value to set * @return the OSDisk object itself. @@ -133,7 +133,7 @@ public OSDisk withEncryptionSettings(DiskEncryptionSettings encryptionSettings) } /** - * Get the name value. + * Get the disk name. * * @return the name value */ @@ -142,7 +142,7 @@ public String name() { } /** - * Set the name value. + * Set the disk name. * * @param name the name value to set * @return the OSDisk object itself. @@ -153,7 +153,7 @@ public OSDisk withName(String name) { } /** - * Get the vhd value. + * Get the virtual hard disk. * * @return the vhd value */ @@ -162,7 +162,7 @@ public VirtualHardDisk vhd() { } /** - * Set the vhd value. + * Set the virtual hard disk. * * @param vhd the vhd value to set * @return the OSDisk object itself. @@ -173,7 +173,7 @@ public OSDisk withVhd(VirtualHardDisk vhd) { } /** - * Get the image value. + * Get the source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist. * * @return the image value */ @@ -182,7 +182,7 @@ public VirtualHardDisk image() { } /** - * Set the image value. + * Set the source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist. * * @param image the image value to set * @return the OSDisk object itself. @@ -193,7 +193,7 @@ public OSDisk withImage(VirtualHardDisk image) { } /** - * Get the caching value. + * Get specifies the caching requirements. <br><br> Possible values are: <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'None', 'ReadOnly', 'ReadWrite'. * * @return the caching value */ @@ -202,7 +202,7 @@ public CachingTypes caching() { } /** - * Set the caching value. + * Set specifies the caching requirements. <br><br> Possible values are: <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'None', 'ReadOnly', 'ReadWrite'. * * @param caching the caching value to set * @return the OSDisk object itself. @@ -213,7 +213,7 @@ public OSDisk withCaching(CachingTypes caching) { } /** - * Get the createOption value. + * Get specifies how the virtual machine should be created.<br><br> Possible values are:<br><br> **Attach** \u2013 This value is used when you are using a specialized disk to create the virtual machine.<br><br> **FromImage** \u2013 This value is used when you are using an image to create the virtual machine. If you are using a platform image, you also use the imageReference element described above. If you are using a marketplace image, you also use the plan element previously described. Possible values include: 'FromImage', 'Empty', 'Attach'. * * @return the createOption value */ @@ -222,7 +222,7 @@ public DiskCreateOptionTypes createOption() { } /** - * Set the createOption value. + * Set specifies how the virtual machine should be created.<br><br> Possible values are:<br><br> **Attach** \u2013 This value is used when you are using a specialized disk to create the virtual machine.<br><br> **FromImage** \u2013 This value is used when you are using an image to create the virtual machine. If you are using a platform image, you also use the imageReference element described above. If you are using a marketplace image, you also use the plan element previously described. Possible values include: 'FromImage', 'Empty', 'Attach'. * * @param createOption the createOption value to set * @return the OSDisk object itself. @@ -233,7 +233,7 @@ public OSDisk withCreateOption(DiskCreateOptionTypes createOption) { } /** - * Get the diskSizeGB value. + * Get specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image. <br><br> This value cannot be larger than 1023 GB. * * @return the diskSizeGB value */ @@ -242,7 +242,7 @@ public Integer diskSizeGB() { } /** - * Set the diskSizeGB value. + * Set specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image. <br><br> This value cannot be larger than 1023 GB. * * @param diskSizeGB the diskSizeGB value to set * @return the OSDisk object itself. @@ -253,7 +253,7 @@ public OSDisk withDiskSizeGB(Integer diskSizeGB) { } /** - * Get the managedDisk value. + * Get the managed disk parameters. * * @return the managedDisk value */ @@ -262,7 +262,7 @@ public ManagedDiskParameters managedDisk() { } /** - * Set the managedDisk value. + * Set the managed disk parameters. * * @param managedDisk the managedDisk value to set * @return the OSDisk object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/OSDiskImage.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/OSDiskImage.java index b6b6c778503b..2d200db4f14f 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/OSDiskImage.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/OSDiskImage.java @@ -22,7 +22,7 @@ public class OSDiskImage { private OperatingSystemTypes operatingSystem; /** - * Get the operatingSystem value. + * Get the operating system of the osDiskImage. Possible values include: 'Windows', 'Linux'. * * @return the operatingSystem value */ @@ -31,7 +31,7 @@ public OperatingSystemTypes operatingSystem() { } /** - * Set the operatingSystem value. + * Set the operating system of the osDiskImage. Possible values include: 'Windows', 'Linux'. * * @param operatingSystem the operatingSystem value to set * @return the OSDiskImage object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/OSProfile.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/OSProfile.java index 372f280d6665..945a19d7167c 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/OSProfile.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/OSProfile.java @@ -17,10 +17,11 @@ public class OSProfile { /** * Specifies the host OS name of the virtual machine. <br><br> - * **Max-length (Windows):** 15 characters <br><br> - * **Max-length (Linux):** 64 characters. <br><br> For naming - * conventions and restrictions see [Azure infrastructure services - * implementation + * This name cannot be updated after the VM is created. + * <br><br> **Max-length (Windows):** 15 characters + * <br><br> **Max-length (Linux):** 64 characters. + * <br><br> For naming conventions and restrictions see [Azure + * infrastructure services implementation * guidelines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-infrastructure-subscription-accounts-guidelines?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#1-naming-conventions). */ @JsonProperty(value = "computerName") @@ -106,7 +107,7 @@ public class OSProfile { private List secrets; /** - * Get the computerName value. + * Get specifies the host OS name of the virtual machine. <br><br> This name cannot be updated after the VM is created. <br><br> **Max-length (Windows):** 15 characters <br><br> **Max-length (Linux):** 64 characters. <br><br> For naming conventions and restrictions see [Azure infrastructure services implementation guidelines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-infrastructure-subscription-accounts-guidelines?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#1-naming-conventions). * * @return the computerName value */ @@ -115,7 +116,7 @@ public String computerName() { } /** - * Set the computerName value. + * Set specifies the host OS name of the virtual machine. <br><br> This name cannot be updated after the VM is created. <br><br> **Max-length (Windows):** 15 characters <br><br> **Max-length (Linux):** 64 characters. <br><br> For naming conventions and restrictions see [Azure infrastructure services implementation guidelines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-infrastructure-subscription-accounts-guidelines?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#1-naming-conventions). * * @param computerName the computerName value to set * @return the OSProfile object itself. @@ -126,7 +127,7 @@ public OSProfile withComputerName(String computerName) { } /** - * Get the adminUsername value. + * Get specifies the name of the administrator account. <br><br> **Windows-only restriction:** Cannot end in "." <br><br> **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". <br><br> **Minimum-length (Linux):** 1 character <br><br> **Max-length (Linux):** 64 characters <br><br> **Max-length (Windows):** 20 characters <br><br><li> For root access to the Linux VM, see [Using root privileges on Linux virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-use-root-privileges?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)<br><li> For a list of built-in system users on Linux that should not be used in this field, see [Selecting User Names for Linux on Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-usernames?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). * * @return the adminUsername value */ @@ -135,7 +136,7 @@ public String adminUsername() { } /** - * Set the adminUsername value. + * Set specifies the name of the administrator account. <br><br> **Windows-only restriction:** Cannot end in "." <br><br> **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". <br><br> **Minimum-length (Linux):** 1 character <br><br> **Max-length (Linux):** 64 characters <br><br> **Max-length (Windows):** 20 characters <br><br><li> For root access to the Linux VM, see [Using root privileges on Linux virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-use-root-privileges?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)<br><li> For a list of built-in system users on Linux that should not be used in this field, see [Selecting User Names for Linux on Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-usernames?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). * * @param adminUsername the adminUsername value to set * @return the OSProfile object itself. @@ -146,7 +147,7 @@ public OSProfile withAdminUsername(String adminUsername) { } /** - * Get the adminPassword value. + * Get specifies the password of the administrator account. <br><br> **Minimum-length (Windows):** 8 characters <br><br> **Minimum-length (Linux):** 6 characters <br><br> **Max-length (Windows):** 123 characters <br><br> **Max-length (Linux):** 72 characters <br><br> **Complexity requirements:** 3 out of 4 conditions below need to be fulfilled <br> Has lower characters <br>Has upper characters <br> Has a digit <br> Has a special character (Regex match [\W_]) <br><br> **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" <br><br> For resetting the password, see [How to reset the Remote Desktop service or its login password in a Windows VM](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-reset-rdp?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) <br><br> For resetting root password, see [Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-vmaccess-extension?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#reset-root-password). * * @return the adminPassword value */ @@ -155,7 +156,7 @@ public String adminPassword() { } /** - * Set the adminPassword value. + * Set specifies the password of the administrator account. <br><br> **Minimum-length (Windows):** 8 characters <br><br> **Minimum-length (Linux):** 6 characters <br><br> **Max-length (Windows):** 123 characters <br><br> **Max-length (Linux):** 72 characters <br><br> **Complexity requirements:** 3 out of 4 conditions below need to be fulfilled <br> Has lower characters <br>Has upper characters <br> Has a digit <br> Has a special character (Regex match [\W_]) <br><br> **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" <br><br> For resetting the password, see [How to reset the Remote Desktop service or its login password in a Windows VM](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-reset-rdp?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) <br><br> For resetting root password, see [Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-vmaccess-extension?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#reset-root-password). * * @param adminPassword the adminPassword value to set * @return the OSProfile object itself. @@ -166,7 +167,7 @@ public OSProfile withAdminPassword(String adminPassword) { } /** - * Get the customData value. + * Get specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. <br><br> For using cloud-init for your VM, see [Using cloud-init to customize a Linux VM during creation](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-cloud-init?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). * * @return the customData value */ @@ -175,7 +176,7 @@ public String customData() { } /** - * Set the customData value. + * Set specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. <br><br> For using cloud-init for your VM, see [Using cloud-init to customize a Linux VM during creation](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-cloud-init?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). * * @param customData the customData value to set * @return the OSProfile object itself. @@ -186,7 +187,7 @@ public OSProfile withCustomData(String customData) { } /** - * Get the windowsConfiguration value. + * Get specifies Windows operating system settings on the virtual machine. * * @return the windowsConfiguration value */ @@ -195,7 +196,7 @@ public WindowsConfiguration windowsConfiguration() { } /** - * Set the windowsConfiguration value. + * Set specifies Windows operating system settings on the virtual machine. * * @param windowsConfiguration the windowsConfiguration value to set * @return the OSProfile object itself. @@ -206,7 +207,7 @@ public OSProfile withWindowsConfiguration(WindowsConfiguration windowsConfigurat } /** - * Get the linuxConfiguration value. + * Get specifies the Linux operating system settings on the virtual machine. <br><br>For a list of supported Linux distributions, see [Linux on Azure-Endorsed Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) <br><br> For running non-endorsed distributions, see [Information for Non-Endorsed Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-create-upload-generic?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). * * @return the linuxConfiguration value */ @@ -215,7 +216,7 @@ public LinuxConfiguration linuxConfiguration() { } /** - * Set the linuxConfiguration value. + * Set specifies the Linux operating system settings on the virtual machine. <br><br>For a list of supported Linux distributions, see [Linux on Azure-Endorsed Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) <br><br> For running non-endorsed distributions, see [Information for Non-Endorsed Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-create-upload-generic?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). * * @param linuxConfiguration the linuxConfiguration value to set * @return the OSProfile object itself. @@ -226,7 +227,7 @@ public OSProfile withLinuxConfiguration(LinuxConfiguration linuxConfiguration) { } /** - * Get the secrets value. + * Get specifies set of certificates that should be installed onto the virtual machine. * * @return the secrets value */ @@ -235,7 +236,7 @@ public List secrets() { } /** - * Set the secrets value. + * Set specifies set of certificates that should be installed onto the virtual machine. * * @param secrets the secrets value to set * @return the OSProfile object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/Plan.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/Plan.java index ea8af0465e33..b3c52da364c1 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/Plan.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/Plan.java @@ -45,7 +45,7 @@ public class Plan { private String promotionCode; /** - * Get the name value. + * Get the plan ID. * * @return the name value */ @@ -54,7 +54,7 @@ public String name() { } /** - * Set the name value. + * Set the plan ID. * * @param name the name value to set * @return the Plan object itself. @@ -65,7 +65,7 @@ public Plan withName(String name) { } /** - * Get the publisher value. + * Get the publisher ID. * * @return the publisher value */ @@ -74,7 +74,7 @@ public String publisher() { } /** - * Set the publisher value. + * Set the publisher ID. * * @param publisher the publisher value to set * @return the Plan object itself. @@ -85,7 +85,7 @@ public Plan withPublisher(String publisher) { } /** - * Get the product value. + * Get specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element. * * @return the product value */ @@ -94,7 +94,7 @@ public String product() { } /** - * Set the product value. + * Set specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element. * * @param product the product value to set * @return the Plan object itself. @@ -105,7 +105,7 @@ public Plan withProduct(String product) { } /** - * Get the promotionCode value. + * Get the promotion code. * * @return the promotionCode value */ @@ -114,7 +114,7 @@ public String promotionCode() { } /** - * Set the promotionCode value. + * Set the promotion code. * * @param promotionCode the promotionCode value to set * @return the Plan object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/PurchasePlan.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/PurchasePlan.java index c6b8b38373d6..80dd7929dda2 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/PurchasePlan.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/PurchasePlan.java @@ -35,7 +35,7 @@ public class PurchasePlan { private String product; /** - * Get the publisher value. + * Get the publisher ID. * * @return the publisher value */ @@ -44,7 +44,7 @@ public String publisher() { } /** - * Set the publisher value. + * Set the publisher ID. * * @param publisher the publisher value to set * @return the PurchasePlan object itself. @@ -55,7 +55,7 @@ public PurchasePlan withPublisher(String publisher) { } /** - * Get the name value. + * Get the plan ID. * * @return the name value */ @@ -64,7 +64,7 @@ public String name() { } /** - * Set the name value. + * Set the plan ID. * * @param name the name value to set * @return the PurchasePlan object itself. @@ -75,7 +75,7 @@ public PurchasePlan withName(String name) { } /** - * Get the product value. + * Get specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element. * * @return the product value */ @@ -84,7 +84,7 @@ public String product() { } /** - * Set the product value. + * Set specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element. * * @param product the product value to set * @return the PurchasePlan object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ResourceSkuCapabilities.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ResourceSkuCapabilities.java index a1f98845a923..4fadb756478e 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ResourceSkuCapabilities.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ResourceSkuCapabilities.java @@ -11,7 +11,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * Describes The SKU capabilites object. + * Describes The SKU capabilities object. */ public class ResourceSkuCapabilities { /** @@ -27,7 +27,7 @@ public class ResourceSkuCapabilities { private String value; /** - * Get the name value. + * Get an invariant to describe the feature. * * @return the name value */ @@ -36,7 +36,7 @@ public String name() { } /** - * Get the value value. + * Get an invariant if the feature is measured by quantity. * * @return the value value */ diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ResourceSkuCapacity.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ResourceSkuCapacity.java index b92ad333bcb4..2d9e7390ae82 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ResourceSkuCapacity.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ResourceSkuCapacity.java @@ -40,7 +40,7 @@ public class ResourceSkuCapacity { private ResourceSkuCapacityScaleType scaleType; /** - * Get the minimum value. + * Get the minimum capacity. * * @return the minimum value */ @@ -49,7 +49,7 @@ public Long minimum() { } /** - * Get the maximum value. + * Get the maximum capacity that can be set. * * @return the maximum value */ @@ -58,7 +58,7 @@ public Long maximum() { } /** - * Get the defaultProperty value. + * Get the default capacity. * * @return the defaultProperty value */ @@ -67,7 +67,7 @@ public Long defaultProperty() { } /** - * Get the scaleType value. + * Get the scale type applicable to the sku. Possible values include: 'Automatic', 'Manual', 'None'. * * @return the scaleType value */ diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ResourceSkuCosts.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ResourceSkuCosts.java index 49fa4c8f3afd..6971aecc0acd 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ResourceSkuCosts.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ResourceSkuCosts.java @@ -33,7 +33,7 @@ public class ResourceSkuCosts { private String extendedUnit; /** - * Get the meterID value. + * Get used for querying price from commerce. * * @return the meterID value */ @@ -42,7 +42,7 @@ public String meterID() { } /** - * Get the quantity value. + * Get the multiplier is needed to extend the base metered cost. * * @return the quantity value */ @@ -51,7 +51,7 @@ public Long quantity() { } /** - * Get the extendedUnit value. + * Get an invariant to show the extended unit. * * @return the extendedUnit value */ diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ResourceSkuRestrictions.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ResourceSkuRestrictions.java index fadb25ca8a34..ac2193609bbb 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ResourceSkuRestrictions.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ResourceSkuRestrictions.java @@ -36,7 +36,7 @@ public class ResourceSkuRestrictions { private ResourceSkuRestrictionsReasonCode reasonCode; /** - * Get the type value. + * Get the type of restrictions. Possible values include: 'Location'. * * @return the type value */ @@ -45,7 +45,7 @@ public ResourceSkuRestrictionsType type() { } /** - * Get the values value. + * Get the value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. * * @return the values value */ @@ -54,7 +54,7 @@ public List values() { } /** - * Get the reasonCode value. + * Get the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. * * @return the reasonCode value */ diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ResourceUpdate.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ResourceUpdate.java index 43b53a0b09d0..fe5c6e388b0e 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ResourceUpdate.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/ResourceUpdate.java @@ -28,7 +28,7 @@ public class ResourceUpdate { private DiskSku sku; /** - * Get the tags value. + * Get resource tags. * * @return the tags value */ @@ -37,7 +37,7 @@ public Map tags() { } /** - * Set the tags value. + * Set resource tags. * * @param tags the tags value to set * @return the ResourceUpdate object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/RollingUpgradePolicy.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/RollingUpgradePolicy.java index 0c2047938a13..3bc1dcee0c74 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/RollingUpgradePolicy.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/RollingUpgradePolicy.java @@ -53,7 +53,7 @@ public class RollingUpgradePolicy { private String pauseTimeBetweenBatches; /** - * Get the maxBatchInstancePercent value. + * Get the maximum percent of total virtual machine instances that will be upgraded simultaneously by the rolling upgrade in one batch. As this is a maximum, unhealthy instances in previous or future batches can cause the percentage of instances in a batch to decrease to ensure higher reliability. The default value for this parameter is 20%. * * @return the maxBatchInstancePercent value */ @@ -62,7 +62,7 @@ public Integer maxBatchInstancePercent() { } /** - * Set the maxBatchInstancePercent value. + * Set the maximum percent of total virtual machine instances that will be upgraded simultaneously by the rolling upgrade in one batch. As this is a maximum, unhealthy instances in previous or future batches can cause the percentage of instances in a batch to decrease to ensure higher reliability. The default value for this parameter is 20%. * * @param maxBatchInstancePercent the maxBatchInstancePercent value to set * @return the RollingUpgradePolicy object itself. @@ -73,7 +73,7 @@ public RollingUpgradePolicy withMaxBatchInstancePercent(Integer maxBatchInstance } /** - * Get the maxUnhealthyInstancePercent value. + * Get the maximum percentage of the total virtual machine instances in the scale set that can be simultaneously unhealthy, either as a result of being upgraded, or by being found in an unhealthy state by the virtual machine health checks before the rolling upgrade aborts. This constraint will be checked prior to starting any batch. The default value for this parameter is 20%. * * @return the maxUnhealthyInstancePercent value */ @@ -82,7 +82,7 @@ public Integer maxUnhealthyInstancePercent() { } /** - * Set the maxUnhealthyInstancePercent value. + * Set the maximum percentage of the total virtual machine instances in the scale set that can be simultaneously unhealthy, either as a result of being upgraded, or by being found in an unhealthy state by the virtual machine health checks before the rolling upgrade aborts. This constraint will be checked prior to starting any batch. The default value for this parameter is 20%. * * @param maxUnhealthyInstancePercent the maxUnhealthyInstancePercent value to set * @return the RollingUpgradePolicy object itself. @@ -93,7 +93,7 @@ public RollingUpgradePolicy withMaxUnhealthyInstancePercent(Integer maxUnhealthy } /** - * Get the maxUnhealthyUpgradedInstancePercent value. + * Get the maximum percentage of upgraded virtual machine instances that can be found to be in an unhealthy state. This check will happen after each batch is upgraded. If this percentage is ever exceeded, the rolling update aborts. The default value for this parameter is 20%. * * @return the maxUnhealthyUpgradedInstancePercent value */ @@ -102,7 +102,7 @@ public Integer maxUnhealthyUpgradedInstancePercent() { } /** - * Set the maxUnhealthyUpgradedInstancePercent value. + * Set the maximum percentage of upgraded virtual machine instances that can be found to be in an unhealthy state. This check will happen after each batch is upgraded. If this percentage is ever exceeded, the rolling update aborts. The default value for this parameter is 20%. * * @param maxUnhealthyUpgradedInstancePercent the maxUnhealthyUpgradedInstancePercent value to set * @return the RollingUpgradePolicy object itself. @@ -113,7 +113,7 @@ public RollingUpgradePolicy withMaxUnhealthyUpgradedInstancePercent(Integer maxU } /** - * Get the pauseTimeBetweenBatches value. + * Get the wait time between completing the update for all virtual machines in one batch and starting the next batch. The time duration should be specified in ISO 8601 format. The default value is 0 seconds (PT0S). * * @return the pauseTimeBetweenBatches value */ @@ -122,7 +122,7 @@ public String pauseTimeBetweenBatches() { } /** - * Set the pauseTimeBetweenBatches value. + * Set the wait time between completing the update for all virtual machines in one batch and starting the next batch. The time duration should be specified in ISO 8601 format. The default value is 0 seconds (PT0S). * * @param pauseTimeBetweenBatches the pauseTimeBetweenBatches value to set * @return the RollingUpgradePolicy object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/RollingUpgradeProgressInfo.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/RollingUpgradeProgressInfo.java index c40663aaf727..b0fd0131324c 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/RollingUpgradeProgressInfo.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/RollingUpgradeProgressInfo.java @@ -40,7 +40,7 @@ public class RollingUpgradeProgressInfo { private Integer pendingInstanceCount; /** - * Get the successfulInstanceCount value. + * Get the number of instances that have been successfully upgraded. * * @return the successfulInstanceCount value */ @@ -49,7 +49,7 @@ public Integer successfulInstanceCount() { } /** - * Get the failedInstanceCount value. + * Get the number of instances that have failed to be upgraded successfully. * * @return the failedInstanceCount value */ @@ -58,7 +58,7 @@ public Integer failedInstanceCount() { } /** - * Get the inProgressInstanceCount value. + * Get the number of instances that are currently being upgraded. * * @return the inProgressInstanceCount value */ @@ -67,7 +67,7 @@ public Integer inProgressInstanceCount() { } /** - * Get the pendingInstanceCount value. + * Get the number of instances that have not yet begun to be upgraded. * * @return the pendingInstanceCount value */ diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/RollingUpgradeRunningStatus.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/RollingUpgradeRunningStatus.java index 1d87ba6ae4a7..91eba7a0cca2 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/RollingUpgradeRunningStatus.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/RollingUpgradeRunningStatus.java @@ -42,7 +42,7 @@ public class RollingUpgradeRunningStatus { private DateTime lastActionTime; /** - * Get the code value. + * Get code indicating the current status of the upgrade. Possible values include: 'RollingForward', 'Cancelled', 'Completed', 'Faulted'. * * @return the code value */ @@ -51,7 +51,7 @@ public RollingUpgradeStatusCode code() { } /** - * Get the startTime value. + * Get start time of the upgrade. * * @return the startTime value */ @@ -60,7 +60,7 @@ public DateTime startTime() { } /** - * Get the lastAction value. + * Get the last action performed on the rolling upgrade. Possible values include: 'Start', 'Cancel'. * * @return the lastAction value */ @@ -69,7 +69,7 @@ public RollingUpgradeActionType lastAction() { } /** - * Get the lastActionTime value. + * Get last action time of the upgrade. * * @return the lastActionTime value */ diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/RunCommandInput.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/RunCommandInput.java index 9ce3c32a0a64..437a4987ab84 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/RunCommandInput.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/RunCommandInput.java @@ -35,7 +35,7 @@ public class RunCommandInput { private List parameters; /** - * Get the commandId value. + * Get the run command id. * * @return the commandId value */ @@ -44,7 +44,7 @@ public String commandId() { } /** - * Set the commandId value. + * Set the run command id. * * @param commandId the commandId value to set * @return the RunCommandInput object itself. @@ -55,7 +55,7 @@ public RunCommandInput withCommandId(String commandId) { } /** - * Get the script value. + * Get optional. The script to be executed. When this value is given, the given script will override the default script of the command. * * @return the script value */ @@ -64,7 +64,7 @@ public List script() { } /** - * Set the script value. + * Set optional. The script to be executed. When this value is given, the given script will override the default script of the command. * * @param script the script value to set * @return the RunCommandInput object itself. @@ -75,7 +75,7 @@ public RunCommandInput withScript(List script) { } /** - * Get the parameters value. + * Get the run command parameters. * * @return the parameters value */ @@ -84,7 +84,7 @@ public List parameters() { } /** - * Set the parameters value. + * Set the run command parameters. * * @param parameters the parameters value to set * @return the RunCommandInput object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/RunCommandInputParameter.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/RunCommandInputParameter.java index 39d60c16004c..8d344b7a2961 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/RunCommandInputParameter.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/RunCommandInputParameter.java @@ -27,7 +27,7 @@ public class RunCommandInputParameter { private String value; /** - * Get the name value. + * Get the run command parameter name. * * @return the name value */ @@ -36,7 +36,7 @@ public String name() { } /** - * Set the name value. + * Set the run command parameter name. * * @param name the name value to set * @return the RunCommandInputParameter object itself. @@ -47,7 +47,7 @@ public RunCommandInputParameter withName(String name) { } /** - * Get the value value. + * Get the run command parameter value. * * @return the value value */ @@ -56,7 +56,7 @@ public String value() { } /** - * Set the value value. + * Set the run command parameter value. * * @param value the value value to set * @return the RunCommandInputParameter object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/RunCommandParameterDefinition.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/RunCommandParameterDefinition.java index 1711eb5293dc..6350b1cee85d 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/RunCommandParameterDefinition.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/RunCommandParameterDefinition.java @@ -39,7 +39,7 @@ public class RunCommandParameterDefinition { private Boolean required; /** - * Get the name value. + * Get the run command parameter name. * * @return the name value */ @@ -48,7 +48,7 @@ public String name() { } /** - * Set the name value. + * Set the run command parameter name. * * @param name the name value to set * @return the RunCommandParameterDefinition object itself. @@ -59,7 +59,7 @@ public RunCommandParameterDefinition withName(String name) { } /** - * Get the type value. + * Get the run command parameter type. * * @return the type value */ @@ -68,7 +68,7 @@ public String type() { } /** - * Set the type value. + * Set the run command parameter type. * * @param type the type value to set * @return the RunCommandParameterDefinition object itself. @@ -79,7 +79,7 @@ public RunCommandParameterDefinition withType(String type) { } /** - * Get the defaultValue value. + * Get the run command parameter default value. * * @return the defaultValue value */ @@ -88,7 +88,7 @@ public String defaultValue() { } /** - * Set the defaultValue value. + * Set the run command parameter default value. * * @param defaultValue the defaultValue value to set * @return the RunCommandParameterDefinition object itself. @@ -99,7 +99,7 @@ public RunCommandParameterDefinition withDefaultValue(String defaultValue) { } /** - * Get the required value. + * Get the run command parameter required. * * @return the required value */ @@ -108,7 +108,7 @@ public Boolean required() { } /** - * Set the required value. + * Set the run command parameter required. * * @param required the required value to set * @return the RunCommandParameterDefinition object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/Sku.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/Sku.java index a94edb20745b..8ad09e535d11 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/Sku.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/Sku.java @@ -35,7 +35,7 @@ public class Sku { private Long capacity; /** - * Get the name value. + * Get the sku name. * * @return the name value */ @@ -44,7 +44,7 @@ public String name() { } /** - * Set the name value. + * Set the sku name. * * @param name the name value to set * @return the Sku object itself. @@ -55,7 +55,7 @@ public Sku withName(String name) { } /** - * Get the tier value. + * Get specifies the tier of virtual machines in a scale set.<br /><br /> Possible Values:<br /><br /> **Standard**<br /><br /> **Basic**. * * @return the tier value */ @@ -64,7 +64,7 @@ public String tier() { } /** - * Set the tier value. + * Set specifies the tier of virtual machines in a scale set.<br /><br /> Possible Values:<br /><br /> **Standard**<br /><br /> **Basic**. * * @param tier the tier value to set * @return the Sku object itself. @@ -75,7 +75,7 @@ public Sku withTier(String tier) { } /** - * Get the capacity value. + * Get specifies the number of virtual machines in the scale set. * * @return the capacity value */ @@ -84,7 +84,7 @@ public Long capacity() { } /** - * Set the capacity value. + * Set specifies the number of virtual machines in the scale set. * * @param capacity the capacity value to set * @return the Sku object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/Snapshot.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/Snapshot.java index aca022decb70..669c43e282ca 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/Snapshot.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/Snapshot.java @@ -10,12 +10,12 @@ import com.microsoft.azure.arm.model.HasInner; import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; import com.microsoft.azure.arm.resources.models.HasResourceGroup; import com.microsoft.azure.arm.model.Refreshable; import com.microsoft.azure.arm.model.Updatable; import com.microsoft.azure.arm.model.Appliable; import com.microsoft.azure.arm.model.Creatable; -import com.microsoft.azure.arm.resources.models.GroupableResourceCore; import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.compute.v2017_03_30.implementation.ComputeManager; import org.joda.time.DateTime; @@ -93,46 +93,56 @@ interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup, Resource.UpdateWithTags, U */ interface UpdateStages { /** - * The stage of the snapshot {0} allowing to specify DiskSizeGB. + * The stage of the snapshot update allowing to specify DiskSizeGB. */ interface WithDiskSizeGB { /** * Specifies diskSizeGB. + * @param diskSizeGB If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size + * @return the next update stage */ Update withDiskSizeGB(Integer diskSizeGB); } /** - * The stage of the snapshot {0} allowing to specify EncryptionSettings. + * The stage of the snapshot update allowing to specify EncryptionSettings. */ interface WithEncryptionSettings { /** * Specifies encryptionSettings. + * @param encryptionSettings Encryption settings for disk or snapshot + * @return the next update stage */ Update withEncryptionSettings(EncryptionSettings encryptionSettings); } /** - * The stage of the snapshot {0} allowing to specify OsType. + * The stage of the snapshot update allowing to specify OsType. */ interface WithOsType { /** * Specifies osType. + * @param osType the Operating System type. Possible values include: 'Windows', 'Linux' + * @return the next update stage */ Update withOsType(OperatingSystemTypes osType); } /** - * The stage of the snapshot {0} allowing to specify Sku. + * The stage of the snapshot update allowing to specify Sku. */ interface WithSku { /** * Specifies sku. + * @param sku the sku parameter value + * @return the next update stage */ Update withSku(DiskSku sku); } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/SnapshotUpdate.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/SnapshotUpdate.java index e0fafe2ff0dc..e26100dcfa05 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/SnapshotUpdate.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/SnapshotUpdate.java @@ -39,7 +39,7 @@ public class SnapshotUpdate extends ResourceUpdate { private EncryptionSettings encryptionSettings; /** - * Get the osType value. + * Get the Operating System type. Possible values include: 'Windows', 'Linux'. * * @return the osType value */ @@ -48,7 +48,7 @@ public OperatingSystemTypes osType() { } /** - * Set the osType value. + * Set the Operating System type. Possible values include: 'Windows', 'Linux'. * * @param osType the osType value to set * @return the SnapshotUpdate object itself. @@ -59,7 +59,7 @@ public SnapshotUpdate withOsType(OperatingSystemTypes osType) { } /** - * Get the diskSizeGB value. + * Get if creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. * * @return the diskSizeGB value */ @@ -68,7 +68,7 @@ public Integer diskSizeGB() { } /** - * Set the diskSizeGB value. + * Set if creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. * * @param diskSizeGB the diskSizeGB value to set * @return the SnapshotUpdate object itself. @@ -79,7 +79,7 @@ public SnapshotUpdate withDiskSizeGB(Integer diskSizeGB) { } /** - * Get the encryptionSettings value. + * Get encryption settings for disk or snapshot. * * @return the encryptionSettings value */ @@ -88,7 +88,7 @@ public EncryptionSettings encryptionSettings() { } /** - * Set the encryptionSettings value. + * Set encryption settings for disk or snapshot. * * @param encryptionSettings the encryptionSettings value to set * @return the SnapshotUpdate object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/SourceVault.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/SourceVault.java index a986c547f2cb..d3e90f1164da 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/SourceVault.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/SourceVault.java @@ -11,7 +11,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * The vault id is an Azure Resource Manager Resoure id in the form + * The vault id is an Azure Resource Manager Resource id in the form * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. */ public class SourceVault { @@ -22,7 +22,7 @@ public class SourceVault { private String id; /** - * Get the id value. + * Get resource Id. * * @return the id value */ @@ -31,7 +31,7 @@ public String id() { } /** - * Set the id value. + * Set resource Id. * * @param id the id value to set * @return the SourceVault object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/SshConfiguration.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/SshConfiguration.java index 5500612cbd17..13fef512da9e 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/SshConfiguration.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/SshConfiguration.java @@ -22,7 +22,7 @@ public class SshConfiguration { private List publicKeys; /** - * Get the publicKeys value. + * Get the list of SSH public keys used to authenticate with linux based VMs. * * @return the publicKeys value */ @@ -31,7 +31,7 @@ public List publicKeys() { } /** - * Set the publicKeys value. + * Set the list of SSH public keys used to authenticate with linux based VMs. * * @param publicKeys the publicKeys value to set * @return the SshConfiguration object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/SshPublicKey.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/SshPublicKey.java index 9a19cf4a6a4e..8403b23ff362 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/SshPublicKey.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/SshPublicKey.java @@ -34,7 +34,7 @@ public class SshPublicKey { private String keyData; /** - * Get the path value. + * Get specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key is appended to the file. Example: /home/user/.ssh/authorized_keys. * * @return the path value */ @@ -43,7 +43,7 @@ public String path() { } /** - * Set the path value. + * Set specifies the full path on the created VM where ssh public key is stored. If the file already exists, the specified key is appended to the file. Example: /home/user/.ssh/authorized_keys. * * @param path the path value to set * @return the SshPublicKey object itself. @@ -54,7 +54,7 @@ public SshPublicKey withPath(String path) { } /** - * Get the keyData value. + * Get sSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. <br><br> For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-mac-create-ssh-keys?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). * * @return the keyData value */ @@ -63,7 +63,7 @@ public String keyData() { } /** - * Set the keyData value. + * Set sSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. <br><br> For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-mac-create-ssh-keys?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). * * @param keyData the keyData value to set * @return the SshPublicKey object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/StorageAccountTypes.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/StorageAccountTypes.java index c1d25e6dba92..b6466b82cd33 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/StorageAccountTypes.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/StorageAccountTypes.java @@ -8,46 +8,34 @@ package com.microsoft.azure.management.compute.v2017_03_30; +import java.util.Collection; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import com.microsoft.rest.ExpandableStringEnum; /** * Defines values for StorageAccountTypes. */ -public enum StorageAccountTypes { - /** Enum value Standard_LRS. */ - STANDARD_LRS("Standard_LRS"), +public final class StorageAccountTypes extends ExpandableStringEnum { + /** Static value Standard_LRS for StorageAccountTypes. */ + public static final StorageAccountTypes STANDARD_LRS = fromString("Standard_LRS"); - /** Enum value Premium_LRS. */ - PREMIUM_LRS("Premium_LRS"); - - /** The actual serialized value for a StorageAccountTypes instance. */ - private String value; - - StorageAccountTypes(String value) { - this.value = value; - } + /** Static value Premium_LRS for StorageAccountTypes. */ + public static final StorageAccountTypes PREMIUM_LRS = fromString("Premium_LRS"); /** - * Parses a serialized value to a StorageAccountTypes instance. - * - * @param value the serialized value to parse. - * @return the parsed StorageAccountTypes object, or null if unable to parse. + * Creates or finds a StorageAccountTypes from its string representation. + * @param name a name to look for + * @return the corresponding StorageAccountTypes */ @JsonCreator - public static StorageAccountTypes fromString(String value) { - StorageAccountTypes[] items = StorageAccountTypes.values(); - for (StorageAccountTypes item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static StorageAccountTypes fromString(String name) { + return fromString(name, StorageAccountTypes.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** + * @return known StorageAccountTypes values + */ + public static Collection values() { + return values(StorageAccountTypes.class); } } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/StorageProfile.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/StorageProfile.java index 5088b39b1052..317ed97bfd89 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/StorageProfile.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/StorageProfile.java @@ -44,7 +44,7 @@ public class StorageProfile { private List dataDisks; /** - * Get the imageReference value. + * Get specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations. * * @return the imageReference value */ @@ -53,7 +53,7 @@ public ImageReference imageReference() { } /** - * Set the imageReference value. + * Set specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations. * * @param imageReference the imageReference value to set * @return the StorageProfile object itself. @@ -64,7 +64,7 @@ public StorageProfile withImageReference(ImageReference imageReference) { } /** - * Get the osDisk value. + * Get specifies information about the operating system disk used by the virtual machine. <br><br> For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). * * @return the osDisk value */ @@ -73,7 +73,7 @@ public OSDisk osDisk() { } /** - * Set the osDisk value. + * Set specifies information about the operating system disk used by the virtual machine. <br><br> For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). * * @param osDisk the osDisk value to set * @return the StorageProfile object itself. @@ -84,7 +84,7 @@ public StorageProfile withOsDisk(OSDisk osDisk) { } /** - * Get the dataDisks value. + * Get specifies the parameters that are used to add a data disk to a virtual machine. <br><br> For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). * * @return the dataDisks value */ @@ -93,7 +93,7 @@ public List dataDisks() { } /** - * Set the dataDisks value. + * Set specifies the parameters that are used to add a data disk to a virtual machine. <br><br> For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). * * @param dataDisks the dataDisks value to set * @return the StorageProfile object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/SubResourceReadOnly.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/SubResourceReadOnly.java index 53c471d8e135..63a43cc15d2e 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/SubResourceReadOnly.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/SubResourceReadOnly.java @@ -21,7 +21,7 @@ public class SubResourceReadOnly { private String id; /** - * Get the id value. + * Get resource Id. * * @return the id value */ diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/UpdateResource.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/UpdateResource.java index c5919545149e..e9f4043a50b1 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/UpdateResource.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/UpdateResource.java @@ -22,7 +22,7 @@ public class UpdateResource { private Map tags; /** - * Get the tags value. + * Get resource tags. * * @return the tags value */ @@ -31,7 +31,7 @@ public Map tags() { } /** - * Set the tags value. + * Set resource tags. * * @param tags the tags value to set * @return the UpdateResource object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/UpgradePolicy.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/UpgradePolicy.java index 6903abef7b6d..c3bf249b9dd2 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/UpgradePolicy.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/UpgradePolicy.java @@ -41,7 +41,7 @@ public class UpgradePolicy { private Boolean automaticOSUpgrade; /** - * Get the mode value. + * Get specifies the mode of an upgrade to virtual machines in the scale set.<br /><br /> Possible values are:<br /><br /> **Manual** - You control the application of updates to virtual machines in the scale set. You do this by using the manualUpgrade action.<br /><br /> **Automatic** - All virtual machines in the scale set are automatically updated at the same time. Possible values include: 'Automatic', 'Manual', 'Rolling'. * * @return the mode value */ @@ -50,7 +50,7 @@ public UpgradeMode mode() { } /** - * Set the mode value. + * Set specifies the mode of an upgrade to virtual machines in the scale set.<br /><br /> Possible values are:<br /><br /> **Manual** - You control the application of updates to virtual machines in the scale set. You do this by using the manualUpgrade action.<br /><br /> **Automatic** - All virtual machines in the scale set are automatically updated at the same time. Possible values include: 'Automatic', 'Manual', 'Rolling'. * * @param mode the mode value to set * @return the UpgradePolicy object itself. @@ -61,7 +61,7 @@ public UpgradePolicy withMode(UpgradeMode mode) { } /** - * Get the rollingUpgradePolicy value. + * Get the configuration parameters used while performing a rolling upgrade. * * @return the rollingUpgradePolicy value */ @@ -70,7 +70,7 @@ public RollingUpgradePolicy rollingUpgradePolicy() { } /** - * Set the rollingUpgradePolicy value. + * Set the configuration parameters used while performing a rolling upgrade. * * @param rollingUpgradePolicy the rollingUpgradePolicy value to set * @return the UpgradePolicy object itself. @@ -81,7 +81,7 @@ public UpgradePolicy withRollingUpgradePolicy(RollingUpgradePolicy rollingUpgrad } /** - * Get the automaticOSUpgrade value. + * Get whether OS upgrades should automatically be applied to scale set instances in a rolling fashion when a newer version of the image becomes available. * * @return the automaticOSUpgrade value */ @@ -90,7 +90,7 @@ public Boolean automaticOSUpgrade() { } /** - * Set the automaticOSUpgrade value. + * Set whether OS upgrades should automatically be applied to scale set instances in a rolling fashion when a newer version of the image becomes available. * * @param automaticOSUpgrade the automaticOSUpgrade value to set * @return the UpgradePolicy object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/UsageName.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/UsageName.java index d8cf6a1090f9..a2ea0c4b325d 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/UsageName.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/UsageName.java @@ -27,7 +27,7 @@ public class UsageName { private String localizedValue; /** - * Get the value value. + * Get the name of the resource. * * @return the value value */ @@ -36,7 +36,7 @@ public String value() { } /** - * Set the value value. + * Set the name of the resource. * * @param value the value value to set * @return the UsageName object itself. @@ -47,7 +47,7 @@ public UsageName withValue(String value) { } /** - * Get the localizedValue value. + * Get the localized name of the resource. * * @return the localizedValue value */ @@ -56,7 +56,7 @@ public String localizedValue() { } /** - * Set the localizedValue value. + * Set the localized name of the resource. * * @param localizedValue the localizedValue value to set * @return the UsageName object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VaultCertificate.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VaultCertificate.java index aee1b904c265..b3211205c3ee 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VaultCertificate.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VaultCertificate.java @@ -35,15 +35,16 @@ public class VaultCertificate { * to which the certificate should be added. The specified certificate * store is implicitly in the LocalMachine account. <br><br>For * Linux VMs, the certificate file is placed under the /var/lib/waagent - * directory, with the file name <UppercaseThumbprint>.crt for the - * X509 certificate file and <UppercaseThumbpring>.prv for private - * key. Both of these files are .pem formatted. + * directory, with the file name &lt;UppercaseThumbprint&gt;.crt + * for the X509 certificate file and + * &lt;UppercaseThumbprint&gt;.prv for private key. Both of these + * files are .pem formatted. */ @JsonProperty(value = "certificateStore") private String certificateStore; /** - * Get the certificateUrl value. + * Get this is the URL of a certificate that has been uploaded to Key Vault as a secret. For adding a secret to the Key Vault, see [Add a key or secret to the key vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). In this case, your certificate needs to be It is the Base64 encoding of the following JSON Object which is encoded in UTF-8: <br><br> {<br> "data":"<Base64-encoded-certificate>",<br> "dataType":"pfx",<br> "password":"<pfx-file-password>"<br>}. * * @return the certificateUrl value */ @@ -52,7 +53,7 @@ public String certificateUrl() { } /** - * Set the certificateUrl value. + * Set this is the URL of a certificate that has been uploaded to Key Vault as a secret. For adding a secret to the Key Vault, see [Add a key or secret to the key vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). In this case, your certificate needs to be It is the Base64 encoding of the following JSON Object which is encoded in UTF-8: <br><br> {<br> "data":"<Base64-encoded-certificate>",<br> "dataType":"pfx",<br> "password":"<pfx-file-password>"<br>}. * * @param certificateUrl the certificateUrl value to set * @return the VaultCertificate object itself. @@ -63,7 +64,7 @@ public VaultCertificate withCertificateUrl(String certificateUrl) { } /** - * Get the certificateStore value. + * Get for Windows VMs, specifies the certificate store on the Virtual Machine to which the certificate should be added. The specified certificate store is implicitly in the LocalMachine account. <br><br>For Linux VMs, the certificate file is placed under the /var/lib/waagent directory, with the file name &lt;UppercaseThumbprint&gt;.crt for the X509 certificate file and &lt;UppercaseThumbprint&gt;.prv for private key. Both of these files are .pem formatted. * * @return the certificateStore value */ @@ -72,7 +73,7 @@ public String certificateStore() { } /** - * Set the certificateStore value. + * Set for Windows VMs, specifies the certificate store on the Virtual Machine to which the certificate should be added. The specified certificate store is implicitly in the LocalMachine account. <br><br>For Linux VMs, the certificate file is placed under the /var/lib/waagent directory, with the file name &lt;UppercaseThumbprint&gt;.crt for the X509 certificate file and &lt;UppercaseThumbprint&gt;.prv for private key. Both of these files are .pem formatted. * * @param certificateStore the certificateStore value to set * @return the VaultCertificate object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VaultSecretGroup.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VaultSecretGroup.java index bd49bb51e892..fa0bd460d405 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VaultSecretGroup.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VaultSecretGroup.java @@ -31,7 +31,7 @@ public class VaultSecretGroup { private List vaultCertificates; /** - * Get the sourceVault value. + * Get the relative URL of the Key Vault containing all of the certificates in VaultCertificates. * * @return the sourceVault value */ @@ -40,7 +40,7 @@ public SubResource sourceVault() { } /** - * Set the sourceVault value. + * Set the relative URL of the Key Vault containing all of the certificates in VaultCertificates. * * @param sourceVault the sourceVault value to set * @return the VaultSecretGroup object itself. @@ -51,7 +51,7 @@ public VaultSecretGroup withSourceVault(SubResource sourceVault) { } /** - * Get the vaultCertificates value. + * Get the list of key vault references in SourceVault which contain certificates. * * @return the vaultCertificates value */ @@ -60,7 +60,7 @@ public List vaultCertificates() { } /** - * Set the vaultCertificates value. + * Set the list of key vault references in SourceVault which contain certificates. * * @param vaultCertificates the vaultCertificates value to set * @return the VaultSecretGroup object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualHardDisk.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualHardDisk.java index ddb676c0a4e1..5deb37042249 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualHardDisk.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualHardDisk.java @@ -21,7 +21,7 @@ public class VirtualHardDisk { private String uri; /** - * Get the uri value. + * Get specifies the virtual hard disk's uri. * * @return the uri value */ @@ -30,7 +30,7 @@ public String uri() { } /** - * Set the uri value. + * Set specifies the virtual hard disk's uri. * * @param uri the uri value to set * @return the VirtualHardDisk object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachine.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachine.java index 0770d63ab310..1e042a03a2c8 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachine.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachine.java @@ -9,23 +9,21 @@ package com.microsoft.azure.management.compute.v2017_03_30; import com.microsoft.azure.arm.model.HasInner; -import com.microsoft.azure.arm.resources.models.Resource; -import com.microsoft.azure.arm.resources.models.HasResourceGroup; -import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.management.compute.v2017_03_30.implementation.VirtualMachineInner; +import com.microsoft.azure.arm.model.Indexable; import com.microsoft.azure.arm.model.Updatable; import com.microsoft.azure.arm.model.Appliable; import com.microsoft.azure.arm.model.Creatable; -import com.microsoft.azure.arm.resources.models.GroupableResourceCore; import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.compute.v2017_03_30.implementation.ComputeManager; +import java.util.Map; import com.microsoft.azure.SubResource; import java.util.List; -import com.microsoft.azure.management.compute.v2017_03_30.implementation.VirtualMachineInner; /** * Type representing VirtualMachine. */ -public interface VirtualMachine extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { +public interface VirtualMachine extends HasInner, Indexable, Updatable, HasManager { /** * @return the availabilitySet value. */ @@ -41,6 +39,11 @@ public interface VirtualMachine extends HasInner, Resource, */ HardwareProfile hardwareProfile(); + /** + * @return the id value. + */ + String id(); + /** * @return the identity value. */ @@ -56,6 +59,16 @@ public interface VirtualMachine extends HasInner, Resource, */ String licenseType(); + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + /** * @return the networkProfile value. */ @@ -86,6 +99,16 @@ public interface VirtualMachine extends HasInner, Resource, */ StorageProfile storageProfile(); + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + /** * @return the vmId value. */ @@ -99,7 +122,7 @@ public interface VirtualMachine extends HasInner, Resource, /** * The entirety of the VirtualMachine definition. */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, DefinitionStages.WithLocation, DefinitionStages.WithCreate { } /** @@ -109,111 +132,161 @@ interface DefinitionStages { /** * The first stage of a VirtualMachine definition. */ - interface Blank extends GroupableResourceCore.DefinitionWithRegion { + interface Blank extends WithLocation { } /** - * The stage of the VirtualMachine definition allowing to specify the resource group. + * The stage of the virtualmachine definition allowing to specify Location. */ - interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + interface WithLocation { + /** + * Specifies resourceGroupName. + * @param resourceGroupName The name of the resource group + * @return the next definition stage + */ + WithLocation withExistingLocation(String resourceGroupName); } /** - * The stage of the virtualmachine update allowing to specify AvailabilitySet. + * The stage of the virtualmachine definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location Resource location + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the virtualmachine definition allowing to specify AvailabilitySet. */ interface WithAvailabilitySet { /** * Specifies availabilitySet. + * @param availabilitySet Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see [Manage the availability of virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). <br><br> For more information on Azure planned maintenance, see [Planned maintenance for virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) <br><br> Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set + * @return the next definition stage */ WithCreate withAvailabilitySet(SubResource availabilitySet); } /** - * The stage of the virtualmachine update allowing to specify DiagnosticsProfile. + * The stage of the virtualmachine definition allowing to specify DiagnosticsProfile. */ interface WithDiagnosticsProfile { /** * Specifies diagnosticsProfile. + * @param diagnosticsProfile Specifies the boot diagnostic settings state. <br><br>Minimum api-version: 2015-06-15 + * @return the next definition stage */ WithCreate withDiagnosticsProfile(DiagnosticsProfile diagnosticsProfile); } /** - * The stage of the virtualmachine update allowing to specify HardwareProfile. + * The stage of the virtualmachine definition allowing to specify HardwareProfile. */ interface WithHardwareProfile { /** * Specifies hardwareProfile. + * @param hardwareProfile Specifies the hardware settings for the virtual machine + * @return the next definition stage */ WithCreate withHardwareProfile(HardwareProfile hardwareProfile); } /** - * The stage of the virtualmachine update allowing to specify Identity. + * The stage of the virtualmachine definition allowing to specify Identity. */ interface WithIdentity { /** * Specifies identity. + * @param identity The identity of the virtual machine, if configured + * @return the next definition stage */ WithCreate withIdentity(VirtualMachineIdentity identity); } /** - * The stage of the virtualmachine update allowing to specify LicenseType. + * The stage of the virtualmachine definition allowing to specify LicenseType. */ interface WithLicenseType { /** * Specifies licenseType. + * @param licenseType Specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. <br><br> Possible values are: <br><br> Windows_Client <br><br> Windows_Server <br><br> If this element is included in a request for an update, the value must match the initial value. This value cannot be updated. <br><br> For more information, see [Azure Hybrid Use Benefit for Windows Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) <br><br> Minimum api-version: 2015-06-15 + * @return the next definition stage */ WithCreate withLicenseType(String licenseType); } /** - * The stage of the virtualmachine update allowing to specify NetworkProfile. + * The stage of the virtualmachine definition allowing to specify NetworkProfile. */ interface WithNetworkProfile { /** * Specifies networkProfile. + * @param networkProfile Specifies the network interfaces of the virtual machine + * @return the next definition stage */ WithCreate withNetworkProfile(NetworkProfile networkProfile); } /** - * The stage of the virtualmachine update allowing to specify OsProfile. + * The stage of the virtualmachine definition allowing to specify OsProfile. */ interface WithOsProfile { /** * Specifies osProfile. + * @param osProfile Specifies the operating system settings for the virtual machine + * @return the next definition stage */ WithCreate withOsProfile(OSProfile osProfile); } /** - * The stage of the virtualmachine update allowing to specify Plan. + * The stage of the virtualmachine definition allowing to specify Plan. */ interface WithPlan { /** * Specifies plan. + * @param plan Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save** + * @return the next definition stage */ WithCreate withPlan(Plan plan); } /** - * The stage of the virtualmachine update allowing to specify StorageProfile. + * The stage of the virtualmachine definition allowing to specify StorageProfile. */ interface WithStorageProfile { /** * Specifies storageProfile. + * @param storageProfile Specifies the storage settings for the virtual machine disks + * @return the next definition stage */ WithCreate withStorageProfile(StorageProfile storageProfile); } /** - * The stage of the virtualmachine update allowing to specify Zones. + * The stage of the virtualmachine definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Resource tags + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the virtualmachine definition allowing to specify Zones. */ interface WithZones { /** * Specifies zones. + * @param zones The virtual machine zones + * @return the next definition stage */ WithCreate withZones(List zones); } @@ -223,13 +296,13 @@ interface WithZones { * the resource to be created (via {@link WithCreate#create()}), but also allows * for any other optional settings to be specified. */ - interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithAvailabilitySet, DefinitionStages.WithDiagnosticsProfile, DefinitionStages.WithHardwareProfile, DefinitionStages.WithIdentity, DefinitionStages.WithLicenseType, DefinitionStages.WithNetworkProfile, DefinitionStages.WithOsProfile, DefinitionStages.WithPlan, DefinitionStages.WithStorageProfile, DefinitionStages.WithZones { + interface WithCreate extends Creatable, DefinitionStages.WithAvailabilitySet, DefinitionStages.WithDiagnosticsProfile, DefinitionStages.WithHardwareProfile, DefinitionStages.WithIdentity, DefinitionStages.WithLicenseType, DefinitionStages.WithNetworkProfile, DefinitionStages.WithOsProfile, DefinitionStages.WithPlan, DefinitionStages.WithStorageProfile, DefinitionStages.WithTags, DefinitionStages.WithZones { } } /** * The template for a VirtualMachine update operation, containing all the settings that can be modified. */ - interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAvailabilitySet, UpdateStages.WithDiagnosticsProfile, UpdateStages.WithHardwareProfile, UpdateStages.WithIdentity, UpdateStages.WithLicenseType, UpdateStages.WithNetworkProfile, UpdateStages.WithOsProfile, UpdateStages.WithPlan, UpdateStages.WithStorageProfile, UpdateStages.WithZones { + interface Update extends Appliable, UpdateStages.WithAvailabilitySet, UpdateStages.WithDiagnosticsProfile, UpdateStages.WithHardwareProfile, UpdateStages.WithIdentity, UpdateStages.WithLicenseType, UpdateStages.WithNetworkProfile, UpdateStages.WithOsProfile, UpdateStages.WithPlan, UpdateStages.WithStorageProfile, UpdateStages.WithTags, UpdateStages.WithZones { } /** @@ -237,101 +310,133 @@ interface Update extends Appliable, Resource.UpdateWithTags tags); + } + + /** + * The stage of the virtualmachine update allowing to specify Zones. */ interface WithZones { /** * Specifies zones. + * @param zones The virtual machine zones + * @return the next update stage */ Update withZones(List zones); } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineAgentInstanceView.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineAgentInstanceView.java index d8bf79451139..78ee1890f6cd 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineAgentInstanceView.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineAgentInstanceView.java @@ -34,7 +34,7 @@ public class VirtualMachineAgentInstanceView { private List statuses; /** - * Get the vmAgentVersion value. + * Get the VM Agent full version. * * @return the vmAgentVersion value */ @@ -43,7 +43,7 @@ public String vmAgentVersion() { } /** - * Set the vmAgentVersion value. + * Set the VM Agent full version. * * @param vmAgentVersion the vmAgentVersion value to set * @return the VirtualMachineAgentInstanceView object itself. @@ -54,7 +54,7 @@ public VirtualMachineAgentInstanceView withVmAgentVersion(String vmAgentVersion) } /** - * Get the extensionHandlers value. + * Get the virtual machine extension handler instance view. * * @return the extensionHandlers value */ @@ -63,7 +63,7 @@ public List extensionHandlers() { } /** - * Set the extensionHandlers value. + * Set the virtual machine extension handler instance view. * * @param extensionHandlers the extensionHandlers value to set * @return the VirtualMachineAgentInstanceView object itself. @@ -74,7 +74,7 @@ public VirtualMachineAgentInstanceView withExtensionHandlers(List statuses() { } /** - * Set the statuses value. + * Set the resource status information. * * @param statuses the statuses value to set * @return the VirtualMachineAgentInstanceView object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineCaptureParameters.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineCaptureParameters.java index ba2f0c42d561..1af6578db435 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineCaptureParameters.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineCaptureParameters.java @@ -34,7 +34,7 @@ public class VirtualMachineCaptureParameters { private boolean overwriteVhds; /** - * Get the vhdPrefix value. + * Get the captured virtual hard disk's name prefix. * * @return the vhdPrefix value */ @@ -43,7 +43,7 @@ public String vhdPrefix() { } /** - * Set the vhdPrefix value. + * Set the captured virtual hard disk's name prefix. * * @param vhdPrefix the vhdPrefix value to set * @return the VirtualMachineCaptureParameters object itself. @@ -54,7 +54,7 @@ public VirtualMachineCaptureParameters withVhdPrefix(String vhdPrefix) { } /** - * Get the destinationContainerName value. + * Get the destination container name. * * @return the destinationContainerName value */ @@ -63,7 +63,7 @@ public String destinationContainerName() { } /** - * Set the destinationContainerName value. + * Set the destination container name. * * @param destinationContainerName the destinationContainerName value to set * @return the VirtualMachineCaptureParameters object itself. @@ -74,7 +74,7 @@ public VirtualMachineCaptureParameters withDestinationContainerName(String desti } /** - * Get the overwriteVhds value. + * Get specifies whether to overwrite the destination virtual hard disk, in case of conflict. * * @return the overwriteVhds value */ @@ -83,7 +83,7 @@ public boolean overwriteVhds() { } /** - * Set the overwriteVhds value. + * Set specifies whether to overwrite the destination virtual hard disk, in case of conflict. * * @param overwriteVhds the overwriteVhds value to set * @return the VirtualMachineCaptureParameters object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineExtension.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineExtension.java index dc44d9b4692d..95588a9b7a3e 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineExtension.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineExtension.java @@ -115,6 +115,9 @@ interface Blank extends WithVirtualMachine { interface WithVirtualMachine { /** * Specifies resourceGroupName, vmName. + * @param resourceGroupName The name of the resource group + * @param vmName The name of the virtual machine where the extension should be created or updated + * @return the next definition stage */ WithLocation withExistingVirtualMachine(String resourceGroupName, String vmName); } @@ -125,6 +128,8 @@ interface WithVirtualMachine { interface WithLocation { /** * Specifies location. + * @param location Resource location + * @return the next definition stage */ WithCreate withLocation(String location); } @@ -135,6 +140,8 @@ interface WithLocation { interface WithAutoUpgradeMinorVersion { /** * Specifies autoUpgradeMinorVersion. + * @param autoUpgradeMinorVersion Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true + * @return the next definition stage */ WithCreate withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion); } @@ -145,6 +152,8 @@ interface WithAutoUpgradeMinorVersion { interface WithForceUpdateTag { /** * Specifies forceUpdateTag. + * @param forceUpdateTag How the extension handler should be forced to update even if the extension configuration has not changed + * @return the next definition stage */ WithCreate withForceUpdateTag(String forceUpdateTag); } @@ -155,6 +164,8 @@ interface WithForceUpdateTag { interface WithInstanceView { /** * Specifies instanceView. + * @param instanceView The virtual machine extension instance view + * @return the next definition stage */ WithCreate withInstanceView(VirtualMachineExtensionInstanceView instanceView); } @@ -165,6 +176,8 @@ interface WithInstanceView { interface WithProtectedSettings { /** * Specifies protectedSettings. + * @param protectedSettings The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all + * @return the next definition stage */ WithCreate withProtectedSettings(Object protectedSettings); } @@ -175,6 +188,8 @@ interface WithProtectedSettings { interface WithPublisher { /** * Specifies publisher. + * @param publisher The name of the extension handler publisher + * @return the next definition stage */ WithCreate withPublisher(String publisher); } @@ -185,6 +200,8 @@ interface WithPublisher { interface WithSettings { /** * Specifies settings. + * @param settings Json formatted public settings for the extension + * @return the next definition stage */ WithCreate withSettings(Object settings); } @@ -195,6 +212,8 @@ interface WithSettings { interface WithTags { /** * Specifies tags. + * @param tags Resource tags + * @return the next definition stage */ WithCreate withTags(Map tags); } @@ -205,6 +224,8 @@ interface WithTags { interface WithTypeHandlerVersion { /** * Specifies typeHandlerVersion. + * @param typeHandlerVersion Specifies the version of the script handler + * @return the next definition stage */ WithCreate withTypeHandlerVersion(String typeHandlerVersion); } @@ -215,6 +236,8 @@ interface WithTypeHandlerVersion { interface WithVirtualMachineExtensionType { /** * Specifies virtualMachineExtensionType. + * @param virtualMachineExtensionType Specifies the type of the extension; an example is "CustomScriptExtension" + * @return the next definition stage */ WithCreate withVirtualMachineExtensionType(String virtualMachineExtensionType); } @@ -243,6 +266,8 @@ interface UpdateStages { interface WithAutoUpgradeMinorVersion { /** * Specifies autoUpgradeMinorVersion. + * @param autoUpgradeMinorVersion Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true + * @return the next update stage */ Update withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion); } @@ -253,6 +278,8 @@ interface WithAutoUpgradeMinorVersion { interface WithForceUpdateTag { /** * Specifies forceUpdateTag. + * @param forceUpdateTag How the extension handler should be forced to update even if the extension configuration has not changed + * @return the next update stage */ Update withForceUpdateTag(String forceUpdateTag); } @@ -263,6 +290,8 @@ interface WithForceUpdateTag { interface WithProtectedSettings { /** * Specifies protectedSettings. + * @param protectedSettings The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all + * @return the next update stage */ Update withProtectedSettings(Object protectedSettings); } @@ -273,6 +302,8 @@ interface WithProtectedSettings { interface WithPublisher { /** * Specifies publisher. + * @param publisher The name of the extension handler publisher + * @return the next update stage */ Update withPublisher(String publisher); } @@ -283,6 +314,8 @@ interface WithPublisher { interface WithSettings { /** * Specifies settings. + * @param settings Json formatted public settings for the extension + * @return the next update stage */ Update withSettings(Object settings); } @@ -293,6 +326,8 @@ interface WithSettings { interface WithTags { /** * Specifies tags. + * @param tags Resource tags + * @return the next update stage */ Update withTags(Map tags); } @@ -303,6 +338,8 @@ interface WithTags { interface WithType { /** * Specifies type. + * @param type Specifies the type of the extension; an example is "CustomScriptExtension" + * @return the next update stage */ Update withType(String type); } @@ -313,6 +350,8 @@ interface WithType { interface WithTypeHandlerVersion { /** * Specifies typeHandlerVersion. + * @param typeHandlerVersion Specifies the version of the script handler + * @return the next update stage */ Update withTypeHandlerVersion(String typeHandlerVersion); } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineExtensionHandlerInstanceView.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineExtensionHandlerInstanceView.java index 6c39edef66b9..a09d26e3547d 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineExtensionHandlerInstanceView.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineExtensionHandlerInstanceView.java @@ -34,7 +34,7 @@ public class VirtualMachineExtensionHandlerInstanceView { private InstanceViewStatus status; /** - * Get the type value. + * Get specifies the type of the extension; an example is "CustomScriptExtension". * * @return the type value */ @@ -43,7 +43,7 @@ public String type() { } /** - * Set the type value. + * Set specifies the type of the extension; an example is "CustomScriptExtension". * * @param type the type value to set * @return the VirtualMachineExtensionHandlerInstanceView object itself. @@ -54,7 +54,7 @@ public VirtualMachineExtensionHandlerInstanceView withType(String type) { } /** - * Get the typeHandlerVersion value. + * Get specifies the version of the script handler. * * @return the typeHandlerVersion value */ @@ -63,7 +63,7 @@ public String typeHandlerVersion() { } /** - * Set the typeHandlerVersion value. + * Set specifies the version of the script handler. * * @param typeHandlerVersion the typeHandlerVersion value to set * @return the VirtualMachineExtensionHandlerInstanceView object itself. @@ -74,7 +74,7 @@ public VirtualMachineExtensionHandlerInstanceView withTypeHandlerVersion(String } /** - * Get the status value. + * Get the extension handler status. * * @return the status value */ @@ -83,7 +83,7 @@ public InstanceViewStatus status() { } /** - * Set the status value. + * Set the extension handler status. * * @param status the status value to set * @return the VirtualMachineExtensionHandlerInstanceView object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineExtensionInstanceView.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineExtensionInstanceView.java index 2d896b3f1825..bd6c9b1e9e08 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineExtensionInstanceView.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineExtensionInstanceView.java @@ -47,7 +47,7 @@ public class VirtualMachineExtensionInstanceView { private List statuses; /** - * Get the name value. + * Get the virtual machine extension name. * * @return the name value */ @@ -56,7 +56,7 @@ public String name() { } /** - * Set the name value. + * Set the virtual machine extension name. * * @param name the name value to set * @return the VirtualMachineExtensionInstanceView object itself. @@ -67,7 +67,7 @@ public VirtualMachineExtensionInstanceView withName(String name) { } /** - * Get the type value. + * Get specifies the type of the extension; an example is "CustomScriptExtension". * * @return the type value */ @@ -76,7 +76,7 @@ public String type() { } /** - * Set the type value. + * Set specifies the type of the extension; an example is "CustomScriptExtension". * * @param type the type value to set * @return the VirtualMachineExtensionInstanceView object itself. @@ -87,7 +87,7 @@ public VirtualMachineExtensionInstanceView withType(String type) { } /** - * Get the typeHandlerVersion value. + * Get specifies the version of the script handler. * * @return the typeHandlerVersion value */ @@ -96,7 +96,7 @@ public String typeHandlerVersion() { } /** - * Set the typeHandlerVersion value. + * Set specifies the version of the script handler. * * @param typeHandlerVersion the typeHandlerVersion value to set * @return the VirtualMachineExtensionInstanceView object itself. @@ -107,7 +107,7 @@ public VirtualMachineExtensionInstanceView withTypeHandlerVersion(String typeHan } /** - * Get the substatuses value. + * Get the resource status information. * * @return the substatuses value */ @@ -116,7 +116,7 @@ public List substatuses() { } /** - * Set the substatuses value. + * Set the resource status information. * * @param substatuses the substatuses value to set * @return the VirtualMachineExtensionInstanceView object itself. @@ -127,7 +127,7 @@ public VirtualMachineExtensionInstanceView withSubstatuses(List statuses() { } /** - * Set the statuses value. + * Set the resource status information. * * @param statuses the statuses value to set * @return the VirtualMachineExtensionInstanceView object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineExtensionUpdate.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineExtensionUpdate.java index ec2d13b4844e..c276d1b46878 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineExtensionUpdate.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineExtensionUpdate.java @@ -65,7 +65,7 @@ public class VirtualMachineExtensionUpdate extends UpdateResource { private Object protectedSettings; /** - * Get the forceUpdateTag value. + * Get how the extension handler should be forced to update even if the extension configuration has not changed. * * @return the forceUpdateTag value */ @@ -74,7 +74,7 @@ public String forceUpdateTag() { } /** - * Set the forceUpdateTag value. + * Set how the extension handler should be forced to update even if the extension configuration has not changed. * * @param forceUpdateTag the forceUpdateTag value to set * @return the VirtualMachineExtensionUpdate object itself. @@ -85,7 +85,7 @@ public VirtualMachineExtensionUpdate withForceUpdateTag(String forceUpdateTag) { } /** - * Get the publisher value. + * Get the name of the extension handler publisher. * * @return the publisher value */ @@ -94,7 +94,7 @@ public String publisher() { } /** - * Set the publisher value. + * Set the name of the extension handler publisher. * * @param publisher the publisher value to set * @return the VirtualMachineExtensionUpdate object itself. @@ -105,7 +105,7 @@ public VirtualMachineExtensionUpdate withPublisher(String publisher) { } /** - * Get the type value. + * Get specifies the type of the extension; an example is "CustomScriptExtension". * * @return the type value */ @@ -114,7 +114,7 @@ public String type() { } /** - * Set the type value. + * Set specifies the type of the extension; an example is "CustomScriptExtension". * * @param type the type value to set * @return the VirtualMachineExtensionUpdate object itself. @@ -125,7 +125,7 @@ public VirtualMachineExtensionUpdate withType(String type) { } /** - * Get the typeHandlerVersion value. + * Get specifies the version of the script handler. * * @return the typeHandlerVersion value */ @@ -134,7 +134,7 @@ public String typeHandlerVersion() { } /** - * Set the typeHandlerVersion value. + * Set specifies the version of the script handler. * * @param typeHandlerVersion the typeHandlerVersion value to set * @return the VirtualMachineExtensionUpdate object itself. @@ -145,7 +145,7 @@ public VirtualMachineExtensionUpdate withTypeHandlerVersion(String typeHandlerVe } /** - * Get the autoUpgradeMinorVersion value. + * Get indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. * * @return the autoUpgradeMinorVersion value */ @@ -154,7 +154,7 @@ public Boolean autoUpgradeMinorVersion() { } /** - * Set the autoUpgradeMinorVersion value. + * Set indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. * * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set * @return the VirtualMachineExtensionUpdate object itself. @@ -165,7 +165,7 @@ public VirtualMachineExtensionUpdate withAutoUpgradeMinorVersion(Boolean autoUpg } /** - * Get the settings value. + * Get json formatted public settings for the extension. * * @return the settings value */ @@ -174,7 +174,7 @@ public Object settings() { } /** - * Set the settings value. + * Set json formatted public settings for the extension. * * @param settings the settings value to set * @return the VirtualMachineExtensionUpdate object itself. @@ -185,7 +185,7 @@ public VirtualMachineExtensionUpdate withSettings(Object settings) { } /** - * Get the protectedSettings value. + * Get the extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. * * @return the protectedSettings value */ @@ -194,7 +194,7 @@ public Object protectedSettings() { } /** - * Set the protectedSettings value. + * Set the extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. * * @param protectedSettings the protectedSettings value to set * @return the VirtualMachineExtensionUpdate object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineExtensions.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineExtensions.java index b67f682b13af..a263720b6dd2 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineExtensions.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineExtensions.java @@ -8,16 +8,20 @@ package com.microsoft.azure.management.compute.v2017_03_30; -import com.microsoft.azure.arm.collection.SupportsCreating; -import rx.Completable; import rx.Observable; -import com.microsoft.azure.management.compute.v2017_03_30.implementation.VirtualMachineExtensionsInner; -import com.microsoft.azure.arm.model.HasInner; +import rx.Completable; /** * Type representing VirtualMachineExtensions. */ -public interface VirtualMachineExtensions extends SupportsCreating, HasInner { +public interface VirtualMachineExtensions { + /** + * Begins definition for a new Extension resource. + * @param name resource name. + * @return the first stage of the new Extension definition. + */ + VirtualMachineExtension.DefinitionStages.Blank defineExtension(String name); + /** * The operation to get the extension. * diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineHealthStatus.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineHealthStatus.java index f098d277ffb2..696121a81101 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineHealthStatus.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineHealthStatus.java @@ -21,7 +21,7 @@ public class VirtualMachineHealthStatus { private InstanceViewStatus status; /** - * Get the status value. + * Get the health status information for the VM. * * @return the status value */ diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineIdentity.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineIdentity.java index c5380e8104fb..ad6a722abc34 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineIdentity.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineIdentity.java @@ -35,7 +35,7 @@ public class VirtualMachineIdentity { private ResourceIdentityType type; /** - * Get the principalId value. + * Get the principal id of virtual machine identity. * * @return the principalId value */ @@ -44,7 +44,7 @@ public String principalId() { } /** - * Get the tenantId value. + * Get the tenant id associated with the virtual machine. * * @return the tenantId value */ @@ -53,7 +53,7 @@ public String tenantId() { } /** - * Get the type value. + * Get the type of identity used for the virtual machine. Currently, the only supported type is 'SystemAssigned', which implicitly creates an identity. Possible values include: 'SystemAssigned'. * * @return the type value */ @@ -62,7 +62,7 @@ public ResourceIdentityType type() { } /** - * Set the type value. + * Set the type of identity used for the virtual machine. Currently, the only supported type is 'SystemAssigned', which implicitly creates an identity. Possible values include: 'SystemAssigned'. * * @param type the type value to set * @return the VirtualMachineIdentity object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSet.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSet.java index 8646817be637..210e031ac2bb 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSet.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSet.java @@ -10,12 +10,12 @@ import com.microsoft.azure.arm.model.HasInner; import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; import com.microsoft.azure.arm.resources.models.HasResourceGroup; import com.microsoft.azure.arm.model.Refreshable; import com.microsoft.azure.arm.model.Updatable; import com.microsoft.azure.arm.model.Appliable; import com.microsoft.azure.arm.model.Creatable; -import com.microsoft.azure.arm.resources.models.GroupableResourceCore; import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.compute.v2017_03_30.implementation.ComputeManager; import java.util.List; @@ -98,81 +98,97 @@ interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup zones); } @@ -196,71 +212,85 @@ interface Update extends Appliable, Resource.UpdateWithT */ interface UpdateStages { /** - * The stage of the virtualmachinescaleset {0} allowing to specify Identity. + * The stage of the virtualmachinescaleset update allowing to specify Identity. */ interface WithIdentity { /** * Specifies identity. + * @param identity The identity of the virtual machine scale set, if configured + * @return the next update stage */ Update withIdentity(VirtualMachineScaleSetIdentity identity); } /** - * The stage of the virtualmachinescaleset {0} allowing to specify Overprovision. + * The stage of the virtualmachinescaleset update allowing to specify Overprovision. */ interface WithOverprovision { /** * Specifies overprovision. + * @param overprovision Specifies whether the Virtual Machine Scale Set should be overprovisioned + * @return the next update stage */ Update withOverprovision(Boolean overprovision); } /** - * The stage of the virtualmachinescaleset {0} allowing to specify Plan. + * The stage of the virtualmachinescaleset update allowing to specify Plan. */ interface WithPlan { /** * Specifies plan. + * @param plan The purchase plan when deploying a virtual machine scale set from VM Marketplace images + * @return the next update stage */ Update withPlan(Plan plan); } /** - * The stage of the virtualmachinescaleset {0} allowing to specify SinglePlacementGroup. + * The stage of the virtualmachinescaleset update allowing to specify SinglePlacementGroup. */ interface WithSinglePlacementGroup { /** * Specifies singlePlacementGroup. + * @param singlePlacementGroup When true this limits the scale set to a single placement group, of max size 100 virtual machines + * @return the next update stage */ Update withSinglePlacementGroup(Boolean singlePlacementGroup); } /** - * The stage of the virtualmachinescaleset {0} allowing to specify Sku. + * The stage of the virtualmachinescaleset update allowing to specify Sku. */ interface WithSku { /** * Specifies sku. + * @param sku The virtual machine scale set sku + * @return the next update stage */ Update withSku(Sku sku); } /** - * The stage of the virtualmachinescaleset {0} allowing to specify UpgradePolicy. + * The stage of the virtualmachinescaleset update allowing to specify UpgradePolicy. */ interface WithUpgradePolicy { /** * Specifies upgradePolicy. + * @param upgradePolicy The upgrade policy + * @return the next update stage */ Update withUpgradePolicy(UpgradePolicy upgradePolicy); } /** - * The stage of the virtualmachinescaleset {0} allowing to specify VirtualMachineProfile. + * The stage of the virtualmachinescaleset update allowing to specify VirtualMachineProfile. */ interface WithVirtualMachineProfile { /** * Specifies virtualMachineProfile. + * @param virtualMachineProfile The virtual machine profile + * @return the next update stage */ Update withVirtualMachineProfile(VirtualMachineScaleSetUpdateVMProfile virtualMachineProfile); } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetDataDisk.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetDataDisk.java index ad911fa4b36f..d5a9a2fcb84a 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetDataDisk.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetDataDisk.java @@ -47,7 +47,7 @@ public class VirtualMachineScaleSetDataDisk { /** * Specifies the size of an empty data disk in gigabytes. This element can - * be used to overwrite the name of the disk in a virtual machine image. + * be used to overwrite the size of the disk in a virtual machine image. * <br><br> This value cannot be larger than 1023 GB. */ @JsonProperty(value = "diskSizeGB") @@ -60,7 +60,7 @@ public class VirtualMachineScaleSetDataDisk { private VirtualMachineScaleSetManagedDiskParameters managedDisk; /** - * Get the name value. + * Get the disk name. * * @return the name value */ @@ -69,7 +69,7 @@ public String name() { } /** - * Set the name value. + * Set the disk name. * * @param name the name value to set * @return the VirtualMachineScaleSetDataDisk object itself. @@ -80,7 +80,7 @@ public VirtualMachineScaleSetDataDisk withName(String name) { } /** - * Get the lun value. + * Get specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. * * @return the lun value */ @@ -89,7 +89,7 @@ public int lun() { } /** - * Set the lun value. + * Set specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. * * @param lun the lun value to set * @return the VirtualMachineScaleSetDataDisk object itself. @@ -100,7 +100,7 @@ public VirtualMachineScaleSetDataDisk withLun(int lun) { } /** - * Get the caching value. + * Get specifies the caching requirements. <br><br> Possible values are: <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'None', 'ReadOnly', 'ReadWrite'. * * @return the caching value */ @@ -109,7 +109,7 @@ public CachingTypes caching() { } /** - * Set the caching value. + * Set specifies the caching requirements. <br><br> Possible values are: <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'None', 'ReadOnly', 'ReadWrite'. * * @param caching the caching value to set * @return the VirtualMachineScaleSetDataDisk object itself. @@ -120,7 +120,7 @@ public VirtualMachineScaleSetDataDisk withCaching(CachingTypes caching) { } /** - * Get the createOption value. + * Get the create option. Possible values include: 'FromImage', 'Empty', 'Attach'. * * @return the createOption value */ @@ -129,7 +129,7 @@ public DiskCreateOptionTypes createOption() { } /** - * Set the createOption value. + * Set the create option. Possible values include: 'FromImage', 'Empty', 'Attach'. * * @param createOption the createOption value to set * @return the VirtualMachineScaleSetDataDisk object itself. @@ -140,7 +140,7 @@ public VirtualMachineScaleSetDataDisk withCreateOption(DiskCreateOptionTypes cre } /** - * Get the diskSizeGB value. + * Get specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image. <br><br> This value cannot be larger than 1023 GB. * * @return the diskSizeGB value */ @@ -149,7 +149,7 @@ public Integer diskSizeGB() { } /** - * Set the diskSizeGB value. + * Set specifies the size of an empty data disk in gigabytes. This element can be used to overwrite the size of the disk in a virtual machine image. <br><br> This value cannot be larger than 1023 GB. * * @param diskSizeGB the diskSizeGB value to set * @return the VirtualMachineScaleSetDataDisk object itself. @@ -160,7 +160,7 @@ public VirtualMachineScaleSetDataDisk withDiskSizeGB(Integer diskSizeGB) { } /** - * Get the managedDisk value. + * Get the managed disk parameters. * * @return the managedDisk value */ @@ -169,7 +169,7 @@ public VirtualMachineScaleSetManagedDiskParameters managedDisk() { } /** - * Set the managedDisk value. + * Set the managed disk parameters. * * @param managedDisk the managedDisk value to set * @return the VirtualMachineScaleSetDataDisk object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetExtension.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetExtension.java index 64c6ef2bc3b1..a0a1f61aec1b 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetExtension.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetExtension.java @@ -94,6 +94,9 @@ interface Blank extends WithVirtualMachineScaleSet { interface WithVirtualMachineScaleSet { /** * Specifies resourceGroupName, vmScaleSetName. + * @param resourceGroupName The name of the resource group + * @param vmScaleSetName The name of the VM scale set where the extension should be create or updated + * @return the next definition stage */ WithCreate withExistingVirtualMachineScaleSet(String resourceGroupName, String vmScaleSetName); } @@ -104,6 +107,8 @@ interface WithVirtualMachineScaleSet { interface WithAutoUpgradeMinorVersion { /** * Specifies autoUpgradeMinorVersion. + * @param autoUpgradeMinorVersion Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true + * @return the next definition stage */ WithCreate withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion); } @@ -114,6 +119,8 @@ interface WithAutoUpgradeMinorVersion { interface WithForceUpdateTag { /** * Specifies forceUpdateTag. + * @param forceUpdateTag If a value is provided and is different from the previous value, the extension handler will be forced to update even if the extension configuration has not changed + * @return the next definition stage */ WithCreate withForceUpdateTag(String forceUpdateTag); } @@ -124,6 +131,8 @@ interface WithForceUpdateTag { interface WithName { /** * Specifies name. + * @param name The name of the extension + * @return the next definition stage */ WithCreate withName(String name); } @@ -134,6 +143,8 @@ interface WithName { interface WithProtectedSettings { /** * Specifies protectedSettings. + * @param protectedSettings The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all + * @return the next definition stage */ WithCreate withProtectedSettings(Object protectedSettings); } @@ -144,6 +155,8 @@ interface WithProtectedSettings { interface WithPublisher { /** * Specifies publisher. + * @param publisher The name of the extension handler publisher + * @return the next definition stage */ WithCreate withPublisher(String publisher); } @@ -154,6 +167,8 @@ interface WithPublisher { interface WithSettings { /** * Specifies settings. + * @param settings Json formatted public settings for the extension + * @return the next definition stage */ WithCreate withSettings(Object settings); } @@ -164,6 +179,8 @@ interface WithSettings { interface WithType { /** * Specifies type. + * @param type Specifies the type of the extension; an example is "CustomScriptExtension" + * @return the next definition stage */ WithCreate withType(String type); } @@ -174,6 +191,8 @@ interface WithType { interface WithTypeHandlerVersion { /** * Specifies typeHandlerVersion. + * @param typeHandlerVersion Specifies the version of the script handler + * @return the next definition stage */ WithCreate withTypeHandlerVersion(String typeHandlerVersion); } @@ -202,6 +221,8 @@ interface UpdateStages { interface WithAutoUpgradeMinorVersion { /** * Specifies autoUpgradeMinorVersion. + * @param autoUpgradeMinorVersion Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true + * @return the next update stage */ Update withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion); } @@ -212,6 +233,8 @@ interface WithAutoUpgradeMinorVersion { interface WithForceUpdateTag { /** * Specifies forceUpdateTag. + * @param forceUpdateTag If a value is provided and is different from the previous value, the extension handler will be forced to update even if the extension configuration has not changed + * @return the next update stage */ Update withForceUpdateTag(String forceUpdateTag); } @@ -222,6 +245,8 @@ interface WithForceUpdateTag { interface WithName { /** * Specifies name. + * @param name The name of the extension + * @return the next update stage */ Update withName(String name); } @@ -232,6 +257,8 @@ interface WithName { interface WithProtectedSettings { /** * Specifies protectedSettings. + * @param protectedSettings The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all + * @return the next update stage */ Update withProtectedSettings(Object protectedSettings); } @@ -242,6 +269,8 @@ interface WithProtectedSettings { interface WithPublisher { /** * Specifies publisher. + * @param publisher The name of the extension handler publisher + * @return the next update stage */ Update withPublisher(String publisher); } @@ -252,6 +281,8 @@ interface WithPublisher { interface WithSettings { /** * Specifies settings. + * @param settings Json formatted public settings for the extension + * @return the next update stage */ Update withSettings(Object settings); } @@ -262,6 +293,8 @@ interface WithSettings { interface WithType { /** * Specifies type. + * @param type Specifies the type of the extension; an example is "CustomScriptExtension" + * @return the next update stage */ Update withType(String type); } @@ -272,6 +305,8 @@ interface WithType { interface WithTypeHandlerVersion { /** * Specifies typeHandlerVersion. + * @param typeHandlerVersion Specifies the version of the script handler + * @return the next update stage */ Update withTypeHandlerVersion(String typeHandlerVersion); } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetExtensionProfile.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetExtensionProfile.java index f03a52fb1237..14e5db1a4417 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetExtensionProfile.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetExtensionProfile.java @@ -23,7 +23,7 @@ public class VirtualMachineScaleSetExtensionProfile { private List extensions; /** - * Get the extensions value. + * Get the virtual machine scale set child extension resources. * * @return the extensions value */ @@ -32,7 +32,7 @@ public List extensions() { } /** - * Set the extensions value. + * Set the virtual machine scale set child extension resources. * * @param extensions the extensions value to set * @return the VirtualMachineScaleSetExtensionProfile object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetIPConfiguration.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetIPConfiguration.java index 8bc4d767e9a2..6e7ea749416c 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetIPConfiguration.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetIPConfiguration.java @@ -80,7 +80,7 @@ public class VirtualMachineScaleSetIPConfiguration extends SubResource { private List loadBalancerInboundNatPools; /** - * Get the name value. + * Get the IP configuration name. * * @return the name value */ @@ -89,7 +89,7 @@ public String name() { } /** - * Set the name value. + * Set the IP configuration name. * * @param name the name value to set * @return the VirtualMachineScaleSetIPConfiguration object itself. @@ -100,7 +100,7 @@ public VirtualMachineScaleSetIPConfiguration withName(String name) { } /** - * Get the subnet value. + * Get specifies the identifier of the subnet. * * @return the subnet value */ @@ -109,7 +109,7 @@ public ApiEntityReference subnet() { } /** - * Set the subnet value. + * Set specifies the identifier of the subnet. * * @param subnet the subnet value to set * @return the VirtualMachineScaleSetIPConfiguration object itself. @@ -120,7 +120,7 @@ public VirtualMachineScaleSetIPConfiguration withSubnet(ApiEntityReference subne } /** - * Get the primary value. + * Get specifies the primary network interface in case the virtual machine has more than 1 network interface. * * @return the primary value */ @@ -129,7 +129,7 @@ public Boolean primary() { } /** - * Set the primary value. + * Set specifies the primary network interface in case the virtual machine has more than 1 network interface. * * @param primary the primary value to set * @return the VirtualMachineScaleSetIPConfiguration object itself. @@ -140,7 +140,7 @@ public VirtualMachineScaleSetIPConfiguration withPrimary(Boolean primary) { } /** - * Get the publicIPAddressConfiguration value. + * Get the publicIPAddressConfiguration. * * @return the publicIPAddressConfiguration value */ @@ -149,7 +149,7 @@ public VirtualMachineScaleSetPublicIPAddressConfiguration publicIPAddressConfigu } /** - * Set the publicIPAddressConfiguration value. + * Set the publicIPAddressConfiguration. * * @param publicIPAddressConfiguration the publicIPAddressConfiguration value to set * @return the VirtualMachineScaleSetIPConfiguration object itself. @@ -160,7 +160,7 @@ public VirtualMachineScaleSetIPConfiguration withPublicIPAddressConfiguration(Vi } /** - * Get the privateIPAddressVersion value. + * Get available from Api-Version 2017-03-30 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. Possible values include: 'IPv4', 'IPv6'. * * @return the privateIPAddressVersion value */ @@ -169,7 +169,7 @@ public IPVersion privateIPAddressVersion() { } /** - * Set the privateIPAddressVersion value. + * Set available from Api-Version 2017-03-30 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. Possible values include: 'IPv4', 'IPv6'. * * @param privateIPAddressVersion the privateIPAddressVersion value to set * @return the VirtualMachineScaleSetIPConfiguration object itself. @@ -180,7 +180,7 @@ public VirtualMachineScaleSetIPConfiguration withPrivateIPAddressVersion(IPVersi } /** - * Get the applicationGatewayBackendAddressPools value. + * Get specifies an array of references to backend address pools of application gateways. A scale set can reference backend address pools of multiple application gateways. Multiple scale sets cannot use the same application gateway. * * @return the applicationGatewayBackendAddressPools value */ @@ -189,7 +189,7 @@ public List applicationGatewayBackendAddressPools() { } /** - * Set the applicationGatewayBackendAddressPools value. + * Set specifies an array of references to backend address pools of application gateways. A scale set can reference backend address pools of multiple application gateways. Multiple scale sets cannot use the same application gateway. * * @param applicationGatewayBackendAddressPools the applicationGatewayBackendAddressPools value to set * @return the VirtualMachineScaleSetIPConfiguration object itself. @@ -200,7 +200,7 @@ public VirtualMachineScaleSetIPConfiguration withApplicationGatewayBackendAddres } /** - * Get the loadBalancerBackendAddressPools value. + * Get specifies an array of references to backend address pools of load balancers. A scale set can reference backend address pools of one public and one internal load balancer. Multiple scale sets cannot use the same load balancer. * * @return the loadBalancerBackendAddressPools value */ @@ -209,7 +209,7 @@ public List loadBalancerBackendAddressPools() { } /** - * Set the loadBalancerBackendAddressPools value. + * Set specifies an array of references to backend address pools of load balancers. A scale set can reference backend address pools of one public and one internal load balancer. Multiple scale sets cannot use the same load balancer. * * @param loadBalancerBackendAddressPools the loadBalancerBackendAddressPools value to set * @return the VirtualMachineScaleSetIPConfiguration object itself. @@ -220,7 +220,7 @@ public VirtualMachineScaleSetIPConfiguration withLoadBalancerBackendAddressPools } /** - * Get the loadBalancerInboundNatPools value. + * Get specifies an array of references to inbound Nat pools of the load balancers. A scale set can reference inbound nat pools of one public and one internal load balancer. Multiple scale sets cannot use the same load balancer. * * @return the loadBalancerInboundNatPools value */ @@ -229,7 +229,7 @@ public List loadBalancerInboundNatPools() { } /** - * Set the loadBalancerInboundNatPools value. + * Set specifies an array of references to inbound Nat pools of the load balancers. A scale set can reference inbound nat pools of one public and one internal load balancer. Multiple scale sets cannot use the same load balancer. * * @param loadBalancerInboundNatPools the loadBalancerInboundNatPools value to set * @return the VirtualMachineScaleSetIPConfiguration object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetIdentity.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetIdentity.java index 5ebc09958dfc..ae09f4edaaf5 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetIdentity.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetIdentity.java @@ -35,7 +35,7 @@ public class VirtualMachineScaleSetIdentity { private ResourceIdentityType type; /** - * Get the principalId value. + * Get the principal id of virtual machine scale set identity. * * @return the principalId value */ @@ -44,7 +44,7 @@ public String principalId() { } /** - * Get the tenantId value. + * Get the tenant id associated with the virtual machine scale set. * * @return the tenantId value */ @@ -53,7 +53,7 @@ public String tenantId() { } /** - * Get the type value. + * Get the type of identity used for the virtual machine scale set. Currently, the only supported type is 'SystemAssigned', which implicitly creates an identity. Possible values include: 'SystemAssigned'. * * @return the type value */ @@ -62,7 +62,7 @@ public ResourceIdentityType type() { } /** - * Set the type value. + * Set the type of identity used for the virtual machine scale set. Currently, the only supported type is 'SystemAssigned', which implicitly creates an identity. Possible values include: 'SystemAssigned'. * * @param type the type value to set * @return the VirtualMachineScaleSetIdentity object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetInstanceViewStatusesSummary.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetInstanceViewStatusesSummary.java index 19a2deb31243..31451f479196 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetInstanceViewStatusesSummary.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetInstanceViewStatusesSummary.java @@ -23,7 +23,7 @@ public class VirtualMachineScaleSetInstanceViewStatusesSummary { private List statusesSummary; /** - * Get the statusesSummary value. + * Get the extensions information. * * @return the statusesSummary value */ diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetManagedDiskParameters.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetManagedDiskParameters.java index 27d2323dd58e..6246f1597bdf 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetManagedDiskParameters.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetManagedDiskParameters.java @@ -23,7 +23,7 @@ public class VirtualMachineScaleSetManagedDiskParameters { private StorageAccountTypes storageAccountType; /** - * Get the storageAccountType value. + * Get specifies the storage account type for the managed disk. Possible values are: Standard_LRS or Premium_LRS. Possible values include: 'Standard_LRS', 'Premium_LRS'. * * @return the storageAccountType value */ @@ -32,7 +32,7 @@ public StorageAccountTypes storageAccountType() { } /** - * Set the storageAccountType value. + * Set specifies the storage account type for the managed disk. Possible values are: Standard_LRS or Premium_LRS. Possible values include: 'Standard_LRS', 'Premium_LRS'. * * @param storageAccountType the storageAccountType value to set * @return the VirtualMachineScaleSetManagedDiskParameters object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetNetworkConfiguration.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetNetworkConfiguration.java index fe734f6dd5fb..6295cf0a9a97 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetNetworkConfiguration.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetNetworkConfiguration.java @@ -58,7 +58,7 @@ public class VirtualMachineScaleSetNetworkConfiguration extends SubResource { private List ipConfigurations; /** - * Get the name value. + * Get the network configuration name. * * @return the name value */ @@ -67,7 +67,7 @@ public String name() { } /** - * Set the name value. + * Set the network configuration name. * * @param name the name value to set * @return the VirtualMachineScaleSetNetworkConfiguration object itself. @@ -78,7 +78,7 @@ public VirtualMachineScaleSetNetworkConfiguration withName(String name) { } /** - * Get the primary value. + * Get specifies the primary network interface in case the virtual machine has more than 1 network interface. * * @return the primary value */ @@ -87,7 +87,7 @@ public Boolean primary() { } /** - * Set the primary value. + * Set specifies the primary network interface in case the virtual machine has more than 1 network interface. * * @param primary the primary value to set * @return the VirtualMachineScaleSetNetworkConfiguration object itself. @@ -98,7 +98,7 @@ public VirtualMachineScaleSetNetworkConfiguration withPrimary(Boolean primary) { } /** - * Get the enableAcceleratedNetworking value. + * Get specifies whether the network interface is accelerated networking-enabled. * * @return the enableAcceleratedNetworking value */ @@ -107,7 +107,7 @@ public Boolean enableAcceleratedNetworking() { } /** - * Set the enableAcceleratedNetworking value. + * Set specifies whether the network interface is accelerated networking-enabled. * * @param enableAcceleratedNetworking the enableAcceleratedNetworking value to set * @return the VirtualMachineScaleSetNetworkConfiguration object itself. @@ -118,7 +118,7 @@ public VirtualMachineScaleSetNetworkConfiguration withEnableAcceleratedNetworkin } /** - * Get the networkSecurityGroup value. + * Get the network security group. * * @return the networkSecurityGroup value */ @@ -127,7 +127,7 @@ public SubResource networkSecurityGroup() { } /** - * Set the networkSecurityGroup value. + * Set the network security group. * * @param networkSecurityGroup the networkSecurityGroup value to set * @return the VirtualMachineScaleSetNetworkConfiguration object itself. @@ -138,7 +138,7 @@ public VirtualMachineScaleSetNetworkConfiguration withNetworkSecurityGroup(SubRe } /** - * Get the dnsSettings value. + * Get the dns settings to be applied on the network interfaces. * * @return the dnsSettings value */ @@ -147,7 +147,7 @@ public VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings() { } /** - * Set the dnsSettings value. + * Set the dns settings to be applied on the network interfaces. * * @param dnsSettings the dnsSettings value to set * @return the VirtualMachineScaleSetNetworkConfiguration object itself. @@ -158,7 +158,7 @@ public VirtualMachineScaleSetNetworkConfiguration withDnsSettings(VirtualMachine } /** - * Get the ipConfigurations value. + * Get specifies the IP configurations of the network interface. * * @return the ipConfigurations value */ @@ -167,7 +167,7 @@ public List ipConfigurations() { } /** - * Set the ipConfigurations value. + * Set specifies the IP configurations of the network interface. * * @param ipConfigurations the ipConfigurations value to set * @return the VirtualMachineScaleSetNetworkConfiguration object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetNetworkConfigurationDnsSettings.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetNetworkConfigurationDnsSettings.java index f6e7280b2a73..dd1a4f7e809b 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetNetworkConfigurationDnsSettings.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetNetworkConfigurationDnsSettings.java @@ -23,7 +23,7 @@ public class VirtualMachineScaleSetNetworkConfigurationDnsSettings { private List dnsServers; /** - * Get the dnsServers value. + * Get list of DNS servers IP addresses. * * @return the dnsServers value */ @@ -32,7 +32,7 @@ public List dnsServers() { } /** - * Set the dnsServers value. + * Set list of DNS servers IP addresses. * * @param dnsServers the dnsServers value to set * @return the VirtualMachineScaleSetNetworkConfigurationDnsSettings object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetNetworkProfile.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetNetworkProfile.java index fe7f47e5cb3e..f34b7b4a976c 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetNetworkProfile.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetNetworkProfile.java @@ -31,7 +31,7 @@ public class VirtualMachineScaleSetNetworkProfile { private List networkInterfaceConfigurations; /** - * Get the healthProbe value. + * Get a reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. * * @return the healthProbe value */ @@ -40,7 +40,7 @@ public ApiEntityReference healthProbe() { } /** - * Set the healthProbe value. + * Set a reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. * * @param healthProbe the healthProbe value to set * @return the VirtualMachineScaleSetNetworkProfile object itself. @@ -51,7 +51,7 @@ public VirtualMachineScaleSetNetworkProfile withHealthProbe(ApiEntityReference h } /** - * Get the networkInterfaceConfigurations value. + * Get the list of network configurations. * * @return the networkInterfaceConfigurations value */ @@ -60,7 +60,7 @@ public List networkInterfaceConfigur } /** - * Set the networkInterfaceConfigurations value. + * Set the list of network configurations. * * @param networkInterfaceConfigurations the networkInterfaceConfigurations value to set * @return the VirtualMachineScaleSetNetworkProfile object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetOSDisk.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetOSDisk.java index 99cbc7e6c6c5..1e60eda23cd9 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetOSDisk.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetOSDisk.java @@ -74,7 +74,7 @@ public class VirtualMachineScaleSetOSDisk { private VirtualMachineScaleSetManagedDiskParameters managedDisk; /** - * Get the name value. + * Get the disk name. * * @return the name value */ @@ -83,7 +83,7 @@ public String name() { } /** - * Set the name value. + * Set the disk name. * * @param name the name value to set * @return the VirtualMachineScaleSetOSDisk object itself. @@ -94,7 +94,7 @@ public VirtualMachineScaleSetOSDisk withName(String name) { } /** - * Get the caching value. + * Get specifies the caching requirements. <br><br> Possible values are: <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'None', 'ReadOnly', 'ReadWrite'. * * @return the caching value */ @@ -103,7 +103,7 @@ public CachingTypes caching() { } /** - * Set the caching value. + * Set specifies the caching requirements. <br><br> Possible values are: <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. Possible values include: 'None', 'ReadOnly', 'ReadWrite'. * * @param caching the caching value to set * @return the VirtualMachineScaleSetOSDisk object itself. @@ -114,7 +114,7 @@ public VirtualMachineScaleSetOSDisk withCaching(CachingTypes caching) { } /** - * Get the createOption value. + * Get specifies how the virtual machines in the scale set should be created.<br><br> The only allowed value is: **FromImage** \u2013 This value is used when you are using an image to create the virtual machine. If you are using a platform image, you also use the imageReference element described above. If you are using a marketplace image, you also use the plan element previously described. Possible values include: 'FromImage', 'Empty', 'Attach'. * * @return the createOption value */ @@ -123,7 +123,7 @@ public DiskCreateOptionTypes createOption() { } /** - * Set the createOption value. + * Set specifies how the virtual machines in the scale set should be created.<br><br> The only allowed value is: **FromImage** \u2013 This value is used when you are using an image to create the virtual machine. If you are using a platform image, you also use the imageReference element described above. If you are using a marketplace image, you also use the plan element previously described. Possible values include: 'FromImage', 'Empty', 'Attach'. * * @param createOption the createOption value to set * @return the VirtualMachineScaleSetOSDisk object itself. @@ -134,7 +134,7 @@ public VirtualMachineScaleSetOSDisk withCreateOption(DiskCreateOptionTypes creat } /** - * Get the osType value. + * Get this property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD. <br><br> Possible values are: <br><br> **Windows** <br><br> **Linux**. Possible values include: 'Windows', 'Linux'. * * @return the osType value */ @@ -143,7 +143,7 @@ public OperatingSystemTypes osType() { } /** - * Set the osType value. + * Set this property allows you to specify the type of the OS that is included in the disk if creating a VM from user-image or a specialized VHD. <br><br> Possible values are: <br><br> **Windows** <br><br> **Linux**. Possible values include: 'Windows', 'Linux'. * * @param osType the osType value to set * @return the VirtualMachineScaleSetOSDisk object itself. @@ -154,7 +154,7 @@ public VirtualMachineScaleSetOSDisk withOsType(OperatingSystemTypes osType) { } /** - * Get the image value. + * Get specifies information about the unmanaged user image to base the scale set on. * * @return the image value */ @@ -163,7 +163,7 @@ public VirtualHardDisk image() { } /** - * Set the image value. + * Set specifies information about the unmanaged user image to base the scale set on. * * @param image the image value to set * @return the VirtualMachineScaleSetOSDisk object itself. @@ -174,7 +174,7 @@ public VirtualMachineScaleSetOSDisk withImage(VirtualHardDisk image) { } /** - * Get the vhdContainers value. + * Get specifies the container urls that are used to store operating system disks for the scale set. * * @return the vhdContainers value */ @@ -183,7 +183,7 @@ public List vhdContainers() { } /** - * Set the vhdContainers value. + * Set specifies the container urls that are used to store operating system disks for the scale set. * * @param vhdContainers the vhdContainers value to set * @return the VirtualMachineScaleSetOSDisk object itself. @@ -194,7 +194,7 @@ public VirtualMachineScaleSetOSDisk withVhdContainers(List vhdContainers } /** - * Get the managedDisk value. + * Get the managed disk parameters. * * @return the managedDisk value */ @@ -203,7 +203,7 @@ public VirtualMachineScaleSetManagedDiskParameters managedDisk() { } /** - * Set the managedDisk value. + * Set the managed disk parameters. * * @param managedDisk the managedDisk value to set * @return the VirtualMachineScaleSetOSDisk object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetOSProfile.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetOSProfile.java index 5f9f10acad30..8f6c27eed581 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetOSProfile.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetOSProfile.java @@ -102,7 +102,7 @@ public class VirtualMachineScaleSetOSProfile { private List secrets; /** - * Get the computerNamePrefix value. + * Get specifies the computer name prefix for all of the virtual machines in the scale set. Computer name prefixes must be 1 to 15 characters long. * * @return the computerNamePrefix value */ @@ -111,7 +111,7 @@ public String computerNamePrefix() { } /** - * Set the computerNamePrefix value. + * Set specifies the computer name prefix for all of the virtual machines in the scale set. Computer name prefixes must be 1 to 15 characters long. * * @param computerNamePrefix the computerNamePrefix value to set * @return the VirtualMachineScaleSetOSProfile object itself. @@ -122,7 +122,7 @@ public VirtualMachineScaleSetOSProfile withComputerNamePrefix(String computerNam } /** - * Get the adminUsername value. + * Get specifies the name of the administrator account. <br><br> **Windows-only restriction:** Cannot end in "." <br><br> **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". <br><br> **Minimum-length (Linux):** 1 character <br><br> **Max-length (Linux):** 64 characters <br><br> **Max-length (Windows):** 20 characters <br><br><li> For root access to the Linux VM, see [Using root privileges on Linux virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-use-root-privileges?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)<br><li> For a list of built-in system users on Linux that should not be used in this field, see [Selecting User Names for Linux on Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-usernames?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). * * @return the adminUsername value */ @@ -131,7 +131,7 @@ public String adminUsername() { } /** - * Set the adminUsername value. + * Set specifies the name of the administrator account. <br><br> **Windows-only restriction:** Cannot end in "." <br><br> **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". <br><br> **Minimum-length (Linux):** 1 character <br><br> **Max-length (Linux):** 64 characters <br><br> **Max-length (Windows):** 20 characters <br><br><li> For root access to the Linux VM, see [Using root privileges on Linux virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-use-root-privileges?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)<br><li> For a list of built-in system users on Linux that should not be used in this field, see [Selecting User Names for Linux on Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-usernames?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). * * @param adminUsername the adminUsername value to set * @return the VirtualMachineScaleSetOSProfile object itself. @@ -142,7 +142,7 @@ public VirtualMachineScaleSetOSProfile withAdminUsername(String adminUsername) { } /** - * Get the adminPassword value. + * Get specifies the password of the administrator account. <br><br> **Minimum-length (Windows):** 8 characters <br><br> **Minimum-length (Linux):** 6 characters <br><br> **Max-length (Windows):** 123 characters <br><br> **Max-length (Linux):** 72 characters <br><br> **Complexity requirements:** 3 out of 4 conditions below need to be fulfilled <br> Has lower characters <br>Has upper characters <br> Has a digit <br> Has a special character (Regex match [\W_]) <br><br> **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" <br><br> For resetting the password, see [How to reset the Remote Desktop service or its login password in a Windows VM](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-reset-rdp?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) <br><br> For resetting root password, see [Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-vmaccess-extension?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#reset-root-password). * * @return the adminPassword value */ @@ -151,7 +151,7 @@ public String adminPassword() { } /** - * Set the adminPassword value. + * Set specifies the password of the administrator account. <br><br> **Minimum-length (Windows):** 8 characters <br><br> **Minimum-length (Linux):** 6 characters <br><br> **Max-length (Windows):** 123 characters <br><br> **Max-length (Linux):** 72 characters <br><br> **Complexity requirements:** 3 out of 4 conditions below need to be fulfilled <br> Has lower characters <br>Has upper characters <br> Has a digit <br> Has a special character (Regex match [\W_]) <br><br> **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" <br><br> For resetting the password, see [How to reset the Remote Desktop service or its login password in a Windows VM](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-reset-rdp?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) <br><br> For resetting root password, see [Manage users, SSH, and check or repair disks on Azure Linux VMs using the VMAccess Extension](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-vmaccess-extension?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json#reset-root-password). * * @param adminPassword the adminPassword value to set * @return the VirtualMachineScaleSetOSProfile object itself. @@ -162,7 +162,7 @@ public VirtualMachineScaleSetOSProfile withAdminPassword(String adminPassword) { } /** - * Get the customData value. + * Get specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. <br><br> For using cloud-init for your VM, see [Using cloud-init to customize a Linux VM during creation](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-cloud-init?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). * * @return the customData value */ @@ -171,7 +171,7 @@ public String customData() { } /** - * Set the customData value. + * Set specifies a base-64 encoded string of custom data. The base-64 encoded string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum length of the binary array is 65535 bytes. <br><br> For using cloud-init for your VM, see [Using cloud-init to customize a Linux VM during creation](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-using-cloud-init?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). * * @param customData the customData value to set * @return the VirtualMachineScaleSetOSProfile object itself. @@ -182,7 +182,7 @@ public VirtualMachineScaleSetOSProfile withCustomData(String customData) { } /** - * Get the windowsConfiguration value. + * Get specifies Windows operating system settings on the virtual machine. * * @return the windowsConfiguration value */ @@ -191,7 +191,7 @@ public WindowsConfiguration windowsConfiguration() { } /** - * Set the windowsConfiguration value. + * Set specifies Windows operating system settings on the virtual machine. * * @param windowsConfiguration the windowsConfiguration value to set * @return the VirtualMachineScaleSetOSProfile object itself. @@ -202,7 +202,7 @@ public VirtualMachineScaleSetOSProfile withWindowsConfiguration(WindowsConfigura } /** - * Get the linuxConfiguration value. + * Get specifies the Linux operating system settings on the virtual machine. <br><br>For a list of supported Linux distributions, see [Linux on Azure-Endorsed Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) <br><br> For running non-endorsed distributions, see [Information for Non-Endorsed Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-create-upload-generic?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). * * @return the linuxConfiguration value */ @@ -211,7 +211,7 @@ public LinuxConfiguration linuxConfiguration() { } /** - * Set the linuxConfiguration value. + * Set specifies the Linux operating system settings on the virtual machine. <br><br>For a list of supported Linux distributions, see [Linux on Azure-Endorsed Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json) <br><br> For running non-endorsed distributions, see [Information for Non-Endorsed Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-create-upload-generic?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json). * * @param linuxConfiguration the linuxConfiguration value to set * @return the VirtualMachineScaleSetOSProfile object itself. @@ -222,7 +222,7 @@ public VirtualMachineScaleSetOSProfile withLinuxConfiguration(LinuxConfiguration } /** - * Get the secrets value. + * Get specifies set of certificates that should be installed onto the virtual machines in the scale set. * * @return the secrets value */ @@ -231,7 +231,7 @@ public List secrets() { } /** - * Set the secrets value. + * Set specifies set of certificates that should be installed onto the virtual machines in the scale set. * * @param secrets the secrets value to set * @return the VirtualMachineScaleSetOSProfile object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetPublicIPAddressConfiguration.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetPublicIPAddressConfiguration.java index 02efe61bd311..a1e038b2e03b 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetPublicIPAddressConfiguration.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetPublicIPAddressConfiguration.java @@ -36,7 +36,7 @@ public class VirtualMachineScaleSetPublicIPAddressConfiguration { private VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings dnsSettings; /** - * Get the name value. + * Get the publicIP address configuration name. * * @return the name value */ @@ -45,7 +45,7 @@ public String name() { } /** - * Set the name value. + * Set the publicIP address configuration name. * * @param name the name value to set * @return the VirtualMachineScaleSetPublicIPAddressConfiguration object itself. @@ -56,7 +56,7 @@ public VirtualMachineScaleSetPublicIPAddressConfiguration withName(String name) } /** - * Get the idleTimeoutInMinutes value. + * Get the idle timeout of the public IP address. * * @return the idleTimeoutInMinutes value */ @@ -65,7 +65,7 @@ public Integer idleTimeoutInMinutes() { } /** - * Set the idleTimeoutInMinutes value. + * Set the idle timeout of the public IP address. * * @param idleTimeoutInMinutes the idleTimeoutInMinutes value to set * @return the VirtualMachineScaleSetPublicIPAddressConfiguration object itself. @@ -76,7 +76,7 @@ public VirtualMachineScaleSetPublicIPAddressConfiguration withIdleTimeoutInMinut } /** - * Get the dnsSettings value. + * Get the dns settings to be applied on the publicIP addresses . * * @return the dnsSettings value */ @@ -85,7 +85,7 @@ public VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings dnsSettings } /** - * Set the dnsSettings value. + * Set the dns settings to be applied on the publicIP addresses . * * @param dnsSettings the dnsSettings value to set * @return the VirtualMachineScaleSetPublicIPAddressConfiguration object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings.java index bfb9d9f31008..6305425cff74 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings.java @@ -24,7 +24,7 @@ public class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings { private String domainNameLabel; /** - * Get the domainNameLabel value. + * Get the Domain name label.The concatenation of the domain name label and vm index will be the domain name labels of the PublicIPAddress resources that will be created. * * @return the domainNameLabel value */ @@ -33,7 +33,7 @@ public String domainNameLabel() { } /** - * Set the domainNameLabel value. + * Set the Domain name label.The concatenation of the domain name label and vm index will be the domain name labels of the PublicIPAddress resources that will be created. * * @param domainNameLabel the domainNameLabel value to set * @return the VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetSkuCapacity.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetSkuCapacity.java index a703e24737c3..89356071589b 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetSkuCapacity.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetSkuCapacity.java @@ -40,7 +40,7 @@ public class VirtualMachineScaleSetSkuCapacity { private VirtualMachineScaleSetSkuScaleType scaleType; /** - * Get the minimum value. + * Get the minimum capacity. * * @return the minimum value */ @@ -49,7 +49,7 @@ public Long minimum() { } /** - * Get the maximum value. + * Get the maximum capacity that can be set. * * @return the maximum value */ @@ -58,7 +58,7 @@ public Long maximum() { } /** - * Get the defaultCapacity value. + * Get the default capacity. * * @return the defaultCapacity value */ @@ -67,7 +67,7 @@ public Long defaultCapacity() { } /** - * Get the scaleType value. + * Get the scale type applicable to the sku. Possible values include: 'Automatic', 'None'. * * @return the scaleType value */ diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetStorageProfile.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetStorageProfile.java index 01381bfa1f23..00851a9a0884 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetStorageProfile.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetStorageProfile.java @@ -44,7 +44,7 @@ public class VirtualMachineScaleSetStorageProfile { private List dataDisks; /** - * Get the imageReference value. + * Get specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations. * * @return the imageReference value */ @@ -53,7 +53,7 @@ public ImageReference imageReference() { } /** - * Set the imageReference value. + * Set specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations. * * @param imageReference the imageReference value to set * @return the VirtualMachineScaleSetStorageProfile object itself. @@ -64,7 +64,7 @@ public VirtualMachineScaleSetStorageProfile withImageReference(ImageReference im } /** - * Get the osDisk value. + * Get specifies information about the operating system disk used by the virtual machines in the scale set. <br><br> For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). * * @return the osDisk value */ @@ -73,7 +73,7 @@ public VirtualMachineScaleSetOSDisk osDisk() { } /** - * Set the osDisk value. + * Set specifies information about the operating system disk used by the virtual machines in the scale set. <br><br> For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). * * @param osDisk the osDisk value to set * @return the VirtualMachineScaleSetStorageProfile object itself. @@ -84,7 +84,7 @@ public VirtualMachineScaleSetStorageProfile withOsDisk(VirtualMachineScaleSetOSD } /** - * Get the dataDisks value. + * Get specifies the parameters that are used to add data disks to the virtual machines in the scale set. <br><br> For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). * * @return the dataDisks value */ @@ -93,7 +93,7 @@ public List dataDisks() { } /** - * Set the dataDisks value. + * Set specifies the parameters that are used to add data disks to the virtual machines in the scale set. <br><br> For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). * * @param dataDisks the dataDisks value to set * @return the VirtualMachineScaleSetStorageProfile object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdate.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdate.java index 2bb2de6343d2..d2653e650d45 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdate.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdate.java @@ -62,7 +62,7 @@ public class VirtualMachineScaleSetUpdate extends UpdateResource { private VirtualMachineScaleSetIdentity identity; /** - * Get the sku value. + * Get the virtual machine scale set sku. * * @return the sku value */ @@ -71,7 +71,7 @@ public Sku sku() { } /** - * Set the sku value. + * Set the virtual machine scale set sku. * * @param sku the sku value to set * @return the VirtualMachineScaleSetUpdate object itself. @@ -82,7 +82,7 @@ public VirtualMachineScaleSetUpdate withSku(Sku sku) { } /** - * Get the plan value. + * Get the purchase plan when deploying a virtual machine scale set from VM Marketplace images. * * @return the plan value */ @@ -91,7 +91,7 @@ public Plan plan() { } /** - * Set the plan value. + * Set the purchase plan when deploying a virtual machine scale set from VM Marketplace images. * * @param plan the plan value to set * @return the VirtualMachineScaleSetUpdate object itself. @@ -102,7 +102,7 @@ public VirtualMachineScaleSetUpdate withPlan(Plan plan) { } /** - * Get the upgradePolicy value. + * Get the upgrade policy. * * @return the upgradePolicy value */ @@ -111,7 +111,7 @@ public UpgradePolicy upgradePolicy() { } /** - * Set the upgradePolicy value. + * Set the upgrade policy. * * @param upgradePolicy the upgradePolicy value to set * @return the VirtualMachineScaleSetUpdate object itself. @@ -122,7 +122,7 @@ public VirtualMachineScaleSetUpdate withUpgradePolicy(UpgradePolicy upgradePolic } /** - * Get the virtualMachineProfile value. + * Get the virtual machine profile. * * @return the virtualMachineProfile value */ @@ -131,7 +131,7 @@ public VirtualMachineScaleSetUpdateVMProfile virtualMachineProfile() { } /** - * Set the virtualMachineProfile value. + * Set the virtual machine profile. * * @param virtualMachineProfile the virtualMachineProfile value to set * @return the VirtualMachineScaleSetUpdate object itself. @@ -142,7 +142,7 @@ public VirtualMachineScaleSetUpdate withVirtualMachineProfile(VirtualMachineScal } /** - * Get the overprovision value. + * Get specifies whether the Virtual Machine Scale Set should be overprovisioned. * * @return the overprovision value */ @@ -151,7 +151,7 @@ public Boolean overprovision() { } /** - * Set the overprovision value. + * Set specifies whether the Virtual Machine Scale Set should be overprovisioned. * * @param overprovision the overprovision value to set * @return the VirtualMachineScaleSetUpdate object itself. @@ -162,7 +162,7 @@ public VirtualMachineScaleSetUpdate withOverprovision(Boolean overprovision) { } /** - * Get the singlePlacementGroup value. + * Get when true this limits the scale set to a single placement group, of max size 100 virtual machines. * * @return the singlePlacementGroup value */ @@ -171,7 +171,7 @@ public Boolean singlePlacementGroup() { } /** - * Set the singlePlacementGroup value. + * Set when true this limits the scale set to a single placement group, of max size 100 virtual machines. * * @param singlePlacementGroup the singlePlacementGroup value to set * @return the VirtualMachineScaleSetUpdate object itself. @@ -182,7 +182,7 @@ public VirtualMachineScaleSetUpdate withSinglePlacementGroup(Boolean singlePlace } /** - * Get the identity value. + * Get the identity of the virtual machine scale set, if configured. * * @return the identity value */ @@ -191,7 +191,7 @@ public VirtualMachineScaleSetIdentity identity() { } /** - * Set the identity value. + * Set the identity of the virtual machine scale set, if configured. * * @param identity the identity value to set * @return the VirtualMachineScaleSetUpdate object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateIPConfiguration.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateIPConfiguration.java index a3ea6cde23b4..602525c6141b 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateIPConfiguration.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateIPConfiguration.java @@ -71,7 +71,7 @@ public class VirtualMachineScaleSetUpdateIPConfiguration extends SubResource { private List loadBalancerInboundNatPools; /** - * Get the name value. + * Get the IP configuration name. * * @return the name value */ @@ -80,7 +80,7 @@ public String name() { } /** - * Set the name value. + * Set the IP configuration name. * * @param name the name value to set * @return the VirtualMachineScaleSetUpdateIPConfiguration object itself. @@ -91,7 +91,7 @@ public VirtualMachineScaleSetUpdateIPConfiguration withName(String name) { } /** - * Get the subnet value. + * Get the subnet. * * @return the subnet value */ @@ -100,7 +100,7 @@ public ApiEntityReference subnet() { } /** - * Set the subnet value. + * Set the subnet. * * @param subnet the subnet value to set * @return the VirtualMachineScaleSetUpdateIPConfiguration object itself. @@ -111,7 +111,7 @@ public VirtualMachineScaleSetUpdateIPConfiguration withSubnet(ApiEntityReference } /** - * Get the primary value. + * Get specifies the primary IP Configuration in case the network interface has more than one IP Configuration. * * @return the primary value */ @@ -120,7 +120,7 @@ public Boolean primary() { } /** - * Set the primary value. + * Set specifies the primary IP Configuration in case the network interface has more than one IP Configuration. * * @param primary the primary value to set * @return the VirtualMachineScaleSetUpdateIPConfiguration object itself. @@ -131,7 +131,7 @@ public VirtualMachineScaleSetUpdateIPConfiguration withPrimary(Boolean primary) } /** - * Get the publicIPAddressConfiguration value. + * Get the publicIPAddressConfiguration. * * @return the publicIPAddressConfiguration value */ @@ -140,7 +140,7 @@ public VirtualMachineScaleSetUpdatePublicIPAddressConfiguration publicIPAddressC } /** - * Set the publicIPAddressConfiguration value. + * Set the publicIPAddressConfiguration. * * @param publicIPAddressConfiguration the publicIPAddressConfiguration value to set * @return the VirtualMachineScaleSetUpdateIPConfiguration object itself. @@ -151,7 +151,7 @@ public VirtualMachineScaleSetUpdateIPConfiguration withPublicIPAddressConfigurat } /** - * Get the privateIPAddressVersion value. + * Get available from Api-Version 2017-03-30 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. Possible values include: 'IPv4', 'IPv6'. * * @return the privateIPAddressVersion value */ @@ -160,7 +160,7 @@ public IPVersion privateIPAddressVersion() { } /** - * Set the privateIPAddressVersion value. + * Set available from Api-Version 2017-03-30 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. Possible values include: 'IPv4', 'IPv6'. * * @param privateIPAddressVersion the privateIPAddressVersion value to set * @return the VirtualMachineScaleSetUpdateIPConfiguration object itself. @@ -171,7 +171,7 @@ public VirtualMachineScaleSetUpdateIPConfiguration withPrivateIPAddressVersion(I } /** - * Get the applicationGatewayBackendAddressPools value. + * Get the application gateway backend address pools. * * @return the applicationGatewayBackendAddressPools value */ @@ -180,7 +180,7 @@ public List applicationGatewayBackendAddressPools() { } /** - * Set the applicationGatewayBackendAddressPools value. + * Set the application gateway backend address pools. * * @param applicationGatewayBackendAddressPools the applicationGatewayBackendAddressPools value to set * @return the VirtualMachineScaleSetUpdateIPConfiguration object itself. @@ -191,7 +191,7 @@ public VirtualMachineScaleSetUpdateIPConfiguration withApplicationGatewayBackend } /** - * Get the loadBalancerBackendAddressPools value. + * Get the load balancer backend address pools. * * @return the loadBalancerBackendAddressPools value */ @@ -200,7 +200,7 @@ public List loadBalancerBackendAddressPools() { } /** - * Set the loadBalancerBackendAddressPools value. + * Set the load balancer backend address pools. * * @param loadBalancerBackendAddressPools the loadBalancerBackendAddressPools value to set * @return the VirtualMachineScaleSetUpdateIPConfiguration object itself. @@ -211,7 +211,7 @@ public VirtualMachineScaleSetUpdateIPConfiguration withLoadBalancerBackendAddres } /** - * Get the loadBalancerInboundNatPools value. + * Get the load balancer inbound nat pools. * * @return the loadBalancerInboundNatPools value */ @@ -220,7 +220,7 @@ public List loadBalancerInboundNatPools() { } /** - * Set the loadBalancerInboundNatPools value. + * Set the load balancer inbound nat pools. * * @param loadBalancerInboundNatPools the loadBalancerInboundNatPools value to set * @return the VirtualMachineScaleSetUpdateIPConfiguration object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateNetworkConfiguration.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateNetworkConfiguration.java index 062a820c549b..5494f9fba563 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateNetworkConfiguration.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateNetworkConfiguration.java @@ -57,7 +57,7 @@ public class VirtualMachineScaleSetUpdateNetworkConfiguration extends SubResourc private List ipConfigurations; /** - * Get the name value. + * Get the network configuration name. * * @return the name value */ @@ -66,7 +66,7 @@ public String name() { } /** - * Set the name value. + * Set the network configuration name. * * @param name the name value to set * @return the VirtualMachineScaleSetUpdateNetworkConfiguration object itself. @@ -77,7 +77,7 @@ public VirtualMachineScaleSetUpdateNetworkConfiguration withName(String name) { } /** - * Get the primary value. + * Get whether this is a primary NIC on a virtual machine. * * @return the primary value */ @@ -86,7 +86,7 @@ public Boolean primary() { } /** - * Set the primary value. + * Set whether this is a primary NIC on a virtual machine. * * @param primary the primary value to set * @return the VirtualMachineScaleSetUpdateNetworkConfiguration object itself. @@ -97,7 +97,7 @@ public VirtualMachineScaleSetUpdateNetworkConfiguration withPrimary(Boolean prim } /** - * Get the enableAcceleratedNetworking value. + * Get specifies whether the network interface is accelerated networking-enabled. * * @return the enableAcceleratedNetworking value */ @@ -106,7 +106,7 @@ public Boolean enableAcceleratedNetworking() { } /** - * Set the enableAcceleratedNetworking value. + * Set specifies whether the network interface is accelerated networking-enabled. * * @param enableAcceleratedNetworking the enableAcceleratedNetworking value to set * @return the VirtualMachineScaleSetUpdateNetworkConfiguration object itself. @@ -117,7 +117,7 @@ public VirtualMachineScaleSetUpdateNetworkConfiguration withEnableAcceleratedNet } /** - * Get the networkSecurityGroup value. + * Get the network security group. * * @return the networkSecurityGroup value */ @@ -126,7 +126,7 @@ public SubResource networkSecurityGroup() { } /** - * Set the networkSecurityGroup value. + * Set the network security group. * * @param networkSecurityGroup the networkSecurityGroup value to set * @return the VirtualMachineScaleSetUpdateNetworkConfiguration object itself. @@ -137,7 +137,7 @@ public VirtualMachineScaleSetUpdateNetworkConfiguration withNetworkSecurityGroup } /** - * Get the dnsSettings value. + * Get the dns settings to be applied on the network interfaces. * * @return the dnsSettings value */ @@ -146,7 +146,7 @@ public VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings() { } /** - * Set the dnsSettings value. + * Set the dns settings to be applied on the network interfaces. * * @param dnsSettings the dnsSettings value to set * @return the VirtualMachineScaleSetUpdateNetworkConfiguration object itself. @@ -157,7 +157,7 @@ public VirtualMachineScaleSetUpdateNetworkConfiguration withDnsSettings(VirtualM } /** - * Get the ipConfigurations value. + * Get the virtual machine scale set IP Configuration. * * @return the ipConfigurations value */ @@ -166,7 +166,7 @@ public List ipConfigurations() { } /** - * Set the ipConfigurations value. + * Set the virtual machine scale set IP Configuration. * * @param ipConfigurations the ipConfigurations value to set * @return the VirtualMachineScaleSetUpdateNetworkConfiguration object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateNetworkProfile.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateNetworkProfile.java index 8969ea3758d3..04d8b443cbff 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateNetworkProfile.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateNetworkProfile.java @@ -22,7 +22,7 @@ public class VirtualMachineScaleSetUpdateNetworkProfile { private List networkInterfaceConfigurations; /** - * Get the networkInterfaceConfigurations value. + * Get the list of network configurations. * * @return the networkInterfaceConfigurations value */ @@ -31,7 +31,7 @@ public List networkInterfaceCo } /** - * Set the networkInterfaceConfigurations value. + * Set the list of network configurations. * * @param networkInterfaceConfigurations the networkInterfaceConfigurations value to set * @return the VirtualMachineScaleSetUpdateNetworkProfile object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateOSDisk.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateOSDisk.java index bfb9fd3afdfe..7ac453037203 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateOSDisk.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateOSDisk.java @@ -44,7 +44,7 @@ public class VirtualMachineScaleSetUpdateOSDisk { private VirtualMachineScaleSetManagedDiskParameters managedDisk; /** - * Get the caching value. + * Get the caching type. Possible values include: 'None', 'ReadOnly', 'ReadWrite'. * * @return the caching value */ @@ -53,7 +53,7 @@ public CachingTypes caching() { } /** - * Set the caching value. + * Set the caching type. Possible values include: 'None', 'ReadOnly', 'ReadWrite'. * * @param caching the caching value to set * @return the VirtualMachineScaleSetUpdateOSDisk object itself. @@ -64,7 +64,7 @@ public VirtualMachineScaleSetUpdateOSDisk withCaching(CachingTypes caching) { } /** - * Get the image value. + * Get the Source User Image VirtualHardDisk. This VirtualHardDisk will be copied before using it to attach to the Virtual Machine. If SourceImage is provided, the destination VirtualHardDisk should not exist. * * @return the image value */ @@ -73,7 +73,7 @@ public VirtualHardDisk image() { } /** - * Set the image value. + * Set the Source User Image VirtualHardDisk. This VirtualHardDisk will be copied before using it to attach to the Virtual Machine. If SourceImage is provided, the destination VirtualHardDisk should not exist. * * @param image the image value to set * @return the VirtualMachineScaleSetUpdateOSDisk object itself. @@ -84,7 +84,7 @@ public VirtualMachineScaleSetUpdateOSDisk withImage(VirtualHardDisk image) { } /** - * Get the vhdContainers value. + * Get the list of virtual hard disk container uris. * * @return the vhdContainers value */ @@ -93,7 +93,7 @@ public List vhdContainers() { } /** - * Set the vhdContainers value. + * Set the list of virtual hard disk container uris. * * @param vhdContainers the vhdContainers value to set * @return the VirtualMachineScaleSetUpdateOSDisk object itself. @@ -104,7 +104,7 @@ public VirtualMachineScaleSetUpdateOSDisk withVhdContainers(List vhdCont } /** - * Get the managedDisk value. + * Get the managed disk parameters. * * @return the managedDisk value */ @@ -113,7 +113,7 @@ public VirtualMachineScaleSetManagedDiskParameters managedDisk() { } /** - * Set the managedDisk value. + * Set the managed disk parameters. * * @param managedDisk the managedDisk value to set * @return the VirtualMachineScaleSetUpdateOSDisk object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateOSProfile.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateOSProfile.java index c428e5000181..a2e89dfb8a01 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateOSProfile.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateOSProfile.java @@ -40,7 +40,7 @@ public class VirtualMachineScaleSetUpdateOSProfile { private List secrets; /** - * Get the customData value. + * Get a base-64 encoded string of custom data. * * @return the customData value */ @@ -49,7 +49,7 @@ public String customData() { } /** - * Set the customData value. + * Set a base-64 encoded string of custom data. * * @param customData the customData value to set * @return the VirtualMachineScaleSetUpdateOSProfile object itself. @@ -60,7 +60,7 @@ public VirtualMachineScaleSetUpdateOSProfile withCustomData(String customData) { } /** - * Get the windowsConfiguration value. + * Get the Windows Configuration of the OS profile. * * @return the windowsConfiguration value */ @@ -69,7 +69,7 @@ public WindowsConfiguration windowsConfiguration() { } /** - * Set the windowsConfiguration value. + * Set the Windows Configuration of the OS profile. * * @param windowsConfiguration the windowsConfiguration value to set * @return the VirtualMachineScaleSetUpdateOSProfile object itself. @@ -80,7 +80,7 @@ public VirtualMachineScaleSetUpdateOSProfile withWindowsConfiguration(WindowsCon } /** - * Get the linuxConfiguration value. + * Get the Linux Configuration of the OS profile. * * @return the linuxConfiguration value */ @@ -89,7 +89,7 @@ public LinuxConfiguration linuxConfiguration() { } /** - * Set the linuxConfiguration value. + * Set the Linux Configuration of the OS profile. * * @param linuxConfiguration the linuxConfiguration value to set * @return the VirtualMachineScaleSetUpdateOSProfile object itself. @@ -100,7 +100,7 @@ public VirtualMachineScaleSetUpdateOSProfile withLinuxConfiguration(LinuxConfigu } /** - * Get the secrets value. + * Get the List of certificates for addition to the VM. * * @return the secrets value */ @@ -109,7 +109,7 @@ public List secrets() { } /** - * Set the secrets value. + * Set the List of certificates for addition to the VM. * * @param secrets the secrets value to set * @return the VirtualMachineScaleSetUpdateOSProfile object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdatePublicIPAddressConfiguration.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdatePublicIPAddressConfiguration.java index c2fbac0f5972..48ef0b65a38a 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdatePublicIPAddressConfiguration.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdatePublicIPAddressConfiguration.java @@ -36,7 +36,7 @@ public class VirtualMachineScaleSetUpdatePublicIPAddressConfiguration { private VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings dnsSettings; /** - * Get the name value. + * Get the publicIP address configuration name. * * @return the name value */ @@ -45,7 +45,7 @@ public String name() { } /** - * Set the name value. + * Set the publicIP address configuration name. * * @param name the name value to set * @return the VirtualMachineScaleSetUpdatePublicIPAddressConfiguration object itself. @@ -56,7 +56,7 @@ public VirtualMachineScaleSetUpdatePublicIPAddressConfiguration withName(String } /** - * Get the idleTimeoutInMinutes value. + * Get the idle timeout of the public IP address. * * @return the idleTimeoutInMinutes value */ @@ -65,7 +65,7 @@ public Integer idleTimeoutInMinutes() { } /** - * Set the idleTimeoutInMinutes value. + * Set the idle timeout of the public IP address. * * @param idleTimeoutInMinutes the idleTimeoutInMinutes value to set * @return the VirtualMachineScaleSetUpdatePublicIPAddressConfiguration object itself. @@ -76,7 +76,7 @@ public VirtualMachineScaleSetUpdatePublicIPAddressConfiguration withIdleTimeoutI } /** - * Get the dnsSettings value. + * Get the dns settings to be applied on the publicIP addresses . * * @return the dnsSettings value */ @@ -85,7 +85,7 @@ public VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings dnsSettings } /** - * Set the dnsSettings value. + * Set the dns settings to be applied on the publicIP addresses . * * @param dnsSettings the dnsSettings value to set * @return the VirtualMachineScaleSetUpdatePublicIPAddressConfiguration object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateStorageProfile.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateStorageProfile.java index 2e5f7eb0758d..3c3dc45cd785 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateStorageProfile.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateStorageProfile.java @@ -34,7 +34,7 @@ public class VirtualMachineScaleSetUpdateStorageProfile { private List dataDisks; /** - * Get the imageReference value. + * Get the image reference. * * @return the imageReference value */ @@ -43,7 +43,7 @@ public ImageReference imageReference() { } /** - * Set the imageReference value. + * Set the image reference. * * @param imageReference the imageReference value to set * @return the VirtualMachineScaleSetUpdateStorageProfile object itself. @@ -54,7 +54,7 @@ public VirtualMachineScaleSetUpdateStorageProfile withImageReference(ImageRefere } /** - * Get the osDisk value. + * Get the OS disk. * * @return the osDisk value */ @@ -63,7 +63,7 @@ public VirtualMachineScaleSetUpdateOSDisk osDisk() { } /** - * Set the osDisk value. + * Set the OS disk. * * @param osDisk the osDisk value to set * @return the VirtualMachineScaleSetUpdateStorageProfile object itself. @@ -74,7 +74,7 @@ public VirtualMachineScaleSetUpdateStorageProfile withOsDisk(VirtualMachineScale } /** - * Get the dataDisks value. + * Get the data disks. * * @return the dataDisks value */ @@ -83,7 +83,7 @@ public List dataDisks() { } /** - * Set the dataDisks value. + * Set the data disks. * * @param dataDisks the dataDisks value to set * @return the VirtualMachineScaleSetUpdateStorageProfile object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateVMProfile.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateVMProfile.java index bc9c120b8488..2d3c7b1f4683 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateVMProfile.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetUpdateVMProfile.java @@ -51,7 +51,7 @@ public class VirtualMachineScaleSetUpdateVMProfile { private String licenseType; /** - * Get the osProfile value. + * Get the virtual machine scale set OS profile. * * @return the osProfile value */ @@ -60,7 +60,7 @@ public VirtualMachineScaleSetUpdateOSProfile osProfile() { } /** - * Set the osProfile value. + * Set the virtual machine scale set OS profile. * * @param osProfile the osProfile value to set * @return the VirtualMachineScaleSetUpdateVMProfile object itself. @@ -71,7 +71,7 @@ public VirtualMachineScaleSetUpdateVMProfile withOsProfile(VirtualMachineScaleSe } /** - * Get the storageProfile value. + * Get the virtual machine scale set storage profile. * * @return the storageProfile value */ @@ -80,7 +80,7 @@ public VirtualMachineScaleSetUpdateStorageProfile storageProfile() { } /** - * Set the storageProfile value. + * Set the virtual machine scale set storage profile. * * @param storageProfile the storageProfile value to set * @return the VirtualMachineScaleSetUpdateVMProfile object itself. @@ -91,7 +91,7 @@ public VirtualMachineScaleSetUpdateVMProfile withStorageProfile(VirtualMachineSc } /** - * Get the networkProfile value. + * Get the virtual machine scale set network profile. * * @return the networkProfile value */ @@ -100,7 +100,7 @@ public VirtualMachineScaleSetUpdateNetworkProfile networkProfile() { } /** - * Set the networkProfile value. + * Set the virtual machine scale set network profile. * * @param networkProfile the networkProfile value to set * @return the VirtualMachineScaleSetUpdateVMProfile object itself. @@ -111,7 +111,7 @@ public VirtualMachineScaleSetUpdateVMProfile withNetworkProfile(VirtualMachineSc } /** - * Get the diagnosticsProfile value. + * Get the virtual machine scale set diagnostics profile. * * @return the diagnosticsProfile value */ @@ -120,7 +120,7 @@ public DiagnosticsProfile diagnosticsProfile() { } /** - * Set the diagnosticsProfile value. + * Set the virtual machine scale set diagnostics profile. * * @param diagnosticsProfile the diagnosticsProfile value to set * @return the VirtualMachineScaleSetUpdateVMProfile object itself. @@ -131,7 +131,7 @@ public VirtualMachineScaleSetUpdateVMProfile withDiagnosticsProfile(DiagnosticsP } /** - * Get the extensionProfile value. + * Get the virtual machine scale set extension profile. * * @return the extensionProfile value */ @@ -140,7 +140,7 @@ public VirtualMachineScaleSetExtensionProfile extensionProfile() { } /** - * Set the extensionProfile value. + * Set the virtual machine scale set extension profile. * * @param extensionProfile the extensionProfile value to set * @return the VirtualMachineScaleSetUpdateVMProfile object itself. @@ -151,7 +151,7 @@ public VirtualMachineScaleSetUpdateVMProfile withExtensionProfile(VirtualMachine } /** - * Get the licenseType value. + * Get the license type, which is for bring your own license scenario. * * @return the licenseType value */ @@ -160,7 +160,7 @@ public String licenseType() { } /** - * Set the licenseType value. + * Set the license type, which is for bring your own license scenario. * * @param licenseType the licenseType value to set * @return the VirtualMachineScaleSetUpdateVMProfile object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetVM.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetVM.java index b17368ac6c1a..30511a027f9e 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetVM.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetVM.java @@ -50,7 +50,7 @@ public interface VirtualMachineScaleSetVM extends HasInner statusesSummary; /** - * Get the name value. + * Get the extension name. * * @return the name value */ @@ -37,7 +37,7 @@ public String name() { } /** - * Get the statusesSummary value. + * Get the extensions information. * * @return the statusesSummary value */ diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetVMInstanceIDs.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetVMInstanceIDs.java index 8104a7594841..eb9fa8f69ddf 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetVMInstanceIDs.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetVMInstanceIDs.java @@ -24,7 +24,7 @@ public class VirtualMachineScaleSetVMInstanceIDs { private List instanceIds; /** - * Get the instanceIds value. + * Get the virtual machine scale set instance ids. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. * * @return the instanceIds value */ @@ -33,7 +33,7 @@ public List instanceIds() { } /** - * Set the instanceIds value. + * Set the virtual machine scale set instance ids. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. * * @param instanceIds the instanceIds value to set * @return the VirtualMachineScaleSetVMInstanceIDs object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetVMInstanceRequiredIDs.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetVMInstanceRequiredIDs.java index 38b558d40fed..82bdb8ac26d9 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetVMInstanceRequiredIDs.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetVMInstanceRequiredIDs.java @@ -22,7 +22,7 @@ public class VirtualMachineScaleSetVMInstanceRequiredIDs { private List instanceIds; /** - * Get the instanceIds value. + * Get the virtual machine scale set instance ids. * * @return the instanceIds value */ @@ -31,7 +31,7 @@ public List instanceIds() { } /** - * Set the instanceIds value. + * Set the virtual machine scale set instance ids. * * @param instanceIds the instanceIds value to set * @return the VirtualMachineScaleSetVMInstanceRequiredIDs object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetVMProfile.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetVMProfile.java index eb48fe1b92b5..e4f0a0c7ccab 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetVMProfile.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineScaleSetVMProfile.java @@ -64,7 +64,7 @@ public class VirtualMachineScaleSetVMProfile { private String licenseType; /** - * Get the osProfile value. + * Get specifies the operating system settings for the virtual machines in the scale set. * * @return the osProfile value */ @@ -73,7 +73,7 @@ public VirtualMachineScaleSetOSProfile osProfile() { } /** - * Set the osProfile value. + * Set specifies the operating system settings for the virtual machines in the scale set. * * @param osProfile the osProfile value to set * @return the VirtualMachineScaleSetVMProfile object itself. @@ -84,7 +84,7 @@ public VirtualMachineScaleSetVMProfile withOsProfile(VirtualMachineScaleSetOSPro } /** - * Get the storageProfile value. + * Get specifies the storage settings for the virtual machine disks. * * @return the storageProfile value */ @@ -93,7 +93,7 @@ public VirtualMachineScaleSetStorageProfile storageProfile() { } /** - * Set the storageProfile value. + * Set specifies the storage settings for the virtual machine disks. * * @param storageProfile the storageProfile value to set * @return the VirtualMachineScaleSetVMProfile object itself. @@ -104,7 +104,7 @@ public VirtualMachineScaleSetVMProfile withStorageProfile(VirtualMachineScaleSet } /** - * Get the networkProfile value. + * Get specifies properties of the network interfaces of the virtual machines in the scale set. * * @return the networkProfile value */ @@ -113,7 +113,7 @@ public VirtualMachineScaleSetNetworkProfile networkProfile() { } /** - * Set the networkProfile value. + * Set specifies properties of the network interfaces of the virtual machines in the scale set. * * @param networkProfile the networkProfile value to set * @return the VirtualMachineScaleSetVMProfile object itself. @@ -124,7 +124,7 @@ public VirtualMachineScaleSetVMProfile withNetworkProfile(VirtualMachineScaleSet } /** - * Get the diagnosticsProfile value. + * Get specifies the boot diagnostic settings state. <br><br>Minimum api-version: 2015-06-15. * * @return the diagnosticsProfile value */ @@ -133,7 +133,7 @@ public DiagnosticsProfile diagnosticsProfile() { } /** - * Set the diagnosticsProfile value. + * Set specifies the boot diagnostic settings state. <br><br>Minimum api-version: 2015-06-15. * * @param diagnosticsProfile the diagnosticsProfile value to set * @return the VirtualMachineScaleSetVMProfile object itself. @@ -144,7 +144,7 @@ public VirtualMachineScaleSetVMProfile withDiagnosticsProfile(DiagnosticsProfile } /** - * Get the extensionProfile value. + * Get specifies a collection of settings for extensions installed on virtual machines in the scale set. * * @return the extensionProfile value */ @@ -153,7 +153,7 @@ public VirtualMachineScaleSetExtensionProfile extensionProfile() { } /** - * Set the extensionProfile value. + * Set specifies a collection of settings for extensions installed on virtual machines in the scale set. * * @param extensionProfile the extensionProfile value to set * @return the VirtualMachineScaleSetVMProfile object itself. @@ -164,7 +164,7 @@ public VirtualMachineScaleSetVMProfile withExtensionProfile(VirtualMachineScaleS } /** - * Get the licenseType value. + * Get specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. <br><br> Possible values are: <br><br> Windows_Client <br><br> Windows_Server <br><br> If this element is included in a request for an update, the value must match the initial value. This value cannot be updated. <br><br> For more information, see [Azure Hybrid Use Benefit for Windows Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) <br><br> Minimum api-version: 2015-06-15. * * @return the licenseType value */ @@ -173,7 +173,7 @@ public String licenseType() { } /** - * Set the licenseType value. + * Set specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. <br><br> Possible values are: <br><br> Windows_Client <br><br> Windows_Server <br><br> If this element is included in a request for an update, the value must match the initial value. This value cannot be updated. <br><br> For more information, see [Azure Hybrid Use Benefit for Windows Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) <br><br> Minimum api-version: 2015-06-15. * * @param licenseType the licenseType value to set * @return the VirtualMachineScaleSetVMProfile object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineStatusCodeCount.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineStatusCodeCount.java index 63955c4f10b4..012c41b2c5b7 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineStatusCodeCount.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineStatusCodeCount.java @@ -28,7 +28,7 @@ public class VirtualMachineStatusCodeCount { private Integer count; /** - * Get the code value. + * Get the instance view status code. * * @return the code value */ @@ -37,7 +37,7 @@ public String code() { } /** - * Get the count value. + * Get the number of instances having a particular status code. * * @return the count value */ diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachines.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachines.java index a3881f15dddd..f23a11d0163f 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachines.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachines.java @@ -8,21 +8,31 @@ package com.microsoft.azure.management.compute.v2017_03_30; -import com.microsoft.azure.arm.collection.SupportsCreating; -import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; -import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; -import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; import rx.Observable; -import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; -import com.microsoft.azure.arm.collection.SupportsListing; -import com.microsoft.azure.management.compute.v2017_03_30.implementation.VirtualMachinesInner; -import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.compute.v2017_03_30.VirtualMachine; +import rx.Completable; import com.microsoft.azure.management.compute.v2017_03_30.VirtualMachineVirtualMachineSize; /** * Type representing VirtualMachines. */ -public interface VirtualMachines extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { +public interface VirtualMachines { + /** + * Begins definition for a new VirtualMachine resource. + * @param name resource name. + * @return the first stage of the new VirtualMachine definition. + */ + VirtualMachine.DefinitionStages.Blank defineVirtualMachine(String name); + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByLocationAsync(final String location); + /** * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs. * @@ -34,6 +44,26 @@ public interface VirtualMachines extends SupportsCreating captureAsync(String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters); + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteAsync(String resourceGroupName, String vmName); + + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByResourceGroupAsync(String resourceGroupName, String vmName); + /** * Retrieves information about the run-time state of a virtual machine. * @@ -135,6 +165,23 @@ public interface VirtualMachines extends SupportsCreating runCommandAsync(String resourceGroupName, String vmName, RunCommandInput parameters); + /** + * Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to get the next page of virtual machines. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByResourceGroupAsync(final String resourceGroupName); + + /** + * Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + /** * The operation to get all extensions of a Virtual Machine. * diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/WinRMConfiguration.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/WinRMConfiguration.java index 3ee49dcbf1d3..bb850c4ad8f0 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/WinRMConfiguration.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/WinRMConfiguration.java @@ -22,7 +22,7 @@ public class WinRMConfiguration { private List listeners; /** - * Get the listeners value. + * Get the list of Windows Remote Management listeners. * * @return the listeners value */ @@ -31,7 +31,7 @@ public List listeners() { } /** - * Set the listeners value. + * Set the list of Windows Remote Management listeners. * * @param listeners the listeners value to set * @return the WinRMConfiguration object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/WinRMListener.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/WinRMListener.java index ef2a3d728615..2642737cb664 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/WinRMListener.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/WinRMListener.java @@ -38,7 +38,7 @@ public class WinRMListener { private String certificateUrl; /** - * Get the protocol value. + * Get specifies the protocol of listener. <br><br> Possible values are: <br>**http** <br><br> **https**. Possible values include: 'Http', 'Https'. * * @return the protocol value */ @@ -47,7 +47,7 @@ public ProtocolTypes protocol() { } /** - * Set the protocol value. + * Set specifies the protocol of listener. <br><br> Possible values are: <br>**http** <br><br> **https**. Possible values include: 'Http', 'Https'. * * @param protocol the protocol value to set * @return the WinRMListener object itself. @@ -58,7 +58,7 @@ public WinRMListener withProtocol(ProtocolTypes protocol) { } /** - * Get the certificateUrl value. + * Get this is the URL of a certificate that has been uploaded to Key Vault as a secret. For adding a secret to the Key Vault, see [Add a key or secret to the key vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). In this case, your certificate needs to be It is the Base64 encoding of the following JSON Object which is encoded in UTF-8: <br><br> {<br> "data":"<Base64-encoded-certificate>",<br> "dataType":"pfx",<br> "password":"<pfx-file-password>"<br>}. * * @return the certificateUrl value */ @@ -67,7 +67,7 @@ public String certificateUrl() { } /** - * Set the certificateUrl value. + * Set this is the URL of a certificate that has been uploaded to Key Vault as a secret. For adding a secret to the Key Vault, see [Add a key or secret to the key vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). In this case, your certificate needs to be It is the Base64 encoding of the following JSON Object which is encoded in UTF-8: <br><br> {<br> "data":"<Base64-encoded-certificate>",<br> "dataType":"pfx",<br> "password":"<pfx-file-password>"<br>}. * * @param certificateUrl the certificateUrl value to set * @return the WinRMListener object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/WindowsConfiguration.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/WindowsConfiguration.java index 7964be2e792a..edcba7395dcf 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/WindowsConfiguration.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/WindowsConfiguration.java @@ -53,7 +53,7 @@ public class WindowsConfiguration { private WinRMConfiguration winRM; /** - * Get the provisionVMAgent value. + * Get indicates whether virtual machine agent should be provisioned on the virtual machine. <br><br> When this property is not specified in the request body, default behavior is to set it to true. This will ensure that VM Agent is installed on the VM so that extensions can be added to the VM later. * * @return the provisionVMAgent value */ @@ -62,7 +62,7 @@ public Boolean provisionVMAgent() { } /** - * Set the provisionVMAgent value. + * Set indicates whether virtual machine agent should be provisioned on the virtual machine. <br><br> When this property is not specified in the request body, default behavior is to set it to true. This will ensure that VM Agent is installed on the VM so that extensions can be added to the VM later. * * @param provisionVMAgent the provisionVMAgent value to set * @return the WindowsConfiguration object itself. @@ -73,7 +73,7 @@ public WindowsConfiguration withProvisionVMAgent(Boolean provisionVMAgent) { } /** - * Get the enableAutomaticUpdates value. + * Get indicates whether virtual machine is enabled for automatic updates. * * @return the enableAutomaticUpdates value */ @@ -82,7 +82,7 @@ public Boolean enableAutomaticUpdates() { } /** - * Set the enableAutomaticUpdates value. + * Set indicates whether virtual machine is enabled for automatic updates. * * @param enableAutomaticUpdates the enableAutomaticUpdates value to set * @return the WindowsConfiguration object itself. @@ -93,7 +93,7 @@ public WindowsConfiguration withEnableAutomaticUpdates(Boolean enableAutomaticUp } /** - * Get the timeZone value. + * Get specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". * * @return the timeZone value */ @@ -102,7 +102,7 @@ public String timeZone() { } /** - * Set the timeZone value. + * Set specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". * * @param timeZone the timeZone value to set * @return the WindowsConfiguration object itself. @@ -113,7 +113,7 @@ public WindowsConfiguration withTimeZone(String timeZone) { } /** - * Get the additionalUnattendContent value. + * Get specifies additional base-64 encoded XML formatted information that can be included in the Unattend.xml file, which is used by Windows Setup. * * @return the additionalUnattendContent value */ @@ -122,7 +122,7 @@ public List additionalUnattendContent() { } /** - * Set the additionalUnattendContent value. + * Set specifies additional base-64 encoded XML formatted information that can be included in the Unattend.xml file, which is used by Windows Setup. * * @param additionalUnattendContent the additionalUnattendContent value to set * @return the WindowsConfiguration object itself. @@ -133,7 +133,7 @@ public WindowsConfiguration withAdditionalUnattendContent(List virtualMachines() { } /** - * Set the virtualMachines value. + * Set a list of references to all virtual machines in the availability set. * * @param virtualMachines the virtualMachines value to set * @return the AvailabilitySetInner object itself. @@ -121,7 +121,7 @@ public AvailabilitySetInner withVirtualMachines(List virtualMachine } /** - * Get the statuses value. + * Get the resource status information. * * @return the statuses value */ @@ -130,7 +130,7 @@ public List statuses() { } /** - * Get the sku value. + * Get sku of the availability set. * * @return the sku value */ @@ -139,7 +139,7 @@ public Sku sku() { } /** - * Set the sku value. + * Set sku of the availability set. * * @param sku the sku value to set * @return the AvailabilitySetInner object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/AvailabilitySetsImpl.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/AvailabilitySetsImpl.java index 75a993a43456..159edc27cb9b 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/AvailabilitySetsImpl.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/AvailabilitySetsImpl.java @@ -84,10 +84,34 @@ public PagedList listByResourceGroup(String resourceGroupName) public Observable listByResourceGroupAsync(String resourceGroupName) { AvailabilitySetsInner client = this.inner(); return client.listByResourceGroupAsync(resourceGroupName) - .flatMap(new Func1, Observable>() { + .flatMapIterable(new Func1, Iterable>() { @Override - public Observable call(Page innerPage) { - return Observable.from(innerPage.items()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public AvailabilitySet call(AvailabilitySetInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + AvailabilitySetsInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + AvailabilitySetsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); } }) .map(new Func1() { diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/AvailabilitySetsInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/AvailabilitySetsInner.java index ec2dcf15153d..eab3d2479203 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/AvailabilitySetsInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/AvailabilitySetsInner.java @@ -10,9 +10,12 @@ import com.microsoft.azure.arm.collection.InnerSupportsGet; import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; @@ -30,6 +33,7 @@ import retrofit2.http.Path; import retrofit2.http.PUT; import retrofit2.http.Query; +import retrofit2.http.Url; import retrofit2.Response; import rx.functions.Func1; import rx.Observable; @@ -38,7 +42,7 @@ * An instance of this class provides access to all the operations defined * in AvailabilitySets. */ -public class AvailabilitySetsInner implements InnerSupportsGet, InnerSupportsDelete { +public class AvailabilitySetsInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { /** The Retrofit service to perform REST calls. */ private AvailabilitySetsService service; /** The service client containing this operation class. */ @@ -72,6 +76,10 @@ interface AvailabilitySetsService { @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}") Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("availabilitySetName") String availabilitySetName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.v2017_03_30.AvailabilitySets list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.v2017_03_30.AvailabilitySets listByResourceGroup" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets") Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -80,6 +88,14 @@ interface AvailabilitySetsService { @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes") Observable> listAvailableSizes(@Path("resourceGroupName") String resourceGroupName, @Path("availabilitySetName") String availabilitySetName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.v2017_03_30.AvailabilitySets listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.v2017_03_30.AvailabilitySets listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -349,20 +365,234 @@ private ServiceResponse getByResourceGroupDelegate(Respons .build(response); } + /** + * Lists all availability sets in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<AvailabilitySetInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all availability sets in a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all availability sets in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AvailabilitySetInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all availability sets in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AvailabilitySetInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all availability sets in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AvailabilitySetInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String expand = null; + return service.list(this.client.subscriptionId(), this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all availability sets in a subscription. + * + * @param expand The expand expression to apply to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<AvailabilitySetInner> object if successful. + */ + public PagedList list(final String expand) { + ServiceResponse> response = listSinglePageAsync(expand).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all availability sets in a subscription. + * + * @param expand The expand expression to apply to the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String expand, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(expand), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all availability sets in a subscription. + * + * @param expand The expand expression to apply to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AvailabilitySetInner> object + */ + public Observable> listAsync(final String expand) { + return listWithServiceResponseAsync(expand) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all availability sets in a subscription. + * + * @param expand The expand expression to apply to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AvailabilitySetInner> object + */ + public Observable>> listWithServiceResponseAsync(final String expand) { + return listSinglePageAsync(expand) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all availability sets in a subscription. + * + ServiceResponse> * @param expand The expand expression to apply to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AvailabilitySetInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String expand) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + /** * Lists all availability sets in a resource group. * * @param resourceGroupName The name of the resource group. - * @return the PagedList object if successful. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<AvailabilitySetInner> object if successful. */ - public PagedList listByResourceGroup(String resourceGroupName) { - PageImpl page = new PageImpl<>(); - page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); - page.setNextPageLink(null); - return new PagedList(page) { + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { @Override public Page nextPage(String nextPageLink) { - return null; + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } @@ -372,36 +602,67 @@ public Page nextPage(String nextPageLink) { * * @param resourceGroupName The name of the resource group. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** * Lists all availability sets in a resource group. * * @param resourceGroupName The name of the resource group. - * @return the observable to the List<AvailabilitySetInner> object + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AvailabilitySetInner> object */ - public Observable> listByResourceGroupAsync(String resourceGroupName) { - return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { - @Override - public Page call(ServiceResponse> response) { - PageImpl page = new PageImpl<>(); - page.setItems(response.body()); - return page; - } - }); + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** * Lists all availability sets in a resource group. * * @param resourceGroupName The name of the resource group. - * @return the observable to the List<AvailabilitySetInner> object + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AvailabilitySetInner> object */ - public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName) { + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all availability sets in a resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AvailabilitySetInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -412,17 +673,12 @@ public Observable>> listByResourceGro throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable>> call(Response response) { + public Observable>> call(Response response) { try { ServiceResponse> result = listByResourceGroupDelegate(response); - List items = null; - if (result.body() != null) { - items = result.body().items(); - } - ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); - return Observable.just(clientResponse); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -507,7 +763,7 @@ public Observable>> listAvailableS @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listAvailableSizesDelegate(response); + ServiceResponse> result = listAvailableSizesDelegate(response); List items = null; if (result.body() != null) { items = result.body().items(); @@ -521,9 +777,231 @@ public Observable>> call(Response< }); } - private ServiceResponse> listAvailableSizesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listAvailableSizesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all availability sets in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<AvailabilitySetInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all availability sets in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all availability sets in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AvailabilitySetInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all availability sets in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AvailabilitySetInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all availability sets in a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AvailabilitySetInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all availability sets in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<AvailabilitySetInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all availability sets in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all availability sets in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AvailabilitySetInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all availability sets in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AvailabilitySetInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all availability sets in a resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AvailabilitySetInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ComputeManagementClientImpl.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ComputeManagementClientImpl.java index 281a13bc34d2..8e566920535d 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ComputeManagementClientImpl.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ComputeManagementClientImpl.java @@ -63,11 +63,11 @@ public String apiVersion() { return this.apiVersion; } - /** Gets or sets the preferred language for the response. */ + /** The preferred language for the response. */ private String acceptLanguage; /** - * Gets Gets or sets the preferred language for the response. + * Gets The preferred language for the response. * * @return the acceptLanguage value. */ @@ -76,7 +76,7 @@ public String acceptLanguage() { } /** - * Sets Gets or sets the preferred language for the response. + * Sets The preferred language for the response. * * @param acceptLanguage the acceptLanguage value. * @return the service client itself @@ -86,11 +86,11 @@ public ComputeManagementClientImpl withAcceptLanguage(String acceptLanguage) { return this; } - /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ private int longRunningOperationRetryTimeout; /** - * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. * * @return the longRunningOperationRetryTimeout value. */ @@ -99,7 +99,7 @@ public int longRunningOperationRetryTimeout() { } /** - * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. * * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. * @return the service client itself @@ -109,11 +109,11 @@ public ComputeManagementClientImpl withLongRunningOperationRetryTimeout(int long return this; } - /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ private boolean generateClientRequestId; /** - * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. * * @return the generateClientRequestId value. */ @@ -122,7 +122,7 @@ public boolean generateClientRequestId() { } /** - * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. * * @param generateClientRequestId the generateClientRequestId value. * @return the service client itself @@ -401,6 +401,6 @@ protected void initialize() { */ @Override public String userAgent() { - return String.format("%s (%s, %s)", super.userAgent(), "ComputeManagementClient", "2017-03-30"); + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "ComputeManagementClient", "2017-03-30"); } } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/DiskInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/DiskInner.java index f53a7ed22ed8..22c14dada562 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/DiskInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/DiskInner.java @@ -83,7 +83,7 @@ public class DiskInner extends Resource { private String provisioningState; /** - * Get the managedBy value. + * Get a relative URI containing the ID of the VM that has the disk attached. * * @return the managedBy value */ @@ -112,7 +112,7 @@ public DiskInner withSku(DiskSku sku) { } /** - * Get the zones value. + * Get the Logical zone list for Disk. * * @return the zones value */ @@ -121,7 +121,7 @@ public List zones() { } /** - * Set the zones value. + * Set the Logical zone list for Disk. * * @param zones the zones value to set * @return the DiskInner object itself. @@ -132,7 +132,7 @@ public DiskInner withZones(List zones) { } /** - * Get the timeCreated value. + * Get the time when the disk was created. * * @return the timeCreated value */ @@ -141,7 +141,7 @@ public DateTime timeCreated() { } /** - * Get the osType value. + * Get the Operating System type. Possible values include: 'Windows', 'Linux'. * * @return the osType value */ @@ -150,7 +150,7 @@ public OperatingSystemTypes osType() { } /** - * Set the osType value. + * Set the Operating System type. Possible values include: 'Windows', 'Linux'. * * @param osType the osType value to set * @return the DiskInner object itself. @@ -161,7 +161,7 @@ public DiskInner withOsType(OperatingSystemTypes osType) { } /** - * Get the creationData value. + * Get disk source information. CreationData information cannot be changed after the disk has been created. * * @return the creationData value */ @@ -170,7 +170,7 @@ public CreationData creationData() { } /** - * Set the creationData value. + * Set disk source information. CreationData information cannot be changed after the disk has been created. * * @param creationData the creationData value to set * @return the DiskInner object itself. @@ -181,7 +181,7 @@ public DiskInner withCreationData(CreationData creationData) { } /** - * Get the diskSizeGB value. + * Get if creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. * * @return the diskSizeGB value */ @@ -190,7 +190,7 @@ public Integer diskSizeGB() { } /** - * Set the diskSizeGB value. + * Set if creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. * * @param diskSizeGB the diskSizeGB value to set * @return the DiskInner object itself. @@ -201,7 +201,7 @@ public DiskInner withDiskSizeGB(Integer diskSizeGB) { } /** - * Get the encryptionSettings value. + * Get encryption settings for disk or snapshot. * * @return the encryptionSettings value */ @@ -210,7 +210,7 @@ public EncryptionSettings encryptionSettings() { } /** - * Set the encryptionSettings value. + * Set encryption settings for disk or snapshot. * * @param encryptionSettings the encryptionSettings value to set * @return the DiskInner object itself. @@ -221,7 +221,7 @@ public DiskInner withEncryptionSettings(EncryptionSettings encryptionSettings) { } /** - * Get the provisioningState value. + * Get the disk provisioning state. * * @return the provisioningState value */ diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/DisksInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/DisksInner.java index 8ae8cf5e94f5..7abd1d342dfd 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/DisksInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/DisksInner.java @@ -41,6 +41,10 @@ import retrofit2.Response; import rx.functions.Func1; import rx.Observable; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined @@ -797,7 +801,7 @@ public Observable>> call(ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param resourceGroupName The name of the resource group. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<DiskInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -816,7 +820,7 @@ public Observable>> listByResourceGroupSinglePag @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listByResourceGroupDelegate(response); + ServiceResponse> result = listByResourceGroupDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -825,9 +829,9 @@ public Observable>> call(Response }); } - private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -923,7 +927,7 @@ public Observable>> listSinglePageAsync() { @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listDelegate(response); + ServiceResponse> result = listDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -932,9 +936,9 @@ public Observable>> call(Response }); } - private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -1177,7 +1181,7 @@ public Observable> revokeAccessWit throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Observable> observable = service.revokeAccess(this.client.subscriptionId(), resourceGroupName, diskName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -1348,7 +1352,7 @@ public Observable>> call(ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<DiskInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -1362,7 +1366,7 @@ public Observable>> listByResourceGroupNextSingl @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listByResourceGroupNextDelegate(response); + ServiceResponse> result = listByResourceGroupNextDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -1371,9 +1375,9 @@ public Observable>> call(Response }); } - private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -1459,7 +1463,7 @@ public Observable>> call(ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<DiskInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -1473,7 +1477,7 @@ public Observable>> listNextSinglePageAsync(fina @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listNextDelegate(response); + ServiceResponse> result = listNextDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -1482,9 +1486,9 @@ public Observable>> call(Response }); } - private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ImageInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ImageInner.java index e82f8ed333db..7103d2cab8fb 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ImageInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ImageInner.java @@ -40,7 +40,7 @@ public class ImageInner extends Resource { private String provisioningState; /** - * Get the sourceVirtualMachine value. + * Get the source virtual machine from which Image is created. * * @return the sourceVirtualMachine value */ @@ -49,7 +49,7 @@ public SubResource sourceVirtualMachine() { } /** - * Set the sourceVirtualMachine value. + * Set the source virtual machine from which Image is created. * * @param sourceVirtualMachine the sourceVirtualMachine value to set * @return the ImageInner object itself. @@ -60,7 +60,7 @@ public ImageInner withSourceVirtualMachine(SubResource sourceVirtualMachine) { } /** - * Get the storageProfile value. + * Get specifies the storage settings for the virtual machine disks. * * @return the storageProfile value */ @@ -69,7 +69,7 @@ public ImageStorageProfile storageProfile() { } /** - * Set the storageProfile value. + * Set specifies the storage settings for the virtual machine disks. * * @param storageProfile the storageProfile value to set * @return the ImageInner object itself. @@ -80,7 +80,7 @@ public ImageInner withStorageProfile(ImageStorageProfile storageProfile) { } /** - * Get the provisioningState value. + * Get the provisioning state. * * @return the provisioningState value */ diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ImagesInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ImagesInner.java index cc464508cfe6..582544f89481 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ImagesInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ImagesInner.java @@ -681,7 +681,7 @@ public Observable>> call(ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param resourceGroupName The name of the resource group. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<ImageInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -700,7 +700,7 @@ public Observable>> listByResourceGroupSinglePa @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listByResourceGroupDelegate(response); + ServiceResponse> result = listByResourceGroupDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -709,9 +709,9 @@ public Observable>> call(Response }); } - private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -807,7 +807,7 @@ public Observable>> listSinglePageAsync() { @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listDelegate(response); + ServiceResponse> result = listDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -816,9 +816,9 @@ public Observable>> call(Response }); } - private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -904,7 +904,7 @@ public Observable>> call(ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<ImageInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -918,7 +918,7 @@ public Observable>> listByResourceGroupNextSing @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listByResourceGroupNextDelegate(response); + ServiceResponse> result = listByResourceGroupNextDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -927,9 +927,9 @@ public Observable>> call(Response }); } - private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -1015,7 +1015,7 @@ public Observable>> call(ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<ImageInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -1029,7 +1029,7 @@ public Observable>> listNextSinglePageAsync(fin @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listNextDelegate(response); + ServiceResponse> result = listNextDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -1038,9 +1038,9 @@ public Observable>> call(Response }); } - private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/OperationStatusResponseInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/OperationStatusResponseInner.java index b374aed6cc24..aee52bdc0eac 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/OperationStatusResponseInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/OperationStatusResponseInner.java @@ -47,7 +47,7 @@ public class OperationStatusResponseInner { private ApiError error; /** - * Get the name value. + * Get operation ID. * * @return the name value */ @@ -56,7 +56,7 @@ public String name() { } /** - * Get the status value. + * Get operation status. * * @return the status value */ @@ -65,7 +65,7 @@ public String status() { } /** - * Get the startTime value. + * Get start time of the operation. * * @return the startTime value */ @@ -74,7 +74,7 @@ public DateTime startTime() { } /** - * Get the endTime value. + * Get end time of the operation. * * @return the endTime value */ @@ -83,7 +83,7 @@ public DateTime endTime() { } /** - * Get the error value. + * Get api error. * * @return the error value */ diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/PageImpl.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/PageImpl.java index d45204eb0680..e8bac3d82366 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/PageImpl.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/PageImpl.java @@ -22,7 +22,7 @@ public class PageImpl implements Page { /** * The link to the next page. */ - @JsonProperty("") + @JsonProperty("nextLink") private String nextPageLink; /** diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/PageImpl1.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/PageImpl1.java index dea4da1fef03..04155bfc51ef 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/PageImpl1.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/PageImpl1.java @@ -22,7 +22,7 @@ public class PageImpl1 implements Page { /** * The link to the next page. */ - @JsonProperty("nextLink") + @JsonProperty("") private String nextPageLink; /** diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ResourceSkuInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ResourceSkuInner.java index ca1f725bd3c3..bc3cf04734c4 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ResourceSkuInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ResourceSkuInner.java @@ -95,7 +95,7 @@ public class ResourceSkuInner { private List restrictions; /** - * Get the resourceType value. + * Get the type of resource the SKU applies to. * * @return the resourceType value */ @@ -104,7 +104,7 @@ public String resourceType() { } /** - * Get the name value. + * Get the name of SKU. * * @return the name value */ @@ -113,7 +113,7 @@ public String name() { } /** - * Get the tier value. + * Get specifies the tier of virtual machines in a scale set.<br /><br /> Possible Values:<br /><br /> **Standard**<br /><br /> **Basic**. * * @return the tier value */ @@ -122,7 +122,7 @@ public String tier() { } /** - * Get the size value. + * Get the Size of the SKU. * * @return the size value */ @@ -131,7 +131,7 @@ public String size() { } /** - * Get the family value. + * Get the Family of this particular SKU. * * @return the family value */ @@ -140,7 +140,7 @@ public String family() { } /** - * Get the kind value. + * Get the Kind of resources that are supported in this SKU. * * @return the kind value */ @@ -149,7 +149,7 @@ public String kind() { } /** - * Get the capacity value. + * Get specifies the number of virtual machines in the scale set. * * @return the capacity value */ @@ -158,7 +158,7 @@ public ResourceSkuCapacity capacity() { } /** - * Get the locations value. + * Get the set of locations that the SKU is available. * * @return the locations value */ @@ -167,7 +167,7 @@ public List locations() { } /** - * Get the apiVersions value. + * Get the api versions that support this SKU. * * @return the apiVersions value */ @@ -176,7 +176,7 @@ public List apiVersions() { } /** - * Get the costs value. + * Get metadata for retrieving price info. * * @return the costs value */ @@ -185,7 +185,7 @@ public List costs() { } /** - * Get the capabilities value. + * Get a name value pair to describe the capability. * * @return the capabilities value */ @@ -194,7 +194,7 @@ public List capabilities() { } /** - * Get the restrictions value. + * Get the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. * * @return the restrictions value */ diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ResourceSkusImpl.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ResourceSkusImpl.java index 6ee776e9f26d..c46f3f4ced40 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ResourceSkusImpl.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ResourceSkusImpl.java @@ -37,7 +37,8 @@ public Observable listAsync() { public Iterable call(Page page) { return page.items(); } - }) .map(new Func1() { + }) + .map(new Func1() { @Override public ResourceSku call(ResourceSkuInner inner) { return new ResourceSkuImpl(inner, manager()); diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ResourceSkusInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ResourceSkusInner.java index 15f97bba754c..3e27cc8badab 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ResourceSkusInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/ResourceSkusInner.java @@ -157,7 +157,7 @@ public Observable>> listSinglePageAsync() @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listDelegate(response); + ServiceResponse> result = listDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -166,9 +166,9 @@ public Observable>> call(Response> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -254,7 +254,7 @@ public Observable>> call(ServiceResponse< /** * Gets the list of Microsoft.Compute SKUs available for your Subscription. * - ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<ResourceSkuInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -268,7 +268,7 @@ public Observable>> listNextSinglePageAsy @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listNextDelegate(response); + ServiceResponse> result = listNextDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -277,9 +277,9 @@ public Observable>> call(Response> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/RollingUpgradeStatusInfoInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/RollingUpgradeStatusInfoInner.java index f2ce3e57997d..12ad14318a51 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/RollingUpgradeStatusInfoInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/RollingUpgradeStatusInfoInner.java @@ -47,7 +47,7 @@ public class RollingUpgradeStatusInfoInner extends Resource { private ApiError error; /** - * Get the policy value. + * Get the rolling upgrade policies applied for this upgrade. * * @return the policy value */ @@ -56,7 +56,7 @@ public RollingUpgradePolicy policy() { } /** - * Get the runningStatus value. + * Get information about the current running state of the overall upgrade. * * @return the runningStatus value */ @@ -65,7 +65,7 @@ public RollingUpgradeRunningStatus runningStatus() { } /** - * Get the progress value. + * Get information about the number of virtual machine instances in each upgrade state. * * @return the progress value */ @@ -74,7 +74,7 @@ public RollingUpgradeProgressInfo progress() { } /** - * Get the error value. + * Get error details for this upgrade, if there are any. * * @return the error value */ diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/RunCommandDocumentBaseInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/RunCommandDocumentBaseInner.java index fe4696407011..103e58d34d91 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/RunCommandDocumentBaseInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/RunCommandDocumentBaseInner.java @@ -46,7 +46,7 @@ public class RunCommandDocumentBaseInner { private String description; /** - * Get the schema value. + * Get the VM run command schema. * * @return the schema value */ @@ -55,7 +55,7 @@ public String schema() { } /** - * Set the schema value. + * Set the VM run command schema. * * @param schema the schema value to set * @return the RunCommandDocumentBaseInner object itself. @@ -66,7 +66,7 @@ public RunCommandDocumentBaseInner withSchema(String schema) { } /** - * Get the id value. + * Get the VM run command id. * * @return the id value */ @@ -75,7 +75,7 @@ public String id() { } /** - * Set the id value. + * Set the VM run command id. * * @param id the id value to set * @return the RunCommandDocumentBaseInner object itself. @@ -86,7 +86,7 @@ public RunCommandDocumentBaseInner withId(String id) { } /** - * Get the osType value. + * Get the Operating System type. Possible values include: 'Windows', 'Linux'. * * @return the osType value */ @@ -95,7 +95,7 @@ public OperatingSystemTypes osType() { } /** - * Set the osType value. + * Set the Operating System type. Possible values include: 'Windows', 'Linux'. * * @param osType the osType value to set * @return the RunCommandDocumentBaseInner object itself. @@ -106,7 +106,7 @@ public RunCommandDocumentBaseInner withOsType(OperatingSystemTypes osType) { } /** - * Get the label value. + * Get the VM run command label. * * @return the label value */ @@ -115,7 +115,7 @@ public String label() { } /** - * Set the label value. + * Set the VM run command label. * * @param label the label value to set * @return the RunCommandDocumentBaseInner object itself. @@ -126,7 +126,7 @@ public RunCommandDocumentBaseInner withLabel(String label) { } /** - * Get the description value. + * Get the VM run command description. * * @return the description value */ @@ -135,7 +135,7 @@ public String description() { } /** - * Set the description value. + * Set the VM run command description. * * @param description the description value to set * @return the RunCommandDocumentBaseInner object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/RunCommandDocumentImpl.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/RunCommandDocumentImpl.java index dc98fffbb008..57e34c1085f1 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/RunCommandDocumentImpl.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/RunCommandDocumentImpl.java @@ -23,6 +23,7 @@ class RunCommandDocumentImpl extends IndexableRefreshableWrapperImpl parameters; /** - * Get the script value. + * Get the script to be executed. * * @return the script value */ @@ -38,7 +38,7 @@ public List script() { } /** - * Set the script value. + * Set the script to be executed. * * @param script the script value to set * @return the RunCommandDocumentInner object itself. @@ -49,7 +49,7 @@ public RunCommandDocumentInner withScript(List script) { } /** - * Get the parameters value. + * Get the parameters used by the script. * * @return the parameters value */ @@ -58,7 +58,7 @@ public List parameters() { } /** - * Set the parameters value. + * Set the parameters used by the script. * * @param parameters the parameters value to set * @return the RunCommandDocumentInner object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/RunCommandResultInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/RunCommandResultInner.java index 41fc0773f32c..d206abb6d592 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/RunCommandResultInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/RunCommandResultInner.java @@ -23,7 +23,7 @@ public class RunCommandResultInner extends OperationStatusResponseInner { private Object output; /** - * Get the output value. + * Get operation output data (raw JSON). * * @return the output value */ @@ -32,7 +32,7 @@ public Object output() { } /** - * Set the output value. + * Set operation output data (raw JSON). * * @param output the output value to set * @return the RunCommandResultInner object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/SnapshotInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/SnapshotInner.java index c41802fa8d11..c6157eead297 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/SnapshotInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/SnapshotInner.java @@ -76,7 +76,7 @@ public class SnapshotInner extends Resource { private String provisioningState; /** - * Get the managedBy value. + * Get unused. Always Null. * * @return the managedBy value */ @@ -105,7 +105,7 @@ public SnapshotInner withSku(DiskSku sku) { } /** - * Get the timeCreated value. + * Get the time when the disk was created. * * @return the timeCreated value */ @@ -114,7 +114,7 @@ public DateTime timeCreated() { } /** - * Get the osType value. + * Get the Operating System type. Possible values include: 'Windows', 'Linux'. * * @return the osType value */ @@ -123,7 +123,7 @@ public OperatingSystemTypes osType() { } /** - * Set the osType value. + * Set the Operating System type. Possible values include: 'Windows', 'Linux'. * * @param osType the osType value to set * @return the SnapshotInner object itself. @@ -134,7 +134,7 @@ public SnapshotInner withOsType(OperatingSystemTypes osType) { } /** - * Get the creationData value. + * Get disk source information. CreationData information cannot be changed after the disk has been created. * * @return the creationData value */ @@ -143,7 +143,7 @@ public CreationData creationData() { } /** - * Set the creationData value. + * Set disk source information. CreationData information cannot be changed after the disk has been created. * * @param creationData the creationData value to set * @return the SnapshotInner object itself. @@ -154,7 +154,7 @@ public SnapshotInner withCreationData(CreationData creationData) { } /** - * Get the diskSizeGB value. + * Get if creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. * * @return the diskSizeGB value */ @@ -163,7 +163,7 @@ public Integer diskSizeGB() { } /** - * Set the diskSizeGB value. + * Set if creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size. * * @param diskSizeGB the diskSizeGB value to set * @return the SnapshotInner object itself. @@ -174,7 +174,7 @@ public SnapshotInner withDiskSizeGB(Integer diskSizeGB) { } /** - * Get the encryptionSettings value. + * Get encryption settings for disk or snapshot. * * @return the encryptionSettings value */ @@ -183,7 +183,7 @@ public EncryptionSettings encryptionSettings() { } /** - * Set the encryptionSettings value. + * Set encryption settings for disk or snapshot. * * @param encryptionSettings the encryptionSettings value to set * @return the SnapshotInner object itself. @@ -194,7 +194,7 @@ public SnapshotInner withEncryptionSettings(EncryptionSettings encryptionSetting } /** - * Get the provisioningState value. + * Get the disk provisioning state. * * @return the provisioningState value */ diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/SnapshotsInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/SnapshotsInner.java index c49248196a2b..9f51e057ed99 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/SnapshotsInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/SnapshotsInner.java @@ -41,6 +41,10 @@ import retrofit2.Response; import rx.functions.Func1; import rx.Observable; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined @@ -797,7 +801,7 @@ public Observable>> call(ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param resourceGroupName The name of the resource group. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<SnapshotInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -816,7 +820,7 @@ public Observable>> listByResourceGroupSingl @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listByResourceGroupDelegate(response); + ServiceResponse> result = listByResourceGroupDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -825,9 +829,9 @@ public Observable>> call(Response> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -923,7 +927,7 @@ public Observable>> listSinglePageAsync() { @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listDelegate(response); + ServiceResponse> result = listDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -932,9 +936,9 @@ public Observable>> call(Response> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -1177,7 +1181,7 @@ public Observable> revokeAccessWit throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Observable> observable = service.revokeAccess(this.client.subscriptionId(), resourceGroupName, snapshotName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -1348,7 +1352,7 @@ public Observable>> call(ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<SnapshotInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -1362,7 +1366,7 @@ public Observable>> listByResourceGroupNextS @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listByResourceGroupNextDelegate(response); + ServiceResponse> result = listByResourceGroupNextDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -1371,9 +1375,9 @@ public Observable>> call(Response> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -1459,7 +1463,7 @@ public Observable>> call(ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<SnapshotInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -1473,7 +1477,7 @@ public Observable>> listNextSinglePageAsync( @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listNextDelegate(response); + ServiceResponse> result = listNextDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -1482,9 +1486,9 @@ public Observable>> call(Response> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/UsageInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/UsageInner.java index 49f7d996cabd..753222a9ad18 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/UsageInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/UsageInner.java @@ -41,13 +41,16 @@ public class UsageInner { /** * Creates an instance of UsageInner class. + * @param currentValue the current usage of the resource. + * @param limit the maximum permitted usage of the resource. + * @param name the name of the type of usage. */ public UsageInner() { unit = "Count"; } /** - * Get the unit value. + * Get an enum describing the unit of usage measurement. * * @return the unit value */ @@ -56,7 +59,7 @@ public String unit() { } /** - * Set the unit value. + * Set an enum describing the unit of usage measurement. * * @param unit the unit value to set * @return the UsageInner object itself. @@ -67,7 +70,7 @@ public UsageInner withUnit(String unit) { } /** - * Get the currentValue value. + * Get the current usage of the resource. * * @return the currentValue value */ @@ -76,7 +79,7 @@ public int currentValue() { } /** - * Set the currentValue value. + * Set the current usage of the resource. * * @param currentValue the currentValue value to set * @return the UsageInner object itself. @@ -87,7 +90,7 @@ public UsageInner withCurrentValue(int currentValue) { } /** - * Get the limit value. + * Get the maximum permitted usage of the resource. * * @return the limit value */ @@ -96,7 +99,7 @@ public long limit() { } /** - * Set the limit value. + * Set the maximum permitted usage of the resource. * * @param limit the limit value to set * @return the UsageInner object itself. @@ -107,7 +110,7 @@ public UsageInner withLimit(long limit) { } /** - * Get the name value. + * Get the name of the type of usage. * * @return the name value */ @@ -116,7 +119,7 @@ public UsageName name() { } /** - * Set the name value. + * Set the name of the type of usage. * * @param name the name value to set * @return the UsageInner object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/UsagesInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/UsagesInner.java index 6f2a1857ee95..83134f5d6c3f 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/UsagesInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/UsagesInner.java @@ -146,7 +146,7 @@ public Observable>> call(ServiceResponse> * @param location The location for which resource usage is queried. + ServiceResponse> * @param location The location for which resource usage is queried. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<UsageInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -165,7 +165,7 @@ public Observable>> listSinglePageAsync(final S @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listDelegate(response); + ServiceResponse> result = listDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -174,9 +174,9 @@ public Observable>> call(Response }); } - private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -262,7 +262,7 @@ public Observable>> call(ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<UsageInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -276,7 +276,7 @@ public Observable>> listNextSinglePageAsync(fin @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listNextDelegate(response); + ServiceResponse> result = listNextDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -285,9 +285,9 @@ public Observable>> call(Response }); } - private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineCaptureResultInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineCaptureResultInner.java index f9d1e66d87de..1ed5d0a3355a 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineCaptureResultInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineCaptureResultInner.java @@ -24,7 +24,7 @@ public class VirtualMachineCaptureResultInner extends SubResource { private Object output; /** - * Get the output value. + * Get operation output data (raw JSON). * * @return the output value */ @@ -33,7 +33,7 @@ public Object output() { } /** - * Set the output value. + * Set operation output data (raw JSON). * * @param output the output value to set * @return the VirtualMachineCaptureResultInner object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineExtensionImageImpl.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineExtensionImageImpl.java index 45fb74c4e2db..d8d2dab64e63 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineExtensionImageImpl.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineExtensionImageImpl.java @@ -23,6 +23,7 @@ class VirtualMachineExtensionImageImpl extends IndexableRefreshableWrapperImpl listTypesAsync(String location, public Observable call(List innerList) { return Observable.from(innerList); } - }) .map(new Func1() { + }) + .map(new Func1() { @Override public VirtualMachineExtensionImage call(VirtualMachineExtensionImageInner inner) { return new VirtualMachineExtensionImageImpl(inner, manager()); diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineExtensionImpl.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineExtensionImpl.java index f249824f3eec..9ac64d4f7947 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineExtensionImpl.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineExtensionImpl.java @@ -37,7 +37,7 @@ class VirtualMachineExtensionImpl extends CreatableUpdatableImpl implements VirtualMachineExtensions { private final ComputeManager manager; @@ -29,16 +29,24 @@ public ComputeManager manager() { } @Override - public VirtualMachineExtensionImpl define(String name) { - return wrapModel(name); + public VirtualMachineExtensionImpl defineExtension(String name) { + return wrapExtensionModel(name); + } + + private VirtualMachineExtensionImpl wrapExtensionModel(String name) { + return new VirtualMachineExtensionImpl(name, this.manager()); } - private VirtualMachineExtensionImpl wrapModel(VirtualMachineExtensionInner inner) { + private VirtualMachineExtensionImpl wrapVirtualMachineExtensionModel(VirtualMachineExtensionInner inner) { return new VirtualMachineExtensionImpl(inner, manager()); } - private VirtualMachineExtensionImpl wrapModel(String name) { - return new VirtualMachineExtensionImpl(name, this.manager()); + private Observable getVirtualMachineExtensionInnerUsingVirtualMachineExtensionsInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String vmName = IdParsingUtils.getValueFromIdByName(id, "virtualMachines"); + String vmExtensionName = IdParsingUtils.getValueFromIdByName(id, "extensions"); + VirtualMachineExtensionsInner client = this.inner(); + return client.getAsync(resourceGroupName, vmName, vmExtensionName); } @Override @@ -48,7 +56,7 @@ public Observable getAsync(String resourceGroupName, St .map(new Func1() { @Override public VirtualMachineExtension call(VirtualMachineExtensionInner inner) { - return wrapModel(inner); + return wrapVirtualMachineExtensionModel(inner); } }); } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineExtensionsListResultInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineExtensionsListResultInner.java index 5601df2cc533..ffc8e4af0ecc 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineExtensionsListResultInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineExtensionsListResultInner.java @@ -22,7 +22,7 @@ public class VirtualMachineExtensionsListResultInner { private List value; /** - * Get the value value. + * Get the list of extensions. * * @return the value value */ @@ -31,7 +31,7 @@ public List value() { } /** - * Set the value value. + * Set the list of extensions. * * @param value the value value to set * @return the VirtualMachineExtensionsListResultInner object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineImageImpl.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineImageImpl.java index bad4b0285264..30dc93efb0c2 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineImageImpl.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineImageImpl.java @@ -28,6 +28,7 @@ class VirtualMachineImageImpl extends IndexableRefreshableWrapperImpl tags; /** - * Get the name value. + * Get the name of the resource. * * @return the name value */ @@ -46,7 +46,7 @@ public String name() { } /** - * Set the name value. + * Set the name of the resource. * * @param name the name value to set * @return the VirtualMachineImageResourceInner object itself. @@ -57,7 +57,7 @@ public VirtualMachineImageResourceInner withName(String name) { } /** - * Get the location value. + * Get the supported Azure location of the resource. * * @return the location value */ @@ -66,7 +66,7 @@ public String location() { } /** - * Set the location value. + * Set the supported Azure location of the resource. * * @param location the location value to set * @return the VirtualMachineImageResourceInner object itself. @@ -77,7 +77,7 @@ public VirtualMachineImageResourceInner withLocation(String location) { } /** - * Get the tags value. + * Get specifies the tags that are assigned to the virtual machine. For more information about using tags, see [Using tags to organize your Azure resources](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md). * * @return the tags value */ @@ -86,7 +86,7 @@ public Map tags() { } /** - * Set the tags value. + * Set specifies the tags that are assigned to the virtual machine. For more information about using tags, see [Using tags to organize your Azure resources](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md). * * @param tags the tags value to set * @return the VirtualMachineImageResourceInner object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineImagesImpl.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineImagesImpl.java index eebc0349bb41..43ca651069dd 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineImagesImpl.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineImagesImpl.java @@ -110,7 +110,8 @@ public Observable listOffersAsync(String location, public Observable call(List innerList) { return Observable.from(innerList); } - }) .map(new Func1() { + }) + .map(new Func1() { @Override public VirtualMachineImageResource call(VirtualMachineImageResourceInner inner) { return new VirtualMachineImageResourceImpl(inner, manager()); diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineImpl.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineImpl.java index 58612679f40d..3f837cca7bc5 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineImpl.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineImpl.java @@ -8,9 +8,10 @@ package com.microsoft.azure.management.compute.v2017_03_30.implementation; -import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; import com.microsoft.azure.management.compute.v2017_03_30.VirtualMachine; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; import rx.Observable; +import java.util.Map; import com.microsoft.azure.management.compute.v2017_03_30.Plan; import com.microsoft.azure.management.compute.v2017_03_30.HardwareProfile; import com.microsoft.azure.management.compute.v2017_03_30.StorageProfile; @@ -24,29 +25,53 @@ import java.util.ArrayList; import com.microsoft.azure.management.compute.v2017_03_30.VirtualMachineExtension; -class VirtualMachineImpl extends GroupableResourceCoreImpl implements VirtualMachine, VirtualMachine.Definition, VirtualMachine.Update { - VirtualMachineImpl(String name, VirtualMachineInner inner, ComputeManager manager) { - super(name, inner, manager); +class VirtualMachineImpl extends CreatableUpdatableImpl implements VirtualMachine, VirtualMachine.Definition, VirtualMachine.Update { + private final ComputeManager manager; + private String resourceGroupName; + private String vmName; + + VirtualMachineImpl(String name, ComputeManager manager) { + super(name, new VirtualMachineInner()); + this.manager = manager; + // Set resource name + this.vmName = name; + // + } + + VirtualMachineImpl(VirtualMachineInner inner, ComputeManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.vmName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.vmName = IdParsingUtils.getValueFromIdByName(inner.id(), "virtualMachines"); + // + } + + @Override + public ComputeManager manager() { + return this.manager; } @Override public Observable createResourceAsync() { VirtualMachinesInner client = this.manager().inner().virtualMachines(); - return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + return client.createOrUpdateAsync(this.resourceGroupName, this.vmName, this.inner()) .map(innerToFluentMap(this)); } @Override public Observable updateResourceAsync() { VirtualMachinesInner client = this.manager().inner().virtualMachines(); - return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + return client.createOrUpdateAsync(this.resourceGroupName, this.vmName, this.inner()) .map(innerToFluentMap(this)); } @Override protected Observable getInnerAsync() { VirtualMachinesInner client = this.manager().inner().virtualMachines(); - return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + return null; // NOP getInnerAsync implementation as get is not supported } @Override @@ -70,6 +95,11 @@ public HardwareProfile hardwareProfile() { return this.inner().hardwareProfile(); } + @Override + public String id() { + return this.inner().id(); + } + @Override public VirtualMachineIdentity identity() { return this.inner().identity(); @@ -90,6 +120,16 @@ public String licenseType() { return this.inner().licenseType(); } + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + @Override public NetworkProfile networkProfile() { return this.inner().networkProfile(); @@ -126,6 +166,16 @@ public StorageProfile storageProfile() { return this.inner().storageProfile(); } + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + @Override public String vmId() { return this.inner().vmId(); @@ -136,6 +186,18 @@ public List zones() { return this.inner().zones(); } + @Override + public VirtualMachineImpl withExistingLocation(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public VirtualMachineImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + @Override public VirtualMachineImpl withAvailabilitySet(SubResource availabilitySet) { this.inner().withAvailabilitySet(availabilitySet); @@ -190,6 +252,12 @@ public VirtualMachineImpl withStorageProfile(StorageProfile storageProfile) { return this; } + @Override + public VirtualMachineImpl withTags(Map tags) { + this.inner().withTags(tags); + return this; + } + @Override public VirtualMachineImpl withZones(List zones) { this.inner().withZones(zones); diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineInner.java index 9bd54cbe4913..746a026c0895 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineInner.java @@ -76,7 +76,7 @@ public class VirtualMachineInner extends Resource { * availability. For more information about availability sets, see [Manage * the availability of virtual * machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). - * <br><br> For more information on Azure planned maintainance, + * <br><br> For more information on Azure planned maintenance, * see [Planned maintenance for virtual machines in * Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) * <br><br> Currently, a VM can only be added to availability @@ -140,7 +140,7 @@ public class VirtualMachineInner extends Resource { private List zones; /** - * Get the plan value. + * Get specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. * * @return the plan value */ @@ -149,7 +149,7 @@ public Plan plan() { } /** - * Set the plan value. + * Set specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. * * @param plan the plan value to set * @return the VirtualMachineInner object itself. @@ -160,7 +160,7 @@ public VirtualMachineInner withPlan(Plan plan) { } /** - * Get the hardwareProfile value. + * Get specifies the hardware settings for the virtual machine. * * @return the hardwareProfile value */ @@ -169,7 +169,7 @@ public HardwareProfile hardwareProfile() { } /** - * Set the hardwareProfile value. + * Set specifies the hardware settings for the virtual machine. * * @param hardwareProfile the hardwareProfile value to set * @return the VirtualMachineInner object itself. @@ -180,7 +180,7 @@ public VirtualMachineInner withHardwareProfile(HardwareProfile hardwareProfile) } /** - * Get the storageProfile value. + * Get specifies the storage settings for the virtual machine disks. * * @return the storageProfile value */ @@ -189,7 +189,7 @@ public StorageProfile storageProfile() { } /** - * Set the storageProfile value. + * Set specifies the storage settings for the virtual machine disks. * * @param storageProfile the storageProfile value to set * @return the VirtualMachineInner object itself. @@ -200,7 +200,7 @@ public VirtualMachineInner withStorageProfile(StorageProfile storageProfile) { } /** - * Get the osProfile value. + * Get specifies the operating system settings for the virtual machine. * * @return the osProfile value */ @@ -209,7 +209,7 @@ public OSProfile osProfile() { } /** - * Set the osProfile value. + * Set specifies the operating system settings for the virtual machine. * * @param osProfile the osProfile value to set * @return the VirtualMachineInner object itself. @@ -220,7 +220,7 @@ public VirtualMachineInner withOsProfile(OSProfile osProfile) { } /** - * Get the networkProfile value. + * Get specifies the network interfaces of the virtual machine. * * @return the networkProfile value */ @@ -229,7 +229,7 @@ public NetworkProfile networkProfile() { } /** - * Set the networkProfile value. + * Set specifies the network interfaces of the virtual machine. * * @param networkProfile the networkProfile value to set * @return the VirtualMachineInner object itself. @@ -240,7 +240,7 @@ public VirtualMachineInner withNetworkProfile(NetworkProfile networkProfile) { } /** - * Get the diagnosticsProfile value. + * Get specifies the boot diagnostic settings state. <br><br>Minimum api-version: 2015-06-15. * * @return the diagnosticsProfile value */ @@ -249,7 +249,7 @@ public DiagnosticsProfile diagnosticsProfile() { } /** - * Set the diagnosticsProfile value. + * Set specifies the boot diagnostic settings state. <br><br>Minimum api-version: 2015-06-15. * * @param diagnosticsProfile the diagnosticsProfile value to set * @return the VirtualMachineInner object itself. @@ -260,7 +260,7 @@ public VirtualMachineInner withDiagnosticsProfile(DiagnosticsProfile diagnostics } /** - * Get the availabilitySet value. + * Get specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see [Manage the availability of virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). <br><br> For more information on Azure planned maintenance, see [Planned maintenance for virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) <br><br> Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. * * @return the availabilitySet value */ @@ -269,7 +269,7 @@ public SubResource availabilitySet() { } /** - * Set the availabilitySet value. + * Set specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see [Manage the availability of virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). <br><br> For more information on Azure planned maintenance, see [Planned maintenance for virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) <br><br> Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. * * @param availabilitySet the availabilitySet value to set * @return the VirtualMachineInner object itself. @@ -280,7 +280,7 @@ public VirtualMachineInner withAvailabilitySet(SubResource availabilitySet) { } /** - * Get the provisioningState value. + * Get the provisioning state, which only appears in the response. * * @return the provisioningState value */ @@ -289,7 +289,7 @@ public String provisioningState() { } /** - * Get the instanceView value. + * Get the virtual machine instance view. * * @return the instanceView value */ @@ -298,7 +298,7 @@ public VirtualMachineInstanceViewInner instanceView() { } /** - * Get the licenseType value. + * Get specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. <br><br> Possible values are: <br><br> Windows_Client <br><br> Windows_Server <br><br> If this element is included in a request for an update, the value must match the initial value. This value cannot be updated. <br><br> For more information, see [Azure Hybrid Use Benefit for Windows Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) <br><br> Minimum api-version: 2015-06-15. * * @return the licenseType value */ @@ -307,7 +307,7 @@ public String licenseType() { } /** - * Set the licenseType value. + * Set specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. <br><br> Possible values are: <br><br> Windows_Client <br><br> Windows_Server <br><br> If this element is included in a request for an update, the value must match the initial value. This value cannot be updated. <br><br> For more information, see [Azure Hybrid Use Benefit for Windows Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) <br><br> Minimum api-version: 2015-06-15. * * @param licenseType the licenseType value to set * @return the VirtualMachineInner object itself. @@ -318,7 +318,7 @@ public VirtualMachineInner withLicenseType(String licenseType) { } /** - * Get the vmId value. + * Get specifies the VM unique ID which is a 128-bits identifier that is encoded and stored in all Azure IaaS VMs SMBIOS and can be read using platform BIOS commands. * * @return the vmId value */ @@ -327,7 +327,7 @@ public String vmId() { } /** - * Get the resources value. + * Get the virtual machine child extension resources. * * @return the resources value */ @@ -336,7 +336,7 @@ public List resources() { } /** - * Get the identity value. + * Get the identity of the virtual machine, if configured. * * @return the identity value */ @@ -345,7 +345,7 @@ public VirtualMachineIdentity identity() { } /** - * Set the identity value. + * Set the identity of the virtual machine, if configured. * * @param identity the identity value to set * @return the VirtualMachineInner object itself. @@ -356,7 +356,7 @@ public VirtualMachineInner withIdentity(VirtualMachineIdentity identity) { } /** - * Get the zones value. + * Get the virtual machine zones. * * @return the zones value */ @@ -365,7 +365,7 @@ public List zones() { } /** - * Set the zones value. + * Set the virtual machine zones. * * @param zones the zones value to set * @return the VirtualMachineInner object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineInstanceViewInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineInstanceViewInner.java index 0aa073bb21df..95abc2e135c3 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineInstanceViewInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineInstanceViewInner.java @@ -65,9 +65,8 @@ public class VirtualMachineInstanceViewInner { /** * Boot Diagnostics is a debugging feature which allows you to view Console - * Output and Screenshot to diagnose VM status. <br><br> For - * Linux Virtual Machines, you can easily view the output of your console - * log. <br><br> For both Windows and Linux virtual machines, + * Output and Screenshot to diagnose VM status. <br><br> You + * can easily view the output of your console log. <br><br> * Azure also enables you to see a screenshot of the VM from the * hypervisor. */ @@ -81,7 +80,7 @@ public class VirtualMachineInstanceViewInner { private List statuses; /** - * Get the platformUpdateDomain value. + * Get specifies the update domain of the virtual machine. * * @return the platformUpdateDomain value */ @@ -90,7 +89,7 @@ public Integer platformUpdateDomain() { } /** - * Set the platformUpdateDomain value. + * Set specifies the update domain of the virtual machine. * * @param platformUpdateDomain the platformUpdateDomain value to set * @return the VirtualMachineInstanceViewInner object itself. @@ -101,7 +100,7 @@ public VirtualMachineInstanceViewInner withPlatformUpdateDomain(Integer platform } /** - * Get the platformFaultDomain value. + * Get specifies the fault domain of the virtual machine. * * @return the platformFaultDomain value */ @@ -110,7 +109,7 @@ public Integer platformFaultDomain() { } /** - * Set the platformFaultDomain value. + * Set specifies the fault domain of the virtual machine. * * @param platformFaultDomain the platformFaultDomain value to set * @return the VirtualMachineInstanceViewInner object itself. @@ -121,7 +120,7 @@ public VirtualMachineInstanceViewInner withPlatformFaultDomain(Integer platformF } /** - * Get the rdpThumbPrint value. + * Get the Remote desktop certificate thumbprint. * * @return the rdpThumbPrint value */ @@ -130,7 +129,7 @@ public String rdpThumbPrint() { } /** - * Set the rdpThumbPrint value. + * Set the Remote desktop certificate thumbprint. * * @param rdpThumbPrint the rdpThumbPrint value to set * @return the VirtualMachineInstanceViewInner object itself. @@ -141,7 +140,7 @@ public VirtualMachineInstanceViewInner withRdpThumbPrint(String rdpThumbPrint) { } /** - * Get the vmAgent value. + * Get the VM Agent running on the virtual machine. * * @return the vmAgent value */ @@ -150,7 +149,7 @@ public VirtualMachineAgentInstanceView vmAgent() { } /** - * Set the vmAgent value. + * Set the VM Agent running on the virtual machine. * * @param vmAgent the vmAgent value to set * @return the VirtualMachineInstanceViewInner object itself. @@ -161,7 +160,7 @@ public VirtualMachineInstanceViewInner withVmAgent(VirtualMachineAgentInstanceVi } /** - * Get the maintenanceRedeployStatus value. + * Get the Maintenance Operation status on the virtual machine. * * @return the maintenanceRedeployStatus value */ @@ -170,7 +169,7 @@ public MaintenanceRedeployStatus maintenanceRedeployStatus() { } /** - * Set the maintenanceRedeployStatus value. + * Set the Maintenance Operation status on the virtual machine. * * @param maintenanceRedeployStatus the maintenanceRedeployStatus value to set * @return the VirtualMachineInstanceViewInner object itself. @@ -181,7 +180,7 @@ public VirtualMachineInstanceViewInner withMaintenanceRedeployStatus(Maintenance } /** - * Get the disks value. + * Get the virtual machine disk information. * * @return the disks value */ @@ -190,7 +189,7 @@ public List disks() { } /** - * Set the disks value. + * Set the virtual machine disk information. * * @param disks the disks value to set * @return the VirtualMachineInstanceViewInner object itself. @@ -201,7 +200,7 @@ public VirtualMachineInstanceViewInner withDisks(List disks) { } /** - * Get the extensions value. + * Get the extensions information. * * @return the extensions value */ @@ -210,7 +209,7 @@ public List extensions() { } /** - * Set the extensions value. + * Set the extensions information. * * @param extensions the extensions value to set * @return the VirtualMachineInstanceViewInner object itself. @@ -221,7 +220,7 @@ public VirtualMachineInstanceViewInner withExtensions(List statuses() { } /** - * Set the statuses value. + * Set the resource status information. * * @param statuses the statuses value to set * @return the VirtualMachineInstanceViewInner object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineRunCommandsInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineRunCommandsInner.java index 7f45834d922c..80fda17139df 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineRunCommandsInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineRunCommandsInner.java @@ -151,7 +151,7 @@ public Observable>> call(Servi /** * Lists all available run commands for a subscription in a location. * - ServiceResponse> * @param location The location upon which run commands is queried. + ServiceResponse> * @param location The location upon which run commands is queried. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<RunCommandDocumentBaseInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -170,7 +170,7 @@ public Observable>> listSingle @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listDelegate(response); + ServiceResponse> result = listDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -179,9 +179,9 @@ public Observable>> call(Respo }); } - private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -353,7 +353,7 @@ public Observable>> call(Servi /** * Lists all available run commands for a subscription in a location. * - ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<RunCommandDocumentBaseInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -367,7 +367,7 @@ public Observable>> listNextSi @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listNextDelegate(response); + ServiceResponse> result = listNextDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -376,9 +376,9 @@ public Observable>> call(Respo }); } - private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetExtensionImpl.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetExtensionImpl.java index 7f58e2610f3b..859e39a00323 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetExtensionImpl.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetExtensionImpl.java @@ -31,7 +31,7 @@ class VirtualMachineScaleSetExtensionImpl extends CreatableUpdatableImpl>> c /** * Gets a list of all extensions in a VM scale set. * - ServiceResponse> * @param resourceGroupName The name of the resource group. - ServiceResponse> * @param vmScaleSetName The name of the VM scale set containing the extension. + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param vmScaleSetName The name of the VM scale set containing the extension. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<VirtualMachineScaleSetExtensionInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -739,7 +739,7 @@ public Observable>> l @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listDelegate(response); + ServiceResponse> result = listDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -748,9 +748,9 @@ public Observable>> c }); } - private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -836,7 +836,7 @@ public Observable>> c /** * Gets a list of all extensions in a VM scale set. * - ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<VirtualMachineScaleSetExtensionInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -850,7 +850,7 @@ public Observable>> l @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listNextDelegate(response); + ServiceResponse> result = listNextDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -859,9 +859,9 @@ public Observable>> c }); } - private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetInner.java index e3bfa3c81da4..02358957991c 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetInner.java @@ -92,7 +92,7 @@ public class VirtualMachineScaleSetInner extends Resource { private List zones; /** - * Get the sku value. + * Get the virtual machine scale set sku. * * @return the sku value */ @@ -101,7 +101,7 @@ public Sku sku() { } /** - * Set the sku value. + * Set the virtual machine scale set sku. * * @param sku the sku value to set * @return the VirtualMachineScaleSetInner object itself. @@ -112,7 +112,7 @@ public VirtualMachineScaleSetInner withSku(Sku sku) { } /** - * Get the plan value. + * Get specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. * * @return the plan value */ @@ -121,7 +121,7 @@ public Plan plan() { } /** - * Set the plan value. + * Set specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. * * @param plan the plan value to set * @return the VirtualMachineScaleSetInner object itself. @@ -132,7 +132,7 @@ public VirtualMachineScaleSetInner withPlan(Plan plan) { } /** - * Get the upgradePolicy value. + * Get the upgrade policy. * * @return the upgradePolicy value */ @@ -141,7 +141,7 @@ public UpgradePolicy upgradePolicy() { } /** - * Set the upgradePolicy value. + * Set the upgrade policy. * * @param upgradePolicy the upgradePolicy value to set * @return the VirtualMachineScaleSetInner object itself. @@ -152,7 +152,7 @@ public VirtualMachineScaleSetInner withUpgradePolicy(UpgradePolicy upgradePolicy } /** - * Get the virtualMachineProfile value. + * Get the virtual machine profile. * * @return the virtualMachineProfile value */ @@ -161,7 +161,7 @@ public VirtualMachineScaleSetVMProfile virtualMachineProfile() { } /** - * Set the virtualMachineProfile value. + * Set the virtual machine profile. * * @param virtualMachineProfile the virtualMachineProfile value to set * @return the VirtualMachineScaleSetInner object itself. @@ -172,7 +172,7 @@ public VirtualMachineScaleSetInner withVirtualMachineProfile(VirtualMachineScale } /** - * Get the provisioningState value. + * Get the provisioning state, which only appears in the response. * * @return the provisioningState value */ @@ -181,7 +181,7 @@ public String provisioningState() { } /** - * Get the overprovision value. + * Get specifies whether the Virtual Machine Scale Set should be overprovisioned. * * @return the overprovision value */ @@ -190,7 +190,7 @@ public Boolean overprovision() { } /** - * Set the overprovision value. + * Set specifies whether the Virtual Machine Scale Set should be overprovisioned. * * @param overprovision the overprovision value to set * @return the VirtualMachineScaleSetInner object itself. @@ -201,7 +201,7 @@ public VirtualMachineScaleSetInner withOverprovision(Boolean overprovision) { } /** - * Get the uniqueId value. + * Get specifies the ID which uniquely identifies a Virtual Machine Scale Set. * * @return the uniqueId value */ @@ -210,7 +210,7 @@ public String uniqueId() { } /** - * Get the singlePlacementGroup value. + * Get when true this limits the scale set to a single placement group, of max size 100 virtual machines. * * @return the singlePlacementGroup value */ @@ -219,7 +219,7 @@ public Boolean singlePlacementGroup() { } /** - * Set the singlePlacementGroup value. + * Set when true this limits the scale set to a single placement group, of max size 100 virtual machines. * * @param singlePlacementGroup the singlePlacementGroup value to set * @return the VirtualMachineScaleSetInner object itself. @@ -230,7 +230,7 @@ public VirtualMachineScaleSetInner withSinglePlacementGroup(Boolean singlePlacem } /** - * Get the identity value. + * Get the identity of the virtual machine scale set, if configured. * * @return the identity value */ @@ -239,7 +239,7 @@ public VirtualMachineScaleSetIdentity identity() { } /** - * Set the identity value. + * Set the identity of the virtual machine scale set, if configured. * * @param identity the identity value to set * @return the VirtualMachineScaleSetInner object itself. @@ -250,7 +250,7 @@ public VirtualMachineScaleSetInner withIdentity(VirtualMachineScaleSetIdentity i } /** - * Get the zones value. + * Get the virtual machine scale set zones. * * @return the zones value */ @@ -259,7 +259,7 @@ public List zones() { } /** - * Set the zones value. + * Set the virtual machine scale set zones. * * @param zones the zones value to set * @return the VirtualMachineScaleSetInner object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetInstanceViewInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetInstanceViewInner.java index 3e37fdfe9bca..55aa73351faf 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetInstanceViewInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetInstanceViewInner.java @@ -37,7 +37,7 @@ public class VirtualMachineScaleSetInstanceViewInner { private List statuses; /** - * Get the virtualMachine value. + * Get the instance view status summary for the virtual machine scale set. * * @return the virtualMachine value */ @@ -46,7 +46,7 @@ public VirtualMachineScaleSetInstanceViewStatusesSummary virtualMachine() { } /** - * Get the extensions value. + * Get the extensions information. * * @return the extensions value */ @@ -55,7 +55,7 @@ public List extensions() { } /** - * Get the statuses value. + * Get the resource status information. * * @return the statuses value */ @@ -64,7 +64,7 @@ public List statuses() { } /** - * Set the statuses value. + * Set the resource status information. * * @param statuses the statuses value to set * @return the VirtualMachineScaleSetInstanceViewInner object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetRollingUpgradesInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetRollingUpgradesInner.java index a81b60d26a3a..eb6b17a8d0fb 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetRollingUpgradesInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetRollingUpgradesInner.java @@ -25,6 +25,10 @@ import retrofit2.Response; import rx.functions.Func1; import rx.Observable; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined @@ -140,7 +144,7 @@ public Observable> cancelWithServi throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Observable> observable = service.cancel(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -296,7 +300,7 @@ public Observable> startOSUpgradeW throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Observable> observable = service.startOSUpgrade(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetSkuInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetSkuInner.java index 26845f6d289b..3e24049d2993 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetSkuInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetSkuInner.java @@ -35,7 +35,7 @@ public class VirtualMachineScaleSetSkuInner { private VirtualMachineScaleSetSkuCapacity capacity; /** - * Get the resourceType value. + * Get the type of resource the sku applies to. * * @return the resourceType value */ @@ -44,7 +44,7 @@ public String resourceType() { } /** - * Get the sku value. + * Get the Sku. * * @return the sku value */ @@ -53,7 +53,7 @@ public Sku sku() { } /** - * Get the capacity value. + * Get specifies the number of virtual machines in the scale set. * * @return the capacity value */ diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetVMImpl.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetVMImpl.java index 5cbd48a71762..2bf9b1881d5d 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetVMImpl.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetVMImpl.java @@ -14,7 +14,7 @@ import com.microsoft.azure.SubResource; import com.microsoft.azure.management.compute.v2017_03_30.DiagnosticsProfile; import com.microsoft.azure.management.compute.v2017_03_30.HardwareProfile; -import com.microsoft.azure.management.compute.v2017_03_30.VirtualMachineInstanceView; +import com.microsoft.azure.management.compute.v2017_03_30.VirtualMachineScaleSetVMInstanceView; import com.microsoft.azure.management.compute.v2017_03_30.NetworkProfile; import com.microsoft.azure.management.compute.v2017_03_30.OSProfile; import com.microsoft.azure.management.compute.v2017_03_30.Plan; @@ -34,6 +34,7 @@ class VirtualMachineScaleSetVMImpl extends IndexableRefreshableWrapperImpl resources; /** - * Get the instanceId value. + * Get the virtual machine instance ID. * * @return the instanceId value */ @@ -154,7 +154,7 @@ public String instanceId() { } /** - * Get the sku value. + * Get the virtual machine SKU. * * @return the sku value */ @@ -163,7 +163,7 @@ public Sku sku() { } /** - * Get the latestModelApplied value. + * Get specifies whether the latest model has been applied to the virtual machine. * * @return the latestModelApplied value */ @@ -172,7 +172,7 @@ public Boolean latestModelApplied() { } /** - * Get the vmId value. + * Get azure VM unique ID. * * @return the vmId value */ @@ -181,16 +181,16 @@ public String vmId() { } /** - * Get the instanceView value. + * Get the virtual machine instance view. * * @return the instanceView value */ - public VirtualMachineInstanceViewInner instanceView() { + public VirtualMachineScaleSetVMInstanceViewInner instanceView() { return this.instanceView; } /** - * Get the hardwareProfile value. + * Get specifies the hardware settings for the virtual machine. * * @return the hardwareProfile value */ @@ -199,7 +199,7 @@ public HardwareProfile hardwareProfile() { } /** - * Set the hardwareProfile value. + * Set specifies the hardware settings for the virtual machine. * * @param hardwareProfile the hardwareProfile value to set * @return the VirtualMachineScaleSetVMInner object itself. @@ -210,7 +210,7 @@ public VirtualMachineScaleSetVMInner withHardwareProfile(HardwareProfile hardwar } /** - * Get the storageProfile value. + * Get specifies the storage settings for the virtual machine disks. * * @return the storageProfile value */ @@ -219,7 +219,7 @@ public StorageProfile storageProfile() { } /** - * Set the storageProfile value. + * Set specifies the storage settings for the virtual machine disks. * * @param storageProfile the storageProfile value to set * @return the VirtualMachineScaleSetVMInner object itself. @@ -230,7 +230,7 @@ public VirtualMachineScaleSetVMInner withStorageProfile(StorageProfile storagePr } /** - * Get the osProfile value. + * Get specifies the operating system settings for the virtual machine. * * @return the osProfile value */ @@ -239,7 +239,7 @@ public OSProfile osProfile() { } /** - * Set the osProfile value. + * Set specifies the operating system settings for the virtual machine. * * @param osProfile the osProfile value to set * @return the VirtualMachineScaleSetVMInner object itself. @@ -250,7 +250,7 @@ public VirtualMachineScaleSetVMInner withOsProfile(OSProfile osProfile) { } /** - * Get the networkProfile value. + * Get specifies the network interfaces of the virtual machine. * * @return the networkProfile value */ @@ -259,7 +259,7 @@ public NetworkProfile networkProfile() { } /** - * Set the networkProfile value. + * Set specifies the network interfaces of the virtual machine. * * @param networkProfile the networkProfile value to set * @return the VirtualMachineScaleSetVMInner object itself. @@ -270,7 +270,7 @@ public VirtualMachineScaleSetVMInner withNetworkProfile(NetworkProfile networkPr } /** - * Get the diagnosticsProfile value. + * Get specifies the boot diagnostic settings state. <br><br>Minimum api-version: 2015-06-15. * * @return the diagnosticsProfile value */ @@ -279,7 +279,7 @@ public DiagnosticsProfile diagnosticsProfile() { } /** - * Set the diagnosticsProfile value. + * Set specifies the boot diagnostic settings state. <br><br>Minimum api-version: 2015-06-15. * * @param diagnosticsProfile the diagnosticsProfile value to set * @return the VirtualMachineScaleSetVMInner object itself. @@ -290,7 +290,7 @@ public VirtualMachineScaleSetVMInner withDiagnosticsProfile(DiagnosticsProfile d } /** - * Get the availabilitySet value. + * Get specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see [Manage the availability of virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). <br><br> For more information on Azure planned maintenance, see [Planned maintenance for virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) <br><br> Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. * * @return the availabilitySet value */ @@ -299,7 +299,7 @@ public SubResource availabilitySet() { } /** - * Set the availabilitySet value. + * Set specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see [Manage the availability of virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). <br><br> For more information on Azure planned maintenance, see [Planned maintenance for virtual machines in Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) <br><br> Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. * * @param availabilitySet the availabilitySet value to set * @return the VirtualMachineScaleSetVMInner object itself. @@ -310,7 +310,7 @@ public VirtualMachineScaleSetVMInner withAvailabilitySet(SubResource availabilit } /** - * Get the provisioningState value. + * Get the provisioning state, which only appears in the response. * * @return the provisioningState value */ @@ -319,7 +319,7 @@ public String provisioningState() { } /** - * Get the licenseType value. + * Get specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. <br><br> Possible values are: <br><br> Windows_Client <br><br> Windows_Server <br><br> If this element is included in a request for an update, the value must match the initial value. This value cannot be updated. <br><br> For more information, see [Azure Hybrid Use Benefit for Windows Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) <br><br> Minimum api-version: 2015-06-15. * * @return the licenseType value */ @@ -328,7 +328,7 @@ public String licenseType() { } /** - * Set the licenseType value. + * Set specifies that the image or disk that is being used was licensed on-premises. This element is only used for images that contain the Windows Server operating system. <br><br> Possible values are: <br><br> Windows_Client <br><br> Windows_Server <br><br> If this element is included in a request for an update, the value must match the initial value. This value cannot be updated. <br><br> For more information, see [Azure Hybrid Use Benefit for Windows Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) <br><br> Minimum api-version: 2015-06-15. * * @param licenseType the licenseType value to set * @return the VirtualMachineScaleSetVMInner object itself. @@ -339,7 +339,7 @@ public VirtualMachineScaleSetVMInner withLicenseType(String licenseType) { } /** - * Get the plan value. + * Get specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. * * @return the plan value */ @@ -348,7 +348,7 @@ public Plan plan() { } /** - * Set the plan value. + * Set specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. * * @param plan the plan value to set * @return the VirtualMachineScaleSetVMInner object itself. @@ -359,7 +359,7 @@ public VirtualMachineScaleSetVMInner withPlan(Plan plan) { } /** - * Get the resources value. + * Get the virtual machine child extension resources. * * @return the resources value */ diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetVMInstanceViewInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetVMInstanceViewInner.java index a8c58c0dbe49..18dee1e7ae20 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetVMInstanceViewInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetVMInstanceViewInner.java @@ -65,9 +65,8 @@ public class VirtualMachineScaleSetVMInstanceViewInner { /** * Boot Diagnostics is a debugging feature which allows you to view Console - * Output and Screenshot to diagnose VM status. <br><br> For - * Linux Virtual Machines, you can easily view the output of your console - * log. <br><br> For both Windows and Linux virtual machines, + * Output and Screenshot to diagnose VM status. <br><br> You + * can easily view the output of your console log. <br><br> * Azure also enables you to see a screenshot of the VM from the * hypervisor. */ @@ -88,7 +87,7 @@ public class VirtualMachineScaleSetVMInstanceViewInner { private String placementGroupId; /** - * Get the platformUpdateDomain value. + * Get the Update Domain count. * * @return the platformUpdateDomain value */ @@ -97,7 +96,7 @@ public Integer platformUpdateDomain() { } /** - * Set the platformUpdateDomain value. + * Set the Update Domain count. * * @param platformUpdateDomain the platformUpdateDomain value to set * @return the VirtualMachineScaleSetVMInstanceViewInner object itself. @@ -108,7 +107,7 @@ public VirtualMachineScaleSetVMInstanceViewInner withPlatformUpdateDomain(Intege } /** - * Get the platformFaultDomain value. + * Get the Fault Domain count. * * @return the platformFaultDomain value */ @@ -117,7 +116,7 @@ public Integer platformFaultDomain() { } /** - * Set the platformFaultDomain value. + * Set the Fault Domain count. * * @param platformFaultDomain the platformFaultDomain value to set * @return the VirtualMachineScaleSetVMInstanceViewInner object itself. @@ -128,7 +127,7 @@ public VirtualMachineScaleSetVMInstanceViewInner withPlatformFaultDomain(Integer } /** - * Get the rdpThumbPrint value. + * Get the Remote desktop certificate thumbprint. * * @return the rdpThumbPrint value */ @@ -137,7 +136,7 @@ public String rdpThumbPrint() { } /** - * Set the rdpThumbPrint value. + * Set the Remote desktop certificate thumbprint. * * @param rdpThumbPrint the rdpThumbPrint value to set * @return the VirtualMachineScaleSetVMInstanceViewInner object itself. @@ -148,7 +147,7 @@ public VirtualMachineScaleSetVMInstanceViewInner withRdpThumbPrint(String rdpThu } /** - * Get the vmAgent value. + * Get the VM Agent running on the virtual machine. * * @return the vmAgent value */ @@ -157,7 +156,7 @@ public VirtualMachineAgentInstanceView vmAgent() { } /** - * Set the vmAgent value. + * Set the VM Agent running on the virtual machine. * * @param vmAgent the vmAgent value to set * @return the VirtualMachineScaleSetVMInstanceViewInner object itself. @@ -168,7 +167,7 @@ public VirtualMachineScaleSetVMInstanceViewInner withVmAgent(VirtualMachineAgent } /** - * Get the disks value. + * Get the disks information. * * @return the disks value */ @@ -177,7 +176,7 @@ public List disks() { } /** - * Set the disks value. + * Set the disks information. * * @param disks the disks value to set * @return the VirtualMachineScaleSetVMInstanceViewInner object itself. @@ -188,7 +187,7 @@ public VirtualMachineScaleSetVMInstanceViewInner withDisks(List extensions() { } /** - * Set the extensions value. + * Set the extensions information. * * @param extensions the extensions value to set * @return the VirtualMachineScaleSetVMInstanceViewInner object itself. @@ -208,7 +207,7 @@ public VirtualMachineScaleSetVMInstanceViewInner withExtensions(List statuses() { } /** - * Set the statuses value. + * Set the resource status information. * * @param statuses the statuses value to set * @return the VirtualMachineScaleSetVMInstanceViewInner object itself. @@ -257,7 +256,7 @@ public VirtualMachineScaleSetVMInstanceViewInner withStatuses(List> reimageWithServ throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Observable> observable = service.reimage(resourceGroupName, vmScaleSetName, instanceId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -376,7 +380,7 @@ public Observable> reimageAllWithS throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Observable> observable = service.reimageAll(resourceGroupName, vmScaleSetName, instanceId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -546,7 +550,7 @@ public Observable> deallocateWithS throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Observable> observable = service.deallocate(resourceGroupName, vmScaleSetName, instanceId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -1110,7 +1114,7 @@ public Observable>> listSing @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listDelegate(response); + ServiceResponse> result = listDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -1215,11 +1219,11 @@ public Observable>> call(Ser /** * Gets a list of all virtual machines in a VM scale sets. * - ServiceResponse> * @param resourceGroupName The name of the resource group. - ServiceResponse> * @param virtualMachineScaleSetName The name of the VM scale set. - ServiceResponse> * @param filter The filter to apply to the operation. - ServiceResponse> * @param select The list parameters. - ServiceResponse> * @param expand The expand expression to apply to the operation. + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param virtualMachineScaleSetName The name of the VM scale set. + ServiceResponse> * @param filter The filter to apply to the operation. + ServiceResponse> * @param select The list parameters. + ServiceResponse> * @param expand The expand expression to apply to the operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<VirtualMachineScaleSetVMInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -1241,7 +1245,7 @@ public Observable>> listSing @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listDelegate(response); + ServiceResponse> result = listDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -1250,9 +1254,9 @@ public Observable>> call(Res }); } - private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -1330,7 +1334,7 @@ public Observable> powerOffWithSer throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Observable> observable = service.powerOff(resourceGroupName, vmScaleSetName, instanceId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -1500,7 +1504,7 @@ public Observable> restartWithServ throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Observable> observable = service.restart(resourceGroupName, vmScaleSetName, instanceId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -1670,7 +1674,7 @@ public Observable> startWithServic throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Observable> observable = service.start(resourceGroupName, vmScaleSetName, instanceId, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -1848,7 +1852,7 @@ public Observable>> call(Ser /** * Gets a list of all virtual machines in a VM scale sets. * - ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<VirtualMachineScaleSetVMInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -1862,7 +1866,7 @@ public Observable>> listNext @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listNextDelegate(response); + ServiceResponse> result = listNextDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -1871,9 +1875,9 @@ public Observable>> call(Res }); } - private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java index 0f725f5dcf3e..2b87fd03a991 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java @@ -42,6 +42,10 @@ import retrofit2.Response; import rx.functions.Func1; import rx.Observable; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined @@ -846,7 +850,7 @@ public Observable> deallocateWithS VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); vmInstanceIDs.withInstanceIds(null); Observable> observable = service.deallocate(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute resources. You are not billed for the compute resources that this virtual machine scale set deallocates. @@ -924,7 +928,7 @@ public Observable> deallocateWithS vmInstanceIDs.withInstanceIds(instanceIds); } Observable> observable = service.deallocate(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -1182,7 +1186,7 @@ public Observable> deleteInstances VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceRequiredIDs(); vmInstanceIDs.withInstanceIds(instanceIds); Observable> observable = service.deleteInstances(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -1448,7 +1452,7 @@ public Observable>> call(Servi /** * Gets a list of all VM scale sets under a resource group. * - ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param resourceGroupName The name of the resource group. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<VirtualMachineScaleSetInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -1467,7 +1471,7 @@ public Observable>> listByReso @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listByResourceGroupDelegate(response); + ServiceResponse> result = listByResourceGroupDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -1476,9 +1480,9 @@ public Observable>> call(Respo }); } - private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -1574,7 +1578,7 @@ public Observable>> listSingle @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listDelegate(response); + ServiceResponse> result = listDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -1583,9 +1587,9 @@ public Observable>> call(Respo }); } - private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -1674,8 +1678,8 @@ public Observable>> call(Se /** * Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for each SKU. * - ServiceResponse> * @param resourceGroupName The name of the resource group. - ServiceResponse> * @param vmScaleSetName The name of the VM scale set. + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param vmScaleSetName The name of the VM scale set. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<VirtualMachineScaleSetSkuInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -1697,7 +1701,7 @@ public Observable>> listSku @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listSkusDelegate(response); + ServiceResponse> result = listSkusDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -1706,9 +1710,9 @@ public Observable>> call(Re }); } - private ServiceResponse> listSkusDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listSkusDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -1782,7 +1786,7 @@ public Observable> powerOffWithSer VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); vmInstanceIDs.withInstanceIds(null); Observable> observable = service.powerOff(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. @@ -1860,7 +1864,7 @@ public Observable> powerOffWithSer vmInstanceIDs.withInstanceIds(instanceIds); } Observable> observable = service.powerOff(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -2111,7 +2115,7 @@ public Observable> restartWithServ VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); vmInstanceIDs.withInstanceIds(null); Observable> observable = service.restart(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** * Restarts one or more virtual machines in a VM scale set. @@ -2189,7 +2193,7 @@ public Observable> restartWithServ vmInstanceIDs.withInstanceIds(instanceIds); } Observable> observable = service.restart(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -2440,7 +2444,7 @@ public Observable> startWithServic VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); vmInstanceIDs.withInstanceIds(null); Observable> observable = service.start(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** * Starts one or more virtual machines in a VM scale set. @@ -2518,7 +2522,7 @@ public Observable> startWithServic vmInstanceIDs.withInstanceIds(instanceIds); } Observable> observable = service.start(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -2776,7 +2780,7 @@ public Observable> updateInstances VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceRequiredIDs(); vmInstanceIDs.withInstanceIds(instanceIds); Observable> observable = service.updateInstances(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -2945,7 +2949,7 @@ public Observable> reimageWithServ VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); vmInstanceIDs.withInstanceIds(null); Observable> observable = service.reimage(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set. @@ -3023,7 +3027,7 @@ public Observable> reimageWithServ vmInstanceIDs.withInstanceIds(instanceIds); } Observable> observable = service.reimage(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -3274,7 +3278,7 @@ public Observable> reimageAllWithS VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); vmInstanceIDs.withInstanceIds(null); Observable> observable = service.reimageAll(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** * Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only supported for managed disks. @@ -3352,7 +3356,7 @@ public Observable> reimageAllWithS vmInstanceIDs.withInstanceIds(instanceIds); } Observable> observable = service.reimageAll(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -3615,7 +3619,7 @@ public Observable>> call(Servi /** * Gets a list of all VM scale sets under a resource group. * - ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<VirtualMachineScaleSetInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -3629,7 +3633,7 @@ public Observable>> listByReso @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listByResourceGroupNextDelegate(response); + ServiceResponse> result = listByResourceGroupNextDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -3638,9 +3642,9 @@ public Observable>> call(Respo }); } - private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -3726,7 +3730,7 @@ public Observable>> call(Servi /** * Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use nextLink property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all the VM Scale Sets. * - ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<VirtualMachineScaleSetInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -3740,7 +3744,7 @@ public Observable>> listNextSi @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listNextDelegate(response); + ServiceResponse> result = listNextDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -3749,9 +3753,9 @@ public Observable>> call(Respo }); } - private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -3837,7 +3841,7 @@ public Observable>> call(Se /** * Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for each SKU. * - ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<VirtualMachineScaleSetSkuInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -3851,7 +3855,7 @@ public Observable>> listSku @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listSkusNextDelegate(response); + ServiceResponse> result = listSkusNextDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -3860,9 +3864,9 @@ public Observable>> call(Re }); } - private ServiceResponse> listSkusNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listSkusNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineSizeInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineSizeInner.java index f171e8081ef4..068c94a4553d 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineSizeInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineSizeInner.java @@ -52,7 +52,7 @@ public class VirtualMachineSizeInner { private Integer maxDataDiskCount; /** - * Get the name value. + * Get the name of the virtual machine size. * * @return the name value */ @@ -61,7 +61,7 @@ public String name() { } /** - * Set the name value. + * Set the name of the virtual machine size. * * @param name the name value to set * @return the VirtualMachineSizeInner object itself. @@ -72,7 +72,7 @@ public VirtualMachineSizeInner withName(String name) { } /** - * Get the numberOfCores value. + * Get the number of cores supported by the virtual machine size. * * @return the numberOfCores value */ @@ -81,7 +81,7 @@ public Integer numberOfCores() { } /** - * Set the numberOfCores value. + * Set the number of cores supported by the virtual machine size. * * @param numberOfCores the numberOfCores value to set * @return the VirtualMachineSizeInner object itself. @@ -92,7 +92,7 @@ public VirtualMachineSizeInner withNumberOfCores(Integer numberOfCores) { } /** - * Get the osDiskSizeInMB value. + * Get the OS disk size, in MB, allowed by the virtual machine size. * * @return the osDiskSizeInMB value */ @@ -101,7 +101,7 @@ public Integer osDiskSizeInMB() { } /** - * Set the osDiskSizeInMB value. + * Set the OS disk size, in MB, allowed by the virtual machine size. * * @param osDiskSizeInMB the osDiskSizeInMB value to set * @return the VirtualMachineSizeInner object itself. @@ -112,7 +112,7 @@ public VirtualMachineSizeInner withOsDiskSizeInMB(Integer osDiskSizeInMB) { } /** - * Get the resourceDiskSizeInMB value. + * Get the resource disk size, in MB, allowed by the virtual machine size. * * @return the resourceDiskSizeInMB value */ @@ -121,7 +121,7 @@ public Integer resourceDiskSizeInMB() { } /** - * Set the resourceDiskSizeInMB value. + * Set the resource disk size, in MB, allowed by the virtual machine size. * * @param resourceDiskSizeInMB the resourceDiskSizeInMB value to set * @return the VirtualMachineSizeInner object itself. @@ -132,7 +132,7 @@ public VirtualMachineSizeInner withResourceDiskSizeInMB(Integer resourceDiskSize } /** - * Get the memoryInMB value. + * Get the amount of memory, in MB, supported by the virtual machine size. * * @return the memoryInMB value */ @@ -141,7 +141,7 @@ public Integer memoryInMB() { } /** - * Set the memoryInMB value. + * Set the amount of memory, in MB, supported by the virtual machine size. * * @param memoryInMB the memoryInMB value to set * @return the VirtualMachineSizeInner object itself. @@ -152,7 +152,7 @@ public VirtualMachineSizeInner withMemoryInMB(Integer memoryInMB) { } /** - * Get the maxDataDiskCount value. + * Get the maximum number of data disks that can be attached to the virtual machine size. * * @return the maxDataDiskCount value */ @@ -161,7 +161,7 @@ public Integer maxDataDiskCount() { } /** - * Set the maxDataDiskCount value. + * Set the maximum number of data disks that can be attached to the virtual machine size. * * @param maxDataDiskCount the maxDataDiskCount value to set * @return the VirtualMachineSizeInner object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineSizesInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineSizesInner.java index e55a8aed3604..e72b2aa6ad4b 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineSizesInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineSizesInner.java @@ -121,7 +121,7 @@ public Observable>> listWithServic @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listDelegate(response); + ServiceResponse> result = listDelegate(response); List items = null; if (result.body() != null) { items = result.body().items(); @@ -135,9 +135,9 @@ public Observable>> call(Response< }); } - private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesImpl.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesImpl.java new file mode 100644 index 000000000000..8f9c5a8f6ae4 --- /dev/null +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesImpl.java @@ -0,0 +1,297 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.compute.v2017_03_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.compute.v2017_03_30.VirtualMachines; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.compute.v2017_03_30.VirtualMachine; +import com.microsoft.azure.management.compute.v2017_03_30.VirtualMachineCaptureResult; +import com.microsoft.azure.management.compute.v2017_03_30.OperationStatusResponse; +import com.microsoft.azure.management.compute.v2017_03_30.VirtualMachineInstanceView; +import com.microsoft.azure.management.compute.v2017_03_30.RunCommandResult; +import com.microsoft.azure.management.compute.v2017_03_30.VirtualMachineCaptureParameters; +import com.microsoft.azure.management.compute.v2017_03_30.RunCommandInput; +import com.microsoft.azure.management.compute.v2017_03_30.VirtualMachineExtensionsListResult; +import java.util.List; +import com.microsoft.azure.management.compute.v2017_03_30.VirtualMachineVirtualMachineSize; + +class VirtualMachinesImpl extends WrapperImpl implements VirtualMachines { + private final ComputeManager manager; + + VirtualMachinesImpl(ComputeManager manager) { + super(manager.inner().virtualMachines()); + this.manager = manager; + } + + public ComputeManager manager() { + return this.manager; + } + + @Override + public VirtualMachineImpl defineVirtualMachine(String name) { + return wrapVirtualMachineModel(name); + } + + private VirtualMachineImpl wrapVirtualMachineModel(String name) { + return new VirtualMachineImpl(name, this.manager()); + } + + private VirtualMachineImpl wrapVirtualMachineModel(VirtualMachineInner inner) { + return new VirtualMachineImpl(inner, manager()); + } + + private VirtualMachineVirtualMachineSizeImpl wrapVirtualMachineVirtualMachineSizeModel(VirtualMachineSizeInner inner) { + return new VirtualMachineVirtualMachineSizeImpl(inner, manager()); + } + + @Override + public Observable listByLocationAsync(final String location) { + VirtualMachinesInner client = this.inner(); + return client.listByLocationAsync(location) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public VirtualMachine call(VirtualMachineInner inner) { + return wrapVirtualMachineModel(inner); + } + }); + } + + @Override + public Observable captureAsync(String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) { + VirtualMachinesInner client = this.inner(); + return client.captureAsync(resourceGroupName, vmName, parameters) + .map(new Func1() { + @Override + public VirtualMachineCaptureResult call(VirtualMachineCaptureResultInner inner) { + return new VirtualMachineCaptureResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable deleteAsync(String resourceGroupName, String vmName) { + VirtualMachinesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, vmName) + .map(new Func1() { + @Override + public OperationStatusResponse call(OperationStatusResponseInner inner) { + return new OperationStatusResponseImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByResourceGroupAsync(String resourceGroupName, String vmName) { + VirtualMachinesInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, vmName) + .map(new Func1() { + @Override + public VirtualMachine call(VirtualMachineInner inner) { + return new VirtualMachineImpl(inner, manager()); + } + }); + } + + @Override + public Observable instanceViewAsync(String resourceGroupName, String vmName) { + VirtualMachinesInner client = this.inner(); + return client.instanceViewAsync(resourceGroupName, vmName) + .map(new Func1() { + @Override + public VirtualMachineInstanceView call(VirtualMachineInstanceViewInner inner) { + return new VirtualMachineInstanceViewImpl(inner, manager()); + } + }); + } + + @Override + public Observable convertToManagedDisksAsync(String resourceGroupName, String vmName) { + VirtualMachinesInner client = this.inner(); + return client.convertToManagedDisksAsync(resourceGroupName, vmName) + .map(new Func1() { + @Override + public OperationStatusResponse call(OperationStatusResponseInner inner) { + return new OperationStatusResponseImpl(inner, manager()); + } + }); + } + + @Override + public Observable deallocateAsync(String resourceGroupName, String vmName) { + VirtualMachinesInner client = this.inner(); + return client.deallocateAsync(resourceGroupName, vmName) + .map(new Func1() { + @Override + public OperationStatusResponse call(OperationStatusResponseInner inner) { + return new OperationStatusResponseImpl(inner, manager()); + } + }); + } + + @Override + public Observable generalizeAsync(String resourceGroupName, String vmName) { + VirtualMachinesInner client = this.inner(); + return client.generalizeAsync(resourceGroupName, vmName) + .map(new Func1() { + @Override + public OperationStatusResponse call(OperationStatusResponseInner inner) { + return new OperationStatusResponseImpl(inner, manager()); + } + }); + } + + @Override + public Observable powerOffAsync(String resourceGroupName, String vmName) { + VirtualMachinesInner client = this.inner(); + return client.powerOffAsync(resourceGroupName, vmName) + .map(new Func1() { + @Override + public OperationStatusResponse call(OperationStatusResponseInner inner) { + return new OperationStatusResponseImpl(inner, manager()); + } + }); + } + + @Override + public Observable restartAsync(String resourceGroupName, String vmName) { + VirtualMachinesInner client = this.inner(); + return client.restartAsync(resourceGroupName, vmName) + .map(new Func1() { + @Override + public OperationStatusResponse call(OperationStatusResponseInner inner) { + return new OperationStatusResponseImpl(inner, manager()); + } + }); + } + + @Override + public Observable startAsync(String resourceGroupName, String vmName) { + VirtualMachinesInner client = this.inner(); + return client.startAsync(resourceGroupName, vmName) + .map(new Func1() { + @Override + public OperationStatusResponse call(OperationStatusResponseInner inner) { + return new OperationStatusResponseImpl(inner, manager()); + } + }); + } + + @Override + public Observable redeployAsync(String resourceGroupName, String vmName) { + VirtualMachinesInner client = this.inner(); + return client.redeployAsync(resourceGroupName, vmName) + .map(new Func1() { + @Override + public OperationStatusResponse call(OperationStatusResponseInner inner) { + return new OperationStatusResponseImpl(inner, manager()); + } + }); + } + + @Override + public Observable performMaintenanceAsync(String resourceGroupName, String vmName) { + VirtualMachinesInner client = this.inner(); + return client.performMaintenanceAsync(resourceGroupName, vmName) + .map(new Func1() { + @Override + public OperationStatusResponse call(OperationStatusResponseInner inner) { + return new OperationStatusResponseImpl(inner, manager()); + } + }); + } + + @Override + public Observable runCommandAsync(String resourceGroupName, String vmName, RunCommandInput parameters) { + VirtualMachinesInner client = this.inner(); + return client.runCommandAsync(resourceGroupName, vmName, parameters) + .map(new Func1() { + @Override + public RunCommandResult call(RunCommandResultInner inner) { + return new RunCommandResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByResourceGroupAsync(final String resourceGroupName) { + VirtualMachinesInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public VirtualMachine call(VirtualMachineInner inner) { + return new VirtualMachineImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync() { + VirtualMachinesInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public VirtualMachine call(VirtualMachineInner inner) { + return new VirtualMachineImpl(inner, manager()); + } + }); + } + + @Override + public Observable getExtensionsAsync(String resourceGroupName, String vmName) { + VirtualMachinesInner client = this.inner(); + return client.getExtensionsAsync(resourceGroupName, vmName) + .map(new Func1() { + @Override + public VirtualMachineExtensionsListResult call(VirtualMachineExtensionsListResultInner inner) { + return new VirtualMachineExtensionsListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAvailableSizesAsync(String resourceGroupName, String vmName) { + VirtualMachinesInner client = this.inner(); + return client.listAvailableSizesAsync(resourceGroupName, vmName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public VirtualMachineVirtualMachineSize call(VirtualMachineSizeInner inner) { + return wrapVirtualMachineVirtualMachineSizeModel(inner); + } + }); + } + +} diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java index 434379c14891..33d685310dd9 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java @@ -41,6 +41,10 @@ import retrofit2.Response; import rx.functions.Func1; import rx.Observable; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined @@ -72,6 +76,10 @@ interface VirtualMachinesService { @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions") Observable> getExtensions(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("subscriptionId") String subscriptionId, @Query("$expand") String expand, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.v2017_03_30.VirtualMachines listByLocation" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines") + Observable> listByLocation(@Path("location") String location, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.v2017_03_30.VirtualMachines capture" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture") Observable> capture(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("subscriptionId") String subscriptionId, @Body VirtualMachineCaptureParameters parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -184,6 +192,10 @@ interface VirtualMachinesService { @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand") Observable> beginRunCommand(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("subscriptionId") String subscriptionId, @Body RunCommandInput parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.v2017_03_30.VirtualMachines listByLocationNext" }) + @GET + Observable> listByLocationNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.v2017_03_30.VirtualMachines listByResourceGroupNext" }) @GET Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -364,6 +376,121 @@ private ServiceResponse getExtensionsDe .build(response); } + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<VirtualMachineInner> object if successful. + */ + public PagedList listByLocation(final String location) { + ServiceResponse> response = listByLocationSinglePageAsync(location).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByLocationAsync(final String location, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByLocationSinglePageAsync(location), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualMachineInner> object + */ + public Observable> listByLocationAsync(final String location) { + return listByLocationWithServiceResponseAsync(location) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualMachineInner> object + */ + public Observable>> listByLocationWithServiceResponseAsync(final String location) { + return listByLocationSinglePageAsync(location) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByLocationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + ServiceResponse> * @param location The location for which virtual machines under the subscription are queried. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VirtualMachineInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByLocationSinglePageAsync(final String location) { + if (location == null) { + throw new IllegalArgumentException("Parameter location is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByLocation(location, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByLocationDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByLocationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + /** * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs. * @@ -438,7 +565,7 @@ public Observable> captureWith } Validator.validate(parameters); Observable> observable = service.capture(resourceGroupName, vmName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -1187,7 +1314,7 @@ public Observable> convertToManage throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Observable> observable = service.convertToManagedDisks(resourceGroupName, vmName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -1343,7 +1470,7 @@ public Observable> deallocateWithS throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Observable> observable = service.deallocate(resourceGroupName, vmName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -1599,7 +1726,7 @@ public Observable>> call(ServiceRespon /** * Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to get the next page of virtual machines. * - ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param resourceGroupName The name of the resource group. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<VirtualMachineInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -1618,7 +1745,7 @@ public Observable>> listByResourceGrou @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listByResourceGroupDelegate(response); + ServiceResponse> result = listByResourceGroupDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -1627,9 +1754,9 @@ public Observable>> call(Response> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -1725,7 +1852,7 @@ public Observable>> listSinglePageAsyn @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listDelegate(response); + ServiceResponse> result = listDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -1734,9 +1861,9 @@ public Observable>> call(Response> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -1811,7 +1938,7 @@ public Observable>> listAvailableS @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listAvailableSizesDelegate(response); + ServiceResponse> result = listAvailableSizesDelegate(response); List items = null; if (result.body() != null) { items = result.body().items(); @@ -1825,9 +1952,9 @@ public Observable>> call(Response< }); } - private ServiceResponse> listAvailableSizesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listAvailableSizesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -1898,7 +2025,7 @@ public Observable> powerOffWithSer throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Observable> observable = service.powerOff(resourceGroupName, vmName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -2054,7 +2181,7 @@ public Observable> restartWithServ throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Observable> observable = service.restart(resourceGroupName, vmName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -2210,7 +2337,7 @@ public Observable> startWithServic throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Observable> observable = service.start(resourceGroupName, vmName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -2366,7 +2493,7 @@ public Observable> redeployWithSer throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Observable> observable = service.redeploy(resourceGroupName, vmName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -2522,7 +2649,7 @@ public Observable> performMaintena throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Observable> observable = service.performMaintenance(resourceGroupName, vmName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -2686,7 +2813,7 @@ public Observable> runCommandWithServiceR } Validator.validate(parameters); Observable> observable = service.runCommand(resourceGroupName, vmName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); } /** @@ -2784,6 +2911,117 @@ private ServiceResponse beginRunCommandDelegate(Response< .build(response); } + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<VirtualMachineInner> object if successful. + */ + public PagedList listByLocationNext(final String nextPageLink) { + ServiceResponse> response = listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByLocationNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByLocationNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualMachineInner> object + */ + public Observable> listByLocationNextAsync(final String nextPageLink) { + return listByLocationNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualMachineInner> object + */ + public Observable>> listByLocationNextWithServiceResponseAsync(final String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByLocationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VirtualMachineInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByLocationNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByLocationNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByLocationNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByLocationNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + /** * Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to get the next page of virtual machines. * @@ -2865,7 +3103,7 @@ public Observable>> call(ServiceRespon /** * Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to get the next page of virtual machines. * - ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<VirtualMachineInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -2879,7 +3117,7 @@ public Observable>> listByResourceGrou @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listByResourceGroupNextDelegate(response); + ServiceResponse> result = listByResourceGroupNextDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -2888,9 +3126,9 @@ public Observable>> call(Response> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -2976,7 +3214,7 @@ public Observable>> call(ServiceRespon /** * Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines. * - ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<VirtualMachineInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -2990,7 +3228,7 @@ public Observable>> listNextSinglePage @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listNextDelegate(response); + ServiceResponse> result = listNextDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -2999,9 +3237,9 @@ public Observable>> call(Response> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } diff --git a/containerservice/resource-manager/v2019_08_01/pom.xml b/containerservice/resource-manager/v2019_08_01/pom.xml new file mode 100644 index 000000000000..9fe51ff4ffd3 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.containerservice.v2019_08_01 + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-containerservice + 1.0.0-beta + jar + Microsoft Azure SDK for ContainerService Management + This package contains Microsoft ContainerService Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + 1.6.5 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/AgentPool.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/AgentPool.java new file mode 100644 index 000000000000..3f4d900add37 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/AgentPool.java @@ -0,0 +1,534 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.AgentPoolInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.ContainerServiceManager; +import java.util.List; + +/** + * Type representing AgentPool. + */ +public interface AgentPool extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the agentPoolType value. + */ + AgentPoolType agentPoolType(); + + /** + * @return the availabilityZones value. + */ + List availabilityZones(); + + /** + * @return the count value. + */ + int count(); + + /** + * @return the enableAutoScaling value. + */ + Boolean enableAutoScaling(); + + /** + * @return the enableNodePublicIP value. + */ + Boolean enableNodePublicIP(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the maxCount value. + */ + Integer maxCount(); + + /** + * @return the maxPods value. + */ + Integer maxPods(); + + /** + * @return the minCount value. + */ + Integer minCount(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the nodeTaints value. + */ + List nodeTaints(); + + /** + * @return the orchestratorVersion value. + */ + String orchestratorVersion(); + + /** + * @return the osDiskSizeGB value. + */ + Integer osDiskSizeGB(); + + /** + * @return the osType value. + */ + OSType osType(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the scaleSetEvictionPolicy value. + */ + ScaleSetEvictionPolicy scaleSetEvictionPolicy(); + + /** + * @return the scaleSetPriority value. + */ + ScaleSetPriority scaleSetPriority(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the vmSize value. + */ + ContainerServiceVMSizeTypes vmSize(); + + /** + * @return the vnetSubnetID value. + */ + String vnetSubnetID(); + + /** + * The entirety of the AgentPool definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithManagedCluster, DefinitionStages.WithCount, DefinitionStages.WithVmSize, DefinitionStages.WithCreate { + } + + /** + * Grouping of AgentPool definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a AgentPool definition. + */ + interface Blank extends WithManagedCluster { + } + + /** + * The stage of the agentpool definition allowing to specify ManagedCluster. + */ + interface WithManagedCluster { + /** + * Specifies resourceGroupName, resourceName. + * @param resourceGroupName The name of the resource group + * @param resourceName The name of the managed cluster resource + * @return the next definition stage + */ + WithCount withExistingManagedCluster(String resourceGroupName, String resourceName); + } + + /** + * The stage of the agentpool definition allowing to specify Count. + */ + interface WithCount { + /** + * Specifies count. + * @param count Number of agents (VMs) to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1 + * @return the next definition stage + */ + WithVmSize withCount(int count); + } + + /** + * The stage of the agentpool definition allowing to specify VmSize. + */ + interface WithVmSize { + /** + * Specifies vmSize. + * @param vmSize Size of agent VMs. Possible values include: 'Standard_A1', 'Standard_A10', 'Standard_A11', 'Standard_A1_v2', 'Standard_A2', 'Standard_A2_v2', 'Standard_A2m_v2', 'Standard_A3', 'Standard_A4', 'Standard_A4_v2', 'Standard_A4m_v2', 'Standard_A5', 'Standard_A6', 'Standard_A7', 'Standard_A8', 'Standard_A8_v2', 'Standard_A8m_v2', 'Standard_A9', 'Standard_B2ms', 'Standard_B2s', 'Standard_B4ms', 'Standard_B8ms', 'Standard_D1', 'Standard_D11', 'Standard_D11_v2', 'Standard_D11_v2_Promo', 'Standard_D12', 'Standard_D12_v2', 'Standard_D12_v2_Promo', 'Standard_D13', 'Standard_D13_v2', 'Standard_D13_v2_Promo', 'Standard_D14', 'Standard_D14_v2', 'Standard_D14_v2_Promo', 'Standard_D15_v2', 'Standard_D16_v3', 'Standard_D16s_v3', 'Standard_D1_v2', 'Standard_D2', 'Standard_D2_v2', 'Standard_D2_v2_Promo', 'Standard_D2_v3', 'Standard_D2s_v3', 'Standard_D3', 'Standard_D32_v3', 'Standard_D32s_v3', 'Standard_D3_v2', 'Standard_D3_v2_Promo', 'Standard_D4', 'Standard_D4_v2', 'Standard_D4_v2_Promo', 'Standard_D4_v3', 'Standard_D4s_v3', 'Standard_D5_v2', 'Standard_D5_v2_Promo', 'Standard_D64_v3', 'Standard_D64s_v3', 'Standard_D8_v3', 'Standard_D8s_v3', 'Standard_DS1', 'Standard_DS11', 'Standard_DS11_v2', 'Standard_DS11_v2_Promo', 'Standard_DS12', 'Standard_DS12_v2', 'Standard_DS12_v2_Promo', 'Standard_DS13', 'Standard_DS13-2_v2', 'Standard_DS13-4_v2', 'Standard_DS13_v2', 'Standard_DS13_v2_Promo', 'Standard_DS14', 'Standard_DS14-4_v2', 'Standard_DS14-8_v2', 'Standard_DS14_v2', 'Standard_DS14_v2_Promo', 'Standard_DS15_v2', 'Standard_DS1_v2', 'Standard_DS2', 'Standard_DS2_v2', 'Standard_DS2_v2_Promo', 'Standard_DS3', 'Standard_DS3_v2', 'Standard_DS3_v2_Promo', 'Standard_DS4', 'Standard_DS4_v2', 'Standard_DS4_v2_Promo', 'Standard_DS5_v2', 'Standard_DS5_v2_Promo', 'Standard_E16_v3', 'Standard_E16s_v3', 'Standard_E2_v3', 'Standard_E2s_v3', 'Standard_E32-16s_v3', 'Standard_E32-8s_v3', 'Standard_E32_v3', 'Standard_E32s_v3', 'Standard_E4_v3', 'Standard_E4s_v3', 'Standard_E64-16s_v3', 'Standard_E64-32s_v3', 'Standard_E64_v3', 'Standard_E64s_v3', 'Standard_E8_v3', 'Standard_E8s_v3', 'Standard_F1', 'Standard_F16', 'Standard_F16s', 'Standard_F16s_v2', 'Standard_F1s', 'Standard_F2', 'Standard_F2s', 'Standard_F2s_v2', 'Standard_F32s_v2', 'Standard_F4', 'Standard_F4s', 'Standard_F4s_v2', 'Standard_F64s_v2', 'Standard_F72s_v2', 'Standard_F8', 'Standard_F8s', 'Standard_F8s_v2', 'Standard_G1', 'Standard_G2', 'Standard_G3', 'Standard_G4', 'Standard_G5', 'Standard_GS1', 'Standard_GS2', 'Standard_GS3', 'Standard_GS4', 'Standard_GS4-4', 'Standard_GS4-8', 'Standard_GS5', 'Standard_GS5-16', 'Standard_GS5-8', 'Standard_H16', 'Standard_H16m', 'Standard_H16mr', 'Standard_H16r', 'Standard_H8', 'Standard_H8m', 'Standard_L16s', 'Standard_L32s', 'Standard_L4s', 'Standard_L8s', 'Standard_M128-32ms', 'Standard_M128-64ms', 'Standard_M128ms', 'Standard_M128s', 'Standard_M64-16ms', 'Standard_M64-32ms', 'Standard_M64ms', 'Standard_M64s', 'Standard_NC12', 'Standard_NC12s_v2', 'Standard_NC12s_v3', 'Standard_NC24', 'Standard_NC24r', 'Standard_NC24rs_v2', 'Standard_NC24rs_v3', 'Standard_NC24s_v2', 'Standard_NC24s_v3', 'Standard_NC6', 'Standard_NC6s_v2', 'Standard_NC6s_v3', 'Standard_ND12s', 'Standard_ND24rs', 'Standard_ND24s', 'Standard_ND6s', 'Standard_NV12', 'Standard_NV24', 'Standard_NV6' + * @return the next definition stage + */ + WithCreate withVmSize(ContainerServiceVMSizeTypes vmSize); + } + + /** + * The stage of the agentpool definition allowing to specify AgentPoolType. + */ + interface WithAgentPoolType { + /** + * Specifies agentPoolType. + * @param agentPoolType AgentPoolType represents types of an agent pool. Possible values include: 'VirtualMachineScaleSets', 'AvailabilitySet' + * @return the next definition stage + */ + WithCreate withAgentPoolType(AgentPoolType agentPoolType); + } + + /** + * The stage of the agentpool definition allowing to specify AvailabilityZones. + */ + interface WithAvailabilityZones { + /** + * Specifies availabilityZones. + * @param availabilityZones (PREVIEW) Availability zones for nodes. Must use VirtualMachineScaleSets AgentPoolType + * @return the next definition stage + */ + WithCreate withAvailabilityZones(List availabilityZones); + } + + /** + * The stage of the agentpool definition allowing to specify EnableAutoScaling. + */ + interface WithEnableAutoScaling { + /** + * Specifies enableAutoScaling. + * @param enableAutoScaling Whether to enable auto-scaler + * @return the next definition stage + */ + WithCreate withEnableAutoScaling(Boolean enableAutoScaling); + } + + /** + * The stage of the agentpool definition allowing to specify EnableNodePublicIP. + */ + interface WithEnableNodePublicIP { + /** + * Specifies enableNodePublicIP. + * @param enableNodePublicIP Enable public IP for nodes + * @return the next definition stage + */ + WithCreate withEnableNodePublicIP(Boolean enableNodePublicIP); + } + + /** + * The stage of the agentpool definition allowing to specify MaxCount. + */ + interface WithMaxCount { + /** + * Specifies maxCount. + * @param maxCount Maximum number of nodes for auto-scaling + * @return the next definition stage + */ + WithCreate withMaxCount(Integer maxCount); + } + + /** + * The stage of the agentpool definition allowing to specify MaxPods. + */ + interface WithMaxPods { + /** + * Specifies maxPods. + * @param maxPods Maximum number of pods that can run on a node + * @return the next definition stage + */ + WithCreate withMaxPods(Integer maxPods); + } + + /** + * The stage of the agentpool definition allowing to specify MinCount. + */ + interface WithMinCount { + /** + * Specifies minCount. + * @param minCount Minimum number of nodes for auto-scaling + * @return the next definition stage + */ + WithCreate withMinCount(Integer minCount); + } + + /** + * The stage of the agentpool definition allowing to specify NodeTaints. + */ + interface WithNodeTaints { + /** + * Specifies nodeTaints. + * @param nodeTaints Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule + * @return the next definition stage + */ + WithCreate withNodeTaints(List nodeTaints); + } + + /** + * The stage of the agentpool definition allowing to specify OrchestratorVersion. + */ + interface WithOrchestratorVersion { + /** + * Specifies orchestratorVersion. + * @param orchestratorVersion Version of orchestrator specified when creating the managed cluster + * @return the next definition stage + */ + WithCreate withOrchestratorVersion(String orchestratorVersion); + } + + /** + * The stage of the agentpool definition allowing to specify OsDiskSizeGB. + */ + interface WithOsDiskSizeGB { + /** + * Specifies osDiskSizeGB. + * @param osDiskSizeGB OS Disk Size in GB to be used to specify the disk size for every machine in this master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified + * @return the next definition stage + */ + WithCreate withOsDiskSizeGB(Integer osDiskSizeGB); + } + + /** + * The stage of the agentpool definition allowing to specify OsType. + */ + interface WithOsType { + /** + * Specifies osType. + * @param osType OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: 'Linux', 'Windows' + * @return the next definition stage + */ + WithCreate withOsType(OSType osType); + } + + /** + * The stage of the agentpool definition allowing to specify ScaleSetEvictionPolicy. + */ + interface WithScaleSetEvictionPolicy { + /** + * Specifies scaleSetEvictionPolicy. + * @param scaleSetEvictionPolicy ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. Possible values include: 'Delete', 'Deallocate' + * @return the next definition stage + */ + WithCreate withScaleSetEvictionPolicy(ScaleSetEvictionPolicy scaleSetEvictionPolicy); + } + + /** + * The stage of the agentpool definition allowing to specify ScaleSetPriority. + */ + interface WithScaleSetPriority { + /** + * Specifies scaleSetPriority. + * @param scaleSetPriority ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. Possible values include: 'Low', 'Regular' + * @return the next definition stage + */ + WithCreate withScaleSetPriority(ScaleSetPriority scaleSetPriority); + } + + /** + * The stage of the agentpool definition allowing to specify VnetSubnetID. + */ + interface WithVnetSubnetID { + /** + * Specifies vnetSubnetID. + * @param vnetSubnetID VNet SubnetID specifies the VNet's subnet identifier + * @return the next definition stage + */ + WithCreate withVnetSubnetID(String vnetSubnetID); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithAgentPoolType, DefinitionStages.WithAvailabilityZones, DefinitionStages.WithEnableAutoScaling, DefinitionStages.WithEnableNodePublicIP, DefinitionStages.WithMaxCount, DefinitionStages.WithMaxPods, DefinitionStages.WithMinCount, DefinitionStages.WithNodeTaints, DefinitionStages.WithOrchestratorVersion, DefinitionStages.WithOsDiskSizeGB, DefinitionStages.WithOsType, DefinitionStages.WithScaleSetEvictionPolicy, DefinitionStages.WithScaleSetPriority, DefinitionStages.WithVnetSubnetID { + } + } + /** + * The template for a AgentPool update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAgentPoolType, UpdateStages.WithAvailabilityZones, UpdateStages.WithEnableAutoScaling, UpdateStages.WithEnableNodePublicIP, UpdateStages.WithMaxCount, UpdateStages.WithMaxPods, UpdateStages.WithMinCount, UpdateStages.WithNodeTaints, UpdateStages.WithOrchestratorVersion, UpdateStages.WithOsDiskSizeGB, UpdateStages.WithOsType, UpdateStages.WithScaleSetEvictionPolicy, UpdateStages.WithScaleSetPriority, UpdateStages.WithVnetSubnetID { + } + + /** + * Grouping of AgentPool update stages. + */ + interface UpdateStages { + /** + * The stage of the agentpool update allowing to specify AgentPoolType. + */ + interface WithAgentPoolType { + /** + * Specifies agentPoolType. + * @param agentPoolType AgentPoolType represents types of an agent pool. Possible values include: 'VirtualMachineScaleSets', 'AvailabilitySet' + * @return the next update stage + */ + Update withAgentPoolType(AgentPoolType agentPoolType); + } + + /** + * The stage of the agentpool update allowing to specify AvailabilityZones. + */ + interface WithAvailabilityZones { + /** + * Specifies availabilityZones. + * @param availabilityZones (PREVIEW) Availability zones for nodes. Must use VirtualMachineScaleSets AgentPoolType + * @return the next update stage + */ + Update withAvailabilityZones(List availabilityZones); + } + + /** + * The stage of the agentpool update allowing to specify EnableAutoScaling. + */ + interface WithEnableAutoScaling { + /** + * Specifies enableAutoScaling. + * @param enableAutoScaling Whether to enable auto-scaler + * @return the next update stage + */ + Update withEnableAutoScaling(Boolean enableAutoScaling); + } + + /** + * The stage of the agentpool update allowing to specify EnableNodePublicIP. + */ + interface WithEnableNodePublicIP { + /** + * Specifies enableNodePublicIP. + * @param enableNodePublicIP Enable public IP for nodes + * @return the next update stage + */ + Update withEnableNodePublicIP(Boolean enableNodePublicIP); + } + + /** + * The stage of the agentpool update allowing to specify MaxCount. + */ + interface WithMaxCount { + /** + * Specifies maxCount. + * @param maxCount Maximum number of nodes for auto-scaling + * @return the next update stage + */ + Update withMaxCount(Integer maxCount); + } + + /** + * The stage of the agentpool update allowing to specify MaxPods. + */ + interface WithMaxPods { + /** + * Specifies maxPods. + * @param maxPods Maximum number of pods that can run on a node + * @return the next update stage + */ + Update withMaxPods(Integer maxPods); + } + + /** + * The stage of the agentpool update allowing to specify MinCount. + */ + interface WithMinCount { + /** + * Specifies minCount. + * @param minCount Minimum number of nodes for auto-scaling + * @return the next update stage + */ + Update withMinCount(Integer minCount); + } + + /** + * The stage of the agentpool update allowing to specify NodeTaints. + */ + interface WithNodeTaints { + /** + * Specifies nodeTaints. + * @param nodeTaints Taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule + * @return the next update stage + */ + Update withNodeTaints(List nodeTaints); + } + + /** + * The stage of the agentpool update allowing to specify OrchestratorVersion. + */ + interface WithOrchestratorVersion { + /** + * Specifies orchestratorVersion. + * @param orchestratorVersion Version of orchestrator specified when creating the managed cluster + * @return the next update stage + */ + Update withOrchestratorVersion(String orchestratorVersion); + } + + /** + * The stage of the agentpool update allowing to specify OsDiskSizeGB. + */ + interface WithOsDiskSizeGB { + /** + * Specifies osDiskSizeGB. + * @param osDiskSizeGB OS Disk Size in GB to be used to specify the disk size for every machine in this master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified + * @return the next update stage + */ + Update withOsDiskSizeGB(Integer osDiskSizeGB); + } + + /** + * The stage of the agentpool update allowing to specify OsType. + */ + interface WithOsType { + /** + * Specifies osType. + * @param osType OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: 'Linux', 'Windows' + * @return the next update stage + */ + Update withOsType(OSType osType); + } + + /** + * The stage of the agentpool update allowing to specify ScaleSetEvictionPolicy. + */ + interface WithScaleSetEvictionPolicy { + /** + * Specifies scaleSetEvictionPolicy. + * @param scaleSetEvictionPolicy ScaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. Possible values include: 'Delete', 'Deallocate' + * @return the next update stage + */ + Update withScaleSetEvictionPolicy(ScaleSetEvictionPolicy scaleSetEvictionPolicy); + } + + /** + * The stage of the agentpool update allowing to specify ScaleSetPriority. + */ + interface WithScaleSetPriority { + /** + * Specifies scaleSetPriority. + * @param scaleSetPriority ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. Possible values include: 'Low', 'Regular' + * @return the next update stage + */ + Update withScaleSetPriority(ScaleSetPriority scaleSetPriority); + } + + /** + * The stage of the agentpool update allowing to specify VnetSubnetID. + */ + interface WithVnetSubnetID { + /** + * Specifies vnetSubnetID. + * @param vnetSubnetID VNet SubnetID specifies the VNet's subnet identifier + * @return the next update stage + */ + Update withVnetSubnetID(String vnetSubnetID); + } + + } +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/AgentPoolAvailableVersions.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/AgentPoolAvailableVersions.java new file mode 100644 index 000000000000..d2023548caf6 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/AgentPoolAvailableVersions.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.ContainerServiceManager; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.AgentPoolAvailableVersionsInner; +import java.util.List; + +/** + * Type representing AgentPoolAvailableVersions. + */ +public interface AgentPoolAvailableVersions extends HasInner, HasManager { + /** + * @return the agentPoolVersions value. + */ + List agentPoolVersions(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem.java new file mode 100644 index 000000000000..8cebcf840f03 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem model. + */ +public class AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem { + /** + * Whether this version is the default agent pool version. + */ + @JsonProperty(value = "default") + private Boolean defaultProperty; + + /** + * Kubernetes version (major, minor, patch). + */ + @JsonProperty(value = "kubernetesVersion") + private String kubernetesVersion; + + /** + * Whether Kubernetes version is currently in preview. + */ + @JsonProperty(value = "isPreview") + private Boolean isPreview; + + /** + * Get whether this version is the default agent pool version. + * + * @return the defaultProperty value + */ + public Boolean defaultProperty() { + return this.defaultProperty; + } + + /** + * Set whether this version is the default agent pool version. + * + * @param defaultProperty the defaultProperty value to set + * @return the AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem object itself. + */ + public AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem withDefaultProperty(Boolean defaultProperty) { + this.defaultProperty = defaultProperty; + return this; + } + + /** + * Get kubernetes version (major, minor, patch). + * + * @return the kubernetesVersion value + */ + public String kubernetesVersion() { + return this.kubernetesVersion; + } + + /** + * Set kubernetes version (major, minor, patch). + * + * @param kubernetesVersion the kubernetesVersion value to set + * @return the AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem object itself. + */ + public AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem withKubernetesVersion(String kubernetesVersion) { + this.kubernetesVersion = kubernetesVersion; + return this; + } + + /** + * Get whether Kubernetes version is currently in preview. + * + * @return the isPreview value + */ + public Boolean isPreview() { + return this.isPreview; + } + + /** + * Set whether Kubernetes version is currently in preview. + * + * @param isPreview the isPreview value to set + * @return the AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem object itself. + */ + public AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem withIsPreview(Boolean isPreview) { + this.isPreview = isPreview; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/AgentPoolType.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/AgentPoolType.java new file mode 100644 index 000000000000..8ec122af9c1e --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/AgentPoolType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for AgentPoolType. + */ +public final class AgentPoolType extends ExpandableStringEnum { + /** Static value VirtualMachineScaleSets for AgentPoolType. */ + public static final AgentPoolType VIRTUAL_MACHINE_SCALE_SETS = fromString("VirtualMachineScaleSets"); + + /** Static value AvailabilitySet for AgentPoolType. */ + public static final AgentPoolType AVAILABILITY_SET = fromString("AvailabilitySet"); + + /** + * Creates or finds a AgentPoolType from its string representation. + * @param name a name to look for + * @return the corresponding AgentPoolType + */ + @JsonCreator + public static AgentPoolType fromString(String name) { + return fromString(name, AgentPoolType.class); + } + + /** + * @return known AgentPoolType values + */ + public static Collection values() { + return values(AgentPoolType.class); + } +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/AgentPoolUpgradeProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/AgentPoolUpgradeProfile.java new file mode 100644 index 000000000000..f72c825af7db --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/AgentPoolUpgradeProfile.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.ContainerServiceManager; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.AgentPoolUpgradeProfileInner; +import java.util.List; + +/** + * Type representing AgentPoolUpgradeProfile. + */ +public interface AgentPoolUpgradeProfile extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the kubernetesVersion value. + */ + String kubernetesVersion(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the osType value. + */ + OSType osType(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the upgrades value. + */ + List upgrades(); + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/AgentPoolUpgradeProfilePropertiesUpgradesItem.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/AgentPoolUpgradeProfilePropertiesUpgradesItem.java new file mode 100644 index 000000000000..2b9824130eaf --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/AgentPoolUpgradeProfilePropertiesUpgradesItem.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The AgentPoolUpgradeProfilePropertiesUpgradesItem model. + */ +public class AgentPoolUpgradeProfilePropertiesUpgradesItem { + /** + * Kubernetes version (major, minor, patch). + */ + @JsonProperty(value = "kubernetesVersion") + private String kubernetesVersion; + + /** + * Whether Kubernetes version is currently in preview. + */ + @JsonProperty(value = "isPreview") + private Boolean isPreview; + + /** + * Get kubernetes version (major, minor, patch). + * + * @return the kubernetesVersion value + */ + public String kubernetesVersion() { + return this.kubernetesVersion; + } + + /** + * Set kubernetes version (major, minor, patch). + * + * @param kubernetesVersion the kubernetesVersion value to set + * @return the AgentPoolUpgradeProfilePropertiesUpgradesItem object itself. + */ + public AgentPoolUpgradeProfilePropertiesUpgradesItem withKubernetesVersion(String kubernetesVersion) { + this.kubernetesVersion = kubernetesVersion; + return this; + } + + /** + * Get whether Kubernetes version is currently in preview. + * + * @return the isPreview value + */ + public Boolean isPreview() { + return this.isPreview; + } + + /** + * Set whether Kubernetes version is currently in preview. + * + * @param isPreview the isPreview value to set + * @return the AgentPoolUpgradeProfilePropertiesUpgradesItem object itself. + */ + public AgentPoolUpgradeProfilePropertiesUpgradesItem withIsPreview(Boolean isPreview) { + this.isPreview = isPreview; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/AgentPools.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/AgentPools.java new file mode 100644 index 000000000000..7428e17148c3 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/AgentPools.java @@ -0,0 +1,80 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.AgentPoolsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing AgentPools. + */ +public interface AgentPools extends SupportsCreating, HasInner { + /** + * Gets the agent pool. + * Gets the details of the agent pool by managed cluster and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String resourceName, String agentPoolName); + + /** + * Gets a list of agent pools in the specified managed cluster. + * Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String resourceName); + + /** + * Deletes an agent pool. + * Deletes the agent pool in the specified managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String resourceName, String agentPoolName); + + /** + * Gets upgrade profile for an agent pool. + * Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getUpgradeProfileAsync(String resourceGroupName, String resourceName, String agentPoolName); + + /** + * Gets a list of supported versions for the specified agent pool. + * Gets a list of supported versions for the specified agent pool. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAvailableAgentPoolVersionsAsync(String resourceGroupName, String resourceName, String agentPoolName); + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerService.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerService.java new file mode 100644 index 000000000000..2239d56b5e8e --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerService.java @@ -0,0 +1,270 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.ContainerServiceManager; +import java.util.List; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.ContainerServiceInner; + +/** + * Type representing ContainerService. + */ +public interface ContainerService extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the agentPoolProfiles value. + */ + List agentPoolProfiles(); + + /** + * @return the customProfile value. + */ + ContainerServiceCustomProfile customProfile(); + + /** + * @return the diagnosticsProfile value. + */ + ContainerServiceDiagnosticsProfile diagnosticsProfile(); + + /** + * @return the linuxProfile value. + */ + ContainerServiceLinuxProfile linuxProfile(); + + /** + * @return the masterProfile value. + */ + ContainerServiceMasterProfile masterProfile(); + + /** + * @return the orchestratorProfile value. + */ + ContainerServiceOrchestratorProfile orchestratorProfile(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the servicePrincipalProfile value. + */ + ContainerServiceServicePrincipalProfile servicePrincipalProfile(); + + /** + * @return the windowsProfile value. + */ + ContainerServiceWindowsProfile windowsProfile(); + + /** + * The entirety of the ContainerService definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithLinuxProfile, DefinitionStages.WithMasterProfile, DefinitionStages.WithOrchestratorProfile, DefinitionStages.WithCreate { + } + + /** + * Grouping of ContainerService definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ContainerService definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the ContainerService definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the containerservice definition allowing to specify LinuxProfile. + */ + interface WithLinuxProfile { + /** + * Specifies linuxProfile. + * @param linuxProfile Profile for Linux VMs in the container service cluster + * @return the next definition stage +*/ + WithMasterProfile withLinuxProfile(ContainerServiceLinuxProfile linuxProfile); + } + + /** + * The stage of the containerservice definition allowing to specify MasterProfile. + */ + interface WithMasterProfile { + /** + * Specifies masterProfile. + * @param masterProfile Profile for the container service master + * @return the next definition stage +*/ + WithOrchestratorProfile withMasterProfile(ContainerServiceMasterProfile masterProfile); + } + + /** + * The stage of the containerservice definition allowing to specify OrchestratorProfile. + */ + interface WithOrchestratorProfile { + /** + * Specifies orchestratorProfile. + * @param orchestratorProfile Profile for the container service orchestrator + * @return the next definition stage +*/ + WithCreate withOrchestratorProfile(ContainerServiceOrchestratorProfile orchestratorProfile); + } + + /** + * The stage of the containerservice definition allowing to specify AgentPoolProfiles. + */ + interface WithAgentPoolProfiles { + /** + * Specifies agentPoolProfiles. + * @param agentPoolProfiles Properties of the agent pool + * @return the next definition stage + */ + WithCreate withAgentPoolProfiles(List agentPoolProfiles); + } + + /** + * The stage of the containerservice definition allowing to specify CustomProfile. + */ + interface WithCustomProfile { + /** + * Specifies customProfile. + * @param customProfile Properties to configure a custom container service cluster + * @return the next definition stage + */ + WithCreate withCustomProfile(ContainerServiceCustomProfile customProfile); + } + + /** + * The stage of the containerservice definition allowing to specify DiagnosticsProfile. + */ + interface WithDiagnosticsProfile { + /** + * Specifies diagnosticsProfile. + * @param diagnosticsProfile Profile for diagnostics in the container service cluster + * @return the next definition stage + */ + WithCreate withDiagnosticsProfile(ContainerServiceDiagnosticsProfile diagnosticsProfile); + } + + /** + * The stage of the containerservice definition allowing to specify ServicePrincipalProfile. + */ + interface WithServicePrincipalProfile { + /** + * Specifies servicePrincipalProfile. + * @param servicePrincipalProfile Information about a service principal identity for the cluster to use for manipulating Azure APIs. Exact one of secret or keyVaultSecretRef need to be specified + * @return the next definition stage + */ + WithCreate withServicePrincipalProfile(ContainerServiceServicePrincipalProfile servicePrincipalProfile); + } + + /** + * The stage of the containerservice definition allowing to specify WindowsProfile. + */ + interface WithWindowsProfile { + /** + * Specifies windowsProfile. + * @param windowsProfile Profile for Windows VMs in the container service cluster + * @return the next definition stage + */ + WithCreate withWindowsProfile(ContainerServiceWindowsProfile windowsProfile); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithAgentPoolProfiles, DefinitionStages.WithCustomProfile, DefinitionStages.WithDiagnosticsProfile, DefinitionStages.WithServicePrincipalProfile, DefinitionStages.WithWindowsProfile { + } + } + /** + * The template for a ContainerService update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAgentPoolProfiles, UpdateStages.WithCustomProfile, UpdateStages.WithDiagnosticsProfile, UpdateStages.WithServicePrincipalProfile, UpdateStages.WithWindowsProfile { + } + + /** + * Grouping of ContainerService update stages. + */ + interface UpdateStages { + /** + * The stage of the containerservice update allowing to specify AgentPoolProfiles. + */ + interface WithAgentPoolProfiles { + /** + * Specifies agentPoolProfiles. + * @param agentPoolProfiles Properties of the agent pool + * @return the next update stage + */ + Update withAgentPoolProfiles(List agentPoolProfiles); + } + + /** + * The stage of the containerservice update allowing to specify CustomProfile. + */ + interface WithCustomProfile { + /** + * Specifies customProfile. + * @param customProfile Properties to configure a custom container service cluster + * @return the next update stage + */ + Update withCustomProfile(ContainerServiceCustomProfile customProfile); + } + + /** + * The stage of the containerservice update allowing to specify DiagnosticsProfile. + */ + interface WithDiagnosticsProfile { + /** + * Specifies diagnosticsProfile. + * @param diagnosticsProfile Profile for diagnostics in the container service cluster + * @return the next update stage + */ + Update withDiagnosticsProfile(ContainerServiceDiagnosticsProfile diagnosticsProfile); + } + + /** + * The stage of the containerservice update allowing to specify ServicePrincipalProfile. + */ + interface WithServicePrincipalProfile { + /** + * Specifies servicePrincipalProfile. + * @param servicePrincipalProfile Information about a service principal identity for the cluster to use for manipulating Azure APIs. Exact one of secret or keyVaultSecretRef need to be specified + * @return the next update stage + */ + Update withServicePrincipalProfile(ContainerServiceServicePrincipalProfile servicePrincipalProfile); + } + + /** + * The stage of the containerservice update allowing to specify WindowsProfile. + */ + interface WithWindowsProfile { + /** + * Specifies windowsProfile. + * @param windowsProfile Profile for Windows VMs in the container service cluster + * @return the next update stage + */ + Update withWindowsProfile(ContainerServiceWindowsProfile windowsProfile); + } + + } +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceAgentPoolProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceAgentPoolProfile.java new file mode 100644 index 000000000000..458d166b2458 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceAgentPoolProfile.java @@ -0,0 +1,327 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Profile for the container service agent pool. + */ +public class ContainerServiceAgentPoolProfile { + /** + * Unique name of the agent pool profile in the context of the subscription + * and resource group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Number of agents (VMs) to host docker containers. Allowed values must be + * in the range of 1 to 100 (inclusive). The default value is 1. + */ + @JsonProperty(value = "count") + private Integer count; + + /** + * Size of agent VMs. Possible values include: 'Standard_A1', + * 'Standard_A10', 'Standard_A11', 'Standard_A1_v2', 'Standard_A2', + * 'Standard_A2_v2', 'Standard_A2m_v2', 'Standard_A3', 'Standard_A4', + * 'Standard_A4_v2', 'Standard_A4m_v2', 'Standard_A5', 'Standard_A6', + * 'Standard_A7', 'Standard_A8', 'Standard_A8_v2', 'Standard_A8m_v2', + * 'Standard_A9', 'Standard_B2ms', 'Standard_B2s', 'Standard_B4ms', + * 'Standard_B8ms', 'Standard_D1', 'Standard_D11', 'Standard_D11_v2', + * 'Standard_D11_v2_Promo', 'Standard_D12', 'Standard_D12_v2', + * 'Standard_D12_v2_Promo', 'Standard_D13', 'Standard_D13_v2', + * 'Standard_D13_v2_Promo', 'Standard_D14', 'Standard_D14_v2', + * 'Standard_D14_v2_Promo', 'Standard_D15_v2', 'Standard_D16_v3', + * 'Standard_D16s_v3', 'Standard_D1_v2', 'Standard_D2', 'Standard_D2_v2', + * 'Standard_D2_v2_Promo', 'Standard_D2_v3', 'Standard_D2s_v3', + * 'Standard_D3', 'Standard_D32_v3', 'Standard_D32s_v3', 'Standard_D3_v2', + * 'Standard_D3_v2_Promo', 'Standard_D4', 'Standard_D4_v2', + * 'Standard_D4_v2_Promo', 'Standard_D4_v3', 'Standard_D4s_v3', + * 'Standard_D5_v2', 'Standard_D5_v2_Promo', 'Standard_D64_v3', + * 'Standard_D64s_v3', 'Standard_D8_v3', 'Standard_D8s_v3', 'Standard_DS1', + * 'Standard_DS11', 'Standard_DS11_v2', 'Standard_DS11_v2_Promo', + * 'Standard_DS12', 'Standard_DS12_v2', 'Standard_DS12_v2_Promo', + * 'Standard_DS13', 'Standard_DS13-2_v2', 'Standard_DS13-4_v2', + * 'Standard_DS13_v2', 'Standard_DS13_v2_Promo', 'Standard_DS14', + * 'Standard_DS14-4_v2', 'Standard_DS14-8_v2', 'Standard_DS14_v2', + * 'Standard_DS14_v2_Promo', 'Standard_DS15_v2', 'Standard_DS1_v2', + * 'Standard_DS2', 'Standard_DS2_v2', 'Standard_DS2_v2_Promo', + * 'Standard_DS3', 'Standard_DS3_v2', 'Standard_DS3_v2_Promo', + * 'Standard_DS4', 'Standard_DS4_v2', 'Standard_DS4_v2_Promo', + * 'Standard_DS5_v2', 'Standard_DS5_v2_Promo', 'Standard_E16_v3', + * 'Standard_E16s_v3', 'Standard_E2_v3', 'Standard_E2s_v3', + * 'Standard_E32-16s_v3', 'Standard_E32-8s_v3', 'Standard_E32_v3', + * 'Standard_E32s_v3', 'Standard_E4_v3', 'Standard_E4s_v3', + * 'Standard_E64-16s_v3', 'Standard_E64-32s_v3', 'Standard_E64_v3', + * 'Standard_E64s_v3', 'Standard_E8_v3', 'Standard_E8s_v3', 'Standard_F1', + * 'Standard_F16', 'Standard_F16s', 'Standard_F16s_v2', 'Standard_F1s', + * 'Standard_F2', 'Standard_F2s', 'Standard_F2s_v2', 'Standard_F32s_v2', + * 'Standard_F4', 'Standard_F4s', 'Standard_F4s_v2', 'Standard_F64s_v2', + * 'Standard_F72s_v2', 'Standard_F8', 'Standard_F8s', 'Standard_F8s_v2', + * 'Standard_G1', 'Standard_G2', 'Standard_G3', 'Standard_G4', + * 'Standard_G5', 'Standard_GS1', 'Standard_GS2', 'Standard_GS3', + * 'Standard_GS4', 'Standard_GS4-4', 'Standard_GS4-8', 'Standard_GS5', + * 'Standard_GS5-16', 'Standard_GS5-8', 'Standard_H16', 'Standard_H16m', + * 'Standard_H16mr', 'Standard_H16r', 'Standard_H8', 'Standard_H8m', + * 'Standard_L16s', 'Standard_L32s', 'Standard_L4s', 'Standard_L8s', + * 'Standard_M128-32ms', 'Standard_M128-64ms', 'Standard_M128ms', + * 'Standard_M128s', 'Standard_M64-16ms', 'Standard_M64-32ms', + * 'Standard_M64ms', 'Standard_M64s', 'Standard_NC12', 'Standard_NC12s_v2', + * 'Standard_NC12s_v3', 'Standard_NC24', 'Standard_NC24r', + * 'Standard_NC24rs_v2', 'Standard_NC24rs_v3', 'Standard_NC24s_v2', + * 'Standard_NC24s_v3', 'Standard_NC6', 'Standard_NC6s_v2', + * 'Standard_NC6s_v3', 'Standard_ND12s', 'Standard_ND24rs', + * 'Standard_ND24s', 'Standard_ND6s', 'Standard_NV12', 'Standard_NV24', + * 'Standard_NV6'. + */ + @JsonProperty(value = "vmSize", required = true) + private ContainerServiceVMSizeTypes vmSize; + + /** + * OS Disk Size in GB to be used to specify the disk size for every machine + * in this master/agent pool. If you specify 0, it will apply the default + * osDisk size according to the vmSize specified. + */ + @JsonProperty(value = "osDiskSizeGB") + private Integer osDiskSizeGB; + + /** + * DNS prefix to be used to create the FQDN for the agent pool. + */ + @JsonProperty(value = "dnsPrefix") + private String dnsPrefix; + + /** + * FQDN for the agent pool. + */ + @JsonProperty(value = "fqdn", access = JsonProperty.Access.WRITE_ONLY) + private String fqdn; + + /** + * Ports number array used to expose on this agent pool. The default opened + * ports are different based on your choice of orchestrator. + */ + @JsonProperty(value = "ports") + private List ports; + + /** + * Storage profile specifies what kind of storage used. Choose from + * StorageAccount and ManagedDisks. Leave it empty, we will choose for you + * based on the orchestrator choice. Possible values include: + * 'StorageAccount', 'ManagedDisks'. + */ + @JsonProperty(value = "storageProfile") + private ContainerServiceStorageProfileTypes storageProfile; + + /** + * VNet SubnetID specifies the VNet's subnet identifier. + */ + @JsonProperty(value = "vnetSubnetID") + private String vnetSubnetID; + + /** + * OsType to be used to specify os type. Choose from Linux and Windows. + * Default to Linux. Possible values include: 'Linux', 'Windows'. + */ + @JsonProperty(value = "osType") + private OSType osType; + + /** + * Get unique name of the agent pool profile in the context of the subscription and resource group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set unique name of the agent pool profile in the context of the subscription and resource group. + * + * @param name the name value to set + * @return the ContainerServiceAgentPoolProfile object itself. + */ + public ContainerServiceAgentPoolProfile withName(String name) { + this.name = name; + return this; + } + + /** + * Get number of agents (VMs) to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. + * + * @return the count value + */ + public Integer count() { + return this.count; + } + + /** + * Set number of agents (VMs) to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. + * + * @param count the count value to set + * @return the ContainerServiceAgentPoolProfile object itself. + */ + public ContainerServiceAgentPoolProfile withCount(Integer count) { + this.count = count; + return this; + } + + /** + * Get size of agent VMs. Possible values include: 'Standard_A1', 'Standard_A10', 'Standard_A11', 'Standard_A1_v2', 'Standard_A2', 'Standard_A2_v2', 'Standard_A2m_v2', 'Standard_A3', 'Standard_A4', 'Standard_A4_v2', 'Standard_A4m_v2', 'Standard_A5', 'Standard_A6', 'Standard_A7', 'Standard_A8', 'Standard_A8_v2', 'Standard_A8m_v2', 'Standard_A9', 'Standard_B2ms', 'Standard_B2s', 'Standard_B4ms', 'Standard_B8ms', 'Standard_D1', 'Standard_D11', 'Standard_D11_v2', 'Standard_D11_v2_Promo', 'Standard_D12', 'Standard_D12_v2', 'Standard_D12_v2_Promo', 'Standard_D13', 'Standard_D13_v2', 'Standard_D13_v2_Promo', 'Standard_D14', 'Standard_D14_v2', 'Standard_D14_v2_Promo', 'Standard_D15_v2', 'Standard_D16_v3', 'Standard_D16s_v3', 'Standard_D1_v2', 'Standard_D2', 'Standard_D2_v2', 'Standard_D2_v2_Promo', 'Standard_D2_v3', 'Standard_D2s_v3', 'Standard_D3', 'Standard_D32_v3', 'Standard_D32s_v3', 'Standard_D3_v2', 'Standard_D3_v2_Promo', 'Standard_D4', 'Standard_D4_v2', 'Standard_D4_v2_Promo', 'Standard_D4_v3', 'Standard_D4s_v3', 'Standard_D5_v2', 'Standard_D5_v2_Promo', 'Standard_D64_v3', 'Standard_D64s_v3', 'Standard_D8_v3', 'Standard_D8s_v3', 'Standard_DS1', 'Standard_DS11', 'Standard_DS11_v2', 'Standard_DS11_v2_Promo', 'Standard_DS12', 'Standard_DS12_v2', 'Standard_DS12_v2_Promo', 'Standard_DS13', 'Standard_DS13-2_v2', 'Standard_DS13-4_v2', 'Standard_DS13_v2', 'Standard_DS13_v2_Promo', 'Standard_DS14', 'Standard_DS14-4_v2', 'Standard_DS14-8_v2', 'Standard_DS14_v2', 'Standard_DS14_v2_Promo', 'Standard_DS15_v2', 'Standard_DS1_v2', 'Standard_DS2', 'Standard_DS2_v2', 'Standard_DS2_v2_Promo', 'Standard_DS3', 'Standard_DS3_v2', 'Standard_DS3_v2_Promo', 'Standard_DS4', 'Standard_DS4_v2', 'Standard_DS4_v2_Promo', 'Standard_DS5_v2', 'Standard_DS5_v2_Promo', 'Standard_E16_v3', 'Standard_E16s_v3', 'Standard_E2_v3', 'Standard_E2s_v3', 'Standard_E32-16s_v3', 'Standard_E32-8s_v3', 'Standard_E32_v3', 'Standard_E32s_v3', 'Standard_E4_v3', 'Standard_E4s_v3', 'Standard_E64-16s_v3', 'Standard_E64-32s_v3', 'Standard_E64_v3', 'Standard_E64s_v3', 'Standard_E8_v3', 'Standard_E8s_v3', 'Standard_F1', 'Standard_F16', 'Standard_F16s', 'Standard_F16s_v2', 'Standard_F1s', 'Standard_F2', 'Standard_F2s', 'Standard_F2s_v2', 'Standard_F32s_v2', 'Standard_F4', 'Standard_F4s', 'Standard_F4s_v2', 'Standard_F64s_v2', 'Standard_F72s_v2', 'Standard_F8', 'Standard_F8s', 'Standard_F8s_v2', 'Standard_G1', 'Standard_G2', 'Standard_G3', 'Standard_G4', 'Standard_G5', 'Standard_GS1', 'Standard_GS2', 'Standard_GS3', 'Standard_GS4', 'Standard_GS4-4', 'Standard_GS4-8', 'Standard_GS5', 'Standard_GS5-16', 'Standard_GS5-8', 'Standard_H16', 'Standard_H16m', 'Standard_H16mr', 'Standard_H16r', 'Standard_H8', 'Standard_H8m', 'Standard_L16s', 'Standard_L32s', 'Standard_L4s', 'Standard_L8s', 'Standard_M128-32ms', 'Standard_M128-64ms', 'Standard_M128ms', 'Standard_M128s', 'Standard_M64-16ms', 'Standard_M64-32ms', 'Standard_M64ms', 'Standard_M64s', 'Standard_NC12', 'Standard_NC12s_v2', 'Standard_NC12s_v3', 'Standard_NC24', 'Standard_NC24r', 'Standard_NC24rs_v2', 'Standard_NC24rs_v3', 'Standard_NC24s_v2', 'Standard_NC24s_v3', 'Standard_NC6', 'Standard_NC6s_v2', 'Standard_NC6s_v3', 'Standard_ND12s', 'Standard_ND24rs', 'Standard_ND24s', 'Standard_ND6s', 'Standard_NV12', 'Standard_NV24', 'Standard_NV6'. + * + * @return the vmSize value + */ + public ContainerServiceVMSizeTypes vmSize() { + return this.vmSize; + } + + /** + * Set size of agent VMs. Possible values include: 'Standard_A1', 'Standard_A10', 'Standard_A11', 'Standard_A1_v2', 'Standard_A2', 'Standard_A2_v2', 'Standard_A2m_v2', 'Standard_A3', 'Standard_A4', 'Standard_A4_v2', 'Standard_A4m_v2', 'Standard_A5', 'Standard_A6', 'Standard_A7', 'Standard_A8', 'Standard_A8_v2', 'Standard_A8m_v2', 'Standard_A9', 'Standard_B2ms', 'Standard_B2s', 'Standard_B4ms', 'Standard_B8ms', 'Standard_D1', 'Standard_D11', 'Standard_D11_v2', 'Standard_D11_v2_Promo', 'Standard_D12', 'Standard_D12_v2', 'Standard_D12_v2_Promo', 'Standard_D13', 'Standard_D13_v2', 'Standard_D13_v2_Promo', 'Standard_D14', 'Standard_D14_v2', 'Standard_D14_v2_Promo', 'Standard_D15_v2', 'Standard_D16_v3', 'Standard_D16s_v3', 'Standard_D1_v2', 'Standard_D2', 'Standard_D2_v2', 'Standard_D2_v2_Promo', 'Standard_D2_v3', 'Standard_D2s_v3', 'Standard_D3', 'Standard_D32_v3', 'Standard_D32s_v3', 'Standard_D3_v2', 'Standard_D3_v2_Promo', 'Standard_D4', 'Standard_D4_v2', 'Standard_D4_v2_Promo', 'Standard_D4_v3', 'Standard_D4s_v3', 'Standard_D5_v2', 'Standard_D5_v2_Promo', 'Standard_D64_v3', 'Standard_D64s_v3', 'Standard_D8_v3', 'Standard_D8s_v3', 'Standard_DS1', 'Standard_DS11', 'Standard_DS11_v2', 'Standard_DS11_v2_Promo', 'Standard_DS12', 'Standard_DS12_v2', 'Standard_DS12_v2_Promo', 'Standard_DS13', 'Standard_DS13-2_v2', 'Standard_DS13-4_v2', 'Standard_DS13_v2', 'Standard_DS13_v2_Promo', 'Standard_DS14', 'Standard_DS14-4_v2', 'Standard_DS14-8_v2', 'Standard_DS14_v2', 'Standard_DS14_v2_Promo', 'Standard_DS15_v2', 'Standard_DS1_v2', 'Standard_DS2', 'Standard_DS2_v2', 'Standard_DS2_v2_Promo', 'Standard_DS3', 'Standard_DS3_v2', 'Standard_DS3_v2_Promo', 'Standard_DS4', 'Standard_DS4_v2', 'Standard_DS4_v2_Promo', 'Standard_DS5_v2', 'Standard_DS5_v2_Promo', 'Standard_E16_v3', 'Standard_E16s_v3', 'Standard_E2_v3', 'Standard_E2s_v3', 'Standard_E32-16s_v3', 'Standard_E32-8s_v3', 'Standard_E32_v3', 'Standard_E32s_v3', 'Standard_E4_v3', 'Standard_E4s_v3', 'Standard_E64-16s_v3', 'Standard_E64-32s_v3', 'Standard_E64_v3', 'Standard_E64s_v3', 'Standard_E8_v3', 'Standard_E8s_v3', 'Standard_F1', 'Standard_F16', 'Standard_F16s', 'Standard_F16s_v2', 'Standard_F1s', 'Standard_F2', 'Standard_F2s', 'Standard_F2s_v2', 'Standard_F32s_v2', 'Standard_F4', 'Standard_F4s', 'Standard_F4s_v2', 'Standard_F64s_v2', 'Standard_F72s_v2', 'Standard_F8', 'Standard_F8s', 'Standard_F8s_v2', 'Standard_G1', 'Standard_G2', 'Standard_G3', 'Standard_G4', 'Standard_G5', 'Standard_GS1', 'Standard_GS2', 'Standard_GS3', 'Standard_GS4', 'Standard_GS4-4', 'Standard_GS4-8', 'Standard_GS5', 'Standard_GS5-16', 'Standard_GS5-8', 'Standard_H16', 'Standard_H16m', 'Standard_H16mr', 'Standard_H16r', 'Standard_H8', 'Standard_H8m', 'Standard_L16s', 'Standard_L32s', 'Standard_L4s', 'Standard_L8s', 'Standard_M128-32ms', 'Standard_M128-64ms', 'Standard_M128ms', 'Standard_M128s', 'Standard_M64-16ms', 'Standard_M64-32ms', 'Standard_M64ms', 'Standard_M64s', 'Standard_NC12', 'Standard_NC12s_v2', 'Standard_NC12s_v3', 'Standard_NC24', 'Standard_NC24r', 'Standard_NC24rs_v2', 'Standard_NC24rs_v3', 'Standard_NC24s_v2', 'Standard_NC24s_v3', 'Standard_NC6', 'Standard_NC6s_v2', 'Standard_NC6s_v3', 'Standard_ND12s', 'Standard_ND24rs', 'Standard_ND24s', 'Standard_ND6s', 'Standard_NV12', 'Standard_NV24', 'Standard_NV6'. + * + * @param vmSize the vmSize value to set + * @return the ContainerServiceAgentPoolProfile object itself. + */ + public ContainerServiceAgentPoolProfile withVmSize(ContainerServiceVMSizeTypes vmSize) { + this.vmSize = vmSize; + return this; + } + + /** + * Get oS Disk Size in GB to be used to specify the disk size for every machine in this master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. + * + * @return the osDiskSizeGB value + */ + public Integer osDiskSizeGB() { + return this.osDiskSizeGB; + } + + /** + * Set oS Disk Size in GB to be used to specify the disk size for every machine in this master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. + * + * @param osDiskSizeGB the osDiskSizeGB value to set + * @return the ContainerServiceAgentPoolProfile object itself. + */ + public ContainerServiceAgentPoolProfile withOsDiskSizeGB(Integer osDiskSizeGB) { + this.osDiskSizeGB = osDiskSizeGB; + return this; + } + + /** + * Get dNS prefix to be used to create the FQDN for the agent pool. + * + * @return the dnsPrefix value + */ + public String dnsPrefix() { + return this.dnsPrefix; + } + + /** + * Set dNS prefix to be used to create the FQDN for the agent pool. + * + * @param dnsPrefix the dnsPrefix value to set + * @return the ContainerServiceAgentPoolProfile object itself. + */ + public ContainerServiceAgentPoolProfile withDnsPrefix(String dnsPrefix) { + this.dnsPrefix = dnsPrefix; + return this; + } + + /** + * Get fQDN for the agent pool. + * + * @return the fqdn value + */ + public String fqdn() { + return this.fqdn; + } + + /** + * Get ports number array used to expose on this agent pool. The default opened ports are different based on your choice of orchestrator. + * + * @return the ports value + */ + public List ports() { + return this.ports; + } + + /** + * Set ports number array used to expose on this agent pool. The default opened ports are different based on your choice of orchestrator. + * + * @param ports the ports value to set + * @return the ContainerServiceAgentPoolProfile object itself. + */ + public ContainerServiceAgentPoolProfile withPorts(List ports) { + this.ports = ports; + return this; + } + + /** + * Get storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. Possible values include: 'StorageAccount', 'ManagedDisks'. + * + * @return the storageProfile value + */ + public ContainerServiceStorageProfileTypes storageProfile() { + return this.storageProfile; + } + + /** + * Set storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. Possible values include: 'StorageAccount', 'ManagedDisks'. + * + * @param storageProfile the storageProfile value to set + * @return the ContainerServiceAgentPoolProfile object itself. + */ + public ContainerServiceAgentPoolProfile withStorageProfile(ContainerServiceStorageProfileTypes storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Get vNet SubnetID specifies the VNet's subnet identifier. + * + * @return the vnetSubnetID value + */ + public String vnetSubnetID() { + return this.vnetSubnetID; + } + + /** + * Set vNet SubnetID specifies the VNet's subnet identifier. + * + * @param vnetSubnetID the vnetSubnetID value to set + * @return the ContainerServiceAgentPoolProfile object itself. + */ + public ContainerServiceAgentPoolProfile withVnetSubnetID(String vnetSubnetID) { + this.vnetSubnetID = vnetSubnetID; + return this; + } + + /** + * Get osType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: 'Linux', 'Windows'. + * + * @return the osType value + */ + public OSType osType() { + return this.osType; + } + + /** + * Set osType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: 'Linux', 'Windows'. + * + * @param osType the osType value to set + * @return the ContainerServiceAgentPoolProfile object itself. + */ + public ContainerServiceAgentPoolProfile withOsType(OSType osType) { + this.osType = osType; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceCustomProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceCustomProfile.java new file mode 100644 index 000000000000..5166dd87aa88 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceCustomProfile.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties to configure a custom container service cluster. + */ +public class ContainerServiceCustomProfile { + /** + * The name of the custom orchestrator to use. + */ + @JsonProperty(value = "orchestrator", required = true) + private String orchestrator; + + /** + * Get the name of the custom orchestrator to use. + * + * @return the orchestrator value + */ + public String orchestrator() { + return this.orchestrator; + } + + /** + * Set the name of the custom orchestrator to use. + * + * @param orchestrator the orchestrator value to set + * @return the ContainerServiceCustomProfile object itself. + */ + public ContainerServiceCustomProfile withOrchestrator(String orchestrator) { + this.orchestrator = orchestrator; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceDiagnosticsProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceDiagnosticsProfile.java new file mode 100644 index 000000000000..bfe6b2dc0a74 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceDiagnosticsProfile.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Profile for diagnostics on the container service cluster. + */ +public class ContainerServiceDiagnosticsProfile { + /** + * Profile for diagnostics on the container service VMs. + */ + @JsonProperty(value = "vmDiagnostics", required = true) + private ContainerServiceVMDiagnostics vmDiagnostics; + + /** + * Get profile for diagnostics on the container service VMs. + * + * @return the vmDiagnostics value + */ + public ContainerServiceVMDiagnostics vmDiagnostics() { + return this.vmDiagnostics; + } + + /** + * Set profile for diagnostics on the container service VMs. + * + * @param vmDiagnostics the vmDiagnostics value to set + * @return the ContainerServiceDiagnosticsProfile object itself. + */ + public ContainerServiceDiagnosticsProfile withVmDiagnostics(ContainerServiceVMDiagnostics vmDiagnostics) { + this.vmDiagnostics = vmDiagnostics; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceLinuxProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceLinuxProfile.java new file mode 100644 index 000000000000..4eb352b2e916 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceLinuxProfile.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Profile for Linux VMs in the container service cluster. + */ +public class ContainerServiceLinuxProfile { + /** + * The administrator username to use for Linux VMs. + */ + @JsonProperty(value = "adminUsername", required = true) + private String adminUsername; + + /** + * SSH configuration for Linux-based VMs running on Azure. + */ + @JsonProperty(value = "ssh", required = true) + private ContainerServiceSshConfiguration ssh; + + /** + * Get the administrator username to use for Linux VMs. + * + * @return the adminUsername value + */ + public String adminUsername() { + return this.adminUsername; + } + + /** + * Set the administrator username to use for Linux VMs. + * + * @param adminUsername the adminUsername value to set + * @return the ContainerServiceLinuxProfile object itself. + */ + public ContainerServiceLinuxProfile withAdminUsername(String adminUsername) { + this.adminUsername = adminUsername; + return this; + } + + /** + * Get sSH configuration for Linux-based VMs running on Azure. + * + * @return the ssh value + */ + public ContainerServiceSshConfiguration ssh() { + return this.ssh; + } + + /** + * Set sSH configuration for Linux-based VMs running on Azure. + * + * @param ssh the ssh value to set + * @return the ContainerServiceLinuxProfile object itself. + */ + public ContainerServiceLinuxProfile withSsh(ContainerServiceSshConfiguration ssh) { + this.ssh = ssh; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceMasterProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceMasterProfile.java new file mode 100644 index 000000000000..e249782148dc --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceMasterProfile.java @@ -0,0 +1,271 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Profile for the container service master. + */ +public class ContainerServiceMasterProfile { + /** + * Number of masters (VMs) in the container service cluster. Allowed values + * are 1, 3, and 5. The default value is 1. + */ + @JsonProperty(value = "count") + private Integer count; + + /** + * DNS prefix to be used to create the FQDN for the master pool. + */ + @JsonProperty(value = "dnsPrefix", required = true) + private String dnsPrefix; + + /** + * Size of agent VMs. Possible values include: 'Standard_A1', + * 'Standard_A10', 'Standard_A11', 'Standard_A1_v2', 'Standard_A2', + * 'Standard_A2_v2', 'Standard_A2m_v2', 'Standard_A3', 'Standard_A4', + * 'Standard_A4_v2', 'Standard_A4m_v2', 'Standard_A5', 'Standard_A6', + * 'Standard_A7', 'Standard_A8', 'Standard_A8_v2', 'Standard_A8m_v2', + * 'Standard_A9', 'Standard_B2ms', 'Standard_B2s', 'Standard_B4ms', + * 'Standard_B8ms', 'Standard_D1', 'Standard_D11', 'Standard_D11_v2', + * 'Standard_D11_v2_Promo', 'Standard_D12', 'Standard_D12_v2', + * 'Standard_D12_v2_Promo', 'Standard_D13', 'Standard_D13_v2', + * 'Standard_D13_v2_Promo', 'Standard_D14', 'Standard_D14_v2', + * 'Standard_D14_v2_Promo', 'Standard_D15_v2', 'Standard_D16_v3', + * 'Standard_D16s_v3', 'Standard_D1_v2', 'Standard_D2', 'Standard_D2_v2', + * 'Standard_D2_v2_Promo', 'Standard_D2_v3', 'Standard_D2s_v3', + * 'Standard_D3', 'Standard_D32_v3', 'Standard_D32s_v3', 'Standard_D3_v2', + * 'Standard_D3_v2_Promo', 'Standard_D4', 'Standard_D4_v2', + * 'Standard_D4_v2_Promo', 'Standard_D4_v3', 'Standard_D4s_v3', + * 'Standard_D5_v2', 'Standard_D5_v2_Promo', 'Standard_D64_v3', + * 'Standard_D64s_v3', 'Standard_D8_v3', 'Standard_D8s_v3', 'Standard_DS1', + * 'Standard_DS11', 'Standard_DS11_v2', 'Standard_DS11_v2_Promo', + * 'Standard_DS12', 'Standard_DS12_v2', 'Standard_DS12_v2_Promo', + * 'Standard_DS13', 'Standard_DS13-2_v2', 'Standard_DS13-4_v2', + * 'Standard_DS13_v2', 'Standard_DS13_v2_Promo', 'Standard_DS14', + * 'Standard_DS14-4_v2', 'Standard_DS14-8_v2', 'Standard_DS14_v2', + * 'Standard_DS14_v2_Promo', 'Standard_DS15_v2', 'Standard_DS1_v2', + * 'Standard_DS2', 'Standard_DS2_v2', 'Standard_DS2_v2_Promo', + * 'Standard_DS3', 'Standard_DS3_v2', 'Standard_DS3_v2_Promo', + * 'Standard_DS4', 'Standard_DS4_v2', 'Standard_DS4_v2_Promo', + * 'Standard_DS5_v2', 'Standard_DS5_v2_Promo', 'Standard_E16_v3', + * 'Standard_E16s_v3', 'Standard_E2_v3', 'Standard_E2s_v3', + * 'Standard_E32-16s_v3', 'Standard_E32-8s_v3', 'Standard_E32_v3', + * 'Standard_E32s_v3', 'Standard_E4_v3', 'Standard_E4s_v3', + * 'Standard_E64-16s_v3', 'Standard_E64-32s_v3', 'Standard_E64_v3', + * 'Standard_E64s_v3', 'Standard_E8_v3', 'Standard_E8s_v3', 'Standard_F1', + * 'Standard_F16', 'Standard_F16s', 'Standard_F16s_v2', 'Standard_F1s', + * 'Standard_F2', 'Standard_F2s', 'Standard_F2s_v2', 'Standard_F32s_v2', + * 'Standard_F4', 'Standard_F4s', 'Standard_F4s_v2', 'Standard_F64s_v2', + * 'Standard_F72s_v2', 'Standard_F8', 'Standard_F8s', 'Standard_F8s_v2', + * 'Standard_G1', 'Standard_G2', 'Standard_G3', 'Standard_G4', + * 'Standard_G5', 'Standard_GS1', 'Standard_GS2', 'Standard_GS3', + * 'Standard_GS4', 'Standard_GS4-4', 'Standard_GS4-8', 'Standard_GS5', + * 'Standard_GS5-16', 'Standard_GS5-8', 'Standard_H16', 'Standard_H16m', + * 'Standard_H16mr', 'Standard_H16r', 'Standard_H8', 'Standard_H8m', + * 'Standard_L16s', 'Standard_L32s', 'Standard_L4s', 'Standard_L8s', + * 'Standard_M128-32ms', 'Standard_M128-64ms', 'Standard_M128ms', + * 'Standard_M128s', 'Standard_M64-16ms', 'Standard_M64-32ms', + * 'Standard_M64ms', 'Standard_M64s', 'Standard_NC12', 'Standard_NC12s_v2', + * 'Standard_NC12s_v3', 'Standard_NC24', 'Standard_NC24r', + * 'Standard_NC24rs_v2', 'Standard_NC24rs_v3', 'Standard_NC24s_v2', + * 'Standard_NC24s_v3', 'Standard_NC6', 'Standard_NC6s_v2', + * 'Standard_NC6s_v3', 'Standard_ND12s', 'Standard_ND24rs', + * 'Standard_ND24s', 'Standard_ND6s', 'Standard_NV12', 'Standard_NV24', + * 'Standard_NV6'. + */ + @JsonProperty(value = "vmSize", required = true) + private ContainerServiceVMSizeTypes vmSize; + + /** + * OS Disk Size in GB to be used to specify the disk size for every machine + * in this master/agent pool. If you specify 0, it will apply the default + * osDisk size according to the vmSize specified. + */ + @JsonProperty(value = "osDiskSizeGB") + private Integer osDiskSizeGB; + + /** + * VNet SubnetID specifies the VNet's subnet identifier. + */ + @JsonProperty(value = "vnetSubnetID") + private String vnetSubnetID; + + /** + * FirstConsecutiveStaticIP used to specify the first static ip of masters. + */ + @JsonProperty(value = "firstConsecutiveStaticIP") + private String firstConsecutiveStaticIP; + + /** + * Storage profile specifies what kind of storage used. Choose from + * StorageAccount and ManagedDisks. Leave it empty, we will choose for you + * based on the orchestrator choice. Possible values include: + * 'StorageAccount', 'ManagedDisks'. + */ + @JsonProperty(value = "storageProfile") + private ContainerServiceStorageProfileTypes storageProfile; + + /** + * FQDN for the master pool. + */ + @JsonProperty(value = "fqdn", access = JsonProperty.Access.WRITE_ONLY) + private String fqdn; + + /** + * Get number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. + * + * @return the count value + */ + public Integer count() { + return this.count; + } + + /** + * Set number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. + * + * @param count the count value to set + * @return the ContainerServiceMasterProfile object itself. + */ + public ContainerServiceMasterProfile withCount(Integer count) { + this.count = count; + return this; + } + + /** + * Get dNS prefix to be used to create the FQDN for the master pool. + * + * @return the dnsPrefix value + */ + public String dnsPrefix() { + return this.dnsPrefix; + } + + /** + * Set dNS prefix to be used to create the FQDN for the master pool. + * + * @param dnsPrefix the dnsPrefix value to set + * @return the ContainerServiceMasterProfile object itself. + */ + public ContainerServiceMasterProfile withDnsPrefix(String dnsPrefix) { + this.dnsPrefix = dnsPrefix; + return this; + } + + /** + * Get size of agent VMs. Possible values include: 'Standard_A1', 'Standard_A10', 'Standard_A11', 'Standard_A1_v2', 'Standard_A2', 'Standard_A2_v2', 'Standard_A2m_v2', 'Standard_A3', 'Standard_A4', 'Standard_A4_v2', 'Standard_A4m_v2', 'Standard_A5', 'Standard_A6', 'Standard_A7', 'Standard_A8', 'Standard_A8_v2', 'Standard_A8m_v2', 'Standard_A9', 'Standard_B2ms', 'Standard_B2s', 'Standard_B4ms', 'Standard_B8ms', 'Standard_D1', 'Standard_D11', 'Standard_D11_v2', 'Standard_D11_v2_Promo', 'Standard_D12', 'Standard_D12_v2', 'Standard_D12_v2_Promo', 'Standard_D13', 'Standard_D13_v2', 'Standard_D13_v2_Promo', 'Standard_D14', 'Standard_D14_v2', 'Standard_D14_v2_Promo', 'Standard_D15_v2', 'Standard_D16_v3', 'Standard_D16s_v3', 'Standard_D1_v2', 'Standard_D2', 'Standard_D2_v2', 'Standard_D2_v2_Promo', 'Standard_D2_v3', 'Standard_D2s_v3', 'Standard_D3', 'Standard_D32_v3', 'Standard_D32s_v3', 'Standard_D3_v2', 'Standard_D3_v2_Promo', 'Standard_D4', 'Standard_D4_v2', 'Standard_D4_v2_Promo', 'Standard_D4_v3', 'Standard_D4s_v3', 'Standard_D5_v2', 'Standard_D5_v2_Promo', 'Standard_D64_v3', 'Standard_D64s_v3', 'Standard_D8_v3', 'Standard_D8s_v3', 'Standard_DS1', 'Standard_DS11', 'Standard_DS11_v2', 'Standard_DS11_v2_Promo', 'Standard_DS12', 'Standard_DS12_v2', 'Standard_DS12_v2_Promo', 'Standard_DS13', 'Standard_DS13-2_v2', 'Standard_DS13-4_v2', 'Standard_DS13_v2', 'Standard_DS13_v2_Promo', 'Standard_DS14', 'Standard_DS14-4_v2', 'Standard_DS14-8_v2', 'Standard_DS14_v2', 'Standard_DS14_v2_Promo', 'Standard_DS15_v2', 'Standard_DS1_v2', 'Standard_DS2', 'Standard_DS2_v2', 'Standard_DS2_v2_Promo', 'Standard_DS3', 'Standard_DS3_v2', 'Standard_DS3_v2_Promo', 'Standard_DS4', 'Standard_DS4_v2', 'Standard_DS4_v2_Promo', 'Standard_DS5_v2', 'Standard_DS5_v2_Promo', 'Standard_E16_v3', 'Standard_E16s_v3', 'Standard_E2_v3', 'Standard_E2s_v3', 'Standard_E32-16s_v3', 'Standard_E32-8s_v3', 'Standard_E32_v3', 'Standard_E32s_v3', 'Standard_E4_v3', 'Standard_E4s_v3', 'Standard_E64-16s_v3', 'Standard_E64-32s_v3', 'Standard_E64_v3', 'Standard_E64s_v3', 'Standard_E8_v3', 'Standard_E8s_v3', 'Standard_F1', 'Standard_F16', 'Standard_F16s', 'Standard_F16s_v2', 'Standard_F1s', 'Standard_F2', 'Standard_F2s', 'Standard_F2s_v2', 'Standard_F32s_v2', 'Standard_F4', 'Standard_F4s', 'Standard_F4s_v2', 'Standard_F64s_v2', 'Standard_F72s_v2', 'Standard_F8', 'Standard_F8s', 'Standard_F8s_v2', 'Standard_G1', 'Standard_G2', 'Standard_G3', 'Standard_G4', 'Standard_G5', 'Standard_GS1', 'Standard_GS2', 'Standard_GS3', 'Standard_GS4', 'Standard_GS4-4', 'Standard_GS4-8', 'Standard_GS5', 'Standard_GS5-16', 'Standard_GS5-8', 'Standard_H16', 'Standard_H16m', 'Standard_H16mr', 'Standard_H16r', 'Standard_H8', 'Standard_H8m', 'Standard_L16s', 'Standard_L32s', 'Standard_L4s', 'Standard_L8s', 'Standard_M128-32ms', 'Standard_M128-64ms', 'Standard_M128ms', 'Standard_M128s', 'Standard_M64-16ms', 'Standard_M64-32ms', 'Standard_M64ms', 'Standard_M64s', 'Standard_NC12', 'Standard_NC12s_v2', 'Standard_NC12s_v3', 'Standard_NC24', 'Standard_NC24r', 'Standard_NC24rs_v2', 'Standard_NC24rs_v3', 'Standard_NC24s_v2', 'Standard_NC24s_v3', 'Standard_NC6', 'Standard_NC6s_v2', 'Standard_NC6s_v3', 'Standard_ND12s', 'Standard_ND24rs', 'Standard_ND24s', 'Standard_ND6s', 'Standard_NV12', 'Standard_NV24', 'Standard_NV6'. + * + * @return the vmSize value + */ + public ContainerServiceVMSizeTypes vmSize() { + return this.vmSize; + } + + /** + * Set size of agent VMs. Possible values include: 'Standard_A1', 'Standard_A10', 'Standard_A11', 'Standard_A1_v2', 'Standard_A2', 'Standard_A2_v2', 'Standard_A2m_v2', 'Standard_A3', 'Standard_A4', 'Standard_A4_v2', 'Standard_A4m_v2', 'Standard_A5', 'Standard_A6', 'Standard_A7', 'Standard_A8', 'Standard_A8_v2', 'Standard_A8m_v2', 'Standard_A9', 'Standard_B2ms', 'Standard_B2s', 'Standard_B4ms', 'Standard_B8ms', 'Standard_D1', 'Standard_D11', 'Standard_D11_v2', 'Standard_D11_v2_Promo', 'Standard_D12', 'Standard_D12_v2', 'Standard_D12_v2_Promo', 'Standard_D13', 'Standard_D13_v2', 'Standard_D13_v2_Promo', 'Standard_D14', 'Standard_D14_v2', 'Standard_D14_v2_Promo', 'Standard_D15_v2', 'Standard_D16_v3', 'Standard_D16s_v3', 'Standard_D1_v2', 'Standard_D2', 'Standard_D2_v2', 'Standard_D2_v2_Promo', 'Standard_D2_v3', 'Standard_D2s_v3', 'Standard_D3', 'Standard_D32_v3', 'Standard_D32s_v3', 'Standard_D3_v2', 'Standard_D3_v2_Promo', 'Standard_D4', 'Standard_D4_v2', 'Standard_D4_v2_Promo', 'Standard_D4_v3', 'Standard_D4s_v3', 'Standard_D5_v2', 'Standard_D5_v2_Promo', 'Standard_D64_v3', 'Standard_D64s_v3', 'Standard_D8_v3', 'Standard_D8s_v3', 'Standard_DS1', 'Standard_DS11', 'Standard_DS11_v2', 'Standard_DS11_v2_Promo', 'Standard_DS12', 'Standard_DS12_v2', 'Standard_DS12_v2_Promo', 'Standard_DS13', 'Standard_DS13-2_v2', 'Standard_DS13-4_v2', 'Standard_DS13_v2', 'Standard_DS13_v2_Promo', 'Standard_DS14', 'Standard_DS14-4_v2', 'Standard_DS14-8_v2', 'Standard_DS14_v2', 'Standard_DS14_v2_Promo', 'Standard_DS15_v2', 'Standard_DS1_v2', 'Standard_DS2', 'Standard_DS2_v2', 'Standard_DS2_v2_Promo', 'Standard_DS3', 'Standard_DS3_v2', 'Standard_DS3_v2_Promo', 'Standard_DS4', 'Standard_DS4_v2', 'Standard_DS4_v2_Promo', 'Standard_DS5_v2', 'Standard_DS5_v2_Promo', 'Standard_E16_v3', 'Standard_E16s_v3', 'Standard_E2_v3', 'Standard_E2s_v3', 'Standard_E32-16s_v3', 'Standard_E32-8s_v3', 'Standard_E32_v3', 'Standard_E32s_v3', 'Standard_E4_v3', 'Standard_E4s_v3', 'Standard_E64-16s_v3', 'Standard_E64-32s_v3', 'Standard_E64_v3', 'Standard_E64s_v3', 'Standard_E8_v3', 'Standard_E8s_v3', 'Standard_F1', 'Standard_F16', 'Standard_F16s', 'Standard_F16s_v2', 'Standard_F1s', 'Standard_F2', 'Standard_F2s', 'Standard_F2s_v2', 'Standard_F32s_v2', 'Standard_F4', 'Standard_F4s', 'Standard_F4s_v2', 'Standard_F64s_v2', 'Standard_F72s_v2', 'Standard_F8', 'Standard_F8s', 'Standard_F8s_v2', 'Standard_G1', 'Standard_G2', 'Standard_G3', 'Standard_G4', 'Standard_G5', 'Standard_GS1', 'Standard_GS2', 'Standard_GS3', 'Standard_GS4', 'Standard_GS4-4', 'Standard_GS4-8', 'Standard_GS5', 'Standard_GS5-16', 'Standard_GS5-8', 'Standard_H16', 'Standard_H16m', 'Standard_H16mr', 'Standard_H16r', 'Standard_H8', 'Standard_H8m', 'Standard_L16s', 'Standard_L32s', 'Standard_L4s', 'Standard_L8s', 'Standard_M128-32ms', 'Standard_M128-64ms', 'Standard_M128ms', 'Standard_M128s', 'Standard_M64-16ms', 'Standard_M64-32ms', 'Standard_M64ms', 'Standard_M64s', 'Standard_NC12', 'Standard_NC12s_v2', 'Standard_NC12s_v3', 'Standard_NC24', 'Standard_NC24r', 'Standard_NC24rs_v2', 'Standard_NC24rs_v3', 'Standard_NC24s_v2', 'Standard_NC24s_v3', 'Standard_NC6', 'Standard_NC6s_v2', 'Standard_NC6s_v3', 'Standard_ND12s', 'Standard_ND24rs', 'Standard_ND24s', 'Standard_ND6s', 'Standard_NV12', 'Standard_NV24', 'Standard_NV6'. + * + * @param vmSize the vmSize value to set + * @return the ContainerServiceMasterProfile object itself. + */ + public ContainerServiceMasterProfile withVmSize(ContainerServiceVMSizeTypes vmSize) { + this.vmSize = vmSize; + return this; + } + + /** + * Get oS Disk Size in GB to be used to specify the disk size for every machine in this master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. + * + * @return the osDiskSizeGB value + */ + public Integer osDiskSizeGB() { + return this.osDiskSizeGB; + } + + /** + * Set oS Disk Size in GB to be used to specify the disk size for every machine in this master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. + * + * @param osDiskSizeGB the osDiskSizeGB value to set + * @return the ContainerServiceMasterProfile object itself. + */ + public ContainerServiceMasterProfile withOsDiskSizeGB(Integer osDiskSizeGB) { + this.osDiskSizeGB = osDiskSizeGB; + return this; + } + + /** + * Get vNet SubnetID specifies the VNet's subnet identifier. + * + * @return the vnetSubnetID value + */ + public String vnetSubnetID() { + return this.vnetSubnetID; + } + + /** + * Set vNet SubnetID specifies the VNet's subnet identifier. + * + * @param vnetSubnetID the vnetSubnetID value to set + * @return the ContainerServiceMasterProfile object itself. + */ + public ContainerServiceMasterProfile withVnetSubnetID(String vnetSubnetID) { + this.vnetSubnetID = vnetSubnetID; + return this; + } + + /** + * Get firstConsecutiveStaticIP used to specify the first static ip of masters. + * + * @return the firstConsecutiveStaticIP value + */ + public String firstConsecutiveStaticIP() { + return this.firstConsecutiveStaticIP; + } + + /** + * Set firstConsecutiveStaticIP used to specify the first static ip of masters. + * + * @param firstConsecutiveStaticIP the firstConsecutiveStaticIP value to set + * @return the ContainerServiceMasterProfile object itself. + */ + public ContainerServiceMasterProfile withFirstConsecutiveStaticIP(String firstConsecutiveStaticIP) { + this.firstConsecutiveStaticIP = firstConsecutiveStaticIP; + return this; + } + + /** + * Get storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. Possible values include: 'StorageAccount', 'ManagedDisks'. + * + * @return the storageProfile value + */ + public ContainerServiceStorageProfileTypes storageProfile() { + return this.storageProfile; + } + + /** + * Set storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. Possible values include: 'StorageAccount', 'ManagedDisks'. + * + * @param storageProfile the storageProfile value to set + * @return the ContainerServiceMasterProfile object itself. + */ + public ContainerServiceMasterProfile withStorageProfile(ContainerServiceStorageProfileTypes storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Get fQDN for the master pool. + * + * @return the fqdn value + */ + public String fqdn() { + return this.fqdn; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceNetworkProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceNetworkProfile.java new file mode 100644 index 000000000000..2ffd5e9a4821 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceNetworkProfile.java @@ -0,0 +1,233 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Profile of network configuration. + */ +public class ContainerServiceNetworkProfile { + /** + * Network plugin used for building Kubernetes network. Possible values + * include: 'azure', 'kubenet'. + */ + @JsonProperty(value = "networkPlugin") + private NetworkPlugin networkPlugin; + + /** + * Network policy used for building Kubernetes network. Possible values + * include: 'calico', 'azure'. + */ + @JsonProperty(value = "networkPolicy") + private NetworkPolicy networkPolicy; + + /** + * A CIDR notation IP range from which to assign pod IPs when kubenet is + * used. + */ + @JsonProperty(value = "podCidr") + private String podCidr; + + /** + * A CIDR notation IP range from which to assign service cluster IPs. It + * must not overlap with any Subnet IP ranges. + */ + @JsonProperty(value = "serviceCidr") + private String serviceCidr; + + /** + * An IP address assigned to the Kubernetes DNS service. It must be within + * the Kubernetes service address range specified in serviceCidr. + */ + @JsonProperty(value = "dnsServiceIP") + private String dnsServiceIP; + + /** + * A CIDR notation IP range assigned to the Docker bridge network. It must + * not overlap with any Subnet IP ranges or the Kubernetes service address + * range. + */ + @JsonProperty(value = "dockerBridgeCidr") + private String dockerBridgeCidr; + + /** + * The load balancer sku for the managed cluster. Possible values include: + * 'standard', 'basic'. + */ + @JsonProperty(value = "loadBalancerSku") + private LoadBalancerSku loadBalancerSku; + + /** + * Profile of the cluster load balancer. + */ + @JsonProperty(value = "loadBalancerProfile") + private ManagedClusterLoadBalancerProfile loadBalancerProfile; + + /** + * Get network plugin used for building Kubernetes network. Possible values include: 'azure', 'kubenet'. + * + * @return the networkPlugin value + */ + public NetworkPlugin networkPlugin() { + return this.networkPlugin; + } + + /** + * Set network plugin used for building Kubernetes network. Possible values include: 'azure', 'kubenet'. + * + * @param networkPlugin the networkPlugin value to set + * @return the ContainerServiceNetworkProfile object itself. + */ + public ContainerServiceNetworkProfile withNetworkPlugin(NetworkPlugin networkPlugin) { + this.networkPlugin = networkPlugin; + return this; + } + + /** + * Get network policy used for building Kubernetes network. Possible values include: 'calico', 'azure'. + * + * @return the networkPolicy value + */ + public NetworkPolicy networkPolicy() { + return this.networkPolicy; + } + + /** + * Set network policy used for building Kubernetes network. Possible values include: 'calico', 'azure'. + * + * @param networkPolicy the networkPolicy value to set + * @return the ContainerServiceNetworkProfile object itself. + */ + public ContainerServiceNetworkProfile withNetworkPolicy(NetworkPolicy networkPolicy) { + this.networkPolicy = networkPolicy; + return this; + } + + /** + * Get a CIDR notation IP range from which to assign pod IPs when kubenet is used. + * + * @return the podCidr value + */ + public String podCidr() { + return this.podCidr; + } + + /** + * Set a CIDR notation IP range from which to assign pod IPs when kubenet is used. + * + * @param podCidr the podCidr value to set + * @return the ContainerServiceNetworkProfile object itself. + */ + public ContainerServiceNetworkProfile withPodCidr(String podCidr) { + this.podCidr = podCidr; + return this; + } + + /** + * Get a CIDR notation IP range from which to assign service cluster IPs. It must not overlap with any Subnet IP ranges. + * + * @return the serviceCidr value + */ + public String serviceCidr() { + return this.serviceCidr; + } + + /** + * Set a CIDR notation IP range from which to assign service cluster IPs. It must not overlap with any Subnet IP ranges. + * + * @param serviceCidr the serviceCidr value to set + * @return the ContainerServiceNetworkProfile object itself. + */ + public ContainerServiceNetworkProfile withServiceCidr(String serviceCidr) { + this.serviceCidr = serviceCidr; + return this; + } + + /** + * Get an IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service address range specified in serviceCidr. + * + * @return the dnsServiceIP value + */ + public String dnsServiceIP() { + return this.dnsServiceIP; + } + + /** + * Set an IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service address range specified in serviceCidr. + * + * @param dnsServiceIP the dnsServiceIP value to set + * @return the ContainerServiceNetworkProfile object itself. + */ + public ContainerServiceNetworkProfile withDnsServiceIP(String dnsServiceIP) { + this.dnsServiceIP = dnsServiceIP; + return this; + } + + /** + * Get a CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. + * + * @return the dockerBridgeCidr value + */ + public String dockerBridgeCidr() { + return this.dockerBridgeCidr; + } + + /** + * Set a CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. + * + * @param dockerBridgeCidr the dockerBridgeCidr value to set + * @return the ContainerServiceNetworkProfile object itself. + */ + public ContainerServiceNetworkProfile withDockerBridgeCidr(String dockerBridgeCidr) { + this.dockerBridgeCidr = dockerBridgeCidr; + return this; + } + + /** + * Get the load balancer sku for the managed cluster. Possible values include: 'standard', 'basic'. + * + * @return the loadBalancerSku value + */ + public LoadBalancerSku loadBalancerSku() { + return this.loadBalancerSku; + } + + /** + * Set the load balancer sku for the managed cluster. Possible values include: 'standard', 'basic'. + * + * @param loadBalancerSku the loadBalancerSku value to set + * @return the ContainerServiceNetworkProfile object itself. + */ + public ContainerServiceNetworkProfile withLoadBalancerSku(LoadBalancerSku loadBalancerSku) { + this.loadBalancerSku = loadBalancerSku; + return this; + } + + /** + * Get profile of the cluster load balancer. + * + * @return the loadBalancerProfile value + */ + public ManagedClusterLoadBalancerProfile loadBalancerProfile() { + return this.loadBalancerProfile; + } + + /** + * Set profile of the cluster load balancer. + * + * @param loadBalancerProfile the loadBalancerProfile value to set + * @return the ContainerServiceNetworkProfile object itself. + */ + public ContainerServiceNetworkProfile withLoadBalancerProfile(ManagedClusterLoadBalancerProfile loadBalancerProfile) { + this.loadBalancerProfile = loadBalancerProfile; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceOrchestratorProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceOrchestratorProfile.java new file mode 100644 index 000000000000..3f38b5d099b1 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceOrchestratorProfile.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Profile for the container service orchestrator. + */ +public class ContainerServiceOrchestratorProfile { + /** + * The orchestrator to use to manage container service cluster resources. + * Valid values are Kubernetes, Swarm, DCOS, DockerCE and Custom. Possible + * values include: 'Kubernetes', 'Swarm', 'DCOS', 'DockerCE', 'Custom'. + */ + @JsonProperty(value = "orchestratorType", required = true) + private ContainerServiceOrchestratorTypes orchestratorType; + + /** + * The version of the orchestrator to use. You can specify the + * major.minor.patch part of the actual version.For example, you can + * specify version as "1.6.11". + */ + @JsonProperty(value = "orchestratorVersion") + private String orchestratorVersion; + + /** + * Get the orchestrator to use to manage container service cluster resources. Valid values are Kubernetes, Swarm, DCOS, DockerCE and Custom. Possible values include: 'Kubernetes', 'Swarm', 'DCOS', 'DockerCE', 'Custom'. + * + * @return the orchestratorType value + */ + public ContainerServiceOrchestratorTypes orchestratorType() { + return this.orchestratorType; + } + + /** + * Set the orchestrator to use to manage container service cluster resources. Valid values are Kubernetes, Swarm, DCOS, DockerCE and Custom. Possible values include: 'Kubernetes', 'Swarm', 'DCOS', 'DockerCE', 'Custom'. + * + * @param orchestratorType the orchestratorType value to set + * @return the ContainerServiceOrchestratorProfile object itself. + */ + public ContainerServiceOrchestratorProfile withOrchestratorType(ContainerServiceOrchestratorTypes orchestratorType) { + this.orchestratorType = orchestratorType; + return this; + } + + /** + * Get the version of the orchestrator to use. You can specify the major.minor.patch part of the actual version.For example, you can specify version as "1.6.11". + * + * @return the orchestratorVersion value + */ + public String orchestratorVersion() { + return this.orchestratorVersion; + } + + /** + * Set the version of the orchestrator to use. You can specify the major.minor.patch part of the actual version.For example, you can specify version as "1.6.11". + * + * @param orchestratorVersion the orchestratorVersion value to set + * @return the ContainerServiceOrchestratorProfile object itself. + */ + public ContainerServiceOrchestratorProfile withOrchestratorVersion(String orchestratorVersion) { + this.orchestratorVersion = orchestratorVersion; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceOrchestratorTypes.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceOrchestratorTypes.java new file mode 100644 index 000000000000..d81ff9c943f7 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceOrchestratorTypes.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ContainerServiceOrchestratorTypes. + */ +public final class ContainerServiceOrchestratorTypes extends ExpandableStringEnum { + /** Static value Kubernetes for ContainerServiceOrchestratorTypes. */ + public static final ContainerServiceOrchestratorTypes KUBERNETES = fromString("Kubernetes"); + + /** Static value Swarm for ContainerServiceOrchestratorTypes. */ + public static final ContainerServiceOrchestratorTypes SWARM = fromString("Swarm"); + + /** Static value DCOS for ContainerServiceOrchestratorTypes. */ + public static final ContainerServiceOrchestratorTypes DCOS = fromString("DCOS"); + + /** Static value DockerCE for ContainerServiceOrchestratorTypes. */ + public static final ContainerServiceOrchestratorTypes DOCKER_CE = fromString("DockerCE"); + + /** Static value Custom for ContainerServiceOrchestratorTypes. */ + public static final ContainerServiceOrchestratorTypes CUSTOM = fromString("Custom"); + + /** + * Creates or finds a ContainerServiceOrchestratorTypes from its string representation. + * @param name a name to look for + * @return the corresponding ContainerServiceOrchestratorTypes + */ + @JsonCreator + public static ContainerServiceOrchestratorTypes fromString(String name) { + return fromString(name, ContainerServiceOrchestratorTypes.class); + } + + /** + * @return known ContainerServiceOrchestratorTypes values + */ + public static Collection values() { + return values(ContainerServiceOrchestratorTypes.class); + } +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceServicePrincipalProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceServicePrincipalProfile.java new file mode 100644 index 000000000000..5d3e69921416 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceServicePrincipalProfile.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about a service principal identity for the cluster to use for + * manipulating Azure APIs. Either secret or keyVaultSecretRef must be + * specified. + */ +public class ContainerServiceServicePrincipalProfile { + /** + * The ID for the service principal. + */ + @JsonProperty(value = "clientId", required = true) + private String clientId; + + /** + * The secret password associated with the service principal in plain text. + */ + @JsonProperty(value = "secret") + private String secret; + + /** + * Reference to a secret stored in Azure Key Vault. + */ + @JsonProperty(value = "keyVaultSecretRef") + private KeyVaultSecretRef keyVaultSecretRef; + + /** + * Get the ID for the service principal. + * + * @return the clientId value + */ + public String clientId() { + return this.clientId; + } + + /** + * Set the ID for the service principal. + * + * @param clientId the clientId value to set + * @return the ContainerServiceServicePrincipalProfile object itself. + */ + public ContainerServiceServicePrincipalProfile withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get the secret password associated with the service principal in plain text. + * + * @return the secret value + */ + public String secret() { + return this.secret; + } + + /** + * Set the secret password associated with the service principal in plain text. + * + * @param secret the secret value to set + * @return the ContainerServiceServicePrincipalProfile object itself. + */ + public ContainerServiceServicePrincipalProfile withSecret(String secret) { + this.secret = secret; + return this; + } + + /** + * Get reference to a secret stored in Azure Key Vault. + * + * @return the keyVaultSecretRef value + */ + public KeyVaultSecretRef keyVaultSecretRef() { + return this.keyVaultSecretRef; + } + + /** + * Set reference to a secret stored in Azure Key Vault. + * + * @param keyVaultSecretRef the keyVaultSecretRef value to set + * @return the ContainerServiceServicePrincipalProfile object itself. + */ + public ContainerServiceServicePrincipalProfile withKeyVaultSecretRef(KeyVaultSecretRef keyVaultSecretRef) { + this.keyVaultSecretRef = keyVaultSecretRef; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceSshConfiguration.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceSshConfiguration.java new file mode 100644 index 000000000000..a0de8c467e6c --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceSshConfiguration.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * SSH configuration for Linux-based VMs running on Azure. + */ +public class ContainerServiceSshConfiguration { + /** + * The list of SSH public keys used to authenticate with Linux-based VMs. + * Only expect one key specified. + */ + @JsonProperty(value = "publicKeys", required = true) + private List publicKeys; + + /** + * Get the list of SSH public keys used to authenticate with Linux-based VMs. Only expect one key specified. + * + * @return the publicKeys value + */ + public List publicKeys() { + return this.publicKeys; + } + + /** + * Set the list of SSH public keys used to authenticate with Linux-based VMs. Only expect one key specified. + * + * @param publicKeys the publicKeys value to set + * @return the ContainerServiceSshConfiguration object itself. + */ + public ContainerServiceSshConfiguration withPublicKeys(List publicKeys) { + this.publicKeys = publicKeys; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceSshPublicKey.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceSshPublicKey.java new file mode 100644 index 000000000000..acbaaa3b68c9 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceSshPublicKey.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains information about SSH certificate public key data. + */ +public class ContainerServiceSshPublicKey { + /** + * Certificate public key used to authenticate with VMs through SSH. The + * certificate must be in PEM format with or without headers. + */ + @JsonProperty(value = "keyData", required = true) + private String keyData; + + /** + * Get certificate public key used to authenticate with VMs through SSH. The certificate must be in PEM format with or without headers. + * + * @return the keyData value + */ + public String keyData() { + return this.keyData; + } + + /** + * Set certificate public key used to authenticate with VMs through SSH. The certificate must be in PEM format with or without headers. + * + * @param keyData the keyData value to set + * @return the ContainerServiceSshPublicKey object itself. + */ + public ContainerServiceSshPublicKey withKeyData(String keyData) { + this.keyData = keyData; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceStorageProfileTypes.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceStorageProfileTypes.java new file mode 100644 index 000000000000..53aa4619feb2 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceStorageProfileTypes.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ContainerServiceStorageProfileTypes. + */ +public final class ContainerServiceStorageProfileTypes extends ExpandableStringEnum { + /** Static value StorageAccount for ContainerServiceStorageProfileTypes. */ + public static final ContainerServiceStorageProfileTypes STORAGE_ACCOUNT = fromString("StorageAccount"); + + /** Static value ManagedDisks for ContainerServiceStorageProfileTypes. */ + public static final ContainerServiceStorageProfileTypes MANAGED_DISKS = fromString("ManagedDisks"); + + /** + * Creates or finds a ContainerServiceStorageProfileTypes from its string representation. + * @param name a name to look for + * @return the corresponding ContainerServiceStorageProfileTypes + */ + @JsonCreator + public static ContainerServiceStorageProfileTypes fromString(String name) { + return fromString(name, ContainerServiceStorageProfileTypes.class); + } + + /** + * @return known ContainerServiceStorageProfileTypes values + */ + public static Collection values() { + return values(ContainerServiceStorageProfileTypes.class); + } +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceVMDiagnostics.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceVMDiagnostics.java new file mode 100644 index 000000000000..48e6a9514165 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceVMDiagnostics.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Profile for diagnostics on the container service VMs. + */ +public class ContainerServiceVMDiagnostics { + /** + * Whether the VM diagnostic agent is provisioned on the VM. + */ + @JsonProperty(value = "enabled", required = true) + private boolean enabled; + + /** + * The URI of the storage account where diagnostics are stored. + */ + @JsonProperty(value = "storageUri", access = JsonProperty.Access.WRITE_ONLY) + private String storageUri; + + /** + * Get whether the VM diagnostic agent is provisioned on the VM. + * + * @return the enabled value + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set whether the VM diagnostic agent is provisioned on the VM. + * + * @param enabled the enabled value to set + * @return the ContainerServiceVMDiagnostics object itself. + */ + public ContainerServiceVMDiagnostics withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the URI of the storage account where diagnostics are stored. + * + * @return the storageUri value + */ + public String storageUri() { + return this.storageUri; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceVMSizeTypes.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceVMSizeTypes.java new file mode 100644 index 000000000000..33558b7248b8 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceVMSizeTypes.java @@ -0,0 +1,557 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ContainerServiceVMSizeTypes. + */ +public final class ContainerServiceVMSizeTypes extends ExpandableStringEnum { + /** Static value Standard_A1 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_A1 = fromString("Standard_A1"); + + /** Static value Standard_A10 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_A10 = fromString("Standard_A10"); + + /** Static value Standard_A11 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_A11 = fromString("Standard_A11"); + + /** Static value Standard_A1_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_A1_V2 = fromString("Standard_A1_v2"); + + /** Static value Standard_A2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_A2 = fromString("Standard_A2"); + + /** Static value Standard_A2_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_A2_V2 = fromString("Standard_A2_v2"); + + /** Static value Standard_A2m_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_A2M_V2 = fromString("Standard_A2m_v2"); + + /** Static value Standard_A3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_A3 = fromString("Standard_A3"); + + /** Static value Standard_A4 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_A4 = fromString("Standard_A4"); + + /** Static value Standard_A4_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_A4_V2 = fromString("Standard_A4_v2"); + + /** Static value Standard_A4m_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_A4M_V2 = fromString("Standard_A4m_v2"); + + /** Static value Standard_A5 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_A5 = fromString("Standard_A5"); + + /** Static value Standard_A6 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_A6 = fromString("Standard_A6"); + + /** Static value Standard_A7 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_A7 = fromString("Standard_A7"); + + /** Static value Standard_A8 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_A8 = fromString("Standard_A8"); + + /** Static value Standard_A8_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_A8_V2 = fromString("Standard_A8_v2"); + + /** Static value Standard_A8m_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_A8M_V2 = fromString("Standard_A8m_v2"); + + /** Static value Standard_A9 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_A9 = fromString("Standard_A9"); + + /** Static value Standard_B2ms for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_B2MS = fromString("Standard_B2ms"); + + /** Static value Standard_B2s for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_B2S = fromString("Standard_B2s"); + + /** Static value Standard_B4ms for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_B4MS = fromString("Standard_B4ms"); + + /** Static value Standard_B8ms for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_B8MS = fromString("Standard_B8ms"); + + /** Static value Standard_D1 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D1 = fromString("Standard_D1"); + + /** Static value Standard_D11 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D11 = fromString("Standard_D11"); + + /** Static value Standard_D11_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D11_V2 = fromString("Standard_D11_v2"); + + /** Static value Standard_D11_v2_Promo for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D11_V2_PROMO = fromString("Standard_D11_v2_Promo"); + + /** Static value Standard_D12 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D12 = fromString("Standard_D12"); + + /** Static value Standard_D12_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D12_V2 = fromString("Standard_D12_v2"); + + /** Static value Standard_D12_v2_Promo for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D12_V2_PROMO = fromString("Standard_D12_v2_Promo"); + + /** Static value Standard_D13 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D13 = fromString("Standard_D13"); + + /** Static value Standard_D13_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D13_V2 = fromString("Standard_D13_v2"); + + /** Static value Standard_D13_v2_Promo for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D13_V2_PROMO = fromString("Standard_D13_v2_Promo"); + + /** Static value Standard_D14 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D14 = fromString("Standard_D14"); + + /** Static value Standard_D14_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D14_V2 = fromString("Standard_D14_v2"); + + /** Static value Standard_D14_v2_Promo for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D14_V2_PROMO = fromString("Standard_D14_v2_Promo"); + + /** Static value Standard_D15_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D15_V2 = fromString("Standard_D15_v2"); + + /** Static value Standard_D16_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D16_V3 = fromString("Standard_D16_v3"); + + /** Static value Standard_D16s_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D16S_V3 = fromString("Standard_D16s_v3"); + + /** Static value Standard_D1_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D1_V2 = fromString("Standard_D1_v2"); + + /** Static value Standard_D2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D2 = fromString("Standard_D2"); + + /** Static value Standard_D2_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D2_V2 = fromString("Standard_D2_v2"); + + /** Static value Standard_D2_v2_Promo for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D2_V2_PROMO = fromString("Standard_D2_v2_Promo"); + + /** Static value Standard_D2_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D2_V3 = fromString("Standard_D2_v3"); + + /** Static value Standard_D2s_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D2S_V3 = fromString("Standard_D2s_v3"); + + /** Static value Standard_D3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D3 = fromString("Standard_D3"); + + /** Static value Standard_D32_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D32_V3 = fromString("Standard_D32_v3"); + + /** Static value Standard_D32s_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D32S_V3 = fromString("Standard_D32s_v3"); + + /** Static value Standard_D3_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D3_V2 = fromString("Standard_D3_v2"); + + /** Static value Standard_D3_v2_Promo for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D3_V2_PROMO = fromString("Standard_D3_v2_Promo"); + + /** Static value Standard_D4 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D4 = fromString("Standard_D4"); + + /** Static value Standard_D4_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D4_V2 = fromString("Standard_D4_v2"); + + /** Static value Standard_D4_v2_Promo for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D4_V2_PROMO = fromString("Standard_D4_v2_Promo"); + + /** Static value Standard_D4_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D4_V3 = fromString("Standard_D4_v3"); + + /** Static value Standard_D4s_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D4S_V3 = fromString("Standard_D4s_v3"); + + /** Static value Standard_D5_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D5_V2 = fromString("Standard_D5_v2"); + + /** Static value Standard_D5_v2_Promo for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D5_V2_PROMO = fromString("Standard_D5_v2_Promo"); + + /** Static value Standard_D64_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D64_V3 = fromString("Standard_D64_v3"); + + /** Static value Standard_D64s_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D64S_V3 = fromString("Standard_D64s_v3"); + + /** Static value Standard_D8_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D8_V3 = fromString("Standard_D8_v3"); + + /** Static value Standard_D8s_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_D8S_V3 = fromString("Standard_D8s_v3"); + + /** Static value Standard_DS1 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS1 = fromString("Standard_DS1"); + + /** Static value Standard_DS11 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS11 = fromString("Standard_DS11"); + + /** Static value Standard_DS11_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS11_V2 = fromString("Standard_DS11_v2"); + + /** Static value Standard_DS11_v2_Promo for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS11_V2_PROMO = fromString("Standard_DS11_v2_Promo"); + + /** Static value Standard_DS12 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS12 = fromString("Standard_DS12"); + + /** Static value Standard_DS12_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS12_V2 = fromString("Standard_DS12_v2"); + + /** Static value Standard_DS12_v2_Promo for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS12_V2_PROMO = fromString("Standard_DS12_v2_Promo"); + + /** Static value Standard_DS13 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS13 = fromString("Standard_DS13"); + + /** Static value Standard_DS13-2_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS13_2_V2 = fromString("Standard_DS13-2_v2"); + + /** Static value Standard_DS13-4_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS13_4_V2 = fromString("Standard_DS13-4_v2"); + + /** Static value Standard_DS13_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS13_V2 = fromString("Standard_DS13_v2"); + + /** Static value Standard_DS13_v2_Promo for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS13_V2_PROMO = fromString("Standard_DS13_v2_Promo"); + + /** Static value Standard_DS14 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS14 = fromString("Standard_DS14"); + + /** Static value Standard_DS14-4_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS14_4_V2 = fromString("Standard_DS14-4_v2"); + + /** Static value Standard_DS14-8_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS14_8_V2 = fromString("Standard_DS14-8_v2"); + + /** Static value Standard_DS14_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS14_V2 = fromString("Standard_DS14_v2"); + + /** Static value Standard_DS14_v2_Promo for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS14_V2_PROMO = fromString("Standard_DS14_v2_Promo"); + + /** Static value Standard_DS15_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS15_V2 = fromString("Standard_DS15_v2"); + + /** Static value Standard_DS1_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS1_V2 = fromString("Standard_DS1_v2"); + + /** Static value Standard_DS2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS2 = fromString("Standard_DS2"); + + /** Static value Standard_DS2_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS2_V2 = fromString("Standard_DS2_v2"); + + /** Static value Standard_DS2_v2_Promo for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS2_V2_PROMO = fromString("Standard_DS2_v2_Promo"); + + /** Static value Standard_DS3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS3 = fromString("Standard_DS3"); + + /** Static value Standard_DS3_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS3_V2 = fromString("Standard_DS3_v2"); + + /** Static value Standard_DS3_v2_Promo for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS3_V2_PROMO = fromString("Standard_DS3_v2_Promo"); + + /** Static value Standard_DS4 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS4 = fromString("Standard_DS4"); + + /** Static value Standard_DS4_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS4_V2 = fromString("Standard_DS4_v2"); + + /** Static value Standard_DS4_v2_Promo for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS4_V2_PROMO = fromString("Standard_DS4_v2_Promo"); + + /** Static value Standard_DS5_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS5_V2 = fromString("Standard_DS5_v2"); + + /** Static value Standard_DS5_v2_Promo for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_DS5_V2_PROMO = fromString("Standard_DS5_v2_Promo"); + + /** Static value Standard_E16_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_E16_V3 = fromString("Standard_E16_v3"); + + /** Static value Standard_E16s_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_E16S_V3 = fromString("Standard_E16s_v3"); + + /** Static value Standard_E2_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_E2_V3 = fromString("Standard_E2_v3"); + + /** Static value Standard_E2s_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_E2S_V3 = fromString("Standard_E2s_v3"); + + /** Static value Standard_E32-16s_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_E32_16S_V3 = fromString("Standard_E32-16s_v3"); + + /** Static value Standard_E32-8s_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_E32_8S_V3 = fromString("Standard_E32-8s_v3"); + + /** Static value Standard_E32_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_E32_V3 = fromString("Standard_E32_v3"); + + /** Static value Standard_E32s_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_E32S_V3 = fromString("Standard_E32s_v3"); + + /** Static value Standard_E4_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_E4_V3 = fromString("Standard_E4_v3"); + + /** Static value Standard_E4s_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_E4S_V3 = fromString("Standard_E4s_v3"); + + /** Static value Standard_E64-16s_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_E64_16S_V3 = fromString("Standard_E64-16s_v3"); + + /** Static value Standard_E64-32s_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_E64_32S_V3 = fromString("Standard_E64-32s_v3"); + + /** Static value Standard_E64_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_E64_V3 = fromString("Standard_E64_v3"); + + /** Static value Standard_E64s_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_E64S_V3 = fromString("Standard_E64s_v3"); + + /** Static value Standard_E8_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_E8_V3 = fromString("Standard_E8_v3"); + + /** Static value Standard_E8s_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_E8S_V3 = fromString("Standard_E8s_v3"); + + /** Static value Standard_F1 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_F1 = fromString("Standard_F1"); + + /** Static value Standard_F16 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_F16 = fromString("Standard_F16"); + + /** Static value Standard_F16s for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_F16S = fromString("Standard_F16s"); + + /** Static value Standard_F16s_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_F16S_V2 = fromString("Standard_F16s_v2"); + + /** Static value Standard_F1s for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_F1S = fromString("Standard_F1s"); + + /** Static value Standard_F2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_F2 = fromString("Standard_F2"); + + /** Static value Standard_F2s for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_F2S = fromString("Standard_F2s"); + + /** Static value Standard_F2s_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_F2S_V2 = fromString("Standard_F2s_v2"); + + /** Static value Standard_F32s_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_F32S_V2 = fromString("Standard_F32s_v2"); + + /** Static value Standard_F4 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_F4 = fromString("Standard_F4"); + + /** Static value Standard_F4s for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_F4S = fromString("Standard_F4s"); + + /** Static value Standard_F4s_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_F4S_V2 = fromString("Standard_F4s_v2"); + + /** Static value Standard_F64s_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_F64S_V2 = fromString("Standard_F64s_v2"); + + /** Static value Standard_F72s_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_F72S_V2 = fromString("Standard_F72s_v2"); + + /** Static value Standard_F8 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_F8 = fromString("Standard_F8"); + + /** Static value Standard_F8s for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_F8S = fromString("Standard_F8s"); + + /** Static value Standard_F8s_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_F8S_V2 = fromString("Standard_F8s_v2"); + + /** Static value Standard_G1 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_G1 = fromString("Standard_G1"); + + /** Static value Standard_G2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_G2 = fromString("Standard_G2"); + + /** Static value Standard_G3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_G3 = fromString("Standard_G3"); + + /** Static value Standard_G4 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_G4 = fromString("Standard_G4"); + + /** Static value Standard_G5 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_G5 = fromString("Standard_G5"); + + /** Static value Standard_GS1 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_GS1 = fromString("Standard_GS1"); + + /** Static value Standard_GS2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_GS2 = fromString("Standard_GS2"); + + /** Static value Standard_GS3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_GS3 = fromString("Standard_GS3"); + + /** Static value Standard_GS4 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_GS4 = fromString("Standard_GS4"); + + /** Static value Standard_GS4-4 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_GS4_4 = fromString("Standard_GS4-4"); + + /** Static value Standard_GS4-8 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_GS4_8 = fromString("Standard_GS4-8"); + + /** Static value Standard_GS5 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_GS5 = fromString("Standard_GS5"); + + /** Static value Standard_GS5-16 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_GS5_16 = fromString("Standard_GS5-16"); + + /** Static value Standard_GS5-8 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_GS5_8 = fromString("Standard_GS5-8"); + + /** Static value Standard_H16 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_H16 = fromString("Standard_H16"); + + /** Static value Standard_H16m for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_H16M = fromString("Standard_H16m"); + + /** Static value Standard_H16mr for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_H16MR = fromString("Standard_H16mr"); + + /** Static value Standard_H16r for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_H16R = fromString("Standard_H16r"); + + /** Static value Standard_H8 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_H8 = fromString("Standard_H8"); + + /** Static value Standard_H8m for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_H8M = fromString("Standard_H8m"); + + /** Static value Standard_L16s for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_L16S = fromString("Standard_L16s"); + + /** Static value Standard_L32s for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_L32S = fromString("Standard_L32s"); + + /** Static value Standard_L4s for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_L4S = fromString("Standard_L4s"); + + /** Static value Standard_L8s for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_L8S = fromString("Standard_L8s"); + + /** Static value Standard_M128-32ms for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_M128_32MS = fromString("Standard_M128-32ms"); + + /** Static value Standard_M128-64ms for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_M128_64MS = fromString("Standard_M128-64ms"); + + /** Static value Standard_M128ms for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_M128MS = fromString("Standard_M128ms"); + + /** Static value Standard_M128s for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_M128S = fromString("Standard_M128s"); + + /** Static value Standard_M64-16ms for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_M64_16MS = fromString("Standard_M64-16ms"); + + /** Static value Standard_M64-32ms for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_M64_32MS = fromString("Standard_M64-32ms"); + + /** Static value Standard_M64ms for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_M64MS = fromString("Standard_M64ms"); + + /** Static value Standard_M64s for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_M64S = fromString("Standard_M64s"); + + /** Static value Standard_NC12 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_NC12 = fromString("Standard_NC12"); + + /** Static value Standard_NC12s_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_NC12S_V2 = fromString("Standard_NC12s_v2"); + + /** Static value Standard_NC12s_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_NC12S_V3 = fromString("Standard_NC12s_v3"); + + /** Static value Standard_NC24 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_NC24 = fromString("Standard_NC24"); + + /** Static value Standard_NC24r for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_NC24R = fromString("Standard_NC24r"); + + /** Static value Standard_NC24rs_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_NC24RS_V2 = fromString("Standard_NC24rs_v2"); + + /** Static value Standard_NC24rs_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_NC24RS_V3 = fromString("Standard_NC24rs_v3"); + + /** Static value Standard_NC24s_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_NC24S_V2 = fromString("Standard_NC24s_v2"); + + /** Static value Standard_NC24s_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_NC24S_V3 = fromString("Standard_NC24s_v3"); + + /** Static value Standard_NC6 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_NC6 = fromString("Standard_NC6"); + + /** Static value Standard_NC6s_v2 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_NC6S_V2 = fromString("Standard_NC6s_v2"); + + /** Static value Standard_NC6s_v3 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_NC6S_V3 = fromString("Standard_NC6s_v3"); + + /** Static value Standard_ND12s for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_ND12S = fromString("Standard_ND12s"); + + /** Static value Standard_ND24rs for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_ND24RS = fromString("Standard_ND24rs"); + + /** Static value Standard_ND24s for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_ND24S = fromString("Standard_ND24s"); + + /** Static value Standard_ND6s for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_ND6S = fromString("Standard_ND6s"); + + /** Static value Standard_NV12 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_NV12 = fromString("Standard_NV12"); + + /** Static value Standard_NV24 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_NV24 = fromString("Standard_NV24"); + + /** Static value Standard_NV6 for ContainerServiceVMSizeTypes. */ + public static final ContainerServiceVMSizeTypes STANDARD_NV6 = fromString("Standard_NV6"); + + /** + * Creates or finds a ContainerServiceVMSizeTypes from its string representation. + * @param name a name to look for + * @return the corresponding ContainerServiceVMSizeTypes + */ + @JsonCreator + public static ContainerServiceVMSizeTypes fromString(String name) { + return fromString(name, ContainerServiceVMSizeTypes.class); + } + + /** + * @return known ContainerServiceVMSizeTypes values + */ + public static Collection values() { + return values(ContainerServiceVMSizeTypes.class); + } +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceWindowsProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceWindowsProfile.java new file mode 100644 index 000000000000..6f596676c67d --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServiceWindowsProfile.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Profile for Windows VMs in the container service cluster. + */ +public class ContainerServiceWindowsProfile { + /** + * The administrator username to use for Windows VMs. + */ + @JsonProperty(value = "adminUsername", required = true) + private String adminUsername; + + /** + * The administrator password to use for Windows VMs. + */ + @JsonProperty(value = "adminPassword", required = true) + private String adminPassword; + + /** + * Get the administrator username to use for Windows VMs. + * + * @return the adminUsername value + */ + public String adminUsername() { + return this.adminUsername; + } + + /** + * Set the administrator username to use for Windows VMs. + * + * @param adminUsername the adminUsername value to set + * @return the ContainerServiceWindowsProfile object itself. + */ + public ContainerServiceWindowsProfile withAdminUsername(String adminUsername) { + this.adminUsername = adminUsername; + return this; + } + + /** + * Get the administrator password to use for Windows VMs. + * + * @return the adminPassword value + */ + public String adminPassword() { + return this.adminPassword; + } + + /** + * Set the administrator password to use for Windows VMs. + * + * @param adminPassword the adminPassword value to set + * @return the ContainerServiceWindowsProfile object itself. + */ + public ContainerServiceWindowsProfile withAdminPassword(String adminPassword) { + this.adminPassword = adminPassword; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServices.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServices.java new file mode 100644 index 000000000000..c987fec856e3 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ContainerServices.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.ContainerServicesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ContainerServices. + */ +public interface ContainerServices extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Gets a list of supported orchestrators in the specified subscription. + * Gets a list of supported orchestrators in the specified subscription. The operation returns properties of each orchestrator including version, available upgrades and whether that version or upgrades are in preview. + * + * @param location The name of a supported Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listOrchestratorsAsync(String location); + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/CredentialResult.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/CredentialResult.java new file mode 100644 index 000000000000..ee020612cd74 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/CredentialResult.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The credential result response. + */ +public class CredentialResult { + /** + * The name of the credential. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Base64-encoded Kubernetes configuration file. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private byte[] value; + + /** + * Get the name of the credential. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get base64-encoded Kubernetes configuration file. + * + * @return the value value + */ + public byte[] value() { + return this.value; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/CredentialResults.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/CredentialResults.java new file mode 100644 index 000000000000..3e82b6edb7b7 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/CredentialResults.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.ContainerServiceManager; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.CredentialResultsInner; +import java.util.List; + +/** + * Type representing CredentialResults. + */ +public interface CredentialResults extends HasInner, HasManager { + /** + * @return the kubeconfigs value. + */ + List kubeconfigs(); + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/KeyVaultSecretRef.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/KeyVaultSecretRef.java new file mode 100644 index 000000000000..3ed5a2acf8de --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/KeyVaultSecretRef.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Reference to a secret stored in Azure Key Vault. + */ +public class KeyVaultSecretRef { + /** + * Key vault identifier. + */ + @JsonProperty(value = "vaultID", required = true) + private String vaultID; + + /** + * The secret name. + */ + @JsonProperty(value = "secretName", required = true) + private String secretName; + + /** + * The secret version. + */ + @JsonProperty(value = "version") + private String version; + + /** + * Get key vault identifier. + * + * @return the vaultID value + */ + public String vaultID() { + return this.vaultID; + } + + /** + * Set key vault identifier. + * + * @param vaultID the vaultID value to set + * @return the KeyVaultSecretRef object itself. + */ + public KeyVaultSecretRef withVaultID(String vaultID) { + this.vaultID = vaultID; + return this; + } + + /** + * Get the secret name. + * + * @return the secretName value + */ + public String secretName() { + return this.secretName; + } + + /** + * Set the secret name. + * + * @param secretName the secretName value to set + * @return the KeyVaultSecretRef object itself. + */ + public KeyVaultSecretRef withSecretName(String secretName) { + this.secretName = secretName; + return this; + } + + /** + * Get the secret version. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Set the secret version. + * + * @param version the version value to set + * @return the KeyVaultSecretRef object itself. + */ + public KeyVaultSecretRef withVersion(String version) { + this.version = version; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/LoadBalancerSku.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/LoadBalancerSku.java new file mode 100644 index 000000000000..a8ce0d012e30 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/LoadBalancerSku.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for LoadBalancerSku. + */ +public final class LoadBalancerSku extends ExpandableStringEnum { + /** Static value standard for LoadBalancerSku. */ + public static final LoadBalancerSku STANDARD = fromString("standard"); + + /** Static value basic for LoadBalancerSku. */ + public static final LoadBalancerSku BASIC = fromString("basic"); + + /** + * Creates or finds a LoadBalancerSku from its string representation. + * @param name a name to look for + * @return the corresponding LoadBalancerSku + */ + @JsonCreator + public static LoadBalancerSku fromString(String name) { + return fromString(name, LoadBalancerSku.class); + } + + /** + * @return known LoadBalancerSku values + */ + public static Collection values() { + return values(LoadBalancerSku.class); + } +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedCluster.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedCluster.java new file mode 100644 index 000000000000..4e002464971f --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedCluster.java @@ -0,0 +1,491 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.ContainerServiceManager; +import java.util.List; +import java.util.Map; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.ManagedClusterInner; + +/** + * Type representing ManagedCluster. + */ +public interface ManagedCluster extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the aadProfile value. + */ + ManagedClusterAADProfile aadProfile(); + + /** + * @return the addonProfiles value. + */ + Map addonProfiles(); + + /** + * @return the agentPoolProfiles value. + */ + List agentPoolProfiles(); + + /** + * @return the apiServerAccessProfile value. + */ + ManagedClusterAPIServerAccessProfile apiServerAccessProfile(); + + /** + * @return the dnsPrefix value. + */ + String dnsPrefix(); + + /** + * @return the enablePodSecurityPolicy value. + */ + Boolean enablePodSecurityPolicy(); + + /** + * @return the enableRBAC value. + */ + Boolean enableRBAC(); + + /** + * @return the fqdn value. + */ + String fqdn(); + + /** + * @return the identity value. + */ + ManagedClusterIdentity identity(); + + /** + * @return the kubernetesVersion value. + */ + String kubernetesVersion(); + + /** + * @return the linuxProfile value. + */ + ContainerServiceLinuxProfile linuxProfile(); + + /** + * @return the maxAgentPools value. + */ + Integer maxAgentPools(); + + /** + * @return the networkProfile value. + */ + ContainerServiceNetworkProfile networkProfile(); + + /** + * @return the nodeResourceGroup value. + */ + String nodeResourceGroup(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the servicePrincipalProfile value. + */ + ManagedClusterServicePrincipalProfile servicePrincipalProfile(); + + /** + * @return the windowsProfile value. + */ + ManagedClusterWindowsProfile windowsProfile(); + + /** + * The entirety of the ManagedCluster definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of ManagedCluster definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ManagedCluster definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the ManagedCluster definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the managedcluster definition allowing to specify AadProfile. + */ + interface WithAadProfile { + /** + * Specifies aadProfile. + * @param aadProfile Profile of Azure Active Directory configuration + * @return the next definition stage + */ + WithCreate withAadProfile(ManagedClusterAADProfile aadProfile); + } + + /** + * The stage of the managedcluster definition allowing to specify AddonProfiles. + */ + interface WithAddonProfiles { + /** + * Specifies addonProfiles. + * @param addonProfiles Profile of managed cluster add-on + * @return the next definition stage + */ + WithCreate withAddonProfiles(Map addonProfiles); + } + + /** + * The stage of the managedcluster definition allowing to specify AgentPoolProfiles. + */ + interface WithAgentPoolProfiles { + /** + * Specifies agentPoolProfiles. + * @param agentPoolProfiles Properties of the agent pool + * @return the next definition stage + */ + WithCreate withAgentPoolProfiles(List agentPoolProfiles); + } + + /** + * The stage of the managedcluster definition allowing to specify ApiServerAccessProfile. + */ + interface WithApiServerAccessProfile { + /** + * Specifies apiServerAccessProfile. + * @param apiServerAccessProfile Access profile for managed cluster API server + * @return the next definition stage + */ + WithCreate withApiServerAccessProfile(ManagedClusterAPIServerAccessProfile apiServerAccessProfile); + } + + /** + * The stage of the managedcluster definition allowing to specify DnsPrefix. + */ + interface WithDnsPrefix { + /** + * Specifies dnsPrefix. + * @param dnsPrefix DNS prefix specified when creating the managed cluster + * @return the next definition stage + */ + WithCreate withDnsPrefix(String dnsPrefix); + } + + /** + * The stage of the managedcluster definition allowing to specify EnablePodSecurityPolicy. + */ + interface WithEnablePodSecurityPolicy { + /** + * Specifies enablePodSecurityPolicy. + * @param enablePodSecurityPolicy (PREVIEW) Whether to enable Kubernetes Pod security policy + * @return the next definition stage + */ + WithCreate withEnablePodSecurityPolicy(Boolean enablePodSecurityPolicy); + } + + /** + * The stage of the managedcluster definition allowing to specify EnableRBAC. + */ + interface WithEnableRBAC { + /** + * Specifies enableRBAC. + * @param enableRBAC Whether to enable Kubernetes Role-Based Access Control + * @return the next definition stage + */ + WithCreate withEnableRBAC(Boolean enableRBAC); + } + + /** + * The stage of the managedcluster definition allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + * @param identity The identity of the managed cluster, if configured + * @return the next definition stage + */ + WithCreate withIdentity(ManagedClusterIdentity identity); + } + + /** + * The stage of the managedcluster definition allowing to specify KubernetesVersion. + */ + interface WithKubernetesVersion { + /** + * Specifies kubernetesVersion. + * @param kubernetesVersion Version of Kubernetes specified when creating the managed cluster + * @return the next definition stage + */ + WithCreate withKubernetesVersion(String kubernetesVersion); + } + + /** + * The stage of the managedcluster definition allowing to specify LinuxProfile. + */ + interface WithLinuxProfile { + /** + * Specifies linuxProfile. + * @param linuxProfile Profile for Linux VMs in the container service cluster + * @return the next definition stage + */ + WithCreate withLinuxProfile(ContainerServiceLinuxProfile linuxProfile); + } + + /** + * The stage of the managedcluster definition allowing to specify NetworkProfile. + */ + interface WithNetworkProfile { + /** + * Specifies networkProfile. + * @param networkProfile Profile of network configuration + * @return the next definition stage + */ + WithCreate withNetworkProfile(ContainerServiceNetworkProfile networkProfile); + } + + /** + * The stage of the managedcluster definition allowing to specify NodeResourceGroup. + */ + interface WithNodeResourceGroup { + /** + * Specifies nodeResourceGroup. + * @param nodeResourceGroup Name of the resource group containing agent pool nodes + * @return the next definition stage + */ + WithCreate withNodeResourceGroup(String nodeResourceGroup); + } + + /** + * The stage of the managedcluster definition allowing to specify ServicePrincipalProfile. + */ + interface WithServicePrincipalProfile { + /** + * Specifies servicePrincipalProfile. + * @param servicePrincipalProfile Information about a service principal identity for the cluster to use for manipulating Azure APIs + * @return the next definition stage + */ + WithCreate withServicePrincipalProfile(ManagedClusterServicePrincipalProfile servicePrincipalProfile); + } + + /** + * The stage of the managedcluster definition allowing to specify WindowsProfile. + */ + interface WithWindowsProfile { + /** + * Specifies windowsProfile. + * @param windowsProfile Profile for Windows VMs in the container service cluster + * @return the next definition stage + */ + WithCreate withWindowsProfile(ManagedClusterWindowsProfile windowsProfile); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithAadProfile, DefinitionStages.WithAddonProfiles, DefinitionStages.WithAgentPoolProfiles, DefinitionStages.WithApiServerAccessProfile, DefinitionStages.WithDnsPrefix, DefinitionStages.WithEnablePodSecurityPolicy, DefinitionStages.WithEnableRBAC, DefinitionStages.WithIdentity, DefinitionStages.WithKubernetesVersion, DefinitionStages.WithLinuxProfile, DefinitionStages.WithNetworkProfile, DefinitionStages.WithNodeResourceGroup, DefinitionStages.WithServicePrincipalProfile, DefinitionStages.WithWindowsProfile { + } + } + /** + * The template for a ManagedCluster update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAadProfile, UpdateStages.WithAddonProfiles, UpdateStages.WithAgentPoolProfiles, UpdateStages.WithApiServerAccessProfile, UpdateStages.WithDnsPrefix, UpdateStages.WithEnablePodSecurityPolicy, UpdateStages.WithEnableRBAC, UpdateStages.WithIdentity, UpdateStages.WithKubernetesVersion, UpdateStages.WithLinuxProfile, UpdateStages.WithNetworkProfile, UpdateStages.WithNodeResourceGroup, UpdateStages.WithServicePrincipalProfile, UpdateStages.WithWindowsProfile { + } + + /** + * Grouping of ManagedCluster update stages. + */ + interface UpdateStages { + /** + * The stage of the managedcluster update allowing to specify AadProfile. + */ + interface WithAadProfile { + /** + * Specifies aadProfile. + * @param aadProfile Profile of Azure Active Directory configuration + * @return the next update stage + */ + Update withAadProfile(ManagedClusterAADProfile aadProfile); + } + + /** + * The stage of the managedcluster update allowing to specify AddonProfiles. + */ + interface WithAddonProfiles { + /** + * Specifies addonProfiles. + * @param addonProfiles Profile of managed cluster add-on + * @return the next update stage + */ + Update withAddonProfiles(Map addonProfiles); + } + + /** + * The stage of the managedcluster update allowing to specify AgentPoolProfiles. + */ + interface WithAgentPoolProfiles { + /** + * Specifies agentPoolProfiles. + * @param agentPoolProfiles Properties of the agent pool + * @return the next update stage + */ + Update withAgentPoolProfiles(List agentPoolProfiles); + } + + /** + * The stage of the managedcluster update allowing to specify ApiServerAccessProfile. + */ + interface WithApiServerAccessProfile { + /** + * Specifies apiServerAccessProfile. + * @param apiServerAccessProfile Access profile for managed cluster API server + * @return the next update stage + */ + Update withApiServerAccessProfile(ManagedClusterAPIServerAccessProfile apiServerAccessProfile); + } + + /** + * The stage of the managedcluster update allowing to specify DnsPrefix. + */ + interface WithDnsPrefix { + /** + * Specifies dnsPrefix. + * @param dnsPrefix DNS prefix specified when creating the managed cluster + * @return the next update stage + */ + Update withDnsPrefix(String dnsPrefix); + } + + /** + * The stage of the managedcluster update allowing to specify EnablePodSecurityPolicy. + */ + interface WithEnablePodSecurityPolicy { + /** + * Specifies enablePodSecurityPolicy. + * @param enablePodSecurityPolicy (PREVIEW) Whether to enable Kubernetes Pod security policy + * @return the next update stage + */ + Update withEnablePodSecurityPolicy(Boolean enablePodSecurityPolicy); + } + + /** + * The stage of the managedcluster update allowing to specify EnableRBAC. + */ + interface WithEnableRBAC { + /** + * Specifies enableRBAC. + * @param enableRBAC Whether to enable Kubernetes Role-Based Access Control + * @return the next update stage + */ + Update withEnableRBAC(Boolean enableRBAC); + } + + /** + * The stage of the managedcluster update allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + * @param identity The identity of the managed cluster, if configured + * @return the next update stage + */ + Update withIdentity(ManagedClusterIdentity identity); + } + + /** + * The stage of the managedcluster update allowing to specify KubernetesVersion. + */ + interface WithKubernetesVersion { + /** + * Specifies kubernetesVersion. + * @param kubernetesVersion Version of Kubernetes specified when creating the managed cluster + * @return the next update stage + */ + Update withKubernetesVersion(String kubernetesVersion); + } + + /** + * The stage of the managedcluster update allowing to specify LinuxProfile. + */ + interface WithLinuxProfile { + /** + * Specifies linuxProfile. + * @param linuxProfile Profile for Linux VMs in the container service cluster + * @return the next update stage + */ + Update withLinuxProfile(ContainerServiceLinuxProfile linuxProfile); + } + + /** + * The stage of the managedcluster update allowing to specify NetworkProfile. + */ + interface WithNetworkProfile { + /** + * Specifies networkProfile. + * @param networkProfile Profile of network configuration + * @return the next update stage + */ + Update withNetworkProfile(ContainerServiceNetworkProfile networkProfile); + } + + /** + * The stage of the managedcluster update allowing to specify NodeResourceGroup. + */ + interface WithNodeResourceGroup { + /** + * Specifies nodeResourceGroup. + * @param nodeResourceGroup Name of the resource group containing agent pool nodes + * @return the next update stage + */ + Update withNodeResourceGroup(String nodeResourceGroup); + } + + /** + * The stage of the managedcluster update allowing to specify ServicePrincipalProfile. + */ + interface WithServicePrincipalProfile { + /** + * Specifies servicePrincipalProfile. + * @param servicePrincipalProfile Information about a service principal identity for the cluster to use for manipulating Azure APIs + * @return the next update stage + */ + Update withServicePrincipalProfile(ManagedClusterServicePrincipalProfile servicePrincipalProfile); + } + + /** + * The stage of the managedcluster update allowing to specify WindowsProfile. + */ + interface WithWindowsProfile { + /** + * Specifies windowsProfile. + * @param windowsProfile Profile for Windows VMs in the container service cluster + * @return the next update stage + */ + Update withWindowsProfile(ManagedClusterWindowsProfile windowsProfile); + } + + } +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterAADProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterAADProfile.java new file mode 100644 index 000000000000..5bb7d3effab8 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterAADProfile.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * AADProfile specifies attributes for Azure Active Directory integration. + */ +public class ManagedClusterAADProfile { + /** + * The client AAD application ID. + */ + @JsonProperty(value = "clientAppID", required = true) + private String clientAppID; + + /** + * The server AAD application ID. + */ + @JsonProperty(value = "serverAppID", required = true) + private String serverAppID; + + /** + * The server AAD application secret. + */ + @JsonProperty(value = "serverAppSecret") + private String serverAppSecret; + + /** + * The AAD tenant ID to use for authentication. If not specified, will use + * the tenant of the deployment subscription. + */ + @JsonProperty(value = "tenantID") + private String tenantID; + + /** + * Get the client AAD application ID. + * + * @return the clientAppID value + */ + public String clientAppID() { + return this.clientAppID; + } + + /** + * Set the client AAD application ID. + * + * @param clientAppID the clientAppID value to set + * @return the ManagedClusterAADProfile object itself. + */ + public ManagedClusterAADProfile withClientAppID(String clientAppID) { + this.clientAppID = clientAppID; + return this; + } + + /** + * Get the server AAD application ID. + * + * @return the serverAppID value + */ + public String serverAppID() { + return this.serverAppID; + } + + /** + * Set the server AAD application ID. + * + * @param serverAppID the serverAppID value to set + * @return the ManagedClusterAADProfile object itself. + */ + public ManagedClusterAADProfile withServerAppID(String serverAppID) { + this.serverAppID = serverAppID; + return this; + } + + /** + * Get the server AAD application secret. + * + * @return the serverAppSecret value + */ + public String serverAppSecret() { + return this.serverAppSecret; + } + + /** + * Set the server AAD application secret. + * + * @param serverAppSecret the serverAppSecret value to set + * @return the ManagedClusterAADProfile object itself. + */ + public ManagedClusterAADProfile withServerAppSecret(String serverAppSecret) { + this.serverAppSecret = serverAppSecret; + return this; + } + + /** + * Get the AAD tenant ID to use for authentication. If not specified, will use the tenant of the deployment subscription. + * + * @return the tenantID value + */ + public String tenantID() { + return this.tenantID; + } + + /** + * Set the AAD tenant ID to use for authentication. If not specified, will use the tenant of the deployment subscription. + * + * @param tenantID the tenantID value to set + * @return the ManagedClusterAADProfile object itself. + */ + public ManagedClusterAADProfile withTenantID(String tenantID) { + this.tenantID = tenantID; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterAPIServerAccessProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterAPIServerAccessProfile.java new file mode 100644 index 000000000000..e28893148faa --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterAPIServerAccessProfile.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Access profile for managed cluster API server. + */ +public class ManagedClusterAPIServerAccessProfile { + /** + * Authorized IP Ranges to kubernetes API server. + */ + @JsonProperty(value = "authorizedIPRanges") + private List authorizedIPRanges; + + /** + * Whether to create the cluster as a private cluster or not. + */ + @JsonProperty(value = "enablePrivateCluster") + private Boolean enablePrivateCluster; + + /** + * Get authorized IP Ranges to kubernetes API server. + * + * @return the authorizedIPRanges value + */ + public List authorizedIPRanges() { + return this.authorizedIPRanges; + } + + /** + * Set authorized IP Ranges to kubernetes API server. + * + * @param authorizedIPRanges the authorizedIPRanges value to set + * @return the ManagedClusterAPIServerAccessProfile object itself. + */ + public ManagedClusterAPIServerAccessProfile withAuthorizedIPRanges(List authorizedIPRanges) { + this.authorizedIPRanges = authorizedIPRanges; + return this; + } + + /** + * Get whether to create the cluster as a private cluster or not. + * + * @return the enablePrivateCluster value + */ + public Boolean enablePrivateCluster() { + return this.enablePrivateCluster; + } + + /** + * Set whether to create the cluster as a private cluster or not. + * + * @param enablePrivateCluster the enablePrivateCluster value to set + * @return the ManagedClusterAPIServerAccessProfile object itself. + */ + public ManagedClusterAPIServerAccessProfile withEnablePrivateCluster(Boolean enablePrivateCluster) { + this.enablePrivateCluster = enablePrivateCluster; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterAccessProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterAccessProfile.java new file mode 100644 index 000000000000..c11a33700689 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterAccessProfile.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.ContainerServiceManager; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.ManagedClusterAccessProfileInner; +import java.util.Map; + +/** + * Type representing ManagedClusterAccessProfile. + */ +public interface ManagedClusterAccessProfile extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the kubeConfig value. + */ + byte[] kubeConfig(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterAddonProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterAddonProfile.java new file mode 100644 index 000000000000..6700ba66acb0 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterAddonProfile.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A Kubernetes add-on profile for a managed cluster. + */ +public class ManagedClusterAddonProfile { + /** + * Whether the add-on is enabled or not. + */ + @JsonProperty(value = "enabled", required = true) + private boolean enabled; + + /** + * Key-value pairs for configuring an add-on. + */ + @JsonProperty(value = "config") + private Map config; + + /** + * Get whether the add-on is enabled or not. + * + * @return the enabled value + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set whether the add-on is enabled or not. + * + * @param enabled the enabled value to set + * @return the ManagedClusterAddonProfile object itself. + */ + public ManagedClusterAddonProfile withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get key-value pairs for configuring an add-on. + * + * @return the config value + */ + public Map config() { + return this.config; + } + + /** + * Set key-value pairs for configuring an add-on. + * + * @param config the config value to set + * @return the ManagedClusterAddonProfile object itself. + */ + public ManagedClusterAddonProfile withConfig(Map config) { + this.config = config; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterAgentPoolProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterAgentPoolProfile.java new file mode 100644 index 000000000000..4af0e3f80c1c --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterAgentPoolProfile.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Profile for the container service agent pool. + */ +public class ManagedClusterAgentPoolProfile extends ManagedClusterAgentPoolProfileProperties { + /** + * Unique name of the agent pool profile in the context of the subscription + * and resource group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Get unique name of the agent pool profile in the context of the subscription and resource group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set unique name of the agent pool profile in the context of the subscription and resource group. + * + * @param name the name value to set + * @return the ManagedClusterAgentPoolProfile object itself. + */ + public ManagedClusterAgentPoolProfile withName(String name) { + this.name = name; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterAgentPoolProfileProperties.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterAgentPoolProfileProperties.java new file mode 100644 index 000000000000..71a75d7f1378 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterAgentPoolProfileProperties.java @@ -0,0 +1,511 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties for the container service agent pool profile. + */ +public class ManagedClusterAgentPoolProfileProperties { + /** + * Number of agents (VMs) to host docker containers. Allowed values must be + * in the range of 1 to 100 (inclusive). The default value is 1. + */ + @JsonProperty(value = "count", required = true) + private int count; + + /** + * Size of agent VMs. Possible values include: 'Standard_A1', + * 'Standard_A10', 'Standard_A11', 'Standard_A1_v2', 'Standard_A2', + * 'Standard_A2_v2', 'Standard_A2m_v2', 'Standard_A3', 'Standard_A4', + * 'Standard_A4_v2', 'Standard_A4m_v2', 'Standard_A5', 'Standard_A6', + * 'Standard_A7', 'Standard_A8', 'Standard_A8_v2', 'Standard_A8m_v2', + * 'Standard_A9', 'Standard_B2ms', 'Standard_B2s', 'Standard_B4ms', + * 'Standard_B8ms', 'Standard_D1', 'Standard_D11', 'Standard_D11_v2', + * 'Standard_D11_v2_Promo', 'Standard_D12', 'Standard_D12_v2', + * 'Standard_D12_v2_Promo', 'Standard_D13', 'Standard_D13_v2', + * 'Standard_D13_v2_Promo', 'Standard_D14', 'Standard_D14_v2', + * 'Standard_D14_v2_Promo', 'Standard_D15_v2', 'Standard_D16_v3', + * 'Standard_D16s_v3', 'Standard_D1_v2', 'Standard_D2', 'Standard_D2_v2', + * 'Standard_D2_v2_Promo', 'Standard_D2_v3', 'Standard_D2s_v3', + * 'Standard_D3', 'Standard_D32_v3', 'Standard_D32s_v3', 'Standard_D3_v2', + * 'Standard_D3_v2_Promo', 'Standard_D4', 'Standard_D4_v2', + * 'Standard_D4_v2_Promo', 'Standard_D4_v3', 'Standard_D4s_v3', + * 'Standard_D5_v2', 'Standard_D5_v2_Promo', 'Standard_D64_v3', + * 'Standard_D64s_v3', 'Standard_D8_v3', 'Standard_D8s_v3', 'Standard_DS1', + * 'Standard_DS11', 'Standard_DS11_v2', 'Standard_DS11_v2_Promo', + * 'Standard_DS12', 'Standard_DS12_v2', 'Standard_DS12_v2_Promo', + * 'Standard_DS13', 'Standard_DS13-2_v2', 'Standard_DS13-4_v2', + * 'Standard_DS13_v2', 'Standard_DS13_v2_Promo', 'Standard_DS14', + * 'Standard_DS14-4_v2', 'Standard_DS14-8_v2', 'Standard_DS14_v2', + * 'Standard_DS14_v2_Promo', 'Standard_DS15_v2', 'Standard_DS1_v2', + * 'Standard_DS2', 'Standard_DS2_v2', 'Standard_DS2_v2_Promo', + * 'Standard_DS3', 'Standard_DS3_v2', 'Standard_DS3_v2_Promo', + * 'Standard_DS4', 'Standard_DS4_v2', 'Standard_DS4_v2_Promo', + * 'Standard_DS5_v2', 'Standard_DS5_v2_Promo', 'Standard_E16_v3', + * 'Standard_E16s_v3', 'Standard_E2_v3', 'Standard_E2s_v3', + * 'Standard_E32-16s_v3', 'Standard_E32-8s_v3', 'Standard_E32_v3', + * 'Standard_E32s_v3', 'Standard_E4_v3', 'Standard_E4s_v3', + * 'Standard_E64-16s_v3', 'Standard_E64-32s_v3', 'Standard_E64_v3', + * 'Standard_E64s_v3', 'Standard_E8_v3', 'Standard_E8s_v3', 'Standard_F1', + * 'Standard_F16', 'Standard_F16s', 'Standard_F16s_v2', 'Standard_F1s', + * 'Standard_F2', 'Standard_F2s', 'Standard_F2s_v2', 'Standard_F32s_v2', + * 'Standard_F4', 'Standard_F4s', 'Standard_F4s_v2', 'Standard_F64s_v2', + * 'Standard_F72s_v2', 'Standard_F8', 'Standard_F8s', 'Standard_F8s_v2', + * 'Standard_G1', 'Standard_G2', 'Standard_G3', 'Standard_G4', + * 'Standard_G5', 'Standard_GS1', 'Standard_GS2', 'Standard_GS3', + * 'Standard_GS4', 'Standard_GS4-4', 'Standard_GS4-8', 'Standard_GS5', + * 'Standard_GS5-16', 'Standard_GS5-8', 'Standard_H16', 'Standard_H16m', + * 'Standard_H16mr', 'Standard_H16r', 'Standard_H8', 'Standard_H8m', + * 'Standard_L16s', 'Standard_L32s', 'Standard_L4s', 'Standard_L8s', + * 'Standard_M128-32ms', 'Standard_M128-64ms', 'Standard_M128ms', + * 'Standard_M128s', 'Standard_M64-16ms', 'Standard_M64-32ms', + * 'Standard_M64ms', 'Standard_M64s', 'Standard_NC12', 'Standard_NC12s_v2', + * 'Standard_NC12s_v3', 'Standard_NC24', 'Standard_NC24r', + * 'Standard_NC24rs_v2', 'Standard_NC24rs_v3', 'Standard_NC24s_v2', + * 'Standard_NC24s_v3', 'Standard_NC6', 'Standard_NC6s_v2', + * 'Standard_NC6s_v3', 'Standard_ND12s', 'Standard_ND24rs', + * 'Standard_ND24s', 'Standard_ND6s', 'Standard_NV12', 'Standard_NV24', + * 'Standard_NV6'. + */ + @JsonProperty(value = "vmSize", required = true) + private ContainerServiceVMSizeTypes vmSize; + + /** + * OS Disk Size in GB to be used to specify the disk size for every machine + * in this master/agent pool. If you specify 0, it will apply the default + * osDisk size according to the vmSize specified. + */ + @JsonProperty(value = "osDiskSizeGB") + private Integer osDiskSizeGB; + + /** + * VNet SubnetID specifies the VNet's subnet identifier. + */ + @JsonProperty(value = "vnetSubnetID") + private String vnetSubnetID; + + /** + * Maximum number of pods that can run on a node. + */ + @JsonProperty(value = "maxPods") + private Integer maxPods; + + /** + * OsType to be used to specify os type. Choose from Linux and Windows. + * Default to Linux. Possible values include: 'Linux', 'Windows'. + */ + @JsonProperty(value = "osType") + private OSType osType; + + /** + * Maximum number of nodes for auto-scaling. + */ + @JsonProperty(value = "maxCount") + private Integer maxCount; + + /** + * Minimum number of nodes for auto-scaling. + */ + @JsonProperty(value = "minCount") + private Integer minCount; + + /** + * Whether to enable auto-scaler. + */ + @JsonProperty(value = "enableAutoScaling") + private Boolean enableAutoScaling; + + /** + * AgentPoolType represents types of an agent pool. Possible values + * include: 'VirtualMachineScaleSets', 'AvailabilitySet'. + */ + @JsonProperty(value = "type") + private AgentPoolType type; + + /** + * Version of orchestrator specified when creating the managed cluster. + */ + @JsonProperty(value = "orchestratorVersion") + private String orchestratorVersion; + + /** + * The current deployment or provisioning state, which only appears in the + * response. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * (PREVIEW) Availability zones for nodes. Must use VirtualMachineScaleSets + * AgentPoolType. + */ + @JsonProperty(value = "availabilityZones") + private List availabilityZones; + + /** + * Enable public IP for nodes. + */ + @JsonProperty(value = "enableNodePublicIP") + private Boolean enableNodePublicIP; + + /** + * ScaleSetPriority to be used to specify virtual machine scale set + * priority. Default to regular. Possible values include: 'Low', 'Regular'. + */ + @JsonProperty(value = "scaleSetPriority") + private ScaleSetPriority scaleSetPriority; + + /** + * ScaleSetEvictionPolicy to be used to specify eviction policy for low + * priority virtual machine scale set. Default to Delete. Possible values + * include: 'Delete', 'Deallocate'. + */ + @JsonProperty(value = "scaleSetEvictionPolicy") + private ScaleSetEvictionPolicy scaleSetEvictionPolicy; + + /** + * Taints added to new nodes during node pool create and scale. For + * example, key=value:NoSchedule. + */ + @JsonProperty(value = "nodeTaints") + private List nodeTaints; + + /** + * Get number of agents (VMs) to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. + * + * @return the count value + */ + public int count() { + return this.count; + } + + /** + * Set number of agents (VMs) to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. + * + * @param count the count value to set + * @return the ManagedClusterAgentPoolProfileProperties object itself. + */ + public ManagedClusterAgentPoolProfileProperties withCount(int count) { + this.count = count; + return this; + } + + /** + * Get size of agent VMs. Possible values include: 'Standard_A1', 'Standard_A10', 'Standard_A11', 'Standard_A1_v2', 'Standard_A2', 'Standard_A2_v2', 'Standard_A2m_v2', 'Standard_A3', 'Standard_A4', 'Standard_A4_v2', 'Standard_A4m_v2', 'Standard_A5', 'Standard_A6', 'Standard_A7', 'Standard_A8', 'Standard_A8_v2', 'Standard_A8m_v2', 'Standard_A9', 'Standard_B2ms', 'Standard_B2s', 'Standard_B4ms', 'Standard_B8ms', 'Standard_D1', 'Standard_D11', 'Standard_D11_v2', 'Standard_D11_v2_Promo', 'Standard_D12', 'Standard_D12_v2', 'Standard_D12_v2_Promo', 'Standard_D13', 'Standard_D13_v2', 'Standard_D13_v2_Promo', 'Standard_D14', 'Standard_D14_v2', 'Standard_D14_v2_Promo', 'Standard_D15_v2', 'Standard_D16_v3', 'Standard_D16s_v3', 'Standard_D1_v2', 'Standard_D2', 'Standard_D2_v2', 'Standard_D2_v2_Promo', 'Standard_D2_v3', 'Standard_D2s_v3', 'Standard_D3', 'Standard_D32_v3', 'Standard_D32s_v3', 'Standard_D3_v2', 'Standard_D3_v2_Promo', 'Standard_D4', 'Standard_D4_v2', 'Standard_D4_v2_Promo', 'Standard_D4_v3', 'Standard_D4s_v3', 'Standard_D5_v2', 'Standard_D5_v2_Promo', 'Standard_D64_v3', 'Standard_D64s_v3', 'Standard_D8_v3', 'Standard_D8s_v3', 'Standard_DS1', 'Standard_DS11', 'Standard_DS11_v2', 'Standard_DS11_v2_Promo', 'Standard_DS12', 'Standard_DS12_v2', 'Standard_DS12_v2_Promo', 'Standard_DS13', 'Standard_DS13-2_v2', 'Standard_DS13-4_v2', 'Standard_DS13_v2', 'Standard_DS13_v2_Promo', 'Standard_DS14', 'Standard_DS14-4_v2', 'Standard_DS14-8_v2', 'Standard_DS14_v2', 'Standard_DS14_v2_Promo', 'Standard_DS15_v2', 'Standard_DS1_v2', 'Standard_DS2', 'Standard_DS2_v2', 'Standard_DS2_v2_Promo', 'Standard_DS3', 'Standard_DS3_v2', 'Standard_DS3_v2_Promo', 'Standard_DS4', 'Standard_DS4_v2', 'Standard_DS4_v2_Promo', 'Standard_DS5_v2', 'Standard_DS5_v2_Promo', 'Standard_E16_v3', 'Standard_E16s_v3', 'Standard_E2_v3', 'Standard_E2s_v3', 'Standard_E32-16s_v3', 'Standard_E32-8s_v3', 'Standard_E32_v3', 'Standard_E32s_v3', 'Standard_E4_v3', 'Standard_E4s_v3', 'Standard_E64-16s_v3', 'Standard_E64-32s_v3', 'Standard_E64_v3', 'Standard_E64s_v3', 'Standard_E8_v3', 'Standard_E8s_v3', 'Standard_F1', 'Standard_F16', 'Standard_F16s', 'Standard_F16s_v2', 'Standard_F1s', 'Standard_F2', 'Standard_F2s', 'Standard_F2s_v2', 'Standard_F32s_v2', 'Standard_F4', 'Standard_F4s', 'Standard_F4s_v2', 'Standard_F64s_v2', 'Standard_F72s_v2', 'Standard_F8', 'Standard_F8s', 'Standard_F8s_v2', 'Standard_G1', 'Standard_G2', 'Standard_G3', 'Standard_G4', 'Standard_G5', 'Standard_GS1', 'Standard_GS2', 'Standard_GS3', 'Standard_GS4', 'Standard_GS4-4', 'Standard_GS4-8', 'Standard_GS5', 'Standard_GS5-16', 'Standard_GS5-8', 'Standard_H16', 'Standard_H16m', 'Standard_H16mr', 'Standard_H16r', 'Standard_H8', 'Standard_H8m', 'Standard_L16s', 'Standard_L32s', 'Standard_L4s', 'Standard_L8s', 'Standard_M128-32ms', 'Standard_M128-64ms', 'Standard_M128ms', 'Standard_M128s', 'Standard_M64-16ms', 'Standard_M64-32ms', 'Standard_M64ms', 'Standard_M64s', 'Standard_NC12', 'Standard_NC12s_v2', 'Standard_NC12s_v3', 'Standard_NC24', 'Standard_NC24r', 'Standard_NC24rs_v2', 'Standard_NC24rs_v3', 'Standard_NC24s_v2', 'Standard_NC24s_v3', 'Standard_NC6', 'Standard_NC6s_v2', 'Standard_NC6s_v3', 'Standard_ND12s', 'Standard_ND24rs', 'Standard_ND24s', 'Standard_ND6s', 'Standard_NV12', 'Standard_NV24', 'Standard_NV6'. + * + * @return the vmSize value + */ + public ContainerServiceVMSizeTypes vmSize() { + return this.vmSize; + } + + /** + * Set size of agent VMs. Possible values include: 'Standard_A1', 'Standard_A10', 'Standard_A11', 'Standard_A1_v2', 'Standard_A2', 'Standard_A2_v2', 'Standard_A2m_v2', 'Standard_A3', 'Standard_A4', 'Standard_A4_v2', 'Standard_A4m_v2', 'Standard_A5', 'Standard_A6', 'Standard_A7', 'Standard_A8', 'Standard_A8_v2', 'Standard_A8m_v2', 'Standard_A9', 'Standard_B2ms', 'Standard_B2s', 'Standard_B4ms', 'Standard_B8ms', 'Standard_D1', 'Standard_D11', 'Standard_D11_v2', 'Standard_D11_v2_Promo', 'Standard_D12', 'Standard_D12_v2', 'Standard_D12_v2_Promo', 'Standard_D13', 'Standard_D13_v2', 'Standard_D13_v2_Promo', 'Standard_D14', 'Standard_D14_v2', 'Standard_D14_v2_Promo', 'Standard_D15_v2', 'Standard_D16_v3', 'Standard_D16s_v3', 'Standard_D1_v2', 'Standard_D2', 'Standard_D2_v2', 'Standard_D2_v2_Promo', 'Standard_D2_v3', 'Standard_D2s_v3', 'Standard_D3', 'Standard_D32_v3', 'Standard_D32s_v3', 'Standard_D3_v2', 'Standard_D3_v2_Promo', 'Standard_D4', 'Standard_D4_v2', 'Standard_D4_v2_Promo', 'Standard_D4_v3', 'Standard_D4s_v3', 'Standard_D5_v2', 'Standard_D5_v2_Promo', 'Standard_D64_v3', 'Standard_D64s_v3', 'Standard_D8_v3', 'Standard_D8s_v3', 'Standard_DS1', 'Standard_DS11', 'Standard_DS11_v2', 'Standard_DS11_v2_Promo', 'Standard_DS12', 'Standard_DS12_v2', 'Standard_DS12_v2_Promo', 'Standard_DS13', 'Standard_DS13-2_v2', 'Standard_DS13-4_v2', 'Standard_DS13_v2', 'Standard_DS13_v2_Promo', 'Standard_DS14', 'Standard_DS14-4_v2', 'Standard_DS14-8_v2', 'Standard_DS14_v2', 'Standard_DS14_v2_Promo', 'Standard_DS15_v2', 'Standard_DS1_v2', 'Standard_DS2', 'Standard_DS2_v2', 'Standard_DS2_v2_Promo', 'Standard_DS3', 'Standard_DS3_v2', 'Standard_DS3_v2_Promo', 'Standard_DS4', 'Standard_DS4_v2', 'Standard_DS4_v2_Promo', 'Standard_DS5_v2', 'Standard_DS5_v2_Promo', 'Standard_E16_v3', 'Standard_E16s_v3', 'Standard_E2_v3', 'Standard_E2s_v3', 'Standard_E32-16s_v3', 'Standard_E32-8s_v3', 'Standard_E32_v3', 'Standard_E32s_v3', 'Standard_E4_v3', 'Standard_E4s_v3', 'Standard_E64-16s_v3', 'Standard_E64-32s_v3', 'Standard_E64_v3', 'Standard_E64s_v3', 'Standard_E8_v3', 'Standard_E8s_v3', 'Standard_F1', 'Standard_F16', 'Standard_F16s', 'Standard_F16s_v2', 'Standard_F1s', 'Standard_F2', 'Standard_F2s', 'Standard_F2s_v2', 'Standard_F32s_v2', 'Standard_F4', 'Standard_F4s', 'Standard_F4s_v2', 'Standard_F64s_v2', 'Standard_F72s_v2', 'Standard_F8', 'Standard_F8s', 'Standard_F8s_v2', 'Standard_G1', 'Standard_G2', 'Standard_G3', 'Standard_G4', 'Standard_G5', 'Standard_GS1', 'Standard_GS2', 'Standard_GS3', 'Standard_GS4', 'Standard_GS4-4', 'Standard_GS4-8', 'Standard_GS5', 'Standard_GS5-16', 'Standard_GS5-8', 'Standard_H16', 'Standard_H16m', 'Standard_H16mr', 'Standard_H16r', 'Standard_H8', 'Standard_H8m', 'Standard_L16s', 'Standard_L32s', 'Standard_L4s', 'Standard_L8s', 'Standard_M128-32ms', 'Standard_M128-64ms', 'Standard_M128ms', 'Standard_M128s', 'Standard_M64-16ms', 'Standard_M64-32ms', 'Standard_M64ms', 'Standard_M64s', 'Standard_NC12', 'Standard_NC12s_v2', 'Standard_NC12s_v3', 'Standard_NC24', 'Standard_NC24r', 'Standard_NC24rs_v2', 'Standard_NC24rs_v3', 'Standard_NC24s_v2', 'Standard_NC24s_v3', 'Standard_NC6', 'Standard_NC6s_v2', 'Standard_NC6s_v3', 'Standard_ND12s', 'Standard_ND24rs', 'Standard_ND24s', 'Standard_ND6s', 'Standard_NV12', 'Standard_NV24', 'Standard_NV6'. + * + * @param vmSize the vmSize value to set + * @return the ManagedClusterAgentPoolProfileProperties object itself. + */ + public ManagedClusterAgentPoolProfileProperties withVmSize(ContainerServiceVMSizeTypes vmSize) { + this.vmSize = vmSize; + return this; + } + + /** + * Get oS Disk Size in GB to be used to specify the disk size for every machine in this master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. + * + * @return the osDiskSizeGB value + */ + public Integer osDiskSizeGB() { + return this.osDiskSizeGB; + } + + /** + * Set oS Disk Size in GB to be used to specify the disk size for every machine in this master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. + * + * @param osDiskSizeGB the osDiskSizeGB value to set + * @return the ManagedClusterAgentPoolProfileProperties object itself. + */ + public ManagedClusterAgentPoolProfileProperties withOsDiskSizeGB(Integer osDiskSizeGB) { + this.osDiskSizeGB = osDiskSizeGB; + return this; + } + + /** + * Get vNet SubnetID specifies the VNet's subnet identifier. + * + * @return the vnetSubnetID value + */ + public String vnetSubnetID() { + return this.vnetSubnetID; + } + + /** + * Set vNet SubnetID specifies the VNet's subnet identifier. + * + * @param vnetSubnetID the vnetSubnetID value to set + * @return the ManagedClusterAgentPoolProfileProperties object itself. + */ + public ManagedClusterAgentPoolProfileProperties withVnetSubnetID(String vnetSubnetID) { + this.vnetSubnetID = vnetSubnetID; + return this; + } + + /** + * Get maximum number of pods that can run on a node. + * + * @return the maxPods value + */ + public Integer maxPods() { + return this.maxPods; + } + + /** + * Set maximum number of pods that can run on a node. + * + * @param maxPods the maxPods value to set + * @return the ManagedClusterAgentPoolProfileProperties object itself. + */ + public ManagedClusterAgentPoolProfileProperties withMaxPods(Integer maxPods) { + this.maxPods = maxPods; + return this; + } + + /** + * Get osType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: 'Linux', 'Windows'. + * + * @return the osType value + */ + public OSType osType() { + return this.osType; + } + + /** + * Set osType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: 'Linux', 'Windows'. + * + * @param osType the osType value to set + * @return the ManagedClusterAgentPoolProfileProperties object itself. + */ + public ManagedClusterAgentPoolProfileProperties withOsType(OSType osType) { + this.osType = osType; + return this; + } + + /** + * Get maximum number of nodes for auto-scaling. + * + * @return the maxCount value + */ + public Integer maxCount() { + return this.maxCount; + } + + /** + * Set maximum number of nodes for auto-scaling. + * + * @param maxCount the maxCount value to set + * @return the ManagedClusterAgentPoolProfileProperties object itself. + */ + public ManagedClusterAgentPoolProfileProperties withMaxCount(Integer maxCount) { + this.maxCount = maxCount; + return this; + } + + /** + * Get minimum number of nodes for auto-scaling. + * + * @return the minCount value + */ + public Integer minCount() { + return this.minCount; + } + + /** + * Set minimum number of nodes for auto-scaling. + * + * @param minCount the minCount value to set + * @return the ManagedClusterAgentPoolProfileProperties object itself. + */ + public ManagedClusterAgentPoolProfileProperties withMinCount(Integer minCount) { + this.minCount = minCount; + return this; + } + + /** + * Get whether to enable auto-scaler. + * + * @return the enableAutoScaling value + */ + public Boolean enableAutoScaling() { + return this.enableAutoScaling; + } + + /** + * Set whether to enable auto-scaler. + * + * @param enableAutoScaling the enableAutoScaling value to set + * @return the ManagedClusterAgentPoolProfileProperties object itself. + */ + public ManagedClusterAgentPoolProfileProperties withEnableAutoScaling(Boolean enableAutoScaling) { + this.enableAutoScaling = enableAutoScaling; + return this; + } + + /** + * Get agentPoolType represents types of an agent pool. Possible values include: 'VirtualMachineScaleSets', 'AvailabilitySet'. + * + * @return the type value + */ + public AgentPoolType type() { + return this.type; + } + + /** + * Set agentPoolType represents types of an agent pool. Possible values include: 'VirtualMachineScaleSets', 'AvailabilitySet'. + * + * @param type the type value to set + * @return the ManagedClusterAgentPoolProfileProperties object itself. + */ + public ManagedClusterAgentPoolProfileProperties withType(AgentPoolType type) { + this.type = type; + return this; + } + + /** + * Get version of orchestrator specified when creating the managed cluster. + * + * @return the orchestratorVersion value + */ + public String orchestratorVersion() { + return this.orchestratorVersion; + } + + /** + * Set version of orchestrator specified when creating the managed cluster. + * + * @param orchestratorVersion the orchestratorVersion value to set + * @return the ManagedClusterAgentPoolProfileProperties object itself. + */ + public ManagedClusterAgentPoolProfileProperties withOrchestratorVersion(String orchestratorVersion) { + this.orchestratorVersion = orchestratorVersion; + return this; + } + + /** + * Get the current deployment or provisioning state, which only appears in the response. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get (PREVIEW) Availability zones for nodes. Must use VirtualMachineScaleSets AgentPoolType. + * + * @return the availabilityZones value + */ + public List availabilityZones() { + return this.availabilityZones; + } + + /** + * Set (PREVIEW) Availability zones for nodes. Must use VirtualMachineScaleSets AgentPoolType. + * + * @param availabilityZones the availabilityZones value to set + * @return the ManagedClusterAgentPoolProfileProperties object itself. + */ + public ManagedClusterAgentPoolProfileProperties withAvailabilityZones(List availabilityZones) { + this.availabilityZones = availabilityZones; + return this; + } + + /** + * Get enable public IP for nodes. + * + * @return the enableNodePublicIP value + */ + public Boolean enableNodePublicIP() { + return this.enableNodePublicIP; + } + + /** + * Set enable public IP for nodes. + * + * @param enableNodePublicIP the enableNodePublicIP value to set + * @return the ManagedClusterAgentPoolProfileProperties object itself. + */ + public ManagedClusterAgentPoolProfileProperties withEnableNodePublicIP(Boolean enableNodePublicIP) { + this.enableNodePublicIP = enableNodePublicIP; + return this; + } + + /** + * Get scaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. Possible values include: 'Low', 'Regular'. + * + * @return the scaleSetPriority value + */ + public ScaleSetPriority scaleSetPriority() { + return this.scaleSetPriority; + } + + /** + * Set scaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. Possible values include: 'Low', 'Regular'. + * + * @param scaleSetPriority the scaleSetPriority value to set + * @return the ManagedClusterAgentPoolProfileProperties object itself. + */ + public ManagedClusterAgentPoolProfileProperties withScaleSetPriority(ScaleSetPriority scaleSetPriority) { + this.scaleSetPriority = scaleSetPriority; + return this; + } + + /** + * Get scaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. Possible values include: 'Delete', 'Deallocate'. + * + * @return the scaleSetEvictionPolicy value + */ + public ScaleSetEvictionPolicy scaleSetEvictionPolicy() { + return this.scaleSetEvictionPolicy; + } + + /** + * Set scaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. Possible values include: 'Delete', 'Deallocate'. + * + * @param scaleSetEvictionPolicy the scaleSetEvictionPolicy value to set + * @return the ManagedClusterAgentPoolProfileProperties object itself. + */ + public ManagedClusterAgentPoolProfileProperties withScaleSetEvictionPolicy(ScaleSetEvictionPolicy scaleSetEvictionPolicy) { + this.scaleSetEvictionPolicy = scaleSetEvictionPolicy; + return this; + } + + /** + * Get taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + * + * @return the nodeTaints value + */ + public List nodeTaints() { + return this.nodeTaints; + } + + /** + * Set taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + * + * @param nodeTaints the nodeTaints value to set + * @return the ManagedClusterAgentPoolProfileProperties object itself. + */ + public ManagedClusterAgentPoolProfileProperties withNodeTaints(List nodeTaints) { + this.nodeTaints = nodeTaints; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterIdentity.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterIdentity.java new file mode 100644 index 000000000000..90f8a418b46a --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterIdentity.java @@ -0,0 +1,80 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Identity for the managed cluster. + */ +public class ManagedClusterIdentity { + /** + * The principal id of the system assigned identity which is used by master + * components. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /** + * The tenant id of the system assigned identity which is used by master + * components. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * The type of identity used for the managed cluster. Type 'SystemAssigned' + * will use an implicitly created identity in master components and an + * auto-created user assigned identity in MC_ resource group in agent + * nodes. Type 'None' will not use MSI for the managed cluster, service + * principal will be used instead. Possible values include: + * 'SystemAssigned', 'None'. + */ + @JsonProperty(value = "type") + private ResourceIdentityType type; + + /** + * Get the principal id of the system assigned identity which is used by master components. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenant id of the system assigned identity which is used by master components. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service principal will be used instead. Possible values include: 'SystemAssigned', 'None'. + * + * @return the type value + */ + public ResourceIdentityType type() { + return this.type; + } + + /** + * Set the type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service principal will be used instead. Possible values include: 'SystemAssigned', 'None'. + * + * @param type the type value to set + * @return the ManagedClusterIdentity object itself. + */ + public ManagedClusterIdentity withType(ResourceIdentityType type) { + this.type = type; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterLoadBalancerProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterLoadBalancerProfile.java new file mode 100644 index 000000000000..1a8b539f9bf8 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterLoadBalancerProfile.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Profile of the managed cluster load balancer. + */ +public class ManagedClusterLoadBalancerProfile { + /** + * Desired managed outbound IPs for the cluster load balancer. + */ + @JsonProperty(value = "managedOutboundIPs") + private ManagedClusterLoadBalancerProfileManagedOutboundIPs managedOutboundIPs; + + /** + * Desired outbound IP Prefix resources for the cluster load balancer. + */ + @JsonProperty(value = "outboundIPPrefixes") + private ManagedClusterLoadBalancerProfileOutboundIPPrefixes outboundIPPrefixes; + + /** + * Desired outbound IP resources for the cluster load balancer. + */ + @JsonProperty(value = "outboundIPs") + private ManagedClusterLoadBalancerProfileOutboundIPs outboundIPs; + + /** + * The effective outbound IP resources of the cluster load balancer. + */ + @JsonProperty(value = "effectiveOutboundIPs") + private List effectiveOutboundIPs; + + /** + * Get desired managed outbound IPs for the cluster load balancer. + * + * @return the managedOutboundIPs value + */ + public ManagedClusterLoadBalancerProfileManagedOutboundIPs managedOutboundIPs() { + return this.managedOutboundIPs; + } + + /** + * Set desired managed outbound IPs for the cluster load balancer. + * + * @param managedOutboundIPs the managedOutboundIPs value to set + * @return the ManagedClusterLoadBalancerProfile object itself. + */ + public ManagedClusterLoadBalancerProfile withManagedOutboundIPs(ManagedClusterLoadBalancerProfileManagedOutboundIPs managedOutboundIPs) { + this.managedOutboundIPs = managedOutboundIPs; + return this; + } + + /** + * Get desired outbound IP Prefix resources for the cluster load balancer. + * + * @return the outboundIPPrefixes value + */ + public ManagedClusterLoadBalancerProfileOutboundIPPrefixes outboundIPPrefixes() { + return this.outboundIPPrefixes; + } + + /** + * Set desired outbound IP Prefix resources for the cluster load balancer. + * + * @param outboundIPPrefixes the outboundIPPrefixes value to set + * @return the ManagedClusterLoadBalancerProfile object itself. + */ + public ManagedClusterLoadBalancerProfile withOutboundIPPrefixes(ManagedClusterLoadBalancerProfileOutboundIPPrefixes outboundIPPrefixes) { + this.outboundIPPrefixes = outboundIPPrefixes; + return this; + } + + /** + * Get desired outbound IP resources for the cluster load balancer. + * + * @return the outboundIPs value + */ + public ManagedClusterLoadBalancerProfileOutboundIPs outboundIPs() { + return this.outboundIPs; + } + + /** + * Set desired outbound IP resources for the cluster load balancer. + * + * @param outboundIPs the outboundIPs value to set + * @return the ManagedClusterLoadBalancerProfile object itself. + */ + public ManagedClusterLoadBalancerProfile withOutboundIPs(ManagedClusterLoadBalancerProfileOutboundIPs outboundIPs) { + this.outboundIPs = outboundIPs; + return this; + } + + /** + * Get the effective outbound IP resources of the cluster load balancer. + * + * @return the effectiveOutboundIPs value + */ + public List effectiveOutboundIPs() { + return this.effectiveOutboundIPs; + } + + /** + * Set the effective outbound IP resources of the cluster load balancer. + * + * @param effectiveOutboundIPs the effectiveOutboundIPs value to set + * @return the ManagedClusterLoadBalancerProfile object itself. + */ + public ManagedClusterLoadBalancerProfile withEffectiveOutboundIPs(List effectiveOutboundIPs) { + this.effectiveOutboundIPs = effectiveOutboundIPs; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterLoadBalancerProfileManagedOutboundIPs.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterLoadBalancerProfileManagedOutboundIPs.java new file mode 100644 index 000000000000..52376a69697b --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterLoadBalancerProfileManagedOutboundIPs.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Desired managed outbound IPs for the cluster load balancer. + */ +public class ManagedClusterLoadBalancerProfileManagedOutboundIPs { + /** + * Desired number of outbound IP created/managed by Azure for the cluster + * load balancer. Allowed values must be in the range of 1 to 100 + * (inclusive). The default value is 1. + */ + @JsonProperty(value = "count") + private Integer count; + + /** + * Get desired number of outbound IP created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. + * + * @return the count value + */ + public Integer count() { + return this.count; + } + + /** + * Set desired number of outbound IP created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. + * + * @param count the count value to set + * @return the ManagedClusterLoadBalancerProfileManagedOutboundIPs object itself. + */ + public ManagedClusterLoadBalancerProfileManagedOutboundIPs withCount(Integer count) { + this.count = count; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.java new file mode 100644 index 000000000000..10ec84941db5 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Desired outbound IP Prefix resources for the cluster load balancer. + */ +public class ManagedClusterLoadBalancerProfileOutboundIPPrefixes { + /** + * A list of public IP prefix resources. + */ + @JsonProperty(value = "publicIPPrefixes") + private List publicIPPrefixes; + + /** + * Get a list of public IP prefix resources. + * + * @return the publicIPPrefixes value + */ + public List publicIPPrefixes() { + return this.publicIPPrefixes; + } + + /** + * Set a list of public IP prefix resources. + * + * @param publicIPPrefixes the publicIPPrefixes value to set + * @return the ManagedClusterLoadBalancerProfileOutboundIPPrefixes object itself. + */ + public ManagedClusterLoadBalancerProfileOutboundIPPrefixes withPublicIPPrefixes(List publicIPPrefixes) { + this.publicIPPrefixes = publicIPPrefixes; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterLoadBalancerProfileOutboundIPs.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterLoadBalancerProfileOutboundIPs.java new file mode 100644 index 000000000000..9f709a148ab8 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterLoadBalancerProfileOutboundIPs.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Desired outbound IP resources for the cluster load balancer. + */ +public class ManagedClusterLoadBalancerProfileOutboundIPs { + /** + * A list of public IP resources. + */ + @JsonProperty(value = "publicIPs") + private List publicIPs; + + /** + * Get a list of public IP resources. + * + * @return the publicIPs value + */ + public List publicIPs() { + return this.publicIPs; + } + + /** + * Set a list of public IP resources. + * + * @param publicIPs the publicIPs value to set + * @return the ManagedClusterLoadBalancerProfileOutboundIPs object itself. + */ + public ManagedClusterLoadBalancerProfileOutboundIPs withPublicIPs(List publicIPs) { + this.publicIPs = publicIPs; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterPoolUpgradeProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterPoolUpgradeProfile.java new file mode 100644 index 000000000000..bbcade8ba9dd --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterPoolUpgradeProfile.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The list of available upgrade versions. + */ +public class ManagedClusterPoolUpgradeProfile { + /** + * Kubernetes version (major, minor, patch). + */ + @JsonProperty(value = "kubernetesVersion", required = true) + private String kubernetesVersion; + + /** + * Pool name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * OsType to be used to specify os type. Choose from Linux and Windows. + * Default to Linux. Possible values include: 'Linux', 'Windows'. + */ + @JsonProperty(value = "osType", required = true) + private OSType osType; + + /** + * List of orchestrator types and versions available for upgrade. + */ + @JsonProperty(value = "upgrades") + private List upgrades; + + /** + * Get kubernetes version (major, minor, patch). + * + * @return the kubernetesVersion value + */ + public String kubernetesVersion() { + return this.kubernetesVersion; + } + + /** + * Set kubernetes version (major, minor, patch). + * + * @param kubernetesVersion the kubernetesVersion value to set + * @return the ManagedClusterPoolUpgradeProfile object itself. + */ + public ManagedClusterPoolUpgradeProfile withKubernetesVersion(String kubernetesVersion) { + this.kubernetesVersion = kubernetesVersion; + return this; + } + + /** + * Get pool name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set pool name. + * + * @param name the name value to set + * @return the ManagedClusterPoolUpgradeProfile object itself. + */ + public ManagedClusterPoolUpgradeProfile withName(String name) { + this.name = name; + return this; + } + + /** + * Get osType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: 'Linux', 'Windows'. + * + * @return the osType value + */ + public OSType osType() { + return this.osType; + } + + /** + * Set osType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: 'Linux', 'Windows'. + * + * @param osType the osType value to set + * @return the ManagedClusterPoolUpgradeProfile object itself. + */ + public ManagedClusterPoolUpgradeProfile withOsType(OSType osType) { + this.osType = osType; + return this; + } + + /** + * Get list of orchestrator types and versions available for upgrade. + * + * @return the upgrades value + */ + public List upgrades() { + return this.upgrades; + } + + /** + * Set list of orchestrator types and versions available for upgrade. + * + * @param upgrades the upgrades value to set + * @return the ManagedClusterPoolUpgradeProfile object itself. + */ + public ManagedClusterPoolUpgradeProfile withUpgrades(List upgrades) { + this.upgrades = upgrades; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterPoolUpgradeProfileUpgradesItem.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterPoolUpgradeProfileUpgradesItem.java new file mode 100644 index 000000000000..2e437bbe2a35 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterPoolUpgradeProfileUpgradesItem.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ManagedClusterPoolUpgradeProfileUpgradesItem model. + */ +public class ManagedClusterPoolUpgradeProfileUpgradesItem { + /** + * Kubernetes version (major, minor, patch). + */ + @JsonProperty(value = "kubernetesVersion") + private String kubernetesVersion; + + /** + * Whether Kubernetes version is currently in preview. + */ + @JsonProperty(value = "isPreview") + private Boolean isPreview; + + /** + * Get kubernetes version (major, minor, patch). + * + * @return the kubernetesVersion value + */ + public String kubernetesVersion() { + return this.kubernetesVersion; + } + + /** + * Set kubernetes version (major, minor, patch). + * + * @param kubernetesVersion the kubernetesVersion value to set + * @return the ManagedClusterPoolUpgradeProfileUpgradesItem object itself. + */ + public ManagedClusterPoolUpgradeProfileUpgradesItem withKubernetesVersion(String kubernetesVersion) { + this.kubernetesVersion = kubernetesVersion; + return this; + } + + /** + * Get whether Kubernetes version is currently in preview. + * + * @return the isPreview value + */ + public Boolean isPreview() { + return this.isPreview; + } + + /** + * Set whether Kubernetes version is currently in preview. + * + * @param isPreview the isPreview value to set + * @return the ManagedClusterPoolUpgradeProfileUpgradesItem object itself. + */ + public ManagedClusterPoolUpgradeProfileUpgradesItem withIsPreview(Boolean isPreview) { + this.isPreview = isPreview; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterServicePrincipalProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterServicePrincipalProfile.java new file mode 100644 index 000000000000..a010b1760468 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterServicePrincipalProfile.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about a service principal identity for the cluster to use for + * manipulating Azure APIs. + */ +public class ManagedClusterServicePrincipalProfile { + /** + * The ID for the service principal. + */ + @JsonProperty(value = "clientId", required = true) + private String clientId; + + /** + * The secret password associated with the service principal in plain text. + */ + @JsonProperty(value = "secret") + private String secret; + + /** + * Get the ID for the service principal. + * + * @return the clientId value + */ + public String clientId() { + return this.clientId; + } + + /** + * Set the ID for the service principal. + * + * @param clientId the clientId value to set + * @return the ManagedClusterServicePrincipalProfile object itself. + */ + public ManagedClusterServicePrincipalProfile withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get the secret password associated with the service principal in plain text. + * + * @return the secret value + */ + public String secret() { + return this.secret; + } + + /** + * Set the secret password associated with the service principal in plain text. + * + * @param secret the secret value to set + * @return the ManagedClusterServicePrincipalProfile object itself. + */ + public ManagedClusterServicePrincipalProfile withSecret(String secret) { + this.secret = secret; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterUpgradeProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterUpgradeProfile.java new file mode 100644 index 000000000000..3c0a3f09f119 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterUpgradeProfile.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.ContainerServiceManager; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.ManagedClusterUpgradeProfileInner; +import java.util.List; + +/** + * Type representing ManagedClusterUpgradeProfile. + */ +public interface ManagedClusterUpgradeProfile extends HasInner, HasManager { + /** + * @return the agentPoolProfiles value. + */ + List agentPoolProfiles(); + + /** + * @return the controlPlaneProfile value. + */ + ManagedClusterPoolUpgradeProfile controlPlaneProfile(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterWindowsProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterWindowsProfile.java new file mode 100644 index 000000000000..19234fa8e11c --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusterWindowsProfile.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Profile for Windows VMs in the container service cluster. + */ +public class ManagedClusterWindowsProfile { + /** + * The administrator username to use for Windows VMs. + */ + @JsonProperty(value = "adminUsername", required = true) + private String adminUsername; + + /** + * The administrator password to use for Windows VMs. + */ + @JsonProperty(value = "adminPassword") + private String adminPassword; + + /** + * Get the administrator username to use for Windows VMs. + * + * @return the adminUsername value + */ + public String adminUsername() { + return this.adminUsername; + } + + /** + * Set the administrator username to use for Windows VMs. + * + * @param adminUsername the adminUsername value to set + * @return the ManagedClusterWindowsProfile object itself. + */ + public ManagedClusterWindowsProfile withAdminUsername(String adminUsername) { + this.adminUsername = adminUsername; + return this; + } + + /** + * Get the administrator password to use for Windows VMs. + * + * @return the adminPassword value + */ + public String adminPassword() { + return this.adminPassword; + } + + /** + * Set the administrator password to use for Windows VMs. + * + * @param adminPassword the adminPassword value to set + * @return the ManagedClusterWindowsProfile object itself. + */ + public ManagedClusterWindowsProfile withAdminPassword(String adminPassword) { + this.adminPassword = adminPassword; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusters.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusters.java new file mode 100644 index 000000000000..429838adfadd --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedClusters.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Completable; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.ManagedClustersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagedClusters. + */ +public interface ManagedClusters extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Gets cluster admin credential of a managed cluster. + * Gets cluster admin credential of the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listClusterAdminCredentialsAsync(String resourceGroupName, String resourceName); + + /** + * Gets cluster user credential of a managed cluster. + * Gets cluster user credential of the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listClusterUserCredentialsAsync(String resourceGroupName, String resourceName); + + /** + * Reset Service Principal Profile of a managed cluster. + * Update the service principal Profile for a managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Reset Service Principal Profile operation for a Managed Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable resetServicePrincipalProfileAsync(String resourceGroupName, String resourceName, ManagedClusterServicePrincipalProfile parameters); + + /** + * Reset AAD Profile of a managed cluster. + * Update the AAD Profile for a managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Reset AAD Profile operation for a Managed Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable resetAADProfileAsync(String resourceGroupName, String resourceName, ManagedClusterAADProfile parameters); + + /** + * Gets upgrade profile for a managed cluster. + * Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getUpgradeProfileAsync(String resourceGroupName, String resourceName); + + /** + * Gets an access profile of a managed cluster. + * Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param roleName The name of the role for managed cluster accessProfile resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAccessProfileAsync(String resourceGroupName, String resourceName, String roleName); + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/NetworkPlugin.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/NetworkPlugin.java new file mode 100644 index 000000000000..93bf8665b2b1 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/NetworkPlugin.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for NetworkPlugin. + */ +public final class NetworkPlugin extends ExpandableStringEnum { + /** Static value azure for NetworkPlugin. */ + public static final NetworkPlugin AZURE = fromString("azure"); + + /** Static value kubenet for NetworkPlugin. */ + public static final NetworkPlugin KUBENET = fromString("kubenet"); + + /** + * Creates or finds a NetworkPlugin from its string representation. + * @param name a name to look for + * @return the corresponding NetworkPlugin + */ + @JsonCreator + public static NetworkPlugin fromString(String name) { + return fromString(name, NetworkPlugin.class); + } + + /** + * @return known NetworkPlugin values + */ + public static Collection values() { + return values(NetworkPlugin.class); + } +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/NetworkPolicy.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/NetworkPolicy.java new file mode 100644 index 000000000000..6c629b6babcd --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/NetworkPolicy.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for NetworkPolicy. + */ +public final class NetworkPolicy extends ExpandableStringEnum { + /** Static value calico for NetworkPolicy. */ + public static final NetworkPolicy CALICO = fromString("calico"); + + /** Static value azure for NetworkPolicy. */ + public static final NetworkPolicy AZURE = fromString("azure"); + + /** + * Creates or finds a NetworkPolicy from its string representation. + * @param name a name to look for + * @return the corresponding NetworkPolicy + */ + @JsonCreator + public static NetworkPolicy fromString(String name) { + return fromString(name, NetworkPolicy.class); + } + + /** + * @return known NetworkPolicy values + */ + public static Collection values() { + return values(NetworkPolicy.class); + } +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/NetworkProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/NetworkProfile.java new file mode 100644 index 000000000000..d5e922d0b260 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/NetworkProfile.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents the OpenShift networking configuration. + */ +public class NetworkProfile { + /** + * CIDR for the OpenShift Vnet. + */ + @JsonProperty(value = "vnetCidr") + private String vnetCidr; + + /** + * CIDR of the Vnet to peer. + */ + @JsonProperty(value = "peerVnetId") + private String peerVnetId; + + /** + * ID of the Vnet created for OSA cluster. + */ + @JsonProperty(value = "vnetId") + private String vnetId; + + /** + * Get cIDR for the OpenShift Vnet. + * + * @return the vnetCidr value + */ + public String vnetCidr() { + return this.vnetCidr; + } + + /** + * Set cIDR for the OpenShift Vnet. + * + * @param vnetCidr the vnetCidr value to set + * @return the NetworkProfile object itself. + */ + public NetworkProfile withVnetCidr(String vnetCidr) { + this.vnetCidr = vnetCidr; + return this; + } + + /** + * Get cIDR of the Vnet to peer. + * + * @return the peerVnetId value + */ + public String peerVnetId() { + return this.peerVnetId; + } + + /** + * Set cIDR of the Vnet to peer. + * + * @param peerVnetId the peerVnetId value to set + * @return the NetworkProfile object itself. + */ + public NetworkProfile withPeerVnetId(String peerVnetId) { + this.peerVnetId = peerVnetId; + return this; + } + + /** + * Get iD of the Vnet created for OSA cluster. + * + * @return the vnetId value + */ + public String vnetId() { + return this.vnetId; + } + + /** + * Set iD of the Vnet created for OSA cluster. + * + * @param vnetId the vnetId value to set + * @return the NetworkProfile object itself. + */ + public NetworkProfile withVnetId(String vnetId) { + this.vnetId = vnetId; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OSType.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OSType.java new file mode 100644 index 000000000000..a8b4fe9dd66f --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OSType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for OSType. + */ +public final class OSType extends ExpandableStringEnum { + /** Static value Linux for OSType. */ + public static final OSType LINUX = fromString("Linux"); + + /** Static value Windows for OSType. */ + public static final OSType WINDOWS = fromString("Windows"); + + /** + * Creates or finds a OSType from its string representation. + * @param name a name to look for + * @return the corresponding OSType + */ + @JsonCreator + public static OSType fromString(String name) { + return fromString(name, OSType.class); + } + + /** + * @return known OSType values + */ + public static Collection values() { + return values(OSType.class); + } +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftAgentPoolProfileRole.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftAgentPoolProfileRole.java new file mode 100644 index 000000000000..13d6cccd7b16 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftAgentPoolProfileRole.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for OpenShiftAgentPoolProfileRole. + */ +public final class OpenShiftAgentPoolProfileRole extends ExpandableStringEnum { + /** Static value compute for OpenShiftAgentPoolProfileRole. */ + public static final OpenShiftAgentPoolProfileRole COMPUTE = fromString("compute"); + + /** Static value infra for OpenShiftAgentPoolProfileRole. */ + public static final OpenShiftAgentPoolProfileRole INFRA = fromString("infra"); + + /** + * Creates or finds a OpenShiftAgentPoolProfileRole from its string representation. + * @param name a name to look for + * @return the corresponding OpenShiftAgentPoolProfileRole + */ + @JsonCreator + public static OpenShiftAgentPoolProfileRole fromString(String name) { + return fromString(name, OpenShiftAgentPoolProfileRole.class); + } + + /** + * @return known OpenShiftAgentPoolProfileRole values + */ + public static Collection values() { + return values(OpenShiftAgentPoolProfileRole.class); + } +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftContainerServiceVMSize.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftContainerServiceVMSize.java new file mode 100644 index 000000000000..ea35d7fe61bb --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftContainerServiceVMSize.java @@ -0,0 +1,134 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for OpenShiftContainerServiceVMSize. + */ +public final class OpenShiftContainerServiceVMSize extends ExpandableStringEnum { + /** Static value Standard_D2s_v3 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_D2S_V3 = fromString("Standard_D2s_v3"); + + /** Static value Standard_D4s_v3 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_D4S_V3 = fromString("Standard_D4s_v3"); + + /** Static value Standard_D8s_v3 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_D8S_V3 = fromString("Standard_D8s_v3"); + + /** Static value Standard_D16s_v3 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_D16S_V3 = fromString("Standard_D16s_v3"); + + /** Static value Standard_D32s_v3 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_D32S_V3 = fromString("Standard_D32s_v3"); + + /** Static value Standard_D64s_v3 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_D64S_V3 = fromString("Standard_D64s_v3"); + + /** Static value Standard_DS4_v2 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_DS4_V2 = fromString("Standard_DS4_v2"); + + /** Static value Standard_DS5_v2 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_DS5_V2 = fromString("Standard_DS5_v2"); + + /** Static value Standard_F8s_v2 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_F8S_V2 = fromString("Standard_F8s_v2"); + + /** Static value Standard_F16s_v2 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_F16S_V2 = fromString("Standard_F16s_v2"); + + /** Static value Standard_F32s_v2 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_F32S_V2 = fromString("Standard_F32s_v2"); + + /** Static value Standard_F64s_v2 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_F64S_V2 = fromString("Standard_F64s_v2"); + + /** Static value Standard_F72s_v2 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_F72S_V2 = fromString("Standard_F72s_v2"); + + /** Static value Standard_F8s for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_F8S = fromString("Standard_F8s"); + + /** Static value Standard_F16s for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_F16S = fromString("Standard_F16s"); + + /** Static value Standard_E4s_v3 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_E4S_V3 = fromString("Standard_E4s_v3"); + + /** Static value Standard_E8s_v3 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_E8S_V3 = fromString("Standard_E8s_v3"); + + /** Static value Standard_E16s_v3 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_E16S_V3 = fromString("Standard_E16s_v3"); + + /** Static value Standard_E20s_v3 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_E20S_V3 = fromString("Standard_E20s_v3"); + + /** Static value Standard_E32s_v3 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_E32S_V3 = fromString("Standard_E32s_v3"); + + /** Static value Standard_E64s_v3 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_E64S_V3 = fromString("Standard_E64s_v3"); + + /** Static value Standard_GS2 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_GS2 = fromString("Standard_GS2"); + + /** Static value Standard_GS3 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_GS3 = fromString("Standard_GS3"); + + /** Static value Standard_GS4 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_GS4 = fromString("Standard_GS4"); + + /** Static value Standard_GS5 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_GS5 = fromString("Standard_GS5"); + + /** Static value Standard_DS12_v2 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_DS12_V2 = fromString("Standard_DS12_v2"); + + /** Static value Standard_DS13_v2 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_DS13_V2 = fromString("Standard_DS13_v2"); + + /** Static value Standard_DS14_v2 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_DS14_V2 = fromString("Standard_DS14_v2"); + + /** Static value Standard_DS15_v2 for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_DS15_V2 = fromString("Standard_DS15_v2"); + + /** Static value Standard_L4s for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_L4S = fromString("Standard_L4s"); + + /** Static value Standard_L8s for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_L8S = fromString("Standard_L8s"); + + /** Static value Standard_L16s for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_L16S = fromString("Standard_L16s"); + + /** Static value Standard_L32s for OpenShiftContainerServiceVMSize. */ + public static final OpenShiftContainerServiceVMSize STANDARD_L32S = fromString("Standard_L32s"); + + /** + * Creates or finds a OpenShiftContainerServiceVMSize from its string representation. + * @param name a name to look for + * @return the corresponding OpenShiftContainerServiceVMSize + */ + @JsonCreator + public static OpenShiftContainerServiceVMSize fromString(String name) { + return fromString(name, OpenShiftContainerServiceVMSize.class); + } + + /** + * @return known OpenShiftContainerServiceVMSize values + */ + public static Collection values() { + return values(OpenShiftContainerServiceVMSize.class); + } +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftManagedCluster.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftManagedCluster.java new file mode 100644 index 000000000000..de5f1eca1699 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftManagedCluster.java @@ -0,0 +1,280 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.ContainerServiceManager; +import java.util.List; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.OpenShiftManagedClusterInner; + +/** + * Type representing OpenShiftManagedCluster. + */ +public interface OpenShiftManagedCluster extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the agentPoolProfiles value. + */ + List agentPoolProfiles(); + + /** + * @return the authProfile value. + */ + OpenShiftManagedClusterAuthProfile authProfile(); + + /** + * @return the clusterVersion value. + */ + String clusterVersion(); + + /** + * @return the fqdn value. + */ + String fqdn(); + + /** + * @return the masterPoolProfile value. + */ + OpenShiftManagedClusterMasterPoolProfile masterPoolProfile(); + + /** + * @return the networkProfile value. + */ + NetworkProfile networkProfile(); + + /** + * @return the openShiftVersion value. + */ + String openShiftVersion(); + + /** + * @return the plan value. + */ + PurchasePlan plan(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the publicHostname value. + */ + String publicHostname(); + + /** + * @return the routerProfiles value. + */ + List routerProfiles(); + + /** + * The entirety of the OpenShiftManagedCluster definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithOpenShiftVersion, DefinitionStages.WithCreate { + } + + /** + * Grouping of OpenShiftManagedCluster definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a OpenShiftManagedCluster definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the OpenShiftManagedCluster definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the openshiftmanagedcluster definition allowing to specify OpenShiftVersion. + */ + interface WithOpenShiftVersion { + /** + * Specifies openShiftVersion. + * @param openShiftVersion Version of OpenShift specified when creating the cluster + * @return the next definition stage +*/ + WithCreate withOpenShiftVersion(String openShiftVersion); + } + + /** + * The stage of the openshiftmanagedcluster definition allowing to specify AgentPoolProfiles. + */ + interface WithAgentPoolProfiles { + /** + * Specifies agentPoolProfiles. + * @param agentPoolProfiles Configuration of OpenShift cluster VMs + * @return the next definition stage + */ + WithCreate withAgentPoolProfiles(List agentPoolProfiles); + } + + /** + * The stage of the openshiftmanagedcluster definition allowing to specify AuthProfile. + */ + interface WithAuthProfile { + /** + * Specifies authProfile. + * @param authProfile Configures OpenShift authentication + * @return the next definition stage + */ + WithCreate withAuthProfile(OpenShiftManagedClusterAuthProfile authProfile); + } + + /** + * The stage of the openshiftmanagedcluster definition allowing to specify MasterPoolProfile. + */ + interface WithMasterPoolProfile { + /** + * Specifies masterPoolProfile. + * @param masterPoolProfile Configuration for OpenShift master VMs + * @return the next definition stage + */ + WithCreate withMasterPoolProfile(OpenShiftManagedClusterMasterPoolProfile masterPoolProfile); + } + + /** + * The stage of the openshiftmanagedcluster definition allowing to specify NetworkProfile. + */ + interface WithNetworkProfile { + /** + * Specifies networkProfile. + * @param networkProfile Configuration for OpenShift networking + * @return the next definition stage + */ + WithCreate withNetworkProfile(NetworkProfile networkProfile); + } + + /** + * The stage of the openshiftmanagedcluster definition allowing to specify Plan. + */ + interface WithPlan { + /** + * Specifies plan. + * @param plan Define the resource plan as required by ARM for billing purposes + * @return the next definition stage + */ + WithCreate withPlan(PurchasePlan plan); + } + + /** + * The stage of the openshiftmanagedcluster definition allowing to specify RouterProfiles. + */ + interface WithRouterProfiles { + /** + * Specifies routerProfiles. + * @param routerProfiles Configuration for OpenShift router(s) + * @return the next definition stage + */ + WithCreate withRouterProfiles(List routerProfiles); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithAgentPoolProfiles, DefinitionStages.WithAuthProfile, DefinitionStages.WithMasterPoolProfile, DefinitionStages.WithNetworkProfile, DefinitionStages.WithPlan, DefinitionStages.WithRouterProfiles { + } + } + /** + * The template for a OpenShiftManagedCluster update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAgentPoolProfiles, UpdateStages.WithAuthProfile, UpdateStages.WithMasterPoolProfile, UpdateStages.WithNetworkProfile, UpdateStages.WithPlan, UpdateStages.WithRouterProfiles { + } + + /** + * Grouping of OpenShiftManagedCluster update stages. + */ + interface UpdateStages { + /** + * The stage of the openshiftmanagedcluster update allowing to specify AgentPoolProfiles. + */ + interface WithAgentPoolProfiles { + /** + * Specifies agentPoolProfiles. + * @param agentPoolProfiles Configuration of OpenShift cluster VMs + * @return the next update stage + */ + Update withAgentPoolProfiles(List agentPoolProfiles); + } + + /** + * The stage of the openshiftmanagedcluster update allowing to specify AuthProfile. + */ + interface WithAuthProfile { + /** + * Specifies authProfile. + * @param authProfile Configures OpenShift authentication + * @return the next update stage + */ + Update withAuthProfile(OpenShiftManagedClusterAuthProfile authProfile); + } + + /** + * The stage of the openshiftmanagedcluster update allowing to specify MasterPoolProfile. + */ + interface WithMasterPoolProfile { + /** + * Specifies masterPoolProfile. + * @param masterPoolProfile Configuration for OpenShift master VMs + * @return the next update stage + */ + Update withMasterPoolProfile(OpenShiftManagedClusterMasterPoolProfile masterPoolProfile); + } + + /** + * The stage of the openshiftmanagedcluster update allowing to specify NetworkProfile. + */ + interface WithNetworkProfile { + /** + * Specifies networkProfile. + * @param networkProfile Configuration for OpenShift networking + * @return the next update stage + */ + Update withNetworkProfile(NetworkProfile networkProfile); + } + + /** + * The stage of the openshiftmanagedcluster update allowing to specify Plan. + */ + interface WithPlan { + /** + * Specifies plan. + * @param plan Define the resource plan as required by ARM for billing purposes + * @return the next update stage + */ + Update withPlan(PurchasePlan plan); + } + + /** + * The stage of the openshiftmanagedcluster update allowing to specify RouterProfiles. + */ + interface WithRouterProfiles { + /** + * Specifies routerProfiles. + * @param routerProfiles Configuration for OpenShift router(s) + * @return the next update stage + */ + Update withRouterProfiles(List routerProfiles); + } + + } +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftManagedClusterAADIdentityProvider.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftManagedClusterAADIdentityProvider.java new file mode 100644 index 000000000000..5f29092c1e5c --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftManagedClusterAADIdentityProvider.java @@ -0,0 +1,125 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Defines the Identity provider for MS AAD. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind", defaultImpl = OpenShiftManagedClusterAADIdentityProvider.class) +@JsonTypeName("AADIdentityProvider") +public class OpenShiftManagedClusterAADIdentityProvider extends OpenShiftManagedClusterBaseIdentityProvider { + /** + * The clientId password associated with the provider. + */ + @JsonProperty(value = "clientId") + private String clientId; + + /** + * The secret password associated with the provider. + */ + @JsonProperty(value = "secret") + private String secret; + + /** + * The tenantId associated with the provider. + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /** + * The groupId to be granted cluster admin role. + */ + @JsonProperty(value = "customerAdminGroupId") + private String customerAdminGroupId; + + /** + * Get the clientId password associated with the provider. + * + * @return the clientId value + */ + public String clientId() { + return this.clientId; + } + + /** + * Set the clientId password associated with the provider. + * + * @param clientId the clientId value to set + * @return the OpenShiftManagedClusterAADIdentityProvider object itself. + */ + public OpenShiftManagedClusterAADIdentityProvider withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Get the secret password associated with the provider. + * + * @return the secret value + */ + public String secret() { + return this.secret; + } + + /** + * Set the secret password associated with the provider. + * + * @param secret the secret value to set + * @return the OpenShiftManagedClusterAADIdentityProvider object itself. + */ + public OpenShiftManagedClusterAADIdentityProvider withSecret(String secret) { + this.secret = secret; + return this; + } + + /** + * Get the tenantId associated with the provider. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId associated with the provider. + * + * @param tenantId the tenantId value to set + * @return the OpenShiftManagedClusterAADIdentityProvider object itself. + */ + public OpenShiftManagedClusterAADIdentityProvider withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the groupId to be granted cluster admin role. + * + * @return the customerAdminGroupId value + */ + public String customerAdminGroupId() { + return this.customerAdminGroupId; + } + + /** + * Set the groupId to be granted cluster admin role. + * + * @param customerAdminGroupId the customerAdminGroupId value to set + * @return the OpenShiftManagedClusterAADIdentityProvider object itself. + */ + public OpenShiftManagedClusterAADIdentityProvider withCustomerAdminGroupId(String customerAdminGroupId) { + this.customerAdminGroupId = customerAdminGroupId; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftManagedClusterAgentPoolProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftManagedClusterAgentPoolProfile.java new file mode 100644 index 000000000000..3eccb30f5587 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftManagedClusterAgentPoolProfile.java @@ -0,0 +1,186 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines the configuration of the OpenShift cluster VMs. + */ +public class OpenShiftManagedClusterAgentPoolProfile { + /** + * Unique name of the pool profile in the context of the subscription and + * resource group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Number of agents (VMs) to host docker containers. + */ + @JsonProperty(value = "count", required = true) + private int count; + + /** + * Size of agent VMs. Possible values include: 'Standard_D2s_v3', + * 'Standard_D4s_v3', 'Standard_D8s_v3', 'Standard_D16s_v3', + * 'Standard_D32s_v3', 'Standard_D64s_v3', 'Standard_DS4_v2', + * 'Standard_DS5_v2', 'Standard_F8s_v2', 'Standard_F16s_v2', + * 'Standard_F32s_v2', 'Standard_F64s_v2', 'Standard_F72s_v2', + * 'Standard_F8s', 'Standard_F16s', 'Standard_E4s_v3', 'Standard_E8s_v3', + * 'Standard_E16s_v3', 'Standard_E20s_v3', 'Standard_E32s_v3', + * 'Standard_E64s_v3', 'Standard_GS2', 'Standard_GS3', 'Standard_GS4', + * 'Standard_GS5', 'Standard_DS12_v2', 'Standard_DS13_v2', + * 'Standard_DS14_v2', 'Standard_DS15_v2', 'Standard_L4s', 'Standard_L8s', + * 'Standard_L16s', 'Standard_L32s'. + */ + @JsonProperty(value = "vmSize", required = true) + private OpenShiftContainerServiceVMSize vmSize; + + /** + * Subnet CIDR for the peering. + */ + @JsonProperty(value = "subnetCidr") + private String subnetCidr; + + /** + * OsType to be used to specify os type. Choose from Linux and Windows. + * Default to Linux. Possible values include: 'Linux', 'Windows'. + */ + @JsonProperty(value = "osType") + private OSType osType; + + /** + * Define the role of the AgentPoolProfile. Possible values include: + * 'compute', 'infra'. + */ + @JsonProperty(value = "role") + private OpenShiftAgentPoolProfileRole role; + + /** + * Get unique name of the pool profile in the context of the subscription and resource group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set unique name of the pool profile in the context of the subscription and resource group. + * + * @param name the name value to set + * @return the OpenShiftManagedClusterAgentPoolProfile object itself. + */ + public OpenShiftManagedClusterAgentPoolProfile withName(String name) { + this.name = name; + return this; + } + + /** + * Get number of agents (VMs) to host docker containers. + * + * @return the count value + */ + public int count() { + return this.count; + } + + /** + * Set number of agents (VMs) to host docker containers. + * + * @param count the count value to set + * @return the OpenShiftManagedClusterAgentPoolProfile object itself. + */ + public OpenShiftManagedClusterAgentPoolProfile withCount(int count) { + this.count = count; + return this; + } + + /** + * Get size of agent VMs. Possible values include: 'Standard_D2s_v3', 'Standard_D4s_v3', 'Standard_D8s_v3', 'Standard_D16s_v3', 'Standard_D32s_v3', 'Standard_D64s_v3', 'Standard_DS4_v2', 'Standard_DS5_v2', 'Standard_F8s_v2', 'Standard_F16s_v2', 'Standard_F32s_v2', 'Standard_F64s_v2', 'Standard_F72s_v2', 'Standard_F8s', 'Standard_F16s', 'Standard_E4s_v3', 'Standard_E8s_v3', 'Standard_E16s_v3', 'Standard_E20s_v3', 'Standard_E32s_v3', 'Standard_E64s_v3', 'Standard_GS2', 'Standard_GS3', 'Standard_GS4', 'Standard_GS5', 'Standard_DS12_v2', 'Standard_DS13_v2', 'Standard_DS14_v2', 'Standard_DS15_v2', 'Standard_L4s', 'Standard_L8s', 'Standard_L16s', 'Standard_L32s'. + * + * @return the vmSize value + */ + public OpenShiftContainerServiceVMSize vmSize() { + return this.vmSize; + } + + /** + * Set size of agent VMs. Possible values include: 'Standard_D2s_v3', 'Standard_D4s_v3', 'Standard_D8s_v3', 'Standard_D16s_v3', 'Standard_D32s_v3', 'Standard_D64s_v3', 'Standard_DS4_v2', 'Standard_DS5_v2', 'Standard_F8s_v2', 'Standard_F16s_v2', 'Standard_F32s_v2', 'Standard_F64s_v2', 'Standard_F72s_v2', 'Standard_F8s', 'Standard_F16s', 'Standard_E4s_v3', 'Standard_E8s_v3', 'Standard_E16s_v3', 'Standard_E20s_v3', 'Standard_E32s_v3', 'Standard_E64s_v3', 'Standard_GS2', 'Standard_GS3', 'Standard_GS4', 'Standard_GS5', 'Standard_DS12_v2', 'Standard_DS13_v2', 'Standard_DS14_v2', 'Standard_DS15_v2', 'Standard_L4s', 'Standard_L8s', 'Standard_L16s', 'Standard_L32s'. + * + * @param vmSize the vmSize value to set + * @return the OpenShiftManagedClusterAgentPoolProfile object itself. + */ + public OpenShiftManagedClusterAgentPoolProfile withVmSize(OpenShiftContainerServiceVMSize vmSize) { + this.vmSize = vmSize; + return this; + } + + /** + * Get subnet CIDR for the peering. + * + * @return the subnetCidr value + */ + public String subnetCidr() { + return this.subnetCidr; + } + + /** + * Set subnet CIDR for the peering. + * + * @param subnetCidr the subnetCidr value to set + * @return the OpenShiftManagedClusterAgentPoolProfile object itself. + */ + public OpenShiftManagedClusterAgentPoolProfile withSubnetCidr(String subnetCidr) { + this.subnetCidr = subnetCidr; + return this; + } + + /** + * Get osType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: 'Linux', 'Windows'. + * + * @return the osType value + */ + public OSType osType() { + return this.osType; + } + + /** + * Set osType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: 'Linux', 'Windows'. + * + * @param osType the osType value to set + * @return the OpenShiftManagedClusterAgentPoolProfile object itself. + */ + public OpenShiftManagedClusterAgentPoolProfile withOsType(OSType osType) { + this.osType = osType; + return this; + } + + /** + * Get define the role of the AgentPoolProfile. Possible values include: 'compute', 'infra'. + * + * @return the role value + */ + public OpenShiftAgentPoolProfileRole role() { + return this.role; + } + + /** + * Set define the role of the AgentPoolProfile. Possible values include: 'compute', 'infra'. + * + * @param role the role value to set + * @return the OpenShiftManagedClusterAgentPoolProfile object itself. + */ + public OpenShiftManagedClusterAgentPoolProfile withRole(OpenShiftAgentPoolProfileRole role) { + this.role = role; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftManagedClusterAuthProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftManagedClusterAuthProfile.java new file mode 100644 index 000000000000..5e168240bca5 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftManagedClusterAuthProfile.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines all possible authentication profiles for the OpenShift cluster. + */ +public class OpenShiftManagedClusterAuthProfile { + /** + * Type of authentication profile to use. + */ + @JsonProperty(value = "identityProviders") + private List identityProviders; + + /** + * Get type of authentication profile to use. + * + * @return the identityProviders value + */ + public List identityProviders() { + return this.identityProviders; + } + + /** + * Set type of authentication profile to use. + * + * @param identityProviders the identityProviders value to set + * @return the OpenShiftManagedClusterAuthProfile object itself. + */ + public OpenShiftManagedClusterAuthProfile withIdentityProviders(List identityProviders) { + this.identityProviders = identityProviders; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftManagedClusterBaseIdentityProvider.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftManagedClusterBaseIdentityProvider.java new file mode 100644 index 000000000000..e278f76c7f5d --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftManagedClusterBaseIdentityProvider.java @@ -0,0 +1,24 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * Structure for any Identity provider. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind", defaultImpl = OpenShiftManagedClusterBaseIdentityProvider.class) +@JsonTypeName("OpenShiftManagedClusterBaseIdentityProvider") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "AADIdentityProvider", value = OpenShiftManagedClusterAADIdentityProvider.class) +}) +public class OpenShiftManagedClusterBaseIdentityProvider { +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftManagedClusterIdentityProvider.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftManagedClusterIdentityProvider.java new file mode 100644 index 000000000000..377b1f92ae39 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftManagedClusterIdentityProvider.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines the configuration of the identity providers to be used in the + * OpenShift cluster. + */ +public class OpenShiftManagedClusterIdentityProvider { + /** + * Name of the provider. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Configuration of the provider. + */ + @JsonProperty(value = "provider") + private OpenShiftManagedClusterBaseIdentityProvider provider; + + /** + * Get name of the provider. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of the provider. + * + * @param name the name value to set + * @return the OpenShiftManagedClusterIdentityProvider object itself. + */ + public OpenShiftManagedClusterIdentityProvider withName(String name) { + this.name = name; + return this; + } + + /** + * Get configuration of the provider. + * + * @return the provider value + */ + public OpenShiftManagedClusterBaseIdentityProvider provider() { + return this.provider; + } + + /** + * Set configuration of the provider. + * + * @param provider the provider value to set + * @return the OpenShiftManagedClusterIdentityProvider object itself. + */ + public OpenShiftManagedClusterIdentityProvider withProvider(OpenShiftManagedClusterBaseIdentityProvider provider) { + this.provider = provider; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftManagedClusterMasterPoolProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftManagedClusterMasterPoolProfile.java new file mode 100644 index 000000000000..f441f3611c1b --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftManagedClusterMasterPoolProfile.java @@ -0,0 +1,161 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * OpenShiftManagedClusterMaterPoolProfile contains configuration for OpenShift + * master VMs. + */ +public class OpenShiftManagedClusterMasterPoolProfile { + /** + * Unique name of the master pool profile in the context of the + * subscription and resource group. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Number of masters (VMs) to host docker containers. The default value is + * 3. + */ + @JsonProperty(value = "count", required = true) + private int count; + + /** + * Size of agent VMs. Possible values include: 'Standard_D2s_v3', + * 'Standard_D4s_v3', 'Standard_D8s_v3', 'Standard_D16s_v3', + * 'Standard_D32s_v3', 'Standard_D64s_v3', 'Standard_DS4_v2', + * 'Standard_DS5_v2', 'Standard_F8s_v2', 'Standard_F16s_v2', + * 'Standard_F32s_v2', 'Standard_F64s_v2', 'Standard_F72s_v2', + * 'Standard_F8s', 'Standard_F16s', 'Standard_E4s_v3', 'Standard_E8s_v3', + * 'Standard_E16s_v3', 'Standard_E20s_v3', 'Standard_E32s_v3', + * 'Standard_E64s_v3', 'Standard_GS2', 'Standard_GS3', 'Standard_GS4', + * 'Standard_GS5', 'Standard_DS12_v2', 'Standard_DS13_v2', + * 'Standard_DS14_v2', 'Standard_DS15_v2', 'Standard_L4s', 'Standard_L8s', + * 'Standard_L16s', 'Standard_L32s'. + */ + @JsonProperty(value = "vmSize", required = true) + private OpenShiftContainerServiceVMSize vmSize; + + /** + * Subnet CIDR for the peering. + */ + @JsonProperty(value = "subnetCidr") + private String subnetCidr; + + /** + * OsType to be used to specify os type. Choose from Linux and Windows. + * Default to Linux. Possible values include: 'Linux', 'Windows'. + */ + @JsonProperty(value = "osType") + private OSType osType; + + /** + * Get unique name of the master pool profile in the context of the subscription and resource group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set unique name of the master pool profile in the context of the subscription and resource group. + * + * @param name the name value to set + * @return the OpenShiftManagedClusterMasterPoolProfile object itself. + */ + public OpenShiftManagedClusterMasterPoolProfile withName(String name) { + this.name = name; + return this; + } + + /** + * Get number of masters (VMs) to host docker containers. The default value is 3. + * + * @return the count value + */ + public int count() { + return this.count; + } + + /** + * Set number of masters (VMs) to host docker containers. The default value is 3. + * + * @param count the count value to set + * @return the OpenShiftManagedClusterMasterPoolProfile object itself. + */ + public OpenShiftManagedClusterMasterPoolProfile withCount(int count) { + this.count = count; + return this; + } + + /** + * Get size of agent VMs. Possible values include: 'Standard_D2s_v3', 'Standard_D4s_v3', 'Standard_D8s_v3', 'Standard_D16s_v3', 'Standard_D32s_v3', 'Standard_D64s_v3', 'Standard_DS4_v2', 'Standard_DS5_v2', 'Standard_F8s_v2', 'Standard_F16s_v2', 'Standard_F32s_v2', 'Standard_F64s_v2', 'Standard_F72s_v2', 'Standard_F8s', 'Standard_F16s', 'Standard_E4s_v3', 'Standard_E8s_v3', 'Standard_E16s_v3', 'Standard_E20s_v3', 'Standard_E32s_v3', 'Standard_E64s_v3', 'Standard_GS2', 'Standard_GS3', 'Standard_GS4', 'Standard_GS5', 'Standard_DS12_v2', 'Standard_DS13_v2', 'Standard_DS14_v2', 'Standard_DS15_v2', 'Standard_L4s', 'Standard_L8s', 'Standard_L16s', 'Standard_L32s'. + * + * @return the vmSize value + */ + public OpenShiftContainerServiceVMSize vmSize() { + return this.vmSize; + } + + /** + * Set size of agent VMs. Possible values include: 'Standard_D2s_v3', 'Standard_D4s_v3', 'Standard_D8s_v3', 'Standard_D16s_v3', 'Standard_D32s_v3', 'Standard_D64s_v3', 'Standard_DS4_v2', 'Standard_DS5_v2', 'Standard_F8s_v2', 'Standard_F16s_v2', 'Standard_F32s_v2', 'Standard_F64s_v2', 'Standard_F72s_v2', 'Standard_F8s', 'Standard_F16s', 'Standard_E4s_v3', 'Standard_E8s_v3', 'Standard_E16s_v3', 'Standard_E20s_v3', 'Standard_E32s_v3', 'Standard_E64s_v3', 'Standard_GS2', 'Standard_GS3', 'Standard_GS4', 'Standard_GS5', 'Standard_DS12_v2', 'Standard_DS13_v2', 'Standard_DS14_v2', 'Standard_DS15_v2', 'Standard_L4s', 'Standard_L8s', 'Standard_L16s', 'Standard_L32s'. + * + * @param vmSize the vmSize value to set + * @return the OpenShiftManagedClusterMasterPoolProfile object itself. + */ + public OpenShiftManagedClusterMasterPoolProfile withVmSize(OpenShiftContainerServiceVMSize vmSize) { + this.vmSize = vmSize; + return this; + } + + /** + * Get subnet CIDR for the peering. + * + * @return the subnetCidr value + */ + public String subnetCidr() { + return this.subnetCidr; + } + + /** + * Set subnet CIDR for the peering. + * + * @param subnetCidr the subnetCidr value to set + * @return the OpenShiftManagedClusterMasterPoolProfile object itself. + */ + public OpenShiftManagedClusterMasterPoolProfile withSubnetCidr(String subnetCidr) { + this.subnetCidr = subnetCidr; + return this; + } + + /** + * Get osType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: 'Linux', 'Windows'. + * + * @return the osType value + */ + public OSType osType() { + return this.osType; + } + + /** + * Set osType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: 'Linux', 'Windows'. + * + * @param osType the osType value to set + * @return the OpenShiftManagedClusterMasterPoolProfile object itself. + */ + public OpenShiftManagedClusterMasterPoolProfile withOsType(OSType osType) { + this.osType = osType; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftManagedClusters.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftManagedClusters.java new file mode 100644 index 000000000000..40061a758906 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftManagedClusters.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.OpenShiftManagedClustersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing OpenShiftManagedClusters. + */ +public interface OpenShiftManagedClusters extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftRouterProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftRouterProfile.java new file mode 100644 index 000000000000..b3d740641f1d --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OpenShiftRouterProfile.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents an OpenShift router. + */ +public class OpenShiftRouterProfile { + /** + * Name of the router profile. + */ + @JsonProperty(value = "name") + private String name; + + /** + * DNS subdomain for OpenShift router. + */ + @JsonProperty(value = "publicSubdomain", access = JsonProperty.Access.WRITE_ONLY) + private String publicSubdomain; + + /** + * Auto-allocated FQDN for the OpenShift router. + */ + @JsonProperty(value = "fqdn", access = JsonProperty.Access.WRITE_ONLY) + private String fqdn; + + /** + * Get name of the router profile. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of the router profile. + * + * @param name the name value to set + * @return the OpenShiftRouterProfile object itself. + */ + public OpenShiftRouterProfile withName(String name) { + this.name = name; + return this; + } + + /** + * Get dNS subdomain for OpenShift router. + * + * @return the publicSubdomain value + */ + public String publicSubdomain() { + return this.publicSubdomain; + } + + /** + * Get auto-allocated FQDN for the OpenShift router. + * + * @return the fqdn value + */ + public String fqdn() { + return this.fqdn; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OperationValue.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OperationValue.java new file mode 100644 index 000000000000..ce5f90208da5 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OperationValue.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.ContainerServiceManager; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.OperationValueInner; + +/** + * Type representing OperationValue. + */ +public interface OperationValue extends HasInner, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the operation value. + */ + String operation(); + + /** + * @return the origin value. + */ + String origin(); + + /** + * @return the provider value. + */ + String provider(); + + /** + * @return the resource value. + */ + String resource(); + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/Operations.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/Operations.java new file mode 100644 index 000000000000..f859cb23871a --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import rx.Observable; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Gets a list of compute operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OrchestratorProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OrchestratorProfile.java new file mode 100644 index 000000000000..4d59cc6c9cb1 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OrchestratorProfile.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains information about orchestrator. + */ +public class OrchestratorProfile { + /** + * Orchestrator type. + */ + @JsonProperty(value = "orchestratorType") + private String orchestratorType; + + /** + * Orchestrator version (major, minor, patch). + */ + @JsonProperty(value = "orchestratorVersion", required = true) + private String orchestratorVersion; + + /** + * Whether Kubernetes version is currently in preview. + */ + @JsonProperty(value = "isPreview") + private Boolean isPreview; + + /** + * Get orchestrator type. + * + * @return the orchestratorType value + */ + public String orchestratorType() { + return this.orchestratorType; + } + + /** + * Set orchestrator type. + * + * @param orchestratorType the orchestratorType value to set + * @return the OrchestratorProfile object itself. + */ + public OrchestratorProfile withOrchestratorType(String orchestratorType) { + this.orchestratorType = orchestratorType; + return this; + } + + /** + * Get orchestrator version (major, minor, patch). + * + * @return the orchestratorVersion value + */ + public String orchestratorVersion() { + return this.orchestratorVersion; + } + + /** + * Set orchestrator version (major, minor, patch). + * + * @param orchestratorVersion the orchestratorVersion value to set + * @return the OrchestratorProfile object itself. + */ + public OrchestratorProfile withOrchestratorVersion(String orchestratorVersion) { + this.orchestratorVersion = orchestratorVersion; + return this; + } + + /** + * Get whether Kubernetes version is currently in preview. + * + * @return the isPreview value + */ + public Boolean isPreview() { + return this.isPreview; + } + + /** + * Set whether Kubernetes version is currently in preview. + * + * @param isPreview the isPreview value to set + * @return the OrchestratorProfile object itself. + */ + public OrchestratorProfile withIsPreview(Boolean isPreview) { + this.isPreview = isPreview; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OrchestratorVersionProfile.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OrchestratorVersionProfile.java new file mode 100644 index 000000000000..a5ed50e3d0a6 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OrchestratorVersionProfile.java @@ -0,0 +1,148 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The profile of an orchestrator and its available versions. + */ +public class OrchestratorVersionProfile { + /** + * Orchestrator type. + */ + @JsonProperty(value = "orchestratorType", required = true) + private String orchestratorType; + + /** + * Orchestrator version (major, minor, patch). + */ + @JsonProperty(value = "orchestratorVersion", required = true) + private String orchestratorVersion; + + /** + * Installed by default if version is not specified. + */ + @JsonProperty(value = "default") + private Boolean defaultProperty; + + /** + * Whether Kubernetes version is currently in preview. + */ + @JsonProperty(value = "isPreview") + private Boolean isPreview; + + /** + * The list of available upgrade versions. + */ + @JsonProperty(value = "upgrades") + private List upgrades; + + /** + * Get orchestrator type. + * + * @return the orchestratorType value + */ + public String orchestratorType() { + return this.orchestratorType; + } + + /** + * Set orchestrator type. + * + * @param orchestratorType the orchestratorType value to set + * @return the OrchestratorVersionProfile object itself. + */ + public OrchestratorVersionProfile withOrchestratorType(String orchestratorType) { + this.orchestratorType = orchestratorType; + return this; + } + + /** + * Get orchestrator version (major, minor, patch). + * + * @return the orchestratorVersion value + */ + public String orchestratorVersion() { + return this.orchestratorVersion; + } + + /** + * Set orchestrator version (major, minor, patch). + * + * @param orchestratorVersion the orchestratorVersion value to set + * @return the OrchestratorVersionProfile object itself. + */ + public OrchestratorVersionProfile withOrchestratorVersion(String orchestratorVersion) { + this.orchestratorVersion = orchestratorVersion; + return this; + } + + /** + * Get installed by default if version is not specified. + * + * @return the defaultProperty value + */ + public Boolean defaultProperty() { + return this.defaultProperty; + } + + /** + * Set installed by default if version is not specified. + * + * @param defaultProperty the defaultProperty value to set + * @return the OrchestratorVersionProfile object itself. + */ + public OrchestratorVersionProfile withDefaultProperty(Boolean defaultProperty) { + this.defaultProperty = defaultProperty; + return this; + } + + /** + * Get whether Kubernetes version is currently in preview. + * + * @return the isPreview value + */ + public Boolean isPreview() { + return this.isPreview; + } + + /** + * Set whether Kubernetes version is currently in preview. + * + * @param isPreview the isPreview value to set + * @return the OrchestratorVersionProfile object itself. + */ + public OrchestratorVersionProfile withIsPreview(Boolean isPreview) { + this.isPreview = isPreview; + return this; + } + + /** + * Get the list of available upgrade versions. + * + * @return the upgrades value + */ + public List upgrades() { + return this.upgrades; + } + + /** + * Set the list of available upgrade versions. + * + * @param upgrades the upgrades value to set + * @return the OrchestratorVersionProfile object itself. + */ + public OrchestratorVersionProfile withUpgrades(List upgrades) { + this.upgrades = upgrades; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OrchestratorVersionProfileListResult.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OrchestratorVersionProfileListResult.java new file mode 100644 index 000000000000..2c05209149b0 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/OrchestratorVersionProfileListResult.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.ContainerServiceManager; +import com.microsoft.azure.management.containerservice.v2019_08_01.implementation.OrchestratorVersionProfileListResultInner; +import java.util.List; + +/** + * Type representing OrchestratorVersionProfileListResult. + */ +public interface OrchestratorVersionProfileListResult extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the orchestrators value. + */ + List orchestrators(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/PurchasePlan.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/PurchasePlan.java new file mode 100644 index 000000000000..1c1cdb8210f3 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/PurchasePlan.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Used for establishing the purchase context of any 3rd Party artifact through + * MarketPlace. + */ +public class PurchasePlan { + /** + * The plan ID. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Specifies the product of the image from the marketplace. This is the + * same value as Offer under the imageReference element. + */ + @JsonProperty(value = "product") + private String product; + + /** + * The promotion code. + */ + @JsonProperty(value = "promotionCode") + private String promotionCode; + + /** + * The plan ID. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /** + * Get the plan ID. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the plan ID. + * + * @param name the name value to set + * @return the PurchasePlan object itself. + */ + public PurchasePlan withName(String name) { + this.name = name; + return this; + } + + /** + * Get specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element. + * + * @return the product value + */ + public String product() { + return this.product; + } + + /** + * Set specifies the product of the image from the marketplace. This is the same value as Offer under the imageReference element. + * + * @param product the product value to set + * @return the PurchasePlan object itself. + */ + public PurchasePlan withProduct(String product) { + this.product = product; + return this; + } + + /** + * Get the promotion code. + * + * @return the promotionCode value + */ + public String promotionCode() { + return this.promotionCode; + } + + /** + * Set the promotion code. + * + * @param promotionCode the promotionCode value to set + * @return the PurchasePlan object itself. + */ + public PurchasePlan withPromotionCode(String promotionCode) { + this.promotionCode = promotionCode; + return this; + } + + /** + * Get the plan ID. + * + * @return the publisher value + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the plan ID. + * + * @param publisher the publisher value to set + * @return the PurchasePlan object itself. + */ + public PurchasePlan withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ResourceIdentityType.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ResourceIdentityType.java new file mode 100644 index 000000000000..3841dd4dc7c9 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ResourceIdentityType.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ResourceIdentityType. + */ +public enum ResourceIdentityType { + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"), + + /** Enum value None. */ + NONE("None"); + + /** The actual serialized value for a ResourceIdentityType instance. */ + private String value; + + ResourceIdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceIdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceIdentityType object, or null if unable to parse. + */ + @JsonCreator + public static ResourceIdentityType fromString(String value) { + ResourceIdentityType[] items = ResourceIdentityType.values(); + for (ResourceIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ResourceReference.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ResourceReference.java new file mode 100644 index 000000000000..e88fff982465 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ResourceReference.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A reference to an Azure resource. + */ +public class ResourceReference { + /** + * The fully qualified Azure resource id. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the fully qualified Azure resource id. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the fully qualified Azure resource id. + * + * @param id the id value to set + * @return the ResourceReference object itself. + */ + public ResourceReference withId(String id) { + this.id = id; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ScaleSetEvictionPolicy.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ScaleSetEvictionPolicy.java new file mode 100644 index 000000000000..5399e37e8ad7 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ScaleSetEvictionPolicy.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ScaleSetEvictionPolicy. + */ +public final class ScaleSetEvictionPolicy extends ExpandableStringEnum { + /** Static value Delete for ScaleSetEvictionPolicy. */ + public static final ScaleSetEvictionPolicy DELETE = fromString("Delete"); + + /** Static value Deallocate for ScaleSetEvictionPolicy. */ + public static final ScaleSetEvictionPolicy DEALLOCATE = fromString("Deallocate"); + + /** + * Creates or finds a ScaleSetEvictionPolicy from its string representation. + * @param name a name to look for + * @return the corresponding ScaleSetEvictionPolicy + */ + @JsonCreator + public static ScaleSetEvictionPolicy fromString(String name) { + return fromString(name, ScaleSetEvictionPolicy.class); + } + + /** + * @return known ScaleSetEvictionPolicy values + */ + public static Collection values() { + return values(ScaleSetEvictionPolicy.class); + } +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ScaleSetPriority.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ScaleSetPriority.java new file mode 100644 index 000000000000..bef9422ab4b2 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ScaleSetPriority.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ScaleSetPriority. + */ +public final class ScaleSetPriority extends ExpandableStringEnum { + /** Static value Low for ScaleSetPriority. */ + public static final ScaleSetPriority LOW = fromString("Low"); + + /** Static value Regular for ScaleSetPriority. */ + public static final ScaleSetPriority REGULAR = fromString("Regular"); + + /** + * Creates or finds a ScaleSetPriority from its string representation. + * @param name a name to look for + * @return the corresponding ScaleSetPriority + */ + @JsonCreator + public static ScaleSetPriority fromString(String name) { + return fromString(name, ScaleSetPriority.class); + } + + /** + * @return known ScaleSetPriority values + */ + public static Collection values() { + return values(ScaleSetPriority.class); + } +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/TagsObject.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/TagsObject.java new file mode 100644 index 000000000000..94a13efa9728 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/TagsObject.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Tags object for patch operations. + */ +public class TagsObject { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the TagsObject object itself. + */ + public TagsObject withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/AgentPoolAvailableVersionsImpl.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/AgentPoolAvailableVersionsImpl.java new file mode 100644 index 000000000000..f67860dcdf90 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/AgentPoolAvailableVersionsImpl.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.management.containerservice.v2019_08_01.AgentPoolAvailableVersions; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.containerservice.v2019_08_01.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem; + +class AgentPoolAvailableVersionsImpl extends WrapperImpl implements AgentPoolAvailableVersions { + private final ContainerServiceManager manager; + AgentPoolAvailableVersionsImpl(AgentPoolAvailableVersionsInner inner, ContainerServiceManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ContainerServiceManager manager() { + return this.manager; + } + + @Override + public List agentPoolVersions() { + return this.inner().agentPoolVersions(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/AgentPoolAvailableVersionsInner.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/AgentPoolAvailableVersionsInner.java new file mode 100644 index 000000000000..4679b134d636 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/AgentPoolAvailableVersionsInner.java @@ -0,0 +1,92 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.containerservice.v2019_08_01.AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The list of available versions for an agent pool. + */ +@JsonFlatten +public class AgentPoolAvailableVersionsInner { + /** + * Id of the agent pool available versions. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Name of the agent pool available versions. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Type of the agent pool available versions. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * List of versions available for agent pool. + */ + @JsonProperty(value = "properties.agentPoolVersions") + private List agentPoolVersions; + + /** + * Get id of the agent pool available versions. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get name of the agent pool available versions. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get type of the agent pool available versions. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get list of versions available for agent pool. + * + * @return the agentPoolVersions value + */ + public List agentPoolVersions() { + return this.agentPoolVersions; + } + + /** + * Set list of versions available for agent pool. + * + * @param agentPoolVersions the agentPoolVersions value to set + * @return the AgentPoolAvailableVersionsInner object itself. + */ + public AgentPoolAvailableVersionsInner withAgentPoolVersions(List agentPoolVersions) { + this.agentPoolVersions = agentPoolVersions; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/AgentPoolImpl.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/AgentPoolImpl.java new file mode 100644 index 000000000000..3ae98ed95a30 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/AgentPoolImpl.java @@ -0,0 +1,281 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.management.containerservice.v2019_08_01.AgentPool; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServiceVMSizeTypes; +import com.microsoft.azure.management.containerservice.v2019_08_01.OSType; +import com.microsoft.azure.management.containerservice.v2019_08_01.AgentPoolType; +import java.util.List; +import com.microsoft.azure.management.containerservice.v2019_08_01.ScaleSetPriority; +import com.microsoft.azure.management.containerservice.v2019_08_01.ScaleSetEvictionPolicy; + +class AgentPoolImpl extends CreatableUpdatableImpl implements AgentPool, AgentPool.Definition, AgentPool.Update { + private final ContainerServiceManager manager; + private String resourceGroupName; + private String resourceName; + private String agentPoolName; + + AgentPoolImpl(String name, ContainerServiceManager manager) { + super(name, new AgentPoolInner()); + this.manager = manager; + // Set resource name + this.agentPoolName = name; + // + } + + AgentPoolImpl(AgentPoolInner inner, ContainerServiceManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.agentPoolName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.resourceName = IdParsingUtils.getValueFromIdByName(inner.id(), "managedClusters"); + this.agentPoolName = IdParsingUtils.getValueFromIdByName(inner.id(), "agentPools"); + // + } + + @Override + public ContainerServiceManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + AgentPoolsInner client = this.manager().inner().agentPools(); + return client.createOrUpdateAsync(this.resourceGroupName, this.resourceName, this.agentPoolName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + AgentPoolsInner client = this.manager().inner().agentPools(); + return client.createOrUpdateAsync(this.resourceGroupName, this.resourceName, this.agentPoolName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + AgentPoolsInner client = this.manager().inner().agentPools(); + return client.getAsync(this.resourceGroupName, this.resourceName, this.agentPoolName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public AgentPoolType agentPoolType() { + return this.inner().agentPoolType(); + } + + @Override + public List availabilityZones() { + return this.inner().availabilityZones(); + } + + @Override + public int count() { + return this.inner().count(); + } + + @Override + public Boolean enableAutoScaling() { + return this.inner().enableAutoScaling(); + } + + @Override + public Boolean enableNodePublicIP() { + return this.inner().enableNodePublicIP(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Integer maxCount() { + return this.inner().maxCount(); + } + + @Override + public Integer maxPods() { + return this.inner().maxPods(); + } + + @Override + public Integer minCount() { + return this.inner().minCount(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List nodeTaints() { + return this.inner().nodeTaints(); + } + + @Override + public String orchestratorVersion() { + return this.inner().orchestratorVersion(); + } + + @Override + public Integer osDiskSizeGB() { + return this.inner().osDiskSizeGB(); + } + + @Override + public OSType osType() { + return this.inner().osType(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public ScaleSetEvictionPolicy scaleSetEvictionPolicy() { + return this.inner().scaleSetEvictionPolicy(); + } + + @Override + public ScaleSetPriority scaleSetPriority() { + return this.inner().scaleSetPriority(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ContainerServiceVMSizeTypes vmSize() { + return this.inner().vmSize(); + } + + @Override + public String vnetSubnetID() { + return this.inner().vnetSubnetID(); + } + + @Override + public AgentPoolImpl withExistingManagedCluster(String resourceGroupName, String resourceName) { + this.resourceGroupName = resourceGroupName; + this.resourceName = resourceName; + return this; + } + + @Override + public AgentPoolImpl withCount(int count) { + this.inner().withCount(count); + return this; + } + + @Override + public AgentPoolImpl withVmSize(ContainerServiceVMSizeTypes vmSize) { + this.inner().withVmSize(vmSize); + return this; + } + + @Override + public AgentPoolImpl withAgentPoolType(AgentPoolType agentPoolType) { + this.inner().withAgentPoolType(agentPoolType); + return this; + } + + @Override + public AgentPoolImpl withAvailabilityZones(List availabilityZones) { + this.inner().withAvailabilityZones(availabilityZones); + return this; + } + + @Override + public AgentPoolImpl withEnableAutoScaling(Boolean enableAutoScaling) { + this.inner().withEnableAutoScaling(enableAutoScaling); + return this; + } + + @Override + public AgentPoolImpl withEnableNodePublicIP(Boolean enableNodePublicIP) { + this.inner().withEnableNodePublicIP(enableNodePublicIP); + return this; + } + + @Override + public AgentPoolImpl withMaxCount(Integer maxCount) { + this.inner().withMaxCount(maxCount); + return this; + } + + @Override + public AgentPoolImpl withMaxPods(Integer maxPods) { + this.inner().withMaxPods(maxPods); + return this; + } + + @Override + public AgentPoolImpl withMinCount(Integer minCount) { + this.inner().withMinCount(minCount); + return this; + } + + @Override + public AgentPoolImpl withNodeTaints(List nodeTaints) { + this.inner().withNodeTaints(nodeTaints); + return this; + } + + @Override + public AgentPoolImpl withOrchestratorVersion(String orchestratorVersion) { + this.inner().withOrchestratorVersion(orchestratorVersion); + return this; + } + + @Override + public AgentPoolImpl withOsDiskSizeGB(Integer osDiskSizeGB) { + this.inner().withOsDiskSizeGB(osDiskSizeGB); + return this; + } + + @Override + public AgentPoolImpl withOsType(OSType osType) { + this.inner().withOsType(osType); + return this; + } + + @Override + public AgentPoolImpl withScaleSetEvictionPolicy(ScaleSetEvictionPolicy scaleSetEvictionPolicy) { + this.inner().withScaleSetEvictionPolicy(scaleSetEvictionPolicy); + return this; + } + + @Override + public AgentPoolImpl withScaleSetPriority(ScaleSetPriority scaleSetPriority) { + this.inner().withScaleSetPriority(scaleSetPriority); + return this; + } + + @Override + public AgentPoolImpl withVnetSubnetID(String vnetSubnetID) { + this.inner().withVnetSubnetID(vnetSubnetID); + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/AgentPoolInner.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/AgentPoolInner.java new file mode 100644 index 000000000000..58db15a020ad --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/AgentPoolInner.java @@ -0,0 +1,550 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServiceVMSizeTypes; +import com.microsoft.azure.management.containerservice.v2019_08_01.OSType; +import com.microsoft.azure.management.containerservice.v2019_08_01.AgentPoolType; +import java.util.List; +import com.microsoft.azure.management.containerservice.v2019_08_01.ScaleSetPriority; +import com.microsoft.azure.management.containerservice.v2019_08_01.ScaleSetEvictionPolicy; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.SubResource; + +/** + * Agent Pool. + */ +@JsonFlatten +public class AgentPoolInner extends SubResource { + /** + * Number of agents (VMs) to host docker containers. Allowed values must be + * in the range of 1 to 100 (inclusive). The default value is 1. + */ + @JsonProperty(value = "properties.count", required = true) + private int count; + + /** + * Size of agent VMs. Possible values include: 'Standard_A1', + * 'Standard_A10', 'Standard_A11', 'Standard_A1_v2', 'Standard_A2', + * 'Standard_A2_v2', 'Standard_A2m_v2', 'Standard_A3', 'Standard_A4', + * 'Standard_A4_v2', 'Standard_A4m_v2', 'Standard_A5', 'Standard_A6', + * 'Standard_A7', 'Standard_A8', 'Standard_A8_v2', 'Standard_A8m_v2', + * 'Standard_A9', 'Standard_B2ms', 'Standard_B2s', 'Standard_B4ms', + * 'Standard_B8ms', 'Standard_D1', 'Standard_D11', 'Standard_D11_v2', + * 'Standard_D11_v2_Promo', 'Standard_D12', 'Standard_D12_v2', + * 'Standard_D12_v2_Promo', 'Standard_D13', 'Standard_D13_v2', + * 'Standard_D13_v2_Promo', 'Standard_D14', 'Standard_D14_v2', + * 'Standard_D14_v2_Promo', 'Standard_D15_v2', 'Standard_D16_v3', + * 'Standard_D16s_v3', 'Standard_D1_v2', 'Standard_D2', 'Standard_D2_v2', + * 'Standard_D2_v2_Promo', 'Standard_D2_v3', 'Standard_D2s_v3', + * 'Standard_D3', 'Standard_D32_v3', 'Standard_D32s_v3', 'Standard_D3_v2', + * 'Standard_D3_v2_Promo', 'Standard_D4', 'Standard_D4_v2', + * 'Standard_D4_v2_Promo', 'Standard_D4_v3', 'Standard_D4s_v3', + * 'Standard_D5_v2', 'Standard_D5_v2_Promo', 'Standard_D64_v3', + * 'Standard_D64s_v3', 'Standard_D8_v3', 'Standard_D8s_v3', 'Standard_DS1', + * 'Standard_DS11', 'Standard_DS11_v2', 'Standard_DS11_v2_Promo', + * 'Standard_DS12', 'Standard_DS12_v2', 'Standard_DS12_v2_Promo', + * 'Standard_DS13', 'Standard_DS13-2_v2', 'Standard_DS13-4_v2', + * 'Standard_DS13_v2', 'Standard_DS13_v2_Promo', 'Standard_DS14', + * 'Standard_DS14-4_v2', 'Standard_DS14-8_v2', 'Standard_DS14_v2', + * 'Standard_DS14_v2_Promo', 'Standard_DS15_v2', 'Standard_DS1_v2', + * 'Standard_DS2', 'Standard_DS2_v2', 'Standard_DS2_v2_Promo', + * 'Standard_DS3', 'Standard_DS3_v2', 'Standard_DS3_v2_Promo', + * 'Standard_DS4', 'Standard_DS4_v2', 'Standard_DS4_v2_Promo', + * 'Standard_DS5_v2', 'Standard_DS5_v2_Promo', 'Standard_E16_v3', + * 'Standard_E16s_v3', 'Standard_E2_v3', 'Standard_E2s_v3', + * 'Standard_E32-16s_v3', 'Standard_E32-8s_v3', 'Standard_E32_v3', + * 'Standard_E32s_v3', 'Standard_E4_v3', 'Standard_E4s_v3', + * 'Standard_E64-16s_v3', 'Standard_E64-32s_v3', 'Standard_E64_v3', + * 'Standard_E64s_v3', 'Standard_E8_v3', 'Standard_E8s_v3', 'Standard_F1', + * 'Standard_F16', 'Standard_F16s', 'Standard_F16s_v2', 'Standard_F1s', + * 'Standard_F2', 'Standard_F2s', 'Standard_F2s_v2', 'Standard_F32s_v2', + * 'Standard_F4', 'Standard_F4s', 'Standard_F4s_v2', 'Standard_F64s_v2', + * 'Standard_F72s_v2', 'Standard_F8', 'Standard_F8s', 'Standard_F8s_v2', + * 'Standard_G1', 'Standard_G2', 'Standard_G3', 'Standard_G4', + * 'Standard_G5', 'Standard_GS1', 'Standard_GS2', 'Standard_GS3', + * 'Standard_GS4', 'Standard_GS4-4', 'Standard_GS4-8', 'Standard_GS5', + * 'Standard_GS5-16', 'Standard_GS5-8', 'Standard_H16', 'Standard_H16m', + * 'Standard_H16mr', 'Standard_H16r', 'Standard_H8', 'Standard_H8m', + * 'Standard_L16s', 'Standard_L32s', 'Standard_L4s', 'Standard_L8s', + * 'Standard_M128-32ms', 'Standard_M128-64ms', 'Standard_M128ms', + * 'Standard_M128s', 'Standard_M64-16ms', 'Standard_M64-32ms', + * 'Standard_M64ms', 'Standard_M64s', 'Standard_NC12', 'Standard_NC12s_v2', + * 'Standard_NC12s_v3', 'Standard_NC24', 'Standard_NC24r', + * 'Standard_NC24rs_v2', 'Standard_NC24rs_v3', 'Standard_NC24s_v2', + * 'Standard_NC24s_v3', 'Standard_NC6', 'Standard_NC6s_v2', + * 'Standard_NC6s_v3', 'Standard_ND12s', 'Standard_ND24rs', + * 'Standard_ND24s', 'Standard_ND6s', 'Standard_NV12', 'Standard_NV24', + * 'Standard_NV6'. + */ + @JsonProperty(value = "properties.vmSize", required = true) + private ContainerServiceVMSizeTypes vmSize; + + /** + * OS Disk Size in GB to be used to specify the disk size for every machine + * in this master/agent pool. If you specify 0, it will apply the default + * osDisk size according to the vmSize specified. + */ + @JsonProperty(value = "properties.osDiskSizeGB") + private Integer osDiskSizeGB; + + /** + * VNet SubnetID specifies the VNet's subnet identifier. + */ + @JsonProperty(value = "properties.vnetSubnetID") + private String vnetSubnetID; + + /** + * Maximum number of pods that can run on a node. + */ + @JsonProperty(value = "properties.maxPods") + private Integer maxPods; + + /** + * OsType to be used to specify os type. Choose from Linux and Windows. + * Default to Linux. Possible values include: 'Linux', 'Windows'. + */ + @JsonProperty(value = "properties.osType") + private OSType osType; + + /** + * Maximum number of nodes for auto-scaling. + */ + @JsonProperty(value = "properties.maxCount") + private Integer maxCount; + + /** + * Minimum number of nodes for auto-scaling. + */ + @JsonProperty(value = "properties.minCount") + private Integer minCount; + + /** + * Whether to enable auto-scaler. + */ + @JsonProperty(value = "properties.enableAutoScaling") + private Boolean enableAutoScaling; + + /** + * AgentPoolType represents types of an agent pool. Possible values + * include: 'VirtualMachineScaleSets', 'AvailabilitySet'. + */ + @JsonProperty(value = "properties.type") + private AgentPoolType agentPoolType; + + /** + * Version of orchestrator specified when creating the managed cluster. + */ + @JsonProperty(value = "properties.orchestratorVersion") + private String orchestratorVersion; + + /** + * The current deployment or provisioning state, which only appears in the + * response. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * (PREVIEW) Availability zones for nodes. Must use VirtualMachineScaleSets + * AgentPoolType. + */ + @JsonProperty(value = "properties.availabilityZones") + private List availabilityZones; + + /** + * Enable public IP for nodes. + */ + @JsonProperty(value = "properties.enableNodePublicIP") + private Boolean enableNodePublicIP; + + /** + * ScaleSetPriority to be used to specify virtual machine scale set + * priority. Default to regular. Possible values include: 'Low', 'Regular'. + */ + @JsonProperty(value = "properties.scaleSetPriority") + private ScaleSetPriority scaleSetPriority; + + /** + * ScaleSetEvictionPolicy to be used to specify eviction policy for low + * priority virtual machine scale set. Default to Delete. Possible values + * include: 'Delete', 'Deallocate'. + */ + @JsonProperty(value = "properties.scaleSetEvictionPolicy") + private ScaleSetEvictionPolicy scaleSetEvictionPolicy; + + /** + * Taints added to new nodes during node pool create and scale. For + * example, key=value:NoSchedule. + */ + @JsonProperty(value = "properties.nodeTaints") + private List nodeTaints; + + /** + * The name of the resource that is unique within a resource group. This + * name can be used to access the resource. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Get number of agents (VMs) to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. + * + * @return the count value + */ + public int count() { + return this.count; + } + + /** + * Set number of agents (VMs) to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. + * + * @param count the count value to set + * @return the AgentPoolInner object itself. + */ + public AgentPoolInner withCount(int count) { + this.count = count; + return this; + } + + /** + * Get size of agent VMs. Possible values include: 'Standard_A1', 'Standard_A10', 'Standard_A11', 'Standard_A1_v2', 'Standard_A2', 'Standard_A2_v2', 'Standard_A2m_v2', 'Standard_A3', 'Standard_A4', 'Standard_A4_v2', 'Standard_A4m_v2', 'Standard_A5', 'Standard_A6', 'Standard_A7', 'Standard_A8', 'Standard_A8_v2', 'Standard_A8m_v2', 'Standard_A9', 'Standard_B2ms', 'Standard_B2s', 'Standard_B4ms', 'Standard_B8ms', 'Standard_D1', 'Standard_D11', 'Standard_D11_v2', 'Standard_D11_v2_Promo', 'Standard_D12', 'Standard_D12_v2', 'Standard_D12_v2_Promo', 'Standard_D13', 'Standard_D13_v2', 'Standard_D13_v2_Promo', 'Standard_D14', 'Standard_D14_v2', 'Standard_D14_v2_Promo', 'Standard_D15_v2', 'Standard_D16_v3', 'Standard_D16s_v3', 'Standard_D1_v2', 'Standard_D2', 'Standard_D2_v2', 'Standard_D2_v2_Promo', 'Standard_D2_v3', 'Standard_D2s_v3', 'Standard_D3', 'Standard_D32_v3', 'Standard_D32s_v3', 'Standard_D3_v2', 'Standard_D3_v2_Promo', 'Standard_D4', 'Standard_D4_v2', 'Standard_D4_v2_Promo', 'Standard_D4_v3', 'Standard_D4s_v3', 'Standard_D5_v2', 'Standard_D5_v2_Promo', 'Standard_D64_v3', 'Standard_D64s_v3', 'Standard_D8_v3', 'Standard_D8s_v3', 'Standard_DS1', 'Standard_DS11', 'Standard_DS11_v2', 'Standard_DS11_v2_Promo', 'Standard_DS12', 'Standard_DS12_v2', 'Standard_DS12_v2_Promo', 'Standard_DS13', 'Standard_DS13-2_v2', 'Standard_DS13-4_v2', 'Standard_DS13_v2', 'Standard_DS13_v2_Promo', 'Standard_DS14', 'Standard_DS14-4_v2', 'Standard_DS14-8_v2', 'Standard_DS14_v2', 'Standard_DS14_v2_Promo', 'Standard_DS15_v2', 'Standard_DS1_v2', 'Standard_DS2', 'Standard_DS2_v2', 'Standard_DS2_v2_Promo', 'Standard_DS3', 'Standard_DS3_v2', 'Standard_DS3_v2_Promo', 'Standard_DS4', 'Standard_DS4_v2', 'Standard_DS4_v2_Promo', 'Standard_DS5_v2', 'Standard_DS5_v2_Promo', 'Standard_E16_v3', 'Standard_E16s_v3', 'Standard_E2_v3', 'Standard_E2s_v3', 'Standard_E32-16s_v3', 'Standard_E32-8s_v3', 'Standard_E32_v3', 'Standard_E32s_v3', 'Standard_E4_v3', 'Standard_E4s_v3', 'Standard_E64-16s_v3', 'Standard_E64-32s_v3', 'Standard_E64_v3', 'Standard_E64s_v3', 'Standard_E8_v3', 'Standard_E8s_v3', 'Standard_F1', 'Standard_F16', 'Standard_F16s', 'Standard_F16s_v2', 'Standard_F1s', 'Standard_F2', 'Standard_F2s', 'Standard_F2s_v2', 'Standard_F32s_v2', 'Standard_F4', 'Standard_F4s', 'Standard_F4s_v2', 'Standard_F64s_v2', 'Standard_F72s_v2', 'Standard_F8', 'Standard_F8s', 'Standard_F8s_v2', 'Standard_G1', 'Standard_G2', 'Standard_G3', 'Standard_G4', 'Standard_G5', 'Standard_GS1', 'Standard_GS2', 'Standard_GS3', 'Standard_GS4', 'Standard_GS4-4', 'Standard_GS4-8', 'Standard_GS5', 'Standard_GS5-16', 'Standard_GS5-8', 'Standard_H16', 'Standard_H16m', 'Standard_H16mr', 'Standard_H16r', 'Standard_H8', 'Standard_H8m', 'Standard_L16s', 'Standard_L32s', 'Standard_L4s', 'Standard_L8s', 'Standard_M128-32ms', 'Standard_M128-64ms', 'Standard_M128ms', 'Standard_M128s', 'Standard_M64-16ms', 'Standard_M64-32ms', 'Standard_M64ms', 'Standard_M64s', 'Standard_NC12', 'Standard_NC12s_v2', 'Standard_NC12s_v3', 'Standard_NC24', 'Standard_NC24r', 'Standard_NC24rs_v2', 'Standard_NC24rs_v3', 'Standard_NC24s_v2', 'Standard_NC24s_v3', 'Standard_NC6', 'Standard_NC6s_v2', 'Standard_NC6s_v3', 'Standard_ND12s', 'Standard_ND24rs', 'Standard_ND24s', 'Standard_ND6s', 'Standard_NV12', 'Standard_NV24', 'Standard_NV6'. + * + * @return the vmSize value + */ + public ContainerServiceVMSizeTypes vmSize() { + return this.vmSize; + } + + /** + * Set size of agent VMs. Possible values include: 'Standard_A1', 'Standard_A10', 'Standard_A11', 'Standard_A1_v2', 'Standard_A2', 'Standard_A2_v2', 'Standard_A2m_v2', 'Standard_A3', 'Standard_A4', 'Standard_A4_v2', 'Standard_A4m_v2', 'Standard_A5', 'Standard_A6', 'Standard_A7', 'Standard_A8', 'Standard_A8_v2', 'Standard_A8m_v2', 'Standard_A9', 'Standard_B2ms', 'Standard_B2s', 'Standard_B4ms', 'Standard_B8ms', 'Standard_D1', 'Standard_D11', 'Standard_D11_v2', 'Standard_D11_v2_Promo', 'Standard_D12', 'Standard_D12_v2', 'Standard_D12_v2_Promo', 'Standard_D13', 'Standard_D13_v2', 'Standard_D13_v2_Promo', 'Standard_D14', 'Standard_D14_v2', 'Standard_D14_v2_Promo', 'Standard_D15_v2', 'Standard_D16_v3', 'Standard_D16s_v3', 'Standard_D1_v2', 'Standard_D2', 'Standard_D2_v2', 'Standard_D2_v2_Promo', 'Standard_D2_v3', 'Standard_D2s_v3', 'Standard_D3', 'Standard_D32_v3', 'Standard_D32s_v3', 'Standard_D3_v2', 'Standard_D3_v2_Promo', 'Standard_D4', 'Standard_D4_v2', 'Standard_D4_v2_Promo', 'Standard_D4_v3', 'Standard_D4s_v3', 'Standard_D5_v2', 'Standard_D5_v2_Promo', 'Standard_D64_v3', 'Standard_D64s_v3', 'Standard_D8_v3', 'Standard_D8s_v3', 'Standard_DS1', 'Standard_DS11', 'Standard_DS11_v2', 'Standard_DS11_v2_Promo', 'Standard_DS12', 'Standard_DS12_v2', 'Standard_DS12_v2_Promo', 'Standard_DS13', 'Standard_DS13-2_v2', 'Standard_DS13-4_v2', 'Standard_DS13_v2', 'Standard_DS13_v2_Promo', 'Standard_DS14', 'Standard_DS14-4_v2', 'Standard_DS14-8_v2', 'Standard_DS14_v2', 'Standard_DS14_v2_Promo', 'Standard_DS15_v2', 'Standard_DS1_v2', 'Standard_DS2', 'Standard_DS2_v2', 'Standard_DS2_v2_Promo', 'Standard_DS3', 'Standard_DS3_v2', 'Standard_DS3_v2_Promo', 'Standard_DS4', 'Standard_DS4_v2', 'Standard_DS4_v2_Promo', 'Standard_DS5_v2', 'Standard_DS5_v2_Promo', 'Standard_E16_v3', 'Standard_E16s_v3', 'Standard_E2_v3', 'Standard_E2s_v3', 'Standard_E32-16s_v3', 'Standard_E32-8s_v3', 'Standard_E32_v3', 'Standard_E32s_v3', 'Standard_E4_v3', 'Standard_E4s_v3', 'Standard_E64-16s_v3', 'Standard_E64-32s_v3', 'Standard_E64_v3', 'Standard_E64s_v3', 'Standard_E8_v3', 'Standard_E8s_v3', 'Standard_F1', 'Standard_F16', 'Standard_F16s', 'Standard_F16s_v2', 'Standard_F1s', 'Standard_F2', 'Standard_F2s', 'Standard_F2s_v2', 'Standard_F32s_v2', 'Standard_F4', 'Standard_F4s', 'Standard_F4s_v2', 'Standard_F64s_v2', 'Standard_F72s_v2', 'Standard_F8', 'Standard_F8s', 'Standard_F8s_v2', 'Standard_G1', 'Standard_G2', 'Standard_G3', 'Standard_G4', 'Standard_G5', 'Standard_GS1', 'Standard_GS2', 'Standard_GS3', 'Standard_GS4', 'Standard_GS4-4', 'Standard_GS4-8', 'Standard_GS5', 'Standard_GS5-16', 'Standard_GS5-8', 'Standard_H16', 'Standard_H16m', 'Standard_H16mr', 'Standard_H16r', 'Standard_H8', 'Standard_H8m', 'Standard_L16s', 'Standard_L32s', 'Standard_L4s', 'Standard_L8s', 'Standard_M128-32ms', 'Standard_M128-64ms', 'Standard_M128ms', 'Standard_M128s', 'Standard_M64-16ms', 'Standard_M64-32ms', 'Standard_M64ms', 'Standard_M64s', 'Standard_NC12', 'Standard_NC12s_v2', 'Standard_NC12s_v3', 'Standard_NC24', 'Standard_NC24r', 'Standard_NC24rs_v2', 'Standard_NC24rs_v3', 'Standard_NC24s_v2', 'Standard_NC24s_v3', 'Standard_NC6', 'Standard_NC6s_v2', 'Standard_NC6s_v3', 'Standard_ND12s', 'Standard_ND24rs', 'Standard_ND24s', 'Standard_ND6s', 'Standard_NV12', 'Standard_NV24', 'Standard_NV6'. + * + * @param vmSize the vmSize value to set + * @return the AgentPoolInner object itself. + */ + public AgentPoolInner withVmSize(ContainerServiceVMSizeTypes vmSize) { + this.vmSize = vmSize; + return this; + } + + /** + * Get oS Disk Size in GB to be used to specify the disk size for every machine in this master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. + * + * @return the osDiskSizeGB value + */ + public Integer osDiskSizeGB() { + return this.osDiskSizeGB; + } + + /** + * Set oS Disk Size in GB to be used to specify the disk size for every machine in this master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. + * + * @param osDiskSizeGB the osDiskSizeGB value to set + * @return the AgentPoolInner object itself. + */ + public AgentPoolInner withOsDiskSizeGB(Integer osDiskSizeGB) { + this.osDiskSizeGB = osDiskSizeGB; + return this; + } + + /** + * Get vNet SubnetID specifies the VNet's subnet identifier. + * + * @return the vnetSubnetID value + */ + public String vnetSubnetID() { + return this.vnetSubnetID; + } + + /** + * Set vNet SubnetID specifies the VNet's subnet identifier. + * + * @param vnetSubnetID the vnetSubnetID value to set + * @return the AgentPoolInner object itself. + */ + public AgentPoolInner withVnetSubnetID(String vnetSubnetID) { + this.vnetSubnetID = vnetSubnetID; + return this; + } + + /** + * Get maximum number of pods that can run on a node. + * + * @return the maxPods value + */ + public Integer maxPods() { + return this.maxPods; + } + + /** + * Set maximum number of pods that can run on a node. + * + * @param maxPods the maxPods value to set + * @return the AgentPoolInner object itself. + */ + public AgentPoolInner withMaxPods(Integer maxPods) { + this.maxPods = maxPods; + return this; + } + + /** + * Get osType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: 'Linux', 'Windows'. + * + * @return the osType value + */ + public OSType osType() { + return this.osType; + } + + /** + * Set osType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: 'Linux', 'Windows'. + * + * @param osType the osType value to set + * @return the AgentPoolInner object itself. + */ + public AgentPoolInner withOsType(OSType osType) { + this.osType = osType; + return this; + } + + /** + * Get maximum number of nodes for auto-scaling. + * + * @return the maxCount value + */ + public Integer maxCount() { + return this.maxCount; + } + + /** + * Set maximum number of nodes for auto-scaling. + * + * @param maxCount the maxCount value to set + * @return the AgentPoolInner object itself. + */ + public AgentPoolInner withMaxCount(Integer maxCount) { + this.maxCount = maxCount; + return this; + } + + /** + * Get minimum number of nodes for auto-scaling. + * + * @return the minCount value + */ + public Integer minCount() { + return this.minCount; + } + + /** + * Set minimum number of nodes for auto-scaling. + * + * @param minCount the minCount value to set + * @return the AgentPoolInner object itself. + */ + public AgentPoolInner withMinCount(Integer minCount) { + this.minCount = minCount; + return this; + } + + /** + * Get whether to enable auto-scaler. + * + * @return the enableAutoScaling value + */ + public Boolean enableAutoScaling() { + return this.enableAutoScaling; + } + + /** + * Set whether to enable auto-scaler. + * + * @param enableAutoScaling the enableAutoScaling value to set + * @return the AgentPoolInner object itself. + */ + public AgentPoolInner withEnableAutoScaling(Boolean enableAutoScaling) { + this.enableAutoScaling = enableAutoScaling; + return this; + } + + /** + * Get agentPoolType represents types of an agent pool. Possible values include: 'VirtualMachineScaleSets', 'AvailabilitySet'. + * + * @return the agentPoolType value + */ + public AgentPoolType agentPoolType() { + return this.agentPoolType; + } + + /** + * Set agentPoolType represents types of an agent pool. Possible values include: 'VirtualMachineScaleSets', 'AvailabilitySet'. + * + * @param agentPoolType the agentPoolType value to set + * @return the AgentPoolInner object itself. + */ + public AgentPoolInner withAgentPoolType(AgentPoolType agentPoolType) { + this.agentPoolType = agentPoolType; + return this; + } + + /** + * Get version of orchestrator specified when creating the managed cluster. + * + * @return the orchestratorVersion value + */ + public String orchestratorVersion() { + return this.orchestratorVersion; + } + + /** + * Set version of orchestrator specified when creating the managed cluster. + * + * @param orchestratorVersion the orchestratorVersion value to set + * @return the AgentPoolInner object itself. + */ + public AgentPoolInner withOrchestratorVersion(String orchestratorVersion) { + this.orchestratorVersion = orchestratorVersion; + return this; + } + + /** + * Get the current deployment or provisioning state, which only appears in the response. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get (PREVIEW) Availability zones for nodes. Must use VirtualMachineScaleSets AgentPoolType. + * + * @return the availabilityZones value + */ + public List availabilityZones() { + return this.availabilityZones; + } + + /** + * Set (PREVIEW) Availability zones for nodes. Must use VirtualMachineScaleSets AgentPoolType. + * + * @param availabilityZones the availabilityZones value to set + * @return the AgentPoolInner object itself. + */ + public AgentPoolInner withAvailabilityZones(List availabilityZones) { + this.availabilityZones = availabilityZones; + return this; + } + + /** + * Get enable public IP for nodes. + * + * @return the enableNodePublicIP value + */ + public Boolean enableNodePublicIP() { + return this.enableNodePublicIP; + } + + /** + * Set enable public IP for nodes. + * + * @param enableNodePublicIP the enableNodePublicIP value to set + * @return the AgentPoolInner object itself. + */ + public AgentPoolInner withEnableNodePublicIP(Boolean enableNodePublicIP) { + this.enableNodePublicIP = enableNodePublicIP; + return this; + } + + /** + * Get scaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. Possible values include: 'Low', 'Regular'. + * + * @return the scaleSetPriority value + */ + public ScaleSetPriority scaleSetPriority() { + return this.scaleSetPriority; + } + + /** + * Set scaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. Possible values include: 'Low', 'Regular'. + * + * @param scaleSetPriority the scaleSetPriority value to set + * @return the AgentPoolInner object itself. + */ + public AgentPoolInner withScaleSetPriority(ScaleSetPriority scaleSetPriority) { + this.scaleSetPriority = scaleSetPriority; + return this; + } + + /** + * Get scaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. Possible values include: 'Delete', 'Deallocate'. + * + * @return the scaleSetEvictionPolicy value + */ + public ScaleSetEvictionPolicy scaleSetEvictionPolicy() { + return this.scaleSetEvictionPolicy; + } + + /** + * Set scaleSetEvictionPolicy to be used to specify eviction policy for low priority virtual machine scale set. Default to Delete. Possible values include: 'Delete', 'Deallocate'. + * + * @param scaleSetEvictionPolicy the scaleSetEvictionPolicy value to set + * @return the AgentPoolInner object itself. + */ + public AgentPoolInner withScaleSetEvictionPolicy(ScaleSetEvictionPolicy scaleSetEvictionPolicy) { + this.scaleSetEvictionPolicy = scaleSetEvictionPolicy; + return this; + } + + /** + * Get taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + * + * @return the nodeTaints value + */ + public List nodeTaints() { + return this.nodeTaints; + } + + /** + * Set taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + * + * @param nodeTaints the nodeTaints value to set + * @return the AgentPoolInner object itself. + */ + public AgentPoolInner withNodeTaints(List nodeTaints) { + this.nodeTaints = nodeTaints; + return this; + } + + /** + * Get the name of the resource that is unique within a resource group. This name can be used to access the resource. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get resource type. + * + * @return the type value + */ + public String type() { + return this.type; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/AgentPoolUpgradeProfileImpl.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/AgentPoolUpgradeProfileImpl.java new file mode 100644 index 000000000000..b268e73755eb --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/AgentPoolUpgradeProfileImpl.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.management.containerservice.v2019_08_01.AgentPoolUpgradeProfile; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.containerservice.v2019_08_01.OSType; +import java.util.List; +import com.microsoft.azure.management.containerservice.v2019_08_01.AgentPoolUpgradeProfilePropertiesUpgradesItem; + +class AgentPoolUpgradeProfileImpl extends WrapperImpl implements AgentPoolUpgradeProfile { + private final ContainerServiceManager manager; + AgentPoolUpgradeProfileImpl(AgentPoolUpgradeProfileInner inner, ContainerServiceManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ContainerServiceManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String kubernetesVersion() { + return this.inner().kubernetesVersion(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public OSType osType() { + return this.inner().osType(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public List upgrades() { + return this.inner().upgrades(); + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/AgentPoolUpgradeProfileInner.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/AgentPoolUpgradeProfileInner.java new file mode 100644 index 000000000000..9a7a068de465 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/AgentPoolUpgradeProfileInner.java @@ -0,0 +1,146 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.management.containerservice.v2019_08_01.OSType; +import java.util.List; +import com.microsoft.azure.management.containerservice.v2019_08_01.AgentPoolUpgradeProfilePropertiesUpgradesItem; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The list of available upgrades for an agent pool. + */ +@JsonFlatten +public class AgentPoolUpgradeProfileInner { + /** + * Id of the agent pool upgrade profile. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Name of the agent pool upgrade profile. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Type of the agent pool upgrade profile. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Kubernetes version (major, minor, patch). + */ + @JsonProperty(value = "properties.kubernetesVersion", required = true) + private String kubernetesVersion; + + /** + * OsType to be used to specify os type. Choose from Linux and Windows. + * Default to Linux. Possible values include: 'Linux', 'Windows'. + */ + @JsonProperty(value = "properties.osType", required = true) + private OSType osType; + + /** + * List of orchestrator types and versions available for upgrade. + */ + @JsonProperty(value = "properties.upgrades") + private List upgrades; + + /** + * Get id of the agent pool upgrade profile. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get name of the agent pool upgrade profile. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get type of the agent pool upgrade profile. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get kubernetes version (major, minor, patch). + * + * @return the kubernetesVersion value + */ + public String kubernetesVersion() { + return this.kubernetesVersion; + } + + /** + * Set kubernetes version (major, minor, patch). + * + * @param kubernetesVersion the kubernetesVersion value to set + * @return the AgentPoolUpgradeProfileInner object itself. + */ + public AgentPoolUpgradeProfileInner withKubernetesVersion(String kubernetesVersion) { + this.kubernetesVersion = kubernetesVersion; + return this; + } + + /** + * Get osType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: 'Linux', 'Windows'. + * + * @return the osType value + */ + public OSType osType() { + return this.osType; + } + + /** + * Set osType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: 'Linux', 'Windows'. + * + * @param osType the osType value to set + * @return the AgentPoolUpgradeProfileInner object itself. + */ + public AgentPoolUpgradeProfileInner withOsType(OSType osType) { + this.osType = osType; + return this; + } + + /** + * Get list of orchestrator types and versions available for upgrade. + * + * @return the upgrades value + */ + public List upgrades() { + return this.upgrades; + } + + /** + * Set list of orchestrator types and versions available for upgrade. + * + * @param upgrades the upgrades value to set + * @return the AgentPoolUpgradeProfileInner object itself. + */ + public AgentPoolUpgradeProfileInner withUpgrades(List upgrades) { + this.upgrades = upgrades; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/AgentPoolsImpl.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/AgentPoolsImpl.java new file mode 100644 index 000000000000..6f67a955bcd2 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/AgentPoolsImpl.java @@ -0,0 +1,111 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.containerservice.v2019_08_01.AgentPools; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.containerservice.v2019_08_01.AgentPool; +import com.microsoft.azure.management.containerservice.v2019_08_01.AgentPoolUpgradeProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.AgentPoolAvailableVersions; + +class AgentPoolsImpl extends WrapperImpl implements AgentPools { + private final ContainerServiceManager manager; + + AgentPoolsImpl(ContainerServiceManager manager) { + super(manager.inner().agentPools()); + this.manager = manager; + } + + public ContainerServiceManager manager() { + return this.manager; + } + + @Override + public AgentPoolImpl define(String name) { + return wrapModel(name); + } + + private AgentPoolImpl wrapModel(AgentPoolInner inner) { + return new AgentPoolImpl(inner, manager()); + } + + private AgentPoolImpl wrapModel(String name) { + return new AgentPoolImpl(name, this.manager()); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String resourceName) { + AgentPoolsInner client = this.inner(); + return client.listAsync(resourceGroupName, resourceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public AgentPool call(AgentPoolInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String resourceName, String agentPoolName) { + AgentPoolsInner client = this.inner(); + return client.getAsync(resourceGroupName, resourceName, agentPoolName) + .flatMap(new Func1>() { + @Override + public Observable call(AgentPoolInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((AgentPool)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String resourceName, String agentPoolName) { + AgentPoolsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, resourceName, agentPoolName).toCompletable(); + } + + @Override + public Observable getUpgradeProfileAsync(String resourceGroupName, String resourceName, String agentPoolName) { + AgentPoolsInner client = this.inner(); + return client.getUpgradeProfileAsync(resourceGroupName, resourceName, agentPoolName) + .map(new Func1() { + @Override + public AgentPoolUpgradeProfile call(AgentPoolUpgradeProfileInner inner) { + return new AgentPoolUpgradeProfileImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAvailableAgentPoolVersionsAsync(String resourceGroupName, String resourceName, String agentPoolName) { + AgentPoolsInner client = this.inner(); + return client.getAvailableAgentPoolVersionsAsync(resourceGroupName, resourceName, agentPoolName) + .map(new Func1() { + @Override + public AgentPoolAvailableVersions call(AgentPoolAvailableVersionsInner inner) { + return new AgentPoolAvailableVersionsImpl(inner, manager()); + } + }); + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/AgentPoolsInner.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/AgentPoolsInner.java new file mode 100644 index 000000000000..2d49eb40a186 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/AgentPoolsInner.java @@ -0,0 +1,991 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in AgentPools. + */ +public class AgentPoolsInner { + /** The Retrofit service to perform REST calls. */ + private AgentPoolsService service; + /** The service client containing this operation class. */ + private ContainerServiceManagementClientImpl client; + + /** + * Initializes an instance of AgentPoolsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AgentPoolsInner(Retrofit retrofit, ContainerServiceManagementClientImpl client) { + this.service = retrofit.create(AgentPoolsService.class); + this.client = client; + } + + /** + * The interface defining all the services for AgentPools to be + * used by Retrofit to perform actually REST calls. + */ + interface AgentPoolsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.AgentPools list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.AgentPools get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Path("agentPoolName") String agentPoolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.AgentPools createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Path("agentPoolName") String agentPoolName, @Query("api-version") String apiVersion, @Body AgentPoolInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.AgentPools beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Path("agentPoolName") String agentPoolName, @Query("api-version") String apiVersion, @Body AgentPoolInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.AgentPools delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Path("agentPoolName") String agentPoolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.AgentPools beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Path("agentPoolName") String agentPoolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.AgentPools getUpgradeProfile" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default") + Observable> getUpgradeProfile(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Path("agentPoolName") String agentPoolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.AgentPools getAvailableAgentPoolVersions" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/availableAgentPoolVersions") + Observable> getAvailableAgentPoolVersions(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Path("agentPoolName") String agentPoolName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.AgentPools listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of agent pools in the specified managed cluster. + * Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<AgentPoolInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String resourceName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, resourceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of agent pools in the specified managed cluster. + * Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String resourceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, resourceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of agent pools in the specified managed cluster. + * Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AgentPoolInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String resourceName) { + return listWithServiceResponseAsync(resourceGroupName, resourceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of agent pools in the specified managed cluster. + * Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AgentPoolInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String resourceName) { + return listSinglePageAsync(resourceGroupName, resourceName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of agent pools in the specified managed cluster. + * Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AgentPoolInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String resourceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + final String apiVersion = "2019-08-01"; + return service.list(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the agent pool. + * Gets the details of the agent pool by managed cluster and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AgentPoolInner object if successful. + */ + public AgentPoolInner get(String resourceGroupName, String resourceName, String agentPoolName) { + return getWithServiceResponseAsync(resourceGroupName, resourceName, agentPoolName).toBlocking().single().body(); + } + + /** + * Gets the agent pool. + * Gets the details of the agent pool by managed cluster and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String resourceName, String agentPoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, resourceName, agentPoolName), serviceCallback); + } + + /** + * Gets the agent pool. + * Gets the details of the agent pool by managed cluster and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AgentPoolInner object + */ + public Observable getAsync(String resourceGroupName, String resourceName, String agentPoolName) { + return getWithServiceResponseAsync(resourceGroupName, resourceName, agentPoolName).map(new Func1, AgentPoolInner>() { + @Override + public AgentPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the agent pool. + * Gets the details of the agent pool by managed cluster and resource group. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AgentPoolInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String resourceName, String agentPoolName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (agentPoolName == null) { + throw new IllegalArgumentException("Parameter agentPoolName is required and cannot be null."); + } + final String apiVersion = "2019-08-01"; + return service.get(this.client.subscriptionId(), resourceGroupName, resourceName, agentPoolName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates an agent pool. + * Creates or updates an agent pool in the specified managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @param parameters Parameters supplied to the Create or Update an agent pool operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AgentPoolInner object if successful. + */ + public AgentPoolInner createOrUpdate(String resourceGroupName, String resourceName, String agentPoolName, AgentPoolInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, agentPoolName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates an agent pool. + * Creates or updates an agent pool in the specified managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @param parameters Parameters supplied to the Create or Update an agent pool operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String resourceName, String agentPoolName, AgentPoolInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, agentPoolName, parameters), serviceCallback); + } + + /** + * Creates or updates an agent pool. + * Creates or updates an agent pool in the specified managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @param parameters Parameters supplied to the Create or Update an agent pool operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String resourceName, String agentPoolName, AgentPoolInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, agentPoolName, parameters).map(new Func1, AgentPoolInner>() { + @Override + public AgentPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an agent pool. + * Creates or updates an agent pool in the specified managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @param parameters Parameters supplied to the Create or Update an agent pool operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String resourceName, String agentPoolName, AgentPoolInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (agentPoolName == null) { + throw new IllegalArgumentException("Parameter agentPoolName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2019-08-01"; + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, resourceName, agentPoolName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates an agent pool. + * Creates or updates an agent pool in the specified managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @param parameters Parameters supplied to the Create or Update an agent pool operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AgentPoolInner object if successful. + */ + public AgentPoolInner beginCreateOrUpdate(String resourceGroupName, String resourceName, String agentPoolName, AgentPoolInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, agentPoolName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an agent pool. + * Creates or updates an agent pool in the specified managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @param parameters Parameters supplied to the Create or Update an agent pool operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String resourceName, String agentPoolName, AgentPoolInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, agentPoolName, parameters), serviceCallback); + } + + /** + * Creates or updates an agent pool. + * Creates or updates an agent pool in the specified managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @param parameters Parameters supplied to the Create or Update an agent pool operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AgentPoolInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String resourceName, String agentPoolName, AgentPoolInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, agentPoolName, parameters).map(new Func1, AgentPoolInner>() { + @Override + public AgentPoolInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an agent pool. + * Creates or updates an agent pool in the specified managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @param parameters Parameters supplied to the Create or Update an agent pool operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AgentPoolInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String resourceName, String agentPoolName, AgentPoolInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (agentPoolName == null) { + throw new IllegalArgumentException("Parameter agentPoolName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2019-08-01"; + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, resourceName, agentPoolName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes an agent pool. + * Deletes the agent pool in the specified managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String resourceName, String agentPoolName) { + deleteWithServiceResponseAsync(resourceGroupName, resourceName, agentPoolName).toBlocking().last().body(); + } + + /** + * Deletes an agent pool. + * Deletes the agent pool in the specified managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String resourceName, String agentPoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, resourceName, agentPoolName), serviceCallback); + } + + /** + * Deletes an agent pool. + * Deletes the agent pool in the specified managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String resourceName, String agentPoolName) { + return deleteWithServiceResponseAsync(resourceGroupName, resourceName, agentPoolName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an agent pool. + * Deletes the agent pool in the specified managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String resourceName, String agentPoolName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (agentPoolName == null) { + throw new IllegalArgumentException("Parameter agentPoolName is required and cannot be null."); + } + final String apiVersion = "2019-08-01"; + Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, resourceName, agentPoolName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an agent pool. + * Deletes the agent pool in the specified managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String resourceName, String agentPoolName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, resourceName, agentPoolName).toBlocking().single().body(); + } + + /** + * Deletes an agent pool. + * Deletes the agent pool in the specified managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String resourceName, String agentPoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, resourceName, agentPoolName), serviceCallback); + } + + /** + * Deletes an agent pool. + * Deletes the agent pool in the specified managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String resourceName, String agentPoolName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, resourceName, agentPoolName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an agent pool. + * Deletes the agent pool in the specified managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String resourceName, String agentPoolName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (agentPoolName == null) { + throw new IllegalArgumentException("Parameter agentPoolName is required and cannot be null."); + } + final String apiVersion = "2019-08-01"; + return service.beginDelete(this.client.subscriptionId(), resourceGroupName, resourceName, agentPoolName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets upgrade profile for an agent pool. + * Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AgentPoolUpgradeProfileInner object if successful. + */ + public AgentPoolUpgradeProfileInner getUpgradeProfile(String resourceGroupName, String resourceName, String agentPoolName) { + return getUpgradeProfileWithServiceResponseAsync(resourceGroupName, resourceName, agentPoolName).toBlocking().single().body(); + } + + /** + * Gets upgrade profile for an agent pool. + * Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getUpgradeProfileAsync(String resourceGroupName, String resourceName, String agentPoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getUpgradeProfileWithServiceResponseAsync(resourceGroupName, resourceName, agentPoolName), serviceCallback); + } + + /** + * Gets upgrade profile for an agent pool. + * Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AgentPoolUpgradeProfileInner object + */ + public Observable getUpgradeProfileAsync(String resourceGroupName, String resourceName, String agentPoolName) { + return getUpgradeProfileWithServiceResponseAsync(resourceGroupName, resourceName, agentPoolName).map(new Func1, AgentPoolUpgradeProfileInner>() { + @Override + public AgentPoolUpgradeProfileInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets upgrade profile for an agent pool. + * Gets the details of the upgrade profile for an agent pool with a specified resource group and managed cluster name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AgentPoolUpgradeProfileInner object + */ + public Observable> getUpgradeProfileWithServiceResponseAsync(String resourceGroupName, String resourceName, String agentPoolName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (agentPoolName == null) { + throw new IllegalArgumentException("Parameter agentPoolName is required and cannot be null."); + } + final String apiVersion = "2019-08-01"; + return service.getUpgradeProfile(this.client.subscriptionId(), resourceGroupName, resourceName, agentPoolName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getUpgradeProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getUpgradeProfileDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of supported versions for the specified agent pool. + * Gets a list of supported versions for the specified agent pool. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AgentPoolAvailableVersionsInner object if successful. + */ + public AgentPoolAvailableVersionsInner getAvailableAgentPoolVersions(String resourceGroupName, String resourceName, String agentPoolName) { + return getAvailableAgentPoolVersionsWithServiceResponseAsync(resourceGroupName, resourceName, agentPoolName).toBlocking().single().body(); + } + + /** + * Gets a list of supported versions for the specified agent pool. + * Gets a list of supported versions for the specified agent pool. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAvailableAgentPoolVersionsAsync(String resourceGroupName, String resourceName, String agentPoolName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAvailableAgentPoolVersionsWithServiceResponseAsync(resourceGroupName, resourceName, agentPoolName), serviceCallback); + } + + /** + * Gets a list of supported versions for the specified agent pool. + * Gets a list of supported versions for the specified agent pool. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AgentPoolAvailableVersionsInner object + */ + public Observable getAvailableAgentPoolVersionsAsync(String resourceGroupName, String resourceName, String agentPoolName) { + return getAvailableAgentPoolVersionsWithServiceResponseAsync(resourceGroupName, resourceName, agentPoolName).map(new Func1, AgentPoolAvailableVersionsInner>() { + @Override + public AgentPoolAvailableVersionsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a list of supported versions for the specified agent pool. + * Gets a list of supported versions for the specified agent pool. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param agentPoolName The name of the agent pool. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AgentPoolAvailableVersionsInner object + */ + public Observable> getAvailableAgentPoolVersionsWithServiceResponseAsync(String resourceGroupName, String resourceName, String agentPoolName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (agentPoolName == null) { + throw new IllegalArgumentException("Parameter agentPoolName is required and cannot be null."); + } + final String apiVersion = "2019-08-01"; + return service.getAvailableAgentPoolVersions(this.client.subscriptionId(), resourceGroupName, resourceName, agentPoolName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAvailableAgentPoolVersionsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAvailableAgentPoolVersionsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of agent pools in the specified managed cluster. + * Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<AgentPoolInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of agent pools in the specified managed cluster. + * Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of agent pools in the specified managed cluster. + * Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AgentPoolInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of agent pools in the specified managed cluster. + * Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AgentPoolInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of agent pools in the specified managed cluster. + * Gets a list of agent pools in the specified managed cluster. The operation returns properties of each agent pool. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AgentPoolInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ContainerServiceImpl.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ContainerServiceImpl.java new file mode 100644 index 000000000000..7f52bb410d54 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ContainerServiceImpl.java @@ -0,0 +1,148 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerService; +import rx.Observable; +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServiceOrchestratorProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServiceCustomProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServiceServicePrincipalProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServiceMasterProfile; +import java.util.List; +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServiceAgentPoolProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServiceWindowsProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServiceLinuxProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServiceDiagnosticsProfile; + +class ContainerServiceImpl extends GroupableResourceCoreImpl implements ContainerService, ContainerService.Definition, ContainerService.Update { + ContainerServiceImpl(String name, ContainerServiceInner inner, ContainerServiceManager manager) { + super(name, inner, manager); + } + + @Override + public Observable createResourceAsync() { + ContainerServicesInner client = this.manager().inner().containerServices(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ContainerServicesInner client = this.manager().inner().containerServices(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ContainerServicesInner client = this.manager().inner().containerServices(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public List agentPoolProfiles() { + return this.inner().agentPoolProfiles(); + } + + @Override + public ContainerServiceCustomProfile customProfile() { + return this.inner().customProfile(); + } + + @Override + public ContainerServiceDiagnosticsProfile diagnosticsProfile() { + return this.inner().diagnosticsProfile(); + } + + @Override + public ContainerServiceLinuxProfile linuxProfile() { + return this.inner().linuxProfile(); + } + + @Override + public ContainerServiceMasterProfile masterProfile() { + return this.inner().masterProfile(); + } + + @Override + public ContainerServiceOrchestratorProfile orchestratorProfile() { + return this.inner().orchestratorProfile(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public ContainerServiceServicePrincipalProfile servicePrincipalProfile() { + return this.inner().servicePrincipalProfile(); + } + + @Override + public ContainerServiceWindowsProfile windowsProfile() { + return this.inner().windowsProfile(); + } + + @Override + public ContainerServiceImpl withLinuxProfile(ContainerServiceLinuxProfile linuxProfile) { + this.inner().withLinuxProfile(linuxProfile); + return this; + } + + @Override + public ContainerServiceImpl withMasterProfile(ContainerServiceMasterProfile masterProfile) { + this.inner().withMasterProfile(masterProfile); + return this; + } + + @Override + public ContainerServiceImpl withOrchestratorProfile(ContainerServiceOrchestratorProfile orchestratorProfile) { + this.inner().withOrchestratorProfile(orchestratorProfile); + return this; + } + + @Override + public ContainerServiceImpl withAgentPoolProfiles(List agentPoolProfiles) { + this.inner().withAgentPoolProfiles(agentPoolProfiles); + return this; + } + + @Override + public ContainerServiceImpl withCustomProfile(ContainerServiceCustomProfile customProfile) { + this.inner().withCustomProfile(customProfile); + return this; + } + + @Override + public ContainerServiceImpl withDiagnosticsProfile(ContainerServiceDiagnosticsProfile diagnosticsProfile) { + this.inner().withDiagnosticsProfile(diagnosticsProfile); + return this; + } + + @Override + public ContainerServiceImpl withServicePrincipalProfile(ContainerServiceServicePrincipalProfile servicePrincipalProfile) { + this.inner().withServicePrincipalProfile(servicePrincipalProfile); + return this; + } + + @Override + public ContainerServiceImpl withWindowsProfile(ContainerServiceWindowsProfile windowsProfile) { + this.inner().withWindowsProfile(windowsProfile); + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ContainerServiceInner.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ContainerServiceInner.java new file mode 100644 index 000000000000..50e68abeed0c --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ContainerServiceInner.java @@ -0,0 +1,255 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServiceOrchestratorProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServiceCustomProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServiceServicePrincipalProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServiceMasterProfile; +import java.util.List; +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServiceAgentPoolProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServiceWindowsProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServiceLinuxProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServiceDiagnosticsProfile; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Container service. + */ +@JsonFlatten +public class ContainerServiceInner extends Resource { + /** + * The current deployment or provisioning state, which only appears in the + * response. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Profile for the container service orchestrator. + */ + @JsonProperty(value = "properties.orchestratorProfile", required = true) + private ContainerServiceOrchestratorProfile orchestratorProfile; + + /** + * Properties to configure a custom container service cluster. + */ + @JsonProperty(value = "properties.customProfile") + private ContainerServiceCustomProfile customProfile; + + /** + * Information about a service principal identity for the cluster to use + * for manipulating Azure APIs. Exact one of secret or keyVaultSecretRef + * need to be specified. + */ + @JsonProperty(value = "properties.servicePrincipalProfile") + private ContainerServiceServicePrincipalProfile servicePrincipalProfile; + + /** + * Profile for the container service master. + */ + @JsonProperty(value = "properties.masterProfile", required = true) + private ContainerServiceMasterProfile masterProfile; + + /** + * Properties of the agent pool. + */ + @JsonProperty(value = "properties.agentPoolProfiles") + private List agentPoolProfiles; + + /** + * Profile for Windows VMs in the container service cluster. + */ + @JsonProperty(value = "properties.windowsProfile") + private ContainerServiceWindowsProfile windowsProfile; + + /** + * Profile for Linux VMs in the container service cluster. + */ + @JsonProperty(value = "properties.linuxProfile", required = true) + private ContainerServiceLinuxProfile linuxProfile; + + /** + * Profile for diagnostics in the container service cluster. + */ + @JsonProperty(value = "properties.diagnosticsProfile") + private ContainerServiceDiagnosticsProfile diagnosticsProfile; + + /** + * Get the current deployment or provisioning state, which only appears in the response. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get profile for the container service orchestrator. + * + * @return the orchestratorProfile value + */ + public ContainerServiceOrchestratorProfile orchestratorProfile() { + return this.orchestratorProfile; + } + + /** + * Set profile for the container service orchestrator. + * + * @param orchestratorProfile the orchestratorProfile value to set + * @return the ContainerServiceInner object itself. + */ + public ContainerServiceInner withOrchestratorProfile(ContainerServiceOrchestratorProfile orchestratorProfile) { + this.orchestratorProfile = orchestratorProfile; + return this; + } + + /** + * Get properties to configure a custom container service cluster. + * + * @return the customProfile value + */ + public ContainerServiceCustomProfile customProfile() { + return this.customProfile; + } + + /** + * Set properties to configure a custom container service cluster. + * + * @param customProfile the customProfile value to set + * @return the ContainerServiceInner object itself. + */ + public ContainerServiceInner withCustomProfile(ContainerServiceCustomProfile customProfile) { + this.customProfile = customProfile; + return this; + } + + /** + * Get information about a service principal identity for the cluster to use for manipulating Azure APIs. Exact one of secret or keyVaultSecretRef need to be specified. + * + * @return the servicePrincipalProfile value + */ + public ContainerServiceServicePrincipalProfile servicePrincipalProfile() { + return this.servicePrincipalProfile; + } + + /** + * Set information about a service principal identity for the cluster to use for manipulating Azure APIs. Exact one of secret or keyVaultSecretRef need to be specified. + * + * @param servicePrincipalProfile the servicePrincipalProfile value to set + * @return the ContainerServiceInner object itself. + */ + public ContainerServiceInner withServicePrincipalProfile(ContainerServiceServicePrincipalProfile servicePrincipalProfile) { + this.servicePrincipalProfile = servicePrincipalProfile; + return this; + } + + /** + * Get profile for the container service master. + * + * @return the masterProfile value + */ + public ContainerServiceMasterProfile masterProfile() { + return this.masterProfile; + } + + /** + * Set profile for the container service master. + * + * @param masterProfile the masterProfile value to set + * @return the ContainerServiceInner object itself. + */ + public ContainerServiceInner withMasterProfile(ContainerServiceMasterProfile masterProfile) { + this.masterProfile = masterProfile; + return this; + } + + /** + * Get properties of the agent pool. + * + * @return the agentPoolProfiles value + */ + public List agentPoolProfiles() { + return this.agentPoolProfiles; + } + + /** + * Set properties of the agent pool. + * + * @param agentPoolProfiles the agentPoolProfiles value to set + * @return the ContainerServiceInner object itself. + */ + public ContainerServiceInner withAgentPoolProfiles(List agentPoolProfiles) { + this.agentPoolProfiles = agentPoolProfiles; + return this; + } + + /** + * Get profile for Windows VMs in the container service cluster. + * + * @return the windowsProfile value + */ + public ContainerServiceWindowsProfile windowsProfile() { + return this.windowsProfile; + } + + /** + * Set profile for Windows VMs in the container service cluster. + * + * @param windowsProfile the windowsProfile value to set + * @return the ContainerServiceInner object itself. + */ + public ContainerServiceInner withWindowsProfile(ContainerServiceWindowsProfile windowsProfile) { + this.windowsProfile = windowsProfile; + return this; + } + + /** + * Get profile for Linux VMs in the container service cluster. + * + * @return the linuxProfile value + */ + public ContainerServiceLinuxProfile linuxProfile() { + return this.linuxProfile; + } + + /** + * Set profile for Linux VMs in the container service cluster. + * + * @param linuxProfile the linuxProfile value to set + * @return the ContainerServiceInner object itself. + */ + public ContainerServiceInner withLinuxProfile(ContainerServiceLinuxProfile linuxProfile) { + this.linuxProfile = linuxProfile; + return this; + } + + /** + * Get profile for diagnostics in the container service cluster. + * + * @return the diagnosticsProfile value + */ + public ContainerServiceDiagnosticsProfile diagnosticsProfile() { + return this.diagnosticsProfile; + } + + /** + * Set profile for diagnostics in the container service cluster. + * + * @param diagnosticsProfile the diagnosticsProfile value to set + * @return the ContainerServiceInner object itself. + */ + public ContainerServiceInner withDiagnosticsProfile(ContainerServiceDiagnosticsProfile diagnosticsProfile) { + this.diagnosticsProfile = diagnosticsProfile; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ContainerServiceManagementClientImpl.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ContainerServiceManagementClientImpl.java new file mode 100644 index 000000000000..0efd97ac21c6 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ContainerServiceManagementClientImpl.java @@ -0,0 +1,239 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the ContainerServiceManagementClientImpl class. + */ +public class ContainerServiceManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. */ + private String subscriptionId; + + /** + * Gets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public ContainerServiceManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public ContainerServiceManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public ContainerServiceManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public ContainerServiceManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The OpenShiftManagedClustersInner object to access its operations. + */ + private OpenShiftManagedClustersInner openShiftManagedClusters; + + /** + * Gets the OpenShiftManagedClustersInner object to access its operations. + * @return the OpenShiftManagedClustersInner object. + */ + public OpenShiftManagedClustersInner openShiftManagedClusters() { + return this.openShiftManagedClusters; + } + + /** + * The ContainerServicesInner object to access its operations. + */ + private ContainerServicesInner containerServices; + + /** + * Gets the ContainerServicesInner object to access its operations. + * @return the ContainerServicesInner object. + */ + public ContainerServicesInner containerServices() { + return this.containerServices; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The ManagedClustersInner object to access its operations. + */ + private ManagedClustersInner managedClusters; + + /** + * Gets the ManagedClustersInner object to access its operations. + * @return the ManagedClustersInner object. + */ + public ManagedClustersInner managedClusters() { + return this.managedClusters; + } + + /** + * The AgentPoolsInner object to access its operations. + */ + private AgentPoolsInner agentPools; + + /** + * Gets the AgentPoolsInner object to access its operations. + * @return the AgentPoolsInner object. + */ + public AgentPoolsInner agentPools() { + return this.agentPools; + } + + /** + * Initializes an instance of ContainerServiceManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public ContainerServiceManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of ContainerServiceManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public ContainerServiceManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of ContainerServiceManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public ContainerServiceManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.openShiftManagedClusters = new OpenShiftManagedClustersInner(restClient().retrofit(), this); + this.containerServices = new ContainerServicesInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.managedClusters = new ManagedClustersInner(restClient().retrofit(), this); + this.agentPools = new AgentPoolsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "ContainerServiceManagementClient", "2019-08-01"); + } +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ContainerServiceManager.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ContainerServiceManager.java new file mode 100644 index 000000000000..1aeffc149fa1 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ContainerServiceManager.java @@ -0,0 +1,147 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.containerservice.v2019_08_01.OpenShiftManagedClusters; +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServices; +import com.microsoft.azure.management.containerservice.v2019_08_01.Operations; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusters; +import com.microsoft.azure.management.containerservice.v2019_08_01.AgentPools; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure ContainerService resource management. + */ +public final class ContainerServiceManager extends ManagerCore { + private OpenShiftManagedClusters openShiftManagedClusters; + private ContainerServices containerServices; + private Operations operations; + private ManagedClusters managedClusters; + private AgentPools agentPools; + /** + * Get a Configurable instance that can be used to create ContainerServiceManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new ContainerServiceManager.ConfigurableImpl(); + } + /** + * Creates an instance of ContainerServiceManager that exposes ContainerService resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the ContainerServiceManager + */ + public static ContainerServiceManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new ContainerServiceManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of ContainerServiceManager that exposes ContainerService resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the ContainerServiceManager + */ + public static ContainerServiceManager authenticate(RestClient restClient, String subscriptionId) { + return new ContainerServiceManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of ContainerServiceManager that exposes ContainerService management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing ContainerService management API entry points that work across subscriptions + */ + ContainerServiceManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage OpenShiftManagedClusters. + */ + public OpenShiftManagedClusters openShiftManagedClusters() { + if (this.openShiftManagedClusters == null) { + this.openShiftManagedClusters = new OpenShiftManagedClustersImpl(this); + } + return this.openShiftManagedClusters; + } + + /** + * @return Entry point to manage ContainerServices. + */ + public ContainerServices containerServices() { + if (this.containerServices == null) { + this.containerServices = new ContainerServicesImpl(this); + } + return this.containerServices; + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage ManagedClusters. + */ + public ManagedClusters managedClusters() { + if (this.managedClusters == null) { + this.managedClusters = new ManagedClustersImpl(this); + } + return this.managedClusters; + } + + /** + * @return Entry point to manage AgentPools. + */ + public AgentPools agentPools() { + if (this.agentPools == null) { + this.agentPools = new AgentPoolsImpl(this); + } + return this.agentPools; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public ContainerServiceManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return ContainerServiceManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private ContainerServiceManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new ContainerServiceManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ContainerServicesImpl.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ContainerServicesImpl.java new file mode 100644 index 000000000000..65b24666e335 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ContainerServicesImpl.java @@ -0,0 +1,151 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * def + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServices; +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerService; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.containerservice.v2019_08_01.OrchestratorVersionProfileListResult; + +class ContainerServicesImpl extends GroupableResourcesCoreImpl implements ContainerServices { + protected ContainerServicesImpl(ContainerServiceManager manager) { + super(manager.inner().containerServices(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + ContainerServicesInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + ContainerServicesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + ContainerServicesInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + ContainerServicesInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ContainerService call(ContainerServiceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + ContainerServicesInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + ContainerServicesInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ContainerService call(ContainerServiceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public ContainerServiceImpl define(String name) { + return wrapModel(name); + } + + @Override + protected ContainerServiceImpl wrapModel(ContainerServiceInner inner) { + return new ContainerServiceImpl(inner.name(), inner, manager()); + } + + @Override + protected ContainerServiceImpl wrapModel(String name) { + return new ContainerServiceImpl(name, new ContainerServiceInner(), this.manager()); + } + + @Override + public Observable listOrchestratorsAsync(String location) { + ContainerServicesInner client = this.inner(); + return client.listOrchestratorsAsync(location) + .map(new Func1() { + @Override + public OrchestratorVersionProfileListResult call(OrchestratorVersionProfileListResultInner inner) { + return new OrchestratorVersionProfileListResultImpl(inner, manager()); + } + }); + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ContainerServicesInner.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ContainerServicesInner.java new file mode 100644 index 000000000000..52f30a818234 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ContainerServicesInner.java @@ -0,0 +1,1152 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ContainerServices. + */ +public class ContainerServicesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ContainerServicesService service; + /** The service client containing this operation class. */ + private ContainerServiceManagementClientImpl client; + + /** + * Initializes an instance of ContainerServicesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ContainerServicesInner(Retrofit retrofit, ContainerServiceManagementClientImpl client) { + this.service = retrofit.create(ContainerServicesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ContainerServices to be + * used by Retrofit to perform actually REST calls. + */ + interface ContainerServicesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServices list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/containerServices") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServices createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("containerServiceName") String containerServiceName, @Path("subscriptionId") String subscriptionId, @Body ContainerServiceInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServices beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("containerServiceName") String containerServiceName, @Path("subscriptionId") String subscriptionId, @Body ContainerServiceInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServices getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("containerServiceName") String containerServiceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServices delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("containerServiceName") String containerServiceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServices beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices/{containerServiceName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("containerServiceName") String containerServiceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServices listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/containerServices") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServices listOrchestrators" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/orchestrators") + Observable> listOrchestrators(@Path("subscriptionId") String subscriptionId, @Path("location") String location, @Query("api-version") String apiVersion, @Query("resource-type") String resourceType, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServices listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServices listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of container services in the specified subscription. + * Gets a list of container services in the specified subscription. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ContainerServiceInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of container services in the specified subscription. + * Gets a list of container services in the specified subscription. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of container services in the specified subscription. + * Gets a list of container services in the specified subscription. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ContainerServiceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of container services in the specified subscription. + * Gets a list of container services in the specified subscription. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ContainerServiceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of container services in the specified subscription. + * Gets a list of container services in the specified subscription. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ContainerServiceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-07-01"; + return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates a container service. + * Creates or updates a container service with the specified configuration of orchestrator, masters, and agents. + * + * @param resourceGroupName The name of the resource group. + * @param containerServiceName The name of the container service in the specified subscription and resource group. + * @param parameters Parameters supplied to the Create or Update a Container Service operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ContainerServiceInner object if successful. + */ + public ContainerServiceInner createOrUpdate(String resourceGroupName, String containerServiceName, ContainerServiceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, containerServiceName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a container service. + * Creates or updates a container service with the specified configuration of orchestrator, masters, and agents. + * + * @param resourceGroupName The name of the resource group. + * @param containerServiceName The name of the container service in the specified subscription and resource group. + * @param parameters Parameters supplied to the Create or Update a Container Service operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String containerServiceName, ContainerServiceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, containerServiceName, parameters), serviceCallback); + } + + /** + * Creates or updates a container service. + * Creates or updates a container service with the specified configuration of orchestrator, masters, and agents. + * + * @param resourceGroupName The name of the resource group. + * @param containerServiceName The name of the container service in the specified subscription and resource group. + * @param parameters Parameters supplied to the Create or Update a Container Service operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String containerServiceName, ContainerServiceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, containerServiceName, parameters).map(new Func1, ContainerServiceInner>() { + @Override + public ContainerServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a container service. + * Creates or updates a container service with the specified configuration of orchestrator, masters, and agents. + * + * @param resourceGroupName The name of the resource group. + * @param containerServiceName The name of the container service in the specified subscription and resource group. + * @param parameters Parameters supplied to the Create or Update a Container Service operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String containerServiceName, ContainerServiceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (containerServiceName == null) { + throw new IllegalArgumentException("Parameter containerServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2017-07-01"; + Observable> observable = service.createOrUpdate(resourceGroupName, containerServiceName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates a container service. + * Creates or updates a container service with the specified configuration of orchestrator, masters, and agents. + * + * @param resourceGroupName The name of the resource group. + * @param containerServiceName The name of the container service in the specified subscription and resource group. + * @param parameters Parameters supplied to the Create or Update a Container Service operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ContainerServiceInner object if successful. + */ + public ContainerServiceInner beginCreateOrUpdate(String resourceGroupName, String containerServiceName, ContainerServiceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, containerServiceName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a container service. + * Creates or updates a container service with the specified configuration of orchestrator, masters, and agents. + * + * @param resourceGroupName The name of the resource group. + * @param containerServiceName The name of the container service in the specified subscription and resource group. + * @param parameters Parameters supplied to the Create or Update a Container Service operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String containerServiceName, ContainerServiceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, containerServiceName, parameters), serviceCallback); + } + + /** + * Creates or updates a container service. + * Creates or updates a container service with the specified configuration of orchestrator, masters, and agents. + * + * @param resourceGroupName The name of the resource group. + * @param containerServiceName The name of the container service in the specified subscription and resource group. + * @param parameters Parameters supplied to the Create or Update a Container Service operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ContainerServiceInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String containerServiceName, ContainerServiceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, containerServiceName, parameters).map(new Func1, ContainerServiceInner>() { + @Override + public ContainerServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a container service. + * Creates or updates a container service with the specified configuration of orchestrator, masters, and agents. + * + * @param resourceGroupName The name of the resource group. + * @param containerServiceName The name of the container service in the specified subscription and resource group. + * @param parameters Parameters supplied to the Create or Update a Container Service operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ContainerServiceInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String containerServiceName, ContainerServiceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (containerServiceName == null) { + throw new IllegalArgumentException("Parameter containerServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2017-07-01"; + return service.beginCreateOrUpdate(resourceGroupName, containerServiceName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the properties of the specified container service. + * Gets the properties of the specified container service in the specified subscription and resource group. The operation returns the properties including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. + * + * @param resourceGroupName The name of the resource group. + * @param containerServiceName The name of the container service in the specified subscription and resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ContainerServiceInner object if successful. + */ + public ContainerServiceInner getByResourceGroup(String resourceGroupName, String containerServiceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, containerServiceName).toBlocking().single().body(); + } + + /** + * Gets the properties of the specified container service. + * Gets the properties of the specified container service in the specified subscription and resource group. The operation returns the properties including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. + * + * @param resourceGroupName The name of the resource group. + * @param containerServiceName The name of the container service in the specified subscription and resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String containerServiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, containerServiceName), serviceCallback); + } + + /** + * Gets the properties of the specified container service. + * Gets the properties of the specified container service in the specified subscription and resource group. The operation returns the properties including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. + * + * @param resourceGroupName The name of the resource group. + * @param containerServiceName The name of the container service in the specified subscription and resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ContainerServiceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String containerServiceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, containerServiceName).map(new Func1, ContainerServiceInner>() { + @Override + public ContainerServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the properties of the specified container service. + * Gets the properties of the specified container service in the specified subscription and resource group. The operation returns the properties including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. + * + * @param resourceGroupName The name of the resource group. + * @param containerServiceName The name of the container service in the specified subscription and resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ContainerServiceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String containerServiceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (containerServiceName == null) { + throw new IllegalArgumentException("Parameter containerServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-07-01"; + return service.getByResourceGroup(resourceGroupName, containerServiceName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes the specified container service. + * Deletes the specified container service in the specified subscription and resource group. The operation does not delete other resources created as part of creating a container service, including storage accounts, VMs, and availability sets. All the other resources created with the container service are part of the same resource group and can be deleted individually. + * + * @param resourceGroupName The name of the resource group. + * @param containerServiceName The name of the container service in the specified subscription and resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String containerServiceName) { + deleteWithServiceResponseAsync(resourceGroupName, containerServiceName).toBlocking().last().body(); + } + + /** + * Deletes the specified container service. + * Deletes the specified container service in the specified subscription and resource group. The operation does not delete other resources created as part of creating a container service, including storage accounts, VMs, and availability sets. All the other resources created with the container service are part of the same resource group and can be deleted individually. + * + * @param resourceGroupName The name of the resource group. + * @param containerServiceName The name of the container service in the specified subscription and resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String containerServiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, containerServiceName), serviceCallback); + } + + /** + * Deletes the specified container service. + * Deletes the specified container service in the specified subscription and resource group. The operation does not delete other resources created as part of creating a container service, including storage accounts, VMs, and availability sets. All the other resources created with the container service are part of the same resource group and can be deleted individually. + * + * @param resourceGroupName The name of the resource group. + * @param containerServiceName The name of the container service in the specified subscription and resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String containerServiceName) { + return deleteWithServiceResponseAsync(resourceGroupName, containerServiceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified container service. + * Deletes the specified container service in the specified subscription and resource group. The operation does not delete other resources created as part of creating a container service, including storage accounts, VMs, and availability sets. All the other resources created with the container service are part of the same resource group and can be deleted individually. + * + * @param resourceGroupName The name of the resource group. + * @param containerServiceName The name of the container service in the specified subscription and resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String containerServiceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (containerServiceName == null) { + throw new IllegalArgumentException("Parameter containerServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-07-01"; + Observable> observable = service.delete(resourceGroupName, containerServiceName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes the specified container service. + * Deletes the specified container service in the specified subscription and resource group. The operation does not delete other resources created as part of creating a container service, including storage accounts, VMs, and availability sets. All the other resources created with the container service are part of the same resource group and can be deleted individually. + * + * @param resourceGroupName The name of the resource group. + * @param containerServiceName The name of the container service in the specified subscription and resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String containerServiceName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, containerServiceName).toBlocking().single().body(); + } + + /** + * Deletes the specified container service. + * Deletes the specified container service in the specified subscription and resource group. The operation does not delete other resources created as part of creating a container service, including storage accounts, VMs, and availability sets. All the other resources created with the container service are part of the same resource group and can be deleted individually. + * + * @param resourceGroupName The name of the resource group. + * @param containerServiceName The name of the container service in the specified subscription and resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String containerServiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, containerServiceName), serviceCallback); + } + + /** + * Deletes the specified container service. + * Deletes the specified container service in the specified subscription and resource group. The operation does not delete other resources created as part of creating a container service, including storage accounts, VMs, and availability sets. All the other resources created with the container service are part of the same resource group and can be deleted individually. + * + * @param resourceGroupName The name of the resource group. + * @param containerServiceName The name of the container service in the specified subscription and resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String containerServiceName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, containerServiceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified container service. + * Deletes the specified container service in the specified subscription and resource group. The operation does not delete other resources created as part of creating a container service, including storage accounts, VMs, and availability sets. All the other resources created with the container service are part of the same resource group and can be deleted individually. + * + * @param resourceGroupName The name of the resource group. + * @param containerServiceName The name of the container service in the specified subscription and resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String containerServiceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (containerServiceName == null) { + throw new IllegalArgumentException("Parameter containerServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-07-01"; + return service.beginDelete(resourceGroupName, containerServiceName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of container services in the specified resource group. + * Gets a list of container services in the specified subscription and resource group. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ContainerServiceInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of container services in the specified resource group. + * Gets a list of container services in the specified subscription and resource group. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of container services in the specified resource group. + * Gets a list of container services in the specified subscription and resource group. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ContainerServiceInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of container services in the specified resource group. + * Gets a list of container services in the specified subscription and resource group. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ContainerServiceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of container services in the specified resource group. + * Gets a list of container services in the specified subscription and resource group. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ContainerServiceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-07-01"; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of supported orchestrators in the specified subscription. + * Gets a list of supported orchestrators in the specified subscription. The operation returns properties of each orchestrator including version, available upgrades and whether that version or upgrades are in preview. + * + * @param location The name of a supported Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OrchestratorVersionProfileListResultInner object if successful. + */ + public OrchestratorVersionProfileListResultInner listOrchestrators(String location) { + return listOrchestratorsWithServiceResponseAsync(location).toBlocking().single().body(); + } + + /** + * Gets a list of supported orchestrators in the specified subscription. + * Gets a list of supported orchestrators in the specified subscription. The operation returns properties of each orchestrator including version, available upgrades and whether that version or upgrades are in preview. + * + * @param location The name of a supported Azure region. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listOrchestratorsAsync(String location, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listOrchestratorsWithServiceResponseAsync(location), serviceCallback); + } + + /** + * Gets a list of supported orchestrators in the specified subscription. + * Gets a list of supported orchestrators in the specified subscription. The operation returns properties of each orchestrator including version, available upgrades and whether that version or upgrades are in preview. + * + * @param location The name of a supported Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OrchestratorVersionProfileListResultInner object + */ + public Observable listOrchestratorsAsync(String location) { + return listOrchestratorsWithServiceResponseAsync(location).map(new Func1, OrchestratorVersionProfileListResultInner>() { + @Override + public OrchestratorVersionProfileListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a list of supported orchestrators in the specified subscription. + * Gets a list of supported orchestrators in the specified subscription. The operation returns properties of each orchestrator including version, available upgrades and whether that version or upgrades are in preview. + * + * @param location The name of a supported Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OrchestratorVersionProfileListResultInner object + */ + public Observable> listOrchestratorsWithServiceResponseAsync(String location) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (location == null) { + throw new IllegalArgumentException("Parameter location is required and cannot be null."); + } + final String apiVersion = "2019-08-01"; + final String resourceType = null; + return service.listOrchestrators(this.client.subscriptionId(), location, apiVersion, resourceType, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listOrchestratorsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets a list of supported orchestrators in the specified subscription. + * Gets a list of supported orchestrators in the specified subscription. The operation returns properties of each orchestrator including version, available upgrades and whether that version or upgrades are in preview. + * + * @param location The name of a supported Azure region. + * @param resourceType resource type for which the list of orchestrators needs to be returned + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OrchestratorVersionProfileListResultInner object if successful. + */ + public OrchestratorVersionProfileListResultInner listOrchestrators(String location, String resourceType) { + return listOrchestratorsWithServiceResponseAsync(location, resourceType).toBlocking().single().body(); + } + + /** + * Gets a list of supported orchestrators in the specified subscription. + * Gets a list of supported orchestrators in the specified subscription. The operation returns properties of each orchestrator including version, available upgrades and whether that version or upgrades are in preview. + * + * @param location The name of a supported Azure region. + * @param resourceType resource type for which the list of orchestrators needs to be returned + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listOrchestratorsAsync(String location, String resourceType, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listOrchestratorsWithServiceResponseAsync(location, resourceType), serviceCallback); + } + + /** + * Gets a list of supported orchestrators in the specified subscription. + * Gets a list of supported orchestrators in the specified subscription. The operation returns properties of each orchestrator including version, available upgrades and whether that version or upgrades are in preview. + * + * @param location The name of a supported Azure region. + * @param resourceType resource type for which the list of orchestrators needs to be returned + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OrchestratorVersionProfileListResultInner object + */ + public Observable listOrchestratorsAsync(String location, String resourceType) { + return listOrchestratorsWithServiceResponseAsync(location, resourceType).map(new Func1, OrchestratorVersionProfileListResultInner>() { + @Override + public OrchestratorVersionProfileListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a list of supported orchestrators in the specified subscription. + * Gets a list of supported orchestrators in the specified subscription. The operation returns properties of each orchestrator including version, available upgrades and whether that version or upgrades are in preview. + * + * @param location The name of a supported Azure region. + * @param resourceType resource type for which the list of orchestrators needs to be returned + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OrchestratorVersionProfileListResultInner object + */ + public Observable> listOrchestratorsWithServiceResponseAsync(String location, String resourceType) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (location == null) { + throw new IllegalArgumentException("Parameter location is required and cannot be null."); + } + final String apiVersion = "2019-08-01"; + return service.listOrchestrators(this.client.subscriptionId(), location, apiVersion, resourceType, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listOrchestratorsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listOrchestratorsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of container services in the specified subscription. + * Gets a list of container services in the specified subscription. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ContainerServiceInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of container services in the specified subscription. + * Gets a list of container services in the specified subscription. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of container services in the specified subscription. + * Gets a list of container services in the specified subscription. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ContainerServiceInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of container services in the specified subscription. + * Gets a list of container services in the specified subscription. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ContainerServiceInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of container services in the specified subscription. + * Gets a list of container services in the specified subscription. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ContainerServiceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of container services in the specified resource group. + * Gets a list of container services in the specified subscription and resource group. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ContainerServiceInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of container services in the specified resource group. + * Gets a list of container services in the specified subscription and resource group. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of container services in the specified resource group. + * Gets a list of container services in the specified subscription and resource group. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ContainerServiceInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of container services in the specified resource group. + * Gets a list of container services in the specified subscription and resource group. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ContainerServiceInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of container services in the specified resource group. + * Gets a list of container services in the specified subscription and resource group. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ContainerServiceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/CredentialResultsImpl.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/CredentialResultsImpl.java new file mode 100644 index 000000000000..144684ef65bd --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/CredentialResultsImpl.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.management.containerservice.v2019_08_01.CredentialResults; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.containerservice.v2019_08_01.CredentialResult; + +class CredentialResultsImpl extends WrapperImpl implements CredentialResults { + private final ContainerServiceManager manager; + CredentialResultsImpl(CredentialResultsInner inner, ContainerServiceManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ContainerServiceManager manager() { + return this.manager; + } + + @Override + public List kubeconfigs() { + return this.inner().kubeconfigs(); + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/CredentialResultsInner.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/CredentialResultsInner.java new file mode 100644 index 000000000000..f471226150b5 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/CredentialResultsInner.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.containerservice.v2019_08_01.CredentialResult; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The list of credential result response. + */ +public class CredentialResultsInner { + /** + * Base64-encoded Kubernetes configuration file. + */ + @JsonProperty(value = "kubeconfigs", access = JsonProperty.Access.WRITE_ONLY) + private List kubeconfigs; + + /** + * Get base64-encoded Kubernetes configuration file. + * + * @return the kubeconfigs value + */ + public List kubeconfigs() { + return this.kubeconfigs; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/IdParsingUtils.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..428c9011b978 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ManagedClusterAccessProfileImpl.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ManagedClusterAccessProfileImpl.java new file mode 100644 index 000000000000..ae8436bfe017 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ManagedClusterAccessProfileImpl.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusterAccessProfile; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.Map; + +class ManagedClusterAccessProfileImpl extends WrapperImpl implements ManagedClusterAccessProfile { + private final ContainerServiceManager manager; + ManagedClusterAccessProfileImpl(ManagedClusterAccessProfileInner inner, ContainerServiceManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ContainerServiceManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public byte[] kubeConfig() { + return this.inner().kubeConfig(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ManagedClusterAccessProfileInner.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ManagedClusterAccessProfileInner.java new file mode 100644 index 000000000000..9453e5e1d79c --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ManagedClusterAccessProfileInner.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Managed cluster Access Profile. + */ +@JsonFlatten +public class ManagedClusterAccessProfileInner extends Resource { + /** + * Base64-encoded Kubernetes configuration file. + */ + @JsonProperty(value = "properties.kubeConfig") + private byte[] kubeConfig; + + /** + * Get base64-encoded Kubernetes configuration file. + * + * @return the kubeConfig value + */ + public byte[] kubeConfig() { + return this.kubeConfig; + } + + /** + * Set base64-encoded Kubernetes configuration file. + * + * @param kubeConfig the kubeConfig value to set + * @return the ManagedClusterAccessProfileInner object itself. + */ + public ManagedClusterAccessProfileInner withKubeConfig(byte[] kubeConfig) { + this.kubeConfig = kubeConfig; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ManagedClusterImpl.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ManagedClusterImpl.java new file mode 100644 index 000000000000..f08a7c23aae7 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ManagedClusterImpl.java @@ -0,0 +1,226 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedCluster; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusterAgentPoolProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServiceLinuxProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusterWindowsProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusterServicePrincipalProfile; +import java.util.Map; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusterAddonProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServiceNetworkProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusterAADProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusterAPIServerAccessProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusterIdentity; + +class ManagedClusterImpl extends GroupableResourceCoreImpl implements ManagedCluster, ManagedCluster.Definition, ManagedCluster.Update { + ManagedClusterImpl(String name, ManagedClusterInner inner, ContainerServiceManager manager) { + super(name, inner, manager); + } + + @Override + public Observable createResourceAsync() { + ManagedClustersInner client = this.manager().inner().managedClusters(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ManagedClustersInner client = this.manager().inner().managedClusters(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ManagedClustersInner client = this.manager().inner().managedClusters(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public ManagedClusterAADProfile aadProfile() { + return this.inner().aadProfile(); + } + + @Override + public Map addonProfiles() { + return this.inner().addonProfiles(); + } + + @Override + public List agentPoolProfiles() { + return this.inner().agentPoolProfiles(); + } + + @Override + public ManagedClusterAPIServerAccessProfile apiServerAccessProfile() { + return this.inner().apiServerAccessProfile(); + } + + @Override + public String dnsPrefix() { + return this.inner().dnsPrefix(); + } + + @Override + public Boolean enablePodSecurityPolicy() { + return this.inner().enablePodSecurityPolicy(); + } + + @Override + public Boolean enableRBAC() { + return this.inner().enableRBAC(); + } + + @Override + public String fqdn() { + return this.inner().fqdn(); + } + + @Override + public ManagedClusterIdentity identity() { + return this.inner().identity(); + } + + @Override + public String kubernetesVersion() { + return this.inner().kubernetesVersion(); + } + + @Override + public ContainerServiceLinuxProfile linuxProfile() { + return this.inner().linuxProfile(); + } + + @Override + public Integer maxAgentPools() { + return this.inner().maxAgentPools(); + } + + @Override + public ContainerServiceNetworkProfile networkProfile() { + return this.inner().networkProfile(); + } + + @Override + public String nodeResourceGroup() { + return this.inner().nodeResourceGroup(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public ManagedClusterServicePrincipalProfile servicePrincipalProfile() { + return this.inner().servicePrincipalProfile(); + } + + @Override + public ManagedClusterWindowsProfile windowsProfile() { + return this.inner().windowsProfile(); + } + + @Override + public ManagedClusterImpl withAadProfile(ManagedClusterAADProfile aadProfile) { + this.inner().withAadProfile(aadProfile); + return this; + } + + @Override + public ManagedClusterImpl withAddonProfiles(Map addonProfiles) { + this.inner().withAddonProfiles(addonProfiles); + return this; + } + + @Override + public ManagedClusterImpl withAgentPoolProfiles(List agentPoolProfiles) { + this.inner().withAgentPoolProfiles(agentPoolProfiles); + return this; + } + + @Override + public ManagedClusterImpl withApiServerAccessProfile(ManagedClusterAPIServerAccessProfile apiServerAccessProfile) { + this.inner().withApiServerAccessProfile(apiServerAccessProfile); + return this; + } + + @Override + public ManagedClusterImpl withDnsPrefix(String dnsPrefix) { + this.inner().withDnsPrefix(dnsPrefix); + return this; + } + + @Override + public ManagedClusterImpl withEnablePodSecurityPolicy(Boolean enablePodSecurityPolicy) { + this.inner().withEnablePodSecurityPolicy(enablePodSecurityPolicy); + return this; + } + + @Override + public ManagedClusterImpl withEnableRBAC(Boolean enableRBAC) { + this.inner().withEnableRBAC(enableRBAC); + return this; + } + + @Override + public ManagedClusterImpl withIdentity(ManagedClusterIdentity identity) { + this.inner().withIdentity(identity); + return this; + } + + @Override + public ManagedClusterImpl withKubernetesVersion(String kubernetesVersion) { + this.inner().withKubernetesVersion(kubernetesVersion); + return this; + } + + @Override + public ManagedClusterImpl withLinuxProfile(ContainerServiceLinuxProfile linuxProfile) { + this.inner().withLinuxProfile(linuxProfile); + return this; + } + + @Override + public ManagedClusterImpl withNetworkProfile(ContainerServiceNetworkProfile networkProfile) { + this.inner().withNetworkProfile(networkProfile); + return this; + } + + @Override + public ManagedClusterImpl withNodeResourceGroup(String nodeResourceGroup) { + this.inner().withNodeResourceGroup(nodeResourceGroup); + return this; + } + + @Override + public ManagedClusterImpl withServicePrincipalProfile(ManagedClusterServicePrincipalProfile servicePrincipalProfile) { + this.inner().withServicePrincipalProfile(servicePrincipalProfile); + return this; + } + + @Override + public ManagedClusterImpl withWindowsProfile(ManagedClusterWindowsProfile windowsProfile) { + this.inner().withWindowsProfile(windowsProfile); + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ManagedClusterInner.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ManagedClusterInner.java new file mode 100644 index 000000000000..e7b1429b16b7 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ManagedClusterInner.java @@ -0,0 +1,442 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusterAgentPoolProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServiceLinuxProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusterWindowsProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusterServicePrincipalProfile; +import java.util.Map; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusterAddonProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ContainerServiceNetworkProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusterAADProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusterAPIServerAccessProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusterIdentity; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Managed cluster. + */ +@JsonFlatten +public class ManagedClusterInner extends Resource { + /** + * The current deployment or provisioning state, which only appears in the + * response. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * The max number of agent pools for the managed cluster. + */ + @JsonProperty(value = "properties.maxAgentPools", access = JsonProperty.Access.WRITE_ONLY) + private Integer maxAgentPools; + + /** + * Version of Kubernetes specified when creating the managed cluster. + */ + @JsonProperty(value = "properties.kubernetesVersion") + private String kubernetesVersion; + + /** + * DNS prefix specified when creating the managed cluster. + */ + @JsonProperty(value = "properties.dnsPrefix") + private String dnsPrefix; + + /** + * FQDN for the master pool. + */ + @JsonProperty(value = "properties.fqdn", access = JsonProperty.Access.WRITE_ONLY) + private String fqdn; + + /** + * Properties of the agent pool. + */ + @JsonProperty(value = "properties.agentPoolProfiles") + private List agentPoolProfiles; + + /** + * Profile for Linux VMs in the container service cluster. + */ + @JsonProperty(value = "properties.linuxProfile") + private ContainerServiceLinuxProfile linuxProfile; + + /** + * Profile for Windows VMs in the container service cluster. + */ + @JsonProperty(value = "properties.windowsProfile") + private ManagedClusterWindowsProfile windowsProfile; + + /** + * Information about a service principal identity for the cluster to use + * for manipulating Azure APIs. + */ + @JsonProperty(value = "properties.servicePrincipalProfile") + private ManagedClusterServicePrincipalProfile servicePrincipalProfile; + + /** + * Profile of managed cluster add-on. + */ + @JsonProperty(value = "properties.addonProfiles") + private Map addonProfiles; + + /** + * Name of the resource group containing agent pool nodes. + */ + @JsonProperty(value = "properties.nodeResourceGroup") + private String nodeResourceGroup; + + /** + * Whether to enable Kubernetes Role-Based Access Control. + */ + @JsonProperty(value = "properties.enableRBAC") + private Boolean enableRBAC; + + /** + * (PREVIEW) Whether to enable Kubernetes Pod security policy. + */ + @JsonProperty(value = "properties.enablePodSecurityPolicy") + private Boolean enablePodSecurityPolicy; + + /** + * Profile of network configuration. + */ + @JsonProperty(value = "properties.networkProfile") + private ContainerServiceNetworkProfile networkProfile; + + /** + * Profile of Azure Active Directory configuration. + */ + @JsonProperty(value = "properties.aadProfile") + private ManagedClusterAADProfile aadProfile; + + /** + * Access profile for managed cluster API server. + */ + @JsonProperty(value = "properties.apiServerAccessProfile") + private ManagedClusterAPIServerAccessProfile apiServerAccessProfile; + + /** + * The identity of the managed cluster, if configured. + */ + @JsonProperty(value = "identity") + private ManagedClusterIdentity identity; + + /** + * Get the current deployment or provisioning state, which only appears in the response. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the max number of agent pools for the managed cluster. + * + * @return the maxAgentPools value + */ + public Integer maxAgentPools() { + return this.maxAgentPools; + } + + /** + * Get version of Kubernetes specified when creating the managed cluster. + * + * @return the kubernetesVersion value + */ + public String kubernetesVersion() { + return this.kubernetesVersion; + } + + /** + * Set version of Kubernetes specified when creating the managed cluster. + * + * @param kubernetesVersion the kubernetesVersion value to set + * @return the ManagedClusterInner object itself. + */ + public ManagedClusterInner withKubernetesVersion(String kubernetesVersion) { + this.kubernetesVersion = kubernetesVersion; + return this; + } + + /** + * Get dNS prefix specified when creating the managed cluster. + * + * @return the dnsPrefix value + */ + public String dnsPrefix() { + return this.dnsPrefix; + } + + /** + * Set dNS prefix specified when creating the managed cluster. + * + * @param dnsPrefix the dnsPrefix value to set + * @return the ManagedClusterInner object itself. + */ + public ManagedClusterInner withDnsPrefix(String dnsPrefix) { + this.dnsPrefix = dnsPrefix; + return this; + } + + /** + * Get fQDN for the master pool. + * + * @return the fqdn value + */ + public String fqdn() { + return this.fqdn; + } + + /** + * Get properties of the agent pool. + * + * @return the agentPoolProfiles value + */ + public List agentPoolProfiles() { + return this.agentPoolProfiles; + } + + /** + * Set properties of the agent pool. + * + * @param agentPoolProfiles the agentPoolProfiles value to set + * @return the ManagedClusterInner object itself. + */ + public ManagedClusterInner withAgentPoolProfiles(List agentPoolProfiles) { + this.agentPoolProfiles = agentPoolProfiles; + return this; + } + + /** + * Get profile for Linux VMs in the container service cluster. + * + * @return the linuxProfile value + */ + public ContainerServiceLinuxProfile linuxProfile() { + return this.linuxProfile; + } + + /** + * Set profile for Linux VMs in the container service cluster. + * + * @param linuxProfile the linuxProfile value to set + * @return the ManagedClusterInner object itself. + */ + public ManagedClusterInner withLinuxProfile(ContainerServiceLinuxProfile linuxProfile) { + this.linuxProfile = linuxProfile; + return this; + } + + /** + * Get profile for Windows VMs in the container service cluster. + * + * @return the windowsProfile value + */ + public ManagedClusterWindowsProfile windowsProfile() { + return this.windowsProfile; + } + + /** + * Set profile for Windows VMs in the container service cluster. + * + * @param windowsProfile the windowsProfile value to set + * @return the ManagedClusterInner object itself. + */ + public ManagedClusterInner withWindowsProfile(ManagedClusterWindowsProfile windowsProfile) { + this.windowsProfile = windowsProfile; + return this; + } + + /** + * Get information about a service principal identity for the cluster to use for manipulating Azure APIs. + * + * @return the servicePrincipalProfile value + */ + public ManagedClusterServicePrincipalProfile servicePrincipalProfile() { + return this.servicePrincipalProfile; + } + + /** + * Set information about a service principal identity for the cluster to use for manipulating Azure APIs. + * + * @param servicePrincipalProfile the servicePrincipalProfile value to set + * @return the ManagedClusterInner object itself. + */ + public ManagedClusterInner withServicePrincipalProfile(ManagedClusterServicePrincipalProfile servicePrincipalProfile) { + this.servicePrincipalProfile = servicePrincipalProfile; + return this; + } + + /** + * Get profile of managed cluster add-on. + * + * @return the addonProfiles value + */ + public Map addonProfiles() { + return this.addonProfiles; + } + + /** + * Set profile of managed cluster add-on. + * + * @param addonProfiles the addonProfiles value to set + * @return the ManagedClusterInner object itself. + */ + public ManagedClusterInner withAddonProfiles(Map addonProfiles) { + this.addonProfiles = addonProfiles; + return this; + } + + /** + * Get name of the resource group containing agent pool nodes. + * + * @return the nodeResourceGroup value + */ + public String nodeResourceGroup() { + return this.nodeResourceGroup; + } + + /** + * Set name of the resource group containing agent pool nodes. + * + * @param nodeResourceGroup the nodeResourceGroup value to set + * @return the ManagedClusterInner object itself. + */ + public ManagedClusterInner withNodeResourceGroup(String nodeResourceGroup) { + this.nodeResourceGroup = nodeResourceGroup; + return this; + } + + /** + * Get whether to enable Kubernetes Role-Based Access Control. + * + * @return the enableRBAC value + */ + public Boolean enableRBAC() { + return this.enableRBAC; + } + + /** + * Set whether to enable Kubernetes Role-Based Access Control. + * + * @param enableRBAC the enableRBAC value to set + * @return the ManagedClusterInner object itself. + */ + public ManagedClusterInner withEnableRBAC(Boolean enableRBAC) { + this.enableRBAC = enableRBAC; + return this; + } + + /** + * Get (PREVIEW) Whether to enable Kubernetes Pod security policy. + * + * @return the enablePodSecurityPolicy value + */ + public Boolean enablePodSecurityPolicy() { + return this.enablePodSecurityPolicy; + } + + /** + * Set (PREVIEW) Whether to enable Kubernetes Pod security policy. + * + * @param enablePodSecurityPolicy the enablePodSecurityPolicy value to set + * @return the ManagedClusterInner object itself. + */ + public ManagedClusterInner withEnablePodSecurityPolicy(Boolean enablePodSecurityPolicy) { + this.enablePodSecurityPolicy = enablePodSecurityPolicy; + return this; + } + + /** + * Get profile of network configuration. + * + * @return the networkProfile value + */ + public ContainerServiceNetworkProfile networkProfile() { + return this.networkProfile; + } + + /** + * Set profile of network configuration. + * + * @param networkProfile the networkProfile value to set + * @return the ManagedClusterInner object itself. + */ + public ManagedClusterInner withNetworkProfile(ContainerServiceNetworkProfile networkProfile) { + this.networkProfile = networkProfile; + return this; + } + + /** + * Get profile of Azure Active Directory configuration. + * + * @return the aadProfile value + */ + public ManagedClusterAADProfile aadProfile() { + return this.aadProfile; + } + + /** + * Set profile of Azure Active Directory configuration. + * + * @param aadProfile the aadProfile value to set + * @return the ManagedClusterInner object itself. + */ + public ManagedClusterInner withAadProfile(ManagedClusterAADProfile aadProfile) { + this.aadProfile = aadProfile; + return this; + } + + /** + * Get access profile for managed cluster API server. + * + * @return the apiServerAccessProfile value + */ + public ManagedClusterAPIServerAccessProfile apiServerAccessProfile() { + return this.apiServerAccessProfile; + } + + /** + * Set access profile for managed cluster API server. + * + * @param apiServerAccessProfile the apiServerAccessProfile value to set + * @return the ManagedClusterInner object itself. + */ + public ManagedClusterInner withApiServerAccessProfile(ManagedClusterAPIServerAccessProfile apiServerAccessProfile) { + this.apiServerAccessProfile = apiServerAccessProfile; + return this; + } + + /** + * Get the identity of the managed cluster, if configured. + * + * @return the identity value + */ + public ManagedClusterIdentity identity() { + return this.identity; + } + + /** + * Set the identity of the managed cluster, if configured. + * + * @param identity the identity value to set + * @return the ManagedClusterInner object itself. + */ + public ManagedClusterInner withIdentity(ManagedClusterIdentity identity) { + this.identity = identity; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ManagedClusterUpgradeProfileImpl.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ManagedClusterUpgradeProfileImpl.java new file mode 100644 index 000000000000..e4a1384e60da --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ManagedClusterUpgradeProfileImpl.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusterUpgradeProfile; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusterPoolUpgradeProfile; + +class ManagedClusterUpgradeProfileImpl extends WrapperImpl implements ManagedClusterUpgradeProfile { + private final ContainerServiceManager manager; + ManagedClusterUpgradeProfileImpl(ManagedClusterUpgradeProfileInner inner, ContainerServiceManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ContainerServiceManager manager() { + return this.manager; + } + + @Override + public List agentPoolProfiles() { + return this.inner().agentPoolProfiles(); + } + + @Override + public ManagedClusterPoolUpgradeProfile controlPlaneProfile() { + return this.inner().controlPlaneProfile(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ManagedClusterUpgradeProfileInner.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ManagedClusterUpgradeProfileInner.java new file mode 100644 index 000000000000..4a41fd0b7529 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ManagedClusterUpgradeProfileInner.java @@ -0,0 +1,118 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusterPoolUpgradeProfile; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The list of available upgrades for compute pools. + */ +@JsonFlatten +public class ManagedClusterUpgradeProfileInner { + /** + * Id of upgrade profile. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Name of upgrade profile. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Type of upgrade profile. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * The list of available upgrade versions for the control plane. + */ + @JsonProperty(value = "properties.controlPlaneProfile", required = true) + private ManagedClusterPoolUpgradeProfile controlPlaneProfile; + + /** + * The list of available upgrade versions for agent pools. + */ + @JsonProperty(value = "properties.agentPoolProfiles", required = true) + private List agentPoolProfiles; + + /** + * Get id of upgrade profile. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get name of upgrade profile. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get type of upgrade profile. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the list of available upgrade versions for the control plane. + * + * @return the controlPlaneProfile value + */ + public ManagedClusterPoolUpgradeProfile controlPlaneProfile() { + return this.controlPlaneProfile; + } + + /** + * Set the list of available upgrade versions for the control plane. + * + * @param controlPlaneProfile the controlPlaneProfile value to set + * @return the ManagedClusterUpgradeProfileInner object itself. + */ + public ManagedClusterUpgradeProfileInner withControlPlaneProfile(ManagedClusterPoolUpgradeProfile controlPlaneProfile) { + this.controlPlaneProfile = controlPlaneProfile; + return this; + } + + /** + * Get the list of available upgrade versions for agent pools. + * + * @return the agentPoolProfiles value + */ + public List agentPoolProfiles() { + return this.agentPoolProfiles; + } + + /** + * Set the list of available upgrade versions for agent pools. + * + * @param agentPoolProfiles the agentPoolProfiles value to set + * @return the ManagedClusterUpgradeProfileInner object itself. + */ + public ManagedClusterUpgradeProfileInner withAgentPoolProfiles(List agentPoolProfiles) { + this.agentPoolProfiles = agentPoolProfiles; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ManagedClustersImpl.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ManagedClustersImpl.java new file mode 100644 index 000000000000..759e3566bf0d --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ManagedClustersImpl.java @@ -0,0 +1,203 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * def + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusters; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedCluster; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.containerservice.v2019_08_01.CredentialResults; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusterServicePrincipalProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusterAADProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusterUpgradeProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusterAccessProfile; + +class ManagedClustersImpl extends GroupableResourcesCoreImpl implements ManagedClusters { + protected ManagedClustersImpl(ContainerServiceManager manager) { + super(manager.inner().managedClusters(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + ManagedClustersInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + ManagedClustersInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + ManagedClustersInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + ManagedClustersInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ManagedCluster call(ManagedClusterInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + ManagedClustersInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + ManagedClustersInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ManagedCluster call(ManagedClusterInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public ManagedClusterImpl define(String name) { + return wrapModel(name); + } + + @Override + public Observable listClusterAdminCredentialsAsync(String resourceGroupName, String resourceName) { + ManagedClustersInner client = this.inner(); + return client.listClusterAdminCredentialsAsync(resourceGroupName, resourceName) + .map(new Func1() { + @Override + public CredentialResults call(CredentialResultsInner inner) { + return new CredentialResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable listClusterUserCredentialsAsync(String resourceGroupName, String resourceName) { + ManagedClustersInner client = this.inner(); + return client.listClusterUserCredentialsAsync(resourceGroupName, resourceName) + .map(new Func1() { + @Override + public CredentialResults call(CredentialResultsInner inner) { + return new CredentialResultsImpl(inner, manager()); + } + }); + } + + @Override + public Completable resetServicePrincipalProfileAsync(String resourceGroupName, String resourceName, ManagedClusterServicePrincipalProfile parameters) { + ManagedClustersInner client = this.inner(); + return client.resetServicePrincipalProfileAsync(resourceGroupName, resourceName, parameters).toCompletable(); + } + + @Override + public Completable resetAADProfileAsync(String resourceGroupName, String resourceName, ManagedClusterAADProfile parameters) { + ManagedClustersInner client = this.inner(); + return client.resetAADProfileAsync(resourceGroupName, resourceName, parameters).toCompletable(); + } + + @Override + protected ManagedClusterImpl wrapModel(ManagedClusterInner inner) { + return new ManagedClusterImpl(inner.name(), inner, manager()); + } + + @Override + protected ManagedClusterImpl wrapModel(String name) { + return new ManagedClusterImpl(name, new ManagedClusterInner(), this.manager()); + } + + @Override + public Observable getUpgradeProfileAsync(String resourceGroupName, String resourceName) { + ManagedClustersInner client = this.inner(); + return client.getUpgradeProfileAsync(resourceGroupName, resourceName) + .map(new Func1() { + @Override + public ManagedClusterUpgradeProfile call(ManagedClusterUpgradeProfileInner inner) { + return new ManagedClusterUpgradeProfileImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAccessProfileAsync(String resourceGroupName, String resourceName, String roleName) { + ManagedClustersInner client = this.inner(); + return client.getAccessProfileAsync(resourceGroupName, resourceName, roleName) + .map(new Func1() { + @Override + public ManagedClusterAccessProfile call(ManagedClusterAccessProfileInner inner) { + return new ManagedClusterAccessProfileImpl(inner, manager()); + } + }); + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ManagedClustersInner.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ManagedClustersInner.java new file mode 100644 index 000000000000..901b6f03105f --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/ManagedClustersInner.java @@ -0,0 +1,2070 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusterAADProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusterServicePrincipalProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.TagsObject; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ManagedClusters. + */ +public class ManagedClustersInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ManagedClustersService service; + /** The service client containing this operation class. */ + private ContainerServiceManagementClientImpl client; + + /** + * Initializes an instance of ManagedClustersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagedClustersInner(Retrofit retrofit, ContainerServiceManagementClientImpl client) { + this.service = retrofit.create(ManagedClustersService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagedClusters to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagedClustersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusters list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusters listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters") + Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusters getUpgradeProfile" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default") + Observable> getUpgradeProfile(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusters getAccessProfile" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential") + Observable> getAccessProfile(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Path("roleName") String roleName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusters listClusterAdminCredentials" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential") + Observable> listClusterAdminCredentials(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusters listClusterUserCredentials" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential") + Observable> listClusterUserCredentials(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusters getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusters createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Body ManagedClusterInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusters beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Body ManagedClusterInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusters updateTags" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") + Observable> updateTags(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TagsObject parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusters beginUpdateTags" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}") + Observable> beginUpdateTags(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TagsObject parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusters delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusters beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusters resetServicePrincipalProfile" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") + Observable> resetServicePrincipalProfile(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Body ManagedClusterServicePrincipalProfile parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusters beginResetServicePrincipalProfile" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile") + Observable> beginResetServicePrincipalProfile(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Body ManagedClusterServicePrincipalProfile parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusters resetAADProfile" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") + Observable> resetAADProfile(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Body ManagedClusterAADProfile parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusters beginResetAADProfile" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile") + Observable> beginResetAADProfile(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Body ManagedClusterAADProfile parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusters listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.ManagedClusters listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of managed clusters in the specified subscription. + * Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedClusterInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of managed clusters in the specified subscription. + * Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of managed clusters in the specified subscription. + * Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedClusterInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of managed clusters in the specified subscription. + * Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedClusterInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of managed clusters in the specified subscription. + * Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedClusterInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-08-01"; + return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists managed clusters in the specified subscription and resource group. + * Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedClusterInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists managed clusters in the specified subscription and resource group. + * Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists managed clusters in the specified subscription and resource group. + * Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedClusterInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists managed clusters in the specified subscription and resource group. + * Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedClusterInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists managed clusters in the specified subscription and resource group. + * Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedClusterInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + final String apiVersion = "2019-08-01"; + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets upgrade profile for a managed cluster. + * Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedClusterUpgradeProfileInner object if successful. + */ + public ManagedClusterUpgradeProfileInner getUpgradeProfile(String resourceGroupName, String resourceName) { + return getUpgradeProfileWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Gets upgrade profile for a managed cluster. + * Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getUpgradeProfileAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getUpgradeProfileWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Gets upgrade profile for a managed cluster. + * Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedClusterUpgradeProfileInner object + */ + public Observable getUpgradeProfileAsync(String resourceGroupName, String resourceName) { + return getUpgradeProfileWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, ManagedClusterUpgradeProfileInner>() { + @Override + public ManagedClusterUpgradeProfileInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets upgrade profile for a managed cluster. + * Gets the details of the upgrade profile for a managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedClusterUpgradeProfileInner object + */ + public Observable> getUpgradeProfileWithServiceResponseAsync(String resourceGroupName, String resourceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + final String apiVersion = "2019-08-01"; + return service.getUpgradeProfile(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getUpgradeProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getUpgradeProfileDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets an access profile of a managed cluster. + * Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param roleName The name of the role for managed cluster accessProfile resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedClusterAccessProfileInner object if successful. + */ + public ManagedClusterAccessProfileInner getAccessProfile(String resourceGroupName, String resourceName, String roleName) { + return getAccessProfileWithServiceResponseAsync(resourceGroupName, resourceName, roleName).toBlocking().single().body(); + } + + /** + * Gets an access profile of a managed cluster. + * Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param roleName The name of the role for managed cluster accessProfile resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAccessProfileAsync(String resourceGroupName, String resourceName, String roleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAccessProfileWithServiceResponseAsync(resourceGroupName, resourceName, roleName), serviceCallback); + } + + /** + * Gets an access profile of a managed cluster. + * Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param roleName The name of the role for managed cluster accessProfile resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedClusterAccessProfileInner object + */ + public Observable getAccessProfileAsync(String resourceGroupName, String resourceName, String roleName) { + return getAccessProfileWithServiceResponseAsync(resourceGroupName, resourceName, roleName).map(new Func1, ManagedClusterAccessProfileInner>() { + @Override + public ManagedClusterAccessProfileInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an access profile of a managed cluster. + * Gets the accessProfile for the specified role name of the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param roleName The name of the role for managed cluster accessProfile resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedClusterAccessProfileInner object + */ + public Observable> getAccessProfileWithServiceResponseAsync(String resourceGroupName, String resourceName, String roleName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (roleName == null) { + throw new IllegalArgumentException("Parameter roleName is required and cannot be null."); + } + final String apiVersion = "2019-08-01"; + return service.getAccessProfile(this.client.subscriptionId(), resourceGroupName, resourceName, roleName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAccessProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAccessProfileDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets cluster admin credential of a managed cluster. + * Gets cluster admin credential of the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CredentialResultsInner object if successful. + */ + public CredentialResultsInner listClusterAdminCredentials(String resourceGroupName, String resourceName) { + return listClusterAdminCredentialsWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Gets cluster admin credential of a managed cluster. + * Gets cluster admin credential of the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listClusterAdminCredentialsAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listClusterAdminCredentialsWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Gets cluster admin credential of a managed cluster. + * Gets cluster admin credential of the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CredentialResultsInner object + */ + public Observable listClusterAdminCredentialsAsync(String resourceGroupName, String resourceName) { + return listClusterAdminCredentialsWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, CredentialResultsInner>() { + @Override + public CredentialResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets cluster admin credential of a managed cluster. + * Gets cluster admin credential of the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CredentialResultsInner object + */ + public Observable> listClusterAdminCredentialsWithServiceResponseAsync(String resourceGroupName, String resourceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + final String apiVersion = "2019-08-01"; + return service.listClusterAdminCredentials(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listClusterAdminCredentialsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listClusterAdminCredentialsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets cluster user credential of a managed cluster. + * Gets cluster user credential of the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CredentialResultsInner object if successful. + */ + public CredentialResultsInner listClusterUserCredentials(String resourceGroupName, String resourceName) { + return listClusterUserCredentialsWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Gets cluster user credential of a managed cluster. + * Gets cluster user credential of the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listClusterUserCredentialsAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listClusterUserCredentialsWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Gets cluster user credential of a managed cluster. + * Gets cluster user credential of the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CredentialResultsInner object + */ + public Observable listClusterUserCredentialsAsync(String resourceGroupName, String resourceName) { + return listClusterUserCredentialsWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, CredentialResultsInner>() { + @Override + public CredentialResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets cluster user credential of a managed cluster. + * Gets cluster user credential of the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CredentialResultsInner object + */ + public Observable> listClusterUserCredentialsWithServiceResponseAsync(String resourceGroupName, String resourceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + final String apiVersion = "2019-08-01"; + return service.listClusterUserCredentials(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listClusterUserCredentialsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listClusterUserCredentialsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a managed cluster. + * Gets the details of the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedClusterInner object if successful. + */ + public ManagedClusterInner getByResourceGroup(String resourceGroupName, String resourceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Gets a managed cluster. + * Gets the details of the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Gets a managed cluster. + * Gets the details of the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedClusterInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String resourceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, ManagedClusterInner>() { + @Override + public ManagedClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a managed cluster. + * Gets the details of the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedClusterInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String resourceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + final String apiVersion = "2019-08-01"; + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates a managed cluster. + * Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Create or Update a Managed Cluster operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedClusterInner object if successful. + */ + public ManagedClusterInner createOrUpdate(String resourceGroupName, String resourceName, ManagedClusterInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a managed cluster. + * Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Create or Update a Managed Cluster operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String resourceName, ManagedClusterInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters), serviceCallback); + } + + /** + * Creates or updates a managed cluster. + * Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Create or Update a Managed Cluster operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String resourceName, ManagedClusterInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1, ManagedClusterInner>() { + @Override + public ManagedClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a managed cluster. + * Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Create or Update a Managed Cluster operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String resourceName, ManagedClusterInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2019-08-01"; + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates a managed cluster. + * Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Create or Update a Managed Cluster operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedClusterInner object if successful. + */ + public ManagedClusterInner beginCreateOrUpdate(String resourceGroupName, String resourceName, ManagedClusterInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a managed cluster. + * Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Create or Update a Managed Cluster operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String resourceName, ManagedClusterInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters), serviceCallback); + } + + /** + * Creates or updates a managed cluster. + * Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Create or Update a Managed Cluster operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedClusterInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String resourceName, ManagedClusterInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1, ManagedClusterInner>() { + @Override + public ManagedClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a managed cluster. + * Creates or updates a managed cluster with the specified configuration for agents and Kubernetes version. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Create or Update a Managed Cluster operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedClusterInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String resourceName, ManagedClusterInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2019-08-01"; + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates tags on a managed cluster. + * Updates a managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedClusterInner object if successful. + */ + public ManagedClusterInner updateTags(String resourceGroupName, String resourceName) { + return updateTagsWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().last().body(); + } + + /** + * Updates tags on a managed cluster. + * Updates a managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateTagsAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateTagsWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Updates tags on a managed cluster. + * Updates a managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateTagsAsync(String resourceGroupName, String resourceName) { + return updateTagsWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, ManagedClusterInner>() { + @Override + public ManagedClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates tags on a managed cluster. + * Updates a managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateTagsWithServiceResponseAsync(String resourceGroupName, String resourceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + final String apiVersion = "2019-08-01"; + final Map tags = null; + TagsObject parameters = new TagsObject(); + parameters.withTags(null); + Observable> observable = service.updateTags(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Updates tags on a managed cluster. + * Updates a managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedClusterInner object if successful. + */ + public ManagedClusterInner updateTags(String resourceGroupName, String resourceName, Map tags) { + return updateTagsWithServiceResponseAsync(resourceGroupName, resourceName, tags).toBlocking().last().body(); + } + + /** + * Updates tags on a managed cluster. + * Updates a managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param tags Resource tags. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateTagsAsync(String resourceGroupName, String resourceName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateTagsWithServiceResponseAsync(resourceGroupName, resourceName, tags), serviceCallback); + } + + /** + * Updates tags on a managed cluster. + * Updates a managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateTagsAsync(String resourceGroupName, String resourceName, Map tags) { + return updateTagsWithServiceResponseAsync(resourceGroupName, resourceName, tags).map(new Func1, ManagedClusterInner>() { + @Override + public ManagedClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates tags on a managed cluster. + * Updates a managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateTagsWithServiceResponseAsync(String resourceGroupName, String resourceName, Map tags) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + Validator.validate(tags); + final String apiVersion = "2019-08-01"; + TagsObject parameters = new TagsObject(); + parameters.withTags(tags); + Observable> observable = service.updateTags(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates tags on a managed cluster. + * Updates a managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedClusterInner object if successful. + */ + public ManagedClusterInner beginUpdateTags(String resourceGroupName, String resourceName) { + return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Updates tags on a managed cluster. + * Updates a managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateTagsAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateTagsWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Updates tags on a managed cluster. + * Updates a managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedClusterInner object + */ + public Observable beginUpdateTagsAsync(String resourceGroupName, String resourceName) { + return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, ManagedClusterInner>() { + @Override + public ManagedClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates tags on a managed cluster. + * Updates a managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedClusterInner object + */ + public Observable> beginUpdateTagsWithServiceResponseAsync(String resourceGroupName, String resourceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + final String apiVersion = "2019-08-01"; + final Map tags = null; + TagsObject parameters = new TagsObject(); + parameters.withTags(null); + return service.beginUpdateTags(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateTagsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates tags on a managed cluster. + * Updates a managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagedClusterInner object if successful. + */ + public ManagedClusterInner beginUpdateTags(String resourceGroupName, String resourceName, Map tags) { + return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, resourceName, tags).toBlocking().single().body(); + } + + /** + * Updates tags on a managed cluster. + * Updates a managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param tags Resource tags. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateTagsAsync(String resourceGroupName, String resourceName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateTagsWithServiceResponseAsync(resourceGroupName, resourceName, tags), serviceCallback); + } + + /** + * Updates tags on a managed cluster. + * Updates a managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedClusterInner object + */ + public Observable beginUpdateTagsAsync(String resourceGroupName, String resourceName, Map tags) { + return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, resourceName, tags).map(new Func1, ManagedClusterInner>() { + @Override + public ManagedClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates tags on a managed cluster. + * Updates a managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagedClusterInner object + */ + public Observable> beginUpdateTagsWithServiceResponseAsync(String resourceGroupName, String resourceName, Map tags) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + Validator.validate(tags); + final String apiVersion = "2019-08-01"; + TagsObject parameters = new TagsObject(); + parameters.withTags(tags); + return service.beginUpdateTags(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateTagsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateTagsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a managed cluster. + * Deletes the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String resourceName) { + deleteWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().last().body(); + } + + /** + * Deletes a managed cluster. + * Deletes the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Deletes a managed cluster. + * Deletes the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String resourceName) { + return deleteWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a managed cluster. + * Deletes the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String resourceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + final String apiVersion = "2019-08-01"; + Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a managed cluster. + * Deletes the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String resourceName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Deletes a managed cluster. + * Deletes the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Deletes a managed cluster. + * Deletes the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String resourceName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a managed cluster. + * Deletes the managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String resourceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + final String apiVersion = "2019-08-01"; + return service.beginDelete(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Reset Service Principal Profile of a managed cluster. + * Update the service principal Profile for a managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Reset Service Principal Profile operation for a Managed Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void resetServicePrincipalProfile(String resourceGroupName, String resourceName, ManagedClusterServicePrincipalProfile parameters) { + resetServicePrincipalProfileWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().last().body(); + } + + /** + * Reset Service Principal Profile of a managed cluster. + * Update the service principal Profile for a managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Reset Service Principal Profile operation for a Managed Cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture resetServicePrincipalProfileAsync(String resourceGroupName, String resourceName, ManagedClusterServicePrincipalProfile parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(resetServicePrincipalProfileWithServiceResponseAsync(resourceGroupName, resourceName, parameters), serviceCallback); + } + + /** + * Reset Service Principal Profile of a managed cluster. + * Update the service principal Profile for a managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Reset Service Principal Profile operation for a Managed Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable resetServicePrincipalProfileAsync(String resourceGroupName, String resourceName, ManagedClusterServicePrincipalProfile parameters) { + return resetServicePrincipalProfileWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Reset Service Principal Profile of a managed cluster. + * Update the service principal Profile for a managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Reset Service Principal Profile operation for a Managed Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> resetServicePrincipalProfileWithServiceResponseAsync(String resourceGroupName, String resourceName, ManagedClusterServicePrincipalProfile parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2019-08-01"; + Observable> observable = service.resetServicePrincipalProfile(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Reset Service Principal Profile of a managed cluster. + * Update the service principal Profile for a managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Reset Service Principal Profile operation for a Managed Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginResetServicePrincipalProfile(String resourceGroupName, String resourceName, ManagedClusterServicePrincipalProfile parameters) { + beginResetServicePrincipalProfileWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().single().body(); + } + + /** + * Reset Service Principal Profile of a managed cluster. + * Update the service principal Profile for a managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Reset Service Principal Profile operation for a Managed Cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginResetServicePrincipalProfileAsync(String resourceGroupName, String resourceName, ManagedClusterServicePrincipalProfile parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginResetServicePrincipalProfileWithServiceResponseAsync(resourceGroupName, resourceName, parameters), serviceCallback); + } + + /** + * Reset Service Principal Profile of a managed cluster. + * Update the service principal Profile for a managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Reset Service Principal Profile operation for a Managed Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginResetServicePrincipalProfileAsync(String resourceGroupName, String resourceName, ManagedClusterServicePrincipalProfile parameters) { + return beginResetServicePrincipalProfileWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Reset Service Principal Profile of a managed cluster. + * Update the service principal Profile for a managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Reset Service Principal Profile operation for a Managed Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginResetServicePrincipalProfileWithServiceResponseAsync(String resourceGroupName, String resourceName, ManagedClusterServicePrincipalProfile parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2019-08-01"; + return service.beginResetServicePrincipalProfile(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginResetServicePrincipalProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginResetServicePrincipalProfileDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Reset AAD Profile of a managed cluster. + * Update the AAD Profile for a managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Reset AAD Profile operation for a Managed Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void resetAADProfile(String resourceGroupName, String resourceName, ManagedClusterAADProfile parameters) { + resetAADProfileWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().last().body(); + } + + /** + * Reset AAD Profile of a managed cluster. + * Update the AAD Profile for a managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Reset AAD Profile operation for a Managed Cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture resetAADProfileAsync(String resourceGroupName, String resourceName, ManagedClusterAADProfile parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(resetAADProfileWithServiceResponseAsync(resourceGroupName, resourceName, parameters), serviceCallback); + } + + /** + * Reset AAD Profile of a managed cluster. + * Update the AAD Profile for a managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Reset AAD Profile operation for a Managed Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable resetAADProfileAsync(String resourceGroupName, String resourceName, ManagedClusterAADProfile parameters) { + return resetAADProfileWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Reset AAD Profile of a managed cluster. + * Update the AAD Profile for a managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Reset AAD Profile operation for a Managed Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> resetAADProfileWithServiceResponseAsync(String resourceGroupName, String resourceName, ManagedClusterAADProfile parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2019-08-01"; + Observable> observable = service.resetAADProfile(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Reset AAD Profile of a managed cluster. + * Update the AAD Profile for a managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Reset AAD Profile operation for a Managed Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginResetAADProfile(String resourceGroupName, String resourceName, ManagedClusterAADProfile parameters) { + beginResetAADProfileWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().single().body(); + } + + /** + * Reset AAD Profile of a managed cluster. + * Update the AAD Profile for a managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Reset AAD Profile operation for a Managed Cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginResetAADProfileAsync(String resourceGroupName, String resourceName, ManagedClusterAADProfile parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginResetAADProfileWithServiceResponseAsync(resourceGroupName, resourceName, parameters), serviceCallback); + } + + /** + * Reset AAD Profile of a managed cluster. + * Update the AAD Profile for a managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Reset AAD Profile operation for a Managed Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginResetAADProfileAsync(String resourceGroupName, String resourceName, ManagedClusterAADProfile parameters) { + return beginResetAADProfileWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Reset AAD Profile of a managed cluster. + * Update the AAD Profile for a managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the managed cluster resource. + * @param parameters Parameters supplied to the Reset AAD Profile operation for a Managed Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginResetAADProfileWithServiceResponseAsync(String resourceGroupName, String resourceName, ManagedClusterAADProfile parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2019-08-01"; + return service.beginResetAADProfile(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginResetAADProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginResetAADProfileDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of managed clusters in the specified subscription. + * Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedClusterInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of managed clusters in the specified subscription. + * Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of managed clusters in the specified subscription. + * Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedClusterInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of managed clusters in the specified subscription. + * Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedClusterInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of managed clusters in the specified subscription. + * Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedClusterInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists managed clusters in the specified subscription and resource group. + * Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ManagedClusterInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists managed clusters in the specified subscription and resource group. + * Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists managed clusters in the specified subscription and resource group. + * Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedClusterInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists managed clusters in the specified subscription and resource group. + * Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ManagedClusterInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists managed clusters in the specified subscription and resource group. + * Lists managed clusters in the specified subscription and resource group. The operation returns properties of each managed cluster. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ManagedClusterInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OpenShiftManagedClusterImpl.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OpenShiftManagedClusterImpl.java new file mode 100644 index 000000000000..3ee4d03ab946 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OpenShiftManagedClusterImpl.java @@ -0,0 +1,150 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.containerservice.v2019_08_01.OpenShiftManagedCluster; +import rx.Observable; +import com.microsoft.azure.management.containerservice.v2019_08_01.PurchasePlan; +import com.microsoft.azure.management.containerservice.v2019_08_01.NetworkProfile; +import java.util.List; +import com.microsoft.azure.management.containerservice.v2019_08_01.OpenShiftRouterProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.OpenShiftManagedClusterMasterPoolProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.OpenShiftManagedClusterAgentPoolProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.OpenShiftManagedClusterAuthProfile; + +class OpenShiftManagedClusterImpl extends GroupableResourceCoreImpl implements OpenShiftManagedCluster, OpenShiftManagedCluster.Definition, OpenShiftManagedCluster.Update { + OpenShiftManagedClusterImpl(String name, OpenShiftManagedClusterInner inner, ContainerServiceManager manager) { + super(name, inner, manager); + } + + @Override + public Observable createResourceAsync() { + OpenShiftManagedClustersInner client = this.manager().inner().openShiftManagedClusters(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + OpenShiftManagedClustersInner client = this.manager().inner().openShiftManagedClusters(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + OpenShiftManagedClustersInner client = this.manager().inner().openShiftManagedClusters(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public List agentPoolProfiles() { + return this.inner().agentPoolProfiles(); + } + + @Override + public OpenShiftManagedClusterAuthProfile authProfile() { + return this.inner().authProfile(); + } + + @Override + public String clusterVersion() { + return this.inner().clusterVersion(); + } + + @Override + public String fqdn() { + return this.inner().fqdn(); + } + + @Override + public OpenShiftManagedClusterMasterPoolProfile masterPoolProfile() { + return this.inner().masterPoolProfile(); + } + + @Override + public NetworkProfile networkProfile() { + return this.inner().networkProfile(); + } + + @Override + public String openShiftVersion() { + return this.inner().openShiftVersion(); + } + + @Override + public PurchasePlan plan() { + return this.inner().plan(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public String publicHostname() { + return this.inner().publicHostname(); + } + + @Override + public List routerProfiles() { + return this.inner().routerProfiles(); + } + + @Override + public OpenShiftManagedClusterImpl withOpenShiftVersion(String openShiftVersion) { + this.inner().withOpenShiftVersion(openShiftVersion); + return this; + } + + @Override + public OpenShiftManagedClusterImpl withAgentPoolProfiles(List agentPoolProfiles) { + this.inner().withAgentPoolProfiles(agentPoolProfiles); + return this; + } + + @Override + public OpenShiftManagedClusterImpl withAuthProfile(OpenShiftManagedClusterAuthProfile authProfile) { + this.inner().withAuthProfile(authProfile); + return this; + } + + @Override + public OpenShiftManagedClusterImpl withMasterPoolProfile(OpenShiftManagedClusterMasterPoolProfile masterPoolProfile) { + this.inner().withMasterPoolProfile(masterPoolProfile); + return this; + } + + @Override + public OpenShiftManagedClusterImpl withNetworkProfile(NetworkProfile networkProfile) { + this.inner().withNetworkProfile(networkProfile); + return this; + } + + @Override + public OpenShiftManagedClusterImpl withPlan(PurchasePlan plan) { + this.inner().withPlan(plan); + return this; + } + + @Override + public OpenShiftManagedClusterImpl withRouterProfiles(List routerProfiles) { + this.inner().withRouterProfiles(routerProfiles); + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OpenShiftManagedClusterInner.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OpenShiftManagedClusterInner.java new file mode 100644 index 000000000000..2141f9c309e2 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OpenShiftManagedClusterInner.java @@ -0,0 +1,271 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.management.containerservice.v2019_08_01.PurchasePlan; +import com.microsoft.azure.management.containerservice.v2019_08_01.NetworkProfile; +import java.util.List; +import com.microsoft.azure.management.containerservice.v2019_08_01.OpenShiftRouterProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.OpenShiftManagedClusterMasterPoolProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.OpenShiftManagedClusterAgentPoolProfile; +import com.microsoft.azure.management.containerservice.v2019_08_01.OpenShiftManagedClusterAuthProfile; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * OpenShift Managed cluster. + */ +@JsonFlatten +public class OpenShiftManagedClusterInner extends Resource { + /** + * Define the resource plan as required by ARM for billing purposes. + */ + @JsonProperty(value = "plan") + private PurchasePlan plan; + + /** + * The current deployment or provisioning state, which only appears in the + * response. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Version of OpenShift specified when creating the cluster. + */ + @JsonProperty(value = "properties.openShiftVersion", required = true) + private String openShiftVersion; + + /** + * Version of OpenShift specified when creating the cluster. + */ + @JsonProperty(value = "properties.clusterVersion", access = JsonProperty.Access.WRITE_ONLY) + private String clusterVersion; + + /** + * Service generated FQDN for OpenShift API server. + */ + @JsonProperty(value = "properties.publicHostname", access = JsonProperty.Access.WRITE_ONLY) + private String publicHostname; + + /** + * Service generated FQDN for OpenShift API server loadbalancer internal + * hostname. + */ + @JsonProperty(value = "properties.fqdn", access = JsonProperty.Access.WRITE_ONLY) + private String fqdn; + + /** + * Configuration for OpenShift networking. + */ + @JsonProperty(value = "properties.networkProfile") + private NetworkProfile networkProfile; + + /** + * Configuration for OpenShift router(s). + */ + @JsonProperty(value = "properties.routerProfiles") + private List routerProfiles; + + /** + * Configuration for OpenShift master VMs. + */ + @JsonProperty(value = "properties.masterPoolProfile") + private OpenShiftManagedClusterMasterPoolProfile masterPoolProfile; + + /** + * Configuration of OpenShift cluster VMs. + */ + @JsonProperty(value = "properties.agentPoolProfiles") + private List agentPoolProfiles; + + /** + * Configures OpenShift authentication. + */ + @JsonProperty(value = "properties.authProfile") + private OpenShiftManagedClusterAuthProfile authProfile; + + /** + * Get define the resource plan as required by ARM for billing purposes. + * + * @return the plan value + */ + public PurchasePlan plan() { + return this.plan; + } + + /** + * Set define the resource plan as required by ARM for billing purposes. + * + * @param plan the plan value to set + * @return the OpenShiftManagedClusterInner object itself. + */ + public OpenShiftManagedClusterInner withPlan(PurchasePlan plan) { + this.plan = plan; + return this; + } + + /** + * Get the current deployment or provisioning state, which only appears in the response. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get version of OpenShift specified when creating the cluster. + * + * @return the openShiftVersion value + */ + public String openShiftVersion() { + return this.openShiftVersion; + } + + /** + * Set version of OpenShift specified when creating the cluster. + * + * @param openShiftVersion the openShiftVersion value to set + * @return the OpenShiftManagedClusterInner object itself. + */ + public OpenShiftManagedClusterInner withOpenShiftVersion(String openShiftVersion) { + this.openShiftVersion = openShiftVersion; + return this; + } + + /** + * Get version of OpenShift specified when creating the cluster. + * + * @return the clusterVersion value + */ + public String clusterVersion() { + return this.clusterVersion; + } + + /** + * Get service generated FQDN for OpenShift API server. + * + * @return the publicHostname value + */ + public String publicHostname() { + return this.publicHostname; + } + + /** + * Get service generated FQDN for OpenShift API server loadbalancer internal hostname. + * + * @return the fqdn value + */ + public String fqdn() { + return this.fqdn; + } + + /** + * Get configuration for OpenShift networking. + * + * @return the networkProfile value + */ + public NetworkProfile networkProfile() { + return this.networkProfile; + } + + /** + * Set configuration for OpenShift networking. + * + * @param networkProfile the networkProfile value to set + * @return the OpenShiftManagedClusterInner object itself. + */ + public OpenShiftManagedClusterInner withNetworkProfile(NetworkProfile networkProfile) { + this.networkProfile = networkProfile; + return this; + } + + /** + * Get configuration for OpenShift router(s). + * + * @return the routerProfiles value + */ + public List routerProfiles() { + return this.routerProfiles; + } + + /** + * Set configuration for OpenShift router(s). + * + * @param routerProfiles the routerProfiles value to set + * @return the OpenShiftManagedClusterInner object itself. + */ + public OpenShiftManagedClusterInner withRouterProfiles(List routerProfiles) { + this.routerProfiles = routerProfiles; + return this; + } + + /** + * Get configuration for OpenShift master VMs. + * + * @return the masterPoolProfile value + */ + public OpenShiftManagedClusterMasterPoolProfile masterPoolProfile() { + return this.masterPoolProfile; + } + + /** + * Set configuration for OpenShift master VMs. + * + * @param masterPoolProfile the masterPoolProfile value to set + * @return the OpenShiftManagedClusterInner object itself. + */ + public OpenShiftManagedClusterInner withMasterPoolProfile(OpenShiftManagedClusterMasterPoolProfile masterPoolProfile) { + this.masterPoolProfile = masterPoolProfile; + return this; + } + + /** + * Get configuration of OpenShift cluster VMs. + * + * @return the agentPoolProfiles value + */ + public List agentPoolProfiles() { + return this.agentPoolProfiles; + } + + /** + * Set configuration of OpenShift cluster VMs. + * + * @param agentPoolProfiles the agentPoolProfiles value to set + * @return the OpenShiftManagedClusterInner object itself. + */ + public OpenShiftManagedClusterInner withAgentPoolProfiles(List agentPoolProfiles) { + this.agentPoolProfiles = agentPoolProfiles; + return this; + } + + /** + * Get configures OpenShift authentication. + * + * @return the authProfile value + */ + public OpenShiftManagedClusterAuthProfile authProfile() { + return this.authProfile; + } + + /** + * Set configures OpenShift authentication. + * + * @param authProfile the authProfile value to set + * @return the OpenShiftManagedClusterInner object itself. + */ + public OpenShiftManagedClusterInner withAuthProfile(OpenShiftManagedClusterAuthProfile authProfile) { + this.authProfile = authProfile; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OpenShiftManagedClustersImpl.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OpenShiftManagedClustersImpl.java new file mode 100644 index 000000000000..54b52a760d42 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OpenShiftManagedClustersImpl.java @@ -0,0 +1,138 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * def + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.containerservice.v2019_08_01.OpenShiftManagedClusters; +import com.microsoft.azure.management.containerservice.v2019_08_01.OpenShiftManagedCluster; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; + +class OpenShiftManagedClustersImpl extends GroupableResourcesCoreImpl implements OpenShiftManagedClusters { + protected OpenShiftManagedClustersImpl(ContainerServiceManager manager) { + super(manager.inner().openShiftManagedClusters(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + OpenShiftManagedClustersInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + OpenShiftManagedClustersInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + OpenShiftManagedClustersInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + OpenShiftManagedClustersInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public OpenShiftManagedCluster call(OpenShiftManagedClusterInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + OpenShiftManagedClustersInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + OpenShiftManagedClustersInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public OpenShiftManagedCluster call(OpenShiftManagedClusterInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public OpenShiftManagedClusterImpl define(String name) { + return wrapModel(name); + } + + @Override + protected OpenShiftManagedClusterImpl wrapModel(OpenShiftManagedClusterInner inner) { + return new OpenShiftManagedClusterImpl(inner.name(), inner, manager()); + } + + @Override + protected OpenShiftManagedClusterImpl wrapModel(String name) { + return new OpenShiftManagedClusterImpl(name, new OpenShiftManagedClusterInner(), this.manager()); + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OpenShiftManagedClustersInner.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OpenShiftManagedClustersInner.java new file mode 100644 index 000000000000..40a9fd1fae0c --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OpenShiftManagedClustersInner.java @@ -0,0 +1,1328 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.containerservice.v2019_08_01.TagsObject; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in OpenShiftManagedClusters. + */ +public class OpenShiftManagedClustersInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private OpenShiftManagedClustersService service; + /** The service client containing this operation class. */ + private ContainerServiceManagementClientImpl client; + + /** + * Initializes an instance of OpenShiftManagedClustersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OpenShiftManagedClustersInner(Retrofit retrofit, ContainerServiceManagementClientImpl client) { + this.service = retrofit.create(OpenShiftManagedClustersService.class); + this.client = client; + } + + /** + * The interface defining all the services for OpenShiftManagedClusters to be + * used by Retrofit to perform actually REST calls. + */ + interface OpenShiftManagedClustersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.OpenShiftManagedClusters list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/openShiftManagedClusters") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.OpenShiftManagedClusters listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters") + Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.OpenShiftManagedClusters getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.OpenShiftManagedClusters createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Body OpenShiftManagedClusterInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.OpenShiftManagedClusters beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Body OpenShiftManagedClusterInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.OpenShiftManagedClusters updateTags" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") + Observable> updateTags(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TagsObject parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.OpenShiftManagedClusters beginUpdateTags" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}") + Observable> beginUpdateTags(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TagsObject parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.OpenShiftManagedClusters delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.OpenShiftManagedClusters beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/openShiftManagedClusters/{resourceName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.OpenShiftManagedClusters listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.OpenShiftManagedClusters listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of OpenShift managed clusters in the specified subscription. + * Gets a list of OpenShift managed clusters in the specified subscription. The operation returns properties of each OpenShift managed cluster. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OpenShiftManagedClusterInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of OpenShift managed clusters in the specified subscription. + * Gets a list of OpenShift managed clusters in the specified subscription. The operation returns properties of each OpenShift managed cluster. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of OpenShift managed clusters in the specified subscription. + * Gets a list of OpenShift managed clusters in the specified subscription. The operation returns properties of each OpenShift managed cluster. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OpenShiftManagedClusterInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of OpenShift managed clusters in the specified subscription. + * Gets a list of OpenShift managed clusters in the specified subscription. The operation returns properties of each OpenShift managed cluster. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OpenShiftManagedClusterInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of OpenShift managed clusters in the specified subscription. + * Gets a list of OpenShift managed clusters in the specified subscription. The operation returns properties of each OpenShift managed cluster. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OpenShiftManagedClusterInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-04-30"; + return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists OpenShift managed clusters in the specified subscription and resource group. + * Lists OpenShift managed clusters in the specified subscription and resource group. The operation returns properties of each OpenShift managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OpenShiftManagedClusterInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists OpenShift managed clusters in the specified subscription and resource group. + * Lists OpenShift managed clusters in the specified subscription and resource group. The operation returns properties of each OpenShift managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists OpenShift managed clusters in the specified subscription and resource group. + * Lists OpenShift managed clusters in the specified subscription and resource group. The operation returns properties of each OpenShift managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OpenShiftManagedClusterInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists OpenShift managed clusters in the specified subscription and resource group. + * Lists OpenShift managed clusters in the specified subscription and resource group. The operation returns properties of each OpenShift managed cluster. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OpenShiftManagedClusterInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists OpenShift managed clusters in the specified subscription and resource group. + * Lists OpenShift managed clusters in the specified subscription and resource group. The operation returns properties of each OpenShift managed cluster. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OpenShiftManagedClusterInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + final String apiVersion = "2019-04-30"; + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a OpenShift managed cluster. + * Gets the details of the managed OpenShift cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OpenShiftManagedClusterInner object if successful. + */ + public OpenShiftManagedClusterInner getByResourceGroup(String resourceGroupName, String resourceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Gets a OpenShift managed cluster. + * Gets the details of the managed OpenShift cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Gets a OpenShift managed cluster. + * Gets the details of the managed OpenShift cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OpenShiftManagedClusterInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String resourceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, OpenShiftManagedClusterInner>() { + @Override + public OpenShiftManagedClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a OpenShift managed cluster. + * Gets the details of the managed OpenShift cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OpenShiftManagedClusterInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String resourceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + final String apiVersion = "2019-04-30"; + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates an OpenShift managed cluster. + * Creates or updates a OpenShift managed cluster with the specified configuration for agents and OpenShift version. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @param parameters Parameters supplied to the Create or Update an OpenShift Managed Cluster operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OpenShiftManagedClusterInner object if successful. + */ + public OpenShiftManagedClusterInner createOrUpdate(String resourceGroupName, String resourceName, OpenShiftManagedClusterInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates an OpenShift managed cluster. + * Creates or updates a OpenShift managed cluster with the specified configuration for agents and OpenShift version. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @param parameters Parameters supplied to the Create or Update an OpenShift Managed Cluster operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String resourceName, OpenShiftManagedClusterInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters), serviceCallback); + } + + /** + * Creates or updates an OpenShift managed cluster. + * Creates or updates a OpenShift managed cluster with the specified configuration for agents and OpenShift version. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @param parameters Parameters supplied to the Create or Update an OpenShift Managed Cluster operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String resourceName, OpenShiftManagedClusterInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1, OpenShiftManagedClusterInner>() { + @Override + public OpenShiftManagedClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an OpenShift managed cluster. + * Creates or updates a OpenShift managed cluster with the specified configuration for agents and OpenShift version. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @param parameters Parameters supplied to the Create or Update an OpenShift Managed Cluster operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String resourceName, OpenShiftManagedClusterInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2019-04-30"; + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates an OpenShift managed cluster. + * Creates or updates a OpenShift managed cluster with the specified configuration for agents and OpenShift version. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @param parameters Parameters supplied to the Create or Update an OpenShift Managed Cluster operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OpenShiftManagedClusterInner object if successful. + */ + public OpenShiftManagedClusterInner beginCreateOrUpdate(String resourceGroupName, String resourceName, OpenShiftManagedClusterInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an OpenShift managed cluster. + * Creates or updates a OpenShift managed cluster with the specified configuration for agents and OpenShift version. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @param parameters Parameters supplied to the Create or Update an OpenShift Managed Cluster operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String resourceName, OpenShiftManagedClusterInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters), serviceCallback); + } + + /** + * Creates or updates an OpenShift managed cluster. + * Creates or updates a OpenShift managed cluster with the specified configuration for agents and OpenShift version. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @param parameters Parameters supplied to the Create or Update an OpenShift Managed Cluster operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OpenShiftManagedClusterInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String resourceName, OpenShiftManagedClusterInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1, OpenShiftManagedClusterInner>() { + @Override + public OpenShiftManagedClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an OpenShift managed cluster. + * Creates or updates a OpenShift managed cluster with the specified configuration for agents and OpenShift version. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @param parameters Parameters supplied to the Create or Update an OpenShift Managed Cluster operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OpenShiftManagedClusterInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String resourceName, OpenShiftManagedClusterInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2019-04-30"; + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates tags on an OpenShift managed cluster. + * Updates an OpenShift managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OpenShiftManagedClusterInner object if successful. + */ + public OpenShiftManagedClusterInner updateTags(String resourceGroupName, String resourceName) { + return updateTagsWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().last().body(); + } + + /** + * Updates tags on an OpenShift managed cluster. + * Updates an OpenShift managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateTagsAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateTagsWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Updates tags on an OpenShift managed cluster. + * Updates an OpenShift managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateTagsAsync(String resourceGroupName, String resourceName) { + return updateTagsWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, OpenShiftManagedClusterInner>() { + @Override + public OpenShiftManagedClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates tags on an OpenShift managed cluster. + * Updates an OpenShift managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateTagsWithServiceResponseAsync(String resourceGroupName, String resourceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + final String apiVersion = "2019-04-30"; + final Map tags = null; + TagsObject parameters = new TagsObject(); + parameters.withTags(null); + Observable> observable = service.updateTags(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Updates tags on an OpenShift managed cluster. + * Updates an OpenShift managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OpenShiftManagedClusterInner object if successful. + */ + public OpenShiftManagedClusterInner updateTags(String resourceGroupName, String resourceName, Map tags) { + return updateTagsWithServiceResponseAsync(resourceGroupName, resourceName, tags).toBlocking().last().body(); + } + + /** + * Updates tags on an OpenShift managed cluster. + * Updates an OpenShift managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @param tags Resource tags. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateTagsAsync(String resourceGroupName, String resourceName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateTagsWithServiceResponseAsync(resourceGroupName, resourceName, tags), serviceCallback); + } + + /** + * Updates tags on an OpenShift managed cluster. + * Updates an OpenShift managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateTagsAsync(String resourceGroupName, String resourceName, Map tags) { + return updateTagsWithServiceResponseAsync(resourceGroupName, resourceName, tags).map(new Func1, OpenShiftManagedClusterInner>() { + @Override + public OpenShiftManagedClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates tags on an OpenShift managed cluster. + * Updates an OpenShift managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateTagsWithServiceResponseAsync(String resourceGroupName, String resourceName, Map tags) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + Validator.validate(tags); + final String apiVersion = "2019-04-30"; + TagsObject parameters = new TagsObject(); + parameters.withTags(tags); + Observable> observable = service.updateTags(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates tags on an OpenShift managed cluster. + * Updates an OpenShift managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OpenShiftManagedClusterInner object if successful. + */ + public OpenShiftManagedClusterInner beginUpdateTags(String resourceGroupName, String resourceName) { + return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Updates tags on an OpenShift managed cluster. + * Updates an OpenShift managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateTagsAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateTagsWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Updates tags on an OpenShift managed cluster. + * Updates an OpenShift managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OpenShiftManagedClusterInner object + */ + public Observable beginUpdateTagsAsync(String resourceGroupName, String resourceName) { + return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, OpenShiftManagedClusterInner>() { + @Override + public OpenShiftManagedClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates tags on an OpenShift managed cluster. + * Updates an OpenShift managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OpenShiftManagedClusterInner object + */ + public Observable> beginUpdateTagsWithServiceResponseAsync(String resourceGroupName, String resourceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + final String apiVersion = "2019-04-30"; + final Map tags = null; + TagsObject parameters = new TagsObject(); + parameters.withTags(null); + return service.beginUpdateTags(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateTagsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates tags on an OpenShift managed cluster. + * Updates an OpenShift managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OpenShiftManagedClusterInner object if successful. + */ + public OpenShiftManagedClusterInner beginUpdateTags(String resourceGroupName, String resourceName, Map tags) { + return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, resourceName, tags).toBlocking().single().body(); + } + + /** + * Updates tags on an OpenShift managed cluster. + * Updates an OpenShift managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @param tags Resource tags. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateTagsAsync(String resourceGroupName, String resourceName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateTagsWithServiceResponseAsync(resourceGroupName, resourceName, tags), serviceCallback); + } + + /** + * Updates tags on an OpenShift managed cluster. + * Updates an OpenShift managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OpenShiftManagedClusterInner object + */ + public Observable beginUpdateTagsAsync(String resourceGroupName, String resourceName, Map tags) { + return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, resourceName, tags).map(new Func1, OpenShiftManagedClusterInner>() { + @Override + public OpenShiftManagedClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates tags on an OpenShift managed cluster. + * Updates an OpenShift managed cluster with the specified tags. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OpenShiftManagedClusterInner object + */ + public Observable> beginUpdateTagsWithServiceResponseAsync(String resourceGroupName, String resourceName, Map tags) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + Validator.validate(tags); + final String apiVersion = "2019-04-30"; + TagsObject parameters = new TagsObject(); + parameters.withTags(tags); + return service.beginUpdateTags(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateTagsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateTagsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes an OpenShift managed cluster. + * Deletes the OpenShift managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String resourceName) { + deleteWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().last().body(); + } + + /** + * Deletes an OpenShift managed cluster. + * Deletes the OpenShift managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Deletes an OpenShift managed cluster. + * Deletes the OpenShift managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String resourceName) { + return deleteWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an OpenShift managed cluster. + * Deletes the OpenShift managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String resourceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + final String apiVersion = "2019-04-30"; + Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an OpenShift managed cluster. + * Deletes the OpenShift managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String resourceName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Deletes an OpenShift managed cluster. + * Deletes the OpenShift managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Deletes an OpenShift managed cluster. + * Deletes the OpenShift managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String resourceName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an OpenShift managed cluster. + * Deletes the OpenShift managed cluster with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. + * @param resourceName The name of the OpenShift managed cluster resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String resourceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + final String apiVersion = "2019-04-30"; + return service.beginDelete(this.client.subscriptionId(), resourceGroupName, resourceName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of OpenShift managed clusters in the specified subscription. + * Gets a list of OpenShift managed clusters in the specified subscription. The operation returns properties of each OpenShift managed cluster. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OpenShiftManagedClusterInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of OpenShift managed clusters in the specified subscription. + * Gets a list of OpenShift managed clusters in the specified subscription. The operation returns properties of each OpenShift managed cluster. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of OpenShift managed clusters in the specified subscription. + * Gets a list of OpenShift managed clusters in the specified subscription. The operation returns properties of each OpenShift managed cluster. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OpenShiftManagedClusterInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of OpenShift managed clusters in the specified subscription. + * Gets a list of OpenShift managed clusters in the specified subscription. The operation returns properties of each OpenShift managed cluster. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OpenShiftManagedClusterInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of OpenShift managed clusters in the specified subscription. + * Gets a list of OpenShift managed clusters in the specified subscription. The operation returns properties of each OpenShift managed cluster. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OpenShiftManagedClusterInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists OpenShift managed clusters in the specified subscription and resource group. + * Lists OpenShift managed clusters in the specified subscription and resource group. The operation returns properties of each OpenShift managed cluster. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OpenShiftManagedClusterInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists OpenShift managed clusters in the specified subscription and resource group. + * Lists OpenShift managed clusters in the specified subscription and resource group. The operation returns properties of each OpenShift managed cluster. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists OpenShift managed clusters in the specified subscription and resource group. + * Lists OpenShift managed clusters in the specified subscription and resource group. The operation returns properties of each OpenShift managed cluster. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OpenShiftManagedClusterInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists OpenShift managed clusters in the specified subscription and resource group. + * Lists OpenShift managed clusters in the specified subscription and resource group. The operation returns properties of each OpenShift managed cluster. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OpenShiftManagedClusterInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists OpenShift managed clusters in the specified subscription and resource group. + * Lists OpenShift managed clusters in the specified subscription and resource group. The operation returns properties of each OpenShift managed cluster. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OpenShiftManagedClusterInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OperationValueImpl.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OperationValueImpl.java new file mode 100644 index 000000000000..07eea73a4c69 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OperationValueImpl.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.management.containerservice.v2019_08_01.OperationValue; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class OperationValueImpl extends WrapperImpl implements OperationValue { + private final ContainerServiceManager manager; + OperationValueImpl(OperationValueInner inner, ContainerServiceManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ContainerServiceManager manager() { + return this.manager; + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String operation() { + return this.inner().operation(); + } + + @Override + public String origin() { + return this.inner().origin(); + } + + @Override + public String provider() { + return this.inner().provider(); + } + + @Override + public String resource() { + return this.inner().resource(); + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OperationValueInner.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OperationValueInner.java new file mode 100644 index 000000000000..db8a8cfeec60 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OperationValueInner.java @@ -0,0 +1,109 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Describes the properties of a Compute Operation value. + */ +@JsonFlatten +public class OperationValueInner { + /** + * The origin of the compute operation. + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private String origin; + + /** + * The name of the compute operation. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The display name of the compute operation. + */ + @JsonProperty(value = "display.operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * The display name of the resource the operation applies to. + */ + @JsonProperty(value = "display.resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * The description of the operation. + */ + @JsonProperty(value = "display.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * The resource provider for the operation. + */ + @JsonProperty(value = "display.provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Get the origin of the compute operation. + * + * @return the origin value + */ + public String origin() { + return this.origin; + } + + /** + * Get the name of the compute operation. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the display name of the compute operation. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Get the display name of the resource the operation applies to. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get the description of the operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Get the resource provider for the operation. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OperationsImpl.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OperationsImpl.java new file mode 100644 index 000000000000..3ecf4c68e9e1 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.containerservice.v2019_08_01.Operations; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.containerservice.v2019_08_01.OperationValue; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ContainerServiceManager manager; + + OperationsImpl(ContainerServiceManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ContainerServiceManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public OperationValue call(OperationValueInner inner) { + return new OperationValueImpl(inner, manager()); + } + }); + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OperationsInner.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OperationsInner.java new file mode 100644 index 000000000000..8f85d620fb1a --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OperationsInner.java @@ -0,0 +1,132 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private ContainerServiceManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, ContainerServiceManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerservice.v2019_08_01.Operations list" }) + @GET("providers/Microsoft.ContainerService/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of compute operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<OperationValueInner> object if successful. + */ + public List list() { + return listWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Gets a list of compute operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Gets a list of compute operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<OperationValueInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of compute operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<OperationValueInner> object + */ + public Observable>> listWithServiceResponseAsync() { + final String apiVersion = "2019-08-01"; + return service.list(apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OrchestratorVersionProfileListResultImpl.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OrchestratorVersionProfileListResultImpl.java new file mode 100644 index 000000000000..d049663917b4 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OrchestratorVersionProfileListResultImpl.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.microsoft.azure.management.containerservice.v2019_08_01.OrchestratorVersionProfileListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.containerservice.v2019_08_01.OrchestratorVersionProfile; + +class OrchestratorVersionProfileListResultImpl extends WrapperImpl implements OrchestratorVersionProfileListResult { + private final ContainerServiceManager manager; + OrchestratorVersionProfileListResultImpl(OrchestratorVersionProfileListResultInner inner, ContainerServiceManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ContainerServiceManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List orchestrators() { + return this.inner().orchestrators(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OrchestratorVersionProfileListResultInner.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OrchestratorVersionProfileListResultInner.java new file mode 100644 index 000000000000..59e7ab97b7b2 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/OrchestratorVersionProfileListResultInner.java @@ -0,0 +1,92 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.containerservice.v2019_08_01.OrchestratorVersionProfile; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The list of versions for supported orchestrators. + */ +@JsonFlatten +public class OrchestratorVersionProfileListResultInner { + /** + * Id of the orchestrator version profile list result. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Name of the orchestrator version profile list result. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Type of the orchestrator version profile list result. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * List of orchestrator version profiles. + */ + @JsonProperty(value = "properties.orchestrators", required = true) + private List orchestrators; + + /** + * Get id of the orchestrator version profile list result. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get name of the orchestrator version profile list result. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get type of the orchestrator version profile list result. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get list of orchestrator version profiles. + * + * @return the orchestrators value + */ + public List orchestrators() { + return this.orchestrators; + } + + /** + * Set list of orchestrator version profiles. + * + * @param orchestrators the orchestrators value to set + * @return the OrchestratorVersionProfileListResultInner object itself. + */ + public OrchestratorVersionProfileListResultInner withOrchestrators(List orchestrators) { + this.orchestrators = orchestrators; + return this; + } + +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/PageImpl.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/PageImpl.java new file mode 100644 index 000000000000..d291fbadd8de --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/PageImpl1.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/PageImpl1.java new file mode 100644 index 000000000000..018f1453cce0 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/package-info.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/package-info.java new file mode 100644 index 000000000000..1caa785eb82b --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for ContainerServiceManagementClient. + * Container Service Client. + */ +package com.microsoft.azure.management.containerservice.v2019_08_01.implementation; diff --git a/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/package-info.java b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/package-info.java new file mode 100644 index 000000000000..947522c7a347 --- /dev/null +++ b/containerservice/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for ContainerServiceManagementClient. + * Container Service Client. + */ +package com.microsoft.azure.management.containerservice.v2019_08_01; diff --git a/cosmosdb/data-plane/.github/ISSUE_TEMPLATE/Bug_report.md b/cosmosdb/data-plane/.github/ISSUE_TEMPLATE/Bug_report.md deleted file mode 100644 index 7531bf124a13..000000000000 --- a/cosmosdb/data-plane/.github/ISSUE_TEMPLATE/Bug_report.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -name: "Bug report" -about: Create a report to help us improve - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior. - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Actual behavior** -Provide a description of the actual behavior observed. - -**Environment summary** -SDK Version: -Java JDK version: -OS Version (e.g. Windows, Linux, MacOSX) - -**Additional context** -Add any other context about the problem here. diff --git a/cosmosdb/data-plane/.gitignore b/cosmosdb/data-plane/.gitignore deleted file mode 100644 index bdb262af0bac..000000000000 --- a/cosmosdb/data-plane/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -*.class -target - -# Package Files # -*.jar - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* - -# MacOS files # -.DS_Store - -# IDE files # -.project -.settings -.classpath -.idea -*.iml - -doc -docs diff --git a/cosmosdb/data-plane/.travis.yml b/cosmosdb/data-plane/.travis.yml deleted file mode 100644 index 02ba5c532eaf..000000000000 --- a/cosmosdb/data-plane/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: java -sudo: false # faster builds - -matrix: - include: - - os: linux - jdk: oraclejdk8 -# - os: osx -# osx_image: xcode8 -script: -- mvn dependency:resolve -- mvn test -P fast -DargLine="-DACCOUNT_HOST=$ACCOUNT_HOST -DACCOUNT_KEY=$ACCOUNT_KEY" cobertura:cobertura -after_success: - - bash <(curl -s https://codecov.io/bash) - -cache: - directories: - - $HOME/.m2 diff --git a/cosmosdb/data-plane/CODEOWNERS b/cosmosdb/data-plane/CODEOWNERS deleted file mode 100644 index 26da20e9f2cf..000000000000 --- a/cosmosdb/data-plane/CODEOWNERS +++ /dev/null @@ -1,10 +0,0 @@ -# CODEOWNERS is a GitHub standard to specify who is automatically assigned pull requests to review. -# This helps to prevent pull requests from languishing without review. -# GitHub can also be configured to require review from code owners before a pull request can be merged. - -# Further reading is available from the following two URLs: -# https://blog.github.com/2017-07-06-introducing-code-owners/ -# https://help.github.com/articles/about-codeowners/ - -# Default owner for repo -* @moderakh @christopheranderson @kushagraThapar diff --git a/cosmosdb/data-plane/LICENSE b/cosmosdb/data-plane/LICENSE deleted file mode 100644 index 21071075c245..000000000000 --- a/cosmosdb/data-plane/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. All rights reserved. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE diff --git a/cosmosdb/data-plane/README.md b/cosmosdb/data-plane/README.md deleted file mode 100644 index 19399df1e3db..000000000000 --- a/cosmosdb/data-plane/README.md +++ /dev/null @@ -1,301 +0,0 @@ -## Java SDK for SQL API of Azure Cosmos DB -[![Maven Central](https://img.shields.io/maven-central/v/com.microsoft.azure/azure-cosmosdb.svg)](https://search.maven.org/artifact/com.microsoft.azure/azure-cosmosdb/2.4.3/jar) -[![Build Status](https://api.travis-ci.org/Azure/azure-cosmosdb-java.svg?branch=master)](https://travis-ci.org/Azure/azure-cosmosdb-java) -[![Known Vulnerabilities](https://snyk.io/test/github/Azure/azure-cosmosdb-java/badge.svg?targetFile=sdk%2Fpom.xml)](https://snyk.io/test/github/Azure/azure-cosmosdb-java?targetFile=sdk%2Fpom.xml) - - - - -- [Consuming the official Microsoft Azure Cosmos DB Java SDK](#consuming-the-official-microsoft-azure-cosmos-db-java-sdk) -- [Prerequisites](#prerequisites) -- [API Documentation](#api-documentation) -- [Usage Code Sample](#usage-code-sample) -- [Guide for Prod](#guide-for-prod) -- [Future, CompletableFuture, and ListenableFuture](#future-completablefuture-and-listenablefuture) -- [Checking out the Source Code](#checking-out-the-source-code) -- [FAQ](#faq) -- [Release changes](#release-changes) -- [Contribution and Feedback](#contribution-and-feedback) -- [License](#license) - - - - -## Consuming the official Microsoft Azure Cosmos DB Java SDK - -This project provides a SDK library in Java for interacting with [SQL API](https://docs.microsoft.com/en-us/azure/cosmos-db/sql-api-sql-query) of [Azure Cosmos DB -Database Service](https://azure.microsoft.com/en-us/services/cosmos-db/). This project also includes samples, tools, and utilities. - -Jar dependency binary information for maven and gradle can be found here at [maven]( https://mvnrepository.com/artifact/com.microsoft.azure/azure-cosmosdb/2.4.3). - -For example, using maven, you can add the following dependency to your maven pom file: - -```xml - - com.microsoft.azure - azure-cosmosdb - 2.4.3 - -``` - - - -Useful links: -- [Sample Get Started APP](https://github.com/Azure-Samples/azure-cosmos-db-sql-api-async-java-getting-started) -- [Introduction to Resource Model of Azure Cosmos DB Service]( https://docs.microsoft.com/en-us/azure/cosmos-db/sql-api-resources) -- [Introduction to SQL API of Azure Cosmos DB Service](https://docs.microsoft.com/en-us/azure/cosmos-db/sql-api-sql-query) -- [SDK JavaDoc API](https://azure.github.io/azure-cosmosdb-java/2.4.0/com/microsoft/azure/cosmosdb/rx/AsyncDocumentClient.html) -- [RxJava Observable JavaDoc API](http://reactivex.io/RxJava/1.x/javadoc/rx/Observable.html) -- [SDK FAQ](faq/) - -## Prerequisites -* Java Development Kit 8 -* An active Azure account. If you don't have one, you can sign up for a [free account](https://azure.microsoft.com/free/). Alternatively, you can use the [Azure Cosmos DB Emulator](https://azure.microsoft.com/documentation/articles/documentdb-nosql-local-emulator) for development and testing. As emulator https certificate is self signed, you need to import its certificate to java trusted cert store as [explained here](https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator-export-ssl-certificates) -* (Optional) SLF4J is a logging facade. -* (Optional) [SLF4J binding](http://www.slf4j.org/manual.html) is used to associate a specific logging framework with SLF4J. -* (Optional) Maven - -SLF4J is only needed if you plan to use logging, please also download an SLF4J binding which will link the SLF4J API with the logging implementation of your choice. See the [SLF4J user manual](http://www.slf4j.org/manual.html) for more information. - - -## API Documentation -Javadoc is available [here](https://azure.github.io/azure-cosmosdb-java/2.4.0/com/microsoft/azure/cosmosdb/rx/AsyncDocumentClient.html). - -The SDK provide Reactive Extension Observable based async API. You can read more about RxJava and [Observable APIs here](http://reactivex.io/RxJava/1.x/javadoc/rx/Observable.html). - - -## Usage Code Sample - -Code Sample for creating a Document: -```java -import com.microsoft.azure.cosmosdb.rx.*; -import com.microsoft.azure.cosmosdb.*; - -ConnectionPolicy policy = new ConnectionPolicy(); -policy.setConnectionMode(ConnectionMode.Direct); - -AsyncDocumentClient asyncClient = new AsyncDocumentClient.Builder() - .withServiceEndpoint(HOST) - .withMasterKeyOrResourceToken(MASTER_KEY) - .withConnectionPolicy(policy) - .withConsistencyLevel(ConsistencyLevel.Eventual) - .build(); - -Document doc = new Document(String.format("{ 'id': 'doc%d', 'counter': '%d'}", 1, 1)); - -Observable> createDocumentObservable = - asyncClient.createDocument(collectionLink, doc, null, false); - createDocumentObservable - .single() // we know there will be one response - .subscribe( - - documentResourceResponse -> { - System.out.println(documentResourceResponse.getRequestCharge()); - }, - - error -> { - System.err.println("an error happened: " + error.getMessage()); - }); -``` - -We have a get started sample app available [here](https://github.com/Azure-Samples/azure-cosmos-db-sql-api-async-java-getting-started). - -Also We have more examples in form of standalone unit tests in [examples project](examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples). - - -## Guide for Prod -To achieve better performance and higher throughput there are a few tips that are helpful to follow: - -### Use Appropriate Scheduler (Avoid stealing Eventloop IO Netty threads) -SDK uses [netty](https://netty.io/) for non-blocking IO. The SDK uses a fixed number of IO netty eventloop threads (as many CPU cores your machine has) for executing IO operations. - - The Observable returned by API emits the result on one of the shared IO eventloop netty threads. So it is important to not block the shared IO eventloop netty threads. Doing CPU intensive work or blocking operation on the IO eventloop netty thread may cause deadlock or significantly reduce SDK throughput. - -For example the following code executes a cpu intensive work on the eventloop IO netty thread: - - -```java -Observable> createDocObs = asyncDocumentClient.createDocument( - collectionLink, document, null, true); - -createDocObs.subscribe( - resourceResponse -> { - //this is executed on eventloop IO netty thread. - //the eventloop thread is shared and is meant to return back quickly. - // - // DON'T do this on eventloop IO netty thread. - veryCpuIntensiveWork(); - }); - -``` - -After result is received if you want to do CPU intensive work on the result you should avoid doing so on eventloop IO netty thread. You can instead provide your own Scheduler to provide your own thread for running your work. - -```java -import rx.schedulers; - -Observable> createDocObs = asyncDocumentClient.createDocument( - collectionLink, document, null, true); - -createDocObs.subscribeOn(Schedulers.computation()) -subscribe( - resourceResponse -> { - // this is executed on threads provided by Scheduler.computation() - // Schedulers.computation() should be used only the work is cpu intensive and you are not doing blocking IO, thread sleep, etc. in this thread against other resources. - veryCpuIntensiveWork(); - }); - -``` - -Based on the type of your work you should use the appropriate existing RxJava Scheduler for your work. Please read here -[``Schedulers``](http://reactivex.io/RxJava/1.x/javadoc/rx/schedulers/Schedulers.html). - - -### Disable netty's logging -Netty library logging is very chatty and need to be turned off (suppressing log in the configuration may not be enough) to avoid additional CPU costs. -If you are not in debugging mode disable netty's logging altogether. So if you are using log4j to remove the additional CPU costs incurred by ``org.apache.log4j.Category.callAppenders()`` from netty add the following line to your codebase: - -```java -org.apache.log4j.Logger.getLogger("io.netty").setLevel(org.apache.log4j.Level.OFF); -``` - -### OS Open files Resource Limit -Some Linux systems (like Redhat) have an upper limit on the number of open files and so the total number of connections. Run the following to view the current limits: - -```bash -ulimit -a -``` - -The number of open files (nofile) need to be large enough to have enough room for your configured connection pool size and other open files by the OS. It can be modified to allow for a larger connection pool size. - -Open the limits.conf file: - -```bash -vim /etc/security/limits.conf -``` -Add/modify the following lines: - -``` -* - nofile 100000 -``` - -### Use native SSL implementation for netty -Netty can use OpenSSL directly for SSL implementation stack to achieve better performance. -In the absence of this configuration netty will fall back to Java's default SSL implementation. - -on Ubuntu: -```bash -sudo apt-get install openssl -sudo apt-get install libapr1 -``` - -and add the following dependency to your project maven dependencies: -```xml - - io.netty - netty-tcnative - 2.0.20.Final - linux-x86_64 - -``` - -For other platforms (Redhat, Windows, Mac, etc) please refer to these instructions https://netty.io/wiki/forked-tomcat-native.html - -### Common Perf Tips -There is a set of common perf tips written for our sync SDK. The majority of them also apply to the async SDK. It is available [here](https://docs.microsoft.com/en-us/azure/cosmos-db/performance-tips-java). - -## Future, CompletableFuture, and ListenableFuture - -The SDK provide Reactive Extension (Rx) [Observable](http://reactivex.io/RxJava/1.x/javadoc/rx/Observable.html) based async API. - - -RX API has advantages over Future based APIs. But if you wish to use ``Future`` you can translate Observables to Java native Futures: - -```java -// You can convert an Observable to a ListenableFuture. -// ListenableFuture (part of google guava library) is a popular extension -// of Java's Future which allows registering listener callbacks: -// https://github.com/google/guava/wiki/ListenableFutureExplained - -import rx.observable.ListenableFutureObservable; - -Observable> createDocObservable = asyncClient.createDocument( - collectionLink, document, null, false); - -// NOTE: if you are going to do CPU intensive work -// on the result thread consider changing the scheduler see Use Proper Scheduler -// (Avoid Stealing Eventloop IO Netty threads) section -ListenableFuture> listenableFuture = - ListenableFutureObservable.to(createDocObservable); - -ResourceResponse rrd = listenableFuture.get(); -``` - -For this to work you will need [RxJava Guava library dependency ](https://mvnrepository.com/artifact/io.reactivex/rxjava-guava/1.0.3). More information available here https://github.com/ReactiveX/RxJavaGuava. - -You can see more details on how to convert Observables to Futures here: -https://dzone.com/articles/converting-between - -## Checking out the Source Code -The SDK is open source and is available here [sdk](sdk/). - - Clone the Repo -```bash -git clone https://github.com/Azure/azure-cosmosdb-java.git -cd azure-cosmosdb-java -``` - -### How to Build from Command Line - -* Run the following maven command to build: - -```bash -maven clean package -DskipTests -``` - -#### Running Tests from Command Line - -Running tests require Azure Cosmos DB Endpoint credentials: - -```bash -mvn test -DACCOUNT_HOST="https://REPLACE_ME_WITH_YOURS.documents.azure.com:443/" -DACCOUNT_KEY="REPLACE_ME_WITH_YOURS" -``` - -### Import into Intellij or Eclipse - -* Load the main parent project pom file in Intellij/Eclipse (That should automatically load examples). -* For running the samples you need a proper Azure Cosmos DB Endpoint. The endpoints are picked up from [TestConfigurations.java](examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/TestConfigurations.java). There is a similar endpoint config file for the sdk tests [here](sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TestConfigurations.java). -* You can pass your endpoint credentials as VM Arguments in Eclipse JUnit Run Config: -```bash - -DACCOUNT_HOST="https://REPLACE_ME.documents.azure.com:443/" -DACCOUNT_KEY="REPLACE_ME" - ``` -* or you can simply put your endpoint credentials in TestConfigurations.java -* The SDK tests are written using TestNG framework, if you use Eclipse you may have to - add TestNG plugin to your eclipse IDE as explained [here](http://testng.org/doc/eclipse.html). - Intellij has builtin support for TestNG. -* Now you can run the tests in your Intellij/Eclipse IDE. - - -## FAQ -We have a frequently asked questions which is maintained [here](faq/). - -## Release changes -Release changelog is available [here](changelog/). - - -## Contribution and Feedback - -This is an open source project and we welcome contributions. - -If you would like to become an active contributor to this project please follow the instructions provided in [Azure Projects Contribution Guidelines](http://azure.github.io/guidelines/). - -We have [travis build CI](https://travis-ci.org/Azure/azure-cosmosdb-java) which should pass for any PR. - -If you encounter any bugs with the SDK please file an [issue](https://github.com/Azure/azure-cosmosdb-java/issues) in the Issues section of the project. - - -## License -MIT License -Copyright (c) 2018 Copyright (c) Microsoft Corporation diff --git a/cosmosdb/data-plane/benchmark/README.md b/cosmosdb/data-plane/benchmark/README.md deleted file mode 100644 index 4f7aadcc7796..000000000000 --- a/cosmosdb/data-plane/benchmark/README.md +++ /dev/null @@ -1,81 +0,0 @@ -# Benchmark tool - -## Build the benchmarking tool - -```bash -git clone https://github.com/Azure/azure-cosmosdb-java.git -cd azure-cosmosdb-java - -mvn clean package -DskipTests -``` - -and then the package will be generated. - -## Run the WriteLatency workload - -```bash -java -jar benchmark/target/azure-cosmosdb-benchmark-2.4.1-SNAPSHOT-jar-with-dependencies.jar \ - -serviceEndpoint $endpoint -masterKey $masterkey \ - -databaseId $dbname -collectionId $colname \ - -consistencyLevel Eventual -concurrency 10 -numberOfOperations 1000000 \ - -operation WriteLatency -connectionMode Direct -``` - -## Sample Report: - -``` -2/13/19 9:32:39 PM ============================================================= - --- Meters ---------------------------------------------------------------------- -#Successful Operations - count = 89934 - mean rate = 1798.56 events/second - 1-minute rate = 1718.45 events/second - 5-minute rate = 1630.17 events/second - 15-minute rate = 1610.01 events/second -#Unsuccessful Operations - count = 0 - mean rate = 0.00 events/second - 1-minute rate = 0.00 events/second - 5-minute rate = 0.00 events/second - 15-minute rate = 0.00 events/second - --- Timers ---------------------------------------------------------------------- -Latency - count = 89938 - mean rate = 1798.64 calls/second - 1-minute rate = 1718.65 calls/second - 5-minute rate = 1630.37 calls/second - 15-minute rate = 1610.21 calls/second - min = 3.97 milliseconds - max = 22.81 milliseconds - mean = 5.37 milliseconds - stddev = 0.96 milliseconds - median = 5.26 milliseconds - 75% <= 5.70 milliseconds - 95% <= 6.40 milliseconds - 98% <= 6.93 milliseconds - 99% <= 7.51 milliseconds - 99.9% <= 17.37 milliseconds -``` - -## Other Currently Supported Workloads - -* ReadLatency, -* WriteLatency, -* ReadThroughput, -* WriteThroughput, -* QueryCross, -* QuerySingle, -* QuerySingleMany, -* QueryParallel, -* QueryOrderby, -* QueryAggregate, -* QueryAggregateTopOrderby, -* QueryTopOrderby, -* Mixed -* ReadMyWrites - - -You can provide ``--help`` to the tool to see the list of other work loads (read, etc) and other options. - diff --git a/cosmosdb/data-plane/benchmark/pom.xml b/cosmosdb/data-plane/benchmark/pom.xml deleted file mode 100644 index 1bf6722f0281..000000000000 --- a/cosmosdb/data-plane/benchmark/pom.xml +++ /dev/null @@ -1,196 +0,0 @@ - - - - 4.0.0 - - com.microsoft.azure - azure-cosmosdb-parent - 2.4.5 - - - azure-cosmosdb-benchmark - Async SDK for SQL API of Azure Cosmos DB Service - Benchmarking tool - Benchmarking tool for Async SDK for SQL API of Azure Cosmos DB Service - - - UTF-8 - 1.7.6 - 1.2.17 - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - com.microsoft.azure.cosmosdb.benchmark.Main - - - - maven-assembly-plugin - 2.2 - - - jar-with-dependencies - - - - com.microsoft.azure.cosmosdb.benchmark.Main - - - - - - make-assembly - package - - single - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.6.0 - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-eclipse-plugin - 2.8 - - - - org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8 - - - - - - - - - com.microsoft.azure - azure-cosmosdb - - - com.microsoft.azure - azure-cosmosdb-commons-test-utils - - - io.netty - netty-tcnative - 2.0.20.Final - linux-x86_64 - - - com.google.guava - guava - ${guava.version} - - - io.reactivex - rxjava-guava - 1.0.3 - - - org.mockito - mockito-core - ${mockito.version} - test - - - org.hamcrest - hamcrest-all - 1.3 - test - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.slf4j - slf4j-log4j12 - ${slf4j.version} - - - log4j - log4j - ${log4j.version} - - - io.dropwizard.metrics - metrics-core - ${metrics.version} - - - io.dropwizard.metrics - metrics-jvm - ${metrics.version} - - - io.dropwizard.metrics - metrics-graphite - ${metrics.version} - - - com.beust - jcommander - 1.58 - - - org.apache.commons - commons-lang3 - ${commons-lang3.version} - - - org.testng - testng - ${testng.version} - test - - - org.assertj - assertj-core - ${assertj.version} - test - - - org.mockito - mockito-all - ${mockito.version} - test - - - diff --git a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncBenchmark.java b/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncBenchmark.java deleted file mode 100644 index 477118e3d51c..000000000000 --- a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncBenchmark.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -import com.codahale.metrics.ConsoleReporter; -import com.codahale.metrics.Meter; -import com.codahale.metrics.MetricFilter; -import com.codahale.metrics.MetricRegistry; -import com.codahale.metrics.ScheduledReporter; -import com.codahale.metrics.Timer; -import com.codahale.metrics.graphite.Graphite; -import com.codahale.metrics.graphite.GraphiteReporter; -import com.codahale.metrics.jvm.CachedThreadStatesGaugeSet; -import com.codahale.metrics.jvm.GarbageCollectorMetricSet; -import com.codahale.metrics.jvm.MemoryUsageGaugeSet; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.benchmark.Configuration.Operation; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import org.apache.commons.lang3.RandomStringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Observable; -import rx.Subscriber; - -import java.net.InetSocketAddress; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.Semaphore; -import java.util.concurrent.TimeUnit; - -abstract class AsyncBenchmark { - private final MetricRegistry metricsRegistry = new MetricRegistry(); - private final ScheduledReporter reporter; - private final CountDownLatch operationCounterLatch; - private final String nameCollectionLink; - - private Meter successMeter; - private Meter failureMeter; - - final Logger logger; - final AsyncDocumentClient client; - final DocumentCollection collection; - final String partitionKey; - final Configuration configuration; - final List docsToRead; - final Semaphore concurrencyControlSemaphore; - Timer latency; - - AsyncBenchmark(Configuration cfg) { - client = new AsyncDocumentClient.Builder() - .withServiceEndpoint(cfg.getServiceEndpoint()) - .withMasterKeyOrResourceToken(cfg.getMasterKey()) - .withConnectionPolicy(cfg.getConnectionPolicy()) - .withConsistencyLevel(cfg.getConsistencyLevel()) - .build(); - - logger = LoggerFactory.getLogger(this.getClass()); - - Database database = DocDBUtils.getDatabase(client, cfg.getDatabaseId()); - collection = DocDBUtils.getCollection(client, database.getSelfLink(), cfg.getCollectionId()); - nameCollectionLink = String.format("dbs/%s/colls/%s", database.getId(), collection.getId()); - partitionKey = collection.getPartitionKey().getPaths().iterator().next().split("/")[1]; - concurrencyControlSemaphore = new Semaphore(cfg.getConcurrency()); - operationCounterLatch = new CountDownLatch(cfg.getNumberOfOperations()); - configuration = cfg; - - ArrayList> createDocumentObservables = new ArrayList<>(); - - if (configuration.getOperationType() != Operation.WriteLatency - && configuration.getOperationType() != Operation.WriteThroughput - && configuration.getOperationType() != Operation.ReadMyWrites) { - String dataFieldValue = RandomStringUtils.randomAlphabetic(cfg.getDocumentDataFieldSize()); - for (int i = 0; i < cfg.getNumberOfPreCreatedDocuments(); i++) { - String uuid = UUID.randomUUID().toString(); - Document newDoc = new Document(); - newDoc.setId(uuid); - newDoc.set(partitionKey, uuid); - newDoc.set("dataField1", dataFieldValue); - newDoc.set("dataField2", dataFieldValue); - newDoc.set("dataField3", dataFieldValue); - newDoc.set("dataField4", dataFieldValue); - newDoc.set("dataField5", dataFieldValue); - Observable obs = client.createDocument(collection.getSelfLink(), newDoc, null, false) - .map(ResourceResponse::getResource); - createDocumentObservables.add(obs); - } - } - - docsToRead = Observable.merge(createDocumentObservables, 100).toList().toBlocking().single(); - init(); - - if (configuration.isEnableJvmStats()) { - metricsRegistry.register("gc", new GarbageCollectorMetricSet()); - metricsRegistry.register("threads", new CachedThreadStatesGaugeSet(10, TimeUnit.SECONDS)); - metricsRegistry.register("memory", new MemoryUsageGaugeSet()); - } - - if (configuration.getGraphiteEndpoint() != null) { - final Graphite graphite = new Graphite(new InetSocketAddress(configuration.getGraphiteEndpoint(), configuration.getGraphiteEndpointPort())); - reporter = GraphiteReporter.forRegistry(metricsRegistry) - .prefixedWith(configuration.getOperationType().name()) - .convertRatesTo(TimeUnit.SECONDS) - .convertDurationsTo(TimeUnit.MILLISECONDS) - .filter(MetricFilter.ALL) - .build(graphite); - } else { - reporter = ConsoleReporter.forRegistry(metricsRegistry).convertRatesTo(TimeUnit.SECONDS) - .convertDurationsTo(TimeUnit.MILLISECONDS).build(); - } - } - - protected void init() { - } - - void shutdown() { - client.close(); - } - - protected void onSuccess() { - } - - protected void onError(Throwable throwable) { - } - - protected String getCollectionLink() { - if (configuration.isUseNameLink()) { - return this.nameCollectionLink; - } else { - return collection.getSelfLink(); - } - } - - protected String getDocumentLink(Document doc) { - if (configuration.isUseNameLink()) { - return this.nameCollectionLink + "/docs/" + doc.getId(); - } else { - return doc.getSelfLink(); - } - } - - protected abstract void performWorkload(Subscriber subs, long i) throws Exception; - - void run() throws Exception { - - successMeter = metricsRegistry.meter("#Successful Operations"); - failureMeter = metricsRegistry.meter("#Unsuccessful Operations"); - if (configuration.getOperationType() == Operation.ReadLatency - || configuration.getOperationType() == Operation.WriteLatency) - latency = metricsRegistry.timer("Latency"); - - reporter.start(configuration.getPrintingInterval(), TimeUnit.SECONDS); - - long startTime = System.currentTimeMillis(); - - for (long i = 1; i <= configuration.getNumberOfOperations(); i++) { - - Subscriber subs = new Subscriber() { - - @Override - public void onStart() { - } - - @Override - public void onCompleted() { - successMeter.mark(); - concurrencyControlSemaphore.release(); - operationCounterLatch.countDown(); - AsyncBenchmark.this.onSuccess(); - } - - @Override - public void onError(Throwable e) { - failureMeter.mark(); - logger.error("Encountered failure {} on thread {}" , - e.getMessage(), Thread.currentThread().getName(), e); - concurrencyControlSemaphore.release(); - operationCounterLatch.countDown(); - AsyncBenchmark.this.onError(e); - } - - @Override - public void onNext(T value) { - } - }; - - performWorkload(subs, i); - } - - operationCounterLatch.await(); - long endTime = System.currentTimeMillis(); - logger.info("[{}] operations performed in [{}] seconds.", - configuration.getNumberOfOperations(), (int) ((endTime - startTime) / 1000)); - - reporter.report(); - reporter.close(); - } -} diff --git a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncMixedBenchmark.java b/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncMixedBenchmark.java deleted file mode 100644 index 9af6ddd21e59..000000000000 --- a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncMixedBenchmark.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import org.apache.commons.lang3.RandomStringUtils; -import rx.Observable; -import rx.Subscriber; -import rx.schedulers.Schedulers; - -import java.util.Random; -import java.util.UUID; - -class AsyncMixedBenchmark extends AsyncBenchmark { - - private final String uuid; - private final String dataFieldValue; - private final Random r; - - AsyncMixedBenchmark(Configuration cfg) { - super(cfg); - uuid = UUID.randomUUID().toString(); - dataFieldValue = RandomStringUtils.randomAlphabetic(configuration.getDocumentDataFieldSize()); - r = new Random(); - } - - @Override - protected void performWorkload(Subscriber subs, long i) throws InterruptedException { - Observable obs; - if (i % 10 == 0 && i % 100 != 0) { - - String idString = uuid + i; - Document newDoc = new Document(); - newDoc.setId(idString); - newDoc.set(partitionKey, idString); - newDoc.set("dataField1", dataFieldValue); - newDoc.set("dataField2", dataFieldValue); - newDoc.set("dataField3", dataFieldValue); - newDoc.set("dataField4", dataFieldValue); - newDoc.set("dataField5", dataFieldValue); - obs = client.createDocument(getCollectionLink(), newDoc, null, false).map(ResourceResponse::getResource); - - } else if (i % 100 == 0) { - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(10); - options.setEnableCrossPartitionQuery(true); - - String sqlQuery = "Select top 100 * from c order by c._ts"; - obs = client.queryDocuments(getCollectionLink(), sqlQuery, options) - .map(frp -> frp.getResults().get(0)); - } else { - - int index = r.nextInt(1000); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(docsToRead.get(index).getId())); - - obs = client.readDocument(getDocumentLink(docsToRead.get(index)), options).map(ResourceResponse::getResource); - } - - concurrencyControlSemaphore.acquire(); - - obs.subscribeOn(Schedulers.computation()).subscribe(subs); - } -} diff --git a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncQueryBenchmark.java b/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncQueryBenchmark.java deleted file mode 100644 index 73df9a4ab81d..000000000000 --- a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncQueryBenchmark.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -import java.util.Random; - -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.benchmark.Configuration.Operation; - -import rx.Observable; -import rx.Subscriber; -import rx.schedulers.Schedulers; - -import javax.net.ssl.SSLException; - -class AsyncQueryBenchmark extends AsyncBenchmark> { - - private int pageCount = 0; - - AsyncQueryBenchmark(Configuration cfg) { - super(cfg); - } - - @Override - protected void onSuccess() { - pageCount++; - if (pageCount % 10000 == 0) { - if (pageCount == 0) { - return; - } - logger.info("total pages so far: {}", pageCount); - } - } - - @Override - protected void performWorkload(Subscriber> subs, long i) throws InterruptedException { - - Observable> obs; - Random r = new Random(); - FeedOptions options = new FeedOptions(); - - if (configuration.getOperationType() == Operation.QueryCross) { - - int index = r.nextInt(1000); - options.setEnableCrossPartitionQuery(true); - String sqlQuery = "Select * from c where c._rid = \"" + docsToRead.get(index).getResourceId() + "\""; - obs = client.queryDocuments(getCollectionLink(), sqlQuery, options); - } else if (configuration.getOperationType() == Operation.QuerySingle) { - - int index = r.nextInt(1000); - String pk = docsToRead.get(index).getString("pk"); - options.setPartitionKey(new PartitionKey(pk)); - String sqlQuery = "Select * from c where c.pk = \"" + pk + "\""; - obs = client.queryDocuments(getCollectionLink(), sqlQuery, options); - } else if (configuration.getOperationType() == Operation.QueryParallel) { - - options.setMaxItemCount(10); - options.setEnableCrossPartitionQuery(true); - String sqlQuery = "Select * from c"; - obs = client.queryDocuments(getCollectionLink(), sqlQuery, options); - } else if (configuration.getOperationType() == Operation.QueryOrderby) { - - options.setMaxItemCount(10); - options.setEnableCrossPartitionQuery(true); - String sqlQuery = "Select * from c order by c._ts"; - obs = client.queryDocuments(getCollectionLink(), sqlQuery, options); - } else if (configuration.getOperationType() == Operation.QueryAggregate) { - - options.setMaxItemCount(10); - options.setEnableCrossPartitionQuery(true); - String sqlQuery = "Select value max(c._ts) from c"; - obs = client.queryDocuments(getCollectionLink(), sqlQuery, options); - } else if (configuration.getOperationType() == Operation.QueryAggregateTopOrderby) { - - options.setEnableCrossPartitionQuery(true); - String sqlQuery = "Select top 1 value count(c) from c order by c._ts"; - obs = client.queryDocuments(getCollectionLink(), sqlQuery, options); - } else if (configuration.getOperationType() == Operation.QueryTopOrderby) { - - options.setEnableCrossPartitionQuery(true); - String sqlQuery = "Select top 1000 * from c order by c._ts"; - obs = client.queryDocuments(getCollectionLink(), sqlQuery, options); - } else { - throw new IllegalArgumentException("Unsupported Operation: " + configuration.getOperationType()); - } - concurrencyControlSemaphore.acquire(); - - obs.subscribeOn(Schedulers.computation()).subscribe(subs); - } -} diff --git a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncQuerySinglePartitionMultiple.java b/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncQuerySinglePartitionMultiple.java deleted file mode 100644 index 1d515226bea8..000000000000 --- a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncQuerySinglePartitionMultiple.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKey; - -import rx.Observable; -import rx.Subscriber; -import rx.schedulers.Schedulers; - -import javax.net.ssl.SSLException; - -class AsyncQuerySinglePartitionMultiple extends AsyncBenchmark> { - - private static final String SQL_QUERY = "Select * from c where c.pk = \"pk\""; - private FeedOptions options; - private int pageCount = 0; - - AsyncQuerySinglePartitionMultiple(Configuration cfg) { - super(cfg); - options = new FeedOptions(); - options.setPartitionKey(new PartitionKey("pk")); - options.setMaxItemCount(10); - } - - @Override - protected void onSuccess() { - pageCount++; - if (pageCount % 10000 == 0) { - if (pageCount == 0) { - return; - } - logger.info("total pages so far: {}", pageCount); - } - } - - @Override - protected void performWorkload(Subscriber> subs, long i) throws InterruptedException { - Observable> obs = client.queryDocuments(getCollectionLink(), SQL_QUERY, options); - - concurrencyControlSemaphore.acquire(); - - obs.subscribeOn(Schedulers.computation()).subscribe(subs); - } -} diff --git a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncReadBenchmark.java b/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncReadBenchmark.java deleted file mode 100644 index bdf0454f3824..000000000000 --- a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncReadBenchmark.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -import com.codahale.metrics.Timer; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.benchmark.Configuration.Operation; - -import rx.Observable; -import rx.Subscriber; -import rx.schedulers.Schedulers; - -import javax.net.ssl.SSLException; - -class AsyncReadBenchmark extends AsyncBenchmark> { - - class LatencySubscriber extends Subscriber { - - Timer.Context context; - Subscriber subscriber; - - LatencySubscriber(Subscriber subscriber) { - this.subscriber = subscriber; - } - - @Override - public void onCompleted() { - context.stop(); - subscriber.onCompleted(); - } - - @Override - public void onError(Throwable e) { - context.stop(); - subscriber.onError(e); - } - - @Override - public void onNext(T t) { - subscriber.onNext(t); - } - } - - AsyncReadBenchmark(Configuration cfg) { - super(cfg); - } - - @Override - protected void performWorkload(Subscriber> subs, long i) throws InterruptedException { - int index = (int) (i % docsToRead.size()); - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(docsToRead.get(index).getId())); - - Observable> obs = client.readDocument(getDocumentLink(docsToRead.get(index)), options); - - concurrencyControlSemaphore.acquire(); - - if (configuration.getOperationType() == Operation.ReadThroughput) { - obs.subscribeOn(Schedulers.computation()).subscribe(subs); - } else { - LatencySubscriber> latencySubscriber = new LatencySubscriber<>( - subs); - latencySubscriber.context = latency.time(); - obs.subscribeOn(Schedulers.computation()).subscribe(latencySubscriber); - } - } -} diff --git a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncWriteBenchmark.java b/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncWriteBenchmark.java deleted file mode 100644 index 8256e1c48cba..000000000000 --- a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/AsyncWriteBenchmark.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -import java.util.UUID; - -import org.apache.commons.lang3.RandomStringUtils; - -import com.codahale.metrics.Timer; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.benchmark.Configuration.Operation; - -import rx.Observable; -import rx.Subscriber; -import rx.schedulers.Schedulers; - -import javax.net.ssl.SSLException; - -class AsyncWriteBenchmark extends AsyncBenchmark> { - - private final String uuid; - private final String dataFieldValue; - - class LatencySubscriber extends Subscriber { - - Timer.Context context; - Subscriber subscriber; - - LatencySubscriber(Subscriber subscriber) { - this.subscriber = subscriber; - } - - @Override - public void onCompleted() { - context.stop(); - subscriber.onCompleted(); - } - - @Override - public void onError(Throwable e) { - context.stop(); - subscriber.onError(e); - } - - @Override - public void onNext(T t) { - subscriber.onNext(t); - } - } - - AsyncWriteBenchmark(Configuration cfg) { - super(cfg); - uuid = UUID.randomUUID().toString(); - dataFieldValue = RandomStringUtils.randomAlphabetic(configuration.getDocumentDataFieldSize()); - } - - @Override - protected void performWorkload(Subscriber> subs, long i) throws InterruptedException { - - String idString = uuid + i; - Document newDoc = new Document(); - newDoc.setId(idString); - newDoc.set(partitionKey, idString); - newDoc.set("dataField1", dataFieldValue); - newDoc.set("dataField2", dataFieldValue); - newDoc.set("dataField3", dataFieldValue); - newDoc.set("dataField4", dataFieldValue); - newDoc.set("dataField5", dataFieldValue); - Observable> obs = client.createDocument(getCollectionLink(), newDoc, null, - false); - - concurrencyControlSemaphore.acquire(); - - if (configuration.getOperationType() == Operation.WriteThroughput) { - obs.subscribeOn(Schedulers.computation()).subscribe(subs); - } else { - LatencySubscriber> latencySubscriber = new LatencySubscriber<>( - subs); - latencySubscriber.context = latency.time(); - obs.subscribeOn(Schedulers.computation()).subscribe(latencySubscriber); - } - } -} diff --git a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/Configuration.java b/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/Configuration.java deleted file mode 100644 index 915591f8b7c9..000000000000 --- a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/Configuration.java +++ /dev/null @@ -1,311 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -import java.util.Arrays; - -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; - -import com.beust.jcommander.IStringConverter; -import com.beust.jcommander.Parameter; -import com.beust.jcommander.ParameterException; -import com.google.common.base.Strings; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.benchmark.Configuration.Operation.OperationTypeConverter; - -class Configuration { - private final static int GRAPHITE_SERVER_DEFAULT_PORT = 2003; - - @Parameter(names = "-serviceEndpoint", description = "Service Endpoint") - private String serviceEndpoint; - - @Parameter(names = "-masterKey", description = "Master Key") - private String masterKey; - - @Parameter(names = "-databaseId", description = "Database ID") - private String databaseId; - - @Parameter(names = "-collectionId", description = "Collection ID") - private String collectionId; - - @Parameter(names = "-useNameLink", description = "Use name Link") - private boolean useNameLink = false; - - @Parameter(names = "-documentDataFieldSize", description = "Length of a document data field in characters (16-bit)") - private int documentDataFieldSize = 20; - - @Parameter(names = "-maxConnectionPoolSize", description = "Max Connection Pool Size") - private Integer maxConnectionPoolSize = 1000; - - @Parameter(names = "-consistencyLevel", description = "Consistency Level", converter = ConsistencyLevelConverter.class) - private ConsistencyLevel consistencyLevel = ConsistencyLevel.Session; - - @Parameter(names = "-connectionMode", description = "Connection Mode") - private ConnectionMode connectionMode = ConnectionMode.Direct; - - @Parameter(names = "-graphiteEndpoint", description = "Graphite endpoint") - private String graphiteEndpoint; - - @Parameter(names = "-enableJvmStats", description = "Enables JVM Stats") - private boolean enableJvmStats; - - @Parameter(names = "-operation", description = "Type of Workload:\n" - + "\tReadThroughput- run a Read workload that prints only throughput *\n" - + "\tWriteThroughput - run a Write workload that prints only throughput\n" - + "\tReadLatency - run a Read workload that prints both throughput and latency *\n" - + "\tWriteLatency - run a Write workload that prints both throughput and latency\n" - + "\tQueryCross - run a 'Select * from c where c._rid = SOME_RID' workload that prints throughput\n" - + "\tQuerySingle - run a 'Select * from c where c.pk = SOME_PK' workload that prints throughput\n" - + "\tQuerySingleMany - run a 'Select * from c where c.pk = \"pk\"' workload that prints throughput\n" - + "\tQueryParallel - run a 'Select * from c' workload that prints throughput\n" - + "\tQueryOrderby - run a 'Select * from c order by c._ts' workload that prints throughput\n" - + "\tQueryAggregate - run a 'Select value max(c._ts) from c' workload that prints throughput\n" - + "\tQueryAggregateTopOrderby - run a 'Select top 1 value count(c) from c order by c._ts' workload that prints throughput\n" - + "\tQueryTopOrderby - run a 'Select top 1000 * from c order by c._ts' workload that prints throughput\n" - + "\tMixed - runa workload of 90 reads, 9 writes and 1 QueryTopOrderby per 100 operations *\n" - + "\tReadMyWrites - run a workflow of writes followed by reads and queries attempting to read the write.*\n" - + "\n\t* writes 10k documents initially, which are used in the reads", converter = OperationTypeConverter.class) - private Operation operation = Operation.WriteThroughput; - - @Parameter(names = "-concurrency", description = "Degree of Concurrency in Inserting Documents." - + " If this value is not specified, the max connection pool size will be used as the concurrency level.") - private Integer concurrency; - - @Parameter(names = "-numberOfOperations", description = "Total Number Of Documents To Insert") - private int numberOfOperations = 100000; - - @Parameter(names = "-printingInterval", description = "Interval of time after which Metrics should be printed (seconds)") - private int printingInterval = 10; - - @Parameter(names = "-numberOfPreCreatedDocuments", description = "Total Number Of Documents To pre create for a read workload to use") - private int numberOfPreCreatedDocuments = 1000; - - @Parameter(names = {"-h", "-help", "--help"}, description = "Help", help = true) - private boolean help = false; - - enum Operation { - ReadThroughput, - WriteThroughput, - ReadLatency, - WriteLatency, - QueryCross, - QuerySingle, - QuerySingleMany, - QueryParallel, - QueryOrderby, - QueryAggregate, - QueryAggregateTopOrderby, - QueryTopOrderby, - Mixed, - ReadMyWrites; - - static Operation fromString(String code) { - - for (Operation output : Operation.values()) { - if (output.toString().equalsIgnoreCase(code)) { - return output; - } - } - - return null; - } - - static class OperationTypeConverter implements IStringConverter { - - /* - * (non-Javadoc) - * - * @see com.beust.jcommander.IStringConverter#convert(java.lang.String) - */ - @Override - public Operation convert(String value) { - Operation ret = fromString(value); - if (ret == null) { - throw new ParameterException("Value " + value + " can not be converted to ClientType. " - + "Available values are: " + Arrays.toString(Operation.values())); - } - return ret; - } - } - } - - private static ConsistencyLevel fromString(String code) { - for (ConsistencyLevel output : ConsistencyLevel.values()) { - if (output.toString().equalsIgnoreCase(code)) { - return output; - } - } - return null; - } - - static class ConsistencyLevelConverter implements IStringConverter { - - /* - * (non-Javadoc) - * - * @see com.beust.jcommander.IStringConverter#convert(java.lang.String) - */ - @Override - public ConsistencyLevel convert(String value) { - ConsistencyLevel ret = fromString(value); - if (ret == null) { - throw new ParameterException("Value " + value + " can not be converted to ClientType. " - + "Available values are: " + Arrays.toString(Operation.values())); - } - return ret; - } - } - - Operation getOperationType() { - return operation; - } - - int getNumberOfOperations() { - return numberOfOperations; - } - - String getServiceEndpoint() { - return serviceEndpoint; - } - - String getMasterKey() { - return masterKey; - } - - boolean isHelp() { - return help; - } - - int getDocumentDataFieldSize() { - return documentDataFieldSize; - } - - ConnectionPolicy getConnectionPolicy() { - ConnectionPolicy policy = new ConnectionPolicy(); - policy.setConnectionMode(connectionMode); - policy.setMaxPoolSize(maxConnectionPoolSize); - return policy; - } - - ConsistencyLevel getConsistencyLevel() { - return consistencyLevel; - } - - String getDatabaseId() { - return databaseId; - } - - String getCollectionId() { - return collectionId; - } - - int getNumberOfPreCreatedDocuments() { - return numberOfPreCreatedDocuments; - } - - int getPrintingInterval() { - return printingInterval; - } - - int getConcurrency() { - if (this.concurrency != null) { - return concurrency; - } else { - return this.maxConnectionPoolSize; - } - } - - boolean isUseNameLink() { - return useNameLink; - } - - public boolean isEnableJvmStats() { - return enableJvmStats; - } - - public String getGraphiteEndpoint() { - if (graphiteEndpoint == null) { - return null; - } - - return StringUtils.substringBeforeLast(graphiteEndpoint, ":"); - } - - public int getGraphiteEndpointPort() { - if (graphiteEndpoint == null) { - return -1; - } - - String portAsString = Strings.emptyToNull(StringUtils.substringAfterLast(graphiteEndpoint, ":")); - if (portAsString == null) { - return GRAPHITE_SERVER_DEFAULT_PORT; - } else { - return Integer.parseInt(portAsString); - } - } - - public String toString() { - return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); - } - - void tryGetValuesFromSystem() { - serviceEndpoint = StringUtils.defaultString(Strings.emptyToNull(System.getenv().get("SERVICE_END_POINT")), - serviceEndpoint); - - masterKey = StringUtils.defaultString(Strings.emptyToNull(System.getenv().get("MASTER_KEY")), masterKey); - - databaseId = StringUtils.defaultString(Strings.emptyToNull(System.getenv().get("DATABASE_ID")), databaseId); - - collectionId = StringUtils.defaultString(Strings.emptyToNull(System.getenv().get("COLLECTION_ID")), - collectionId); - - documentDataFieldSize = Integer.parseInt( - StringUtils.defaultString(Strings.emptyToNull(System.getenv().get("DOCUMENT_DATA_FIELD_SIZE")), - Integer.toString(documentDataFieldSize))); - - maxConnectionPoolSize = Integer.parseInt( - StringUtils.defaultString(Strings.emptyToNull(System.getenv().get("MAX_CONNECTION_POOL_SIZE")), - Integer.toString(maxConnectionPoolSize))); - - ConsistencyLevelConverter consistencyLevelConverter = new ConsistencyLevelConverter(); - consistencyLevel = consistencyLevelConverter.convert(StringUtils - .defaultString(Strings.emptyToNull(System.getenv().get("CONSISTENCY_LEVEL")), consistencyLevel.name())); - - OperationTypeConverter operationTypeConverter = new OperationTypeConverter(); - operation = operationTypeConverter.convert( - StringUtils.defaultString(Strings.emptyToNull(System.getenv().get("OPERATION")), operation.name())); - - String concurrencyValue = StringUtils.defaultString(Strings.emptyToNull(System.getenv().get("CONCURRENCY")), - concurrency == null ? null : Integer.toString(concurrency)); - concurrency = concurrencyValue == null ? null : Integer.parseInt(concurrencyValue); - - String numberOfOperationsValue = StringUtils.defaultString( - Strings.emptyToNull(System.getenv().get("NUMBER_OF_OPERATIONS")), Integer.toString(numberOfOperations)); - numberOfOperations = Integer.parseInt(numberOfOperationsValue); - } -} diff --git a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/DocDBUtils.java b/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/DocDBUtils.java deleted file mode 100644 index 4d05fb177cc6..000000000000 --- a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/DocDBUtils.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.SqlParameter; -import com.microsoft.azure.cosmosdb.SqlParameterCollection; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; - -class DocDBUtils { - - private DocDBUtils() { - } - - static Database getDatabase(AsyncDocumentClient client, String databaseId) { - FeedResponse feedResponsePages = client - .queryDatabases(new SqlQuerySpec("SELECT * FROM root r WHERE r.id=@id", - new SqlParameterCollection(new SqlParameter("@id", databaseId))), null) - .toBlocking().single(); - - if (feedResponsePages.getResults().isEmpty()) { - throw new RuntimeException("cannot find datatbase " + databaseId); - } - return feedResponsePages.getResults().get(0); - } - - static DocumentCollection getCollection(AsyncDocumentClient client, String databaseLink, - String collectionId) { - FeedResponse feedResponsePages = client - .queryCollections(databaseLink, - new SqlQuerySpec("SELECT * FROM root r WHERE r.id=@id", - new SqlParameterCollection(new SqlParameter("@id", collectionId))), - null) - .toBlocking().single(); - - if (feedResponsePages.getResults().isEmpty()) { - throw new RuntimeException("cannot find collection " + collectionId); - } - return feedResponsePages.getResults().get(0); - } -} diff --git a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/Main.java b/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/Main.java deleted file mode 100644 index 18c20c619faf..000000000000 --- a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/Main.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.beust.jcommander.JCommander; -import com.beust.jcommander.ParameterException; - -public class Main { - - private final static Logger LOGGER = LoggerFactory.getLogger(Main.class); - - public static void main(String[] args) throws Exception { - org.apache.log4j.Logger.getLogger("io.netty").setLevel(org.apache.log4j.Level.OFF); - - try { - LOGGER.debug("Parsing the arguments ..."); - Configuration cfg = new Configuration(); - cfg.tryGetValuesFromSystem(); - - JCommander jcommander = new JCommander(cfg, args); - if (cfg.isHelp()) { - // prints out the usage help - jcommander.usage(); - return; - } - - AsyncBenchmark benchmark; - switch (cfg.getOperationType()) { - case WriteThroughput: - case WriteLatency: - benchmark = new AsyncWriteBenchmark(cfg); - break; - - case ReadThroughput: - case ReadLatency: - benchmark = new AsyncReadBenchmark(cfg); - break; - - case QueryCross: - case QuerySingle: - case QueryParallel: - case QueryOrderby: - case QueryAggregate: - case QueryTopOrderby: - case QueryAggregateTopOrderby: - benchmark = new AsyncQueryBenchmark(cfg); - break; - - case Mixed: - benchmark = new AsyncMixedBenchmark(cfg); - break; - - case QuerySingleMany: - benchmark = new AsyncQuerySinglePartitionMultiple(cfg); - break; - - case ReadMyWrites: - benchmark = new ReadMyWriteWorkflow(cfg); - break; - - default: - throw new RuntimeException(cfg.getOperationType() + " is not supported"); - } - - benchmark.run(); - benchmark.shutdown(); - - } catch (ParameterException e) { - // if any error in parsing the cmd-line options print out the usage help - System.err.println("Invalid Usage: " + e.getMessage()); - System.err.println("Try '-help' for more information."); - System.exit(1); - } - } -} diff --git a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/ReadMyWriteWorkflow.java b/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/ReadMyWriteWorkflow.java deleted file mode 100644 index 5115dcfb0060..000000000000 --- a/cosmosdb/data-plane/benchmark/src/main/java/com/microsoft/azure/cosmosdb/benchmark/ReadMyWriteWorkflow.java +++ /dev/null @@ -1,419 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.SqlParameter; -import com.microsoft.azure.cosmosdb.SqlParameterCollection; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.rx.internal.NotFoundException; -import org.apache.commons.lang3.RandomStringUtils; -import org.apache.commons.lang3.RandomUtils; -import rx.Observable; -import rx.Subscriber; -import rx.schedulers.Schedulers; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.stream.Collectors; - -/** - * This workflow is intended for session and above consistency levels. - *

- * This workflow first will create some documents in cosmosdb and will store them all in its local cache. - * Then at each step will randomly will try to do a write, read its own write, or query for its own write. - */ -class ReadMyWriteWorkflow extends AsyncBenchmark { - private final static String QUERY_FIELD_NAME = "prop"; - private final static String ORDER_BY_FIELD_NAME = "_ts"; - private final static int MAX_TOP_QUERY_COUNT = 2000; - - private ConcurrentHashMap cache; - private int cacheSize; - - ReadMyWriteWorkflow(Configuration cfg) { - super(cfg); - } - - @Override - protected void init() { - this.cacheSize = configuration.getNumberOfPreCreatedDocuments(); - this.cache = new ConcurrentHashMap<>(); - this.populateCache(); - } - - @Override - protected void performWorkload(Subscriber subs, long i) throws Exception { - Observable obs; - boolean readyMyWrite = RandomUtils.nextBoolean(); - if (readyMyWrite) { - // will do a write and immediately upon success will either - // do a point read - // or single partition query - // or cross partition query to find the write. - int j = Math.toIntExact(Math.floorMod(i, 3)); - switch (j) { - case 0: - // write a random document to cosmodb and update the cache. - // then try to read the document which just was written - obs = writeDocument() - .flatMap(d -> readDocument(d)); - break; - case 1: - // write a random document to cosmodb and update the cache. - // then try to query for the document which just was written - obs = writeDocument() - .flatMap(d -> singlePartitionQuery(d) - .switchIfEmpty(Observable.error(new NotFoundException( - "couldn't find my write in a single partition query!")))); - break; - case 2: - // write a random document to cosmodb and update the cache. - // then try to query for the document which just was written - obs = writeDocument() - .flatMap(d -> xPartitionQuery(generateQuery(d)) - .switchIfEmpty(Observable.error(new NotFoundException( - "couldn't find my write in a cross partition query!")))); - break; - default: - assert false; - throw new IllegalStateException(); - } - } else { - // will either do - // a write - // a point read for a in memory cached document - // or single partition query for a in memory cached document - // or cross partition query for a in memory cached document - int j = Math.toIntExact(Math.floorMod(i, 4)); - switch (j) { - case 0: - // write a random document to cosmosdb and update the cache - obs = writeDocument(); - break; - case 1: - // randomly choose a document from the cache and do a single point read - obs = readDocument(cache.get(cacheKey())); - break; - case 2: - // randomly choose a document from the cache and do a single partition query - obs = singlePartitionQuery(cache.get(cacheKey())) - .switchIfEmpty(Observable.error(new NotFoundException( - "couldn't find my cached write in a single partition query!"))); - break; - case 3: - // randomly choose a document from the cache and do a cross partition query - obs = xPartitionQuery(generateRandomQuery()) - .switchIfEmpty(Observable.error(new NotFoundException( - "couldn't find my cached write in a cross partition query!"))); - break; - default: - assert false; - throw new IllegalStateException(); - } - } - - concurrencyControlSemaphore.acquire(); - - obs.subscribeOn(Schedulers.computation()).subscribe(subs); - } - - private void populateCache() { - ArrayList> list = new ArrayList<>(); - for (int i = 0; i < cacheSize; i++) { - Observable observable = writeDocument(i); - list.add(observable); - } - - logger.info("Pre-populating {} documents ....", cacheSize); - Observable.merge(list, configuration.getConcurrency()).toCompletable().await(); - logger.info("Finished pre-populating {} documents", cacheSize); - } - - /** - * Writes a random document to cosmosdb and store it in a random location in the cache. - * - * @return Observable of document - */ - private Observable writeDocument() { - return writeDocument(null); - } - - /** - * Writes a random document to cosmosdb and store it in the slot i-th in the cache. - * - * @return Observable of document - */ - private Observable writeDocument(Integer i) { - String idString = Utils.randomUUID().toString(); - String randomVal = Utils.randomUUID().toString(); - Document document = new Document(); - document.setId(idString); - document.set(partitionKey, idString); - document.set(QUERY_FIELD_NAME, randomVal); - document.set("dataField1", randomVal); - document.set("dataField2", randomVal); - document.set("dataField3", randomVal); - document.set("dataField4", randomVal); - - Integer key = i == null ? cacheKey() : i; - return client.createDocument(getCollectionLink(), document, null, false) - .doOnNext(r -> cache.put(key, r.getResource())) - .map(ResourceResponse::getResource); - } - - /** - * given a document tries to read it from cosmosdb - * - * @param d document to be read - * @return Observable of document - */ - private Observable readDocument(Document d) { - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(d.getString(partitionKey))); - - return client.readDocument(getDocumentLink(d), options) - .map(ResourceResponse::getResource); - } - - /** - * Generates a random query - * - * @return a randomly generated query - */ - private SqlQuerySpec generateRandomQuery() { - int docCount = RandomUtils.nextInt(1, 2); - Set keys = new HashSet<>(); - for (int i = 0; i < docCount; i++) { - int key = RandomUtils.nextInt(0, cacheSize); - keys.add(key); - } - List documentList = null; - if (RandomUtils.nextBoolean()) { - documentList = keys.stream().map(cache::get).collect(Collectors.toList()); - } - - int top = RandomUtils.nextInt(0, MAX_TOP_QUERY_COUNT); - boolean useOrderBy = RandomUtils.nextBoolean(); - - return generateQuery(documentList, top > 1000 ? top : null, useOrderBy); - } - - /** - * given a query returns the corresponding observable result - * - * @param query to find document - * @return Observable document - */ - private Observable xPartitionQuery(SqlQuerySpec query) { - FeedOptions options = new FeedOptions(); - options.setMaxDegreeOfParallelism(-1); - options.setEnableCrossPartitionQuery(true); - - return client.queryDocuments(getCollectionLink(), query, options) - .flatMap(p -> Observable.from(p.getResults())); - } - - /** - * given a document returns the corresponding observable result of issuing a single partition query - * for the document. - * - * @param d document to be queried for. - * @return Observable document - */ - private Observable singlePartitionQuery(Document d) { - FeedOptions options = new FeedOptions(); - options.setPartitionKey(new PartitionKey(d.get(partitionKey))); - - SqlQuerySpec sqlQuerySpec = new SqlQuerySpec(String.format("Select top 100 * from c where c.%s = '%s'", - QUERY_FIELD_NAME, - d.getString(QUERY_FIELD_NAME))); - return client.queryDocuments(getCollectionLink(), sqlQuerySpec, options) - .flatMap(p -> Observable.from(p.getResults())); - } - - /** - * Given a document list generates a randomly generated sql query which can find only and only the documents - *

- * The generated query may have a top, orderby, top and orderby. - * - * @param documentList list of documents to be queried for - * @return SqlQuerySpec - */ - private SqlQuerySpec generateQuery(Document... documentList) { - return generateQuery(Arrays.asList(documentList)); - } - - /** - * Given a document list generates a randomly generated sql query which can find only and only the documents - *

- * The generated query may have a top, orderby, top and orderby. - * - * @param documentList list of documents to be queried for - * @return SqlQuerySpec - */ - private SqlQuerySpec generateQuery(List documentList) { - int top = RandomUtils.nextInt(0, MAX_TOP_QUERY_COUNT); - boolean useOrderBy = RandomUtils.nextBoolean(); - - return generateQuery(documentList, top >= documentList.size() ? top : null, useOrderBy); - } - - /** - * Given a document list generates sql query which can find only and only the documents - * - * @param documentList lists of documents to find - * @param topCount if a valid top count, the query will have a top count - * @param withOrderBy if not null, the query will have an orderby clause - * @return SqlQuerySpec - */ - private SqlQuerySpec generateQuery(List documentList, Integer topCount, boolean withOrderBy) { - QueryBuilder queryBuilder = new QueryBuilder(); - if (withOrderBy) { - queryBuilder.orderBy(ORDER_BY_FIELD_NAME); - } - if (documentList != null && !documentList.isEmpty()) { - if (topCount != null) { - topCount = Math.max(topCount, documentList.size()); - } - - queryBuilder.whereClause(QueryBuilder.WhereClause.InWhereClause.asInWhereClause(QUERY_FIELD_NAME, documentList)); - } - - if ((documentList == null || documentList.isEmpty()) && (topCount == null || topCount <= 0)) { - topCount = 100; - } - - if (topCount != null) { - queryBuilder.top(topCount); - } - - return queryBuilder.toSqlQuerySpec(); - } - - private int cacheKey() { - return RandomUtils.nextInt(0, cacheSize); - } - - /** - * This is used for making random query generation with different terms (top, orderby) easier. - */ - static class QueryBuilder { - private String orderByFieldName; - private Integer topCount; - private WhereClause whereClause; - - QueryBuilder top(int top) { - this.topCount = top; - return this; - } - - QueryBuilder orderBy(String fieldName) { - this.orderByFieldName = fieldName; - return this; - } - - QueryBuilder whereClause(WhereClause whereClause) { - this.whereClause = whereClause; - return this; - } - - static abstract class WhereClause { - static class InWhereClause extends WhereClause { - private final List parameters; - private final String whereCondition; - - static InWhereClause asInWhereClause(String fieldName, List documentList) { - List parameters = new ArrayList<>(documentList.size()); - for (int i = 0; i < documentList.size(); i++) { - Object value = documentList.get(i).get(fieldName); - SqlParameter sqlParameter = new SqlParameter("@param" + i, value); - parameters.add(sqlParameter); - } - - return new InWhereClause(fieldName, parameters); - } - - InWhereClause(String fieldName, List parameters) { - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(fieldName); - stringBuilder.append(" IN ("); - List params = parameters.stream().map(SqlParameter::getName).collect(Collectors.toList()); - stringBuilder.append(String.join(", ", params)); - stringBuilder.append(")"); - - this.whereCondition = stringBuilder.toString(); - this.parameters = parameters; - } - - @Override - String getWhereCondition(String rootName) { - return rootName + "." + this.whereCondition; - } - - @Override - SqlParameterCollection getSqlParameterCollection() { - return new SqlParameterCollection(this.parameters); - } - } - - abstract String getWhereCondition(String rootName); - - abstract SqlParameterCollection getSqlParameterCollection(); - } - - SqlQuerySpec toSqlQuerySpec() { - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("SELECT"); - - if (topCount != null) { - stringBuilder.append(" TOP ").append(topCount); - } - - stringBuilder.append(" * FROM root"); - if (whereClause != null) { - stringBuilder.append(" WHERE "); - stringBuilder.append(whereClause.getWhereCondition("root")); - - } - - if (orderByFieldName != null) { - stringBuilder.append(" ORDER BY ").append("root.").append(orderByFieldName); - } - - return whereClause == null ? - new SqlQuerySpec(stringBuilder.toString()) : - new SqlQuerySpec(stringBuilder.toString(), whereClause.getSqlParameterCollection()); - } - } -} diff --git a/cosmosdb/data-plane/benchmark/src/main/resources/log4j.properties b/cosmosdb/data-plane/benchmark/src/main/resources/log4j.properties deleted file mode 100644 index 92751a419201..000000000000 --- a/cosmosdb/data-plane/benchmark/src/main/resources/log4j.properties +++ /dev/null @@ -1,14 +0,0 @@ -# this is the log4j configuration for tests - -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=INFO, A1 - -log4j.category.com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd=WARN -log4j.category.io.netty=INFO -log4j.category.io.reactivex=INFO -# A1 is set to be a ConsoleAppender. -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%d %5X{pid} [%t] %-5p %c - %m%n \ No newline at end of file diff --git a/cosmosdb/data-plane/benchmark/src/test/java/com/microsoft/azure/cosmosdb/benchmark/QueryBuilderTest.java b/cosmosdb/data-plane/benchmark/src/test/java/com/microsoft/azure/cosmosdb/benchmark/QueryBuilderTest.java deleted file mode 100644 index d83d5505e1d3..000000000000 --- a/cosmosdb/data-plane/benchmark/src/test/java/com/microsoft/azure/cosmosdb/benchmark/QueryBuilderTest.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -import com.google.common.collect.ImmutableList; -import com.microsoft.azure.cosmosdb.SqlParameter; -import org.testng.annotations.Test; - -import static com.microsoft.azure.cosmosdb.benchmark.ReadMyWriteWorkflow.QueryBuilder.WhereClause; -import static org.assertj.core.api.Assertions.assertThat; - -public class QueryBuilderTest { - - @Test(groups = {"unit"}) - public void basic() { - ReadMyWriteWorkflow.QueryBuilder queryBuilder = new ReadMyWriteWorkflow.QueryBuilder(); - assertThat(queryBuilder.toSqlQuerySpec().getQueryText()) - .isEqualTo("SELECT * FROM root"); - } - - @Test(groups = {"unit"}) - public void top() { - ReadMyWriteWorkflow.QueryBuilder queryBuilder = new ReadMyWriteWorkflow.QueryBuilder(); - queryBuilder.top(50); - assertThat(queryBuilder.toSqlQuerySpec().getQueryText()) - .isEqualTo("SELECT TOP 50 * FROM root"); - } - - @Test(groups = {"unit"}) - public void orderBy() { - ReadMyWriteWorkflow.QueryBuilder queryBuilder = new ReadMyWriteWorkflow.QueryBuilder(); - queryBuilder.orderBy("prop"); - assertThat(queryBuilder.toSqlQuerySpec().getQueryText()) - .isEqualTo("SELECT * FROM root ORDER BY root.prop"); - } - - @Test(groups = {"unit"}) - public void whereInClause() { - ReadMyWriteWorkflow.QueryBuilder queryBuilder = new ReadMyWriteWorkflow.QueryBuilder(); - - ImmutableList parameters = ImmutableList.of(new SqlParameter("@param1", 1), - new SqlParameter("@param2", 2)); - queryBuilder.whereClause(new WhereClause.InWhereClause("colName", - parameters)); - assertThat(queryBuilder.toSqlQuerySpec().getQueryText()) - .isEqualTo("SELECT * FROM root WHERE root.colName IN (@param1, @param2)"); - assertThat(queryBuilder.toSqlQuerySpec().getParameters()).containsExactlyElementsOf(parameters); - } - - @Test(groups = {"unit"}) - public void topOrderByWhereClause() { - ReadMyWriteWorkflow.QueryBuilder queryBuilder = new ReadMyWriteWorkflow.QueryBuilder(); - queryBuilder.orderBy("prop"); - queryBuilder.top(5); - - ImmutableList parameters = ImmutableList.of(new SqlParameter("@param1", 1), - new SqlParameter("@param2", 2)); - queryBuilder.whereClause(new WhereClause.InWhereClause("colName", - parameters)); - assertThat(queryBuilder.toSqlQuerySpec().getQueryText()) - .isEqualTo("SELECT TOP 5 * FROM root WHERE root.colName IN (@param1, @param2) ORDER BY root.prop"); - assertThat(queryBuilder.toSqlQuerySpec().getParameters()).containsExactlyElementsOf(parameters); - } -} diff --git a/cosmosdb/data-plane/benchmark/src/test/java/com/microsoft/azure/cosmosdb/benchmark/Utils.java b/cosmosdb/data-plane/benchmark/src/test/java/com/microsoft/azure/cosmosdb/benchmark/Utils.java deleted file mode 100644 index 49517fd05cb5..000000000000 --- a/cosmosdb/data-plane/benchmark/src/test/java/com/microsoft/azure/cosmosdb/benchmark/Utils.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - - -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.RetryOptions; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.TestConfigurations; -import rx.Observable; - -public class Utils { - public static AsyncDocumentClient housekeepingClient() { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - RetryOptions options = new RetryOptions(); - options.setMaxRetryAttemptsOnThrottledRequests(100); - options.setMaxRetryWaitTimeInSeconds(60); - connectionPolicy.setRetryOptions(options); - return new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .build(); - } - - public static String getCollectionLink(Database db, DocumentCollection collection) { - return "dbs/" + db.getId() + "/colls/" + collection; - } - - public static Database createDatabaseForTest(AsyncDocumentClient client) { - return DatabaseForTest.create(DatabaseManagerImpl.getInstance(client)).createdDatabase; - } - - public static void safeCleanDatabases(AsyncDocumentClient client) { - if (client != null) { - DatabaseForTest.cleanupStaleTestDatabases(DatabaseManagerImpl.getInstance(client)); - } - } - - public static void safeClean(AsyncDocumentClient client, Database database) { - if (database != null) { - safeClean(client, database.getId()); - } - } - - public static void safeClean(AsyncDocumentClient client, String databaseId) { - if (client != null) { - if (databaseId != null) { - try { - client.deleteDatabase("/dbs/" + databaseId, null).toBlocking().single(); - } catch (Exception e) { - } - } - } - } - - public static String generateDatabaseId() { - return DatabaseForTest.generateId(); - } - - public static void safeClose(AsyncDocumentClient client) { - if (client != null) { - client.close(); - } - } - - private static class DatabaseManagerImpl implements DatabaseForTest.DatabaseManager { - public static DatabaseManagerImpl getInstance(AsyncDocumentClient client) { - return new DatabaseManagerImpl(client); - } - - private final AsyncDocumentClient client; - - private DatabaseManagerImpl(AsyncDocumentClient client) { - this.client = client; - } - - @Override - public Observable> queryDatabases(SqlQuerySpec query) { - return client.queryDatabases(query, null); - } - - @Override - public Observable> createDatabase(Database databaseDefinition) { - return client.createDatabase(databaseDefinition, null); - } - - @Override - public Observable> deleteDatabase(String id) { - - return client.deleteDatabase("dbs/" + id, null); - } - } -} diff --git a/cosmosdb/data-plane/benchmark/src/test/java/com/microsoft/azure/cosmosdb/benchmark/WorkflowTest.java b/cosmosdb/data-plane/benchmark/src/test/java/com/microsoft/azure/cosmosdb/benchmark/WorkflowTest.java deleted file mode 100644 index 6490d47bcb6d..000000000000 --- a/cosmosdb/data-plane/benchmark/src/test/java/com/microsoft/azure/cosmosdb/benchmark/WorkflowTest.java +++ /dev/null @@ -1,348 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.benchmark; - -import com.beust.jcommander.JCommander; -import com.microsoft.azure.cosmosdb.DataType; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.IncludedPath; -import com.microsoft.azure.cosmosdb.Index; -import com.microsoft.azure.cosmosdb.IndexingPolicy; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.TestConfigurations; -import org.apache.commons.lang3.StringUtils; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicInteger; - -import static org.assertj.core.api.Assertions.assertThat; - -public class WorkflowTest { - private static final int TIMEOUT = 120000; - private Database database; - private DocumentCollection collection; - - @Test(groups = "simple", timeOut = TIMEOUT) - public void readMyWritesCLI() throws Exception { - String cmdFormat = "-serviceEndpoint %s -masterKey %s" + - " -databaseId %s -collectionId %s" + - " -consistencyLevel Session -concurrency 2 -numberOfOperations 123" + - " -operation ReadMyWrites -connectionMode Direct -numberOfPreCreatedDocuments 100"; - - String cmd = String.format(cmdFormat, - TestConfigurations.HOST, - TestConfigurations.MASTER_KEY, - database.getId(), - collection.getId()); - Main.main(StringUtils.split(cmd)); - } - - @Test(dataProvider = "collectionLinkTypeArgProvider", groups = "simple", timeOut = TIMEOUT) - public void readMyWrites(boolean useNameLink) throws Exception { - int numberOfOperations = 123; - String cmdFormat = "-serviceEndpoint %s -masterKey %s" + - " -databaseId %s -collectionId %s" + - " -consistencyLevel Session -concurrency 2 -numberOfOperations %s" + - " -operation ReadMyWrites -connectionMode Direct -numberOfPreCreatedDocuments 100"; - - String cmd = String.format(cmdFormat, - TestConfigurations.HOST, - TestConfigurations.MASTER_KEY, - database.getId(), - collection.getId(), - numberOfOperations) - + (useNameLink ? " -useNameLink" : ""); - - Configuration cfg = new Configuration(); - new JCommander(cfg, StringUtils.split(cmd)); - - AtomicInteger success = new AtomicInteger(); - AtomicInteger error = new AtomicInteger(); - - ReadMyWriteWorkflow wf = new ReadMyWriteWorkflow(cfg) { - @Override - protected void onError(Throwable throwable) { - error.incrementAndGet(); - } - - @Override - protected void onSuccess() { - success.incrementAndGet(); - } - }; - - wf.run(); - wf.shutdown(); - - assertThat(error).hasValue(0); - assertThat(success).hasValue(numberOfOperations); - } - - @Test(groups = "simple", timeOut = TIMEOUT) - public void writeLatencyCLI() throws Exception { - String cmdFormat = "-serviceEndpoint %s -masterKey %s" + - " -databaseId %s -collectionId %s" + - " -consistencyLevel Session -concurrency 2 -numberOfOperations 1000" + - " -operation WriteLatency -connectionMode Direct"; - - String cmd = String.format(cmdFormat, - TestConfigurations.HOST, - TestConfigurations.MASTER_KEY, - database.getId(), - collection.getId()); - Main.main(StringUtils.split(cmd)); - } - - @Test(dataProvider = "collectionLinkTypeArgProvider", groups = "simple", timeOut = TIMEOUT) - public void writeLatency(boolean useNameLink) throws Exception { - int numberOfOperations = 123; - String cmdFormat = "-serviceEndpoint %s -masterKey %s" + - " -databaseId %s -collectionId %s" + - " -consistencyLevel Session -concurrency 2 -numberOfOperations %s" + - " -operation WriteLatency -connectionMode Direct"; - - String cmd = String.format(cmdFormat, - TestConfigurations.HOST, - TestConfigurations.MASTER_KEY, - database.getId(), - collection.getId(), - numberOfOperations) - + (useNameLink ? " -useNameLink" : ""); - - Configuration cfg = new Configuration(); - new JCommander(cfg, StringUtils.split(cmd)); - - AtomicInteger success = new AtomicInteger(); - AtomicInteger error = new AtomicInteger(); - - AsyncWriteBenchmark wf = new AsyncWriteBenchmark(cfg) { - @Override - protected void onError(Throwable throwable) { - error.incrementAndGet(); - } - - @Override - protected void onSuccess() { - success.incrementAndGet(); - } - }; - - wf.run(); - wf.shutdown(); - - assertThat(error).hasValue(0); - assertThat(success).hasValue(numberOfOperations); - } - - @Test(dataProvider = "collectionLinkTypeArgProvider", groups = "simple", timeOut = TIMEOUT) - public void writeThroughput(boolean useNameLink) throws Exception { - int numberOfOperations = 123; - String cmdFormat = "-serviceEndpoint %s -masterKey %s" + - " -databaseId %s -collectionId %s" + - " -consistencyLevel Session -concurrency 2 -numberOfOperations %s" + - " -operation WriteThroughput -connectionMode Direct"; - - String cmd = String.format(cmdFormat, - TestConfigurations.HOST, - TestConfigurations.MASTER_KEY, - database.getId(), - collection.getId(), - numberOfOperations) - + (useNameLink ? " -useNameLink" : ""); - - Configuration cfg = new Configuration(); - new JCommander(cfg, StringUtils.split(cmd)); - - AtomicInteger success = new AtomicInteger(); - AtomicInteger error = new AtomicInteger(); - - AsyncWriteBenchmark wf = new AsyncWriteBenchmark(cfg) { - @Override - protected void onError(Throwable throwable) { - error.incrementAndGet(); - } - - @Override - protected void onSuccess() { - success.incrementAndGet(); - } - }; - - wf.run(); - wf.shutdown(); - - assertThat(error).hasValue(0); - assertThat(success).hasValue(numberOfOperations); - } - - @Test(dataProvider = "collectionLinkTypeArgProvider", groups = "simple", timeOut = TIMEOUT) - public void readLatency(boolean useNameLink) throws Exception { - int numberOfOperations = 123; - String cmdFormat = "-serviceEndpoint %s -masterKey %s" + - " -databaseId %s -collectionId %s" + - " -consistencyLevel Session -concurrency 2 -numberOfOperations %s" + - " -operation ReadLatency -connectionMode Direct"; - - String cmd = String.format(cmdFormat, - TestConfigurations.HOST, - TestConfigurations.MASTER_KEY, - database.getId(), - collection.getId(), - numberOfOperations) - + (useNameLink ? " -useNameLink" : ""); - - Configuration cfg = new Configuration(); - new JCommander(cfg, StringUtils.split(cmd)); - - AtomicInteger success = new AtomicInteger(); - AtomicInteger error = new AtomicInteger(); - - AsyncReadBenchmark wf = new AsyncReadBenchmark(cfg) { - @Override - protected void onError(Throwable throwable) { - error.incrementAndGet(); - } - - @Override - protected void onSuccess() { - success.incrementAndGet(); - } - }; - - wf.run(); - wf.shutdown(); - - assertThat(error).hasValue(0); - assertThat(success).hasValue(numberOfOperations); - } - - @Test(dataProvider = "collectionLinkTypeArgProvider", groups = "simple", timeOut = TIMEOUT) - public void readThroughput(boolean useNameLink) throws Exception { - int numberOfOperations = 123; - String cmdFormat = "-serviceEndpoint %s -masterKey %s" + - " -databaseId %s -collectionId %s" + - " -consistencyLevel Session -concurrency 2 -numberOfOperations %s" + - " -operation ReadThroughput -connectionMode Direct"; - - String cmd = String.format(cmdFormat, - TestConfigurations.HOST, - TestConfigurations.MASTER_KEY, - database.getId(), - collection.getId(), - numberOfOperations) - + (useNameLink ? " -useNameLink" : ""); - - Configuration cfg = new Configuration(); - new JCommander(cfg, StringUtils.split(cmd)); - - AtomicInteger success = new AtomicInteger(); - AtomicInteger error = new AtomicInteger(); - - AsyncReadBenchmark wf = new AsyncReadBenchmark(cfg) { - @Override - protected void onError(Throwable throwable) { - error.incrementAndGet(); - } - - @Override - protected void onSuccess() { - success.incrementAndGet(); - } - }; - - wf.run(); - wf.shutdown(); - - assertThat(error).hasValue(0); - assertThat(success).hasValue(numberOfOperations); - } - - @BeforeClass(groups = "simple", timeOut = TIMEOUT) - public void beforeClass() { - RequestOptions options = new RequestOptions(); - options.setOfferThroughput(10000); - AsyncDocumentClient housekeepingClient = Utils.housekeepingClient(); - database = Utils.createDatabaseForTest(housekeepingClient); - collection = housekeepingClient.createCollection("dbs/"+ database.getId(), - getCollectionDefinitionWithRangeRangeIndex(), - options) - .toBlocking().single().getResource(); - housekeepingClient.close(); - } - - @DataProvider(name = "collectionLinkTypeArgProvider") - public Object[][] collectionLinkTypeArgProvider() { - return new Object[][]{ - // is namebased - {true}, - {false}, - }; - } - - @AfterClass(groups = "simple", timeOut = TIMEOUT) - public void afterClass() { - AsyncDocumentClient housekeepingClient = Utils.housekeepingClient(); - Utils.safeCleanDatabases(housekeepingClient); - Utils.safeClean(housekeepingClient, database); - Utils.safeClose(housekeepingClient); - } - - DocumentCollection getCollectionDefinitionWithRangeRangeIndex() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList<>(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - IndexingPolicy indexingPolicy = new IndexingPolicy(); - Collection includedPaths = new ArrayList<>(); - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath("/*"); - Collection indexes = new ArrayList<>(); - Index stringIndex = Index.Range(DataType.String); - stringIndex.set("precision", -1); - indexes.add(stringIndex); - - Index numberIndex = Index.Range(DataType.Number); - numberIndex.set("precision", -1); - indexes.add(numberIndex); - includedPath.setIndexes(indexes); - includedPaths.add(includedPath); - indexingPolicy.setIncludedPaths(includedPaths); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setIndexingPolicy(indexingPolicy); - collectionDefinition.setId(UUID.randomUUID().toString()); - collectionDefinition.setPartitionKey(partitionKeyDef); - - return collectionDefinition; - } -} diff --git a/cosmosdb/data-plane/changelog/README.md b/cosmosdb/data-plane/changelog/README.md deleted file mode 100644 index f72d0684abc2..000000000000 --- a/cosmosdb/data-plane/changelog/README.md +++ /dev/null @@ -1,111 +0,0 @@ -## Changelog - -### 2.4.3 -* Fixed resource leak issue on closing client - -### 2.4.2 -* Fixed bugs in continuation token support for cross partition queries - -### 2.4.1 -* Fixed some bugs in Direct mode. -* Improved logging in Direct mode. -* Improved connection management. - -### 2.4.0 -* Direct GA. -* Added support for QueryMetrics. -* Changed the APIs accepting java.util.Collection for which order is important to accept java.util.List instead. Now ConnectionPolicy#getPreferredLocations(), JsonSerialization, and PartitionKey(.) accept List. - -### 2.4.0-beta1 - -* Added support for Direct Https. -* Changed the APIs accepting java.util.Collection for which order is important to accept java.util.List instead. - Now ConnectionPolicy#getPreferredLocations(), JsonSerialization, and PartitionKey(.) accept List. -* Fixed a Session bug for Document query in Gateway mode. -* Upgraded dependencies (netty 0.4.20 [github #79](https://github.com/Azure/azure-cosmosdb-java/issues/79), RxJava 1.3.8). - -### 2.3.1 - -* Fix handling very large query responses. -* Fix resource token handling when instantiating client ([github #78](https://github.com/Azure/azure-cosmosdb-java/issues/78)). -* Upgraded vulnerable dependency jackson-databind ([github #77](https://github.com/Azure/azure-cosmosdb-java/pull/77)). - -### 2.3.0 - -* Fixed a resource leak bug. -* Added support for MultiPolygon -* Added support for custom headers in RequestOptions. - -### 2.2.2 -* Fixed a packaging bug. - -### 2.2.1 -* Fixed a NPE bug in write retry path. -* Fixed a NPE bug in endpoint management. -* Upgraded vulnerable dependencies ([github #68](https://github.com/Azure/azure-cosmosdb-java/issues/68)). -* Added support for Netty network logging for troubleshooting. - -### 2.2.0 -* Added support for Multi-region write. - -### 2.1.0 -* Added support for Proxy. -* Added support for resource token authorization. -* Fixed a bug in handling large partition keys ([github #63](https://github.com/Azure/azure-cosmosdb-java/issues/63)). -* Documentation improved. -* SDK restructured into more granular modules. - -### 2.0.1 -- Fixed a bug for non-english locales ([github #51](https://github.com/Azure/azure-cosmosdb-java/issues/51)). -- Added helper methods for Conflict resource. - -### 2.0.0 -- Replaced org.json dependency by jackson due to performance reasons and licensing ([github #29](https://github.com/Azure/azure-cosmosdb-java/issues/29)). -- Removed deprecated OfferV2 class. -- Added accessor method to Offer class for throughput content. -- Any method in Document/Resource returning org.json types changed to return a jackson object type. -- getObject(.) method of classes extending JsonSerializable changed to return a jackson ObjectNode type. -- getCollection(.) method changed to return Collection of ObjectNode. -- Removed JsonSerializable subclasses' constructors with org.json.JSONObject arg. -- JsonSerializable.toJson (SerializationFormattingPolicy.Indented) now uses two spaces for indentation. - -### 1.0.2 -- Added support for Unique Index Policy. -- Added support for limiting response continuation token size in feed options. -- Added support for Partition Split in Cross Partition Query. -- Fixed a bug in Json timestamp serialization ([github #32](https://github.com/Azure/azure-cosmosdb-java/issues/32)). -- Fixed a bug in Json enum serialization. -- Fixed a bug in managing documents of 2MB size ([github #33](https://github.com/Azure/azure-cosmosdb-java/issues/33)). -- Dependency com.fasterxml.jackson.core:jackson-databind upgraded to 2.9.5 due to a bug ([jackson-databind: github #1599](https://github.com/FasterXML/jackson-databind/issues/1599)) -- Dependency on rxjava-extras upgraded to 0.8.0.17 due to a bug ([rxjava-extras: github #30](https://github.com/davidmoten/rxjava-extras/issues/30)). -- The metadata description in pom file updated to be inline with the rest of documentation. -- Syntax improvement ([github #41](https://github.com/Azure/azure-cosmosdb-java/issues/41)), ([github #40](https://github.com/Azure/azure-cosmosdb-java/issues/40)). - -### 1.0.1 -- Added back-pressure support in query. -- Added support for partition key range id in query. -- Changed to allow larger continuation token in request header (bugfix github #24). -- netty dependency upgraded to 4.1.22.Final to ensure JVM shuts down after main thread finishes. -- Changed to avoid passing session token when reading master resources. -- Added more examples. -- Added more benchmarking scenarios. -- Fixed java header files for proper javadoc generation. - -### 1.0.0 -- Release 1.0.0 has fully end to end support for non-blocking IO using netty library in Gateway mode. -- Dependency on ``azure-documentdb`` SDK removed. -- Artifact id changed to ``azure-cosmosdb`` from ``azure-documentdb-rx`` in 0.9.0-rc2. -- Java package name changed to ``com.microsoft.azure.cosmosdb`` from ``com.microsoft.azure.documentdb`` in 0.9.0-rc2. - -### 0.9.0-rc2 -- ``FeedResponsePage`` renamed to ``FeedReponse`` -- Some minor modifications to ``ConnectionPolicy`` configuration. -All time fields and methods in ConnectionPolicy suffixed with "InMillis" to be more precise of the time unit. -- ``ConnectionPolicy#setProxy()`` removed. -- ``FeedOptions#pageSize`` renamed to -``FeedOptions#maxItemCount`` -- Release 1.0.0 deprecates 0.9.x releases. - -### 0.9.0-rc1 -- First release of ``azure-documentdb-rx`` SDK. -- CRUD Document API fully non-blocking using netty. Query async API implemented as a wrapper using blocking SDK ``azure-documentdb``. diff --git a/cosmosdb/data-plane/commons-test-utils/pom.xml b/cosmosdb/data-plane/commons-test-utils/pom.xml deleted file mode 100644 index f06ce657bcb6..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/pom.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - 4.0.0 - - com.microsoft.azure - azure-cosmosdb-parent - 2.4.5 - - azure-cosmosdb-commons-test-utils - Common Test Components for Testing Async SDK for SQL API of Azure Cosmos DB Service - Common Test Components for Testing Async SDK for SQL API of Azure Cosmos DB Service - jar - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.6.0 - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-eclipse-plugin - 2.8 - - - - org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8 - - - - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - attach-sources - - jar-no-fork - - - - - - - - - - org.apache.maven.plugins - maven-surefire-report-plugin - 2.22.0 - - - org.codehaus.mojo - findbugs-maven-plugin - 3.0.4 - - - org.apache.maven.plugins - maven-jxr-plugin - 2.1 - - - - - - com.microsoft.azure - azure-cosmosdb-commons - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.testng - testng - ${testng.version} - - - org.assertj - assertj-core - ${assertj.version} - - - org.mockito - mockito-all - ${mockito.version} - - - org.slf4j - slf4j-log4j12 - ${slf4j.version} - - - log4j - log4j - ${log4j.version} - - - com.google.guava - guava - ${guava.version} - - - diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/BridgeUtils.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/BridgeUtils.java deleted file mode 100644 index f5e449b53fc9..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/BridgeUtils.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.List; - -/** - * This is a helper class for testing. - */ -public class BridgeUtils { - - public static DatabaseAccount createDatabaseAccount(List readLocations, - List writeLocations, - boolean useMultipleWriteLocations) { - DatabaseAccount dbAccount = new DatabaseAccount(); - dbAccount.setEnableMultipleWriteLocations(useMultipleWriteLocations); - - dbAccount.setReadableLocations(readLocations); - dbAccount.setWritableLocations(writeLocations); - - return dbAccount; - } - - public static DatabaseAccountLocation createDatabaseAccountLocation(String name, String endpoint) { - DatabaseAccountLocation dal = new DatabaseAccountLocation(); - dal.setName(name); - dal.setEndpoint(endpoint); - - return dal; - } - - public static ConflictResolutionPolicy createConflictResolutionPolicy() { - return new ConflictResolutionPolicy(); - } - - public static ConflictResolutionPolicy setMode(ConflictResolutionPolicy policy, ConflictResolutionMode mode) { - policy.setMode(mode); - return policy; - } - - public static ConflictResolutionPolicy setPath(ConflictResolutionPolicy policy, String path) { - policy.setConflictResolutionPath(path); - return policy; - } - - public static ConflictResolutionPolicy setStoredProc(ConflictResolutionPolicy policy, String storedProcLink) { - policy.setConflictResolutionProcedure(storedProcLink); - return policy; - } -} diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/ConfigsBuilder.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/ConfigsBuilder.java deleted file mode 100644 index ff8ec498a823..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/ConfigsBuilder.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import org.mockito.Mockito; - -/** - * This can be used for testing. - */ -public class ConfigsBuilder { - private Configs configs = Mockito.spy(new Configs()); - - public static ConfigsBuilder instance() { - return new ConfigsBuilder(); - } - - public ConfigsBuilder withProtocol(Protocol protocol) { - Mockito.doReturn(protocol).when(configs).getProtocol(); - return this; - } - - public Configs build() { - return configs; - } -} diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/DatabaseForTest.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/DatabaseForTest.java deleted file mode 100644 index 1e646d58e6eb..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/DatabaseForTest.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import org.apache.commons.lang3.RandomStringUtils; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Observable; - -import java.time.Duration; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; - -public class DatabaseForTest { - private static Logger logger = LoggerFactory.getLogger(DatabaseForTest.class); - public static final String SHARED_DB_ID_PREFIX = "RxJava.SDKTest.SharedDatabase"; - private static final Duration CLEANUP_THRESHOLD_DURATION = Duration.ofHours(1); - private static final String DELIMITER = "_"; - private static DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMdd'T'HHmmss"); - - public LocalDateTime createdTime; - public Database createdDatabase; - - private DatabaseForTest(Database db, LocalDateTime createdTime) { - this.createdDatabase = db; - this.createdTime = createdTime; - } - - private boolean isStale() { - return isOlderThan(CLEANUP_THRESHOLD_DURATION); - } - - private boolean isOlderThan(Duration dur) { - return createdTime.isBefore(LocalDateTime.now().minus(dur)); - } - - public static String generateId() { - return SHARED_DB_ID_PREFIX + DELIMITER + TIME_FORMATTER.format(LocalDateTime.now()) + DELIMITER + RandomStringUtils.randomAlphabetic(3); - } - - private static DatabaseForTest from(Database db) { - if (db == null || db.getId() == null || db.getSelfLink() == null) { - return null; - } - - String id = db.getId(); - if (id == null) { - return null; - } - - String[] parts = StringUtils.split(id, DELIMITER); - if (parts.length != 3) { - return null; - } - if (!StringUtils.equals(parts[0], SHARED_DB_ID_PREFIX)) { - return null; - } - - try { - LocalDateTime parsedTime = LocalDateTime.parse(parts[1], TIME_FORMATTER); - return new DatabaseForTest(db, parsedTime); - } catch (Exception e) { - return null; - } - } - - public static DatabaseForTest create(DatabaseManager client) { - Database dbDef = new Database(); - dbDef.setId(generateId()); - - Database db = client.createDatabase(dbDef).toBlocking().single().getResource(); - DatabaseForTest dbForTest = DatabaseForTest.from(db); - assertThat(dbForTest).isNotNull(); - return dbForTest; - } - - public static void cleanupStaleTestDatabases(DatabaseManager client) { - logger.info("Cleaning stale test databases ..."); - List dbs = client.queryDatabases( - new SqlQuerySpec("SELECT * FROM c WHERE STARTSWITH(c.id, @PREFIX)", - new SqlParameterCollection(new SqlParameter("@PREFIX", DatabaseForTest.SHARED_DB_ID_PREFIX)))) - .flatMap(page -> Observable.from(page.getResults())).toList().toBlocking().single(); - - for (Database db : dbs) { - assertThat(db.getId()).startsWith(DatabaseForTest.SHARED_DB_ID_PREFIX); - - DatabaseForTest dbForTest = DatabaseForTest.from(db); - - if (db != null && dbForTest.isStale()) { - logger.info("Deleting database {}", db.getId()); - client.deleteDatabase(db.getId()).toBlocking().single(); - } - } - } - - public interface DatabaseManager { - Observable> queryDatabases(SqlQuerySpec query); - Observable> createDatabase(Database databaseDefinition); - Observable> deleteDatabase(String id); - } -} diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpClientUnderTestWrapper.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpClientUnderTestWrapper.java deleted file mode 100644 index ffb118d8d852..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpClientUnderTestWrapper.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import io.netty.buffer.ByteBuf; -import io.reactivex.netty.client.RxClient; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import static org.mockito.Mockito.doAnswer; - -/** - * This is a helper class for capturing requests sent over a httpClient. - */ -public class HttpClientUnderTestWrapper { - final private CompositeHttpClient origHttpClient; - final private CompositeHttpClient spyHttpClient; - - public final List> capturedRequest = Collections.synchronizedList(new ArrayList<>()); - - public HttpClientUnderTestWrapper(CompositeHttpClient origHttpClient) { - this.origHttpClient = origHttpClient; - this.spyHttpClient = Mockito.spy(origHttpClient); - - initRequestCapture(spyHttpClient); - } - - public CompositeHttpClient getSpyHttpClient() { - return spyHttpClient; - } - - void initRequestCapture(CompositeHttpClient spyClient) { - - doAnswer(new Answer() { - @Override - public Object answer(InvocationOnMock invocationOnMock) throws Throwable { - RxClient.ServerInfo serverInfo = invocationOnMock.getArgumentAt(0, RxClient.ServerInfo.class); - HttpClientRequest httpReq = invocationOnMock.getArgumentAt(1, HttpClientRequest.class); - capturedRequest.add(httpReq); - return origHttpClient.submit(serverInfo, httpReq); - } - }).when(spyClient).submit(Mockito.any(RxClient.ServerInfo.class), Mockito.any(HttpClientRequest.class)); - } -} diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResponseBuilder.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResponseBuilder.java deleted file mode 100644 index 5a1c1900d920..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResponseBuilder.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; - -import java.math.BigDecimal; -import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -public class StoreResponseBuilder { - private int status; - private List> headerEntries; - private String content; - - public static StoreResponseBuilder create() { - return new StoreResponseBuilder(); - } - - public StoreResponseBuilder() { - headerEntries = new ArrayList<>(); - } - - public StoreResponseBuilder withHeader(String key, String value) { - headerEntries.add(new AbstractMap.SimpleEntry(key, value)); - return this; - } - - public StoreResponseBuilder withLSN(long lsn) { - headerEntries.add(new AbstractMap.SimpleEntry(WFConstants.BackendHeaders.LSN, Long.toString(lsn))); - return this; - } - - public StoreResponseBuilder withRequestCharge(BigDecimal requestCharge) { - withRequestCharge(requestCharge.doubleValue()); - return this; - } - - public StoreResponseBuilder withRequestCharge(double requestCharge) { - headerEntries.add(new AbstractMap.SimpleEntry(HttpConstants.HttpHeaders.REQUEST_CHARGE, Double.toString(requestCharge))); - return this; - } - - public StoreResponseBuilder withLocalLSN(long localLsn) { - headerEntries.add(new AbstractMap.SimpleEntry(WFConstants.BackendHeaders.LOCAL_LSN, Long.toString(localLsn))); - return this; - } - - public StoreResponseBuilder withPartitionKeyRangeId(String partitionKeyRangeId) { - headerEntries.add(new AbstractMap.SimpleEntry(WFConstants.BackendHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId)); - return this; - } - - public StoreResponseBuilder withItemLocalLSN(long itemLocalLsn) { - headerEntries.add(new AbstractMap.SimpleEntry(WFConstants.BackendHeaders.ITEM_LOCAL_LSN, Long.toString(itemLocalLsn))); - return this; - } - - public StoreResponseBuilder withQuorumAckecdLsn(long quorumAckecdLsn) { - headerEntries.add(new AbstractMap.SimpleEntry(WFConstants.BackendHeaders.QUORUM_ACKED_LSN, Long.toString(quorumAckecdLsn))); - return this; - } - - public StoreResponseBuilder withQuorumAckecdLocalLsn(long quorumAckecdLocalLsn) { - headerEntries.add(new AbstractMap.SimpleEntry(WFConstants.BackendHeaders.QUORUM_ACKED_LOCAL_LSN, Long.toString(quorumAckecdLocalLsn))); - return this; - } - - public StoreResponseBuilder withGlobalCommittedLsn(long globalCommittedLsn) { - headerEntries.add(new AbstractMap.SimpleEntry(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, Long.toString(globalCommittedLsn))); - return this; - } - - public StoreResponseBuilder withSessionToken(String sessionToken) { - headerEntries.add(new AbstractMap.SimpleEntry(HttpConstants.HttpHeaders.SESSION_TOKEN, sessionToken)); - return this; - } - - public StoreResponseBuilder withStatus(int status) { - this.status = status; - return this; - } - - public StoreResponseBuilder withContent(String content) { - this.content = content; - return this; - } - - public StoreResponse build() { - return new StoreResponse(status, headerEntries, content); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/DocumentServiceRequestContextValidator.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/DocumentServiceRequestContextValidator.java deleted file mode 100644 index 5458c36929b9..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/DocumentServiceRequestContextValidator.java +++ /dev/null @@ -1,97 +0,0 @@ - -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResponse; -import com.microsoft.azure.cosmosdb.rx.internal.DocumentServiceRequestContext; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; - -import java.util.ArrayList; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; - -public interface DocumentServiceRequestContextValidator { - - static Builder builder() { - return new Builder(); - } - - void validate(T v); - - class Builder { - private List> validators = new ArrayList<>(); - - public DocumentServiceRequestContextValidator build() { - return new DocumentServiceRequestContextValidator() { - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void validate(T v) { - for (DocumentServiceRequestContextValidator validator : validators) { - validator.validate(v); - } - } - }; - } - - - public Builder add(DocumentServiceRequestContextValidator validator) { - validators.add(validator); - return this; - } - - public Builder qurorumSelectedLSN(long quoriumSelectedLSN) { - add(new DocumentServiceRequestContextValidator() { - @Override - public void validate(DocumentServiceRequestContext v) { - assertThat(v.quorumSelectedLSN).isEqualTo(quoriumSelectedLSN); - } - }); - return this; - } - - public Builder globalCommittedSelectedLSN(long globalCommittedSelectedLSN) { - add(new DocumentServiceRequestContextValidator() { - @Override - public void validate(DocumentServiceRequestContext v) { - assertThat(v.globalCommittedSelectedLSN).isEqualTo(globalCommittedSelectedLSN); - } - }); - return this; - } - - public Builder storeResponses(List storeResponses) { - add(new DocumentServiceRequestContextValidator() { - @Override - public void validate(DocumentServiceRequestContext v) { - assertThat(v.storeResponses).isEqualTo(storeResponses); - } - }); - return this; - } - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/DocumentServiceRequestValidator.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/DocumentServiceRequestValidator.java deleted file mode 100644 index d26d13cd3c57..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/DocumentServiceRequestValidator.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; - -import java.util.ArrayList; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; - -public interface DocumentServiceRequestValidator { - - static Builder builder() { - return new Builder(); - } - - void validate(T v); - - class Builder { - private List> validators = new ArrayList<>(); - - public DocumentServiceRequestValidator build() { - return new DocumentServiceRequestValidator() { - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void validate(T v) { - for (DocumentServiceRequestValidator validator : validators) { - validator.validate(v); - } - } - }; - } - - public Builder add(DocumentServiceRequestValidator validator) { - validators.add(validator); - return this; - } - - public Builder withResourceType(ResourceType resourceType) { - add(new DocumentServiceRequestValidator() { - @Override - public void validate(T v) { - assertThat(v.getResourceType()).isEqualTo(resourceType); - } - }); - return this; - } - - public Builder withOperationType(OperationType operationType) { - add(new DocumentServiceRequestValidator() { - @Override - public void validate(T v) { - assertThat(v.getOperationType()).isEqualTo(operationType); - } - }); - return this; - } - - public Builder resourceTypeIn(ResourceType... resourceType) { - add(new DocumentServiceRequestValidator() { - @Override - public void validate(T v) { - assertThat(v.getResourceType()).isIn((Object[]) resourceType); - } - }); - return this; - } - - public Builder resourceTypeNotIn(ResourceType... resourceType) { - add(new DocumentServiceRequestValidator() { - @Override - public void validate(T v) { - assertThat(v.getResourceType()).isNotIn((Object[]) resourceType); - } - }); - return this; - } - - public Builder add(DocumentServiceRequestContextValidator validator) { - add(new DocumentServiceRequestValidator() { - @Override - public void validate(RxDocumentServiceRequest request) { - validator.validate(request.requestContext); - } - }); - return this; - } - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/FailureValidator.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/FailureValidator.java deleted file mode 100644 index 2ad5ec534aa6..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/FailureValidator.java +++ /dev/null @@ -1,349 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.WFConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; - -import java.util.ArrayList; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; - -public interface FailureValidator { - - static Builder builder() { - return new Builder(); - } - - void validate(Throwable t); - - class Builder { - private List validators = new ArrayList<>(); - - public FailureValidator build() { - return new FailureValidator() { - @Override - public void validate(Throwable t) { - for (FailureValidator validator : validators) { - validator.validate(t); - } - } - }; - } - - public Builder statusCode(int statusCode) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - assertThat(((DocumentClientException) t).getStatusCode()).isEqualTo(statusCode); - } - }); - return this; - } - - public Builder lsnGreaterThan(long quorumAckedLSN) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - assertThat(BridgeInternal.getLSN((DocumentClientException) t) > quorumAckedLSN).isTrue(); - } - }); - return this; - } - - public Builder lsnGreaterThanEqualsTo(long quorumAckedLSN) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - assertThat(BridgeInternal.getLSN((DocumentClientException) t) >= quorumAckedLSN).isTrue(); - } - }); - return this; - } - - public Builder exceptionQuorumAckedLSNInNotNull() { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - DocumentClientException documentClientException = (DocumentClientException) t; - long exceptionQuorumAckedLSN = -1; - if (documentClientException.getResponseHeaders().get(WFConstants.BackendHeaders.QUORUM_ACKED_LSN) != null) { - exceptionQuorumAckedLSN = Long.parseLong((String) documentClientException.getResponseHeaders().get(WFConstants.BackendHeaders.QUORUM_ACKED_LSN)); - - } - assertThat(exceptionQuorumAckedLSN).isNotEqualTo(-1); - } - }); - return this; - } - - public Builder errorMessageContains(String errorMsg) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t.getMessage()).contains(errorMsg); - } - }); - return this; - } - - public Builder notNullActivityId() { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - assertThat(((DocumentClientException) t).getActivityId()).isNotNull(); - } - }); - return this; - } - - public Builder error(Error error) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - assertThat(((DocumentClientException) t).getError().toJson()).isEqualTo(error.toJson()); - } - }); - return this; - } - - public Builder subStatusCode(Integer substatusCode) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - assertThat(((DocumentClientException) t).getSubStatusCode()).isEqualTo(substatusCode); - } - }); - return this; - } - - public Builder unknownSubStatusCode() { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - assertThat(((DocumentClientException) t).getSubStatusCode()).isEqualTo(HttpConstants.SubStatusCodes.UNKNOWN); - } - }); - return this; - } - - public Builder responseHeader(String key, String value) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - assertThat(((DocumentClientException) t).getResponseHeaders().get(key)).isEqualTo(value); - } - }); - return this; - } - - public Builder lsn(long lsn) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - DocumentClientException ex = (DocumentClientException) t; - assertThat(BridgeInternal.getLSN(ex)).isEqualTo(lsn); - } - }); - return this; - } - - public Builder partitionKeyRangeId(String pkrid) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - DocumentClientException ex = (DocumentClientException) t; - assertThat(BridgeInternal.getPartitionKeyRangeId(ex)).isEqualTo(pkrid); - } - }); - return this; - } - - public Builder resourceAddress(String resourceAddress) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - DocumentClientException ex = (DocumentClientException) t; - assertThat(BridgeInternal.getResourceAddress(ex)).isEqualTo(resourceAddress); - } - }); - return this; - } - - public Builder instanceOf(Class cls) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(cls); - } - }); - return this; - } - - public Builder sameAs(Exception exception) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isSameAs(exception); - } - }); - return this; - } - - public Builder resourceNotFound() { - - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - DocumentClientException ex = (DocumentClientException) t; - assertThat(ex.getStatusCode()).isEqualTo(404); - - } - }); - return this; - } - - public Builder resourceTokenNotFound() { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(IllegalArgumentException.class); - IllegalArgumentException ex = (IllegalArgumentException) t; - assertThat(ex.getMessage()).isEqualTo(RMResources.ResourceTokenNotFound); - } - }); - return this; - } - - public Builder resourceAlreadyExists() { - - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - DocumentClientException ex = (DocumentClientException) t; - assertThat(ex.getStatusCode()).isEqualTo(409); - - } - }); - return this; - } - - public Builder causeInstanceOf(Class cls) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t.getCause()).isNotNull(); - assertThat(t.getCause()).isInstanceOf(cls); - } - }); - return this; - } - - public Builder causeOfCauseInstanceOf(Class cls) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t.getCause()).isNotNull(); - assertThat(t.getCause().getCause()).isNotNull(); - assertThat(t.getCause().getCause()).isInstanceOf(cls); - } - }); - return this; - } - - public Builder documentClientExceptionHeaderRequestContainsEntry(String key, String value) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(DocumentClientException.class); - DocumentClientException ex = (DocumentClientException) t; - assertThat(BridgeInternal.getRequestHeaders(ex)).containsEntry(key, value); - } - }); - return this; - } - - public Builder withRuntimeExceptionMessage(String message) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(RuntimeException.class); - assertThat(t.getMessage()).isEqualTo(message); - } - }); - return this; - } - - public Builder withRuntimeExceptionClass(Class k) { - validators.add(new FailureValidator() { - @Override - public void validate(Throwable t) { - assertThat(t).isNotNull(); - assertThat(t).isInstanceOf(RuntimeException.class); - assertThat(t).isInstanceOf(k); - } - }); - return this; - } - } -} diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/FeedResponseListValidator.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/FeedResponseListValidator.java deleted file mode 100644 index 6356f1363fff..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/FeedResponseListValidator.java +++ /dev/null @@ -1,305 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.time.Duration; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.microsoft.azure.cosmosdb.CompositePath; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.QueryMetrics; -import com.microsoft.azure.cosmosdb.Resource; - -public interface FeedResponseListValidator { - - void validate(List> feedList); - - class Builder { - private List> validators = new ArrayList<>(); - - public FeedResponseListValidator build() { - return new FeedResponseListValidator() { - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void validate(List> feedList) { - for (FeedResponseListValidator validator : validators) { - validator.validate(feedList); - } - } - }; - } - - public Builder totalSize(final int expectedCount) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - int resultCount = feedList.stream().mapToInt(f -> f.getResults().size()).sum(); - assertThat(resultCount) - .describedAs("total number of results").isEqualTo(expectedCount); - } - }); - return this; - } - - public Builder containsExactly(List expectedIds) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - List actualIds = feedList - .stream() - .flatMap(f -> f.getResults().stream()) - .map(r -> r.getResourceId()) - .collect(Collectors.toList()); - assertThat(actualIds) - .describedAs("Resource IDs of results") - .containsExactlyElementsOf(expectedIds); - } - }); - return this; - } - - public Builder validateAllResources(Map> resourceIDToValidator) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - List resources = feedList - .stream() - .flatMap(f -> f.getResults().stream()) - .collect(Collectors.toList()); - - for(T r: resources) { - ResourceValidator validator = resourceIDToValidator.get(r.getResourceId()); - assertThat(validator).isNotNull(); - validator.validate(r); - } - } - }); - return this; - } - - public Builder exactlyContainsInAnyOrder(List expectedIds) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - List actualIds = feedList - .stream() - .flatMap(f -> f.getResults().stream()) - .map(r -> r.getResourceId()) - .collect(Collectors.toList()); - assertThat(actualIds) - .describedAs("Resource IDs of results") - .containsOnlyElementsOf(expectedIds); - } - }); - return this; - } - - public Builder numberOfPages(int expectedNumberOfPages) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - assertThat(feedList) - .describedAs("number of pages") - .hasSize(expectedNumberOfPages); - } - }); - return this; - } - - public Builder numberOfPagesIsGreaterThanOrEqualTo(int leastNumber) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - assertThat(feedList.size()) - .describedAs("number of pages") - .isGreaterThanOrEqualTo(leastNumber); - } - }); - return this; - } - - public Builder totalRequestChargeIsAtLeast(double minimumCharge) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - assertThat(feedList.stream().mapToDouble(p -> p.getRequestCharge()).sum()) - .describedAs("total request charge") - .isGreaterThanOrEqualTo(minimumCharge); - } - }); - return this; - } - - public Builder pageSatisfy(int pageNumber, FeedResponseValidator pageValidator) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - assertThat(feedList.size()).isGreaterThan(pageNumber); - pageValidator.validate(feedList.get(pageNumber)); - } - }); - return this; - } - - public Builder allPagesSatisfy(FeedResponseValidator pageValidator) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - - for(FeedResponse fp: feedList) { - pageValidator.validate(fp); - } - } - }); - return this; - } - - public Builder withAggregateValue(Object value) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - List list = feedList.get(0).getResults(); - Document result = list.size() > 0 ? list.get(0) : null; - - if (result != null) { - if (value instanceof Double) { - - Double d = result.getDouble("_aggregate"); - assertThat(d).isEqualTo(value); - } else if (value instanceof Integer) { - - Integer d = result.getInt("_aggregate"); - assertThat(d).isEqualTo(value); - } else if (value instanceof String) { - - String d = result.getString("_aggregate"); - assertThat(d).isEqualTo(value); - } else if (value instanceof Document){ - - assertThat(result.toString()).isEqualTo(value.toString()); - } else { - - assertThat(result.get("_aggregate")).isNull(); - assertThat(value).isNull(); - } - } else { - - assertThat(value).isNull(); - } - - } - }); - return this; - } - - public Builder withOrderedResults(ArrayList expectedOrderedList, - ArrayList compositeIndex) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - - List resultOrderedList = feedList.stream() - .flatMap(f -> f.getResults().stream()) - .collect(Collectors.toList()); - assertThat(expectedOrderedList.size()).isEqualTo(resultOrderedList.size()); - - ArrayList paths = new ArrayList(); - Iterator compositeIndexIterator = compositeIndex.iterator(); - while (compositeIndexIterator.hasNext()) { - paths.add(compositeIndexIterator.next().getPath().replace("/", "")); - } - for (int i = 0; i < resultOrderedList.size(); i ++) { - ArrayNode resultValues = (ArrayNode) resultOrderedList.get(i).get("$1"); - assertThat(resultValues.size()).isEqualTo(paths.size()); - for (int j = 0; j < paths.size(); j++) { - if (paths.get(j).contains("number")) { - assertThat(expectedOrderedList.get(i).getInt(paths.get(j))).isEqualTo(resultValues.get(j).intValue()); - } else if (paths.get(j).toLowerCase().contains("string")) { - assertThat(expectedOrderedList.get(i).getString(paths.get(j))).isEqualTo(resultValues.get(j).asText()); - } else if (paths.get(j).contains("bool")) { - assertThat(expectedOrderedList.get(i).getBoolean(paths.get(j))).isEqualTo(resultValues.get(j).asBoolean()); - } else { - assertThat(resultValues.get(j).isNull()).isTrue(); - assertThat(expectedOrderedList.get(i).get("nullField")).isNull(); - } - } - } - - } - }); - return this; - } - - public Builder pageLengths(int[] pageLengths) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - assertThat(feedList).hasSize(pageLengths.length); - for (int i = 0; i < pageLengths.length; i++) - assertThat(feedList.get(i).getResults().size()).isEqualTo(pageLengths[i]); - } - }); - return this; - } - - public Builder hasValidQueryMetrics(boolean shouldHaveMetrics) { - validators.add(new FeedResponseListValidator() { - @Override - public void validate(List> feedList) { - for(FeedResponse feedPage: feedList) { - if (shouldHaveMetrics) { - QueryMetrics queryMetrics = BridgeInternal.createQueryMetricsFromCollection(feedPage.getQueryMetrics().values()); - assertThat(queryMetrics.getIndexHitDocumentCount()).isGreaterThanOrEqualTo(0); - assertThat(queryMetrics.getRetrievedDocumentSize()).isGreaterThan(0); - assertThat(queryMetrics.getTotalQueryExecutionTime().compareTo(Duration.ZERO)).isGreaterThan(0); - assertThat(queryMetrics.getOutputDocumentCount()).isGreaterThan(0); - assertThat(queryMetrics.getRetrievedDocumentCount()).isGreaterThan(0); - assertThat(queryMetrics.getDocumentLoadTime().compareTo(Duration.ZERO)).isGreaterThan(0); - assertThat(queryMetrics.getDocumentWriteTime().compareTo(Duration.ZERO)).isGreaterThanOrEqualTo(0); - assertThat(queryMetrics.getVMExecutionTime().compareTo(Duration.ZERO)).isGreaterThan(0); - assertThat(queryMetrics.getQueryPreparationTimes().getLogicalPlanBuildTime().compareTo(Duration.ZERO)).isGreaterThan(0); - assertThat(queryMetrics.getQueryPreparationTimes().getPhysicalPlanBuildTime().compareTo(Duration.ZERO)).isGreaterThanOrEqualTo(0); - assertThat(queryMetrics.getQueryPreparationTimes().getQueryCompilationTime().compareTo(Duration.ZERO)).isGreaterThan(0); - assertThat(queryMetrics.getRuntimeExecutionTimes().getQueryEngineExecutionTime().compareTo(Duration.ZERO)).isGreaterThanOrEqualTo(0); - assertThat(BridgeInternal.getClientSideMetrics(queryMetrics).getRequestCharge()).isGreaterThan(0); - } else { - assertThat(feedPage.getQueryMetrics().isEmpty()); - } - } - } - }); - return this; - } - } -} diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/FeedResponseValidator.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/FeedResponseValidator.java deleted file mode 100644 index d245f6f49593..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/FeedResponseValidator.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; - -public interface FeedResponseValidator { - - void validate(FeedResponse feedList); - - public class Builder { - private List> validators = new ArrayList<>(); - - public FeedResponseValidator build() { - return new FeedResponseValidator() { - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void validate(FeedResponse feedPage) { - for (FeedResponseValidator validator : validators) { - validator.validate(feedPage); - } - } - }; - } - - public Builder pageSizeIsLessThanOrEqualTo(final int maxPageSize) { - - validators.add(new FeedResponseValidator() { - @Override - public void validate(FeedResponse feedPage) { - assertThat(feedPage.getResults().size()).isLessThanOrEqualTo(maxPageSize); - } - }); - return this; - } - - public Builder pageSizeOf(final int expectedCount) { - - validators.add(new FeedResponseValidator() { - @Override - public void validate(FeedResponse feedPage) { - assertThat(feedPage.getResults()).hasSize(expectedCount); - } - }); - return this; - } - - public Builder positiveRequestCharge() { - - validators.add(new FeedResponseValidator() { - @Override - public void validate(FeedResponse feedPage) { - assertThat(feedPage.getRequestCharge()).isPositive(); - } - }); - return this; - } - - public Builder requestChargeGreaterThanOrEqualTo(double minRequestCharge) { - - validators.add(new FeedResponseValidator() { - @Override - public void validate(FeedResponse feedPage) { - assertThat(feedPage.getRequestCharge()).isGreaterThanOrEqualTo(minRequestCharge); - } - }); - return this; - } - - public Builder requestChargeLessThanOrEqualTo(double maxRequestCharge) { - - validators.add(new FeedResponseValidator() { - @Override - public void validate(FeedResponse feedPage) { - assertThat(feedPage.getRequestCharge()).isLessThanOrEqualTo(maxRequestCharge); - } - }); - return this; - } - - public Builder hasHeader(String headerKey) { - - validators.add(new FeedResponseValidator() { - @Override - public void validate(FeedResponse feedPage) { - assertThat(feedPage.getResponseHeaders()).containsKey(headerKey); - } - }); - return this; - } - - public Builder hasRequestChargeHeader() { - - validators.add(new FeedResponseValidator() { - @Override - public void validate(FeedResponse feedPage) { - assertThat(feedPage.getResponseHeaders()).containsKey(HttpConstants.HttpHeaders.REQUEST_CHARGE); - } - }); - return this; - } - - public Builder idsExactlyAre(final List expectedIds) { - validators.add(new FeedResponseValidator() { - @Override - public void validate(FeedResponse feedPage) { - assertThat(feedPage - .getResults().stream() - .map(r -> r.getResourceId()) - .collect(Collectors.toList())) - .containsExactlyElementsOf(expectedIds); - } - }); - return this; - } - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/ResourceResponseValidator.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/ResourceResponseValidator.java deleted file mode 100644 index 0686e7df1336..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/ResourceResponseValidator.java +++ /dev/null @@ -1,379 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.time.Instant; -import java.util.ArrayList; -import java.util.Date; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map.Entry; - -import org.assertj.core.api.Condition; - -import com.microsoft.azure.cosmosdb.Attachment; -import com.microsoft.azure.cosmosdb.CompositePath; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.IndexingMode; -import com.microsoft.azure.cosmosdb.Offer; -import com.microsoft.azure.cosmosdb.Permission; -import com.microsoft.azure.cosmosdb.PermissionMode; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.SpatialSpec; -import com.microsoft.azure.cosmosdb.StoredProcedure; -import com.microsoft.azure.cosmosdb.Trigger; -import com.microsoft.azure.cosmosdb.TriggerOperation; -import com.microsoft.azure.cosmosdb.TriggerType; -import com.microsoft.azure.cosmosdb.UserDefinedFunction; -import com.microsoft.azure.cosmosdb.SpatialType; - -public interface ResourceResponseValidator { - - static Builder builder() { - return new Builder(); - } - - void validate(ResourceResponse resourceResponse); - - class Builder { - private List> validators = new ArrayList<>(); - - public ResourceResponseValidator build() { - return new ResourceResponseValidator() { - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void validate(ResourceResponse resourceResponse) { - for (ResourceResponseValidator validator : validators) { - validator.validate(resourceResponse); - } - } - }; - } - - public Builder withId(final String resourceId) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource()).isNotNull(); - assertThat(resourceResponse.getResource().getId()).as("check Resource Id").isEqualTo(resourceId); - } - }); - return this; - } - - public Builder nullResource() { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource()).isNull(); - } - }); - return this; - } - - public Builder withProperty(String propertyName, Condition validatingCondition) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource()).isNotNull(); - assertThat(resourceResponse.getResource().get(propertyName)).is(validatingCondition); - - } - }); - return this; - } - - public Builder withProperty(String propertyName, Object value) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource()).isNotNull(); - assertThat(resourceResponse.getResource().get(propertyName)).isEqualTo(value); - - } - }); - return this; - } - - - public Builder withTimestampIsAfterOrEqualTo(Instant time) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource()).isNotNull(); - assertThat(resourceResponse.getResource().getTimestamp()).isNotNull(); - Date d = resourceResponse.getResource().getTimestamp(); - System.out.println(d.toString()); - assertThat(d.toInstant()).isAfterOrEqualTo(time); - } - }); - return this; - } - - public Builder withTimestampIsBeforeOrEqualTo(Instant time) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource()).isNotNull(); - assertThat(resourceResponse.getResource().getTimestamp()).isNotNull(); - Date d = resourceResponse.getResource().getTimestamp(); - assertThat(d.toInstant()).isBeforeOrEqualTo(time); - } - }); - return this; - } - - public Builder withPermissionMode(PermissionMode mode) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource().getPermissionMode()).isEqualTo(mode); - } - }); - return this; - } - - public Builder withPermissionResourceLink(String link) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource().getResourceLink()).isEqualTo(link); - } - }); - return this; - } - - public Builder indexingMode(IndexingMode mode) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource()).isNotNull(); - assertThat(resourceResponse.getResource().getIndexingPolicy()).isNotNull(); - assertThat(resourceResponse.getResource().getIndexingPolicy().getIndexingMode()).isEqualTo(mode); - } - }); - return this; - } - - public Builder withStoredProcedureBody(String functionBody) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource().getBody()).isEqualTo(functionBody); - } - }); - return this; - } - - public Builder withUserDefinedFunctionBody(String functionBody) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource().getBody()).isEqualTo(functionBody); - } - }); - return this; - } - - - public Builder withTriggerBody(String functionBody) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource().getBody()).isEqualTo(functionBody); - } - }); - return this; - } - - public Builder notNullEtag() { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource()).isNotNull(); - assertThat(resourceResponse.getResource().getETag()).isNotNull(); - } - }); - return this; - } - - public Builder notEmptySelfLink() { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource()).isNotNull(); - assertThat(resourceResponse.getResource().getSelfLink()).isNotEmpty(); - } - }); - return this; - } - - public Builder withTriggerInternals(TriggerType type, TriggerOperation op) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource().getTriggerType()).isEqualTo(type); - assertThat(resourceResponse.getResource().getTriggerOperation()).isEqualTo(op); - } - }); - return this; - } - - public Builder withContentType(final String contentType) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource().getContentType()).isEqualTo(contentType); - } - }); - return this; - } - - public Builder withOfferThroughput(int throughput) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource().getThroughput()) - .isEqualTo(throughput); - } - }); - return this; - } - - public Builder validatePropertyCondition(String key, Condition condition) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - assertThat(resourceResponse.getResource()).isNotNull(); - assertThat(resourceResponse.getResource().get(key)).is(condition); - - } - }); - return this; - } - - public Builder withCompositeIndexes(Collection> compositeIndexesWritten) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - Iterator> compositeIndexesReadIterator = resourceResponse.getResource() - .getIndexingPolicy().getCompositeIndexes().iterator(); - Iterator> compositeIndexesWrittenIterator = compositeIndexesWritten.iterator(); - - ArrayList readIndexesStrings = new ArrayList(); - ArrayList writtenIndexesStrings = new ArrayList(); - - while (compositeIndexesReadIterator.hasNext() && compositeIndexesWrittenIterator.hasNext()) { - Iterator compositeIndexReadIterator = compositeIndexesReadIterator.next().iterator(); - Iterator compositeIndexWrittenIterator = compositeIndexesWrittenIterator.next().iterator(); - - StringBuilder readIndexesString = new StringBuilder(); - StringBuilder writtenIndexesString = new StringBuilder(); - - while (compositeIndexReadIterator.hasNext() && compositeIndexWrittenIterator.hasNext()) { - CompositePath compositePathRead = compositeIndexReadIterator.next(); - CompositePath compositePathWritten = compositeIndexWrittenIterator.next(); - - readIndexesString.append(compositePathRead.getPath() + ":" + compositePathRead.getOrder() + ";"); - writtenIndexesString.append(compositePathWritten.getPath() + ":" + compositePathRead.getOrder() + ";"); - } - - readIndexesStrings.add(readIndexesString.toString()); - writtenIndexesStrings.add(writtenIndexesString.toString()); - } - - assertThat(readIndexesStrings).containsExactlyInAnyOrderElementsOf(writtenIndexesStrings); - } - }); - return this; - } - - public Builder withSpatialIndexes(Collection spatialIndexes) { - validators.add(new ResourceResponseValidator() { - - @Override - public void validate(ResourceResponse resourceResponse) { - Iterator spatialIndexesReadIterator = resourceResponse.getResource() - .getIndexingPolicy().getSpatialIndexes().iterator(); - Iterator spatialIndexesWrittenIterator = spatialIndexes.iterator(); - - HashMap> readIndexMap = new HashMap>(); - HashMap> writtenIndexMap = new HashMap>(); - - while (spatialIndexesReadIterator.hasNext() && spatialIndexesWrittenIterator.hasNext()) { - SpatialSpec spatialSpecRead = spatialIndexesReadIterator.next(); - SpatialSpec spatialSpecWritten = spatialIndexesWrittenIterator.next(); - - String readPath = spatialSpecRead.getPath() + ":"; - String writtenPath = spatialSpecWritten.getPath() + ":"; - - ArrayList readSpatialTypes = new ArrayList(); - ArrayList writtenSpatialTypes = new ArrayList(); - - Iterator spatialTypesReadIterator = spatialSpecRead.getSpatialTypes().iterator(); - Iterator spatialTypesWrittenIterator = spatialSpecWritten.getSpatialTypes().iterator(); - - while (spatialTypesReadIterator.hasNext() && spatialTypesWrittenIterator.hasNext()) { - readSpatialTypes.add(spatialTypesReadIterator.next()); - writtenSpatialTypes.add(spatialTypesWrittenIterator.next()); - } - - readIndexMap.put(readPath, readSpatialTypes); - writtenIndexMap.put(writtenPath, writtenSpatialTypes); - } - - for (Entry> entry : readIndexMap.entrySet()) { - assertThat(entry.getValue()) - .containsExactlyInAnyOrderElementsOf(writtenIndexMap.get(entry.getKey())); - } - } - }); - return this; - } - } -} diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/ResourceValidator.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/ResourceValidator.java deleted file mode 100644 index a95a6346089c..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/ResourceValidator.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; - -import com.microsoft.azure.cosmosdb.Resource; - -interface ResourceValidator { - - void validate(T v); - - class Builder { - private List> validators = new ArrayList<>(); - - public ResourceValidator build() { - return new ResourceValidator() { - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - public void validate(T v) { - for (ResourceValidator validator : validators) { - validator.validate(v); - } - } - }; - } - - public Builder areEqual(T expectedValue) { - validators.add(new ResourceValidator() { - @Override - public void validate(T v) { - - assertThat(v.getHashMap().keySet()) - .describedAs("number of fields"). - hasSize(expectedValue.getHashMap().keySet().size()); - expectedValue.getHashMap().keySet(); - for(String key: expectedValue.getHashMap().keySet()) { - assertThat(expectedValue.get(key)) - .describedAs("value for " + key) - .isEqualTo(expectedValue.get(key)); - } - } - }); - return this; - } - - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/TestConfigurations.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/TestConfigurations.java deleted file mode 100644 index a6f115439e9e..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/TestConfigurations.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import org.apache.commons.lang3.StringUtils; - -import com.google.common.base.Strings; - -/** - * Contains the configurations for tests. - * - * For running tests, you can pass a customized endpoint configuration in one of the following - * ways: - *
    - *
  • -DACCOUNT_KEY="[your-key]" -ACCOUNT_HOST="[your-endpoint]" as JVM - * command-line option.
  • - *
  • You can set ACCOUNT_KEY and ACCOUNT_HOST as environment variables.
  • - *
- * - * If none of the above is set, emulator endpoint will be used. - */ -public final class TestConfigurations { - // Replace MASTER_KEY and HOST with values from your Azure Cosmos DB account. - // The default values are credentials of the local emulator, which are not used in any production environment. - // - public static String MASTER_KEY = - System.getProperty("ACCOUNT_KEY", - StringUtils.defaultString(Strings.emptyToNull( - System.getenv().get("ACCOUNT_KEY")), - "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==")); - - public static String HOST = - System.getProperty("ACCOUNT_HOST", - StringUtils.defaultString(Strings.emptyToNull( - System.getenv().get("ACCOUNT_HOST")), - "https://localhost:443/")); - - public static String CONSISTENCY = - System.getProperty("ACCOUNT_CONSISTENCY", - StringUtils.defaultString(Strings.emptyToNull( - System.getenv().get("ACCOUNT_CONSISTENCY")), "Strong")); - - public static String PREFERRED_LOCATIONS = - System.getProperty("PREFERRED_LOCATIONS", - StringUtils.defaultString(Strings.emptyToNull( - System.getenv().get("PREFERRED_LOCATIONS")), null)); -} diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/Utils.java b/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/Utils.java deleted file mode 100644 index 9bc18381d95d..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/java/com/microsoft/azure/cosmosdb/rx/Utils.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.Database; - -public class Utils { - private static final String DATABASES_PATH_SEGMENT = "dbs"; - private static final String COLLECTIONS_PATH_SEGMENT = "colls"; - private static final String DOCUMENTS_PATH_SEGMENT = "docs"; - private static final String USERS_PATH_SEGMENT = "users"; - - public static String getDatabaseLink(Database database, boolean isNameBased) { - if (isNameBased) { - return getDatabaseNameLink(database.getId()); - } else { - return database.getSelfLink(); - } - } - - public static String getDatabaseNameLink(String databaseId) { - return DATABASES_PATH_SEGMENT + "/" + databaseId; - } - - public static String getCollectionNameLink(String databaseId, String collectionId) { - - return DATABASES_PATH_SEGMENT + "/" + databaseId + "/" + COLLECTIONS_PATH_SEGMENT + "/" + collectionId; - } - - public static String getDocumentNameLink(String databaseId, String collectionId, String docId) { - - return DATABASES_PATH_SEGMENT + "/" + databaseId + "/" + COLLECTIONS_PATH_SEGMENT + "/" +collectionId + "/" + DOCUMENTS_PATH_SEGMENT + "/" + docId; - } - - public static String getUserNameLink(String databaseId, String userId) { - - return DATABASES_PATH_SEGMENT + "/" + databaseId + "/" + USERS_PATH_SEGMENT + "/" + userId; - } - - private Utils() { - } -} diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/tests/java/com/microsoft/azure/cosmosdb/ConfigsBuilderTest.java b/cosmosdb/data-plane/commons-test-utils/src/main/tests/java/com/microsoft/azure/cosmosdb/ConfigsBuilderTest.java deleted file mode 100644 index cf49065ef5bf..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/tests/java/com/microsoft/azure/cosmosdb/ConfigsBuilderTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import org.testng.annotations.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -public class ConfigsBuilderTest { - - @Test(groups = { "unit" }) - public void defaultProtocol() { - Configs config = ConfigsBuilder.instance().build(); - assertThat(config.getProtocol()).isEqualTo(Protocol.Https); - } - - @Test(groups = { "unit" }) - public void tcp() { - Configs config = ConfigsBuilder.instance().withProtocol(Protocol.Tcp).build(); - assertThat(config.getProtocol()).isEqualTo(Protocol.Tcp); - } - - @Test(groups = { "unit" }) - public void https() { - Configs config = ConfigsBuilder.instance().withProtocol(Protocol.Https).build(); - assertThat(config.getProtocol()).isEqualTo(Protocol.Https); - } -} diff --git a/cosmosdb/data-plane/commons-test-utils/src/main/tests/resources/log4j.properties b/cosmosdb/data-plane/commons-test-utils/src/main/tests/resources/log4j.properties deleted file mode 100644 index 1f3287c67a55..000000000000 --- a/cosmosdb/data-plane/commons-test-utils/src/main/tests/resources/log4j.properties +++ /dev/null @@ -1,15 +0,0 @@ -# this is the log4j configuration for tests - -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=INFO, A1 - -# Set HTTP components' logger to INFO - -log4j.category.io.netty=INFO -log4j.category.io.reactivex=INFO -# A1 is set to be a ConsoleAppender. -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%d %5X{pid} [%t] %-5p %c - %m%n diff --git a/cosmosdb/data-plane/commons/pom.xml b/cosmosdb/data-plane/commons/pom.xml deleted file mode 100644 index 103f302b51ba..000000000000 --- a/cosmosdb/data-plane/commons/pom.xml +++ /dev/null @@ -1,204 +0,0 @@ - - - 4.0.0 - - com.microsoft.azure - azure-cosmosdb-parent - 2.4.5 - - azure-cosmosdb-commons - Common Components for Async SDK for SQL API of Azure Cosmos DB Service - Common Components for Async SDK for SQL API of Azure Cosmos DB Service - jar - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.6.0 - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-eclipse-plugin - 2.8 - - - - org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8 - - - - - - - - - - org.apache.maven.plugins - maven-surefire-report-plugin - 2.22.0 - - - org.codehaus.mojo - findbugs-maven-plugin - 3.0.4 - - - org.apache.maven.plugins - maven-jxr-plugin - 2.1 - - - - - - com.fasterxml.jackson.core - jackson-databind - ${jackson-databind.version} - - - com.fasterxml.uuid - java-uuid-generator - ${java-uuid-generator.version} - - - commons-io - commons-io - ${commons-io.version} - - - commons-validator - commons-validator - ${commons-validator.version} - - - com.github.davidmoten - rxjava-extras - ${rxjava-extras.version} - - - io.reactivex - rxjava - ${rxjava.version} - - - io.reactivex - rxjava-string - ${rxjava-string.version} - - - io.reactivex - rxnetty - ${rxnetty.version} - - - io.netty - netty-transport-native-epoll - - - - - io.netty - netty-codec-http - ${netty.version} - - - io.netty - netty-handler - ${netty.version} - - - io.netty - netty-transport - ${netty.version} - - - io.netty - netty-handler-proxy - ${netty.version} - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.apache.commons - commons-lang3 - ${commons-lang3.version} - - - org.apache.commons - commons-collections4 - 4.2 - - - org.apache.commons - commons-text - ${commons-text.version} - - - org.testng - testng - ${testng.version} - test - - - org.assertj - assertj-core - ${assertj.version} - test - - - org.mockito - mockito-all - ${mockito.version} - test - - - org.slf4j - slf4j-log4j12 - ${slf4j.version} - test - - - log4j - log4j - ${log4j.version} - test - - - com.google.guava - guava - ${guava.version} - test - - - diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/AccessCondition.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/AccessCondition.java deleted file mode 100644 index ecf664d5795a..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/AccessCondition.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Represents a set of access conditions to be used for operations against the Azure Cosmos DB database service. - */ -public final class AccessCondition { - - private AccessConditionType type = AccessConditionType.IfMatch; - private String condition; - - /** - * Gets the condition type. - * - * @return the condition type. - */ - public AccessConditionType getType() { - return this.type; - } - - /** - * Sets the condition type. - * - * @param type the condition type to use. - */ - public void setType(AccessConditionType type) { - this.type = type; - } - - /** - * Gets the value of the condition - for AccessConditionType IfMatchs and IfNotMatch, this is the ETag that has to - * be compared to. - * - * @return the condition. - */ - public String getCondition() { - return this.condition; - } - - /** - * Sets the value of the condition - for AccessConditionType IfMatchs and IfNotMatch, this is the ETag that has to - * be compared to. - * - * @param condition the condition to use. - */ - public void setCondition(String condition) { - this.condition = condition; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/AccessConditionType.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/AccessConditionType.java deleted file mode 100644 index 1366079dfe2a..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/AccessConditionType.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Specifies the set of access condition types that can be used for operations in the Azure Cosmos DB database service. - */ -public enum AccessConditionType { - /** - * Check if the resource's ETag value matches the ETag value performed. - */ - IfMatch, - - /** - * Check if the resource's ETag value does not match ETag value performed. - */ - IfNoneMatch -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Attachment.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Attachment.java deleted file mode 100644 index 203c778242d3..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Attachment.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents a document attachment in the Azure Cosmos DB database service. - *

- * Each document may contain zero or more attachments. Attachments can be of any MIME type - text, image, binary data. - * These are stored externally in Azure Blob storage. Attachments are automatically deleted when the parent document - * is deleted. - */ -public class Attachment extends Resource { - /** - * Initialize an attachment object. - */ - public Attachment() { - super(); - } - - /** - * Initialize an attachment object from json string. - * - * @param source the json string representation of the Attachment. - */ - public Attachment(String source) { - super(source); - } - - /** - * Gets the MIME content type of the attachment. - * - * @return the content type. - */ - public String getContentType() { - return super.getString(Constants.Properties.CONTENT_TYPE); - } - - /** - * Sets the MIME content type of the attachment. - * - * @param contentType the content type to use. - */ - public void setContentType(String contentType) { - super.set(Constants.Properties.CONTENT_TYPE, contentType); - } - - /** - * Gets the media link associated with the attachment content. - * - * @return the media link. - */ - public String getMediaLink() { - return super.getString(Constants.Properties.MEDIA_LINK); - } - - /** - * Sets the media link associated with the attachment content. - * - * @param mediaLink the media link to use. - */ - public void setMediaLink(String mediaLink) { - super.set(Constants.Properties.MEDIA_LINK, mediaLink); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/BridgeInternal.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/BridgeInternal.java deleted file mode 100644 index e0bc79144077..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/BridgeInternal.java +++ /dev/null @@ -1,285 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.query.metrics.ClientSideMetrics; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; - -import java.net.URI; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentMap; - -import static com.microsoft.azure.cosmosdb.internal.Constants.QueryExecutionContext.INCREMENTAL_FEED_HEADER_VALUE; - - -/** - * This is meant to be used only internally as a bridge access to classes in - * com.microsoft.azure.cosmosdb - **/ -public class BridgeInternal { - - public static Error createError(ObjectNode objectNode) { - return new Error(objectNode); - } - - public static Document documentFromObject(Object document, ObjectMapper mapper) { - return Document.FromObject(document, mapper); - } - - public static ResourceResponse toResourceResponse(RxDocumentServiceResponse response, - Class cls) { - return new ResourceResponse(response, cls); - } - - public static MediaResponse toMediaResponse(RxDocumentServiceResponse response, boolean willBuffer) { - return new MediaResponse(response, willBuffer); - } - - public static FeedResponse toFeedResponsePage(RxDocumentServiceResponse response, - Class cls) { - return new FeedResponse(response.getQueryResponse(cls), response.getResponseHeaders()); - } - - public static FeedResponse toChaneFeedResponsePage(RxDocumentServiceResponse response, - Class cls) { - return new FeedResponse(noChanges(response) ? Collections.emptyList(): response.getQueryResponse(cls), response.getResponseHeaders(), noChanges(response)); - } - - public static StoredProcedureResponse toStoredProcedureResponse(RxDocumentServiceResponse response) { - return new StoredProcedureResponse(response); - } - - public static DatabaseAccount toDatabaseAccount(RxDocumentServiceResponse response) { - DatabaseAccount account = response.getResource(DatabaseAccount.class); - - // read the headers and set to the account - Map responseHeader = response.getResponseHeaders(); - - account.setMaxMediaStorageUsageInMB( - Long.valueOf(responseHeader.get(HttpConstants.HttpHeaders.MAX_MEDIA_STORAGE_USAGE_IN_MB))); - account.setMediaStorageUsageInMB( - Long.valueOf(responseHeader.get(HttpConstants.HttpHeaders.CURRENT_MEDIA_STORAGE_USAGE_IN_MB))); - - return account; - } - - public static Map getFeedHeaders(FeedOptionsBase options) { - - if (options == null) - return new HashMap<>(); - - Map headers = new HashMap<>(); - - if (options.getMaxItemCount() != null) { - headers.put(HttpConstants.HttpHeaders.PAGE_SIZE, options.getMaxItemCount().toString()); - } - - if (options instanceof ChangeFeedOptions) { - ChangeFeedOptions changeFeedOptions = (ChangeFeedOptions) options; - - String ifNoneMatchValue = null; - if (changeFeedOptions.getRequestContinuation() != null) { - ifNoneMatchValue = changeFeedOptions.getRequestContinuation(); - } else if (!changeFeedOptions.isStartFromBeginning()) { - ifNoneMatchValue = "*"; - } - // On REST level, change feed is using IfNoneMatch/ETag instead of - // continuation. - if (ifNoneMatchValue != null) { - headers.put(HttpConstants.HttpHeaders.IF_NONE_MATCH, ifNoneMatchValue); - } - - headers.put(HttpConstants.HttpHeaders.A_IM, INCREMENTAL_FEED_HEADER_VALUE); - } else if (options.getRequestContinuation() != null) { - headers.put(HttpConstants.HttpHeaders.CONTINUATION, options.getRequestContinuation()); - } - - FeedOptions feedOptions = options instanceof FeedOptions ? (FeedOptions) options : null; - if (feedOptions != null) { - if (feedOptions.getSessionToken() != null) { - headers.put(HttpConstants.HttpHeaders.SESSION_TOKEN, feedOptions.getSessionToken()); - } - - if (feedOptions.getEnableScanInQuery() != null) { - headers.put(HttpConstants.HttpHeaders.ENABLE_SCAN_IN_QUERY, - feedOptions.getEnableScanInQuery().toString()); - } - - if (feedOptions.getEmitVerboseTracesInQuery() != null) { - headers.put(HttpConstants.HttpHeaders.EMIT_VERBOSE_TRACES_IN_QUERY, - feedOptions.getEmitVerboseTracesInQuery().toString()); - } - - if (feedOptions.getEnableCrossPartitionQuery() != null) { - headers.put(HttpConstants.HttpHeaders.ENABLE_CROSS_PARTITION_QUERY, - feedOptions.getEnableCrossPartitionQuery().toString()); - } - - if (feedOptions.getMaxDegreeOfParallelism() != 0) { - headers.put(HttpConstants.HttpHeaders.PARALLELIZE_CROSS_PARTITION_QUERY, Boolean.TRUE.toString()); - } - - if (feedOptions.getResponseContinuationTokenLimitInKb() > 0) { - headers.put(HttpConstants.HttpHeaders.RESPONSE_CONTINUATION_TOKEN_LIMIT_IN_KB, - Strings.toString(feedOptions.getResponseContinuationTokenLimitInKb())); - } - - if(feedOptions.getPopulateQueryMetrics()){ - headers.put(HttpConstants.HttpHeaders.POPULATE_QUERY_METRICS, String.valueOf(feedOptions.getPopulateQueryMetrics())); - } - } - - return headers; - } - - public static boolean noChanges(FeedResponse page) { - return page.nochanges; - } - - public static boolean noChanges(RxDocumentServiceResponse rsp) { - return rsp.getStatusCode() == HttpConstants.StatusCodes.NOT_MODIFIED; - } - - public static FeedResponse createFeedResponse(List results, Map headers) { - return new FeedResponse<>(results, headers); - } - - public static FeedResponse createFeedResponseWithQueryMetrics(List results, Map headers, ConcurrentMap queryMetricsMap) { - return new FeedResponse<>(results, headers, queryMetricsMap); - } - - public static E setResourceAddress(E e, String resourceAddress) { - e.resourceAddress = resourceAddress; - return e; - } - - public static long getLSN(E e) { - return e.lsn; - } - - public static String getPartitionKeyRangeId(E e) { - return e.partitionKeyRangeId; - } - - public static String getResourceAddress(E e) { - return e.resourceAddress; - } - - public static E setLSN(E e, long lsn) { - e.lsn = lsn; - return e; - } - - public static E setPartitionKeyRangeId(E e, String partitionKeyRangeId) { - e.partitionKeyRangeId = partitionKeyRangeId; - return e; - } - - public static boolean isEnableMultipleWriteLocations(DatabaseAccount account) { - return account.isEnableMultipleWriteLocations(); - } - - public static boolean getUseMultipleWriteLocations(ConnectionPolicy policy) { - return policy.isUsingMultipleWriteLocations(); - } - - public static void setUseMultipleWriteLocations(ConnectionPolicy policy, boolean value) { - policy.setUsingMultipleWriteLocations(value); - } - - public static URI getRequestUri(DocumentClientException documentClientException) { - return documentClientException.requestUri; - } - - public static void setRequestHeaders(DocumentClientException documentClientException, Map requestHeaders) { - documentClientException.requestHeaders = requestHeaders; - } - - public static Map getRequestHeaders(DocumentClientException documentClientException) { - return documentClientException.requestHeaders; - } - - public static Map getQueryEngineConfiuration(DatabaseAccount databaseAccount) { - return databaseAccount.getQueryEngineConfiuration(); - } - - public static ReplicationPolicy getReplicationPolicy(DatabaseAccount databaseAccount) { - return databaseAccount.getReplicationPolicy(); - } - - public static ReplicationPolicy getSystemReplicationPolicy(DatabaseAccount databaseAccount) { - return databaseAccount.getSystemReplicationPolicy(); - } - - public static ConsistencyPolicy getConsistencyPolicy(DatabaseAccount databaseAccount) { - return databaseAccount.getConsistencyPolicy(); - } - - public static String getAltLink(Resource resource) { - return resource.getAltLink(); - } - - public static void setAltLink(Resource resource, String altLink) { - resource.setAltLink(altLink); - } - - public static void setMaxReplicaSetSize(ReplicationPolicy replicationPolicy, int value) { - replicationPolicy.setMaxReplicaSetSize(value); - } - - public static void putQueryMetricsIntoMap(FeedResponse response, - String partitionKeyRangeId, - QueryMetrics queryMetrics){ - response.getQueryMetricsMap().put(partitionKeyRangeId, queryMetrics); - } - - public static QueryMetrics createQueryMetricsFromDelimitedStringAndClientSideMetrics(String queryMetricsDelimitedString, - ClientSideMetrics clientSideMetrics, - String activityId) { - return QueryMetrics.createFromDelimitedStringAndClientSideMetrics(queryMetricsDelimitedString, clientSideMetrics, activityId); - } - - public static QueryMetrics createQueryMetricsFromCollection(Collection queryMetricsCollection) { - return QueryMetrics.createFromCollection(queryMetricsCollection); - } - - public static ClientSideMetrics getClientSideMetrics(QueryMetrics queryMetrics){ - return queryMetrics.getClientSideMetrics(); - } - - public static String getInnerErrorMessage(DocumentClientException documentClientException) { - if (documentClientException == null) { - return null; - } - return documentClientException.getInnerErrorMessage(); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ChangeFeedOptions.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ChangeFeedOptions.java deleted file mode 100644 index a52595d59443..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ChangeFeedOptions.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.time.ZonedDateTime; - -/** - * Specifies the options associated with change feed methods (enumeration operations) in the Azure Cosmos DB database service. - */ -public final class ChangeFeedOptions extends FeedOptionsBase { - private String partitionKeyRangeId; - private boolean startFromBeginning; - private ZonedDateTime startDateTime; - - public ChangeFeedOptions() {} - - public ChangeFeedOptions(ChangeFeedOptions options) { - super(options); - this.partitionKeyRangeId = options.partitionKeyRangeId; - this.startFromBeginning = options.startFromBeginning; - this.startDateTime = options.startDateTime; - } - - /** - * Get the partition key range id for the current request - *

- * ChangeFeed requests can be executed against specific partition key ranges. - * This is used to process the change feed in parallel across multiple consumers. - *

- * - * @return a string indicating the partition key range ID - * @see PartitionKeyRange - */ - public String getPartitionKeyRangeId() { - return partitionKeyRangeId; - } - - /** - * Set the partition key range id for the current request - *

- * ChangeFeed requests can be executed against specific partition key ranges. - * This is used to process the change feed in parallel across multiple consumers. - *

- * - * @param partitionKeyRangeId a string indicating the partition key range ID - * @see PartitionKeyRange - */ - public void setPartitionKeyRangeId(String partitionKeyRangeId) { - this.partitionKeyRangeId = partitionKeyRangeId; - } - - /** - * Get whether change feed should start from beginning (true) or from current (false). - * By default it's start from current (false). - * - * @return a boolean value indicating change feed should start from beginning or not - */ - public boolean isStartFromBeginning() { - return startFromBeginning; - } - - /** - * Set whether change feed should start from beginning (true) or from current (false). - * By default it's start from current (false). - * - * @param startFromBeginning a boolean value indicating change feed should start from beginning or not - */ - public void setStartFromBeginning(boolean startFromBeginning) { - this.startFromBeginning = startFromBeginning; - } - - /** - * Gets the zoned date time to start looking for changes after. - * @return a zoned date time to start looking for changes after, if set or null otherwise - */ - public ZonedDateTime getStartDateTime() { - return startDateTime; - } - - /** - * Sets the zoned date time (exclusive) to start looking for changes after. - * If this is specified, startFromBeginning is ignored. - * @param startDateTime a zoned date time to start looking for changes after. - */ - public void setStartDateTime(ZonedDateTime startDateTime) { - this.startDateTime = startDateTime; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ClientSideRequestStatistics.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ClientSideRequestStatistics.java deleted file mode 100644 index cc71e6b391f5..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ClientSideRequestStatistics.java +++ /dev/null @@ -1,275 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb; - -import java.net.URI; -import java.net.URISyntaxException; -import java.time.Duration; -import java.time.LocalDateTime; -import java.time.ZoneOffset; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; - -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResult; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.apache.commons.lang3.StringUtils; - -public class ClientSideRequestStatistics { - - private final static int MAX_SUPPLEMENTAL_REQUESTS_FOR_TO_STRING = 10; - - private final static DateTimeFormatter responseTimeFormatter = DateTimeFormatter.ofPattern("dd MMM yyyy HH:mm:ss.SSS").withLocale(Locale.US); - - private ZonedDateTime requestStartTime; - private ZonedDateTime requestEndTime; - - private List responseStatisticsList; - private List supplementalResponseStatisticsList; - private Map addressResolutionStatistics; - - private List contactedReplicas; - private Set failedReplicas; - private Set regionsContacted; - - public ClientSideRequestStatistics() { - this.requestStartTime = ZonedDateTime.now(ZoneOffset.UTC); - this.requestEndTime = ZonedDateTime.now(ZoneOffset.UTC); - this.responseStatisticsList = new ArrayList<>(); - this.supplementalResponseStatisticsList = new ArrayList<>(); - this.addressResolutionStatistics = new HashMap<>(); - this.contactedReplicas = new ArrayList<>(); - this.failedReplicas = new HashSet<>(); - this.regionsContacted = new HashSet<>(); - } - - public Duration getRequestLatency() { - return Duration.between(requestStartTime, requestEndTime); - } - - private boolean isCPUOverloaded() { - // NOTE: CPUMonitor and CPULoadHistory is not implemented in async SDK yet. - return false; - } - - public void recordResponse(RxDocumentServiceRequest request, StoreResult storeResult) { - ZonedDateTime responseTime = ZonedDateTime.now(ZoneOffset.UTC); - - StoreResponseStatistics storeResponseStatistics = new StoreResponseStatistics(); - storeResponseStatistics.requestResponseTime = responseTime; - storeResponseStatistics.storeResult = storeResult; - storeResponseStatistics.requestOperationType = request.getOperationType(); - storeResponseStatistics.requestResourceType = request.getResourceType(); - - URI locationEndPoint = null; - if (request.requestContext.locationEndpointToRoute != null) { - try { - locationEndPoint = request.requestContext.locationEndpointToRoute.toURI(); - } catch (URISyntaxException e) { - throw new IllegalArgumentException(e); - } - } - - synchronized (this) { - if (responseTime.isAfter(this.requestEndTime)) { - this.requestEndTime = responseTime; - } - - if (locationEndPoint != null) { - this.regionsContacted.add(locationEndPoint); - } - - if (storeResponseStatistics.requestOperationType == OperationType.Head || - storeResponseStatistics.requestOperationType == OperationType.HeadFeed) { - this.supplementalResponseStatisticsList.add(storeResponseStatistics); - } else { - this.responseStatisticsList.add(storeResponseStatistics); - } - } - } - - public String recordAddressResolutionStart(URI targetEndpoint) { - String identifier = Utils.randomUUID().toString(); - - AddressResolutionStatistics resolutionStatistics = new AddressResolutionStatistics(); - resolutionStatistics.startTime = ZonedDateTime.now(ZoneOffset.UTC); - // Very far in the future - resolutionStatistics.endTime = ZonedDateTime.of(LocalDateTime.MAX, ZoneOffset.UTC); - resolutionStatistics.targetEndpoint = targetEndpoint == null ? "" : targetEndpoint.toString(); - - synchronized (this) { - this.addressResolutionStatistics.put(identifier, resolutionStatistics); - } - - return identifier; - } - - public void recordAddressResolutionEnd(String identifier) { - if (StringUtils.isEmpty(identifier)) { - return; - } - ZonedDateTime responseTime = ZonedDateTime.now(ZoneOffset.UTC); - - synchronized (this) { - if (!this.addressResolutionStatistics.containsKey(identifier)) { - throw new IllegalArgumentException("Identifier " + identifier + " does not exist. Please call start before calling end"); - } - - if (responseTime.isAfter(this.requestEndTime)) { - this.requestEndTime = responseTime; - } - - AddressResolutionStatistics resolutionStatistics = this.addressResolutionStatistics.get(identifier); - resolutionStatistics.endTime = responseTime; - } - } - - @Override - public String toString() { - StringBuilder stringBuilder = new StringBuilder(); - - // need to lock in case of concurrent operations. this should be extremely rare since toString() - // should only be called at the end of request. - synchronized (this) { - - // first trace request start time, as well as total non-head/headfeed requests made. - stringBuilder.append("RequestStartTime: ") - .append("\"").append(this.requestStartTime.format(responseTimeFormatter)).append("\"") - .append(", ") - .append("RequestEndTime: ") - .append("\"").append(this.requestEndTime.format(responseTimeFormatter)).append("\"") - .append(", ") - .append("Duration: ") - .append(Duration.between(requestStartTime, requestEndTime).toMillis()) - .append(" ms, ") - .append("Number of regions attempted: ") - .append(this.regionsContacted.isEmpty() ? 1 : this.regionsContacted.size()) - .append(System.lineSeparator()); - - // take all responses here - this should be limited in number and each one contains relevant information. - for (StoreResponseStatistics storeResponseStatistics : this.responseStatisticsList) { - stringBuilder.append(storeResponseStatistics.toString()).append(System.lineSeparator()); - } - - // take all responses here - this should be limited in number and each one is important. - for (AddressResolutionStatistics value : this.addressResolutionStatistics.values()) { - stringBuilder.append(value.toString()).append(System.lineSeparator()); - } - - // only take last 10 responses from this list - this has potential of having large number of entries. - // since this is for establishing consistency, we can make do with the last responses to paint a meaningful picture. - int supplementalResponseStatisticsListCount = this.supplementalResponseStatisticsList.size(); - int initialIndex = Math.max(supplementalResponseStatisticsListCount - MAX_SUPPLEMENTAL_REQUESTS_FOR_TO_STRING, 0); - if (initialIndex != 0) { - stringBuilder.append(" -- Displaying only the last ") - .append(MAX_SUPPLEMENTAL_REQUESTS_FOR_TO_STRING) - .append(" head/headfeed requests. Total head/headfeed requests: ") - .append(supplementalResponseStatisticsListCount); - } - for (int i = initialIndex; i < supplementalResponseStatisticsListCount; i++) { - stringBuilder.append(this.supplementalResponseStatisticsList.get(i).toString()).append(System.lineSeparator()); - } - } - String requestStatsString = stringBuilder.toString(); - if (!requestStatsString.isEmpty()) { - return System.lineSeparator() + requestStatsString; - } - return StringUtils.EMPTY; - } - - public List getContactedReplicas() { - return contactedReplicas; - } - - public void setContactedReplicas(List contactedReplicas) { - this.contactedReplicas = contactedReplicas; - } - - public Set getFailedReplicas() { - return failedReplicas; - } - - public void setFailedReplicas(Set failedReplicas) { - this.failedReplicas = failedReplicas; - } - - public Set getRegionsContacted() { - return regionsContacted; - } - - public void setRegionsContacted(Set regionsContacted) { - this.regionsContacted = regionsContacted; - } - - private static String formatDateTime(ZonedDateTime dateTime) { - if (dateTime == null) { - return null; - } - return dateTime.format(responseTimeFormatter); - } - - private class StoreResponseStatistics { - - private ZonedDateTime requestResponseTime; - private StoreResult storeResult; - private ResourceType requestResourceType; - private OperationType requestOperationType; - - @Override - public String toString() { - return "StoreResponseStatistics{" + - "requestResponseTime=\"" + formatDateTime(requestResponseTime) + "\"" + - ", storeResult=" + storeResult + - ", requestResourceType=" + requestResourceType + - ", requestOperationType=" + requestOperationType + - '}'; - } - } - - private class AddressResolutionStatistics { - private ZonedDateTime startTime; - private ZonedDateTime endTime; - private String targetEndpoint; - - AddressResolutionStatistics() { - } - - @Override - public String toString() { - return "AddressResolutionStatistics{" + - "startTime=\"" + formatDateTime(startTime) + "\"" + - ", endTime=\"" + formatDateTime(endTime) + "\"" + - ", targetEndpoint='" + targetEndpoint + '\'' + - '}'; - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/CommonsBridgeInternal.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/CommonsBridgeInternal.java deleted file mode 100644 index 20009de704a8..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/CommonsBridgeInternal.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -public class CommonsBridgeInternal { - public static boolean isV2(PartitionKeyDefinition pkd) { - return pkd.getVersion() != null && PartitionKeyDefinitionVersion.V2.val == pkd.getVersion().val; - } - - public static void setV2(PartitionKeyDefinition pkd) { - pkd.setVersion(PartitionKeyDefinitionVersion.V2); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/CompositePath.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/CompositePath.java deleted file mode 100644 index ea9fcb67b175..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/CompositePath.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import org.apache.commons.lang3.StringUtils; - -import com.microsoft.azure.cosmosdb.internal.Constants; -import org.apache.commons.text.WordUtils; - -/** - * Represents a composite path of the IndexingPolicy in the Azure Cosmos DB database service. - * A composite path is used in a composite index. For example if you want to run a query like - * "SELECT * FROM c ORDER BY c.age, c.height", then you need to add "/age" and "/height" - * as composite paths to your composite index. - */ -public class CompositePath extends JsonSerializable { - /** - * Constructor. - */ - public CompositePath() { - super(); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the included path. - */ - public CompositePath(String jsonString) { - super(jsonString); - } - - /** - * Gets path. - * - * @return the path. - */ - public String getPath() { - return super.getString(Constants.Properties.PATH); - } - - /** - * Sets path. - * - * @param path the path. - */ - public void setPath(String path) { - super.set(Constants.Properties.PATH, path); - } - - /** - * Gets the sort order for the composite path. - * - * For example if you want to run the query "SELECT * FROM c ORDER BY c.age asc, c.height desc", - * then you need to make the order for "/age" "ascending" and the order for "/height" "descending". - * - * @return the sort order. - */ - public CompositePathSortOrder getOrder() { - String strValue = super.getString(Constants.Properties.ORDER); - if (!StringUtils.isEmpty(strValue)) { - try { - return CompositePathSortOrder.valueOf(WordUtils.capitalize(super.getString(Constants.Properties.ORDER))); - } catch (IllegalArgumentException e) { - this.getLogger().warn("Invalid indexingMode value {}.", super.getString(Constants.Properties.ORDER)); - return CompositePathSortOrder.Ascending; - } - } - return CompositePathSortOrder.Ascending; - } - - /** - * Gets the sort order for the composite path. - * - * For example if you want to run the query "SELECT * FROM c ORDER BY c.age asc, c.height desc", - * then you need to make the order for "/age" "ascending" and the order for "/height" "descending". - * - * @param order the sort order. - */ - public void setOrder(CompositePathSortOrder order) { - super.set(Constants.Properties.ORDER, order.toString()); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/CompositePathSortOrder.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/CompositePathSortOrder.java deleted file mode 100644 index fdb123abb0f8..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/CompositePathSortOrder.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Represents the sorting order for a path in a composite index, for a - * collection in the Azure Cosmos DB database service. - */ -public enum CompositePathSortOrder { - /** - * Ascending sort order for composite paths. - */ - Ascending { - public String toString() { - return "ascending"; - } - }, - - /** - * Descending sort order for composite paths. - */ - Descending { - public String toString() { - return "descending"; - } - }, -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Conflict.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Conflict.java deleted file mode 100644 index 21650fe6331a..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Conflict.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; - -import java.lang.reflect.InvocationTargetException; - -/** - * Represents a conflict in the version of a particular resource in the Azure Cosmos DB database service. - *

- * During rare failure scenarios, conflicts are generated for the documents in transit. Clients can inspect the - * respective conflict instances for resources and operations in conflict. - */ -public final class Conflict extends Resource { - /** - * Initialize a conflict object. - */ - public Conflict() { - super(); - } - - /** - * Initialize a conflict object from json string. - * - * @param jsonString the json string that represents the conflict. - */ - public Conflict(String jsonString) { - super(jsonString); - } - - /** - * Gets the operation kind. - * - * @return the operation kind. - */ - public String getOperationKind() { - return super.getString(Constants.Properties.OPERATION_TYPE); - } - - /** - * Gets the type of the conflicting resource. - * - * @return the resource type. - */ - public String getResouceType() { - return super.getString(Constants.Properties.RESOURCE_TYPE); - } - - /** - * Gets the resource ID for the conflict in the Azure Cosmos DB service. - * @return resource Id for the conflict. - */ - public String getSourceResourceId() { - return super.getString(Constants.Properties.SOURCE_RESOURCE_ID); - } - - /** - * Gets the conflicting resource in the Azure Cosmos DB service. - * @param the type of the object. - * @param klass The returned type of conflicting resource. - * @return The conflicting resource. - */ - public T getResource(Class klass) { - String resourceAsString = super.getString(Constants.Properties.CONTENT); - - if (!Strings.isNullOrEmpty(resourceAsString)) { - try { - return klass.getConstructor(String.class).newInstance(resourceAsString); - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException | NoSuchMethodException | SecurityException e) { - throw new IllegalStateException("Failed to instantiate class object.", e); - } - } else { - return null; - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConflictResolutionMode.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConflictResolutionMode.java deleted file mode 100644 index 8e605c5a0951..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConflictResolutionMode.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -public enum ConflictResolutionMode { - /** - * Last writer wins conflict resolution mode - * - * Setting the ConflictResolutionMode to "LastWriterWins" indicates that conflict resolution should be done by inspecting a field in the conflicting documents - * and picking the document which has the higher value in that path. See {@link ConflictResolutionPolicy#getConflictResolutionPath()} for details on how to specify the path - * to be checked for conflict resolution. Also note that Deletes win. - */ - LastWriterWins, - - /** - * Custom conflict resolution mode - * - * Setting the ConflictResolutionMode to "Custom" indicates that conflict resolution is custom handled by a user. - * The user could elect to register a user specified {@link StoredProcedure} for handling conflicting resources. - * Should the user not register a user specified StoredProcedure, conflicts will default to being made available as {@link Conflict} resources, - * which the user can inspect and manually resolve. - * See {@link ConflictResolutionPolicy#getConflictResolutionProcedure()} for details on how to specify the stored procedure - * to run for conflict resolution. - */ - Custom, - - /** - * Invalid or unknown mode. - */ - Invalid -} - diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConflictResolutionPolicy.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConflictResolutionPolicy.java deleted file mode 100644 index 291b24d326b9..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConflictResolutionPolicy.java +++ /dev/null @@ -1,221 +0,0 @@ -package com.microsoft.azure.cosmosdb; - - -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import org.apache.commons.text.WordUtils; - - -/** - * Represents the conflict resolution policy configuration for specifying how to resolve conflicts - * in case writes from different regions result in conflicts on documents in the collection in the Azure Cosmos DB service. - * - * A collection with custom conflict resolution with no user-registered stored procedure. - *

{@code
- * DocumentCollection collectionSpec = new DocumentCollection();
- * collectionSpec.setId("Multi-master collection");
- *
- * ConflictResolutionPolicy policy = ConflictResolutionPolicy.createCustomPolicy();
- * collectionSpec.setConflictResolutionPolicy(policy);
- *
- * DocumentCollection collection = client.createCollection(databaseLink, collectionSpec, null)
- *         .toBlocking().single().getResource();
- *
- * }
- * 
- * - * A collection with custom conflict resolution with a user-registered stored procedure. - *
{@code
- * DocumentCollection collectionSpec = new DocumentCollection();
- * collectionSpec.setId("Multi-master collection");
- *
- * ConflictResolutionPolicy policy = ConflictResolutionPolicy.createCustomPolicy(conflictResolutionSprocName);
- * collectionSpec.setConflictResolutionPolicy(policy);
- *
- * DocumentCollection collection = client.createCollection(databaseLink, collectionSpec, null)
- *         .toBlocking().single().getResource();
- *
- * }
- * 
- * - * A collection with last writer wins conflict resolution, based on a path in the conflicting documents. - * A collection with custom conflict resolution with a user-registered stored procedure. - *
{@code
- * DocumentCollection collectionSpec = new DocumentCollection();
- * collectionSpec.setId("Multi-master collection");
- *
- * ConflictResolutionPolicy policy = ConflictResolutionPolicy.createLastWriterWinsPolicy("/path/for/conflict/resolution");
- * collectionSpec.setConflictResolutionPolicy(policy);
- *
- * DocumentCollection collection = client.createCollection(databaseLink, collectionSpec, null)
- *         .toBlocking().single().getResource();
- *
- * }
- * 
- */ -public class ConflictResolutionPolicy extends JsonSerializable { - - /** - * Creates a LastWriterWins {@link ConflictResolutionPolicy} with "/_ts" as the resolution path. - * - * In case of a conflict occurring on a document, the document with the higher integer value in the default path - * {@link Resource#getTimestamp()}, i.e., "/_ts" will be used. - * - * @return ConflictResolutionPolicy. - */ - public static ConflictResolutionPolicy createLastWriterWinsPolicy() { - ConflictResolutionPolicy policy = new ConflictResolutionPolicy(); - policy.setMode(ConflictResolutionMode.LastWriterWins); - return policy; - } - - /** - * - * Creates a LastWriterWins {@link ConflictResolutionPolicy} with path as the resolution path. - * - * The specified path must be present in each document and must be an integer value. - * In case of a conflict occurring on a document, the document with the higher integer value in the specified path - * will be picked. - * - * @param conflictResolutionPath The path to check values for last-writer wins conflict resolution. - * That path is a rooted path of the property in the document, such as "/name/first". - * @return ConflictResolutionPolicy. - */ - public static ConflictResolutionPolicy createLastWriterWinsPolicy(String conflictResolutionPath) { - ConflictResolutionPolicy policy = new ConflictResolutionPolicy(); - policy.setMode(ConflictResolutionMode.LastWriterWins); - if (conflictResolutionPath != null) { - policy.setConflictResolutionPath(conflictResolutionPath); - } - return policy; - } - - /** - * Creates a Custom {@link ConflictResolutionPolicy} which uses the specified stored procedure - * to perform conflict resolution - * - * This stored procedure may be created after the {@link DocumentCollection} is created and can be changed as required. - * - *
    - *
  • In case the stored procedure fails or throws an exception, - * the conflict resolution will default to registering conflicts in the conflicts feed
  • - *
  • The user can provide the stored procedure @see {@link Resource#getId()}
  • - *
- * @param conflictResolutionSprocName stored procedure to perform conflict resolution. - * @return ConflictResolutionPolicy. - */ - public static ConflictResolutionPolicy createCustomPolicy(String conflictResolutionSprocName) { - ConflictResolutionPolicy policy = new ConflictResolutionPolicy(); - policy.setMode(ConflictResolutionMode.Custom); - if (conflictResolutionSprocName != null) { - policy.setConflictResolutionProcedure(conflictResolutionSprocName); - } - return policy; - } - - /** - * Creates a Custom {@link ConflictResolutionPolicy} without any {@link StoredProcedure}. User manually - * should resolve conflicts. - * - * The conflicts will be registered in the conflicts feed and the user should manually resolve them. - * - * @return ConflictResolutionPolicy. - */ - public static ConflictResolutionPolicy createCustomPolicy() { - ConflictResolutionPolicy policy = new ConflictResolutionPolicy(); - policy.setMode(ConflictResolutionMode.Custom); - return policy; - } - - /** - * Initializes a new instance of the {@link ConflictResolutionPolicy} class for the Azure Cosmos DB service. - */ - ConflictResolutionPolicy() {} - - public ConflictResolutionPolicy(String jsonString) { - super(jsonString); - } - - /** - * Gets the {@link ConflictResolutionMode} in the Azure Cosmos DB service. - * By default it is {@link ConflictResolutionMode#LastWriterWins}. - * - * @return ConflictResolutionMode. - */ - public ConflictResolutionMode getConflictResolutionMode() { - - String strValue = super.getString(Constants.Properties.MODE); - - if (!Strings.isNullOrEmpty(strValue)) { - try { - return ConflictResolutionMode.valueOf(WordUtils.capitalize(super.getString(Constants.Properties.MODE))); - } catch (IllegalArgumentException e) { - this.getLogger().warn("Invalid ConflictResolutionMode value {}.", super.getString(Constants.Properties.MODE)); - return ConflictResolutionMode.Invalid; - } - } - - return ConflictResolutionMode.Invalid; - } - - /** - * Sets the {@link ConflictResolutionMode} in the Azure Cosmos DB service. - * By default it is {@link ConflictResolutionMode#LastWriterWins}. - * - * @param mode One of the values of the {@link ConflictResolutionMode} enum. - */ - void setMode(ConflictResolutionMode mode) { - super.set(Constants.Properties.MODE, mode.name()); - } - - /** - * Gets the path which is present in each document in the Azure Cosmos DB service for last writer wins conflict-resolution. - * This path must be present in each document and must be an integer value. - * In case of a conflict occurring on a document, the document with the higher integer value in the specified path will be picked. - * If the path is unspecified, by default the {@link Resource#getTimestamp()} path will be used. - * - * This value should only be set when using {@link ConflictResolutionMode#LastWriterWins} - * - * @return The path to check values for last-writer wins conflict resolution. - * That path is a rooted path of the property in the document, such as "/name/first". - */ - public String getConflictResolutionPath() { - return super.getString(Constants.Properties.CONFLICT_RESOLUTION_PATH); - } - - /** - * Sets the path which is present in each document in the Azure Cosmos DB service for last writer wins conflict-resolution. - * This path must be present in each document and must be an integer value. - * In case of a conflict occurring on a document, the document with the higher integer value in the specified path will be picked. - * If the path is unspecified, by default the {@link Resource#getTimestamp()} path will be used. - * - * This value should only be set when using {@link ConflictResolutionMode#LastWriterWins} - * - * @param value The path to check values for last-writer wins conflict resolution. - * That path is a rooted path of the property in the document, such as "/name/first". - */ - void setConflictResolutionPath(String value) { - super.set(Constants.Properties.CONFLICT_RESOLUTION_PATH, value); - } - - /** - * Gets the {@link StoredProcedure} which is used for conflict resolution in the Azure Cosmos DB service. - * This stored procedure may be created after the {@link DocumentCollection} is created and can be changed as required. - * - *
    - *
  • This value should only be set when using {@link ConflictResolutionMode#Custom}
  • - *
  • In case the stored procedure fails or throws an exception, - * the conflict resolution will default to registering conflicts in the conflicts feed
  • - *
  • The user can provide the stored procedure @see {@link Resource#getId()}
  • - *
- ** - * @return the stored procedure to perform conflict resolution.] - */ - public String getConflictResolutionProcedure() { - return super.getString(Constants.Properties.CONFLICT_RESOLUTION_PROCEDURE); - } - - void setConflictResolutionProcedure(String value) { - super.set(Constants.Properties.CONFLICT_RESOLUTION_PROCEDURE, value); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConnectionMode.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConnectionMode.java deleted file mode 100644 index c534ef3394b7..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConnectionMode.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Represents the connection mode to be used by the client in the Azure Cosmos DB database service. - *

- * Direct and Gateway connectivity modes are supported. Gateway is the default. - * Refer to <see>http://azure.microsoft.com/documentation/articles/documentdb- - * interactions-with-resources/#connectivity-options</see> for additional - * details. - *

- */ -public enum ConnectionMode { - - /** - * Specifies that requests to server resources are made through a gateway proxy using HTTPS. - *

- * In Gateway mode, all requests are made through a gateway proxy. - *

- */ - Gateway, - - /** - * Specifies that requests to server resources are made directly to the data nodes. - *

- * In Direct mode, all requests to server resources within a collection, such as documents, stored procedures - * and user-defined functions, etc., are made directly to the data nodes within the target Cosmos DB cluster - * using either the HTTPS or TCP/SSL transport protocol. - *

- * Certain operations on account or database level resources, such as databases, collections and users, etc., - * are always routed through the gateway using HTTPS. - *

- */ - Direct -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConnectionPolicy.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConnectionPolicy.java deleted file mode 100644 index 6409218e0515..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConnectionPolicy.java +++ /dev/null @@ -1,400 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.net.InetSocketAddress; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -/** - * Represents the Connection policy associated with a DocumentClient in the Azure Cosmos DB database service. - */ -public final class ConnectionPolicy { - - private static final int DEFAULT_REQUEST_TIMEOUT_IN_MILLIS = 60 * 1000; - // defaultMediaRequestTimeout is based upon the blob client timeout and the - // retry policy. - private static final int DEFAULT_MEDIA_REQUEST_TIMEOUT_IN_MILLIS = 300 * 1000; - private static final int DEFAULT_IDLE_CONNECTION_TIMEOUT_IN_MILLIS = 60 * 1000; - - private static final int DEFAULT_MAX_POOL_SIZE = 1000; - - private static ConnectionPolicy default_policy = null; - private int requestTimeoutInMillis; - private int mediaRequestTimeoutInMillis; - private ConnectionMode connectionMode; - private MediaReadMode mediaReadMode; - private int maxPoolSize; - private int idleConnectionTimeoutInMillis; - private String userAgentSuffix; - private RetryOptions retryOptions; - private boolean enableEndpointDiscovery = true; - private List preferredLocations; - private boolean usingMultipleWriteLocations; - private InetSocketAddress inetSocketProxyAddress; - private Boolean enableReadRequestsFallback; - - /** - * Constructor. - */ - public ConnectionPolicy() { - this.connectionMode = ConnectionMode.Gateway; - this.enableReadRequestsFallback = null; - this.idleConnectionTimeoutInMillis = DEFAULT_IDLE_CONNECTION_TIMEOUT_IN_MILLIS; - this.maxPoolSize = DEFAULT_MAX_POOL_SIZE; - this.mediaReadMode = MediaReadMode.Buffered; - this.mediaRequestTimeoutInMillis = ConnectionPolicy.DEFAULT_MEDIA_REQUEST_TIMEOUT_IN_MILLIS; - this.requestTimeoutInMillis = ConnectionPolicy.DEFAULT_REQUEST_TIMEOUT_IN_MILLIS; - this.retryOptions = new RetryOptions(); - this.userAgentSuffix = ""; - } - - /** - * Gets the default connection policy. - * - * @return the default connection policy. - */ - public static ConnectionPolicy GetDefault() { - if (ConnectionPolicy.default_policy == null) { - ConnectionPolicy.default_policy = new ConnectionPolicy(); - } - return ConnectionPolicy.default_policy; - } - - /** - * Gets the request timeout (time to wait for response from network peer) in - * milliseconds. - * - * @return the request timeout in milliseconds. - */ - public int getRequestTimeoutInMillis() { - return this.requestTimeoutInMillis; - } - - /** - * Sets the request timeout (time to wait for response from network peer) in - * milliseconds. The default is 60 seconds. - * - * @param requestTimeoutInMillis the request timeout in milliseconds. - */ - public void setRequestTimeoutInMillis(int requestTimeoutInMillis) { - this.requestTimeoutInMillis = requestTimeoutInMillis; - } - - /** - * Gets or sets time to wait for response from network peer for attachment - * content (aka media) operations. - * - * @return the media request timeout in milliseconds. - */ - public int getMediaRequestTimeoutInMillis() { - return this.mediaRequestTimeoutInMillis; - } - - /** - * Gets or sets Time to wait for response from network peer for attachment - * content (aka media) operations. - * - * @param mediaRequestTimeoutInMillis the media request timeout in milliseconds. - */ - public void setMediaRequestTimeoutInMillis(int mediaRequestTimeoutInMillis) { - this.mediaRequestTimeoutInMillis = mediaRequestTimeoutInMillis; - } - - /** - * Gets the connection mode used in the client. - * - * @return the connection mode. - */ - public ConnectionMode getConnectionMode() { - return this.connectionMode; - } - - /** - * Sets the connection mode used in the client. - * - * @param connectionMode the connection mode. - */ - public void setConnectionMode(ConnectionMode connectionMode) { - this.connectionMode = connectionMode; - } - - /** - * Gets the attachment content (aka media) download mode. - * - * @return the media read mode. - */ - public MediaReadMode getMediaReadMode() { - return this.mediaReadMode; - } - - /** - * Sets the attachment content (aka media) download mode. - * - * @param mediaReadMode the media read mode. - */ - public void setMediaReadMode(MediaReadMode mediaReadMode) { - this.mediaReadMode = mediaReadMode; - } - - /** - * Gets the value of the connection pool size the client is using. - * - * @return connection pool size. - */ - public int getMaxPoolSize() { - return this.maxPoolSize; - } - - /** - * Sets the value of the connection pool size, the default - * is 1000. - * - * @param maxPoolSize The value of the connection pool size. - */ - public void setMaxPoolSize(int maxPoolSize) { - this.maxPoolSize = maxPoolSize; - } - - /** - * Gets the value of the timeout for an idle connection, the default is 60 - * seconds. - * - * @return Idle connection timeout. - */ - public int getIdleConnectionTimeoutInMillis() { - return this.idleConnectionTimeoutInMillis; - } - - /** - * sets the value of the timeout for an idle connection. After that time, - * the connection will be automatically closed. - * - * @param idleConnectionTimeoutInMillis the timeout for an idle connection in seconds. - */ - public void setIdleConnectionTimeoutInMillis(int idleConnectionTimeoutInMillis) { - this.idleConnectionTimeoutInMillis = idleConnectionTimeoutInMillis; - } - - /** - * Gets the value of user-agent suffix. - * - * @return the value of user-agent suffix. - */ - public String getUserAgentSuffix() { - return this.userAgentSuffix; - } - - /** - * sets the value of the user-agent suffix. - * - * @param userAgentSuffix The value to be appended to the user-agent header, this is - * used for monitoring purposes. - */ - public void setUserAgentSuffix(String userAgentSuffix) { - this.userAgentSuffix = userAgentSuffix; - } - - /** - * Gets the retry policy options associated with the DocumentClient instance. - * - * @return the RetryOptions instance. - */ - public RetryOptions getRetryOptions() { - return this.retryOptions; - } - - /** - * Sets the retry policy options associated with the DocumentClient instance. - *

- * Properties in the RetryOptions class allow application to customize the built-in - * retry policies. This property is optional. When it's not set, the SDK uses the - * default values for configuring the retry policies. See RetryOptions class for - * more details. - * - * @param retryOptions the RetryOptions instance. - */ - public void setRetryOptions(RetryOptions retryOptions) { - if (retryOptions == null) { - throw new IllegalArgumentException("retryOptions value must not be null."); - } - - this.retryOptions = retryOptions; - } - - /** - * Gets the flag to enable endpoint discovery for geo-replicated database accounts. - * - * @return whether endpoint discovery is enabled. - */ - public boolean getEnableEndpointDiscovery() { - return this.enableEndpointDiscovery; - } - - /** - * Sets the flag to enable endpoint discovery for geo-replicated database accounts. - *

- * When EnableEndpointDiscovery is true, the SDK will automatically discover the - * current write and read regions to ensure requests are sent to the correct region - * based on the capability of the region and the user's preference. - *

- * The default value for this property is true indicating endpoint discovery is enabled. - * - * @param enableEndpointDiscovery true if EndpointDiscovery is enabled. - */ - public void setEnableEndpointDiscovery(boolean enableEndpointDiscovery) { - this.enableEndpointDiscovery = enableEndpointDiscovery; - } - - /** - * Gets the flag to enable writes on any locations (regions) for geo-replicated database accounts in the Azure Cosmos DB service. - * - * When the value of this property is true, the SDK will direct write operations to - * available writable locations of geo-replicated database account. Writable locations - * are ordered by PreferredLocations property. Setting the property value - * to true has no effect until EnableMultipleWriteLocations in DatabaseAccount - * is also set to true. - * - * Default value is false indicating that writes are only directed to - * first region in PreferredLocations property. - * - * @return flag to enable writes on any locations (regions) for geo-replicated database accounts. - */ - public boolean isUsingMultipleWriteLocations() { - return this.usingMultipleWriteLocations; - } - - /** - * Gets whether to allow for reads to go to multiple regions configured on an account of Azure Cosmos DB service. - * - * Default value is null. - * - * If this property is not set, the default is true for all Consistency Levels other than Bounded Staleness, - * The default is false for Bounded Staleness. - * 1. {@link #enableEndpointDiscovery} is true - * 2. the Azure Cosmos DB account has more than one region - * - * @return flag to allow for reads to go to multiple regions configured on an account of Azure Cosmos DB service. - */ - public Boolean isEnableReadRequestsFallback() { - return this.enableReadRequestsFallback; - } - - /** - * Sets the flag to enable writes on any locations (regions) for geo-replicated database accounts in the Azure Cosmos DB service. - * - * When the value of this property is true, the SDK will direct write operations to - * available writable locations of geo-replicated database account. Writable locations - * are ordered by PreferredLocations property. Setting the property value - * to true has no effect until EnableMultipleWriteLocations in DatabaseAccount - * is also set to true. - * - * Default value is false indicating that writes are only directed to - * first region in PreferredLocations property. - * - * @param usingMultipleWriteLocations flag to enable writes on any locations (regions) for geo-replicated database accounts. - */ - public void setUsingMultipleWriteLocations(boolean usingMultipleWriteLocations) { - this.usingMultipleWriteLocations = usingMultipleWriteLocations; - } - - /** - * Sets whether to allow for reads to go to multiple regions configured on an account of Azure Cosmos DB service. - * - * Default value is null. - * - * If this property is not set, the default is true for all Consistency Levels other than Bounded Staleness, - * The default is false for Bounded Staleness. - * 1. {@link #enableEndpointDiscovery} is true - * 2. the Azure Cosmos DB account has more than one region - * - * @param enableReadRequestsFallback flag to enable reads to go to multiple regions configured on an account of Azure Cosmos DB service. - */ - public void setEnableReadRequestsFallback(Boolean enableReadRequestsFallback) { - this.enableReadRequestsFallback = enableReadRequestsFallback; - } - - /** - * Gets the preferred locations for geo-replicated database accounts - * - * @return the list of preferred location. - */ - public List getPreferredLocations() { - return this.preferredLocations != null ? preferredLocations : Collections.emptyList(); - } - - /** - * Sets the preferred locations for geo-replicated database accounts. For example, - * "East US" as the preferred location. - *

- * When EnableEndpointDiscovery is true and PreferredRegions is non-empty, - * the SDK will prefer to use the locations in the collection in the order - * they are specified to perform operations. - *

- * If EnableEndpointDiscovery is set to false, this property is ignored. - * - * @param preferredLocations the list of preferred locations. - */ - public void setPreferredLocations(List preferredLocations) { - this.preferredLocations = preferredLocations; - } - - /** - * Gets the InetSocketAddress of proxy server. - * - * @return the value of proxyHost. - */ - public InetSocketAddress getProxy() { - return this.inetSocketProxyAddress; - } - - /** - * This will create the InetSocketAddress for proxy server, - * all the requests to cosmoDB will route from this address. - * @param proxyHost The proxy server host. - * @param proxyPort The proxy server port. - */ - public void setProxy(String proxyHost, int proxyPort) { - this.inetSocketProxyAddress = new InetSocketAddress(proxyHost, proxyPort); - } - - @Override - public String toString() { - return "ConnectionPolicy{" + - "requestTimeoutInMillis=" + requestTimeoutInMillis + - ", mediaRequestTimeoutInMillis=" + mediaRequestTimeoutInMillis + - ", connectionMode=" + connectionMode + - ", mediaReadMode=" + mediaReadMode + - ", maxPoolSize=" + maxPoolSize + - ", idleConnectionTimeoutInMillis=" + idleConnectionTimeoutInMillis + - ", userAgentSuffix='" + userAgentSuffix + '\'' + - ", retryOptions=" + retryOptions + - ", enableEndpointDiscovery=" + enableEndpointDiscovery + - ", preferredLocations=" + preferredLocations + - ", usingMultipleWriteLocations=" + usingMultipleWriteLocations + - ", inetSocketProxyAddress=" + inetSocketProxyAddress + - '}'; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConsistencyLevel.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConsistencyLevel.java deleted file mode 100644 index a7da6d28eb8a..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConsistencyLevel.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Represents the consistency levels supported for Cosmos DB client operations in the Azure Cosmos DB database service. - *

- * The requested ConsistencyLevel must match or be weaker than that provisioned for the database account. Consistency - * levels by order of strength are Strong, BoundedStaleness, Session and Eventual. - */ -public enum ConsistencyLevel { - - /** - * Strong Consistency guarantees that read operations always return the value that was last written. - */ - Strong, - - /** - * Bounded Staleness guarantees that reads are not too out-of-date. This can be configured based on number of - * operations (MaxStalenessPrefix) or time (MaxStalenessIntervalInSeconds) - */ - BoundedStaleness, - - /** - * Session Consistency guarantees monotonic reads (you never read old data, then new, then old again), monotonic - * writes (writes are ordered) and read your writes (your writes are immediately visible to your reads) within - * any single session. - */ - Session, - - /** - * Eventual Consistency guarantees that reads will return a subset of writes. All writes will be eventually be - * available for reads. - */ - Eventual, - - /** - * ConsistentPrefix Consistency guarantees that reads will return some prefix of all writes with no gaps. All writes - * will be eventually be available for reads. - */ - ConsistentPrefix -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConsistencyPolicy.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConsistencyPolicy.java deleted file mode 100644 index 141a6b196795..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ConsistencyPolicy.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - - -import org.apache.commons.text.WordUtils; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Encapsulates the settings for consistency policy in the Azure Cosmos DB database service. - */ -public final class ConsistencyPolicy extends JsonSerializable { - private static final ConsistencyLevel DEFAULT_DEFAULT_CONSISTENCY_LEVEL = - ConsistencyLevel.Session; - - private static final int DEFAULT_MAX_STALENESS_INTERVAL = 5; - private static final int DEFAULT_MAX_STALENESS_PREFIX = 100; - - - /** - * Constructor. - */ - ConsistencyPolicy() { - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the consistency policy. - */ - public ConsistencyPolicy(String jsonString) { - super(jsonString); - } - - /** - * Get the name of the resource. - * - * @return the default consistency level. - */ - public ConsistencyLevel getDefaultConsistencyLevel() { - - ConsistencyLevel result = ConsistencyPolicy.DEFAULT_DEFAULT_CONSISTENCY_LEVEL; - try { - result = ConsistencyLevel.valueOf( - WordUtils.capitalize(super.getString(Constants.Properties.DEFAULT_CONSISTENCY_LEVEL))); - } catch (IllegalArgumentException e) { - // ignore the exception and return the default - this.getLogger().warn("Unknown consistency level {}, value ignored.", super.getString(Constants.Properties.DEFAULT_CONSISTENCY_LEVEL)); - } - return result; - } - - /** - * Set the name of the resource. - * - * @param level the consistency level. - */ - public void setDefaultConsistencyLevel(ConsistencyLevel level) { - super.set(Constants.Properties.DEFAULT_CONSISTENCY_LEVEL, level.name()); - } - - /** - * Gets the bounded staleness consistency, the maximum allowed staleness in terms difference in sequence numbers - * (aka version). - * - * @return the max staleness prefix. - */ - public int getMaxStalenessPrefix() { - Integer value = super.getInt(Constants.Properties.MAX_STALENESS_PREFIX); - if (value == null) { - return ConsistencyPolicy.DEFAULT_MAX_STALENESS_PREFIX; - } - return value; - } - - /** - * Sets the bounded staleness consistency, the maximum allowed staleness in terms difference in sequence numbers - * (aka version). - * - * @param maxStalenessPrefix the max staleness prefix. - */ - public void setMaxStalenessPrefix(int maxStalenessPrefix) { - super.set(Constants.Properties.MAX_STALENESS_PREFIX, maxStalenessPrefix); - } - - /** - * Gets the in bounded staleness consistency, the maximum allowed staleness in terms time interval. - * - * @return the max staleness prefix. - */ - public int getMaxStalenessIntervalInSeconds() { - Integer value = super.getInt(Constants.Properties.MAX_STALENESS_INTERVAL_IN_SECONDS); - if (value == null) { - return ConsistencyPolicy.DEFAULT_MAX_STALENESS_INTERVAL; - } - return value; - } - - /** - * Sets the in bounded staleness consistency, the maximum allowed staleness in terms time interval. - * - * @param maxStalenessIntervalInSeconds the max staleness interval in seconds. - */ - public void setMaxStalenessIntervalInSeconds(int maxStalenessIntervalInSeconds) { - super.set(Constants.Properties.MAX_STALENESS_INTERVAL_IN_SECONDS, maxStalenessIntervalInSeconds); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/CosmosResourceType.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/CosmosResourceType.java deleted file mode 100644 index 11029c770a91..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/CosmosResourceType.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Resource types in the Azure Cosmos DB database service. - */ -public enum CosmosResourceType { - - System(-100), - Attachment(3), - DocumentCollection(1), - Conflict(107), - Database(0), - Document(2), - Index(104), - Offer(113), - Permission(5), - StoredProcedure(109), - Trigger(110), - User(4), - UserDefinedFunction(111); - - final private int value; - - CosmosResourceType(int value) { - this.value = value; - } - - public int value() { - return this.value; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DataType.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DataType.java deleted file mode 100644 index 9ff43f876835..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DataType.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Data types in the Azure Cosmos DB database service. - */ -public enum DataType { - /** - * Represents a numeric data type. - */ - Number, - - /** - * Represents a string data type. - */ - String, - - /** - * Represent a point data type. - */ - Point, - - /** - * Represents a line string data type. - */ - LineString, - - /** - * Represent a polygon data type. - */ - Polygon, - - /** - * Represent a multi-polygon data type. - */ - MultiPolygon -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Database.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Database.java deleted file mode 100644 index 118eef88cf38..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Database.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import org.apache.commons.lang3.StringUtils; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents a Database in the Azure Cosmos DB database service. A database manages users, permissions and a set of collections - *

- * Each Azure Cosmos DB Service is able to support multiple independent named databases, with the database being the - * logical container for data. Each Database consists of one or more collections, each of which in turn contain one or - * more documents. Since databases are an an administrative resource and the Service Master Key will be required in - * order to access and successfully complete any action using the User APIs. - */ -public final class Database extends Resource { - - /** - * Initialize a database object. - */ - public Database() { - super(); - } - - /** - * Initialize a database object from json string. - * - * @param jsonString the json string. - */ - public Database(String jsonString) { - super(jsonString); - } - - /** - * Gets the self-link for collections in the database - * - * @return the collections link. - */ - public String getCollectionsLink() { - return String.format("%s/%s", - StringUtils.stripEnd(super.getSelfLink(), "/"), - super.getString(Constants.Properties.COLLECTIONS_LINK)); - } - - /** - * Gets the self-link for users in the database. - * - * @return the users link. - */ - public String getUsersLink() { - return String.format("%s/%s", - StringUtils.stripEnd(super.getSelfLink(), "/"), - super.getString(Constants.Properties.USERS_LINK)); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DatabaseAccount.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DatabaseAccount.java deleted file mode 100644 index a8ce58bb977a..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DatabaseAccount.java +++ /dev/null @@ -1,283 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.Utils; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.lang3.ObjectUtils; -import org.apache.commons.lang3.StringUtils; - -/** - * Represents a database account in the Azure Cosmos DB database service. - */ -public class DatabaseAccount extends Resource { - private ConsistencyPolicy consistencyPolicy; - - private long maxMediaStorageUsageInMB; - private long mediaStorageUsageInMB; - private ReplicationPolicy replicationPolicy; - private ReplicationPolicy systemReplicationPolicy; - private Map queryEngineConfiguration; - - /** - * Constructor. - */ - DatabaseAccount() { - this.setSelfLink(""); - } - - /** - * Initialize a database account object from json string. - * - * @param jsonString the json string that represents the database account. - */ - public DatabaseAccount(String jsonString) { - super(jsonString); - } - - /** - * Get the databases link of the databaseAccount. - * - * @return the databases link. - */ - public String getDatabasesLink() { - return super.getString(Constants.Properties.DATABASES_LINK); - } - - /** - * Set the databases of the databaseAccount. - * - * @param databasesLink the databases link. - */ - void setDatabasesLink(String databasesLink) { - super.set(Constants.Properties.DATABASES_LINK, databasesLink); - } - - /** - * Get the medialink of the databaseAccount. - * - * @return the media link. - */ - public String getMediaLink() { - return super.getString(Constants.Properties.MEDIA_LINK); - } - - /** - * Set the medialink of the databaseAccount. - * - * @param medialink the media link. - */ - void setMediaLink(String medialink) { - super.set(Constants.Properties.MEDIA_LINK, medialink); - } - - /** - * Get the addresseslink of the databaseAccount. - * - * @return the addresses link. - */ - public String getAddressesLink() { - return super.getString(Constants.Properties.ADDRESS_LINK); - } - - /** - * Set the addresseslink of the databaseAccount. - * - * @param addresseslink the addresses link. - */ - void setAddressesLink(String addresseslink) { - super.set(Constants.Properties.ADDRESS_LINK, addresseslink); - } - - /** - * Attachment content (media) storage quota in MBs Retrieved from gateway. - * - * @return the max media storage usage in MB. - */ - public long getMaxMediaStorageUsageInMB() { - return this.maxMediaStorageUsageInMB; - } - - void setMaxMediaStorageUsageInMB(long value) { - this.maxMediaStorageUsageInMB = value; - } - - /** - * Current attachment content (media) usage in MBs. - *

- * Retrieved from gateway. Value is returned from cached information updated - * periodically and is not guaranteed to be real time. - * - * @return the media storage usage in MB. - */ - public long getMediaStorageUsageInMB() { - return this.mediaStorageUsageInMB; - } - - void setMediaStorageUsageInMB(long value) { - this.mediaStorageUsageInMB = value; - } - - /** - * Gets the ConsistencyPolicy settings. - * - * @return the consistency policy. - */ - public ConsistencyPolicy getConsistencyPolicy() { - if (this.consistencyPolicy == null) { - this.consistencyPolicy = super.getObject(Constants.Properties.USER_CONSISTENCY_POLICY, - ConsistencyPolicy.class); - - if (this.consistencyPolicy == null) { - this.consistencyPolicy = new ConsistencyPolicy(); - } - } - return this.consistencyPolicy; - } - - /** - * Gets the ReplicationPolicy settings. - * - * @return the replication policy. - */ - public ReplicationPolicy getReplicationPolicy() { - if (this.replicationPolicy == null) { - this.replicationPolicy = super.getObject(Constants.Properties.USER_REPLICATION_POLICY, - ReplicationPolicy.class); - - if (this.replicationPolicy == null) { - this.replicationPolicy = new ReplicationPolicy(); - } - } - - return this.replicationPolicy; - } - - /** - * Gets the SystemReplicationPolicy settings. - * - * @return the system replication policy. - */ - ReplicationPolicy getSystemReplicationPolicy() { - if (this.systemReplicationPolicy == null) { - this.systemReplicationPolicy = super.getObject(Constants.Properties.SYSTEM_REPLICATION_POLICY, - ReplicationPolicy.class); - - if (this.systemReplicationPolicy == null) { - this.systemReplicationPolicy = new ReplicationPolicy(); - } - } - - return this.systemReplicationPolicy; - } - - /** - * Gets the QueryEngineConfiuration settings. - * - * @return the query engine configuration. - */ - Map getQueryEngineConfiuration() { - if (this.queryEngineConfiguration == null) { - String queryEngineConfigurationJsonString = super.getObject(Constants.Properties.QUERY_ENGINE_CONFIGURATION, - String.class); - if (StringUtils.isNotEmpty(queryEngineConfigurationJsonString)) { - TypeReference> typeRef = new TypeReference>() { - }; - try { - this.queryEngineConfiguration = Utils.getSimpleObjectMapper() - .readValue(queryEngineConfigurationJsonString, typeRef); - } catch (IOException e) { - throw new IllegalArgumentException(e); - } - if (this.queryEngineConfiguration == null) { - this.queryEngineConfiguration = new HashMap<>(); - } - } - } - - return this.queryEngineConfiguration; - } - - /** - * Gets the list of writable locations for this database account. - * - * @return the list of writable locations. - */ - public Iterable getWritableLocations() { - return super.getCollection(Constants.Properties.WRITABLE_LOCATIONS, DatabaseAccountLocation.class); - } - - /** - * Sets the list of writable locations for this database account. - *

- * The list of writable locations are returned by the service. - * - * @param locations the list of writable locations. - */ - void setWritableLocations(Iterable locations) { - super.set(Constants.Properties.WRITABLE_LOCATIONS, locations); - } - - /** - * Gets the list of readable locations for this database account. - * - * @return the list of readable locations. - */ - public Iterable getReadableLocations() { - return super.getCollection(Constants.Properties.READABLE_LOCATIONS, DatabaseAccountLocation.class); - } - - /** - * Sets the list of readable locations for this database account. - *

- * The list of readable locations are returned by the service. - * - * @param locations the list of readable locations. - */ - void setReadableLocations(Iterable locations) { - super.set(Constants.Properties.READABLE_LOCATIONS, locations); - } - - boolean isEnableMultipleWriteLocations() { - return ObjectUtils.defaultIfNull(super.getBoolean(Constants.Properties.ENABLE_MULTIPLE_WRITE_LOCATIONS), false); - } - - void setEnableMultipleWriteLocations(boolean value) { - super.set(Constants.Properties.ENABLE_MULTIPLE_WRITE_LOCATIONS, value); - } - - @Override - void populatePropertyBag() { - if (this.consistencyPolicy != null) { - this.consistencyPolicy.populatePropertyBag(); - super.set(Constants.Properties.USER_CONSISTENCY_POLICY, this.consistencyPolicy); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DatabaseAccountLocation.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DatabaseAccountLocation.java deleted file mode 100644 index 2ee1cca92a09..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DatabaseAccountLocation.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents the location of a database account in the Azure Cosmos DB database service. - */ -public class DatabaseAccountLocation extends JsonSerializable { - - /** - * Default Constructor. Creates a new instance of the - * DatabaseAccountLocation object. - */ - DatabaseAccountLocation() { - super(); - } - - /** - * Creates a new instance of the DatabaseAccountLocation object from a JSON - * string. - * - * @param jsonString the JSON string that represents the DatabaseAccountLocation object. - */ - public DatabaseAccountLocation(String jsonString) { - super(jsonString); - } - - /** - * Gets The name of the database account location. - * - * @return the name of the database account location. - */ - public String getName() { - return super.getString(Constants.Properties.Name); - } - - /** - * Sets the name of the database account location. - * - * @param name the name of the database account location. - */ - public void setName(String name) { - super.set(Constants.Properties.Name, name); - } - - /** - * Gets The endpoint (the URI) of the database account location. - * - * @return the endpoint of the database account location. - */ - public String getEndpoint() { - return super.getString(Constants.Properties.DATABASE_ACCOUNT_ENDPOINT); - } - - /** - * Sets the endpoint (the URI) of the database account location. - * - * @param endpoint the endpoint of the database account location. - */ - public void setEndpoint(String endpoint) { - super.set(Constants.Properties.DATABASE_ACCOUNT_ENDPOINT, endpoint); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Document.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Document.java deleted file mode 100644 index 31922b93adba..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Document.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.io.IOException; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents a document in the Azure Cosmos DB database service. - *

- * A document is a structured JSON document. There is no set schema for the JSON documents, and a document may contain - * any number of custom properties as well as an optional list of attachments. Document is an application resource and - * can be authorized using the master key or resource keys. - */ -public class Document extends Resource { - - /** - * Initialize a document object. - */ - public Document() { - super(); - } - - /** - * Initialize a document object from json string. - * - * @param jsonString the json string that represents the document object. - * @param objectMapper the custom object mapper - */ - public Document(String jsonString, ObjectMapper objectMapper) { - super(jsonString, objectMapper); - } - - /** - * Initialize a document object from json string. - * - * @param jsonString the json string that represents the document object. - */ - public Document(String jsonString) { - super(jsonString); - } - - static Document FromObject(Object document, ObjectMapper objectMapper) { - Document typedDocument; - if (document instanceof Document) { - typedDocument = (Document) document; - } else { - try { - return new Document(objectMapper.writeValueAsString(document)); - } catch (IOException e) { - throw new IllegalArgumentException("Can't serialize the object into the json string", e); - } - } - return typedDocument; - } - - /** - * Gets the document's time-to-live value. - * - * @return the document's time-to-live value in seconds. - */ - public Integer getTimeToLive() { - if (super.has(Constants.Properties.TTL)) { - return super.getInt(Constants.Properties.TTL); - } - - return null; - } - - /** - * Sets the document's time-to-live value. - *

- * A document's time-to-live value is an optional property. If set, the document expires after the specified number - * of seconds since its last write time. The value of this property should be one of the following: - *

- * null - indicates the time-to-live value for this document inherits from the parent collection's default time-to-live value. - *

- * nonzero positive integer - indicates the number of seconds before the document expires. It overrides the default time-to-live - * value specified on the parent collection, unless the parent collection's default time-to-live is null. - *

- * -1 - indicates the document never expires. It overrides the default time-to-live - * value specified on the parent collection, unless the parent collection's default time-to-live is null. - * - * @param timeToLive the document's time-to-live value in seconds. - */ - public void setTimeToLive(Integer timeToLive) { - // a "null" value is represented as a missing element on the wire. - // setting timeToLive to null should remove the property from the property bag. - if (timeToLive != null) { - super.set(Constants.Properties.TTL, timeToLive); - } else if (super.has(Constants.Properties.TTL)) { - super.remove(Constants.Properties.TTL); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DocumentClientException.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DocumentClientException.java deleted file mode 100644 index c9b6d4a99fd9..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DocumentClientException.java +++ /dev/null @@ -1,302 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.net.URI; -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.lang3.StringUtils; - -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; - -/** - * This class defines a custom exception type for all operations on - * DocumentClient in the Azure Cosmos DB database service. Applications are expected to catch DocumentClientException - * and handle errors as appropriate when calling methods on DocumentClient. - *

- * Errors coming from the service during normal execution are converted to - * DocumentClientException before returning to the application with the following exception: - *

- * When a BE error is encountered during a QueryIterable<T> iteration, an IllegalStateException - * is thrown instead of DocumentClientException. - *

- * When a transport level error happens that request is not able to reach the service, - * an IllegalStateException is thrown instead of DocumentClientException. - */ -public class DocumentClientException extends Exception { - private static final long serialVersionUID = 1L; - - private Error error; - private final int statusCode; - private final Map responseHeaders; - private ClientSideRequestStatistics clientSideRequestStatistics; - String resourceAddress; - String partitionKeyRangeId; - URI requestUri; - long lsn; - Map requestHeaders; - - /** - * Creates a new instance of the DocumentClientException class. - * - * @param statusCode the http status code of the response. - */ - public DocumentClientException(int statusCode) { - this.statusCode = statusCode; - this.responseHeaders = new HashMap<>(); - } - - /** - * Creates a new instance of the DocumentClientException class. - * - * @param statusCode the http status code of the response. - * @param errorMessage the error message. - */ - public DocumentClientException(int statusCode, String errorMessage) { - Error error = new Error(); - error.set(Constants.Properties.MESSAGE, errorMessage); - this.statusCode = statusCode; - this.error = error; - this.responseHeaders = new HashMap<>(); - } - - /** - * Creates a new instance of the DocumentClientException class. - * - * @param statusCode the http status code of the response. - * @param innerException the original exception. - */ - public DocumentClientException(int statusCode, Exception innerException) { - super(innerException); - this.statusCode = statusCode; - this.responseHeaders = new HashMap<>(); - } - - /** - * Creates a new instance of the DocumentClientException class. - * - * @param statusCode the http status code of the response. - * @param errorResource the error resource object. - * @param responseHeaders the response headers. - */ - public DocumentClientException(int statusCode, Error errorResource, Map responseHeaders) { - this(null, statusCode, errorResource, responseHeaders); - } - - /** - * Creates a new instance of the DocumentClientException class. - * - * @param resourceAddress the address of the resource the request is associated with. - * @param statusCode the http status code of the response. - * @param errorResource the error resource object. - * @param responseHeaders the response headers. - */ - - public DocumentClientException(String resourceAddress, int statusCode, Error errorResource, Map responseHeaders) { - - super(errorResource == null ? null : errorResource.getMessage()); - - this.responseHeaders = safeResponseHeaders(responseHeaders); - this.resourceAddress = resourceAddress; - this.statusCode = statusCode; - this.error = errorResource; - } - - /** Creates a new instance of the DocumentClientException class. - * @param message the string message. - * @param statusCode the http status code of the response. - * @param exception the exception object. - * @param responseHeaders the response headers. - * @param resourceAddress the address of the resource the request is associated with. - */ - public DocumentClientException(String message, Exception exception, Map responseHeaders, int statusCode, String resourceAddress) { - - super(message, exception); - - this.responseHeaders = safeResponseHeaders(responseHeaders); - this.resourceAddress = resourceAddress; - this.statusCode = statusCode; - } - - @Override - public String getMessage() { - if (clientSideRequestStatistics == null) { - return getInnerErrorMessage(); - } - return getInnerErrorMessage() + ", " + clientSideRequestStatistics.toString(); - } - - /** - * Gets the activity ID associated with the request. - * - * @return the activity ID. - */ - public String getActivityId() { - if (this.responseHeaders != null) { - return this.responseHeaders.get(HttpConstants.HttpHeaders.ACTIVITY_ID); - } - - return null; - } - - /** - * Gets the http status code. - * - * @return the status code. - */ - public int getStatusCode() { - return this.statusCode; - } - - /** - * Gets the sub status code. - * - * @return the status code. - */ - public int getSubStatusCode() { - int code = HttpConstants.SubStatusCodes.UNKNOWN; - if (this.responseHeaders != null) { - String subStatusString = this.responseHeaders.get(HttpConstants.HttpHeaders.SUB_STATUS); - if (StringUtils.isNotEmpty(subStatusString)) { - try { - code = Integer.parseInt(subStatusString); - } catch (NumberFormatException e) { - // If value cannot be parsed as Integer, return Unknown. - } - } - } - - return code; - } - - /** - * Gets the error code associated with the exception. - * - * @return the error. - */ - public Error getError() { - return this.error; - } - - /** - * Gets the recommended time interval after which the client can retry - * failed requests - * - * @return the recommended time interval after which the client can retry - * failed requests. - */ - public long getRetryAfterInMilliseconds() { - long retryIntervalInMilliseconds = 0; - - if (this.responseHeaders != null) { - String header = this.responseHeaders.get(HttpConstants.HttpHeaders.RETRY_AFTER_IN_MILLISECONDS); - - if (StringUtils.isNotEmpty(header)) { - try { - retryIntervalInMilliseconds = Long.parseLong(header); - } catch (NumberFormatException e) { - // If the value cannot be parsed as long, return 0. - } - } - } - - // - // In the absence of explicit guidance from the backend, don't introduce - // any unilateral retry delays here. - return retryIntervalInMilliseconds; - } - - /** - * Gets the response headers as key-value pairs - * - * @return the response headers - */ - public Map getResponseHeaders() { - return this.responseHeaders; - } - - /** - * Gets the resource address associated with this exception. - * - * @return the resource address associated with this exception. - */ - String getResourceAddress() { - return this.resourceAddress; - } - - /** - * Gets the Client side request statistics associated with this exception. - * - * @return Client side request statistics associated with this exception. - */ - public ClientSideRequestStatistics getClientSideRequestStatistics() { - return clientSideRequestStatistics; - } - - public void setClientSideRequestStatistics(ClientSideRequestStatistics clientSideRequestStatistics) { - this.clientSideRequestStatistics = clientSideRequestStatistics; - } - - @Override - public String toString() { - return getClass().getSimpleName() + "{" + - "error=" + error + - ", resourceAddress='" + resourceAddress + '\'' + - ", statusCode=" + statusCode + - ", message=" + getMessage() + - ", getCauseInfo=" + getCauseInfo() + - ", responseHeaders=" + responseHeaders + - ", requestHeaders=" + requestHeaders + - '}'; - } - - String getInnerErrorMessage() { - String innerErrorMessage = super.getMessage(); - if (error != null) { - innerErrorMessage = error.getMessage(); - if (innerErrorMessage == null) { - innerErrorMessage = String.valueOf(error.get("Errors")); - } - } - return innerErrorMessage; - } - - private String getCauseInfo() { - Throwable cause = getCause(); - if (cause != null) { - return String.format("[class: %s, message: %s]", cause.getClass(), cause.getMessage()); - } - return null; - } - - private Map safeResponseHeaders(Map map) { - if (map != null) { - return new HashMap<>(map); - } else { - return new HashMap<>(); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DocumentCollection.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DocumentCollection.java deleted file mode 100644 index 351b483e0dc5..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/DocumentCollection.java +++ /dev/null @@ -1,297 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.Constants; -import org.apache.commons.lang3.StringUtils; - -/** - * Represents a document collection in the Azure Cosmos DB database service. A collection is a named logical container - * for documents. - *

- * A database may contain zero or more named collections and each collection consists of zero or more JSON documents. - * Being schema-free, the documents in a collection do not need to share the same structure or fields. Since collections - * are application resources, they can be authorized using either the master key or resource keys. - */ -public final class DocumentCollection extends Resource { - private IndexingPolicy indexingPolicy; - private UniqueKeyPolicy uniqueKeyPolicy; - private PartitionKeyDefinition partitionKeyDefinition; - - /** - * Initialize a document collection object. - */ - public DocumentCollection() { - super(); - } - - /** - * Initialize a document collection object from json string. - * - * @param jsonString the json string that represents the document collection. - */ - public DocumentCollection(String jsonString) { - super(jsonString); - } - - /** - * Gets the indexing policy. - * - * @return the indexing policy. - */ - public IndexingPolicy getIndexingPolicy() { - if (this.indexingPolicy == null) { - if (super.has(Constants.Properties.INDEXING_POLICY)) { - this.indexingPolicy = super.getObject(Constants.Properties.INDEXING_POLICY, IndexingPolicy.class); - } else { - this.indexingPolicy = new IndexingPolicy(); - } - } - - return this.indexingPolicy; - } - - /** - * Sets the indexing policy. - * - * @param indexingPolicy the indexing policy. - */ - public void setIndexingPolicy(IndexingPolicy indexingPolicy) { - if (indexingPolicy == null) { - throw new IllegalArgumentException("IndexingPolicy cannot be null."); - } - - this.indexingPolicy = indexingPolicy; - } - - /** - * Gets the collection's partition key definition. - * - * @return the partition key definition. - */ - public PartitionKeyDefinition getPartitionKey() { - if (this.partitionKeyDefinition == null) { - - if (super.has(Constants.Properties.PARTITION_KEY)) { - this.partitionKeyDefinition = super.getObject(Constants.Properties.PARTITION_KEY, PartitionKeyDefinition.class); - } else { - this.partitionKeyDefinition = new PartitionKeyDefinition(); - } - } - - return this.partitionKeyDefinition; - } - - /** - * Sets the collection's partition key definition. - * - * @param partitionKey the partition key definition. - */ - public void setPartitionKey(PartitionKeyDefinition partitionKey) { - if (partitionKey == null) { - throw new IllegalArgumentException("partitionKey cannot be null."); - } - - this.partitionKeyDefinition = partitionKey; - } - - /** - * Gets the collection's default time-to-live value. - * - * @return the default time-to-live value in seconds. - */ - public Integer getDefaultTimeToLive() { - if (super.has(Constants.Properties.DEFAULT_TTL)) { - return super.getInt(Constants.Properties.DEFAULT_TTL); - } - - return null; - } - - /** - * Sets the collection's default time-to-live value. - *

- * The default time-to-live value on a collection is an optional property. If set, the documents within the collection - * expires after the specified number of seconds since their last write time. The value of this property should be one of the following: - *

- * null - indicates evaluation of time-to-live is disabled and documents within the collection will never expire, regardless whether - * individual documents have their time-to-live set. - *

- * nonzero positive integer - indicates the default time-to-live value for all documents within the collection. This value can be overridden - * by individual documents' time-to-live value. - *

- * -1 - indicates by default all documents within the collection never expire. This value can be overridden by individual documents' - * time-to-live value. - * - * @param timeToLive the default time-to-live value in seconds. - */ - public void setDefaultTimeToLive(Integer timeToLive) { - // a "null" value is represented as a missing element on the wire. - // setting timeToLive to null should remove the property from the property bag. - if (timeToLive != null) { - super.set(Constants.Properties.DEFAULT_TTL, timeToLive); - } else if (super.has(Constants.Properties.DEFAULT_TTL)) { - super.remove(Constants.Properties.DEFAULT_TTL); - } - } - - /** - * Sets the Uni that guarantees uniqueness of documents in collection in the Azure Cosmos DB service. - * @return UniqueKeyPolicy - */ - public UniqueKeyPolicy getUniqueKeyPolicy() { - - // Thread safe lazy initialization for case when collection is cached (and is basically readonly). - if (this.uniqueKeyPolicy == null) { - this.uniqueKeyPolicy = super.getObject(Constants.Properties.UNIQUE_KEY_POLICY, UniqueKeyPolicy.class); - - if (this.uniqueKeyPolicy == null) { - this.uniqueKeyPolicy = new UniqueKeyPolicy(); - } - } - - return this.uniqueKeyPolicy; - } - - public void setUniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy) { - if (uniqueKeyPolicy == null) { - throw new IllegalArgumentException("uniqueKeyPolicy cannot be null."); - } - - this.uniqueKeyPolicy = uniqueKeyPolicy; - super.set(Constants.Properties.UNIQUE_KEY_POLICY, uniqueKeyPolicy); - } - - /** - * Gets the conflictResolutionPolicy that is used for resolving conflicting writes - * on documents in different regions, in a collection in the Azure Cosmos DB service. - * - * @return ConflictResolutionPolicy - */ - public ConflictResolutionPolicy getConflictResolutionPolicy() { - return super.getObject(Constants.Properties.CONFLICT_RESOLUTION_POLICY, ConflictResolutionPolicy.class); - } - - /** - * Sets the conflictResolutionPolicy that is used for resolving conflicting writes - * on documents in different regions, in a collection in the Azure Cosmos DB service. - * - * @param value ConflictResolutionPolicy to be used. - */ - public void setConflictResolutionPolicy(ConflictResolutionPolicy value) { - if (value == null) { - throw new IllegalArgumentException("CONFLICT_RESOLUTION_POLICY cannot be null."); - } - - super.set(Constants.Properties.CONFLICT_RESOLUTION_POLICY, value); - } - - - /** - * Gets the self-link for documents in a collection. - * - * @return the document link. - */ - public String getDocumentsLink() { - return String.format("%s/%s", - StringUtils.stripEnd(super.getSelfLink(), "/"), - super.getString(Constants.Properties.DOCUMENTS_LINK)); - } - - /** - * Gets the self-link for stored procedures in a collection. - * - * @return the stored procedures link. - */ - public String getStoredProceduresLink() { - return String.format("%s/%s", - StringUtils.stripEnd(super.getSelfLink(), "/"), - super.getString(Constants.Properties.STORED_PROCEDURES_LINK)); - } - - /** - * Gets the self-link for triggers in a collection. - * - * @return the trigger link. - */ - public String getTriggersLink() { - return StringUtils.removeEnd(this.getSelfLink(), "/") + - "/" + super.getString(Constants.Properties.TRIGGERS_LINK); - } - - /** - * Gets the self-link for user defined functions in a collection. - * - * @return the user defined functions link. - */ - public String getUserDefinedFunctionsLink() { - return StringUtils.removeEnd(this.getSelfLink(), "/") + - "/" + super.getString(Constants.Properties.USER_DEFINED_FUNCTIONS_LINK); - } - - /** - * Gets the self-link for conflicts in a collection. - * - * @return the conflicts link. - */ - public String getConflictsLink() { - return StringUtils.removeEnd(this.getSelfLink(), "/") + - "/" + super.getString(Constants.Properties.CONFLICTS_LINK); - } - - @Override - void populatePropertyBag() { - if (this.indexingPolicy == null) { - this.getIndexingPolicy(); - } - if (this.uniqueKeyPolicy == null) { - this.getUniqueKeyPolicy(); - } - - if (this.partitionKeyDefinition != null) { - this.partitionKeyDefinition.populatePropertyBag(); - super.set(Constants.Properties.PARTITION_KEY, this.partitionKeyDefinition); - } - - this.indexingPolicy.populatePropertyBag(); - this.uniqueKeyPolicy.populatePropertyBag(); - super.set(Constants.Properties.INDEXING_POLICY, this.indexingPolicy); - super.set(Constants.Properties.UNIQUE_KEY_POLICY, this.uniqueKeyPolicy); - } - - @Override - public boolean equals(Object obj) { - if (obj == null || !DocumentCollection.class.isAssignableFrom(obj.getClass())) { - return false; - } - - DocumentCollection typedObj = (DocumentCollection) obj; - return typedObj.getResourceId().equals(this.getResourceId()); - } - - @Override - public int hashCode() { - return this.getResourceId().hashCode(); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Error.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Error.java deleted file mode 100644 index 8923700be3c2..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Error.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Encapsulates error related details in the Azure Cosmos DB database service. - */ -public class Error extends Resource { - /** - * Initialize a new instance of the Error object. - */ - public Error() { - super(); - } - - /** - * Initialize a new instance of the Error object from a JSON string. - * - * @param objectNode the {@link ObjectNode} that represents the error. - */ - Error(ObjectNode objectNode) { - super(objectNode); - } - - /** - * Initialize a new instance of the Error object from a JSON string. - * - * @param jsonString the jsonString that represents the error. - */ - public Error(String jsonString) { - super(jsonString); - } - - /** - * Initialize a new instance of the Error object. - * - * @param errorCode the error code. - * @param message the error message. - */ - public Error(String errorCode, String message) { - this(errorCode, message, null); - } - - /** - * Initialize a new instance of the Error object. - * - * @param errorCode - * the error code. - * @param message - * the error message. - * @param additionalErrorInfo - * additional error info. - */ - public Error(String errorCode, String message, String additionalErrorInfo) { - super(); - this.setCode(errorCode); - this.setMessage(message); - this.setAdditionalErrorInfo(additionalErrorInfo); - } - - /** - * Gets the error code. - * - * @return the error code. - */ - public String getCode() { - return super.getString(Constants.Properties.CODE); - } - - /** - * Sets the error code. - * - * @param code the error code. - */ - private void setCode(String code) { - super.set(Constants.Properties.CODE, code); - } - - /** - * Gets the error message. - * - * @return the error message. - */ - public String getMessage() { - return super.getString(Constants.Properties.MESSAGE); - } - - /** - * Sets the error message. - * - * @param message the error message. - */ - private void setMessage(String message) { - super.set(Constants.Properties.MESSAGE, message); - } - - /** - * Gets the error details. - * - * @return the error details. - */ - public String getErrorDetails() { - return super.getString(Constants.Properties.ERROR_DETAILS); - } - - /** - * Sets the partitioned query execution info. - * - * @param additionalErrorInfo - * the partitioned query execution info. - */ - private void setAdditionalErrorInfo(String additionalErrorInfo) { - super.set(Constants.Properties.ADDITIONAL_ERROR_INFO, additionalErrorInfo); - } - - /** - * Gets the partitioned query execution info. - * - * @return the partitioned query execution info. - */ - public String getPartitionedQueryExecutionInfo() { - return super.getString(Constants.Properties.ADDITIONAL_ERROR_INFO); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ExcludedPath.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ExcludedPath.java deleted file mode 100644 index 58cb1835d70d..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ExcludedPath.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents an excluded path of the IndexingPolicy in the Azure Cosmos DB database service. - */ -public class ExcludedPath extends JsonSerializable { - - /** - * Constructor. - */ - public ExcludedPath() { - super(); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the excluded path. - */ - public ExcludedPath(String jsonString) { - super(jsonString); - } - - /** - * Gets path. - * - * @return the path. - */ - public String getPath() { - return super.getString(Constants.Properties.PATH); - } - - /** - * Sets path. - * - * @param path the path. - */ - public void setPath(String path) { - super.set(Constants.Properties.PATH, path); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/FeedOptions.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/FeedOptions.java deleted file mode 100644 index d0fd538ade3b..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/FeedOptions.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Specifies the options associated with feed methods (enumeration operations) in the Azure Cosmos DB database service. - */ -public final class FeedOptions extends FeedOptionsBase { - private String sessionToken; - private String partitionKeyRangeId; - private Boolean enableScanInQuery; - private Boolean emitVerboseTracesInQuery; - private Boolean enableCrossPartitionQuery; - private int maxDegreeOfParallelism; - private int maxBufferedItemCount; - private int responseContinuationTokenLimitInKb; - - public FeedOptions() {} - - public FeedOptions(FeedOptions options) { - super(options); - this.sessionToken = options.sessionToken; - this.partitionKeyRangeId = options.partitionKeyRangeId; - this.enableScanInQuery = options.enableScanInQuery; - this.emitVerboseTracesInQuery = options.emitVerboseTracesInQuery; - this.enableCrossPartitionQuery = options.enableCrossPartitionQuery; - this.maxDegreeOfParallelism = options.maxDegreeOfParallelism; - this.maxBufferedItemCount = options.maxBufferedItemCount; - this.responseContinuationTokenLimitInKb = options.responseContinuationTokenLimitInKb; - } - - /** - * Gets the partitionKeyRangeId. - * - * @return the partitionKeyRangeId. - */ - public String getPartitionKeyRangeIdInternal() { - return this.partitionKeyRangeId; - } - - /** - * Sets the partitionKeyRangeId. - * - * @param partitionKeyRangeId - * the partitionKeyRangeId. - */ - public void setPartitionKeyRangeIdInternal(String partitionKeyRangeId) { - this.partitionKeyRangeId = partitionKeyRangeId; - } - - /** - * Gets the session token for use with session consistency. - * - * @return the session token. - */ - public String getSessionToken() { - return this.sessionToken; - } - - /** - * Sets the session token for use with session consistency. - * - * @param sessionToken - * the session token. - */ - public void setSessionToken(String sessionToken) { - this.sessionToken = sessionToken; - } - - /** - * Gets the option to allow scan on the queries which couldn't be served as - * indexing was opted out on the requested paths. - * - * @return the option of enable scan in query. - */ - public Boolean getEnableScanInQuery() { - return this.enableScanInQuery; - } - - /** - * Sets the option to allow scan on the queries which couldn't be served as - * indexing was opted out on the requested paths. - * - * @param enableScanInQuery - * the option of enable scan in query. - */ - public void setEnableScanInQuery(Boolean enableScanInQuery) { - this.enableScanInQuery = enableScanInQuery; - } - - /** - * Gets the option to allow queries to emit out verbose traces for - * investigation. - * - * @return the emit verbose traces in query. - */ - public Boolean getEmitVerboseTracesInQuery() { - return this.emitVerboseTracesInQuery; - } - - /** - * Sets the option to allow queries to emit out verbose traces for - * investigation. - * - * @param emitVerboseTracesInQuery - * the emit verbose traces in query. - */ - public void setEmitVerboseTracesInQuery(Boolean emitVerboseTracesInQuery) { - this.emitVerboseTracesInQuery = emitVerboseTracesInQuery; - } - - /** - * Gets the option to allow queries to run across all partitions of the - * collection. - * - * @return whether to allow queries to run across all partitions of the - * collection. - */ - public Boolean getEnableCrossPartitionQuery() { - return this.enableCrossPartitionQuery; - } - - /** - * Sets the option to allow queries to run across all partitions of the - * collection. - * - * @param enableCrossPartitionQuery - * whether to allow queries to run across all partitions of the - * collection. - */ - public void setEnableCrossPartitionQuery(Boolean enableCrossPartitionQuery) { - this.enableCrossPartitionQuery = enableCrossPartitionQuery; - } - - /** - * Gets the number of concurrent operations run client side during parallel - * query execution. - * - * @return number of concurrent operations run client side during parallel - * query execution. - */ - public int getMaxDegreeOfParallelism() { - return maxDegreeOfParallelism; - } - - /** - * Sets the number of concurrent operations run client side during parallel - * query execution. - * - * @param maxDegreeOfParallelism - * number of concurrent operations. - */ - public void setMaxDegreeOfParallelism(int maxDegreeOfParallelism) { - this.maxDegreeOfParallelism = maxDegreeOfParallelism; - } - - /** - * Gets the maximum number of items that can be buffered client side during - * parallel query execution. - * - * @return maximum number of items that can be buffered client side during - * parallel query execution. - */ - public int getMaxBufferedItemCount() { - return maxBufferedItemCount; - } - - /** - * Sets the maximum number of items that can be buffered client side during - * parallel query execution. - * - * @param maxBufferedItemCount - * maximum number of items. - */ - public void setMaxBufferedItemCount(int maxBufferedItemCount) { - this.maxBufferedItemCount = maxBufferedItemCount; - } - - /** - * Sets the ResponseContinuationTokenLimitInKb request option for document query requests - * in the Azure Cosmos DB service. - * - * ResponseContinuationTokenLimitInKb is used to limit the length of continuation token in the query response. - * Valid values are >= 1. - * - * The continuation token contains both required and optional fields. - * The required fields are necessary for resuming the execution from where it was stooped. - * The optional fields may contain serialized index lookup work that was done but not yet utilized. - * This avoids redoing the work again in subsequent continuations and hence improve the query performance. - * Setting the maximum continuation size to 1KB, the Azure Cosmos DB service will only serialize required fields. - * Starting from 2KB, the Azure Cosmos DB service would serialize as much as it could fit till it reaches the maximum specified size. - * - * @param limitInKb continuation token size limit. - */ - public void setResponseContinuationTokenLimitInKb(int limitInKb) { - this.responseContinuationTokenLimitInKb = limitInKb; - } - - /** - * Gets the ResponseContinuationTokenLimitInKb request option for document query requests - * in the Azure Cosmos DB service. If not already set returns 0. - * - * ResponseContinuationTokenLimitInKb is used to limit the length of continuation token in the query response. - * Valid values are >= 1. - * - * @return return set ResponseContinuationTokenLimitInKb, or 0 if not set - */ - public int getResponseContinuationTokenLimitInKb() { - return responseContinuationTokenLimitInKb; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/FeedOptionsBase.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/FeedOptionsBase.java deleted file mode 100644 index d2edb4cf433f..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/FeedOptionsBase.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.Map; - -/** - * Specifies the common options associated with feed methods (enumeration operations) in the Azure Cosmos DB database service. - */ -public abstract class FeedOptionsBase { - private Integer maxItemCount; - private String requestContinuation; - private PartitionKey partitionkey; - private boolean populateQueryMetrics; - private Map properties; - - protected FeedOptionsBase() {} - - FeedOptionsBase(FeedOptionsBase options) { - this.maxItemCount = options.maxItemCount; - this.requestContinuation = options.requestContinuation; - this.partitionkey = options.partitionkey; - this.populateQueryMetrics = options.populateQueryMetrics; - } - - /** - * Gets the maximum number of items to be returned in the enumeration - * operation. - * - * @return the max number of items. - */ - public Integer getMaxItemCount() { - return this.maxItemCount; - } - - /** - * Sets the maximum number of items to be returned in the enumeration - * operation. - * - * @param maxItemCount the max number of items. - */ - public void setMaxItemCount(Integer maxItemCount) { - this.maxItemCount = maxItemCount; - } - - /** - * Gets the request continuation token. - * - * @return the request continuation. - */ - public String getRequestContinuation() { - return this.requestContinuation; - } - - /** - * Sets the request continuation token. - * - * @param requestContinuation - * the request continuation. - */ - public void setRequestContinuation(String requestContinuation) { - this.requestContinuation = requestContinuation; - } - - /** - * Gets the partition key used to identify the current request's target - * partition. - * - * @return the partition key. - */ - public PartitionKey getPartitionKey() { - return this.partitionkey; - } - - /** - * Sets the partition key used to identify the current request's target - * partition. - * - * @param partitionkey - * the partition key value. - */ - public void setPartitionKey(PartitionKey partitionkey) { - this.partitionkey = partitionkey; - } - - /** - * Gets the option to enable populate query metrics - * @return whether to enable populate query metrics - */ - public boolean getPopulateQueryMetrics() { - return populateQueryMetrics; - } - - /** - * Sets the option to enable/disable getting metrics relating to query execution on document query requests - * @param populateQueryMetrics whether to enable or disable query metrics - */ - public void setPopulateQueryMetrics(boolean populateQueryMetrics) { - this.populateQueryMetrics = populateQueryMetrics; - } - - /** - * Gets the properties - * - * @return Map of request options properties - */ - public Map getProperties() { - return properties; - } - - /** - * Sets the properties used to identify the request token. - * - * @param properties the properties. - */ - public void setProperties(Map properties) { - this.properties = properties; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/FeedResponse.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/FeedResponse.java deleted file mode 100644 index 3ce9c19ed4ec..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/FeedResponse.java +++ /dev/null @@ -1,401 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -import org.apache.commons.lang3.StringUtils; - -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; - -public class FeedResponse { - - private final List results; - private final Map header; - private final HashMap usageHeaders; - private final HashMap quotaHeaders; - private final boolean useEtagAsContinuation; - boolean nochanges; - private final ConcurrentMap queryMetricsMap; - private final String DefaultPartition = "0"; - - FeedResponse(List results, Map headers) { - this(results, headers, false, false, new ConcurrentHashMap<>()); - } - - FeedResponse(List results, Map headers, ConcurrentMap queryMetricsMap) { - this(results, headers, false, false, queryMetricsMap); - } - - FeedResponse(List results, Map header, boolean nochanges) { - this(results, header, true, nochanges, new ConcurrentHashMap<>()); - } - - // TODO: need to more sure the query metrics can round trip just from the headers. - // We can then remove it as a parameter. - private FeedResponse( - List results, - Map header, - boolean useEtagAsContinuation, - boolean nochanges, - ConcurrentMap queryMetricsMap) { - this.results = results; - this.header = header; - this.usageHeaders = new HashMap<>(); - this.quotaHeaders = new HashMap<>(); - this.useEtagAsContinuation = useEtagAsContinuation; - this.nochanges = nochanges; - this.queryMetricsMap = new ConcurrentHashMap<>(queryMetricsMap); - } - - /** - * Results. - * - * @return the list of results. - */ - public List getResults() { - return results; - } - - /** - * Gets the maximum quota for database resources within the account from the Azure Cosmos DB service. - * - * @return The maximum quota for the account. - */ - public long getDatabaseQuota() { - return this.getMaxQuotaHeader(Constants.Quota.DATABASE); - } - - /** - * Gets the current number of database resources within the account from the Azure Cosmos DB service. - * - * @return The current number of databases. - */ - public long getDatabaseUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.DATABASE); - } - - /** - * Gets the maximum quota for collection resources within an account from the Azure Cosmos DB service. - * - * @return The maximum quota for the account. - */ - public long getCollectionQuota() { - return this.getMaxQuotaHeader(Constants.Quota.COLLECTION); - } - - /** - * Gets the current number of collection resources within the account from the Azure Cosmos DB service. - * - * @return The current number of collections. - */ - public long getCollectionUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.COLLECTION); - } - - /** - * Gets the maximum quota for user resources within an account from the Azure Cosmos DB service. - * - * @return The maximum quota for the account. - */ - public long getUserQuota() { - return this.getMaxQuotaHeader(Constants.Quota.USER); - } - - /** - * Gets the current number of user resources within the account from the Azure Cosmos DB service. - * - * @return The current number of users. - */ - public long getUserUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.USER); - } - - /** - * Gets the maximum quota for permission resources within an account from the Azure Cosmos DB service. - * - * @return The maximum quota for the account. - */ - public long getPermissionQuota() { - return this.getMaxQuotaHeader(Constants.Quota.PERMISSION); - } - - /** - * Gets the current number of permission resources within the account from the Azure Cosmos DB service. - * - * @return The current number of permissions. - */ - public long getPermissionUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.PERMISSION); - } - - /** - * Gets the maximum size of a collection in kilobytes from the Azure Cosmos DB service. - * - * @return The maximum quota in kilobytes. - */ - public long getCollectionSizeQuota() { - return this.getMaxQuotaHeader(Constants.Quota.COLLECTION_SIZE); - } - - /** - * Gets the current size of a collection in kilobytes from the Azure Cosmos DB service. - * - * @return The current size of a collection in kilobytes. - */ - public long getCollectionSizeUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.COLLECTION_SIZE); - } - - /** - * Gets the maximum quota of stored procedures for a collection from the Azure Cosmos DB service. - * - * @return The maximum stored procedure quota. - */ - public long getStoredProceduresQuota() { - return this.getMaxQuotaHeader(Constants.Quota.STORED_PROCEDURE); - } - - /** - * Gets the current number of stored procedures for a collection from the Azure Cosmos DB service. - * - * @return The current number of stored procedures. - */ - public long getStoredProceduresUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.STORED_PROCEDURE); - } - - /** - * Gets the maximum quota of triggers for a collection from the Azure Cosmos DB service. - * - * @return The maximum triggers quota. - */ - public long getTriggersQuota() { - return this.getMaxQuotaHeader(Constants.Quota.TRIGGER); - } - - /** - * Get the current number of triggers for a collection from the Azure Cosmos DB service. - * - * @return The current number of triggers. - */ - public long getTriggersUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.TRIGGER); - } - - /** - * Gets the maximum quota of user defined functions for a collection from the Azure Cosmos DB service. - * - * @return The maximum user defined functions quota. - */ - public long getUserDefinedFunctionsQuota() { - return this.getMaxQuotaHeader(Constants.Quota.USER_DEFINED_FUNCTION); - } - - /** - * Gets the current number of user defined functions for a collection from the Azure Cosmos DB service. - * - * @return the current number of user defined functions. - */ - public long getUserDefinedFunctionsUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.USER_DEFINED_FUNCTION); - } - - /** - * Gets the maximum size limit for this entity from the Azure Cosmos DB service. - * - * @return the maximum size limit for this entity. - * Measured in kilobytes for document resources and in counts for other resources. - */ - public String getMaxResourceQuota() { - return getValueOrNull(header, - HttpConstants.HttpHeaders.MAX_RESOURCE_QUOTA); - } - - /** - * Gets the current size of this entity from the Azure Cosmos DB service. - * - * @return the current size for this entity. Measured in kilobytes for document resources - * and in counts for other resources. - */ - public String getCurrentResourceQuotaUsage() { - return getValueOrNull(header, - HttpConstants.HttpHeaders.CURRENT_RESOURCE_QUOTA_USAGE); - } - - /** - * Gets the number of index paths (terms) generated by the operation. - * - * @return the request charge. - */ - public double getRequestCharge() { - String value = getValueOrNull(header, - HttpConstants.HttpHeaders.REQUEST_CHARGE); - if (StringUtils.isEmpty(value)) { - return 0; - } - return Double.valueOf(value); - } - - /** - * Gets the activity ID for the request. - * - * @return the activity id. - */ - public String getActivityId() { - return getValueOrNull(header, HttpConstants.HttpHeaders.ACTIVITY_ID); - } - - /** - * Gets the continuation token to be used for continuing the enumeration. - * - * @return the response continuation. - */ - public String getResponseContinuation() { - String headerName = useEtagAsContinuation - ? HttpConstants.HttpHeaders.E_TAG - : HttpConstants.HttpHeaders.CONTINUATION; - return getValueOrNull(header, headerName); - } - - /** - * Gets the session token for use in session consistency. - * - * @return the session token. - */ - public String getSessionToken() { - return getValueOrNull(header, HttpConstants.HttpHeaders.SESSION_TOKEN); - } - - /** - * Gets the response headers. - * - * @return the response headers. - */ - public Map getResponseHeaders() { - return header; - } - - private String getQueryMetricsString(){ - return getValueOrNull(getResponseHeaders(), - HttpConstants.HttpHeaders.QUERY_METRICS); - } - - /** - * Gets the QueryMetrics for each partition. - * - * @return the QueryMetrics for each partition. - */ - public ConcurrentMap getQueryMetrics() { - if (queryMetricsMap != null && !queryMetricsMap.isEmpty()) { - return queryMetricsMap; - } - - //We parse query metrics for un-partitioned collection here - if (!StringUtils.isEmpty(getQueryMetricsString())) { - String qm = getQueryMetricsString(); - qm += String.format(";%s=%.2f", QueryMetricsConstants.RequestCharge, getRequestCharge()); - queryMetricsMap.put(DefaultPartition, QueryMetrics.createFromDelimitedString(qm)); - } - return queryMetricsMap; - } - - ConcurrentMap getQueryMetricsMap(){ - return queryMetricsMap; - } - - private long getCurrentQuotaHeader(String headerName) { - if (this.usageHeaders.size() == 0 && !StringUtils.isEmpty(this.getMaxResourceQuota()) && - !StringUtils.isEmpty(this.getCurrentResourceQuotaUsage())) { - this.populateQuotaHeader(this.getMaxResourceQuota(), this.getCurrentResourceQuotaUsage()); - } - - if (this.usageHeaders.containsKey(headerName)) { - return this.usageHeaders.get(headerName); - } - - return 0; - } - - private long getMaxQuotaHeader(String headerName) { - if (this.quotaHeaders.size() == 0 && - !StringUtils.isEmpty(this.getMaxResourceQuota()) && - !StringUtils.isEmpty(this.getCurrentResourceQuotaUsage())) { - this.populateQuotaHeader(this.getMaxResourceQuota(), this.getCurrentResourceQuotaUsage()); - } - - if (this.quotaHeaders.containsKey(headerName)) { - return this.quotaHeaders.get(headerName); - } - - return 0; - } - - private void populateQuotaHeader(String headerMaxQuota, - String headerCurrentUsage) { - String[] headerMaxQuotaWords = headerMaxQuota.split(Constants.Quota.DELIMITER_CHARS, -1); - String[] headerCurrentUsageWords = headerCurrentUsage.split(Constants.Quota.DELIMITER_CHARS, -1); - - for (int i = 0; i < headerMaxQuotaWords.length; ++i) { - if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.DATABASE)) { - this.quotaHeaders.put(Constants.Quota.DATABASE, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.DATABASE, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.COLLECTION)) { - this.quotaHeaders.put(Constants.Quota.COLLECTION, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.COLLECTION, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.USER)) { - this.quotaHeaders.put(Constants.Quota.USER, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.USER, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.PERMISSION)) { - this.quotaHeaders.put(Constants.Quota.PERMISSION, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.PERMISSION, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.COLLECTION_SIZE)) { - this.quotaHeaders.put(Constants.Quota.COLLECTION_SIZE, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.COLLECTION_SIZE, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.STORED_PROCEDURE)) { - this.quotaHeaders.put(Constants.Quota.STORED_PROCEDURE, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.STORED_PROCEDURE, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.TRIGGER)) { - this.quotaHeaders.put(Constants.Quota.TRIGGER, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.TRIGGER, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.USER_DEFINED_FUNCTION)) { - this.quotaHeaders.put(Constants.Quota.USER_DEFINED_FUNCTION, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.USER_DEFINED_FUNCTION, - Long.valueOf(headerCurrentUsageWords[i + 1])); - } - } - } - - private static String getValueOrNull(Map map, String key) { - if (map != null) { - return map.get(key); - } - return null; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/HashIndex.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/HashIndex.java deleted file mode 100644 index 2c351733dec8..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/HashIndex.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import org.apache.commons.text.WordUtils; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents a hash index in the Azure Cosmos DB database service. - */ -public final class HashIndex extends Index { - - /** - * Specifies an instance of HashIndex class with specified DataType. - *

- * Here is an example to instantiate HashIndex class passing in the DataType: - *

-     * {@code
-     *
-     * HashIndex hashIndex = new HashIndex(DataType.String);
-     *
-     * }
-     * 
- * - * @param dataType the data type. - */ - public HashIndex(DataType dataType) { - super(IndexKind.Hash); - this.setDataType(dataType); - } - - /** - * Initializes a new instance of the HashIndex class with specified DataType and precision. - *

- * Here is an example to instantiate HashIndex class passing in the DataType: - *

-     * {@code
-     *
-     * HashIndex hashIndex = new HashIndex(DataType.String, 3);
-     *
-     * }
-     * 
- * - * @param dataType the data type. - * @param precision the precision. - */ - public HashIndex(DataType dataType, int precision) { - super(IndexKind.Hash); - this.setDataType(dataType); - this.setPrecision(precision); - } - - /** - * Initializes a new instance of the HashIndex class with json string. - * - * @param jsonString the json string that represents the index. - */ - public HashIndex(String jsonString) { - super(jsonString, IndexKind.Hash); - if (this.getDataType() == null) { - throw new IllegalArgumentException("The jsonString doesn't contain a valid 'dataType'."); - } - } - - /** - * Gets data type. - * - * @return the data type. - */ - public DataType getDataType() { - DataType result = null; - try { - result = DataType.valueOf(WordUtils.capitalize(super.getString(Constants.Properties.DATA_TYPE))); - } catch (IllegalArgumentException e) { - // Ignore exception and let the caller handle null value. - this.getLogger().warn("Invalid index dataType value {}.", super.getString(Constants.Properties.DATA_TYPE)); - } - return result; - } - - /** - * Sets data type. - * - * @param dataType the data type. - */ - public void setDataType(DataType dataType) { - super.set(Constants.Properties.DATA_TYPE, dataType.name()); - } - - /** - * Gets precision. - * - * @return the precision. - */ - public int getPrecision() { - return super.getInt(Constants.Properties.PRECISION); - } - - /** - * Sets precision. - * - * @param precision the precision. - */ - public void setPrecision(int precision) { - super.set(Constants.Properties.PRECISION, precision); - } - - boolean hasPrecision() { - return super.has(Constants.Properties.PRECISION); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IncludedPath.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IncludedPath.java deleted file mode 100644 index 3a630102fde8..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IncludedPath.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.ArrayList; -import java.util.Collection; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; -import org.apache.commons.text.WordUtils; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents an included path of the IndexingPolicy in the Azure Cosmos DB database service. - */ -public class IncludedPath extends JsonSerializable { - - private Collection indexes; - - /** - * Constructor. - */ - public IncludedPath() { - super(); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the included path. - */ - public IncludedPath(String jsonString) { - super(jsonString); - } - - /** - * Gets path. - * - * @return the path. - */ - public String getPath() { - return super.getString(Constants.Properties.PATH); - } - - /** - * Sets path. - * - * @param path the path. - */ - public void setPath(String path) { - super.set(Constants.Properties.PATH, path); - } - - /** - * Gets the paths that are chosen to be indexed by the user. - * - * @return the included paths. - */ - public Collection getIndexes() { - if (this.indexes == null) { - this.indexes = this.getIndexCollection(); - - if (this.indexes == null) { - this.indexes = new ArrayList(); - } - } - - return this.indexes; - } - - public void setIndexes(Collection indexes) { - this.indexes = indexes; - } - - private Collection getIndexCollection() { - if (this.propertyBag != null && this.propertyBag.has(Constants.Properties.INDEXES)) { - ArrayNode jsonArray = (ArrayNode) this.propertyBag.get(Constants.Properties.INDEXES); - Collection result = new ArrayList(); - - for (int i = 0; i < jsonArray.size(); i++) { - JsonNode jsonObject = jsonArray.get(i); - - IndexKind indexKind = IndexKind.valueOf(WordUtils.capitalize( - jsonObject.get(Constants.Properties.INDEX_KIND).asText())); - switch (indexKind) { - case Hash: - result.add(new HashIndex(jsonObject.toString())); - break; - case Range: - result.add(new RangeIndex(jsonObject.toString())); - break; - case Spatial: - result.add(new SpatialIndex(jsonObject.toString())); - break; - } - } - - return result; - } - - return null; - } - - @Override - void populatePropertyBag() { - if (this.indexes != null) { - for (Index index : this.indexes) { - index.populatePropertyBag(); - } - - super.set(Constants.Properties.INDEXES, this.indexes); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Index.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Index.java deleted file mode 100644 index 7a3b00a6dc97..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Index.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import org.apache.commons.text.WordUtils; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents the index of a collection in the Azure Cosmos DB database service. - */ -public abstract class Index extends JsonSerializable { - - /** - * Constructor. - * - * @param indexKind the kind of the index - */ - protected Index(IndexKind indexKind) { - super(); - this.setKind(indexKind); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the index. - * @param indexKind the kind of the index - */ - protected Index(String jsonString, IndexKind indexKind) { - super(jsonString); - this.setKind(indexKind); - } - - /** - * Returns an instance of RangeIndex class with specified DataType. - *

- * Here is an example to create RangeIndex instance passing in the DataType: - *

-     * {@code
-     *
-     * RangeIndex rangeIndex = Index.Range(DataType.Number);
-     *
-     * }
-     * 
- * - * @param dataType the data type. - * @return an instance of RangeIndex type. - */ - public static RangeIndex Range(DataType dataType) { - return new RangeIndex(dataType); - } - - /** - * Returns an instance of RangeIndex class with specified DataType and precision. - *

- * Here is an example to create RangeIndex instance passing in the DataType and precision: - *

-     * {@code
-     *
-     * RangeIndex rangeIndex = Index.Range(DataType.Number, -1);
-     *
-     * }
-     * 
- * - * @param dataType specifies the target data type for the index path specification. - * @param precision specifies the precision to be used for the data type associated with this index. - * @return an instance of RangeIndex type. - */ - public static RangeIndex Range(DataType dataType, int precision) { - return new RangeIndex(dataType, precision); - } - - /** - * Returns an instance of HashIndex class with specified DataType. - *

- * Here is an example to create HashIndex instance passing in the DataType: - *

-     * {@code
-     *
-     * HashIndex hashIndex = Index.Hash(DataType.String);
-     * }
-     * 
- * - * @param dataType specifies the target data type for the index path specification. - * @return an instance of HashIndex type. - */ - public static HashIndex Hash(DataType dataType) { - return new HashIndex(dataType); - } - - /** - * Returns an instance of HashIndex class with specified DataType and precision. - *

- * Here is an example to create HashIndex instance passing in the DataType and precision: - *

- * HashIndex hashIndex = Index.Hash(DataType.String, 3); - * - * @param dataType specifies the target data type for the index path specification. - * @param precision specifies the precision to be used for the data type associated with this index. - * @return an instance of HashIndex type. - */ - public static HashIndex Hash(DataType dataType, int precision) { - return new HashIndex(dataType, precision); - } - - /** - * Returns an instance of SpatialIndex class with specified DataType. - *

- * Here is an example to create SpatialIndex instance passing in the DataType: - *

- * SpatialIndex spatialIndex = Index.Spatial(DataType.Point); - * - * @param dataType specifies the target data type for the index path specification. - * @return an instance of SpatialIndex type. - */ - public static SpatialIndex Spatial(DataType dataType) { - return new SpatialIndex(dataType); - } - - /** - * Gets index kind. - * - * @return the index kind. - */ - public IndexKind getKind() { - IndexKind result = null; - try { - result = IndexKind.valueOf(WordUtils.capitalize(super.getString(Constants.Properties.INDEX_KIND))); - } catch (IllegalArgumentException e) { - this.getLogger().warn("Invalid index kind value %s.", super.getString(Constants.Properties.INDEX_KIND)); - } - - return result; - } - - /** - * Sets index kind. - * - * @param indexKind the index kind. - */ - private void setKind(IndexKind indexKind) { - super.set(Constants.Properties.INDEX_KIND, indexKind.name()); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IndexKind.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IndexKind.java deleted file mode 100644 index 4e63ba467972..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IndexKind.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * These are the indexing types available for indexing a path in the Azure Cosmos DB database service. - * For additional details, refer to - * http://azure.microsoft.com/documentation/articles/documentdb-indexing-policies/#ConfigPolicy. - */ -public enum IndexKind { - // The index entries are hashed to serve point look up queries. - // Can be used to serve queries like: SELECT * FROM docs d WHERE d.prop = 5 - Hash, - - // The index entries are ordered. Range indexes are optimized for inequality predicate queries with efficient range - // scans. - // Can be used to serve queries like: SELECT * FROM docs d WHERE d.prop > 5 - Range, - - // The index entries are indexed to serve spatial queries like below: - // SELECT * FROM Root r WHERE ST_DISTANCE({"type":"Point","coordinates":[71.0589,42.3601]}, r.location) $LE 10000 - Spatial -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IndexingDirective.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IndexingDirective.java deleted file mode 100644 index 603191cc05c8..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IndexingDirective.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Specifies whether or not the resource is to be indexed in the Azure Cosmos DB database service. - */ -public enum IndexingDirective { - - /** - * Use any pre-defined/pre-configured defaults. - */ - Default, - - /** - * Index the resource. - */ - Include, - - /** - * Do not index the resource. - */ - Exclude -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IndexingMode.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IndexingMode.java deleted file mode 100644 index 54bd9b96a99e..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IndexingMode.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Specifies the supported indexing modes in the Azure Cosmos DB database service. - */ -public enum IndexingMode { - /** - * Index is updated synchronously with a create or update operation. - *

- * With consistent indexing, query behavior is the same as the default consistency level for the collection. The - * index is always kept up to date with the data. - */ - Consistent, - - /** - * Index is updated asynchronously with respect to a create or update operation. - *

- * With lazy indexing, queries are eventually consistent. The index is updated when the collection is idle. - */ - Lazy, - - /** - * No index is provided. - *

- * Setting IndexingMode to "None" drops the index. Use this if you don't want to maintain the index for a document - * collection, to save the storage cost or improve the write throughput. Your queries will degenerate to scans of - * the entire collection. - */ - None -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IndexingPolicy.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IndexingPolicy.java deleted file mode 100644 index 41650c03a562..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/IndexingPolicy.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.microsoft.azure.cosmosdb.internal.Constants; -import org.apache.commons.text.WordUtils; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; - -/** - * Represents the indexing policy configuration for a collection in the Azure Cosmos DB database service. - */ -public final class IndexingPolicy extends JsonSerializable { - - private static final String DEFAULT_PATH = "/*"; - - private Collection includedPaths; - private Collection excludedPaths; - private Collection> compositeIndexes; - private Collection spatialIndexes; - - /** - * Constructor. - */ - public IndexingPolicy() { - this.setAutomatic(true); - this.setIndexingMode(IndexingMode.Consistent); - } - - /** - * Initializes a new instance of the IndexingPolicy class with the specified set of indexes as - * default index specifications for the root path. - *

- * The following example shows how to override the default indexingPolicy for root path: - *

-     * {@code
-     * HashIndex hashIndexOverride = Index.Hash(DataType.String, 5);
-     * RangeIndex rangeIndexOverride = Index.Range(DataType.Number, 2);
-     * SpatialIndex spatialIndexOverride = Index.Spatial(DataType.Point);
-     *
-     * IndexingPolicy indexingPolicy = new IndexingPolicy(hashIndexOverride, rangeIndexOverride, spatialIndexOverride);
-     * }
-     * 
- *

- * If you would like to just override the indexingPolicy for Numbers you can specify just that: - *

-     * {@code
-     * RangeIndex rangeIndexOverride = Index.Range(DataType.Number, 2);
-     *
-     * IndexingPolicy indexingPolicy = new IndexingPolicy(rangeIndexOverride);
-     * }
-     * 
- * - * @param defaultIndexOverrides comma separated set of indexes that serve as default index specifications for the root path. - */ - public IndexingPolicy(Index[] defaultIndexOverrides) { - this(); - - if (defaultIndexOverrides == null) { - throw new IllegalArgumentException("defaultIndexOverrides is null."); - } - - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath(IndexingPolicy.DEFAULT_PATH); - includedPath.setIndexes(new ArrayList(Arrays.asList(defaultIndexOverrides))); - this.getIncludedPaths().add(includedPath); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the indexing policy. - */ - public IndexingPolicy(String jsonString) { - super(jsonString); - } - - /** - * Gets whether automatic indexing is enabled for a collection. - *

- * In automatic indexing, documents can be explicitly excluded from indexing using RequestOptions. In manual - * indexing, documents can be explicitly included. - * - * @return the automatic - */ - public Boolean getAutomatic() { - return super.getBoolean(Constants.Properties.AUTOMATIC); - } - - /** - * Sets whether automatic indexing is enabled for a collection. - *

- * In automatic indexing, documents can be explicitly excluded from indexing using RequestOptions. In manual - * indexing, documents can be explicitly included. - * - * @param automatic the automatic - */ - public void setAutomatic(boolean automatic) { - super.set(Constants.Properties.AUTOMATIC, automatic); - } - - /** - * Gets the indexing mode (consistent or lazy). - * - * @return the indexing mode. - */ - public IndexingMode getIndexingMode() { - IndexingMode result = IndexingMode.Lazy; - try { - result = IndexingMode.valueOf(WordUtils.capitalize(super.getString(Constants.Properties.INDEXING_MODE))); - } catch (IllegalArgumentException e) { - this.getLogger().warn("Invalid indexingMode value {}.", super.getString(Constants.Properties.INDEXING_MODE)); - } - return result; - } - - /** - * Sets the indexing mode (consistent or lazy). - * - * @param indexingMode the indexing mode. - */ - public void setIndexingMode(IndexingMode indexingMode) { - super.set(Constants.Properties.INDEXING_MODE, indexingMode.name()); - } - - /** - * Gets the paths that are chosen to be indexed by the user. - * - * @return the included paths. - */ - public Collection getIncludedPaths() { - if (this.includedPaths == null) { - this.includedPaths = super.getCollection(Constants.Properties.INCLUDED_PATHS, IncludedPath.class); - - if (this.includedPaths == null) { - this.includedPaths = new ArrayList(); - } - } - - return this.includedPaths; - } - - public void setIncludedPaths(Collection includedPaths) { - this.includedPaths = includedPaths; - } - - /** - * Gets the paths that are not indexed. - * - * @return the excluded paths. - */ - public Collection getExcludedPaths() { - if (this.excludedPaths == null) { - this.excludedPaths = super.getCollection(Constants.Properties.EXCLUDED_PATHS, ExcludedPath.class); - - if (this.excludedPaths == null) { - this.excludedPaths = new ArrayList(); - } - } - - return this.excludedPaths; - } - - public void setExcludedPaths(Collection excludedPaths) { - this.excludedPaths = excludedPaths; - } - - /** - * Gets the composite indexes for additional indexes. - * - * @return the composite indexes. - */ - public Collection> getCompositeIndexes() { - if (this.compositeIndexes == null) { - this.compositeIndexes = new ArrayList>(); - ArrayNode compositeIndexes = (ArrayNode) super.get(Constants.Properties.COMPOSITE_INDEXES); - for (int i = 0; i < compositeIndexes.size(); i ++) { - ArrayNode compositeIndex = (ArrayNode) compositeIndexes.get(i); - ArrayList compositePaths = new ArrayList(); - for (int j = 0; j < compositeIndex.size(); j ++) { - CompositePath candidateCompositePath = new CompositePath(compositeIndex.get(j).toString()); - compositePaths.add(candidateCompositePath); - } - this.compositeIndexes.add(compositePaths); - } - } - - return this.compositeIndexes; - } - - /** - * Sets the composite indexes for additional indexes. - * - * @param compositeIndexes the composite indexes. - */ - public void setCompositeIndexes(Collection> compositeIndexes) { - this.compositeIndexes = compositeIndexes; - super.set(Constants.Properties.COMPOSITE_INDEXES, this.compositeIndexes); - } - - /** - * Sets the spatial indexes for additional indexes. - * - * @return the spatial indexes. - */ - public Collection getSpatialIndexes() { - if (this.spatialIndexes == null) { - this.spatialIndexes = super.getCollection(Constants.Properties.SPATIAL_INDEXES, SpatialSpec.class); - - if (this.spatialIndexes == null) { - this.spatialIndexes = new ArrayList(); - } - } - - return this.spatialIndexes; - } - - /** - * Sets the spatial indexes for additional indexes. - * - * @param spatialIndexes the spatial indexes. - */ - public void setSpatialIndexes(Collection spatialIndexes) { - this.spatialIndexes = spatialIndexes; - super.set(Constants.Properties.SPATIAL_INDEXES, this.spatialIndexes); - } - - @Override - void populatePropertyBag() { - // If indexing mode is not 'none' and not paths are set, set them to the defaults - if (this.getIndexingMode() != IndexingMode.None && this.getIncludedPaths().size() == 0 && - this.getExcludedPaths().size() == 0) { - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath(IndexingPolicy.DEFAULT_PATH); - this.getIncludedPaths().add(includedPath); - } - - if (this.includedPaths != null) { - for (IncludedPath includedPath : this.includedPaths) { - includedPath.populatePropertyBag(); - } - super.set(Constants.Properties.INCLUDED_PATHS, this.includedPaths); - } - - if (this.excludedPaths != null) { - for (ExcludedPath excludedPath : this.excludedPaths) { - excludedPath.populatePropertyBag(); - } - super.set(Constants.Properties.EXCLUDED_PATHS, this.excludedPaths); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/JsonSerializable.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/JsonSerializable.java deleted file mode 100644 index 27b52d80d51b..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/JsonSerializable.java +++ /dev/null @@ -1,581 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.microsoft.azure.cosmosdb.internal.Utils; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.fasterxml.jackson.databind.ObjectMapper; - -/** - * Represents a base resource that can be serialized to JSON in the Azure Cosmos DB database service. - */ -public class JsonSerializable { - private final static Logger logger = LoggerFactory.getLogger(JsonSerializable.class); - private final static ObjectMapper OBJECT_MAPPER = Utils.getSimpleObjectMapper(); - private ObjectMapper om; - transient ObjectNode propertyBag = null; - - protected JsonSerializable() { - this.propertyBag = OBJECT_MAPPER.createObjectNode(); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the JsonSerializable. - * @param objectMapper the custom object mapper - */ - protected JsonSerializable(String jsonString, ObjectMapper objectMapper) { - this.propertyBag = fromJson(jsonString); - this.om = objectMapper; - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the JsonSerializable. - */ - protected JsonSerializable(String jsonString) { - this.propertyBag = fromJson(jsonString); - } - - /** - * Constructor. - * - * @param objectNode the {@link ObjectNode} that represent the {@link JsonSerializable} - */ - JsonSerializable(ObjectNode objectNode) { - this.propertyBag = objectNode; - } - - protected ObjectMapper getMapper() { - if (this.om != null) { return this.om; } - return OBJECT_MAPPER; - } - - private static void checkForValidPOJO(Class c) { - if (c.isAnonymousClass() || c.isLocalClass()) { - throw new IllegalArgumentException( - String.format("%s can't be an anonymous or local class.", c.getName())); - } - if (c.isMemberClass() && !Modifier.isStatic(c.getModifiers())) { - throw new IllegalArgumentException( - String.format("%s must be static if it's a member class.", c.getName())); - } - } - - protected Logger getLogger() { - return logger; - } - - void populatePropertyBag() { - } - - /** - * Returns the propertybag(JSONObject) in a hashMap - * - * @return the HashMap. - */ - public HashMap getHashMap() { - return getMapper().convertValue(this.propertyBag, HashMap.class); - } - - /** - * Checks whether a property exists. - * - * @param propertyName the property to look up. - * @return true if the property exists. - */ - public boolean has(String propertyName) { - return this.propertyBag.has(propertyName); - } - - /** - * Removes a value by propertyName. - * - * @param propertyName the property to remove. - */ - public void remove(String propertyName) { - this.propertyBag.remove(propertyName); - } - - /** - * Sets the value of a property. - * - * @param the type of the object. - * @param propertyName the property to set. - * @param value the value of the property. - */ - @SuppressWarnings({"unchecked", "rawtypes"}) - public void set(String propertyName, T value) { - if (value == null) { - // Sets null. - this.propertyBag.putNull(propertyName); - } else if (value instanceof Collection) { - // Collection. - ArrayNode jsonArray = propertyBag.arrayNode(); - this.internalSetCollection(propertyName, (Collection) value, jsonArray); - this.propertyBag.set(propertyName, jsonArray); - } else if (value instanceof JsonNode) { - this.propertyBag.set(propertyName, (JsonNode) value); - } else if (value instanceof JsonSerializable) { - // JsonSerializable - JsonSerializable castedValue = (JsonSerializable) value; - if (castedValue != null) { - castedValue.populatePropertyBag(); - } - this.propertyBag.set(propertyName, castedValue != null ? castedValue.propertyBag : null); - } else { - // POJO, ObjectNode, number (includes int, float, double etc), boolean, - // and string. - this.propertyBag.set(propertyName, getMapper().valueToTree(value)); - } - } - - @SuppressWarnings({"unchecked", "rawtypes"}) - private void internalSetCollection(String propertyName, Collection collection, ArrayNode targetArray) { - for (T childValue : collection) { - if (childValue == null) { - // Sets null. - targetArray.addNull(); - } else if (childValue instanceof Collection) { - // When T is also a Collection, use recursion. - ArrayNode childArray = targetArray.addArray(); - this.internalSetCollection(propertyName, (Collection) childValue, childArray); - } else if (childValue instanceof JsonNode) { - targetArray.add((JsonNode) childValue); - } else if (childValue instanceof JsonSerializable) { - // JsonSerializable - JsonSerializable castedValue = (JsonSerializable) childValue; - castedValue.populatePropertyBag(); - targetArray.add(castedValue.propertyBag != null ? castedValue.propertyBag : this.getMapper().createObjectNode()); - } else { - // POJO, JSONObject, Number (includes Int, Float, Double etc), - // Boolean, and String. - targetArray.add(this.getMapper().valueToTree(childValue)); - } - } - } - - /** - * Gets a property value as Object. - * - * @param propertyName the property to get. - * @return the value of the property. - */ - public Object get(String propertyName) { - if (this.has(propertyName) && this.propertyBag.hasNonNull(propertyName)) { - return getValue(this.propertyBag.get(propertyName)); - } else { - return null; - } - } - - /** - * Gets a string value. - * - * @param propertyName the property to get. - * @return the string value. - */ - public String getString(String propertyName) { - if (this.has(propertyName) && this.propertyBag.hasNonNull(propertyName)) { - return this.propertyBag.get(propertyName).asText(); - } else { - return null; - } - } - - /** - * Gets a boolean value. - * - * @param propertyName the property to get. - * @return the boolean value. - */ - public Boolean getBoolean(String propertyName) { - if (this.has(propertyName) && this.propertyBag.hasNonNull(propertyName)) { - return this.propertyBag.get(propertyName).asBoolean(); - } else { - return null; - } - } - - /** - * Gets an integer value. - * - * @param propertyName the property to get. - * @return the boolean value - */ - public Integer getInt(String propertyName) { - if (this.has(propertyName) && this.propertyBag.hasNonNull(propertyName)) { - return Integer.valueOf(this.propertyBag.get(propertyName).asInt()); - } else { - return null; - } - } - - /** - * Gets a long value. - * - * @param propertyName the property to get. - * @return the long value - */ - public Long getLong(String propertyName) { - if (this.has(propertyName) && this.propertyBag.hasNonNull(propertyName)) { - return Long.valueOf(this.propertyBag.get(propertyName).asLong()); - } else { - return null; - } - } - - /** - * Gets a double value. - * - * @param propertyName the property to get. - * @return the double value. - */ - public Double getDouble(String propertyName) { - if (this.has(propertyName) && this.propertyBag.hasNonNull(propertyName)) { - return new Double(this.propertyBag.get(propertyName).asDouble()); - } else { - return null; - } - } - - /** - * Gets an object value. - * - * @param the type of the object. - * @param propertyName the property to get. - * @param c the class of the object. If c is a POJO class, it must be a member (and not an anonymous or local) - * and a static one. - * @return the object value. - */ - public T getObject(String propertyName, Class c) { - if (this.propertyBag.has(propertyName) && this.propertyBag.hasNonNull(propertyName)) { - JsonNode jsonObj = propertyBag.get(propertyName); - if (Number.class.isAssignableFrom(c) || String.class.isAssignableFrom(c) - || Boolean.class.isAssignableFrom(c) || Object.class == c) { - // Number, String, Boolean - return c.cast(getValue(jsonObj)); - } else if (Enum.class.isAssignableFrom(c)) { - try { - return c.cast(c.getMethod("valueOf", String.class).invoke(null, String.class.cast(getValue(jsonObj)))); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException - | NoSuchMethodException | SecurityException e) { - throw new IllegalStateException("Failed to create enum.", e); - } - } else if (JsonSerializable.class.isAssignableFrom(c)) { - try { - return c.getConstructor(String.class).newInstance(toJson(jsonObj)); - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException | NoSuchMethodException | SecurityException e) { - throw new IllegalStateException("Failed to instantiate class object.", e); - } - } else { - // POJO - JsonSerializable.checkForValidPOJO(c); - try { - return this.getMapper().treeToValue(jsonObj, c); - } catch (IOException e) { - throw new IllegalStateException("Failed to get POJO.", e); - } - } - } - - return null; - } - - /** - * Gets an object List. - * - * @param the type of the objects in the List. - * @param propertyName the property to get - * @param c the class of the object. If c is a POJO class, it must be a member (and not an anonymous or local) - * and a static one. - * @return the object collection. - */ - public List getList(String propertyName, Class c) { - if (this.propertyBag.has(propertyName) && this.propertyBag.hasNonNull(propertyName)) { - ArrayNode jsonArray = (ArrayNode) this.propertyBag.get(propertyName); - ArrayList result = new ArrayList(); - - boolean isBaseClass = false; - boolean isEnumClass = false; - boolean isJsonSerializable = false; - - // Check once. - if (Number.class.isAssignableFrom(c) || String.class.isAssignableFrom(c) - || Boolean.class.isAssignableFrom(c) || Object.class == c) { - isBaseClass = true; - } else if (Enum.class.isAssignableFrom(c)) { - isEnumClass = true; - } else if (JsonSerializable.class.isAssignableFrom(c)) { - isJsonSerializable = true; - } else { - JsonSerializable.checkForValidPOJO(c); - } - - for (JsonNode n : jsonArray) { - if (isBaseClass) { - // Number, String, Boolean - result.add(c.cast(getValue(n))); - } else if (isEnumClass) { - try { - result.add(c.cast(c.getMethod("valueOf", String.class).invoke(null, - String.class.cast(getValue(n))))); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException - | NoSuchMethodException | SecurityException e) { - throw new IllegalStateException("Failed to create enum.", e); - } - } else if (isJsonSerializable) { - // JsonSerializable - try { - result.add(c.getConstructor(String.class).newInstance(toJson(n))); - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException | NoSuchMethodException | SecurityException e) { - throw new IllegalStateException("Failed to instantiate class object.", e); - } - } else { - // POJO - try { - result.add(this.getMapper().treeToValue(n, c)); - } catch (IOException e) { - throw new IllegalStateException("Failed to get POJO.", e); - } - } - } - return result; - } - return null; - } - - /** - * Gets an object collection. - * - * @param the type of the objects in the collection. - * @param propertyName the property to get - * @param c the class of the object. If c is a POJO class, it must be a member (and not an anonymous or local) - * and a static one. - * @return the object collection. - */ - public Collection getCollection(String propertyName, Class c) { - return getList(propertyName, c); - } - - /** - * Gets a JSONObject. - * - * @param propertyName the property to get. - * @return the JSONObject. - */ - public ObjectNode getObject(String propertyName) { - if (this.propertyBag.has(propertyName) && this.propertyBag.hasNonNull(propertyName)) { - ObjectNode jsonObj = (ObjectNode) this.propertyBag.get(propertyName); - return jsonObj; - } - return null; - } - - /** - * Gets a JSONObject collection. - * - * @param propertyName the property to get. - * @return the JSONObject collection. - */ - public Collection getCollection(String propertyName) { - Collection result = null; - if (this.propertyBag.has(propertyName) && this.propertyBag.hasNonNull(propertyName)) { - result = new ArrayList(); - - for (JsonNode n : this.propertyBag.findValues(propertyName)) { - result.add((ObjectNode) n); - } - } - - return result; - } - - /** - * Gets the value of a property identified by an array of property names that forms the path. - * - * @param propertyNames that form the path to the property to get. - * @return the value of the property. - */ - public Object getObjectByPath(List propertyNames) { - ObjectNode propBag = this.propertyBag; - JsonNode value = null; - String propertyName = null; - Integer matchedProperties = 0; - Iterator iterator = propertyNames.iterator(); - if (iterator.hasNext()) { - do { - propertyName = iterator.next(); - if (propBag.has(propertyName)) { - matchedProperties++; - value = propBag.get(propertyName); - if (!value.isObject()) { - break; - } - propBag = (ObjectNode) value; - } else { - break; - } - } while (iterator.hasNext()); - - if (value != null && matchedProperties == propertyNames.size()) { - return getValue(value); - } - } - - return null; - } - - static Object getValue(JsonNode value) { - if (value.isValueNode()) { - switch (value.getNodeType()) { - case BOOLEAN: - return value.asBoolean(); - case NUMBER: - if (value.isInt()) { - return value.asInt(); - } else if (value.isLong()) { - return value.asLong(); - } else if (value.isDouble()) { - return value.asDouble(); - } - case STRING : - return value.asText(); - } - } - return value; - } - - private ObjectNode fromJson(String json){ - try { - return (ObjectNode) getMapper().readTree(json); - } catch (IOException e) { - throw new IllegalArgumentException(String.format("Unable to parse JSON %s", json), e); - } - } - - private String toJson(Object object){ - try { - return getMapper().writeValueAsString(object); - } catch (JsonProcessingException e) { - throw new IllegalStateException("Unable to convert JSON to String", e); - } - } - - private String toPrettyJson(Object object){ - try { - return getMapper().writerWithDefaultPrettyPrinter().writeValueAsString(object); - } catch (JsonProcessingException e) { - throw new IllegalStateException("Unable to convert JSON to String", e); - } - } - - /** - * Converts to an Object (only POJOs and JSONObject are supported). - * - * @param the type of the object. - * @param c the class of the object, either a POJO class or JSONObject. If c is a POJO class, it must be a member - * (and not an anonymous or local) and a static one. - * @return the POJO. - */ - public T toObject(Class c) { - if (JsonSerializable.class.isAssignableFrom(c) || String.class.isAssignableFrom(c) - || Number.class.isAssignableFrom(c) || Boolean.class.isAssignableFrom(c)) { - throw new IllegalArgumentException("c can only be a POJO class or JSONObject"); - } - if (ObjectNode.class.isAssignableFrom(c)) { - // JSONObject - if (ObjectNode.class != c) { - throw new IllegalArgumentException("We support JSONObject but not its sub-classes."); - } - return c.cast(this.propertyBag); - } else { - // POJO - JsonSerializable.checkForValidPOJO(c); - try { - return this.getMapper().readValue(this.toJson(), c); - } catch (IOException e) { - throw new IllegalStateException("Failed to get POJO.", e); - } - } - } - - /** - * Converts to a JSON string. - * - * @return the JSON string. - */ - public String toJson() { - return this.toJson(SerializationFormattingPolicy.None); - } - - /** - * Converts to a JSON string. - * - * @param formattingPolicy the formatting policy to be used. - * @return the JSON string. - */ - public String toJson(SerializationFormattingPolicy formattingPolicy) { - this.populatePropertyBag(); - if (SerializationFormattingPolicy.Indented.equals(formattingPolicy) ) { - return toPrettyJson(propertyBag); - } else { - return toJson(propertyBag); - } - } - - /** - * Gets Simple String representation of property bag. - * - * For proper conversion to json and inclusion of the default values - * use {@link #toJson()}. - * - * @return string representation of property bag. - */ - public String toString() { - return toJson(propertyBag); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/MediaOptions.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/MediaOptions.java deleted file mode 100644 index 43d38ee187d2..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/MediaOptions.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Options used with attachment content (aka media) creation in the Azure Cosmos DB database service. - */ -public final class MediaOptions { - private String slug; - private String contentType; - - /** - * Gets the HTTP Slug header value. - * - * @return the slug. - */ - public String getSlug() { - return this.slug; - } - - /** - * Sets the HTTP Slug header value. - * - * @param slug the slug. - */ - public void setSlug(String slug) { - this.slug = slug; - } - - /** - * Gets the HTTP ContentType header value. - * - * @return the content type. - */ - public String getContentType() { - return this.contentType; - } - - /** - * Sets the HTTP ContentType header value. - * - * @param contentType the content type. - */ - public void setContentType(String contentType) { - this.contentType = contentType; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/MediaReadMode.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/MediaReadMode.java deleted file mode 100644 index 00b318ea7f58..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/MediaReadMode.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Represents the mode for use with downloading attachment content (aka media) from the Azure Cosmos DB database service. - */ -public enum MediaReadMode { - - /** - * Content is buffered at the client and not directly streamed from the - * content store. Use Buffered to reduce the time taken to read and write - * media files. - */ - Buffered, - - /** - * Content is directly streamed from the content store without any buffering - * at the client. Use Streamed to reduce the client memory overhead of - * reading and writing media files. - */ - Streamed -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/MediaResponse.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/MediaResponse.java deleted file mode 100644 index cc4e1dcf3075..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/MediaResponse.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.io.BufferedInputStream; -import java.io.InputStream; -import java.util.Map; - -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; - -/** - * Response associated with retrieving attachment content in the Azure Cosmos DB database service. - */ -public final class MediaResponse { - private InputStream media = null; - private Map responseHeaders = null; - - MediaResponse(RxDocumentServiceResponse response, boolean willBuffer) { - this.media = response.getContentStream(); - if (willBuffer) { - this.media = new BufferedInputStream(this.media); - } - - this.responseHeaders = response.getResponseHeaders(); - } - - /** - * Gets the attachment content stream. - * - * @return the attachment content stream. - */ - public InputStream getMedia() { - return this.media; - } - - /** - * Gets the headers associated with the response. - * - * @return the response headers. - */ - public Map getResponseHeaders() { - return this.responseHeaders; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Offer.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Offer.java deleted file mode 100644 index 0e450510340e..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Offer.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.fasterxml.jackson.databind.node.ObjectNode; - -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.Utils; - -/** - * Represents an offer in the Azure Cosmos DB database service. - */ -public class Offer extends Resource { - - /** - * Initialize an new instance of the Offer object. - * - * @param offerThroughput the throughput value for this offer. - */ - public Offer(int offerThroughput) { - super(); - this.setOfferVersion(Constants.Properties.OFFER_VERSION_V2); - this.setOfferType(""); - ObjectNode content = Utils.getSimpleObjectMapper().createObjectNode(); - content.put(Constants.Properties.OFFER_THROUGHPUT, offerThroughput); - this.setContent(content); - } - - /** - * Initialize an offer object from json string. - * - * @param jsonString the json string that represents the offer. - */ - public Offer(String jsonString) { - super(jsonString); - } - - /** - * Gets the self-link of a resource to which the resource offer applies. - * - * @return the resource link. - */ - public String getResourceLink() { - return super.getString(Constants.Properties.RESOURCE_LINK); - } - - /** - * Sets the self-link of a resource to which the resource offer applies. - * - * @param resourceLink the resource link. - */ - void setResourceLink(String resourceLink) { - super.set(Constants.Properties.RESOURCE_LINK, resourceLink); - } - - /** - * Sets the target resource id of a resource to which this offer applies. - * - * @return the resource id. - */ - public String getOfferResourceId() { - return super.getString(Constants.Properties.OFFER_RESOURCE_ID); - } - - /** - * Sets the target resource id of a resource to which this offer applies. - * - * @param resourceId the resource id. - */ - void setOfferResourceId(String resourceId) { - super.set(Constants.Properties.OFFER_RESOURCE_ID, resourceId); - } - - /** - * Gets the OfferType for the resource offer. - * - * @return the offer type. - */ - public String getOfferType() { - return super.getString(Constants.Properties.OFFER_TYPE); - } - - /** - * Sets the OfferType for the resource offer. - * - * @param offerType the offer type. - */ - public void setOfferType(String offerType) { - super.set(Constants.Properties.OFFER_TYPE, offerType); - } - - /** - * Gets the version of the current offer. - * - * @return the offer version. - */ - public String getOfferVersion() { - return super.getString(Constants.Properties.OFFER_VERSION); - } - - /** - * Sets the offer version. - * - * @param offerVersion the version of the offer. - */ - public void setOfferVersion(String offerVersion) { - super.set(Constants.Properties.OFFER_VERSION, offerVersion); - } - - /** - * Gets the offer throughput for this offer. - * - * @return the offer throughput. - */ - public int getThroughput() { - return this.getContent().get(Constants.Properties.OFFER_THROUGHPUT).asInt(); - } - - /** - * Sets the offer throughput for this offer. - * - * @param throughput the throughput of this offer. - */ - public void setThroughput(int throughput) { - this.getContent().put(Constants.Properties.OFFER_THROUGHPUT, throughput); - } - - private ObjectNode getContent() { - return super.getObject(Constants.Properties.OFFER_CONTENT); - } - - private void setContent(ObjectNode offerContent) { - super.set(Constants.Properties.OFFER_CONTENT, offerContent); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKey.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKey.java deleted file mode 100644 index 8defae8237b4..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKey.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternal; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -/** - * Represents a partition key value in the Azure Cosmos DB database service. A partition key identifies the partition - * where the document is stored in. - */ -public class PartitionKey { - - private PartitionKeyInternal internalPartitionKey; - - PartitionKey(PartitionKeyInternal partitionKeyInternal) { - this.internalPartitionKey = partitionKeyInternal; - } - - /** - * Constructor. Create a new instance of the PartitionKey object. - * - * @param key the value of the partition key. - */ - @SuppressWarnings("serial") - public PartitionKey(final Object key) { - this.internalPartitionKey = PartitionKeyInternal.fromObjectArray(new Object[] {key}, true); - } - - /** - * Create a new instance of the PartitionKey object from a serialized JSON partition key. - * - * @param jsonString the JSON string representation of this PartitionKey object. - * @return the PartitionKey instance. - */ - public static PartitionKey FromJsonString(String jsonString) { - return new PartitionKey(PartitionKeyInternal.fromJsonString(jsonString)); - } - - /** - * Serialize the PartitionKey object to a JSON string. - * - * @return the string representation of this PartitionKey object. - */ - public String toString() { - return this.internalPartitionKey.toJson(); - } - - public PartitionKeyInternal getInternalPartitionKey() { - return internalPartitionKey; - } - - /** - * Overrides the Equal operator for object comparisons between two instances of {@link PartitionKey} - * @param other The object to compare with. - * @return True if two object instance are considered equal. - */ - @Override - public boolean equals(Object other) { - if (other == null) { - return false; - } - - if (this == other) { - return true; - } - - PartitionKey otherKey = Utils.as(other, PartitionKey.class); - return otherKey != null && this.internalPartitionKey.equals(otherKey.internalPartitionKey); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKeyDefinition.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKeyDefinition.java deleted file mode 100644 index e9f71e9928b0..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKeyDefinition.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.text.WordUtils; - -/** - * Represents a partition key definition in the Azure Cosmos DB database service. A partition key definition specifies which - * document property is used as the partition key in a collection that has multiple partitions. - */ -public final class PartitionKeyDefinition extends JsonSerializable { - private List paths; - private PartitionKind kind; - private PartitionKeyDefinitionVersion version; - - /** - * Constructor. Creates a new instance of the PartitionKeyDefinition object. - */ - public PartitionKeyDefinition() { - this.setKind(PartitionKind.Hash); - } - - /** - * Constructor. Creates a new instance of the PartitionKeyDefinition object from a - * JSON string. - * - * @param jsonString the JSON string that represents the partition key definition. - */ - public PartitionKeyDefinition(String jsonString) { - super(jsonString); - } - - /** - * Sets the partition algorithm used to calculate the partition id given a partition key. - * - * @return the partition algorithm. - */ - public PartitionKind getKind() { - if (this.kind == null) { - this.kind = super.getObject(Constants.Properties.PARTITION_KIND, PartitionKind.class); - } - - return this.kind; - } - - /** - * Sets the partition algorithm used to calculate the partition id given a partition key. - * - * @param kind the partition algorithm. - */ - public void setKind(PartitionKind kind) { - this.kind = kind; - } - - public PartitionKeyDefinitionVersion getVersion() { - if (this.version == null) { - Object versionObject = super.getObject(Constants.Properties.PARTITION_KEY_DEFINITION_VERSION, Object.class); - if (versionObject == null) { - this.version = null; - } else { - String versionStr = String.valueOf(versionObject); - if (StringUtils.isNumeric(versionStr)) { - this.version = PartitionKeyDefinitionVersion.valueOf(String.format("V%d", Integer.parseInt(versionStr))); - } else { - this.version = !Strings.isNullOrEmpty(versionStr) - ? PartitionKeyDefinitionVersion.valueOf(WordUtils.capitalize(versionStr)) - : null; - } - } - } - - return this.version; - } - - public void setVersion(PartitionKeyDefinitionVersion version) { - this.version = version; - } - - /** - * Gets the document property paths for the partition key. - * - * @return the paths to the document properties that form the partition key. - */ - public List getPaths() { - if (this.paths == null) { - if (super.has(Constants.Properties.PARTITION_KEY_PATHS)) { - paths = super.getList(Constants.Properties.PARTITION_KEY_PATHS, String.class); - } else { - paths = new ArrayList<>(); - } - } - - return paths; - } - - /** - * Sets the document property paths for the partition key. - * - * @param paths the paths to document properties that form the partition key. - */ - public void setPaths(List paths) { - if (paths == null || paths.size() == 0) { - throw new IllegalArgumentException("paths must not be null or empty."); - } - - this.paths = paths; - } - - @Override - void populatePropertyBag() { - if (this.kind != null) { - super.set(Constants.Properties.PARTITION_KIND, kind.name()); - } - if (this.paths != null) { - super.set(Constants.Properties.PARTITION_KEY_PATHS, paths); - } - - if (this.version != null) { - super.set(Constants.Properties.PARTITION_KEY_DEFINITION_VERSION, version.name()); - } - super.populatePropertyBag(); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKeyDefinitionVersion.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKeyDefinitionVersion.java deleted file mode 100644 index 096f2dc054f9..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKeyDefinitionVersion.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Partitioning version. - */ -public enum PartitionKeyDefinitionVersion { - - /** - * Original version of hash partitioning. - */ - V1(1), - - /** - * Enhanced version of hash partitioning - offers better distribution of long partition keys and uses less storage. - * - * This version should be used for any practical purpose, but it is available in newer SDKs only. - */ - V2(2); - - int val; - - private PartitionKeyDefinitionVersion(int val) { - this.val = val; - } - -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKeyRange.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKeyRange.java deleted file mode 100644 index f74e3146a8bf..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKeyRange.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.List; - -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.routing.Range; - -/** - * Represent a partition key range in the Azure Cosmos DB database service. - */ -public class PartitionKeyRange extends Resource { - public static final String MINIMUM_INCLUSIVE_EFFECTIVE_PARTITION_KEY = ""; - public static final String MAXIMUM_EXCLUSIVE_EFFECTIVE_PARTITION_KEY = "FF"; - public static final String MASTER_PARTITION_KEY_RANGE_ID = "M"; - - /** - * Initialize a partition key range object. - */ - public PartitionKeyRange() { - super(); - } - - /** - * Initialize a partition key range object from json string. - * - * @param jsonString - * the json string that represents the partition key range - * object. - */ - public PartitionKeyRange(String jsonString) { - super(jsonString); - } - - public PartitionKeyRange(String id, String minInclusive, String maxExclusive) { - super(); - this.setId(id); - this.setMinInclusive(minInclusive); - this.setMaxExclusive(maxExclusive); - } - - public PartitionKeyRange(String id, String minInclusive, String maxExclusive, List parents) { - super(); - this.setId(id); - this.setMinInclusive(minInclusive); - this.setMaxExclusive(maxExclusive); - this.setParents(parents); - } - - public String getMinInclusive() { - return super.getString("minInclusive"); - } - - public void setMinInclusive(String minInclusive) { - super.set("minInclusive", minInclusive); - } - - public String getMaxExclusive() { - return super.getString("maxExclusive"); - } - - public void setMaxExclusive(String maxExclusive) { - super.set("maxExclusive", maxExclusive); - } - - public Range toRange() { - return new Range(this.getMinInclusive(), this.getMaxExclusive(), true, false); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof PartitionKeyRange)) { - return false; - } - - PartitionKeyRange otherRange = (PartitionKeyRange) obj; - - return this.getId().compareTo(otherRange.getId()) == 0 - && this.getMinInclusive().compareTo(otherRange.getMinInclusive()) == 0 - && this.getMaxExclusive().compareTo(otherRange.getMaxExclusive()) == 0; - } - - @Override - public int hashCode() { - int hash = 0; - hash = (hash * 397) ^ this.getId().hashCode(); - hash = (hash * 397) ^ this.getMinInclusive().hashCode(); - hash = (hash * 397) ^ this.getMaxExclusive().hashCode(); - return hash; - } - - void setParents(List parents) { - this.set(Constants.Properties.PARENTS, parents); - } - - /** - * Used internally to indicate the ID of the parent range - * @return a list partition key range ID - */ - public List getParents() { return this.getList(Constants.Properties.PARENTS, String.class); } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKind.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKind.java deleted file mode 100644 index 4c5c94c35cd2..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PartitionKind.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Specifies the partition scheme for an multiple-partitioned collection in the Azure Cosmos DB database service. - */ -public enum PartitionKind { - /** - * The Partition of a document is calculated based on the hash value of the PartitionKey. - */ - Hash -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Permission.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Permission.java deleted file mode 100644 index a72b653582ec..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Permission.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.fasterxml.jackson.databind.node.ArrayNode; -import org.apache.commons.text.WordUtils; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents a per-User Permission to access a specific resource e.g. Document or Collection in the Azure Cosmos DB database service. - */ -public class Permission extends Resource { - /** - * Initialize a permission object. - */ - public Permission() { - super(); - } - - /** - * Initialize a permission object from json string. - * - * @param jsonString the json string that represents the permission. - */ - public Permission(String jsonString) { - super(jsonString); - } - - /** - * Gets the self-link of resource to which the permission applies. - * - * @return the resource link. - */ - public String getResourceLink() { - return super.getString(Constants.Properties.RESOURCE_LINK); - } - - /** - * Sets the self-link of resource to which the permission applies. - * - * @param resourceLink the resource link. - */ - public void setResourceLink(String resourceLink) { - super.set(Constants.Properties.RESOURCE_LINK, resourceLink); - } - - /** - * Gets the permission mode. - * - * @return the permission mode. - */ - public PermissionMode getPermissionMode() { - String value = super.getString(Constants.Properties.PERMISSION_MODE); - return PermissionMode.valueOf(WordUtils.capitalize(value)); - } - - /** - * Sets the permission mode. - * - * @param permissionMode the permission mode. - */ - public void setPermissionMode(PermissionMode permissionMode) { - this.set(Constants.Properties.PERMISSION_MODE, - permissionMode.name().toLowerCase()); - } - - /** - * Gets the access token granting the defined permission. - * - * @return the access token. - */ - public String getToken() { - return super.getString(Constants.Properties.TOKEN); - } - - /** - * Gets the resource partition key associated with this permission object. - * - * @return the partition key. - */ - public PartitionKey getResourcePartitionKey() { - PartitionKey key = null; - Object value = super.get(Constants.Properties.RESOURCE_PARTITION_KEY); - if (value != null) { - ArrayNode arrayValue = (ArrayNode) value; - key = new PartitionKey(getValue(arrayValue.get(0))); - } - - return key; - } - - /** - * Sets the resource partition key associated with this permission object. - * - * @param partitionkey the partition key. - */ - public void setResourcePartitionKey(PartitionKey partitionkey) { - super.set(Constants.Properties.RESOURCE_PARTITION_KEY, partitionkey.getInternalPartitionKey().toJson()); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PermissionMode.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PermissionMode.java deleted file mode 100644 index ef514dcf4573..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/PermissionMode.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Enumeration specifying applicability of permission in the Azure Cosmos DB database service. - */ -public enum PermissionMode { - /** - * Permission applicable for read operations only. - */ - Read(0x1), - - /** - * Permission applicable for all operations. - */ - All(0x2); - - private int value; - - PermissionMode(int value) { - this.value = value; - } - - /** - * Gets the numerical value of the permission mode. - * - * @return the numerical value. - */ - public int getValue() { - return value; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/QueryMetrics.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/QueryMetrics.java deleted file mode 100644 index c333c6a757a6..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/QueryMetrics.java +++ /dev/null @@ -1,315 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.query.metrics.ClientSideMetrics; -import com.microsoft.azure.cosmosdb.internal.query.metrics.FetchExecutionRange; -import com.microsoft.azure.cosmosdb.internal.query.metrics.QueryMetricsTextWriter; -import com.microsoft.azure.cosmosdb.internal.query.metrics.SchedulingTimeSpan; -import org.apache.commons.lang3.tuple.ImmutablePair; - -import java.time.Duration; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; - -/** - * Query metrics in the Azure Cosmos database service. - * This metric represents a moving average for a set of queries whose metrics have been aggregated together. - */ -public final class QueryMetrics { - public static QueryMetrics ZERO = new QueryMetrics( - new ArrayList<>(), /* */ - 0, /* retrievedDocumentCount */ - 0, /* retrievedDocumentSize */ - 0, /* outputDocumentCount */ - 0, /* outputDocumentSize */ - 0, /* indexHitCount */ - Duration.ZERO, - QueryPreparationTimes.ZERO, - Duration.ZERO, - Duration.ZERO, - Duration.ZERO, - RuntimeExecutionTimes.ZERO, - Duration.ZERO, - ClientSideMetrics.ZERO); - private final long retrievedDocumentCount; - private final long retrievedDocumentSize; - private final long outputDocumentCount; - private final long outputDocumentSize; - private final long indexHitDocumentCount; - private final Duration totalQueryExecutionTime; - private final QueryPreparationTimes queryPreparationTimes; - private final Duration indexLookupTime; - private final Duration documentLoadTime; - private final Duration vmExecutionTime; - private final RuntimeExecutionTimes runtimeExecutionTimes; - private final Duration documentWriteTime; - private final ClientSideMetrics clientSideMetrics; - private final List activityIds; - - public QueryMetrics(List activities, long retrievedDocumentCount, long retrievedDocumentSize, long outputDocumentCount, - long outputDocumentSize, long indexHitCount, Duration totalQueryExecutionTime, - QueryPreparationTimes queryPreparationTimes, Duration indexLookupTime, Duration documentLoadTime, - Duration vmExecutionTime, RuntimeExecutionTimes runtimeExecutionTimes, Duration documentWriteTime, - ClientSideMetrics clientSideMetrics) { - this.retrievedDocumentCount = retrievedDocumentCount; - this.retrievedDocumentSize = retrievedDocumentSize; - this.outputDocumentCount = outputDocumentCount; - this.outputDocumentSize = outputDocumentSize; - this.indexHitDocumentCount = indexHitCount; - this.totalQueryExecutionTime = totalQueryExecutionTime; - this.queryPreparationTimes = queryPreparationTimes; - this.indexLookupTime = indexLookupTime; - this.documentLoadTime = documentLoadTime; - this.vmExecutionTime = vmExecutionTime; - this.runtimeExecutionTimes = runtimeExecutionTimes; - this.documentWriteTime = documentWriteTime; - this.clientSideMetrics = clientSideMetrics; - this.activityIds = activities; - } - - /** - * @return the retrievedDocumentCount - */ - public long getRetrievedDocumentCount() { - return retrievedDocumentCount; - } - - /** - * @return the retrievedDocumentSize - */ - public long getRetrievedDocumentSize() { - return retrievedDocumentSize; - } - - /** - * @return the outputDocumentCount - */ - public long getOutputDocumentCount() { - return outputDocumentCount; - } - - /** - * @return the outputDocumentSize - */ - public long getOutputDocumentSize() { - return outputDocumentSize; - } - - /** - * @return the indexHitDocumentCount - */ - public long getIndexHitDocumentCount() { - return indexHitDocumentCount; - } - - /** - * Gets the index hit ratio by query in the Azure Cosmos database service. - * - * @return the IndexHitRatio - */ - public double getIndexHitRatio() { - return this.retrievedDocumentCount == 0 ? 1 : (double) this.indexHitDocumentCount / this.retrievedDocumentCount; - } - - /** - * @return the totalQueryExecutionTime - */ - public Duration getTotalQueryExecutionTime() { - return totalQueryExecutionTime; - } - - /** - * @return the queryPreparationTimes - */ - public QueryPreparationTimes getQueryPreparationTimes() { - return queryPreparationTimes; - } - - /** - * @return the indexLookupTime - */ - public Duration getIndexLookupTime() { - return indexLookupTime; - } - - /** - * @return the documentLoadTime - */ - public Duration getDocumentLoadTime() { - return documentLoadTime; - } - - /** - * @return the vmExecutionTime - */ - public Duration getVMExecutionTime() { - return vmExecutionTime; - } - - /** - * @return the runtimeExecutionTimes - */ - public RuntimeExecutionTimes getRuntimeExecutionTimes() { - return runtimeExecutionTimes; - } - - /** - * @return the documentWriteTime - */ - public Duration getDocumentWriteTime() { - return documentWriteTime; - } - - /** - * @return the clientSideMetrics - */ - ClientSideMetrics getClientSideMetrics() { - return clientSideMetrics; - } - - /** - * @return number of reties in the Azure Cosmos database service. - */ - public long getRetries() { - return this.clientSideMetrics.getRetries(); - } - - public QueryMetrics add(QueryMetrics... queryMetricsArgs) { - ArrayList queryMetricsList = new ArrayList(); - for (QueryMetrics queryMetrics : queryMetricsArgs) { - queryMetricsList.add(queryMetrics); - } - - queryMetricsList.add(this); - - return QueryMetrics.createFromCollection(queryMetricsList); - } - - private String toTextString() { - return toTextString(0); - } - - private String toTextString(int indentLevel) { - StringBuilder stringBuilder = new StringBuilder(); - QueryMetricsTextWriter queryMetricsTextWriter = new QueryMetricsTextWriter(stringBuilder); - queryMetricsTextWriter.writeQueryMetrics(this); - return stringBuilder.toString(); - } - - static QueryMetrics createFromCollection(Collection queryMetricsCollection) { - long retrievedDocumentCount = 0; - long retrievedDocumentSize = 0; - long outputDocumentCount = 0; - long outputDocumentSize = 0; - long indexHitDocumentCount = 0; - Duration totalQueryExecutionTime = Duration.ZERO; - Collection queryPreparationTimesCollection = new ArrayList(); - Duration indexLookupTime = Duration.ZERO; - Duration documentLoadTime = Duration.ZERO; - Duration vmExecutionTime = Duration.ZERO; - Collection runtimeExecutionTimesCollection = new ArrayList(); - Duration documentWriteTime = Duration.ZERO; - Collection clientSideMetricsCollection = new ArrayList(); - List activityIds = new ArrayList<>(); - - for (QueryMetrics queryMetrics : queryMetricsCollection) { - if (queryMetrics == null) { - throw new NullPointerException("queryMetricsList can not have null elements"); - } - activityIds.addAll(queryMetrics.activityIds); - retrievedDocumentCount += queryMetrics.retrievedDocumentCount; - retrievedDocumentSize += queryMetrics.retrievedDocumentSize; - outputDocumentCount += queryMetrics.outputDocumentCount; - outputDocumentSize += queryMetrics.outputDocumentSize; - indexHitDocumentCount += queryMetrics.indexHitDocumentCount; - totalQueryExecutionTime = totalQueryExecutionTime.plus(queryMetrics.totalQueryExecutionTime); - queryPreparationTimesCollection.add(queryMetrics.queryPreparationTimes); - indexLookupTime = indexLookupTime.plus(queryMetrics.indexLookupTime); - documentLoadTime = documentLoadTime.plus(queryMetrics.documentLoadTime); - vmExecutionTime = vmExecutionTime.plus(queryMetrics.vmExecutionTime); - runtimeExecutionTimesCollection.add(queryMetrics.runtimeExecutionTimes); - documentWriteTime = documentWriteTime.plus(queryMetrics.documentWriteTime); - clientSideMetricsCollection.add(queryMetrics.clientSideMetrics); - } - - return new QueryMetrics(activityIds, retrievedDocumentCount, retrievedDocumentSize, outputDocumentCount, - outputDocumentSize, - indexHitDocumentCount, totalQueryExecutionTime, - QueryPreparationTimes.createFromCollection(queryPreparationTimesCollection), indexLookupTime, documentLoadTime, - vmExecutionTime, RuntimeExecutionTimes.createFromCollection(runtimeExecutionTimesCollection), - documentWriteTime, ClientSideMetrics.createFromCollection(clientSideMetricsCollection)); - } - - private static double getOrDefault(HashMap metrics, String key) { - Double doubleReference = metrics.get(key); - return doubleReference == null ? 0 : doubleReference; - } - - static QueryMetrics createFromDelimitedString(String delimitedString) { - HashMap metrics = QueryMetricsUtils.parseDelimitedString(delimitedString); - return QueryMetrics.createFromDelimitedStringAndClientSideMetrics(delimitedString, - new ClientSideMetrics(0, 0, new ArrayList(), - new ArrayList>()), ""); - } - - static QueryMetrics createFromDelimitedStringAndClientSideMetrics(String delimitedString, ClientSideMetrics clientSideMetrics, - String activityId) { - HashMap metrics = QueryMetricsUtils.parseDelimitedString(delimitedString); - double indexHitRatio; - double retrievedDocumentCount; - indexHitRatio = metrics.get(QueryMetricsConstants.IndexHitRatio); - retrievedDocumentCount = metrics.get(QueryMetricsConstants.RetrievedDocumentCount); - long indexHitCount = (long) (indexHitRatio * retrievedDocumentCount); - double outputDocumentCount = metrics.get(QueryMetricsConstants.OutputDocumentCount); - double outputDocumentSize = metrics.get(QueryMetricsConstants.OutputDocumentSize); - double retrievedDocumentSize = metrics.get(QueryMetricsConstants.RetrievedDocumentSize); - Duration totalQueryExecutionTime = QueryMetricsUtils.getDurationFromMetrics(metrics, QueryMetricsConstants.TotalQueryExecutionTimeInMs); - - List activities = new ArrayList<>(); - activities.add(activityId); - - return new QueryMetrics( - activities, - (long) retrievedDocumentCount, - (long) retrievedDocumentSize, - (long) outputDocumentCount, - (long) outputDocumentSize, - indexHitCount, - totalQueryExecutionTime, - QueryPreparationTimes.createFromDelimitedString(delimitedString), - QueryMetricsUtils.getDurationFromMetrics(metrics, QueryMetricsConstants.IndexLookupTimeInMs), - QueryMetricsUtils.getDurationFromMetrics(metrics, QueryMetricsConstants.DocumentLoadTimeInMs), - QueryMetricsUtils.getDurationFromMetrics(metrics, QueryMetricsConstants.VMExecutionTimeInMs), - RuntimeExecutionTimes.createFromDelimitedString(delimitedString), - QueryMetricsUtils.getDurationFromMetrics(metrics, QueryMetricsConstants.DocumentWriteTimeInMs), - clientSideMetrics); - } - - @Override - public String toString() { - return toTextString(0); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/QueryMetricsConstants.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/QueryMetricsConstants.java deleted file mode 100644 index f14d338e1910..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/QueryMetricsConstants.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb; - -public final class QueryMetricsConstants { - // QueryMetrics - public static final String RetrievedDocumentCount = "retrievedDocumentCount"; - public static final String RetrievedDocumentSize = "retrievedDocumentSize"; - public static final String OutputDocumentCount = "outputDocumentCount"; - public static final String OutputDocumentSize = "outputDocumentSize"; - public static final String IndexHitRatio = "indexUtilizationRatio"; - public static final String IndexHitDocumentCount = "indexHitDocumentCount"; - public static final String TotalQueryExecutionTimeInMs = "totalExecutionTimeInMs"; - - // QueryPreparationTimes - public static final String QueryCompileTimeInMs = "queryCompileTimeInMs"; - public static final String LogicalPlanBuildTimeInMs = "queryLogicalPlanBuildTimeInMs"; - public static final String PhysicalPlanBuildTimeInMs = "queryPhysicalPlanBuildTimeInMs"; - public static final String QueryOptimizationTimeInMs = "queryOptimizationTimeInMs"; - - // QueryTimes - public static final String IndexLookupTimeInMs = "indexLookupTimeInMs"; - public static final String DocumentLoadTimeInMs = "documentLoadTimeInMs"; - public static final String VMExecutionTimeInMs = "VMExecutionTimeInMs"; - public static final String DocumentWriteTimeInMs = "writeOutputTimeInMs"; - - // RuntimeExecutionTimes - public static final String QueryEngineTimes = "queryEngineTimes"; - public static final String SystemFunctionExecuteTimeInMs = "systemFunctionExecuteTimeInMs"; - public static final String UserDefinedFunctionExecutionTimeInMs = "userFunctionExecuteTimeInMs"; - - // ClientSideMetrics - public static final String Retries = "retries"; - public static final String RequestCharge = "requestCharge"; - - // QueryMetrics Text - public static final String ActivityIds = "Activity Ids"; - public static final String RetrievedDocumentCountText = "Retrieved Document Count"; - public static final String RetrievedDocumentSizeText = "Retrieved Document Size"; - public static final String OutputDocumentCountText = "Output Document Count"; - public static final String OutputDocumentSizeText = "Output Document Size"; - public static final String IndexUtilizationText = "Index Utilization"; - public static final String TotalQueryExecutionTimeText = "Total Query Execution Time"; - - // QueryPreparationTimes Text - public static final String QueryPreparationTimesText = "Query Preparation Times"; - public static final String QueryCompileTimeText = "Query Compilation Time"; - public static final String LogicalPlanBuildTimeText = "Logical Plan Build Time"; - public static final String PhysicalPlanBuildTimeText = "Physical Plan Build Time"; - public static final String QueryOptimizationTimeText = "Query Optimization Time"; - - // QueryTimes Text - public static final String QueryEngineTimesText = "Query Engine Times"; - public static final String IndexLookupTimeText = "Index Lookup Time"; - public static final String DocumentLoadTimeText = "Document Load Time"; - public static final String WriteOutputTimeText = "Document Write Time"; - - // RuntimeExecutionTimes Text - public static final String RuntimeExecutionTimesText = "Runtime Execution Times"; - public static final String TotalExecutionTimeText = "Query Engine Execution Time"; - public static final String SystemFunctionExecuteTimeText = "System Function Execution Time"; - public static final String UserDefinedFunctionExecutionTimeText = "User-defined Function Execution Time"; - - // ClientSideQueryMetrics Text - public static final String ClientSideQueryMetricsText = "Client Side Metrics"; - public static final String RetriesText = "Retry Count"; - public static final String RequestChargeText = "Request Charge"; - public static final String FetchExecutionRangesText = "Partition Execution Timeline"; - public static final String SchedulingMetricsText = "Scheduling Metrics"; -} - diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/QueryMetricsUtils.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/QueryMetricsUtils.java deleted file mode 100644 index 320e68e67346..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/QueryMetricsUtils.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb; - -import org.apache.commons.lang3.StringUtils; - -import java.time.Duration; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; - -class QueryMetricsUtils { - static final String Indent = StringUtils.SPACE; - private static final int NANOS_TO_MILLIS = 1000000; - private static final String BytesUnitString = "bytes"; - - static HashMap parseDelimitedString(String delimitedString) { - if (delimitedString == null) { - throw new NullPointerException("delimitedString"); - } - - HashMap metrics = new HashMap<>(); - - final int key = 0; - final int value = 1; - String[] headerAttributes = StringUtils.split(delimitedString, ";"); - - for (String attribute : headerAttributes) { - String[] attributeKeyValue = StringUtils.split(attribute, "="); - - if (attributeKeyValue.length != 2) { - throw new NullPointerException("recieved a malformed delimited String"); - } - - String attributeKey = attributeKeyValue[key]; - double attributeValue = Double.parseDouble(attributeKeyValue[value]); - metrics.put(attributeKey, attributeValue); - } - - return metrics; - } - - static Duration durationFromMetrics(HashMap metrics, String key) { - // Just attempt to get the metrics - Double durationInMilliseconds = metrics.get(key); - if (durationInMilliseconds == null) { - return Duration.ZERO; - } - - long seconds = (long) (durationInMilliseconds / 1e3); - long nanoseconds = (long) ((durationInMilliseconds - (seconds * 1e3)) * 1e6); - - return Duration.ofSeconds(seconds, nanoseconds); - } - - static Duration getDurationFromMetrics(HashMap metrics, String key) { - double timeSpanInMilliseconds; - Duration timeSpanFromMetrics; - timeSpanInMilliseconds = metrics.get(key); - timeSpanFromMetrics = QueryMetricsUtils.doubleMillisecondsToDuration(timeSpanInMilliseconds); - return timeSpanFromMetrics; - } - - private static Duration doubleMillisecondsToDuration(double timeSpanInMilliseconds) { - long timeInNanoSeconds = (long) (timeSpanInMilliseconds * NANOS_TO_MILLIS); - return Duration.ofNanos(timeInNanoSeconds); - } - - private static void appendToStringBuilder(StringBuilder stringBuilder, String property, String value, - String units, int indentLevel) { - final String FormatString = "%-40s : %15s %-12s %s"; - - stringBuilder.append(String.format( - Locale.ROOT, - FormatString, - StringUtils.repeat(Indent, indentLevel) + property, - value, - units, - System.lineSeparator())); - } - - static void appendBytesToStringBuilder(StringBuilder stringBuilder, String property, long bytes, int indentLevel) { - final String BytesFormatString = "%d"; - - QueryMetricsUtils.appendToStringBuilder( - stringBuilder, - property, - String.format(BytesFormatString, bytes), - BytesUnitString, - indentLevel); - } - - static void appendMillisecondsToStringBuilder(StringBuilder stringBuilder, String property, double milliseconds, - int indentLevel) { - final String MillisecondsFormatString = "%f"; - final String MillisecondsUnitString = "milliseconds"; - - QueryMetricsUtils.appendToStringBuilder(stringBuilder, property, String.format(MillisecondsFormatString, - milliseconds), MillisecondsUnitString, indentLevel); - } - - static void appendNanosecondsToStringBuilder(StringBuilder stringBuilder, String property, double nanoSeconds, - int indentLevel) { - final String MillisecondsFormatString = "%.2f"; - final String MillisecondsUnitString = "milliseconds"; - QueryMetricsUtils.appendToStringBuilder(stringBuilder, property, String.format(MillisecondsFormatString, - nanosToMilliSeconds(nanoSeconds)), MillisecondsUnitString, indentLevel); - } - - static double nanosToMilliSeconds(double nanos) { - return nanos / NANOS_TO_MILLIS; - } - - static void appendHeaderToStringBuilder(StringBuilder stringBuilder, String headerTitle, int indentLevel) { - final String FormatString = "%s %s"; - stringBuilder.append(String.format( - Locale.ROOT, - FormatString, - String.join(StringUtils.repeat(Indent, indentLevel)) + headerTitle, - System.lineSeparator())); - } - - static void appendRUToStringBuilder(StringBuilder stringBuilder, String property, double requestCharge, - int indentLevel) { - final String RequestChargeFormatString = "%s"; - final String RequestChargeUnitString = "RUs"; - - QueryMetricsUtils.appendToStringBuilder( - stringBuilder, - property, - String.format(Locale.ROOT, RequestChargeFormatString, requestCharge), - RequestChargeUnitString, - indentLevel); - } - - static void appendActivityIdsToStringBuilder(StringBuilder stringBuilder, String activityIdsLabel, - List activityIds, int indentLevel) { - stringBuilder.append(activityIdsLabel); - stringBuilder.append(System.lineSeparator()); - for (String activityId : activityIds) { - stringBuilder.append(Indent); - stringBuilder.append(activityId); - stringBuilder.append(System.lineSeparator()); - } - } - - static void appendPercentageToStringBuilder(StringBuilder stringBuilder, String property, double percentage, - int indentLevel) { - final String PercentageFormatString = "%.2f"; - final String PercentageUnitString = "%"; - - QueryMetricsUtils.appendToStringBuilder(stringBuilder, property, String.format(PercentageFormatString, - percentage * 100), PercentageUnitString, indentLevel); - } - - static void appendCountToStringBuilder(StringBuilder stringBuilder, String property, long count, int indentLevel) { - final String CountFormatString = "%s"; - final String CountUnitString = ""; - - QueryMetricsUtils.appendToStringBuilder( - stringBuilder, - property, - String.format(CountFormatString, count), - CountUnitString, - indentLevel); - } - - static void appendNewlineToStringBuilder(StringBuilder stringBuilder) { - QueryMetricsUtils.appendHeaderToStringBuilder(stringBuilder, StringUtils.EMPTY, 0); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/QueryPreparationTimes.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/QueryPreparationTimes.java deleted file mode 100644 index 1ab1ae83bf75..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/QueryPreparationTimes.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb; - -import java.time.Duration; -import java.util.Collection; -import java.util.HashMap; - -public final class QueryPreparationTimes { - - static final QueryPreparationTimes ZERO = new QueryPreparationTimes(Duration.ZERO, Duration.ZERO, Duration.ZERO, Duration.ZERO); - - private final Duration queryCompilationTime; - private final Duration logicalPlanBuildTime; - private final Duration physicalPlanBuildTime; - private final Duration queryOptimizationTime; - - /** - * @param queryCompilationTime - * @param logicalPlanBuildTime - * @param physicalPlanBuildTime - * @param queryOptimizationTime - */ - QueryPreparationTimes(Duration queryCompilationTime, Duration logicalPlanBuildTime, Duration physicalPlanBuildTime, - Duration queryOptimizationTime) { - super(); - - if (queryCompilationTime == null) { - throw new NullPointerException("queryCompilationTime"); - } - - if (logicalPlanBuildTime == null) { - throw new NullPointerException("logicalPlanBuildTime"); - } - - if (physicalPlanBuildTime == null) { - throw new NullPointerException("physicalPlanBuildTime"); - } - - if (queryOptimizationTime == null) { - throw new NullPointerException("queryOptimizationTime"); - } - - this.queryCompilationTime = queryCompilationTime; - this.logicalPlanBuildTime = logicalPlanBuildTime; - this.physicalPlanBuildTime = physicalPlanBuildTime; - this.queryOptimizationTime = queryOptimizationTime; - } - - /** - * @return the queryCompilationTime - */ - public Duration getQueryCompilationTime() { - return queryCompilationTime; - } - - /** - * @return the logicalPlanBuildTime - */ - public Duration getLogicalPlanBuildTime() { - return logicalPlanBuildTime; - } - - /** - * @return the physicalPlanBuildTime - */ - public Duration getPhysicalPlanBuildTime() { - return physicalPlanBuildTime; - } - - /** - * @return the queryOptimizationTime - */ - public Duration getQueryOptimizationTime() { - return queryOptimizationTime; - } - - static QueryPreparationTimes createFromCollection( - Collection queryPreparationTimesCollection) { - if (queryPreparationTimesCollection == null) { - throw new NullPointerException("queryPreparationTimesCollection"); - } - - Duration queryCompilationTime = Duration.ZERO; - Duration logicalPlanBuildTime = Duration.ZERO; - Duration physicalPlanBuildTime = Duration.ZERO; - Duration queryOptimizationTime = Duration.ZERO; - - for (QueryPreparationTimes queryPreparationTimes : queryPreparationTimesCollection) { - if (queryPreparationTimes == null) { - throw new NullPointerException("queryPreparationTimesList can not have a null element"); - } - - queryCompilationTime = queryCompilationTime.plus(queryPreparationTimes.queryCompilationTime); - logicalPlanBuildTime = logicalPlanBuildTime.plus(queryPreparationTimes.logicalPlanBuildTime); - physicalPlanBuildTime = physicalPlanBuildTime.plus(queryPreparationTimes.physicalPlanBuildTime); - queryOptimizationTime = queryOptimizationTime.plus(queryPreparationTimes.queryOptimizationTime); - } - - return new QueryPreparationTimes( - queryCompilationTime, - logicalPlanBuildTime, - physicalPlanBuildTime, - queryOptimizationTime); - } - - static QueryPreparationTimes createFromDelimitedString(String delimitedString) { - HashMap metrics = QueryMetricsUtils.parseDelimitedString(delimitedString); - - return new QueryPreparationTimes( - QueryMetricsUtils.durationFromMetrics(metrics, QueryMetricsConstants.QueryCompileTimeInMs), - QueryMetricsUtils.durationFromMetrics(metrics, QueryMetricsConstants.LogicalPlanBuildTimeInMs), - QueryMetricsUtils.durationFromMetrics(metrics, QueryMetricsConstants.PhysicalPlanBuildTimeInMs), - QueryMetricsUtils.durationFromMetrics(metrics, QueryMetricsConstants.QueryOptimizationTimeInMs)); - } - - String toDelimitedString() { - String formatString = "%s=%.2f;%s=%.2f;%s=%.2f;%s=%.2f"; - return String.format( - formatString, - QueryMetricsConstants.QueryCompileTimeInMs, - this.queryCompilationTime.toMillis(), - QueryMetricsConstants.LogicalPlanBuildTimeInMs, - this.logicalPlanBuildTime.toMillis(), - QueryMetricsConstants.PhysicalPlanBuildTimeInMs, - this.physicalPlanBuildTime.toMillis(), - QueryMetricsConstants.QueryOptimizationTimeInMs, - this.queryOptimizationTime.toMillis()); - } - - String toTextString(int indentLevel) { - if (indentLevel == Integer.MAX_VALUE) { - throw new NumberFormatException("indentLevel input must be less than Integer.MaxValue"); - } - - StringBuilder stringBuilder = new StringBuilder(); - - QueryMetricsUtils.appendHeaderToStringBuilder(stringBuilder, QueryMetricsConstants.QueryPreparationTimesText, - indentLevel); - - QueryMetricsUtils.appendNanosecondsToStringBuilder(stringBuilder, QueryMetricsConstants.QueryCompileTimeText - , this.queryCompilationTime.toNanos(), indentLevel + 1); - - QueryMetricsUtils.appendNanosecondsToStringBuilder(stringBuilder, - QueryMetricsConstants.LogicalPlanBuildTimeText, this.logicalPlanBuildTime.toNanos(), - indentLevel + 1); - - QueryMetricsUtils.appendNanosecondsToStringBuilder(stringBuilder, - QueryMetricsConstants.PhysicalPlanBuildTimeText, this.physicalPlanBuildTime.toNanos(), - indentLevel + 1); - - QueryMetricsUtils.appendNanosecondsToStringBuilder(stringBuilder, - QueryMetricsConstants.QueryOptimizationTimeText, this.queryOptimizationTime.toNanos(), - indentLevel + 1); - return stringBuilder.toString(); - } -} - diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/RangeIndex.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/RangeIndex.java deleted file mode 100644 index 27ef781fe73a..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/RangeIndex.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import org.apache.commons.text.WordUtils; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents a range index in the Azure Cosmos DB database service. - */ -public final class RangeIndex extends Index { - - /** - * Initializes a new instance of the RangeIndex class with specified DataType. - *

- * Here is an example to instantiate RangeIndex class passing in the DataType: - *

-     * {@code
-     *
-     * RangeIndex rangeIndex = new RangeIndex(DataType.Number);
-     *
-     * }
-     * 
- * - * @param dataType the data type. - */ - public RangeIndex(DataType dataType) { - super(IndexKind.Range); - this.setDataType(dataType); - } - - /** - * Initializes a new instance of the RangeIndex class with specified DataType and precision. - *
-     * {@code
-     *
-     * RangeIndex rangeIndex = new RangeIndex(DataType.Number, -1);
-     *
-     * }
-     * 
- * @param dataType the data type of the RangeIndex - * @param precision the precision of the RangeIndex - */ - public RangeIndex(DataType dataType, int precision) { - super(IndexKind.Range); - this.setDataType(dataType); - this.setPrecision(precision); - } - - /** - * Initializes a new instance of the RangeIndex class with json string. - * - * @param jsonString the json string that represents the index. - */ - public RangeIndex(String jsonString) { - super(jsonString, IndexKind.Range); - if (this.getDataType() == null) { - throw new IllegalArgumentException("The jsonString doesn't contain a valid 'dataType'."); - } - } - - /** - * Gets data type. - * - * @return the data type. - */ - public DataType getDataType() { - DataType result = null; - try { - result = DataType.valueOf(WordUtils.capitalize(super.getString(Constants.Properties.DATA_TYPE))); - } catch (IllegalArgumentException e) { - this.getLogger().warn("Invalid index dataType value {}.", super.getString(Constants.Properties.DATA_TYPE)); - } - return result; - } - - /** - * Sets data type. - * - * @param dataType the data type. - */ - public void setDataType(DataType dataType) { - super.set(Constants.Properties.DATA_TYPE, dataType.name()); - } - - /** - * Gets precision. - * - * @return the precision. - */ - public int getPrecision() { - return super.getInt(Constants.Properties.PRECISION); - } - - /** - * Sets precision. - * - * @param precision the precision. - */ - public void setPrecision(int precision) { - super.set(Constants.Properties.PRECISION, precision); - } - - boolean hasPrecision() { - return super.has(Constants.Properties.PRECISION); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ReplicationPolicy.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ReplicationPolicy.java deleted file mode 100644 index 727fcd588b63..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ReplicationPolicy.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Encapsulates the replication policy in the Azure Cosmos DB database service. - */ -public class ReplicationPolicy extends JsonSerializable { - private static final int DEFAULT_MAX_REPLICA_SET_SIZE = 4; - private static final int DEFAULT_MIN_REPLICA_SET_SIZE = 3; - - public ReplicationPolicy() { - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the replication policy. - */ - public ReplicationPolicy(String jsonString) { - super(jsonString); - } - - public int getMaxReplicaSetSize() { - Integer maxReplicaSetSize = super.getInt(Constants.Properties.MAX_REPLICA_SET_SIZE); - if (maxReplicaSetSize == null) { - return DEFAULT_MAX_REPLICA_SET_SIZE; - } - - return maxReplicaSetSize; - } - - void setMaxReplicaSetSize(int value) { - Integer maxReplicaSetSize = super.getInt(Constants.Properties.MAX_REPLICA_SET_SIZE); - super.set(Constants.Properties.MAX_REPLICA_SET_SIZE, value); - } - - public int getMinReplicaSetSize() { - Integer minReplicaSetSize = super.getInt(Constants.Properties.MIN_REPLICA_SET_SIZE); - if (minReplicaSetSize == null) { - return DEFAULT_MIN_REPLICA_SET_SIZE; - } - - return minReplicaSetSize; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/RequestOptions.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/RequestOptions.java deleted file mode 100644 index 9a9e77a3503e..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/RequestOptions.java +++ /dev/null @@ -1,329 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Encapsulates options that can be specified for a request issued to the Azure Cosmos DB database service. - */ -public class RequestOptions { - private Map customOptions; - private List preTriggerInclude; - private List postTriggerInclude; - private AccessCondition accessCondition; - private IndexingDirective indexingDirective; - private ConsistencyLevel consistencyLevel; - private String sessionToken; - private Integer resourceTokenExpirySeconds; - private String offerType; - private Integer offerThroughput; - private PartitionKey partitionkey; - private String partitionKeyRangeId; - private boolean scriptLoggingEnabled; - private boolean populateQuotaInfo; - private Map properties; - - /** - * Gets the triggers to be invoked before the operation. - * - * @return the triggers to be invoked before the operation. - */ - public List getPreTriggerInclude() { - return this.preTriggerInclude; - } - - /** - * Sets the triggers to be invoked before the operation. - * - * @param preTriggerInclude the triggers to be invoked before the operation. - */ - public void setPreTriggerInclude(List preTriggerInclude) { - this.preTriggerInclude = preTriggerInclude; - } - - /** - * Gets the triggers to be invoked after the operation. - * - * @return the triggers to be invoked after the operation. - */ - public List getPostTriggerInclude() { - return this.postTriggerInclude; - } - - /** - * Sets the triggers to be invoked after the operation. - * - * @param postTriggerInclude the triggers to be invoked after the operation. - */ - public void setPostTriggerInclude(List postTriggerInclude) { - this.postTriggerInclude = postTriggerInclude; - } - - /** - * Gets the conditions associated with the request. - * - * @return the access condition. - */ - public AccessCondition getAccessCondition() { - return this.accessCondition; - } - - /** - * Sets the conditions associated with the request. - * - * @param accessCondition the access condition. - */ - public void setAccessCondition(AccessCondition accessCondition) { - this.accessCondition = accessCondition; - } - - /** - * Gets the indexing directive (index, do not index etc). - * - * @return the indexing directive. - */ - public IndexingDirective getIndexingDirective() { - return this.indexingDirective; - } - - /** - * Sets the indexing directive (index, do not index etc). - * - * @param indexingDirective the indexing directive. - */ - public void setIndexingDirective(IndexingDirective indexingDirective) { - this.indexingDirective = indexingDirective; - } - - /** - * Gets the consistency level required for the request. - * - * @return the consistency level. - */ - public ConsistencyLevel getConsistencyLevel() { - return this.consistencyLevel; - } - - /** - * Sets the consistency level required for the request. - * - * @param consistencyLevel the consistency level. - */ - public void setConsistencyLevel(ConsistencyLevel consistencyLevel) { - this.consistencyLevel = consistencyLevel; - } - - /** - * Gets the token for use with session consistency. - * - * @return the session token. - */ - public String getSessionToken() { - return this.sessionToken; - } - - /** - * Sets the token for use with session consistency. - * - * @param sessionToken the session token. - */ - public void setSessionToken(String sessionToken) { - this.sessionToken = sessionToken; - } - - /** - * Gets the expiry time for resource token. Used when creating, updating, reading permission. - * - * @return the resource token expiry seconds. - */ - public Integer getResourceTokenExpirySeconds() { - return this.resourceTokenExpirySeconds; - } - - /** - * Sets the expiry time for resource token. Used when creating, updating, reading permission. - * - * @param resourceTokenExpirySeconds the resource token expiry seconds. - */ - public void setResourceTokenExpirySeconds(Integer resourceTokenExpirySeconds) { - this.resourceTokenExpirySeconds = resourceTokenExpirySeconds; - } - - /** - * Gets the offer type when creating a document collection. - * - * @return the offer type. - */ - public String getOfferType() { - return this.offerType; - } - - /** - * Sets the offer type when creating a document collection. - * - * @param offerType the offer type. - */ - public void setOfferType(String offerType) { - this.offerType = offerType; - } - - /** - * Gets the throughput in the form of Request Units per second when creating a document collection. - * - * @return the throughput value. - */ - public Integer getOfferThroughput() { - return this.offerThroughput; - } - - /** - * Sets the throughput in the form of Request Units per second when creating a document collection. - * - * @param offerThroughput the throughput value. - */ - public void setOfferThroughput(Integer offerThroughput) { - this.offerThroughput = offerThroughput; - } - - /** - * Gets the partition key used to identify the current request's target partition. - * - * @return the partition key value. - */ - public PartitionKey getPartitionKey() { - return this.partitionkey; - } - - /** - * Sets the partition key used to identify the current request's target partition. - * - * @param partitionkey the partition key value. - */ - public void setPartitionKey(PartitionKey partitionkey) { - this.partitionkey = partitionkey; - } - - /** - * Internal usage only: Gets the partition key range id used to identify the current request's target partition. - * - * @return the partition key range id value. - */ - String getPartitionKeyRangeId() { - return this.partitionKeyRangeId; - } - - /** - * Internal usage only: Sets the partition key range id used to identify the current request's target partition. - * - * @param partitionKeyRangeId the partition key range id value. - */ - protected void setPartitionKeyRengeId(String partitionKeyRangeId) { - this.partitionKeyRangeId = partitionKeyRangeId; - } - - /** - * Gets whether Javascript stored procedure logging is enabled for the current request in the Azure Cosmos DB database - * service or not. - * - * @return true if Javascript stored procedure logging is enabled - */ - public boolean isScriptLoggingEnabled() { - return scriptLoggingEnabled; - } - - /** - * Sets whether Javascript stored procedure logging is enabled for the current request in the Azure Cosmos DB database - * service or not. - * - * @param scriptLoggingEnabled true if stored procedure Javascript logging is enabled - */ - public void setScriptLoggingEnabled(boolean scriptLoggingEnabled) { - this.scriptLoggingEnabled = scriptLoggingEnabled; - } - - /** - * Gets the PopulateQuotaInfo setting for document collection read requests in the Azure Cosmos DB database service. - * PopulateQuotaInfo is used to enable/disable getting document collection quota related stats for document - * collection read requests. - * - * @return true if PopulateQuotaInfo is enabled - */ - public boolean isPopulateQuotaInfo() { - return populateQuotaInfo; - } - - /** - * Sets the PopulateQuotaInfo setting for document collection read requests in the Azure Cosmos DB database service. - * PopulateQuotaInfo is used to enable/disable getting document collection quota related stats for document - * collection read requests. - * - * @param populateQuotaInfo a boolean value indicating whether PopulateQuotaInfo is enabled or not - */ - public void setPopulateQuotaInfo(boolean populateQuotaInfo) { - this.populateQuotaInfo = populateQuotaInfo; - } - - /** - * Sets the custom request option value by key - * - * @param name a string representing the custom option's name - * @param value a String representing the custom option's value - */ - public void setHeader(String name, String value) { - if (this.customOptions == null) { - this.customOptions = new HashMap<>(); - } - this.customOptions.put(name, value); - } - - /** - * Gets the custom request options - * - * @return Map of custom request options - */ - public Map getHeaders() { - return this.customOptions; - } - /** - * Gets the properties - * - * @return Map of request options properties - */ - public Map getProperties() { - return properties; - } - - /** - * Sets the properties used to identify the request token. - * - * @param properties the properties. - */ - public void setProperties(Map properties) { - this.properties = properties; - } - -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Resource.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Resource.java deleted file mode 100644 index eb84bf89a0b1..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Resource.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.Date; -import java.util.concurrent.TimeUnit; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents the base resource in the Azure Cosmos DB database service. - */ -public class Resource extends JsonSerializable { - private String altLink; - - /** - * Copy constructor. - * @param resource resource to by copied. - */ - protected Resource(Resource resource) { - this.setId(resource.getId()); - this.setResourceId(resource.getResourceId()); - this.setSelfLink(resource.getSelfLink()); - this.setAltLink(resource.getAltLink()); - this.setTimestamp(resource.getTimestamp()); - this.setETag(resource.getETag()); - } - - /** - * Constructor. - */ - protected Resource() { - super(); - } - - /** - * Constructor. - * - * @param objectNode the {@link ObjectNode} that represent the {@link JsonSerializable} - */ - Resource(ObjectNode objectNode) { - super(objectNode); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the resource. - * @param objectMapper the custom object mapper - */ - protected Resource(String jsonString, ObjectMapper objectMapper) { - super(jsonString, objectMapper); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the resource. - */ - protected Resource(String jsonString) { - super(jsonString); - } - - /** - * Gets the name of the resource. - * - * @return the name of the resource. - */ - public String getId() { - return super.getString(Constants.Properties.ID); - } - - /** - * Sets the name of the resource. - * - * @param id the name of the resource. - */ - public void setId(String id) { - super.set(Constants.Properties.ID, id); - } - - /** - * Gets the ID associated with the resource. - * - * @return the ID associated with the resource. - */ - public String getResourceId() { - return super.getString(Constants.Properties.R_ID); - } - - /** - * Set the ID associated with the resource. - * - * @param resourceId the ID associated with the resource. - */ - public void setResourceId(String resourceId) { - super.set(Constants.Properties.R_ID, resourceId); - } - - /** - * Get the self-link associated with the resource. - * - * @return the self link. - */ - public String getSelfLink() { - return super.getString(Constants.Properties.SELF_LINK); - } - - /** - * Set the self-link associated with the resource. - * - * @param selfLink the self link. - */ - void setSelfLink(String selfLink) { - super.set(Constants.Properties.SELF_LINK, selfLink); - } - - /** - * Get the last modified timestamp associated with the resource. - * - * @return the timestamp. - */ - public Date getTimestamp() { - Double seconds = super.getDouble(Constants.Properties.LAST_MODIFIED); - if (seconds == null) return null; - return new Date(TimeUnit.SECONDS.toMillis(seconds.longValue())); - } - - /** - * Set the last modified timestamp associated with the resource. - * - * @param timestamp the timestamp. - */ - void setTimestamp(Date timestamp) { - double millisec = timestamp.getTime(); - super.set(Constants.Properties.LAST_MODIFIED, TimeUnit.MILLISECONDS.toSeconds((long) millisec)); - } - - /** - * Get the entity tag associated with the resource. - * - * @return the e tag. - */ - public String getETag() { - return super.getString(Constants.Properties.E_TAG); - } - - /** - * Set the self-link associated with the resource. - * - * @param eTag the e tag. - */ - void setETag(String eTag) { - super.set(Constants.Properties.E_TAG, eTag); - } - - /** - * Sets the alt-link associated with the resource from the Azure Cosmos DB service. - * @param altLink - */ - void setAltLink(String altLink) { - this.altLink = altLink; - } - - /** - * Gets the alt-link associated with the resource from the Azure Cosmos DB service. - */ - String getAltLink() { - return this.altLink; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ResourceResponse.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ResourceResponse.java deleted file mode 100644 index d92db7263700..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/ResourceResponse.java +++ /dev/null @@ -1,447 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.time.Duration; -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.lang3.StringUtils; - -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; - -/** - * Represents the service response to a request made from DocumentClient in the Azure Cosmos DB database service. - * Contains both the resource and the response headers. - * - * @param the resource type of the resource response. - */ -public final class ResourceResponse { - private Class cls; - private T resource; - private RxDocumentServiceResponse response; - private Map usageHeaders; - private Map quotaHeaders; - - ResourceResponse(RxDocumentServiceResponse response, Class cls) { - this.response = response; - this.usageHeaders = new HashMap(); - this.quotaHeaders = new HashMap(); - this.cls = cls; - this.resource = this.response.getResource(this.cls); - } - - /** - * Max Quota. - * - * @return the database quota. - */ - public long getDatabaseQuota() { - return this.getMaxQuotaHeader(Constants.Quota.DATABASE); - } - - /** - * Current Usage. - * - * @return the current database usage. - */ - public long getDatabaseUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.DATABASE); - } - - /** - * Max Quota. - * - * @return the collection quota. - */ - public long getCollectionQuota() { - return this.getMaxQuotaHeader(Constants.Quota.COLLECTION); - } - - /** - * Current Usage. - * - * @return the current collection usage. - */ - public long getCollectionUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.COLLECTION); - } - - /** - * Max Quota. - * - * @return the user quota. - */ - public long getUserQuota() { - return this.getMaxQuotaHeader(Constants.Quota.USER); - } - - /** - * Current Usage. - * - * @return the current user usage. - */ - public long getUserUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.USER); - } - - /** - * Max Quota. - * - * @return the permission quota. - */ - public long getPermissionQuota() { - return this.getMaxQuotaHeader(Constants.Quota.PERMISSION); - } - - /** - * Current Usage. - * - * @return the current permission usage. - */ - public long getPermissionUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.PERMISSION); - } - - /** - * Max Quota. - * - * @return the collection size quota. - */ - public long getCollectionSizeQuota() { - return this.getMaxQuotaHeader(Constants.Quota.COLLECTION_SIZE); - } - - /** - * Current Usage. - * - * @return the collection size usage. - */ - public long getCollectionSizeUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.COLLECTION_SIZE); - } - - /** - * Max Quota. - * - * @return the document quota. - */ - public long getDocumentQuota() { - return this.getMaxQuotaHeader(Constants.Quota.DOCUMENTS_SIZE); - } - - /** - * Current Usage. - * - * @return the document usage. - */ - public long getDocumentUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.DOCUMENTS_SIZE); - } - - /** - * Max document count quota. - * - * @return the document count quota. - */ - public long getDocumentCountQuota() { - return this.getMaxQuotaHeader(Constants.Quota.DOCUMENTS_COUNT); - } - - /** - * Current document count usage. - * - * @return the document count usage. - */ - public long getDocumentCountUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.DOCUMENTS_COUNT); - } - - /** - * Max Quota. - * - * @return the stored procedures quota. - */ - public long getStoredProceduresQuota() { - return this.getMaxQuotaHeader(Constants.Quota.STORED_PROCEDURE); - } - - /** - * Current Usage. - * - * @return the current stored procedures usage. - */ - public long getStoredProceduresUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.STORED_PROCEDURE); - } - - /** - * Max Quota. - * - * @return the triggers quota. - */ - public long getTriggersQuota() { - return this.getMaxQuotaHeader(Constants.Quota.TRIGGER); - } - - /** - * Current Usage. - * - * @return the current triggers usage. - */ - public long getTriggersUsage() { - return this.getCurrentQuotaHeader(Constants.Quota.TRIGGER); - } - - /** - * Max Quota. - * - * @return the user defined functions quota. - */ - public long getUserDefinedFunctionsQuota() { - return this.getMaxQuotaHeader(Constants.Quota.USER_DEFINED_FUNCTION); - } - - /** - * Current Usage. - * - * @return the current user defined functions usage. - */ - public long getUserDefinedFunctionsUsage() { - return this.getCurrentQuotaHeader( - Constants.Quota.USER_DEFINED_FUNCTION); - } - - /** - * Gets the Activity ID for the request. - * - * @return the activity id. - */ - public String getActivityId() { - return this.response.getResponseHeaders().get(HttpConstants.HttpHeaders.ACTIVITY_ID); - } - - /** - * Gets the token used for managing client's consistency requirements. - * - * @return the session token. - */ - public String getSessionToken() { - return this.response.getResponseHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); - } - - /** - * Gets the HTTP status code associated with the response. - * - * @return the status code. - */ - public int getStatusCode() { - return this.response.getStatusCode(); - } - - /** - * Gets the maximum size limit for this entity (in megabytes (MB) for server resources and in count for master - * resources). - * - * @return the max resource quota. - */ - public String getMaxResourceQuota() { - return this.response.getResponseHeaders().get(HttpConstants.HttpHeaders.MAX_RESOURCE_QUOTA); - } - - /** - * Gets the current size of this entity (in megabytes (MB) for server resources and in count for master resources) - * - * @return the current resource quota usage. - */ - public String getCurrentResourceQuotaUsage() { - return this.response.getResponseHeaders().get(HttpConstants.HttpHeaders.CURRENT_RESOURCE_QUOTA_USAGE); - } - - /** - * Gets the resource for the request. - * - * @return the resource. - */ - public T getResource() { - return this.resource; - } - - /** - * Gets the number of index paths (terms) generated by the operation. - * - * @return the request charge. - */ - public double getRequestCharge() { - String value = this.getResponseHeaders().get(HttpConstants.HttpHeaders.REQUEST_CHARGE); - if (StringUtils.isEmpty(value)) { - return 0; - } - return Double.valueOf(value); - } - - /** - * Gets the headers associated with the response. - * - * @return the response headers. - */ - public Map getResponseHeaders() { - return this.response.getResponseHeaders(); - } - - /** - * Gets the progress of an index transformation, if one is underway. - * - * @return the progress of an index transformation. - */ - public long getIndexTransformationProgress() { - String value = this.getResponseHeaders().get(HttpConstants.HttpHeaders.INDEX_TRANSFORMATION_PROGRESS); - if (StringUtils.isEmpty(value)) { - return -1; - } - return Long.parseLong(value); - } - - /** - * Gets the progress of lazy indexing. - * - * @return the progress of lazy indexing. - */ - public long getLazyIndexingProgress() { - String value = this.getResponseHeaders().get(HttpConstants.HttpHeaders.LAZY_INDEXING_PROGRESS); - if (StringUtils.isEmpty(value)) { - return -1; - } - return Long.parseLong(value); - } - - /** - * Gets the request statistics for the current request to Azure Cosmos DB service. - * - * @return request statistics for the current request to Azure Cosmos DB service. - */ - public ClientSideRequestStatistics getClientSideRequestStatistics() { - return this.response.getClientSideRequestStatistics(); - } - - /** - * Gets the end-to-end request latency for the current request to Azure Cosmos DB service. - * - * @return end-to-end request latency for the current request to Azure Cosmos DB service. - */ - public Duration getRequestLatency() { - ClientSideRequestStatistics clientSideRequestStatistics = this.response.getClientSideRequestStatistics(); - if (clientSideRequestStatistics == null) { - return Duration.ZERO; - } - - return clientSideRequestStatistics.getRequestLatency(); - } - - /** - * Gets the diagnostics information for the current request to Azure Cosmos DB service. - * - * @return diagnostics information for the current request to Azure Cosmos DB service. - */ - public String getRequestDiagnosticsString() { - ClientSideRequestStatistics clientSideRequestStatistics = this.response.getClientSideRequestStatistics(); - if (clientSideRequestStatistics == null) { - return StringUtils.EMPTY; - } - return clientSideRequestStatistics.toString(); - } - - long getCurrentQuotaHeader(String headerName) { - if (this.usageHeaders.size() == 0 && - !StringUtils.isEmpty(this.getMaxResourceQuota()) && - !StringUtils.isEmpty(this.getCurrentResourceQuotaUsage())) { - this.populateQuotaHeader(this.getMaxResourceQuota(), this.getCurrentResourceQuotaUsage()); - } - - if (this.usageHeaders.containsKey(headerName)) { - return this.usageHeaders.get(headerName); - } - - return 0; - } - - long getMaxQuotaHeader(String headerName) { - if (this.quotaHeaders.size() == 0 && - !StringUtils.isEmpty(this.getMaxResourceQuota()) && - !this.getCurrentResourceQuotaUsage().isEmpty()) { - this.populateQuotaHeader(this.getMaxResourceQuota(), this.getCurrentResourceQuotaUsage()); - } - - if (this.quotaHeaders.containsKey(headerName)) { - return this.quotaHeaders.get(headerName); - } - - return 0; - } - - private void populateQuotaHeader(String headerMaxQuota, String headerCurrentUsage) { - String[] headerMaxQuotaWords = headerMaxQuota.split(Constants.Quota.DELIMITER_CHARS, -1); - String[] headerCurrentUsageWords = headerCurrentUsage.split(Constants.Quota.DELIMITER_CHARS, -1); - - assert (headerMaxQuotaWords.length == headerCurrentUsageWords.length); - - for (int i = 0; i < headerMaxQuotaWords.length; ++i) { - if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.DATABASE)) { - this.quotaHeaders.put(Constants.Quota.DATABASE, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.DATABASE, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.COLLECTION)) { - this.quotaHeaders.put(Constants.Quota.COLLECTION, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.COLLECTION, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.USER)) { - this.quotaHeaders.put(Constants.Quota.USER, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.USER, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.PERMISSION)) { - this.quotaHeaders.put(Constants.Quota.PERMISSION, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.PERMISSION, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.COLLECTION_SIZE)) { - this.quotaHeaders.put(Constants.Quota.COLLECTION_SIZE, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.COLLECTION_SIZE, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.DOCUMENTS_SIZE)) { - this.quotaHeaders.put(Constants.Quota.DOCUMENTS_SIZE, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.DOCUMENTS_SIZE, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.STORED_PROCEDURE)) { - this.quotaHeaders.put(Constants.Quota.STORED_PROCEDURE, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.STORED_PROCEDURE, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.TRIGGER)) { - this.quotaHeaders.put(Constants.Quota.TRIGGER, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.TRIGGER, Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.USER_DEFINED_FUNCTION)) { - this.quotaHeaders.put(Constants.Quota.USER_DEFINED_FUNCTION, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.USER_DEFINED_FUNCTION, - Long.valueOf(headerCurrentUsageWords[i + 1])); - } else if (headerMaxQuotaWords[i].equalsIgnoreCase(Constants.Quota.DOCUMENTS_COUNT)) { - this.quotaHeaders.put(Constants.Quota.DOCUMENTS_COUNT, Long.valueOf(headerMaxQuotaWords[i + 1])); - this.usageHeaders.put(Constants.Quota.DOCUMENTS_COUNT, - Long.valueOf(headerCurrentUsageWords[i + 1])); - } - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/RetryOptions.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/RetryOptions.java deleted file mode 100644 index 2fb19427228c..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/RetryOptions.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Encapsulates retry options in the Azure Cosmos DB database service. - */ -public class RetryOptions { - private int maxRetryAttemptsOnThrottledRequests; - private int maxRetryWaitTimeInSeconds; - - /** - * Creates a new instance of the RetryOptions class and initializes all - * properties to default values. - */ - public RetryOptions() { - this.maxRetryAttemptsOnThrottledRequests = 9; - this.maxRetryWaitTimeInSeconds = 30; - } - - /** - * Gets the maximum number of retries in the case where the request fails - * because the service has applied rate limiting on the client. - * - * @return the maximum number of retries. - */ - public int getMaxRetryAttemptsOnThrottledRequests() { - return this.maxRetryAttemptsOnThrottledRequests; - } - - /** - * Sets the maximum number of retries in the case where the request fails - * because the service has applied rate limiting on the client. - *

- * When a client is sending requests faster than the allowed rate, the - * service will return HttpStatusCode 429 (Too Many Request) to throttle the - * client. The current implementation in the SDK will then wait for the - * amount of time the service tells it to wait and retry after the time has - * elapsed. - *

- * The default value is 9. This means in the case where the request is - * throttled, the same request will be issued for a maximum of 10 times to - * the server before an error is returned to the application. - * - * @param maxRetryAttemptsOnThrottledRequests the max number of retry attempts on failed requests due to a - * throttle error. - */ - public void setMaxRetryAttemptsOnThrottledRequests(int maxRetryAttemptsOnThrottledRequests) { - if (maxRetryAttemptsOnThrottledRequests < 0) { - throw new IllegalArgumentException("maxRetryAttemptsOnThrottledRequests value must be a positive integer."); - } - - this.maxRetryAttemptsOnThrottledRequests = maxRetryAttemptsOnThrottledRequests; - } - - /** - * Gets the maximum retry time in seconds. - * - * @return the maximum retry time in seconds. - */ - public int getMaxRetryWaitTimeInSeconds() { - return this.maxRetryWaitTimeInSeconds; - } - - /** - * Sets the maximum retry time in seconds. - *

- * When a request fails due to a throttle error, the service sends back a - * response that contains a value indicating the client should not retry - * before the time period has elapsed (Retry-After). The MaxRetryWaitTime - * flag allows the application to set a maximum wait time for all retry - * attempts. If the cumulative wait time exceeds the MaxRetryWaitTime, the - * SDK will stop retrying and return the error to the application. - *

- * The default value is 30 seconds. - * - * @param maxRetryWaitTimeInSeconds the maximum number of seconds a request will be retried. - */ - public void setMaxRetryWaitTimeInSeconds(int maxRetryWaitTimeInSeconds) { - if (maxRetryWaitTimeInSeconds < 0 || maxRetryWaitTimeInSeconds > Integer.MAX_VALUE / 1000) { - throw new IllegalArgumentException( - "value must be a positive integer between the range of 0 to " + Integer.MAX_VALUE / 1000); - } - - this.maxRetryWaitTimeInSeconds = maxRetryWaitTimeInSeconds; - } - - @Override - public String toString() { - return "RetryOptions{" + - "maxRetryAttemptsOnThrottledRequests=" + maxRetryAttemptsOnThrottledRequests + - ", maxRetryWaitTimeInSeconds=" + maxRetryWaitTimeInSeconds + - '}'; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/RuntimeExecutionTimes.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/RuntimeExecutionTimes.java deleted file mode 100644 index 0beb503a80ab..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/RuntimeExecutionTimes.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb; - -import java.time.Duration; -import java.util.Collection; -import java.util.HashMap; - -/** - * Query runtime execution times in the Azure Cosmos DB service. - */ -public final class RuntimeExecutionTimes { - - static final RuntimeExecutionTimes ZERO = new RuntimeExecutionTimes(Duration.ZERO, Duration.ZERO, Duration.ZERO); - - private final Duration queryEngineExecutionTime; - private final Duration systemFunctionExecutionTime; - private final Duration userDefinedFunctionExecutionTime; - - /** - * @param queryEngineExecutionTime - * @param systemFunctionExecutionTime - * @param userDefinedFunctionExecutionTime - */ - RuntimeExecutionTimes(Duration queryEngineExecutionTime, Duration systemFunctionExecutionTime, - Duration userDefinedFunctionExecutionTime) { - super(); - - if (queryEngineExecutionTime == null) { - throw new NullPointerException("queryEngineExecutionTime"); - } - - if (systemFunctionExecutionTime == null) { - throw new NullPointerException("systemFunctionExecutionTime"); - } - - if (userDefinedFunctionExecutionTime == null) { - throw new NullPointerException("userDefinedFunctionExecutionTime"); - } - - this.queryEngineExecutionTime = queryEngineExecutionTime; - this.systemFunctionExecutionTime = systemFunctionExecutionTime; - this.userDefinedFunctionExecutionTime = userDefinedFunctionExecutionTime; - } - - /** - * @return the queryEngineExecutionTime - */ - public Duration getQueryEngineExecutionTime() { - return queryEngineExecutionTime; - } - - /** - * @return the systemFunctionExecutionTime - */ - public Duration getSystemFunctionExecutionTime() { - return systemFunctionExecutionTime; - } - - /** - * @return the userDefinedFunctionExecutionTime - */ - public Duration getUserDefinedFunctionExecutionTime() { - return userDefinedFunctionExecutionTime; - } - - static RuntimeExecutionTimes createFromCollection( - Collection runtimeExecutionTimesCollection) { - if (runtimeExecutionTimesCollection == null) { - throw new NullPointerException("runtimeExecutionTimesCollection"); - } - - Duration queryEngineExecutionTime = Duration.ZERO; - Duration systemFunctionExecutionTime = Duration.ZERO; - Duration userDefinedFunctionExecutionTime = Duration.ZERO; - - for (RuntimeExecutionTimes runtimeExecutionTime : runtimeExecutionTimesCollection) { - queryEngineExecutionTime = queryEngineExecutionTime.plus(runtimeExecutionTime.queryEngineExecutionTime); - systemFunctionExecutionTime = systemFunctionExecutionTime.plus(runtimeExecutionTime.systemFunctionExecutionTime); - userDefinedFunctionExecutionTime = userDefinedFunctionExecutionTime.plus(runtimeExecutionTime.userDefinedFunctionExecutionTime); - } - - return new RuntimeExecutionTimes( - queryEngineExecutionTime, - systemFunctionExecutionTime, - userDefinedFunctionExecutionTime); - } - - static RuntimeExecutionTimes createFromDelimitedString(String delimitedString) { - HashMap metrics = QueryMetricsUtils.parseDelimitedString(delimitedString); - - Duration vmExecutionTime = QueryMetricsUtils.durationFromMetrics(metrics, QueryMetricsConstants.VMExecutionTimeInMs); - Duration indexLookupTime = QueryMetricsUtils.durationFromMetrics(metrics, QueryMetricsConstants.IndexLookupTimeInMs); - Duration documentLoadTime = QueryMetricsUtils.durationFromMetrics(metrics, QueryMetricsConstants.DocumentLoadTimeInMs); - Duration documentWriteTime = QueryMetricsUtils.durationFromMetrics(metrics, QueryMetricsConstants.DocumentWriteTimeInMs); - - return new RuntimeExecutionTimes( - vmExecutionTime.minus(indexLookupTime).minus(documentLoadTime).minus(documentWriteTime), - QueryMetricsUtils.durationFromMetrics(metrics, QueryMetricsConstants.SystemFunctionExecuteTimeInMs), - QueryMetricsUtils.durationFromMetrics(metrics, QueryMetricsConstants.UserDefinedFunctionExecutionTimeInMs)); - } - - String toDelimitedString() { - String formatString = "%s=%2f;%s=%2f"; - - // queryEngineExecutionTime is not emitted, since it is calculated as - // vmExecutionTime - indexLookupTime - documentLoadTime - documentWriteTime - return String.format( - formatString, - QueryMetricsConstants.SystemFunctionExecuteTimeInMs, - this.systemFunctionExecutionTime.toMillis(), - QueryMetricsConstants.UserDefinedFunctionExecutionTimeInMs, - this.userDefinedFunctionExecutionTime.toMillis()); - } - - String toTextString(int indentLevel) { - if (indentLevel == Integer.MAX_VALUE) { - throw new NumberFormatException("indentLevel input must be less than Int32.MaxValue"); - } - StringBuilder stringBuilder = new StringBuilder(); - - QueryMetricsUtils.appendHeaderToStringBuilder(stringBuilder, QueryMetricsConstants.RuntimeExecutionTimesText, - indentLevel); - - QueryMetricsUtils.appendNanosecondsToStringBuilder(stringBuilder, - QueryMetricsConstants.TotalExecutionTimeText, this.queryEngineExecutionTime.toNanos(), - indentLevel + 1); - - QueryMetricsUtils.appendNanosecondsToStringBuilder(stringBuilder, - QueryMetricsConstants.SystemFunctionExecuteTimeText, - this.systemFunctionExecutionTime.toNanos(), indentLevel + 1); - - QueryMetricsUtils.appendNanosecondsToStringBuilder(stringBuilder, - QueryMetricsConstants.UserDefinedFunctionExecutionTimeText, - this.userDefinedFunctionExecutionTime.toNanos(), indentLevel + 1); - - return stringBuilder.toString(); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SerializationFormattingPolicy.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SerializationFormattingPolicy.java deleted file mode 100644 index bd753f5e394c..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SerializationFormattingPolicy.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * The formatting policy associated with JSON serialization in the Azure Cosmos DB database service. - */ -public enum SerializationFormattingPolicy { - - /** - * No additional formatting required. - */ - None, - - /** - * Indent the fields appropriately. - */ - Indented -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SpatialIndex.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SpatialIndex.java deleted file mode 100644 index a263640bcb3d..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SpatialIndex.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import org.apache.commons.text.WordUtils; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents a spatial index in the Azure Cosmos DB database service. - */ -public final class SpatialIndex extends Index { - - /** - * Initializes a new instance of the SpatialIndex class. - *

- * Here is an example to instantiate SpatialIndex class passing in the DataType - *

-     * {@code
-     *
-     * SpatialIndex spatialIndex = new SpatialIndex(DataType.Point);
-     *
-     * }
-     * 
- * - * @param dataType specifies the target data type for the index path specification. - */ - public SpatialIndex(DataType dataType) { - super(IndexKind.Spatial); - this.setDataType(dataType); - } - - /** - * Initializes a new instance of the SpatialIndex class. - * - * @param jsonString the json string that represents the index. - */ - public SpatialIndex(String jsonString) { - super(jsonString, IndexKind.Spatial); - if (this.getDataType() == null) { - throw new IllegalArgumentException("The jsonString doesn't contain a valid 'dataType'."); - } - } - - /** - * Gets data type. - * - * @return the data type. - */ - public DataType getDataType() { - DataType result = null; - try { - result = DataType.valueOf(WordUtils.capitalize(super.getString(Constants.Properties.DATA_TYPE))); - } catch (IllegalArgumentException e) { - this.getLogger().warn("Invalid index dataType value {}.", super.getString(Constants.Properties.DATA_TYPE)); - } - return result; - } - - /** - * Sets data type. - * - * @param dataType the data type. - */ - public void setDataType(DataType dataType) { - super.set(Constants.Properties.DATA_TYPE, dataType.name()); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SpatialSpec.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SpatialSpec.java deleted file mode 100644 index 828bd0895699..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SpatialSpec.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.ArrayList; -import java.util.Collection; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -public class SpatialSpec extends JsonSerializable { - - private Collection spatialTypes; - - /** - * Constructor. - */ - public SpatialSpec() { - super(); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the included path. - */ - public SpatialSpec(String jsonString) { - super(jsonString); - } - - - /** - * Gets path. - * - * @return the path. - */ - public String getPath() { - return super.getString(Constants.Properties.PATH); - } - - /** - * Sets path. - * - * @param path the path. - */ - public void setPath(String path) { - super.set(Constants.Properties.PATH, path); - } - - /** - * Gets the collection of spatial types. - * - * @return the collection of spatial types. - */ - public Collection getSpatialTypes() { - if (this.spatialTypes == null) { - this.spatialTypes = super.getCollection(Constants.Properties.TYPES, SpatialType.class); - - if (this.spatialTypes == null) { - this.spatialTypes = new ArrayList(); - } - } - - return this.spatialTypes; - } - - /** - * Sets the collection of spatial types. - * - * @param spatialTypes the collection of spatial types. - */ - public void setSpatialTypes(Collection spatialTypes) { - this.spatialTypes = spatialTypes; - Collection spatialTypeNames = new ArrayList(); - for (SpatialType spatialType : this.spatialTypes) { - spatialTypeNames.add(spatialType.name()); - } - super.set(Constants.Properties.TYPES, spatialTypeNames); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SpatialType.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SpatialType.java deleted file mode 100644 index 23ddd664f872..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SpatialType.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Defines the target data type of an index path specification in the Azure Cosmos DB service. - * - */ -public enum SpatialType { - /** - * Represent a point data type. - */ - Point, - - /** - * Represent a line string data type. - */ - LineString, - - /** - * Represent a polygon data type. - */ - Polygon, - - /** - * Represent a multi-polygon data type. - */ - MultiPolygon -} - diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SqlParameter.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SqlParameter.java deleted file mode 100644 index 6d6018f04e33..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SqlParameter.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Represents a SQL parameter in the SqlQuerySpec used for queries in the Azure Cosmos DB database service. - */ -public final class SqlParameter extends JsonSerializable { - - - /** - * Initializes a new instance of the SqlParameter class. - */ - public SqlParameter() { - super(); - } - - /** - * Initializes a new instance of the SqlParameter class with the name and value of the parameter. - * - * @param name the name of the parameter. - * @param value the value of the parameter. - */ - public SqlParameter(String name, Object value) { - super(); - this.setName(name); - this.setValue(value); - } - - /** - * Gets the name of the parameter. - * - * @return the name of the parameter. - */ - public String getName() { - return super.getString("name"); - } - - /** - * Sets the name of the parameter. - * - * @param name the name of the parameter. - */ - public void setName(String name) { - super.set("name", name); - } - - /** - * Gets the value of the parameter. - * - * @param c the class of the parameter value. - * @param the type of the parameter - * @return the value of the parameter. - */ - public Object getValue(Class c) { - return super.getObject("value", c); - } - - /** - * Sets the value of the parameter. - * - * @param value the value of the parameter. - */ - public void setValue(Object value) { - super.set("value", value); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SqlParameterCollection.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SqlParameterCollection.java deleted file mode 100644 index 8d7a5bcbe8ac..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SqlParameterCollection.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - -/** - * Represents a collection of SQL parameters to for a SQL query in the Azure Cosmos DB database service. - */ -public final class SqlParameterCollection implements Collection { - - private List parameters; - - /** - * Initializes a new instance of the SqlParameterCollection class. - */ - public SqlParameterCollection() { - this.parameters = new ArrayList(); - } - - /** - * Initializes a new instance of the SqlParameterCollection class from an array of parameters. - * - * @param parameters the array of parameters. - */ - public SqlParameterCollection(SqlParameter... parameters) { - if (parameters == null) { - throw new IllegalArgumentException("parameters"); - } - - this.parameters = Arrays.asList(parameters); - } - - /** - * Initializes a new instance of the SqlParameterCollection class from a collection of parameters. - * - * @param parameters the collection of parameters. - */ - public SqlParameterCollection(Collection parameters) { - if (parameters == null) { - throw new IllegalArgumentException("parameters"); - } - - this.parameters = new ArrayList(parameters); - } - - @Override - public boolean add(SqlParameter parameter) { - return this.parameters.add(parameter); - } - - @Override - public boolean addAll(Collection parameters) { - return this.parameters.addAll(parameters); - } - - @Override - public void clear() { - this.parameters.clear(); - } - - @Override - public boolean contains(Object parameter) { - return this.parameters.contains(parameter); - } - - @Override - public boolean containsAll(Collection parameters) { - return this.parameters.containsAll(parameters); - } - - @Override - public boolean isEmpty() { - return this.parameters.isEmpty(); - } - - @Override - public Iterator iterator() { - return this.parameters.iterator(); - } - - @Override - public boolean remove(Object parameter) { - return this.parameters.remove(parameter); - } - - @Override - public boolean removeAll(Collection parameters) { - return this.parameters.removeAll(parameters); - } - - @Override - public boolean retainAll(Collection parameters) { - return this.parameters.retainAll(parameters); - } - - @Override - public int size() { - return this.parameters.size(); - } - - @Override - public Object[] toArray() { - return this.parameters.toArray(); - } - - @Override - public T[] toArray(T[] parameters) { - return this.parameters.toArray(parameters); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SqlQuerySpec.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SqlQuerySpec.java deleted file mode 100644 index a73f3112c83a..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/SqlQuerySpec.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.ArrayList; -import java.util.Collection; - -/** - * Represents a SQL query in the Azure Cosmos DB database service. - */ -public final class SqlQuerySpec extends JsonSerializable { - - private SqlParameterCollection parameters; - - /** - * Initializes a new instance of the SqlQuerySpec class. - */ - public SqlQuerySpec() { - super(); - } - - /** - * Initializes a new instance of the SqlQuerySpec class with the text of the - * query. - * - * @param queryText - * the query text. - */ - public SqlQuerySpec(String queryText) { - super(); - this.setQueryText(queryText); - } - - /** - * Initializes a new instance of the SqlQuerySpec class with the text of the - * query and parameters. - * - * @param queryText the query text. - * @param parameters the query parameters. - */ - public SqlQuerySpec(String queryText, SqlParameterCollection parameters) { - super(); - this.setQueryText(queryText); - this.parameters = parameters; - } - - /** - * Gets the text of the query. - * - * @return the query text. - */ - public String getQueryText() { - return super.getString("query"); - } - - /** - * Sets the text of the query. - * - * @param queryText - * the query text. - */ - public void setQueryText(String queryText) { - super.set("query", queryText); - } - - /** - * Gets the collection of query parameters. - * - * @return the query parameters. - */ - public SqlParameterCollection getParameters() { - if (this.parameters == null) { - Collection sqlParameters = super.getCollection("parameters", SqlParameter.class); - if (sqlParameters == null) { - sqlParameters = new ArrayList(); - } - - this.parameters = new SqlParameterCollection(sqlParameters); - } - - return this.parameters; - } - - /** - * Sets the collection of query parameters. - * - * @param parameters - * the query parameters. - */ - public void setParameters(SqlParameterCollection parameters) { - this.parameters = parameters; - } - - @Override - void populatePropertyBag() { - boolean defaultParameters = (this.parameters != null && this.parameters.size() != 0); - - if (defaultParameters) { - super.set("parameters", this.parameters); - } else { - super.remove("parameters"); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/StoredProcedure.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/StoredProcedure.java deleted file mode 100644 index 0972ca2f57a7..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/StoredProcedure.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents a stored procedure in the Azure Cosmos DB database service. - *

- * Cosmos DB allows stored procedures to be executed in the storage tier, directly against a document collection. The - * script gets executed under ACID transactions on the primary storage partition of the specified collection. For - * additional details, refer to the server-side JavaScript API documentation. - */ -public class StoredProcedure extends Resource { - - /** - * Constructor. - */ - public StoredProcedure() { - super(); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the stored procedure. - */ - public StoredProcedure(String jsonString) { - super(jsonString); - } - - /** - * Get the body of the stored procedure. - * - * @return the body of the stored procedure. - */ - public String getBody() { - return super.getString(Constants.Properties.BODY); - } - - /** - * Set the body of the stored procedure. - * - * @param body the body of the stored procedure. - */ - public void setBody(String body) { - super.set(Constants.Properties.BODY, body); - } -} - diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/StoredProcedureResponse.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/StoredProcedureResponse.java deleted file mode 100644 index ea358de0d579..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/StoredProcedureResponse.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; - -/** - * Represents the response returned from a stored procedure in the Azure Cosmos DB database service. - * Wraps the response body and headers. - */ -public final class StoredProcedureResponse { - private final static Logger logger = LoggerFactory.getLogger(StoredProcedureResponse.class); - private final RxDocumentServiceResponse response; - - /** - * Constructs StoredProcedureResponse. - * - * @param response the document service response. - */ - StoredProcedureResponse(RxDocumentServiceResponse response) { - this.response = response; - } - - /** - * Gets the Activity ID of the request. - * - * @return the activity id. - */ - public String getActivityId() { - return this.response.getResponseHeaders().get(HttpConstants.HttpHeaders.ACTIVITY_ID); - } - - /** - * Gets the token for use with session consistency requests. - * - * @return the session token. - */ - public String getSessionToken() { - return this.response.getResponseHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); - } - - /** - * Gets the request completion status code. - * - * @return the status code. - */ - public int getStatusCode() { - return this.response.getStatusCode(); - } - - /** - * Gets the maximum size limit for this entity (in megabytes (MB) for server resources and in count for master - * resources). - * - * @return the max resource quota. - */ - public String getMaxResourceQuota() { - return this.response.getResponseHeaders().get(HttpConstants.HttpHeaders.MAX_RESOURCE_QUOTA); - } - - /** - * Gets the current size of this entity (in megabytes (MB) for server resources and in count for master resources) - * - * @return the current resource quota usage. - */ - public String getCurrentResourceQuotaUsage() { - return this.response.getResponseHeaders().get(HttpConstants.HttpHeaders.CURRENT_RESOURCE_QUOTA_USAGE); - } - - /** - * Gets the number of normalized requests charged. - * - * @return the request charge. - */ - public double getRequestCharge() { - String value = this.response.getResponseHeaders().get(HttpConstants.HttpHeaders.REQUEST_CHARGE); - try { - return Double.valueOf(value); - } catch (NumberFormatException e) { - logger.warn("Invalid x-ms-request-charge value {}.", value); - return 0; - } - } - - /** - * Gets the headers associated with the response. - * - * @return the response headers. - */ - public Map getResponseHeaders() { - return this.response.getResponseHeaders(); - } - - /** - * Gets the response of a stored procedure, serialized into a document. - * - * @return the response as a document. - */ - public Document getResponseAsDocument() { - return this.response.getResource(Document.class); - } - - /** - * Gets the response of a stored procedure, serialized into an attachment. - * - * @return the response as an attachment. - */ - public Attachment getResponseAsAttachment() { - return this.response.getResource(Attachment.class); - } - - /** - * Gets the response of a stored procedure as a string. - * - * @return the response as a string. - */ - public String getResponseAsString() { - return this.response.getReponseBodyAsString(); - } - - /** - * Gets the output from stored procedure console.log() statements. - * - * @return the output string from the stored procedure console.log() statements. - */ - public String getScriptLog() { - return this.response.getResponseHeaders().get(HttpConstants.HttpHeaders.SCRIPT_LOG_RESULTS); - } - - /** - * Gets the client side request statics for execution of stored procedure. - * - * @return client side request statistics for execution of stored procedure. - */ - public ClientSideRequestStatistics getClientSideRequestStatistics() { - return this.response.getClientSideRequestStatistics(); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/TokenResolver.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/TokenResolver.java deleted file mode 100644 index 363626a557ff..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/TokenResolver.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.Map; - -/** - * This interface is for client side implementation, which can be used for initializing - * AsyncDocumentClient without passing master key, resource token and permission feed.
- *
- * Each time the SDK create request for CosmosDB, authorization token is generated based on that - * request at client side which enables creation of one AsyncDocumentClient per application shared across various users - * with different resource permissions. - */ -@FunctionalInterface -public interface TokenResolver { - - /** - * This method will consume the request information and based on that it will generate the authorization token. - * @param properties the user properties. - * @param requestVerb Request verb i.e. GET, POST, PUT etc. - * @param resourceIdOrFullName ResourceID or resource full name. - * @param resourceType Resource type i.e. Database, DocumentCollection, Document etc. - * @return The authorization token. - */ - public String getAuthorizationToken(String requestVerb, String resourceIdOrFullName, CosmosResourceType resourceType, Map properties); - -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Trigger.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Trigger.java deleted file mode 100644 index 2b71da26710f..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Trigger.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import org.apache.commons.text.WordUtils; -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents a trigger in the Azure Cosmos DB database service. - *

- * Cosmos DB supports pre and post triggers defined in JavaScript to be executed on creates, updates and deletes. For - * additional details, refer to the server-side JavaScript API documentation. - */ -public class Trigger extends Resource { - - /** - * Constructor. - */ - public Trigger() { - super(); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the trigger. - */ - public Trigger(String jsonString) { - super(jsonString); - } - - /** - * Get the body of the trigger. - * - * @return the body of the trigger. - */ - public String getBody() { - return super.getString(Constants.Properties.BODY); - } - - /** - * Set the body of the trigger. - * - * @param body the body of the trigger. - */ - public void setBody(String body) { - super.set(Constants.Properties.BODY, body); - } - - /** - * Get the type of the trigger. - * - * @return the trigger type. - */ - public TriggerType getTriggerType() { - TriggerType result = TriggerType.Pre; - try { - result = TriggerType.valueOf( - WordUtils.capitalize(super.getString(Constants.Properties.TRIGGER_TYPE))); - } catch (IllegalArgumentException e) { - // ignore the exception and return the default - this.getLogger().warn("Invalid triggerType value {}.", super.getString(Constants.Properties.TRIGGER_TYPE)); - } - return result; - } - - /** - * Set the type of the resource. - * - * @param triggerType the trigger type. - */ - public void setTriggerType(TriggerType triggerType) { - super.set(Constants.Properties.TRIGGER_TYPE, triggerType.name()); - } - - /** - * Get the operation type of the trigger. - * - * @return the trigger operation. - */ - public TriggerOperation getTriggerOperation() { - TriggerOperation result = TriggerOperation.Create; - try { - result = TriggerOperation.valueOf( - WordUtils.capitalize(super.getString(Constants.Properties.TRIGGER_OPERATION))); - } catch (IllegalArgumentException e) { - // ignore the exception and return the default - this.getLogger().warn("Invalid triggerOperation value {}.", super.getString(Constants.Properties.TRIGGER_OPERATION)); - } - return result; - } - - /** - * Set the operation type of the trigger. - * - * @param triggerOperation the trigger operation. - */ - public void setTriggerOperation(TriggerOperation triggerOperation) { - super.set(Constants.Properties.TRIGGER_OPERATION, triggerOperation.name()); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/TriggerOperation.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/TriggerOperation.java deleted file mode 100644 index 084250371a94..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/TriggerOperation.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Specifies the operations on which a trigger should be executed in the Azure Cosmos DB database service. - */ -public enum TriggerOperation { - /** - * All operations. - */ - All(0x0), - - /** - * Create operations only. - */ - Create(0x1), - - /** - * Update operations only. - */ - Update(0x2), - - /** - * Delete operations only. - */ - Delete(0x3), - - /** - * Replace operations only. - */ - Replace(0x4); - - private int value; - - TriggerOperation(int value) { - this.value = value; - } - - /** - * Gets the numerical value of the trigger operation. - * - * @return the numerical value. - */ - public int getValue() { - return value; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/TriggerType.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/TriggerType.java deleted file mode 100644 index 9f46d79cd916..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/TriggerType.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * The trigger type in the Azure Cosmos DB database service. - */ -public enum TriggerType { - /** - * Trigger should be executed before the associated operation(s). - */ - Pre(0x0), - - /** - * Trigger should be executed after the associated operation(s). - */ - Post(0x1); - - private int value; - - TriggerType(int value) { - this.value = value; - } - - /** - * Gets the numerical value of the trigger type. - * - * @return the numerical value. - */ - public int getValue() { - return value; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Undefined.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Undefined.java deleted file mode 100644 index ceb3fc06bb04..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/Undefined.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -/** - * Represents the 'Undefined' partition key in the Azure Cosmos DB database service. - */ -public class Undefined extends JsonSerializable { - - private final static Undefined value = new Undefined(); - - /** - * Constructor. Create a new instance of the Undefined object. - */ - private Undefined() { - } - - /** - * Returns the singleton value of Undefined. - * - * @return the Undefined value - */ - public static Undefined Value() { - return value; - } - - /** - * Returns the string representation of Undfined. - */ - public String toString() { - return "{}"; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/UniqueKey.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/UniqueKey.java deleted file mode 100644 index 7a60410c8fbe..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/UniqueKey.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2016 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb; - -import java.util.ArrayList; -import java.util.Collection; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents a unique key on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. - * - * 1) For partitioned collections, the value of partition key is implicitly a part of each unique key. - * 2) Uniqueness constraint is also enforced for missing values. - * For instance, if unique key policy defines a unique key with single property path, there could be only one document that has missing value for this property. - * @see UniqueKeyPolicy - */ -public class UniqueKey extends JsonSerializable { - private Collection paths; - - public UniqueKey() { - super(); - } - - public UniqueKey(String jsonString) { - super(jsonString); - } - - /** - * Gets the paths, a set of which must be unique for each document in the Azure Cosmos DB service. - * - * The paths to enforce uniqueness on. Each path is a rooted path of the unique property in the document, - * such as "/name/first". - * - * @return the unique paths. - */ - public Collection getPaths() { - if (this.paths == null) { - this.paths = super.getCollection(Constants.Properties.PATHS, String.class); - - if (this.paths == null) { - this.paths = new ArrayList(); - } - } - - return this.paths; - } - - - /** - * Sets the paths, a set of which must be unique for each document in the Azure Cosmos DB service. - * - * The paths to enforce uniqueness on. Each path is a rooted path of the unique property in the document, - * such as "/name/first". - * - * @param paths the unique paths. - */ - public void setPaths(Collection paths) { - this.paths = paths; - } - - @Override - void populatePropertyBag() { - if (paths != null) { - super.set(Constants.Properties.PATHS, paths); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/UniqueKeyPolicy.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/UniqueKeyPolicy.java deleted file mode 100644 index 26e5983eaf77..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/UniqueKeyPolicy.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb; - -import java.util.ArrayList; -import java.util.Collection; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents the unique key policy configuration for specifying uniqueness constraints on documents in the - * collection in the Azure Cosmos DB service. - */ -public class UniqueKeyPolicy extends JsonSerializable { - private Collection uniqueKeys; - - public UniqueKeyPolicy() { - super(); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the Unique Key policy. - */ - public UniqueKeyPolicy(String jsonString) { - super(jsonString); - } - - /** - * Gets or sets collection of {@link UniqueKey} that guarantee uniqueness of documents in collection - * in the Azure Cosmos DB service. - * - * @return the unique keys. - */ - public Collection getUniqueKeys() { - if (this.uniqueKeys == null) { - this.uniqueKeys = super.getCollection(Constants.Properties.UNIQUE_KEYS, UniqueKey.class); - if (this.uniqueKeys == null) { - this.uniqueKeys = new ArrayList<>(); - } - } - return this.uniqueKeys; - } - - public void setUniqueKeys(Collection uniqueKeys) { - if (uniqueKeys == null) { - throw new IllegalArgumentException("uniqueKeys cannot be null."); - } - this.uniqueKeys = uniqueKeys; - } - - @Override - void populatePropertyBag() { - if (this.uniqueKeys != null) { - for(UniqueKey uniqueKey: uniqueKeys) { - uniqueKey.populatePropertyBag(); - } - super.set(Constants.Properties.UNIQUE_KEYS, uniqueKeys); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/User.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/User.java deleted file mode 100644 index f3a0137051e0..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/User.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents a database user in the Azure Cosmos DB database service. - */ -public class User extends Resource { - - /** - * Initialize a user object. - */ - public User() { - super(); - } - - /** - * Initialize a user object from json string. - * - * @param jsonString the json string that represents the database user. - */ - public User(String jsonString) { - super(jsonString); - } - - /** - * Gets the self-link of the permissions associated with the user. - * - * @return the permissions link. - */ - public String getPermissionsLink() { - String selfLink = this.getSelfLink(); - if (selfLink.endsWith("/")) { - return selfLink + super.getString(Constants.Properties.PERMISSIONS_LINK); - } else { - return selfLink + "/" + super.getString(Constants.Properties.PERMISSIONS_LINK); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/UserDefinedFunction.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/UserDefinedFunction.java deleted file mode 100644 index 7cfb585ead3e..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/UserDefinedFunction.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Represents a user defined function in the Azure Cosmos DB database service. - *

- * Cosmos DB supports JavaScript UDFs which can be used inside queries, stored procedures and triggers. For additional - * details, refer to the server-side JavaScript API documentation. - */ -public class UserDefinedFunction extends Resource { - - /** - * Constructor. - */ - public UserDefinedFunction() { - super(); - } - - /** - * Constructor. - * - * @param jsonString the json string that represents the user defined function. - */ - public UserDefinedFunction(String jsonString) { - super(jsonString); - } - - /** - * Get the body of the user defined function. - * - * @return the body. - */ - public String getBody() { - return super.getString(Constants.Properties.BODY); - } - - /** - * Set the body of the user defined function. - * - * @param body the body. - */ - public void setBody(String body) { - super.set(Constants.Properties.BODY, body); - } -} - diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Bytes.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Bytes.java deleted file mode 100644 index 9220f79f73a5..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Bytes.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - - -public class Bytes { - - public static void reverse(byte[] bytes, int offset, int endIndex) { - for(int i = offset, j = endIndex - 1; i < j; --j, i++) { - byte aux = bytes[i]; - bytes[i] = bytes[j]; - bytes[j] = aux; - } - } - - public static void reverse(byte[] bytes) { - Bytes.reverse(bytes, 0, bytes.length); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Constants.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Constants.java deleted file mode 100644 index 6ae4ca51597a..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Constants.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -/** - * Used internally. Constants in the Azure Cosmos DB database service Java SDK. - */ -public final class Constants { - - public static final class Quota { - // Quota Strings - public static final String DATABASE = "databases"; - public static final String COLLECTION = "collections"; - public static final String USER = "users"; - public static final String PERMISSION = "permissions"; - public static final String COLLECTION_SIZE = "collectionSize"; - public static final String DOCUMENTS_SIZE = "documentsSize"; - public static final String STORED_PROCEDURE = "storedProcedures"; - public static final String TRIGGER = "triggers"; - public static final String USER_DEFINED_FUNCTION = "functions"; - public static final String DELIMITER_CHARS = "=|;"; - public static final String DOCUMENTS_COUNT = "documentsCount"; - } - - public static final class Properties { - public static final String ID = "id"; - public static final String R_ID = "_rid"; - public static final String SELF_LINK = "_self"; - public static final String LAST_MODIFIED = "_ts"; - public static final String COUNT = "_count"; - public static final String E_TAG = "_etag"; - public static final String AGGREGATE = "_aggregate"; - - public static final String CONSISTENCY_POLICY = "consistencyPolicy"; - public static final String DEFAULT_CONSISTENCY_LEVEL = "defaultConsistencyLevel"; - public static final String MAX_STALENESS_PREFIX = "maxStalenessPrefix"; - public static final String MAX_STALENESS_INTERVAL_IN_SECONDS = "maxIntervalInSeconds"; - public static final String PARENTS = "parents"; - - public static final String DATABASES_LINK = "_dbs"; - public static final String COLLECTIONS_LINK = "_colls"; - public static final String USERS_LINK = "_users"; - public static final String PERMISSIONS_LINK = "_permissions"; - public static final String ATTACHMENTS_LINK = "_attachments"; - public static final String STORED_PROCEDURES_LINK = "_sprocs"; - public static final String TRIGGERS_LINK = "_triggers"; - public static final String USER_DEFINED_FUNCTIONS_LINK = "_udfs"; - public static final String CONFLICTS_LINK = "_conflicts"; - public static final String DOCUMENTS_LINK = "_docs"; - public static final String RESOURCE_LINK = "resource"; - public static final String MEDIA_LINK = "media"; - - public static final String PERMISSION_MODE = "permissionMode"; - public static final String RESOURCE_KEY = "key"; - public static final String TOKEN = "_token"; - public static final String SQL_API_TYPE = "0x10"; - - // Scripting - public static final String BODY = "body"; - public static final String TRIGGER_TYPE = "triggerType"; - public static final String TRIGGER_OPERATION = "triggerOperation"; - - public static final String MAX_SIZE = "maxSize"; - public static final String CURRENT_USAGE = "currentUsage"; - - public static final String CONTENT = "content"; - - public static final String CONTENT_TYPE = "contentType"; - - // ErrorResource. - public static final String CODE = "code"; - public static final String MESSAGE = "message"; - public static final String ERROR_DETAILS = "errorDetails"; - public static final String ADDITIONAL_ERROR_INFO = "additionalErrorInfo"; - - // PartitionInfo. - public static final String RESOURCE_TYPE = "resourceType"; - public static final String SERVICE_INDEX = "serviceIndex"; - public static final String PARTITION_INDEX = "partitionIndex"; - - public static final String ADDRESS_LINK = "addresses"; - public static final String USER_REPLICATION_POLICY = "userReplicationPolicy"; - public static final String USER_CONSISTENCY_POLICY = "userConsistencyPolicy"; - public static final String SYSTEM_REPLICATION_POLICY = "systemReplicationPolicy"; - public static final String READ_POLICY = "readPolicy"; - public static final String QUERY_ENGINE_CONFIGURATION = "queryEngineConfiguration"; - - //ReplicationPolicy - public static final String REPLICATION_POLICY = "replicationPolicy"; - public static final String ASYNC_REPLICATION = "asyncReplication"; - public static final String MAX_REPLICA_SET_SIZE = "maxReplicasetSize"; - public static final String MIN_REPLICA_SET_SIZE = "minReplicaSetSize"; - - //Indexing Policy. - public static final String INDEXING_POLICY = "indexingPolicy"; - public static final String AUTOMATIC = "automatic"; - public static final String STRING_PRECISION = "StringPrecision"; - public static final String NUMERIC_PRECISION = "NumericPrecision"; - public static final String MAX_PATH_DEPTH = "maxPathDepth"; - public static final String INDEXING_MODE = "indexingMode"; - public static final String INDEX_TYPE = "IndexType"; - public static final String INDEX_KIND = "kind"; - public static final String DATA_TYPE = "dataType"; - public static final String PRECISION = "precision"; - - public static final String PATHS = "paths"; - public static final String PATH = "path"; - public static final String INCLUDED_PATHS = "includedPaths"; - public static final String EXCLUDED_PATHS = "excludedPaths"; - public static final String INDEXES = "indexes"; - public static final String COMPOSITE_INDEXES = "compositeIndexes"; - public static final String ORDER = "order"; - public static final String SPATIAL_INDEXES = "spatialIndexes"; - public static final String TYPES = "types"; - - // Unique index. - public static final String UNIQUE_KEY_POLICY = "uniqueKeyPolicy"; - public static final String UNIQUE_KEYS = "uniqueKeys"; - - // Conflict. - public static final String CONFLICT = "conflict"; - public static final String OPERATION_TYPE = "operationType"; - public static final String SOURCE_RESOURCE_ID = "resourceId"; - - // Offer resource - public static final String OFFER_TYPE = "offerType"; - public static final String OFFER_VERSION = "offerVersion"; - public static final String OFFER_CONTENT = "content"; - public static final String OFFER_THROUGHPUT = "offerThroughput"; - public static final String OFFER_VERSION_V1 = "V1"; - public static final String OFFER_VERSION_V2 = "V2"; - public static final String OFFER_RESOURCE_ID = "offerResourceId"; - - // PartitionKey - public static final String PARTITION_KEY = "partitionKey"; - public static final String PARTITION_KEY_PATHS = "paths"; - public static final String PARTITION_KIND = "kind"; - public static final String PARTITION_KEY_DEFINITION_VERSION = "version"; - - public static final String RESOURCE_PARTITION_KEY = "resourcePartitionKey"; - public static final String PARTITION_KEY_RANGE_ID = "partitionKeyRangeId"; - public static final String MIN_INCLUSIVE_EFFECTIVE_PARTITION_KEY = "minInclusiveEffectivePartitionKey"; - public static final String MAX_EXCLUSIVE_EFFECTIVE_PARTITION_KEY = "maxExclusiveEffectivePartitionKey"; - - // AddressResource - public static final String IS_PRIMARY = "isPrimary"; - public static final String PROTOCOL = "protocol"; - public static final String LOGICAL_URI = "logicalUri"; - public static final String PHYISCAL_URI = "physcialUri"; - - // Time-to-Live - public static final String TTL = "ttl"; - public static final String DEFAULT_TTL = "defaultTtl"; - - // Global DB account properties - public static final String Name = "name"; - public static final String WRITABLE_LOCATIONS = "writableLocations"; - public static final String READABLE_LOCATIONS = "readableLocations"; - public static final String DATABASE_ACCOUNT_ENDPOINT = "databaseAccountEndpoint"; - - //Authorization - public static final String MASTER_TOKEN = "master"; - public static final String RESOURCE_TOKEN = "resource"; - public static final String TOKEN_VERSION = "1.0"; - public static final String AUTH_SCHEMA_TYPE = "type"; - public static final String AUTH_VERSION = "ver"; - public static final String AUTH_SIGNATURE = "sig"; - public static final String READ_PERMISSION_MODE = "read"; - public static final String ALL_PERMISSION_MODE = "all"; - public static final String PATH_SEPARATOR = "/"; - - public static final int DEFAULT_MAX_PAGE_SIZE = 100; - public static final String ENABLE_MULTIPLE_WRITE_LOCATIONS = "enableMultipleWriteLocations"; - - // Conflict resolution policy - public static final String CONFLICT_RESOLUTION_POLICY = "conflictResolutionPolicy"; - public static final String MODE = "mode"; - public static final String CONFLICT_RESOLUTION_PATH = "conflictResolutionPath"; - public static final String CONFLICT_RESOLUTION_PROCEDURE = "conflictResolutionProcedure"; - - //Handler names for RXNetty httpClient - public static final String SSL_HANDLER_NAME = "ssl-handler"; - public static final String SSL_COMPLETION_HANDLER_NAME = "ssl-completion-handler"; - public static final String HTTP_PROXY_HANDLER_NAME = "http-proxy-handler"; - public static final String LOGGING_HANDLER_NAME = "logging-handler"; - } - - public static final class UrlEncodingInfo { - public static final String PLUS_SYMBOL_ESCAPED = "\\+"; - public static final String PLUS_SYMBOL_URI_ENCODING = "%2b"; - public static final String SINGLE_SPACE_URI_ENCODING = "%20"; - public static final String UTF_8 = "UTF-8"; - } - - public static final class PartitionedQueryExecutionInfo { - public static final int VERSION_1 = 1; - } - - public static final class QueryExecutionContext { - public static final String INCREMENTAL_FEED_HEADER_VALUE = "Incremental feed"; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/HttpConstants.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/HttpConstants.java deleted file mode 100644 index 0ca46de53635..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/HttpConstants.java +++ /dev/null @@ -1,323 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -/** - * Used internally. HTTP constants in the Azure Cosmos DB database service Java SDK. - */ -public class HttpConstants { - public static class HttpMethods { - public static final String GET = "GET"; - public static final String POST = "POST"; - public static final String PUT = "PUT"; - public static final String DELETE = "DELETE"; - public static final String HEAD = "HEAD"; - public static final String OPTIONS = "OPTIONS"; - public static final String PATCH = "PATCH"; - } - - public static class QueryStrings { - public static final String URL = "$resolveFor"; - public static final String FILTER = "$filter"; - public static final String PARTITION_KEY_RANGE_IDS = "$partitionKeyRangeIds"; - } - - public static class HttpHeaders { - public static final String AUTHORIZATION = "authorization"; - public static final String E_TAG = "etag"; - public static final String METHOD_OVERRIDE = "X-HTTP-Method"; - public static final String SLUG = "Slug"; - public static final String CONTENT_TYPE = "Content-Type"; - public static final String LAST_MODIFIED = "Last-Modified"; - public static final String CONTENT_ENCODING = "Content-Encoding"; - public static final String CHARACTER_SET = "CharacterSet"; - public static final String USER_AGENT = "User-Agent"; - public static final String IF_MODIFIED_SINCE = "If-Modified-Since"; - public static final String IF_MATCH = "If-Match"; - public static final String IF_NONE_MATCH = "If-None-Match"; - public static final String CONTENT_LENGTH = "Content-Length"; - public static final String ACCEPT_ENCODING = "Accept-Encoding"; - public static final String KEEP_ALIVE = "Keep-Alive"; - public static final String CONNECTION = "Connection"; - public static final String CACHE_CONTROL = "Cache-Control"; - public static final String TRANSFER_ENCODING = "Transfer-Encoding"; - public static final String CONTENT_LANGUAGE = "Content-Language"; - public static final String CONTENT_LOCATION = "Content-Location"; - public static final String CONTENT_MD5 = "Content-Md5"; - public static final String CONTENT_RANGE = "Content-Range"; - public static final String ACCEPT = "Accept"; - public static final String ACCEPT_CHARSET = "Accept-Charset"; - public static final String ACCEPT_LANGUAGE = "Accept-Language"; - public static final String IF_RANGE = "If-Range"; - public static final String IF_UNMODIFIED_SINCE = "If-Unmodified-Since"; - public static final String MAX_FORWARDS = "Max-Forwards"; - public static final String PROXY_AUTHORIZATION = "Proxy-Authorization"; - public static final String ACCEPT_RANGES = "Accept-Ranges"; - public static final String PROXY_AUTHENTICATE = "Proxy-Authenticate"; - public static final String RETRY_AFTER = "Retry-After"; - public static final String SET_COOKIE = "Set-Cookie"; - public static final String WWW_AUTHENTICATE = "Www-Authenticate"; - public static final String ORIGIN = "Origin"; - public static final String HOST = "Host"; - public static final String ACCESS_CONTROL_ALLOW_ORIGIN = "Access-Control-Allow-Origin"; - public static final String ACCESS_CONTROL_ALLOW_HEADERS = "Access-Control-Allow-Headers"; - public static final String KEY_VALUE_ENCODING_FORMAT = "application/x-www-form-urlencoded"; - public static final String WRAP_ASSERTION_FORMAT = "wrap_assertion_format"; - public static final String WRAP_ASSERTION = "wrap_assertion"; - public static final String WRAP_SCOPE = "wrap_scope"; - public static final String SIMPLE_TOKEN = "SWT"; - public static final String HTTP_DATE = "date"; - public static final String PREFER = "Prefer"; - public static final String LOCATION = "Location"; - public static final String REFERER = "referer"; - - // Query - public static final String QUERY = "x-ms-documentdb-query"; - public static final String IS_QUERY = "x-ms-documentdb-isquery"; - public static final String ENABLE_CROSS_PARTITION_QUERY = "x-ms-documentdb-query-enablecrosspartition"; - public static final String PARALLELIZE_CROSS_PARTITION_QUERY = "x-ms-documentdb-query-parallelizecrosspartitionquery"; - - // Our custom DocDB headers - public static final String CONTINUATION = "x-ms-continuation"; - public static final String PAGE_SIZE = "x-ms-max-item-count"; - public static final String RESPONSE_CONTINUATION_TOKEN_LIMIT_IN_KB = "x-ms-documentdb-responsecontinuationtokenlimitinkb"; - - // Request sender generated. Simply echoed by backend. - public static final String ACTIVITY_ID = "x-ms-activity-id"; - public static final String PRE_TRIGGER_INCLUDE = "x-ms-documentdb-pre-trigger-include"; - public static final String PRE_TRIGGER_EXCLUDE = "x-ms-documentdb-pre-trigger-exclude"; - public static final String POST_TRIGGER_INCLUDE = "x-ms-documentdb-post-trigger-include"; - public static final String POST_TRIGGER_EXCLUDE = "x-ms-documentdb-post-trigger-exclude"; - public static final String INDEXING_DIRECTIVE = "x-ms-indexing-directive"; - public static final String SESSION_TOKEN = "x-ms-session-token"; - public static final String CONSISTENCY_LEVEL = "x-ms-consistency-level"; - public static final String X_DATE = "x-ms-date"; - public static final String COLLECTION_PARTITION_INFO = "x-ms-collection-partition-info"; - public static final String COLLECTION_SERVICE_INFO = "x-ms-collection-service-info"; - public static final String RETRY_AFTER_IN_MILLISECONDS = "x-ms-retry-after-ms"; - public static final String IS_FEED_UNFILTERED = "x-ms-is-feed-unfiltered"; - public static final String RESOURCE_TOKEN_EXPIRY = "x-ms-documentdb-expiry-seconds"; - public static final String ENABLE_SCAN_IN_QUERY = "x-ms-documentdb-query-enable-scan"; - public static final String EMIT_VERBOSE_TRACES_IN_QUERY = "x-ms-documentdb-query-emit-traces"; - - // target lsn for head requests - public static final String TARGET_LSN = "x-ms-target-lsn"; - public static final String TARGET_GLOBAL_COMMITTED_LSN = "x-ms-target-global-committed-lsn"; - - //Request validation - public static final String REQUEST_VALIDATION_FAILURE = "x-ms-request-validation-failure"; - - public static final String WRITE_REQUEST_TRIGGER_ADDRESS_REFRESH = "x-ms-write-request-trigger-refresh"; - - // Quota Info - public static final String MAX_RESOURCE_QUOTA = "x-ms-resource-quota"; - public static final String CURRENT_RESOURCE_QUOTA_USAGE = "x-ms-resource-usage"; - public static final String MAX_MEDIA_STORAGE_USAGE_IN_MB = "x-ms-max-media-storage-usage-mb"; - - // Usage Info - public static final String REQUEST_CHARGE = "x-ms-request-charge"; - public static final String CURRENT_MEDIA_STORAGE_USAGE_IN_MB = "x-ms-media-storage-usage-mb"; - public static final String DATABASE_ACCOUNT_CONSUMED_DOCUMENT_STORAGE_IN_MB = "x-ms-databaseaccount-consumed-mb"; - public static final String DATABASE_ACCOUNT_RESERVED_DOCUMENT_STORAGE_IN_MB = "x-ms-databaseaccount-reserved-mb"; - public static final String DATABASE_ACCOUNT_PROVISIONED_DOCUMENT_STORAGE_IN_MB = "x-ms-databaseaccount-provisioned-mb"; - - // Address related headers. - public static final String FORCE_REFRESH = "x-ms-force-refresh"; - public static final String ITEM_COUNT = "x-ms-item-count"; - public static final String NEW_RESOURCE_ID = "x-ms-new-resource-id"; - public static final String USE_MASTER_COLLECTION_RESOLVER = "x-ms-use-master-collection-resolver"; - - // Admin Headers - public static final String FULL_UPGRADE = "x-ms-force-full-upgrade"; - public static final String ONLY_UPGRADE_SYSTEM_APPLICATIONS = "x-ms-only-upgrade-system-applications"; - public static final String ONLY_UPGRADE_NON_SYSTEM_APPLICATIONS = "x-ms-only-upgrade-non-system-applications"; - public static final String UPGRADE_FABRIC_RING_CODE_AND_CONFIG = "x-ms-upgrade-fabric-code-config"; - public static final String IGNORE_IN_PROGRESS_UPGRADE = "x-ms-ignore-inprogress-upgrade"; - public static final String UPGRADE_VERIFICATION_KIND = "x-ms-upgrade-verification-kind"; - public static final String IS_CANARY = "x-ms-iscanary"; - public static final String FORCE_DELETE = "x-ms-force-delete"; - - // Version headers and values - public static final String VERSION = "x-ms-version"; - public static final String SCHEMA_VERSION = "x-ms-schemaversion"; - public static final String SERVER_VERSION = "x-ms-serviceversion"; - public static final String GATEWAY_VERSION = "x-ms-gatewayversion"; - - // RDFE Resource Provider headers - public static final String OCP_RESOURCE_PROVIDER_REGISTERED_URI = "ocp-resourceprovider-registered-uri"; - - // For Document service management operations only. This is in - // essence a 'handle' to (long running) operations. - public static final String REQUEST_ID = "x-ms-request-id"; - - // Object returning this determines what constitutes state and what - // last state change means. For replica, it is the last role change. - public static final String LAST_STATE_CHANGE_UTC = "x-ms-last-state-change-utc"; - - // CSM specific headers - // Client-request-id: Optional caller-specified request ID, in the form - // of a GUID - public static final String CLIENT_REQUEST_ID = "x-ms-client-request-id"; - - // Offer header - public static final String OFFER_TYPE = "x-ms-offer-type"; - public static final String OFFER_THROUGHPUT = "x-ms-offer-throughput"; - public static final String OFFER_IS_RU_PER_MINUTE_THROUGHPUT_ENABLED = "x-ms-offer-is-ru-per-minute-throughput-enabled"; - - // Upsert header - public static final String IS_UPSERT = "x-ms-documentdb-is-upsert"; - - // Index progress headers - public static final String INDEX_TRANSFORMATION_PROGRESS = "x-ms-documentdb-collection-index-transformation-progress"; - public static final String LAZY_INDEXING_PROGRESS = "x-ms-documentdb-collection-lazy-indexing-progress"; - - //Owner name - public static final String OWNER_FULL_NAME = "x-ms-alt-content-path"; - - // Owner ID used for name based request in session token. - public static final String OWNER_ID = "x-ms-content-path"; - - // Partition headers - public static final String PARTITION_KEY = "x-ms-documentdb-partitionkey"; - public static final String PARTITION_KEY_RANGE_ID = "x-ms-documentdb-partitionkeyrangeid"; - - // Error response sub status code - public static final String SUB_STATUS = "x-ms-substatus"; - - public static final String LSN = "lsn"; - - // Custom DocDB JavaScript logging headers - public static final String SCRIPT_ENABLE_LOGGING = "x-ms-documentdb-script-enable-logging"; - public static final String SCRIPT_LOG_RESULTS = "x-ms-documentdb-script-log-results"; - - // Collection quota - public static final String POPULATE_QUOTA_INFO = "x-ms-documentdb-populatequotainfo"; - - // ChangeFeed - public static final String A_IM = "A-IM"; - public static final String ALLOW_TENTATIVE_WRITES = "x-ms-cosmos-allow-tentative-writes"; - - // These settings were added to support RNTBD and they've been added here to reduce merge conflicts - - public static final String CAN_CHARGE = "x-ms-cancharge"; - public static final String CAN_OFFER_REPLACE_COMPLETE = "x-ms-can-offer-replace-complete"; - public static final String CAN_THROTTLE = "x-ms-canthrottle"; - public static final String CLIENT_RETRY_ATTEMPT_COUNT = "x-ms-client-retry-attempt-count"; - public static final String COLLECTION_INDEX_TRANSFORMATION_PROGRESS = "x-ms-documentdb-collection-index-transformation-progress"; - public static final String COLLECTION_LAZY_INDEXING_PROGRESS = "x-ms-documentdb-collection-lazy-indexing-progress"; - public static final String COLLECTION_REMOTE_STORAGE_SECURITY_IDENTIFIER = "x-ms-collection-security-identifier"; - public static final String CONTENT_SERIALIZATION_FORMAT = "x-ms-documentdb-content-serialization-format"; - public static final String DISABLE_RNTBD_CHANNEL = "x-ms-disable-rntbd-channel"; - public static final String DISABLE_RU_PER_MINUTE_USAGE = "x-ms-documentdb-disable-ru-per-minute-usage"; - public static final String ENABLE_LOGGING = "x-ms-documentdb-script-enable-logging"; - public static final String ENABLE_LOW_PRECISION_ORDER_BY = "x-ms-documentdb-query-enable-low-precision-order-by"; - public static final String END_EPK = "x-ms-end-epk"; - public static final String END_ID = "x-ms-end-id"; - public static final String ENUMERATION_DIRECTION = "x-ms-enumeration-direction"; - public static final String FILTER_BY_SCHEMA_RESOURCE_ID = "x-ms-documentdb-filterby-schema-rid"; - public static final String FORCE_QUERY_SCAN = "x-ms-documentdb-force-query-scan"; - public static final String GATEWAY_SIGNATURE = "x-ms-gateway-signature"; - public static final String IS_AUTO_SCALE_REQUEST = "x-ms-is-auto-scale"; - public static final String IS_READ_ONLY_SCRIPT = "x-ms-is-readonly-script"; - public static final String LOG_RESULTS = "x-ms-documentdb-script-log-results"; - public static final String MIGRATE_COLLECTION_DIRECTIVE = "x-ms-migratecollection-directive"; - public static final String POPULATE_COLLECTION_THROUGHPUT_INFO = "x-ms-documentdb-populatecollectionthroughputinfo"; - public static final String POPULATE_PARTITION_STATISTICS = "x-ms-documentdb-populatepartitionstatistics"; - public static final String POPULATE_QUERY_METRICS = "x-ms-documentdb-populatequerymetrics"; - public static final String PROFILE_REQUEST = "x-ms-profile-request"; - public static final String READ_FEED_KEY_TYPE = "x-ms-read-key-type"; - public static final String REMAINING_TIME_IN_MS_ON_CLIENT_REQUEST = "x-ms-remaining-time-in-ms-on-client"; - public static final String RESTORE_METADATA_FILTER = "x-ms-restore-metadata-filter"; - public static final String SHARED_OFFER_THROUGHPUT = "x-ms-cosmos-shared-offer-throughput"; - public static final String START_EPK = "x-ms-start-epk"; - public static final String START_ID = "x-ms-start-id"; - public static final String SUPPORT_SPATIAL_LEGACY_COORDINATES = "x-ms-documentdb-supportspatiallegacycoordinates"; - public static final String TRANSPORT_REQUEST_ID = "x-ms-transport-request-id"; - public static final String USE_POLYGONS_SMALLER_THAN_AHEMISPHERE = "x-ms-documentdb-usepolygonssmallerthanahemisphere"; - public static final String API_TYPE = "x-ms-cosmos-apitype"; - public static final String QUERY_METRICS = "x-ms-documentdb-query-metrics"; - - } - - public static class A_IMHeaderValues { - public static final String INCREMENTAL_FEED = "Incremental Feed"; - } - - public static class Versions { - public static final String CURRENT_VERSION = "2018-09-17"; - - // TODO: FIXME we can use maven plugin for generating a version file - // @see https://stackoverflow.com/questions/2469922/generate-a-version-java-file-in-maven - public static final String SDK_VERSION = "2.4.5"; - public static final String SDK_NAME = "cosmosdb-java-sdk"; - } - - public static class StatusCodes { - public static final int NOT_MODIFIED = 304; - // Client error - public static final int MINIMUM_STATUSCODE_AS_ERROR_GATEWAY = 400; - public static final int BADREQUEST = 400; - public static final int UNAUTHORIZED = 401; - public static final int FORBIDDEN = 403; - public static final int NOTFOUND = 404; - public static final int METHOD_NOT_ALLOWED = 405; - public static final int REQUEST_TIMEOUT = 408; - public static final int CONFLICT = 409; - public static final int GONE = 410; - public static final int PRECONDITION_FAILED = 412; - public static final int REQUEST_ENTITY_TOO_LARGE = 413; - public static final int LOCKED = 423; - public static final int TOO_MANY_REQUESTS = 429; - public static final int RETRY_WITH = 449; - - public static final int SERVICE_UNAVAILABLE = 503; - public static final int INTERNAL_SERVER_ERROR = 500; - } - - public static class SubStatusCodes { - // Unknown SubStatus Code - public static final int UNKNOWN = 0; - - // 400: Bad Request substatus - public static final int PARTITION_KEY_MISMATCH = 1001; - public static final int CROSS_PARTITION_QUERY_NOT_SERVABLE = 1004; - - // 410: StatusCodeType_Gone: substatus - public static final int NAME_CACHE_IS_STALE = 1000; - public static final int PARTITION_KEY_RANGE_GONE = 1002; - public static final int COMPLETING_SPLIT = 1007; - public static final int COMPLETING_PARTITION_MIGRATION = 1008; - - // 403: Forbidden substatus - public static final int FORBIDDEN_WRITEFORBIDDEN = 3; - public static final int DATABASE_ACCOUNT_NOTFOUND = 1008; - - // 404: LSN in session token is higher - public static final int READ_SESSION_NOT_AVAILABLE = 1002; - } - - public static class HeaderValues { - public static final String NoCache = "no-cache"; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ISessionToken.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ISessionToken.java deleted file mode 100644 index 08ce7f9c1f7e..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ISessionToken.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import com.microsoft.azure.cosmosdb.DocumentClientException; - -/** - * Models session token. - * - * We make assumption that instances of this interface are immutable (read only after they are constructed), so if you want to change - * this behaviour please review all of its uses and make sure that mutability doesn't break anything. - */ -public interface ISessionToken { - - String PARTITION_KEY_RANGE_SESSION_SEPARATOR = ":"; - - /** - * Returns true if this instance of session token is valid with respect to other session token. - * This is used to decide if the client can accept server's response (based on comparison between client's - * and server's session token) - * - * @param other Session token to validate - * @return true if this instance of session token is valid with respect to other session token; - * false otherwise - */ - boolean isValid(ISessionToken other) throws DocumentClientException; - - /** - * Returns a new instance of session token obtained by merging this session token with - * the given session token other. - * - * Merge is commutative operation, so a.Merge(b).Equals(b.Merge(a)) - * - * @param other Other session token to merge - * @return Instance of merged session token - */ - ISessionToken merge(ISessionToken other) throws DocumentClientException; - - long getLSN(); - - String convertToString(); -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Integers.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Integers.java deleted file mode 100644 index 3d9c3cb6fdcb..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Integers.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import com.microsoft.azure.cosmosdb.rx.internal.Strings; - -public class Integers { - public static int tryParse(String value, int defaultValue) { - if (Strings.isNullOrEmpty(value)) { - return defaultValue; - } - - try { - return Integer.valueOf(value); - } catch (NumberFormatException e) { - return defaultValue; - } - } - - public static Integer tryParse(String value) { - if (Strings.isNullOrEmpty(value)) { - return null; - } - - try { - return Integer.valueOf(value); - } catch (NumberFormatException e) { - return null; - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/InternalServerErrorException.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/InternalServerErrorException.java deleted file mode 100644 index b6a12f08b3c6..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/InternalServerErrorException.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.HttpUtils; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.net.URI; -import java.net.URL; -import java.util.Map; - -/** - * This exception is thrown when DocumentServiceRequest contains x-ms-documentdb-partitionkeyrangeid - * header and such range id doesn't exist. - *

- * No retries should be made in this case, as either split or merge might have happened and query/readfeed - * must take appropriate actions. - */ -public class InternalServerErrorException extends DocumentClientException { - - public InternalServerErrorException() { - this(RMResources.InternalServerError); - } - - public InternalServerErrorException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.INTERNAL_SERVER_ERROR, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public InternalServerErrorException(String message) { - this(message, (Exception) null, (Map) null, (String) null); - } - - - public InternalServerErrorException(String message, Exception innerException) { - this(message, innerException, (HttpResponseHeaders) null, (String) null); - } - - public InternalServerErrorException(Exception innerException) { - this(RMResources.InternalServerError, innerException, (HttpResponseHeaders) null, (String) null); - } - - public InternalServerErrorException(String message, HttpResponseHeaders headers, URI requestUri) { - super(message, null, HttpUtils.asMap(headers), HttpConstants.StatusCodes.INTERNAL_SERVER_ERROR, requestUri != null ? requestUri.toString() : null); - } - - public InternalServerErrorException(String message, HttpResponseHeaders headers, String requestUri) { - super(message, null, HttpUtils.asMap(headers), HttpConstants.StatusCodes.INTERNAL_SERVER_ERROR, requestUri); - } - - public InternalServerErrorException(String message, HttpResponseHeaders headers, URL requestUri) { - super(message, null, HttpUtils.asMap(headers), HttpConstants.StatusCodes.INTERNAL_SERVER_ERROR, requestUri != null ? requestUri.toString() : null); - } - - public InternalServerErrorException(String message, Exception innerException, HttpResponseHeaders headers, URI requestUri) { - super(message, innerException, HttpUtils.asMap(headers), HttpConstants.StatusCodes.INTERNAL_SERVER_ERROR, requestUri != null ? requestUri.toString() : null); - } - - public InternalServerErrorException(String message, Exception innerException, HttpResponseHeaders headers, String requestUri) { - super(message, innerException, HttpUtils.asMap(headers), HttpConstants.StatusCodes.INTERNAL_SERVER_ERROR, requestUri); - } - - public InternalServerErrorException(String message, Exception innerException, Map headers, String requestUri) { - super(message, innerException, headers, HttpConstants.StatusCodes.INTERNAL_SERVER_ERROR, requestUri); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/JavaStreamUtils.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/JavaStreamUtils.java deleted file mode 100644 index bc0c51223603..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/JavaStreamUtils.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import org.apache.commons.lang3.StringUtils; - -import java.util.Collection; -import java.util.Iterator; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -public class JavaStreamUtils { - - private static String safeToString(T t) { - return t != null ? t.toString() : "null"; - } - - public static String toString(Collection collection, String delimiter) { - return collection.stream() - .map( t -> safeToString(t) ) - .collect(Collectors.joining(delimiter)); - } - - -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/LifeCycleUtils.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/LifeCycleUtils.java deleted file mode 100644 index a5bc168b5db8..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/LifeCycleUtils.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class LifeCycleUtils { - private final static Logger logger = LoggerFactory.getLogger(LifeCycleUtils.class); - public static void closeQuietly(AutoCloseable closeable) { - try { - if (closeable != null) { - logger.debug("closing an instance of {}", closeable.getClass().getCanonicalName()); - closeable.close(); - } - } catch (Exception e) { - logger.warn("attempting to close an instance of {} failed", closeable.getClass().getCanonicalName(), e); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Lists.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Lists.java deleted file mode 100644 index d3007dab8312..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Lists.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import java.util.List; - -public class Lists { - - public static V firstOrDefault(List list, V defaultValue) { - return list.isEmpty() ? defaultValue : list.get(0); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Longs.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Longs.java deleted file mode 100644 index 5a8c9398385f..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Longs.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import com.microsoft.azure.cosmosdb.rx.internal.Strings; - -public class Longs { - public static long tryParse(String value, long defaultValue) { - if (Strings.isNullOrEmpty(value)) { - return defaultValue; - } - - try { - return Long.valueOf(value); - } catch (NumberFormatException e) { - return defaultValue; - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/MutableVolatile.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/MutableVolatile.java deleted file mode 100644 index 4b4c9b2338e4..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/MutableVolatile.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -public class MutableVolatile { - - public MutableVolatile(T initValue){ - v = initValue; - } - - public MutableVolatile() {} - public volatile T v; -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/OperationType.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/OperationType.java deleted file mode 100644 index 05b1a484509d..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/OperationType.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -/** - * Operation types in the Azure Cosmos DB database service. - */ -public enum OperationType { - AbortPartitionMigration, - AbortSplit, - AddComputeGatewayRequestCharges, - BatchApply, - BatchReportThroughputUtilization, - CompletePartitionMigration, - CompleteSplit, - Crash, - Create, - Delete, - ExecuteJavaScript, - ForceConfigRefresh, - GetSplitPoint, - Head, - HeadFeed, - MigratePartition, - Pause, - PreCreateValidation, - OfferPreGrowValidation, - OfferUpdateOperation, - PreReplaceValidation, - Query, - Read, - ReadFeed, - Recreate, - Recycle, - Replace, - Resume, - SqlQuery, - Stop, - Throttle, - Update, - Upsert; - - public boolean isWriteOperation() { - return this == Create || - this == Delete || - this == Recreate || - this == ExecuteJavaScript || - this == Replace || - this == Upsert || - this == Update; - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/PathInfo.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/PathInfo.java deleted file mode 100644 index b1884975d5f5..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/PathInfo.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -/** - * Represents a resource path's information in the Azure Cosmos DB database service. - */ -public final class PathInfo { - public boolean isFeed; - public String resourcePath; - public String resourceIdOrFullName; - public boolean isNameBased; - - public PathInfo(boolean isFeed, String resourcePath, String resourceIdOrFullName, boolean isNameBased) { - this.isFeed = isFeed; - this.resourcePath = resourcePath; - this.resourceIdOrFullName = resourceIdOrFullName; - this.isNameBased = isNameBased; - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/PathParser.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/PathParser.java deleted file mode 100644 index c1f54819e453..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/PathParser.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -/** - * Provide functionality to parse resource paths in the Azure Cosmos DB database service. - */ -public final class PathParser { - - private static final char segmentSeparator = '/'; - - public static List getPathParts(String path) { - ArrayList tokens = new ArrayList(); - int currentIndex = 0; - - while (currentIndex < path.length()) { - if (path.charAt(currentIndex) != segmentSeparator) { - throw new IllegalArgumentException(String.format("Invalid path, failed at index %d.", currentIndex)); - } - - if (++currentIndex == path.length()) - break; - - if (path.charAt(currentIndex) == '\"' || path.charAt(currentIndex) == '\'') { - char quote = path.charAt(currentIndex); - int newIndex = ++currentIndex; - while (true) { - newIndex = path.indexOf(quote, newIndex); - if (newIndex == -1) { - throw new IllegalArgumentException(String.format("Invalid path, failed at index %d.", currentIndex)); - } - - if (path.charAt(newIndex - 1) != '\\') { - break; - } - - ++newIndex; - } - - String token = path.substring(currentIndex, newIndex); - tokens.add(token); - currentIndex = newIndex + 1; - } else { - int newIndex = path.indexOf(segmentSeparator, currentIndex); - String token = null; - if (newIndex == -1) { - token = path.substring(currentIndex); - currentIndex = path.length(); - } else { - token = path.substring(currentIndex, newIndex); - currentIndex = newIndex; - } - - token = token.trim(); - tokens.add(token); - } - } - - return tokens; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Paths.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Paths.java deleted file mode 100644 index 25b0af49db4c..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Paths.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -/** - * Used internally. Contains string constants to work with the paths in the Azure Cosmos DB database service. - */ -public class Paths { - static final String ROOT = "/"; - - public static final String DATABASES_PATH_SEGMENT = "dbs"; - public static final String DATABASES_ROOT = ROOT + DATABASES_PATH_SEGMENT; - - public static final String USERS_PATH_SEGMENT = "users"; - public static final String PERMISSIONS_PATH_SEGMENT = "permissions"; - public static final String COLLECTIONS_PATH_SEGMENT = "colls"; - public static final String STORED_PROCEDURES_PATH_SEGMENT = "sprocs"; - public static final String TRIGGERS_PATH_SEGMENT = "triggers"; - public static final String USER_DEFINED_FUNCTIONS_PATH_SEGMENT = "udfs"; - public static final String CONFLICTS_PATH_SEGMENT = "conflicts"; - public static final String DOCUMENTS_PATH_SEGMENT = "docs"; - public static final String ATTACHMENTS_PATH_SEGMENT = "attachments"; - - // /offers - public static final String OFFERS_PATH_SEGMENT = "offers"; - public static final String OFFERS_ROOT = ROOT + OFFERS_PATH_SEGMENT + "/"; - - public static final String ADDRESS_PATH_SEGMENT = "addresses"; - public static final String PARTITIONS_PATH_SEGMENT = "partitions"; - public static final String DATABASE_ACCOUNT_PATH_SEGMENT = "databaseaccount"; - public static final String TOPOLOGY_PATH_SEGMENT = "topology"; - public static final String MEDIA_PATH_SEGMENT = "media"; - public static final String MEDIA_ROOT = ROOT + MEDIA_PATH_SEGMENT; - public static final String SCHEMAS_PATH_SEGMENT = "schemas"; - public static final String PARTITION_KEY_RANGES_PATH_SEGMENT = "pkranges"; - - public static final String USER_DEFINED_TYPES_PATH_SEGMENT = "udts"; - - public static final String RID_RANGE_PATH_SEGMENT = "ridranges"; -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/PathsHelper.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/PathsHelper.java deleted file mode 100644 index f65d3f5c0e6f..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/PathsHelper.java +++ /dev/null @@ -1,884 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import java.util.ArrayList; -import java.util.List; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import com.microsoft.azure.cosmosdb.Attachment; -import com.microsoft.azure.cosmosdb.Conflict; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.Offer; -import com.microsoft.azure.cosmosdb.Permission; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.StoredProcedure; -import com.microsoft.azure.cosmosdb.Trigger; -import com.microsoft.azure.cosmosdb.User; -import com.microsoft.azure.cosmosdb.UserDefinedFunction; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; - -import org.apache.commons.text.StringEscapeUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.Pair; - -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; - -/** - * Used internally to provide utility methods to work with the resource's path in the Azure Cosmos DB database service. - */ -public class PathsHelper { - private final static Logger logger = LoggerFactory.getLogger(PathsHelper.class); - - public static String generatePath(ResourceType resourceType, RxDocumentServiceRequest request, boolean isFeed) { - if (request.getIsNameBased()) { - return PathsHelper.generatePathForNameBased(resourceType, request.getResourceAddress(), isFeed); - } else { - return PathsHelper.generatePath(resourceType, request.getResourceId(), isFeed); - } - } - - public static String generatePathForNameBased(Resource resourceType, String resourceOwnerFullName, String resourceName) { - if (resourceName == null) - return null; - - if (resourceType instanceof Database) { - return Paths.DATABASES_PATH_SEGMENT + "/" + resourceName; - } else if (resourceOwnerFullName == null) { - return null; - } else if (resourceType instanceof DocumentCollection) { - return resourceOwnerFullName + "/" + Paths.COLLECTIONS_PATH_SEGMENT + "/" + resourceName; - } else if (resourceType instanceof StoredProcedure) { - return resourceOwnerFullName + "/" + Paths.STORED_PROCEDURES_PATH_SEGMENT + "/" + resourceName; - } else if (resourceType instanceof UserDefinedFunction) { - return resourceOwnerFullName + "/" + Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT + "/" + resourceName; - } else if (resourceType instanceof Trigger) { - return resourceOwnerFullName + "/" + Paths.TRIGGERS_PATH_SEGMENT + "/" + resourceName; - } else if (resourceType instanceof Conflict) { - return resourceOwnerFullName + "/" + Paths.CONFLICTS_PATH_SEGMENT + "/" + resourceName; - } else if (resourceType instanceof Attachment) { - return resourceOwnerFullName + "/" + Paths.ATTACHMENTS_PATH_SEGMENT + "/" + resourceName; - } else if (resourceType instanceof User) { - return resourceOwnerFullName + "/" + Paths.USERS_PATH_SEGMENT + "/" + resourceName; - } else if (resourceType instanceof Permission) { - return resourceOwnerFullName + "/" + Paths.PERMISSIONS_PATH_SEGMENT + "/" + resourceName; - } else if (resourceType instanceof Document) { - return resourceOwnerFullName + "/" + Paths.DOCUMENTS_PATH_SEGMENT + "/" + resourceName; - } else if (resourceType instanceof Offer) { - return Paths.OFFERS_PATH_SEGMENT + "/" + resourceName; - } else if (resourceType instanceof Resource) { - // just generic Resource type. - return null; - } - - String errorMessage = String.format(RMResources.UnknownResourceType, resourceType.toString()); - assert false : errorMessage; - throw new IllegalArgumentException(errorMessage); - } - - private static String generatePathForNameBased(ResourceType resourceType, String resourceFullName, boolean isFeed) { - if (isFeed && Strings.isNullOrEmpty(resourceFullName) && resourceType != ResourceType.Database) { - String errorMessage = String.format(RMResources.UnexpectedResourceType, resourceType); - throw new IllegalArgumentException(errorMessage); - } - - String resourcePath = null; - if (!isFeed) { - resourcePath = resourceFullName; - } else if (resourceType == ResourceType.Database) { - return Paths.DATABASES_PATH_SEGMENT; - } else if (resourceType == ResourceType.DocumentCollection) { - resourcePath = resourceFullName + "/" + Paths.COLLECTIONS_PATH_SEGMENT; - } else if (resourceType == ResourceType.StoredProcedure) { - resourcePath = resourceFullName + "/" + Paths.STORED_PROCEDURES_PATH_SEGMENT; - } else if (resourceType == ResourceType.UserDefinedFunction) { - resourcePath = resourceFullName + "/" + Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT; - } else if (resourceType == ResourceType.Trigger) { - resourcePath = resourceFullName + "/" + Paths.TRIGGERS_PATH_SEGMENT; - } else if (resourceType == ResourceType.Conflict) { - resourcePath = resourceFullName + "/" + Paths.CONFLICTS_PATH_SEGMENT; - } else if (resourceType == ResourceType.Attachment) { - resourcePath = resourceFullName + "/" + Paths.ATTACHMENTS_PATH_SEGMENT; - } else if (resourceType == ResourceType.User) { - resourcePath = resourceFullName + "/" + Paths.USERS_PATH_SEGMENT; - } else if (resourceType == ResourceType.Permission) { - resourcePath = resourceFullName + "/" + Paths.PERMISSIONS_PATH_SEGMENT; - } else if (resourceType == ResourceType.Document) { - resourcePath = resourceFullName + "/" + Paths.DOCUMENTS_PATH_SEGMENT; - } else if (resourceType == ResourceType.Offer) { - return resourceFullName + "/" + Paths.OFFERS_PATH_SEGMENT; - } else if (resourceType == ResourceType.PartitionKeyRange) { - return resourceFullName + "/" + Paths.PARTITION_KEY_RANGES_PATH_SEGMENT; - } else if (resourceType == ResourceType.Schema) { - resourcePath = resourceFullName + "/" + Paths.SCHEMAS_PATH_SEGMENT; - } else { - String errorMessage = String.format(RMResources.UnknownResourceType, resourceType.toString()); - assert false : errorMessage; - throw new IllegalArgumentException(errorMessage); - } - - return resourcePath; - } - - public static String generatePath(ResourceType resourceType, String ownerOrResourceId, boolean isFeed) { - if (isFeed && (ownerOrResourceId == null || ownerOrResourceId.isEmpty()) && - resourceType != ResourceType.Database && - resourceType != ResourceType.Offer && - resourceType != ResourceType.MasterPartition && - resourceType != ResourceType.ServerPartition && - resourceType != ResourceType.DatabaseAccount && - resourceType != ResourceType.Topology) { - throw new IllegalStateException("Invalid resource type"); - } - - if(ownerOrResourceId == null) { - ownerOrResourceId = StringUtils.EMPTY; - } - - if (isFeed && resourceType == ResourceType.Database) { - return Paths.DATABASES_PATH_SEGMENT; - } else if (resourceType == ResourceType.Database) { - return Paths.DATABASES_PATH_SEGMENT + "/" + ownerOrResourceId; - } else if (isFeed && resourceType == ResourceType.DocumentCollection) { - ResourceId documentCollectionId = ResourceId.parse(ownerOrResourceId); - - return Paths.DATABASES_PATH_SEGMENT + "/" + documentCollectionId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT; - } else if (resourceType == ResourceType.DocumentCollection) { - ResourceId documentCollectionId = ResourceId.parse(ownerOrResourceId); - - return Paths.DATABASES_PATH_SEGMENT + "/" + documentCollectionId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + documentCollectionId.getDocumentCollectionId().toString(); - } else if (isFeed && resourceType == ResourceType.Offer) { - return Paths.OFFERS_PATH_SEGMENT; - } else if (resourceType == ResourceType.Offer) { - return Paths.OFFERS_PATH_SEGMENT + "/" + ownerOrResourceId; - } else if (isFeed && resourceType == ResourceType.StoredProcedure) { - ResourceId documentCollectionId = ResourceId.parse(ownerOrResourceId); - - return - Paths.DATABASES_PATH_SEGMENT + "/" + documentCollectionId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + documentCollectionId.getDocumentCollectionId().toString() + "/" + - Paths.STORED_PROCEDURES_PATH_SEGMENT; - } else if (resourceType == ResourceType.StoredProcedure) { - ResourceId storedProcedureId = ResourceId.parse(ownerOrResourceId); - - return Paths.DATABASES_PATH_SEGMENT + "/" + storedProcedureId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + storedProcedureId.getDocumentCollectionId().toString() + "/" + - Paths.STORED_PROCEDURES_PATH_SEGMENT + "/" + storedProcedureId.getStoredProcedureId().toString(); - } else if (isFeed && resourceType == ResourceType.UserDefinedFunction) { - ResourceId documentCollectionId = ResourceId.parse(ownerOrResourceId); - - return - Paths.DATABASES_PATH_SEGMENT + "/" + documentCollectionId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + documentCollectionId.getDocumentCollectionId().toString() + "/" + - Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT; - } else if (resourceType == ResourceType.UserDefinedFunction) { - ResourceId functionId = ResourceId.parse(ownerOrResourceId); - - return Paths.DATABASES_PATH_SEGMENT + "/" + functionId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + functionId.getDocumentCollectionId().toString() + "/" + - Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT + "/" + functionId.getUserDefinedFunctionId().toString(); - } else if (isFeed && resourceType == ResourceType.Trigger) { - ResourceId documentCollectionId = ResourceId.parse(ownerOrResourceId); - - return - Paths.DATABASES_PATH_SEGMENT + "/" + documentCollectionId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + documentCollectionId.getDocumentCollectionId().toString() + "/" + - Paths.TRIGGERS_PATH_SEGMENT; - } else if (resourceType == ResourceType.Trigger) { - ResourceId triggerId = ResourceId.parse(ownerOrResourceId); - - return Paths.DATABASES_PATH_SEGMENT + "/" + triggerId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + triggerId.getDocumentCollectionId().toString() + "/" + - Paths.TRIGGERS_PATH_SEGMENT + "/" + triggerId.getTriggerId().toString(); - } else if (isFeed && resourceType == ResourceType.Conflict) { - ResourceId documentCollectionId = ResourceId.parse(ownerOrResourceId); - - return - Paths.DATABASES_PATH_SEGMENT + "/" + documentCollectionId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + documentCollectionId.getDocumentCollectionId().toString() + "/" + - Paths.CONFLICTS_PATH_SEGMENT; - } else if (resourceType == ResourceType.Conflict) { - ResourceId conflictId = ResourceId.parse(ownerOrResourceId); - - return Paths.DATABASES_PATH_SEGMENT + "/" + conflictId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + conflictId.getDocumentCollectionId().toString() + "/" + - Paths.CONFLICTS_PATH_SEGMENT + "/" + conflictId.getConflictId().toString(); - } else if (isFeed && resourceType == ResourceType.PartitionKeyRange) { - ResourceId documentCollectionId = ResourceId.parse(ownerOrResourceId); - - return Paths.DATABASES_PATH_SEGMENT + "/" + documentCollectionId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + - documentCollectionId.getDocumentCollectionId().toString() + "/" + - Paths.PARTITION_KEY_RANGES_PATH_SEGMENT; - } else if (resourceType == ResourceType.PartitionKeyRange) { - ResourceId partitionKeyRangeId = ResourceId.parse(ownerOrResourceId); - - return Paths.DATABASES_PATH_SEGMENT + "/" + partitionKeyRangeId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + partitionKeyRangeId.getDocumentCollectionId().toString() + "/" + - Paths.PARTITION_KEY_RANGES_PATH_SEGMENT + "/" + partitionKeyRangeId.getPartitionKeyRangeId().toString(); - } else if (isFeed && resourceType == ResourceType.Attachment) { - ResourceId documentCollectionId = ResourceId.parse(ownerOrResourceId); - - return - Paths.DATABASES_PATH_SEGMENT + "/" + documentCollectionId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + documentCollectionId.getDocumentCollectionId().toString() + "/" + - Paths.DOCUMENTS_PATH_SEGMENT + "/" + documentCollectionId.getDocumentId().toString() + "/" + - Paths.ATTACHMENTS_PATH_SEGMENT; - } else if (resourceType == ResourceType.Attachment) { - ResourceId attachmentId = ResourceId.parse(ownerOrResourceId); - - return Paths.DATABASES_PATH_SEGMENT + "/" + attachmentId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + attachmentId.getDocumentCollectionId().toString() + "/" + - Paths.DOCUMENTS_PATH_SEGMENT + "/" + attachmentId.getDocumentId().toString() + "/" + - Paths.ATTACHMENTS_PATH_SEGMENT + "/" + attachmentId.getAttachmentId().toString(); - } else if (isFeed && resourceType == ResourceType.User) { - return - Paths.DATABASES_PATH_SEGMENT + "/" + ownerOrResourceId + "/" + - Paths.USERS_PATH_SEGMENT; - } else if (resourceType == ResourceType.User) { - ResourceId userId = ResourceId.parse(ownerOrResourceId); - - return Paths.DATABASES_PATH_SEGMENT + "/" + userId.getDatabaseId().toString() + "/" + - Paths.USERS_PATH_SEGMENT + "/" + userId.getUserId().toString(); - } else if (isFeed && resourceType == ResourceType.Permission) { - ResourceId userId = ResourceId.parse(ownerOrResourceId); - - return - Paths.DATABASES_PATH_SEGMENT + "/" + userId.getDatabaseId().toString() + "/" + - Paths.USERS_PATH_SEGMENT + "/" + userId.getUserId().toString() + "/" + - Paths.PERMISSIONS_PATH_SEGMENT; - } else if (resourceType == ResourceType.Permission) { - ResourceId permissionId = ResourceId.parse(ownerOrResourceId); - - return Paths.DATABASES_PATH_SEGMENT + "/" + permissionId.getDatabaseId().toString() + "/" + - Paths.USERS_PATH_SEGMENT + "/" + permissionId.getUserId().toString() + "/" + - Paths.PERMISSIONS_PATH_SEGMENT + "/" + permissionId.getPermissionId().toString(); - } else if (isFeed && resourceType == ResourceType.Document) { - ResourceId documentCollectionId = ResourceId.parse(ownerOrResourceId); - - return - Paths.DATABASES_PATH_SEGMENT + "/" + documentCollectionId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + documentCollectionId.getDocumentCollectionId().toString() + "/" + - Paths.DOCUMENTS_PATH_SEGMENT; - } else if (resourceType == ResourceType.Document) { - ResourceId documentId = ResourceId.parse(ownerOrResourceId); - - return Paths.DATABASES_PATH_SEGMENT + "/" + documentId.getDatabaseId().toString() + "/" + - Paths.COLLECTIONS_PATH_SEGMENT + "/" + documentId.getDocumentCollectionId().toString() + "/" + - Paths.DOCUMENTS_PATH_SEGMENT + "/" + documentId.getDocumentId().toString(); - } else if (isFeed && resourceType == ResourceType.MasterPartition) { - return Paths.PARTITIONS_PATH_SEGMENT; - } else if (resourceType == ResourceType.MasterPartition) { - return Paths.PARTITIONS_PATH_SEGMENT + "/" + ownerOrResourceId; - } else if (isFeed && resourceType == ResourceType.ServerPartition) { - return Paths.PARTITIONS_PATH_SEGMENT; - } else if (resourceType == ResourceType.ServerPartition) { - return Paths.PARTITIONS_PATH_SEGMENT + "/" + ownerOrResourceId; - } else if (isFeed && resourceType == ResourceType.Topology) { - return Paths.TOPOLOGY_PATH_SEGMENT; - } else if (resourceType == ResourceType.Topology) { - return Paths.TOPOLOGY_PATH_SEGMENT + "/" + ownerOrResourceId; - } else if (isFeed && resourceType == ResourceType.DatabaseAccount) { - return Paths.DATABASE_ACCOUNT_PATH_SEGMENT; - } else if (resourceType == ResourceType.DatabaseAccount) { - return Paths.DATABASE_ACCOUNT_PATH_SEGMENT + "/" + ownerOrResourceId; - } - - String errorMessage = "invalid resource type"; - throw new IllegalStateException(errorMessage); - } - - public static PathInfo parsePathSegments(String resourceUrl) { - String[] segments = StringUtils.strip(resourceUrl, "/").split("/"); - if (segments == null || segments.length < 1) { - return null; - } - - int uriSegmentsCount = segments.length; - String segmentOne = StringUtils.strip(segments[uriSegmentsCount - 1], "/"); - String segmentTwo = (uriSegmentsCount >= 2) ? StringUtils.strip(segments[uriSegmentsCount - 2], "/") - : StringUtils.EMPTY; - - // handle name based operation - if (uriSegmentsCount >= 2) { - // parse the databaseId, if failed, it is name based routing - // mediaId is special, we will treat it always as id based. - if (Paths.MEDIA_PATH_SEGMENT.compareTo(segments[0]) != 0 - && Paths.OFFERS_PATH_SEGMENT.compareTo(segments[0]) != 0 - && Paths.PARTITIONS_PATH_SEGMENT.compareTo(segments[0]) != 0 - && Paths.DATABASE_ACCOUNT_PATH_SEGMENT.compareTo(segments[0]) != 0) { - Pair result = ResourceId.tryParse(segments[1]); - if (!result.getLeft() || !result.getRight().isDatabaseId()) { - return parseNameSegments(resourceUrl, segments); - } - } - - } - - // Feed paths have odd number of segments - if ((uriSegmentsCount % 2 != 0) && isResourceType(segmentOne)) { - return new PathInfo(true, segmentOne, - segmentOne.compareToIgnoreCase(Paths.DATABASES_PATH_SEGMENT) != 0 ? segmentTwo : StringUtils.EMPTY, - false); - } else if (isResourceType(segmentTwo)) { - return new PathInfo(false, segmentTwo, segmentOne, false); - } - - return null; - } - - /** - * Method which will return boolean based on whether it is able to parse the - * path and name segment from resource url , and fill info in PathInfo object - * @param resourceUrl Complete ResourceLink - * @param pathInfo Path info object which will hold information - * @param clientVersion The Client version - * @return - */ - public static boolean tryParsePathSegments(String resourceUrl, PathInfo pathInfo, String clientVersion) { - pathInfo.resourcePath = StringUtils.EMPTY; - pathInfo.resourceIdOrFullName = StringUtils.EMPTY; - pathInfo.isFeed = false; - pathInfo.isNameBased = false; - if (StringUtils.isEmpty(resourceUrl)) { - return false; - } - String trimmedStr = StringUtils.strip(resourceUrl, Constants.Properties.PATH_SEPARATOR); - String[] segments = StringUtils.split(trimmedStr, Constants.Properties.PATH_SEPARATOR); - if (segments == null || segments.length < 1) { - return false; - } - int uriSegmentsCount = segments.length; - String segmentOne = segments[uriSegmentsCount - 1]; - String segmentTwo = (uriSegmentsCount >= 2) ? segments[uriSegmentsCount - 2] : StringUtils.EMPTY; - - // handle name based operation - if (uriSegmentsCount >= 2) { - // parse the databaseId, if failed, it is name based routing - // mediaId is special, we will treat it always as id based. - if (Paths.MEDIA_PATH_SEGMENT.compareTo(segments[0]) != 0 - && Paths.OFFERS_PATH_SEGMENT.compareTo(segments[0]) != 0 - && Paths.PARTITIONS_PATH_SEGMENT.compareTo(segments[0]) != 0 - && Paths.DATABASE_ACCOUNT_PATH_SEGMENT.compareTo(segments[0]) != 0 - && Paths.TOPOLOGY_PATH_SEGMENT.compareTo(segments[0]) != 0 - && Paths.RID_RANGE_PATH_SEGMENT.compareTo(segments[0]) != 0) { - Pair result = ResourceId.tryParse(segments[1]); - if (!result.getLeft() || !result.getRight().isDatabaseId()) { - pathInfo.isNameBased = true; - return tryParseNameSegments(resourceUrl, segments, pathInfo); - } - } - } - // Feed paths have odd number of segments - if ((uriSegmentsCount % 2 != 0) && PathsHelper.isResourceType(segmentOne)) { - pathInfo.isFeed = true; - pathInfo.resourcePath = segmentOne; - // The URL for dbs may contain the management endpoint as the segmentTwo which - // should not be used as resourceId - if (!segmentOne.equalsIgnoreCase(Paths.DATABASES_PATH_SEGMENT)) { - pathInfo.resourceIdOrFullName = segmentTwo; - } - } else if (PathsHelper.isResourceType(segmentTwo)) { - pathInfo.isFeed = false; - pathInfo.resourcePath = segmentTwo; - pathInfo.resourceIdOrFullName = segmentOne; - // Media ID is not supposed to be used for any ID verification. However, if the - // old client makes a call for media ID - // we still need to support it. - // For new clients, parse to return the attachment id. For old clients do not - // modify. - if (!StringUtils.isEmpty(clientVersion) - && pathInfo.resourcePath.equalsIgnoreCase(Paths.MEDIA_PATH_SEGMENT)) { - String attachmentId = null; - byte storeIndex = 0; - // MEDIA Id parsing code will come here , supported MediaIdHelper file missing in java sdk(Sync and Async both) - //Below code from .net - // if (!MediaIdHelper.TryParseMediaId(resourceIdOrFullName, out attachmentId, out storeIndex)) - // { - // return false; - //} - //resourceIdOrFullName = attachmentId; - } - } else { - return false; - } - - return true; - - } - - /** - * Method which will return boolean based on whether it is able to parse the - * name segment from resource url , and fill info in PathInfo object - * @param resourceUrl Complete ResourceLink - * @param segments - * @param pathInfo Path info object which will hold information - * @return - */ - private static boolean tryParseNameSegments(String resourceUrl, String[] segments, PathInfo pathInfo) { - pathInfo.isFeed = false; - pathInfo.resourceIdOrFullName = ""; - pathInfo.resourcePath = ""; - if (segments == null || segments.length < 1) { - return false; - } - if (segments.length % 2 == 0) { - // even number, assume it is individual resource - if (isResourceType(segments[segments.length - 2])) { - pathInfo.resourcePath = segments[segments.length - 2]; - pathInfo.resourceIdOrFullName = StringEscapeUtils.unescapeJava(StringUtils.removeEnd( - StringUtils.removeStart(resourceUrl, Paths.ROOT), Paths.ROOT)); - return true; - } - } else { - // odd number, assume it is feed request - if (isResourceType(segments[segments.length - 1])) { - pathInfo.isFeed = true; - pathInfo.resourcePath = segments[segments.length - 1]; - String resourceIdOrFullName = resourceUrl.substring(0, StringUtils.removeEnd(resourceUrl,Paths.ROOT).lastIndexOf(Paths.ROOT)); - pathInfo.resourceIdOrFullName = StringEscapeUtils.unescapeJava(StringUtils.removeEnd( - StringUtils.removeStart(resourceIdOrFullName, Paths.ROOT), Paths.ROOT)); - return true; - } - } - return false; - } - - public static PathInfo parseNameSegments(String resourceUrl, String[] segments) { - if (segments == null || segments.length < 1) { - return null; - } - - if (segments.length % 2 == 0) { - // even number, assume it is individual resource - if (isResourceType(segments[segments.length - 2])) { - return new PathInfo(false, segments[segments.length - 2], - StringEscapeUtils.unescapeJava(StringUtils.strip(resourceUrl, Paths.ROOT)), true); - } - } else { - // odd number, assume it is feed request - if (isResourceType(segments[segments.length - 1])) { - return new PathInfo(true, segments[segments.length - 1], - StringEscapeUtils.unescapeJava(StringUtils.strip( - resourceUrl.substring(0, - StringUtils.removeEnd(resourceUrl, Paths.ROOT).lastIndexOf(Paths.ROOT)), - Paths.ROOT)), - true); - } - } - - return null; - } - - private static boolean isResourceType(String resourcePathSegment) { - if (StringUtils.isEmpty(resourcePathSegment)) { - return false; - } - - switch (resourcePathSegment.toLowerCase()) { - case Paths.ATTACHMENTS_PATH_SEGMENT: - case Paths.COLLECTIONS_PATH_SEGMENT: - case Paths.DATABASES_PATH_SEGMENT: - case Paths.PERMISSIONS_PATH_SEGMENT: - case Paths.USERS_PATH_SEGMENT: - case Paths.DOCUMENTS_PATH_SEGMENT: - case Paths.STORED_PROCEDURES_PATH_SEGMENT: - case Paths.TRIGGERS_PATH_SEGMENT: - case Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT: - case Paths.CONFLICTS_PATH_SEGMENT: - case Paths.MEDIA_PATH_SEGMENT: - case Paths.OFFERS_PATH_SEGMENT: - case Paths.PARTITIONS_PATH_SEGMENT: - case Paths.DATABASE_ACCOUNT_PATH_SEGMENT: - case Paths.TOPOLOGY_PATH_SEGMENT: - case Paths.PARTITION_KEY_RANGES_PATH_SEGMENT: - case Paths.SCHEMAS_PATH_SEGMENT: - return true; - default: - return false; - } - } - - public static String generatePathForNameBased(ResourceType resourceType, String resourceOwnerFullName, String resourceName) { - switch (resourceType) { - case Database: - return Paths.DATABASES_PATH_SEGMENT + "/" + resourceName; - case DocumentCollection: - return resourceOwnerFullName + "/" + Paths.COLLECTIONS_PATH_SEGMENT + "/" + resourceName; - case StoredProcedure: - return resourceOwnerFullName + "/" + Paths.STORED_PROCEDURES_PATH_SEGMENT + "/" + resourceName; - case UserDefinedFunction: - return resourceOwnerFullName + "/" + Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT + "/" + resourceName; - case Trigger: - return resourceOwnerFullName + "/" + Paths.TRIGGERS_PATH_SEGMENT + "/" + resourceName; - case Attachment: - return resourceOwnerFullName + "/" + Paths.ATTACHMENTS_PATH_SEGMENT + "/" + resourceName; - case Conflict: - return resourceOwnerFullName + "/" + Paths.CONFLICTS_PATH_SEGMENT + "/" + resourceName; - case Document: - return resourceOwnerFullName + "/" + Paths.DOCUMENTS_PATH_SEGMENT + "/" + resourceName; - case Offer: - return resourceOwnerFullName + "/" + Paths.OFFERS_PATH_SEGMENT + "/" + resourceName; - case Permission: - return resourceOwnerFullName + "/" + Paths.PERMISSIONS_PATH_SEGMENT + "/" + resourceName; - case User: - return resourceOwnerFullName + "/" + Paths.USERS_PATH_SEGMENT + "/" + resourceName; - case PartitionKeyRange: - return resourceOwnerFullName + "/" + Paths.PARTITION_KEY_RANGES_PATH_SEGMENT + "/" + resourceName; - default: - return null; - } - } - - public static String getCollectionPath(String resourceFullName) { - if (resourceFullName != null) { - String trimmedResourceFullName = Utils.trimBeginningAndEndingSlashes(resourceFullName); - int index = indexOfNth(trimmedResourceFullName, '/', 4); - if (index > 0) - return trimmedResourceFullName.substring(0, index); - } - - return resourceFullName; - } - - public static String getDatabasePath(String resourceFullName) { - if (resourceFullName != null) { - int index = indexOfNth(resourceFullName, '/', 2); - if (index > 0) - return resourceFullName.substring(0, index); - } - - return resourceFullName; - } - - public static String getParentByIndex(String resourceFullName, int segmentIndex) { - int index = indexOfNth(resourceFullName, '/', segmentIndex); - if (index > 0) - return resourceFullName.substring(0, index); - else { - index = indexOfNth(resourceFullName, '/', segmentIndex - 1); - if (index > 0) - return resourceFullName; - else - return null; - } - } - public static boolean isNameBased(String resourceIdOrFullName) { - // quick way to tell whether it is resourceId nor not, non conclusively. - if (resourceIdOrFullName != null && !resourceIdOrFullName.isEmpty() - && resourceIdOrFullName.length() > 4 && resourceIdOrFullName.charAt(3) == '/') { - return true; - } - return false; - } - - private static int indexOfNth(String str, char value, int nthOccurance) { - int remaining = nthOccurance; - char[] characters = str.toCharArray(); - for (int i = 0; i < characters.length; i++) { - if (characters[i] == value) { - remaining--; - if (remaining == 0) { - return i; - } - } - } - return -1; - } - - public static ResourceType getResourcePathSegment(String resourcePathSegment) throws BadRequestException { - if (StringUtils.isEmpty(resourcePathSegment)) { - String message = String.format(RMResources.StringArgumentNullOrEmpty, "resourcePathSegment"); - throw new BadRequestException(message); - } - - switch (resourcePathSegment) { - case Paths.ATTACHMENTS_PATH_SEGMENT: - return ResourceType.Attachment; - - case Paths.COLLECTIONS_PATH_SEGMENT: - return ResourceType.DocumentCollection; - - case Paths.DATABASES_PATH_SEGMENT: - return ResourceType.Database; - - case Paths.PERMISSIONS_PATH_SEGMENT: - return ResourceType.Permission; - - case Paths.USERS_PATH_SEGMENT: - return ResourceType.User; - - case Paths.DOCUMENTS_PATH_SEGMENT: - return ResourceType.Document; - - case Paths.STORED_PROCEDURES_PATH_SEGMENT: - return ResourceType.StoredProcedure; - - case Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT: - return ResourceType.UserDefinedFunction; - - case Paths.TRIGGERS_PATH_SEGMENT: - return ResourceType.Trigger; - - case Paths.CONFLICTS_PATH_SEGMENT: - return ResourceType.Conflict; - - case Paths.OFFERS_PATH_SEGMENT: - return ResourceType.Offer; - - case Paths.SCHEMAS_PATH_SEGMENT: - return ResourceType.Schema; - } - - String errorMessage = String.format(RMResources.UnknownResourceType, resourcePathSegment); - throw new BadRequestException(errorMessage); - } - - public static String getResourcePath(ResourceType resourceType) throws BadRequestException { - switch (resourceType) { - case Database: - return Paths.DATABASES_PATH_SEGMENT; - - case DocumentCollection: - return Paths.COLLECTIONS_PATH_SEGMENT; - - case Document: - return Paths.DOCUMENTS_PATH_SEGMENT; - - case StoredProcedure: - return Paths.STORED_PROCEDURES_PATH_SEGMENT; - - case UserDefinedFunction: - return Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT; - - case Trigger: - return Paths.TRIGGERS_PATH_SEGMENT; - - case Conflict: - return Paths.CONFLICTS_PATH_SEGMENT; - - case Attachment: - return Paths.ATTACHMENTS_PATH_SEGMENT; - - case User: - return Paths.USERS_PATH_SEGMENT; - - case Permission: - return Paths.PERMISSIONS_PATH_SEGMENT; - - case Offer: - return Paths.OFFERS_PATH_SEGMENT; - - case MasterPartition: - case ServerPartition: - return Paths.PARTITIONS_PATH_SEGMENT; - - case PartitionKeyRange: - return Paths.PARTITION_KEY_RANGES_PATH_SEGMENT; - - case Media: - return Paths.MEDIA_ROOT; - - case Schema: - return Paths.SCHEMAS_PATH_SEGMENT; - - - case DatabaseAccount: - case Topology: - - return Paths.ROOT; - - default: - String errorMessage = String.format(RMResources.UnknownResourceType, resourceType.toString()); - throw new BadRequestException(errorMessage); - } - } - - public static boolean validateResourceFullName(ResourceType resourceType, String resourceFullName) { - String[] segments = StringUtils.split(resourceFullName, '/'); - String[] resourcePathArray = getResourcePathArray(resourceType); - if (resourcePathArray == null) { - return false; - } - - if (segments.length != resourcePathArray.length * 2) { - return false; - } - for (int i = 0; i < resourcePathArray.length; i++) { - if(resourcePathArray[i].compareTo(segments[2 * i]) != 0) { - return false; - } - } - return true; - } - - private static String[] getResourcePathArray(ResourceType resourceType) { - List segments = new ArrayList(); - segments.add(Paths.DATABASES_PATH_SEGMENT); - - if (resourceType == ResourceType.Permission || - resourceType == ResourceType.User) { - segments.add(Paths.USERS_PATH_SEGMENT); - if (resourceType == ResourceType.Permission) { - segments.add(Paths.PERMISSIONS_PATH_SEGMENT); - } - } else if (resourceType == ResourceType.DocumentCollection || - resourceType == ResourceType.StoredProcedure || - resourceType == ResourceType.UserDefinedFunction || - resourceType == ResourceType.Trigger || - resourceType == ResourceType.Conflict || - resourceType == ResourceType.Attachment || - resourceType == ResourceType.Document || - resourceType == ResourceType.PartitionKeyRange || - resourceType == ResourceType.Schema) { - segments.add(Paths.COLLECTIONS_PATH_SEGMENT); - if (resourceType == ResourceType.StoredProcedure) { - segments.add(Paths.STORED_PROCEDURES_PATH_SEGMENT); - } else if(resourceType == ResourceType.UserDefinedFunction) { - segments.add(Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT); - } else if(resourceType == ResourceType.Trigger) { - segments.add(Paths.TRIGGERS_PATH_SEGMENT); - } else if (resourceType == ResourceType.Conflict) { - segments.add(Paths.CONFLICTS_PATH_SEGMENT); - } else if (resourceType == ResourceType.Schema) { - segments.add(Paths.SCHEMAS_PATH_SEGMENT); - } else if(resourceType == ResourceType.Document || - resourceType == ResourceType.Attachment) { - segments.add(Paths.DOCUMENTS_PATH_SEGMENT); - if (resourceType == ResourceType.Attachment) { - segments.add(Paths.ATTACHMENTS_PATH_SEGMENT); - } - } else if(resourceType == ResourceType.PartitionKeyRange) { - segments.add(Paths.PARTITION_KEY_RANGES_PATH_SEGMENT); - } - } else if (resourceType != ResourceType.Database) { - return null; - } - return segments.stream().toArray(String[]::new); - } - - public static boolean validateResourceId(ResourceType resourceType, String resourceId) { - if (resourceType == ResourceType.Conflict) { - return PathsHelper.validateConflictId(resourceId); - } else if (resourceType == ResourceType.Database) { - return PathsHelper.validateDatabaseId(resourceId); - } else if (resourceType == ResourceType.DocumentCollection) { - return PathsHelper.validateDocumentCollectionId(resourceId); - } else if (resourceType == ResourceType.Document) { - return PathsHelper.validateDocumentId(resourceId); - } else if (resourceType == ResourceType.Permission) { - return PathsHelper.validatePermissionId(resourceId); - } else if (resourceType == ResourceType.StoredProcedure) { - return PathsHelper.validateStoredProcedureId(resourceId); - } else if (resourceType == ResourceType.Trigger) { - return PathsHelper.validateTriggerId(resourceId); - } else if (resourceType == ResourceType.UserDefinedFunction) { - return PathsHelper.validateUserDefinedFunctionId(resourceId); - } else if (resourceType == ResourceType.User) { - return PathsHelper.validateUserId(resourceId); - } else if (resourceType == ResourceType.Attachment) { - return PathsHelper.validateAttachmentId(resourceId); - } else { - logger.error(String.format("ValidateResourceId not implemented for Type %s in ResourceRequestHandler", resourceType.toString())); - return false; - } - } - - public static boolean validateDatabaseId(String resourceIdString) { - Pair pair = ResourceId.tryParse(resourceIdString); - return pair.getLeft() && pair.getRight().getDatabase() != 0; - } - - public static boolean validateDocumentCollectionId(String resourceIdString) { - Pair pair = ResourceId.tryParse(resourceIdString); - return pair.getLeft() && pair.getRight().getDocumentCollection() != 0; - } - - public static boolean validateDocumentId(String resourceIdString) { - Pair pair = ResourceId.tryParse(resourceIdString); - return pair.getLeft() && pair.getRight().getDocument() != 0; - } - - public static boolean validateConflictId(String resourceIdString) { - Pair pair = ResourceId.tryParse(resourceIdString); - return pair.getLeft() && pair.getRight().getConflict() != 0; - } - - public static boolean validateAttachmentId(String resourceIdString) { - Pair pair = ResourceId.tryParse(resourceIdString); - return pair.getLeft() && pair.getRight().getAttachment() != 0; - } - - public static boolean validatePermissionId(String resourceIdString) { - Pair pair = ResourceId.tryParse(resourceIdString); - return pair.getLeft() && pair.getRight().getPermission() != 0; - } - - public static boolean validateStoredProcedureId(String resourceIdString) { - Pair pair = ResourceId.tryParse(resourceIdString); - return pair.getLeft() && pair.getRight().getStoredProcedure() != 0; - } - - public static boolean validateTriggerId(String resourceIdString) { - Pair pair = ResourceId.tryParse(resourceIdString); - return pair.getLeft() && pair.getRight().getTrigger() != 0; - } - - public static boolean validateUserDefinedFunctionId(String resourceIdString) { - Pair pair = ResourceId.tryParse(resourceIdString); - return pair.getLeft() && pair.getRight().getUserDefinedFunction() != 0; - } - - public static boolean validateUserId(String resourceIdString) { - Pair pair = ResourceId.tryParse(resourceIdString); - return pair.getLeft() && pair.getRight().getUser() != 0; - } - - - public static boolean isPublicResource(Resource resourceType) { - if (resourceType instanceof Database || - resourceType instanceof DocumentCollection || - resourceType instanceof StoredProcedure || - resourceType instanceof UserDefinedFunction || - resourceType instanceof Trigger || - resourceType instanceof Conflict || - resourceType instanceof Attachment || - resourceType instanceof User || - resourceType instanceof Permission || - resourceType instanceof Document || - resourceType instanceof Offer - ) { - return true; - } else { - return false; - } - } - -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Quadruple.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Quadruple.java deleted file mode 100644 index 624c12b5148e..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Quadruple.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -/** - * Represents class with four different generic objects. - */ -public class Quadruple { - - private final A val0; - private final B val1; - private final C val2; - private final D val3; - - public static Quadruple with(final A value0, final B value1, final C value2, - final D value3) { - return new Quadruple(value0, value1, value2, value3); - } - - public Quadruple(final A value0, final B value1, final C value2, final D value3) { - this.val0 = value0; - this.val1 = value1; - this.val2 = value2; - this.val3 = value3; - } - - public A getValue0() { - return this.val0; - } - - public B getValue1() { - return this.val1; - } - - public C getValue2() { - return this.val2; - } - - public D getValue3() { - return this.val3; - } - -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/QueryCompatibilityMode.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/QueryCompatibilityMode.java deleted file mode 100644 index 77dba9f5c531..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/QueryCompatibilityMode.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -/** - * A client query compatibility mode when making query request in the Azure Cosmos DB database service. Can be used - * to force a specific query request format. - */ -public enum QueryCompatibilityMode { - Default, - Query, - SqlQuery -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/RequestChargeTracker.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/RequestChargeTracker.java deleted file mode 100644 index 0cb8d3468835..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/RequestChargeTracker.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import java.util.concurrent.atomic.AtomicLong; - -/** - * Tracks requests charge in the Azure Cosmos DB database service. - */ -public final class RequestChargeTracker { - private final static int NUMBER_OF_DECIMAL_POINT_TO_RESERVE_FACTOR = 1000; - private final AtomicLong totalRUs = new AtomicLong(); - - public double getTotalRequestCharge() { - return ((double) this.totalRUs.get()) / NUMBER_OF_DECIMAL_POINT_TO_RESERVE_FACTOR; - } - - public void addCharge(double ruUsage) { - this.totalRUs.addAndGet((long) (ruUsage * NUMBER_OF_DECIMAL_POINT_TO_RESERVE_FACTOR)); - } - - public double getAndResetCharge() { - return (double) this.totalRUs.getAndSet(0) / NUMBER_OF_DECIMAL_POINT_TO_RESERVE_FACTOR; - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ResourceId.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ResourceId.java deleted file mode 100644 index 78bd93de8946..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ResourceId.java +++ /dev/null @@ -1,540 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.Pair; - -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.nio.charset.StandardCharsets; -import java.util.Arrays; - -/** - * Used internally to represents a Resource ID in the Azure Cosmos DB database service. - */ -public class ResourceId { - static final short Length = 20; - static final short OFFER_ID_LENGTH = 3; - static final short MAX_PATH_FRAGMENT = 8; - - private int database; - private int documentCollection; - private long storedProcedure; - private long trigger; - private long userDefinedFunction; - private long conflict; - private long document; - private long partitionKeyRange; - private int user; - private long permission; - private int attachment; - private long offer; - - private ResourceId() { - this.offer = 0; - this.database = 0; - this.documentCollection = 0; - this.storedProcedure = 0; - this.trigger = 0; - this.userDefinedFunction = 0; - this.document = 0; - this.partitionKeyRange = 0; - this.user = 0; - this.conflict = 0; - this.permission = 0; - this.attachment = 0; - } - - public static ResourceId parse(String id) throws IllegalArgumentException { - Pair pair = ResourceId.tryParse(id); - - if (!pair.getKey()) { - throw new IllegalArgumentException(String.format( - "Invalid resource id %s", id)); - } - return pair.getValue(); - } - - public static byte[] parse(ResourceType type, String id) { - if (ResourceId.hasNonHierarchicalResourceId(type)) { - return id.getBytes(StandardCharsets.UTF_8); - } - return ResourceId.parse(id).getValue(); - } - - private static boolean hasNonHierarchicalResourceId(ResourceType type) { - switch (type) { - case MasterPartition: - case ServerPartition: - case RidRange: - return true; - default: - return false; - } - } - - public static ResourceId newDatabaseId(int dbid) { - ResourceId resourceId = new ResourceId(); - resourceId.database = dbid; - return resourceId; - } - - public static ResourceId newDocumentCollectionId(String databaseId, int collectionId) { - ResourceId dbId = ResourceId.parse(databaseId); - - return newDocumentCollectionId(dbId.database, collectionId); - } - - static ResourceId newDocumentCollectionId(int dbId, int collectionId) { - ResourceId collectionResourceId = new ResourceId(); - collectionResourceId.database = dbId; - collectionResourceId.documentCollection = collectionId; - - return collectionResourceId; - } - - public static ResourceId newUserId(String databaseId, int userId) { - ResourceId dbId = ResourceId.parse(databaseId); - - ResourceId userResourceId = new ResourceId(); - userResourceId.database = dbId.database; - userResourceId.user = userId; - - return userResourceId; - } - - public static ResourceId newPermissionId(String userId, long permissionId) { - ResourceId usrId = ResourceId.parse(userId); - - ResourceId permissionResourceId = new ResourceId(); - permissionResourceId.database = usrId.database; - permissionResourceId.user = usrId.user; - permissionResourceId.permission = permissionId; - return permissionResourceId; - } - - public static ResourceId newAttachmentId(String documentId, int attachmentId) { - ResourceId docId = ResourceId.parse(documentId); - - ResourceId attachmentResourceId = new ResourceId(); - attachmentResourceId.database = docId.database; - attachmentResourceId.documentCollection = docId.documentCollection; - attachmentResourceId.document = docId.document; - attachmentResourceId.attachment = attachmentId; - - return attachmentResourceId; - } - - public static Pair tryParse(String id) { - ResourceId rid = null; - - try { - if (StringUtils.isEmpty(id)) - return Pair.of(false, null); - - if (id.length() % 4 != 0) { - // our ResourceId string is always padded - return Pair.of(false, null); - } - - byte[] buffer = null; - - Pair pair = ResourceId.verify(id); - - if (!pair.getKey()) - return Pair.of(false, null); - - buffer = pair.getValue(); - - if (buffer.length % 4 != 0 && buffer.length != ResourceId.OFFER_ID_LENGTH) { - return Pair.of(false, null); - } - - rid = new ResourceId(); - - if (buffer.length == ResourceId.OFFER_ID_LENGTH) { - rid.offer = 0; - for (int index = 0; index < ResourceId.OFFER_ID_LENGTH; index++) - { - rid.offer |= (long)(buffer[index] << (index * 8)); - } - return Pair.of(true, rid); - } - - if (buffer.length >= 4) - rid.database = ByteBuffer.wrap(buffer).getInt(); - - if (buffer.length >= 8) { - byte[] temp = new byte[4]; - ResourceId.blockCopy(buffer, 4, temp, 0, 4); - - boolean isCollection = (temp[0] & (128)) > 0; - - if (isCollection) { - rid.documentCollection = ByteBuffer.wrap(temp).getInt(); - - if (buffer.length >= 16) { - byte[] subCollRes = new byte[8]; - ResourceId.blockCopy(buffer, 8, subCollRes, 0, 8); - - long subCollectionResource = ByteBuffer.wrap(buffer, 8, 8).getLong(); - if ((subCollRes[7] >> 4) == (byte) CollectionChildResourceType.Document) { - rid.document = subCollectionResource; - - if (buffer.length == 20) { - rid.attachment = ByteBuffer.wrap(buffer, 16, 4).getInt(); - } - } else if (Math.abs(subCollRes[7] >> 4) == (byte) CollectionChildResourceType.StoredProcedure) { - rid.storedProcedure = subCollectionResource; - } else if ((subCollRes[7] >> 4) == (byte) CollectionChildResourceType.Trigger) { - rid.trigger = subCollectionResource; - } else if ((subCollRes[7] >> 4) == (byte) CollectionChildResourceType.UserDefinedFunction) { - rid.userDefinedFunction = subCollectionResource; - } else if ((subCollRes[7] >> 4) == (byte) CollectionChildResourceType.Conflict) { - rid.conflict = subCollectionResource; - } else if ((subCollRes[7] >> 4) == (byte) CollectionChildResourceType.PartitionKeyRange) { - rid.partitionKeyRange = subCollectionResource; - } else { - return Pair.of(false, rid); - } - } else if (buffer.length != 8) { - return Pair.of(false, rid); - } - } else { - rid.user = ByteBuffer.wrap(temp).getInt(); - - if (buffer.length == 16) { - rid.permission = ByteBuffer.wrap(buffer, 8, 8).getLong(); - } else if (buffer.length != 8) { - return Pair.of(false, rid); - } - } - } - - return Pair.of(true, rid); - } catch (Exception e) { - return Pair.of(false, null); - } - } - - public static Pair verify(String id) { - if (StringUtils.isEmpty(id)) - throw new IllegalArgumentException("id"); - - byte[] buffer = null; - - try { - buffer = ResourceId.fromBase64String(id); - } catch (Exception e) { - } - - if (buffer == null || buffer.length > ResourceId.Length) { - buffer = null; - return Pair.of(false, buffer); - } - - return Pair.of(true, buffer); - } - - public static boolean verifyBool(String id) { - return verify(id).getKey(); - } - - static byte[] fromBase64String(String s) { - return Utils.Base64Decoder.decode(s.replace('-', '/')); - } - - static String toBase64String(byte[] buffer) { - return ResourceId.toBase64String(buffer, 0, buffer.length); - } - - static String toBase64String(byte[] buffer, int offset, int length) { - byte[] subBuffer = Arrays.copyOfRange(buffer, offset, length); - - return Utils.encodeBase64String(subBuffer).replace('/', '-'); - } - - // Copy the bytes provided with a for loop, faster when there are only a few - // bytes to copy - static void blockCopy(byte[] src, int srcOffset, byte[] dst, int dstOffset, int count) { - int stop = srcOffset + count; - for (int i = srcOffset; i < stop; i++) - dst[dstOffset++] = src[i]; - } - - private static byte[] convertToBytesUsingByteBuffer(int value) { - ByteOrder order = ByteOrder.BIG_ENDIAN; - ByteBuffer buffer = ByteBuffer.allocate(4); - buffer.order(order); - return buffer.putInt(value).array(); - } - - private static byte[] convertToBytesUsingByteBuffer(long value) { - ByteOrder order = ByteOrder.BIG_ENDIAN; - ByteBuffer buffer = ByteBuffer.allocate(8); - buffer.order(order); - return buffer.putLong(value).array(); - } - - public boolean isDatabaseId() { - return this.getDatabase() != 0 && (this.getDocumentCollection() == 0 && this.getUser() == 0); - } - - public int getDatabase() { - return this.database; - } - - public ResourceId getDatabaseId() { - ResourceId rid = new ResourceId(); - rid.database = this.database; - return rid; - } - - public int getDocumentCollection() { - return this.documentCollection; - } - - public ResourceId getDocumentCollectionId() { - ResourceId rid = new ResourceId(); - rid.database = this.database; - rid.documentCollection = this.documentCollection; - return rid; - } - - /** - * Unique (across all databases) Id for the DocumentCollection. - * First 4 bytes are DatabaseId and next 4 bytes are CollectionId. - * - * @return the unique collectionId - */ - public long getUniqueDocumentCollectionId() { - return (long) this.database << 32 | this.documentCollection; - } - - public long getStoredProcedure() { - return this.storedProcedure; - } - - public ResourceId getStoredProcedureId() { - ResourceId rid = new ResourceId(); - rid.database = this.database; - rid.documentCollection = this.documentCollection; - rid.storedProcedure = this.storedProcedure; - return rid; - } - - public long getTrigger() { - return this.trigger; - } - - public ResourceId getTriggerId() { - ResourceId rid = new ResourceId(); - rid.database = this.database; - rid.documentCollection = this.documentCollection; - rid.trigger = this.trigger; - return rid; - } - - public long getUserDefinedFunction() { - return this.userDefinedFunction; - } - - public ResourceId getUserDefinedFunctionId() { - ResourceId rid = new ResourceId(); - rid.database = this.database; - rid.documentCollection = this.documentCollection; - rid.userDefinedFunction = this.userDefinedFunction; - return rid; - } - - public long getConflict() { - return this.conflict; - } - - public ResourceId getConflictId() { - ResourceId rid = new ResourceId(); - rid.database = this.database; - rid.documentCollection = this.documentCollection; - rid.conflict = this.conflict; - return rid; - } - - public long getDocument() { - return this.document; - } - - public ResourceId getDocumentId() { - ResourceId rid = new ResourceId(); - rid.database = this.database; - rid.documentCollection = this.documentCollection; - rid.document = this.document; - return rid; - } - - public long getPartitionKeyRange() { - return this.partitionKeyRange; - } - - public ResourceId getPartitionKeyRangeId() { - ResourceId rid = new ResourceId(); - rid.database = this.database; - rid.documentCollection = this.documentCollection; - rid.partitionKeyRange = this.partitionKeyRange; - return rid; - } - - public int getUser() { - return this.user; - } - - public ResourceId getUserId() { - ResourceId rid = new ResourceId(); - rid.database = this.database; - rid.user = this.user; - return rid; - } - - public long getPermission() { - return this.permission; - } - - public ResourceId getPermissionId() { - ResourceId rid = new ResourceId(); - rid.database = this.database; - rid.user = this.user; - rid.permission = this.permission; - return rid; - } - - public int getAttachment() { - return this.attachment; - } - - public ResourceId getAttachmentId() { - ResourceId rid = new ResourceId(); - rid.database = this.database; - rid.documentCollection = this.documentCollection; - rid.document = this.document; - rid.attachment = this.attachment; - return rid; - } - - public long getOffer() { return this.offer; } - - public ResourceId getOfferId() { - ResourceId rid = new ResourceId(); - rid.offer = this.offer; - return rid; - } - - public byte[] getValue() { - int len = 0; - if (this.offer != 0) - len += ResourceId.OFFER_ID_LENGTH; - else if (this.database != 0) - len += 4; - if (this.documentCollection != 0 || this.user != 0) - len += 4; - if (this.document != 0 || this.permission != 0 - || this.storedProcedure != 0 || this.trigger != 0 - || this.userDefinedFunction != 0 || this.conflict != 0 - || this.partitionKeyRange != 0) - len += 8; - if (this.attachment != 0) - len += 4; - - byte[] val = new byte[len]; - - if (this.offer != 0) - ResourceId.blockCopy(convertToBytesUsingByteBuffer(this.offer), - 0, val, 0, ResourceId.OFFER_ID_LENGTH); - else if (this.database != 0) - ResourceId.blockCopy(convertToBytesUsingByteBuffer(this.database), - 0, val, 0, 4); - - if (this.documentCollection != 0) - ResourceId.blockCopy( - convertToBytesUsingByteBuffer(this.documentCollection), - 0, val, 4, 4); - else if (this.user != 0) - ResourceId.blockCopy(convertToBytesUsingByteBuffer(this.user), - 0, val, 4, 4); - - if (this.storedProcedure != 0) - ResourceId.blockCopy( - convertToBytesUsingByteBuffer(this.storedProcedure), - 0, val, 8, 8); - else if (this.trigger != 0) - ResourceId.blockCopy(convertToBytesUsingByteBuffer(this.trigger), - 0, val, 8, 8); - else if (this.userDefinedFunction != 0) - ResourceId.blockCopy( - convertToBytesUsingByteBuffer(this.userDefinedFunction), - 0, val, 8, 8); - else if (this.conflict != 0) - ResourceId.blockCopy(convertToBytesUsingByteBuffer(this.conflict), - 0, val, 8, 8); - else if (this.document != 0) - ResourceId.blockCopy(convertToBytesUsingByteBuffer(this.document), - 0, val, 8, 8); - else if (this.permission != 0) - ResourceId.blockCopy( - convertToBytesUsingByteBuffer(this.permission), - 0, val, 8, 8); - else if (this.partitionKeyRange != 0) - ResourceId.blockCopy( - convertToBytesUsingByteBuffer(this.partitionKeyRange), - 0, val, 8, 8); - - if (this.attachment != 0) - ResourceId.blockCopy( - convertToBytesUsingByteBuffer(this.attachment), - 0, val, 16, 4); - - return val; - } - - public String toString() { - return ResourceId.toBase64String(this.getValue()); - } - - public boolean equals(ResourceId other) { - if (other == null) { - return false; - } - - return Arrays.equals(this.getValue(), other.getValue()); - } - - // Using a byte however, we only need nibble here. - private static class CollectionChildResourceType { - public static final byte Document = 0x0; - public static final byte StoredProcedure = 0x08; - public static final byte Trigger = 0x07; - public static final byte UserDefinedFunction = 0x06; - public static final byte Conflict = 0x04; - public static final byte PartitionKeyRange = 0x05; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ResourceTokenAuthorizationHelper.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ResourceTokenAuthorizationHelper.java deleted file mode 100644 index 9e0577917258..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ResourceTokenAuthorizationHelper.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal; - -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.tuple.Pair; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyAndResourceTokenPair; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternal; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; - -/** - * This class is used internally and act as a helper in authorization of - * resources from permission feed and its supporting method. - * - */ -public class ResourceTokenAuthorizationHelper { - - private static final Logger logger = LoggerFactory.getLogger(ResourceTokenAuthorizationHelper.class); - - /** - * This method help to differentiate between master key and resource token - * - * @param token - * ResourceToken provide - * @return Whether given token is resource token or not - */ - public static boolean isResourceToken(String token) { - int typeSeparatorPosition = token.indexOf('&'); - if (typeSeparatorPosition == -1) { - return false; - } - String authType = token.substring(0, typeSeparatorPosition); - int typeKeyValueSepartorPosition = authType.indexOf('='); - if (typeKeyValueSepartorPosition == -1 || !authType.substring(0, typeKeyValueSepartorPosition) - .equalsIgnoreCase(Constants.Properties.AUTH_SCHEMA_TYPE)) { - return false; - } - - String authTypeValue = authType.substring(typeKeyValueSepartorPosition + 1); - - return authTypeValue.equalsIgnoreCase(Constants.Properties.RESOURCE_TOKEN); - } - - /** - * Private method which will fetch resource token based on partition key and - * resource address . - * - * @param resourceTokensMap - * @param resourceAddress - * @param partitionKey - * @return - */ - private static String getResourceToken(Map> resourceTokensMap, - String resourceAddress, - PartitionKeyInternal partitionKey) { - List partitionKeyAndResourceTokenPairs = resourceTokensMap - .get(resourceAddress); - if (partitionKeyAndResourceTokenPairs != null) { - for (PartitionKeyAndResourceTokenPair pair : partitionKeyAndResourceTokenPairs) { - if (pair.getPartitionKey().contains(partitionKey) || partitionKey.equals(PartitionKeyInternal.Empty)) { - return pair.getResourceToken(); - } - } - } - - return null; - } - - /** - * This method will try to fetch the resource token to access the resource . - * - * @param resourceTokensMap - * It contains the resource link and its partition key and resource - * token list . - * @param headers - * Header information of the request . - * @param resourceAddress - * Resource full name or ID . - * @param requestVerb - * The verb . - */ - public static String getAuthorizationTokenUsingResourceTokens( - Map> resourceTokensMap, - String requestVerb, - String resourceAddress, - Map headers) { - PartitionKeyInternal partitionKey = PartitionKeyInternal.Empty; - String partitionKeyString = headers.get(HttpConstants.HttpHeaders.PARTITION_KEY); - if (partitionKeyString != null) { - partitionKey = PartitionKeyInternal.fromJsonString(partitionKeyString); - } - - if (PathsHelper.isNameBased(resourceAddress)) { - String resourceToken = null; - for (int index = 2; index < ResourceId.MAX_PATH_FRAGMENT; index = index + 2) { - String resourceParent = PathsHelper.getParentByIndex(resourceAddress, index); - if (resourceParent == null) - break; - resourceToken = getResourceToken(resourceTokensMap, resourceParent, partitionKey); - if (resourceToken != null) - break; - } - - // Get or Head for collection can be done with any child token - if (resourceToken == null && PathsHelper.getCollectionPath(resourceAddress).equalsIgnoreCase(resourceAddress) - && HttpConstants.HttpMethods.GET.equalsIgnoreCase(requestVerb) - || HttpConstants.HttpMethods.HEAD.equalsIgnoreCase(requestVerb)) { - String resourceAddressWithSlash = resourceAddress.endsWith(Constants.Properties.PATH_SEPARATOR) - ? resourceAddress - : resourceAddress + Constants.Properties.PATH_SEPARATOR; - for (String key : resourceTokensMap.keySet()) { - if (key.startsWith(resourceAddressWithSlash)) { - if (resourceTokensMap.get(key) != null && resourceTokensMap.get(key).size() > 0) - resourceToken = resourceTokensMap.get(key).get(0).getResourceToken(); - break; - } - } - } - - if (resourceToken == null) { - throw new IllegalArgumentException(RMResources.ResourceTokenNotFound); - } - - logger.debug("returned token for resourceAddress [{}] = [{}]", - resourceAddress, resourceToken); - return resourceToken; - } else { - String resourceToken = null; - ResourceId resourceId = ResourceId.parse(resourceAddress); - if (resourceId.getAttachment() != 0 || resourceId.getPermission() != 0 - || resourceId.getStoredProcedure() != 0 || resourceId.getTrigger() != 0 - || resourceId.getUserDefinedFunction() != 0) { - // Use the leaf ID - attachment/permission/sproc/trigger/udf - resourceToken = getResourceToken(resourceTokensMap, resourceAddress, partitionKey); - } - - if (resourceToken == null && (resourceId.getAttachment() != 0 || resourceId.getDocument() != 0)) { - // Use DocumentID for attachment/document - resourceToken = getResourceToken(resourceTokensMap, resourceId.getDocumentId().toString(), - partitionKey); - } - - if (resourceToken == null && (resourceId.getAttachment() != 0 || resourceId.getDocument() != 0 - || resourceId.getStoredProcedure() != 0 || resourceId.getTrigger() != 0 - || resourceId.getUserDefinedFunction() != 0 || resourceId.getDocumentCollection() != 0)) { - // Use CollectionID for attachment/document/sproc/trigger/udf/collection - resourceToken = getResourceToken(resourceTokensMap, resourceId.getDocumentCollectionId().toString(), - partitionKey); - } - - if (resourceToken == null && (resourceId.getPermission() != 0 || resourceId.getUser() != 0)) { - // Use UserID for permission/user - resourceToken = getResourceToken(resourceTokensMap, resourceId.getUserId().toString(), partitionKey); - } - - if (resourceToken == null) { - // Use DatabaseId if all else fail - resourceToken = getResourceToken(resourceTokensMap, resourceId.getDatabaseId().toString(), - partitionKey); - } - // Get or Head for collection can be done with any child token - if (resourceToken == null && resourceId.getDocumentCollection() != 0 - && (HttpConstants.HttpMethods.GET.equalsIgnoreCase(requestVerb) - || HttpConstants.HttpMethods.HEAD.equalsIgnoreCase(requestVerb))) { - for (String key : resourceTokensMap.keySet()) { - ResourceId tokenRid; - Pair pair = ResourceId.tryParse(key); - ResourceId test1= pair.getRight().getDocumentCollectionId(); - boolean test = test1.equals(resourceId); - if (!PathsHelper.isNameBased(key) && pair.getLeft() - && pair.getRight().getDocumentCollectionId().equals(resourceId)) { - if (resourceTokensMap.get(key) != null && resourceTokensMap.get(key).size() > 0) { - resourceToken = resourceTokensMap.get(key).get(0).getResourceToken(); - } - } - } - - } - - if (resourceToken == null) { - throw new IllegalArgumentException(RMResources.ResourceTokenNotFound); - } - - logger.debug("returned token for resourceAddress [{}] = [{}]", - resourceAddress, resourceToken); - return resourceToken; - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ResourceType.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ResourceType.java deleted file mode 100644 index cf6a2f609487..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ResourceType.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -/** - * Resource types in the Azure Cosmos DB database service. - */ -public enum ResourceType { - - // REQUIRED: This enum must be kept in sync with the ResourceType enum in backend native - - Unknown(-1), - Attachment(3), - BatchApply(112), - DocumentCollection(1), - ComputeGatewayCharges(131), - Conflict(107), - Database(0), - DatabaseAccount(118), - Document(2), - Index(104), - IndexBookmark(105), - IndexSize(106), - LargeInvalid(100), - LogStoreLogs(126), - MasterPartition(120), - Module(9), - ModuleCommand(103), - Offer(113), - PartitionKeyRange(125), - PartitionSetInformation(114), - Permission(5), - PreviousImage(128), - Progress(6), - Record(108), - Replica(7), - RestoreMetadata(127), - RidRange(130), - Schema(124), - SchemaContainer(123), - ServerPartition(121), - SmallMaxInvalid(10), - StoredProcedure(109), - Timestamp(117), - Tombstone(8), - Topology(122), - Trigger(110), - User(4), - UserDefinedFunction(111), - UserDefinedType(133), - VectorClock(129), - XPReplicatorAddress(115), - - // These names make it unclear what they map to in ResourceType. - Address(-5), - Key(-2), - Media(-3), - ServiceFabricService(-4); - - final private int value; - - ResourceType(int value) { - this.value = value; - } - - public int value() { - return this.value; - } - - public boolean isCollectionChild() { - return this == ResourceType.Document || - this == ResourceType.Attachment || - this == ResourceType.Conflict || - this == ResourceType.Schema || - this.isScript(); - } - - public boolean isMasterResource() { - return this == ResourceType.Offer || - this == ResourceType.Database || - this == ResourceType.User || - this == ResourceType.Permission || - this == ResourceType.Topology || - this == ResourceType.PartitionKeyRange || - this == ResourceType.DocumentCollection; - } - - ///

- /// Resources for which this method returns true, are spread between multiple partitions - /// - public boolean isPartitioned() { - return this == ResourceType.Document || - this == ResourceType.Attachment || - this == ResourceType.Conflict; - } - - public boolean isScript() { - return this == ResourceType.UserDefinedFunction || - this == ResourceType.Trigger || - this == ResourceType.StoredProcedure; - } - -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/RuntimeConstants.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/RuntimeConstants.java deleted file mode 100644 index fe1907cca044..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/RuntimeConstants.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -/** - * Used internally. Runtime constants in the Azure Cosmos DB database service Java SDK. - */ -public class RuntimeConstants { - public static class MediaTypes { - // http://www.iana.org/assignments/media-types/media-types.xhtml - public static final String ANY = "*/*"; - public static final String IMAGE_JPEG = "image/jpeg"; - public static final String IMAGE_PNG = "image/png"; - public static final String JAVA_SCRIPT = "application/x-javascript"; - public static final String JSON = "application/json"; - public static final String OCTET_STREAM = "application/octet-stream"; - public static final String QUERY_JSON = "application/query+json"; - public static final String SQL = "application/sql"; - public static final String TEXT_HTML = "text/html"; - public static final String TEXT_PLAIN = "text/plain"; - public static final String XML = "application/xml"; - } - - public static class ProtocolScheme { - public static final String HTTPS = "https"; - public static final String TCP = "rntbd"; - } - - static class Separators { - static final char[] Url = new char[] {'/'}; - static final char[] Quote = new char[] {'\''}; - static final char[] DomainId = new char[] {'-'}; - static final char[] Query = new char[] {'?', '&', '='}; - static final char[] Parenthesis = new char[] {'(', ')'}; - static final char[] UserAgentHeader = new char[] {'(', ')', ';', ','}; - - - //Note that the accept header separator here is ideally comma. Semicolon is used for separators within individual - //header for now cloud moe does not recognize such accept header hence we allow both semicolon or comma separated - //accept header - static final char[] Header = new char[] {';', ','}; - static final char[] CookieSeparator = new char[] {';'}; - static final char[] CookieValueSeparator = new char[] {'='}; - static final char[] PPMUserToken = new char[] {':'}; - static final char[] Identifier = new char[] {'-'}; - static final char[] Host = new char[] {'.'}; - static final char[] Version = new char[] {','}; - static final char[] Pair = new char[] {';'}; - static final char[] ETag = new char[] {'#'}; - static final char[] MemberQuery = new char[] {'+'}; - - static final String HeaderEncodingBegin = "=?"; - static final String HeaderEncodingEnd = "?="; - static final String HeaderEncodingSeparator = "?"; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Utils.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Utils.java deleted file mode 100644 index 821e25392566..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/Utils.java +++ /dev/null @@ -1,438 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLEncoder; -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; -import java.util.Base64; -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; -import java.util.UUID; - -import org.apache.commons.lang3.StringUtils; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.uuid.EthernetAddress; -import com.fasterxml.uuid.Generators; -import com.fasterxml.uuid.impl.TimeBasedGenerator; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DocumentCollection; - -/** - * Used internally to provides utility functions for the Azure Cosmos DB database service Java SDK. - */ -public final class Utils { - private static final ZoneId GMT_ZONE_ID = ZoneId.of("GMT"); - public static final Base64.Encoder Base64Encoder = Base64.getEncoder(); - public static final Base64.Decoder Base64Decoder = Base64.getDecoder(); - - private static final ObjectMapper simpleObjectMapper = new ObjectMapper(); - private static final TimeBasedGenerator TimeUUIDGegerator = - Generators.timeBasedGenerator(EthernetAddress.constructMulticastAddress()); - - // NOTE DateTimeFormatter.RFC_1123_DATE_TIME cannot be used. - // because cosmos db rfc1123 validation requires two digits for day. - // so Thu, 04 Jan 2018 00:30:37 GMT is accepted by the cosmos db service, - // but Thu, 4 Jan 2018 00:30:37 GMT is not. - // Therefore, we need a custom date time formatter. - private static final DateTimeFormatter RFC_1123_DATE_TIME = DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US); - - static { - Utils.simpleObjectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - Utils.simpleObjectMapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); - Utils.simpleObjectMapper.configure(JsonParser.Feature.ALLOW_TRAILING_COMMA, true); - Utils.simpleObjectMapper.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true); - } - - public static byte[] getUTF8Bytes(String str) throws UnsupportedEncodingException { - return str.getBytes("UTF-8"); - } - - public static String encodeBase64String(byte[] binaryData) { - String encodedString = Base64Encoder.encodeToString(binaryData); - - if (encodedString.endsWith("\r\n")) { - encodedString = encodedString.substring(0, encodedString.length() - 2); - } - return encodedString; - } - - /** - * Checks whether the specified link is Name based or not - * - * @param link the link to analyze. - * @return true or false - */ - public static boolean isNameBased(String link) { - if (StringUtils.isEmpty(link)) { - return false; - } - - // trimming the leading "/" - if (link.startsWith("/") && link.length() > 1) { - link = link.substring(1); - } - - // Splitting the link(separated by "/") into parts - String[] parts = StringUtils.split(link, "/"); - - // First part should be "dbs" - if (parts.length == 0 || StringUtils.isEmpty(parts[0]) - || !parts[0].equalsIgnoreCase(Paths.DATABASES_PATH_SEGMENT)) { - return false; - } - - // The second part is the database id(ResourceID or Name) and cannot be - // empty - if (parts.length < 2 || StringUtils.isEmpty(parts[1])) { - return false; - } - - // Either ResourceID or database name - String databaseID = parts[1]; - - // Length of databaseID(in case of ResourceID) is always 8 - if (databaseID.length() != 8) { - return true; - } - - // Decoding the databaseID - byte[] buffer = ResourceId.fromBase64String(databaseID); - - // Length of decoded buffer(in case of ResourceID) is always 4 - if (buffer.length != 4) { - return true; - } - - return false; - } - - /** - * Checks whether the specified link is a Database Self Link or a Database - * ID based link - * - * @param link the link to analyze. - * @return true or false - */ - public static boolean isDatabaseLink(String link) { - if (StringUtils.isEmpty(link)) { - return false; - } - - // trimming the leading and trailing "/" from the input string - link = trimBeginningAndEndingSlashes(link); - - // Splitting the link(separated by "/") into parts - String[] parts = StringUtils.split(link, "/"); - - if (parts.length != 2) { - return false; - } - - // First part should be "dbs" - if (StringUtils.isEmpty(parts[0]) || !parts[0].equalsIgnoreCase(Paths.DATABASES_PATH_SEGMENT)) { - return false; - } - - // The second part is the database id(ResourceID or Name) and cannot be - // empty - if (StringUtils.isEmpty(parts[1])) { - return false; - } - - return true; - } - - /** - * Checks whether the specified path segment is a resource type - * - * @param resourcePathSegment the path segment to analyze. - * @return true or false - */ - public static boolean IsResourceType(String resourcePathSegment) { - if (StringUtils.isEmpty(resourcePathSegment)) { - return false; - } - - switch (resourcePathSegment.toLowerCase()) { - case Paths.ATTACHMENTS_PATH_SEGMENT: - case Paths.COLLECTIONS_PATH_SEGMENT: - case Paths.DATABASES_PATH_SEGMENT: - case Paths.PERMISSIONS_PATH_SEGMENT: - case Paths.USERS_PATH_SEGMENT: - case Paths.DOCUMENTS_PATH_SEGMENT: - case Paths.STORED_PROCEDURES_PATH_SEGMENT: - case Paths.TRIGGERS_PATH_SEGMENT: - case Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT: - case Paths.CONFLICTS_PATH_SEGMENT: - case Paths.PARTITION_KEY_RANGES_PATH_SEGMENT: - return true; - - default: - return false; - } - } - - /** - * Joins the specified paths by appropriately padding them with '/' - * - * @param path1 the first path segment to join. - * @param path2 the second path segment to join. - * @return the concatenated path with '/' - */ - public static String joinPath(String path1, String path2) { - path1 = trimBeginningAndEndingSlashes(path1); - String result = "/" + path1 + "/"; - - if (!StringUtils.isEmpty(path2)) { - path2 = trimBeginningAndEndingSlashes(path2); - result += path2 + "/"; - } - - return result; - } - - /** - * Trims the beginning and ending '/' from the given path - * - * @param path the path to trim for beginning and ending slashes - * @return the path without beginning and ending '/' - */ - public static String trimBeginningAndEndingSlashes(String path) { - if(path == null) { - return null; - } - - if (path.startsWith("/")) { - path = path.substring(1); - } - - if (path.endsWith("/")) { - path = path.substring(0, path.length() - 1); - } - - return path; - } - - public static Map paramEncode(Map queryParams) { - // TODO: this is not performant revisit - HashMap map = new HashMap<>(); - for(Map.Entry paramEntry: queryParams.entrySet()) { - try { - map.put(paramEntry.getKey(), URLEncoder.encode(paramEntry.getValue(), "UTF-8")); - } catch (UnsupportedEncodingException e) { - throw new IllegalStateException(e); - } - } - return map; - } - - public static String createQuery(Map queryParameters) { - if (queryParameters == null) - return ""; - StringBuilder queryString = new StringBuilder(); - for (Map.Entry nameValuePair : queryParameters.entrySet()) { - String key = nameValuePair.getKey(); - String value = nameValuePair.getValue(); - if (key != null && !key.isEmpty()) { - if (queryString.length() > 0) { - queryString.append(RuntimeConstants.Separators.Query[1]); - } - queryString.append(key); - if (value != null) { - queryString.append(RuntimeConstants.Separators.Query[2]); - queryString.append(value); - } - } - } - return queryString.toString(); - } - - public static URL setQuery(String urlString, String query) { - - if (urlString == null) - throw new IllegalStateException("urlString parameter can't be null."); - query = Utils.removeLeadingQuestionMark(query); - try { - if (query != null && !query.isEmpty()) { - return new URI(Utils.addTrailingSlash(urlString) + RuntimeConstants.Separators.Query[0] + query) - .toURL(); - } else { - return new URI(Utils.addTrailingSlash(urlString)).toURL(); - } - } catch (MalformedURLException e) { - throw new IllegalStateException("Uri is invalid: ", e); - } catch (URISyntaxException e) { - throw new IllegalStateException("Uri is invalid: ", e); - } - } - - /** - * Given the full path to a resource, extract the collection path. - * - * @param resourceFullName the full path to the resource. - * @return the path of the collection in which the resource is. - */ - public static String getCollectionName(String resourceFullName) { - if (resourceFullName != null) { - resourceFullName = Utils.trimBeginningAndEndingSlashes(resourceFullName); - - int slashCount = 0; - for (int i = 0; i < resourceFullName.length(); i++) { - if (resourceFullName.charAt(i) == '/') { - slashCount++; - if (slashCount == 4) { - return resourceFullName.substring(0, i); - } - } - } - } - return resourceFullName; - } - - public static Boolean isCollectionPartitioned(DocumentCollection collection) { - if (collection == null) { - throw new IllegalArgumentException("collection"); - } - - return collection.getPartitionKey() != null - && collection.getPartitionKey().getPaths() != null - && collection.getPartitionKey().getPaths().size() > 0; - } - - public static boolean isCollectionChild(ResourceType type) { - return type == ResourceType.Document || type == ResourceType.Attachment || type == ResourceType.Conflict - || type == ResourceType.StoredProcedure || type == ResourceType.Trigger || type == ResourceType.UserDefinedFunction; - } - - public static boolean isWriteOperation(OperationType operationType) { - return operationType == OperationType.Create || operationType == OperationType.Upsert || operationType == OperationType.Delete || operationType == OperationType.Replace - || operationType == OperationType.ExecuteJavaScript; - } - - public static boolean isFeedRequest(OperationType requestOperationType) { - return requestOperationType == OperationType.Create || - requestOperationType == OperationType.Upsert || - requestOperationType == OperationType.ReadFeed || - requestOperationType == OperationType.Query || - requestOperationType == OperationType.SqlQuery || - requestOperationType == OperationType.HeadFeed; - } - - private static String addTrailingSlash(String path) { - if (path == null || path.isEmpty()) - path = new String(RuntimeConstants.Separators.Url); - else if (path.charAt(path.length() - 1) != RuntimeConstants.Separators.Url[0]) - path = path + RuntimeConstants.Separators.Url[0]; - - return path; - } - - private static String removeLeadingQuestionMark(String path) { - if (path == null || path.isEmpty()) - return path; - - if (path.charAt(0) == RuntimeConstants.Separators.Query[0]) - return path.substring(1); - - return path; - } - - public static boolean isValidConsistency(ConsistencyLevel backendConsistency, - ConsistencyLevel desiredConsistency) { - switch (backendConsistency) { - case Strong: - return desiredConsistency == ConsistencyLevel.Strong || - desiredConsistency == ConsistencyLevel.BoundedStaleness || - desiredConsistency == ConsistencyLevel.Session || - desiredConsistency == ConsistencyLevel.Eventual || - desiredConsistency == ConsistencyLevel.ConsistentPrefix; - - case BoundedStaleness: - return desiredConsistency == ConsistencyLevel.BoundedStaleness || - desiredConsistency == ConsistencyLevel.Session || - desiredConsistency == ConsistencyLevel.Eventual || - desiredConsistency == ConsistencyLevel.ConsistentPrefix; - - case Session: - case Eventual: - case ConsistentPrefix: - return desiredConsistency == ConsistencyLevel.Session || - desiredConsistency == ConsistencyLevel.Eventual || - desiredConsistency == ConsistencyLevel.ConsistentPrefix; - - default: - throw new IllegalArgumentException("backendConsistency"); - } - } - - public static String getUserAgent(String sdkName, String sdkVersion) { - String osName = System.getProperty("os.name"); - if (osName == null) { - osName = "Unknown"; - } - osName = osName.replaceAll("\\s", ""); - String userAgent = String.format("%s/%s JRE/%s %s/%s", - osName, - System.getProperty("os.version"), - System.getProperty("java.version"), - sdkName, - sdkVersion); - return userAgent; - } - - public static ObjectMapper getSimpleObjectMapper() { - return Utils.simpleObjectMapper; - } - - /** - * Returns Current Time in RFC 1123 format, e.g, - * Fri, 01 Dec 2017 19:22:30 GMT. - * - * @return an instance of String - */ - public static String nowAsRFC1123() { - ZonedDateTime now = ZonedDateTime.now(GMT_ZONE_ID); - return Utils.RFC_1123_DATE_TIME.format(now); - } - - public static UUID randomUUID() { - return TimeUUIDGegerator.generate(); - } - - public static String zonedDateTimeAsUTCRFC1123(ZonedDateTime zonedDateTime){ - return Utils.RFC_1123_DATE_TIME.format(zonedDateTime.withZoneSameInstant(GMT_ZONE_ID)); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/Address.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/Address.java deleted file mode 100644 index ac09a6669e5d..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/Address.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.internal.Constants; - -/** - * Used internally to represent a physical address in the Azure Cosmos DB database service. - */ -public class Address extends Resource { - /** - * Initialize an offer object. - */ - public Address() { - super(); - } - - /** - * Initialize an address object from json string. - * - * @param jsonString the json string that represents the address. - */ - public Address(String jsonString) { - super(jsonString); - } - - public boolean IsPrimary() { - return super.getBoolean(Constants.Properties.IS_PRIMARY); - } - - void setIsPrimary(boolean isPrimary) { - super.set(Constants.Properties.IS_PRIMARY, isPrimary); - } - - public String getProtocolScheme() { - return super.getString(Constants.Properties.PROTOCOL); - } - - void setProtocol(String protocol) { - super.set(Constants.Properties.PROTOCOL, protocol); - } - - public String getLogicalUri() { - return super.getString(Constants.Properties.LOGICAL_URI); - } - - void setLogicalUri(String logicalUri) { - super.set(Constants.Properties.LOGICAL_URI, logicalUri); - } - - public String getPhyicalUri() { - return super.getString(Constants.Properties.PHYISCAL_URI); - } - - void setPhysicalUri(String phyicalUri) { - super.set(Constants.Properties.PHYISCAL_URI, phyicalUri); - } - - public String getPartitionIndex() { - return super.getString(Constants.Properties.PARTITION_INDEX); - } - - void setPartitionIndex(String partitionIndex) { - super.set(Constants.Properties.PARTITION_INDEX, partitionIndex); - } - - public String getParitionKeyRangeId() { - return super.getString(Constants.Properties.PARTITION_KEY_RANGE_ID); - } - - public void setPartitionKeyRangeId(String partitionKeyRangeId) { - super.set(Constants.Properties.PARTITION_KEY_RANGE_ID, partitionKeyRangeId); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressInformation.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressInformation.java deleted file mode 100644 index 10ecf29854c2..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressInformation.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import java.util.Objects; - -/** - * Used internally to encapsulate a physical address information in the Azure Cosmos DB database service. - */ -public class AddressInformation { - private Protocol protocol; - private boolean isPublic; - private boolean isPrimary; - private String physicalUri; - - public AddressInformation(boolean isPublic, boolean isPrimary, String physicalUri, Protocol protocol) { - Objects.requireNonNull(protocol); - this.protocol = protocol; - this.isPublic = isPublic; - this.isPrimary = isPrimary; - this.physicalUri = physicalUri; - } - - public AddressInformation(boolean isPublic, boolean isPrimary, String physicalUri, String protocolScheme) { - this(isPublic, isPrimary, physicalUri, scheme2protocol(protocolScheme)); - } - - public boolean isPublic() { - return isPublic; - } - - public boolean isPrimary() { - return isPrimary; - } - - public String getPhysicalUri() { - return physicalUri; - } - - public Protocol getProtocol() { - return this.protocol; - } - - public String getProtocolName() { - return this.protocol.name(); - } - - public String getProtocolScheme() { - return this.protocol.scheme(); - } - - @Override - public String toString() { - return "AddressInformation{" + - "protocol='" + protocol + '\'' + - ", isPublic=" + isPublic + - ", isPrimary=" + isPrimary + - ", physicalUri='" + physicalUri + '\'' + - '}'; - } - - private static Protocol scheme2protocol(String scheme) { - - Objects.requireNonNull(scheme, "scheme"); - - switch (scheme.toLowerCase()) { - case "https": - return Protocol.Https; - case "rntbd": - return Protocol.Tcp; - default: - throw new IllegalArgumentException(String.format("scheme: %s", scheme)); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GoneException.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GoneException.java deleted file mode 100644 index 04aaaf9cb138..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GoneException.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.net.URI; -import java.util.HashMap; -import java.util.Map; - -public class GoneException extends DocumentClientException { - - public GoneException(String msg) { - this(msg, null); - } - public GoneException() { - this(RMResources.Gone, (String) null); - } - - public GoneException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.GONE, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public GoneException(String message, String requestUri) { - this(message, (Exception) null, new HashMap<>(), requestUri); - } - - public GoneException(String message, - Exception innerException, - URI requestUri, - String localIpAddress) { - this(message(localIpAddress, message), innerException, (HttpResponseHeaders) null, requestUri); - } - - public GoneException(Exception innerException) { - this(RMResources.Gone, innerException, new HashMap<>(), (String) null); - } - - public GoneException(String message, HttpResponseHeaders headers, URI requestUri) { - super(message, null, HttpUtils.asMap(headers), HttpConstants.StatusCodes.GONE, requestUri != null ? requestUri.toString() : null); - } - - public GoneException(String message, HttpResponseHeaders headers, String requestUri) { - super(message, null, HttpUtils.asMap(headers), HttpConstants.StatusCodes.GONE, requestUri); - } - - public GoneException(String message, - Exception innerException, - HttpResponseHeaders headers, - URI requestUri) { - super(message, innerException, HttpUtils.asMap(headers), HttpConstants.StatusCodes.GONE, requestUri != null ? requestUri.toString() : null); - } - - public GoneException(String message, - Exception innerException, - Map headers, - String requestUri) { - super(message, innerException, headers, HttpConstants.StatusCodes.GONE, requestUri); - } - - public GoneException(Error error, Map headers) { - super(HttpConstants.StatusCodes.GONE, error, headers); - } - - private static String message(String localIP, String baseMessage) { - if (!Strings.isNullOrEmpty(localIP)) { - return String.format( - RMResources.ExceptionMessageAddIpAddress, - baseMessage, - localIP); - } - - return baseMessage; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpUtils.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpUtils.java deleted file mode 100644 index 13bbb27aee3f..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpUtils.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.internal.Constants.UrlEncodingInfo; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import io.reactivex.netty.protocol.http.client.HttpRequestHeaders; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URLDecoder; -import java.net.URLEncoder; -import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -public class HttpUtils { - - private static Logger log = LoggerFactory.getLogger(HttpUtils.class); - - public static String urlEncode(String url) { - try { - return URLEncoder.encode(url, UrlEncodingInfo.UTF_8).replaceAll(UrlEncodingInfo.PLUS_SYMBOL_ESCAPED, UrlEncodingInfo.SINGLE_SPACE_URI_ENCODING); - } catch (UnsupportedEncodingException e) { - log.error("failed to encode {}", url, e); - throw new IllegalArgumentException("failed to encode url " + url, e); - } - } - - public static String urlDecode(String url) { - try { - return URLDecoder.decode(url.replaceAll(UrlEncodingInfo.PLUS_SYMBOL_ESCAPED, UrlEncodingInfo.PLUS_SYMBOL_URI_ENCODING), UrlEncodingInfo.UTF_8); - } catch (UnsupportedEncodingException e) { - log.error("failed to decode {}", url, e); - throw new IllegalArgumentException("failed to decode url " + url, e); - } - } - - public static URI toURI(String uri) { - try { - return new URI(uri); - } catch (Exception e) { - log.error("failed to parse {}", uri, e); - throw new IllegalArgumentException("failed to parse uri " + uri, e); - } - } - - public static Map asMap(HttpResponseHeaders headers) { - if (headers == null) { - return new HashMap<>(); - } - - HashMap map = new HashMap<>(headers.names().size()); - for (Entry entry : headers.entries()) { - if (entry.getKey().equals(HttpConstants.HttpHeaders.OWNER_FULL_NAME)) { - map.put(entry.getKey(), HttpUtils.urlDecode(entry.getValue())); - } else { - map.put(entry.getKey(), entry.getValue()); - } - } - return map; - } - - public static Map asMap(HttpRequestHeaders headers) { - HashMap map = new HashMap<>(); - if (headers == null) { - return map; - } - for (Entry entry : headers.entries()) { - map.put(entry.getKey(), entry.getValue()); - } - return map; - } - - public static String getDateHeader(Map headerValues) { - if (headerValues == null) { - return StringUtils.EMPTY; - } - - // Since Date header is overridden by some proxies/http client libraries, we support - // an additional date header 'x-ms-date' and prefer that to the regular 'date' header. - String date = headerValues.get(HttpConstants.HttpHeaders.X_DATE); - if (Strings.isNullOrEmpty(date)) { - date = headerValues.get(HttpConstants.HttpHeaders.HTTP_DATE); - } - - return date != null ? date : StringUtils.EMPTY; - } - - public static List> unescape(List> headers) { - List> result = new ArrayList>(); - for (Entry entry : headers) { - if (entry.getKey().equals(HttpConstants.HttpHeaders.OWNER_FULL_NAME)) { - String unescapedUrl = HttpUtils.urlDecode(entry.getValue()); - entry = new AbstractMap.SimpleEntry(entry.getKey(), unescapedUrl); - } - result.add(entry); - } - return result; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/Protocol.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/Protocol.java deleted file mode 100644 index 5f5c1d7ef6a2..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/Protocol.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -public enum Protocol { - Https, Tcp; - - String scheme() { - switch (this) { - case Https: - return "https"; - case Tcp: - return "rntbd"; - default: - throw new IllegalStateException(); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RequestTimeoutException.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RequestTimeoutException.java deleted file mode 100644 index 836d4b3935dc..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RequestTimeoutException.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.net.URI; -import java.util.Map; - -public class RequestTimeoutException extends DocumentClientException { - - public RequestTimeoutException() { - this(RMResources.RequestTimeout, null); - } - - public RequestTimeoutException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.REQUEST_TIMEOUT, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public RequestTimeoutException(String message, URI requestUri) { - this(message, (Exception) null, (HttpResponseHeaders) null, requestUri); - } - - public RequestTimeoutException(String message, - Exception innerException, - URI requestUri, - String localIpAddress) { - this(message(localIpAddress, message), innerException, (HttpResponseHeaders) null, requestUri); - } - - public RequestTimeoutException(Exception innerException) { - this(RMResources.Gone, innerException, (HttpResponseHeaders) null, null); - } - - public RequestTimeoutException(String message, HttpResponseHeaders headers, URI requestUri) { - super(message, null, HttpUtils.asMap(headers), HttpConstants.StatusCodes.REQUEST_TIMEOUT, requestUri != null ? requestUri.toString() : null); - } - - public RequestTimeoutException(String message, HttpResponseHeaders headers, String requestUri) { - super(message, null, HttpUtils.asMap(headers), HttpConstants.StatusCodes.REQUEST_TIMEOUT, requestUri); - } - - public RequestTimeoutException(String message, - Exception innerException, - HttpResponseHeaders headers, - URI requestUri) { - super(message, innerException, HttpUtils.asMap(headers), HttpConstants.StatusCodes.REQUEST_TIMEOUT, requestUri != null ? requestUri.toString() : null); - } - - private static String message(String localIP, String baseMessage) { - if (!Strings.isNullOrEmpty(localIP)) { - return String.format( - RMResources.ExceptionMessageAddIpAddress, - baseMessage, - localIP); - } - - return baseMessage; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResponse.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResponse.java deleted file mode 100644 index 816918cc7512..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResponse.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.ClientSideRequestStatistics; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.InputStream; -import java.util.List; -import java.util.Map.Entry; - -/** - * Used internally to represents a response from the store. - */ -public class StoreResponse { - final static Logger LOGGER = LoggerFactory.getLogger(StoreResponse.class); - final private int status; - final private String[] responseHeaderNames; - final private String[] responseHeaderValues; - final private InputStream httpEntityStream; - final private String content; - - private ClientSideRequestStatistics clientSideRequestStatistics; - - public StoreResponse(int status, List> headerEntries, InputStream inputStream) { - this(status, headerEntries, null, inputStream); - } - - public StoreResponse(int status, List> headerEntries, String content) { - this(status, headerEntries, content, null); - } - - private StoreResponse( - int status, - List> headerEntries, - String content, - InputStream inputStream) { - responseHeaderNames = new String[headerEntries.size()]; - responseHeaderValues = new String[headerEntries.size()]; - - int i = 0; - - for(Entry headerEntry: headerEntries) { - responseHeaderNames[i] = headerEntry.getKey(); - responseHeaderValues[i] = headerEntry.getValue(); - i++; - } - - this.status = status; - - this.content = content; - this.httpEntityStream = inputStream; - } - - public int getStatus() { - return status; - } - - public String[] getResponseHeaderNames() { - return responseHeaderNames; - } - - public String[] getResponseHeaderValues() { - return responseHeaderValues; - } - - public String getResponseBody() { - return this.content; - } - - public InputStream getResponseStream() { - // Some operation type doesn't have a response stream so this can be null - return this.httpEntityStream; - } - - public long getLSN() { - String lsnString = this.getHeaderValue(WFConstants.BackendHeaders.LSN); - if (StringUtils.isNotEmpty(lsnString)) { - return Long.parseLong(lsnString); - } - - return -1; - } - - public String getPartitionKeyRangeId() { - return this.getHeaderValue(WFConstants.BackendHeaders.PARTITION_KEY_RANGE_ID); - } - - public String getContinuation() { - return this.getHeaderValue(HttpConstants.HttpHeaders.CONTINUATION); - } - - public String getHeaderValue(String attribute) { - if (this.responseHeaderValues == null || this.responseHeaderNames.length != this.responseHeaderValues.length) { - return null; - } - - for (int i = 0; i < responseHeaderNames.length; i++) { - if (responseHeaderNames[i].equalsIgnoreCase(attribute)) { - return responseHeaderValues[i]; - } - } - - return null; - } - - public ClientSideRequestStatistics getClientSideRequestStatistics() { - return clientSideRequestStatistics; - } - - public void setClientSideRequestStatistics(ClientSideRequestStatistics clientSideRequestStatistics) { - this.clientSideRequestStatistics = clientSideRequestStatistics; - } - - int getSubStatusCode() { - int subStatusCode = HttpConstants.SubStatusCodes.UNKNOWN; - String subStatusCodeString = this.getHeaderValue(WFConstants.BackendHeaders.SUB_STATUS); - if (StringUtils.isNotEmpty(subStatusCodeString)) { - try { - subStatusCode = Integer.parseInt(subStatusCodeString); - } catch (NumberFormatException e) { - // If value cannot be parsed as Integer, return Unknown. - } - } - return subStatusCode; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResult.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResult.java deleted file mode 100644 index 9dbb0d416052..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResult.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.ISessionToken; -import com.microsoft.azure.cosmosdb.internal.InternalServerErrorException; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.rx.internal.Exceptions; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.net.URI; - -public class StoreResult { - private final static Logger logger = LoggerFactory.getLogger(StoreResult.class); - - private final StoreResponse storeResponse; - private final DocumentClientException exception; - - final public long lsn; - final public String partitionKeyRangeId; - final public long quorumAckedLSN; - final public long globalCommittedLSN; - final public long numberOfReadRegions; - final public long itemLSN; - final public ISessionToken sessionToken; - final public double requestCharge; - final public int currentReplicaSetSize; - final public int currentWriteQuorum; - final public boolean isValid; - final public boolean isGoneException; - final public boolean isNotFoundException; - final public boolean isInvalidPartitionException; - final public URI storePhysicalAddress; - - public StoreResult( - StoreResponse storeResponse, - DocumentClientException exception, - String partitionKeyRangeId, - long lsn, - long quorumAckedLsn, - double requestCharge, - int currentReplicaSetSize, - int currentWriteQuorum, - boolean isValid, - URI storePhysicalAddress, - long globalCommittedLSN, - int numberOfReadRegions, - long itemLSN, - ISessionToken sessionToken) { - this.storeResponse = storeResponse; - this.exception = exception; - this.partitionKeyRangeId = partitionKeyRangeId; - this.lsn = lsn; - this.quorumAckedLSN = quorumAckedLsn; - this.requestCharge = requestCharge; - this.currentReplicaSetSize = currentReplicaSetSize; - this.currentWriteQuorum = currentWriteQuorum; - this.isValid = isValid; - this.isGoneException = this.exception != null && this.exception.getStatusCode() == HttpConstants.StatusCodes.GONE; - this.isNotFoundException = this.exception != null && this.exception.getStatusCode() == HttpConstants.StatusCodes.NOTFOUND; - this.isInvalidPartitionException = this.exception != null - && Exceptions.isNameCacheStale(this.exception); - this.storePhysicalAddress = storePhysicalAddress; - this.globalCommittedLSN = globalCommittedLSN; - this.numberOfReadRegions = numberOfReadRegions; - this.itemLSN = itemLSN; - this.sessionToken = sessionToken; - } - - public DocumentClientException getException() throws InternalServerErrorException { - if (this.exception == null) { - String message = "Exception should be available but found none"; - assert false : message; - logger.error(message); - throw new InternalServerErrorException(RMResources.InternalServerError); - } - - return exception; - } - - public StoreResponse toResponse() throws DocumentClientException { - return toResponse(null); - } - - public StoreResponse toResponse(RequestChargeTracker requestChargeTracker) throws DocumentClientException { - if (!this.isValid) { - if (this.exception == null) { - logger.error("Exception not set for invalid response"); - throw new InternalServerErrorException(RMResources.InternalServerError); - } - - throw this.exception; - } - - if (requestChargeTracker != null && this.isValid) { - StoreResult.setRequestCharge(this.storeResponse, this.exception, requestChargeTracker.getTotalRequestCharge()); - } - - if (this.exception != null) { - throw exception; - } - - return this.storeResponse; - } - - private static void setRequestCharge(StoreResponse response, DocumentClientException documentClientException, double totalRequestCharge) { - if (documentClientException != null) { - documentClientException.getResponseHeaders().put(HttpConstants.HttpHeaders.REQUEST_CHARGE, - Double.toString(totalRequestCharge)); - } - // Set total charge as final charge for the response. - else if (response.getResponseHeaderNames() != null) { - for (int i = 0; i < response.getResponseHeaderNames().length; ++i) { - if (Strings.areEqualIgnoreCase( - response.getResponseHeaderNames()[i], - HttpConstants.HttpHeaders.REQUEST_CHARGE)) { - response.getResponseHeaderValues()[i] = Double.toString(totalRequestCharge); - break; - } - } - } - } - - @Override - public String toString() { - int statusCode = 0; - int subStatusCode = HttpConstants.SubStatusCodes.UNKNOWN; - - if (this.storeResponse != null) { - statusCode = this.storeResponse.getStatus(); - subStatusCode = this.storeResponse.getSubStatusCode(); - } else if (this.exception != null) { - statusCode = this.exception.getStatusCode(); - subStatusCode = this.exception.getSubStatusCode(); - } - - return "storePhysicalAddress: " + this.storePhysicalAddress + - ", lsn: " + this.lsn + - ", globalCommittedLsn: " + this.globalCommittedLSN + - ", partitionKeyRangeId: " + this.partitionKeyRangeId + - ", isValid: " + this.isValid + - ", statusCode: " + statusCode + - ", subStatusCode: " + subStatusCode + - ", isGone: " + this.isGoneException + - ", isNotFound: " + this.isNotFoundException + - ", isInvalidPartition: " + this.isInvalidPartitionException + - ", requestCharge: " + this.requestCharge + - ", itemLSN: " + this.itemLSN + - ", sessionToken: " + (this.sessionToken != null ? this.sessionToken.convertToString() : null) + - ", exception: " + BridgeInternal.getInnerErrorMessage(this.exception); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TimeoutHelper.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TimeoutHelper.java deleted file mode 100644 index c870d8cf6ed9..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TimeoutHelper.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import java.time.Duration; -import java.time.Instant; - -public class TimeoutHelper { - private final Instant startTime; - private final Duration timeOut; - - public TimeoutHelper(Duration timeOut) { - this.startTime = Instant.now(); - this.timeOut = timeOut; - } - - public boolean isElapsed() { - Duration elapsed = Duration.ofMillis(Instant.now().toEpochMilli() - startTime.toEpochMilli()); - return elapsed.compareTo(this.timeOut) >= 0; - } - - public Duration getRemainingTime() { - Duration elapsed = Duration.ofMillis(Instant.now().toEpochMilli() - startTime.toEpochMilli()); - return this.timeOut.minus(elapsed); - } - - public void throwTimeoutIfElapsed() throws RequestTimeoutException { - if (this.isElapsed()) { - throw new RequestTimeoutException(); - } - } - - public void throwGoneIfElapsed() throws GoneException { - if (this.isElapsed()) { - throw new GoneException(); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/WFConstants.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/WFConstants.java deleted file mode 100644 index 9d177fbffae8..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/WFConstants.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -public class WFConstants { - public static class BackendHeaders { - public static final String RESOURCE_ID = "x-docdb-resource-id"; - public static final String OWNER_ID = "x-docdb-owner-id"; - public static final String ENTITY_ID = "x-docdb-entity-id"; - public static final String DATABASE_ENTITY_MAX_COUNT = "x-ms-database-entity-max-count"; - public static final String DATABASE_ENTITY_CURRENT_COUNT = "x-ms-database-entity-current-count"; - public static final String COLLECTION_ENTITY_MAX_COUNT = "x-ms-collection-entity-max-count"; - public static final String COLLECTION_ENTITY_CURRENT_COUNT = "x-ms-collection-entity-current-count"; - public static final String USER_ENTITY_MAX_COUNT = "x-ms-user-entity-max-count"; - public static final String USER_ENTITY_CURRENT_COUNT = "x-ms-user-entity-current-count"; - public static final String PERMISSION_ENTITY_MAX_COUNT = "x-ms-permission-entity-max-count"; - public static final String PERMISSION_ENTITY_CURRENT_COUNT = "x-ms-permission-entity-current-count"; - public static final String ROOT_ENTITY_MAX_COUNT = "x-ms-root-entity-max-count"; - public static final String ROOT_ENTITY_CURRENT_COUNT = "x-ms-root-entity-current-count"; - public static final String RESOURCE_SCHEMA_NAME = "x-ms-resource-schema-name"; - public static final String LSN = "lsn"; - public static final String QUORUM_ACKED_LSN = "x-ms-quorum-acked-lsn"; - public static final String QUORUM_ACKED_LLSN = "x-ms-cosmos-quorum-acked-llsn"; - public static final String CURRENT_WRITE_QUORUM = "x-ms-current-write-quorum"; - public static final String CURRENT_REPLICA_SET_SIZE = "x-ms-current-replica-set-size"; - public static final String COLLECTION_PARTITION_INDEX = "collection-partition-index"; - public static final String COLLECTION_SERVICE_INDEX = "collection-service-index"; - public static final String STATUS = "Status"; - public static final String ACTIVITY_ID = "ActivityId"; - public static final String IS_FANOUT_REQUEST = "x-ms-is-fanout-request"; - public static final String PRIMARY_MASTER_KEY = "x-ms-primary-master-key"; - public static final String SECONDARY_MASTER_KEY = "x-ms-secondary-master-key"; - public static final String PRIMARY_READONLY_KEY = "x-ms-primary-readonly-key"; - public static final String SECONDARY_READONLY_KEY = "x-ms-secondary-readonly-key"; - public static final String BIND_REPLICA_DIRECTIVE = "x-ms-bind-replica"; - public static final String DATABASE_ACCOUNT_ID = "x-ms-database-account-id"; - public static final String REQUEST_VALIDATION_FAILURE = "x-ms-request-validation-failure"; - public static final String SUB_STATUS = "x-ms-substatus"; - public static final String PARTITION_KEY_RANGE_ID = "x-ms-documentdb-partitionkeyrangeid"; - public static final String BIND_MIN_EFFECTIVE_PARTITION_KEY = "x-ms-documentdb-bindmineffectivepartitionkey"; - public static final String BIND_MAX_EFFECTIVE_PARTITION_KEY = "x-ms-documentdb-bindmaxeffectivepartitionkey"; - public static final String BIND_PARTITION_KEY_RANGE_ID = "x-ms-documentdb-bindpartitionkeyrangeid"; - public static final String BIND_PARTITION_KEY_RANGE_RID_PREFIX = "x-ms-documentdb-bindpartitionkeyrangeridprefix"; - public static final String MINIMUM_ALLOWED_CLIENT_VERSION = "x-ms-documentdb-minimumallowedclientversion"; - public static final String PARTITION_COUNT = "x-ms-documentdb-partitioncount"; - public static final String COLLECTION_RID = "x-ms-documentdb-collection-rid"; - public static final String XP_ROLE = "x-ms-xp-role"; - public static final String HAS_TENTATIVE_WRITES = "x-ms-cosmosdb-has-tentative-writes"; - public static final String IS_RU_PER_MINUTE_USED = "x-ms-documentdb-is-ru-per-minute-used"; - public static final String QUERY_METRICS = "x-ms-documentdb-query-metrics"; - public static final String GLOBAL_COMMITTED_LSN = "x-ms-global-Committed-lsn"; - public static final String NUMBER_OF_READ_REGIONS = "x-ms-number-of-read-regions"; - public static final String OFFER_REPLACE_PENDING = "x-ms-offer-replace-pending"; - public static final String ITEM_LSN = "x-ms-item-lsn"; - public static final String REMOTE_STORAGE_TYPE = "x-ms-remote-storage-type"; - public static final String RESTORE_STATE = "x-ms-restore-state"; - public static final String COLLECTION_SECURITY_IDENTIFIER = "x-ms-collection-security-identifier"; - public static final String RESTORE_PARAMS = "x-ms-restore-params"; - public static final String SHARE_THROUGHPUT = "x-ms-share-throughput"; - public static final String PARTITION_RESOURCE_FILTER = "x-ms-partition-resource-filter"; - public static final String FEDERATION_ID_FOR_AUTH = "x-ms-federation-for-auth"; - public static final String FORCE_QUERY_SCAN = "x-ms-documentdb-force-query-scan"; - public static final String ENABLE_DYNAMIC_RID_RANGE_ALLOCATION = "x-ms-enable-dynamic-rid-range-allocation"; - public static final String EXCLUDE_SYSTEM_PROPERTIES = "x-ms-exclude-system-properties"; - public static final String LOCAL_LSN = "x-ms-cosmos-llsn"; - public static final String QUORUM_ACKED_LOCAL_LSN = "x-ms-cosmos-quorum-acked-llsn"; - public static final String ITEM_LOCAL_LSN = "x-ms-cosmos-item-llsn"; - public static final String BINARY_ID = "x-ms-binary-id"; - public static final String TIME_TO_LIVE_IN_SECONDS = "x-ms-time-to-live-in-seconds"; - public static final String EFFECTIVE_PARTITION_KEY = "x-ms-effective-partition-key"; - public static final String BINARY_PASSTHROUGH_REQUEST = "x-ms-binary-passthrough-request"; - public static final String FANOUT_OPERATION_STATE = "x-ms-fanout-operation-state"; - public static final String CONTENT_SERIALIZATION_FORMAT = "x-ms-documentdb-content-serialization-format"; - public static final String ALLOW_TENTATIVE_WRITES = "x-ms-cosmos-allow-tentative-writes"; - public static final String IS_USER_REQUEST = "x-ms-cosmos-internal-is-user-request"; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/ClientSideMetrics.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/ClientSideMetrics.java deleted file mode 100644 index 8a93a3a16e52..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/ClientSideMetrics.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.query.metrics; - -import org.apache.commons.lang3.tuple.ImmutablePair; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; - -/** - * Client side QueryMetrics - */ -public class ClientSideMetrics { - - public static final ClientSideMetrics ZERO = new ClientSideMetrics( - 0, /* retries*/ - 0, /* requestCharge */ - new ArrayList<>(), /* fetchExecutionRanges */ - new ArrayList<>()); /* partitionSchedulingTimeSpans */ - - private final long retries; - private final double requestCharge; - private final List fetchExecutionRanges; - private final List> partitionSchedulingTimeSpans; - - /** - * Constructor - * - * @param retries The number of retries required to execute the query. - * @param requestCharge The request charge incurred from executing the query. - * @param executionRanges The fetch execution ranges from executing the query. - * @param schedulingTimeSpans The partition scheduling timespans from the query. - */ - public ClientSideMetrics(int retries, double requestCharge, List executionRanges, - List> schedulingTimeSpans) { - if (executionRanges == null || executionRanges.contains(null)) { - throw new NullPointerException("executionRanges"); - } - if (schedulingTimeSpans == null || schedulingTimeSpans.contains(null)) { - throw new NullPointerException("schedulingTimeSpans"); - } - if (retries < 0) { - throw new IllegalArgumentException("retries must not be negative"); - } - if (requestCharge < 0) { - throw new IllegalArgumentException("requestCharge must not be negative"); - } - - this.retries = retries; - this.requestCharge = requestCharge; - this.fetchExecutionRanges = executionRanges; - this.partitionSchedulingTimeSpans = schedulingTimeSpans; - } - - /** - * Gets number of retries in the Azure Cosmos database service - * - * @return the retries - */ - public long getRetries() { - return retries; - } - - /** - * Gets the request charge for this continuation of the query. - * - * @return the requestCharge - */ - public double getRequestCharge() { - return requestCharge; - } - - /** - * create ClientSideMetrics from collection - * - * @param clientSideMetricsCollection - * @return - */ - public static ClientSideMetrics createFromCollection(Collection clientSideMetricsCollection) { - if (clientSideMetricsCollection == null) { - throw new NullPointerException("clientSideMetricsCollection"); - } - - int retries = 0; - double requestCharge = 0; - List fetchExecutionRanges = new ArrayList<>(); - List> partitionSchedulingTimeSpans = new ArrayList<>(); - - for (ClientSideMetrics clientSideQueryMetrics : clientSideMetricsCollection) { - retries += clientSideQueryMetrics.retries; - requestCharge += clientSideQueryMetrics.requestCharge; - fetchExecutionRanges.addAll(clientSideQueryMetrics.fetchExecutionRanges); - partitionSchedulingTimeSpans.addAll(clientSideQueryMetrics.partitionSchedulingTimeSpans); - } - - return new ClientSideMetrics(retries, requestCharge, fetchExecutionRanges, partitionSchedulingTimeSpans); - } - - static double getOrDefault(HashMap metrics, String key) { - Double doubleReference = metrics.get(key); - return doubleReference == null ? 0 : doubleReference; - } - - /** - * Gets the Fetch Execution Ranges for this continuation of the query. - * - * @return the Fetch Execution Ranges for this continuation of the query - */ - public List getFetchExecutionRanges() { - return fetchExecutionRanges; - } - - /** - * Gets the Partition Scheduling TimeSpans for this query. - * - * @return the List of Partition Scheduling TimeSpans for this query - */ - public List> getPartitionSchedulingTimeSpans() { - return partitionSchedulingTimeSpans; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/FetchExecutionRange.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/FetchExecutionRange.java deleted file mode 100644 index 30e1e341c26d..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/FetchExecutionRange.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.query.metrics; - -import java.time.Instant; - -/** - * Stores information about fetch execution - */ -public class FetchExecutionRange { - private final Instant startTime; - private final Instant endTime; - private final String partitionId; - private final long numberOfDocuments; - private final long retryCount; - private final String activityId; - - /** - * Constructor - * - * @param activityId The activityId of the fetch - * @param startTime The start time of the fetch - * @param endTime The end time of the fetch - * @param partitionId The partitionkeyrangeid from which you are fetching for - * @param numberOfDocuments The number of documents that were fetched in the particular execution range - * @param retryCount The number of times we retried for this fetch execution range - */ - FetchExecutionRange(String activityId, Instant startTime, Instant endTime, String partitionId, long numberOfDocuments, long retryCount) { - this.activityId = activityId; - this.startTime = startTime; - this.endTime = endTime; - this.partitionId = partitionId; - this.numberOfDocuments = numberOfDocuments; - this.retryCount = retryCount; - } - - /** - * Gets the start time of the fetch. - * - * @return the start time of the fetch. - */ - public Instant getStartTime() { - return startTime; - } - - /** - * Gets the end time of the fetch. - * - * @return the end time of the fetch. - */ - public Instant getEndTime() { - return endTime; - } - - /** - * Gets the partition id that was fetched from. - * - * @return the partition id that was fetched from. - */ - public String getPartitionId() { - return partitionId; - } - - /** - * Gets the number of documents that where fetched in the particular execution range. - * - * @return the number of documents that where fetched in the particular execution range. - */ - public long getNumberOfDocuments() { - return numberOfDocuments; - } - - /** - * Gets the number of times we retried for this fetch execution range. - * - * @return the number of times we retried for this fetch execution range. - */ - public long getRetryCount() { - return retryCount; - } - - /** - * Gets the activityId of the fetch. - * - * @return the activityId of the fetch. - */ - public String getActivityId() { - return activityId; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/FetchExecutionRangeAccumulator.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/FetchExecutionRangeAccumulator.java deleted file mode 100644 index cb67879c01aa..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/FetchExecutionRangeAccumulator.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.query.metrics; - -import org.apache.commons.lang3.time.StopWatch; - -import java.time.Duration; -import java.time.Instant; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; - -/** - * Accumlator that acts as a builder of FetchExecutionRanges - */ -public class FetchExecutionRangeAccumulator { - private final String partitionKeyRangeId; - private final Instant constructionTime; - private final StopWatch stopwatch; - private List fetchExecutionRanges; - private Instant startTime; - private Instant endTime; - private boolean isFetching; - - public FetchExecutionRangeAccumulator(String partitionKeyRangeId) { - this.partitionKeyRangeId = partitionKeyRangeId; - this.constructionTime = Instant.now(); - // This stopwatch is always running and is only used to calculate deltas that are synchronized with the construction time. - this.stopwatch = new StopWatch(); - stopwatch.start(); - this.fetchExecutionRanges = new ArrayList(); - } - - /** - * Gets the FetchExecutionRanges and resets the accumulator. - * - * @return the SchedulingMetricsResult. - */ - public List getExecutionRanges() { - List returnValue = this.fetchExecutionRanges; - this.fetchExecutionRanges = new ArrayList<>(); - return returnValue; - } - - /** - * Updates the most recent start time internally. - */ - public void beginFetchRange() { - if (!this.isFetching) { - // Calculating the start time as the construction time and the stopwatch as a delta. - this.startTime = this.constructionTime.plus(Duration.ofMillis(this.stopwatch.getTime(TimeUnit.MILLISECONDS))); - this.isFetching = true; - } - } - - /** - * Updates the most recent end time internally and constructs a new FetchExecutionRange - * - * @param numberOfDocuments The number of documents that were fetched for this range. - * @param retryCount The number of times we retried for this fetch execution range. - */ - public void endFetchRange(String activityId, long numberOfDocuments, long retryCount) { - if (this.isFetching) { - // Calculating the end time as the construction time and the stopwatch as a delta. - this.endTime = this.constructionTime.plus(Duration.ofMillis(this.stopwatch.getTime(TimeUnit.MILLISECONDS))); - FetchExecutionRange fetchExecutionRange = new FetchExecutionRange( - activityId, - this.startTime, - this.endTime, - this.partitionKeyRangeId, - numberOfDocuments, - retryCount); - this.fetchExecutionRanges.add(fetchExecutionRange); - this.isFetching = false; - } - } - -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/QueryMetricsTextWriter.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/QueryMetricsTextWriter.java deleted file mode 100644 index 72c6383b0054..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/QueryMetricsTextWriter.java +++ /dev/null @@ -1,600 +0,0 @@ -package com.microsoft.azure.cosmosdb.internal.query.metrics; - -import org.apache.commons.lang3.StringUtils; - -import java.time.Duration; -import java.time.Instant; -import java.time.ZoneOffset; -import java.time.format.DateTimeFormatter; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.UUID; - -public class QueryMetricsTextWriter extends QueryMetricsWriter { - - private final StringBuilder stringBuilder; - - // QueryMetrics - private static final String ActivityIds = "Activity Ids"; - private static final String RetrievedDocumentCount = "Retrieved Document Count"; - private static final String RetrievedDocumentSize = "Retrieved Document Size"; - private static final String OutputDocumentCount = "Output Document Count"; - private static final String OutputDocumentSize = "Output Document Size"; - private static final String IndexUtilizationText = "Index Utilization"; - private static final String TotalQueryExecutionTime = "Total Query Execution Time"; - - // QueryPreparationTimes - private static final String QueryPreparationTimes = "Query Preparation Times"; - private static final String QueryCompileTime = "Query Compilation Time"; - private static final String LogicalPlanBuildTime = "Logical Plan Build Time"; - private static final String PhysicalPlanBuildTime = "Physical Plan Build Time"; - private static final String QueryOptimizationTime = "Query Optimization Time"; - - // QueryTimes - private static final String QueryEngineTimes = "Query Engine Times"; - private static final String IndexLookupTime = "Index Lookup Time"; - private static final String DocumentLoadTime = "Document Load Time"; - private static final String DocumentWriteTime = "Document Write Time"; - - // RuntimeExecutionTimes - private static final String RuntimeExecutionTimes = "Runtime Execution Times"; - private static final String TotalExecutionTime = "Query Engine Execution Time"; - private static final String SystemFunctionExecuteTime = "System Function Execution Time"; - private static final String UserDefinedFunctionExecutionTime = "User-defined Function Execution Time"; - - // ClientSideQueryMetrics - private static final String ClientSideQueryMetrics = "Client Side Metrics"; - private static final String Retries = "Retry Count"; - private static final String RequestCharge = "Request Charge"; - private static final String FetchExecutionRanges = "Partition Execution Timeline"; - private static final String SchedulingMetrics = "Scheduling Metrics"; - - // Constants for Partition Execution Timeline Table - private static final String StartTimeHeader = "Start Time (UTC)"; - private static final String EndTimeHeader = "End Time (UTC)"; - private static final String DurationHeader = "Duration (ms)"; - private static final String PartitionKeyRangeIdHeader = "Partition Id"; - private static final String NumberOfDocumentsHeader = "Number of Documents"; - private static final String RetryCountHeader = "Retry Count"; - private static final String ActivityIdHeader = "Activity Id"; - - // Constants for Scheduling Metrics Table - private static final String PartitionIdHeader = "Partition Id"; - private static final String ResponseTimeHeader = "Response Time (ms)"; - private static final String RunTimeHeader = "Run Time (ms)"; - private static final String WaitTimeHeader = "Wait Time (ms)"; - private static final String TurnaroundTimeHeader = "Turnaround Time (ms)"; - private static final String NumberOfPreemptionHeader = "Number of Preemptions"; - - // Static for Partition Execution Timeline Table - // private static int MaxDateTimeStringLength = LocalDateTime.MAX.toString().length(); - private static final int MaxDateTimeStringLength = 16; - private static final int StartTimeHeaderLength = Math.max(MaxDateTimeStringLength, StartTimeHeader.length()); - private static final int EndTimeHeaderLength = Math.max(MaxDateTimeStringLength, EndTimeHeader.length()); - private static final int DurationHeaderLength = DurationHeader.length(); - private static final int PartitionKeyRangeIdHeaderLength = PartitionKeyRangeIdHeader.length(); - private static final int NumberOfDocumentsHeaderLength = NumberOfDocumentsHeader.length(); - private static final int RetryCountHeaderLength = RetryCountHeader.length(); - private static final int ActivityIdHeaderLength = UUID.randomUUID().toString().length(); - - private static TextTable.Column[] PartitionExecutionTimelineColumns = new TextTable.Column[] - { - new TextTable.Column(PartitionKeyRangeIdHeader, PartitionKeyRangeIdHeaderLength), - new TextTable.Column(ActivityIdHeader, ActivityIdHeaderLength), - new TextTable.Column(StartTimeHeader, StartTimeHeaderLength), - new TextTable.Column(EndTimeHeader, EndTimeHeaderLength), - new TextTable.Column(DurationHeader, DurationHeaderLength), - new TextTable.Column(NumberOfDocumentsHeader, NumberOfDocumentsHeaderLength), - new TextTable.Column(RetryCountHeader, RetryCountHeaderLength), - }; - - private static TextTable PartitionExecutionTimelineTable = new TextTable(Arrays.asList(PartitionExecutionTimelineColumns)); - - // Static for Scheduling Metrics Table - //private static readonly int MaxTimeSpanStringLength = Math.Max(TimeSpan.MaxValue.TotalMilliseconds.ToString - // ("G17").Length, TurnaroundTimeHeader.Length); - private static final int PartitionIdHeaderLength = PartitionIdHeader.length(); - private static final int ResponseTimeHeaderLength = ResponseTimeHeader.length(); - private static final int RunTimeHeaderLength = RunTimeHeader.length(); - private static final int WaitTimeHeaderLength = WaitTimeHeader.length(); - private static final int TurnaroundTimeHeaderLength = TurnaroundTimeHeader.length(); - private static final int NumberOfPreemptionHeaderLength = NumberOfPreemptionHeader.length(); - - private static TextTable.Column[] SchedulingMetricsColumns = new TextTable.Column[] - { - new TextTable.Column(PartitionIdHeader, PartitionIdHeaderLength), - new TextTable.Column(ResponseTimeHeader, ResponseTimeHeaderLength), - new TextTable.Column(RunTimeHeader, RunTimeHeaderLength), - new TextTable.Column(WaitTimeHeader, WaitTimeHeaderLength), - new TextTable.Column(TurnaroundTimeHeader, TurnaroundTimeHeaderLength), - new TextTable.Column(NumberOfPreemptionHeader, NumberOfPreemptionHeaderLength), - }; - - private static TextTable SchedulingMetricsTable = new TextTable(Arrays.asList(SchedulingMetricsColumns)); - - // FetchExecutionRange state - private String lastFetchPartitionId; - private String lastActivityId; - private Instant lastStartTime; - private Instant lastEndTime; - private long lastFetchDocumentCount; - private long lastFetchRetryCount; - - // PartitionSchedulingTimeSpan state - private String lastSchedulingPartitionId; - private long lastResponseTime; - private long lastRunTime; - private long lastWaitTime; - private long lastTurnaroundTime; - private long lastNumberOfPreemptions; - - static DateTimeFormatter formatter = - DateTimeFormatter.ofPattern("HH:mm:ss:SSSS").withZone(ZoneOffset.UTC); - - public QueryMetricsTextWriter(StringBuilder stringBuilder) { - assert stringBuilder != null; - this.stringBuilder = stringBuilder; - } - - @Override - protected void writeBeforeQueryMetrics() { - // Do Nothing - } - - @Override - protected void writeRetrievedDocumentCount(long retrievedDocumentCount) { - QueryMetricsTextWriter.appendCountToStringBuilder(stringBuilder, - QueryMetricsTextWriter.RetrievedDocumentCount, retrievedDocumentCount, 0); - } - - @Override - protected void writeRetrievedDocumentSize(long retrievedDocumentSize) { - QueryMetricsTextWriter.appendBytesToStringBuilder(stringBuilder, QueryMetricsTextWriter.RetrievedDocumentSize - , retrievedDocumentSize, 0); - } - - @Override - protected void writeOutputDocumentCount(long outputDocumentCount) { - QueryMetricsTextWriter.appendCountToStringBuilder(stringBuilder, QueryMetricsTextWriter.OutputDocumentCount, - outputDocumentCount, 0); - } - - @Override - protected void writeOutputDocumentSize(long outputDocumentSize) { - QueryMetricsTextWriter.appendBytesToStringBuilder(stringBuilder, QueryMetricsTextWriter.OutputDocumentSize, - outputDocumentSize, 0); - } - - @Override - protected void writeIndexHitRatio(double indexHitRatio) { - QueryMetricsTextWriter.appendPercentageToStringBuilder(stringBuilder, QueryMetricsTextWriter.IndexUtilizationText - , indexHitRatio, 0); - } - - @Override - protected void writeTotalQueryExecutionTime(Duration totalQueryExecutionTime) { - QueryMetricsTextWriter.appendNanosecondsToStringBuilder(stringBuilder, - QueryMetricsTextWriter.TotalQueryExecutionTime, durationToMilliseconds(totalQueryExecutionTime), 0); - } - - @Override - protected void writeBeforeQueryPreparationTimes() { - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, - QueryMetricsTextWriter.QueryPreparationTimes, 1); - } - - @Override - protected void writeQueryCompilationTime(Duration queryCompilationTime) { - QueryMetricsTextWriter.appendMillisecondsToStringBuilder(stringBuilder, - QueryMetricsTextWriter.QueryCompileTime, durationToMilliseconds(queryCompilationTime), 2); - } - - @Override - protected void writeLogicalPlanBuildTime(Duration logicalPlanBuildTime) { - QueryMetricsTextWriter.appendMillisecondsToStringBuilder(stringBuilder, - QueryMetricsTextWriter.LogicalPlanBuildTime, durationToMilliseconds(logicalPlanBuildTime), 2); - } - - @Override - protected void writePhysicalPlanBuildTime(Duration physicalPlanBuildTime) { - QueryMetricsTextWriter.appendMillisecondsToStringBuilder(stringBuilder, - QueryMetricsTextWriter.PhysicalPlanBuildTime, durationToMilliseconds(physicalPlanBuildTime), 2); - } - - @Override - protected void writeQueryOptimizationTime(Duration queryOptimizationTime) { - QueryMetricsTextWriter.appendMillisecondsToStringBuilder(stringBuilder, - QueryMetricsTextWriter.QueryOptimizationTime, durationToMilliseconds(queryOptimizationTime), 2); - } - - @Override - protected void writeAfterQueryPreparationTimes() { - // Do Nothing - } - - @Override - protected void writeIndexLookupTime(Duration indexLookupTime) { - QueryMetricsTextWriter.appendMillisecondsToStringBuilder(stringBuilder, - QueryMetricsTextWriter.IndexLookupTime, durationToMilliseconds(indexLookupTime), 1); - } - - @Override - protected void writeDocumentLoadTime(Duration documentLoadTime) { - QueryMetricsTextWriter.appendMillisecondsToStringBuilder(stringBuilder, - QueryMetricsTextWriter.DocumentLoadTime, durationToMilliseconds(documentLoadTime), 1); - } - - @Override - protected void writeVMExecutionTime(Duration vMExecutionTime) { - // Do Nothing - } - - @Override - protected void writeBeforeRuntimeExecutionTimes() { - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, - QueryMetricsTextWriter.RuntimeExecutionTimes, 1); - } - - @Override - protected void writeQueryEngineExecutionTime(Duration queryEngineExecutionTime) { - QueryMetricsTextWriter.appendMillisecondsToStringBuilder(stringBuilder, - QueryMetricsTextWriter.QueryEngineTimes, durationToMilliseconds(queryEngineExecutionTime), 2); - } - - @Override - protected void writeSystemFunctionExecutionTime(Duration systemFunctionExecutionTime) { - QueryMetricsTextWriter.appendMillisecondsToStringBuilder(stringBuilder, - QueryMetricsTextWriter.SystemFunctionExecuteTime, durationToMilliseconds(systemFunctionExecutionTime) - , 2); - } - - @Override - protected void writeUserDefinedFunctionExecutionTime(Duration userDefinedFunctionExecutionTime) { - QueryMetricsTextWriter.appendMillisecondsToStringBuilder(stringBuilder, - QueryMetricsTextWriter.UserDefinedFunctionExecutionTime, - durationToMilliseconds(userDefinedFunctionExecutionTime), 2); - } - - @Override - protected void writeAfterRuntimeExecutionTimes() { - // Do Nothing - } - - @Override - protected void writeDocumentWriteTime(Duration documentWriteTime) { - QueryMetricsTextWriter.appendMillisecondsToStringBuilder(stringBuilder, - QueryMetricsTextWriter.DocumentWriteTime, durationToMilliseconds(documentWriteTime), 1); - } - - @Override - protected void writeBeforeClientSideMetrics() { - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, - QueryMetricsTextWriter.ClientSideQueryMetrics, 0); - } - - @Override - protected void writeRetries(long retries) { - QueryMetricsTextWriter.appendCountToStringBuilder(stringBuilder, QueryMetricsTextWriter.Retries, retries, 1); - } - - @Override - protected void writeRequestCharge(double requestCharge) { - QueryMetricsTextWriter.appendRUToStringBuilder(stringBuilder, QueryMetricsTextWriter.RequestCharge, - requestCharge, 1); - } - - @Override - protected void writeBeforePartitionExecutionTimeline() { - QueryMetricsTextWriter.appendNewlineToStringBuilder(stringBuilder); - - // Building the table for fetch execution ranges - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, QueryMetricsTextWriter.FetchExecutionRanges - , 1); - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, PartitionExecutionTimelineTable.getTopLine(), 1); - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, PartitionExecutionTimelineTable.getHeader(), 1); - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, PartitionExecutionTimelineTable.getMiddleLine(), 1); - } - - @Override - protected void writeBeforeFetchExecutionRange() { - // Do Nothing - } - - @Override - protected void writeFetchPartitionKeyRangeId(String partitionId) { - this.lastFetchPartitionId = partitionId; - } - - @Override - protected void writeActivityId(String activityId) { - this.lastActivityId = activityId; - } - - @Override - protected void writeStartTime(Instant startTime) { - this.lastStartTime = startTime; - } - - @Override - protected void writeEndTime(Instant endTime) { - this.lastEndTime = endTime; - } - - @Override - protected void writeFetchDocumentCount(long numberOfDocuments) { - this.lastFetchDocumentCount = numberOfDocuments; - } - - @Override - protected void writeFetchRetryCount(long retryCount) { - this.lastFetchRetryCount = retryCount; - } - - @Override - protected void writeAfterFetchExecutionRange() { - QueryMetricsTextWriter.appendHeaderToStringBuilder( - stringBuilder, - PartitionExecutionTimelineTable.getRow(Arrays.asList( - this.lastFetchPartitionId, - this.lastActivityId, - formatter.format(this.lastStartTime), - formatter.format(this.lastEndTime), - nanosToMilliSeconds(this.lastEndTime.minusNanos(lastStartTime.getNano()).getNano()), - this.lastFetchDocumentCount, - this.lastFetchRetryCount)), - 1); - } - - @Override - protected void writeAfterPartitionExecutionTimeline() { - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, PartitionExecutionTimelineTable.getBottomLine(), - 1); - } - - @Override - protected void writeBeforeSchedulingMetrics() { - QueryMetricsTextWriter.appendNewlineToStringBuilder(stringBuilder); - - // Building the table for scheduling metrics - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, QueryMetricsTextWriter.SchedulingMetrics, 1); - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, SchedulingMetricsTable.getTopLine(), 1); - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, SchedulingMetricsTable.getHeader(), 1); - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, SchedulingMetricsTable.getMiddleLine(), 1); - } - - @Override - protected void writeBeforePartitionSchedulingDuration() { - // Do Nothing - } - - @Override - protected void writePartitionSchedulingDurationId(String partitionId) { - this.lastSchedulingPartitionId = partitionId; - } - - @Override - protected void writeResponseTime(long responseTime) { - this.lastResponseTime = responseTime; - } - - @Override - protected void writeRunTime(long runTime) { - this.lastRunTime = runTime; - } - - @Override - protected void writeWaitTime(long waitTime) { - this.lastWaitTime = waitTime; - } - - @Override - protected void writeTurnaroundTime(long turnaroundTime) { - this.lastTurnaroundTime = turnaroundTime; - } - - @Override - protected void writeNumberOfPreemptions(long numPreemptions) { - this.lastNumberOfPreemptions = numPreemptions; - } - - @Override - protected void writeAfterPartitionSchedulingDuration() { - QueryMetricsTextWriter.appendHeaderToStringBuilder( - stringBuilder, - SchedulingMetricsTable.getRow(Arrays.asList( - this.lastSchedulingPartitionId, - this.lastResponseTime, - this.lastRunTime, - this.lastWaitTime, - this.lastTurnaroundTime, - this.lastNumberOfPreemptions)), - 1); - } - - @Override - protected void writeAfterSchedulingMetrics() { - QueryMetricsTextWriter.appendHeaderToStringBuilder(stringBuilder, SchedulingMetricsTable.getBottomLine(), 1); - } - - @Override - protected void writeAfterClientSideMetrics() { - // Do Nothing - } - - @Override - protected void writeAfterQueryMetrics() { - // Do Nothing - } - - // Util functions - private static final int NANOS_TO_MILLIS = 1000000; - - static HashMap parseDelimitedString(String delimitedString) { - if (delimitedString == null) { - throw new NullPointerException("delimitedString"); - } - - HashMap metrics = new HashMap<>(); - - final int key = 0; - final int value = 1; - String[] headerAttributes = StringUtils.split(delimitedString, ";"); - - for (String attribute : headerAttributes) { - String[] attributeKeyValue = StringUtils.split(attribute, "="); - - if (attributeKeyValue.length != 2) { - throw new NullPointerException("recieved a malformed delimited String"); - } - - String attributeKey = attributeKeyValue[key]; - double attributeValue = Double.parseDouble(attributeKeyValue[value]); - metrics.put(attributeKey, attributeValue); - } - - return metrics; - } - - static Duration durationFromMetrics(HashMap metrics, String key) { - // Just attempt to get the metrics - Double durationInMilliseconds = metrics.get(key); - if (durationInMilliseconds == null) { - return Duration.ZERO; - } - - long seconds = (long) (durationInMilliseconds / 1e3); - long nanoseconds = (long) ((durationInMilliseconds - (seconds * 1e3)) * 1e6); - - return Duration.ofSeconds(seconds, nanoseconds); - } - - static double durationToMilliseconds(Duration duration) { - double seconds = duration.getSeconds(); - double nano = duration.getNano(); - - return (seconds * 1e3) + (nano / 1e6); - } - - static Duration getDurationFromMetrics(HashMap metrics, String key) { - double timeSpanInMilliseconds; - Duration timeSpanFromMetrics; - timeSpanInMilliseconds = metrics.get(key); - timeSpanFromMetrics = doubleMillisecondsToDuration(timeSpanInMilliseconds); - return timeSpanFromMetrics; - } - - private static Duration doubleMillisecondsToDuration(double timeSpanInMilliseconds) { - long timeInNanoSeconds = (long) (timeSpanInMilliseconds * NANOS_TO_MILLIS); - return Duration.ofNanos(timeInNanoSeconds); - } - - private static void appendToStringBuilder(StringBuilder stringBuilder, String property, String value, - String units, int indentLevel) { - final String Indent = " "; - final String FormatString = "%-40s : %15s %-12s %s"; - - stringBuilder.append(String.format( - Locale.ROOT, - FormatString, - StringUtils.repeat(Indent, indentLevel) + property, - value, - units, - System.lineSeparator())); - } - - static void appendBytesToStringBuilder(StringBuilder stringBuilder, String property, long bytes, int indentLevel) { - final String BytesFormatString = "%d"; - final String BytesUnitString = "bytes"; - - appendToStringBuilder( - stringBuilder, - property, - String.format(BytesFormatString, bytes), - BytesUnitString, - indentLevel); - } - - static void appendMillisecondsToStringBuilder(StringBuilder stringBuilder, String property, double milliseconds, - int indentLevel) { - final String MillisecondsFormatString = "%f"; - final String MillisecondsUnitString = "milliseconds"; - - appendToStringBuilder(stringBuilder, property, String.format(MillisecondsFormatString, - milliseconds), MillisecondsUnitString, indentLevel); - } - - static void appendNanosecondsToStringBuilder(StringBuilder stringBuilder, String property, double nanoSeconds, - int indentLevel) { - final String MillisecondsFormatString = "%.2f"; - final String MillisecondsUnitString = "milliseconds"; - appendToStringBuilder(stringBuilder, property, String.format(MillisecondsFormatString, - nanosToMilliSeconds(nanoSeconds)), MillisecondsUnitString, indentLevel); - } - - static double nanosToMilliSeconds(double nanos) { - return nanos / NANOS_TO_MILLIS; - } - - static void appendHeaderToStringBuilder(StringBuilder stringBuilder, String headerTitle, int indentLevel) { - final String Indent = " "; - final String FormatString = "%s %s"; - stringBuilder.append(String.format( - Locale.ROOT, - FormatString, - String.join(StringUtils.repeat(Indent, indentLevel)) + headerTitle, - System.lineSeparator())); - } - - static void appendRUToStringBuilder(StringBuilder stringBuilder, String property, double requestCharge, - int indentLevel) { - final String RequestChargeFormatString = "%s"; - final String RequestChargeUnitString = "RUs"; - - appendToStringBuilder( - stringBuilder, - property, - String.format(Locale.ROOT, RequestChargeFormatString, requestCharge), - RequestChargeUnitString, - indentLevel); - } - - static void appendActivityIdsToStringBuilder(StringBuilder stringBuilder, String activityIdsLabel, - List activityIds, int indentLevel) { - final String Indent = " "; - stringBuilder.append(activityIdsLabel); - stringBuilder.append(System.lineSeparator()); - for (String activityId : activityIds) { - stringBuilder.append(Indent); - stringBuilder.append(activityId); - stringBuilder.append(System.lineSeparator()); - } - } - - static void appendPercentageToStringBuilder(StringBuilder stringBuilder, String property, double percentage, - int indentLevel) { - final String PercentageFormatString = "%.2f"; - final String PercentageUnitString = "%"; - - appendToStringBuilder(stringBuilder, property, String.format(PercentageFormatString, - percentage * 100), PercentageUnitString, indentLevel); - } - - static void appendCountToStringBuilder(StringBuilder stringBuilder, String property, long count, int indentLevel) { - final String CountFormatString = "%s"; - final String CountUnitString = ""; - - appendToStringBuilder( - stringBuilder, - property, - String.format(CountFormatString, count), - CountUnitString, - indentLevel); - } - - static void appendNewlineToStringBuilder(StringBuilder stringBuilder) { - appendHeaderToStringBuilder(stringBuilder, StringUtils.EMPTY, 0); - } - -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/QueryMetricsWriter.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/QueryMetricsWriter.java deleted file mode 100644 index 575760ec7b50..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/QueryMetricsWriter.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.microsoft.azure.cosmosdb.internal.query.metrics; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.QueryMetrics; -import com.microsoft.azure.cosmosdb.QueryPreparationTimes; -import com.microsoft.azure.cosmosdb.RuntimeExecutionTimes; -import org.apache.commons.lang3.tuple.ImmutablePair; - -import java.time.Duration; -import java.time.Instant; -import java.util.List; - -abstract class QueryMetricsWriter { - - public void writeQueryMetrics(QueryMetrics queryMetrics) { - this.writeBeforeQueryMetrics(); - - // Top Level Properties - this.writeRetrievedDocumentCount(queryMetrics.getRetrievedDocumentCount()); - this.writeRetrievedDocumentSize(queryMetrics.getRetrievedDocumentSize()); - this.writeOutputDocumentCount(queryMetrics.getOutputDocumentCount()); - this.writeOutputDocumentSize(queryMetrics.getOutputDocumentSize()); - this.writeIndexHitRatio(queryMetrics.getIndexHitRatio()); - this.writeTotalQueryExecutionTime(queryMetrics.getTotalQueryExecutionTime()); - - // QueryPreparationTimes - this.writeQueryPreparationTimes(queryMetrics.getQueryPreparationTimes()); - - this.writeIndexLookupTime(queryMetrics.getIndexLookupTime()); - this.writeDocumentLoadTime(queryMetrics.getDocumentLoadTime()); - this.writeVMExecutionTime(queryMetrics.getVMExecutionTime()); - - // RuntimesExecutionTimes - this.writeRuntimesExecutionTimes(queryMetrics.getRuntimeExecutionTimes()); - - this.writeDocumentWriteTime(queryMetrics.getDocumentWriteTime()); - - // ClientSideMetrics - this.writeClientSideMetrics(BridgeInternal.getClientSideMetrics(queryMetrics)); - - this.writeAfterQueryMetrics(); - } - - protected abstract void writeBeforeQueryMetrics(); - - protected abstract void writeRetrievedDocumentCount(long retrievedDocumentCount); - - protected abstract void writeRetrievedDocumentSize(long retrievedDocumentSize); - - protected abstract void writeOutputDocumentCount(long outputDocumentCount); - - protected abstract void writeOutputDocumentSize(long outputDocumentSize); - - protected abstract void writeIndexHitRatio(double indexHitRatio); - - protected abstract void writeTotalQueryExecutionTime(Duration totalQueryExecutionTime); - - //QueryPreparationTimes - private void writeQueryPreparationTimes(QueryPreparationTimes queryPreparationTimes) { - this.writeBeforeQueryPreparationTimes(); - - this.writeQueryCompilationTime(queryPreparationTimes.getQueryCompilationTime()); - this.writeLogicalPlanBuildTime(queryPreparationTimes.getLogicalPlanBuildTime()); - this.writePhysicalPlanBuildTime(queryPreparationTimes.getPhysicalPlanBuildTime()); - this.writeQueryOptimizationTime(queryPreparationTimes.getQueryOptimizationTime()); - - this.writeAfterQueryPreparationTimes(); - } - - protected abstract void writeBeforeQueryPreparationTimes(); - - protected abstract void writeQueryCompilationTime(Duration queryCompilationTime); - - protected abstract void writeLogicalPlanBuildTime(Duration logicalPlanBuildTime); - - protected abstract void writePhysicalPlanBuildTime(Duration physicalPlanBuildTime); - - protected abstract void writeQueryOptimizationTime(Duration queryOptimizationTime); - - protected abstract void writeAfterQueryPreparationTimes(); - - protected abstract void writeIndexLookupTime(Duration indexLookupTime); - - protected abstract void writeDocumentLoadTime(Duration documentLoadTime); - - protected abstract void writeVMExecutionTime(Duration vMExecutionTime); - - // RuntimeExecutionTimes - private void writeRuntimesExecutionTimes(RuntimeExecutionTimes runtimeExecutionTimes) { - this.writeBeforeRuntimeExecutionTimes(); - - this.writeQueryEngineExecutionTime(runtimeExecutionTimes.getQueryEngineExecutionTime()); - this.writeSystemFunctionExecutionTime(runtimeExecutionTimes.getSystemFunctionExecutionTime()); - this.writeUserDefinedFunctionExecutionTime(runtimeExecutionTimes.getUserDefinedFunctionExecutionTime()); - - this.writeAfterRuntimeExecutionTimes(); - } - - - protected abstract void writeBeforeRuntimeExecutionTimes(); - - protected abstract void writeQueryEngineExecutionTime(Duration queryEngineExecutionTime); - - protected abstract void writeSystemFunctionExecutionTime(Duration systemFunctionExecutionTime); - - protected abstract void writeUserDefinedFunctionExecutionTime(Duration userDefinedFunctionExecutionTime); - - protected abstract void writeAfterRuntimeExecutionTimes(); - - protected abstract void writeDocumentWriteTime(Duration documentWriteTime); - - // ClientSideMetrics - private void writeClientSideMetrics(ClientSideMetrics clientSideMetrics) { - this.writeBeforeClientSideMetrics(); - - this.writeRetries(clientSideMetrics.getRetries()); - this.writeRequestCharge(clientSideMetrics.getRequestCharge()); - this.writePartitionExecutionTimeline(clientSideMetrics); - this.writeSchedulingMetrics(clientSideMetrics); - - this.writeAfterClientSideMetrics(); - } - - protected abstract void writeBeforeClientSideMetrics(); - - protected abstract void writeRetries(long retries); - - protected abstract void writeRequestCharge(double requestCharge); - - private void writePartitionExecutionTimeline(ClientSideMetrics clientSideMetrics) { - this.writeBeforePartitionExecutionTimeline(); - List fetchExecutionRanges = clientSideMetrics.getFetchExecutionRanges(); - fetchExecutionRanges.sort((f1, f2) -> f2.getStartTime().compareTo(f1.getStartTime())); - for (FetchExecutionRange fetchExecutionRange : clientSideMetrics.getFetchExecutionRanges()) { - this.writeFetchExecutionRange(fetchExecutionRange); - } - this.writeAfterPartitionExecutionTimeline(); - } - - protected abstract void writeBeforePartitionExecutionTimeline(); - - private void writeFetchExecutionRange(FetchExecutionRange fetchExecutionRange) { - this.writeBeforeFetchExecutionRange(); - - this.writeFetchPartitionKeyRangeId(fetchExecutionRange.getPartitionId()); - this.writeActivityId(fetchExecutionRange.getActivityId()); - this.writeStartTime(fetchExecutionRange.getStartTime()); - this.writeEndTime(fetchExecutionRange.getEndTime()); - this.writeFetchDocumentCount(fetchExecutionRange.getNumberOfDocuments()); - this.writeFetchRetryCount(fetchExecutionRange.getRetryCount()); - - this.writeAfterFetchExecutionRange(); - } - - protected abstract void writeBeforeFetchExecutionRange(); - - protected abstract void writeFetchPartitionKeyRangeId(String partitionId); - - protected abstract void writeActivityId(String activityId); - - protected abstract void writeStartTime(Instant startTime); - - protected abstract void writeEndTime(Instant endTime); - - protected abstract void writeFetchDocumentCount(long numberOfDocuments); - - protected abstract void writeFetchRetryCount(long retryCount); - - protected abstract void writeAfterFetchExecutionRange(); - - protected abstract void writeAfterPartitionExecutionTimeline(); - - private void writeSchedulingMetrics(ClientSideMetrics clientSideMetrics) { - this.writeBeforeSchedulingMetrics(); - List> partitionSchedulingTimeSpans = clientSideMetrics.getPartitionSchedulingTimeSpans(); - partitionSchedulingTimeSpans.sort((o1, o2) -> (int) (o2.right.getResponseTime() - o1.right.getResponseTime())); - for (ImmutablePair partitionSchedulingDuration : - partitionSchedulingTimeSpans) { - String partitionId = partitionSchedulingDuration.getLeft(); - SchedulingTimeSpan schedulingDuration = partitionSchedulingDuration.getRight(); - - this.writePartitionSchedulingDuration(partitionId, schedulingDuration); - } - - this.writeAfterSchedulingMetrics(); - } - - protected abstract void writeBeforeSchedulingMetrics(); - - private void writePartitionSchedulingDuration(String partitionId, SchedulingTimeSpan schedulingDuration) { - this.writeBeforePartitionSchedulingDuration(); - - this.writePartitionSchedulingDurationId(partitionId); - this.writeResponseTime(schedulingDuration.getResponseTime()); - this.writeRunTime(schedulingDuration.getRunTime()); - this.writeWaitTime(schedulingDuration.getWaitTime()); - this.writeTurnaroundTime(schedulingDuration.getTurnaroundTime()); - this.writeNumberOfPreemptions(schedulingDuration.getNumPreemptions()); - - this.writeAfterPartitionSchedulingDuration(); - } - - protected abstract void writeBeforePartitionSchedulingDuration(); - - protected abstract void writePartitionSchedulingDurationId(String partitionId); - - protected abstract void writeResponseTime(long responseTime); - - protected abstract void writeRunTime(long runTime); - - protected abstract void writeWaitTime(long waitTime); - - protected abstract void writeTurnaroundTime(long turnaroundTime); - - protected abstract void writeNumberOfPreemptions(long numPreemptions); - - protected abstract void writeAfterPartitionSchedulingDuration(); - - protected abstract void writeAfterSchedulingMetrics(); - - protected abstract void writeAfterClientSideMetrics(); - - protected abstract void writeAfterQueryMetrics(); - -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/SchedulingStopwatch.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/SchedulingStopwatch.java deleted file mode 100644 index eac7270f90be..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/SchedulingStopwatch.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.query.metrics; - -import org.apache.commons.lang3.time.StopWatch; - -public class SchedulingStopwatch { - private StopWatch turnaroundTimeStopwatch; - private StopWatch responseTimeStopwatch; - private StopWatch runTimeStopwatch; - private long numPreemptions; - private boolean responded; - - public SchedulingStopwatch() { - this.turnaroundTimeStopwatch = new StopWatch(); - this.responseTimeStopwatch = new StopWatch(); - this.runTimeStopwatch = new StopWatch(); - } - - public SchedulingTimeSpan getElapsedTime() { - return new SchedulingTimeSpan(this.turnaroundTimeStopwatch.getTime(), this.responseTimeStopwatch.getTime(), - this.runTimeStopwatch.getTime(), - this.turnaroundTimeStopwatch.getTime() - this.runTimeStopwatch.getTime(), this.numPreemptions); - } - - /** - * Tells the SchedulingStopwatch know that the process is in a state where it is ready to be worked on, - * which in turn starts the stopwatch for for response time and turnaround time. - */ - public void ready() { - startStopWatch(this.turnaroundTimeStopwatch); - startStopWatch(this.responseTimeStopwatch); - } - - public void start() { - if (!this.runTimeStopwatch.isStarted()) { - if (!this.responded) { - // This is the first time the process got a response, so the response time stopwatch needs to stop. - this.responseTimeStopwatch.stop(); - this.responded = true; - } - this.runTimeStopwatch.reset(); - startStopWatch(this.runTimeStopwatch); - } - } - - public void stop() { - if (this.runTimeStopwatch.isStarted()) { - stopStopWatch(this.runTimeStopwatch); - this.numPreemptions++; - } - } - - public void terminate() { - stopStopWatch(this.turnaroundTimeStopwatch); - stopStopWatch(this.responseTimeStopwatch); - } - - private void startStopWatch(StopWatch stopwatch) { - synchronized (stopwatch) { - stopwatch.start(); - } - } - - private void stopStopWatch(StopWatch stopwatch) { - synchronized (stopwatch) { - stopwatch.stop(); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/SchedulingTimeSpan.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/SchedulingTimeSpan.java deleted file mode 100644 index 02bd4cbd80dc..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/SchedulingTimeSpan.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.query.metrics; - -public class SchedulingTimeSpan { - - /** - * The total time taken from when the process arrives to when it ended. - */ - private final long turnaroundTime; - - /** - * The total latency (time) taken from when the process arrived to when the CPU actually started working on it. - */ - private final long responseTime; - - /** - * The total time the process spent in the running state. - */ - private final long runTime; - - /** - * The total time that the process spent is on the ready or waiting state. - */ - private final long waitTime; - - /** - * Number of times the process was preempted. - */ - private final long numPreemptions; - - public SchedulingTimeSpan(long turnaroundTime, long responseTime, long runTime, long waitTime, long numPreemptions) { - this.turnaroundTime = turnaroundTime; - this.responseTime = responseTime; - this.runTime = runTime; - this.waitTime = waitTime; - this.numPreemptions = numPreemptions; - } - - public long getTurnaroundTime() { - return turnaroundTime; - } - - public long getResponseTime() { - return responseTime; - } - - public long getRunTime() { - return runTime; - } - - public long getWaitTime() { - return waitTime; - } - - public long getNumPreemptions() { - return numPreemptions; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/TextTable.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/TextTable.java deleted file mode 100644 index ca7c711ee4f1..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/query/metrics/TextTable.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.query.metrics; - -import org.apache.commons.lang3.StringUtils; - -import java.util.ArrayList; -import java.util.List; - -class TextTable { - private static final char CellLeftTop = '┌'; - private static final char CellRightTop = '┐'; - private static final char CellLeftBottom = '└'; - private static final char CellRightBottom = '┘'; - private static final char CellHorizontalJointTop = '┬'; - private static final char CellHorizontalJointBottom = '┴'; - private static final char CellVerticalJointLeft = '├'; - private static final char CellTJoint = '┼'; - private static final char CellVerticalJointRight = '┤'; - private static final char CellHorizontalLine = '-'; - private static final char CellVerticalLine = '│'; - - private List columns; - - private String header; - private String topLine; - private String middleLine; - private String bottomLine; - - private String rowFormatString; - - /** - * Initializes a new instance of the TextTable class. - * - * @param columns The columns of the table - */ - public TextTable(List columns) { - this.columns = new ArrayList<>(columns); - - // Building the table header - String headerFormatString = TextTable.buildLineFormatString(columns); - this.header = String.format(headerFormatString, columns.stream().map(textTableColumn -> textTableColumn.columnName).toArray()); - - // building the different lines - this.topLine = TextTable.buildLine(CellLeftTop, CellRightTop, CellHorizontalJointTop, columns); - this.middleLine = TextTable.buildLine(CellVerticalJointLeft, CellVerticalJointRight, CellTJoint, columns); - this.bottomLine = TextTable.buildLine(CellLeftBottom, CellRightBottom, CellHorizontalJointBottom, columns); - - // building the row format string - this.rowFormatString = TextTable.buildLineFormatString(columns); - } - - public String getRow(List cells) { - if (cells.size() != this.columns.size()) { - throw new IllegalArgumentException("Cells in a row needs to have exactly 1 element per column"); - } - return String.format(this.rowFormatString, cells.toArray()); - } - - private static String buildLine(char firstChar, char lastChar, char seperator, List columns) { - StringBuilder lineStringBuilder = new StringBuilder(); - lineStringBuilder.append(firstChar); - for (Column column : columns.subList(0, columns.size() - 1)) { - lineStringBuilder.append(StringUtils.repeat(CellHorizontalLine, column.columnWidth)); - lineStringBuilder.append(seperator); - } - - lineStringBuilder.append(StringUtils.repeat(CellHorizontalLine, columns.get(columns.size() - 1).columnWidth)); - lineStringBuilder.append(lastChar); - - return lineStringBuilder.toString(); - } - - private static String buildLineFormatString(List columns) { - StringBuilder lineFormatStringBuilder = new StringBuilder(); - lineFormatStringBuilder.append(CellVerticalLine); - for (Column column : columns) { - lineFormatStringBuilder.append("%" + column.columnWidth + "s"); - lineFormatStringBuilder.append(CellVerticalLine); - } - - return lineFormatStringBuilder.toString(); - } - - - static class Column { - String columnName; - int columnWidth; - - public Column(String columnName, int columnWidth) { - this.columnName = columnName; - this.columnWidth = columnWidth; - } - } - - public String getHeader() { - return header; - } - - public String getTopLine() { - return topLine; - } - - public String getMiddleLine() { - return middleLine; - } - - public String getBottomLine() { - return bottomLine; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/BoolPartitionKeyComponent.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/BoolPartitionKeyComponent.java deleted file mode 100644 index eda8dd7a9422..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/BoolPartitionKeyComponent.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.io.IOException; -import java.io.OutputStream; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -class BoolPartitionKeyComponent implements IPartitionKeyComponent { - - private final boolean value; - - public BoolPartitionKeyComponent(boolean value) { - this.value = value; - } - - @Override - public int CompareTo(IPartitionKeyComponent other) { - BoolPartitionKeyComponent otherBool = Utils.as(other, BoolPartitionKeyComponent.class); - if (otherBool == null) { - throw new IllegalArgumentException("other"); - } - - return (int) Math.signum((this.value ? 1 : 0) - (otherBool.value ? 1 : 0)); - } - - @Override - public int GetTypeOrdinal() { - return this.value ? PartitionKeyComponentType.TRUE.type : PartitionKeyComponentType.FALSE.type; - } - - @Override - public void JsonEncode(JsonGenerator writer) { - try { - writer.writeBoolean(this.value); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForHashing(OutputStream outputStream) { - try { - outputStream.write((byte) (this.value ? PartitionKeyComponentType.TRUE.type - : PartitionKeyComponentType.FALSE.type)); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForHashingV2(OutputStream outputStream) { - try { - outputStream.write((byte) (this.value ? PartitionKeyComponentType.TRUE.type - : PartitionKeyComponentType.FALSE.type)); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForBinaryEncoding(OutputStream outputStream) { - try { - outputStream.write((byte) (this.value ? PartitionKeyComponentType.TRUE.type - : PartitionKeyComponentType.FALSE.type)); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public IPartitionKeyComponent Truncate() { - return this; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/IPartitionKeyComponent.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/IPartitionKeyComponent.java deleted file mode 100644 index ff21ae1d307c..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/IPartitionKeyComponent.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.io.OutputStream; - -import com.fasterxml.jackson.core.JsonGenerator; - -interface IPartitionKeyComponent { - int CompareTo(IPartitionKeyComponent other); - - int GetTypeOrdinal(); - - void JsonEncode(JsonGenerator writer); - - void WriteForHashing(OutputStream outputStream); - - void WriteForHashingV2(OutputStream binaryWriter); - - void WriteForBinaryEncoding(OutputStream binaryWriter); - - IPartitionKeyComponent Truncate(); -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/InfinityPartitionKeyComponent.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/InfinityPartitionKeyComponent.java deleted file mode 100644 index fb5ed45050d2..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/InfinityPartitionKeyComponent.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.io.IOException; -import java.io.OutputStream; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -class InfinityPartitionKeyComponent implements IPartitionKeyComponent { - @Override - public int CompareTo(IPartitionKeyComponent other) { - InfinityPartitionKeyComponent otherInfinity = Utils.as(other, InfinityPartitionKeyComponent.class); - if (otherInfinity == null) { - throw new IllegalArgumentException("other"); - } - - return 0; - } - - @Override - public int GetTypeOrdinal() { - return PartitionKeyComponentType.INFINITY.type; - } - - @Override - public void JsonEncode(JsonGenerator writer) { - throw new UnsupportedOperationException(); - } - - @Override - public void WriteForHashing(OutputStream outputStream) { - throw new IllegalStateException(); - } - - @Override - public void WriteForHashingV2(OutputStream outputStream) { - throw new IllegalStateException(); - } - - @Override - public void WriteForBinaryEncoding(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.INFINITY.type); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public IPartitionKeyComponent Truncate() { - return this; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MaxNumberPartitionKeyComponent.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MaxNumberPartitionKeyComponent.java deleted file mode 100644 index c88fa8889be4..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MaxNumberPartitionKeyComponent.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.io.IOException; -import java.io.OutputStream; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -class MaxNumberPartitionKeyComponent implements IPartitionKeyComponent { - public static final MaxNumberPartitionKeyComponent VALUE = new MaxNumberPartitionKeyComponent(); - - @Override - public int CompareTo(IPartitionKeyComponent other) { - MaxNumberPartitionKeyComponent otherMaxNumber = Utils.as(other, MaxNumberPartitionKeyComponent.class); - if (otherMaxNumber == null) { - throw new IllegalArgumentException("other"); - } - - return 0; - } - - @Override - public int GetTypeOrdinal() { - return PartitionKeyComponentType.MAXNUMBER.ordinal(); - } - - @Override - public void JsonEncode(JsonGenerator writer) { - PartitionKeyInternal.PartitionKeyInternalJsonSerializer.jsonEncode(this, writer); - } - - @Override - public void WriteForHashing(OutputStream outputStream) { - throw new UnsupportedOperationException(); - } - - @Override - public void WriteForHashingV2(OutputStream outputStream) { - throw new UnsupportedOperationException(); - } - - @Override - public void WriteForBinaryEncoding(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.MAXNUMBER.type); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public IPartitionKeyComponent Truncate() { - return this; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MaxStringPartitionKeyComponent.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MaxStringPartitionKeyComponent.java deleted file mode 100644 index 0b45955919da..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MaxStringPartitionKeyComponent.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.io.IOException; -import java.io.OutputStream; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -class MaxStringPartitionKeyComponent implements IPartitionKeyComponent { - public static final MaxStringPartitionKeyComponent VALUE = new MaxStringPartitionKeyComponent(); - - @Override - public int CompareTo(IPartitionKeyComponent other) { - MaxStringPartitionKeyComponent otherMaxString = Utils.as(other, MaxStringPartitionKeyComponent.class); - if (otherMaxString == null) { - throw new IllegalArgumentException("other"); - } - - return 0; - } - - @Override - public int GetTypeOrdinal() { - return PartitionKeyComponentType.MAXSTRING.ordinal(); - } - - @Override - public void JsonEncode(JsonGenerator writer) { - PartitionKeyInternal.PartitionKeyInternalJsonSerializer.jsonEncode(this, writer); - } - - @Override - public void WriteForHashing(OutputStream outputStream) { - throw new UnsupportedOperationException(); - } - - @Override - public void WriteForHashingV2(OutputStream outputStream) { - throw new UnsupportedOperationException(); - } - - - @Override - public void WriteForBinaryEncoding(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.MAXSTRING.type); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public IPartitionKeyComponent Truncate() { - return this; - } - -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MinNumberPartitionKeyComponent.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MinNumberPartitionKeyComponent.java deleted file mode 100644 index 7d10d3126256..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MinNumberPartitionKeyComponent.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.io.IOException; -import java.io.OutputStream; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -class MinNumberPartitionKeyComponent implements IPartitionKeyComponent { - public static final MinNumberPartitionKeyComponent VALUE = new MinNumberPartitionKeyComponent(); - - @Override - public int CompareTo(IPartitionKeyComponent other) { - MinNumberPartitionKeyComponent otherMinNumber = Utils.as(other, MinNumberPartitionKeyComponent.class); - if (otherMinNumber == null) { - throw new IllegalArgumentException("other"); - } - - return 0; - } - - @Override - public int GetTypeOrdinal() { - return PartitionKeyComponentType.MINNUMBER.ordinal(); - } - - @Override - public void JsonEncode(JsonGenerator writer) { - PartitionKeyInternal.PartitionKeyInternalJsonSerializer.jsonEncode(this, writer); - } - - @Override - public void WriteForHashing(OutputStream outputStream) { - throw new UnsupportedOperationException(); - } - - @Override - public void WriteForHashingV2(OutputStream outputStream) { - throw new UnsupportedOperationException(); - } - - @Override - public void WriteForBinaryEncoding(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.MINNUMBER.type); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public IPartitionKeyComponent Truncate() { - return this; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MinStringPartitionKeyComponent.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MinStringPartitionKeyComponent.java deleted file mode 100644 index 8b765dab91d3..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MinStringPartitionKeyComponent.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.io.IOException; -import java.io.OutputStream; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -class MinStringPartitionKeyComponent implements IPartitionKeyComponent { - public static final MinStringPartitionKeyComponent VALUE = new MinStringPartitionKeyComponent(); - - @Override - public int CompareTo(IPartitionKeyComponent other) { - MinStringPartitionKeyComponent otherMinString = Utils.as(other, MinStringPartitionKeyComponent.class); - if (otherMinString == null) { - throw new IllegalArgumentException("other"); - } - - return 0; - } - - @Override - public int GetTypeOrdinal() { - return PartitionKeyComponentType.MINSTRING.ordinal(); - } - - @Override - public void JsonEncode(JsonGenerator writer) { - PartitionKeyInternal.PartitionKeyInternalJsonSerializer.jsonEncode(this, writer); - } - - @Override - public void WriteForHashing(OutputStream outputStream) { - throw new UnsupportedOperationException(); - } - - @Override - public void WriteForHashingV2(OutputStream outputStream) { - throw new UnsupportedOperationException(); - } - - - @Override - public void WriteForBinaryEncoding(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.MINSTRING.type); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public IPartitionKeyComponent Truncate() { - return this; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/NullPartitionKeyComponent.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/NullPartitionKeyComponent.java deleted file mode 100644 index a82585474370..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/NullPartitionKeyComponent.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.io.IOException; -import java.io.OutputStream; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -class NullPartitionKeyComponent implements IPartitionKeyComponent { - - public static final NullPartitionKeyComponent VALUE = new NullPartitionKeyComponent(); - - @Override - public int CompareTo(IPartitionKeyComponent other) { - NullPartitionKeyComponent otherMinString = Utils.as(other, NullPartitionKeyComponent.class); - if (otherMinString == null) { - throw new IllegalArgumentException("other"); - } - - return 0; - } - - @Override - public int GetTypeOrdinal() { - return PartitionKeyComponentType.NULL.type; - } - - @Override - public void JsonEncode(JsonGenerator writer) { - try { - writer.writeObject(null); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForHashing(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.NULL.type); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForHashingV2(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.NULL.type); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForBinaryEncoding(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.NULL.type); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public IPartitionKeyComponent Truncate() { - return this; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/NumberPartitionKeyComponent.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/NumberPartitionKeyComponent.java deleted file mode 100644 index 18eed71c03d9..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/NumberPartitionKeyComponent.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.io.IOException; -import java.io.OutputStream; -import java.math.BigInteger; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -/** - * Used internally to represent a number component in the partition key of the Azure Cosmos DB database service. - */ -public class NumberPartitionKeyComponent implements IPartitionKeyComponent { - - public static final NumberPartitionKeyComponent Zero = new NumberPartitionKeyComponent(0); - private final double value; - - public NumberPartitionKeyComponent(double value) { - this.value = value; - } - - private static byte[] doubleToByteArray(double d) { - byte[] output = new byte[8]; - long lng = Double.doubleToLongBits(d); - for (int i = 0; i < 8; i++) { - output[i] = (byte) ((lng >> (i * 8)) & 0xff); - } - return output; - } - - private static long EncodeDoubleAsUInt64(double value) { - long rawLongBits = Double.doubleToRawLongBits(value); - long mask = 0x8000000000000000L; - return Long.compareUnsigned(rawLongBits, mask) < 0 - ? rawLongBits ^ mask - : (~rawLongBits) + 1; - } - - @Override - public int CompareTo(IPartitionKeyComponent other) { - NumberPartitionKeyComponent otherBool = Utils.as(other, NumberPartitionKeyComponent.class); - if (otherBool == null) { - throw new IllegalArgumentException("other"); - } - - return Double.compare(this.value, ((NumberPartitionKeyComponent) other).value); - } - - @Override - public int GetTypeOrdinal() { - return PartitionKeyComponentType.NUMBER.type; - } - - @Override - public void JsonEncode(JsonGenerator writer) { - try { - writer.writeNumber(String.valueOf(value)); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForHashing(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.NUMBER.type); - outputStream.write(doubleToByteArray(this.value)); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForHashingV2(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.NUMBER.type); - outputStream.write(doubleToByteArray(this.value)); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForBinaryEncoding(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.NUMBER.type); - - long payload = NumberPartitionKeyComponent.EncodeDoubleAsUInt64(this.value); - - // Encode first chunk with 8-bits of payload - outputStream.write((byte) (payload >> (64 - 8))); - payload <<= 8; - - // Encode remaining chunks with 7 bits of payload followed by single "1" bit each. - byte byteToWrite = 0; - boolean firstIteration = true; - do { - if (!firstIteration) { - outputStream.write(byteToWrite); - } else { - firstIteration = false; - } - - byteToWrite = (byte) ((payload >> (64 - 8)) | 0x01); - payload <<= 7; - } while (payload != 0); - - // Except for last chunk that ends with "0" bit. - outputStream.write((byte) (byteToWrite & 0xFE)); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public IPartitionKeyComponent Truncate() { - return this; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyAndResourceTokenPair.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyAndResourceTokenPair.java deleted file mode 100644 index f1c3c5241c79..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyAndResourceTokenPair.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.routing; - -/** - * This is the pair for Partition key and its corresponding Resource Token , - * this is the value in resource token map which is getting filled during the - * construction of AsyncDocumentClient - */ -public class PartitionKeyAndResourceTokenPair { - - private PartitionKeyInternal partitionKey; - private String resourceToken; - - public PartitionKeyAndResourceTokenPair(PartitionKeyInternal partitionKey, String resourceToken) { - this.partitionKey = partitionKey; - this.resourceToken = resourceToken; - } - - /** - * Get the Partition Key - * - * @return Partition Key - */ - public PartitionKeyInternal getPartitionKey() { - return partitionKey; - } - - /** - * Sets the PartitionKey - * - * @param partitionKey - * The Partition key - */ - public void setPartitionKey(PartitionKeyInternal partitionKey) { - this.partitionKey = partitionKey; - } - - /** - * Gets the Resource Token - * - * @return Resource Token - */ - public String getResourceToken() { - return resourceToken; - } - - /** - * Sets the Resource Token - * - * @param resourceToken - * The Resource Token - */ - public void setResourceToken(String resourceToken) { - this.resourceToken = resourceToken; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyComponentType.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyComponentType.java deleted file mode 100644 index ee1180f0a2aa..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyComponentType.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -enum PartitionKeyComponentType { - UNDEFINED(0x0), - NULL(0x1), - FALSE(0x2), - TRUE(0x3), - MINNUMBER(0x4), - NUMBER(0x5), - MAXNUMBER(0x6), - MINSTRING(0x7), - STRING(0x8), - MAXSTRING(0x9), - INFINITY(0xFF); - - public final int type; - PartitionKeyComponentType(int type) { - this.type = type; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyInternal.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyInternal.java deleted file mode 100644 index 1051193584ae..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyInternal.java +++ /dev/null @@ -1,333 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.ObjectCodec; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import com.fasterxml.jackson.databind.node.NullNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import com.microsoft.azure.cosmosdb.Undefined; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; - -import static com.microsoft.azure.cosmosdb.rx.internal.Utils.as; - -/** - * Used internally to encapsulate internal information of a partition key in the Azure Cosmos DB database service. - */ -@JsonSerialize(using = PartitionKeyInternal.PartitionKeyInternalJsonSerializer.class) -@JsonDeserialize(using = PartitionKeyInternal.PartitionKeyInternalJsonDeserializer.class) -public class PartitionKeyInternal implements Comparable { - - private static final String TYPE = "type"; - private static final String MIN_NUMBER = "MinNumber"; - private static final String MAX_NUMBER = "MaxNumber"; - private static final String MIN_STRING = "MinString"; - private static final String MAX_STRING = "MaxString"; - private static final String INFINITY = "Infinity"; - - public static final PartitionKeyInternal EmptyPartitionKey = - new PartitionKeyInternal(new ArrayList<>()); - - @SuppressWarnings("serial") - public static final PartitionKeyInternal InfinityPartitionKey = - new PartitionKeyInternal(new ArrayList() {{ - add(new InfinityPartitionKeyComponent()); - }}); - - public static final PartitionKeyInternal InclusiveMinimum = PartitionKeyInternal.EmptyPartitionKey; - public static final PartitionKeyInternal ExclusiveMaximum = PartitionKeyInternal.InfinityPartitionKey; - public static final PartitionKeyInternal Empty = PartitionKeyInternal.EmptyPartitionKey; - - final List components; - - public PartitionKeyInternal(List values) { - if (values == null) { - throw new IllegalArgumentException("values"); - } - - this.components = values; - } - - public static PartitionKeyInternal fromJsonString(String partitionKey) { - if (Strings.isNullOrEmpty(partitionKey)) { - throw new IllegalArgumentException(String.format(RMResources.UnableToDeserializePartitionKeyValue, partitionKey)); - } - - try { - return Utils.getSimpleObjectMapper().readValue(partitionKey, PartitionKeyInternal.class); - } catch (IOException e) { - throw new IllegalArgumentException(e); - } - } - - public static PartitionKeyInternal fromObjectArray(Object[] values, boolean strict) { - if (values == null) { - throw new IllegalArgumentException("values"); - } - - return PartitionKeyInternal.fromObjectArray(Arrays.asList(values), strict); - } - - public static PartitionKeyInternal fromObjectArray(List values, boolean strict) { - if (values == null) { - throw new IllegalArgumentException("values"); - } - - List components = new ArrayList<>(); - for (Object value : values) { - if (value == NullNode.instance || value == null) { - components.add(NullPartitionKeyComponent.VALUE); - } else if (value instanceof Undefined) { - components.add(UndefinedPartitionKeyComponent.VALUE); - } else if (value instanceof Boolean) { - components.add(new BoolPartitionKeyComponent((boolean) value)); - } else if (value instanceof String) { - components.add(new StringPartitionKeyComponent((String) value)); - } else if (isNumeric(value)) { - components.add(new NumberPartitionKeyComponent(((Number) value).doubleValue())); - } else if (value instanceof ObjectNode && ((ObjectNode) value).get(TYPE) != null) { - switch (((ObjectNode) value).get(TYPE).asText()) { - case MIN_NUMBER: - components.add(MinNumberPartitionKeyComponent.VALUE); - break; - case MAX_NUMBER: - components.add(MaxNumberPartitionKeyComponent.VALUE); - break; - case MIN_STRING: - components.add(MinStringPartitionKeyComponent.VALUE); - break; - case MAX_STRING: - components.add(MaxStringPartitionKeyComponent.VALUE); - break; - } - } else { - if (strict) { - throw new IllegalArgumentException("Unable to construct PartitionKeyInternal from objects array"); - } else { - components.add(UndefinedPartitionKeyComponent.VALUE); - } - } - } - - return new PartitionKeyInternal(components); - } - - private static boolean isNumeric(Object value) { - return value instanceof Number; - } - - private static PartitionKeyInternal getExclusiveMaximum() { - return PartitionKeyInternal.InfinityPartitionKey; - } - - public static PartitionKeyInternal getEmpty() { - return PartitionKeyInternal.EmptyPartitionKey; - } - - @Override - public boolean equals(Object obj) { - PartitionKeyInternal pki = as(obj, PartitionKeyInternal.class); - if (pki == null) { - return false; - } - - if (pki == this) { - return true; - } - - return this.compareTo(pki) == 0; - } - - public int compareTo(PartitionKeyInternal other) { - if (other == null) { - throw new IllegalArgumentException("other"); - } - - for (int i = 0; i < Math.min(this.components.size(), other.components.size()); i++) { - int leftOrdinal = this.components.get(i).GetTypeOrdinal(); - int rightOrdinal = other.components.get(i).GetTypeOrdinal(); - if (leftOrdinal != rightOrdinal) { - return (int) Math.signum(leftOrdinal - rightOrdinal); - } - - int result = this.components.get(i).CompareTo(other.components.get(i)); - if (result != 0) { - return (int) Math.signum(result); - } - } - - return (int) Math.signum(this.components.size() - other.components.size()); - } - - public String toJson() { - try { - return Utils.getSimpleObjectMapper().writeValueAsString(this); - } catch (IOException e) { - throw new IllegalArgumentException("Unable serialize the partition key internal into the JSON string", e); - } - } - - public boolean contains(PartitionKeyInternal nestedPartitionKey) { - if (this.components.size() > nestedPartitionKey.components.size()) { - return false; - } - - for (int i = 0; i < this.components.size(); i++) { - if (this.components.get(i).CompareTo(nestedPartitionKey.components.get(i)) != 0) { - return false; - } - } - - return true; - } - - public List getComponents() { - return components; - } - - @SuppressWarnings("serial") - static final class PartitionKeyInternalJsonSerializer extends StdSerializer { - - protected PartitionKeyInternalJsonSerializer() { this(null); } - - protected PartitionKeyInternalJsonSerializer(Class t) { - super(t); - } - - @Override - public void serialize(PartitionKeyInternal partitionKey, JsonGenerator writer, SerializerProvider serializerProvider) { - try { - if (partitionKey.equals(PartitionKeyInternal.getExclusiveMaximum())) { - writer.writeString(INFINITY); - return; - } - - writer.writeStartArray(); - for (IPartitionKeyComponent componentValue : partitionKey.getComponents()) { - componentValue.JsonEncode(writer); - } - writer.writeEndArray(); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - static void jsonEncode(MinNumberPartitionKeyComponent component, JsonGenerator writer) { - jsonEncodeLimit(writer, MIN_NUMBER); - } - - static void jsonEncode(MaxNumberPartitionKeyComponent component, JsonGenerator writer) { - jsonEncodeLimit(writer, MAX_NUMBER); - } - - static void jsonEncode(MinStringPartitionKeyComponent component, JsonGenerator writer) { - jsonEncodeLimit(writer, MIN_STRING); - } - - static void jsonEncode(MaxStringPartitionKeyComponent component, JsonGenerator writer) { - jsonEncodeLimit(writer, MAX_STRING); - } - - private static void jsonEncodeLimit(JsonGenerator writer, String value) { - try { - writer.writeStartObject(); - writer.writeFieldName(TYPE); - writer.writeString(value); - writer.writeEndObject(); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - } - - @SuppressWarnings("serial") - static final class PartitionKeyInternalJsonDeserializer extends StdDeserializer { - - protected PartitionKeyInternalJsonDeserializer() { this(null); } - - protected PartitionKeyInternalJsonDeserializer(Class vc) { - super(vc); - } - - @Override - public PartitionKeyInternal deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) { - - ObjectCodec objectCodec = jsonParser.getCodec(); - JsonNode root; - try { - root = objectCodec.readTree(jsonParser); - } catch (IOException e) { - throw new IllegalArgumentException(e); - } - - if (root.isTextual() && root.asText().equals(INFINITY)) { - return PartitionKeyInternal.getExclusiveMaximum(); - } - - List objects = new ArrayList<>(); - if (root.isArray()) { - Iterator iterator = root.iterator(); - while (iterator.hasNext()) { - JsonNode node = iterator.next(); - if (node.isNull()) { - objects.add(null); - } else if (node.isNumber()) { - objects.add(node.asDouble()); - } else if (node.isBoolean()) { - objects.add(node.asBoolean()); - } else if (node.isTextual()) { - objects.add(node.asText()); - } else if (node.isArray() && node.size() == 0 - || node.isObject() - && (node.fields() == null || !node.fields().hasNext())) { - objects.add(Undefined.Value()); - } else { - objects.add(node); - } - } - return PartitionKeyInternal.fromObjectArray(objects, true); - } - - throw new IllegalStateException(String.format( - "Unable to deserialize PartitionKeyInternal '%s'", - root.toString())); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyRangeIdentity.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyRangeIdentity.java deleted file mode 100644 index 41360c5e20b9..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyRangeIdentity.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import org.apache.commons.lang3.StringUtils; - -/** - * Used internally to represents the identity of a partition key range in the Azure Cosmos DB database service. - */ -public final class PartitionKeyRangeIdentity { - private String collectionRid; - private String partitionKeyRangeId; - - public PartitionKeyRangeIdentity(String collectionRid, String partitionKeyRangeId) { - if (collectionRid == null) { - throw new IllegalArgumentException("collectionRid"); - } - - if (partitionKeyRangeId == null) { - throw new IllegalArgumentException("partitionKeyRangeId"); - } - - this.collectionRid = collectionRid; - this.partitionKeyRangeId = partitionKeyRangeId; - } - - /** - * This should only be used for user provided partitionKeyRangeId, because in this case - * he knows what he is doing. If collection was deleted/created with same name - it is his responsibility. - *

- * If our code infers partitionKeyRangeId automatically and uses collection information from collection cache, - * we need to ensure that request will reach correct collection. In this case constructor which takes collectionRid MUST - * be used. - * - * @param partitionKeyRangeId a string represents the partition key range Id - */ - public PartitionKeyRangeIdentity(String partitionKeyRangeId) { - if (partitionKeyRangeId == null) { - throw new IllegalArgumentException("partitionKeyRangeId"); - } - - this.partitionKeyRangeId = partitionKeyRangeId; - } - - public static PartitionKeyRangeIdentity fromHeader(String header) { - String[] parts = StringUtils.split(header,","); - if (parts.length == 2) { - return new PartitionKeyRangeIdentity(parts[0], parts[1]); - } else if (parts.length == 1) { - return new PartitionKeyRangeIdentity(parts[0]); - } else { - throw new IllegalStateException("x-ms-documentdb-partitionkeyrangeid header contains invalid value '" + header + "'"); - } - } - - public String toHeader() { - if (this.collectionRid != null) { - return String.format("%s,%s", this.collectionRid, this.partitionKeyRangeId); - } - - return String.format("%s", this.partitionKeyRangeId); - } - - @Override - public boolean equals(Object other) { - if (null == other) { - return false; - } - if (this == other) { - return true; - } - return other instanceof PartitionKeyRangeIdentity - && ((PartitionKeyRangeIdentity) other).collectionRid.equals(this.collectionRid) - && ((PartitionKeyRangeIdentity) other).partitionKeyRangeId.equals(this.partitionKeyRangeId); - } - - @Override - public int hashCode() { - return ((this.collectionRid != null ? this.collectionRid.hashCode() : 0) * 397) - ^ (this.partitionKeyRangeId != null ? this.partitionKeyRangeId.hashCode() : 0); - } - - public String getCollectionRid() { - return collectionRid; - } - - public String getPartitionKeyRangeId() { - return partitionKeyRangeId; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/Range.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/Range.java deleted file mode 100644 index e4a4d7ff8b39..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/Range.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.util.Comparator; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.microsoft.azure.cosmosdb.JsonSerializable; - -@JsonIgnoreProperties({ "empty", "singleValue", "hashMap" }) -public final class Range> extends JsonSerializable { - private static final String MIN_PROPERTY = "min"; - private static final String MAX_PROPERTY = "max"; - private static final String IS_MIN_INCLUSIVE_PROPERTY = "isMinInclusive"; - private static final String IS_MAX_INCLUSIVE_PROPERTY = "isMaxInclusive"; - - private T minValue; - private T maxValue; - - public Range() { - super(); - } - - public Range(String jsonString) { - super(jsonString); - } - - public Range(T min, T max, boolean isMinInclusive, boolean isMaxInclusive) { - this.setMin(min); - this.setMax(max); - this.setMinInclusive(isMinInclusive); - this.setMaxInclusive(isMaxInclusive); - } - - public static > Range getPointRange(T value) { - return new Range(value, value, true, true); - } - - public static > Range getEmptyRange(T value) { - return new Range(value, value, true, false); - } - - public static > boolean checkOverlapping(Range range1, Range range2) { - if (range1 == null || range2 == null || range1.isEmpty() || range2.isEmpty()) { - return false; - } - - int cmp1 = range1.getMin().compareTo(range2.getMax()); - int cmp2 = range2.getMin().compareTo(range1.getMax()); - - if (cmp1 <= 0 && cmp2 <= 0) { - return !((cmp1 == 0 && !(range1.isMinInclusive() && range2.isMaxInclusive())) - || (cmp2 == 0 && !(range2.isMinInclusive() && range1.isMaxInclusive()))); - } - - return false; - } - - @SuppressWarnings("unchecked") - public T getMin() { - if (this.minValue == null) { - this.minValue = (T) super.get(Range.MIN_PROPERTY); - } - - return this.minValue; - } - - public void setMin(T min) { - this.minValue = min; - super.set(Range.MIN_PROPERTY, min); - } - - @SuppressWarnings("unchecked") - public T getMax() { - if (this.maxValue == null) { - this.maxValue = (T) super.get(Range.MAX_PROPERTY); - } - - return this.maxValue; - } - - public void setMax(T max) { - this.maxValue = max; - super.set(Range.MAX_PROPERTY, max); - } - - @JsonProperty("isMinInclusive") - public boolean isMinInclusive() { - return super.getBoolean(Range.IS_MIN_INCLUSIVE_PROPERTY); - } - - public void setMinInclusive(boolean isMinInclusive) { - super.set(Range.IS_MIN_INCLUSIVE_PROPERTY, isMinInclusive); - } - - @JsonProperty("isMaxInclusive") - public boolean isMaxInclusive() { - return super.getBoolean(Range.IS_MAX_INCLUSIVE_PROPERTY); - } - - public void setMaxInclusive(boolean isMaxInclusive) { - super.set(Range.IS_MAX_INCLUSIVE_PROPERTY, isMaxInclusive); - } - - public boolean isSingleValue() { - return this.isMinInclusive() && this.isMaxInclusive() && this.getMin().compareTo(this.getMax()) == 0; - } - - public boolean isEmpty() { - return this.getMin().compareTo(this.getMax()) == 0 && !(this.isMinInclusive() && this.isMaxInclusive()); - } - - public boolean contains(T value) { - int minToValueRelation = this.getMin().compareTo(value); - int maxToValueRelation = this.getMax().compareTo(value); - - return ((this.isMinInclusive() && minToValueRelation <= 0) - || (!this.isMinInclusive() && minToValueRelation < 0)) - && ((this.isMaxInclusive() && maxToValueRelation >= 0) - || (!this.isMaxInclusive() && maxToValueRelation > 0)); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof Range)) - return false; - if (obj == this) - return true; - @SuppressWarnings("unchecked") - Range otherRange = (Range) obj; - - return this.getMin().compareTo(otherRange.getMin()) == 0 && this.getMax().compareTo(otherRange.getMax()) == 0 - && this.isMinInclusive() == otherRange.isMinInclusive() - && this.isMaxInclusive() == otherRange.isMaxInclusive(); - } - - @Override - public int hashCode() { - int hash = 0; - hash = (hash * 397) ^ this.getMin().hashCode(); - hash = (hash * 397) ^ this.getMax().hashCode(); - hash = (hash * 397) ^ Boolean.compare(this.isMinInclusive(), false); - hash = (hash * 397) ^ Boolean.compare(this.isMaxInclusive(), false); - return hash; - } - - public static class MinComparator> implements Comparator> { - @Override - public int compare(Range range1, Range range2) { - int result = range1.getMin().compareTo(range2.getMin()); - if (result != 0 || range1.isMinInclusive() == range2.isMinInclusive()) { - return result; - } - - return range1.isMinInclusive() ? -1 : 1; - } - } - - public static class MaxComparator> implements Comparator> { - @Override - public int compare(Range range1, Range range2) { - int result = range1.getMax().compareTo(range2.getMax()); - if (result != 0 || range1.isMaxInclusive() == range2.isMaxInclusive()) { - return result; - } - - return range1.isMaxInclusive() ? 1 : -1; - } - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/StringPartitionKeyComponent.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/StringPartitionKeyComponent.java deleted file mode 100644 index 5f373417d1cb..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/StringPartitionKeyComponent.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.UnsupportedEncodingException; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -class StringPartitionKeyComponent implements IPartitionKeyComponent { - - public static final int MAX_STRING_CHARS = 100; - public static final int MAX_STRING_BYTES_TO_APPEND = 100; - private final String value; - private final byte[] utf8Value; - - public StringPartitionKeyComponent(String value) { - if (value == null) { - throw new IllegalArgumentException("value"); - } - - this.value = value; - try { - this.utf8Value = com.microsoft.azure.cosmosdb.internal.Utils.getUTF8Bytes(value); - } catch (UnsupportedEncodingException e) { - throw new IllegalArgumentException(e); - } - } - - @Override - public int CompareTo(IPartitionKeyComponent other) { - StringPartitionKeyComponent otherString = Utils.as(other, StringPartitionKeyComponent.class) ; - if (otherString == null) { - throw new IllegalArgumentException("other"); - } - - return this.value.compareTo(otherString.value); - } - - @Override - public int GetTypeOrdinal() { - return PartitionKeyComponentType.STRING.type; - } - - @Override - public int hashCode() { - // hashCode for hashmap dictionary, etc - return value.hashCode(); - } - - public IPartitionKeyComponent Truncate() { - if (this.value.length() > MAX_STRING_CHARS) { - return new StringPartitionKeyComponent(this.value.substring(0, MAX_STRING_CHARS)); - } - - return this; - } - - @Override - public void JsonEncode(JsonGenerator writer) { - try { - writer.writeString(this.value); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForHashing(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.STRING.type); - outputStream.write(utf8Value); - outputStream.write((byte) 0); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForHashingV2(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.STRING.type); - outputStream.write(utf8Value); - outputStream.write((byte) 0xFF); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForBinaryEncoding(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.STRING.type); - boolean shortString = this.utf8Value.length <= MAX_STRING_BYTES_TO_APPEND; - - for (int index = 0; index < (shortString ? this.utf8Value.length : MAX_STRING_BYTES_TO_APPEND + 1); index++) { - byte charByte = this.utf8Value[index]; - if (charByte < 0xFF) charByte++; - outputStream.write(charByte); - } - - if (shortString) { - outputStream.write((byte) 0x00); - } - } catch (IOException e) { - throw new IllegalStateException(e); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/UndefinedPartitionKeyComponent.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/UndefinedPartitionKeyComponent.java deleted file mode 100644 index 8bbad5c40153..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/UndefinedPartitionKeyComponent.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.io.IOException; -import java.io.OutputStream; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -class UndefinedPartitionKeyComponent implements IPartitionKeyComponent { - - public static final UndefinedPartitionKeyComponent VALUE = new UndefinedPartitionKeyComponent(); - - @Override - public int CompareTo(IPartitionKeyComponent other) { - UndefinedPartitionKeyComponent otherUndefined = Utils.as(other, UndefinedPartitionKeyComponent.class); - if (otherUndefined == null) { - throw new IllegalArgumentException("other"); - } - - return 0; - } - - @Override - public int GetTypeOrdinal() { - return PartitionKeyComponentType.UNDEFINED.type; - } - - @Override - public void JsonEncode(JsonGenerator writer) { - try { - writer.writeStartObject(); - writer.writeEndObject(); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForHashing(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.UNDEFINED.type); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForHashingV2(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.UNDEFINED.type); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void WriteForBinaryEncoding(OutputStream outputStream) { - try { - outputStream.write((byte) PartitionKeyComponentType.UNDEFINED.type); - } catch (IOException e) { - throw new IllegalStateException(e); - } - } - - @Override - public IPartitionKeyComponent Truncate() { - return this; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/package-info.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/package-info.java deleted file mode 100644 index 351bf1499dc6..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/package-info.java +++ /dev/null @@ -1,28 +0,0 @@ - -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/** - * This package provides Java SDK Common Resources for Azure Cosmos DB. - */ -package com.microsoft.azure.cosmosdb; \ No newline at end of file diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/AuthorizationTokenType.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/AuthorizationTokenType.java deleted file mode 100644 index dc0e37c3dcc5..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/AuthorizationTokenType.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -public enum AuthorizationTokenType { - Invalid, - PrimaryMasterKey, - PrimaryReadonlyMasterKey, - SecondaryMasterKey, - SecondaryReadonlyMasterKey, - SystemReadOnly, - SystemReadWrite, - SystemAll, - ResourceToken -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/BadRequestException.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/BadRequestException.java deleted file mode 100644 index f9dc2cf70860..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/BadRequestException.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.HttpUtils; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.net.URI; -import java.util.HashMap; -import java.util.Map; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class BadRequestException extends DocumentClientException { - private static final long serialVersionUID = 1L; - - public BadRequestException(String message, Exception innerException) { - super(message, innerException, new HashMap<>(), HttpConstants.StatusCodes.BADREQUEST, null); - } - - public BadRequestException() { - this(RMResources.BadRequest); - } - - public BadRequestException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.BADREQUEST, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public BadRequestException(String message) { - this(message, (Exception) null, (HttpResponseHeaders) null, null); - } - - public BadRequestException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public BadRequestException(String message, HttpResponseHeaders headers, URI requestUri) { - this(message, headers, requestUri != null ? requestUri.toString() : null); - } - - public BadRequestException(Exception innerException) { - this(RMResources.BadRequest, innerException, null, null); - } - - public BadRequestException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - super(String.format("%s: %s", RMResources.BadRequest, message), - innerException, - HttpUtils.asMap(headers), - HttpConstants.StatusCodes.BADREQUEST, - requestUri != null ? requestUri.toString() : null); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/Configs.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/Configs.java deleted file mode 100644 index 7bd80d3fbdac..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/Configs.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import io.netty.handler.ssl.SslContext; -import io.netty.handler.ssl.SslContextBuilder; -import io.netty.handler.ssl.SslProvider; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.text.WordUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.net.ssl.SSLException; - -public class Configs { - private static final Logger logger = LoggerFactory.getLogger(Configs.class); - private final SslContext sslContext; - - private static final String PROTOCOL = "COSMOS.PROTOCOL"; - private static final Protocol DEFAULT_PROTOCOL = Protocol.Https; - - private static final String UNAVAILABLE_LOCATIONS_EXPIRATION_TIME_IN_SECONDS = "COSMOS.UNAVAILABLE_LOCATIONS_EXPIRATION_TIME_IN_SECONDS"; - - private static final String MAX_HTTP_BODY_LENGTH_IN_BYTES = "COSMOS.MAX_HTTP_BODY_LENGTH_IN_BYTES"; - private static final String MAX_HTTP_INITIAL_LINE_LENGTH_IN_BYTES = "COSMOS.MAX_HTTP_INITIAL_LINE_LENGTH_IN_BYTES"; - private static final String MAX_HTTP_CHUNK_SIZE_IN_BYTES = "COSMOS.MAX_HTTP_CHUNK_SIZE_IN_BYTES"; - private static final String MAX_HTTP_HEADER_SIZE_IN_BYTES = "COSMOS.MAX_HTTP_HEADER_SIZE_IN_BYTES"; - private static final String MAX_DIRECT_HTTPS_POOL_SIZE = "COSMOS.MAX_DIRECT_HTTP_CONNECTION_LIMIT"; - - private static final int DEFAULT_UNAVAILABLE_LOCATIONS_EXPIRATION_TIME_IN_SECONDS = 5 * 60; - - private static final int DEFAULT_MAX_HTTP_BODY_LENGTH_IN_BYTES = 6 * 1024 * 1024; //6MB - private static final int DEFAULT_MAX_HTTP_INITIAL_LINE_LENGTH = 4096; //4KB - private static final int DEFAULT_MAX_HTTP_CHUNK_SIZE_IN_BYTES = 8192; //8KB - private static final int DEFAULT_MAX_HTTP_REQUEST_HEADER_SIZE = 32 * 1024; //32 KB - - private static final int MAX_NUMBER_OF_READ_BARRIER_READ_RETRIES = 6; - private static final int MAX_NUMBER_OF_PRIMARY_READ_RETRIES = 6; - private static final int MAX_NUMBER_OF_READ_QUORUM_RETRIES = 6; - private static final int DELAY_BETWEEN_READ_BARRIER_CALLS_IN_MS = 5; - - private static final int MAX_BARRIER_RETRIES_FOR_MULTI_REGION = 30; - private static final int BARRIER_RETRY_INTERVAL_IN_MS_FOR_MULTI_REGION = 30; - - private static final int MAX_SHORT_BARRIER_RETRIES_FOR_MULTI_REGION = 4; - private static final int SHORT_BARRIER_RETRY_INTERVAL_IN_MS_FOR_MULTI_REGION = 10; - private static final int CPU_CNT = Runtime.getRuntime().availableProcessors(); - private static final int DEFAULT_DIRECT_HTTPS_POOL_SIZE = CPU_CNT * 500; - - public Configs() { - this.sslContext = sslContextInit(); - } - - private SslContext sslContextInit() { - try { - SslProvider sslProvider = SslContext.defaultClientProvider(); - return SslContextBuilder.forClient().sslProvider(sslProvider).build(); - } catch (SSLException sslException) { - logger.error("Fatal error cannot instantiate ssl context due to {}", sslException.getMessage(), sslException); - throw new IllegalStateException(sslException); - } - } - - public SslContext getSslContext() { - return this.sslContext; - } - - public Protocol getProtocol() { - String protocol = getJVMConfigAsString(PROTOCOL, DEFAULT_PROTOCOL.name()); - try { - return Protocol.valueOf(WordUtils.capitalize(protocol.toLowerCase())); - } catch (Exception e) { - logger.error("Parsing protocol {} failed. Using the default {}.", protocol, DEFAULT_PROTOCOL, e); - return DEFAULT_PROTOCOL; - } - } - - public int getMaxNumberOfReadBarrierReadRetries() { - return MAX_NUMBER_OF_READ_BARRIER_READ_RETRIES; - } - - public int getMaxNumberOfPrimaryReadRetries() { - return MAX_NUMBER_OF_PRIMARY_READ_RETRIES; - } - - public int getMaxNumberOfReadQuorumRetries() { - return MAX_NUMBER_OF_READ_QUORUM_RETRIES; - } - - public int getDelayBetweenReadBarrierCallsInMs() { - return DELAY_BETWEEN_READ_BARRIER_CALLS_IN_MS; - } - - public int getMaxBarrierRetriesForMultiRegion() { - return MAX_BARRIER_RETRIES_FOR_MULTI_REGION; - } - - public int getBarrierRetryIntervalInMsForMultiRegion() { - return BARRIER_RETRY_INTERVAL_IN_MS_FOR_MULTI_REGION; - } - - public int getMaxShortBarrierRetriesForMultiRegion() { - return MAX_SHORT_BARRIER_RETRIES_FOR_MULTI_REGION; - } - - public int getShortBarrierRetryIntervalInMsForMultiRegion() { - return SHORT_BARRIER_RETRY_INTERVAL_IN_MS_FOR_MULTI_REGION; - } - - public int getDirectHttpsMaxConnectionLimit() { - return getJVMConfigAsInt(MAX_DIRECT_HTTPS_POOL_SIZE, DEFAULT_DIRECT_HTTPS_POOL_SIZE); - } - - public int getMaxHttpHeaderSize() { - return getJVMConfigAsInt(MAX_HTTP_HEADER_SIZE_IN_BYTES, DEFAULT_MAX_HTTP_REQUEST_HEADER_SIZE); - } - - public int getMaxHttpInitialLineLength() { - return getJVMConfigAsInt(MAX_HTTP_INITIAL_LINE_LENGTH_IN_BYTES, DEFAULT_MAX_HTTP_INITIAL_LINE_LENGTH); - } - - public int getMaxHttpChunkSize() { - return getJVMConfigAsInt(MAX_HTTP_CHUNK_SIZE_IN_BYTES, DEFAULT_MAX_HTTP_CHUNK_SIZE_IN_BYTES); - } - - public int getMaxHttpBodyLength() { - return getJVMConfigAsInt(MAX_HTTP_BODY_LENGTH_IN_BYTES, DEFAULT_MAX_HTTP_BODY_LENGTH_IN_BYTES); - } - - public int getUnavailableLocationsExpirationTimeInSeconds() { - return getJVMConfigAsInt(UNAVAILABLE_LOCATIONS_EXPIRATION_TIME_IN_SECONDS, DEFAULT_UNAVAILABLE_LOCATIONS_EXPIRATION_TIME_IN_SECONDS); - } - - private static String getJVMConfigAsString(String propName, String defaultValue) { - String propValue = System.getProperty(propName); - return StringUtils.defaultString(propValue, defaultValue); - } - - private static int getJVMConfigAsInt(String propName, int defaultValue) { - String propValue = System.getProperty(propName); - return getIntValue(propValue, defaultValue); - } - - private static int getIntValue(String val, int defaultValue) { - if (StringUtils.isEmpty(val)) { - return defaultValue; - } else { - return Integer.valueOf(val); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/DocumentServiceRequestContext.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/DocumentServiceRequestContext.java deleted file mode 100644 index 11adef562364..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/DocumentServiceRequestContext.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.net.URL; -import java.util.List; - -import com.microsoft.azure.cosmosdb.ClientSideRequestStatistics; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.ISessionToken; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResult; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResponse; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.TimeoutHelper; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternal; - -public class DocumentServiceRequestContext implements Cloneable{ - public volatile boolean forceAddressRefresh; - public volatile boolean forceRefreshAddressCache; - public volatile RequestChargeTracker requestChargeTracker; - public volatile TimeoutHelper timeoutHelper; - public volatile String resolvedCollectionRid; - public volatile ISessionToken sessionToken; - public volatile long quorumSelectedLSN; - public volatile long globalCommittedSelectedLSN; - public volatile StoreResponse globalStrongWriteResponse; - public volatile ConsistencyLevel originalRequestConsistencyLevel; - public volatile PartitionKeyRange resolvedPartitionKeyRange; - public volatile Integer regionIndex; - public volatile Boolean usePreferredLocations; - public volatile Integer locationIndexToRoute; - public volatile URL locationEndpointToRoute; - public volatile boolean performedBackgroundAddressRefresh; - public volatile boolean performLocalRefreshOnGoneException; - public volatile List storeResponses; - public volatile StoreResult quorumSelectedStoreResponse; - public volatile PartitionKeyInternal effectivePartitionKey; - public volatile ClientSideRequestStatistics clientSideRequestStatistics; - - /** - * Sets routing directive for GlobalEndpointManager to resolve the request - * to endpoint based on location index. - * - * @param locationIndex Index of the location to which the request should be routed. - * @param usePreferredLocations Use preferred locations to route request. - */ - public void RouteToLocation(int locationIndex, boolean usePreferredLocations) { - this.locationIndexToRoute = locationIndex; - this.usePreferredLocations = usePreferredLocations; - this.locationEndpointToRoute = null; - } - - /** - * Sets location-based routing directive for GlobalEndpointManager to resolve - * the request to given locationEndpoint. - * - * @param locationEndpoint Location endpoint to which the request should be routed. - */ - public void RouteToLocation(URL locationEndpoint) { - this.locationEndpointToRoute = locationEndpoint; - this.locationIndexToRoute = null; - this.usePreferredLocations = null; - } - - /** - * Clears location-based routing directive - */ - public void ClearRouteToLocation() { - this.locationIndexToRoute = null; - this.locationEndpointToRoute = null; - this.usePreferredLocations = null; - } - - @Override - public DocumentServiceRequestContext clone() { - DocumentServiceRequestContext context = new DocumentServiceRequestContext(); - context.forceAddressRefresh = this.forceAddressRefresh; - context.forceRefreshAddressCache = this.forceRefreshAddressCache; - context.requestChargeTracker = this.requestChargeTracker; - context.timeoutHelper = this.timeoutHelper; - context.resolvedCollectionRid = this.resolvedCollectionRid; - context.sessionToken = this.sessionToken; - context.quorumSelectedLSN = this.quorumSelectedLSN; - context.globalCommittedSelectedLSN = this.globalCommittedSelectedLSN; - context.globalStrongWriteResponse = this.globalStrongWriteResponse; - context.originalRequestConsistencyLevel = this.originalRequestConsistencyLevel; - context.resolvedPartitionKeyRange = this.resolvedPartitionKeyRange; - context.regionIndex = this.regionIndex; - context.usePreferredLocations = this.usePreferredLocations; - context.locationIndexToRoute = this.locationIndexToRoute; - context.locationEndpointToRoute = this.locationEndpointToRoute; - context.performLocalRefreshOnGoneException = this.performLocalRefreshOnGoneException; - context.effectivePartitionKey = this.effectivePartitionKey; - context.performedBackgroundAddressRefresh = this.performedBackgroundAddressRefresh; - context.clientSideRequestStatistics = this.clientSideRequestStatistics; - - return context; - } -} - diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/Exceptions.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/Exceptions.java deleted file mode 100644 index 08bea22645da..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/Exceptions.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class Exceptions { - - public static boolean isStatusCode(DocumentClientException e, int status) { - return status == e.getStatusCode(); - } - - public static boolean isSubStatusCode(DocumentClientException e, int subStatus) { - return subStatus == e.getSubStatusCode(); - } - - public static boolean isPartitionSplit(DocumentClientException e) { - return isStatusCode(e, HttpConstants.StatusCodes.GONE) - && isSubStatusCode(e, HttpConstants.SubStatusCodes.PARTITION_KEY_RANGE_GONE); - } - - public static boolean isNameCacheStale(DocumentClientException e) { - return isStatusCode(e, HttpConstants.StatusCodes.GONE) - && isSubStatusCode(e, HttpConstants.SubStatusCodes.NAME_CACHE_IS_STALE); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/HttpClientFactory.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/HttpClientFactory.java deleted file mode 100644 index 99967bb8b404..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/HttpClientFactory.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; -import io.netty.channel.ChannelPipeline; -import io.netty.handler.logging.LogLevel; -import io.netty.handler.logging.LoggingHandler; -import io.netty.handler.proxy.HttpProxyHandler; -import io.netty.handler.ssl.SslContext; -import io.netty.handler.ssl.SslContextBuilder; -import io.netty.handler.ssl.SslHandler; -import io.netty.handler.ssl.SslProvider; -import io.reactivex.netty.pipeline.PipelineConfigurator; -import io.reactivex.netty.pipeline.PipelineConfiguratorComposite; -import io.reactivex.netty.pipeline.ssl.SSLEngineFactory; -import io.reactivex.netty.pipeline.ssl.SslCompletionHandler; -import io.reactivex.netty.protocol.http.HttpObjectAggregationConfigurator; -import io.reactivex.netty.protocol.http.client.CompositeHttpClientBuilder; -import io.reactivex.netty.protocol.http.client.HttpClient.HttpClientConfig; -import io.reactivex.netty.protocol.http.client.HttpClientPipelineConfigurator; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; - -import javax.net.ssl.SSLEngine; -import javax.net.ssl.SSLException; - -import com.microsoft.azure.cosmosdb.internal.Constants; -import org.slf4j.LoggerFactory; - -import java.net.InetSocketAddress; -import java.util.concurrent.TimeUnit; - -/** - * Helper class internally used for instantiating rx http client. - */ -public class HttpClientFactory { - private final static String NETWORK_LOG_CATEGORY = "com.microsoft.azure.cosmosdb.netty-network"; - - private final Configs configs; - private Integer maxPoolSize; - private Integer maxIdleConnectionTimeoutInMillis; - private Integer requestTimeoutInMillis; - private InetSocketAddress proxy; - - public HttpClientFactory(Configs configs) { - this.configs = configs; - } - - public HttpClientFactory withPoolSize(int maxPoolSize) { - this.maxPoolSize = maxPoolSize; - return this; - } - - public HttpClientFactory withHttpProxy(InetSocketAddress proxy) { - this.proxy = proxy; - return this; - } - - public HttpClientFactory withMaxIdleConnectionTimeoutInMillis(int maxIdleConnectionTimeoutInMillis) { - this.maxIdleConnectionTimeoutInMillis = maxIdleConnectionTimeoutInMillis; - return this; - } - - public HttpClientFactory withRequestTimeoutInMillis(int requestTimeoutInMillis) { - this.requestTimeoutInMillis = requestTimeoutInMillis; - return this; - } - - class DefaultSSLEngineFactory implements SSLEngineFactory { - private final SslContext sslContext; - - private DefaultSSLEngineFactory() { - this.sslContext = configs.getSslContext(); - } - - @Override - public SSLEngine createSSLEngine(ByteBufAllocator allocator) { - return sslContext.newEngine(allocator); - } - } - class SslPipelineConfiguratorUsedWithProxy implements PipelineConfigurator { - - private final SSLEngineFactory sslEngineFactory; - - private SslPipelineConfiguratorUsedWithProxy(SSLEngineFactory sslEngineFactory) { - this.sslEngineFactory = sslEngineFactory; - } - - @Override - public void configureNewPipeline(ChannelPipeline pipeline) { - final SslHandler sslHandler = new SslHandler(sslEngineFactory.createSSLEngine(pipeline.channel().alloc())); - if(proxy != null) { - pipeline.addAfter(Constants.Properties.HTTP_PROXY_HANDLER_NAME,Constants.Properties.SSL_HANDLER_NAME, sslHandler); - } else { - pipeline.addFirst(Constants.Properties.SSL_HANDLER_NAME, sslHandler); - } - pipeline.addAfter(Constants.Properties.SSL_HANDLER_NAME, Constants.Properties.SSL_COMPLETION_HANDLER_NAME, - new SslCompletionHandler(sslHandler.handshakeFuture())); - } - } - - public CompositeHttpClientBuilder toHttpClientBuilder() { - - if (configs == null) { - throw new IllegalArgumentException("configs is null"); - } - - DefaultSSLEngineFactory defaultSSLEngineFactory = new DefaultSSLEngineFactory(); - CompositeHttpClientBuilder builder = new CompositeHttpClientBuilder(); - if (maxPoolSize != null) { - builder = builder.withMaxConnections(maxPoolSize); - } - - if (maxIdleConnectionTimeoutInMillis != null) { - builder = builder.withIdleConnectionsTimeoutMillis(maxIdleConnectionTimeoutInMillis); - } - - builder = builder.pipelineConfigurator(pipeline -> { - LoggingHandler loggingHandler = getLoggingHandler(); - - if (loggingHandler != null) { - pipeline.addFirst(Constants.Properties.LOGGING_HANDLER_NAME, loggingHandler); - } - - if(proxy != null) { - pipeline.addFirst(Constants.Properties.HTTP_PROXY_HANDLER_NAME, new HttpProxyHandler(proxy)); - } - }) - .appendPipelineConfigurator(new SslPipelineConfiguratorUsedWithProxy<>(defaultSSLEngineFactory)) - .appendPipelineConfigurator(createClientPipelineConfigurator(configs)); - - if (requestTimeoutInMillis != null) { - HttpClientConfig.Builder clientConfigBuilder = new HttpClientConfig.Builder(); - clientConfigBuilder.readTimeout(requestTimeoutInMillis, TimeUnit.MILLISECONDS); - return builder.config(clientConfigBuilder.build()); - } - - return builder; - } - - private static PipelineConfigurator createClientPipelineConfigurator(Configs config) { - PipelineConfigurator clientPipelineConfigurator = new PipelineConfiguratorComposite( - new HttpClientPipelineConfigurator( - config.getMaxHttpInitialLineLength(), - config.getMaxHttpHeaderSize(), - config.getMaxHttpChunkSize(), - true), - new HttpObjectAggregationConfigurator(config.getMaxHttpBodyLength())); - return clientPipelineConfigurator; - } - - private static LoggingHandler getLoggingHandler() { - if (LoggerFactory.getLogger(NETWORK_LOG_CATEGORY).isTraceEnabled()) { - return new LoggingHandler(NETWORK_LOG_CATEGORY, LogLevel.TRACE); - } - - return null; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/InternalConstants.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/InternalConstants.java deleted file mode 100644 index 991b807d28b6..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/InternalConstants.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -class InternalConstants { - - static class ResourceKeys { - static final String ATTACHMENTS = "Attachments"; - static final String CONFLICTS = "Conflicts"; - static final String DATABASES = "Databases"; - static final String DOCUMENTS = "Documents"; - static final String DOCUMENT_COLLECTIONS = "DocumentCollections"; - static final String OFFERS = "Offers"; - static final String PERMISSIONS = "Permissions"; - static final String PARTITION_KEY_RANGES = "PartitionKeyRanges"; - static final String TRIGGERS = "Triggers"; - static final String STOREDPROCEDURES = "StoredProcedures"; - static final String USERS = "Users"; - static final String USER_DEFINED_FUNCTIONS = "UserDefinedFunctions"; - static final String ADDRESSES = "Addresss"; - } - - static class StreamApi { - static final int STREAM_LENGTH_EOF = -1; - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RMResources.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RMResources.java deleted file mode 100644 index 38a08c2476d5..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RMResources.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -public class RMResources { - - public static final String UnknownResourceType = "Resource type %s is unknown"; - public static final String InvalidDocumentCollection = "The specified document collection is invalid."; - public static final String StringArgumentNullOrEmpty = "String agument %s is null or empty"; - public static final String PartitionKeyAndParitionKeyRangeIdBothSpecified = "Both Partition Key and Partition Key range are Specified in %s"; - public static final String PartitionKeyRangeIdOrPartitionKeyMustBeSpecified = "One of the partition key range id or partition key must be specified"; - public static final String TooFewPartitionKeyComponents = "PartitionKey has fewer components than defined the collection resource."; - public static final String TooManyPartitionKeyComponents = "PartitionKey has more components than defined the collection resource."; - public static final String UnableToDeserializePartitionKeyValue = "Cannot deserialize PartitionKey value '%s"; - public static final String Gone = "The requested resource is no longer available at the server."; - public static final String ExceptionMessageAddIpAddress = "%s, Local IP: %s"; - public static final String ExceptionMessage = "Message: %s"; - public static final String ServiceUnavailable = "Service is currently unavailable, please retry after a while. If this problem persists please contact support."; - public static final String InternalServerError = "Unknown server error occurred when processing this request."; - public static final String InvalidBackendResponse = "The backend response was not in the correct format."; - public static final String PartitionKeyRangeNotFound = "PartitionKeyRange with id %s in collection %s doesn't exist"; - public static final String InvalidTarget = "Target for the request is invalid"; - public static final String InvalidPartitionKey = "Partition key %s is invalid."; - public static final String PartitionKeyMismatch = "Partition key provided either doesn't correspond to definition in the collection or doesn't match partition key field values specified in the document."; - public static final String MissingPartitionKeyValue = "PartitionKey value must be supplied for this operation."; - public static final String InvalidConflictResolutionMode = "Invalid mode '%s' for setting '%s'. MODE expected is '%s'."; - public static final String InvalidRegionsInSessionToken = "Compared session tokens '%s' and '%s' has unexpected regions."; - public static final String InvalidSessionToken = "The session token provided '%s' is invalid."; - public static final String ResourceTokenNotFound = "Resource token not found."; - public static final String Unauthorized = "Unable to authenticate the request. The request requires valid user authentication."; - public static final String Forbidden = "Unable to proceed with the request. Please check the authorization claims to ensure the required permissions to process the request."; - public static final String NotFound = "Entity with the specified id does not exist in the system."; - public static final String BadRequest = "One of the input values is invalid."; - public static final String MethodNotAllowed = "The requested verb is not supported."; - public static final String EntityAlreadyExists = "Entity with the specified id already exists in the system."; - public static final String PreconditionFailed = "Operation cannot be performed because one of the specified precondition is not met."; - public static final String RequestEntityTooLarge = "The size of the response exceeded the maximum allowed size, limit the response size by specifying smaller value for '%s' header."; - public static final String Locked = ""; - public static final String RetryWith = "Retry the request."; - public static final String TooManyRequests = "The request rate is too large. Please retry after sometime."; - public static final String UnexpectedResourceType = "ResourceType %s is unexpected."; - public static final String InvalidHeaderValue = "Value '%s' specified for the header '%s' is invalid."; - public static final String RequestTimeout = "Request timed out."; - public static final String GlobalStrongWriteBarrierNotMet = "Global Strong write barrier has not been met for the request."; - public static final String InvalidRequestHeaderValue = "Invalid value for request header %s: %s"; - public static final String InvalidResourceAddress = "Invalid address for resource %s: %s"; - public static final String ReadQuorumNotMet = "Read Quorum size of %d is not met for the request."; - public static final String ReadSessionNotAvailable = "The read session is not available for the input session token."; - public static final String InvalidUrl = "InvalidUrl"; - public static final String InvalidResourceUrlQuery = "The value %s specified for query %s is invalid."; - public static final String PartitionKeyRangeIdAbsentInContext = "PartitionKeyRangeId is absent in the context."; -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentServiceRequest.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentServiceRequest.java deleted file mode 100644 index d1346deb44c0..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentServiceRequest.java +++ /dev/null @@ -1,1060 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.io.InputStream; -import java.net.URI; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.Map; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.WFConstants; -import org.apache.commons.lang3.StringUtils; - -import com.microsoft.azure.cosmosdb.ChangeFeedOptions; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedOptionsBase; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.PathInfo; -import com.microsoft.azure.cosmosdb.internal.PathsHelper; -import com.microsoft.azure.cosmosdb.internal.QueryCompatibilityMode; -import com.microsoft.azure.cosmosdb.internal.ResourceId; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; - -import rx.Observable; -import rx.observables.StringObservable; - -/** - * This is core Transport/Connection agnostic request to the Azure Cosmos DB database service. - */ -public class RxDocumentServiceRequest { - private static final char PREFER_HEADER_SEPERATOR = ';'; - private static final String PREFER_HEADER_VALUE_FORMAT = "%s=%s"; - - public volatile boolean forcePartitionKeyRangeRefresh; - public volatile boolean forceCollectionRoutingMapRefresh; - private String resourceId; - private final ResourceType resourceType; - private final Map headers; - private volatile String continuation; - private boolean isMedia = false; - private final boolean isNameBased; - private final OperationType operationType; - private final String resourceAddress; - public volatile boolean forceNameCacheRefresh; - private volatile URI endpointOverride = null; - private final String activityId; - private volatile String resourceFullName; - - private volatile String originalSessionToken; - private volatile PartitionKeyRangeIdentity partitionKeyRangeIdentity; - private volatile Integer defaultReplicaIndex; - - public DocumentServiceRequestContext requestContext; - - private Observable contentObservable; - private byte[] byteContent; - - // NOTE: TODO: these fields are copied from .Net SDK - // some of these fields are missing from the main java sdk service request - // so it means most likely the corresponding features are also missing from the main sdk - // we need to wire this up. - public boolean UseGatewayMode; - - private volatile boolean isDisposed = false; - public volatile String entityId; - public volatile String queryString; - public volatile boolean isFeed; - public volatile AuthorizationTokenType authorizationTokenType; - public volatile Map properties; - - public boolean isReadOnlyRequest() { - return this.operationType == OperationType.Read - || this.operationType == OperationType.ReadFeed - || this.operationType == OperationType.Head - || this.operationType == OperationType.HeadFeed - || this.operationType == OperationType.Query - || this.operationType == OperationType.SqlQuery; - } - - public boolean isReadOnlyScript() { - String isReadOnlyScript = this.headers.get(HttpConstants.HttpHeaders.IS_READ_ONLY_SCRIPT); - if(StringUtils.isEmpty(isReadOnlyScript)) { - return false; - } else { - return this.operationType.equals(OperationType.ExecuteJavaScript) && isReadOnlyScript.equalsIgnoreCase(Boolean.TRUE.toString()); - } - } - - /** - * @param operationType the operation type. - * @param resourceIdOrFullName the request id or full name. - * @param resourceType the resource type. - * @param byteContent the byte content. - * @param headers the headers. - * @param isNameBased whether request is name based. - * @param authorizationTokenType the request authorizationTokenType. - */ - private RxDocumentServiceRequest(OperationType operationType, - String resourceIdOrFullName, - ResourceType resourceType, - byte[] byteContent, - Map headers, - boolean isNameBased, - AuthorizationTokenType authorizationTokenType) { - this.operationType = operationType; - this.forceNameCacheRefresh = false; - this.resourceType = resourceType; - this.byteContent = byteContent; - this.headers = headers != null ? headers : new HashMap<>(); - this.activityId = Utils.randomUUID().toString(); - this.isFeed = false; - this.isNameBased = isNameBased; - if (!isNameBased) { - this.resourceId = resourceIdOrFullName; - } - this.resourceAddress = resourceIdOrFullName; - this.authorizationTokenType = authorizationTokenType; - this.requestContext = new DocumentServiceRequestContext(); - if (StringUtils.isNotEmpty(this.headers.get(WFConstants.BackendHeaders.PARTITION_KEY_RANGE_ID))) - this.partitionKeyRangeIdentity = PartitionKeyRangeIdentity.fromHeader(this.headers.get(WFConstants.BackendHeaders.PARTITION_KEY_RANGE_ID)); - } - - /** - * Creates a AbstractDocumentServiceRequest - * - * @param operationType the operation type. - * @param resourceIdOrFullName the request id or full name. - * @param resourceType the resource type. - * @param path the path. - * @param headers the headers - */ - private RxDocumentServiceRequest(OperationType operationType, - String resourceIdOrFullName, - ResourceType resourceType, - String path, - Map headers) { - this.requestContext = new DocumentServiceRequestContext(); - this.operationType = operationType; - this.resourceType = resourceType; - this.requestContext.sessionToken = null; - this.headers = headers != null ? headers : new HashMap<>(); - this.activityId = Utils.randomUUID().toString(); - this.isFeed = false; - PathInfo pathInfo = new PathInfo(false, null, null, false); - if (StringUtils.isNotEmpty(path)) { - if (PathsHelper.tryParsePathSegments(path, pathInfo, null)) { - this.isNameBased = pathInfo.isNameBased; - this.isFeed = pathInfo.isFeed; - resourceIdOrFullName = pathInfo.resourceIdOrFullName; - if (!this.isNameBased) { - if (resourceType == ResourceType.Media) { - this.resourceId = getAttachmentIdFromMediaId(resourceIdOrFullName); - } else { - this.resourceId = resourceIdOrFullName; - } - - this.resourceAddress = resourceIdOrFullName; - - // throw exception when the address parsing fail - // do not parse address for offer resource - if (StringUtils.isNotEmpty(this.resourceId) && !ResourceId.tryParse(this.resourceId).getLeft() - && !resourceType.equals(ResourceType.Offer) && !resourceType.equals(ResourceType.Media) - && !resourceType.equals(ResourceType.MasterPartition) - && !resourceType.equals(ResourceType.ServerPartition) - && !resourceType.equals(ResourceType.DatabaseAccount) - && !resourceType.equals(ResourceType.RidRange)) { - throw new IllegalArgumentException( - String.format(RMResources.InvalidResourceUrlQuery, path, HttpConstants.QueryStrings.URL)); - } - } else { - this.resourceAddress = resourceIdOrFullName; - this.resourceId = null; - } - } else { - throw new IllegalArgumentException(RMResources.NotFound); - } - } else { - this.isNameBased = false; - this.resourceAddress = resourceIdOrFullName; - } - - if (StringUtils.isNotEmpty(this.headers.get(HttpConstants.HttpHeaders.PARTITION_KEY_RANGE_ID))) { - this.partitionKeyRangeIdentity = PartitionKeyRangeIdentity - .fromHeader(this.headers.get(HttpConstants.HttpHeaders.PARTITION_KEY_RANGE_ID)); - } - } - - /** - * Creates a DocumentServiceRequest - * - * @param resourceId the resource Id. - * @param resourceType the resource type. - * @param content the byte content observable\ - * @param contentObservable the byte content observable - * @param headers the request headers. - */ - private RxDocumentServiceRequest(OperationType operationType, - String resourceId, - ResourceType resourceType, - Observable contentObservable, - byte[] content, - String path, - Map headers, - AuthorizationTokenType authorizationTokenType) { - this( operationType, - resourceId, - resourceType, - path, - headers); - this.authorizationTokenType = authorizationTokenType; - this.byteContent = content; - this.contentObservable = contentObservable; - } - - /** - * Creates a DocumentServiceRequest with an HttpEntity. - * - * @param resourceType the resource type. - * @param path the relative URI path. - * @param contentObservable the byte content observable - * @param headers the request headers. - */ - private RxDocumentServiceRequest(OperationType operationType, - ResourceType resourceType, - String path, - Observable contentObservable, - Map headers, - AuthorizationTokenType authorizationTokenType) { - this(operationType, extractIdFromUri(path), resourceType, contentObservable, null, path, headers, authorizationTokenType); - } - - /** - * Creates a DocumentServiceRequest with an HttpEntity. - * - * @param resourceType the resource type. - * @param path the relative URI path. - * @param byteContent the byte content. - * @param headers the request headers. - */ - private RxDocumentServiceRequest(OperationType operationType, - ResourceType resourceType, - String path, - byte[] byteContent, - Map headers, - AuthorizationTokenType authorizationTokenType) { - this(operationType, extractIdFromUri(path), resourceType, null, byteContent, path, headers, authorizationTokenType); - } - - /** - * Creates a DocumentServiceRequest with an HttpEntity. - * - * @param resourceType the resource type. - * @param path the relative URI path. - * @param headers the request headers. - */ - private RxDocumentServiceRequest(OperationType operationType, - ResourceType resourceType, - String path, - Map headers, - AuthorizationTokenType authorizationTokenType) { - this(operationType, extractIdFromUri(path), resourceType, null , null, path, headers, authorizationTokenType); - } - - public void setContentBytes(byte[] bytes) { - this.byteContent = bytes; - } - - /** - * Creates a DocumentServiceRequest with a stream. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param content the content observable - * @param headers the request headers. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - ResourceType resourceType, - String relativePath, - Observable content, - Map headers) { - return new RxDocumentServiceRequest(operation, resourceType, relativePath, content, headers, AuthorizationTokenType.PrimaryMasterKey); - } - - /** - * Creates a DocumentServiceRequest with a stream. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param content the content observable - * @param headers the request headers. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - ResourceType resourceType, - String relativePath, - Observable content, - Map headers, - AuthorizationTokenType authorizationTokenType) { - return new RxDocumentServiceRequest(operation, resourceType, relativePath, content, headers, authorizationTokenType); - } - - /** Creates a DocumentServiceRequest with a stream. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param inputStream the input stream. - * @param headers the request headers. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - ResourceType resourceType, - String relativePath, - InputStream inputStream, - Map headers) { - // StringObservable is mis-named. It doesn't make any assumptions on character set - // and handles bytes only - return new RxDocumentServiceRequest(operation, resourceType, relativePath, StringObservable.from(inputStream), headers, AuthorizationTokenType.PrimaryMasterKey); - } - - /** Creates a DocumentServiceRequest with a stream. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param inputStream the input stream. - * @param headers the request headers. - * @param authorizationTokenType the request authorizationTokenType. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - ResourceType resourceType, - String relativePath, - InputStream inputStream, - Map headers, - AuthorizationTokenType authorizationTokenType) { - // StringObservable is mis-named. It doesn't make any assumptions on character set - // and handles bytes only - return new RxDocumentServiceRequest(operation, resourceType, relativePath, StringObservable.from(inputStream), headers, authorizationTokenType); - } - - /** - * Creates a DocumentServiceRequest with a resource. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param resource the resource of the request. - * @param headers the request headers. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - ResourceType resourceType, - String relativePath, - Resource resource, - Map headers) { - return RxDocumentServiceRequest.create(operation, resourceType, relativePath, resource, headers, (RequestOptions)null); - } - - /** - * Creates a DocumentServiceRequest with a resource. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param resource the resource of the request. - * @param headers the request headers. - * @param options the request/feed/changeFeed options. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - ResourceType resourceType, - String relativePath, - Resource resource, - Map headers, - Object options) { - - RxDocumentServiceRequest request = new RxDocumentServiceRequest(operation, resourceType, relativePath, - // TODO: this re-encodes, can we improve performance here? - resource.toJson().getBytes(StandardCharsets.UTF_8), headers, AuthorizationTokenType.PrimaryMasterKey); - request.properties = getProperties(options); - return request; - } - - /** - * Creates a DocumentServiceRequest with a query. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param query the query. - * @param headers the request headers. - * @param options the request/feed/changeFeed options. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - ResourceType resourceType, - String relativePath, - String query, - Map headers, - Object options) { - RxDocumentServiceRequest request = new RxDocumentServiceRequest(operation, resourceType, relativePath, - query.getBytes(StandardCharsets.UTF_8), headers, AuthorizationTokenType.PrimaryMasterKey); - request.properties = getProperties(options); - return request; - } - - /** - * Creates a DocumentServiceRequest with a query. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param query the query. - * @param headers the request headers. - * @param authorizationTokenType the request authorizationTokenType. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - ResourceType resourceType, - String relativePath, - String query, - Map headers, - AuthorizationTokenType authorizationTokenType) { - return new RxDocumentServiceRequest(operation, resourceType, relativePath, - query.getBytes(StandardCharsets.UTF_8), headers, authorizationTokenType); - } - - /** - * Creates a DocumentServiceRequest with a query. - * - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param querySpec the query. - * @param queryCompatibilityMode the QueryCompatibilityMode mode. - * @param headers the request headers. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(ResourceType resourceType, - String relativePath, - SqlQuerySpec querySpec, - QueryCompatibilityMode queryCompatibilityMode, - Map headers) { - OperationType operation; - String queryText; - switch (queryCompatibilityMode) { - case SqlQuery: - if (querySpec.getParameters() != null && querySpec.getParameters().size() > 0) { - throw new IllegalArgumentException( - String.format("Unsupported argument in query compatibility mode '{%s}'", - queryCompatibilityMode.name())); - } - - operation = OperationType.SqlQuery; - queryText = querySpec.getQueryText(); - break; - - case Default: - case Query: - default: - operation = OperationType.Query; - queryText = querySpec.toJson(); - break; - } - - Observable body = StringObservable.encode(Observable.just(queryText), StandardCharsets.UTF_8); - return new RxDocumentServiceRequest(operation, resourceType, relativePath, body, headers, AuthorizationTokenType.PrimaryMasterKey); - } - - /** - * Creates a DocumentServiceRequest without body. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param headers the request headers. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - ResourceType resourceType, - String relativePath, - Map headers) { - return RxDocumentServiceRequest.create(operation, resourceType, relativePath, headers, (RequestOptions)null); - } - - /** - * Creates a DocumentServiceRequest without body. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param headers the request headers. - * @param options the request/feed/changeFeed options. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - ResourceType resourceType, - String relativePath, - Map headers, - Object options) { - RxDocumentServiceRequest request = new RxDocumentServiceRequest(operation, resourceType, relativePath, headers, AuthorizationTokenType.PrimaryMasterKey); - request.properties = getProperties(options); - return request; - } - - /** - * Creates a DocumentServiceRequest without body. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param headers the request headers. - * @param authorizationTokenType the request authorizationTokenType. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - ResourceType resourceType, - String relativePath, - Map headers, - AuthorizationTokenType authorizationTokenType) { - return new RxDocumentServiceRequest(operation, resourceType, relativePath, headers, authorizationTokenType); - } - - /** - * Creates a DocumentServiceRequest without body. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param headers the request headers. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - Resource resource, - ResourceType resourceType, - String relativePath, - Map headers) { - byte[] resourceContent = resource.toJson().getBytes(StandardCharsets.UTF_8); - return new RxDocumentServiceRequest(operation, resourceType, relativePath, resourceContent, headers, AuthorizationTokenType.PrimaryMasterKey); - } - - /** - * Creates a DocumentServiceRequest without body. - * - * @param operation the operation type. - * @param resourceType the resource type. - * @param relativePath the relative URI path. - * @param headers the request headers. - * @param authorizationTokenType the request authorizationTokenType. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - Resource resource, - ResourceType resourceType, - String relativePath, - Map headers, - AuthorizationTokenType authorizationTokenType) { - byte[] resourceContent = resource.toJson().getBytes(StandardCharsets.UTF_8); - return new RxDocumentServiceRequest(operation, resourceType, relativePath, resourceContent, headers, authorizationTokenType); - } - - /** - * Creates a DocumentServiceRequest with a resourceId. - * - * @param operation the operation type. - * @param resourceId the resource id. - * @param resourceType the resource type. - * @param headers the request headers. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - String resourceId, - ResourceType resourceType, - Map headers) { - return new RxDocumentServiceRequest(operation, resourceId,resourceType, null, headers, false, AuthorizationTokenType.PrimaryMasterKey) ; - } - - /** - * Creates a DocumentServiceRequest with a resourceId. - * - * @param operation the operation type. - * @param resourceId the resource id. - * @param resourceType the resource type. - * @param headers the request headers. - * @param authorizationTokenType the request authorizationTokenType. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - String resourceId, - ResourceType resourceType, - Map headers, - AuthorizationTokenType authorizationTokenType) { - return new RxDocumentServiceRequest(operation, resourceId, resourceType, null, headers, false, authorizationTokenType); - } - - /** - * Creates a DocumentServiceRequest with a resourceId. - * - * @param operation the operation type. - * @param resourceId the resource id. - * @param resourceType the resource type. - * @param headers the request headers. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - String resourceId, - ResourceType resourceType, - Resource resource, - Map headers) { - byte[] resourceContent = resource.toJson().getBytes(StandardCharsets.UTF_8); - return new RxDocumentServiceRequest(operation, resourceId, resourceType, resourceContent, headers, false, AuthorizationTokenType.PrimaryMasterKey); - } - - /** - * Creates a DocumentServiceRequest with a resourceId. - * - * @param operation the operation type. - * @param resourceId the resource id. - * @param resourceType the resource type. - * @param headers the request headers. - * @param authorizationTokenType the request authorizationTokenType. - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - String resourceId, - ResourceType resourceType, - Resource resource, - Map headers, - AuthorizationTokenType authorizationTokenType) { - byte[] resourceContent = resource.toJson().getBytes(StandardCharsets.UTF_8); - return new RxDocumentServiceRequest(operation, resourceId, resourceType, resourceContent, headers, false, authorizationTokenType); - } - - /** - * Creates a DocumentServiceRequest with operationType and resourceType - * @param operation the operation type - * @param resourceType the resource type - * @return the created document service request. - */ - public static RxDocumentServiceRequest create(OperationType operation, - ResourceType resourceType) { - return new RxDocumentServiceRequest(operation, null, resourceType, null, null); - } - - public static RxDocumentServiceRequest createFromName( - OperationType operationType, - String resourceFullName, - ResourceType resourceType) { - return new RxDocumentServiceRequest(operationType, - resourceFullName, - resourceType, - null, - new HashMap<>(), - true, - AuthorizationTokenType.PrimaryMasterKey - ); - } - - public static RxDocumentServiceRequest createFromName( - OperationType operationType, - String resourceFullName, - ResourceType resourceType, - AuthorizationTokenType authorizationTokenType) { - return new RxDocumentServiceRequest(operationType, - resourceFullName, - resourceType, - null, - new HashMap<>(), - true, - authorizationTokenType - ); - } - - public static RxDocumentServiceRequest createFromName( - OperationType operationType, - Resource resource, - String resourceFullName, - ResourceType resourceType) { - byte[] resourceContent = resource.toJson().getBytes(StandardCharsets.UTF_8); - return new RxDocumentServiceRequest(operationType, - resourceFullName, - resourceType, - resourceContent, - new HashMap<>(), - true, - AuthorizationTokenType.PrimaryMasterKey - ); - } - - public static RxDocumentServiceRequest createFromName( - OperationType operationType, - Resource resource, - String resourceFullName, - ResourceType resourceType, - AuthorizationTokenType authorizationTokenType) { - byte[] resourceContent = resource.toJson().getBytes(StandardCharsets.UTF_8); - return new RxDocumentServiceRequest(operationType, - resourceFullName, - resourceType, - resourceContent, - new HashMap<>(), - true, - authorizationTokenType - ); - } - - private static String extractIdFromUri(String path) { - if (path.length() == 0) { - return path; - } - - if (path.charAt(path.length() - 1) != '/') { - path = path + '/'; - } - - if (path.charAt(0) != '/') { - path = '/' + path; - } - // This is a hack. We need a padding '=' so that path.split("/") - // returns even number of string pieces. - // TODO(pushi): Improve the code and remove the hack. - path = path + '='; - - // The path will be in the form of - // /[resourceType]/[resourceId]/ or - // /[resourceType]/[resourceId]/[resourceType]/ - // The result of split will be in the form of - // [[[resourceType], [resourceId] ... ,[resourceType], ""] - // In the first case, to extract the resourceId it will the element - // before last ( at length -2 ) and the type will before it - // ( at length -3 ) - // In the second case, to extract the resource type it will the element - // before last ( at length -2 ) - String[] pathParts = StringUtils.split(path, "/"); - if (pathParts.length % 2 == 0) { - // request in form /[resourceType]/[resourceId]/. - return pathParts[pathParts.length - 2]; - } else { - // request in form /[resourceType]/[resourceId]/[resourceType]/. - return pathParts[pathParts.length - 3]; - } - } - - static String getAttachmentIdFromMediaId(String mediaId) { - // '/' was replaced with '-'. - byte[] buffer = Utils.Base64Decoder.decode(mediaId.replace('-', '/').getBytes()); - - final int resoureIdLength = 20; - String attachmentId; - - if (buffer.length > resoureIdLength) { - // We are cuting off the storage index. - byte[] newBuffer = new byte[resoureIdLength]; - System.arraycopy(buffer, 0, newBuffer, 0, resoureIdLength); - attachmentId = Utils.encodeBase64String(newBuffer).replace('/', '-'); - } else { - attachmentId = mediaId; - } - - return attachmentId; - } - - /** - * Gets the resource id. - * - * @return the resource id. - */ - public String getResourceId() { - return this.resourceId; - } - - /** - * Sets the resource id. - * - */ - public void setResourceId(String resourceId) { - this.resourceId = resourceId; - } - - /** - * Gets the resource type. - * - * @return the resource type. - */ - public ResourceType getResourceType() { - return this.resourceType; - } - - /** - * Gets the request headers. - * - * @return the request headers. - */ - public Map getHeaders() { - return this.headers; - } - - /** - * Gets the continuation. - * - * @return the continuation. - */ - public String getContinuation() { - return this.continuation; - } - - public void setContinuation(String continuation) { - this.continuation = continuation; - } - - public boolean getIsMedia() { - return this.isMedia; - } - - public void setIsMedia(boolean isMedia) { - this.isMedia = isMedia; - } - - public boolean getIsNameBased() { - return this.isNameBased; - } - - public OperationType getOperationType() { - return this.operationType; - } - - public String getResourceAddress() { - return resourceAddress; - } - - public boolean isForceNameCacheRefresh() { - return forceNameCacheRefresh; - } - - public void setForceNameCacheRefresh(boolean forceNameCacheRefresh) { - this.forceNameCacheRefresh = forceNameCacheRefresh; - } - - public URI getEndpointOverride() { - return this.endpointOverride; - } - - public void setEndpointOverride(URI endpointOverride) { - this.endpointOverride = endpointOverride; - } - - public String getActivityId() { - return this.activityId; - } - - public PartitionKeyRangeIdentity getPartitionKeyRangeIdentity() { - return partitionKeyRangeIdentity; - } - - public void routeTo(PartitionKeyRangeIdentity partitionKeyRangeIdentity) { - this.setPartitionKeyRangeIdentity(partitionKeyRangeIdentity); - } - - public void setPartitionKeyRangeIdentity(PartitionKeyRangeIdentity partitionKeyRangeIdentity) { - this.partitionKeyRangeIdentity = partitionKeyRangeIdentity; - if (partitionKeyRangeIdentity != null) { - this.headers.put(HttpConstants.HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeIdentity.toHeader()); - } else { - this.headers.remove(HttpConstants.HttpHeaders.PARTITION_KEY_RANGE_ID); - } - } - - public String getOriginalSessionToken() { - return originalSessionToken; - } - - public void setOriginalSessionToken(String originalSessionToken) { - this.originalSessionToken = originalSessionToken; - } - - public void setDefaultReplicaIndex(Integer defaultReplicaIndex) { - this.defaultReplicaIndex = defaultReplicaIndex; - } - - public Integer getDefaultReplicaIndex() { - return defaultReplicaIndex; - } - - public boolean isChangeFeedRequest() { - return this.headers.containsKey(HttpConstants.HttpHeaders.A_IM); - } - - public boolean isWritingToMaster() { - return operationType.isWriteOperation() && resourceType.isMasterResource(); - } - - public boolean isReadingFromMaster() { - if (resourceType == ResourceType.Offer || - resourceType == ResourceType.Database || - resourceType == ResourceType.User || - resourceType == ResourceType.Permission || - resourceType == ResourceType.Topology || - resourceType == ResourceType.DatabaseAccount || - resourceType == ResourceType.PartitionKeyRange || - (resourceType == ResourceType.DocumentCollection - && (operationType == OperationType.ReadFeed - || operationType == OperationType.Query - || operationType == OperationType.SqlQuery))) { - return true; - } - return false; - } - - public boolean isValidAddress(ResourceType resourceType) { - ResourceType resourceTypeToValidate = ResourceType.Unknown; - - if(resourceType != ResourceType.Unknown) { - resourceTypeToValidate = resourceType; - } else { - if(!this.isFeed) { - resourceTypeToValidate =this.resourceType; - } else { - if(this.resourceType == ResourceType.Database) { - return true; - } else if(this.resourceType == ResourceType.DocumentCollection || - this.resourceType == ResourceType.User) { - resourceTypeToValidate = ResourceType.Database; - } else if(this.resourceType == ResourceType.Permission) { - resourceTypeToValidate = ResourceType.User; - } else if(this.resourceType == ResourceType.Document || - this.resourceType == ResourceType.StoredProcedure || - this.resourceType == ResourceType.UserDefinedFunction || - this.resourceType == ResourceType.Trigger || - this.resourceType == ResourceType.Conflict || - this.resourceType == ResourceType.PartitionKeyRange) { - resourceTypeToValidate = ResourceType.DocumentCollection; - } else if(this.resourceType == ResourceType.Attachment) { - resourceTypeToValidate = ResourceType.Document; - } else { - return false; - } - } - } - - if (this.isNameBased) { - return PathsHelper.validateResourceFullName(resourceType != ResourceType.Unknown ? resourceType : resourceTypeToValidate, this.resourceAddress); - } else { - return PathsHelper.validateResourceId(resourceTypeToValidate, this.resourceId); - } - } - - public void addPreferHeader(String preferHeaderName, String preferHeaderValue) { - String headerToAdd = String.format(PREFER_HEADER_VALUE_FORMAT, preferHeaderName, preferHeaderValue); - String preferHeader = this.headers.get(HttpConstants.HttpHeaders.PREFER); - if(StringUtils.isNotEmpty(preferHeader)) { - preferHeader += PREFER_HEADER_SEPERATOR + headerToAdd; - } else { - preferHeader = headerToAdd; - } - this.headers.put(HttpConstants.HttpHeaders.PREFER, preferHeader); - } - - public static RxDocumentServiceRequest CreateFromResource(RxDocumentServiceRequest request, Resource modifiedResource) { - RxDocumentServiceRequest modifiedRequest; - if (!request.getIsNameBased()) { - modifiedRequest = RxDocumentServiceRequest.create(request.getOperationType(), - request.getResourceId(), - request.getResourceType(), - modifiedResource, - request.headers); - } else { - modifiedRequest = RxDocumentServiceRequest.createFromName(request.getOperationType(), - modifiedResource, - request.getResourceAddress(), - request.getResourceType()); - } - return modifiedRequest; - } - - public void clearRoutingHints() { - this.partitionKeyRangeIdentity = null; - this.requestContext.resolvedPartitionKeyRange = null; - } - - public Observable getContentObservable() { - return contentObservable; - } - - public byte[] getContent() { - return byteContent; - } - - public RxDocumentServiceRequest clone() { - RxDocumentServiceRequest rxDocumentServiceRequest = RxDocumentServiceRequest.create(this.getOperationType(), this.resourceId,this.getResourceType(),this.getHeaders()); - rxDocumentServiceRequest.setContentBytes(this.getContent()); - rxDocumentServiceRequest.setContinuation(this.getContinuation()); - rxDocumentServiceRequest.setDefaultReplicaIndex(this.getDefaultReplicaIndex()); - rxDocumentServiceRequest.setEndpointOverride(this.getEndpointOverride()); - rxDocumentServiceRequest.setForceNameCacheRefresh(this.isForceNameCacheRefresh()); - rxDocumentServiceRequest.setIsMedia(this.getIsMedia()); - rxDocumentServiceRequest.setOriginalSessionToken(this.getOriginalSessionToken()); - rxDocumentServiceRequest.setPartitionKeyRangeIdentity(this.getPartitionKeyRangeIdentity()); - rxDocumentServiceRequest.contentObservable = this.getContentObservable(); - rxDocumentServiceRequest.forceCollectionRoutingMapRefresh = this.forceCollectionRoutingMapRefresh; - rxDocumentServiceRequest.forcePartitionKeyRangeRefresh = this.forcePartitionKeyRangeRefresh; - rxDocumentServiceRequest.UseGatewayMode = this.UseGatewayMode; - rxDocumentServiceRequest.queryString = this.queryString; - rxDocumentServiceRequest.requestContext = this.requestContext; - return rxDocumentServiceRequest; - } - - public void Dispose() { - if (this.isDisposed) { - return; - } - - if (this.byteContent != null) { - this.byteContent = null; - } - - this.isDisposed = true; - } - - private static Map getProperties(Object options) { - if (options == null) { - return null; - } else if (options instanceof RequestOptions) { - return ((RequestOptions) options).getProperties(); - } else if (options instanceof FeedOptionsBase) { - return ((FeedOptionsBase) options).getProperties(); - } else { - return null; - } - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentServiceResponse.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentServiceResponse.java deleted file mode 100644 index 0cc618257ab5..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentServiceResponse.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.microsoft.azure.cosmosdb.Attachment; -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ClientSideRequestStatistics; -import com.microsoft.azure.cosmosdb.Conflict; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.Offer; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Permission; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.StoredProcedure; -import com.microsoft.azure.cosmosdb.Trigger; -import com.microsoft.azure.cosmosdb.User; -import com.microsoft.azure.cosmosdb.UserDefinedFunction; -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.PathsHelper; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Address; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResponse; -import org.apache.commons.lang3.StringUtils; - -import java.io.IOException; -import java.io.InputStream; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * This is core Transport/Connection agnostic response for the Azure Cosmos DB database service. - */ -public class RxDocumentServiceResponse { - private final int statusCode; - private final Map headersMap; - private final StoreResponse storeResponse; - - public RxDocumentServiceResponse(StoreResponse response) { - String[] headerNames = response.getResponseHeaderNames(); - String[] headerValues = response.getResponseHeaderValues(); - - this.headersMap = new HashMap<>(headerNames.length); - - // Gets status code. - this.statusCode = response.getStatus(); - - // Extracts headers. - for (int i = 0; i < headerNames.length; i++) { - this.headersMap.put(headerNames[i], headerValues[i]); - } - - this.storeResponse = response; - } - - public static String getResourceKey(Class c) { - if (c.equals(Attachment.class)) { - return InternalConstants.ResourceKeys.ATTACHMENTS; - } else if (c.equals(Conflict.class)) { - return InternalConstants.ResourceKeys.CONFLICTS; - } else if (c.equals(Database.class)) { - return InternalConstants.ResourceKeys.DATABASES; - } else if (Document.class.isAssignableFrom(c)) { - return InternalConstants.ResourceKeys.DOCUMENTS; - } else if (c.equals(DocumentCollection.class)) { - return InternalConstants.ResourceKeys.DOCUMENT_COLLECTIONS; - } else if (c.equals(Offer.class)) { - return InternalConstants.ResourceKeys.OFFERS; - } else if (c.equals(Permission.class)) { - return InternalConstants.ResourceKeys.PERMISSIONS; - } else if (c.equals(Trigger.class)) { - return InternalConstants.ResourceKeys.TRIGGERS; - } else if (c.equals(StoredProcedure.class)) { - return InternalConstants.ResourceKeys.STOREDPROCEDURES; - } else if (c.equals(User.class)) { - return InternalConstants.ResourceKeys.USERS; - } else if (c.equals(UserDefinedFunction.class)) { - return InternalConstants.ResourceKeys.USER_DEFINED_FUNCTIONS; - } else if (c.equals(Address.class)) { - return InternalConstants.ResourceKeys.ADDRESSES; - } else if (c.equals(PartitionKeyRange.class)) { - return InternalConstants.ResourceKeys.PARTITION_KEY_RANGES; - } - - throw new IllegalArgumentException("c"); - } - - public int getStatusCode() { - return this.statusCode; - } - - public Map getResponseHeaders() { - return this.headersMap; - } - - public String getReponseBodyAsString() { - return this.storeResponse.getResponseBody(); - } - - public T getResource(Class c) { - String responseBody = this.getReponseBodyAsString(); - if (StringUtils.isEmpty(responseBody)) - return null; - - T resource = null; - try { - resource = c.getConstructor(String.class).newInstance(responseBody); - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException - | NoSuchMethodException | SecurityException e) { - throw new IllegalStateException("Failed to instantiate class object.", e); - } - if(PathsHelper.isPublicResource(resource)) { - BridgeInternal.setAltLink(resource, PathsHelper.generatePathForNameBased(resource, this.getOwnerFullName(),resource.getId())); - } - - return resource; - } - - public List getQueryResponse(Class c) { - String responseBody = this.getReponseBodyAsString(); - if (responseBody == null) { - return new ArrayList(); - } - - JsonNode jobject = fromJson(responseBody); - String resourceKey = RxDocumentServiceResponse.getResourceKey(c); - ArrayNode jTokenArray = (ArrayNode) jobject.get(resourceKey); - - // Aggregate queries may return a nested array - ArrayNode innerArray; - while (jTokenArray != null && jTokenArray.size() == 1 && (innerArray = toArrayNode(jTokenArray.get(0))) != null) { - jTokenArray = innerArray; - } - - List queryResults = new ArrayList(); - - if (jTokenArray != null) { - for (int i = 0; i < jTokenArray.size(); ++i) { - JsonNode jToken = jTokenArray.get(i); - // Aggregate on single partition collection may return the aggregated value only - // In that case it needs to encapsulated in a special document - String resourceJson = jToken.isNumber() || jToken.isBoolean() - ? String.format("{\"%s\": %s}", Constants.Properties.AGGREGATE, jToken.asText()) - : toJson(jToken); - T resource = null; - try { - resource = c.getConstructor(String.class).newInstance(resourceJson); - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException | NoSuchMethodException | SecurityException e) { - throw new IllegalStateException("Failed to instantiate class object.", e); - } - - queryResults.add(resource); - } - } - - return queryResults; - } - - private ArrayNode toArrayNode(JsonNode n) { - if (n.isArray()) { - return (ArrayNode) n; - } else { - return null; - } - } - - private static JsonNode fromJson(String json){ - try { - return Utils.getSimpleObjectMapper().readTree(json); - } catch (IOException e) { - throw new IllegalStateException(String.format("Unable to parse JSON %s", json), e); - } - } - - private static String toJson(Object object){ - try { - return Utils.getSimpleObjectMapper().writeValueAsString(object); - } catch (JsonProcessingException e) { - throw new IllegalStateException("Can't serialize the object into the json string", e); - } - } - - private String getOwnerFullName() { - if (this.headersMap != null) { - return this.headersMap.get(HttpConstants.HttpHeaders.OWNER_FULL_NAME); - } - return null; - } - - public InputStream getContentStream() { - return this.storeResponse.getResponseStream(); - } - - public ClientSideRequestStatistics getClientSideRequestStatistics() { - if (this.storeResponse == null) { - return null; - } - return this.storeResponse.getClientSideRequestStatistics(); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/Strings.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/Strings.java deleted file mode 100644 index 468872ac4319..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/Strings.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import org.apache.commons.lang3.StringUtils; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class Strings { - public static final String Emtpy = ""; - - public static boolean isNullOrWhiteSpace(String str) { - return StringUtils.isEmpty(str) || StringUtils.isWhitespace(str); - } - public static boolean isNullOrEmpty(String str) { - return StringUtils.isEmpty(str); - } - - public static String toString(boolean value) { - return Boolean.toString(value); - } - - public static String toString(int value) { - return Integer.toString(value); - } - - public static boolean areEqual(String str1, String str2) { - return StringUtils.equals(str1, str2); - } - - public static boolean areEqualIgnoreCase(String str1, String str2) { - return StringUtils.equalsIgnoreCase(str1, str2); - } - - public static boolean containsIgnoreCase(String str1, String str2) { - return StringUtils.containsIgnoreCase(str1, str2); - } - - public static int compare(String str1, String str2) { - return StringUtils.compare(str1, str2); - } - - public static String toCamelCase(String str) { - if (isNullOrEmpty(str)) { - return str; - } - - return str.substring(0, 1).toUpperCase() + str.substring(1, str.length()).toLowerCase(); - } -} diff --git a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/Utils.java b/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/Utils.java deleted file mode 100644 index 118aa91d3f0b..000000000000 --- a/cosmosdb/data-plane/commons/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/Utils.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class Utils { - - public static int getValueOrDefault(Integer val, int defaultValue) { - return val != null ? val.intValue() : defaultValue; - } - - public static void checkStateOrThrow(boolean value, String argumentName, String message) throws IllegalArgumentException { - - IllegalArgumentException t = checkStateOrReturnException(value, argumentName, message); - if (t != null) { - throw t; - } - } - - public static void checkNotNullOrThrow(Object val, String argumentName, String message) throws NullPointerException { - - NullPointerException t = checkNotNullOrReturnException(val, argumentName, message); - if (t != null) { - throw t; - } - } - - public static void checkStateOrThrow(boolean value, String argumentName, String messageTemplate, Object... messageTemplateParams) throws IllegalArgumentException { - IllegalArgumentException t = checkStateOrReturnException(value, argumentName, argumentName, messageTemplateParams); - if (t != null) { - throw t; - } - } - - public static IllegalArgumentException checkStateOrReturnException(boolean value, String argumentName, String message) { - - if (value) { - return null; - } - - return new IllegalArgumentException(String.format("argumentName: %s, message: %s", argumentName, message)); - } - - public static IllegalArgumentException checkStateOrReturnException(boolean value, String argumentName, String messageTemplate, Object... messageTemplateParams) { - if (value) { - return null; - } - - return new IllegalArgumentException(String.format("argumentName: %s, message: %s", argumentName, String.format(messageTemplate, messageTemplateParams))); - } - - private static NullPointerException checkNotNullOrReturnException(Object val, String argumentName, String messageTemplate, Object... messageTemplateParams) { - if (val != null) { - return null; - } - - return new NullPointerException(String.format("argumentName: %s, message: %s", argumentName, String.format(messageTemplate, messageTemplateParams))); - } - - public static BadRequestException checkRequestOrReturnException(boolean value, String argumentName, String message) { - - if (value) { - return null; - } - - return new BadRequestException(String.format("argumentName: %s, message: %s", argumentName, message)); - } - - public static BadRequestException checkRequestOrReturnException(boolean value, String argumentName, String messageTemplate, Object... messageTemplateParams) { - if (value) { - return null; - } - - return new BadRequestException(String.format("argumentName: %s, message: %s", argumentName, String.format(messageTemplate, messageTemplateParams))); - } - - @SuppressWarnings("unchecked") - public static O as(I i, Class klass) { - if (i == null) { - return null; - } - - if (klass.isInstance(i)) { - return (O) i; - } else { - return null; - } - } - - @SuppressWarnings("unchecked") - public static List immutableListOf() { - return Collections.EMPTY_LIST; - } - - public static List immutableListOf(V v1) { - List list = new ArrayList<>(); - list.add(v1); - return Collections.unmodifiableList(list); - } - - public static MapimmutableMapOf() { - return Collections.emptyMap(); - } - - public static MapimmutableMapOf(K k1, V v1) { - Map map = new HashMap(); - map.put(k1, v1); - map = Collections.unmodifiableMap(map); - return map; - } - - public static V firstOrDefault(List list) { - return list.size() > 0? list.get(0) : null ; - } - - public static class ValueHolder { - - public ValueHolder() { - } - - public ValueHolder(V v) { - this.v = v; - } - public V v; - - public static ValueHolder initialize(T v) { - return new ValueHolder(v); - } - } - - public static boolean tryGetValue(Map dictionary, K key, ValueHolder holder) { - // doesn't work for dictionary with null value - holder.v = dictionary.get(key); - return holder.v != null; - } - - public static boolean tryRemove(Map dictionary, K key, ValueHolder holder) { - // doesn't work for dictionary with null value - holder.v = dictionary.remove(key); - return holder.v != null; - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/ConflictTests.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/ConflictTests.java deleted file mode 100644 index 9139d319d52e..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/ConflictTests.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import org.apache.commons.io.IOUtils; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -public class ConflictTests { - private String conflictAsString; - - @BeforeClass(groups = { "unit" }) - public void setup() throws Exception { - conflictAsString = IOUtils.toString( - getClass().getClassLoader().getResourceAsStream("sampleConflict.json"), "UTF-8"); - } - - @Test(groups = { "unit" }) - public void getSourceResourceId() { - Conflict conf = new Conflict(conflictAsString); - assertThat(conf.getSourceResourceId()).isEqualTo("k6d9ALgBmD+ChB4AAAAAAA=="); - } - - @Test(groups = { "unit" }) - public void getOperationKind() { - Conflict conf = new Conflict(conflictAsString); - assertThat(conf.getOperationKind()).isEqualTo("create"); - conf.getSourceResourceId(); - } - - @Test(groups = { "unit" }) - public void getResourceType() { - Conflict conf = new Conflict(conflictAsString); - assertThat(conf.getResouceType()).isEqualTo("document"); - conf.getSourceResourceId(); - } - - @Test(groups = { "unit" }) - public void getResource() { - Conflict conf = new Conflict(conflictAsString); - Document doc = conf.getResource(Document.class); - assertThat(doc.getId()).isEqualTo("0007312a-a1c5-4b54-9e39-35de2367fa33"); - assertThat(doc.getInt("regionId")).isEqualTo(2); - assertThat(doc.getResourceId()).isEqualTo("k6d9ALgBmD+ChB4AAAAAAA=="); - assertThat(doc.getETag()).isEqualTo("\"00000200-0000-0000-0000-5b6e214b0000\""); - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/ConnectionPolicyTest.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/ConnectionPolicyTest.java deleted file mode 100644 index 5b4d34817b6a..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/ConnectionPolicyTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -public class ConnectionPolicyTest { - - @DataProvider(name = "connectionModeArgProvider") - public Object[][] connectionModeArgProvider() { - return new Object[][]{ - { ConnectionMode.Gateway }, - { ConnectionMode.Direct }, - }; - } - - @Test(groups = { "unit" }, dataProvider = "connectionModeArgProvider") - public void connectionMode(ConnectionMode connectionMode) { - ConnectionPolicy policy = new ConnectionPolicy(); - policy.setConnectionMode(connectionMode); - - assertThat(policy.getConnectionMode()).isEqualTo(connectionMode); - } - - @DataProvider(name = "connectionProtocolModeArgProvider") - public Object[][] connectionProtocolModeArgProvider() { - return new Object[][]{ - { Protocol.Https }, - { Protocol.Tcp }, - }; - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/DocumentClientExceptionTest.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/DocumentClientExceptionTest.java deleted file mode 100644 index ddf535c3c577..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/DocumentClientExceptionTest.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.google.common.collect.ImmutableMap; -import org.testng.annotations.Test; - -import java.util.Map; - -import static org.assertj.core.api.Assertions.assertThat; - -public class DocumentClientExceptionTest { - - @Test(groups = { "unit" }) - public void headerNotNull1() { - DocumentClientException dce = new DocumentClientException(0); - assertThat(dce.getResponseHeaders()).isNotNull(); - assertThat(dce.getResponseHeaders()).isEmpty(); - } - - @Test(groups = { "unit" }) - public void headerNotNull2() { - DocumentClientException dce = new DocumentClientException(0, "dummy"); - assertThat(dce.getResponseHeaders()).isNotNull(); - assertThat(dce.getResponseHeaders()).isEmpty(); - } - - @Test(groups = { "unit" }) - public void headerNotNull3() { - DocumentClientException dce = new DocumentClientException(0, new RuntimeException()); - assertThat(dce.getResponseHeaders()).isNotNull(); - assertThat(dce.getResponseHeaders()).isEmpty(); - } - - @Test(groups = { "unit" }) - public void headerNotNull4() { - DocumentClientException dce = new DocumentClientException(0, (Error) null, (Map) null); - assertThat(dce.getResponseHeaders()).isNotNull(); - assertThat(dce.getResponseHeaders()).isEmpty(); - } - - @Test(groups = { "unit" }) - public void headerNotNull5() { - DocumentClientException dce = new DocumentClientException((String) null, 0, (Error) null, (Map) null); - assertThat(dce.getResponseHeaders()).isNotNull(); - assertThat(dce.getResponseHeaders()).isEmpty(); - } - - @Test(groups = { "unit" }) - public void headerNotNull6() { - DocumentClientException dce = new DocumentClientException((String) null, (Exception) null, (Map) null, 0, (String) null); - assertThat(dce.getResponseHeaders()).isNotNull(); - assertThat(dce.getResponseHeaders()).isEmpty(); - } - - @Test(groups = { "unit" }) - public void headerNotNull7() { - ImmutableMap respHeaders = ImmutableMap.of("key", "value"); - DocumentClientException dce = new DocumentClientException((String) null, (Exception) null, respHeaders, 0, (String) null); - assertThat(dce.getResponseHeaders()).isNotNull(); - assertThat(dce.getResponseHeaders()).contains(respHeaders.entrySet().iterator().next()); - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/DocumentCollectionTests.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/DocumentCollectionTests.java deleted file mode 100644 index 2e11ed6134e1..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/DocumentCollectionTests.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.google.common.collect.ImmutableList; -import org.testng.annotations.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -public class DocumentCollectionTests { - - @Test(groups = { "unit" }) - public void getPartitionKey() { - DocumentCollection collection = new DocumentCollection(); - PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition(); - partitionKeyDefinition.setPaths(ImmutableList.of("/mypk")); - collection.setPartitionKey(partitionKeyDefinition); - assertThat(collection.getPartitionKey()).isEqualTo(partitionKeyDefinition); - } - - @Test(groups = { "unit" }) - public void getPartitionKey_serializeAndDeserialize() { - DocumentCollection collection = new DocumentCollection(); - PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition(); - partitionKeyDefinition.setPaths(ImmutableList.of("/mypk")); - partitionKeyDefinition.setVersion(PartitionKeyDefinitionVersion.V2); - collection.setPartitionKey(partitionKeyDefinition); - - DocumentCollection parsedColl = new DocumentCollection(collection.toJson()); - assertThat(parsedColl.getPartitionKey().getKind().toString()).isEqualTo(partitionKeyDefinition.getKind().toString()); - assertThat(parsedColl.getPartitionKey().getPaths()).isEqualTo(partitionKeyDefinition.getPaths()); - assertThat(parsedColl.getPartitionKey().getVersion()).isEqualTo(partitionKeyDefinition.getVersion()); - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/DocumentTests.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/DocumentTests.java deleted file mode 100644 index d3777240f00f..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/DocumentTests.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Date; - -import org.testng.annotations.Test; - -public class DocumentTests { - - @Test(groups = { "unit" }) - public void timestamp() { - Document d = new Document(); - Date time = new Date(86400 * 1000); - d.setTimestamp(time); - assertThat(d.getTimestamp()).isEqualTo(time); - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/IncludedPathTest.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/IncludedPathTest.java deleted file mode 100644 index 663c2834c206..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/IncludedPathTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Collection; - -import org.testng.annotations.Test; - -public class IncludedPathTest { - - @Test(groups = {"unit"}) - public void deserialize() { - String json = "{" + - " 'path': '\\/*'," + - " 'indexes': [" + - " {" + - " 'kind': 'Range'," + - " 'dataType': 'String'," + - " 'precision': -1" + - " }," + - " {" + - " 'kind': 'Range'," + - " 'dataType': 'Number'," + - " 'precision': -1" + - " }" + - " ]" + - "}"; - IncludedPath path = new IncludedPath(json); - Collection indexes = path.getIndexes(); - assertThat(indexes).hasSize(2); - assertThat(indexes).usingFieldByFieldElementComparator().contains(Index.Range(DataType.String, -1)); - assertThat(indexes).usingFieldByFieldElementComparator().contains(Index.Range(DataType.Number, -1)); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/JsonSerializableTests.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/JsonSerializableTests.java deleted file mode 100644 index ca5c4b4af07e..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/JsonSerializableTests.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.microsoft.azure.cosmosdb; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.testng.Assert.fail; - -import java.io.Serializable; - -import org.testng.annotations.Test; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.core.JsonParseException; - -public class JsonSerializableTests { - - public static class Pojo implements Serializable { - int a; - int b; - - public Pojo(int a, int b) { - this.a = a; - this.b = b; - } - - @JsonCreator - public Pojo(@JsonProperty("a") String a, @JsonProperty("b") String b) { - this.a = Integer.parseInt(a); - this.b = Integer.parseInt(b); - } - - public int getA() { - return a; - } - - public int getB() { - return b; - } - - public void setA(int a) { - this.a = a; - } - - public void setB(int b) { - this.b = b; - } - - } - - public enum enums { - first, second, third - } - - @Test(groups = { "unit" }) - public void getObjectAndCastToClass() { - Document document = new Document(); - // numeric values - document.set("intValue", Integer.MAX_VALUE); - document.set("doubleValue", Double.MAX_VALUE); - document.set("longValue", Long.MAX_VALUE); - - assertThat(document.getObject("intValue", Integer.class).intValue()).isEqualTo(Integer.MAX_VALUE); - assertThat(document.getObject("doubleValue", Double.class).doubleValue()).isEqualTo(Double.MAX_VALUE); - assertThat(document.getObject("longValue", Long.class).longValue()).isEqualTo(Long.MAX_VALUE); - - // string - document.set("stringValue", "stringField"); - assertThat(document.getObject("stringValue", String.class)).isEqualTo("stringField"); - - // boolean - document.set("boolValue", true); - assertThat(document.getObject("boolValue", Boolean.class)).isEqualTo(true); - - // enum - document.set("enumValue", "third"); - assertThat(document.getObject("enumValue", enums.class)).isEqualTo(enums.third); - - // Pojo - Pojo pojo = new Pojo(1, 2); - document.set("pojoValue", pojo); - Pojo readPojo = document.getObject("pojoValue", Pojo.class); - assertThat(readPojo.getA()).isEqualTo(pojo.getA()); - assertThat(readPojo.getB()).isEqualTo(pojo.getB()); - - // JsonSerializable - Document innerDocument = new Document(); - innerDocument.setId("innerDocument"); - document.set("innerDocument", innerDocument); - Document readInnerDocument = document.getObject("innerDocument", Document.class); - assertThat(readInnerDocument.getId()).isEqualTo(innerDocument.getId()); - } - - @Test(groups = { "unit" }) - public void objectMapperInvalidJsonNoQuotesForFieldAndValue() { - // Invalid Json - field and value must be quoted - try { - new Document("{ field: value }"); - fail("failure expected"); - } catch (Exception e) { - assertThat(e.getCause() instanceof JsonParseException).isTrue(); - } - } - - @Test(groups = { "unit" }) - public void objectMapperInvalidJsonNoQuotesForField() { - // Invalid Json - field must be quoted - try { - new Document("{ field: 'value' }"); - fail("failure expected"); - } catch (Exception e) { - assertThat(e.getCause() instanceof JsonParseException).isTrue(); - } - } - - @Test(groups = { "unit" }) - public void objectMapperInvalidJsonNoDuplicatesAllowed() { - // Invalid Json - duplicates must not exist in Json string - try { - new Document("{ 'field': 'value1', 'field': 'value2' }"); - fail("failure expected"); - } catch (Exception e) { - assertThat(e.getCause() instanceof JsonParseException).isTrue(); - } - } - - @Test(groups = { "unit" }) - public void objectMapperValidJsonWithSingleQuotesAndTrailingComma() { - Document document = null; - - // Valid Json - Single quotes and trailing commas allowed in Json string - document = new Document("{ 'field1': 'value1', 'field2': 'value2', }"); - assertThat(document.toJson().equals("{\"field1\":\"value1\",\"field2\":\"value2\"}")).isEqualTo(true); - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/PermissionTest.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/PermissionTest.java deleted file mode 100644 index 3a4f0edd2c6e..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/PermissionTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.testng.annotations.Test; - -public class PermissionTest { - - @Test(groups = {"unit"}) - public void deserialize() { - String json = "{" + - " 'id': 'a98eb026-b66b-4cec-8fb9-9b0e10ddab76'," + - " 'permissionMode': 'read'," + - " 'resource': 'dbs/AQAAAA==/colls/AQAAAJ0fgTc='," + - " 'resourcePartitionKey': ['/id']" + - "}"; - Permission p = new Permission(json); - assertThat(p.getResourcePartitionKey()).isEqualToComparingFieldByField(new PartitionKey("/id")); - assertThat(p.getPermissionMode()).isEqualTo(PermissionMode.Read); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/ResourceIdTests.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/ResourceIdTests.java deleted file mode 100644 index 62c514ac318c..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/ResourceIdTests.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.HashMap; -import java.util.Map; -import java.util.Random; - -import org.apache.commons.lang3.tuple.Pair; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.internal.ResourceId; - -public class ResourceIdTests { - - @Test(groups = { "unit" }) - public void resourceIdTryParsing() { - HashMap cases = new HashMap<>(); - cases.put("testDb", false); - cases.put("db", false); - cases.put("cosmosdb", false); - cases.put("asosfactor", false); - - cases.put("f", false); - cases.put("fo", false); - cases.put("foo", false); - cases.put("foob", true); - cases.put("fooba", false); - cases.put("foobar", false); - cases.put("Zm8=", false); - cases.put("Zm9v", true); - cases.put("Zm9vYg==", true); - cases.put("Zm9vYmE=", false); - cases.put("Zm9vYmFy", false); - - // collection rid - cases.put("1-MxAPlgMgA=", true); - cases.put("nJRwAA==", true); - cases.put("MaZyAA==", true); - cases.put("-qpmAA==", true); - cases.put("wsIRAA==", true); - cases.put("GJwnAA==", true); - - // document rid - cases.put("ClZUAPp9+A0=", true); - - // offer rid - cases.put("-d8Hx", false); - - for (Map.Entry testCase : cases.entrySet()) { - Pair resourcePair = ResourceId.tryParse(testCase.getKey()); - assertThat( resourcePair.getKey()).as(String.format("ResourceId.tryParse failed for '%s'", testCase.getKey())).isEqualTo(testCase.getValue()); - } - } - - private static int randomNextIntForTest(Random rnd, Boolean positive) { - return rnd.nextInt(Integer.MAX_VALUE / 2) + (positive ? Integer.MAX_VALUE / 2 : - Integer.MAX_VALUE / 2); - } - - @Test(groups = { "unit" }) - public void resourceIdParsingRoundTrip() { - Random rnd = new Random(System.currentTimeMillis()); - - ResourceId dbRid = ResourceId.newDatabaseId(randomNextIntForTest(rnd, true)); - ResourceId parsedDbRid = ResourceId.parse(dbRid.toString()); - assertThat(parsedDbRid.getDatabase()).isEqualTo(dbRid.getDatabase()); - - ResourceId collRid = ResourceId.newDocumentCollectionId(dbRid.toString(), randomNextIntForTest(rnd, false)); - ResourceId parsedCollRid = ResourceId.parse(collRid.toString()); - assertThat(parsedCollRid.getDatabase()).isEqualTo(collRid.getDatabase()); - assertThat(parsedCollRid.getDocumentCollection()).isEqualTo(collRid.getDocumentCollection()); - - ResourceId userRid = ResourceId.newUserId(dbRid.toString(), randomNextIntForTest(rnd, true)); - ResourceId parsedUserRid = ResourceId.parse(userRid.toString()); - assertThat(parsedUserRid.getDatabase()).isEqualTo(userRid.getDatabase()); - assertThat(parsedUserRid.getUser()).isEqualTo(userRid.getUser()); - - ResourceId permissionRid = ResourceId.newPermissionId(userRid.toString(), randomNextIntForTest(rnd, false)); - ResourceId parsedPermissionRid = ResourceId.parse(permissionRid.toString()); - assertThat(parsedPermissionRid.getDatabase()).isEqualTo(permissionRid.getDatabase()); - assertThat(parsedPermissionRid.getUser()).isEqualTo(permissionRid.getUser()); - assertThat(parsedPermissionRid.getPermission()).isEqualTo(permissionRid.getPermission()); - - ResourceId attachmentRid = ResourceId.newAttachmentId("wsIRALoBhyQ9AAAAAAAACA==", randomNextIntForTest(rnd, true)); - ResourceId parsedAttachmentRid = ResourceId.parse(attachmentRid.toString()); - assertThat(parsedAttachmentRid.getDatabase()).isEqualTo(attachmentRid.getDatabase()); - assertThat(parsedAttachmentRid.getDocumentCollection()).isEqualTo(attachmentRid.getDocumentCollection()); - assertThat(parsedAttachmentRid.getDocument()).isEqualTo(attachmentRid.getDocument()); - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/PathsHelperTest.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/PathsHelperTest.java deleted file mode 100644 index ee22d54ef190..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/PathsHelperTest.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.apache.commons.lang3.StringUtils; -import org.testng.annotations.Test; -import static org.assertj.core.api.Assertions.assertThat; - -public class PathsHelperTest { - - private static final String DATABASE_ID = "IXYFAA=="; - private static final String DATABASE_COLLECTION_ID = "IXYFAOHEBPM="; - private static final String DOCUMENT_ID = "IXYFAOHEBPMBAAAAAAAAAA=="; - private static final String ATTACHMENT_ID = "IXYFAOHEBPMBAAAAAAAAABJYSJk="; - private static final String PERMISSION_ID = "IXYFAE9ZOwBGkyqWIsNKAA=="; - private static final String STORED_PRCEDURE_ID = "IXYFAOHEBPMCAAAAAAAAgA=="; - private static final String TRIGGER_ID = "IXYFAOHEBPMCAAAAAAAAcA=="; - private static final String USER_DEFINED_FUNCTION_ID = "IXYFAOHEBPMBAAAAAAAAYA=="; - private static final String USER_ID = "IXYFAE9ZOwA="; - private static final String CONFLICT_ID = "k6d9ALgBmD8BAAAAAAAAQA=="; - - private static final String DATABASE_FULL_NAME = "dbs/IXYFAA==/"; - private static final String DOCUMENT_COLLECTION_FULL_NAME = "dbs/IXYFAA==/colls/IXYFAOHEBPM=/"; - private static final String DOCUMENT_FULL_NAME = "dbs/IXYFAA==/colls/IXYFAOHEBPM=/docs/IXYFAOHEBPMBAAAAAAAAAA==/"; - private static final String STORED_PRCEDURE_FULL_NAME = "dbs/IXYFAA==/colls/IXYFAOHEBPM=/sprocs/IXYFAOHEBPMCAAAAAAAAgA==/"; - private static final String USER_DEFINED_FUNCTION_FULL_NAME = "dbs/IXYFAA==/colls/IXYFAOHEBPM=/udfs/IXYFAOHEBPMBAAAAAAAAYA==/"; - private static final String USER_FULL_NAME = "dbs/IXYFAA==/users/IXYFAE9ZOwA=/"; - private static final String PERMISSION_FULL_NAME = "dbs/IXYFAA==/users/IXYFAE9ZOwA=/permissions/IXYFAE9ZOwBGkyqWIsNKAA==/"; - private static final String ATTACHMENT_FULL_NAME = "dbs/IXYFAA==/colls/IXYFAOHEBPM=/docs/IXYFAOHEBPMBAAAAAAAAAA==/attachments/IXYFAOHEBPMBAAAAAAAAABJYSJk=/"; - private static final String TRIGGER_FULL_NAME = "dbs/IXYFAA==/colls/IXYFAOHEBPM=/triggers/IXYFAOHEBPMCAAAAAAAAcA==/"; - private static final String CONFLICT_FULL_NAME = "dbs/k6d9AA==/colls/k6d9ALgBmD8=/conflicts/k6d9ALgBmD8BAAAAAAAAQA==/"; - - private static final String INCORRECT = "incorrect"; - - @Test(groups = { "unit" }) - public void validateResourceID() { - assertThat(PathsHelper.validateResourceId(ResourceType.Database, DATABASE_ID)).isTrue(); - assertThat(PathsHelper.validateResourceId(ResourceType.DocumentCollection, DATABASE_COLLECTION_ID)).isTrue(); - assertThat(PathsHelper.validateResourceId(ResourceType.Document, DOCUMENT_ID)).isTrue(); - assertThat(PathsHelper.validateResourceId(ResourceType.Attachment, ATTACHMENT_ID)).isTrue(); - assertThat(PathsHelper.validateResourceId(ResourceType.Permission, PERMISSION_ID)).isTrue(); - assertThat(PathsHelper.validateResourceId(ResourceType.StoredProcedure, STORED_PRCEDURE_ID)).isTrue(); - assertThat(PathsHelper.validateResourceId(ResourceType.Trigger, TRIGGER_ID)).isTrue(); - assertThat(PathsHelper.validateResourceId(ResourceType.UserDefinedFunction, USER_DEFINED_FUNCTION_ID)).isTrue(); - assertThat(PathsHelper.validateResourceId(ResourceType.User, USER_ID)).isTrue(); - assertThat(PathsHelper.validateResourceId(ResourceType.Conflict, CONFLICT_ID)).isTrue(); - - assertThat(PathsHelper.validateResourceId(ResourceType.Database, DATABASE_ID + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceId(ResourceType.DocumentCollection, DATABASE_COLLECTION_ID + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceId(ResourceType.Document, DOCUMENT_ID + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceId(ResourceType.Attachment, ATTACHMENT_ID + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceId(ResourceType.Permission, PERMISSION_ID + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceId(ResourceType.StoredProcedure, STORED_PRCEDURE_ID + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceId(ResourceType.Trigger, TRIGGER_ID + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceId(ResourceType.UserDefinedFunction, USER_DEFINED_FUNCTION_ID + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceId(ResourceType.User, USER_ID + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceId(ResourceType.Conflict, CONFLICT_ID + INCORRECT)).isFalse(); - } - - @Test(groups = { "unit" }) - public void validateResourceFullName() { - assertThat(PathsHelper.validateResourceFullName(ResourceType.Database, DATABASE_FULL_NAME)).isTrue(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.DocumentCollection, DOCUMENT_COLLECTION_FULL_NAME)).isTrue(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.Document, DOCUMENT_FULL_NAME)).isTrue(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.Attachment, ATTACHMENT_FULL_NAME)).isTrue(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.Permission, PERMISSION_FULL_NAME)).isTrue(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.User, USER_FULL_NAME)).isTrue(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.Conflict, CONFLICT_FULL_NAME)).isTrue(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.UserDefinedFunction, USER_DEFINED_FUNCTION_FULL_NAME)).isTrue(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.StoredProcedure, STORED_PRCEDURE_FULL_NAME)).isTrue(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.Trigger, TRIGGER_FULL_NAME)).isTrue(); - - assertThat(PathsHelper.validateResourceFullName(ResourceType.Database, DATABASE_FULL_NAME + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.DocumentCollection, DOCUMENT_COLLECTION_FULL_NAME + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.Document, DOCUMENT_FULL_NAME + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.Attachment, ATTACHMENT_FULL_NAME + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.Permission, PERMISSION_FULL_NAME + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.User, USER_FULL_NAME + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.Conflict, CONFLICT_FULL_NAME + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.UserDefinedFunction, USER_DEFINED_FUNCTION_FULL_NAME + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.StoredProcedure, STORED_PRCEDURE_FULL_NAME + INCORRECT)).isFalse(); - assertThat(PathsHelper.validateResourceFullName(ResourceType.Trigger, TRIGGER_FULL_NAME + INCORRECT)).isFalse(); - - } - - @Test(groups = {"unit"}) - public void generatePathAtDBLevel() { - RxDocumentServiceRequest rxDocumentServiceRequest = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.DatabaseAccount); - String path = PathsHelper.generatePath(ResourceType.DatabaseAccount, rxDocumentServiceRequest, rxDocumentServiceRequest.isFeed); - assertThat(path).isEqualTo(Paths.DATABASE_ACCOUNT_PATH_SEGMENT + "/"); - - rxDocumentServiceRequest = RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Database); - path = PathsHelper.generatePath(ResourceType.Database, rxDocumentServiceRequest, rxDocumentServiceRequest.isFeed); - assertThat(path).isEqualTo(Paths.DATABASES_PATH_SEGMENT + "/"); - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/RxDocumentServiceRequestTest.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/RxDocumentServiceRequestTest.java deleted file mode 100644 index 2d157911e347..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/RxDocumentServiceRequestTest.java +++ /dev/null @@ -1,456 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.nio.charset.StandardCharsets; -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.Resource; -import org.apache.commons.collections4.map.HashedMap; -import org.apache.commons.lang3.StringUtils; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.rx.internal.AuthorizationTokenType; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; - -import rx.Observable; - -public class RxDocumentServiceRequestTest { - - private final static String DOCUMENT_DEFINITION = "{ " + "\"id\": \"%s\", " + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" + "}"; - private static final String PARTITION_KEY_VALUE = "1"; - - private final String DOCUMENT_URL_WITH_ID = "/dbs/IXYFAA==/colls/IXYFAOHEBPM=/docs/IXYFAOHEBPMBAAAAAAAAAA==/"; - private final String DOCUMENT_URL_WITH_NAME = "/dbs/testDB/colls/testColl/docs/testDoc/"; - private final String DOCUMENT_URL_WITH_ID_WITHOUT_SLASH = "dbs/IXYFAA==/colls/IXYFAOHEBPM=/docs/IXYFAOHEBPMBAAAAAAAAAA==/"; - private final String DOCUMENT_URL_WITH_NAME_WITHOUT_SLASH = "dbs/testDB/colls/testColl/docs/testDoc/"; - - private static final String DATABASE_URL = "/dbs/IXYFAA==/"; - private static final String DOCUMENT_COLLECTION_URL = "/dbs/IXYFAA==/colls/IXYFAOHEBPM=/"; - private static final String STORED_PRCEDURE_URL = "/dbs/IXYFAA==/colls/IXYFAOHEBPM=/sprocs/IXYFAOHEBPMCAAAAAAAAgA==/"; - private static final String USER_DEFINED_FUNCTION_URL = "/dbs/IXYFAA==/colls/IXYFAOHEBPM=/udfs/IXYFAOHEBPMBAAAAAAAAYA==/"; - private static final String USER_URL = "/dbs/IXYFAA==/users/IXYFAE9ZOwA=/"; - private static final String PERMISSION_URL = "/dbs/IXYFAA==/users/IXYFAE9ZOwA=/permissions/IXYFAE9ZOwBGkyqWIsNKAA==/"; - private static final String ATTACHMENT_URL = "/dbs/IXYFAA==/colls/IXYFAOHEBPM=/docs/IXYFAOHEBPMBAAAAAAAAAA==/attachments/IXYFAOHEBPMBAAAAAAAAABJYSJk=/"; - private static final String TRIGGER_URL = "/dbs/IXYFAA==/colls/IXYFAOHEBPM=/triggers/IXYFAOHEBPMCAAAAAAAAcA==/"; - private static final String CONFLICT_URL = "/dbs/k6d9AA==/colls/k6d9ALgBmD8=/conflicts/k6d9ALgBmD8BAAAAAAAAQA==/"; - - @DataProvider(name = "documentUrl") - public Object[][] documentUrlWithId() { - return new Object[][] { { DOCUMENT_URL_WITH_ID, DOCUMENT_URL_WITH_NAME, OperationType.Read }, - { DOCUMENT_URL_WITH_ID, DOCUMENT_URL_WITH_NAME, OperationType.Delete }, - { DOCUMENT_URL_WITH_ID, DOCUMENT_URL_WITH_NAME, OperationType.Replace }, - { DOCUMENT_URL_WITH_ID_WITHOUT_SLASH, DOCUMENT_URL_WITH_NAME_WITHOUT_SLASH, OperationType.Read }, - { DOCUMENT_URL_WITH_ID_WITHOUT_SLASH, DOCUMENT_URL_WITH_NAME_WITHOUT_SLASH, OperationType.Delete }, - { DOCUMENT_URL_WITH_ID_WITHOUT_SLASH, DOCUMENT_URL_WITH_NAME_WITHOUT_SLASH, OperationType.Replace }, }; - } - - @DataProvider(name = "resourceUrlWithOperationType") - public Object[][] resourceOperation() { - return new Object[][] { { DATABASE_URL, ResourceType.Database, OperationType.Read }, - { DOCUMENT_COLLECTION_URL, ResourceType.DocumentCollection, OperationType.Read }, - { STORED_PRCEDURE_URL, ResourceType.StoredProcedure, OperationType.Read }, - { USER_DEFINED_FUNCTION_URL, ResourceType.UserDefinedFunction, OperationType.Read }, - { USER_URL, ResourceType.User, OperationType.Read }, - { PERMISSION_URL, ResourceType.Permission, OperationType.Read }, - { ATTACHMENT_URL, ResourceType.Attachment, OperationType.Read }, - { TRIGGER_URL, ResourceType.Trigger, OperationType.Read }, - { CONFLICT_URL, ResourceType.Conflict, OperationType.Read }, - - { DATABASE_URL, ResourceType.Database, OperationType.Create }, - { DOCUMENT_COLLECTION_URL, ResourceType.DocumentCollection, OperationType.Create }, - { STORED_PRCEDURE_URL, ResourceType.StoredProcedure, OperationType.Create }, - { USER_DEFINED_FUNCTION_URL, ResourceType.UserDefinedFunction, OperationType.Create }, - { USER_URL, ResourceType.User, OperationType.Create }, - { PERMISSION_URL, ResourceType.Permission, OperationType.Create }, - { ATTACHMENT_URL, ResourceType.Attachment, OperationType.Create }, - { TRIGGER_URL, ResourceType.Trigger, OperationType.Create }, - { CONFLICT_URL, ResourceType.Conflict, OperationType.Create }, - - { DATABASE_URL, ResourceType.Database, OperationType.Delete }, - { DOCUMENT_COLLECTION_URL, ResourceType.DocumentCollection, OperationType.Delete }, - { STORED_PRCEDURE_URL, ResourceType.StoredProcedure, OperationType.Delete }, - { USER_DEFINED_FUNCTION_URL, ResourceType.UserDefinedFunction, OperationType.Delete }, - { USER_URL, ResourceType.User, OperationType.Delete }, - { PERMISSION_URL, ResourceType.Permission, OperationType.Delete }, - { ATTACHMENT_URL, ResourceType.Attachment, OperationType.Delete }, - { TRIGGER_URL, ResourceType.Trigger, OperationType.Delete }, - { CONFLICT_URL, ResourceType.Conflict, OperationType.Delete }, - - { DATABASE_URL, ResourceType.Database, OperationType.Replace }, - { DOCUMENT_COLLECTION_URL, ResourceType.DocumentCollection, OperationType.Replace }, - { STORED_PRCEDURE_URL, ResourceType.StoredProcedure, OperationType.Replace }, - { USER_DEFINED_FUNCTION_URL, ResourceType.UserDefinedFunction, OperationType.Replace }, - { USER_URL, ResourceType.User, OperationType.Replace }, - { PERMISSION_URL, ResourceType.Permission, OperationType.Replace }, - { ATTACHMENT_URL, ResourceType.Attachment, OperationType.Replace }, - { TRIGGER_URL, ResourceType.Trigger, OperationType.Replace }, - { CONFLICT_URL, ResourceType.Conflict, OperationType.Replace }, - - { DATABASE_URL, ResourceType.Database, OperationType.Query }, - { DOCUMENT_COLLECTION_URL, ResourceType.DocumentCollection, OperationType.Query }, - { STORED_PRCEDURE_URL, ResourceType.StoredProcedure, OperationType.Query }, - { USER_DEFINED_FUNCTION_URL, ResourceType.UserDefinedFunction, OperationType.Query }, - { USER_URL, ResourceType.User, OperationType.Query }, - { PERMISSION_URL, ResourceType.Permission, OperationType.Query }, - { ATTACHMENT_URL, ResourceType.Attachment, OperationType.Query }, - { TRIGGER_URL, ResourceType.Trigger, OperationType.Query }, - { CONFLICT_URL, ResourceType.Conflict, OperationType.Query }, - - { DATABASE_URL, ResourceType.Database, OperationType.Update }, - { DOCUMENT_COLLECTION_URL, ResourceType.DocumentCollection, OperationType.Update }, - { STORED_PRCEDURE_URL, ResourceType.StoredProcedure, OperationType.Update }, - { USER_DEFINED_FUNCTION_URL, ResourceType.UserDefinedFunction, OperationType.Update }, - { USER_URL, ResourceType.User, OperationType.Update }, - { PERMISSION_URL, ResourceType.Permission, OperationType.Update }, - { ATTACHMENT_URL, ResourceType.Attachment, OperationType.Update }, - { TRIGGER_URL, ResourceType.Trigger, OperationType.Update }, - { CONFLICT_URL, ResourceType.Conflict, OperationType.Update } }; - } - - @DataProvider(name = "resourceIdOrFullNameRequestAndOperationTypeData") - public Object[][] resourceIdOrFullNameRequestAndOperationTypeData() { - return new Object[][]{ - {"IXYFAA==", "dbs/testDB", ResourceType.Database, OperationType.Read}, - {"IXYFAA==", "dbs/testDB", ResourceType.Database, OperationType.Create}, - - {"IXYFAOHEBPM=", "dbs/testDB/colls/testColl", ResourceType.DocumentCollection, OperationType.Read}, - {"IXYFAOHEBPM=", "dbs/testDB/colls/testColl", ResourceType.DocumentCollection, OperationType.Create}, - {"IXYFAOHEBPM=", "dbs/testDB/colls/testColl", ResourceType.DocumentCollection, OperationType.Delete}, - {"IXYFAOHEBPM=", "dbs/testDB/colls/testColl", ResourceType.DocumentCollection, OperationType.Query}, - - {"IXYFAOHEBPMBAAAAAAAAAA==", "dbs/testDB/colls/testColl/docs/testDoc", ResourceType.Document, OperationType.Read}, - {"IXYFAOHEBPMBAAAAAAAAAA==", "dbs/testDB/colls/testColl/docs/testDoc", ResourceType.Document, OperationType.Create}, - {"IXYFAOHEBPMBAAAAAAAAAA==", "dbs/testDB/colls/testColl/docs/testDoc", ResourceType.Document, OperationType.Delete}, - {"IXYFAOHEBPMBAAAAAAAAAA==", "dbs/testDB/colls/testColl/docs/testDoc", ResourceType.Document, OperationType.Query}, - }; - } - - /** - * This test case will cover various create methods through resource url with Id in detail for document resource. - * @param documentUrlWithId Document url with id - * @param documentUrlWithName Document url with name - * @param operationType Operation type - */ - @Test(groups = { "unit" }, dataProvider = "documentUrl") - public void createWithResourceIdURL(String documentUrlWithId, String documentUrlWithName, - OperationType operationType) { - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, - ResourceType.Document, - documentUrlWithId, - new HashedMap(), AuthorizationTokenType.PrimaryMasterKey); - - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.PrimaryMasterKey); - assertThat(request.getResourceAddress()).isEqualTo("IXYFAOHEBPMBAAAAAAAAAA=="); - assertThat(request.getResourceId()).isEqualTo("IXYFAOHEBPMBAAAAAAAAAA=="); - - request = RxDocumentServiceRequest.create(operationType, "IXYFAOHEBPMBAAAAAAAAAA==", ResourceType.Document, - new HashedMap(), AuthorizationTokenType.PrimaryReadonlyMasterKey); - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.PrimaryReadonlyMasterKey); - assertThat(request.getResourceAddress()).isEqualTo("IXYFAOHEBPMBAAAAAAAAAA=="); - assertThat(request.getResourceId()).isEqualTo("IXYFAOHEBPMBAAAAAAAAAA=="); - - Document document = getDocumentDefinition(); - request = RxDocumentServiceRequest.create(operationType, document, ResourceType.Document, documentUrlWithId, - new HashedMap(), AuthorizationTokenType.Invalid); - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.Invalid); - assertThat(request.getResourceAddress()).isEqualTo("IXYFAOHEBPMBAAAAAAAAAA=="); - assertThat(request.getResourceId()).isEqualTo("IXYFAOHEBPMBAAAAAAAAAA=="); - assertThat(request.getContent()).isEqualTo(document.toJson().getBytes(StandardCharsets.UTF_8)); - - Observable inputStream = Observable.just(document.toJson().getBytes(StandardCharsets.UTF_8)); - request = RxDocumentServiceRequest.create(operationType, ResourceType.Document, documentUrlWithId, inputStream, - new HashedMap(), AuthorizationTokenType.SecondaryMasterKey); - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.SecondaryMasterKey); - assertThat(request.getResourceAddress()).isEqualTo("IXYFAOHEBPMBAAAAAAAAAA=="); - assertThat(request.getResourceId()).isEqualTo("IXYFAOHEBPMBAAAAAAAAAA=="); - assertThat(request.getContentObservable()).isEqualTo(inputStream); - - // Creating one request without giving AuthorizationTokenType , it should take - // PrimaryMasterKey by default - request = RxDocumentServiceRequest.create(operationType, - ResourceType.Document, - documentUrlWithId, - new HashedMap()); - - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.PrimaryMasterKey); - assertThat(request.getResourceAddress()).isEqualTo("IXYFAOHEBPMBAAAAAAAAAA=="); - assertThat(request.getResourceId()).isEqualTo("IXYFAOHEBPMBAAAAAAAAAA=="); - - } - - /** - * This test case will cover various create method through resource url with name in detail for document resource. - * @param documentUrlWithId Document url with id - * @param documentUrlWithName Document url with name - * @param operationType Operation type - */ - @Test(groups = { "unit" }, dataProvider = "documentUrl") - public void createWithResourceNameURL(String documentUrlWithId, String documentUrlWithName, - OperationType operationType) { - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, - ResourceType.Document, - documentUrlWithName, - new HashedMap(), AuthorizationTokenType.PrimaryMasterKey); - - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.PrimaryMasterKey); - assertThat(request.getResourceAddress()) - .isEqualTo(StringUtils.removeEnd(StringUtils.removeStart(documentUrlWithName, Paths.ROOT), Paths.ROOT)); - assertThat(request.getResourceId()).isNull(); - - Document document = getDocumentDefinition(); - Observable inputStream = Observable.just(document.toJson().getBytes(StandardCharsets.UTF_8)); - request = RxDocumentServiceRequest.create(operationType, - ResourceType.Document, - documentUrlWithName, - inputStream, - new HashedMap(), - AuthorizationTokenType.SecondaryMasterKey); - - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.SecondaryMasterKey); - assertThat(request.getResourceAddress()) - .isEqualTo(StringUtils.removeEnd(StringUtils.removeStart(documentUrlWithName, Paths.ROOT), Paths.ROOT)); - assertThat(request.getResourceId()).isNull(); - assertThat(request.getContentObservable()).isEqualTo(inputStream); - - // Creating one request without giving AuthorizationTokenType , it should take - // PrimaryMasterKey by default - request = RxDocumentServiceRequest.create(operationType, - ResourceType.Document, - documentUrlWithName, - new HashedMap()); - - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.PrimaryMasterKey); - assertThat(request.getResourceAddress()) - .isEqualTo(StringUtils.removeEnd(StringUtils.removeStart(documentUrlWithName, Paths.ROOT), Paths.ROOT)); - assertThat(request.getResourceId()).isNull(); - } - - - /** - * This will cover sanity for most of the combination of different source with various - * operation. - * @param resourceUrl Resource Url - * @param resourceType Resource Type - * @param operationType Operation type - */ - @Test(groups = { "unit" }, dataProvider = "resourceUrlWithOperationType") - public void createDifferentResourceRequestWithDiffOperation(String resourceUrl, ResourceType resourceType, - OperationType operationType) { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, resourceType, resourceUrl, - new HashedMap(), AuthorizationTokenType.PrimaryMasterKey); - assertThat(resourceUrl.contains(request.getResourceAddress())).isTrue(); - assertThat(resourceUrl.contains(request.getResourceId())).isTrue(); - assertThat(request.getResourceType()).isEqualTo(resourceType); - assertThat(request.getOperationType()).isEqualTo(operationType); - assertThat(request.getHeaders()).isNotNull(); - } - - /** - * This will test all the create method without request path. - * - * @param resourceId Resource id - * @param resourceType Resource Type - * @param operationType Operation type - */ - @Test(groups = {"unit"}, dataProvider = "resourceIdOrFullNameRequestAndOperationTypeData") - public void createRequestWithoutPath(String resourceId, String resourceFullName, ResourceType resourceType, - OperationType operationType) { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, resourceId, resourceType, null); - assertThat(request.getHeaders()).isNotNull(); - assertThat(request.getResourceAddress()).isEqualTo(resourceId); - assertThat(request.getResourceId()).isEqualTo(resourceId); - assertThat(request.getResourceType()).isEqualTo(resourceType); - assertThat(request.getOperationType()).isEqualTo(operationType); - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.PrimaryMasterKey); - - - request = RxDocumentServiceRequest.create(operationType, resourceId, resourceType, null, AuthorizationTokenType.ResourceToken); - assertThat(request.getHeaders()).isNotNull(); - assertThat(request.getResourceAddress()).isEqualTo(resourceId); - assertThat(request.getResourceId()).isEqualTo(resourceId); - assertThat(request.getResourceType()).isEqualTo(resourceType); - assertThat(request.getOperationType()).isEqualTo(operationType); - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.ResourceToken); - - Document document = getDocumentDefinition(); - request = RxDocumentServiceRequest.create(operationType, resourceId, resourceType, document, null); - assertThat(request.getHeaders()).isNotNull(); - assertThat(request.getResourceAddress()).isEqualTo(resourceId); - assertThat(request.getResourceId()).isEqualTo(resourceId); - assertThat(request.getResourceType()).isEqualTo(resourceType); - assertThat(request.getOperationType()).isEqualTo(operationType); - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.PrimaryMasterKey); - assertThat(request.getContent()).isEqualTo(document.toJson().getBytes(StandardCharsets.UTF_8)); - - request = RxDocumentServiceRequest.create(operationType, resourceId, resourceType, document, null, AuthorizationTokenType.ResourceToken); - assertThat(request.getHeaders()).isNotNull(); - assertThat(request.getResourceAddress()).isEqualTo(resourceId); - assertThat(request.getResourceId()).isEqualTo(resourceId); - assertThat(request.getResourceType()).isEqualTo(resourceType); - assertThat(request.getOperationType()).isEqualTo(operationType); - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.ResourceToken); - assertThat(request.getContent()).isEqualTo(document.toJson().getBytes(StandardCharsets.UTF_8)); - - request = RxDocumentServiceRequest.createFromName(operationType, resourceFullName, resourceType); - assertThat(request.getHeaders()).isNotNull(); - assertThat(request.getResourceAddress()).isEqualTo(resourceFullName); - assertThat(request.getResourceId()).isNull(); - assertThat(request.getIsNameBased()).isTrue(); - assertThat(request.getResourceType()).isEqualTo(resourceType); - assertThat(request.getOperationType()).isEqualTo(operationType); - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.PrimaryMasterKey); - - request = RxDocumentServiceRequest.createFromName(operationType, resourceFullName, resourceType, AuthorizationTokenType.ResourceToken); - assertThat(request.getHeaders()).isNotNull(); - assertThat(request.getResourceAddress()).isEqualTo(resourceFullName); - assertThat(request.getResourceId()).isNull(); - assertThat(request.getIsNameBased()).isTrue(); - assertThat(request.getResourceType()).isEqualTo(resourceType); - assertThat(request.getOperationType()).isEqualTo(operationType); - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.ResourceToken); - - request = RxDocumentServiceRequest.createFromName(operationType, document, resourceFullName, resourceType); - assertThat(request.getHeaders()).isNotNull(); - assertThat(request.getResourceAddress()).isEqualTo(resourceFullName); - assertThat(request.getResourceId()).isNull(); - assertThat(request.getIsNameBased()).isTrue(); - assertThat(request.getResourceType()).isEqualTo(resourceType); - assertThat(request.getOperationType()).isEqualTo(operationType); - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.PrimaryMasterKey); - assertThat(request.getContent()).isEqualTo(document.toJson().getBytes(StandardCharsets.UTF_8)); - - request = RxDocumentServiceRequest.createFromName(operationType, document, resourceFullName, resourceType, AuthorizationTokenType.ResourceToken); - assertThat(request.getHeaders()).isNotNull(); - assertThat(request.getResourceAddress()).isEqualTo(resourceFullName); - assertThat(request.getResourceId()).isNull(); - assertThat(request.getIsNameBased()).isTrue(); - assertThat(request.getResourceType()).isEqualTo(resourceType); - assertThat(request.getOperationType()).isEqualTo(operationType); - assertThat(request.authorizationTokenType).isEqualTo(AuthorizationTokenType.ResourceToken); - assertThat(request.getContent()).isEqualTo(document.toJson().getBytes(StandardCharsets.UTF_8)); - } - - @Test(groups = { "unit" }, dataProvider = "documentUrl") - public void isValidAddress(String documentUrlWithId, String documentUrlWithName, OperationType operationType) { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, - ResourceType.Document, - documentUrlWithId, - new HashedMap()); - - assertThat(request.isValidAddress(ResourceType.Database)).isTrue(); - assertThat(request.isValidAddress(ResourceType.DocumentCollection)).isTrue(); - assertThat(request.isValidAddress(ResourceType.Document)).isTrue(); - assertThat(request.isValidAddress(ResourceType.Unknown)).isTrue(); - assertThat(request.isValidAddress(ResourceType.User)).isFalse(); - assertThat(request.isValidAddress(ResourceType.Trigger)).isFalse(); - assertThat(request.isValidAddress(ResourceType.Offer)).isFalse(); - assertThat(request.isValidAddress(ResourceType.Permission)).isFalse(); - assertThat(request.isValidAddress(ResourceType.Attachment)).isFalse(); - assertThat(request.isValidAddress(ResourceType.StoredProcedure)).isFalse(); - assertThat(request.isValidAddress(ResourceType.Conflict)).isFalse(); - assertThat(request.isValidAddress(ResourceType.PartitionKeyRange)).isFalse(); - - request = RxDocumentServiceRequest.create(operationType, - ResourceType.Document, - documentUrlWithName, - new HashedMap()); - - assertThat(request.isValidAddress(ResourceType.Document)).isTrue(); - assertThat(request.isValidAddress(ResourceType.Unknown)).isTrue(); - String collectionFullName = "/dbs/testDB/colls/testColl/"; - request = RxDocumentServiceRequest.create(operationType, ResourceType.DocumentCollection, collectionFullName, - new HashedMap()); - - assertThat(request.isValidAddress(ResourceType.DocumentCollection)).isTrue(); - assertThat(request.isValidAddress(ResourceType.Unknown)).isTrue(); - - String databaseFullName = "/dbs/testDB"; - request = RxDocumentServiceRequest.create(operationType, - ResourceType.Database, - databaseFullName, - new HashedMap()); - - assertThat(request.isValidAddress(ResourceType.Database)).isTrue(); - assertThat(request.isValidAddress(ResourceType.Unknown)).isTrue(); - - String permissionFullName = "/dbs/testDB/users/testUser/permissions/testPermission"; - request = RxDocumentServiceRequest.create(operationType, - ResourceType.Permission, - permissionFullName, - new HashedMap()); - - assertThat(request.isValidAddress(ResourceType.Permission)).isTrue(); - assertThat(request.isValidAddress(ResourceType.Unknown)).isTrue(); - - String triggerFullName = "/dbs/testDB/colls/testUser/triggers/testTrigger"; - request = RxDocumentServiceRequest.create(operationType, - ResourceType.Trigger, - triggerFullName, - new HashedMap()); - - assertThat(request.isValidAddress(ResourceType.Trigger)).isTrue(); - assertThat(request.isValidAddress(ResourceType.Unknown)).isTrue(); - - String attachmentFullName = "/dbs/testDB/colls/testUser/docs/testDoc/attachments/testAttachment"; - request = RxDocumentServiceRequest.create(operationType, - ResourceType.Attachment, - attachmentFullName, - new HashedMap()); - - assertThat(request.isValidAddress(ResourceType.Attachment)).isTrue(); - assertThat(request.isValidAddress(ResourceType.Unknown)).isTrue(); - } - - @Test(groups = { "unit" }, dataProvider = "documentUrl") - public void addPreferHeader(String documentUrlWithId, String documentUrlWithName, OperationType operationType) { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, - ResourceType.Document, - documentUrlWithId, - new HashedMap()); - - request.addPreferHeader("preferHeaderName1", "preferHeaderValue1"); - assertThat(request.getHeaders().size()).isEqualTo(1); - assertThat(request.getHeaders().get(HttpConstants.HttpHeaders.PREFER)) - .isEqualTo("preferHeaderName1=preferHeaderValue1"); - - request.addPreferHeader("preferHeaderName2", "preferHeaderValue2"); - assertThat(request.getHeaders().size()).isEqualTo(1); - assertThat(request.getHeaders().get(HttpConstants.HttpHeaders.PREFER)) - .isEqualTo("preferHeaderName1=preferHeaderValue1;" + "preferHeaderName2=preferHeaderValue2"); - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format(DOCUMENT_DEFINITION, uuid, PARTITION_KEY_VALUE)); - return doc; - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/TimeTokenTest.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/TimeTokenTest.java deleted file mode 100644 index 710d740ae9a0..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/TimeTokenTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import java.time.format.DateTimeFormatter; -import java.util.Locale; - -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; - -public class TimeTokenTest { - - private Locale defaultLocale; - - @BeforeTest(groups = { "unit" }) - public void beforeMethod() { - defaultLocale = Locale.getDefault(); - } - - @Test(groups = { "unit" }) - public void nonLocaleUS() { - Locale.setDefault(Locale.ITALIAN); - DateTimeFormatter RFC_1123_DATE_TIME = - DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US); - String time = Utils.nowAsRFC1123(); - Locale.setDefault(Locale.US); - RFC_1123_DATE_TIME.parse(time); - } - - @AfterTest(groups = { "unit" }) - public void afterMethod() { - // set back default locale before test - if (defaultLocale != null) { - Locale.setDefault(defaultLocale); - } else { - Locale.setDefault(Locale.US); - } - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpUtilsTest.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpUtilsTest.java deleted file mode 100644 index de52b4fa83f7..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpUtilsTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2019 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.util.List; -import java.util.Map.Entry; -import java.util.Set; - -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.internal.HttpConstants; - -import io.netty.handler.codec.http.DefaultHttpHeaders; -import io.netty.handler.codec.http.DefaultHttpResponse; -import io.netty.handler.codec.http.HttpHeaders; -import io.netty.handler.codec.http.HttpResponse; -import io.netty.handler.codec.http.HttpResponseStatus; -import io.netty.handler.codec.http.HttpVersion; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -public class HttpUtilsTest { - - private static final String OWNER_FULL_NAME_VALUE = "dbs/RxJava.SDKTest.SharedDatabase_20190304T121302_iZc/colls/+%20-_,:.%7C~b2d67001-9000-454e-a140-abceb1756c48%20+-_,:.%7C~"; - - @Test(groups = { "unit" }) - public void verifyConversionOfHttpResponseHeadersToMap() throws UnsupportedEncodingException { - HttpHeaders headersMap = new DefaultHttpHeaders(); - headersMap.add(HttpConstants.HttpHeaders.OWNER_FULL_NAME, OWNER_FULL_NAME_VALUE); - - HttpResponse httpResponse = new DefaultHttpResponse(HttpVersion.HTTP_1_0, - HttpResponseStatus.ACCEPTED, - headersMap); - HttpResponseHeaders httpResponseHeaders = new HttpClientResponse(httpResponse, null).getHeaders(); - Set> resultHeadersSet = HttpUtils.asMap(httpResponseHeaders).entrySet(); - - assertThat(resultHeadersSet.size()).isEqualTo(1); - Entry entry = resultHeadersSet.iterator().next(); - assertThat(entry.getKey()).isEqualTo(HttpConstants.HttpHeaders.OWNER_FULL_NAME); - assertThat(entry.getValue()).isEqualTo(HttpUtils.urlDecode(OWNER_FULL_NAME_VALUE)); - - List> resultHeadersList = HttpUtils.unescape(httpResponseHeaders.entries()); - assertThat(resultHeadersList.size()).isEqualTo(1); - entry = resultHeadersSet.iterator().next(); - assertThat(entry.getKey()).isEqualTo(HttpConstants.HttpHeaders.OWNER_FULL_NAME); - assertThat(entry.getValue()).isEqualTo(HttpUtils.urlDecode(OWNER_FULL_NAME_VALUE)); - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResponseTest.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResponseTest.java deleted file mode 100644 index d91eb8faf0fd..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResponseTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.util.ArrayList; -import java.util.HashMap; - -import org.apache.commons.io.IOUtils; -import org.testng.annotations.Test; - -public class StoreResponseTest { - @Test(groups = { "unit" }) - public void stringContent() { - String content = "I am body"; - HashMap headerMap = new HashMap<>(); - headerMap.put("key1", "value1"); - headerMap.put("key2", "value2"); - - StoreResponse sp = new StoreResponse(200, new ArrayList<>(headerMap.entrySet()), content); - - assertThat(sp.getStatus()).isEqualTo(200); - assertThat(sp.getResponseStream()).isNull(); - assertThat(sp.getResponseBody()).isEqualTo(content); - assertThat(sp.getHeaderValue("key1")).isEqualTo("value1"); - } - - @Test(groups = { "unit" }) - public void streamContent() throws Exception { - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - baos.write(new byte[] { 3, 0, 1, 9, -1, 125 }); - HashMap headerMap = new HashMap<>(); - headerMap.put("key1", "value1"); - headerMap.put("key2", "value2"); - - StoreResponse sp = new StoreResponse(200, new ArrayList<>(headerMap.entrySet()), new ByteArrayInputStream(baos.toByteArray())); - - assertThat(sp.getStatus()).isEqualTo(200); - assertThat(sp.getResponseBody()).isNull(); - assertThat(sp.getResponseStream()).isNotNull(); - assertThat(IOUtils.contentEquals(new ByteArrayInputStream(baos.toByteArray()), sp.getResponseStream())); - } -} diff --git a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/StringPartitionKeyComponentTest.java b/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/StringPartitionKeyComponentTest.java deleted file mode 100644 index 02b0bd685d80..000000000000 --- a/cosmosdb/data-plane/commons/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/StringPartitionKeyComponentTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.microsoft.azure.cosmosdb.internal.routing; - -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import static org.assertj.core.api.Assertions.assertThat; - -public class StringPartitionKeyComponentTest { - @DataProvider(name = "paramProvider") - public Object[][] paramProvider() { - return new Object[][] { - {"Friday", "Friday", 0}, - {"Friday", "Venerdì", -1}, - {"Fri", "Ven", -1}, - }; - } - - @Test(groups = { "unit" }, dataProvider = "paramProvider") - public void compare(String str1, String str2, int expectedCompare) { - StringPartitionKeyComponent spkc1 = new StringPartitionKeyComponent(str1); - StringPartitionKeyComponent spkc2 = new StringPartitionKeyComponent(str2); - - assertThat(Integer.signum(spkc1.CompareTo(spkc2))).isEqualTo(Integer.signum(expectedCompare)); - } -} diff --git a/cosmosdb/data-plane/commons/src/test/resources/log4j.properties b/cosmosdb/data-plane/commons/src/test/resources/log4j.properties deleted file mode 100644 index 00b89ecf16b7..000000000000 --- a/cosmosdb/data-plane/commons/src/test/resources/log4j.properties +++ /dev/null @@ -1,16 +0,0 @@ -# this is the log4j configuration for tests - -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=INFO, A1 - -# Set HTTP components' logger to INFO - -log4j.category.io.netty=INFO -log4j.category.io.reactivex=INFO -log4j.category.com.microsoft.azure.cosmosdb=INFO -# A1 is set to be a ConsoleAppender. -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%d %5X{pid} [%t] %-5p %c - %m%n diff --git a/cosmosdb/data-plane/commons/src/test/resources/sampleConflict.json b/cosmosdb/data-plane/commons/src/test/resources/sampleConflict.json deleted file mode 100644 index 12f2a507b7a3..000000000000 --- a/cosmosdb/data-plane/commons/src/test/resources/sampleConflict.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "id": "k6d9ALgBmD8BAAAAAAAAQA==", - "_rid": "k6d9ALgBmD8BAAAAAAAAQA==", - "_self": "dbs/k6d9AA==/colls/k6d9ALgBmD8=/conflicts/k6d9ALgBmD8BAAAAAAAAQA==/", - "_etag": "\"00004a0f-0000-0000-0000-5b6e214b0000\"", - "resourceType": "document", - "operationType": "create", - "resourceId": "k6d9ALgBmD+ChB4AAAAAAA==", - "content": "{\"id\":\"0007312a-a1c5-4b54-9e39-35de2367fa33\",\"regionId\":2,\"regionEndpoint\":\"https://test-southeastasia.documents.azure.com:443/\",\"_rid\":\"k6d9ALgBmD+ChB4AAAAAAA==\",\"_self\":\"dbs\\/k6d9AA==\\/colls\\/k6d9ALgBmD8=\\/docs\\/k6d9ALgBmD+ChB4AAAAAAA==\\/\",\"_etag\":\"\\\"00000200-0000-0000-0000-5b6e214b0000\\\"\",\"_attachments\":\"attachments\\/\",\"_ts\":1533944139}", - "_ts": 1533944139 -} diff --git a/cosmosdb/data-plane/direct-impl/pom.xml b/cosmosdb/data-plane/direct-impl/pom.xml deleted file mode 100644 index 58a49378abaf..000000000000 --- a/cosmosdb/data-plane/direct-impl/pom.xml +++ /dev/null @@ -1,327 +0,0 @@ - - - 4.0.0 - com.microsoft.azure - azure-cosmosdb-direct - Azure Cosmos DB Async SDK Direct Internal Implementation - 2.4.5 - Azure Cosmos DB Async SDK Direct Internal Implementation - https://docs.microsoft.com/en-us/azure/cosmos-db - jar - - UTF-8 - unit - 2.4.5 - 27.0.1-jre - 4.0.5 - - - - - unit - - default - unit - - - true - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - - - - - - - fast - - simple - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - long - - long - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - direct - - direct - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - multi-master - - multi-master - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - emulator - - emulator - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - non-emulator - - non-emulator - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.22.0 - - unit - - **/*.java - - - - surefire.testng.verbose - 2 - - - - - - org.apache.maven.plugins - maven-failsafe-plugin - 2.22.0 - - - **/*.java - - ${test.groups} - - - surefire.testng.verbose - 2 - - - - - - - integration-test - verify - - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.6.0 - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-eclipse-plugin - 2.8 - - - - org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8 - - - - - - maven-javadoc-plugin - 3.0.1 - - - attach-javadocs - - jar - - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.4 - - - empty-javadoc-jar - package - - jar - - - empty-javadoc - ${basedir}/javadoc - - - - empty-sources-jar - package - - jar - - - empty-sources - ${basedir}/sources - - - - - - - - - - org.apache.maven.plugins - maven-surefire-report-plugin - 2.22.0 - - - org.codehaus.mojo - findbugs-maven-plugin - 3.0.4 - - - org.apache.maven.plugins - maven-jxr-plugin - 2.1 - - - - - - com.microsoft.azure - azure-cosmosdb-gateway - ${cosmosdb-sdk.version} - - - com.microsoft.azure - azure-cosmosdb-commons-test-utils - ${cosmosdb-sdk.version} - test - - - com.google.guava - guava - ${guava.version} - - - io.dropwizard.metrics - metrics-core - ${metrics.version} - - - - - MIT License - http://www.opensource.org/licenses/mit-license.php - - - - scm:git:https://github.com/Azure/azure-cosmosdb-java.git - scm:git:https://github.com/Azure/azure-cosmosdb-java.git - https://github.com/Azure/azure-cosmosdb-java.git - - - - Azure Cosmos DB Developer Platform Devs - docdbdevplatdevs@microsoft.com - Microsoft - http://www.microsoft.com/ - - - diff --git a/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/RntbdTransportClient.md b/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/RntbdTransportClient.md deleted file mode 100755 index aed9cacda209..000000000000 --- a/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/RntbdTransportClient.md +++ /dev/null @@ -1,495 +0,0 @@ -This specification describes a Netty-based Java implementation for direct-mode access to Azure Cosmos using its proprietary RNTBD protocol. This enables a Java client to create direct channels to Azure Cosmos back-end endpoints. - -RNTBD is intended to be the high-performance TCP transport alternative to HTTP for Cosmos. At its core, the transport stack must implement the `Microsoft.Azure.Documents.TransportClient` contract. It must be able to: - -* Accept requests intended for a Cosmos DB replica. - -* Serialize and send the requests to the intended endpoint , - -* De-serialize the response and return a StoreResponse in a timely fashion or fail with an appropriate error. - -The `RntbdTransportClient` implements this contract. It extends `TransportClient` and implements its one-and-only-one overridable method: -``` - @Override - public Single invokeStoreAsync( - URI physicalAddress, - ResourceOperation operation, - RxDocumentServiceRequest request) -``` - -The `physicalAddress` address in the call to `invokeStoreAsync` is a request URI of the form: - - **rntbd://**_\_**:**_\_**/**_\_ - -Netty channel pipelines are created dynamically based on the host and port portion of the URI. The replica path is opaque to the `RntbdTransportClient`. - -Having one connection per remote endpoint might suffice in many cases, but there are reasons to believe the client will benefit from additional connections to the same endpoint in at least two cases: - -* Head-of-line blocking - - Requests or responses can become bottle-necked behind large payloads, as they all must pass sequentially through the same stream. - -* Object contention - - Machines with many cores might attempt to send requests to the same endpoint simultaneously, causing all requests to be sent serially, and then all responses to be dispatched serially. - -For these reasons, the `RntbdTransportClient` supports multiple connections to an endpoint. At least one channel is created for each unique combination of host name and port number. Additional channels are created when the number of pending requests on existing channels gets too high. The set of channels created for a host name and port number are represented as an `RntbdTransportClient.Endpoint`. - -The criteria and thresholds for deciding when to create new channels, when to close existing channels, how to balance traffic among multiple connections, and whether to limit the total number of requests pending to an `RntbdTransportClient.Endpoint` are to be determined. The following section briefly describes the RNTBD protocol and the `RntbdTransportClient` channel pipeline. - -## RNTBD Protocol and the RntbdTransportClient Channel Pipeline - -Following creation of a channel upon receipt of the first `RxDocumentServiceRequest` to an endpoint, the RNTBD protocol requires a two-step context negotiation to complete before message exchange begins. - -1. SSL Handshake - - At the end of this step all future messages will be encrypted. All SSL-related work--negotiation, encryption, and decryption--is performed by Netty's built-in `SSLHandler`. An RNTBD client must only negotiate TLS 1.2 or higher. This is subject to change as security requirements become more stringent over time. - -2. RNTBD context negotiation - - In this step the transport client makes a single request--an `RntbdContextRequest`--and awaits a single response--an `RntbdContext` message. - -Request messages that arrive during context negotiation are queued. After context negotiation is complete all pending requests are sent. Request messages are framed and sent one at a time in arrival order on the channel's outgoing message stream. Response messages may be received in any order. Because of this pending promises of replies are matched with incoming response messages based on Activity ID. The lifetime of an RNTBD channel is illustrated in Figure 1. - -``` -┌────────────────────────────────────────────────────────────────────────────────────┐ -│ RNTBD Channel Timeline │ -└────────────────────────────────────────────────────────────────────────────────────┘ - -┌──────────┐ ┌──────────┐ -│ │ │ │ -│ Client │ │ Service │ -│ │ │ │ -└──────────┘ └──────────┘ -┌──────────┐ ┌──────────┐ ──────────────────────┐ -│ │ │ │ │ -│ ├─────────────────┐ │ │ │ -│ │ │ │ │ │ -│ │ ┌─────────────┐ └──────────────────▶│ │ │ -│ │ │SSL Handshake│ │ │ │ -│ │ └─────────────┘ │ │ Negotiate context │ -│ │ ┌──────────────────┤ │ │ -│ │◀─────────────────┘ │ │ │ -│ │ │ │ │ -│ ├─RntbdContextRequest────────────────▶│ │ │ -│ │ │ │ │ -│ │◀──────────────────────RntbdContext──│ │ │ -│ │ │ │ ──────────────────────┘ -│ │ │ │ ──────────────────────┐ -│ │ │ │ │ -│ │ │ │ │ -│ ├─RntbdRequest[1]────────────────────▶│ │ │ -│ │ │ │ │ -│ │ │ │ │ -│ ├─RntbdRequest[2]────────────────────▶│ │ │ -│ │ │ │ │ -│ │ │ │ │ -│ │◀───────────────────RntbdResponse[2]─│ │ │ -│ │ │ │ │ -│ │ │ │ │ -│ ├──RntbdRequest[3]───────────────────▶│ │ │ -│ │ │ │ Exchange messages │ -│ │ │ │ │ -│ │◀───────────────────RntbdResponse[1]─│ │ │ -│ │ │ │ │ -│ │ │ │ │ -│ │◀───────────────────RntbdResponse[3]─│ │ │ -│ │ │ │ │ -│ │ │ │ │ -│ │ . │ │ │ -│ │ . │ │ │ -│ │ . │ │ │ -│ │ │ │ │ -│ │ │ │ │ -└──────────┘ └──────────┘ ──────────────────────┘ -``` -*Figure 1. RNTBD Channel Timeline* - -Figure 2 illustrates the `RntbdTransportClient` implementation of the RNTBD protocol. It diagrams the happy-path. Channel management, error handling, and the details of the channel pipeline will be discussed later in this document. -
- -![Figure 2. RNTBD Channel Implementation Overview ](attachments/RntbdTransportClient.sequence-diagram-1fd9c04f-87e6-472e-afe8-8b1ed30685c2.png) -*Figure 2. RNTBD Channel Implementation Overview* - -The next section describes the `RntbdTransportClient` channel implementation. - -## RNTBD Channel Implementation - -Once a connection is established on a channel, the `RntbdTransportClient` begins exchanging messages. Messages written to an RNTBD channel move through a pipeline. This pipeline is the heart of the RNTBD channel implementation. - -There are four outgoing (request) message types and three incoming (response) message types: - -| Request type | Response type | Description -| ------------------------- | ----------------| ------------------------------------------------------------------------ -| `RntbdContextRequest` | `RntbdContext` | Sent on receipt of the first request on a channel. The response indicates that the connected Cosmos Service is either ready or rejects the request to exchange messages. -| `RntbdReadRequest` | `RntbdResponse` | A request to read data with an error or non-error response. -| `RntbdHealthCheckRequest` | `RntbdHealth` | Sent before each write operation on a channel. A response indicates that the connected Cosmos Service is in good health. -| `RntbdWriteRequest` | `RntbdResponse` | A request to write data with an error or non-error response. - -Request and response message types share a common base: `RntbdRequest` and `RntbdResponse`, respectively. - -The RNTBD pipeline is composed of a small number of Netty pipeline handlers: - -| Pipeline class | Role -| ----------------------------- | -------------------------------------------------------------------------------------- -| `SslHandler` | Negotiates a secure connection. Subsequently encrypts data written to the channel's output stream and decrypts data read from the channel's input stream. The `SslHandler` reads/writes bytes. It knows nothing about RNTBD messages. -| `RntbdClientMessageFormatter` | Encodes `RntbdRequest` messages (to bytes) and decodes `RntbdResponse` messages (from bytes). -| `RntbdContextNegotiator` | Injects an `RntbdContextRequest` message upon receipt of the first `RntbdRequest` message on a channel. `RntbdRequest` messages are queued and left pending until receipt of an `RntbdContext` message. If the response acknowledges that the connected Cosmos service is ready to exchange messages, all pending messages are sent down the pipeline. On rejection, failure, cancellation, or timeout, the channel is closed and all pending responses are completed exceptionally. -| `RntbdHealthChecker` | Injects an `RntbdHealthCheckRequest` message upon receipt of an `RntbdWriteRequest` message. The `RntbdWriteRequest` is left pending until an associated `RntbdHealth` response is received. The `RntbdWriteRequest` message is then sent down the pipeline. On failure, cancellation, or timeout, the `RntbdWriteRequest` is completed exceptionally with an indication that the `RntbdWriteRequest` is retry-able. -| `RntbdClientMessageManager` | Creates and completes `CompletableFuture` instances. Handles cancellations, exceptions, and timeouts. Maintains the `RntbdContext`. - -## Health Checks, Write Operations, and Channel Failures - -Cosmos writes are not idempotent at the server. For this reason, the `RntbdTransportClient` must avoid sending writes through failed channels to whatever extent possible. This is the reason for sending write requests in two stages: - -* Check that the channel is healthy and then--only if the server reports that the connection is healthy-- - -* Proceed with the write operation - -The sequence of health check followed by write operation introduces a [time-of-check to time-of-use (TOCTOU)](https://en.wikipedia.org/wiki/Time_of_check_to_time_of_use) race condition. Even if the health check succeeds, the write operation could fail any time before the client receives a response--before sending the payload, while sending, or while waiting for a response. - -There is no way to close the race. The race window should be as small as possible. For this reason success responses to health checks aren't cached. That said, it’s not possible to reduce the probability of write failures to zero. When a failure is detected (on read, write, or health check operation), the channel will be closed and the `CompletableFuture` associated with each pending request will be completed exceptionally. The error associated with a failed `CompletableFuture` will indicate whether a failed request is retry-able. - -## Cancellations, Exceptions, and Timeouts - -Cancellations may be initiated by `RntbdTransportClient` consumers using the `Single` returned by `RntbdTransportClient.invokeStoreAsync`. - -Four types of exceptions are thrown by elements of the RNTBD pipeline: - -* IllegalArgumentException is thrown when the argument to a function doesn't conform to the contract for a method and is indicative of a bug in the RNTBD channel pipeline code. - -* IllegalStateException is thrown when the state of a pipeline, request, or response object doesn't conform to expectations. It is indicative of a bug in the RNTBD channel pipeline code or an object passed to it. - -* CorruptedFrameException is thrown when an IO error is detected. This means there was a problem reading/writing bytes to the wire. It is indicative of a channel health issue. - -* SocketException (or one of its derivatives) are raised when a connection cannot be established or an established connection drops or hangs. - -## Exception propagation - -Exception propagate through the `RntbdTransportClient` like this: - -* Connection exceptions associated with opening a channel propagate to the future listener added by RntbdTransportClient.Endpoint.write. - -* Outbound channel exceptions propagate to the future listener added by RntbdTransportClient.Endpoint.doWrite - -* Inbound channel exceptions are caught by RntbdRequestManager.exceptionCaught and propagate to the RxJava Single emitter returned by RntbdTransportClient.invokeStoreAsync. - -#### Exception mapping - -TODO: DANOBLE - -## Performance Requirements - -The performance requirements of the transport client stack are somewhat fuzzy. As it’s one of the core components of the system, the per-request overhead must be minimal. The overhead is best emphasized by tiny reads (<1 KiB) at eventual consistency, in the same region (1 ms RTT). - -Each connection should be able to handle around 2,500-5,000 requests per second. Given enough cores and memory, the transport stack must be able to handle around 30,000-60,000 requests per second, per endpoint. - -The current version of the protocol performs worse than necessary because all headers are in a flat structure. As such, the (inherently single-threaded) logic that decodes a request header to determine which pending I/O to complete must parse more data than necessary, lowering the peak attainable throughput per connection. Fixing that requires a protocol breaking change (incrementing the protocol version number and rolling out in a deliberate fashion). - -## Confidentiality & Integrity - -The client must only negotiate TLS 1.2 or newer. This is subject to change, as security requirements become more stringent over time. - -## Pass-through Tokens - -RNTBD requests carry a correlation ID which is called `activityID` throughout the `RntbdTransportClient` implementation. An `activityID` is propagated to remote endpoints on every request. -The same holds for the user agent string which is included in the `RntbdContext` associated with a channel. - -## RNTBD Message Formats - -Each RNTBD message type consists of two parts: - -* a head frame followed by -* an optional body frame. - -Each frame begins with a 32-bit integer `length` field followed by a payload. - -``` -┌─────────────┬──────────────────┐ -│ length (32) │ payload (0...) ... -└─────────────┴──────────────────┘ -``` - -The definition of the `length` field is different for the head and body frames. - -| Frame | Definition of `length` field -| ----- | -------------------------------------------------------------------------------------------------------------- -| head | Length of the frame (four plus the length of the payload) expressed as an unsigned 32-bit integer in little-endian order. Values greater than `Integer.MAX_VALUE` must not be sent. -| body | Length of the payload expressed as a 32-bit integer in little-endian order. Values greater than `Integer.MAX_VALUE` must not be sent. - -The `RntbdTransportClient` sends request messages and receives response messages. Following RNTBD context negotiation there is no guarantee that responses will be received in the order that requests are sent. Hence, it is the job of the `RntbdTransportClient` to match requests to responses based on *Activity ID*. - -## RNTBD Request Messages - -RNTBD request messages have this format: - -``` -RntbdRequestHead frame -┌────────────────────────────────────┬──────────────────┬──────────────────┬──────────────────────────────────────────── -│length (32) │resourceType (16) │operationType (16)│activityID (128) -└────────────────────────────────────┴──────────────────┴──────────────────┴────────────────────────┬──────────────────┐ - │headers (0...) ... -────────────────────────────────────────────────────────────────────────────────────────────────────┴──────────────────┘ - -RntbdRequestBody frame -┌────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────────┐ -│length (32) │ payload (0...) ... -└────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────────┘ -``` - -The fields of the `RntbdRequestHead` are defined as: - -| Field | Definition -| ------------- | ----------------------------------------------------------------------------------------------------- -| length | Length of the frame expressed as an unsigned 32-bit integer in little-endian order. Values greater than `Integer.MAX_VALUE` must not be sent. -| resourceType | A 16-bit `RntbdResourceType.id()` value in little-endian order. -| operationType | A 16-bit `RntbdOperationType.id()` value in little-endian order. -| activityId | A 128-bit Activity ID that uniquely identifies the request message. It is a `UUID` serialized as an `int` followed by three `short` and six `byte` values in little-endian order. This serialization yields the same sequence of bytes as produced by `System.Guid.ToByteArray`. -| headers | A variable-length sequence of RNTBD headers expressed as `RntbdToken` values. - -A description of each message type follows. - -### RntbdContextRequest - -An `RntbdContextRequest` consists of a single frame: an `RntbdRequestHead` with three headers. - -``` -┌──────────────────────────────┬──────────────┬──────────────┬─────────────────────────────────────────────────────────┬ -│length (32) │0x0000 (16) │0x0000 (16) │activityID (128) ... -└──────────────────────────────┴──────────────┴──────────────┴─────────────────────────────────────────────────────────┴ -┬─────────────────────────────────────────────┬ ┬───────────────────────────────────────────────────────┐ -│protocolVersion: RntbdTokenType.ULong (56) ... │clientVersion: RntbdTokenType.SmallString (32..2072) ... -┴─────────────────────────────────────────────┴ ┴───────────────────────────────────────────────────────┘ -┬───────────────────────────────────────────────────────────┐ -│userAgent: RntbdTokenType.SmallString (32..2072) ... -┴───────────────────────────────────────────────────────────┘ -``` - -The fields of the `RntbdContextRequest` are defined as follows: - -| Field | Definition -| --------------- | ---------------------------------------------------------------------------------------------------- -| length | Length of the frame expressed as an unsigned 32-bit integer in little-endian order. -| resourceType | A 16-bit value of zero. This is the value of `RntbdResourceType.Connection.id()`. -| operationType | A 16-bit value of zero. This is the value of `RntbdOperationType.Connection.id()`. -| protocolVersion | The protocol version to be negotiated. It is represented as a 56-bit long `RntbdToken` of type `RntbdTokenType.ULong`. Its token identifier is `RntbdContextRequestHeader.ProtocolVersion.id()`. -| clientVersion | The client version string. It is represented as a variable-length `RntbdToken` of type `RntbdTokenType.ShortString`. Its token identifier is `RntbdContextRequestHeader.ClientVersion.id()`. -| userAgent | A string identifying the user agent. It is represented as a variable-length `RntbdToken` of type `RntbdTokenType.ShortString`. Its token identifier is `RntbdContextRequestHeader.UserAgent.id()`. - - -### RntbdHealthCheckRequest - -TODO: DANOBLE - -### RntbdReadRequest - -TODO: DANOBLE - -### RntbdWriteRequest - -TODO: DANOBLE - -## RNTBD Response Messages - -RNTBD response messages have this format: - -``` -RntbdResponseHead frame -┌────────────────────────────────────┬──────────────────┬─────────────────────────────────────────────────────────────── -│length (32) │status (16) │activityID (128) -└────────────────────────────────────┴──────────────────┴────────────────────────┬─────────────────────────────────────┐ - │headers (0...) ... -─────────────────────────────────────────────────────────────────────────────────┴─────────────────────────────────────┘ - -RntbdResponseBody frame -┌────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────────┐ -│length (32) │ payload (0...) ... -└────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────────┘ -``` - -The fields of the `RntbdResponseHead` are defined as: - -| Field | Definition -| ------------- | ------------------------------------------------------------------------------------------------------ -| length | Length of the frame expressed as an unsigned 32-bit integer in little-endian order. Values greater than `Integer.MAX_VALUE` must not be sent. -| status | A 32-bit `HttpResponseStatus` code in little-endian order. -| activityId | A 128-bit Activity ID that uniquely identifies the request message. It is a `UUID` serialized as an `int` followed by three `short` and six `byte` values in little-endian order. This serialization yields the same sequence of bytes as produced by `System.Guid.ToByteArray`. -| headers | A variable-length sequence of RNTBD headers expressed as `RntbdToken` values. - - -## RNTBD Headers - -RNTBD headers are expressed as a sequence of `RntbdToken` instances with this wire format: - -``` -┌────────────────┬────────┬────────────────────────────┐ -│id (16) │type (8)│value (0...) ... -└────────────────┴────────┴────────────────────────────┘ -``` - -The fields of an `RntbdToken` instance are defined as: - -| Field | Definition -| ------ | ------------------------------------------------------------------------------------------------------ -| id | A 16-bit `RntbdRequestHeader` or `RntbdResponseHeader` identifier in little-endian order. -| type | An 8-bit `RntbdTokenType` ID. -| value | Value of the header identified by `id`. The format and length of the value depend on the `type`. - -Here are the formats of `RntbdToken` instance values by `RntbdTokenType`. - -### RntbdTokenType.Byte (0x00) - -An `RntbdToken` of type `RntbdTokenType.UShort` represents an unsigned 8-bit integer-valued header. It has a fixed -length of 4 bytes (32 bits). - -``` -┌────────────────┬────────┬────────┐ -│id (16) │0x00 (8)│val (8) │ -└────────────────┴────────┴────────┘ -``` - -### RntbdTokenType.UShort (0x01) - -An `RntbdToken` of type `RntbdTokenType.UShort` represents an unsigned 16-bit integer-valued header. It has a fixed -length of 5 bytes (40 bits). - -``` -┌────────────────┬────────┬────────────────┐ -│id (16) │0x01 (8)│ value (16) │ -└────────────────┴────────┴────────────────┘ -``` - -### RntbdTokenType.ULong (0x02) - -An `RntbdToken` of type `RntbdTokenType.ULong` represents an unsigned 32-bit integer-valued header. It has a fixed -length of 7 bytes (56 bits). - -``` -┌────────────────┬────────┬────────────────────────────────┐ -│id (16) │0x02 (8)│value (32) │ -└────────────────┴────────┴────────────────────────────────┘ -``` - -### RntbdTokenType.Long (0x03) - -An `RntbdToken` of type `RntbdTokenType.Long` represents an signed 32-bit integer-valued header. It has a fixed length of 7 bytes (56 bits). - -``` -┌────────────────┬────────┬────────────────────────────────┐ -│id (16) │0x03 (8)│value (32) │ -└────────────────┴────────┴────────────────────────────────┘ -``` - -### RntbdTokenType.ULongLong (0x04) - -An `RntbdToken` of type `RntbdTokenType.ULongLong` represents an unsigned 64-bit integer-valued header. It has a fixed length of 11 bytes (88 bits). - -``` -┌────────────────┬────────┬────────────────────────────────────────────────────────────────┐ -│id (16) │0x04 (8)│value (64) │ -└────────────────┴────────┴────────────────────────────────────────────────────────────────┘ -``` - -### RntbdTokenType.LongLong (0x05) - -An `RntbdToken` of type `RntbdTokenType.LongLong` represents a signed 64-bit integer-valued header. It has a fixed -length of 11 bytes (88 bits). - -``` -┌────────────────┬────────┬────────────────────────────────────────────────────────────────┐ -│id (16) │ 0x05 │ (64) │ -└────────────────┴────────┴────────────────────────────────────────────────────────────────┘ -``` - -### RntbdTokenType.Guid (0x06) - -An `RntbdToken` of type `RntbdTokenType.Guid` represents a 128-bit UUID serializes using an algorithm that produces -the same byte sequence as [`System.Guid.ToByteArray`](https://docs.microsoft.com/en-us/dotnet/api/system.guid.tobytearray?view=netframework-4.7.2). It has a fixed length of 19 bytes (152 bits). - -``` -┌────────────────┬────────┬───────────────────────────────────────────────────────────────────────────────────────────── -│id (16) │0x06 (8)│ value (128) -└────────────────┴────────┴───────────────────────────────────────────────────────────────────────────────────────────── -───────────────────────────────────┐ - │ -───────────────────────────────────┘ -``` - -### RntbdTokenType.SmallString (0x07) - -An `RntbdToken` of type `RntbdTokenType.SmallString` represents a UTF-8 encoded string-valued header. It has a variable length between 4 bytes (32 bits) and 259 bytes (2,072 bits). Its encoded string value can be as large as 255 bytes. - -``` -┌────────────────┬────────┬────────┬────────────────────────────┐ -│id (16) │0x07 (8)│len (8) │ val (0..0xFF) ... -└────────────────┴────────┴────────┴────────────────────────────┘ -``` - -### RntbdTokenType.String (0x08) - -An `RntbdToken` of type `RntbdTokenType.String` represents a UTF-8 encoded string-valued header. It has a variable length between 5 bytes (40 bits) and 2,147,483,654 bytes (524,320 bits). Its encoded string value can be as large as -65,535 bytes (64 KiB - 1 byte). - -``` -┌────────────────┬────────┬────────────────┬────────────────────────────┐ -│id (16) │0x08 (8)│len (16) │ val (0..0xFFFF) ... -└────────────────┴────────┴────────────────┴────────────────────────────┘ -``` - -### RntbdTokenType.ULongString (0x09) - -An `RntbdToken` of type `RntbdTokenType.ULongString` represents a UTF-8 encoded string-valued header. It has a variable length between 7 bytes (56 bits) and 2,147,483,654 bytes (a little more than 16 gibits). Its encoded string value can be as large as 2,147,483,647 (2**31 - 1) bytes. - -``` -┌────────────────┬────────┬────────────────────────────────┬────────────────────────────┐ -│id (16) │0x09 (8)│len (32) │ val (0..0x7FFFFFFF) ... -└────────────────┴────────┴────────────────────────────────┴────────────────────────────┘ -``` - -### RntbdTokenType.SmallBytes (0x0A) - -``` -┌────────────────┬────────┬────────┬────────────────────────────┐ -│id (16) │ 0x0A │len (8) │ val (0..0xFF) ... -└────────────────┴────────┴────────┴────────────────────────────┘ -``` - -### RntbdTokenType.Bytes (0x0B) - -``` -┌────────────────┬────────┬────────────────┬────────────────────────────┐ -│id (16) │ 0x0B │len (16) │ val (0..0xFFFF) ... -└────────────────┴────────┴────────────────┴────────────────────────────┘ -``` - -### RntbdTokenType.ULongBytes (0x0C) - -``` -┌────────────────┬────────┬────────────────────────────────┬────────────────────────────┐ -│id (16) │ 0x0C │len (32) │ val (0..0x7FFFFFFF) ... -└────────────────┴────────┴────────────────────────────────┴────────────────────────────┘ -``` - -### RntbdTokenType.Float (0x0D) - -``` -┌────────────────┬────────┬────────────────────────────────┐ -│id (16) │ 0x0D │ val (32) │ -└────────────────┴────────┴────────────────────────────────┘ -``` - -### RntbdTokenType.Double (0x0E) - -``` -┌────────────────┬────────┬────────────────────────────────────────────────────────────────┐ -│id (16) │ 0x0E │ val (64) │ -└────────────────┴────────┴────────────────────────────────────────────────────────────────┘ -``` - -### RntbdTokenType.Invalid (0xFF) - -``` -┌────────────────┬────────┐ -│id (16) │ 0x0F │ -└────────────────┴────────┘ -``` diff --git a/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/RntbdTransportClient.pptx b/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/RntbdTransportClient.pptx deleted file mode 100644 index 11eebca00164..000000000000 Binary files a/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/RntbdTransportClient.pptx and /dev/null differ diff --git a/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/attachments/RntbdTransportClient.sequence-diagram-1fd9c04f-87e6-472e-afe8-8b1ed30685c2.png b/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/attachments/RntbdTransportClient.sequence-diagram-1fd9c04f-87e6-472e-afe8-8b1ed30685c2.png deleted file mode 100755 index 051d4c1ab632..000000000000 Binary files a/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/attachments/RntbdTransportClient.sequence-diagram-1fd9c04f-87e6-472e-afe8-8b1ed30685c2.png and /dev/null differ diff --git a/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/src/RntbdTransportClient architecture.vsdx b/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/src/RntbdTransportClient architecture.vsdx deleted file mode 100644 index e570a5bb8967..000000000000 Binary files a/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/src/RntbdTransportClient architecture.vsdx and /dev/null differ diff --git a/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/src/RntbdTransportClient sequence diagram.vsdx b/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/src/RntbdTransportClient sequence diagram.vsdx deleted file mode 100644 index bd353b0f73b2..000000000000 Binary files a/cosmosdb/data-plane/direct-impl/specifications/RntbdTransportClient/src/RntbdTransportClient sequence diagram.vsdx and /dev/null differ diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/ContentSerializationFormat.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/ContentSerializationFormat.java deleted file mode 100644 index fb9a8fe974d3..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/ContentSerializationFormat.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal; - -public enum ContentSerializationFormat { - /** - * Standard JSON RFC UTF-8 text - */ - JsonText, - - /** - * Custom binary for Cosmos DB that encodes a superset of JSON values. - */ - CosmosBinary, -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/EnumerationDirection.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/EnumerationDirection.java deleted file mode 100644 index d4b6aed5351f..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/EnumerationDirection.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal; - -public enum EnumerationDirection { - /** - * Use forward direction - */ - Forward, - - /** - * Use reverse direction - */ - Reverse -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/FanoutOperationState.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/FanoutOperationState.java deleted file mode 100644 index b8c3a4786e80..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/FanoutOperationState.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal; - -public enum FanoutOperationState { - /** - * Fanout operation started - */ - Started, - - /** - * Fanout operation completed - */ - Completed -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/MigrateCollectionDirective.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/MigrateCollectionDirective.java deleted file mode 100644 index 5d3f30231fa1..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/MigrateCollectionDirective.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal; - -public enum MigrateCollectionDirective { - /** - * Move to SSD - */ - Thaw, - - /** - * Move to HDD - */ - Freeze -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/ReadFeedKeyType.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/ReadFeedKeyType.java deleted file mode 100644 index f84a40047e9a..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/ReadFeedKeyType.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal; - -/** - * Type of Start and End key for ReadFeedKey - */ -public enum ReadFeedKeyType { - /** - * Use resource name - */ - ResourceId, - - /** - * Use effective partition key - */ - EffectivePartitionKey -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/RemoteStorageType.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/RemoteStorageType.java deleted file mode 100644 index e0f65239a64c..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/RemoteStorageType.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal; - -public enum RemoteStorageType { - /** - * Use standard storage - */ - NotSpecified, - - /** - * Use standard storage - */ - Standard, - - /** - * Use premium storage - */ - Premium -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressResolver.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressResolver.java deleted file mode 100644 index db65feef97d5..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressResolver.java +++ /dev/null @@ -1,716 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.InternalServerErrorException; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceId; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.routing.CollectionRoutingMap; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternal; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternalHelper; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import com.microsoft.azure.cosmosdb.rx.internal.ICollectionRoutingMapCache; -import com.microsoft.azure.cosmosdb.rx.internal.InvalidPartitionException; -import com.microsoft.azure.cosmosdb.rx.internal.NotFoundException; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxCollectionCache; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Single; -import rx.functions.Func1; - -import java.util.concurrent.Callable; - -/** - * Abstracts out the logic to resolve physical replica addresses for the given {@link RxDocumentServiceRequest} - *

- * AddressCache internally maintains CollectionCache, CollectionRoutingMapCache and BackendAddressCache. - * Logic in this class mainly joins these 3 caches and deals with potential staleness of the caches. - */ -public class AddressResolver implements IAddressResolver { - private static Logger logger = LoggerFactory.getLogger(AddressResolver.class); - - private final static PartitionKeyRangeIdentity masterPartitionKeyRangeIdentity = - new PartitionKeyRangeIdentity(PartitionKeyRange.MASTER_PARTITION_KEY_RANGE_ID); - - private RxCollectionCache collectionCache; - private ICollectionRoutingMapCache collectionRoutingMapCache; - private IAddressCache addressCache; - - public AddressResolver() { - } - - public void initializeCaches( - RxCollectionCache collectionCache, - ICollectionRoutingMapCache collectionRoutingMapCache, - IAddressCache addressCache) { - this.collectionCache = collectionCache; - this.addressCache = addressCache; - this.collectionRoutingMapCache = collectionRoutingMapCache; - } - - public Single resolveAsync( - RxDocumentServiceRequest request, - boolean forceRefreshPartitionAddresses) { - - Single resultObs = this.resolveAddressesAndIdentityAsync(request, forceRefreshPartitionAddresses); - - return resultObs.flatMap(result -> { - - try { - this.throwIfTargetChanged(request, result.TargetPartitionKeyRange); - } catch (Exception e) { - return Single.error(e); - } - - request.requestContext.resolvedPartitionKeyRange = result.TargetPartitionKeyRange; - - return Single.just(result.Addresses); - }); - } - - private static boolean isSameCollection(PartitionKeyRange initiallyResolved, PartitionKeyRange newlyResolved) { - if (initiallyResolved == null) { - throw new IllegalArgumentException("parent"); - } - - if (newlyResolved == null) { - return false; - } - - if (Strings.areEqual(initiallyResolved.getId(), PartitionKeyRange.MASTER_PARTITION_KEY_RANGE_ID) && - Strings.areEqual(newlyResolved.getId(), PartitionKeyRange.MASTER_PARTITION_KEY_RANGE_ID)) { - return true; - } - - if (Strings.areEqual(initiallyResolved.getId(), PartitionKeyRange.MASTER_PARTITION_KEY_RANGE_ID) - || Strings.areEqual(newlyResolved.getId(), PartitionKeyRange.MASTER_PARTITION_KEY_RANGE_ID)) { - String message = - "Request was resolved to master partition and then to server partition."; - assert false : message; - logger.warn(message); - return false; - } - - if (ResourceId.parse(initiallyResolved.getResourceId()).getDocumentCollection() - != ResourceId.parse(newlyResolved.getResourceId()).getDocumentCollection()) { - return false; - } - - if (!Strings.areEqual(initiallyResolved.getId(), newlyResolved.getId()) && - !(newlyResolved.getParents() != null && newlyResolved.getParents().contains(initiallyResolved.getId()))) { - // the above condition should be always false in current codebase. - // We don't need to refresh any caches if we resolved to a range which is child of previously resolved range. - // Quorum reads should be handled transparently as child partitions share LSNs with parent partitions which are gone. - String message = - "Request is targeted at a partition key range which is not child of previously targeted range."; - assert false : message; - logger.warn(message); - - return false; - } - - return true; - } - - /** - * Validates if the target partition to which the request is being sent has changed during retry. - *

- * If that happens, the request is no more valid and need to be retried. - * - * @param request Request in progress - * @param targetRange Target partition key range determined by address resolver - * @*/ - private void throwIfTargetChanged(RxDocumentServiceRequest request, PartitionKeyRange targetRange) throws DocumentClientException { - // If new range is child of previous range, we don't need to throw any exceptions - // as LSNs are continued on child ranges. - if (request.requestContext.resolvedPartitionKeyRange != null && - !isSameCollection(request.requestContext.resolvedPartitionKeyRange, targetRange)) { - if (!request.getIsNameBased()) { - String message = String.format( - "Target should not change for non name based requests. Previous target {}, Current {}", - request.requestContext.resolvedPartitionKeyRange, targetRange); - assert false : message; - logger.warn(message); - } - - request.requestContext.resolvedPartitionKeyRange = null; - throw new InvalidPartitionException(RMResources.InvalidTarget, request.getResourceAddress()); - } - } - - private static void ensureRoutingMapPresent( - RxDocumentServiceRequest request, - CollectionRoutingMap routingMap, - DocumentCollection collection) throws DocumentClientException { - if (routingMap == null && request.getIsNameBased() && request.getPartitionKeyRangeIdentity() != null - && request.getPartitionKeyRangeIdentity().getCollectionRid() != null) { - // By design, if partitionkeyrangeid header is present and it contains collectionrid for collection - // which doesn't exist, we return InvalidPartitionException. Backend does the same. - // Caller (client SDK or whoever attached the header) supposedly has outdated collection cache and will refresh it. - // We cannot retry here, as the logic for retry in this case is use-case specific. - logger.debug( - "Routing map for request with partitionkeyrageid {} was not found", - request.getPartitionKeyRangeIdentity().toHeader()); - - InvalidPartitionException invalidPartitionException = new InvalidPartitionException(); - BridgeInternal.setResourceAddress(invalidPartitionException, request.getResourceAddress()); - throw invalidPartitionException; - } - - if (routingMap == null) { - logger.debug( - "Routing map was not found although collection cache is upto date for collection {}", - collection.getResourceId()); - // Routing map not found although collection was resolved correctly. - NotFoundException e = new NotFoundException(); - BridgeInternal.setResourceAddress(e, request.getResourceAddress()); - throw e; - } - } - - private Single tryResolveServerPartitionAsync( - RxDocumentServiceRequest request, - DocumentCollection collection, - CollectionRoutingMap routingMap, - boolean collectionCacheIsUptodate, - boolean collectionRoutingMapCacheIsUptodate, - boolean forceRefreshPartitionAddresses) { - - try { - // Check if this request partitionkeyrange-aware routing logic. We cannot retry here in this case - // and need to bubble up errors. - if (request.getPartitionKeyRangeIdentity() != null) { - return this.tryResolveServerPartitionByPartitionKeyRangeIdAsync( - request, - collection, - routingMap, - collectionCacheIsUptodate, - collectionRoutingMapCacheIsUptodate, - forceRefreshPartitionAddresses); - } - - if (!request.getResourceType().isPartitioned() && - !(request.getResourceType() == ResourceType.StoredProcedure && request.getOperationType() == OperationType.ExecuteJavaScript) && - // Collection head is sent internally for strong consistency given routing hints from original requst, which is for partitioned resource. - !(request.getResourceType() == ResourceType.DocumentCollection && request.getOperationType() == OperationType.Head)) { - logger.error( - "Shouldn't come here for non partitioned resources. resourceType : {}, operationtype:{}, resourceaddress:{}", - request.getResourceType(), - request.getOperationType(), - request.getResourceAddress()); - return Single.error(BridgeInternal.setResourceAddress(new InternalServerErrorException(RMResources.InternalServerError), request.getResourceAddress())); - } - - PartitionKeyRange range; - String partitionKeyString = request.getHeaders().get(HttpConstants.HttpHeaders.PARTITION_KEY); - - if (partitionKeyString != null) { - range = this.tryResolveServerPartitionByPartitionKey( - request, - partitionKeyString, - collectionCacheIsUptodate, - collection, - routingMap); - } else { - range = this.tryResolveSinglePartitionCollection(request, routingMap, collectionCacheIsUptodate); - } - - if (range == null) { - // Collection cache or routing map cache is potentially outdated. Return null - - // upper logic will refresh cache and retry. - return null; - } - - Single addressesObs = this.addressCache.tryGetAddresses( - request, - new PartitionKeyRangeIdentity(collection.getResourceId(), range.getId()), - forceRefreshPartitionAddresses); - - return addressesObs.flatMap(addresses -> { - - if (addresses == null) { - logger.info( - "Could not resolve addresses for identity {}/{}. Potentially collection cache or routing map cache is outdated. Return null - upper logic will refresh and retry. ", - new PartitionKeyRangeIdentity(collection.getResourceId(), range.getId())); - return Single.just(null); - } - - return Single.just(new ResolutionResult(range, addresses)); - }); - - } catch (Exception e) { - return Single.error(e); - } - } - - private PartitionKeyRange tryResolveSinglePartitionCollection( - RxDocumentServiceRequest request, - CollectionRoutingMap routingMap, - boolean collectionCacheIsUptoDate) throws DocumentClientException { - // Neither partitionkey nor partitionkeyrangeid is specified. - // Three options here: - // * This is non-partitioned collection and old client SDK which doesn't send partition key. In - // this case there's single entry in routing map. But can be multiple entries if before that - // existed partitioned collection with same name. - // * This is partitioned collection and old client SDK which doesn't send partition key. - // In this case there can be multiple ranges in routing map. - // * This is partitioned collection and this is custom written REST sdk, which has a bug and doesn't send - // partition key. - // We cannot know for sure whether this is partitioned collection or not, because - // partition key definition cache can be outdated. - // So we route request to the first partition. If this is non-partitioned collection - request will succeed. - // If it is partitioned collection - backend will return bad request as partition key header is required in this case. - if (routingMap.getOrderedPartitionKeyRanges().size() == 1) { - return (PartitionKeyRange) routingMap.getOrderedPartitionKeyRanges().get(0); - } - - if (collectionCacheIsUptoDate) { - throw BridgeInternal.setResourceAddress(new BadRequestException(RMResources.MissingPartitionKeyValue), request.getResourceAddress()); - } else { - return null; - } - } - - private Single resolveMasterResourceAddress(RxDocumentServiceRequest request, - boolean forceRefreshPartitionAddresses) { - assert ReplicatedResourceClient.isReadingFromMaster(request.getResourceType(), request.getOperationType()) - && request.getPartitionKeyRangeIdentity() == null; - - // ServiceIdentity serviceIdentity = this.masterServiceIdentity; - PartitionKeyRangeIdentity partitionKeyRangeIdentity = this.masterPartitionKeyRangeIdentity; - Single addressesObs = this.addressCache.tryGetAddresses( - request, - partitionKeyRangeIdentity, - forceRefreshPartitionAddresses); - - return addressesObs.flatMap(addresses -> { - if (addresses == null) { - logger.warn("Could not get addresses for master partition"); - - // return Observable.error() - NotFoundException e = new NotFoundException(); - BridgeInternal.setResourceAddress(e, request.getResourceAddress()); - return Single.error(e); - } - - PartitionKeyRange partitionKeyRange = new PartitionKeyRange(); - partitionKeyRange.setId(PartitionKeyRange.MASTER_PARTITION_KEY_RANGE_ID); - return Single.just(new ResolutionResult(partitionKeyRange, addresses)); - - }); - } - - private class RefreshState { - - volatile boolean collectionCacheIsUptoDate; - volatile boolean collectionRoutingMapCacheIsUptoDate; - volatile DocumentCollection collection; - volatile CollectionRoutingMap routingMap; - volatile ResolutionResult resolutionResult; - } - - private Single getOrRefreshRoutingMap(RxDocumentServiceRequest request, boolean forceRefreshPartitionAddresses) { - - RefreshState state = new RefreshState(); - - state.collectionCacheIsUptoDate = !request.getIsNameBased() || - (request.getPartitionKeyRangeIdentity() != null && request.getPartitionKeyRangeIdentity().getCollectionRid() != null); - state.collectionRoutingMapCacheIsUptoDate = false; - - Single collectionObs = this.collectionCache.resolveCollectionAsync(request); - - Single stateObs = collectionObs.flatMap(collection -> { - state.collection = collection; - Single routingMapObs = - this.collectionRoutingMapCache.tryLookupAsync(collection.getResourceId(), null, request.forceCollectionRoutingMapRefresh, request.properties); - final DocumentCollection underlyingCollection = collection; - return routingMapObs.flatMap(routingMap -> { - state.routingMap = routingMap; - - if (request.forcePartitionKeyRangeRefresh) { - state.collectionRoutingMapCacheIsUptoDate = true; - request.forcePartitionKeyRangeRefresh = false; - if (routingMap != null) { - return this.collectionRoutingMapCache.tryLookupAsync(underlyingCollection.getResourceId(), routingMap, request.properties) - .map(newRoutingMap -> { - state.routingMap = newRoutingMap; - return state; - }); - } - - } - - return Single.just(state); - }); - }); - - return stateObs.flatMap(newState -> { - - if (newState.routingMap == null && !newState.collectionCacheIsUptoDate) { - // Routing map was not found by resolved collection rid. Maybe collection rid is outdated. - // Refresh collection cache and reresolve routing map. - request.forceNameCacheRefresh = true; - newState.collectionCacheIsUptoDate = true; - newState.collectionRoutingMapCacheIsUptoDate = false; - - Single newCollectionObs = this.collectionCache.resolveCollectionAsync(request); - - return newCollectionObs.flatMap(collection -> { - newState.collection = collection; - Single newRoutingMapObs = this.collectionRoutingMapCache.tryLookupAsync( - collection.getResourceId(), - null, - request.properties); - - return newRoutingMapObs.map(routingMap -> { - newState.routingMap = routingMap; - return newState; - }); - } - ); - - } - - return Single.just(newState); - }); - } - - private Single getStateWithNewRoutingMap(RefreshState state, Single routingMapSingle) { - return routingMapSingle.map(r -> { - state.routingMap = r; - return state; - }); - } - - /** - * Resolves the endpoint of the partition for the given request - * - * @param request Request for which the partition endpoint resolution is to be performed - * @param forceRefreshPartitionAddresses Force refresh the partition's endpoint - * @return ResolutionResult - */ - private Single resolveAddressesAndIdentityAsync( - RxDocumentServiceRequest request, - boolean forceRefreshPartitionAddresses) { - - if (ReplicatedResourceClient.isReadingFromMaster(request.getResourceType(), request.getOperationType()) - && request.getPartitionKeyRangeIdentity() == null) { - return resolveMasterResourceAddress(request, forceRefreshPartitionAddresses); - } - - Single refreshStateObs = this.getOrRefreshRoutingMap(request, forceRefreshPartitionAddresses); - - return refreshStateObs.flatMap( - state -> { - try { - AddressResolver.ensureRoutingMapPresent(request, state.routingMap, state.collection); - - } catch (Exception e) { - return Single.error(e); - } - - // At this point we have both collection and routingMap. - Single resultObs = this.tryResolveServerPartitionAsync( - request, - state.collection, - state.routingMap, - state.collectionCacheIsUptoDate, - state.collectionRoutingMapCacheIsUptoDate, - forceRefreshPartitionAddresses); - - - return resultObs.flatMap(result -> { - Func1> addCollectionRidIfNameBased = funcResolutionResult -> { - assert funcResolutionResult != null; - if (request.getIsNameBased()) { - // Append collection rid. - // If we resolved collection rid incorrectly because of outdated cache, this can lead - // to incorrect routing decisions. But backend will validate collection rid and throw - // InvalidPartitionException if we reach wrong collection. - // Also this header will be used by backend to inject collection rid into metrics for - // throttled requests. - request.getHeaders().put(WFConstants.BackendHeaders.COLLECTION_RID, state.collection.getResourceId()); - } - - return Single.just(funcResolutionResult); - }; - - if (result != null) { - return addCollectionRidIfNameBased.call(result); - } - - // result is null: - assert result == null; - - Func1> ensureCollectionRoutingMapCacheIsUptoDateFunc = funcState -> { - if (!funcState.collectionRoutingMapCacheIsUptoDate) { - funcState.collectionRoutingMapCacheIsUptoDate = true; - Single newRoutingMapObs = this.collectionRoutingMapCache.tryLookupAsync( - funcState.collection.getResourceId(), - funcState.routingMap, - request.properties); - - return getStateWithNewRoutingMap(funcState, newRoutingMapObs); - } else { - return Single.just(state); - } - }; - - Func1> resolveServerPartition = funcState -> { - - try { - AddressResolver.ensureRoutingMapPresent(request, funcState.routingMap, funcState.collection); - } catch (Exception e) { - return Single.error(e); - } - - return this.tryResolveServerPartitionAsync( - request, - funcState.collection, - funcState.routingMap, - true, - true, - forceRefreshPartitionAddresses); - }; - - Func1> onNullThrowNotFound = funcResolutionResult -> { - if (funcResolutionResult == null) { - logger.debug("Couldn't route partitionkeyrange-oblivious request after retry/cache refresh. Collection doesn't exist."); - - // At this point collection cache and routing map caches are refreshed. - // The only reason we will get here is if collection doesn't exist. - // Case when partition-key-range doesn't exist is handled in the corresponding method. - - return Single.error(BridgeInternal.setResourceAddress(new NotFoundException(), request.getResourceAddress())); - } - - return Single.just(funcResolutionResult); - }; - - // Couldn't resolve server partition or its addresses. - // Either collection cache is outdated or routing map cache is outdated. - if (!state.collectionCacheIsUptoDate) { - request.forceNameCacheRefresh = true; - state.collectionCacheIsUptoDate = true; - - Single newCollectionObs = this.collectionCache.resolveCollectionAsync(request); - Single newRefreshStateObs = newCollectionObs.flatMap(collection -> { - state.collection = collection; - - if (collection.getResourceId() != state.routingMap.getCollectionUniqueId()) { - // Collection cache was stale. We resolved to new Rid. routing map cache is potentially stale - // for this new collection rid. Mark it as such. - state.collectionRoutingMapCacheIsUptoDate = false; - Single newRoutingMap = this.collectionRoutingMapCache.tryLookupAsync( - collection.getResourceId(), - null, - request.properties); - - return getStateWithNewRoutingMap(state, newRoutingMap); - } - - return Single.just(state); - }); - - Single newResultObs = newRefreshStateObs.flatMap(ensureCollectionRoutingMapCacheIsUptoDateFunc::call) - .flatMap(resolveServerPartition::call); - - return newResultObs.flatMap(onNullThrowNotFound::call).flatMap(addCollectionRidIfNameBased::call); - - } else { - return ensureCollectionRoutingMapCacheIsUptoDateFunc.call(state) - .flatMap(resolveServerPartition::call).flatMap(onNullThrowNotFound).flatMap(addCollectionRidIfNameBased); - } - }); - } - ); - } - - private ResolutionResult handleRangeAddressResolutionFailure( - RxDocumentServiceRequest request, - boolean collectionCacheIsUpToDate, - boolean routingMapCacheIsUpToDate, - CollectionRoutingMap routingMap) throws DocumentClientException { - // Optimization to not refresh routing map unnecessary. As we keep track of parent child relationships, - // we can determine that a range is gone just by looking up in the routing map. - if (collectionCacheIsUpToDate && routingMapCacheIsUpToDate || - collectionCacheIsUpToDate && routingMap.IsGone(request.getPartitionKeyRangeIdentity().getPartitionKeyRangeId())) { - String errorMessage = String.format( - RMResources.PartitionKeyRangeNotFound, - request.getPartitionKeyRangeIdentity().getPartitionKeyRangeId(), - request.getPartitionKeyRangeIdentity().getCollectionRid()); - throw BridgeInternal.setResourceAddress(new PartitionKeyRangeGoneException(errorMessage), request.getResourceAddress()); - } - - return null; - } - - private Single returnOrError(Callable function) { - try { - return Single.just(function.call()); - } catch (Exception e) { - return Single.error(e); - } - } - - private Single tryResolveServerPartitionByPartitionKeyRangeIdAsync( - RxDocumentServiceRequest request, - DocumentCollection collection, - CollectionRoutingMap routingMap, - boolean collectionCacheIsUpToDate, - boolean routingMapCacheIsUpToDate, - boolean forceRefreshPartitionAddresses) { - - PartitionKeyRange partitionKeyRange = routingMap.getRangeByPartitionKeyRangeId(request.getPartitionKeyRangeIdentity().getPartitionKeyRangeId()); - if (partitionKeyRange == null) { - logger.debug("Cannot resolve range '{}'", request.getPartitionKeyRangeIdentity().toHeader()); - return returnOrError(() -> this.handleRangeAddressResolutionFailure(request, collectionCacheIsUpToDate, routingMapCacheIsUpToDate, routingMap)); - } - - Single addressesObs = this.addressCache.tryGetAddresses( - request, - new PartitionKeyRangeIdentity(collection.getResourceId(), request.getPartitionKeyRangeIdentity().getPartitionKeyRangeId()), - forceRefreshPartitionAddresses); - - return addressesObs.flatMap(addresses -> { - - if (addresses == null) { - logger.debug("Cannot resolve addresses for range '{}'", request.getPartitionKeyRangeIdentity().toHeader()); - - try { - return Single.just(this.handleRangeAddressResolutionFailure(request, collectionCacheIsUpToDate, routingMapCacheIsUpToDate, routingMap)); - } catch (DocumentClientException e) { - return Single.error(e); - } - } - - return Single.just(new ResolutionResult(partitionKeyRange, addresses)); - }); - } - - private PartitionKeyRange tryResolveServerPartitionByPartitionKey( - RxDocumentServiceRequest request, - String partitionKeyString, - boolean collectionCacheUptoDate, - DocumentCollection collection, - CollectionRoutingMap routingMap) throws DocumentClientException { - if (request == null) { - throw new NullPointerException("request"); - } - - if (partitionKeyString == null) { - throw new NullPointerException("partitionKeyString"); - } - - if (collection == null) { - throw new NullPointerException("collection"); - } - - if (routingMap == null) { - throw new NullPointerException("routingMap"); - } - - PartitionKeyInternal partitionKey; - - try { - partitionKey = PartitionKeyInternal.fromJsonString(partitionKeyString); - } catch (Exception ex) { - throw BridgeInternal.setResourceAddress(new BadRequestException( - String.format(RMResources.InvalidPartitionKey, partitionKeyString), - ex), request.getResourceAddress()); - } - - if (partitionKey == null) { - throw new InternalServerErrorException(String.format("partition key is null '%s'", partitionKeyString)); - } - - if (partitionKey.getComponents().size() == collection.getPartitionKey().getPaths().size()) { - // Although we can compute effective partition key here, in general case this Gateway can have outdated - // partition key definition cached - like if collection with same name but with Range partitioning is created. - // In this case server will not pass x-ms-documentdb-collection-rid check and will return back InvalidPartitionException. - // Gateway will refresh its cache and retry. - String effectivePartitionKey = PartitionKeyInternalHelper.getEffectivePartitionKeyString(partitionKey, collection.getPartitionKey()); - - // There should be exactly one range which contains a partition key. Always. - return routingMap.getRangeByEffectivePartitionKey(effectivePartitionKey); - } - - if (collectionCacheUptoDate) { - BadRequestException badRequestException = BridgeInternal.setResourceAddress(new BadRequestException(RMResources.PartitionKeyMismatch), request.getResourceAddress()); - badRequestException.getResponseHeaders().put(WFConstants.BackendHeaders.SUB_STATUS, Integer.toString(HttpConstants.SubStatusCodes.PARTITION_KEY_MISMATCH)); - - throw badRequestException; - } - - // Partition key supplied has different number paths than locally cached partition key definition. - // Three things can happen: - // 1. User supplied wrong partition key. - // 2. Client SDK has outdated partition key definition cache and extracted wrong value from the document. - // 3. Gateway's cache is outdated. - // - // What we will do is append x-ms-documentdb-collection-rid header and forward it to random collection partition. - // * If collection rid matches, server will send back 400.1001, because it also will not be able to compute - // effective partition key. Gateway will forward this status code to client - client will handle it. - // * If collection rid doesn't match, server will send back InvalidPartiitonException and Gateway will - // refresh name routing cache - this will refresh partition key definition as well, and retry. - - logger.debug( - "Cannot compute effective partition key. Definition has '{}' paths, values supplied has '{}' paths. Will refresh cache and retry.", - collection.getPartitionKey().getPaths().size(), - partitionKey.getComponents().size()); - - return null; - } - - private class ResolutionResult { - public final PartitionKeyRange TargetPartitionKeyRange; - public final AddressInformation[] Addresses; - - public ResolutionResult( - PartitionKeyRange targetPartitionKeyRange, - AddressInformation[] addresses) { - if (targetPartitionKeyRange == null) { - throw new NullPointerException("targetPartitionKeyRange"); - } - - if (addresses == null) { - throw new NullPointerException("addresses"); - } - - this.TargetPartitionKeyRange = targetPartitionKeyRange; - this.Addresses = addresses; - } - } -} - diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressSelector.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressSelector.java deleted file mode 100644 index 24727f7a07a7..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressSelector.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import rx.Single; - -import java.net.URI; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -public class AddressSelector { - private final IAddressResolver addressResolver; - private final Protocol protocol; - - public AddressSelector(IAddressResolver addressResolver, Protocol protocol) { - this.addressResolver = addressResolver; - this.protocol = protocol; - } - - public Single> resolveAllUriAsync( - RxDocumentServiceRequest request, - boolean includePrimary, - boolean forceRefresh) { - Single> allReplicaAddressesObs = this.resolveAddressesAsync(request, forceRefresh); - return allReplicaAddressesObs.map(allReplicaAddresses -> allReplicaAddresses.stream().filter(a -> includePrimary || !a.isPrimary()) - .map(a -> HttpUtils.toURI(a.getPhysicalUri())).collect(Collectors.toList())); - } - - public Single resolvePrimaryUriAsync(RxDocumentServiceRequest request, boolean forceAddressRefresh) { - Single> replicaAddressesObs = this.resolveAddressesAsync(request, forceAddressRefresh); - return replicaAddressesObs.flatMap(replicaAddresses -> { - try { - return Single.just(AddressSelector.getPrimaryUri(request, replicaAddresses)); - } catch (Exception e) { - return Single.error(e); - } - }); - } - - public static URI getPrimaryUri(RxDocumentServiceRequest request, List replicaAddresses) throws GoneException { - AddressInformation primaryAddress = null; - - if (request.getDefaultReplicaIndex() != null) { - int defaultReplicaIndex = request.getDefaultReplicaIndex(); - if (defaultReplicaIndex >= 0 && defaultReplicaIndex < replicaAddresses.size()) { - primaryAddress = replicaAddresses.get(defaultReplicaIndex); - } - } else { - primaryAddress = replicaAddresses.stream().filter(address -> address.isPrimary() && !address.getPhysicalUri().contains("[")) - .findAny().orElse(null); - } - - if (primaryAddress == null) { - // Primary endpoint (of the desired protocol) was not found. - throw new GoneException(String.format("The requested resource is no longer available at the server. Returned addresses are {%s}", - String.join(",", replicaAddresses.stream().map(address -> address.getPhysicalUri()).collect(Collectors.toList()))), null); - } - - return HttpUtils.toURI(primaryAddress.getPhysicalUri()); - } - - public Single> resolveAddressesAsync(RxDocumentServiceRequest request, boolean forceAddressRefresh) { - Single> resolvedAddressesObs = - (this.addressResolver.resolveAsync(request, forceAddressRefresh)) - .map(addresses -> Arrays.stream(addresses) - .filter(address -> { - return !Strings.isNullOrEmpty(address.getPhysicalUri()) && Strings.areEqualIgnoreCase(address.getProtocolScheme(), this.protocol.scheme()); - }) - .collect(Collectors.toList())); - - return resolvedAddressesObs.map( - resolvedAddresses -> { - List r = resolvedAddresses.stream().filter(address -> !address.isPublic()).collect(Collectors.toList()); - if (r.size() > 0) { - return r; - } else { - return resolvedAddresses.stream().filter(address -> address.isPublic()).collect(Collectors.toList()); - } - } - ); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/BarrierRequestHelper.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/BarrierRequestHelper.java deleted file mode 100644 index dabfb9d2c96e..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/BarrierRequestHelper.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.InternalServerErrorException; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.PathsHelper; -import com.microsoft.azure.cosmosdb.internal.ResourceId; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.rx.internal.AuthorizationTokenType; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import org.apache.commons.lang3.NotImplementedException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Single; -import rx.exceptions.Exceptions; - -import java.util.Map; - -public class BarrierRequestHelper { - private final static Logger logger = LoggerFactory.getLogger(BarrierRequestHelper.class); - - public static Single createAsync( - RxDocumentServiceRequest request, - IAuthorizationTokenProvider authorizationTokenProvider, - Long targetLsn, - Long targetGlobalCommittedLsn) { - - boolean isCollectionHeadRequest = BarrierRequestHelper.isCollectionHeadBarrierRequest( - request.getResourceType(), - request.getOperationType()); - - AuthorizationTokenType originalRequestTokenType = request.authorizationTokenType; - - if (originalRequestTokenType == AuthorizationTokenType.Invalid) { - String message = "AuthorizationTokenType not set for the read request"; - assert false : message; - logger.error(message); - } - - String authorizationToken = Strings.Emtpy; - RxDocumentServiceRequest barrierLsnRequest = null; - if (!isCollectionHeadRequest) { - // DB Feed - barrierLsnRequest = RxDocumentServiceRequest.create( - OperationType.HeadFeed, - (String) null, - (ResourceType) ResourceType.Database, - (Map) null); - } else if (request.getIsNameBased()) { - // Name based server request - - // get the collection full name - // dbs/{id}/colls/{collid}/ - String collectionLink = PathsHelper.getCollectionPath(request.getResourceAddress()); - barrierLsnRequest = RxDocumentServiceRequest.createFromName( - OperationType.Head, - collectionLink, - ResourceType.DocumentCollection); - } else { - // RID based Server request - barrierLsnRequest = RxDocumentServiceRequest.create( - OperationType.Head, - ResourceId.parse(request.getResourceId()).getDocumentCollectionId().toString(), - ResourceType.DocumentCollection, null); - } - - barrierLsnRequest.getHeaders().put(HttpConstants.HttpHeaders.X_DATE, Utils.nowAsRFC1123()); - - if (targetLsn != null && targetLsn > 0) { - barrierLsnRequest.getHeaders().put(HttpConstants.HttpHeaders.TARGET_LSN, targetLsn.toString()); - } - - if (targetGlobalCommittedLsn != null && targetGlobalCommittedLsn > 0) { - barrierLsnRequest.getHeaders().put(HttpConstants.HttpHeaders.TARGET_GLOBAL_COMMITTED_LSN, targetGlobalCommittedLsn.toString()); - } - - switch (originalRequestTokenType) { - case PrimaryMasterKey: - case PrimaryReadonlyMasterKey: - case SecondaryMasterKey: - case SecondaryReadonlyMasterKey: - authorizationToken = authorizationTokenProvider.getUserAuthorizationToken( - barrierLsnRequest.getResourceAddress(), - isCollectionHeadRequest ? ResourceType.DocumentCollection : ResourceType.Database, - HttpConstants.HttpMethods.HEAD, - barrierLsnRequest.getHeaders(), - originalRequestTokenType, - request.properties); - break; - - - case ResourceToken: - authorizationToken = request.getHeaders().get(HttpConstants.HttpHeaders.AUTHORIZATION); - break; - - default: - String unknownAuthToken = "Unknown authorization token kind for read request"; - assert false : unknownAuthToken; - logger.error(unknownAuthToken); - Exceptions.propagate(new InternalServerErrorException(RMResources.InternalServerError)); - } - - barrierLsnRequest.getHeaders().put(HttpConstants.HttpHeaders.AUTHORIZATION, authorizationToken); - barrierLsnRequest.requestContext = request.requestContext.clone(); - - if (request.getPartitionKeyRangeIdentity() != null) { - barrierLsnRequest.routeTo(request.getPartitionKeyRangeIdentity()); - } - if (request.getHeaders().get(HttpConstants.HttpHeaders.PARTITION_KEY) != null) { - barrierLsnRequest.getHeaders().put(HttpConstants.HttpHeaders.PARTITION_KEY, request.getHeaders().get(HttpConstants.HttpHeaders.PARTITION_KEY)); - } - if (request.getHeaders().get(WFConstants.BackendHeaders.COLLECTION_RID) != null) { - barrierLsnRequest.getHeaders().put(WFConstants.BackendHeaders.COLLECTION_RID, request.getHeaders().get(WFConstants.BackendHeaders.COLLECTION_RID)); - } - - return Single.just(barrierLsnRequest); - } - - static boolean isCollectionHeadBarrierRequest(ResourceType resourceType, OperationType operationType) { - switch (resourceType) { - case Attachment: - case Document: - case Conflict: - case StoredProcedure: - case UserDefinedFunction: - case Trigger: - return true; - case DocumentCollection: - if (operationType != OperationType.ReadFeed && operationType != OperationType.Query && operationType != OperationType.SqlQuery) { - return true; - } else { - return false; - } - case PartitionKeyRange: - // no logic for OperationType.GetSplitPoint and OperationType.AbortSplit - // as they are not applicable to SDK - return false; - default: - return false; - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConflictException.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConflictException.java deleted file mode 100644 index 58f7e39d3c72..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConflictException.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.util.Map; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class ConflictException extends DocumentClientException { - - private static final long serialVersionUID = 1L; - - public ConflictException() { - this(RMResources.EntityAlreadyExists); - } - - public ConflictException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.CONFLICT, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public ConflictException(String msg) { - super(HttpConstants.StatusCodes.CONFLICT, msg); - } - - public ConflictException(String msg, String resourceAddress) { - super(msg, null, null, HttpConstants.StatusCodes.CONFLICT, resourceAddress); - } - - public ConflictException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public ConflictException(Exception innerException) { - this(RMResources.EntityAlreadyExists, innerException, null, null); - } - - public ConflictException(Error error, Map headers) { - super(HttpConstants.StatusCodes.CONFLICT, error, headers); - } - - public ConflictException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - super(String.format("%s: %s", RMResources.EntityAlreadyExists, message), - innerException, - HttpUtils.asMap(headers), - HttpConstants.StatusCodes.CONFLICT, - requestUri); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyReader.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyReader.java deleted file mode 100644 index ab132ebbafbd..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyReader.java +++ /dev/null @@ -1,439 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import java.util.HashMap; -import java.util.List; - -import com.microsoft.azure.cosmosdb.ClientSideRequestStatistics; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.ISessionToken; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.NotFoundException; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; - -import static com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Single; - -/* - ConsistencyLevel Replication Mode Desired ReadMode - ------------------- -------------------- --------------------------------------------------------------------------- - Strong Synchronous Read from Read Quorum - Asynchronous Not supported - - Bounded Staleness Synchronous Read from Read Quorum - Asynchronous Read from Read Quorum. Performing read barrier on Primary is unsupported. - - Session Sync/Async Read Any (With LSN Cookie) - Default to Primary as last resort (which should succeed always) - - Eventual Sync/Async Read Any - - Client does validation of unsupported combinations. - - - Preliminaries - ============= - 1. We do primary copy/single master replication. - 2. We do sync or async replication depending on the value of DefaultConsistencyLevel on a database account. - If the database account is configured with DefaultConsistencyLevel = Strong, we do sync replication. By default, for all other values of DefaultConsistencyLevel, we do asynchronous replication. - - Replica set - =========== - We define N as the current number of replicas protecting a partition. - At any given point, the value of N can fluctuate between NMax and NMin. - NMax is called the target replica set size and NMin is called the minimum write availability set size. - NMin and NMax are statically defined whereas N is dynamic. - Dynamic replica set is great for dealing with successive failures. - Since N fluctuates between NMax and NMin, the value of N at the time of calculation of W may not be the same when R is calculated. - This is a side effect of dynamic quorum and requires careful consideration. - - NMin = 2, NMax >= 3 - - Simultaneous Failures - ===================== - In general N replicas imply 2f+1 simultaneous failures - N = 5 allows for 2 simultaneous failures - N = 4 allows for 1 failure - N = 3 allows for 1 failure - N < 3 allows for 0 failures - - Quorums - ======= - W = Write Quorum = Number of replicas which acknowledge a write before the primary can ack the client. It is majority set i.e. N/2 + 1 - R = Read Quorum = Set of replicas such that there is non-empty intersection between W and R that constitute N i.e. R = N -W + 1 - - For sync replication, W is used as a majority quorum. - For async replication, W = 1. We have two LSNs, one is quorum acknowledged LSN (LSN-Q) and another is what is visible to the client (LSN-C). - LSN-Q is the stable LSN which corresponds to the write quorum of Windows Fabric. LSN-C is unstable and corresponds to W=1. - - Assumptions - =========== - Nmin <= N <= Nmax - W >= N/2 + 1 - R = N -W + 1 - - N from read standpoint means number of address from BE which is returning successful response. - Successful reponse: Any BE response containing LSN response header is considered successful reponse. Typically every response other than 410 is treated as succesful response. - - Strong Consistency - ================== - Strong Read requires following guarantees. - * Read value is the latest that has been written. If a write operation finished. Any subsequent reads should see that value. - * Monotonic guarantee. Any read that starts after a previous read operation, should see atleast return equal or higher version of the value. - - To perform strong read we require that atleast R i.e. Read Quorum number of replicas have the value committed. To acheve that such read : - * Read R replicas. If they have the same LSN, use the read result - * If they don't have the same LSN, we will either return the result with the highest LSN observed from those R replicas, after ensuring that LSN - becomes available with R replicas. - * Secondary replicas are always preferred for reading. If R secondaries have returned the result but cannot agree on the resulting LSN, we can include Primary to satisfy read quorum. - * If we only have R replicas (i.e. N==R), we include primary in reading the result and validate N==R. - - Bounded Staleness - ================= - Sync Replication: - Bounded staleness uses the same logic as Strong for cases where the server is using sync replication. - - Async Replication: - For async replication, we make sure that we do not use the Primary as barrier for read quorum. This is because Primary is always going to run ahead (async replication uses W=1 on Primary). - Using primary would voilate the monotonic read guarantees when we fall back to reading from secondary in the subsequent reads as they are always running slower as compared to Primary. - - Session - ======= - We read from secondaries one by one until we find a match for the client's session token (LSN-C). - We go to primary as a last resort which should satisfy LSN-C. - - Availability for Bounded Staleness (for NMax = 4 and NMin = 2): - When there is a partition, the minority quorum can remain available for read as long as N >= 1 - When there is a partition, the minority quorum can remain available for writes as long as N >= 2 - - Eventual - ======== - We can read from any replicas. - - Availability for Bounded Staleness (for NMax = 4 and NMin = 2): - When there is a partition, the minority quorum can remain available for read as long as N >= 1 - When there is a partition, the minority quorum can remain available for writes as long as N >= 2 - - Read Retry logic - ----------------- - For Any NonQuorum Reads(A.K.A ReadAny); AddressCache is refreshed for following condition. - 1) No Secondary Address is found in Address Cache. - 2) Chosen Secondary Returned GoneException/EndpointNotFoundException. - - For Quorum Read address cache is refreshed on following condition. - 1) We found only R secondary where R < RMAX. - 2) We got GoneException/EndpointNotFoundException on all the secondary we contacted. - - */ -/** - * ConsistencyReader has a dependency on both StoreReader and QuorumReader. For Bounded Staleness and Strong Consistency, it uses the Quorum Reader - * to converge on a read from read quorum number of replicas. - * For Session and Eventual Consistency, it directly uses the store reader. - */ -public class ConsistencyReader { - private final static int MAX_NUMBER_OF_SECONDARY_READ_RETRIES = 3; - private final static Logger logger = LoggerFactory.getLogger(ConsistencyReader.class); - - private final AddressSelector addressSelector; - private final GatewayServiceConfigurationReader serviceConfigReader; - private final IAuthorizationTokenProvider authorizationTokenProvider; - private final StoreReader storeReader; - private final QuorumReader quorumReader; - private final Configs configs; - - public ConsistencyReader( - Configs configs, - AddressSelector addressSelector, - ISessionContainer sessionContainer, - TransportClient transportClient, - GatewayServiceConfigurationReader serviceConfigReader, - IAuthorizationTokenProvider authorizationTokenProvider) { - this.configs = configs; - this.addressSelector = addressSelector; - this.serviceConfigReader = serviceConfigReader; - this.authorizationTokenProvider = authorizationTokenProvider; - this.storeReader = createStoreReader(transportClient, addressSelector, sessionContainer); - this.quorumReader = createQuorumReader(transportClient, addressSelector, this.storeReader, serviceConfigReader, authorizationTokenProvider); - } - - public Single readAsync(RxDocumentServiceRequest entity, - TimeoutHelper timeout, - boolean isInRetry, - boolean forceRefresh) { - if (!isInRetry) { - if (timeout.isElapsed()) { - return Single.error(new RequestTimeoutException()); - } - - } else { - if (timeout.isElapsed()) { - return Single.error(new GoneException()); - } - } - - entity.requestContext.timeoutHelper = timeout; - - if (entity.requestContext.requestChargeTracker == null) { - entity.requestContext.requestChargeTracker = new RequestChargeTracker(); - } - - if(entity.requestContext.clientSideRequestStatistics == null) { - entity.requestContext.clientSideRequestStatistics = new ClientSideRequestStatistics(); - } - - entity.requestContext.forceRefreshAddressCache = forceRefresh; - - ValueHolder targetConsistencyLevel = ValueHolder.initialize(null); - ValueHolder useSessionToken = ValueHolder.initialize(null); - ReadMode desiredReadMode; - try { - desiredReadMode = this.deduceReadMode(entity, targetConsistencyLevel, useSessionToken); - } catch (DocumentClientException e) { - return Single.error(e); - } - int maxReplicaCount = this.getMaxReplicaSetSize(entity); - int readQuorumValue = maxReplicaCount - (maxReplicaCount / 2); - - switch (desiredReadMode) { - case Primary: - return this.readPrimaryAsync(entity, useSessionToken.v); - - case Strong: - entity.requestContext.performLocalRefreshOnGoneException = true; - return this.quorumReader.readStrongAsync(entity, readQuorumValue, desiredReadMode); - - case BoundedStaleness: - entity.requestContext.performLocalRefreshOnGoneException = true; - - // for bounded staleness, we are defaulting to read strong for local region reads. - // this can be done since we are always running with majority quorum w = 3 (or 2 during quorum downshift). - // This means that the primary will always be part of the write quorum, and - // therefore can be included for barrier reads. - - // NOTE: this assumes that we are running with SYNC replication (i.e. majority quorum). - // When we run on a minority write quorum(w=2), to ensure monotonic read guarantees - // we always contact two secondary replicas and exclude primary. - // However, this model significantly reduces availability and available throughput for serving reads for bounded staleness during reconfiguration. - // Therefore, to ensure monotonic read guarantee from any replica set we will just use regular quorum read(R=2) since our write quorum is always majority(W=3) - return this.quorumReader.readStrongAsync(entity, readQuorumValue, desiredReadMode); - - case Any: - if (targetConsistencyLevel.v == ConsistencyLevel.Session) { - return this.readSessionAsync(entity, desiredReadMode); - } else { - return this.readAnyAsync(entity, desiredReadMode); - } - - default: - throw new IllegalStateException("invalid operation " + desiredReadMode); - } - } - - private Single readPrimaryAsync(RxDocumentServiceRequest entity, - boolean useSessionToken) { - - Single responseObs = this.storeReader.readPrimaryAsync( - entity, - false /*required valid LSN*/, - useSessionToken); - return responseObs.flatMap(response -> { - try { - return Single.just(response.toResponse()); - } catch (DocumentClientException e) { - // TODO: RxJava1 due to design flaw doesn't allow throwing checked exception - // RxJava2 has fixed this design flaw, - // once we switched to RxJava2 we can get rid of unnecessary catch block - // also we can switch to Observable.map(.) - return Single.error(e); - } - }); - } - - private Single readAnyAsync(RxDocumentServiceRequest entity, - ReadMode readMode) { - Single> responsesObs = this.storeReader.readMultipleReplicaAsync( - entity, - /* includePrimary */ true, - /* replicaCountToRead */ 1, - /* requiresValidLSN*/ false, - /* useSessionToken */ false, - /* readMode */ readMode); - - return responsesObs.flatMap( - responses -> { - if (responses.size() == 0) { - return Single.error(new GoneException(RMResources.Gone)); - } - - try { - return Single.just(responses.get(0).toResponse()); - } catch (DocumentClientException e) { - // TODO: RxJava1 due to design flaw doesn't allow throwing checked exception - // RxJava2 has fixed this design flaw, - // once we switched to RxJava2 we can get rid of unnecessary catch block - // also we can switch to Observable.map(.) - return Single.error(e); - } - } - ); - } - - private Single readSessionAsync(RxDocumentServiceRequest entity, - ReadMode readMode) { - - if (entity.requestContext.timeoutHelper.isElapsed()) { - return Single.error(new GoneException()); - } - - Single> responsesObs = this.storeReader.readMultipleReplicaAsync( - entity, - /* includePrimary */ true, - /* replicaCountToRead */ 1, - /* requiresValidLSN */ true, - /* useSessionToken */ true, - /* readMode */ readMode, - /* checkMinLsn */ true, - /* forceReadAll */ false); - - return responsesObs.flatMap(responses -> { - - if (responses.size() > 0) { - try { - return Single.just(responses.get(0).toResponse(entity.requestContext.requestChargeTracker)); - } catch (NotFoundException notFoundException) { - try { - if (entity.requestContext.sessionToken != null - && responses.get(0).sessionToken != null - && !entity.requestContext.sessionToken.isValid(responses.get(0).sessionToken)) { - logger.warn("Convert to session read exception, request {} Session Lsn {}, responseLSN {}", entity.getResourceAddress(), entity.requestContext.sessionToken.convertToString(), responses.get(0).lsn); - notFoundException.getResponseHeaders().put(WFConstants.BackendHeaders.SUB_STATUS, Integer.toString(HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE)); - } - return Single.error(notFoundException); - } catch (DocumentClientException e) { - // TODO: RxJava1 due to design flaw doesn't allow throwing checked exception - // so we have to catch and return - // once we move to RxJava2 we can fix this. - return Single.error(e); - } - } catch (DocumentClientException dce) { - // TODO: RxJava1 due to design flaw doesn't allow throwing checked exception - // so we have to catch and return - // once we move to RxJava2 we can fix this. - return Single.error(dce); - } - - } - - // else - HashMap responseHeaders = new HashMap<>(); - responseHeaders.put(WFConstants.BackendHeaders.SUB_STATUS, Integer.toString(HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE)); - ISessionToken requestSessionToken = entity.requestContext.sessionToken; - logger.warn("Fail the session read {}, request session token {}", entity.getResourceAddress(), requestSessionToken == null ? "" : requestSessionToken.convertToString()); - return Single.error(new NotFoundException(RMResources.ReadSessionNotAvailable, responseHeaders, null)); - }); - } - - ReadMode deduceReadMode(RxDocumentServiceRequest request, - ValueHolder targetConsistencyLevel, - ValueHolder useSessionToken) throws DocumentClientException { - targetConsistencyLevel.v = RequestHelper.GetConsistencyLevelToUse(this.serviceConfigReader, request); - useSessionToken.v = (targetConsistencyLevel.v == ConsistencyLevel.Session); - - if (request.getDefaultReplicaIndex() != null) { - // Don't use session token - this is used by internal scenarios which technically don't intend session read when they target - // request to specific replica. - useSessionToken.v = false; - return ReadMode.Primary; //Let the addressResolver decides which replica to connect to. - } - - switch (targetConsistencyLevel.v) { - case Eventual: - return ReadMode.Any; - - case ConsistentPrefix: - return ReadMode.Any; - - case Session: - return ReadMode.Any; - - case BoundedStaleness: - return ReadMode.BoundedStaleness; - - case Strong: - return ReadMode.Strong; - - default: - throw new IllegalStateException("Invalid Consistency Level " + targetConsistencyLevel.v); - } - } - - public int getMaxReplicaSetSize(RxDocumentServiceRequest entity) { - boolean isMasterResource = ReplicatedResourceClient.isReadingFromMaster(entity.getResourceType(), entity.getOperationType()); - if (isMasterResource) { - return this.serviceConfigReader.getSystemReplicationPolicy().getMaxReplicaSetSize(); - } else { - return this.serviceConfigReader.getUserReplicationPolicy().getMaxReplicaSetSize(); - } - } - - public int getMinReplicaSetSize(RxDocumentServiceRequest entity) { - boolean isMasterResource = ReplicatedResourceClient.isReadingFromMaster(entity.getResourceType(), entity.getOperationType()); - if (isMasterResource) { - return this.serviceConfigReader.getSystemReplicationPolicy().getMinReplicaSetSize(); - } else { - return this.serviceConfigReader.getUserReplicationPolicy().getMinReplicaSetSize(); - } - } - - StoreReader createStoreReader(TransportClient transportClient, - AddressSelector addressSelector, - ISessionContainer sessionContainer) { - return new StoreReader(transportClient, - addressSelector, - sessionContainer); - } - - QuorumReader createQuorumReader(TransportClient transportClient, - AddressSelector addressSelector, - StoreReader storeReader, - GatewayServiceConfigurationReader serviceConfigurationReader, - IAuthorizationTokenProvider authorizationTokenProvider) { - return new QuorumReader(transportClient, - addressSelector, - storeReader, - serviceConfigurationReader, - authorizationTokenProvider, - configs); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyWriter.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyWriter.java deleted file mode 100644 index 2710724723c0..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyWriter.java +++ /dev/null @@ -1,396 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.ClientSideRequestStatistics; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.Integers; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.internal.SessionTokenHelper; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import org.apache.commons.collections4.ComparatorUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Observable; -import rx.Single; -import rx.schedulers.Schedulers; - -import java.net.URI; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicLong; -import java.util.concurrent.atomic.AtomicReference; -import java.util.stream.Collectors; - -/* - * ConsistencyWriter has two modes for writing - local quorum-acked write and globally strong write. - * - * The determination of whether a request is a local quorum-acked write or a globally strong write is through several factors: - * 1. Request.RequestContext.OriginalRequestConsistencyLevel - ensure that original request's consistency level, if set, is strong. - * 2. Default consistency level of the accoutn should be strong. - * 3. Number of read regions returned by write response > 0. - * - * For quorum-acked write: - * We send single request to primary of a single partition, which will take care of replicating to its secondaries. Once write quorum number of replicas commits the write, the write request returns to the user with success. There is no additional handling for this case. - * - * For globally strong write: - * Similarly, we send single request to primary of write region, which will take care of replicating to its secondaries, one of which is XPPrimary. XPPrimary will then replicate to all remote regions, which will all ack from within their region. In the write region, the request returns from the backend once write quorum number of replicas commits the write - but at this time, the response cannot be returned to caller, since linearizability guarantees will be violated. ConsistencyWriter will continuously issue barrier head requests against the partition in question, until GlobalCommittedLsn is at least as big as the lsn of the original response. - * 1. Issue write request to write region - * 2. Receive response from primary of write region, look at GlobalCommittedLsn and LSN headers. - * 3. If GlobalCommittedLSN == LSN, return response to caller - * 4. If GlobalCommittedLSN < LSN, cache LSN in request as SelectedGlobalCommittedLSN, and issue barrier requests against any/all replicas. - * 5. Each barrier response will contain its own LSN and GlobalCommittedLSN, check for any response that satisfies GlobalCommittedLSN >= SelectedGlobalCommittedLSN - * 6. Return to caller on success. - */ -public class ConsistencyWriter { - private final static int MAX_NUMBER_OF_WRITE_BARRIER_READ_RETRIES = 30; - private final static int DELAY_BETWEEN_WRITE_BARRIER_CALLS_IN_MS = 30; - private final static int MAX_SHORT_BARRIER_RETRIES_FOR_MULTI_REGION = 4; - private final static int SHORT_BARRIER_RETRY_INTERVAL_IN_MS_FOR_MULTI_REGION = 10; - - private final Logger logger = LoggerFactory.getLogger(ConsistencyWriter.class); - private final TransportClient transportClient; - private final AddressSelector addressSelector; - private final ISessionContainer sessionContainer; - private final IAuthorizationTokenProvider authorizationTokenProvider; - private final boolean useMultipleWriteLocations; - private final GatewayServiceConfigurationReader serviceConfigReader; - private final StoreReader storeReader; - - public ConsistencyWriter( - AddressSelector addressSelector, - ISessionContainer sessionContainer, - TransportClient transportClient, - IAuthorizationTokenProvider authorizationTokenProvider, - GatewayServiceConfigurationReader serviceConfigReader, - boolean useMultipleWriteLocations) { - this.transportClient = transportClient; - this.addressSelector = addressSelector; - this.sessionContainer = sessionContainer; - this.authorizationTokenProvider = authorizationTokenProvider; - this.useMultipleWriteLocations = useMultipleWriteLocations; - this.serviceConfigReader = serviceConfigReader; - this.storeReader = new StoreReader(transportClient, addressSelector, null /*we need store reader only for global strong, no session is needed*/); - } - - public Single writeAsync( - RxDocumentServiceRequest entity, - TimeoutHelper timeout, - boolean forceRefresh) { - - if (timeout.isElapsed()) { - return Single.error(new RequestTimeoutException()); - } - - String sessionToken = entity.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); - - return this.writePrivateAsync(entity, timeout, forceRefresh).doOnEach( - arg -> { - try { - SessionTokenHelper.setOriginalSessionToken(entity, sessionToken); - } catch (Throwable throwable) { - logger.error("Unexpected failure in handling orig [{}]: new [{}]", arg, throwable.getMessage(), throwable); - } - } - ); - } - - Single writePrivateAsync( - RxDocumentServiceRequest request, - TimeoutHelper timeout, - boolean forceRefresh) { - if (timeout.isElapsed()) { - return Single.error(new RequestTimeoutException()); - } - - request.requestContext.timeoutHelper = timeout; - - if (request.requestContext.requestChargeTracker == null) { - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - } - - if (request.requestContext.clientSideRequestStatistics == null) { - request.requestContext.clientSideRequestStatistics = new ClientSideRequestStatistics(); - } - - request.requestContext.forceRefreshAddressCache = forceRefresh; - - if (request.requestContext.globalStrongWriteResponse == null) { - - Single> replicaAddressesObs = this.addressSelector.resolveAddressesAsync(request, forceRefresh); - AtomicReference primaryURI = new AtomicReference<>(); - - return replicaAddressesObs.flatMap(replicaAddresses -> { - try { - List contactedReplicas = new ArrayList<>(); - replicaAddresses.forEach(replicaAddress -> contactedReplicas.add(HttpUtils.toURI(replicaAddress.getPhysicalUri()))); - request.requestContext.clientSideRequestStatistics.setContactedReplicas(contactedReplicas); - return Single.just(AddressSelector.getPrimaryUri(request, replicaAddresses)); - } catch (GoneException e) { - // RxJava1 doesn't allow throwing checked exception from Observable operators - return Single.error(e); - } - }).flatMap(primaryUri -> { - try { - primaryURI.set(primaryUri); - if (this.useMultipleWriteLocations && - RequestHelper.GetConsistencyLevelToUse(this.serviceConfigReader, request) == ConsistencyLevel.Session) { - // Set session token to ensure session consistency for write requests - // when writes can be issued to multiple locations - SessionTokenHelper.setPartitionLocalSessionToken(request, this.sessionContainer); - } else { - // When writes can only go to single location, there is no reason - // to session session token to the server. - SessionTokenHelper.validateAndRemoveSessionToken(request); - } - - } catch (Exception e) { - // RxJava1 doesn't allow throwing checked exception from Observable operators - return Single.error(e); - } - - return this.transportClient.invokeResourceOperationAsync(primaryUri, request) - .doOnError( - t -> { - try { - DocumentClientException ex = Utils.as(t, DocumentClientException.class); - try { - request.requestContext.clientSideRequestStatistics.recordResponse(request, - storeReader.createStoreResult(null, ex, false, false, primaryUri)); - } catch (DocumentClientException e) { - logger.error("Error occurred while recording response", e); - } - String value = ex.getResponseHeaders().get(HttpConstants.HttpHeaders.WRITE_REQUEST_TRIGGER_ADDRESS_REFRESH); - if (!Strings.isNullOrWhiteSpace(value)) { - Integer result = Integers.tryParse(value); - if (result != null && result == 1) { - startBackgroundAddressRefresh(request); - } - } - } catch (Throwable throwable) { - logger.error("Unexpected failure in handling orig [{}]", t.getMessage(), t); - logger.error("Unexpected failure in handling orig [{}] : new [{}]", t.getMessage(), throwable.getMessage(), throwable); - } - } - ); - - }).flatMap(response -> { - try { - request.requestContext.clientSideRequestStatistics.recordResponse(request, - storeReader.createStoreResult(response, null, false, false, primaryURI.get())); - } catch (DocumentClientException e) { - logger.error("Error occurred while recording response", e); - } - return barrierForGlobalStrong(request, response); - }); - } else { - - Single barrierRequestObs = BarrierRequestHelper.createAsync(request, this.authorizationTokenProvider, null, request.requestContext.globalCommittedSelectedLSN); - return barrierRequestObs.flatMap(barrierRequest -> { - return waitForWriteBarrierAsync(barrierRequest, request.requestContext.globalCommittedSelectedLSN) - .flatMap(v -> { - - if (!v.booleanValue()) { - logger.warn("ConsistencyWriter: Write barrier has not been met for global strong request. SelectedGlobalCommittedLsn: {}", request.requestContext.globalCommittedSelectedLSN); - return Single.error(new GoneException(RMResources.GlobalStrongWriteBarrierNotMet)); - } - - return Single.just(request); - }); - }).map(req -> req.requestContext.globalStrongWriteResponse); - } - } - - boolean isGlobalStrongRequest(RxDocumentServiceRequest request, StoreResponse response) { - if (this.serviceConfigReader.getDefaultConsistencyLevel() == ConsistencyLevel.Strong) { - int numberOfReadRegions = -1; - String headerValue = null; - if ((headerValue = response.getHeaderValue(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS)) != null) { - numberOfReadRegions = Integer.parseInt(headerValue); - } - - if (numberOfReadRegions > 0 && this.serviceConfigReader.getDefaultConsistencyLevel() == ConsistencyLevel.Strong) { - return true; - } - } - - return false; - } - - Single barrierForGlobalStrong(RxDocumentServiceRequest request, StoreResponse response) { - try { - if (ReplicatedResourceClient.isGlobalStrongEnabled() && this.isGlobalStrongRequest(request, response)) { - Utils.ValueHolder lsn = Utils.ValueHolder.initialize(-1l); - Utils.ValueHolder globalCommittedLsn = Utils.ValueHolder.initialize(-1l); - - getLsnAndGlobalCommittedLsn(response, lsn, globalCommittedLsn); - if (lsn.v == -1 || globalCommittedLsn.v == -1) { - logger.error("ConsistencyWriter: lsn {} or GlobalCommittedLsn {} is not set for global strong request", - lsn, globalCommittedLsn); - throw new GoneException(RMResources.Gone); - } - - request.requestContext.globalStrongWriteResponse = response; - request.requestContext.globalCommittedSelectedLSN = lsn.v; - - //if necessary we would have already refreshed cache by now. - request.requestContext.forceRefreshAddressCache = false; - - logger.debug("ConsistencyWriter: globalCommittedLsn {}, lsn {}", globalCommittedLsn, lsn); - //barrier only if necessary, i.e. when write region completes write, but read regions have not. - - if (globalCommittedLsn.v < lsn.v) { - Single barrierRequestObs = BarrierRequestHelper.createAsync(request, - this.authorizationTokenProvider, - null, - request.requestContext.globalCommittedSelectedLSN); - - return barrierRequestObs.flatMap(barrierRequest -> { - Single barrierWait = this.waitForWriteBarrierAsync(barrierRequest, request.requestContext.globalCommittedSelectedLSN); - - return barrierWait.flatMap(res -> { - if (!res) { - logger.error("ConsistencyWriter: Write barrier has not been met for global strong request. SelectedGlobalCommittedLsn: {}", - request.requestContext.globalCommittedSelectedLSN); - // RxJava1 doesn't allow throwing checked exception - return Single.error(new GoneException(RMResources.GlobalStrongWriteBarrierNotMet)); - } - - return Single.just(request.requestContext.globalStrongWriteResponse); - }); - - }); - - } else { - return Single.just(request.requestContext.globalStrongWriteResponse); - } - } else { - return Single.just(response); - } - - } catch (DocumentClientException e) { - // RxJava1 doesn't allow throwing checked exception from Observable operators - return Single.error(e); - } - } - - private Single waitForWriteBarrierAsync(RxDocumentServiceRequest barrierRequest, long selectedGlobalCommittedLsn) { - AtomicInteger writeBarrierRetryCount = new AtomicInteger(ConsistencyWriter.MAX_NUMBER_OF_WRITE_BARRIER_READ_RETRIES); - AtomicLong maxGlobalCommittedLsnReceived = new AtomicLong(0); - return Observable.defer(() -> { - if (barrierRequest.requestContext.timeoutHelper.isElapsed()) { - return Observable.error(new RequestTimeoutException()); - } - - Single> storeResultListObs = this.storeReader.readMultipleReplicaAsync( - barrierRequest, - true /*allowPrimary*/, - 1 /*any replica with correct globalCommittedLsn is good enough*/, - false /*requiresValidLsn*/, - false /*useSessionToken*/, - ReadMode.Strong, - false /*checkMinLsn*/, - false /*forceReadAll*/); - return storeResultListObs.flatMap( - responses -> { - if (responses != null && responses.stream().anyMatch(response -> response.globalCommittedLSN >= selectedGlobalCommittedLsn)) { - return Single.just(Boolean.TRUE); - } - - //get max global committed lsn from current batch of responses, then update if greater than max of all batches. - long maxGlobalCommittedLsn = (responses != null || !responses.isEmpty()) ? - (Long) responses.stream().map(s -> s.globalCommittedLSN).max(ComparatorUtils.NATURAL_COMPARATOR).get() : - 0l; - maxGlobalCommittedLsnReceived.set(maxGlobalCommittedLsnReceived.get() > maxGlobalCommittedLsn ? - maxGlobalCommittedLsnReceived.get() : maxGlobalCommittedLsn); - - //only refresh on first barrier call, set to false for subsequent attempts. - barrierRequest.requestContext.forceRefreshAddressCache = false; - - //trace on last retry. - if (writeBarrierRetryCount.getAndDecrement() == 0) { - logger.debug("ConsistencyWriter: WaitForWriteBarrierAsync - Last barrier multi-region strong. Responses: {}", - String.join("; ", responses.stream().map(r -> r.toString()).collect(Collectors.toList()))); - } - - return Single.just(null); - }).toObservable(); - }).repeatWhen(s -> { - if (writeBarrierRetryCount.get() == 0) { - return Observable.empty(); - } else { - - if ((ConsistencyWriter.MAX_NUMBER_OF_WRITE_BARRIER_READ_RETRIES - writeBarrierRetryCount.get()) > ConsistencyWriter.MAX_SHORT_BARRIER_RETRIES_FOR_MULTI_REGION) { - return Observable.timer(ConsistencyWriter.DELAY_BETWEEN_WRITE_BARRIER_CALLS_IN_MS, TimeUnit.MILLISECONDS); - } else { - return Observable.timer(ConsistencyWriter.SHORT_BARRIER_RETRY_INTERVAL_IN_MS_FOR_MULTI_REGION, TimeUnit.MILLISECONDS); - } - } - }).take(1) - .map(r -> { - if (r == null) { - // after retries exhausted print this log and return false - logger.debug("ConsistencyWriter: Highest global committed lsn received for write barrier call is {}", maxGlobalCommittedLsnReceived); - - return false; - } - return r; - }).toSingle(); - } - - static void getLsnAndGlobalCommittedLsn(StoreResponse response, Utils.ValueHolder lsn, Utils.ValueHolder globalCommittedLsn) { - lsn.v = -1l; - globalCommittedLsn.v = -1l; - - String headerValue; - - if ((headerValue = response.getHeaderValue(WFConstants.BackendHeaders.LSN)) != null) { - lsn.v = Long.parseLong(headerValue); - } - - if ((headerValue = response.getHeaderValue(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN)) != null) { - globalCommittedLsn.v = Long.parseLong(headerValue); - } - } - - void startBackgroundAddressRefresh(RxDocumentServiceRequest request) { - this.addressSelector.resolvePrimaryUriAsync(request, true) - .observeOn(Schedulers.io()) - .subscribe( - r -> { - }, - e -> logger.warn( - "Background refresh of the primary address failed with {}", e.getMessage(), e) - ); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/CustomHeaders.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/CustomHeaders.java deleted file mode 100644 index 8f3f3f8e7d6b..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/CustomHeaders.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -public final class CustomHeaders { - - public static final class HttpHeaders { - // Specify whether to exclude system properties while storing the document - public static final String EXCLUDE_SYSTEM_PROPERTIES = "x-ms-exclude-system-properties"; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ErrorUtils.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ErrorUtils.java deleted file mode 100644 index 5fdca7819b13..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ErrorUtils.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import io.netty.buffer.ByteBuf; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Observable; -import rx.Single; - -import java.net.URI; - -public class ErrorUtils { - private static final Logger logger = LoggerFactory.getLogger(TransportClient.class); - - protected static Single getErrorResponseAsync(HttpClientResponse responseMessage) { - - if (responseMessage.getContent() == null) { - return Single.just(StringUtils.EMPTY); - } - - return getErrorFromStream(responseMessage.getContent()); - } - - protected static Single getErrorFromStream(Observable stream) { - return ResponseUtils.toString(stream).toSingle(); - } - - protected static void logGoneException(URI physicalAddress, String activityId) { - logger.trace("Listener not found. Store Physical Address {} ActivityId {}", - physicalAddress, activityId); - } - - protected static void logGoneException(String physicalAddress, String activityId) { - logger.trace("Listener not found. Store Physical Address {} ActivityId {}", - physicalAddress, activityId); - } - - protected static void logException(URI physicalAddress, String activityId) { - logger.trace("Store Request Failed. Store Physical Address {} ActivityId {}", - physicalAddress, activityId); - } - - protected static void logException(String physicalAddress, String activityId) { - logger.trace("Store Request Failed. Store Physical Address {} ActivityId {}", - physicalAddress, activityId); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ForbiddenException.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ForbiddenException.java deleted file mode 100644 index d74feb5b911a..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ForbiddenException.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.net.URI; -import java.util.Map; - -public class ForbiddenException extends DocumentClientException { - public ForbiddenException() { - this(RMResources.Forbidden); - } - - public ForbiddenException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.FORBIDDEN, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public ForbiddenException(String message) { - this(message, (Exception) null, (HttpResponseHeaders) null, null); - } - - public ForbiddenException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public ForbiddenException(String message, HttpResponseHeaders headers, URI requestUri) { - this(message, headers, requestUri != null ? requestUri.toString() : null); - } - - public ForbiddenException(Exception innerException) { - this(RMResources.Forbidden, innerException, null, null); - } - - public ForbiddenException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - super(String.format("%s: %s", RMResources.Forbidden, message), - innerException, - HttpUtils.asMap(headers), - HttpConstants.StatusCodes.FORBIDDEN, - requestUri != null ? requestUri.toString() : null); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayAddressCache.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayAddressCache.java deleted file mode 100644 index 3e3053fa7841..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayAddressCache.java +++ /dev/null @@ -1,536 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.Paths; -import com.microsoft.azure.cosmosdb.internal.PathsHelper; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import com.microsoft.azure.cosmosdb.rx.internal.AuthorizationTokenType; -import com.microsoft.azure.cosmosdb.rx.internal.Exceptions; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; -import com.microsoft.azure.cosmosdb.rx.internal.caches.AsyncCache; -import io.netty.buffer.ByteBuf; -import io.reactivex.netty.client.RxClient; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.Pair; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Completable; -import rx.Observable; -import rx.Single; - -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.time.Duration; -import java.time.Instant; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.stream.Collectors; - -public class GatewayAddressCache implements IAddressCache { - private final static Logger logger = LoggerFactory.getLogger(GatewayAddressCache.class); - private final static String protocolFilterFormat = "%s eq %s"; - private final static int DefaultBatchSize = 50; - - private final static int DefaultSuboptimalPartitionForceRefreshIntervalInSeconds = 600; - private final ServiceConfig serviceConfig = ServiceConfig.getInstance(); - - private final String databaseFeedEntryUrl = PathsHelper.generatePath(ResourceType.Database, "", true); - private final URL serviceEndpoint; - private final URL addressEndpoint; - - private final AsyncCache serverPartitionAddressCache; - private final ConcurrentHashMap suboptimalServerPartitionTimestamps; - private final long suboptimalPartitionForceRefreshIntervalInSeconds; - - private final String protocolScheme; - private final String protocolFilter; - private final IAuthorizationTokenProvider tokenProvider; - private final HashMap defaultRequestHeaders; - private final CompositeHttpClient httpClient; - - private volatile Pair masterPartitionAddressCache; - private volatile Instant suboptimalMasterPartitionTimestamp; - - public GatewayAddressCache( - URL serviceEndpoint, - Protocol protocol, - IAuthorizationTokenProvider tokenProvider, - UserAgentContainer userAgent, - CompositeHttpClient httpClient, - long suboptimalPartitionForceRefreshIntervalInSeconds) { - try { - this.addressEndpoint = new URL(serviceEndpoint, Paths.ADDRESS_PATH_SEGMENT); - } catch (MalformedURLException e) { - logger.error("serviceEndpoint {} is invalid", serviceEndpoint, e); - assert false; - throw new IllegalStateException(e); - } - this.tokenProvider = tokenProvider; - this.serviceEndpoint = serviceEndpoint; - this.serverPartitionAddressCache = new AsyncCache<>(); - this.suboptimalServerPartitionTimestamps = new ConcurrentHashMap<>(); - this.suboptimalMasterPartitionTimestamp = Instant.MAX; - - this.suboptimalPartitionForceRefreshIntervalInSeconds = suboptimalPartitionForceRefreshIntervalInSeconds; - - this.protocolScheme = protocol.scheme(); - this.protocolFilter = String.format(GatewayAddressCache.protocolFilterFormat, - Constants.Properties.PROTOCOL, - this.protocolScheme); - - this.httpClient = httpClient; - - if (userAgent == null) { - userAgent = new UserAgentContainer(); - } - - defaultRequestHeaders = new HashMap<>(); - defaultRequestHeaders.put(HttpConstants.HttpHeaders.USER_AGENT, userAgent.getUserAgent()); - - // Set requested API version header for version enforcement. - defaultRequestHeaders.put(HttpConstants.HttpHeaders.VERSION, HttpConstants.Versions.CURRENT_VERSION); - } - - public GatewayAddressCache( - URL serviceEndpoint, - Protocol protocol, - IAuthorizationTokenProvider tokenProvider, - UserAgentContainer userAgent, - CompositeHttpClient httpClient) { - this(serviceEndpoint, - protocol, - tokenProvider, - userAgent, - httpClient, - DefaultSuboptimalPartitionForceRefreshIntervalInSeconds); - } - - private URL getServiceEndpoint() { - return this.serviceEndpoint; - } - - @Override - public Single tryGetAddresses(RxDocumentServiceRequest request, - PartitionKeyRangeIdentity partitionKeyRangeIdentity, - boolean forceRefreshPartitionAddresses) { - - com.microsoft.azure.cosmosdb.rx.internal.Utils.checkNotNullOrThrow(request, "request", ""); - com.microsoft.azure.cosmosdb.rx.internal.Utils.checkNotNullOrThrow(partitionKeyRangeIdentity, "partitionKeyRangeIdentity", ""); - - if (StringUtils.equals(partitionKeyRangeIdentity.getPartitionKeyRangeId(), - PartitionKeyRange.MASTER_PARTITION_KEY_RANGE_ID)) { - - // if that's master partition return master partition address! - return this.resolveMasterAsync(request, forceRefreshPartitionAddresses, request.properties).map(r -> r.getRight()); - } - - Instant suboptimalServerPartitionTimestamp = this.suboptimalServerPartitionTimestamps.get(partitionKeyRangeIdentity); - - if (suboptimalServerPartitionTimestamp != null) { - boolean forceRefreshDueToSuboptimalPartitionReplicaSet = Duration.between(suboptimalServerPartitionTimestamp, Instant.now()).getSeconds() - > this.suboptimalPartitionForceRefreshIntervalInSeconds; - - if (forceRefreshDueToSuboptimalPartitionReplicaSet) { - // Compares the existing value for the specified key with a specified value, - // and if they are equal, updates the key with a third value. - Instant newValue = this.suboptimalServerPartitionTimestamps.computeIfPresent(partitionKeyRangeIdentity, - (key, oldVal) -> { - if (suboptimalServerPartitionTimestamp.equals(oldVal)) { - return Instant.MAX; - } else { - return oldVal; - } - }); - - if (!newValue.equals(suboptimalServerPartitionTimestamp)) { - // the value was replaced; - forceRefreshPartitionAddresses = true; - } - } - } - - final boolean forceRefreshPartitionAddressesModified = forceRefreshPartitionAddresses; - - if (forceRefreshPartitionAddressesModified) { - this.serverPartitionAddressCache.refresh( - partitionKeyRangeIdentity, - () -> this.getAddressesForRangeId( - request, - partitionKeyRangeIdentity.getCollectionRid(), - partitionKeyRangeIdentity.getPartitionKeyRangeId(), - true)); - - this.suboptimalServerPartitionTimestamps.remove(partitionKeyRangeIdentity); - } - - Single addressesObs = this.serverPartitionAddressCache.getAsync( - partitionKeyRangeIdentity, - null, - () -> this.getAddressesForRangeId( - request, - partitionKeyRangeIdentity.getCollectionRid(), - partitionKeyRangeIdentity.getPartitionKeyRangeId(), - false)); - - return addressesObs.map( - addresses -> { - if (notAllReplicasAvailable(addresses)) { - this.suboptimalServerPartitionTimestamps.putIfAbsent(partitionKeyRangeIdentity, Instant.now()); - } - - return addresses; - }).onErrorResumeNext(ex -> { - DocumentClientException dce = com.microsoft.azure.cosmosdb.rx.internal.Utils.as(ex, DocumentClientException.class); - if (dce == null) { - if (forceRefreshPartitionAddressesModified) { - this.suboptimalServerPartitionTimestamps.remove(partitionKeyRangeIdentity); - } - return Single.error(ex); - } else { - assert dce != null; - if (Exceptions.isStatusCode(dce, HttpConstants.StatusCodes.NOTFOUND) || - Exceptions.isStatusCode(dce, HttpConstants.StatusCodes.GONE) || - Exceptions.isSubStatusCode(dce, HttpConstants.SubStatusCodes.PARTITION_KEY_RANGE_GONE)) { - //remove from suboptimal cache in case the collection+pKeyRangeId combo is gone. - this.suboptimalServerPartitionTimestamps.remove(partitionKeyRangeIdentity); - return null; - } - return Single.error(ex); - } - - }); - } - - Single> getServerAddressesViaGatewayAsync( - RxDocumentServiceRequest request, - String collectionRid, - List partitionKeyRangeIds, - boolean forceRefresh) { - String entryUrl = PathsHelper.generatePath(ResourceType.Document, collectionRid, true); - HashMap addressQuery = new HashMap<>(); - - addressQuery.put(HttpConstants.QueryStrings.URL, HttpUtils.urlEncode(entryUrl)); - - HashMap headers = new HashMap<>(defaultRequestHeaders); - if (forceRefresh) { - headers.put(HttpConstants.HttpHeaders.FORCE_REFRESH, Boolean.TRUE.toString()); - } - - addressQuery.put(HttpConstants.QueryStrings.FILTER, HttpUtils.urlEncode(this.protocolFilter)); - - addressQuery.put(HttpConstants.QueryStrings.PARTITION_KEY_RANGE_IDS, String.join(",", partitionKeyRangeIds)); - headers.put(HttpConstants.HttpHeaders.X_DATE, Utils.nowAsRFC1123()); - String token = null; - - token = this.tokenProvider.getUserAuthorizationToken( - collectionRid, - ResourceType.Document, - HttpConstants.HttpMethods.GET, - headers, - AuthorizationTokenType.PrimaryMasterKey, - request.properties); - - if (token == null && request.getIsNameBased()) { - // User doesn't have rid based resource token. Maybe user has name based. - String collectionAltLink = PathsHelper.getCollectionPath(request.getResourceAddress()); - token = this.tokenProvider.getUserAuthorizationToken( - collectionAltLink, - ResourceType.Document, - HttpConstants.HttpMethods.GET, - headers, - AuthorizationTokenType.PrimaryMasterKey, - request.properties); - } - - token = HttpUtils.urlEncode(token); - headers.put(HttpConstants.HttpHeaders.AUTHORIZATION, token); - URL targetEndpoint = Utils.setQuery(this.addressEndpoint.toString(), Utils.createQuery(addressQuery)); - String identifier = logAddressResolutionStart(request, targetEndpoint); - HttpClientRequest httpGet = HttpClientRequest.createGet(targetEndpoint.toString()); - - for (Map.Entry entry : headers.entrySet()) { - httpGet.withHeader(entry.getKey(), entry.getValue()); - } - - RxClient.ServerInfo serverInfo = new RxClient.ServerInfo(targetEndpoint.getHost(), targetEndpoint.getPort()); - Observable> responseObs = this.httpClient.submit(serverInfo, httpGet); - - Single dsrObs = responseObs.toSingle().flatMap(rsp -> - HttpClientUtils.parseResponseAsync(rsp)); - return dsrObs.map( - dsr -> { - logAddressResolutionEnd(request, identifier); - List

addresses = dsr.getQueryResponse(Address.class); - return addresses; - }); - } - - public void dispose() { - // TODO We will implement this in future once we will move to httpClient to CompositeHttpClient - //https://msdata.visualstudio.com/CosmosDB/_workitems/edit/340842 - } - - private Single> resolveMasterAsync(RxDocumentServiceRequest request, boolean forceRefresh, Map properties) { - Pair masterAddressAndRangeInitial = this.masterPartitionAddressCache; - - forceRefresh = forceRefresh || - (masterAddressAndRangeInitial != null && - notAllReplicasAvailable(masterAddressAndRangeInitial.getRight()) && - Duration.between(this.suboptimalMasterPartitionTimestamp, Instant.now()).getSeconds() > this.suboptimalPartitionForceRefreshIntervalInSeconds); - - if (forceRefresh || this.masterPartitionAddressCache == null) { - Single> masterReplicaAddressesObs = this.getMasterAddressesViaGatewayAsync( - request, - ResourceType.Database, - null, - databaseFeedEntryUrl, - forceRefresh, - false, - properties); - - return masterReplicaAddressesObs.map( - masterAddresses -> { - Pair masterAddressAndRangeRes = - this.toPartitionAddressAndRange("", masterAddresses); - this.masterPartitionAddressCache = masterAddressAndRangeRes; - - if (notAllReplicasAvailable(masterAddressAndRangeRes.getRight()) - && this.suboptimalMasterPartitionTimestamp.equals(Instant.MAX)) { - this.suboptimalMasterPartitionTimestamp = Instant.now(); - } else { - this.suboptimalMasterPartitionTimestamp = Instant.MAX; - } - - return masterPartitionAddressCache; - }) - .doOnError( - e -> { - this.suboptimalMasterPartitionTimestamp = Instant.MAX; - }); - } else { - if (notAllReplicasAvailable(masterAddressAndRangeInitial.getRight()) - && this.suboptimalMasterPartitionTimestamp.equals(Instant.MAX)) { - this.suboptimalMasterPartitionTimestamp = Instant.now(); - } - - return Single.just(masterAddressAndRangeInitial); - } - } - - private Single getAddressesForRangeId( - RxDocumentServiceRequest request, - String collectionRid, - String partitionKeyRangeId, - boolean forceRefresh) { - Single> addressResponse = this.getServerAddressesViaGatewayAsync(request, collectionRid, Collections.singletonList(partitionKeyRangeId), forceRefresh); - - Single>> addressInfos = - addressResponse.map( - addresses -> - addresses.stream().filter(addressInfo -> - this.protocolScheme.equals(addressInfo.getProtocolScheme())) - .collect(Collectors.groupingBy( - address -> address.getParitionKeyRangeId())) - .values().stream() - .map(groupedAddresses -> toPartitionAddressAndRange(collectionRid, addresses)) - .collect(Collectors.toList())); - - Single>> result = addressInfos.map(addressInfo -> addressInfo.stream() - .filter(a -> - StringUtils.equals(a.getLeft().getPartitionKeyRangeId(), partitionKeyRangeId)) - .collect(Collectors.toList())); - - return result.flatMap( - list -> { - if (list.isEmpty()) { - - String errorMessage = String.format( - RMResources.PartitionKeyRangeNotFound, - partitionKeyRangeId, - collectionRid); - - PartitionKeyRangeGoneException e = new PartitionKeyRangeGoneException(errorMessage); - BridgeInternal.setResourceAddress(e, collectionRid); - - return Single.error(e); - } else { - return Single.just(list.get(0).getRight()); - } - }); - } - - Single> getMasterAddressesViaGatewayAsync( - RxDocumentServiceRequest request, - ResourceType resourceType, - String resourceAddress, - String entryUrl, - boolean forceRefresh, - boolean useMasterCollectionResolver, - Map properties) { - HashMap queryParameters = new HashMap<>(); - queryParameters.put(HttpConstants.QueryStrings.URL, HttpUtils.urlEncode(entryUrl)); - HashMap headers = new HashMap<>(defaultRequestHeaders); - - if (forceRefresh) { - headers.put(HttpConstants.HttpHeaders.FORCE_REFRESH, Boolean.TRUE.toString()); - } - - if (useMasterCollectionResolver) { - headers.put(HttpConstants.HttpHeaders.USE_MASTER_COLLECTION_RESOLVER, Boolean.TRUE.toString()); - } - - queryParameters.put(HttpConstants.QueryStrings.FILTER, HttpUtils.urlEncode(this.protocolFilter)); - headers.put(HttpConstants.HttpHeaders.X_DATE, Utils.nowAsRFC1123()); - String token = this.tokenProvider.getUserAuthorizationToken( - resourceAddress, - resourceType, - HttpConstants.HttpMethods.GET, - headers, - AuthorizationTokenType.PrimaryMasterKey, - properties); - - headers.put(HttpConstants.HttpHeaders.AUTHORIZATION, HttpUtils.urlEncode(token)); - URL targetEndpoint = Utils.setQuery(this.addressEndpoint.toString(), Utils.createQuery(queryParameters)); - String identifier = logAddressResolutionStart(request, targetEndpoint); - HttpClientRequest httpGet = HttpClientRequest.createGet(targetEndpoint.toString()); - - for (Map.Entry entry : headers.entrySet()) { - httpGet.withHeader(entry.getKey(), entry.getValue()); - } - - RxClient.ServerInfo serverInfo = new RxClient.ServerInfo(targetEndpoint.getHost(), targetEndpoint.getPort()); - Observable> responseObs = this.httpClient.submit(serverInfo, httpGet); - - Single dsrObs = responseObs.toSingle().flatMap(rsp -> - HttpClientUtils.parseResponseAsync(rsp)); - return dsrObs.map( - dsr -> { - logAddressResolutionEnd(request, identifier); - List
addresses = dsr.getQueryResponse(Address.class); - return addresses; - }); - } - - private Pair toPartitionAddressAndRange(String collectionRid, List
addresses) { - Address address = addresses.get(0); - - AddressInformation[] addressInfos = - addresses.stream().map(addr -> - GatewayAddressCache.toAddressInformation(addr) - ).collect(Collectors.toList()).toArray(new AddressInformation[addresses.size()]); - return Pair.of(new PartitionKeyRangeIdentity(collectionRid, address.getParitionKeyRangeId()), addressInfos); - } - - private static AddressInformation toAddressInformation(Address address) { - return new AddressInformation(true, address.IsPrimary(), address.getPhyicalUri(), address.getProtocolScheme()); - } - - public Completable openAsync( - DocumentCollection collection, - List partitionKeyRangeIdentities) { - List>> tasks = new ArrayList<>(); - int batchSize = GatewayAddressCache.DefaultBatchSize; - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create( - OperationType.Read, - // collection.AltLink, - collection.getResourceId(), - ResourceType.DocumentCollection, - // AuthorizationTokenType.PrimaryMasterKey - Collections.EMPTY_MAP); - for (int i = 0; i < partitionKeyRangeIdentities.size(); i += batchSize) { - - int endIndex = i + batchSize; - endIndex = endIndex < partitionKeyRangeIdentities.size() - ? endIndex : partitionKeyRangeIdentities.size(); - - tasks.add(this.getServerAddressesViaGatewayAsync( - request, - collection.getResourceId(), - - partitionKeyRangeIdentities.subList(i, endIndex). - stream().map(range -> range.getPartitionKeyRangeId()).collect(Collectors.toList()), - false).toObservable()); - } - - return Observable.concat(tasks) - .doOnNext(list -> { - List> addressInfos = list.stream() - .filter(addressInfo -> this.protocolScheme.equals(addressInfo.getProtocolScheme())) - .collect(Collectors.groupingBy(address -> address.getParitionKeyRangeId())) - .entrySet().stream().map(group -> toPartitionAddressAndRange(collection.getResourceId(), group.getValue())) - .collect(Collectors.toList()); - - for (Pair addressInfo : addressInfos) { - this.serverPartitionAddressCache.set( - new PartitionKeyRangeIdentity(collection.getResourceId(), addressInfo.getLeft().getPartitionKeyRangeId()), - addressInfo.getRight()); - } - }).toCompletable(); - } - - private boolean notAllReplicasAvailable(AddressInformation[] addressInformations) { - return addressInformations.length < this.serviceConfig.userReplicationPolicy.MaxReplicaSetSize; - } - - private static String logAddressResolutionStart(RxDocumentServiceRequest request, URL targetEndpointUrl) { - try { - if (request.requestContext.clientSideRequestStatistics != null) { - return request.requestContext.clientSideRequestStatistics.recordAddressResolutionStart(targetEndpointUrl.toURI()); - } - } catch (URISyntaxException e) { - throw new IllegalArgumentException(e); - } - return null; - } - - private static void logAddressResolutionEnd(RxDocumentServiceRequest request, String identifier) { - if (request.requestContext.clientSideRequestStatistics != null) { - request.requestContext.clientSideRequestStatistics.recordAddressResolutionEnd(identifier); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayServiceConfigurationReader.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayServiceConfigurationReader.java deleted file mode 100644 index 8ce4417065d6..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayServiceConfigurationReader.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.lang3.StringUtils; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DatabaseAccount; -import com.microsoft.azure.cosmosdb.ReplicationPolicy; -import com.microsoft.azure.cosmosdb.internal.BaseAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.rx.internal.GlobalEndpointManager; - -import io.netty.buffer.ByteBuf; -import io.netty.handler.codec.http.HttpMethod; -import io.reactivex.netty.client.RxClient; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; -import rx.Observable; -import rx.Single; -import rx.functions.Action1; - -/** - * This class will read the service configuration from the gateway. - * - * As .Net does code sharing between the SDK and GW there are two implementation to IServiceConfigurationReader - * GatewayServiceConfigurationReader which is for SDK - * DatabaseAccountConfigurationReader which is for GW - * Some of the APIs are not relevant in SDK and due to that in .Net the SDK implementation one throws not-implemented. - * - * In java, as we don't do code sharing - * and we got rid of the interface which is not needed and only implemented the methods in GatewayServiceConfigurationReader - */ -public class GatewayServiceConfigurationReader { - - public static final String GATEWAY_READER_NOT_INITIALIZED = "GatewayServiceConfigurationReader has not been initialized"; - - public ReplicationPolicy userReplicationPolicy; - private ReplicationPolicy systemReplicationPolicy; - private ConsistencyLevel consistencyLevel; - private volatile boolean initialized; - private URI serviceEndpoint; - private final ConnectionPolicy connectionPolicy; - private Map queryEngineConfiguration; - private final BaseAuthorizationTokenProvider baseAuthorizationTokenProvider; - private final boolean hasAuthKeyResourceToken; - private final String authKeyResourceToken; - private CompositeHttpClient httpClient; - - public GatewayServiceConfigurationReader(URI serviceEndpoint, boolean hasResourceToken, String resourceToken, - ConnectionPolicy connectionPolicy, BaseAuthorizationTokenProvider baseAuthorizationTokenProvider, - CompositeHttpClient httpClient) { - this.serviceEndpoint = serviceEndpoint; - this.baseAuthorizationTokenProvider = baseAuthorizationTokenProvider; - this.hasAuthKeyResourceToken = hasResourceToken; - this.authKeyResourceToken = resourceToken; - this.connectionPolicy = connectionPolicy; - this.httpClient = httpClient; - } - - public ReplicationPolicy getUserReplicationPolicy() { - this.throwIfNotInitialized(); - return this.userReplicationPolicy; - } - - public ReplicationPolicy getSystemReplicationPolicy() { - this.throwIfNotInitialized(); - return this.systemReplicationPolicy; - } - - public boolean enableAuthorization() { - return true; - } - - public ConsistencyLevel getDefaultConsistencyLevel() { - this.throwIfNotInitialized(); - return this.consistencyLevel; - } - - public void setDefaultConsistencyLevel(ConsistencyLevel value) { - this.throwIfNotInitialized(); - this.consistencyLevel = value; - } - - public Map getQueryEngineConfiguration() { - this.throwIfNotInitialized(); - return this.queryEngineConfiguration; - } - - private Single getDatabaseAccountAsync(URI serviceEndpoint) { - HttpClientRequest httpRequest = HttpClientRequest.create(HttpMethod.GET, - this.serviceEndpoint.toString()); - - httpRequest.withHeader(HttpConstants.HttpHeaders.VERSION, HttpConstants.Versions.CURRENT_VERSION); - - UserAgentContainer userAgentContainer = new UserAgentContainer(); - String userAgentSuffix = this.connectionPolicy.getUserAgentSuffix(); - if (userAgentSuffix != null && userAgentSuffix.length() > 0) { - userAgentContainer.setSuffix(userAgentSuffix); - } - - httpRequest.withHeader(HttpConstants.HttpHeaders.USER_AGENT, userAgentContainer.getUserAgent()); - httpRequest.withHeader(HttpConstants.HttpHeaders.API_TYPE, Constants.Properties.SQL_API_TYPE); - String authorizationToken = StringUtils.EMPTY; - if (this.hasAuthKeyResourceToken || baseAuthorizationTokenProvider == null) { - authorizationToken = HttpUtils.urlEncode(this.authKeyResourceToken); - } else { - // Retrieve the document service properties. - String xDate = Utils.nowAsRFC1123(); - httpRequest.withHeader(HttpConstants.HttpHeaders.X_DATE, xDate); - Map header = new HashMap<>(); - header.put(HttpConstants.HttpHeaders.X_DATE, xDate); - authorizationToken = baseAuthorizationTokenProvider - .generateKeyAuthorizationSignature(HttpConstants.HttpMethods.GET, serviceEndpoint, header); - } - - httpRequest.withHeader(HttpConstants.HttpHeaders.AUTHORIZATION, authorizationToken); - RxClient.ServerInfo serverInfo = new RxClient.ServerInfo(serviceEndpoint.getHost(), serviceEndpoint.getPort()); - - Observable> clientResponseObservable = this.httpClient.submit(serverInfo, - httpRequest); - return toDatabaseAccountObservable(clientResponseObservable.toSingle()); - } - - public Single initializeReaderAsync() { - try { - return GlobalEndpointManager.getDatabaseAccountFromAnyLocationsAsync(this.serviceEndpoint.toURL(), - - new ArrayList<>(this.connectionPolicy.getPreferredLocations()), url -> { - try { - return getDatabaseAccountAsync(url.toURI()); - } catch (URISyntaxException e) { - throw new IllegalArgumentException("URI " + url); - } - }).doOnSuccess(new Action1() { - - @Override - public void call(DatabaseAccount databaseAccount) { - userReplicationPolicy = BridgeInternal.getReplicationPolicy(databaseAccount); - systemReplicationPolicy = BridgeInternal.getSystemReplicationPolicy(databaseAccount); - queryEngineConfiguration = BridgeInternal.getQueryEngineConfiuration(databaseAccount); - consistencyLevel = BridgeInternal.getConsistencyPolicy(databaseAccount).getDefaultConsistencyLevel(); - initialized = true; - } - }); - } catch (MalformedURLException e) { - throw new IllegalArgumentException(this.serviceEndpoint.toString(), e); - } - } - - private Single toDatabaseAccountObservable( - Single> clientResponseObservable) { - return clientResponseObservable.flatMap(clientResponse -> { - return HttpClientUtils.parseResponseAsync(clientResponse) - .map(rxDocumentServiceResponse -> rxDocumentServiceResponse.getResource(DatabaseAccount.class)); - }); - } - - private void throwIfNotInitialized() { - if (!this.initialized) { - throw new IllegalArgumentException(GATEWAY_READER_NOT_INITIALIZED); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GoneAndRetryWithRetryPolicy.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GoneAndRetryWithRetryPolicy.java deleted file mode 100644 index 3f519231d16f..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GoneAndRetryWithRetryPolicy.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import java.time.Duration; - -import org.apache.commons.lang3.time.StopWatch; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.Quadruple; -import com.microsoft.azure.cosmosdb.rx.internal.IDocumentClientRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.IRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.InvalidPartitionException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionIsMigratingException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionKeyRangeIsSplittingException; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; - -import rx.Single; - -public class GoneAndRetryWithRetryPolicy implements IRetryPolicy { - - private final static Logger logger = LoggerFactory.getLogger(GoneAndRetryWithRetryPolicy.class); - private final static int DEFAULT_WAIT_TIME_IN_SECONDS = 30; - private final static int MAXIMUM_BACKOFF_TIME_IN_SECONDS = 15; - private final static int INITIAL_BACKOFF_TIME = 1; - private final static int BACK_OFF_MULTIPLIER = 2; - - private final RxDocumentServiceRequest request; - private volatile int attemptCount = 1; - private volatile int attemptCountInvalidPartition = 1; - private volatile int currentBackoffSeconds = GoneAndRetryWithRetryPolicy.INITIAL_BACKOFF_TIME; - private volatile RetryWithException lastRetryWithException; - private final StopWatch durationTimer = new StopWatch(); - private final int waitTimeInSeconds; - //TODO once this is moved to IRetryPolicy, remove from here. - public static Quadruple INITIAL_ARGUMENT_VALUE_POLICY_ARG = Quadruple.with(false, false, - Duration.ofSeconds(60), 0); - - public GoneAndRetryWithRetryPolicy(RxDocumentServiceRequest request, Integer waitTimeInSeconds) { - this.request = request; - startStopWatch(this.durationTimer); - if (waitTimeInSeconds != null) { - this.waitTimeInSeconds = waitTimeInSeconds; - } else { - this.waitTimeInSeconds = DEFAULT_WAIT_TIME_IN_SECONDS; - } - } - - @Override - public Single shouldRetry(Exception exception) { - DocumentClientException exceptionToThrow = null; - Duration backoffTime = Duration.ofSeconds(0); - Duration timeout = Duration.ofSeconds(0); - boolean forceRefreshAddressCache = false; - if (!(exception instanceof GoneException) && - !(exception instanceof RetryWithException) && - !(exception instanceof PartitionIsMigratingException) && - !(exception instanceof InvalidPartitionException && - (this.request.getPartitionKeyRangeIdentity() == null || - this.request.getPartitionKeyRangeIdentity().getCollectionRid() == null)) && - !(exception instanceof PartitionKeyRangeIsSplittingException)) { - logger.debug("Operation will NOT be retried. Current attempt {}, Exception: {} ", this.attemptCount, - exception); - stopStopWatch(this.durationTimer); - return Single.just(ShouldRetryResult.noRetry()); - } else if (exception instanceof RetryWithException) { - this.lastRetryWithException = (RetryWithException) exception; - } - long remainingSeconds = this.waitTimeInSeconds - this.durationTimer.getTime() / 1000; - int currentRetryAttemptCount = this.attemptCount; - if (this.attemptCount++ > 1) { - if (remainingSeconds <= 0) { - if (exception instanceof GoneException) { - if (this.lastRetryWithException != null) { - logger.warn( - "Received gone exception after backoff/retry including at least one RetryWithException. " - + "Will fail the request with RetryWithException. GoneException: {}. RetryWithException: {}", - exception, this.lastRetryWithException); - exceptionToThrow = this.lastRetryWithException; - } else { - logger.warn("Received gone exception after backoff/retry. Will fail the request. {}", - exception.toString()); - exceptionToThrow = new DocumentClientException(HttpConstants.StatusCodes.SERVICE_UNAVAILABLE, - exception); - } - - } else if (exception instanceof PartitionKeyRangeGoneException) { - if (this.lastRetryWithException != null) { - logger.warn( - "Received partition key range gone exception after backoff/retry including at least one RetryWithException." - + "Will fail the request with RetryWithException. GoneException: {}. RetryWithException: {}", - exception, this.lastRetryWithException); - exceptionToThrow = this.lastRetryWithException; - } else { - logger.warn( - "Received partition key range gone exception after backoff/retry. Will fail the request. {}", - exception.toString()); - exceptionToThrow = new DocumentClientException(HttpConstants.StatusCodes.SERVICE_UNAVAILABLE, - exception); - } - } else if (exception instanceof InvalidPartitionException) { - if (this.lastRetryWithException != null) { - logger.warn( - "Received InvalidPartitionException after backoff/retry including at least one RetryWithException. " - + "Will fail the request with RetryWithException. InvalidPartitionException: {}. RetryWithException: {}", - exception, this.lastRetryWithException); - } else { - logger.warn( - "Received invalid collection partition exception after backoff/retry. Will fail the request. {}", - exception.toString()); - exceptionToThrow = new DocumentClientException(HttpConstants.StatusCodes.SERVICE_UNAVAILABLE, - exception); - } - } else { - logger.warn("Received retrywith exception after backoff/retry. Will fail the request. {}", - exception.toString()); - } - stopStopWatch(this.durationTimer); - return Single.just(ShouldRetryResult.error(exceptionToThrow)); - } - backoffTime = Duration.ofSeconds(Math.min(Math.min(this.currentBackoffSeconds, remainingSeconds), - GoneAndRetryWithRetryPolicy.MAXIMUM_BACKOFF_TIME_IN_SECONDS)); - this.currentBackoffSeconds *= GoneAndRetryWithRetryPolicy.BACK_OFF_MULTIPLIER; - logger.info("BackoffTime: {} seconds.", backoffTime.getSeconds()); - } - - // Calculate the remaining time based after accounting for the backoff that we - // will perform - long timeoutInMillSec = remainingSeconds*1000 - backoffTime.toMillis(); - timeout = timeoutInMillSec > 0 ? Duration.ofMillis(timeoutInMillSec) - : Duration.ofSeconds(GoneAndRetryWithRetryPolicy.MAXIMUM_BACKOFF_TIME_IN_SECONDS); - if (exception instanceof GoneException) { - logger.warn("Received gone exception, will retry, {}", exception.toString()); - forceRefreshAddressCache = true; // indicate we are in retry. - } else if (exception instanceof PartitionIsMigratingException) { - logger.warn("Received PartitionIsMigratingException, will retry, {}", exception.toString()); - this.request.forceCollectionRoutingMapRefresh = true; - forceRefreshAddressCache = true; - } else if (exception instanceof InvalidPartitionException) { - this.request.requestContext.quorumSelectedLSN = -1; - this.request.requestContext.resolvedPartitionKeyRange = null; - this.request.requestContext.quorumSelectedStoreResponse = null; - this.request.requestContext.globalCommittedSelectedLSN = -1; - if (this.attemptCountInvalidPartition++ > 2) { - // for second InvalidPartitionException, stop retrying. - logger.warn("Received second InvalidPartitionException after backoff/retry. Will fail the request. {}", - exception.toString()); - return Single.just(ShouldRetryResult - .error(new DocumentClientException(HttpConstants.StatusCodes.SERVICE_UNAVAILABLE, exception))); - } - - if (this.request != null) { - logger.warn("Received invalid collection exception, will retry, {}", exception.toString()); - this.request.forceNameCacheRefresh = true; - } else { - logger.error("Received unexpected invalid collection exception, request should be non-null.", - exception); - return Single.just(ShouldRetryResult - .error(new DocumentClientException(HttpConstants.StatusCodes.INTERNAL_SERVER_ERROR, exception))); - } - forceRefreshAddressCache = false; - } else if (exception instanceof PartitionKeyRangeIsSplittingException) { - this.request.requestContext.resolvedPartitionKeyRange = null; - this.request.requestContext.quorumSelectedLSN = -1; - this.request.requestContext.quorumSelectedStoreResponse = null; - logger.info("Received partition key range splitting exception, will retry, {}", exception.toString()); - this.request.forcePartitionKeyRangeRefresh = true; - forceRefreshAddressCache = false; - } else { - logger.warn("Received retrywith exception, will retry, {}", exception); - // For RetryWithException, prevent the caller - // from refreshing any caches. - forceRefreshAddressCache = false; - } - return Single.just(ShouldRetryResult.retryAfter(backoffTime, - Quadruple.with(forceRefreshAddressCache, true, timeout, currentRetryAttemptCount))); - } - - private void stopStopWatch(StopWatch stopwatch) { - synchronized (stopwatch) { - stopwatch.stop(); - } - } - - private void startStopWatch(StopWatch stopwatch) { - synchronized (stopwatch) { - stopwatch.start(); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpClientUtils.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpClientUtils.java deleted file mode 100644 index 29e329d17cbd..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpClientUtils.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; -import io.netty.buffer.ByteBuf; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; -import rx.Single; - -public class HttpClientUtils { - - public static Single parseResponseAsync(HttpClientResponse responseMessage) { - - if (responseMessage.getStatus().code() < HttpConstants.StatusCodes.MINIMUM_STATUSCODE_AS_ERROR_GATEWAY) { - - Single storeResponse = ResponseUtils.toStoreResponse(responseMessage); - return storeResponse.map(sr -> new RxDocumentServiceResponse(sr)); - - // TODO: to break the dependency between RxDocumentServiceResponse and StoreResponse - // we should factor out the RxDocumentServiceResponse(StoreResponse) constructor to a helper class - - } else { - return HttpClientUtils.createDocumentClientException(responseMessage).flatMap(e -> Single.error(e)); - } - } - - private static Single createDocumentClientException(HttpClientResponse responseMessage) { - Single readStream = ResponseUtils.toString(responseMessage.getContent()).toSingle(); - - return readStream.map(body -> { - Error error = new Error(body); - - // TODO: we should set resource address in the Document Client Exception - - return new DocumentClientException(responseMessage.getStatus().code(), error, - HttpUtils.asMap(responseMessage.getHeaders())); - }); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpTransportClient.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpTransportClient.java deleted file mode 100644 index 5e7a354480c5..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpTransportClient.java +++ /dev/null @@ -1,986 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.Integers; -import com.microsoft.azure.cosmosdb.internal.InternalServerErrorException; -import com.microsoft.azure.cosmosdb.internal.Lists; -import com.microsoft.azure.cosmosdb.internal.Longs; -import com.microsoft.azure.cosmosdb.internal.MutableVolatile; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.PathsHelper; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.RuntimeConstants; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.HttpClientFactory; -import com.microsoft.azure.cosmosdb.rx.internal.InvalidPartitionException; -import com.microsoft.azure.cosmosdb.rx.internal.NotFoundException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionIsMigratingException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionKeyRangeIsSplittingException; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import io.netty.buffer.ByteBuf; -import io.netty.handler.codec.http.HttpMethod; -import io.netty.handler.codec.http.HttpResponseStatus; -import io.reactivex.netty.client.RxClient; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; -import io.reactivex.netty.protocol.http.client.HttpRequestHeaders; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Single; - -import java.net.URI; -import java.time.Instant; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import static com.microsoft.azure.cosmosdb.internal.Utils.trimBeginningAndEndingSlashes; -/* - * The following code only support Document Write without any error handling support. - */ -public class HttpTransportClient extends TransportClient { - private final Logger logger = LoggerFactory.getLogger(HttpTransportClient.class); - private final CompositeHttpClient httpClient; - private final Map defaultHeaders; - private final Configs configs; - - CompositeHttpClient createHttpClient(int requestTimeout) { - // TODO: use one instance of SSL context everywhere - HttpClientFactory httpClientFactory = new HttpClientFactory(this.configs); - httpClientFactory.withRequestTimeoutInMillis(requestTimeout * 1000); - httpClientFactory.withPoolSize(configs.getDirectHttpsMaxConnectionLimit()); - - return httpClientFactory.toHttpClientBuilder().build(); - } - - public HttpTransportClient(Configs configs, int requestTimeout, UserAgentContainer userAgent) { - this.configs = configs; - this.httpClient = createHttpClient(requestTimeout); - - this.defaultHeaders = new HashMap<>(); - - // Set requested API version header for version enforcement. - this.defaultHeaders.put(HttpConstants.HttpHeaders.VERSION, HttpConstants.Versions.CURRENT_VERSION); - this.defaultHeaders.put(HttpConstants.HttpHeaders.CACHE_CONTROL, HttpConstants.HeaderValues.NoCache); - - if (userAgent == null) { - userAgent = new UserAgentContainer(); - } - - this.defaultHeaders.put(HttpConstants.HttpHeaders.USER_AGENT, userAgent.getUserAgent()); - this.defaultHeaders.put(HttpConstants.HttpHeaders.ACCEPT, RuntimeConstants.MediaTypes.JSON); - } - - @Override - public void close() { - httpClient.shutdown(); - } - - public Single invokeStoreAsync( - URI physicalAddress, - ResourceOperation resourceOperation, - RxDocumentServiceRequest request) { - - try { - - // uuid correlation manager - UUID activityId = UUID.fromString(request.getActivityId()); - - if (resourceOperation.operationType == OperationType.Recreate) { - Map errorResponseHeaders = new HashMap<>(); - errorResponseHeaders.put(HttpConstants.HttpHeaders.REQUEST_VALIDATION_FAILURE, "1"); - - logger.error("Received Recreate request on Http client"); - throw new InternalServerErrorException(RMResources.InternalServerError, null, errorResponseHeaders, null); - } - - HttpClientRequest httpRequest = prepareHttpMessage(activityId, physicalAddress, resourceOperation, request); - RxClient.ServerInfo serverInfo = new RxClient.ServerInfo(physicalAddress.getHost(), physicalAddress.getPort()); - - MutableVolatile sendTimeUtc = new MutableVolatile<>(); - - Single> responseMessage = this.httpClient.submit(serverInfo, httpRequest).toSingle(); - responseMessage = responseMessage.doOnSubscribe(() -> { - sendTimeUtc.v = Instant.now(); - this.beforeRequest( - activityId, - httpRequest.getUri(), - request.getResourceType(), - httpRequest.getHeaders()); - }); - - responseMessage = responseMessage.onErrorResumeNext(t -> { - - Exception exception = Utils.as(t, Exception.class); - if (exception == null) { - logger.error("critical failure", t); - t.printStackTrace(); - assert false : "critical failure"; - return Single.error(t); - } - - //Trace.CorrelationManager.ActivityId = activityId; - if (WebExceptionUtility.isWebExceptionRetriable(exception)) { - logger.debug("Received retriable exception {} " + - "sending the request to {}, will re-resolve the address " + - "send time UTC: {}", - exception, - physicalAddress, - sendTimeUtc); - - GoneException goneException = new GoneException( - String.format( - RMResources.ExceptionMessage, - RMResources.Gone), - exception, - null, - physicalAddress); - - return Single.error(goneException); - } else if (request.isReadOnlyRequest()) { - logger.trace("Received exception {} on readonly request" + - "sending the request to {}, will reresolve the address " + - "send time UTC: {}", - exception, - physicalAddress, - sendTimeUtc); - - GoneException goneException = new GoneException( - String.format( - RMResources.ExceptionMessage, - RMResources.Gone), - exception, - null, - physicalAddress); - - return Single.error(goneException); - } else { - // We can't throw a GoneException here because it will cause retry and we don't - // know if the request failed before or after the message got sent to the server. - // So in order to avoid duplicating the request we will not retry. - // TODO: a possible solution for this is to add the ability to send a request to the server - // to check if the previous request was received or not and act accordingly. - ServiceUnavailableException serviceUnavailableException = new ServiceUnavailableException( - String.format( - RMResources.ExceptionMessage, - RMResources.ServiceUnavailable), - exception, - null, - physicalAddress.toString()); - serviceUnavailableException.getResponseHeaders().put(HttpConstants.HttpHeaders.REQUEST_VALIDATION_FAILURE, "1"); - serviceUnavailableException.getResponseHeaders().put(HttpConstants.HttpHeaders.WRITE_REQUEST_TRIGGER_ADDRESS_REFRESH, "1"); - return Single.error(serviceUnavailableException); - } - }).doOnSuccess(httpClientResponse -> { - Instant receivedTimeUtc = Instant.now(); - double durationInMilliSeconds = (receivedTimeUtc.toEpochMilli() - sendTimeUtc.v.toEpochMilli()); - this.afterRequest( - activityId, - httpClientResponse.getStatus().code() , - durationInMilliSeconds, - httpClientResponse.getHeaders()); - }).doOnError( e -> { - Instant receivedTimeUtc = Instant.now(); - double durationInMilliSeconds = (receivedTimeUtc.toEpochMilli() - sendTimeUtc.v.toEpochMilli()); - this.afterRequest( - activityId, - 0, - durationInMilliSeconds, - null); - }); - - return responseMessage.flatMap(rsp -> processHttpResponse(request.getResourceAddress(), httpRequest, activityId.toString(), rsp, physicalAddress)); - - } catch (Exception e) { - // TODO improve on exception catching - return Single.error(e); - } - } - - private void beforeRequest(UUID activityId, String uri, ResourceType resourceType, HttpRequestHeaders requestHeaders) { - // TODO: perf counters - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/258624 - } - - private void afterRequest(UUID activityId, - int statusCode, - double durationInMilliSeconds, - HttpResponseHeaders responseHeaders) { - // TODO: perf counters - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/258624 - } - - private static void addHeader(HttpRequestHeaders requestHeaders, String headerName, RxDocumentServiceRequest request) { - String headerValue = request.getHeaders().get(headerName); - if (!Strings.isNullOrEmpty(headerValue)) { - requestHeaders.add(headerName, headerValue); - } - } - - private static void addHeader(HttpRequestHeaders requestHeaders, String headerName, String headerValue) { - if (!Strings.isNullOrEmpty(headerValue)) { - requestHeaders.add(headerName, headerValue); - } - } - - private String GetMatch(RxDocumentServiceRequest request, ResourceOperation resourceOperation) { - switch (resourceOperation.operationType) { - case Delete: - case ExecuteJavaScript: - case Replace: - case Update: - case Upsert: - return request.getHeaders().get(HttpConstants.HttpHeaders.IF_MATCH); - - case Read: - case ReadFeed: - return request.getHeaders().get(HttpConstants.HttpHeaders.IF_NONE_MATCH); - - default: - return null; - } - } - - private HttpClientRequest prepareHttpMessage( - UUID activityId, - URI physicalAddress, - ResourceOperation resourceOperation, - RxDocumentServiceRequest request) throws Exception { - - HttpClientRequest httpRequestMessage = null; - URI requestUri; - HttpMethod method; - - // The StreamContent created below will own and dispose its underlying stream, but we may need to reuse the stream on the - // RxDocumentServiceRequest for future requests. Hence we need to clone without incurring copy cost, so that when - // HttpRequestMessage -> StreamContent -> MemoryStream all get disposed, the original stream will be left open. - switch (resourceOperation.operationType) { - case Create: - requestUri = this.getResourceFeedUri(resourceOperation.resourceType, physicalAddress, request); - method = HttpMethod.POST; - assert request.getContent() != null; - httpRequestMessage = HttpClientRequest.create(method, requestUri.toString()); - httpRequestMessage.withContent(request.getContent()); - break; - - case ExecuteJavaScript: - requestUri = this.getResourceEntryUri(resourceOperation.resourceType, physicalAddress, request); - method = HttpMethod.POST; - assert request.getContent() != null; - httpRequestMessage = HttpClientRequest.create(method, requestUri.toString()); - httpRequestMessage.withContent(request.getContent()); - break; - - case Delete: - requestUri = this.getResourceEntryUri(resourceOperation.resourceType, physicalAddress, request); - method = HttpMethod.DELETE; - httpRequestMessage = HttpClientRequest.create(method, requestUri.toString()); - break; - - case Read: - requestUri = this.getResourceEntryUri(resourceOperation.resourceType, physicalAddress, request); - method = HttpMethod.GET; - httpRequestMessage = HttpClientRequest.create(method, requestUri.toString()); - break; - - case ReadFeed: - requestUri = this.getResourceFeedUri(resourceOperation.resourceType, physicalAddress, request); - method = HttpMethod.GET; - httpRequestMessage = HttpClientRequest.create(method, requestUri.toString()); - break; - - case Replace: - requestUri = this.getResourceEntryUri(resourceOperation.resourceType, physicalAddress, request); - method = HttpMethod.PUT; - assert request.getContent() != null; - httpRequestMessage = HttpClientRequest.create(method, requestUri.toString()); - httpRequestMessage.withContent(request.getContent()); - break; - - case Update: - requestUri = this.getResourceEntryUri(resourceOperation.resourceType, physicalAddress, request); - method = new HttpMethod("PATCH"); - assert request.getContent() != null; - httpRequestMessage = HttpClientRequest.create(method, requestUri.toString()); - httpRequestMessage.withContent(request.getContent()); - break; - - case Query: - case SqlQuery: - requestUri = this.getResourceFeedUri(resourceOperation.resourceType, physicalAddress, request); - method = HttpMethod.POST; - assert request.getContent() != null; - httpRequestMessage = HttpClientRequest.create(method, requestUri.toString()); - httpRequestMessage.withContent(request.getContent()); - HttpTransportClient.addHeader(httpRequestMessage.getHeaders(), HttpConstants.HttpHeaders.CONTENT_TYPE, request); - break; - - case Upsert: - requestUri = this.getResourceFeedUri(resourceOperation.resourceType, physicalAddress, request); - method = HttpMethod.POST; - assert request.getContent() != null; - httpRequestMessage = HttpClientRequest.create(method, requestUri.toString()); - httpRequestMessage.withContent(request.getContent()); - break; - - case Head: - requestUri = this.getResourceEntryUri(resourceOperation.resourceType, physicalAddress, request); - method = HttpMethod.HEAD; - httpRequestMessage = HttpClientRequest.create(method, requestUri.toString()); - break; - - case HeadFeed: - requestUri = this.getResourceFeedUri(resourceOperation.resourceType, physicalAddress, request); - method = HttpMethod.HEAD; - httpRequestMessage = HttpClientRequest.create(method, requestUri.toString()); - break; - - default: - assert false : "Unsupported operation type"; - throw new IllegalStateException(); - } - - Map documentServiceRequestHeaders = request.getHeaders(); - HttpRequestHeaders httpRequestHeaders = httpRequestMessage.getHeaders(); - - // add default headers - for(Map.Entry entry: defaultHeaders.entrySet()) { - HttpTransportClient.addHeader(httpRequestHeaders, entry.getKey(), entry.getValue()); - } - - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.VERSION, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.USER_AGENT, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.PAGE_SIZE, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.PRE_TRIGGER_INCLUDE, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.PRE_TRIGGER_EXCLUDE, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.POST_TRIGGER_INCLUDE, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.POST_TRIGGER_EXCLUDE, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.AUTHORIZATION, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.INDEXING_DIRECTIVE, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.MIGRATE_COLLECTION_DIRECTIVE, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.SESSION_TOKEN, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.PREFER, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.RESOURCE_TOKEN_EXPIRY, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.ENABLE_SCAN_IN_QUERY, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.EMIT_VERBOSE_TRACES_IN_QUERY, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.CAN_CHARGE, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.CAN_THROTTLE, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.ENABLE_LOW_PRECISION_ORDER_BY, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.ENABLE_LOGGING, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.IS_READ_ONLY_SCRIPT, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.CONTENT_SERIALIZATION_FORMAT, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.CONTINUATION, request.getContinuation()); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.ACTIVITY_ID, activityId.toString()); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.PARTITION_KEY, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.PARTITION_KEY_RANGE_ID, request); - - String dateHeader = HttpUtils.getDateHeader(documentServiceRequestHeaders); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.X_DATE, dateHeader); - HttpTransportClient.addHeader(httpRequestHeaders, "Match", this.GetMatch(request, resourceOperation)); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.IF_MODIFIED_SINCE, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.A_IM, request); - if (!request.getIsNameBased()) { - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.RESOURCE_ID, request.getResourceId()); - } - - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.ENTITY_ID, request.entityId); - - String fanoutRequestHeader = request.getHeaders().get(WFConstants.BackendHeaders.IS_FANOUT_REQUEST); - HttpTransportClient.addHeader(httpRequestMessage.getHeaders(), WFConstants.BackendHeaders.IS_FANOUT_REQUEST, fanoutRequestHeader); - - if (request.getResourceType() == ResourceType.DocumentCollection) { - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.COLLECTION_PARTITION_INDEX, documentServiceRequestHeaders.get(WFConstants.BackendHeaders.COLLECTION_PARTITION_INDEX)); - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.COLLECTION_SERVICE_INDEX, documentServiceRequestHeaders.get(WFConstants.BackendHeaders.COLLECTION_SERVICE_INDEX)); - } - - if (documentServiceRequestHeaders.get(WFConstants.BackendHeaders.BIND_REPLICA_DIRECTIVE) != null) { - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.BIND_REPLICA_DIRECTIVE, documentServiceRequestHeaders.get(WFConstants.BackendHeaders.BIND_REPLICA_DIRECTIVE)); - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.PRIMARY_MASTER_KEY, documentServiceRequestHeaders.get(WFConstants.BackendHeaders.PRIMARY_MASTER_KEY)); - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.SECONDARY_MASTER_KEY, documentServiceRequestHeaders.get(WFConstants.BackendHeaders.SECONDARY_MASTER_KEY)); - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.PRIMARY_READONLY_KEY, documentServiceRequestHeaders.get(WFConstants.BackendHeaders.PRIMARY_READONLY_KEY)); - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.SECONDARY_READONLY_KEY, documentServiceRequestHeaders.get(WFConstants.BackendHeaders.SECONDARY_READONLY_KEY)); - } - - if (documentServiceRequestHeaders.get(HttpConstants.HttpHeaders.CAN_OFFER_REPLACE_COMPLETE) != null) { - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.CAN_OFFER_REPLACE_COMPLETE, documentServiceRequestHeaders.get(HttpConstants.HttpHeaders.CAN_OFFER_REPLACE_COMPLETE)); - } - - //Query - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.IS_QUERY, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.QUERY, request); - - // Upsert - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.IS_UPSERT, request); - - // SupportSpatialLegacyCoordinates - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.SUPPORT_SPATIAL_LEGACY_COORDINATES, request); - - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.PARTITION_COUNT, request); - - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.COLLECTION_RID, request); - - // Filter by schema - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.FILTER_BY_SCHEMA_RESOURCE_ID, request); - - // UsePolygonsSmallerThanAHemisphere - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.USE_POLYGONS_SMALLER_THAN_AHEMISPHERE, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.GATEWAY_SIGNATURE, request); - - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.POPULATE_QUOTA_INFO, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.POPULATE_QUERY_METRICS, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.FORCE_QUERY_SCAN, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.RESPONSE_CONTINUATION_TOKEN_LIMIT_IN_KB, request); - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.REMOTE_STORAGE_TYPE, request); - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.SHARE_THROUGHPUT, request); - - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.POPULATE_PARTITION_STATISTICS, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.POPULATE_COLLECTION_THROUGHPUT_INFO, request); - - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.REMAINING_TIME_IN_MS_ON_CLIENT_REQUEST, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.CLIENT_RETRY_ATTEMPT_COUNT, request); - - // target lsn for head requests. - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.TARGET_LSN, request); - HttpTransportClient.addHeader(httpRequestHeaders, HttpConstants.HttpHeaders.TARGET_GLOBAL_COMMITTED_LSN, request); - - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.FEDERATION_ID_FOR_AUTH, request); - - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.FANOUT_OPERATION_STATE, request); - HttpTransportClient.addHeader(httpRequestHeaders, WFConstants.BackendHeaders.ALLOW_TENTATIVE_WRITES, request); - - HttpTransportClient.addHeader(httpRequestHeaders, CustomHeaders.HttpHeaders.EXCLUDE_SYSTEM_PROPERTIES, request); - - return httpRequestMessage; - } - - static URI getResourceFeedUri(ResourceType resourceType, URI physicalAddress, RxDocumentServiceRequest request) throws Exception { - switch (resourceType) { - case Attachment: - return getAttachmentFeedUri(physicalAddress, request); - case DocumentCollection: - return getCollectionFeedUri(physicalAddress, request); - case Conflict: - return getConflictFeedUri(physicalAddress, request); - case Database: - return getDatabaseFeedUri(physicalAddress); - case Document: - return getDocumentFeedUri(physicalAddress, request); - case Permission: - return getPermissionFeedUri(physicalAddress, request); - case StoredProcedure: - return getStoredProcedureFeedUri(physicalAddress, request); - case Trigger: - return getTriggerFeedUri(physicalAddress, request); - case User: - return getUserFeedUri(physicalAddress, request); - - case UserDefinedFunction: - return getUserDefinedFunctionFeedUri(physicalAddress, request); - case Schema: - return getSchemaFeedUri(physicalAddress, request); - case Offer: - return getOfferFeedUri(physicalAddress, request); - -// Other types: Replica, Module, ModuleCommand, Record, UserDefinedType not applicable to SDK. - - default: - assert false : "Unexpected resource type: " + resourceType; - throw new NotFoundException(); - } - } - - static URI getResourceEntryUri(ResourceType resourceType, URI physicalAddress, RxDocumentServiceRequest request) throws Exception { - switch (resourceType) { - case Attachment: - return getAttachmentEntryUri(physicalAddress, request); - case DocumentCollection: - return getCollectionEntryUri(physicalAddress, request); - case Conflict: - return getConflictEntryUri(physicalAddress, request); - case Database: - return getDatabaseEntryUri(physicalAddress, request); - case Document: - return getDocumentEntryUri(physicalAddress, request); - case Permission: - return getPermissionEntryUri(physicalAddress, request); - case StoredProcedure: - return getStoredProcedureEntryUri(physicalAddress, request); - case Trigger: - return getTriggerEntryUri(physicalAddress, request); - case User: - return getUserEntryUri(physicalAddress, request); - case UserDefinedFunction: - return getUserDefinedFunctionEntryUri(physicalAddress, request); - case Schema: - return getSchemaEntryUri(physicalAddress, request); - case Offer: - return getOfferEntryUri(physicalAddress, request); - -// Other types: Replica, Module, ModuleCommand, Record, UserDefinedType not applicable to SDK. - - default: - assert false: "Unexpected resource type: " + resourceType; - throw new IllegalStateException(); - } - } - - static URI createURI(URI baseAddress, String resourcePath) { - return baseAddress.resolve(HttpUtils.urlEncode(trimBeginningAndEndingSlashes(resourcePath))); - } - - static URI getRootFeedUri(URI baseAddress) { - return baseAddress; - } - - static URI getDatabaseFeedUri(URI baseAddress) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Database, StringUtils.EMPTY, true)); - } - - static URI getDatabaseEntryUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Database, request, false)); - } - - static URI getCollectionFeedUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.DocumentCollection, request, true)); - } - - static URI getStoredProcedureFeedUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.StoredProcedure, request, true)); - } - - static URI getTriggerFeedUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Trigger, request, true)); - } - - static URI getUserDefinedFunctionFeedUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.UserDefinedFunction, request, true)); - } - - static URI getCollectionEntryUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.DocumentCollection, request, false)); - } - - static URI getStoredProcedureEntryUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.StoredProcedure, request, false)); - } - - static URI getTriggerEntryUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Trigger, request, false)); - } - - static URI getUserDefinedFunctionEntryUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.UserDefinedFunction, request, false)); - } - - static URI getDocumentFeedUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Document, request, true)); - } - - static URI getDocumentEntryUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Document, request, false)); - } - - static URI getConflictFeedUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Conflict, request, true)); - } - - static URI getConflictEntryUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Conflict, request, false)); - } - - static URI getAttachmentFeedUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Attachment, request, true)); - } - - static URI getAttachmentEntryUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Attachment, request, false)); - } - - static URI getUserFeedUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.User, request, true)); - } - - static URI getUserEntryUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.User, request, false)); - } - - static URI getPermissionFeedUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Permission, request, true)); - } - - static URI getPermissionEntryUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Permission, request, false)); - } - - static URI getOfferFeedUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Offer, request, true)); - } - - - static URI getSchemaFeedUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Schema, request, true)); - } - - static URI getSchemaEntryUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Schema, request, false)); - } - - static URI getOfferEntryUri(URI baseAddress, RxDocumentServiceRequest request) throws Exception { - return createURI(baseAddress, PathsHelper.generatePath(ResourceType.Offer, request, false)); - } - - static String getHeader(String[] names, String[] values, String name) { - for (int idx = 0; idx < names.length; idx++) { - if (Strings.areEqual(names[idx], name)) { - return values[idx]; - } - } - - return null; - } - - private Single processHttpResponse(String resourceAddress, HttpClientRequest request, String activityId, HttpClientResponse response, URI physicalAddress) { - if (response == null) { - InternalServerErrorException exception = - new InternalServerErrorException( - String.format( - RMResources.ExceptionMessage, - RMResources.InvalidBackendResponse), - null, - physicalAddress); - exception.getResponseHeaders().put(HttpConstants.HttpHeaders.ACTIVITY_ID, - activityId); - exception.getResponseHeaders().put(HttpConstants.HttpHeaders.REQUEST_VALIDATION_FAILURE, "1"); - - return Single.error(exception); - } - - // If the status code is < 300 or 304 NotModified (we treat not modified as success) then it means that it's a success code and shouldn't throw. - if (response.getStatus().code() < HttpConstants.StatusCodes.MINIMUM_STATUSCODE_AS_ERROR_GATEWAY || - response.getStatus().code() == HttpConstants.StatusCodes.NOT_MODIFIED) { - return HttpTransportClient.createStoreResponseFromHttpResponse(response); - } - else { - return this.createErrorResponseFromHttpResponse(resourceAddress, activityId, request, response); - } - } - - private Single createErrorResponseFromHttpResponse(String resourceAddress, String activityId, - HttpClientRequest request, - HttpClientResponse response) { - HttpResponseStatus statusCode = response.getStatus(); - Single errorMessageObs = ErrorUtils.getErrorResponseAsync(response); - - return errorMessageObs.flatMap( - errorMessage -> { - long responseLSN = -1; - - List lsnValues; - if ((lsnValues = response.getHeaders().getAll(WFConstants.BackendHeaders.LSN)) != null) { - String temp = lsnValues.isEmpty() ? null : lsnValues.get(0); - responseLSN = Longs.tryParse(temp, responseLSN); - } - - String responsePartitionKeyRangeId = null; - List partitionKeyRangeIdValues; - if ((partitionKeyRangeIdValues = response.getHeaders().getAll(WFConstants.BackendHeaders.PARTITION_KEY_RANGE_ID)) != null) { - responsePartitionKeyRangeId = Lists.firstOrDefault(partitionKeyRangeIdValues, null); - } - - DocumentClientException exception; - - switch (statusCode.code()) { - case HttpConstants.StatusCodes.UNAUTHORIZED: - exception = new UnauthorizedException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.Unauthorized : errorMessage), - response.getHeaders(), - request.getUri()); - break; - - case HttpConstants.StatusCodes.FORBIDDEN: - exception = new ForbiddenException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.Forbidden : errorMessage), - response.getHeaders(), - request.getUri()); - break; - - case HttpConstants.StatusCodes.NOTFOUND: - // HTTP.SYS returns NotFound (404) if the URI - // is not registered. This is really an indication that - // the replica which registered the URI is not - // available at the server. We detect this case by - // the presence of Content-Type header in the response - // and map it to HTTP Gone (410), which is the more - // appropriate response for this case. - if (response.getContent() != null && response.getHeaders() != null && response.getHeaders().get(HttpConstants.HttpHeaders.CONTENT_TYPE) != null && - !Strings.isNullOrEmpty(response.getHeaders().get(HttpConstants.HttpHeaders.CONTENT_TYPE)) && - Strings.containsIgnoreCase(response.getHeaders().get(HttpConstants.HttpHeaders.CONTENT_TYPE), RuntimeConstants.MediaTypes.TEXT_HTML)) { - // Have the request URL in the exception message for debugging purposes. - exception = new GoneException( - String.format( - RMResources.ExceptionMessage, - RMResources.Gone), - request.getUri()); - exception.getResponseHeaders().put(HttpConstants.HttpHeaders.ACTIVITY_ID, - activityId); - - break; - } else { - exception = new NotFoundException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.NotFound : errorMessage), - response.getHeaders(), - request.getUri()); - break; - } - - case HttpConstants.StatusCodes.BADREQUEST: - exception = new BadRequestException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.BadRequest : errorMessage), - response.getHeaders(), - request.getUri()); - break; - - case HttpConstants.StatusCodes.METHOD_NOT_ALLOWED: - exception = new MethodNotAllowedException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.MethodNotAllowed : errorMessage), - null, - response.getHeaders(), - request.getUri()); - break; - - case HttpConstants.StatusCodes.GONE: { - - // TODO: update perf counter - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/258624 - ErrorUtils.logGoneException(request.getUri(), activityId); - - Integer nSubStatus = 0; - String valueSubStatus = null; - - valueSubStatus = response.getHeaders().get(WFConstants.BackendHeaders.SUB_STATUS); - if (!Strings.isNullOrEmpty(valueSubStatus)) { - if ((nSubStatus = Integers.tryParse(valueSubStatus)) == null) { - exception = new InternalServerErrorException( - String.format( - RMResources.ExceptionMessage, - RMResources.InvalidBackendResponse), - response.getHeaders(), - request.getUri()); - break; - } - } - - if (nSubStatus == HttpConstants.SubStatusCodes.NAME_CACHE_IS_STALE) { - exception = new InvalidPartitionException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.Gone : errorMessage), - response.getHeaders(), - request.getUri()); - break; - } else if (nSubStatus == HttpConstants.SubStatusCodes.PARTITION_KEY_RANGE_GONE) { - exception = new PartitionKeyRangeGoneException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.Gone : errorMessage), - response.getHeaders(), - request.getUri()); - break; - } else if (nSubStatus == HttpConstants.SubStatusCodes.COMPLETING_SPLIT) { - exception = new PartitionKeyRangeIsSplittingException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.Gone : errorMessage), - response.getHeaders(), - request.getUri()); - break; - } else if (nSubStatus == HttpConstants.SubStatusCodes.COMPLETING_PARTITION_MIGRATION) { - exception = new PartitionIsMigratingException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.Gone : errorMessage), - response.getHeaders(), - request.getUri()); - break; - } else { - // Have the request URL in the exception message for debugging purposes. - exception = new GoneException( - String.format( - RMResources.ExceptionMessage, - RMResources.Gone), - response.getHeaders(), - request.getUri()); - - exception.getResponseHeaders().put(HttpConstants.HttpHeaders.ACTIVITY_ID, - activityId); - break; - } - } - - case HttpConstants.StatusCodes.CONFLICT: - exception = new ConflictException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.EntityAlreadyExists : errorMessage), - response.getHeaders(), - request.getUri()); - break; - - case HttpConstants.StatusCodes.PRECONDITION_FAILED: - exception = new PreconditionFailedException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.PreconditionFailed : errorMessage), - response.getHeaders(), - request.getUri()); - break; - - case HttpConstants.StatusCodes.REQUEST_ENTITY_TOO_LARGE: - exception = new RequestEntityTooLargeException( - String.format( - RMResources.ExceptionMessage, - String.format( - RMResources.RequestEntityTooLarge, - HttpConstants.HttpHeaders.PAGE_SIZE)), - response.getHeaders(), - request.getUri()); - break; - - case HttpConstants.StatusCodes.LOCKED: - exception = new LockedException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.Locked : errorMessage), - response.getHeaders(), - request.getUri()); - break; - - case HttpConstants.StatusCodes.SERVICE_UNAVAILABLE: - exception = new ServiceUnavailableException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.ServiceUnavailable : errorMessage), - response.getHeaders(), - request.getUri()); - break; - - case HttpConstants.StatusCodes.REQUEST_TIMEOUT: - exception = new RequestTimeoutException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.RequestTimeout : errorMessage), - response.getHeaders(), - request.getUri()); - break; - - case HttpConstants.StatusCodes.RETRY_WITH: - exception = new RetryWithException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.RetryWith : errorMessage), - response.getHeaders(), - request.getUri()); - break; - - case HttpConstants.StatusCodes.TOO_MANY_REQUESTS: - exception = - new RequestRateTooLargeException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.TooManyRequests : errorMessage), - response.getHeaders(), - request.getUri()); - - List values = response.getHeaders().getAll(HttpConstants.HttpHeaders.RETRY_AFTER_IN_MILLISECONDS); - - if (values == null || values.isEmpty()) { - logger.warn("RequestRateTooLargeException being thrown without RetryAfter."); - } else { - exception.getResponseHeaders().put(HttpConstants.HttpHeaders.RETRY_AFTER_IN_MILLISECONDS, values.get(0)); - } - - break; - - case HttpConstants.StatusCodes.INTERNAL_SERVER_ERROR: - exception = new InternalServerErrorException( - String.format( - RMResources.ExceptionMessage, - Strings.isNullOrEmpty(errorMessage) ? RMResources.InternalServerError : errorMessage), - response.getHeaders(), - request.getUri()); - break; - - default: - logger.error("Unrecognized status code {} returned by backend. ActivityId {}", statusCode, activityId); - ErrorUtils.logException(request.getUri(), activityId); - exception = new InternalServerErrorException( - String.format( - RMResources.ExceptionMessage, - RMResources.InvalidBackendResponse), - response.getHeaders(), - request.getUri()); - break; - } - - BridgeInternal.setLSN(exception, responseLSN); - BridgeInternal.setPartitionKeyRangeId(exception, responsePartitionKeyRangeId); - BridgeInternal.setResourceAddress(exception, resourceAddress); - BridgeInternal.setRequestHeaders(exception, HttpUtils.asMap(request.getHeaders())); - - return Single.error(exception); - } - ); - } - - private static Single createStoreResponseFromHttpResponse( - HttpClientResponse responseMessage) { - - Single storeResponse = ResponseUtils.toStoreResponse(responseMessage); - return storeResponse; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/IAddressCache.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/IAddressCache.java deleted file mode 100644 index 3e53730b86bc..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/IAddressCache.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import rx.Single; - -public interface IAddressCache { - - /** - * Resolves physical addresses by either PartitionKeyRangeIdentity. - * - * - * @param request Request is needed only by GatewayAddressCache in the only case when request is name based and user has name based auth token. - * PartitionkeyRangeIdentity can be used to locate auth token in this case. - * @param partitionKeyRangeIdentity target partition key range Id - * @param forceRefreshPartitionAddresses Whether addresses need to be refreshed as previously resolved addresses were determined to be outdated. - * @return Physical addresses. - */ - Single tryGetAddresses( - RxDocumentServiceRequest request, - PartitionKeyRangeIdentity partitionKeyRangeIdentity, - boolean forceRefreshPartitionAddresses); -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/IAddressResolver.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/IAddressResolver.java deleted file mode 100644 index d2c5dce2dc49..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/IAddressResolver.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import rx.Single; - -public interface IAddressResolver { - Single resolveAsync( - RxDocumentServiceRequest request, - boolean forceRefreshPartitionAddresses); -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/IStoreClient.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/IStoreClient.java deleted file mode 100644 index a9a1c1fffdae..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/IStoreClient.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.rx.internal.IRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; -import rx.Single; -import rx.functions.Func1; - -public interface IStoreClient { - - Single processMessageAsync( - RxDocumentServiceRequest request, - IRetryPolicy retryPolicy, - Func1> prepareRequestAsyncDelegate); - - default Single processMessageAsync( - RxDocumentServiceRequest request, - Func1> prepareRequestAsyncDelegate) { - return processMessageAsync(request, null, prepareRequestAsyncDelegate); - } - - default Single processMessageAsync( - RxDocumentServiceRequest request, - IRetryPolicy retryPolicy) { - return processMessageAsync(request, retryPolicy, null); - } - - default Single processMessageAsync( - RxDocumentServiceRequest request) { - return processMessageAsync(request, null, null); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/LockedException.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/LockedException.java deleted file mode 100644 index 1b996af941a3..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/LockedException.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.util.Map; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class LockedException extends DocumentClientException { - private static final long serialVersionUID = 1L; - - public LockedException() { - this(RMResources.Locked); - } - - public LockedException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.LOCKED, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public LockedException(String msg) { - super(HttpConstants.StatusCodes.LOCKED, msg); - } - - public LockedException(String msg, String resourceAddress) { - super(msg, null, null, HttpConstants.StatusCodes.LOCKED, resourceAddress); - } - - public LockedException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public LockedException(Exception innerException) { - this(RMResources.Locked, innerException, null, null); - } - - public LockedException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - super(String.format("%s: %s", RMResources.Locked, message), - innerException, - HttpUtils.asMap(headers), - HttpConstants.StatusCodes.LOCKED, - requestUri); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/MethodNotAllowedException.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/MethodNotAllowedException.java deleted file mode 100644 index 082789ba3eda..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/MethodNotAllowedException.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.net.URI; -import java.util.Map; - -public class MethodNotAllowedException extends DocumentClientException { - public MethodNotAllowedException() { - this(RMResources.MethodNotAllowed); - } - - public MethodNotAllowedException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.METHOD_NOT_ALLOWED, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public MethodNotAllowedException(String message) { - this(message, (Exception) null, (HttpResponseHeaders) null, null); - } - - public MethodNotAllowedException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public MethodNotAllowedException(String message, HttpResponseHeaders headers, URI requestUri) { - this(message, headers, requestUri != null ? requestUri.toString() : null); - } - - public MethodNotAllowedException(Exception innerException) { - this(RMResources.MethodNotAllowed, innerException, null, null); - } - - public MethodNotAllowedException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - super(String.format("%s: %s", RMResources.MethodNotAllowed, message), - innerException, - HttpUtils.asMap(headers), - HttpConstants.StatusCodes.METHOD_NOT_ALLOWED, - requestUri != null ? requestUri.toString() : null); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PartitionKeyRangeGoneException.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PartitionKeyRangeGoneException.java deleted file mode 100644 index 3a8531316e03..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PartitionKeyRangeGoneException.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; -import org.apache.commons.collections4.CollectionUtils; - -import java.net.URL; -import java.util.HashMap; -import java.util.Map; - -/** - * This exception is thrown when DocumentServiceRequest contains x-ms-documentdb-partitionkeyrangeid - * header and such range id doesn't exist. - *

- * No retries should be made in this case, as either split or merge might have happened and query/readfeed - * must take appropriate actions. - */ -public class PartitionKeyRangeGoneException extends DocumentClientException { - - public PartitionKeyRangeGoneException() { - this(RMResources.Gone); - } - - public PartitionKeyRangeGoneException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.GONE, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - this.setSubstatus(); - } - - public PartitionKeyRangeGoneException(String message) { - this(message, (Exception) null, null, null); - } - - public PartitionKeyRangeGoneException(String message, Exception innerException) { - this(message, innerException, (HttpResponseHeaders) null, null); - } - - public PartitionKeyRangeGoneException(Exception innerException) { - this(RMResources.Gone, innerException, (HttpResponseHeaders) null, null); - } - - - public PartitionKeyRangeGoneException(String message, HttpResponseHeaders headers, String requestUri) { - super(message, null, HttpUtils.asMap(headers), HttpConstants.StatusCodes.GONE, requestUri); - this.setSubstatus(); - } - - public PartitionKeyRangeGoneException(String message, Exception innerException, HttpResponseHeaders headers, String requestUri) { - super(message, innerException, HttpUtils.asMap(headers), HttpConstants.StatusCodes.GONE, requestUri); - this.setSubstatus(); - } - - private void setSubstatus() { - this.getResponseHeaders().put(WFConstants.BackendHeaders.SUB_STATUS, Integer.toString(HttpConstants.SubStatusCodes.PARTITION_KEY_RANGE_GONE)); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PreconditionFailedException.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PreconditionFailedException.java deleted file mode 100644 index 400609c86685..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PreconditionFailedException.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.util.Map; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class PreconditionFailedException extends DocumentClientException { - - private static final long serialVersionUID = 1L; - - public PreconditionFailedException() { - this(RMResources.PreconditionFailed); - } - - public PreconditionFailedException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.PRECONDITION_FAILED, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public PreconditionFailedException(String msg) { - super(HttpConstants.StatusCodes.PRECONDITION_FAILED, msg); - } - - public PreconditionFailedException(String msg, String resourceAddress) { - super(msg, null, null, HttpConstants.StatusCodes.PRECONDITION_FAILED, resourceAddress); - } - - public PreconditionFailedException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public PreconditionFailedException(Exception innerException) { - this(RMResources.PreconditionFailed, innerException, null, null); - } - - public PreconditionFailedException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - super(String.format("%s: %s", RMResources.PreconditionFailed, message), - innerException, - HttpUtils.asMap(headers), - HttpConstants.StatusCodes.PRECONDITION_FAILED, - requestUri); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/QueryRequestPerformanceActivity.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/QueryRequestPerformanceActivity.java deleted file mode 100644 index 1673bbc60d76..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/QueryRequestPerformanceActivity.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -// TODO troubleshooting info -// https://msdata.visualstudio.com/CosmosDB/_workitems/edit/258624 -public class QueryRequestPerformanceActivity { -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/QuorumReader.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/QuorumReader.java deleted file mode 100644 index 6028328a6875..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/QuorumReader.java +++ /dev/null @@ -1,811 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - - -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.internal.InternalServerErrorException; -import com.microsoft.azure.cosmosdb.internal.JavaStreamUtils; -import com.microsoft.azure.cosmosdb.internal.MutableVolatile; -import com.microsoft.azure.cosmosdb.internal.Quadruple; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.apache.commons.lang3.tuple.Pair; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Observable; -import rx.Single; - -import java.util.Comparator; -import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicLong; -import java.util.stream.Collectors; - -import static com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; - -// -//================================================================================================================= -// Strong read logic: -//================================================================================================================= -// -// ------------------- PerformPrimaryRead------------------------------------------------------------- -// | ^ | -// [RetryOnSecondary] | | -// | [QuorumNotSelected] | -// \/ | \/ -// Start-------------------------->SecondaryQuorumRead-------------[QuorumMet]-------------------------------->Result -// | ^ -// [QuorumSelected] | -// | | -// \/ | -// PrimaryReadBarrier------------------------------------------------------------- -// -//================================================================================================================= -// BoundedStaleness quorum read logic: -//================================================================================================================= -// -// ------------------- PerformPrimaryRead------------------------------------------------------------- -// | ^ | -// [RetryOnSecondary] | | -// | [QuorumNotSelected] | -// \/ | \/ -// Start-------------------------->SecondaryQuorumRead-------------[QuorumMet]-------------------------------->Result -// | ^ -// [QuorumSelected] | -// | | -// | | -// --------------------------------------------------------------------------- -// -/** - * QuorumReader wraps the client side quorum logic on top of the StoreReader - */ -public class QuorumReader { - private final static Logger logger = LoggerFactory.getLogger(QuorumReader.class); - - private final int maxNumberOfReadBarrierReadRetries; - private final int maxNumberOfPrimaryReadRetries; - private final int maxNumberOfReadQuorumRetries; - private final int delayBetweenReadBarrierCallsInMs; - - private final int maxBarrierRetriesForMultiRegion; - private final int barrierRetryIntervalInMsForMultiRegion; - - private final int maxShortBarrierRetriesForMultiRegion; - private final int shortBarrierRetryIntervalInMsForMultiRegion; - - private final StoreReader storeReader; - private final GatewayServiceConfigurationReader serviceConfigReader; - private final IAuthorizationTokenProvider authorizationTokenProvider; - - public QuorumReader( - Configs configs, - TransportClient transportClient, - AddressSelector addressSelector, - StoreReader storeReader, - GatewayServiceConfigurationReader serviceConfigReader, - IAuthorizationTokenProvider authorizationTokenProvider) { - this.storeReader = storeReader; - this.serviceConfigReader = serviceConfigReader; - this.authorizationTokenProvider = authorizationTokenProvider; - - this.maxNumberOfReadBarrierReadRetries = configs.getMaxNumberOfReadBarrierReadRetries(); - this.maxNumberOfPrimaryReadRetries = configs.getMaxNumberOfPrimaryReadRetries(); - this.maxNumberOfReadQuorumRetries = configs.getMaxNumberOfReadQuorumRetries(); - this.delayBetweenReadBarrierCallsInMs = configs.getDelayBetweenReadBarrierCallsInMs(); - this.maxBarrierRetriesForMultiRegion = configs.getMaxBarrierRetriesForMultiRegion(); - this.barrierRetryIntervalInMsForMultiRegion = configs.getBarrierRetryIntervalInMsForMultiRegion(); - this.maxShortBarrierRetriesForMultiRegion = configs.getMaxShortBarrierRetriesForMultiRegion(); - this.shortBarrierRetryIntervalInMsForMultiRegion = configs.getShortBarrierRetryIntervalInMsForMultiRegion(); - } - - public QuorumReader( - TransportClient transportClient, - AddressSelector addressSelector, - StoreReader storeReader, - GatewayServiceConfigurationReader serviceConfigReader, - IAuthorizationTokenProvider authorizationTokenProvider, - Configs configs) { - this(configs, transportClient, addressSelector, storeReader, serviceConfigReader, authorizationTokenProvider); - } - - public Single readStrongAsync( - RxDocumentServiceRequest entity, - int readQuorumValue, - ReadMode readMode) { - final MutableVolatile shouldRetryOnSecondary = new MutableVolatile<>(false); - final MutableVolatile hasPerformedReadFromPrimary = new MutableVolatile<>(false); - - return Observable.defer( - // the following will be repeated till the repeat().takeUntil(.) condition is satisfied. - () -> { - if (entity.requestContext.timeoutHelper.isElapsed()) { - return Observable.error(new GoneException()); - } - - shouldRetryOnSecondary.v = false; - Single secondaryQuorumReadResultObs = - this.readQuorumAsync(entity, readQuorumValue, false, readMode); - - return secondaryQuorumReadResultObs.toObservable().flatMap( - secondaryQuorumReadResult -> { - - switch (secondaryQuorumReadResult.quorumResult) { - case QuorumMet: - try { - return Observable.just(secondaryQuorumReadResult.getResponse()); - } catch (DocumentClientException e) { - return Observable.error(e); - } - - case QuorumSelected: - Single barrierRequestObs = BarrierRequestHelper.createAsync( - entity, - this.authorizationTokenProvider, - secondaryQuorumReadResult.selectedLsn, - secondaryQuorumReadResult.globalCommittedSelectedLsn); - - return barrierRequestObs.toObservable().flatMap(barrierRequest -> { - Single readBarrierObs = this.waitForReadBarrierAsync( - barrierRequest, - true /* include primary */, - readQuorumValue, - secondaryQuorumReadResult.selectedLsn, - secondaryQuorumReadResult.globalCommittedSelectedLsn, - readMode); - - return readBarrierObs.toObservable().flatMap( - readBarrier -> { - - if (readBarrier) { - try { - return Observable.just(secondaryQuorumReadResult.getResponse()); - } catch (Exception e) { - return Observable.error(e); - } - } - - // else barrier was not successful - logger.warn( - "QuorumSelected: Could not converge on the LSN {} GlobalCommittedLSN {} after primary read barrier with read quorum {} for strong read, Responses: {}", - secondaryQuorumReadResult.selectedLsn, - secondaryQuorumReadResult.globalCommittedSelectedLsn, - readQuorumValue, - String.join(";", secondaryQuorumReadResult.storeResponses) - ); - - entity.requestContext.quorumSelectedStoreResponse = secondaryQuorumReadResult.selectedResponse; - entity.requestContext.storeResponses = secondaryQuorumReadResult.storeResponses; - entity.requestContext.quorumSelectedLSN = secondaryQuorumReadResult.selectedLsn; - entity.requestContext.globalCommittedSelectedLSN = secondaryQuorumReadResult.globalCommittedSelectedLsn; - - return Observable.empty(); - } - ); - }); - - case QuorumNotSelected: - if (hasPerformedReadFromPrimary.v) { - logger.warn("QuorumNotSelected: Primary read already attempted. Quorum could not be selected after retrying on secondaries."); - return Observable.error(new GoneException(RMResources.ReadQuorumNotMet)); - } - - logger.warn("QuorumNotSelected: Quorum could not be selected with read quorum of {}", readQuorumValue); - Single responseObs = this.readPrimaryAsync(entity, readQuorumValue, false); - - return responseObs.toObservable().flatMap( - response -> { - if (response.isSuccessful && response.shouldRetryOnSecondary) { - assert false : "QuorumNotSelected: PrimaryResult has both Successful and shouldRetryOnSecondary flags set"; - logger.error("PrimaryResult has both Successful and shouldRetryOnSecondary flags set"); - } else if (response.isSuccessful) { - logger.debug("QuorumNotSelected: ReadPrimary successful"); - try { - return Observable.just(response.getResponse()); - } catch (DocumentClientException e) { - return Observable.error(e); - } - } else if (response.shouldRetryOnSecondary) { - shouldRetryOnSecondary.v = true; - logger.warn("QuorumNotSelected: ReadPrimary did not succeed. Will retry on secondary."); - hasPerformedReadFromPrimary.v = true; - } else { - logger.warn("QuorumNotSelected: Could not get successful response from ReadPrimary"); - return Observable.error(new GoneException(String.format(RMResources.ReadQuorumNotMet, readQuorumValue))); - } - - return Observable.empty(); - - } - ); - - default: - logger.error("Unknown ReadQuorum result {}", secondaryQuorumReadResult.quorumResult.toString()); - return Observable.error(new InternalServerErrorException(RMResources.InternalServerError)); - } - - }); - }).repeat(maxNumberOfReadQuorumRetries) - .takeUntil(dummy -> !shouldRetryOnSecondary.v) - .concatWith(Observable.defer(() -> { - logger.warn("Could not complete read quorum with read quorum value of {}", readQuorumValue); - - return Observable.error(new GoneException( - String.format( - RMResources.ReadQuorumNotMet, - readQuorumValue))); - })) - .take(1) - .toSingle(); - } - - private Single readQuorumAsync( - RxDocumentServiceRequest entity, - int readQuorum, - boolean includePrimary, - ReadMode readMode) { - if (entity.requestContext.timeoutHelper.isElapsed()) { - return Single.error(new GoneException()); - } - - return ensureQuorumSelectedStoreResponse(entity, readQuorum, includePrimary, readMode).flatMap( - res -> { - if (res.getLeft() != null) { - // no need for barrier - return Single.just(res.getKey()); - } - - long readLsn = res.getValue().getValue0(); - long globalCommittedLSN = res.getValue().getValue1(); - StoreResult storeResult = res.getValue().getValue2(); - List storeResponses = res.getValue().getValue3(); - - // ReadBarrier required - Single barrierRequestObs = BarrierRequestHelper.createAsync(entity, this.authorizationTokenProvider, readLsn, globalCommittedLSN); - return barrierRequestObs.flatMap( - barrierRequest -> { - Single waitForObs = this.waitForReadBarrierAsync(barrierRequest, false, readQuorum, readLsn, globalCommittedLSN, readMode); - return waitForObs.flatMap( - waitFor -> { - if (!waitFor) { - return Single.just(new ReadQuorumResult( - entity.requestContext.requestChargeTracker, - ReadQuorumResultKind.QuorumSelected, - readLsn, - globalCommittedLSN, - storeResult, - storeResponses)); - } - - return Single.just(new ReadQuorumResult( - entity.requestContext.requestChargeTracker, - ReadQuorumResultKind.QuorumMet, - readLsn, - globalCommittedLSN, - storeResult, - storeResponses)); - } - ); - } - ); - } - ); - } - - private Single>>> ensureQuorumSelectedStoreResponse(RxDocumentServiceRequest entity, int readQuorum, boolean includePrimary, ReadMode readMode) { - - if (entity.requestContext.quorumSelectedStoreResponse == null) { - Single> responseResultObs = this.storeReader.readMultipleReplicaAsync( - entity, includePrimary, readQuorum, true /*required valid LSN*/, false, readMode); - - return responseResultObs.flatMap( - responseResult -> { - List storeResponses = responseResult.stream().map(response -> response.toString()).collect(Collectors.toList()); - int responseCount = (int) responseResult.stream().filter(response -> response.isValid).count(); - if (responseCount < readQuorum) { - return Single.just(Pair.of(new ReadQuorumResult(entity.requestContext.requestChargeTracker, - ReadQuorumResultKind.QuorumNotSelected, - -1, -1, null, storeResponses), null)); - } - - //either request overrides consistency level with strong, or request does not override and account default consistency level is strong - boolean isGlobalStrongReadCandidate = - (ReplicatedResourceClient.isGlobalStrongEnabled() && this.serviceConfigReader.getDefaultConsistencyLevel() == ConsistencyLevel.Strong) && - (entity.requestContext.originalRequestConsistencyLevel == null || entity.requestContext.originalRequestConsistencyLevel == ConsistencyLevel.Strong); - - ValueHolder readLsn = new ValueHolder(-1); - ValueHolder globalCommittedLSN = new ValueHolder(-1); - ValueHolder storeResult = new ValueHolder(null); - - if (this.isQuorumMet( - responseResult, - readQuorum, - false, - isGlobalStrongReadCandidate, - readLsn, - globalCommittedLSN, - storeResult)) { - return Single.just(Pair.of(new ReadQuorumResult( - entity.requestContext.requestChargeTracker, - ReadQuorumResultKind.QuorumMet, - readLsn.v, - globalCommittedLSN.v, - storeResult.v, - storeResponses), null)); - } - - // at this point, if refresh were necessary, we would have refreshed it in ReadMultipleReplicaAsync - // so set to false here to avoid further refrehses for this request. - entity.requestContext.forceRefreshAddressCache = false; - - Quadruple> state = Quadruple.with(readLsn.v, globalCommittedLSN.v, storeResult.v, storeResponses); - return Single.just(Pair.of(null, state)); - } - ); - } else { - - ValueHolder readLsn = ValueHolder.initialize(entity.requestContext.quorumSelectedLSN); - ValueHolder globalCommittedLSN = ValueHolder.initialize(entity.requestContext.globalCommittedSelectedLSN); - ValueHolder storeResult = ValueHolder.initialize(entity.requestContext.quorumSelectedStoreResponse); - List storeResponses = entity.requestContext.storeResponses; - Quadruple> state = Quadruple.with(readLsn.v, globalCommittedLSN.v, storeResult.v, storeResponses); - - return Single.just(Pair.of(null, state)); - } - } - - /** - * Read and get response from Primary - * - * @param entity - * @param readQuorum - * @param useSessionToken - * @return - */ - private Single readPrimaryAsync( - RxDocumentServiceRequest entity, - int readQuorum, - boolean useSessionToken) { - if (entity.requestContext.timeoutHelper.isElapsed()) { - return Single.error(new GoneException()); - } - - // We would have already refreshed address before reaching here. Avoid performing here. - entity.requestContext.forceRefreshAddressCache = false; - - Single storeResultObs = this.storeReader.readPrimaryAsync( - entity, true /*required valid LSN*/, useSessionToken); - - return storeResultObs.flatMap( - storeResult -> { - if (!storeResult.isValid) { - try { - return Single.error(storeResult.getException()); - } catch (InternalServerErrorException e) { - return Single.error(e); - } - } - - if (storeResult.currentReplicaSetSize <= 0 || storeResult.lsn < 0 || storeResult.quorumAckedLSN < 0) { - String message = String.format( - "Invalid value received from response header. CurrentReplicaSetSize %d, StoreLSN %d, QuorumAckedLSN %d", - storeResult.currentReplicaSetSize, storeResult.lsn, storeResult.quorumAckedLSN); - - // might not be returned if primary is still building the secondary replicas (during churn) - logger.error(message); - - // throw exception instead of returning inconsistent result. - return Single.error(new GoneException(String.format(RMResources.ReadQuorumNotMet, readQuorum))); - - } - - if (storeResult.currentReplicaSetSize > readQuorum) { - logger.warn( - "Unexpected response. Replica Set size is {} which is greater than min value {}", storeResult.currentReplicaSetSize, readQuorum); - return Single.just(new ReadPrimaryResult(entity.requestContext.requestChargeTracker, /*isSuccessful */ false, - /* shouldRetryOnSecondary: */ true, /* response: */ null)); - } - - // To accommodate for store latency, where an LSN may be acked by not persisted in the store, we compare the quorum acked LSN and store LSN. - // In case of sync replication, the store LSN will follow the quorum committed LSN - // In case of async replication (if enabled for bounded staleness), the store LSN can be ahead of the quorum committed LSN if the primary is able write to faster than secondary acks. - // We pick higher of the 2 LSN and wait for the other to reach that LSN. - if (storeResult.lsn != storeResult.quorumAckedLSN) { - logger.warn("Store LSN {} and quorum acked LSN {} don't match", storeResult.lsn, storeResult.quorumAckedLSN); - long higherLsn = storeResult.lsn > storeResult.quorumAckedLSN ? storeResult.lsn : storeResult.quorumAckedLSN; - - Single waitForLsnRequestObs = BarrierRequestHelper.createAsync(entity, this.authorizationTokenProvider, higherLsn, null); - return waitForLsnRequestObs.flatMap( - waitForLsnRequest -> { - Single primaryWaitForLsnResponseObs = this.waitForPrimaryLsnAsync(waitForLsnRequest, higherLsn, readQuorum); - return primaryWaitForLsnResponseObs.map( - primaryWaitForLsnResponse -> { - if (primaryWaitForLsnResponse == PrimaryReadOutcome.QuorumNotMet) { - return new ReadPrimaryResult( - entity.requestContext.requestChargeTracker, /*(isSuccessful: */ false, /* shouldRetryOnSecondary: */ false, /* response: */null); - } else if (primaryWaitForLsnResponse == PrimaryReadOutcome.QuorumInconclusive) { - return new ReadPrimaryResult( - entity.requestContext.requestChargeTracker, /* isSuccessful: */ false, /* shouldRetryOnSecondary: */ - true, /* response: */ null); - } - - return new ReadPrimaryResult( - entity.requestContext.requestChargeTracker, /* isSuccessful: */ true, /* shouldRetryOnSecondary: */ false, /*response: */ storeResult); - } - ); - } - ); - } - - return Single.just(new ReadPrimaryResult( - /* requestChargeTracker: */ entity.requestContext.requestChargeTracker, /* isSuccessful: */ true, /* shouldRetryOnSecondary:*/ false, - /*response: */ storeResult)); - } - ); - } - - private Single waitForPrimaryLsnAsync( - RxDocumentServiceRequest barrierRequest, - long lsnToWaitFor, - int readQuorum) { - - return Observable.defer(() -> { - if (barrierRequest.requestContext.timeoutHelper.isElapsed()) { - return Observable.error(new GoneException()); - } - - // We would have already refreshed address before reaching here. Avoid performing here. - barrierRequest.requestContext.forceRefreshAddressCache = false; - - Single storeResultObs = this.storeReader.readPrimaryAsync(barrierRequest, true /*required valid LSN*/, false); - - return storeResultObs.toObservable().flatMap( - storeResult -> { - if (!storeResult.isValid) { - try { - return Observable.error(storeResult.getException()); - } catch (InternalServerErrorException e) { - return Observable.error(e); - } - } - - if (storeResult.currentReplicaSetSize > readQuorum) { - logger.warn( - "Unexpected response. Replica Set size is {} which is greater than min value {}", storeResult.currentReplicaSetSize, readQuorum); - return Observable.just(PrimaryReadOutcome.QuorumInconclusive); - } - - // Java this will move to the repeat logic - if (storeResult.lsn < lsnToWaitFor || storeResult.quorumAckedLSN < lsnToWaitFor) { - logger.warn( - "Store LSN {} or quorum acked LSN {} are lower than expected LSN {}", storeResult.lsn, storeResult.quorumAckedLSN, lsnToWaitFor); - - return Observable.timer(delayBetweenReadBarrierCallsInMs, TimeUnit.MILLISECONDS).flatMap(dummy -> Observable.empty()); - } - - return Observable.just(PrimaryReadOutcome.QuorumMet); - } - ); - }).repeat(maxNumberOfPrimaryReadRetries) // Loop for store and quorum LSN to match - .defaultIfEmpty(PrimaryReadOutcome.QuorumNotMet) - .first() - .toSingle(); - - } - - private Single waitForReadBarrierAsync( - RxDocumentServiceRequest barrierRequest, - boolean allowPrimary, - final int readQuorum, - final long readBarrierLsn, - final long targetGlobalCommittedLSN, - ReadMode readMode) { - AtomicInteger readBarrierRetryCount = new AtomicInteger(maxNumberOfReadBarrierReadRetries); - AtomicInteger readBarrierRetryCountMultiRegion = new AtomicInteger(maxBarrierRetriesForMultiRegion); - - AtomicLong maxGlobalCommittedLsn = new AtomicLong(0); - - return Observable.defer(() -> { - - if (barrierRequest.requestContext.timeoutHelper.isElapsed()) { - return Observable.error(new GoneException()); - } - - Single> responsesObs = this.storeReader.readMultipleReplicaAsync( - barrierRequest, allowPrimary, readQuorum, - true /*required valid LSN*/, false /*useSessionToken*/, readMode, false /*checkMinLSN*/, true /*forceReadAll*/); - - return responsesObs.toObservable().flatMap( - responses -> { - - long maxGlobalCommittedLsnInResponses = responses.size() > 0 ? responses.stream() - .mapToLong(response -> response.globalCommittedLSN).max().getAsLong() : 0; - - - if ((responses.stream().filter(response -> response.lsn >= readBarrierLsn).count() >= readQuorum) && - (!(targetGlobalCommittedLSN > 0) || maxGlobalCommittedLsnInResponses >= targetGlobalCommittedLSN)) { - return Observable.just(true); - } - - maxGlobalCommittedLsn.set(maxGlobalCommittedLsn.get() > maxGlobalCommittedLsnInResponses ? - maxGlobalCommittedLsn.get() : maxGlobalCommittedLsnInResponses); - - //only refresh on first barrier call, set to false for subsequent attempts. - barrierRequest.requestContext.forceRefreshAddressCache = false; - - if (readBarrierRetryCount.decrementAndGet() == 0) { - logger.debug("QuorumReader: waitForReadBarrierAsync - Last barrier for single-region requests. Responses: {}", - JavaStreamUtils.toString(responses, "; ")); - - // retries exhausted - return Observable.just(false); - - } else { - // delay - //await Task.Delay(QuorumReader.delayBetweenReadBarrierCallsInMs); - return Observable.empty(); - - } - } - ); - }).repeatWhen(obs -> obs.flatMap(aVoid -> { - return Observable.timer(delayBetweenReadBarrierCallsInMs, TimeUnit.MILLISECONDS); - })) - .take(1) // Retry loop - .flatMap(barrierRequestSucceeded -> - Observable.defer(() -> { - - if (barrierRequestSucceeded) { - return Observable.just(true); - } - - // we will go into global strong read barrier mode for global strong requests after regular barrier calls have been exhausted. - if (targetGlobalCommittedLSN > 0) { - return Observable.defer(() -> { - - if (barrierRequest.requestContext.timeoutHelper.isElapsed()) { - return Observable.error(new GoneException()); - } - - Single> responsesObs = this.storeReader.readMultipleReplicaAsync( - barrierRequest, allowPrimary, readQuorum, - true /*required valid LSN*/, false /*useSessionToken*/, readMode, false /*checkMinLSN*/, true /*forceReadAll*/); - - return responsesObs.toObservable().flatMap( - responses -> { - long maxGlobalCommittedLsnInResponses = responses.size() > 0 ? responses.stream() - .mapToLong(response -> response.globalCommittedLSN).max().getAsLong() : 0; - - if ((responses.stream().filter(response -> response.lsn >= readBarrierLsn).count() >= readQuorum) && - maxGlobalCommittedLsnInResponses >= targetGlobalCommittedLSN) { - return Observable.just(true); - } - - maxGlobalCommittedLsn.set(maxGlobalCommittedLsn.get() > maxGlobalCommittedLsnInResponses ? - maxGlobalCommittedLsn.get() : maxGlobalCommittedLsnInResponses); - - //trace on last retry. - if (readBarrierRetryCountMultiRegion.getAndDecrement() == 0) { - logger.debug("QuorumReader: waitForReadBarrierAsync - Last barrier for mult-region strong requests. Responses: {}", - JavaStreamUtils.toString(responses, "; ")); - return Observable.just(false); - } else { - return Observable.empty(); - } - } - ); - - }).repeatWhen(obs -> obs.flatMap(aVoid -> { - - if ((maxBarrierRetriesForMultiRegion - readBarrierRetryCountMultiRegion.get()) > maxShortBarrierRetriesForMultiRegion) { - return Observable.timer(barrierRetryIntervalInMsForMultiRegion, TimeUnit.MILLISECONDS); - } else { - return Observable.timer(shortBarrierRetryIntervalInMsForMultiRegion, TimeUnit.MILLISECONDS); - } - - }) - // stop predicate, simulating while loop - ).take(1); - } - - return Observable.empty(); - })). - concatWith( - Observable.defer(() -> { - logger.debug("QuorumReader: waitForReadBarrierAsync - TargetGlobalCommittedLsn: {}, MaxGlobalCommittedLsn: {}.", targetGlobalCommittedLSN, maxGlobalCommittedLsn); - return Observable.just(false); - }) - ).take(1).toSingle(); - } - - private boolean isQuorumMet( - List readResponses, - int readQuorum, - boolean isPrimaryIncluded, - boolean isGlobalStrongRead, - ValueHolder readLsn, - ValueHolder globalCommittedLSN, - ValueHolder selectedResponse) { - long maxLsn = 0; - long minLsn = Long.MAX_VALUE; - int replicaCountMaxLsn = 0; - List validReadResponses = readResponses.stream().filter(response -> response.isValid).collect(Collectors.toList()); - int validResponsesCount = validReadResponses.size(); - - if (validResponsesCount == 0) { - readLsn.v = 0l; - globalCommittedLSN.v = -1l; - selectedResponse.v = null; - - return false; - } - - assert !validReadResponses.isEmpty(); - long numberOfReadRegions = validReadResponses.stream().map(res -> res.numberOfReadRegions).max(Comparator.naturalOrder()).get(); - boolean checkForGlobalStrong = isGlobalStrongRead && numberOfReadRegions > 0; - - // Pick any R replicas in the response and check if they are at the same LSN - for (StoreResult response : validReadResponses) { - if (response.lsn == maxLsn) { - replicaCountMaxLsn++; - } else if (response.lsn > maxLsn) { - replicaCountMaxLsn = 1; - maxLsn = response.lsn; - } - - if (response.lsn < minLsn) { - minLsn = response.lsn; - } - } - - final long maxLsnFinal = maxLsn; - selectedResponse.v = validReadResponses.stream().filter(s -> s.lsn == maxLsnFinal).findFirst().get(); - - readLsn.v = selectedResponse.v.itemLSN == -1 ? - maxLsn : Math.min(selectedResponse.v.itemLSN, maxLsn); - globalCommittedLSN.v = checkForGlobalStrong ? readLsn.v : -1l; - - long maxGlobalCommittedLSN = validReadResponses.stream().mapToLong(res -> res.globalCommittedLSN).max().getAsLong(); - - logger.debug("QuorumReader: MaxLSN {} ReplicaCountMaxLSN {} bCheckGlobalStrong {} MaxGlobalCommittedLSN {} NumberOfReadRegions {} SelectedResponseItemLSN {}", - maxLsn, replicaCountMaxLsn, checkForGlobalStrong, maxGlobalCommittedLSN, numberOfReadRegions, selectedResponse.v.itemLSN); - - // quorum is met if one of the following conditions are satisfied: - // 1. readLsn is greater than zero - // AND the number of responses that have the same LSN as the selected response is greater than or equal to the read quorum - // AND if applicable, the max GlobalCommittedLSN of all responses is greater than or equal to the lsn of the selected response. - - // 2. if the request is a point-read request, - // AND there are more than one response in the readResponses - // AND the LSN of the returned resource of the selected response is less than or equal to the minimum lsn of the all the responses, - // AND if applicable, the LSN of the returned resource of the selected response is less than or equal to the minimum globalCommittedLsn of all the responses. - // This means that the returned resource is old enough to have been committed by at least all the received responses, - // which should be larger than or equal to the read quorum, which therefore means we have strong consistency. - boolean isQuorumMet = false; - - if ((readLsn.v > 0 && replicaCountMaxLsn >= readQuorum) && - (!checkForGlobalStrong || maxGlobalCommittedLSN >= maxLsn)) { - isQuorumMet = true; - } - - if (!isQuorumMet && validResponsesCount >= readQuorum && selectedResponse.v.itemLSN != -1 && - (minLsn != Long.MAX_VALUE && selectedResponse.v.itemLSN <= minLsn) && - (!checkForGlobalStrong || (selectedResponse.v.itemLSN <= maxGlobalCommittedLSN))) { - isQuorumMet = true; - } - - return isQuorumMet; - } - - private enum ReadQuorumResultKind { - QuorumMet, - QuorumSelected, - QuorumNotSelected - } - - private abstract class ReadResult { - private final StoreResult response; - private final RequestChargeTracker requestChargeTracker; - - protected ReadResult(RequestChargeTracker requestChargeTracker, StoreResult response) { - this.requestChargeTracker = requestChargeTracker; - this.response = response; - } - - public StoreResponse getResponse() throws DocumentClientException { - if (!this.isValidResult()) { - logger.error("getResponse called for invalid result"); - throw new InternalServerErrorException(RMResources.InternalServerError); - } - - return this.response.toResponse(requestChargeTracker); - } - - protected abstract boolean isValidResult(); - } - - private class ReadQuorumResult extends ReadResult { - public ReadQuorumResult( - RequestChargeTracker requestChargeTracker, - ReadQuorumResultKind QuorumResult, - long selectedLsn, - long globalCommittedSelectedLsn, - StoreResult selectedResponse, - List storeResponses) { - super(requestChargeTracker, selectedResponse); - - this.quorumResult = QuorumResult; - this.selectedLsn = selectedLsn; - this.globalCommittedSelectedLsn = globalCommittedSelectedLsn; - this.selectedResponse = selectedResponse; - this.storeResponses = storeResponses; - } - - public final ReadQuorumResultKind quorumResult; - - /** - * Response selected to lock on the LSN. This is the response with the highest LSN - */ - public final StoreResult selectedResponse; - - /** - * All store responses from Quorum Read. - */ - public final List storeResponses; - - public final long selectedLsn; - - public final long globalCommittedSelectedLsn; - - protected boolean isValidResult() { - return this.quorumResult == ReadQuorumResultKind.QuorumMet || this.quorumResult == ReadQuorumResultKind.QuorumSelected; - } - } - - private class ReadPrimaryResult extends ReadResult { - public final boolean shouldRetryOnSecondary; - public final boolean isSuccessful; - - public ReadPrimaryResult(RequestChargeTracker requestChargeTracker, boolean isSuccessful, boolean shouldRetryOnSecondary, StoreResult response) { - super(requestChargeTracker, response); - this.isSuccessful = isSuccessful; - this.shouldRetryOnSecondary = shouldRetryOnSecondary; - } - - protected boolean isValidResult() { - return isSuccessful; - } - } - - private enum PrimaryReadOutcome { - QuorumNotMet, // Primary LSN is not committed. - QuorumInconclusive, // Secondary replicas are available. Must read R secondary's to deduce current quorum. - QuorumMet, - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReadMode.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReadMode.java deleted file mode 100644 index ebefc977a38b..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReadMode.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -public enum ReadMode { - Primary, // Test hook - Strong, - BoundedStaleness, - Any -} - diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReplicatedResourceClient.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReplicatedResourceClient.java deleted file mode 100644 index b8d116ef7408..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReplicatedResourceClient.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import java.time.Duration; - -import com.microsoft.azure.cosmosdb.ClientSideRequestStatistics; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.ReplicatedResourceClientUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.Quadruple; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.rx.internal.BackoffRetryUtility; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; - -import rx.Single; -import rx.functions.Func1; -import rx.functions.Func2; - -/** - * ReplicatedResourceClient uses the ConsistencyReader to make requests to - * backend - */ -public class ReplicatedResourceClient { - private final Logger logger = LoggerFactory.getLogger(ReplicatedResourceClient.class); - private static final int GONE_AND_RETRY_WITH_TIMEOUT_IN_SECONDS = 30; - private static final int STRONG_GONE_AND_RETRY_WITH_RETRY_TIMEOUT_SECONDS = 60; - private static final int MIN_BACKOFF_FOR_FAILLING_BACK_TO_OTHER_REGIONS_FOR_READ_REQUESTS_IN_SECONDS = 1; - - private final AddressSelector addressSelector; - private final ConsistencyReader consistencyReader; - private final ConsistencyWriter consistencyWriter; - private final Protocol protocol; - private final TransportClient transportClient; - private final boolean enableReadRequestsFallback; - private final GatewayServiceConfigurationReader serviceConfigReader; - private final Configs configs; - - public ReplicatedResourceClient( - Configs configs, - AddressSelector addressSelector, - ISessionContainer sessionContainer, - TransportClient transportClient, - GatewayServiceConfigurationReader serviceConfigReader, - IAuthorizationTokenProvider authorizationTokenProvider, - boolean enableReadRequestsFallback, - boolean useMultipleWriteLocations) { - this.configs = configs; - this.protocol = configs.getProtocol(); - this.addressSelector = addressSelector; - if (protocol != Protocol.Https && protocol != Protocol.Tcp) { - throw new IllegalArgumentException("protocol"); - } - - this.transportClient = transportClient; - this.serviceConfigReader = serviceConfigReader; - - this.consistencyReader = new ConsistencyReader(configs, - this.addressSelector, - sessionContainer, - transportClient, - serviceConfigReader, - authorizationTokenProvider); - this.consistencyWriter = new ConsistencyWriter( - this.addressSelector, - sessionContainer, - transportClient, - authorizationTokenProvider, - serviceConfigReader, - useMultipleWriteLocations); - this.enableReadRequestsFallback = enableReadRequestsFallback; - } - - public static boolean isReadingFromMaster(ResourceType resourceType, OperationType operationType) { - return ReplicatedResourceClientUtils.isReadingFromMaster(resourceType, operationType); - } - - public static boolean isMasterResource(ResourceType resourceType) { - return ReplicatedResourceClientUtils.isMasterResource(resourceType); - } - - public static boolean isGlobalStrongEnabled() { - return true; - } - - public Single invokeAsync(RxDocumentServiceRequest request, - Func1> prepareRequestAsyncDelegate) { - Func2, RxDocumentServiceRequest, Single> mainFuncDelegate = ( - Quadruple forceRefreshAndTimeout, - RxDocumentServiceRequest documentServiceRequest) -> { - documentServiceRequest.getHeaders().put(HttpConstants.HttpHeaders.CLIENT_RETRY_ATTEMPT_COUNT, - forceRefreshAndTimeout.getValue3().toString()); - documentServiceRequest.getHeaders().put(HttpConstants.HttpHeaders.REMAINING_TIME_IN_MS_ON_CLIENT_REQUEST, - Long.toString(forceRefreshAndTimeout.getValue2().toMillis())); - return invokeAsync(request, new TimeoutHelper(forceRefreshAndTimeout.getValue2()), - forceRefreshAndTimeout.getValue1(), forceRefreshAndTimeout.getValue0()); - - }; - Func1, Single> funcDelegate = ( - Quadruple forceRefreshAndTimeout) -> { - if (prepareRequestAsyncDelegate != null) { - return prepareRequestAsyncDelegate.call(request).flatMap(responseReq -> { - return mainFuncDelegate.call(forceRefreshAndTimeout, responseReq); - }); - } else { - return mainFuncDelegate.call(forceRefreshAndTimeout, request); - } - - }; - - Func1, Single> inBackoffFuncDelegate = null; - - // we will enable fallback to other regions if the following conditions are met: - // 1. request is a read operation AND - // 2. enableReadRequestsFallback is set to true. (can only ever be true if - // direct mode, on client) - if (request.isReadOnlyRequest() && this.enableReadRequestsFallback) { - if (request.requestContext.clientSideRequestStatistics == null) { - request.requestContext.clientSideRequestStatistics = new ClientSideRequestStatistics(); - } - RxDocumentServiceRequest freshRequest = request.clone(); - inBackoffFuncDelegate = (Quadruple forceRefreshAndTimeout) -> { - RxDocumentServiceRequest readRequestClone = freshRequest.clone(); - - if (prepareRequestAsyncDelegate != null) { - return prepareRequestAsyncDelegate.call(readRequestClone).flatMap(responseReq -> { - logger.trace(String.format("Executing inBackoffAlternateCallbackMethod on readRegionIndex {}", - forceRefreshAndTimeout.getValue3())); - responseReq.requestContext.RouteToLocation(forceRefreshAndTimeout.getValue3(), true); - return invokeAsync(responseReq, new TimeoutHelper(forceRefreshAndTimeout.getValue2()), - forceRefreshAndTimeout.getValue1(), - forceRefreshAndTimeout.getValue0()); - }); - } else { - logger.trace(String.format("Executing inBackoffAlternateCallbackMethod on readRegionIndex {}", - forceRefreshAndTimeout.getValue3())); - readRequestClone.requestContext.RouteToLocation(forceRefreshAndTimeout.getValue3(), true); - return invokeAsync(readRequestClone, new TimeoutHelper(forceRefreshAndTimeout.getValue2()), - forceRefreshAndTimeout.getValue1(), - forceRefreshAndTimeout.getValue0()); - } - - }; - } - - int retryTimeout = this.serviceConfigReader.getDefaultConsistencyLevel() == ConsistencyLevel.Strong ? - ReplicatedResourceClient.STRONG_GONE_AND_RETRY_WITH_RETRY_TIMEOUT_SECONDS : - ReplicatedResourceClient.GONE_AND_RETRY_WITH_TIMEOUT_IN_SECONDS; - - return BackoffRetryUtility.executeAsync(funcDelegate, new GoneAndRetryWithRetryPolicy(request, retryTimeout), - inBackoffFuncDelegate, Duration.ofSeconds( - ReplicatedResourceClient.MIN_BACKOFF_FOR_FAILLING_BACK_TO_OTHER_REGIONS_FOR_READ_REQUESTS_IN_SECONDS)); - } - - private Single invokeAsync(RxDocumentServiceRequest request, TimeoutHelper timeout, - boolean isInRetry, boolean forceRefresh) { - - if (request.getOperationType().equals(OperationType.ExecuteJavaScript)) { - if (request.isReadOnlyScript()) { - return this.consistencyReader.readAsync(request, timeout, isInRetry, forceRefresh); - } else { - return this.consistencyWriter.writeAsync(request, timeout, forceRefresh); - } - } else if (request.getOperationType().isWriteOperation()) { - return this.consistencyWriter.writeAsync(request, timeout, forceRefresh); - } else if (request.isReadOnlyRequest()) { - return this.consistencyReader.readAsync(request, timeout, isInRetry, forceRefresh); - } else { - throw new IllegalArgumentException( - String.format("Unexpected operation type %s", request.getOperationType())); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RequestEntityTooLargeException.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RequestEntityTooLargeException.java deleted file mode 100644 index 1c8a33835e5e..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RequestEntityTooLargeException.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.util.Map; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class RequestEntityTooLargeException extends DocumentClientException { - private static final long serialVersionUID = 1L; - - public RequestEntityTooLargeException() { - this(RMResources.RequestEntityTooLarge); - } - - public RequestEntityTooLargeException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.REQUEST_ENTITY_TOO_LARGE, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public RequestEntityTooLargeException(String msg) { - super(HttpConstants.StatusCodes.REQUEST_ENTITY_TOO_LARGE, msg); - } - - public RequestEntityTooLargeException(String msg, String resourceAddress) { - super(msg, null, null, HttpConstants.StatusCodes.REQUEST_ENTITY_TOO_LARGE, resourceAddress); - } - - public RequestEntityTooLargeException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public RequestEntityTooLargeException(Exception innerException) { - this(RMResources.RequestEntityTooLarge, innerException, null, null); - } - - public RequestEntityTooLargeException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - super(String.format(RMResources.RequestEntityTooLarge, message), - innerException, - HttpUtils.asMap(headers), - HttpConstants.StatusCodes.REQUEST_ENTITY_TOO_LARGE, - requestUri); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RequestHelper.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RequestHelper.java deleted file mode 100644 index 5eb93d0acd8a..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RequestHelper.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import org.apache.commons.lang3.EnumUtils; - -public class RequestHelper { - public static ConsistencyLevel GetConsistencyLevelToUse(GatewayServiceConfigurationReader serviceConfigReader, - RxDocumentServiceRequest request) throws DocumentClientException { - ConsistencyLevel consistencyLevelToUse = serviceConfigReader.getDefaultConsistencyLevel(); - - String requestConsistencyLevelHeaderValue = request.getHeaders().get(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL); - - if (!Strings.isNullOrEmpty(requestConsistencyLevelHeaderValue)) { - ConsistencyLevel requestConsistencyLevel = EnumUtils.getEnum(ConsistencyLevel.class, requestConsistencyLevelHeaderValue); - if (requestConsistencyLevel == null) { - throw new BadRequestException( - String.format( - RMResources.InvalidHeaderValue, - requestConsistencyLevelHeaderValue, - HttpConstants.HttpHeaders.CONSISTENCY_LEVEL)); - } - - consistencyLevelToUse = requestConsistencyLevel; - } - - return consistencyLevelToUse; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RequestRateTooLargeException.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RequestRateTooLargeException.java deleted file mode 100644 index 1d5c315bade1..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RequestRateTooLargeException.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.net.URI; -import java.util.Map; - -public class RequestRateTooLargeException extends DocumentClientException { - - public RequestRateTooLargeException() { - this(RMResources.TooManyRequests, null); - } - - public RequestRateTooLargeException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.NOTFOUND, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public RequestRateTooLargeException(String message, URI requestUri) { - this(message, (Exception) null, (HttpResponseHeaders) null, requestUri); - } - - public RequestRateTooLargeException(String message, - Exception innerException, - URI requestUri) { - this(message, innerException, (HttpResponseHeaders) null, requestUri); - } - - public RequestRateTooLargeException(Exception innerException) { - this(RMResources.TooManyRequests, innerException, (HttpResponseHeaders) null, null); - } - - public RequestRateTooLargeException(String message, HttpResponseHeaders headers, URI requestUri) { - super(message, null, HttpUtils.asMap(headers), HttpConstants.StatusCodes.TOO_MANY_REQUESTS, requestUri != null ? requestUri.toString() : null); - } - - public RequestRateTooLargeException(String message, HttpResponseHeaders headers, String requestUri) { - super(message, null, HttpUtils.asMap(headers), HttpConstants.StatusCodes.TOO_MANY_REQUESTS, requestUri); - } - - public RequestRateTooLargeException(String message, - Exception innerException, - HttpResponseHeaders headers, - URI requestUri) { - super(message, innerException, HttpUtils.asMap(headers), HttpConstants.StatusCodes.TOO_MANY_REQUESTS, requestUri != null ? requestUri.toString() : null); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ResourceOperation.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ResourceOperation.java deleted file mode 100644 index e51367dea91d..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ResourceOperation.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; - -public class ResourceOperation { - public final OperationType operationType; - public final ResourceType resourceType; - - public ResourceOperation( - OperationType operationType, - ResourceType resourceType) { - this.operationType = operationType; - this.resourceType = resourceType; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ResponseUtils.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ResponseUtils.java deleted file mode 100644 index c37c7bef907a..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ResponseUtils.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import io.netty.buffer.ByteBuf; -import io.netty.handler.codec.http.HttpResponseStatus; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; -import org.apache.commons.io.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Observable; -import rx.Single; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; - -class ResponseUtils { - private final static int INITIAL_RESPONSE_BUFFER_SIZE = 1024; - private final static Logger logger = LoggerFactory.getLogger(ResponseUtils.class); - - public static Observable toString(Observable contentObservable) { - return contentObservable - .reduce( - new ByteArrayOutputStream(INITIAL_RESPONSE_BUFFER_SIZE), - (out, bb) -> { - try { - bb.readBytes(out, bb.readableBytes()); - return out; - } catch (IOException e) { - throw new RuntimeException(e); - } - }) - .map(out -> { - return new String(out.toByteArray(), StandardCharsets.UTF_8); - }); - } - - public static Single toStoreResponse(HttpClientResponse clientResponse) { - - HttpResponseHeaders httpResponseHeaders = clientResponse.getHeaders(); - HttpResponseStatus httpResponseStatus = clientResponse.getStatus(); - - Observable contentObservable; - - if (clientResponse.getContent() == null) { - // for delete we don't expect any body - contentObservable = Observable.just(null); - } else { - // transforms the observable to Observable - contentObservable = toString(clientResponse.getContent()); - } - - Observable storeResponseObservable = contentObservable - .flatMap(content -> { - try { - // transforms to Observable - StoreResponse rsp = new StoreResponse(httpResponseStatus.code(), HttpUtils.unescape(httpResponseHeaders.entries()), content); - return Observable.just(rsp); - } catch (Exception e) { - return Observable.error(e); - } - }); - - return storeResponseObservable.toSingle(); - } - - private static void validateOrThrow(RxDocumentServiceRequest request, HttpResponseStatus status, HttpResponseHeaders headers, String body, - InputStream inputStream) throws DocumentClientException { - - int statusCode = status.code(); - - if (statusCode >= HttpConstants.StatusCodes.MINIMUM_STATUSCODE_AS_ERROR_GATEWAY) { - if (body == null && inputStream != null) { - try { - body = IOUtils.toString(inputStream, StandardCharsets.UTF_8); - } catch (IOException e) { - logger.error("Failed to get content from the http response", e); - throw new IllegalStateException("Failed to get content from the http response", e); - } finally { - IOUtils.closeQuietly(inputStream); - } - } - - String statusCodeString = status.reasonPhrase() != null - ? status.reasonPhrase().replace(" ", "") - : ""; - Error error = null; - error = (body != null) ? new Error(body) : new Error(); - error = new Error(statusCodeString, - String.format("%s, StatusCode: %s", error.getMessage(), statusCodeString), - error.getPartitionedQueryExecutionInfo()); - - throw new DocumentClientException(statusCode, error, HttpUtils.asMap(headers)); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RetryWithException.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RetryWithException.java deleted file mode 100644 index df32963da686..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RetryWithException.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.net.URI; -import java.util.Map; - -public class RetryWithException extends DocumentClientException { - - public RetryWithException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.RETRY_WITH, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public RetryWithException(String message, URI requestUri) { - this(message, (Exception) null, (HttpResponseHeaders) null, requestUri); - } - - public RetryWithException(String message, - Exception innerException, - URI requestUri) { - this(message, innerException, (HttpResponseHeaders) null, requestUri); - } - - public RetryWithException(String message, HttpResponseHeaders headers, URI requestUri) { - super(message, null, HttpUtils.asMap(headers), HttpConstants.StatusCodes.RETRY_WITH, requestUri != null ? requestUri.toString() : null); - } - - public RetryWithException(String message, HttpResponseHeaders headers, String requestUri) { - super(message, null, HttpUtils.asMap(headers), HttpConstants.StatusCodes.RETRY_WITH, requestUri); - } - - public RetryWithException(String message, - Exception innerException, - HttpResponseHeaders headers, - URI requestUri) { - super(message, innerException, HttpUtils.asMap(headers), HttpConstants.StatusCodes.RETRY_WITH, requestUri != null ? requestUri.toString() : null); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RntbdTransportClient.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RntbdTransportClient.java deleted file mode 100644 index adec62b59bef..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RntbdTransportClient.java +++ /dev/null @@ -1,393 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdEndpoint; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdMetrics; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdObjectMapper; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdRequestArgs; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdServiceEndpoint; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import io.netty.handler.ssl.SslContext; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Single; -import rx.SingleEmitter; - -import java.io.IOException; -import java.net.URI; -import java.time.Duration; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionException; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicLong; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdReporter.reportIssueUnless; - -@JsonSerialize(using = RntbdTransportClient.JsonSerializer.class) -public final class RntbdTransportClient extends TransportClient implements AutoCloseable { - - // region Fields - - private static final AtomicLong instanceCount = new AtomicLong(); - private static final Logger logger = LoggerFactory.getLogger(RntbdTransportClient.class); - private static final String namePrefix = RntbdTransportClient.class.getSimpleName() + '-'; - - private final AtomicBoolean closed = new AtomicBoolean(); - private final RntbdEndpoint.Provider endpointProvider; - private final RntbdMetrics metrics; - private final String name; - - // endregion - - // region Constructors - - RntbdTransportClient(final RntbdEndpoint.Provider endpointProvider) { - this.name = RntbdTransportClient.namePrefix + RntbdTransportClient.instanceCount.incrementAndGet(); - this.endpointProvider = endpointProvider; - this.metrics = new RntbdMetrics(this.name); - } - - RntbdTransportClient(final Options options, final SslContext sslContext) { - this(new RntbdServiceEndpoint.Provider(options, sslContext)); - } - - RntbdTransportClient(final Configs configs, final int requestTimeoutInSeconds, final UserAgentContainer userAgent) { - this(new Options.Builder(requestTimeoutInSeconds).userAgent(userAgent).build(), configs.getSslContext()); - } - - // endregion - - // region Methods - - @Override - public void close() { - - logger.debug("\n [{}] CLOSE", this); - - if (this.closed.compareAndSet(false, true)) { - this.endpointProvider.close(); - this.metrics.close(); - return; - } - - logger.debug("\n [{}]\n already closed", this); - } - - @Override - public Single invokeStoreAsync( - final URI physicalAddress, final ResourceOperation unused, final RxDocumentServiceRequest request - ) { - checkNotNull(physicalAddress, "physicalAddress"); - checkNotNull(request, "request"); - this.throwIfClosed(); - - final RntbdRequestArgs requestArgs = new RntbdRequestArgs(request, physicalAddress); - - if (logger.isDebugEnabled()) { - requestArgs.traceOperation(logger, null, "invokeStoreAsync"); - logger.debug("\n [{}]\n {}\n INVOKE_STORE_ASYNC", this, requestArgs); - } - - final RntbdEndpoint endpoint = this.endpointProvider.get(physicalAddress); - this.metrics.incrementRequestCount(); - - final CompletableFuture future = endpoint.request(requestArgs); - - return Single.fromEmitter((SingleEmitter emitter) -> { - - future.whenComplete((response, error) -> { - - requestArgs.traceOperation(logger, null, "emitSingle", response, error); - this.metrics.incrementResponseCount(); - - if (error == null) { - emitter.onSuccess(response); - } else { - if (!(error instanceof DocumentClientException)) { - logger.warn("{} expected failure of {}, not ", requestArgs, DocumentClientException.class, error); - } - this.metrics.incrementErrorResponseCount(); - emitter.onError(error instanceof CompletionException ? error.getCause() : error); - } - - requestArgs.traceOperation(logger, null, "emitSingleComplete"); - }); - }); - } - - @Override - public String toString() { - return RntbdObjectMapper.toJson(this); - } - - private void throwIfClosed() { - checkState(!this.closed.get(), "%s is closed", this); - } - - // endregion - - // region Types - - static final class JsonSerializer extends StdSerializer { - - public JsonSerializer() { - this(null); - } - - public JsonSerializer(Class type) { - super(type); - } - - @Override - public void serialize(RntbdTransportClient value, JsonGenerator generator, SerializerProvider provider) throws IOException { - - generator.writeStartObject(); - - generator.writeArrayFieldStart(value.name); - - value.endpointProvider.list().forEach(endpoint -> { - try { - generator.writeObject(endpoint); - } catch (IOException error) { - logger.error("failed to serialize {} due to ", endpoint.getName(), error); - } - }); - - generator.writeEndArray(); - - generator.writeObjectField("config", value.endpointProvider.config()); - generator.writeObjectField("metrics", value.metrics); - generator.writeEndObject(); - } - } - - public static final class Options { - - // region Fields - - private final String certificateHostNameOverride; - private final int maxChannelsPerEndpoint; - private final int maxRequestsPerChannel; - private final Duration connectionTimeout; - private final int partitionCount; - private final Duration receiveHangDetectionTime; - private final Duration requestTimeout; - private final Duration sendHangDetectionTime; - private final UserAgentContainer userAgent; - - // endregion - - // region Constructors - - private Options(Builder builder) { - - this.certificateHostNameOverride = builder.certificateHostNameOverride; - this.maxChannelsPerEndpoint = builder.maxChannelsPerEndpoint; - this.maxRequestsPerChannel = builder.maxRequestsPerChannel; - this.connectionTimeout = builder.connectionTimeout == null ? builder.requestTimeout : builder.connectionTimeout; - this.partitionCount = builder.partitionCount; - this.requestTimeout = builder.requestTimeout; - this.receiveHangDetectionTime = builder.receiveHangDetectionTime; - this.sendHangDetectionTime = builder.sendHangDetectionTime; - this.userAgent = builder.userAgent; - } - - // endregion - - // region Accessors - - public String getCertificateHostNameOverride() { - return this.certificateHostNameOverride; - } - - public int getMaxChannelsPerEndpoint() { - return this.maxChannelsPerEndpoint; - } - - public int getMaxRequestsPerChannel() { - return this.maxRequestsPerChannel; - } - - public Duration getConnectionTimeout() { - return this.connectionTimeout; - } - - public int getPartitionCount() { - return this.partitionCount; - } - - public Duration getReceiveHangDetectionTime() { - return this.receiveHangDetectionTime; - } - - public Duration getRequestTimeout() { - return this.requestTimeout; - } - - public Duration getSendHangDetectionTime() { - return this.sendHangDetectionTime; - } - - public UserAgentContainer getUserAgent() { - return this.userAgent; - } - - // endregion - - // region Methods - - @Override - public String toString() { - return RntbdObjectMapper.toJson(this); - } - - // endregion - - // region Types - - public static class Builder { - - // region Fields - - private static final UserAgentContainer DEFAULT_USER_AGENT_CONTAINER = new UserAgentContainer(); - private static final Duration SIXTY_FIVE_SECONDS = Duration.ofSeconds(65L); - private static final Duration TEN_SECONDS = Duration.ofSeconds(10L); - - // Required parameters - - private String certificateHostNameOverride = null; - - // Optional parameters - - private int maxChannelsPerEndpoint = 10; - private int maxRequestsPerChannel = 30; - private Duration connectionTimeout = null; - private int partitionCount = 1; - private Duration receiveHangDetectionTime = SIXTY_FIVE_SECONDS; - private Duration requestTimeout; - private Duration sendHangDetectionTime = TEN_SECONDS; - private UserAgentContainer userAgent = DEFAULT_USER_AGENT_CONTAINER; - - // endregion - - // region Constructors - - public Builder(Duration requestTimeout) { - this.requestTimeout(requestTimeout); - } - - public Builder(int requestTimeoutInSeconds) { - this(Duration.ofSeconds(requestTimeoutInSeconds)); - } - - // endregion - - // region Methods - - public Options build() { - return new Options(this); - } - - public Builder certificateHostNameOverride(final String value) { - this.certificateHostNameOverride = value; - return this; - } - - public Builder connectionTimeout(final Duration value) { - checkArgument(value == null || value.compareTo(Duration.ZERO) > 0, "value: %s", value); - this.connectionTimeout = value; - return this; - } - - public Builder maxRequestsPerChannel(final int value) { - checkArgument(value > 0, "value: %s", value); - this.maxRequestsPerChannel = value; - return this; - } - - public Builder maxChannelsPerEndpoint(final int value) { - checkArgument(value > 0, "value: %s", value); - this.maxChannelsPerEndpoint = value; - return this; - } - - public Builder partitionCount(final int value) { - checkArgument(value > 0, "value: %s", value); - this.partitionCount = value; - return this; - } - - public Builder receiveHangDetectionTime(final Duration value) { - - checkNotNull(value, "value: null"); - checkArgument(value.compareTo(Duration.ZERO) > 0, "value: %s", value); - - this.receiveHangDetectionTime = value; - return this; - } - - public Builder requestTimeout(final Duration value) { - - checkNotNull(value, "value: null"); - checkArgument(value.compareTo(Duration.ZERO) > 0, "value: %s", value); - - this.requestTimeout = value; - return this; - } - - public Builder sendHangDetectionTime(final Duration value) { - - checkNotNull(value, "value: null"); - checkArgument(value.compareTo(Duration.ZERO) > 0, "value: %s", value); - - this.sendHangDetectionTime = value; - return this; - } - - public Builder userAgent(final UserAgentContainer value) { - checkNotNull(value, "value: null"); - this.userAgent = value; - return this; - } - - // endregion - } - - // endregion - } - - // endregion -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ServerProperties.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ServerProperties.java deleted file mode 100644 index d8a84ba78d61..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ServerProperties.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -final public class ServerProperties { - - final private String agent, version; - - public ServerProperties(String agent, String version) { - this.agent = agent; - this.version = version; - } - - public String getAgent() { - return this.agent; - } - - public String getVersion() { - return this.version; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ServerStoreModel.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ServerStoreModel.java deleted file mode 100644 index c21ad28d13e0..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ServerStoreModel.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - - -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; -import com.microsoft.azure.cosmosdb.rx.internal.RxStoreModel; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import org.apache.commons.lang3.EnumUtils; -import rx.Observable; -import rx.Single; - -public class ServerStoreModel implements RxStoreModel { - private final StoreClient storeClient; - - public ServerStoreModel(StoreClient storeClient) { - this.storeClient = storeClient; - } - - public Observable processMessage(RxDocumentServiceRequest request) { - String requestConsistencyLevelHeaderValue = request.getHeaders().get(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL); - - request.requestContext.originalRequestConsistencyLevel = null; - - if (!Strings.isNullOrEmpty(requestConsistencyLevelHeaderValue)) { - ConsistencyLevel requestConsistencyLevel; - - if ((requestConsistencyLevel = EnumUtils.getEnum(ConsistencyLevel.class, requestConsistencyLevelHeaderValue)) == null) { - return Observable.error(new BadRequestException( - String.format( - RMResources.InvalidHeaderValue, - requestConsistencyLevelHeaderValue, - HttpConstants.HttpHeaders.CONSISTENCY_LEVEL))); - } - - request.requestContext.originalRequestConsistencyLevel = requestConsistencyLevel; - } - - if (ReplicatedResourceClient.isMasterResource(request.getResourceType())) { - request.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Strong.toString()); - } - - Single response = this.storeClient.processMessageAsync(request); - return response.toObservable(); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ServiceConfig.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ServiceConfig.java deleted file mode 100644 index 25ae57544ce5..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ServiceConfig.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -class ServiceConfig { - final static ServiceConfig instance = new ServiceConfig(); - public SystemReplicationPolicy systemReplicationPolicy = new SystemReplicationPolicy(); - public SystemReplicationPolicy userReplicationPolicy = new SystemReplicationPolicy(); - - public static ServiceConfig getInstance() { - return instance; - } - - class SystemReplicationPolicy { - public static final int MaxReplicaSetSize = 4; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ServiceUnavailableException.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ServiceUnavailableException.java deleted file mode 100644 index e028912a9068..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ServiceUnavailableException.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.net.URI; -import java.util.Map; - -public class ServiceUnavailableException extends DocumentClientException { - public ServiceUnavailableException() { - this(RMResources.ServiceUnavailable); - } - - public ServiceUnavailableException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.NOTFOUND, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public ServiceUnavailableException(String message) { - this(message, (Exception) null, (HttpResponseHeaders) null, null); - } - - public ServiceUnavailableException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public ServiceUnavailableException(String message, HttpResponseHeaders headers, URI requestUri) { - this(message, headers, requestUri != null ? requestUri.toString() : null); - } - - public ServiceUnavailableException(Exception innerException) { - this(RMResources.ServiceUnavailable, innerException, null, null); - } - - public ServiceUnavailableException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - super(String.format("%s: %s", RMResources.ServiceUnavailable, message), - innerException, - HttpUtils.asMap(headers), - HttpConstants.StatusCodes.SERVICE_UNAVAILABLE, - requestUri != null ? requestUri.toString() : null); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreClient.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreClient.java deleted file mode 100644 index f51634e9a31c..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreClient.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.ISessionToken; -import com.microsoft.azure.cosmosdb.internal.InternalServerErrorException; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.SessionContainer; -import com.microsoft.azure.cosmosdb.internal.SessionTokenHelper; -import com.microsoft.azure.cosmosdb.rx.internal.BackoffRetryUtility; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.Exceptions; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.IRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import org.apache.commons.lang3.math.NumberUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Single; -import rx.functions.Func0; -import rx.functions.Func1; - -import java.util.HashMap; -import java.util.Map; - -/** - * Instantiated to issue direct connectivity requests to the backend on: - * - Gateway (for gateway mode clients) - * - Client (for direct mode clients) - * StoreClient uses the ReplicatedResourceClient to make requests to the backend. - */ -public class StoreClient implements IStoreClient { - private final Logger logger = LoggerFactory.getLogger(StoreClient.class); - private final GatewayServiceConfigurationReader serviceConfigurationReader; - - private final SessionContainer sessionContainer; - private final ReplicatedResourceClient replicatedResourceClient; - private final TransportClient transportClient; - private final String ZERO_PARTITION_KEY_RANGE = "0"; - - public StoreClient( - Configs configs, - IAddressResolver addressResolver, - SessionContainer sessionContainer, - GatewayServiceConfigurationReader serviceConfigurationReader, IAuthorizationTokenProvider userTokenProvider, - TransportClient transportClient, - boolean useMultipleWriteLocations) { - this.transportClient = transportClient; - this.sessionContainer = sessionContainer; - this.serviceConfigurationReader = serviceConfigurationReader; - this.replicatedResourceClient = new ReplicatedResourceClient( - configs, - new AddressSelector(addressResolver, configs.getProtocol()), - sessionContainer, - this.transportClient, - serviceConfigurationReader, - userTokenProvider, - false, - useMultipleWriteLocations); - } - - @Override - public Single processMessageAsync(RxDocumentServiceRequest request, IRetryPolicy retryPolicy, Func1> prepareRequestAsyncDelegate) { - if (request == null) { - throw new NullPointerException("request"); - } - - Func0> storeResponseDelegate = () -> this.replicatedResourceClient.invokeAsync(request, prepareRequestAsyncDelegate); - - Single storeResponse = retryPolicy != null - ? BackoffRetryUtility.executeRetry(storeResponseDelegate, retryPolicy) - : storeResponseDelegate.call(); - - storeResponse = storeResponse.doOnError(e -> { - try { - DocumentClientException exception = Utils.as(e, DocumentClientException.class); - - if (exception == null) { - return; - } - - exception.setClientSideRequestStatistics(request.requestContext.clientSideRequestStatistics); - - handleUnsuccessfulStoreResponse(request, exception); - } catch (Throwable throwable) { - logger.error("Unexpected failure in handling orig [{}]", e.getMessage(), e); - logger.error("Unexpected failure in handling orig [{}] : new [{}]", e.getMessage(), throwable.getMessage(), throwable); - } - } - ); - - return storeResponse.flatMap(sr -> { - try { - return Single.just(this.completeResponse(sr, request)); - } catch (Exception e) { - return Single.error(e); - } - }); - } - - private void handleUnsuccessfulStoreResponse(RxDocumentServiceRequest request, DocumentClientException exception) { - this.updateResponseHeader(request, exception.getResponseHeaders()); - if ((!ReplicatedResourceClient.isMasterResource(request.getResourceType())) && - (Exceptions.isStatusCode(exception, HttpConstants.StatusCodes.PRECONDITION_FAILED) || Exceptions.isStatusCode(exception, HttpConstants.StatusCodes.CONFLICT) || - (Exceptions.isStatusCode(exception, HttpConstants.StatusCodes.NOTFOUND) && - !Exceptions.isSubStatusCode(exception, HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE)))) { - this.captureSessionToken(request, exception.getResponseHeaders()); - } - } - - private RxDocumentServiceResponse completeResponse( - StoreResponse storeResponse, - RxDocumentServiceRequest request) throws InternalServerErrorException { - if (storeResponse.getResponseHeaderNames().length != storeResponse.getResponseHeaderValues().length) { - throw new InternalServerErrorException(RMResources.InvalidBackendResponse); - } - - Map headers = new HashMap<>(storeResponse.getResponseHeaderNames().length); - for (int idx = 0; idx < storeResponse.getResponseHeaderNames().length; idx++) { - String name = storeResponse.getResponseHeaderNames()[idx]; - String value = storeResponse.getResponseHeaderValues()[idx]; - - headers.put(name, value); - } - - this.updateResponseHeader(request, headers); - this.captureSessionToken(request, headers); - storeResponse.setClientSideRequestStatistics(request.requestContext.clientSideRequestStatistics); - return new RxDocumentServiceResponse(storeResponse); - } - - private long getLSN(Map headers) { - long defaultValue = -1; - String value = headers.get(WFConstants.BackendHeaders.LSN); - - if (!Strings.isNullOrEmpty(value)) { - return NumberUtils.toLong(value, defaultValue); - - } - - return defaultValue; - } - - private void updateResponseHeader(RxDocumentServiceRequest request, Map headers) { - String requestConsistencyLevel = request.getHeaders().get(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL); - - boolean sessionConsistency = - this.serviceConfigurationReader.getDefaultConsistencyLevel() == ConsistencyLevel.Session || - (!Strings.isNullOrEmpty(requestConsistencyLevel) - && Strings.areEqualIgnoreCase(requestConsistencyLevel, ConsistencyLevel.Session.name())); - - long storeLSN = this.getLSN(headers); - if (storeLSN == -1) { - return; - } - - String partitionKeyRangeId = headers.get(WFConstants.BackendHeaders.PARTITION_KEY_RANGE_ID); - - if (Strings.isNullOrEmpty(partitionKeyRangeId)) { - String inputSession = request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); - if (!Strings.isNullOrEmpty(inputSession) - && inputSession.indexOf(ISessionToken.PARTITION_KEY_RANGE_SESSION_SEPARATOR) >= 1) { - partitionKeyRangeId = inputSession.substring(0, - inputSession.indexOf(ISessionToken.PARTITION_KEY_RANGE_SESSION_SEPARATOR)); - } else { - partitionKeyRangeId = ZERO_PARTITION_KEY_RANGE; - } - } - - ISessionToken sessionToken = null; - String sessionTokenResponseHeader = headers.get(HttpConstants.HttpHeaders.SESSION_TOKEN); - if (!Strings.isNullOrEmpty(sessionTokenResponseHeader)) { - sessionToken = SessionTokenHelper.parse(sessionTokenResponseHeader); - } - - if (sessionToken != null) { - headers.put(HttpConstants.HttpHeaders.SESSION_TOKEN, String.format( - "%s:%s", - partitionKeyRangeId, - sessionToken.convertToString())); - } - - headers.remove(WFConstants.BackendHeaders.PARTITION_KEY_RANGE_ID); - } - - private void captureSessionToken(RxDocumentServiceRequest request, Map headers) { - if (request.getResourceType() == ResourceType.DocumentCollection - && request.getOperationType() == OperationType.Delete) { - String resourceId; - if (request.getIsNameBased()) { - resourceId = headers.get(HttpConstants.HttpHeaders.OWNER_ID); - } else { - resourceId = request.getResourceId(); - } - this.sessionContainer.clearTokenByResourceId(resourceId); - } else { - this.sessionContainer.setSessionToken(request, headers); - } - } - - // TODO RNTBD support - // https://msdata.visualstudio.com/CosmosDB/SDK/_workitems/edit/262496 -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreClientFactory.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreClientFactory.java deleted file mode 100644 index 7409f7f8e005..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreClientFactory.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.internal.SessionContainer; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; - -// TODO: DANOBLE: no support for ICommunicationEventSource ask Ji -// Links: -// https://msdata.visualstudio.com/CosmosDB/SDK/_workitems/edit/262496 - -public class StoreClientFactory implements AutoCloseable { - private final Configs configs; - private final int maxConcurrentConnectionOpenRequests; - private final int requestTimeoutInSeconds; - private final Protocol protocol; - private final TransportClient transportClient; - private volatile boolean isClosed; - - public StoreClientFactory( - Configs configs, - int requestTimeoutInSeconds, - int maxConcurrentConnectionOpenRequests, - UserAgentContainer userAgent) { - - this.configs = configs; - this.protocol = configs.getProtocol(); - this.requestTimeoutInSeconds = requestTimeoutInSeconds; - this.maxConcurrentConnectionOpenRequests = maxConcurrentConnectionOpenRequests; - - if (protocol == Protocol.Https) { - this.transportClient = new HttpTransportClient(configs, requestTimeoutInSeconds, userAgent); - } else if (protocol == Protocol.Tcp){ - this.transportClient = new RntbdTransportClient(configs, requestTimeoutInSeconds, userAgent); - } else { - throw new IllegalArgumentException(String.format("protocol: %s", this.protocol)); - } - } - - public void close() throws Exception { - this.transportClient.close(); - this.isClosed = true; - } - - // TODO wew don't have support for the following yet - // TODO enableReadRequestsFallback ask Ji - // TODO useFallbackClient ask Ji - public StoreClient createStoreClient( - IAddressResolver addressResolver, - SessionContainer sessionContainer, - GatewayServiceConfigurationReader serviceConfigurationReader, - IAuthorizationTokenProvider authorizationTokenProvider, - boolean useMultipleWriteLocations) { - this.throwIfClosed(); - - return new StoreClient(configs, - addressResolver, - sessionContainer, - serviceConfigurationReader, - authorizationTokenProvider, - this.transportClient, - useMultipleWriteLocations); - } - - private void throwIfClosed() { - if (isClosed) { - throw new IllegalStateException("storeClient already closed!"); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreReader.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreReader.java deleted file mode 100644 index b9d92218f315..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreReader.java +++ /dev/null @@ -1,896 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ClientSideRequestStatistics; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.ISessionToken; -import com.microsoft.azure.cosmosdb.internal.Integers; -import com.microsoft.azure.cosmosdb.internal.InternalServerErrorException; -import com.microsoft.azure.cosmosdb.internal.MutableVolatile; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.SessionTokenHelper; -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionIsMigratingException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionKeyRangeIsSplittingException; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.Pair; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Observable; -import rx.Single; -import rx.exceptions.CompositeException; -import rx.schedulers.Schedulers; - -import java.net.URI; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.ThreadLocalRandom; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; - -import static com.microsoft.azure.cosmosdb.rx.internal.Exceptions.isSubStatusCode; - -public class StoreReader { - private final Logger logger = LoggerFactory.getLogger(StoreReader.class); - private final TransportClient transportClient; - private final AddressSelector addressSelector; - private final ISessionContainer sessionContainer; - private String lastReadAddress; - - public StoreReader( - TransportClient transportClient, - AddressSelector addressSelector, - ISessionContainer sessionContainer) { - this.transportClient = transportClient; - this.addressSelector = addressSelector; - this.sessionContainer = sessionContainer; - } - - public Single> readMultipleReplicaAsync( - RxDocumentServiceRequest entity, - boolean includePrimary, - int replicaCountToRead, - boolean requiresValidLsn, - boolean useSessionToken, - ReadMode readMode) { - return readMultipleReplicaAsync(entity, includePrimary, replicaCountToRead, requiresValidLsn, useSessionToken, readMode, false, false); - } - - /** - * Makes requests to multiple replicas at once and returns responses - * @param entity RxDocumentServiceRequest - * @param includePrimary flag to indicate whether to indicate primary replica in the reads - * @param replicaCountToRead number of replicas to read from - * @param requiresValidLsn flag to indicate whether a valid lsn is required to consider a response as valid - * @param useSessionToken flag to indicate whether to use session token - * @param readMode Read mode - * @param checkMinLSN set minimum required session lsn - * @param forceReadAll reads from all available replicas to gather result from readsToRead number of replicas - * @return ReadReplicaResult which indicates the LSN and whether Quorum was Met / Not Met etc - */ - public Single> readMultipleReplicaAsync( - RxDocumentServiceRequest entity, - boolean includePrimary, - int replicaCountToRead, - boolean requiresValidLsn, - boolean useSessionToken, - ReadMode readMode, - boolean checkMinLSN, - boolean forceReadAll) { - - if (entity.requestContext.timeoutHelper.isElapsed()) { - return Single.error(new GoneException()); - } - - String originalSessionToken = entity.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); - - if (entity.requestContext.clientSideRequestStatistics == null) { - entity.requestContext.clientSideRequestStatistics = new ClientSideRequestStatistics(); - } - - Single readQuorumResultObs = this.readMultipleReplicasInternalAsync( - entity, includePrimary, replicaCountToRead, requiresValidLsn, useSessionToken, readMode, checkMinLSN, forceReadAll); - - return readQuorumResultObs.flatMap(readQuorumResult -> { - if (entity.requestContext.performLocalRefreshOnGoneException && - readQuorumResult.retryWithForceRefresh && - !entity.requestContext.forceRefreshAddressCache) { - if (entity.requestContext.timeoutHelper.isElapsed()) { - return Single.error(new GoneException()); - } - - entity.requestContext.forceRefreshAddressCache = true; - - return this.readMultipleReplicasInternalAsync( - entity, includePrimary, replicaCountToRead, requiresValidLsn, useSessionToken, readMode, false /*checkMinLSN*/, forceReadAll) - .map(r -> r.responses); - } else { - return Single.just(readQuorumResult.responses); - } - }).toObservable().doAfterTerminate(() -> { - SessionTokenHelper.setOriginalSessionToken(entity, originalSessionToken); - }).toSingle(); - } - - private Observable earlyResultIfNotEnoughReplicas(List replicaAddresses, - RxDocumentServiceRequest request, - int replicaCountToRead) { - if (replicaAddresses.size() < replicaCountToRead) { - // if not enough replicas, return ReadReplicaResult - if (!request.requestContext.forceRefreshAddressCache) { - return Observable.just(new ReadReplicaResult(true /*retryWithForceRefresh*/, Collections.emptyList())); - } else { - return Observable.just(new ReadReplicaResult(false /*retryWithForceRefresh*/, Collections.emptyList())); - } - } else { - // if there are enough replicas, move on - return Observable.empty(); - } - } - - private Observable toStoreResult(RxDocumentServiceRequest request, - Pair, URI> storeRespAndURI, - ReadMode readMode, - boolean requiresValidLsn) { - - return storeRespAndURI.getLeft() - .flatMap(storeResponse -> { - try { - StoreResult storeResult = this.createStoreResult( - storeResponse, - null, requiresValidLsn, - readMode != ReadMode.Strong, - storeRespAndURI.getRight()); - - request.requestContext.clientSideRequestStatistics.getContactedReplicas().add(storeRespAndURI.getRight()); - return Observable.just(storeResult); - } catch (Exception e) { - // RxJava1 doesn't allow throwing checked exception from Observable operators - return Observable.error(e); - } - } - ).onErrorResumeNext(t -> { - - try { - logger.debug("Exception {} is thrown while doing readMany", t); - Exception storeException = Utils.as(t, Exception.class); - if (storeException == null) { - return Observable.error(t); - } - -// Exception storeException = readTask.Exception != null ? readTask.Exception.InnerException : null; - StoreResult storeResult = this.createStoreResult( - null, - storeException, requiresValidLsn, - readMode != ReadMode.Strong, - null); - if (storeException instanceof TransportException) { - request.requestContext.clientSideRequestStatistics.getFailedReplicas().add(storeRespAndURI.getRight()); - } - return Observable.just(storeResult); - } catch (Exception e) { - // RxJava1 doesn't allow throwing checked exception from Observable operators - return Observable.error(e); - } - }); - } - - private Observable> readFromReplicas(List resultCollector, - List resolveApiResults, - final AtomicInteger replicasToRead, - RxDocumentServiceRequest entity, - boolean includePrimary, - int replicaCountToRead, - boolean requiresValidLsn, - boolean useSessionToken, - ReadMode readMode, - boolean checkMinLSN, - boolean forceReadAll, - final MutableVolatile requestSessionToken, - final MutableVolatile hasGoneException, - boolean enforceSessionCheck, - final MutableVolatile shortCircut) { - if (entity.requestContext.timeoutHelper.isElapsed()) { - return Observable.error(new GoneException()); - } - List, URI>> readStoreTasks = new ArrayList<>(); - int uriIndex = StoreReader.generateNextRandom(resolveApiResults.size()); - - while (resolveApiResults.size() > 0) { - uriIndex = uriIndex % resolveApiResults.size(); - URI uri = resolveApiResults.get(uriIndex); - Pair, URI> res; - try { - res = this.readFromStoreAsync(resolveApiResults.get(uriIndex), - entity); - - } catch (Exception e) { - res = Pair.of(Single.error(e), uri); - } - - readStoreTasks.add(Pair.of(res.getLeft().toObservable(), res.getRight())); - resolveApiResults.remove(uriIndex); - - - if (!forceReadAll && readStoreTasks.size() == replicasToRead.get()) { - break; - } - } - - replicasToRead.set(readStoreTasks.size() >= replicasToRead.get() ? 0 : replicasToRead.get() - readStoreTasks.size()); - - - List> storeResult = readStoreTasks - .stream() - .map(item -> toStoreResult(entity, item, readMode, requiresValidLsn)) - .collect(Collectors.toList()); - Observable allStoreResults = Observable.merge(storeResult); - - return allStoreResults.toList().onErrorResumeNext(e -> { - if (e instanceof CompositeException) { - logger.info("Captured composite exception"); - CompositeException compositeException = (CompositeException) e; - List exceptions = compositeException.getExceptions(); - assert exceptions != null && !exceptions.isEmpty(); - return Observable.error(exceptions.get(0)); - } - - return Observable.error(e); - }).map(newStoreResults -> { - for (StoreResult srr : newStoreResults) { - - entity.requestContext.requestChargeTracker.addCharge(srr.requestCharge); - entity.requestContext.clientSideRequestStatistics.recordResponse(entity, srr); - if (srr.isValid) { - - try { - - if (requestSessionToken.v == null - || (srr.sessionToken != null && requestSessionToken.v.isValid(srr.sessionToken)) - || (!enforceSessionCheck && !srr.isNotFoundException)) { - resultCollector.add(srr); - } - - } catch (Exception e) { - // TODO: what to do on exception? - } - } - - hasGoneException.v = hasGoneException.v || (srr.isGoneException && !srr.isInvalidPartitionException); - - if (resultCollector.size() >= replicaCountToRead) { - if (hasGoneException.v && !entity.requestContext.performedBackgroundAddressRefresh) { - this.startBackgroundAddressRefresh(entity); - entity.requestContext.performedBackgroundAddressRefresh = true; - } - - shortCircut.v = new ReadReplicaResult(false, resultCollector); - replicasToRead.set(0); - return resultCollector; - } - - // Remaining replicas - replicasToRead.set(replicaCountToRead - resultCollector.size()); - } - return resultCollector; - }); - } - - private ReadReplicaResult createReadReplicaResult(List responseResult, - int replicaCountToRead, - int resolvedAddressCount, - boolean hasGoneException, - RxDocumentServiceRequest entity) throws DocumentClientException { - if (responseResult.size() < replicaCountToRead) { - logger.debug("Could not get quorum number of responses. " + - "ValidResponsesReceived: {} ResponsesExpected: {}, ResolvedAddressCount: {}, ResponsesString: {}", - responseResult.size(), - replicaCountToRead, - resolvedAddressCount, - String.join(";", responseResult.stream().map(r -> r.toString()).collect(Collectors.toList()))); - - if (hasGoneException) { - if (!entity.requestContext.performLocalRefreshOnGoneException) { - // If we are not supposed to act upon GoneExceptions here, just throw them - throw new GoneException(); - } else if (!entity.requestContext.forceRefreshAddressCache) { - // We could not obtain valid read quorum number of responses even when we went through all the secondary addresses - // Attempt force refresh and start over again. - return new ReadReplicaResult(true, responseResult); - } - } - } - - return new ReadReplicaResult(false, responseResult); - } - - /** - * Makes requests to multiple replicas at once and returns responses - * @param entity DocumentServiceRequest - * @param includePrimary flag to indicate whether to indicate primary replica in the reads - * @param replicaCountToRead number of replicas to read from - * @param requiresValidLsn flag to indicate whether a valid lsn is required to consider a response as valid - * @param useSessionToken flag to indicate whether to use session token - * @param readMode Read mode - * @param checkMinLSN set minimum required session lsn - * @param forceReadAll will read from all available replicas to put together result from readsToRead number of replicas - * @return ReadReplicaResult which indicates the LSN and whether Quorum was Met / Not Met etc - */ - private Single readMultipleReplicasInternalAsync(RxDocumentServiceRequest entity, - boolean includePrimary, - int replicaCountToRead, - boolean requiresValidLsn, - boolean useSessionToken, - ReadMode readMode, - boolean checkMinLSN, - boolean forceReadAll) { - if (entity.requestContext.timeoutHelper.isElapsed()) { - return Single.error(new GoneException()); - } - - String requestedCollectionId = null; - - if (entity.forceNameCacheRefresh) { - requestedCollectionId = entity.requestContext.resolvedCollectionRid; - } - - Single> resolveApiResultsObs = this.addressSelector.resolveAllUriAsync( - entity, - includePrimary, - entity.requestContext.forceRefreshAddressCache); - - if (!StringUtils.isEmpty(requestedCollectionId) && !StringUtils.isEmpty(entity.requestContext.resolvedCollectionRid)) { - if (!requestedCollectionId.equals(entity.requestContext.resolvedCollectionRid)) { - this.sessionContainer.clearTokenByResourceId(requestedCollectionId); - } - } - - return resolveApiResultsObs.toObservable() - .map(list -> Collections.synchronizedList(new ArrayList<>(list))) - .flatMap( - resolveApiResults -> { - try { - MutableVolatile requestSessionToken = new MutableVolatile<>(); - if (useSessionToken) { - SessionTokenHelper.setPartitionLocalSessionToken(entity, this.sessionContainer); - if (checkMinLSN) { - requestSessionToken.v = entity.requestContext.sessionToken; - } - } else { - entity.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN); - } - - Observable y = earlyResultIfNotEnoughReplicas(resolveApiResults, entity, replicaCountToRead); - return y.switchIfEmpty( - Observable.defer(() -> { - - List storeResultList = Collections.synchronizedList(new ArrayList<>()); - AtomicInteger replicasToRead = new AtomicInteger(replicaCountToRead); - - // string clientVersion = entity.Headers[HttpConstants.HttpHeaders.Version]; - // enforceSessionCheck = string.IsNullOrEmpty(clientVersion) ? false : VersionUtility.IsLaterThan(clientVersion, HttpConstants.Versions.v2016_05_30); - // TODO: enforceSessionCheck is true, replace with true - boolean enforceSessionCheck = true; - - MutableVolatile hasGoneException = new MutableVolatile(false); - MutableVolatile shortCircuitResult = new MutableVolatile(); - - return Observable.defer(() -> - readFromReplicas( - storeResultList, - resolveApiResults, - replicasToRead, - entity, - includePrimary, - replicaCountToRead, - requiresValidLsn, - useSessionToken, - readMode, - checkMinLSN, - forceReadAll, - requestSessionToken, - hasGoneException, - enforceSessionCheck, - shortCircuitResult)) - // repeat().takeUntil() simulate a while loop pattern - .repeat() - .takeUntil(x -> { - // Loop until we have the read quorum number of valid responses or if we have read all the replicas - if (replicasToRead.get() > 0 && resolveApiResults.size() > 0) { - // take more from the source observable - return false; - } else { - // enough result - return true; - } - }) - .toCompletable() - .andThen( - Observable.defer(() -> { - try { - // TODO: some fields which get updated need to be thread-safe - return Observable.just(createReadReplicaResult(storeResultList, replicaCountToRead, resolveApiResults.size(), hasGoneException.v, entity)); - } catch (Exception e) { - return Observable.error(e); - } - } - )); - })); - } catch (Exception e) { - return Observable.error(e); - } - } - ).toSingle(); - } - - public Single readPrimaryAsync( - RxDocumentServiceRequest entity, - boolean requiresValidLsn, - boolean useSessionToken) { - if (entity.requestContext.timeoutHelper.isElapsed()) { - return Single.error(new GoneException()); - } - - String originalSessionToken = entity.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); - if (entity.requestContext.clientSideRequestStatistics == null) { - entity.requestContext.clientSideRequestStatistics = new ClientSideRequestStatistics(); - } - - return this.readPrimaryInternalAsync( - entity, requiresValidLsn, useSessionToken).flatMap( - readQuorumResult -> { - - if (entity.requestContext.performLocalRefreshOnGoneException && - readQuorumResult.retryWithForceRefresh && - !entity.requestContext.forceRefreshAddressCache) { - if (entity.requestContext.timeoutHelper.isElapsed()) { - return Single.error(new GoneException()); - } - - entity.requestContext.forceRefreshAddressCache = true; - return this.readPrimaryInternalAsync(entity, requiresValidLsn, useSessionToken); - } else { - return Single.just(readQuorumResult); - } - } - ).flatMap(readQuorumResult -> { - - // RxJava1 doesn't allow throwing Typed Exception from Observable.map(.) - // this is a design flaw which was fixed in RxJava2. - - // as our core is built on top of RxJava1 here we had to use Observable.flatMap(.) not map(.) - // once we switch to RxJava2 we can move to Observable.map(.) - // https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0#functional-interfaces - if (readQuorumResult.responses.size() == 0) { - return Single.error(new GoneException(RMResources.Gone)); - } - - return Single.just(readQuorumResult.responses.get(0)); - - }).doOnEach(arg -> { - try { - SessionTokenHelper.setOriginalSessionToken(entity, originalSessionToken); - } catch (Throwable throwable) { - logger.error("Unexpected failure in handling orig [{}]: new [{}]", arg, throwable.getMessage(), throwable); - } - } - ); - } - - private Single readPrimaryInternalAsync( - RxDocumentServiceRequest entity, - boolean requiresValidLsn, - boolean useSessionToken) { - if (entity.requestContext.timeoutHelper.isElapsed()) { - return Single.error(new GoneException()); - } - - Single primaryUriObs = this.addressSelector.resolvePrimaryUriAsync( - entity, - entity.requestContext.forceRefreshAddressCache); - - Single storeResultObs = primaryUriObs.flatMap( - primaryUri -> { - try { - if (useSessionToken) { - SessionTokenHelper.setPartitionLocalSessionToken(entity, this.sessionContainer); - } else { - // Remove whatever session token can be there in headers. - // We don't need it. If it is global - backend will not undersand it. - // But there's no point in producing partition local sesison token. - entity.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN); - } - - - Pair, URI> storeResponseObsAndUri = this.readFromStoreAsync(primaryUri, entity); - - return storeResponseObsAndUri.getLeft().flatMap( - storeResponse -> { - - try { - StoreResult storeResult = this.createStoreResult( - storeResponse != null ? storeResponse : null, - null, requiresValidLsn, - true, - storeResponse != null ? storeResponseObsAndUri.getRight() : null); - return Single.just(storeResult); - } catch (DocumentClientException e) { - return Single.error(e); - } - } - - ); - - } catch (DocumentClientException e) { - // RxJava1 doesn't allow throwing checked exception from Observable:map - return Single.error(e); - } - - } - ).onErrorResumeNext(t -> { - logger.debug("Exception {} is thrown while doing Read Primary", t); - - Exception storeTaskException = Utils.as(t, Exception.class); - if (storeTaskException == null) { - return Single.error(t); - } - - try { - StoreResult storeResult = this.createStoreResult( - null, - storeTaskException, requiresValidLsn, - true, - null); - return Single.just(storeResult); - } catch (DocumentClientException e) { - // RxJava1 doesn't allow throwing checked exception from Observable operators - return Single.error(e); - } - }); - - return storeResultObs.map(storeResult -> { - entity.requestContext.clientSideRequestStatistics.recordResponse(entity, storeResult); - entity.requestContext.requestChargeTracker.addCharge(storeResult.requestCharge); - - if (storeResult.isGoneException && !storeResult.isInvalidPartitionException) { - return new ReadReplicaResult(true, Collections.emptyList()); - } - - return new ReadReplicaResult(false, Collections.singletonList(storeResult)); - }); - } - - private Pair, URI> readFromStoreAsync( - URI physicalAddress, - RxDocumentServiceRequest request) throws DocumentClientException { - - if (request.requestContext.timeoutHelper.isElapsed()) { - throw new GoneException(); - } - - //QueryRequestPerformanceActivity activity = null; - // TODO: ifNoneMatch and maxPageSize are not used in the .Net code. check with Ji - String ifNoneMatch = request.getHeaders().get(HttpConstants.HttpHeaders.IF_NONE_MATCH); - String continuation = null; - String maxPageSize = null; - - // TODO: is this needed - this.lastReadAddress = physicalAddress.toString(); - - if (request.getOperationType() == OperationType.ReadFeed || - request.getOperationType() == OperationType.Query) { - continuation = request.getHeaders().get(HttpConstants.HttpHeaders.CONTINUATION); - maxPageSize = request.getHeaders().get(HttpConstants.HttpHeaders.PAGE_SIZE); - - if (continuation != null && continuation.contains(";")) { - String[] parts = StringUtils.split(continuation, ';'); - if (parts.length < 3) { - throw new BadRequestException(String.format( - RMResources.InvalidHeaderValue, - continuation, - HttpConstants.HttpHeaders.CONTINUATION)); - } - - continuation = parts[0]; - } - - request.setContinuation(continuation); - - // TODO: troubleshooting - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/258624 - //activity = CustomTypeExtensions.StartActivity(request); - } - - switch (request.getOperationType()) { - case Read: - case Head: { - Single storeResponseObs = this.transportClient.invokeResourceOperationAsync( - physicalAddress, - request); - - return Pair.of(storeResponseObs, physicalAddress); - - } - - case ReadFeed: - case HeadFeed: - case Query: - case SqlQuery: - case ExecuteJavaScript: { - Single storeResponseObs = StoreReader.completeActivity(this.transportClient.invokeResourceOperationAsync( - physicalAddress, - request), null); - // TODO activity); - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/258624 - return Pair.of(storeResponseObs, physicalAddress); - } - - default: - throw new IllegalStateException(String.format("Unexpected operation type {%s}", request.getOperationType())); - } - } - - - private static Single completeActivity(Single task, Object activity) { - // TODO: client statistics - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/258624 - return task; - } - - StoreResult createStoreResult(StoreResponse storeResponse, - Exception responseException, - boolean requiresValidLsn, - boolean useLocalLSNBasedHeaders, - URI storePhysicalAddress) throws DocumentClientException { - - if (responseException == null) { - String headerValue = null; - long quorumAckedLSN = -1; - int currentReplicaSetSize = -1; - int currentWriteQuorum = -1; - long globalCommittedLSN = -1; - int numberOfReadRegions = -1; - long itemLSN = -1; - if ((headerValue = storeResponse.getHeaderValue( - useLocalLSNBasedHeaders ? WFConstants.BackendHeaders.QUORUM_ACKED_LOCAL_LSN : WFConstants.BackendHeaders.QUORUM_ACKED_LSN)) != null) { - quorumAckedLSN = Long.parseLong(headerValue); - } - - if ((headerValue = storeResponse.getHeaderValue(WFConstants.BackendHeaders.CURRENT_REPLICA_SET_SIZE)) != null) { - currentReplicaSetSize = Integer.parseInt(headerValue); - } - - if ((headerValue = storeResponse.getHeaderValue(WFConstants.BackendHeaders.CURRENT_WRITE_QUORUM)) != null) { - currentWriteQuorum = Integer.parseInt(headerValue); - } - - double requestCharge = 0; - if ((headerValue = storeResponse.getHeaderValue(HttpConstants.HttpHeaders.REQUEST_CHARGE)) != null) { - requestCharge = Double.parseDouble(headerValue); - } - - if ((headerValue = storeResponse.getHeaderValue(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS)) != null) { - numberOfReadRegions = Integer.parseInt(headerValue); - } - - if ((headerValue = storeResponse.getHeaderValue(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN)) != null) { - globalCommittedLSN = Long.parseLong(headerValue); - } - - if ((headerValue = storeResponse.getHeaderValue( - useLocalLSNBasedHeaders ? WFConstants.BackendHeaders.ITEM_LOCAL_LSN : WFConstants.BackendHeaders.ITEM_LSN)) != null) { - itemLSN = Long.parseLong(headerValue); - } - - long lsn = -1; - if (useLocalLSNBasedHeaders) { - if ((headerValue = storeResponse.getHeaderValue(WFConstants.BackendHeaders.LOCAL_LSN)) != null) { - lsn = Long.parseLong(headerValue); - } - } else { - lsn = storeResponse.getLSN(); - } - - ISessionToken sessionToken = null; - // Session token response header is introduced from version HttpConstants.Versions.v2018_06_18 onwards. - // Previously it was only a request header - if ((headerValue = storeResponse.getHeaderValue(HttpConstants.HttpHeaders.SESSION_TOKEN)) != null) { - sessionToken = SessionTokenHelper.parse(headerValue); - } - - return new StoreResult( - /* storeResponse: */storeResponse, - /* exception: */ null, - /* partitionKeyRangeId: */ storeResponse.getPartitionKeyRangeId(), - /* lsn: */ lsn, - /* quorumAckedLsn: */ quorumAckedLSN, - /* requestCharge: */ requestCharge, - /* currentReplicaSetSize: */ currentReplicaSetSize, - /* currentWriteQuorum: */ currentWriteQuorum, - /* isValid: */true, - /* storePhysicalAddress: */ storePhysicalAddress, - /* globalCommittedLSN: */ globalCommittedLSN, - /* numberOfReadRegions: */ numberOfReadRegions, - /* itemLSN: */ itemLSN, - /* sessionToken: */ sessionToken); - } else { - DocumentClientException documentClientException = Utils.as(responseException, DocumentClientException.class); - if (documentClientException != null) { - StoreReader.verifyCanContinueOnException(documentClientException); - long quorumAckedLSN = -1; - int currentReplicaSetSize = -1; - int currentWriteQuorum = -1; - long globalCommittedLSN = -1; - int numberOfReadRegions = -1; - String headerValue = documentClientException.getResponseHeaders().get(useLocalLSNBasedHeaders ? WFConstants.BackendHeaders.QUORUM_ACKED_LOCAL_LSN : WFConstants.BackendHeaders.QUORUM_ACKED_LSN); - if (!Strings.isNullOrEmpty(headerValue)) { - quorumAckedLSN = Long.parseLong(headerValue); - } - - headerValue = documentClientException.getResponseHeaders().get(WFConstants.BackendHeaders.CURRENT_REPLICA_SET_SIZE); - if (!Strings.isNullOrEmpty(headerValue)) { - currentReplicaSetSize = Integer.parseInt(headerValue); - } - - headerValue = documentClientException.getResponseHeaders().get(WFConstants.BackendHeaders.CURRENT_WRITE_QUORUM); - if (!Strings.isNullOrEmpty(headerValue)) { - currentReplicaSetSize = Integer.parseInt(headerValue); - } - - double requestCharge = 0; - headerValue = documentClientException.getResponseHeaders().get(HttpConstants.HttpHeaders.REQUEST_CHARGE); - if (!Strings.isNullOrEmpty(headerValue)) { - requestCharge = Double.parseDouble(headerValue); - } - - headerValue = documentClientException.getResponseHeaders().get(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS); - if (!Strings.isNullOrEmpty(headerValue)) { - numberOfReadRegions = Integer.parseInt(headerValue); - } - - headerValue = documentClientException.getResponseHeaders().get(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN); - if (!Strings.isNullOrEmpty(headerValue)) { - globalCommittedLSN = Integer.parseInt(headerValue); - } - - long lsn = -1; - if (useLocalLSNBasedHeaders) { - headerValue = documentClientException.getResponseHeaders().get(WFConstants.BackendHeaders.LOCAL_LSN); - if (!Strings.isNullOrEmpty(headerValue)) { - lsn = Long.parseLong(headerValue); - } - } else { - lsn = BridgeInternal.getLSN(documentClientException); - } - - ISessionToken sessionToken = null; - - // Session token response header is introduced from version HttpConstants.Versions.v2018_06_18 onwards. - // Previously it was only a request header - headerValue = documentClientException.getResponseHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); - if (!Strings.isNullOrEmpty(headerValue)) { - sessionToken = SessionTokenHelper.parse(headerValue); - } - - return new StoreResult( - /* storeResponse: */ (StoreResponse) null, - /* exception: */ documentClientException, - /* partitionKeyRangeId: */BridgeInternal.getPartitionKeyRangeId(documentClientException), - /* lsn: */ lsn, - /* quorumAckedLsn: */ quorumAckedLSN, - /* requestCharge: */ requestCharge, - /* currentReplicaSetSize: */ currentReplicaSetSize, - /* currentWriteQuorum: */ currentWriteQuorum, - /* isValid: */!requiresValidLsn - || ((documentClientException.getStatusCode() != HttpConstants.StatusCodes.GONE || isSubStatusCode(documentClientException, HttpConstants.SubStatusCodes.NAME_CACHE_IS_STALE)) - && lsn >= 0), - // TODO: verify where exception.RequestURI is supposed to be set in .Net - /* storePhysicalAddress: */ storePhysicalAddress == null ? BridgeInternal.getRequestUri(documentClientException) : storePhysicalAddress, - /* globalCommittedLSN: */ globalCommittedLSN, - /* numberOfReadRegions: */ numberOfReadRegions, - /* itemLSN: */ -1, - sessionToken); - } else { - logger.error("Unexpected exception {} received while reading from store.", responseException.getMessage(), responseException); - return new StoreResult( - /* storeResponse: */ null, - /* exception: */ new InternalServerErrorException(RMResources.InternalServerError), - /* partitionKeyRangeId: */ (String) null, - /* lsn: */ -1, - /* quorumAckedLsn: */ -1, - /* requestCharge: */ 0, - /* currentReplicaSetSize: */ 0, - /* currentWriteQuorum: */ 0, - /* isValid: */ false, - /* storePhysicalAddress: */ storePhysicalAddress, - /* globalCommittedLSN: */-1, - /* numberOfReadRegions: */ 0, - /* itemLSN: */ -1, - /* sessionToken: */ null); - } - } - } - - void startBackgroundAddressRefresh(RxDocumentServiceRequest request) { - this.addressSelector.resolveAllUriAsync(request, true, true) - .observeOn(Schedulers.io()) - .subscribe( - r -> { - }, - e -> logger.warn( - "Background refresh of the addresses failed with {}", e.getMessage(), e) - ); - } - - private static int generateNextRandom(int maxValue) { - // The benefit of using ThreadLocalRandom.current() over Random is - // avoiding the synchronization contention due to multi-threading. - return ThreadLocalRandom.current().nextInt(maxValue); - } - - static void verifyCanContinueOnException(DocumentClientException ex) throws DocumentClientException { - if (ex instanceof PartitionKeyRangeGoneException) { - throw ex; - } - - if (ex instanceof PartitionKeyRangeIsSplittingException) { - throw ex; - } - - if (ex instanceof PartitionIsMigratingException) { - throw ex; - } - - String value = ex.getResponseHeaders().get(HttpConstants.HttpHeaders.REQUEST_VALIDATION_FAILURE); - if (Strings.isNullOrWhiteSpace(value)) { - return; - } - - Integer result = Integers.tryParse(value); - if (result != null && result == 1) { - throw ex; - } - - return; - } - - private class ReadReplicaResult { - public ReadReplicaResult(boolean retryWithForceRefresh, List responses) { - this.retryWithForceRefresh = retryWithForceRefresh; - this.responses = responses; - } - - public final boolean retryWithForceRefresh; - public final List responses; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TransportClient.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TransportClient.java deleted file mode 100644 index b25cbe351722..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TransportClient.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import rx.Single; - -import java.net.URI; - -public abstract class TransportClient implements AutoCloseable { - - // Uses requests's ResourceOperation to determine the operation - public Single invokeResourceOperationAsync(URI physicalAddress, RxDocumentServiceRequest request) { - return this.invokeStoreAsync(physicalAddress, new ResourceOperation(request.getOperationType(), request.getResourceType()), request); - } - - protected abstract Single invokeStoreAsync( - URI physicalAddress, - ResourceOperation resourceOperation, - RxDocumentServiceRequest request); -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TransportException.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TransportException.java deleted file mode 100644 index c1e3a499a018..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TransportException.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.Error; -import io.netty.handler.codec.http.HttpResponseStatus; - -import java.util.Map; - -public class TransportException extends Exception { - - final private Error error; - final private Map headers; - final private HttpResponseStatus status; - - public TransportException(HttpResponseStatus status, ObjectNode details, Map headers) { - - super("TODO: DANOBLE: format message string based on headers, and status information"); - this.error = BridgeInternal.createError(details); - this.headers = headers; - this.status = status; - } - - public Error getError() { - return error; - } - - public Map getHeaders() { - return headers; - } - - public HttpResponseStatus getStatus() { - return status; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/UnauthorizedException.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/UnauthorizedException.java deleted file mode 100644 index 5caf0c8b5916..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/UnauthorizedException.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.net.URI; -import java.util.Map; - -public class UnauthorizedException extends DocumentClientException { - - public UnauthorizedException() { - this(RMResources.Unauthorized); - } - - public UnauthorizedException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.UNAUTHORIZED, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public UnauthorizedException(String message) { - this(message, (Exception) null, (HttpResponseHeaders) null, null); - } - - public UnauthorizedException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public UnauthorizedException(String message, HttpResponseHeaders headers, URI requestUri) { - this(message, headers, requestUri != null ? requestUri.toString() : null); - } - - public UnauthorizedException(Exception innerException) { - this(RMResources.Unauthorized, innerException, null, null); - } - - public UnauthorizedException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - super(String.format("%s: %s", RMResources.Unauthorized, message), - innerException, - HttpUtils.asMap(headers), - HttpConstants.StatusCodes.UNAUTHORIZED, - requestUri != null ? requestUri.toString() : null); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdClientChannelHandler.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdClientChannelHandler.java deleted file mode 100644 index 7ea0ab72d948..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdClientChannelHandler.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import io.netty.channel.Channel; -import io.netty.channel.ChannelInitializer; -import io.netty.channel.ChannelPipeline; -import io.netty.channel.EventLoop; -import io.netty.channel.pool.ChannelPool; -import io.netty.channel.pool.ChannelPoolHandler; -import io.netty.handler.logging.LoggingHandler; -import io.netty.handler.ssl.SslHandler; -import io.netty.handler.timeout.ReadTimeoutHandler; -import io.netty.handler.timeout.WriteTimeoutHandler; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.net.ssl.SSLEngine; -import java.util.concurrent.TimeUnit; - -import static com.google.common.base.Preconditions.checkNotNull; - -public class RntbdClientChannelHandler extends ChannelInitializer implements ChannelPoolHandler { - - private static Logger logger = LoggerFactory.getLogger(RntbdClientChannelHandler.class); - private final RntbdEndpoint.Config config; - - RntbdClientChannelHandler(final RntbdEndpoint.Config config) { - checkNotNull(config, "config"); - this.config = config; - } - - /** - * Called by {@link ChannelPool#acquire} after a {@link Channel} is acquired - *

- * This method is called within the {@link EventLoop} of the {@link Channel}. - * - * @param channel a channel that was just acquired - */ - @Override - public void channelAcquired(final Channel channel) throws Exception { - logger.trace("{} CHANNEL ACQUIRED", channel); - } - - /** - * Called by {@link ChannelPool#release} after a {@link Channel} is created - *

- * This method is called within the {@link EventLoop} of the {@link Channel}. - * - * @param channel a channel that was just created - */ - @Override - public void channelCreated(final Channel channel) throws Exception { - logger.trace("{} CHANNEL CREATED", channel); - this.initChannel(channel); - } - - /** - * Called by {@link ChannelPool#release} after a {@link Channel} is released - *

- * This method is called within the {@link EventLoop} of the {@link Channel}. - * - * @param channel a channel that was just released - */ - @Override - public void channelReleased(final Channel channel) throws Exception { - logger.trace("{} CHANNEL RELEASED", channel); - } - - /** - * Called by @{ChannelPipeline} initializer after the current channel is registered to an event loop. - *

- * This method constructs this pipeline: - *

{@code
-     * ChannelPipeline {
-     *     (ReadTimeoutHandler#0 = io.netty.handler.timeout.ReadTimeoutHandler),
-     *     (SslHandler#0 = io.netty.handler.ssl.SslHandler),
-     *     (RntbdContextNegotiator#0 = com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdContextNegotiator),
-     *     (RntbdResponseDecoder#0 = com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdResponseDecoder),
-     *     (RntbdRequestEncoder#0 = com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdRequestEncoder),
-     *     (WriteTimeoutHandler#0 = io.netty.handler.timeout.WriteTimeoutHandler),
-     *     (RntbdRequestManager#0 = com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdRequestManager),
-     *     (SimpleChannelPool$1#0 = io.netty.channel.pool.SimpleChannelPool$1)
-     * }
-     * }
- * - * @param channel a channel that was just registered with an event loop - */ - @Override - protected void initChannel(final Channel channel) { - - checkNotNull(channel); - - assert channel.isRegistered(); - assert channel.isOpen(); - assert !channel.isActive(); - - final RntbdRequestManager requestManager = new RntbdRequestManager(); - final long readerIdleTime = this.config.getReceiveHangDetectionTime(); - final long writerIdleTime = this.config.getSendHangDetectionTime(); - final ChannelPipeline pipeline = channel.pipeline(); - - pipeline.addFirst( - new RntbdContextNegotiator(requestManager, this.config.getUserAgent()), - new RntbdResponseDecoder(), - new RntbdRequestEncoder(), - new WriteTimeoutHandler(writerIdleTime, TimeUnit.NANOSECONDS), - requestManager - ); - - if (this.config.getWireLogLevel() != null) { - pipeline.addFirst(new LoggingHandler(this.config.getWireLogLevel())); - } - - final SSLEngine sslEngine = this.config.getSslContext().newEngine(channel.alloc()); - - pipeline.addFirst( - new ReadTimeoutHandler(readerIdleTime, TimeUnit.NANOSECONDS), - new SslHandler(sslEngine) - ); - } - -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdClientChannelPool.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdClientChannelPool.java deleted file mode 100644 index e1ef4d31f9ee..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdClientChannelPool.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.Channel; -import io.netty.channel.ChannelId; -import io.netty.channel.pool.ChannelHealthChecker; -import io.netty.channel.pool.FixedChannelPool; -import io.netty.util.concurrent.Future; -import io.netty.util.concurrent.Promise; -import org.apache.commons.lang3.reflect.FieldUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.lang.reflect.Field; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicReference; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkState; - -@JsonSerialize(using = RntbdClientChannelPool.JsonSerializer.class) -public final class RntbdClientChannelPool extends FixedChannelPool { - - private static final Logger logger = LoggerFactory.getLogger(RntbdClientChannelPool.class); - private static final AtomicReference pendingAcquireCount = new AtomicReference<>(); - - private final ConcurrentHashMap atCapacity; - private final AtomicInteger availableChannelCount; - private final AtomicBoolean closed; - private final int maxRequestsPerChannel; - - /** - * Creates a new instance using the {@link ChannelHealthChecker#ACTIVE} - * - * @param bootstrap the {@link Bootstrap} that is used for connections - * @param config the {@link RntbdEndpoint.Config} that is used for the channel pool instance created - */ - RntbdClientChannelPool(final Bootstrap bootstrap, final RntbdEndpoint.Config config) { - - super(bootstrap, new RntbdClientChannelHandler(config), ChannelHealthChecker.ACTIVE, null, - -1L, config.getMaxChannelsPerEndpoint(), Integer.MAX_VALUE, true - ); - - this.maxRequestsPerChannel = config.getMaxRequestsPerChannel(); - this.availableChannelCount = new AtomicInteger(); - this.atCapacity = new ConcurrentHashMap<>(); - this.closed = new AtomicBoolean(); - } - - @Override - public Future acquire(Promise promise) { - this.throwIfClosed(); - return super.acquire(promise); - } - - @Override - public Future release(Channel channel, Promise promise) { - this.throwIfClosed(); - return super.release(channel, promise); - } - - @Override - public void close() { - - if (this.closed.compareAndSet(false, true)) { - - if (!this.atCapacity.isEmpty()) { - - for (Channel channel : this.atCapacity.values()) { - super.offerChannel(channel); - } - - this.atCapacity.clear(); - } - - this.availableChannelCount.set(0); - super.close(); - } - } - - public int availableChannelCount() { - return this.availableChannelCount.get(); - } - - public int pendingAcquireCount() { - - Field field = pendingAcquireCount.get(); - - if (field == null) { - - synchronized (pendingAcquireCount) { - - field = pendingAcquireCount.get(); - - if (field == null) { - field = FieldUtils.getDeclaredField(FixedChannelPool.class, "pendingAcquireCount", true); - pendingAcquireCount.set(field); - } - } - - } - try { - return (int)FieldUtils.readField(field, this); - } catch (IllegalAccessException error) { - logger.error("could not access field due to ", error); - } - - return -1; - } - - /** - * Poll a {@link Channel} out of internal storage to reuse it - *

- * Maintainers: Implementations of this method must be thread-safe. - * - * @return a value of {@code null}, if no {@link Channel} is ready to be reused - */ - @Override - protected synchronized Channel pollChannel() { - - final Channel channel = super.pollChannel(); - - if (channel != null) { - this.availableChannelCount.decrementAndGet(); - return channel; - } - - if (this.atCapacity.isEmpty()) { - return null; - } - - return this.atCapacity.search(Long.MAX_VALUE, (id, value) -> { - if (pendingRequestCount(value) < this.maxRequestsPerChannel) { - this.availableChannelCount.decrementAndGet(); - this.atCapacity.remove(id); - return value; - } - return null; - }); - } - - /** - * Offer a {@link Channel} back to the internal storage - *

- * Maintainers: Implementations of this method must be thread-safe. - * - * @param channel the {@link Channel} to return to internal storage - * @return {@code true}, if the {@link Channel} could be added to internal storage; otherwise {@code false} - */ - @Override - protected synchronized boolean offerChannel(final Channel channel) { - - checkArgument(channel.isActive(), "%s inactive", channel); - final boolean offered; - - if (pendingRequestCount(channel) >= this.maxRequestsPerChannel) { - this.atCapacity.put(channel.id(), channel); - offered = true; - } else { - offered = super.offerChannel(channel); - } - - if (offered) { - this.availableChannelCount.incrementAndGet(); - } - - return offered; - } - - @Override - public String toString() { - return RntbdObjectMapper.toJson(this); - } - - private static int pendingRequestCount(final Channel channel) { - return channel.pipeline().get(RntbdRequestManager.class).getPendingRequestCount(); - } - - private void throwIfClosed() { - checkState(!this.closed.get(), "%s is closed", this); - } - - // region Types - - static final class JsonSerializer extends StdSerializer { - - public JsonSerializer() { - this(null); - } - - public JsonSerializer(Class type) { - super(type); - } - - @Override - public void serialize(RntbdClientChannelPool value, JsonGenerator generator, SerializerProvider provider) throws IOException { - - generator.writeStartObject(); - generator.writeNumberField("acquiredChannelCount", value.acquiredChannelCount()); - generator.writeNumberField("availableChannelCount", value.availableChannelCount()); - generator.writeNumberField("maxRequestsPerChannel", value.maxRequestsPerChannel); - generator.writeNumberField("pendingAcquisitionCount", value.pendingAcquireCount()); - generator.writeBooleanField("isClosed", value.closed.get()); - generator.writeEndObject(); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdConstants.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdConstants.java deleted file mode 100644 index e57e7660f274..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdConstants.java +++ /dev/null @@ -1,750 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Sets; - -import java.util.EnumSet; -import java.util.stream.Collector; - -final class RntbdConstants { - - static final int CurrentProtocolVersion = 0x00000001; - - private RntbdConstants() { - } - - public enum RntbdConsistencyLevel { - - Strong((byte)0x00), - BoundedStaleness((byte)0x01), - Session((byte)0x02), - Eventual((byte)0x03), - ConsistentPrefix((byte)0x04), - - Invalid((byte)0xFF); - - private final byte id; - - RntbdConsistencyLevel(final byte id) { - this.id = id; - } - - public byte id() { - return this.id; - } - } - - public enum RntbdContentSerializationFormat { - - JsonText((byte)0x00), - CosmosBinary((byte)0x01), - - Invalid((byte)0xFF); - - private final byte id; - - RntbdContentSerializationFormat(final byte id) { - this.id = id; - } - - public byte id() { - return this.id; - } - } - - enum RntbdContextHeader implements RntbdHeader { - - ProtocolVersion((short)0x0000, RntbdTokenType.ULong, false), - ClientVersion((short)0x0001, RntbdTokenType.SmallString, false), - ServerAgent((short)0x0002, RntbdTokenType.SmallString, true), - ServerVersion((short)0x0003, RntbdTokenType.SmallString, true), - IdleTimeoutInSeconds((short)0x0004, RntbdTokenType.ULong, false), - UnauthenticatedTimeoutInSeconds((short)0x0005, RntbdTokenType.ULong, false); - - public static final ImmutableMap map; - public static final ImmutableSet set = Sets.immutableEnumSet(EnumSet.allOf(RntbdContextHeader.class)); - - static { - final Collector> collector = ImmutableMap.toImmutableMap(RntbdContextHeader::id, h -> h); - map = set.stream().collect(collector); - } - - private final short id; - private final boolean isRequired; - private final RntbdTokenType type; - - RntbdContextHeader(final short id, final RntbdTokenType type, final boolean isRequired) { - this.id = id; - this.type = type; - this.isRequired = isRequired; - } - - public boolean isRequired() { - return this.isRequired; - } - - public short id() { - return this.id; - } - - public RntbdTokenType type() { - return this.type; - } - } - - enum RntbdContextRequestHeader implements RntbdHeader { - - ProtocolVersion((short)0x0000, RntbdTokenType.ULong, true), - ClientVersion((short)0x0001, RntbdTokenType.SmallString, true), - UserAgent((short)0x0002, RntbdTokenType.SmallString, true); - - public static final ImmutableMap map; - public static final ImmutableSet set = Sets.immutableEnumSet(EnumSet.allOf(RntbdContextRequestHeader.class)); - - static { - final Collector> collector = ImmutableMap.toImmutableMap(h -> h.id(), h -> h); - map = set.stream().collect(collector); - } - - private final short id; - private final boolean isRequired; - private final RntbdTokenType type; - - RntbdContextRequestHeader(final short id, final RntbdTokenType type, final boolean isRequired) { - this.id = id; - this.type = type; - this.isRequired = isRequired; - } - - public boolean isRequired() { - return this.isRequired; - } - - public short id() { - return this.id; - } - - public RntbdTokenType type() { - return this.type; - } - } - - public enum RntbdEnumerationDirection { - - Invalid((byte)0x00), - - Forward((byte)0x01), - Reverse((byte)0x02); - - private final byte id; - - RntbdEnumerationDirection(final byte id) { - this.id = id; - } - - public byte id() { - return this.id; - } - } - - public enum RntbdFanoutOperationState { - - Started((byte)0x01), - Completed((byte)0x02); - - private final byte id; - - RntbdFanoutOperationState(final byte id) { - this.id = id; - } - - public byte id() { - return this.id; - } - } - - enum RntbdIndexingDirective { - - Default((byte)0x00), - Include((byte)0x01), - Exclude((byte)0x02), - Invalid((byte)0xFF); - - private final byte id; - - RntbdIndexingDirective(final byte id) { - this.id = id; - } - - public static RntbdIndexingDirective fromId(final byte id) { - switch (id) { - case (byte)0x00: - return Default; - case (byte)0x01: - return Include; - case (byte)0x02: - return Exclude; - case (byte)0xFF: - return Invalid; - } - throw new IllegalArgumentException("id"); - } - - public byte id() { - return this.id; - } - } - - public enum RntbdMigrateCollectionDirective { - - Thaw((byte)0x00), - Freeze((byte)0x01), - - Invalid((byte)0xFF); - - private final byte id; - - RntbdMigrateCollectionDirective(final byte id) { - this.id = id; - } - - public byte id() { - return this.id; - } - } - - enum RntbdOperationType { - - Connection((short)0x0000), - Create((short)0x0001), - Update((short)0x0002), - Read((short)0x0003), - ReadFeed((short)0x0004), - Delete((short)0x0005), - Replace((short)0x0006), - // Obsolete and now undefined: JPathQuery((short)0x0007), - ExecuteJavaScript((short)0x0008), - SQLQuery((short)0x0009), - Pause((short)0x000A), - Resume((short)0x000B), - Stop((short)0x000C), - Recycle((short)0x000D), - Crash((short)0x000E), - Query((short)0x000F), - ForceConfigRefresh((short)0x0010), - Head((short)0x0011), - HeadFeed((short)0x0012), - Upsert((short)0x0013), - Recreate((short)0x0014), - Throttle((short)0x0015), - GetSplitPoint((short)0x0016), - PreCreateValidation((short)0x0017), - BatchApply((short)0x0018), - AbortSplit((short)0x0019), - CompleteSplit((short)0x001A), - OfferUpdateOperation((short)0x001B), - OfferPreGrowValidation((short)0x001C), - BatchReportThroughputUtilization((short)0x001D), - CompletePartitionMigration((short)0x001E), - AbortPartitionMigration((short)0x001F), - PreReplaceValidation((short)0x0020), - AddComputeGatewayRequestCharges((short)0x0021), - MigratePartition((short)0x0022); - - private final short id; - - RntbdOperationType(final short id) { - this.id = id; - } - - public static RntbdOperationType fromId(final short id) throws IllegalArgumentException { - - switch (id) { - case 0x0000: - return RntbdOperationType.Connection; - case 0x0001: - return RntbdOperationType.Create; - case 0x0002: - return RntbdOperationType.Update; - case 0x0003: - return RntbdOperationType.Read; - case 0x0004: - return RntbdOperationType.ReadFeed; - case 0x0005: - return RntbdOperationType.Delete; - case 0x0006: - return RntbdOperationType.Replace; - // Obsolete and now undefined: case 0x0007: return RntbdOperationType.JPathQuery; - case 0x0008: - return RntbdOperationType.ExecuteJavaScript; - case 0x0009: - return RntbdOperationType.SQLQuery; - case 0x000A: - return RntbdOperationType.Pause; - case 0x000B: - return RntbdOperationType.Resume; - case 0x000C: - return RntbdOperationType.Stop; - case 0x000D: - return RntbdOperationType.Recycle; - case 0x000E: - return RntbdOperationType.Crash; - case 0x000F: - return RntbdOperationType.Query; - case 0x0010: - return RntbdOperationType.ForceConfigRefresh; - case 0x0011: - return RntbdOperationType.Head; - case 0x0012: - return RntbdOperationType.HeadFeed; - case 0x0013: - return RntbdOperationType.Upsert; - case 0x0014: - return RntbdOperationType.Recreate; - case 0x0015: - return RntbdOperationType.Throttle; - case 0x0016: - return RntbdOperationType.GetSplitPoint; - case 0x0017: - return RntbdOperationType.PreCreateValidation; - case 0x0018: - return RntbdOperationType.BatchApply; - case 0x0019: - return RntbdOperationType.AbortSplit; - case 0x001A: - return RntbdOperationType.CompleteSplit; - case 0x001B: - return RntbdOperationType.OfferUpdateOperation; - case 0x001C: - return RntbdOperationType.OfferPreGrowValidation; - case 0x001D: - return RntbdOperationType.BatchReportThroughputUtilization; - case 0x001E: - return RntbdOperationType.CompletePartitionMigration; - case 0x001F: - return RntbdOperationType.AbortPartitionMigration; - case 0x0020: - return RntbdOperationType.PreReplaceValidation; - case 0x0021: - return RntbdOperationType.AddComputeGatewayRequestCharges; - case 0x0022: - return RntbdOperationType.MigratePartition; - } - throw new IllegalArgumentException("id"); - } - - public short id() { - return this.id; - } - } - - public enum RntbdReadFeedKeyType { - - Invalid((byte)0x00), - ResourceId((byte)0x01), - EffectivePartitionKey((byte)0x02); - - private final byte id; - - RntbdReadFeedKeyType(final byte id) { - this.id = id; - } - - public byte id() { - return this.id; - } - } - - public enum RntbdRemoteStorageType { - - Invalid((byte)0x00), - NotSpecified((byte)0x01), - Standard((byte)0x02), - Premium((byte)0x03); - - private final byte id; - - RntbdRemoteStorageType(final byte id) { - this.id = id; - } - - public byte id() { - return this.id; - } - } - - public enum RntbdRequestHeader implements RntbdHeader { - - ResourceId((short)0x0000, RntbdTokenType.Bytes, false), - AuthorizationToken((short)0x0001, RntbdTokenType.String, false), - PayloadPresent((short)0x0002, RntbdTokenType.Byte, true), - Date((short)0x0003, RntbdTokenType.SmallString, false), - PageSize((short)0x0004, RntbdTokenType.ULong, false), - SessionToken((short)0x0005, RntbdTokenType.String, false), - ContinuationToken((short)0x0006, RntbdTokenType.String, false), - IndexingDirective((short)0x0007, RntbdTokenType.Byte, false), - Match((short)0x0008, RntbdTokenType.String, false), - PreTriggerInclude((short)0x0009, RntbdTokenType.String, false), - PostTriggerInclude((short)0x000A, RntbdTokenType.String, false), - IsFanout((short)0x000B, RntbdTokenType.Byte, false), - CollectionPartitionIndex((short)0x000C, RntbdTokenType.ULong, false), - CollectionServiceIndex((short)0x000D, RntbdTokenType.ULong, false), - PreTriggerExclude((short)0x000E, RntbdTokenType.String, false), - PostTriggerExclude((short)0x000F, RntbdTokenType.String, false), - ConsistencyLevel((short)0x0010, RntbdTokenType.Byte, false), - EntityId((short)0x0011, RntbdTokenType.String, false), - ResourceSchemaName((short)0x0012, RntbdTokenType.SmallString, false), - ReplicaPath((short)0x0013, RntbdTokenType.String, true), - ResourceTokenExpiry((short)0x0014, RntbdTokenType.ULong, false), - DatabaseName((short)0x0015, RntbdTokenType.String, false), - CollectionName((short)0x0016, RntbdTokenType.String, false), - DocumentName((short)0x0017, RntbdTokenType.String, false), - AttachmentName((short)0x0018, RntbdTokenType.String, false), - UserName((short)0x0019, RntbdTokenType.String, false), - PermissionName((short)0x001A, RntbdTokenType.String, false), - StoredProcedureName((short)0x001B, RntbdTokenType.String, false), - UserDefinedFunctionName((short)0x001C, RntbdTokenType.String, false), - TriggerName((short)0x001D, RntbdTokenType.String, false), - EnableScanInQuery((short)0x001E, RntbdTokenType.Byte, false), - EmitVerboseTracesInQuery((short)0x001F, RntbdTokenType.Byte, false), - ConflictName((short)0x0020, RntbdTokenType.String, false), - BindReplicaDirective((short)0x0021, RntbdTokenType.String, false), - PrimaryMasterKey((short)0x0022, RntbdTokenType.String, false), - SecondaryMasterKey((short)0x0023, RntbdTokenType.String, false), - PrimaryReadonlyKey((short)0x0024, RntbdTokenType.String, false), - SecondaryReadonlyKey((short)0x0025, RntbdTokenType.String, false), - ProfileRequest((short)0x0026, RntbdTokenType.Byte, false), - EnableLowPrecisionOrderBy((short)0x0027, RntbdTokenType.Byte, false), - ClientVersion((short)0x0028, RntbdTokenType.SmallString, false), - CanCharge((short)0x0029, RntbdTokenType.Byte, false), - CanThrottle((short)0x002A, RntbdTokenType.Byte, false), - PartitionKey((short)0x002B, RntbdTokenType.String, false), - PartitionKeyRangeId((short)0x002C, RntbdTokenType.String, false), - NotUsed2D((short)0x002D, RntbdTokenType.Invalid, false), - NotUsed2E((short)0x002E, RntbdTokenType.Invalid, false), - NotUsed2F((short)0x002F, RntbdTokenType.Invalid, false), - // not used 0x0030, - MigrateCollectionDirective((short)0x0031, RntbdTokenType.Byte, false), - NotUsed32((short)0x0032, RntbdTokenType.Invalid, false), - SupportSpatialLegacyCoordinates((short)0x0033, RntbdTokenType.Byte, false), - PartitionCount((short)0x0034, RntbdTokenType.ULong, false), - CollectionRid((short)0x0035, RntbdTokenType.String, false), - PartitionKeyRangeName((short)0x0036, RntbdTokenType.String, false), - // not used((short)0x0037), RoundTripTimeInMsec - // not used((short)0x0038), RequestMessageSentTime - // not used((short)0x0039), RequestMessageTimeOffset - SchemaName((short)0x003A, RntbdTokenType.String, false), - FilterBySchemaRid((short)0x003B, RntbdTokenType.String, false), - UsePolygonsSmallerThanAHemisphere((short)0x003C, RntbdTokenType.Byte, false), - GatewaySignature((short)0x003D, RntbdTokenType.String, false), - EnableLogging((short)0x003E, RntbdTokenType.Byte, false), - A_IM((short)0x003F, RntbdTokenType.String, false), - PopulateQuotaInfo((short)0x0040, RntbdTokenType.Byte, false), - DisableRUPerMinuteUsage((short)0x0041, RntbdTokenType.Byte, false), - PopulateQueryMetrics((short)0x0042, RntbdTokenType.Byte, false), - ResponseContinuationTokenLimitInKb((short)0x0043, RntbdTokenType.ULong, false), - PopulatePartitionStatistics((short)0x0044, RntbdTokenType.Byte, false), - RemoteStorageType((short)0x0045, RntbdTokenType.Byte, false), - CollectionRemoteStorageSecurityIdentifier((short)0x0046, RntbdTokenType.String, false), - IfModifiedSince((short)0x0047, RntbdTokenType.String, false), - PopulateCollectionThroughputInfo((short)0x0048, RntbdTokenType.Byte, false), - RemainingTimeInMsOnClientRequest((short)0x0049, RntbdTokenType.ULong, false), - ClientRetryAttemptCount((short)0x004A, RntbdTokenType.ULong, false), - TargetLsn((short)0x004B, RntbdTokenType.LongLong, false), - TargetGlobalCommittedLsn((short)0x004C, RntbdTokenType.LongLong, false), - TransportRequestID((short)0x004D, RntbdTokenType.ULong, false), - RestoreMetadaFilter((short)0x004E, RntbdTokenType.String, false), - RestoreParams((short)0x004F, RntbdTokenType.String, false), - ShareThroughput((short)0x0050, RntbdTokenType.Byte, false), - PartitionResourceFilter((short)0x0051, RntbdTokenType.String, false), - IsReadOnlyScript((short)0x0052, RntbdTokenType.Byte, false), - IsAutoScaleRequest((short)0x0053, RntbdTokenType.Byte, false), - ForceQueryScan((short)0x0054, RntbdTokenType.Byte, false), - // not used((short)0x0055), LeaseSeqNumber - CanOfferReplaceComplete((short)0x0056, RntbdTokenType.Byte, false), - ExcludeSystemProperties((short)0x0057, RntbdTokenType.Byte, false), - BinaryId((short)0x0058, RntbdTokenType.Bytes, false), - TimeToLiveInSeconds((short)0x0059, RntbdTokenType.Long, false), - EffectivePartitionKey((short)0x005A, RntbdTokenType.Bytes, false), - BinaryPassthroughRequest((short)0x005B, RntbdTokenType.Byte, false), - UserDefinedTypeName((short)0x005C, RntbdTokenType.String, false), - EnableDynamicRidRangeAllocation((short)0x005D, RntbdTokenType.Byte, false), - EnumerationDirection((short)0x005E, RntbdTokenType.Byte, false), - StartId((short)0x005F, RntbdTokenType.Bytes, false), - EndId((short)0x0060, RntbdTokenType.Bytes, false), - FanoutOperationState((short)0x0061, RntbdTokenType.Byte, false), - StartEpk((short)0x0062, RntbdTokenType.Bytes, false), - EndEpk((short)0x0063, RntbdTokenType.Bytes, false), - ReadFeedKeyType((short)0x0064, RntbdTokenType.Byte, false), - ContentSerializationFormat((short)0x0065, RntbdTokenType.Byte, false), - AllowTentativeWrites((short)0x0066, RntbdTokenType.Byte, false), - IsUserRequest((short)0x0067, RntbdTokenType.Byte, false), - SharedOfferThroughput((short)0x0068, RntbdTokenType.ULong, false); - - public static final ImmutableMap map; - public static final ImmutableSet set = Sets.immutableEnumSet(EnumSet.allOf(RntbdRequestHeader.class)); - - static { - final Collector> collector = ImmutableMap.toImmutableMap(RntbdRequestHeader::id, h -> h); - map = set.stream().collect(collector); - } - - private final short id; - private final boolean isRequired; - private final RntbdTokenType type; - - RntbdRequestHeader(final short id, final RntbdTokenType type, final boolean isRequired) { - this.id = id; - this.type = type; - this.isRequired = isRequired; - } - - public boolean isRequired() { - return this.isRequired; - } - - public short id() { - return this.id; - } - - public RntbdTokenType type() { - return this.type; - } - } - - enum RntbdResourceType { - - Connection((short)0x0000), - Database((short)0x0001), - Collection((short)0x0002), - Document((short)0x0003), - Attachment((short)0x0004), - User((short)0x0005), - Permission((short)0x0006), - StoredProcedure((short)0x0007), - Conflict((short)0x0008), - Trigger((short)0x0009), - UserDefinedFunction((short)0x000A), - Module((short)0x000B), - Replica((short)0x000C), - ModuleCommand((short)0x000D), - Record((short)0x000E), - Offer((short)0x000F), - PartitionSetInformation((short)0x0010), - XPReplicatorAddress((short)0x0011), - MasterPartition((short)0x0012), - ServerPartition((short)0x0013), - DatabaseAccount((short)0x0014), - Topology((short)0x0015), - PartitionKeyRange((short)0x0016), - // Obsolete and now undefined: Timestamp((short)0x0017), - Schema((short)0x0018), - BatchApply((short)0x0019), - RestoreMetadata((short)0x001A), - ComputeGatewayCharges((short)0x001B), - RidRange((short)0x001C), - UserDefinedType((short)0x001D); - - private final short id; - - RntbdResourceType(final short id) { - this.id = id; - } - - public static RntbdResourceType fromId(final short id) throws IllegalArgumentException { - switch (id) { - case 0x0000: - return RntbdResourceType.Connection; - case 0x0001: - return RntbdResourceType.Database; - case 0x0002: - return RntbdResourceType.Collection; - case 0x0003: - return RntbdResourceType.Document; - case 0x0004: - return RntbdResourceType.Attachment; - case 0x0005: - return RntbdResourceType.User; - case 0x0006: - return RntbdResourceType.Permission; - case 0x0007: - return RntbdResourceType.StoredProcedure; - case 0x0008: - return RntbdResourceType.Conflict; - case 0x0009: - return RntbdResourceType.Trigger; - case 0x000A: - return RntbdResourceType.UserDefinedFunction; - case 0x000B: - return RntbdResourceType.Module; - case 0x000C: - return RntbdResourceType.Replica; - case 0x000D: - return RntbdResourceType.ModuleCommand; - case 0x000E: - return RntbdResourceType.Record; - case 0x000F: - return RntbdResourceType.Offer; - case 0x0010: - return RntbdResourceType.PartitionSetInformation; - case 0x0011: - return RntbdResourceType.XPReplicatorAddress; - case 0x0012: - return RntbdResourceType.MasterPartition; - case 0x0013: - return RntbdResourceType.ServerPartition; - case 0x0014: - return RntbdResourceType.DatabaseAccount; - case 0x0015: - return RntbdResourceType.Topology; - case 0x0016: - return RntbdResourceType.PartitionKeyRange; - // Obsolete and now undefined: case 0x0017: return RntbdResourceType.Timestamp; - case 0x0018: - return RntbdResourceType.Schema; - case 0x0019: - return RntbdResourceType.BatchApply; - case 0x001A: - return RntbdResourceType.RestoreMetadata; - case 0x001B: - return RntbdResourceType.ComputeGatewayCharges; - case 0x001C: - return RntbdResourceType.RidRange; - case 0x001D: - return RntbdResourceType.UserDefinedType; - } - throw new IllegalArgumentException(String.format("id: %d", id)); - } - - public short id() { - return this.id; - } - } - - public enum RntbdResponseHeader implements RntbdHeader { - - PayloadPresent((short)0x0000, RntbdTokenType.Byte, true), - // not used((short)0x0001), - LastStateChangeDateTime((short)0x0002, RntbdTokenType.SmallString, false), - ContinuationToken((short)0x0003, RntbdTokenType.String, false), - ETag((short)0x0004, RntbdTokenType.String, false), - // not used((short)0x005,) - // not used((short)0x006,) - ReadsPerformed((short)0x0007, RntbdTokenType.ULong, false), - WritesPerformed((short)0x0008, RntbdTokenType.ULong, false), - QueriesPerformed((short)0x0009, RntbdTokenType.ULong, false), - IndexTermsGenerated((short)0x000A, RntbdTokenType.ULong, false), - ScriptsExecuted((short)0x000B, RntbdTokenType.ULong, false), - RetryAfterMilliseconds((short)0x000C, RntbdTokenType.ULong, false), - IndexingDirective((short)0x000D, RntbdTokenType.Byte, false), - StorageMaxResoureQuota((short)0x000E, RntbdTokenType.String, false), - StorageResourceQuotaUsage((short)0x000F, RntbdTokenType.String, false), - SchemaVersion((short)0x0010, RntbdTokenType.SmallString, false), - CollectionPartitionIndex((short)0x0011, RntbdTokenType.ULong, false), - CollectionServiceIndex((short)0x0012, RntbdTokenType.ULong, false), - LSN((short)0x0013, RntbdTokenType.LongLong, false), - ItemCount((short)0x0014, RntbdTokenType.ULong, false), - RequestCharge((short)0x0015, RntbdTokenType.Double, false), - // not used((short)0x0016), - OwnerFullName((short)0x0017, RntbdTokenType.String, false), - OwnerId((short)0x0018, RntbdTokenType.String, false), - DatabaseAccountId((short)0x0019, RntbdTokenType.String, false), - QuorumAckedLSN((short)0x001A, RntbdTokenType.LongLong, false), - RequestValidationFailure((short)0x001B, RntbdTokenType.Byte, false), - SubStatus((short)0x001C, RntbdTokenType.ULong, false), - CollectionUpdateProgress((short)0x001D, RntbdTokenType.ULong, false), - CurrentWriteQuorum((short)0x001E, RntbdTokenType.ULong, false), - CurrentReplicaSetSize((short)0x001F, RntbdTokenType.ULong, false), - CollectionLazyIndexProgress((short)0x0020, RntbdTokenType.ULong, false), - PartitionKeyRangeId((short)0x0021, RntbdTokenType.String, false), - // not used((short)0x0022), RequestMessageReceivedTime - // not used((short)0x0023), ResponseMessageSentTime - // not used((short)0x0024), ResponseMessageTimeOffset - LogResults((short)0x0025, RntbdTokenType.String, false), - XPRole((short)0x0026, RntbdTokenType.ULong, false), - IsRUPerMinuteUsed((short)0x0027, RntbdTokenType.Byte, false), - QueryMetrics((short)0x0028, RntbdTokenType.String, false), - GlobalCommittedLSN((short)0x0029, RntbdTokenType.LongLong, false), - NumberOfReadRegions((short)0x0030, RntbdTokenType.ULong, false), - OfferReplacePending((short)0x0031, RntbdTokenType.Byte, false), - ItemLSN((short)0x0032, RntbdTokenType.LongLong, false), - RestoreState((short)0x0033, RntbdTokenType.String, false), - CollectionSecurityIdentifier((short)0x0034, RntbdTokenType.String, false), - TransportRequestID((short)0x0035, RntbdTokenType.ULong, false), - ShareThroughput((short)0x0036, RntbdTokenType.Byte, false), - // not used((short)0x0037), LeaseSeqNumber - DisableRntbdChannel((short)0x0038, RntbdTokenType.Byte, false), - ServerDateTimeUtc((short)0x0039, RntbdTokenType.SmallString, false), - LocalLSN((short)0x003A, RntbdTokenType.LongLong, false), - QuorumAckedLocalLSN((short)0x003B, RntbdTokenType.LongLong, false), - ItemLocalLSN((short)0x003C, RntbdTokenType.LongLong, false), - HasTentativeWrites((short)0x003D, RntbdTokenType.Byte, false), - SessionToken((short)0x003E, RntbdTokenType.String, false); - - public static final ImmutableMap map; - public static final ImmutableSet set = Sets.immutableEnumSet(EnumSet.allOf(RntbdResponseHeader.class)); - - static { - final Collector> collector = ImmutableMap.toImmutableMap(RntbdResponseHeader::id, header -> header); - map = set.stream().collect(collector); - } - - private final short id; - private final boolean isRequired; - private final RntbdTokenType type; - - RntbdResponseHeader(final short id, final RntbdTokenType type, final boolean isRequired) { - this.id = id; - this.type = type; - this.isRequired = isRequired; - } - - public boolean isRequired() { - return this.isRequired; - } - - public short id() { - return this.id; - } - - public RntbdTokenType type() { - return this.type; - } - } - - interface RntbdHeader { - - boolean isRequired(); - - short id(); - - String name(); - - RntbdTokenType type(); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContext.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContext.java deleted file mode 100644 index bd506d1425af..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContext.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectWriter; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.ServerProperties; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.TransportException; -import io.netty.buffer.ByteBuf; -import io.netty.handler.codec.CorruptedFrameException; -import io.netty.handler.codec.http.HttpResponseStatus; - -import java.util.Collections; -import java.util.HashMap; -import java.util.UUID; - -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.CurrentProtocolVersion; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdContextHeader; - -public final class RntbdContext { - - private final RntbdResponseStatus frame; - private final Headers headers; - - private RntbdContext(final RntbdResponseStatus frame, final Headers headers) { - - this.frame = frame; - this.headers = headers; - } - - @JsonProperty - UUID getActivityId() { - return this.frame.getActivityId(); - } - - @JsonProperty - String getClientVersion() { - return this.headers.clientVersion.getValue(String.class); - } - - @JsonProperty - long getIdleTimeoutInSeconds() { - return this.headers.idleTimeoutInSeconds.getValue(Long.class); - } - - @JsonProperty - int getProtocolVersion() { - return this.headers.protocolVersion.getValue(Long.class).intValue(); - } - - @JsonProperty - ServerProperties getServerProperties() { - return new ServerProperties( - this.headers.serverAgent.getValue(String.class), - this.headers.serverVersion.getValue(String.class) - ); - } - - String getServerVersion() { - return this.headers.serverVersion.getValue(String.class); - } - - @JsonProperty - int getStatusCode() { - return this.frame.getStatusCode(); - } - - @JsonProperty - long getUnauthenticatedTimeoutInSeconds() { - return this.headers.unauthenticatedTimeoutInSeconds.getValue(Long.class); - } - - static RntbdContext decode(final ByteBuf in) throws TransportException { - - in.markReaderIndex(); - - final RntbdResponseStatus frame = RntbdResponseStatus.decode(in); - final int statusCode = frame.getStatusCode(); - final int headersLength = frame.getHeadersLength(); - - if (statusCode < 200 || statusCode >= 400) { - if (!RntbdFramer.canDecodePayload(in, in.readerIndex() + headersLength)) { - in.resetReaderIndex(); - return null; - } - } - - final Headers headers = Headers.decode(in.readSlice(headersLength)); - - if (statusCode < 200 || statusCode >= 400) { - - final ObjectNode details = RntbdObjectMapper.readTree(in.readSlice(in.readIntLE())); - final HashMap map = new HashMap<>(4); - - if (headers.clientVersion.isPresent()) { - map.put("requiredClientVersion", headers.clientVersion.getValue()); - } - - if (headers.protocolVersion.isPresent()) { - map.put("requiredProtocolVersion", headers.protocolVersion.getValue()); - } - - if (headers.serverAgent.isPresent()) { - map.put("serverAgent", headers.serverAgent.getValue()); - } - - if (headers.serverVersion.isPresent()) { - map.put("serverVersion", headers.serverVersion.getValue()); - } - - throw new TransportException(frame.getStatus(), details, Collections.unmodifiableMap(map)); - } - - return new RntbdContext(frame, headers); - } - - public void encode(final ByteBuf out) { - - final int start = out.writerIndex(); - - this.frame.encode(out); - this.headers.encode(out); - - final int length = out.writerIndex() - start; - - if (length != this.frame.getLength()) { - throw new IllegalStateException(); - } - } - - public static RntbdContext from(final RntbdContextRequest request, final ServerProperties properties, final HttpResponseStatus status) { - - // NOTE TO CODE REVIEWERS - // ---------------------- - // In its current form this method is meant to enable a limited set of test scenarios. It will be revised as - // required to support test scenarios as they are developed. - - final Headers headers = new Headers(); - - headers.clientVersion.setValue(request.getClientVersion()); - headers.idleTimeoutInSeconds.setValue(0); - headers.protocolVersion.setValue(CurrentProtocolVersion); - headers.serverAgent.setValue(properties.getAgent()); - headers.serverVersion.setValue(properties.getVersion()); - headers.unauthenticatedTimeoutInSeconds.setValue(0); - - final int length = RntbdResponseStatus.LENGTH + headers.computeLength(); - final UUID activityId = request.getActivityId(); - - final RntbdResponseStatus frame = new RntbdResponseStatus(length, status, activityId); - - return new RntbdContext(frame, headers); - } - - @Override - public String toString() { - final ObjectWriter writer = RntbdObjectMapper.writer(); - try { - return writer.writeValueAsString(this); - } catch (final JsonProcessingException error) { - throw new CorruptedFrameException(error); - } - } - - private static final class Headers extends RntbdTokenStream { - - RntbdToken clientVersion; - RntbdToken idleTimeoutInSeconds; - RntbdToken protocolVersion; - RntbdToken serverAgent; - RntbdToken serverVersion; - RntbdToken unauthenticatedTimeoutInSeconds; - - Headers() { - - super(RntbdContextHeader.set, RntbdContextHeader.map); - - this.clientVersion = this.get(RntbdContextHeader.ClientVersion); - this.idleTimeoutInSeconds = this.get(RntbdContextHeader.IdleTimeoutInSeconds); - this.protocolVersion = this.get(RntbdContextHeader.ProtocolVersion); - this.serverAgent = this.get(RntbdContextHeader.ServerAgent); - this.serverVersion = this.get(RntbdContextHeader.ServerVersion); - this.unauthenticatedTimeoutInSeconds = this.get(RntbdContextHeader.UnauthenticatedTimeoutInSeconds); - } - - static Headers decode(final ByteBuf in) { - final Headers headers = new Headers(); - Headers.decode(in, headers); - return headers; - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextDecoder.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextDecoder.java deleted file mode 100644 index 8aea47b4881d..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextDecoder.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.ByteToMessageDecoder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.List; - -class RntbdContextDecoder extends ByteToMessageDecoder { - - private static final Logger logger = LoggerFactory.getLogger(RntbdContextDecoder.class); - - /** - * Deserialize from an input {@link ByteBuf} to an {@link RntbdContext} instance - *

- * This method fulfills the promise of an {@link RntbdContext} instance. It does not pass the instance down the - * pipeline. - * - * @param context the {@link ChannelHandlerContext} to which this {@link ByteToMessageDecoder} belongs - * @param in the {@link ByteBuf} from which to readTree data - * @param out the {@link List} to which decoded messages should be added - * @throws Exception thrown if an error occurs - */ - @Override - protected void decode(final ChannelHandlerContext context, final ByteBuf in, final List out) throws Exception { - - if (RntbdFramer.canDecodeHead(in)) { - - final RntbdContext rntbdContext = RntbdContext.decode(in); - context.fireUserEventTriggered(rntbdContext); - in.discardReadBytes(); - - logger.debug("{} DECODE COMPLETE: {}", context.channel(), rntbdContext); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextNegotiator.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextNegotiator.java deleted file mode 100644 index bd5f5a079c14..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextNegotiator.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.internal.Utils; -import io.netty.buffer.ByteBuf; -import io.netty.channel.Channel; -import io.netty.channel.ChannelFutureListener; -import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.ChannelPipeline; -import io.netty.channel.ChannelPromise; -import io.netty.channel.CombinedChannelDuplexHandler; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.concurrent.CompletableFuture; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - -public final class RntbdContextNegotiator extends CombinedChannelDuplexHandler { - - private static final Logger logger = LoggerFactory.getLogger(RntbdContextNegotiator.class); - private final RntbdRequestManager manager; - private final UserAgentContainer userAgent; - - private volatile boolean pendingRntbdContextRequest = true; - - public RntbdContextNegotiator(final RntbdRequestManager manager, final UserAgentContainer userAgent) { - - super(new RntbdContextDecoder(), new RntbdContextRequestEncoder()); - - checkNotNull(manager, "manager"); - checkNotNull(userAgent, "userAgent"); - - this.manager = manager; - this.userAgent = userAgent; - } - - /** - * Called once a write operation is made. The write operation will write the messages through the - * {@link ChannelPipeline}. Those are then ready to be flushed to the actual {@link Channel} once - * {@link Channel#flush()} is called - * - * @param context the {@link ChannelHandlerContext} for which the write operation is made - * @param message the message to write - * @param promise the {@link ChannelPromise} to notify once the operation completes - * @throws Exception thrown if an error occurs - */ - @Override - public void write( - final ChannelHandlerContext context, final Object message, final ChannelPromise promise - ) throws Exception { - - checkArgument(message instanceof ByteBuf, "message: %s", message.getClass()); - final ByteBuf out = (ByteBuf)message; - - if (this.manager.hasRntbdContext()) { - context.writeAndFlush(out, promise); - } else { - if (this.pendingRntbdContextRequest) { - // Thread safe: netty guarantees that no channel handler methods are called concurrently - this.startRntbdContextRequest(context); - this.pendingRntbdContextRequest = false; - } - this.manager.pendWrite(out, promise); - } - } - - // region Privates - - private void startRntbdContextRequest(final ChannelHandlerContext context) throws Exception { - - logger.debug("{} START CONTEXT REQUEST", context.channel()); - - final Channel channel = context.channel(); - final RntbdContextRequest request = new RntbdContextRequest(Utils.randomUUID(), this.userAgent); - final CompletableFuture contextRequestFuture = this.manager.getRntbdContextRequestFuture(); - - super.write(context, request, channel.newPromise().addListener((ChannelFutureListener)future -> { - - if (future.isSuccess()) { - contextRequestFuture.complete(request); - return; - } - - if (future.isCancelled()) { - contextRequestFuture.cancel(true); - return; - } - - contextRequestFuture.completeExceptionally(future.cause()); - })); - } - - // endregion -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextRequest.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextRequest.java deleted file mode 100644 index 8c22180925e2..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextRequest.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectWriter; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import io.netty.buffer.ByteBuf; -import io.netty.handler.codec.CorruptedFrameException; - -import java.nio.charset.StandardCharsets; -import java.util.UUID; - -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.Versions; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.CurrentProtocolVersion; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdContextRequestHeader; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdOperationType; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdResourceType; - -public final class RntbdContextRequest { - - @JsonProperty - private final UUID activityId; - - @JsonProperty - private final Headers headers; - - RntbdContextRequest(final UUID activityId, final UserAgentContainer userAgent) { - this(activityId, new Headers(userAgent)); - } - - private RntbdContextRequest(final UUID activityId, final Headers headers) { - this.activityId = activityId; - this.headers = headers; - } - - public UUID getActivityId() { - return this.activityId; - } - - public String getClientVersion() { - return this.headers.clientVersion.getValue(String.class); - } - - public static RntbdContextRequest decode(final ByteBuf in) { - - final int resourceOperationTypeCode = in.getInt(in.readerIndex() + Integer.BYTES); - - if (resourceOperationTypeCode != 0) { - final String reason = String.format("resourceOperationCode=0x%08X", resourceOperationTypeCode); - throw new IllegalStateException(reason); - } - - final int start = in.readerIndex(); - final int expectedLength = in.readIntLE(); - - final RntbdRequestFrame header = RntbdRequestFrame.decode(in); - final Headers headers = Headers.decode(in.readSlice(expectedLength - (in.readerIndex() - start))); - - final int observedLength = in.readerIndex() - start; - - if (observedLength != expectedLength) { - final String reason = String.format("expectedLength=%d, observeredLength=%d", expectedLength, observedLength); - throw new IllegalStateException(reason); - } - - in.discardReadBytes(); - return new RntbdContextRequest(header.getActivityId(), headers); - } - - public void encode(final ByteBuf out) { - - final int expectedLength = RntbdRequestFrame.LENGTH + this.headers.computeLength(); - final int start = out.writerIndex(); - - out.writeIntLE(expectedLength); - - final RntbdRequestFrame header = new RntbdRequestFrame(this.getActivityId(), RntbdOperationType.Connection, RntbdResourceType.Connection); - header.encode(out); - this.headers.encode(out); - - final int observedLength = out.writerIndex() - start; - - if (observedLength != expectedLength) { - final String reason = String.format("expectedLength=%d, observeredLength=%d", expectedLength, observedLength); - throw new IllegalStateException(reason); - } - } - - @Override - public String toString() { - final ObjectWriter writer = RntbdObjectMapper.writer(); - try { - return writer.writeValueAsString(this); - } catch (final JsonProcessingException error) { - throw new CorruptedFrameException(error); - } - } - - private static final class Headers extends RntbdTokenStream { - - private static final byte[] ClientVersion = Versions.CURRENT_VERSION.getBytes(StandardCharsets.UTF_8); - - @JsonProperty - RntbdToken clientVersion; - - @JsonProperty - RntbdToken protocolVersion; - - @JsonProperty - RntbdToken userAgent; - - Headers(final UserAgentContainer container) { - - this(); - - this.clientVersion.setValue(ClientVersion); - this.protocolVersion.setValue(CurrentProtocolVersion); - this.userAgent.setValue(container.getUserAgent()); - } - - private Headers() { - - super(RntbdContextRequestHeader.set, RntbdContextRequestHeader.map); - - this.clientVersion = this.get(RntbdContextRequestHeader.ClientVersion); - this.protocolVersion = this.get(RntbdContextRequestHeader.ProtocolVersion); - this.userAgent = this.get(RntbdContextRequestHeader.UserAgent); - } - - static Headers decode(final ByteBuf in) { - return Headers.decode(in, new Headers()); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextRequestDecoder.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextRequestDecoder.java deleted file mode 100644 index eeb951e727d7..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextRequestDecoder.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.ByteToMessageDecoder; - -import java.util.List; - -public class RntbdContextRequestDecoder extends ByteToMessageDecoder { - - public RntbdContextRequestDecoder() { - this.setSingleDecode(true); - } - - /** - * Prepare for decoding an @{link RntbdContextRequest} or fire a channel readTree event to pass the input message along - * - * @param context the {@link ChannelHandlerContext} which this {@link ByteToMessageDecoder} belongs to - * @param message the message to be decoded - * @throws Exception thrown if an error occurs - */ - @Override - public void channelRead(final ChannelHandlerContext context, final Object message) throws Exception { - - if (message instanceof ByteBuf) { - - final ByteBuf in = (ByteBuf)message; - final int resourceOperationType = in.getInt(in.readerIndex() + Integer.BYTES); - - if (resourceOperationType == 0) { - assert this.isSingleDecode(); - super.channelRead(context, message); - return; - } - } - context.fireChannelRead(message); - } - - /** - * Decode an RntbdContextRequest from an {@link ByteBuf} stream - *

- * This method will be called till either an input {@link ByteBuf} has nothing to readTree on return from this method or - * till nothing is readTree from the input {@link ByteBuf}. - * - * @param context the {@link ChannelHandlerContext} which this {@link ByteToMessageDecoder} belongs to - * @param in the {@link ByteBuf} from which to readTree data - * @param out the {@link List} to which decoded messages should be added - * @throws IllegalStateException thrown if an error occurs - */ - @Override - protected void decode(final ChannelHandlerContext context, final ByteBuf in, final List out) throws IllegalStateException { - - final RntbdContextRequest request; - in.markReaderIndex(); - - try { - request = RntbdContextRequest.decode(in); - } catch (final IllegalStateException error) { - in.resetReaderIndex(); - throw error; - } - - in.discardReadBytes(); - out.add(request); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextRequestEncoder.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextRequestEncoder.java deleted file mode 100644 index f078811f5b84..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdContextRequestEncoder.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.MessageToByteEncoder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -final class RntbdContextRequestEncoder extends MessageToByteEncoder { - - private static final Logger Logger = LoggerFactory.getLogger(RntbdContextRequestEncoder.class); - - /** - * Returns {@code true} if the given message is an @{link RntbdContextRequest} instance - *

- * If {@code false} this message should be passed to the next @{link ChannelOutboundHandler} in the pipeline. - * - * @param message the message to encode - * @return @{code true}, if the given message is an an @{link RntbdContextRequest} instance; otherwise @{false} - */ - @Override - public boolean acceptOutboundMessage(final Object message) { - return message instanceof RntbdContextRequest; - } - - /** - * Encode an @{link RntbdContextRequest} message into a {@link ByteBuf} - *

- * This method will be called for each written message that can be handled by this encoder. - * - * @param context the {@link ChannelHandlerContext} which this {@link MessageToByteEncoder} belongs to - * @param message the message to encode - * @param out the {@link ByteBuf} into which the encoded message will be written - * @throws IllegalStateException is thrown if an error occurs - */ - @Override - protected void encode(final ChannelHandlerContext context, final Object message, final ByteBuf out) throws IllegalStateException { - - final RntbdContextRequest request = (RntbdContextRequest)message; - out.markWriterIndex(); - - try { - request.encode(out); - } catch (final IllegalStateException error) { - out.resetWriterIndex(); - throw error; - } - - Logger.debug("{}: ENCODE COMPLETE: request={}", context.channel(), request); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdEndpoint.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdEndpoint.java deleted file mode 100644 index 27cf10d49070..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdEndpoint.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResponse; -import io.netty.handler.logging.LogLevel; -import io.netty.handler.ssl.SslContext; - -import java.net.URI; -import java.util.concurrent.CompletableFuture; -import java.util.stream.Stream; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.RntbdTransportClient.Options; - -public interface RntbdEndpoint extends AutoCloseable { - - String getName(); - - @Override - void close() throws RuntimeException; - - CompletableFuture request(RntbdRequestArgs requestArgs); - - interface Provider extends AutoCloseable { - - @Override - void close() throws RuntimeException; - - Config config(); - - int count(); - - RntbdEndpoint get(URI physicalAddress); - - Stream list(); - } - - final class Config { - - private final Options options; - private final SslContext sslContext; - private final LogLevel wireLogLevel; - - public Config(final Options options, final SslContext sslContext, final LogLevel wireLogLevel) { - - checkNotNull(options, "options"); - checkNotNull(sslContext, "sslContext"); - - this.options = options; - this.sslContext = sslContext; - this.wireLogLevel = wireLogLevel; - } - - public int getConnectionTimeout() { - final long value = this.options.getConnectionTimeout().toMillis(); - assert value <= Integer.MAX_VALUE; - return (int)value; - } - - public int getMaxChannelsPerEndpoint() { - return this.options.getMaxChannelsPerEndpoint(); - } - - public int getMaxRequestsPerChannel() { - return this.options.getMaxRequestsPerChannel(); - } - - public long getReceiveHangDetectionTime() { - return this.options.getReceiveHangDetectionTime().toNanos(); - } - - public long getRequestTimeout() { - return this.options.getRequestTimeout().toNanos(); - } - - public long getSendHangDetectionTime() { - return this.options.getSendHangDetectionTime().toNanos(); - } - - public SslContext getSslContext() { - return this.sslContext; - } - - public UserAgentContainer getUserAgent() { - return this.options.getUserAgent(); - } - - public LogLevel getWireLogLevel() { - return this.wireLogLevel; - } - - @Override - public String toString() { - return RntbdObjectMapper.toJson(this); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdFramer.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdFramer.java deleted file mode 100644 index 2b38ceb4c3ff..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdFramer.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import io.netty.buffer.ByteBuf; -import io.netty.handler.codec.CorruptedFrameException; - -import static com.google.common.base.Preconditions.checkNotNull; - -final class RntbdFramer { - - private RntbdFramer() { - } - - static boolean canDecodeHead(final ByteBuf in) throws CorruptedFrameException { - - checkNotNull(in, "in"); - - if (in.readableBytes() < RntbdResponseStatus.LENGTH) { - return false; - } - - final int start = in.readerIndex(); - final long length = in.getUnsignedIntLE(start); - - if (length > Integer.MAX_VALUE) { - final String reason = String.format("Head frame length exceeds Integer.MAX_VALUE, %d: %d", - Integer.MAX_VALUE, length - ); - throw new CorruptedFrameException(reason); - } - - if (length < Integer.BYTES) { - final String reason = String.format("Head frame length is less than size of length field, %d: %d", - Integer.BYTES, length - ); - throw new CorruptedFrameException(reason); - } - - return length <= in.readableBytes(); - } - - static boolean canDecodePayload(final ByteBuf in, final int start) { - - checkNotNull(in, "in"); - - final int readerIndex = in.readerIndex(); - - if (start < readerIndex) { - throw new IllegalArgumentException("start < in.readerIndex()"); - } - - final int offset = start - readerIndex; - - if (in.readableBytes() - offset < Integer.BYTES) { - return false; - } - - final long length = in.getUnsignedIntLE(start); - - if (length > Integer.MAX_VALUE) { - final String reason = String.format("Payload frame length exceeds Integer.MAX_VALUE, %d: %d", - Integer.MAX_VALUE, length - ); - throw new CorruptedFrameException(reason); - } - - return offset + Integer.BYTES + length <= in.readableBytes(); - } - - static boolean canDecodePayload(final ByteBuf in) { - return canDecodePayload(in, in.readerIndex()); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdMetrics.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdMetrics.java deleted file mode 100644 index a0fef0c4a43e..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdMetrics.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.codahale.metrics.Gauge; -import com.codahale.metrics.Meter; -import com.codahale.metrics.MetricFilter; -import com.codahale.metrics.MetricRegistry; -import com.codahale.metrics.RatioGauge; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.google.common.base.Stopwatch; - -import java.time.Duration; - -@JsonPropertyOrder({ - "lifetime", "requests", "responses", "errorResponses", "responseRate", "completionRate", "throughput" -}) -public final class RntbdMetrics implements AutoCloseable { - - // region Fields - - private static final MetricRegistry registry = new MetricRegistry(); - - private final Gauge completionRate; - private final Meter errorResponses; - private final Stopwatch lifetime; - private final String prefix; - private final Meter requests; - private final Gauge responseRate; - private final Meter responses; - - // endregion - - // region Constructors - - public RntbdMetrics(final String name) { - - this.lifetime = Stopwatch.createStarted(); - this.prefix = name + '.'; - - this.requests = registry.register(this.prefix + "requests", new Meter()); - this.responses = registry.register(this.prefix + "responses", new Meter()); - this.errorResponses = registry.register(this.prefix + "errorResponses", new Meter()); - this.responseRate = registry.register(this.prefix + "responseRate", new ResponseRate(this)); - this.completionRate = registry.register(this.prefix + "completionRate", new CompletionRate(this)); - } - - // endregion - - // region Accessors - - public double getCompletionRate() { - return this.completionRate.getValue(); - } - - public long getErrorResponses() { - return this.errorResponses.getCount(); - } - - public double getLifetime() { - final Duration elapsed = this.lifetime.elapsed(); - return elapsed.getSeconds() + (1E-9D * elapsed.getNano()); - } - - public long getRequests() { - return this.requests.getCount(); - } - - public double getResponseRate() { - return this.responseRate.getValue(); - } - - public long getResponses() { - return this.responses.getCount(); - } - - public double getThroughput() { - return this.responses.getMeanRate(); - } - - // endregion - - // region Methods - - @Override - public void close() { - registry.removeMatching(MetricFilter.startsWith(this.prefix)); - } - - public final void incrementErrorResponseCount() { - this.errorResponses.mark(); - } - - public final void incrementRequestCount() { - this.requests.mark(); - } - - public final void incrementResponseCount() { - this.responses.mark(); - } - - @Override - public String toString() { - return RntbdObjectMapper.toJson(this); - } - - // endregion - - private static final class CompletionRate extends RatioGauge { - - private final RntbdMetrics metrics; - - private CompletionRate(RntbdMetrics metrics) { - this.metrics = metrics; - } - - @Override - protected Ratio getRatio() { - return Ratio.of(this.metrics.responses.getCount() - this.metrics.errorResponses.getCount(), - this.metrics.requests.getCount()); - } - } - - private static final class ResponseRate extends RatioGauge { - - private final RntbdMetrics metrics; - - private ResponseRate(RntbdMetrics metrics) { - this.metrics = metrics; - } - - @Override - protected Ratio getRatio() { - return Ratio.of(this.metrics.responses.getCount(), this.metrics.requests.getCount()); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdObjectMapper.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdObjectMapper.java deleted file mode 100644 index 6b9c7d984373..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdObjectMapper.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.ObjectWriter; -import com.fasterxml.jackson.databind.node.JsonNodeType; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.fasterxml.jackson.databind.ser.PropertyFilter; -import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufInputStream; -import io.netty.handler.codec.CorruptedFrameException; -import io.netty.handler.codec.EncoderException; - -import java.io.IOException; -import java.io.InputStream; - -import static com.google.common.base.Preconditions.checkNotNull; - -public final class RntbdObjectMapper { - - private static final SimpleFilterProvider filterProvider; - private static final ObjectMapper objectMapper; - private static final ObjectWriter objectWriter; - - static { - objectMapper = new ObjectMapper().setFilterProvider(filterProvider = new SimpleFilterProvider()); - objectWriter = objectMapper.writer(); - } - - private RntbdObjectMapper() { - } - - static ObjectNode readTree(final RntbdResponse response) { - checkNotNull(response, "response"); - return readTree(response.getContent()); - } - - static ObjectNode readTree(final ByteBuf in) { - - checkNotNull(in, "in"); - final JsonNode node; - - try (final InputStream istream = new ByteBufInputStream(in)) { - node = objectMapper.readTree(istream); - } catch (final IOException error) { - throw new CorruptedFrameException(error); - } - - if (node.isObject()) { - return (ObjectNode)node; - } - - final String cause = String.format("Expected %s, not %s", JsonNodeType.OBJECT, node.getNodeType()); - throw new CorruptedFrameException(cause); - } - - static void registerPropertyFilter(final Class type, final Class filter) { - - checkNotNull(type, "type"); - checkNotNull(filter, "filter"); - - try { - filterProvider.addFilter(type.getSimpleName(), filter.newInstance()); - } catch (final ReflectiveOperationException error) { - throw new IllegalStateException(error); - } - } - - public static String toJson(Object value) { - try { - return objectWriter.writeValueAsString(value); - } catch (final JsonProcessingException error) { - throw new EncoderException(error); - } - } - - public static ObjectWriter writer() { - return objectWriter; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdReporter.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdReporter.java deleted file mode 100644 index 5f0ee7d3de0e..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdReporter.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import org.apache.commons.lang3.exception.ExceptionUtils; -import org.slf4j.Logger; -import org.slf4j.helpers.FormattingTuple; -import org.slf4j.helpers.MessageFormatter; - -import java.nio.file.Paths; - -public final class RntbdReporter { - - private static final String codeSource = Paths.get( - RntbdReporter.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getFileName().toString(); - - private RntbdReporter() { - } - - public static void reportIssue(Logger logger, Object subject, String format, Object... arguments) { - if (logger.isErrorEnabled()) { - doReportIssue(logger, subject, format, arguments); - } - } - - public static void reportIssueUnless( - boolean predicate, Logger logger, Object subject, String format, Object... arguments - ) { - if (!predicate && logger.isErrorEnabled()) { - doReportIssue(logger, subject, format, arguments); - } - } - - private static void doReportIssue(Logger logger, Object subject, String format, Object[] arguments) { - - FormattingTuple formattingTuple = MessageFormatter.arrayFormat(format, arguments); - StackTraceElement[] stackTraceElements = new Exception().getStackTrace(); - Throwable throwable = formattingTuple.getThrowable(); - - if (throwable == null) { - logger.error("Report this {} issue to ensure it is addressed:\n[{}]\n[{}]\n[{}]", - codeSource, subject, stackTraceElements[2], formattingTuple.getMessage() - ); - } else { - logger.error("Report this {} issue to ensure it is addressed:\n[{}]\n[{}]\n[{}{}{}]", - codeSource, subject, stackTraceElements[2], formattingTuple.getMessage(), - throwable, ExceptionUtils.getStackTrace(throwable) - ); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequest.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequest.java deleted file mode 100644 index 90f041a305f5..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequest.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import io.netty.buffer.ByteBuf; - -import java.util.UUID; - -import static com.google.common.base.Preconditions.checkNotNull; - -public final class RntbdRequest { - - private static final byte[] EmptyByteArray = {}; - - private final RntbdRequestFrame frame; - private final RntbdRequestHeaders headers; - private final byte[] payload; - - private RntbdRequest(final RntbdRequestFrame frame, final RntbdRequestHeaders headers, final byte[] payload) { - - checkNotNull(frame, "frame"); - checkNotNull(headers, "headers"); - - this.frame = frame; - this.headers = headers; - this.payload = payload == null ? EmptyByteArray : payload; - } - - public UUID getActivityId() { - return this.frame.getActivityId(); - } - - static RntbdRequest decode(final ByteBuf in) { - - final int resourceOperationCode = in.getInt(in.readerIndex() + Integer.BYTES); - - if (resourceOperationCode == 0) { - final String reason = String.format("resourceOperationCode=0x%08X", resourceOperationCode); - throw new IllegalStateException(reason); - } - - final int start = in.readerIndex(); - final int expectedLength = in.readIntLE(); - - final RntbdRequestFrame header = RntbdRequestFrame.decode(in); - final RntbdRequestHeaders metadata = RntbdRequestHeaders.decode(in); - final ByteBuf payloadBuf = in.readSlice(expectedLength - (in.readerIndex() - start)); - - final int observedLength = in.readerIndex() - start; - - if (observedLength != expectedLength) { - final String reason = String.format("expectedLength=%d, observedLength=%d", expectedLength, observedLength); - throw new IllegalStateException(reason); - } - - final byte[] payload = new byte[payloadBuf.readableBytes()]; - payloadBuf.readBytes(payload); - in.discardReadBytes(); - - return new RntbdRequest(header, metadata, payload); - } - - void encode(final ByteBuf out) { - - final int expectedLength = RntbdRequestFrame.LENGTH + this.headers.computeLength(); - final int start = out.readerIndex(); - - out.writeIntLE(expectedLength); - this.frame.encode(out); - this.headers.encode(out); - - assert out.writerIndex() - start == expectedLength; - - if (this.payload.length > 0) { - out.writeIntLE(this.payload.length); - out.writeBytes(this.payload); - } - } - - public static RntbdRequest from(final RntbdRequestArgs args) { - - final RxDocumentServiceRequest serviceRequest = args.getServiceRequest(); - - final RntbdRequestFrame frame = new RntbdRequestFrame( - args.getActivityId(), - serviceRequest.getOperationType(), - serviceRequest.getResourceType()); - - final RntbdRequestHeaders headers = new RntbdRequestHeaders(args, frame); - - return new RntbdRequest(frame, headers, serviceRequest.getContent()); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestArgs.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestArgs.java deleted file mode 100644 index 226259c6e229..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestArgs.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.google.common.base.Stopwatch; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import io.netty.channel.ChannelHandlerContext; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; - -import java.math.BigDecimal; -import java.net.URI; -import java.time.Duration; -import java.util.UUID; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static com.google.common.base.Preconditions.checkNotNull; - -public final class RntbdRequestArgs { - - private static final String className = RntbdRequestArgs.class.getCanonicalName(); - - private final UUID activityId; - private final long birthTime; - private final Stopwatch lifetime; - private final URI physicalAddress; - private final String replicaPath; - private final RxDocumentServiceRequest serviceRequest; - - public RntbdRequestArgs(final RxDocumentServiceRequest serviceRequest, final URI physicalAddress) { - this.activityId = UUID.fromString(serviceRequest.getActivityId()); - this.birthTime = System.nanoTime(); - this.lifetime = Stopwatch.createStarted(); - this.physicalAddress = physicalAddress; - this.replicaPath = StringUtils.stripEnd(physicalAddress.getPath(), "/"); - this.serviceRequest = serviceRequest; - } - - public UUID getActivityId() { - return this.activityId; - } - - public long getBirthTime() { - return this.birthTime; - } - - public Duration getLifetime() { - return this.lifetime.elapsed(); - } - - public String getReplicaPath() { - return this.replicaPath; - } - - public URI getPhysicalAddress() { - return this.physicalAddress; - } - - public RxDocumentServiceRequest getServiceRequest() { - return this.serviceRequest; - } - - @Override - public String toString() { - return '[' + RntbdRequestArgs.className + '(' + this.serviceRequest.getActivityId() - + ", origin: " + this.physicalAddress.getScheme() + "://" + this.physicalAddress.getAuthority() - + ", operationType: " + this.serviceRequest.getOperationType() - + ", resourceType: " + this.serviceRequest.getResourceType() - + ", replicaPath: " + this.replicaPath - + ", lifetime: " + this.getLifetime() - + ")]"; - } - - public void traceOperation(final Logger logger, final ChannelHandlerContext context, final String operationName, final Object... args) { - - checkNotNull(logger, "logger"); - - if (logger.isTraceEnabled()) { - final BigDecimal lifetime = BigDecimal.valueOf(this.lifetime.elapsed().toNanos(), 6); - logger.trace("{},{},\"{}({})\",\"{}\",\"{}\"", this.birthTime, lifetime, operationName, - Stream.of(args).map(arg -> - arg == null ? "null" : arg.toString()).collect(Collectors.joining(",") - ), - this, context - ); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestDecoder.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestDecoder.java deleted file mode 100644 index 3f1de9c65c24..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestDecoder.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.ByteToMessageDecoder; - -import java.util.List; - -public final class RntbdRequestDecoder extends ByteToMessageDecoder { - /** - * Prepare for decoding an @{link RntbdRequest} or fire a channel readTree event to pass the input message along - * - * @param context the {@link ChannelHandlerContext} which this {@link ByteToMessageDecoder} belongs to - * @param message the message to be decoded - * @throws Exception thrown if an error occurs - */ - @Override - public void channelRead(final ChannelHandlerContext context, final Object message) throws Exception { - - if (message instanceof ByteBuf) { - - final ByteBuf in = (ByteBuf)message; - final int resourceOperationType = in.getInt(in.readerIndex() + Integer.BYTES); - - if (resourceOperationType != 0) { - super.channelRead(context, message); - return; - } - } - - context.fireChannelRead(message); - } - - /** - * Decode the input {@link ByteBuf} to an RntbdRequest instance - *

- * This method will be called till either the input {@link ByteBuf} has nothing to readTree after return from this - * method or till nothing was readTree from the input {@link ByteBuf}. - * - * @param context the {@link ChannelHandlerContext} which this {@link ByteToMessageDecoder} belongs to - * @param in the {@link ByteBuf} from which to readTree data - * @param out the {@link List} to which decoded messages should be added - * @throws IllegalStateException thrown if an error occurs - */ - @Override - protected void decode(final ChannelHandlerContext context, final ByteBuf in, final List out) throws IllegalStateException { - - final RntbdRequest request; - in.markReaderIndex(); - - try { - request = RntbdRequest.decode(in); - } catch (final IllegalStateException error) { - in.resetReaderIndex(); - throw error; - } - - in.discardReadBytes(); - out.add(request); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestEncoder.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestEncoder.java deleted file mode 100644 index 247ca7d19878..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestEncoder.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.ChannelOutboundHandler; -import io.netty.handler.codec.MessageToByteEncoder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public final class RntbdRequestEncoder extends MessageToByteEncoder { - - private static final Logger logger = LoggerFactory.getLogger(RntbdRequestEncoder.class); - - /** - * Returns {@code true} if the given message is an @{link RntbdRequest} instance - *

- * If {@code false} this message should be passed to the next {@link ChannelOutboundHandler} in the pipeline. - * - * @param message the message to encode - * @return {@code true}, if the given message is an an {@link RntbdRequest} instance; otherwise @{false} - */ - @Override - public boolean acceptOutboundMessage(final Object message) { - return message instanceof RntbdRequestArgs; - } - - /** - * Encode a message into a {@link ByteBuf} - *

- * This method will be called for each message that can be written by this encoder. - * - * @param context the {@link ChannelHandlerContext} which this {@link MessageToByteEncoder} belongs encode - * @param message the message to encode - * @param out the {@link ByteBuf} into which the encoded message will be written - */ - @Override - protected void encode(final ChannelHandlerContext context, final Object message, final ByteBuf out) throws Exception { - - final RntbdRequest request = RntbdRequest.from((RntbdRequestArgs)message); - final int start = out.writerIndex(); - - try { - request.encode(out); - } catch (final Throwable error) { - out.writerIndex(start); - throw error; - } - - if (logger.isDebugEnabled()) { - final int length = out.writerIndex() - start; - logger.debug("{}: ENCODE COMPLETE: length={}, request={}", context.channel(), length, request); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestFrame.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestFrame.java deleted file mode 100644 index 80c181d5bfb2..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestFrame.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import io.netty.buffer.ByteBuf; - -import java.util.Locale; -import java.util.UUID; - -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdOperationType; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdResourceType; - -final class RntbdRequestFrame { - - // region Fields - - static final int LENGTH = Integer.BYTES // messageLength - + Short.BYTES // resourceType - + Short.BYTES // operationType - + 2 * Long.BYTES; // activityId - - private final UUID activityId; - private final RntbdOperationType operationType; - private final RntbdResourceType resourceType; - - // region Constructors - - RntbdRequestFrame(final UUID activityId, final OperationType operationType, final ResourceType resourceType) { - this(activityId, map(operationType), map(resourceType)); - } - - RntbdRequestFrame(final UUID activityId, final RntbdOperationType operationType, final RntbdResourceType resourceType) { - this.activityId = activityId; - this.operationType = operationType; - this.resourceType = resourceType; - } - - // endregion - - // region Methods - - UUID getActivityId() { - return this.activityId; - } - - RntbdOperationType getOperationType() { - return this.operationType; - } - - RntbdResourceType getResourceType() { - return this.resourceType; - } - - static RntbdRequestFrame decode(final ByteBuf in) { - - final RntbdResourceType resourceType = RntbdResourceType.fromId(in.readShortLE()); - final RntbdOperationType operationType = RntbdOperationType.fromId(in.readShortLE()); - final UUID activityId = RntbdUUID.decode(in); - - return new RntbdRequestFrame(activityId, operationType, resourceType); - } - - void encode(final ByteBuf out) { - out.writeShortLE(this.resourceType.id()); - out.writeShortLE(this.operationType.id()); - RntbdUUID.encode(this.activityId, out); - } - - private static RntbdResourceType map(final ResourceType resourceType) { - - switch (resourceType) { - case Attachment: - return RntbdResourceType.Attachment; - case DocumentCollection: - return RntbdResourceType.Collection; - case Conflict: - return RntbdResourceType.Conflict; - case Database: - return RntbdResourceType.Database; - case Document: - return RntbdResourceType.Document; - case Module: - return RntbdResourceType.Module; - case ModuleCommand: - return RntbdResourceType.ModuleCommand; - case Record: - return RntbdResourceType.Record; - case Permission: - return RntbdResourceType.Permission; - case Replica: - return RntbdResourceType.Replica; - case StoredProcedure: - return RntbdResourceType.StoredProcedure; - case Trigger: - return RntbdResourceType.Trigger; - case User: - return RntbdResourceType.User; - case UserDefinedType: - return RntbdResourceType.UserDefinedType; - case UserDefinedFunction: - return RntbdResourceType.UserDefinedFunction; - case Offer: - return RntbdResourceType.Offer; - case PartitionSetInformation: - return RntbdResourceType.PartitionSetInformation; - case XPReplicatorAddress: - return RntbdResourceType.XPReplicatorAddress; - case MasterPartition: - return RntbdResourceType.MasterPartition; - case ServerPartition: - return RntbdResourceType.ServerPartition; - case DatabaseAccount: - return RntbdResourceType.DatabaseAccount; - case Topology: - return RntbdResourceType.Topology; - case PartitionKeyRange: - return RntbdResourceType.PartitionKeyRange; - case Schema: - return RntbdResourceType.Schema; - case BatchApply: - return RntbdResourceType.BatchApply; - case RestoreMetadata: - return RntbdResourceType.RestoreMetadata; - case ComputeGatewayCharges: - return RntbdResourceType.ComputeGatewayCharges; - case RidRange: - return RntbdResourceType.RidRange; - default: - final String reason = String.format(Locale.ROOT, "Unrecognized resource type: %s", resourceType); - throw new UnsupportedOperationException(reason); - } - } - - private static RntbdOperationType map(final OperationType operationType) { - - switch (operationType) { - case Crash: - return RntbdOperationType.Crash; - case Create: - return RntbdOperationType.Create; - case Delete: - return RntbdOperationType.Delete; - case ExecuteJavaScript: - return RntbdOperationType.ExecuteJavaScript; - case Query: - return RntbdOperationType.Query; - case Pause: - return RntbdOperationType.Pause; - case Read: - return RntbdOperationType.Read; - case ReadFeed: - return RntbdOperationType.ReadFeed; - case Recreate: - return RntbdOperationType.Recreate; - case Recycle: - return RntbdOperationType.Recycle; - case Replace: - return RntbdOperationType.Replace; - case Resume: - return RntbdOperationType.Resume; - case Stop: - return RntbdOperationType.Stop; - case SqlQuery: - return RntbdOperationType.SQLQuery; - case Update: - return RntbdOperationType.Update; - case ForceConfigRefresh: - return RntbdOperationType.ForceConfigRefresh; - case Head: - return RntbdOperationType.Head; - case HeadFeed: - return RntbdOperationType.HeadFeed; - case Upsert: - return RntbdOperationType.Upsert; - case Throttle: - return RntbdOperationType.Throttle; - case PreCreateValidation: - return RntbdOperationType.PreCreateValidation; - case GetSplitPoint: - return RntbdOperationType.GetSplitPoint; - case AbortSplit: - return RntbdOperationType.AbortSplit; - case CompleteSplit: - return RntbdOperationType.CompleteSplit; - case BatchApply: - return RntbdOperationType.BatchApply; - case OfferUpdateOperation: - return RntbdOperationType.OfferUpdateOperation; - case OfferPreGrowValidation: - return RntbdOperationType.OfferPreGrowValidation; - case BatchReportThroughputUtilization: - return RntbdOperationType.BatchReportThroughputUtilization; - case AbortPartitionMigration: - return RntbdOperationType.AbortPartitionMigration; - case CompletePartitionMigration: - return RntbdOperationType.CompletePartitionMigration; - case PreReplaceValidation: - return RntbdOperationType.PreReplaceValidation; - case MigratePartition: - return RntbdOperationType.MigratePartition; - case AddComputeGatewayRequestCharges: - return RntbdOperationType.AddComputeGatewayRequestCharges; - default: - final String reason = String.format(Locale.ROOT, "Unrecognized operation type: %s", operationType); - throw new UnsupportedOperationException(reason); - } - } - - // endregion -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestFramer.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestFramer.java deleted file mode 100644 index 21a64a554ee1..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestFramer.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import io.netty.handler.codec.LengthFieldBasedFrameDecoder; - -import java.nio.ByteOrder; - -public final class RntbdRequestFramer extends LengthFieldBasedFrameDecoder { - - public RntbdRequestFramer() { - super(ByteOrder.LITTLE_ENDIAN, Integer.MAX_VALUE, 0, Integer.BYTES, -Integer.BYTES, 0, true); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestHeaders.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestHeaders.java deleted file mode 100644 index bac0da32f9b6..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestHeaders.java +++ /dev/null @@ -1,1272 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.IndexingDirective; -import com.microsoft.azure.cosmosdb.internal.ContentSerializationFormat; -import com.microsoft.azure.cosmosdb.internal.EnumerationDirection; -import com.microsoft.azure.cosmosdb.internal.FanoutOperationState; -import com.microsoft.azure.cosmosdb.internal.MigrateCollectionDirective; -import com.microsoft.azure.cosmosdb.internal.Paths; -import com.microsoft.azure.cosmosdb.internal.ReadFeedKeyType; -import com.microsoft.azure.cosmosdb.internal.RemoteStorageType; -import com.microsoft.azure.cosmosdb.internal.ResourceId; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import io.netty.buffer.ByteBuf; -import org.apache.commons.lang3.EnumUtils; -import org.apache.commons.lang3.StringUtils; - -import java.util.Base64; -import java.util.Locale; -import java.util.Map; -import java.util.function.Supplier; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.HttpHeaders; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.WFConstants.BackendHeaders; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdConsistencyLevel; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdContentSerializationFormat; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdEnumerationDirection; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdFanoutOperationState; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdIndexingDirective; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdMigrateCollectionDirective; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdOperationType; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdReadFeedKeyType; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdRemoteStorageType; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdRequestHeader; - -@JsonFilter("RntbdToken") -final class RntbdRequestHeaders extends RntbdTokenStream { - - // region Fields - - private static final String UrlTrim = "/+"; - - // endregion - - // region Constructors - - RntbdRequestHeaders(final RntbdRequestArgs args, final RntbdRequestFrame frame) { - - this(); - - checkNotNull(args, "args"); - checkNotNull(frame, "frame"); - - final RxDocumentServiceRequest request = args.getServiceRequest(); - final byte[] content = request.getContent(); - - this.getPayloadPresent().setValue(content != null && content.length > 0); - this.getReplicaPath().setValue(args.getReplicaPath()); - - final Map headers = request.getHeaders(); - - // Special-case headers - - this.addAimHeader(headers); - this.addAllowScanOnQuery(headers); - this.addBinaryIdIfPresent(headers); - this.addCanCharge(headers); - this.addCanOfferReplaceComplete(headers); - this.addCanThrottle(headers); - this.addCollectionRemoteStorageSecurityIdentifier(headers); - this.addConsistencyLevelHeader(headers); - this.addContentSerializationFormat(headers); - this.addContinuationToken(request); - this.addDateHeader(headers); - this.addDisableRUPerMinuteUsage(headers); - this.addEmitVerboseTracesInQuery(headers); - this.addEnableLogging(headers); - this.addEnableLowPrecisionOrderBy(headers); - this.addEntityId(headers); - this.addEnumerationDirection(headers); - this.addExcludeSystemProperties(headers); - this.addFanoutOperationStateHeader(headers); - this.addIfModifiedSinceHeader(headers); - this.addIndexingDirectiveHeader(headers); - this.addIsAutoScaleRequest(headers); - this.addIsFanout(headers); - this.addIsReadOnlyScript(headers); - this.addIsUserRequest(headers); - this.addMatchHeader(headers, frame.getOperationType()); - this.addMigrateCollectionDirectiveHeader(headers); - this.addPageSize(headers); - this.addPopulateCollectionThroughputInfo(headers); - this.addPopulatePartitionStatistics(headers); - this.addPopulateQueryMetrics(headers); - this.addPopulateQuotaInfo(headers); - this.addProfileRequest(headers); - this.addQueryForceScan(headers); - this.addRemoteStorageType(headers); - this.addResourceIdOrPathHeaders(request); - this.addResponseContinuationTokenLimitInKb(headers); - this.addShareThroughput(headers); - this.addStartAndEndKeys(headers); - this.addSupportSpatialLegacyCoordinates(headers); - this.addUsePolygonsSmallerThanAHemisphere(headers); - - // Normal headers (Strings, Ints, Longs, etc.) - - this.fillTokenFromHeader(headers, this::getAllowTentativeWrites, BackendHeaders.ALLOW_TENTATIVE_WRITES); - this.fillTokenFromHeader(headers, this::getAuthorizationToken, HttpHeaders.AUTHORIZATION); - this.fillTokenFromHeader(headers, this::getBinaryPassThroughRequest, BackendHeaders.BINARY_PASSTHROUGH_REQUEST); - this.fillTokenFromHeader(headers, this::getBindReplicaDirective, BackendHeaders.BIND_REPLICA_DIRECTIVE); - this.fillTokenFromHeader(headers, this::getClientRetryAttemptCount, HttpHeaders.CLIENT_RETRY_ATTEMPT_COUNT); - this.fillTokenFromHeader(headers, this::getCollectionPartitionIndex, BackendHeaders.COLLECTION_PARTITION_INDEX); - this.fillTokenFromHeader(headers, this::getCollectionRid, BackendHeaders.COLLECTION_RID); - this.fillTokenFromHeader(headers, this::getCollectionServiceIndex, BackendHeaders.COLLECTION_SERVICE_INDEX); - this.fillTokenFromHeader(headers, this::getEffectivePartitionKey, BackendHeaders.EFFECTIVE_PARTITION_KEY); - this.fillTokenFromHeader(headers, this::getEnableDynamicRidRangeAllocation, BackendHeaders.ENABLE_DYNAMIC_RID_RANGE_ALLOCATION); - this.fillTokenFromHeader(headers, this::getFilterBySchemaRid, HttpHeaders.FILTER_BY_SCHEMA_RESOURCE_ID); - this.fillTokenFromHeader(headers, this::getGatewaySignature, HttpHeaders.GATEWAY_SIGNATURE); - this.fillTokenFromHeader(headers, this::getPartitionCount, BackendHeaders.PARTITION_COUNT); - this.fillTokenFromHeader(headers, this::getPartitionKey, HttpHeaders.PARTITION_KEY); - this.fillTokenFromHeader(headers, this::getPartitionKeyRangeId, HttpHeaders.PARTITION_KEY_RANGE_ID); - this.fillTokenFromHeader(headers, this::getPartitionResourceFilter, BackendHeaders.PARTITION_RESOURCE_FILTER); - this.fillTokenFromHeader(headers, this::getPostTriggerExclude, HttpHeaders.POST_TRIGGER_EXCLUDE); - this.fillTokenFromHeader(headers, this::getPostTriggerInclude, HttpHeaders.POST_TRIGGER_INCLUDE); - this.fillTokenFromHeader(headers, this::getPreTriggerExclude, HttpHeaders.PRE_TRIGGER_EXCLUDE); - this.fillTokenFromHeader(headers, this::getPreTriggerInclude, HttpHeaders.PRE_TRIGGER_INCLUDE); - this.fillTokenFromHeader(headers, this::getPrimaryMasterKey, BackendHeaders.PRIMARY_MASTER_KEY); - this.fillTokenFromHeader(headers, this::getPrimaryReadonlyKey, BackendHeaders.PRIMARY_READONLY_KEY); - this.fillTokenFromHeader(headers, this::getRemainingTimeInMsOnClientRequest, HttpHeaders.REMAINING_TIME_IN_MS_ON_CLIENT_REQUEST); - this.fillTokenFromHeader(headers, this::getResourceSchemaName, BackendHeaders.RESOURCE_SCHEMA_NAME); - this.fillTokenFromHeader(headers, this::getResourceTokenExpiry, HttpHeaders.RESOURCE_TOKEN_EXPIRY); - this.fillTokenFromHeader(headers, this::getRestoreMetadataFilter, HttpHeaders.RESTORE_METADATA_FILTER); - this.fillTokenFromHeader(headers, this::getRestoreParams, BackendHeaders.RESTORE_PARAMS); - this.fillTokenFromHeader(headers, this::getSecondaryMasterKey, BackendHeaders.SECONDARY_MASTER_KEY); - this.fillTokenFromHeader(headers, this::getSecondaryReadonlyKey, BackendHeaders.SECONDARY_READONLY_KEY); - this.fillTokenFromHeader(headers, this::getSessionToken, HttpHeaders.SESSION_TOKEN); - this.fillTokenFromHeader(headers, this::getSharedOfferThroughput, HttpHeaders.SHARED_OFFER_THROUGHPUT); - this.fillTokenFromHeader(headers, this::getTargetGlobalCommittedLsn, HttpHeaders.TARGET_GLOBAL_COMMITTED_LSN); - this.fillTokenFromHeader(headers, this::getTargetLsn, HttpHeaders.TARGET_LSN); - this.fillTokenFromHeader(headers, this::getTimeToLiveInSeconds, BackendHeaders.TIME_TO_LIVE_IN_SECONDS); - this.fillTokenFromHeader(headers, this::getTransportRequestID, HttpHeaders.TRANSPORT_REQUEST_ID); - - // Will be null in case of direct, which is fine - BE will use the value slice the connection context this. - // When this is used in Gateway, the header value will be populated with the proxied HTTP request's header, - // and BE will respect the per-request value. - - this.fillTokenFromHeader(headers, this::getClientVersion, HttpHeaders.VERSION); - } - - private RntbdRequestHeaders() { - super(RntbdRequestHeader.set, RntbdRequestHeader.map); - } - - // endregion - - // region Methods - - static RntbdRequestHeaders decode(final ByteBuf in) { - final RntbdRequestHeaders metadata = new RntbdRequestHeaders(); - return RntbdRequestHeaders.decode(in, metadata); - } - - // endregion - - // region Privates - - private RntbdToken getAIM() { - return this.get(RntbdRequestHeader.A_IM); - } - - private RntbdToken getAllowTentativeWrites() { - return this.get(RntbdRequestHeader.AllowTentativeWrites); - } - - private RntbdToken getAttachmentName() { - return this.get(RntbdRequestHeader.AttachmentName); - } - - private RntbdToken getAuthorizationToken() { - return this.get(RntbdRequestHeader.AuthorizationToken); - } - - private RntbdToken getBinaryId() { - return this.get(RntbdRequestHeader.BinaryId); - } - - private RntbdToken getBinaryPassThroughRequest() { - return this.get(RntbdRequestHeader.BinaryPassthroughRequest); - } - - private RntbdToken getBindReplicaDirective() { - return this.get(RntbdRequestHeader.BindReplicaDirective); - } - - private RntbdToken getCanCharge() { - return this.get(RntbdRequestHeader.CanCharge); - } - - private RntbdToken getCanOfferReplaceComplete() { - return this.get(RntbdRequestHeader.CanOfferReplaceComplete); - } - - private RntbdToken getCanThrottle() { - return this.get(RntbdRequestHeader.CanThrottle); - } - - private RntbdToken getClientRetryAttemptCount() { - return this.get(RntbdRequestHeader.ClientRetryAttemptCount); - } - - private RntbdToken getClientVersion() { - return this.get(RntbdRequestHeader.ClientVersion); - } - - private RntbdToken getCollectionName() { - return this.get(RntbdRequestHeader.CollectionName); - } - - private RntbdToken getCollectionPartitionIndex() { - return this.get(RntbdRequestHeader.CollectionPartitionIndex); - } - - private RntbdToken getCollectionRemoteStorageSecurityIdentifier() { - return this.get(RntbdRequestHeader.CollectionRemoteStorageSecurityIdentifier); - } - - private RntbdToken getCollectionRid() { - return this.get(RntbdRequestHeader.CollectionRid); - } - - private RntbdToken getCollectionServiceIndex() { - return this.get(RntbdRequestHeader.CollectionServiceIndex); - } - - private RntbdToken getConflictName() { - return this.get(RntbdRequestHeader.ConflictName); - } - - private RntbdToken getConsistencyLevel() { - return this.get(RntbdRequestHeader.ConsistencyLevel); - } - - private RntbdToken getContentSerializationFormat() { - return this.get(RntbdRequestHeader.ContentSerializationFormat); - } - - private RntbdToken getContinuationToken() { - return this.get(RntbdRequestHeader.ContinuationToken); - } - - private RntbdToken getDatabaseName() { - return this.get(RntbdRequestHeader.DatabaseName); - } - - private RntbdToken getDate() { - return this.get(RntbdRequestHeader.Date); - } - - private RntbdToken getDisableRUPerMinuteUsage() { - return this.get(RntbdRequestHeader.DisableRUPerMinuteUsage); - } - - private RntbdToken getDocumentName() { - return this.get(RntbdRequestHeader.DocumentName); - } - - private RntbdToken getEffectivePartitionKey() { - return this.get(RntbdRequestHeader.EffectivePartitionKey); - } - - private RntbdToken getEmitVerboseTracesInQuery() { - return this.get(RntbdRequestHeader.EmitVerboseTracesInQuery); - } - - private RntbdToken getEnableDynamicRidRangeAllocation() { - return this.get(RntbdRequestHeader.EnableDynamicRidRangeAllocation); - } - - private RntbdToken getEnableLogging() { - return this.get(RntbdRequestHeader.EnableLogging); - } - - private RntbdToken getEnableLowPrecisionOrderBy() { - return this.get(RntbdRequestHeader.EnableLowPrecisionOrderBy); - } - - private RntbdToken getEnableScanInQuery() { - return this.get(RntbdRequestHeader.EnableScanInQuery); - } - - private RntbdToken getEndEpk() { - return this.get(RntbdRequestHeader.EndEpk); - } - - private RntbdToken getEndId() { - return this.get(RntbdRequestHeader.EndId); - } - - private RntbdToken getEntityId() { - return this.get(RntbdRequestHeader.EntityId); - } - - private RntbdToken getEnumerationDirection() { - return this.get(RntbdRequestHeader.EnumerationDirection); - } - - private RntbdToken getExcludeSystemProperties() { - return this.get(RntbdRequestHeader.ExcludeSystemProperties); - } - - private RntbdToken getFanoutOperationState() { - return this.get(RntbdRequestHeader.FanoutOperationState); - } - - private RntbdToken getFilterBySchemaRid() { - return this.get(RntbdRequestHeader.FilterBySchemaRid); - } - - private RntbdToken getForceQueryScan() { - return this.get(RntbdRequestHeader.ForceQueryScan); - } - - private RntbdToken getGatewaySignature() { - return this.get(RntbdRequestHeader.GatewaySignature); - } - - private RntbdToken getIfModifiedSince() { - return this.get(RntbdRequestHeader.IfModifiedSince); - } - - private RntbdToken getIndexingDirective() { - return this.get(RntbdRequestHeader.IndexingDirective); - } - - private RntbdToken getIsAutoScaleRequest() { - return this.get(RntbdRequestHeader.IsAutoScaleRequest); - } - - private RntbdToken getIsFanout() { - return this.get(RntbdRequestHeader.IsFanout); - } - - private RntbdToken getIsReadOnlyScript() { - return this.get(RntbdRequestHeader.IsReadOnlyScript); - } - - private RntbdToken getIsUserRequest() { - return this.get(RntbdRequestHeader.IsUserRequest); - } - - private RntbdToken getMatch() { - return this.get(RntbdRequestHeader.Match); - } - - private RntbdToken getMigrateCollectionDirective() { - return this.get(RntbdRequestHeader.MigrateCollectionDirective); - } - - private RntbdToken getPageSize() { - return this.get(RntbdRequestHeader.PageSize); - } - - private RntbdToken getPartitionCount() { - return this.get(RntbdRequestHeader.PartitionCount); - } - - private RntbdToken getPartitionKey() { - return this.get(RntbdRequestHeader.PartitionKey); - } - - private RntbdToken getPartitionKeyRangeId() { - return this.get(RntbdRequestHeader.PartitionKeyRangeId); - } - - private RntbdToken getPartitionKeyRangeName() { - return this.get(RntbdRequestHeader.PartitionKeyRangeName); - } - - private RntbdToken getPartitionResourceFilter() { - return this.get(RntbdRequestHeader.PartitionResourceFilter); - } - - private RntbdToken getPayloadPresent() { - return this.get(RntbdRequestHeader.PayloadPresent); - } - - private RntbdToken getPermissionName() { - return this.get(RntbdRequestHeader.PermissionName); - } - - private RntbdToken getPopulateCollectionThroughputInfo() { - return this.get(RntbdRequestHeader.PopulateCollectionThroughputInfo); - } - - private RntbdToken getPopulatePartitionStatistics() { - return this.get(RntbdRequestHeader.PopulatePartitionStatistics); - } - - private RntbdToken getPopulateQueryMetrics() { - return this.get(RntbdRequestHeader.PopulateQueryMetrics); - } - - private RntbdToken getPopulateQuotaInfo() { - return this.get(RntbdRequestHeader.PopulateQuotaInfo); - } - - private RntbdToken getPostTriggerExclude() { - return this.get(RntbdRequestHeader.PostTriggerExclude); - } - - private RntbdToken getPostTriggerInclude() { - return this.get(RntbdRequestHeader.PostTriggerInclude); - } - - private RntbdToken getPreTriggerExclude() { - return this.get(RntbdRequestHeader.PreTriggerExclude); - } - - private RntbdToken getPreTriggerInclude() { - return this.get(RntbdRequestHeader.PreTriggerInclude); - } - - private RntbdToken getPrimaryMasterKey() { - return this.get(RntbdRequestHeader.PrimaryMasterKey); - } - - private RntbdToken getPrimaryReadonlyKey() { - return this.get(RntbdRequestHeader.PrimaryReadonlyKey); - } - - private RntbdToken getProfileRequest() { - return this.get(RntbdRequestHeader.ProfileRequest); - } - - private RntbdToken getReadFeedKeyType() { - return this.get(RntbdRequestHeader.ReadFeedKeyType); - } - - private RntbdToken getRemainingTimeInMsOnClientRequest() { - return this.get(RntbdRequestHeader.RemainingTimeInMsOnClientRequest); - } - - private RntbdToken getRemoteStorageType() { - return this.get(RntbdRequestHeader.RemoteStorageType); - } - - private RntbdToken getReplicaPath() { - return this.get(RntbdRequestHeader.ReplicaPath); - } - - private RntbdToken getResourceId() { - return this.get(RntbdRequestHeader.ResourceId); - } - - private RntbdToken getResourceSchemaName() { - return this.get(RntbdRequestHeader.ResourceSchemaName); - } - - private RntbdToken getResourceTokenExpiry() { - return this.get(RntbdRequestHeader.ResourceTokenExpiry); - } - - private RntbdToken getResponseContinuationTokenLimitInKb() { - return this.get(RntbdRequestHeader.ResponseContinuationTokenLimitInKb); - } - - private RntbdToken getRestoreMetadataFilter() { - return this.get(RntbdRequestHeader.RestoreMetadaFilter); - } - - private RntbdToken getRestoreParams() { - return this.get(RntbdRequestHeader.RestoreParams); - } - - private RntbdToken getSchemaName() { - return this.get(RntbdRequestHeader.SchemaName); - } - - private RntbdToken getSecondaryMasterKey() { - return this.get(RntbdRequestHeader.SecondaryMasterKey); - } - - private RntbdToken getSecondaryReadonlyKey() { - return this.get(RntbdRequestHeader.SecondaryReadonlyKey); - } - - private RntbdToken getSessionToken() { - return this.get(RntbdRequestHeader.SessionToken); - } - - private RntbdToken getShareThroughput() { - return this.get(RntbdRequestHeader.ShareThroughput); - } - - private RntbdToken getSharedOfferThroughput() { - return this.get(RntbdRequestHeader.SharedOfferThroughput); - } - - private RntbdToken getStartEpk() { - return this.get(RntbdRequestHeader.StartEpk); - } - - private RntbdToken getStartId() { - return this.get(RntbdRequestHeader.StartId); - } - - private RntbdToken getStoredProcedureName() { - return this.get(RntbdRequestHeader.StoredProcedureName); - } - - private RntbdToken getSupportSpatialLegacyCoordinates() { - return this.get(RntbdRequestHeader.SupportSpatialLegacyCoordinates); - } - - private RntbdToken getTargetGlobalCommittedLsn() { - return this.get(RntbdRequestHeader.TargetGlobalCommittedLsn); - } - - private RntbdToken getTargetLsn() { - return this.get(RntbdRequestHeader.TargetLsn); - } - - private RntbdToken getTimeToLiveInSeconds() { - return this.get(RntbdRequestHeader.TimeToLiveInSeconds); - } - - private RntbdToken getTransportRequestID() { - return this.get(RntbdRequestHeader.TransportRequestID); - } - - private RntbdToken getTriggerName() { - return this.get(RntbdRequestHeader.TriggerName); - } - - private RntbdToken getUsePolygonsSmallerThanAHemisphere() { - return this.get(RntbdRequestHeader.UsePolygonsSmallerThanAHemisphere); - } - - private RntbdToken getUserDefinedFunctionName() { - return this.get(RntbdRequestHeader.UserDefinedFunctionName); - } - - private RntbdToken getUserDefinedTypeName() { - return this.get(RntbdRequestHeader.UserDefinedTypeName); - } - - private RntbdToken getUserName() { - return this.get(RntbdRequestHeader.UserName); - } - - private void addAimHeader(final Map headers) { - - final String value = headers.get(HttpHeaders.A_IM); - - if (StringUtils.isNotEmpty(value)) { - this.getAIM().setValue(value); - } - } - - private void addAllowScanOnQuery(final Map headers) { - final String value = headers.get(HttpHeaders.ENABLE_SCAN_IN_QUERY); - if (StringUtils.isNotEmpty(value)) { - this.getEnableScanInQuery().setValue(Boolean.parseBoolean(value)); - } - } - - private void addBinaryIdIfPresent(final Map headers) { - final String value = headers.get(BackendHeaders.BINARY_ID); - if (StringUtils.isNotEmpty(value)) { - this.getBinaryId().setValue(Base64.getDecoder().decode(value)); - } - } - - private void addCanCharge(final Map headers) { - final String value = headers.get(HttpHeaders.CAN_CHARGE); - if (StringUtils.isNotEmpty(value)) { - this.getCanCharge().setValue(Boolean.parseBoolean(value)); - } - } - - private void addCanOfferReplaceComplete(final Map headers) { - final String value = headers.get(HttpHeaders.CAN_OFFER_REPLACE_COMPLETE); - if (StringUtils.isNotEmpty(value)) { - this.getCanOfferReplaceComplete().setValue(Boolean.parseBoolean(value)); - } - } - - private void addCanThrottle(final Map headers) { - final String value = headers.get(HttpHeaders.CAN_THROTTLE); - if (StringUtils.isNotEmpty(value)) { - this.getCanThrottle().setValue(Boolean.parseBoolean(value)); - } - } - - private void addCollectionRemoteStorageSecurityIdentifier(final Map headers) { - final String value = headers.get(HttpHeaders.COLLECTION_REMOTE_STORAGE_SECURITY_IDENTIFIER); - if (StringUtils.isNotEmpty(value)) { - this.getCollectionRemoteStorageSecurityIdentifier().setValue(value); - } - } - - private void addConsistencyLevelHeader(final Map headers) { - - final String value = headers.get(HttpHeaders.CONSISTENCY_LEVEL); - - if (StringUtils.isNotEmpty(value)) { - - final ConsistencyLevel level = EnumUtils.getEnumIgnoreCase(ConsistencyLevel.class, value); - - if (level == null) { - final String reason = String.format(Locale.ROOT, RMResources.InvalidRequestHeaderValue, - HttpHeaders.CONSISTENCY_LEVEL, - value); - throw new IllegalStateException(reason); - } - - switch (level) { - case Strong: - this.getConsistencyLevel().setValue(RntbdConsistencyLevel.Strong.id()); - break; - case BoundedStaleness: - this.getConsistencyLevel().setValue(RntbdConsistencyLevel.BoundedStaleness.id()); - break; - case Session: - this.getConsistencyLevel().setValue(RntbdConsistencyLevel.Session.id()); - break; - case Eventual: - this.getConsistencyLevel().setValue(RntbdConsistencyLevel.Eventual.id()); - break; - case ConsistentPrefix: - this.getConsistencyLevel().setValue(RntbdConsistencyLevel.ConsistentPrefix.id()); - break; - default: - assert false; - break; - } - } - } - - private void addContentSerializationFormat(final Map headers) { - - final String value = headers.get(HttpHeaders.CONTENT_SERIALIZATION_FORMAT); - - if (StringUtils.isNotEmpty(value)) { - - final ContentSerializationFormat format = EnumUtils.getEnumIgnoreCase(ContentSerializationFormat.class, value); - - if (format == null) { - final String reason = String.format(Locale.ROOT, RMResources.InvalidRequestHeaderValue, - HttpHeaders.CONTENT_SERIALIZATION_FORMAT, - value); - throw new IllegalStateException(reason); - } - - switch (format) { - case JsonText: - this.getContentSerializationFormat().setValue(RntbdContentSerializationFormat.JsonText.id()); - break; - case CosmosBinary: - this.getContentSerializationFormat().setValue(RntbdContentSerializationFormat.CosmosBinary.id()); - break; - default: - assert false; - } - } - } - - private void addContinuationToken(final RxDocumentServiceRequest request) { - final String value = request.getContinuation(); - if (StringUtils.isNotEmpty(value)) { - this.getContinuationToken().setValue(value); - } - } - - private void addDateHeader(final Map headers) { - - // Since the HTTP date header is overridden by some proxies/http client libraries, we support an additional date - // header and prefer that to the (regular) date header - - String value = headers.get(HttpHeaders.X_DATE); - - if (StringUtils.isEmpty(value)) { - value = headers.get(HttpHeaders.HTTP_DATE); - } - - if (StringUtils.isNotEmpty(value)) { - this.getDate().setValue(value); - } - } - - private void addDisableRUPerMinuteUsage(final Map headers) { - final String value = headers.get(HttpHeaders.DISABLE_RU_PER_MINUTE_USAGE); - if (StringUtils.isNotEmpty(value)) { - this.getDisableRUPerMinuteUsage().setValue(Boolean.parseBoolean(value)); - } - } - - private void addEmitVerboseTracesInQuery(final Map headers) { - final String value = headers.get(HttpHeaders.EMIT_VERBOSE_TRACES_IN_QUERY); - if (StringUtils.isNotEmpty(value)) { - this.getEmitVerboseTracesInQuery().setValue(Boolean.parseBoolean(value)); - } - } - - private void addEnableLogging(final Map headers) { - final String value = headers.get(HttpHeaders.ENABLE_LOGGING); - if (StringUtils.isNotEmpty(value)) { - this.getEnableLogging().setValue(Boolean.parseBoolean(value)); - } - } - - private void addEnableLowPrecisionOrderBy(final Map headers) { - final String value = headers.get(HttpHeaders.ENABLE_LOW_PRECISION_ORDER_BY); - if (StringUtils.isNotEmpty(value)) { - this.getEnableLowPrecisionOrderBy().setValue(Boolean.parseBoolean(value)); - } - } - - private void addEntityId(final Map headers) { - final String value = headers.get(BackendHeaders.ENTITY_ID); - if (StringUtils.isNotEmpty(value)) { - this.getEntityId().setValue(value); - } - } - - private void addEnumerationDirection(final Map headers) { - - final String value = headers.get(HttpHeaders.ENUMERATION_DIRECTION); - - if (StringUtils.isNotEmpty(value)) { - - final EnumerationDirection direction = EnumUtils.getEnumIgnoreCase(EnumerationDirection.class, value); - - if (direction == null) { - final String reason = String.format(Locale.ROOT, RMResources.InvalidRequestHeaderValue, - HttpHeaders.ENUMERATION_DIRECTION, - value); - throw new IllegalStateException(reason); - } - - switch (direction) { - case Forward: - this.getEnumerationDirection().setValue(RntbdEnumerationDirection.Forward.id()); - break; - case Reverse: - this.getEnumerationDirection().setValue(RntbdEnumerationDirection.Reverse.id()); - break; - default: - assert false; - } - } - } - - private void addExcludeSystemProperties(final Map headers) { - final String value = headers.get(BackendHeaders.EXCLUDE_SYSTEM_PROPERTIES); - if (StringUtils.isNotEmpty(value)) { - this.getExcludeSystemProperties().setValue(Boolean.parseBoolean(value)); - } - } - - private void addFanoutOperationStateHeader(final Map headers) { - - final String value = headers.get(BackendHeaders.FANOUT_OPERATION_STATE); - - if (StringUtils.isNotEmpty(value)) { - - final FanoutOperationState format = EnumUtils.getEnumIgnoreCase(FanoutOperationState.class, value); - - if (format == null) { - final String reason = String.format(Locale.ROOT, RMResources.InvalidRequestHeaderValue, - BackendHeaders.FANOUT_OPERATION_STATE, - value); - throw new IllegalStateException(reason); - } - - switch (format) { - case Started: - this.getFanoutOperationState().setValue(RntbdFanoutOperationState.Started.id()); - break; - case Completed: - this.getFanoutOperationState().setValue(RntbdFanoutOperationState.Completed.id()); - break; - default: - assert false; - } - } - } - - private void addIfModifiedSinceHeader(final Map headers) { - final String value = headers.get(HttpHeaders.IF_MODIFIED_SINCE); - if (StringUtils.isNotEmpty(value)) { - this.getIfModifiedSince().setValue(value); - } - } - - private void addIndexingDirectiveHeader(final Map headers) { - - final String value = headers.get(HttpHeaders.INDEXING_DIRECTIVE); - - if (StringUtils.isNotEmpty(value)) { - - final IndexingDirective directive = EnumUtils.getEnumIgnoreCase(IndexingDirective.class, value); - - if (directive == null) { - final String reason = String.format(Locale.ROOT, RMResources.InvalidRequestHeaderValue, - HttpHeaders.INDEXING_DIRECTIVE, - value); - throw new IllegalStateException(reason); - } - - switch (directive) { - case Default: - this.getIndexingDirective().setValue(RntbdIndexingDirective.Default.id()); - break; - case Exclude: - this.getIndexingDirective().setValue(RntbdIndexingDirective.Exclude.id()); - break; - case Include: - this.getIndexingDirective().setValue(RntbdIndexingDirective.Include.id()); - break; - default: - assert false; - } - } - } - - private void addIsAutoScaleRequest(final Map headers) { - final String value = headers.get(HttpHeaders.IS_AUTO_SCALE_REQUEST); - if (StringUtils.isNotEmpty(value)) { - this.getIsAutoScaleRequest().setValue(Boolean.parseBoolean(value)); - } - } - - private void addIsFanout(final Map headers) { - final String value = headers.get(BackendHeaders.IS_FANOUT_REQUEST); - if (StringUtils.isNotEmpty(value)) { - this.getIsFanout().setValue(Boolean.parseBoolean(value)); - } - } - - private void addIsReadOnlyScript(final Map headers) { - final String value = headers.get(HttpHeaders.IS_READ_ONLY_SCRIPT); - if (StringUtils.isNotEmpty(value)) { - this.getIsReadOnlyScript().setValue(Boolean.parseBoolean(value)); - } - } - - private void addIsUserRequest(final Map headers) { - final String value = headers.get(BackendHeaders.IS_USER_REQUEST); - if (StringUtils.isNotEmpty(value)) { - this.getIsUserRequest().setValue(Boolean.parseBoolean(value)); - } - } - - private void addMatchHeader(final Map headers, final RntbdOperationType operationType) { - - String match = null; - - switch (operationType) { - case Read: - case ReadFeed: - match = headers.get(HttpHeaders.IF_NONE_MATCH); - break; - default: - match = headers.get(HttpHeaders.IF_MATCH); - break; - } - - if (StringUtils.isNotEmpty(match)) { - this.getMatch().setValue(match); - } - } - - private void addMigrateCollectionDirectiveHeader(final Map headers) { - - final String value = headers.get(HttpHeaders.MIGRATE_COLLECTION_DIRECTIVE); - - if (StringUtils.isNotEmpty(value)) { - - final MigrateCollectionDirective directive = EnumUtils.getEnumIgnoreCase(MigrateCollectionDirective.class, value); - - if (directive == null) { - final String reason = String.format(Locale.ROOT, RMResources.InvalidRequestHeaderValue, - HttpHeaders.MIGRATE_COLLECTION_DIRECTIVE, - value); - throw new IllegalStateException(reason); - } - - switch (directive) { - case Freeze: - this.getMigrateCollectionDirective().setValue(RntbdMigrateCollectionDirective.Freeze.id()); - break; - case Thaw: - this.getMigrateCollectionDirective().setValue(RntbdMigrateCollectionDirective.Thaw.id()); - break; - default: - assert false; - break; - } - } - } - - private void addPageSize(final Map headers) { - - final String value = headers.get(HttpHeaders.PAGE_SIZE); - - if (StringUtils.isNotEmpty(value)) { - final long aLong = parseLong(HttpHeaders.PAGE_SIZE, value, -1, 0xFFFFFFFFL); - this.getPageSize().setValue((int)(aLong < 0 ? 0xFFFFFFFFL : aLong)); - } - } - - private void addPopulateCollectionThroughputInfo(final Map headers) { - final String value = headers.get(HttpHeaders.POPULATE_COLLECTION_THROUGHPUT_INFO); - if (StringUtils.isNotEmpty(value)) { - this.getPopulateCollectionThroughputInfo().setValue(Boolean.parseBoolean(value)); - } - } - - private void addPopulatePartitionStatistics(final Map headers) { - final String value = headers.get(HttpHeaders.POPULATE_PARTITION_STATISTICS); - if (StringUtils.isNotEmpty(value)) { - this.getPopulatePartitionStatistics().setValue(Boolean.parseBoolean(value)); - } - } - - private void addPopulateQueryMetrics(final Map headers) { - final String value = headers.get(HttpHeaders.POPULATE_QUERY_METRICS); - if (StringUtils.isNotEmpty(value)) { - this.getPopulateQueryMetrics().setValue(Boolean.parseBoolean(value)); - } - } - - private void addPopulateQuotaInfo(final Map headers) { - final String value = headers.get(HttpHeaders.POPULATE_QUOTA_INFO); - if (StringUtils.isNotEmpty(value)) { - this.getPopulateQuotaInfo().setValue(Boolean.parseBoolean(value)); - } - } - - private void addProfileRequest(final Map headers) { - final String value = headers.get(HttpHeaders.PROFILE_REQUEST); - if (StringUtils.isNotEmpty(value)) { - this.getProfileRequest().setValue(Boolean.parseBoolean(value)); - } - } - - private void addQueryForceScan(final Map headers) { - final String value = headers.get(HttpHeaders.FORCE_QUERY_SCAN); - if (StringUtils.isNotEmpty(value)) { - this.getForceQueryScan().setValue(Boolean.parseBoolean(value)); - } - } - - private void addRemoteStorageType(final Map headers) { - - final String value = headers.get(BackendHeaders.REMOTE_STORAGE_TYPE); - - if (StringUtils.isNotEmpty(value)) { - - final RemoteStorageType type = EnumUtils.getEnumIgnoreCase(RemoteStorageType.class, value); - - if (type == null) { - final String reason = String.format(Locale.ROOT, RMResources.InvalidRequestHeaderValue, - BackendHeaders.REMOTE_STORAGE_TYPE, - value); - throw new IllegalStateException(reason); - } - - switch (type) { - case Standard: - this.getRemoteStorageType().setValue(RntbdRemoteStorageType.Standard.id()); - break; - case Premium: - this.getRemoteStorageType().setValue(RntbdRemoteStorageType.Premium.id()); - break; - default: - assert false; - } - } - } - - private void addResourceIdOrPathHeaders(final RxDocumentServiceRequest request) { - - final String value = request.getResourceId(); - - if (StringUtils.isNotEmpty(value)) { - // Name-based can also have ResourceId because gateway might have generated it - this.getResourceId().setValue(ResourceId.parse(request.getResourceType(), value)); - } - - if (request.getIsNameBased()) { - - // Assumption: format is like "dbs/dbName/colls/collName/docs/docName" or "/dbs/dbName/colls/collName", - // not "apps/appName/partitions/partitionKey/replicas/replicaId/dbs/dbName" - - final String address = request.getResourceAddress(); - final String[] fragments = address.split(UrlTrim); - int count = fragments.length; - int index = 0; - - if (count > 0 && fragments[0].isEmpty()) { - ++index; - --count; - } - - if (count >= 2) { - switch (fragments[index]) { - case Paths.DATABASES_PATH_SEGMENT: - this.getDatabaseName().setValue(fragments[index + 1]); - break; - default: - final String reason = String.format(Locale.ROOT, RMResources.InvalidResourceAddress, - value, address); - throw new IllegalStateException(reason); - } - } - - if (count >= 4) { - switch (fragments[index + 2]) { - case Paths.COLLECTIONS_PATH_SEGMENT: - this.getCollectionName().setValue(fragments[index + 3]); - break; - case Paths.USERS_PATH_SEGMENT: - this.getUserName().setValue(fragments[index + 3]); - break; - case Paths.USER_DEFINED_TYPES_PATH_SEGMENT: - this.getUserDefinedTypeName().setValue(fragments[index + 3]); - break; - } - } - - if (count >= 6) { - switch (fragments[index + 4]) { - case Paths.DOCUMENTS_PATH_SEGMENT: - this.getDocumentName().setValue(fragments[index + 5]); - break; - case Paths.STORED_PROCEDURES_PATH_SEGMENT: - this.getStoredProcedureName().setValue(fragments[index + 5]); - break; - case Paths.PERMISSIONS_PATH_SEGMENT: - this.getPermissionName().setValue(fragments[index + 5]); - break; - case Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT: - this.getUserDefinedFunctionName().setValue(fragments[index + 5]); - break; - case Paths.TRIGGERS_PATH_SEGMENT: - this.getTriggerName().setValue(fragments[index + 5]); - break; - case Paths.CONFLICTS_PATH_SEGMENT: - this.getConflictName().setValue(fragments[index + 5]); - break; - case Paths.PARTITION_KEY_RANGES_PATH_SEGMENT: - this.getPartitionKeyRangeName().setValue(fragments[index + 5]); - break; - case Paths.SCHEMAS_PATH_SEGMENT: - this.getSchemaName().setValue(fragments[index + 5]); - break; - } - } - - if (count >= 8) { - switch (fragments[index + 6]) { - case Paths.ATTACHMENTS_PATH_SEGMENT: - this.getAttachmentName().setValue(fragments[index + 7]); - break; - } - } - } - } - - private void addResponseContinuationTokenLimitInKb(final Map headers) { - - final String value = headers.get(HttpHeaders.RESPONSE_CONTINUATION_TOKEN_LIMIT_IN_KB); - - if (StringUtils.isNotEmpty(value)) { - final long aLong = parseLong(HttpHeaders.RESPONSE_CONTINUATION_TOKEN_LIMIT_IN_KB, value, 0, 0xFFFFFFFFL); - this.getResponseContinuationTokenLimitInKb().setValue((int)(aLong < 0 ? 0xFFFFFFFFL : aLong)); - } - } - - private void addShareThroughput(final Map headers) { - final String value = headers.get(BackendHeaders.SHARE_THROUGHPUT); - if (StringUtils.isNotEmpty(value)) { - this.getShareThroughput().setValue(Boolean.parseBoolean(value)); - } - } - - private void addStartAndEndKeys(final Map headers) { - - String value = headers.get(HttpHeaders.READ_FEED_KEY_TYPE); - - if (StringUtils.isNotEmpty(value)) { - - final ReadFeedKeyType type = EnumUtils.getEnumIgnoreCase(ReadFeedKeyType.class, value); - - if (type == null) { - final String reason = String.format(Locale.ROOT, RMResources.InvalidRequestHeaderValue, - HttpHeaders.READ_FEED_KEY_TYPE, - value); - throw new IllegalStateException(reason); - } - - switch (type) { - case ResourceId: - this.getReadFeedKeyType().setValue(RntbdReadFeedKeyType.ResourceId.id()); - break; - case EffectivePartitionKey: - this.getReadFeedKeyType().setValue(RntbdReadFeedKeyType.EffectivePartitionKey.id()); - break; - default: - assert false; - } - } - - final Base64.Decoder decoder = Base64.getDecoder(); - - value = headers.get(HttpHeaders.START_ID); - - if (StringUtils.isNotEmpty(value)) { - this.getStartId().setValue(decoder.decode(value)); - } - - value = headers.get(HttpHeaders.END_ID); - - if (StringUtils.isNotEmpty(value)) { - this.getEndId().setValue(decoder.decode(value)); - } - - value = headers.get(HttpHeaders.START_EPK); - - if (StringUtils.isNotEmpty(value)) { - this.getStartEpk().setValue(decoder.decode(value)); - } - - value = headers.get(HttpHeaders.END_EPK); - - if (StringUtils.isNotEmpty(value)) { - this.getEndEpk().setValue(decoder.decode(value)); - } - } - - private void addSupportSpatialLegacyCoordinates(final Map headers) { - final String value = headers.get(HttpHeaders.SUPPORT_SPATIAL_LEGACY_COORDINATES); - if (StringUtils.isNotEmpty(value)) { - this.getSupportSpatialLegacyCoordinates().setValue(Boolean.parseBoolean(value)); - } - } - - private void addUsePolygonsSmallerThanAHemisphere(final Map headers) { - final String value = headers.get(HttpHeaders.USE_POLYGONS_SMALLER_THAN_AHEMISPHERE); - if (StringUtils.isNotEmpty(value)) { - this.getUsePolygonsSmallerThanAHemisphere().setValue(Boolean.parseBoolean(value)); - } - } - - private void fillTokenFromHeader(final Map headers, final Supplier supplier, final String name) { - - final String value = headers.get(name); - - if (StringUtils.isNotEmpty(value)) { - - final RntbdToken token = supplier.get(); - - switch (token.getType()) { - - case SmallString: - case String: - case ULongString: { - - token.setValue(value); - break; - } - case Byte: { - - token.setValue(Boolean.parseBoolean(value)); - break; - } - case Double: { - - token.setValue(parseDouble(name, value)); - break; - } - case Long: { - - final long aLong = parseLong(name, value, Integer.MIN_VALUE, Integer.MAX_VALUE); - token.setValue(aLong); - break; - } - case ULong: { - - final long aLong = parseLong(name, value, 0, 0xFFFFFFFFL); - token.setValue(aLong); - break; - } - case LongLong: { - - final long aLong = parseLong(name, value); - token.setValue(aLong); - break; - } - default: { - assert false : "Recognized header has neither special-case nor default handling to convert " - + "from header String to RNTBD token"; - break; - } - } - } - } - - private static double parseDouble(final String name, final String value) { - - final double aDouble; - - try { - aDouble = Double.parseDouble(value); - } catch (final NumberFormatException error) { - final String reason = String.format(Locale.ROOT, RMResources.InvalidRequestHeaderValue, name, value); - throw new IllegalStateException(reason); - } - return aDouble; - } - - private static long parseLong(final String name, final String value) { - final long aLong; - try { - aLong = Long.parseLong(value); - } catch (final NumberFormatException error) { - final String reason = String.format(Locale.ROOT, RMResources.InvalidRequestHeaderValue, name, value); - throw new IllegalStateException(reason); - } - return aLong; - } - - private static long parseLong(final String name, final String value, final long min, final long max) { - final long aLong = parseLong(name, value); - if (!(min <= aLong && aLong <= max)) { - final String reason = String.format(Locale.ROOT, RMResources.InvalidRequestHeaderValue, name, aLong); - throw new IllegalStateException(reason); - } - return aLong; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestManager.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestManager.java deleted file mode 100644 index 10c81f854a05..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestManager.java +++ /dev/null @@ -1,774 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.google.common.base.Strings; -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.InternalServerErrorException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.ConflictException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.ForbiddenException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.GoneException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.LockedException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.MethodNotAllowedException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.PartitionKeyRangeGoneException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.PreconditionFailedException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.RequestEntityTooLargeException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.RequestRateTooLargeException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.RequestTimeoutException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.RetryWithException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.ServiceUnavailableException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResponse; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.UnauthorizedException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdResponseHeader; -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import com.microsoft.azure.cosmosdb.rx.internal.InvalidPartitionException; -import com.microsoft.azure.cosmosdb.rx.internal.NotFoundException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionIsMigratingException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionKeyRangeIsSplittingException; -import io.netty.buffer.ByteBuf; -import io.netty.channel.Channel; -import io.netty.channel.ChannelException; -import io.netty.channel.ChannelHandler; -import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.ChannelInboundHandler; -import io.netty.channel.ChannelOption; -import io.netty.channel.ChannelOutboundHandler; -import io.netty.channel.ChannelPipeline; -import io.netty.channel.ChannelPromise; -import io.netty.channel.CoalescingBufferQueue; -import io.netty.channel.EventLoop; -import io.netty.handler.codec.http.HttpResponseStatus; -import io.netty.util.ReferenceCountUtil; -import io.netty.util.Timeout; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.math.BigDecimal; -import java.net.SocketAddress; -import java.util.Map; -import java.util.Optional; -import java.util.UUID; -import java.util.concurrent.CancellationException; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionException; -import java.util.concurrent.ConcurrentHashMap; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.StatusCodes; -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.SubStatusCodes; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdReporter.reportIssue; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdReporter.reportIssueUnless; - -public final class RntbdRequestManager implements ChannelHandler, ChannelInboundHandler, ChannelOutboundHandler { - - // region Fields - - private static final Logger logger = LoggerFactory.getLogger(RntbdRequestManager.class); - - private final CompletableFuture contextFuture = new CompletableFuture<>(); - private final CompletableFuture contextRequestFuture = new CompletableFuture<>(); - private final ConcurrentHashMap pendingRequests = new ConcurrentHashMap<>(); - - private boolean closingExceptionally = false; - private ChannelHandlerContext context; - private RntbdRequestRecord pendingRequest; - private CoalescingBufferQueue pendingWrites; - - // endregion - - // region ChannelHandler methods - - /** - * Gets called after the {@link ChannelHandler} was added to the actual context and it's ready to handle events. - * - * @param context {@link ChannelHandlerContext} to which this {@link RntbdRequestManager} belongs - */ - @Override - public void handlerAdded(final ChannelHandlerContext context) throws Exception { - this.traceOperation(context, "handlerAdded"); - } - - /** - * Gets called after the {@link ChannelHandler} was removed from the actual context and it doesn't handle events - * anymore. - * - * @param context {@link ChannelHandlerContext} to which this {@link RntbdRequestManager} belongs - */ - @Override - public void handlerRemoved(final ChannelHandlerContext context) throws Exception { - this.traceOperation(context, "handlerRemoved"); - } - - // endregion - - // region ChannelInboundHandler methods - - /** - * The {@link Channel} of the {@link ChannelHandlerContext} is now active - * - * @param context {@link ChannelHandlerContext} to which this {@link RntbdRequestManager} belongs - */ - @Override - public void channelActive(final ChannelHandlerContext context) throws Exception { - this.traceOperation(this.context, "channelActive"); - context.fireChannelActive(); - } - - /** - * Completes all pending requests exceptionally when a channel reaches the end of its lifetime - *

- * This method will only be called after the channel is closed. - * - * @param context {@link ChannelHandlerContext} to which this {@link RntbdRequestManager} belongs - */ - @Override - public void channelInactive(final ChannelHandlerContext context) throws Exception { - this.traceOperation(this.context, "channelInactive"); - this.completeAllPendingRequestsExceptionally(context, ClosedWithPendingRequestsException.INSTANCE); - context.fireChannelInactive(); - } - - @Override - public void channelRead(final ChannelHandlerContext context, final Object message) throws Exception { - - this.traceOperation(context, "channelRead"); - - if (message instanceof RntbdResponse) { - try { - this.messageReceived(context, (RntbdResponse)message); - } finally { - ReferenceCountUtil.release(message); - } - this.traceOperation(context, "channelReadComplete"); - return; - } - - final String reason = Strings.lenientFormat("expected message of type %s, not %s", RntbdResponse.class, message.getClass()); - throw new IllegalStateException(reason); - } - - /** - * Invoked when the last message read by the current read operation has been consumed - *

- * If {@link ChannelOption#AUTO_READ} is off, no further attempt to read an inbound data from the current - * {@link Channel} will be made until {@link ChannelHandlerContext#read} is called. This leaves time - * for outbound messages to be written. - * - * @param context {@link ChannelHandlerContext} to which this {@link RntbdRequestManager} belongs - */ - @Override - public void channelReadComplete(final ChannelHandlerContext context) throws Exception { - this.traceOperation(context, "channelReadComplete"); - context.fireChannelReadComplete(); - } - - /** - * Constructs a {@link CoalescingBufferQueue} for buffering encoded requests until we have an {@link RntbdRequest} - *

- * This method then calls {@link ChannelHandlerContext#fireChannelRegistered()} to forward to the next - * {@link ChannelInboundHandler} in the {@link ChannelPipeline}. - *

- * Sub-classes may override this method to change behavior. - * - * @param context the {@link ChannelHandlerContext} for which the bind operation is made - */ - @Override - public void channelRegistered(final ChannelHandlerContext context) throws Exception { - - this.traceOperation(context, "channelRegistered"); - - if (!(this.context == null && this.pendingWrites == null)) { - throw new IllegalStateException(); - } - - this.pendingWrites = new CoalescingBufferQueue(context.channel()); - this.context = context; - context.fireChannelRegistered(); - } - - /** - * The {@link Channel} of the {@link ChannelHandlerContext} was unregistered from its {@link EventLoop} - * - * @param context {@link ChannelHandlerContext} to which this {@link RntbdRequestManager} belongs - */ - @Override - public void channelUnregistered(final ChannelHandlerContext context) throws Exception { - - this.traceOperation(context, "channelUnregistered"); - - if (this.context == null || this.pendingWrites == null || !this.pendingWrites.isEmpty()) { - throw new IllegalStateException(); - } - - this.pendingWrites = null; - this.context = null; - context.fireChannelUnregistered(); - } - - /** - * Gets called once the writable state of a {@link Channel} changed. You can check the state with - * {@link Channel#isWritable()}. - * - * @param context {@link ChannelHandlerContext} to which this {@link RntbdRequestManager} belongs - */ - @Override - public void channelWritabilityChanged(final ChannelHandlerContext context) throws Exception { - this.traceOperation(context, "channelWritabilityChanged"); - context.fireChannelWritabilityChanged(); - } - - /** - * Processes {@link ChannelHandlerContext#fireExceptionCaught(Throwable)} in the {@link ChannelPipeline} - * - * @param context {@link ChannelHandlerContext} to which this {@link RntbdRequestManager} belongs - * @param cause Exception caught - */ - @Override - @SuppressWarnings("deprecation") - public void exceptionCaught(final ChannelHandlerContext context, final Throwable cause) throws Exception { - - // TODO: DANOBLE: replace RntbdRequestManager.exceptionCaught with read/write listeners - // Notes: - // ChannelInboundHandler.exceptionCaught is deprecated and--today, prior to deprecation--only catches read-- - // i.e., inbound--exceptions. - // Replacements: - // * read listener: unclear as there is no obvious replacement - // * write listener: implemented by RntbdTransportClient.DefaultEndpoint.doWrite - // Links: - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/373213 - - this.traceOperation(context, "exceptionCaught", cause); - - if (!this.closingExceptionally) { - reportIssueUnless(cause != ClosedWithPendingRequestsException.INSTANCE, logger, context, - "expected an exception other than ", ClosedWithPendingRequestsException.INSTANCE); - this.completeAllPendingRequestsExceptionally(context, cause); - context.close(); - } - } - - /** - * Processes inbound events triggered by channel handlers in the {@link RntbdClientChannelHandler} pipeline - *

- * All but inbound request management events are ignored. - * - * @param context {@link ChannelHandlerContext} to which this {@link RntbdRequestManager} belongs - * @param event An object representing a user event - */ - @Override - public void userEventTriggered(final ChannelHandlerContext context, final Object event) { - - this.traceOperation(context, "userEventTriggered", event); - - if (event instanceof RntbdContext) { - this.completeRntbdContextFuture(context, (RntbdContext)event); - return; - } - - context.fireUserEventTriggered(event); - } - - // endregion - - // region ChannelOutboundHandler methods - - /** - * Called once a bind operation is made. - * - * @param context the {@link ChannelHandlerContext} for which the bind operation is made - * @param localAddress the {@link SocketAddress} to which it should bound - * @param promise the {@link ChannelPromise} to notify once the operation completes - * @throws Exception thrown if an error occurs - */ - @Override - public void bind(final ChannelHandlerContext context, final SocketAddress localAddress, final ChannelPromise promise) throws Exception { - this.traceOperation(context, "bind"); - context.bind(localAddress, promise); - } - - /** - * Called once a close operation is made. - * - * @param context the {@link ChannelHandlerContext} for which the close operation is made - * @param promise the {@link ChannelPromise} to notify once the operation completes - * @throws Exception thrown if an error occurs - */ - @Override - public void close(final ChannelHandlerContext context, final ChannelPromise promise) throws Exception { - this.traceOperation(context, "close"); - context.close(promise); - } - - /** - * Called once a connect operation is made. - * - * @param context the {@link ChannelHandlerContext} for which the connect operation is made - * @param remoteAddress the {@link SocketAddress} to which it should connect - * @param localAddress the {@link SocketAddress} which is used as source on connect - * @param promise the {@link ChannelPromise} to notify once the operation completes - * @throws Exception thrown if an error occurs - */ - @Override - public void connect(final ChannelHandlerContext context, final SocketAddress remoteAddress, final SocketAddress localAddress, final ChannelPromise promise) throws Exception { - this.traceOperation(context, "connect"); - context.connect(remoteAddress, localAddress, promise); - } - - /** - * Called once a deregister operation is made from the current registered {@link EventLoop}. - * - * @param context the {@link ChannelHandlerContext} for which the close operation is made - * @param promise the {@link ChannelPromise} to notify once the operation completes - * @throws Exception thrown if an error occurs - */ - @Override - public void deregister(final ChannelHandlerContext context, final ChannelPromise promise) throws Exception { - this.traceOperation(context, "deregister"); - context.deregister(promise); - } - - /** - * Called once a disconnect operation is made. - * - * @param context the {@link ChannelHandlerContext} for which the disconnect operation is made - * @param promise the {@link ChannelPromise} to notify once the operation completes - * @throws Exception thrown if an error occurs - */ - @Override - public void disconnect(final ChannelHandlerContext context, final ChannelPromise promise) throws Exception { - this.traceOperation(context, "disconnect"); - context.disconnect(promise); - } - - /** - * Called once a flush operation is made - *

- * The flush operation will try to flush out all previous written messages that are pending. - * - * @param context the {@link ChannelHandlerContext} for which the flush operation is made - * @throws Exception thrown if an error occurs - */ - @Override - public void flush(final ChannelHandlerContext context) throws Exception { - this.traceOperation(context, "flush"); - context.flush(); - } - - /** - * Intercepts {@link ChannelHandlerContext#read} - * - * @param context the {@link ChannelHandlerContext} for which the read operation is made - */ - @Override - public void read(final ChannelHandlerContext context) throws Exception { - this.traceOperation(context, "read"); - context.read(); - } - - /** - * Called once a write operation is made - *

- * The write operation will send messages through the {@link ChannelPipeline} which are then ready to be flushed - * to the actual {@link Channel}. This will occur when {@link Channel#flush} is called. - * - * @param context the {@link ChannelHandlerContext} for which the write operation is made - * @param message the message to write - * @param promise the {@link ChannelPromise} to notify once the operation completes - * @throws Exception thrown if an error occurs - */ - @Override - public void write(final ChannelHandlerContext context, final Object message, final ChannelPromise promise) throws Exception { - - // TODO: DANOBLE: Ensure that all write errors are reported with a root cause of type EncoderException - - this.traceOperation(context, "write", message); - - if (message instanceof RntbdRequestRecord) { - context.write(this.addPendingRequestRecord((RntbdRequestRecord)message), promise); - } else { - final String reason = Strings.lenientFormat("Expected message of type %s, not %s", RntbdRequestArgs.class, message.getClass()); - this.exceptionCaught(context, new IllegalStateException(reason)); - } - } - - // endregion - - // region Private and package private methods - - int getPendingRequestCount() { - return this.pendingRequests.size(); - } - - CompletableFuture getRntbdContextRequestFuture() { - return this.contextRequestFuture; - } - - boolean hasRntbdContext() { - return this.contextFuture.getNow(null) != null; - } - - void pendWrite(final ByteBuf out, final ChannelPromise promise) { - - checkNotNull(out, "out"); - checkNotNull(promise, "promise"); - checkState(this.pendingWrites != null, "pendingWrite: null"); - - this.pendingWrites.add(out, promise); - } - - private RntbdRequestArgs addPendingRequestRecord(final RntbdRequestRecord requestRecord) { - - // TODO: DANOBLE: Consider revising the implementation of RntbdRequestManager.addPendingRequestRecord - // At a minimum consider these issues: - // * Do we have a requirement to support multiple concurrent operations for a single activityId? - // * Should we replace, renew, or maintain a list of pending requests for each activityId? - // We currently fail when we find an existing request record. - // Links: - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/378801 - - this.pendingRequest = this.pendingRequests.compute(requestRecord.getActivityId(), (activityId, current) -> { - - checkArgument(current == null, "current: expected no request record, not %s", current); - - final Timeout pendingRequestTimeout = requestRecord.newTimeout(timeout -> { - this.pendingRequests.remove(activityId); - requestRecord.expire(); - }); - - requestRecord.whenComplete((response, error) -> { - this.pendingRequests.remove(activityId); - pendingRequestTimeout.cancel(); - }); - - return requestRecord; - }); - - return this.pendingRequest.getArgs(); - } - - private Optional getRntbdContext() { - return Optional.of(this.contextFuture.getNow(null)); - } - - private void completeAllPendingRequestsExceptionally(final ChannelHandlerContext context, final Throwable throwable) { - - checkNotNull(throwable, "throwable: null"); - - if (this.closingExceptionally) { - checkArgument(throwable == ClosedWithPendingRequestsException.INSTANCE, "throwable: %s", throwable); - return; - } - - this.closingExceptionally = true; - - if (!this.pendingWrites.isEmpty()) { - this.pendingWrites.releaseAndFailAll(context, ClosedWithPendingRequestsException.INSTANCE); - } - - if (!this.pendingRequests.isEmpty()) { - - final Channel channel = context.channel(); - - if (!this.contextRequestFuture.isDone()) { - this.contextRequestFuture.completeExceptionally(throwable); - } - - if (!this.contextFuture.isDone()) { - this.contextFuture.completeExceptionally(throwable); - } - - Exception contextRequestException = null; - - if (this.contextRequestFuture.isCompletedExceptionally()) { - try { - this.contextRequestFuture.get(); - } catch (final CancellationException error) { - logger.debug("\n {} closed: context send cancelled", channel); - contextRequestException = error; - } catch (final Throwable error) { - final String message = Strings.lenientFormat("context send failed due to %s", error); - logger.debug("\n {} closed: {}", channel, message); - contextRequestException = new ChannelException(message, error); - } - } else if (this.contextFuture.isCompletedExceptionally()) { - try { - this.contextFuture.get(); - } catch (final CancellationException error) { - logger.debug("\n {} closed: context receive cancelled", channel); - contextRequestException = error; - } catch (final Throwable error) { - final String message = Strings.lenientFormat("context receive failed due to %s", error); - logger.debug("\n {} closed: {}", channel, message); - contextRequestException = new ChannelException(message, error); - } - } - - final String origin = "rntbd:/" + channel.remoteAddress(); - final int count = this.pendingRequests.size(); - final String message; - - if (contextRequestException == null) { - message = Strings.lenientFormat("%s channel closed with %s pending requests", channel, count); - } else { - message = Strings.lenientFormat("%s context request failed with %s pending requests", channel, count); - } - - final Exception reason; - - if (throwable == ClosedWithPendingRequestsException.INSTANCE && contextRequestException != null) { - reason = contextRequestException; - } else { - reason = throwable instanceof Exception ? (Exception)throwable : new ChannelException(throwable); - } - - for (final RntbdRequestRecord requestRecord : this.pendingRequests.values()) { - - final RntbdRequestArgs args = requestRecord.getArgs(); - final String requestUri = origin + args.getReplicaPath(); - final Map headers = args.getServiceRequest().getHeaders(); - - final GoneException cause = new GoneException(message, reason, headers, requestUri); - BridgeInternal.setRequestHeaders(cause, headers); - requestRecord.completeExceptionally(cause); - } - } - } - - private void completeRntbdContextFuture(final ChannelHandlerContext context, final RntbdContext value) { - - checkNotNull(context, "context"); - checkNotNull(value, "value"); - - if (this.contextFuture.isDone()) { - throw new IllegalStateException(Strings.lenientFormat("rntbdContextFuture: %s", this.contextFuture)); - } - - this.contextFuture.complete(value); - - final RntbdContextNegotiator negotiator = context.channel().pipeline().get(RntbdContextNegotiator.class); - negotiator.removeInboundHandler(); - negotiator.removeOutboundHandler(); - - if (!this.pendingWrites.isEmpty()) { - this.pendingWrites.writeAndRemoveAll(context); - } - } - - /** - * This method is called for each incoming message of type {@link StoreResponse} to complete a request - * - * @param context {@link ChannelHandlerContext} encode to which this {@link RntbdRequestManager} belongs - * @param response the message encode handle - */ - private void messageReceived(final ChannelHandlerContext context, final RntbdResponse response) { - - final UUID activityId = response.getActivityId(); - final RntbdRequestRecord pendingRequest = this.pendingRequests.get(activityId); - - if (pendingRequest == null) { - logger.warn("[activityId: {}] no request pending", activityId); - return; - } - - final HttpResponseStatus status = response.getStatus(); - - if (HttpResponseStatus.OK.code() <= status.code() && status.code() < HttpResponseStatus.MULTIPLE_CHOICES.code()) { - - final StoreResponse storeResponse = response.toStoreResponse(this.contextFuture.getNow(null)); - pendingRequest.complete(storeResponse); - - } else { - - // Map response to a DocumentClientException - - final DocumentClientException cause; - - // ..Fetch required header values - - final long lsn = response.getHeader(RntbdResponseHeader.LSN); - final String partitionKeyRangeId = response.getHeader(RntbdResponseHeader.PartitionKeyRangeId); - - // ..Create Error instance - - final Error error = response.hasPayload() ? - BridgeInternal.createError(RntbdObjectMapper.readTree(response)) : - new Error(Integer.toString(status.code()), status.reasonPhrase(), status.codeClass().name()); - - // ..Map RNTBD response headers to HTTP response headers - - final Map responseHeaders = response.getHeaders().asMap( - this.getRntbdContext().orElseThrow(IllegalStateException::new), activityId - ); - - // ..Create DocumentClientException based on status and sub-status codes - - switch (status.code()) { - - case StatusCodes.BADREQUEST: - cause = new BadRequestException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.CONFLICT: - cause = new ConflictException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.FORBIDDEN: - cause = new ForbiddenException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.GONE: - - final int subStatusCode = Math.toIntExact(response.getHeader(RntbdResponseHeader.SubStatus)); - - switch (subStatusCode) { - case SubStatusCodes.COMPLETING_SPLIT: - cause = new PartitionKeyRangeIsSplittingException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - case SubStatusCodes.COMPLETING_PARTITION_MIGRATION: - cause = new PartitionIsMigratingException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - case SubStatusCodes.NAME_CACHE_IS_STALE: - cause = new InvalidPartitionException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - case SubStatusCodes.PARTITION_KEY_RANGE_GONE: - cause = new PartitionKeyRangeGoneException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - default: - cause = new GoneException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - } - break; - - case StatusCodes.INTERNAL_SERVER_ERROR: - cause = new InternalServerErrorException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.LOCKED: - cause = new LockedException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.METHOD_NOT_ALLOWED: - cause = new MethodNotAllowedException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.NOTFOUND: - cause = new NotFoundException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.PRECONDITION_FAILED: - cause = new PreconditionFailedException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.REQUEST_ENTITY_TOO_LARGE: - cause = new RequestEntityTooLargeException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.REQUEST_TIMEOUT: - cause = new RequestTimeoutException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.RETRY_WITH: - cause = new RetryWithException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.SERVICE_UNAVAILABLE: - cause = new ServiceUnavailableException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.TOO_MANY_REQUESTS: - cause = new RequestRateTooLargeException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - case StatusCodes.UNAUTHORIZED: - cause = new UnauthorizedException(error, lsn, partitionKeyRangeId, responseHeaders); - break; - - default: - cause = new DocumentClientException(status.code(), error, responseHeaders); - break; - } - - logger.trace("{}[activityId: {}, statusCode: {}, subStatusCode: {}] ", - context.channel(), cause.getActivityId(), cause.getStatusCode(), cause.getSubStatusCode(), cause - ); - - pendingRequest.completeExceptionally(cause); - } - } - - private void traceOperation(final ChannelHandlerContext context, final String operationName, final Object... args) { - - if (logger.isTraceEnabled()) { - - final long birthTime; - final BigDecimal lifetime; - - if (this.pendingRequest == null) { - birthTime = System.nanoTime(); - lifetime = BigDecimal.ZERO; - } else { - birthTime = this.pendingRequest.getBirthTime(); - lifetime = BigDecimal.valueOf(this.pendingRequest.getLifetime().toNanos(), 6); - } - - logger.trace("{},{},\"{}({})\",\"{}\",\"{}\"", birthTime, lifetime, operationName, Stream.of(args).map(arg -> - arg == null ? "null" : arg.toString()).collect(Collectors.joining(",") - ), this.pendingRequest, context - ); - } - } - - // endregion - - // region Types - - private static class ClosedWithPendingRequestsException extends RuntimeException { - - static ClosedWithPendingRequestsException INSTANCE = new ClosedWithPendingRequestsException(); - - // TODO: DANOBLE: Consider revising strategy for closing an RntbdTransportClient with pending requests - // One possibility: - // A channel associated with an RntbdTransportClient will not be closed immediately, if there are any pending - // requests on it. Instead it will be scheduled to close after the request timeout interval (default: 60s) has - // elapsed. - // Algorithm: - // When the RntbdTransportClient is closed, it closes each of its RntbdServiceEndpoint instances. In turn each - // RntbdServiceEndpoint closes its RntbdClientChannelPool. The RntbdClientChannelPool.close method should - // schedule closure of any channel with pending requests for later; when the request timeout interval has - // elapsed or--ideally--when all pending requests have completed. - // Links: - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/388987 - - private ClosedWithPendingRequestsException() { - } - } - - // endregion -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestRecord.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestRecord.java deleted file mode 100644 index 108a8e106b9a..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestRecord.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.RequestTimeoutException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResponse; -import io.netty.util.Timeout; -import io.netty.util.TimerTask; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.time.Duration; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.TimeUnit; - -import static com.google.common.base.Preconditions.checkNotNull; - -public final class RntbdRequestRecord extends CompletableFuture { - - private static final Logger logger = LoggerFactory.getLogger(RntbdRequestRecord.class); - - private final RntbdRequestArgs args; - private final RntbdRequestTimer timer; - - public RntbdRequestRecord(final RntbdRequestArgs args, final RntbdRequestTimer timer) { - - checkNotNull(args, "args"); - checkNotNull(timer, "timer"); - - this.args = args; - this.timer = timer; - } - - public UUID getActivityId() { - return this.args.getActivityId(); - } - - public RntbdRequestArgs getArgs() { - return this.args; - } - - public long getBirthTime() { - return this.args.getBirthTime(); - } - - public Duration getLifetime() { - return this.args.getLifetime(); - } - - public void expire() { - final RequestTimeoutException error = new RequestTimeoutException( - String.format("Request timeout interval (%,d ms) elapsed", - this.timer.getRequestTimeout(TimeUnit.MILLISECONDS)), - this.args.getPhysicalAddress()); - BridgeInternal.setRequestHeaders(error, this.args.getServiceRequest().getHeaders()); - this.completeExceptionally(error); - } - - public Timeout newTimeout(final TimerTask task) { - return this.timer.newTimeout(task); - } - - @Override - public String toString() { - return this.args.toString(); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestTimer.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestTimer.java deleted file mode 100644 index 7217dfc7f73d..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdRequestTimer.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import io.netty.util.HashedWheelTimer; -import io.netty.util.Timeout; -import io.netty.util.Timer; -import io.netty.util.TimerTask; - -import java.util.concurrent.TimeUnit; - -public final class RntbdRequestTimer implements AutoCloseable { - - private static final long FIVE_MILLISECONDS = 5000000L; - private final long requestTimeout; - private final Timer timer; - - public RntbdRequestTimer(final long requestTimeout) { - - // Inspection of the HashWheelTimer code indicates that our choice of a 5 millisecond timer resolution ensures - // a request will timeout within 10 milliseconds of the specified requestTimeout interval. This is because - // cancellation of a timeout takes two timer resolution units to complete. - - this.timer = new HashedWheelTimer(FIVE_MILLISECONDS, TimeUnit.NANOSECONDS); - this.requestTimeout = requestTimeout; - } - - public long getRequestTimeout(TimeUnit unit) { - return unit.convert(requestTimeout, TimeUnit.NANOSECONDS); - } - - @Override - public void close() throws RuntimeException { - this.timer.stop(); - } - - public Timeout newTimeout(final TimerTask task) { - return this.timer.newTimeout(task, this.requestTimeout, TimeUnit.NANOSECONDS); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdResponse.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdResponse.java deleted file mode 100644 index 77142964209a..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdResponse.java +++ /dev/null @@ -1,290 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectWriter; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResponse; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; -import io.netty.buffer.EmptyByteBuf; -import io.netty.handler.codec.CorruptedFrameException; -import io.netty.handler.codec.http.HttpResponseStatus; -import io.netty.util.ReferenceCounted; -import io.netty.util.ResourceLeakDetector; - -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicInteger; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdResponseHeader; -import static java.lang.Math.min; - -@JsonPropertyOrder({ "frame", "headers", "content" }) -public final class RntbdResponse implements ReferenceCounted { - - // region Fields - - @JsonProperty - @JsonSerialize(using = PayloadSerializer.class) - private final ByteBuf content; - - @JsonProperty - private final RntbdResponseStatus frame; - - @JsonProperty - private final RntbdResponseHeaders headers; - - private AtomicInteger referenceCount = new AtomicInteger(); - - // endregion - - public RntbdResponse(final UUID activityId, final int statusCode, final Map map, final ByteBuf content) { - - this.headers = RntbdResponseHeaders.fromMap(map, content.readableBytes() > 0); - this.content = content.retain(); - - final HttpResponseStatus status = HttpResponseStatus.valueOf(statusCode); - final int length = RntbdResponseStatus.LENGTH + this.headers.computeLength(); - - this.frame = new RntbdResponseStatus(length, status, activityId); - } - - private RntbdResponse(final RntbdResponseStatus frame, final RntbdResponseHeaders headers, final ByteBuf content) { - - this.frame = frame; - this.headers = headers; - this.content = content.retain(); - } - - public UUID getActivityId() { - return this.frame.getActivityId(); - } - - @JsonIgnore - public ByteBuf getContent() { - return this.content; - } - - @JsonIgnore - public RntbdResponseHeaders getHeaders() { - return this.headers; - } - - @JsonIgnore - public HttpResponseStatus getStatus() { - return this.frame.getStatus(); - } - - static RntbdResponse decode(final ByteBuf in) { - - in.markReaderIndex(); - - final RntbdResponseStatus frame = RntbdResponseStatus.decode(in); - final RntbdResponseHeaders headers = RntbdResponseHeaders.decode(in.readSlice(frame.getHeadersLength())); - - final boolean hasPayload = headers.isPayloadPresent(); - final ByteBuf content; - - if (hasPayload) { - - if (!RntbdFramer.canDecodePayload(in)) { - in.resetReaderIndex(); - return null; - } - - content = in.readSlice(in.readIntLE()); - - } else { - - content = new EmptyByteBuf(in.alloc()); - } - - return new RntbdResponse(frame, headers, content); - } - - public void encode(final ByteBuf out) { - - final int start = out.writerIndex(); - - this.frame.encode(out); - this.headers.encode(out); - - final int length = out.writerIndex() - start; - - if (length != this.frame.getLength()) { - throw new IllegalStateException(); - } - - if (this.hasPayload()) { - out.writeIntLE(this.content.readableBytes()); - out.writeBytes(this.content); - } else if (this.content.readableBytes() > 0) { - throw new IllegalStateException(); - } - } - - @JsonIgnore - public T getHeader(final RntbdResponseHeader header) { - final T value = (T)this.headers.get(header).getValue(); - return value; - } - - public boolean hasPayload() { - return this.headers.isPayloadPresent(); - } - - /** - * Returns the reference count of this object. If {@code 0}, it means this object has been deallocated. - */ - @Override - public int refCnt() { - return this.referenceCount.get(); - } - - /** - * Decreases the reference count by {@code 1} and deallocate this object if the reference count reaches {@code 0} - * - * @return {@code true} if and only if the reference count became {@code 0} and this object is de-allocated - */ - @Override - public boolean release() { - return this.release(1); - } - - /** - * Decreases the reference count by {@code decrement} and de-allocates this object if the reference count reaches {@code 0} - * - * @param decrement amount of the decrease - * @return {@code true} if and only if the reference count became {@code 0} and this object has been de-allocated - */ - @Override - public boolean release(final int decrement) { - - return this.referenceCount.getAndAccumulate(decrement, (value, n) -> { - value = value - min(value, n); - if (value == 0) { - assert this.headers != null && this.content != null; - this.headers.releaseBuffers(); - this.content.release(); - } - return value; - }) == 0; - } - - /** - * Increases the reference count by {@code 1}. - */ - @Override - public ReferenceCounted retain() { - this.referenceCount.incrementAndGet(); - return this; - } - - /** - * Increases the reference count by the specified {@code increment}. - * - * @param increment amount of the increase - */ - @Override - public ReferenceCounted retain(final int increment) { - this.referenceCount.addAndGet(increment); - return this; - } - - StoreResponse toStoreResponse(final RntbdContext context) { - - checkNotNull(context, "context"); - final int length = this.content.readableBytes(); - - return new StoreResponse( - this.getStatus().code(), - this.headers.asList(context, this.getActivityId()), - length == 0 ? null : this.content.readCharSequence(length, StandardCharsets.UTF_8).toString() - ); - } - - @Override - public String toString() { - final ObjectWriter writer = RntbdObjectMapper.writer(); - try { - return writer.writeValueAsString(this); - } catch (final JsonProcessingException error) { - throw new CorruptedFrameException(error); - } - } - - /** - * Records the current access location of this object for debugging purposes - *

- * If this object is determined to be leaked, the information recorded by this operation will be provided to you - * via {@link ResourceLeakDetector}. This method is a shortcut to {@link #touch(Object) touch(null)}. - */ - @Override - public ReferenceCounted touch() { - return this; - } - - /** - * Records the current access location of this object with additional arbitrary information for debugging purposes - *

- * If this object is determined to be leaked, the information recorded by this operation will be - * provided to you via {@link ResourceLeakDetector}. - * - * @param hint information useful for debugging (unused) - */ - @Override - public ReferenceCounted touch(final Object hint) { - return this; - } - - private static class PayloadSerializer extends StdSerializer { - - public PayloadSerializer() { - super(ByteBuf.class, true); - } - - @Override - public void serialize(final ByteBuf value, final JsonGenerator generator, final SerializerProvider provider) throws IOException { - - final int length = value.readableBytes(); - - generator.writeStartObject(); - generator.writeObjectField("length", length); - generator.writeObjectField("content", ByteBufUtil.hexDump(value, 0, length)); - generator.writeEndObject(); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdResponseDecoder.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdResponseDecoder.java deleted file mode 100644 index d813233255c3..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdResponseDecoder.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.ByteToMessageDecoder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.List; - -public final class RntbdResponseDecoder extends ByteToMessageDecoder { - - private static final Logger Logger = LoggerFactory.getLogger(RntbdResponseDecoder.class); - - /** - * Deserialize from an input {@link ByteBuf} to an {@link RntbdResponse} instance - *

- * This method is called till it reads no bytes from the {@link ByteBuf} or there is no more data to be readTree. - * - * @param context the {@link ChannelHandlerContext} to which this {@link RntbdResponseDecoder} belongs - * @param in the {@link ByteBuf} to which data to be decoded is readTree - * @param out the {@link List} to which decoded messages are added - */ - @Override - protected void decode(final ChannelHandlerContext context, final ByteBuf in, final List out) { - - if (RntbdFramer.canDecodeHead(in)) { - - final RntbdResponse response = RntbdResponse.decode(in); - - if (response != null) { - Logger.debug("{} DECODE COMPLETE: {}", context.channel(), response); - in.discardReadBytes(); - out.add(response.retain()); - } - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdResponseHeaders.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdResponseHeaders.java deleted file mode 100644 index ef459591e8f2..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdResponseHeaders.java +++ /dev/null @@ -1,535 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectWriter; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import io.netty.buffer.ByteBuf; -import io.netty.handler.codec.CorruptedFrameException; - -import java.math.BigDecimal; -import java.util.AbstractMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.function.BiConsumer; -import java.util.function.Function; - -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.HttpHeaders; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.WFConstants.BackendHeaders; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdIndexingDirective; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdResponseHeader; - -@JsonFilter("RntbdToken") -class RntbdResponseHeaders extends RntbdTokenStream { - - // region Fields - - @JsonProperty - private final RntbdToken LSN; - @JsonProperty - private final RntbdToken collectionLazyIndexProgress; - @JsonProperty - private final RntbdToken collectionPartitionIndex; - @JsonProperty - private final RntbdToken collectionSecurityIdentifier; - @JsonProperty - private final RntbdToken collectionServiceIndex; - @JsonProperty - private final RntbdToken collectionUpdateProgress; - @JsonProperty - private final RntbdToken continuationToken; - @JsonProperty - private final RntbdToken currentReplicaSetSize; - @JsonProperty - private final RntbdToken currentWriteQuorum; - @JsonProperty - private final RntbdToken databaseAccountId; - @JsonProperty - private final RntbdToken disableRntbdChannel; - @JsonProperty - private final RntbdToken eTag; - @JsonProperty - private final RntbdToken globalCommittedLSN; - @JsonProperty - private final RntbdToken hasTentativeWrites; - @JsonProperty - private final RntbdToken indexTermsGenerated; - @JsonProperty - private final RntbdToken indexingDirective; - @JsonProperty - private final RntbdToken isRUPerMinuteUsed; - @JsonProperty - private final RntbdToken itemCount; - @JsonProperty - private final RntbdToken itemLSN; - @JsonProperty - private final RntbdToken itemLocalLSN; - @JsonProperty - private final RntbdToken lastStateChangeDateTime; - @JsonProperty - private final RntbdToken localLSN; - @JsonProperty - private final RntbdToken logResults; - @JsonProperty - private final RntbdToken numberOfReadRegions; - @JsonProperty - private final RntbdToken offerReplacePending; - @JsonProperty - private final RntbdToken ownerFullName; - @JsonProperty - private final RntbdToken ownerId; - @JsonProperty - private final RntbdToken partitionKeyRangeId; - @JsonProperty - private final RntbdToken payloadPresent; - @JsonProperty - private final RntbdToken queriesPerformed; - @JsonProperty - private final RntbdToken queryMetrics; - @JsonProperty - private final RntbdToken quorumAckedLSN; - @JsonProperty - private final RntbdToken quorumAckedLocalLSN; - @JsonProperty - private final RntbdToken readsPerformed; - @JsonProperty - private final RntbdToken requestCharge; - @JsonProperty - private final RntbdToken requestValidationFailure; - @JsonProperty - private final RntbdToken restoreState; - @JsonProperty - private final RntbdToken retryAfterMilliseconds; - @JsonProperty - private final RntbdToken schemaVersion; - @JsonProperty - private final RntbdToken scriptsExecuted; - @JsonProperty - private final RntbdToken serverDateTimeUtc; - @JsonProperty - private final RntbdToken sessionToken; - @JsonProperty - private final RntbdToken shareThroughput; - @JsonProperty - private final RntbdToken storageMaxResoureQuota; - @JsonProperty - private final RntbdToken storageResourceQuotaUsage; - @JsonProperty - private final RntbdToken subStatus; - @JsonProperty - private final RntbdToken transportRequestID; - @JsonProperty - private final RntbdToken writesPerformed; - @JsonProperty - private final RntbdToken xpRole; - - // endregion - - private RntbdResponseHeaders() { - - super(RntbdResponseHeader.set, RntbdResponseHeader.map); - - this.LSN = this.get(RntbdResponseHeader.LSN); - this.collectionLazyIndexProgress = this.get(RntbdResponseHeader.CollectionLazyIndexProgress); - this.collectionPartitionIndex = this.get(RntbdResponseHeader.CollectionPartitionIndex); - this.collectionSecurityIdentifier = this.get(RntbdResponseHeader.CollectionSecurityIdentifier); - this.collectionServiceIndex = this.get(RntbdResponseHeader.CollectionServiceIndex); - this.collectionUpdateProgress = this.get(RntbdResponseHeader.CollectionUpdateProgress); - this.continuationToken = this.get(RntbdResponseHeader.ContinuationToken); - this.currentReplicaSetSize = this.get(RntbdResponseHeader.CurrentReplicaSetSize); - this.currentWriteQuorum = this.get(RntbdResponseHeader.CurrentWriteQuorum); - this.databaseAccountId = this.get(RntbdResponseHeader.DatabaseAccountId); - this.disableRntbdChannel = this.get(RntbdResponseHeader.DisableRntbdChannel); - this.eTag = this.get(RntbdResponseHeader.ETag); - this.globalCommittedLSN = this.get(RntbdResponseHeader.GlobalCommittedLSN); - this.hasTentativeWrites = this.get(RntbdResponseHeader.HasTentativeWrites); - this.indexTermsGenerated = this.get(RntbdResponseHeader.IndexTermsGenerated); - this.indexingDirective = this.get(RntbdResponseHeader.IndexingDirective); - this.isRUPerMinuteUsed = this.get(RntbdResponseHeader.IsRUPerMinuteUsed); - this.itemCount = this.get(RntbdResponseHeader.ItemCount); - this.itemLSN = this.get(RntbdResponseHeader.ItemLSN); - this.itemLocalLSN = this.get(RntbdResponseHeader.ItemLocalLSN); - this.lastStateChangeDateTime = this.get(RntbdResponseHeader.LastStateChangeDateTime); - this.localLSN = this.get(RntbdResponseHeader.LocalLSN); - this.logResults = this.get(RntbdResponseHeader.LogResults); - this.numberOfReadRegions = this.get(RntbdResponseHeader.NumberOfReadRegions); - this.offerReplacePending = this.get(RntbdResponseHeader.OfferReplacePending); - this.ownerFullName = this.get(RntbdResponseHeader.OwnerFullName); - this.ownerId = this.get(RntbdResponseHeader.OwnerId); - this.partitionKeyRangeId = this.get(RntbdResponseHeader.PartitionKeyRangeId); - this.payloadPresent = this.get(RntbdResponseHeader.PayloadPresent); - this.queriesPerformed = this.get(RntbdResponseHeader.QueriesPerformed); - this.queryMetrics = this.get(RntbdResponseHeader.QueryMetrics); - this.quorumAckedLSN = this.get(RntbdResponseHeader.QuorumAckedLSN); - this.quorumAckedLocalLSN = this.get(RntbdResponseHeader.QuorumAckedLocalLSN); - this.readsPerformed = this.get(RntbdResponseHeader.ReadsPerformed); - this.requestCharge = this.get(RntbdResponseHeader.RequestCharge); - this.requestValidationFailure = this.get(RntbdResponseHeader.RequestValidationFailure); - this.restoreState = this.get(RntbdResponseHeader.RestoreState); - this.retryAfterMilliseconds = this.get(RntbdResponseHeader.RetryAfterMilliseconds); - this.schemaVersion = this.get(RntbdResponseHeader.SchemaVersion); - this.scriptsExecuted = this.get(RntbdResponseHeader.ScriptsExecuted); - this.serverDateTimeUtc = this.get(RntbdResponseHeader.ServerDateTimeUtc); - this.sessionToken = this.get(RntbdResponseHeader.SessionToken); - this.shareThroughput = this.get(RntbdResponseHeader.ShareThroughput); - this.storageMaxResoureQuota = this.get(RntbdResponseHeader.StorageMaxResoureQuota); - this.storageResourceQuotaUsage = this.get(RntbdResponseHeader.StorageResourceQuotaUsage); - this.subStatus = this.get(RntbdResponseHeader.SubStatus); - this.transportRequestID = this.get(RntbdResponseHeader.TransportRequestID); - this.writesPerformed = this.get(RntbdResponseHeader.WritesPerformed); - this.xpRole = this.get(RntbdResponseHeader.XPRole); - } - - boolean isPayloadPresent() { - return this.payloadPresent.isPresent() && this.payloadPresent.getValue(Byte.class) != 0x00; - } - - List> asList(final RntbdContext context, final UUID activityId) { - - final ImmutableList.Builder> builder = ImmutableList.builderWithExpectedSize(this.computeCount() + 2); - builder.add(new Entry(HttpHeaders.SERVER_VERSION, context.getServerVersion())); - builder.add(new Entry(HttpHeaders.ACTIVITY_ID, activityId.toString())); - - this.collectEntries((token, toEntry) -> { - if (token.isPresent()) { - builder.add(toEntry.apply(token)); - } - }); - - return builder.build(); - } - - public Map asMap(final RntbdContext context, final UUID activityId) { - - final ImmutableMap.Builder builder = ImmutableMap.builderWithExpectedSize(this.computeCount() + 2); - builder.put(new Entry(HttpHeaders.SERVER_VERSION, context.getServerVersion())); - builder.put(new Entry(HttpHeaders.ACTIVITY_ID, activityId.toString())); - - this.collectEntries((token, toEntry) -> { - if (token.isPresent()) { - builder.put(toEntry.apply(token)); - } - }); - - return builder.build(); - } - - static RntbdResponseHeaders decode(final ByteBuf in) { - final RntbdResponseHeaders headers = new RntbdResponseHeaders(); - RntbdTokenStream.decode(in, headers); - return headers; - } - - public static RntbdResponseHeaders fromMap(final Map map, final boolean payloadPresent) { - - final RntbdResponseHeaders headers = new RntbdResponseHeaders(); - headers.payloadPresent.setValue(payloadPresent); - headers.setValues(map); - - return headers; - } - - public void setValues(final Map headers) { - - this.mapValue(this.LSN, BackendHeaders.LSN, Long::parseLong, headers); - this.mapValue(this.collectionLazyIndexProgress, HttpHeaders.COLLECTION_LAZY_INDEXING_PROGRESS, Integer::parseInt, headers); - this.mapValue(this.collectionLazyIndexProgress, BackendHeaders.COLLECTION_PARTITION_INDEX, Integer::parseInt, headers); - this.mapValue(this.collectionSecurityIdentifier, BackendHeaders.COLLECTION_SECURITY_IDENTIFIER, String::toString, headers); - this.mapValue(this.collectionServiceIndex, BackendHeaders.COLLECTION_SERVICE_INDEX, Integer::parseInt, headers); - this.mapValue(this.collectionUpdateProgress, HttpHeaders.COLLECTION_INDEX_TRANSFORMATION_PROGRESS, Integer::parseInt, headers); - this.mapValue(this.continuationToken, HttpHeaders.CONTINUATION, String::toString, headers); - this.mapValue(this.currentReplicaSetSize, BackendHeaders.CURRENT_REPLICA_SET_SIZE, Integer::parseInt, headers); - this.mapValue(this.currentWriteQuorum, BackendHeaders.CURRENT_WRITE_QUORUM, Integer::parseInt, headers); - this.mapValue(this.databaseAccountId, BackendHeaders.DATABASE_ACCOUNT_ID, String::toString, headers); - this.mapValue(this.disableRntbdChannel, HttpHeaders.DISABLE_RNTBD_CHANNEL, Boolean::parseBoolean, headers); - this.mapValue(this.eTag, HttpHeaders.E_TAG, String::toString, headers); - this.mapValue(this.globalCommittedLSN, BackendHeaders.GLOBAL_COMMITTED_LSN, Long::parseLong, headers); - this.mapValue(this.hasTentativeWrites, BackendHeaders.HAS_TENTATIVE_WRITES, Boolean::parseBoolean, headers); - this.mapValue(this.indexingDirective, HttpHeaders.INDEXING_DIRECTIVE, RntbdIndexingDirective::valueOf, headers); - this.mapValue(this.isRUPerMinuteUsed, BackendHeaders.IS_RU_PER_MINUTE_USED, Byte::parseByte, headers); - this.mapValue(this.itemCount, HttpHeaders.ITEM_COUNT, Integer::parseInt, headers); - this.mapValue(this.itemLSN, BackendHeaders.ITEM_LSN, Long::parseLong, headers); - this.mapValue(this.itemLocalLSN, BackendHeaders.ITEM_LOCAL_LSN, Long::parseLong, headers); - this.mapValue(this.lastStateChangeDateTime, HttpHeaders.LAST_STATE_CHANGE_UTC, String::toString, headers); - this.mapValue(this.lastStateChangeDateTime, HttpHeaders.LAST_STATE_CHANGE_UTC, String::toString, headers); - this.mapValue(this.localLSN, BackendHeaders.LOCAL_LSN, Long::parseLong, headers); - this.mapValue(this.logResults, HttpHeaders.LOG_RESULTS, String::toString, headers); - this.mapValue(this.numberOfReadRegions, BackendHeaders.NUMBER_OF_READ_REGIONS, Integer::parseInt, headers); - this.mapValue(this.offerReplacePending, BackendHeaders.OFFER_REPLACE_PENDING, Boolean::parseBoolean, headers); - this.mapValue(this.ownerFullName, HttpHeaders.OWNER_FULL_NAME, String::toString, headers); - this.mapValue(this.ownerId, HttpHeaders.OWNER_ID, String::toString, headers); - this.mapValue(this.partitionKeyRangeId, BackendHeaders.PARTITION_KEY_RANGE_ID, String::toString, headers); - this.mapValue(this.queryMetrics, BackendHeaders.QUERY_METRICS, String::toString, headers); - this.mapValue(this.quorumAckedLSN, BackendHeaders.QUORUM_ACKED_LSN, Long::parseLong, headers); - this.mapValue(this.quorumAckedLocalLSN, BackendHeaders.QUORUM_ACKED_LOCAL_LSN, Long::parseLong, headers); - this.mapValue(this.requestCharge, HttpHeaders.REQUEST_CHARGE, Double::parseDouble, headers); - this.mapValue(this.requestValidationFailure, BackendHeaders.REQUEST_VALIDATION_FAILURE, Byte::parseByte, headers); - this.mapValue(this.restoreState, BackendHeaders.RESTORE_STATE, String::toString, headers); - this.mapValue(this.retryAfterMilliseconds, HttpHeaders.RETRY_AFTER_IN_MILLISECONDS, Integer::parseInt, headers); - this.mapValue(this.schemaVersion, HttpHeaders.SCHEMA_VERSION, String::toString, headers); - this.mapValue(this.serverDateTimeUtc, HttpHeaders.X_DATE, String::toString, headers); - this.mapValue(this.sessionToken, HttpHeaders.SESSION_TOKEN, String::toString, headers); - this.mapValue(this.shareThroughput, BackendHeaders.SHARE_THROUGHPUT, Boolean::parseBoolean, headers); - this.mapValue(this.storageMaxResoureQuota, HttpHeaders.MAX_RESOURCE_QUOTA, String::toString, headers); - this.mapValue(this.storageResourceQuotaUsage, HttpHeaders.CURRENT_RESOURCE_QUOTA_USAGE, String::toString, headers); - this.mapValue(this.subStatus, BackendHeaders.SUB_STATUS, Integer::parseInt, headers); - this.mapValue(this.transportRequestID, HttpHeaders.TRANSPORT_REQUEST_ID, Integer::parseInt, headers); - this.mapValue(this.xpRole, BackendHeaders.XP_ROLE, Integer::parseInt, headers); - } - - @Override - public String toString() { - final ObjectWriter writer = RntbdObjectMapper.writer(); - try { - return writer.writeValueAsString(this); - } catch (final JsonProcessingException error) { - throw new CorruptedFrameException(error); - } - } - - private void collectEntries(final BiConsumer>> collector) { - - collector.accept(this.LSN, token -> - toLongEntry(BackendHeaders.LSN, token) - ); - - collector.accept(this.collectionLazyIndexProgress, token -> - toIntegerEntry(HttpHeaders.COLLECTION_LAZY_INDEXING_PROGRESS, token) - ); - - collector.accept(this.collectionPartitionIndex, token -> - toIntegerEntry(BackendHeaders.COLLECTION_PARTITION_INDEX, token) - ); - - collector.accept(this.collectionSecurityIdentifier, token -> - toStringEntry(BackendHeaders.COLLECTION_SECURITY_IDENTIFIER, token) - ); - - collector.accept(this.collectionServiceIndex, token -> - toIntegerEntry(BackendHeaders.COLLECTION_SERVICE_INDEX, token) - ); - - collector.accept(this.collectionUpdateProgress, token -> - toIntegerEntry(HttpHeaders.COLLECTION_INDEX_TRANSFORMATION_PROGRESS, token) - ); - - collector.accept(this.continuationToken, token -> - toStringEntry(HttpHeaders.CONTINUATION, token) - ); - - collector.accept(this.currentReplicaSetSize, token -> - toIntegerEntry(BackendHeaders.CURRENT_REPLICA_SET_SIZE, token) - ); - - collector.accept(this.currentWriteQuorum, token -> - toIntegerEntry(BackendHeaders.CURRENT_WRITE_QUORUM, token) - ); - - collector.accept(this.databaseAccountId, token -> - toStringEntry(BackendHeaders.DATABASE_ACCOUNT_ID, token) - ); - - collector.accept(this.disableRntbdChannel, token -> - toBooleanEntry(HttpHeaders.DISABLE_RNTBD_CHANNEL, token) - ); - - collector.accept(this.eTag, token -> - toStringEntry(HttpHeaders.E_TAG, token) - ); - - collector.accept(this.globalCommittedLSN, token -> - toLongEntry(BackendHeaders.GLOBAL_COMMITTED_LSN, token) - ); - - collector.accept(this.hasTentativeWrites, token -> - toBooleanEntry(BackendHeaders.HAS_TENTATIVE_WRITES, token) - ); - - collector.accept(this.indexingDirective, token -> - new Entry(HttpHeaders.INDEXING_DIRECTIVE, RntbdIndexingDirective.fromId(token.getValue(Byte.class)).name()) - ); - - collector.accept(this.isRUPerMinuteUsed, token -> - toByteEntry(BackendHeaders.IS_RU_PER_MINUTE_USED, token) - ); - - collector.accept(this.itemCount, token -> - toIntegerEntry(HttpHeaders.ITEM_COUNT, token) - ); - - collector.accept(this.itemLSN, token -> - toLongEntry(BackendHeaders.ITEM_LSN, token) - ); - - collector.accept(this.itemLocalLSN, token -> - toLongEntry(BackendHeaders.ITEM_LOCAL_LSN, token) - ); - - collector.accept(this.lastStateChangeDateTime, token -> - toStringEntry(HttpHeaders.LAST_STATE_CHANGE_UTC, token) - ); - - collector.accept(this.localLSN, token -> - toLongEntry(BackendHeaders.LOCAL_LSN, token) - ); - - collector.accept(this.logResults, token -> - toStringEntry(HttpHeaders.LOG_RESULTS, token) - ); - - collector.accept(this.numberOfReadRegions, token -> - toIntegerEntry(BackendHeaders.NUMBER_OF_READ_REGIONS, token) - ); - - collector.accept(this.offerReplacePending, token -> - toBooleanEntry(BackendHeaders.OFFER_REPLACE_PENDING, token) - ); - - collector.accept(this.ownerFullName, token -> - toStringEntry(HttpHeaders.OWNER_FULL_NAME, token) - ); - - collector.accept(this.ownerId, token -> - toStringEntry(HttpHeaders.OWNER_ID, token) - ); - - collector.accept(this.partitionKeyRangeId, token -> - toStringEntry(BackendHeaders.PARTITION_KEY_RANGE_ID, token) - ); - - collector.accept(this.queryMetrics, token -> - toStringEntry(BackendHeaders.QUERY_METRICS, token) - ); - - collector.accept(this.quorumAckedLSN, token -> - toLongEntry(BackendHeaders.QUORUM_ACKED_LSN, token) - ); - - collector.accept(this.quorumAckedLocalLSN, token -> - toLongEntry(BackendHeaders.QUORUM_ACKED_LOCAL_LSN, token) - ); - - collector.accept(this.requestCharge, token -> - toCurrencyEntry(HttpHeaders.REQUEST_CHARGE, token) - ); - - collector.accept(this.requestValidationFailure, token -> - toByteEntry(BackendHeaders.REQUEST_VALIDATION_FAILURE, token) - ); - - collector.accept(this.restoreState, token -> - toStringEntry(BackendHeaders.RESTORE_STATE, token) - ); - - collector.accept(this.retryAfterMilliseconds, token -> - toIntegerEntry(HttpHeaders.RETRY_AFTER_IN_MILLISECONDS, token) - ); - - collector.accept(this.schemaVersion, token -> - toStringEntry(HttpHeaders.SCHEMA_VERSION, token) - ); - - collector.accept(this.serverDateTimeUtc, token -> - toStringEntry(HttpHeaders.X_DATE, token) - ); - - collector.accept(this.sessionToken, token -> - this.toSessionTokenEntry(HttpHeaders.SESSION_TOKEN, token) - ); - - collector.accept(this.shareThroughput, token -> - toBooleanEntry(BackendHeaders.SHARE_THROUGHPUT, token) - ); - - collector.accept(this.storageMaxResoureQuota, token -> - toStringEntry(HttpHeaders.MAX_RESOURCE_QUOTA, token) - ); - - collector.accept(this.storageResourceQuotaUsage, token -> - toStringEntry(HttpHeaders.CURRENT_RESOURCE_QUOTA_USAGE, token) - ); - - collector.accept(this.subStatus, token -> - toIntegerEntry(BackendHeaders.SUB_STATUS, token) - ); - - collector.accept(this.transportRequestID, token -> - toIntegerEntry(HttpHeaders.TRANSPORT_REQUEST_ID, token) - ); - - collector.accept(this.xpRole, token -> - toIntegerEntry(BackendHeaders.XP_ROLE, token) - ); - } - - private void mapValue(final RntbdToken token, final String name, final Function parse, final Map headers) { - - final String value = headers.get(name); - - if (value != null) { - token.setValue(parse.apply(value)); - } - } - - private static Map.Entry toBooleanEntry(final String name, final RntbdToken token) { - return new Entry(name, String.valueOf(token.getValue(Byte.class) != 0)); - } - - private static Map.Entry toByteEntry(final String name, final RntbdToken token) { - return new Entry(name, Byte.toString(token.getValue(Byte.class))); - } - - private static Map.Entry toCurrencyEntry(final String name, final RntbdToken token) { - final BigDecimal value = new BigDecimal(Math.round(token.getValue(Double.class) * 100D)).scaleByPowerOfTen(-2); - return new Entry(name, value.toString()); - } - - private static Map.Entry toIntegerEntry(final String name, final RntbdToken token) { - return new Entry(name, Long.toString(token.getValue(Long.class))); - } - - private static Map.Entry toLongEntry(final String name, final RntbdToken token) { - return new Entry(name, Long.toString(token.getValue(Long.class))); - } - - private Map.Entry toSessionTokenEntry(final String name, final RntbdToken token) { - return new Entry(name, this.partitionKeyRangeId.getValue(String.class) + ":" + this.sessionToken.getValue(String.class)); - } - - private static Map.Entry toStringEntry(final String name, final RntbdToken token) { - return new Entry(name, token.getValue(String.class)); - } - - private static final class Entry extends AbstractMap.SimpleImmutableEntry { - Entry(final String name, final String value) { - super(name, value); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdResponseStatus.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdResponseStatus.java deleted file mode 100644 index f5473084f4a0..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdResponseStatus.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectWriter; -import io.netty.buffer.ByteBuf; -import io.netty.handler.codec.CorruptedFrameException; -import io.netty.handler.codec.http.HttpResponseStatus; - -import java.util.UUID; - -@JsonPropertyOrder({ "length", "status", "activityId" }) -final class RntbdResponseStatus { - - // region Fields - - static final int LENGTH = Integer.BYTES // length - + Integer.BYTES // status - + 2 * Long.BYTES; // activityId - - @JsonProperty("activityId") - private final UUID activityId; - - @JsonProperty("length") - private final int length; - - private final HttpResponseStatus status; - - // endregion - - RntbdResponseStatus(final int length, final HttpResponseStatus status, final UUID activityId) { - this.length = length; - this.status = status; - this.activityId = activityId; - } - - public UUID getActivityId() { - return this.activityId; - } - - int getHeadersLength() { - return this.length - LENGTH; - } - - public int getLength() { - return this.length; - } - - public HttpResponseStatus getStatus() { - return this.status; - } - - @JsonProperty("status") - public int getStatusCode() { - return this.status.code(); - } - - static RntbdResponseStatus decode(final ByteBuf in) { - - final long length = in.readUnsignedIntLE(); - - if (!(LENGTH <= length && length <= Integer.MAX_VALUE)) { - final String reason = String.format("frame length: %d", length); - throw new CorruptedFrameException(reason); - } - - final int code = in.readIntLE(); - final HttpResponseStatus status = HttpResponseStatus.valueOf(code); - - if (status == null) { - final String reason = String.format("status code: %d", code); - throw new CorruptedFrameException(reason); - } - - final UUID activityId = RntbdUUID.decode(in); - return new RntbdResponseStatus((int)length, status, activityId); - } - - void encode(final ByteBuf out) { - out.writeIntLE(this.getLength()); - out.writeIntLE(this.getStatusCode()); - RntbdUUID.encode(this.getActivityId(), out); - } - - @Override - public String toString() { - final ObjectWriter writer = RntbdObjectMapper.writer(); - try { - return writer.writeValueAsString(this); - } catch (final JsonProcessingException error) { - throw new CorruptedFrameException(error); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdServiceEndpoint.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdServiceEndpoint.java deleted file mode 100644 index 8c89a207f762..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdServiceEndpoint.java +++ /dev/null @@ -1,355 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.StdSerializer; -import com.google.common.collect.ImmutableMap; -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.GoneException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.RntbdTransportClient.Options; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResponse; -import io.netty.bootstrap.Bootstrap; -import io.netty.channel.Channel; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOption; -import io.netty.channel.nio.NioEventLoopGroup; -import io.netty.channel.socket.nio.NioSocketChannel; -import io.netty.handler.logging.LogLevel; -import io.netty.handler.ssl.SslContext; -import io.netty.util.concurrent.DefaultThreadFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.net.SocketAddress; -import java.net.URI; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicLong; -import java.util.stream.Stream; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdReporter.reportIssue; - -@JsonSerialize(using = RntbdServiceEndpoint.JsonSerializer.class) -public final class RntbdServiceEndpoint implements RntbdEndpoint { - - private static final AtomicLong instanceCount = new AtomicLong(); - private static final Logger logger = LoggerFactory.getLogger(RntbdServiceEndpoint.class); - private static final String namePrefix = RntbdServiceEndpoint.class.getSimpleName() + '-'; - - private final RntbdClientChannelPool channelPool; - private final AtomicBoolean closed; - private final RntbdMetrics metrics; - private final String name; - private final SocketAddress remoteAddress; - private final RntbdRequestTimer requestTimer; - - // region Constructors - - private RntbdServiceEndpoint( - final Config config, final NioEventLoopGroup group, final RntbdRequestTimer timer, final URI physicalAddress - ) { - - final Bootstrap bootstrap = new Bootstrap() - .channel(NioSocketChannel.class) - .group(group) - .option(ChannelOption.AUTO_READ, true) - .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, config.getConnectionTimeout()) - .option(ChannelOption.SO_KEEPALIVE, true) - .remoteAddress(physicalAddress.getHost(), physicalAddress.getPort()); - - this.name = RntbdServiceEndpoint.namePrefix + instanceCount.incrementAndGet(); - this.channelPool = new RntbdClientChannelPool(bootstrap, config); - this.remoteAddress = bootstrap.config().remoteAddress(); - this.metrics = new RntbdMetrics(this.name); - this.closed = new AtomicBoolean(); - this.requestTimer = timer; - } - - // endregion - - // region Accessors - - @Override - public String getName() { - return this.name; - } - - // endregion - - // region Methods - - @Override - public void close() { - if (this.closed.compareAndSet(false, true)) { - this.channelPool.close(); - this.metrics.close(); - } - } - - public CompletableFuture request(final RntbdRequestArgs args) { - - this.throwIfClosed(); - - if (logger.isDebugEnabled()) { - args.traceOperation(logger, null, "request"); - logger.debug("\n {}\n {}\n REQUEST", this, args); - } - - final RntbdRequestRecord requestRecord = this.write(args); - this.metrics.incrementRequestCount(); - - return requestRecord.whenComplete((response, error) -> { - - args.traceOperation(logger, null, "requestComplete", response, error); - this.metrics.incrementResponseCount(); - - if (error != null) { - this.metrics.incrementErrorResponseCount(); - } - - if (logger.isDebugEnabled()) { - if (error == null) { - final int status = response.getStatus(); - logger.debug("\n [{}]\n {}\n request succeeded with response status: {}", this, args, status); - } else { - logger.debug("\n [{}]\n {}\n request failed due to ", this, args, error); - } - } - }); - } - - @Override - public String toString() { - return RntbdObjectMapper.toJson(this); - } - - // endregion - - // region Privates - - private void releaseToPool(final Channel channel) { - - logger.debug("\n [{}]\n {}\n RELEASE", this, channel); - - this.channelPool.release(channel).addListener(future -> { - if (logger.isDebugEnabled()) { - if (future.isSuccess()) { - logger.debug("\n [{}]\n {}\n release succeeded", this, channel); - } else { - logger.debug("\n [{}]\n {}\n release failed due to {}", this, channel, future.cause()); - } - } - }); - } - - private void throwIfClosed() { - checkState(!this.closed.get(), "%s is closed", this); - } - - private RntbdRequestRecord write(final RntbdRequestArgs requestArgs) { - - final RntbdRequestRecord requestRecord = new RntbdRequestRecord(requestArgs, this.requestTimer); - logger.debug("\n [{}]\n {}\n WRITE", this, requestArgs); - - this.channelPool.acquire().addListener(connected -> { - - if (connected.isSuccess()) { - - requestArgs.traceOperation(logger, null, "write"); - final Channel channel = (Channel)connected.get(); - this.releaseToPool(channel); - - channel.write(requestRecord).addListener((ChannelFuture future) -> { - requestArgs.traceOperation(logger, null, "writeComplete", channel); - if (!future.isSuccess()) { - this.metrics.incrementErrorResponseCount(); - } - }); - - return; - } - - final UUID activityId = requestArgs.getActivityId(); - final Throwable cause = connected.cause(); - - if (connected.isCancelled()) { - - logger.debug("\n [{}]\n {}\n write cancelled: {}", this, requestArgs, cause); - requestRecord.cancel(true); - - } else { - - logger.debug("\n [{}]\n {}\n write failed due to {} ", this, requestArgs, cause); - final String reason = cause.getMessage(); - - final GoneException goneException = new GoneException( - String.format("failed to establish connection to %s: %s", this.remoteAddress, reason), - cause instanceof Exception ? (Exception)cause : new IOException(reason, cause), - ImmutableMap.of(HttpConstants.HttpHeaders.ACTIVITY_ID, activityId.toString()), - requestArgs.getReplicaPath() - ); - - BridgeInternal.setRequestHeaders(goneException, requestArgs.getServiceRequest().getHeaders()); - requestRecord.completeExceptionally(goneException); - } - }); - - return requestRecord; - } - - // endregion - - // region Types - - static final class JsonSerializer extends StdSerializer { - - public JsonSerializer() { - this(null); - } - - public JsonSerializer(Class type) { - super(type); - } - - @Override - public void serialize(RntbdServiceEndpoint value, JsonGenerator generator, SerializerProvider provider) - throws IOException { - - generator.writeStartObject(); - generator.writeStringField(value.name, value.remoteAddress.toString()); - generator.writeObjectField("channelPool", value.channelPool); - generator.writeEndObject(); - } - } - - public static final class Provider implements RntbdEndpoint.Provider { - - private static final Logger logger = LoggerFactory.getLogger(Provider.class); - - private final AtomicBoolean closed = new AtomicBoolean(); - private final Config config; - private final ConcurrentHashMap endpoints = new ConcurrentHashMap<>(); - private final NioEventLoopGroup eventLoopGroup; - private final RntbdRequestTimer requestTimer; - - public Provider(final Options options, final SslContext sslContext) { - - checkNotNull(options, "options"); - checkNotNull(sslContext, "sslContext"); - - final DefaultThreadFactory threadFactory = new DefaultThreadFactory("CosmosEventLoop", true); - final int threadCount = Runtime.getRuntime().availableProcessors(); - final LogLevel wireLogLevel; - - if (logger.isTraceEnabled()) { - wireLogLevel = LogLevel.TRACE; - } else if (logger.isDebugEnabled()) { - wireLogLevel = LogLevel.DEBUG; - } else { - wireLogLevel = null; - } - - this.config = new Config(options, sslContext, wireLogLevel); - this.requestTimer = new RntbdRequestTimer(config.getRequestTimeout()); - this.eventLoopGroup = new NioEventLoopGroup(threadCount, threadFactory); - } - - @Override - public void close() throws RuntimeException { - - if (this.closed.compareAndSet(false, true)) { - - this.requestTimer.close(); - - for (final RntbdEndpoint endpoint : this.endpoints.values()) { - endpoint.close(); - } - - this.eventLoopGroup.shutdownGracefully().addListener(future -> { - if (future.isSuccess()) { - logger.debug("\n [{}]\n closed endpoints", this); - return; - } - logger.error("\n [{}]\n failed to close endpoints due to ", this, future.cause()); - }); - return; - } - - logger.debug("\n [{}]\n already closed", this); - } - - @Override - public Config config() { - return this.config; - } - - @Override - public int count() { - return this.endpoints.size(); - } - - @Override - public RntbdEndpoint get(URI physicalAddress) { - return endpoints.computeIfAbsent(physicalAddress.getAuthority(), authority -> - new RntbdServiceEndpoint(config, eventLoopGroup, requestTimer, physicalAddress) - ); - } - - @Override - public Stream list() { - return this.endpoints.values().stream(); - } - - private void deleteEndpoint(final URI physicalAddress) { - - // TODO: DANOBLE: Utilize this method of tearing down unhealthy endpoints - // Specifically, ensure that this method is called when a Read/WriteTimeoutException occurs or a health - // check request fails. This perhaps likely requires a change to RntbdClientChannelPool. - // Links: - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/331552 - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/331593 - - checkNotNull(physicalAddress, "physicalAddress: %s", physicalAddress); - - final String authority = physicalAddress.getAuthority(); - final RntbdEndpoint endpoint = this.endpoints.remove(authority); - - if (endpoint != null) { - endpoint.close(); - } - } - } - - // endregion -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdToken.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdToken.java deleted file mode 100644 index 555d0338a413..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdToken.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectWriter; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.ser.PropertyWriter; -import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; -import io.netty.buffer.ByteBuf; -import io.netty.handler.codec.CorruptedFrameException; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdHeader; - -@JsonPropertyOrder({ "id", "name", "type", "present", "required", "value" }) -final class RntbdToken { - - // region Fields - - private static final int HEADER_LENGTH = Short.BYTES + Byte.BYTES; - - static { - RntbdObjectMapper.registerPropertyFilter(RntbdToken.class, RntbdToken.PropertyFilter.class); - } - - private final RntbdHeader header; - private int length; - private Object value; - - // endregion - - private RntbdToken(final RntbdHeader header) { - checkNotNull(header, "header"); - this.header = header; - this.value = null; - this.length = Integer.MIN_VALUE; - } - - @JsonProperty - final short getId() { - return this.header.id(); - } - - // region Accessors - - @JsonProperty - final String getName() { - return this.header.name(); - } - - @JsonProperty - final RntbdTokenType getType() { - return this.header.type(); - } - - @JsonProperty - final Object getValue() { - - if (this.value == null) { - return this.header.type().codec().defaultValue(); - } - - if (this.value instanceof ByteBuf) { - final ByteBuf buffer = (ByteBuf)this.value; - this.value = this.header.type().codec().read(buffer); - buffer.release(); - } else { - this.value = this.header.type().codec().convert(this.value); - } - - return this.value; - } - - @JsonProperty - final void setValue(final Object value) { - this.ensureValid(value); - this.length = Integer.MIN_VALUE; - this.value = value; - } - - @JsonProperty - final boolean isPresent() { - return this.value != null; - } - - @JsonProperty - final boolean isRequired() { - return this.header.isRequired(); - } - - final int computeLength() { - - if (!this.isPresent()) { - return 0; - } - - if (this.value instanceof ByteBuf) { - final ByteBuf buffer = (ByteBuf)this.value; - assert buffer.readerIndex() == 0; - return HEADER_LENGTH + buffer.readableBytes(); - } - - if (this.length == Integer.MIN_VALUE) { - this.length = HEADER_LENGTH + this.header.type().codec().computeLength(this.value); - } - - return this.length; - } - - // endregion - - // region Methods - - static RntbdToken create(final RntbdHeader header) { - return new RntbdToken(header); - } - - void decode(final ByteBuf in) { - - checkNotNull(in, "in"); - - if (this.value instanceof ByteBuf) { - ((ByteBuf)this.value).release(); - } - - this.value = this.header.type().codec().readSlice(in).retain(); // No data transfer until the first call to RntbdToken.getValue - } - - final void encode(final ByteBuf out) { - - checkNotNull(out, "out"); - - if (!this.isPresent()) { - if (this.isRequired()) { - final String message = String.format("Missing value for required header: %s", this); - throw new IllegalStateException(message); - } - return; - } - - out.writeShortLE(this.getId()); - out.writeByte(this.getType().id()); - - if (this.value instanceof ByteBuf) { - out.writeBytes((ByteBuf)this.value); - } else { - this.ensureValid(this.value); - this.header.type().codec().write(this.value, out); - } - } - - final T getValue(final Class cls) { - return cls.cast(this.getValue()); - } - - final void releaseBuffer() { - if (this.value instanceof ByteBuf) { - final ByteBuf buffer = (ByteBuf)this.value; - buffer.release(); - } - } - - @Override - public String toString() { - final ObjectWriter writer = RntbdObjectMapper.writer(); - try { - return writer.writeValueAsString(this); - } catch (final JsonProcessingException error) { - throw new CorruptedFrameException(error); - } - } - - private void ensureValid(final Object value) { - - checkNotNull(value, "value"); - - if (!this.header.type().codec().isValid(value)) { - final String reason = String.format("value: %s", value.getClass()); - throw new IllegalArgumentException(reason); - } - } - - // endregion - - // region Types - - static class PropertyFilter extends SimpleBeanPropertyFilter { - - @Override - public void serializeAsField(final Object object, final JsonGenerator generator, final SerializerProvider provider, final PropertyWriter writer) throws Exception { - - if (generator.canOmitFields()) { - - final Object value = writer.getMember().getValue(object); - - if (value instanceof RntbdToken && !((RntbdToken)value).isPresent()) { - return; - } - } - - writer.serializeAsField(object, generator, provider); - } - } - - // endregion -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdTokenStream.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdTokenStream.java deleted file mode 100644 index 6926876ebf54..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdTokenStream.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; -import io.netty.buffer.ByteBuf; - -import java.util.stream.Collector; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdConstants.RntbdHeader; - -abstract class RntbdTokenStream & RntbdHeader> { - - final ImmutableMap headers; - final ImmutableMap tokens; - - RntbdTokenStream(final ImmutableSet headers, final ImmutableMap ids) { - - checkNotNull(headers, "headers"); - checkNotNull(ids, "ids"); - - final Collector> collector = Maps.toImmutableEnumMap(h -> h, RntbdToken::create); - this.tokens = headers.stream().collect(collector); - this.headers = ids; - } - - final int computeCount() { - - int count = 0; - - for (final RntbdToken token : this.tokens.values()) { - if (token.isPresent()) { - ++count; - } - } - - return count; - } - - final int computeLength() { - - int total = 0; - - for (final RntbdToken token : this.tokens.values()) { - total += token.computeLength(); - } - - return total; - } - - static > T decode(final ByteBuf in, final T stream) { - - while (in.readableBytes() > 0) { - - final short id = in.readShortLE(); - final RntbdTokenType type = RntbdTokenType.fromId(in.readByte()); - - RntbdToken token = stream.tokens.get(stream.headers.get(id)); - - if (token == null) { - token = RntbdToken.create(new UndefinedHeader(id, type)); - } - - token.decode(in); - } - - for (final RntbdToken token : stream.tokens.values()) { - if (!token.isPresent() && token.isRequired()) { - final String reason = String.format("Required token not found on RNTBD stream: type: %s, identifier: %s", - token.getType(), token.getId()); - throw new IllegalStateException(reason); - } - } - - return stream; - } - - final void encode(final ByteBuf out) { - for (final RntbdToken token : this.tokens.values()) { - token.encode(out); - } - } - - final RntbdToken get(final T header) { - return this.tokens.get(header); - } - - final void releaseBuffers() { - for (final RntbdToken token : this.tokens.values()) { - token.releaseBuffer(); - } - } - - private static final class UndefinedHeader implements RntbdHeader { - - private final short id; - private final RntbdTokenType type; - - UndefinedHeader(final short id, final RntbdTokenType type) { - this.id = id; - this.type = type; - } - - @Override - public boolean isRequired() { - return false; - } - - @Override - public short id() { - return this.id; - } - - @Override - public String name() { - return "Undefined"; - } - - @Override - public RntbdTokenType type() { - return this.type; - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdTokenType.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdTokenType.java deleted file mode 100644 index c6b76693087c..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdTokenType.java +++ /dev/null @@ -1,838 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import com.google.common.base.Utf8; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; -import io.netty.handler.codec.CorruptedFrameException; - -import java.nio.charset.StandardCharsets; -import java.util.UUID; - -enum RntbdTokenType { - - // All values are encoded as little endian byte sequences except for Guid - // Guid values are serialized in Microsoft GUID byte order - // Reference: GUID structure and System.Guid type - - Byte((byte)0x00, RntbdByte.codec), // byte => byte - UShort((byte)0x01, RntbdUnsignedShort.codec), // short => int - ULong((byte)0x02, RntbdUnsignedInteger.codec), // int => long - Long((byte)0x03, RntbdInteger.codec), // int => int - ULongLong((byte)0x04, RntbdLong.codec), // long => long - LongLong((byte)0x05, RntbdLong.codec), // long => long - - Guid((byte)0x06, RntbdGuid.codec), // byte[16] => UUID - SmallString((byte)0x07, RntbdShortString.codec), // (byte, byte[0..255]) => String - String((byte)0x08, RntbdString.codec), // (short, byte[0..64KiB]) => String - ULongString((byte)0x09, RntbdLongString.codec), // (int, byte[0..2GiB-1]) => String - - SmallBytes((byte)0x0A, RntbdShortBytes.codec), // (byte, byte[0..255]) => byte[] - Bytes((byte)0x0B, RntbdBytes.codec), // (short, byte[0..64KiB]) => byte[] - ULongBytes((byte)0x0C, RntbdLongBytes.codec), // (int, byte[0..2GiB-1]) => byte[] - - Float((byte)0x0D, RntbdFloat.codec), // float => float - Double((byte)0x0E, RntbdDouble.codec), // double => double - - Invalid((byte)0xFF, RntbdNone.codec); // no data - - // region Implementation - - private Codec codec; - private byte id; - - RntbdTokenType(final byte id, final Codec codec) { - this.codec = codec; - this.id = id; - } - - public Codec codec() { - return this.codec; - } - - public static RntbdTokenType fromId(final byte value) { - - for (final RntbdTokenType tokenType : RntbdTokenType.values()) { - if (value == tokenType.id) { - return tokenType; - } - } - return Invalid; - } - - public byte id() { - return this.id; - } - - // endregion - - // region Types - - public interface Codec { - - int computeLength(Object value); - - Object convert(Object value); - - Object defaultValue(); - - boolean isValid(Object value); - - Object read(ByteBuf in); - - ByteBuf readSlice(ByteBuf in); - - void write(Object value, ByteBuf out); - } - - private static class RntbdByte implements Codec { - - public static final Codec codec = new RntbdByte(); - - private RntbdByte() { - } - - @Override - public final int computeLength(final Object value) { - return java.lang.Byte.BYTES; - } - - @Override - public final Object convert(final Object value) { - - assert this.isValid(value); - - if (value instanceof Number) { - return ((Number)value).byteValue(); - } - return (boolean)value ? (byte)0x01 : (byte)0x00; - } - - @Override - public final Object defaultValue() { - return (byte)0; - } - - @Override - public final boolean isValid(final Object value) { - return value instanceof Number || value instanceof Boolean; - } - - @Override - public final Object read(final ByteBuf in) { - return in.readByte(); - } - - @Override - public final ByteBuf readSlice(final ByteBuf in) { - return in.readSlice(java.lang.Byte.BYTES); - } - - @Override - public final void write(final Object value, final ByteBuf out) { - assert this.isValid(value); - out.writeByte(value instanceof Byte ? (byte)value : ((boolean)value ? 0x01 : 0x00)); - } - } - - private static class RntbdBytes implements Codec { - - public static final Codec codec = new RntbdBytes(); - private static final byte[] defaultValue = {}; - - private RntbdBytes() { - } - - @Override - public int computeLength(final Object value) { - assert this.isValid(value); - return Short.BYTES + ((byte[])value).length; - } - - @Override - public final Object convert(final Object value) { - assert this.isValid(value); - return value; - } - - @Override - public final Object defaultValue() { - return defaultValue; - } - - @Override - public boolean isValid(final Object value) { - return value instanceof byte[] && ((byte[])value).length < 0xFFFF; - } - - @Override - public Object read(final ByteBuf in) { - final int length = in.readUnsignedShortLE(); - return in.readBytes(length); - } - - @Override - public ByteBuf readSlice(final ByteBuf in) { - final int length = in.getUnsignedShortLE(in.readerIndex()); - return in.readSlice(Short.BYTES + length); - } - - @Override - public void write(final Object value, final ByteBuf out) { - - assert this.isValid(value); - - final byte[] bytes = (byte[])value; - final int length = bytes.length; - - if (length > 0xFFFF) { - throw new IllegalStateException(); - } - - out.writeShortLE((short)length); - out.writeBytes(bytes); - } - } - - private static class RntbdDouble implements Codec { - - public static final Codec codec = new RntbdDouble(); - - private RntbdDouble() { - } - - @Override - public final int computeLength(final Object value) { - assert this.isValid(value); - return java.lang.Double.BYTES; - } - - @Override - public final Object convert(final Object value) { - assert this.isValid(value); - return ((Number)value).doubleValue(); - } - - @Override - public final Object defaultValue() { - return 0.0D; - } - - @Override - public final boolean isValid(final Object value) { - return value instanceof Number; - } - - @Override - public final Object read(final ByteBuf in) { - return in.readDoubleLE(); - } - - @Override - public final ByteBuf readSlice(final ByteBuf in) { - return in.readSlice(java.lang.Double.BYTES); - } - - @Override - public final void write(final Object value, final ByteBuf out) { - assert this.isValid(value); - out.writeDoubleLE(((Number)value).doubleValue()); - } - } - - private static class RntbdFloat implements Codec { - - public static final Codec codec = new RntbdFloat(); - - private RntbdFloat() { - } - - @Override - public final int computeLength(final Object value) { - assert this.isValid(value); - return java.lang.Float.BYTES; - } - - @Override - public final Object convert(final Object value) { - assert this.isValid(value); - return ((Number)value).floatValue(); - } - - @Override - public final Object defaultValue() { - return 0.0F; - } - - @Override - public final boolean isValid(final Object value) { - return value instanceof Number; - } - - @Override - public final Object read(final ByteBuf in) { - return in.readFloatLE(); - } - - @Override - public final ByteBuf readSlice(final ByteBuf in) { - return in.readSlice(java.lang.Float.BYTES); - } - - @Override - public final void write(final Object value, final ByteBuf out) { - assert this.isValid(value); - out.writeFloatLE(((Number)value).floatValue()); - } - } - - private static class RntbdGuid implements Codec { - - public static final Codec codec = new RntbdGuid(); - - private RntbdGuid() { - } - - @Override - public final int computeLength(final Object value) { - assert this.isValid(value); - return 2 * java.lang.Long.BYTES; - } - - @Override - public final Object convert(final Object value) { - assert this.isValid(value); - return value; - } - - @Override - public final Object defaultValue() { - return RntbdUUID.EMPTY; - } - - @Override - public final boolean isValid(final Object value) { - return value instanceof UUID; - } - - @Override - public final Object read(final ByteBuf in) { - return RntbdUUID.decode(in); - } - - @Override - public final ByteBuf readSlice(final ByteBuf in) { - return in.readSlice(2 * java.lang.Long.BYTES); - } - - @Override - public final void write(final Object value, final ByteBuf out) { - assert this.isValid(value); - RntbdUUID.encode((UUID)value, out); - } - } - - private static class RntbdInteger implements Codec { - - public static final Codec codec = new RntbdInteger(); - - private RntbdInteger() { - } - - @Override - public final int computeLength(final Object value) { - assert this.isValid(value); - return Integer.BYTES; - } - - @Override - public final Object convert(final Object value) { - assert this.isValid(value); - return ((Number)value).intValue(); - } - - @Override - public final Object defaultValue() { - return 0; - } - - @Override - public final boolean isValid(final Object value) { - return value instanceof Number; - } - - @Override - public final Object read(final ByteBuf in) { - return in.readIntLE(); - } - - @Override - public final ByteBuf readSlice(final ByteBuf in) { - return in.readSlice(Integer.BYTES); - } - - @Override - public final void write(final Object value, final ByteBuf out) { - assert this.isValid(value); - out.writeIntLE(((Number)value).intValue()); - } - } - - private static class RntbdLong implements Codec { - - public static final Codec codec = new RntbdLong(); - - private RntbdLong() { - } - - @Override - public final int computeLength(final Object value) { - assert this.isValid(value); - return java.lang.Long.BYTES; - } - - @Override - public final Object convert(final Object value) { - assert this.isValid(value); - return ((Number)value).longValue(); - } - - @Override - public final Object defaultValue() { - return 0L; - } - - @Override - public final boolean isValid(final Object value) { - return value instanceof Number; - } - - @Override - public final Object read(final ByteBuf in) { - return in.readLongLE(); - } - - @Override - public final ByteBuf readSlice(final ByteBuf in) { - return in.readSlice(java.lang.Long.BYTES); - } - - @Override - public final void write(final Object value, final ByteBuf out) { - assert this.isValid(value); - out.writeLongLE(((Number)value).longValue()); - } - } - - private static class RntbdLongBytes extends RntbdBytes { - - public static final Codec codec = new RntbdLongBytes(); - - private RntbdLongBytes() { - } - - @Override - public final int computeLength(final Object value) { - assert this.isValid(value); - return Integer.BYTES + ((byte[])value).length; - } - - @Override - public final boolean isValid(final Object value) { - return value instanceof byte[] && ((byte[])value).length < 0xFFFF; - } - - @Override - public final Object read(final ByteBuf in) { - - final long length = in.readUnsignedIntLE(); - - if (length > Integer.MAX_VALUE) { - throw new IllegalStateException(); - } - return in.readBytes((int)length); - } - - @Override - public final ByteBuf readSlice(final ByteBuf in) { - - final long length = in.getUnsignedIntLE(in.readerIndex()); - - if (length > Integer.MAX_VALUE) { - throw new IllegalStateException(); - } - return in.readSlice(Integer.BYTES + (int)length); - } - - @Override - public final void write(final Object value, final ByteBuf out) { - - assert this.isValid(value); - - final byte[] bytes = (byte[])value; - out.writeIntLE(bytes.length); - out.writeBytes(bytes); - } - } - - private static class RntbdLongString extends RntbdString { - - public static final Codec codec = new RntbdLongString(); - - private RntbdLongString() { - } - - @Override - public final int computeLength(final Object value) { - return Integer.BYTES + this.computeLength(value, Integer.MAX_VALUE); - } - - @Override - public final Object read(final ByteBuf in) { - - final long length = in.readUnsignedIntLE(); - - if (length > Integer.MAX_VALUE) { - throw new IllegalStateException(); - } - - return in.readCharSequence((int)length, StandardCharsets.UTF_8).toString(); - } - - @Override - public final void write(final Object value, final ByteBuf out) { - - final int length = this.computeLength(value, Integer.MAX_VALUE); - out.writeIntLE(length); - writeValue(out, value, length); - } - } - - private static class RntbdNone implements Codec { - - public static final Codec codec = new RntbdNone(); - - @Override - public final int computeLength(final Object value) { - return 0; - } - - @Override - public final Object convert(final Object value) { - return null; - } - - @Override - public final Object defaultValue() { - return null; - } - - @Override - public final boolean isValid(final Object value) { - return true; - } - - @Override - public final Object read(final ByteBuf in) { - return null; - } - - @Override - public final ByteBuf readSlice(final ByteBuf in) { - return null; - } - - @Override - public final void write(final Object value, final ByteBuf out) { - } - } - - private static class RntbdShortBytes extends RntbdBytes { - - public static final Codec codec = new RntbdShortBytes(); - - private RntbdShortBytes() { - } - - @Override - public final int computeLength(final Object value) { - assert this.isValid(value); - return java.lang.Byte.BYTES + ((byte[])value).length; - } - - @Override - public final boolean isValid(final Object value) { - return value instanceof byte[] && ((byte[])value).length < 0xFFFF; - } - - @Override - public final Object read(final ByteBuf in) { - - final int length = in.readUnsignedByte(); - final byte[] bytes = new byte[length]; - in.readBytes(bytes); - - return bytes; - } - - @Override - public final ByteBuf readSlice(final ByteBuf in) { - return in.readSlice(java.lang.Byte.BYTES + in.getUnsignedByte(in.readerIndex())); - } - - @Override - public final void write(final Object value, final ByteBuf out) { - - assert this.isValid(value); - - final byte[] bytes = (byte[])value; - final int length = bytes.length; - - if (length > 0xFF) { - throw new IllegalStateException(); - } - - out.writeByte((byte)length); - out.writeBytes(bytes); - } - } - - private static class RntbdShortString extends RntbdString { - - public static final Codec codec = new RntbdShortString(); - - private RntbdShortString() { - } - - @Override - public final int computeLength(final Object value) { - return java.lang.Byte.BYTES + this.computeLength(value, 0xFF); - } - - @Override - public final Object read(final ByteBuf in) { - return in.readCharSequence(in.readUnsignedByte(), StandardCharsets.UTF_8).toString(); - } - - @Override - public final ByteBuf readSlice(final ByteBuf in) { - return in.readSlice(java.lang.Byte.BYTES + in.getUnsignedByte(in.readerIndex())); - } - - @Override - public final void write(final Object value, final ByteBuf out) { - - final int length = this.computeLength(value, 0xFF); - out.writeByte(length); - writeValue(out, value, length); - } - } - - private static class RntbdString implements Codec { - - public static final Codec codec = new RntbdString(); - - private RntbdString() { - } - - final int computeLength(final Object value, final int maxLength) { - - assert this.isValid(value); - final int length; - - if (value instanceof String) { - - final String string = (String)value; - length = Utf8.encodedLength(string); - - } else { - - final byte[] string = (byte[])value; - - if (!Utf8.isWellFormed(string)) { - final String reason = java.lang.String.format("UTF-8 byte string is ill-formed: %s", ByteBufUtil.hexDump(string)); - throw new CorruptedFrameException(reason); - } - - length = string.length; - } - - if (length > maxLength) { - final String reason = java.lang.String.format("UTF-8 byte string exceeds %d bytes: %d bytes", maxLength, length); - throw new CorruptedFrameException(reason); - } - - return length; - } - - @Override - public int computeLength(final Object value) { - return Short.BYTES + this.computeLength(value, 0xFFFF); - } - - @Override - public final Object convert(final Object value) { - assert this.isValid(value); - return value instanceof String ? value : new String((byte[])value, StandardCharsets.UTF_8); - } - - @Override - public final Object defaultValue() { - return ""; - } - - @Override - public final boolean isValid(final Object value) { - return value instanceof String || value instanceof byte[]; - } - - @Override - public Object read(final ByteBuf in) { - final int length = in.readUnsignedShortLE(); - return in.readCharSequence(length, StandardCharsets.UTF_8).toString(); - } - - @Override - public ByteBuf readSlice(final ByteBuf in) { - return in.readSlice(Short.BYTES + in.getUnsignedShortLE(in.readerIndex())); - } - - @Override - public void write(final Object value, final ByteBuf out) { - - final int length = this.computeLength(value, 0xFFFF); - out.writeShortLE(length); - writeValue(out, value, length); - } - - static void writeValue(final ByteBuf out, final Object value, final int length) { - - final int start = out.writerIndex(); - - if (value instanceof String) { - out.writeCharSequence((String)value, StandardCharsets.UTF_8); - } else { - out.writeBytes((byte[])value); - } - - assert out.writerIndex() - start == length; - } - } - - private static class RntbdUnsignedInteger implements Codec { - - public static final Codec codec = new RntbdUnsignedInteger(); - - private RntbdUnsignedInteger() { - } - - @Override - public final int computeLength(final Object value) { - assert this.isValid(value); - return Integer.BYTES; - } - - @Override - public final Object convert(final Object value) { - assert this.isValid(value); - return ((Number)value).longValue() & 0xFFFFFFFFL; - } - - @Override - public final Object defaultValue() { - return 0L; - } - - @Override - public final boolean isValid(final Object value) { - return value instanceof Number; - } - - @Override - public final Object read(final ByteBuf in) { - return in.readUnsignedIntLE(); - } - - @Override - public final ByteBuf readSlice(final ByteBuf in) { - return in.readSlice(Integer.BYTES); - } - - @Override - public final void write(final Object value, final ByteBuf out) { - assert this.isValid(value); - out.writeIntLE(((Number)value).intValue()); - } - } - - private static class RntbdUnsignedShort implements Codec { - - public static final Codec codec = new RntbdUnsignedShort(); - - private RntbdUnsignedShort() { - } - - @Override - public final int computeLength(final Object value) { - assert this.isValid(value); - return Short.BYTES; - } - - @Override - public final Object convert(final Object value) { - assert this.isValid(value); - return ((Number)value).intValue() & 0xFFFF; - } - - @Override - public final Object defaultValue() { - return 0; - } - - @Override - public final boolean isValid(final Object value) { - return value instanceof Number; - } - - @Override - public final Object read(final ByteBuf in) { - return in.readUnsignedShortLE(); - } - - @Override - public final ByteBuf readSlice(final ByteBuf in) { - return in.readSlice(Short.BYTES); - } - - @Override - public final void write(final Object value, final ByteBuf out) { - assert this.isValid(value); - out.writeShortLE(((Number)value).shortValue()); - } - } - - // endregion -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdUUID.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdUUID.java deleted file mode 100644 index 20c9f1233528..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/rntbd/RntbdUUID.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.handler.codec.CorruptedFrameException; - -import java.util.UUID; - -import static com.google.common.base.Preconditions.checkNotNull; - -public final class RntbdUUID { - - public static final UUID EMPTY = new UUID(0L, 0L); - - private RntbdUUID() { - } - - /** - * Decode a {@link UUID} as serialized by Microsoft APIs like {@code System.Guid.ToByteArray} - * - * @param bytes a {@link byte} array containing the serialized {@link UUID} to be decoded - * @return a new {@link UUID} - */ - public static UUID decode(final byte[] bytes) { - return decode(Unpooled.wrappedBuffer(bytes)); - } - - /** - * Decode a {@link UUID} as serialized by Microsoft APIs like {@code System.Guid.ToByteArray} - * - * @param in a {@link ByteBuf} containing the serialized {@link UUID} to be decoded - * @return a new {@link UUID} - */ - public static UUID decode(final ByteBuf in) { - - checkNotNull(in, "in"); - - if (in.readableBytes() < 2 * Long.BYTES) { - final String reason = String.format("invalid frame length: %d", in.readableBytes()); - throw new CorruptedFrameException(reason); - } - - long mostSignificantBits = in.readUnsignedIntLE() << 32; - - mostSignificantBits |= (0x000000000000FFFFL & in.readShortLE()) << 16; - mostSignificantBits |= (0x000000000000FFFFL & in.readShortLE()); - - long leastSignificantBits = (0x000000000000FFFFL & in.readShortLE()) << (32 + 16); - - for (int shift = 32 + 8; shift >= 0; shift -= 8) { - leastSignificantBits |= (0x00000000000000FFL & in.readByte()) << shift; - } - - return new UUID(mostSignificantBits, leastSignificantBits); - } - - /** - * Encodes a {@link UUID} as serialized by Microsoft APIs like {@code System.Guid.ToByteArray} - * - * @param uuid a {@link UUID} to be encoded - * @return a new byte array containing the encoded - */ - public static byte[] encode(final UUID uuid) { - final byte[] bytes = new byte[2 * Integer.BYTES]; - encode(uuid, Unpooled.wrappedBuffer(bytes)); - return bytes; - } - - /** - * Encodes a {@link UUID} as serialized by Microsoft APIs like {@code System.Guid.ToByteArray} - * - * @param uuid a {@link UUID} to be encoded - * @param out an output {@link ByteBuf} - */ - public static void encode(final UUID uuid, final ByteBuf out) { - - final long mostSignificantBits = uuid.getMostSignificantBits(); - - out.writeIntLE((int)((mostSignificantBits & 0xFFFFFFFF00000000L) >>> 32)); - out.writeShortLE((short)((mostSignificantBits & 0x00000000FFFF0000L) >>> 16)); - out.writeShortLE((short)(mostSignificantBits & 0x000000000000FFFFL)); - - final long leastSignificantBits = uuid.getLeastSignificantBits(); - - out.writeShortLE((short)((leastSignificantBits & 0xFFFF000000000000L) >>> (32 + 16))); - out.writeShort((short)((leastSignificantBits & 0x0000FFFF00000000L) >>> 32)); - out.writeInt((int)(leastSignificantBits & 0x00000000FFFFFFFFL)); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/Int128.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/Int128.java deleted file mode 100644 index c74a4ff99a01..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/Int128.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - - -import java.math.BigInteger; - -public class Int128 { - - private final BigInteger value; - - private static final BigInteger MaxBigIntValue = - new BigInteger(new byte[] { - (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, - (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 - }); - - public static final Int128 MaxValue = new Int128( - new BigInteger(new byte[] { - (byte) 0x7F, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, - (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, - }) - ); - - private Int128(BigInteger value) { - this.value = value.remainder(MaxBigIntValue); - } - - public Int128(int n) { - this(BigInteger.valueOf(n)); - } - - public Int128(byte[] data) { - if (data.length != 16) { - throw new IllegalArgumentException("data"); - } - - this.value = new BigInteger(data); - - if (this.value.compareTo(MaxValue.value) > 0) { - throw new IllegalArgumentException(); - } - } - - public static Int128 multiply(Int128 left, Int128 right) { - return new Int128(left.value.multiply(right.value)); - } - - public static Int128 add(Int128 left, Int128 right) { - return new Int128(left.value.add(right.value)); - } - - public static Int128 subtract(Int128 left, Int128 right) { - return new Int128(left.value.subtract(right.value)); - } - - public static Int128 div (Int128 left, Int128 right) { - return new Int128(left.value.divide(right.value)); - } - - public static boolean gt(Int128 left, Int128 right) { - return left.value.compareTo(right.value) > 0; - } - - public static boolean lt(Int128 left, Int128 right) { - return left.value.compareTo(right.value) < 0; - } - - public byte[] bytes() { - byte[] bytes = this.value.toByteArray(); - if (bytes.length < 16) { - byte[] paddedBytes = new byte[16]; - System.arraycopy(bytes, 0, paddedBytes, 0, bytes.length); - return paddedBytes; - } - - return bytes; - } - -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MurmurHash3_128.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MurmurHash3_128.java deleted file mode 100644 index 06224c795a64..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MurmurHash3_128.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -public class MurmurHash3_128 { - - public static UInt128 hash128(byte[] bytes) { - return hash128(bytes, bytes.length, new UInt128(0, 0)); - } - - public static UInt128 hash128(byte[] bytes, int length, UInt128 seed) { - final long c1 = 0x87c37b91114253d5L; - final long c2 = 0x4cf5ad432745937fL; - - long h1 = seed.high; - long h2 = seed.low; - - // body - int position; - for (position = 0; position < length - 15; position += 16) { - long k1 = getLittleEndianLong(bytes, position); - long k2 = getLittleEndianLong(bytes, position + 8); - - // k1, h1 - k1 *= c1; - k1 = rotateLeft64(k1, 31); - k1 *= c2; - - h1 ^= k1; - h1 = rotateLeft64(h1, 27); - h1 += h2; - h1 = h1 * 5 + 0x52dce729; - - // k2, h2 - k2 *= c2; - k2 = rotateLeft64(k2, 33); - k2 *= c1; - - h2 ^= k2; - h2 = rotateLeft64(h2, 31); - h2 += h1; - h2 = h2 * 5 + 0x38495ab5; - } - - - { - // tail - long k1 = 0; - long k2 = 0; - - int n = length & 15; - if (n >= 15) k2 ^= (bytes[position + 14] & 0xffL) << 48; - if (n >= 14) k2 ^= (bytes[position + 13] & 0xffL) << 40; - if (n >= 13) k2 ^= (bytes[position + 12] & 0xffL) << 32; - if (n >= 12) k2 ^= (bytes[position + 11] & 0xffL) << 24; - if (n >= 11) k2 ^= (bytes[position + 10] & 0xffL) << 16; - if (n >= 10) k2 ^= (bytes[position + 9] & 0xffL) << 8; - if (n >= 9) k2 ^= (bytes[position + 8] & 0xffL) << 0; - - k2 *= c2; - k2 = rotateLeft64(k2, 33); - k2 *= c1; - h2 ^= k2; - - if (n >= 8) k1 ^= (bytes[position + 7] & 0xffL) << 56; - if (n >= 7) k1 ^= (bytes[position + 6] & 0xffL) << 48; - if (n >= 6) k1 ^= (bytes[position + 5] & 0xffL) << 40; - if (n >= 5) k1 ^= (bytes[position + 4] & 0xffL) << 32; - if (n >= 4) k1 ^= (bytes[position + 3] & 0xffL) << 24; - if (n >= 3) k1 ^= (bytes[position + 2] & 0xffL) << 16; - if (n >= 2) k1 ^= (bytes[position + 1] & 0xffL) << 8; - if (n >= 1) k1 ^= (bytes[position + 0] & 0xffL) << 0; - - k1 *= c1; - k1 = rotateLeft64(k1, 31); - k1 *= c2; - h1 ^= k1; - } - - // finalization - h1 ^= length; - h2 ^= length; - - h1 += h2; - h2 += h1; - - // h1 - h1 ^= h1 >>> 33; - h1 *= 0xff51afd7ed558ccdL; - h1 ^= h1 >>> 33; - h1 *= 0xc4ceb9fe1a85ec53L; - h1 ^= h1 >>> 33; - - // h2 - h2 ^= h2 >>> 33; - h2 *= 0xff51afd7ed558ccdL; - h2 ^= h2 >>> 33; - h2 *= 0xc4ceb9fe1a85ec53L; - h2 ^= h2 >>> 33; - - h1 += h2; - h2 += h1; - - h1 = Long.reverseBytes(h1); - h2 = Long.reverseBytes(h2); - - return new UInt128(h1, h2); - } - - - private static int rotateLeft32(int n, int numBits) { - assert numBits < 32; - return Integer.rotateLeft(n, numBits); - } - - private static long rotateLeft64(long n, int numBits) { - assert numBits < 64; - return Long.rotateLeft(n, numBits); - } - - private static final long getLittleEndianLong(byte[] bytes, int offset) { - return ((long) bytes[offset + 7] << 56) // no mask needed - | ((bytes[offset + 6] & 0xffL) << 48) - | ((bytes[offset + 5] & 0xffL) << 40) - | ((bytes[offset + 4] & 0xffL) << 32) - | ((bytes[offset + 3] & 0xffL) << 24) - | ((bytes[offset + 2] & 0xffL) << 16) - | ((bytes[offset + 1] & 0xffL) << 8) - | ((bytes[offset] & 0xffL)); - } - - private static int intAsLittleIndian(byte[] bytes, int i) { - return (bytes[i] & 0xff) | ((bytes[i + 1] & 0xff) << 8) | ((bytes[i + 2] & 0xff) << 16) | (bytes[i + 3] << 24); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MurmurHash3_32.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MurmurHash3_32.java deleted file mode 100644 index e92cb2e41187..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/MurmurHash3_32.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -/* - * The MurmurHash3 algorithm was created by Austin Appleby and placed in the public domain. - * This java port was authored by Yonik Seeley and also placed into the public domain. - * The author hereby disclaims copyright to this source code. - *

- * This produces exactly the same hash values as the final C++ - * version of MurmurHash3 and is thus suitable for producing the same hash values across - * platforms. - *

- * The 32 bit x86 version of this hash should be the fastest variant for relatively short keys like ids. - * See http://github.com/yonik/java_util for future updates to this file. - */ -public class MurmurHash3_32 { - /** - * Returns the MurmurHash3_x86_32 hash. - * - * @param data a byte array containing the data to be hashed - * @param len an integer indicating the length of data - * @param seed an integer to be used as hash seed - * @return the hash value - */ - public static int hash(byte[] data, int len, int seed) { - final int c1 = 0xcc9e2d51; - final int c2 = 0x1b873593; - - int h1 = seed; - int roundedEnd = (len & 0xfffffffc); // round down to 4 byte block - - for (int i = 0; i < roundedEnd; i += 4) { - // little endian load order - int k1 = (data[i] & 0xff) | ((data[i + 1] & 0xff) << 8) | ((data[i + 2] & 0xff) << 16) | (data[i + 3] << 24); - k1 *= c1; - k1 = (k1 << 15) | (k1 >>> 17); // ROTL32(k1,15); - k1 *= c2; - - h1 ^= k1; - h1 = (h1 << 13) | (h1 >>> 19); // ROTL32(h1,13); - h1 = h1 * 5 + 0xe6546b64; - } - - // tail - int k1 = 0; - - switch (len & 0x03) { - case 3: - k1 = (data[roundedEnd + 2] & 0xff) << 16; - // fallthrough - case 2: - k1 |= (data[roundedEnd + 1] & 0xff) << 8; - // fallthrough - case 1: - k1 |= (data[roundedEnd] & 0xff); - k1 *= c1; - k1 = (k1 << 15) | (k1 >>> 17); // ROTL32(k1,15); - k1 *= c2; - h1 ^= k1; - } - - // finalization - h1 ^= len; - - // fmix(h1); - h1 ^= h1 >>> 16; - h1 *= 0x85ebca6b; - h1 ^= h1 >>> 13; - h1 *= 0xc2b2ae35; - h1 ^= h1 >>> 16; - - return h1; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyInternalHelper.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyInternalHelper.java deleted file mode 100644 index 316f6e87dc35..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyInternalHelper.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import com.microsoft.azure.cosmosdb.CommonsBridgeInternal; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.PartitionKind; -import com.microsoft.azure.cosmosdb.internal.Bytes; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.nio.ByteBuffer; -import java.util.List; - -public class PartitionKeyInternalHelper { - - public static final String MinimumInclusiveEffectivePartitionKey = PartitionKeyInternalHelper.toHexEncodedBinaryString(PartitionKeyInternal.EmptyPartitionKey.components); - public static final String MaximumExclusiveEffectivePartitionKey = PartitionKeyInternalHelper.toHexEncodedBinaryString(PartitionKeyInternal.InfinityPartitionKey.components); - - static final int MaxPartitionKeyBinarySize = - (1 /*type marker */ + - 9 /* hash value*/ + - 1 /* type marker*/ + StringPartitionKeyComponent.MAX_STRING_BYTES_TO_APPEND + - 1 /*trailing zero*/ - ) * 3; - private static final Int128 MaxHashV2Value = new Int128(new byte[] { - (byte) 0x3F, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, - (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF}); - - static byte[] uIntToBytes(UInt128 unit) { - ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES * 2); - buffer.putLong(unit.low); - buffer.putLong(unit.high); - return buffer.array(); - } - - static long asUnsignedLong(int x) { - return x & 0x00000000ffffffffL; - } - - static byte[] longToBytes(long x) { - ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES); - buffer.putLong(x); - return buffer.array(); - } - - static String toHexEncodedBinaryString(IPartitionKeyComponent... components) { - ByteArrayOutputStream stream = new ByteArrayOutputStream(MaxPartitionKeyBinarySize); - for (IPartitionKeyComponent component: components) { - component.WriteForBinaryEncoding(stream); - } - - return HexConvert.bytesToHex(stream.toByteArray()); - } - - static String toHexEncodedBinaryString(List components) { - ByteArrayOutputStream stream = new ByteArrayOutputStream(MaxPartitionKeyBinarySize); - for (IPartitionKeyComponent component: components) { - component.WriteForBinaryEncoding(stream); - } - - return HexConvert.bytesToHex(stream.toByteArray()); - } - - static public String getEffectivePartitionKeyForHashPartitioningV2(PartitionKeyInternal partitionKeyInternal) { - try(ByteArrayOutputStream byteArrayBuffer = new ByteArrayOutputStream()) { - for (int i = 0; i < partitionKeyInternal.components.size(); i++) { - partitionKeyInternal.components.get(i).WriteForHashingV2(byteArrayBuffer); - } - - byte[] bytes = byteArrayBuffer.toByteArray(); - UInt128 hashAsUnit128 = MurmurHash3_128.hash128(bytes); - - byte[] hash = uIntToBytes(hashAsUnit128); - Bytes.reverse(hash); - - // Reset 2 most significant bits, as max exclusive value is 'FF'. - // Plus one more just in case. - hash[0] &= 0x3F; - - return HexConvert.bytesToHex(hash); - } catch (IOException e) { - throw new IllegalArgumentException(e); - } - } - - static String getEffectivePartitionKeyForHashPartitioning(PartitionKeyInternal partitionKeyInternal) { - IPartitionKeyComponent[] truncatedComponents = new IPartitionKeyComponent[partitionKeyInternal.components.size()]; - - for (int i = 0; i < truncatedComponents.length; i++) { - truncatedComponents[i] = partitionKeyInternal.components.get(i).Truncate(); - } - - double hash; - try(ByteArrayOutputStream byteArrayBuffer = new ByteArrayOutputStream()) { - for (int i = 0; i < truncatedComponents.length; i++) { - truncatedComponents[i].WriteForHashing(byteArrayBuffer); - } - - byte[] bytes = byteArrayBuffer.toByteArray(); - int hashAsInt = MurmurHash3_32.hash(bytes, bytes.length, 0); - hash = (double) asUnsignedLong(hashAsInt); - } catch (IOException e) { - throw new IllegalArgumentException(e); - } - - IPartitionKeyComponent[] partitionKeyComponents = new IPartitionKeyComponent[partitionKeyInternal.components.size() + 1]; - partitionKeyComponents[0] = new NumberPartitionKeyComponent(hash); - for (int i = 0; i < truncatedComponents.length; i++) { - partitionKeyComponents[i + 1] = truncatedComponents[i]; - } - - return toHexEncodedBinaryString(partitionKeyComponents); - } - - public static String getEffectivePartitionKeyString(PartitionKeyInternal partitionKeyInternal, PartitionKeyDefinition partitionKeyDefinition) { - return getEffectivePartitionKeyString(partitionKeyInternal, partitionKeyDefinition, true); - } - - public static String getEffectivePartitionKeyString(PartitionKeyInternal partitionKeyInternal, PartitionKeyDefinition partitionKeyDefinition, boolean strict) { - if (partitionKeyInternal.equals(PartitionKeyInternal.EmptyPartitionKey)) { - return MinimumInclusiveEffectivePartitionKey; - } - - if (partitionKeyInternal.equals(PartitionKeyInternal.InfinityPartitionKey)) { - return MaximumExclusiveEffectivePartitionKey; - } - - if (partitionKeyInternal.components.size() < partitionKeyDefinition.getPaths().size()) { - throw new IllegalArgumentException(RMResources.TooFewPartitionKeyComponents); - } - - if (partitionKeyInternal.components.size() > partitionKeyDefinition.getPaths().size() && strict) { - throw new IllegalArgumentException(RMResources.TooManyPartitionKeyComponents); - } - - PartitionKind kind = partitionKeyDefinition.getKind(); - if (kind == null) { - kind = PartitionKind.Hash; - } - - switch (kind) { - case Hash: - if (CommonsBridgeInternal.isV2(partitionKeyDefinition)) { - // V2 - return getEffectivePartitionKeyForHashPartitioningV2(partitionKeyInternal); - } else { - // V1 - return getEffectivePartitionKeyForHashPartitioning(partitionKeyInternal); - } - - default: - return toHexEncodedBinaryString(partitionKeyInternal.components); - } - } - - static class HexConvert { - final protected static char[] hexArray = "0123456789ABCDEF".toCharArray(); - - public static String bytesToHex(byte[] bytes) { - char[] hexChars = new char[bytes.length * 2]; - for (int j = 0; j < bytes.length; j++) { - int v = bytes[j] & 0xFF; - hexChars[j * 2] = hexArray[v >>> 4]; - hexChars[j * 2 + 1] = hexArray[v & 0x0F]; - } - return new String(hexChars); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/UInt128.java b/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/UInt128.java deleted file mode 100644 index 4241b78cd705..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/UInt128.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -class UInt128 { - long low; - long high; - - UInt128(long x, long y) { - this.low = x; - this.high = y; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/PartitionKeyHashingTests.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/PartitionKeyHashingTests.java deleted file mode 100644 index 72b83febf422..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/PartitionKeyHashingTests.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.microsoft.azure.cosmosdb; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -import org.testng.annotations.Test; - -import com.fasterxml.jackson.databind.node.NullNode; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternalHelper; - -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; - -public class PartitionKeyHashingTests { - - @Test(groups = "unit") - public void effectivePartitionKeyHashV1() { - HashMap keyToEffectivePartitionKeyString = new HashMap() {{ - put("", "05C1CF33970FF80800"); - put("partitionKey", "05C1E1B3D9CD2608716273756A756A706F4C667A00"); - put(new String(new char[1024]).replace("\0", "a"), "05C1EB5921F706086262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626262626200"); - put(null, "05C1ED45D7475601"); - put(NullNode.getInstance(), "05C1ED45D7475601"); - put(Undefined.Value(), "05C1D529E345DC00"); - put(true, "05C1D7C5A903D803"); - put(false, "05C1DB857D857C02"); - put(Byte.MIN_VALUE, "05C1D73349F54C053FA0"); - put(Byte.MAX_VALUE, "05C1DD539DDFCC05C05FE0"); - put(Long.MIN_VALUE, "05C1DB35F33D1C053C20"); - put(Long.MAX_VALUE, "05C1B799AB2DD005C3E0"); - put(Integer.MIN_VALUE, "05C1DFBF252BCC053E20"); - put(Integer.MAX_VALUE, "05C1E1F503DFB205C1DFFFFFFFFC"); - put(Double.MIN_VALUE, "05C1E5C91F4D3005800101010101010102"); - put(Double.MAX_VALUE, "05C1CBE367C53005FFEFFFFFFFFFFFFFFE"); - }}; - - for (Map.Entry entry : keyToEffectivePartitionKeyString.entrySet()) { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - partitionKeyDef.setKind(PartitionKind.Hash); - partitionKeyDef.setPaths(Arrays.asList(new String[]{"\\id"})); - String actualEffectiveKeyString = PartitionKeyInternalHelper.getEffectivePartitionKeyString(new PartitionKey(entry.getKey()).getInternalPartitionKey(),partitionKeyDef, true); - assertThat(entry.getValue()).isEqualTo(actualEffectiveKeyString); - } - } - - @Test(groups = "unit") - public void effectivePartitionKeyHashV2() { - HashMap keyToEffectivePartitionKeyString = new HashMap() {{ - put("", "32E9366E637A71B4E710384B2F4970A0"); - put("partitionKey", "013AEFCF77FA271571CF665A58C933F1"); - put(new String(new char[1024]).replace("\0", "a"), "332BDF5512AE49615F32C7D98C2DB86C"); - put(null, "378867E4430E67857ACE5C908374FE16"); - put(NullNode.getInstance(), "378867E4430E67857ACE5C908374FE16"); - put(Undefined.Value(), "11622DAA78F835834610ABE56EFF5CB5"); - put(true, "0E711127C5B5A8E4726AC6DD306A3E59"); - put(false, "2FE1BE91E90A3439635E0E9E37361EF2"); - put(Byte.MIN_VALUE, "01DAEDABF913540367FE219B2AD06148"); - put(Byte.MAX_VALUE, "0C507ACAC853ECA7977BF4CEFB562A25"); - put(Long.MIN_VALUE, "23D5C6395512BDFEAFADAD15328AD2BB"); - put(Long.MAX_VALUE, "2EDB959178DFCCA18983F89384D1629B"); - put(Integer.MIN_VALUE, "0B1660D5233C3171725B30D4A5F4CC1F"); - put(Integer.MAX_VALUE, "2D9349D64712AEB5EB1406E2F0BE2725"); - put(Double.MIN_VALUE, "0E6CBA63A280927DE485DEF865800139"); - put(Double.MAX_VALUE, "31424D996457102634591FF245DBCC4D"); - }}; - - for (Map.Entry entry : keyToEffectivePartitionKeyString.entrySet()) { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - partitionKeyDef.setKind(PartitionKind.Hash); - partitionKeyDef.setVersion(PartitionKeyDefinitionVersion.V2); - partitionKeyDef.setPaths(Arrays.asList(new String[]{"\\id"})); - String actualEffectiveKeyString = PartitionKeyInternalHelper.getEffectivePartitionKeyString(new PartitionKey(entry.getKey()).getInternalPartitionKey(),partitionKeyDef, true); - assertThat(entry.getValue()).isEqualTo(actualEffectiveKeyString); - } - } - - @Test(groups = "unit") - public void hashV2PartitionKeyDeserialization() { - String partitionKeyDefinitionStr = "{\"paths\":[\"/pk\"],\"kind\":\"Hash\",\"version\":2}"; - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(partitionKeyDefinitionStr); - assertThat(partitionKeyDef.getVersion()).isEqualTo(PartitionKeyDefinitionVersion.V2); - assertThat(partitionKeyDef.getKind()).isEqualTo(PartitionKind.Hash); - assertThat(partitionKeyDef.getPaths().toArray()[0]).isEqualTo("/pk"); - } - - @Test(groups = "unit") - public void hashV1PartitionKeyDeserialization() { - String partitionKeyDefinitionStr = "{\"paths\":[\"/pk\"],\"kind\":\"Hash\"}"; - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(partitionKeyDefinitionStr); - assertThat(partitionKeyDef.getVersion()).isNull(); - assertThat(partitionKeyDef.getKind()).isEqualTo(PartitionKind.Hash); - assertThat(partitionKeyDef.getPaths().toArray()[0]).isEqualTo("/pk"); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressResolverTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressResolverTest.java deleted file mode 100644 index 4c1fadafdeca..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressResolverTest.java +++ /dev/null @@ -1,1008 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.routing.CollectionRoutingMap; -import com.microsoft.azure.cosmosdb.internal.routing.IServerIdentity; -import com.microsoft.azure.cosmosdb.internal.routing.InMemoryCollectionRoutingMap; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternalHelper; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import com.microsoft.azure.cosmosdb.rx.internal.ICollectionRoutingMapCache; -import com.microsoft.azure.cosmosdb.rx.internal.InvalidPartitionException; -import com.microsoft.azure.cosmosdb.rx.internal.NotFoundException; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxCollectionCache; -import org.apache.commons.lang3.NotImplementedException; -import org.apache.commons.lang3.ObjectUtils; -import org.apache.commons.lang3.mutable.MutableObject; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import rx.Single; -import rx.functions.Func1; - -import java.net.URI; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; -import static org.assertj.core.api.AssertionsForClassTypes.fail; - -/** - * Tests that partition manager correctly resolves addresses for requests and does appropriate number of cache refreshes. - */ -public class AddressResolverTest { - - private static final Logger logger = LoggerFactory.getLogger(AddressResolverTest.class); - private static final String DOCUMENT_TEST_URL = "dbs/IXYFAA==/colls/IXYFAOHEBPM=/docs/IXYFAOHEBPMBAAAAAAAAAA==/"; - private AddressResolver addressResolver; - private RxCollectionCache collectionCache; - private ICollectionRoutingMapCache collectionRoutingMapCache; - private IAddressCache fabricAddressCache; - - private int collectionCacheRefreshedCount; - private Map routingMapRefreshCount; - private Map addressesRefreshCount; - - @BeforeClass(groups = "unit") - public void setup() throws Exception { - this.addressResolver = new AddressResolver(); - this.collectionCache = Mockito.mock(RxCollectionCache.class); - this.collectionRoutingMapCache = Mockito.mock(ICollectionRoutingMapCache.class); - this.fabricAddressCache = Mockito.mock(IAddressCache.class); - this.addressResolver.initializeCaches(this.collectionCache, this.collectionRoutingMapCache, this.fabricAddressCache); - - this.collection1 = new DocumentCollection(); - this.collection1.setId("coll"); - this.collection1.setResourceId("rid1"); - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - partitionKeyDef.setPaths(ImmutableList.of("/field1")); - this.collection1.setPartitionKey(partitionKeyDef); - - this.collection2 = new DocumentCollection(); - this.collection2.setId("coll"); - this.collection2.setResourceId("rid2"); - new PartitionKeyDefinition(); - partitionKeyDef.setPaths(ImmutableList.of("/field1")); - this.collection2.setPartitionKey(partitionKeyDef); - - Func1>, Void> addPartitionKeyRangeFunc = listArg -> { - listArg.forEach(tuple -> ((ServiceIdentity) tuple.right).partitionKeyRangeIds.add(new PartitionKeyRangeIdentity(collection1.getResourceId(), tuple.left.getId()))); - return null; - }; - - List> rangesBeforeSplit1 = - new ArrayList<>(); - ServiceIdentity serverServiceIdentity = new ServiceIdentity("federation1", new URI("fabric://serverservice1"), false); - - rangesBeforeSplit1.add( - ImmutablePair.of(new PartitionKeyRange("0", PartitionKeyInternalHelper.MinimumInclusiveEffectivePartitionKey, - PartitionKeyInternalHelper.MaximumExclusiveEffectivePartitionKey), serverServiceIdentity)); - - addPartitionKeyRangeFunc.call(rangesBeforeSplit1); - - - this.routingMapCollection1BeforeSplit = - InMemoryCollectionRoutingMap.tryCreateCompleteRoutingMap( - rangesBeforeSplit1, - collection1.getResourceId()); - - List> rangesAfterSplit1 = - new ArrayList<>(); - ServiceIdentity serverServiceIdentity2 = new ServiceIdentity("federation1", new URI("fabric://serverservice2"), false); - ServiceIdentity serverServiceIdentity3 = new ServiceIdentity("federation1", new URI("fabric://serverservice3"), false); - - rangesAfterSplit1.add( - ImmutablePair.of( - new PartitionKeyRange("1", PartitionKeyInternalHelper.MinimumInclusiveEffectivePartitionKey, "5E", ImmutableList.of("0")), - serverServiceIdentity2)); - - rangesAfterSplit1.add( - ImmutablePair.of( - new PartitionKeyRange("2", "5E", PartitionKeyInternalHelper.MaximumExclusiveEffectivePartitionKey, ImmutableList.of("0")), - serverServiceIdentity3)); - - addPartitionKeyRangeFunc.call(rangesAfterSplit1); - - this.routingMapCollection1AfterSplit = InMemoryCollectionRoutingMap.tryCreateCompleteRoutingMap(rangesAfterSplit1, collection1.getResourceId()); - - List> rangesBeforeSplit2 = - new ArrayList<>(); - ServiceIdentity serverServiceIdentity4 = new ServiceIdentity("federation1", new URI("fabric://serverservice4"), false); - - rangesBeforeSplit2.add( - ImmutablePair.of( - new PartitionKeyRange("0", PartitionKeyInternalHelper.MinimumInclusiveEffectivePartitionKey, PartitionKeyInternalHelper.MaximumExclusiveEffectivePartitionKey), - serverServiceIdentity4)); - - addPartitionKeyRangeFunc.call(rangesBeforeSplit2); - - - this.routingMapCollection2BeforeSplit = InMemoryCollectionRoutingMap.tryCreateCompleteRoutingMap(rangesBeforeSplit2, collection2.getResourceId()); - - List> rangesAfterSplit2 = - new ArrayList<>(); - - ServiceIdentity serverServiceIdentity5 = new ServiceIdentity("federation1", new URI("fabric://serverservice5"), false); - ServiceIdentity serverServiceIdentity6 = new ServiceIdentity("federation1", new URI("fabric://serverservice6"), false); - rangesAfterSplit2.add( - ImmutablePair.of( - new PartitionKeyRange("1", PartitionKeyInternalHelper.MinimumInclusiveEffectivePartitionKey, "5E", ImmutableList.of("0")), - serverServiceIdentity5)); - - rangesAfterSplit2.add( - ImmutablePair.of( - new PartitionKeyRange("2", "5E", PartitionKeyInternalHelper.MaximumExclusiveEffectivePartitionKey, ImmutableList.of("0")), - serverServiceIdentity6)); - - - addPartitionKeyRangeFunc.call(rangesAfterSplit2); - - - this.routingMapCollection2AfterSplit = InMemoryCollectionRoutingMap.tryCreateCompleteRoutingMap(rangesAfterSplit2, collection2.getResourceId()); - } - - private void TestCacheRefreshWhileRouteByPartitionKey( - DocumentCollection collectionBeforeRefresh, - DocumentCollection collectionAfterRefresh, - Map routingMapBeforeRefresh, - Map routingMapAfterRefresh, - Map addressesBeforeRefresh, - Map addressesAfterRefresh, - AddressInformation[] targetAddresses, - ServiceIdentity targetServiceIdentity, - PartitionKeyRange targetPartitionKeyRange, - boolean forceNameCacheRefresh, - boolean forceRoutingMapRefresh, - boolean forceAddressRefresh, - int collectionCacheRefreshed, - int routingMapCacheRefreshed, - int addressCacheRefreshed, - boolean nameBased) throws Exception { - - if (targetServiceIdentity != null && targetPartitionKeyRange != null) { - targetServiceIdentity.partitionKeyRangeIds.add(new PartitionKeyRangeIdentity(collectionAfterRefresh != null ? collectionAfterRefresh.getResourceId() : collectionBeforeRefresh.getResourceId(), targetPartitionKeyRange.getId())); - } - - this.initializeMocks( - collectionBeforeRefresh, - collectionAfterRefresh, - routingMapBeforeRefresh, - routingMapAfterRefresh, - addressesBeforeRefresh, - addressesAfterRefresh); - - RxDocumentServiceRequest request; - if (nameBased) { - request = RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.Document, - "dbs/db/colls/coll/docs/doc1", - new HashMap<>()); - } else { - request = RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.Document, - DOCUMENT_TEST_URL, - new HashMap<>()); - } - - request.forceNameCacheRefresh = forceNameCacheRefresh; - request.forcePartitionKeyRangeRefresh = forceRoutingMapRefresh; - request.getHeaders().put(HttpConstants.HttpHeaders.PARTITION_KEY, new PartitionKey("foo").toString()); - AddressInformation[] resolvedAddresses = null; - try { - resolvedAddresses = this.addressResolver.resolveAsync(request, forceAddressRefresh).toBlocking().value(); - } catch (RuntimeException e) { - throw (Exception) e.getCause(); - } finally { - assertThat(collectionCacheRefreshed).isEqualTo(collectionCacheRefreshedCount).describedAs("collection cache refresh count mismath"); - - assertThat(routingMapCacheRefreshed).isEqualTo(routingMapRefreshCount.values().stream().mapToInt(v -> v).sum()).describedAs("routing map cache refresh count mismath"); - assertThat(addressCacheRefreshed).isEqualTo(addressesRefreshCount.values().stream().mapToInt(v -> v).sum()).describedAs("address cache refresh count mismatch"); - assertThat(routingMapRefreshCount.entrySet().stream().filter(pair -> pair.getValue() > 1).count()).isEqualTo(0); - assertThat(addressesRefreshCount.entrySet().stream().filter(pair -> pair.getValue() > 1).count()).isEqualTo(0); - } - - assertThat(targetAddresses[0].getPhysicalUri()).isEqualTo(resolvedAddresses[0].getPhysicalUri()); - // Assert.AreEqual(targetServiceIdentity, request.requestContext.TargetIdentity); - assertThat(targetPartitionKeyRange.getId()).isEqualTo(request.requestContext.resolvedPartitionKeyRange.getId()); - } - - private void TestCacheRefreshWhileRouteByPartitionKeyRangeId( - DocumentCollection collectionBeforeRefresh, - DocumentCollection collectionAfterRefresh, - Map routingMapBeforeRefresh, - Map routingMapAfterRefresh, - Map addressesBeforeRefresh, - Map addressesAfterRefresh, - PartitionKeyRangeIdentity rangeIdentity, - AddressInformation[] targetAddresses, - ServiceIdentity targetServiceIdentity, - PartitionKeyRange targetPartitionKeyRange, - boolean forceNameCacheRefresh, - boolean forceRoutingMapRefresh, - boolean forceAddressRefresh, - int collectionCacheRefreshed, - int routingMapCacheRefreshed, - int addressCacheRefreshed, - boolean nameBased) throws Exception { - - if (targetServiceIdentity != null && targetPartitionKeyRange != null) { - targetServiceIdentity.partitionKeyRangeIds.add(new PartitionKeyRangeIdentity(collectionAfterRefresh != null ? collectionAfterRefresh.getResourceId() : collectionBeforeRefresh.getResourceId(), targetPartitionKeyRange.getId())); - } - - this.initializeMocks( - collectionBeforeRefresh, - collectionAfterRefresh, - routingMapBeforeRefresh, - routingMapAfterRefresh, - addressesBeforeRefresh, - addressesAfterRefresh); - - RxDocumentServiceRequest request; - if (nameBased) { - request = RxDocumentServiceRequest.createFromName( - OperationType.Read, - "dbs/db/colls/coll/docs/doc1", - ResourceType.Document); - } else { - request = RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.Document, - DOCUMENT_TEST_URL, - new HashMap<>()); - } - - request.forceNameCacheRefresh = forceNameCacheRefresh; - request.forcePartitionKeyRangeRefresh = forceRoutingMapRefresh; - request.routeTo(rangeIdentity); - AddressInformation[] resolvedAddresses; - try { - resolvedAddresses = this.addressResolver.resolveAsync(request, forceAddressRefresh).toBlocking().value(); - } catch (RuntimeException e) { - e.printStackTrace(); - throw (Exception) e.getCause(); - } finally { - assertThat(collectionCacheRefreshed).isEqualTo(collectionCacheRefreshedCount).describedAs("collection cache refresh count mismath"); - - assertThat(routingMapCacheRefreshed).isEqualTo(routingMapRefreshCount.values().stream().mapToInt(v -> v).sum()).describedAs("routing map cache refresh count mismath"); - assertThat(addressCacheRefreshed).isEqualTo(addressesRefreshCount.values().stream().mapToInt(v -> v).sum()).describedAs("address cache refresh count mismatch"); - - - assertThat(routingMapRefreshCount.entrySet().stream().filter(pair -> pair.getValue() > 1).count()).isEqualTo(0); - assertThat(addressesRefreshCount.entrySet().stream().filter(pair -> pair.getValue() > 1).count()).isEqualTo(0); - } - - assertThat(targetAddresses[0].getPhysicalUri()).isEqualTo(resolvedAddresses[0].getPhysicalUri()); - // Assert.AreEqual(targetServiceIdentity, request.requestContext.TargetIdentity); - assertThat(targetPartitionKeyRange.getId()).isEqualTo(request.requestContext.resolvedPartitionKeyRange.getId()); - } - - private void initializeMocks( - DocumentCollection collectionBeforeRefresh, - DocumentCollection collectionAfterRefresh, - Map routingMapBeforeRefresh, - Map routingMapAfterRefreshInitial, - Map addressesBeforeRefresh, - Map addressesAfterRefreshInitial) { - final Map routingMapAfterRefresh = ObjectUtils.defaultIfNull(routingMapAfterRefreshInitial, routingMapBeforeRefresh); - final Map addressesAfterRefresh = ObjectUtils.defaultIfNull(addressesAfterRefreshInitial, addressesBeforeRefresh); - - // Collection cache - MutableObject currentCollection = new MutableObject(collectionBeforeRefresh); - this.collectionCacheRefreshedCount = 0; - - Mockito.doAnswer(new Answer() { - @Override - public Object answer(InvocationOnMock invocationOnMock) throws Throwable { - RxDocumentServiceRequest request = invocationOnMock.getArgumentAt(0, RxDocumentServiceRequest.class); - if (request.forceNameCacheRefresh && collectionAfterRefresh != null) { - currentCollection.setValue(collectionAfterRefresh); - AddressResolverTest.this.collectionCacheRefreshedCount++; - request.forceNameCacheRefresh = false; - return Single.just(currentCollection.getValue()); - } - - if (request.forceNameCacheRefresh && collectionAfterRefresh == null) { - currentCollection.setValue(null); - AddressResolverTest.this.collectionCacheRefreshedCount++; - request.forceNameCacheRefresh = false; - return Single.error(new NotFoundException()); - } - - if (!request.forceNameCacheRefresh && currentCollection.getValue() == null) { - return Single.error(new NotFoundException()); - - } - - if (!request.forceNameCacheRefresh && currentCollection.getValue() != null) { - return Single.just(currentCollection.getValue()); - } - - return null; - } - }).when(this.collectionCache).resolveCollectionAsync(Mockito.any(RxDocumentServiceRequest.class)); - - // Routing map cache - Map currentRoutingMap = - new HashMap<>(routingMapBeforeRefresh); - this.routingMapRefreshCount = new HashMap<>(); - - Mockito.doAnswer(new Answer() { - @Override - public Object answer(InvocationOnMock invocationOnMock) throws Throwable { - String collectionRid = invocationOnMock.getArgumentAt(0, String.class); - CollectionRoutingMap previousValue = invocationOnMock.getArgumentAt(1, CollectionRoutingMap.class); - - return collectionRoutingMapCache.tryLookupAsync(collectionRid, previousValue, false, null); - } - }).when(this.collectionRoutingMapCache).tryLookupAsync(Mockito.anyString(), Mockito.any(CollectionRoutingMap.class), Mockito.anyMap()); - - // Refresh case - Mockito.doAnswer(new Answer() { - @Override - public Object answer(InvocationOnMock invocationOnMock) throws Throwable { - String collectionRid = invocationOnMock.getArgumentAt(0, String.class); - CollectionRoutingMap previousValue = invocationOnMock.getArgumentAt(1, CollectionRoutingMap.class); - - if (previousValue == null) { - return Single.just(currentRoutingMap.containsKey(collectionRid) ? currentRoutingMap.get(collectionRid) : null); - } - - if (previousValue != null && currentRoutingMap.containsKey(previousValue.getCollectionUniqueId()) && - currentRoutingMap.get(previousValue.getCollectionUniqueId()) == previousValue) { - - - if (previousValue != null && previousValue.getCollectionUniqueId() != collectionRid) { - throw new RuntimeException("InvalidOperation"); - } - - if (routingMapAfterRefresh.containsKey(collectionRid)) { - currentRoutingMap.put(collectionRid, routingMapAfterRefresh.get(collectionRid)); - } else { - currentRoutingMap.remove(collectionRid); - } - - if (!routingMapRefreshCount.containsKey(collectionRid)) { - routingMapRefreshCount.put(collectionRid, 1); - } else { - routingMapRefreshCount.put(collectionRid, routingMapRefreshCount.get(collectionRid) + 1); - } - - - return Single.just(currentRoutingMap.containsKey(collectionRid) ? currentRoutingMap.get(collectionRid) : null); - } - - return Single.error(new NotImplementedException("not mocked")); - } - }).when(this.collectionRoutingMapCache).tryLookupAsync(Mockito.anyString(), Mockito.any(CollectionRoutingMap.class), Mockito.anyBoolean(), Mockito.anyMap()); - - - // Fabric Address Cache - Map currentAddresses = - new HashMap<>(addressesBeforeRefresh); - this.addressesRefreshCount = new HashMap<>(); - - // No refresh case - Mockito.doAnswer(new Answer() { - @Override - public Object answer(InvocationOnMock invocationOnMock) throws Exception { - RxDocumentServiceRequest request = invocationOnMock.getArgumentAt(0, RxDocumentServiceRequest.class); - PartitionKeyRangeIdentity pkri = invocationOnMock.getArgumentAt(1, PartitionKeyRangeIdentity.class); - Boolean forceRefresh = invocationOnMock.getArgumentAt(2, Boolean.class); - - if (!forceRefresh) { - return Single.just(currentAddresses.get(findMatchingServiceIdentity(currentAddresses, pkri))); - } else { - - ServiceIdentity si; - - if ((si = findMatchingServiceIdentity(addressesAfterRefresh, pkri)) != null) { - currentAddresses.put(si, addressesAfterRefresh.get(si)); - } else { - - si = findMatchingServiceIdentity(currentAddresses, pkri); - currentAddresses.remove(si); - } - - if (si == null) { - si = ServiceIdentity.dummyInstance; - } - - if (!addressesRefreshCount.containsKey(si)) { - addressesRefreshCount.put(si, 1); - } else { - addressesRefreshCount.put(si, addressesRefreshCount.get(si) + 1); - } - - - // TODO: what to return in this case if it is null!! - return Single.just(currentAddresses.containsKey(si) ? currentAddresses.get(si) : null); - } - } - // - }).when(fabricAddressCache).tryGetAddresses(Mockito.any(RxDocumentServiceRequest.class), Mockito.any(PartitionKeyRangeIdentity.class), Mockito.anyBoolean()); - } - - private static ServiceIdentity findMatchingServiceIdentity(Map map, PartitionKeyRangeIdentity pkri) { - for (ServiceIdentity si : map.keySet()) { - if (si.partitionKeyRangeIds.contains(pkri)) { - return si; - } - - } - return null; - } - - private final AddressInformation[] addresses1 = {new AddressInformation(true, true, "tcp://host/partition1", Protocol.Https)}; - private final AddressInformation[] addresses2 = {new AddressInformation(true, true, "tcp://host/partition2", Protocol.Https)}; - private final AddressInformation[] addresses3 = {new AddressInformation(true, true, "tcp://host/partition3", Protocol.Https)}; - - private DocumentCollection collection1; - private DocumentCollection collection2; - private CollectionRoutingMap routingMapCollection1BeforeSplit; - private CollectionRoutingMap routingMapCollection1AfterSplit; - private CollectionRoutingMap routingMapCollection2BeforeSplit; - private CollectionRoutingMap routingMapCollection2AfterSplit; - - @Test(groups = "unit") - public void testCacheRefreshesWhileRoutingByPartitionKey() throws Exception { - logger.info("All caches are up to date. Name Based"); - this.TestCacheRefreshWhileRouteByPartitionKey( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - null, - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), this.addresses1), - null, - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), - getRangeAt(this.routingMapCollection1BeforeSplit, 0), - false, - false, - false, - 0, - 0, - 0, - true); - - logger.info("All caches are up to date. Rid Based"); - this.TestCacheRefreshWhileRouteByPartitionKey( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - null, - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), this.addresses1), - null, - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), - getRangeAt(this.routingMapCollection1BeforeSplit, 0), - false, - false, - false, - 0, - 0, - 0, - true); - - logger.info("Address cache is stale. Force Refresh. Name Based"); - this.TestCacheRefreshWhileRouteByPartitionKey( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - null, - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), this.addresses1), - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), this.addresses2), - this.addresses2, - getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), - this.routingMapCollection1BeforeSplit.getOrderedPartitionKeyRanges().get(0), - false, - false, - true, - 0, - 0, - 1, - true); - - logger.info("Address cache is stale. Force Refresh. Rid Based"); - this.TestCacheRefreshWhileRouteByPartitionKey( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - null, - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), this.addresses1), - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), this.addresses2), - this.addresses2, - getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), - getRangeAt(this.routingMapCollection1BeforeSplit, 0), - false, - false, - true, - 0, - 0, - 1, - false); - - logger.info("Routing map cache is stale. Force Refresh. Name based"); - this.TestCacheRefreshWhileRouteByPartitionKey( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1AfterSplit), - ImmutableMap.of( - getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), this.addresses1, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), this.addresses2, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 1), this.addresses3), - null, - this.addresses2, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), - getRangeAt(this.routingMapCollection1AfterSplit, 0), - false, - true, - false, - 0, - 1, - 0, - true); - - logger.info("Routing map cache is stale. Force Refresh. Rid based"); - this.TestCacheRefreshWhileRouteByPartitionKey( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1AfterSplit), - ImmutableMap.of( - getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), this.addresses1, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), this.addresses2, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 1), this.addresses3), - null, - this.addresses2, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), - getRangeAt(this.routingMapCollection1AfterSplit, 0), - false, - true, - false, - 0, - 1, - 0, - false); - - logger.info("Name cache is stale. Force Refresh. Name based"); - this.TestCacheRefreshWhileRouteByPartitionKey( - this.collection1, - this.collection2, - ImmutableMap.of(this.collection2.getResourceId(), this.routingMapCollection2BeforeSplit), - null, - ImmutableMap.of( - getServiceIdentityAt(this.routingMapCollection2BeforeSplit, 0), this.addresses1), - null, - this.addresses1, - getServiceIdentityAt(this.routingMapCollection2BeforeSplit, 0), - getRangeAt(this.routingMapCollection2BeforeSplit, 0), - true, - false, - false, - 1, - 0, - 0, - true); - - logger.info("Name cache is stale (collection deleted new one created same name). Routing Map Cache returns null"); - this.TestCacheRefreshWhileRouteByPartitionKey( - this.collection1, - this.collection2, - ImmutableMap.of(this.collection2.getResourceId(), this.routingMapCollection2BeforeSplit), - null, - ImmutableMap.of( - getServiceIdentityAt(this.routingMapCollection2BeforeSplit, 0), this.addresses1), - null, - this.addresses1, - getServiceIdentityAt(this.routingMapCollection2BeforeSplit, 0), - getRangeAt(this.routingMapCollection2BeforeSplit, 0), - false, - false, - false, - 1, - 0, - 0, - true); - - logger.info("Routing map cache is stale (split happened). Address Cache returns null"); - this.TestCacheRefreshWhileRouteByPartitionKey( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1AfterSplit), - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), this.addresses1), - null, - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), - getRangeAt(this.routingMapCollection1AfterSplit, 0), - false, - false, - false, - 1, - 1, - 0, - true); - - - logger.info("Collection cache is stale (deleted created same name). Routing map cache is stale for new collection (split happened). Address Cache returns null"); - this.TestCacheRefreshWhileRouteByPartitionKey( - this.collection1, - this.collection2, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit, - this.collection2.getResourceId(), this.routingMapCollection2BeforeSplit), - ImmutableMap.of(this.collection2.getResourceId(), this.routingMapCollection2AfterSplit), - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection2AfterSplit, 0), this.addresses1), - null, - this.addresses1, - getServiceIdentityAt(this.routingMapCollection2AfterSplit, 0), - getRangeAt(this.routingMapCollection2AfterSplit, 0), - false, - false, - false, - 1, - 1, - 0, - true); - - logger.info("Collection cache is stale (collection deleted). Routing map cache is stale (collection deleted). Address Cache returns null"); - try { - this.TestCacheRefreshWhileRouteByPartitionKey( - this.collection1, - null, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - ImmutableMap.of(), - ImmutableMap.of(), - null, - null, - null, - null, - false, - false, - false, - 1, - 0, - 0, - true); - - fail("Expected NotFoundException"); - } catch (NotFoundException e) { - } - - logger.info("Collection cache is stale (collection deleted). Routing map cache returns null."); - try { - this.TestCacheRefreshWhileRouteByPartitionKey( - this.collection1, - null, - ImmutableMap.of(), - null, - ImmutableMap.of(), - null, - null, - null, - null, - false, - false, - false, - 1, - 0, - 0, - true); - - fail("Expected NotFoundException"); - } catch (NotFoundException e) { - } - } - - private static PartitionKeyRange getRangeAt(CollectionRoutingMap routingMap, int index) { - return routingMap.getOrderedPartitionKeyRanges().get(index); - } - - private static ServiceIdentity getServiceIdentityAt(CollectionRoutingMap routingMap, int index) { - return (ServiceIdentity) routingMap.tryGetInfoByPartitionKeyRangeId(routingMap.getOrderedPartitionKeyRanges().get(index).getId()); - } - - @Test(groups = "unit") - public void testCacheRefreshesWhileRoutingByPartitionKeyRangeId() throws Exception { - logger.info("All caches are up to date. Name Based"); - this.TestCacheRefreshWhileRouteByPartitionKeyRangeId( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - null, - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), this.addresses1), - null, - new PartitionKeyRangeIdentity(this.collection1.getResourceId(), "0"), - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), - getRangeAt(this.routingMapCollection1BeforeSplit, 0), - false, - false, - false, - 0, - 0, - 0, - true); - - logger.info("All caches are up to date. Name Based. Non existent range with collection rid"); - try { - this.TestCacheRefreshWhileRouteByPartitionKeyRangeId( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - null, - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), this.addresses1), - null, - new PartitionKeyRangeIdentity(this.collection1.getResourceId(), "1"), - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), - getRangeAt(this.routingMapCollection1BeforeSplit, 0), - false, - false, - false, - 0, - 1, - 0, - true); - - fail("Should have gotten PartitionKeyRangeGoneException"); - } catch (PartitionKeyRangeGoneException e) { - } - - logger.info("All caches are up to date. Name Based. Non existent range withOUT collection rid"); - try { - this.TestCacheRefreshWhileRouteByPartitionKeyRangeId( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - null, - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), this.addresses1), - null, - new PartitionKeyRangeIdentity("1"), - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), - getRangeAt(this.routingMapCollection1BeforeSplit, 0), - false, - false, - false, - 1, - 1, - 0, - true); - - fail("Should have gotten PartitionKeyRangeGoneException"); - } catch (PartitionKeyRangeGoneException e) { - } - - logger.info("All caches are up to date. Name Based.Range doesn't exist in routing map because split happened."); - try { - this.TestCacheRefreshWhileRouteByPartitionKeyRangeId( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1AfterSplit), - null, - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), this.addresses1), - null, - new PartitionKeyRangeIdentity(collection1.getResourceId(), "0"), - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1BeforeSplit, 0), - getRangeAt(this.routingMapCollection1BeforeSplit, 0), - false, - false, - false, - 0, - 0, - 0, - true); - - fail("Should have gotten PartitionKeyRangeGoneException"); - } catch (PartitionKeyRangeGoneException e) { - } - - try { - logger.info("Name Based.Routing map cache is outdated because split happened. Address cache returns null."); - this.TestCacheRefreshWhileRouteByPartitionKeyRangeId( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1AfterSplit), - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), this.addresses1), - null, - new PartitionKeyRangeIdentity(collection1.getResourceId(), "0"), - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), - getRangeAt(this.routingMapCollection1AfterSplit, 0), - false, - false, - false, - 0, - 1, - 0, - true); - - fail("Should have gotten PartitionKeyRangeGoneException"); - } catch (PartitionKeyRangeGoneException e) { - } - - logger.info("Name Based.Routing map cache is outdated because split happend."); - this.TestCacheRefreshWhileRouteByPartitionKeyRangeId( - this.collection1, - this.collection1, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1AfterSplit), - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), this.addresses1), - null, - new PartitionKeyRangeIdentity(collection1.getResourceId(), "1"), - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), - getRangeAt(this.routingMapCollection1AfterSplit, 0), - false, - false, - false, - 0, - 1, - 0, - true); - - try { - logger.info("Collection cache is outdated. Routing map cache returns null. Collection is deleted. Range with collection rid."); - this.TestCacheRefreshWhileRouteByPartitionKeyRangeId( - this.collection1, - null, - ImmutableMap.of(), - ImmutableMap.of(), - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), this.addresses1), - null, - new PartitionKeyRangeIdentity(collection1.getResourceId(), "0"), - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), - getRangeAt(this.routingMapCollection1AfterSplit, 0), - false, - false, - false, - 0, - 0, - 0, - true); - - fail("Should have gotten InvalidPartitionException"); - } catch (InvalidPartitionException e) { - } - - try { - logger.info("Collection cache is outdated. Routing map cache returns null. Collection is deleted. Range without collection rid"); - this.TestCacheRefreshWhileRouteByPartitionKeyRangeId( - this.collection1, - null, - ImmutableMap.of(), - ImmutableMap.of(), - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), this.addresses1), - null, - new PartitionKeyRangeIdentity("0"), - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), - getRangeAt(this.routingMapCollection1AfterSplit, 0), - false, - false, - false, - 1, - 0, - 0, - true); - - fail("Should have gotten NotFoundException"); - } catch (NotFoundException e) { - } - - try { - logger.info("Collection cache is outdated. Routing map cache returns null. Collection is deleted. Range with collection rid. Rid based."); - this.TestCacheRefreshWhileRouteByPartitionKeyRangeId( - this.collection1, - null, - ImmutableMap.of(), - ImmutableMap.of(), - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), this.addresses1), - null, - new PartitionKeyRangeIdentity(collection1.getResourceId(), "0"), - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), - getRangeAt(this.routingMapCollection1AfterSplit, 0), - false, - false, - false, - 0, - 0, - 0, - false); - - fail("Should have gotten NotFoundException"); - } catch (NotFoundException e) { - } - - try { - logger.info("Collection cache is outdated. Routing map cache is outdated. Address cache is outdated. ForceAddressRefresh. Range with collection rid. Name based."); - this.TestCacheRefreshWhileRouteByPartitionKeyRangeId( - this.collection1, - this.collection2, - ImmutableMap.of(this.collection1.getResourceId(), this.routingMapCollection1BeforeSplit), - ImmutableMap.of(this.collection2.getResourceId(), this.routingMapCollection2BeforeSplit), - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), this.addresses1), - ImmutableMap.of(getServiceIdentityAt(this.routingMapCollection2AfterSplit, 0), this.addresses2), - new PartitionKeyRangeIdentity(collection1.getResourceId(), "0"), - this.addresses1, - getServiceIdentityAt(this.routingMapCollection1AfterSplit, 0), - getRangeAt(this.routingMapCollection1AfterSplit, 0), - false, - false, - true, - 0, - 1, - 1, - true); - - fail("Should have gotten InvalidPartitionException"); - } catch (InvalidPartitionException e) { - } - } - - static class ServiceIdentity implements IServerIdentity { - final boolean IsMasterService; - final URI ServiceName; - final String FederationId; - final Set partitionKeyRangeIds; - final static ServiceIdentity dummyInstance = new ServiceIdentity(null, null, true); - - public ServiceIdentity(String federationId, URI serviceName, boolean isMasterService, PartitionKeyRangeIdentity... partitionKeyRangeIdentities) { - this.FederationId = federationId; - this.ServiceName = serviceName; - this.IsMasterService = isMasterService; - this.partitionKeyRangeIds = new HashSet<>(Arrays.stream(partitionKeyRangeIdentities).collect(Collectors.toList())); - } - } -} - diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressSelectorTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressSelectorTest.java deleted file mode 100644 index 4755646d1896..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressSelectorTest.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.collect.ImmutableList; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.mockito.Matchers; -import org.mockito.Mockito; -import org.testng.annotations.Test; -import rx.Single; - -import java.net.URI; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; - -public class AddressSelectorTest { - - @Test(groups = "unit", expectedExceptions = GoneException.class) - public void getPrimaryUri_NoAddress() throws Exception { - RxDocumentServiceRequest request = Mockito.mock(RxDocumentServiceRequest.class); - Mockito.doReturn(null).when(request).getDefaultReplicaIndex(); - List replicaAddresses = new ArrayList<>(); - - AddressSelector.getPrimaryUri(request, replicaAddresses); - } - - @Test(groups = "unit", expectedExceptions = GoneException.class, expectedExceptionsMessageRegExp = - "The requested resource is no longer available at the server. Returned addresses are \\{https://cosmos1,https://cosmos2\\}") - public void getPrimaryUri_NoPrimaryAddress() throws Exception { - RxDocumentServiceRequest request = Mockito.mock(RxDocumentServiceRequest.class); - Mockito.doReturn(null).when(request).getDefaultReplicaIndex(); - - List replicaAddresses = new ArrayList<>(); - - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos1", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos2", Protocol.Https)); - - AddressSelector.getPrimaryUri(request, replicaAddresses); - } - - @Test(groups = "unit") - public void getPrimaryUri() throws Exception { - RxDocumentServiceRequest request = Mockito.mock(RxDocumentServiceRequest.class); - Mockito.doReturn(null).when(request).getDefaultReplicaIndex(); - - List replicaAddresses = new ArrayList<>(); - - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos1", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, true, "https://cosmos2", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos3", Protocol.Https)); - - URI res = AddressSelector.getPrimaryUri(request, replicaAddresses); - - assertThat(res).isEqualTo(URI.create("https://cosmos2")); - } - - @Test(groups = "unit") - public void getPrimaryUri_WithRequestReplicaIndex() throws Exception { - RxDocumentServiceRequest request = Mockito.mock(RxDocumentServiceRequest.class); - Mockito.doReturn(1).when(request).getDefaultReplicaIndex(); - - List replicaAddresses = new ArrayList<>(); - - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos1", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos2", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos3", Protocol.Https)); - - URI res = AddressSelector.getPrimaryUri(request, replicaAddresses); - - assertThat(res).isEqualTo(URI.create("https://cosmos2")); - } - - @Test(groups = "unit") - public void resolvePrimaryUriAsync() { - IAddressResolver addressResolver = Mockito.mock(IAddressResolver.class); - AddressSelector selector = new AddressSelector(addressResolver, Protocol.Https); - - RxDocumentServiceRequest request = Mockito.mock(RxDocumentServiceRequest.class); - Mockito.doReturn(null).when(request).getDefaultReplicaIndex(); - - List replicaAddresses = new ArrayList<>(); - - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos4", Protocol.Tcp)); - replicaAddresses.add(new AddressInformation(true, true, "https://cosmos5", Protocol.Tcp)); - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos1", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, true, "https://cosmos2", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos3", Protocol.Https)); - - Mockito.doReturn(Single.just(replicaAddresses.toArray(new AddressInformation[0]))).when(addressResolver).resolveAsync(Mockito.any(RxDocumentServiceRequest.class), Matchers.eq(false)); - - URI res = selector.resolvePrimaryUriAsync(request, false).toBlocking().value(); - - assertThat(res).isEqualTo(URI.create("https://cosmos2")); - } - - @Test(groups = "unit") - public void resolveAllUriAsync() { - IAddressResolver addressResolver = Mockito.mock(IAddressResolver.class); - AddressSelector selector = new AddressSelector(addressResolver, Protocol.Https); - - RxDocumentServiceRequest request = Mockito.mock(RxDocumentServiceRequest.class); - Mockito.doReturn(null).when(request).getDefaultReplicaIndex(); - - List replicaAddresses = new ArrayList<>(); - - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos4", Protocol.Tcp)); - replicaAddresses.add(new AddressInformation(true, true, "https://cosmos5", Protocol.Tcp)); - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos1", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, true, "https://cosmos2", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos3", Protocol.Https)); - - Mockito.doReturn(Single.just(replicaAddresses.toArray(new AddressInformation[0]))).when(addressResolver).resolveAsync(Mockito.any(RxDocumentServiceRequest.class), Matchers.eq(false)); - - List res = selector.resolveAllUriAsync(request, true, false).toBlocking().value(); - - assertThat(res).isEqualTo(ImmutableList.of(URI.create("https://cosmos1"), URI.create("https://cosmos2"), URI.create("https://cosmos3"))); - } - - @Test(groups = "unit") - public void resolveAddressesAsync() { - IAddressResolver addressResolver = Mockito.mock(IAddressResolver.class); - AddressSelector selector = new AddressSelector(addressResolver, Protocol.Https); - - RxDocumentServiceRequest request = Mockito.mock(RxDocumentServiceRequest.class); - Mockito.doReturn(null).when(request).getDefaultReplicaIndex(); - - List replicaAddresses = new ArrayList<>(); - - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos4", Protocol.Tcp)); - replicaAddresses.add(new AddressInformation(true, true, "https://cosmos5", Protocol.Tcp)); - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos1", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, true, "https://cosmos2", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos3", Protocol.Https)); - - Mockito.doReturn(Single.just(replicaAddresses.toArray(new AddressInformation[0]))).when(addressResolver).resolveAsync(Mockito.any(RxDocumentServiceRequest.class), Matchers.eq(false)); - - List res = selector.resolveAddressesAsync(request, false).toBlocking().value(); - - assertThat(res).isEqualTo(replicaAddresses.stream().filter(a -> a.getProtocolName().equals(Protocol.Https.name())).collect(Collectors.toList())); - } - - @Test(groups = "unit") - public void resolveAllUriAsync_RNTBD() { - IAddressResolver addressResolver = Mockito.mock(IAddressResolver.class); - AddressSelector selector = new AddressSelector(addressResolver, Protocol.Tcp); - - RxDocumentServiceRequest request = Mockito.mock(RxDocumentServiceRequest.class); - Mockito.doReturn(null).when(request).getDefaultReplicaIndex(); - - List replicaAddresses = new ArrayList<>(); - - replicaAddresses.add(new AddressInformation(true, false, "rntbd://cosmos1", Protocol.Tcp)); - replicaAddresses.add(new AddressInformation(true, true, "rntbd://cosmos2", Protocol.Tcp)); - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos1", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, true, "https://cosmos2", Protocol.Https)); - replicaAddresses.add(new AddressInformation(true, false, "https://cosmos3", Protocol.Https)); - - Mockito.doReturn(Single.just(replicaAddresses.toArray(new AddressInformation[0]))).when(addressResolver).resolveAsync(Mockito.any(RxDocumentServiceRequest.class), Matchers.eq(false)); - - List res = selector.resolveAllUriAsync(request, true, false).toBlocking().value(); - - assertThat(res).isEqualTo(ImmutableList.of(URI.create("rntbd://cosmos1"), URI.create("rntbd://cosmos2"))); - } - -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressSelectorWrapper.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressSelectorWrapper.java deleted file mode 100644 index a968ffb24bc2..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressSelectorWrapper.java +++ /dev/null @@ -1,527 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.base.Predicates; -import com.google.common.collect.ImmutableList; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; -import org.assertj.core.api.Condition; -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import rx.Single; - -import java.net.URI; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.function.Function; -import java.util.stream.Collectors; - -import static org.assertj.core.api.Assertions.assertThat; - -public class AddressSelectorWrapper { - - private static String resolveAllUriAsync = "resolveAllUriAsync"; - private static String resolvePrimaryUriAsync = "resolvePrimaryUriAsync"; - private static String resolveAddressesAsync = "resolveAddressesAsync"; - private final List invocationOnMockList; - - public final AddressSelector addressSelector; - - public static class InOrderVerificationBuilder { - private List> actions = new ArrayList<>(); - - public static InOrderVerificationBuilder create() { - return new InOrderVerificationBuilder(); - } - - public InOrderVerificationBuilder verify(InOrderVerification.Verifier v, int index) { - actions.add(verification -> { - verification.verify(v, index); - return null; - }); - return this; - } - - public InOrderVerificationBuilder verifyOnAll(InOrderVerification.Verifier v) { - actions.add(verification -> { - verification.verifyOnAll(v); - return null; - }); - return this; - } - - public InOrderVerificationBuilder verifyNext(InOrderVerification.Verifier v) { - actions.add(verification -> { - verification.verifyNext(v); - return null; - }); - return this; - } - - public InOrderVerificationBuilder verifyNumberOfInvocations(int expected) { - actions.add(verification -> { - verification.verifyNumberOfInvocations(expected); - return null; - }); - return this; - } - - public void execute(AddressSelectorWrapper addressSelectorWrapper) { - InOrderVerification v = new InOrderVerification(addressSelectorWrapper.invocationOnMockList); - for(Function action: actions) { - action.apply(v); - } - } - } - - public InOrderVerification getInOrderVerification() { - return new InOrderVerification(invocationOnMockList); - } - - public static class InOrderVerification { - private final List invocations; - private int internalIndex = 0; - - InOrderVerification(List invocationOnMockList) { - invocations = invocationOnMockList; - } - - public InOrderVerification verify(Verifier v, int index) { - v.verify(invocations.get(index)); - return this; - } - - public InOrderVerification verifyOnAll(Verifier v) { - for(InvocationOnMock i: invocations) { - v.verify(i); - } - return this; - } - - public InOrderVerification verifyNext(Verifier v) { - v.verify(invocations.get(internalIndex++)); - return this; - } - - public InOrderVerification verifyNumberOfInvocations(int expected) { - assertThat(invocations).hasSize(expected); - return this; - } - - interface Verifier { - - void verify(InvocationOnMock invocation); - - public static VerifierBuilder builder() { - return new VerifierBuilder(); - } - - public static class VerifierBuilder { - - public Verifier build() { - return new Verifier() { - @Override - public void verify(InvocationOnMock invocation) { - for(Verifier v: verifiers) { - v.verify(invocation); - } - } - }; - } - - List verifiers = new ArrayList<>(); - - VerifierBuilder add(Verifier verifier) { - verifiers.add(verifier); - return this; - } - - VerifierBuilder methodName(String methodName) { - add(new Verifier() { - @Override - public void verify(InvocationOnMock invocation) { - assertThat(invocation.getMethod().getName()).isEqualTo(methodName); - } - }); - return this; - } - - VerifierBuilder resolveAllUriAsync() { - methodName(resolveAllUriAsync); - return this; - } - - VerifierBuilder resolvePrimaryUriAsync() { - methodName(resolvePrimaryUriAsync); - return this; - } - - VerifierBuilder resolveAddressesAsync() { - methodName(resolveAddressesAsync); - return this; - } - - VerifierBuilder resolveAllUriAsync(Condition requestMatcher, Condition includePrimaryMatcher, Condition forceRefreshMatcher) { - methodName(resolveAllUriAsync); - add(new Verifier() { - @Override - public void verify(InvocationOnMock invocation) { - RxDocumentServiceRequest request = invocation.getArgumentAt(0, RxDocumentServiceRequest.class); - boolean includePrimary = invocation.getArgumentAt(1, Boolean.class); - boolean forceRefresh = invocation.getArgumentAt(2, Boolean.class); - - assertThat(request).is(requestMatcher); - - assertThat(includePrimary).is(includePrimaryMatcher); - assertThat(forceRefresh).is(forceRefreshMatcher); - } - }); - return this; - } - - VerifierBuilder resolveAllUriAsync_IncludePrimary(boolean primaryIncluded) { - methodName(resolveAllUriAsync); - - Condition alwaysTrue = new Condition(Predicates.alwaysTrue(), "no condition"); - Condition primaryIncludedCond = new Condition(Predicates.equalTo(primaryIncluded), String.format("%b (primaryIncluded)", primaryIncluded)); - - resolveAllUriAsync(alwaysTrue, primaryIncludedCond, alwaysTrue); - return this; - } - - VerifierBuilder resolveAllUriAsync_ForceRefresh(boolean forceRefresh) { - methodName(resolveAllUriAsync); - - Condition alwaysTrue = new Condition(Predicates.alwaysTrue(), "no condition"); - Condition forceRefreshCond = new Condition(Predicates.equalTo(forceRefresh), String.format("%b (forceRefresh)", forceRefresh)); - - resolveAllUriAsync(alwaysTrue, alwaysTrue, forceRefreshCond); - return this; - } - } - } - } - - public AddressSelectorWrapper(AddressSelector addressSelector, List invocationOnMockList) { - this.addressSelector = addressSelector; - this.invocationOnMockList = invocationOnMockList; - } - - public AddressSelectorWrapper verifyNumberOfForceCachRefresh(int expectedNumber) { - int count = 0; - for (InvocationOnMock invocationOnMock : invocationOnMockList) { - boolean forceRefresh; - if (invocationOnMock.getMethod().getName().endsWith("resolveAllUriAsync")) { - forceRefresh = invocationOnMock.getArgumentAt(2, Boolean.class); - } else { - forceRefresh = invocationOnMock.getArgumentAt(1, Boolean.class); - } - if (forceRefresh) { - count++; - } - } - assertThat(count).isEqualTo(expectedNumber); - return this; - } - - public AddressSelectorWrapper verifyNumberOfForceCacheRefreshGreaterThanOrEqualTo(int minimum) { - int count = 0; - for (InvocationOnMock invocationOnMock : invocationOnMockList) { - boolean forceRefresh; - if (invocationOnMock.getMethod().getName().endsWith("resolveAllUriAsync")) { - forceRefresh = invocationOnMock.getArgumentAt(2, Boolean.class); - } else { - forceRefresh = invocationOnMock.getArgumentAt(1, Boolean.class); - } - if (forceRefresh) { - count++; - } - } - assertThat(count).isGreaterThanOrEqualTo(minimum); - return this; - } - - public AddressSelectorWrapper validate() { - // for now do nothing; - return this; - } - - public AddressSelectorWrapper verifyVesolvePrimaryUriAsyncCount(int count) { - Mockito.verify(addressSelector, Mockito.times(count)).resolvePrimaryUriAsync(Mockito.any(), Mockito.anyBoolean()); - return this; - } - - public AddressSelectorWrapper verifyResolveAddressesAsync(int count) { - Mockito.verify(addressSelector, Mockito.times(count)).resolveAddressesAsync(Mockito.any(), Mockito.anyBoolean()); - return this; - } - - public AddressSelectorWrapper verifyResolveAllUriAsync(int count) { - Mockito.verify(addressSelector, Mockito.times(count)).resolveAllUriAsync(Mockito.any(), Mockito.anyBoolean(), Mockito.anyBoolean()); - return this; - } - - public AddressSelectorWrapper verifyTotalInvocations(int count) { - assertThat(invocationOnMockList).hasSize(count); - return this; - } - - public static class Builder { - final Protocol protocol; - AddressSelector addressSelector; - List invocationOnMockList = Collections.synchronizedList(new ArrayList<>()); - - - public Builder(Protocol protocol) { - this.protocol = protocol; - } - - public static class PrimaryReplicaMoveBuilder extends Builder { - static PrimaryReplicaMoveBuilder create(Protocol protocol) { - return new PrimaryReplicaMoveBuilder(protocol); - } - - public PrimaryReplicaMoveBuilder(Protocol protocol) { - super(protocol); - addressSelector = Mockito.mock(AddressSelector.class); - } - - public PrimaryReplicaMoveBuilder withPrimaryReplicaMove(URI primaryURIBeforeForceRefresh, URI primaryURIAfterForceRefresh) { - AtomicBoolean refreshed = new AtomicBoolean(false); - Mockito.doAnswer((invocation) -> { - capture(invocation); - RxDocumentServiceRequest request = invocation.getArgumentAt(0, RxDocumentServiceRequest.class); - boolean forceRefresh = invocation.getArgumentAt(1, Boolean.class); - - if (forceRefresh || refreshed.get()) { - refreshed.set(true); - return Single.just(primaryURIAfterForceRefresh); - } - - return Single.just(primaryURIBeforeForceRefresh); - }).when(addressSelector).resolvePrimaryUriAsync(Mockito.any(RxDocumentServiceRequest.class), Mockito.anyBoolean()); - - Mockito.doAnswer((invocation -> { - capture(invocation); - return null; - })).when(addressSelector).resolveAllUriAsync(Mockito.any(), Mockito.anyBoolean(), Mockito.anyBoolean()); - - Mockito.doAnswer((invocation -> { - capture(invocation); - return null; - })).when(addressSelector).resolveAddressesAsync(Mockito.any(), Mockito.anyBoolean()); - - return this; - } - - public AddressSelectorWrapper build() { - return new AddressSelectorWrapper(this.addressSelector, this.invocationOnMockList); - } - } - - public static class ReplicaMoveBuilder extends Builder { - - List> secondary = new ArrayList<>(); - Pair primary; - private Function partitionKeyRangeFunction; - - static ReplicaMoveBuilder create(Protocol protocol) { - return new ReplicaMoveBuilder(protocol); - } - - public ReplicaMoveBuilder(Protocol protocol) { - super(protocol); - addressSelector = Mockito.mock(AddressSelector.class); - } - - public ReplicaMoveBuilder withPrimaryMove(URI uriBeforeForceRefresh, URI uriAfterForceRefresh) { - withReplicaMove(uriBeforeForceRefresh, uriAfterForceRefresh, true); - return this; - } - - public ReplicaMoveBuilder withSecondaryMove(URI uriBeforeForceRefresh, URI uriAfterForceRefresh) { - withReplicaMove(uriBeforeForceRefresh, uriAfterForceRefresh, false); - return this; - } - - public ReplicaMoveBuilder newPartitionKeyRangeIdOnRefresh(Function partitionKeyRangeFunction) { - this.partitionKeyRangeFunction = partitionKeyRangeFunction; - return this; - } - - public ReplicaMoveBuilder withReplicaMove(URI uriBeforeForceRefresh, URI uriAfterForceRefresh, boolean isPrimary) { - if (isPrimary) { - primary = ImmutablePair.of(uriBeforeForceRefresh, uriAfterForceRefresh); - } else { - secondary.add(ImmutablePair.of(uriBeforeForceRefresh, uriAfterForceRefresh)); - } - return this; - } - - - public AddressSelectorWrapper build() { - AtomicBoolean refreshed = new AtomicBoolean(false); - Mockito.doAnswer((invocation) -> { - capture(invocation); - RxDocumentServiceRequest request = invocation.getArgumentAt(0, RxDocumentServiceRequest.class); - boolean forceRefresh = invocation.getArgumentAt(1, Boolean.class); - if (partitionKeyRangeFunction != null) { - request.requestContext.resolvedPartitionKeyRange = partitionKeyRangeFunction.apply(request); - } - if (forceRefresh || refreshed.get()) { - refreshed.set(true); - return Single.just(primary.getRight()); - } else { - return Single.just(primary.getLeft()); - } - - }).when(addressSelector).resolvePrimaryUriAsync(Mockito.any(RxDocumentServiceRequest.class), Mockito.anyBoolean()); - - Mockito.doAnswer((invocation -> { - capture(invocation); - RxDocumentServiceRequest request = invocation.getArgumentAt(0, RxDocumentServiceRequest.class); - boolean includePrimary = invocation.getArgumentAt(1, Boolean.class); - boolean forceRefresh = invocation.getArgumentAt(2, Boolean.class); - - ImmutableList.Builder b = ImmutableList.builder(); - - if (forceRefresh || refreshed.get()) { - if (partitionKeyRangeFunction != null) { - request.requestContext.resolvedPartitionKeyRange = partitionKeyRangeFunction.apply(request); - } - refreshed.set(true); - if (includePrimary) { - b.add(primary.getRight()); - } - b.addAll(secondary.stream().map(s -> s.getRight()).collect(Collectors.toList())); - return Single.just(b.build()); - } else { - // old - if (includePrimary) { - b.add(primary.getLeft()); - } - b.addAll(secondary.stream().map(s -> s.getLeft()).collect(Collectors.toList())); - return Single.just(b.build()); - } - - })).when(addressSelector).resolveAllUriAsync(Mockito.any(RxDocumentServiceRequest.class), Mockito.anyBoolean(), Mockito.anyBoolean()); - - Mockito.doAnswer((invocation -> { - capture(invocation); - RxDocumentServiceRequest request = invocation.getArgumentAt(0, RxDocumentServiceRequest.class); - boolean forceRefresh = invocation.getArgumentAt(1, Boolean.class); - - ImmutableList.Builder b = ImmutableList.builder(); - - if (forceRefresh || refreshed.get()) { - if (partitionKeyRangeFunction != null) { - request.requestContext.resolvedPartitionKeyRange = partitionKeyRangeFunction.apply(request); - } - - refreshed.set(true); - b.add(primary.getRight()); - b.addAll(secondary.stream().map(s -> s.getRight()).collect(Collectors.toList())); - return Single.just(b.build()); - } else { - // old - b.add(primary.getLeft()); - b.addAll(secondary.stream().map(s -> s.getLeft()).collect(Collectors.toList())); - return Single.just(b.build()); - } - })).when(addressSelector).resolveAddressesAsync(Mockito.any(RxDocumentServiceRequest.class), Mockito.anyBoolean()); - - return new AddressSelectorWrapper(addressSelector, invocationOnMockList); - } - } - - public static class Simple extends Builder { - private URI primaryAddress; - private List secondaryAddresses; - static Simple create() { - return new Simple(Protocol.Https); - } - - public Simple(Protocol protocol) { - super(protocol); - addressSelector = Mockito.mock(AddressSelector.class); - } - - public Simple withPrimary(URI primaryAddress) { - this.primaryAddress = primaryAddress; - return this; - } - - public Simple withSecondary(List secondaryAddresses) { - this.secondaryAddresses = secondaryAddresses; - return this; - } - - public AddressSelectorWrapper build() { - Mockito.doAnswer((invocation) -> { - capture(invocation); - return Single.just(primaryAddress); - }).when(addressSelector).resolvePrimaryUriAsync(Mockito.any(RxDocumentServiceRequest.class), Mockito.anyBoolean()); - - Mockito.doAnswer((invocation -> { - capture(invocation); - RxDocumentServiceRequest request = invocation.getArgumentAt(0, RxDocumentServiceRequest.class); - boolean includePrimary = invocation.getArgumentAt(1, Boolean.class); - boolean forceRefresh = invocation.getArgumentAt(2, Boolean.class); - - if (includePrimary) { - return Single.just(ImmutableList.builder().addAll(secondaryAddresses).add(primaryAddress).build()); - } else { - return Single.just(secondaryAddresses); - } - })).when(addressSelector).resolveAllUriAsync(Mockito.any(), Mockito.anyBoolean(), Mockito.anyBoolean()); - - Mockito.doAnswer((invocation -> { - capture(invocation); - return Single.just(ImmutableList.builder() - .addAll(secondaryAddresses.stream() - .map(uri -> toAddressInformation(uri, false, protocol)) - .collect(Collectors.toList())) - .add(toAddressInformation(primaryAddress, true, protocol)) - .build()); - })).when(addressSelector).resolveAddressesAsync(Mockito.any(), Mockito.anyBoolean()); - - - return new AddressSelectorWrapper(this.addressSelector, this.invocationOnMockList); - } - - private AddressInformation toAddressInformation(URI uri, boolean isPrimary, Protocol protocol) { - return new AddressInformation(true, isPrimary, uri.toString(), protocol); - } - } - - protected void capture(InvocationOnMock invocationOnMock) { - invocationOnMockList.add(invocationOnMock); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyReaderTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyReaderTest.java deleted file mode 100644 index 36c3795fe961..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyReaderTest.java +++ /dev/null @@ -1,782 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.collect.ImmutableList; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.ISessionToken; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.VectorSessionToken; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.DocumentServiceRequestContext; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.NotFoundException; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import org.mockito.Mockito; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import rx.Single; -import rx.observers.TestSubscriber; - -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.net.URI; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import static com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; -import static org.assertj.core.api.Assertions.assertThat; - -public class ConsistencyReaderTest { - private final Configs configs = new Configs(); - private static final int TIMEOUT = 30000; - @DataProvider(name = "deduceReadModeArgProvider") - public Object[][] deduceReadModeArgProvider() { - return new Object[][]{ - // account consistency, request consistency, expected readmode, expected consistency to use, whether use session - { ConsistencyLevel.Strong, null, ReadMode.Strong, ConsistencyLevel.Strong, false}, - { ConsistencyLevel.Strong, ConsistencyLevel.Eventual, ReadMode.Any, ConsistencyLevel.Eventual, false}, - { ConsistencyLevel.Strong, ConsistencyLevel.Session, ReadMode.Any, ConsistencyLevel.Session, true}, - { ConsistencyLevel.Session, ConsistencyLevel.Eventual, ReadMode.Any, ConsistencyLevel.Eventual, false}, - { ConsistencyLevel.Session, ConsistencyLevel.Session, ReadMode.Any, ConsistencyLevel.Session, true}, - { ConsistencyLevel.Session, ConsistencyLevel.Eventual, ReadMode.Any, ConsistencyLevel.Eventual, false}, - { ConsistencyLevel.Session, null, ReadMode.Any, ConsistencyLevel.Session, true}, - { ConsistencyLevel.Eventual, ConsistencyLevel.Eventual, ReadMode.Any, ConsistencyLevel.Eventual, false}, - { ConsistencyLevel.Eventual, null, ReadMode.Any, ConsistencyLevel.Eventual, false}, - }; - } - - @Test(groups = "unit", dataProvider = "deduceReadModeArgProvider") - public void deduceReadMode(ConsistencyLevel accountConsistencyLevel, ConsistencyLevel requestConsistency, ReadMode expectedReadMode, - ConsistencyLevel expectedConsistencyToUse, boolean expectedToUseSession) throws DocumentClientException { - AddressSelector addressSelector = Mockito.mock(AddressSelector.class); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - TransportClient transportClient = Mockito.mock(TransportClient.class); - GatewayServiceConfiguratorReaderMock gatewayServiceConfigurationReaderWrapper = GatewayServiceConfiguratorReaderMock.from(accountConsistencyLevel); - IAuthorizationTokenProvider authorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - ConsistencyReader consistencyReader = new ConsistencyReader(configs, - addressSelector, - sessionContainer, - transportClient, - gatewayServiceConfigurationReaderWrapper.gatewayServiceConfigurationReader, - authorizationTokenProvider); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - if (requestConsistency != null) { - request.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, requestConsistency.name()); - } - - ValueHolder consistencyLevel = ValueHolder.initialize(null); - ValueHolder useSession = ValueHolder.initialize(null); - - ReadMode readMode = consistencyReader.deduceReadMode(request, consistencyLevel, useSession); - - assertThat(readMode).isEqualTo(expectedReadMode); - assertThat(consistencyLevel.v).isEqualTo(expectedConsistencyToUse); - assertThat(useSession.v).isEqualTo(expectedToUseSession); - } - - @DataProvider(name = "getMaxReplicaSetSizeArgProvider") - public Object[][] getMaxReplicaSetSizeArgProvider() { - return new Object[][]{ - // system max replica count, system min replica count, user max replica count, user min replica, is reading from master operation - { 4, 3, 4, 3, false }, - { 4, 3, 4, 3, true }, - - { 4, 3, 3, 2, false }, - { 4, 3, 3, 2, true } - }; - } - - @Test(groups = "unit", dataProvider = "getMaxReplicaSetSizeArgProvider") - public void replicaSizes(int systemMaxReplicaCount, - int systemMinReplicaCount, - int userMaxReplicaCount, - int userMinReplicaCount, - boolean isReadingFromMasterOperation) { - AddressSelector addressSelector = Mockito.mock(AddressSelector.class); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - TransportClient transportClient = Mockito.mock(TransportClient.class); - GatewayServiceConfiguratorReaderMock gatewayServiceConfigurationReaderWrapper = GatewayServiceConfiguratorReaderMock.from(ConsistencyLevel.Strong, - systemMaxReplicaCount, - systemMinReplicaCount, - userMaxReplicaCount, - userMinReplicaCount); - IAuthorizationTokenProvider authorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - ConsistencyReader consistencyReader = new ConsistencyReader(configs, - addressSelector, - sessionContainer, - transportClient, - gatewayServiceConfigurationReaderWrapper.gatewayServiceConfigurationReader, - authorizationTokenProvider); - - RxDocumentServiceRequest request; - if (isReadingFromMasterOperation) { - request = RxDocumentServiceRequest.createFromName( - OperationType.ReadFeed, "/dbs/db/colls/col", ResourceType.DocumentCollection); - } else { - request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - } - - assertThat(consistencyReader.getMaxReplicaSetSize(request)).isEqualTo(isReadingFromMasterOperation? systemMaxReplicaCount : userMaxReplicaCount); - assertThat(consistencyReader.getMinReplicaSetSize(request)).isEqualTo(isReadingFromMasterOperation? systemMinReplicaCount : userMinReplicaCount); - } - - @Test(groups = "unit") - public void readAny() { - List secondaries = ImmutableList.of(URI.create("secondary1"), URI.create("secondary2"), URI.create("secondary3")); - URI primaryAddress = URI.create("primary"); - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryAddress) - .withSecondary(secondaries) - .build(); - - StoreResponse primaryResponse = StoreResponseBuilder.create() - .withLSN(54) - .withLocalLSN(18) - .withRequestCharge(1.1) - .build(); - StoreResponse secondaryResponse1 = StoreResponseBuilder.create() - .withLSN(53) - .withLocalLSN(17) - .withRequestCharge(1.1) - .build(); - StoreResponse secondaryResponse2 = StoreResponseBuilder.create() - .withLSN(52) - .withLocalLSN(16) - .withRequestCharge(1.1) - .build(); - StoreResponse secondaryResponse3 = StoreResponseBuilder.create() - .withLSN(51) - .withLocalLSN(15) - .withRequestCharge(1.1) - .build(); - TransportClientWrapper transportClientWrapper = TransportClientWrapper.Builder.uriToResultBuilder() - .storeResponseOn(primaryAddress, OperationType.Read, ResourceType.Document, primaryResponse, true) - .storeResponseOn(secondaries.get(0), OperationType.Read, ResourceType.Document, secondaryResponse1, true) - .storeResponseOn(secondaries.get(1), OperationType.Read, ResourceType.Document, secondaryResponse2, true) - .storeResponseOn(secondaries.get(2), OperationType.Read, ResourceType.Document, secondaryResponse3, true) - .build(); - - GatewayServiceConfiguratorReaderMock gatewayServiceConfigurationReaderWrapper = GatewayServiceConfiguratorReaderMock.from(ConsistencyLevel.Strong); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - - IAuthorizationTokenProvider authorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - ConsistencyReaderUnderTest consistencyReader = new ConsistencyReaderUnderTest(addressSelectorWrapper.addressSelector, - sessionContainer, - transportClientWrapper.transportClient, - gatewayServiceConfigurationReaderWrapper.gatewayServiceConfigurationReader, - authorizationTokenProvider); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - request.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Eventual.name()); - - TimeoutHelper timeout = Mockito.mock(TimeoutHelper.class); - boolean forceRefresh = false; - boolean isInRetry = false; - Single storeResponseSingle = consistencyReader.readAsync(request, timeout, isInRetry, forceRefresh); - - StoreResponseValidator validator = StoreResponseValidator.create() - .withBELSNGreaterThanOrEqualTo(51) - .withRequestCharge(1.1) - .in(primaryResponse, secondaryResponse1, secondaryResponse2, secondaryResponse3) - .build(); - validateSuccess(storeResponseSingle, validator); - - Mockito.verifyZeroInteractions(consistencyReader.getSpyQuorumReader()); - - - Mockito.verify(consistencyReader.getSpyStoreReader(), Mockito.times(1)) - .readMultipleReplicaAsync(Mockito.any(RxDocumentServiceRequest.class), - Mockito.anyBoolean(), - Mockito.anyInt(), - Mockito.anyBoolean(), - Mockito.anyBoolean(), - Mockito.any(), - Mockito.anyBoolean(), - Mockito.anyBoolean()); - - transportClientWrapper.validate() - .verifyNumberOfInvocations(1); - - addressSelectorWrapper.validate() - .verifyTotalInvocations(1) - .verifyNumberOfForceCachRefresh(0) - .verifyVesolvePrimaryUriAsyncCount(0) - .verifyResolveAllUriAsync(1); - } - - @Test(groups = "unit") - public void readSessionConsistency_SomeReplicasLagBehindAndReturningResponseWithLowerLSN_FindAnotherReplica() { - long slowReplicaLSN = 651176; - String partitionKeyRangeId = "1"; - long fasterReplicaLSN = 651177; - - List secondaries = ImmutableList.of(URI.create("secondary1"), URI.create("secondary2"), URI.create("secondary3")); - URI primaryAddress = URI.create("primary"); - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryAddress) - .withSecondary(secondaries) - .build(); - - StoreResponse primaryResponse = StoreResponseBuilder.create() - .withSessionToken(partitionKeyRangeId + ":-1#" + slowReplicaLSN) - .withLSN(slowReplicaLSN) - .withLocalLSN(slowReplicaLSN) - .withQuorumAckecdLsn(slowReplicaLSN) - .withQuorumAckecdLocalLsn(slowReplicaLSN) - .withGlobalCommittedLsn(-1) - .withItemLocalLSN(slowReplicaLSN) - .withRequestCharge(1.1) - .build(); - StoreResponse secondaryResponse1 = StoreResponseBuilder.create() - .withSessionToken(partitionKeyRangeId + ":-1#" + slowReplicaLSN) - .withLSN(slowReplicaLSN) - .withLocalLSN(slowReplicaLSN) - .withQuorumAckecdLsn(slowReplicaLSN) - .withQuorumAckecdLocalLsn(slowReplicaLSN) - .withGlobalCommittedLsn(-1) - .withItemLocalLSN(slowReplicaLSN) - .withRequestCharge(1.1) - .build(); - StoreResponse secondaryResponse2 = StoreResponseBuilder.create() - .withSessionToken(partitionKeyRangeId + ":-1#" + fasterReplicaLSN) - .withLSN(fasterReplicaLSN) - .withLocalLSN(fasterReplicaLSN) - .withQuorumAckecdLsn(fasterReplicaLSN) - .withQuorumAckecdLocalLsn(fasterReplicaLSN) - .withGlobalCommittedLsn(-1) - .withItemLocalLSN(fasterReplicaLSN) - .withRequestCharge(1.1) - .build(); - StoreResponse secondaryResponse3 = StoreResponseBuilder.create() - .withSessionToken(partitionKeyRangeId + ":-1#" + slowReplicaLSN) - .withLSN(slowReplicaLSN) - .withLocalLSN(slowReplicaLSN) - .withQuorumAckecdLsn(slowReplicaLSN) - .withQuorumAckecdLocalLsn(slowReplicaLSN) - .withGlobalCommittedLsn(-1) - .withItemLocalLSN(slowReplicaLSN) - .withRequestCharge(1.1) - .build(); - TransportClientWrapper transportClientWrapper = TransportClientWrapper.Builder.uriToResultBuilder() - .storeResponseOn(primaryAddress, OperationType.Read, ResourceType.Document, primaryResponse, true) - .storeResponseOn(secondaries.get(0), OperationType.Read, ResourceType.Document, secondaryResponse1, true) - .storeResponseOn(secondaries.get(1), OperationType.Read, ResourceType.Document, secondaryResponse2, true) - .storeResponseOn(secondaries.get(2), OperationType.Read, ResourceType.Document, secondaryResponse3, true) - .build(); - - GatewayServiceConfiguratorReaderMock gatewayServiceConfigurationReaderWrapper = GatewayServiceConfiguratorReaderMock.from(ConsistencyLevel.Strong); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - - IAuthorizationTokenProvider authorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - ConsistencyReaderUnderTest consistencyReader = new ConsistencyReaderUnderTest(addressSelectorWrapper.addressSelector, - sessionContainer, - transportClientWrapper.transportClient, - gatewayServiceConfigurationReaderWrapper.gatewayServiceConfigurationReader, - authorizationTokenProvider); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - request.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Session.name()); - request.requestContext = new DocumentServiceRequestContext(); - Utils.ValueHolder sessionToken = Utils.ValueHolder.initialize(null); - assertThat(VectorSessionToken.tryCreate("-1#" + fasterReplicaLSN , sessionToken)).isTrue(); - request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - request.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId(partitionKeyRangeId); - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - - Mockito.doReturn(sessionToken.v).when(sessionContainer).resolvePartitionLocalSessionToken(Mockito.eq(request), Mockito.anyString()); - - - TimeoutHelper timeout = Mockito.mock(TimeoutHelper.class); - boolean forceRefresh = false; - boolean isInRetry = false; - Single storeResponseSingle = consistencyReader.readAsync(request, timeout, isInRetry, forceRefresh); - - StoreResponseValidator validator = StoreResponseValidator.create() - .withBELSN(fasterReplicaLSN) - .withRequestChargeGreaterThanOrEqualTo(1.1) - .in(primaryResponse, secondaryResponse1, secondaryResponse2, secondaryResponse3) - .build(); - validateSuccess(storeResponseSingle, validator); - - Mockito.verifyZeroInteractions(consistencyReader.getSpyQuorumReader()); - - - Mockito.verify(consistencyReader.getSpyStoreReader(), Mockito.times(1)) - .readMultipleReplicaAsync(Mockito.any(RxDocumentServiceRequest.class), - Mockito.anyBoolean(), - Mockito.anyInt(), - Mockito.anyBoolean(), - Mockito.anyBoolean(), - Mockito.any(), - Mockito.anyBoolean(), - Mockito.anyBoolean()); - - assertThat(transportClientWrapper.validate() - .getNumberOfInvocations()) - .isGreaterThanOrEqualTo(1) - .isLessThanOrEqualTo(4); - - addressSelectorWrapper.validate() - .verifyTotalInvocations(1) - .verifyNumberOfForceCachRefresh(0) - .verifyVesolvePrimaryUriAsyncCount(0) - .verifyResolveAllUriAsync(1); - } - - /** - * reading in session consistency, if the requested session token cannot be supported by some replicas - * tries others till we find a replica which can support the given session token - */ - @Test(groups = "unit") - public void sessionNotAvailableFromSomeReplicasThrowingNotFound_FindReplicaSatisfyingRequestedSession() { - long slowReplicaLSN = 651175; - long globalCommittedLsn = 651174; - - long fasterReplicaLSN = 651176; - String partitionKeyRangeId = "1"; - - NotFoundException foundException = new NotFoundException(); - foundException.getResponseHeaders().put(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":-1#" + slowReplicaLSN); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.LSN, Long.toString(slowReplicaLSN)); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.LOCAL_LSN, Long.toString(slowReplicaLSN)); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, Long.toString(globalCommittedLsn)); - - StoreResponse storeResponse = StoreResponseBuilder.create() - .withSessionToken(partitionKeyRangeId + ":-1#" + fasterReplicaLSN) - .withLSN(fasterReplicaLSN) - .withLocalLSN(fasterReplicaLSN) - .withQuorumAckecdLsn(fasterReplicaLSN) - .withQuorumAckecdLocalLsn(fasterReplicaLSN) - .withGlobalCommittedLsn(-1) - .withItemLocalLSN(fasterReplicaLSN) - .withRequestCharge(1.1) - .build(); - - TransportClientWrapper transportClientWrapper = new TransportClientWrapper.Builder.ReplicaResponseBuilder - .SequentialBuilder() - .then(foundException) // 1st replica read returns not found - .then(foundException) // 2nd replica read returns not found - .then(foundException) // 3rd replica read returns not found - .then(storeResponse) // 4th replica read returns storeResponse satisfying requested session token - .build(); - - URI primaryUri = URI.create("primary"); - URI secondaryUri1 = URI.create("secondary1"); - URI secondaryUri2 = URI.create("secondary2"); - URI secondaryUri3 = URI.create("secondary3"); - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryUri) - .withSecondary(ImmutableList.of(secondaryUri1, secondaryUri2, secondaryUri3)) - .build(); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - - Configs configs = new Configs(); - GatewayServiceConfiguratorReaderMock gatewayServiceConfigurationReaderWrapper = GatewayServiceConfiguratorReaderMock.from(ConsistencyLevel.Strong, - 4, - 3, - 4, - 3); - - IAuthorizationTokenProvider authTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - ConsistencyReader consistencyReader = new ConsistencyReader(configs, - addressSelectorWrapper.addressSelector, - sessionContainer, - transportClientWrapper.transportClient, - gatewayServiceConfigurationReaderWrapper.gatewayServiceConfigurationReader, - authTokenProvider); - - - TimeoutHelper timeoutHelper = Mockito.mock(TimeoutHelper.class); - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Session.name()); - dsr.requestContext = new DocumentServiceRequestContext(); - Utils.ValueHolder sessionToken = Utils.ValueHolder.initialize(null); - assertThat(VectorSessionToken.tryCreate("-1#" + fasterReplicaLSN , sessionToken)).isTrue(); - dsr.requestContext.timeoutHelper = timeoutHelper; - dsr.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId(partitionKeyRangeId); - dsr.requestContext.requestChargeTracker = new RequestChargeTracker(); - - Mockito.doReturn(sessionToken.v).when(sessionContainer).resolvePartitionLocalSessionToken(Mockito.eq(dsr), Mockito.anyString()); - - Single storeResponseSingle = consistencyReader.readAsync(dsr, timeoutHelper, false, false); - - StoreResponseValidator validator = StoreResponseValidator.create().isSameAs(storeResponse).isSameAs(storeResponse).build(); - validateSuccess(storeResponseSingle, validator); - } - - /** - * Reading with session consistency, replicas have session token with higher than requested and return not found - */ - @Test(groups = "unit") - public void sessionRead_LegitimateNotFound() { - long lsn = 651175; - long globalCommittedLsn = 651174; - String partitionKeyRangeId = "73"; - - NotFoundException foundException = new NotFoundException(); - foundException.getResponseHeaders().put(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":-1#" + lsn); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.LSN, Long.toString(lsn)); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.LOCAL_LSN, Long.toString(lsn)); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, Long.toString(globalCommittedLsn)); - - TransportClientWrapper transportClientWrapper = new TransportClientWrapper.Builder.ReplicaResponseBuilder - .SequentialBuilder() - .then(foundException) // 1st replica read returns not found lsn(response) >= lsn(request) - .then(foundException) // 2nd replica read returns not found lsn(response) >= lsn(request) - .then(foundException) // 3rd replica read returns not found lsn(response) >= lsn(request) - .then(foundException) // 4th replica read returns not found lsn(response) >= lsn(request) - .build(); - - URI primaryUri = URI.create("primary"); - URI secondaryUri1 = URI.create("secondary1"); - URI secondaryUri2 = URI.create("secondary2"); - URI secondaryUri3 = URI.create("secondary3"); - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryUri) - .withSecondary(ImmutableList.of(secondaryUri1, secondaryUri2, secondaryUri3)) - .build(); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - TimeoutHelper timeoutHelper = Mockito.mock(TimeoutHelper.class); - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Session.name()); - dsr.requestContext = new DocumentServiceRequestContext(); - Utils.ValueHolder sessionToken = Utils.ValueHolder.initialize(null); - assertThat(VectorSessionToken.tryCreate("-1#" + lsn , sessionToken)).isTrue(); - dsr.requestContext.timeoutHelper = timeoutHelper; - dsr.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId(partitionKeyRangeId); - dsr.requestContext.requestChargeTracker = new RequestChargeTracker(); - - Mockito.doReturn(sessionToken.v).when(sessionContainer).resolvePartitionLocalSessionToken(Mockito.eq(dsr), Mockito.anyString()); - - Configs configs = new Configs(); - GatewayServiceConfiguratorReaderMock gatewayServiceConfigurationReaderWrapper = GatewayServiceConfiguratorReaderMock.from(ConsistencyLevel.Strong, - 4, - 3, - 4, - 3); - - IAuthorizationTokenProvider authTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - ConsistencyReader consistencyReader = new ConsistencyReader(configs, - addressSelectorWrapper.addressSelector, - sessionContainer, - transportClientWrapper.transportClient, - gatewayServiceConfigurationReaderWrapper.gatewayServiceConfigurationReader, - authTokenProvider); - - Single storeResponseSingle = consistencyReader.readAsync(dsr, timeoutHelper, false, false); - - FailureValidator failureValidator = FailureValidator.builder().resourceNotFound().instanceOf(NotFoundException.class).unknownSubStatusCode().build(); - validateException(storeResponseSingle, failureValidator); - } - - /** - * reading in session consistency, no replica support requested lsn - */ - @Test(groups = "unit") - public void sessionRead_ReplicasDoNotHaveTheRequestedLSN() { - long lsn = 651175; - long globalCommittedLsn = 651174; - String partitionKeyRangeId = "73"; - NotFoundException foundException = new NotFoundException(); - foundException.getResponseHeaders().put(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":-1#" + lsn); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.LSN, Long.toString(651175)); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.LOCAL_LSN, Long.toString(651175)); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, Long.toString(globalCommittedLsn)); - - TransportClientWrapper transportClientWrapper = new TransportClientWrapper.Builder.ReplicaResponseBuilder - .SequentialBuilder() - .then(foundException) // 1st replica read lsn lags behind the request lsn - .then(foundException) // 2nd replica read lsn lags behind the request lsn - .then(foundException) // 3rd replica read lsn lags behind the request lsn - .then(foundException) // 4th replica read lsn lags behind the request lsn - .build(); - - URI primaryUri = URI.create("primary"); - URI secondaryUri1 = URI.create("secondary1"); - URI secondaryUri2 = URI.create("secondary2"); - URI secondaryUri3 = URI.create("secondary3"); - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryUri) - .withSecondary(ImmutableList.of(secondaryUri1, secondaryUri2, secondaryUri3)) - .build(); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - TimeoutHelper timeoutHelper = Mockito.mock(TimeoutHelper.class); - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Session.name()); - dsr.requestContext = new DocumentServiceRequestContext(); - Utils.ValueHolder sessionToken = Utils.ValueHolder.initialize(null); - assertThat(VectorSessionToken.tryCreate("-1#" + (lsn + 1) , sessionToken)).isTrue(); - dsr.requestContext.timeoutHelper = timeoutHelper; - dsr.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId(partitionKeyRangeId); - dsr.requestContext.requestChargeTracker = new RequestChargeTracker(); - - Mockito.doReturn(sessionToken.v).when(sessionContainer).resolvePartitionLocalSessionToken(Mockito.eq(dsr), Mockito.anyString()); - - Configs configs = new Configs(); - GatewayServiceConfiguratorReaderMock gatewayServiceConfigurationReaderWrapper = GatewayServiceConfiguratorReaderMock.from(ConsistencyLevel.Strong, - 4, - 3, - 4, - 3); - - IAuthorizationTokenProvider authTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - ConsistencyReader consistencyReader = new ConsistencyReader(configs, - addressSelectorWrapper.addressSelector, - sessionContainer, - transportClientWrapper.transportClient, - gatewayServiceConfigurationReaderWrapper.gatewayServiceConfigurationReader, - authTokenProvider); - - Single storeResponseSingle = consistencyReader.readAsync(dsr, timeoutHelper, false, false); - - FailureValidator failureValidator = FailureValidator.builder().resourceNotFound().instanceOf(NotFoundException.class).subStatusCode(HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE).build(); - validateException(storeResponseSingle, failureValidator); - } - - @Test(groups = "unit") - public void requestRateTooLarge_BubbleUp() { - long lsn = 651175; - long globalCommittedLsn = 651174; - String partitionKeyRangeId = "73"; - - RequestRateTooLargeException requestTooLargeException = new RequestRateTooLargeException(); - requestTooLargeException.getResponseHeaders().put(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":-1#" + lsn); - requestTooLargeException.getResponseHeaders().put(WFConstants.BackendHeaders.LSN, Long.toString(651175)); - requestTooLargeException.getResponseHeaders().put(WFConstants.BackendHeaders.LOCAL_LSN, Long.toString(651175)); - requestTooLargeException.getResponseHeaders().put(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, Long.toString(globalCommittedLsn)); - - TransportClientWrapper transportClientWrapper = new TransportClientWrapper.Builder.ReplicaResponseBuilder - .SequentialBuilder() - .then(requestTooLargeException) // 1st replica read result in throttling - .then(requestTooLargeException) // 2nd replica read result in throttling - .then(requestTooLargeException) // 3rd replica read result in throttling - .then(requestTooLargeException) // 4th replica read result in throttling - .build(); - - URI primaryUri = URI.create("primary"); - URI secondaryUri1 = URI.create("secondary1"); - URI secondaryUri2 = URI.create("secondary2"); - URI secondaryUri3 = URI.create("secondary3"); - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryUri) - .withSecondary(ImmutableList.of(secondaryUri1, secondaryUri2, secondaryUri3)) - .build(); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - TimeoutHelper timeoutHelper = Mockito.mock(TimeoutHelper.class); - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Session.name()); - dsr.requestContext = new DocumentServiceRequestContext(); - Utils.ValueHolder sessionToken = Utils.ValueHolder.initialize(null); - assertThat(VectorSessionToken.tryCreate("-1#" + lsn , sessionToken)).isTrue(); - dsr.requestContext.timeoutHelper = timeoutHelper; - dsr.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId(partitionKeyRangeId); - dsr.requestContext.requestChargeTracker = new RequestChargeTracker(); - - Mockito.doReturn(sessionToken.v).when(sessionContainer).resolvePartitionLocalSessionToken(Mockito.eq(dsr), Mockito.anyString()); - - Configs configs = new Configs(); - GatewayServiceConfiguratorReaderMock gatewayServiceConfigurationReaderWrapper = GatewayServiceConfiguratorReaderMock.from(ConsistencyLevel.Strong, - 4, - 3, - 4, - 3); - - IAuthorizationTokenProvider authTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - ConsistencyReader consistencyReader = new ConsistencyReader(configs, - addressSelectorWrapper.addressSelector, - sessionContainer, - transportClientWrapper.transportClient, - gatewayServiceConfigurationReaderWrapper.gatewayServiceConfigurationReader, - authTokenProvider); - - Single storeResponseSingle = consistencyReader.readAsync(dsr, timeoutHelper, false, false); - - - FailureValidator failureValidator = FailureValidator.builder().instanceOf(RequestRateTooLargeException.class).unknownSubStatusCode().build(); - validateException(storeResponseSingle, failureValidator); - } - - @DataProvider(name = "simpleReadStrongArgProvider") - public Object[][] simpleReadStrongArgProvider() { - return new Object[][]{ - { 1, ReadMode.Strong }, - { 2, ReadMode.Strong }, - { 3, ReadMode.Strong }, - }; - } - - @Test(groups = "unit", dataProvider = "simpleReadStrongArgProvider") - public void basicReadStrong_AllReplicasSameLSN(int replicaCountToRead, ReadMode readMode) { - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - URI primaryReplicaURI = URI.create("primary"); - ImmutableList secondaryReplicaURIs = ImmutableList.of(URI.create("secondary1"), URI.create("secondary2"), URI.create("secondary3")); - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryReplicaURI) - .withSecondary(secondaryReplicaURIs) - .build(); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - - request.requestContext = new DocumentServiceRequestContext(); - request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - request.requestContext.resolvedPartitionKeyRange = Mockito.mock(PartitionKeyRange.class); - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - - BigDecimal requestChargePerRead = new BigDecimal(1.1); - - StoreResponse primaryResponse = StoreResponseBuilder.create() - .withLSN(51) - .withLocalLSN(18) - .withRequestCharge(requestChargePerRead.doubleValue()) - .build(); - StoreResponse secondaryResponse1 = StoreResponseBuilder.create() - .withLSN(51) - .withLocalLSN(18) - .withRequestCharge(requestChargePerRead.doubleValue()) - .build(); - StoreResponse secondaryResponse2 = StoreResponseBuilder.create() - .withLSN(51) - .withLocalLSN(18) - .withRequestCharge(requestChargePerRead.doubleValue()) - .build(); - StoreResponse secondaryResponse3 = StoreResponseBuilder.create() - .withLSN(51) - .withLocalLSN(18) - .withRequestCharge(requestChargePerRead.doubleValue()) - .build(); - - TransportClientWrapper transportClientWrapper = TransportClientWrapper.Builder.uriToResultBuilder() - .storeResponseOn(primaryReplicaURI, OperationType.Read, ResourceType.Document, primaryResponse, false) - .storeResponseOn(secondaryReplicaURIs.get(0), OperationType.Read, ResourceType.Document, secondaryResponse1, false) - .storeResponseOn(secondaryReplicaURIs.get(1), OperationType.Read, ResourceType.Document, secondaryResponse2, false) - .storeResponseOn(secondaryReplicaURIs.get(2), OperationType.Read, ResourceType.Document, secondaryResponse3, false) - .build(); - - StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer); - GatewayServiceConfigurationReader serviceConfigurator = Mockito.mock(GatewayServiceConfigurationReader.class); - IAuthorizationTokenProvider authTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - QuorumReader quorumReader = new QuorumReader(configs, transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, storeReader, serviceConfigurator, authTokenProvider); - - Single storeResponseSingle = quorumReader.readStrongAsync(request, replicaCountToRead, readMode); - - StoreResponseValidator validator = StoreResponseValidator.create() - .withBELSN(51) - .withRequestCharge(requestChargePerRead.multiply(BigDecimal.valueOf(replicaCountToRead)).setScale(2, RoundingMode.FLOOR).doubleValue()) - .build(); - validateSuccess(storeResponseSingle, validator); - - transportClientWrapper.validate() - .verifyNumberOfInvocations(replicaCountToRead); - addressSelectorWrapper.validate() - .verifyNumberOfForceCachRefresh(0) - .verifyVesolvePrimaryUriAsyncCount(0) - .verifyTotalInvocations(1); - } - - // TODO: add more mocking tests for when one replica lags behind and we need to do barrier request. - - public static void validateSuccess(Single> single, - MultiStoreResultValidator validator) { - validateSuccess(single, validator, 10000); - } - - public static void validateSuccess(Single> single, - MultiStoreResultValidator validator, - long timeout) { - TestSubscriber> testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - public static void validateSuccess(Single single, - StoreResponseValidator validator) { - validateSuccess(single, validator, 10000); - } - - public static void validateSuccess(Single single, - StoreResponseValidator validator, - long timeout) { - TestSubscriber testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - - public static void validateException(Single single, - FailureValidator validator, - long timeout) { - TestSubscriber testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - validator.validate(testSubscriber.getOnErrorEvents().get(0)); - } - - public static void validateException(Single single, - FailureValidator validator) { - validateException(single, validator, TIMEOUT); - } - - private PartitionKeyRange partitionKeyRangeWithId(String id) { - PartitionKeyRange partitionKeyRange = Mockito.mock(PartitionKeyRange.class); - Mockito.doReturn(id).when(partitionKeyRange).getId(); - return partitionKeyRange; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyReaderUnderTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyReaderUnderTest.java deleted file mode 100644 index 4f35b9c0e973..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyReaderUnderTest.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import org.mockito.Mockito; - -public class ConsistencyReaderUnderTest extends ConsistencyReader { - private QuorumReader origQuorumReader; - private QuorumReader spyQuorumReader; - - private StoreReaderUnderTest origStoreReader; - private StoreReaderUnderTest spyStoreReader; - - public ConsistencyReaderUnderTest(AddressSelector addressSelector, - ISessionContainer sessionContainer, - TransportClient transportClient, - GatewayServiceConfigurationReader serviceConfigReader, - IAuthorizationTokenProvider authorizationTokenProvider) { - super(new Configs(), addressSelector, sessionContainer, transportClient, serviceConfigReader, authorizationTokenProvider); - - } - - public QuorumReader getOrigQuorumReader() { - return origQuorumReader; - } - - public QuorumReader getSpyQuorumReader() { - return spyQuorumReader; - } - - public StoreReaderUnderTest getOrigStoreReader() { - return origStoreReader; - } - - public StoreReaderUnderTest getSpyStoreReader() { - return spyStoreReader; - } - - @Override - QuorumReader createQuorumReader(TransportClient transportClient, - AddressSelector addressSelector, - StoreReader storeReader, - GatewayServiceConfigurationReader serviceConfigurationReader, - IAuthorizationTokenProvider authorizationTokenProvider) { - this.origQuorumReader = super.createQuorumReader(transportClient, - addressSelector, - storeReader, - serviceConfigurationReader, - authorizationTokenProvider); - this.spyQuorumReader = Mockito.spy(this.origQuorumReader); - return this.spyQuorumReader; - } - - @Override - StoreReader createStoreReader(TransportClient transportClient, - AddressSelector addressSelector, - ISessionContainer sessionContainer) { - this.origStoreReader = new StoreReaderUnderTest(transportClient, addressSelector, sessionContainer); - this.spyStoreReader = Mockito.spy(this.origStoreReader); - return this.spyStoreReader; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyWriterTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyWriterTest.java deleted file mode 100644 index 02f5b97aef37..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ConsistencyWriterTest.java +++ /dev/null @@ -1,297 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.collect.ImmutableList; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.internal.DocumentServiceRequestContext; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionIsMigratingException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionKeyRangeIsSplittingException; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import rx.Single; -import rx.observers.TestSubscriber; -import rx.subjects.PublishSubject; - -import java.net.URI; -import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.CyclicBarrier; -import java.util.concurrent.TimeUnit; - -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.StatusCodes.GONE; -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.SubStatusCodes.COMPLETING_PARTITION_MIGRATION; -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.SubStatusCodes.COMPLETING_SPLIT; -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.SubStatusCodes.PARTITION_KEY_RANGE_GONE; -import static org.assertj.core.api.Assertions.assertThat; - -public class ConsistencyWriterTest { - - private AddressSelector addressSelector; - private ISessionContainer sessionContainer; - private TransportClient transportClient; - private GatewayServiceConfigurationReader serviceConfigReader; - private ConsistencyWriter consistencyWriter; - - @DataProvider(name = "exceptionArgProvider") - public Object[][] exceptionArgProvider() { - return new Object[][]{ - // exception to be thrown from transportClient, expected (exception type, status, subStatus) - { new PartitionKeyRangeGoneException(), PartitionKeyRangeGoneException.class, GONE, PARTITION_KEY_RANGE_GONE, }, - { new PartitionKeyRangeIsSplittingException() , PartitionKeyRangeIsSplittingException.class, GONE, COMPLETING_SPLIT, }, - { new PartitionIsMigratingException(), PartitionIsMigratingException.class, GONE, COMPLETING_PARTITION_MIGRATION, }, - }; - } - - @Test(groups = "unit", dataProvider = "exceptionArgProvider") - public void exception(Exception ex, Class klass, int expectedStatusCode, Integer expectedSubStatusCode) { - TransportClientWrapper transportClientWrapper = new TransportClientWrapper.Builder.ReplicaResponseBuilder - .SequentialBuilder() - .then(ex) - .build(); - - URI primaryUri = URI.create("primary"); - URI secondaryUri1 = URI.create("secondary1"); - URI secondaryUri2 = URI.create("secondary2"); - URI secondaryUri3 = URI.create("secondary3"); - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryUri) - .withSecondary(ImmutableList.of(secondaryUri1, secondaryUri2, secondaryUri3)) - .build(); - sessionContainer = Mockito.mock(ISessionContainer.class); - IAuthorizationTokenProvider authorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - serviceConfigReader = Mockito.mock(GatewayServiceConfigurationReader.class); - - consistencyWriter = new ConsistencyWriter( - addressSelectorWrapper.addressSelector, - sessionContainer, - transportClientWrapper.transportClient, - authorizationTokenProvider, - serviceConfigReader, - false); - - TimeoutHelper timeoutHelper = Mockito.mock(TimeoutHelper.class); - RxDocumentServiceRequest dsr = Mockito.mock(RxDocumentServiceRequest.class); - dsr.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - - Single res = consistencyWriter.writeAsync(dsr, timeoutHelper, false); - - FailureValidator failureValidator = FailureValidator.builder() - .instanceOf(klass) - .statusCode(expectedStatusCode) - .subStatusCode(expectedSubStatusCode) - .build(); - - TestSubscriber subscriber = new TestSubscriber<>(); - res.subscribe(subscriber); - subscriber.awaitTerminalEvent(); - subscriber.assertNotCompleted(); - assertThat(subscriber.getOnErrorEvents()).hasSize(1); - failureValidator.validate(subscriber.getOnErrorEvents().get(0)); - } - - @Test(groups = "unit") - public void startBackgroundAddressRefresh() throws Exception { - initializeConsistencyWriter(false); - - CyclicBarrier b = new CyclicBarrier(2); - PublishSubject subject = PublishSubject.create(); - CountDownLatch c = new CountDownLatch(1); - - URI uri = URI.create("https://localhost:5050"); - - List invocationOnMocks = Collections.synchronizedList(new ArrayList<>()); - Mockito.doAnswer(new Answer() { - @Override - public Single answer(InvocationOnMock invocationOnMock) { - invocationOnMocks.add(invocationOnMock); - return subject.toSingle().doOnSuccess(x -> c.countDown()).doAfterTerminate(() -> { - new Thread() { - @Override - public void run() { - try { - b.await(); - } catch (Exception e) { - - } - } - }.start(); - }); - } - }).when(addressSelector).resolvePrimaryUriAsync(Mockito.any(RxDocumentServiceRequest.class), Mockito.anyBoolean()); - RxDocumentServiceRequest request = Mockito.mock(RxDocumentServiceRequest.class); - consistencyWriter.startBackgroundAddressRefresh(request); - - subject.onNext(uri); - subject.onCompleted(); - - TimeUnit.MILLISECONDS.sleep(1000); - assertThat(c.getCount()).isEqualTo(0); - assertThat(b.getNumberWaiting()).isEqualTo(1); - b.await(1000, TimeUnit.MILLISECONDS); - assertThat(invocationOnMocks).hasSize(1); - assertThat(invocationOnMocks.get(0).getArgumentAt(1, Boolean.class)).isTrue(); - } - - @Test(groups = "unit") - public void getLsnAndGlobalCommittedLsn() { - ImmutableList.Builder> builder = new ImmutableList.Builder<>(); - builder.add(new AbstractMap.SimpleEntry<>(WFConstants.BackendHeaders.LSN, "3")); - builder.add(new AbstractMap.SimpleEntry<>(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, "2")); - ImmutableList> headers = builder.build(); - - StoreResponse sr = new StoreResponse(0, headers, (String) null); - Utils.ValueHolder lsn = Utils.ValueHolder.initialize(-2l); - Utils.ValueHolder globalCommittedLsn = Utils.ValueHolder.initialize(-2l); - ConsistencyWriter.getLsnAndGlobalCommittedLsn(sr, lsn, globalCommittedLsn); - assertThat(lsn.v).isEqualTo(3); - assertThat(globalCommittedLsn.v).isEqualTo(2); - } - - - @Test(groups = "unit") - public void timeout1() throws Exception { - initializeConsistencyWriter(false); - TimeoutHelper timeoutHelper = Mockito.mock(TimeoutHelper.class); - Mockito.doReturn(true).when(timeoutHelper).isElapsed(); - ConsistencyWriter spyConsistencyWriter = Mockito.spy(this.consistencyWriter); - TestSubscriber subscriber = new TestSubscriber(); - - spyConsistencyWriter.writeAsync(Mockito.mock(RxDocumentServiceRequest.class), timeoutHelper, false) - .toObservable() - .subscribe(subscriber); - - subscriber.awaitTerminalEvent(10, TimeUnit.MILLISECONDS); - subscriber.assertNoValues(); - - subscriber.assertError(RequestTimeoutException.class); - } - - @Test(groups = "unit") - public void timeout2() throws Exception { - initializeConsistencyWriter(false); - TimeoutHelper timeoutHelper = Mockito.mock(TimeoutHelper.class); - Mockito.doReturn(false).doReturn(true).when(timeoutHelper).isElapsed(); - ConsistencyWriter spyConsistencyWriter = Mockito.spy(this.consistencyWriter); - TestSubscriber subscriber = new TestSubscriber(); - - spyConsistencyWriter.writeAsync(Mockito.mock(RxDocumentServiceRequest.class), timeoutHelper, false) - .toObservable() - .subscribe(subscriber); - - subscriber.awaitTerminalEvent(10, TimeUnit.MILLISECONDS); - subscriber.assertError(RequestTimeoutException.class); - } - - @DataProvider(name = "globalStrongArgProvider") - public Object[][] globalStrongArgProvider() { - return new Object[][]{ - { - ConsistencyLevel.Session, - Mockito.mock(RxDocumentServiceRequest.class), - Mockito.mock(StoreResponse.class), - - false, - }, - { - ConsistencyLevel.Eventual, - Mockito.mock(RxDocumentServiceRequest.class), - Mockito.mock(StoreResponse.class), - - false, - }, - { - - ConsistencyLevel.Eventual, - Mockito.mock(RxDocumentServiceRequest.class), - StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, Integer.toString(5)) - .build(), - false, - }, - { - - ConsistencyLevel.Strong, - Mockito.mock(RxDocumentServiceRequest.class), - StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, Integer.toString(5)) - .build(), - true, - }, - { - - ConsistencyLevel.Strong, - Mockito.mock(RxDocumentServiceRequest.class), - StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, Integer.toString(0)) - .build(), - false, - } - }; - } - - @Test(groups = "unit", dataProvider = "globalStrongArgProvider") - public void isGlobalStrongRequest(ConsistencyLevel defaultConsistencyLevel, RxDocumentServiceRequest req, StoreResponse storeResponse, boolean isGlobalStrongExpected) { - initializeConsistencyWriter(false); - Mockito.doReturn(defaultConsistencyLevel).when(this.serviceConfigReader).getDefaultConsistencyLevel(); - - - assertThat(consistencyWriter.isGlobalStrongRequest(req, storeResponse)).isEqualTo(isGlobalStrongExpected); - } - - private void initializeConsistencyWriter(boolean useMultipleWriteLocation) { - addressSelector = Mockito.mock(AddressSelector.class); - sessionContainer = Mockito.mock(ISessionContainer.class); - transportClient = Mockito.mock(TransportClient.class); - IAuthorizationTokenProvider authorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - serviceConfigReader = Mockito.mock(GatewayServiceConfigurationReader.class); - - consistencyWriter = new ConsistencyWriter( - addressSelector, - sessionContainer, - transportClient, - authorizationTokenProvider, - serviceConfigReader, - useMultipleWriteLocation); - } - - // TODO: add more mocking unit tests for Global Strong (mocking unit tests) - // TODO: add more tests for Session behaviour (mocking unit tests) - // TODO: add more tests for error handling behaviour (mocking unit tests) - // TODO: add tests for replica catch up (request barrier while loop) (mocking unit tests) - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/320977 -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/EndpointMock.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/EndpointMock.java deleted file mode 100644 index d2d709b3bb18..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/EndpointMock.java +++ /dev/null @@ -1,279 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.collect.ImmutableList; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.apache.commons.collections.map.HashedMap; - -import java.net.URI; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -abstract public class EndpointMock { - - TransportClientWrapper transportClientWrapper; - AddressSelectorWrapper addressSelectorWrapper; - - public EndpointMock(AddressSelectorWrapper addressSelectorWrapper, TransportClientWrapper transportClientWrapper) { - this.addressSelectorWrapper = addressSelectorWrapper; - this.transportClientWrapper = transportClientWrapper; - } - - public static class EndpointMockVerificationBuilder { - public static EndpointMockVerificationBuilder builder() { - return new EndpointMockVerificationBuilder(); - } - - private AddressSelectorWrapper.InOrderVerificationBuilder addressSelectorVerificationBuilder; - private TransportClientWrapper.TransportClientWrapperVerificationBuilder transportClientValidation; - - public EndpointMockVerificationBuilder withAddressSelectorValidation(AddressSelectorWrapper.InOrderVerificationBuilder addressSelectorBuilder) { - addressSelectorVerificationBuilder = addressSelectorBuilder; - return this; - } - - public EndpointMockVerificationBuilder withTransportClientValidation(TransportClientWrapper.TransportClientWrapperVerificationBuilder transportClientValidation) { - this.transportClientValidation = transportClientValidation; - return this; - } - - public void execute(EndpointMock endpointMock) { - this.addressSelectorVerificationBuilder.execute(endpointMock.addressSelectorWrapper); - this.transportClientValidation.execute(endpointMock.transportClientWrapper); - } - } - - - public void validate(EndpointMockVerificationBuilder verificationBuilder) { - this.addressSelectorWrapper.validate(); - this.transportClientWrapper.validate(); - if (verificationBuilder != null) { - verificationBuilder.execute(this); - } - } - - public static Builder.NoSecondaryReplica noSecondaryReplicaBuilder() { - return new Builder.NoSecondaryReplica(); - } - - abstract static class Builder { - - class ReplicasWithSameSpeed extends Builder { - - URI primary; - List secondaries = new ArrayList<>(); - StoreResponse headStoreResponse; - StoreResponse readStoreResponse; - - ReplicasWithSameSpeed addPrimary(URI replicaAddress) { - primary = replicaAddress; - return this; - } - - ReplicasWithSameSpeed addSecondary(URI replicaAddress) { - secondaries.add(replicaAddress); - return this; - } - - ReplicasWithSameSpeed storeResponseOnRead(StoreResponse storeResponse) { - this.readStoreResponse = storeResponse; - return this; - } - - ReplicasWithSameSpeed storeResponseOnHead(StoreResponse storeResponse) { - this.headStoreResponse = storeResponse; - return this; - } - - public EndpointMock build() { - TransportClientWrapper.Builder.ReplicaResponseBuilder transportClientWrapperBuilder = TransportClientWrapper.Builder.replicaResponseBuilder(); - - ImmutableList replicas = ImmutableList.builder().add(primary).addAll(secondaries).build(); - - for(URI replica: replicas) { - transportClientWrapperBuilder.addReplica(replica, (i, request) -> { - if (request.getOperationType() == OperationType.Head || request.getOperationType() == OperationType.HeadFeed) { - return headStoreResponse; - } else { - return readStoreResponse; - } - }); - } - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create().withPrimary(primary) - .withSecondary(secondaries).build(); - - return new EndpointMock(addressSelectorWrapper, transportClientWrapperBuilder.build()) {}; - } - } - - class QuorumNotMetSecondaryReplicasDisappear { - URI primary; - Map> disappearDictionary = new HashedMap(); - public QuorumNotMetSecondaryReplicasDisappear primaryReplica(URI primaryReplica) { - this.primary = primaryReplica; - return this; - } - - public QuorumNotMetSecondaryReplicasDisappear secondaryReplicasDisappearWhen(URI secondary, - Function2WithCheckedException disappearPredicate) { - disappearDictionary.put(secondary, disappearPredicate); - return this; - } - - public QuorumNotMetSecondaryReplicasDisappear secondaryReplicasDisappearAfter(URI secondary, int attempt) { - disappearDictionary.put(secondary, (i, r) -> i >= attempt); - return this; - } - } - - static public class NoSecondaryReplica extends Builder { - private long LOCAL_LSN = 19; - private long LSN = 52; - private URI defaultPrimaryURI = URI.create("primary"); - private URI primary = defaultPrimaryURI; - private StoreResponse defaultResponse = StoreResponseBuilder.create() - .withLSN(LSN) - .withLocalLSN(LOCAL_LSN) - .withHeader(WFConstants.BackendHeaders.CURRENT_REPLICA_SET_SIZE, "1") - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LSN, Long.toString(LSN)) - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LOCAL_LSN, Long.toString(LOCAL_LSN)) - .withRequestCharge(0) - .build(); - - private StoreResponse headStoreResponse = defaultResponse; - private StoreResponse readStoreResponse = defaultResponse; - private Function1WithCheckedException storeResponseFunc; - - public NoSecondaryReplica primaryReplica(URI primaryReplica) { - this.primary = primaryReplica; - return this; - } - - public NoSecondaryReplica response(StoreResponse storeResponse) { - this.readStoreResponse = storeResponse; - this.headStoreResponse = storeResponse; - return this; - } - - public NoSecondaryReplica response(Function1WithCheckedException storeResponseFunc) { - this.storeResponseFunc = storeResponseFunc; - return this; - } - - public EndpointMock build() { - - TransportClientWrapper.Builder.ReplicaResponseBuilder transportClientWrapperBuilder = TransportClientWrapper.Builder.replicaResponseBuilder(); - - ImmutableList replicas = ImmutableList.builder().add(primary).build(); - - for(URI replica: replicas) { - transportClientWrapperBuilder.addReplica(replica, (i, request) -> { - - if (storeResponseFunc != null) { - return storeResponseFunc.apply(request); - } - - if (request.getOperationType() == OperationType.Head || request.getOperationType() == OperationType.HeadFeed) { - return headStoreResponse; - } else { - return readStoreResponse; - } - }); - } - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create().withPrimary(primary) - .withSecondary(ImmutableList.of()).build(); - - return new EndpointMock(addressSelectorWrapper, transportClientWrapperBuilder.build()) {}; - } - } - - static public class NoSecondaryReplica_TwoSecondaryReplicasGoLiveAfterFirstHitOnPrimary extends Builder { - private long LOCAL_LSN = 19; - private long LSN = 52; - private URI primary = URI.create("primary"); - private ImmutableList secondaryReplicas = ImmutableList.of(URI.create("secondary1"), URI.create("secondary2")); - private StoreResponse primaryDefaultResponse = StoreResponseBuilder.create() - .withLSN(LSN) - .withLocalLSN(LOCAL_LSN) - .withHeader(WFConstants.BackendHeaders.CURRENT_REPLICA_SET_SIZE, "3") - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LSN, Long.toString(LSN)) - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LOCAL_LSN, Long.toString(LOCAL_LSN)) - .withRequestCharge(0) - .build(); - - private StoreResponse secondaryDefaultResponse = StoreResponseBuilder.create() - .withLSN(LSN) - .withLocalLSN(LOCAL_LSN) - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LSN, Long.toString(LSN)) - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LOCAL_LSN, Long.toString(LOCAL_LSN)) - .withRequestCharge(0) - .build(); - Map> secondaryResponseFunc = - new HashMap<>(); - - - public NoSecondaryReplica_TwoSecondaryReplicasGoLiveAfterFirstHitOnPrimary primaryReplica(URI primaryReplica) { - this.primary = primaryReplica; - return this; - } - - public NoSecondaryReplica_TwoSecondaryReplicasGoLiveAfterFirstHitOnPrimary responseFromSecondary( - URI replica, - Function1WithCheckedException func) { - secondaryResponseFunc.put(replica, func); - return this; - } - - public EndpointMock build() { - - TransportClientWrapper.Builder.ReplicaResponseBuilder transportClientWrapperBuilder = TransportClientWrapper.Builder.replicaResponseBuilder(); - - transportClientWrapperBuilder.addReplica(primary, (i, request) -> { - return primaryDefaultResponse; - }); - - transportClientWrapperBuilder.addReplica(secondaryReplicas.get(0), (i, request) -> { - return secondaryDefaultResponse; - }); - - transportClientWrapperBuilder.addReplica(secondaryReplicas.get(1), (i, request) -> { - return secondaryDefaultResponse; - }); - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create().withPrimary(primary) - .withSecondary(ImmutableList.of()).build(); - - return new EndpointMock(addressSelectorWrapper, transportClientWrapperBuilder.build()){}; - } - } - - public abstract EndpointMock build() ; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ExceptionBuilder.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ExceptionBuilder.java deleted file mode 100644 index d73c90350fb1..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ExceptionBuilder.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.rx.internal.InvalidPartitionException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionIsMigratingException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionKeyRangeIsSplittingException; - -import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -public class ExceptionBuilder { - private Integer status; - private List> headerEntries; - private String message; - - public static ExceptionBuilder create() { - return new ExceptionBuilder(); - } - - public ExceptionBuilder() { - headerEntries = new ArrayList<>(); - } - - public ExceptionBuilder withHeader(String key, String value) { - headerEntries.add(new AbstractMap.SimpleEntry(key, value)); - return this; - } - - public ExceptionBuilder withStatus(int status) { - this.status = status; - return this; - } - - public ExceptionBuilder withMessage(String message) { - this.message = message; - return this; - } - - public GoneException asGoneException() { - assert status == null; - GoneException dce = new GoneException(); - dce.getResponseHeaders().putAll(headerEntries.stream().collect(Collectors.toMap(i -> i.getKey(), i -> i.getValue()))); - return dce; - } - - public InvalidPartitionException asInvalidPartitionException() { - assert status == null; - InvalidPartitionException dce = new InvalidPartitionException(); - dce.getResponseHeaders().putAll(headerEntries.stream().collect(Collectors.toMap(i -> i.getKey(), i -> i.getValue()))); - return dce; - } - - public PartitionKeyRangeGoneException asPartitionKeyRangeGoneException() { - assert status == null; - PartitionKeyRangeGoneException dce = new PartitionKeyRangeGoneException(); - dce.getResponseHeaders().putAll(headerEntries.stream().collect(Collectors.toMap(i -> i.getKey(), i -> i.getValue()))); - return dce; - } - - - public PartitionKeyRangeIsSplittingException asPartitionKeyRangeIsSplittingException() { - assert status == null; - PartitionKeyRangeIsSplittingException dce = new PartitionKeyRangeIsSplittingException(); - dce.getResponseHeaders().putAll(headerEntries.stream().collect(Collectors.toMap(i -> i.getKey(), i -> i.getValue()))); - return dce; - } - - public PartitionIsMigratingException asPartitionIsMigratingException() { - assert status == null; - PartitionIsMigratingException dce = new PartitionIsMigratingException(); - dce.getResponseHeaders().putAll(headerEntries.stream().collect(Collectors.toMap(i -> i.getKey(), i -> i.getValue()))); - return dce; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/Function1WithCheckedException.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/Function1WithCheckedException.java deleted file mode 100644 index 3e55f35763fe..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/Function1WithCheckedException.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -@FunctionalInterface -public interface Function1WithCheckedException{ - - R apply(T t) throws Exception; - -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/Function2WithCheckedException.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/Function2WithCheckedException.java deleted file mode 100644 index 093ce601fcfe..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/Function2WithCheckedException.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -@FunctionalInterface -public interface Function2WithCheckedException{ - R apply(T1 t1, T2 t2) throws Exception; - -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayServiceConfiguratorReaderMock.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayServiceConfiguratorReaderMock.java deleted file mode 100644 index 0b536d36c740..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayServiceConfiguratorReaderMock.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DatabaseAccount; -import com.microsoft.azure.cosmosdb.ReplicationPolicy; -import org.mockito.Mockito; -import rx.Single; - -public class GatewayServiceConfiguratorReaderMock { - - public GatewayServiceConfigurationReader gatewayServiceConfigurationReader; - - public static GatewayServiceConfiguratorReaderMock from(ConsistencyLevel accountConsistencyLevel) { - return new GatewayServiceConfiguratorReaderMock(new ReplicationPolicy("{}"), new ReplicationPolicy("{}"), accountConsistencyLevel); - } - - public static GatewayServiceConfiguratorReaderMock from(ConsistencyLevel accountConsistencyLevel, - int systemMaxReplicaCount, - int systemMinReplicaCount, - int userMaxReplicaCount, - int userMinReplicaCount) { - ReplicationPolicy userRP = Mockito.mock(ReplicationPolicy.class); - Mockito.doReturn(userMaxReplicaCount).when(userRP).getMaxReplicaSetSize(); - Mockito.doReturn(userMinReplicaCount).when(userRP).getMinReplicaSetSize(); - - ReplicationPolicy systemRP = Mockito.mock(ReplicationPolicy.class); - Mockito.doReturn(systemMaxReplicaCount).when(systemRP).getMaxReplicaSetSize(); - Mockito.doReturn(systemMinReplicaCount).when(systemRP).getMinReplicaSetSize(); - - return new GatewayServiceConfiguratorReaderMock(userRP, systemRP, accountConsistencyLevel); - } - - public static GatewayServiceConfiguratorReaderMock from(ConsistencyLevel accountConsistencyLevel, int maxReplicaSize, int minReplicaCase) { - ReplicationPolicy rp = Mockito.mock(ReplicationPolicy.class); - Mockito.doReturn(maxReplicaSize).when(rp).getMaxReplicaSetSize(); - Mockito.doReturn(minReplicaCase).when(rp).getMinReplicaSetSize(); - - return new GatewayServiceConfiguratorReaderMock(rp, rp, accountConsistencyLevel); - } - - - public GatewayServiceConfiguratorReaderMock(ReplicationPolicy userReplicationPolicy, - ReplicationPolicy systemReplicationPolicy, - ConsistencyLevel defaultConsistencyLevel) { - this.gatewayServiceConfigurationReader = Mockito.mock(GatewayServiceConfigurationReader.class); - - Mockito.doReturn(Single.just(Mockito.mock(DatabaseAccount.class))).when(this.gatewayServiceConfigurationReader).initializeReaderAsync(); - Mockito.doReturn(defaultConsistencyLevel).when(this.gatewayServiceConfigurationReader).getDefaultConsistencyLevel(); - Mockito.doReturn(systemReplicationPolicy).when(this.gatewayServiceConfigurationReader).getSystemReplicationPolicy(); - Mockito.doReturn(userReplicationPolicy).when(this.gatewayServiceConfigurationReader).getUserReplicationPolicy(); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GoneAndRetryWithRetryPolicyTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GoneAndRetryWithRetryPolicyTest.java deleted file mode 100644 index b9895fe301b7..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GoneAndRetryWithRetryPolicyTest.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import com.microsoft.azure.cosmosdb.rx.internal.IRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.InvalidPartitionException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionIsMigratingException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionKeyRangeIsSplittingException; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.testng.annotations.Test; -import rx.Single; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * This test file will cover various exception on GoneAndRetryWithRetryPolicy. - * - */ -public class GoneAndRetryWithRetryPolicyTest { - protected static final int TIMEOUT = 60000; - - /** - * Retry with GoneException , retried 4 times and verified the returned - * shouldRetryResult. ShouldRetryResult - */ - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void shouldRetryWithGoneException() { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document); - GoneAndRetryWithRetryPolicy goneAndRetryWithRetryPolicy = new GoneAndRetryWithRetryPolicy(request, 30); - Single singleShouldRetry = goneAndRetryWithRetryPolicy - .shouldRetry(new GoneException()); - IRetryPolicy.ShouldRetryResult shouldRetryResult = singleShouldRetry.toBlocking().value(); - assertThat(shouldRetryResult.shouldRetry).isTrue(); - assertThat(shouldRetryResult.policyArg.getValue0()).isTrue(); - assertThat(shouldRetryResult.policyArg.getValue3()).isEqualTo(1); - assertThat(shouldRetryResult.backOffTime.getSeconds()).isEqualTo(0); - - singleShouldRetry = goneAndRetryWithRetryPolicy.shouldRetry(new GoneException()); - shouldRetryResult = singleShouldRetry.toBlocking().value(); - assertThat(shouldRetryResult.shouldRetry).isTrue(); - assertThat(shouldRetryResult.policyArg.getValue0()).isTrue(); - assertThat(shouldRetryResult.policyArg.getValue3()).isEqualTo(2); - assertThat(shouldRetryResult.backOffTime.getSeconds()).isEqualTo(1); - - singleShouldRetry = goneAndRetryWithRetryPolicy.shouldRetry(new GoneException()); - shouldRetryResult = singleShouldRetry.toBlocking().value(); - assertThat(shouldRetryResult.shouldRetry).isTrue(); - assertThat(shouldRetryResult.policyArg.getValue0()).isTrue(); - assertThat(shouldRetryResult.policyArg.getValue3()).isEqualTo(3); - assertThat(shouldRetryResult.backOffTime.getSeconds()).isEqualTo(2); - - singleShouldRetry = goneAndRetryWithRetryPolicy.shouldRetry(new GoneException()); - shouldRetryResult = singleShouldRetry.toBlocking().value(); - assertThat(shouldRetryResult.shouldRetry).isTrue(); - assertThat(shouldRetryResult.policyArg.getValue0()).isTrue(); - assertThat(shouldRetryResult.policyArg.getValue3()).isEqualTo(4); - assertThat(shouldRetryResult.backOffTime.getSeconds()).isEqualTo(4); - - } - - /** - * Retry with PartitionIsMigratingException - */ - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void shouldRetryWithPartitionIsMigratingException() { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document); - GoneAndRetryWithRetryPolicy goneAndRetryWithRetryPolicy = new GoneAndRetryWithRetryPolicy(request, 30); - Single singleShouldRetry = goneAndRetryWithRetryPolicy - .shouldRetry(new PartitionIsMigratingException()); - IRetryPolicy.ShouldRetryResult shouldRetryResult = singleShouldRetry.toBlocking().value(); - assertThat(shouldRetryResult.shouldRetry).isTrue(); - assertThat(request.forceCollectionRoutingMapRefresh).isTrue(); - assertThat(shouldRetryResult.policyArg.getValue0()).isTrue(); - } - - /** - * Retry with InvalidPartitionException - */ - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void shouldRetryWithInvalidPartitionException() { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document); - GoneAndRetryWithRetryPolicy goneAndRetryWithRetryPolicy = new GoneAndRetryWithRetryPolicy(request, 30); - Single singleShouldRetry = goneAndRetryWithRetryPolicy - .shouldRetry(new InvalidPartitionException()); - IRetryPolicy.ShouldRetryResult shouldRetryResult = singleShouldRetry.toBlocking().value(); - assertThat(shouldRetryResult.shouldRetry).isTrue(); - assertThat(request.requestContext.quorumSelectedLSN).isEqualTo(-1); - assertThat(request.requestContext.resolvedPartitionKeyRange).isNull(); - assertThat(request.requestContext.globalCommittedSelectedLSN).isEqualTo(-1); - assertThat(shouldRetryResult.policyArg.getValue0()).isFalse(); - - goneAndRetryWithRetryPolicy.shouldRetry(new InvalidPartitionException()); - // It will retry max till 3 attempts - shouldRetryResult = goneAndRetryWithRetryPolicy.shouldRetry(new InvalidPartitionException()).toBlocking() - .value(); - assertThat(shouldRetryResult.shouldRetry).isFalse(); - DocumentClientException clientException = (DocumentClientException) shouldRetryResult.exception; - assertThat(clientException.getStatusCode()).isEqualTo(HttpConstants.StatusCodes.SERVICE_UNAVAILABLE); - - } - - /** - * Retry with PartitionKeyRangeIsSplittingException - */ - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void shouldRetryWithPartitionKeyRangeIsSplittingException() { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document); - GoneAndRetryWithRetryPolicy goneAndRetryWithRetryPolicy = new GoneAndRetryWithRetryPolicy(request, 30); - Single singleShouldRetry = goneAndRetryWithRetryPolicy - .shouldRetry(new PartitionKeyRangeIsSplittingException()); - IRetryPolicy.ShouldRetryResult shouldRetryResult = singleShouldRetry.toBlocking().value(); - assertThat(shouldRetryResult.shouldRetry).isTrue(); - assertThat(request.forcePartitionKeyRangeRefresh).isTrue(); - assertThat(request.requestContext.resolvedPartitionKeyRange).isNull(); - assertThat(request.requestContext.quorumSelectedLSN).isEqualTo(-1); - assertThat(shouldRetryResult.policyArg.getValue0()).isFalse(); - - } - - /** - * No retry on bad request exception - */ - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void shouldRetryWithGenericException() { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document); - GoneAndRetryWithRetryPolicy goneAndRetryWithRetryPolicy = new GoneAndRetryWithRetryPolicy(request, 30); - Single singleShouldRetry = goneAndRetryWithRetryPolicy - .shouldRetry(new BadRequestException()); - IRetryPolicy.ShouldRetryResult shouldRetryResult = singleShouldRetry.toBlocking().value(); - assertThat(shouldRetryResult.shouldRetry).isFalse(); - } - -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpClientMockWrapper.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpClientMockWrapper.java deleted file mode 100644 index f456424a0319..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpClientMockWrapper.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; -import io.netty.buffer.ByteBufUtil; -import io.netty.handler.codec.http.DefaultHttpHeaders; -import io.netty.handler.codec.http.DefaultHttpResponse; -import io.netty.handler.codec.http.HttpHeaders; -import io.netty.handler.codec.http.HttpResponse; -import io.netty.handler.codec.http.HttpResponseStatus; -import io.netty.handler.codec.http.HttpVersion; -import io.reactivex.netty.client.RxClient; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import rx.Observable; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.TimeUnit; - -public class HttpClientMockWrapper { - public static HttpClientBehaviourBuilder httpClientBehaviourBuilder() { - return new HttpClientBehaviourBuilder(); - } - - public static class HttpClientBehaviourBuilder { - private int status; - private String content; - private HttpHeaders httpHeaders = new DefaultHttpHeaders(); - private Exception networkFailure; - - public HttpClientBehaviourBuilder withNetworkFailure(Exception networkFailure) { - this.networkFailure = networkFailure; - return this; - } - - public HttpClientBehaviourBuilder withStatus(int status) { - this.status = status; - return this; - } - - public HttpClientBehaviourBuilder withHeaders(HttpHeaders httpHeaders) { - this.httpHeaders = httpHeaders; - return this; - } - - public HttpClientBehaviourBuilder withHeaders(String... pairs) { - if (pairs.length % 2 != 0) { - throw new IllegalArgumentException(); - } - - for(int i = 0; i < pairs.length/ 2; i++) { - this.httpHeaders.add(pairs[2*i], pairs[2*i +1]); - } - - return this; - } - - public HttpClientBehaviourBuilder withContent(String content) { - this.content = content; - return this; - } - - public HttpClientBehaviourBuilder withHeaderLSN(long lsn) { - this.httpHeaders.add(WFConstants.BackendHeaders.LSN, Long.toString(lsn)); - return this; - } - - public HttpClientBehaviourBuilder withHeaderPartitionKeyRangeId(String partitionKeyRangeId) { - this.httpHeaders.add(WFConstants.BackendHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId); - return this; - } - - public HttpClientBehaviourBuilder withHeaderSubStatusCode(int subStatusCode) { - this.httpHeaders.add(WFConstants.BackendHeaders.SUB_STATUS, Integer.toString(subStatusCode)); - return this; - } - - public HttpClientResponse asHttpClientResponse() { - if (this.networkFailure != null) { - return null; - } - - HttpClientResponse resp = Mockito.mock(HttpClientResponse.class); - Mockito.doReturn(HttpResponseStatus.valueOf(status)).when(resp).getStatus(); - Mockito.doReturn(Observable.just(ByteBufUtil.writeUtf8(ByteBufAllocator.DEFAULT, content))).when(resp).getContent(); - - DefaultHttpResponse httpResponse = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.valueOf(status), httpHeaders); - - try { - Constructor constructor = HttpResponseHeaders.class.getDeclaredConstructor(HttpResponse.class); - constructor.setAccessible(true); - HttpResponseHeaders httpResponseHeaders = constructor.newInstance(httpResponse); - Mockito.doReturn(httpResponseHeaders).when(resp).getHeaders(); - - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException - | InvocationTargetException | NoSuchMethodException | SecurityException e) { - throw new IllegalStateException("Failed to instantiate class object.", e); - } - - return resp; - } - - public Exception asNetworkFailure() { - return this.networkFailure; - } - - @Override - public String toString() { - return "HttpClientBehaviourBuilder{" + - "status=" + status + - ", content='" + content + '\'' + - ", httpHeaders=" + httpHeaders + - ", networkFailure=" + networkFailure + - '}'; - } - } - - private final CompositeHttpClient httpClient; - private final List, RxClient.ServerInfo>> requests = Collections.synchronizedList(new ArrayList<>()); - - public HttpClientMockWrapper(long responseAfterMillis, HttpClientResponse httpClientResponse) { - this(responseAfterMillis, httpClientResponse, null); - } - - private static Observable> httpClientResponseOrException(HttpClientResponse httpClientResponse, Exception e) { - assert ((httpClientResponse != null && e == null) || (httpClientResponse == null && e != null)); - return httpClientResponse != null ? Observable.just(httpClientResponse) : Observable.error(e); - } - - public HttpClientMockWrapper(long responseAfterMillis, Exception e) { - this(responseAfterMillis, null, e); - } - - public HttpClientMockWrapper(HttpClientResponse httpClientResponse) { - this(0, httpClientResponse); - } - - private HttpClientMockWrapper(long responseAfterMillis, final HttpClientResponse httpClientResponse, final Exception e) { - httpClient = Mockito.mock(CompositeHttpClient.class); - assert httpClientResponse == null || e == null; - - Mockito.doAnswer(new Answer() { - @Override - public Observable> answer(InvocationOnMock invocationOnMock) throws Throwable { - RxClient.ServerInfo serverInfo = invocationOnMock.getArgumentAt(0, RxClient.ServerInfo.class); - HttpClientRequest req = invocationOnMock.getArgumentAt(1, HttpClientRequest.class); - - requests.add(new ImmutablePair<>(req, serverInfo)); - - if (responseAfterMillis <= 0) { - return httpClientResponseOrException(httpClientResponse, e); - } else { - return Observable.timer(responseAfterMillis, TimeUnit.MILLISECONDS).flatMap(t -> httpClientResponseOrException(httpClientResponse, e)); - } - } - }).when(httpClient).submit(Mockito.any(RxClient.ServerInfo.class), Mockito.any(HttpClientRequest.class)); - } - - public HttpClientMockWrapper(HttpClientBehaviourBuilder builder) { - this(0, builder.asHttpClientResponse(), builder.asNetworkFailure()); - } - - public HttpClientMockWrapper(Exception e) { - this(0, e); - } - - public CompositeHttpClient getClient() { - return httpClient; - } - - public List, RxClient.ServerInfo>> getCapturedInvocation() { - return requests; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpTransportClientTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpTransportClientTest.java deleted file mode 100644 index f4ca18efd052..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/HttpTransportClientTest.java +++ /dev/null @@ -1,641 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.InternalServerErrorException; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.InvalidPartitionException; -import com.microsoft.azure.cosmosdb.rx.internal.NotFoundException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionIsMigratingException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionKeyRangeIsSplittingException; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import io.netty.buffer.ByteBuf; -import io.netty.channel.ConnectTimeoutException; -import io.netty.handler.codec.http.EmptyHttpHeaders; -import io.reactivex.netty.client.RxClient; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.assertj.core.api.Assertions; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import rx.Single; -import rx.observers.TestSubscriber; - -import java.net.URI; -import java.net.UnknownHostException; -import java.util.HashMap; -import java.util.concurrent.TimeUnit; - -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; - -/** - * Tests validating {@link HttpTransportClient} - */ -public class HttpTransportClientTest { - private final static Configs configs = new Configs(); - private final static int TIMEOUT = 1000; - - private final URI physicalAddress = URI.create( - "https://by4prdddc03-docdb-1.documents.azure.com:9056" + - "/apps/b76af614-5421-4318-4c9e-33056ff5a2bf/services/e7c8d429-c379-40c9-9486-65b89b70be2f" + - "/partitions/5f5b8766-3bdf-4713-b85a-a55ac2ccd62c/replicas/131828696163674404p/"); - - private final long lsn = 5; - private final String partitionKeyRangeId = "3"; - - @Test(groups = "unit") - public void getResourceFeedUri_Document() throws Exception { - RxDocumentServiceRequest req = RxDocumentServiceRequest.createFromName( - OperationType.Create, "dbs/db/colls/col", ResourceType.Document); - URI res = HttpTransportClient.getResourceFeedUri(req.getResourceType(), physicalAddress, req); - assertThat(res.toString()).isEqualTo(physicalAddress.toString() + HttpUtils.urlEncode("dbs/db/colls/col/docs")); - } - - @Test(groups = "unit") - public void getResourceFeedUri_Attachment() throws Exception { - RxDocumentServiceRequest req = RxDocumentServiceRequest.createFromName( - OperationType.Create, "dbs/db/colls/col", ResourceType.Attachment); - URI res = HttpTransportClient.getResourceFeedUri(req.getResourceType(), physicalAddress, req); - assertThat(res.toString()).isEqualTo(physicalAddress.toString() + HttpUtils.urlEncode("dbs/db/colls/col/attachments")); - } - - @Test(groups = "unit") - public void getResourceFeedUri_Collection() throws Exception { - RxDocumentServiceRequest req = RxDocumentServiceRequest.createFromName( - OperationType.Create, "dbs/db", ResourceType.DocumentCollection); - URI res = HttpTransportClient.getResourceFeedUri(req.getResourceType(), physicalAddress, req); - assertThat(res.toString()).isEqualTo(physicalAddress.toString() + HttpUtils.urlEncode("dbs/db/colls")); - } - - @Test(groups = "unit") - public void getResourceFeedUri_Conflict() throws Exception { - RxDocumentServiceRequest req = RxDocumentServiceRequest.createFromName( - OperationType.Create, "/dbs/db/colls/col", ResourceType.Conflict); - URI res = HttpTransportClient.getResourceFeedUri(req.getResourceType(), physicalAddress, req); - assertThat(res.toString()).isEqualTo(physicalAddress.toString() + HttpUtils.urlEncode("dbs/db/colls/col/conflicts")); - } - - @Test(groups = "unit") - public void getResourceFeedUri_Database() throws Exception { - RxDocumentServiceRequest req = RxDocumentServiceRequest.createFromName( - OperationType.Create, "/", ResourceType.Database); - URI res = HttpTransportClient.getResourceFeedUri(req.getResourceType(), physicalAddress, req); - assertThat(res.toString()).isEqualTo(physicalAddress.toString() + "dbs"); - } - - public static HttpTransportClient getHttpTransportClientUnderTest(int requestTimeout, - UserAgentContainer userAgent, - CompositeHttpClient httpClient) { - class HttpTransportClientUnderTest extends HttpTransportClient { - public HttpTransportClientUnderTest(int requestTimeout, UserAgentContainer userAgent) { - super(configs, requestTimeout, userAgent); - } - - @Override - CompositeHttpClient createHttpClient(int requestTimeout) { - return httpClient; - } - } - - return new HttpTransportClientUnderTest(requestTimeout, userAgent); - } - - @Test(groups = "unit") - public void validateDefaultHeaders() { - HttpClientResponse mockedResponse = new HttpClientMockWrapper.HttpClientBehaviourBuilder() - .withContent("").withStatus(200) - .withHeaders(EmptyHttpHeaders.INSTANCE) - .asHttpClientResponse(); - HttpClientMockWrapper httpClientMockWrapper = new HttpClientMockWrapper(mockedResponse); - - UserAgentContainer userAgentContainer = new UserAgentContainer(); - userAgentContainer.setSuffix("i am suffix"); - - HttpTransportClient transportClient = getHttpTransportClientUnderTest(100, - userAgentContainer, - httpClientMockWrapper.getClient()); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Create, "dbs/db/colls/col", ResourceType.Document); - request.setContentBytes(new byte[0]); - - transportClient.invokeStoreAsync(physicalAddress, - new ResourceOperation(OperationType.Create, ResourceType.Document), - request).toBlocking().value(); - - assertThat(httpClientMockWrapper.getCapturedInvocation()).asList().hasSize(1); - ImmutablePair, RxClient.ServerInfo> httpClientInvocation = httpClientMockWrapper.getCapturedInvocation().get(0); - - assertThat(httpClientInvocation.left.getHeaders().get(HttpConstants.HttpHeaders.USER_AGENT)).endsWith("i am suffix"); - assertThat(httpClientInvocation.left.getHeaders().get(HttpConstants.HttpHeaders.CACHE_CONTROL)).isEqualTo("no-cache"); - assertThat(httpClientInvocation.left.getHeaders().get(HttpConstants.HttpHeaders.ACCEPT)).isEqualTo("application/json"); - assertThat(httpClientInvocation.left.getHeaders().get(HttpConstants.HttpHeaders.VERSION)).isEqualTo(HttpConstants.Versions.CURRENT_VERSION); - - } - - @DataProvider(name = "fromMockedHttpResponseToExpectedDocumentClientException") - public Object[][] fromMockedHttpResponseToExpectedDocumentClientException() { - return new Object[][]{ - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(401) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(UnauthorizedException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(403) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(ForbiddenException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(404) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(NotFoundException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(404) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId) - .withHeaders(HttpConstants.HttpHeaders.CONTENT_TYPE, "text/html"), - - FailureValidator.builder() - .instanceOf(GoneException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(400) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(BadRequestException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(405) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(MethodNotAllowedException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(409) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(ConflictException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(412) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(PreconditionFailedException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(412) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(PreconditionFailedException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(413) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(RequestEntityTooLargeException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(423) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(LockedException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(503) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(ServiceUnavailableException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(408) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(RequestTimeoutException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(449) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(RetryWithException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(429) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(RequestRateTooLargeException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(500) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId), - - FailureValidator.builder() - .instanceOf(InternalServerErrorException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(410) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId) - .withHeaderSubStatusCode(HttpConstants.SubStatusCodes.NAME_CACHE_IS_STALE), - - FailureValidator.builder() - .instanceOf(InvalidPartitionException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(410) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId) - .withHeaderSubStatusCode(HttpConstants.SubStatusCodes.PARTITION_KEY_RANGE_GONE), - - FailureValidator.builder() - .instanceOf(PartitionKeyRangeGoneException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(410) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId) - .withHeaderSubStatusCode(HttpConstants.SubStatusCodes.COMPLETING_SPLIT), - - FailureValidator.builder() - .instanceOf(PartitionKeyRangeIsSplittingException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(410) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId) - .withHeaderSubStatusCode(HttpConstants.SubStatusCodes.COMPLETING_PARTITION_MIGRATION), - - FailureValidator.builder() - .instanceOf(PartitionIsMigratingException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - { - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withContent("").withStatus(410) - .withHeaderLSN(lsn) - .withHeaderPartitionKeyRangeId(partitionKeyRangeId) - .withHeaderSubStatusCode(0), - - FailureValidator.builder() - .instanceOf(GoneException.class) - .resourceAddress("dbs/db/colls/col") - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - }, - }; - } - - /** - * Validates the error handling behaviour of HttpTransportClient for https status codes >= 400 - * @param mockedResponseBuilder - * @param failureValidatorBuilder - */ - @Test(groups = "unit", dataProvider = "fromMockedHttpResponseToExpectedDocumentClientException") - public void failuresWithHttpStatusCodes(HttpClientMockWrapper.HttpClientBehaviourBuilder mockedResponseBuilder, - FailureValidator.Builder failureValidatorBuilder) { - HttpClientMockWrapper httpClientMockWrapper = new HttpClientMockWrapper(mockedResponseBuilder); - UserAgentContainer userAgentContainer = new UserAgentContainer(); - HttpTransportClient transportClient = getHttpTransportClientUnderTest( - 100, - userAgentContainer, - httpClientMockWrapper.getClient()); - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Create, "dbs/db/colls/col", ResourceType.Document); - request.setContentBytes(new byte[0]); - - Single storeResp = transportClient.invokeStoreAsync( - physicalAddress, - new ResourceOperation(OperationType.Create, ResourceType.Document), - request); - - validateFailure(storeResp, failureValidatorBuilder.build()); - } - - @DataProvider(name = "fromMockedNetworkFailureToExpectedDocumentClientException") - public Object[][] fromMockedNetworkFailureToExpectedDocumentClientException() { - return new Object[][]{ - // create request, retriable network exception - { - createRequestFromName( - OperationType.Create, "dbs/db/colls/col", ResourceType.Document), - - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withNetworkFailure(new UnknownHostException()), - - FailureValidator.builder() - .instanceOf(GoneException.class) - }, - - // create request, retriable network exception - { - createRequestFromName( - OperationType.Create, "dbs/db/colls/col", ResourceType.Document), - - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withNetworkFailure(new UnknownHostException()), - - FailureValidator.builder() - .instanceOf(GoneException.class) - }, - - // create request, retriable network exception - { - createRequestFromName( - OperationType.Create, "dbs/db/colls/col", ResourceType.Document), - - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withNetworkFailure(new ConnectTimeoutException()), - - FailureValidator.builder() - .instanceOf(GoneException.class) - }, - - // read request, retriable network exception - { - createRequestFromName( - OperationType.Read, "dbs/db/colls/col", ResourceType.Document), - - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withNetworkFailure(new ConnectTimeoutException()), - - FailureValidator.builder() - .instanceOf(GoneException.class) - }, - - // create request, non-retriable network exception - { - createRequestFromName( - OperationType.Create, "dbs/db/colls/col", ResourceType.Document), - - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withNetworkFailure(new RuntimeException()), - - FailureValidator.builder() - .instanceOf(ServiceUnavailableException.class) - }, - - // read request, non-retriable network exception - { - createRequestFromName( - OperationType.Read, "dbs/db/colls/col", ResourceType.Document), - - HttpClientMockWrapper. - httpClientBehaviourBuilder() - .withNetworkFailure(new RuntimeException()), - - FailureValidator.builder() - .instanceOf(GoneException.class) - }, - }; - } - - /** - * Validates the error handling behaviour of HttpTransportClient for network failures from which http status codes - * cannot be derived. For example Socket Connection failure. - * @param request - * @param mockedResponseBuilder - * @param failureValidatorBuilder - */ - @Test(groups = "unit", dataProvider = "fromMockedNetworkFailureToExpectedDocumentClientException") - public void networkFailures(RxDocumentServiceRequest request, - HttpClientMockWrapper.HttpClientBehaviourBuilder mockedResponseBuilder, - FailureValidator.Builder failureValidatorBuilder) { - HttpClientMockWrapper httpClientMockWrapper = new HttpClientMockWrapper(mockedResponseBuilder); - UserAgentContainer userAgentContainer = new UserAgentContainer(); - HttpTransportClient transportClient = getHttpTransportClientUnderTest( - 100, - userAgentContainer, - httpClientMockWrapper.getClient()); - - Single storeResp = transportClient.invokeStoreAsync( - physicalAddress, - new ResourceOperation(OperationType.Create, ResourceType.Document), - request); - - validateFailure(storeResp, failureValidatorBuilder.build()); - } - - private static RxDocumentServiceRequest createRequestFromName( - OperationType operationType, - String resourceFullName, - ResourceType resourceType) { - return createRequestFromName(operationType, resourceFullName, resourceType, new byte[0]); - } - - private static RxDocumentServiceRequest createRequestFromName( - OperationType operationType, - String resourceFullName, - ResourceType resourceType, - byte[] content) { - RxDocumentServiceRequest req = RxDocumentServiceRequest.create( - operationType, - resourceType, - resourceFullName, - new HashMap<>()); - - req.setContentBytes(content); - return req; - } - - public void validateSuccess(Single single, StoreResponseValidator validator) { - validateSuccess(single, validator, TIMEOUT); - } - - public static void validateSuccess(Single single, - StoreResponseValidator validator, long timeout) { - - TestSubscriber testSubscriber = new TestSubscriber<>(); - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - public void validateFailure(Single single, - FailureValidator validator) { - validateFailure(single, validator, TIMEOUT); - } - - public static void validateFailure(Single single, - FailureValidator validator, long timeout) { - - TestSubscriber testSubscriber = new TestSubscriber<>(); - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - Assertions.assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - validator.validate(testSubscriber.getOnErrorEvents().get(0)); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/MultiStoreResultValidator.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/MultiStoreResultValidator.java deleted file mode 100644 index 3b948d992ba4..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/MultiStoreResultValidator.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.base.Predicates; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import org.apache.commons.lang3.mutable.MutableObject; -import org.assertj.core.description.Description; -import org.assertj.core.description.TextDescription; - -import java.util.ArrayList; -import java.util.List; -import java.util.function.BiFunction; -import java.util.function.Predicate; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.AssertionsForClassTypes.fail; - -/** - * this is meant to be used when there reading multiple replicas for the same thing - */ -public interface MultiStoreResultValidator { - - static Builder create() { - return new Builder(); - } - - void validate(List storeResults); - - class Builder { - private List validators = new ArrayList<>(); - - public MultiStoreResultValidator build() { - return new MultiStoreResultValidator() { - - @SuppressWarnings({"rawtypes", "unchecked"}) - @Override - public void validate(List storeResults) { - for (MultiStoreResultValidator validator : validators) { - validator.validate(storeResults); - } - } - }; - } - - public Builder validateEachWith(StoreResultValidator storeResultValidator) { - validators.add(new MultiStoreResultValidator() { - - @Override - public void validate(List storeResults) { - for(StoreResult srr: storeResults) { - storeResultValidator.validate(srr); - } - } - }); - return this; - } - - public Builder validateEachWith(StoreResponseValidator storeResponseValidator) { - validators.add(new MultiStoreResultValidator() { - - @Override - public void validate(List storeResults) { - for(StoreResult srr: storeResults) { - try { - storeResponseValidator.validate(srr.toResponse()); - } catch (DocumentClientException e) { - fail(e.getMessage()); - } - } - } - }); - return this; - } - - public Builder withMinimumLSN(long minimumLSN) { - this.validateEachWith(StoreResultValidator.create().withMinLSN(minimumLSN).build()); - return this; - } - - public Builder withAggregate(BiFunction aggregator, - T initialValue, - Predicate finalValuePredicate, - Description description) { - MutableObject total = new MutableObject<>(initialValue); - validators.add(new MultiStoreResultValidator() { - - @Override - public void validate(List storeResults) { - for(StoreResult srr: storeResults) { - total.setValue(aggregator.apply(srr, total.getValue())); - } - - assertThat(finalValuePredicate.test(total.getValue())) - .describedAs(Description.mostRelevantDescription(description, - String.format("actual value %s.", - total.getValue().toString()))) - .isTrue(); - } - }); - return this; - } - - public Builder withTotalRequestCharge(double totalExpectedRC) { - this.withAggregate((srr, v) -> srr.requestCharge + v.doubleValue(), - 0d, - Predicates.equalTo(totalExpectedRC), - new TextDescription("total request charge is expected to be %f", totalExpectedRC)); - return this; - } - - public Builder withNonZeroRequestCharge() { - - this.withAggregate((srr, v) -> srr.requestCharge + v.doubleValue(), - 0d, - aDouble -> aDouble > 0, - new TextDescription("total request charge expected to be greater than 0")); - return this; - } - - public Builder validateEachWith(FailureValidator failureValidator) { - validators.add(new MultiStoreResultValidator() { - - @Override - public void validate(List storeResults) { - for(StoreResult srr: storeResults) { - try { - failureValidator.validate(srr.getException()); - } catch (DocumentClientException e) { - fail(e.getMessage()); - } - } - } - }); - return this; - } - - public Builder noFailure() { - this.validateEachWith(StoreResultValidator.create().isValid().noException().build()); - return this; - } - - public Builder withSize(int expectedNumber) { - validators.add(new MultiStoreResultValidator() { - - @Override - public void validate(List storeResults) { - assertThat(storeResults).hasSize(expectedNumber); - } - }); - return this; - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/MurmurHash3_32Test.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/MurmurHash3_32Test.java deleted file mode 100644 index 0e8e01b2baa5..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/MurmurHash3_32Test.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.hash.HashFunction; -import com.google.common.hash.Hashing; -import com.microsoft.azure.cosmosdb.internal.routing.MurmurHash3_32; -import org.apache.commons.lang3.RandomUtils; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import java.io.UnsupportedEncodingException; -import java.nio.charset.Charset; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * validates {@link MurmurHash3_32} against Google's murmur3_32 implementation. - */ -public class MurmurHash3_32Test { - - private MurmurHash3_32 murmurHash3_32; - - @BeforeClass(groups = "unit") - public void setup() { - murmurHash3_32 = new MurmurHash3_32(); - } - - @Test(groups = "unit") - public void murmurHash3_32_EmptyByteArray() { - byte[] byteArray = new byte[0]; - int actualHash = murmurHash3_32.hash(byteArray, byteArray.length, 0); - - HashFunction googleMurmur3_32 = Hashing.murmur3_32(0); - int expectedHash = googleMurmur3_32.hashBytes(byteArray).asInt(); - - assertThat(actualHash).isEqualTo(expectedHash); - } - - @Test(groups = "unit") - public void murmurHash3_32_String() { - byte[] byteArray = new String("test").getBytes(Charset.forName("UTF-8")); - int actualHash = murmurHash3_32.hash(byteArray, byteArray.length, 0); - - HashFunction googleMurmur3_32 = Hashing.murmur3_32(0); - int expectedHash = googleMurmur3_32.hashBytes(byteArray).asInt(); - - assertThat(actualHash).isEqualTo(expectedHash); - } - - @Test(groups = "unit") - public void murmurHash3_32_NonLatin() throws UnsupportedEncodingException { - String nonLatin = "абвгдеёжзийклмнопрстуфхцчшщъыьэюяабвгдеёжзийклмнопрстуфхцчшщъыьэюяабвгдеёжзийклмнопрстуфхцчшщъыьэюяабвгдеёжзийклмнопрстуфхцчшщъыьэюя"; - for(int i = 0; i < nonLatin.length() + 1; i++) { - byte[] byteArray = nonLatin.substring(0, i).getBytes("UTF-8"); - int actualHash = murmurHash3_32.hash(byteArray, byteArray.length, 0); - - HashFunction googleMurmur3_32 = Hashing.murmur3_32(0); - int expectedHash = googleMurmur3_32.hashBytes(byteArray).asInt(); - - assertThat(actualHash).isEqualTo(expectedHash); - } - } - - @Test(groups = "unit") - public void murmurHash3_32_ZeroByteArray() { - byte[] byteArray = new byte[3]; - int actualHash = murmurHash3_32.hash(byteArray, byteArray.length, 0); - - HashFunction googleMurmur3_32 = Hashing.murmur3_32(0); - int expectedHash = googleMurmur3_32.hashBytes(byteArray).asInt(); - - assertThat(actualHash).isEqualTo(expectedHash); - } - - @Test(groups = "unit") - public void murmurHash3_32_RandomBytesOfAllSizes() { - for(int i = 0; i < 1000; i++) { - byte[] byteArray = randomBytes(i); - - int actualHash = murmurHash3_32.hash(byteArray, byteArray.length, 0); - - HashFunction googleMurmur3_32 = Hashing.murmur3_32(0); - int expectedHash = googleMurmur3_32.hashBytes(byteArray).asInt(); - - assertThat(actualHash).isEqualTo(expectedHash); - } - } - - private byte[] randomBytes(int count) { - return RandomUtils.nextBytes(count); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PartitionKeyInternalTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PartitionKeyInternalTest.java deleted file mode 100644 index 46d72c3e5b66..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PartitionKeyInternalTest.java +++ /dev/null @@ -1,473 +0,0 @@ -/* - * - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; -import com.microsoft.azure.cosmosdb.CommonsBridgeInternal; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.PartitionKind; -import com.microsoft.azure.cosmosdb.Undefined; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternal; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternalHelper; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternalUtils; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import rx.functions.Func2; - -import java.util.ArrayList; - -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; -import static org.assertj.core.api.AssertionsForClassTypes.fail; - -public class PartitionKeyInternalTest { - - /** - * Tests serialization of empty partition key. - */ - @Test(groups="unit") - public void emptyPartitionKey() { - String json = "[]"; - PartitionKeyInternal partitionKey = PartitionKeyInternal.fromJsonString(json); - assertThat(partitionKey).isEqualTo(PartitionKeyInternal.getEmpty()); - assertThat(partitionKey.toJson()).isEqualTo("[]"); - } - - /** - * Tests serialization of various types. - */ - @Test(groups="unit") - public void variousTypes() { - String json = "[\"aa\", null, true, false, {}, 5, 5.5]"; - PartitionKeyInternal partitionKey = PartitionKeyInternal.fromJsonString(json); - assertThat(partitionKey).isEqualTo( - PartitionKeyInternal.fromObjectArray( - Lists.newArrayList(new Object[]{"aa", null, true, false, Undefined.Value(), 5, 5.5}), true)); - - assertThat(partitionKey.toJson()).isEqualTo("[\"aa\",null,true,false,{},5.0,5.5]"); - } - - /** - * Tests deserialization of empty string - */ - @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class) - public void deserializeEmptyString() { - PartitionKeyInternal.fromJsonString(""); - } - - /** - * Tests deserialization of null - */ - @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class) - public void deserializeNull() { - PartitionKeyInternal.fromJsonString(null); - } - - /** - * Tests deserialization of invalid partition key - */ - @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class) - public void invalidString() { - PartitionKeyInternal.fromJsonString("[aa]"); - } - - - /** - * Tests deserialization of invalid partition key - */ - @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class) - public void invalidNumber() { - PartitionKeyInternal.fromJsonString("[1.a]"); - } - - /** - * Tests deserialization of invalid partition key - */ - @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class) - public void missingBraces() { - PartitionKeyInternal.fromJsonString("[{]"); - } - - /** - * Missing Value - */ - @Test(groups = "unit") - public void missingValue() { - try { - PartitionKeyInternal.fromJsonString(""); - fail("should throw"); - } catch (IllegalArgumentException e) { - assertThat(e.getMessage()).isEqualTo( - String.format( - RMResources.UnableToDeserializePartitionKeyValue, "")); - } - } - - /** - * Tests serialization of infinity value. - */ - @Test(groups = "unit") - public void maxValue() { - String json = "\"Infinity\""; - PartitionKeyInternal partitionKey = PartitionKeyInternal.fromJsonString(json); - assertThat(partitionKey).isEqualTo(PartitionKeyInternal.ExclusiveMaximum); - } - - /** - * Tests serialization of minimum value. - */ - @Test(groups = "unit") - public void minValue() { - String json = "[]"; - PartitionKeyInternal partitionKey = PartitionKeyInternal.fromJsonString(json); - assertThat(partitionKey).isEqualTo(PartitionKeyInternal.InclusiveMinimum); - } - - /** - * Tests serialization of undefined value. - */ - @Test(groups = "unit") - public void undefinedValue() { - String json = "[]"; - PartitionKeyInternal partitionKey = PartitionKeyInternal.fromJsonString(json); - assertThat(partitionKey).isEqualTo(PartitionKeyInternal.Empty); - } - - /** - * Tests JsonConvert.DefaultSettings that could cause indentation. - */ - @Test(groups="unit") - public void jsonConvertDefaultSettings() { - String json = "[123.0]"; - PartitionKeyInternal partitionKey = PartitionKeyInternal.fromJsonString(json); - assertThat(partitionKey.toJson()).isEqualTo(json); - } - - /** - * Tests unicode characters in partition key - */ - @Test(groups="unit") - public void unicodeCharacters() { - String json = "[\"电脑\"]"; - PartitionKeyInternal partitionKey = PartitionKeyInternal.fromJsonString(json); - assertThat(partitionKey.toJson()).isEqualTo("[\"\u7535\u8111\"]"); - } - - /** - * Tests partition key value comparisons. - */ - @Test(groups="unit") - public void comparison() { - verifyComparison("[]", "[]", 0); - verifyComparison("[]", "[{}]", -1); - verifyComparison("[]", "[false]", -1); - verifyComparison("[]", "[true]", -1); - verifyComparison("[]", "[null]", -1); - verifyComparison("[]", "[2]", -1); - verifyComparison("[]", "[\"aa\"]", -1); - verifyComparison("[]", "\"Infinity\"", -1); - - verifyComparison("[{}]", "[]", 1); - verifyComparison("[{}]", "[{}]", 0); - verifyComparison("[{}]", "[false]", -1); - verifyComparison("[{}]", "[true]", -1); - verifyComparison("[{}]", "[null]", -1); - verifyComparison("[{}]", "[2]", -1); - verifyComparison("[{}]", "[\"aa\"]", -1); - verifyComparison("[{}]", "\"Infinity\"", -1); - - verifyComparison("[false]", "[]", 1); - verifyComparison("[false]", "[{}]", 1); - verifyComparison("[false]", "[null]", 1); - verifyComparison("[false]", "[false]", 0); - verifyComparison("[false]", "[true]", -1); - verifyComparison("[false]", "[2]", -1); - verifyComparison("[false]", "[\"aa\"]", -1); - verifyComparison("[false]", "\"Infinity\"", -1); - - verifyComparison("[true]", "[]", 1); - verifyComparison("[true]", "[{}]", 1); - verifyComparison("[true]", "[null]", 1); - verifyComparison("[true]", "[false]", 1); - verifyComparison("[true]", "[true]", 0); - verifyComparison("[true]", "[2]", -1); - verifyComparison("[true]", "[\"aa\"]", -1); - verifyComparison("[true]", "\"Infinity\"", -1); - - verifyComparison("[null]", "[]", 1); - verifyComparison("[null]", "[{}]", 1); - verifyComparison("[null]", "[null]", 0); - verifyComparison("[null]", "[false]", -1); - verifyComparison("[null]", "[true]", -1); - verifyComparison("[null]", "[2]", -1); - verifyComparison("[null]", "[\"aa\"]", -1); - verifyComparison("[null]", "\"Infinity\"", -1); - - verifyComparison("[2]", "[]", 1); - verifyComparison("[2]", "[{}]", 1); - verifyComparison("[2]", "[null]", 1); - verifyComparison("[2]", "[false]", 1); - verifyComparison("[2]", "[true]", 1); - verifyComparison("[1]", "[2]", -1); - verifyComparison("[2]", "[2]", 0); - verifyComparison("[3]", "[2]", 1); - verifyComparison("[2.1234344]", "[2]", 1); - verifyComparison("[2]", "[\"aa\"]", -1); - verifyComparison("[2]", "\"Infinity\"", -1); - - verifyComparison("[\"aa\"]", "[]", 1); - verifyComparison("[\"aa\"]", "[{}]", 1); - verifyComparison("[\"aa\"]", "[null]", 1); - verifyComparison("[\"aa\"]", "[false]", 1); - verifyComparison("[\"aa\"]", "[true]", 1); - verifyComparison("[\"aa\"]", "[2]", 1); - verifyComparison("[\"\"]", "[\"aa\"]", -1); - verifyComparison("[\"aa\"]", "[\"aa\"]", 0); - verifyComparison("[\"b\"]", "[\"aa\"]", 1); - verifyComparison("[\"aa\"]", "\"Infinity\"", -1); - - verifyComparison("\"Infinity\"", "[]", 1); - verifyComparison("\"Infinity\"", "[{}]", 1); - verifyComparison("\"Infinity\"", "[null]", 1); - verifyComparison("\"Infinity\"", "[false]", 1); - verifyComparison("\"Infinity\"", "[true]", 1); - verifyComparison("\"Infinity\"", "[2]", 1); - verifyComparison("\"Infinity\"", "[\"aa\"]", 1); - verifyComparison("\"Infinity\"", "\"Infinity\"", 0); - } - - /** - * Tests that invalid partition key value will throw an exception. - */ - @Test(groups = "unit", expectedExceptions = IllegalArgumentException.class) - public void invalidPartitionKeyValue() { - PartitionKeyInternal.fromObjectArray( - Lists.newArrayList(new Object[]{2, true, new StringBuilder()}), true); - } - - /** - * Tests {@link PartitionKeyInternal#contains(PartitionKeyInternal)} method. - */ - @Test(groups="unit") - public void contains() { - Func2 verifyContains = (parentPartitionKey, childPartitionKey) -> - PartitionKeyInternal.fromJsonString(parentPartitionKey) - .contains(PartitionKeyInternal.fromJsonString(childPartitionKey)); - - assertThat(verifyContains.call("[]", "[]")).isTrue(); - assertThat(verifyContains.call("[]", "[{}]")).isTrue(); - assertThat(verifyContains.call("[]", "[null]")).isTrue(); - assertThat(verifyContains.call("[]", "[true]")).isTrue(); - assertThat(verifyContains.call("[]", "[false]")).isTrue(); - assertThat(verifyContains.call("[]", "[2]")).isTrue(); - assertThat(verifyContains.call("[]", "[\"fdfd\"]")).isTrue(); - - assertThat(verifyContains.call("[2]", "[]")).isFalse(); - assertThat(verifyContains.call("[2]", "[2]")).isTrue(); - assertThat(verifyContains.call("[2]", "[2, \"USA\"]")).isTrue(); - assertThat(verifyContains.call("[1]", "[2, \"USA\"]")).isFalse(); - } - - @Test(groups="unit") - public void invalidPartitionKeyValueNonStrict() { - assertThat(PartitionKeyInternal.fromObjectArray(new Object[]{2, true, Undefined.Value()}, true)) - .isEqualTo( - PartitionKeyInternal.fromObjectArray(new Object[]{2, true, new StringBuilder()}, false)); - } - - /** - * Tests constructing effective partition key value. - */ - @Test(groups="unit") - public void hashEffectivePartitionKey() { - - assertThat(PartitionKeyInternalHelper.getEffectivePartitionKeyString(PartitionKeyInternal.InclusiveMinimum, new PartitionKeyDefinition())) - .isEqualTo(PartitionKeyInternalHelper.MinimumInclusiveEffectivePartitionKey); - - assertThat( - PartitionKeyInternalHelper.getEffectivePartitionKeyString(PartitionKeyInternal.ExclusiveMaximum, new PartitionKeyDefinition())) - .isEqualTo(PartitionKeyInternalHelper.MaximumExclusiveEffectivePartitionKey); - - PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition(); - partitionKeyDefinition.setPaths(Lists.newArrayList("/A", "/B", "/C", "/E", "/F", "/G")); - - PartitionKeyInternal partitionKey = PartitionKeyInternal.fromObjectArray( - new Object[]{2, true, false, null, Undefined.Value(), "Привет!"}, true); - String effectivePartitionKey = PartitionKeyInternalHelper.getEffectivePartitionKeyString(partitionKey, partitionKeyDefinition); - - assertThat(effectivePartitionKey).isEqualTo("05C1D19581B37C05C0000302010008D1A0D281D1B9D1B3D1B6D2832200"); - } - - @DataProvider(name = "v2ParamProvider") - public Object[][] v2ParamProvider() { - return new Object[][] { - {"[5.0]", "19C08621B135968252FB34B4CF66F811"}, - { "[5.12312419050912359123]", "0EF2E2D82460884AF0F6440BE4F726A8"}, - {"[\"redmond\"]", "22E342F38A486A088463DFF7838A5963"}, - {"[true]", "0E711127C5B5A8E4726AC6DD306A3E59"}, - {"[false]", "2FE1BE91E90A3439635E0E9E37361EF2"}, - {"[]", ""}, - {"[null]", "378867E4430E67857ACE5C908374FE16"}, - {"[{}]", "11622DAA78F835834610ABE56EFF5CB5"}, - {"[5.0, \"redmond\", true, null]", "3032DECBE2AB1768D8E0AEDEA35881DF"}, - {"[\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"]", - "36375D21568760E891C9CB7002D5E059"}, - }; - } - - /** - * Tests binary encoding of partition key - */ - @Test(groups="unit", dataProvider = "v2ParamProvider") - public void partitionKeyBinaryEncodingV2(String partitionKeyRangeJson, String expectedHexEncoding) { - validateEffectivePartitionKeyV2(partitionKeyRangeJson, expectedHexEncoding); - } - - /** - * Tests that effective partition key produced by us and the backend is the same. - */ - @Test(groups="unit") - public void managedNativeCompatibility() { - PartitionKeyInternal partitionKey = - PartitionKeyInternal.fromJsonString("[\"по-русски\",null,true,false,{},5.5]"); - - PartitionKeyDefinition pkDefinition = new PartitionKeyDefinition(); - pkDefinition.setPaths(ImmutableList.of("/field1", "/field2", "/field3", "/field4", "/field5", "/field6")); - - String effectivePartitionKey = PartitionKeyInternalHelper.getEffectivePartitionKeyString(partitionKey, pkDefinition); - assertThat("05C1D39FA55F0408D1C0D1BF2ED281D284D282D282D1BBD1B9000103020005C016").isEqualTo(effectivePartitionKey); - - String latin = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"; - String nonLatin = "абвгдеёжзийклмнопрстуфхцчшщъыьэюяабвгдеёжзийклмнопрстуфхцчшщъыьэюяабвгдеёжзийклмнопрстуфхцчшщъыьэюяабвгдеёжзийклмнопрстуфхцчшщъыьэюя"; - - verifyEffectivePartitionKeyEncoding(latin, 99, "05C19B2DC38FC00862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F7071727374757600", false); - verifyEffectivePartitionKeyEncoding(latin, 99, "072D8FA3228DD2A6C0A7129C845700E6", true); - - verifyEffectivePartitionKeyEncoding(latin, 100, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 100, "023D5F0B62EBEF22A43564F267193B4D", true); - - verifyEffectivePartitionKeyEncoding(latin, 101, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 101, "357D83181DB32D35F58CDA3C9F2E0742", true); - - verifyEffectivePartitionKeyEncoding(latin, 102, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 102, "12B320F72959AB449FD8E090C6B23B88", true); - - verifyEffectivePartitionKeyEncoding(latin, 103, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 103, "25FD21A31C69A8C8AD994F7FAC2B2B9F", true); - - verifyEffectivePartitionKeyEncoding(latin, 104, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 104, "1DC6FB1CF6E1228C506AA6C8735023C4", true); - - verifyEffectivePartitionKeyEncoding(latin, 105, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 105, "308E1E7870956CE5D9BDAD01200E09BD", true); - - verifyEffectivePartitionKeyEncoding(latin, 106, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 106, "362E21ABDEA7179DBDF7BF549DD8303B", true); - - verifyEffectivePartitionKeyEncoding(latin, 107, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 107, "1EBE932ECEFA4F53CE339D31B6BF53FD", true); - - verifyEffectivePartitionKeyEncoding(latin, 108, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 108, "3BFA3A6E9CBABA0EF756AEDEC66B1B3C", true); - - verifyEffectivePartitionKeyEncoding(latin, 109, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 109, "2880BF78DE0CE2CD1B0120EDA22601C4", true); - - verifyEffectivePartitionKeyEncoding(latin, 110, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 110, "1F3577D1D9CA7FC56100AED11F4DC646", true); - - verifyEffectivePartitionKeyEncoding(latin, 111, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 111, "205A9EB61F3B063E61C6ED655C9220E6", true); - - verifyEffectivePartitionKeyEncoding(latin, 112, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 112, "1152A43F1A852AFDDD4518C9CDD48616", true); - - verifyEffectivePartitionKeyEncoding(latin, 113, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 113, "38E2EB2EF54012B5CA40CDA34F1C7736", true); - - verifyEffectivePartitionKeyEncoding(latin, 114, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 114, "19BCC416843B9085DBBC18E8C7C80D72", true); - - verifyEffectivePartitionKeyEncoding(latin, 115, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 115, "03F1BB89FD8E9747B047281E80FA2E84", true); - - verifyEffectivePartitionKeyEncoding(latin, 116, "05C1DD5D8149640862636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767778797A7B62636465666768696A6B6C6D6E6F707172737475767700", false); - verifyEffectivePartitionKeyEncoding(latin, 116, "2BA0757B833F3922A3CBBB6DDA3803B4", true); - - verifyEffectivePartitionKeyEncoding(nonLatin, 49, "05C1C1BD37FE08D1B1D1B2D1B3D1B4D1B5D1B6D292D1B7D1B8D1B9D1BAD1BBD1BCD1BDD1BED1BFD1C0D281D282D283D284D285D286D287D288D289D28AD28BD28CD28DD28ED28FD290D1B1D1B2D1B3D1B4D1B5D1B6D292D1B7D1B8D1B9D1BAD1BBD1BCD1BDD1BED1BF00", false); - verifyEffectivePartitionKeyEncoding(nonLatin, 49, "3742C1AF65AFA809282539F4BCDF2F6F", true); - - verifyEffectivePartitionKeyEncoding(nonLatin, 50, "05C1B339EF472008D1B1D1B2D1B3D1B4D1B5D1B6D292D1B7D1B8D1B9D1BAD1BBD1BCD1BDD1BED1BFD1C0D281D282D283D284D285D286D287D288D289D28AD28BD28CD28DD28ED28FD290D1B1D1B2D1B3D1B4D1B5D1B6D292D1B7D1B8D1B9D1BAD1BBD1BCD1BDD1BED1BFD1C000", false); - verifyEffectivePartitionKeyEncoding(nonLatin, 50, "399CF1F141E066E09CC7557EA7F0977A", true); - - verifyEffectivePartitionKeyEncoding(nonLatin, 51, "05C1EB1F29DBFA08D1B1D1B2D1B3D1B4D1B5D1B6D292D1B7D1B8D1B9D1BAD1BBD1BCD1BDD1BED1BFD1C0D281D282D283D284D285D286D287D288D289D28AD28BD28CD28DD28ED28FD290D1B1D1B2D1B3D1B4D1B5D1B6D292D1B7D1B8D1B9D1BAD1BBD1BCD1BDD1BED1BFD1C0D2", false); - verifyEffectivePartitionKeyEncoding(nonLatin, 51, "2D63C2F5FDAC6EFE5660CD509A723A90", true); - - verifyEffectivePartitionKeyEncoding(nonLatin, 99, "05C1E72F79C71608D1B1D1B2D1B3D1B4D1B5D1B6D292D1B7D1B8D1B9D1BAD1BBD1BCD1BDD1BED1BFD1C0D281D282D283D284D285D286D287D288D289D28AD28BD28CD28DD28ED28FD290D1B1D1B2D1B3D1B4D1B5D1B6D292D1B7D1B8D1B9D1BAD1BBD1BCD1BDD1BED1BFD1C0D2", false); - verifyEffectivePartitionKeyEncoding(nonLatin, 99, "1E9836D9BCB67FDB2B5C984BD40AFAF9", true); - - verifyEffectivePartitionKeyEncoding(nonLatin, 100, "05C1E3653D9F3E08D1B1D1B2D1B3D1B4D1B5D1B6D292D1B7D1B8D1B9D1BAD1BBD1BCD1BDD1BED1BFD1C0D281D282D283D284D285D286D287D288D289D28AD28BD28CD28DD28ED28FD290D1B1D1B2D1B3D1B4D1B5D1B6D292D1B7D1B8D1B9D1BAD1BBD1BCD1BDD1BED1BFD1C0D2", false); - verifyEffectivePartitionKeyEncoding(nonLatin, 100, "16102F19448867537E51BB4377962AF9", true); - - verifyEffectivePartitionKeyEncoding(nonLatin, 101, "05C1E3653D9F3E08D1B1D1B2D1B3D1B4D1B5D1B6D292D1B7D1B8D1B9D1BAD1BBD1BCD1BDD1BED1BFD1C0D281D282D283D284D285D286D287D288D289D28AD28BD28CD28DD28ED28FD290D1B1D1B2D1B3D1B4D1B5D1B6D292D1B7D1B8D1B9D1BAD1BBD1BCD1BDD1BED1BFD1C0D2", false); - verifyEffectivePartitionKeyEncoding(nonLatin, 101, "0B6D25D07748AB9CA0F523D4BAD146C8", true); - } - - private static void validateEffectivePartitionKeyV2(String partitionKeyRangeJson, String expectedHexEncoding) { - PartitionKeyInternal partitionKey = PartitionKeyInternal.fromJsonString(partitionKeyRangeJson); - - PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition(); - partitionKeyDefinition.setKind(PartitionKind.Hash); - CommonsBridgeInternal.setV2(partitionKeyDefinition); - ArrayList paths = new ArrayList(); - for (int i = 0; i < partitionKey.getComponents().size(); i++) { - paths.add("/path" + i); - } - - if (paths.size() > 0) { - partitionKeyDefinition.setPaths(paths); - } - - String hexEncodedEffectivePartitionKey = PartitionKeyInternalHelper.getEffectivePartitionKeyString(partitionKey, partitionKeyDefinition); - assertThat(hexEncodedEffectivePartitionKey).isEqualTo(expectedHexEncoding); - } - - private void verifyComparison(String leftKey, String rightKey, int result) { - assertThat(PartitionKeyInternal.fromJsonString(leftKey). - compareTo(PartitionKeyInternal.fromJsonString(rightKey))).isEqualTo(result); - } - - private static void verifyEffectivePartitionKeyEncoding(String buffer, int length, String expectedValue, boolean v2) { - PartitionKeyDefinition pkDefinition = new PartitionKeyDefinition(); - pkDefinition.setPaths(ImmutableList.of("/field1")); - if (v2) { - CommonsBridgeInternal.setV2(pkDefinition); - } - - PartitionKeyInternal pk = PartitionKeyInternalUtils.createPartitionKeyInternal(buffer.substring(0, length)); - assertThat(PartitionKeyInternalHelper.getEffectivePartitionKeyString(pk, pkDefinition)).isEqualTo(expectedValue); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PartitionKeyTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PartitionKeyTest.java deleted file mode 100644 index 31164b31156c..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PartitionKeyTest.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.collect.ImmutableList; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.Undefined; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternalHelper; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; -import static org.assertj.core.api.AssertionsForClassTypes.fail; - -public class PartitionKeyTest { - - @DataProvider(name = "paramProvider") - public Object[][] paramProvider() { - return new Object[][] { - { Undefined.Value(), "[{}]" }, - { null, "[null]"}, - { false, "[false]"}, - { true, "[true]"}, - { 123.456, "[123.456]"}, - { 5, "[5.0]"}, - { "PartitionKeyValue", "[\"PartitionKeyValue\"]"}, - }; - } - - /** - * Simple test for @{@link PartitionKey}. - */ - @Test(groups = "unit", dataProvider = "paramProvider") - public void partitionKey(Object partitionKey, String partitionKeyAsJson) { - assertThat(new PartitionKey(partitionKey).toString()).isEqualTo(partitionKeyAsJson); - } - - /** - * Test equals override for @{@link PartitionKey} - */ - @Test(groups = "unit", dataProvider = "paramProvider") - public void partitionKeyCompare(Object partitionKey, String partitionKeyAsJson) { - assertThat(new PartitionKey(partitionKey)).isEqualTo(PartitionKey.FromJsonString(partitionKeyAsJson)); - } - - /** - * too few partition key values. - */ - @Test(groups = "unit") - public void tooFewPartitionKeyComponents() { - PartitionKeyDefinition pkd = new PartitionKeyDefinition(); - pkd.setPaths(ImmutableList.of("/pk1", "/pk2")); - PartitionKey pk = PartitionKey.FromJsonString("[\"PartitionKeyValue\"]"); - - try { - PartitionKeyInternalHelper.getEffectivePartitionKeyString(pk.getInternalPartitionKey(), pkd); - fail("should throw"); - } catch (IllegalArgumentException e) { - assertThat(e.getMessage()).isEqualTo(RMResources.TooFewPartitionKeyComponents); - } - } - - /** - * too many partition key values. - */ - @Test(groups = "unit") - public void tooManyPartitionKeyComponents() { - PartitionKeyDefinition pkd = new PartitionKeyDefinition(); - pkd.setPaths(ImmutableList.of("/pk1")); - PartitionKey pk = PartitionKey.FromJsonString("[true, false]"); - - try { - PartitionKeyInternalHelper.getEffectivePartitionKeyString(pk.getInternalPartitionKey(), pkd); - fail("should throw"); - } catch (IllegalArgumentException e) { - assertThat(e.getMessage()).isEqualTo(RMResources.TooManyPartitionKeyComponents); - } - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/QuorumReaderTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/QuorumReaderTest.java deleted file mode 100644 index cff71c20577a..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/QuorumReaderTest.java +++ /dev/null @@ -1,677 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.base.Stopwatch; -import com.google.common.collect.ImmutableList; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.rx.DocumentServiceRequestContextValidator; -import com.microsoft.azure.cosmosdb.rx.DocumentServiceRequestValidator; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.DocumentServiceRequestContext; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.mockito.Mockito; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import rx.Single; -import rx.observers.TestSubscriber; - -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.net.URI; -import java.time.Duration; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import static org.assertj.core.api.Assertions.assertThat; - -public class QuorumReaderTest { - private final Duration timeResolution = Duration.ofMillis(10); - private final Configs configs; - - public QuorumReaderTest() { - configs = new Configs(); - } - - @DataProvider(name = "simpleReadStrongArgProvider") - public Object[][] simpleReadStrongArgProvider() { - return new Object[][]{ - //int replicaCountToRead, ReadMode readMode, Long lsn, Long localLSN - { 1, ReadMode.Strong, 51l, 18l }, - { 2, ReadMode.Strong, 51l, 18l }, - { 3, ReadMode.Strong, 51l, 18l }, - - { 2, ReadMode.Any, 51l, 18l }, - { 1, ReadMode.Any, 51l, 18l }, - - { 2, ReadMode.Any, null, 18l }, - { 1, ReadMode.Any, null, 18l }, - }; - } - - private StoreResponse storeResponse(Long lsn, Long localLSN, Double rc) { - StoreResponseBuilder srb = StoreResponseBuilder.create(); - if (rc != null) { - srb.withRequestCharge(rc); - } - - if (lsn != null) { - srb.withLSN(lsn); - } - - if (localLSN != null) { - srb.withLocalLSN(localLSN); - } - - return srb.build(); - } - - @Test(groups = "unit", dataProvider = "simpleReadStrongArgProvider") - public void basicReadStrong_AllReplicasSameLSN(int replicaCountToRead, ReadMode readMode, Long lsn, Long localLSN) { - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - URI primaryReplicaURI = URI.create("primary"); - ImmutableList secondaryReplicaURIs = ImmutableList.of(URI.create("secondary1"), URI.create("secondary2"), URI.create("secondary3")); - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryReplicaURI) - .withSecondary(secondaryReplicaURIs) - .build(); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - - request.requestContext = new DocumentServiceRequestContext(); - request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - request.requestContext.resolvedPartitionKeyRange = Mockito.mock(PartitionKeyRange.class); - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - - BigDecimal requestChargePerRead = new BigDecimal(1.1); - - StoreResponse primaryResponse = storeResponse(lsn, localLSN, requestChargePerRead.doubleValue()); - StoreResponse secondaryResponse1 = storeResponse(lsn, localLSN, requestChargePerRead.doubleValue()); - StoreResponse secondaryResponse2 = storeResponse(lsn, localLSN, requestChargePerRead.doubleValue()); - StoreResponse secondaryResponse3 = storeResponse(lsn, localLSN, requestChargePerRead.doubleValue()); - - TransportClientWrapper transportClientWrapper = TransportClientWrapper.Builder.uriToResultBuilder() - .storeResponseOn(primaryReplicaURI, OperationType.Read, ResourceType.Document, primaryResponse, false) - .storeResponseOn(secondaryReplicaURIs.get(0), OperationType.Read, ResourceType.Document, secondaryResponse1, false) - .storeResponseOn(secondaryReplicaURIs.get(1), OperationType.Read, ResourceType.Document, secondaryResponse2, false) - .storeResponseOn(secondaryReplicaURIs.get(2), OperationType.Read, ResourceType.Document, secondaryResponse3, false) - .build(); - - StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer); - - GatewayServiceConfigurationReader serviceConfigurator = Mockito.mock(GatewayServiceConfigurationReader.class); - IAuthorizationTokenProvider authTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - QuorumReader quorumReader = new QuorumReader(configs, transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, storeReader, serviceConfigurator, authTokenProvider); - - Single storeResponseSingle = quorumReader.readStrongAsync(request, replicaCountToRead, readMode); - - StoreResponseValidator.Builder validatorBuilder = StoreResponseValidator.create() - .withBELocalLSN(localLSN) - .withRequestCharge(requestChargePerRead.multiply(BigDecimal.valueOf(replicaCountToRead)).setScale(2, RoundingMode.FLOOR).doubleValue()); - - if (lsn != null) { - validatorBuilder.withBELSN(lsn); - } - - validateSuccess(storeResponseSingle, validatorBuilder.build()); - - transportClientWrapper.validate() - .verifyNumberOfInvocations(replicaCountToRead); - addressSelectorWrapper.validate() - .verifyNumberOfForceCachRefresh(0) - .verifyVesolvePrimaryUriAsyncCount(0) - .verifyTotalInvocations(1); - } - - @DataProvider(name = "readStrong_RequestBarrierArgProvider") - public Object[][] readStrong_RequestBarrierArgProvider() { - return new Object[][]{ - { 1 }, - { 2 }, - { configs.getMaxNumberOfReadBarrierReadRetries() - 1 }, - { configs.getMaxNumberOfReadBarrierReadRetries() }, - }; - } - - @Test(groups = "unit", dataProvider = "readStrong_RequestBarrierArgProvider") - public void readStrong_OnlySecondary_RequestBarrier_Success(int numberOfBarrierRequestTillCatchUp) { - // scenario: we get lsn l1, l2 where l1 > l2 - // we do barrier request and send it to all replicas till we have two replicas with at least l1 lsn - - ReadMode readMode = ReadMode.Strong; - int replicaCountToRead = 2; - - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - URI primaryReplicaURI = URI.create("primary"); - ImmutableList secondaryReplicaURIs = ImmutableList.of(URI.create("secondary1"), URI.create("secondary2")); - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryReplicaURI) - .withSecondary(secondaryReplicaURIs) - .build(); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - - request.requestContext = new DocumentServiceRequestContext(); - request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - request.requestContext.resolvedPartitionKeyRange = Mockito.mock(PartitionKeyRange.class); - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - - BigDecimal requestChargePerRead = new BigDecimal(1.1); - BigDecimal requestChargePerHead = BigDecimal.ZERO; - - long expectedQuorumLsn = 53; - long expectedQuorumLocalLSN = 20; - - StoreResponse primaryResponse = StoreResponseBuilder.create() - .withLSN(expectedQuorumLsn - 2) - .withLocalLSN(expectedQuorumLocalLSN - 2) - .withRequestCharge(requestChargePerRead) - .build(); - - TransportClientWrapper.Builder.UriToResultBuilder builder = TransportClientWrapper.Builder.uriToResultBuilder() - .storeResponseOn(primaryReplicaURI, OperationType.Read, ResourceType.Document, primaryResponse, false); - - // slow replica - StoreResponse readResponse = StoreResponseBuilder.create() - .withLSN(expectedQuorumLsn - 1) - .withLocalLSN(expectedQuorumLocalLSN -1) - .withRequestCharge(requestChargePerRead) - .build(); - builder.storeResponseOn(secondaryReplicaURIs.get(0), OperationType.Read, ResourceType.Document, readResponse, false); - - for(int i = 0; i < numberOfBarrierRequestTillCatchUp; i++) { - int lsnIncrement = (i == numberOfBarrierRequestTillCatchUp - 1) ? 1 : 0; - readResponse = StoreResponseBuilder.create() - .withLSN(expectedQuorumLsn - 1 + lsnIncrement) - .withLocalLSN(expectedQuorumLocalLSN - 1 + lsnIncrement) - .withRequestCharge(requestChargePerRead) - .build(); - builder.storeResponseOn(secondaryReplicaURIs.get(0), OperationType.Read, ResourceType.Document, readResponse, false); - - StoreResponse headResponse = StoreResponseBuilder.create() - .withLSN(expectedQuorumLsn - 1 + lsnIncrement) - .withLocalLSN(expectedQuorumLocalLSN - 1 + lsnIncrement) - .withRequestCharge(requestChargePerHead) - .build(); - builder.storeResponseOn(secondaryReplicaURIs.get(0), OperationType.Head, ResourceType.DocumentCollection, headResponse, false); - } - - // faster replica - readResponse = StoreResponseBuilder.create() - .withLSN(expectedQuorumLsn) - .withLocalLSN(expectedQuorumLocalLSN) - .withRequestCharge(requestChargePerRead) - .build(); - builder.storeResponseOn(secondaryReplicaURIs.get(1), OperationType.Read, ResourceType.Document, readResponse, false); - for(int i = 0; i < numberOfBarrierRequestTillCatchUp; i++) { - StoreResponse headResponse = StoreResponseBuilder.create() - .withLSN(expectedQuorumLsn + 10 * (i + 1)) - .withLocalLSN(expectedQuorumLocalLSN + 10 * (i + 1)) - .withRequestCharge(requestChargePerHead) - .build(); - builder.storeResponseOn(secondaryReplicaURIs.get(1), OperationType.Head, ResourceType.DocumentCollection, headResponse, false); - } - - TransportClientWrapper transportClientWrapper = builder.build(); - - StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer); - - GatewayServiceConfigurationReader serviceConfigurator = Mockito.mock(GatewayServiceConfigurationReader.class); - IAuthorizationTokenProvider authTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - QuorumReader quorumReader = new QuorumReader(configs, transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, storeReader, serviceConfigurator, authTokenProvider); - - int expectedNumberOfReads = 2; - int expectedNumberOfHeads = 2 * numberOfBarrierRequestTillCatchUp; - - double expectedRequestCharge = requestChargePerRead.multiply(BigDecimal.valueOf(expectedNumberOfReads)).add( - requestChargePerHead.multiply(BigDecimal.valueOf(expectedNumberOfHeads))).setScale(4, RoundingMode.FLOOR).doubleValue(); - - Stopwatch stopwatch = Stopwatch.createStarted(); - - Single storeResponseSingle = quorumReader.readStrongAsync(request, replicaCountToRead, readMode); - - StoreResponseValidator validator = StoreResponseValidator.create() - .withBELSN(expectedQuorumLsn) - .withRequestCharge(expectedRequestCharge) - .build(); - - validateSuccess(storeResponseSingle, validator); - - assertThat(stopwatch.elapsed().plus(timeResolution)).isGreaterThanOrEqualTo(Duration.ofMillis( - numberOfBarrierRequestTillCatchUp * configs.getDelayBetweenReadBarrierCallsInMs())); - - transportClientWrapper.validate() - .verifyNumberOfInvocations(expectedNumberOfReads + expectedNumberOfHeads); - addressSelectorWrapper.validate() - .verifyNumberOfForceCachRefresh(0) - .verifyVesolvePrimaryUriAsyncCount(0) - .verifyTotalInvocations(1 + numberOfBarrierRequestTillCatchUp); - - AddressSelectorWrapper.InOrderVerification.Verifier addressSelectorVerifier = AddressSelectorWrapper.InOrderVerification.Verifier.builder() - .resolveAllUriAsync_IncludePrimary(false) - .resolveAllUriAsync_ForceRefresh(false) - .build(); - - addressSelectorWrapper.getInOrderVerification() - .verifyNumberOfInvocations(1 + numberOfBarrierRequestTillCatchUp) - .verifyOnAll(addressSelectorVerifier); - - DocumentServiceRequestValidator requestValidator = DocumentServiceRequestValidator.builder() - .add(DocumentServiceRequestContextValidator.builder() - .qurorumSelectedLSN(0l) - .globalCommittedSelectedLSN(0l) - .storeResponses(null) - .build()) - .build(); - requestValidator.validate(request); - } - - @DataProvider(name = "readStrong_SecondaryReadBarrierExhausted_ReadBarrierOnPrimary_SuccessArgProvider") - public Object[][] readStrong_SecondaryReadBarrierExhausted_ReadBarrierOnPrimary_SuccessArgProvider() { - return new Object[][]{ - { 1 }, - { 2 }, - { configs.getMaxNumberOfReadBarrierReadRetries() - 1 }, - { configs.getMaxNumberOfReadBarrierReadRetries() }, - }; - } - - @Test(groups = "unit", dataProvider = "readStrong_SecondaryReadBarrierExhausted_ReadBarrierOnPrimary_SuccessArgProvider") - public void readStrong_SecondaryReadBarrierExhausted_ReadBarrierOnPrimary_Success(int numberOfHeadBarriersWithPrimaryIncludedTillQuorumMet) { - // scenario: we exhaust all barrier request retries on secondaries - // after that we start barrier requests including the primary - - int numberOfBarrierRequestTillCatchUp = configs.getMaxNumberOfReadBarrierReadRetries() + numberOfHeadBarriersWithPrimaryIncludedTillQuorumMet; - - ReadMode readMode = ReadMode.Strong; - int replicaCountToRead = 2; - - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - URI primaryReplicaURI = URI.create("primary"); - ImmutableList secondaryReplicaURIs = ImmutableList.of(URI.create("secondary1"), URI.create("secondary2")); - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryReplicaURI) - .withSecondary(secondaryReplicaURIs) - .build(); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - - request.requestContext = new DocumentServiceRequestContext(); - request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - request.requestContext.resolvedPartitionKeyRange = Mockito.mock(PartitionKeyRange.class); - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - - BigDecimal requestChargePerRead = new BigDecimal(1.1); - BigDecimal requestChargePerHead = BigDecimal.ZERO; - - TransportClientWrapper.Builder.UriToResultBuilder builder = TransportClientWrapper.Builder.uriToResultBuilder(); - - long expectedQuorumLsn = 53; - long expectedQuorumLocalLSN = 20; - - for(int i = 0; i < numberOfHeadBarriersWithPrimaryIncludedTillQuorumMet; i++) { - int lsnIncrement = (i == numberOfHeadBarriersWithPrimaryIncludedTillQuorumMet - 1) ? 1 : 0; - StoreResponse headResponse = StoreResponseBuilder.create() - .withLSN(expectedQuorumLsn - 1 + lsnIncrement) - .withLocalLSN(expectedQuorumLocalLSN - 1 + lsnIncrement) - .withRequestCharge(requestChargePerHead) - .build(); - builder.storeResponseOn(primaryReplicaURI, OperationType.Head, ResourceType.DocumentCollection, headResponse, false); - } - - // slow replica - StoreResponse readResponse = StoreResponseBuilder.create() - .withLSN(expectedQuorumLsn - 1) - .withLocalLSN(expectedQuorumLocalLSN - 1) - .withRequestCharge(requestChargePerRead) - .build(); - builder.storeResponseOn(secondaryReplicaURIs.get(0), OperationType.Read, ResourceType.Document, readResponse, false); - - for(int i = 0; i < numberOfBarrierRequestTillCatchUp; i++) { - int lsnIncrement = (i == numberOfBarrierRequestTillCatchUp - 1) ? 1 : 0; - readResponse = StoreResponseBuilder.create() - .withLSN(expectedQuorumLsn - 1 + lsnIncrement) - .withLocalLSN(expectedQuorumLocalLSN - 1 + lsnIncrement) - .withRequestCharge(requestChargePerRead) - .build(); - builder.storeResponseOn(secondaryReplicaURIs.get(0), OperationType.Read, ResourceType.Document, readResponse, false); - - StoreResponse headResponse = StoreResponseBuilder.create() - .withLSN(expectedQuorumLsn - 1 + lsnIncrement) - .withLocalLSN(expectedQuorumLocalLSN - 1 + lsnIncrement) - .withRequestCharge(requestChargePerHead) - .build(); - builder.storeResponseOn(secondaryReplicaURIs.get(0), OperationType.Head, ResourceType.DocumentCollection, headResponse, false); - } - - // faster replica - readResponse = StoreResponseBuilder.create() - .withLSN(expectedQuorumLsn) - .withLocalLSN(expectedQuorumLocalLSN) - .withRequestCharge(requestChargePerRead) - .build(); - builder.storeResponseOn(secondaryReplicaURIs.get(1), OperationType.Read, ResourceType.Document, readResponse, false); - for(int i = 0; i < numberOfBarrierRequestTillCatchUp; i++) { - StoreResponse headResponse = StoreResponseBuilder.create() - .withLSN(expectedQuorumLsn + 10 * (i + 1)) - .withLocalLSN(expectedQuorumLocalLSN + 10 * (i + 1)) - .withRequestCharge(requestChargePerHead) - .build(); - builder.storeResponseOn(secondaryReplicaURIs.get(1), OperationType.Head, ResourceType.DocumentCollection, headResponse, false); - } - - TransportClientWrapper transportClientWrapper = builder.build(); - - StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer); - - GatewayServiceConfigurationReader serviceConfigurator = Mockito.mock(GatewayServiceConfigurationReader.class); - IAuthorizationTokenProvider authTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - QuorumReader quorumReader = new QuorumReader(configs, transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, storeReader, serviceConfigurator, authTokenProvider); - - int beforeSecondariesRetriesExhausted_expectedNumberOfReads = 2; - int beforeSecondariesRetriesExhausted_expectedNumberOfHeads = 2 * configs.getMaxNumberOfReadBarrierReadRetries(); - - int numberOfHeadRetriesRequestWhenPrimaryIncluded = 3 * numberOfHeadBarriersWithPrimaryIncludedTillQuorumMet; - - double expectedRequestCharge = requestChargePerRead.multiply(BigDecimal.valueOf(beforeSecondariesRetriesExhausted_expectedNumberOfReads)) - .add(requestChargePerHead.multiply(BigDecimal.valueOf(beforeSecondariesRetriesExhausted_expectedNumberOfHeads))) - .setScale(4, RoundingMode.FLOOR).doubleValue(); - - Stopwatch stopwatch = Stopwatch.createStarted(); - - Single storeResponseSingle = quorumReader.readStrongAsync(request, replicaCountToRead, readMode); - - StoreResponseValidator validator = StoreResponseValidator.create() - .withBELSN(expectedQuorumLsn) - .withRequestCharge(expectedRequestCharge) - .build(); - - validateSuccess(storeResponseSingle, validator); - - assertThat(stopwatch.elapsed().plus(timeResolution)).isGreaterThanOrEqualTo(Duration.ofMillis( - numberOfBarrierRequestTillCatchUp * configs.getDelayBetweenReadBarrierCallsInMs())); - - transportClientWrapper.validate() - .verifyNumberOfInvocations(beforeSecondariesRetriesExhausted_expectedNumberOfReads - + beforeSecondariesRetriesExhausted_expectedNumberOfHeads - + numberOfHeadRetriesRequestWhenPrimaryIncluded); - addressSelectorWrapper.validate() - .verifyNumberOfForceCachRefresh(0) - .verifyVesolvePrimaryUriAsyncCount(0) - .verifyTotalInvocations(1 + numberOfBarrierRequestTillCatchUp); - - AddressSelectorWrapper.InOrderVerification.Verifier primaryNotIncludedVerifier = AddressSelectorWrapper - .InOrderVerification.Verifier.builder() - .resolveAllUriAsync_IncludePrimary(false) - .resolveAllUriAsync_ForceRefresh(false) - .build(); - - AddressSelectorWrapper.InOrderVerification.Verifier primaryIncludedVerifier = AddressSelectorWrapper - .InOrderVerification.Verifier.builder() - .resolveAllUriAsync_IncludePrimary(true) - .resolveAllUriAsync_ForceRefresh(false) - .build(); - - int numberOfAddressResolutionWithoutPrimary = configs.getMaxNumberOfReadBarrierReadRetries()+ 1; - int numberOfAddressResolutionWithPrimary = 1; - - AddressSelectorWrapper.InOrderVerification ov = addressSelectorWrapper.getInOrderVerification(); - - for(int i = 0; i < numberOfAddressResolutionWithoutPrimary; i++) { - ov.verifyNext(primaryNotIncludedVerifier); - } - - for(int i = 0; i < numberOfAddressResolutionWithPrimary; i++) { - ov.verifyNext(primaryIncludedVerifier); - } - - DocumentServiceRequestValidator requestValidator = DocumentServiceRequestValidator.builder() - .add(DocumentServiceRequestContextValidator.builder() - .qurorumSelectedLSN(0l) - .globalCommittedSelectedLSN(0l) - .storeResponses(null) - .build()) - .build(); - requestValidator.validate(request); - } - - @Test(groups = "unit") - public void readStrong_QuorumNotSelected_ReadPrimary() { - // scenario: attempts to read from secondaries, - // only one secondary is available so ends in QuorumNotSelected State - // reads from Primary and succeeds - - ReadMode readMode = ReadMode.Strong; - int replicaCountToRead = 2; - - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - URI primaryReplicaURI = URI.create("primary"); - ImmutableList secondaryReplicaURIs = ImmutableList.of(URI.create("secondary1")); - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryReplicaURI) - .withSecondary(secondaryReplicaURIs) - .build(); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - - request.requestContext = new DocumentServiceRequestContext(); - request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - request.requestContext.resolvedPartitionKeyRange = Mockito.mock(PartitionKeyRange.class); - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - - BigDecimal requestChargePerRead = new BigDecimal(1.1); - BigDecimal requestChargePerHead = BigDecimal.ZERO; - - TransportClientWrapper.Builder.UriToResultBuilder builder = TransportClientWrapper.Builder.uriToResultBuilder(); - - long primaryLSN = 52; - long primaryLocalLSN = 19; - - StoreResponse headResponse = StoreResponseBuilder.create() - .withLSN(primaryLSN) - .withLocalLSN(primaryLocalLSN) - .withHeader(WFConstants.BackendHeaders.CURRENT_REPLICA_SET_SIZE, "2") - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LSN, Long.toString(primaryLSN)) - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LOCAL_LSN, Long.toString(primaryLocalLSN)) - .withRequestCharge(requestChargePerRead) - .build(); - builder.storeResponseOn(primaryReplicaURI, OperationType.Read, ResourceType.Document, headResponse, false); - - StoreResponse readResponse = StoreResponseBuilder.create() - .withLSN(primaryLSN) - .withLocalLSN(primaryLocalLSN) - .withRequestCharge(requestChargePerRead) - .build(); - builder.storeResponseOn(secondaryReplicaURIs.get(0), OperationType.Read, ResourceType.Document, readResponse, false); - - TransportClientWrapper transportClientWrapper = builder.build(); - - StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer); - - GatewayServiceConfigurationReader serviceConfigurator = Mockito.mock(GatewayServiceConfigurationReader.class); - IAuthorizationTokenProvider authTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - QuorumReader quorumReader = new QuorumReader(configs, transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, storeReader, serviceConfigurator, authTokenProvider); - - double expectedRequestCharge = requestChargePerRead.multiply(BigDecimal.valueOf(1)) - .add(requestChargePerHead.multiply(BigDecimal.valueOf(0))) - .setScale(4, RoundingMode.FLOOR).doubleValue(); - - Single storeResponseSingle = quorumReader.readStrongAsync(request, replicaCountToRead, readMode); - - StoreResponseValidator validator = StoreResponseValidator.create() - .withBELSN(primaryLSN) - .withBELocalLSN(primaryLocalLSN) - .withRequestCharge(expectedRequestCharge) - .build(); - - validateSuccess(storeResponseSingle, validator); - - transportClientWrapper.validate() - .verifyNumberOfInvocations(1); - - addressSelectorWrapper.validate() - .verifyNumberOfForceCachRefresh(0) - .verifyVesolvePrimaryUriAsyncCount(1) - .verifyTotalInvocations(2); - - AddressSelectorWrapper.InOrderVerification.Verifier primaryNotIncludedVerifier = AddressSelectorWrapper - .InOrderVerification.Verifier.builder() - .resolveAllUriAsync_IncludePrimary(false) - .resolveAllUriAsync_ForceRefresh(false) - .build(); - - AddressSelectorWrapper.InOrderVerification.Verifier resolvePrimaryVerifier = AddressSelectorWrapper - .InOrderVerification.Verifier.builder() - .resolvePrimaryUriAsync() - .build(); - - AddressSelectorWrapper.InOrderVerification ov = addressSelectorWrapper.getInOrderVerification(); - ov.verifyNext(primaryNotIncludedVerifier); - ov.verifyNext(resolvePrimaryVerifier); - - DocumentServiceRequestValidator requestValidator = DocumentServiceRequestValidator.builder() - .add(DocumentServiceRequestContextValidator.builder() - .qurorumSelectedLSN(0l) - .globalCommittedSelectedLSN(0l) - .storeResponses(null) - .build()) - .build(); - requestValidator.validate(request); - } - - @DataProvider(name = "readPrimaryArgProvider") - public Object[][] readPrimaryArgProvider() { - return new Object[][]{ - // endpoint, verifier for endpoint expected result, verifying the StoreResponse returned - { - EndpointMock.noSecondaryReplicaBuilder() - .response(StoreResponseBuilder.create() - .withLSN(52) - .withLocalLSN(19) - .withHeader(WFConstants.BackendHeaders.CURRENT_REPLICA_SET_SIZE, "1") - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LSN, "19") - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LOCAL_LSN, "19") - .withRequestCharge(0) - .build()) - .build(), - - EndpointMock.EndpointMockVerificationBuilder.builder() - .withAddressSelectorValidation(AddressSelectorWrapper - .InOrderVerificationBuilder - .create() - .verifyNumberOfInvocations(2) - .verifyNext(AddressSelectorWrapper.InOrderVerification.Verifier.builder() - .resolveAllUriAsync_IncludePrimary(false) - .resolveAllUriAsync_ForceRefresh(false) - .build()) - .verifyNext(AddressSelectorWrapper.InOrderVerification.Verifier.builder() - .resolvePrimaryUriAsync() - .build())) - .withTransportClientValidation(TransportClientWrapper.TransportClientWrapperVerificationBuilder.create().verifyNumberOfInvocations(1)), - - StoreResponseValidator.create() - .withBELSN(52) - .build() - } - }; - } - - @Test(groups = "unit", dataProvider = "readPrimaryArgProvider") - public void readPrimary(EndpointMock endpointMock, - EndpointMock.EndpointMockVerificationBuilder verification, - StoreResponseValidator storeResponseValidator) { - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - - GatewayServiceConfigurationReader serviceConfigurator = Mockito.mock(GatewayServiceConfigurationReader.class); - IAuthorizationTokenProvider authTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - - QuorumReader quorumReader = new QuorumReader(configs, endpointMock.transportClientWrapper.transportClient, - endpointMock.addressSelectorWrapper.addressSelector, - new StoreReader(endpointMock.transportClientWrapper.transportClient, - endpointMock.addressSelectorWrapper.addressSelector, - sessionContainer), - serviceConfigurator, - authTokenProvider); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - - request.requestContext = new DocumentServiceRequestContext(); - request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - request.requestContext.resolvedPartitionKeyRange = Mockito.mock(PartitionKeyRange.class); - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - - int replicaCountToRead = 1; - ReadMode readMode = ReadMode.Strong; - Single storeResponseSingle = quorumReader.readStrongAsync(request, replicaCountToRead, readMode); - - validateSuccess(storeResponseSingle, storeResponseValidator); - endpointMock.validate(verification); - } - - public static void validateSuccess(Single> single, - MultiStoreResultValidator validator) { - validateSuccess(single, validator, 10000); - } - - public static void validateSuccess(Single> single, - MultiStoreResultValidator validator, - long timeout) { - TestSubscriber> testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - public static void validateSuccess(Single single, - StoreResponseValidator validator) { - validateSuccess(single, validator, 10000); - } - - public static void validateSuccess(Single single, - StoreResponseValidator validator, - long timeout) { - TestSubscriber testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReplicaAddressFactory.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReplicaAddressFactory.java deleted file mode 100644 index 472f9e19eb7d..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReplicaAddressFactory.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import org.apache.commons.lang3.RandomStringUtils; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -public class ReplicaAddressFactory { - private static String TEMPLATE = "https://by4prdddc03-docdb-1.documents.azure.com:9056" + - "/apps/%s/services/e7c8d429-c379-40c9-9486-65b89b70be2f" + - "/partitions/%s/replicas/%s/"; - - public static String createPartitionPhysicalURI(String partitionId, boolean isPrimary) { - return String.format(TEMPLATE, UUID.randomUUID(), partitionId, RandomStringUtils.randomNumeric(18) + (isPrimary ? "p" : "s")); - } - - public static String createPrimaryPhysicalURI(String partitionId) { - return createPartitionPhysicalURI(partitionId, true); - } - - public static String createSecondaryPhysicalURI(String partitionId) { - return createPartitionPhysicalURI(partitionId, false); - } - - public static AddressInformation createAddressInformation(String partitionId, boolean isPrimary, Protocol protocol) { - String loc = createPartitionPhysicalURI(partitionId, isPrimary); - return new AddressInformation(true, isPrimary, loc, protocol); - } - - public static List createPartitionAddressInformation(String partitionId, - boolean includePrimary, - int numberOfAllReplicas, - Protocol protocol) { - List addressInformationList = new ArrayList<>(); - for (boolean isPrimary = includePrimary; numberOfAllReplicas > 0; numberOfAllReplicas--) { - addressInformationList.add(createAddressInformation(partitionId, isPrimary, protocol)); - isPrimary = false; - } - - return addressInformationList; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReplicatedResourceClientPartitionSplitTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReplicatedResourceClientPartitionSplitTest.java deleted file mode 100644 index dfc26fef75a4..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReplicatedResourceClientPartitionSplitTest.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.SessionContainer; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.DocumentServiceRequestContext; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionKeyRangeIsSplittingException; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.assertj.core.api.Assertions; -import org.mockito.Mockito; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import rx.Single; -import rx.functions.Func1; -import rx.observers.TestSubscriber; - -import java.net.URI; -import java.util.List; -import java.util.concurrent.TimeUnit; - -public class ReplicatedResourceClientPartitionSplitTest { - protected static final int TIMEOUT = 120000; - - @DataProvider(name = "partitionIsSplittingArgProvider") - public Object[][] partitionIsSplittingArgProvider() { - return new Object[][]{ - // Consistency mode, number of partition splitting exception till split migration completes - { ConsistencyLevel.Eventual, 1}, - { ConsistencyLevel.Eventual, 2}, - { ConsistencyLevel.Eventual, Integer.MAX_VALUE }, // server side partition split operation never completes - }; - } - - @Test(groups = { "unit" }, dataProvider = "partitionIsSplittingArgProvider", timeOut = TIMEOUT) - public void partitionSplit_RefreshCache_Read(ConsistencyLevel consistencyLevel, int partitionIsSplitting) { - URI secondary1AddressBeforeMove = URI.create("secondary"); - URI secondary1AddressAfterMove = URI.create("secondaryNew"); - - URI primaryAddressBeforeMove = URI.create("primary"); - URI primaryAddressAfterMove = URI.create("primaryNew"); - - String partitionKeyRangeIdBeforeSplit = "1"; - String partitionKeyRangeIdAfterSplit = "2"; - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.ReplicaMoveBuilder.create(Protocol.Https) - .withPrimaryMove(primaryAddressBeforeMove, primaryAddressAfterMove) - .withSecondaryMove(secondary1AddressBeforeMove, secondary1AddressAfterMove) - .newPartitionKeyRangeIdOnRefresh(r -> partitionKeyRangeWithId(partitionKeyRangeIdAfterSplit)) - .build(); - - long lsn = 54; - long localLsn = 18; - - StoreResponse primaryResponse = StoreResponseBuilder.create() - .withLSN(lsn) - .withLocalLSN(localLsn) - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LOCAL_LSN, Long.toString(localLsn)) - .withHeader(WFConstants.BackendHeaders.CURRENT_REPLICA_SET_SIZE, partitionKeyRangeIdAfterSplit) - .withRequestCharge(1.1) - .build(); - StoreResponse secondaryResponse1 = StoreResponseBuilder.create() - .withLSN(lsn) - .withLocalLSN(localLsn) - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LOCAL_LSN, Long.toString(localLsn)) - .withHeader(WFConstants.BackendHeaders.CURRENT_REPLICA_SET_SIZE, partitionKeyRangeIdAfterSplit) - .withRequestCharge(1.1) - .build(); - - TransportClientWrapper.Builder.UriToResultBuilder transportClientWrapperBuilder = TransportClientWrapper.Builder.uriToResultBuilder(); - - PartitionKeyRangeIsSplittingException splittingException = new PartitionKeyRangeIsSplittingException(); - if (partitionIsSplitting == Integer.MAX_VALUE) { - transportClientWrapperBuilder - .exceptionOn(primaryAddressBeforeMove, OperationType.Read, ResourceType.Document, splittingException, true) - .exceptionOn(secondary1AddressBeforeMove, OperationType.Read, ResourceType.Document, splittingException, true); - } else { - for (int i = 0; i < partitionIsSplitting; i++) { - transportClientWrapperBuilder - .exceptionOn(primaryAddressBeforeMove, OperationType.Read, ResourceType.Document, splittingException, false) - .exceptionOn(secondary1AddressBeforeMove, OperationType.Read, ResourceType.Document, splittingException, false); - } - } - - GoneException goneException = new GoneException(); - transportClientWrapperBuilder - .exceptionOn(primaryAddressBeforeMove, OperationType.Read, ResourceType.Document, goneException, true) - .exceptionOn(secondary1AddressBeforeMove, OperationType.Read, ResourceType.Document, goneException, true) - .storeResponseOn(primaryAddressAfterMove, OperationType.Read, ResourceType.Document, secondaryResponse1, true) - .storeResponseOn(secondary1AddressAfterMove, OperationType.Read, ResourceType.Document, primaryResponse, true); - - - TransportClientWrapper transportClientWrapper = transportClientWrapperBuilder.build(); - - GatewayServiceConfiguratorReaderMock gatewayServiceConfigurationReaderWrapper = GatewayServiceConfiguratorReaderMock.from(ConsistencyLevel.Strong, - 4, - 3, - 4, - 3); - - SessionContainer sessionContainer = new SessionContainer("test"); - - IAuthorizationTokenProvider authorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - ReplicatedResourceClient resourceClient = new ReplicatedResourceClient(new Configs(), - addressSelectorWrapper.addressSelector, - sessionContainer, - transportClientWrapper.transportClient, - gatewayServiceConfigurationReaderWrapper.gatewayServiceConfigurationReader, - authorizationTokenProvider, - false, - false); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - request.requestContext = new DocumentServiceRequestContext(); - request.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId(partitionKeyRangeIdBeforeSplit); - request.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, consistencyLevel.name()); - - Func1> prepareRequestAsyncDelegate = null; - Single storeResponseObs = resourceClient.invokeAsync(request, prepareRequestAsyncDelegate); - - if (partitionIsSplitting < Integer.MAX_VALUE) { - - StoreResponseValidator validator = StoreResponseValidator.create() - .withBELSN(lsn) - .withRequestCharge(1.1) - .build(); - validateSuccess(storeResponseObs, validator); - - addressSelectorWrapper.verifyNumberOfForceCacheRefreshGreaterThanOrEqualTo(1); - } else { - FailureValidator validator = FailureValidator.builder().instanceOf(DocumentClientException.class) - .statusCode(503).build(); - validateFailure(storeResponseObs, validator, TIMEOUT); - } - } - - public static void validateSuccess(Single> single, - MultiStoreResultValidator validator) { - validateSuccess(single, validator, TIMEOUT); - } - - public static void validateSuccess(Single> single, - MultiStoreResultValidator validator, long timeout) { - TestSubscriber> testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - public static void validateSuccess(Single single, - StoreResponseValidator validator) { - validateSuccess(single, validator, TIMEOUT); - } - - public static void validateSuccess(Single single, - StoreResponseValidator validator, long timeout) { - TestSubscriber testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - - public static void validateFailure(Single single, FailureValidator validator, long timeout) { - - TestSubscriber testSubscriber = new TestSubscriber<>(); - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - Assertions.assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - validator.validate(testSubscriber.getOnErrorEvents().get(0)); - } - - private PartitionKeyRange partitionKeyRangeWithId(String id) { - PartitionKeyRange partitionKeyRange = Mockito.mock(PartitionKeyRange.class); - Mockito.doReturn(id).when(partitionKeyRange).getId(); - return partitionKeyRange; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReplicatedResourceClientTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReplicatedResourceClientTest.java deleted file mode 100644 index 55c8c4c6da04..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/ReplicatedResourceClientTest.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.assertj.core.api.Assertions; -import org.mockito.Matchers; -import org.mockito.Mockito; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import rx.Single; -import rx.observers.TestSubscriber; - -import java.util.concurrent.TimeUnit; - -public class ReplicatedResourceClientTest { - protected static final int TIMEOUT = 60000; - private IAddressResolver addressResolver; - private TransportClient transportClient; - private boolean enableReadRequestsFallback; - public boolean forceAddressRefresh; - private GatewayServiceConfigurationReader serviceConfigReader; - private IAuthorizationTokenProvider authorizationTokenProvider; - - @BeforeClass(groups = "unit") - public void setup() throws Exception { - addressResolver = Mockito.mock(IAddressResolver.class); - transportClient = Mockito.mock(TransportClient.class); - serviceConfigReader = Mockito.mock(GatewayServiceConfigurationReader.class); - authorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - } - - /** - * This test will verify that Gone exception will be retired - * fixed number of time before throwing error. - */ - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void invokeAsyncWithGoneException() { - Configs configs = new Configs(); - ReplicatedResourceClient resourceClient = new ReplicatedResourceClient(configs, new AddressSelector(addressResolver, Protocol.Https), null, - transportClient, serviceConfigReader, authorizationTokenProvider, enableReadRequestsFallback, false); - FailureValidator validator = FailureValidator.builder().instanceOf(DocumentClientException.class).build(); - RxDocumentServiceRequest request = Mockito.spy(RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Document)); - - Mockito.when(addressResolver.resolveAsync(Matchers.any(), Matchers.anyBoolean())) - .thenReturn(Single.error(new GoneException())); - Single response = resourceClient.invokeAsync(request, null); - - validateFailure(response, validator, TIMEOUT); - //method will fail 7 time (first try ,last try , and 5 retries within 30 sec(1,2,4,8,15 wait)) - Mockito.verify(addressResolver, Mockito.times(7)).resolveAsync(Matchers.any(), Matchers.anyBoolean()); - } - - public static void validateFailure(Single single, FailureValidator validator, long timeout) { - - TestSubscriber testSubscriber = new TestSubscriber<>(); - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - Assertions.assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - validator.validate(testSubscriber.getOnErrorEvents().get(0)); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RntbdTransportClientTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RntbdTransportClientTest.java deleted file mode 100644 index 0bdb62448466..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/RntbdTransportClientTest.java +++ /dev/null @@ -1,914 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.base.Strings; -import com.google.common.collect.ImmutableMap; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.internal.BaseAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.internal.InternalServerErrorException; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.Paths; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdContext; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdContextNegotiator; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdContextRequest; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdEndpoint; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdRequestArgs; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdRequestEncoder; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdRequestManager; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdRequestRecord; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdRequestTimer; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdResponse; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdResponseDecoder; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdUUID; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import com.microsoft.azure.cosmosdb.rx.internal.InvalidPartitionException; -import com.microsoft.azure.cosmosdb.rx.internal.NotFoundException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionIsMigratingException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionKeyRangeIsSplittingException; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.channel.ChannelHandler; -import io.netty.channel.embedded.EmbeddedChannel; -import io.netty.handler.codec.http.HttpResponseStatus; -import io.netty.handler.logging.LogLevel; -import io.netty.handler.ssl.SslContext; -import io.netty.handler.ssl.SslContextBuilder; -import org.apache.commons.lang3.StringUtils; -import org.assertj.core.api.Assertions; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import rx.Single; -import rx.Subscriber; -import rx.observers.TestSubscriber; - -import java.net.ConnectException; -import java.net.URI; -import java.time.Duration; -import java.util.Arrays; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.TimeUnit; -import java.util.stream.Stream; - -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.HttpHeaders; -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.HttpMethods; -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.SubStatusCodes; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; - -public final class RntbdTransportClientTest { - - private static final Logger logger = LoggerFactory.getLogger(RntbdTransportClientTest.class); - private static final int lsn = 5; - private static final ByteBuf noContent = Unpooled.wrappedBuffer(new byte[0]); - private static final String partitionKeyRangeId = "3"; - private static final URI physicalAddress = URI.create("rntbd://host:10251/replica-path/"); - private static final Duration requestTimeout = Duration.ofSeconds(1000); - - @DataProvider(name = "fromMockedNetworkFailureToExpectedDocumentClientException") - public Object[][] fromMockedNetworkFailureToExpectedDocumentClientException() { - - return new Object[][] { - }; - } - - @DataProvider(name = "fromMockedRntbdResponseToExpectedDocumentClientException") - public Object[][] fromMockedRntbdResponseToExpectedDocumentClientException() { - - return new Object[][] { - { - // 1 BadRequestException - - FailureValidator.builder() - .instanceOf(BadRequestException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 400, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 2 UnauthorizedException - - FailureValidator.builder() - .instanceOf(UnauthorizedException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 401, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 3 ForbiddenException - - FailureValidator.builder() - .instanceOf(ForbiddenException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 403, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 4 NotFoundException - - FailureValidator.builder() - .instanceOf(NotFoundException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 404, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 5 MethodNotAllowedException - - FailureValidator.builder() - .instanceOf(MethodNotAllowedException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 405, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 6 RequestTimeoutException - - FailureValidator.builder() - .instanceOf(RequestTimeoutException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 408, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 7 ConflictException - - FailureValidator.builder() - .instanceOf(ConflictException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 409, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 8 InvalidPartitionException - - FailureValidator.builder() - .instanceOf(InvalidPartitionException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 410, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId, - HttpHeaders.SUB_STATUS, Integer.toString(SubStatusCodes.NAME_CACHE_IS_STALE) - ), - noContent) - }, - { - // 9 PartitionKeyRangeGoneException - - FailureValidator.builder() - .instanceOf(PartitionKeyRangeGoneException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 410, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId, - HttpHeaders.SUB_STATUS, Integer.toString(SubStatusCodes.PARTITION_KEY_RANGE_GONE) - ), - noContent) - }, - { - // 10 PartitionKeyRangeIsSplittingException - - FailureValidator.builder() - .instanceOf(PartitionKeyRangeIsSplittingException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 410, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId, - HttpHeaders.SUB_STATUS, Integer.toString(SubStatusCodes.COMPLETING_SPLIT) - ), - noContent) - }, - { - // 11 PartitionIsMigratingException - - FailureValidator.builder() - .instanceOf(PartitionIsMigratingException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 410, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId, - HttpHeaders.SUB_STATUS, Integer.toString(SubStatusCodes.COMPLETING_PARTITION_MIGRATION) - ), - noContent) - }, - { - // 12 GoneException - - FailureValidator.builder() - .instanceOf(GoneException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 410, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId, - HttpHeaders.SUB_STATUS, String.valueOf(SubStatusCodes.UNKNOWN)), - noContent) - }, - { - // 13 PreconditionFailedException - - FailureValidator.builder() - .instanceOf(PreconditionFailedException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 412, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 14 RequestEntityTooLargeException - - FailureValidator.builder() - .instanceOf(RequestEntityTooLargeException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 413, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 15 LockedException - - FailureValidator.builder() - .instanceOf(LockedException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 423, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 16 RequestRateTooLargeException - - FailureValidator.builder() - .instanceOf(RequestRateTooLargeException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 429, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 17 RetryWithException - - FailureValidator.builder() - .instanceOf(RetryWithException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 449, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 18 InternalServerErrorException - - FailureValidator.builder() - .instanceOf(InternalServerErrorException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 500, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - { - // 19 ServiceUnavailableException - - FailureValidator.builder() - .instanceOf(ServiceUnavailableException.class) - .lsn(lsn) - .partitionKeyRangeId(partitionKeyRangeId) - .resourceAddress(null), - RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - "/dbs/db/colls/col", - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - )), - new RntbdResponse( - RntbdUUID.EMPTY, - 503, - ImmutableMap.of( - HttpHeaders.LSN, Integer.toString(lsn), - HttpHeaders.PARTITION_KEY_RANGE_ID, partitionKeyRangeId - ), - noContent) - }, - }; - } - - /** - * Verifies that a request for a non-existent resource produces a {@link }GoneException} - */ - @Test(enabled = false, groups = "direct") - public void verifyGoneResponseMapsToGoneException() throws Exception { - - final RntbdTransportClient.Options options = new RntbdTransportClient.Options.Builder(requestTimeout).build(); - final SslContext sslContext = SslContextBuilder.forClient().build(); - - try (final RntbdTransportClient transportClient = new RntbdTransportClient(options, sslContext)) { - - final BaseAuthorizationTokenProvider authorizationTokenProvider = new BaseAuthorizationTokenProvider( - RntbdTestConfiguration.AccountKey - ); - - final URI physicalAddress = new URI("rntbd://" - + RntbdTestConfiguration.RntbdAuthority - + "/apps/DocDbApp/services/DocDbMaster0/partitions/780e44f4-38c8-11e6-8106-8cdcd42c33be/replicas/1p/" - ); - - final ImmutableMap.Builder builder = ImmutableMap.builder(); - - builder.put(HttpHeaders.X_DATE, Utils.nowAsRFC1123()); - - final String token = authorizationTokenProvider.generateKeyAuthorizationSignature(HttpMethods.GET, - Paths.DATABASE_ACCOUNT_PATH_SEGMENT, - ResourceType.DatabaseAccount, - builder.build() - ); - - builder.put(HttpHeaders.AUTHORIZATION, token); - - final RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.DatabaseAccount, - Paths.DATABASE_ACCOUNT_PATH_SEGMENT, - builder.build() - ); - - final Single responseSingle = transportClient.invokeStoreAsync(physicalAddress, null, request); - - responseSingle.toObservable().toBlocking().subscribe(new Subscriber() { - @Override - public void onCompleted() { - } - - @Override - public void onError(final Throwable error) { - final String format = "Expected %s, not %s"; - assertTrue(error instanceof GoneException, String.format(format, GoneException.class, error.getClass())); - final Throwable cause = error.getCause(); - if (cause != null) { - // assumption: cosmos isn't listening on 10251 - assertTrue(cause instanceof ConnectException, String.format(format, ConnectException.class, error.getClass())); - } - } - - @Override - public void onNext(final StoreResponse response) { - fail(String.format("Expected GoneException, not a StoreResponse: %s", response)); - } - }); - - } catch (final Exception error) { - final String message = String.format("%s: %s", error.getClass(), error.getMessage()); - fail(message, error); - } - } - - /** - * Validates the error handling behavior of {@link RntbdTransportClient} for network failures - *

- * These are the exceptions that cannot be derived from server responses. They are mapped from Netty channel - * failures simulated by {@link FakeChannel}. - * - * @param builder A feature validator builder to confirm that response is correctly mapped to an exception - * @param request An RNTBD request instance - * @param exception An exception mapping - */ - @Test(enabled = false, groups = "unit", dataProvider = "fromMockedNetworkFailureToExpectedDocumentClientException") - public void verifyNetworkFailure( - final FailureValidator.Builder builder, - final RxDocumentServiceRequest request, - final DocumentClientException exception - ) { - // TODO: DANOBLE: Implement RntbdTransportClientTest.verifyNetworkFailure - // Links: - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/378750 - throw new UnsupportedOperationException("TODO: DANOBLE: Implement this test"); - } - - /** - * Validates the error handling behavior of the {@link RntbdTransportClient} for HTTP status codes >= 400 - * - * @param builder A feature validator builder to confirm that response is correctly mapped to an exception - * @param request An RNTBD request instance - * @param response The RNTBD response instance to be returned as a result of the request - */ - @Test(enabled = true, groups = "unit", dataProvider = "fromMockedRntbdResponseToExpectedDocumentClientException") - public void verifyRequestFailures( - final FailureValidator.Builder builder, - final RxDocumentServiceRequest request, - final RntbdResponse response - ) { - final UserAgentContainer userAgent = new UserAgentContainer(); - final Duration timeout = Duration.ofMillis(100); - - try (final RntbdTransportClient client = getRntbdTransportClientUnderTest(userAgent, timeout, response)) { - - final Single responseSingle; - - try { - responseSingle = client.invokeStoreAsync( - physicalAddress, new ResourceOperation(request.getOperationType(), request.getResourceType()), request - ); - } catch (final Exception error) { - throw new AssertionError(String.format("%s: %s", error.getClass(), error.getMessage())); - } - - this.validateFailure(responseSingle, builder.build()); - } - } - - private static RntbdTransportClient getRntbdTransportClientUnderTest( - final UserAgentContainer userAgent, - final Duration requestTimeout, - final RntbdResponse expected - ) { - - final RntbdTransportClient.Options options = new RntbdTransportClient.Options.Builder(requestTimeout) - .userAgent(userAgent) - .build(); - - final SslContext sslContext; - - try { - sslContext = SslContextBuilder.forClient().build(); - } catch (final Exception error) { - throw new AssertionError(String.format("%s: %s", error.getClass(), error.getMessage())); - } - - return new RntbdTransportClient(new FakeEndpoint.Provider(options, sslContext, expected)); - } - - private void validateFailure(final Single single, final FailureValidator validator) { - validateFailure(single, validator, requestTimeout.toMillis()); - } - - private static void validateFailure( - final Single single, final FailureValidator validator, final long timeout - ) { - - final TestSubscriber testSubscriber = new TestSubscriber<>(); - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - Assertions.assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - validator.validate(testSubscriber.getOnErrorEvents().get(0)); - } - - // region Types - - private static final class FakeChannel extends EmbeddedChannel { - - private static final ServerProperties serverProperties = new ServerProperties("agent", "3.0.0"); - private final BlockingQueue responses; - - FakeChannel(final BlockingQueue responses, final ChannelHandler... handlers) { - super(handlers); - this.responses = responses; - } - - @Override - protected void handleInboundMessage(final Object message) { - super.handleInboundMessage(message); - assertTrue(message instanceof ByteBuf); - } - - @Override - protected void handleOutboundMessage(final Object message) { - - assertTrue(message instanceof ByteBuf); - - final ByteBuf out = Unpooled.buffer(); - final ByteBuf in = (ByteBuf) message; - - // This is the end of the outbound pipeline and so we can do what we wish with the outbound message - - if (in.getUnsignedIntLE(4) == 0) { - - final RntbdContextRequest request = RntbdContextRequest.decode(in.copy()); - final RntbdContext rntbdContext = RntbdContext.from(request, serverProperties, HttpResponseStatus.OK); - - rntbdContext.encode(out); - - } else { - - final RntbdResponse rntbdResponse; - - try { - rntbdResponse = this.responses.take(); - } catch (final Exception error) { - throw new AssertionError(String.format("%s: %s", error.getClass(), error.getMessage())); - } - - rntbdResponse.encode(out); - out.setBytes(8, in.slice(8, 16)); // Overwrite activityId - } - - this.writeInbound(out); - } - } - - private static final class FakeEndpoint implements RntbdEndpoint { - - final RntbdRequestTimer requestTimer; - final FakeChannel fakeChannel; - final URI physicalAddress; - - private FakeEndpoint( - final Config config, final RntbdRequestTimer timer, final URI physicalAddress, - final RntbdResponse... expected - ) { - - final ArrayBlockingQueue responses = new ArrayBlockingQueue<>( - expected.length, true, Arrays.asList(expected) - ); - - RntbdRequestManager requestManager = new RntbdRequestManager(); - this.physicalAddress = physicalAddress; - this.requestTimer = timer; - - this.fakeChannel = new FakeChannel(responses, - new RntbdContextNegotiator(requestManager, config.getUserAgent()), - new RntbdRequestEncoder(), - new RntbdResponseDecoder(), - requestManager - ); - } - - @Override - public String getName() { - return "FakeEndpoint"; - } - - @Override - public void close() { - this.fakeChannel.close().syncUninterruptibly(); - } - - @Override - public RntbdRequestRecord request(final RntbdRequestArgs requestArgs) { - final RntbdRequestRecord requestRecord = new RntbdRequestRecord(requestArgs, this.requestTimer); - this.fakeChannel.writeOutbound(requestRecord); - return requestRecord; - } - - static class Provider implements RntbdEndpoint.Provider { - - final Config config; - final RntbdResponse expected; - final RntbdRequestTimer timer; - - Provider(RntbdTransportClient.Options options, SslContext sslContext, RntbdResponse expected) { - this.config = new Config(options, sslContext, LogLevel.WARN); - this.timer = new RntbdRequestTimer(config.getRequestTimeout()); - this.expected = expected; - } - - @Override - public void close() throws RuntimeException { - this.timer.close(); - } - - @Override - public Config config() { - return this.config; - } - - @Override - public int count() { - return 1; - } - - @Override - public RntbdEndpoint get(URI physicalAddress) { - return new FakeEndpoint(config, timer, physicalAddress, expected); - } - - @Override - public Stream list() { - return Stream.empty(); - } - } - } - - private static final class RntbdTestConfiguration { - - static String AccountHost = System.getProperty("ACCOUNT_HOST", - StringUtils.defaultString( - Strings.emptyToNull(System.getenv().get("ACCOUNT_HOST")), - "https://localhost:8081/" - ) - ); - - static String AccountKey = System.getProperty("ACCOUNT_KEY", - StringUtils.defaultString( - Strings.emptyToNull(System.getenv().get("ACCOUNT_KEY")), - "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==" - ) - ); - - static String RntbdAuthority = System.getProperty("rntbd.authority", - StringUtils.defaultString( - Strings.emptyToNull(System.getenv().get("RNTBD_AUTHORITY")), - String.format("%s:10251", URI.create(AccountHost).getHost()) - ) - ); - - private RntbdTestConfiguration() { - } - } - - // endregion -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreReaderDotNetTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreReaderDotNetTest.java deleted file mode 100644 index 9b0d4bfa0b98..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreReaderDotNetTest.java +++ /dev/null @@ -1,903 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.ReplicationPolicy; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.SessionContainer; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.internal.AuthorizationTokenType; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.DocumentServiceRequestContext; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.InvalidPartitionException; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import org.apache.commons.lang3.StringUtils; -import org.mockito.Matchers; -import org.mockito.Mockito; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.annotations.Test; -import rx.Single; -import rx.observers.TestSubscriber; - -import java.net.URI; -import java.net.URISyntaxException; -import java.time.Duration; -import java.util.ArrayDeque; -import java.util.List; -import java.util.NoSuchElementException; -import java.util.Queue; -import java.util.concurrent.TimeUnit; - -import static org.assertj.core.api.Assertions.assertThat; - -public class StoreReaderDotNetTest { - private static final Logger logger = LoggerFactory.getLogger(StoreReaderDotNetTest.class); - @Test(groups = "unit") - public void addressCache() { - // create a real document service request - RxDocumentServiceRequest entity = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document); - - // setup mocks for address information - AddressInformation[] addressInformation = new AddressInformation[3]; - for (int i = 0; i < 3; i++) { - addressInformation[i] = new AddressInformation(true, true, "http://replica-" + i, Protocol.Https); - } - - IAddressResolver mockAddressCache = Mockito.mock(IAddressResolver.class); - - Mockito.doReturn(Single.just(addressInformation)) - .when(mockAddressCache) - .resolveAsync(Mockito.any(RxDocumentServiceRequest.class), Mockito.eq(false)); - - // validate that the mock works - AddressInformation[] addressInfo = mockAddressCache.resolveAsync(entity, false).toBlocking().value(); - assertThat(addressInfo[0]).isEqualTo(addressInformation[0]); - } - - /** - * Tests for TransportClient - */ - @Test(groups = "unit") - public void transportClient() { - // create a real document service request - RxDocumentServiceRequest entity = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document); - - // setup mocks for address information - AddressInformation[] addressInformation = new AddressInformation[3]; - - // construct URIs that look like the actual uri - // rntbd://yt1prdddc01-docdb-1.documents.azure.com:14003/apps/ce8ab332-f59e-4ce7-a68e-db7e7cfaa128/services/68cc0b50-04c6-4716-bc31-2dfefd29e3ee/partitions/5604283d-0907-4bf4-9357-4fa9e62de7b5/replicas/131170760736528207s/ - for (int i = 0; i < 3; i++) { - String physicalUri = - "rntbd://dummytenant.documents.azure.com:14003/apps/APPGUID/services/SERVICEGUID/partitions/PARTITIONGUID/replicas/" - + Integer.toString(i) + (i == 0 ? "p" : "s") + "/"; - addressInformation[i] = new AddressInformation(true, true, physicalUri, Protocol.Tcp); - - } - - // create objects for all the dependencies of the StoreReader - TransportClient mockTransportClient = Mockito.mock(TransportClient.class); - - // create mock store response object - StoreResponseBuilder srb = new StoreResponseBuilder(); - - - // set lsn and activityid on the store response. - srb.withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_1" ); - srb.withHeader(WFConstants.BackendHeaders.LSN, "50"); - - // setup mock transport client - Mockito.doReturn(Single.just(srb.build())) - .when(mockTransportClient) - .invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[0].getPhysicalUri())), - Mockito.any(RxDocumentServiceRequest.class)); - - - - // get response from mock object - StoreResponse response = mockTransportClient.invokeResourceOperationAsync(URI.create(addressInformation[0].getPhysicalUri()), entity).toBlocking().value(); - - // validate that the LSN matches - // validate that the ActivityId Matches - - StoreResponseValidator validator = StoreResponseValidator.create().withBELSN(50).withBEActivityId("ACTIVITYID1_1").build(); - validator.validate(response); - } - - private TransportClient getMockTransportClientDuringUpgrade(AddressInformation[] addressInformation) { - // create objects for all the dependencies of the StoreReader - TransportClient mockTransportClient = Mockito.mock(TransportClient.class); - - // create mock store response object - // set lsn and activityid on the store response. - StoreResponse mockStoreResponseFast = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "50") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_1") - .build(); - - StoreResponse mockStoreResponseSlow = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "30") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_1") - .build(); - - // setup mock transport client for the first replica - Mockito.doReturn(Single.just(mockStoreResponseFast)) - .when(mockTransportClient) - .invokeResourceOperationAsync(Mockito.eq(URI.create(addressInformation[0].getPhysicalUri())), Mockito.any(RxDocumentServiceRequest.class)); - - - // setup mock transport client with a sequence of outputs - Mockito.doReturn(Single.just(mockStoreResponseFast)) // initial read response - .doReturn(Single.just(mockStoreResponseFast)) // barrier retry, count 1 - .doReturn(Single.just(mockStoreResponseFast)) // barrier retry, count 2 - .doReturn(Single.error(new InvalidPartitionException())) // throw invalid partition exception to simulate collection recreate with same name - .doReturn(Single.just(mockStoreResponseFast)) // new read - .doReturn(Single.just(mockStoreResponseFast)) // subsequent barriers - .doReturn(Single.just(mockStoreResponseFast)) - .doReturn(Single.just(mockStoreResponseFast)) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[1].getPhysicalUri())), - Mockito.any(RxDocumentServiceRequest.class)); - - // After this, the product code should reset target identity, and lsn response - Queue queueOfResponses = new ArrayDeque<>(); - - // let the first 10 responses be slow, and then fast - for (int i = 0; i < 20; i++) { - queueOfResponses.add(i <= 2 ? mockStoreResponseSlow : mockStoreResponseFast); - } - - // setup mock transport client with a sequence of outputs, for the second replica - // This replica behaves in the following manner: - // calling InvokeResourceOperationAsync - // 1st time: returns valid LSN - // 2nd time: returns InvalidPartitionException - // initial read response - - Mockito.doAnswer((params) -> Single.just(queueOfResponses.poll())) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[2].getPhysicalUri())), - Mockito.any(RxDocumentServiceRequest.class)); - - return mockTransportClient; - } - - private enum ReadQuorumResultKind { - QuorumMet, - QuorumSelected, - QuorumNotSelected - } - - private TransportClient getMockTransportClientForGlobalStrongReads(AddressInformation[] addressInformation, ReadQuorumResultKind result) { - // create objects for all the dependencies of the StoreReader - TransportClient mockTransportClient = Mockito.mock(TransportClient.class); - - // create mock store response object - - StoreResponse mockStoreResponse1 = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "100") - .withHeader(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, "90") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_1") - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, "1") - .build(); - - StoreResponse mockStoreResponse2 = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "90") - .withHeader(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, "90") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_2") - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, "1") - .build(); - - - StoreResponse mockStoreResponse3 = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "92") - .withHeader(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, "90") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_3") - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, "1") - .build(); - - StoreResponse mockStoreResponse4 = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "100") - .withHeader(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, "92") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_3") - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, "1") - .build(); - - StoreResponse mockStoreResponse5 = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "100") - .withHeader(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, "100") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_3") - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, "1") - .withHeader(WFConstants.BackendHeaders.CURRENT_REPLICA_SET_SIZE, "1") - .withHeader(WFConstants.BackendHeaders.QUORUM_ACKED_LSN, "100") - .build(); - // set lsn and activityid on the store response. - - StoreResponse mockStoreResponseFast = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "50") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_1") - .build(); - - if(result == ReadQuorumResultKind.QuorumMet) { - // setup mock transport client for the first replica - Mockito.doReturn(Single.just(mockStoreResponse5)) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[0].getPhysicalUri())), Mockito.any(RxDocumentServiceRequest.class)); - - Mockito.doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse5)) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[1].getPhysicalUri())), - Mockito.any(RxDocumentServiceRequest.class)); - - Mockito.doReturn(Single.just(mockStoreResponse2)) - .doReturn(Single.just(mockStoreResponse2)) - .doReturn(Single.just(mockStoreResponse2)) - .doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse4)) - .doReturn(Single.just(mockStoreResponse5)) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[2].getPhysicalUri())), - Mockito.any(RxDocumentServiceRequest.class)); - } - - if (result == ReadQuorumResultKind.QuorumSelected) { - // setup mock transport client for the first replica - Mockito.doReturn(Single.just(mockStoreResponse2)) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[0].getPhysicalUri())), Mockito.any(RxDocumentServiceRequest.class)); - - // setup mock transport client with a sequence of outputs - Mockito.doReturn(Single.just(mockStoreResponse1)) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[1].getPhysicalUri())), Mockito.any(RxDocumentServiceRequest.class)); - - - // setup mock transport client with a sequence of outputs - Mockito.doReturn(Single.just(mockStoreResponse2)) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[2].getPhysicalUri())), Mockito.any(RxDocumentServiceRequest.class)); - } else if (result == ReadQuorumResultKind.QuorumNotSelected) { - // setup mock transport client for the first replica - - Mockito.doReturn(Single.just(mockStoreResponse5)) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[0].getPhysicalUri())), Mockito.any(RxDocumentServiceRequest.class)); - - Mockito.doReturn(Single.just(mockStoreResponse5)) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[1].getPhysicalUri())), Mockito.any(RxDocumentServiceRequest.class)); - - Mockito.doReturn(Single.error(new GoneException("test"))) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[2].getPhysicalUri())), Mockito.any(RxDocumentServiceRequest.class)); - } - - return mockTransportClient; - } - - private TransportClient getMockTransportClientForGlobalStrongWrites( - AddressInformation[] addressInformation, - int indexOfCaughtUpReplica, - boolean undershootGlobalCommittedLsnDuringBarrier, - boolean overshootLsnDuringBarrier, - boolean overshootGlobalCommittedLsnDuringBarrier) - { - TransportClient mockTransportClient = Mockito.mock(TransportClient.class); - - // create mock store response object - - // set lsn and activityid on the store response. - StoreResponse mockStoreResponse1 = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "100") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_1") - .withHeader(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, "90") - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, "1") - .build(); - - StoreResponse mockStoreResponse2 = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "100") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_2") - .withHeader(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, "100") - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, "1") - .build(); - - StoreResponse mockStoreResponse3 = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "103") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_3") - .withHeader(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, "100") - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, "1") - .build(); - - StoreResponse mockStoreResponse4 = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "103") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_3") - .withHeader(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, "103") - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, "1") - .build(); - - StoreResponse mockStoreResponse5 = StoreResponseBuilder.create() - .withHeader(WFConstants.BackendHeaders.LSN, "106") - .withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, "ACTIVITYID1_3") - .withHeader(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, "103") - .withHeader(WFConstants.BackendHeaders.NUMBER_OF_READ_REGIONS, "1") - .build(); - - StoreResponse finalResponse = null; - if (undershootGlobalCommittedLsnDuringBarrier) { - finalResponse = mockStoreResponse1; - } else { - if (overshootLsnDuringBarrier) { - if (overshootGlobalCommittedLsnDuringBarrier) { - finalResponse = mockStoreResponse5; - } else { - finalResponse = mockStoreResponse3; - } - } else { - if (overshootGlobalCommittedLsnDuringBarrier) { - finalResponse = mockStoreResponse4; - } else { - finalResponse = mockStoreResponse2; - } - } - } - - for (int i = 0; i < addressInformation.length; i++) { - if (i == indexOfCaughtUpReplica) { - Mockito.doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(finalResponse)) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[i].getPhysicalUri())), Mockito.any(RxDocumentServiceRequest.class)); - - } else { - Mockito.doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse1)) - .doReturn(Single.just(mockStoreResponse1)) - .when(mockTransportClient).invokeResourceOperationAsync( - Mockito.eq(URI.create(addressInformation[i].getPhysicalUri())), Mockito.any(RxDocumentServiceRequest.class)); - } - } - - return mockTransportClient; - } - - /** - * We are simulating upgrade scenario where one of the secondary replicas is down. - * And one of the other secondary replicas is an XP Primary (lagging behind). - * Dyanmic Quorum is in effect, so Write Quorum = 2 - * @return array of AddressInformation - */ - private AddressInformation[] getMockAddressInformationDuringUpgrade() { - // setup mocks for address information - AddressInformation[] addressInformation = new AddressInformation[3]; - - // construct URIs that look like the actual uri - // rntbd://yt1prdddc01-docdb-1.documents.azure.com:14003/apps/ce8ab332-f59e-4ce7-a68e-db7e7cfaa128/services/68cc0b50-04c6-4716-bc31-2dfefd29e3ee/partitions/5604283d-0907-4bf4-9357-4fa9e62de7b5/replicas/131170760736528207s/ - for (int i = 0; i <= 2; i++) { - String physicalUri = - "rntbd://dummytenant.documents.azure.com:14003/apps/APPGUID/services/SERVICEGUID/partitions/PARTITIONGUID/replicas/" - + Integer.toString(i) + (i == 0 ? "p" : "s") + "/"; - addressInformation[i] = new AddressInformation(true, i == 0 ? true : false, physicalUri, Protocol.Tcp); - } - - return addressInformation; - } - - /** - * Given an array of address information, gives mock address cache. - * @param addressInformation - * @return - */ - private IAddressResolver getMockAddressCache(AddressInformation[] addressInformation) - { - // Address Selector is an internal sealed class that can't be mocked, but its dependency - // AddressCache can be mocked. - IAddressResolver mockAddressCache = Mockito.mock(IAddressResolver.class); - - Mockito.doReturn(Single.just(addressInformation)).when(mockAddressCache) - .resolveAsync(Mockito.any(RxDocumentServiceRequest.class), Mockito.eq(false) /*forceRefresh*/); - - Mockito.doReturn(Single.just(new AddressInformation[0])).when(mockAddressCache) - .resolveAsync(Mockito.any(RxDocumentServiceRequest.class), Mockito.eq(true) /*forceRefresh*/); - - return mockAddressCache; - } - - /** - * Tests for {@link StoreReader} - */ - @Test(groups = "unit") - public void storeReaderBarrier() { - // create a real document service request - RxDocumentServiceRequest entity = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document); - - // set request charge tracker - this is referenced in store reader (ReadMultipleReplicaAsync) - DocumentServiceRequestContext requestContext = new DocumentServiceRequestContext(); - // requestContext.ClientRequestStatistics = new ClientSideRequestStatistics(); - requestContext.requestChargeTracker = new RequestChargeTracker(); - entity.requestContext = requestContext; - - // also setup timeout helper, used in store reader - // entity.requestContext.timeoutHelper = new TimeoutHelper(new TimeSpan(2, 2, 2)); - entity.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - - // when the store reader throws Invalid Partition exception, the higher layer should - // clear this target identity. - // entity.requestContext.TargetIdentity = new ServiceIdentity("dummyTargetIdentity1", new Uri("http://dummyTargetIdentity1"), false); - entity.requestContext.resolvedPartitionKeyRange = new PartitionKeyRange(); - - AddressInformation[] addressInformation = getMockAddressInformationDuringUpgrade(); - IAddressResolver mockAddressCache = getMockAddressCache(addressInformation); - - // validate that the mock works - AddressInformation[] addressInfo = mockAddressCache.resolveAsync(entity, false).toBlocking().value(); - - assertThat(addressInfo[0]).isEqualTo(addressInformation[0]); - - AddressSelector addressSelector = new AddressSelector(mockAddressCache, Protocol.Tcp); - URI primaryAddress = addressSelector.resolvePrimaryUriAsync(entity, false /*forceAddressRefresh*/).toBlocking().value(); - - // check if the address return from Address Selector matches the original address info - assertThat(primaryAddress.toString()).isEqualTo(addressInformation[0].getPhysicalUri()); - - // get mock transport client that returns a sequence of responses to simulate upgrade - TransportClient mockTransportClient = getMockTransportClientDuringUpgrade(addressInformation); - - // get response from mock object - StoreResponse response = mockTransportClient.invokeResourceOperationAsync(URI.create(addressInformation[0].getPhysicalUri()), entity).toBlocking().value(); - - // validate that the LSN matches - assertThat(response.getLSN()).isEqualTo(50); - - String activityId = response.getHeaderValue(WFConstants.BackendHeaders.ACTIVITY_ID); - - // validate that the ActivityId Matches - assertThat(activityId).isEqualTo("ACTIVITYID1_1"); - - // create a real session container - we don't need session for this test anyway - ISessionContainer sessionContainer = new SessionContainer(Strings.Emtpy); - - // create store reader with mock transport client, real address selector (that has mock address cache), and real session container - StoreReader storeReader = - new StoreReader(mockTransportClient, - addressSelector, - sessionContainer); - - // reads always go to read quorum (2) replicas - int replicaCountToRead = 2; - - List result = storeReader.readMultipleReplicaAsync( - entity, - false /*includePrimary*/, - replicaCountToRead, - true /*requiresValidLSN*/, - false /*useSessionToken*/, - ReadMode.Strong).toBlocking().value(); - - // make sure we got 2 responses from the store reader - assertThat(result).hasSize(2); - } - - public static void validateSuccess(Single> single, - MultiStoreResultValidator validator) { - validateSuccess(single, validator, 10000); - } - - public static void validateSuccess(Single> single, - MultiStoreResultValidator validator, long timeout) { - TestSubscriber> testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - public static void validateSuccess(Single single, - StoreResultValidator validator) { - validateSuccess(single, validator, 10000); - } - - public static void validateSuccess(Single single, - StoreResultValidator validator, long timeout) { - TestSubscriber testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - public static void validateException(Single single, - FailureValidator validator) { - validateException(single, validator, 10000); - } - - public static void validateException(Single single, - FailureValidator validator, long timeout) { - TestSubscriber testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - validator.validate(testSubscriber.getOnErrorEvents().get(0)); - } - - /** - * StoreClient uses ReplicatedResourceClient uses ConsistencyReader uses QuorumReader uses StoreReader uses TransportClient uses RntbdConnection - */ - @Test(groups = "unit", enabled = false) - public void storeClient() throws URISyntaxException { - // create a real document service request (with auth token level = god) - RxDocumentServiceRequest entity = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document); - entity.authorizationTokenType = AuthorizationTokenType.PrimaryMasterKey; - - // set request charge tracker - this is referenced in store reader (ReadMultipleReplicaAsync) - DocumentServiceRequestContext requestContext = new DocumentServiceRequestContext(); - requestContext.requestChargeTracker = new RequestChargeTracker(); - entity.requestContext = requestContext; - - // set a dummy resource id on the request. - entity.setResourceId("1-MxAPlgMgA="); - - // set consistency level on the request to Bounded Staleness - entity.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.BoundedStaleness.toString()); - - // also setup timeout helper, used in store reader - entity.requestContext.timeoutHelper = new TimeoutHelper(Duration.ofSeconds(2 * 60 * 60 + 2 * 60 + 2)); - - // when the store reader throws Invalid Partition exception, the higher layer should - entity.requestContext.resolvedPartitionKeyRange = new PartitionKeyRange(); - - AddressInformation[] addressInformations = getMockAddressInformationDuringUpgrade(); - IAddressResolver mockAddressCache = getMockAddressCache(addressInformations); - - // validate that the mock works - AddressInformation[] addressInfo = mockAddressCache.resolveAsync(entity, false).toBlocking().value(); - assertThat(addressInfo[0]).isEqualTo(addressInformations[0]); - - AddressSelector addressSelector = new AddressSelector(mockAddressCache, Protocol.Tcp); - URI primaryAddress = addressSelector.resolvePrimaryUriAsync(entity, false).toBlocking().value(); - - // check if the address return from Address Selector matches the original address info - assertThat(primaryAddress.toString()).isEqualTo(addressInformations[0].getPhysicalUri()); - - // get mock transport client that returns a sequence of responses to simulate upgrade - TransportClient mockTransportClient = getMockTransportClientDuringUpgrade(addressInformations); - - // get response from mock object - StoreResponse response = mockTransportClient.invokeResourceOperationAsync(new URI(addressInformations[0].getPhysicalUri()), entity).toBlocking().value(); - - // validate that the LSN matches - assertThat(response.getLSN()).isEqualTo(50); - - String activityId = response.getHeaderValue(WFConstants.BackendHeaders.ACTIVITY_ID); - // validate that the ActivityId Matches - assertThat(activityId).isEqualTo("ACTIVITYID1_1"); - - // create a real session container - we don't need session for this test anyway - SessionContainer sessionContainer = new SessionContainer(StringUtils.EMPTY); - - // create store reader with mock transport client, real address selector (that has mock address cache), and real session container - StoreReader storeReader = new StoreReader(mockTransportClient, addressSelector, sessionContainer); - - IAuthorizationTokenProvider mockAuthorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - Mockito.when(mockAuthorizationTokenProvider.getUserAuthorizationToken(Matchers.anyString(), Matchers.any(), Matchers.anyString(), Matchers.anyMap(), - Matchers.any(), Matchers.anyMap())).thenReturn("dummyauthtoken"); - - // setup max replica set size on the config reader - ReplicationPolicy replicationPolicy = new ReplicationPolicy(); - GatewayServiceConfigurationReader mockServiceConfigReader = Mockito.mock(GatewayServiceConfigurationReader.class); - Mockito.when(mockServiceConfigReader.getUserReplicationPolicy()).thenReturn(replicationPolicy); - - try { - StoreClient storeClient = new StoreClient(new Configs(),mockAddressCache, sessionContainer, mockServiceConfigReader, mockAuthorizationTokenProvider, mockTransportClient, false); - - ServerStoreModel storeModel = new ServerStoreModel(storeClient); - Single result = storeModel.processMessage(entity).toSingle(); - result.toBlocking().value(); - - // if we have reached this point, there was a successful request. - // validate if the target identity has been cleared out. - // If the target identity is null and the request still succeeded, it means - // that the very first read succeeded without a barrier request. - assertThat(entity.requestContext.resolvedPartitionKeyRange).isNotNull(); - } catch (Exception e) { - assertThat(e instanceof ServiceUnavailableException - || e instanceof IllegalArgumentException - || e instanceof NullPointerException - || e instanceof NoSuchElementException).isTrue(); - } - } - - /** - * test consistency writer for global strong - */ - @Test(groups = "unit") - public void globalStrongConsistentWrite() { - // create a real document service request (with auth token level = god) - RxDocumentServiceRequest entity = RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Document); - entity.authorizationTokenType = AuthorizationTokenType.PrimaryMasterKey; - - // set request charge tracker - this is referenced in store reader (ReadMultipleReplicaAsync) - DocumentServiceRequestContext requestContext = new DocumentServiceRequestContext(); - requestContext.requestChargeTracker = new RequestChargeTracker(); - entity.requestContext = requestContext; - - // set a dummy resource id on the request. - entity.setResourceId("1-MxAPlgMgA="); - - // set consistency level on the request to Bounded Staleness - entity.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Strong.toString()); - - // also setup timeout helper, used in store reader - entity.requestContext.timeoutHelper = new TimeoutHelper(Duration.ofSeconds(2 * 60 * 60 + 2 * 60 + 2)); - - // when the store reader throws Invalid Partition exception, the higher layer should - // clear this target identity. - entity.requestContext.resolvedPartitionKeyRange = new PartitionKeyRange(); - - AddressInformation[] addressInformations = getMockAddressInformationDuringUpgrade(); - IAddressResolver mockAddressCache = getMockAddressCache(addressInformations); - - // validate that the mock works - AddressInformation[] addressInfo = mockAddressCache.resolveAsync(entity, false).toBlocking().value(); - assertThat(addressInformations[0]).isEqualTo(addressInfo[0]); - - AddressSelector addressSelector = new AddressSelector(mockAddressCache, Protocol.Tcp); - URI primaryAddress = addressSelector.resolvePrimaryUriAsync(entity, false).toBlocking().value(); - - // check if the address return from Address Selector matches the original address info - assertThat(primaryAddress.toString()).isEqualTo(addressInformations[0].getPhysicalUri()); - - // create a real session container - we don't need session for this test anyway - SessionContainer sessionContainer = new SessionContainer(StringUtils.EMPTY); - GatewayServiceConfigurationReader serviceConfigurationReader = Mockito.mock(GatewayServiceConfigurationReader.class); - - IAuthorizationTokenProvider mockAuthorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - Mockito.when(mockAuthorizationTokenProvider.getUserAuthorizationToken(Matchers.anyString(),Matchers.any(), Matchers.anyString(), Matchers.anyMap(), - Matchers.any(), Matchers.anyMap())).thenReturn("dummyauthtoken"); - - for (int i = 0; i < addressInformations.length; i++) { - TransportClient mockTransportClient = getMockTransportClientForGlobalStrongWrites(addressInformations, i, false, false, false); - StoreReader storeReader = new StoreReader(mockTransportClient, addressSelector, sessionContainer); - ConsistencyWriter consistencyWriter = new ConsistencyWriter(addressSelector, sessionContainer, mockTransportClient, mockAuthorizationTokenProvider, serviceConfigurationReader, false); - StoreResponse response = consistencyWriter.writeAsync(entity, new TimeoutHelper(Duration.ofSeconds(30)), false).toBlocking().value(); - assertThat(response.getLSN()).isEqualTo(100); - - //globalCommittedLsn never catches up in this case - mockTransportClient = getMockTransportClientForGlobalStrongWrites(addressInformations, i, true, false, false); - consistencyWriter = new ConsistencyWriter(addressSelector, sessionContainer, mockTransportClient, mockAuthorizationTokenProvider, serviceConfigurationReader, false); - try { - response = consistencyWriter.writeAsync(entity, new TimeoutHelper(Duration.ofSeconds(30)), false).toBlocking().value(); - // fail("it should throw exception"); - } catch (Exception e) { - } - - mockTransportClient = getMockTransportClientForGlobalStrongWrites(addressInformations, i, false, true, false); - storeReader = new StoreReader(mockTransportClient, addressSelector, sessionContainer); - consistencyWriter = new ConsistencyWriter(addressSelector, sessionContainer, mockTransportClient, mockAuthorizationTokenProvider, serviceConfigurationReader, false); - response = consistencyWriter.writeAsync(entity, new TimeoutHelper(Duration.ofSeconds(30)), false).toBlocking().value(); - assertThat(response.getLSN()).isEqualTo(100); - - mockTransportClient = getMockTransportClientForGlobalStrongWrites(addressInformations, i, false, true, true); - storeReader = new StoreReader(mockTransportClient, addressSelector, sessionContainer); - consistencyWriter = new ConsistencyWriter(addressSelector, sessionContainer, mockTransportClient, mockAuthorizationTokenProvider, serviceConfigurationReader, false); - response = consistencyWriter.writeAsync(entity, new TimeoutHelper(Duration.ofSeconds(30)), false).toBlocking().value(); - assertThat(response.getLSN()).isEqualTo(100); - - - mockTransportClient = getMockTransportClientForGlobalStrongWrites(addressInformations, i, false, false, true); - storeReader = new StoreReader(mockTransportClient, addressSelector, sessionContainer); - consistencyWriter = new ConsistencyWriter(addressSelector, sessionContainer, mockTransportClient, mockAuthorizationTokenProvider, serviceConfigurationReader, false); - response = consistencyWriter.writeAsync(entity, new TimeoutHelper(Duration.ofSeconds(30)), false).toBlocking().value(); - assertThat(response.getLSN()).isEqualTo(100); - - } - } - - /** - * Mocking Consistency - */ - @Test(groups = "unit", priority = 1) - public void globalStrongConsistency() { - // create a real document service request (with auth token level = god) - RxDocumentServiceRequest entity = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document); - entity.authorizationTokenType = AuthorizationTokenType.PrimaryMasterKey; - - // set request charge tracker - this is referenced in store reader (ReadMultipleReplicaAsync) - DocumentServiceRequestContext requestContext = new DocumentServiceRequestContext(); - requestContext.requestChargeTracker = new RequestChargeTracker(); - entity.requestContext = requestContext; - - // set a dummy resource id on the request. - entity.setResourceId("1-MxAPlgMgA="); - - // set consistency level on the request to Bounded Staleness - entity.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.BoundedStaleness.toString()); - - // also setup timeout helper, used in store reader - entity.requestContext.timeoutHelper = new TimeoutHelper(Duration.ofSeconds(2 * 60 * 60 + 2 * 60 + 2)); - - // when the store reader throws Invalid Partition exception, the higher layer should - // clear this target identity. - entity.requestContext.resolvedPartitionKeyRange = new PartitionKeyRange(); - - AddressInformation[] addressInformations = getMockAddressInformationDuringUpgrade(); - IAddressResolver mockAddressCache = getMockAddressCache(addressInformations); - - // validate that the mock works - AddressInformation[] addressInfo = mockAddressCache.resolveAsync(entity, false).toBlocking().value(); - assertThat(addressInfo[0]).isEqualTo(addressInformations[0]); - - AddressSelector addressSelector = new AddressSelector(mockAddressCache, Protocol.Tcp); - URI primaryAddress = addressSelector.resolvePrimaryUriAsync(entity, false).toBlocking().value(); - - // check if the address return from Address Selector matches the original address info - assertThat(primaryAddress.toString()).isEqualTo(addressInformations[0].getPhysicalUri()); - - // Quorum Met scenario Start - { - // get mock transport client that returns a sequence of responses to simulate upgrade - TransportClient mockTransportClient = getMockTransportClientForGlobalStrongReads(addressInformations, ReadQuorumResultKind.QuorumMet); - - // create a real session container - we don't need session for this test anyway - SessionContainer sessionContainer = new SessionContainer(StringUtils.EMPTY); - - // create store reader with mock transport client, real address selector (that has mock address cache), and real session container - StoreReader storeReader = new StoreReader(mockTransportClient, addressSelector, sessionContainer); - - IAuthorizationTokenProvider mockAuthorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - Mockito.when(mockAuthorizationTokenProvider.getUserAuthorizationToken(Matchers.anyString(), Matchers.any(), Matchers.anyString(), Matchers.anyMap(), - Matchers.any(), Matchers.anyMap())).thenReturn("dummyauthtoken"); - - // setup max replica set size on the config reader - ReplicationPolicy replicationPolicy = new ReplicationPolicy(); - GatewayServiceConfigurationReader mockServiceConfigReader = Mockito.mock(GatewayServiceConfigurationReader.class); - Mockito.when(mockServiceConfigReader.getUserReplicationPolicy()).thenReturn(replicationPolicy); - - QuorumReader reader = new QuorumReader(new Configs(),mockTransportClient, addressSelector, storeReader, mockServiceConfigReader, mockAuthorizationTokenProvider); - - entity.requestContext.originalRequestConsistencyLevel = ConsistencyLevel.Strong; - - StoreResponse result = reader.readStrongAsync(entity, 2, ReadMode.Strong).toBlocking().value(); - assertThat(result.getLSN()).isEqualTo(100); - - String globalCommitedLSN = result.getHeaderValue(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN); - - long nGlobalCommitedLSN = Long.parseLong(globalCommitedLSN); - assertThat(nGlobalCommitedLSN).isEqualTo(90); - } - - // Quorum Selected scenario - { - // get mock transport client that returns a sequence of responses to simulate upgrade - TransportClient mockTransportClient = getMockTransportClientForGlobalStrongReads(addressInformations, ReadQuorumResultKind.QuorumSelected); - - // create a real session container - we don't need session for this test anyway - SessionContainer sessionContainer = new SessionContainer(StringUtils.EMPTY); - - // create store reader with mock transport client, real address selector (that has mock address cache), and real session container - StoreReader storeReader = new StoreReader(mockTransportClient, addressSelector, sessionContainer); - - IAuthorizationTokenProvider mockAuthorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - Mockito.when(mockAuthorizationTokenProvider.getUserAuthorizationToken(Matchers.anyString(), Matchers.any(), Matchers.anyString(), Matchers.anyMap(), - Matchers.any(), Matchers.anyMap())).thenReturn("dummyauthtoken"); - - // setup max replica set size on the config reader - ReplicationPolicy replicationPolicy = new ReplicationPolicy(); - BridgeInternal.setMaxReplicaSetSize(replicationPolicy,4); - - GatewayServiceConfigurationReader mockServiceConfigReader = Mockito.mock(GatewayServiceConfigurationReader.class); - Mockito.when(mockServiceConfigReader.getUserReplicationPolicy()).thenReturn(replicationPolicy); - Mockito.when(mockServiceConfigReader.getDefaultConsistencyLevel()).thenReturn(ConsistencyLevel.Strong); - - QuorumReader reader = new QuorumReader(new Configs(), mockTransportClient, addressSelector, storeReader, mockServiceConfigReader, mockAuthorizationTokenProvider); - entity.requestContext.originalRequestConsistencyLevel = ConsistencyLevel.Strong; - entity.requestContext.quorumSelectedLSN = -1; - entity.requestContext.globalCommittedSelectedLSN = -1; - try { - StoreResponse result = reader.readStrongAsync(entity, 2, ReadMode.Strong).toBlocking().value(); - assertThat(false).isTrue(); - } catch (Exception ex) { - if (ex.getCause() instanceof GoneException) { - logger.info("Gone exception expected!"); - } - } - - assertThat(entity.requestContext.quorumSelectedLSN).isEqualTo(100); - assertThat(entity.requestContext.globalCommittedSelectedLSN).isEqualTo(100); - } - - // Quorum not met scenario - { - // get mock transport client that returns a sequence of responses to simulate upgrade - TransportClient mockTransportClient = getMockTransportClientForGlobalStrongReads(addressInformations, ReadQuorumResultKind.QuorumNotSelected); - - // create a real session container - we don't need session for this test anyway - SessionContainer sessionContainer = new SessionContainer(StringUtils.EMPTY); - - // create store reader with mock transport client, real address selector (that has mock address cache), and real session container - StoreReader storeReader = - new StoreReader(mockTransportClient, - addressSelector, - sessionContainer); - - IAuthorizationTokenProvider mockAuthorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - Mockito.when(mockAuthorizationTokenProvider.getUserAuthorizationToken(Matchers.anyString(), Matchers.any(), Matchers.anyString(), Matchers.anyMap(), - Matchers.any(), Matchers.anyMap())).thenReturn("dummyauthtoken"); - // setup max replica set size on the config reader - ReplicationPolicy replicationPolicy = new ReplicationPolicy(); - BridgeInternal.setMaxReplicaSetSize(replicationPolicy,4); - - GatewayServiceConfigurationReader mockServiceConfigReader = Mockito.mock(GatewayServiceConfigurationReader.class); - Mockito.when(mockServiceConfigReader.getUserReplicationPolicy()).thenReturn(replicationPolicy); - Mockito.when(mockServiceConfigReader.getDefaultConsistencyLevel()).thenReturn(ConsistencyLevel.Strong); - - QuorumReader reader = new QuorumReader(new Configs(), mockTransportClient, addressSelector, storeReader, mockServiceConfigReader, mockAuthorizationTokenProvider); - entity.requestContext.originalRequestConsistencyLevel = ConsistencyLevel.Strong; - entity.requestContext.performLocalRefreshOnGoneException = true; - - StoreResponse result = reader.readStrongAsync(entity, 2, ReadMode.Strong).toBlocking().value(); - assertThat(result.getLSN()).isEqualTo(100); - - String globalCommitedLSN; - globalCommitedLSN = result.getHeaderValue(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN); - long nGlobalCommitedLSN = Long.parseLong(globalCommitedLSN); - assertThat(nGlobalCommitedLSN).isEqualTo(90); - } - - } - - // TODO: more mocking unit tests for different scenarios in StoreReader - // TODO: more mocking tests on how session work for StoreReader -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreReaderTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreReaderTest.java deleted file mode 100644 index 7ed77154118c..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreReaderTest.java +++ /dev/null @@ -1,831 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.collect.ImmutableList; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.ISessionToken; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.VectorSessionToken; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.internal.DocumentServiceRequestContext; -import com.microsoft.azure.cosmosdb.rx.internal.NotFoundException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionIsMigratingException; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionKeyRangeIsSplittingException; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import org.assertj.core.api.AssertionsForClassTypes; -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import rx.Single; -import rx.observers.TestSubscriber; -import rx.subjects.PublishSubject; - -import java.net.URI; -import java.util.List; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.CyclicBarrier; -import java.util.concurrent.TimeUnit; - -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.StatusCodes.GONE; -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.SubStatusCodes.COMPLETING_PARTITION_MIGRATION; -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.SubStatusCodes.COMPLETING_SPLIT; -import static com.microsoft.azure.cosmosdb.internal.HttpConstants.SubStatusCodes.PARTITION_KEY_RANGE_GONE; -import static org.assertj.core.api.Assertions.assertThat; - -public class StoreReaderTest { - private static final int TIMEOUT = 30000; - - - /** - * Tests for {@link StoreReader} - */ - @Test(groups = "unit") - public void startBackgroundAddressRefresh() throws Exception { - TransportClient transportClient = Mockito.mock(TransportClient.class); - AddressSelector addressSelector = Mockito.mock(AddressSelector.class); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - - StoreReader storeReader = new StoreReader(transportClient, addressSelector, sessionContainer); - - CyclicBarrier b = new CyclicBarrier(2); - PublishSubject> subject = PublishSubject.create(); - CountDownLatch c = new CountDownLatch(1); - - List uris = ImmutableList.of(URI.create("https://localhost:5050"), URI.create("https://localhost:5051"), - URI.create("https://localhost:50502"), URI.create("https://localhost:5053")); - - Mockito.doAnswer(new Answer() { - @Override - public Single> answer(InvocationOnMock invocationOnMock) throws Throwable { - - return subject.toSingle().doOnSuccess(x -> c.countDown()).doAfterTerminate(() -> { - new Thread() { - @Override - public void run() { - try { - b.await(); - } catch (Exception e) { - - } - } - }.start(); - }); - } - }).when(addressSelector).resolveAllUriAsync(Mockito.any(RxDocumentServiceRequest.class), Mockito.eq(true), Mockito.eq(true)); - RxDocumentServiceRequest request = Mockito.mock(RxDocumentServiceRequest.class); - storeReader.startBackgroundAddressRefresh(request); - - subject.onNext(uris); - subject.onCompleted(); - - TimeUnit.MILLISECONDS.sleep(100); - AssertionsForClassTypes.assertThat(c.getCount()).isEqualTo(0); - AssertionsForClassTypes.assertThat(b.getNumberWaiting()).isEqualTo(1); - b.await(1000, TimeUnit.MILLISECONDS); - } - - @DataProvider(name = "verifyCanContinueOnExceptionArgProvider") - public Object[][] verifyCanContinueOnExceptionArgProvider() { - return new Object[][]{ - {new PartitionKeyRangeGoneException(), false,}, - {new PartitionKeyRangeIsSplittingException(), false,}, - {new PartitionKeyRangeGoneException(), false,}, - {new PartitionIsMigratingException(), false,}, - {new GoneException(), true,}, - {ExceptionBuilder.create().withHeader(HttpConstants.HttpHeaders.REQUEST_VALIDATION_FAILURE, "").asGoneException(), true,}, - {ExceptionBuilder.create().withHeader(HttpConstants.HttpHeaders.REQUEST_VALIDATION_FAILURE, "0").asGoneException(), true,}, - {ExceptionBuilder.create().withHeader(HttpConstants.HttpHeaders.REQUEST_VALIDATION_FAILURE, "1").asGoneException(), false,}, - }; - } - - @Test(groups = "unit", dataProvider = "verifyCanContinueOnExceptionArgProvider") - public void verifyCanContinueOnException(DocumentClientException dce, Boolean shouldVerify) { - DocumentClientException capturedFailure = null; - try { - StoreReader.verifyCanContinueOnException(dce); - } catch (DocumentClientException e) { - capturedFailure = e; - } - - if (shouldVerify) { - assertThat(capturedFailure).isNull(); - } else { - assertThat(capturedFailure).isEqualTo(dce); - } - } - - @DataProvider(name = "exceptionArgProvider") - public Object[][] exceptionArgProvider() { - return new Object[][]{ - // exception to be thrown from transportClient, expected (exception type, status, subStatus) - { new PartitionKeyRangeGoneException(), PartitionKeyRangeGoneException.class, GONE, PARTITION_KEY_RANGE_GONE, }, - { new PartitionKeyRangeIsSplittingException() , PartitionKeyRangeIsSplittingException.class, GONE, COMPLETING_SPLIT, }, - { new PartitionIsMigratingException(), PartitionIsMigratingException.class, GONE, COMPLETING_PARTITION_MIGRATION, }, - }; - } - - @Test(groups = "unit", dataProvider = "exceptionArgProvider") - public void exception(Exception ex, Class klass, int expectedStatusCode, Integer expectedSubStatusCode) { - TransportClientWrapper transportClientWrapper = new TransportClientWrapper.Builder.ReplicaResponseBuilder - .SequentialBuilder() - .then(ex) - .build(); - - URI primaryUri = URI.create("primary"); - URI secondaryUri1 = URI.create("secondary1"); - URI secondaryUri2 = URI.create("secondary2"); - URI secondaryUri3 = URI.create("secondary3"); - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryUri) - .withSecondary(ImmutableList.of(secondaryUri1, secondaryUri2, secondaryUri3)) - .build(); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer); - - TimeoutHelper timeoutHelper = Mockito.mock(TimeoutHelper.class); - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - dsr.requestContext.timeoutHelper = timeoutHelper; - dsr.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId("1"); - Single> res = storeReader.readMultipleReplicaAsync(dsr, true, 3, true, true, ReadMode.Strong); - - FailureValidator failureValidator = FailureValidator.builder() - .instanceOf(klass) - .statusCode(expectedStatusCode) - .subStatusCode(expectedSubStatusCode) - .build(); - - TestSubscriber> subscriber = new TestSubscriber<>(); - res.subscribe(subscriber); - subscriber.awaitTerminalEvent(); - subscriber.assertNotCompleted(); - assertThat(subscriber.getOnErrorEvents()).hasSize(1); - failureValidator.validate(subscriber.getOnErrorEvents().get(0)); - } - - /** - * reading in session consistency, if the requested session token cannot be supported by some replicas - * tries others till we find a replica which can support the given session token - */ - @Test(groups = "unit") - public void sessionNotAvailableFromSomeReplicas_FindReplicaSatisfyingRequestedSession() { - long slowReplicaLSN = 651175; - long globalCommittedLsn = 651174; - String partitionKeyRangeId = "73"; - NotFoundException foundException = new NotFoundException(); - foundException.getResponseHeaders().put(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":-1#" + slowReplicaLSN); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.LSN, Long.toString(slowReplicaLSN)); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.LOCAL_LSN, Long.toString(slowReplicaLSN)); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, Long.toString(globalCommittedLsn)); - - long fasterReplicaLSN = 651176; - - StoreResponse storeResponse = StoreResponseBuilder.create() - .withSessionToken(partitionKeyRangeId + ":-1#" + fasterReplicaLSN) - .withLSN(fasterReplicaLSN) - .withLocalLSN(fasterReplicaLSN) - .withQuorumAckecdLsn(fasterReplicaLSN) - .withQuorumAckecdLocalLsn(fasterReplicaLSN) - .withGlobalCommittedLsn(-1) - .withItemLocalLSN(fasterReplicaLSN) - .withRequestCharge(1.1) - .build(); - - TransportClientWrapper transportClientWrapper = new TransportClientWrapper.Builder.ReplicaResponseBuilder - .SequentialBuilder() - .then(foundException) // 1st replica read returns not found with lower lsn - .then(foundException) // 2nd replica read returns not found with lower lsn - .then(foundException) // 3rd replica read returns not found with lower lsn - .then(storeResponse) // 4th replica read returns storeResponse satisfying requested session token - .build(); - - URI primaryUri = URI.create("primary"); - URI secondaryUri1 = URI.create("secondary1"); - URI secondaryUri2 = URI.create("secondary2"); - URI secondaryUri3 = URI.create("secondary3"); - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryUri) - .withSecondary(ImmutableList.of(secondaryUri1, secondaryUri2, secondaryUri3)) - .build(); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer); - - TimeoutHelper timeoutHelper = Mockito.mock(TimeoutHelper.class); - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Session.name()); - dsr.requestContext = new DocumentServiceRequestContext(); - Utils.ValueHolder sessionToken = Utils.ValueHolder.initialize(null); - dsr.requestContext.sessionToken = sessionToken.v; - dsr.requestContext.timeoutHelper = timeoutHelper; - dsr.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId(partitionKeyRangeId); - dsr.requestContext.requestChargeTracker = new RequestChargeTracker(); - assertThat(VectorSessionToken.tryCreate("-1#" + fasterReplicaLSN , sessionToken)).isTrue(); - - Mockito.doReturn(sessionToken.v).when(sessionContainer).resolvePartitionLocalSessionToken(Mockito.eq(dsr), Mockito.anyString()); - - Single> readResult = storeReader.readMultipleReplicaAsync( - dsr, - /* includePrimary */ true, - /* replicaCountToRead */ 1, - /* requiresValidLSN */ true, - /* useSessionToken */ true, - /* readMode */ ReadMode.Any, - /* checkMinLsn */ true, - /* forceReadAll */ false); - - MultiStoreResultValidator validator = MultiStoreResultValidator.create() - .withSize(1) - .validateEachWith(StoreResultValidator.create() - .isValid() - .noException() - .withStoreResponse(StoreResponseValidator.create() - .isSameAs(storeResponse) - .build()) - .build()) - .build(); - validateSuccess(readResult, validator); - - addressSelectorWrapper.validate() - .verifyNumberOfForceCachRefresh(0) - .verifyVesolvePrimaryUriAsyncCount(0) - .verifyTotalInvocations(1); - } - - /** - * Reading with session consistency, replicas have session token with higher than requested and return not found - */ - @Test(groups = "unit") - public void sessionRead_LegitimateNotFound() { - long lsn = 651175; - long globalCommittedLsn = 651174; - String partitionKeyRangeId = "73"; - - NotFoundException foundException = new NotFoundException(); - foundException.getResponseHeaders().put(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":-1#" + lsn); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.LSN, Long.toString(lsn)); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.LOCAL_LSN, Long.toString(lsn)); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, Long.toString(globalCommittedLsn)); - - TransportClientWrapper transportClientWrapper = new TransportClientWrapper.Builder.ReplicaResponseBuilder - .SequentialBuilder() - .then(foundException) // 1st replica read returns not found - .then(foundException) // 2nd replica read returns not found - .then(foundException) // 3rd replica read returns not found - .then(foundException) // 4th replica read returns not found - .build(); - - URI primaryUri = URI.create("primary"); - URI secondaryUri1 = URI.create("secondary1"); - URI secondaryUri2 = URI.create("secondary2"); - URI secondaryUri3 = URI.create("secondary3"); - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryUri) - .withSecondary(ImmutableList.of(secondaryUri1, secondaryUri2, secondaryUri3)) - .build(); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer); - - TimeoutHelper timeoutHelper = Mockito.mock(TimeoutHelper.class); - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Session.name()); - dsr.requestContext = new DocumentServiceRequestContext(); - Utils.ValueHolder sessionToken = Utils.ValueHolder.initialize(null); - dsr.requestContext.sessionToken = sessionToken.v; - dsr.requestContext.timeoutHelper = timeoutHelper; - dsr.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId(partitionKeyRangeId); - dsr.requestContext.requestChargeTracker = new RequestChargeTracker(); - assertThat(VectorSessionToken.tryCreate("-1#" + (lsn - 1) , sessionToken)).isTrue(); - - Mockito.doReturn(sessionToken.v).when(sessionContainer).resolvePartitionLocalSessionToken(Mockito.eq(dsr), Mockito.anyString()); - - Single> readResult = storeReader.readMultipleReplicaAsync( - dsr, - /* includePrimary */ true, - /* replicaCountToRead */ 1, - /* requiresValidLSN */ true, - /* useSessionToken */ true, - /* readMode */ ReadMode.Any, - /* checkMinLsn */ true, - /* forceReadAll */ false); - - MultiStoreResultValidator validator = MultiStoreResultValidator.create() - .withSize(1) - .validateEachWith(StoreResultValidator.create() - .isValid() - .withException(FailureValidator.builder().instanceOf(NotFoundException.class).build()) - .build()) - .build(); - validateSuccess(readResult, validator); - } - - /** - * reading in session consistency, none of the replicas can support the requested session token. - */ - @Test(groups = "unit") - public void sessionRead_ReplicasDoNotHaveTheRequestedLSN_NoResult() { - long lsn = 651175; - long globalCommittedLsn = 651174; - String partitionKeyRangeId = "73"; - - NotFoundException foundException = new NotFoundException(); - foundException.getResponseHeaders().put(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":-1#" + lsn); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.LSN, Long.toString(lsn)); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.LOCAL_LSN, Long.toString(lsn)); - foundException.getResponseHeaders().put(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, Long.toString(globalCommittedLsn)); - - TransportClientWrapper transportClientWrapper = new TransportClientWrapper.Builder.ReplicaResponseBuilder - .SequentialBuilder() - .then(foundException) // 1st replica read returns not found - .then(foundException) // 2nd replica read returns not found - .then(foundException) // 3rd replica read returns not found - .then(foundException) // 4th replica read returns not found - .build(); - - URI primaryUri = URI.create("primary"); - URI secondaryUri1 = URI.create("secondary1"); - URI secondaryUri2 = URI.create("secondary2"); - URI secondaryUri3 = URI.create("secondary3"); - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryUri) - .withSecondary(ImmutableList.of(secondaryUri1, secondaryUri2, secondaryUri3)) - .build(); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer); - - TimeoutHelper timeoutHelper = Mockito.mock(TimeoutHelper.class); - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Session.name()); - dsr.requestContext = new DocumentServiceRequestContext(); - Utils.ValueHolder sessionToken = Utils.ValueHolder.initialize(null); - dsr.requestContext.sessionToken = sessionToken.v; - dsr.requestContext.timeoutHelper = timeoutHelper; - dsr.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId(partitionKeyRangeId); - dsr.requestContext.requestChargeTracker = new RequestChargeTracker(); - assertThat(VectorSessionToken.tryCreate("-1#" + (lsn + 1) , sessionToken)).isTrue(); - - Mockito.doReturn(sessionToken.v).when(sessionContainer).resolvePartitionLocalSessionToken(Mockito.eq(dsr), Mockito.anyString()); - - Single> readResult = storeReader.readMultipleReplicaAsync( - dsr, - /* includePrimary */ true, - /* replicaCountToRead */ 1, - /* requiresValidLSN */ true, - /* useSessionToken */ true, - /* readMode */ ReadMode.Any, - /* checkMinLsn */ true, - /* forceReadAll */ false); - - MultiStoreResultValidator validator = MultiStoreResultValidator.create() - .withSize(0) - .build(); - validateSuccess(readResult, validator); - } - - @Test(groups = "unit") - public void requestRateTooLarge_BubbleUp() { - long lsn = 1045395; - long globalCommittedLsn = 1045395; - String partitionKeyRangeId = "257"; - - RequestRateTooLargeException requestRateTooLargeException = new RequestRateTooLargeException(); - requestRateTooLargeException.getResponseHeaders().put(HttpConstants.HttpHeaders.LSN, Long.toString(lsn)); - requestRateTooLargeException.getResponseHeaders().put(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, Long.toString(globalCommittedLsn)); - requestRateTooLargeException.getResponseHeaders().put(WFConstants.BackendHeaders.LOCAL_LSN, Long.toString(lsn)); - requestRateTooLargeException.getResponseHeaders().put(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":-1#" + lsn); - - TransportClientWrapper transportClientWrapper = new TransportClientWrapper.Builder.ReplicaResponseBuilder - .SequentialBuilder() - .then(requestRateTooLargeException) // 1st replica read returns 429 - .then(requestRateTooLargeException) // 2nd replica read returns 429 - .then(requestRateTooLargeException) // 3rd replica read returns 429 - .then(requestRateTooLargeException) // 4th replica read returns 429 - .build(); - - URI primaryUri = URI.create("primary"); - URI secondaryUri1 = URI.create("secondary1"); - URI secondaryUri2 = URI.create("secondary2"); - URI secondaryUri3 = URI.create("secondary3"); - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryUri) - .withSecondary(ImmutableList.of(secondaryUri1, secondaryUri2, secondaryUri3)) - .build(); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer); - - TimeoutHelper timeoutHelper = Mockito.mock(TimeoutHelper.class); - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.getHeaders().put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, ConsistencyLevel.Session.name()); - dsr.requestContext = new DocumentServiceRequestContext(); - Utils.ValueHolder sessionToken = Utils.ValueHolder.initialize(null); - dsr.requestContext.sessionToken = sessionToken.v; - dsr.requestContext.timeoutHelper = timeoutHelper; - dsr.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId("1"); - dsr.requestContext.requestChargeTracker = new RequestChargeTracker(); - assertThat(VectorSessionToken.tryCreate("-1#" + (lsn - 1) , sessionToken)).isTrue(); - - Mockito.doReturn(sessionToken.v).when(sessionContainer).resolvePartitionLocalSessionToken(Mockito.eq(dsr), Mockito.anyString()); - - Single> readResult = storeReader.readMultipleReplicaAsync( - dsr, - /* includePrimary */ true, - /* replicaCountToRead */ 1, - /* requiresValidLSN */ true, - /* useSessionToken */ true, - /* readMode */ ReadMode.Any, - /* checkMinLsn */ true, - /* forceReadAll */ false); - - MultiStoreResultValidator validator = MultiStoreResultValidator.create() - .withSize(1) - .validateEachWith(FailureValidator.builder().instanceOf(RequestRateTooLargeException.class).build()) - .build(); - validateSuccess(readResult, validator); - } - - @Test(groups = "unit") - public void readPrimaryAsync() { - TransportClient transportClient = Mockito.mock(TransportClient.class); - AddressSelector addressSelector = Mockito.mock(AddressSelector.class); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - - URI primaryURI = URI.create("primaryLoc"); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - - request.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - request.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId("12"); - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - - Mockito.doReturn(Single.just(primaryURI)).when(addressSelector).resolvePrimaryUriAsync( - Mockito.eq(request) , Mockito.eq(false)); - - StoreResponse storeResponse = Mockito.mock(StoreResponse.class); - Mockito.doReturn(Single.just(storeResponse)).when(transportClient).invokeResourceOperationAsync(Mockito.eq(primaryURI), Mockito.eq(request)); - - StoreReader storeReader = new StoreReader(transportClient, addressSelector, sessionContainer); - - Single readResult = storeReader.readPrimaryAsync(request, true, true); - StoreResultValidator validator = StoreResultValidator.create() - .withStoreResponse(StoreResponseValidator.create().isSameAs(storeResponse).build()) - .build(); - validateSuccess(readResult, validator); - } - - @Test(groups = "unit") - public void readPrimaryAsync_GoneFromReplica() { - TransportClient transportClient = Mockito.mock(TransportClient.class); - AddressSelector addressSelector = Mockito.mock(AddressSelector.class); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - - URI primaryURI = URI.create("primaryLoc"); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - - request.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - request.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId("12"); - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - - Mockito.doReturn(Single.just(primaryURI)).when(addressSelector).resolvePrimaryUriAsync( - Mockito.eq(request) , Mockito.eq(false)); - - Mockito.doReturn(Single.error(ExceptionBuilder.create().asGoneException())).when(transportClient).invokeResourceOperationAsync(Mockito.eq(primaryURI), Mockito.eq(request)); - StoreReader storeReader = new StoreReader(transportClient, addressSelector, sessionContainer); - Single readResult = storeReader.readPrimaryAsync(request, true, true); - - FailureValidator validator = FailureValidator.builder().instanceOf(GoneException.class).build(); - validateException(readResult, validator); - } - - @Test(groups = "unit") - public void readPrimaryAsync_GoneExceptionOnTimeout() { - TransportClient transportClient = Mockito.mock(TransportClient.class); - AddressSelector addressSelector = Mockito.mock(AddressSelector.class); - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - - URI primaryURI = URI.create("primaryLoc"); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - - request.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - Mockito.doReturn(true).when(request.requestContext.timeoutHelper).isElapsed(); - request.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId("12"); - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - - Mockito.doReturn(Single.just(primaryURI)).when(addressSelector).resolvePrimaryUriAsync( - Mockito.eq(request) , Mockito.eq(false)); - - StoreResponse storeResponse = Mockito.mock(StoreResponse.class); - Mockito.doReturn(Single.just(storeResponse)).when(transportClient).invokeResourceOperationAsync(Mockito.eq(primaryURI), Mockito.eq(request)); - - StoreReader storeReader = new StoreReader(transportClient, addressSelector, sessionContainer); - - Single readResult = storeReader.readPrimaryAsync(request, true, true); - FailureValidator validator = FailureValidator.builder().instanceOf(GoneException.class).build(); - validateException(readResult, validator); - } - - @DataProvider(name = "readPrimaryAsync_RetryOnGoneArgProvider") - public Object[][] readPrimaryAsync_RetryOnGoneArgProvider() { - return new Object[][]{ - // first exception from TransportClient, - // performLocalRefreshOnGoneException, - // retry with force refresh expected, - // validator for expected Exception from Single - // StoreResult has a successful StoreResponse - { - // partition moved, refresh replica address cache and retry - ExceptionBuilder.create().asGoneException(), true, true, null, true - }, - - { - // partition moved, refresh replica address cache is not requested, fail - ExceptionBuilder.create().asGoneException(), false, false, FailureValidator.builder().instanceOf(GoneException.class).build(), false - }, - - { - // invalid partition exception represents collection stale, cannot succeed, propagate failure - ExceptionBuilder.create().asInvalidPartitionException(), true, false, null, false - }, - - { - // cannot continue on partition key range gone, require address cache refresh - ExceptionBuilder.create().asPartitionKeyRangeGoneException(), true, false, - FailureValidator.builder().instanceOf(PartitionKeyRangeGoneException.class).build(), true - }, - - { - // cannot continue on partition split, require address cache refresh - ExceptionBuilder.create().asPartitionKeyRangeIsSplittingException(), true, false, - FailureValidator.builder().instanceOf(PartitionKeyRangeIsSplittingException.class).build(), true - }, - - { - // cannot continue on partition split, require address cache refresh - ExceptionBuilder.create().asPartitionIsMigratingException(), true, false, - FailureValidator.builder().instanceOf(PartitionIsMigratingException.class).build(), true - }, - }; - } - - @Test(groups = "unit", dataProvider = "readPrimaryAsync_RetryOnGoneArgProvider") - public void readPrimaryAsync_RetryOnPrimaryReplicaMove(Exception firstExceptionFromTransport, - boolean performLocalRefreshOnGoneException, - boolean retryWithForceRefreshExpected, - FailureValidator failureFromSingle, - boolean expectedStoreResponseInStoredReadResult) { - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - StoreResponse response = StoreResponseBuilder.create().build(); - - TransportClientWrapper transportClientWrapper = TransportClientWrapper.Builder.sequentialBuilder() - .then(firstExceptionFromTransport) - .then(response) - .build(); - - URI primaryURIPriorToRefresh = URI.create("stale"); - URI primaryURIAfterRefresh = URI.create("new"); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - - request.requestContext.performLocalRefreshOnGoneException = performLocalRefreshOnGoneException; - request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - request.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId("12"); - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.PrimaryReplicaMoveBuilder.create(Protocol.Https) - .withPrimaryReplicaMove(primaryURIPriorToRefresh, primaryURIAfterRefresh).build(); - StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer); - - Single readResult = storeReader.readPrimaryAsync(request, true, true); - - if (failureFromSingle == null) { - StoreResultValidator validator; - if (expectedStoreResponseInStoredReadResult) { - validator = StoreResultValidator.create().withStoreResponse(StoreResponseValidator.create().isSameAs(response).build()).build(); - } else { - validator = StoreResultValidator.create().withException(FailureValidator.builder().sameAs(firstExceptionFromTransport).build()).build(); - } - - validateSuccess(readResult, validator); - } else { - validateException(readResult, failureFromSingle); - } - - int numberOfAttempts = 1 + (retryWithForceRefreshExpected ? 1: 0); - - transportClientWrapper.validate() - .verifyNumberOfInvocations(numberOfAttempts); - - addressSelectorWrapper.validate() - .verifyResolveAddressesAsync(0) - .verifyResolveAllUriAsync(0) - .verifyVesolvePrimaryUriAsyncCount(numberOfAttempts) - .verifyNumberOfForceCachRefresh(retryWithForceRefreshExpected ? 1: 0); - } - - @DataProvider(name = "readMultipleReplicasAsyncArgProvider") - public Object[][] readMultipleReplicasAsyncArgProvider() { - return new Object[][]{ - // boolean includePrimary, int replicaCountToRead, ReadMode.Strong - { false, 3, ReadMode.Strong }, - { true, 3, ReadMode.Strong }, - { false, 3, ReadMode.Any }, - { true, 3, ReadMode.Any }, - { true, 2, ReadMode.Any }, - { false, 2, ReadMode.Any }, - { true, 1, ReadMode.Any }, - { false, 1, ReadMode.Any }, - }; - } - - @Test(groups = "unit", dataProvider = "readMultipleReplicasAsyncArgProvider") - public void readMultipleReplicasAsync(boolean includePrimary, int replicaCountToRead, ReadMode readMode) { - // This adds basic tests for StoreReader.readMultipleReplicasAsync(.) without failure - // TODO: add some tests for readMultipleReplicasAsync which mock behaviour of failure of reading from a replica - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - URI primaryReplicaURI = URI.create("primary"); - ImmutableList secondaryReplicaURIs = ImmutableList.of(URI.create("secondary1"), URI.create("secondary2"), URI.create("secondary3")); - AddressSelectorWrapper addressSelectorWrapper = AddressSelectorWrapper.Builder.Simple.create() - .withPrimary(primaryReplicaURI) - .withSecondary(secondaryReplicaURIs) - .build(); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - - request.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - request.requestContext.timeoutHelper = Mockito.mock(TimeoutHelper.class); - request.requestContext.resolvedPartitionKeyRange = partitionKeyRangeWithId("12"); - - request.requestContext.requestChargeTracker = new RequestChargeTracker(); - - double requestChargePerRead = 1.1; - - StoreResponse primaryResponse = StoreResponseBuilder.create() - .withLSN(51) - .withLocalLSN(18) - .withRequestCharge(requestChargePerRead) - .build(); - StoreResponse secondaryResponse1 = StoreResponseBuilder.create() - .withLSN(50) - .withLocalLSN(17) - .withRequestCharge(requestChargePerRead) - .build(); - StoreResponse secondaryResponse2 = StoreResponseBuilder.create() - .withLSN(49) - .withLocalLSN(16) - .withRequestCharge(requestChargePerRead) - .build(); - StoreResponse secondaryResponse3 = StoreResponseBuilder.create() - .withLSN(48) - .withLocalLSN(15) - .withRequestCharge(requestChargePerRead) - .build(); - - List responseList = ImmutableList.of(primaryResponse, secondaryResponse1, secondaryResponse2, secondaryResponse3); - - TransportClientWrapper transportClientWrapper = TransportClientWrapper.Builder.uriToResultBuilder() - .storeResponseOn(primaryReplicaURI, OperationType.Read, ResourceType.Document, primaryResponse, false) - .storeResponseOn(secondaryReplicaURIs.get(0), OperationType.Read, ResourceType.Document, secondaryResponse1, false) - .storeResponseOn(secondaryReplicaURIs.get(1), OperationType.Read, ResourceType.Document, secondaryResponse2, false) - .storeResponseOn(secondaryReplicaURIs.get(2), OperationType.Read, ResourceType.Document, secondaryResponse3, false) - .build(); - - StoreReader storeReader = new StoreReader(transportClientWrapper.transportClient, addressSelectorWrapper.addressSelector, sessionContainer); - - Single> readResult = storeReader.readMultipleReplicaAsync(request, includePrimary, replicaCountToRead, true, true, readMode); - - long expectedMinLsn = - responseList - .stream() - .filter(sr -> (sr != primaryResponse || includePrimary)) - .mapToLong(sr -> - { - String value = (ReadMode.Strong == readMode)? - sr.getHeaderValue(WFConstants.BackendHeaders.LSN) : - sr.getHeaderValue(WFConstants.BackendHeaders.LOCAL_LSN); - return Long.parseLong(value); - }) - .min().orElse(-1); - - - MultiStoreResultValidator validator = MultiStoreResultValidator.create() - .withSize(replicaCountToRead) - .withMinimumLSN(expectedMinLsn) - .noFailure() - .withTotalRequestCharge(requestChargePerRead * replicaCountToRead) - .build(); - validateSuccess(readResult, validator); - - transportClientWrapper.validate() - .verifyNumberOfInvocations(replicaCountToRead); - addressSelectorWrapper.validate() - .verifyNumberOfForceCachRefresh(0) - .verifyVesolvePrimaryUriAsyncCount(0) - .verifyTotalInvocations(1); - } - - public static void validateSuccess(Single> single, - MultiStoreResultValidator validator) { - validateSuccess(single, validator, 10000); - } - - public static void validateSuccess(Single> single, - MultiStoreResultValidator validator, long timeout) { - TestSubscriber> testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - public static void validateSuccess(Single single, - StoreResultValidator validator) { - validateSuccess(single, validator, 10000); - } - - public static void validateSuccess(Single single, - StoreResultValidator validator, long timeout) { - TestSubscriber testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - public static void validateException(Single single, - FailureValidator validator, long timeout) { - TestSubscriber testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - validator.validate(testSubscriber.getOnErrorEvents().get(0)); - } - - public static void validateException(Single single, - FailureValidator validator) { - validateException(single, validator, TIMEOUT); - } - - private PartitionKeyRange partitionKeyRangeWithId(String id) { - PartitionKeyRange partitionKeyRange = Mockito.mock(PartitionKeyRange.class); - Mockito.doReturn(id).when(partitionKeyRange).getId(); - return partitionKeyRange; - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreReaderUnderTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreReaderUnderTest.java deleted file mode 100644 index f2953ac71c4e..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreReaderUnderTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.collect.ImmutableList; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.apache.commons.lang3.tuple.Pair; -import rx.Single; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -public class StoreReaderUnderTest extends StoreReader { - - public List>> invocations = Collections.synchronizedList(new ArrayList<>()); - - public StoreReaderUnderTest(TransportClient transportClient, AddressSelector addressSelector, ISessionContainer sessionContainer) { - super(transportClient, addressSelector, sessionContainer); - } - - @Override - public Single> readMultipleReplicaAsync(RxDocumentServiceRequest entity, boolean includePrimary, int replicaCountToRead, boolean requiresValidLsn, boolean useSessionToken, ReadMode readMode) { - Method method = new Object(){}.getClass().getEnclosingMethod(); - ImmutableList list = ImmutableList.of(entity, includePrimary, replicaCountToRead, requiresValidLsn, useSessionToken, readMode); - invocations.add(Pair.of(method, list)); - - return super.readMultipleReplicaAsync(entity, includePrimary, replicaCountToRead, requiresValidLsn, useSessionToken, readMode); - } - - @Override - public Single> readMultipleReplicaAsync(RxDocumentServiceRequest entity, boolean includePrimary, int replicaCountToRead, boolean requiresValidLsn, boolean useSessionToken, ReadMode readMode, boolean checkMinLSN, boolean forceReadAll) { - Method method = new Object(){}.getClass().getEnclosingMethod(); - ImmutableList list = ImmutableList.of(entity, includePrimary, replicaCountToRead, requiresValidLsn, useSessionToken, readMode, checkMinLSN, forceReadAll); - invocations.add(Pair.of(method, list)); - return super.readMultipleReplicaAsync(entity, includePrimary, replicaCountToRead, requiresValidLsn, useSessionToken, readMode, checkMinLSN, forceReadAll); - } - - @Override - public Single readPrimaryAsync(RxDocumentServiceRequest entity, boolean requiresValidLsn, boolean useSessionToken) { - Method method = new Object(){}.getClass().getEnclosingMethod(); - ImmutableList list = ImmutableList.of(entity, requiresValidLsn, useSessionToken); - invocations.add(Pair.of(method, list)); - return super.readPrimaryAsync(entity, requiresValidLsn, useSessionToken); - } - -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResponseValidator.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResponseValidator.java deleted file mode 100644 index 708d2a36b9a3..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResponseValidator.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import org.assertj.core.api.Condition; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; - -public interface StoreResponseValidator { - - void validate(StoreResponse storeResponse); - - public static Builder create() { - return new Builder(); - } - - public class Builder { - private List validators = new ArrayList<>(); - - public StoreResponseValidator build() { - return new StoreResponseValidator() { - - @SuppressWarnings({"rawtypes", "unchecked"}) - @Override - public void validate(StoreResponse resp) { - for (StoreResponseValidator validator : validators) { - validator.validate(resp); - } - } - }; - } - public Builder hasHeader(String headerKey) { - - validators.add(new StoreResponseValidator() { - @Override - public void validate(StoreResponse resp) { - assertThat(Arrays.asList(resp.getResponseHeaderNames())).asList().contains(headerKey); - } - }); - return this; - } - public Builder withHeader(String headerKey, String headerValue) { - - validators.add(new StoreResponseValidator() { - @Override - public void validate(StoreResponse resp) { - assertThat(Arrays.asList(resp.getResponseHeaderNames())).asList().contains(headerKey); - int index = Arrays.asList(resp.getResponseHeaderNames()).indexOf(headerKey); - assertThat(resp.getResponseHeaderValues()[index]).isEqualTo(headerValue); - } - }); - return this; - } - - public Builder withHeaderValueCondition(String headerKey, Condition condition) { - - validators.add(new StoreResponseValidator() { - @Override - public void validate(StoreResponse resp) { - assertThat(Arrays.asList(resp.getResponseHeaderNames())).asList().contains(headerKey); - int index = Arrays.asList(resp.getResponseHeaderNames()).indexOf(headerKey); - String value = resp.getResponseHeaderValues()[index]; - condition.matches(value); - } - }); - return this; - } - - public Builder isSameAs(StoreResponse storeResponse) { - - validators.add(new StoreResponseValidator() { - @Override - public void validate(StoreResponse resp) { - assertThat(resp).isSameAs(storeResponse); - } - }); - return this; - } - - public Builder withContent(String content) { - - validators.add(new StoreResponseValidator() { - @Override - public void validate(StoreResponse resp) { - assertThat(content).isEqualTo(resp.getResponseBody()); - } - }); - return this; - } - - public Builder withStatus(int status) { - - validators.add(new StoreResponseValidator() { - @Override - public void validate(StoreResponse resp) { - assertThat(status == resp.getStatus()).isTrue(); - } - }); - return this; - } - - public Builder in(StoreResponse... storeResponse) { - - validators.add(new StoreResponseValidator() { - @Override - public void validate(StoreResponse resp) { - assertThat(resp).isIn((Object[]) storeResponse); - } - }); - return this; - } - - public Builder withBEActivityId(String activityId) { - withHeader(WFConstants.BackendHeaders.ACTIVITY_ID, activityId); - return this; - } - - public Builder withRequestCharge(double value) { - withHeader(HttpConstants.HttpHeaders.REQUEST_CHARGE, Double.toString(value)); - return this; - } - - public Builder withRequestChargeGreaterThanOrEqualTo(double value) { - withHeaderValueCondition(HttpConstants.HttpHeaders.REQUEST_CHARGE, new Condition<>(s -> { - try { - double parsed = Double.parseDouble(s); - return parsed >= value; - } catch (Exception e) { - return false; - } - }, "request charge should be greater than or equal to " + value)); - return this; - } - - public Builder withRequestChargeLessThanOrEqualTo(double value) { - withHeaderValueCondition(HttpConstants.HttpHeaders.REQUEST_CHARGE, new Condition<>(s -> { - try { - double parsed = Double.parseDouble(s); - return parsed <= value; - } catch (Exception e) { - return false; - } - }, "request charge should be greater than or equal to " + value)); - return this; - } - - - public Builder withBELSN(long lsn) { - withHeader(WFConstants.BackendHeaders.LSN, Long.toString(lsn)); - return this; - } - - public Builder withBELocalLSN(long lsn) { - withHeader(WFConstants.BackendHeaders.LOCAL_LSN, Long.toString(lsn)); - return this; - } - - public Builder withBELSNGreaterThanOrEqualTo(long minLSN) { - Condition condition = new Condition<>(value -> { - try { - Long valueAsLong = Long.parseLong(value); - return valueAsLong > minLSN; - } catch (Exception e) { - return false; - } - }, "min lsn"); - withHeaderValueCondition(WFConstants.BackendHeaders.LSN, condition); - return this; - } - - public Builder withBEGlobalLSNGreaterThanOrEqualTo(long minLSN) { - Condition condition = new Condition<>(value -> { - try { - Long valueAsLong = Long.parseLong(value); - return valueAsLong > minLSN; - } catch (Exception e) { - return false; - } - }, "min global lsn"); - withHeaderValueCondition(WFConstants.BackendHeaders.GLOBAL_COMMITTED_LSN, condition); - return this; - } - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResultValidator.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResultValidator.java deleted file mode 100644 index a526001f84dd..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/StoreResultValidator.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; - -import java.net.URI; -import java.util.ArrayList; -import java.util.List; - -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; -import static org.assertj.core.api.AssertionsForClassTypes.fail; - - -public interface StoreResultValidator { - - static Builder create() { - return new Builder(); - } - - void validate(StoreResult storeResult); - - class Builder { - private List validators = new ArrayList<>(); - - public StoreResultValidator build() { - return new StoreResultValidator() { - - @SuppressWarnings({"rawtypes", "unchecked"}) - @Override - public void validate(StoreResult storeResult) { - for (StoreResultValidator validator : validators) { - validator.validate(storeResult); - } - } - }; - } - - public Builder withStoreResponse(StoreResponseValidator storeResponseValidator) { - validators.add(new StoreResultValidator() { - - @Override - public void validate(StoreResult storeResult) { - try { - storeResponseValidator.validate(storeResult.toResponse()); - }catch (DocumentClientException e) { - fail(e.getMessage()); - } - } - }); - return this; - } - - public Builder withException(FailureValidator failureValidator) { - validators.add(new StoreResultValidator() { - - @Override - public void validate(StoreResult storeResult) { - try { - failureValidator.validate(storeResult.getException()); - }catch (DocumentClientException e) { - fail(e.getMessage()); - } - } - }); - return this; - } - - public Builder withLSN(long lsn) { - validators.add(new StoreResultValidator() { - - @Override - public void validate(StoreResult storeResult) { - assertThat(storeResult.lsn).isEqualTo(lsn); - } - }); - return this; - } - - public Builder withMinLSN(long minLSN) { - validators.add(new StoreResultValidator() { - - @Override - public void validate(StoreResult storeResult) { - assertThat(storeResult.lsn).isGreaterThanOrEqualTo(minLSN); - } - }); - return this; - } - - public Builder withGlobalCommitedLSN(long globalLsn) { - validators.add(new StoreResultValidator() { - - @Override - public void validate(StoreResult storeResult) { - assertThat(storeResult.globalCommittedLSN).isEqualTo(globalLsn); - } - }); - return this; - } - - public Builder withQuorumAckedLsn(long quorumAckedLsn) { - validators.add(new StoreResultValidator() { - - @Override - public void validate(StoreResult storeResult) { - assertThat(storeResult.quorumAckedLSN).isEqualTo(quorumAckedLsn); - } - }); - return this; - } - - public Builder noException() { - validators.add(new StoreResultValidator() { - - @Override - public void validate(StoreResult storeResult) { - assertThat(storeResult).hasFieldOrPropertyWithValue("exception", null); - assertThat(storeResult.isGoneException).isFalse(); - } - }); - return this; - } - - public Builder isValid() { - validators.add(new StoreResultValidator() { - - @Override - public void validate(StoreResult storeResult) { - assertThat(storeResult.isValid).isTrue(); - } - }); - return this; - } - - public Builder withReplicaSize(int count) { - validators.add(new StoreResultValidator() { - - @Override - public void validate(StoreResult storeResult) { - assertThat(storeResult.currentReplicaSetSize).isEqualTo(count); - } - }); - return this; - } - - public Builder withStorePhysicalURI(URI expectedURi) { - validators.add(new StoreResultValidator() { - - @Override - public void validate(StoreResult storeResult) { - assertThat(storeResult.storePhysicalAddress).isEqualTo(expectedURi); - } - }); - return this; - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TimeoutHelperTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TimeoutHelperTest.java deleted file mode 100644 index 4f0b3105087b..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TimeoutHelperTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import org.testng.annotations.Test; - -import java.time.Duration; - -import static org.assertj.core.api.Assertions.assertThat; - -public class TimeoutHelperTest { - - @Test(groups = "unit") - public void isElapsed() throws InterruptedException { - Duration duration1 = Duration.ofMillis(100); - TimeoutHelper timeoutHelper1 = new TimeoutHelper(duration1); - assertThat(timeoutHelper1.isElapsed()).isFalse(); - - Duration duration2 = Duration.ofMillis(100); - TimeoutHelper timeoutHelper2 = new TimeoutHelper(duration2); - Thread.sleep(100); - assertThat(timeoutHelper2.isElapsed()).isTrue(); - } - - @Test(groups = "unit") - public void getRemainingTime() throws InterruptedException { - for (int i = 1; i <= 5; i++) { - Duration duration = Duration.ofMillis(100); - TimeoutHelper timeoutHelper = new TimeoutHelper(duration); - Thread.sleep((10*i)); - Duration remainingTime1 = timeoutHelper.getRemainingTime(); - //Giving 5 ms extra buffer in case thread sleep complete early - assertThat(remainingTime1.toMillis()).isLessThanOrEqualTo(100-10*i+5); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TransportClientWrapper.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TransportClientWrapper.java deleted file mode 100644 index c92b6204b3ec..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/TransportClientWrapper.java +++ /dev/null @@ -1,330 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import org.apache.commons.lang3.tuple.Pair; -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Single; - -import java.net.URI; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.Function; - -import static org.assertj.core.api.Assertions.assertThat; - -public class TransportClientWrapper { - private static Logger logger = LoggerFactory.getLogger(TransportClientWrapper.class); - public final TransportClient transportClient; - private final AtomicBoolean valid; - private final AtomicInteger cnt; - private final List> requests; - - TransportClientWrapper(TransportClient transportClient, AtomicInteger cnt, AtomicBoolean valid, List> requests) { - this.transportClient = transportClient; - this.valid = valid; - this.cnt = cnt; - this.requests = requests; - } - - public static class TransportClientWrapperVerificationBuilder { - private List> actions = new ArrayList<>(); - - public static TransportClientWrapperVerificationBuilder create() { - return new TransportClientWrapperVerificationBuilder(); - } - - public TransportClientWrapperVerificationBuilder verifyNumberOfInvocations(int count) { - actions.add(transportClientWrapper -> { - assertThat(transportClientWrapper.getNumberOfInvocations()).isEqualTo(count); - return null; - }); - return this; - } - - public void execute(TransportClientWrapper transportClientWrapper) { - for(Function action: actions) { - action.apply(transportClientWrapper); - } - } - } - - public TransportClientWrapper verifyNumberOfInvocations(int count) { - assertThat(cnt.get()).isEqualTo(count); - return this; - } - - public List> getCapturedArgs() { - return requests; - } - - public int getNumberOfInvocations() { - return cnt.get(); - } - - public TransportClientWrapper validate() { - assertThat(valid).isTrue(); - return this; - } - - public interface Builder { - - static void capture(List> capturedRequests, InvocationOnMock invocation) { - URI physicalUri = invocation.getArgumentAt(0, URI.class); - RxDocumentServiceRequest request = invocation.getArgumentAt(1, RxDocumentServiceRequest.class); - logger.debug("URI: {}, request {}", physicalUri, request); - capturedRequests.add(Pair.of(physicalUri, request)); - } - - TransportClientWrapper build(); - - public static ReplicaResponseBuilder replicaResponseBuilder() { - return new ReplicaResponseBuilder(); - } - - class ReplicaResponseBuilder implements Builder { - Map responseFunctionDictionary = new HashMap<>(); - - public ReplicaResponseBuilder addReplica(URI replicaURI, - Function2WithCheckedException invocationNumberToStoreResponse) { - - responseFunctionDictionary.put(replicaURI, invocationNumberToStoreResponse); - return this; - } - - public TransportClientWrapper build() { - - Map replicaResponseCounterDict = new HashMap<>(); - - AtomicInteger i = new AtomicInteger(0); - AtomicBoolean valid = new AtomicBoolean(true); - List> capturedArgs = Collections.synchronizedList(new ArrayList<>()); - - TransportClient transportClient = Mockito.mock(TransportClient.class); - Mockito.doAnswer(invocation -> { - i.incrementAndGet(); - URI physicalUri = invocation.getArgumentAt(0, URI.class); - RxDocumentServiceRequest request = invocation.getArgumentAt(1, RxDocumentServiceRequest.class); - Function2WithCheckedException function = responseFunctionDictionary.get(physicalUri); - if (function == null) { - valid.set(false); - return Single.error(new IllegalStateException("no registered function for replica " + physicalUri)); - } - int current; - synchronized (transportClient) { - capture(capturedArgs, invocation); - - AtomicInteger cnt = replicaResponseCounterDict.get(physicalUri); - if (cnt == null) { - cnt = new AtomicInteger(0); - replicaResponseCounterDict.put(physicalUri, cnt); - } - - current = cnt.getAndIncrement(); - } - - try { - return Single.just(function.apply(current, request)); - } catch (Exception e) { - return Single.error(e); - } - - }).when(transportClient).invokeResourceOperationAsync(Mockito.any(URI.class), Mockito.any(RxDocumentServiceRequest.class)); - - return new TransportClientWrapper(transportClient, i, valid, capturedArgs); - } - } - - - static SequentialBuilder sequentialBuilder() { - return new SequentialBuilder(); - } - - class SequentialBuilder implements Builder { - private List list = new ArrayList<>(); - - public SequentialBuilder then(StoreResponse response) { - list.add(response); - return this; - } - - public SequentialBuilder then(Exception exception) { - list.add(exception); - return this; - } - - public TransportClientWrapper build() { - AtomicInteger i = new AtomicInteger(0); - AtomicBoolean valid = new AtomicBoolean(true); - List> capturedArgs = Collections.synchronizedList(new ArrayList<>()); - - TransportClient transportClient = Mockito.mock(TransportClient.class); - Mockito.doAnswer(invocation -> { - capture(capturedArgs, invocation); - - int current = i.getAndIncrement(); - if (current >= list.size()) { - valid.set(false); - return Single.error(new IllegalStateException()); - } - Object obj = list.get(current); - StoreResponse response = Utils.as(obj, StoreResponse.class); - if (response != null) { - return Single.just(response); - } else { - return Single.error((Exception) obj); - } - - }).when(transportClient).invokeResourceOperationAsync(Mockito.any(URI.class), Mockito.any(RxDocumentServiceRequest.class)); - - return new TransportClientWrapper(transportClient, i, valid, capturedArgs); - } - } - - static UriToResultBuilder uriToResultBuilder() { - return new UriToResultBuilder(); - } - - class UriToResultBuilder implements Builder { - private static class Result { - StoreResponse storeResponse; - Exception exception; - boolean stickyResult; - - public Result(StoreResponse storeResponse, Exception exception, boolean stickyResult) { - this.storeResponse = storeResponse; - this.exception = exception; - this.stickyResult = stickyResult; - } - } - - private static class Tuple { - URI replicaURI; - OperationType operationType; - ResourceType resourceType; - - public Tuple(URI replicaURI, OperationType operationType, ResourceType resourceType) { - this.replicaURI = replicaURI; - this.operationType = operationType; - this.resourceType = resourceType; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Tuple tuple = (Tuple) o; - return Objects.equals(replicaURI, tuple.replicaURI) && - operationType == tuple.operationType && - resourceType == tuple.resourceType; - } - - @Override - public int hashCode() { - return Objects.hash(replicaURI, operationType, resourceType); - } - - @Override - public String toString() { - return "Tuple{" + - "replicaURI=" + replicaURI + - ", operationType=" + operationType + - ", resourceType=" + resourceType + - '}'; - } - } - private Map> uriToResult = new HashMap<>(); - - - private UriToResultBuilder resultOn(URI replicaURI, OperationType operationType, ResourceType resourceType, StoreResponse rsp, Exception ex, boolean stickyResult) { - Tuple key = new Tuple(replicaURI, operationType, resourceType); - List list = uriToResult.get(key); - if (list == null) { - list = new ArrayList<>(); - uriToResult.put(key, list); - } - list.add(new Result(rsp, ex, stickyResult)); - return this; - } - - public UriToResultBuilder storeResponseOn(URI replicaURI, OperationType operationType, ResourceType resourceType, StoreResponse response, boolean stickyResult) { - resultOn(replicaURI, operationType, resourceType, response, null, stickyResult); - return this; - } - - public UriToResultBuilder exceptionOn(URI replicaURI, OperationType operationType, ResourceType resourceType, Exception exception, boolean stickyResult) { - resultOn(replicaURI, operationType, resourceType, null, exception, stickyResult); - return this; - } - - public TransportClientWrapper build() { - AtomicBoolean valid = new AtomicBoolean(true); - AtomicInteger cnt = new AtomicInteger(0); - List> capturedArgs = Collections.synchronizedList(new ArrayList<>()); - TransportClient transportClient = Mockito.mock(TransportClient.class); - Mockito.doAnswer(invocation -> { - cnt.getAndIncrement(); - URI physicalUri = invocation.getArgumentAt(0, URI.class); - RxDocumentServiceRequest request = invocation.getArgumentAt(1, RxDocumentServiceRequest.class); - capture(capturedArgs, invocation); - - Tuple tuple = new Tuple(physicalUri, request.getOperationType(), request.getResourceType()); - List list = uriToResult.get(tuple); - if (list == null || list.isEmpty()) { - // unknown - valid.set(false); - return Single.error(new IllegalStateException(tuple.toString())); - } - - Result result = list.get(0); - - if (!result.stickyResult) { - list.remove(0); - } - if (result.storeResponse != null) { - return Single.just(result.storeResponse); - } else { - return Single.error(result.exception); - } - - }).when(transportClient).invokeResourceOperationAsync(Mockito.any(URI.class), Mockito.any(RxDocumentServiceRequest.class)); - - return new TransportClientWrapper(transportClient, cnt, valid, capturedArgs); - } - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/WebExceptionUtilityTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/WebExceptionUtilityTest.java deleted file mode 100644 index 8d80eece8e9f..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/WebExceptionUtilityTest.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import io.netty.channel.ChannelException; -import io.netty.channel.ConnectTimeoutException; -import io.netty.handler.timeout.ReadTimeoutException; -import io.reactivex.netty.client.PoolExhaustedException; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -import javax.net.ssl.SSLHandshakeException; -import javax.net.ssl.SSLPeerUnverifiedException; -import java.net.ConnectException; -import java.net.NoRouteToHostException; -import java.net.SocketTimeoutException; -import java.net.UnknownHostException; - -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; - -/** - * validation tests for {@link WebExceptionUtility} - */ -public class WebExceptionUtilityTest { - - @DataProvider(name = "exceptionToIsRetriable") - public Object[][] exceptionToIsRetriable() { - return new Object[][]{ - // exception, is retriable - { - new RuntimeException(), false - }, - { - new ConnectException(), true - }, - { - new ConnectTimeoutException(), true - }, - { - new UnknownHostException(), true - }, - { - ReadTimeoutException.INSTANCE, false - }, - { - new SSLHandshakeException("dummy"), true - }, - { - new NoRouteToHostException(), true, - }, - { - new SSLPeerUnverifiedException("dummy"), true - }, - { - new SocketTimeoutException(), false - }, - { - new PoolExhaustedException(), true - } - }; - } - - @Test(groups = "unit", dataProvider = "exceptionToIsRetriable") - public void isWebExceptionRetriable(Exception e, boolean isRetriable) { - boolean actualRes = WebExceptionUtility.isWebExceptionRetriable(e); - if (isRetriable) { - assertThat(actualRes).describedAs(e.toString()).isTrue(); - } else { - assertThat(actualRes).describedAs(e.toString()).isFalse(); - } - } - - @DataProvider(name = "networkFailure") - public Object[][] networkFailure() { - return new Object[][]{ - // exception, is retriable - { - new RuntimeException(), false - }, - { - new ConnectException(), true - }, - { - new ConnectTimeoutException(), true - }, - { - new UnknownHostException(), true - }, - { - ReadTimeoutException.INSTANCE, true - }, - { - new SSLHandshakeException("dummy"), true - }, - { - new NoRouteToHostException(), true, - }, - { - new SSLPeerUnverifiedException("dummy"), true - }, - { - new SocketTimeoutException(), true - }, - { - new ChannelException(), true - } - }; - } - - @Test(groups = "unit", dataProvider = "networkFailure") - public void isNetworkFailure(Exception e, boolean isNetworkFailure) { - boolean actualRes = WebExceptionUtility.isNetworkFailure(e); - if (isNetworkFailure) { - assertThat(actualRes).describedAs(e.toString()).isTrue(); - } else { - assertThat(actualRes).describedAs(e.toString()).isFalse(); - } - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyInternalUtils.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyInternalUtils.java deleted file mode 100644 index b4e9875f6cf8..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/PartitionKeyInternalUtils.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import com.google.common.collect.ImmutableList; - -public class PartitionKeyInternalUtils { - - public static PartitionKeyInternal createPartitionKeyInternal(String str) { - return new PartitionKeyInternal(ImmutableList.of( - new StringPartitionKeyComponent(str))); - - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RetryUtilsTest.java b/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RetryUtilsTest.java deleted file mode 100644 index 606380453aba..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RetryUtilsTest.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.time.Duration; -import java.util.concurrent.TimeUnit; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; -import org.mockito.Matchers; -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.internal.Quadruple; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.GoneException; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResponse; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResponseBuilder; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResponseValidator; -import com.microsoft.azure.cosmosdb.rx.internal.IRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.RetryUtils; -import com.microsoft.azure.cosmosdb.rx.internal.IRetryPolicy.ShouldRetryResult; - -import rx.Single; -import rx.functions.Func1; -import rx.observers.TestSubscriber; - -public class RetryUtilsTest { - IRetryPolicy retryPolicy; - Func1, Single> callbackMethod; - Func1, Single> inBackoffAlternateCallbackMethod; - private static final Duration minBackoffForInBackoffCallback = Duration.ofMillis(10); - private static final int TIMEOUT = 30000; - private static final Duration BACK_OFF_DURATION = Duration.ofMillis(20); - private StoreResponse storeResponse; - - @BeforeClass(groups = { "unit" }) - public void beforeClass() throws Exception { - retryPolicy = Mockito.mock(IRetryPolicy.class); - callbackMethod = Mockito.mock(Func1.class); - inBackoffAlternateCallbackMethod = Mockito.mock(Func1.class); - storeResponse = getStoreResponse(); - } - - /** - * This method will make sure we are throwing original exception in case of - * ShouldRetryResult.noRetry() instead of Single.error(null). - */ - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void toRetryWithAlternateFuncWithNoRetry() { - Func1> onErrorFunc = RetryUtils.toRetryWithAlternateFunc(callbackMethod, - retryPolicy, inBackoffAlternateCallbackMethod, minBackoffForInBackoffCallback); - Mockito.when(retryPolicy.shouldRetry(Matchers.any())).thenReturn(Single.just(ShouldRetryResult.noRetry())); - Single response = onErrorFunc.call(new GoneException()); - validateFailure(response, TIMEOUT, GoneException.class); - } - - /** - * This method will test retries on callbackMethod, eventually returning success - * response after some failures and making sure it failed for at least specific - * number before passing. - */ - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void toRetryWithAlternateFuncTestingMethodOne() { - Func1> onErrorFunc = RetryUtils.toRetryWithAlternateFunc(callbackMethod, - retryPolicy, null, minBackoffForInBackoffCallback); - - toggleMockFuncBtwFailureSuccess(callbackMethod); - Mockito.when(retryPolicy.shouldRetry(Matchers.any())) - .thenReturn(Single.just(ShouldRetryResult.retryAfter(BACK_OFF_DURATION))); - Single response = onErrorFunc.call(new GoneException()); - StoreResponseValidator validator = StoreResponseValidator.create().withStatus(storeResponse.getStatus()) - .withContent(storeResponse.getResponseBody()).build(); - validateSuccess(response, validator, TIMEOUT); - Mockito.verify(callbackMethod, Mockito.times(4)).call(Matchers.any()); - } - - /** - * This method will test retries on inBackoffAlternateCallbackMethod, eventually - * returning success response after some failures and making sure it failed for - * at least specific number before passing. - */ - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void toRetryWithAlternateFuncTestingMethodTwo() { - Func1> onErrorFunc = RetryUtils.toRetryWithAlternateFunc(callbackMethod, - retryPolicy, inBackoffAlternateCallbackMethod, minBackoffForInBackoffCallback); - Mockito.when(callbackMethod.call(Matchers.any())).thenReturn(Single.error(new GoneException())); - toggleMockFuncBtwFailureSuccess(inBackoffAlternateCallbackMethod); - Mockito.when(retryPolicy.shouldRetry(Matchers.any())) - .thenReturn(Single.just(ShouldRetryResult.retryAfter(BACK_OFF_DURATION))); - Single response = onErrorFunc.call(new GoneException()); - StoreResponseValidator validator = StoreResponseValidator.create().withStatus(storeResponse.getStatus()) - .withContent(storeResponse.getResponseBody()).build(); - validateSuccess(response, validator, TIMEOUT); - Mockito.verify(inBackoffAlternateCallbackMethod, Mockito.times(4)).call(Matchers.any()); - } - - private void validateFailure(Single single, long timeout, Class class1) { - - TestSubscriber testSubscriber = new TestSubscriber<>(); - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - if (!(testSubscriber.getOnErrorEvents().get(0).getClass().equals(class1))) { - fail("Not expecting " + testSubscriber.getOnErrorEvents().get(0)); - } - } - - private void validateSuccess(Single single, StoreResponseValidator validator, long timeout) { - - TestSubscriber testSubscriber = new TestSubscriber<>(); - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - assertThat(testSubscriber.getOnNextEvents()).hasSize(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - private void toggleMockFuncBtwFailureSuccess( - Func1, Single> method) { - Mockito.when(method.call(Matchers.any())).thenAnswer(new Answer>() { - - private int count = 0; - - @Override - public Single answer(InvocationOnMock invocation) throws Throwable { - if (count++ < 3) { - return Single.error(new GoneException()); - } - return Single.just(storeResponse); - } - }); - } - - private StoreResponse getStoreResponse() { - StoreResponseBuilder storeResponseBuilder = new StoreResponseBuilder().withContent("Test content") - .withStatus(200); - return storeResponseBuilder.build(); - } -} diff --git a/cosmosdb/data-plane/direct-impl/src/test/resources/log4j.properties b/cosmosdb/data-plane/direct-impl/src/test/resources/log4j.properties deleted file mode 100644 index 00b89ecf16b7..000000000000 --- a/cosmosdb/data-plane/direct-impl/src/test/resources/log4j.properties +++ /dev/null @@ -1,16 +0,0 @@ -# this is the log4j configuration for tests - -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=INFO, A1 - -# Set HTTP components' logger to INFO - -log4j.category.io.netty=INFO -log4j.category.io.reactivex=INFO -log4j.category.com.microsoft.azure.cosmosdb=INFO -# A1 is set to be a ConsoleAppender. -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%d %5X{pid} [%t] %-5p %c - %m%n diff --git a/cosmosdb/data-plane/examples/pom.xml b/cosmosdb/data-plane/examples/pom.xml deleted file mode 100644 index 52ef7db4eeda..000000000000 --- a/cosmosdb/data-plane/examples/pom.xml +++ /dev/null @@ -1,154 +0,0 @@ - - - - 4.0.0 - - com.microsoft.azure - azure-cosmosdb-parent - 2.4.5 - - - azure-cosmosdb-examples - Async SDK for SQL API of Azure Cosmos DB Service - Examples - Examples for Async SDK for SQL API of Azure Cosmos DB Service - - - UTF-8 - 1.7.6 - 1.2.17 - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.6.0 - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-eclipse-plugin - 2.8 - - - - org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8 - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - com.microsoft.azure.cosmosdb.benchmark.Main - - - - maven-assembly-plugin - 2.2 - - - jar-with-dependencies - - - - com.microsoft.azure.cosmosdb.rx.examples.multimaster.samples.Main - - - - - - make-assembly - package - - single - - - - - - - - - com.microsoft.azure - azure-cosmosdb - - - com.microsoft.azure - azure-cosmosdb-commons-test-utils - - - com.google.guava - guava - ${guava.version} - - - io.reactivex - rxjava-guava - 1.0.3 - test - - - org.testng - testng - ${testng.version} - test - - - org.mockito - mockito-core - ${mockito.version} - test - - - org.hamcrest - hamcrest-all - 1.3 - test - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.slf4j - slf4j-log4j12 - ${slf4j.version} - - - log4j - log4j - ${log4j.version} - - - diff --git a/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/ConfigurationManager.java b/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/ConfigurationManager.java deleted file mode 100644 index a09f58c3da25..000000000000 --- a/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/ConfigurationManager.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.examples.multimaster; - -import java.util.Properties; - -public class ConfigurationManager { - public static Properties getAppSettings() { - return System.getProperties(); - } -} diff --git a/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/Helpers.java b/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/Helpers.java deleted file mode 100644 index 389faee55a6e..000000000000 --- a/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/Helpers.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.examples.multimaster; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import rx.Observable; -import rx.Single; - -public class Helpers { - - static public String createDocumentCollectionUri(String databaseName, String collectionName) { - return String.format("/dbs/%s/colls/%s", databaseName, collectionName); - } - - static public String createDatabaseUri(String databaseName) { - return String.format("/dbs/%s", databaseName); - } - - static public Single createDatabaseIfNotExists(AsyncDocumentClient client, String databaseName) { - - return client.readDatabase("/dbs/" + databaseName, null) - .onErrorResumeNext( - e -> { - if (e instanceof DocumentClientException) { - DocumentClientException dce = (DocumentClientException) e; - if (dce.getStatusCode() == 404) { - // if doesn't exist create it - - Database d = new Database(); - d.setId(databaseName); - - return client.createDatabase(d, null); - } - } - - return Observable.error(e); - } - ).map(ResourceResponse::getResource).toSingle(); - } - - static public Single createCollectionIfNotExists(AsyncDocumentClient client, String databaseName, String collectionName) { - return client.readCollection(createDocumentCollectionUri(databaseName, collectionName), null) - .onErrorResumeNext( - e -> { - if (e instanceof DocumentClientException) { - DocumentClientException dce = (DocumentClientException) e; - if (dce.getStatusCode() == 404) { - // if doesn't exist create it - - DocumentCollection collection = new DocumentCollection(); - collection.setId(collectionName); - - return client.createCollection(createDatabaseUri(databaseName), collection, null); - } - } - - return Observable.error(e); - } - ).map(ResourceResponse::getResource).toSingle(); - } - - static public Single createCollectionIfNotExists(AsyncDocumentClient client, String databaseName, DocumentCollection collection) { - return client.readCollection(createDocumentCollectionUri(databaseName, collection.getId()), null) - .onErrorResumeNext( - e -> { - if (e instanceof DocumentClientException) { - DocumentClientException dce = (DocumentClientException) e; - if (dce.getStatusCode() == 404) { - // if doesn't exist create it - - return client.createCollection(createDatabaseUri(databaseName), collection, null); - } - } - - return Observable.error(e); - } - ).map(ResourceResponse::getResource).toSingle(); - } -} diff --git a/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/samples/ConflictWorker.java b/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/samples/ConflictWorker.java deleted file mode 100644 index 6f6f4548f7f0..000000000000 --- a/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/samples/ConflictWorker.java +++ /dev/null @@ -1,877 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.examples.multimaster.samples; - -import com.microsoft.azure.cosmosdb.AccessCondition; -import com.microsoft.azure.cosmosdb.AccessConditionType; -import com.microsoft.azure.cosmosdb.Conflict; -import com.microsoft.azure.cosmosdb.ConflictResolutionMode; -import com.microsoft.azure.cosmosdb.ConflictResolutionPolicy; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.StoredProcedure; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.examples.multimaster.Helpers; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Observable; -import rx.Scheduler; -import rx.schedulers.Schedulers; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; - -public class ConflictWorker { - private static Logger logger = LoggerFactory.getLogger(ConflictWorker.class); - - private final Scheduler schedulerForBlockingWork; - private final List clients; - private final String basicCollectionUri; - private final String manualCollectionUri; - private final String lwwCollectionUri; - private final String udpCollectionUri; - private final String databaseName; - private final String basicCollectionName; - private final String manualCollectionName; - private final String lwwCollectionName; - private final String udpCollectionName; - private final ExecutorService executor; - - public ConflictWorker(String databaseName, String basicCollectionName, String manualCollectionName, String lwwCollectionName, String udpCollectionName) { - this.clients = new ArrayList<>(); - this.basicCollectionUri = Helpers.createDocumentCollectionUri(databaseName, basicCollectionName); - this.manualCollectionUri = Helpers.createDocumentCollectionUri(databaseName, manualCollectionName); - this.lwwCollectionUri = Helpers.createDocumentCollectionUri(databaseName, lwwCollectionName); - this.udpCollectionUri = Helpers.createDocumentCollectionUri(databaseName, udpCollectionName); - - this.databaseName = databaseName; - this.basicCollectionName = basicCollectionName; - this.manualCollectionName = manualCollectionName; - this.lwwCollectionName = lwwCollectionName; - this.udpCollectionName = udpCollectionName; - - this.executor = Executors.newFixedThreadPool(100); - this.schedulerForBlockingWork = Schedulers.from(executor); - } - - public void addClient(AsyncDocumentClient client) { - this.clients.add(client); - } - - private DocumentCollection createCollectionIfNotExists(AsyncDocumentClient createClient, String databaseName, DocumentCollection collection) { - return Helpers.createCollectionIfNotExists(createClient, this.databaseName, collection) - .subscribeOn(schedulerForBlockingWork).toBlocking().value(); - } - - private DocumentCollection createCollectionIfNotExists(AsyncDocumentClient createClient, String databaseName, String collectionName) { - - return Helpers.createCollectionIfNotExists(createClient, this.databaseName, this.basicCollectionName) - .subscribeOn(schedulerForBlockingWork).toBlocking().value(); - } - - private DocumentCollection getCollectionDefForManual(String id) { - DocumentCollection collection = new DocumentCollection(); - collection.setId(id); - ConflictResolutionPolicy policy = ConflictResolutionPolicy.createCustomPolicy(); - collection.setConflictResolutionPolicy(policy); - return collection; - } - - private DocumentCollection getCollectionDefForLastWinWrites(String id, String conflictResolutionPath) { - DocumentCollection collection = new DocumentCollection(); - collection.setId(id); - ConflictResolutionPolicy policy = ConflictResolutionPolicy.createLastWriterWinsPolicy(conflictResolutionPath); - collection.setConflictResolutionPolicy(policy); - return collection; - } - - private DocumentCollection getCollectionDefForCustom(String id, String storedProc) { - DocumentCollection collection = new DocumentCollection(); - collection.setId(id); - ConflictResolutionPolicy policy = ConflictResolutionPolicy.createCustomPolicy(storedProc); - collection.setConflictResolutionPolicy(policy); - return collection; - } - - public void initialize() throws Exception { - AsyncDocumentClient createClient = this.clients.get(0); - - Helpers.createDatabaseIfNotExists(createClient, this.databaseName).subscribeOn(schedulerForBlockingWork).toBlocking().value(); - - DocumentCollection basic = createCollectionIfNotExists(createClient, this.databaseName, this.basicCollectionName); - - DocumentCollection manualCollection = createCollectionIfNotExists(createClient, - Helpers.createDatabaseUri(this.databaseName), getCollectionDefForManual(this.manualCollectionName)); - - DocumentCollection lwwCollection = createCollectionIfNotExists(createClient, - Helpers.createDatabaseUri(this.databaseName), getCollectionDefForLastWinWrites(this.lwwCollectionName, "/regionId")); - - DocumentCollection udpCollection = createCollectionIfNotExists(createClient, - Helpers.createDatabaseUri(this.databaseName), getCollectionDefForCustom(this.udpCollectionName, - String.format("dbs/%s/colls/%s/sprocs/%s", this.databaseName, this.udpCollectionName, "resolver"))); - - StoredProcedure lwwSproc = new StoredProcedure(); - lwwSproc.setId("resolver"); - lwwSproc.setBody(IOUtils.toString( - getClass().getClassLoader().getResourceAsStream("resolver-storedproc.txt"), "UTF-8")); - - lwwSproc = - getResource(createClient.upsertStoredProcedure( - Helpers.createDocumentCollectionUri(this.databaseName, this.udpCollectionName), lwwSproc, null)); - - } - - private T getResource(Observable> obs) { - return obs.subscribeOn(schedulerForBlockingWork).toBlocking().single().getResource(); - } - - public void runManualConflict() throws Exception { - logger.info("\r\nInsert Conflict\r\n"); - this.runInsertConflictOnManual(); - - logger.info("\r\nUpdate Conflict\r\n"); - this.runUpdateConflictOnManual(); - - logger.info("\r\nDelete Conflict\r\n"); - this.runDeleteConflictOnManual(); - } - - public void runLWWConflict() throws Exception { - logger.info("\r\nInsert Conflict\r\n"); - this.runInsertConflictOnLWW(); - - logger.info("\r\nUpdate Conflict\r\n"); - this.runUpdateConflictOnLWW(); - - logger.info("\r\nDelete Conflict\r\n"); - this.runDeleteConflictOnLWW(); - } - - public void runUDPConflict() throws Exception { - logger.info("\r\nInsert Conflict\r\n"); - this.runInsertConflictOnUdp(); - - logger.info("\r\nUpdate Conflict\r\n"); - this.runUpdateConflictOnUdp(); - - logger.info("\r\nDelete Conflict\r\n"); - this.runDeleteConflictOnUdp(); - } - - public void runInsertConflictOnManual() throws Exception { - do { - logger.info("1) Performing conflicting insert across {} regions on {}", this.clients.size(), this.manualCollectionName); - - ArrayList> insertTask = new ArrayList>(); - - Document conflictDocument = new Document(); - conflictDocument.setId(UUID.randomUUID().toString()); - - int index = 0; - for (AsyncDocumentClient client : this.clients) { - insertTask.add(this.tryInsertDocument(client, this.manualCollectionUri, conflictDocument, index++)); - } - - List conflictDocuments = Observable.merge(insertTask).toList().subscribeOn(schedulerForBlockingWork).toBlocking().single(); - - if (conflictDocuments.size() == this.clients.size()) { - logger.info("2) Caused {} insert conflicts, verifying conflict resolution", conflictDocuments.size()); - - for (Document conflictingInsert : conflictDocuments) { - this.validateManualConflict(this.clients, conflictingInsert); - } - break; - } else { - logger.info("Retrying insert to induce conflicts"); - } - } while (true); - } - - public void runUpdateConflictOnManual() throws Exception { - do { - Document conflictDocument = new Document(); - conflictDocument.setId(UUID.randomUUID().toString()); - - - conflictDocument = this.tryInsertDocument(clients.get(0), this.manualCollectionUri, conflictDocument, 0) - .firstOrDefault(null).toBlocking().first(); - - TimeUnit.SECONDS.sleep(1);//1 Second for write to sync. - - - logger.info("1) Performing conflicting update across 3 regions on {}", this.manualCollectionName); - - ArrayList> updateTask = new ArrayList>(); - - int index = 0; - for (AsyncDocumentClient client : this.clients) { - updateTask.add(this.tryUpdateDocument(client, this.manualCollectionUri, conflictDocument, index++)); - } - - List conflictDocuments = Observable.merge(updateTask).toList().toBlocking().single(); - - if (conflictDocuments.size() > 1) { - logger.info("2) Caused {} updated conflicts, verifying conflict resolution", conflictDocuments.size()); - - for (Document conflictingUpdate : conflictDocuments) { - this.validateManualConflict(this.clients, conflictingUpdate); - } - break; - } else { - logger.info("Retrying update to induce conflicts"); - } - } while (true); - } - - public void runDeleteConflictOnManual() throws Exception { - do { - Document conflictDocument = new Document(); - conflictDocument.setId(UUID.randomUUID().toString()); - - conflictDocument = this.tryInsertDocument(clients.get(0), this.manualCollectionUri, conflictDocument, 0) - .firstOrDefault(null).toBlocking().first(); - - TimeUnit.SECONDS.sleep(10);//1 Second for write to sync. - - logger.info("1) Performing conflicting delete across 3 regions on {}", this.manualCollectionName); - - ArrayList> deleteTask = new ArrayList>(); - - int index = 0; - for (AsyncDocumentClient client : this.clients) { - deleteTask.add(this.tryDeleteDocument(client, this.manualCollectionUri, conflictDocument, index++)); - } - - List conflictDocuments = Observable.merge(deleteTask).toList() - .subscribeOn(schedulerForBlockingWork) - .toBlocking().single(); - - if (conflictDocuments.size() > 1) { - logger.info("2) Caused {} delete conflicts, verifying conflict resolution", conflictDocuments.size()); - - for (Document conflictingDelete : conflictDocuments) { - this.validateManualConflict(this.clients, conflictingDelete); - } - - break; - } else { - logger.info("Retrying update to induce conflicts"); - } - } while (true); - } - - public void runInsertConflictOnLWW() throws Exception { - do { - logger.info("Performing conflicting insert across 3 regions"); - - ArrayList> insertTask = new ArrayList>(); - - Document conflictDocument = new Document(); - conflictDocument.setId(UUID.randomUUID().toString()); - - int index = 0; - for (AsyncDocumentClient client : this.clients) { - insertTask.add(this.tryInsertDocument(client, this.lwwCollectionUri, conflictDocument, index++)); - } - - List conflictDocuments = Observable.merge(insertTask).toList().toBlocking().single(); - - - if (conflictDocuments.size() > 1) { - logger.info("Inserted {} conflicts, verifying conflict resolution", conflictDocuments.size()); - - this.validateLWW(this.clients, conflictDocuments); - - break; - } else { - logger.info("Retrying insert to induce conflicts"); - } - } while (true); - } - - public void runUpdateConflictOnLWW() throws Exception { - do { - Document conflictDocument = new Document(); - conflictDocument.setId(UUID.randomUUID().toString()); - - conflictDocument = this.tryInsertDocument(clients.get(0), this.lwwCollectionUri, conflictDocument, 0) - .firstOrDefault(null).toBlocking().first(); - - - TimeUnit.SECONDS.sleep(1); //1 Second for write to sync. - - logger.info("1) Performing conflicting update across {} regions on {}", this.clients.size(), this.lwwCollectionUri); - - ArrayList> insertTask = new ArrayList>(); - - int index = 0; - for (AsyncDocumentClient client : this.clients) { - insertTask.add(this.tryUpdateDocument(client, this.lwwCollectionUri, conflictDocument, index++)); - } - - List conflictDocuments = Observable.merge(insertTask).toList().toBlocking().single(); - - - if (conflictDocuments.size() > 1) { - logger.info("2) Caused {} update conflicts, verifying conflict resolution", conflictDocuments.size()); - - this.validateLWW(this.clients, conflictDocuments); - - break; - } else { - logger.info("Retrying insert to induce conflicts"); - } - } while (true); - } - - public void runDeleteConflictOnLWW() throws Exception { - do { - Document conflictDocument = new Document(); - conflictDocument.setId(UUID.randomUUID().toString()); - - conflictDocument = this.tryInsertDocument(clients.get(0), this.lwwCollectionUri, conflictDocument, 0) - .firstOrDefault(null).toBlocking().first(); - - - TimeUnit.SECONDS.sleep(1); //1 Second for write to sync. - - logger.info("1) Performing conflicting delete across {} regions on {}", this.clients.size(), this.lwwCollectionUri); - - ArrayList> insertTask = new ArrayList>(); - - int index = 0; - for (AsyncDocumentClient client : this.clients) { - if (index % 2 == 1) { - //We delete from region 1, even though region 2 always win. - insertTask.add(this.tryDeleteDocument(client, this.lwwCollectionUri, conflictDocument, index++)); - } else { - insertTask.add(this.tryUpdateDocument(client, this.lwwCollectionUri, conflictDocument, index++)); - } - } - - List conflictDocuments = Observable.merge(insertTask).toList().toBlocking().single(); - - if (conflictDocuments.size() > 1) { - logger.info("Inserted {} conflicts, verifying conflict resolution", conflictDocuments.size()); - - //Delete should always win. irrespective of LWW. - this.validateLWW(this.clients, conflictDocuments, true); - break; - } else { - logger.info("Retrying update/delete to induce conflicts"); - } - } while (true); - } - - public void runInsertConflictOnUdp() throws Exception { - do { - logger.info("1) Performing conflicting insert across 3 regions on {}", this.udpCollectionName); - - ArrayList> insertTask = new ArrayList>(); - - Document conflictDocument = new Document(); - conflictDocument.setId(UUID.randomUUID().toString()); - - int index = 0; - for (AsyncDocumentClient client : this.clients) { - insertTask.add(this.tryInsertDocument(client, this.udpCollectionUri, conflictDocument, index++)); - } - - List conflictDocuments = Observable.merge(insertTask).toList().toBlocking().single(); - - - if (conflictDocuments.size() > 1) { - logger.info("2) Caused {} insert conflicts, verifying conflict resolution", conflictDocuments.size()); - - this.validateUDPAsync(this.clients, conflictDocuments); - - break; - } else { - logger.info("Retrying insert to induce conflicts"); - } - } while (true); - } - - public void runUpdateConflictOnUdp() throws Exception { - do { - Document conflictDocument = new Document(); - conflictDocument.setId(UUID.randomUUID().toString()); - - conflictDocument = this.tryInsertDocument(clients.get(0), this.udpCollectionUri, conflictDocument, 0) - .firstOrDefault(null).toBlocking().first(); - - TimeUnit.SECONDS.sleep(1); //1 Second for write to sync. - - logger.info("1) Performing conflicting update across 3 regions on {}", this.udpCollectionUri); - - ArrayList> updateTask = new ArrayList>(); - - int index = 0; - for (AsyncDocumentClient client : this.clients) { - updateTask.add(this.tryUpdateDocument(client, this.udpCollectionUri, conflictDocument, index++)); - } - - List conflictDocuments = Observable.merge(updateTask).toList().toBlocking().single(); - - - if (conflictDocuments.size() > 1) { - logger.info("2) Caused {} update conflicts, verifying conflict resolution", conflictDocuments.size()); - - this.validateUDPAsync(this.clients, conflictDocuments); - - break; - } else { - logger.info("Retrying update to induce conflicts"); - } - } while (true); - } - - public void runDeleteConflictOnUdp() throws Exception { - do { - Document conflictDocument = new Document(); - conflictDocument.setId(UUID.randomUUID().toString()); - - conflictDocument = this.tryInsertDocument(clients.get(0), this.udpCollectionUri, conflictDocument, 0) - .firstOrDefault(null).toBlocking().first(); - - TimeUnit.SECONDS.sleep(1); //1 Second for write to sync. - - logger.info("1) Performing conflicting update/delete across 3 regions on {}", this.udpCollectionUri); - - ArrayList> deleteTask = new ArrayList>(); - - int index = 0; - for (AsyncDocumentClient client : this.clients) { - if (index % 2 == 1) { - //We delete from region 1, even though region 2 always win. - deleteTask.add(this.tryDeleteDocument(client, this.udpCollectionUri, conflictDocument, index++)); - } else { - deleteTask.add(this.tryUpdateDocument(client, this.udpCollectionUri, conflictDocument, index++)); - } - } - - List conflictDocuments = Observable.merge(deleteTask).toList().toBlocking().single(); - - if (conflictDocuments.size() > 1) { - logger.info("2) Caused {} delete conflicts, verifying conflict resolution", conflictDocuments.size()); - - //Delete should always win. irrespective of LWW. - this.validateUDPAsync(this.clients, conflictDocuments, true); - break; - } else { - logger.info("Retrying update/delete to induce conflicts"); - } - } while (true); - } - - private Observable tryInsertDocument(AsyncDocumentClient client, String collectionUri, Document document, int index) { - - logger.debug("region: {}", client.getWriteEndpoint()); - document.set("regionId", index); - document.set("regionEndpoint", client.getReadEndpoint()); - return client.createDocument(collectionUri, document, null, false) - .onErrorResumeNext(e -> { - if (hasDocumentClientException(e, 409)) { - return Observable.empty(); - } else { - return Observable.error(e); - } - }).map(ResourceResponse::getResource); - } - - private boolean hasDocumentClientException(Throwable e, int statusCode) { - if (e instanceof DocumentClientException) { - DocumentClientException dce = (DocumentClientException) e; - return dce.getStatusCode() == statusCode; - } - - return false; - } - - private boolean hasDocumentClientExceptionCause(Throwable e) { - while (e != null) { - if (e instanceof DocumentClientException) { - return true; - } - - e = e.getCause(); - } - return false; - } - - private boolean hasDocumentClientExceptionCause(Throwable e, int statusCode) { - while (e != null) { - if (e instanceof DocumentClientException) { - DocumentClientException dce = (DocumentClientException) e; - return dce.getStatusCode() == statusCode; - } - - e = e.getCause(); - } - - return false; - } - - private Observable tryUpdateDocument(AsyncDocumentClient client, String collectionUri, Document document, int index) { - document.set("regionId", index); - document.set("regionEndpoint", client.getReadEndpoint()); - - RequestOptions options = new RequestOptions(); - options.setAccessCondition(new AccessCondition()); - options.getAccessCondition().setType(AccessConditionType.IfMatch); - options.getAccessCondition().setCondition(document.getETag()); - - - return client.replaceDocument(document.getSelfLink(), document, null).onErrorResumeNext(e -> { - - // pre condition failed - if (hasDocumentClientException(e, 412)) { - //Lost synchronously or not document yet. No conflict is induced. - return Observable.empty(); - - } - return Observable.error(e); - }).map(ResourceResponse::getResource); - } - - private Observable tryDeleteDocument(AsyncDocumentClient client, String collectionUri, Document document, int index) { - document.set("regionId", index); - document.set("regionEndpoint", client.getReadEndpoint()); - - RequestOptions options = new RequestOptions(); - options.setAccessCondition(new AccessCondition()); - options.getAccessCondition().setType(AccessConditionType.IfMatch); - options.getAccessCondition().setCondition(document.getETag()); - - - return client.deleteDocument(document.getSelfLink(), options).onErrorResumeNext(e -> { - - // pre condition failed - if (hasDocumentClientException(e, 412)) { - //Lost synchronously. No conflict is induced. - return Observable.empty(); - - } - return Observable.error(e); - }).map(rr -> document); - } - - private void validateManualConflict(List clients, Document conflictDocument) throws Exception { - boolean conflictExists = false; - for (AsyncDocumentClient client : clients) { - conflictExists = this.validateManualConflict(client, conflictDocument); - } - - if (conflictExists) { - this.deleteConflict(conflictDocument); - } - } - - private boolean isDelete(Conflict conflict) { - return StringUtils.equalsIgnoreCase(conflict.getOperationKind(), "delete"); - } - - - private boolean equals(String a, String b) { - return StringUtils.equals(a, b); - } - - private boolean validateManualConflict(AsyncDocumentClient client, Document conflictDocument) throws Exception { - while (true) { - FeedResponse response = client.readConflicts(this.manualCollectionUri, null) - .first().toBlocking().single(); - - for (Conflict conflict : response.getResults()) { - if (!isDelete(conflict)) { - Document conflictDocumentContent = conflict.getResource(Document.class); - if (equals(conflictDocument.getId(), conflictDocumentContent.getId())) { - if (equals(conflictDocument.getResourceId(), conflictDocumentContent.getResourceId()) && - equals(conflictDocument.getETag(), conflictDocumentContent.getETag())) { - logger.info("Document from Region {} lost conflict @ {}", - conflictDocument.getId(), - conflictDocument.getInt("regionId"), - client.getReadEndpoint()); - return true; - } else { - try { - //Checking whether this is the winner. - Document winnerDocument = client.readDocument(conflictDocument.getSelfLink(), null) - .toBlocking().single().getResource(); - logger.info("Document from region {} won the conflict @ {}", - conflictDocument.getInt("regionId"), - client.getReadEndpoint()); - return false; - } - catch (Exception exception) { - if (hasDocumentClientException(exception, 404)) { - throw exception; - } else { - logger.info( - "Document from region {} not found @ {}", - conflictDocument.getInt("regionId"), - client.getReadEndpoint()); - } - } - } - } - } else { - if (equals(conflict.getSourceResourceId(), conflictDocument.getResourceId())) { - logger.info("Delete conflict found @ {}", - client.getReadEndpoint()); - return false; - } - } - } - - logger.error("Document {} is not found in conflict feed @ {}, retrying", - conflictDocument.getId(), - client.getReadEndpoint()); - - TimeUnit.MILLISECONDS.sleep(500); - } - } - - private void deleteConflict(Document conflictDocument) { - AsyncDocumentClient delClient = clients.get(0); - - FeedResponse conflicts = delClient.readConflicts(this.manualCollectionUri, null).first().toBlocking().single(); - - for (Conflict conflict : conflicts.getResults()) { - if (!isDelete(conflict)) { - Document conflictContent = conflict.getResource(Document.class); - if (equals(conflictContent.getResourceId(), conflictDocument.getResourceId()) - && equals(conflictContent.getETag(), conflictDocument.getETag())) { - logger.info("Deleting manual conflict {} from region {}", - conflict.getSourceResourceId(), - conflictContent.getInt("regionId")); - delClient.deleteConflict(conflict.getSelfLink(), null) - .toBlocking().single(); - - } - } else if (equals(conflict.getSourceResourceId(), conflictDocument.getResourceId())) { - logger.info("Deleting manual conflict {} from region {}", - conflict.getSourceResourceId(), - conflictDocument.getInt("regionId")); - delClient.deleteConflict(conflict.getSelfLink(), null) - .toBlocking().single(); - } - } - } - - private void validateLWW(List clients, List conflictDocument) throws Exception { - validateLWW(clients, conflictDocument, false); - } - - - private void validateLWW(List clients, List conflictDocument, boolean hasDeleteConflict) throws Exception { - for (AsyncDocumentClient client : clients) { - this.validateLWW(client, conflictDocument, hasDeleteConflict); - } - } - - private void validateLWW(AsyncDocumentClient client, List conflictDocument, boolean hasDeleteConflict) throws Exception { - FeedResponse response = client.readConflicts(this.lwwCollectionUri, null) - .first().toBlocking().single(); - - if (response.getResults().size() != 0) { - logger.error("Found {} conflicts in the lww collection", response.getResults().size()); - return; - } - - if (hasDeleteConflict) { - do { - try { - client.readDocument(conflictDocument.get(0).getSelfLink(), null).toBlocking().single(); - - logger.error("Delete conflict for document {} didnt win @ {}", - conflictDocument.get(0).getId(), - client.getReadEndpoint()); - - TimeUnit.MILLISECONDS.sleep(500); - } catch (Exception exception) { - if (!hasDocumentClientExceptionCause(exception)) { - throw exception; - } - - // NotFound - if (hasDocumentClientExceptionCause(exception, 404)) { - - logger.info("Delete conflict won @ {}", client.getReadEndpoint()); - return; - } else { - logger.error("Delete conflict for document {} didnt win @ {}", - conflictDocument.get(0).getId(), - client.getReadEndpoint()); - - TimeUnit.MILLISECONDS.sleep(500); - } - } - } while (true); - } - - Document winnerDocument = null; - - for (Document document : conflictDocument) { - if (winnerDocument == null || - winnerDocument.getInt("regionId") <= document.getInt("regionId")) { - winnerDocument = document; - } - } - - logger.info("Document from region {} should be the winner", - winnerDocument.getInt("regionId")); - - while (true) { - try { - Document existingDocument = client.readDocument(winnerDocument.getSelfLink(), null) - .toBlocking().single().getResource(); - - if (existingDocument.getInt("regionId") == winnerDocument.getInt("regionId")) { - logger.info("Winner document from region {} found at {}", - existingDocument.getInt("regionId"), - client.getReadEndpoint()); - break; - } else { - logger.error("Winning document version from region {} is not found @ {}, retrying...", - winnerDocument.getInt("regionId"), - client.getWriteEndpoint()); - TimeUnit.MILLISECONDS.sleep(500); - } - } catch (Exception e) { - logger.error("Winner document from region {} is not found @ {}, retrying...", - winnerDocument.getInt("regionId"), - client.getWriteEndpoint()); - TimeUnit.MILLISECONDS.sleep(500); - } - } - } - - private void validateUDPAsync(List clients, List conflictDocument) throws Exception { - validateUDPAsync(clients, conflictDocument, false); - } - - private void validateUDPAsync(List clients, List conflictDocument, boolean hasDeleteConflict) throws Exception { - for (AsyncDocumentClient client : clients) { - this.validateUDPAsync(client, conflictDocument, hasDeleteConflict); - } - } - - private String documentNameLink(String collectionId, String documentId) { - return String.format("dbs/%s/colls/%s/docs/%s", databaseName, collectionId, documentId); - } - - private void validateUDPAsync(AsyncDocumentClient client, List conflictDocument, boolean hasDeleteConflict) throws Exception { - FeedResponse response = client.readConflicts(this.udpCollectionUri, null).first().toBlocking().single(); - - if (response.getResults().size() != 0) { - logger.error("Found {} conflicts in the udp collection", response.getResults().size()); - return; - } - - if (hasDeleteConflict) { - do { - try { - client.readDocument( - documentNameLink(udpCollectionName, conflictDocument.get(0).getId()), null) - .toBlocking().single(); - - logger.error("Delete conflict for document {} didnt win @ {}", - conflictDocument.get(0).getId(), - client.getReadEndpoint()); - - TimeUnit.MILLISECONDS.sleep(500); - - } catch (Exception exception) { - if (hasDocumentClientExceptionCause(exception, 404)) { - logger.info("Delete conflict won @ {}", client.getReadEndpoint()); - return; - } else { - logger.error("Delete conflict for document {} didnt win @ {}", - conflictDocument.get(0).getId(), - client.getReadEndpoint()); - - TimeUnit.MILLISECONDS.sleep(500); - } - } - } while (true); - } - - Document winnerDocument = null; - - for (Document document : conflictDocument) { - if (winnerDocument == null || - winnerDocument.getInt("regionId") <= document.getInt("regionId")) { - winnerDocument = document; - } - } - - logger.info("Document from region {} should be the winner", - winnerDocument.getInt("regionId")); - - while (true) { - try { - - Document existingDocument = client.readDocument( - documentNameLink(udpCollectionName, winnerDocument.getId()), null) - .toBlocking().single().getResource(); - - if (existingDocument.getInt("regionId") == winnerDocument.getInt( - ("regionId"))) { - logger.info("Winner document from region {} found at {}", - existingDocument.getInt("regionId"), - client.getReadEndpoint()); - break; - } else { - logger.error("Winning document version from region {} is not found @ {}, retrying...", - winnerDocument.getInt("regionId"), - client.getWriteEndpoint()); - TimeUnit.MILLISECONDS.sleep(500); - } - } catch (Exception e) { - logger.error("Winner document from region {} is not found @ {}, retrying...", - winnerDocument.getInt("regionId"), - client.getWriteEndpoint()); - TimeUnit.MILLISECONDS.sleep(500); - } - } - } - - public void shutdown() { - this.executor.shutdown(); - for(AsyncDocumentClient client: clients) { - client.close(); - } - } -} diff --git a/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/samples/Main.java b/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/samples/Main.java deleted file mode 100644 index 58f1864a54d3..000000000000 --- a/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/samples/Main.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.examples.multimaster.samples; - -import com.microsoft.azure.cosmosdb.rx.examples.multimaster.ConfigurationManager; -import org.apache.commons.io.IOUtils; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; - - -public class Main { - public static void main(String[] args) throws Exception { - - if (args.length != 1) { - help(); - System.exit(1); - } - - try (InputStream inputStream = new FileInputStream(args[0])) { - ConfigurationManager.getAppSettings().load(inputStream); - System.out.println("Using file " + args[0] + " for the setting."); - } - - Main.runScenarios(); - } - - private static void runScenarios() throws Exception { - MultiMasterScenario scenario = new MultiMasterScenario(); - scenario.initialize(); - - scenario.runBasic(); - - scenario.runManualConflict(); - scenario.runLWW(); - scenario.runUDP(); - - System.out.println("Finished"); - - //shutting down the active the resources - scenario.shutdown(); - } - - private static void help() throws IOException { - System.out.println("Provide the path to setting file in the following format: "); - try (InputStream inputStream = - Main.class.getClassLoader() - .getResourceAsStream("multi-master-sample-config.properties")) { - - IOUtils.copy(inputStream, System.out); - - System.out.println(); - } catch (Exception e) { - throw e; - } - } -} diff --git a/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/samples/MultiMasterScenario.java b/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/samples/MultiMasterScenario.java deleted file mode 100644 index 5c127de357fc..000000000000 --- a/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/samples/MultiMasterScenario.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.examples.multimaster.samples; - -import com.google.common.base.Preconditions; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.examples.multimaster.ConfigurationManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Completable; - -import javax.net.ssl.SSLException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -public class MultiMasterScenario { - - private final static Logger logger = LoggerFactory.getLogger(MultiMasterScenario.class); - - final private String accountEndpoint; - final private String accountKey; - final private List workers; - final private ConflictWorker conflictWorker; - - public MultiMasterScenario() { - this.accountEndpoint = ConfigurationManager.getAppSettings().getProperty("endpoint"); - this.accountKey = ConfigurationManager.getAppSettings().getProperty("key"); - - String databaseName = ConfigurationManager.getAppSettings().getProperty("databaseName"); - String manualCollectionName = ConfigurationManager.getAppSettings().getProperty("manualCollectionName"); - String lwwCollectionName = ConfigurationManager.getAppSettings().getProperty("lwwCollectionName"); - String udpCollectionName = ConfigurationManager.getAppSettings().getProperty("udpCollectionName"); - String basicCollectionName = ConfigurationManager.getAppSettings().getProperty("basicCollectionName"); - String regionsAsString = ConfigurationManager.getAppSettings().getProperty("regions"); - Preconditions.checkNotNull(regionsAsString, "regions is required"); - String[] regions = regionsAsString.split(";"); - Preconditions.checkArgument(regions.length > 0, "at least one region is required"); - Preconditions.checkNotNull(accountEndpoint, "accountEndpoint is required"); - Preconditions.checkNotNull(accountKey, "accountKey is required"); - Preconditions.checkNotNull(databaseName, "databaseName is required"); - Preconditions.checkNotNull(manualCollectionName, "manualCollectionName is required"); - Preconditions.checkNotNull(lwwCollectionName, "lwwCollectionName is required"); - Preconditions.checkNotNull(udpCollectionName, "udpCollectionName is required"); - Preconditions.checkNotNull(basicCollectionName, "basicCollectionName is required"); - - this.workers = new ArrayList<>(); - this.conflictWorker = new ConflictWorker(databaseName, basicCollectionName, manualCollectionName, lwwCollectionName, udpCollectionName); - - for (String region : regions) { - ConnectionPolicy policy = new ConnectionPolicy(); - policy.setUsingMultipleWriteLocations(true); - policy.setPreferredLocations(Collections.singletonList(region)); - - AsyncDocumentClient client = - new AsyncDocumentClient.Builder() - .withMasterKeyOrResourceToken(this.accountKey) - .withServiceEndpoint(this.accountEndpoint) - .withConsistencyLevel(ConsistencyLevel.Eventual) - .withConnectionPolicy(policy).build(); - - - workers.add(new Worker(client, databaseName, basicCollectionName)); - - conflictWorker.addClient(client); - } - } - - public void initialize() throws Exception { - this.conflictWorker.initialize(); - logger.info("Initialized collections."); - } - - public void runBasic() throws Exception { - logger.info("\n####################################################"); - logger.info("Basic Active-Active"); - logger.info("####################################################"); - - logger.info("1) Starting insert loops across multiple regions ..."); - - List basicTask = new ArrayList(); - - int documentsToInsertPerWorker = 100; - - for (Worker worker : this.workers) { - basicTask.add(worker.runLoopAsync(documentsToInsertPerWorker)); - } - - Completable.merge(basicTask).await(); - - basicTask.clear(); - - logger.info("2) Reading from every region ..."); - - int expectedDocuments = this.workers.size() * documentsToInsertPerWorker; - for (Worker worker : this.workers) { - basicTask.add(worker.readAllAsync(expectedDocuments)); - } - - Completable.merge(basicTask).await(); - - basicTask.clear(); - - logger.info("3) Deleting all the documents ..."); - - this.workers.get(0).deleteAll(); - - logger.info("####################################################"); - } - - public void runManualConflict() throws Exception { - logger.info("\n####################################################"); - logger.info("Manual Conflict Resolution"); - logger.info("####################################################"); - - this.conflictWorker.runManualConflict(); - logger.info("####################################################"); - } - - public void runLWW() throws Exception { - logger.info("\n####################################################"); - logger.info("LWW Conflict Resolution"); - logger.info("####################################################"); - - this.conflictWorker.runLWWConflict(); - logger.info("####################################################"); - } - - public void runUDP() throws Exception { - logger.info("\n####################################################"); - logger.info("UDP Conflict Resolution"); - logger.info("####################################################"); - - this.conflictWorker.runUDPConflict(); - logger.info("####################################################"); - } - - public void shutdown() { - conflictWorker.shutdown(); - for(Worker worker: this.workers) { - worker.shutdown(); - } - } -} diff --git a/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/samples/Worker.java b/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/samples/Worker.java deleted file mode 100644 index 90a5ab77aaff..000000000000 --- a/cosmosdb/data-plane/examples/src/main/java/com/microsoft/azure/cosmosdb/rx/examples/multimaster/samples/Worker.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.examples.multimaster.samples; - - -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.rx.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Completable; -import rx.Scheduler; -import rx.schedulers.Schedulers; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; - -public class Worker { - private final static Logger logger = LoggerFactory.getLogger(Worker.class); - - private final AsyncDocumentClient client; - private final String documentCollectionUri; - - // scheduler for blocking work - private final Scheduler schedulerForBlockingWork; - private final ExecutorService executor; - - public Worker(AsyncDocumentClient client, String databaseName, String collectionName) { - this.client = client; - this.documentCollectionUri = String.format("/dbs/%s/colls/%s", databaseName, collectionName); - this.executor = Executors.newSingleThreadExecutor(); - this.schedulerForBlockingWork = Schedulers.from(executor); - } - - public Completable runLoopAsync(int documentsToInsert) { - return Completable.defer(() -> { - - int iterationCount = 0; - - List latency = new ArrayList<>(); - while (iterationCount++ < documentsToInsert) { - long startTick = System.currentTimeMillis(); - - Document d = new Document(); - d.setId(UUID.randomUUID().toString()); - - this.client.createDocument(this.documentCollectionUri, d, null, false) - .subscribeOn(schedulerForBlockingWork).toBlocking().single(); - - long endTick = System.currentTimeMillis(); - - latency.add(endTick - startTick); - } - - Collections.sort(latency); - int p50Index = (latency.size() / 2); - - logger.info("Inserted {} documents at {} with p50 {} ms", - documentsToInsert, - this.client.getWriteEndpoint(), - latency.get(p50Index)); - - return Completable.complete(); - - }); - - } - - - public Completable readAllAsync(int expectedNumberOfDocuments) { - - return Completable.defer(() -> { - - while (true) { - int totalItemRead = 0; - FeedResponse response = null; - do { - - FeedOptions options = new FeedOptions(); - options.setRequestContinuation(response != null ? response.getResponseContinuation() : null); - - response = this.client.readDocuments(this.documentCollectionUri, options).first() - .subscribeOn(schedulerForBlockingWork).toBlocking().single(); - - totalItemRead += response.getResults().size(); - } while (response.getResponseContinuation() != null); - - if (totalItemRead < expectedNumberOfDocuments) { - logger.info("Total item read {} from {} is less than {}, retrying reads", - totalItemRead, - this.client.getReadEndpoint(), - expectedNumberOfDocuments); - - try { - TimeUnit.SECONDS.sleep(1); - } catch (InterruptedException e) { - logger.info("interrupted"); - break; - } - continue; - } else { - logger.info("Read {} items from {}", totalItemRead, this.client.getReadEndpoint()); - break; - } - } - - return Completable.complete(); - }); - } - - void deleteAll() { - List documents = new ArrayList<>(); - FeedResponse response = null; - do { - - FeedOptions options = new FeedOptions(); - options.setRequestContinuation(response != null ? response.getResponseContinuation() : null); - - response = this.client.readDocuments(this.documentCollectionUri, options).first() - .subscribeOn(schedulerForBlockingWork).toBlocking().single(); - - documents.addAll(response.getResults()); - } while (response.getResponseContinuation() != null); - - for (Document document : documents) { - try { - this.client.deleteDocument(document.getSelfLink(), null) - .subscribeOn(schedulerForBlockingWork).toBlocking().single(); - } catch (RuntimeException exEx) { - DocumentClientException dce = getDocumentClientExceptionCause(exEx); - - if (dce.getStatusCode() != 404) { - logger.info("Error occurred while deleting {} from {}", dce, client.getWriteEndpoint()); - } - } - } - - logger.info("Deleted all documents from region {}", this.client.getWriteEndpoint()); - } - - private DocumentClientException getDocumentClientExceptionCause(Throwable e) { - while (e != null) { - - if (e instanceof DocumentClientException) { - return (DocumentClientException) e; - } - - e = e.getCause(); - } - - return null; - } - - public void shutdown() { - executor.shutdown(); - client.close(); - } -} diff --git a/cosmosdb/data-plane/examples/src/main/resources/log4j.properties b/cosmosdb/data-plane/examples/src/main/resources/log4j.properties deleted file mode 100644 index 00b7fefa6413..000000000000 --- a/cosmosdb/data-plane/examples/src/main/resources/log4j.properties +++ /dev/null @@ -1,23 +0,0 @@ -# this is the log4j configuration for tests - -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=WARN, A1 - -log4j.category.io.netty=INFO -log4j.category.io.reactivex=INFO -log4j.category.com.microsoft.azure.cosmosdb.rx.examples.multimaster.samples.ConflictWorker=INFO -log4j.category.com.microsoft.azure.cosmosdb.rx.examples.multimaster.samples.Main=INFO -log4j.category.com.microsoft.azure.cosmosdb.rx.examples.multimaster.samples.Worker=INFO -log4j.category.com.microsoft.azure.cosmosdb.rx.examples.multimaster.samples.MultiMasterScenario=INFO -log4j.category.com.microsoft.azure.cosmosdb.rx.examples.multimaster.ConfigurationManager=INFO -log4j.category.com.microsoft.azure.cosmosdb.rx.examples.multimaster.Helpers=INFO - -# A1 is set to be a ConsoleAppender. -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -#log4j.appender.A1.layout.ConversionPattern=%d %5X{pid} [%t] %-5p - %m%n - -log4j.appender.A1.layout.ConversionPattern=%m%n - diff --git a/cosmosdb/data-plane/examples/src/main/resources/multi-master-sample-config.properties b/cosmosdb/data-plane/examples/src/main/resources/multi-master-sample-config.properties deleted file mode 100644 index 42c20302edc1..000000000000 --- a/cosmosdb/data-plane/examples/src/main/resources/multi-master-sample-config.properties +++ /dev/null @@ -1,8 +0,0 @@ -endpoint= -key= -regions=North Central US;North Europe;Southeast Asia -databaseName=multiMasterDemoDB -manualCollectionName=myManualCollection -lwwCollectionName=myLwwCollection -udpCollectionName=myUdpCollection -basicCollectionName=myBasicCollection \ No newline at end of file diff --git a/cosmosdb/data-plane/examples/src/main/resources/resolver-storedproc.txt b/cosmosdb/data-plane/examples/src/main/resources/resolver-storedproc.txt deleted file mode 100644 index e856721a979a..000000000000 --- a/cosmosdb/data-plane/examples/src/main/resources/resolver-storedproc.txt +++ /dev/null @@ -1,45 +0,0 @@ -function resolver(incomingRecord, existingRecord, isTombstone, conflictingRecords) { - var collection = getContext().getCollection(); - if (!incomingRecord) { - if (existingRecord) { - collection.deleteDocument(existingRecord._self, {}, function(err, responseOptions) { - if (err) throw err; - }); - } - } else if (isTombstone) { - // delete always wins. - } else { - var documentToUse = incomingRecord; - if (existingRecord) { - if (documentToUse.regionId < existingRecord.regionId) { - documentToUse = existingRecord; - } - } - var i; - for (i = 0; i < conflictingRecords.length; i++) { - if (documentToUse.regionId < conflictingRecords[i].regionId) { - documentToUse = conflictingRecords[i]; - } - } - tryDelete(conflictingRecords, incomingRecord, existingRecord, documentToUse); - } - function tryDelete(documents, incoming, existing, documentToInsert) { - if (documents.length > 0) { - collection.deleteDocument(documents[0]._self, {}, function(err, responseOptions) { - if (err) throw err; - documents.shift(); - tryDelete(documents, incoming, existing, documentToInsert); - }); - } else if (existing) { - collection.replaceDocument(existing._self, documentToInsert, - function(err, documentCreated) { - if (err) throw err; - }); - } else { - collection.createDocument(collection.getSelfLink(), documentToInsert, - function(err, documentCreated) { - if (err) throw err; - }); - } - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/CollectionCRUDAsyncAPITest.java b/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/CollectionCRUDAsyncAPITest.java deleted file mode 100644 index e9d0c4d33604..000000000000 --- a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/CollectionCRUDAsyncAPITest.java +++ /dev/null @@ -1,410 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.examples; - -import com.google.common.util.concurrent.ListenableFuture; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DataType; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.IncludedPath; -import com.microsoft.azure.cosmosdb.Index; -import com.microsoft.azure.cosmosdb.IndexingPolicy; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; -import rx.Observable; -import rx.functions.Action1; -import rx.observable.ListenableFutureObservable; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.CountDownLatch; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.greaterThan; - -/** - * This integration test class demonstrates how to use Async API to create, - * delete, replace, and update Document Collections. - *

- * NOTE: you can use rxJava based async api with java8 lambda expression. Use of - * rxJava based async APIs with java8 lambda expressions is much prettier. - *

- * You can also use the async API without java8 lambda expression support. - *

- * For example - *

    - *
  • {@link #createCollection_MultiPartition_Async()} demonstrates how to use async api - * with java8 lambda expression. - * - *
  • {@link #createCollection_Async_withoutLambda()} demonstrates how to - * do the same thing without lambda expression. - *
- *

- * Also if you need to work with Future or ListenableFuture it is possible to - * transform an observable to ListenableFuture. Please see - * {@link #transformObservableToGoogleGuavaListenableFuture()} - *

- * To Modify the Collection's throughput after it has been created, you need to - * update the corresponding Offer. Please see - * {@see com.microsoft.azure.cosmosdb.rx.examples.OfferCRUDAsyncAPITest#testUpdateOffer()} - */ -public class CollectionCRUDAsyncAPITest { - private final static int TIMEOUT = 120000; - private static Database createdDatabase; - private static AsyncDocumentClient asyncClient; - private DocumentCollection collectionDefinition; - - @BeforeClass(groups = "samples", timeOut = TIMEOUT) - public void setUp() { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - asyncClient = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - - createdDatabase = Utils.createDatabaseForTest(asyncClient); - } - - @BeforeMethod(groups = "samples", timeOut = TIMEOUT) - public void before() { - collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - } - - @AfterClass(groups = "samples", timeOut = TIMEOUT) - public void shutdown() { - Utils.safeClean(asyncClient, createdDatabase); - Utils.safeClose(asyncClient); - } - - /** - * Create a document collection using async api. - * If you want a single partition collection with 10,000 RU/s throughput, - * the only way to do so is to create a single partition collection with lower - * throughput (400) and then increase the throughput. - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createCollection_SinglePartition_Async() throws Exception { - RequestOptions singlePartitionRequestOptions = new RequestOptions(); - singlePartitionRequestOptions.setOfferThroughput(400); - Observable> createCollectionObservable = asyncClient - .createCollection(getDatabaseLink(), collectionDefinition, singlePartitionRequestOptions); - - final CountDownLatch countDownLatch = new CountDownLatch(1); - - createCollectionObservable.single() // We know there is only single result - .subscribe(collectionResourceResponse -> { - System.out.println(collectionResourceResponse.getActivityId()); - countDownLatch.countDown(); - }, error -> { - System.err.println( - "an error occurred while creating the collection: actual cause: " + error.getMessage()); - countDownLatch.countDown(); - }); - - // Wait till collection creation completes - countDownLatch.await(); - } - - /** - * Create a document collection using async api. - * This test uses java8 lambda expression. - * See testCreateCollection_Async_withoutLambda for usage without lambda - * expressions. - * Set the throughput to be > 10,000 RU/s - * to create a multi partition collection. - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createCollection_MultiPartition_Async() throws Exception { - RequestOptions multiPartitionRequestOptions = new RequestOptions(); - multiPartitionRequestOptions.setOfferThroughput(20000); - - Observable> createCollectionObservable = asyncClient.createCollection( - getDatabaseLink(), getMultiPartitionCollectionDefinition(), multiPartitionRequestOptions); - - final CountDownLatch countDownLatch = new CountDownLatch(1); - - createCollectionObservable.single() // We know there is only single result - .subscribe(collectionResourceResponse -> { - System.out.println(collectionResourceResponse.getActivityId()); - countDownLatch.countDown(); - }, error -> { - System.err.println( - "an error occurred while creating the collection: actual cause: " + error.getMessage()); - countDownLatch.countDown(); - }); - - // Wait till collection creation completes - countDownLatch.await(); - } - - /** - * Create a document Collection using async api, without java8 lambda expressions - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createCollection_Async_withoutLambda() throws Exception { - Observable> createCollectionObservable = asyncClient - .createCollection(getDatabaseLink(), collectionDefinition, null); - - final CountDownLatch countDownLatch = new CountDownLatch(1); - Action1> onCollectionCreationAction = new Action1>() { - - @Override - public void call(ResourceResponse resourceResponse) { - // Collection is created - System.out.println(resourceResponse.getActivityId()); - countDownLatch.countDown(); - } - }; - - Action1 onError = new Action1() { - @Override - public void call(Throwable error) { - System.err.println( - "an error occurred while creating the collection: actual cause: " + error.getMessage()); - countDownLatch.countDown(); - } - }; - - createCollectionObservable.single() // We know there is only a single event - .subscribe(onCollectionCreationAction, onError); - - // Wait till collection creation completes - countDownLatch.await(); - } - - /** - * Create a collection in a blocking manner - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createCollection_toBlocking() { - Observable> createCollectionObservable = asyncClient - .createCollection(getDatabaseLink(), collectionDefinition, null); - - // toBlocking() converts the observable to a blocking observable. - // single() gets the only result. - createCollectionObservable.toBlocking().single(); - } - - /** - * Attempt to create a Collection which already exists - * - First create a Collection - * - Using the async api generate an async collection creation observable - * - Converts the Observable to blocking using Observable.toBlocking() api - * - Catch already exist failure (409) - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createCollection_toBlocking_CollectionAlreadyExists_Fails() { - asyncClient.createCollection(getDatabaseLink(), collectionDefinition, null).toBlocking().single(); - - // Create the collection for test. - Observable> collectionForTestObservable = asyncClient - .createCollection(getDatabaseLink(), collectionDefinition, null); - - try { - collectionForTestObservable.toBlocking() // Blocks - .single(); // Gets the single result - assertThat("Should not reach here", false); - } catch (Exception e) { - assertThat("Collection already exists.", ((DocumentClientException) e.getCause()).getStatusCode(), - equalTo(409)); - } - } - - /** - * You can convert an Observable to a ListenableFuture. - * ListenableFuture (part of google guava library) is a popular extension - * of Java's Future which allows registering listener callbacks: - * https://github.com/google/guava/wiki/ListenableFutureExplained - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void transformObservableToGoogleGuavaListenableFuture() throws Exception { - Observable> createCollectionObservable = asyncClient - .createCollection(getDatabaseLink(), collectionDefinition, null); - ListenableFuture> future = ListenableFutureObservable - .to(createCollectionObservable); - - ResourceResponse rrd = future.get(); - - assertThat(rrd.getRequestCharge(), greaterThan((double) 0)); - System.out.println(rrd.getRequestCharge()); - } - - /** - * Read a Collection in an Async manner - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createAndReadCollection() throws Exception { - // Create a Collection - DocumentCollection documentCollection = asyncClient - .createCollection(getDatabaseLink(), collectionDefinition, null).toBlocking().single() - .getResource(); - - // Read the created collection using async api - Observable> readCollectionObservable = asyncClient - .readCollection(getCollectionLink(documentCollection), null); - - final CountDownLatch countDownLatch = new CountDownLatch(1); - - readCollectionObservable.single() // We know there is only single result - .subscribe(collectionResourceResponse -> { - System.out.println(collectionResourceResponse.getActivityId()); - countDownLatch.countDown(); - }, error -> { - System.err.println( - "an error occurred while reading the collection: actual cause: " + error.getMessage()); - countDownLatch.countDown(); - }); - - // Wait till read collection completes - countDownLatch.await(); - } - - /** - * Delete a Collection in an Async manner - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createAndDeleteCollection() throws Exception { - // Create a Collection - DocumentCollection documentCollection = asyncClient - .createCollection(getDatabaseLink(), collectionDefinition, null).toBlocking().single() - .getResource(); - - // Delete the created collection using async api - Observable> deleteCollectionObservable = asyncClient - .deleteCollection(getCollectionLink(documentCollection), null); - - final CountDownLatch countDownLatch = new CountDownLatch(1); - - deleteCollectionObservable.single() // We know there is only single result - .subscribe(collectionResourceResponse -> { - System.out.println(collectionResourceResponse.getActivityId()); - countDownLatch.countDown(); - }, error -> { - System.err.println( - "an error occurred while deleting the collection: actual cause: " + error.getMessage()); - countDownLatch.countDown(); - }); - - // Wait till collection deletion completes - countDownLatch.await(); - } - - /** - * Query a Collection in an Async manner - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void collectionCreateAndQuery() throws Exception { - // Create a Collection - DocumentCollection collection = asyncClient - .createCollection(getDatabaseLink(), collectionDefinition, null).toBlocking().single() - .getResource(); - - // Query the created collection using async api - Observable> queryCollectionObservable = asyncClient.queryCollections( - getDatabaseLink(), String.format("SELECT * FROM r where r.id = '%s'", collection.getId()), - null); - - final CountDownLatch countDownLatch = new CountDownLatch(1); - - queryCollectionObservable.toList().subscribe(collectionFeedResponseList -> { - // toList() should return a list of size 1 - assertThat(collectionFeedResponseList.size(), equalTo(1)); - - // First element of the list should have only 1 result - FeedResponse collectionFeedResponse = collectionFeedResponseList.get(0); - assertThat(collectionFeedResponse.getResults().size(), equalTo(1)); - - // This collection should have the same id as the one we created - DocumentCollection foundCollection = collectionFeedResponse.getResults().get(0); - assertThat(foundCollection.getId(), equalTo(collection.getId())); - - System.out.println(collectionFeedResponse.getActivityId()); - countDownLatch.countDown(); - }, error -> { - System.err.println("an error occurred while querying the collection: actual cause: " + error.getMessage()); - countDownLatch.countDown(); - }); - - // Wait till collection query completes - countDownLatch.await(); - } - - private String getDatabaseLink() { - return "dbs/" + createdDatabase.getId(); - } - - private String getCollectionLink(DocumentCollection collection) { - return "dbs/" + createdDatabase.getId() + "/colls/" + collection.getId(); - } - - private DocumentCollection getMultiPartitionCollectionDefinition() { - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - - // Set the partitionKeyDefinition for a partitioned collection. - // Here, we are setting the partitionKey of the Collection to be /city - PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition(); - List paths = new ArrayList<>(); - paths.add("/city"); - partitionKeyDefinition.setPaths(paths); - collectionDefinition.setPartitionKey(partitionKeyDefinition); - - // Set indexing policy to be range range for string and number - IndexingPolicy indexingPolicy = new IndexingPolicy(); - Collection includedPaths = new ArrayList<>(); - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath("/*"); - Collection indexes = new ArrayList<>(); - Index stringIndex = Index.Range(DataType.String); - stringIndex.set("precision", -1); - indexes.add(stringIndex); - - Index numberIndex = Index.Range(DataType.Number); - numberIndex.set("precision", -1); - indexes.add(numberIndex); - includedPath.setIndexes(indexes); - includedPaths.add(includedPath); - indexingPolicy.setIncludedPaths(includedPaths); - collectionDefinition.setIndexingPolicy(indexingPolicy); - - return collectionDefinition; - } -} diff --git a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/ConflictAPITest.java b/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/ConflictAPITest.java deleted file mode 100644 index 8aad1f45b8e9..000000000000 --- a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/ConflictAPITest.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.examples; - -import com.google.common.util.concurrent.ListenableFuture; -import com.microsoft.azure.cosmosdb.Conflict; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import rx.Observable; -import rx.observable.ListenableFutureObservable; - -import java.util.Iterator; -import java.util.List; -import java.util.UUID; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.hasSize; -import static org.hamcrest.Matchers.notNullValue; - -/** - * This integration test class demonstrates how to use Async API for - * Conflicts. - *

- * Also if you need to work with Future or ListenableFuture it is possible to - * transform an observable to ListenableFuture. Please see - * {@link #transformObservableToGoogleGuavaListenableFuture()} - */ -public class ConflictAPITest { - private final static int TIMEOUT = 60000; - - private AsyncDocumentClient client; - private DocumentCollection createdCollection; - private Database createdDatabase; - - @BeforeClass(groups = "samples", timeOut = TIMEOUT) - public void setUp() { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - client = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - - // Create database - createdDatabase = Utils.createDatabaseForTest(client); - - // Create collection - createdCollection = client - .createCollection("/dbs/" + createdDatabase.getId(), collectionDefinition, null) - .toBlocking().single().getResource(); - - int numberOfDocuments = 20; - // Add documents - for (int i = 0; i < numberOfDocuments; i++) { - Document doc = new Document(String.format("{ 'id': 'loc%d', 'counter': %d}", i, i)); - client.createDocument(getCollectionLink(), doc, null, true).toBlocking().single(); - } - } - - @AfterClass(groups = "samples", timeOut = TIMEOUT) - public void shutdown() { - Utils.safeClean(client, createdDatabase); - Utils.safeClose(client); - } - - /** - * Read conflicts - * Converts the conflict read feed observable to blocking observable and - * uses that to find all conflicts - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void readConflicts_toBlocking_toIterator() { - // read all conflicts - int requestPageSize = 3; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(requestPageSize); - - Observable> conflictReadFeedObservable = client - .readConflicts(getCollectionLink(), options); - - // Covert the observable to a blocking observable, then convert the blocking - // observable to an iterator - Iterator> it = conflictReadFeedObservable.toBlocking().getIterator(); - - int expectedNumberOfConflicts = 0; - - int numberOfResults = 0; - while (it.hasNext()) { - FeedResponse page = it.next(); - System.out.println("items: " + page.getResults()); - String pageSizeAsString = page.getResponseHeaders().get(HttpConstants.HttpHeaders.ITEM_COUNT); - assertThat("header item count must be present", pageSizeAsString, notNullValue()); - int pageSize = Integer.valueOf(pageSizeAsString); - assertThat("Result size must match header item count", page.getResults(), hasSize(pageSize)); - numberOfResults += pageSize; - } - assertThat("number of total results", numberOfResults, equalTo(expectedNumberOfConflicts)); - } - - /** - * You can convert an Observable to a ListenableFuture. - * ListenableFuture (part of google guava library) is a popular extension - * of Java's Future which allows registering listener callbacks: - * https://github.com/google/guava/wiki/ListenableFutureExplained - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void transformObservableToGoogleGuavaListenableFuture() throws Exception { - int requestPageSize = 3; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(requestPageSize); - - Observable> conflictReadFeedObservable = client - .readConflicts(getCollectionLink(), options); - - // Convert to observable of list of pages - Observable>> allPagesObservable = conflictReadFeedObservable.toList(); - - // Convert the observable of list of pages to a Future - ListenableFuture>> future = ListenableFutureObservable.to(allPagesObservable); - - List> pageList = future.get(); - - int totalNumberOfRetrievedConflicts = 0; - for (FeedResponse page : pageList) { - totalNumberOfRetrievedConflicts += page.getResults().size(); - } - assertThat(0, equalTo(totalNumberOfRetrievedConflicts)); - } - - private String getCollectionLink() { - return "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId(); - } -} - diff --git a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/DatabaseCRUDAsyncAPITest.java b/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/DatabaseCRUDAsyncAPITest.java deleted file mode 100644 index 1f2fdfde4b64..000000000000 --- a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/DatabaseCRUDAsyncAPITest.java +++ /dev/null @@ -1,317 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.examples; - -import com.google.common.util.concurrent.ListenableFuture; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import rx.Observable; -import rx.functions.Action1; -import rx.observable.ListenableFutureObservable; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.CountDownLatch; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.greaterThan; - -/** - * This integration test class demonstrates how to use Async API to create, - * delete, replace, and update Databases. - *

- * NOTE: you can use rxJava based async api with java8 lambda expression. Use of - * rxJava based async APIs with java8 lambda expressions is much prettier. - *

- * You can also use the async API without java8 lambda expression support. - *

- * For example - *

    - *
  • {@link #createDatabase_Async()} demonstrates how to use async api - * with java8 lambda expression. - * - *
  • {@link #createDatabase_Async_withoutLambda()} demonstrates how to - * do the same thing without lambda expression. - *
- *

- * Also if you need to work with Future or ListenableFuture it is possible to - * transform an observable to ListenableFuture. Please see - * {@link #transformObservableToGoogleGuavaListenableFuture()} - */ -public class DatabaseCRUDAsyncAPITest { - private final static int TIMEOUT = 60000; - private final List databaseIds = new ArrayList<>(); - - private AsyncDocumentClient asyncClient; - - @BeforeClass(groups = "samples", timeOut = TIMEOUT) - public void setUp() { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - asyncClient = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - } - - private Database getDatabaseDefinition() { - Database databaseDefinition = new Database(); - databaseDefinition.setId(Utils.generateDatabaseId()); - - databaseIds.add(databaseDefinition.getId()); - - return databaseDefinition; - } - - @AfterClass(groups = "samples", timeOut = TIMEOUT) - public void shutdown() { - for (String id : databaseIds) { - Utils.safeClean(asyncClient, id); - } - Utils.safeClose(asyncClient); - } - - /** - * Create a database using async api. - * This test uses java8 lambda expression. - * See testCreateDatabase_Async_withoutLambda for usage without lambda. - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createDatabase_Async() throws Exception { - Observable> createDatabaseObservable = asyncClient.createDatabase(getDatabaseDefinition(), - null); - - final CountDownLatch completionLatch = new CountDownLatch(1); - - createDatabaseObservable.single() // We know there is only single result - .subscribe(databaseResourceResponse -> { - System.out.println(databaseResourceResponse.getActivityId()); - completionLatch.countDown(); - }, error -> { - System.err.println( - "an error occurred while creating the database: actual cause: " + error.getMessage()); - completionLatch.countDown(); - }); - - // Wait till database creation completes - completionLatch.await(); - } - - /** - * Create a database using async api, without java8 lambda expressions - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createDatabase_Async_withoutLambda() throws Exception { - Observable> createDatabaseObservable = asyncClient.createDatabase(getDatabaseDefinition(), - null); - - final CountDownLatch completionLatch = new CountDownLatch(1); - Action1> onDatabaseCreationAction = new Action1>() { - - @Override - public void call(ResourceResponse resourceResponse) { - // Database is created - System.out.println(resourceResponse.getActivityId()); - completionLatch.countDown(); - } - }; - - Action1 onError = new Action1() { - @Override - public void call(Throwable error) { - System.err - .println("an error occurred while creating the database: actual cause: " + error.getMessage()); - completionLatch.countDown(); - } - }; - - createDatabaseObservable.single() // We know there is only a single event - .subscribe(onDatabaseCreationAction, onError); - - // Wait till database creation completes - completionLatch.await(); - } - - /** - * Create a database in a blocking manner - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createDatabase_toBlocking() { - Observable> createDatabaseObservable = asyncClient.createDatabase(getDatabaseDefinition(), - null); - - // toBlocking() converts to a blocking observable. - // single() gets the only result. - createDatabaseObservable.toBlocking().single(); - } - - /** - * Attempt to create a database which already exists - * - First create a database - * - Using the async api generate an async database creation observable - * - Converts the Observable to blocking using Observable.toBlocking() api - * - Catch already exist failure (409) - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createDatabase_toBlocking_DatabaseAlreadyExists_Fails() { - Database databaseDefinition = getDatabaseDefinition(); - asyncClient.createDatabase(databaseDefinition, null).toBlocking().single(); - - // Create the database for test. - Observable> databaseForTestObservable = asyncClient - .createDatabase(databaseDefinition, null); - - try { - databaseForTestObservable.toBlocking() // Blocks - .single(); // Gets the single result - assertThat("Should not reach here", false); - } catch (Exception e) { - assertThat("Database already exists.", ((DocumentClientException) e.getCause()).getStatusCode(), - equalTo(409)); - } - } - - /** - * You can convert an Observable to a ListenableFuture. - * ListenableFuture (part of google guava library) is a popular extension - * of Java's Future which allows registering listener callbacks: - * https://github.com/google/guava/wiki/ListenableFutureExplained - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void transformObservableToGoogleGuavaListenableFuture() throws Exception { - Observable> createDatabaseObservable = asyncClient.createDatabase(getDatabaseDefinition(), - null); - ListenableFuture> future = ListenableFutureObservable.to(createDatabaseObservable); - - ResourceResponse rrd = future.get(); - - assertThat(rrd.getRequestCharge(), greaterThan((double) 0)); - System.out.print(rrd.getRequestCharge()); - } - - /** - * Read a Database in an Async manner - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createAndReadDatabase() throws Exception { - // Create a database - Database database = asyncClient.createDatabase(getDatabaseDefinition(), null).toBlocking().single().getResource(); - - // Read the created database using async api - Observable> readDatabaseObservable = asyncClient.readDatabase("dbs/" + database.getId(), - null); - - final CountDownLatch completionLatch = new CountDownLatch(1); - - readDatabaseObservable.single() // We know there is only single result - .subscribe(databaseResourceResponse -> { - System.out.println(databaseResourceResponse.getActivityId()); - completionLatch.countDown(); - }, error -> { - System.err.println( - "an error occurred while reading the database: actual cause: " + error.getMessage()); - completionLatch.countDown(); - }); - - // Wait till read database completes - completionLatch.await(); - } - - /** - * Delete a Database in an Async manner - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createAndDeleteDatabase() throws Exception { - // Create a database - Database database = asyncClient.createDatabase(getDatabaseDefinition(), null).toBlocking().single().getResource(); - - // Delete the created database using async api - Observable> deleteDatabaseObservable = asyncClient - .deleteDatabase("dbs/" + database.getId(), null); - - final CountDownLatch completionLatch = new CountDownLatch(1); - - deleteDatabaseObservable.single() // We know there is only single result - .subscribe(databaseResourceResponse -> { - System.out.println(databaseResourceResponse.getActivityId()); - completionLatch.countDown(); - }, error -> { - System.err.println( - "an error occurred while deleting the database: actual cause: " + error.getMessage()); - completionLatch.countDown(); - }); - - // Wait till database deletion completes - completionLatch.await(); - } - - /** - * Query a Database in an Async manner - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void databaseCreateAndQuery() throws Exception { - // Create a database - Database databaseDefinition = getDatabaseDefinition(); - asyncClient.createDatabase(databaseDefinition, null).toBlocking().single().getResource(); - - // Query the created database using async api - Observable> queryDatabaseObservable = asyncClient - .queryDatabases(String.format("SELECT * FROM r where r.id = '%s'", databaseDefinition.getId()), null); - - final CountDownLatch completionLatch = new CountDownLatch(1); - - queryDatabaseObservable.toList().subscribe(databaseFeedResponseList -> { - // toList() should return a list of size 1 - assertThat(databaseFeedResponseList.size(), equalTo(1)); - - // First element of the list should have only 1 result - FeedResponse databaseFeedResponse = databaseFeedResponseList.get(0); - assertThat(databaseFeedResponse.getResults().size(), equalTo(1)); - - // This database should have the same id as the one we created - Database foundDatabase = databaseFeedResponse.getResults().get(0); - assertThat(foundDatabase.getId(), equalTo(databaseDefinition.getId())); - - System.out.println(databaseFeedResponse.getActivityId()); - completionLatch.countDown(); - }, error -> { - System.err.println("an error occurred while querying the database: actual cause: " + error.getMessage()); - completionLatch.countDown(); - }); - - // Wait till database query completes - completionLatch.await(); - } -} diff --git a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/DocumentCRUDAsyncAPITest.java b/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/DocumentCRUDAsyncAPITest.java deleted file mode 100644 index a9df3991e84c..000000000000 --- a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/DocumentCRUDAsyncAPITest.java +++ /dev/null @@ -1,540 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.examples; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.common.util.concurrent.ListenableFuture; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import org.apache.commons.lang3.RandomUtils; -import org.assertj.core.api.Assertions; -import org.testng.Assert; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import rx.Observable; -import rx.functions.Action1; -import rx.observable.ListenableFutureObservable; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.CountDownLatch; - -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.Matchers.hasSize; -import static org.hamcrest.Matchers.is; - -/** - * This integration test class demonstrates how to use Async API to create, - * delete, replace, and upsert Documents. If you are interested in examples for - * querying for documents please see {@link DocumentQueryAsyncAPITest} - *

- * NOTE: you can use rxJava based async api with java8 lambda expression. Use - * of rxJava based async APIs with java8 lambda expressions is much prettier. - *

- * You can also use the async API without java8 lambda expression. - *

- * For example - *

    - *
  • {@link #createDocument_Async()} demonstrates how to use async api - * with java8 lambda expression. - * - *
  • {@link #createDocument_Async_withoutLambda()} demonstrates how to do - * the same thing without lambda expression. - *
- *

- * Also if you need to work with Future or ListenableFuture it is possible to - * transform an observable to ListenableFuture. Please see - * {@link #transformObservableToGoogleGuavaListenableFuture()} - */ -public class DocumentCRUDAsyncAPITest { - private final static String PARTITION_KEY_PATH = "/mypk"; - private final static int TIMEOUT = 60000; - private AsyncDocumentClient asyncClient; - private Database createdDatabase; - private DocumentCollection createdCollection; - - @BeforeClass(groups = "samples", timeOut = TIMEOUT) - public void setUp() { - // Sets up the requirements for each test - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - asyncClient = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - - PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition(); - ArrayList partitionKeyPaths = new ArrayList(); - partitionKeyPaths.add(PARTITION_KEY_PATH); - partitionKeyDefinition.setPaths(partitionKeyPaths); - collectionDefinition.setPartitionKey(partitionKeyDefinition); - - // Create database - createdDatabase = Utils.createDatabaseForTest(asyncClient); - - // Create collection - createdCollection = asyncClient - .createCollection("dbs/" + createdDatabase.getId(), collectionDefinition, null) - .toBlocking().single().getResource(); - } - - @AfterClass(groups = "samples", timeOut = TIMEOUT) - public void shutdown() { - Utils.safeClean(asyncClient, createdDatabase); - Utils.safeClose(asyncClient); - } - - /** - * Create a document using java8 lambda expressions - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createDocument_Async() throws Exception { - Document doc = new Document(String.format("{ 'id': 'doc%s', 'counter': '%d'}", UUID.randomUUID().toString(), 1)); - Observable> createDocumentObservable = asyncClient - .createDocument(getCollectionLink(), doc, null, true); - - final CountDownLatch completionLatch = new CountDownLatch(1); - - // Subscribe to Document resource response emitted by the observable - createDocumentObservable.single() // We know there will be one response - .subscribe(documentResourceResponse -> { - System.out.println(documentResourceResponse.getActivityId()); - completionLatch.countDown(); - }, error -> { - System.err.println( - "an error occurred while creating the document: actual cause: " + error.getMessage()); - completionLatch.countDown(); - }); - - // Wait till document creation completes - completionLatch.await(); - } - - /** - * Create a document without java8 lambda expressions - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createDocument_Async_withoutLambda() throws Exception { - Document doc = new Document(String.format("{ 'id': 'doc%s', 'counter': '%d'}", UUID.randomUUID().toString(), 1)); - Observable> createDocumentObservable = asyncClient - .createDocument(getCollectionLink(), doc, null, true); - - final CountDownLatch completionLatch = new CountDownLatch(1); - - Action1> onNext = new Action1>() { - - @Override - public void call(ResourceResponse documentResourceResponse) { - System.out.println(documentResourceResponse.getActivityId()); - completionLatch.countDown(); - } - }; - - Action1 onError = new Action1() { - - public void call(Throwable error) { - System.err - .println("an error occurred while creating the document: actual cause: " + error.getMessage()); - completionLatch.countDown(); - } - }; - - // Subscribe to Document resource response emitted by the observable - createDocumentObservable.single() // We know there will be one response - .subscribe(onNext, onError); - - // Wait till document creation completes - completionLatch.await(); - } - - /** - * Create a document in a blocking manner - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createDocument_toBlocking() { - Document doc = new Document(String.format("{ 'id': 'doc%s', 'counter': '%d'}", UUID.randomUUID().toString(), 1)); - Observable> createDocumentObservable = asyncClient - .createDocument(getCollectionLink(), doc, null, true); - - // toBlocking() converts to a blocking observable. - // single() gets the only result. - createDocumentObservable.toBlocking().single(); - } - - /** - * Create a document with a programmatically set definition, in an Async manner - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createDocumentWithProgrammableDocumentDefinition() throws Exception { - Document documentDefinition = new Document(); - documentDefinition.setId("test-document"); - documentDefinition.set("counter", 1); - - // Create a document - Document createdDocument = asyncClient - .createDocument(getCollectionLink(), documentDefinition, null, false).toBlocking().single() - .getResource(); - - // Read the created document - Observable> readDocumentObservable = asyncClient - .readDocument(getDocumentLink(createdDocument), null); - - final CountDownLatch completionLatch = new CountDownLatch(1); - - readDocumentObservable.subscribe(documentResourceResponse -> { - Document readDocument = documentResourceResponse.getResource(); - - // The read document must be the same as the written document - assertThat(readDocument.getId(), equalTo("test-document")); - assertThat(readDocument.getInt("counter"), equalTo(1)); - System.out.println(documentResourceResponse.getActivityId()); - completionLatch.countDown(); - }, error -> { - System.err.println("an error occured while creating the document: actual cause: " + error.getMessage()); - completionLatch.countDown(); - }); - - completionLatch.await(); - } - - /** - * Create 10 documents and sum up all the documents creation request charges - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void documentCreation_SumUpRequestCharge() throws Exception { - // Create 10 documents - List>> listOfCreateDocumentObservables = new ArrayList<>(); - for (int i = 0; i < 10; i++) { - Document doc = new Document(String.format("{ 'id': 'doc%s', 'counter': '%d'}", UUID.randomUUID().toString(), i)); - - Observable> createDocumentObservable = asyncClient - .createDocument(getCollectionLink(), doc, null, false); - listOfCreateDocumentObservables.add(createDocumentObservable); - } - - // Merge all document creation observables into one observable - Observable> mergedObservable = Observable.merge(listOfCreateDocumentObservables); - - // Create a new observable emitting the total charge of creating all 10 - // documents. - Observable totalChargeObservable = mergedObservable - .map(ResourceResponse::getRequestCharge) - // Map to request charge - .reduce((totalCharge, charge) -> totalCharge + charge); - // Sum up all the charges - - final CountDownLatch completionLatch = new CountDownLatch(1); - - // Subscribe to the total request charge observable - totalChargeObservable.subscribe(totalCharge -> { - // Print the total charge - System.out.println(totalCharge); - completionLatch.countDown(); - }, e -> completionLatch.countDown() - ); - - completionLatch.await(); - } - - /** - * Attempt to create a document which already exists - * - First create a document - * - Using the async api generate an async document creation observable - * - Converts the Observable to blocking using Observable.toBlocking() api - * - Catch already exist failure (409) - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createDocument_toBlocking_DocumentAlreadyExists_Fails() { - Document doc = new Document(String.format("{ 'id': 'doc%s', 'counter': '%d'}", UUID.randomUUID().toString(), 1)); - asyncClient.createDocument(getCollectionLink(), doc, null, false).toBlocking().single(); - - // Create the document - Observable> createDocumentObservable = asyncClient - .createDocument(getCollectionLink(), doc, null, false); - - try { - createDocumentObservable.toBlocking() // Converts the observable to a blocking observable - .single(); // Gets the single result - Assert.fail("Document Already Exists. Document Creation must fail"); - } catch (Exception e) { - assertThat("Document already exists.", ((DocumentClientException) e.getCause()).getStatusCode(), - equalTo(409)); - } - } - - /** - * Attempt to create a document which already exists - * - First create a document - * - Using the async api generate an async document creation observable - * - Converts the Observable to blocking using Observable.toBlocking() api - * - Catch already exist failure (409) - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void createDocument_Async_DocumentAlreadyExists_Fails() throws Exception { - Document doc = new Document(String.format("{ 'id': 'doc%s', 'counter': '%d'}", UUID.randomUUID().toString(), 1)); - asyncClient.createDocument(getCollectionLink(), doc, null, false).toBlocking().single(); - - // Create the document - Observable> createDocumentObservable = asyncClient - .createDocument(getCollectionLink(), doc, null, false); - - List errorList = Collections.synchronizedList(new ArrayList<>()); - - createDocumentObservable.subscribe(resourceResponse -> { - }, error -> { - errorList.add(error); - System.err.println("failed to create a document due to: " + error.getMessage()); - }); - - Thread.sleep(2000); - assertThat(errorList, hasSize(1)); - assertThat(errorList.get(0), is(instanceOf(DocumentClientException.class))); - assertThat(((DocumentClientException) errorList.get(0)).getStatusCode(), equalTo(409)); - } - - /** - * Replace a document - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void documentReplace_Async() throws Exception { - // Create a document - Document createdDocument = new Document(String.format("{ 'id': 'doc%s', 'counter': '%d'}", UUID.randomUUID().toString(), 1)); - createdDocument = asyncClient.createDocument(getCollectionLink(), createdDocument, null, false).toBlocking() - .single().getResource(); - - // Try to replace the existing document - Document replacingDocument = new Document( - String.format("{ 'id': 'doc%s', 'counter': '%d', 'new-prop' : '2'}", createdDocument.getId(), 1)); - Observable> replaceDocumentObservable = asyncClient - .replaceDocument(getDocumentLink(createdDocument), replacingDocument, null); - - List> capturedResponse = Collections - .synchronizedList(new ArrayList<>()); - - replaceDocumentObservable.subscribe(resourceResponse -> { - capturedResponse.add(resourceResponse); - }); - - Thread.sleep(2000); - - assertThat(capturedResponse, hasSize(1)); - assertThat(capturedResponse.get(0).getResource().get("new-prop"), equalTo("2")); - } - - /** - * Upsert a document - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void documentUpsert_Async() throws Exception { - // Create a document - Document doc = new Document(String.format("{ 'id': 'doc%s', 'counter': '%d'}", UUID.randomUUID().toString(), 1)); - asyncClient.createDocument(getCollectionLink(), doc, null, false).toBlocking().single(); - - // Upsert the existing document - Document upsertingDocument = new Document( - String.format("{ 'id': 'doc%s', 'counter': '%d', 'new-prop' : '2'}", doc.getId(), 1)); - Observable> upsertDocumentObservable = asyncClient - .upsertDocument(getCollectionLink(), upsertingDocument, null, false); - - List> capturedResponse = Collections - .synchronizedList(new ArrayList<>()); - - upsertDocumentObservable.subscribe(resourceResponse -> { - capturedResponse.add(resourceResponse); - }); - - Thread.sleep(4000); - - assertThat(capturedResponse, hasSize(1)); - assertThat(capturedResponse.get(0).getResource().get("new-prop"), equalTo("2")); - } - - /** - * Delete a document - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void documentDelete_Async() throws Exception { - // Create a document - Document createdDocument = new Document(String.format("{ 'id': 'doc%s', 'counter': '%d', 'mypk' : '%s'}", UUID.randomUUID().toString(), 1, UUID.randomUUID().toString())); - createdDocument = asyncClient.createDocument(getCollectionLink(), createdDocument, null, false).toBlocking() - .single().getResource(); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(createdDocument.getString("mypk"))); - - // Delete the existing document - Observable> deleteDocumentObservable = asyncClient - .deleteDocument(getDocumentLink(createdDocument), options); - - List> capturedResponse = Collections - .synchronizedList(new ArrayList<>()); - - deleteDocumentObservable.subscribe(resourceResponse -> { - capturedResponse.add(resourceResponse); - }); - - Thread.sleep(2000); - - assertThat(capturedResponse, hasSize(1)); - - // Assert document is deleted - FeedOptions queryOptions = new FeedOptions(); - queryOptions.setEnableCrossPartitionQuery(true); - List listOfDocuments = asyncClient - .queryDocuments(getCollectionLink(), String.format("SELECT * FROM r where r.id = '%s'", createdDocument.getId()), queryOptions) - .map(FeedResponse::getResults) // Map page to its list of documents - .concatMap(Observable::from) // Flatten the observable - .toList() // Transform to a observable - .toBlocking() // Block - .single(); // Gets the List - - // Assert that there is no document found - assertThat(listOfDocuments, hasSize(0)); - } - - /** - * Read a document - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void documentRead_Async() throws Exception { - // Create a document - Document createdDocument = new Document(String.format("{ 'id': 'doc%s', 'counter': '%d', 'mypk' : '%s'}", UUID.randomUUID().toString(), 1, UUID.randomUUID().toString())); - createdDocument = asyncClient.createDocument(getCollectionLink(), createdDocument, null, false).toBlocking() - .single().getResource(); - - // Read the document - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(createdDocument.getString("mypk"))); - Observable> readDocumentObservable = asyncClient - .readDocument(getDocumentLink(createdDocument), options); - - List> capturedResponse = Collections - .synchronizedList(new ArrayList<>()); - - readDocumentObservable.subscribe(resourceResponse -> { - capturedResponse.add(resourceResponse); - }); - - Thread.sleep(2000); - - // Assert document is retrieved - assertThat(capturedResponse, hasSize(1)); - } - - private static class TestObject { - @JsonProperty("mypk") - private String mypk; - - @JsonProperty("id") - private String id; - - @JsonProperty("prop") - private String prop; - } - - @Test(groups = {"samples"}, timeOut = TIMEOUT) - public void customSerialization() throws Exception { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - mapper.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true); - - TestObject testObject = new TestObject(); - testObject.id = UUID.randomUUID().toString(); - testObject.mypk = UUID.randomUUID().toString(); - testObject.prop = UUID.randomUUID().toString(); - String itemAsJsonString = mapper.writeValueAsString(testObject); - Document doc = new Document(itemAsJsonString); - - Document createdDocument = asyncClient - .createDocument(getCollectionLink(), doc, null, false) - .toBlocking() - .single() - .getResource(); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(testObject.mypk)); - - Document readDocument = asyncClient - .readDocument(createdDocument.getSelfLink(), options) - .toBlocking() - .single() - .getResource(); - - TestObject readObject = mapper.readValue(readDocument.toJson(), TestObject.class); - assertThat(readObject.prop, equalTo(testObject.prop)); - } - - /** - * You can convert an Observable to a ListenableFuture. - * ListenableFuture (part of google guava library) is a popular extension - * of Java's Future which allows registering listener callbacks: - * https://github.com/google/guava/wiki/ListenableFutureExplained - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void transformObservableToGoogleGuavaListenableFuture() throws Exception { - Document doc = new Document(String.format("{ 'id': 'doc%d', 'counter': '%d'}", RandomUtils.nextInt(), 1)); - Observable> createDocumentObservable = asyncClient - .createDocument(getCollectionLink(), doc, null, false); - ListenableFuture> listenableFuture = ListenableFutureObservable - .to(createDocumentObservable); - - ResourceResponse rrd = listenableFuture.get(); - - assertThat(rrd.getRequestCharge(), greaterThan((double) 0)); - System.out.print(rrd.getRequestCharge()); - } - - private String getCollectionLink() { - return "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId(); - } - - private String getDocumentLink(Document createdDocument) { - return "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId() + "/docs/" + createdDocument.getId(); - } -} diff --git a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/DocumentQueryAsyncAPITest.java b/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/DocumentQueryAsyncAPITest.java deleted file mode 100644 index 35d652c3efdf..000000000000 --- a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/DocumentQueryAsyncAPITest.java +++ /dev/null @@ -1,491 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.examples; - -import com.google.common.util.concurrent.ListenableFuture; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.SqlParameterCollection; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import org.apache.commons.lang3.RandomStringUtils; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import rx.Observable; -import rx.Subscriber; -import rx.functions.Action1; -import rx.functions.Func1; -import rx.observable.ListenableFutureObservable; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.atomic.AtomicInteger; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.hasSize; -import static org.hamcrest.Matchers.notNullValue; - -/** - * This integration test class demonstrates how to use Async API to query for - * Documents. - *

- * NOTE: you can use rxJava based async api with java8 lambda expression. Use - * of rxJava based async APIs with java8 lambda expressions is much prettier. - *

- * You can also use the async API without java8 lambda expression. - *

- * For example - *

    - *
  • {@link #queryDocuments_Async()} demonstrates how to use async api - * with java8 lambda expression. - * - *
  • {@link #queryDocuments_Async_withoutLambda()} demonstrates how to do - * the same thing without lambda expression. - *
- *

- * Also if you need to work with Future or ListenableFuture it is possible to - * transform an observable to ListenableFuture. Please see - * {@link #transformObservableToGoogleGuavaListenableFuture()} - */ -public class DocumentQueryAsyncAPITest { - private final static int TIMEOUT = 60000; - private AsyncDocumentClient asyncClient; - private DocumentCollection createdCollection; - private Database createdDatabase; - private int numberOfDocuments; - - @BeforeClass(groups = "samples", timeOut = TIMEOUT) - public void setUp() { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - asyncClient = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - - // Create database - - createdDatabase = Utils.createDatabaseForTest(asyncClient); - - // Create collection - createdCollection = asyncClient - .createCollection("dbs/" + createdDatabase.getId(), collectionDefinition, null) - .toBlocking().single().getResource(); - - numberOfDocuments = 20; - // Add documents - for (int i = 0; i < numberOfDocuments; i++) { - Document doc = new Document(String.format("{ 'id': 'loc%d', 'counter': %d}", i, i)); - asyncClient.createDocument(getCollectionLink(), doc, null, true).toBlocking().single(); - } - } - - @AfterClass(groups = "samples", timeOut = TIMEOUT) - public void shutdown() { - Utils.safeClean(asyncClient, createdDatabase); - Utils.safeClose(asyncClient); - } - - /** - * Query for documents using java8 lambda expressions - * Creates a document query observable and verifies the async behavior - * of document query observable - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void queryDocuments_Async() throws Exception { - int requestPageSize = 3; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(requestPageSize); - - Observable> documentQueryObservable = asyncClient - .queryDocuments(getCollectionLink(), "SELECT * FROM root", options); - - final CountDownLatch mainThreadBarrier = new CountDownLatch(1); - - final CountDownLatch resultsCountDown = new CountDownLatch(numberOfDocuments); - - // forEach(.) is an alias for subscribe(.) - documentQueryObservable.forEach(page -> { - try { - // Waits on the barrier - mainThreadBarrier.await(); - } catch (InterruptedException e) { - } - - for (@SuppressWarnings("unused") - Document d : page.getResults()) { - resultsCountDown.countDown(); - } - }); - - // The following code will run concurrently - System.out.println("action is subscribed to the observable"); - - // Release main thread barrier - System.out.println("after main thread barrier is released, subscribed observable action can continue"); - mainThreadBarrier.countDown(); - - System.out.println("waiting for all the results using result count down latch"); - - resultsCountDown.await(); - } - - /** - * Query for documents, without using java8 lambda expressions - * Creates a document query observable and verifies the async behavior - * of document query observable - * NOTE: does the same thing as testQueryDocuments_Async without java8 lambda - * expression - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void queryDocuments_Async_withoutLambda() throws Exception { - int requestPageSize = 3; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(requestPageSize); - - Observable> documentQueryObservable = asyncClient - .queryDocuments(getCollectionLink(), "SELECT * FROM root", options); - - final CountDownLatch mainThreadBarrier = new CountDownLatch(1); - - final CountDownLatch resultsCountDown = new CountDownLatch(numberOfDocuments); - - Action1> actionPerPage = new Action1>() { - - @SuppressWarnings("unused") - @Override - public void call(FeedResponse t) { - - try { - // waits on the barrier - mainThreadBarrier.await(); - } catch (InterruptedException e) { - } - - for (Document d : t.getResults()) { - resultsCountDown.countDown(); - } - } - }; - - // forEach(.) is an alias for subscribe(.) - documentQueryObservable.forEach(actionPerPage); - // The following code will run concurrently - - System.out.println("action is subscribed to the observable"); - - // Release main thread barrier - System.out.println("after main thread barrier is released, subscribed observable action can continue"); - mainThreadBarrier.countDown(); - - System.out.println("waiting for all the results using result count down latch"); - - resultsCountDown.await(); - } - - /** - * Queries for documents and sum up the total request charge - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void queryDocuments_findTotalRequestCharge() throws Exception { - int requestPageSize = 3; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(requestPageSize); - - Observable totalChargeObservable = asyncClient - .queryDocuments(getCollectionLink(), "SELECT * FROM root", options) - .map(FeedResponse::getRequestCharge) // Map the page to its request charge - .reduce((totalCharge, charge) -> totalCharge + charge); // Sum up all the request charges - - final CountDownLatch successfulCompletionLatch = new CountDownLatch(1); - - // subscribe(.) is the same as forEach(.) - totalChargeObservable.subscribe(totalCharge -> { - System.out.println(totalCharge); - successfulCompletionLatch.countDown(); - }); - - successfulCompletionLatch.await(); - } - - /** - * Subscriber unsubscribes after first page - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void queryDocuments_unsubscribeAfterFirstPage() throws Exception { - int requestPageSize = 3; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(requestPageSize); - - Observable> requestChargeObservable = asyncClient - .queryDocuments(getCollectionLink(), "SELECT * FROM root", options); - - AtomicInteger onNextCounter = new AtomicInteger(); - AtomicInteger onCompletedCounter = new AtomicInteger(); - AtomicInteger onErrorCounter = new AtomicInteger(); - - // Subscribe to the pages of Documents emitted by the observable - requestChargeObservable.subscribe(new Subscriber>() { - - @Override - public void onCompleted() { - onCompletedCounter.incrementAndGet(); - } - - @Override - public void onError(Throwable e) { - onErrorCounter.incrementAndGet(); - } - - @Override - public void onNext(FeedResponse page) { - onNextCounter.incrementAndGet(); - unsubscribe(); - } - }); - - Thread.sleep(4000); - - // After subscriber unsubscribes, it doesn't receive any more pages. - assertThat(onNextCounter.get(), equalTo(1)); - assertThat(onCompletedCounter.get(), equalTo(0)); - assertThat(onErrorCounter.get(), equalTo(0)); - } - - /** - * Queries for documents and filter out the fetched results - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void queryDocuments_filterFetchedResults() throws Exception { - int requestPageSize = 3; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(requestPageSize); - - Func1 isPrimeNumber = new Func1() { - - @Override - public Boolean call(Document doc) { - int n = doc.getInt("counter"); - if (n <= 1) - return false; - for (int i = 2; 2 * i < n; i++) { - if (n % i == 0) - return false; - } - return true; - } - }; - - List resultList = Collections.synchronizedList(new ArrayList()); - - asyncClient.queryDocuments(getCollectionLink(), "SELECT * FROM root", options) - .map(FeedResponse::getResults) // Map the page to the list of documents - .concatMap(Observable::from) // Flatten the observable> to observable - .filter(isPrimeNumber) // Filter documents using isPrimeNumber predicate - .subscribe(doc -> resultList.add(doc)); // Collect the results - - Thread.sleep(4000); - - int expectedNumberOfPrimes = 0; - // Find all the documents with prime number counter - for (int i = 0; i < numberOfDocuments; i++) { - boolean isPrime = true; - if (i <= 1) - isPrime = false; - for (int j = 2; 2 * j < i; j++) { - if (i % j == 0) { - isPrime = false; - break; - } - } - - if (isPrime) { - expectedNumberOfPrimes++; - } - } - - // Assert that we only collected what's expected - assertThat(resultList, hasSize(expectedNumberOfPrimes)); - } - - /** - * Queries for documents - * Converts the document query observable to blocking observable and - * uses that to find all documents - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void queryDocuments_toBlocking_toIterator() { - // Query for documents - int requestPageSize = 3; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(requestPageSize); - - Observable> documentQueryObservable = asyncClient - .queryDocuments(getCollectionLink(), "SELECT * FROM root", options); - - // Covert the observable to a blocking observable, then convert the blocking - // observable to an iterator - Iterator> it = documentQueryObservable.toBlocking().getIterator(); - - int pageCounter = 0; - int numberOfResults = 0; - while (it.hasNext()) { - FeedResponse page = it.next(); - pageCounter++; - - String pageSizeAsString = page.getResponseHeaders().get(HttpConstants.HttpHeaders.ITEM_COUNT); - assertThat("header item count must be present", pageSizeAsString, notNullValue()); - int pageSize = Integer.valueOf(pageSizeAsString); - assertThat("Result size must match header item count", page.getResults(), hasSize(pageSize)); - numberOfResults += pageSize; - } - assertThat("number of total results", numberOfResults, equalTo(numberOfDocuments)); - assertThat("number of result pages", pageCounter, - equalTo((numberOfDocuments + requestPageSize - 1) / requestPageSize)); - } - - /** - * Queries for documents using an Orderby query. - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void qrderBy_Async() throws Exception { - // Create a partitioned collection - String collectionId = UUID.randomUUID().toString(); - DocumentCollection multiPartitionCollection = createMultiPartitionCollection("dbs/" + createdDatabase.getId(), - collectionId, "/key"); - - // Insert documents - int totalNumberOfDocumentsInMultiPartitionCollection = 10; - for (int i = 0; i < totalNumberOfDocumentsInMultiPartitionCollection; i++) { - - Document doc = new Document(String.format("{\"id\":\"documentId%d\",\"key\":\"%s\",\"prop\":%d}", i, - RandomStringUtils.randomAlphabetic(2), i)); - asyncClient.createDocument("dbs/" + createdDatabase.getId() + "/colls/" + multiPartitionCollection.getId(), - doc, null, true).toBlocking().single(); - } - - // Query for the documents order by the prop field - SqlQuerySpec query = new SqlQuerySpec("SELECT r.id FROM r ORDER BY r.prop", new SqlParameterCollection()); - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - options.setMaxItemCount(5); - - // Max degree of parallelism determines the number of partitions that - // the SDK establishes simultaneous connections to. - options.setMaxDegreeOfParallelism(2); - - // Get the observable order by query documents - Observable> documentQueryObservable = asyncClient.queryDocuments( - "dbs/" + createdDatabase.getId() + "/colls/" + multiPartitionCollection.getId(), query, options); - - List resultList = Collections.synchronizedList(new ArrayList<>()); - - documentQueryObservable.map(FeedResponse::getResults) - // Map the logical page to the list of documents in the page - .concatMap(Observable::from) // Flatten the list of documents - .map(doc -> doc.getId()) // Map to the document Id - .forEach(docId -> resultList.add(docId)); // Add each document Id to the resultList - - Thread.sleep(4000); - - // Assert we found all the results - assertThat(resultList, hasSize(totalNumberOfDocumentsInMultiPartitionCollection)); - for (int i = 0; i < totalNumberOfDocumentsInMultiPartitionCollection; i++) { - String docId = resultList.get(i); - // Assert that the order of the documents are valid - assertThat(docId, equalTo("documentId" + i)); - } - } - - /** - * You can convert an Observable to a ListenableFuture. - * ListenableFuture (part of google guava library) is a popular extension - * of Java's Future which allows registering listener callbacks: - * https://github.com/google/guava/wiki/ListenableFutureExplained - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void transformObservableToGoogleGuavaListenableFuture() throws Exception { - int requestPageSize = 3; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(requestPageSize); - - Observable> documentQueryObservable = asyncClient - .queryDocuments(getCollectionLink(), "SELECT * FROM root", options); - - // Convert to observable of list of pages - Observable>> allPagesObservable = documentQueryObservable.toList(); - - // Convert the observable of list of pages to a Future - ListenableFuture>> future = ListenableFutureObservable.to(allPagesObservable); - - List> pageList = future.get(); - - int totalNumberOfRetrievedDocuments = 0; - for (FeedResponse page : pageList) { - totalNumberOfRetrievedDocuments += page.getResults().size(); - } - assertThat(numberOfDocuments, equalTo(totalNumberOfRetrievedDocuments)); - } - - private String getCollectionLink() { - return "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId(); - } - - private DocumentCollection createMultiPartitionCollection(String databaseLink, String collectionId, - String partitionKeyPath) { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); - paths.add(partitionKeyPath); - partitionKeyDef.setPaths(paths); - - RequestOptions options = new RequestOptions(); - options.setOfferThroughput(10100); - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(collectionId); - collectionDefinition.setPartitionKey(partitionKeyDef); - DocumentCollection createdCollection = asyncClient.createCollection(databaseLink, collectionDefinition, options) - .toBlocking().single().getResource(); - - return createdCollection; - } -} diff --git a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/InMemoryGroupbyTest.java b/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/InMemoryGroupbyTest.java deleted file mode 100644 index baeac40b2a02..000000000000 --- a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/InMemoryGroupbyTest.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.examples; - -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.SqlParameter; -import com.microsoft.azure.cosmosdb.SqlParameterCollection; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import rx.Observable; -import rx.observables.GroupedObservable; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.UUID; - -public class InMemoryGroupbyTest { - private final static int TIMEOUT = 60000; - - private static AsyncDocumentClient asyncClient; - private static Database createdDatabase; - private static DocumentCollection createdCollection; - - @BeforeClass(groups = "samples", timeOut = TIMEOUT) - public static void setUp() throws Exception { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - asyncClient = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - - // Create database - createdDatabase = Utils.createDatabaseForTest(asyncClient); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - - // Create collection - createdCollection = asyncClient - .createCollection("dbs/" + createdDatabase.getId(), collectionDefinition, null) - .toBlocking().single().getResource(); - - int numberOfPayers = 10; - int numberOfDocumentsPerPayer = 10; - - for (int i = 0; i < numberOfPayers; i++) { - - for (int j = 0; j < numberOfDocumentsPerPayer; j++) { - - LocalDateTime currentTime = LocalDateTime.now(); - - Document doc = new Document(String.format("{ " - + "'id' : '%s'," - + "'site_id': 'ABC', " - + "'payer_id': %d, " - + " 'created_time' : %d " - + "}", UUID.randomUUID().toString(), i, currentTime.getSecond())); - asyncClient.createDocument(getCollectionLink(), doc, null, true).toBlocking().single(); - - Thread.sleep(100); - } - } - System.out.println("finished inserting documents"); - } - - @AfterClass(groups = "samples", timeOut = TIMEOUT) - public static void shutdown() { - Utils.safeClean(asyncClient, createdDatabase); - asyncClient.close(); - } - - /** - * Queries Documents and performs Group by operation after fetching the Documents. - * If you want to understand the steps in more details see {@link #groupByInMemory_MoreDetail()} - * @throws Exception - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void groupByInMemory() { - // If you want to understand the steps in more details see groupByInMemoryMoreDetail() - int requestPageSize = 3; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(requestPageSize); - - Observable documentsObservable = asyncClient - .queryDocuments(getCollectionLink(), - new SqlQuerySpec("SELECT * FROM root r WHERE r.site_id=@site_id", - new SqlParameterCollection(new SqlParameter("@site_id", "ABC"))), - options) - .flatMap(page -> Observable.from(page.getResults())); - - final LocalDateTime now = LocalDateTime.now(); - - List> resultsGroupedAsLists = documentsObservable - .filter(doc -> Math.abs(now.getSecond() - doc.getInt("created_time")) <= 90) - .groupBy(doc -> doc.getInt("payer_id")).flatMap(grouped -> grouped.toList()) - .toList() - .toBlocking() - .single(); - - for(List resultsForEachPayer :resultsGroupedAsLists) { - System.out.println("documents with payer_id : " + resultsForEachPayer.get(0).getInt("payer_id") + " are " + resultsForEachPayer); - } - } - - /** - * This does the same thing as {@link #groupByInMemory_MoreDetail()} but with pedagogical details - * @throws Exception - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void groupByInMemory_MoreDetail() { - - int requestPageSize = 3; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(requestPageSize); - - - Observable documentsObservable = asyncClient - .queryDocuments(getCollectionLink(), - new SqlQuerySpec("SELECT * FROM root r WHERE r.site_id=@site_id", - new SqlParameterCollection(new SqlParameter("@site_id", "ABC"))), - options) - .flatMap(page -> Observable.from(page.getResults())); - - final LocalDateTime now = LocalDateTime.now(); - - Observable> groupedByPayerIdObservable = documentsObservable - .filter(doc -> Math.abs(now.getSecond() - doc.getInt("created_time")) <= 90) - .groupBy(doc -> doc.getInt("payer_id")); - - Observable> docsGroupedAsList = groupedByPayerIdObservable.flatMap(grouped -> { - Observable> list = grouped.toList(); - return list; - }); - - List> resultsGroupedAsLists = docsGroupedAsList.toList().toBlocking().single(); - - for(List resultsForEachPayer : resultsGroupedAsLists) { - System.out.println("documents with payer_id : " + resultsForEachPayer.get(0).getInt("payer_id") + " are " + resultsForEachPayer); - } - } - - private static String getCollectionLink() { - return "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId(); - } -} diff --git a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/OfferCRUDAsyncAPITest.java b/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/OfferCRUDAsyncAPITest.java deleted file mode 100644 index f64d4ec20fc3..000000000000 --- a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/OfferCRUDAsyncAPITest.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2017 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.examples; - -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DataType; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.IncludedPath; -import com.microsoft.azure.cosmosdb.Index; -import com.microsoft.azure.cosmosdb.IndexingPolicy; -import com.microsoft.azure.cosmosdb.Offer; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.CountDownLatch; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.MatcherAssert.assertThat; - -/** - * This integration test class demonstrates how to use Async API to query and - * replace an Offer. - */ -public class OfferCRUDAsyncAPITest { - private final static int TIMEOUT = 60000; - private Database createdDatabase; - private AsyncDocumentClient asyncClient; - - @BeforeClass(groups = "samples", timeOut = TIMEOUT) - public void setUp() { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - asyncClient = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - - // Create database - createdDatabase = Utils.createDatabaseForTest(asyncClient); - } - - @AfterClass(groups = "samples", timeOut = TIMEOUT) - public void shutdown() { - Utils.safeClean(asyncClient, createdDatabase); - Utils.safeClose(asyncClient); - } - - /** - * Query for all the offers existing in the database account. - * Replace the required offer so that it has a higher throughput. - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void updateOffer() throws Exception { - - int initialThroughput = 10200; - int newThroughput = 10300; - - // Set the throughput to be 10,200 - RequestOptions multiPartitionRequestOptions = new RequestOptions(); - multiPartitionRequestOptions.setOfferThroughput(initialThroughput); - - // Create the collection - DocumentCollection createdCollection = asyncClient.createCollection("dbs/" + createdDatabase.getId(), - getMultiPartitionCollectionDefinition(), multiPartitionRequestOptions).toBlocking().single() - .getResource(); - - final CountDownLatch successfulCompletionLatch = new CountDownLatch(1); - - // Find offer associated with this collection - asyncClient.queryOffers( - String.format("SELECT * FROM r where r.offerResourceId = '%s'", createdCollection.getResourceId()), - null).flatMap(offerFeedResponse -> { - List offerList = offerFeedResponse.getResults(); - // Number of offers returned should be 1 - assertThat(offerList.size(), equalTo(1)); - - // This offer must correspond to the collection we created - Offer offer = offerList.get(0); - int currentThroughput = offer.getThroughput(); - assertThat(offer.getString("offerResourceId"), equalTo(createdCollection.getResourceId())); - assertThat(currentThroughput, equalTo(initialThroughput)); - System.out.println("initial throughput: " + currentThroughput); - - // Update the offer's throughput - offer.setThroughput(newThroughput); - - // Replace the offer - return asyncClient.replaceOffer(offer); - }).subscribe(offerResourceResponse -> { - Offer offer = offerResourceResponse.getResource(); - int currentThroughput = offer.getThroughput(); - - // The current throughput of the offer must be equal to the new throughput value - assertThat(offer.getString("offerResourceId"), equalTo(createdCollection.getResourceId())); - assertThat(currentThroughput, equalTo(newThroughput)); - - System.out.println("updated throughput: " + currentThroughput); - successfulCompletionLatch.countDown(); - }, error -> { - System.err - .println("an error occurred while updating the offer: actual cause: " + error.getMessage()); - }); - - successfulCompletionLatch.await(); - } - - private DocumentCollection getMultiPartitionCollectionDefinition() { - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - - // Set the partitionKeyDefinition for a partitioned collection - // Here, we are setting the partitionKey of the Collection to be /city - PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition(); - List paths = new ArrayList<>(); - paths.add("/city"); - partitionKeyDefinition.setPaths(paths); - collectionDefinition.setPartitionKey(partitionKeyDefinition); - - // Set indexing policy to be range range for string and number - IndexingPolicy indexingPolicy = new IndexingPolicy(); - Collection includedPaths = new ArrayList<>(); - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath("/*"); - Collection indexes = new ArrayList<>(); - Index stringIndex = Index.Range(DataType.String); - stringIndex.set("precision", -1); - indexes.add(stringIndex); - - Index numberIndex = Index.Range(DataType.Number); - numberIndex.set("precision", -1); - indexes.add(numberIndex); - includedPath.setIndexes(indexes); - includedPaths.add(includedPath); - indexingPolicy.setIncludedPaths(includedPaths); - collectionDefinition.setIndexingPolicy(indexingPolicy); - - return collectionDefinition; - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/StoredProcedureAsyncAPITest.java b/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/StoredProcedureAsyncAPITest.java deleted file mode 100644 index aa06bf501397..000000000000 --- a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/StoredProcedureAsyncAPITest.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2017 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.examples; - -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DataType; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.IncludedPath; -import com.microsoft.azure.cosmosdb.Index; -import com.microsoft.azure.cosmosdb.IndexingPolicy; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.StoredProcedure; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.CountDownLatch; - -import javax.net.ssl.SSLException; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.core.Is.is; - -/** - * This integration test class demonstrates how to use Async API to create - * and execute Stored Procedures. - */ -public class StoredProcedureAsyncAPITest { - private final static int TIMEOUT = 60000; - - private Database createdDatabase; - private DocumentCollection createdCollection; - private AsyncDocumentClient asyncClient; - - @BeforeClass(groups = "samples", timeOut = TIMEOUT) - public void setUp() { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - asyncClient = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - - createdDatabase = Utils.createDatabaseForTest(asyncClient); - - createdCollection = asyncClient - .createCollection("dbs/" + createdDatabase.getId(), getMultiPartitionCollectionDefinition(), null) - .toBlocking().single().getResource(); - } - - @AfterClass(groups = "samples", timeOut = TIMEOUT) - public void shutdown() { - Utils.safeClean(asyncClient, createdDatabase); - Utils.safeClose(asyncClient); - } - - /** - * Execute Stored Procedure and retrieve the Script Log - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void scriptConsoleLogEnabled() throws Exception { - // Create a stored procedure - StoredProcedure storedProcedure = new StoredProcedure( - "{" + - " 'id':'storedProcedureSample'," + - " 'body':" + - " 'function() {" + - " var mytext = \"x\";" + - " var myval = 1;" + - " try {" + - " console.log(\"The value of %s is %s.\", mytext, myval);" + - " getContext().getResponse().setBody(\"Success!\");" + - " }" + - " catch(err) {" + - " getContext().getResponse().setBody(\"inline err: [\" + err.number + \"] \" + err);" + - " }" + - " }'" + - "}"); - - storedProcedure = asyncClient.createStoredProcedure(getCollectionLink(), storedProcedure, null) - .toBlocking().single().getResource(); - - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setScriptLoggingEnabled(true); - requestOptions.setPartitionKey(new PartitionKey("Seattle")); - - final CountDownLatch successfulCompletionLatch = new CountDownLatch(1); - - // Execute the stored procedure - asyncClient.executeStoredProcedure(getSprocLink(storedProcedure), requestOptions, new Object[]{}) - .subscribe(storedProcedureResponse -> { - String logResult = "The value of x is 1."; - try { - assertThat(URLDecoder.decode(storedProcedureResponse.getScriptLog(), "UTF-8"), is(logResult)); - assertThat(URLDecoder.decode(storedProcedureResponse.getResponseHeaders() - .get(HttpConstants.HttpHeaders.SCRIPT_LOG_RESULTS), "UTF-8"), is(logResult)); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - successfulCompletionLatch.countDown(); - System.out.println(storedProcedureResponse.getActivityId()); - }, error -> { - System.err.println("an error occurred while executing the stored procedure: actual cause: " - + error.getMessage()); - }); - - successfulCompletionLatch.await(); - } - - /** - * Execute Stored Procedure that takes arguments - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void executeStoredProcWithArgs() throws Exception { - // Create stored procedure - StoredProcedure storedProcedure = new StoredProcedure( - "{" + - " 'id': 'multiplySample'," + - " 'body':" + - " 'function (value, num) {" + - " getContext().getResponse().setBody(" + - " \"2*\" + value + \" is \" + num * 2 );" + - " }'" + - "}"); - - storedProcedure = asyncClient.createStoredProcedure(getCollectionLink(), storedProcedure, null) - .toBlocking().single().getResource(); - - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey("Seattle")); - - final CountDownLatch successfulCompletionLatch = new CountDownLatch(1); - - // Execute the stored procedure - Object[] storedProcedureArgs = new Object[]{"a", 123}; - asyncClient.executeStoredProcedure(getSprocLink(storedProcedure), requestOptions, storedProcedureArgs) - .subscribe(storedProcedureResponse -> { - String storedProcResultAsString = storedProcedureResponse.getResponseAsString(); - assertThat(storedProcResultAsString, equalTo("\"2*a is 246\"")); - successfulCompletionLatch.countDown(); - System.out.println(storedProcedureResponse.getActivityId()); - }, error -> { - System.err.println("an error occurred while executing the stored procedure: actual cause: " - + error.getMessage()); - }); - - successfulCompletionLatch.await(); - } - - /** - * Execute Stored Procedure that takes arguments, passing a Pojo object - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void executeStoredProcWithPojoArgs() throws Exception { - // create stored procedure - StoredProcedure storedProcedure = new StoredProcedure( - "{" + - " 'id': 'storedProcedurePojoSample'," + - " 'body':" + - " 'function (value) {" + - " getContext().getResponse().setBody(" + - " \"a is \" + value.temp);" + - " }'" + - "}"); - - storedProcedure = asyncClient.createStoredProcedure(getCollectionLink(), storedProcedure, null) - .toBlocking().single().getResource(); - - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey("Seattle")); - - final CountDownLatch successfulCompletionLatch = new CountDownLatch(1); - - // POJO - class SamplePojo { - public String temp = "my temp value"; - } - SamplePojo samplePojo = new SamplePojo(); - - // Execute the stored procedure - Object[] storedProcedureArgs = new Object[]{samplePojo}; - asyncClient.executeStoredProcedure(getSprocLink(storedProcedure), requestOptions, storedProcedureArgs) - .subscribe(storedProcedureResponse -> { - String storedProcResultAsString = storedProcedureResponse.getResponseAsString(); - assertThat(storedProcResultAsString, equalTo("\"a is my temp value\"")); - successfulCompletionLatch.countDown(); - System.out.println(storedProcedureResponse.getActivityId()); - }, error -> { - System.err.println("an error occurred while executing the stored procedure: actual cause: " - + error.getMessage()); - }); - - successfulCompletionLatch.await(); - } - - private static DocumentCollection getMultiPartitionCollectionDefinition() { - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - - // Set the partitionKeyDefinition for a partitioned collection - // Here, we are setting the partitionKey of the Collection to be /city - PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition(); - List paths = new ArrayList(); - paths.add("/city"); - partitionKeyDefinition.setPaths(paths); - collectionDefinition.setPartitionKey(partitionKeyDefinition); - - // Set indexing policy to be range range for string and number - IndexingPolicy indexingPolicy = new IndexingPolicy(); - Collection includedPaths = new ArrayList(); - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath("/*"); - Collection indexes = new ArrayList(); - Index stringIndex = Index.Range(DataType.String); - stringIndex.set("precision", -1); - indexes.add(stringIndex); - - Index numberIndex = Index.Range(DataType.Number); - numberIndex.set("precision", -1); - indexes.add(numberIndex); - includedPath.setIndexes(indexes); - includedPaths.add(includedPath); - indexingPolicy.setIncludedPaths(includedPaths); - collectionDefinition.setIndexingPolicy(indexingPolicy); - - return collectionDefinition; - } - - private String getCollectionLink() { - return "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId(); - } - - private String getSprocLink(StoredProcedure sproc) { - return "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId() + "/sprocs/" + sproc.getId(); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/TestConfigurations.java b/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/TestConfigurations.java deleted file mode 100644 index f48ee5da652c..000000000000 --- a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/TestConfigurations.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.examples; - -import org.apache.commons.lang3.StringUtils; - -import com.google.common.base.Strings; - -/** - * Contains the configurations for tests. - *

- * For running tests, you can pass a customized endpoint configuration in one of the following - * ways: - *

    - *
  • -DACCOUNT_KEY="[your-key]" -ACCOUNT_HOST="[your-endpoint]" as JVM - * command-line option.
  • - *
  • You can set ACCOUNT_KEY and ACCOUNT_HOST as environment variables.
  • - *
- *

- * If none of the above is set, emulator endpoint will be used. - */ -public final class TestConfigurations { - // Replace MASTER_KEY and HOST with values from your Azure Cosmos DB account. - // The default values are credentials of the local emulator, which are not used in any production environment. - // - public static String MASTER_KEY = - System.getProperty("ACCOUNT_KEY", - StringUtils.defaultString(Strings.emptyToNull( - System.getenv().get("ACCOUNT_KEY")), - "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==")); - - public static String HOST = - System.getProperty("ACCOUNT_HOST", - StringUtils.defaultString(Strings.emptyToNull( - System.getenv().get("ACCOUNT_HOST")), - "https://localhost:443/")); -} diff --git a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/TokenResolverTest.java b/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/TokenResolverTest.java deleted file mode 100644 index c33f14fdc2b3..000000000000 --- a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/TokenResolverTest.java +++ /dev/null @@ -1,336 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.examples; - -import com.google.common.collect.ImmutableMap; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.CosmosResourceType; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.Permission; -import com.microsoft.azure.cosmosdb.PermissionMode; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.TokenResolver; -import com.microsoft.azure.cosmosdb.User; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import rx.Observable; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.hasSize; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.core.IsInstanceOf.instanceOf; - -public class TokenResolverTest { - private final static int TIMEOUT = 60000; - private final static String USER_ID = "userId"; - private AsyncDocumentClient asyncClient; - private Database createdDatabase; - private DocumentCollection createdCollection; - private Map userToReadOnlyResourceTokenMap = new HashMap<>(); - private Map documentToReadUserMap = new HashMap<>(); - - private Map documentToReadWriteUserMap = new HashMap<>(); - private Map userToReadWriteResourceTokenMap = new HashMap<>(); - - - /** - * This Example walks you through how to use a token resolver to - * control authorization and access to Cosmos DB resources. - */ - @BeforeClass(groups = "samples", timeOut = TIMEOUT) - public void setUp() { - // Sets up the requirements for each test - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - asyncClient = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - - // Create database - createdDatabase = Utils.createDatabaseForTest(asyncClient); - - // Create collection - createdCollection = asyncClient - .createCollection("dbs/" + createdDatabase.getId(), collectionDefinition, null) - .toBlocking().single().getResource(); - - for (int i = 0; i < 10; i++) { - // Create a document - Document documentDefinition = new Document(); - documentDefinition.setId(UUID.randomUUID().toString()); - Document createdDocument = asyncClient.createDocument(createdCollection.getSelfLink(), documentDefinition, null, true).toBlocking().first().getResource(); - - // Create a User who is meant to only read this document - User readUserDefinition = new User(); - readUserDefinition.setId(UUID.randomUUID().toString()); - User createdReadUser = asyncClient.createUser(createdDatabase.getSelfLink(), readUserDefinition, null).toBlocking().first().getResource(); - - // Create a read only permission for the above document - Permission readOnlyPermissionDefinition = new Permission(); - readOnlyPermissionDefinition.setId(UUID.randomUUID().toString()); - readOnlyPermissionDefinition.setResourceLink(createdDocument.getSelfLink()); - readOnlyPermissionDefinition.setPermissionMode(PermissionMode.Read); - - // Assign the permission to the above user - Permission readOnlyCreatedPermission = asyncClient.createPermission(createdReadUser.getSelfLink(), readOnlyPermissionDefinition, null).toBlocking().first().getResource(); - userToReadOnlyResourceTokenMap.put(createdReadUser.getId(), readOnlyCreatedPermission.getToken()); - - documentToReadUserMap.put(createdDocument.getSelfLink(), createdReadUser.getId()); - - // Create a User who can both read and write this document - User readWriteUserDefinition = new User(); - readWriteUserDefinition.setId(UUID.randomUUID().toString()); - User createdReadWriteUser = asyncClient.createUser(createdDatabase.getSelfLink(), readWriteUserDefinition, null).toBlocking().first().getResource(); - - // Create a read/write permission for the above document - Permission readWritePermissionDefinition = new Permission(); - readWritePermissionDefinition.setId(UUID.randomUUID().toString()); - readWritePermissionDefinition.setResourceLink(createdDocument.getSelfLink()); - readWritePermissionDefinition.setPermissionMode(PermissionMode.All); - - // Assign the permission to the above user - Permission readWriteCreatedPermission = asyncClient.createPermission(createdReadWriteUser.getSelfLink(), readWritePermissionDefinition, null).toBlocking().first().getResource(); - userToReadWriteResourceTokenMap.put(createdReadWriteUser.getId(), readWriteCreatedPermission.getToken()); - - documentToReadWriteUserMap.put(createdDocument.getSelfLink(), createdReadWriteUser.getId()); - } - } - - /** - * Read a document with a user having read permission - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void readDocumentThroughTokenResolver() throws Exception { - AsyncDocumentClient asyncClientWithTokenResolver = null; - try { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - asyncClientWithTokenResolver = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .withTokenResolver(getTokenResolverForRead()) - .build(); - List> capturedResponse = Collections - .synchronizedList(new ArrayList<>()); - for (String documentLink : documentToReadUserMap.keySet()) { - - // Each document has one User who can only read it. Pass that User Id in the properties. - // The token resolver will resolve the token for that User based on 'userId'. - ImmutableMap properties = ImmutableMap. builder() - .put(USER_ID, documentToReadUserMap.get(documentLink)) - .build(); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setProperties(properties); - Observable> readDocumentObservable = asyncClientWithTokenResolver - .readDocument(documentLink, requestOptions); - readDocumentObservable.subscribe(resourceResponse -> { - capturedResponse.add(resourceResponse); - }); - } - Thread.sleep(2000); - System.out.println("capturedResponse.size() = " + capturedResponse.size()); - assertThat(capturedResponse, hasSize(10)); - } finally { - Utils.safeClose(asyncClientWithTokenResolver); - } - } - - /** - * Delete a document with a user having all permission - */ - @Test(groups = "samples", timeOut = TIMEOUT, dependsOnMethods = {"readDocumentThroughTokenResolver"}) - public void deleteDocumentThroughTokenResolver() throws Exception { - AsyncDocumentClient asyncClientWithTokenResolver = null; - try { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - asyncClientWithTokenResolver = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .withTokenResolver(getTokenResolverForReadWrite()) - .build(); - List> capturedResponse = Collections - .synchronizedList(new ArrayList<>()); - for (String documentLink : documentToReadWriteUserMap.keySet()) { - - // Each document has one User who can read and write it. Pass that User Id in the properties. - // The token resolver will resolve the token for that User based on 'userId'. - ImmutableMap properties = ImmutableMap. builder() - .put(USER_ID, documentToReadWriteUserMap.get(documentLink)) - .build(); - - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setProperties(properties); - Observable> readDocumentObservable = asyncClientWithTokenResolver - .deleteDocument(documentLink, requestOptions); - readDocumentObservable.subscribe(resourceResponse -> { - capturedResponse.add(resourceResponse); - }); - } - Thread.sleep(2000); - assertThat(capturedResponse, hasSize(10)); - } finally { - Utils.safeClose(asyncClientWithTokenResolver); - } - } - - /** - * Block list an user and throw error from token resolver - */ - @Test(groups = "samples", timeOut = TIMEOUT) - public void blockListUserThroughTokenResolver() throws Exception { - String blockListedUserId = "block listed user"; - String errorMessage = "block listed user! access denied!"; - - AsyncDocumentClient asyncClientWithTokenResolver = null; - - try { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - asyncClientWithTokenResolver = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .withTokenResolver(getTokenResolverWithBlockList(blockListedUserId, errorMessage)) - .build(); - - // Read a document using a block listed user, passing the 'userId' in the properties. - // Token resolver will throw RuntimeException. - RequestOptions options = new RequestOptions(); - ImmutableMap properties = ImmutableMap. builder() - .put(USER_ID, blockListedUserId) - .build(); - - options.setProperties(properties); - Observable> readObservable = asyncClientWithTokenResolver.readCollection(createdCollection.getSelfLink(), options); - List capturedErrors = Collections - .synchronizedList(new ArrayList<>()); - readObservable.subscribe(response -> {}, throwable -> capturedErrors.add(throwable)); - Thread.sleep(2000); - assertThat(capturedErrors, hasSize(1)); - assertThat(capturedErrors.get(0), instanceOf(RuntimeException.class)); - assertThat(capturedErrors.get(0).getMessage(), equalTo(errorMessage)); - - // Read a document using a valid user, passing the 'userId' in the properties. - // Token resolver will pass on the correct token for authentication. - String validUserId = userToReadWriteResourceTokenMap.keySet().iterator().next(); - System.out.println(validUserId); - properties = ImmutableMap. builder() - .put(USER_ID, validUserId) - .build(); - options.setProperties(properties); - readObservable = asyncClientWithTokenResolver.readCollection(createdCollection.getSelfLink(), options); - List capturedResponse = Collections - .synchronizedList(new ArrayList<>()); - readObservable.subscribe(resourceResponse -> capturedResponse.add(resourceResponse.getResource()), error -> error.printStackTrace()); - Thread.sleep(2000); - assertThat(capturedErrors, hasSize(1)); - assertThat(capturedResponse.get(0).getId(), equalTo(createdCollection.getId())); - } finally { - Utils.safeClose(asyncClientWithTokenResolver); - } - } - - /** - * For Reading DatabaseAccount on client initialization, use any User's token. - * For subsequent Reads, get the correct read only token based on 'userId'. - */ - private TokenResolver getTokenResolverForRead() { - return (String requestVerb, String resourceIdOrFullName, CosmosResourceType resourceType, Map properties) -> { - if (resourceType.equals(CosmosResourceType.System)) { - //Choose any token it should have the read access on database account - for (String token : userToReadOnlyResourceTokenMap.values()) { - return token; - } - } else { - return userToReadOnlyResourceTokenMap.get(properties.get(USER_ID)); - } - return null; - }; - } - - /** - * For Reading DatabaseAccount on client initialization, use any User's token. - * For subsequent Reads/Writes, get the correct read/write token based on 'userId'. - */ - private TokenResolver getTokenResolverForReadWrite() { - return (String requestVerb, String resourceIdOrFullName, CosmosResourceType resourceType, Map properties) -> { - if (resourceType.equals(CosmosResourceType.System)) { - //Choose any token it should have the read access on database account - for (String token : userToReadWriteResourceTokenMap.values()) { - return token; - } - } else { - return userToReadWriteResourceTokenMap.get(properties.get(USER_ID)); - } - return null; - }; - } - - /** - * For Reading DatabaseAccount on client initialization, use any User's token. - * For subsequent Reads, get the correct read/write token based on 'userId', - * only if user is not block listed. In this scenario, the block listed user id - * is compared to the current user's id, passed into the properties for the request. - */ - private TokenResolver getTokenResolverWithBlockList(String blockListedUserId, String errorMessage) { - return (String requestVerb, String resourceIdOrFullName, CosmosResourceType resourceType, Map properties) -> { - if (resourceType == CosmosResourceType.System) { - return userToReadWriteResourceTokenMap.values().iterator().next(); - } else if (!properties.get(USER_ID).toString().equals(blockListedUserId)) { - return userToReadWriteResourceTokenMap.get(properties.get(USER_ID)); - } else { - throw new RuntimeException(errorMessage); - } - }; - } - - @AfterClass(groups = "samples", timeOut = TIMEOUT) - public void shutdown() { - Utils.safeClean(asyncClient, createdDatabase); - Utils.safeClose(asyncClient); - } -} diff --git a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/UniqueIndexAsyncAPITest.java b/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/UniqueIndexAsyncAPITest.java deleted file mode 100644 index e253729f1ee4..000000000000 --- a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/UniqueIndexAsyncAPITest.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.examples; - -import com.google.common.collect.ImmutableList; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.UniqueKey; -import com.microsoft.azure.cosmosdb.UniqueKeyPolicy; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import rx.Observable; -import rx.observers.TestSubscriber; - -import java.util.Collections; -import java.util.UUID; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.hasSize; - -public class UniqueIndexAsyncAPITest { - private final static int TIMEOUT = 60000; - - private AsyncDocumentClient client; - private Database createdDatabase; - - @Test(groups = "samples", timeOut = TIMEOUT) - public void uniqueIndex() { - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - UniqueKeyPolicy uniqueKeyPolicy = new UniqueKeyPolicy(); - UniqueKey uniqueKey = new UniqueKey(); - uniqueKey.setPaths(ImmutableList.of("/name", "/field")); - uniqueKeyPolicy.setUniqueKeys(Collections.singleton(uniqueKey)); - collectionDefinition.setUniqueKeyPolicy(uniqueKeyPolicy); - - DocumentCollection collection = client.createCollection(getDatabaseLink(), collectionDefinition, null).toBlocking().single().getResource(); - - Document doc1 = new Document("{ 'name':'Alan Turning', 'field': 'Mathematics', 'other' : 'Logic' }"); - Document doc2 = new Document("{ 'name':'Al-Khwarizmi', 'field': 'Mathematics' , 'other' : 'Algebra '}"); - Document doc3 = new Document("{ 'name':'Alan Turning', 'field': 'Mathematics', 'other' : 'CS' }"); - - client.createDocument(getCollectionLink(collection), doc1, null, false).toBlocking().single().getResource(); - client.createDocument(getCollectionLink(collection), doc2, null, false).toBlocking().single().getResource(); - - // doc1 got inserted with the same values for 'name' and 'field' - // so inserting a new one with the same values will violate unique index constraint. - Observable> docCreation = - client.createDocument(getCollectionLink(collection), doc3, null, false); - - TestSubscriber> subscriber = new TestSubscriber<>(); - docCreation.subscribe(subscriber); - - subscriber.awaitTerminalEvent(); - subscriber.assertError(DocumentClientException.class); - assertThat(subscriber.getOnErrorEvents(), hasSize(1)); - - // error code for failure is conflict - assertThat(((DocumentClientException) subscriber.getOnErrorEvents().get(0)).getStatusCode(), equalTo(409)); - } - - @BeforeClass(groups = "samples", timeOut = TIMEOUT) - public void setUp() { - // Sets up the requirements for each test - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - client = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - - // Create database - createdDatabase = Utils.createDatabaseForTest(client); - } - - @AfterClass(groups = "samples", timeOut = TIMEOUT) - public void shutdown() { - Utils.safeClean(client, createdDatabase); - Utils.safeClose(client); - } - - private String getCollectionLink(DocumentCollection collection) { - return "dbs/" + createdDatabase.getId() + "/colls/" + collection.getId(); - } - - private String getDatabaseLink() { - return "dbs/" + createdDatabase.getId(); - } -} diff --git a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/Utils.java b/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/Utils.java deleted file mode 100644 index 5e498bcc2e2a..000000000000 --- a/cosmosdb/data-plane/examples/src/test/java/com/microsoft/azure/cosmosdb/rx/examples/Utils.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.examples; - -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.RetryOptions; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.TestConfigurations; -import org.testng.annotations.AfterSuite; -import rx.Observable; - -public class Utils { - - @AfterSuite(groups = "samples") - public void cleanupStaleDatabase() { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - RetryOptions options = new RetryOptions(); - connectionPolicy.setRetryOptions(options); - AsyncDocumentClient client = new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .build(); - safeCleanDatabases(client); - client.close(); - } - - public static String getCollectionLink(Database db, DocumentCollection collection) { - return "dbs/" + db.getId() + "/colls/" + collection; - } - - public static Database createDatabaseForTest(AsyncDocumentClient client) { - return DatabaseForTest.create(DatabaseManagerImpl.getInstance(client)).createdDatabase; - } - - private static void safeCleanDatabases(AsyncDocumentClient client) { - if (client != null) { - DatabaseForTest.cleanupStaleTestDatabases(DatabaseManagerImpl.getInstance(client)); - } - } - - public static void safeClean(AsyncDocumentClient client, Database database) { - if (database != null) { - safeClean(client, database.getId()); - } - } - - public static void safeClean(AsyncDocumentClient client, String databaseId) { - if (client != null) { - if (databaseId != null) { - try { - client.deleteDatabase("/dbs/" + databaseId, null).toBlocking().single(); - } catch (Exception e) { - } - } - } - } - - public static String generateDatabaseId() { - return DatabaseForTest.generateId(); - } - - public static void safeClose(AsyncDocumentClient client) { - if (client != null) { - client.close(); - } - } - - private static class DatabaseManagerImpl implements DatabaseForTest.DatabaseManager { - public static DatabaseManagerImpl getInstance(AsyncDocumentClient client) { - return new DatabaseManagerImpl(client); - } - - private final AsyncDocumentClient client; - - private DatabaseManagerImpl(AsyncDocumentClient client) { - this.client = client; - } - - @Override - public Observable> queryDatabases(SqlQuerySpec query) { - return client.queryDatabases(query, null); - } - - @Override - public Observable> createDatabase(Database databaseDefinition) { - return client.createDatabase(databaseDefinition, null); - } - - @Override - public Observable> deleteDatabase(String id) { - - return client.deleteDatabase("dbs/" + id, null); - } - } -} diff --git a/cosmosdb/data-plane/examples/src/test/resources/log4j.properties b/cosmosdb/data-plane/examples/src/test/resources/log4j.properties deleted file mode 100644 index b7947ea7907d..000000000000 --- a/cosmosdb/data-plane/examples/src/test/resources/log4j.properties +++ /dev/null @@ -1,13 +0,0 @@ -# this is the log4j configuration for tests - -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=INFO, A1 - -log4j.category.io.netty=INFO -log4j.category.io.reactivex=INFO -# A1 is set to be a ConsoleAppender. -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%d %5X{pid} [%t] %-5p %c - %m%n diff --git a/cosmosdb/data-plane/faq/README.md b/cosmosdb/data-plane/faq/README.md deleted file mode 100644 index 8fa637f1570d..000000000000 --- a/cosmosdb/data-plane/faq/README.md +++ /dev/null @@ -1,9 +0,0 @@ - -### FAQ - -#### I am getting this error: - -- ``Request Rate too Large`` Request too large is an error from service indicating that you temporarily went beyond the provisioned throughput. You should retry after the provided -``DocumentClientException#getRetryAfterInMilliseconds()``. - -- ``CollectionPoolExhausted`` this is a SDK side error indicating that the SDK's connection pool is saturated. Consider to retry later, increase the connection pool size or use a semaphore to throttle your workload. diff --git a/cosmosdb/data-plane/gateway/pom.xml b/cosmosdb/data-plane/gateway/pom.xml deleted file mode 100644 index a51483cb36f6..000000000000 --- a/cosmosdb/data-plane/gateway/pom.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - 4.0.0 - - com.microsoft.azure - azure-cosmosdb-parent - 2.4.5 - - azure-cosmosdb-gateway - Common Gateway Components for Async SDK for SQL API of Azure Cosmos DB Service - Common Gateway Components for Async SDK for SQL API of Azure Cosmos DB Service - jar - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.6.0 - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-eclipse-plugin - 2.8 - - - - org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8 - - - - - - - - - - org.apache.maven.plugins - maven-surefire-report-plugin - 2.22.0 - - - org.codehaus.mojo - findbugs-maven-plugin - 3.0.4 - - - org.apache.maven.plugins - maven-jxr-plugin - 2.1 - - - - - - com.microsoft.azure - azure-cosmosdb-commons - - - com.microsoft.azure - azure-cosmosdb-commons-test-utils - test - - - org.testng - testng - ${testng.version} - test - - - org.assertj - assertj-core - ${assertj.version} - test - - - org.mockito - mockito-all - ${mockito.version} - test - - - org.slf4j - slf4j-log4j12 - ${slf4j.version} - test - - - log4j - log4j - ${log4j.version} - test - - - com.google.guava - guava - ${guava.version} - test - - - diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/DatabaseAccountManagerInternal.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/DatabaseAccountManagerInternal.java deleted file mode 100644 index 670153b18672..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/DatabaseAccountManagerInternal.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb; - -import rx.Observable; - -import java.net.URI; - -public interface DatabaseAccountManagerInternal { - - /** - * Gets database account information. - * - * @param endpoint the endpoint from which gets the database account - * @return the database account. - */ - Observable getDatabaseAccountFromEndpoint(URI endpoint); - - /** - * Gets the connection policy - * - * @return connection policy - */ - ConnectionPolicy getConnectionPolicy(); - - /** - * Gets the service endpoint - * - * @return service endpoint - */ - URI getServiceEndpoint(); - -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/ISessionContainer.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/ISessionContainer.java deleted file mode 100644 index 24abe4825075..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/ISessionContainer.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import com.microsoft.azure.cosmosdb.internal.ISessionToken; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; - -import java.util.Map; - -public interface ISessionContainer { - /** - * Returns a serialized map of partitionKeyRangeId to session token. If a entity is name based then the method extracts name from - * ResourceAddress and use it to identify collection otherwise it uses ResourceId. Returns empty string if collection is unknown - * @param entity {@link RxDocumentServiceRequest entity} - * @return serialzed map of partitionKeyRangeId to session token or empty string is collection is unknown - */ - String resolveGlobalSessionToken(RxDocumentServiceRequest entity); - - /** - * Returns a session token identified by partitionKeyRangeId(*) from a collection identified either by ResourceAddress - * (in case of name based entity) or either by ResourceId. - * - * If partitionKeyRangeId is not in the collection's partitionKeyRangeId token map then method - * iterates through request.RequestContext.ResolvedPartitionKeyRange.Parents starting from tail and - * returns a corresponding token if there is a match. - * @param entity {@link RxDocumentServiceRequest} - * @param partitionKeyRangeId partitionKeyRangeId - * @return Returns a session token identified by partitionKeyRangeId(*) from a collection identified either by ResourceAddress - * (in case of name based entity) or either by ResourceId. - */ - ISessionToken resolvePartitionLocalSessionToken(RxDocumentServiceRequest entity, String partitionKeyRangeId); - - /** - * Atomically: removes partitionKeyRangeId token map associated with resourceId, - * maps resourceId to collectionFullName and removes its map as well - * @param resourceId resourceId - */ - void clearTokenByResourceId(String resourceId); - - /** - * Atomically: removes partitionKeyRangeId token map associated with collectionFullName, maps collectionFullName to resourceId and - * removes its map as well. - * @param collectionFullName collectionFullName - */ - void clearTokenByCollectionFullName(String collectionFullName); - - /** - * Infers collectionFullName using responseHeaders[HttpConstants.HttpHeaders.OwnerFullName] or request.ResourceAddress, - * infers resourceId using responseHeaders[HttpConstants.HttpHeaders.OwnerId] or request.ResourceId, - * and adds responseHeaders[HttpConstants.HttpHeaders.SessionToken] session token to the (collectionFullName, resourceId)'s - * partitionKeyRangeId token map. - * - * NB: Silently does nothing for master queries, or when it's impossible to infer collectionRid and collectionFullName - * from the request, or then SessionToken is missing in responseHeader. - * - * @param request {@link RxDocumentServiceRequest} - * @param responseHeaders responseHeaders - */ - void setSessionToken(RxDocumentServiceRequest request, Map responseHeaders); - - /** - * Adds responseHeaders[HttpConstants.HttpHeaders.SessionToken] session token to the (collectionFullName, collectionRid)'s partitionKeyRangeId token map. - * @param collectionRid collectionRid - * @param collectionFullName collectionFullName - * @param responseHeaders responseHeaders - */ - void setSessionToken(String collectionRid, String collectionFullName, Map responseHeaders); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/AuthorizationTokenProvider.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/AuthorizationTokenProvider.java deleted file mode 100644 index 3aaa9f60dbc5..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/AuthorizationTokenProvider.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import java.util.Map; - -/** - * Represents types that can provide functionality to generate authorization token for the Azure Cosmos DB database - * service. - */ -public interface AuthorizationTokenProvider { - String generateKeyAuthorizationSignature(String verb, - String resourceIdOrFullName, - ResourceType resourceType, - Map headers); - - String getAuthorizationTokenUsingResourceTokens(Map resourceTokens, - String path, - String resourceId); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/BaseAuthorizationTokenProvider.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/BaseAuthorizationTokenProvider.java deleted file mode 100644 index f04df192d7f4..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/BaseAuthorizationTokenProvider.java +++ /dev/null @@ -1,373 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import java.net.URI; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; -import java.util.Collections; -import java.util.HashSet; -import java.util.Locale; -import java.util.Map; - -import javax.crypto.Mac; -import javax.crypto.SecretKey; -import javax.crypto.spec.SecretKeySpec; - -import org.apache.commons.lang3.StringUtils; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.HttpUtils; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; - -/** - * This class is used internally by both client (for generating the auth header with master/system key) and by the Gateway when - * verifying the auth header in the Azure Cosmos DB database service. - */ -public class BaseAuthorizationTokenProvider implements AuthorizationTokenProvider { - - private static final String AUTH_PREFIX = "type=master&ver=1.0&sig="; - private final String masterKey; - private final Mac macInstance; - - public BaseAuthorizationTokenProvider(String masterKey) { - this.masterKey = masterKey; - byte[] masterKeyDecodedBytes = Utils.Base64Decoder.decode(this.masterKey.getBytes()); - SecretKey signingKey = new SecretKeySpec(masterKeyDecodedBytes, "HMACSHA256"); - try { - this.macInstance = Mac.getInstance("HMACSHA256"); - this.macInstance.init(signingKey); - } catch (NoSuchAlgorithmException | InvalidKeyException e) { - throw new IllegalStateException(e); - } - } - - private static String getResourceSegment(ResourceType resourceType) { - switch (resourceType) { - case Attachment: - return Paths.ATTACHMENTS_PATH_SEGMENT; - case Database: - return Paths.DATABASES_PATH_SEGMENT; - case Conflict: - return Paths.CONFLICTS_PATH_SEGMENT; - case Document: - return Paths.DOCUMENTS_PATH_SEGMENT; - case DocumentCollection: - return Paths.COLLECTIONS_PATH_SEGMENT; - case Offer: - return Paths.OFFERS_PATH_SEGMENT; - case Permission: - return Paths.PERMISSIONS_PATH_SEGMENT; - case StoredProcedure: - return Paths.STORED_PROCEDURES_PATH_SEGMENT; - case Trigger: - return Paths.TRIGGERS_PATH_SEGMENT; - case UserDefinedFunction: - return Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT; - case User: - return Paths.USERS_PATH_SEGMENT; - case PartitionKeyRange: - return Paths.PARTITION_KEY_RANGES_PATH_SEGMENT; - case Media: - return Paths.MEDIA_PATH_SEGMENT; - case DatabaseAccount: - return ""; - default: - return null; - } - } - - /** - * This API is a helper method to create auth header based on client request using masterkey. - * - * @param verb the verb. - * @param resourceIdOrFullName the resource id or full name - * @param resourceType the resource type. - * @param headers the request headers. - * @return the key authorization signature. - */ - public String generateKeyAuthorizationSignature(String verb, - String resourceIdOrFullName, - ResourceType resourceType, - Map headers) { - return this.generateKeyAuthorizationSignature(verb, resourceIdOrFullName, - BaseAuthorizationTokenProvider.getResourceSegment(resourceType).toLowerCase(), headers); - } - - /** - * This API is a helper method to create auth header based on client request using masterkey. - * - * @param verb the verb - * @param resourceIdOrFullName the resource id or full name - * @param resourceSegment the resource segment - * @param headers the request headers - * @return the key authorization signature - */ - public String generateKeyAuthorizationSignature(String verb, - String resourceIdOrFullName, - String resourceSegment, - Map headers) { - if (verb == null || verb.isEmpty()) { - throw new IllegalArgumentException("verb"); - } - - if (resourceIdOrFullName == null) { - resourceIdOrFullName = ""; - } - - if (resourceSegment == null) { - throw new IllegalArgumentException("resourceSegment"); - } - - if (headers == null) { - throw new IllegalArgumentException("headers"); - } - - if (this.masterKey == null || this.masterKey.isEmpty()) { - throw new IllegalArgumentException("masterKey"); - } - - if(!PathsHelper.isNameBased(resourceIdOrFullName)) { - resourceIdOrFullName = resourceIdOrFullName.toLowerCase(Locale.ROOT); - } - - // Skipping lower casing of resourceId since it may now contain "ID" of the resource as part of the FullName - StringBuilder body = new StringBuilder(); - body.append(verb.toLowerCase()) - .append('\n') - .append(resourceSegment) - .append('\n') - .append(resourceIdOrFullName) - .append('\n'); - - if (headers.containsKey(HttpConstants.HttpHeaders.X_DATE)) { - body.append(headers.get(HttpConstants.HttpHeaders.X_DATE).toLowerCase()); - } - - body.append('\n'); - - if (headers.containsKey(HttpConstants.HttpHeaders.HTTP_DATE)) { - body.append(headers.get(HttpConstants.HttpHeaders.HTTP_DATE).toLowerCase()); - } - - body.append('\n'); - - Mac mac = null; - try { - mac = (Mac) this.macInstance.clone(); - } catch (CloneNotSupportedException e) { - throw new IllegalStateException(e); - } - - byte[] digest = mac.doFinal(body.toString().getBytes()); - - String auth = Utils.encodeBase64String(digest); - - return AUTH_PREFIX + auth; - } - - /** - * This API is a helper method to create auth header based on client request using resourceTokens. - * - * @param resourceTokens the resource tokens. - * @param path the path. - * @param resourceId the resource id. - * @return the authorization token. - */ - public String getAuthorizationTokenUsingResourceTokens(Map resourceTokens, - String path, - String resourceId) { - if (resourceTokens == null) { - throw new IllegalArgumentException("resourceTokens"); - } - - String resourceToken = null; - if (resourceTokens.containsKey(resourceId) && resourceTokens.get(resourceId) != null) { - resourceToken = resourceTokens.get(resourceId); - } else if (StringUtils.isEmpty(path) || StringUtils.isEmpty(resourceId)) { - if (resourceTokens.size() > 0) { - resourceToken = resourceTokens.values().iterator().next(); - } - } else { - // Get the last resource id from the path and use that to find the corresponding token. - String[] pathParts = StringUtils.split(path, "/"); - String[] resourceTypes = {"dbs", "colls", "docs", "sprocs", "udfs", "triggers", "users", "permissions", - "attachments", "media", "conflicts"}; - HashSet resourceTypesSet = new HashSet(); - Collections.addAll(resourceTypesSet, resourceTypes); - - for (int i = pathParts.length - 1; i >= 0; --i) { - - if (!resourceTypesSet.contains(pathParts[i]) && resourceTokens.containsKey(pathParts[i])) { - resourceToken = resourceTokens.get(pathParts[i]); - } - } - } - - return resourceToken; - } - public String generateKeyAuthorizationSignature(String verb, URI uri, Map headers) { - if (StringUtils.isEmpty(verb)) { - throw new IllegalArgumentException(String.format(RMResources.StringArgumentNullOrEmpty, "verb")); - } - - if (uri == null) { - throw new IllegalArgumentException("uri"); - } - - if (headers == null) { - throw new IllegalArgumentException("headers"); - } - PathInfo pathInfo = new PathInfo(false, StringUtils.EMPTY, StringUtils.EMPTY, false); - getResourceTypeAndIdOrFullName(uri, pathInfo); - return generateKeyAuthorizationSignatureNew(verb, pathInfo.resourceIdOrFullName, pathInfo.resourcePath, - headers); - } - - public String generateKeyAuthorizationSignatureNew(String verb, String resourceIdValue, String resourceType, - Map headers) { - if (StringUtils.isEmpty(verb)) { - throw new IllegalArgumentException(String.format(RMResources.StringArgumentNullOrEmpty, "verb")); - } - - if (resourceType == null) { - throw new IllegalArgumentException(String.format(RMResources.StringArgumentNullOrEmpty, "resourceType")); // can be empty - } - - if (headers == null) { - throw new IllegalArgumentException("headers"); - } - // Order of the values included in the message payload is a protocol that - // clients/BE need to follow exactly. - // More headers can be added in the future. - // If any of the value is optional, it should still have the placeholder value - // of "" - // OperationType -> ResourceType -> ResourceId/OwnerId -> XDate -> Date - String verbInput = verb; - String resourceIdInput = resourceIdValue; - String resourceTypeInput = resourceType; - - String authResourceId = getAuthorizationResourceIdOrFullName(resourceTypeInput, resourceIdInput); - String payLoad = generateMessagePayload(verbInput, authResourceId, resourceTypeInput, headers); - Mac mac = null; - try { - mac = (Mac) this.macInstance.clone(); - } catch (CloneNotSupportedException e) { - throw new IllegalStateException(e); - } - byte[] digest = mac.doFinal(payLoad.getBytes()); - String authorizationToken = Utils.encodeBase64String(digest); - String authtoken = AUTH_PREFIX + authorizationToken; - return HttpUtils.urlEncode(authtoken); - } - - private String generateMessagePayload(String verb, String resourceId, String resourceType, - Map headers) { - String xDate = headers.get(HttpConstants.HttpHeaders.X_DATE); - String date = headers.get(HttpConstants.HttpHeaders.HTTP_DATE); - // At-least one of date header should present - // https://docs.microsoft.com/en-us/rest/api/documentdb/access-control-on-documentdb-resources - if (StringUtils.isEmpty(xDate) && (StringUtils.isEmpty(date) || StringUtils.isWhitespace(date))) { - headers.put(HttpConstants.HttpHeaders.X_DATE, Utils.nowAsRFC1123()); - xDate = Utils.nowAsRFC1123(); - } - - // for name based, it is case sensitive, we won't use the lower case - if (!PathsHelper.isNameBased(resourceId)) { - resourceId = resourceId.toLowerCase(); - } - - StringBuilder payload = new StringBuilder(); - payload.append(verb.toLowerCase()) - .append('\n') - .append(resourceType.toLowerCase()) - .append('\n') - .append(resourceId) - .append('\n') - .append(xDate.toLowerCase()) - .append('\n') - .append(StringUtils.isEmpty(xDate) ? date.toLowerCase() : "") - .append('\n'); - - return payload.toString(); - } - - private String getAuthorizationResourceIdOrFullName(String resourceType, String resourceIdOrFullName) { - if (StringUtils.isEmpty(resourceType) || StringUtils.isEmpty(resourceIdOrFullName)) { - return resourceIdOrFullName; - } - if (PathsHelper.isNameBased(resourceIdOrFullName)) { - // resource fullname is always end with name (not type segment like docs/colls). - return resourceIdOrFullName; - } - - if (resourceType.equalsIgnoreCase(Paths.OFFERS_PATH_SEGMENT) - || resourceType.equalsIgnoreCase(Paths.PARTITIONS_PATH_SEGMENT) - || resourceType.equalsIgnoreCase(Paths.TOPOLOGY_PATH_SEGMENT) - || resourceType.equalsIgnoreCase(Paths.RID_RANGE_PATH_SEGMENT)) { - return resourceIdOrFullName; - } - - ResourceId parsedRId = ResourceId.parse(resourceIdOrFullName); - if (resourceType.equalsIgnoreCase(Paths.DATABASES_PATH_SEGMENT)) { - return parsedRId.getDatabaseId().toString(); - } else if (resourceType.equalsIgnoreCase(Paths.USERS_PATH_SEGMENT)) { - return parsedRId.getUserId().toString(); - } else if (resourceType.equalsIgnoreCase(Paths.COLLECTIONS_PATH_SEGMENT)) { - return parsedRId.getDocumentCollectionId().toString(); - } else if (resourceType.equalsIgnoreCase(Paths.DOCUMENTS_PATH_SEGMENT)) { - return parsedRId.getDocumentId().toString(); - } else { - // leaf node - return resourceIdOrFullName; - } - } - - private void getResourceTypeAndIdOrFullName(URI uri, PathInfo pathInfo) { - if (uri == null) { - throw new IllegalArgumentException("uri"); - } - - pathInfo.resourcePath = StringUtils.EMPTY; - pathInfo.resourceIdOrFullName = StringUtils.EMPTY; - - String[] segments = StringUtils.split(uri.toString(), Constants.Properties.PATH_SEPARATOR); - if (segments == null || segments.length < 1) { - throw new IllegalArgumentException(RMResources.InvalidUrl); - } - // Authorization code is fine with Uri not having resource id and path. - // We will just return empty in that case - String pathAndQuery = StringUtils.EMPTY ; - if(StringUtils.isNotEmpty(uri.getPath())) { - pathAndQuery+= uri.getPath(); - } - if(StringUtils.isNotEmpty(uri.getQuery())) { - pathAndQuery+="?"; - pathAndQuery+= uri.getQuery(); - } - if (!PathsHelper.tryParsePathSegments(pathAndQuery, pathInfo, null)) { - pathInfo.resourcePath = StringUtils.EMPTY; - pathInfo.resourceIdOrFullName = StringUtils.EMPTY; - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/BaseDatabaseAccountConfigurationProvider.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/BaseDatabaseAccountConfigurationProvider.java deleted file mode 100644 index a9faa3657514..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/BaseDatabaseAccountConfigurationProvider.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DatabaseAccount; - -/** - * Used internally to provides functionality to work with database account configuration in the Azure Cosmos DB database service. - */ -public class BaseDatabaseAccountConfigurationProvider implements DatabaseAccountConfigurationProvider { - private ConsistencyLevel desiredConsistencyLevel; - private DatabaseAccount databaseAccount; - - public BaseDatabaseAccountConfigurationProvider(DatabaseAccount databaseAccount, ConsistencyLevel desiredConsistencyLevel) { - this.databaseAccount = databaseAccount; - this.desiredConsistencyLevel = desiredConsistencyLevel; - } - - public ConsistencyLevel getStoreConsistencyPolicy() { - ConsistencyLevel databaseAccountConsistency = this.databaseAccount.getConsistencyPolicy().getDefaultConsistencyLevel(); - if (this.desiredConsistencyLevel == null) { - return databaseAccountConsistency; - } else if (!Utils.isValidConsistency(databaseAccountConsistency, this.desiredConsistencyLevel)) { - throw new IllegalArgumentException(String.format( - "ConsistencyLevel %1s specified in the request is invalid when service is configured with consistency level %2s. Ensure the request consistency level is not stronger than the service consistency level.", - this.desiredConsistencyLevel.toString(), - databaseAccountConsistency.toString())); - } else { - return this.desiredConsistencyLevel; - } - } - - public int getMaxReplicaSetSize() { - return this.databaseAccount.getReplicationPolicy().getMaxReplicaSetSize(); - } - - @Override - public String getQueryEngineConfiguration() { - return databaseAccount.get("queryEngineConfiguration").toString(); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/DatabaseAccountConfigurationProvider.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/DatabaseAccountConfigurationProvider.java deleted file mode 100644 index 15ef723956d9..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/DatabaseAccountConfigurationProvider.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import com.microsoft.azure.cosmosdb.ConsistencyLevel; - -/** - * Defines an interface to work with database account configuration in the Azure Cosmos DB database service. - */ -public interface DatabaseAccountConfigurationProvider { - ConsistencyLevel getStoreConsistencyPolicy(); - - int getMaxReplicaSetSize(); - - String getQueryEngineConfiguration(); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/RetryPolicy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/RetryPolicy.java deleted file mode 100644 index 9b1b5eec6312..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/RetryPolicy.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import com.microsoft.azure.cosmosdb.DocumentClientException; - -/** - * Used internally to define the interface for retry policy in the Azure Cosmos DB database service Java SDK. - */ -public interface RetryPolicy { - boolean shouldRetry(DocumentClientException exception) ; - - long getRetryAfterInMilliseconds(); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/SessionContainer.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/SessionContainer.java deleted file mode 100644 index 58e4ff4f65f1..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/SessionContainer.java +++ /dev/null @@ -1,317 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.rx.internal.ReplicatedResourceClientUtils; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.locks.ReentrantReadWriteLock; - -import static com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; - -/** - * Used internally to cache the collections' session tokens in the Azure Cosmos DB database service. - */ -public final class SessionContainer implements ISessionContainer { - private final Logger logger = LoggerFactory.getLogger(SessionContainer.class); - - /** - * Session token cache that maps collection ResourceID to session tokens - */ - private final ConcurrentHashMap> collectionResourceIdToSessionTokens = new ConcurrentHashMap<>(); - /** - * Collection ResourceID cache that maps collection name to collection ResourceID - * When collection name is provided instead of self-link, this is used in combination with - * collectionResourceIdToSessionTokens to retrieve the session token for the collection by name - */ - private final ReentrantReadWriteLock readWriteLock = new ReentrantReadWriteLock(); - private final ReentrantReadWriteLock.ReadLock readLock = readWriteLock.readLock(); - private final ReentrantReadWriteLock.WriteLock writeLock = readWriteLock.writeLock(); - - private final ConcurrentHashMap collectionNameToCollectionResourceId = new ConcurrentHashMap<>(); - private final ConcurrentHashMap collectionResourceIdToCollectionName = new ConcurrentHashMap<>(); - private final String hostName; - - public SessionContainer(final String hostName) { - this.hostName = hostName; - } - - public String getHostName() { - return this.hostName; - } - - public String getSessionToken(String collectionLink) { - - PathInfo pathInfo = new PathInfo(false, null, null, false); - ConcurrentHashMap partitionKeyRangeIdToTokenMap = null; - if (PathsHelper.tryParsePathSegments(collectionLink, pathInfo, null)) { - Long UniqueDocumentCollectionId = null; - if (pathInfo.isNameBased) { - String collectionName = PathsHelper.getCollectionPath(pathInfo.resourceIdOrFullName); - UniqueDocumentCollectionId = this.collectionNameToCollectionResourceId.get(collectionName); - } else { - ResourceId resourceId = ResourceId.parse(pathInfo.resourceIdOrFullName); - if (resourceId.getDocumentCollection() != 0) { - UniqueDocumentCollectionId = resourceId.getUniqueDocumentCollectionId(); - } - } - - if (UniqueDocumentCollectionId != null) { - partitionKeyRangeIdToTokenMap = this.collectionResourceIdToSessionTokens.get(UniqueDocumentCollectionId); - } - } - - if (partitionKeyRangeIdToTokenMap == null) { - return StringUtils.EMPTY; - } - - return SessionContainer.getCombinedSessionToken(partitionKeyRangeIdToTokenMap); - } - - private ConcurrentHashMap getPartitionKeyRangeIdToTokenMap(RxDocumentServiceRequest request) { - return getPartitionKeyRangeIdToTokenMap(request.getIsNameBased(), request.getResourceId(), request.getResourceAddress()); - } - - private ConcurrentHashMap getPartitionKeyRangeIdToTokenMap(boolean isNameBased, String rId, String resourceAddress) { - ConcurrentHashMap rangeIdToTokenMap = null; - if (!isNameBased) { - if (!StringUtils.isEmpty(rId)) { - ResourceId resourceId = ResourceId.parse(rId); - if (resourceId.getDocumentCollection() != 0) { - rangeIdToTokenMap = - this.collectionResourceIdToSessionTokens.get(resourceId.getUniqueDocumentCollectionId()); - } - } - } else { - String collectionName = Utils.getCollectionName(resourceAddress); - if (!StringUtils.isEmpty(collectionName) && this.collectionNameToCollectionResourceId.containsKey(collectionName)) { - rangeIdToTokenMap = this.collectionResourceIdToSessionTokens.get( - this.collectionNameToCollectionResourceId.get(collectionName)); - } - } - return rangeIdToTokenMap; - } - - - public String resolveGlobalSessionToken(RxDocumentServiceRequest request) { - ConcurrentHashMap partitionKeyRangeIdToTokenMap = this.getPartitionKeyRangeIdToTokenMap(request); - if (partitionKeyRangeIdToTokenMap != null) { - return SessionContainer.getCombinedSessionToken(partitionKeyRangeIdToTokenMap); - } - - return StringUtils.EMPTY; - } - - @Override - public ISessionToken resolvePartitionLocalSessionToken(RxDocumentServiceRequest request, String partitionKeyRangeId) { - return SessionTokenHelper.resolvePartitionLocalSessionToken(request, - partitionKeyRangeId, - this.getPartitionKeyRangeIdToTokenMap(request)); - } - - @Override - public void clearTokenByCollectionFullName(String collectionFullName) { - if (!Strings.isNullOrEmpty(collectionFullName)) { - String collectionName = PathsHelper.getCollectionPath(collectionFullName); - this.writeLock.lock(); - try { - if (this.collectionNameToCollectionResourceId.containsKey(collectionName)) { - Long rid = this.collectionNameToCollectionResourceId.get(collectionName); - this.collectionResourceIdToSessionTokens.remove(rid); - this.collectionResourceIdToCollectionName.remove(rid); - this.collectionNameToCollectionResourceId.remove(collectionName); - } - } finally { - this.writeLock.unlock(); - } - } - } - - @Override - public void clearTokenByResourceId(String resourceId) { - if (!StringUtils.isEmpty(resourceId)) { - ResourceId resource = ResourceId.parse(resourceId); - if (resource.getDocumentCollection() != 0) { - Long rid = resource.getUniqueDocumentCollectionId(); - this.writeLock.lock(); - try { - if (this.collectionResourceIdToCollectionName.containsKey(rid)) { - String collectionName = this.collectionResourceIdToCollectionName.get(rid); - this.collectionResourceIdToSessionTokens.remove(rid); - this.collectionResourceIdToCollectionName.remove(rid); - this.collectionNameToCollectionResourceId.remove(collectionName); - } - } finally { - this.writeLock.unlock(); - } - } - } - } - - @Override - public void setSessionToken(RxDocumentServiceRequest request, Map responseHeaders) { - String token = responseHeaders.get(HttpConstants.HttpHeaders.SESSION_TOKEN); - - if (!Strings.isNullOrEmpty(token)) { - ValueHolder resourceId = ValueHolder.initialize(null); - ValueHolder collectionName = ValueHolder.initialize(null); - - if (shouldUpdateSessionToken(request, responseHeaders, resourceId, collectionName)) { - this.setSessionToken(resourceId.v, collectionName.v, token); - } - } - } - - @Override - public void setSessionToken(String collectionRid, String collectionFullName, Map responseHeaders) { - ResourceId resourceId = ResourceId.parse(collectionRid); - String collectionName = PathsHelper.getCollectionPath(collectionFullName); - String token = responseHeaders.get(HttpConstants.HttpHeaders.SESSION_TOKEN); - if (!Strings.isNullOrEmpty(token)) { - this.setSessionToken(resourceId, collectionName, token); - } - } - - private void setSessionToken(ResourceId resourceId, String collectionName, String token) { - String partitionKeyRangeId; - ISessionToken parsedSessionToken; - - String[] tokenParts = StringUtils.split(token, ':'); - partitionKeyRangeId = tokenParts[0]; - parsedSessionToken = SessionTokenHelper.parse(tokenParts[1]); - - logger.trace("Update Session token {} {} {}", resourceId.getUniqueDocumentCollectionId(), collectionName, parsedSessionToken); - - boolean isKnownCollection; - - this.readLock.lock(); - try { - isKnownCollection = this.collectionNameToCollectionResourceId.containsKey(collectionName) && - this.collectionResourceIdToCollectionName.containsKey(resourceId.getUniqueDocumentCollectionId()) && - this.collectionNameToCollectionResourceId.get(collectionName) == resourceId.getUniqueDocumentCollectionId() && - this.collectionResourceIdToCollectionName.get(resourceId.getUniqueDocumentCollectionId()).equals(collectionName); - if (isKnownCollection) { - this.addSessionToken(resourceId, partitionKeyRangeId, parsedSessionToken); - } - } finally { - this.readLock.unlock(); - } - - if (!isKnownCollection) { - this.writeLock.lock(); - try { - if (collectionName != null && resourceId.getUniqueDocumentCollectionId() != 0) { - this.collectionNameToCollectionResourceId.compute(collectionName, (k, v) -> resourceId.getUniqueDocumentCollectionId()); - this.collectionResourceIdToCollectionName.compute(resourceId.getUniqueDocumentCollectionId(), (k, v) -> collectionName); - } - addSessionToken(resourceId, partitionKeyRangeId, parsedSessionToken); - } finally { - this.writeLock.unlock(); - } - } - } - - private void addSessionToken(ResourceId resourceId, String partitionKeyRangeId, ISessionToken parsedSessionToken) { - this.collectionResourceIdToSessionTokens.compute( - resourceId.getUniqueDocumentCollectionId(), (k, existingTokens) -> { - if (existingTokens == null) { - ConcurrentHashMap tokens = new ConcurrentHashMap<>(); - tokens.put(partitionKeyRangeId, parsedSessionToken); - return tokens; - } - - existingTokens.merge(partitionKeyRangeId, parsedSessionToken, (existingSessionTokens, newSessionToken) -> { - try { - if (existingSessionTokens == null) { - return newSessionToken; - } - - return existingSessionTokens.merge(newSessionToken); - } catch (DocumentClientException e) { - throw new IllegalStateException(e); - } - }); - - return existingTokens; - } - ); - } - - private static String getCombinedSessionToken(ConcurrentHashMap tokens) { - StringBuilder result = new StringBuilder(); - if (tokens != null) { - for (Iterator> iterator = tokens.entrySet().iterator(); iterator.hasNext(); ) { - Entry entry = iterator.next(); - result = result.append(entry.getKey()).append(":").append(entry.getValue().convertToString()); - if (iterator.hasNext()) { - result = result.append(","); - } - } - } - - return result.toString(); - } - - private static boolean shouldUpdateSessionToken( - RxDocumentServiceRequest request, - Map responseHeaders, - ValueHolder resourceId, - ValueHolder collectionName) { - resourceId.v = null; - String ownerFullName = responseHeaders.get(HttpConstants.HttpHeaders.OWNER_FULL_NAME); - if (Strings.isNullOrEmpty(ownerFullName)) ownerFullName = request.getResourceAddress(); - - collectionName.v = PathsHelper.getCollectionPath(ownerFullName); - String resourceIdString; - - if (!request.getIsNameBased()) { - resourceIdString = request.getResourceId(); - } else { - resourceIdString = responseHeaders.get(HttpConstants.HttpHeaders.OWNER_ID); - if (Strings.isNullOrEmpty(resourceIdString)) resourceIdString = request.getResourceId(); - } - - if (!Strings.isNullOrEmpty(resourceIdString)) { - resourceId.v = ResourceId.parse(resourceIdString); - - if (resourceId.v.getDocumentCollection() != 0 && - collectionName != null && - !ReplicatedResourceClientUtils.isReadingFromMaster(request.getResourceType(), request.getOperationType())) { - return true; - } - } - - return false; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/SessionTokenHelper.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/SessionTokenHelper.java deleted file mode 100644 index 5906ade34050..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/SessionTokenHelper.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import org.apache.commons.lang3.StringUtils; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -import static com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; - -/** - * Used internally to provides helper functions to work with session tokens in the Azure Cosmos DB database service. - */ -public class SessionTokenHelper { - - public static void setOriginalSessionToken(RxDocumentServiceRequest request, String originalSessionToken) { - if (request == null) { - throw new IllegalArgumentException("request is null"); - } - - if (originalSessionToken == null) { - request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN); - } else { - request.getHeaders().put(HttpConstants.HttpHeaders.SESSION_TOKEN, originalSessionToken); - } - } - - public static void setPartitionLocalSessionToken(RxDocumentServiceRequest request, ISessionContainer sessionContainer) throws DocumentClientException { - String originalSessionToken = request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); - String partitionKeyRangeId = request.requestContext.resolvedPartitionKeyRange.getId(); - - - if (Strings.isNullOrEmpty(partitionKeyRangeId)) { - // AddressCache/address resolution didn't produce partition key range id. - // In this case it is a bug. - throw new InternalServerErrorException(RMResources.PartitionKeyRangeIdAbsentInContext); - } - - if (StringUtils.isNotEmpty(originalSessionToken)) { - ISessionToken sessionToken = getLocalSessionToken(request, originalSessionToken, partitionKeyRangeId); - request.requestContext.sessionToken = sessionToken; - } else { - // use ambient session token. - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, partitionKeyRangeId); - request.requestContext.sessionToken = sessionToken; - } - - if (request.requestContext.sessionToken == null) { - request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN); - } else { - request.getHeaders().put(HttpConstants.HttpHeaders.SESSION_TOKEN, - String.format("%1s:%2s", partitionKeyRangeId, request.requestContext.sessionToken.convertToString())); - } - } - - private static ISessionToken getLocalSessionToken( - RxDocumentServiceRequest request, - String globalSessionToken, - String partitionKeyRangeId) throws DocumentClientException { - - if (partitionKeyRangeId == null || partitionKeyRangeId.isEmpty()) { - // AddressCache/address resolution didn't produce partition key range id. - // In this case it is a bug. - throw new IllegalStateException("Partition key range Id is absent in the context."); - } - - // Convert global session token to local - there's no point in sending global token over the wire to the backend. - // Global session token is comma separated array of : pairs. For example: - // 2:425344,748:2341234,99:42344 - // Local session token is single : pair. - // Backend only cares about pair which relates to the range owned by the partition. - String[] localTokens = StringUtils.split(globalSessionToken, ","); - Set partitionKeyRangeSet = new HashSet<>(); - partitionKeyRangeSet.add(partitionKeyRangeId); - - ISessionToken highestSessionToken = null; - - if (request.requestContext.resolvedPartitionKeyRange != null && request.requestContext.resolvedPartitionKeyRange.getParents() != null) { - partitionKeyRangeSet.addAll(request.requestContext.resolvedPartitionKeyRange.getParents()); - } - - for (String localToken : localTokens) { - String[] items = StringUtils.split(localToken, ":"); - if (items.length != 2) { - throw new BadRequestException(String.format(RMResources.InvalidSessionToken, partitionKeyRangeId)); - } - - ISessionToken parsedSessionToken = SessionTokenHelper.parse(items[1]); - - if (partitionKeyRangeSet.contains(items[0])) { - - if (highestSessionToken == null) { - highestSessionToken = parsedSessionToken; - } else { - highestSessionToken = highestSessionToken.merge(parsedSessionToken); - } - - } - } - - return highestSessionToken; - } - - static ISessionToken resolvePartitionLocalSessionToken(RxDocumentServiceRequest request, - String partitionKeyRangeId, - ConcurrentHashMap rangeIdToTokenMap) { - if (rangeIdToTokenMap != null) { - if (rangeIdToTokenMap.containsKey(partitionKeyRangeId)) { - return rangeIdToTokenMap.get(partitionKeyRangeId); - } else { - Collection parents = request.requestContext.resolvedPartitionKeyRange.getParents(); - if (parents != null) { - List parentsList = new ArrayList<>(parents); - for (int i = parentsList.size() - 1; i >= 0; i--) { - String parentId = parentsList.get(i); - if (rangeIdToTokenMap.containsKey(parentId)) { - return rangeIdToTokenMap.get(parentId); - } - } - } - } - } - - return null; - } - - public static ISessionToken parse(String sessionToken) { - ValueHolder partitionKeyRangeSessionToken = ValueHolder.initialize(null); - - if (SessionTokenHelper.tryParse(sessionToken, partitionKeyRangeSessionToken)) { - return partitionKeyRangeSessionToken.v; - } else { - throw new RuntimeException(new BadRequestException(String.format(RMResources.InvalidSessionToken, sessionToken))); - } - } - - static boolean tryParse(String sessionToken, ValueHolder parsedSessionToken) { - parsedSessionToken.v = null; - if (!Strings.isNullOrEmpty(sessionToken)) { - String[] sessionTokenSegments = StringUtils.split(sessionToken,":"); - return VectorSessionToken.tryCreate(sessionTokenSegments[sessionTokenSegments.length - 1], parsedSessionToken); - } else { - return false; - } - } - - public static void validateAndRemoveSessionToken(RxDocumentServiceRequest request) throws DocumentClientException { - String sessionToken = request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); - if (!Strings.isNullOrEmpty(sessionToken)) { - getLocalSessionToken(request, sessionToken, StringUtils.EMPTY); - request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN); - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/UserAgentContainer.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/UserAgentContainer.java deleted file mode 100644 index 5f11ff50fe5f..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/UserAgentContainer.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -/** - * Used internally. The user agent object, which is used to track the version of the Java SDK of the Azure Cosmos DB database service. - */ -public class UserAgentContainer { - - private static final int MAX_SUFFIX_LENGTH = 64; - private final String baseUserAgent; - private String suffix; - private String userAgent; - - private UserAgentContainer(String sdkName, String sdkVersion) { - this.baseUserAgent = Utils.getUserAgent(sdkName, sdkVersion); - this.suffix = ""; - this.userAgent = baseUserAgent; - } - - public UserAgentContainer() { - this(HttpConstants.Versions.SDK_NAME, HttpConstants.Versions.SDK_VERSION); - } - - public String getSuffix() { - return this.suffix; - } - - public void setSuffix(String suffix) { - if (suffix.length() > MAX_SUFFIX_LENGTH) { - suffix = suffix.substring(0, MAX_SUFFIX_LENGTH); - } - - this.suffix = suffix; - this.userAgent = baseUserAgent.concat(this.suffix); - } - - public String getUserAgent() { - return this.userAgent; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/VectorSessionToken.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/VectorSessionToken.java deleted file mode 100644 index f3b04712dbda..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/VectorSessionToken.java +++ /dev/null @@ -1,322 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import org.apache.commons.collections4.map.UnmodifiableMap; -import org.apache.commons.lang3.ObjectUtils; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.HashMap; -import java.util.Map; -import java.util.stream.Collectors; - -import static com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; - -/** - * Models vector clock bases session token. Session token has the following format: - * {Version}#{GlobalLSN}#{RegionId1}={LocalLsn1}#{RegionId2}={LocalLsn2}....#{RegionIdN}={LocalLsnN} - * 'Version' captures the configuration number of the partition which returned this session token. - * 'Version' is incremented everytime topology of the partition is updated (say due to Add/Remove/Failover). - * * The choice of separators '#' and '=' is important. Separators ';' and ',' are used to delimit - * per-partitionKeyRange session token - * session - * - * We make assumption that instances of this class are immutable (read only after they are constructed), so if you want to change - * this behaviour please review all of its uses and make sure that mutability doesn't break anything. - */ -public class VectorSessionToken implements ISessionToken { - private final static Logger logger = LoggerFactory.getLogger(VectorSessionToken.class); - private final static char SegmentSeparator = '#'; - private final static char RegionProgressSeparator = '='; - - private final long version; - private final long globalLsn; - private final UnmodifiableMap localLsnByRegion; - private final String sessionToken; - - private VectorSessionToken(long version, long globalLsn, UnmodifiableMap localLsnByRegion) { - this(version, globalLsn, localLsnByRegion, null); - } - - private VectorSessionToken(long version, long globalLsn, UnmodifiableMap localLsnByRegion, String sessionToken) { - this.version = version; - this.globalLsn = globalLsn; - this.localLsnByRegion = localLsnByRegion; - if (sessionToken == null) { - String regionProgress = String.join( - Character.toString(VectorSessionToken.SegmentSeparator), - localLsnByRegion. - entrySet() - .stream() - .map(kvp -> new StringBuilder().append(kvp.getKey()).append(VectorSessionToken.RegionProgressSeparator).append(kvp.getValue())) - .collect(Collectors.toList())); - - if (Strings.isNullOrEmpty(regionProgress)) { - StringBuilder sb = new StringBuilder(); - sb.append(this.version) - .append(VectorSessionToken.SegmentSeparator) - .append(this.globalLsn); - this.sessionToken = sb.toString(); - } else { - StringBuilder sb = new StringBuilder(); - sb.append(this.version) - .append(VectorSessionToken.SegmentSeparator) - .append(this.globalLsn) - .append(VectorSessionToken.SegmentSeparator) - .append(regionProgress); - this.sessionToken = sb.toString(); - } - } else { - this.sessionToken = sessionToken; - } - } - - public static boolean tryCreate(String sessionToken, ValueHolder parsedSessionToken) { - ValueHolder versionHolder = ValueHolder.initialize(-1l); - ValueHolder globalLsnHolder = ValueHolder.initialize(-1l); - - ValueHolder> localLsnByRegion = ValueHolder.initialize(null); - - if (VectorSessionToken.tryParseSessionToken( - sessionToken, - versionHolder, - globalLsnHolder, - localLsnByRegion)) { - parsedSessionToken.v = new VectorSessionToken(versionHolder.v, globalLsnHolder.v, localLsnByRegion.v, sessionToken); - return true; - } else { - return false; - } - } - - public long getLSN() { - return this.globalLsn; - } - - @Override - public boolean equals(Object obj) { - VectorSessionToken other = Utils.as(obj, VectorSessionToken.class); - - if (other == null) { - return false; - } - - return this.version == other.version - && this.globalLsn == other.globalLsn - && this.areRegionProgressEqual(other.localLsnByRegion); - } - - public boolean isValid(ISessionToken otherSessionToken) throws DocumentClientException { - VectorSessionToken other = Utils.as(otherSessionToken, VectorSessionToken.class); - - if (other == null) { - throw new IllegalArgumentException("otherSessionToken"); - } - - if (other.version < this.version || other.globalLsn < this.globalLsn) { - return false; - } - - if (other.version == this.version && other.localLsnByRegion.size() != this.localLsnByRegion.size()) { - throw new InternalServerErrorException( - String.format(RMResources.InvalidRegionsInSessionToken, this.sessionToken, other.sessionToken)); - } - - for (Map.Entry kvp : other.localLsnByRegion.entrySet()) { - Integer regionId = kvp.getKey(); - long otherLocalLsn = kvp.getValue(); - ValueHolder localLsn = ValueHolder.initialize(-1l); - - - if (!Utils.tryGetValue(this.localLsnByRegion, regionId, localLsn)) { - // Region mismatch: other session token has progress for a region which is missing in this session token - // Region mismatch can be ignored only if this session token version is smaller than other session token version - if (this.version == other.version) { - throw new InternalServerErrorException( - String.format(RMResources.InvalidRegionsInSessionToken, this.sessionToken, other.sessionToken)); - } else { - // ignore missing region as other session token version > this session token version - } - } else { - // region is present in both session tokens. - if (otherLocalLsn < localLsn.v) { - return false; - } - } - } - - return true; - } - - // Merge is commutative operation, so a.Merge(b).Equals(b.Merge(a)) - public ISessionToken merge(ISessionToken obj) throws DocumentClientException { - VectorSessionToken other = Utils.as(obj, VectorSessionToken.class); - - if (other == null) { - throw new IllegalArgumentException("obj"); - } - - if (this.version == other.version && this.localLsnByRegion.size() != other.localLsnByRegion.size()) { - throw new InternalServerErrorException( - String.format(RMResources.InvalidRegionsInSessionToken, this.sessionToken, other.sessionToken)); - } - - VectorSessionToken sessionTokenWithHigherVersion; - VectorSessionToken sessionTokenWithLowerVersion; - - if (this.version < other.version) { - sessionTokenWithLowerVersion = this; - sessionTokenWithHigherVersion = other; - } else { - sessionTokenWithLowerVersion = other; - sessionTokenWithHigherVersion = this; - } - - Map highestLocalLsnByRegion = new HashMap<>(); - - for (Map.Entry kvp : sessionTokenWithHigherVersion.localLsnByRegion.entrySet()) { - Integer regionId = kvp.getKey(); - - long localLsn1 = kvp.getValue(); - ValueHolder localLsn2 = ValueHolder.initialize(-1l); - - if (Utils.tryGetValue(sessionTokenWithLowerVersion.localLsnByRegion, regionId, localLsn2)) { - highestLocalLsnByRegion.put(regionId, Math.max(localLsn1, localLsn2.v)); - } else if (this.version == other.version) { - throw new InternalServerErrorException( - String.format(RMResources.InvalidRegionsInSessionToken, this.sessionToken, other.sessionToken)); - } else { - highestLocalLsnByRegion.put(regionId, localLsn1); - } - } - - return new VectorSessionToken( - Math.max(this.version, other.version), - Math.max(this.globalLsn, other.globalLsn), - (UnmodifiableMap) UnmodifiableMap.unmodifiableMap(highestLocalLsnByRegion)); - } - - public String convertToString() { - return this.sessionToken; - } - - private boolean areRegionProgressEqual(UnmodifiableMap other) { - if (this.localLsnByRegion.size() != other.size()) { - return false; - } - - for (Map.Entry kvp : this.localLsnByRegion.entrySet()) { - Integer regionId = kvp.getKey(); - ValueHolder localLsn1 = ValueHolder.initialize(kvp.getValue()); - ValueHolder localLsn2 = ValueHolder.initialize(-1l); - - if (Utils.tryGetValue(other, regionId, localLsn2)) { - if (ObjectUtils.notEqual(localLsn1.v, localLsn2.v)) { - return false; - } - } - } - - return true; - } - - private static boolean tryParseSessionToken( - String sessionToken, - ValueHolder version, - ValueHolder globalLsn, - ValueHolder> localLsnByRegion) { - version.v = 0L; - localLsnByRegion.v = null; - globalLsn.v = -1L; - - if (Strings.isNullOrEmpty(sessionToken)) { - logger.warn("Session token is empty"); - return false; - } - - String[] segments = StringUtils.split(sessionToken, VectorSessionToken.SegmentSeparator); - - if (segments.length < 2) { - return false; - } - - if (!tryParseLong(segments[0], version) - || !tryParseLong(segments[1], globalLsn)) { - logger.warn("Unexpected session token version number '{}' OR global lsn '{}'.", segments[0], segments[1]); - return false; - } - - Map lsnByRegion = new HashMap<>(); - - for (int i = 2; i < segments.length; i++) { - String regionSegment = segments[i]; - - String[] regionIdWithLsn = StringUtils.split(regionSegment, VectorSessionToken.RegionProgressSeparator); - - if (regionIdWithLsn.length != 2) { - logger.warn("Unexpected region progress segment length '{}' in session token.", regionIdWithLsn.length); - return false; - } - - ValueHolder regionId = ValueHolder.initialize(0); - ValueHolder localLsn = ValueHolder.initialize(-1l); - - if (!tryParseInt(regionIdWithLsn[0], regionId) - || !tryParseLong(regionIdWithLsn[1], localLsn)) { - logger.warn("Unexpected region progress '{}' for region '{}' in session token.", regionIdWithLsn[0], regionIdWithLsn[1]); - return false; - } - - lsnByRegion.put(regionId.v, localLsn.v); - } - - localLsnByRegion.v = (UnmodifiableMap) UnmodifiableMap.unmodifiableMap(lsnByRegion); - return true; - } - - private static boolean tryParseLong(String str, ValueHolder value) { - try { - value.v = Long.parseLong(str); - return true; - } catch (Exception e) { - return false; - } - } - - private static boolean tryParseInt(String str, ValueHolder value) { - try { - value.v = Integer.parseInt(str); - return true; - } catch (Exception e) { - return false; - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/WebExceptionUtility.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/WebExceptionUtility.java deleted file mode 100644 index c90fdf1e1b47..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/WebExceptionUtility.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import io.netty.channel.ChannelException; -import io.reactivex.netty.client.PoolExhaustedException; - -import javax.net.ssl.SSLHandshakeException; -import javax.net.ssl.SSLPeerUnverifiedException; -import java.io.IOException; -import java.net.ConnectException; -import java.net.NoRouteToHostException; -import java.net.UnknownHostException; - -public class WebExceptionUtility { - public static boolean isWebExceptionRetriable(Exception ex) { - Exception iterator = ex; - - while (iterator != null) { - if (WebExceptionUtility.isWebExceptionRetriableInternal(iterator)) { - return true; - } - - Throwable t = iterator.getCause(); - iterator = Utils.as(t, Exception.class); - } - - return false; - } - - private static boolean isWebExceptionRetriableInternal(Exception ex) { - if (ex instanceof PoolExhaustedException) { - return true; - } - - IOException webEx = Utils.as(ex, IOException.class); - if (webEx == null) { - return false; - } - - // any network failure for which we are certain the request hasn't reached the service endpoint. - if (webEx instanceof ConnectException || - webEx instanceof UnknownHostException || - webEx instanceof SSLHandshakeException || - webEx instanceof NoRouteToHostException || - webEx instanceof SSLPeerUnverifiedException) { - return true; - } - - return false; - } - - public static boolean isNetworkFailure(Exception ex) { - Exception iterator = ex; - - while (iterator != null) { - if (WebExceptionUtility.isNetworkFailureInternal(iterator)) { - return true; - } - - Throwable t = iterator.getCause(); - iterator = Utils.as(t, Exception.class); - } - - return false; - } - - private static boolean isNetworkFailureInternal(Exception ex) { - if (ex instanceof IOException) { - return true; - } - - if (ex instanceof ChannelException) { - return true; - } - - return false; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/ExceptionHelper.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/ExceptionHelper.java deleted file mode 100644 index 1bf8481c9add..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/ExceptionHelper.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query; - -import java.util.concurrent.ExecutionException; - -class ExceptionHelper { - - private ExceptionHelper() {} - - public static Throwable unwrap(Throwable e) { - if (e.getCause() == null) { - return e; - } - if (e instanceof IllegalStateException || e instanceof ExecutionException) { - return unwrap(e.getCause()); - } - return e; - } - - public static Throwable unwrapIllegalStateException(Exception e) { - if (e instanceof IllegalStateException && e.getCause() != null) { - return e.getCause(); - } - return e; - } - - public static Throwable unwrapExecutionException(Exception e) { - if (e instanceof RuntimeException && e.getCause() != null) { - return e.getCause(); - } - return e; - } - - public static RuntimeException toRuntimeException(Throwable e) { - if (e instanceof RuntimeException) { - return (RuntimeException) e; - } - throw new IllegalStateException(e); - } - -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/ItemComparator.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/ItemComparator.java deleted file mode 100644 index a3f35ee181f3..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/ItemComparator.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query; - -import java.util.Comparator; - -public final class ItemComparator implements Comparator { - private ItemComparator() { - } - - private static class SingletonHelper { - private static final ItemComparator INSTANCE = new ItemComparator(); - } - - public static ItemComparator getInstance() { - return SingletonHelper.INSTANCE; - } - - @Override - public int compare(Object obj1, Object obj2) { - ItemType type1 = ItemTypeHelper.getOrderByItemType(obj1); - ItemType type2 = ItemTypeHelper.getOrderByItemType(obj2); - - int cmp = Integer.compare(type1.getVal(), type2.getVal()); - - if (cmp != 0) { - return cmp; - } - - switch (type1) { - case NoValue: - case Null: - return 0; - case Boolean: - return Boolean.compare((Boolean) obj1, (Boolean) obj2); - case Number: - return Double.compare(((Number) obj1).doubleValue(), ((Number) obj2).doubleValue()); - case String: - return ((String) obj1).compareTo((String) obj2); - default: - throw new ClassCastException(String.format("Unexpected type: %s", type1.toString())); - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/ItemType.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/ItemType.java deleted file mode 100644 index 508e8f7cdd9d..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/ItemType.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query; - -public enum ItemType { - NoValue(0x0), Null(0x1), Boolean(0x2), Number(0x4), String(0x5); - - private final int val; - - ItemType(int val) { - this.val = val; - } - - public int getVal() { - return this.val; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/ItemTypeHelper.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/ItemTypeHelper.java deleted file mode 100644 index 9798739b6ea5..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/ItemTypeHelper.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query; - -import com.microsoft.azure.cosmosdb.Undefined; - -public final class ItemTypeHelper { - public static ItemType getOrderByItemType(Object obj) { - if (obj == null) { - return ItemType.Null; - } - - if (obj instanceof Undefined) { - return ItemType.NoValue; - } - - if (obj instanceof Boolean) { - return ItemType.Boolean; - } - - if (obj instanceof Number) { - return ItemType.Number; - } - - if (obj instanceof String) { - return ItemType.String; - } - - throw new IllegalArgumentException(String.format("Unexpected type: %s", obj.getClass().toString())); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/PartitionedQueryExecutionInfo.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/PartitionedQueryExecutionInfo.java deleted file mode 100644 index 5bcf61ef9ba2..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/PartitionedQueryExecutionInfo.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query; - -import java.util.List; - -import com.microsoft.azure.cosmosdb.JsonSerializable; -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.routing.Range; - -/** - * Used internally to encapsulates execution information for a query in the Azure Cosmos DB database service. - */ -public final class PartitionedQueryExecutionInfo extends JsonSerializable { - @SuppressWarnings("unchecked") - private static final Class> QUERY_RANGES_CLASS = (Class>) Range - .getEmptyRange((String) null).getClass(); - - private QueryInfo queryInfo; - private List> queryRanges; - - PartitionedQueryExecutionInfo(QueryInfo queryInfo, List> queryRanges) { - this.queryInfo = queryInfo; - this.queryRanges = queryRanges; - - super.set( - PartitionedQueryExecutionInfoInternal.PARTITIONED_QUERY_EXECUTION_INFO_VERSION_PROPERTY, - Constants.PartitionedQueryExecutionInfo.VERSION_1); - } - - public PartitionedQueryExecutionInfo(String jsonString) { - super(jsonString); - } - - public int getVersion() { - return super.getInt(PartitionedQueryExecutionInfoInternal.PARTITIONED_QUERY_EXECUTION_INFO_VERSION_PROPERTY); - } - - public QueryInfo getQueryInfo() { - return this.queryInfo != null ? this.queryInfo - : (this.queryInfo = super.getObject( - PartitionedQueryExecutionInfoInternal.QUERY_INFO_PROPERTY, QueryInfo.class)); - } - - public List> getQueryRanges() { - return this.queryRanges != null ? this.queryRanges - : (this.queryRanges = super.getList( - PartitionedQueryExecutionInfoInternal.QUERY_RANGES_PROPERTY, QUERY_RANGES_CLASS)); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/PartitionedQueryExecutionInfoInternal.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/PartitionedQueryExecutionInfoInternal.java deleted file mode 100644 index cd4e4d673ebc..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/PartitionedQueryExecutionInfoInternal.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query; - -import java.util.List; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.microsoft.azure.cosmosdb.JsonSerializable; -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternal; -import com.microsoft.azure.cosmosdb.internal.routing.Range; - -public final class PartitionedQueryExecutionInfoInternal extends JsonSerializable { - static final String QUERY_INFO_PROPERTY = "queryInfo"; - static final String QUERY_RANGES_PROPERTY = "queryRanges"; - static final String PARTITIONED_QUERY_EXECUTION_INFO_VERSION_PROPERTY = "partitionedQueryExecutionInfoVersion"; - - @SuppressWarnings("unchecked") - private static final Class> QUERY_RANGE_CLASS = (Class>) Range - .getEmptyRange((PartitionKeyInternal) null).getClass(); - - private QueryInfo queryInfo; - private List> queryRanges; - - public PartitionedQueryExecutionInfoInternal() { - super.set(PARTITIONED_QUERY_EXECUTION_INFO_VERSION_PROPERTY, Constants.PartitionedQueryExecutionInfo.VERSION_1); - } - - public PartitionedQueryExecutionInfoInternal(String jsonString) { - super(jsonString); - } - - public int getVersion() { - return super.getInt(PARTITIONED_QUERY_EXECUTION_INFO_VERSION_PROPERTY); - } - - public QueryInfo getQueryInfo() { - return this.queryInfo != null ? this.queryInfo - : (this.queryInfo = super.getObject(QUERY_INFO_PROPERTY, QueryInfo.class)); - } - - public void setQueryInfo(QueryInfo queryInfo) { - this.queryInfo = queryInfo; - } - - public List> getQueryRanges() { - return this.queryRanges != null ? this.queryRanges - : (this.queryRanges = super.getList(QUERY_RANGES_PROPERTY, QUERY_RANGE_CLASS)); - } - - public void setQueryRanges(List> queryRanges) { - this.queryRanges = queryRanges; - } - - public String toJson() { - try { - return Utils.getSimpleObjectMapper().writeValueAsString(this); - } catch (JsonProcessingException e) { - throw new IllegalStateException("Unable to serialize partition query execution info internal."); - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/QueryInfo.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/QueryInfo.java deleted file mode 100644 index 666011b837da..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/QueryInfo.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query; - -import java.util.Collection; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.microsoft.azure.cosmosdb.JsonSerializable; -import com.microsoft.azure.cosmosdb.internal.query.aggregation.AggregateOperator; - -/** - * Used internally to encapsulates a query's information in the Azure Cosmos DB database service. - */ -public final class QueryInfo extends JsonSerializable { - private Integer top; - private List orderBy; - private Collection aggregates; - private Collection orderByExpressions; - private String rewrittenQuery; - - public QueryInfo() { } - - public QueryInfo(String jsonString) { - super(jsonString); - } - - public Integer getTop() { - return this.top != null ? this.top : (this.top = super.getInt("top")); - } - - public List getOrderBy() { - return this.orderBy != null ? this.orderBy : (this.orderBy = super.getList("orderBy", SortOrder.class)); - } - - public String getRewrittenQuery() { - return this.rewrittenQuery != null ? this.rewrittenQuery - : (this.rewrittenQuery = super.getString("rewrittenQuery")); - } - - public boolean hasTop() { - return this.getTop() != null; - } - - public boolean hasOrderBy() { - Collection orderBy = this.getOrderBy(); - return orderBy != null && orderBy.size() > 0; - } - - public boolean hasRewrittenQuery() { - return !StringUtils.isEmpty(this.getRewrittenQuery()); - } - - public boolean hasAggregates() { - Collection aggregates = this.getAggregates(); - return aggregates != null && aggregates.size() > 0; - } - - public Collection getAggregates() { - return this.aggregates != null - ? this.aggregates - : (this.aggregates = super.getCollection("aggregates", AggregateOperator.class)); - } - - public Collection getOrderByExpressions() { - return this.orderByExpressions != null - ? this.orderByExpressions - : (this.orderByExpressions = super.getCollection("orderByExpressions", String.class)); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/QueryItem.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/QueryItem.java deleted file mode 100644 index e9756aa55161..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/QueryItem.java +++ /dev/null @@ -1,48 +0,0 @@ - -/** - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query; - -import com.microsoft.azure.cosmosdb.JsonSerializable; -import com.microsoft.azure.cosmosdb.Undefined; - -/** - * Used internally for query in the Azure Cosmos DB database service. - */ -public final class QueryItem extends JsonSerializable { - private Object item; - - public QueryItem(String jsonString) { - super(jsonString); - } - - public Object getItem() { - if (this.item == null) { - Object rawItem = super.get("item"); - this.item = super.has("item") ? rawItem : Undefined.Value(); - } - - return this.item; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/SortOrder.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/SortOrder.java deleted file mode 100644 index af02ac9530ab..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/SortOrder.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query; - -/** - * Sort order in the Azure Cosmos DB database service. - */ -public enum SortOrder { - Ascending, Descending, -} \ No newline at end of file diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/AggregateOperator.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/AggregateOperator.java deleted file mode 100644 index 18b9b7edeb8b..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/AggregateOperator.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query.aggregation; - -public enum AggregateOperator { - Average, - Count, - Max, - Min, - Sum -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/Aggregator.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/Aggregator.java deleted file mode 100644 index ea4ad348f5ec..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/Aggregator.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query.aggregation; - -public interface Aggregator { - void aggregate(Object item); - - Object getResult(); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/AverageAggregator.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/AverageAggregator.java deleted file mode 100644 index d2b66dd60826..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/AverageAggregator.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query.aggregation; - -import java.io.IOException; - -import com.microsoft.azure.cosmosdb.Undefined; -import com.microsoft.azure.cosmosdb.internal.Utils; - -public class AverageAggregator implements Aggregator { - private AverageInfo averageInfo; - - public AverageAggregator() { - this.averageInfo = new AverageInfo(); - } - - @Override - public void aggregate(Object item) { - AverageInfo averageInfo; - try { - averageInfo = Utils.getSimpleObjectMapper().readValue(item.toString(), AverageInfo.class); - } catch (IOException e) { - throw new IllegalStateException("Failed to deserialize aggregate result"); - } - this.averageInfo.add(averageInfo); - } - - @Override - public Object getResult() { - return this.averageInfo.getAverage(); - } - - private static class AverageInfo { - public Double sum; - public long count; - - public void add(AverageInfo other) { - if (other == null) { - throw new IllegalArgumentException("other"); - } - if (other.sum == null) { - return; - } - if (this.sum == null) { - this.sum = 0.0; - } - - this.sum += other.sum; - this.count += other.count; - } - - Object getAverage() { - if (this.sum == null || this.count <= 0) { - return Undefined.Value(); - } - return this.sum / this.count; - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/CountAggregator.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/CountAggregator.java deleted file mode 100644 index 2589f0699006..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/CountAggregator.java +++ /dev/null @@ -1,39 +0,0 @@ - -/** - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query.aggregation; - -public class CountAggregator implements Aggregator { - private long value; - - @Override - public void aggregate(Object item) { - value += Long.parseLong(item.toString()); - } - - @Override - public Object getResult() { - return value; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/MaxAggregator.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/MaxAggregator.java deleted file mode 100644 index fc3ba6d86094..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/MaxAggregator.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query.aggregation; - -import com.microsoft.azure.cosmosdb.Undefined; -import com.microsoft.azure.cosmosdb.internal.query.ItemComparator; - -public class MaxAggregator implements Aggregator { - private Object value; - - public MaxAggregator() { - this.value = Undefined.Value(); - } - - @Override - public void aggregate(Object item) { - if (Undefined.Value().equals(this.value)) { - this.value = item; - } else if (ItemComparator.getInstance().compare(item, this.value) > 0) { - this.value = item; - } - - } - - @Override - public Object getResult() { - return this.value; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/MinAggregator.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/MinAggregator.java deleted file mode 100644 index 344b24f3ba80..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/MinAggregator.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query.aggregation; - -import com.microsoft.azure.cosmosdb.Undefined; -import com.microsoft.azure.cosmosdb.internal.query.ItemComparator; - -public class MinAggregator implements Aggregator { - private Object value; - - public MinAggregator() { - this.value = Undefined.Value(); - } - - @Override - public void aggregate(Object item) { - if (Undefined.Value().equals(this.value)) { - this.value = item; - } else if (ItemComparator.getInstance().compare(item, this.value) < 0) { - this.value = item; - } - } - - @Override - public Object getResult() { - return this.value; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/SumAggregator.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/SumAggregator.java deleted file mode 100644 index ebf2b23437e0..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/aggregation/SumAggregator.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query.aggregation; - -import com.microsoft.azure.cosmosdb.Undefined; - -public class SumAggregator implements Aggregator { - private Double sum; - - @Override - public void aggregate(Object item) { - if (Undefined.Value().equals(item)) { - return; - } - - if (this.sum == null) { - this.sum = 0.0; - } - this.sum += ((Number) item).doubleValue(); - } - - @Override - public Object getResult() { - if (this.sum == null) { - return Undefined.Value(); - } - return this.sum; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/orderbyquery/OrderByRowResult.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/orderbyquery/OrderByRowResult.java deleted file mode 100644 index 18a0ffa102d0..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/orderbyquery/OrderByRowResult.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query.orderbyquery; - -import java.util.List; - -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.query.QueryItem; - -/** - * Represents the result of a query in the Azure Cosmos DB database service. - */ -public final class OrderByRowResult extends Document { - private final Class klass; - private volatile List orderByItems; - private volatile T payload; - private final PartitionKeyRange targetRange; - private final String backendContinuationToken; - - public OrderByRowResult( - Class klass, - String jsonString, - PartitionKeyRange targetRange, - String backendContinuationToken) { - super(jsonString); - this.klass = klass; - this.targetRange = targetRange; - this.backendContinuationToken = backendContinuationToken; - } - - public List getOrderByItems() { - return this.orderByItems != null ? this.orderByItems - : (this.orderByItems = super.getList("orderByItems", QueryItem.class)); - } - - public T getPayload() { - return this.payload != null ? this.payload : (this.payload = super.getObject("payload", klass)); - } - - public PartitionKeyRange getSourcePartitionKeyRange() { - return this.targetRange; - } - - public String getSourceBackendContinuationToken() { - return this.backendContinuationToken; - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/orderbyquery/OrderbyRowComparer.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/orderbyquery/OrderbyRowComparer.java deleted file mode 100644 index 7606c7262949..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/query/orderbyquery/OrderbyRowComparer.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.query.orderbyquery; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Comparator; -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.microsoft.azure.cosmosdb.internal.query.ItemComparator; -import com.microsoft.azure.cosmosdb.internal.query.ItemType; -import com.microsoft.azure.cosmosdb.internal.query.ItemTypeHelper; -import com.microsoft.azure.cosmosdb.internal.query.QueryItem; -import com.microsoft.azure.cosmosdb.internal.query.SortOrder; - -public final class OrderbyRowComparer implements Comparator> { - private static final Logger logger = LoggerFactory.getLogger(OrderbyRowComparer.class); - - private final List sortOrders; - private volatile List itemTypes; - - public OrderbyRowComparer(Collection sortOrders) { - this.sortOrders = new ArrayList<>(sortOrders); - } - - @Override - public int compare(OrderByRowResult r1, OrderByRowResult r2) { - try { - // comparing document (row) vs document (row) - List result1 = r1.getOrderByItems(); - List result2 = r2.getOrderByItems(); - - if (result1.size() != result2.size()) { - throw new IllegalStateException("OrderByItems cannot have different sizes."); - } - - if (result1.size() != this.sortOrders.size()) { - throw new IllegalStateException( - String.format("OrderByItems cannot have a different size than sort orders.")); - } - - if (this.itemTypes == null) { - synchronized (this) { - if (this.itemTypes == null) { - this.itemTypes = new ArrayList(result1.size()); - for (QueryItem item : result1) { - this.itemTypes.add(ItemTypeHelper.getOrderByItemType(item.getItem())); - } - } - } - } - - this.checkOrderByItemType(result1); - this.checkOrderByItemType(result2); - - for (int i = 0; i < result1.size(); ++i) { - int cmp = ItemComparator.getInstance().compare(result1.get(i).getItem(), result2.get(i).getItem()); - if (cmp != 0) { - switch (this.sortOrders.get(i)) { - case Ascending: - return cmp; - case Descending: - return -cmp; - } - } - } - - return r1.getSourcePartitionKeyRange().getMinInclusive().compareTo(r2.getSourcePartitionKeyRange().getMinInclusive()); - } catch (Exception e) { - // Due to a bug in rxjava-extras <= 0.8.0.15 dependency, - // if OrderbyRowComparer throws an unexpected exception, - // then the observable returned by Transformers.orderedMergeWith(.) will never emit a terminal event. - // rxjava-extras lib provided a quick fix on the bugreport: - // https://github.com/davidmoten/rxjava-extras/issues/30 (0.8.0.16) - // we are also capturing the exception stacktrace here - logger.error("Orderby Row comparision failed {}, {}", r1.toJson(), r2.toJson(), e); - throw e; - } - } - - private void checkOrderByItemType(List orderByItems) { - for (int i = 0; i < this.itemTypes.size(); ++i) { - ItemType type = ItemTypeHelper.getOrderByItemType(orderByItems.get(i).getItem()); - if (type != this.itemTypes.get(i)) { - throw new UnsupportedOperationException( - String.format("Expected %s, but got %s.", this.itemTypes.get(i).toString(), type.toString())); - } - } - } - - public List getSortOrders() { - return this.sortOrders; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/CaseInsensitiveHashMap.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/CaseInsensitiveHashMap.java deleted file mode 100644 index 086508469532..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/CaseInsensitiveHashMap.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.BiFunction; -import java.util.function.Function; - - -// TODO: commons-collections lib has CaseInsensitiveHashMap we should switch to that. -// https://commons.apache.org/proper/commons-collections/javadocs/api-3.2.2/org/apache/commons/collections/map/CaseInsensitiveMap.html -public class CaseInsensitiveHashMap extends HashMap { - - private static String safeToLower(String key) { - return key != null ? key.toLowerCase() : null; - } - - @Override - public V get(Object key) { - return super.get(safeToLower((String) key)); - } - - - @Override - public void putAll(Map m) { - super.putAll(m); - } - - @Override - public V put(String key, V value) { - return super.put(safeToLower(key), value); - } - - @Override - public V putIfAbsent(String key, V value) { - return super.putIfAbsent(safeToLower(key), value); - } - - @Override - public V compute(String key, BiFunction remappingFunction) { - return super.compute(safeToLower(key), remappingFunction); - } - - @Override - public V computeIfAbsent(String key, Function mappingFunction) { - return super.computeIfAbsent(safeToLower(key), mappingFunction); - } - - @Override - public V computeIfPresent(String key, BiFunction remappingFunction) { - return super.computeIfPresent(safeToLower(key), remappingFunction); - } - - @Override - public boolean containsKey(Object key) { - return super.containsKey(safeToLower((String) key)); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/CollectionRoutingMap.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/CollectionRoutingMap.java deleted file mode 100644 index 5cc477ac4694..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/CollectionRoutingMap.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.util.Collection; -import java.util.List; - -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import org.apache.commons.lang3.tuple.ImmutablePair; - -/** - * Used internally in request routing in the Azure Cosmos DB database service. - */ -public interface CollectionRoutingMap { - List getOrderedPartitionKeyRanges(); - - PartitionKeyRange getRangeByEffectivePartitionKey(String effectivePartitionKeyValue); - - PartitionKeyRange getRangeByPartitionKeyRangeId(String partitionKeyRangeId); - - Collection getOverlappingRanges(Range range); - - Collection getOverlappingRanges(Collection> providedPartitionKeyRanges); - - PartitionKeyRange tryGetRangeByPartitionKeyRangeId(String partitionKeyRangeId); - - IServerIdentity tryGetInfoByPartitionKeyRangeId(String partitionKeyRangeId); - - boolean IsGone(String partitionKeyRangeId); - - String getCollectionUniqueId(); - - CollectionRoutingMap tryCombine(List> ranges); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/IServerIdentity.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/IServerIdentity.java deleted file mode 100644 index ca5a849739e8..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/IServerIdentity.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -public interface IServerIdentity { -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/InMemoryCollectionRoutingMap.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/InMemoryCollectionRoutingMap.java deleted file mode 100644 index b17205ddd6e8..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/InMemoryCollectionRoutingMap.java +++ /dev/null @@ -1,258 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; -import java.util.stream.Collectors; - -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; - -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import org.apache.commons.lang3.tuple.Pair; - -/** - * Used internally to cache partition key ranges of a collection in the Azure Cosmos DB database service. - */ -public class InMemoryCollectionRoutingMap implements CollectionRoutingMap { - private final Map> rangeById; - private final List orderedPartitionKeyRanges; - private final List> orderedRanges; - - private final Set goneRanges; - - private String collectionUniqueId; - - private InMemoryCollectionRoutingMap(Map> rangeById, - List orderedPartitionKeyRanges, - String collectionUniqueId) { - this.rangeById = rangeById; - this.orderedPartitionKeyRanges = orderedPartitionKeyRanges; - this.orderedRanges = orderedPartitionKeyRanges.stream().map( - range -> - new Range<>( - range.getMinInclusive(), - range.getMaxExclusive(), - true, - false)).collect(Collectors.toList()); - - this.collectionUniqueId = collectionUniqueId; - this.goneRanges = new HashSet<>(orderedPartitionKeyRanges.stream().flatMap(r -> CollectionUtils.emptyIfNull(r.getParents()).stream()).collect(Collectors.toSet())); - - } - - public static InMemoryCollectionRoutingMap tryCreateCompleteRoutingMap( - Iterable> ranges, String collectionUniqueId) { - - Map> rangeById = - new HashMap<>(); - - for (ImmutablePair range: ranges) { - rangeById.put(range.left.getId(), range); - } - - List> sortedRanges = new ArrayList<>(rangeById.values()); - Collections.sort(sortedRanges, new MinPartitionKeyPairComparator()); - List orderedRanges = sortedRanges.stream().map(range -> range.left).collect(Collectors.toList()); - - if (!isCompleteSetOfRanges(orderedRanges)) { - return null; - } - - return new InMemoryCollectionRoutingMap(rangeById, orderedRanges, collectionUniqueId); - } - - private static boolean isCompleteSetOfRanges(List orderedRanges) { - boolean isComplete = false; - if (orderedRanges.size() > 0) { - PartitionKeyRange firstRange = orderedRanges.get(0); - PartitionKeyRange lastRange = orderedRanges.get(orderedRanges.size() - 1); - isComplete = firstRange.getMinInclusive() - .compareTo(PartitionKeyRange.MINIMUM_INCLUSIVE_EFFECTIVE_PARTITION_KEY) == 0; - isComplete &= lastRange.getMaxExclusive() - .compareTo(PartitionKeyRange.MAXIMUM_EXCLUSIVE_EFFECTIVE_PARTITION_KEY) == 0; - - for (int i = 1; i < orderedRanges.size(); i++) { - PartitionKeyRange previousRange = orderedRanges.get(i - 1); - PartitionKeyRange currentRange = orderedRanges.get(i); - isComplete &= previousRange.getMaxExclusive().compareTo(currentRange.getMinInclusive()) == 0; - - if (!isComplete) { - if (previousRange.getMaxExclusive().compareTo(currentRange.getMinInclusive()) > 0) { - throw new IllegalStateException("Ranges overlap"); - } - - break; - } - } - } - - return isComplete; - } - - public String getCollectionUniqueId() { - return collectionUniqueId; - } - - @Override - public List getOrderedPartitionKeyRanges() { - return this.orderedPartitionKeyRanges; - } - - @Override - public PartitionKeyRange getRangeByEffectivePartitionKey(String effectivePartitionKeyValue) { - if (PartitionKeyRange.MINIMUM_INCLUSIVE_EFFECTIVE_PARTITION_KEY.compareTo(effectivePartitionKeyValue) == 0) { - return this.orderedPartitionKeyRanges.get(0); - } - - if (PartitionKeyRange.MAXIMUM_EXCLUSIVE_EFFECTIVE_PARTITION_KEY.compareTo(effectivePartitionKeyValue) == 0) { - return null; - } - - int index = Collections.binarySearch(this.orderedRanges, Range.getPointRange(effectivePartitionKeyValue), - new Range.MinComparator()); - - if (index < 0) { - index = Math.max(0, -index - 2); - } - - return this.orderedPartitionKeyRanges.get(index); - } - - @Override - public PartitionKeyRange getRangeByPartitionKeyRangeId(String partitionKeyRangeId) { - ImmutablePair pair = this.rangeById.get(partitionKeyRangeId); - return pair == null ? null : pair.left; - } - - - @Override - public Collection getOverlappingRanges(Range range) { - return this.getOverlappingRanges(Collections.singletonList(range)); - } - - @Override - public Collection getOverlappingRanges(Collection> providedPartitionKeyRanges) { - if (providedPartitionKeyRanges == null) { - throw new IllegalArgumentException("providedPartitionKeyRanges"); - } - - Map partitionRanges = new TreeMap(); - - for (Range range : providedPartitionKeyRanges) { - int minIndex = Collections.binarySearch(this.orderedRanges, range, new Range.MinComparator()); - if (minIndex < 0) { - minIndex = Math.max(minIndex, -minIndex - 2); - } - - int maxIndex = Collections.binarySearch(this.orderedRanges, range, new Range.MaxComparator()); - if (maxIndex < 0) { - maxIndex = Math.min(this.orderedRanges.size() - 1, -maxIndex - 1); - } - - for (int i = minIndex; i <= maxIndex; ++i) { - if (Range.checkOverlapping(this.orderedRanges.get(i), range)) { - PartitionKeyRange partitionKeyRange = this.orderedPartitionKeyRanges.get(i); - partitionRanges.put(partitionKeyRange.getMinInclusive(), partitionKeyRange); - } - } - } - - return partitionRanges.values(); - } - - - @Override - public PartitionKeyRange tryGetRangeByPartitionKeyRangeId(String partitionKeyRangeId) - { - Pair addresses; - addresses = this.rangeById.get(partitionKeyRangeId); - if (addresses != null) { - return addresses.getLeft(); - } - - return null; - } - - @Override - public IServerIdentity tryGetInfoByPartitionKeyRangeId(String partitionKeyRangeId) - { - Pair addresses; - addresses = this.rangeById.get(partitionKeyRangeId); - if (addresses != null) { - return addresses.getRight(); - } - - return null; - } - - @Override - public boolean IsGone(String partitionKeyRangeId) { - return this.goneRanges.contains(partitionKeyRangeId); - } - - private static class MinPartitionKeyPairComparator - implements Comparator> { - public int compare(ImmutablePair pair1, - ImmutablePair pair2) { - return pair1.left.getMinInclusive().compareTo(pair2.left.getMinInclusive()); - } - } - - - public CollectionRoutingMap tryCombine( - List> ranges) { - Set newGoneRanges = new HashSet<>(ranges.stream().flatMap(tuple -> CollectionUtils.emptyIfNull(tuple.getLeft().getParents()).stream()).collect(Collectors.toSet())); - newGoneRanges.addAll(this.goneRanges); - - Map> newRangeById = - this.rangeById.values().stream().filter(tuple -> !newGoneRanges.contains(tuple.left.getId())).collect(Collectors. - toMap(tuple -> tuple.left.getId(), tuple -> tuple)); - - for (ImmutablePair tuple : ranges.stream().filter(tuple -> !newGoneRanges.contains(tuple.getLeft().getId())).collect(Collectors.toList())) { - newRangeById.put(tuple.getLeft().getId(), tuple); - } - - List> sortedRanges = newRangeById.values().stream().collect(Collectors.toList()); - - Collections.sort(sortedRanges, new MinPartitionKeyPairComparator()); - - List newOrderedRanges = sortedRanges.stream().map(range -> range.left).collect(Collectors.toList()); - - if (!isCompleteSetOfRanges(newOrderedRanges)) { - return null; - } - - return new InMemoryCollectionRoutingMap(newRangeById, newOrderedRanges, this.getCollectionUniqueId()); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/LocationCache.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/LocationCache.java deleted file mode 100644 index d730343526ab..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/LocationCache.java +++ /dev/null @@ -1,581 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DatabaseAccount; -import com.microsoft.azure.cosmosdb.DatabaseAccountLocation; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import org.apache.commons.collections4.map.CaseInsensitiveMap; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.apache.commons.collections4.list.UnmodifiableList; -import org.apache.commons.collections4.map.UnmodifiableMap; -import java.net.URL; -import java.time.Duration; -import java.time.Instant; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.function.BiFunction; -import java.util.stream.Collectors; - -/** - * Implements the abstraction to resolve target location for geo-replicated DatabaseAccount - * with multiple writable and readable locations. - */ -public class LocationCache { - private final static Logger logger = LoggerFactory.getLogger(LocationCache.class); - - private final boolean enableEndpointDiscovery; - private final URL defaultEndpoint; - private final boolean useMultipleWriteLocations; - private final Object lockObject; - private final Duration unavailableLocationsExpirationTime; - private final ConcurrentHashMap locationUnavailabilityInfoByEndpoint; - - private DatabaseAccountLocationsInfo locationInfo; - - private Instant lastCacheUpdateTimestamp; - private boolean enableMultipleWriteLocations; - - public LocationCache( - List preferredLocations, - URL defaultEndpoint, - boolean enableEndpointDiscovery, - boolean useMultipleWriteLocations, - Configs configs) { - this.locationInfo = new DatabaseAccountLocationsInfo(preferredLocations, defaultEndpoint); - this.defaultEndpoint = defaultEndpoint; - this.enableEndpointDiscovery = enableEndpointDiscovery; - this.useMultipleWriteLocations = useMultipleWriteLocations; - - this.lockObject = new Object(); - - - this.locationUnavailabilityInfoByEndpoint = new ConcurrentHashMap<>(); - - this.lastCacheUpdateTimestamp = Instant.MIN; - this.enableMultipleWriteLocations = false; - this.unavailableLocationsExpirationTime = Duration.ofSeconds(configs.getUnavailableLocationsExpirationTimeInSeconds()); - } - - /** - * Gets list of read endpoints ordered by - * - * 1. Preferred location - * 2. Endpoint availability - * @return - */ - public UnmodifiableList getReadEndpoints() { - if (this.locationUnavailabilityInfoByEndpoint.size() > 0 - && unavailableLocationsExpirationTimePassed()) { - this.updateLocationCache(); - } - - return this.locationInfo.readEndpoints; - } - - /** - * Gets list of write endpoints ordered by - * 1. Preferred location - * 2. Endpoint availability - * @return - */ - public UnmodifiableList getWriteEndpoints() { - if (this.locationUnavailabilityInfoByEndpoint.size() > 0 - && unavailableLocationsExpirationTimePassed()) { - this.updateLocationCache(); - } - - return this.locationInfo.writeEndpoints; - } - - /** - * Marks the current location unavailable for read - */ - public void markEndpointUnavailableForRead(URL endpoint) { - this.markEndpointUnavailable(endpoint, OperationType.Read); - } - - /** - * Marks the current location unavailable for write - */ - public void markEndpointUnavailableForWrite(URL endpoint) { - this.markEndpointUnavailable(endpoint, OperationType.Write); - } - - /** - * Invoked when {@link DatabaseAccount} is read - * @param databaseAccount Read DatabaseAccount - */ - public void onDatabaseAccountRead(DatabaseAccount databaseAccount) { - this.updateLocationCache( - databaseAccount.getWritableLocations(), - databaseAccount.getReadableLocations(), - null, - BridgeInternal.isEnableMultipleWriteLocations(databaseAccount)); - } - - void onLocationPreferenceChanged(UnmodifiableList preferredLocations) { - this.updateLocationCache( - null, null , preferredLocations, null); - } - - /** - * Resolves request to service endpoint. - * 1. If this is a write request - * (a) If UseMultipleWriteLocations = true - * (i) For document writes, resolve to most preferred and available write endpoint. - * Once the endpoint is marked unavailable, it is moved to the end of available write endpoint. Current request will - * be retried on next preferred available write endpoint. - * (ii) For all other resources, always resolve to first/second (regardless of preferred locations) - * write endpoint in {@link DatabaseAccount#getWritableLocations()}. - * Endpoint of first write location in {@link DatabaseAccount#getWritableLocations()} is the only endpoint that supports - * write operation on all resource types (except during that region's failover). - * Only during manual failover, client would retry write on second write location in {@link DatabaseAccount#getWritableLocations()}. - * (b) Else resolve the request to first write endpoint in {@link DatabaseAccount#getWritableLocations()} OR - * second write endpoint in {@link DatabaseAccount#getWritableLocations()} in case of manual failover of that location. - * 2. Else resolve the request to most preferred available read endpoint (automatic failover for read requests) - * @param request Request for which endpoint is to be resolved - * @return Resolved endpoint - */ - public URL resolveServiceEndpoint(RxDocumentServiceRequest request) { - if(request.requestContext != null && request.requestContext.locationEndpointToRoute != null) { - return request.requestContext.locationEndpointToRoute; - } - - int locationIndex = Utils.getValueOrDefault(request.requestContext.locationIndexToRoute, 0); - - boolean usePreferredLocations = request.requestContext.usePreferredLocations != null ? request.requestContext.usePreferredLocations : true; - if(!usePreferredLocations || (request.getOperationType().isWriteOperation() && !this.canUseMultipleWriteLocations(request))) { - // For non-document resource types in case of client can use multiple write locations - // or when client cannot use multiple write locations, flip-flop between the - // first and the second writable region in DatabaseAccount (for manual failover) - DatabaseAccountLocationsInfo currentLocationInfo = this.locationInfo; - - if(this.enableEndpointDiscovery && currentLocationInfo.availableWriteLocations.size() > 0) { - locationIndex = Math.min(locationIndex%2, currentLocationInfo.availableWriteLocations.size()-1); - String writeLocation = currentLocationInfo.availableWriteLocations.get(locationIndex); - return currentLocationInfo.availableWriteEndpointByLocation.get(writeLocation); - } else { - return this.defaultEndpoint; - } - } else { - UnmodifiableList endpoints = request.getOperationType().isWriteOperation()? this.getWriteEndpoints() : this.getReadEndpoints(); - return endpoints.get(locationIndex % endpoints.size()); - } - } - - public boolean shouldRefreshEndpoints(Utils.ValueHolder canRefreshInBackground) { - canRefreshInBackground.v = true; - DatabaseAccountLocationsInfo currentLocationInfo = this.locationInfo; - String mostPreferredLocation = Utils.firstOrDefault(currentLocationInfo.preferredLocations); - - // we should schedule refresh in background if we are unable to target the user's most preferredLocation. - if (this.enableEndpointDiscovery) { - - boolean shouldRefresh = this.useMultipleWriteLocations && !this.enableMultipleWriteLocations; - if (!Strings.isNullOrEmpty(mostPreferredLocation)) { - Utils.ValueHolder mostPreferredReadEndpointHolder = new Utils.ValueHolder<>(); - List readLocationEndpoints = currentLocationInfo.readEndpoints; - logger.debug("getReadEndpoints [{}]", readLocationEndpoints); - - if (Utils.tryGetValue(currentLocationInfo.availableReadEndpointByLocation, mostPreferredLocation, mostPreferredReadEndpointHolder)) { - logger.debug("most preferred is [{}], most preferred available is [{}]", - mostPreferredLocation, mostPreferredReadEndpointHolder.v); - if (!areEqual(mostPreferredReadEndpointHolder.v, readLocationEndpoints.get(0))) { - // For reads, we can always refresh in background as we can alternate to - // other available read endpoints - logger.debug("shouldRefreshEndpoints = true, most preferred location [{}]" + - " is not available for read.", mostPreferredLocation); - return true; - } - - logger.debug("most preferred is [{}], and most preferred available [{}] are the same", - mostPreferredLocation, mostPreferredReadEndpointHolder.v); - } - else { - logger.debug("shouldRefreshEndpoints = true, most preferred location [{}] " + - "is not in available read locations.", mostPreferredLocation); - return true; - } - } - - Utils.ValueHolder mostPreferredWriteEndpointHolder = new Utils.ValueHolder<>(); - List writeLocationEndpoints = currentLocationInfo.writeEndpoints; - logger.debug("getWriteEndpoints [{}]", writeLocationEndpoints); - - if (!this.canUseMultipleWriteLocations()) { - if (this.isEndpointUnavailable(writeLocationEndpoints.get(0), OperationType.Write)) { - // Since most preferred write endpoint is unavailable, we can only refresh in background if - // we have an alternate write endpoint - canRefreshInBackground.v = writeLocationEndpoints.size() > 1; - logger.debug("shouldRefreshEndpoints = true, most preferred location " + - "[{}] endpoint [{}] is not available for write. canRefreshInBackground = [{}]", - mostPreferredLocation, - writeLocationEndpoints.get(0), - canRefreshInBackground.v); - - return true; - } else { - logger.debug("shouldRefreshEndpoints: false, [{}] is available for Write", writeLocationEndpoints.get(0)); - return shouldRefresh; - } - } else if (!Strings.isNullOrEmpty(mostPreferredLocation)) { - if (Utils.tryGetValue(currentLocationInfo.availableWriteEndpointByLocation, mostPreferredLocation, mostPreferredWriteEndpointHolder)) { - shouldRefresh = ! areEqual(mostPreferredWriteEndpointHolder.v,writeLocationEndpoints.get(0)); - - if (shouldRefresh) { - logger.debug("shouldRefreshEndpoints: true, write endpoint [{}] is not the same as most preferred [{}]", - writeLocationEndpoints.get(0), mostPreferredWriteEndpointHolder.v); - } else { - logger.debug("shouldRefreshEndpoints: false, write endpoint [{}] is the same as most preferred [{}]", - writeLocationEndpoints.get(0), mostPreferredWriteEndpointHolder.v); - } - - return shouldRefresh; - } else { - logger.debug("shouldRefreshEndpoints = true, most preferred location [{}] is not in available write locations", - mostPreferredLocation); - return true; - } - } else { - logger.debug("shouldRefreshEndpoints: false, mostPreferredLocation [{}] is empty", mostPreferredLocation); - return shouldRefresh; - } - } else { - logger.debug("shouldRefreshEndpoints: false, endpoint discovery not enabled"); - return false; - } - } - private boolean areEqual(URL url1, URL url2) { - return url1.equals(url2); - } - - private void clearStaleEndpointUnavailabilityInfo() { - if (!this.locationUnavailabilityInfoByEndpoint.isEmpty()) { - List unavailableEndpoints = new ArrayList<>(this.locationUnavailabilityInfoByEndpoint.keySet()); - - for (URL unavailableEndpoint: unavailableEndpoints) { - Utils.ValueHolder unavailabilityInfoHolder = new Utils.ValueHolder<>(); - Utils.ValueHolder removedHolder = new Utils.ValueHolder<>(); - - if (Utils.tryGetValue(this.locationUnavailabilityInfoByEndpoint, unavailableEndpoint, unavailabilityInfoHolder) - && - durationPassed(Instant.now(), unavailabilityInfoHolder.v.LastUnavailabilityCheckTimeStamp, - this.unavailableLocationsExpirationTime) - - && Utils.tryRemove(this.locationUnavailabilityInfoByEndpoint, unavailableEndpoint, removedHolder)) { - logger.debug( - "Removed endpoint [{}] unavailable for operations [{}] from unavailableEndpoints", - unavailableEndpoint, - unavailabilityInfoHolder.v.UnavailableOperations); - } - } - } - } - - private boolean isEndpointUnavailable(URL endpoint, OperationType expectedAvailableOperations) { - Utils.ValueHolder unavailabilityInfoHolder = new Utils.ValueHolder<>(); - - if (expectedAvailableOperations == OperationType.None - || !Utils.tryGetValue(this.locationUnavailabilityInfoByEndpoint, endpoint, unavailabilityInfoHolder) - || !unavailabilityInfoHolder.v.UnavailableOperations.supports(expectedAvailableOperations)) { - return false; - } else { - if (durationPassed(Instant.now(), unavailabilityInfoHolder.v.LastUnavailabilityCheckTimeStamp, this.unavailableLocationsExpirationTime)) { - return false; - } else { - logger.debug( - "Endpoint [{}] unavailable for operations [{}] present in unavailableEndpoints", - endpoint, - unavailabilityInfoHolder.v.UnavailableOperations); - // Unexpired entry present. Endpoint is unavailable - return true; - } - } - } - - private void markEndpointUnavailable( - URL unavailableEndpoint, - OperationType unavailableOperationType) { - Instant currentTime = Instant.now(); - LocationUnavailabilityInfo updatedInfo = this.locationUnavailabilityInfoByEndpoint.compute( - unavailableEndpoint, - new BiFunction() { - @Override - public LocationUnavailabilityInfo apply(URL url, LocationUnavailabilityInfo info) { - - if (info == null) { - // not already present, add - return new LocationUnavailabilityInfo(currentTime, unavailableOperationType); - } else { - // already present, update - info.LastUnavailabilityCheckTimeStamp = currentTime; - info.UnavailableOperations = OperationType.combine(info.UnavailableOperations, unavailableOperationType); - return info; - } - - } - }); - - this.updateLocationCache(); - - logger.debug( - "Endpoint [{}] unavailable for [{}] added/updated to unavailableEndpoints with timestamp [{}]", - unavailableEndpoint, - unavailableOperationType, - updatedInfo.LastUnavailabilityCheckTimeStamp); - } - - private void updateLocationCache(){ - updateLocationCache(null, null, null, null); - } - - private void updateLocationCache( - Iterable writeLocations, - Iterable readLocations, - UnmodifiableList preferenceList, - Boolean enableMultipleWriteLocations) { - synchronized (this.lockObject) { - DatabaseAccountLocationsInfo nextLocationInfo = new DatabaseAccountLocationsInfo(this.locationInfo); - logger.debug("updating location cache ..., current readLocations [{}], current writeLocations [{}]", - nextLocationInfo.readEndpoints, nextLocationInfo.writeEndpoints); - - if (preferenceList != null) { - nextLocationInfo.preferredLocations = preferenceList; - } - - if (enableMultipleWriteLocations != null) { - this.enableMultipleWriteLocations = enableMultipleWriteLocations; - } - - this.clearStaleEndpointUnavailabilityInfo(); - - if (readLocations != null) { - Utils.ValueHolder> out = Utils.ValueHolder.initialize(nextLocationInfo.availableReadLocations); - nextLocationInfo.availableReadEndpointByLocation = this.getEndpointByLocation(readLocations, out); - nextLocationInfo.availableReadLocations = out.v; - } - - if (writeLocations != null) { - Utils.ValueHolder> out = Utils.ValueHolder.initialize(nextLocationInfo.availableWriteLocations); - nextLocationInfo.availableWriteEndpointByLocation = this.getEndpointByLocation(writeLocations, out); - nextLocationInfo.availableWriteLocations = out.v; - } - - nextLocationInfo.writeEndpoints = this.getPreferredAvailableEndpoints(nextLocationInfo.availableWriteEndpointByLocation, nextLocationInfo.availableWriteLocations, OperationType.Write, this.defaultEndpoint); - nextLocationInfo.readEndpoints = this.getPreferredAvailableEndpoints(nextLocationInfo.availableReadEndpointByLocation, nextLocationInfo.availableReadLocations, OperationType.Read, nextLocationInfo.writeEndpoints.get(0)); - this.lastCacheUpdateTimestamp = Instant.now(); - - logger.debug("updating location cache finished, new readLocations [{}], new writeLocations [{}]", - nextLocationInfo.readEndpoints, nextLocationInfo.writeEndpoints); - this.locationInfo = nextLocationInfo; - } - } - - private UnmodifiableList getPreferredAvailableEndpoints(UnmodifiableMap endpointsByLocation, - UnmodifiableList orderedLocations, - OperationType expectedAvailableOperation, - URL fallbackEndpoint) { - List endpoints = new ArrayList<>(); - DatabaseAccountLocationsInfo currentLocationInfo = this.locationInfo; - // if enableEndpointDiscovery is false, we always use the defaultEndpoint that user passed in during documentClient init - if (this.enableEndpointDiscovery) { - if (this.canUseMultipleWriteLocations() || expectedAvailableOperation.supports(OperationType.Read)) { - List unavailableEndpoints = new ArrayList<>(); - - // When client can not use multiple write locations, preferred locations list should only be used - // determining read endpoints order. - // If client can use multiple write locations, preferred locations list should be used for determining - // both read and write endpoints order. - - for (String location: currentLocationInfo.preferredLocations) { - Utils.ValueHolder endpoint = new Utils.ValueHolder<>(); - if (Utils.tryGetValue(endpointsByLocation, location, endpoint)) { - if (this.isEndpointUnavailable(endpoint.v, expectedAvailableOperation)) { - unavailableEndpoints.add(endpoint.v); - } else { - endpoints.add(endpoint.v); - } - } - } - - if (endpoints.isEmpty()) { - endpoints.add(fallbackEndpoint); - } - - endpoints.addAll(unavailableEndpoints); - } else { - for (String location : orderedLocations) { - - Utils.ValueHolder endpoint = Utils.ValueHolder.initialize(null); - if (!Strings.isNullOrEmpty(location) && // location is empty during manual failover - Utils.tryGetValue(endpointsByLocation, location, endpoint)) { - endpoints.add(endpoint.v); - } - } - } - } - - if (endpoints.isEmpty()) { - endpoints.add(fallbackEndpoint); - } - - return new UnmodifiableList(endpoints); - } - - private UnmodifiableMap getEndpointByLocation(Iterable locations, - Utils.ValueHolder> orderedLocations) { - Map endpointsByLocation = new CaseInsensitiveMap<>(); - List parsedLocations = new ArrayList<>(); - - for (DatabaseAccountLocation location: locations) { - if (!Strings.isNullOrEmpty(location.getName())) { - try { - URL endpoint = new URL(location.getEndpoint().toLowerCase()); - endpointsByLocation.put(location.getName().toLowerCase(), endpoint); - parsedLocations.add(location.getName()); - - } catch (Exception e) { - logger.warn("GetAvailableEndpointsByLocation() - skipping add for location = [{}] as it is location name is either empty or endpoint is malformed [{}]", - location.getName(), - location.getEndpoint()); - } - } - } - - orderedLocations.v = new UnmodifiableList(parsedLocations); - return (UnmodifiableMap) UnmodifiableMap.unmodifiableMap(endpointsByLocation); - } - - private boolean canUseMultipleWriteLocations() { - return this.useMultipleWriteLocations && this.enableMultipleWriteLocations; - } - - public boolean canUseMultipleWriteLocations(RxDocumentServiceRequest request) { - return this.canUseMultipleWriteLocations() && - (request.getResourceType() == ResourceType.Document || - (request.getResourceType() == ResourceType.StoredProcedure && request.getOperationType() == - com.microsoft.azure.cosmosdb.internal.OperationType.ExecuteJavaScript)); - } - - - private class LocationUnavailabilityInfo { - LocationUnavailabilityInfo(Instant instant, OperationType type) { - this.LastUnavailabilityCheckTimeStamp = instant; - this.UnavailableOperations = type; - } - - public Instant LastUnavailabilityCheckTimeStamp; - public OperationType UnavailableOperations; - } - - private enum OperationType { - None(0x0), - Read(0x1), - Write(0x2), - ReadAndWrite(0x3); - - private final int flag; - - public boolean hasReadFlag() { - return (flag & Read.flag) != 0; - } - - public boolean hasWriteFlag() { - return (flag & Write.flag) != 0; - } - - public static OperationType combine(OperationType t1, OperationType t2) { - switch (t1.flag | t2.flag) { - case 0x0: - return None; - case 0x1: - return Read; - case 0x2: - return Write; - default: - return ReadAndWrite; - } - } - - public boolean supports(OperationType type) { - return (flag & type.flag) != 0; - } - - OperationType(int flag) { - this.flag = flag; - } - } - - private boolean durationPassed(Instant end, Instant start, Duration duration) { - return end.minus(duration).isAfter(start); - } - - private boolean unavailableLocationsExpirationTimePassed() { - return durationPassed(Instant.now(), this.lastCacheUpdateTimestamp, this.unavailableLocationsExpirationTime); - } - - class DatabaseAccountLocationsInfo { - private UnmodifiableList preferredLocations; - // lower-case region - private UnmodifiableList availableWriteLocations; - // lower-case region - private UnmodifiableList availableReadLocations; - private UnmodifiableMap availableWriteEndpointByLocation; - private UnmodifiableMap availableReadEndpointByLocation; - - private UnmodifiableList writeEndpoints; - private UnmodifiableList readEndpoints; - - public DatabaseAccountLocationsInfo(List preferredLocations, - URL defaultEndpoint) { - this.preferredLocations = new UnmodifiableList<>(preferredLocations.stream().map(loc -> loc.toLowerCase()).collect(Collectors.toList())); - this.availableWriteEndpointByLocation = (UnmodifiableMap) UnmodifiableMap.unmodifiableMap(new CaseInsensitiveMap<>()); - this.availableReadEndpointByLocation = (UnmodifiableMap) UnmodifiableMap.unmodifiableMap(new CaseInsensitiveMap<>()); - this.availableReadLocations = new UnmodifiableList<>(Collections.emptyList()); - this.availableWriteLocations = new UnmodifiableList<>(Collections.emptyList()); - this.readEndpoints = new UnmodifiableList<>(Collections.singletonList(defaultEndpoint)); - this.writeEndpoints = new UnmodifiableList<>(Collections.singletonList(defaultEndpoint)); - } - - public DatabaseAccountLocationsInfo(DatabaseAccountLocationsInfo other) { - this.preferredLocations = other.preferredLocations; - this.availableWriteLocations = other.availableWriteLocations; - this.availableReadLocations = other.availableReadLocations; - this.availableWriteEndpointByLocation = other.availableWriteEndpointByLocation; - this.availableReadEndpointByLocation = other.availableReadEndpointByLocation; - this.writeEndpoints = other.writeEndpoints; - this.readEndpoints = other.readEndpoints; - } - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/RoutingMapProvider.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/RoutingMapProvider.java deleted file mode 100644 index ce7be3bdf86c..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/RoutingMapProvider.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.util.Collection; - -import com.microsoft.azure.cosmosdb.PartitionKeyRange; - -/** - * Used internally in request routing in the Azure Cosmos DB database service. - */ -public interface RoutingMapProvider { - Collection getOverlappingRanges(String collectionSelfLink, Range range, boolean forceRefresh); - - PartitionKeyRange tryGetRangeByEffectivePartitionKey(String collectionSelfLink, String effectivePartitionKey); - - PartitionKeyRange getPartitionKeyRangeById(String collectionSelfLink, String partitionKeyRangeId, boolean forceRefresh); - -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/RoutingMapProviderHelper.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/RoutingMapProviderHelper.java deleted file mode 100644 index ef4311699fa3..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/internal/routing/RoutingMapProviderHelper.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import com.microsoft.azure.cosmosdb.PartitionKeyRange; - -/** - * Provide utility functionality to route request in direct connectivity mode in the Azure Cosmos DB database service. - */ -public final class RoutingMapProviderHelper { - private static final Range.MaxComparator MAX_COMPARATOR = new Range.MaxComparator(); - - private static String max(String left, String right) { - return left.compareTo(right) < 0 ? right : left; - } - - private static > boolean IsSortedAndNonOverlapping(List> list) { - for (int i = 1; i < list.size(); i++) { - Range previousRange = list.get(i - 1); - Range currentRange = list.get(i); - - int compareResult = previousRange.getMax().compareTo(currentRange.getMin()); - if (compareResult > 0) { - return false; - } else if (compareResult == 0 && previousRange.isMaxInclusive() && currentRange.isMinInclusive()) { - return false; - } - } - - return true; - } - - public static Collection getOverlappingRanges(RoutingMapProvider routingMapProvider, - String collectionSelfLink, List> sortedRanges) { - if (!IsSortedAndNonOverlapping(sortedRanges)) { - throw new IllegalArgumentException("sortedRanges"); - } - - List targetRanges = new ArrayList(); - int currentProvidedRange = 0; - while (currentProvidedRange < sortedRanges.size()) { - if (sortedRanges.get(currentProvidedRange).isEmpty()) { - currentProvidedRange++; - continue; - } - - Range queryRange; - if (!targetRanges.isEmpty()) { - String left = max(targetRanges.get(targetRanges.size() - 1).getMaxExclusive(), - sortedRanges.get(currentProvidedRange).getMin()); - - boolean leftInclusive = left.compareTo(sortedRanges.get(currentProvidedRange).getMin()) == 0 - ? sortedRanges.get(currentProvidedRange).isMinInclusive() : false; - - queryRange = new Range(left, sortedRanges.get(currentProvidedRange).getMax(), leftInclusive, - sortedRanges.get(currentProvidedRange).isMaxInclusive()); - } else { - queryRange = sortedRanges.get(currentProvidedRange); - } - - targetRanges.addAll(routingMapProvider.getOverlappingRanges(collectionSelfLink, queryRange, false)); - - Range lastKnownTargetRange = targetRanges.get(targetRanges.size() - 1).toRange(); - while (currentProvidedRange < sortedRanges.size() - && MAX_COMPARATOR.compare(sortedRanges.get(currentProvidedRange), lastKnownTargetRange) <= 0) { - currentProvidedRange++; - } - } - - return targetRanges; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/BackoffRetryUtility.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/BackoffRetryUtility.java deleted file mode 100644 index e5240e2fd093..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/BackoffRetryUtility.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.time.Duration; - - -import com.microsoft.azure.cosmosdb.internal.Quadruple; - -import rx.Observable; -import rx.Single; -import rx.functions.Action1; -import rx.functions.Func0; -import rx.functions.Func1; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class BackoffRetryUtility { - - // transforms a retryFunc to a function which can be used by Observable.retryWhen(.) - // also it invokes preRetryCallback prior to doing retry. - public static final Quadruple InitialArgumentValuePolicyArg = Quadruple.with(false, false, - Duration.ofSeconds(60), 0); - - static Func1, Observable> toRetryWhenFunc( - Func1> retryFunc, Action1 preRetryCallback) { - - return new Func1, Observable>() { - - @Override - public Observable call(Observable t) { - - return t.flatMap(f -> { - Exception e = Utils.as(f, Exception.class); - if (e instanceof Exception) { - if (preRetryCallback != null) { - - // TODO: is retry callback invoked immediately on the same thread? - // we should verify this - return retryFunc.call(e).doOnSuccess(v -> preRetryCallback.call(e)).toObservable(); - } else { - return retryFunc.call(e).toObservable(); - } - } else { - return Observable.error(f); - } - }); - } - }; - } - - @SuppressWarnings("unused") - static private Single executeRetry(Func0> callbackMethod, - Func1> callShouldRetry, Action1 preRetryCallback) { - - return Single.defer(() -> { - return callbackMethod.call(); - - }).retryWhen(toRetryWhenFunc(callShouldRetry, preRetryCallback)); - } - - // a helper method for invoking callback method given the retry policy. - // it also invokes the pre retry callback prior to retrying - static public Single executeRetry(Func0> callbackMethod, - IRetryPolicy retryPolicy, - Action1 preRetryCallback) { - - return Single.defer(() -> { - // TODO: is defer required? - return callbackMethod.call(); - }).retryWhen(RetryUtils.toRetryWhenFunc(retryPolicy)); - } - - // a helper method for invoking callback method given the retry policy - static public Single executeRetry(Func0> callbackMethod, - IRetryPolicy retryPolicy) { - - return Single.defer(() -> { - // TODO: is defer required? - return callbackMethod.call(); - }).retryWhen(RetryUtils.toRetryWhenFunc(retryPolicy)); - } - - static public Single executeAsync( - Func1, Single> callbackMethod, IRetryPolicy retryPolicy, - Func1, Single> inBackoffAlternateCallbackMethod, - Duration minBackoffForInBackoffCallback) { - Quadruple policyArg1 = InitialArgumentValuePolicyArg; - - return Single.defer(() -> { - // TODO: is defer required? - return callbackMethod.call(policyArg1).onErrorResumeNext( - RetryUtils.toRetryWithAlternateFunc(callbackMethod,retryPolicy, inBackoffAlternateCallbackMethod,minBackoffForInBackoffCallback)); - }); - } - -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ClearingSessionContainerClientRetryPolicy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ClearingSessionContainerClientRetryPolicy.java deleted file mode 100644 index 0ba6bb83f53e..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ClearingSessionContainerClientRetryPolicy.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Single; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - * - * This retry policy is designed to work with in a pair with ClientRetryPolicy. - * The inner retryPolicy must be a ClientRetryPolicy or a retry policy delegating to it. - * - * The expectation that is the outer retry policy in the retry policy chain and nobody can overwrite ShouldRetryResult. - * Once we clear the session we expect call to fail and throw exception to the client. Otherwise we may violate session consistency. - */ -public class ClearingSessionContainerClientRetryPolicy implements IDocumentClientRetryPolicy { - - private final static Logger logger = LoggerFactory.getLogger(ClearingSessionContainerClientRetryPolicy.class); - - private final IDocumentClientRetryPolicy retryPolicy; - private final ISessionContainer sessionContainer; - private RxDocumentServiceRequest request; - private boolean hasTriggered = false; - - public ClearingSessionContainerClientRetryPolicy(ISessionContainer sessionContainer, IDocumentClientRetryPolicy retryPolicy) { - this.sessionContainer = sessionContainer; - this.retryPolicy = retryPolicy; - } - - @Override - public void onBeforeSendRequest(RxDocumentServiceRequest request) { - this.request = request; - this.retryPolicy.onBeforeSendRequest(request); - } - - @Override - public Single shouldRetry(Exception e) { - - return this.retryPolicy.shouldRetry(e).flatMap(shouldRetryResult -> { - - if (!shouldRetryResult.shouldRetry && !this.hasTriggered) - { - DocumentClientException clientException = Utils.as(e, DocumentClientException.class); - - if (this.request == null) { - // someone didn't call OnBeforeSendRequest - nothing we can do - logger.error("onBeforeSendRequest is not invoked, encountered failure due to request being null", e); - return Single.just(ShouldRetryResult.error(e)); - } - - if (clientException != null && this.request.getIsNameBased() && - Exceptions.isStatusCode(clientException, HttpConstants.StatusCodes.NOTFOUND) && - Exceptions.isSubStatusCode(clientException, HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE)) - { - // Clear the session token, because the collection name might be reused. - logger.warn("Clear the token for named base request {}", request.getResourceAddress()); - - this.sessionContainer.clearTokenByCollectionFullName(request.getResourceAddress()); - - this.hasTriggered = true; - } - } - - return Single.just(shouldRetryResult); - }); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ClientRetryPolicy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ClientRetryPolicy.java deleted file mode 100644 index a4297517e1a3..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ClientRetryPolicy.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.ClientSideRequestStatistics; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.RetryOptions; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.WebExceptionUtility; -import org.apache.commons.collections4.list.UnmodifiableList; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Single; - -import java.net.URL; -import java.time.Duration; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - * - * Client policy is combination of endpoint change retry + throttling retry. - */ -public class ClientRetryPolicy implements IDocumentClientRetryPolicy { - - private final static Logger logger = LoggerFactory.getLogger(ClientRetryPolicy.class); - - final static int RetryIntervalInMS = 1000; //Once we detect failover wait for 1 second before retrying request. - final static int MaxRetryCount = 120; - - private final IDocumentClientRetryPolicy throttlingRetry; - private final ConnectionPoolExhaustedRetry rxNettyConnectionPoolExhaustedRetry; - private final GlobalEndpointManager globalEndpointManager; - private final boolean enableEndpointDiscovery; - private int failoverRetryCount; - - private int sessionTokenRetryCount; - private boolean isReadRequest; - private boolean canUseMultipleWriteLocations; - private URL locationEndpoint; - private RetryContext retryContext; - private ClientSideRequestStatistics clientSideRequestStatistics; - - public ClientRetryPolicy(GlobalEndpointManager globalEndpointManager, - boolean enableEndpointDiscovery, - RetryOptions retryOptions) { - - this.throttlingRetry = new ResourceThrottleRetryPolicy( - retryOptions.getMaxRetryAttemptsOnThrottledRequests(), - retryOptions.getMaxRetryWaitTimeInSeconds()); - this.rxNettyConnectionPoolExhaustedRetry = new ConnectionPoolExhaustedRetry(); - this.globalEndpointManager = globalEndpointManager; - this.failoverRetryCount = 0; - this.enableEndpointDiscovery = enableEndpointDiscovery; - this.sessionTokenRetryCount = 0; - this.canUseMultipleWriteLocations = false; - this.clientSideRequestStatistics = new ClientSideRequestStatistics(); - } - - @Override - public Single shouldRetry(Exception e) { - if (this.locationEndpoint == null) { - // on before request is not invoked because Document Service Request creation failed. - logger.error("locationEndpoint is null because ClientRetryPolicy::onBeforeRequest(.) is not invoked, " + - "probably request creation failed due to invalid options, serialization setting, etc."); - return Single.just(ShouldRetryResult.error(e)); - } - - if (ConnectionPoolExhaustedRetry.isConnectionPoolExhaustedException(e)) { - return rxNettyConnectionPoolExhaustedRetry.shouldRetry(e); - } - - this.retryContext = null; - // Received 403.3 on write region, initiate the endpoint re-discovery - DocumentClientException clientException = Utils.as(e, DocumentClientException.class); - if (clientException != null && clientException.getClientSideRequestStatistics() != null) { - this.clientSideRequestStatistics = clientException.getClientSideRequestStatistics(); - } - if (clientException != null && - Exceptions.isStatusCode(clientException, HttpConstants.StatusCodes.FORBIDDEN) && - Exceptions.isSubStatusCode(clientException, HttpConstants.SubStatusCodes.FORBIDDEN_WRITEFORBIDDEN)) - { - logger.warn("Endpoint not writable. Will refresh cache and retry. {}", e.toString()); - return this.shouldRetryOnEndpointFailureAsync(false); - } - - // Regional endpoint is not available yet for reads (e.g. add/ online of region is in progress) - if (clientException != null && - Exceptions.isStatusCode(clientException, HttpConstants.StatusCodes.FORBIDDEN) && - Exceptions.isSubStatusCode(clientException, HttpConstants.SubStatusCodes.DATABASE_ACCOUNT_NOTFOUND) && - this.isReadRequest) - { - logger.warn("Endpoint not available for reads. Will refresh cache and retry. {}", e.toString()); - return this.shouldRetryOnEndpointFailureAsync(true); - } - - // Received Connection error (HttpRequestException), initiate the endpoint rediscovery - if (WebExceptionUtility.isNetworkFailure(e)) { - logger.warn("Endpoint not reachable. Will refresh cache and retry. {}" , e.toString()); - return this.shouldRetryOnEndpointFailureAsync(this.isReadRequest); - } - - if (clientException != null && - Exceptions.isStatusCode(clientException, HttpConstants.StatusCodes.NOTFOUND) && - Exceptions.isSubStatusCode(clientException, HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE)) { - return Single.just(this.shouldRetryOnSessionNotAvailable()); - } - - return this.throttlingRetry.shouldRetry(e); - } - - private ShouldRetryResult shouldRetryOnSessionNotAvailable() { - this.sessionTokenRetryCount++; - - if (!this.enableEndpointDiscovery) { - // if endpoint discovery is disabled, the request cannot be retried anywhere else - return ShouldRetryResult.noRetry(); - } else { - if (this.canUseMultipleWriteLocations) { - UnmodifiableList endpoints = this.isReadRequest ? this.globalEndpointManager.getReadEndpoints() : this.globalEndpointManager.getWriteEndpoints(); - - if (this.sessionTokenRetryCount > endpoints.size()) { - // When use multiple write locations is true and the request has been tried - // on all locations, then don't retry the request - return ShouldRetryResult.noRetry(); - } else { - this.retryContext = new RetryContext(this.sessionTokenRetryCount - 1, this.sessionTokenRetryCount > 1); - return ShouldRetryResult.retryAfter(Duration.ZERO); - } - } else { - if (this.sessionTokenRetryCount > 1) { - // When cannot use multiple write locations, then don't retry the request if - // we have already tried this request on the write location - return ShouldRetryResult.noRetry(); - } else { - this.retryContext = new RetryContext(this.sessionTokenRetryCount - 1, false); - return ShouldRetryResult.retryAfter(Duration.ZERO); - } - } - } - } - - private Single shouldRetryOnEndpointFailureAsync(boolean isReadRequest) { - if (!this.enableEndpointDiscovery || this.failoverRetryCount > MaxRetryCount) { - logger.warn("ShouldRetryOnEndpointFailureAsync() Not retrying. Retry count = {}", this.failoverRetryCount); - return Single.just(ShouldRetryResult.noRetry()); - } - - this.failoverRetryCount++; - - // Mark the current read endpoint as unavailable - if (this.isReadRequest) { - logger.warn("marking the endpoint {} as unavailable for read",this.locationEndpoint); - this.globalEndpointManager.markEndpointUnavailableForRead(this.locationEndpoint); - } else { - logger.warn("marking the endpoint {} as unavailable for write",this.locationEndpoint); - this.globalEndpointManager.markEndpointUnavailableForWrite(this.locationEndpoint); - } - - // Some requests may be in progress when the endpoint manager and client are closed. - // In that case, the request won't succeed since the http client is closed. - // Therefore just skip the retry here to avoid the delay because retrying won't go through in the end. - - Duration retryDelay = Duration.ZERO; - if (!this.isReadRequest) { - logger.debug("Failover happening. retryCount {}", this.failoverRetryCount); - if (this.failoverRetryCount > 1) { - //if retried both endpoints, follow regular retry interval. - retryDelay = Duration.ofMillis(ClientRetryPolicy.RetryIntervalInMS); - } - } else { - retryDelay = Duration.ofMillis(ClientRetryPolicy.RetryIntervalInMS); - } - this.retryContext = new RetryContext(this.failoverRetryCount, false); - return this.globalEndpointManager.refreshLocationAsync(null) - .andThen(Single.just(ShouldRetryResult.retryAfter(retryDelay))); - } - - @Override - public void onBeforeSendRequest(RxDocumentServiceRequest request) { - this.isReadRequest = request.isReadOnlyRequest(); - this.canUseMultipleWriteLocations = this.globalEndpointManager.CanUseMultipleWriteLocations(request); - if (request.requestContext != null) { - request.requestContext.clientSideRequestStatistics = this.clientSideRequestStatistics; - } - - // clear previous location-based routing directive - if (request.requestContext != null) { - request.requestContext.ClearRouteToLocation(); - } - if (this.retryContext != null) { - // set location-based routing directive based on request retry context - request.requestContext.RouteToLocation(this.retryContext.retryCount, this.retryContext.retryRequestOnPreferredLocations); - } - - // Resolve the endpoint for the request and pin the resolution to the resolved endpoint - // This enables marking the endpoint unavailability on endpoint failover/unreachability - this.locationEndpoint = this.globalEndpointManager.resolveServiceEndpoint(request); - if (request.requestContext != null) { - request.requestContext.RouteToLocation(this.locationEndpoint); - } - } - private class RetryContext { - - public int retryCount; - public boolean retryRequestOnPreferredLocations; - - public RetryContext(int retryCount, - boolean retryRequestOnPreferredLocations) { - this.retryCount = retryCount; - this.retryRequestOnPreferredLocations = retryRequestOnPreferredLocations; - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ConnectionPoolExhaustedRetry.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ConnectionPoolExhaustedRetry.java deleted file mode 100644 index 5f2e166e6ddb..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ConnectionPoolExhaustedRetry.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import io.reactivex.netty.client.PoolExhaustedException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Single; - -import java.time.Duration; - -// rxnetty in servicing a new request throws PoolExhaustedException -// if all connections are in used and max connection pool size is configured. -class ConnectionPoolExhaustedRetry implements IDocumentClientRetryPolicy { - private static final Logger logger = LoggerFactory.getLogger(ConnectionPoolExhaustedRetry.class); - static final Duration RETRY_WAIT_TIME = Duration.ofMillis(10); - static final int MAX_RETRY_COUNT = 10; - - private int retryCount = 0; - - @Override - public Single shouldRetry(Exception e) { - boolean isConnectionPoolExhaustedException = isConnectionPoolExhaustedException(e); - assert isConnectionPoolExhaustedException; - if (!isConnectionPoolExhaustedException) { - logger.error("Fatal error invalid retry path for {}", e.getMessage(), e); - return Single.just(ShouldRetryResult.error(e)); - } - - if (++retryCount <= MAX_RETRY_COUNT) { - logger.warn("PoolExhaustedException failure indicates" + - " the load on the SDK is higher than what current connection pool size can support" + - " either increase the connection pool size for the configured connection mode," + - " or distribute the load on more machines. retry count {}", retryCount); - return Single.just(ShouldRetryResult.retryAfter(RETRY_WAIT_TIME)); - } else { - logger.error("PoolExhaustedException failure indicates" + - " the load on the SDK is higher than what current connection pool size can support" + - " either increase the connection pool size for the configured connection mode," + - " or distribute the load on more machines. All retries exhausted!"); - return Single.just(ShouldRetryResult.error(e)); - } - } - - @Override - public void onBeforeSendRequest(RxDocumentServiceRequest request) { - // no op - } - - static boolean isConnectionPoolExhaustedException(Exception ex) { - while (ex != null) { - if (ex instanceof PoolExhaustedException) { - return true; - } - - Throwable t = ex.getCause(); - if (!(t instanceof Exception)) { - break; - } - - ex = (Exception) t; - } - - return false; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/GlobalEndpointManager.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/GlobalEndpointManager.java deleted file mode 100644 index 6e304f39b7a9..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/GlobalEndpointManager.java +++ /dev/null @@ -1,267 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.DatabaseAccount; -import com.microsoft.azure.cosmosdb.DatabaseAccountManagerInternal; -import com.microsoft.azure.cosmosdb.internal.routing.LocationCache; -import com.microsoft.azure.cosmosdb.rx.internal.routing.LocationHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Completable; -import rx.Observable; -import rx.Scheduler; -import rx.Single; -import rx.functions.Func1; -import rx.schedulers.Schedulers; -import org.apache.commons.collections4.list.UnmodifiableList; - - -import java.net.URISyntaxException; -import java.net.URL; -import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; - -/** - * Endpoint region cache manager implementation. Supports cross region address routing based on - * availability and preference list. - */ -public class GlobalEndpointManager implements AutoCloseable { - private static final Logger logger = LoggerFactory.getLogger(GlobalEndpointManager.class); - - private final int backgroundRefreshLocationTimeIntervalInMS; - private final LocationCache locationCache; - private final URL defaultEndpoint; - private final ConnectionPolicy connectionPolicy; - private final DatabaseAccountManagerInternal owner; - private final AtomicBoolean isRefreshing; - private final ExecutorService executor = Executors.newSingleThreadExecutor(); - private final Scheduler scheduler = Schedulers.from(executor); - private volatile boolean isClosed; - - public GlobalEndpointManager(DatabaseAccountManagerInternal owner, ConnectionPolicy connectionPolicy, Configs configs) { - this.backgroundRefreshLocationTimeIntervalInMS = configs.getUnavailableLocationsExpirationTimeInSeconds() * 1000; - try { - this.locationCache = new LocationCache( - new ArrayList<>(connectionPolicy.getPreferredLocations() != null ? - connectionPolicy.getPreferredLocations(): - Collections.emptyList() - ), - owner.getServiceEndpoint().toURL(), - connectionPolicy.getEnableEndpointDiscovery(), - BridgeInternal.getUseMultipleWriteLocations(connectionPolicy), - configs); - - this.owner = owner; - this.defaultEndpoint = owner.getServiceEndpoint().toURL(); - this.connectionPolicy = connectionPolicy; - - this.isRefreshing = new AtomicBoolean(false); - this.isClosed = false; - } catch (Exception e) { - throw new IllegalArgumentException(e); - } - } - - public void init() { - // TODO: add support for openAsync - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/332589 - startRefreshLocationTimerAsync(true).toCompletable().await(); - } - - public UnmodifiableList getReadEndpoints() { - // readonly - return this.locationCache.getReadEndpoints(); - } - - public UnmodifiableList getWriteEndpoints() { - //readonly - return this.locationCache.getWriteEndpoints(); - } - - public static Single getDatabaseAccountFromAnyLocationsAsync( - URL defaultEndpoint, List locations, Func1> getDatabaseAccountFn) { - - return getDatabaseAccountFn.call(defaultEndpoint).onErrorResumeNext( - e -> { - logger.error("Fail to reach global gateway [{}], [{}]", defaultEndpoint, e.getMessage()); - if (locations.isEmpty()) { - return Single.error(e); - } - - Observable> obs = Observable.range(0, locations.size()) - .map(index -> getDatabaseAccountFn.call(LocationHelper.getLocationEndpoint(defaultEndpoint, locations.get(index))).toObservable()); - - // iterate and get the database account from the first non failure, otherwise get the last error. - Observable res = Observable.concatDelayError(obs).first().single(); - return res.toSingle().doOnError( - innerE -> { - logger.error("Fail to reach location any of locations", String.join(",", locations), innerE.getMessage()); - }); - }); - } - - public URL resolveServiceEndpoint(RxDocumentServiceRequest request) { - return this.locationCache.resolveServiceEndpoint(request); - } - - public void markEndpointUnavailableForRead(URL endpoint) { - logger.debug("Marking endpoint {} unavailable for read",endpoint); - this.locationCache.markEndpointUnavailableForRead(endpoint);; - } - - public void markEndpointUnavailableForWrite(URL endpoint) { - logger.debug("Marking endpoint {} unavailable for Write",endpoint); - this.locationCache.markEndpointUnavailableForWrite(endpoint); - } - - public boolean CanUseMultipleWriteLocations(RxDocumentServiceRequest request) { - return this.locationCache.canUseMultipleWriteLocations(request); - } - - public void close() { - this.isClosed = true; - this.executor.shutdown(); - logger.debug("GlobalEndpointManager closed."); - } - - public Completable refreshLocationAsync(DatabaseAccount databaseAccount) { - return Completable.defer(() -> { - logger.debug("refreshLocationAsync() invoked"); - if (!isRefreshing.compareAndSet(false, true)) { - logger.debug("in the middle of another refresh. Not invoking a new refresh."); - return Completable.complete(); - } - - logger.debug("will refresh"); - return this.refreshLocationPrivateAsync(databaseAccount).doOnError(e -> this.isRefreshing.set(false)); - }); - } - - private Completable refreshLocationPrivateAsync(DatabaseAccount databaseAccount) { - return Completable.defer(() -> { - logger.debug("refreshLocationPrivateAsync() refreshing locations"); - - if (databaseAccount != null) { - this.locationCache.onDatabaseAccountRead(databaseAccount); - } - - Utils.ValueHolder canRefreshInBackground = new Utils.ValueHolder(); - if (this.locationCache.shouldRefreshEndpoints(canRefreshInBackground)) { - logger.debug("shouldRefreshEndpoints: true"); - - if (databaseAccount == null && !canRefreshInBackground.v) { - logger.debug("shouldRefreshEndpoints: can't be done in background"); - - Single databaseAccountObs = getDatabaseAccountFromAnyLocationsAsync( - this.defaultEndpoint, - new ArrayList<>(this.connectionPolicy.getPreferredLocations()), - url -> this.getDatabaseAccountAsync(url)); - - return databaseAccountObs.map(dbAccount -> { - this.locationCache.onDatabaseAccountRead(dbAccount); - return dbAccount; - }).flatMapCompletable(dbAccount -> { - // trigger a startRefreshLocationTimerAsync don't wait on it. - this.startRefreshLocationTimerAsync(); - return Completable.complete(); - }); - } - - // trigger a startRefreshLocationTimerAsync don't wait on it. - this.startRefreshLocationTimerAsync(); - - return Completable.complete(); - } else { - logger.debug("shouldRefreshEndpoints: false, nothing to do."); - this.isRefreshing.set(false); - return Completable.complete(); - } - }); - } - - private void startRefreshLocationTimerAsync() { - startRefreshLocationTimerAsync(false).subscribe(); - } - - private Observable startRefreshLocationTimerAsync(boolean initialization) { - - if (this.isClosed) { - logger.debug("startRefreshLocationTimerAsync: nothing to do, it is closed"); - // if client is already closed, nothing to be done, just return. - return Observable.empty(); - } - - logger.debug("registering a refresh in [{}] ms", this.backgroundRefreshLocationTimeIntervalInMS); - LocalDateTime now = LocalDateTime.now(); - - int delayInMillis = initialization ? 0: this.backgroundRefreshLocationTimeIntervalInMS; - - return Observable.timer(delayInMillis, TimeUnit.MILLISECONDS) - .toSingle().flatMapCompletable( - t -> { - if (this.isClosed) { - logger.warn("client already closed"); - // if client is already closed, nothing to be done, just return. - return Completable.complete(); - } - - logger.debug("startRefreshLocationTimerAsync() - Invoking refresh, I was registered on [{}]", now); - Single databaseAccountObs = GlobalEndpointManager.getDatabaseAccountFromAnyLocationsAsync(this.defaultEndpoint, new ArrayList<>(this.connectionPolicy.getPreferredLocations()), - url -> this.getDatabaseAccountAsync(url)).toObservable().toSingle(); - - return databaseAccountObs.flatMapCompletable(dbAccount -> { - logger.debug("db account retrieved"); - return this.refreshLocationPrivateAsync(dbAccount); - }); - }).onErrorResumeNext(ex -> { - logger.error("startRefreshLocationTimerAsync() - Unable to refresh database account from any location. Exception: {}", ex.toString(), ex); - - this.startRefreshLocationTimerAsync(); - return Completable.complete(); - }).toObservable().subscribeOn(scheduler); - } - - private Single getDatabaseAccountAsync(URL serviceEndpoint) { - try { - return this.owner.getDatabaseAccountFromEndpoint(serviceEndpoint.toURI()) - .doOnNext(i -> logger.debug("account retrieved: {}", i)).toSingle(); - } catch (URISyntaxException e) { - return Single.error(e); - } - } - - public boolean isClosed() { - return this.isClosed; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IAuthorizationTokenProvider.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IAuthorizationTokenProvider.java deleted file mode 100644 index d67b23f6bbe1..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IAuthorizationTokenProvider.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.util.Map; - -import com.microsoft.azure.cosmosdb.internal.ResourceType; - -public interface IAuthorizationTokenProvider { - String getUserAuthorizationToken(String resourceAddress, - ResourceType resourceType, - String get, - Map headers, - AuthorizationTokenType primarymasterkey, - Map properties); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ICollectionRoutingMapCache.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ICollectionRoutingMapCache.java deleted file mode 100644 index bd34d1b82d97..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ICollectionRoutingMapCache.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.internal.routing.CollectionRoutingMap; - -import rx.Single; - -import java.util.Map; - -// TODO: add documentation -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - **/ -public interface ICollectionRoutingMapCache { - default Single tryLookupAsync( - String collectionRid, - CollectionRoutingMap previousValue, - Map properties) { - return tryLookupAsync(collectionRid, previousValue, false, properties); - } - - Single tryLookupAsync( - String collectionRid, - CollectionRoutingMap previousValue, - boolean forceRefreshCollectionRoutingMap, - Map properties); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IDocumentClientRetryPolicy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IDocumentClientRetryPolicy.java deleted file mode 100644 index 7f78ad446cf5..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IDocumentClientRetryPolicy.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import rx.Single; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public interface IDocumentClientRetryPolicy extends IRetryPolicy { - - // TODO: this is just a place holder for now. As .Net has this method. - // I have to spend more time figure out what's the right pattern for this (if method needed) - - /// - /// Method that is called before a request is sent to allow the retry policy implementation - /// to modify the state of the request. - /// - /// The request being sent to the service. - /// - /// Currently only read operations will invoke this method. There is no scenario for write - /// operations to modify requests before retrying. - /// - - // TODO: I need to investigate what's the right contract here and/or if/how this is useful - void onBeforeSendRequest(RxDocumentServiceRequest request); - - - class NoRetry implements IDocumentClientRetryPolicy { - - private static NoRetry instance = new NoRetry(); - - private NoRetry() {} - - public static NoRetry getInstance() { - return instance; - } - - @Override - public void onBeforeSendRequest(RxDocumentServiceRequest request) { - // no op - } - - @Override - public Single shouldRetry(Exception e) { - return Single.just(ShouldRetryResult.error(e)); - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IRetryPolicy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IRetryPolicy.java deleted file mode 100644 index 066e4f39509b..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IRetryPolicy.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.time.Duration; - -import com.microsoft.azure.cosmosdb.internal.Quadruple; - -import rx.Single; - -// TODO update documentation -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public interface IRetryPolicy { - // this capture all the retry logic - // TODO: design decision should this return a single or an observable? - - /// - /// Method that is called to determine from the policy that needs to retry on the exception - /// - /// Exception during the callback method invocation - /// - /// If the retry needs to be attempted or not - Single shouldRetry(Exception e); - - - class ShouldRetryResult { - /// - /// How long to wait before next retry. 0 indicates retry immediately. - /// - public final Duration backOffTime; - public final Exception exception; - public boolean shouldRetry; - public final Quadruple policyArg; - - private ShouldRetryResult(Duration dur, Exception e, boolean shouldRetry, - Quadruple policyArg) { - this.backOffTime = dur; - this.exception = e; - this.shouldRetry = shouldRetry; - this.policyArg = policyArg; - } - - public static ShouldRetryResult retryAfter(Duration dur) { - Utils.checkNotNullOrThrow(dur, "duration", "cannot be null"); - return new ShouldRetryResult(dur, null, true, null); - } - - public static ShouldRetryResult retryAfter(Duration dur, - Quadruple policyArg) { - Utils.checkNotNullOrThrow(dur, "duration", "cannot be null"); - return new ShouldRetryResult(dur, null, true, policyArg); - } - - public static ShouldRetryResult error(Exception e) { - Utils.checkNotNullOrThrow(e, "exception", "cannot be null"); - return new ShouldRetryResult(null, e, false, null); - } - - public static ShouldRetryResult noRetry() { - return new ShouldRetryResult(null, null, false, null); - } - - public void throwIfDoneTrying(Exception capturedException) throws Exception { - if (this.shouldRetry) { - return; - } - - if (this.exception == null) { - throw capturedException; - } else { - throw this.exception; - } - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IRetryPolicyFactory.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IRetryPolicyFactory.java deleted file mode 100644 index 3c36fd5fa0c6..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IRetryPolicyFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public interface IRetryPolicyFactory { - IDocumentClientRetryPolicy getRequestPolicy(); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IRoutingMapProvider.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IRoutingMapProvider.java deleted file mode 100644 index 34f270b493fc..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/IRoutingMapProvider.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.util.List; -import java.util.Map; - -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.routing.Range; - -import rx.Single; - -//TODO: update documentation -//TODO: add two overload methods for forceRefresh = false -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - **/ -public interface IRoutingMapProvider { - /// - /// Returns list of effective partition key ranges for a collection. - /// - /// Collection for which to retrieve routing map. - /// This method will return all ranges which overlap this range. - /// Whether forcefully refreshing the routing map is necessary - /// List of effective partition key ranges for a collection or null if collection doesn't exist. - Single> tryGetOverlappingRangesAsync(String collectionResourceId, Range range, - boolean forceRefresh /* = false */, Map properties); - - Single tryGetPartitionKeyRangeByIdAsync(String collectionResourceId, String partitionKeyRangeId, - boolean forceRefresh /* = false */, Map properties); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/InvalidPartitionException.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/InvalidPartitionException.java deleted file mode 100644 index 2710eaf0cce5..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/InvalidPartitionException.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.HttpUtils; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.WFConstants; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.net.URI; -import java.util.Map; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class InvalidPartitionException extends DocumentClientException { - - private static final long serialVersionUID = 1L; - - public InvalidPartitionException() { - this(RMResources.Gone); - } - - public InvalidPartitionException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.GONE, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public InvalidPartitionException(String msg) { - super(HttpConstants.StatusCodes.GONE, msg); - setSubStatus(); - } - - public InvalidPartitionException(String msg, String resourceAddress) { - super(msg, null, null, HttpConstants.StatusCodes.GONE, resourceAddress); - setSubStatus(); - } - - public InvalidPartitionException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public InvalidPartitionException(Exception innerException) { - this(RMResources.Gone, innerException, null, null); - } - - public InvalidPartitionException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - super(String.format("%s: %s", RMResources.Gone, message), - innerException, - HttpUtils.asMap(headers), - HttpConstants.StatusCodes.GONE, - requestUri); - - setSubStatus(); - } - - private void setSubStatus() { - this.getResponseHeaders().put( - WFConstants.BackendHeaders.SUB_STATUS, - Integer.toString(HttpConstants.SubStatusCodes.NAME_CACHE_IS_STALE)); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/InvalidPartitionExceptionRetryPolicy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/InvalidPartitionExceptionRetryPolicy.java deleted file mode 100644 index cdd7540ddb08..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/InvalidPartitionExceptionRetryPolicy.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.time.Duration; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxCollectionCache; - -import rx.Single; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class InvalidPartitionExceptionRetryPolicy implements IDocumentClientRetryPolicy { - - private final RxCollectionCache clientCollectionCache; - private final IDocumentClientRetryPolicy nextPolicy; - private final String collectionLink; - private final FeedOptions feedOptions; - - private volatile boolean retried = false; - - public InvalidPartitionExceptionRetryPolicy(RxCollectionCache collectionCache, - IDocumentClientRetryPolicy nextPolicy, - String resourceFullName, - FeedOptions feedOptions) { - - this.clientCollectionCache = collectionCache; - this.nextPolicy = nextPolicy; - - // TODO the resource address should be inferred from exception - this.collectionLink = com.microsoft.azure.cosmosdb.internal.Utils.getCollectionName(resourceFullName); - this.feedOptions = feedOptions; - } - - @Override - public void onBeforeSendRequest(RxDocumentServiceRequest request) { - this.nextPolicy.onBeforeSendRequest(request); - } - - @Override - public Single shouldRetry(Exception e) { - DocumentClientException clientException = Utils.as(e, DocumentClientException.class); - if (clientException != null && - Exceptions.isStatusCode(clientException, HttpConstants.StatusCodes.GONE) && - Exceptions.isSubStatusCode(clientException, HttpConstants.SubStatusCodes.NAME_CACHE_IS_STALE)) { - if (!this.retried) { - // TODO: resource address should be accessible from the exception - //this.clientCollectionCache.Refresh(clientException.ResourceAddress); - // TODO: this is blocking. is that fine? - if(this.feedOptions != null) { - this.clientCollectionCache.refresh(collectionLink,this.feedOptions.getProperties()); - } else { - this.clientCollectionCache.refresh(collectionLink,null); - } - - this.retried = true; - return Single.just(ShouldRetryResult.retryAfter(Duration.ZERO)); - } else { - return Single.just(ShouldRetryResult.error(e)); - } - } - - return this.nextPolicy.shouldRetry(e); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/NotFoundException.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/NotFoundException.java deleted file mode 100644 index 3e949875c4d2..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/NotFoundException.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.HttpUtils; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.net.URI; -import java.util.Map; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class NotFoundException extends DocumentClientException { - private static final long serialVersionUID = 1L; - - public NotFoundException() { - this(RMResources.NotFound); - } - - public NotFoundException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.NOTFOUND, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public NotFoundException(String message) { - this(message, (Exception) null, (HttpResponseHeaders) null, null); - } - - public NotFoundException(String message, Map headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public NotFoundException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public NotFoundException(String message, HttpResponseHeaders headers, URI requestUri) { - this(message, headers, requestUri != null ? requestUri.toString() : null); - } - - public NotFoundException(Exception innerException) { - this(RMResources.NotFound, innerException, (Map) null, null); - } - - public NotFoundException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - this(message, innerException, HttpUtils.asMap(headers), requestUri); - } - - public NotFoundException(String message, - Exception innerException, - Map headers, - String requestUri) { - super(String.format("%s: %s", RMResources.NotFound, message), - innerException, - headers, - HttpConstants.StatusCodes.NOTFOUND, - requestUri); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ObservableHelper.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ObservableHelper.java deleted file mode 100644 index 80bf892dedcd..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ObservableHelper.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import rx.Observable; -import rx.Single; -import rx.functions.Func0; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - * - **/ -public class ObservableHelper { - - static public Single inlineIfPossible(Func0> function, IRetryPolicy retryPolicy) { - - if (retryPolicy == null) { - // shortcut - return function.call(); - } else { - return BackoffRetryUtility.executeRetry(function, retryPolicy); - } - } - - static public Observable inlineIfPossibleAsObs(Func0> function, IRetryPolicy retryPolicy) { - - if (retryPolicy == null) { - // shortcut - return Observable.defer(() -> { - return function.call(); - }); - - } else { - return BackoffRetryUtility.executeRetry(() -> function.call().toSingle(), retryPolicy).toObservable(); - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/PartitionIsMigratingException.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/PartitionIsMigratingException.java deleted file mode 100644 index adf2fe3217cc..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/PartitionIsMigratingException.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.HttpUtils; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.WFConstants; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.util.Map; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class PartitionIsMigratingException extends DocumentClientException { - - private static final long serialVersionUID = 1L; - - public PartitionIsMigratingException() { - this(RMResources.Gone); - } - - public PartitionIsMigratingException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.GONE, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public PartitionIsMigratingException(String msg) { - super(HttpConstants.StatusCodes.GONE, msg); - setSubStatus(); - } - - public PartitionIsMigratingException(String msg, String resourceAddress) { - super(msg, null, null, HttpConstants.StatusCodes.GONE, resourceAddress); - setSubStatus(); - } - - public PartitionIsMigratingException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public PartitionIsMigratingException(Exception innerException) { - this(RMResources.Gone, innerException, null, null); - } - - public PartitionIsMigratingException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - super(String.format("%s: %s", RMResources.Gone, message), - innerException, - HttpUtils.asMap(headers), - HttpConstants.StatusCodes.GONE, - requestUri); - - setSubStatus(); - } - - private void setSubStatus() { - this.getResponseHeaders().put( - WFConstants.BackendHeaders.SUB_STATUS, - Integer.toString(HttpConstants.SubStatusCodes.COMPLETING_PARTITION_MIGRATION)); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/PartitionKeyMismatchRetryPolicy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/PartitionKeyMismatchRetryPolicy.java deleted file mode 100644 index 45dc11cc0d13..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/PartitionKeyMismatchRetryPolicy.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.time.Duration; -import java.util.concurrent.atomic.AtomicInteger; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxClientCollectionCache; - -import rx.Single; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - * - * A RetryPolicy implementation that ensures the PartitionKeyDefinitionMap is up-to-date. - * Entries in the PartitionKeyDefinitionMap can become stale if a collection is deleted - * and then recreated with the same name but a different partition key definition, if - * the request is made using name-based links. - * - * TODO: verify with Sergii, other than collection deleted and recreated with the same name - * is there any other scenario which this should be used? - * - */ -public class PartitionKeyMismatchRetryPolicy implements IDocumentClientRetryPolicy { - private RxClientCollectionCache clientCollectionCache; - private IDocumentClientRetryPolicy nextRetryPolicy; - private AtomicInteger retriesAttempted = new AtomicInteger(0); - private String collectionLink; - private RequestOptions options; - private final static int MaxRetries = 1; - - - public PartitionKeyMismatchRetryPolicy( - RxClientCollectionCache clientCollectionCache, - IDocumentClientRetryPolicy nextRetryPolicy, - String resourceFullName, - RequestOptions requestOptions) { - this.clientCollectionCache = clientCollectionCache; - this.nextRetryPolicy = nextRetryPolicy; - - // TODO: this should be retrievable from document client exception. - collectionLink = com.microsoft.azure.cosmosdb.internal.Utils.getCollectionName(resourceFullName); - this.options = options; - } - - - /// - /// Should the caller retry the operation. - /// - /// Exception that occured when the operation was tried - /// - /// True indicates caller should retry, False otherwise - public Single shouldRetry(Exception exception) { - DocumentClientException clientException = Utils.as(exception, DocumentClientException.class) ; - - if (clientException != null && - Exceptions.isStatusCode(clientException, HttpConstants.StatusCodes.BADREQUEST) && - Exceptions.isSubStatusCode(clientException, HttpConstants.SubStatusCodes.PARTITION_KEY_MISMATCH) - && this.retriesAttempted.get() < MaxRetries) { - //Debug.Assert(clientException.ResourceAddress != null); - - // TODO: - //this.clientCollectionCache.refresh(clientException.ResourceAddress); - if (this.options != null) { - this.clientCollectionCache.refresh(collectionLink, this.options.getProperties()); - } else { - this.clientCollectionCache.refresh(collectionLink, null); - } - - this.retriesAttempted.incrementAndGet(); - - return Single.just(ShouldRetryResult.retryAfter(Duration.ZERO)); - } - - return this.nextRetryPolicy.shouldRetry(exception); - } - - - /* (non-Javadoc) - * @see com.microsoft.azure.cosmosdb.rx.internal.query.IDocumentClientRetryPolicy#onBeforeSendRequest(rx.Observable) - */ - @Override - public void onBeforeSendRequest(RxDocumentServiceRequest request) { - // TODO Auto-generated method stub - this.nextRetryPolicy.onBeforeSendRequest(request); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/PartitionKeyRangeGoneRetryPolicy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/PartitionKeyRangeGoneRetryPolicy.java deleted file mode 100644 index 3a2c60a5de24..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/PartitionKeyRangeGoneRetryPolicy.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.time.Duration; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.routing.CollectionRoutingMap; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxCollectionCache; -import com.microsoft.azure.cosmosdb.rx.internal.caches.IPartitionKeyRangeCache; - -import rx.Observable; -import rx.Single; - -// TODO: this need testing -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class PartitionKeyRangeGoneRetryPolicy implements IDocumentClientRetryPolicy { - - private final RxCollectionCache collectionCache; - private final IDocumentClientRetryPolicy nextRetryPolicy; - private final IPartitionKeyRangeCache partitionKeyRangeCache; - private final String collectionLink; - private final FeedOptions feedOptions; - private volatile boolean retried; - - public PartitionKeyRangeGoneRetryPolicy( - RxCollectionCache collectionCache, - IPartitionKeyRangeCache partitionKeyRangeCache, - String collectionLink, - IDocumentClientRetryPolicy nextRetryPolicy, - FeedOptions feedOptions) { - this.collectionCache = collectionCache; - this.partitionKeyRangeCache = partitionKeyRangeCache; - this.collectionLink = collectionLink; - this.nextRetryPolicy = nextRetryPolicy; - this.feedOptions = feedOptions; - } - - /// - /// Should the caller retry the operation. - /// - /// Exception that occured when the operation was tried - /// - /// True indicates caller should retry, False otherwise - public Single shouldRetry(Exception exception) { - DocumentClientException clientException = Utils.as(exception, DocumentClientException.class); - if (clientException != null && - Exceptions.isStatusCode(clientException, HttpConstants.StatusCodes.GONE) && - Exceptions.isSubStatusCode(clientException, HttpConstants.SubStatusCodes.PARTITION_KEY_RANGE_GONE)) { - - if (this.retried){ - return Single.just(ShouldRetryResult.error(clientException)); - } - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - this.collectionLink, - null - // AuthorizationTokenType.PrimaryMasterKey) - ); - if (this.feedOptions != null) { - request.properties = this.feedOptions.getProperties(); - } - Single collectionObs = this.collectionCache.resolveCollectionAsync(request); - - Single retryTimeObservable = collectionObs.flatMap(collection -> { - - Single routingMapObs = this.partitionKeyRangeCache.tryLookupAsync(collection.getResourceId(), null, request.properties); - - Single refreshedRoutingMapObs = routingMapObs.flatMap(routingMap -> { - if (routingMap != null) { - // Force refresh. - return this.partitionKeyRangeCache.tryLookupAsync( - collection.getResourceId(), - routingMap, - request.properties); - } else { - return Observable.just((CollectionRoutingMap) null).toSingle(); - } - }); - - return refreshedRoutingMapObs.flatMap(rm -> { - this.retried = true; - return Single.just(ShouldRetryResult.retryAfter(Duration.ZERO)); - }); - - }); - return retryTimeObservable; - - } else { - return this.nextRetryPolicy.shouldRetry(exception); - } - } - - @Override - public void onBeforeSendRequest(RxDocumentServiceRequest request) { - this.nextRetryPolicy.onBeforeSendRequest(request); - } - -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/PartitionKeyRangeIsSplittingException.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/PartitionKeyRangeIsSplittingException.java deleted file mode 100644 index c3a564fa083f..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/PartitionKeyRangeIsSplittingException.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.HttpUtils; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.WFConstants; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; - -import java.util.Map; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class PartitionKeyRangeIsSplittingException extends DocumentClientException { - - private static final long serialVersionUID = 1L; - - public PartitionKeyRangeIsSplittingException() { - this(RMResources.Gone); - } - - public PartitionKeyRangeIsSplittingException(Error error, long lsn, String partitionKeyRangeId, Map responseHeaders) { - super(HttpConstants.StatusCodes.GONE, error, responseHeaders); - BridgeInternal.setLSN(this, lsn); - BridgeInternal.setPartitionKeyRangeId(this, partitionKeyRangeId); - } - - public PartitionKeyRangeIsSplittingException(String msg) { - super(HttpConstants.StatusCodes.GONE, msg); - setSubStatus(); - } - - public PartitionKeyRangeIsSplittingException(String msg, String resourceAddress) { - super(msg, null, null, HttpConstants.StatusCodes.GONE, resourceAddress); - setSubStatus(); - } - - public PartitionKeyRangeIsSplittingException(String message, HttpResponseHeaders headers, String requestUri) { - this(message, null, headers, requestUri); - } - - public PartitionKeyRangeIsSplittingException(Exception innerException) { - this(RMResources.Gone, innerException, null, null); - } - - public PartitionKeyRangeIsSplittingException(String message, - Exception innerException, - HttpResponseHeaders headers, - String requestUri) { - super(String.format("%s: %s", RMResources.Gone, message), - innerException, - HttpUtils.asMap(headers), - HttpConstants.StatusCodes.GONE, - requestUri); - - setSubStatus(); - } - - private void setSubStatus() { - this.getResponseHeaders().put( - WFConstants.BackendHeaders.SUB_STATUS, - Integer.toString(HttpConstants.SubStatusCodes.COMPLETING_SPLIT)); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RenameCollectionAwareClientRetryPolicy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RenameCollectionAwareClientRetryPolicy.java deleted file mode 100644 index 613bd70b07d5..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RenameCollectionAwareClientRetryPolicy.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxClientCollectionCache; - -import org.apache.commons.lang3.StringUtils; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import rx.Single; - -import java.time.Duration; - -public class RenameCollectionAwareClientRetryPolicy implements IDocumentClientRetryPolicy { - - private final static Logger logger = LoggerFactory.getLogger(RenameCollectionAwareClientRetryPolicy.class); - - private final IDocumentClientRetryPolicy retryPolicy; - private final ISessionContainer sessionContainer; - private final RxClientCollectionCache collectionCache; - private RxDocumentServiceRequest request; - private boolean hasTriggered = false; - - public RenameCollectionAwareClientRetryPolicy(ISessionContainer sessionContainer, RxClientCollectionCache collectionCache, IDocumentClientRetryPolicy retryPolicy) { - this.retryPolicy = retryPolicy; - this.sessionContainer = sessionContainer; - this.collectionCache = collectionCache; - this.request = null; - } - - @Override - public void onBeforeSendRequest(RxDocumentServiceRequest request) { - this.request = request; - this.retryPolicy.onBeforeSendRequest(request); - } - - @Override - public Single shouldRetry(Exception e) { - return this.retryPolicy.shouldRetry(e).flatMap(shouldRetryResult -> { - if (!shouldRetryResult.shouldRetry && !this.hasTriggered) { - DocumentClientException clientException = Utils.as(e, DocumentClientException.class); - - if (this.request == null) { - // someone didn't call OnBeforeSendRequest - nothing we can do - logger.error("onBeforeSendRequest is not invoked, encountered failure due to request being null", e); - return Single.just(ShouldRetryResult.error(e)); - } - - if (clientException != null && this.request.getIsNameBased() && - Exceptions.isStatusCode(clientException, HttpConstants.StatusCodes.NOTFOUND) && - Exceptions.isSubStatusCode(clientException, HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE)) { - // Clear the session token, because the collection name might be reused. - logger.warn("Clear the token for named base request {}", request.getResourceAddress()); - - this.sessionContainer.clearTokenByCollectionFullName(request.getResourceAddress()); - - this.hasTriggered = true; - - String oldCollectionRid = request.requestContext.resolvedCollectionRid; - - request.forceNameCacheRefresh = true; - request.requestContext.resolvedCollectionRid = null; - - Single collectionObs = this.collectionCache.resolveCollectionAsync(request); - - return collectionObs.flatMap(collectionInfo -> { - if (collectionInfo == null) { - logger.warn("Can't recover from session unavailable exception because resolving collection name {} returned null", request.getResourceAddress()); - } else if (!StringUtils.isEmpty(oldCollectionRid) && !StringUtils.isEmpty(collectionInfo.getResourceId())) { - return Single.just(ShouldRetryResult.retryAfter(Duration.ZERO)); - } - return Single.just(shouldRetryResult); - }).onErrorResumeNext(throwable -> { - // When resolveCollectionAsync throws an exception ignore it because it's an attempt to recover an existing - // error. When the recovery fails we return ShouldRetryResult.noRetry and propagate the original exception to the client - - logger.warn("Can't recover from session unavailable exception because resolving collection name {} failed with {}", request.getResourceAddress(), throwable.getMessage()); - if (throwable instanceof Exception) { - return Single.just(ShouldRetryResult.error((Exception) throwable)); - } - return Single.error(throwable); - }); - } - } - return Single.just(shouldRetryResult); - }); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ReplicatedResourceClientUtils.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ReplicatedResourceClientUtils.java deleted file mode 100644 index d1f4429cbe01..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ReplicatedResourceClientUtils.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class ReplicatedResourceClientUtils { - - public static boolean isReadingFromMaster(ResourceType resourceType, OperationType operationType) { - if (resourceType == ResourceType.Offer || - resourceType == ResourceType.Database || - resourceType == ResourceType.User || - resourceType == ResourceType.UserDefinedType || - resourceType == ResourceType.Permission || - resourceType == ResourceType.Topology || - resourceType == ResourceType.DatabaseAccount || - (resourceType == ResourceType.PartitionKeyRange && operationType != OperationType.GetSplitPoint && operationType != OperationType.AbortSplit) || - (resourceType == ResourceType.DocumentCollection && (operationType == OperationType.ReadFeed || operationType == OperationType.Query || operationType == OperationType.SqlQuery))) - { - return true; - } - - return false; - } - - public static boolean isMasterResource(ResourceType resourceType) { - if (resourceType == ResourceType.Offer || - resourceType == ResourceType.Database || - resourceType == ResourceType.User || - resourceType == ResourceType.UserDefinedType || - resourceType == ResourceType.Permission || - resourceType == ResourceType.Topology || - resourceType == ResourceType.DatabaseAccount || - resourceType == ResourceType.PartitionKeyRange || - resourceType == ResourceType.DocumentCollection) { - return true; - } - - return false; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ResetSessionTokenRetryPolicyFactory.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ResetSessionTokenRetryPolicyFactory.java deleted file mode 100644 index 1d6e888c61f5..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ResetSessionTokenRetryPolicyFactory.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxClientCollectionCache; - -public class ResetSessionTokenRetryPolicyFactory implements IRetryPolicyFactory { - - private final IRetryPolicyFactory retryPolicy; - private final ISessionContainer sessionContainer; - private final RxClientCollectionCache collectionCache; - - public ResetSessionTokenRetryPolicyFactory(ISessionContainer sessionContainer, RxClientCollectionCache collectionCache, IRetryPolicyFactory retryPolicy) { - this.retryPolicy = retryPolicy; - this.sessionContainer = sessionContainer; - this.collectionCache = collectionCache; - } - - @Override - public IDocumentClientRetryPolicy getRequestPolicy() { - return new RenameCollectionAwareClientRetryPolicy(this.sessionContainer, this.collectionCache, retryPolicy.getRequestPolicy()); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ResourceThrottleRetryPolicy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ResourceThrottleRetryPolicy.java deleted file mode 100644 index 8aeb8e037dfb..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ResourceThrottleRetryPolicy.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.time.Duration; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; - -import rx.Single; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class ResourceThrottleRetryPolicy implements IDocumentClientRetryPolicy{ - - private final static Logger logger = LoggerFactory.getLogger(ResourceThrottleRetryPolicy.class); - - private final static int DefaultMaxWaitTimeInSeconds = 60; - private final static int DefaultRetryInSeconds = 5; - private final int backoffDelayFactor; - private final int maxAttemptCount; - private final Duration maxWaitTime; - - // TODO: is this thread safe? - // should we make this atomic int? - private int currentAttemptCount; - private Duration cumulativeRetryDelay; - - public ResourceThrottleRetryPolicy(int maxAttemptCount, int maxWaitTimeInSeconds) { - this(maxAttemptCount, maxWaitTimeInSeconds, 1); - } - - public ResourceThrottleRetryPolicy(int maxAttemptCount) { - this(maxAttemptCount, DefaultMaxWaitTimeInSeconds, 1); - } - - public ResourceThrottleRetryPolicy(int maxAttemptCount, int maxWaitTimeInSeconds, int backoffDelayFactor) { - Utils.checkStateOrThrow(maxWaitTimeInSeconds < Integer.MAX_VALUE / 1000, "maxWaitTimeInSeconds", "maxWaitTimeInSeconds must be less than " + Integer.MAX_VALUE / 1000); - - this.maxAttemptCount = maxAttemptCount; - this.backoffDelayFactor = backoffDelayFactor; - this.maxWaitTime = Duration.ofSeconds(maxWaitTimeInSeconds); - this.currentAttemptCount = 0; - this.cumulativeRetryDelay = Duration.ZERO; - } - - @Override - public Single shouldRetry(Exception exception) { - Duration retryDelay = Duration.ZERO; - - if (this.currentAttemptCount < this.maxAttemptCount && - (retryDelay = checkIfRetryNeeded(exception)) != null) { - this.currentAttemptCount++; - logger.warn( - "Operation will be retried after {} milliseconds. Current attempt {}, Cumulative delay {}", - retryDelay.toMillis(), - this.currentAttemptCount, - this.cumulativeRetryDelay, - exception); - return Single.just(ShouldRetryResult.retryAfter(retryDelay)); - } else { - logger.debug( - "Operation will NOT be retried. Current attempt {}", - this.currentAttemptCount, - exception); - return Single.just(ShouldRetryResult.noRetry()); - } - } - - @Override - public void onBeforeSendRequest(RxDocumentServiceRequest request) { - // no op - } - - // if retry not needed reaturns null - /// - /// Returns True if the given exception is retriable - /// - /// Exception to examine - /// retryDelay - /// True if the exception is retriable; False otherwise - private Duration checkIfRetryNeeded(Exception exception) { - Duration retryDelay = Duration.ZERO; - - DocumentClientException dce = Utils.as(exception, DocumentClientException.class); - - if (dce != null){ - - if (Exceptions.isStatusCode(dce, HttpConstants.StatusCodes.TOO_MANY_REQUESTS)) { - retryDelay = Duration.ofMillis(dce.getRetryAfterInMilliseconds()); - if (this.backoffDelayFactor > 1) { - retryDelay = Duration.ofNanos(retryDelay.toNanos() * this.backoffDelayFactor); - } - - if (retryDelay.toMillis() < this.maxWaitTime.toMillis() && - this.maxWaitTime.toMillis() >= (this.cumulativeRetryDelay = retryDelay.plus(this.cumulativeRetryDelay)).toMillis()) - { - if (retryDelay == Duration.ZERO){ - // we should never reach here as BE should turn non-zero of retryDelay - logger.trace("Received retryDelay of 0 with Http 429", exception); - retryDelay = Duration.ofSeconds(DefaultRetryInSeconds); - } - - return retryDelay; - } - } - } - // if retry not needed returns null - return null; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RetryPolicy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RetryPolicy.java deleted file mode 100644 index 9ac61a56f331..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RetryPolicy.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.RetryOptions; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - * - * Represents the retry policy configuration associated with a DocumentClient instance. - */ -public class RetryPolicy implements IRetryPolicyFactory { - private final GlobalEndpointManager globalEndpointManager; - private final boolean enableEndpointDiscovery; - private final RetryOptions retryOptions; - - public RetryPolicy(GlobalEndpointManager globalEndpointManager, ConnectionPolicy connectionPolicy) { - this.enableEndpointDiscovery = connectionPolicy.getEnableEndpointDiscovery(); - this.globalEndpointManager = globalEndpointManager; - this.retryOptions = connectionPolicy.getRetryOptions(); - } - - @Override - public IDocumentClientRetryPolicy getRequestPolicy() { - ClientRetryPolicy clientRetryPolicy = new ClientRetryPolicy(this.globalEndpointManager, - this.enableEndpointDiscovery, this.retryOptions); - - return clientRetryPolicy; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RetryUtils.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RetryUtils.java deleted file mode 100644 index 7432a3ebdef6..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RetryUtils.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.time.Duration; -import java.util.concurrent.TimeUnit; - -import org.apache.commons.lang3.time.StopWatch; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.microsoft.azure.cosmosdb.internal.Quadruple; -import com.microsoft.azure.cosmosdb.rx.internal.IRetryPolicy.ShouldRetryResult; - -import rx.Observable; -import rx.Single; -import rx.functions.Func1; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class RetryUtils { - private final static Logger logger = LoggerFactory.getLogger(BackoffRetryUtility.class); - - public static Func1, Observable> toRetryWhenFunc(IRetryPolicy policy) { - return new Func1, Observable>() { - - @Override - public Observable call(Observable throwableObs) { - return throwableObs.flatMap( t -> { - Exception e = Utils.as(t, Exception.class); - if (e == null) { - return Observable.error(t); - } - - return policy.shouldRetry(e).toObservable().flatMap(s -> { - - if (s.backOffTime != null) { - return Observable.timer(s.backOffTime.toMillis(), TimeUnit.MILLISECONDS); - } else if (s.exception != null) { - return Observable.error(s.exception); - } else { - // NoRetry return original failure - return Observable.error(t); - } - }); - }); - } - }; - } - - /** - * This method will be called after getting error on callbackMethod , and then keep trying between - * callbackMethod and inBackoffAlternateCallbackMethod until success or as stated in - * retry policy. - * @param callbackMethod The callbackMethod - * @param policy Retry policy - * @param inBackoffAlternateCallbackMethod The inBackoffAlternateCallbackMethod - * @param minBackoffForInBackoffCallback Minimum backoff for InBackoffCallbackMethod - * @return - */ - static Func1> toRetryWithAlternateFunc( - Func1, Single> callbackMethod, IRetryPolicy policy, - Func1, Single> inBackoffAlternateCallbackMethod, - Duration minBackoffForInBackoffCallback) { - return new Func1>() { - - @Override - public Single call(Throwable t) { - Exception e = Utils.as(t, Exception.class); - if (e == null) { - return Single.error(t); - } - - return policy.shouldRetry(e).flatMap(shouldRetryResult -> { - if (!shouldRetryResult.shouldRetry) { - if(shouldRetryResult.exception == null) { - return Single.error(e); - } else { - return Single.error(shouldRetryResult.exception); - } - } - - if (inBackoffAlternateCallbackMethod != null - && shouldRetryResult.backOffTime.compareTo(minBackoffForInBackoffCallback) > 0) { - StopWatch stopwatch = new StopWatch(); - startStopWatch(stopwatch); - return inBackoffAlternateCallbackMethod.call(shouldRetryResult.policyArg) - .onErrorResumeNext(recurrsiveWithAlternateFunc(callbackMethod, policy, - inBackoffAlternateCallbackMethod, shouldRetryResult, stopwatch, - minBackoffForInBackoffCallback)); - } else { - return recurrsiveFunc(callbackMethod, policy, inBackoffAlternateCallbackMethod, - shouldRetryResult, minBackoffForInBackoffCallback) - .delaySubscription(Observable.timer(shouldRetryResult.backOffTime.toMillis(), - TimeUnit.MILLISECONDS)); - } - }); - } - }; - - } - - private static Single recurrsiveFunc( - Func1, Single> callbackMethod, IRetryPolicy policy, - Func1, Single> inBackoffAlternateCallbackMethod, - ShouldRetryResult shouldRetryResult, Duration minBackoffForInBackoffCallback) { - return callbackMethod.call(shouldRetryResult.policyArg).onErrorResumeNext(toRetryWithAlternateFunc( - callbackMethod, policy, inBackoffAlternateCallbackMethod, minBackoffForInBackoffCallback)); - - } - - private static Func1> recurrsiveWithAlternateFunc( - Func1, Single> callbackMethod, IRetryPolicy policy, - Func1, Single> inBackoffAlternateCallbackMethod, - ShouldRetryResult shouldRetryResult, StopWatch stopwatch, Duration minBackoffForInBackoffCallback) { - return new Func1>() { - - @Override - public Single call(Throwable t) { - - Exception e = Utils.as(t, Exception.class); - if (e == null) { - return Single.error(t); - } - - stopStopWatch(stopwatch); - logger.info("Failed inBackoffAlternateCallback with {}, proceeding with retry. Time taken: {}ms", - e.toString(), stopwatch.getTime()); - Duration backoffTime = shouldRetryResult.backOffTime.toMillis() > stopwatch.getTime() - ? Duration.ofMillis(shouldRetryResult.backOffTime.toMillis() - stopwatch.getTime()) - : Duration.ZERO; - return recurrsiveFunc(callbackMethod, policy, inBackoffAlternateCallbackMethod, shouldRetryResult, - minBackoffForInBackoffCallback) - .delaySubscription(Observable.timer(backoffTime.toMillis(), TimeUnit.MILLISECONDS)); - } - - }; - } - - private static void stopStopWatch(StopWatch stopwatch) { - synchronized (stopwatch) { - stopwatch.stop(); - } - } - - private static void startStopWatch(StopWatch stopwatch) { - synchronized (stopwatch) { - stopwatch.start(); - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxGatewayStoreModel.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxGatewayStoreModel.java deleted file mode 100644 index 7de0b323f9d9..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxGatewayStoreModel.java +++ /dev/null @@ -1,555 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.PathsHelper; -import com.microsoft.azure.cosmosdb.internal.QueryCompatibilityMode; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.RuntimeConstants; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.HttpUtils; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreResponse; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.handler.codec.http.HttpMethod; -import io.netty.handler.codec.http.HttpResponseStatus; -import io.reactivex.netty.client.RxClient; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Observable; -import rx.Single; -import rx.functions.Func0; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.net.URISyntaxException; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - * - * Used internally to provide functionality to communicate and process response from Gateway in the Azure Cosmos DB database service. - */ -class RxGatewayStoreModel implements RxStoreModel { - - private final static int INITIAL_RESPONSE_BUFFER_SIZE = 1024; - private final Logger logger = LoggerFactory.getLogger(RxGatewayStoreModel.class); - private final Map defaultHeaders; - private final CompositeHttpClient httpClient; - private final QueryCompatibilityMode queryCompatibilityMode; - private final GlobalEndpointManager globalEndpointManager; - private ConsistencyLevel defaultConsistencyLevel; - private ISessionContainer sessionContainer; - - public RxGatewayStoreModel( - ISessionContainer sessionContainer, - ConsistencyLevel defaultConsistencyLevel, - QueryCompatibilityMode queryCompatibilityMode, - UserAgentContainer userAgentContainer, - GlobalEndpointManager globalEndpointManager, - CompositeHttpClient httpClient) { - this.defaultHeaders = new HashMap<>(); - this.defaultHeaders.put(HttpConstants.HttpHeaders.CACHE_CONTROL, - "no-cache"); - this.defaultHeaders.put(HttpConstants.HttpHeaders.VERSION, - HttpConstants.Versions.CURRENT_VERSION); - - if (userAgentContainer == null) { - userAgentContainer = new UserAgentContainer(); - } - - this.defaultHeaders.put(HttpConstants.HttpHeaders.USER_AGENT, userAgentContainer.getUserAgent()); - - if (defaultConsistencyLevel != null) { - this.defaultHeaders.put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, - defaultConsistencyLevel.toString()); - } - - this.defaultConsistencyLevel = defaultConsistencyLevel; - this.globalEndpointManager = globalEndpointManager; - this.queryCompatibilityMode = queryCompatibilityMode; - - this.httpClient = httpClient; - this.sessionContainer = sessionContainer; - } - - private Observable doCreate(RxDocumentServiceRequest request) { - return this.performRequest(request, HttpMethod.POST); - } - - private Observable upsert(RxDocumentServiceRequest request) { - return this.performRequest(request, HttpMethod.POST); - } - - private Observable read(RxDocumentServiceRequest request) { - return this.performRequest(request, HttpMethod.GET); - } - - private Observable replace(RxDocumentServiceRequest request) { - return this.performRequest(request, HttpMethod.PUT); - } - - private Observable delete(RxDocumentServiceRequest request) { - return this.performRequest(request, HttpMethod.DELETE); - } - - private Observable execute(RxDocumentServiceRequest request) { - return this.performRequest(request, HttpMethod.POST); - } - - private Observable readFeed(RxDocumentServiceRequest request) { - return this.performRequest(request, HttpMethod.GET); - } - - private Observable query(RxDocumentServiceRequest request) { - request.getHeaders().put(HttpConstants.HttpHeaders.IS_QUERY, "true"); - - switch (this.queryCompatibilityMode) { - case SqlQuery: - request.getHeaders().put(HttpConstants.HttpHeaders.CONTENT_TYPE, - RuntimeConstants.MediaTypes.SQL); - break; - case Default: - case Query: - default: - request.getHeaders().put(HttpConstants.HttpHeaders.CONTENT_TYPE, - RuntimeConstants.MediaTypes.QUERY_JSON); - break; - } - return this.performRequest(request, HttpMethod.POST); - } - - /** - * Given the request it creates an observable which upon subscription issues HTTP call and emits one RxDocumentServiceResponse. - * - * @param request - * @param method - * @return Observable - */ - public Observable performRequest(RxDocumentServiceRequest request, HttpMethod method) { - - try { - URI uri = getUri(request); - HttpClientRequest httpRequest = HttpClientRequest.create(method, uri.toString()); - - this.fillHttpRequestBaseWithHeaders(request.getHeaders(), httpRequest); - - if (request.getContentObservable() != null) { - - // TODO validate this - // convert byte[] to ByteBuf - // why not use Observable directly? - Observable byteBufObservable = request.getContentObservable() - .map(bytes -> Unpooled.wrappedBuffer(bytes)); - - httpRequest.withContentSource(byteBufObservable); - } else if (request.getContent() != null){ - httpRequest.withContent(request.getContent()); - } - - RxClient.ServerInfo serverInfo = new RxClient.ServerInfo(uri.getHost(), uri.getPort()); - - Observable> clientResponseObservable = this.httpClient.submit(serverInfo, httpRequest); - - return toDocumentServiceResponse(clientResponseObservable, request); - - } catch (Exception e) { - return Observable.error(e); - } - } - - private void fillHttpRequestBaseWithHeaders(Map headers, HttpClientRequest req) { - // Add default headers. - for (Entry entry : this.defaultHeaders.entrySet()) { - if (!headers.containsKey(entry.getKey())) { - // populate default header only if there is no overwrite by the request header - req.withHeader(entry.getKey(), entry.getValue()); - } - } - - // Add override headers. - if (headers != null) { - for (Entry entry : headers.entrySet()) { - if (entry.getValue() == null) { - // netty doesn't allow setting null value in header - req.withHeader(entry.getKey(), ""); - } else { - req.withHeader(entry.getKey(), entry.getValue()); - } - } - } - } - - private URI getUri(RxDocumentServiceRequest request) throws URISyntaxException { - URI rootUri = request.getEndpointOverride(); - if (rootUri == null) { - if (request.getIsMedia()) { - // For media read request, always use the write endpoint. - rootUri = this.globalEndpointManager.getWriteEndpoints().get(0).toURI(); - } else { - rootUri = this.globalEndpointManager.resolveServiceEndpoint(request).toURI(); - } - } - - String path = PathsHelper.generatePath(request.getResourceType(), request, request.isFeed); - if(request.getResourceType().equals(ResourceType.DatabaseAccount)) { - path = StringUtils.EMPTY; - } - - URI uri = new URI("https", - null, - rootUri.getHost(), - rootUri.getPort(), - ensureSlashPrefixed(path), - null, // Query string not used. - null); - - return uri; - } - - private String ensureSlashPrefixed(String path) { - if (path == null) { - return path; - } - - if (path.startsWith("/")) { - return path; - } - - return "/" + path; - } - - private Observable toInputStream(Observable contentObservable) { - // TODO: this is a naive approach for converting to InputStream - // this first reads and buffers everything in memory and then translate that to an input stream - // this means - // 1) there is some performance implication - // 2) this may result in OutOfMemoryException if used for reading huge content, e.g., a media - // - // see this: https://github.com/ReactiveX/RxNetty/issues/391 for some similar discussion on how to - // convert to an input stream - return contentObservable - .reduce( - new ByteArrayOutputStream(), - (out, bb) -> { - try { - bb.readBytes(out, bb.readableBytes()); - return out; - } - catch (IOException e) { - throw new RuntimeException(e); - } - }) - .map(out -> { - return new ByteArrayInputStream(out.toByteArray()); - }); - } - - private Observable toString(Observable contentObservable) { - return contentObservable - .reduce( - new ByteArrayOutputStream(INITIAL_RESPONSE_BUFFER_SIZE), - (out, bb) -> { - try { - bb.readBytes(out, bb.readableBytes()); - return out; - } - catch (IOException e) { - throw new RuntimeException(e); - } - }) - .map(out -> { - return new String(out.toByteArray(), StandardCharsets.UTF_8); - }); - } - - /** - * Transforms the rxNetty's client response Observable to RxDocumentServiceResponse Observable. - * - * - * Once the customer code subscribes to the observable returned by the CRUD APIs, - * the subscription goes up till it reaches the source rxNetty's observable, and at that point the HTTP invocation will be made. - * - * @param clientResponseObservable - * @param request - * @return {@link Observable} - */ - private Observable toDocumentServiceResponse(Observable> clientResponseObservable, - RxDocumentServiceRequest request) { - - if (request.getIsMedia()) { - return clientResponseObservable.flatMap(clientResponse -> { - - // header key/value pairs - HttpResponseHeaders httpResponseHeaders = clientResponse.getHeaders(); - HttpResponseStatus httpResponseStatus = clientResponse.getStatus(); - - Observable inputStreamObservable; - - if (request.getOperationType() == OperationType.Delete) { - // for delete we don't expect any body - inputStreamObservable = Observable.just(null); - } else { - // transforms the observable to Observable - inputStreamObservable = toInputStream(clientResponse.getContent()); - } - - Observable storeResponseObservable = inputStreamObservable - .flatMap(contentInputStream -> { - try { - // If there is any error in the header response this throws exception - // TODO: potential performance improvement: return Observable.error(exception) on failure instead of throwing Exception - validateOrThrow(request, httpResponseStatus, httpResponseHeaders, null, contentInputStream); - - // transforms to Observable - StoreResponse rsp = new StoreResponse(httpResponseStatus.code(), HttpUtils.unescape(httpResponseHeaders.entries()), contentInputStream); - return Observable.just(rsp); - } catch (Exception e) { - return Observable.error(e); - } - }); - - return storeResponseObservable; - - }).map(storeResponse -> new RxDocumentServiceResponse(storeResponse)); - - } else { - return clientResponseObservable.flatMap(clientResponse -> { - - // header key/value pairs - HttpResponseHeaders httpResponseHeaders = clientResponse.getHeaders(); - HttpResponseStatus httpResponseStatus = clientResponse.getStatus(); - - Observable contentObservable; - - if (request.getOperationType() == OperationType.Delete) { - // for delete we don't expect any body - contentObservable = Observable.just(null); - } else { - // transforms the observable to Observable - contentObservable = toString(clientResponse.getContent()); - } - - Observable storeResponseObservable = contentObservable - .flatMap(content -> { - try { - // If there is any error in the header response this throws exception - // TODO: potential performance improvement: return Observable.error(exception) on failure instead of throwing Exception - validateOrThrow(request, httpResponseStatus, httpResponseHeaders, content, null); - - // transforms to Observable - StoreResponse rsp = new StoreResponse(httpResponseStatus.code(), HttpUtils.unescape(httpResponseHeaders.entries()), content); - return Observable.just(rsp); - } catch (Exception e) { - return Observable.error(e); - } - }); - - return storeResponseObservable; - - }).map(storeResponse -> new RxDocumentServiceResponse(storeResponse)) - .onErrorResumeNext(throwable -> { - if (!(throwable instanceof Exception)) { - // fatal error - logger.error("Unexpected failure {}", throwable.getMessage(), throwable); - return Observable.error(throwable); - } - - Exception exception = (Exception) throwable; - if (!(exception instanceof DocumentClientException)) { - // wrap in DocumentClientException - logger.error("Network failure", exception); - DocumentClientException dce = new DocumentClientException(0, exception); - BridgeInternal.setRequestHeaders(dce, request.getHeaders()); - return Observable.error(dce); - } - - return Observable.error(exception); - }); - } - } - - private void validateOrThrow(RxDocumentServiceRequest request, HttpResponseStatus status, HttpResponseHeaders headers, String body, - InputStream inputStream) throws DocumentClientException { - - int statusCode = status.code(); - - if (statusCode >= HttpConstants.StatusCodes.MINIMUM_STATUSCODE_AS_ERROR_GATEWAY) { - if (body == null && inputStream != null) { - try { - body = IOUtils.toString(inputStream, StandardCharsets.UTF_8); - } catch (IOException e) { - logger.error("Failed to get content from the http response", e); - DocumentClientException dce = new DocumentClientException(0, e); - BridgeInternal.setRequestHeaders(dce, request.getHeaders()); - throw dce; - } finally { - IOUtils.closeQuietly(inputStream); - } - } - - String statusCodeString = status.reasonPhrase() != null - ? status.reasonPhrase().replace(" ", "") - : ""; - Error error = null; - error = (body != null) ? new Error(body) : new Error(); - error = new Error(statusCodeString, - String.format("%s, StatusCode: %s", error.getMessage(), statusCodeString), - error.getPartitionedQueryExecutionInfo()); - - DocumentClientException dce = new DocumentClientException(statusCode, error, HttpUtils.asMap(headers)); - BridgeInternal.setRequestHeaders(dce, request.getHeaders()); - throw dce; - } - } - - private Observable invokeAsyncInternal(RxDocumentServiceRequest request) { - switch (request.getOperationType()) { - case Create: - return this.doCreate(request); - case Upsert: - return this.upsert(request); - case Delete: - return this.delete(request); - case ExecuteJavaScript: - return this.execute(request); - case Read: - return this.read(request); - case ReadFeed: - return this.readFeed(request); - case Replace: - return this.replace(request); - case SqlQuery: - case Query: - return this.query(request); - default: - throw new IllegalStateException("Unknown operation type " + request.getOperationType()); - } - } - - private Observable invokeAsync(RxDocumentServiceRequest request) { - Func0> funcDelegate = () -> invokeAsyncInternal(request).toSingle(); - return BackoffRetryUtility.executeRetry(funcDelegate, new WebExceptionRetryPolicy()).toObservable(); - } - - @Override - public Observable processMessage(RxDocumentServiceRequest request) { - this.applySessionToken(request); - - Observable responseObs = invokeAsync(request); - - return responseObs.onErrorResumeNext( - e -> { - DocumentClientException dce = Utils.as(e, DocumentClientException.class); - - if (dce == null) { - logger.error("unexpected failure {}", e.getMessage(), e); - return Observable.error(e); - } - - if ((!ReplicatedResourceClientUtils.isMasterResource(request.getResourceType())) && - (dce.getStatusCode() == HttpConstants.StatusCodes.PRECONDITION_FAILED || - dce.getStatusCode() == HttpConstants.StatusCodes.CONFLICT || - ( - dce.getStatusCode() == HttpConstants.StatusCodes.NOTFOUND && - !Exceptions.isSubStatusCode(dce, - HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE)))) { - this.captureSessionToken(request, dce.getResponseHeaders()); - } - - return Observable.error(dce); - } - ).map(response -> - { - this.captureSessionToken(request, response.getResponseHeaders()); - return response; - } - ); - } - - private void captureSessionToken(RxDocumentServiceRequest request, Map responseHeaders) { - if (request.getResourceType() == ResourceType.DocumentCollection && request.getOperationType() == OperationType.Delete) { - String resourceId; - if (request.getIsNameBased()) { - resourceId = responseHeaders.get(HttpConstants.HttpHeaders.OWNER_ID); - } else { - resourceId = request.getResourceId(); - } - this.sessionContainer.clearTokenByResourceId(resourceId); - } else { - this.sessionContainer.setSessionToken(request, responseHeaders); - } - } - - private void applySessionToken(RxDocumentServiceRequest request) { - Map headers = request.getHeaders(); - - if (headers != null && - !Strings.isNullOrEmpty(request.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN))) { - if (ReplicatedResourceClientUtils.isMasterResource(request.getResourceType())) { - request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN); - } - return; //User is explicitly controlling the session. - } - - String requestConsistencyLevel = headers.get(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL); - - boolean sessionConsistency = - this.defaultConsistencyLevel == ConsistencyLevel.Session || - (!Strings.isNullOrEmpty(requestConsistencyLevel) - && Strings.areEqual(requestConsistencyLevel, ConsistencyLevel.Session.name())); - - if (!sessionConsistency || ReplicatedResourceClientUtils.isMasterResource(request.getResourceType())) { - return; // Only apply the session token in case of session consistency and when resource is not a master resource - } - - //Apply the ambient session. - String sessionToken = this.sessionContainer.resolveGlobalSessionToken(request); - - if (!Strings.isNullOrEmpty(sessionToken)) { - headers.put(HttpConstants.HttpHeaders.SESSION_TOKEN, sessionToken); - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxStoreModel.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxStoreModel.java deleted file mode 100644 index ca5184c221ed..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxStoreModel.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import rx.Observable; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public interface RxStoreModel { - - /** - * Given the request, it returns an Observable of the response. - * - * The Observable upon subscription will execute the request and upon successful execution request returns a single {@link RxDocumentServiceResponse}. - * If the execution of the request fails it returns an error. - * - * @param request - * @return - */ - Observable processMessage(RxDocumentServiceRequest request); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/WebExceptionRetryPolicy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/WebExceptionRetryPolicy.java deleted file mode 100644 index 48f61b07ef9e..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/WebExceptionRetryPolicy.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.WebExceptionUtility; -import org.apache.commons.lang3.time.StopWatch; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Single; - -import java.time.Duration; -import java.util.concurrent.TimeUnit; - -public class WebExceptionRetryPolicy implements IRetryPolicy { - private final static Logger logger = LoggerFactory.getLogger(WebExceptionRetryPolicy.class); - - // total wait time in seconds to retry. should be max of primary reconfigrations/replication wait duration etc - private final static int waitTimeInSeconds = 30; - private final static int initialBackoffSeconds = 1; - private final static int backoffMultiplier = 2; - - private StopWatch durationTimer = new StopWatch(); - private int attemptCount = 1; - // Don't penalise first retry with delay. - private int currentBackoffSeconds = WebExceptionRetryPolicy.initialBackoffSeconds; - - public WebExceptionRetryPolicy() { - durationTimer.start(); - } - - - @Override - public Single shouldRetry(Exception exception) { - Duration backoffTime = Duration.ofSeconds(0); - - if (!WebExceptionUtility.isWebExceptionRetriable(exception)) { - // Have caller propagate original exception. - this.durationTimer.stop(); - return Single.just(ShouldRetryResult.noRetry()); - } - - // Don't penalise first retry with delay. - if (attemptCount++ > 1) { - int remainingSeconds = WebExceptionRetryPolicy.waitTimeInSeconds - Math.toIntExact(this.durationTimer.getTime(TimeUnit.SECONDS)); - if (remainingSeconds <= 0) { - this.durationTimer.stop(); - return Single.just(ShouldRetryResult.noRetry()); - } - - backoffTime = Duration.ofSeconds(Math.min(this.currentBackoffSeconds, remainingSeconds)); - this.currentBackoffSeconds *= WebExceptionRetryPolicy.backoffMultiplier; - } - - logger.warn("Received retriable web exception, will retry", exception); - - return Single.just(ShouldRetryResult.retryAfter(backoffTime)); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/AsyncCache.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/AsyncCache.java deleted file mode 100644 index 58ad25c7bd9d..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/AsyncCache.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.caches; - -import java.util.concurrent.ConcurrentHashMap; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import rx.Observable; -import rx.Single; -import rx.functions.Func0; - -public class AsyncCache { - - private final Logger logger = LoggerFactory.getLogger(AsyncCache.class); - private final ConcurrentHashMap> values = new ConcurrentHashMap<>(); - - private final IEqualityComparer equalityComparer; - - public AsyncCache(IEqualityComparer equalityComparer) { - this.equalityComparer = equalityComparer; - } - - public AsyncCache() { - this(new IEqualityComparer() { - @Override - public boolean areEqual(TValue value1, TValue value2) { - if (value1 == value2) - return true; - if (value1 == null || value2 == null) - return false; - return value1.equals(value2); - } - }); - } - - public void set(TKey key, TValue value) { - logger.debug("set cache[{}]={}", key, value); - values.put(key, new AsyncLazy<>(value)); - } - - /** - * Gets value corresponding to key - * - *

- * If another initialization function is already running, new initialization function will not be started. - * The result will be result of currently running initialization function. - *

- * - *

- * If previous initialization function is successfully completed - value returned by it will be returned unless - * it is equal to obsoleteValue, in which case new initialization function will be started. - *

- *

- * If previous initialization function failed - new one will be launched. - *

- * - * @param key Key for which to get a value. - * @param obsoleteValue Value which is obsolete and needs to be refreshed. - * @param singleValueInitFunc Initialization function. - * @return Cached value or value returned by initialization function. - */ - public Single getAsync( - TKey key, - TValue obsoleteValue, - Func0> singleValueInitFunc) { - - AsyncLazy initialLazyValue = values.get(key); - if (initialLazyValue != null) { - - logger.debug("cache[{}] exists", key); - return initialLazyValue.single().toObservable().flatMap(vaule -> { - - if (!equalityComparer.areEqual(vaule, obsoleteValue)) { - logger.debug("Returning cache[{}] as it is different from obsoleteValue", key); - return Observable.just(vaule); - } - - logger.debug("cache[{}] result value is obsolete ({}), computing new value", key, obsoleteValue); - AsyncLazy asyncLazy = new AsyncLazy<>(singleValueInitFunc); - AsyncLazy actualValue = values.merge(key, asyncLazy, - (lazyValue1, lazyValu2) -> lazyValue1 == initialLazyValue ? lazyValu2 : lazyValue1); - return actualValue.single().toObservable(); - - }, err -> { - - logger.debug("cache[{}] resulted in error {}, computing new value", key, err); - AsyncLazy asyncLazy = new AsyncLazy<>(singleValueInitFunc); - AsyncLazy resultAsyncLazy = values.merge(key, asyncLazy, - (lazyValue1, lazyValu2) -> lazyValue1 == initialLazyValue ? lazyValu2 : lazyValue1); - return resultAsyncLazy.single().toObservable(); - - }, () -> Observable.empty()).toSingle(); - } - - logger.debug("cache[{}] doesn't exist, computing new value", key); - AsyncLazy asyncLazy = new AsyncLazy<>(singleValueInitFunc); - AsyncLazy resultAsyncLazy = values.merge(key, asyncLazy, - (lazyValue1, lazyValu2) -> lazyValue1 == initialLazyValue ? lazyValu2 : lazyValue1); - return resultAsyncLazy.single(); - } - - public void remove(TKey key) { - values.remove(key); - } - - /** - * Remove value from cache and return it if present - * @param key - * @return Value if present, default value if not present - */ - public Single removeAsync(TKey key) { - AsyncLazy lazy = values.remove(key); - return lazy.single(); - // TODO: .Net returns default value on failure of single why? - } - - public void clear() { - this.values.clear(); - } - - /** - * Forces refresh of the cached item if it is not being refreshed at the moment. - * @param key - * @param singleValueInitFunc - */ - public void refresh( - TKey key, - Func0> singleValueInitFunc) { - logger.debug("refreshing cache[{}]", key); - AsyncLazy initialLazyValue = values.get(key); - if (initialLazyValue != null && (initialLazyValue.isSucceeded() || initialLazyValue.isFaulted())) { - AsyncLazy newLazyValue = new AsyncLazy<>(singleValueInitFunc); - - // Update the new task in the cache, - values.merge(key, newLazyValue, - (lazyValue1, lazyValu2) -> lazyValue1 == initialLazyValue ? lazyValu2 : lazyValue1); - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/AsyncLazy.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/AsyncLazy.java deleted file mode 100644 index 79a2c377b7a1..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/AsyncLazy.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.caches; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import rx.Single; -import rx.functions.Func0; - -class AsyncLazy { - - private final static Logger logger = LoggerFactory.getLogger(AsyncLazy.class); - - private final Single single; - - private volatile boolean succeeded; - private volatile boolean failed; - - public AsyncLazy(Func0> func) { - this(Single.defer(() -> { - logger.debug("using Func0> {}", func); - return func.call(); - })); - } - - public AsyncLazy(TValue value) { - this.single = Single.just(value); - this.succeeded = true; - this.failed = false; - } - - private AsyncLazy(Single single) { - logger.debug("constructor"); - this.single = single - .doOnSuccess(v -> this.succeeded = true) - .doOnError(e -> this.failed = true) - .cache(); - } - - public Single single() { - return single; - } - - public boolean isSucceeded() { - return succeeded; - } - - public boolean isFaulted() { - return failed; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/IEqualityComparer.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/IEqualityComparer.java deleted file mode 100644 index a9cd210edb5f..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/IEqualityComparer.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.caches; - -interface IEqualityComparer { - boolean areEqual(TValue v1, TValue v2); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/IPartitionKeyRangeCache.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/IPartitionKeyRangeCache.java deleted file mode 100644 index 1d92cf412dba..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/IPartitionKeyRangeCache.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * The MIT License (MIT) - * Copyright (c) 2017 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.caches; - -import java.util.List; -import java.util.Map; - -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.routing.CollectionRoutingMap; -import com.microsoft.azure.cosmosdb.internal.routing.Range; -import com.microsoft.azure.cosmosdb.rx.internal.ICollectionRoutingMapCache; -import com.microsoft.azure.cosmosdb.rx.internal.IRoutingMapProvider; - -import rx.Single; - -/** - * - */ -public interface IPartitionKeyRangeCache extends IRoutingMapProvider, ICollectionRoutingMapCache { - - Single tryLookupAsync(String collectionRid, CollectionRoutingMap previousValue, Map properties); - - Single> tryGetOverlappingRangesAsync(String collectionRid, Range range, boolean forceRefresh, - Map properties); - - Single tryGetPartitionKeyRangeByIdAsync(String collectionResourceId, String partitionKeyRangeId, boolean forceRefresh, - Map properties); - - Single tryGetRangeByPartitionKeyRangeId(String collectionRid, String partitionKeyRangeId, Map properties); - -} \ No newline at end of file diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/RxClientCollectionCache.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/RxClientCollectionCache.java deleted file mode 100644 index 64fecf3166ef..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/RxClientCollectionCache.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.caches; - -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.util.HashMap; -import java.util.Map; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.PathsHelper; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.rx.internal.AuthorizationTokenType; -import com.microsoft.azure.cosmosdb.rx.internal.ClearingSessionContainerClientRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.IDocumentClientRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.IRetryPolicyFactory; -import com.microsoft.azure.cosmosdb.rx.internal.ObservableHelper; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; -import com.microsoft.azure.cosmosdb.rx.internal.RxStoreModel; - -import rx.Observable; -import rx.Single; - -/** - * Caches collection information. - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class RxClientCollectionCache extends RxCollectionCache { - - private RxStoreModel storeModel; - private final IAuthorizationTokenProvider tokenProvider; - private final IRetryPolicyFactory retryPolicy; - private final ISessionContainer sessionContainer; - - public RxClientCollectionCache(ISessionContainer sessionContainer, - RxStoreModel storeModel, - IAuthorizationTokenProvider tokenProvider, - IRetryPolicyFactory retryPolicy) { - this.storeModel = storeModel; - this.tokenProvider = tokenProvider; - this.retryPolicy = retryPolicy; - this.sessionContainer = sessionContainer; - } - - protected Single getByRidAsync(String collectionRid, Map properties) { - IDocumentClientRetryPolicy retryPolicyInstance = new ClearingSessionContainerClientRetryPolicy(this.sessionContainer, this.retryPolicy.getRequestPolicy()); - return ObservableHelper.inlineIfPossible( - () -> this.readCollectionAsync(PathsHelper.generatePath(ResourceType.DocumentCollection, collectionRid, false), retryPolicyInstance, properties) - , retryPolicyInstance); - } - - protected Single getByNameAsync(String resourceAddress, Map properties) { - IDocumentClientRetryPolicy retryPolicyInstance = new ClearingSessionContainerClientRetryPolicy(this.sessionContainer, this.retryPolicy.getRequestPolicy()); - return ObservableHelper.inlineIfPossible( - () -> this.readCollectionAsync(resourceAddress, retryPolicyInstance, properties), - retryPolicyInstance); - } - - private Single readCollectionAsync(String collectionLink, IDocumentClientRetryPolicy retryPolicyInstance, Map properties) { - - String path = Utils.joinPath(collectionLink, null); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create( - OperationType.Read, - ResourceType.DocumentCollection, - path, - new HashMap()); - - request.getHeaders().put(HttpConstants.HttpHeaders.X_DATE, Utils.nowAsRFC1123()); - - String resourceName = request.getResourceAddress(); - String authorizationToken = tokenProvider.getUserAuthorizationToken( - resourceName, - request.getResourceType(), - HttpConstants.HttpMethods.GET, - request.getHeaders(), - AuthorizationTokenType.PrimaryMasterKey, - properties); - - try { - authorizationToken = URLEncoder.encode(authorizationToken, "UTF-8"); - } catch (UnsupportedEncodingException e) { - return Single.error(new IllegalStateException("Failed to encode authtoken.", e)); - } - request.getHeaders().put(HttpConstants.HttpHeaders.AUTHORIZATION, authorizationToken); - - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - Observable responseObs = this.storeModel.processMessage(request); - return responseObs.map(response -> BridgeInternal.toResourceResponse(response, DocumentCollection.class) - .getResource()).toSingle(); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/RxCollectionCache.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/RxCollectionCache.java deleted file mode 100644 index e634593434ae..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/RxCollectionCache.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.caches; - -import org.apache.commons.lang3.StringUtils; - -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.internal.PathsHelper; -import com.microsoft.azure.cosmosdb.internal.ResourceId; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import com.microsoft.azure.cosmosdb.rx.internal.InvalidPartitionException; -import com.microsoft.azure.cosmosdb.rx.internal.NotFoundException; -import com.microsoft.azure.cosmosdb.rx.internal.RMResources; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; - -import rx.Completable; -import rx.Single; - -import java.util.Map; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public abstract class RxCollectionCache { - - private final AsyncCache collectionInfoByNameCache; - private final AsyncCache collectionInfoByIdCache; - - protected RxCollectionCache() { - this.collectionInfoByNameCache = new AsyncCache(new CollectionRidComparer()); - this.collectionInfoByIdCache = new AsyncCache(new CollectionRidComparer()); - } - - /** - * Resolves a request to a collection in a sticky manner. - * Unless request.ForceNameCacheRefresh is equal to true, it will return the same collection. - * @param request Request to resolve. - * @return an instance of Single<DocumentCollection> - */ - public Single resolveCollectionAsync( - RxDocumentServiceRequest request) { - Completable init = null; - if (request.getIsNameBased()) { - if (request.isForceNameCacheRefresh()) { - Completable completable = this.refreshAsync(request); - init = completable.andThen(Completable.fromAction(() -> request.setForceNameCacheRefresh(false))); - } - - Single collectionInfoObs = this.resolveByPartitionKeyRangeIdentityAsync( - request.getPartitionKeyRangeIdentity(), request.properties); - - if (init != null) { - collectionInfoObs = init.andThen(collectionInfoObs); - } - - return collectionInfoObs.flatMap(collectionInfo -> { - if (collectionInfo != null) { - return Single.just(collectionInfo); - } - - if (request.requestContext.resolvedCollectionRid == null) { - - Single collectionInfoRes = this.resolveByNameAsync(request.getResourceAddress(), request.properties); - - return collectionInfoRes.flatMap(collection -> { - // TODO: how to async log this? - // logger.debug( - // "Mapped resourceName {} to resourceId {}.", - // request.getResourceAddress(), - // collectionInfo.getResourceId()); - - request.setResourceId(collection.getResourceId()); - request.requestContext.resolvedCollectionRid = collection.getResourceId(); - return Single.just(collection); - - }); - } else { - return this.resolveByRidAsync(request.requestContext.resolvedCollectionRid, request.properties); - } - }); - } else { - return resolveByPartitionKeyRangeIdentityAsync(request.getPartitionKeyRangeIdentity(),request.properties) - .flatMap(collection -> { - - if (collection != null) { - return Single.just(collection); - } - - return this.resolveByRidAsync(request.getResourceAddress(), request.properties); - }); - } - } - - /** - * This method is only used in retry policy as it doesn't have request handy. - * @param resourceAddress - */ - public void refresh(String resourceAddress, Map properties) { - if (PathsHelper.isNameBased(resourceAddress)) { - String resourceFullName = PathsHelper.getCollectionPath(resourceAddress); - - this.collectionInfoByNameCache.refresh( - resourceFullName, - () -> { - Single collectionObs = this.getByNameAsync(resourceFullName, properties); - return collectionObs.doOnSuccess(collection -> { - this.collectionInfoByIdCache.set(collection.getResourceId(), collection); - }); - }); - } - } - - protected abstract Single getByRidAsync(String collectionRid, Map properties); - - protected abstract Single getByNameAsync(String resourceAddress, Map properties); - - private Single resolveByPartitionKeyRangeIdentityAsync(PartitionKeyRangeIdentity partitionKeyRangeIdentity, Map properties) { - // if request is targeted at specific partition using x-ms-documentd-partitionkeyrangeid header, - // which contains value ",", then resolve to collection rid in this header. - if (partitionKeyRangeIdentity != null && partitionKeyRangeIdentity.getCollectionRid() != null) { - return this.resolveByRidAsync(partitionKeyRangeIdentity.getCollectionRid(), properties) - .onErrorResumeNext(e -> { - if (e instanceof NotFoundException) { - // This is signal to the upper logic either to refresh - // collection cache and retry. - return Single.error(new InvalidPartitionException(RMResources.InvalidDocumentCollection)); - } - return Single.error(e); - - }); - } - return Single.just(null); - } - - private Single resolveByRidAsync( - String resourceId, Map properties) { - - ResourceId resourceIdParsed = ResourceId.parse(resourceId); - String collectionResourceId = resourceIdParsed.getDocumentCollectionId().toString(); - - return this.collectionInfoByIdCache.getAsync( - collectionResourceId, - null, - () -> this.getByRidAsync(collectionResourceId, properties)); - } - - private Single resolveByNameAsync( - String resourceAddress, Map properties) { - - String resourceFullName = PathsHelper.getCollectionPath(resourceAddress); - - return this.collectionInfoByNameCache.getAsync( - resourceFullName, - null, - () -> { - Single collectionObs = this.getByNameAsync(resourceFullName, properties); - return collectionObs.doOnSuccess(collection -> { - this.collectionInfoByIdCache.set(collection.getResourceId(), collection); - }); - }); - } - - private Completable refreshAsync(RxDocumentServiceRequest request) { - // TODO System.Diagnostics.Debug.Assert(request.IsNameBased); - - String resourceFullName = PathsHelper.getCollectionPath(request.getResourceAddress()); - Completable completable = null; - - if (request.requestContext.resolvedCollectionRid != null) { - // Here we will issue backend call only if cache wasn't already refreshed (if whatever is there corresponds to previously resolved collection rid). - DocumentCollection obsoleteValue = new DocumentCollection(); - obsoleteValue.setResourceId(request.requestContext.resolvedCollectionRid); - - completable = this.collectionInfoByNameCache.getAsync( - resourceFullName, - obsoleteValue, - () -> { - Single collectionObs = this.getByNameAsync(resourceFullName, request.properties); - return collectionObs.doOnSuccess(collection -> { - this.collectionInfoByIdCache.set(collection.getResourceId(), collection); - }); - }).toCompletable(); - } else { - // In case of ForceRefresh directive coming from client, there will be no ResolvedCollectionRid, so we - // need to refresh unconditionally. - completable = Completable.fromAction(() -> this.refresh(request.getResourceAddress(), request.properties)); - } - - return completable.doOnCompleted(() -> request.requestContext.resolvedCollectionRid = null); - } - - private class CollectionRidComparer implements IEqualityComparer { - public boolean areEqual(DocumentCollection left, DocumentCollection right) { - if (left == null && right == null) { - return true; - } - - if ((left == null) ^ (right == null)) { - return false; - } - - return StringUtils.equals(left.getResourceId(), right.getResourceId()); - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/AggregateDocumentQueryExecutionContext.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/AggregateDocumentQueryExecutionContext.java deleted file mode 100644 index 8305732d9ff8..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/AggregateDocumentQueryExecutionContext.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import java.util.function.Function; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.Undefined; -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.query.QueryItem; -import com.microsoft.azure.cosmosdb.internal.query.aggregation.AggregateOperator; -import com.microsoft.azure.cosmosdb.internal.query.aggregation.Aggregator; -import com.microsoft.azure.cosmosdb.internal.query.aggregation.AverageAggregator; -import com.microsoft.azure.cosmosdb.internal.query.aggregation.CountAggregator; -import com.microsoft.azure.cosmosdb.internal.query.aggregation.MaxAggregator; -import com.microsoft.azure.cosmosdb.internal.query.aggregation.MinAggregator; -import com.microsoft.azure.cosmosdb.internal.query.aggregation.SumAggregator; -import com.microsoft.azure.cosmosdb.QueryMetrics; - -import rx.Observable; - -public class AggregateDocumentQueryExecutionContext implements IDocumentQueryExecutionComponent{ - - private IDocumentQueryExecutionComponent component; - private Aggregator aggregator; - private ConcurrentMap queryMetricsMap = new ConcurrentHashMap<>(); - - //QueryInfo class used in PipelinedDocumentQueryExecutionContext returns a Collection of AggregateOperators - //while Multiple aggregates are allowed in queries targeted at a single partition, only a single aggregate is allowed in x-partition queries (currently) - public AggregateDocumentQueryExecutionContext (IDocumentQueryExecutionComponent component, Collection aggregateOperators) { - - this.component = component; - AggregateOperator aggregateOperator = aggregateOperators.iterator().next(); - - switch (aggregateOperator) { - case Average: - this.aggregator = new AverageAggregator(); - break; - case Count: - this.aggregator = new CountAggregator(); - break; - case Max: - this.aggregator = new MaxAggregator(); - break; - case Min: - this.aggregator = new MinAggregator(); - break; - case Sum: - this.aggregator = new SumAggregator(); - break; - default: - throw new IllegalStateException("Unexpected value: " + aggregateOperator.toString()); - } - } - - @SuppressWarnings("unchecked") - @Override - public Observable> drainAsync(int maxPageSize) { - - return this.component.drainAsync(maxPageSize) - .toList() - .map( superList -> { - - double requestCharge = 0; - List aggregateResults = new ArrayList(); - HashMap headers = new HashMap(); - - for(FeedResponse page : superList) { - - if (page.getResults().size() == 0) { - headers.put(HttpConstants.HttpHeaders.REQUEST_CHARGE, Double.toString(requestCharge)); - FeedResponse frp = BridgeInternal.createFeedResponse(aggregateResults, headers); - return (FeedResponse) frp; - } - - Document doc = ((Document)page.getResults().get(0)); - requestCharge += page.getRequestCharge(); - QueryItem values = new QueryItem(doc.toJson()); - this.aggregator.aggregate(values.getItem()); - for(String key : page.getQueryMetrics().keySet()) { - if (queryMetricsMap.containsKey(key)) { - QueryMetrics qm = page.getQueryMetrics().get(key); - queryMetricsMap.get(key).add(qm); - } else { - queryMetricsMap.put(key, page.getQueryMetrics().get(key)); - } - } - } - - if (this.aggregator.getResult() == null || !this.aggregator.getResult().equals(Undefined.Value())) { - Document aggregateDocument = new Document(); - aggregateDocument.set(Constants.Properties.AGGREGATE, this.aggregator.getResult()); - aggregateResults.add(aggregateDocument); - } - - headers.put(HttpConstants.HttpHeaders.REQUEST_CHARGE, Double.toString(requestCharge)); - FeedResponse frp = BridgeInternal.createFeedResponse(aggregateResults, headers); - if(!queryMetricsMap.isEmpty()) { - for(String key: queryMetricsMap.keySet()) { - BridgeInternal.putQueryMetricsIntoMap(frp, key, queryMetricsMap.get(key)); - } - } - return (FeedResponse) frp; - }); - } - - public static Observable> createAsync( - Function>> createSourceComponentFunction, - Collection aggregates, - String continuationToken) { - - return createSourceComponentFunction - .apply(continuationToken) - .map( component -> { return new AggregateDocumentQueryExecutionContext(component, aggregates);}); - } - - public IDocumentQueryExecutionComponent getComponent() { - return this.component; - } - -} \ No newline at end of file diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/CompositeContinuationToken.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/CompositeContinuationToken.java deleted file mode 100644 index 050c24b23ab6..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/CompositeContinuationToken.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import com.microsoft.azure.cosmosdb.JsonSerializable; -import com.microsoft.azure.cosmosdb.internal.routing.Range; -import com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public final class CompositeContinuationToken extends JsonSerializable { - private static final String TokenPropertyName = "token"; - private static final String RangePropertyName = "range"; - private static final Logger logger = LoggerFactory.getLogger(CompositeContinuationToken.class); - - public CompositeContinuationToken(String token, Range range) { - // token is allowed to be null - if (range == null) { - throw new IllegalArgumentException("range must not be null."); - } - - this.setToken(token); - this.setRange(range); - } - - private CompositeContinuationToken(String serializedCompositeContinuationToken) { - super(serializedCompositeContinuationToken); - } - - public static boolean tryParse(String serializedCompositeContinuationToken, - ValueHolder outCompositeContinuationToken) { - boolean parsed; - try { - CompositeContinuationToken compositeContinuationToken = new CompositeContinuationToken( - serializedCompositeContinuationToken); - compositeContinuationToken.getToken(); - - Range range = compositeContinuationToken.getRange(); - if (range == null) { - throw new IllegalArgumentException("range must not be null."); - } - - range.getMax(); - range.getMin(); - range.isEmpty(); - range.isMaxInclusive(); - range.isMinInclusive(); - range.isSingleValue(); - - outCompositeContinuationToken.v = compositeContinuationToken; - parsed = true; - } catch (Exception ex) { - logger.debug( - "Received exception {} when trying to parse: {}", - ex.getMessage(), - serializedCompositeContinuationToken); - parsed = false; - outCompositeContinuationToken.v = null; - } - - return parsed; - } - - /** - * @return the token - */ - public String getToken() { - return super.getString(TokenPropertyName); - } - - /** - * @return the range - */ - public Range getRange() { - return new Range(super.getString(RangePropertyName)); - } - - /** - * @param token - * the token to set - */ - private void setToken(String token) { - super.set(TokenPropertyName, token); - } - - /** - * @param range - * the range to set - */ - private void setRange(Range range) { - /* TODO: Don't stringify the range */ - super.set(RangePropertyName, range.toString()); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DefaultDocumentQueryExecutionContext.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DefaultDocumentQueryExecutionContext.java deleted file mode 100644 index b29ab978a577..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DefaultDocumentQueryExecutionContext.java +++ /dev/null @@ -1,268 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.PathsHelper; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternal; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import com.microsoft.azure.cosmosdb.internal.routing.Range; -import com.microsoft.azure.cosmosdb.rx.internal.BackoffRetryUtility; -import com.microsoft.azure.cosmosdb.rx.internal.IDocumentClientRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.InvalidPartitionExceptionRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.PartitionKeyRangeGoneRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxCollectionCache; -import com.microsoft.azure.cosmosdb.rx.internal.caches.IPartitionKeyRangeCache; -import com.microsoft.azure.cosmosdb.internal.query.metrics.ClientSideMetrics; -import com.microsoft.azure.cosmosdb.internal.query.metrics.FetchExecutionRangeAccumulator; -import com.microsoft.azure.cosmosdb.QueryMetrics; -import com.microsoft.azure.cosmosdb.internal.query.metrics.SchedulingStopwatch; -import com.microsoft.azure.cosmosdb.internal.query.metrics.SchedulingTimeSpan; - -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; -import rx.Observable; -import rx.Single; -import rx.functions.Func1; -import rx.functions.Func2; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class DefaultDocumentQueryExecutionContext extends DocumentQueryExecutionContextBase { - - private boolean isContinuationExpected; - private volatile int retries = -1; - - private final SchedulingStopwatch fetchSchedulingMetrics; - private final FetchExecutionRangeAccumulator fetchExecutionRangeAccumulator; - private static final String DEFAULT_PARTITION_KEY_RANGE_ID = "0"; - - public DefaultDocumentQueryExecutionContext(IDocumentQueryClient client, ResourceType resourceTypeEnum, - Class resourceType, SqlQuerySpec query, FeedOptions feedOptions, String resourceLink, - UUID correlatedActivityId, boolean isContinuationExpected) { - - super(client, - resourceTypeEnum, - resourceType, - query, - feedOptions, - resourceLink, - false, - correlatedActivityId); - - this.isContinuationExpected = isContinuationExpected; - this.fetchSchedulingMetrics = new SchedulingStopwatch(); - this.fetchSchedulingMetrics.ready(); - this.fetchExecutionRangeAccumulator = new FetchExecutionRangeAccumulator(DEFAULT_PARTITION_KEY_RANGE_ID); - } - - protected PartitionKeyInternal getPartitionKeyInternal() { - return this.feedOptions.getPartitionKey() == null ? null : feedOptions.getPartitionKey().getInternalPartitionKey(); - } - - @Override - public Observable> executeAsync() { - - if (feedOptions == null) { - feedOptions = new FeedOptions(); - } - - FeedOptions newFeedOptions = new FeedOptions(feedOptions); - - // We can not go to backend with the composite continuation token, - // but we still need the gateway for the query plan. - // The workaround is to try and parse the continuation token as a composite continuation token. - // If it is, then we send the query to the gateway with max degree of parallelism to force getting back the query plan - - String originalContinuation = newFeedOptions.getRequestContinuation(); - - if (isClientSideContinuationToken(originalContinuation)) { - // At this point we know we want back a query plan - newFeedOptions.setRequestContinuation(null); - newFeedOptions.setMaxDegreeOfParallelism(Integer.MAX_VALUE); - } - - int maxPageSize = newFeedOptions.getMaxItemCount() != null ? newFeedOptions.getMaxItemCount() : Constants.Properties.DEFAULT_MAX_PAGE_SIZE; - - Func2 createRequestFunc = (continuationToken, pageSize) -> this.createRequestAsync(continuationToken, pageSize); - - // TODO: clean up if we want to use single vs observable. - Func1>> executeFunc = executeInternalAsyncFunc(); - - return Paginator - .getPaginatedQueryResultAsObservable(newFeedOptions, createRequestFunc, executeFunc, resourceType, maxPageSize); - } - - public Single> getTargetPartitionKeyRanges(String resourceId, List> queryRanges) { - // TODO: FIXME this needs to be revisited - - Range r = new Range<>("", "FF", true, false); - return client.getPartitionKeyRangeCache().tryGetOverlappingRangesAsync(resourceId, r, false, null); - } - - protected Func1>> executeInternalAsyncFunc() { - RxCollectionCache collectionCache = this.client.getCollectionCache(); - IPartitionKeyRangeCache partitionKeyRangeCache = this.client.getPartitionKeyRangeCache(); - IDocumentClientRetryPolicy retryPolicyInstance = this.client.getResetSessionTokenRetryPolicy().getRequestPolicy(); - - retryPolicyInstance = new InvalidPartitionExceptionRetryPolicy(collectionCache, retryPolicyInstance, resourceLink, feedOptions); - if (super.resourceTypeEnum.isPartitioned()) { - retryPolicyInstance = new PartitionKeyRangeGoneRetryPolicy( - collectionCache, - partitionKeyRangeCache, - PathsHelper.getCollectionPath(super.resourceLink), - retryPolicyInstance, - feedOptions); - } - - final IDocumentClientRetryPolicy finalRetryPolicyInstance = retryPolicyInstance; - - Func1>> executeFunc = req -> { - finalRetryPolicyInstance.onBeforeSendRequest(req); - this.fetchExecutionRangeAccumulator.beginFetchRange(); - this.fetchSchedulingMetrics.start(); - return BackoffRetryUtility.executeRetry(() -> { - ++this.retries; - return executeRequestAsync(req); - }, finalRetryPolicyInstance).toObservable() - .map(tFeedResponse -> { - this.fetchSchedulingMetrics.stop(); - this.fetchExecutionRangeAccumulator.endFetchRange(tFeedResponse.getActivityId(), - tFeedResponse.getResults().size(), - this.retries); - ImmutablePair schedulingTimeSpanMap = - new ImmutablePair<>(DEFAULT_PARTITION_KEY_RANGE_ID, this.fetchSchedulingMetrics.getElapsedTime()); - if (!StringUtils.isEmpty(tFeedResponse.getResponseHeaders().get(HttpConstants.HttpHeaders.QUERY_METRICS))) { - QueryMetrics qm = - BridgeInternal.createQueryMetricsFromDelimitedStringAndClientSideMetrics(tFeedResponse.getResponseHeaders() - .get(HttpConstants.HttpHeaders.QUERY_METRICS), - new ClientSideMetrics(this.retries, - tFeedResponse.getRequestCharge(), - this.fetchExecutionRangeAccumulator.getExecutionRanges(), - Arrays.asList(schedulingTimeSpanMap)), - tFeedResponse.getActivityId()); - BridgeInternal.putQueryMetricsIntoMap(tFeedResponse, DEFAULT_PARTITION_KEY_RANGE_ID, qm); - } - return tFeedResponse; - }); - }; - - return executeFunc; - } - - private Single> executeOnceAsync(IDocumentClientRetryPolicy retryPolicyInstance, String continuationToken) { - // Don't reuse request, as the rest of client SDK doesn't reuse requests between retries. - // The code leaves some temporary garbage in request (in RequestContext etc.), - // which shold be erased during retries. - - RxDocumentServiceRequest request = this.createRequestAsync(continuationToken, this.feedOptions.getMaxItemCount()); - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - if (!Strings.isNullOrEmpty(request.getHeaders().get(HttpConstants.HttpHeaders.PARTITION_KEY)) - || !request.getResourceType().isPartitioned()) { - return this.executeRequestAsync(request); - } - - - // TODO: remove this as partition key range id is not relevant - // TODO; has to be rx async - //CollectionCache collectionCache = this.client.getCollectionCache(); - - // TODO: has to be rx async - //DocumentCollection collection = - // collectionCache.resolveCollection(request); - - // TODO: this code is not relevant because partition key range id should not be exposed - // if (!Strings.isNullOrEmpty(super.getPartitionKeyId())) - // { - // request.RouteTo(new PartitionKeyRangeIdentity(collection.ResourceId, base.PartitionKeyRangeId)); - // return await this.ExecuteRequestAsync(request); - // } - - request.UseGatewayMode = true; - return this.executeRequestAsync(request); - } - - public RxDocumentServiceRequest createRequestAsync(String continuationToken, Integer maxPageSize) { - - // TODO this should be async - Map requestHeaders = this.createCommonHeadersAsync( - this.getFeedOptions(continuationToken, maxPageSize)); - - // TODO: add support for simple continuation for single partition query - //requestHeaders.put(keyHttpConstants.HttpHeaders.IsContinuationExpected, isContinuationExpected.ToString()) - - RxDocumentServiceRequest request = this.createDocumentServiceRequest( - requestHeaders, - this.query, - this.getPartitionKeyInternal()); - - if (!StringUtils.isEmpty(feedOptions.getPartitionKeyRangeIdInternal())) { - request.routeTo(new PartitionKeyRangeIdentity(feedOptions.getPartitionKeyRangeIdInternal())); - } - - return request; - } - - private static boolean isClientSideContinuationToken(String continuationToken) { - if (continuationToken != null) { - ValueHolder outCompositeContinuationToken = new ValueHolder(); - if (CompositeContinuationToken.tryParse(continuationToken, outCompositeContinuationToken)) { - return true; - } - - ValueHolder outOrderByContinuationToken = new ValueHolder(); - if (OrderByContinuationToken.tryParse(continuationToken, outOrderByContinuationToken)) { - return true; - } - - ValueHolder outTakeContinuationToken = new ValueHolder(); - if (TakeContinuationToken.tryParse(continuationToken, outTakeContinuationToken)) { - return true; - } - } - - return false; - } -} - diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentProducer.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentProducer.java deleted file mode 100644 index 37303c96ad40..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentProducer.java +++ /dev/null @@ -1,270 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.IDocumentClientRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.ObservableHelper; -import com.microsoft.azure.cosmosdb.internal.query.metrics.ClientSideMetrics; -import com.microsoft.azure.cosmosdb.internal.query.metrics.FetchExecutionRangeAccumulator; -import com.microsoft.azure.cosmosdb.QueryMetrics; -import com.microsoft.azure.cosmosdb.QueryMetricsConstants; -import com.microsoft.azure.cosmosdb.internal.query.metrics.SchedulingStopwatch; -import com.microsoft.azure.cosmosdb.internal.query.metrics.SchedulingTimeSpan; - -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.internal.routing.Range; -import com.microsoft.azure.cosmosdb.rx.internal.Exceptions; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -import rx.Observable; -import rx.Single; -import rx.functions.Func0; -import rx.functions.Func1; -import rx.functions.Func2; -import rx.functions.Func3; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -class DocumentProducer { - private static final Logger logger = LoggerFactory.getLogger(DocumentProducer.class); - private int retries; - - class DocumentProducerFeedResponse { - FeedResponse pageResult; - PartitionKeyRange sourcePartitionKeyRange; - - DocumentProducerFeedResponse(FeedResponse pageResult) { - this.pageResult = pageResult; - this.sourcePartitionKeyRange = DocumentProducer.this.targetRange; - populatePartitionedQueryMetrics(); - } - - DocumentProducerFeedResponse(FeedResponse pageResult, PartitionKeyRange pkr) { - this.pageResult = pageResult; - this.sourcePartitionKeyRange = pkr; - populatePartitionedQueryMetrics(); - } - - void populatePartitionedQueryMetrics() { - String queryMetricsDelimitedString = pageResult.getResponseHeaders().get(HttpConstants.HttpHeaders.QUERY_METRICS); - if (!StringUtils.isEmpty(queryMetricsDelimitedString)) { - queryMetricsDelimitedString += String.format(";%s=%.2f", QueryMetricsConstants.RequestCharge, pageResult.getRequestCharge()); - ImmutablePair schedulingTimeSpanMap = - new ImmutablePair<>(targetRange.getId(), fetchSchedulingMetrics.getElapsedTime()); - - QueryMetrics qm =BridgeInternal.createQueryMetricsFromDelimitedStringAndClientSideMetrics(queryMetricsDelimitedString, - new ClientSideMetrics(retries, - pageResult.getRequestCharge(), - fetchExecutionRangeAccumulator.getExecutionRanges(), - Arrays.asList(schedulingTimeSpanMap) - ), pageResult.getActivityId()); - BridgeInternal.putQueryMetricsIntoMap(pageResult, targetRange.getId(), qm); - } - } - } - - protected final IDocumentQueryClient client; - protected final String collectionRid; - protected final FeedOptions feedOptions; - protected final Class resourceType; - protected final PartitionKeyRange targetRange; - protected final String collectionLink; - protected final Func3 createRequestFunc; - protected final Func1>> executeRequestFuncWithRetries; - protected final Func0 createRetryPolicyFunc; - protected final int pageSize; - protected final UUID correlatedActivityId; - public int top; - private volatile String lastResponseContinuationToken; - private final SchedulingStopwatch fetchSchedulingMetrics; - private SchedulingStopwatch moveNextSchedulingMetrics; - private final FetchExecutionRangeAccumulator fetchExecutionRangeAccumulator; - - public DocumentProducer( - IDocumentQueryClient client, - String collectionResourceId, - FeedOptions feedOptions, - Func3 createRequestFunc, - Func1>> executeRequestFunc, - PartitionKeyRange targetRange, - String collectionLink, - Func0 createRetryPolicyFunc, - Class resourceType , - UUID correlatedActivityId, - int initialPageSize, // = -1, - String initialContinuationToken, - int top) { - - this.client = client; - this.collectionRid = collectionResourceId; - - this.createRequestFunc = createRequestFunc; - - this.fetchSchedulingMetrics = new SchedulingStopwatch(); - this.fetchSchedulingMetrics.ready(); - this.fetchExecutionRangeAccumulator = new FetchExecutionRangeAccumulator(targetRange.getId()); - - this.executeRequestFuncWithRetries = request -> { - retries = -1; - this.fetchSchedulingMetrics.start(); - this.fetchExecutionRangeAccumulator.beginFetchRange(); - IDocumentClientRetryPolicy retryPolicy = null; - if (createRetryPolicyFunc != null) { - retryPolicy = createRetryPolicyFunc.call(); - retryPolicy.onBeforeSendRequest(request); - } - return ObservableHelper.inlineIfPossibleAsObs( - () -> { - ++retries; - return executeRequestFunc.call(request); - }, retryPolicy); - }; - - this.correlatedActivityId = correlatedActivityId; - - this.feedOptions = feedOptions != null ? feedOptions : new FeedOptions(); - this.feedOptions.setRequestContinuation(initialContinuationToken); - this.lastResponseContinuationToken = initialContinuationToken; - this.resourceType = resourceType; - this.targetRange = targetRange; - this.collectionLink = collectionLink; - this.createRetryPolicyFunc = createRetryPolicyFunc; - this.pageSize = initialPageSize; - this.top = top; - } - - public Observable produceAsync() { - Func2 sourcePartitionCreateRequestFunc = - (token, maxItemCount) -> createRequestFunc.call(targetRange, token, maxItemCount); - Observable> obs = Paginator - .getPaginatedQueryResultAsObservable( - feedOptions, - sourcePartitionCreateRequestFunc, - executeRequestFuncWithRetries, - resourceType, - top, - pageSize) - .map(rsp -> { - lastResponseContinuationToken = rsp.getResponseContinuation(); - this.fetchExecutionRangeAccumulator.endFetchRange(rsp.getActivityId(), - rsp.getResults().size(), - this.retries); - this.fetchSchedulingMetrics.stop(); - return rsp;}); - - return splitProof(obs.map(page -> new DocumentProducerFeedResponse(page))); - } - - private Observable splitProof(Observable sourceFeedResponseObservable) { - return sourceFeedResponseObservable.onErrorResumeNext( t -> { - DocumentClientException dce = Utils.as(t, DocumentClientException.class); - if (dce == null || !isSplit(dce)) { - logger.error("Unexpected failure", t); - return Observable.error(t); - } - - // we are dealing with Split - logger.info("DocumentProducer handling a partition split in [{}], detail:[{}]", targetRange, dce); - Single> replacementRangesObs = getReplacementRanges(targetRange.toRange()); - - // Since new DocumentProducers are instantiated for the new replacement ranges, if for the new - // replacement partitions split happens the corresponding DocumentProducer can recursively handle splits. - // so this is resilient to split on splits. - Observable> replacementProducers = replacementRangesObs.toObservable().flatMap( - partitionKeyRanges -> { - if (logger.isDebugEnabled()) { - logger.info("Cross Partition Query Execution detected partition [{}] split into [{}] partitions," - + " last continuation token is [{}].", - targetRange.toJson(), - String.join(", ", partitionKeyRanges.stream() - .map(pkr -> pkr.toJson()).collect(Collectors.toList())), - lastResponseContinuationToken); - } - return Observable.from(createReplacingDocumentProducersOnSplit(partitionKeyRanges)); - }); - - return produceOnSplit(replacementProducers); - }); - } - - protected Observable produceOnSplit(Observable> replacingDocumentProducers) { - return replacingDocumentProducers.flatMap(dp -> dp.produceAsync(), 1); - } - - private List> createReplacingDocumentProducersOnSplit(List partitionKeyRanges) { - - List> replacingDocumentProducers = new ArrayList<>(partitionKeyRanges.size()); - for(PartitionKeyRange pkr: partitionKeyRanges) { - replacingDocumentProducers.add(createChildDocumentProducerOnSplit(pkr, lastResponseContinuationToken)); - } - return replacingDocumentProducers; - } - - protected DocumentProducer createChildDocumentProducerOnSplit( - PartitionKeyRange targetRange, - String initialContinuationToken) { - - return new DocumentProducer( - client, - collectionRid, - feedOptions, - createRequestFunc, - executeRequestFuncWithRetries, - targetRange, - collectionLink, - null, - resourceType , - correlatedActivityId, - pageSize, - initialContinuationToken, - top); - } - - private Single> getReplacementRanges(Range range) { - return client.getPartitionKeyRangeCache().tryGetOverlappingRangesAsync(collectionRid, range, true, feedOptions.getProperties()); - } - - private boolean isSplit(DocumentClientException e) { - return Exceptions.isPartitionSplit(e); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentQueryExecutionContextBase.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentQueryExecutionContextBase.java deleted file mode 100644 index 3692ee46e0f1..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentQueryExecutionContextBase.java +++ /dev/null @@ -1,299 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.io.UnsupportedEncodingException; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.SqlParameterCollection; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.RuntimeConstants.MediaTypes; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternal; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import com.microsoft.azure.cosmosdb.rx.internal.ReplicatedResourceClientUtils; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -import rx.Observable; -import rx.Single; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public abstract class DocumentQueryExecutionContextBase -implements IDocumentQueryExecutionContext { - - protected ResourceType resourceTypeEnum; - protected String resourceLink; - protected IDocumentQueryClient client; - protected Class resourceType; - protected FeedOptions feedOptions; - protected SqlQuerySpec query; - protected UUID correlatedActivityId; - protected boolean shouldExecuteQueryRequest; - - protected DocumentQueryExecutionContextBase(IDocumentQueryClient client, ResourceType resourceTypeEnum, - Class resourceType, SqlQuerySpec query, FeedOptions feedOptions, String resourceLink, - boolean getLazyFeedResponse, UUID correlatedActivityId) { - - // TODO: validate args are not null: client and feedOption should not be null - this.client = client; - this.resourceTypeEnum = resourceTypeEnum; - this.resourceType = resourceType; - this.query = query; - this.shouldExecuteQueryRequest = (query != null); - this.feedOptions = feedOptions; - this.resourceLink = resourceLink; - // this.getLazyFeedResponse = getLazyFeedResponse; - this.correlatedActivityId = correlatedActivityId; - } - - @Override - abstract public Observable> executeAsync(); - - public String getPartitionKeyId() { - // TODO Auto-generated method stub - return this.feedOptions.getPartitionKeyRangeIdInternal(); - } - - public RxDocumentServiceRequest createDocumentServiceRequest(Map requestHeaders, - SqlQuerySpec querySpec, - PartitionKeyInternal partitionKey) { - - RxDocumentServiceRequest request = querySpec != null - ? this.createQueryDocumentServiceRequest(requestHeaders, querySpec) - : this.createReadFeedDocumentServiceRequest(requestHeaders); - - this.populatePartitionKeyInfo(request, partitionKey); - - return request; - } - - protected RxDocumentServiceRequest createDocumentServiceRequest(Map requestHeaders, - SqlQuerySpec querySpec, - PartitionKeyRange targetRange, - String collectionRid) { - RxDocumentServiceRequest request = querySpec != null - ? this.createQueryDocumentServiceRequest(requestHeaders, querySpec) - : this.createReadFeedDocumentServiceRequest(requestHeaders); - - this.populatePartitionKeyRangeInfo(request, targetRange, collectionRid); - - return request; - } - - public Single> executeRequestAsync(RxDocumentServiceRequest request) { - return (this.shouldExecuteQueryRequest ? this.executeQueryRequestAsync(request) - : this.executeReadFeedRequestAsync(request)); - } - - public Single> executeQueryRequestAsync(RxDocumentServiceRequest request) { - return this.getFeedResponse(this.executeQueryRequestInternalAsync(request)); - } - - public Single> executeReadFeedRequestAsync(RxDocumentServiceRequest request) { - return this.getFeedResponse(this.client.readFeedAsync(request)); - } - - protected Single> getFeedResponse(Single response) { - return response.map(resp -> BridgeInternal.toFeedResponsePage(resp, resourceType)); - } - - public FeedOptions getFeedOptions(String continuationToken, Integer maxPageSize) { - FeedOptions options = new FeedOptions(this.feedOptions); - options.setRequestContinuation(continuationToken); - options.setMaxItemCount(maxPageSize); - return options; - } - - private Single executeQueryRequestInternalAsync(RxDocumentServiceRequest request) { - return this.client.executeQueryAsync(request); - } - - public Map createCommonHeadersAsync(FeedOptions feedOptions) { - Map requestHeaders = new HashMap<>(); - - ConsistencyLevel defaultConsistencyLevel = this.client.getDefaultConsistencyLevelAsync(); - ConsistencyLevel desiredConsistencyLevel = this.client.getDesiredConsistencyLevelAsync(); - if (!Strings.isNullOrEmpty(feedOptions.getSessionToken()) - && !ReplicatedResourceClientUtils.isReadingFromMaster(this.resourceTypeEnum, OperationType.ReadFeed)) { - if (defaultConsistencyLevel == ConsistencyLevel.Session - || (desiredConsistencyLevel == ConsistencyLevel.Session)) { - // Query across partitions is not supported today. Master resources (for e.g., - // database) - // can span across partitions, whereas server resources (viz: collection, - // document and attachment) - // don't span across partitions. Hence, session token returned by one partition - // should not be used - // when quering resources from another partition. - // Since master resources can span across partitions, don't send session token - // to the backend. - // As master resources are sync replicated, we should always get consistent - // query result for master resources, - // irrespective of the chosen replica. - // For server resources, which don't span partitions, specify the session token - // for correct replica to be chosen for servicing the query result. - requestHeaders.put(HttpConstants.HttpHeaders.SESSION_TOKEN, feedOptions.getSessionToken()); - } - } - - requestHeaders.put(HttpConstants.HttpHeaders.CONTINUATION, feedOptions.getRequestContinuation()); - requestHeaders.put(HttpConstants.HttpHeaders.IS_QUERY, Strings.toString(true)); - - // Flow the pageSize only when we are not doing client eval - if (feedOptions.getMaxItemCount() != null && feedOptions.getMaxItemCount() > 0) { - requestHeaders.put(HttpConstants.HttpHeaders.PAGE_SIZE, Strings.toString(feedOptions.getMaxItemCount())); - } - - if (feedOptions.getEnableCrossPartitionQuery() != null) { - - requestHeaders.put(HttpConstants.HttpHeaders.ENABLE_CROSS_PARTITION_QUERY, - Strings.toString(feedOptions.getEnableCrossPartitionQuery())); - } - - if (feedOptions.getMaxDegreeOfParallelism() != 0) { - requestHeaders.put(HttpConstants.HttpHeaders.PARALLELIZE_CROSS_PARTITION_QUERY, Strings.toString(true)); - } - - if (this.feedOptions.getEnableCrossPartitionQuery() != null) { - requestHeaders.put(HttpConstants.HttpHeaders.ENABLE_SCAN_IN_QUERY, - Strings.toString(this.feedOptions.getEnableCrossPartitionQuery())); - } - - if (this.feedOptions.getResponseContinuationTokenLimitInKb() > 0) { - requestHeaders.put(HttpConstants.HttpHeaders.RESPONSE_CONTINUATION_TOKEN_LIMIT_IN_KB, - Strings.toString(feedOptions.getResponseContinuationTokenLimitInKb())); - } - - if (desiredConsistencyLevel != null) { - requestHeaders.put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, desiredConsistencyLevel.name()); - } - - if(feedOptions.getPopulateQueryMetrics()){ - requestHeaders.put(HttpConstants.HttpHeaders.POPULATE_QUERY_METRICS, String.valueOf(feedOptions.getPopulateQueryMetrics())); - } - - return requestHeaders; - } - - private void populatePartitionKeyInfo(RxDocumentServiceRequest request, PartitionKeyInternal partitionKey) { - if (request == null) { - throw new NullPointerException("request"); - } - - if (this.resourceTypeEnum.isPartitioned()) { - if (partitionKey != null) { - request.getHeaders().put(HttpConstants.HttpHeaders.PARTITION_KEY, partitionKey.toJson()); - } - } - } - - public void populatePartitionKeyRangeInfo(RxDocumentServiceRequest request, PartitionKeyRange range, - String collectionRid) { - if (request == null) { - throw new NullPointerException("request"); - } - - if (range == null) { - throw new NullPointerException("range"); - } - - if (this.resourceTypeEnum.isPartitioned()) { - request.routeTo(new PartitionKeyRangeIdentity(collectionRid, range.getId())); - } - } - - private RxDocumentServiceRequest createQueryDocumentServiceRequest(Map requestHeaders, - SqlQuerySpec querySpec) { - RxDocumentServiceRequest executeQueryRequest; - - String queryText; - switch (this.client.getQueryCompatibilityMode()) { - case SqlQuery: - SqlParameterCollection params = querySpec.getParameters(); - Utils.checkStateOrThrow(params != null && params.size() > 0, "query.parameters", - "Unsupported argument in query compatibility mode '%s'", - this.client.getQueryCompatibilityMode().toString()); - - executeQueryRequest = RxDocumentServiceRequest.create(OperationType.SqlQuery, this.resourceTypeEnum, - this.resourceLink, - // AuthorizationTokenType.PrimaryMasterKey, - requestHeaders); - - executeQueryRequest.getHeaders().put(HttpConstants.HttpHeaders.CONTENT_TYPE, MediaTypes.JSON); - queryText = querySpec.getQueryText(); - break; - - case Default: - case Query: - default: - executeQueryRequest = RxDocumentServiceRequest.create(OperationType.Query, this.resourceTypeEnum, - this.resourceLink, - // AuthorizationTokenType.PrimaryMasterKey, - requestHeaders); - - executeQueryRequest.getHeaders().put(HttpConstants.HttpHeaders.CONTENT_TYPE, MediaTypes.QUERY_JSON); - queryText = querySpec.toJson(); - break; - } - - try { - executeQueryRequest.setContentBytes(queryText.getBytes("UTF-8")); - } catch (UnsupportedEncodingException e) { - // TODO Auto-generated catch block - // TODO: exception should be handled differently - e.printStackTrace(); - } - - return executeQueryRequest; - } - - private RxDocumentServiceRequest createReadFeedDocumentServiceRequest(Map requestHeaders) { - if (this.resourceTypeEnum == ResourceType.Database || this.resourceTypeEnum == ResourceType.Offer) { - return RxDocumentServiceRequest.create(OperationType.ReadFeed, null, this.resourceTypeEnum, - // TODO: we may want to add a constructor to RxDocumentRequest supporting authorization type similar to .net - // AuthorizationTokenType.PrimaryMasterKey, - requestHeaders); - } else { - return RxDocumentServiceRequest.create(OperationType.ReadFeed, this.resourceTypeEnum, this.resourceLink, - // TODO: we may want to add a constructor to RxDocumentRequest supporting authorization type similar to .net - // AuthorizationTokenType.PrimaryMasterKey, - requestHeaders); - } - } - -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentQueryExecutionContextFactory.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentQueryExecutionContextFactory.java deleted file mode 100644 index 4b4b2891dfe5..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentQueryExecutionContextFactory.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.util.List; -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.query.PartitionedQueryExecutionInfo; -import com.microsoft.azure.cosmosdb.internal.query.QueryInfo; -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxCollectionCache; - -import rx.Observable; -import rx.Single; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class DocumentQueryExecutionContextFactory { - - private final static int PageSizeFactorForTop = 5; - - private static Single resolveCollection(IDocumentQueryClient client, SqlQuerySpec query, - ResourceType resourceTypeEnum, String resourceLink) { - - RxCollectionCache collectionCache = client.getCollectionCache(); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create( - OperationType.Query, - resourceTypeEnum, - resourceLink, null - // TODO AuthorizationTokenType.Invalid) - ); //this request doesnt actually go to server - return collectionCache.resolveCollectionAsync(request); - } - - public static Observable> createDocumentQueryExecutionContextAsync( - IDocumentQueryClient client, - ResourceType resourceTypeEnum, - Class resourceType, - SqlQuerySpec query, - FeedOptions feedOptions, - String resourceLink, - boolean isContinuationExpected, - UUID correlatedActivityId) { - - // return proxy - Observable collectionObs = Observable.just(null); - - if (resourceTypeEnum.isCollectionChild()) { - collectionObs = resolveCollection(client, query, resourceTypeEnum, resourceLink).toObservable(); - } - - // We create a ProxyDocumentQueryExecutionContext that will be initialized with DefaultDocumentQueryExecutionContext - // which will be used to send the query to Gateway and on getting 400(bad request) with 1004(cross parition query not servable), we initialize it with - // PipelinedDocumentQueryExecutionContext by providing the partition query execution info that's needed(which we get from the exception returned from Gateway). - - Observable> proxyQueryExecutionContext = - collectionObs.flatMap(collection -> - ProxyDocumentQueryExecutionContext.createAsync( - client, - resourceTypeEnum, - resourceType, - query, - feedOptions, - resourceLink, - collection, - isContinuationExpected, - correlatedActivityId)); - - return proxyQueryExecutionContext; - } - - public static Observable> createSpecializedDocumentQueryExecutionContextAsync( - IDocumentQueryClient client, - ResourceType resourceTypeEnum, - Class resourceType, - SqlQuerySpec query, - FeedOptions feedOptions, - String resourceLink, - boolean isContinuationExpected, - PartitionedQueryExecutionInfo partitionedQueryExecutionInfo, - List targetRanges, - String collectionRid, - UUID correlatedActivityId) { - - int initialPageSize = Utils.getValueOrDefault(feedOptions.getMaxItemCount(), ParallelQueryConfig.ClientInternalPageSize); - - BadRequestException validationError = Utils.checkRequestOrReturnException - (initialPageSize > 0, "MaxItemCount", "Invalid MaxItemCount %s", initialPageSize); - if (validationError != null) { - return Observable.error(validationError); - } - - QueryInfo queryInfo = partitionedQueryExecutionInfo.getQueryInfo(); - - boolean getLazyFeedResponse = queryInfo.hasTop(); - - // We need to compute the optimal initial page size for order-by queries - if (queryInfo.hasOrderBy()) { - int top; - if (queryInfo.hasTop() && (top = partitionedQueryExecutionInfo.getQueryInfo().getTop()) > 0) { - int pageSizeWithTop = Math.min( - (int)Math.ceil(top / (double)targetRanges.size()) * PageSizeFactorForTop, - top); - - if (initialPageSize > 0) { - initialPageSize = Math.min(pageSizeWithTop, initialPageSize); - } - else { - initialPageSize = pageSizeWithTop; - } - } - // TODO: do not support continuation in string format right now - // else if (isContinuationExpected) - // { - // if (initialPageSize < 0) - // { - // initialPageSize = (int)Math.Max(feedOptions.MaxBufferedItemCount, ParallelQueryConfig.GetConfig().DefaultMaximumBufferSize); - // } - // - // initialPageSize = Math.Min( - // (int)Math.Ceiling(initialPageSize / (double)targetRanges.Count) * PageSizeFactorForTop, - // initialPageSize); - // } - } - - return PipelinedDocumentQueryExecutionContext.createAsync( - client, - resourceTypeEnum, - resourceType, - query, - feedOptions, - resourceLink, - collectionRid, - partitionedQueryExecutionInfo, - targetRanges, - initialPageSize, - isContinuationExpected, - getLazyFeedResponse, - correlatedActivityId); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/Fetcher.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/Fetcher.java deleted file mode 100644 index 07f5e6daad9f..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/Fetcher.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.FeedOptionsBase; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; - -import rx.Observable; -import rx.functions.Func1; -import rx.functions.Func2; - -class Fetcher { - private final static Logger logger = LoggerFactory.getLogger(Fetcher.class); - - private final Func2 createRequestFunc; - private final Func1>> executeFunc; - private final boolean isChangeFeed; - - private volatile boolean shouldFetchMore; - private volatile int maxItemCount; - private volatile int top; - private volatile String continuationToken; - - public Fetcher(Func2 createRequestFunc, - Func1>> executeFunc, - FeedOptionsBase options, - boolean isChangeFeed, - int top, - int maxItemCount) { - - this.createRequestFunc = createRequestFunc; - this.executeFunc = executeFunc; - this.isChangeFeed = isChangeFeed; - - this.continuationToken = options.getRequestContinuation(); - this.top = top; - if (top == -1) { - this.maxItemCount = maxItemCount; - } else { - // it is a top query, we should not retrieve more than requested top. - this.maxItemCount = Math.min(maxItemCount, top); - } - this.shouldFetchMore = true; - } - - public boolean shouldFetchMore() { - return shouldFetchMore; - } - - public Observable> nextPage() { - RxDocumentServiceRequest request = createRequest(); - return nextPage(request); - } - - private void updateState(FeedResponse response) { - continuationToken = response.getResponseContinuation(); - if (top != -1) { - top -= response.getResults().size(); - if (top < 0) { - // this shouldn't happen - // this means backend retrieved more items than requested - logger.warn("Azure Cosmos DB BackEnd Service returned more than requested {} items", maxItemCount); - top = 0; - } - maxItemCount = Math.min(maxItemCount, top); - } - - shouldFetchMore = shouldFetchMore && - // if token is null or top == 0 then done - (!StringUtils.isEmpty(continuationToken) && (top != 0)) && - // if change feed query and no changes then done - (!isChangeFeed || !BridgeInternal.noChanges(response)); - - logger.debug("Fetcher state updated: " + - "isChangeFeed = {}, continuation token = {}, max item count = {}, should fetch more = {}", - isChangeFeed, continuationToken, maxItemCount, shouldFetchMore); - } - - private RxDocumentServiceRequest createRequest() { - if (!shouldFetchMore) { - // this should never happen - logger.error("invalid state, trying to fetch more after completion"); - throw new IllegalStateException("Invalid state, trying to fetch more after completion"); - } - - return createRequestFunc.call(continuationToken, maxItemCount); - } - - private Observable> nextPage(RxDocumentServiceRequest request) { - return executeFunc.call(request).map(rsp -> { - updateState(rsp); - return rsp; - }); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/IDocumentQueryClient.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/IDocumentQueryClient.java deleted file mode 100644 index 3ac016471730..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/IDocumentQueryClient.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.rx.internal.IRetryPolicyFactory; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxCollectionCache; -import com.microsoft.azure.cosmosdb.rx.internal.caches.IPartitionKeyRangeCache; - -import rx.Single; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public interface IDocumentQueryClient { - - /** - * TODO: this should be async returning observable - * @return - */ - RxCollectionCache getCollectionCache(); - - /** - * TODO: this should be async returning observable - * @return - */ - IPartitionKeyRangeCache getPartitionKeyRangeCache(); - - /** - * @return - */ - IRetryPolicyFactory getResetSessionTokenRetryPolicy(); - - /** - * TODO: this should be async returning observable - * @return - */ - ConsistencyLevel getDefaultConsistencyLevelAsync(); - - /** - * TODO: this should be async returning observable - * @return - */ - ConsistencyLevel getDesiredConsistencyLevelAsync(); - - Single executeQueryAsync(RxDocumentServiceRequest request); - - QueryCompatibilityMode getQueryCompatibilityMode(); - - /// - /// A client query compatibility mode when making query request. - /// Can be used to force a specific query request format. - /// - enum QueryCompatibilityMode { - /// - /// Default (latest) query format. - /// - Default, - - /// - /// Query (application/query+json). - /// Default. - /// - Query, - - /// - /// SqlQuery (application/sql). - /// - SqlQuery - } - - Single readFeedAsync(RxDocumentServiceRequest request); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/IDocumentQueryExecutionComponent.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/IDocumentQueryExecutionComponent.java deleted file mode 100644 index b1a260e54911..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/IDocumentQueryExecutionComponent.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Resource; - -import rx.Observable; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public interface IDocumentQueryExecutionComponent { - - Observable> drainAsync(int maxPageSize); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/IDocumentQueryExecutionContext.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/IDocumentQueryExecutionContext.java deleted file mode 100644 index bb2cd7f1787a..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/IDocumentQueryExecutionContext.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Resource; - -import rx.Observable; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public interface IDocumentQueryExecutionContext { - - Observable> executeAsync(); -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/OrderByContinuationToken.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/OrderByContinuationToken.java deleted file mode 100644 index 79b04551db6b..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/OrderByContinuationToken.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.util.ArrayList; -import java.util.List; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.microsoft.azure.cosmosdb.JsonSerializable; -import com.microsoft.azure.cosmosdb.internal.query.QueryItem; -import com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public final class OrderByContinuationToken extends JsonSerializable { - private static final String CompositeContinuationTokenPropertyName = "compositeToken"; - private static final String OrderByItemsPropetryName = "orderByItems"; - private static final String RidPropertyName = "rid"; - private static final String InclusivePropertyName = "inclusive"; - private static final Logger logger = LoggerFactory.getLogger(OrderByContinuationToken.class); - - public OrderByContinuationToken(CompositeContinuationToken compositeContinuationToken, QueryItem[] orderByItems, - String rid, boolean inclusive) { - if (compositeContinuationToken == null) { - throw new IllegalArgumentException("CompositeContinuationToken must not be null."); - } - - if (orderByItems == null) { - throw new IllegalArgumentException("orderByItems must not be null."); - } - - if (orderByItems.length == 0) { - throw new IllegalArgumentException("orderByItems must not be empty."); - } - - if (rid == null) { - throw new IllegalArgumentException("rid must not be null."); - } - - this.setCompositeContinuationToken(compositeContinuationToken); - this.setOrderByItems(orderByItems); - this.setRid(rid); - this.setInclusive(inclusive); - } - - private OrderByContinuationToken(String serializedOrderByContinuationToken) { - super(serializedOrderByContinuationToken); - } - - public static boolean tryParse(String serializedOrderByContinuationToken, - ValueHolder outOrderByContinuationToken) { - boolean parsed; - try { - OrderByContinuationToken orderByContinuationToken = new OrderByContinuationToken( - serializedOrderByContinuationToken); - CompositeContinuationToken compositeContinuationToken = orderByContinuationToken - .getCompositeContinuationToken(); - if (compositeContinuationToken == null) { - throw new IllegalArgumentException("compositeContinuationToken must not be null."); - } - - orderByContinuationToken.getOrderByItems(); - orderByContinuationToken.getRid(); - orderByContinuationToken.getInclusive(); - - outOrderByContinuationToken.v = orderByContinuationToken; - parsed = true; - } catch (Exception ex) { - logger.debug( - "Received exception {} when trying to parse: {}", - ex.getMessage(), - serializedOrderByContinuationToken); - parsed = false; - outOrderByContinuationToken.v = null; - } - - return parsed; - } - - public CompositeContinuationToken getCompositeContinuationToken() { - ValueHolder outCompositeContinuationToken = new ValueHolder(); - boolean succeeded = CompositeContinuationToken.tryParse(super.getString(CompositeContinuationTokenPropertyName), - outCompositeContinuationToken); - if (!succeeded) { - throw new IllegalArgumentException("Continuation Token was not able to be parsed"); - } - - return outCompositeContinuationToken.v; - } - - public QueryItem[] getOrderByItems() { - List queryItems = new ArrayList(); - ArrayNode arrayNode = (ArrayNode) super.get(OrderByItemsPropetryName); - for (JsonNode jsonNode : arrayNode) { - QueryItem queryItem = new QueryItem(jsonNode.toString()); - queryItems.add(queryItem); - } - - QueryItem[] queryItemsArray = new QueryItem[queryItems.size()]; - - return queryItems.toArray(queryItemsArray); - } - - public String getRid() { - return super.getString(RidPropertyName); - } - - public boolean getInclusive() { - return super.getBoolean(InclusivePropertyName); - } - - private void setCompositeContinuationToken(CompositeContinuationToken compositeContinuationToken) { - super.set(CompositeContinuationTokenPropertyName, compositeContinuationToken.toJson()); - } - - private void setOrderByItems(QueryItem[] orderByItems) { - super.set(OrderByItemsPropetryName, orderByItems); - } - - private void setRid(String rid) { - super.set(RidPropertyName, rid); - } - - private void setInclusive(boolean inclusive) { - super.set(InclusivePropertyName, inclusive); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/OrderByDocumentProducer.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/OrderByDocumentProducer.java deleted file mode 100644 index 8d36a6ce8f68..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/OrderByDocumentProducer.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.internal.query.orderbyquery.OrderByRowResult; -import com.microsoft.azure.cosmosdb.internal.query.orderbyquery.OrderbyRowComparer; -import com.microsoft.azure.cosmosdb.rx.internal.IDocumentClientRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -import com.microsoft.azure.cosmosdb.QueryMetrics; -import rx.Observable; -import rx.functions.Func0; -import rx.functions.Func1; -import rx.functions.Func3; - -class OrderByDocumentProducer extends DocumentProducer { - private final OrderbyRowComparer consumeComparer; - private final Map targetRangeToOrderByContinuationTokenMap; - - OrderByDocumentProducer( - OrderbyRowComparer consumeComparer, - IDocumentQueryClient client, - String collectionResourceId, - FeedOptions feedOptions, - Func3 createRequestFunc, - Func1>> executeRequestFunc, - PartitionKeyRange targetRange, - String collectionLink, - Func0 createRetryPolicyFunc, - Class resourceType, - UUID correlatedActivityId, - int initialPageSize, - String initialContinuationToken, - int top, - Map targetRangeToOrderByContinuationTokenMap) { - super(client, collectionResourceId, feedOptions, createRequestFunc, executeRequestFunc, targetRange, collectionLink, - createRetryPolicyFunc, resourceType, correlatedActivityId, initialPageSize, initialContinuationToken, top); - this.consumeComparer = consumeComparer; - this.targetRangeToOrderByContinuationTokenMap = targetRangeToOrderByContinuationTokenMap; - } - - protected Observable produceOnSplit(Observable> replacementProducers) { - Observable res = replacementProducers.toList().single().flatMap(documentProducers -> { - RequestChargeTracker tracker = new RequestChargeTracker(); - Map queryMetricsMap = new HashMap<>(); - return OrderByUtils.orderedMerge(resourceType, consumeComparer, tracker, documentProducers, queryMetricsMap, - targetRangeToOrderByContinuationTokenMap) - .map(orderByQueryResult -> resultPageFrom(tracker, orderByQueryResult)); - }); - - return res; - } - - @SuppressWarnings("unchecked") - private DocumentProducerFeedResponse resultPageFrom(RequestChargeTracker tracker, OrderByRowResult row) { - double requestCharge = tracker.getAndResetCharge(); - Map headers = Utils.immutableMapOf(HttpConstants.HttpHeaders.REQUEST_CHARGE, String.valueOf(requestCharge)); - FeedResponse fr = BridgeInternal.createFeedResponse(Collections.singletonList((T) row), headers); - return new DocumentProducerFeedResponse(fr, row.getSourcePartitionKeyRange()); - } - - protected DocumentProducer createChildDocumentProducerOnSplit( - PartitionKeyRange targetRange, - String initialContinuationToken) { - - return new OrderByDocumentProducer<>( - consumeComparer, - client, - collectionRid, - feedOptions, - createRequestFunc, - executeRequestFuncWithRetries, - targetRange, - collectionLink, - createRetryPolicyFunc, - resourceType , - correlatedActivityId, - pageSize, - initialContinuationToken, - top, - this.targetRangeToOrderByContinuationTokenMap); - } - -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/OrderByDocumentQueryExecutionContext.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/OrderByDocumentQueryExecutionContext.java deleted file mode 100644 index 64edee55c03c..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/OrderByDocumentQueryExecutionContext.java +++ /dev/null @@ -1,654 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import java.util.function.Function; - -import org.apache.commons.lang3.NotImplementedException; -import org.apache.commons.lang3.tuple.ImmutablePair; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.query.PartitionedQueryExecutionInfo; -import com.microsoft.azure.cosmosdb.internal.query.QueryItem; -import com.microsoft.azure.cosmosdb.internal.query.SortOrder; -import com.microsoft.azure.cosmosdb.internal.query.orderbyquery.OrderByRowResult; -import com.microsoft.azure.cosmosdb.internal.query.orderbyquery.OrderbyRowComparer; -import com.microsoft.azure.cosmosdb.internal.routing.Range; -import com.microsoft.azure.cosmosdb.rx.internal.IDocumentClientRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import com.microsoft.azure.cosmosdb.QueryMetrics; -import com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; - -import rx.Observable; -import rx.Observable.Transformer; -import rx.functions.Func0; -import rx.functions.Func1; -import rx.functions.Func3; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class OrderByDocumentQueryExecutionContext - extends ParallelDocumentQueryExecutionContextBase { - private final String FormatPlaceHolder = "{documentdb-formattableorderbyquery-filter}"; - private final String True = "true"; - private final String collectionRid; - private final OrderbyRowComparer consumeComparer; - private final RequestChargeTracker tracker; - private final ConcurrentMap queryMetricMap; - private Observable> orderByObservable; - private final Map targetRangeToOrderByContinuationTokenMap; - - private OrderByDocumentQueryExecutionContext( - IDocumentQueryClient client, - List partitionKeyRanges, - ResourceType resourceTypeEnum, - Class klass, - SqlQuerySpec query, - FeedOptions feedOptions, - String resourceLink, - String rewrittenQuery, - boolean isContinuationExpected, - boolean getLazyFeedResponse, - OrderbyRowComparer consumeComparer, - String collectionRid, - UUID correlatedActivityId) { - super(client, partitionKeyRanges, resourceTypeEnum, klass, query, feedOptions, resourceLink, rewrittenQuery, - isContinuationExpected, getLazyFeedResponse, correlatedActivityId); - this.collectionRid = collectionRid; - this.consumeComparer = consumeComparer; - this.tracker = new RequestChargeTracker(); - this.queryMetricMap = new ConcurrentHashMap<>(); - targetRangeToOrderByContinuationTokenMap = new HashMap<>(); - } - - public static Observable> createAsync( - IDocumentQueryClient client, - ResourceType resourceTypeEnum, - Class resourceType, - SqlQuerySpec expression, - FeedOptions feedOptions, - String resourceLink, - String collectionRid, - PartitionedQueryExecutionInfo partitionedQueryExecutionInfo, - List partitionKeyRanges, - int initialPageSize, - boolean isContinuationExpected, - boolean getLazyFeedResponse, - UUID correlatedActivityId) { - - OrderByDocumentQueryExecutionContext context = new OrderByDocumentQueryExecutionContext(client, - partitionKeyRanges, - resourceTypeEnum, - resourceType, - expression, - feedOptions, - resourceLink, - partitionedQueryExecutionInfo.getQueryInfo().getRewrittenQuery(), - isContinuationExpected, - getLazyFeedResponse, - new OrderbyRowComparer(partitionedQueryExecutionInfo.getQueryInfo().getOrderBy()), - collectionRid, - correlatedActivityId); - - try { - context.initialize(partitionKeyRanges, - partitionedQueryExecutionInfo.getQueryInfo().getOrderBy(), - partitionedQueryExecutionInfo.getQueryInfo().getOrderByExpressions(), - initialPageSize, - feedOptions.getRequestContinuation()); - - return Observable.just(context); - } catch (DocumentClientException dce) { - return Observable.error(dce); - } - } - - private void initialize( - List partitionKeyRanges, - List sortOrders, - Collection orderByExpressions, - int initialPageSize, - String continuationToken) throws DocumentClientException { - if (continuationToken == null) { - // First iteration so use null continuation tokens and "true" filters - Map partitionKeyRangeToContinuationToken = new HashMap(); - for (PartitionKeyRange partitionKeyRange : partitionKeyRanges) { - partitionKeyRangeToContinuationToken.put(partitionKeyRange, - null); - } - - super.initialize(collectionRid, - partitionKeyRangeToContinuationToken, - initialPageSize, - new SqlQuerySpec(querySpec.getQueryText().replace(FormatPlaceHolder, - True), - querySpec.getParameters())); - } else { - // Check to see if order by continuation token is a valid JSON. - OrderByContinuationToken orderByContinuationToken; - ValueHolder outOrderByContinuationToken = new ValueHolder(); - if (!OrderByContinuationToken.tryParse(continuationToken, - outOrderByContinuationToken)) { - String message = String.format("Invalid JSON in continuation token %s for OrderBy~Context", - continuationToken); - throw new DocumentClientException(HttpConstants.StatusCodes.BADREQUEST, - message); - } - - orderByContinuationToken = outOrderByContinuationToken.v; - - CompositeContinuationToken compositeContinuationToken = orderByContinuationToken - .getCompositeContinuationToken(); - // Check to see if the ranges inside are valid - if (compositeContinuationToken.getRange().isEmpty()) { - String message = String.format("Invalid Range in the continuation token %s for OrderBy~Context.", - continuationToken); - throw new DocumentClientException(HttpConstants.StatusCodes.BADREQUEST, - message); - } - - // At this point the token is valid. - ImmutablePair targetIndexAndFilters = this.GetFiltersForPartitions( - orderByContinuationToken, - partitionKeyRanges, - sortOrders, - orderByExpressions); - - int targetIndex = targetIndexAndFilters.left; - targetRangeToOrderByContinuationTokenMap.put(String.valueOf(targetIndex), orderByContinuationToken); - FormattedFilterInfo formattedFilterInfo = targetIndexAndFilters.right; - - // Left - String filterForRangesLeftOfTheTargetRange = formattedFilterInfo.getFilterForRangesLeftOfTheTargetRange(); - this.initializeRangeWithContinuationTokenAndFilter(partitionKeyRanges, - /* startInclusive */ 0, - /* endExclusive */ targetIndex, - /* continuationToken */ null, - filterForRangesLeftOfTheTargetRange, - initialPageSize); - - // Target - String filterForTargetRange = formattedFilterInfo.getFilterForTargetRange(); - this.initializeRangeWithContinuationTokenAndFilter(partitionKeyRanges, - /* startInclusive */ targetIndex, - /* endExclusive */ targetIndex + 1, - null, - filterForTargetRange, - initialPageSize); - - // Right - String filterForRangesRightOfTheTargetRange = formattedFilterInfo.getFilterForRangesRightOfTheTargetRange(); - this.initializeRangeWithContinuationTokenAndFilter(partitionKeyRanges, - /* startInclusive */ targetIndex + 1, - /* endExclusive */ partitionKeyRanges.size(), - /* continuationToken */ null, - filterForRangesRightOfTheTargetRange, - initialPageSize); - } - - orderByObservable = OrderByUtils.orderedMerge(resourceType, - consumeComparer, - tracker, - documentProducers, - queryMetricMap, - targetRangeToOrderByContinuationTokenMap); - } - - private void initializeRangeWithContinuationTokenAndFilter( - List partitionKeyRanges, - int startInclusive, - int endExclusive, - String continuationToken, - String filter, - int initialPageSize) { - Map partitionKeyRangeToContinuationToken = new HashMap(); - for (int i = startInclusive; i < endExclusive; i++) { - PartitionKeyRange partitionKeyRange = partitionKeyRanges.get(i); - partitionKeyRangeToContinuationToken.put(partitionKeyRange, - continuationToken); - } - - super.initialize(collectionRid, - partitionKeyRangeToContinuationToken, - initialPageSize, - new SqlQuerySpec(querySpec.getQueryText().replace(FormatPlaceHolder, - filter), - querySpec.getParameters())); - } - - private ImmutablePair GetFiltersForPartitions( - OrderByContinuationToken orderByContinuationToken, - List partitionKeyRanges, - List sortOrders, - Collection orderByExpressions) throws DocumentClientException { - // Find the partition key range we left off on - int startIndex = this.FindTargetRangeAndExtractContinuationTokens(partitionKeyRanges, - orderByContinuationToken.getCompositeContinuationToken().getRange()); - - // Get the filters. - FormattedFilterInfo formattedFilterInfo = this.GetFormattedFilters(orderByExpressions, - orderByContinuationToken.getOrderByItems(), - sortOrders, - orderByContinuationToken.getInclusive()); - - return new ImmutablePair(startIndex, - formattedFilterInfo); - } - - private OrderByDocumentQueryExecutionContext.FormattedFilterInfo GetFormattedFilters( - Collection orderByExpressionCollection, - QueryItem[] orderByItems, - Collection sortOrderCollection, - boolean inclusive) { - // Convert to arrays - SortOrder[] sortOrders = new SortOrder[sortOrderCollection.size()]; - sortOrderCollection.toArray(sortOrders); - - String[] expressions = new String[orderByExpressionCollection.size()]; - orderByExpressionCollection.toArray(expressions); - - // Validate the inputs - if (expressions.length != sortOrders.length) { - throw new IllegalArgumentException("expressions.size() != sortOrders.size()"); - } - - if (expressions.length != orderByItems.length) { - throw new IllegalArgumentException("expressions.size() != orderByItems.length"); - } - - // When we run cross partition queries, - // we only serialize the continuation token for the partition that we left off - // on. - // The only problem is that when we resume the order by query, - // we don't have continuation tokens for all other partitions. - // The saving grace is that the data has a composite sort order(query sort - // order, partition key range id) - // so we can generate range filters which in turn the backend will turn into rid - // based continuation tokens, - // which is enough to get the streams of data flowing from all partitions. - // The details of how this is done is described below: - - int numOrderByItems = expressions.length; - boolean isSingleOrderBy = numOrderByItems == 1; - StringBuilder left = new StringBuilder(); - StringBuilder target = new StringBuilder(); - StringBuilder right = new StringBuilder(); - - if (isSingleOrderBy) { - // For a single order by query we resume the continuations in this manner - // Suppose the query is SELECT* FROM c ORDER BY c.string ASC - // And we left off on partition N with the value "B" - // Then - // All the partitions to the left will have finished reading "B" - // Partition N is still reading "B" - // All the partitions to the right have let to read a "B - // Therefore the filters should be - // > "B" , >= "B", and >= "B" respectively - // Repeat the same logic for DESC and you will get - // < "B", <= "B", and <= "B" respectively - // The general rule becomes - // For ASC - // > for partitions to the left - // >= for the partition we left off on - // >= for the partitions to the right - // For DESC - // < for partitions to the left - // <= for the partition we left off on - // <= for the partitions to the right - String expression = expressions[0]; - SortOrder sortOrder = sortOrders[0]; - QueryItem orderByItem = orderByItems[0]; - Object rawItem = orderByItem.getItem(); - String orderByItemToString; - if (rawItem instanceof String) { - orderByItemToString = "\"" + rawItem.toString().replaceAll("\"", - "\\\"") + "\""; - } else { - orderByItemToString = rawItem.toString(); - } - - left.append(String.format("%s %s %s", - expression, - (sortOrder == SortOrder.Descending ? "<" : ">"), - orderByItemToString)); - - if (inclusive) { - target.append(String.format("%s %s %s", - expression, - (sortOrder == SortOrder.Descending ? "<=" : ">="), - orderByItemToString)); - } else { - target.append(String.format("%s %s %s", - expression, - (sortOrder == SortOrder.Descending ? "<" : ">"), - orderByItemToString)); - } - - right.append(String.format("%s %s %s", - expression, - (sortOrder == SortOrder.Descending ? "<=" : ">="), - orderByItemToString)); - } else { - // This code path needs to be implemented, but it's error prone and needs - // testing. - // You can port the implementation from the .net SDK and it should work if - // ported right. - throw new NotImplementedException( - "Resuming a multi order by query from a continuation token is not supported yet."); - } - - return new FormattedFilterInfo(left.toString(), - target.toString(), - right.toString()); - } - - protected OrderByDocumentProducer createDocumentProducer( - String collectionRid, - PartitionKeyRange targetRange, - String continuationToken, - int initialPageSize, - FeedOptions feedOptions, - SqlQuerySpec querySpecForInit, - Map commonRequestHeaders, - Func3 createRequestFunc, - Func1>> executeFunc, - Func0 createRetryPolicyFunc) { - return new OrderByDocumentProducer(consumeComparer, - client, - collectionRid, - feedOptions, - createRequestFunc, - executeFunc, - targetRange, - collectionRid, - () -> client.getResetSessionTokenRetryPolicy().getRequestPolicy(), - resourceType, - correlatedActivityId, - initialPageSize, - continuationToken, - top, - this.targetRangeToOrderByContinuationTokenMap); - } - - private static class ItemToPageTransformer - implements Transformer, FeedResponse> { - private final static int DEFAULT_PAGE_SIZE = 100; - private final RequestChargeTracker tracker; - private final int maxPageSize; - private final ConcurrentMap queryMetricMap; - private final Function, String> orderByContinuationTokenCallback; - private volatile FeedResponse> previousPage; - - public ItemToPageTransformer( - RequestChargeTracker tracker, - int maxPageSize, - ConcurrentMap queryMetricsMap, - Function, String> orderByContinuationTokenCallback) { - this.tracker = tracker; - this.maxPageSize = maxPageSize > 0 ? maxPageSize : DEFAULT_PAGE_SIZE; - this.queryMetricMap = queryMetricsMap; - this.orderByContinuationTokenCallback = orderByContinuationTokenCallback; - this.previousPage = null; - } - - private static Map headerResponse( - double requestCharge) { - return Utils.immutableMapOf(HttpConstants.HttpHeaders.REQUEST_CHARGE, - String.valueOf(requestCharge)); - } - - private FeedResponse> addOrderByContinuationToken( - FeedResponse> page, - String orderByContinuationToken) { - Map headers = new HashMap<>(page.getResponseHeaders()); - headers.put(HttpConstants.HttpHeaders.CONTINUATION, - orderByContinuationToken); - return BridgeInternal.createFeedResponseWithQueryMetrics(page.getResults(), - headers, - page.getQueryMetrics()); - } - - @Override - public Observable> call( - Observable> source) { - return source - // .windows: creates an observable of observable where inner observable - // emits max maxPageSize elements - .window(maxPageSize).map(o -> o.toList()) - // flattens the observable>>> to - // Observable>> - .flatMap(resultListObs -> resultListObs, - 1) - // translates Observable>> to - // Observable>>> - .map(orderByRowResults -> { - // construct a page from result with request charge - FeedResponse> feedResponse = BridgeInternal.createFeedResponse( - orderByRowResults, - headerResponse(tracker.getAndResetCharge())); - if (!queryMetricMap.isEmpty()) { - for (String key : queryMetricMap.keySet()) { - BridgeInternal.putQueryMetricsIntoMap(feedResponse, - key, - queryMetricMap.get(key)); - } - } - return feedResponse; - }) - // Emit an empty page so the downstream observables know when there are no more - // results. - .concatWith(Observable.defer(() -> { - return Observable.just(BridgeInternal.createFeedResponse(Utils.immutableListOf(), - null)); - })) - // Create pairs from the stream to allow the observables downstream to "peek" - // 1, 2, 3, null -> (null, 1), (1, 2), (2, 3), (3, null) - .map(orderByRowResults -> { - ImmutablePair>, FeedResponse>> previousCurrent = new ImmutablePair>, FeedResponse>>( - this.previousPage, - orderByRowResults); - this.previousPage = orderByRowResults; - return previousCurrent; - }) - // remove the (null, 1) - .skip(1) - // Add the continuation token based on the current and next page. - .map(currentNext -> { - FeedResponse> current = currentNext.left; - FeedResponse> next = currentNext.right; - - FeedResponse> page; - if (next.getResults().size() == 0) { - // No more pages no send current page with null continuation token - page = current; - page = this.addOrderByContinuationToken(page, - null); - } else { - // Give the first page but use the first value in the next page to generate the - // continuation token - page = current; - List> results = next.getResults(); - OrderByRowResult firstElementInNextPage = results.get(0); - String orderByContinuationToken = this.orderByContinuationTokenCallback - .apply(firstElementInNextPage); - page = this.addOrderByContinuationToken(page, - orderByContinuationToken); - } - - return page; - }).map(feedOfOrderByRowResults -> { - // FeedResponse> to FeedResponse - List unwrappedResults = new ArrayList(); - for (OrderByRowResult orderByRowResult : feedOfOrderByRowResults.getResults()) { - unwrappedResults.add(orderByRowResult.getPayload()); - } - - return BridgeInternal.createFeedResponseWithQueryMetrics(unwrappedResults, - feedOfOrderByRowResults.getResponseHeaders(), - feedOfOrderByRowResults.getQueryMetrics()); - }).switchIfEmpty(Observable.defer(() -> { - // create an empty page if there is no result - return Observable.just(BridgeInternal.createFeedResponse(Utils.immutableListOf(), - headerResponse(tracker.getAndResetCharge()))); - })); - } - } - - @Override - public Observable> drainAsync( - int maxPageSize) { - //// In order to maintain the continuation token for the user we must drain with - //// a few constraints - //// 1) We always drain from the partition, which has the highest priority item - //// first - //// 2) If multiple partitions have the same priority item then we drain from - //// the left most first - //// otherwise we would need to keep track of how many of each item we drained - //// from each partition - //// (just like parallel queries). - //// Visually that look the following case where we have three partitions that - //// are numbered and store letters. - //// For teaching purposes I have made each item a tuple of the following form: - //// - //// So that duplicates across partitions are distinct, but duplicates within - //// partitions are indistinguishable. - //// |-------| |-------| |-------| - //// | | | | | | - //// | | | | | | - //// | | | | | | - //// | | | | | | - //// | | | | | | - //// | | | | | | - //// | | | | | | - //// |-------| |-------| |-------| - //// Now the correct drain order in this case is: - //// ,,,,,,,,,,, - //// ,,,,,,,,, - //// In more mathematical terms - //// 1) always comes before where x < z - //// 2) always come before where j < k - return this.orderByObservable.compose(new ItemToPageTransformer(tracker, - maxPageSize, - this.queryMetricMap, - ( - orderByRowResult) -> { - return this.getContinuationToken(orderByRowResult); - })); - } - - @Override - public Observable> executeAsync() { - return drainAsync(feedOptions.getMaxItemCount()); - } - - private String getContinuationToken( - OrderByRowResult orderByRowResult) { - // rid - String rid = orderByRowResult.getResourceId(); - - // CompositeContinuationToken - String backendContinuationToken = orderByRowResult.getSourceBackendContinuationToken(); - Range range = orderByRowResult.getSourcePartitionKeyRange().toRange(); - - boolean inclusive = true; - CompositeContinuationToken compositeContinuationToken = new CompositeContinuationToken(backendContinuationToken, - range); - - // OrderByItems - QueryItem[] orderByItems = new QueryItem[orderByRowResult.getOrderByItems().size()]; - orderByRowResult.getOrderByItems().toArray(orderByItems); - - return new OrderByContinuationToken(compositeContinuationToken, - orderByItems, - rid, - inclusive).toJson(); - } - - private final class FormattedFilterInfo { - private final String filterForRangesLeftOfTheTargetRange; - private final String filterForTargetRange; - private final String filterForRangesRightOfTheTargetRange; - - public FormattedFilterInfo( - String filterForRangesLeftOfTheTargetRange, - String filterForTargetRange, - String filterForRangesRightOfTheTargetRange) { - if (filterForRangesLeftOfTheTargetRange == null) { - throw new IllegalArgumentException("filterForRangesLeftOfTheTargetRange must not be null."); - } - - if (filterForTargetRange == null) { - throw new IllegalArgumentException("filterForTargetRange must not be null."); - } - - if (filterForRangesRightOfTheTargetRange == null) { - throw new IllegalArgumentException("filterForRangesRightOfTheTargetRange must not be null."); - } - - this.filterForRangesLeftOfTheTargetRange = filterForRangesLeftOfTheTargetRange; - this.filterForTargetRange = filterForTargetRange; - this.filterForRangesRightOfTheTargetRange = filterForRangesRightOfTheTargetRange; - } - - /** - * @return the filterForRangesLeftOfTheTargetRange - */ - public String getFilterForRangesLeftOfTheTargetRange() { - return filterForRangesLeftOfTheTargetRange; - } - - /** - * @return the filterForTargetRange - */ - public String getFilterForTargetRange() { - return filterForTargetRange; - } - - /** - * @return the filterForRangesRightOfTheTargetRange - */ - public String getFilterForRangesRightOfTheTargetRange() { - return filterForRangesRightOfTheTargetRange; - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/OrderByUtils.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/OrderByUtils.java deleted file mode 100644 index e7eb77377b7f..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/OrderByUtils.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.github.davidmoten.rx.Transformers; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.internal.ResourceId; -import com.microsoft.azure.cosmosdb.internal.query.ItemComparator; -import com.microsoft.azure.cosmosdb.internal.query.QueryItem; -import com.microsoft.azure.cosmosdb.internal.query.SortOrder; -import com.microsoft.azure.cosmosdb.internal.query.orderbyquery.OrderByRowResult; -import com.microsoft.azure.cosmosdb.internal.query.orderbyquery.OrderbyRowComparer; -import com.microsoft.azure.cosmosdb.QueryMetrics; - -import com.microsoft.azure.cosmosdb.rx.internal.BadRequestException; -import org.apache.commons.lang3.tuple.Pair; -import rx.Observable; -import rx.Observable.Transformer; - -class OrderByUtils { - - public static Observable> orderedMerge(Class klass, - OrderbyRowComparer consumeComparer, - RequestChargeTracker tracker, - List> documentProducers, - Map queryMetricsMap, - Map targetRangeToOrderByContinuationTokenMap) { - return toOrderByQueryResultObservable(klass, documentProducers.get(0), tracker, queryMetricsMap, targetRangeToOrderByContinuationTokenMap, consumeComparer.getSortOrders()) - .compose( - Transformers.orderedMergeWith( - documentProducers.subList(1, documentProducers.size()) - .stream() - .map(producer -> toOrderByQueryResultObservable(klass, producer, tracker, queryMetricsMap, targetRangeToOrderByContinuationTokenMap, consumeComparer.getSortOrders())) - .collect(Collectors.toList()), consumeComparer, false, 1)); - } - - private static Observable> toOrderByQueryResultObservable(Class klass, - DocumentProducer producer, - RequestChargeTracker tracker, - Map queryMetricsMap, - Map targetRangeToOrderByContinuationTokenMap, - List sortOrders) { - return producer - .produceAsync() - .compose(new OrderByUtils.PageToItemTransformer(klass, tracker, queryMetricsMap, targetRangeToOrderByContinuationTokenMap, sortOrders)); - } - - private static class PageToItemTransformer implements Transformer.DocumentProducerFeedResponse, OrderByRowResult> { - private final RequestChargeTracker tracker; - private final Class klass; - private final Map queryMetricsMap; - private final Map targetRangeToOrderByContinuationTokenMap; - private final List sortOrders; - - public PageToItemTransformer(Class klass, RequestChargeTracker tracker, Map queryMetricsMap, - Map targetRangeToOrderByContinuationTokenMap, List sortOrders) { - this.klass = klass; - this.tracker = tracker; - this.queryMetricsMap = queryMetricsMap; - this.targetRangeToOrderByContinuationTokenMap = targetRangeToOrderByContinuationTokenMap; - this.sortOrders = sortOrders; - } - - @Override - public Observable> call(Observable.DocumentProducerFeedResponse> source) { - return source.flatMap(documentProducerFeedResponse -> { - for (String key : documentProducerFeedResponse.pageResult.getQueryMetrics().keySet()) { - if (queryMetricsMap.containsKey(key)) { - QueryMetrics qm = documentProducerFeedResponse.pageResult.getQueryMetrics().get(key); - queryMetricsMap.get(key).add(qm); - } else { - queryMetricsMap.put(key, documentProducerFeedResponse.pageResult.getQueryMetrics().get(key)); - } - } - List results = documentProducerFeedResponse.pageResult.getResults(); - OrderByContinuationToken orderByContinuationToken = targetRangeToOrderByContinuationTokenMap.get(documentProducerFeedResponse.sourcePartitionKeyRange.getId()); - if (orderByContinuationToken != null) { - Pair booleanResourceIdPair = ResourceId.tryParse(orderByContinuationToken.getRid()); - if (!booleanResourceIdPair.getLeft()) { - return Observable.error(new BadRequestException(String.format("Invalid Rid in the continuation token %s for OrderBy~Context.", - orderByContinuationToken.getCompositeContinuationToken().getToken()))); - } - ResourceId continuationTokenRid = booleanResourceIdPair.getRight(); - results = results.stream() - .filter(tOrderByRowResult -> { - // When we resume a query on a partition there is a possibility that we only read a partial page from the backend - // meaning that will we repeat some documents if we didn't do anything about it. - // The solution is to filter all the documents that come before in the sort order, since we have already emitted them to the client. - // The key is to seek until we get an order by value that matches the order by value we left off on. - // Once we do that we need to seek to the correct _rid within the term, - // since there might be many documents with the same order by value we left off on. - List queryItems = new ArrayList(); - ArrayNode arrayNode = (ArrayNode) tOrderByRowResult.get("orderByItems"); - for (JsonNode jsonNode : arrayNode) { - QueryItem queryItem = new QueryItem(jsonNode.toString()); - queryItems.add(queryItem); - } - - // Check if its the same orderby item from the token - long cmp = 0; - for (int i = 0; i < sortOrders.size(); i++) { - cmp = ItemComparator.getInstance().compare(orderByContinuationToken.getOrderByItems()[i].getItem(), - queryItems.get(i).getItem()); - if (cmp != 0) { - cmp = sortOrders.get(i).equals(SortOrder.Descending) ? -cmp : cmp; - break; - } - } - - if (cmp == 0) { - // Once the item matches the order by items from the continuation tokens - // We still need to remove all the documents that have a lower rid in the rid sort order. - // If there is a tie in the sort order the documents should be in _rid order in the same direction as the first order by field. - // So if it's ORDER BY c.age ASC, c.name DESC the _rids are ASC - // If ti's ORDER BY c.age DESC, c.name DESC the _rids are DESC - cmp = (continuationTokenRid.getDocument() - ResourceId.tryParse(tOrderByRowResult.getResourceId()).getRight().getDocument()); - - if (sortOrders.iterator().next().equals(SortOrder.Descending)) { - cmp = -cmp; - } - return (cmp <= 0); - } - return true; - - }) - .collect(Collectors.toList()); - - } - - tracker.addCharge(documentProducerFeedResponse.pageResult.getRequestCharge()); - Observable x = Observable.from(results); - - return x.map(r -> new OrderByRowResult( - klass, - r.toJson(), - documentProducerFeedResponse.sourcePartitionKeyRange, - documentProducerFeedResponse.pageResult.getResponseContinuation())); - }, 1); - } - } - -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/Paginator.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/Paginator.java deleted file mode 100644 index 45ec5692e769..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/Paginator.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import com.microsoft.azure.cosmosdb.ChangeFeedOptions; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedOptionsBase; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Observable; -import rx.Observer; -import rx.functions.Func1; -import rx.functions.Func2; -import rx.observables.AsyncOnSubscribe; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class Paginator { - - private final static Logger logger = LoggerFactory.getLogger(Paginator.class); - - public static Observable> getPaginatedChangeFeedQueryResultAsObservable( - ChangeFeedOptions feedOptions, Func2 createRequestFunc, - Func1>> executeFunc, Class resourceType, - int maxPageSize) { - return getPaginatedQueryResultAsObservable(feedOptions, createRequestFunc, executeFunc, resourceType, - -1, maxPageSize, true); - } - - public static Observable> getPaginatedQueryResultAsObservable( - FeedOptions feedOptions, - Func2 createRequestFunc, - Func1>> executeFunc, Class resourceType, - int maxPageSize) { - return getPaginatedQueryResultAsObservable(feedOptions, createRequestFunc, executeFunc, resourceType, - -1, maxPageSize); - } - - public static Observable> getPaginatedQueryResultAsObservable( - FeedOptions options, - Func2 createRequestFunc, - Func1>> executeFunc, Class resourceType, - int top, int maxPageSize) { - return getPaginatedQueryResultAsObservable(options, createRequestFunc, executeFunc, resourceType, - top, maxPageSize, false); - } - - private static Observable> getPaginatedQueryResultAsObservable( - FeedOptionsBase options, - Func2 createRequestFunc, - Func1>> executeFunc, Class resourceType, - int top, int maxPageSize, boolean isChangeFeed) { - - Observable> obs = Observable.defer(() -> { - return Observable.create(new AsyncOnSubscribe>() { - @Override - protected Fetcher generateState() { - return new Fetcher(createRequestFunc, executeFunc, options, isChangeFeed, top, maxPageSize); - } - - @Override - protected Fetcher next(Fetcher fetcher, long requested, Observer>> observer) { - assert requested == 1 : "requested amount expected to be 1"; // as there is a rebatchRequests(1) - - if (fetcher.shouldFetchMore()) { - Observable> respObs = fetcher.nextPage(); - observer.onNext(respObs); - } else { - logger.debug("No more results"); - observer.onCompleted(); - } - - return fetcher; - } - }).rebatchRequests(1); - }); - - return obs; - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/ParallelDocumentQueryExecutionContext.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/ParallelDocumentQueryExecutionContext.java deleted file mode 100644 index f7fe88c34454..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/ParallelDocumentQueryExecutionContext.java +++ /dev/null @@ -1,369 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.apache.commons.lang3.tuple.ImmutablePair; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.RequestChargeTracker; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.query.PartitionedQueryExecutionInfo; -import com.microsoft.azure.cosmosdb.rx.internal.IDocumentClientRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; - -import rx.Observable; -import rx.Observable.Transformer; -import rx.functions.Func0; -import rx.functions.Func1; -import rx.functions.Func3; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class ParallelDocumentQueryExecutionContext - extends ParallelDocumentQueryExecutionContextBase { - - private ParallelDocumentQueryExecutionContext( - IDocumentQueryClient client, - List partitionKeyRanges, - ResourceType resourceTypeEnum, - Class resourceType, - SqlQuerySpec query, - FeedOptions feedOptions, - String resourceLink, - String rewrittenQuery, - String collectionRid, - boolean isContinuationExpected, - boolean getLazyFeedResponse, - UUID correlatedActivityId) { - super(client, partitionKeyRanges, resourceTypeEnum, resourceType, query, feedOptions, resourceLink, - rewrittenQuery, isContinuationExpected, getLazyFeedResponse, correlatedActivityId); - } - - public static Observable> createAsync( - IDocumentQueryClient client, - ResourceType resourceTypeEnum, - Class resourceType, - SqlQuerySpec query, - FeedOptions feedOptions, - String resourceLink, - String collectionRid, - PartitionedQueryExecutionInfo partitionedQueryExecutionInfo, - List targetRanges, - int initialPageSize, - boolean isContinuationExpected, - boolean getLazyFeedResponse, - UUID correlatedActivityId) { - - ParallelDocumentQueryExecutionContext context = new ParallelDocumentQueryExecutionContext(client, - targetRanges, - resourceTypeEnum, - resourceType, - query, - feedOptions, - resourceLink, - partitionedQueryExecutionInfo.getQueryInfo().getRewrittenQuery(), - collectionRid, - isContinuationExpected, - getLazyFeedResponse, - correlatedActivityId); - - try { - context.initialize(collectionRid, - targetRanges, - initialPageSize, - feedOptions.getRequestContinuation()); - return Observable.just(context); - } catch (DocumentClientException dce) { - return Observable.error(dce); - } - } - - private void initialize( - String collectionRid, - List targetRanges, - int initialPageSize, - String continuationToken) throws DocumentClientException { - // Generate the corresponding continuation token map. - Map partitionKeyRangeToContinuationTokenMap = new HashMap(); - if (continuationToken == null) { - // If the user does not give a continuation token, - // then just start the query from the first partition. - for (PartitionKeyRange targetRange : targetRanges) { - partitionKeyRangeToContinuationTokenMap.put(targetRange, - null); - } - } else { - // Figure out which partitions to resume from: - - // If a continuation token is given then we need to figure out partition key - // range it maps to - // in order to filter the partition key ranges. - // For example if suppliedCompositeContinuationToken.Range.Min == - // partition3.Range.Min, - // then we know that partitions 0, 1, 2 are fully drained. - - // Check to see if composite continuation token is a valid JSON. - ValueHolder outCompositeContinuationToken = new ValueHolder(); - if (!CompositeContinuationToken.tryParse(continuationToken, - outCompositeContinuationToken)) { - String message = String.format("Invalid JSON in continuation token %s for Parallel~Context", - continuationToken); - throw new DocumentClientException(HttpConstants.StatusCodes.BADREQUEST, - message); - } - - CompositeContinuationToken compositeContinuationToken = outCompositeContinuationToken.v; - - // Get the right hand side of the query ranges: - List filteredPartitionKeyRanges = this.getPartitionKeyRangesForContinuation( - compositeContinuationToken, - targetRanges); - - // The first partition is the one we left off on and have a backend continuation - // token for. - partitionKeyRangeToContinuationTokenMap.put(filteredPartitionKeyRanges.get(0), - compositeContinuationToken.getToken()); - - // The remaining partitions we have yet to touch / have null continuation tokens - for (int i = 1; i < filteredPartitionKeyRanges.size(); i++) { - partitionKeyRangeToContinuationTokenMap.put(filteredPartitionKeyRanges.get(i), - null); - } - } - - super.initialize(collectionRid, - partitionKeyRangeToContinuationTokenMap, - initialPageSize, - this.querySpec); - } - - private List getPartitionKeyRangesForContinuation( - CompositeContinuationToken compositeContinuationToken, - List partitionKeyRanges) throws DocumentClientException { - // Find the partition key range we left off on - int startIndex = this.FindTargetRangeAndExtractContinuationTokens(partitionKeyRanges, - compositeContinuationToken.getRange()); - - List rightHandSideRanges = new ArrayList(); - for (int i = startIndex; i < partitionKeyRanges.size(); i++) { - rightHandSideRanges.add(partitionKeyRanges.get(i)); - } - - return rightHandSideRanges; - } - - private static class EmptyPagesFilterTransformer - implements Transformer.DocumentProducerFeedResponse, FeedResponse> { - private final RequestChargeTracker tracker; - private DocumentProducer.DocumentProducerFeedResponse previousPage; - - public EmptyPagesFilterTransformer( - RequestChargeTracker tracker) { - - if (tracker == null) { - throw new IllegalArgumentException("Request Charge Tracker must not be null."); - } - - this.tracker = tracker; - this.previousPage = null; - } - - private DocumentProducer.DocumentProducerFeedResponse plusCharge( - DocumentProducer.DocumentProducerFeedResponse documentProducerFeedResponse, - double charge) { - FeedResponse page = documentProducerFeedResponse.pageResult; - Map headers = new HashMap<>(page.getResponseHeaders()); - double pageCharge = page.getRequestCharge(); - pageCharge += charge; - headers.put(HttpConstants.HttpHeaders.REQUEST_CHARGE, - String.valueOf(pageCharge)); - FeedResponse newPage = BridgeInternal.createFeedResponseWithQueryMetrics(page.getResults(), - headers, - page.getQueryMetrics()); - documentProducerFeedResponse.pageResult = newPage; - return documentProducerFeedResponse; - } - - private DocumentProducer.DocumentProducerFeedResponse addCompositeContinuationToken( - DocumentProducer.DocumentProducerFeedResponse documentProducerFeedResponse, - String compositeContinuationToken) { - FeedResponse page = documentProducerFeedResponse.pageResult; - Map headers = new HashMap<>(page.getResponseHeaders()); - headers.put(HttpConstants.HttpHeaders.CONTINUATION, - compositeContinuationToken); - FeedResponse newPage = BridgeInternal.createFeedResponseWithQueryMetrics(page.getResults(), - headers, - page.getQueryMetrics()); - documentProducerFeedResponse.pageResult = newPage; - return documentProducerFeedResponse; - } - - private static Map headerResponse( - double requestCharge) { - return Utils.immutableMapOf(HttpConstants.HttpHeaders.REQUEST_CHARGE, - String.valueOf(requestCharge)); - } - - @Override - public Observable> call( - Observable.DocumentProducerFeedResponse> source) { - return source.filter(documentProducerFeedResponse -> { - if (documentProducerFeedResponse.pageResult.getResults().isEmpty()) { - // filter empty pages and accumulate charge - tracker.addCharge(documentProducerFeedResponse.pageResult.getRequestCharge()); - return false; - } - return true; - }).map(documentProducerFeedResponse -> { - // Add the request charge - double charge = tracker.getAndResetCharge(); - if (charge > 0) { - return plusCharge(documentProducerFeedResponse, - charge); - } else { - return documentProducerFeedResponse; - } - }).concatWith(Observable.defer(() -> { - // Emit an empty page so the downstream observables know when there are no more - // results. - return Observable.just(null); - })).map(documentProducerFeedResponse -> { - // Create pairs from the stream to allow the observables downstream to "peek" - // 1, 2, 3, null -> (null, 1), (1, 2), (2, 3), (3, null) - ImmutablePair.DocumentProducerFeedResponse, DocumentProducer.DocumentProducerFeedResponse> previousCurrent = new ImmutablePair.DocumentProducerFeedResponse, DocumentProducer.DocumentProducerFeedResponse>( - this.previousPage, - documentProducerFeedResponse); - this.previousPage = documentProducerFeedResponse; - return previousCurrent; - }).skip(1).map(currentNext -> { - // remove the (null, 1) - // Add the continuation token based on the current and next page. - DocumentProducer.DocumentProducerFeedResponse current = currentNext.left; - DocumentProducer.DocumentProducerFeedResponse next = currentNext.right; - - String compositeContinuationToken; - String backendContinuationToken = current.pageResult.getResponseContinuation(); - if (backendContinuationToken == null) { - // We just finished reading the last document from a partition - if (next == null) { - // It was the last partition and we are done - compositeContinuationToken = null; - } else { - // It wasn't the last partition, so we need to give the next range, but with a - // null continuation - CompositeContinuationToken compositeContinuationTokenDom = new CompositeContinuationToken(null, - next.sourcePartitionKeyRange.toRange()); - compositeContinuationToken = compositeContinuationTokenDom.toJson(); - } - } else { - // We are in the middle of reading a partition, - // so give back this partition with a backend continuation token - CompositeContinuationToken compositeContinuationTokenDom = new CompositeContinuationToken( - backendContinuationToken, - current.sourcePartitionKeyRange.toRange()); - compositeContinuationToken = compositeContinuationTokenDom.toJson(); - } - - DocumentProducer.DocumentProducerFeedResponse page; - page = current; - page = this.addCompositeContinuationToken(page, - compositeContinuationToken); - - return page; - }).map(documentProducerFeedResponse -> { - // Unwrap the documentProducerFeedResponse and get back the feedResponse - return documentProducerFeedResponse.pageResult; - }).switchIfEmpty(Observable.defer(() -> { - // create an empty page if there is no result - return Observable.just(BridgeInternal.createFeedResponse(Utils.immutableListOf(), - headerResponse(tracker.getAndResetCharge()))); - })); - } - } - - @Override - public Observable> drainAsync( - int maxPageSize) { - List.DocumentProducerFeedResponse>> obs = this.documentProducers - // Get the stream. - .stream() - // Start from the left most partition first. - .sorted(( - dp1, - dp2) -> dp1.targetRange.getMinInclusive().compareTo(dp2.targetRange.getMinInclusive())) - // For each partition get it's stream of results. - .map(dp -> dp.produceAsync()) - // Merge results from all partitions. - .collect(Collectors.toList()); - return Observable.concat(obs).compose(new EmptyPagesFilterTransformer<>(new RequestChargeTracker())); - } - - @Override - public Observable> executeAsync() { - return this.drainAsync(feedOptions.getMaxItemCount()); - } - - protected DocumentProducer createDocumentProducer( - String collectionRid, - PartitionKeyRange targetRange, - String initialContinuationToken, - int initialPageSize, - FeedOptions feedOptions, - SqlQuerySpec querySpecForInit, - Map commonRequestHeaders, - Func3 createRequestFunc, - Func1>> executeFunc, - Func0 createRetryPolicyFunc) { - return new DocumentProducer(client, - collectionRid, - feedOptions, - createRequestFunc, - executeFunc, - targetRange, - collectionRid, - () -> client.getResetSessionTokenRetryPolicy().getRequestPolicy(), - resourceType, - correlatedActivityId, - initialPageSize, - initialContinuationToken, - top); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/ParallelDocumentQueryExecutionContextBase.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/ParallelDocumentQueryExecutionContextBase.java deleted file mode 100644 index 8ed4f7138b24..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/ParallelDocumentQueryExecutionContextBase.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.routing.Range; -import com.microsoft.azure.cosmosdb.rx.internal.IDocumentClientRetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Strings; - -import rx.Observable; -import rx.functions.Func0; -import rx.functions.Func1; -import rx.functions.Func3; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public abstract class ParallelDocumentQueryExecutionContextBase - extends DocumentQueryExecutionContextBase implements IDocumentQueryExecutionComponent { - - protected final List> documentProducers; - protected final List partitionKeyRanges; - protected final SqlQuerySpec querySpec; - protected int pageSize; - protected int top = -1; - - protected ParallelDocumentQueryExecutionContextBase(IDocumentQueryClient client, - List partitionKeyRanges, ResourceType resourceTypeEnum, Class resourceType, - SqlQuerySpec query, FeedOptions feedOptions, String resourceLink, String rewrittenQuery, - boolean isContinuationExpected, boolean getLazyFeedResponse, UUID correlatedActivityId) { - super(client, resourceTypeEnum, resourceType, query, feedOptions, resourceLink, getLazyFeedResponse, - correlatedActivityId); - - documentProducers = new ArrayList<>(); - - this.partitionKeyRanges = partitionKeyRanges; - - if (!Strings.isNullOrEmpty(rewrittenQuery)) { - this.querySpec = new SqlQuerySpec(rewrittenQuery, super.query.getParameters()); - } else { - this.querySpec = super.query; - } - } - - protected void initialize(String collectionRid, - Map partitionKeyRangeToContinuationTokenMap, int initialPageSize, - SqlQuerySpec querySpecForInit) { - this.pageSize = initialPageSize; - Map commonRequestHeaders = createCommonHeadersAsync(this.getFeedOptions(null, null)); - - for (PartitionKeyRange targetRange : partitionKeyRangeToContinuationTokenMap.keySet()) { - Func3 createRequestFunc = (partitionKeyRange, - continuationToken, pageSize) -> { - Map headers = new HashMap<>(commonRequestHeaders); - headers.put(HttpConstants.HttpHeaders.CONTINUATION, continuationToken); - headers.put(HttpConstants.HttpHeaders.PAGE_SIZE, Strings.toString(pageSize)); - return this.createDocumentServiceRequest(headers, querySpecForInit, partitionKeyRange, collectionRid); - }; - - Func1>> executeFunc = (request) -> { - return this.executeRequestAsync(request).toObservable(); - }; - - DocumentProducer dp = createDocumentProducer(collectionRid, targetRange, - partitionKeyRangeToContinuationTokenMap.get(targetRange), initialPageSize, feedOptions, - querySpecForInit, commonRequestHeaders, createRequestFunc, executeFunc, - () -> client.getResetSessionTokenRetryPolicy().getRequestPolicy()); - - documentProducers.add(dp); - } - } - - protected int FindTargetRangeAndExtractContinuationTokens( - List partitionKeyRanges, Range range) throws DocumentClientException { - if (partitionKeyRanges == null) { - throw new IllegalArgumentException("partitionKeyRanges can not be null."); - } - - if (partitionKeyRanges.size() < 1) { - throw new IllegalArgumentException("partitionKeyRanges must have atleast one element."); - } - - for (PartitionKeyRange partitionKeyRange : partitionKeyRanges) { - if (partitionKeyRange == null) { - throw new IllegalArgumentException("partitionKeyRanges can not have null elements."); - } - } - - // Find the minimum index. - PartitionKeyRange needle = new PartitionKeyRange(/* id */ null, range.getMin(), range.getMax()); - int minIndex; - for (minIndex = 0; minIndex < partitionKeyRanges.size(); minIndex++) { - if (needle.getMinInclusive().equals(partitionKeyRanges.get(minIndex).getMinInclusive())) { - break; - } - } - - if (minIndex == partitionKeyRanges.size()) { - throw new DocumentClientException(HttpConstants.StatusCodes.BADREQUEST, - String.format("Could not find partition key range for continuation token: {0}", needle)); - } - - return minIndex; - } - - abstract protected DocumentProducer createDocumentProducer(String collectionRid, PartitionKeyRange targetRange, - String initialContinuationToken, int initialPageSize, FeedOptions feedOptions, SqlQuerySpec querySpecForInit, - Map commonRequestHeaders, - Func3 createRequestFunc, - Func1>> executeFunc, - Func0 createRetryPolicyFunc); - - @Override - abstract public Observable> drainAsync(int maxPageSize); - - public void setTop(int newTop) { - this.top = newTop; - - for (DocumentProducer producer : this.documentProducers) { - producer.top = newTop; - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/ParallelQueryConfig.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/ParallelQueryConfig.java deleted file mode 100644 index 608c8c22c7a9..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/ParallelQueryConfig.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class ParallelQueryConfig { - - public static final int ClientInternalPageSize = 100; - -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/PipelinedDocumentQueryExecutionContext.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/PipelinedDocumentQueryExecutionContext.java deleted file mode 100644 index ef0a0d3a88e5..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/PipelinedDocumentQueryExecutionContext.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.util.List; -import java.util.UUID; -import java.util.function.Function; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.query.PartitionedQueryExecutionInfo; -import com.microsoft.azure.cosmosdb.internal.query.QueryInfo; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -import rx.Observable; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class PipelinedDocumentQueryExecutionContext implements IDocumentQueryExecutionContext { - - private IDocumentQueryExecutionComponent component; - private int actualPageSize; - private UUID correlatedActivityId; - - private PipelinedDocumentQueryExecutionContext(IDocumentQueryExecutionComponent component, int actualPageSize, - UUID correlatedActivityId) { - this.component = component; - this.actualPageSize = actualPageSize; - this.correlatedActivityId = correlatedActivityId; - - // this.executeNextSchedulingMetrics = new SchedulingStopwatch(); - // this.executeNextSchedulingMetrics.Ready(); - - // DefaultTrace.TraceVerbose(string.Format( - // CultureInfo.InvariantCulture, - // "{0} Pipelined~Context, actual page size: {1}", - // DateTime.UtcNow.ToString("o", CultureInfo.InvariantCulture), - // this.actualPageSize)); - } - - public static Observable> createAsync( - IDocumentQueryClient client, ResourceType resourceTypeEnum, Class resourceType, SqlQuerySpec expression, - FeedOptions feedOptions, String resourceLink, String collectionRid, - PartitionedQueryExecutionInfo partitionedQueryExecutionInfo, List targetRanges, - int initialPageSize, boolean isContinuationExpected, boolean getLazyFeedResponse, - UUID correlatedActivityId) { - // Use nested callback pattern to unwrap the continuation token at each level. - Function>> createBaseComponentFunction; - - QueryInfo queryInfo = partitionedQueryExecutionInfo.getQueryInfo(); - - if (queryInfo.hasOrderBy()) { - createBaseComponentFunction = (continuationToken) -> { - FeedOptions orderByFeedOptions = new FeedOptions(feedOptions); - orderByFeedOptions.setRequestContinuation(continuationToken); - return OrderByDocumentQueryExecutionContext.createAsync(client, resourceTypeEnum, resourceType, - expression, orderByFeedOptions, resourceLink, collectionRid, partitionedQueryExecutionInfo, - targetRanges, initialPageSize, isContinuationExpected, getLazyFeedResponse, - correlatedActivityId); - }; - } else { - createBaseComponentFunction = (continuationToken) -> { - FeedOptions parallelFeedOptions = new FeedOptions(feedOptions); - parallelFeedOptions.setRequestContinuation(continuationToken); - return ParallelDocumentQueryExecutionContext.createAsync(client, resourceTypeEnum, resourceType, - expression, parallelFeedOptions, resourceLink, collectionRid, partitionedQueryExecutionInfo, - targetRanges, initialPageSize, isContinuationExpected, getLazyFeedResponse, - correlatedActivityId); - }; - } - - Function>> createAggregateComponentFunction; - if (queryInfo.hasAggregates()) { - createAggregateComponentFunction = (continuationToken) -> { - return AggregateDocumentQueryExecutionContext.createAsync(createBaseComponentFunction, - queryInfo.getAggregates(), continuationToken); - }; - } else { - createAggregateComponentFunction = createBaseComponentFunction; - } - - Function>> createTopComponentFunction; - if (queryInfo.hasTop()) { - createTopComponentFunction = (continuationToken) -> { - return TopDocumentQueryExecutionContext.createAsync(createAggregateComponentFunction, - queryInfo.getTop(), continuationToken); - }; - } else { - createTopComponentFunction = createAggregateComponentFunction; - } - - int actualPageSize = Utils.getValueOrDefault(feedOptions.getMaxItemCount(), - ParallelQueryConfig.ClientInternalPageSize); - - if (actualPageSize == -1) { - actualPageSize = Integer.MAX_VALUE; - } - - int pageSize = Math.min(actualPageSize, Utils.getValueOrDefault(queryInfo.getTop(), (actualPageSize))); - return createTopComponentFunction.apply(feedOptions.getRequestContinuation()) - .map(c -> new PipelinedDocumentQueryExecutionContext<>(c, pageSize, correlatedActivityId)); - } - - @Override - public Observable> executeAsync() { - // TODO Auto-generated method stub - - // TODO add more code here - return this.component.drainAsync(actualPageSize); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/ProxyDocumentQueryExecutionContext.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/ProxyDocumentQueryExecutionContext.java deleted file mode 100644 index 607b84152147..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/ProxyDocumentQueryExecutionContext.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.lang.invoke.MethodHandles; -import java.util.List; -import java.util.UUID; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.query.PartitionedQueryExecutionInfo; -import com.microsoft.azure.cosmosdb.rx.internal.Exceptions; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -import rx.Observable; -import rx.Single; -import rx.functions.Func1; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - * - * This class is used as a proxy to wrap the - * DefaultDocumentQueryExecutionContext which is needed for sending the query to - * Gateway first and then uses PipelinedDocumentQueryExecutionContext after it - * gets the necessary info. - */ -public class ProxyDocumentQueryExecutionContext implements IDocumentQueryExecutionContext { - - private IDocumentQueryExecutionContext innerExecutionContext; - private IDocumentQueryClient client; - private ResourceType resourceTypeEnum; - private Class resourceType; - private FeedOptions feedOptions; - private SqlQuerySpec query; - private String resourceLink; - private DocumentCollection collection; - private UUID correlatedActivityId; - private boolean isContinuationExpected; - private final static Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - - public ProxyDocumentQueryExecutionContext( - IDocumentQueryExecutionContext innerExecutionContext, - IDocumentQueryClient client, - ResourceType resourceTypeEnum, - Class resourceType, - SqlQuerySpec query, - FeedOptions feedOptions, - String resourceLink, - DocumentCollection collection, - boolean isContinuationExpected, - UUID correlatedActivityId) { - this.innerExecutionContext = innerExecutionContext; - - this.client = client; - this.resourceTypeEnum = resourceTypeEnum; - this.resourceType = resourceType; - this.query = query; - this.feedOptions = feedOptions; - this.resourceLink = resourceLink; - - this.collection = collection; - this.isContinuationExpected = isContinuationExpected; - this.correlatedActivityId = correlatedActivityId; - } - - @Override - public Observable> executeAsync() { - - Func1>> func = t -> { - - logger.debug("Received non result message from gateway", t); - if (!(t instanceof Exception)) { - logger.error("Unexpected failure", t); - return Observable.error(t); - } - - if (!isCrossPartitionQuery((Exception) t)) { - // If this is not a cross partition query then propagate error - logger.debug("Failure from gateway", t); - return Observable.error(t); - } - - logger.debug("Setting up query pipeline using the query plan received form gateway"); - - // cross partition query construct pipeline - - DocumentClientException dce = (DocumentClientException) t; - - PartitionedQueryExecutionInfo partitionedQueryExecutionInfo = new - PartitionedQueryExecutionInfo(dce.getError().getPartitionedQueryExecutionInfo()); - - logger.debug("Query Plan from gateway {}", partitionedQueryExecutionInfo); - - DefaultDocumentQueryExecutionContext queryExecutionContext = - (DefaultDocumentQueryExecutionContext) this.innerExecutionContext; - - Single> partitionKeyRanges = queryExecutionContext.getTargetPartitionKeyRanges(collection.getResourceId(), - partitionedQueryExecutionInfo.getQueryRanges()); - - Observable> exContext = partitionKeyRanges.toObservable() - .flatMap(pkranges -> { - return DocumentQueryExecutionContextFactory.createSpecializedDocumentQueryExecutionContextAsync( - this.client, - this.resourceTypeEnum, - this.resourceType, - this.query, - this.feedOptions, - this.resourceLink, - isContinuationExpected, - partitionedQueryExecutionInfo, - pkranges, - this.collection.getResourceId(), - this.correlatedActivityId); - }); - - return exContext.flatMap(context -> context.executeAsync()); - }; - - return this.innerExecutionContext.executeAsync().onErrorResumeNext(func); - } - - private boolean isCrossPartitionQuery(Exception exception) { - - DocumentClientException clientException = Utils.as(exception, DocumentClientException.class); - - if (clientException == null) { - return false; - } - - return (Exceptions.isStatusCode(clientException, HttpConstants.StatusCodes.BADREQUEST) && - Exceptions.isSubStatusCode(clientException, HttpConstants.SubStatusCodes.CROSS_PARTITION_QUERY_NOT_SERVABLE)); - } - - public static Observable> createAsync(IDocumentQueryClient client, - ResourceType resourceTypeEnum, Class resourceType, SqlQuerySpec query, FeedOptions feedOptions, - String resourceLink, DocumentCollection collection, boolean isContinuationExpected, - UUID correlatedActivityId) { - - IDocumentQueryExecutionContext innerExecutionContext = - new DefaultDocumentQueryExecutionContext( - client, - resourceTypeEnum, - resourceType, - query, - feedOptions, - resourceLink, - correlatedActivityId, - isContinuationExpected); - - return Observable.just(new ProxyDocumentQueryExecutionContext(innerExecutionContext, client, - resourceTypeEnum, - resourceType, - query, - feedOptions, - resourceLink, - collection, - isContinuationExpected, - correlatedActivityId)); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/TakeContinuationToken.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/TakeContinuationToken.java deleted file mode 100644 index e8a60c2967cd..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/TakeContinuationToken.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import com.microsoft.azure.cosmosdb.JsonSerializable; -import com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public final class TakeContinuationToken extends JsonSerializable { - private static final String LimitPropertyName = "limit"; - private static final String SourceTokenPropetryName = "sourceToken"; - private static final Logger logger = LoggerFactory.getLogger(TakeContinuationToken.class); - - public TakeContinuationToken(int takeCount, String sourceToken) { - if (takeCount < 0) { - throw new IllegalArgumentException("takeCount must be a non negative number."); - } - - // sourceToken is allowed to be null. - this.setTakeCount(takeCount); - this.setSourceToken(sourceToken); - } - - private TakeContinuationToken(String serializedTakeContinuationToken) { - super(serializedTakeContinuationToken); - } - - public static boolean tryParse(String serializedTakeContinuationToken, - ValueHolder outTakeContinuationToken) { - boolean parsed; - try { - TakeContinuationToken takeContinuationToken = new TakeContinuationToken(serializedTakeContinuationToken); - takeContinuationToken.getSourceToken(); - takeContinuationToken.getTakeCount(); - outTakeContinuationToken.v = takeContinuationToken; - parsed = true; - } catch (Exception ex) { - logger.debug( - "Received exception {} when trying to parse: {}", - ex.getMessage(), - serializedTakeContinuationToken); - parsed = false; - outTakeContinuationToken.v = null; - } - - return parsed; - } - - public int getTakeCount() { - return super.getInt(LimitPropertyName); - } - - public String getSourceToken() { - return super.getString(SourceTokenPropetryName); - } - - private void setTakeCount(int takeCount) { - super.set(LimitPropertyName, takeCount); - } - - private void setSourceToken(String sourceToken) { - super.set(SourceTokenPropetryName, sourceToken); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/TopDocumentQueryExecutionContext.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/TopDocumentQueryExecutionContext.java deleted file mode 100644 index afa80ca43d3c..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/query/TopDocumentQueryExecutionContext.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.Function; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; - -import rx.Observable; -import rx.functions.Func1; - -public class TopDocumentQueryExecutionContext implements IDocumentQueryExecutionComponent { - - private final IDocumentQueryExecutionComponent component; - private final int top; - - public TopDocumentQueryExecutionContext(IDocumentQueryExecutionComponent component, int top) { - this.component = component; - this.top = top; - } - - public static Observable> createAsync( - Function>> createSourceComponentFunction, - int topCount, String topContinuationToken) { - TakeContinuationToken takeContinuationToken; - - if (topContinuationToken == null) { - takeContinuationToken = new TakeContinuationToken(topCount, null); - } else { - ValueHolder outTakeContinuationToken = new ValueHolder(); - if (!TakeContinuationToken.tryParse(topContinuationToken, outTakeContinuationToken)) { - String message = String.format("Invalid JSON in continuation token %s for Top~Context", - topContinuationToken); - DocumentClientException dce = new DocumentClientException(HttpConstants.StatusCodes.BADREQUEST, - message); - return Observable.error(dce); - } - - takeContinuationToken = outTakeContinuationToken.v; - } - - if (takeContinuationToken.getTakeCount() > topCount) { - String message = String.format( - "top count in continuation token: %d can not be greater than the top count in the query: %d.", - takeContinuationToken.getTakeCount(), topCount); - DocumentClientException dce = new DocumentClientException(HttpConstants.StatusCodes.BADREQUEST, message); - return Observable.error(dce); - } - - return createSourceComponentFunction.apply(takeContinuationToken.getSourceToken()).map(component -> { - return new TopDocumentQueryExecutionContext(component, takeContinuationToken.getTakeCount()); - }); - } - - @Override - public Observable> drainAsync(int maxPageSize) { - ParallelDocumentQueryExecutionContextBase context; - - if (this.component instanceof AggregateDocumentQueryExecutionContext) { - context = (ParallelDocumentQueryExecutionContextBase) ((AggregateDocumentQueryExecutionContext) this.component) - .getComponent(); - } else { - context = (ParallelDocumentQueryExecutionContextBase) this.component; - } - - context.setTop(this.top); - - return this.component.drainAsync(maxPageSize).takeUntil(new Func1, Boolean>() { - - private volatile int fetchedItems = 0; - - @Override - public Boolean call(FeedResponse frp) { - - fetchedItems += frp.getResults().size(); - - // take until we have at least top many elements fetched - return fetchedItems >= top; - } - }).map(new Func1, FeedResponse>() { - - private volatile int collectedItems = 0; - private volatile boolean lastPage = false; - - @Override - public FeedResponse call(FeedResponse t) { - - if (collectedItems + t.getResults().size() <= top) { - collectedItems += t.getResults().size(); - - Map headers = new HashMap<>(t.getResponseHeaders()); - if (top != collectedItems) { - // Add Take Continuation Token - String sourceContinuationToken = t.getResponseContinuation(); - TakeContinuationToken takeContinuationToken = new TakeContinuationToken(top - collectedItems, - sourceContinuationToken); - headers.put(HttpConstants.HttpHeaders.CONTINUATION, takeContinuationToken.toJson()); - } else { - // Null out the continuation token - headers.put(HttpConstants.HttpHeaders.CONTINUATION, null); - } - - return BridgeInternal.createFeedResponseWithQueryMetrics(t.getResults(), headers, - t.getQueryMetrics()); - } else { - assert lastPage == false; - lastPage = true; - int lastPageSize = top - collectedItems; - collectedItems += lastPageSize; - - // Null out the continuation token - Map headers = new HashMap<>(t.getResponseHeaders()); - headers.put(HttpConstants.HttpHeaders.CONTINUATION, null); - - return BridgeInternal.createFeedResponseWithQueryMetrics(t.getResults().subList(0, lastPageSize), - headers, t.getQueryMetrics()); - } - } - }); - } -} diff --git a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/routing/LocationHelper.java b/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/routing/LocationHelper.java deleted file mode 100644 index 9cc5fd08442f..000000000000 --- a/cosmosdb/data-plane/gateway/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/routing/LocationHelper.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal.routing; - -import org.apache.commons.lang3.StringUtils; - -import java.net.URL; - -public class LocationHelper { - /** - * For example, for https://contoso.documents.azure.com:443/ and "West US", this will return https://contoso-westus.documents.azure.com:443/ - * NOTE: This ONLY called by client first boot when the input endpoint is not available. - * - * @param serviceEndpoint - * @param location - * @return - */ - public static URL getLocationEndpoint(URL serviceEndpoint, String location) { - - // Split the host into 2 parts seperated by '.' - // For example, "contoso.documents.azure.com" is separated into "contoso" and "documents.azure.com" - // If the host doesn't contains '.', this will return the host as is, as the only element - String[] hostParts = StringUtils.split(serviceEndpoint.getHost(), ".", 2); - - String host; - if (hostParts.length != 0) { - // hostParts[0] will be the global account name - hostParts[0] = hostParts[0] + "-" + dataCenterToUriPostfix(location); - - // if hostParts has only one element, '.' is not included in the returned string - host = String.join(".", hostParts); - } else { - host = serviceEndpoint.getHost(); - } - - try { - return new URL(serviceEndpoint.getProtocol(), host, serviceEndpoint.getPort(), serviceEndpoint.getFile()); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - private static String dataCenterToUriPostfix(String dataCenter) { - return dataCenter.replace(" ", ""); - } -} - diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/GatewayTestUtils.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/GatewayTestUtils.java deleted file mode 100644 index 8292a4c0f399..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/GatewayTestUtils.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb; - -import java.util.List; - -public class GatewayTestUtils { - - public static PartitionKeyRange setParent(PartitionKeyRange pkr, List parents) { - pkr.setParents(parents); - return pkr; - } -} diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/LocationHelperTest.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/LocationHelperTest.java deleted file mode 100644 index 5bc606e29c25..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/LocationHelperTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.microsoft.azure.cosmosdb.internal; - -import com.microsoft.azure.cosmosdb.rx.internal.routing.LocationHelper; -import org.testng.annotations.Test; - -import java.net.URI; -import java.net.URL; - -import static org.assertj.core.api.Assertions.assertThat; - -public class LocationHelperTest { - @Test(groups = "unit") - public void getLocationEndpoint() throws Exception { - URL globalServiceEndpoint = URI.create("https://account-name.documents.azure.com:443").toURL(); - URL expectedRegionServiceEndpoint = URI.create("https://account-name-east-us.documents.azure.com:443").toURL(); - assertThat(LocationHelper.getLocationEndpoint(globalServiceEndpoint, "east-us")) - .isEqualTo(expectedRegionServiceEndpoint); - } -} diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/SessionContainerTest.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/SessionContainerTest.java deleted file mode 100644 index a66625dbf890..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/SessionContainerTest.java +++ /dev/null @@ -1,644 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.microsoft.azure.cosmosdb.GatewayTestUtils; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.rx.internal.DocumentServiceRequestContext; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.reflect.FieldUtils; -import org.mockito.Mockito; -import org.mockito.internal.util.collections.Sets; -import org.testng.annotations.Test; - -import java.util.HashMap; -import java.util.Map; -import java.util.Random; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Tests for {@link SessionContainer} - */ -public class SessionContainerTest { - - private final static Random random = new Random(); - - @Test(groups = "unit") - public void sessionContainer() throws Exception { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - - int numCollections = 2; - int numPartitionKeyRangeIds = 5; - - for (int i = 0; i < numCollections; i++) { - String collectionResourceId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId() + i).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls/collName_" + i; - - for (int j = 0; j < numPartitionKeyRangeIds; j++) { - - String partitionKeyRangeId = "range_" + j; - String lsn = "1#" + j + "#4=90#5=2"; - - sessionContainer.setSessionToken( - collectionResourceId, - collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":" + lsn)); - } - } - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.ReadFeed, ResourceType.DocumentCollection, - "dbs/db1/colls/collName_1", IOUtils.toInputStream("content1", "UTF-8"), new HashMap<>()); - - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_1"); - assertThat(sessionToken.getLSN()).isEqualTo(1); - - DocumentServiceRequestContext dsrContext = new DocumentServiceRequestContext(); - PartitionKeyRange resolvedPKRange = new PartitionKeyRange(); - resolvedPKRange.setId("range_" + (numPartitionKeyRangeIds + 10)); - GatewayTestUtils.setParent(resolvedPKRange, ImmutableList.of("range_2", "range_x")); - dsrContext.resolvedPartitionKeyRange = resolvedPKRange; - request.requestContext = dsrContext; - - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, resolvedPKRange.getId()); - assertThat(sessionToken.getLSN()).isEqualTo(2); - } - - @Test(groups = "unit") - public void setSessionToken_NoSessionTokenForPartitionKeyRangeId() throws Exception { - String collectionRid = "uf4PAK6T-Cw="; - long collectionRidAsLong = ResourceId.parse(collectionRid).getUniqueDocumentCollectionId(); - String partitionKeyRangeId = "test_range_id"; - String sessionToken = "1#100#1=20#2=5#3=30"; - String collectionName = "dbs/db1/colls/collName_1"; - - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - - RxDocumentServiceRequest request1 = RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Document, - collectionName + "/docs", IOUtils.toInputStream("content1", "UTF-8"), new HashMap<>()); - - Map respHeaders = new HashMap<>(); - RxDocumentServiceResponse resp = Mockito.mock(RxDocumentServiceResponse.class); - Mockito.doReturn(respHeaders).when(resp).getResponseHeaders(); - respHeaders.put(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":" + sessionToken); - respHeaders.put(HttpConstants.HttpHeaders.OWNER_FULL_NAME, collectionName); - respHeaders.put(HttpConstants.HttpHeaders.OWNER_ID, collectionRid); - sessionContainer.setSessionToken(request1, resp.getResponseHeaders()); - - ConcurrentHashMap collectionNameToCollectionResourceId = (ConcurrentHashMap) FieldUtils.readField(sessionContainer, "collectionNameToCollectionResourceId", true); - ConcurrentHashMap> collectionResourceIdToSessionTokens = (ConcurrentHashMap>) FieldUtils.readField(sessionContainer, "collectionResourceIdToSessionTokens", true); - assertThat(collectionNameToCollectionResourceId).hasSize(1); - assertThat(collectionResourceIdToSessionTokens).hasSize(1); - assertThat(collectionNameToCollectionResourceId.get(collectionName)).isEqualTo(collectionRidAsLong); - assertThat(collectionResourceIdToSessionTokens.get(collectionRidAsLong)).isNotNull(); - assertThat(collectionResourceIdToSessionTokens.get(collectionRidAsLong)).hasSize(1); - assertThat(collectionResourceIdToSessionTokens.get(collectionRidAsLong).get(partitionKeyRangeId).convertToString()).isEqualTo(sessionToken); - - RxDocumentServiceRequest request2 = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document, - collectionName + "/docs", IOUtils.toInputStream("", "UTF-8"), new HashMap<>()); - - ISessionToken resolvedSessionToken = sessionContainer.resolvePartitionLocalSessionToken(request2, partitionKeyRangeId); - assertThat(resolvedSessionToken.convertToString()).isEqualTo(sessionToken); - } - - @Test(groups = "unit") - public void setSessionToken_MergeOldWithNew() throws Exception { - String collectionRid = "uf4PAK6T-Cw="; - String collectionName = "dbs/db1/colls/collName_1"; - String initialSessionToken = "1#100#1=20#2=5#3=30"; - String newSessionTokenInServerResponse = "1#100#1=31#2=5#3=21"; - String partitionKeyRangeId = "test_range_id"; - String expectedMergedSessionToken = "1#100#1=31#2=5#3=30"; - - Map respHeaders = new HashMap<>(); - - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - - RxDocumentServiceRequest request1 = RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Document, - collectionName + "/docs", IOUtils.toInputStream("content1", "UTF-8"), new HashMap<>()); - - RxDocumentServiceResponse resp = Mockito.mock(RxDocumentServiceResponse.class); - Mockito.doReturn(respHeaders).when(resp).getResponseHeaders(); - respHeaders.put(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":" + initialSessionToken); - respHeaders.put(HttpConstants.HttpHeaders.OWNER_FULL_NAME, collectionName); - respHeaders.put(HttpConstants.HttpHeaders.OWNER_ID, collectionRid); - sessionContainer.setSessionToken(request1, resp.getResponseHeaders()); - - resp = Mockito.mock(RxDocumentServiceResponse.class); - Mockito.doReturn(respHeaders).when(resp).getResponseHeaders(); - respHeaders.put(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":" + newSessionTokenInServerResponse); - respHeaders.put(HttpConstants.HttpHeaders.OWNER_FULL_NAME, collectionName); - respHeaders.put(HttpConstants.HttpHeaders.OWNER_ID, collectionRid); - sessionContainer.setSessionToken(request1, resp.getResponseHeaders()); - - RxDocumentServiceRequest request2 = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document, - collectionName + "/docs", IOUtils.toInputStream("", "UTF-8"), new HashMap<>()); - - ISessionToken resolvedSessionToken = sessionContainer.resolvePartitionLocalSessionToken(request2, partitionKeyRangeId); - assertThat(resolvedSessionToken.convertToString()).isEqualTo(expectedMergedSessionToken); - } - - - @Test(groups = "unit") - public void resolveGlobalSessionTokenReturnsEmptyStringOnEmptyCache() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document, - "dbs/db1/colls/collName/docs/doc1", new HashMap<>()); - assertThat(StringUtils.EMPTY).isEqualTo(sessionContainer.resolveGlobalSessionToken(request)); - } - - @Test(groups = "unit") - public void resolveGlobalSessionTokenReturnsEmptyStringOnCacheMiss() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String partitionKeyRangeId = "range_0"; - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String initialSessionToken = "1#100#1=20#2=5#3=30"; - sessionContainer.setSessionToken(documentCollectionId, "dbs/db1/colls1/collName", - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, partitionKeyRangeId + ":" + initialSessionToken)); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Document, - "dbs/db1/colls1/collName2/docs/doc1", new HashMap<>()); - assertThat(StringUtils.EMPTY).isEqualTo(sessionContainer.resolveGlobalSessionToken(request)); - } - - @Test(groups = "unit") - public void resolveGlobalSessionTokenReturnsTokenMapUsingName() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#1=20#2=5#3=30")); - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_1:1#101#1=20#2=5#3=30")); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document); - String sessionToken = sessionContainer.resolveGlobalSessionToken(request); - Set tokens = Sets.newSet(sessionToken.split(",")); - - assertThat(tokens.size()).isEqualTo(2); - assertThat(tokens.contains("range_0:1#100#1=20#2=5#3=30")).isTrue(); - assertThat(tokens.contains("range_1:1#101#1=20#2=5#3=30")).isTrue(); - } - - @Test(groups = "unit") - public void resolveGlobalSessionTokenReturnsTokenMapUsingResourceId() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#1=20#2=5#3=30")); - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_1:1#101#1=20#2=5#3=30")); - String sessionToken = sessionContainer.resolveGlobalSessionToken(request); - - Set tokens = Sets.newSet(sessionToken.split(",")); - assertThat(tokens.size()).isEqualTo(2); - assertThat(tokens.contains("range_0:1#100#1=20#2=5#3=30")).isTrue(); - assertThat(tokens.contains("range_1:1#101#1=20#2=5#3=30")).isTrue(); - } - - - @Test(groups = "unit") - public void resolveLocalSessionTokenReturnsTokenMapUsingName() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#1=20#2=5#3=30")); - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_1:1#101#1=20#2=5#3=30")); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_1"); - assertThat(sessionToken.getLSN()).isEqualTo(101); - } - - @Test(groups = "unit") - public void resolveLocalSessionTokenReturnsTokenMapUsingResourceId() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#1=20#2=5#3=30")); - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_1:1#101#1=20#2=5#3=30")); - - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_1"); - assertThat(sessionToken.getLSN()).isEqualTo(101); - } - - @Test(groups = "unit") - public void resolveLocalSessionTokenReturnsNullOnPartitionMiss() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#1=20#2=5#3=30")); - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_1:1#101#1=20#2=5#3=30")); - request.requestContext.resolvedPartitionKeyRange = new PartitionKeyRange(); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_2"); - assertThat(sessionToken).isNull(); - } - - @Test(groups = "unit") - public void resolveLocalSessionTokenReturnsNullOnCollectionMiss() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - int randomCollectionId = getRandomCollectionId(); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), randomCollectionId).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceId.newDocumentCollectionId(getRandomDbId(), randomCollectionId - 1).getDocumentCollectionId().toString(), - ResourceType.Document, new HashMap<>()); - - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#1=20#2=5#3=30")); - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_1:1#101#1=20#2=5#3=30")); - request.requestContext.resolvedPartitionKeyRange = new PartitionKeyRange(); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_1"); - assertThat(sessionToken).isNull(); - } - - @Test(groups = "unit") - public void resolvePartitionLocalSessionTokenReturnsTokenOnParentMatch() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#1=20#2=5#3=30")); - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_1:1#101#1=20#2=5#3=30")); - request.requestContext.resolvedPartitionKeyRange = new PartitionKeyRange(); - GatewayTestUtils.setParent(request.requestContext.resolvedPartitionKeyRange, ImmutableList.of("range_1")); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_2"); - assertThat(sessionToken.getLSN()).isEqualTo(101); - } - - @Test(groups = "unit") - public void clearTokenByCollectionFullNameRemovesToken() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#1=20#2=5#3=30")); - - // Test resourceId based - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - - // Test names based - request = RxDocumentServiceRequest.createFromName(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - - sessionContainer.clearTokenByCollectionFullName(collectionFullName); - - // Test resourceId based - request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken).isNull(); - - // Test names based - request = RxDocumentServiceRequest.createFromName(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken).isNull(); - } - - @Test(groups = "unit") - public void clearTokenByResourceIdRemovesToken() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#1=20#2=5#3=30")); - - // Test resourceId based - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - - // Test names based - request = RxDocumentServiceRequest.createFromName(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - - sessionContainer.clearTokenByResourceId(documentCollectionId); - - // Test resourceId based - request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken).isNull(); - - // Test names based - request = RxDocumentServiceRequest.createFromName(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken).isNull(); - } - - @Test(groups = "unit") - public void clearTokenKeepsUnmatchedCollection() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - int randomCollectionId = getRandomCollectionId(); - String documentCollectionId1 = ResourceId.newDocumentCollectionId(getRandomDbId(), randomCollectionId).getDocumentCollectionId().toString(); - String collectionFullName1 = "dbs/db1/colls1/collName1"; - - sessionContainer.setSessionToken(documentCollectionId1, collectionFullName1, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#1=20#2=5#3=30")); - - // Test resourceId based - RxDocumentServiceRequest request1 = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId1, ResourceType.Document, new HashMap<>()); - String documentCollectionId2 = ResourceId.newDocumentCollectionId(getRandomDbId(), randomCollectionId - 1).getDocumentCollectionId().toString(); - String collectionFullName2 = "dbs/db1/colls1/collName2"; - - // Test resourceId based - RxDocumentServiceRequest request2 = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId2, ResourceType.Document, new HashMap<>()); - - sessionContainer.setSessionToken(documentCollectionId2, collectionFullName2, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#1=20#2=5#3=30")); - - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request1, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request2, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - - sessionContainer.clearTokenByResourceId(documentCollectionId2); - - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request1, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request2, "range_0"); - assertThat(sessionToken).isNull(); - } - - @Test(groups = "unit") - public void setSessionTokenDoesntFailOnEmptySessionTokenHeader() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - sessionContainer.setSessionToken(null, new HashMap<>()); - } - - @Test(groups = "unit") - public void setSessionTokenSetsTokenWhenRequestIsntNameBased() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document, new HashMap<>()); - request.setResourceId(documentCollectionId); - - assertThat(request.getIsNameBased()).isFalse(); - sessionContainer.setSessionToken(request, ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#4=90#5=1")); - request = RxDocumentServiceRequest.create(OperationType.Read, documentCollectionId, ResourceType.Document, new HashMap<>()); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - - request = RxDocumentServiceRequest.createFromName(OperationType.Read, collectionFullName + "/docs/doc1", ResourceType.Document); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - } - - @Test(groups = "unit") - public void setSessionTokenGivesPriorityToOwnerFullNameOverResourceAddress() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName1 = "dbs/db1/colls1/collName1"; - String collectionFullName2 = "dbs/db1/colls1/collName2"; - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - collectionFullName1 + "/docs/doc1", ResourceType.Document, new HashMap<>()); - request.setResourceId(documentCollectionId); - sessionContainer.setSessionToken(request, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#4=90#5=1", - HttpConstants.HttpHeaders.OWNER_FULL_NAME, collectionFullName2)); - - request = RxDocumentServiceRequest.createFromName(OperationType.Read, collectionFullName1 + "/docs/doc1", ResourceType.Document); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken).isNull(); - - request = RxDocumentServiceRequest.createFromName(OperationType.Read, collectionFullName2 + "/docs/doc1", ResourceType.Document); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - } - - @Test(groups = "unit") - public void setSessionTokenIgnoresOwnerIdWhenRequestIsntNameBased() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - int randomCollectionId = getRandomCollectionId(); - int randomDbId = getRandomDbId(); - String documentCollectionId1 = ResourceId.newDocumentCollectionId(randomDbId, randomCollectionId).getDocumentCollectionId().toString(); - String documentCollectionId2 = ResourceId.newDocumentCollectionId(randomDbId, randomCollectionId - 1).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName1"; - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document, new HashMap<>()); - request.setResourceId(documentCollectionId1); - assertThat(request.getIsNameBased()).isFalse(); - - sessionContainer.setSessionToken(request, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#4=90#5=1", - HttpConstants.HttpHeaders.OWNER_ID, documentCollectionId2)); - - request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId1, ResourceType.Document, new HashMap<>()); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - - - request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId2, ResourceType.Document, new HashMap<>()); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken).isNull(); - } - - @Test(groups = "unit") - public void setSessionTokenGivesPriorityToOwnerIdOverResourceIdWhenRequestIsNameBased() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - int randomCollectionId = getRandomCollectionId(); - int randomDbId = getRandomDbId(); - String documentCollectionId1 = ResourceId.newDocumentCollectionId(randomDbId, randomCollectionId).getDocumentCollectionId().toString(); - String documentCollectionId2 = ResourceId.newDocumentCollectionId(randomDbId, randomCollectionId - 1).getDocumentCollectionId().toString(); - - String collectionFullName = "dbs/db1/colls1/collName1"; - - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document); - request.setResourceId(documentCollectionId1); - assertThat(request.getIsNameBased()).isTrue(); - - sessionContainer.setSessionToken(request, - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#4=90#5=1", - HttpConstants.HttpHeaders.OWNER_ID, documentCollectionId2)); - - request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId1, ResourceType.Document, new HashMap<>()); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken).isNull(); - - - request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId2, ResourceType.Document, new HashMap<>()); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(100); - } - - @Test(groups = "unit") - public void setSessionTokenDoesntWorkForMasterQueries() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.ReadFeed, - collectionFullName + "/docs/doc1", ResourceType.DocumentCollection, new HashMap<>()); - request.setResourceId(documentCollectionId); - sessionContainer.setSessionToken(request, ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1")); - - request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken).isNull(); - - request = RxDocumentServiceRequest.createFromName(OperationType.Read, collectionFullName + "/docs/doc1", ResourceType.Document); - sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken).isNull(); - } - - @Test(groups = "unit") - public void setSessionTokenDoesntOverwriteHigherLSN() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document, new HashMap<>()); - request.setResourceId(documentCollectionId); - sessionContainer.setSessionToken(request, ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#105#4=90#5=1")); - - - request = RxDocumentServiceRequest.create(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document, new HashMap<>()); - request.setResourceId(documentCollectionId); - sessionContainer.setSessionToken(request, ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#4=90#5=1")); - - request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - request.setResourceId(documentCollectionId); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(105); - } - - @Test(groups = "unit") - public void setSessionTokenOverwriteLowerLSN() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document, new HashMap<>()); - request.setResourceId(documentCollectionId); - sessionContainer.setSessionToken(request, ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#4=90#5=1")); - - - request = RxDocumentServiceRequest.create(OperationType.Read, - collectionFullName + "/docs/doc1", ResourceType.Document, new HashMap<>()); - request.setResourceId(documentCollectionId); - sessionContainer.setSessionToken(request, ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#105#4=90#5=1")); - - request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - request.setResourceId(documentCollectionId); - ISessionToken sessionToken = sessionContainer.resolvePartitionLocalSessionToken(request, "range_0"); - assertThat(sessionToken.getLSN()).isEqualTo(105); - } - - @Test(groups = "unit") - public void setSessionTokenDoesNothingOnEmptySessionTokenHeader() { - SessionContainer sessionContainer = new SessionContainer("127.0.0.1"); - String documentCollectionId = ResourceId.newDocumentCollectionId(getRandomDbId(), getRandomCollectionId()).getDocumentCollectionId().toString(); - String collectionFullName = "dbs/db1/colls1/collName"; - - sessionContainer.setSessionToken(documentCollectionId, collectionFullName + "/docs/doc1", - ImmutableMap.of(HttpConstants.HttpHeaders.SESSION_TOKEN, "range_0:1#100#4=90#5=1")); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - String sessionToken = sessionContainer.resolveGlobalSessionToken(request); - Set tokens = Sets.newSet(sessionToken.split(",")); - assertThat(tokens.size()).isEqualTo(1); - assertThat(tokens.contains("range_0:1#100#4=90#5=1")).isTrue(); - - sessionContainer.setSessionToken(documentCollectionId, collectionFullName, new HashMap<>()); - request = RxDocumentServiceRequest.create(OperationType.Read, - documentCollectionId, ResourceType.Document, new HashMap<>()); - sessionToken = sessionContainer.resolveGlobalSessionToken(request); - tokens = Sets.newSet(sessionToken.split(",")); - assertThat(tokens.size()).isEqualTo(1); - assertThat(tokens.contains("range_0:1#100#4=90#5=1")).isTrue(); - } - - private static int getRandomCollectionId() { - return random.nextInt(Integer.MAX_VALUE / 2) - (Integer.MAX_VALUE / 2); - } - - private static int getRandomDbId() { - return random.nextInt(Integer.MAX_VALUE / 2); - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/SessionTokenTest.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/SessionTokenTest.java deleted file mode 100644 index 15b46fdf006d..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/SessionTokenTest.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal; - -import org.testng.annotations.Test; - -import static com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; - -public class SessionTokenTest { - - @Test(groups = "unit") - public void validateSuccessfulSessionTokenParsing() { - // valid session token - String sessionToken = "1#100#1=20#2=5#3=30"; - ValueHolder parsedSessionToken = new ValueHolder<>(null); - - assertThat(VectorSessionToken.tryCreate(sessionToken, parsedSessionToken)).isTrue(); - } - - @Test(groups = "unit") - public void validateSessionTokenParsingWithInvalidVersion() { - String sessionToken = "foo#100#1=20#2=5#3=30"; - ValueHolder parsedSessionToken = new ValueHolder<>(null); - assertThat(VectorSessionToken.tryCreate(sessionToken, parsedSessionToken)).isFalse(); - } - - @Test(groups = "unit") - public void validateSessionTokenParsingWithInvalidGlobalLsn() { - String sessionToken = "1#foo#1=20#2=5#3=30"; - ValueHolder parsedSessionToken = new ValueHolder<>(null); - assertThat(VectorSessionToken.tryCreate(sessionToken, parsedSessionToken)).isFalse(); - } - - @Test(groups = "unit") - public void validateSessionTokenParsingWithInvalidRegionProgress() { - String sessionToken = "1#100#1=20#2=x#3=30"; - ValueHolder parsedSessionToken = new ValueHolder<>(null); - assertThat(VectorSessionToken.tryCreate(sessionToken, parsedSessionToken)).isFalse(); - - } - - @Test(groups = "unit") - public void validateSessionTokenParsingWithInvalidFormat() { - String sessionToken = "1;100#1=20#2=40"; - ValueHolder parsedSessionToken = new ValueHolder<>(null); - assertThat(VectorSessionToken.tryCreate(sessionToken, parsedSessionToken)).isFalse(); - } - - @Test(groups = "unit") - public void validateSessionTokenParsingFromEmptyString() { - String sessionToken = ""; - ValueHolder parsedSessionToken = new ValueHolder<>(null); - assertThat(VectorSessionToken.tryCreate(sessionToken, parsedSessionToken)).isFalse(); - } - - @Test(groups = "unit") - public void validateSessionTokenComparison() throws Exception { - // valid session token - ValueHolder sessionToken1 = new ValueHolder<>(null); - ValueHolder sessionToken2 = new ValueHolder<>(null); - ValueHolder sessionTokenMerged = new ValueHolder<>(null); - - assertThat(VectorSessionToken.tryCreate("1#100#1=20#2=5#3=30", sessionToken1)).isTrue(); - assertThat(VectorSessionToken.tryCreate("2#105#4=10#2=5#3=30", sessionToken2)).isTrue(); - - assertThat(sessionToken1.v).isNotEqualTo(sessionToken2.v); - assertThat(sessionToken2.v).isNotEqualTo(sessionToken1.v); - - assertThat(sessionToken1.v.isValid(sessionToken2.v)).isTrue(); - assertThat(sessionToken2.v.isValid(sessionToken1.v)).isFalse(); - - - assertThat(VectorSessionToken.tryCreate("2#105#2=5#3=30#4=10", sessionTokenMerged)).isTrue(); - assertThat(sessionTokenMerged.v).isEqualTo(sessionToken1.v.merge(sessionToken2.v)); - - assertThat(VectorSessionToken.tryCreate("1#100#1=20#2=5#3=30", sessionToken1)).isTrue(); - assertThat(VectorSessionToken.tryCreate("1#100#1=10#2=8#3=30", sessionToken2)).isTrue(); - - assertThat(sessionToken1.v.equals(sessionToken2.v)).isFalse(); - assertThat(sessionToken2.v.equals(sessionToken1.v)).isFalse(); - assertThat(sessionToken1.v.isValid(sessionToken2.v)).isFalse(); - assertThat(sessionToken2.v.isValid(sessionToken1.v)).isFalse(); - - assertThat(VectorSessionToken.tryCreate("1#100#1=20#2=8#3=30", sessionTokenMerged)).isTrue(); - assertThat(sessionTokenMerged.v.equals(sessionToken1.v.merge(sessionToken2.v))).isTrue(); - - assertThat(VectorSessionToken.tryCreate("1#100#1=20#2=5#3=30", sessionToken1)).isTrue(); - assertThat(VectorSessionToken.tryCreate("1#102#1=100#2=8#3=30", sessionToken2)).isTrue(); - - assertThat(sessionToken1.v.equals(sessionToken2.v)).isFalse(); - assertThat(sessionToken2.v.equals(sessionToken1.v)).isFalse(); - assertThat(sessionToken1.v.isValid(sessionToken2.v)).isTrue(); - assertThat(sessionToken2.v.isValid(sessionToken1.v)).isFalse(); - - assertThat(VectorSessionToken.tryCreate("1#102#2=8#3=30#1=100", sessionTokenMerged)).isTrue(); - - assertThat(sessionTokenMerged.v.equals(sessionToken1.v.merge(sessionToken2.v))).isTrue(); - - assertThat(VectorSessionToken.tryCreate("1#101#1=20#2=5#3=30", sessionToken1)).isTrue(); - assertThat(VectorSessionToken.tryCreate("1#100#1=20#2=5#3=30#4=40", sessionToken2)).isTrue(); - - - try { - sessionToken1.v.merge(sessionToken2.v); - fail("Region progress can not be different when version is same"); - } catch (InternalServerErrorException e) { - } - - try { - sessionToken2.v.isValid(sessionToken1.v); - fail("Region progress can not be different when version is same"); - } catch (InternalServerErrorException e) { - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/InMemoryCollectionRoutingMapTest.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/InMemoryCollectionRoutingMapTest.java deleted file mode 100644 index 6ae8eedd6a6f..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/InMemoryCollectionRoutingMapTest.java +++ /dev/null @@ -1,271 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; - -import com.google.common.collect.ImmutableList; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.PartitionKeyRange; - -public class InMemoryCollectionRoutingMapTest { - - static class ServerIdentityImp implements IServerIdentity { - private int value; - public ServerIdentityImp(int value) { - this.value = value; - } - - static ServerIdentityImp of(int value) { - return new ServerIdentityImp(value); - } - } - - @Test(groups = { "unit" }) - public void collectionRoutingMap() { - InMemoryCollectionRoutingMap routingMap = InMemoryCollectionRoutingMap - .tryCreateCompleteRoutingMap(Arrays.asList( - new ImmutablePair<>( - new PartitionKeyRange("2", "0000000050", "0000000070"), ServerIdentityImp.of(2)), - new ImmutablePair<>(new PartitionKeyRange("0", "", "0000000030"), - ServerIdentityImp.of(0)), - new ImmutablePair<>( - new PartitionKeyRange("1", "0000000030", "0000000050"), ServerIdentityImp.of(1)), - new ImmutablePair<>(new PartitionKeyRange("3", "0000000070", "FF"), - ServerIdentityImp.of(3))), - StringUtils.EMPTY); - - assertThat("0").isEqualTo(routingMap.getOrderedPartitionKeyRanges().get(0).getId()); - assertThat("1").isEqualTo(routingMap.getOrderedPartitionKeyRanges().get(1).getId()); - assertThat("2").isEqualTo(routingMap.getOrderedPartitionKeyRanges().get(2).getId()); - assertThat("3").isEqualTo(routingMap.getOrderedPartitionKeyRanges().get(3).getId()); - - - assertThat("0").isEqualTo(routingMap.getRangeByEffectivePartitionKey("").getId()); - assertThat("0").isEqualTo(routingMap.getRangeByEffectivePartitionKey("0000000000").getId()); - assertThat("1").isEqualTo(routingMap.getRangeByEffectivePartitionKey("0000000030").getId()); - assertThat("1").isEqualTo(routingMap.getRangeByEffectivePartitionKey("0000000031").getId()); - assertThat("3").isEqualTo(routingMap.getRangeByEffectivePartitionKey("0000000071").getId()); - - assertThat("0").isEqualTo(routingMap.getRangeByPartitionKeyRangeId("0").getId()); - assertThat("1").isEqualTo(routingMap.getRangeByPartitionKeyRangeId("1").getId()); - - assertThat(4).isEqualTo( - routingMap - .getOverlappingRanges(Collections.singletonList(new Range(PartitionKeyRange.MINIMUM_INCLUSIVE_EFFECTIVE_PARTITION_KEY, - PartitionKeyRange.MAXIMUM_EXCLUSIVE_EFFECTIVE_PARTITION_KEY, true, false))) - .size()); - assertThat(0).isEqualTo( - routingMap - .getOverlappingRanges(Collections.singletonList(new Range(PartitionKeyRange.MINIMUM_INCLUSIVE_EFFECTIVE_PARTITION_KEY, - PartitionKeyRange.MINIMUM_INCLUSIVE_EFFECTIVE_PARTITION_KEY, false, false))) - .size()); - - Collection partitionKeyRanges = routingMap - .getOverlappingRanges(Collections.singletonList(new Range("0000000040", "0000000040", true, true))); - - assertThat(1).isEqualTo(partitionKeyRanges.size()); - Iterator iterator = partitionKeyRanges.iterator(); - assertThat("1").isEqualTo(iterator.next().getId()); - - Collection partitionKeyRanges1 = routingMap - .getOverlappingRanges(Arrays.asList(new Range("0000000040", "0000000045", true, true), - new Range("0000000045", "0000000046", true, true), - new Range("0000000046", "0000000050", true, true))); - - assertThat(2).isEqualTo(partitionKeyRanges1.size()); - Iterator iterator1 = partitionKeyRanges1.iterator(); - assertThat("1").isEqualTo(iterator1.next().getId()); - assertThat("2").isEqualTo(iterator1.next().getId()); - } - - @Test(groups = { "unit" }, expectedExceptions = IllegalStateException.class) - public void invalidRoutingMap() { - InMemoryCollectionRoutingMap.tryCreateCompleteRoutingMap(Arrays.asList( - new ImmutablePair<>(new PartitionKeyRange("1", "0000000020", "0000000030"), - ServerIdentityImp.of(2)), - new ImmutablePair<>(new PartitionKeyRange("2", "0000000025", "0000000035"), - ServerIdentityImp.of(2))), - StringUtils.EMPTY); - } - - @Test(groups = { "unit" }) - public void incompleteRoutingMap() { - InMemoryCollectionRoutingMap routingMap = InMemoryCollectionRoutingMap - .tryCreateCompleteRoutingMap(Arrays.asList( - new ImmutablePair<>(new PartitionKeyRange("2", "", "0000000030"), - ServerIdentityImp.of(2)), - new ImmutablePair<>(new PartitionKeyRange("3", "0000000031", "FF"), - ServerIdentityImp.of(2))), - StringUtils.EMPTY); - - assertThat(routingMap).isNull(); - - routingMap = InMemoryCollectionRoutingMap.tryCreateCompleteRoutingMap(Arrays.asList( - new ImmutablePair<>(new PartitionKeyRange("2", "", "0000000030"), ServerIdentityImp.of(2)), - new ImmutablePair<>(new PartitionKeyRange("3", "0000000030", "FF"), ServerIdentityImp.of(2))), - StringUtils.EMPTY); - - assertThat(routingMap).isNotNull(); - } - - @Test(groups = {"unit"}) - public void goneRanges() { - CollectionRoutingMap routingMap = InMemoryCollectionRoutingMap.tryCreateCompleteRoutingMap( - ImmutableList.of( - new ImmutablePair(new PartitionKeyRange("2", "", "0000000030", ImmutableList.of("1", "0")), null), - new ImmutablePair(new PartitionKeyRange("3", "0000000030", "0000000032", ImmutableList.of("5")), null), - new ImmutablePair(new PartitionKeyRange("4", "0000000032", "FF"), null)), - StringUtils.EMPTY); - - assertThat(routingMap.IsGone("1")).isTrue(); - assertThat(routingMap.IsGone("0")).isTrue(); - assertThat(routingMap.IsGone("5")).isTrue(); - - assertThat(routingMap.IsGone("2")).isFalse(); - assertThat(routingMap.IsGone("3")).isFalse(); - assertThat(routingMap.IsGone("4")).isFalse(); - assertThat(routingMap.IsGone("100")).isFalse(); - } - - @Test(groups = {"unit"}) - public void tryCombineRanges() { - CollectionRoutingMap routingMap = InMemoryCollectionRoutingMap.tryCreateCompleteRoutingMap( - ImmutableList.of( - new ImmutablePair( - new PartitionKeyRange( - "2", - "0000000050", - "0000000070"), - null), - - new ImmutablePair( - new PartitionKeyRange( - "0", - "", - "0000000030"), - null), - - new ImmutablePair( - new PartitionKeyRange( - "1", - "0000000030", - "0000000050"), - null), - - new ImmutablePair( - new PartitionKeyRange( - "3", - "0000000070", - "FF"), - null) - ), StringUtils.EMPTY); - - CollectionRoutingMap newRoutingMap = routingMap.tryCombine( - ImmutableList.of( - new ImmutablePair( - new PartitionKeyRange( - "4", - "", - "0000000010", - ImmutableList.of("0") - ), - null), - - new ImmutablePair( - new PartitionKeyRange( - "5", - "0000000010", - "0000000030", - ImmutableList.of("0") - ), - null) - )); - - assertThat(newRoutingMap).isNotNull(); - - newRoutingMap = routingMap.tryCombine( - ImmutableList.of( - new ImmutablePair( - new PartitionKeyRange( - "6", - "", - "0000000005", - ImmutableList.of("0", "4") - ), - null), - - new ImmutablePair( - new PartitionKeyRange( - "7", - "0000000005", - "0000000010", - ImmutableList.of("0", "4") - ), - null), - - new ImmutablePair( - new PartitionKeyRange( - "8", - "0000000010", - "0000000015", - ImmutableList.of("0", "5") - ), - null), - - new ImmutablePair( - new PartitionKeyRange( - "9", - "0000000015", - "0000000030", - ImmutableList.of("0", "5") - ), - null) - )); - - assertThat(newRoutingMap).isNotNull(); - - newRoutingMap = routingMap.tryCombine( - ImmutableList.of( - new ImmutablePair( - new PartitionKeyRange( - "10", - "", - "0000000002", - ImmutableList.of("0", "4", "6") - ), - null) - )); - - assertThat(newRoutingMap).isNull(); - } -} diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/LocationCacheTest.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/LocationCacheTest.java deleted file mode 100644 index bb2d519a7fd7..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/LocationCacheTest.java +++ /dev/null @@ -1,444 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Iterables; -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.BridgeUtils; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.DatabaseAccount; -import com.microsoft.azure.cosmosdb.DatabaseAccountLocation; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.rx.internal.GlobalEndpointManager; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.DatabaseAccountManagerInternal; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; -import org.apache.commons.collections4.list.UnmodifiableList; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import rx.Completable; -import rx.Observable; - -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; -import java.util.stream.IntStream; -import java.util.stream.Stream; -import java.util.stream.StreamSupport; - -import static com.microsoft.azure.cosmosdb.BridgeUtils.createDatabaseAccountLocation; -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Tests for {@link LocationCache} - */ -public class LocationCacheTest { - private final static URL DefaultEndpoint = createUrl("https://default.documents.azure.com"); - private final static URL Location1Endpoint = createUrl("https://location1.documents.azure.com"); - private final static URL Location2Endpoint = createUrl("https://location2.documents.azure.com"); - private final static URL Location3Endpoint = createUrl("https://location3.documents.azure.com"); - private final static URL Location4Endpoint = createUrl("https://location4.documents.azure.com"); - - private static HashMap EndpointByLocation = new HashMap<>(); - - static { - EndpointByLocation.put("location1", LocationCacheTest.Location1Endpoint); - EndpointByLocation.put("location2", LocationCacheTest.Location2Endpoint); - EndpointByLocation.put("location3", LocationCacheTest.Location3Endpoint); - EndpointByLocation.put("location4", LocationCacheTest.Location4Endpoint); - } - - private final Configs configs = new Configs() { - @Override - public int getUnavailableLocationsExpirationTimeInSeconds() { - return 3; - } - }; - - private UnmodifiableList preferredLocations; - private DatabaseAccount databaseAccount; - private LocationCache cache; - private GlobalEndpointManager endpointManager; - private DatabaseAccountManagerInternalMock mockedClient; - - @DataProvider(name = "paramsProvider") - public Object[][] paramsProvider() { - // provides all possible combinations for - // useMultipleWriteEndpoints, endpointDiscoveryEnabled, isPreferredListEmpty - List list = new ArrayList<>(); - for (int i = 0; i < 8; i++) { - boolean useMultipleWriteEndpoints = (i & 1) > 0; - boolean endpointDiscoveryEnabled = (i & 2) > 0; - boolean isPreferredListEmpty = (i & 4) > 0; - list.add(new Object[]{useMultipleWriteEndpoints, endpointDiscoveryEnabled, isPreferredListEmpty}); - } - - return list.toArray(new Object[][]{}); - } - - @Test(groups = "long", dataProvider = "paramsProvider") - public void validateAsync(boolean useMultipleWriteEndpoints, - boolean endpointDiscoveryEnabled, - boolean isPreferredListEmpty) throws Exception { - validateLocationCacheAsync(useMultipleWriteEndpoints, - endpointDiscoveryEnabled, - isPreferredListEmpty); - } - - @Test(groups = "long") - public void validateWriteEndpointOrderWithClientSideDisableMultipleWriteLocation() throws Exception { - this.initialize(false, true, false); - assertThat(this.cache.getWriteEndpoints().get(0)).isEqualTo(LocationCacheTest.Location1Endpoint); - assertThat(this.cache.getWriteEndpoints().get(1)).isEqualTo(LocationCacheTest.Location2Endpoint); - assertThat(this.cache.getWriteEndpoints().get(2)).isEqualTo(LocationCacheTest.Location3Endpoint); - } - - private static DatabaseAccount createDatabaseAccount(boolean useMultipleWriteLocations) { - DatabaseAccount databaseAccount = BridgeUtils.createDatabaseAccount( - // read endpoints - ImmutableList.of( - createDatabaseAccountLocation("location1", LocationCacheTest.Location1Endpoint.toString()), - createDatabaseAccountLocation("location2", LocationCacheTest.Location2Endpoint.toString()), - createDatabaseAccountLocation("location4", LocationCacheTest.Location4Endpoint.toString())), - - // write endpoints - ImmutableList.of( - createDatabaseAccountLocation("location1", LocationCacheTest.Location1Endpoint.toString()), - createDatabaseAccountLocation("location2", LocationCacheTest.Location2Endpoint.toString()), - createDatabaseAccountLocation("location3", LocationCacheTest.Location3Endpoint.toString())), - // if the account supports multi master multi muster - useMultipleWriteLocations); - - return databaseAccount; - } - - private void initialize( - boolean useMultipleWriteLocations, - boolean enableEndpointDiscovery, - boolean isPreferredLocationsListEmpty) throws Exception { - - this.mockedClient = new DatabaseAccountManagerInternalMock(); - this.databaseAccount = LocationCacheTest.createDatabaseAccount(useMultipleWriteLocations); - - this.preferredLocations = isPreferredLocationsListEmpty ? - new UnmodifiableList<>(Collections.emptyList()) : - new UnmodifiableList<>(ImmutableList.of("location1", "location2", "location3")); - - this.cache = new LocationCache( - this.preferredLocations, - LocationCacheTest.DefaultEndpoint, - enableEndpointDiscovery, - useMultipleWriteLocations, - configs); - - this.cache.onDatabaseAccountRead(this.databaseAccount); - - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setEnableEndpointDiscovery(enableEndpointDiscovery); - BridgeInternal.setUseMultipleWriteLocations(connectionPolicy, useMultipleWriteLocations); - connectionPolicy.setPreferredLocations(this.preferredLocations); - - this.endpointManager = new GlobalEndpointManager(mockedClient, connectionPolicy, configs); - } - - class DatabaseAccountManagerInternalMock implements DatabaseAccountManagerInternal { - private final AtomicInteger counter = new AtomicInteger(0); - - private void reset() { - counter.set(0); - } - - private int getInvocationCounter() { - return counter.get(); - } - - @Override - public Observable getDatabaseAccountFromEndpoint(URI endpoint) { - return Observable.just(LocationCacheTest.this.databaseAccount); - } - - @Override - public ConnectionPolicy getConnectionPolicy() { - throw new RuntimeException("not supported"); - } - - @Override - public URI getServiceEndpoint() { - try { - return LocationCacheTest.DefaultEndpoint.toURI(); - } catch (Exception e) { - throw new RuntimeException(); - } - } - } - - private static Stream toStream(Iterable iterable) { - return StreamSupport.stream(iterable.spliterator(), false); - } - - private void validateLocationCacheAsync( - boolean useMultipleWriteLocations, - boolean endpointDiscoveryEnabled, - boolean isPreferredListEmpty) throws Exception { - for (int writeLocationIndex = 0; writeLocationIndex < 3; writeLocationIndex++) { - for (int readLocationIndex = 0; readLocationIndex < 2; readLocationIndex++) { - this.initialize( - useMultipleWriteLocations, - endpointDiscoveryEnabled, - isPreferredListEmpty); - - UnmodifiableList currentWriteEndpoints = this.cache.getWriteEndpoints(); - UnmodifiableList currentReadEndpoints = this.cache.getReadEndpoints(); - for (int i = 0; i < readLocationIndex; i++) { - this.cache.markEndpointUnavailableForRead(createUrl(Iterables.get(this.databaseAccount.getReadableLocations(), i).getEndpoint())); - this.endpointManager.markEndpointUnavailableForRead(createUrl(Iterables.get(this.databaseAccount.getReadableLocations(), i).getEndpoint()));; - } - for (int i = 0; i < writeLocationIndex; i++) { - this.cache.markEndpointUnavailableForWrite(createUrl(Iterables.get(this.databaseAccount.getWritableLocations(), i).getEndpoint())); - this.endpointManager.markEndpointUnavailableForWrite(createUrl(Iterables.get(this.databaseAccount.getWritableLocations(), i).getEndpoint())); - } - - Map writeEndpointByLocation = toStream(this.databaseAccount.getWritableLocations()) - .collect(Collectors.toMap(i -> i.getName(), i -> createUrl(i.getEndpoint()))); - - Map readEndpointByLocation = toStream(this.databaseAccount.getReadableLocations()) - .collect(Collectors.toMap(i -> i.getName(), i -> createUrl(i.getEndpoint()))); - - URL[] preferredAvailableWriteEndpoints = toStream(this.preferredLocations).skip(writeLocationIndex) - .filter(location -> writeEndpointByLocation.containsKey(location)) - .map(location -> writeEndpointByLocation.get(location)) - .collect(Collectors.toList()).toArray(new URL[0]); - - URL[] preferredAvailableReadEndpoints = toStream(this.preferredLocations).skip(readLocationIndex) - .filter(location -> readEndpointByLocation.containsKey(location)) - .map(location -> readEndpointByLocation.get(location)) - .collect(Collectors.toList()).toArray(new URL[0]); - - this.validateEndpointRefresh( - useMultipleWriteLocations, - endpointDiscoveryEnabled, - preferredAvailableWriteEndpoints, - preferredAvailableReadEndpoints, - writeLocationIndex > 0); - - this.validateGlobalEndpointLocationCacheRefreshAsync(); - - this.validateRequestEndpointResolution( - useMultipleWriteLocations, - endpointDiscoveryEnabled, - preferredAvailableWriteEndpoints, - preferredAvailableReadEndpoints); - - // wait for TTL on unavailability info - - TimeUnit.SECONDS.sleep(configs.getUnavailableLocationsExpirationTimeInSeconds() + 1); - - assertThat(currentWriteEndpoints.toArray()).containsExactly(this.cache.getWriteEndpoints().toArray()); - assertThat(currentReadEndpoints.toArray()).containsExactly(this.cache.getReadEndpoints().toArray()); - } - } - } - - private void validateEndpointRefresh( - boolean useMultipleWriteLocations, - boolean endpointDiscoveryEnabled, - URL[] preferredAvailableWriteEndpoints, - URL[] preferredAvailableReadEndpoints, - boolean isFirstWriteEndpointUnavailable) { - - Utils.ValueHolder canRefreshInBackgroundHolder = new Utils.ValueHolder<>(); - canRefreshInBackgroundHolder.v = false; - - boolean shouldRefreshEndpoints = this.cache.shouldRefreshEndpoints(canRefreshInBackgroundHolder); - - boolean isMostPreferredLocationUnavailableForRead = false; - boolean isMostPreferredLocationUnavailableForWrite = useMultipleWriteLocations ? - false : isFirstWriteEndpointUnavailable; - if (this.preferredLocations.size() > 0) { - String mostPreferredReadLocationName = this.preferredLocations.stream() - .filter(location -> toStream(databaseAccount.getReadableLocations()) - .anyMatch(readLocation -> readLocation.getName().equals(location))) - .findFirst().orElse(null); - - URL mostPreferredReadEndpoint = LocationCacheTest.EndpointByLocation.get(mostPreferredReadLocationName); - isMostPreferredLocationUnavailableForRead = preferredAvailableReadEndpoints.length == 0 ? - true : (!areEqual(preferredAvailableReadEndpoints[0], mostPreferredReadEndpoint)); - - String mostPreferredWriteLocationName = this.preferredLocations.stream() - .filter(location -> toStream(databaseAccount.getWritableLocations()) - .anyMatch(writeLocation -> writeLocation.getName().equals(location))) - .findFirst().orElse(null); - - URL mostPreferredWriteEndpoint = LocationCacheTest.EndpointByLocation.get(mostPreferredWriteLocationName); - - if (useMultipleWriteLocations) { - isMostPreferredLocationUnavailableForWrite = preferredAvailableWriteEndpoints.length == 0 ? - true : (!areEqual(preferredAvailableWriteEndpoints[0], mostPreferredWriteEndpoint)); - } - } - - if (!endpointDiscoveryEnabled) { - assertThat(shouldRefreshEndpoints).isFalse(); - } else { - assertThat(shouldRefreshEndpoints).isEqualTo( - isMostPreferredLocationUnavailableForRead || isMostPreferredLocationUnavailableForWrite); - } - - if (shouldRefreshEndpoints) { - assertThat(canRefreshInBackgroundHolder.v).isTrue(); - } - } - - private boolean areEqual(URL url1, URL url2) { - return url1.equals(url2); - } - - private void validateGlobalEndpointLocationCacheRefreshAsync() throws Exception { - - mockedClient.reset(); - List list = IntStream.range(0, 10) - .mapToObj(index -> this.endpointManager.refreshLocationAsync(null)) - .collect(Collectors.toList()); - - Completable.merge(list).await(); - - assertThat(mockedClient.getInvocationCounter()).isLessThanOrEqualTo(1); - mockedClient.reset(); - - IntStream.range(0, 10) - .mapToObj(index -> this.endpointManager.refreshLocationAsync(null)) - .collect(Collectors.toList()); - for (Completable completable : list) { - completable.await(); - } - - assertThat(mockedClient.getInvocationCounter()).isLessThanOrEqualTo(1); - } - - private void validateRequestEndpointResolution( - boolean useMultipleWriteLocations, - boolean endpointDiscoveryEnabled, - URL[] availableWriteEndpoints, - URL[] availableReadEndpoints) throws MalformedURLException { - URL firstAvailableWriteEndpoint; - URL secondAvailableWriteEndpoint; - - if (!endpointDiscoveryEnabled) { - firstAvailableWriteEndpoint = LocationCacheTest.DefaultEndpoint; - secondAvailableWriteEndpoint = LocationCacheTest.DefaultEndpoint; - } else if (!useMultipleWriteLocations) { - firstAvailableWriteEndpoint = createUrl(Iterables.get(this.databaseAccount.getWritableLocations(), 0).getEndpoint()); - secondAvailableWriteEndpoint = createUrl(Iterables.get(this.databaseAccount.getWritableLocations(), 1).getEndpoint()); - } else if (availableWriteEndpoints.length > 1) { - firstAvailableWriteEndpoint = availableWriteEndpoints[0]; - secondAvailableWriteEndpoint = availableWriteEndpoints[1]; - } else if (availableWriteEndpoints.length > 0) { - firstAvailableWriteEndpoint = availableWriteEndpoints[0]; - Iterator writeLocationsIterator = databaseAccount.getWritableLocations().iterator(); - String writeEndpoint = writeLocationsIterator.next().getEndpoint(); - secondAvailableWriteEndpoint = writeEndpoint != firstAvailableWriteEndpoint.toString() - ? new URL(writeEndpoint) - : new URL(writeLocationsIterator.next().getEndpoint()); - } else { - firstAvailableWriteEndpoint = LocationCacheTest.DefaultEndpoint; - secondAvailableWriteEndpoint = LocationCacheTest.DefaultEndpoint; - } - - URL firstAvailableReadEndpoint; - - if (!endpointDiscoveryEnabled) { - firstAvailableReadEndpoint = LocationCacheTest.DefaultEndpoint; - } else if (this.preferredLocations.size() == 0) { - firstAvailableReadEndpoint = firstAvailableWriteEndpoint; - } else if (availableReadEndpoints.length > 0) { - firstAvailableReadEndpoint = availableReadEndpoints[0]; - } else { - firstAvailableReadEndpoint = LocationCacheTest.EndpointByLocation.get(this.preferredLocations.get(0)); - } - - URL firstWriteEnpoint = !endpointDiscoveryEnabled ? - LocationCacheTest.DefaultEndpoint : - createUrl(Iterables.get(this.databaseAccount.getWritableLocations(), 0).getEndpoint()); - - URL secondWriteEnpoint = !endpointDiscoveryEnabled ? - LocationCacheTest.DefaultEndpoint : - createUrl(Iterables.get(this.databaseAccount.getWritableLocations(), 1).getEndpoint()); - - // If current write endpoint is unavailable, write endpoints order doesn't change - // All write requests flip-flop between current write and alternate write endpoint - UnmodifiableList writeEndpoints = this.cache.getWriteEndpoints(); - - assertThat(firstAvailableWriteEndpoint).isEqualTo(writeEndpoints.get(0)); - assertThat(secondAvailableWriteEndpoint).isEqualTo(this.resolveEndpointForWriteRequest(ResourceType.Document, true)); - assertThat(firstAvailableWriteEndpoint).isEqualTo(this.resolveEndpointForWriteRequest(ResourceType.Document, false)); - - // Writes to other resource types should be directed to first/second write endpoint - assertThat(firstWriteEnpoint).isEqualTo(this.resolveEndpointForWriteRequest(ResourceType.Database, false)); - assertThat(secondWriteEnpoint).isEqualTo(this.resolveEndpointForWriteRequest(ResourceType.Database, true)); - - // Reads should be directed to available read endpoints regardless of resource type - assertThat(firstAvailableReadEndpoint).isEqualTo(this.resolveEndpointForReadRequest(true)); - assertThat(firstAvailableReadEndpoint).isEqualTo(this.resolveEndpointForReadRequest(false)); - } - - private URL resolveEndpointForReadRequest(boolean masterResourceType) { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - masterResourceType ? ResourceType.Database : ResourceType.Document); - return this.cache.resolveServiceEndpoint(request); - } - - private URL resolveEndpointForWriteRequest(ResourceType resourceType, boolean useAlternateWriteEndpoint) { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Create, resourceType); - request.requestContext.RouteToLocation(useAlternateWriteEndpoint ? 1 : 0, resourceType.isCollectionChild()); - return this.cache.resolveServiceEndpoint(request); - } - - private RxDocumentServiceRequest CreateRequest(boolean isReadRequest, boolean isMasterResourceType) - { - if (isReadRequest) { - return RxDocumentServiceRequest.create(OperationType.Read, isMasterResourceType ? ResourceType.Database : ResourceType.Document); - } else { - return RxDocumentServiceRequest.create(OperationType.Create, isMasterResourceType ? ResourceType.Database : ResourceType.Document); - } - } - private static URL createUrl(String url) { - try { - return new URL(url); - } catch (MalformedURLException e) { - throw new IllegalArgumentException(e); - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/RoutingMapProviderHelperTest.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/RoutingMapProviderHelperTest.java deleted file mode 100644 index c0b105b5b6bb..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/internal/routing/RoutingMapProviderHelperTest.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.routing; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.function.Function; -import java.util.stream.Collectors; - -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.PartitionKeyRange; - -public class RoutingMapProviderHelperTest { - private static final MockRoutingMapProvider ROUTING_MAP_PROVIDER = new MockRoutingMapProvider( - Arrays.asList(new PartitionKeyRange("0", "", "000A"), new PartitionKeyRange("1", "000A", "000D"), - new PartitionKeyRange("2", "000D", "0012"), new PartitionKeyRange("3", "0012", "0015"), - new PartitionKeyRange("4", "0015", "0020"), new PartitionKeyRange("5", "0020", "0040"), - new PartitionKeyRange("6", "0040", "FF"))); - - private static class MockRoutingMapProvider implements RoutingMapProvider { - private final CollectionRoutingMap routingMap; - - public MockRoutingMapProvider(Collection ranges) { - List> pairs = new ArrayList<>( - ranges.size()); - for (PartitionKeyRange range : ranges) { - pairs.add(new ImmutablePair<>(range, null)); - } - - this.routingMap = InMemoryCollectionRoutingMap.tryCreateCompleteRoutingMap(pairs, StringUtils.EMPTY); - } - - @Override - public Collection getOverlappingRanges(String collectionIdOrNameBasedLink, - Range range, boolean forceRefresh) { - return this.routingMap.getOverlappingRanges(range); - } - - @Override - public PartitionKeyRange tryGetRangeByEffectivePartitionKey(String collectionRid, String effectivePartitionKey) { - return null; - } - - @Override - public PartitionKeyRange getPartitionKeyRangeById(String collectionLink, String partitionKeyRangeId, boolean forceRefresh) { - return null; - } - } - - @Test(groups = { "unit" }, expectedExceptions = IllegalArgumentException.class) - public void nonSortedRanges() { - RoutingMapProviderHelper.getOverlappingRanges(ROUTING_MAP_PROVIDER, "dbs/db1/colls/coll1", - Arrays.asList(new Range("0B", "0B", true, true), new Range("0A", "0A", true, true))); - } - - @Test(groups = { "unit" }, expectedExceptions = IllegalArgumentException.class) - public void overlappingRanges1() { - RoutingMapProviderHelper.getOverlappingRanges(ROUTING_MAP_PROVIDER, "dbs/db1/colls/coll1", - Arrays.asList(new Range("0A", "0D", true, true), new Range("0B", "0E", true, true))); - } - - @Test(groups = { "unit" }, expectedExceptions = IllegalArgumentException.class) - public void overlappingRanges2() { - RoutingMapProviderHelper.getOverlappingRanges(ROUTING_MAP_PROVIDER, "dbs/db1/colls/coll1", - Arrays.asList(new Range("0A", "0D", true, true), new Range("0D", "0E", true, true))); - } - - @Test(groups = { "unit" }) - public void getOverlappingRanges() { - Collection ranges = RoutingMapProviderHelper.getOverlappingRanges(ROUTING_MAP_PROVIDER, - "dbs/db1/colls/coll1", - Arrays.asList(new Range("000B", "000E", true, false), - new Range("000E", "000F", true, false), new Range("000F", "0010", true, true), - new Range("0015", "0015", true, true))); - - Function func = new Function() { - @Override - public String apply(PartitionKeyRange range) { - return range.getId(); - } - }; - - assertThat("1,2,4").isEqualTo(ranges.stream().map(func).collect(Collectors.joining(","))); - - // query for minimal point - ranges = RoutingMapProviderHelper.getOverlappingRanges(ROUTING_MAP_PROVIDER, "dbs/db1/colls/coll1", - Collections.singletonList(new Range("", "", true, true))); - - assertThat("0").isEqualTo(ranges.stream().map(func).collect(Collectors.joining(","))); - - // query for empty range - ranges = RoutingMapProviderHelper.getOverlappingRanges(ROUTING_MAP_PROVIDER, "dbs/db1/colls/coll1", - Collections.singletonList(new Range("", "", true, false))); - - assertThat(0).isEqualTo(ranges.size()); - - // entire range - ranges = RoutingMapProviderHelper.getOverlappingRanges(ROUTING_MAP_PROVIDER, "dbs/db1/colls/coll1", - Collections.singletonList(new Range("", "FF", true, false))); - - assertThat("0,1,2,3,4,5,6").isEqualTo(ranges.stream().map(func).collect(Collectors.joining(","))); - - // matching range - ranges = RoutingMapProviderHelper.getOverlappingRanges(ROUTING_MAP_PROVIDER, "dbs/db1/colls/coll1", - Collections.singletonList(new Range("0012", "0015", true, false))); - - assertThat("3").isEqualTo(ranges.stream().map(func).collect(Collectors.joining(","))); - - // matching range with empty ranges - ranges = RoutingMapProviderHelper.getOverlappingRanges(ROUTING_MAP_PROVIDER, "dbs/db1/colls/coll1", - Arrays.asList(new Range("", "", true, false), new Range("0012", "0015", true, false))); - - assertThat("3").isEqualTo(ranges.stream().map(func).collect(Collectors.joining(","))); - - // matching range and a little bit more. - ranges = RoutingMapProviderHelper.getOverlappingRanges(ROUTING_MAP_PROVIDER, "dbs/db1/colls/coll1", - Collections.singletonList(new Range("0012", "0015", false, true))); - - assertThat("3,4").isEqualTo(ranges.stream().map(func).collect(Collectors.joining(","))); - } -} diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ClientRetryPolicyTest.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ClientRetryPolicyTest.java deleted file mode 100644 index b6c6157fb9af..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ClientRetryPolicyTest.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.RetryOptions; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import io.netty.handler.timeout.ReadTimeoutException; -import org.mockito.Mockito; -import org.testng.annotations.Test; -import rx.Completable; -import rx.Single; -import rx.observers.TestSubscriber; - -import java.net.URL; -import java.time.Duration; -import java.util.concurrent.TimeUnit; - -public class ClientRetryPolicyTest { - private final static int TIMEOUT = 10000; - - @Test(groups = "unit") - public void networkFailureOnRead() throws Exception { - RetryOptions retryOptions = new RetryOptions(); - GlobalEndpointManager endpointManager = Mockito.mock(GlobalEndpointManager.class); - Mockito.doReturn(new URL("http://localhost")).when(endpointManager).resolveServiceEndpoint(Mockito.any(RxDocumentServiceRequest.class)); - Mockito.doReturn(Completable.complete()).when(endpointManager).refreshLocationAsync(Mockito.eq(null)); - ClientRetryPolicy clientRetryPolicy = new ClientRetryPolicy(endpointManager, true, retryOptions); - - Exception exception = ReadTimeoutException.INSTANCE; - - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - - clientRetryPolicy.onBeforeSendRequest(dsr); - - for (int i = 0; i < 10; i++) { - Single shouldRetry = clientRetryPolicy.shouldRetry(exception); - - validateSuccess(shouldRetry, ShouldRetryValidator.builder() - .nullException() - .shouldRetry(true) - .backOfTime(Duration.ofMillis(ClientRetryPolicy.RetryIntervalInMS)) - .build()); - - Mockito.verify(endpointManager, Mockito.times(i + 1)).markEndpointUnavailableForRead(Mockito.any()); - Mockito.verify(endpointManager, Mockito.times(0)).markEndpointUnavailableForWrite(Mockito.any()); - } - } - - @Test(groups = "unit") - public void networkFailureOnWrite() throws Exception { - RetryOptions retryOptions = new RetryOptions(); - GlobalEndpointManager endpointManager = Mockito.mock(GlobalEndpointManager.class); - Mockito.doReturn(new URL("http://localhost")).when(endpointManager).resolveServiceEndpoint(Mockito.any(RxDocumentServiceRequest.class)); - Mockito.doReturn(Completable.complete()).when(endpointManager).refreshLocationAsync(Mockito.eq(null)); - ClientRetryPolicy clientRetryPolicy = new ClientRetryPolicy(endpointManager, true, retryOptions); - - Exception exception = ReadTimeoutException.INSTANCE; - - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Create, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - - clientRetryPolicy.onBeforeSendRequest(dsr); - for (int i = 0; i < 10; i++) { - Single shouldRetry = clientRetryPolicy.shouldRetry(exception); - validateSuccess(shouldRetry, ShouldRetryValidator.builder() - .nullException() - .shouldRetry(true) - .backOfTime(i > 0 ? Duration.ofMillis(ClientRetryPolicy.RetryIntervalInMS) : Duration.ZERO) - .build()); - - Mockito.verify(endpointManager, Mockito.times(0)).markEndpointUnavailableForRead(Mockito.any()); - Mockito.verify(endpointManager, Mockito.times(i + 1)).markEndpointUnavailableForWrite(Mockito.any()); - } - } - - @Test(groups = "unit") - public void onBeforeSendRequestNotInvoked() { - RetryOptions retryOptions = new RetryOptions(); - GlobalEndpointManager endpointManager = Mockito.mock(GlobalEndpointManager.class); - - Mockito.doReturn(Completable.complete()).when(endpointManager).refreshLocationAsync(Mockito.eq(null)); - ClientRetryPolicy clientRetryPolicy = new ClientRetryPolicy(endpointManager, true, retryOptions); - - Exception exception = ReadTimeoutException.INSTANCE; - - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Create, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - - Single shouldRetry = clientRetryPolicy.shouldRetry(exception); - validateSuccess(shouldRetry, ShouldRetryValidator.builder() - .withException(exception) - .shouldRetry(false) - .build()); - - Mockito.verifyZeroInteractions(endpointManager); - } - - public static void validateSuccess(Single single, - ShouldRetryValidator validator) { - - validateSuccess(single, validator, TIMEOUT); - } - - public static void validateSuccess(Single single, - ShouldRetryValidator validator, - long timeout) { - TestSubscriber testSubscriber = new TestSubscriber<>(); - - single.toObservable().subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertCompleted(); - testSubscriber.assertNoErrors(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } -} diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConfigsTests.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConfigsTests.java deleted file mode 100644 index 5ff8c28e33b0..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConfigsTests.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import static org.assertj.core.api.Assertions.assertThat; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import org.testng.annotations.Test; - -public class ConfigsTests { - - @Test(groups = { "unit" }) - public void maxHttpHeaderSize() { - Configs config = new Configs(); - assertThat(config.getMaxHttpHeaderSize()).isEqualTo(32 * 1024); - } - - @Test(groups = { "unit" }) - public void maxHttpBodyLength() { - Configs config = new Configs(); - assertThat(config.getMaxHttpBodyLength()).isEqualTo(6 * 1024 * 1024); - } - - @Test(groups = { "unit" }) - public void getProtocol() { - Configs config = new Configs(); - assertThat(config.getProtocol()).isEqualTo(Protocol.valueOf(System.getProperty("COSMOS.PROTOCOL", "Https"))); - } - - @Test(groups = { "unit" }) - public void getDirectHttpsMaxConnectionLimit() { - Configs config = new Configs(); - assertThat(config.getDirectHttpsMaxConnectionLimit()).isEqualTo(Runtime.getRuntime().availableProcessors() * 500); - } -} diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RenameCollectionAwareClientRetryPolicyTest.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RenameCollectionAwareClientRetryPolicyTest.java deleted file mode 100644 index bfb362d7b93c..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RenameCollectionAwareClientRetryPolicyTest.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.WFConstants; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxClientCollectionCache; -import io.netty.handler.timeout.ReadTimeoutException; -import org.mockito.Mockito; -import org.testng.annotations.Test; -import rx.Completable; -import rx.Single; - -import static com.microsoft.azure.cosmosdb.rx.internal.ClientRetryPolicyTest.validateSuccess; -import static org.assertj.core.api.Assertions.assertThat; - -public class RenameCollectionAwareClientRetryPolicyTest { - - private final static int TIMEOUT = 10000; - - @Test(groups = "unit", timeOut = TIMEOUT) - public void onBeforeSendRequestNotInvoked() { - GlobalEndpointManager endpointManager = Mockito.mock(GlobalEndpointManager.class); - Mockito.doReturn(Completable.complete()).when(endpointManager).refreshLocationAsync(Mockito.eq(null)); - - IRetryPolicyFactory retryPolicyFactory = new RetryPolicy(endpointManager, ConnectionPolicy.GetDefault()); - RxClientCollectionCache rxClientCollectionCache = Mockito.mock(RxClientCollectionCache.class); - - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - RenameCollectionAwareClientRetryPolicy renameCollectionAwareClientRetryPolicy = new RenameCollectionAwareClientRetryPolicy(sessionContainer - , rxClientCollectionCache - , retryPolicyFactory.getRequestPolicy()); - - Exception exception = ReadTimeoutException.INSTANCE; - - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Create, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - - Single shouldRetry = renameCollectionAwareClientRetryPolicy.shouldRetry(exception); - validateSuccess(shouldRetry, ShouldRetryValidator.builder() - .withException(exception) - .shouldRetry(false) - .build()); - - Mockito.verifyZeroInteractions(endpointManager); - } - - @Test(groups = "unit", timeOut = TIMEOUT) - public void shouldRetryWithNotFoundStatusCode() { - GlobalEndpointManager endpointManager = Mockito.mock(GlobalEndpointManager.class); - Mockito.doReturn(Completable.complete()).when(endpointManager).refreshLocationAsync(Mockito.eq(null)); - IRetryPolicyFactory retryPolicyFactory = new RetryPolicy(endpointManager, ConnectionPolicy.GetDefault()); - RxClientCollectionCache rxClientCollectionCache = Mockito.mock(RxClientCollectionCache.class); - - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - RenameCollectionAwareClientRetryPolicy renameCollectionAwareClientRetryPolicy = new RenameCollectionAwareClientRetryPolicy(sessionContainer - , rxClientCollectionCache - , retryPolicyFactory.getRequestPolicy()); - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Create, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - request.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - renameCollectionAwareClientRetryPolicy.onBeforeSendRequest(request); - - NotFoundException notFoundException = new NotFoundException(); - - Single singleShouldRetry = renameCollectionAwareClientRetryPolicy - .shouldRetry(notFoundException); - validateSuccess(singleShouldRetry, ShouldRetryValidator.builder() - .withException(notFoundException) - .shouldRetry(false) - .build()); - } - - @Test(groups = "unit", timeOut = TIMEOUT) - public void shouldRetryWithNotFoundStatusCodeAndReadSessionNotAvailableSubStatusCode() { - GlobalEndpointManager endpointManager = Mockito.mock(GlobalEndpointManager.class); - Mockito.doReturn(Completable.complete()).when(endpointManager).refreshLocationAsync(Mockito.eq(null)); - IRetryPolicyFactory retryPolicyFactory = new RetryPolicy(endpointManager, ConnectionPolicy.GetDefault()); - RxClientCollectionCache rxClientCollectionCache = Mockito.mock(RxClientCollectionCache.class); - - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - RenameCollectionAwareClientRetryPolicy renameCollectionAwareClientRetryPolicy = new RenameCollectionAwareClientRetryPolicy(sessionContainer - , rxClientCollectionCache - , retryPolicyFactory.getRequestPolicy()); - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Create, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - request.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - request.requestContext.resolvedCollectionRid = "rid_0"; - renameCollectionAwareClientRetryPolicy.onBeforeSendRequest(request); - - NotFoundException notFoundException = new NotFoundException(); - notFoundException.getResponseHeaders().put(WFConstants.BackendHeaders.SUB_STATUS, - Integer.toString(HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE)); - - DocumentCollection documentCollection = new DocumentCollection(); - documentCollection.setResourceId("rid_1"); - - Mockito.when(rxClientCollectionCache.resolveCollectionAsync(request)).thenReturn(Single.just(documentCollection)); - - Single singleShouldRetry = renameCollectionAwareClientRetryPolicy - .shouldRetry(notFoundException); - validateSuccess(singleShouldRetry, ShouldRetryValidator.builder() - .nullException() - .shouldRetry(true) - .build()); - } - - /** - * No retry on bad request exception - */ - @Test(groups = "unit", timeOut = TIMEOUT) - public void shouldRetryWithGenericException() { - GlobalEndpointManager endpointManager = Mockito.mock(GlobalEndpointManager.class); - Mockito.doReturn(Completable.complete()).when(endpointManager).refreshLocationAsync(Mockito.eq(null)); - IRetryPolicyFactory retryPolicyFactory = new RetryPolicy(endpointManager, ConnectionPolicy.GetDefault()); - RxClientCollectionCache rxClientCollectionCache = Mockito.mock(RxClientCollectionCache.class); - - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - RenameCollectionAwareClientRetryPolicy renameCollectionAwareClientRetryPolicy = new RenameCollectionAwareClientRetryPolicy(sessionContainer - , rxClientCollectionCache - , retryPolicyFactory.getRequestPolicy()); - RxDocumentServiceRequest request = RxDocumentServiceRequest.createFromName( - OperationType.Create, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - request.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - renameCollectionAwareClientRetryPolicy.onBeforeSendRequest(request); - - Single singleShouldRetry = renameCollectionAwareClientRetryPolicy - .shouldRetry(new BadRequestException()); - IRetryPolicy.ShouldRetryResult shouldRetryResult = singleShouldRetry.toBlocking().value(); - assertThat(shouldRetryResult.shouldRetry).isFalse(); - } -} diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RxGatewayStoreModelTest.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RxGatewayStoreModelTest.java deleted file mode 100644 index e4a550513010..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RxGatewayStoreModelTest.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.QueryCompatibilityMode; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import io.netty.buffer.ByteBuf; -import io.netty.handler.timeout.ReadTimeoutException; -import io.reactivex.netty.client.RxClient; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; -import org.mockito.Mockito; -import org.testng.annotations.Test; -import rx.Observable; -import rx.observers.TestSubscriber; - -import java.net.URL; -import java.util.concurrent.TimeUnit; - -import static org.assertj.core.api.Assertions.assertThat; - -public class RxGatewayStoreModelTest { - private final static int TIMEOUT = 10000; - - @Test(groups = "unit") - public void readTimeout() throws Exception { - ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class); - QueryCompatibilityMode queryCompatibilityMode = QueryCompatibilityMode.Default; - UserAgentContainer userAgentContainer = new UserAgentContainer(); - GlobalEndpointManager globalEndpointManager = Mockito.mock(GlobalEndpointManager.class); - Mockito.doReturn(new URL("https://localhost")) - .when(globalEndpointManager).resolveServiceEndpoint(Mockito.any()); - CompositeHttpClient httpClient = Mockito.mock(CompositeHttpClient.class); - Mockito.doReturn(Observable.error(ReadTimeoutException.INSTANCE)) - .when(httpClient).submit(Mockito.any(RxClient.ServerInfo.class), Mockito.any(HttpClientRequest.class)); - - RxGatewayStoreModel storeModel = new RxGatewayStoreModel( - sessionContainer, - ConsistencyLevel.Session, - queryCompatibilityMode, - userAgentContainer, - globalEndpointManager, - httpClient); - - RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName( - OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document); - dsr.getHeaders().put("key", "value"); - dsr.requestContext = Mockito.mock(DocumentServiceRequestContext.class); - - Observable resp = storeModel.processMessage(dsr); - validateFailure(resp, FailureValidator.builder() - .instanceOf(DocumentClientException.class) - .causeInstanceOf(ReadTimeoutException.class) - .documentClientExceptionHeaderRequestContainsEntry("key", "value") - .statusCode(0).build()); - } - - public void validateFailure(Observable observable, - FailureValidator validator) { - validateFailure(observable, validator, TIMEOUT); - } - - public static void validateFailure(Observable observable, - FailureValidator validator, - long timeout) { - TestSubscriber testSubscriber = new TestSubscriber<>(); - - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - validator.validate(testSubscriber.getOnErrorEvents().get(0)); - } -} diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ShouldRetryValidator.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ShouldRetryValidator.java deleted file mode 100644 index 1701c371dbf2..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ShouldRetryValidator.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.rx.FailureValidator; - -import java.time.Duration; -import java.util.ArrayList; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * This is a helper class for validating a partition address for tests. - */ -public interface ShouldRetryValidator { - - void validate(IRetryPolicy.ShouldRetryResult shouldRetryResult); - - static Builder builder() { - return new Builder(); - } - - class Builder { - private List validators = new ArrayList<>(); - - public ShouldRetryValidator build() { - return new ShouldRetryValidator() { - - @Override - public void validate(IRetryPolicy.ShouldRetryResult shouldRetryResult) { - for (ShouldRetryValidator validator : validators) { - validator.validate(shouldRetryResult); - } - } - }; - } - - public Builder nullException() { - validators.add(new ShouldRetryValidator() { - - @Override - public void validate(IRetryPolicy.ShouldRetryResult shouldRetryResult) { - assertThat(shouldRetryResult.exception).isNull(); - } - }); - return this; - } - - public Builder hasException() { - validators.add(new ShouldRetryValidator() { - - @Override - public void validate(IRetryPolicy.ShouldRetryResult shouldRetryResult) { - assertThat(shouldRetryResult.exception).isNotNull(); - } - }); - return this; - } - - public Builder exceptionOfType(Class klass) { - validators.add(new ShouldRetryValidator() { - - @Override - public void validate(IRetryPolicy.ShouldRetryResult shouldRetryResult) { - assertThat(shouldRetryResult.exception).isNotNull(); - assertThat(shouldRetryResult.exception).isInstanceOf(klass); - } - }); - return this; - } - - public Builder withException(FailureValidator failureValidator) { - validators.add(new ShouldRetryValidator() { - - @Override - public void validate(IRetryPolicy.ShouldRetryResult shouldRetryResult) { - assertThat(shouldRetryResult.exception).isNotNull(); - failureValidator.validate(shouldRetryResult.exception); - } - }); - return this; - } - - public Builder withException(Exception exception) { - validators.add(new ShouldRetryValidator() { - - @Override - public void validate(IRetryPolicy.ShouldRetryResult shouldRetryResult) { - assertThat(shouldRetryResult.exception).isNotNull(); - assertThat(shouldRetryResult.exception).isEqualTo(exception); - } - }); - return this; - } - - public Builder shouldRetry(boolean value) { - validators.add(new ShouldRetryValidator() { - - @Override - public void validate(IRetryPolicy.ShouldRetryResult shouldRetryResult) { - assertThat(shouldRetryResult.shouldRetry).isEqualTo(value); - } - }); - return this; - } - - - public Builder backOfTime(Duration backOfTime) { - validators.add(new ShouldRetryValidator() { - - @Override - public void validate(IRetryPolicy.ShouldRetryResult shouldRetryResult) { - assertThat(shouldRetryResult.backOffTime).isEqualTo(backOfTime); - } - }); - return this; - } - } -} diff --git a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/caches/AsyncCacheTest.java b/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/caches/AsyncCacheTest.java deleted file mode 100644 index b6992f3b97b7..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/caches/AsyncCacheTest.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.caches; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; - -import org.testng.annotations.Test; - -import rx.Observable; -import rx.Single; -import rx.functions.Func1; - -public class AsyncCacheTest { - - private static final int TIMEOUT = 2000; - - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void getAsync() { - AtomicInteger numberOfCacheRefreshes = new AtomicInteger(0); - final Func1> refreshFunc = key -> { - numberOfCacheRefreshes.incrementAndGet(); - return Single.just(key*2); - }; - - AsyncCache cache = new AsyncCache<>(); - - List> tasks = new ArrayList<>(); - for (int i = 0; i < 10; i++) { - for (int j = 0; j < 10; j++) { - int key = j; - tasks.add(cache.getAsync(key, -1, () -> refreshFunc.call(key))); - } - } - - Observable o = Observable.merge(tasks.stream().map(s -> s.toObservable()).collect(Collectors.toList())); - o.toList().toSingle().toBlocking().value(); - - assertThat(numberOfCacheRefreshes.get()).isEqualTo(10); - assertThat(cache.getAsync(2, -1, () -> refreshFunc.call(2)).toBlocking().value()).isEqualTo(4); - - Func1> refreshFunc1 = key -> { - numberOfCacheRefreshes.incrementAndGet(); - return Single.just(key * 2 + 1); - }; - - List> tasks1 = new ArrayList<>(); - for (int i = 0; i < 10; i++) { - for (int j = 0; j < 10; j++) { - int key = j; - tasks1.add(cache.getAsync(key, key * 2, () -> refreshFunc1.call(key))); - } - - for (int j = 0; j < 10; j++) { - int key = j; - tasks1.add(cache.getAsync(key, key * 2 , () -> refreshFunc1.call(key))); - } - } - - Observable o1 = Observable.merge(tasks1.stream().map(s -> s.toObservable()).collect(Collectors.toList())); - o1.toList().toSingle().toBlocking().value(); - - assertThat(numberOfCacheRefreshes.get()).isEqualTo(20); - assertThat(cache.getAsync(2, -1, () -> refreshFunc.call(2)).toBlocking().value()).isEqualTo(5); - } -} diff --git a/cosmosdb/data-plane/gateway/src/test/resources/log4j.properties b/cosmosdb/data-plane/gateway/src/test/resources/log4j.properties deleted file mode 100644 index 1f3287c67a55..000000000000 --- a/cosmosdb/data-plane/gateway/src/test/resources/log4j.properties +++ /dev/null @@ -1,15 +0,0 @@ -# this is the log4j configuration for tests - -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=INFO, A1 - -# Set HTTP components' logger to INFO - -log4j.category.io.netty=INFO -log4j.category.io.reactivex=INFO -# A1 is set to be a ConsoleAppender. -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%d %5X{pid} [%t] %-5p %c - %m%n diff --git a/cosmosdb/data-plane/pom.xml b/cosmosdb/data-plane/pom.xml deleted file mode 100644 index e9d43250857f..000000000000 --- a/cosmosdb/data-plane/pom.xml +++ /dev/null @@ -1,370 +0,0 @@ - - - 4.0.0 - com.microsoft.azure - azure-cosmosdb-parent - 2.4.5 - pom - Azure Cosmos DB SQL API - Java Async SDK (with Reactive Extension RX support) for Azure Cosmos DB SQL API - https://docs.microsoft.com/en-us/azure/cosmos-db - - commons - gateway - examples - benchmark - commons-test-utils - sdk - direct-impl - - - UTF-8 - UTF-8 - 2.5 - 3.8.1 - 1.6 - 1.6 - 27.0.1-jre - 2.9.9 - 3.1.4 - 1.7.6 - 1.2.17 - 4.0.5 - 1.10.19 - 4.1.32.Final - 0.4.20 - 1.3.8 - 0.8.0.17 - 1.1.1 - 6.14.3 - 3.11.1 - 1.10.19 - 27.0.1-jre - 1.6 - unit - 2.4.5 - - - - - - unit - - default - unit - - - true - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - - - - - - - fast - - simple - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - long - - long - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - direct - - direct - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - multi-master - - multi-master - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - examples - - - samples,examples - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - integration-test - verify - - - - - - - - - - emulator - - emulator - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - non-emulator - - non-emulator - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.22.0 - - unit - - %regex[.*] - - - - surefire.testng.verbose - 2 - - - - - - org.apache.maven.plugins - maven-failsafe-plugin - 2.22.0 - - - %regex[.*] - - - - surefire.testng.verbose - 2 - - - ${test.groups} - - - - - integration-test - verify - - - - - - - - - maven-javadoc-plugin - 3.0.1 - true - - true - false - ${javadoc.opts} - - **/internal/**/*.java - - - - - attach-javadocs - - jar - - - - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - attach-sources - - jar-no-fork - - - - - - - - - - org.apache.maven.plugins - maven-surefire-report-plugin - 2.22.0 - - - org.codehaus.mojo - findbugs-maven-plugin - 3.0.4 - - - org.apache.maven.plugins - maven-jxr-plugin - 2.1 - - - - - - - com.microsoft.azure - azure-cosmosdb - ${project.parent.version} - - - com.microsoft.azure - azure-cosmosdb-commons - ${project.parent.version} - - - com.microsoft.azure - azure-cosmosdb-gateway - ${project.parent.version} - - - com.microsoft.azure - azure-cosmosdb-direct - ${cosmosdb-sdk-direct-impl.version} - - - com.microsoft.azure - azure-cosmosdb-commons-test-utils - ${project.parent.version} - - - - - - org.testng - testng - ${testng.version} - test - - - - - MIT License - http://www.opensource.org/licenses/mit-license.php - - - - scm:git:https://github.com/Azure/azure-cosmosdb-java.git - scm:git:https://github.com/Azure/azure-cosmosdb-java.git - https://github.com/Azure/azure-cosmosdb-java.git - - - - Azure Cosmos DB Developer Platform Devs - docdbdevplatdevs@microsoft.com - Microsoft - http://www.microsoft.com/ - - - diff --git a/cosmosdb/data-plane/sdk/pom.xml b/cosmosdb/data-plane/sdk/pom.xml deleted file mode 100644 index fbd7f035378b..000000000000 --- a/cosmosdb/data-plane/sdk/pom.xml +++ /dev/null @@ -1,267 +0,0 @@ - - - 4.0.0 - - com.microsoft.azure - azure-cosmosdb-parent - 2.4.5 - - azure-cosmosdb - Async SDK for SQL API of Azure Cosmos DB Service - Java Async SDK (with Reactive Extension rx support) for Azure Cosmos DB SQL API - jar - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.6.0 - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-eclipse-plugin - 2.8 - - - - org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8 - - - - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - attach-sources - - jar-no-fork - - - - - - - - - - fast - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - src/test/resources/fast-testng.xml - - - - - - - - - long - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - src/test/resources/long-testng.xml - - - - - - - - - emulator - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - src/test/resources/emulator-testng.xml - - - - - - - - - - - org.apache.maven.plugins - maven-surefire-report-plugin - 2.19.1 - - - org.codehaus.mojo - findbugs-maven-plugin - 3.0.4 - - - org.apache.maven.plugins - maven-jxr-plugin - 2.1 - - - - - - com.microsoft.azure - azure-cosmosdb-commons - - - com.microsoft.azure - azure-cosmosdb-gateway - - - com.microsoft.azure - azure-cosmosdb-direct - - - com.microsoft.azure - azure-cosmosdb-commons-test-utils - test - - - com.fasterxml.jackson.core - jackson-databind - ${jackson-databind.version} - - - com.fasterxml.uuid - java-uuid-generator - ${java-uuid-generator.version} - - - commons-io - commons-io - ${commons-io.version} - - - com.github.davidmoten - rxjava-extras - ${rxjava-extras.version} - - - io.reactivex - rxjava - ${rxjava.version} - - - io.reactivex - rxjava-string - ${rxjava-string.version} - - - io.reactivex - rxnetty - ${rxnetty.version} - - - io.netty - netty-transport-native-epoll - - - - - io.netty - netty-codec-http - ${netty.version} - - - io.netty - netty-handler - ${netty.version} - - - io.netty - netty-transport - ${netty.version} - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.apache.commons - commons-lang3 - ${commons-lang3.version} - - - org.testng - testng - ${testng.version} - test - - - org.assertj - assertj-core - ${assertj.version} - test - - - org.mockito - mockito-all - ${mockito.version} - test - - - org.slf4j - slf4j-log4j12 - ${slf4j.version} - test - - - log4j - log4j - ${log4j.version} - test - - - com.google.guava - guava - ${guava.version} - test - - - diff --git a/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/AsyncDocumentClient.java b/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/AsyncDocumentClient.java deleted file mode 100644 index 513baf9a1b7c..000000000000 --- a/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/AsyncDocumentClient.java +++ /dev/null @@ -1,1519 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.io.InputStream; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.List; - -import com.microsoft.azure.cosmosdb.Attachment; -import com.microsoft.azure.cosmosdb.ChangeFeedOptions; -import com.microsoft.azure.cosmosdb.Conflict; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DatabaseAccount; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.MediaOptions; -import com.microsoft.azure.cosmosdb.MediaResponse; -import com.microsoft.azure.cosmosdb.Offer; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Permission; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.StoredProcedure; -import com.microsoft.azure.cosmosdb.StoredProcedureResponse; -import com.microsoft.azure.cosmosdb.TokenResolver; -import com.microsoft.azure.cosmosdb.Trigger; -import com.microsoft.azure.cosmosdb.User; -import com.microsoft.azure.cosmosdb.UserDefinedFunction; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentClientImpl; - -import rx.Observable; - -/** - * Provides a client-side logical representation of the Azure Cosmos DB - * database service. This async client is used to configure and execute requests - * against the service. - * - *

- * {@link AsyncDocumentClient} async APIs return rxJava's {@code - * Observable}, and so you can use rxJava {@link Observable} functionality. - * The async {@link Observable} based APIs perform the requested operation only after - * subscription. - * - *

- * The service client encapsulates the endpoint and credentials used to access - * the Cosmos DB service. - *

- * To instantiate you can use the {@link Builder} - *

- * {@code
- * ConnectionPolicy connectionPolicy = new ConnectionPolicy();
- * connectionPolicy.setConnectionMode(ConnectionMode.Direct);
- * AsyncDocumentClient client = new AsyncDocumentClient.Builder()
- *         .withServiceEndpoint(serviceEndpoint)
- *         .withMasterKeyOrResourceToken(masterKey)
- *         .withConnectionPolicy(connectionPolicy)
- *         .withConsistencyLevel(ConsistencyLevel.Session)
- *         .build();
- * }
- * 
- */ -public interface AsyncDocumentClient { - - /** - * Helper class to build {@link AsyncDocumentClient} instances - * as logical representation of the Azure Cosmos DB database service. - * - *
-     * {@code
-     * ConnectionPolicy connectionPolicy = new ConnectionPolicy();
-     * connectionPolicy.setConnectionMode(ConnectionMode.Direct);
-     * AsyncDocumentClient client = new AsyncDocumentClient.Builder()
-     *         .withServiceEndpoint(serviceEndpoint)
-     *         .withMasterKeyOrResourceToken(masterKey)
-     *         .withConnectionPolicy(connectionPolicy)
-     *         .withConsistencyLevel(ConsistencyLevel.Session)
-     *         .build();
-     * }
-     * 
- */ - class Builder { - - Configs configs = new Configs(); - ConnectionPolicy connectionPolicy; - ConsistencyLevel desiredConsistencyLevel; - List permissionFeed; - String masterKeyOrResourceToken; - URI serviceEndpoint; - TokenResolver tokenResolver; - - public Builder withServiceEndpoint(String serviceEndpoint) { - try { - this.serviceEndpoint = new URI(serviceEndpoint); - } catch (URISyntaxException e) { - throw new IllegalArgumentException(e.getMessage()); - } - return this; - } - - /** - * New method withMasterKeyOrResourceToken will take either master key or resource token - * and perform authentication for accessing resource. - * - * @param masterKeyOrResourceToken MasterKey or resourceToken for authentication. - * @return current Builder. - * @deprecated use {@link #withMasterKeyOrResourceToken(String)} instead. - */ - @Deprecated - public Builder withMasterKey(String masterKeyOrResourceToken) { - this.masterKeyOrResourceToken = masterKeyOrResourceToken; - return this; - } - - /** - * This method will accept the master key , additionally it can also consume - * resource token too for authentication. - * - * @param masterKeyOrResourceToken MasterKey or resourceToken for authentication. - * @return current Builder. - */ - public Builder withMasterKeyOrResourceToken(String masterKeyOrResourceToken) { - this.masterKeyOrResourceToken = masterKeyOrResourceToken; - return this; - } - - /** - * This method will accept the permission list , which contains the - * resource tokens needed to access resources. - * - * @param permissionFeed Permission list for authentication. - * @return current Builder. - */ - public Builder withPermissionFeed(List permissionFeed) { - this.permissionFeed = permissionFeed; - return this; - } - - public Builder withConsistencyLevel(ConsistencyLevel desiredConsistencyLevel) { - this.desiredConsistencyLevel = desiredConsistencyLevel; - return this; - } - - public Builder withConfigs(Configs configs) { - this.configs = configs; - return this; - } - - public Builder withConnectionPolicy(ConnectionPolicy connectionPolicy) { - this.connectionPolicy = connectionPolicy; - return this; - } - - /** - * This method will accept tokenResolver which is rx function, it takes arguments
- * T1 requestVerb(String),
- * T2 resourceIdOrFullName(String),
- * T3 resourceType(com.microsoft.azure.cosmosdb.internal.ResourceType),
- * T4 request headers(Map)
- *
- * and return
- * R authenticationToken(String)
- * - * @param tokenResolver tokenResolver function for authentication. - * @return current Builder. - */ - /*public Builder withTokenResolver(Func4, String> tokenResolver) { - this.tokenResolver = tokenResolver; - return this; - }*/ - - /** - * This method will accept functional interface TokenResolver which helps in generation authorization - * token per request. AsyncDocumentClient can be successfully initialized with this API without passing any MasterKey, ResourceToken or PermissionFeed. - * @param tokenResolver The tokenResolver - * @return current Builder. - */ - public Builder withTokenResolver(TokenResolver tokenResolver) { - this.tokenResolver = tokenResolver; - return this; - } - - private void ifThrowIllegalArgException(boolean value, String error) { - if (value) { - throw new IllegalArgumentException(error); - } - } - - public AsyncDocumentClient build() { - - ifThrowIllegalArgException(this.serviceEndpoint == null, "cannot build client without service endpoint"); - ifThrowIllegalArgException( - this.masterKeyOrResourceToken == null && (permissionFeed == null || permissionFeed.isEmpty()) && this.tokenResolver == null, - "cannot build client without any one of masterKey, resource token, permissionFeed and tokenResolver"); - - RxDocumentClientImpl client = new RxDocumentClientImpl(serviceEndpoint, - masterKeyOrResourceToken, - permissionFeed, - connectionPolicy, - desiredConsistencyLevel, - configs, - tokenResolver); - client.init(); - return client; - } - - public Configs getConfigs() { - return configs; - } - - public void setConfigs(Configs configs) { - this.configs = configs; - } - - public ConnectionPolicy getConnectionPolicy() { - return connectionPolicy; - } - - public void setConnectionPolicy(ConnectionPolicy connectionPolicy) { - this.connectionPolicy = connectionPolicy; - } - - public ConsistencyLevel getDesiredConsistencyLevel() { - return desiredConsistencyLevel; - } - - public void setDesiredConsistencyLevel(ConsistencyLevel desiredConsistencyLevel) { - this.desiredConsistencyLevel = desiredConsistencyLevel; - } - - public List getPermissionFeed() { - return permissionFeed; - } - - public void setPermissionFeed(List permissionFeed) { - this.permissionFeed = permissionFeed; - } - - public String getMasterKeyOrResourceToken() { - return masterKeyOrResourceToken; - } - - public void setMasterKeyOrResourceToken(String masterKeyOrResourceToken) { - this.masterKeyOrResourceToken = masterKeyOrResourceToken; - } - - public URI getServiceEndpoint() { - return serviceEndpoint; - } - - public void setServiceEndpoint(URI serviceEndpoint) { - this.serviceEndpoint = serviceEndpoint; - } - - public TokenResolver getTokenResolver() { - return tokenResolver; - } - - public void setTokenResolver(TokenResolver tokenResolver) { - this.tokenResolver = tokenResolver; - } - } - - /** - * Gets the default service endpoint as passed in by the user during construction. - * - * @return the service endpoint URI - */ - URI getServiceEndpoint(); - - /** - * Gets the current write endpoint chosen based on availability and preference. - * - * @return the write endpoint URI - */ - URI getWriteEndpoint(); - - /** - * Gets the current read endpoint chosen based on availability and preference. - * - * @return the read endpoint URI - */ - URI getReadEndpoint(); - - /** - * Gets the connection policy - * - * @return the connection policy - */ - ConnectionPolicy getConnectionPolicy(); - - /** - * Creates a database. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the created database. - * In case of failure the {@link Observable} will error. - * - * @param database the database. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the created database or an error. - */ - Observable> createDatabase(Database database, RequestOptions options); - - /** - * Deletes a database. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the deleted database. - * In case of failure the {@link Observable} will error. - * - * @param databaseLink the database link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the deleted database or an error. - */ - Observable> deleteDatabase(String databaseLink, RequestOptions options); - - /** - * Reads a database. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the read database. - * In case of failure the {@link Observable} will error. - * - * @param databaseLink the database link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the read database or an error. - */ - Observable> readDatabase(String databaseLink, RequestOptions options); - - /** - * Reads all databases. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response of the read databases. - * In case of failure the {@link Observable} will error. - * - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of read databases or an error. - */ - Observable> readDatabases(FeedOptions options); - - /** - * Query for databases. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response of the read databases. - * In case of failure the {@link Observable} will error. - * - * @param query the query. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of read databases or an error. - */ - Observable> queryDatabases(String query, FeedOptions options); - - /** - * Query for databases. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response of the obtained databases. - * In case of failure the {@link Observable} will error. - * - * @param querySpec the SQL query specification. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained databases or an error. - */ - Observable> queryDatabases(SqlQuerySpec querySpec, FeedOptions options); - - /** - * Creates a document collection. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the created collection. - * In case of failure the {@link Observable} will error. - * - * @param databaseLink the database link. - * @param collection the collection. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the created collection or an error. - */ - Observable> createCollection(String databaseLink, DocumentCollection collection, - RequestOptions options); - - /** - * Replaces a document collection. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the replaced document collection. - * In case of failure the {@link Observable} will error. - * - * @param collection the document collection to use. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the replaced document collection or an error. - */ - Observable> replaceCollection(DocumentCollection collection, RequestOptions options); - - /** - * Deletes a document collection by the collection link. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response for the deleted database. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response for the deleted database or an error. - */ - Observable> deleteCollection(String collectionLink, RequestOptions options); - - /** - * Reads a document collection by the collection link. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the read collection. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the read collection or an error. - */ - Observable> readCollection(String collectionLink, RequestOptions options); - - /** - * Reads all document collections in a database. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response of the read collections. - * In case of failure the {@link Observable} will error. - * - * @param databaseLink the database link. - * @param options the fee options. - * @return an {@link Observable} containing one or several feed response pages of the read collections or an error. - */ - Observable> readCollections(String databaseLink, FeedOptions options); - - /** - * Query for document collections in a database. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response of the obtained collections. - * In case of failure the {@link Observable} will error. - * - * @param databaseLink the database link. - * @param query the query. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained collections or an error. - */ - Observable> queryCollections(String databaseLink, String query, FeedOptions options); - - /** - * Query for document collections in a database. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response of the obtained collections. - * In case of failure the {@link Observable} will error. - * - * @param databaseLink the database link. - * @param querySpec the SQL query specification. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained collections or an error. - */ - Observable> queryCollections(String databaseLink, SqlQuerySpec querySpec, FeedOptions options); - - /** - * Creates a document. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the created document. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the link to the parent document collection. - * @param document the document represented as a POJO or Document object. - * @param options the request options. - * @param disableAutomaticIdGeneration the flag for disabling automatic id generation. - * @return an {@link Observable} containing the single resource response with the created document or an error. - */ - Observable> createDocument(String collectionLink, Object document, RequestOptions options, - boolean disableAutomaticIdGeneration); - - /** - * Upserts a document. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the upserted document. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the link to the parent document collection. - * @param document the document represented as a POJO or Document object to upsert. - * @param options the request options. - * @param disableAutomaticIdGeneration the flag for disabling automatic id generation. - * @return an {@link Observable} containing the single resource response with the upserted document or an error. - */ - Observable> upsertDocument(String collectionLink, Object document, RequestOptions options, - boolean disableAutomaticIdGeneration); - - /** - * Replaces a document using a POJO object. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the replaced document. - * In case of failure the {@link Observable} will error. - * - * @param documentLink the document link. - * @param document the document represented as a POJO or Document object. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the replaced document or an error. - */ - Observable> replaceDocument(String documentLink, Object document, RequestOptions options); - - /** - * Replaces a document with the passed in document. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the replaced document. - * In case of failure the {@link Observable} will error. - * - * @param document the document to replace (containing the document id). - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the replaced document or an error. - */ - Observable> replaceDocument(Document document, RequestOptions options); - - /** - * Deletes a document by the document link. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response for the deleted document. - * In case of failure the {@link Observable} will error. - * - * @param documentLink the document link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response for the deleted document or an error. - */ - Observable> deleteDocument(String documentLink, RequestOptions options); - - /** - * Reads a document by the document link. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the read document. - * In case of failure the {@link Observable} will error. - * - * @param documentLink the document link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the read document or an error. - */ - Observable> readDocument(String documentLink, RequestOptions options); - - /** - * Reads all documents in a document collection. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response of the read documents. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the read documents or an error. - */ - Observable> readDocuments(String collectionLink, FeedOptions options); - - - /** - * Query for documents in a document collection. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response of the obtained documents. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the link to the parent document collection. - * @param query the query. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained document or an error. - */ - Observable> queryDocuments(String collectionLink, String query, FeedOptions options); - - /** - * Query for documents in a document collection. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response of the obtained documents. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the link to the parent document collection. - * @param querySpec the SQL query specification. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained documents or an error. - */ - Observable> queryDocuments(String collectionLink, SqlQuerySpec querySpec, FeedOptions options); - - /** - * Query for documents change feed in a document collection. - * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained documents. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the link to the parent document collection. - * @param changeFeedOptions the change feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained documents or an error. - */ - Observable> queryDocumentChangeFeed(String collectionLink, - ChangeFeedOptions changeFeedOptions); - - /** - * Reads all partition key ranges in a document collection. - * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained partition key ranges. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the link to the parent document collection. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained partition key ranges or an error. - */ - Observable> readPartitionKeyRanges(String collectionLink, FeedOptions options); - - /** - * Creates a stored procedure. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the created stored procedure. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param storedProcedure the stored procedure to create. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the created stored procedure or an error. - */ - Observable> createStoredProcedure(String collectionLink, StoredProcedure storedProcedure, - RequestOptions options); - - /** - * Upserts a stored procedure. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the upserted stored procedure. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param storedProcedure the stored procedure to upsert. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the upserted stored procedure or an error. - */ - Observable> upsertStoredProcedure(String collectionLink, StoredProcedure storedProcedure, - RequestOptions options); - - /** - * Replaces a stored procedure. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the replaced stored procedure. - * In case of failure the {@link Observable} will error. - * - * @param storedProcedure the stored procedure to use. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the replaced stored procedure or an error. - */ - Observable> replaceStoredProcedure(StoredProcedure storedProcedure, RequestOptions options); - - /** - * Deletes a stored procedure by the stored procedure link. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response for the deleted stored procedure. - * In case of failure the {@link Observable} will error. - * - * @param storedProcedureLink the stored procedure link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response for the deleted stored procedure or an error. - */ - Observable> deleteStoredProcedure(String storedProcedureLink, RequestOptions options); - - /** - * Read a stored procedure by the stored procedure link. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the read stored procedure. - * In case of failure the {@link Observable} will error. - * - * @param storedProcedureLink the stored procedure link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the read stored procedure or an error. - */ - Observable> readStoredProcedure(String storedProcedureLink, RequestOptions options); - - /** - * Reads all stored procedures in a document collection link. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the read stored procedures. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the read stored procedures or an error. - */ - Observable> readStoredProcedures(String collectionLink, FeedOptions options); - - /** - * Query for stored procedures in a document collection. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained stored procedures. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param query the query. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained stored procedures or an error. - */ - Observable> queryStoredProcedures(String collectionLink, String query, FeedOptions options); - - /** - * Query for stored procedures in a document collection. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained stored procedures. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param querySpec the SQL query specification. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained stored procedures or an error. - */ - Observable> queryStoredProcedures(String collectionLink, SqlQuerySpec querySpec, - FeedOptions options); - - /** - * Executes a stored procedure by the stored procedure link. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the stored procedure response. - * In case of failure the {@link Observable} will error. - * - * @param storedProcedureLink the stored procedure link. - * @param procedureParams the array of procedure parameter values. - * @return an {@link Observable} containing the single resource response with the stored procedure response or an error. - */ - Observable executeStoredProcedure(String storedProcedureLink, Object[] procedureParams); - - /** - * Executes a stored procedure by the stored procedure link. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the stored procedure response. - * In case of failure the {@link Observable} will error. - * - * @param storedProcedureLink the stored procedure link. - * @param options the request options. - * @param procedureParams the array of procedure parameter values. - * @return an {@link Observable} containing the single resource response with the stored procedure response or an error. - */ - Observable executeStoredProcedure(String storedProcedureLink, RequestOptions options, - Object[] procedureParams); - - /** - * Creates a trigger. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the created trigger. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param trigger the trigger. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the created trigger or an error. - */ - Observable> createTrigger(String collectionLink, Trigger trigger, RequestOptions options); - - /** - * Upserts a trigger. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the upserted trigger. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param trigger the trigger to upsert. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the upserted trigger or an error. - */ - Observable> upsertTrigger(String collectionLink, Trigger trigger, RequestOptions options); - - /** - * Replaces a trigger. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the replaced trigger. - * In case of failure the {@link Observable} will error. - * - * @param trigger the trigger to use. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the replaced trigger or an error. - */ - Observable> replaceTrigger(Trigger trigger, RequestOptions options); - - /** - * Deletes a trigger. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response for the deleted trigger. - * In case of failure the {@link Observable} will error. - * - * @param triggerLink the trigger link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response for the deleted trigger or an error. - */ - Observable> deleteTrigger(String triggerLink, RequestOptions options); - - /** - * Reads a trigger by the trigger link. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response for the read trigger. - * In case of failure the {@link Observable} will error. - * - * @param triggerLink the trigger link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response for the read trigger or an error. - */ - Observable> readTrigger(String triggerLink, RequestOptions options); - - /** - * Reads all triggers in a document collection. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the read triggers. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the read triggers or an error. - */ - Observable> readTriggers(String collectionLink, FeedOptions options); - - /** - * Query for triggers. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained triggers. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param query the query. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained triggers or an error. - */ - Observable> queryTriggers(String collectionLink, String query, FeedOptions options); - - /** - * Query for triggers. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained triggers. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param querySpec the SQL query specification. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained triggers or an error. - */ - Observable> queryTriggers(String collectionLink, SqlQuerySpec querySpec, FeedOptions options); - - /** - * Creates a user defined function. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the created user defined function. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param udf the user defined function. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the created user defined function or an error. - */ - Observable> createUserDefinedFunction(String collectionLink, UserDefinedFunction udf, - RequestOptions options); - - /** - * Upserts a user defined function. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the upserted user defined function. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param udf the user defined function to upsert. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the upserted user defined function or an error. - */ - Observable> upsertUserDefinedFunction(String collectionLink, UserDefinedFunction udf, - RequestOptions options); - - /** - * Replaces a user defined function. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the replaced user defined function. - * In case of failure the {@link Observable} will error. - * - * @param udf the user defined function. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the replaced user defined function or an error. - */ - Observable> replaceUserDefinedFunction(UserDefinedFunction udf, RequestOptions options); - - /** - * Deletes a user defined function. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response for the deleted user defined function. - * In case of failure the {@link Observable} will error. - * - * @param udfLink the user defined function link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response for the deleted user defined function or an error. - */ - Observable> deleteUserDefinedFunction(String udfLink, RequestOptions options); - - /** - * Read a user defined function. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response for the read user defined function. - * In case of failure the {@link Observable} will error. - * - * @param udfLink the user defined function link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response for the read user defined function or an error. - */ - Observable> readUserDefinedFunction(String udfLink, RequestOptions options); - - /** - * Reads all user defined functions in a document collection. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the read user defined functions. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the read user defined functions or an error. - */ - Observable> readUserDefinedFunctions(String collectionLink, FeedOptions options); - - /** - * Query for user defined functions. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained user defined functions. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param query the query. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained user defined functions or an error. - */ - Observable> queryUserDefinedFunctions(String collectionLink, String query, - FeedOptions options); - - /** - * Query for user defined functions. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained user defined functions. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param querySpec the SQL query specification. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained user defined functions or an error. - */ - Observable> queryUserDefinedFunctions(String collectionLink, SqlQuerySpec querySpec, - FeedOptions options); - - /** - * Creates an attachment. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the created attachment. - * In case of failure the {@link Observable} will error. - * - * @param documentLink the document link. - * @param attachment the attachment to create. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the created attachment or an error. - */ - Observable> createAttachment(String documentLink, Attachment attachment, RequestOptions options); - - /** - * Upserts an attachment. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the upserted attachment. - * In case of failure the {@link Observable} will error. - * - * @param documentLink the document link. - * @param attachment the attachment to upsert. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the upserted attachment or an error. - */ - Observable> upsertAttachment(String documentLink, Attachment attachment, RequestOptions options); - - /** - * Replaces an attachment. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the replaced attachment. - * In case of failure the {@link Observable} will error. - * - * @param attachment the attachment to use. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the replaced attachment or an error. - */ - Observable> replaceAttachment(Attachment attachment, RequestOptions options); - - /** - * Deletes an attachment. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response for the deleted attachment. - * In case of failure the {@link Observable} will error. - * - * @param attachmentLink the attachment link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response for the deleted attachment or an error. - */ - Observable> deleteAttachment(String attachmentLink, RequestOptions options); - - /** - * Reads an attachment. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the read attachment. - * In case of failure the {@link Observable} will error. - * - * @param attachmentLink the attachment link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the read attachment or an error. - */ - Observable> readAttachment(String attachmentLink, RequestOptions options); - - /** - * Reads all attachments in a document. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the read attachments. - * In case of failure the {@link Observable} will error. - * - * @param documentLink the document link. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the read attachments or an error. - */ - Observable> readAttachments(String documentLink, FeedOptions options); - - - /** - * Reads a media by the media link. - * - * @param mediaLink the media link. - * @return the media response. - */ - Observable readMedia(String mediaLink); - - /** - * Updates a media by the media link. - * - * @param mediaLink the media link. - * @param mediaStream the media stream to upload. - * @param options the media options. - * @return the media response. - */ - Observable updateMedia(String mediaLink, InputStream mediaStream, MediaOptions options); - - /** - * Query for attachments. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained attachments. - * In case of failure the {@link Observable} will error. - * - * @param documentLink the document link. - * @param query the query. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained attachments or an error. - */ - Observable> queryAttachments(String documentLink, String query, FeedOptions options); - - /** - * Query for attachments. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained attachments. - * In case of failure the {@link Observable} will error. - * - * @param documentLink the document link. - * @param querySpec the SQL query specification. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained attachments or an error. - */ - Observable> queryAttachments(String documentLink, SqlQuerySpec querySpec, FeedOptions options); - - /** - * Creates an attachment. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the created attachment. - * In case of failure the {@link Observable} will error. - * - * @param documentLink the document link. - * @param mediaStream the media stream for creating the attachment. - * @param options the media options. - * @param requestOptions the request options - * @return an {@link Observable} containing the single resource response with the created attachment or an error. - */ - Observable> createAttachment(String documentLink, InputStream mediaStream, MediaOptions options, RequestOptions requestOptions); - - /** - * Upserts an attachment to the media stream - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the upserted attachment. - * In case of failure the {@link Observable} will error. - * - * @param documentLink the document link. - * @param mediaStream the media stream for upserting the attachment. - * @param options the media options. - * @param requestOptions the request options - * @return an {@link Observable} containing the single resource response with the upserted attachment or an error. - */ - Observable> upsertAttachment(String documentLink, InputStream mediaStream, MediaOptions options, RequestOptions requestOptions); - - /** - * Reads a conflict. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the read conflict. - * In case of failure the {@link Observable} will error. - * - * @param conflictLink the conflict link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the read conflict or an error. - */ - Observable> readConflict(String conflictLink, RequestOptions options); - - /** - * Reads all conflicts in a document collection. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the read conflicts. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the read conflicts or an error. - */ - Observable> readConflicts(String collectionLink, FeedOptions options); - - /** - * Query for conflicts. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained conflicts. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param query the query. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained conflicts or an error. - */ - Observable> queryConflicts(String collectionLink, String query, FeedOptions options); - - /** - * Query for conflicts. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained conflicts. - * In case of failure the {@link Observable} will error. - * - * @param collectionLink the collection link. - * @param querySpec the SQL query specification. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained conflicts or an error. - */ - Observable> queryConflicts(String collectionLink, SqlQuerySpec querySpec, FeedOptions options); - - /** - * Deletes a conflict. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response for the deleted conflict. - * In case of failure the {@link Observable} will error. - * - * @param conflictLink the conflict link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response for the deleted conflict or an error. - */ - Observable> deleteConflict(String conflictLink, RequestOptions options); - - /** - * Creates a user. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the created user. - * In case of failure the {@link Observable} will error. - * - * @param databaseLink the database link. - * @param user the user to create. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the created user or an error. - */ - Observable> createUser(String databaseLink, User user, RequestOptions options); - - /** - * Upserts a user. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the upserted user. - * In case of failure the {@link Observable} will error. - * - * @param databaseLink the database link. - * @param user the user to upsert. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the upserted user or an error. - */ - Observable> upsertUser(String databaseLink, User user, RequestOptions options); - - /** - * Replaces a user. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the replaced user. - * In case of failure the {@link Observable} will error. - * - * @param user the user to use. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the replaced user or an error. - */ - Observable> replaceUser(User user, RequestOptions options); - - /** - * Deletes a user. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response for the deleted user. - * In case of failure the {@link Observable} will error. - * - * @param userLink the user link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response for the deleted user or an error. - */ - Observable> deleteUser(String userLink, RequestOptions options); - - /** - * Reads a user. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the read user. - * In case of failure the {@link Observable} will error. - * - * @param userLink the user link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the read user or an error. - */ - Observable> readUser(String userLink, RequestOptions options); - - /** - * Reads all users in a database. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the read users. - * In case of failure the {@link Observable} will error. - * - * @param databaseLink the database link. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the read users or an error. - */ - Observable> readUsers(String databaseLink, FeedOptions options); - - /** - * Query for users. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained users. - * In case of failure the {@link Observable} will error. - * - * @param databaseLink the database link. - * @param query the query. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained users or an error. - */ - Observable> queryUsers(String databaseLink, String query, FeedOptions options); - - /** - * Query for users. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained users. - * In case of failure the {@link Observable} will error. - * - * @param databaseLink the database link. - * @param querySpec the SQL query specification. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained users or an error. - */ - Observable> queryUsers(String databaseLink, SqlQuerySpec querySpec, FeedOptions options); - - /** - * Creates a permission. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the created permission. - * In case of failure the {@link Observable} will error. - * - * @param userLink the user link. - * @param permission the permission to create. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the created permission or an error. - */ - Observable> createPermission(String userLink, Permission permission, RequestOptions options); - - /** - * Upserts a permission. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the upserted permission. - * In case of failure the {@link Observable} will error. - * - * @param userLink the user link. - * @param permission the permission to upsert. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the upserted permission or an error. - */ - Observable> upsertPermission(String userLink, Permission permission, RequestOptions options); - - /** - * Replaces a permission. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the replaced permission. - * In case of failure the {@link Observable} will error. - * - * @param permission the permission to use. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the replaced permission or an error. - */ - Observable> replacePermission(Permission permission, RequestOptions options); - - /** - * Deletes a permission. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response for the deleted permission. - * In case of failure the {@link Observable} will error. - * - * @param permissionLink the permission link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response for the deleted permission or an error. - */ - Observable> deletePermission(String permissionLink, RequestOptions options); - - /** - * Reads a permission. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the read permission. - * In case of failure the {@link Observable} will error. - * - * @param permissionLink the permission link. - * @param options the request options. - * @return an {@link Observable} containing the single resource response with the read permission or an error. - */ - Observable> readPermission(String permissionLink, RequestOptions options); - - /** - * Reads all permissions. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the read permissions. - * In case of failure the {@link Observable} will error. - * - * @param permissionLink the permission link. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the read permissions or an error. - */ - Observable> readPermissions(String permissionLink, FeedOptions options); - - /** - * Query for permissions. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained permissions. - * In case of failure the {@link Observable} will error. - * - * @param permissionLink the permission link. - * @param query the query. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained permissions or an error. - */ - Observable> queryPermissions(String permissionLink, String query, FeedOptions options); - - /** - * Query for permissions. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the obtained permissions. - * In case of failure the {@link Observable} will error. - * - * @param permissionLink the permission link. - * @param querySpec the SQL query specification. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained permissions or an error. - */ - Observable> queryPermissions(String permissionLink, SqlQuerySpec querySpec, FeedOptions options); - - /** - * Replaces an offer. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the replaced offer. - * In case of failure the {@link Observable} will error. - * - * @param offer the offer to use. - * @return an {@link Observable} containing the single resource response with the replaced offer or an error. - */ - Observable> replaceOffer(Offer offer); - - /** - * Reads an offer. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the read offer. - * In case of failure the {@link Observable} will error. - * - * @param offerLink the offer link. - * @return an {@link Observable} containing the single resource response with the read offer or an error. - */ - Observable> readOffer(String offerLink); - - /** - * Reads offers. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of the read offers. - * In case of failure the {@link Observable} will error. - * - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the read offers or an error. - */ - Observable> readOffers(FeedOptions options); - - /** - * Query for offers in a database. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of obtained obtained offers. - * In case of failure the {@link Observable} will error. - * - * @param query the query. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained offers or an error. - */ - Observable> queryOffers(String query, FeedOptions options); - - /** - * Query for offers in a database. - *

- * After subscription the operation will be performed. - * The {@link Observable} will contain one or several feed response pages of obtained obtained offers. - * In case of failure the {@link Observable} will error. - * - * @param querySpec the query specification. - * @param options the feed options. - * @return an {@link Observable} containing one or several feed response pages of the obtained offers or an error. - */ - Observable> queryOffers(SqlQuerySpec querySpec, FeedOptions options); - - /** - * Gets database account information. - *

- * After subscription the operation will be performed. - * The {@link Observable} upon successful completion will contain a single resource response with the database account. - * In case of failure the {@link Observable} will error. - * - * @return an {@link Observable} containing the single resource response with the database account or an error. - */ - Observable getDatabaseAccount(); - - /** - * Close this {@link AsyncDocumentClient} instance and cleans up the resources. - */ - void close(); - -} diff --git a/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ChangeFeedQueryImpl.java b/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ChangeFeedQueryImpl.java deleted file mode 100644 index 4b988cd84bc7..000000000000 --- a/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/ChangeFeedQueryImpl.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import java.util.HashMap; -import java.util.Map; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ChangeFeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.Paths; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternal; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import com.microsoft.azure.cosmosdb.rx.internal.query.Paginator; - -import rx.Observable; -import rx.Single; -import rx.functions.Func1; -import rx.functions.Func2; - -class ChangeFeedQueryImpl { - - private static final String IfNonMatchAllHeaderValue = "*"; - private final RxDocumentClientImpl client; - private final ResourceType resourceType; - private final Class klass; - private final String documentsLink; - private final ChangeFeedOptions options; - - public ChangeFeedQueryImpl(RxDocumentClientImpl client, - ResourceType resourceType, - Class klass, - String collectionLink, - ChangeFeedOptions changeFeedOptions) { - - this.client = client; - this.resourceType = resourceType; - this.klass = klass; - this.documentsLink = Utils.joinPath(collectionLink, Paths.DOCUMENTS_PATH_SEGMENT); - changeFeedOptions = changeFeedOptions != null ? changeFeedOptions: new ChangeFeedOptions(); - - - if (resourceType.isPartitioned() && changeFeedOptions.getPartitionKeyRangeId() == null && changeFeedOptions.getPartitionKey() == null) { - throw new IllegalArgumentException(RMResources.PartitionKeyRangeIdOrPartitionKeyMustBeSpecified); - } - - if (changeFeedOptions.getPartitionKey() != null && - !Strings.isNullOrEmpty(changeFeedOptions.getPartitionKeyRangeId())) { - - throw new IllegalArgumentException(String.format( - RMResources.PartitionKeyAndParitionKeyRangeIdBothSpecified - , "feedOptions")); - } - - String initialNextIfNoneMatch = null; - - boolean canUseStartFromBeginning = true; - if (changeFeedOptions.getRequestContinuation() != null) { - initialNextIfNoneMatch = changeFeedOptions.getRequestContinuation(); - canUseStartFromBeginning = false; - } - - if(changeFeedOptions.getStartDateTime() != null){ - canUseStartFromBeginning = false; - } - - if (canUseStartFromBeginning && !changeFeedOptions.isStartFromBeginning()) { - initialNextIfNoneMatch = IfNonMatchAllHeaderValue; - } - - this.options = getChangeFeedOptions(changeFeedOptions, initialNextIfNoneMatch); - } - - private RxDocumentServiceRequest createDocumentServiceRequest(String continuationToken, int pageSize) { - Map headers = new HashMap<>(); - - if (options.getMaxItemCount() != null) { - headers.put(HttpConstants.HttpHeaders.PAGE_SIZE, String.valueOf(options.getMaxItemCount())); - } - - // On REST level, change feed is using IfNoneMatch/ETag instead of continuation. - if(continuationToken != null) { - headers.put(HttpConstants.HttpHeaders.IF_NONE_MATCH, continuationToken); - } - - headers.put(HttpConstants.HttpHeaders.A_IM, HttpConstants.A_IMHeaderValues.INCREMENTAL_FEED); - - if (options.getPartitionKey() != null) { - PartitionKeyInternal partitionKey = options.getPartitionKey().getInternalPartitionKey(); - headers.put(HttpConstants.HttpHeaders.PARTITION_KEY, partitionKey.toJson()); - } - - if(options.getStartDateTime() != null){ - String dateTimeInHttpFormat = Utils.zonedDateTimeAsUTCRFC1123(options.getStartDateTime()); - headers.put(HttpConstants.HttpHeaders.IF_MODIFIED_SINCE, dateTimeInHttpFormat); - } - - RxDocumentServiceRequest req = RxDocumentServiceRequest.create( - OperationType.ReadFeed, - resourceType, - documentsLink, - headers, - options); - - if (options.getPartitionKeyRangeId() != null) { - req.routeTo(new PartitionKeyRangeIdentity(this.options.getPartitionKeyRangeId())); - } - - return req; - } - - private ChangeFeedOptions getChangeFeedOptions(ChangeFeedOptions options, String continuationToken) { - ChangeFeedOptions newOps = new ChangeFeedOptions(options); - newOps.setRequestContinuation(continuationToken); - return newOps; - } - - public Observable> executeAsync() { - - Func2 createRequestFunc = (continuationToken, pageSize) -> this.createDocumentServiceRequest(continuationToken, pageSize); - - // TODO: clean up if we want to use single vs observable. - Func1>> executeFunc = request -> this.executeRequestAsync(request).toObservable(); - - return Paginator.getPaginatedChangeFeedQueryResultAsObservable(options, createRequestFunc, executeFunc, klass, options.getMaxItemCount() != null ? options.getMaxItemCount(): -1); - } - - private Single> executeRequestAsync(RxDocumentServiceRequest request) { - return client.readFeed(request).toSingle() - .map( rsp -> BridgeInternal.toChaneFeedResponsePage(rsp, klass)); - } -} diff --git a/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentClientImpl.java b/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentClientImpl.java deleted file mode 100644 index c64b74f03646..000000000000 --- a/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentClientImpl.java +++ /dev/null @@ -1,3175 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.microsoft.azure.cosmosdb.AccessConditionType; -import com.microsoft.azure.cosmosdb.Attachment; -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ChangeFeedOptions; -import com.microsoft.azure.cosmosdb.Conflict; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.CosmosResourceType; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DatabaseAccount; -import com.microsoft.azure.cosmosdb.DatabaseAccountManagerInternal; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedOptionsBase; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.JsonSerializable; -import com.microsoft.azure.cosmosdb.MediaOptions; -import com.microsoft.azure.cosmosdb.MediaReadMode; -import com.microsoft.azure.cosmosdb.MediaResponse; -import com.microsoft.azure.cosmosdb.Offer; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.Permission; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.StoredProcedure; -import com.microsoft.azure.cosmosdb.StoredProcedureResponse; -import com.microsoft.azure.cosmosdb.TokenResolver; -import com.microsoft.azure.cosmosdb.Trigger; -import com.microsoft.azure.cosmosdb.Undefined; -import com.microsoft.azure.cosmosdb.User; -import com.microsoft.azure.cosmosdb.UserDefinedFunction; -import com.microsoft.azure.cosmosdb.internal.BaseAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.internal.Constants; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.LifeCycleUtils; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.PathInfo; -import com.microsoft.azure.cosmosdb.internal.PathParser; -import com.microsoft.azure.cosmosdb.internal.Paths; -import com.microsoft.azure.cosmosdb.internal.PathsHelper; -import com.microsoft.azure.cosmosdb.internal.QueryCompatibilityMode; -import com.microsoft.azure.cosmosdb.internal.ResourceTokenAuthorizationHelper; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.RuntimeConstants; -import com.microsoft.azure.cosmosdb.internal.SessionContainer; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.internal.Utils; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.GatewayServiceConfigurationReader; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.ServerStoreModel; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreClient; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreClientFactory; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyAndResourceTokenPair; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternal; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxClientCollectionCache; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxCollectionCache; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxPartitionKeyRangeCache; -import com.microsoft.azure.cosmosdb.rx.internal.directconnectivity.GlobalAddressResolver; -import com.microsoft.azure.cosmosdb.rx.internal.query.DocumentQueryExecutionContextFactory; -import com.microsoft.azure.cosmosdb.rx.internal.query.IDocumentQueryClient; -import com.microsoft.azure.cosmosdb.rx.internal.query.IDocumentQueryExecutionContext; -import com.microsoft.azure.cosmosdb.rx.internal.query.Paginator; -import io.netty.buffer.ByteBuf; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import io.reactivex.netty.protocol.http.client.CompositeHttpClientBuilder; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import rx.Observable; -import rx.Single; -import rx.functions.Func1; -import rx.functions.Func2; - -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import static com.microsoft.azure.cosmosdb.BridgeInternal.documentFromObject; -import static com.microsoft.azure.cosmosdb.BridgeInternal.getAltLink; -import static com.microsoft.azure.cosmosdb.BridgeInternal.toDatabaseAccount; -import static com.microsoft.azure.cosmosdb.BridgeInternal.toFeedResponsePage; -import static com.microsoft.azure.cosmosdb.BridgeInternal.toResourceResponse; -import static com.microsoft.azure.cosmosdb.BridgeInternal.toStoredProcedureResponse; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - */ -public class RxDocumentClientImpl implements AsyncDocumentClient, IAuthorizationTokenProvider { - private final static ObjectMapper mapper = Utils.getSimpleObjectMapper(); - private final Logger logger = LoggerFactory.getLogger(RxDocumentClientImpl.class); - private final String masterKeyOrResourceToken; - private final URI serviceEndpoint; - private final ConnectionPolicy connectionPolicy; - private final ConsistencyLevel consistencyLevel; - private final BaseAuthorizationTokenProvider authorizationTokenProvider; - private final UserAgentContainer userAgentContainer; - private final boolean hasAuthKeyResourceToken; - private final Configs configs; - private TokenResolver tokenResolver; - private SessionContainer sessionContainer; - private String firstResourceTokenFromPermissionFeed = StringUtils.EMPTY; - private RxClientCollectionCache collectionCache; - private RxStoreModel gatewayProxy; - private RxStoreModel storeModel; - private GlobalAddressResolver addressResolver; - private RxPartitionKeyRangeCache partitionKeyRangeCache; - private Map> resourceTokensMap; - - // RetryPolicy retries a request when it encounters session unavailable (see ClientRetryPolicy). - // Once it exhausts all write regions it clears the session container, then it uses RxClientCollectionCache - // to resolves the request's collection name. If it differs from the session container's resource id it - // explains the session unavailable exception: somebody removed and recreated the collection. In this - // case we retry once again (with empty session token) otherwise we return the error to the client - // (see RenameCollectionAwareClientRetryPolicy) - private IRetryPolicyFactory resetSessionTokenRetryPolicy; - /** - * Compatibility mode: Allows to specify compatibility mode used by client when - * making query requests. Should be removed when application/sql is no longer - * supported. - */ - private final QueryCompatibilityMode queryCompatibilityMode = QueryCompatibilityMode.Default; - private final CompositeHttpClient rxClient; - private final GlobalEndpointManager globalEndpointManager; - private final RetryPolicy retryPolicy; - private volatile boolean useMultipleWriteLocations; - - // creator of TransportClient is responsible for disposing it. - private StoreClientFactory storeClientFactory; - - private GatewayServiceConfigurationReader gatewayConfigurationReader; - - public RxDocumentClientImpl(URI serviceEndpoint, - String masterKeyOrResourceToken, - List permissionFeed, - ConnectionPolicy connectionPolicy, - ConsistencyLevel consistencyLevel, - Configs configs, - TokenResolver tokenResolver) { - this(serviceEndpoint, masterKeyOrResourceToken, permissionFeed, connectionPolicy, consistencyLevel, configs); - this.tokenResolver = tokenResolver; - } - - public RxDocumentClientImpl(URI serviceEndpoint, - String masterKeyOrResourceToken, - List permissionFeed, - ConnectionPolicy connectionPolicy, - ConsistencyLevel consistencyLevel, - Configs configs) { - this(serviceEndpoint, masterKeyOrResourceToken, connectionPolicy, consistencyLevel, configs); - if (permissionFeed != null && permissionFeed.size() > 0) { - this.resourceTokensMap = new HashMap<>(); - for (Permission permission : permissionFeed) { - String[] segments = StringUtils.split(permission.getResourceLink(), - Constants.Properties.PATH_SEPARATOR.charAt(0)); - - if (segments.length <= 0) { - throw new IllegalArgumentException("resourceLink"); - } - - List partitionKeyAndResourceTokenPairs = null; - PathInfo pathInfo = new PathInfo(false, StringUtils.EMPTY, StringUtils.EMPTY, false); - if (!PathsHelper.tryParsePathSegments(permission.getResourceLink(), pathInfo, null)) { - throw new IllegalArgumentException(permission.getResourceLink()); - } - - partitionKeyAndResourceTokenPairs = resourceTokensMap.get(pathInfo.resourceIdOrFullName); - if (partitionKeyAndResourceTokenPairs == null) { - partitionKeyAndResourceTokenPairs = new ArrayList<>(); - this.resourceTokensMap.put(pathInfo.resourceIdOrFullName, partitionKeyAndResourceTokenPairs); - } - - PartitionKey partitionKey = permission.getResourcePartitionKey(); - partitionKeyAndResourceTokenPairs.add(new PartitionKeyAndResourceTokenPair( - partitionKey != null ? partitionKey.getInternalPartitionKey() : PartitionKeyInternal.Empty, - permission.getToken())); - logger.debug("Initializing resource token map , with map key [{}] , partition key [{}] and resource token", - pathInfo.resourceIdOrFullName, partitionKey != null ? partitionKey.toString() : null, permission.getToken()); - - } - - if(this.resourceTokensMap.isEmpty()) { - throw new IllegalArgumentException("permissionFeed"); - } - - String firstToken = permissionFeed.get(0).getToken(); - if(ResourceTokenAuthorizationHelper.isResourceToken(firstToken)) { - this.firstResourceTokenFromPermissionFeed = firstToken; - } - } - } - - public RxDocumentClientImpl(URI serviceEndpoint, String masterKeyOrResourceToken, ConnectionPolicy connectionPolicy, - ConsistencyLevel consistencyLevel, Configs configs) { - - logger.info("Initializing DocumentClient with serviceEndpoint [{}], connectionPolicy [{}], " - + "consistencyLevel [{}], protocol [{}]", serviceEndpoint, connectionPolicy, - consistencyLevel, configs.getProtocol()); - - this.configs = configs; - this.masterKeyOrResourceToken = masterKeyOrResourceToken; - this.serviceEndpoint = serviceEndpoint; - - if (masterKeyOrResourceToken != null && ResourceTokenAuthorizationHelper.isResourceToken(masterKeyOrResourceToken)) { - this.authorizationTokenProvider = null; - hasAuthKeyResourceToken = true; - } else if(masterKeyOrResourceToken != null && !ResourceTokenAuthorizationHelper.isResourceToken(masterKeyOrResourceToken)){ - hasAuthKeyResourceToken = false; - this.authorizationTokenProvider = new BaseAuthorizationTokenProvider(this.masterKeyOrResourceToken); - } else { - hasAuthKeyResourceToken = false; - this.authorizationTokenProvider = null; - } - - if (connectionPolicy != null) { - this.connectionPolicy = connectionPolicy; - } else { - this.connectionPolicy = new ConnectionPolicy(); - } - - this.sessionContainer = new SessionContainer(this.serviceEndpoint.getHost()); - this.consistencyLevel = consistencyLevel; - - this.userAgentContainer = new UserAgentContainer(); - - String userAgentSuffix = this.connectionPolicy.getUserAgentSuffix(); - if (userAgentSuffix != null && userAgentSuffix.length() > 0) { - userAgentContainer.setSuffix(userAgentSuffix); - } - - this.rxClient = httpClientBuilder().build(); - this.globalEndpointManager = new GlobalEndpointManager(asDatabaseAccountManagerInternal(), this.connectionPolicy, /**/configs); - this.retryPolicy = new RetryPolicy(this.globalEndpointManager, this.connectionPolicy); - this.resetSessionTokenRetryPolicy = retryPolicy; - } - - private void initializeGatewayConfigurationReader() { - String resourceToken; - if(this.tokenResolver != null) { - resourceToken = this.tokenResolver.getAuthorizationToken("GET", "", CosmosResourceType.System, null); - } else if(!this.hasAuthKeyResourceToken && this.authorizationTokenProvider == null) { - resourceToken = this.firstResourceTokenFromPermissionFeed; - } else { - assert this.masterKeyOrResourceToken != null; - resourceToken = this.masterKeyOrResourceToken; - } - - this.gatewayConfigurationReader = new GatewayServiceConfigurationReader(this.serviceEndpoint, - this.hasAuthKeyResourceToken, - resourceToken, - this.connectionPolicy, - this.authorizationTokenProvider, - this.rxClient); - - DatabaseAccount databaseAccount = this.gatewayConfigurationReader.initializeReaderAsync().toBlocking().value(); - this.useMultipleWriteLocations = this.connectionPolicy.isUsingMultipleWriteLocations() && BridgeInternal.isEnableMultipleWriteLocations(databaseAccount); - - // TODO: add support for openAsync - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/332589 - this.globalEndpointManager.refreshLocationAsync(databaseAccount).await(); - } - - public void init() { - - // TODO: add support for openAsync - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/332589 - this.gatewayProxy = createRxGatewayProxy(this.sessionContainer, - this.consistencyLevel, - this.queryCompatibilityMode, - this.userAgentContainer, - this.globalEndpointManager, - this.rxClient); - this.globalEndpointManager.init(); - this.initializeGatewayConfigurationReader(); - - this.collectionCache = new RxClientCollectionCache(this.sessionContainer, this.gatewayProxy, this, this.retryPolicy); - this.resetSessionTokenRetryPolicy = new ResetSessionTokenRetryPolicyFactory(this.sessionContainer, this.collectionCache, this.retryPolicy); - - this.partitionKeyRangeCache = new RxPartitionKeyRangeCache(RxDocumentClientImpl.this, - collectionCache); - - if (this.connectionPolicy.getConnectionMode() == ConnectionMode.Gateway) { - this.storeModel = this.gatewayProxy; - } else { - this.initializeDirectConnectivity(); - } - } - - private void initializeDirectConnectivity() { - - this.storeClientFactory = new StoreClientFactory( - this.configs, - this.connectionPolicy.getRequestTimeoutInMillis() / 1000, - // this.maxConcurrentConnectionOpenRequests, - 0, - this.userAgentContainer - ); - - this.addressResolver = new GlobalAddressResolver( - this.rxClient, - this.globalEndpointManager, - this.configs.getProtocol(), - this, - this.collectionCache, - this.partitionKeyRangeCache, - userAgentContainer, - // TODO: Gateway Configuration Reader - // this.gatewayConfigurationReader, - null, - this.connectionPolicy); - - this.createStoreModel(true); - } - - DatabaseAccountManagerInternal asDatabaseAccountManagerInternal() { - return new DatabaseAccountManagerInternal() { - - @Override - public URI getServiceEndpoint() { - return RxDocumentClientImpl.this.getServiceEndpoint(); - } - - @Override - public Observable getDatabaseAccountFromEndpoint(URI endpoint) { - logger.info("Getting database account endpoint from {}", endpoint); - return RxDocumentClientImpl.this.getDatabaseAccountFromEndpoint(endpoint); - } - - @Override - public ConnectionPolicy getConnectionPolicy() { - return RxDocumentClientImpl.this.getConnectionPolicy(); - } - }; - } - - RxGatewayStoreModel createRxGatewayProxy(ISessionContainer sessionContainer, - ConsistencyLevel consistencyLevel, - QueryCompatibilityMode queryCompatibilityMode, - UserAgentContainer userAgentContainer, - GlobalEndpointManager globalEndpointManager, - CompositeHttpClient rxClient) { - return new RxGatewayStoreModel(sessionContainer, - consistencyLevel, - queryCompatibilityMode, - userAgentContainer, - globalEndpointManager, - rxClient); - } - - private CompositeHttpClientBuilder httpClientBuilder() { - - HttpClientFactory factory = new HttpClientFactory(this.configs) - .withMaxIdleConnectionTimeoutInMillis(this.connectionPolicy.getIdleConnectionTimeoutInMillis()) - .withPoolSize(this.connectionPolicy.getMaxPoolSize()) - .withHttpProxy(this.connectionPolicy.getProxy()) - .withRequestTimeoutInMillis(this.connectionPolicy.getRequestTimeoutInMillis()); - - return factory.toHttpClientBuilder(); - } - - private void createStoreModel(boolean subscribeRntbdStatus) { - // EnableReadRequestsFallback, if not explicitly set on the connection policy, - // is false if the account's consistency is bounded staleness, - // and true otherwise. - - StoreClient storeClient = this.storeClientFactory.createStoreClient( - this.addressResolver, - this.sessionContainer, - this.gatewayConfigurationReader, - this, - false - ); - - this.storeModel = new ServerStoreModel(storeClient); - } - - - @Override - public URI getServiceEndpoint() { - return this.serviceEndpoint; - } - - @Override - public URI getWriteEndpoint() { - return globalEndpointManager.getWriteEndpoints().stream().findFirst().map(loc -> { - try { - return loc.toURI(); - } catch (URISyntaxException e) { - throw new IllegalStateException(e); - } - }).orElse(null); - } - - @Override - public URI getReadEndpoint() { - return globalEndpointManager.getReadEndpoints().stream().findFirst().map(loc -> { - try { - return loc.toURI(); - } catch (URISyntaxException e) { - throw new IllegalStateException(e); - } - }).orElse(null); - } - - @Override - public ConnectionPolicy getConnectionPolicy() { - return this.connectionPolicy; - } - - @Override - public Observable> createDatabase(Database database, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> createDatabaseInternal(database, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> createDatabaseInternal(Database database, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - - if (database == null) { - throw new IllegalArgumentException("Database"); - } - - logger.debug("Creating a Database. id: [{}]", database.getId()); - validateResource(database); - - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Create, - ResourceType.Database, Paths.DATABASES_ROOT, database, requestHeaders, options); - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - return this.create(request).map(response -> toResourceResponse(response, Database.class)); - } catch (Exception e) { - logger.debug("Failure in creating a database. due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> deleteDatabase(String databaseLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> deleteDatabaseInternal(databaseLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> deleteDatabaseInternal(String databaseLink, RequestOptions options, - IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (StringUtils.isEmpty(databaseLink)) { - throw new IllegalArgumentException("databaseLink"); - } - - logger.debug("Deleting a Database. databaseLink: [{}]", databaseLink); - String path = Utils.joinPath(databaseLink, null); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Delete, - ResourceType.Database, path, requestHeaders, options); - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.delete(request).map(response -> toResourceResponse(response, Database.class)); - } catch (Exception e) { - logger.debug("Failure in deleting a database. due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readDatabase(String databaseLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> readDatabaseInternal(databaseLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> readDatabaseInternal(String databaseLink, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (StringUtils.isEmpty(databaseLink)) { - throw new IllegalArgumentException("databaseLink"); - } - - logger.debug("Reading a Database. databaseLink: [{}]", databaseLink); - String path = Utils.joinPath(databaseLink, null); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.Database, path, requestHeaders, options); - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - return this.read(request).map(response -> toResourceResponse(response, Database.class)); - } catch (Exception e) { - logger.debug("Failure in reading a database. due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readDatabases(FeedOptions options) { - return readFeed(options, ResourceType.Database, Database.class, Paths.DATABASES_ROOT); - } - - private String parentResourceLinkToQueryLink(String parentResouceLink, ResourceType resourceTypeEnum) { - switch (resourceTypeEnum) { - case Database: - return Paths.DATABASES_ROOT; - - case DocumentCollection: - return Utils.joinPath(parentResouceLink, Paths.COLLECTIONS_PATH_SEGMENT); - - case Document: - return Utils.joinPath(parentResouceLink, Paths.DOCUMENTS_PATH_SEGMENT); - - case Offer: - return Paths.OFFERS_ROOT; - - case User: - return Utils.joinPath(parentResouceLink, Paths.USERS_PATH_SEGMENT); - - case Permission: - return Utils.joinPath(parentResouceLink, Paths.PERMISSIONS_PATH_SEGMENT); - - case Attachment: - return Utils.joinPath(parentResouceLink, Paths.ATTACHMENTS_PATH_SEGMENT); - - case StoredProcedure: - return Utils.joinPath(parentResouceLink, Paths.STORED_PROCEDURES_PATH_SEGMENT); - - case Trigger: - return Utils.joinPath(parentResouceLink, Paths.TRIGGERS_PATH_SEGMENT); - - case UserDefinedFunction: - return Utils.joinPath(parentResouceLink, Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT); - - default: - throw new IllegalArgumentException("resource type not supported"); - } - } - - private Observable> createQuery( - String parentResourceLink, - SqlQuerySpec sqlQuery, - FeedOptions options, - Class klass, - ResourceType resourceTypeEnum) { - - String queryResourceLink = parentResourceLinkToQueryLink(parentResourceLink, resourceTypeEnum); - - UUID activityId = Utils.randomUUID(); - IDocumentQueryClient queryClient = DocumentQueryClientImpl(RxDocumentClientImpl.this); - Observable> executionContext = - DocumentQueryExecutionContextFactory.createDocumentQueryExecutionContextAsync(queryClient, resourceTypeEnum, klass, sqlQuery , options, queryResourceLink, false, activityId); - return executionContext.single().flatMap(ex -> { - return ex.executeAsync(); - }); - } - - - @Override - public Observable> queryDatabases(String query, FeedOptions options) { - return queryDatabases(new SqlQuerySpec(query), options); - } - - - @Override - public Observable> queryDatabases(SqlQuerySpec querySpec, FeedOptions options) { - return createQuery(Paths.DATABASES_ROOT, querySpec, options, Database.class, ResourceType.Database); - } - - @Override - public Observable> createCollection(String databaseLink, - DocumentCollection collection, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> this.createCollectionInternal(databaseLink, collection, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> createCollectionInternal(String databaseLink, - DocumentCollection collection, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (StringUtils.isEmpty(databaseLink)) { - throw new IllegalArgumentException("databaseLink"); - } - if (collection == null) { - throw new IllegalArgumentException("collection"); - } - - logger.debug("Creating a Collection. databaseLink: [{}], Collection id: [{}]", databaseLink, - collection.getId()); - validateResource(collection); - - String path = Utils.joinPath(databaseLink, Paths.COLLECTIONS_PATH_SEGMENT); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Create, - ResourceType.DocumentCollection, path, collection, requestHeaders, options); - - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.create(request).map(response -> toResourceResponse(response, DocumentCollection.class)) - .doOnNext(resourceResponse -> { - // set the session token - this.sessionContainer.setSessionToken(resourceResponse.getResource().getResourceId(), - getAltLink(resourceResponse.getResource()), - resourceResponse.getResponseHeaders()); - }); - } catch (Exception e) { - logger.debug("Failure in creating a collection. due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> replaceCollection(DocumentCollection collection, - RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> replaceCollectionInternal(collection, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> replaceCollectionInternal(DocumentCollection collection, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (collection == null) { - throw new IllegalArgumentException("collection"); - } - - logger.debug("Replacing a Collection. id: [{}]", collection.getId()); - validateResource(collection); - - String path = Utils.joinPath(collection.getSelfLink(), null); - Map requestHeaders = this.getRequestHeaders(options); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Replace, - ResourceType.DocumentCollection, path, collection, requestHeaders, options); - - // TODO: .Net has some logic for updating session token which we don't - // have here - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.replace(request).map(response -> toResourceResponse(response, DocumentCollection.class)) - .doOnNext(resourceResponse -> { - if (resourceResponse.getResource() != null) { - // set the session token - this.sessionContainer.setSessionToken(resourceResponse.getResource().getResourceId(), - getAltLink(resourceResponse.getResource()), - resourceResponse.getResponseHeaders()); - } - }); - - } catch (Exception e) { - logger.debug("Failure in replacing a collection. due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> deleteCollection(String collectionLink, - RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> deleteCollectionInternal(collectionLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> deleteCollectionInternal(String collectionLink, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (StringUtils.isEmpty(collectionLink)) { - throw new IllegalArgumentException("collectionLink"); - } - - logger.debug("Deleting a Collection. collectionLink: [{}]", collectionLink); - String path = Utils.joinPath(collectionLink, null); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Delete, - ResourceType.DocumentCollection, path, requestHeaders, options); - - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.delete(request).map(response -> toResourceResponse(response, DocumentCollection.class)); - - } catch (Exception e) { - logger.debug("Failure in deleting a collection, due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - private Observable delete(RxDocumentServiceRequest request) { - populateHeaders(request, HttpConstants.HttpMethods.DELETE); - return getStoreProxy(request).processMessage(request); - } - - private Observable read(RxDocumentServiceRequest request) { - populateHeaders(request, HttpConstants.HttpMethods.GET); - return getStoreProxy(request).processMessage(request); - } - - Observable readFeed(RxDocumentServiceRequest request) { - populateHeaders(request, HttpConstants.HttpMethods.GET); - return gatewayProxy.processMessage(request); - } - - private Observable query(RxDocumentServiceRequest request) { - populateHeaders(request, HttpConstants.HttpMethods.POST); - return this.getStoreProxy(request).processMessage(request) - .map(response -> { - this.captureSessionToken(request, response); - return response; - } - ); - } - - @Override - public Observable> readCollection(String collectionLink, - RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> readCollectionInternal(collectionLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> readCollectionInternal(String collectionLink, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - - // we are using an observable factory here - // observable will be created fresh upon subscription - // this is to ensure we capture most up to date information (e.g., - // session) - try { - if (StringUtils.isEmpty(collectionLink)) { - throw new IllegalArgumentException("collectionLink"); - } - - logger.debug("Reading a Collection. collectionLink: [{}]", collectionLink); - String path = Utils.joinPath(collectionLink, null); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.DocumentCollection, path, requestHeaders, options); - - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - return this.read(request).map(response -> toResourceResponse(response, DocumentCollection.class)); - } catch (Exception e) { - // this is only in trace level to capture what's going on - logger.debug("Failure in reading a collection, due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readCollections(String databaseLink, FeedOptions options) { - - if (StringUtils.isEmpty(databaseLink)) { - throw new IllegalArgumentException("databaseLink"); - } - - return readFeed(options, ResourceType.DocumentCollection, DocumentCollection.class, - Utils.joinPath(databaseLink, Paths.COLLECTIONS_PATH_SEGMENT)); - } - - @Override - public Observable> queryCollections(String databaseLink, String query, - FeedOptions options) { - return createQuery(databaseLink, new SqlQuerySpec(query), options, DocumentCollection.class, ResourceType.DocumentCollection); - } - - @Override - public Observable> queryCollections(String databaseLink, - SqlQuerySpec querySpec, FeedOptions options) { - return createQuery(databaseLink, querySpec, options, DocumentCollection.class, ResourceType.DocumentCollection); - } - - private static String serializeProcedureParams(Object[] objectArray) { - String[] stringArray = new String[objectArray.length]; - - for (int i = 0; i < objectArray.length; ++i) { - Object object = objectArray[i]; - if (object instanceof JsonSerializable) { - stringArray[i] = ((JsonSerializable) object).toJson(); - } else { - - // POJO, ObjectNode, number, String or Boolean - try { - stringArray[i] = mapper.writeValueAsString(object); - } catch (IOException e) { - throw new IllegalArgumentException("Can't serialize the object into the json string", e); - } - } - } - - return String.format("[%s]", StringUtils.join(stringArray, ",")); - } - - private static void validateResource(Resource resource) { - if (!StringUtils.isEmpty(resource.getId())) { - if (resource.getId().indexOf('/') != -1 || resource.getId().indexOf('\\') != -1 || - resource.getId().indexOf('?') != -1 || resource.getId().indexOf('#') != -1) { - throw new IllegalArgumentException("Id contains illegal chars."); - } - - if (resource.getId().endsWith(" ")) { - throw new IllegalArgumentException("Id ends with a space."); - } - } - } - - private Map getRequestHeaders(RequestOptions options) { - Map headers = new HashMap<>(); - - if (this.useMultipleWriteLocations) { - headers.put(HttpConstants.HttpHeaders.ALLOW_TENTATIVE_WRITES, Boolean.TRUE.toString()); - } - - if (consistencyLevel != null) { - headers.put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, consistencyLevel.name()); - } - - if (options == null) { - return headers; - } - - Map customOptions = options.getHeaders(); - if (customOptions != null) { - headers.putAll(customOptions); - } - - if (options.getAccessCondition() != null) { - if (options.getAccessCondition().getType() == AccessConditionType.IfMatch) { - headers.put(HttpConstants.HttpHeaders.IF_MATCH, options.getAccessCondition().getCondition()); - } else { - headers.put(HttpConstants.HttpHeaders.IF_NONE_MATCH, options.getAccessCondition().getCondition()); - } - } - - if (options.getConsistencyLevel() != null) { - headers.put(HttpConstants.HttpHeaders.CONSISTENCY_LEVEL, options.getConsistencyLevel().name()); - } - - if (options.getIndexingDirective() != null) { - headers.put(HttpConstants.HttpHeaders.INDEXING_DIRECTIVE, options.getIndexingDirective().name()); - } - - if (options.getPostTriggerInclude() != null && options.getPostTriggerInclude().size() > 0) { - String postTriggerInclude = StringUtils.join(options.getPostTriggerInclude(), ","); - headers.put(HttpConstants.HttpHeaders.POST_TRIGGER_INCLUDE, postTriggerInclude); - } - - if (options.getPreTriggerInclude() != null && options.getPreTriggerInclude().size() > 0) { - String preTriggerInclude = StringUtils.join(options.getPreTriggerInclude(), ","); - headers.put(HttpConstants.HttpHeaders.PRE_TRIGGER_INCLUDE, preTriggerInclude); - } - - if (!Strings.isNullOrEmpty(options.getSessionToken())) { - headers.put(HttpConstants.HttpHeaders.SESSION_TOKEN, options.getSessionToken()); - } - - if (options.getResourceTokenExpirySeconds() != null) { - headers.put(HttpConstants.HttpHeaders.RESOURCE_TOKEN_EXPIRY, - String.valueOf(options.getResourceTokenExpirySeconds())); - } - - if (options.getOfferThroughput() != null && options.getOfferThroughput() >= 0) { - headers.put(HttpConstants.HttpHeaders.OFFER_THROUGHPUT, options.getOfferThroughput().toString()); - } else if (options.getOfferType() != null) { - headers.put(HttpConstants.HttpHeaders.OFFER_TYPE, options.getOfferType()); - } - - if (options.getPartitionKey() != null) { - headers.put(HttpConstants.HttpHeaders.PARTITION_KEY, options.getPartitionKey().toString()); - } - - if (options.isPopulateQuotaInfo()) { - headers.put(HttpConstants.HttpHeaders.POPULATE_QUOTA_INFO, String.valueOf(true)); - } - - if (options.isScriptLoggingEnabled()) { - headers.put(HttpConstants.HttpHeaders.SCRIPT_ENABLE_LOGGING, String.valueOf(true)); - } - - return headers; - } - - private Map getFeedHeaders(FeedOptionsBase options) { - return BridgeInternal.getFeedHeaders(options); - } - - private Map getMediaHeaders(MediaOptions options) { - Map requestHeaders = new HashMap<>(); - - if (options == null || StringUtils.isEmpty(options.getContentType())) { - requestHeaders.put(HttpConstants.HttpHeaders.CONTENT_TYPE, RuntimeConstants.MediaTypes.OCTET_STREAM); - } - - if (options != null) { - if (!StringUtils.isEmpty(options.getContentType())) { - requestHeaders.put(HttpConstants.HttpHeaders.CONTENT_TYPE, options.getContentType()); - } - - if (!StringUtils.isEmpty(options.getSlug())) { - requestHeaders.put(HttpConstants.HttpHeaders.SLUG, options.getSlug()); - } - } - return requestHeaders; - } - - private Single addPartitionKeyInformation(RxDocumentServiceRequest request, Document document, - RequestOptions options) { - - Single collectionObs = this.collectionCache.resolveCollectionAsync(request); - return collectionObs - .map(collection -> { - addPartitionKeyInformation(request, document, options, collection); - return request; - }); - } - - private Single addPartitionKeyInformation(RxDocumentServiceRequest request, Document document, RequestOptions options, - Single collectionObs) { - - return collectionObs.map(collection -> { - addPartitionKeyInformation(request, document, options, collection); - return request; - }); - } - - private void addPartitionKeyInformation(RxDocumentServiceRequest request, Document document, RequestOptions options, - DocumentCollection collection) { - PartitionKeyDefinition partitionKeyDefinition = collection.getPartitionKey(); - - PartitionKeyInternal partitionKeyInternal = null; - if (options != null && options.getPartitionKey() != null) { - partitionKeyInternal = options.getPartitionKey().getInternalPartitionKey(); - } else if (partitionKeyDefinition == null || partitionKeyDefinition.getPaths().size() == 0) { - // For backward compatibility, if collection doesn't have partition key defined, we assume all documents - // have empty value for it and user doesn't need to specify it explicitly. - partitionKeyInternal = PartitionKeyInternal.getEmpty(); - } else if (document != null) { - partitionKeyInternal = extractPartitionKeyValueFromDocument(document, partitionKeyDefinition); - } else { - throw new UnsupportedOperationException("PartitionKey value must be supplied for this operation."); - } - - request.getHeaders().put(HttpConstants.HttpHeaders.PARTITION_KEY, escapeNonAscii(partitionKeyInternal.toJson())); - } - - private static String escapeNonAscii(String partitionKeyJson) { - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < partitionKeyJson.length(); i++) { - int val = partitionKeyJson.charAt(i); - if (val > 127) { - sb.append("\\u").append(String.format("%04X", val)); - } else { - sb.append(partitionKeyJson.charAt(i)); - } - } - return sb.toString(); - } - - private static PartitionKeyInternal extractPartitionKeyValueFromDocument( - Document document, - PartitionKeyDefinition partitionKeyDefinition) { - if (partitionKeyDefinition != null) { - String path = partitionKeyDefinition.getPaths().iterator().next(); - List parts = PathParser.getPathParts(path); - if (parts.size() >= 1) { - Object value = document.getObjectByPath(parts); - if (value == null || value.getClass() == ObjectNode.class) { - value = Undefined.Value(); - } - - return PartitionKeyInternal.fromObjectArray(Collections.singletonList(value), false); - } - } - - return null; - } - - private Single getCreateDocumentRequest(String documentCollectionLink, Object document, - RequestOptions options, boolean disableAutomaticIdGeneration, OperationType operationType) { - - if (StringUtils.isEmpty(documentCollectionLink)) { - throw new IllegalArgumentException("documentCollectionLink"); - } - if (document == null) { - throw new IllegalArgumentException("document"); - } - - Document typedDocument = documentFromObject(document, mapper); - - RxDocumentClientImpl.validateResource(typedDocument); - - if (typedDocument.getId() == null && !disableAutomaticIdGeneration) { - // We are supposed to use GUID. Basically UUID is the same as GUID - // when represented as a string. - typedDocument.setId(UUID.randomUUID().toString()); - } - String path = Utils.joinPath(documentCollectionLink, Paths.DOCUMENTS_PATH_SEGMENT); - Map requestHeaders = this.getRequestHeaders(options); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, ResourceType.Document, path, - typedDocument, requestHeaders, options); - - Single collectionObs = this.collectionCache.resolveCollectionAsync(request); - return addPartitionKeyInformation(request, typedDocument, options, collectionObs); - } - - private void populateHeaders(RxDocumentServiceRequest request, String httpMethod) { - if (this.masterKeyOrResourceToken != null) { - request.getHeaders().put(HttpConstants.HttpHeaders.X_DATE, Utils.nowAsRFC1123()); - } - - if (this.masterKeyOrResourceToken != null || this.resourceTokensMap != null || this.tokenResolver != null) { - String resourceName = request.getResourceAddress(); - - String authorization = this.getUserAuthorizationToken( - resourceName, request.getResourceType(), httpMethod, request.getHeaders(), - AuthorizationTokenType.PrimaryMasterKey, request.properties); - try { - authorization = URLEncoder.encode(authorization, "UTF-8"); - } catch (UnsupportedEncodingException e) { - throw new IllegalStateException("Failed to encode authtoken.", e); - } - request.getHeaders().put(HttpConstants.HttpHeaders.AUTHORIZATION, authorization); - } - - if ((HttpConstants.HttpMethods.POST.equals(httpMethod) || HttpConstants.HttpMethods.PUT.equals(httpMethod)) - && !request.getHeaders().containsKey(HttpConstants.HttpHeaders.CONTENT_TYPE)) { - request.getHeaders().put(HttpConstants.HttpHeaders.CONTENT_TYPE, RuntimeConstants.MediaTypes.JSON); - } - - if (!request.getHeaders().containsKey(HttpConstants.HttpHeaders.ACCEPT)) { - request.getHeaders().put(HttpConstants.HttpHeaders.ACCEPT, RuntimeConstants.MediaTypes.JSON); - } - } - - @Override - public String getUserAuthorizationToken(String resourceName, - ResourceType resourceType, - String requestVerb, - Map headers, - AuthorizationTokenType tokenType, - Map properties) { - - if (this.tokenResolver != null) { - return this.tokenResolver.getAuthorizationToken(requestVerb, resourceName, this.resolveCosmosResourceType(resourceType), - properties != null ? Collections.unmodifiableMap(properties) : null); - } else if (masterKeyOrResourceToken != null && !hasAuthKeyResourceToken) { - return this.authorizationTokenProvider.generateKeyAuthorizationSignature(requestVerb, resourceName, - resourceType, headers); - } else if (masterKeyOrResourceToken != null && hasAuthKeyResourceToken && resourceTokensMap == null) { - return masterKeyOrResourceToken; - } else { - assert resourceTokensMap != null; - if(resourceType.equals(ResourceType.DatabaseAccount)) { - return this.firstResourceTokenFromPermissionFeed; - } - return ResourceTokenAuthorizationHelper.getAuthorizationTokenUsingResourceTokens(resourceTokensMap, requestVerb, resourceName, headers); - } - } - - private CosmosResourceType resolveCosmosResourceType(ResourceType resourceType) { - try { - return CosmosResourceType.valueOf(resourceType.name()); - } catch (IllegalArgumentException e) { - return CosmosResourceType.System; - } - } - - void captureSessionToken(RxDocumentServiceRequest request, RxDocumentServiceResponse response) { - this.sessionContainer.setSessionToken(request, response.getResponseHeaders()); - } - - private Observable create(RxDocumentServiceRequest request) { - populateHeaders(request, HttpConstants.HttpMethods.POST); - RxStoreModel storeProxy = this.getStoreProxy(request); - return storeProxy.processMessage(request); - } - - private Observable upsert(RxDocumentServiceRequest request) { - - populateHeaders(request, HttpConstants.HttpMethods.POST); - Map headers = request.getHeaders(); - // headers can never be null, since it will be initialized even when no - // request options are specified, - // hence using assertion here instead of exception, being in the private - // method - assert (headers != null); - headers.put(HttpConstants.HttpHeaders.IS_UPSERT, "true"); - - return getStoreProxy(request).processMessage(request) - .map(response -> { - this.captureSessionToken(request, response); - return response; - } - ); - } - - private Observable replace(RxDocumentServiceRequest request) { - populateHeaders(request, HttpConstants.HttpMethods.PUT); - return getStoreProxy(request).processMessage(request); - } - - @Override - public Observable> createDocument(String collectionLink, Object document, - RequestOptions options, boolean disableAutomaticIdGeneration) { - IDocumentClientRetryPolicy requestRetryPolicy = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - if (options == null || options.getPartitionKey() == null) { - requestRetryPolicy = new PartitionKeyMismatchRetryPolicy(collectionCache, requestRetryPolicy, collectionLink, options); - } - - IDocumentClientRetryPolicy finalRetryPolicyInstance = requestRetryPolicy; - return ObservableHelper.inlineIfPossibleAsObs(() -> createDocumentInternal(collectionLink, document, options, disableAutomaticIdGeneration, finalRetryPolicyInstance), requestRetryPolicy); - } - - private Observable> createDocumentInternal(String collectionLink, Object document, - RequestOptions options, final boolean disableAutomaticIdGeneration, IDocumentClientRetryPolicy requestRetryPolicy) { - - try { - logger.debug("Creating a Document. collectionLink: [{}]", collectionLink); - - Single requestObs = getCreateDocumentRequest(collectionLink, document, - options, disableAutomaticIdGeneration, OperationType.Create); - - Observable responseObservable = requestObs - .toObservable() - .flatMap(req -> { - if (requestRetryPolicy != null) { - requestRetryPolicy.onBeforeSendRequest(req); - } - - return create(req); - }); - - Observable> createObservable = - responseObservable - .map(serviceResponse -> { - return toResourceResponse(serviceResponse, Document.class); - }); - - return createObservable; - - } catch (Exception e) { - logger.debug("Failure in creating a document due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> upsertDocument(String collectionLink, Object document, - RequestOptions options, boolean disableAutomaticIdGeneration) { - - IDocumentClientRetryPolicy requestRetryPolicy = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - if (options == null || options.getPartitionKey() == null) { - requestRetryPolicy = new PartitionKeyMismatchRetryPolicy(collectionCache, requestRetryPolicy, collectionLink, options); - } - IDocumentClientRetryPolicy finalRetryPolicyInstance = requestRetryPolicy; - return ObservableHelper.inlineIfPossibleAsObs(() -> upsertDocumentInternal(collectionLink, document, options, disableAutomaticIdGeneration, finalRetryPolicyInstance), requestRetryPolicy); - } - - private Observable> upsertDocumentInternal(String collectionLink, Object document, - RequestOptions options, boolean disableAutomaticIdGeneration, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - logger.debug("Upserting a Document. collectionLink: [{}]", collectionLink); - - Observable reqObs = getCreateDocumentRequest(collectionLink, document, - options, disableAutomaticIdGeneration, OperationType.Upsert).toObservable(); - - Observable responseObservable = reqObs.flatMap(req -> { - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(req); - } - - return upsert(req);}); - return responseObservable - .map(serviceResponse -> toResourceResponse(serviceResponse, Document.class)); - - } catch (Exception e) { - logger.debug("Failure in upserting a document due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> replaceDocument(String documentLink, Object document, - RequestOptions options) { - - IDocumentClientRetryPolicy requestRetryPolicy = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - if (options == null || options.getPartitionKey() == null) { - String collectionLink = Utils.getCollectionName(documentLink); - requestRetryPolicy = new PartitionKeyMismatchRetryPolicy(collectionCache, requestRetryPolicy, collectionLink, options); - } - IDocumentClientRetryPolicy finalRequestRetryPolicy = requestRetryPolicy; - return ObservableHelper.inlineIfPossibleAsObs(() -> replaceDocumentInternal(documentLink, document, options, finalRequestRetryPolicy), requestRetryPolicy); - } - - private Observable> replaceDocumentInternal(String documentLink, Object document, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (StringUtils.isEmpty(documentLink)) { - throw new IllegalArgumentException("documentLink"); - } - - if (document == null) { - throw new IllegalArgumentException("document"); - } - - Document typedDocument = documentFromObject(document, mapper); - - return this.replaceDocumentInternal(documentLink, typedDocument, options, retryPolicyInstance); - - } catch (Exception e) { - logger.debug("Failure in replacing a document due to [{}]", e.getMessage()); - return Observable.error(e); - } - } - - @Override - public Observable> replaceDocument(Document document, RequestOptions options) { - IDocumentClientRetryPolicy requestRetryPolicy = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - if (options == null || options.getPartitionKey() == null) { - String collectionLink = document.getSelfLink(); - requestRetryPolicy = new PartitionKeyMismatchRetryPolicy(collectionCache, requestRetryPolicy, collectionLink, options); - } - IDocumentClientRetryPolicy finalRequestRetryPolicy = requestRetryPolicy; - return ObservableHelper.inlineIfPossibleAsObs(() -> replaceDocumentInternal(document, options, finalRequestRetryPolicy), requestRetryPolicy); - } - - private Observable> replaceDocumentInternal(Document document, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - if (document == null) { - throw new IllegalArgumentException("document"); - } - - return this.replaceDocumentInternal(document.getSelfLink(), document, options, retryPolicyInstance); - - } catch (Exception e) { - logger.debug("Failure in replacing a database due to [{}]", e.getMessage()); - return Observable.error(e); - } - } - - private Observable> replaceDocumentInternal(String documentLink, Document document, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - - if (document == null) { - throw new IllegalArgumentException("document"); - } - - logger.debug("Replacing a Document. documentLink: [{}]", documentLink); - final String path = Utils.joinPath(documentLink, null); - final Map requestHeaders = getRequestHeaders(options); - final RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Replace, - ResourceType.Document, path, document, requestHeaders, options); - - validateResource(document); - - Single collectionObs = collectionCache.resolveCollectionAsync(request); - Single requestObs = addPartitionKeyInformation(request, document, options, collectionObs); - - return requestObs.toObservable().flatMap(req -> { - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - return replace(request) - .map(resp -> toResourceResponse(resp, Document.class));} ); - } - - @Override - public Observable> deleteDocument(String documentLink, RequestOptions options) { - IDocumentClientRetryPolicy requestRetryPolicy = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> deleteDocumentInternal(documentLink, options, requestRetryPolicy), requestRetryPolicy); - } - - private Observable> deleteDocumentInternal(String documentLink, RequestOptions options, - IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (StringUtils.isEmpty(documentLink)) { - throw new IllegalArgumentException("documentLink"); - } - - logger.debug("Deleting a Document. documentLink: [{}]", documentLink); - String path = Utils.joinPath(documentLink, null); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Delete, - ResourceType.Document, path, requestHeaders, options); - - Single collectionObs = collectionCache.resolveCollectionAsync(request); - - Single requestObs = addPartitionKeyInformation(request, null, options, collectionObs); - - return requestObs.toObservable().flatMap(req -> { - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(req); - } - return this.delete(req) - .map(serviceResponse -> toResourceResponse(serviceResponse, Document.class));}); - - } catch (Exception e) { - logger.debug("Failure in deleting a document due to [{}]", e.getMessage()); - return Observable.error(e); - } - } - - @Override - public Observable> readDocument(String documentLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> readDocumentInternal(documentLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> readDocumentInternal(String documentLink, RequestOptions options, - IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (StringUtils.isEmpty(documentLink)) { - throw new IllegalArgumentException("documentLink"); - } - - logger.debug("Reading a Document. documentLink: [{}]", documentLink); - String path = Utils.joinPath(documentLink, null); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.Document, path, requestHeaders, options); - - Single collectionObs = this.collectionCache.resolveCollectionAsync(request); - - Single requestObs = addPartitionKeyInformation(request, null, options, collectionObs); - - return requestObs.toObservable().flatMap(req -> { - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - return this.read(request).map(serviceResponse -> toResourceResponse(serviceResponse, Document.class)); - }); - - } catch (Exception e) { - logger.debug("Failure in reading a document due to [{}]", e.getMessage()); - return Observable.error(e); - } - } - - @Override - public Observable> readDocuments(String collectionLink, FeedOptions options) { - - if (StringUtils.isEmpty(collectionLink)) { - throw new IllegalArgumentException("collectionLink"); - } - - return queryDocuments(collectionLink, "SELECT * FROM r", options); - } - - @Override - public Observable> queryDocuments(String collectionLink, String query, - FeedOptions options) { - return queryDocuments(collectionLink, new SqlQuerySpec(query), options); - } - - private IDocumentQueryClient DocumentQueryClientImpl(RxDocumentClientImpl rxDocumentClientImpl) { - - return new IDocumentQueryClient () { - - @Override - public RxCollectionCache getCollectionCache() { - return RxDocumentClientImpl.this.collectionCache; - } - - @Override - public RxPartitionKeyRangeCache getPartitionKeyRangeCache() { - return RxDocumentClientImpl.this.partitionKeyRangeCache; - } - - @Override - public IRetryPolicyFactory getResetSessionTokenRetryPolicy() { - return RxDocumentClientImpl.this.resetSessionTokenRetryPolicy; - } - - @Override - public ConsistencyLevel getDefaultConsistencyLevelAsync() { - return RxDocumentClientImpl.this.gatewayConfigurationReader.getDefaultConsistencyLevel(); - } - - @Override - public ConsistencyLevel getDesiredConsistencyLevelAsync() { - // TODO Auto-generated method stub - return RxDocumentClientImpl.this.consistencyLevel; - } - - @Override - public Single executeQueryAsync(RxDocumentServiceRequest request) { - return RxDocumentClientImpl.this.query(request).toSingle(); - } - - @Override - public QueryCompatibilityMode getQueryCompatibilityMode() { - // TODO Auto-generated method stub - return QueryCompatibilityMode.Default; - } - - @Override - public Single readFeedAsync(RxDocumentServiceRequest request) { - // TODO Auto-generated method stub - return null; - } - }; - } - - @Override - public Observable> queryDocuments(String collectionLink, SqlQuerySpec querySpec, - FeedOptions options) { - return createQuery(collectionLink, querySpec, options, Document.class, ResourceType.Document); - } - - @Override - public Observable> queryDocumentChangeFeed(final String collectionLink, - final ChangeFeedOptions changeFeedOptions) { - - if (StringUtils.isEmpty(collectionLink)) { - throw new IllegalArgumentException("collectionLink"); - } - - ChangeFeedQueryImpl changeFeedQueryImpl = new ChangeFeedQueryImpl(this, ResourceType.Document, - Document.class, collectionLink, changeFeedOptions); - - return changeFeedQueryImpl.executeAsync(); - } - - @Override - public Observable> readPartitionKeyRanges(final String collectionLink, - FeedOptions options) { - - if (StringUtils.isEmpty(collectionLink)) { - throw new IllegalArgumentException("collectionLink"); - } - - return readFeed(options, ResourceType.PartitionKeyRange, PartitionKeyRange.class, - Utils.joinPath(collectionLink, Paths.PARTITION_KEY_RANGES_PATH_SEGMENT)); - } - - private RxDocumentServiceRequest getStoredProcedureRequest(String collectionLink, StoredProcedure storedProcedure, - RequestOptions options, OperationType operationType) { - if (StringUtils.isEmpty(collectionLink)) { - throw new IllegalArgumentException("collectionLink"); - } - if (storedProcedure == null) { - throw new IllegalArgumentException("storedProcedure"); - } - - validateResource(storedProcedure); - - String path = Utils.joinPath(collectionLink, Paths.STORED_PROCEDURES_PATH_SEGMENT); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, ResourceType.StoredProcedure, - path, storedProcedure, requestHeaders, options); - - return request; - } - - private RxDocumentServiceRequest getUserDefinedFunctionRequest(String collectionLink, UserDefinedFunction udf, - RequestOptions options, OperationType operationType) { - if (StringUtils.isEmpty(collectionLink)) { - throw new IllegalArgumentException("collectionLink"); - } - if (udf == null) { - throw new IllegalArgumentException("udf"); - } - - validateResource(udf); - - String path = Utils.joinPath(collectionLink, Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, - ResourceType.UserDefinedFunction, path, udf, requestHeaders, options); - - return request; - } - - @Override - public Observable> createStoredProcedure(String collectionLink, - StoredProcedure storedProcedure, RequestOptions options) { - IDocumentClientRetryPolicy requestRetryPolicy = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> createStoredProcedureInternal(collectionLink, storedProcedure, options, requestRetryPolicy), requestRetryPolicy); - } - - private Observable> createStoredProcedureInternal(String collectionLink, - StoredProcedure storedProcedure, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - // we are using an observable factory here - // observable will be created fresh upon subscription - // this is to ensure we capture most up to date information (e.g., - // session) - try { - - logger.debug("Creating a StoredProcedure. collectionLink: [{}], storedProcedure id [{}]", - collectionLink, storedProcedure.getId()); - RxDocumentServiceRequest request = getStoredProcedureRequest(collectionLink, storedProcedure, options, - OperationType.Create); - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.create(request).map(response -> toResourceResponse(response, StoredProcedure.class)); - - } catch (Exception e) { - // this is only in trace level to capture what's going on - logger.debug("Failure in creating a StoredProcedure due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> upsertStoredProcedure(String collectionLink, - StoredProcedure storedProcedure, RequestOptions options) { - IDocumentClientRetryPolicy requestRetryPolicy = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> upsertStoredProcedureInternal(collectionLink, storedProcedure, options, requestRetryPolicy), requestRetryPolicy); - } - - private Observable> upsertStoredProcedureInternal(String collectionLink, - StoredProcedure storedProcedure, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - // we are using an observable factory here - // observable will be created fresh upon subscription - // this is to ensure we capture most up to date information (e.g., - // session) - try { - - logger.debug("Upserting a StoredProcedure. collectionLink: [{}], storedProcedure id [{}]", - collectionLink, storedProcedure.getId()); - RxDocumentServiceRequest request = getStoredProcedureRequest(collectionLink, storedProcedure, options, - OperationType.Upsert); - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.upsert(request).map(response -> toResourceResponse(response, StoredProcedure.class)); - - } catch (Exception e) { - // this is only in trace level to capture what's going on - logger.debug("Failure in upserting a StoredProcedure due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> replaceStoredProcedure(StoredProcedure storedProcedure, - RequestOptions options) { - IDocumentClientRetryPolicy requestRetryPolicy = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> replaceStoredProcedureInternal(storedProcedure, options, requestRetryPolicy), requestRetryPolicy); - } - - private Observable> replaceStoredProcedureInternal(StoredProcedure storedProcedure, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - - if (storedProcedure == null) { - throw new IllegalArgumentException("storedProcedure"); - } - logger.debug("Replacing a StoredProcedure. storedProcedure id [{}]", storedProcedure.getId()); - - RxDocumentClientImpl.validateResource(storedProcedure); - - String path = Utils.joinPath(storedProcedure.getSelfLink(), null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Replace, - ResourceType.StoredProcedure, path, storedProcedure, requestHeaders, options); - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.replace(request).map(response -> toResourceResponse(response, StoredProcedure.class)); - - } catch (Exception e) { - logger.debug("Failure in replacing a StoredProcedure due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> deleteStoredProcedure(String storedProcedureLink, - RequestOptions options) { - IDocumentClientRetryPolicy requestRetryPolicy = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> deleteStoredProcedureInternal(storedProcedureLink, options, requestRetryPolicy), requestRetryPolicy); - } - - private Observable> deleteStoredProcedureInternal(String storedProcedureLink, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - // we are using an observable factory here - // observable will be created fresh upon subscription - // this is to ensure we capture most up to date information (e.g., - // session) - try { - - if (StringUtils.isEmpty(storedProcedureLink)) { - throw new IllegalArgumentException("storedProcedureLink"); - } - - logger.debug("Deleting a StoredProcedure. storedProcedureLink [{}]", storedProcedureLink); - String path = Utils.joinPath(storedProcedureLink, null); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Delete, - ResourceType.StoredProcedure, path, requestHeaders, options); - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.delete(request).map(response -> toResourceResponse(response, StoredProcedure.class)); - - } catch (Exception e) { - // this is only in trace level to capture what's going on - logger.debug("Failure in deleting a StoredProcedure due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readStoredProcedure(String storedProcedureLink, - RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> readStoredProcedureInternal(storedProcedureLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> readStoredProcedureInternal(String storedProcedureLink, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - - // we are using an observable factory here - // observable will be created fresh upon subscription - // this is to ensure we capture most up to date information (e.g., - // session) - try { - - if (StringUtils.isEmpty(storedProcedureLink)) { - throw new IllegalArgumentException("storedProcedureLink"); - } - - logger.debug("Reading a StoredProcedure. storedProcedureLink [{}]", storedProcedureLink); - String path = Utils.joinPath(storedProcedureLink, null); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.StoredProcedure, path, requestHeaders, options); - - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.read(request).map(response -> toResourceResponse(response, StoredProcedure.class)); - - } catch (Exception e) { - // this is only in trace level to capture what's going on - logger.debug("Failure in reading a StoredProcedure due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readStoredProcedures(String collectionLink, - FeedOptions options) { - - if (StringUtils.isEmpty(collectionLink)) { - throw new IllegalArgumentException("collectionLink"); - } - - return readFeed(options, ResourceType.StoredProcedure, StoredProcedure.class, - Utils.joinPath(collectionLink, Paths.STORED_PROCEDURES_PATH_SEGMENT)); - } - - @Override - public Observable> queryStoredProcedures(String collectionLink, String query, - FeedOptions options) { - return queryStoredProcedures(collectionLink, new SqlQuerySpec(query), options); - } - - @Override - public Observable> queryStoredProcedures(String collectionLink, - SqlQuerySpec querySpec, FeedOptions options) { - return createQuery(collectionLink, querySpec, options, StoredProcedure.class, ResourceType.StoredProcedure); - } - - @Override - public Observable executeStoredProcedure(String storedProcedureLink, - Object[] procedureParams) { - return this.executeStoredProcedure(storedProcedureLink, null, procedureParams); - } - - @Override - public Observable executeStoredProcedure(String storedProcedureLink, - RequestOptions options, Object[] procedureParams) { - return ObservableHelper.inlineIfPossibleAsObs(() -> executeStoredProcedureInternal(storedProcedureLink, options, procedureParams), this.resetSessionTokenRetryPolicy.getRequestPolicy()); - } - - private Observable executeStoredProcedureInternal(String storedProcedureLink, - RequestOptions options, Object[] procedureParams) { - - try { - logger.debug("Executing a StoredProcedure. storedProcedureLink [{}]", storedProcedureLink); - String path = Utils.joinPath(storedProcedureLink, null); - - Map requestHeaders = getRequestHeaders(options); - requestHeaders.put(HttpConstants.HttpHeaders.ACCEPT, RuntimeConstants.MediaTypes.JSON); - - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.ExecuteJavaScript, - ResourceType.StoredProcedure, path, - procedureParams != null ? RxDocumentClientImpl.serializeProcedureParams(procedureParams) : "", - requestHeaders, options); - - Observable reqObs = addPartitionKeyInformation(request, null, options).toObservable(); - return reqObs.flatMap(req -> create(request) - .map(response -> { - this.captureSessionToken(request, response); - return toStoredProcedureResponse(response); - })); - - } catch (Exception e) { - logger.debug("Failure in executing a StoredProcedure due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> createTrigger(String collectionLink, Trigger trigger, - RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> createTriggerInternal(collectionLink, trigger, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> createTriggerInternal(String collectionLink, Trigger trigger, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - - logger.debug("Creating a Trigger. collectionLink [{}], trigger id [{}]", collectionLink, - trigger.getId()); - RxDocumentServiceRequest request = getTriggerRequest(collectionLink, trigger, options, - OperationType.Create); - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.create(request).map(response -> toResourceResponse(response, Trigger.class)); - - } catch (Exception e) { - logger.debug("Failure in creating a Trigger due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> upsertTrigger(String collectionLink, Trigger trigger, - RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> upsertTriggerInternal(collectionLink, trigger, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> upsertTriggerInternal(String collectionLink, Trigger trigger, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - - logger.debug("Upserting a Trigger. collectionLink [{}], trigger id [{}]", collectionLink, - trigger.getId()); - RxDocumentServiceRequest request = getTriggerRequest(collectionLink, trigger, options, - OperationType.Upsert); - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.upsert(request).map(response -> toResourceResponse(response, Trigger.class)); - - } catch (Exception e) { - logger.debug("Failure in upserting a Trigger due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - private RxDocumentServiceRequest getTriggerRequest(String collectionLink, Trigger trigger, RequestOptions options, - OperationType operationType) { - if (StringUtils.isEmpty(collectionLink)) { - throw new IllegalArgumentException("collectionLink"); - } - if (trigger == null) { - throw new IllegalArgumentException("trigger"); - } - - RxDocumentClientImpl.validateResource(trigger); - - String path = Utils.joinPath(collectionLink, Paths.TRIGGERS_PATH_SEGMENT); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, ResourceType.Trigger, path, - trigger, requestHeaders, options); - - return request; - } - - @Override - public Observable> replaceTrigger(Trigger trigger, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> replaceTriggerInternal(trigger, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> replaceTriggerInternal(Trigger trigger, RequestOptions options, - IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - if (trigger == null) { - throw new IllegalArgumentException("trigger"); - } - - logger.debug("Replacing a Trigger. trigger id [{}]", trigger.getId()); - RxDocumentClientImpl.validateResource(trigger); - - String path = Utils.joinPath(trigger.getSelfLink(), null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Replace, - ResourceType.Trigger, path, trigger, requestHeaders, options); - - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.replace(request).map(response -> toResourceResponse(response, Trigger.class)); - - } catch (Exception e) { - logger.debug("Failure in replacing a Trigger due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> deleteTrigger(String triggerLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> deleteTriggerInternal(triggerLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> deleteTriggerInternal(String triggerLink, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (StringUtils.isEmpty(triggerLink)) { - throw new IllegalArgumentException("triggerLink"); - } - - logger.debug("Deleting a Trigger. triggerLink [{}]", triggerLink); - String path = Utils.joinPath(triggerLink, null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Delete, - ResourceType.Trigger, path, requestHeaders, options); - - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.delete(request).map(response -> toResourceResponse(response, Trigger.class)); - - } catch (Exception e) { - logger.debug("Failure in deleting a Trigger due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readTrigger(String triggerLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> readTriggerInternal(triggerLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> readTriggerInternal(String triggerLink, RequestOptions options, - IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (StringUtils.isEmpty(triggerLink)) { - throw new IllegalArgumentException("triggerLink"); - } - - logger.debug("Reading a Trigger. triggerLink [{}]", triggerLink); - String path = Utils.joinPath(triggerLink, null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.Trigger, path, requestHeaders, options); - - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.read(request).map(response -> toResourceResponse(response, Trigger.class)); - - } catch (Exception e) { - logger.debug("Failure in reading a Trigger due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readTriggers(String collectionLink, FeedOptions options) { - - if (StringUtils.isEmpty(collectionLink)) { - throw new IllegalArgumentException("collectionLink"); - } - - return readFeed(options, ResourceType.Trigger, Trigger.class, - Utils.joinPath(collectionLink, Paths.TRIGGERS_PATH_SEGMENT)); - } - - @Override - public Observable> queryTriggers(String collectionLink, String query, - FeedOptions options) { - return queryTriggers(collectionLink, new SqlQuerySpec(query), options); - } - - @Override - public Observable> queryTriggers(String collectionLink, SqlQuerySpec querySpec, - FeedOptions options) { - return createQuery(collectionLink, querySpec, options, Trigger.class, ResourceType.Trigger); - } - - @Override - public Observable> createUserDefinedFunction(String collectionLink, - UserDefinedFunction udf, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> createUserDefinedFunctionInternal(collectionLink, udf, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> createUserDefinedFunctionInternal(String collectionLink, - UserDefinedFunction udf, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - // we are using an observable factory here - // observable will be created fresh upon subscription - // this is to ensure we capture most up to date information (e.g., - // session) - try { - logger.debug("Creating a UserDefinedFunction. collectionLink [{}], udf id [{}]", collectionLink, - udf.getId()); - RxDocumentServiceRequest request = getUserDefinedFunctionRequest(collectionLink, udf, options, - OperationType.Create); - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.create(request).map(response -> toResourceResponse(response, UserDefinedFunction.class)); - - } catch (Exception e) { - // this is only in trace level to capture what's going on - logger.debug("Failure in creating a UserDefinedFunction due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> upsertUserDefinedFunction(String collectionLink, - UserDefinedFunction udf, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> upsertUserDefinedFunctionInternal(collectionLink, udf, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> upsertUserDefinedFunctionInternal(String collectionLink, - UserDefinedFunction udf, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - // we are using an observable factory here - // observable will be created fresh upon subscription - // this is to ensure we capture most up to date information (e.g., - // session) - try { - logger.debug("Upserting a UserDefinedFunction. collectionLink [{}], udf id [{}]", collectionLink, - udf.getId()); - RxDocumentServiceRequest request = getUserDefinedFunctionRequest(collectionLink, udf, options, - OperationType.Upsert); - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.upsert(request).map(response -> toResourceResponse(response, UserDefinedFunction.class)); - - } catch (Exception e) { - // this is only in trace level to capture what's going on - logger.debug("Failure in upserting a UserDefinedFunction due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> replaceUserDefinedFunction(UserDefinedFunction udf, - RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> replaceUserDefinedFunctionInternal(udf, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> replaceUserDefinedFunctionInternal(UserDefinedFunction udf, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - // we are using an observable factory here - // observable will be created fresh upon subscription - // this is to ensure we capture most up to date information (e.g., - // session) - try { - if (udf == null) { - throw new IllegalArgumentException("udf"); - } - - logger.debug("Replacing a UserDefinedFunction. udf id [{}]", udf.getId()); - validateResource(udf); - - String path = Utils.joinPath(udf.getSelfLink(), null); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Replace, - ResourceType.UserDefinedFunction, path, udf, requestHeaders, options); - - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.replace(request).map(response -> toResourceResponse(response, UserDefinedFunction.class)); - - } catch (Exception e) { - // this is only in trace level to capture what's going on - logger.debug("Failure in replacing a UserDefinedFunction due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> deleteUserDefinedFunction(String udfLink, - RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> deleteUserDefinedFunctionInternal(udfLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> deleteUserDefinedFunctionInternal(String udfLink, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - // we are using an observable factory here - // observable will be created fresh upon subscription - // this is to ensure we capture most up to date information (e.g., - // session) - try { - if (StringUtils.isEmpty(udfLink)) { - throw new IllegalArgumentException("udfLink"); - } - - logger.debug("Deleting a UserDefinedFunction. udfLink [{}]", udfLink); - String path = Utils.joinPath(udfLink, null); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Delete, - ResourceType.UserDefinedFunction, path, requestHeaders, options); - - if (retryPolicyInstance != null){ - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.delete(request).map(response -> toResourceResponse(response, UserDefinedFunction.class)); - - } catch (Exception e) { - // this is only in trace level to capture what's going on - logger.debug("Failure in deleting a UserDefinedFunction due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readUserDefinedFunction(String udfLink, - RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> readUserDefinedFunctionInternal(udfLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> readUserDefinedFunctionInternal(String udfLink, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - // we are using an observable factory here - // observable will be created fresh upon subscription - // this is to ensure we capture most up to date information (e.g., - // session) - try { - if (StringUtils.isEmpty(udfLink)) { - throw new IllegalArgumentException("udfLink"); - } - - logger.debug("Reading a UserDefinedFunction. udfLink [{}]", udfLink); - String path = Utils.joinPath(udfLink, null); - Map requestHeaders = this.getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.UserDefinedFunction, path, requestHeaders, options); - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.read(request).map(response -> toResourceResponse(response, UserDefinedFunction.class)); - - } catch (Exception e) { - // this is only in trace level to capture what's going on - logger.debug("Failure in reading a UserDefinedFunction due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readUserDefinedFunctions(String collectionLink, - FeedOptions options) { - - if (StringUtils.isEmpty(collectionLink)) { - throw new IllegalArgumentException("collectionLink"); - } - - return readFeed(options, ResourceType.UserDefinedFunction, UserDefinedFunction.class, - Utils.joinPath(collectionLink, Paths.USER_DEFINED_FUNCTIONS_PATH_SEGMENT)); - } - - @Override - public Observable> queryUserDefinedFunctions(String collectionLink, - String query, FeedOptions options) { - return queryUserDefinedFunctions(collectionLink, new SqlQuerySpec(query), options); - } - - @Override - public Observable> queryUserDefinedFunctions(String collectionLink, - SqlQuerySpec querySpec, FeedOptions options) { - return createQuery(collectionLink, querySpec, options, UserDefinedFunction.class, ResourceType.UserDefinedFunction); - } - - - @Override - public Observable> createAttachment(String documentLink, Attachment attachment, - RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> createAttachmentInternal(documentLink, attachment, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> createAttachmentInternal(String documentLink, Attachment attachment, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - logger.debug("Creating a Attachment. documentLink [{}], attachment id [{}]", documentLink, - attachment.getId()); - Observable reqObs = getAttachmentRequest(documentLink, attachment, options, - OperationType.Create).toObservable(); - return reqObs.flatMap(req -> { - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(req); - } - - return create(req).map(response -> toResourceResponse(response, Attachment.class)); - }); - - } catch (Exception e) { - logger.debug("Failure in creating a Attachment due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - - @Override - public Observable> upsertAttachment(String documentLink, Attachment attachment, - RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.retryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> upsertAttachmentInternal(documentLink, attachment, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> upsertAttachmentInternal(String documentLink, Attachment attachment, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - logger.debug("Upserting a Attachment. documentLink [{}], attachment id [{}]", documentLink, - attachment.getId()); - Observable reqObs = getAttachmentRequest(documentLink, attachment, options, - OperationType.Upsert).toObservable(); - return reqObs.flatMap(req -> { - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(req); - } - - return upsert(req).map(response -> toResourceResponse(response, Attachment.class)); - }); - - } catch (Exception e) { - logger.debug("Failure in upserting a Attachment due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> replaceAttachment(Attachment attachment, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> replaceAttachmentInternal(attachment, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> replaceAttachmentInternal(Attachment attachment, RequestOptions options, - IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (attachment == null) { - throw new IllegalArgumentException("attachment"); - } - - logger.debug("Replacing a Attachment. attachment id [{}]", attachment.getId()); - RxDocumentClientImpl.validateResource(attachment); - - String path = Utils.joinPath(attachment.getSelfLink(), null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Replace, - ResourceType.Attachment, path, attachment, requestHeaders, options); - - Observable reqObs = addPartitionKeyInformation(request, null, options).toObservable(); - return reqObs.flatMap(req -> { - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return replace(request).map(response -> toResourceResponse(response, Attachment.class)); - }); - } catch (Exception e) { - logger.debug("Failure in replacing a Attachment due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> deleteAttachment(String attachmentLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> deleteAttachmentInternal(attachmentLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> deleteAttachmentInternal(String attachmentLink, RequestOptions options, - IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - if (StringUtils.isEmpty(attachmentLink)) { - throw new IllegalArgumentException("attachmentLink"); - } - - logger.debug("Deleting a Attachment. attachmentLink [{}]", attachmentLink); - String path = Utils.joinPath(attachmentLink, null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Delete, - ResourceType.Attachment, path, requestHeaders, options); - - Observable reqObs = addPartitionKeyInformation(request, null, options).toObservable(); - return reqObs.flatMap(req -> { - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(req); - } - - return delete(req).map(resp -> toResourceResponse(resp, Attachment.class)); - }); - - } catch (Exception e) { - logger.debug("Failure in deleting a Attachment due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readAttachment(String attachmentLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> readAttachmentInternal(attachmentLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> readAttachmentInternal(String attachmentLink, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - if (StringUtils.isEmpty(attachmentLink)) { - throw new IllegalArgumentException("attachmentLink"); - } - - logger.debug("Reading a Attachment. attachmentLink [{}]", attachmentLink); - String path = Utils.joinPath(attachmentLink, null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.Attachment, path, requestHeaders, options); - - Observable reqObs = addPartitionKeyInformation(request, null, options).toObservable(); - - return reqObs.flatMap(req -> { - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return read(request).map(response -> toResourceResponse(response, Attachment.class)); - }); - - } catch (Exception e) { - logger.debug("Failure in reading a Attachment due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readAttachments(String documentLink, FeedOptions options) { - - if (StringUtils.isEmpty(documentLink)) { - throw new IllegalArgumentException("documentLink"); - } - - return readFeedCollectionChild(options, ResourceType.Attachment, Attachment.class, - Utils.joinPath(documentLink, Paths.ATTACHMENTS_PATH_SEGMENT)); - } - - @Override - public Observable readMedia(String mediaLink) { - if (StringUtils.isEmpty(mediaLink)) { - throw new IllegalArgumentException("mediaLink"); - } - - String targetPath = Utils.joinPath(mediaLink, null); - return ObservableHelper.inlineIfPossibleAsObs(() -> readMediaInternal(targetPath), this.resetSessionTokenRetryPolicy.getRequestPolicy()); - } - - private Observable readMediaInternal(String mediaLink) { - logger.debug("Reading a Media. mediaLink [{}]", mediaLink); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, ResourceType.Media, mediaLink, (Map) null, null); - request.setIsMedia(true); - // Media is strong consistent always -> no need of session handling - populateHeaders(request, HttpConstants.HttpMethods.GET); - return gatewayProxy.processMessage(request).map(response -> - BridgeInternal.toMediaResponse(response, this.connectionPolicy.getMediaReadMode() == MediaReadMode.Buffered)); - } - - @Override - public Observable updateMedia(String mediaLink, InputStream mediaStream, MediaOptions options) { - if (StringUtils.isEmpty(mediaLink)) { - throw new IllegalArgumentException("mediaLink"); - } - if (mediaStream == null) { - throw new IllegalArgumentException("mediaStream"); - } - - String targetPath = Utils.joinPath(mediaLink, null); - return ObservableHelper.inlineIfPossibleAsObs(() -> updateMediaInternal(targetPath, mediaStream, options), this.resetSessionTokenRetryPolicy.getRequestPolicy()); - } - - private Observable updateMediaInternal(String mediaLink, InputStream mediaStream, MediaOptions options) { - logger.debug("Updating a Media. mediaLink [{}]", mediaLink); - Map requestHeaders = this.getMediaHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Replace, ResourceType.Media, - mediaLink, - mediaStream, - requestHeaders); - request.setIsMedia(true); - - // Media is strong consistent always -> need of session handling - populateHeaders(request, HttpConstants.HttpMethods.PUT); - return gatewayProxy.processMessage(request).map(response -> - BridgeInternal.toMediaResponse(response, this.connectionPolicy.getMediaReadMode() == MediaReadMode.Buffered)); - } - - @Override - public Observable> queryAttachments(String documentLink, String query, - FeedOptions options) { - return queryAttachments(documentLink, new SqlQuerySpec(query), options); - } - - @Override - public Observable> queryAttachments(String documentLink, SqlQuerySpec querySpec, - FeedOptions options) { - return createQuery(documentLink, querySpec, options, Attachment.class, ResourceType.Attachment); - } - - private Single getAttachmentRequest(String documentLink, Attachment attachment, - RequestOptions options, OperationType operationType) { - if (StringUtils.isEmpty(documentLink)) { - throw new IllegalArgumentException("documentLink"); - } - if (attachment == null) { - throw new IllegalArgumentException("attachment"); - } - - RxDocumentClientImpl.validateResource(attachment); - - String path = Utils.joinPath(documentLink, Paths.ATTACHMENTS_PATH_SEGMENT); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, ResourceType.Attachment, path, - attachment, requestHeaders, options); - - return addPartitionKeyInformation(request, null, options); - } - - @Override - public Observable> createAttachment(String documentLink, InputStream mediaStream, - MediaOptions options, RequestOptions requestOptions) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> createAttachmentInternal(documentLink, mediaStream, options, requestOptions, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> createAttachmentInternal(String documentLink, InputStream mediaStream, - MediaOptions options, RequestOptions requestOptions, IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - logger.debug("Creating a Attachment. attachmentLink [{}]", documentLink); - Observable reqObs = getAttachmentRequest(documentLink, mediaStream, options, - requestOptions, OperationType.Create).toObservable(); - return reqObs.flatMap(req -> { - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(req); - } - - return create(req).map(response -> toResourceResponse(response, Attachment.class)); - }); - - } catch (Exception e) { - logger.debug("Failure in creating a Attachment due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> upsertAttachment(String documentLink, InputStream mediaStream, - MediaOptions options, RequestOptions requestOptions) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> upsertAttachmentInternal(documentLink, mediaStream, options, requestOptions, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> upsertAttachmentInternal(String documentLink, InputStream mediaStream, - MediaOptions options, RequestOptions requestOptions, IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - logger.debug("Upserting a Attachment. attachmentLink [{}]", documentLink); - Observable reqObs = getAttachmentRequest(documentLink, mediaStream, options, - requestOptions, OperationType.Upsert).toObservable(); - return reqObs.flatMap(req -> { - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(req); - } - - return upsert(req).map(response -> toResourceResponse(response, Attachment.class)); - }); - - } catch (Exception e) { - logger.debug("Failure in upserting a Attachment due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - private Single getAttachmentRequest(String documentLink, InputStream mediaStream, - MediaOptions options, RequestOptions requestOptions, OperationType operationType) { - if (StringUtils.isEmpty(documentLink)) { - throw new IllegalArgumentException("documentLink"); - } - if (mediaStream == null) { - throw new IllegalArgumentException("mediaStream"); - } - String path = Utils.joinPath(documentLink, Paths.ATTACHMENTS_PATH_SEGMENT); - Map requestHeaders = this.getMediaHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, ResourceType.Attachment, path, - mediaStream, requestHeaders); - request.setIsMedia(true); - return addPartitionKeyInformation(request, null, requestOptions); - } - - @Override - public Observable> readConflict(String conflictLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> readConflictInternal(conflictLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> readConflictInternal(String conflictLink, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - if (StringUtils.isEmpty(conflictLink)) { - throw new IllegalArgumentException("conflictLink"); - } - - logger.debug("Reading a Conflict. conflictLink [{}]", conflictLink); - String path = Utils.joinPath(conflictLink, null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.Conflict, path, requestHeaders, options); - - Observable reqObs = addPartitionKeyInformation(request, null, options).toObservable(); - - return reqObs.flatMap(req -> { - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - return this.read(request).map(response -> toResourceResponse(response, Conflict.class)); - }); - - } catch (Exception e) { - logger.debug("Failure in reading a Conflict due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readConflicts(String collectionLink, FeedOptions options) { - - if (StringUtils.isEmpty(collectionLink)) { - throw new IllegalArgumentException("collectionLink"); - } - - return readFeed(options, ResourceType.Conflict, Conflict.class, - Utils.joinPath(collectionLink, Paths.CONFLICTS_PATH_SEGMENT)); - } - - @Override - public Observable> queryConflicts(String collectionLink, String query, - FeedOptions options) { - return queryConflicts(collectionLink, new SqlQuerySpec(query), options); - } - - @Override - public Observable> queryConflicts(String collectionLink, SqlQuerySpec querySpec, - FeedOptions options) { - return createQuery(collectionLink, querySpec, options, Conflict.class, ResourceType.Conflict); - } - - @Override - public Observable> deleteConflict(String conflictLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> deleteConflictInternal(conflictLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> deleteConflictInternal(String conflictLink, RequestOptions options, - IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - if (StringUtils.isEmpty(conflictLink)) { - throw new IllegalArgumentException("conflictLink"); - } - - logger.debug("Deleting a Conflict. conflictLink [{}]", conflictLink); - String path = Utils.joinPath(conflictLink, null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Delete, - ResourceType.Conflict, path, requestHeaders, options); - - Observable reqObs = addPartitionKeyInformation(request, null, options).toObservable(); - return reqObs.flatMap(req -> { - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.delete(request).map(response -> toResourceResponse(response, Conflict.class)); - }); - - } catch (Exception e) { - logger.debug("Failure in deleting a Conflict due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> createUser(String databaseLink, User user, RequestOptions options) { - return ObservableHelper.inlineIfPossibleAsObs(() -> createUserInternal(databaseLink, user, options), this.resetSessionTokenRetryPolicy.getRequestPolicy()); - } - - private Observable> createUserInternal(String databaseLink, User user, RequestOptions options) { - try { - logger.debug("Creating a User. databaseLink [{}], user id [{}]", databaseLink, user.getId()); - RxDocumentServiceRequest request = getUserRequest(databaseLink, user, options, OperationType.Create); - return this.create(request).map(response -> toResourceResponse(response, User.class)); - - } catch (Exception e) { - logger.debug("Failure in creating a User due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> upsertUser(String databaseLink, User user, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> upsertUserInternal(databaseLink, user, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> upsertUserInternal(String databaseLink, User user, RequestOptions options, - IDocumentClientRetryPolicy retryPolicyInstance) { - try { - logger.debug("Upserting a User. databaseLink [{}], user id [{}]", databaseLink, user.getId()); - RxDocumentServiceRequest request = getUserRequest(databaseLink, user, options, OperationType.Upsert); - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.upsert(request).map(response -> toResourceResponse(response, User.class)); - - } catch (Exception e) { - logger.debug("Failure in upserting a User due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - private RxDocumentServiceRequest getUserRequest(String databaseLink, User user, RequestOptions options, - OperationType operationType) { - if (StringUtils.isEmpty(databaseLink)) { - throw new IllegalArgumentException("databaseLink"); - } - if (user == null) { - throw new IllegalArgumentException("user"); - } - - RxDocumentClientImpl.validateResource(user); - - String path = Utils.joinPath(databaseLink, Paths.USERS_PATH_SEGMENT); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, ResourceType.User, path, user, - requestHeaders, options); - - return request; - } - - @Override - public Observable> replaceUser(User user, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> replaceUserInternal(user, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> replaceUserInternal(User user, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (user == null) { - throw new IllegalArgumentException("user"); - } - logger.debug("Replacing a User. user id [{}]", user.getId()); - RxDocumentClientImpl.validateResource(user); - - String path = Utils.joinPath(user.getSelfLink(), null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Replace, - ResourceType.User, path, user, requestHeaders, options); - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.replace(request).map(response -> toResourceResponse(response, User.class)); - - } catch (Exception e) { - logger.debug("Failure in replacing a User due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - - public Observable> deleteUser(String userLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> deleteUserInternal(userLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> deleteUserInternal(String userLink, RequestOptions options, - IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - if (StringUtils.isEmpty(userLink)) { - throw new IllegalArgumentException("userLink"); - } - logger.debug("Deleting a User. userLink [{}]", userLink); - String path = Utils.joinPath(userLink, null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Delete, - ResourceType.User, path, requestHeaders, options); - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.delete(request).map(response -> toResourceResponse(response, User.class)); - - } catch (Exception e) { - logger.debug("Failure in deleting a User due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - @Override - public Observable> readUser(String userLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> readUserInternal(userLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> readUserInternal(String userLink, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (StringUtils.isEmpty(userLink)) { - throw new IllegalArgumentException("userLink"); - } - logger.debug("Reading a User. userLink [{}]", userLink); - String path = Utils.joinPath(userLink, null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.User, path, requestHeaders, options); - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - return this.read(request).map(response -> toResourceResponse(response, User.class)); - - } catch (Exception e) { - logger.debug("Failure in reading a User due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readUsers(String databaseLink, FeedOptions options) { - - if (StringUtils.isEmpty(databaseLink)) { - throw new IllegalArgumentException("databaseLink"); - } - - return readFeed(options, ResourceType.User, User.class, - Utils.joinPath(databaseLink, Paths.USERS_PATH_SEGMENT)); - } - - @Override - public Observable> queryUsers(String databaseLink, String query, FeedOptions options) { - return queryUsers(databaseLink, new SqlQuerySpec(query), options); - } - - @Override - public Observable> queryUsers(String databaseLink, SqlQuerySpec querySpec, - FeedOptions options) { - return createQuery(databaseLink, querySpec, options, User.class, ResourceType.User); - } - - @Override - public Observable> createPermission(String userLink, Permission permission, - RequestOptions options) { - return ObservableHelper.inlineIfPossibleAsObs(() -> createPermissionInternal(userLink, permission, options), this.resetSessionTokenRetryPolicy.getRequestPolicy()); - } - - private Observable> createPermissionInternal(String userLink, Permission permission, - RequestOptions options) { - - try { - logger.debug("Creating a Permission. userLink [{}], permission id [{}]", userLink, permission.getId()); - RxDocumentServiceRequest request = getPermissionRequest(userLink, permission, options, - OperationType.Create); - return this.create(request).map(response -> toResourceResponse(response, Permission.class)); - - } catch (Exception e) { - logger.debug("Failure in creating a Permission due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> upsertPermission(String userLink, Permission permission, - RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> upsertPermissionInternal(userLink, permission, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> upsertPermissionInternal(String userLink, Permission permission, - RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - logger.debug("Upserting a Permission. userLink [{}], permission id [{}]", userLink, permission.getId()); - RxDocumentServiceRequest request = getPermissionRequest(userLink, permission, options, - OperationType.Upsert); - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.upsert(request).map(response -> toResourceResponse(response, Permission.class)); - - } catch (Exception e) { - logger.debug("Failure in upserting a Permission due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - private RxDocumentServiceRequest getPermissionRequest(String userLink, Permission permission, - RequestOptions options, OperationType operationType) { - if (StringUtils.isEmpty(userLink)) { - throw new IllegalArgumentException("userLink"); - } - if (permission == null) { - throw new IllegalArgumentException("permission"); - } - - RxDocumentClientImpl.validateResource(permission); - - String path = Utils.joinPath(userLink, Paths.PERMISSIONS_PATH_SEGMENT); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(operationType, ResourceType.Permission, path, - permission, requestHeaders, options); - - return request; - } - - @Override - public Observable> replacePermission(Permission permission, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> replacePermissionInternal(permission, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> replacePermissionInternal(Permission permission, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (permission == null) { - throw new IllegalArgumentException("permission"); - } - logger.debug("Replacing a Permission. permission id [{}]", permission.getId()); - RxDocumentClientImpl.validateResource(permission); - - String path = Utils.joinPath(permission.getSelfLink(), null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Replace, - ResourceType.Permission, path, permission, requestHeaders, options); - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.replace(request).map(response -> toResourceResponse(response, Permission.class)); - - } catch (Exception e) { - logger.debug("Failure in replacing a Permission due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> deletePermission(String permissionLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> deletePermissionInternal(permissionLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> deletePermissionInternal(String permissionLink, RequestOptions options, - IDocumentClientRetryPolicy retryPolicyInstance) { - - try { - if (StringUtils.isEmpty(permissionLink)) { - throw new IllegalArgumentException("permissionLink"); - } - logger.debug("Deleting a Permission. permissionLink [{}]", permissionLink); - String path = Utils.joinPath(permissionLink, null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Delete, - ResourceType.Permission, path, requestHeaders, options); - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.delete(request).map(response -> toResourceResponse(response, Permission.class)); - - } catch (Exception e) { - logger.debug("Failure in deleting a Permission due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readPermission(String permissionLink, RequestOptions options) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> readPermissionInternal(permissionLink, options, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> readPermissionInternal(String permissionLink, RequestOptions options, IDocumentClientRetryPolicy retryPolicyInstance ) { - try { - if (StringUtils.isEmpty(permissionLink)) { - throw new IllegalArgumentException("permissionLink"); - } - logger.debug("Reading a Permission. permissionLink [{}]", permissionLink); - String path = Utils.joinPath(permissionLink, null); - Map requestHeaders = getRequestHeaders(options); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.Permission, path, requestHeaders, options); - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - return this.read(request).map(response -> toResourceResponse(response, Permission.class)); - - } catch (Exception e) { - logger.debug("Failure in reading a Permission due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readPermissions(String userLink, FeedOptions options) { - - if (StringUtils.isEmpty(userLink)) { - throw new IllegalArgumentException("userLink"); - } - - return readFeed(options, ResourceType.Permission, Permission.class, - Utils.joinPath(userLink, Paths.PERMISSIONS_PATH_SEGMENT)); - } - - @Override - public Observable> queryPermissions(String userLink, String query, - FeedOptions options) { - return queryPermissions(userLink, new SqlQuerySpec(query), options); - } - - @Override - public Observable> queryPermissions(String userLink, SqlQuerySpec querySpec, - FeedOptions options) { - return createQuery(userLink, querySpec, options, Permission.class, ResourceType.Permission); - } - - @Override - public Observable> replaceOffer(Offer offer) { - return ObservableHelper.inlineIfPossibleAsObs(() -> replaceOfferInternal(offer), this.resetSessionTokenRetryPolicy.getRequestPolicy()); - } - - private Observable> replaceOfferInternal(Offer offer) { - try { - if (offer == null) { - throw new IllegalArgumentException("offer"); - } - logger.debug("Replacing an Offer. offer id [{}]", offer.getId()); - RxDocumentClientImpl.validateResource(offer); - - String path = Utils.joinPath(offer.getSelfLink(), null); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Replace, - ResourceType.Offer, path, offer, null, null); - return this.replace(request).map(response -> toResourceResponse(response, Offer.class)); - - } catch (Exception e) { - logger.debug("Failure in replacing an Offer due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readOffer(String offerLink) { - IDocumentClientRetryPolicy retryPolicyInstance = this.resetSessionTokenRetryPolicy.getRequestPolicy(); - return ObservableHelper.inlineIfPossibleAsObs(() -> readOfferInternal(offerLink, retryPolicyInstance), retryPolicyInstance); - } - - private Observable> readOfferInternal(String offerLink, IDocumentClientRetryPolicy retryPolicyInstance) { - try { - if (StringUtils.isEmpty(offerLink)) { - throw new IllegalArgumentException("offerLink"); - } - logger.debug("Reading an Offer. offerLink [{}]", offerLink); - String path = Utils.joinPath(offerLink, null); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.Offer, path, (HashMap)null, null); - - if (retryPolicyInstance != null) { - retryPolicyInstance.onBeforeSendRequest(request); - } - - return this.read(request).map(response -> toResourceResponse(response, Offer.class)); - - } catch (Exception e) { - logger.debug("Failure in reading an Offer due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - @Override - public Observable> readOffers(FeedOptions options) { - return readFeed(options, ResourceType.Offer, Offer.class, - Utils.joinPath(Paths.OFFERS_PATH_SEGMENT, null)); - } - - private Observable> readFeedCollectionChild(FeedOptions options, ResourceType resourceType, - Class klass, String resourceLink) { - if (options == null) { - options = new FeedOptions(); - } - - int maxPageSize = options.getMaxItemCount() != null ? options.getMaxItemCount() : -1; - - final FeedOptions finalFeedOptions = options; - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(options.getPartitionKey()); - Func2 createRequestFunc = (continuationToken, pageSize) -> { - Map requestHeaders = new HashMap<>(); - if (continuationToken != null) { - requestHeaders.put(HttpConstants.HttpHeaders.CONTINUATION, continuationToken); - } - requestHeaders.put(HttpConstants.HttpHeaders.PAGE_SIZE, Integer.toString(pageSize)); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.ReadFeed, - resourceType, resourceLink, requestHeaders, finalFeedOptions); - return request; - }; - - Func1>> executeFunc = request -> { - return ObservableHelper.inlineIfPossibleAsObs(() -> { - Single collectionObs = this.collectionCache.resolveCollectionAsync(request); - Single requestObs = this.addPartitionKeyInformation(request, null, requestOptions, collectionObs); - - return requestObs.toObservable().flatMap(req -> this.readFeed(req) - .map(response -> toFeedResponsePage(response, klass))); - }, this.resetSessionTokenRetryPolicy.getRequestPolicy()); - }; - - return Paginator.getPaginatedQueryResultAsObservable(options, createRequestFunc, executeFunc, klass, maxPageSize); - } - - private Observable> readFeed(FeedOptions options, ResourceType resourceType, Class klass, String resourceLink) { - if (options == null) { - options = new FeedOptions(); - } - - int maxPageSize = options.getMaxItemCount() != null ? options.getMaxItemCount() : -1; - final FeedOptions finalFeedOptions = options; - Func2 createRequestFunc = (continuationToken, pageSize) -> { - Map requestHeaders = new HashMap<>(); - if (continuationToken != null) { - requestHeaders.put(HttpConstants.HttpHeaders.CONTINUATION, continuationToken); - } - requestHeaders.put(HttpConstants.HttpHeaders.PAGE_SIZE, Integer.toString(pageSize)); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.ReadFeed, - resourceType, resourceLink, requestHeaders, finalFeedOptions); - return request; - }; - - Func1>> executeFunc = request -> { - return ObservableHelper.inlineIfPossibleAsObs(() -> readFeed(request).map(response -> toFeedResponsePage(response, klass)), - this.resetSessionTokenRetryPolicy.getRequestPolicy()); - }; - - return Paginator.getPaginatedQueryResultAsObservable(options, createRequestFunc, executeFunc, klass, maxPageSize); - } - - @Override - public Observable> queryOffers(String query, FeedOptions options) { - return queryOffers(new SqlQuerySpec(query), options); - } - - @Override - public Observable> queryOffers(SqlQuerySpec querySpec, FeedOptions options) { - return createQuery(null, querySpec, options, Offer.class, ResourceType.Offer); - } - - @Override - public Observable getDatabaseAccount() { - return ObservableHelper.inlineIfPossibleAsObs(() -> getDatabaseAccountInternal(), this.resetSessionTokenRetryPolicy.getRequestPolicy()); - } - - private Observable getDatabaseAccountInternal() { - try { - logger.debug("Getting Database Account"); - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.DatabaseAccount, "", // path - (HashMap) null, - null); - return this.read(request).map(response -> toDatabaseAccount(response)); - - } catch (Exception e) { - logger.debug("Failure in getting Database Account due to [{}]", e.getMessage(), e); - return Observable.error(e); - } - } - - public Object getSession() { - return this.sessionContainer; - } - - public void setSession(Object sessionContainer) { - this.sessionContainer = (SessionContainer) sessionContainer; - } - - public RxPartitionKeyRangeCache getPartitionKeyRangeCache() { - return partitionKeyRangeCache; - } - - public Observable getDatabaseAccountFromEndpoint(URI endpoint) { - return Observable.defer(() -> { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Read, - ResourceType.DatabaseAccount, "", (HashMap) null, (Object) null); - this.populateHeaders(request, HttpConstants.HttpMethods.GET); - - request.setEndpointOverride(endpoint); - return this.gatewayProxy.processMessage(request).doOnError(e -> { - String message = String.format("Failed to retrieve database account information. %s", - e.getCause() != null - ? e.getCause().toString() - : e.toString()); - logger.warn(message); - }).map(rsp -> rsp.getResource(DatabaseAccount.class)) - .doOnNext(databaseAccount -> { - this.useMultipleWriteLocations = this.connectionPolicy.isUsingMultipleWriteLocations() - && BridgeInternal.isEnableMultipleWriteLocations(databaseAccount); - }); - }); - } - - /** - * Certain requests must be routed through gateway even when the client connectivity mode is direct. - * - * @param request - * @return RxStoreModel - */ - private RxStoreModel getStoreProxy(RxDocumentServiceRequest request) { - // If a request is configured to always use Gateway mode(in some cases when targeting .NET Core) - // we return the Gateway store model - if (request.UseGatewayMode) { - return this.gatewayProxy; - } - - ResourceType resourceType = request.getResourceType(); - OperationType operationType = request.getOperationType(); - - if (resourceType == ResourceType.Offer || - resourceType.isScript() && operationType != OperationType.ExecuteJavaScript || - resourceType == ResourceType.PartitionKeyRange) { - return this.gatewayProxy; - } - - if (operationType == OperationType.Create - || operationType == OperationType.Upsert) { - if (resourceType == ResourceType.Database || - resourceType == ResourceType.User || - resourceType == ResourceType.DocumentCollection || - resourceType == ResourceType.Permission) { - return this.gatewayProxy; - } else { - return this.storeModel; - } - } else if (operationType == OperationType.Delete) { - if (resourceType == ResourceType.Database || - resourceType == ResourceType.User || - resourceType == ResourceType.DocumentCollection) { - return this.gatewayProxy; - } else { - return this.storeModel; - } - } else if (operationType == OperationType.Replace) { - if (resourceType == ResourceType.DocumentCollection) { - return this.gatewayProxy; - } else { - return this.storeModel; - } - } else if (operationType == OperationType.Read) { - if (resourceType == ResourceType.DocumentCollection) { - return this.gatewayProxy; - } else { - return this.storeModel; - } - } else { - if ((request.getOperationType() == OperationType.Query || request.getOperationType() == OperationType.SqlQuery) && - Utils.isCollectionChild(request.getResourceType())) { - if (request.getPartitionKeyRangeIdentity() == null) { - return this.gatewayProxy; - } - } - - return this.storeModel; - } - } - - @Override - public void close() { - logger.info("Shutting down ..."); - LifeCycleUtils.closeQuietly(this.globalEndpointManager); - LifeCycleUtils.closeQuietly(this.storeClientFactory); - - try { - this.rxClient.shutdown(); - } catch (Exception e) { - logger.warn("Failure in shutting down rxClient", e); - } - } -} diff --git a/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/RxPartitionKeyRangeCache.java b/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/RxPartitionKeyRangeCache.java deleted file mode 100644 index 1636b7ccd29f..000000000000 --- a/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/caches/RxPartitionKeyRangeCache.java +++ /dev/null @@ -1,247 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.caches; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.internal.routing.IServerIdentity; -import com.microsoft.azure.cosmosdb.rx.internal.NotFoundException; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.routing.CollectionRoutingMap; -import com.microsoft.azure.cosmosdb.internal.routing.InMemoryCollectionRoutingMap; -import com.microsoft.azure.cosmosdb.internal.routing.Range; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.internal.Exceptions; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.Utils; - -import rx.Observable; -import rx.Single; - -/** - * While this class is public, but it is not part of our published public APIs. - * This is meant to be internally used only by our sdk. - **/ -public class RxPartitionKeyRangeCache implements IPartitionKeyRangeCache { - private final Logger logger = LoggerFactory.getLogger(RxPartitionKeyRangeCache.class); - - private final AsyncCache routingMapCache; - private final AsyncDocumentClient client; - private final RxCollectionCache collectionCache; - - public RxPartitionKeyRangeCache(AsyncDocumentClient client, RxCollectionCache collectionCache) { - this.routingMapCache = new AsyncCache<>(); - this.client = client; - this.collectionCache = collectionCache; - } - - /* (non-Javadoc) - * @see com.microsoft.azure.cosmosdb.rx.internal.caches.IPartitionKeyRangeCache#tryLookupAsync(java.lang.String, com.microsoft.azure.cosmosdb.internal.routing.CollectionRoutingMap) - */ - @Override - public Single tryLookupAsync(String collectionRid, CollectionRoutingMap previousValue, Map properties) { - return routingMapCache.getAsync( - collectionRid, - previousValue, - () -> getRoutingMapForCollectionAsync(collectionRid, previousValue, properties)) - .onErrorResumeNext(err -> { - logger.debug("tryLookupAsync on collectionRid {} encountered failure", collectionRid, err); - DocumentClientException dce = Utils.as(err, DocumentClientException.class); - if (dce != null && Exceptions.isStatusCode(dce, HttpConstants.StatusCodes.NOTFOUND)) { - return Single.just(null); - } - - return Single.error(err); - }); - } - - @Override - public Single tryLookupAsync(String collectionRid, CollectionRoutingMap previousValue, boolean forceRefreshCollectionRoutingMap, - Map properties) { - return tryLookupAsync(collectionRid, previousValue, properties); - } - - /* (non-Javadoc) - * @see com.microsoft.azure.cosmosdb.rx.internal.caches.IPartitionKeyRangeCache#tryGetOverlappingRangesAsync(java.lang.String, com.microsoft.azure.cosmosdb.internal.routing.Range, boolean) - */ - @Override - public Single> tryGetOverlappingRangesAsync(String collectionRid, Range range, boolean forceRefresh, - Map properties) { - - Single routingMapObs = tryLookupAsync(collectionRid, null, properties); - - return routingMapObs.flatMap(routingMap -> { - if (forceRefresh && routingMap != null) { - logger.debug("tryGetOverlappingRangesAsync with forceRefresh on collectionRid {}", collectionRid); - return tryLookupAsync(collectionRid, routingMap, properties); - } - - return Single.just(routingMap); - - }).map(routingMap -> { - if (routingMap != null) { - // TODO: the routingMap.getOverlappingRanges(range) returns Collection - // maybe we should consider changing to ArrayList to avoid conversion - return new ArrayList<>(routingMap.getOverlappingRanges(range)); - } else { - logger.debug("Routing Map Null for collection: {} for range: {}, forceRefresh:{}", collectionRid, range.toString(), forceRefresh); - return null; - } - }); - } - - /* (non-Javadoc) - * @see com.microsoft.azure.cosmosdb.rx.internal.caches.IPartitionKeyRangeCache#tryGetPartitionKeyRangeByIdAsync(java.lang.String, java.lang.String, boolean) - */ - @Override - public Single tryGetPartitionKeyRangeByIdAsync(String collectionResourceId, String partitionKeyRangeId, - boolean forceRefresh, Map properties) { - - Single routingMapObs = tryLookupAsync(collectionResourceId, null, properties); - - return routingMapObs.flatMap(routingMap -> { - if (forceRefresh && routingMap != null) { - return tryLookupAsync(collectionResourceId, routingMap, properties); - } - - return Single.just(routingMap); - - }).map(routingMap -> { - if (routingMap != null) { - return routingMap.getRangeByPartitionKeyRangeId(partitionKeyRangeId); - } else { - logger.debug("Routing Map Null for collection: {}, PartitionKeyRangeId: {}, forceRefresh:{}", collectionResourceId, partitionKeyRangeId, forceRefresh); - return null; - } - }); - } - - /* (non-Javadoc) - * @see com.microsoft.azure.cosmosdb.rx.internal.caches.IPartitionKeyRangeCache#tryGetRangeByPartitionKeyRangeId(java.lang.String, java.lang.String) - */ - @Override - public Single tryGetRangeByPartitionKeyRangeId(String collectionRid, String partitionKeyRangeId, Map properties) { - Single routingMapObs = routingMapCache.getAsync( - collectionRid, - null, - () -> getRoutingMapForCollectionAsync(collectionRid, null, properties)); - - return routingMapObs.map(routingMap -> routingMap.getRangeByPartitionKeyRangeId(partitionKeyRangeId)) - .onErrorResumeNext(err -> { - DocumentClientException dce = Utils.as(err, DocumentClientException.class); - logger.debug("tryGetRangeByPartitionKeyRangeId on collectionRid {} and partitionKeyRangeId {} encountered failure", - collectionRid, partitionKeyRangeId, err); - - if (dce != null && Exceptions.isStatusCode(dce, HttpConstants.StatusCodes.NOTFOUND)) { - return Single.just(null); - } - - return Single.error(dce); - }); - } - - private Single getRoutingMapForCollectionAsync( - String collectionRid, - CollectionRoutingMap previousRoutingMap, - Map properties) { - - // TODO: NOTE: main java code doesn't do anything in regard to the previous routing map - // .Net code instead of using DocumentClient controls sending request and receiving requests here - - // here we stick to what main java sdk does, investigate later. - - Single> rangesObs = getPartitionKeyRange(collectionRid, false, properties); - - return rangesObs.flatMap(ranges -> { - - List> rangesTuples = - ranges.stream().map(range -> new ImmutablePair<>(range, (IServerIdentity) null)).collect(Collectors.toList()); - - - CollectionRoutingMap routingMap; - if (previousRoutingMap == null) - { - // Splits could have happened during change feed query and we might have a mix of gone and new ranges. - Set goneRanges = new HashSet<>(ranges.stream().flatMap(range -> CollectionUtils.emptyIfNull(range.getParents()).stream()).collect(Collectors.toSet())); - - routingMap = InMemoryCollectionRoutingMap.tryCreateCompleteRoutingMap( - rangesTuples.stream().filter(tuple -> !goneRanges.contains(tuple.left.getId())).collect(Collectors.toList()), - collectionRid); - } - else - { - routingMap = previousRoutingMap.tryCombine(rangesTuples); - } - - if (routingMap == null) - { - // Range information either doesn't exist or is not complete. - return Single.error(new NotFoundException(String.format("GetRoutingMapForCollectionAsync(collectionRid: {%s}), Range information either doesn't exist or is not complete.", collectionRid))); - } - - return Single.just(routingMap); - }); - } - - private Single> getPartitionKeyRange(String collectionRid, boolean forceRefresh, Map properties) { - RxDocumentServiceRequest request = RxDocumentServiceRequest.create( - OperationType.ReadFeed, - collectionRid, - ResourceType.PartitionKeyRange, - null - ); //this request doesn't actually go to server - - request.requestContext.resolvedCollectionRid = collectionRid; - Single collectionObs = collectionCache.resolveCollectionAsync(request); - - return collectionObs.flatMap(coll -> { - - FeedOptions feedOptions = new FeedOptions(); - if (properties != null) { - feedOptions.setProperties(properties); - } - Observable> rs = client.readPartitionKeyRanges(coll.getSelfLink(), feedOptions) - // maxConcurrent = 1 to makes it in the right order - .flatMap(p -> Observable.from(p.getResults()), 1).toList(); - return rs.toSingle(); - }); - } -} - diff --git a/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/directconnectivity/GlobalAddressResolver.java b/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/directconnectivity/GlobalAddressResolver.java deleted file mode 100644 index 2299c4a04d31..000000000000 --- a/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/internal/directconnectivity/GlobalAddressResolver.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal.directconnectivity; - - -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.AddressInformation; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.AddressResolver; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.GatewayAddressCache; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.GatewayServiceConfigurationReader; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.IAddressResolver; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import com.microsoft.azure.cosmosdb.internal.routing.CollectionRoutingMap; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import com.microsoft.azure.cosmosdb.rx.internal.GlobalEndpointManager; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxCollectionCache; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxPartitionKeyRangeCache; -import io.netty.buffer.ByteBuf; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import rx.Completable; -import rx.Single; - -import java.net.URL; -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Queue; -import java.util.concurrent.ConcurrentHashMap; -import java.util.stream.Collectors; - -public class GlobalAddressResolver implements IAddressResolver { - private final static int MaxBackupReadRegions = 3; - private final GlobalEndpointManager endpointManager; - private final Protocol protocol; - private final IAuthorizationTokenProvider tokenProvider; - private final UserAgentContainer userAgentContainer; - private final RxCollectionCache collectionCache; - private final RxPartitionKeyRangeCache routingMapProvider; - private final int maxEndpoints; - private final GatewayServiceConfigurationReader serviceConfigReader; - final Map addressCacheByEndpoint; - - private GatewayAddressCache gatewayAddressCache; - private AddressResolver addressResolver; - private CompositeHttpClient httpClient; - - public GlobalAddressResolver( - CompositeHttpClient httpClient, - GlobalEndpointManager endpointManager, - Protocol protocol, - IAuthorizationTokenProvider tokenProvider, - RxCollectionCache collectionCache, - RxPartitionKeyRangeCache routingMapProvider, - UserAgentContainer userAgentContainer, - GatewayServiceConfigurationReader serviceConfigReader, - ConnectionPolicy connectionPolicy) { - - this.httpClient = httpClient; - this.endpointManager = endpointManager; - this.protocol = protocol; - this.tokenProvider = tokenProvider; - this.userAgentContainer = userAgentContainer; - this.collectionCache = collectionCache; - this.routingMapProvider = routingMapProvider; - this.serviceConfigReader = serviceConfigReader; - - int maxBackupReadEndpoints = (connectionPolicy.isEnableReadRequestsFallback() == null || connectionPolicy.isEnableReadRequestsFallback()) ? GlobalAddressResolver.MaxBackupReadRegions : 0; - this.maxEndpoints = maxBackupReadEndpoints + 2; // for write and alternate write endpoint (during failover) - this.addressCacheByEndpoint = new ConcurrentHashMap<>(); - - for (URL endpoint : endpointManager.getWriteEndpoints()) { - this.getOrAddEndpoint(endpoint); - } - for (URL endpoint : endpointManager.getReadEndpoints()) { - this.getOrAddEndpoint(endpoint); - } - } - - Completable openAsync(DocumentCollection collection) { - Single routingMap = this.routingMapProvider.tryLookupAsync(collection.getId(), null, null); - return routingMap.flatMapCompletable(collectionRoutingMap -> { - if (collectionRoutingMap == null) { - return Completable.complete(); - } - - List ranges = ((List)collectionRoutingMap.getOrderedPartitionKeyRanges()).stream().map(range -> - new PartitionKeyRangeIdentity(collection.getResourceId(), range.getId())).collect(Collectors.toList()); - List tasks = new ArrayList<>(); - for (EndpointCache endpointCache : this.addressCacheByEndpoint.values()) { - tasks.add(endpointCache.addressCache.openAsync(collection, ranges)); - } - return Completable.mergeDelayError(tasks); - }); - } - - @Override - public Single resolveAsync(RxDocumentServiceRequest request, boolean forceRefresh) { - IAddressResolver resolver = this.getAddressResolver(request); - return resolver.resolveAsync(request, forceRefresh); - } - - public void dispose() { - for (EndpointCache endpointCache : this.addressCacheByEndpoint.values()) { - endpointCache.addressCache.dispose(); - } - } - - private IAddressResolver getAddressResolver(RxDocumentServiceRequest rxDocumentServiceRequest) { - URL endpoint = this.endpointManager.resolveServiceEndpoint(rxDocumentServiceRequest); - return this.getOrAddEndpoint(endpoint).addressResolver; - } - - private EndpointCache getOrAddEndpoint(URL endpoint) { - EndpointCache endpointCache = this.addressCacheByEndpoint.computeIfAbsent(endpoint , key -> { - GatewayAddressCache gatewayAddressCache = new GatewayAddressCache(endpoint, protocol, this.tokenProvider, this.userAgentContainer, this.httpClient); - AddressResolver addressResolver = new AddressResolver(); - addressResolver.initializeCaches(this.collectionCache, this.routingMapProvider, gatewayAddressCache); - EndpointCache cache = new EndpointCache(); - cache.addressCache = gatewayAddressCache; - cache.addressResolver = addressResolver; - return cache; - }); - - if (this.addressCacheByEndpoint.size() > this.maxEndpoints) { - List allEndpoints = new ArrayList(this.endpointManager.getWriteEndpoints()); - allEndpoints.addAll(this.endpointManager.getReadEndpoints()); - Collections.reverse(allEndpoints); - Queue endpoints = new LinkedList<>(allEndpoints); - while (this.addressCacheByEndpoint.size() > this.maxEndpoints) { - if (endpoints.size() > 0) { - URL dequeueEnpoint = ((LinkedList) endpoints).pop(); - if (this.addressCacheByEndpoint.get(dequeueEnpoint) != null) { - this.addressCacheByEndpoint.remove(dequeueEnpoint); - } - } else { - break; - } - } - } - return endpointCache; - } - - static class EndpointCache { - GatewayAddressCache addressCache; - AddressResolver addressResolver; - } -} diff --git a/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/package-info.java b/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/package-info.java deleted file mode 100644 index 2a008122642e..000000000000 --- a/cosmosdb/data-plane/sdk/src/main/java/com/microsoft/azure/cosmosdb/rx/package-info.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -/** - * This package provides Rx interfaces for interacting with Azure Cosmos DB. - */ -package com.microsoft.azure.cosmosdb.rx; \ No newline at end of file diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressValidator.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressValidator.java deleted file mode 100644 index bb19bcfbe40b..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/AddressValidator.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import org.assertj.core.api.Condition; - -import java.util.ArrayList; -import java.util.List; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * This is a helper class for validating a partition address for tests. - */ -public interface AddressValidator { - - void validate(Address address); - - class Builder { - private List validators = new ArrayList<>(); - - public AddressValidator build() { - return new AddressValidator() { - - @Override - public void validate(Address address) { - for (AddressValidator validator : validators) { - validator.validate(address); - } - } - }; - } - - public Builder withId(final String resourceId) { - validators.add(new AddressValidator() { - - @Override - public void validate(Address address) { - assertThat(address.getId()).as("check Resource Id").isEqualTo(resourceId); - } - }); - return this; - } - - - - public Builder withProperty(String propertyName, Condition validatingCondition) { - validators.add(new AddressValidator() { - - @Override - public void validate(Address address) { - assertThat(address.get(propertyName)).is(validatingCondition); - - } - }); - return this; - } - - public Builder withProperty(String propertyName, Object value) { - validators.add(new AddressValidator() { - - @Override - public void validate(Address address) { - assertThat(address.get(propertyName)).isEqualTo(value); - - } - }); - return this; - } - - public Builder isPrimary(boolean isPrimary) { - validators.add(new AddressValidator() { - - @Override - public void validate(Address address) { - assertThat(address.IsPrimary()).isTrue(); - } - }); - return this; - } - - public Builder httpsProtocol() { - validators.add(new AddressValidator() { - - @Override - public void validate(Address address) { - assertThat(address.getProtocolScheme()).isEqualTo("https"); - } - }); - return this; - } - - public Builder protocol(Protocol protocol) { - validators.add(new AddressValidator() { - - @Override - public void validate(Address address) { - if (protocol == Protocol.Https) { - assertThat(address.getProtocolScheme()).isEqualTo("https"); - } else if (protocol == Protocol.Tcp){ - assertThat(address.getProtocolScheme()).isEqualTo("rntbd"); - } - } - }); - return this; - } - - public Builder withRid(String rid) { - validators.add(new AddressValidator() { - - @Override - public void validate(Address address) { - assertThat(address.getResourceId()).isEqualTo(rid); - } - }); - return this; - } - - public Builder withPartitionKeyRangeId(String partitionKeyRangeId) { - validators.add(new AddressValidator() { - - @Override - public void validate(Address address) { - assertThat(address.getParitionKeyRangeId()).isEqualTo(partitionKeyRangeId); - } - }); - return this; - } - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/BarrierRequestHelperTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/BarrierRequestHelperTest.java deleted file mode 100644 index 57f6a4f79d0e..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/BarrierRequestHelperTest.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.TestConfigurations; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentClientImpl; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -import java.util.Map; -import java.util.UUID; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Fail.fail; - -public class BarrierRequestHelperTest { - @Test(groups = "direct") - public void barrierBasic() { - IAuthorizationTokenProvider authTokenProvider = getIAuthorizationTokenProvider(); - - for (ResourceType resourceType : ResourceType.values()) { - - for (OperationType operationType : OperationType.values()) { - Document randomResource = new Document(); - randomResource.setId(UUID.randomUUID().toString()); - RxDocumentServiceRequest request = - RxDocumentServiceRequest.create(operationType, resourceType, "/dbs/7mVFAA==/colls/7mVFAP1jpeU=", randomResource, (Map) null); - - BarrierRequestHelper.createAsync(request, authTokenProvider, 10l, 10l).toCompletable().await(); - request = - RxDocumentServiceRequest.create(operationType, resourceType, "/dbs/7mVFAA==", randomResource, null); - - request.setResourceId("3"); - try { - BarrierRequestHelper.createAsync(request, authTokenProvider, 10l, 10l).toCompletable().await(); - } catch (Exception e) { - if (!BarrierRequestHelper.isCollectionHeadBarrierRequest(resourceType, operationType)) { - fail("Should not fail for non-collection head combinations"); - } - } - } - } - } - - @Test(groups = "direct") - public void barrierDBFeed() { - IAuthorizationTokenProvider authTokenProvider = getIAuthorizationTokenProvider(); - - ResourceType resourceType = ResourceType.DocumentCollection; - OperationType operationType = OperationType.Query; - - Document randomResource = new Document(); - randomResource.setId(UUID.randomUUID().toString()); - RxDocumentServiceRequest request = - RxDocumentServiceRequest.create(operationType, resourceType, "/dbs/7mVFAA==/colls/7mVFAP1jpeU=", randomResource, (Map) null); - - RxDocumentServiceRequest barrierRequest = BarrierRequestHelper.createAsync(request, authTokenProvider, 11l, 10l).toBlocking().value(); - - assertThat(barrierRequest.getOperationType()).isEqualTo(OperationType.HeadFeed); - assertThat(barrierRequest.getResourceType()).isEqualTo(ResourceType.Database); - - - assertThat(getTargetGlobalLsn(barrierRequest)).isEqualTo(10l); - assertThat(getTargetLsn(barrierRequest)).isEqualTo(11l); - } - - @Test(groups = "direct") - public void barrierDocumentQueryNameBasedRequest() { - IAuthorizationTokenProvider authTokenProvider = getIAuthorizationTokenProvider(); - - ResourceType resourceType = ResourceType.Document; - OperationType operationType = OperationType.Query; - - Document randomResource = new Document(); - randomResource.setId(UUID.randomUUID().toString()); - RxDocumentServiceRequest request = - RxDocumentServiceRequest.create(operationType, resourceType, "/dbs/dbname/colls/collname", randomResource, (Map) null); - - RxDocumentServiceRequest barrierRequest = BarrierRequestHelper.createAsync(request, authTokenProvider, 11l, 10l).toBlocking().value(); - - assertThat(barrierRequest.getOperationType()).isEqualTo(OperationType.Head); - assertThat(barrierRequest.getResourceType()).isEqualTo(ResourceType.DocumentCollection); - assertThat(barrierRequest.getResourceAddress()).isEqualTo("dbs/dbname/colls/collname"); - - assertThat(getTargetGlobalLsn(barrierRequest)).isEqualTo(10l); - assertThat(getTargetLsn(barrierRequest)).isEqualTo(11l); - } - - @Test(groups = "direct") - public void barrierDocumentReadNameBasedRequest() { - IAuthorizationTokenProvider authTokenProvider = getIAuthorizationTokenProvider(); - - ResourceType resourceType = ResourceType.Document; - OperationType operationType = OperationType.Read; - - Document randomResource = new Document(); - randomResource.setId(UUID.randomUUID().toString()); - RxDocumentServiceRequest request = - RxDocumentServiceRequest.create(operationType, resourceType, "/dbs/dbname/colls/collname", randomResource, (Map) null); - - RxDocumentServiceRequest barrierRequest = BarrierRequestHelper.createAsync(request, authTokenProvider, 11l, 10l).toBlocking().value(); - - assertThat(barrierRequest.getOperationType()).isEqualTo(OperationType.Head); - assertThat(barrierRequest.getResourceType()).isEqualTo(ResourceType.DocumentCollection); - assertThat(barrierRequest.getResourceAddress()).isEqualTo("dbs/dbname/colls/collname"); - - assertThat(getTargetGlobalLsn(barrierRequest)).isEqualTo(10l); - assertThat(getTargetLsn(barrierRequest)).isEqualTo(11l); - assertThat(barrierRequest.getIsNameBased()).isEqualTo(true); - - } - - @Test(groups = "direct") - public void barrierDocumentReadRidBasedRequest() { - IAuthorizationTokenProvider authTokenProvider = getIAuthorizationTokenProvider(); - - ResourceType resourceType = ResourceType.Document; - OperationType operationType = OperationType.Read; - - Document randomResource = new Document(); - randomResource.setId(UUID.randomUUID().toString()); - RxDocumentServiceRequest request = - RxDocumentServiceRequest.create(operationType, "7mVFAA==", resourceType, (Map) null); - - RxDocumentServiceRequest barrierRequest = BarrierRequestHelper.createAsync(request, authTokenProvider, 11l, 10l).toBlocking().value(); - - assertThat(barrierRequest.getOperationType()).isEqualTo(OperationType.Head); - assertThat(barrierRequest.getResourceType()).isEqualTo(ResourceType.DocumentCollection); - assertThat(barrierRequest.getResourceAddress()).isEqualTo("7mVFAA=="); - - assertThat(getTargetGlobalLsn(barrierRequest)).isEqualTo(10l); - assertThat(getTargetLsn(barrierRequest)).isEqualTo(11l); - assertThat(barrierRequest.getIsNameBased()).isEqualTo(false); - } - - @DataProvider(name = "isCollectionHeadBarrierRequestArgProvider") - public Object[][] isCollectionHeadBarrierRequestArgProvider() { - return new Object[][]{ - // resourceType, operationType, isCollectionHeadBarrierRequest - - {ResourceType.Attachment, null, true}, - {ResourceType.Document, null, true}, - {ResourceType.Conflict, null, true}, - {ResourceType.StoredProcedure, null, true}, - {ResourceType.Attachment, null, true}, - {ResourceType.Trigger, null, true}, - - {ResourceType.DocumentCollection, OperationType.ReadFeed, false}, - {ResourceType.DocumentCollection, OperationType.Query, false}, - {ResourceType.DocumentCollection, OperationType.SqlQuery, false}, - - {ResourceType.DocumentCollection, OperationType.Create, true}, - {ResourceType.DocumentCollection, OperationType.Read, true}, - {ResourceType.DocumentCollection, OperationType.Replace, true}, - {ResourceType.DocumentCollection, OperationType.ExecuteJavaScript, true}, - - {ResourceType.PartitionKeyRange, null, false}, - }; - } - - @Test(groups = "direct", dataProvider = "isCollectionHeadBarrierRequestArgProvider") - public void isCollectionHeadBarrierRequest(ResourceType resourceType, - OperationType operationType, - boolean expectedResult) { - if (operationType != null) { - boolean actual = BarrierRequestHelper.isCollectionHeadBarrierRequest(resourceType, operationType); - assertThat(actual).isEqualTo(expectedResult); - } else { - for (OperationType type : OperationType.values()) { - boolean actual = BarrierRequestHelper.isCollectionHeadBarrierRequest(resourceType, type); - assertThat(actual).isEqualTo(expectedResult); - } - } - } - - private IAuthorizationTokenProvider getIAuthorizationTokenProvider() { - return (RxDocumentClientImpl) - new AsyncDocumentClient.Builder() - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withServiceEndpoint(TestConfigurations.HOST) - .build(); - } - - private String getHeaderValue(RxDocumentServiceRequest req, String name) { - return req.getHeaders().get(name); - } - - private String getPartitionKey(RxDocumentServiceRequest req) { - return getHeaderValue(req, HttpConstants.HttpHeaders.PARTITION_KEY); - } - - private String getCollectionRid(RxDocumentServiceRequest req) { - return getHeaderValue(req, WFConstants.BackendHeaders.COLLECTION_RID); - } - - private PartitionKeyRangeIdentity getPartitionKeyRangeIdentity(RxDocumentServiceRequest req) { - return req.getPartitionKeyRangeIdentity(); - } - - private Long getTargetLsn(RxDocumentServiceRequest req) { - return Long.parseLong(getHeaderValue(req, HttpConstants.HttpHeaders.TARGET_LSN)); - } - - private Long getTargetGlobalLsn(RxDocumentServiceRequest req) { - return Long.parseLong(getHeaderValue(req, HttpConstants.HttpHeaders.TARGET_GLOBAL_COMMITTED_LSN)); - } -} - diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayAddressCacheTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayAddressCacheTest.java deleted file mode 100644 index 54d581f42615..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayAddressCacheTest.java +++ /dev/null @@ -1,880 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; -import com.microsoft.azure.cosmosdb.ConfigsBuilder; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; -import com.microsoft.azure.cosmosdb.rx.TestConfigurations; -import com.microsoft.azure.cosmosdb.rx.TestSuiteBase; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.HttpClientFactory; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentClientImpl; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import io.netty.buffer.ByteBuf; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import org.mockito.Matchers; -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Single; -import rx.observers.TestSubscriber; - -import java.net.URL; -import java.time.Instant; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; - -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; - -public class GatewayAddressCacheTest extends TestSuiteBase { - private Database createdDatabase; - private DocumentCollection createdCollection; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuilders") - public GatewayAddressCacheTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @DataProvider(name = "targetPartitionsKeyRangeListAndCollectionLinkParams") - public Object[][] partitionsKeyRangeListAndCollectionLinkParams() { - return new Object[][] { - // target partition key range ids, collection link - { ImmutableList.of("0"), getNameBasedCollectionLink(), Protocol.Tcp }, - { ImmutableList.of("0"), getNameBasedCollectionLink(), Protocol.Https }, - - { ImmutableList.of("1"), getNameBasedCollectionLink(), Protocol.Https }, - { ImmutableList.of("1"), getCollectionSelfLink(), Protocol.Https }, - { ImmutableList.of("3"), getNameBasedCollectionLink(), Protocol.Https }, - - { ImmutableList.of("0", "1"), getNameBasedCollectionLink(), Protocol.Https }, - { ImmutableList.of("1", "3"), getNameBasedCollectionLink(), Protocol.Https }, - }; - } - - @DataProvider(name = "protocolProvider") - public Object[][] protocolProvider() { - return new Object[][]{ - { Protocol.Https }, - { Protocol.Tcp }, - }; - } - - @Test(groups = { "direct" }, dataProvider = "targetPartitionsKeyRangeListAndCollectionLinkParams", timeOut = TIMEOUT) - public void getServerAddressesViaGateway(List partitionKeyRangeIds, - String collectionLink, - Protocol protocol) throws Exception { - Configs configs = ConfigsBuilder.instance().withProtocol(protocol).build(); - // ask gateway for the addresses - URL serviceEndpoint = new URL(TestConfigurations.HOST); - IAuthorizationTokenProvider authorizationTokenProvider = (RxDocumentClientImpl) client; - - GatewayAddressCache cache = new GatewayAddressCache(serviceEndpoint, - protocol, - authorizationTokenProvider, - null, - getCompositeHttpClient(configs)); - - RxDocumentServiceRequest req = - RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Document, - collectionLink + "/docs/", - getDocumentDefinition(), new HashMap<>()); - - Single> addresses = cache.getServerAddressesViaGatewayAsync( - req, createdCollection.getResourceId(), partitionKeyRangeIds, false); - - PartitionReplicasAddressesValidator validator = new PartitionReplicasAddressesValidator.Builder() - .withProtocol(protocol) - .replicasOfPartitions(partitionKeyRangeIds) - .build(); - - validateSuccess(addresses, validator, TIMEOUT); - } - - @Test(groups = { "direct" }, dataProvider = "protocolProvider", timeOut = TIMEOUT) - public void getMasterAddressesViaGatewayAsync(Protocol protocol) throws Exception { - Configs configs = ConfigsBuilder.instance().withProtocol(protocol).build(); - // ask gateway for the addresses - URL serviceEndpoint = new URL(TestConfigurations.HOST); - IAuthorizationTokenProvider authorizationTokenProvider = (RxDocumentClientImpl) client; - - GatewayAddressCache cache = new GatewayAddressCache(serviceEndpoint, - protocol, - authorizationTokenProvider, - null, - getCompositeHttpClient(configs)); - - RxDocumentServiceRequest req = - RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Database, - "/dbs", - new Database(), new HashMap<>()); - - Single> addresses = cache.getMasterAddressesViaGatewayAsync(req, ResourceType.Database, - null, "/dbs/", false, false, null); - - PartitionReplicasAddressesValidator validator = new PartitionReplicasAddressesValidator.Builder() - .withProtocol(protocol) - .replicasOfSamePartition() - .build(); - - validateSuccess(addresses, validator, TIMEOUT); - } - - @DataProvider(name = "targetPartitionsKeyRangeAndCollectionLinkParams") - public Object[][] partitionsKeyRangeAndCollectionLinkParams() { - return new Object[][] { - // target partition key range ids, collection link, protocol - { "0", getNameBasedCollectionLink(), Protocol.Tcp }, - { "0", getNameBasedCollectionLink(), Protocol.Https }, - - { "1", getNameBasedCollectionLink(), Protocol.Https} , - { "1", getCollectionSelfLink(), Protocol.Https }, - { "3", getNameBasedCollectionLink(), Protocol.Https }, - }; - } - - @Test(groups = { "direct" }, dataProvider = "targetPartitionsKeyRangeAndCollectionLinkParams", timeOut = TIMEOUT) - public void tryGetAddresses_ForDataPartitions(String partitionKeyRangeId, String collectionLink, Protocol protocol) throws Exception { - Configs configs = ConfigsBuilder.instance().withProtocol(protocol).build(); - URL serviceEndpoint = new URL(TestConfigurations.HOST); - IAuthorizationTokenProvider authorizationTokenProvider = (RxDocumentClientImpl) client; - - GatewayAddressCache cache = new GatewayAddressCache(serviceEndpoint, - protocol, - authorizationTokenProvider, - null, - getCompositeHttpClient(configs)); - - RxDocumentServiceRequest req = - RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Document, - collectionLink, - new Database(), new HashMap<>()); - - String collectionRid = createdCollection.getResourceId(); - - PartitionKeyRangeIdentity partitionKeyRangeIdentity = new PartitionKeyRangeIdentity(collectionRid, partitionKeyRangeId); - boolean forceRefreshPartitionAddresses = false; - Single addressesInfosFromCacheObs = cache.tryGetAddresses(req, partitionKeyRangeIdentity, forceRefreshPartitionAddresses); - - ArrayList addressInfosFromCache = Lists.newArrayList(getSuccessResult(addressesInfosFromCacheObs, TIMEOUT)); - - Single> masterAddressFromGatewayObs = cache.getServerAddressesViaGatewayAsync(req, - collectionRid, ImmutableList.of(partitionKeyRangeId), false); - List
expectedAddresses = getSuccessResult(masterAddressFromGatewayObs, TIMEOUT); - - assertSameAs(addressInfosFromCache, expectedAddresses); - } - - @DataProvider(name = "openAsyncTargetAndTargetPartitionsKeyRangeAndCollectionLinkParams") - public Object[][] openAsyncTargetAndPartitionsKeyRangeTargetAndCollectionLinkParams() { - return new Object[][] { - // openAsync target partition key range ids, target partition key range id, collection link - { ImmutableList.of("0", "1"), "0", getNameBasedCollectionLink() }, - { ImmutableList.of("0", "1"), "1", getNameBasedCollectionLink() }, - { ImmutableList.of("0", "1"), "1", getCollectionSelfLink() }, - }; - } - - @Test(groups = { "direct" }, - dataProvider = "openAsyncTargetAndTargetPartitionsKeyRangeAndCollectionLinkParams", - timeOut = TIMEOUT) - public void tryGetAddresses_ForDataPartitions_AddressCachedByOpenAsync_NoHttpRequest( - List allPartitionKeyRangeIds, - String partitionKeyRangeId, String collectionLink) throws Exception { - Configs configs = new Configs(); - HttpClientUnderTestWrapper httpClientWrapper = getHttpClientUnderTestWrapper(configs); - - URL serviceEndpoint = new URL(TestConfigurations.HOST); - IAuthorizationTokenProvider authorizationTokenProvider = (RxDocumentClientImpl) client; - - GatewayAddressCache cache = new GatewayAddressCache(serviceEndpoint, - Protocol.Https, - authorizationTokenProvider, - null, - httpClientWrapper.getSpyHttpClient()); - - String collectionRid = createdCollection.getResourceId(); - - List pkriList = allPartitionKeyRangeIds.stream().map( - pkri -> new PartitionKeyRangeIdentity(collectionRid, pkri)).collect(Collectors.toList()); - - cache.openAsync(createdCollection, pkriList).await(); - - assertThat(httpClientWrapper.capturedRequest).asList().hasSize(1); - httpClientWrapper.capturedRequest.clear(); - - RxDocumentServiceRequest req = - RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Document, - collectionLink, - new Database(), new HashMap<>()); - - PartitionKeyRangeIdentity partitionKeyRangeIdentity = new PartitionKeyRangeIdentity(collectionRid, partitionKeyRangeId); - boolean forceRefreshPartitionAddresses = false; - Single addressesInfosFromCacheObs = cache.tryGetAddresses(req, partitionKeyRangeIdentity, forceRefreshPartitionAddresses); - ArrayList addressInfosFromCache = Lists.newArrayList(getSuccessResult(addressesInfosFromCacheObs, TIMEOUT)); - - // no new request is made - assertThat(httpClientWrapper.capturedRequest) - .describedAs("no http request: addresses already cached by openAsync") - .asList().hasSize(0); - - Single> masterAddressFromGatewayObs = cache.getServerAddressesViaGatewayAsync(req, - collectionRid, ImmutableList.of(partitionKeyRangeId), false); - List
expectedAddresses = getSuccessResult(masterAddressFromGatewayObs, TIMEOUT); - - assertThat(httpClientWrapper.capturedRequest) - .describedAs("getServerAddressesViaGatewayAsync will read addresses from gateway") - .asList().hasSize(1); - - assertSameAs(addressInfosFromCache, expectedAddresses); - } - - @Test(groups = { "direct" }, - dataProvider = "openAsyncTargetAndTargetPartitionsKeyRangeAndCollectionLinkParams", - timeOut = TIMEOUT) - public void tryGetAddresses_ForDataPartitions_ForceRefresh( - List allPartitionKeyRangeIds, - String partitionKeyRangeId, - String collectionLink) throws Exception { - Configs configs = new Configs(); - HttpClientUnderTestWrapper httpClientWrapper = getHttpClientUnderTestWrapper(configs); - - URL serviceEndpoint = new URL(TestConfigurations.HOST); - IAuthorizationTokenProvider authorizationTokenProvider = (RxDocumentClientImpl) client; - - GatewayAddressCache cache = new GatewayAddressCache(serviceEndpoint, - Protocol.Https, - authorizationTokenProvider, - null, - httpClientWrapper.getSpyHttpClient()); - - String collectionRid = createdCollection.getResourceId(); - - List pkriList = allPartitionKeyRangeIds.stream().map( - pkri -> new PartitionKeyRangeIdentity(collectionRid, pkri)).collect(Collectors.toList()); - - cache.openAsync(createdCollection, pkriList).await(); - - assertThat(httpClientWrapper.capturedRequest).asList().hasSize(1); - httpClientWrapper.capturedRequest.clear(); - - RxDocumentServiceRequest req = - RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Document, - collectionLink, - new Database(), new HashMap<>()); - - PartitionKeyRangeIdentity partitionKeyRangeIdentity = new PartitionKeyRangeIdentity(collectionRid, partitionKeyRangeId); - Single addressesInfosFromCacheObs = cache.tryGetAddresses(req, partitionKeyRangeIdentity, true); - ArrayList addressInfosFromCache = Lists.newArrayList(getSuccessResult(addressesInfosFromCacheObs, TIMEOUT)); - - // no new request is made - assertThat(httpClientWrapper.capturedRequest) - .describedAs("force refresh fetched from gateway") - .asList().hasSize(1); - - Single> masterAddressFromGatewayObs = cache.getServerAddressesViaGatewayAsync(req, - collectionRid, ImmutableList.of(partitionKeyRangeId), false); - List
expectedAddresses = getSuccessResult(masterAddressFromGatewayObs, TIMEOUT); - - assertThat(httpClientWrapper.capturedRequest) - .describedAs("getServerAddressesViaGatewayAsync will read addresses from gateway") - .asList().hasSize(2); - - assertSameAs(addressInfosFromCache, expectedAddresses); - } - - @Test(groups = { "direct" }, - dataProvider = "openAsyncTargetAndTargetPartitionsKeyRangeAndCollectionLinkParams", - timeOut = TIMEOUT) - public void tryGetAddresses_ForDataPartitions_Suboptimal_Refresh( - List allPartitionKeyRangeIds, - String partitionKeyRangeId, - String collectionLink) throws Exception { - Configs configs = new Configs(); - HttpClientUnderTestWrapper httpClientWrapper = getHttpClientUnderTestWrapper(configs); - - URL serviceEndpoint = new URL(TestConfigurations.HOST); - IAuthorizationTokenProvider authorizationTokenProvider = (RxDocumentClientImpl) client; - - int suboptimalRefreshTime = 2; - - GatewayAddressCache origCache = new GatewayAddressCache(serviceEndpoint, - Protocol.Https, - authorizationTokenProvider, - null, - httpClientWrapper.getSpyHttpClient(), - suboptimalRefreshTime); - - String collectionRid = createdCollection.getResourceId(); - - List pkriList = allPartitionKeyRangeIds.stream().map( - pkri -> new PartitionKeyRangeIdentity(collectionRid, pkri)).collect(Collectors.toList()); - - origCache.openAsync(createdCollection, pkriList).await(); - - assertThat(httpClientWrapper.capturedRequest).asList().hasSize(1); - httpClientWrapper.capturedRequest.clear(); - - RxDocumentServiceRequest req = - RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Document, - collectionLink, - new Database(), new HashMap<>()); - - PartitionKeyRangeIdentity partitionKeyRangeIdentity = new PartitionKeyRangeIdentity(collectionRid, partitionKeyRangeId); - Single addressesInfosFromCacheObs = origCache.tryGetAddresses(req, partitionKeyRangeIdentity, true); - ArrayList addressInfosFromCache = Lists.newArrayList(getSuccessResult(addressesInfosFromCacheObs, TIMEOUT)); - - // no new request is made - assertThat(httpClientWrapper.capturedRequest) - .describedAs("force refresh fetched from gateway") - .asList().hasSize(1); - - GatewayAddressCache spyCache = Mockito.spy(origCache); - - final AtomicInteger fetchCounter = new AtomicInteger(0); - Mockito.doAnswer(new Answer() { - @Override - public Single> answer(InvocationOnMock invocationOnMock) throws Throwable { - - RxDocumentServiceRequest req = invocationOnMock.getArgumentAt(0, RxDocumentServiceRequest.class); - String collectionRid = invocationOnMock.getArgumentAt(1, String.class); - List partitionKeyRangeIds = invocationOnMock.getArgumentAt(2, List.class); - boolean forceRefresh = invocationOnMock.getArgumentAt(3, Boolean.class); - - int cnt = fetchCounter.getAndIncrement(); - - if (cnt == 0) { - Single> res = origCache.getServerAddressesViaGatewayAsync(req, - collectionRid, - partitionKeyRangeIds, - forceRefresh); - - // remove one replica - return res.map(list -> removeOneReplica(list)); - } - - return origCache.getServerAddressesViaGatewayAsync(req, - collectionRid, - partitionKeyRangeIds, - forceRefresh); - } - }).when(spyCache).getServerAddressesViaGatewayAsync(Matchers.any(RxDocumentServiceRequest.class), Matchers.anyString(), - Matchers.anyList(), Matchers.anyBoolean()); - - httpClientWrapper.capturedRequest.clear(); - - // force refresh to replace existing with sub-optimal addresses - addressesInfosFromCacheObs = spyCache.tryGetAddresses(req, partitionKeyRangeIdentity, true); - AddressInformation[] suboptimalAddresses = getSuccessResult(addressesInfosFromCacheObs, TIMEOUT); - assertThat(httpClientWrapper.capturedRequest) - .describedAs("getServerAddressesViaGatewayAsync will read addresses from gateway") - .asList().hasSize(1); - httpClientWrapper.capturedRequest.clear(); - assertThat(suboptimalAddresses).hasSize(ServiceConfig.SystemReplicationPolicy.MaxReplicaSetSize - 1); - assertThat(fetchCounter.get()).isEqualTo(1); - - // no refresh, use cache - addressesInfosFromCacheObs = spyCache.tryGetAddresses(req, partitionKeyRangeIdentity, false); - suboptimalAddresses = getSuccessResult(addressesInfosFromCacheObs, TIMEOUT); - assertThat(httpClientWrapper.capturedRequest) - .describedAs("getServerAddressesViaGatewayAsync will read addresses from gateway") - .asList().hasSize(0); - assertThat(suboptimalAddresses).hasSize(ServiceConfig.SystemReplicationPolicy.MaxReplicaSetSize - 1); - assertThat(fetchCounter.get()).isEqualTo(1); - - // wait for refresh time - TimeUnit.SECONDS.sleep(suboptimalRefreshTime + 1); - - addressesInfosFromCacheObs = spyCache.tryGetAddresses(req, partitionKeyRangeIdentity, false); - AddressInformation[] addresses = getSuccessResult(addressesInfosFromCacheObs, TIMEOUT); - assertThat(addresses).hasSize(ServiceConfig.SystemReplicationPolicy.MaxReplicaSetSize); - assertThat(httpClientWrapper.capturedRequest) - .describedAs("getServerAddressesViaGatewayAsync will read addresses from gateway") - .asList().hasSize(1); - assertThat(fetchCounter.get()).isEqualTo(2); - } - - @Test(groups = { "direct" }, dataProvider = "protocolProvider",timeOut = TIMEOUT) - public void tryGetAddresses_ForMasterPartition(Protocol protocol) throws Exception { - Configs configs = ConfigsBuilder.instance().withProtocol(protocol).build(); - URL serviceEndpoint = new URL(TestConfigurations.HOST); - IAuthorizationTokenProvider authorizationTokenProvider = (RxDocumentClientImpl) client; - - GatewayAddressCache cache = new GatewayAddressCache(serviceEndpoint, - protocol, - authorizationTokenProvider, - null, - getCompositeHttpClient(configs)); - - RxDocumentServiceRequest req = - RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Database, - "/dbs", - new Database(), new HashMap<>()); - - PartitionKeyRangeIdentity partitionKeyRangeIdentity = new PartitionKeyRangeIdentity("M"); - boolean forceRefreshPartitionAddresses = false; - Single addressesInfosFromCacheObs = cache.tryGetAddresses(req, partitionKeyRangeIdentity, forceRefreshPartitionAddresses); - - ArrayList addressInfosFromCache = Lists.newArrayList(getSuccessResult(addressesInfosFromCacheObs, TIMEOUT)); - - Single> masterAddressFromGatewayObs = cache.getMasterAddressesViaGatewayAsync(req, ResourceType.Database, - null, "/dbs/", false, false, null); - List
expectedAddresses = getSuccessResult(masterAddressFromGatewayObs, TIMEOUT); - - assertSameAs(addressInfosFromCache, expectedAddresses); - } - - @DataProvider(name = "refreshTime") - public Object[][] refreshTime() { - return new Object[][] { - // refresh time, wait before doing tryGetAddresses - { 60, 1 }, - { 1, 2 }, - }; - } - - @Test(groups = { "direct" }, timeOut = TIMEOUT, dataProvider = "refreshTime") - public void tryGetAddresses_ForMasterPartition_MasterPartitionAddressAlreadyCached_NoNewHttpRequest( - int suboptimalPartitionForceRefreshIntervalInSeconds, - int waitTimeInBetweenAttemptsInSeconds - ) throws Exception { - Configs configs = new Configs(); - HttpClientUnderTestWrapper clientWrapper = getHttpClientUnderTestWrapper(configs); - - URL serviceEndpoint = new URL(TestConfigurations.HOST); - IAuthorizationTokenProvider authorizationTokenProvider = (RxDocumentClientImpl) client; - - - GatewayAddressCache cache = new GatewayAddressCache(serviceEndpoint, - Protocol.Https, - authorizationTokenProvider, - null, - clientWrapper.getSpyHttpClient(), - suboptimalPartitionForceRefreshIntervalInSeconds); - - RxDocumentServiceRequest req = - RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Database, - "/dbs", - new Database(), new HashMap<>()); - - PartitionKeyRangeIdentity partitionKeyRangeIdentity = new PartitionKeyRangeIdentity("M"); - boolean forceRefreshPartitionAddresses = false; - - // request master partition info to ensure it is cached. - AddressInformation[] expectedAddresses = cache.tryGetAddresses(req, - partitionKeyRangeIdentity, - forceRefreshPartitionAddresses) - .toBlocking().value(); - - assertThat(clientWrapper.capturedRequest).asList().hasSize(1); - clientWrapper.capturedRequest.clear(); - - - TimeUnit.SECONDS.sleep(waitTimeInBetweenAttemptsInSeconds); - - Single addressesObs = cache.tryGetAddresses(req, - partitionKeyRangeIdentity, - forceRefreshPartitionAddresses); - - AddressInformation[] actualAddresses = getSuccessResult(addressesObs, TIMEOUT); - - assertExactlyEqual(actualAddresses, expectedAddresses); - - // the cache address is used. no new http request is sent - assertThat(clientWrapper.capturedRequest).asList().hasSize(0); - } - - @Test(groups = { "direct" }, timeOut = TIMEOUT) - public void tryGetAddresses_ForMasterPartition_ForceRefresh() throws Exception { - Configs configs = new Configs(); - HttpClientUnderTestWrapper clientWrapper = getHttpClientUnderTestWrapper(configs); - - URL serviceEndpoint = new URL(TestConfigurations.HOST); - IAuthorizationTokenProvider authorizationTokenProvider = (RxDocumentClientImpl) client; - - GatewayAddressCache cache = new GatewayAddressCache(serviceEndpoint, - Protocol.Https, - authorizationTokenProvider, - null, - clientWrapper.getSpyHttpClient()); - - RxDocumentServiceRequest req = - RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Database, - "/dbs", - new Database(), new HashMap<>()); - - PartitionKeyRangeIdentity partitionKeyRangeIdentity = new PartitionKeyRangeIdentity("M"); - - // request master partition info to ensure it is cached. - AddressInformation[] expectedAddresses = cache.tryGetAddresses(req, - partitionKeyRangeIdentity, - false) - .toBlocking().value(); - - assertThat(clientWrapper.capturedRequest).asList().hasSize(1); - clientWrapper.capturedRequest.clear(); - - Single addressesObs = cache.tryGetAddresses(req, - partitionKeyRangeIdentity, - true); - - AddressInformation[] actualAddresses = getSuccessResult(addressesObs, TIMEOUT); - - assertExactlyEqual(actualAddresses, expectedAddresses); - - // the cache address is used. no new http request is sent - assertThat(clientWrapper.capturedRequest).asList().hasSize(1); - } - - private static List
removeOneReplica(List
addresses) { - addresses.remove(0); - return addresses; - } - - @Test(groups = { "direct" }, timeOut = TIMEOUT) - public void tryGetAddresses_SuboptimalMasterPartition_NotStaleEnough_NoRefresh() throws Exception { - Configs configs = new Configs(); - Instant start = Instant.now(); - HttpClientUnderTestWrapper clientWrapper = getHttpClientUnderTestWrapper(configs); - - URL serviceEndpoint = new URL(TestConfigurations.HOST); - IAuthorizationTokenProvider authorizationTokenProvider = (RxDocumentClientImpl) client; - - int refreshPeriodInSeconds = 10; - - GatewayAddressCache origCache = new GatewayAddressCache(serviceEndpoint, - Protocol.Https, - authorizationTokenProvider, - null, - clientWrapper.getSpyHttpClient(), refreshPeriodInSeconds); - - GatewayAddressCache spyCache = Mockito.spy(origCache); - - final AtomicInteger getMasterAddressesViaGatewayAsyncInvocation = new AtomicInteger(0); - Mockito.doAnswer(new Answer() { - @Override - public Single> answer(InvocationOnMock invocationOnMock) throws Throwable { - - RxDocumentServiceRequest request = invocationOnMock.getArgumentAt(0, RxDocumentServiceRequest.class); - ResourceType resourceType = invocationOnMock.getArgumentAt(1, ResourceType.class); - String resourceAddress = invocationOnMock.getArgumentAt(2, String.class); - String entryUrl = invocationOnMock.getArgumentAt(3, String.class); - boolean forceRefresh = invocationOnMock.getArgumentAt(4, Boolean.class); - boolean useMasterCollectionResolver = invocationOnMock.getArgumentAt(5, Boolean.class); - - int cnt = getMasterAddressesViaGatewayAsyncInvocation.getAndIncrement(); - - if (cnt == 0) { - Single> res = origCache.getMasterAddressesViaGatewayAsync( - request, - resourceType, - resourceAddress, - entryUrl, - forceRefresh, - useMasterCollectionResolver, - null); - - // remove one replica - return res.map(list -> removeOneReplica(list)); - } - - return origCache.getMasterAddressesViaGatewayAsync( - request, - resourceType, - resourceAddress, - entryUrl, - forceRefresh, - useMasterCollectionResolver, - null); - } - }).when(spyCache).getMasterAddressesViaGatewayAsync(Matchers.any(RxDocumentServiceRequest.class), Matchers.any(ResourceType.class), Matchers.anyString(), - Matchers.anyString(), Matchers.anyBoolean(), Matchers.anyBoolean(), Matchers.anyMap()); - - - RxDocumentServiceRequest req = - RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Database, - "/dbs", - new Database(), new HashMap<>()); - - PartitionKeyRangeIdentity partitionKeyRangeIdentity = new PartitionKeyRangeIdentity("M"); - - // request master partition info to ensure it is cached. - AddressInformation[] expectedAddresses = spyCache.tryGetAddresses(req, - partitionKeyRangeIdentity, - false) - .toBlocking().value(); - - assertThat(clientWrapper.capturedRequest).asList().hasSize(1); - clientWrapper.capturedRequest.clear(); - - Single addressesObs = spyCache.tryGetAddresses(req, - partitionKeyRangeIdentity, - false); - - AddressInformation[] actualAddresses = getSuccessResult(addressesObs, TIMEOUT); - - assertExactlyEqual(actualAddresses, expectedAddresses); - - // the cache address is used. no new http request is sent - assertThat(clientWrapper.capturedRequest).asList().hasSize(0); - - Instant end = Instant.now(); - assertThat(end.minusSeconds(refreshPeriodInSeconds)).isBefore(start); - } - - @Test(groups = { "direct" }, timeOut = TIMEOUT) - public void tryGetAddresses_SuboptimalMasterPartition_Stale_DoRefresh() throws Exception { - Configs configs = new Configs(); - HttpClientUnderTestWrapper clientWrapper = getHttpClientUnderTestWrapper(configs); - - URL serviceEndpoint = new URL(TestConfigurations.HOST); - IAuthorizationTokenProvider authorizationTokenProvider = (RxDocumentClientImpl) client; - - int refreshPeriodInSeconds = 1; - - GatewayAddressCache origCache = new GatewayAddressCache(serviceEndpoint, - Protocol.Https, - authorizationTokenProvider, - null, - clientWrapper.getSpyHttpClient(), refreshPeriodInSeconds); - - GatewayAddressCache spyCache = Mockito.spy(origCache); - - final AtomicInteger getMasterAddressesViaGatewayAsyncInvocation = new AtomicInteger(0); - Mockito.doAnswer(new Answer() { - @Override - public Single> answer(InvocationOnMock invocationOnMock) throws Throwable { - - System.out.print("fetch"); - - RxDocumentServiceRequest request = invocationOnMock.getArgumentAt(0, RxDocumentServiceRequest.class); - ResourceType resourceType = invocationOnMock.getArgumentAt(1, ResourceType.class); - String resourceAddress = invocationOnMock.getArgumentAt(2, String.class); - String entryUrl = invocationOnMock.getArgumentAt(3, String.class); - boolean forceRefresh = invocationOnMock.getArgumentAt(4, Boolean.class); - boolean useMasterCollectionResolver = invocationOnMock.getArgumentAt(5, Boolean.class); - - int cnt = getMasterAddressesViaGatewayAsyncInvocation.getAndIncrement(); - - if (cnt == 0) { - Single> res = origCache.getMasterAddressesViaGatewayAsync( - request, - resourceType, - resourceAddress, - entryUrl, - forceRefresh, - useMasterCollectionResolver, - null); - - // remove one replica - return res.map(list -> removeOneReplica(list)); - } - - return origCache.getMasterAddressesViaGatewayAsync( - request, - resourceType, - resourceAddress, - entryUrl, - forceRefresh, - useMasterCollectionResolver, - null); - } - }).when(spyCache).getMasterAddressesViaGatewayAsync(Matchers.any(RxDocumentServiceRequest.class), Matchers.any(ResourceType.class), Matchers.anyString(), - Matchers.anyString(), Matchers.anyBoolean(), Matchers.anyBoolean(), Matchers.anyMap()); - - RxDocumentServiceRequest req = - RxDocumentServiceRequest.create(OperationType.Create, ResourceType.Database, - "/dbs", - new Database(), new HashMap<>()); - - PartitionKeyRangeIdentity partitionKeyRangeIdentity = new PartitionKeyRangeIdentity("M"); - - // request master partition info to ensure it is cached. - AddressInformation[] subOptimalAddresses = spyCache.tryGetAddresses(req, - partitionKeyRangeIdentity, - false) - .toBlocking().value(); - - assertThat(getMasterAddressesViaGatewayAsyncInvocation.get()).isEqualTo(1); - assertThat(subOptimalAddresses).hasSize(ServiceConfig.SystemReplicationPolicy.MaxReplicaSetSize - 1); - - Instant start = Instant.now(); - TimeUnit.SECONDS.sleep(refreshPeriodInSeconds + 1); - Instant end = Instant.now(); - assertThat(end.minusSeconds(refreshPeriodInSeconds)).isAfter(start); - - assertThat(clientWrapper.capturedRequest).asList().hasSize(1); - clientWrapper.capturedRequest.clear(); - - Single addressesObs = spyCache.tryGetAddresses(req, - partitionKeyRangeIdentity, - false); - - - AddressInformation[] actualAddresses = getSuccessResult(addressesObs, TIMEOUT); - // the cache address is used. no new http request is sent - assertThat(clientWrapper.capturedRequest).asList().hasSize(1); - assertThat(getMasterAddressesViaGatewayAsyncInvocation.get()).isEqualTo(2); - assertThat(actualAddresses).hasSize(ServiceConfig.SystemReplicationPolicy.MaxReplicaSetSize); - - List
fetchedAddresses = origCache.getMasterAddressesViaGatewayAsync(req, ResourceType.Database, - null, "/dbs/", false, false, null).toBlocking().value(); - - assertSameAs(ImmutableList.copyOf(actualAddresses), fetchedAddresses); - } - - public static void assertSameAs(List actual, List
expected) { - assertThat(actual).asList().hasSize(expected.size()); - for(int i = 0; i < expected.size(); i++) { - assertEqual(actual.get(i), expected.get(i)); - } - } - - private static void assertEqual(AddressInformation actual, Address expected) { - assertThat(actual.getPhysicalUri()).isEqualTo(expected.getPhyicalUri()); - assertThat(actual.getProtocolScheme()).isEqualTo(expected.getProtocolScheme().toLowerCase()); - assertThat(actual.isPrimary()).isEqualTo(expected.IsPrimary()); - } - - private static void assertEqual(AddressInformation actual, AddressInformation expected) { - assertThat(actual.getPhysicalUri()).isEqualTo(expected.getPhysicalUri()); - assertThat(actual.getProtocolName()).isEqualTo(expected.getProtocolName()); - assertThat(actual.isPrimary()).isEqualTo(expected.isPrimary()); - assertThat(actual.isPublic()).isEqualTo(expected.isPublic()); - } - - public static void assertExactlyEqual(AddressInformation[] actual, AddressInformation[] expected) { - assertExactlyEqual(Arrays.asList(actual), Arrays.asList(expected)); - } - - public static void assertExactlyEqual(List actual, List expected) { - assertThat(actual).asList().hasSize(expected.size()); - for(int i = 0; i < expected.size(); i++) { - assertEqual(actual.get(i), expected.get(i)); - } - } - - public static T getSuccessResult(Single observable, long timeout) { - TestSubscriber testSubscriber = new TestSubscriber<>(); - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - return testSubscriber.getOnNextEvents().get(0); - } - - public static void validateSuccess(Single> observable, - PartitionReplicasAddressesValidator validator, long timeout) { - TestSubscriber> testSubscriber = new TestSubscriber<>(); - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - @BeforeClass(groups = { "direct" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - - RequestOptions options = new RequestOptions(); - options.setOfferThroughput(30000); - createdCollection = createCollection(client, createdDatabase.getId(), getCollectionDefinition(), options); - } - - @AfterClass(groups = { "direct" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteCollection(client, createdCollection); - safeClose(client); - } - - static protected DocumentCollection getCollectionDefinition() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList<>(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId("mycol"); - collectionDefinition.setPartitionKey(partitionKeyDef); - - return collectionDefinition; - } - - private CompositeHttpClient getCompositeHttpClient(Configs configs) { - CompositeHttpClient httpClient = new HttpClientFactory(configs) - .toHttpClientBuilder().build(); - return httpClient; - } - - private HttpClientUnderTestWrapper getHttpClientUnderTestWrapper(Configs configs) { - CompositeHttpClient origHttpClient = getCompositeHttpClient(configs); - return new HttpClientUnderTestWrapper(origHttpClient); - } - - public String getNameBasedCollectionLink() { - return "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId(); - } - - public String getCollectionSelfLink() { - return createdCollection.getSelfLink(); - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayServiceConfigurationReaderTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayServiceConfigurationReaderTest.java deleted file mode 100644 index 691139545995..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/GatewayServiceConfigurationReaderTest.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.net.URI; -import java.util.concurrent.TimeUnit; - -import org.apache.commons.io.IOUtils; -import org.mockito.Matchers; -import org.mockito.Mockito; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.DatabaseAccount; -import com.microsoft.azure.cosmosdb.internal.BaseAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; -import com.microsoft.azure.cosmosdb.rx.TestConfigurations; -import com.microsoft.azure.cosmosdb.rx.TestSuiteBase; -import com.microsoft.azure.cosmosdb.rx.internal.SpyClientUnderTestFactory; -import com.microsoft.azure.cosmosdb.rx.internal.SpyClientUnderTestFactory.ClientUnderTest; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; -import io.netty.buffer.ByteBufUtil; -import io.netty.handler.codec.http.DefaultHttpHeaders; -import io.netty.handler.codec.http.DefaultHttpResponse; -import io.netty.handler.codec.http.HttpHeaders; -import io.netty.handler.codec.http.HttpResponse; -import io.netty.handler.codec.http.HttpResponseStatus; -import io.netty.handler.codec.http.HttpVersion; -import io.reactivex.netty.client.RxClient; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; -import rx.Observable; -import rx.Single; -import rx.observers.TestSubscriber; - -public class GatewayServiceConfigurationReaderTest extends TestSuiteBase { - - private static final int TIMEOUT = 8000; - private CompositeHttpClient mockHttpClient; - private CompositeHttpClient httpClient; - private BaseAuthorizationTokenProvider baseAuthorizationTokenProvider; - private ConnectionPolicy connectionPolicy; - private GatewayServiceConfigurationReader mockGatewayServiceConfigurationReader; - private GatewayServiceConfigurationReader gatewayServiceConfigurationReader; - private AsyncDocumentClient client; - private String databaseAccountJson; - private DatabaseAccount expectedDatabaseAccount; - - @Factory(dataProvider = "clientBuilders") - public GatewayServiceConfigurationReaderTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @BeforeClass(groups = "simple") - public void setup() throws Exception { - client = clientBuilder.build(); - mockHttpClient = (CompositeHttpClient) Mockito.mock(CompositeHttpClient.class); - - ClientUnderTest clientUnderTest = SpyClientUnderTestFactory.createClientUnderTest(this.clientBuilder); - httpClient = clientUnderTest.getSpyHttpClient(); - baseAuthorizationTokenProvider = new BaseAuthorizationTokenProvider(TestConfigurations.MASTER_KEY); - connectionPolicy = ConnectionPolicy.GetDefault(); - mockGatewayServiceConfigurationReader = new GatewayServiceConfigurationReader(new URI(TestConfigurations.HOST), - false, TestConfigurations.MASTER_KEY, connectionPolicy, baseAuthorizationTokenProvider, mockHttpClient); - - gatewayServiceConfigurationReader = new GatewayServiceConfigurationReader(new URI(TestConfigurations.HOST), - false, - TestConfigurations.MASTER_KEY, - connectionPolicy, - baseAuthorizationTokenProvider, - httpClient); - databaseAccountJson = IOUtils - .toString(getClass().getClassLoader().getResourceAsStream("databaseAccount.json"), "UTF-8"); - expectedDatabaseAccount = new DatabaseAccount(databaseAccountJson); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - @Test(groups = "simple") - public void mockInitializeReaderAsync() throws Exception { - - HttpClientResponse mockedResponse = getMockResponse(databaseAccountJson); - - Mockito.when(mockHttpClient.submit(Matchers.any(RxClient.ServerInfo.class), Matchers.any())) - .thenReturn(Observable.just(mockedResponse)); - - Single databaseAccount = mockGatewayServiceConfigurationReader.initializeReaderAsync(); - validateSuccess(databaseAccount, expectedDatabaseAccount); - } - - @Test(groups = "simple") - public void mockInitializeReaderAsyncWithResourceToken() throws Exception { - mockGatewayServiceConfigurationReader = new GatewayServiceConfigurationReader(new URI(TestConfigurations.HOST), - true, "SampleResourceToken", connectionPolicy, baseAuthorizationTokenProvider, mockHttpClient); - - HttpClientResponse mockedResponse = getMockResponse(databaseAccountJson); - - Mockito.when(mockHttpClient.submit(Matchers.any(RxClient.ServerInfo.class), Matchers.any())) - .thenReturn(Observable.just(mockedResponse)); - - Single databaseAccount = mockGatewayServiceConfigurationReader.initializeReaderAsync(); - validateSuccess(databaseAccount, expectedDatabaseAccount); - } - - @Test(groups = "simple") - public void initializeReaderAsync() { - Single databaseAccount = gatewayServiceConfigurationReader.initializeReaderAsync(); - validateSuccess(databaseAccount); - } - - public static void validateSuccess(Single observable) { - TestSubscriber testSubscriber = new TestSubscriber(); - - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(TIMEOUT, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - assertThat(BridgeInternal.getQueryEngineConfiuration(testSubscriber.getOnNextEvents().get(0)).size() > 0).isTrue(); - assertThat(BridgeInternal.getReplicationPolicy(testSubscriber.getOnNextEvents().get(0))).isNotNull(); - assertThat(BridgeInternal.getSystemReplicationPolicy(testSubscriber.getOnNextEvents().get(0))).isNotNull(); - } - - public static void validateSuccess(Single observable, DatabaseAccount expectedDatabaseAccount) - throws InterruptedException { - TestSubscriber testSubscriber = new TestSubscriber(); - - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(TIMEOUT, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - assertThat(testSubscriber.getOnNextEvents().get(0).getId()).isEqualTo(expectedDatabaseAccount.getId()); - assertThat(testSubscriber.getOnNextEvents().get(0).getAddressesLink()) - .isEqualTo(expectedDatabaseAccount.getAddressesLink()); - assertThat(testSubscriber.getOnNextEvents().get(0).getWritableLocations().iterator().next().getEndpoint()) - .isEqualTo(expectedDatabaseAccount.getWritableLocations().iterator().next().getEndpoint()); - assertThat(BridgeInternal.getSystemReplicationPolicy(testSubscriber.getOnNextEvents().get(0)).getMaxReplicaSetSize()) - .isEqualTo(BridgeInternal.getSystemReplicationPolicy(expectedDatabaseAccount).getMaxReplicaSetSize()); - assertThat(BridgeInternal.getSystemReplicationPolicy(testSubscriber.getOnNextEvents().get(0)).getMaxReplicaSetSize()) - .isEqualTo(BridgeInternal.getSystemReplicationPolicy(expectedDatabaseAccount).getMaxReplicaSetSize()); - assertThat(BridgeInternal.getQueryEngineConfiuration(testSubscriber.getOnNextEvents().get(0))) - .isEqualTo(BridgeInternal.getQueryEngineConfiuration(expectedDatabaseAccount)); - } - - private HttpClientResponse getMockResponse(String databaseAccountJson) { - HttpClientResponse resp = Mockito.mock(HttpClientResponse.class); - Mockito.doReturn(HttpResponseStatus.valueOf(200)).when(resp).getStatus(); - Mockito.doReturn(Observable.just(ByteBufUtil.writeUtf8(ByteBufAllocator.DEFAULT, databaseAccountJson))) - .when(resp).getContent(); - - HttpHeaders httpHeaders = new DefaultHttpHeaders(); - DefaultHttpResponse httpResponse = new DefaultHttpResponse(HttpVersion.HTTP_1_1, - HttpResponseStatus.valueOf(200), httpHeaders); - - try { - Constructor constructor = HttpResponseHeaders.class - .getDeclaredConstructor(HttpResponse.class); - constructor.setAccessible(true); - HttpResponseHeaders httpResponseHeaders = constructor.newInstance(httpResponse); - Mockito.doReturn(httpResponseHeaders).when(resp).getHeaders(); - - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException - | NoSuchMethodException | SecurityException e) { - throw new IllegalStateException("Failed to instantiate class object.", e); - } - return resp; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PartitionReplicasAddressesValidator.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PartitionReplicasAddressesValidator.java deleted file mode 100644 index fbd37eb5da7d..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/internal/directconnectivity/PartitionReplicasAddressesValidator.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.internal.directconnectivity; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * This is a helper class for validating partition replicas' addresses for tests. - */ -public interface PartitionReplicasAddressesValidator { - - int MAX_REPLICA_SIZE = 4; - - void validate(Collection
addresses); - - class Builder { - private List validators = new ArrayList<>(); - - public PartitionReplicasAddressesValidator build() { - return new PartitionReplicasAddressesValidator() { - - public void validate(Collection
addresses) { - for (PartitionReplicasAddressesValidator validator : validators) { - validator.validate(addresses); - } - } - }; - } - - public Builder size(final int expectedCount) { - - validators.add(new PartitionReplicasAddressesValidator() { - @Override - public void validate(Collection
addresses) { - assertThat(addresses).hasSize(expectedCount); - } - }); - return this; - } - - public Builder forEach(AddressValidator validator) { - - validators.add(new PartitionReplicasAddressesValidator() { - @Override - public void validate(Collection
addresses) { - - for (Address address : addresses) { - validator.validate(address); - } - - } - }); - return this; - } - - public Builder httpsProtocol() { - this.forEach(new AddressValidator.Builder().httpsProtocol().build()); - return this; - } - - public Builder withProtocol(Protocol protocol) { - this.forEach(new AddressValidator.Builder().protocol(protocol).build()); - return this; - } - - public Builder replicasOfPartition(String partitionKeyRangeId) { - validators.add(new PartitionReplicasAddressesValidator() { - @Override - public void validate(Collection
addresses) { - - // if running against prod due to upgrade etc, we may have occasionally 3 or 4 replicas. - assertThat(addresses).size().isGreaterThanOrEqualTo(MAX_REPLICA_SIZE - 1).isLessThanOrEqualTo(MAX_REPLICA_SIZE); - assertThat(addresses.stream().filter(a -> a.IsPrimary()).count()).isEqualTo(1); - - Address a = addresses.iterator().next(); - - AddressValidator validator = new AddressValidator.Builder() - .withPartitionKeyRangeId(partitionKeyRangeId) - .withRid(a.getResourceId()) - .build(); - - for (Address address : addresses) { - validator.validate(address); - } - } - }); - return this; - } - - public Builder replicasOfSamePartition() { - validators.add(new PartitionReplicasAddressesValidator() { - @Override - public void validate(Collection
addresses) { - - // if running against prod due to upgrade etc, we may have occasionally 3 or 4 replicas. - assertThat(addresses).size().isGreaterThanOrEqualTo(MAX_REPLICA_SIZE - 1).isLessThanOrEqualTo(MAX_REPLICA_SIZE); - assertThat(addresses.stream().filter(a -> a.IsPrimary()).count()).isEqualTo(1); - - Address a = addresses.iterator().next(); - - AddressValidator validator = new AddressValidator.Builder() - .withPartitionKeyRangeId(a.getParitionKeyRangeId()) - .withRid(a.getResourceId()) - .build(); - - for (Address address : addresses) { - validator.validate(address); - } - } - }); - return this; - } - - public Builder replicasOfPartitions(Collection partitionKeyRangeIds) { - validators.add(new PartitionReplicasAddressesValidator() { - @Override - public void validate(Collection
addresses) { - - for (String pki : partitionKeyRangeIds) { - List
partitionReplicas = addresses.stream() - .filter(a -> pki.equals(a.getParitionKeyRangeId())) - .collect(Collectors.toList()); - - PartitionReplicasAddressesValidator v = new Builder().replicasOfPartition(pki).build(); - v.validate(partitionReplicas); - } - } - }); - return this; - } - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/AggregateQueryTests.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/AggregateQueryTests.java deleted file mode 100644 index 3a0fb11fb207..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/AggregateQueryTests.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.ArrayList; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - -public class AggregateQueryTests extends TestSuiteBase { - - public static class QueryConfig { - String testName; - String query; - Object expected; - - public QueryConfig (String testName, String query, Object expected) { - this.testName = testName; - this.query = query; - this.expected = expected; - } - } - - public static class AggregateConfig { - String operator; - Object expected; - String condition; - - public AggregateConfig(String operator, Object expected, String condition) { - this.operator = operator; - this.expected = expected; - this.condition = condition; - } - } - - private Database createdDatabase; - private DocumentCollection createdCollection; - private ArrayList docs = new ArrayList(); - private ArrayList queryConfigs = new ArrayList(); - - private String partitionKey = "mypk"; - private String uniquePartitionKey = "uniquePartitionKey"; - private String field = "field"; - private int sum; - private int numberOfDocuments = 800; - private int numberOfDocumentsWithNumericId; - private int numberOfDocsWithSamePartitionKey = 400; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public AggregateQueryTests(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - - // TODO: DANOBLE: Investigate Direct TCP performance issue - // Links: https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028 - // Notes: - // I've seen this test time out in my development environment. I test against a debug instance of the public - // emulator and so what I'm seeing could be the result of a public emulator performance issue. Of course, it - // might also be the result of a Tcp protocol performance problem. - - @Test(groups = { "simple" }, timeOut = 2 * TIMEOUT, dataProvider = "queryMetricsArgProvider") - public void queryDocumentsWithAggregates(boolean qmEnabled) throws Exception { - - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - options.setPopulateQueryMetrics(qmEnabled); - options.setMaxDegreeOfParallelism(2); - - for (QueryConfig queryConfig : queryConfigs) { - - Observable> queryObservable = client - .queryDocuments(createdCollection.getSelfLink(), queryConfig.query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .withAggregateValue(queryConfig.expected) - .numberOfPages(1) - .hasValidQueryMetrics(qmEnabled) - .build(); - - try { - validateQuerySuccess(queryObservable, validator); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - } - - public void bulkInsert(AsyncDocumentClient client) { - generateTestData(); - - ArrayList>> result = new ArrayList>>(); - for (int i = 0; i < docs.size(); i++) { - result.add(client.createDocument("dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId(), docs.get(i), null, false)); - } - - Observable.merge(result, 100).toList().toBlocking().single(); - } - - public void generateTestData() { - - Object[] values = new Object[]{null, false, true, "abc", "cdfg", "opqrs", "ttttttt", "xyz", "oo", "ppp"}; - for (int i = 0; i < values.length; i++) { - Document d = new Document(); - d.set(partitionKey, values[i]); - docs.add(d); - } - - for (int i = 0; i < numberOfDocsWithSamePartitionKey; i++) { - Document d = new Document(); - d.set(partitionKey, uniquePartitionKey); - d.set("resourceId", Integer.toString(i)); - d.set(field, i + 1); - docs.add(d); - } - - numberOfDocumentsWithNumericId = numberOfDocuments - values.length - numberOfDocsWithSamePartitionKey; - for (int i = 0; i < numberOfDocumentsWithNumericId; i++) { - Document d = new Document(); - d.set(partitionKey, i + 1); - docs.add(d); - } - - sum = (int) (numberOfDocumentsWithNumericId * (numberOfDocumentsWithNumericId + 1) / 2.0); - - } - - public void generateTestConfigs() { - - String aggregateQueryFormat = "SELECT VALUE %s(r.%s) FROM r WHERE %s"; - AggregateConfig[] aggregateConfigs = new AggregateConfig[] { - new AggregateConfig("AVG", sum / numberOfDocumentsWithNumericId, String.format("IS_NUMBER(r.%s)", partitionKey)), - new AggregateConfig("AVG", null, "true"), - new AggregateConfig("COUNT", numberOfDocuments, "true"), - new AggregateConfig("MAX","xyz","true"), - new AggregateConfig("MIN", null, "true"), - new AggregateConfig("SUM", sum, String.format("IS_NUMBER(r.%s)", partitionKey)), - new AggregateConfig("SUM", null, "true") - }; - - for (AggregateConfig config: aggregateConfigs) { - String query = String.format(aggregateQueryFormat, config.operator, partitionKey, config.condition); - String testName = String.format("%s %s", config.operator, config.condition); - queryConfigs.add(new QueryConfig(testName, query, config.expected)); - } - - String aggregateSinglePartitionQueryFormat = "SELECT VALUE %s(r.%s) FROM r WHERE r.%s = '%s'"; - String aggregateSinglePartitionQueryFormatSelect = "SELECT %s(r.%s) FROM r WHERE r.%s = '%s'"; - double samePartitionSum = numberOfDocsWithSamePartitionKey * (numberOfDocsWithSamePartitionKey + 1) / 2.0; - - AggregateConfig[] aggregateSinglePartitionConfigs = new AggregateConfig[] { - new AggregateConfig("AVG", samePartitionSum / numberOfDocsWithSamePartitionKey, null), - new AggregateConfig("COUNT", numberOfDocsWithSamePartitionKey, null), - new AggregateConfig("MAX", numberOfDocsWithSamePartitionKey, null), - new AggregateConfig("MIN", 1, null), - new AggregateConfig("SUM", samePartitionSum, null) - }; - - for (AggregateConfig config: aggregateSinglePartitionConfigs) { - String query = String.format(aggregateSinglePartitionQueryFormat, config.operator, field, partitionKey, uniquePartitionKey); - String testName = String.format("%s SinglePartition %s", config.operator, "SELECT VALUE"); - queryConfigs.add(new QueryConfig(testName, query, config.expected)); - - query = String.format(aggregateSinglePartitionQueryFormatSelect, config.operator, field, partitionKey, uniquePartitionKey); - testName = String.format("%s SinglePartition %s", config.operator, "SELECT"); - queryConfigs.add(new QueryConfig(testName, query, new Document("{'$1':" + removeTrailingZerosIfInteger(config.expected) + "}"))); - } - } - - private Object removeTrailingZerosIfInteger(Object obj) { - if (obj instanceof Number) { - Number num = (Number) obj; - if (num.doubleValue() == num.intValue()) { - return num.intValue(); - } - } - return obj; - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - truncateCollection(SHARED_MULTI_PARTITION_COLLECTION); - - bulkInsert(client); - generateTestConfigs(); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/AttachmentCrudTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/AttachmentCrudTest.java deleted file mode 100644 index a229e251a2a5..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/AttachmentCrudTest.java +++ /dev/null @@ -1,235 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Attachment; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; - -import rx.Observable; - -import javax.net.ssl.SSLException; - -public class AttachmentCrudTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - private Document createdDocument; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirectHttps") // Direct TCP mode does not support attachments - public AttachmentCrudTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createAttachment() throws Exception { - // create an Attachment - String uuid = UUID.randomUUID().toString(); - Attachment attachment = getAttachmentDefinition(uuid, "application/text"); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(createdDocument.getId())); - Observable> createObservable = client.createAttachment(getDocumentLink(), attachment, options); - - // validate attachment creation - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(attachment.getId()) - .withContentType("application/text") - .notNullEtag() - .build(); - validateSuccess(createObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void readAttachment() throws Exception { - // create an Attachment - String uuid = UUID.randomUUID().toString(); - Attachment attachment = getAttachmentDefinition(uuid, "application/text"); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(createdDocument.getId())); - Attachment readBackAttachment = client.createAttachment(getDocumentLink(), attachment, options).toBlocking().single().getResource(); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - - // read attachment - Observable> readObservable = client.readAttachment(readBackAttachment.getSelfLink(), options); - - // validate attachment read - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(attachment.getId()) - .withContentType("application/text") - .notNullEtag() - .build(); - validateSuccess(readObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void deleteAttachment() throws Exception { - // create an Attachment - String uuid = UUID.randomUUID().toString(); - Attachment attachment = getAttachmentDefinition(uuid, "application/text"); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(createdDocument.getId())); - Attachment readBackAttachment = client.createAttachment(getDocumentLink(), attachment, options).toBlocking().single().getResource(); - - // delete attachment - Observable> deleteObservable = client.deleteAttachment(readBackAttachment.getSelfLink(), options); - - // validate attachment delete - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .nullResource() - .build(); - validateSuccess(deleteObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void upsertAttachment() throws Exception { - // create an Attachment - String uuid = UUID.randomUUID().toString(); - Attachment attachment = getAttachmentDefinition(uuid, "application/text"); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(createdDocument.getId())); - Attachment readBackAttachment = client.upsertAttachment(getDocumentLink(), attachment, options).toBlocking().single().getResource(); - - // read attachment - waitIfNeededForReplicasToCatchUp(clientBuilder); - Observable> readObservable = client.readAttachment(readBackAttachment.getSelfLink(), options); - - // validate attachment read - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(attachment.getId()) - .withContentType("application/text") - .notNullEtag() - .build(); - validateSuccess(readObservable, validator); - - //update attachment - readBackAttachment.setContentType("application/json"); - - Observable> updateObservable = client.upsertAttachment(getDocumentLink(), readBackAttachment, options); - - // validate attachment update - ResourceResponseValidator validatorForUpdate = new ResourceResponseValidator.Builder() - .withId(readBackAttachment.getId()) - .withContentType("application/json") - .notNullEtag() - .build(); - validateSuccess(updateObservable, validatorForUpdate); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void replaceAttachment() throws Exception { - // create an Attachment - String uuid = UUID.randomUUID().toString(); - Attachment attachment = getAttachmentDefinition(uuid, "application/text"); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(createdDocument.getId())); - Attachment readBackAttachment = client.createAttachment(getDocumentLink(), attachment, options).toBlocking().single().getResource(); - - - // read attachment - waitIfNeededForReplicasToCatchUp(clientBuilder); - Observable> readObservable = client.readAttachment(readBackAttachment.getSelfLink(), options); - - // validate attachment read - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(attachment.getId()) - .withContentType("application/text") - .notNullEtag() - .build(); - validateSuccess(readObservable, validator); - - //update attachment - readBackAttachment.setContentType("application/json"); - - Observable> updateObservable = client.replaceAttachment(readBackAttachment, options); - - // validate attachment update - ResourceResponseValidator validatorForUpdate = new ResourceResponseValidator.Builder() - .withId(readBackAttachment.getId()) - .withContentType("application/json") - .notNullEtag() - .build(); - validateSuccess(updateObservable, validatorForUpdate); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - createdDocument = createDocument(client, createdDatabase.getId(), createdCollection.getId(), getDocumentDefinition()); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private String getDocumentLink() { - return createdDocument.getSelfLink(); - } - - private static Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } - - private static Attachment getAttachmentDefinition(String uuid, String type) { - return new Attachment(String.format( - "{" + - " 'id': '%s'," + - " 'media': 'http://xstore.'," + - " 'MediaType': 'Book'," + - " 'Author': 'My Book Author'," + - " 'Title': 'My Book Title'," + - " 'contentType': '%s'" + - "}", uuid, type)); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/AttachmentQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/AttachmentQueryTest.java deleted file mode 100644 index 1a353241e4b9..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/AttachmentQueryTest.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Attachment; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - -public class AttachmentQueryTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdAttachments = new ArrayList<>(); - - private Document createdDocument; - - private AsyncDocumentClient client; - - public String getCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId()); - } - - public String getDocumentLink() { - return createdDocument.getSelfLink(); - } - - @Factory(dataProvider = "clientBuilders") - public AttachmentQueryTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryWithFilter() throws Exception { - - String filterId = createdAttachments.get(0).getId(); - String query = String.format("SELECT * from c where c.id = '%s'", filterId); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - Observable> queryObservable = client - .queryAttachments(getDocumentLink(), query, options); - - List expectedDocs = createdAttachments.stream().filter(sp -> filterId.equals(sp.getId()) ).collect(Collectors.toList()); - assertThat(expectedDocs).isNotEmpty(); - - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedDocs.size()) - .exactlyContainsInAnyOrder(expectedDocs.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(queryObservable, validator, 10000); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void query_NoResults() throws Exception { - - String query = "SELECT * from root r where r.id = '2'"; - FeedOptions options = new FeedOptions(); - Observable> queryObservable = client - .queryAttachments(getDocumentLink(), query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(new ArrayList<>()) - .numberOfPages(1) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryAll() throws Exception { - - String query = "SELECT * from root"; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryAttachments(getDocumentLink(), query, options); - - List expectedDocs = createdAttachments; - - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator - .Builder() - .exactlyContainsInAnyOrder(expectedDocs - .stream() - .map(d -> d.getResourceId()) - .collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void invalidQuerySytax() throws Exception { - String query = "I am an invalid query"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - FailureValidator validator = new FailureValidator.Builder() - .instanceOf(DocumentClientException.class) - .statusCode(400) - .notNullActivityId() - .build(); - validateQueryFailure(queryObservable, validator); - } - - public Attachment createAttachment(AsyncDocumentClient client) { - Attachment attachment = getAttachmentDefinition(); - return client.createAttachment(getDocumentLink(), attachment, null).toBlocking().single().getResource(); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY); - - Document docDef = new Document(); - docDef.setId(UUID.randomUUID().toString()); - - createdDocument = createDocument(client, createdDatabase.getId(), createdCollection.getId(), docDef); - - for(int i = 0; i < 5; i++) { - createdAttachments.add(createAttachment(client)); - } - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - private static Attachment getAttachmentDefinition() { - return new Attachment(String.format( - "{" + - " 'id': '%s'," + - " 'media': 'http://xstore.'," + - " 'MediaType': 'Book'," + - " 'Author': 'My Book Author'," + - " 'Title': 'My Book Title'," + - " 'contentType': '%s'" + - "}", UUID.randomUUID().toString(), "application/text")); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/BackPressureCrossPartitionTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/BackPressureCrossPartitionTest.java deleted file mode 100644 index 2a40e985d409..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/BackPressureCrossPartitionTest.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.DataType; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.IncludedPath; -import com.microsoft.azure.cosmosdb.Index; -import com.microsoft.azure.cosmosdb.IndexingPolicy; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentClientUnderTest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Observable; -import rx.internal.util.RxRingBuffer; -import rx.observers.TestSubscriber; -import rx.schedulers.Schedulers; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.TimeUnit; - -import static org.assertj.core.api.Assertions.assertThat; - -public class BackPressureCrossPartitionTest extends TestSuiteBase { - private final Logger log = LoggerFactory.getLogger(BackPressureCrossPartitionTest.class); - - private static final int TIMEOUT = 1800000; - private static final int SETUP_TIMEOUT = 60000; - - private int numberOfDocs = 4000; - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdDocuments; - - private RxDocumentClientUnderTest client; - private int numberOfPartitions; - - public String getCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId()); - } - - static protected DocumentCollection getCollectionDefinition() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList<>(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - - IndexingPolicy indexingPolicy = new IndexingPolicy(); - Collection includedPaths = new ArrayList<>(); - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath("/*"); - Collection indexes = new ArrayList<>(); - Index stringIndex = Index.Range(DataType.String); - stringIndex.set("precision", -1); - indexes.add(stringIndex); - - Index numberIndex = Index.Range(DataType.Number); - numberIndex.set("precision", -1); - indexes.add(numberIndex); - includedPath.setIndexes(indexes); - includedPaths.add(includedPath); - indexingPolicy.setIncludedPaths(includedPaths); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - collectionDefinition.setPartitionKey(partitionKeyDef); - collectionDefinition.setIndexingPolicy(indexingPolicy); - - return collectionDefinition; - } - - @Factory(dataProvider = "simpleClientBuildersWithDirectHttps") - public BackPressureCrossPartitionTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - private void warmUp() { - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - // ensure collection is cached - client.queryDocuments(getCollectionLink(), "SELECT * FROM r", options).first().toBlocking().single(); - } - - @DataProvider(name = "queryProvider") - public Object[][] queryProvider() { - return new Object[][] { - // query, maxItemCount, max expected back pressure buffered, total number of expected query results - { "SELECT * FROM r", 1, 2 * RxRingBuffer.SIZE, numberOfDocs}, - { "SELECT * FROM r", 100, 2 * RxRingBuffer.SIZE, numberOfDocs}, - { "SELECT * FROM r ORDER BY r.prop", 100, 2 * RxRingBuffer.SIZE + 3 * numberOfPartitions, numberOfDocs}, - { "SELECT TOP 1000 * FROM r", 1, 2 * RxRingBuffer.SIZE, 1000}, - { "SELECT TOP 1000 * FROM r", 100, 2 * RxRingBuffer.SIZE, 1000}, - { "SELECT TOP 1000 * FROM r ORDER BY r.prop", 100, 2 * RxRingBuffer.SIZE + 3 * numberOfPartitions , 1000}, - }; - } - - // TODO: DANOBLE: Investigate Direct TCP performance issue - // Links: https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028 - - @Test(groups = { "long" }, dataProvider = "queryProvider", timeOut = 2 * TIMEOUT) - public void query(String query, int maxItemCount, int maxExpectedBufferedCountForBackPressure, int expectedNumberOfResults) throws Exception { - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - options.setMaxItemCount(maxItemCount); - options.setMaxDegreeOfParallelism(2); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - client.httpRequests.clear(); - - log.info("instantiating subscriber ..."); - TestSubscriber> subscriber = new TestSubscriber<>(1); - queryObservable.observeOn(Schedulers.io(), 1).subscribe(subscriber); - int sleepTimeInMillis = 40000; - int i = 0; - - // use a test subscriber and request for more result and sleep in between - try { - while(subscriber.getCompletions() == 0 && subscriber.getOnErrorEvents().isEmpty()) { - log.debug("loop " + i); - - TimeUnit.MILLISECONDS.sleep(sleepTimeInMillis); - sleepTimeInMillis /= 2; - - if (sleepTimeInMillis > 4000) { - // validate that only one item is returned to subscriber in each iteration - assertThat(subscriber.getValueCount() - i).isEqualTo(1); - } - - log.debug("subscriber.getValueCount(): " + subscriber.getValueCount()); - log.debug("client.httpRequests.size(): " + client.httpRequests.size()); - // validate that the difference between the number of requests to backend - // and the number of returned results is always less than a fixed threshold - - assertThat(client.httpRequests.size() - subscriber.getValueCount()) - .isLessThanOrEqualTo(maxExpectedBufferedCountForBackPressure); - - log.debug("requesting more"); - subscriber.requestMore(1); - i++; - } - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - - try { - subscriber.assertNoErrors(); - subscriber.assertCompleted(); - assertThat(subscriber.getOnNextEvents().stream().mapToInt(p -> p.getResults().size()).sum()).isEqualTo(expectedNumberOfResults); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - @BeforeClass(groups = { "long" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - RequestOptions options = new RequestOptions(); - options.setOfferThroughput(20000); - createdDatabase = SHARED_DATABASE; - createdCollection = createCollection(createdDatabase.getId(), getCollectionDefinition(), options); - - client = new ClientUnderTestBuilder(clientBuilder).build(); - - ArrayList docDefList = new ArrayList<>(); - for(int i = 0; i < numberOfDocs; i++) { - docDefList.add(getDocumentDefinition(i)); - } - - Observable> documentBulkInsertObs = bulkInsert( - client, - getCollectionLink(), - docDefList, - 1000); - - createdDocuments = documentBulkInsertObs.map(ResourceResponse::getResource).toList().toBlocking().single(); - - numberOfPartitions = client.readPartitionKeyRanges(getCollectionLink(), null) - .flatMap(p -> Observable.from(p.getResults())).toList().toBlocking().single().size(); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - warmUp(); - } - - // TODO: DANOBLE: Investigate Direct TCP performance issue - // Links: https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028 - - @AfterClass(groups = { "long" }, timeOut = 2 * SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteCollection(client, createdCollection); - safeClose(client); - } - - private static Document getDocumentDefinition(int cnt) { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"prop\" : %d, " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, cnt, uuid)); - return doc; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/BackPressureTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/BackPressureTest.java deleted file mode 100644 index c22fc3a4da06..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/BackPressureTest.java +++ /dev/null @@ -1,220 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Offer; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentClientUnderTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Observable; -import rx.internal.util.RxRingBuffer; -import rx.observers.TestSubscriber; -import rx.schedulers.Schedulers; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.TimeUnit; - -import static org.assertj.core.api.Assertions.assertThat; - -public class BackPressureTest extends TestSuiteBase { - - private static final int TIMEOUT = 200000; - private static final int SETUP_TIMEOUT = 60000; - - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdDocuments; - - private RxDocumentClientUnderTest client; - - public String getCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId()); - } - - private static DocumentCollection getSinglePartitionCollectionDefinition() { - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - return collectionDefinition; - } - - @Factory(dataProvider = "simpleClientBuildersWithDirectHttps") - public BackPressureTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "long" }, timeOut = TIMEOUT) - public void readFeed() throws Exception { - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(1); - Observable> queryObservable = client - .readDocuments(getCollectionLink(), options); - - client.httpRequests.clear(); - - TestSubscriber subscriber = new TestSubscriber(1); - queryObservable.observeOn(Schedulers.io(), 1).subscribe(subscriber); - int sleepTimeInMillis = 10000; // 10 seconds - - int i = 0; - // use a test subscriber and request for more result and sleep in between - while (subscriber.getCompletions() == 0 && subscriber.getOnErrorEvents().isEmpty()) { - TimeUnit.MILLISECONDS.sleep(sleepTimeInMillis); - sleepTimeInMillis /= 2; - - if (sleepTimeInMillis > 1000) { - // validate that only one item is returned to subscriber in each iteration - assertThat(subscriber.getValueCount() - i).isEqualTo(1); - } - // validate that only one item is returned to subscriber in each iteration - // validate that the difference between the number of requests to backend - // and the number of returned results is always less than a fixed threshold - assertThat(client.httpRequests.size() - subscriber.getOnNextEvents().size()) - .isLessThanOrEqualTo(RxRingBuffer.SIZE); - - subscriber.requestMore(1); - i++; - } - - subscriber.assertNoErrors(); - subscriber.assertCompleted(); - assertThat(subscriber.getOnNextEvents()).hasSize(createdDocuments.size()); - } - - @Test(groups = { "long" }, timeOut = TIMEOUT) - public void query() throws Exception { - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(1); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), "SELECT * from r", options); - - client.httpRequests.clear(); - - TestSubscriber subscriber = new TestSubscriber(1); - queryObservable.observeOn(Schedulers.io(), 1).subscribe(subscriber); - int sleepTimeInMillis = 10000; - - int i = 0; - // use a test subscriber and request for more result and sleep in between - while(subscriber.getCompletions() == 0 && subscriber.getOnErrorEvents().isEmpty()) { - TimeUnit.MILLISECONDS.sleep(sleepTimeInMillis); - sleepTimeInMillis /= 2; - - if (sleepTimeInMillis > 1000) { - // validate that only one item is returned to subscriber in each iteration - assertThat(subscriber.getValueCount() - i).isEqualTo(1); - } - // validate that the difference between the number of requests to backend - // and the number of returned results is always less than a fixed threshold - assertThat(client.httpRequests.size() - subscriber.getValueCount()) - .isLessThanOrEqualTo(RxRingBuffer.SIZE); - - subscriber.requestMore(1); - i++; - } - - subscriber.assertNoErrors(); - subscriber.assertCompleted(); - - assertThat(subscriber.getOnNextEvents()).hasSize(createdDocuments.size()); - } - - // TODO: DANOBLE: Investigate Direct TCP performance issue - // NOTE: This method requires multiple SHUTDOWN_TIMEOUT intervals - // SEE: https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028 - - @BeforeClass(groups = { "long" }, timeOut = 2 * SETUP_TIMEOUT) - public void beforeClass() throws Exception { - - RequestOptions options = new RequestOptions(); - options.setOfferThroughput(1000); - createdDatabase = SHARED_DATABASE; - createdCollection = createCollection(createdDatabase.getId(), getSinglePartitionCollectionDefinition(), options); - - client = new ClientUnderTestBuilder(clientBuilder).build(); - - // increase throughput to max for a single partition collection to avoid throttling - // for bulk insert and later queries. - Offer offer = client.queryOffers( - String.format("SELECT * FROM r WHERE r.offerResourceId = '%s'", - createdCollection.getResourceId()) - , null).first().map(FeedResponse::getResults).toBlocking().single().get(0); - offer.setThroughput(6000); - offer = client.replaceOffer(offer).toBlocking().single().getResource(); - assertThat(offer.getThroughput()).isEqualTo(6000); - - ArrayList docDefList = new ArrayList<>(); - for(int i = 0; i < 1000; i++) { - docDefList.add(getDocumentDefinition(i)); - } - - Observable> documentBulkInsertObs = bulkInsert( - client, - getCollectionLink(), - docDefList, - 200); - - createdDocuments = documentBulkInsertObs.map(ResourceResponse::getResource).toList().toBlocking().single(); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - warmUp(); - } - - private void warmUp() { - // ensure collection is cached - client.queryDocuments(getCollectionLink(), "SELECT * from r", null).first().toBlocking().single(); - } - - // TODO: DANOBLE: Investigate Direct TCP performance issue - // NOTE: This method requires multiple SHUTDOWN_TIMEOUT intervals - // SEE: https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028 - - @AfterClass(groups = { "long" }, timeOut = 2 * SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteCollection(client, createdCollection); - safeClose(client); - } - - private static Document getDocumentDefinition(int cnt) { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"prop\" : %d, " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, cnt, uuid)); - return doc; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ChangeFeedTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ChangeFeedTest.java deleted file mode 100644 index b2446f333019..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ChangeFeedTest.java +++ /dev/null @@ -1,315 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collection; -import java.time.ZonedDateTime; -import java.util.List; -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ChangeFeedOptions; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.Multimap; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - -public class ChangeFeedTest extends TestSuiteBase { - - private static final int SETUP_TIMEOUT = 40000; - private static final int TIMEOUT = 30000; - private static final String PartitionKeyFieldName = "mypk"; - private Database createdDatabase; - private DocumentCollection createdCollection; - private Multimap partitionKeyToDocuments = ArrayListMultimap.create(); - - private AsyncDocumentClient client; - - public String getCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId()); - } - - static protected DocumentCollection getCollectionDefinition() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); - paths.add("/" + PartitionKeyFieldName); - partitionKeyDef.setPaths(paths); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - collectionDefinition.setPartitionKey(partitionKeyDef); - - return collectionDefinition; - } - - public ChangeFeedTest() { - clientBuilder = createGatewayRxDocumentClient(); - subscriberValidationTimeout = TIMEOUT; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void changeFeed_fromBeginning() throws Exception { - String partitionKey = partitionKeyToDocuments.keySet().iterator().next(); - Collection expectedDocuments = partitionKeyToDocuments.get(partitionKey); - - ChangeFeedOptions changeFeedOption = new ChangeFeedOptions(); - changeFeedOption.setMaxItemCount(3); - changeFeedOption.setPartitionKey(new PartitionKey(partitionKey)); - changeFeedOption.setStartFromBeginning(true); - - List> changeFeedResultList = client.queryDocumentChangeFeed(getCollectionLink(), changeFeedOption) - .toList().toBlocking().single(); - - int count = 0; - for(int i = 0; i < changeFeedResultList.size(); i++) { - FeedResponse changeFeedPage = changeFeedResultList.get(i); - assertThat(changeFeedPage.getResponseContinuation()).as("Response continuation should not be null").isNotNull(); - - count += changeFeedPage.getResults().size(); - assertThat(changeFeedPage.getResults().size()) - .as("change feed should contain all the previously created documents") - .isLessThanOrEqualTo(changeFeedOption.getMaxItemCount()); - } - assertThat(count).as("the number of changes").isEqualTo(expectedDocuments.size()); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void changesFromPartitionKeyRangeId_FromBeginning() throws Exception { - List partitionKeyRangeIds = client.readPartitionKeyRanges(getCollectionLink(), null) - .flatMap(p -> Observable.from(p.getResults()), 1) - .map(pkr -> pkr.getId()) - .toList() - .toBlocking() - .single(); - - assertThat(partitionKeyRangeIds.size()).isGreaterThan(1); - - String pkRangeId = partitionKeyRangeIds.get(0); - - ChangeFeedOptions changeFeedOption = new ChangeFeedOptions(); - changeFeedOption.setMaxItemCount(3); - changeFeedOption.setPartitionKeyRangeId(pkRangeId); - changeFeedOption.setStartFromBeginning(true); - List> changeFeedResultList = client.queryDocumentChangeFeed(getCollectionLink(), changeFeedOption) - .toList().toBlocking().single(); - - int count = 0; - for(int i = 0; i < changeFeedResultList.size(); i++) { - FeedResponse changeFeedPage = changeFeedResultList.get(i); - assertThat(changeFeedPage.getResponseContinuation()).as("Response continuation should not be null").isNotNull(); - - count += changeFeedPage.getResults().size(); - assertThat(changeFeedPage.getResults().size()) - .as("change feed should contain all the previously created documents") - .isLessThanOrEqualTo(changeFeedOption.getMaxItemCount()); - - assertThat(changeFeedPage.getResponseContinuation()).as("Response continuation should not be null").isNotNull(); - assertThat(changeFeedPage.getResponseContinuation()).as("Response continuation should not be empty").isNotEmpty(); - } - assertThat(changeFeedResultList.size()).as("has at least one page").isGreaterThanOrEqualTo(1); - assertThat(count).as("the number of changes").isGreaterThan(0); - assertThat(count).as("the number of changes").isLessThan(partitionKeyToDocuments.size()); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void changeFeed_fromNow() throws Exception { - // Read change feed from current. - ChangeFeedOptions changeFeedOption = new ChangeFeedOptions(); - String partitionKey = partitionKeyToDocuments.keySet().iterator().next(); - changeFeedOption.setPartitionKey(new PartitionKey(partitionKey)); - - List> changeFeedResultsList = client.queryDocumentChangeFeed(getCollectionLink(), changeFeedOption) - .toList() - .toBlocking().single(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder().totalSize(0).build(); - validator.validate(changeFeedResultsList); - assertThat(changeFeedResultsList.get(changeFeedResultsList.size() -1 ). - getResponseContinuation()).as("Response continuation should not be null").isNotNull(); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void changeFeed_fromStartDate() throws Exception { - - //setStartDateTime is not currently supported in multimaster mode. So skipping the test - if(BridgeInternal.isEnableMultipleWriteLocations(client.getDatabaseAccount().toBlocking().single())){ - throw new SkipException("StartTime/IfModifiedSince is not currently supported when EnableMultipleWriteLocations is set"); - } - - // Read change feed from current. - ChangeFeedOptions changeFeedOption = new ChangeFeedOptions(); - String partitionKey = partitionKeyToDocuments.keySet().iterator().next(); - - changeFeedOption.setPartitionKey(new PartitionKey(partitionKey)); - ZonedDateTime befTime = ZonedDateTime.now(); - // Waiting for at-least a second to ensure that new document is created after we took the time stamp - waitAtleastASecond(befTime); - - ZonedDateTime dateTimeBeforeCreatingDoc = ZonedDateTime.now(); - changeFeedOption.setStartDateTime(dateTimeBeforeCreatingDoc); - - // Waiting for at-least a second to ensure that new document is created after we took the time stamp - waitAtleastASecond(dateTimeBeforeCreatingDoc); - client.createDocument(getCollectionLink(), getDocumentDefinition(partitionKey), null, true).toBlocking().single().getResource(); - - List> changeFeedResultList = client.queryDocumentChangeFeed(getCollectionLink(), - changeFeedOption).toList() - .toBlocking().single(); - - int count = 0; - for(int i = 0; i < changeFeedResultList.size(); i++) { - FeedResponse changeFeedPage = changeFeedResultList.get(i); - count += changeFeedPage.getResults().size(); - assertThat(changeFeedPage.getResponseContinuation()).as("Response continuation should not be null").isNotNull(); - } - assertThat(count).as("Change feed should have one newly created document").isEqualTo(1); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void changesFromPartitionKey_AfterInsertingNewDocuments() throws Exception { - ChangeFeedOptions changeFeedOption = new ChangeFeedOptions(); - changeFeedOption.setMaxItemCount(3); - String partitionKey = partitionKeyToDocuments.keySet().iterator().next(); - changeFeedOption.setPartitionKey(new PartitionKey(partitionKey)); - - List> changeFeedResultsList = client.queryDocumentChangeFeed(getCollectionLink(), changeFeedOption) - .toList().toBlocking().single(); - - assertThat(changeFeedResultsList).as("only one page").hasSize(1); - assertThat(changeFeedResultsList.get(0).getResults()).as("no recent changes").isEmpty(); - - String changeFeedContinuation = changeFeedResultsList.get(changeFeedResultsList.size()-1).getResponseContinuation(); - assertThat(changeFeedContinuation).as("continuation token is not null").isNotNull(); - assertThat(changeFeedContinuation).as("continuation token is not empty").isNotEmpty(); - - // create some documents - client.createDocument(getCollectionLink(), getDocumentDefinition(partitionKey), null, true).toBlocking().single(); - client.createDocument(getCollectionLink(), getDocumentDefinition(partitionKey), null, true).toBlocking().single(); - - // Read change feed from continuation - changeFeedOption.setRequestContinuation(changeFeedContinuation); - - - FeedResponse changeFeedResults2 = client.queryDocumentChangeFeed(getCollectionLink(), changeFeedOption) - .toBlocking().first(); - - assertThat(changeFeedResults2.getResults()).as("change feed should contain newly inserted docs.").hasSize(2); - assertThat(changeFeedResults2.getResponseContinuation()).as("Response continuation should not be null").isNotNull(); - } - - public void createDocument(AsyncDocumentClient client, String partitionKey) { - Document docDefinition = getDocumentDefinition(partitionKey); - - Document createdDocument = client - .createDocument(getCollectionLink(), docDefinition, null, false).toBlocking().single().getResource(); - partitionKeyToDocuments.put(partitionKey, createdDocument); - } - - public List bulkInsert(AsyncDocumentClient client, List docs) { - ArrayList>> result = new ArrayList>>(); - for (int i = 0; i < docs.size(); i++) { - result.add(client.createDocument("dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId(), docs.get(i), null, false)); - } - - return Observable.merge(result, 100).map(r -> r.getResource()).toList().toBlocking().single(); - } - - @AfterMethod(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void removeCollection() { - if (createdCollection != null) { - deleteCollection(client, getCollectionLink()); - } - } - - @BeforeMethod(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void populateDocuments(Method method) { - super.beforeMethod(method); - partitionKeyToDocuments.clear(); - - RequestOptions options = new RequestOptions(); - options.setOfferThroughput(10100); - createdCollection = createCollection(client, createdDatabase.getId(), getCollectionDefinition(), options); - - List docs = new ArrayList<>(); - - for (int i = 0; i < 200; i++) { - String partitionKey = UUID.randomUUID().toString(); - for(int j = 0; j < 7; j++) { - docs.add(getDocumentDefinition(partitionKey)); - } - } - - List insertedDocs = bulkInsert(client, docs); - for(Document doc: insertedDocs) { - partitionKeyToDocuments.put(doc.getString(PartitionKeyFieldName), doc); - } - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - // set up the client - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private static Document getDocumentDefinition(String partitionKey) { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(); - doc.setId(uuid); - doc.set("mypk", partitionKey); - doc.set("prop", uuid); - return doc; - } - - private static void waitAtleastASecond(ZonedDateTime befTime) throws InterruptedException { - while (befTime.plusSeconds(1).isAfter(ZonedDateTime.now())) { - Thread.sleep(100); - } - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ClientUnderTestBuilder.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ClientUnderTestBuilder.java deleted file mode 100644 index 914014c2bb2c..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ClientUnderTestBuilder.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentClientUnderTest; - -public class ClientUnderTestBuilder extends Builder { - - public ClientUnderTestBuilder(Builder builder) { - this.configs = builder.configs; - this.connectionPolicy = builder.connectionPolicy; - this.desiredConsistencyLevel = builder.desiredConsistencyLevel; - this.masterKeyOrResourceToken = builder.masterKeyOrResourceToken; - this.serviceEndpoint = builder.serviceEndpoint; - } - - @Override - public RxDocumentClientUnderTest build() { - return new RxDocumentClientUnderTest( - this.serviceEndpoint, - this.masterKeyOrResourceToken, - this.connectionPolicy, - this.desiredConsistencyLevel, - this.configs); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/CollectionCrudTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/CollectionCrudTest.java deleted file mode 100644 index 3aa4b54519cf..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/CollectionCrudTest.java +++ /dev/null @@ -1,335 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.CompositePath; -import com.microsoft.azure.cosmosdb.CompositePathSortOrder; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.IndexingMode; -import com.microsoft.azure.cosmosdb.IndexingPolicy; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.SpatialSpec; -import com.microsoft.azure.cosmosdb.SpatialType; - -import rx.Observable; - -public class CollectionCrudTest extends TestSuiteBase { - private static final int TIMEOUT = 30000; - private static final int SETUP_TIMEOUT = 20000; - private static final int SHUTDOWN_TIMEOUT = 20000; - private final String databaseId = DatabaseForTest.generateId(); - - private AsyncDocumentClient client; - private Database database; - - @Factory(dataProvider = "clientBuildersWithDirect") - public CollectionCrudTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - this.subscriberValidationTimeout = TIMEOUT; - } - - @DataProvider(name = "collectionCrudArgProvider") - public Object[][] collectionCrudArgProvider() { - return new Object[][] { - // collection name, is name base - {UUID.randomUUID().toString(), false } , - {UUID.randomUUID().toString(), true } , - - // with special characters in the name. - {"+ -_,:.|~" + UUID.randomUUID().toString() + " +-_,:.|~", true } , - }; - } - - private DocumentCollection getCollectionDefinition(String collectionName) { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(collectionName); - collectionDefinition.setPartitionKey(partitionKeyDef); - - return collectionDefinition; - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT, dataProvider = "collectionCrudArgProvider") - public void createCollection(String collectionName, boolean isNameBased) { - DocumentCollection collectionDefinition = getCollectionDefinition(collectionName); - - Observable> createObservable = client - .createCollection(getDatabaseLink(database, isNameBased), collectionDefinition, null); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(collectionDefinition.getId()).build(); - - validateSuccess(createObservable, validator); - safeDeleteAllCollections(client, database); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void createCollectionWithCompositeIndexAndSpatialSpec() { - DocumentCollection collection = new DocumentCollection(); - - IndexingPolicy indexingPolicy = new IndexingPolicy(); - CompositePath compositePath1 = new CompositePath(); - compositePath1.setPath("/path1"); - compositePath1.setOrder(CompositePathSortOrder.Ascending); - CompositePath compositePath2 = new CompositePath(); - compositePath2.setPath("/path2"); - compositePath2.setOrder(CompositePathSortOrder.Descending); - CompositePath compositePath3 = new CompositePath(); - compositePath3.setPath("/path3"); - CompositePath compositePath4 = new CompositePath(); - compositePath4.setPath("/path4"); - compositePath4.setOrder(CompositePathSortOrder.Ascending); - CompositePath compositePath5 = new CompositePath(); - compositePath5.setPath("/path5"); - compositePath5.setOrder(CompositePathSortOrder.Descending); - CompositePath compositePath6 = new CompositePath(); - compositePath6.setPath("/path6"); - - ArrayList compositeIndex1 = new ArrayList(); - compositeIndex1.add(compositePath1); - compositeIndex1.add(compositePath2); - compositeIndex1.add(compositePath3); - - ArrayList compositeIndex2 = new ArrayList(); - compositeIndex2.add(compositePath4); - compositeIndex2.add(compositePath5); - compositeIndex2.add(compositePath6); - - Collection> compositeIndexes = new ArrayList>(); - compositeIndexes.add(compositeIndex1); - compositeIndexes.add(compositeIndex2); - indexingPolicy.setCompositeIndexes(compositeIndexes); - - SpatialType[] spatialTypes = new SpatialType[] { - SpatialType.Point, - SpatialType.LineString, - SpatialType.Polygon, - SpatialType.MultiPolygon - }; - Collection spatialIndexes = new ArrayList(); - for (int index = 0; index < 2; index++) { - Collection collectionOfSpatialTypes = new ArrayList(); - - SpatialSpec spec = new SpatialSpec(); - spec.setPath("/path" + index + "/*"); - - for (int i = index; i < index + 3; i++) { - collectionOfSpatialTypes.add(spatialTypes[i]); - } - spec.setSpatialTypes(collectionOfSpatialTypes); - spatialIndexes.add(spec); - } - - indexingPolicy.setSpatialIndexes(spatialIndexes); - - collection.setId(UUID.randomUUID().toString()); - collection.setIndexingPolicy(indexingPolicy); - - Observable> createObservable = client - .createCollection(database.getSelfLink(), collection, null); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(collection.getId()) - .withCompositeIndexes(compositeIndexes) - .withSpatialIndexes(spatialIndexes) - .build(); - - validateSuccess(createObservable, validator); - safeDeleteAllCollections(client, database); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT, dataProvider = "collectionCrudArgProvider") - public void readCollection(String collectionName, boolean isNameBased) { - DocumentCollection collectionDefinition = getCollectionDefinition(collectionName); - - Observable> createObservable = client.createCollection(getDatabaseLink(database, isNameBased), collectionDefinition, - null); - DocumentCollection collection = createObservable.toBlocking().single().getResource(); - - Observable> readObservable = client.readCollection(getCollectionLink(database, collection, isNameBased), null); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(collection.getId()).build(); - validateSuccess(readObservable, validator); - safeDeleteAllCollections(client, database); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT, dataProvider = "collectionCrudArgProvider") - public void readCollection_NameBase(String collectionName, boolean isNameBased) { - DocumentCollection collectionDefinition = getCollectionDefinition(collectionName); - - Observable> createObservable = client.createCollection(getDatabaseLink(database, isNameBased), collectionDefinition, - null); - DocumentCollection collection = createObservable.toBlocking().single().getResource(); - - Observable> readObservable = client.readCollection( - getCollectionLink(database, collection, isNameBased), null); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(collection.getId()).build(); - validateSuccess(readObservable, validator); - safeDeleteAllCollections(client, database); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT, dataProvider = "collectionCrudArgProvider") - public void readCollection_DoesntExist(String collectionName, boolean isNameBased) throws Exception { - - Observable> readObservable = client - .readCollection(Utils.getCollectionNameLink(database.getId(), "I don't exist"), null); - - FailureValidator validator = new FailureValidator.Builder().resourceNotFound().build(); - validateFailure(readObservable, validator); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT, dataProvider = "collectionCrudArgProvider") - public void deleteCollection(String collectionName, boolean isNameBased) { - DocumentCollection collectionDefinition = getCollectionDefinition(collectionName); - - Observable> createObservable = client.createCollection(getDatabaseLink(database, isNameBased), collectionDefinition, null); - DocumentCollection collection = createObservable.toBlocking().single().getResource(); - - Observable> deleteObservable = client.deleteCollection(getCollectionLink(database, collection, isNameBased), - null); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .nullResource().build(); - validateSuccess(deleteObservable, validator); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT, dataProvider = "collectionCrudArgProvider") - public void replaceCollection(String collectionName, boolean isNameBased) { - // create a collection - DocumentCollection collectionDefinition = getCollectionDefinition(collectionName); - Observable> createObservable = client.createCollection(getDatabaseLink(database, isNameBased), collectionDefinition, null); - DocumentCollection collection = createObservable.toBlocking().single().getResource(); - // sanity check - assertThat(collection.getIndexingPolicy().getIndexingMode()).isEqualTo(IndexingMode.Consistent); - - // replace indexing mode - IndexingPolicy indexingMode = new IndexingPolicy(); - indexingMode.setIndexingMode(IndexingMode.Lazy); - collection.setIndexingPolicy(indexingMode); - Observable> readObservable = client.replaceCollection(collection, null); - - // validate - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .indexingMode(IndexingMode.Lazy).build(); - validateSuccess(readObservable, validator); - safeDeleteAllCollections(client, database); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void sessionTokenConsistencyCollectionDeleteCreateSameName() { - AsyncDocumentClient client1 = clientBuilder.build(); - AsyncDocumentClient client2 = clientBuilder.build(); - - String dbId = "db"; - String collectionId = "coll"; - try { - Database databaseDefinition = new Database(); - databaseDefinition.setId(dbId); - createDatabase(client1, dbId); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(collectionId); - DocumentCollection collection = createCollection(client1, dbId, collectionDefinition); - - Document document = new Document(); - document.setId("doc"); - document.set("name", "New Document"); - createDocument(client1, dbId, collectionId, document); - ResourceResponse readDocumentResponse = client1.readDocument(Utils.getDocumentNameLink(dbId, collectionId, document.getId()), null).toBlocking().single(); - logger.info("Client 1 Read Document Client Side Request Statistics {}", readDocumentResponse.getRequestDiagnosticsString()); - logger.info("Client 1 Read Document Latency {}", readDocumentResponse.getRequestLatency()); - - document.set("name", "New Updated Document"); - ResourceResponse upsertDocumentResponse = client1.upsertDocument(collection.getSelfLink(), document, null, - true).toBlocking().single(); - logger.info("Client 1 Upsert Document Client Side Request Statistics {}", upsertDocumentResponse.getRequestDiagnosticsString()); - logger.info("Client 1 Upsert Document Latency {}", upsertDocumentResponse.getRequestLatency()); - - // Delete the existing collection - deleteCollection(client2, Utils.getCollectionNameLink(dbId, collectionId)); - // Recreate the collection with the same name but with different client - createCollection(client2, dbId, collectionDefinition); - - Document newDocument = new Document(); - newDocument.setId("doc"); - newDocument.set("name", "New Created Document"); - createDocument(client2, dbId, collectionId, newDocument); - - readDocumentResponse = client1.readDocument(Utils.getDocumentNameLink(dbId, collectionId, newDocument.getId()), null).toBlocking().single(); - logger.info("Client 2 Read Document Client Side Request Statistics {}", readDocumentResponse.getRequestDiagnosticsString()); - logger.info("Client 2 Read Document Latency {}", readDocumentResponse.getRequestLatency()); - - Document readDocument = readDocumentResponse.getResource(); - - assertThat(readDocument.getId().equals(newDocument.getId())).isTrue(); - assertThat(readDocument.get("name").equals(newDocument.get("name"))).isTrue(); - } finally { - safeDeleteDatabase(client1, dbId); - safeClose(client1); - safeClose(client2); - } - } - - @BeforeClass(groups = { "emulator" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - database = createDatabase(client, databaseId); - } - - @AfterClass(groups = { "emulator" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, databaseId); - safeClose(client); - } - - private static String getDatabaseLink(Database db, boolean isNameLink) { - return isNameLink ? "dbs/" + db.getId() : db.getSelfLink(); - } - - private static String getCollectionLink(Database db, DocumentCollection documentCollection, boolean isNameLink) { - return isNameLink ? "dbs/" + db.getId() + "/colls/" + documentCollection.getId() : documentCollection.getSelfLink(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/CollectionQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/CollectionQueryTest.java deleted file mode 100644 index 0a4500c9d6a7..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/CollectionQueryTest.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.apache.commons.lang3.StringUtils; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - -public class CollectionQueryTest extends TestSuiteBase { - private final static int TIMEOUT = 30000; - private final String databaseId = DatabaseForTest.generateId(); - private List createdCollections = new ArrayList<>(); - private AsyncDocumentClient client; - - private String getDatabaseLink() { - return Utils.getDatabaseNameLink(databaseId); - } - - @Factory(dataProvider = "clientBuilders") - public CollectionQueryTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - this.subscriberValidationTimeout = TIMEOUT; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryCollectionsWithFilter() throws Exception { - - String filterCollectionId = createdCollections.get(0).getId(); - String query = String.format("SELECT * from c where c.id = '%s'", filterCollectionId); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - Observable> queryObservable = client.queryCollections(getDatabaseLink(), query, options); - - List expectedCollections = createdCollections.stream() - .filter(c -> StringUtils.equals(filterCollectionId, c.getId()) ).collect(Collectors.toList()); - - assertThat(expectedCollections).isNotEmpty(); - - int expectedPageSize = (expectedCollections.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedCollections.size()) - .exactlyContainsInAnyOrder(expectedCollections.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(queryObservable, validator, 10000); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryAllCollections() throws Exception { - - String query = "SELECT * from c"; - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - String databaseLink = Utils.getDatabaseNameLink(databaseId); - Observable> queryObservable = client.queryCollections(databaseLink, query, options); - - List expectedCollections = createdCollections; - - assertThat(expectedCollections).isNotEmpty(); - - int expectedPageSize = (expectedCollections.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedCollections.size()) - .exactlyContainsInAnyOrder(expectedCollections.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(queryObservable, validator, 10000); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryCollections_NoResults() throws Exception { - - String query = "SELECT * from root r where r.id = '2'"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client.queryCollections(getDatabaseLink(), query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(new ArrayList<>()) - .numberOfPages(1) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - createDatabase(client, databaseId); - - DocumentCollection collection = new DocumentCollection(); - collection.setId(UUID.randomUUID().toString()); - createdCollections.add(createCollection(client, databaseId, collection)); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, databaseId); - safeClose(client); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DCDocumentCrudTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DCDocumentCrudTest.java deleted file mode 100644 index fc8b79637e95..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DCDocumentCrudTest.java +++ /dev/null @@ -1,343 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.StoredProcedure; -import com.microsoft.azure.cosmosdb.StoredProcedureResponse; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.SpyClientUnderTestFactory; -import org.mockito.stubbing.Answer; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Observable; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.spy; - -/** - * The purpose of the tests in this class is to ensure the request are routed through direct connectivity stack. - * The tests in other test classes validate the actual behaviour and different scenarios. - */ -public class DCDocumentCrudTest extends TestSuiteBase { - private final static int QUERY_TIMEOUT = 30000; - private final static String PARTITION_KEY_FIELD_NAME = "mypk"; - - private static Database createdDatabase; - private static DocumentCollection createdCollection; - - private SpyClientUnderTestFactory.ClientWithGatewaySpy client; - - @DataProvider - public static Object[][] directClientBuilder() { - return new Object[][] { { createDCBuilder(Protocol.Https) }, { createDCBuilder(Protocol.Tcp) } }; - } - - static Builder createDCBuilder(Protocol protocol) { - - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - - Configs configs = spy(new Configs()); - doAnswer((Answer) invocation -> protocol).when(configs).getProtocol(); - - return new Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withConfigs(configs) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY); - } - - @Factory(dataProvider = "directClientBuilder") - public DCDocumentCrudTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "direct" }, timeOut = TIMEOUT) - public void executeStoredProc() { - StoredProcedure storedProcedure = new StoredProcedure(); - storedProcedure.setId(UUID.randomUUID().toString()); - storedProcedure.setBody("function() {var x = 10;}"); - - Observable> createObservable = client - .createStoredProcedure(getCollectionLink(), storedProcedure, null); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(storedProcedure.getId()) - .build(); - - validateSuccess(createObservable, validator, TIMEOUT); - - // creating a stored proc will go through gateway so clearing captured requests - - client.getCapturedRequests().clear(); - - // execute the created storedProc and ensure it goes through direct connectivity stack - String storedProcLink = "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId() + "/sprocs/" + storedProcedure.getId(); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey("dummy")); - StoredProcedureResponse storedProcedureResponse = client - .executeStoredProcedure(storedProcLink, options, null).toBlocking().single(); - - assertThat(storedProcedureResponse.getStatusCode()).isEqualTo(200); - - // validate the request routed through direct stack - validateNoStoredProcExecutionOperationThroughGateway(); - } - - /** - * Tests document creation through direct mode - */ - @Test(groups = { "direct" }, timeOut = TIMEOUT) - public void create() { - final Document docDefinition = getDocumentDefinition(); - - Observable> createObservable = client.createDocument( - this.getCollectionLink(), docDefinition, null, false); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - - validateSuccess(createObservable, validator, TIMEOUT); - validateNoDocumentOperationThroughGateway(); - } - - /** - * Tests document read through direct https. - * @throws Exception - */ - @Test(groups = { "direct" }, timeOut = TIMEOUT) - public void read() throws Exception { - Document docDefinition = this.getDocumentDefinition(); - Document document = client.createDocument(getCollectionLink(), docDefinition, null, false).toBlocking().single().getResource(); - - // give times to replicas to catch up after a write - waitIfNeededForReplicasToCatchUp(clientBuilder); - - String pkValue = document.getString(PARTITION_KEY_FIELD_NAME); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(pkValue)); - - String docLink = - String.format("dbs/%s/colls/%s/docs/%s", createdDatabase.getId(), createdCollection.getId(), document.getId()); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - - validateSuccess(client.readDocument(docLink, options), validator, TIMEOUT); - - validateNoDocumentOperationThroughGateway(); - } - - /** - * Tests document upsert through direct https. - * @throws Exception - */ - @Test(groups = { "direct" }, timeOut = TIMEOUT) - public void upsert() throws Exception { - - final Document docDefinition = getDocumentDefinition(); - - final Document document = client.createDocument(getCollectionLink(), docDefinition, null, false) - .toBlocking() - .single() - .getResource(); - - // give times to replicas to catch up after a write - waitIfNeededForReplicasToCatchUp(clientBuilder); - - String pkValue = document.getString(PARTITION_KEY_FIELD_NAME); - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(pkValue)); - - String propName = "newProp"; - String propValue = "hello"; - document.set(propName, propValue); - - ResourceResponseValidator validator = ResourceResponseValidator.builder() - .withProperty(propName, propValue) - .build(); - validateSuccess(client.upsertDocument(getCollectionLink(), document, options, false), validator, TIMEOUT); - - validateNoDocumentOperationThroughGateway(); - } - - @Test(groups = { "direct" }, timeOut = QUERY_TIMEOUT) - public void crossPartitionQuery() { - - truncateCollection(createdCollection); - waitIfNeededForReplicasToCatchUp(clientBuilder); - - client.getCapturedRequests().clear(); - - int cnt = 1000; - List documentList = new ArrayList<>(); - for(int i = 0; i < cnt; i++) { - Document docDefinition = getDocumentDefinition(); - documentList.add(docDefinition); - } - - documentList = bulkInsert(client, getCollectionLink(), documentList).map(ResourceResponse::getResource).toList().toBlocking().single(); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - options.setMaxDegreeOfParallelism(-1); - options.setMaxItemCount(100); - Observable> results = client.queryDocuments(getCollectionLink(), "SELECT * FROM r", options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(documentList.size()) - .exactlyContainsInAnyOrder(documentList.stream().map(Document::getResourceId).collect(Collectors.toList())).build(); - - try { - validateQuerySuccess(results, validator, QUERY_TIMEOUT); - validateNoDocumentQueryOperationThroughGateway(); - // validates only the first query for fetching query plan goes to gateway. - assertThat(client.getCapturedRequests().stream().filter(r -> r.getResourceType() == ResourceType.Document)).hasSize(1); - } catch (Throwable error) { - if (clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - } - } - - private void validateNoStoredProcExecutionOperationThroughGateway() { - // this validates that Document related requests don't go through gateway - DocumentServiceRequestValidator validateResourceTypesSentToGateway = DocumentServiceRequestValidator.builder() - .resourceTypeIn(ResourceType.DatabaseAccount, - ResourceType.Database, - ResourceType.DocumentCollection, - ResourceType.PartitionKeyRange) - .build(); - - // validate that all gateway captured requests are non document resources - for(RxDocumentServiceRequest request: client.getCapturedRequests()) { - validateResourceTypesSentToGateway.validate(request); - } - } - - private void validateNoDocumentOperationThroughGateway() { - // this validates that Document related requests don't go through gateway - DocumentServiceRequestValidator validateResourceTypesSentToGateway = DocumentServiceRequestValidator.builder() - .resourceTypeIn(ResourceType.DatabaseAccount, - ResourceType.Database, - ResourceType.DocumentCollection, - ResourceType.PartitionKeyRange) - .build(); - - // validate that all gateway captured requests are non document resources - for(RxDocumentServiceRequest request: client.getCapturedRequests()) { - validateResourceTypesSentToGateway.validate(request); - } - } - - private void validateNoDocumentQueryOperationThroughGateway() { - // this validates that Document related requests don't go through gateway - DocumentServiceRequestValidator validateResourceTypesSentToGateway = DocumentServiceRequestValidator.builder() - .resourceTypeIn(ResourceType.DatabaseAccount, - ResourceType.Database, - ResourceType.DocumentCollection, - ResourceType.PartitionKeyRange) - .build(); - - // validate that all gateway captured requests are non document resources - for(RxDocumentServiceRequest request: client.getCapturedRequests()) { - if (request.getOperationType() == OperationType.Query) { - assertThat(request.getPartitionKeyRangeIdentity()).isNull(); - } else { - validateResourceTypesSentToGateway.validate(request); - } - } - } - - @BeforeClass(groups = { "direct" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - - RequestOptions options = new RequestOptions(); - options.setOfferThroughput(10100); - createdDatabase = SHARED_DATABASE; - createdCollection = createCollection(createdDatabase.getId(), getCollectionDefinition(), options); - client = SpyClientUnderTestFactory.createClientWithGatewaySpy(clientBuilder); - - assertThat(client.getCapturedRequests()).isNotEmpty(); - } - - @AfterClass(groups = { "direct" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - @BeforeMethod(groups = { "direct" }) - public void beforeMethod(Method method) { - super.beforeMethod(method); - client.getCapturedRequests().clear(); - } - - private String getCollectionLink() { - return String.format("/dbs/%s/colls/%s", createdDatabase.getId(), createdCollection.getId()); - } - - private Document getDocumentDefinition() { - Document doc = new Document(); - doc.setId(UUID.randomUUID().toString()); - doc.set(PARTITION_KEY_FIELD_NAME, UUID.randomUUID().toString()); - doc.set("name", "Hafez"); - return doc; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DatabaseCrudTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DatabaseCrudTest.java deleted file mode 100644 index 3df99491e5b2..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DatabaseCrudTest.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - -import javax.net.ssl.SSLException; - -import java.util.ArrayList; -import java.util.List; - -public class DatabaseCrudTest extends TestSuiteBase { - private final String preExistingDatabaseId = DatabaseForTest.generateId(); - private final List databases = new ArrayList<>(); - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuilders") - public DatabaseCrudTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void createDatabase() throws Exception { - Database databaseDefinition = new Database(); - databaseDefinition.setId(DatabaseForTest.generateId()); - databases.add(databaseDefinition.getId()); - - // create the database - Observable> createObservable = client.createDatabase(databaseDefinition, null); - - // validate - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(databaseDefinition.getId()).build(); - validateSuccess(createObservable, validator); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void createDatabase_AlreadyExists() throws Exception { - Database databaseDefinition = new Database(); - databaseDefinition.setId(DatabaseForTest.generateId()); - databases.add(databaseDefinition.getId()); - - client.createDatabase(databaseDefinition, null).toBlocking().single(); - - // attempt to create the database - Observable> createObservable = client.createDatabase(databaseDefinition, null); - - // validate - FailureValidator validator = new FailureValidator.Builder().resourceAlreadyExists().build(); - validateFailure(createObservable, validator); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void readDatabase() throws Exception { - // read database - Observable> readObservable = client - .readDatabase(Utils.getDatabaseNameLink(preExistingDatabaseId), null); - - // validate - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(preExistingDatabaseId).build(); - validateSuccess(readObservable, validator); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void readDatabase_DoesntExist() throws Exception { - // read database - Observable> readObservable = client - .readDatabase(Utils.getDatabaseNameLink("I don't exist"), null); - - // validate - FailureValidator validator = new FailureValidator.Builder().resourceNotFound().build(); - validateFailure(readObservable, validator); - } - - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void deleteDatabase() throws Exception { - // create the database - Database databaseDefinition = new Database(); - databaseDefinition.setId(DatabaseForTest.generateId()); - databases.add(databaseDefinition.getId()); - client.createDatabase(databaseDefinition, null).toCompletable().await(); - - // delete the database - Observable> deleteObservable = client - .deleteDatabase(Utils.getDatabaseNameLink(databaseDefinition.getId()), null); - - // validate - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .nullResource().build(); - validateSuccess(deleteObservable, validator); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void deleteDatabase_DoesntExist() throws Exception { - // delete the database - Observable> deleteObservable = client - .deleteDatabase(Utils.getDatabaseNameLink("I don't exist"), null); - - // validate - FailureValidator validator = new FailureValidator.Builder().resourceNotFound().build(); - validateFailure(deleteObservable, validator); - } - - @BeforeClass(groups = { "emulator" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createDatabase(client, preExistingDatabaseId); - } - - @AfterClass(groups = { "emulator" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, preExistingDatabaseId); - for(String dbId: databases) { - safeDeleteDatabase(client, dbId); - } - safeClose(client); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DatabaseQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DatabaseQueryTest.java deleted file mode 100644 index 832e8fe62ea8..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DatabaseQueryTest.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.apache.commons.lang3.StringUtils; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - -public class DatabaseQueryTest extends TestSuiteBase { - - public final String databaseId1 = DatabaseForTest.generateId(); - public final String databaseId2 = DatabaseForTest.generateId(); - - private List createdDatabases = new ArrayList<>(); - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuilders") - public DatabaseQueryTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryDatabaseWithFilter() throws Exception { - String query = String.format("SELECT * from c where c.id = '%s'", databaseId1); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - Observable> queryObservable = client.queryDatabases(query, options); - - List expectedDatabases = createdDatabases.stream() - .filter(d -> StringUtils.equals(databaseId1, d.getId()) ).collect(Collectors.toList()); - - assertThat(expectedDatabases).isNotEmpty(); - - int expectedPageSize = (expectedDatabases.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedDatabases.size()) - .exactlyContainsInAnyOrder(expectedDatabases.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(queryObservable, validator, 10000); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryAllDatabase() throws Exception { - - String query = String.format("SELECT * from c where c.id in ('%s', '%s')", - databaseId1, - databaseId2); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - Observable> queryObservable = client.queryDatabases(query, options); - - List expectedDatabases = createdDatabases; - - assertThat(expectedDatabases).isNotEmpty(); - - int expectedPageSize = (expectedDatabases.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedDatabases.size()) - .exactlyContainsInAnyOrder(expectedDatabases.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(queryObservable, validator, 10000); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryDatabases_NoResults() throws Exception { - - String query = "SELECT * from root r where r.id = '2'"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client.queryDatabases(query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(new ArrayList<>()) - .numberOfPages(1) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - - Database d1 = new Database(); - d1.setId(databaseId1); - createdDatabases.add(createDatabase(client, d1)); - - Database d2 = new Database(); - d2.setId(databaseId2); - createdDatabases.add(createDatabase(client, d2)); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, databaseId1); - safeDeleteDatabase(client, databaseId2); - - safeClose(client); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DocumentClientResourceLeakTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DocumentClientResourceLeakTest.java deleted file mode 100644 index e3a1df72d70a..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DocumentClientResourceLeakTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; -import org.testng.SkipException; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import java.util.UUID; -import java.util.concurrent.TimeUnit; - -import static org.apache.commons.io.FileUtils.ONE_MB; -import static org.assertj.core.api.Assertions.assertThat; - -public class DocumentClientResourceLeakTest extends TestSuiteBase { - private static final int TIMEOUT = 240000; - private static final int MAX_NUMBER = 1000; - private Builder clientBuilder; - private AsyncDocumentClient client; - - private Database createdDatabase; - private DocumentCollection createdCollection; - - @Factory(dataProvider = "simpleClientBuildersWithDirect") - public DocumentClientResourceLeakTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = {"emulator"}, timeOut = TIMEOUT) - public void resourceLeak() throws Exception { - //TODO FIXME DANOBLE this test doesn't pass on RNTBD - if (clientBuilder.configs.getProtocol() == Protocol.Tcp) { - throw new SkipException("RNTBD"); - } - System.gc(); - TimeUnit.SECONDS.sleep(10); - long usedMemoryInBytesBefore = (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()); - - - for (int i = 0; i < MAX_NUMBER; i++) { - logger.info("client {}", i); - client = clientBuilder.build(); - try { - logger.info("creating doc..."); - createDocument(client, createdDatabase.getId(), createdCollection.getId(), getDocumentDefinition()); - } finally { - logger.info("closing client..."); - client.close(); - } - } - System.gc(); - TimeUnit.SECONDS.sleep(10); - long usedMemoryInBytesAfter = (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()); - - assertThat(usedMemoryInBytesAfter - usedMemoryInBytesBefore).isLessThan(200 * ONE_MB); - } - - @BeforeClass(groups = {"emulator"}, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DocumentCrudTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DocumentCrudTest.java deleted file mode 100644 index 2c13e78df1ef..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/DocumentCrudTest.java +++ /dev/null @@ -1,435 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.Undefined; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import org.apache.commons.lang3.StringUtils; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Observable; - -import java.util.Date; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -import static org.apache.commons.io.FileUtils.ONE_MB; -import static org.assertj.core.api.Assertions.assertThat; - -public class DocumentCrudTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public DocumentCrudTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @DataProvider(name = "documentCrudArgProvider") - public Object[][] documentCrudArgProvider() { - return new Object[][] { - // collection name, is name base - {UUID.randomUUID().toString(), false } , - {UUID.randomUUID().toString(), true } , - - // with special characters in the name. - {"+ -_,:.|~" + UUID.randomUUID().toString() + " +-_,:.|~", true } , - }; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void createDocument(String documentId, boolean isNameBased) { - Document docDefinition = getDocumentDefinition(documentId); - - Observable> createObservable = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - - validateSuccess(createObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void createLargeDocument(String documentId, boolean isNameBased) { - Document docDefinition = getDocumentDefinition(documentId); - - //Keep size as ~ 1.5MB to account for size of other props - int size = (int) (ONE_MB * 1.5); - docDefinition.set("largeString", StringUtils.repeat("x", size)); - - Observable> createObservable = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - - validateSuccess(createObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void createDocumentWithVeryLargePartitionKey(String documentId, boolean isNameBased) { - Document docDefinition = getDocumentDefinition(documentId); - StringBuilder sb = new StringBuilder(); - for(int i = 0; i < 100; i++) { - sb.append(i).append("x"); - } - docDefinition.set("mypk", sb.toString()); - - Observable> createObservable = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .withProperty("mypk", sb.toString()) - .build(); - validateSuccess(createObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void readDocumentWithVeryLargePartitionKey(String documentId, boolean isNameBased) { - Document docDefinition = getDocumentDefinition(documentId); - StringBuilder sb = new StringBuilder(); - for(int i = 0; i < 100; i++) { - sb.append(i).append("x"); - } - docDefinition.set("mypk", sb.toString()); - - Document createdDocument = TestSuiteBase.createDocument(client, createdDatabase.getId(), createdCollection.getId(), docDefinition); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(sb.toString())); - Observable> readObservable = client.readDocument(getDocumentLink(createdDocument, isNameBased), options); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .withProperty("mypk", sb.toString()) - .build(); - validateSuccess(readObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void createDocument_AlreadyExists(String documentId, boolean isNameBased) { - Document docDefinition = getDocumentDefinition(documentId); - - client.createDocument(getCollectionLink(isNameBased), docDefinition, null, false).toBlocking().single().getResource(); - - Observable> createObservable = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false); - - FailureValidator validator = new FailureValidator.Builder().resourceAlreadyExists().build(); - validateFailure(createObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void createDocumentTimeout(String documentId, boolean isNameBased) { - Document docDefinition = getDocumentDefinition(documentId); - - Observable> createObservable = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false) - .timeout(1, TimeUnit.MILLISECONDS); - - FailureValidator validator = new FailureValidator.Builder().instanceOf(TimeoutException.class).build(); - - validateFailure(createObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void readDocument(String documentId, boolean isNameBased) { - Document docDefinition = getDocumentDefinition(documentId); - - Document document = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false).toBlocking().single().getResource(); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(document.get("mypk"))); - Observable> readObservable = client.readDocument(getDocumentLink(document, isNameBased), options); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(document.getId()) - .build(); - validateSuccess(readObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void timestamp(String documentId, boolean isNameBased) throws Exception { - Date before = new Date(); - Document docDefinition = getDocumentDefinition(documentId); - Thread.sleep(1000); - Document document = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false).toBlocking().single().getResource(); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(document.get("mypk"))); - Observable> readObservable = client.readDocument(getDocumentLink(document, isNameBased), options); - Document readDocument = readObservable.toBlocking().single().getResource(); - Thread.sleep(1000); - Date after = new Date(); - - assertThat(readDocument.getTimestamp()).isAfterOrEqualsTo(before); - assertThat(readDocument.getTimestamp()).isBeforeOrEqualsTo(after); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void readDocument_DoesntExist(String documentId, boolean isNameBased) { - Document docDefinition = getDocumentDefinition(documentId); - - Document document = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false).toBlocking().single().getResource(); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(document.get("mypk"))); - client.deleteDocument(getDocumentLink(document, isNameBased), options).toBlocking().first(); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - - options.setPartitionKey(new PartitionKey("looloo")); - Observable> readObservable = client.readDocument(getDocumentLink(document, isNameBased), options); - - FailureValidator validator = new FailureValidator.Builder().instanceOf(DocumentClientException.class) - .statusCode(404).build(); - validateFailure(readObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void deleteDocument(String documentId, boolean isNameBased) { - Document docDefinition = getDocumentDefinition(documentId); - - Document document = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false).toBlocking().single().getResource(); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(document.get("mypk"))); - Observable> deleteObservable = client.deleteDocument(getDocumentLink(document, isNameBased), options); - - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .nullResource().build(); - validateSuccess(deleteObservable, validator); - - // attempt to read document which was deleted - waitIfNeededForReplicasToCatchUp(clientBuilder); - - Observable> readObservable = client.readDocument(getDocumentLink(document, isNameBased), options); - FailureValidator notFoundValidator = new FailureValidator.Builder().resourceNotFound().build(); - validateFailure(readObservable, notFoundValidator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void deleteDocument_undefinedPK(String documentId, boolean isNameBased) { - Document docDefinition = new Document(); - docDefinition.setId(documentId); - - Document document = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false).toBlocking().single().getResource(); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(Undefined.Value())); - Observable> deleteObservable = client.deleteDocument(getDocumentLink(document, isNameBased), options); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .nullResource().build(); - validateSuccess(deleteObservable, validator); - - // attempt to read document which was deleted - waitIfNeededForReplicasToCatchUp(clientBuilder); - - Observable> readObservable = client.readDocument(getDocumentLink(document, isNameBased), options); - FailureValidator notFoundValidator = new FailureValidator.Builder().resourceNotFound().build(); - validateFailure(readObservable, notFoundValidator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void deleteDocument_DoesntExist(String documentId, boolean isNameBased) { - Document docDefinition = getDocumentDefinition(documentId); - - Document document = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false).toBlocking().single().getResource(); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(document.get("mypk"))); - client.deleteDocument(getDocumentLink(document, isNameBased), options).toBlocking().single(); - - // delete again - Observable> deleteObservable = client.deleteDocument(getDocumentLink(document, isNameBased), options); - - FailureValidator validator = new FailureValidator.Builder().resourceNotFound().build(); - validateFailure(deleteObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void replaceDocument(String documentId, boolean isNameBased) { - // create a document - Document docDefinition = getDocumentDefinition(documentId); - - Document document = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false).toBlocking().single().getResource(); - - String newPropValue = UUID.randomUUID().toString(); - document.set("newProp", newPropValue); - - // replace document - Observable> readObservable = client.replaceDocument(document, null); - - // validate - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withProperty("newProp", newPropValue).build(); - validateSuccess(readObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void replaceDocument_UsingDocumentLink(String documentId, boolean isNameBased) { - // create a document - Document docDefinition = getDocumentDefinition(documentId); - - Document document = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false).toBlocking().single().getResource(); - - String newPropValue = UUID.randomUUID().toString(); - document.set("newProp", newPropValue); - - // replace document - Observable> readObservable = client.replaceDocument(getDocumentLink(document, isNameBased), document, null); - - // validate - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withProperty("newProp", newPropValue).build(); - validateSuccess(readObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void upsertDocument_CreateDocument(String documentId, boolean isNameBased) { - // create a document - Document docDefinition = getDocumentDefinition(documentId); - - - // replace document - Observable> upsertObservable = client.upsertDocument(getCollectionLink(isNameBased), - docDefinition, null, false); - - // validate - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()).build(); - try { - validateSuccess(upsertObservable, validator); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "documentCrudArgProvider") - public void upsertDocument_ReplaceDocument(String documentId, boolean isNameBased) { - // create a document - Document docDefinition = getDocumentDefinition(documentId); - - Document document = client - .createDocument(getCollectionLink(isNameBased), docDefinition, null, false).toBlocking().single().getResource(); - - String newPropValue = UUID.randomUUID().toString(); - document.set("newProp", newPropValue); - - // replace document - Observable> readObservable = client.upsertDocument - (getCollectionLink(isNameBased), document, null, true); - - // validate - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withProperty("newProp", newPropValue).build(); - try { - validateSuccess(readObservable, validator); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - @BeforeMethod(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeMethod() { - safeClose(client); - client = clientBuilder.build(); - } - - private String getCollectionLink(boolean isNameBased) { - return isNameBased ? "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId() : createdCollection.getSelfLink(); - } - - private String getDocumentLink(Document doc, boolean isNameBased) { - return isNameBased ? "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId() + "/docs/" + doc.getId() : - "dbs/" + createdDatabase.getResourceId() + "/colls/" + createdCollection.getResourceId() + "/docs/" + doc.getResourceId(); - } - - private Document getDocumentDefinition(String documentId) { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , documentId, uuid)); - return doc; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/LogLevelTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/LogLevelTest.java deleted file mode 100644 index c2ace6ab6596..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/LogLevelTest.java +++ /dev/null @@ -1,308 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx; - -import java.io.StringWriter; -import java.lang.reflect.Method; -import java.util.UUID; - -import org.apache.log4j.Level; -import org.apache.log4j.LogManager; -import org.apache.log4j.Logger; -import org.apache.log4j.PatternLayout; -import org.apache.log4j.PropertyConfigurator; -import org.apache.log4j.WriterAppender; -import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - -import static org.assertj.core.api.Assertions.assertThat; - -public class LogLevelTest extends TestSuiteBase { - public final static String COSMOS_DB_LOGGING_CATEGORY = "com.microsoft.azure.cosmosdb"; - public final static String NETWORK_LOGGING_CATEGORY = "com.microsoft.azure.cosmosdb.netty-network"; - public final static String LOG_PATTERN_1 = "HTTP/1.1 200 Ok."; - public final static String LOG_PATTERN_2 = "| 0 1 2 3 4 5 6 7 8 9 a b c d e f |"; - public final static String LOG_PATTERN_3 = "USER_EVENT: SslHandshakeCompletionEvent(SUCCESS)"; - public final static String LOG_PATTERN_4 = "CONNECT: "; - - private static Database createdDatabase; - private static DocumentCollection createdCollection; - - public LogLevelTest() { - this.clientBuilder = createGatewayRxDocumentClient(); - } - - @BeforeClass(groups = {"simple"}, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - } - - /** - * This test will try to create document with netty wire DEBUG logging and validate it. - * - * @throws Exception - */ - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createDocumentWithDebugLevel() throws Exception { - LogManager.getLogger(NETWORK_LOGGING_CATEGORY).setLevel(Level.DEBUG); - StringWriter consoleWriter = new StringWriter(); - WriterAppender appender = new WriterAppender(new PatternLayout(), consoleWriter); - LogManager.getLogger(NETWORK_LOGGING_CATEGORY).addAppender(appender); - - AsyncDocumentClient client = clientBuilder.build(); - try { - Document docDefinition = getDocumentDefinition(); - Observable> createObservable = client - .createDocument(getCollectionLink(), docDefinition, null, false); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - validateSuccess(createObservable, validator); - - assertThat(consoleWriter.toString()).isEmpty(); - - } finally { - safeClose(client); - } - } - - /** - * This test will try to create document with netty wire WARN logging and validate it. - * - * @throws Exception - */ - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createDocumentWithWarningLevel() throws Exception { - LogManager.getRootLogger().setLevel(Level.INFO); - LogManager.getLogger(NETWORK_LOGGING_CATEGORY).setLevel(Level.WARN); - StringWriter consoleWriter = new StringWriter(); - WriterAppender appender = new WriterAppender(new PatternLayout(), consoleWriter); - Logger.getLogger(NETWORK_LOGGING_CATEGORY).addAppender(appender); - - AsyncDocumentClient client = clientBuilder.build(); - try { - Document docDefinition = getDocumentDefinition(); - Observable> createObservable = client - .createDocument(getCollectionLink(), docDefinition, null, false); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - validateSuccess(createObservable, validator); - - assertThat(consoleWriter.toString()).isEmpty(); - } finally { - safeClose(client); - } - } - - /** - * This test will try to create document with netty wire TRACE logging and validate it. - * - * @throws Exception - */ - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createDocumentWithTraceLevel() throws Exception { - LogManager.getRootLogger().setLevel(Level.INFO); - LogManager.getLogger(NETWORK_LOGGING_CATEGORY).setLevel(Level.TRACE); - StringWriter consoleWriter = new StringWriter(); - WriterAppender appender = new WriterAppender(new PatternLayout(), consoleWriter); - Logger.getLogger(NETWORK_LOGGING_CATEGORY).addAppender(appender); - - AsyncDocumentClient client = clientBuilder.build(); - try { - Document docDefinition = getDocumentDefinition(); - Observable> createObservable = client - .createDocument(getCollectionLink(), docDefinition, null, false); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - validateSuccess(createObservable, validator); - - assertThat(consoleWriter.toString()).contains(LOG_PATTERN_1); - assertThat(consoleWriter.toString()).contains(LOG_PATTERN_2); - assertThat(consoleWriter.toString()).contains(LOG_PATTERN_3); - assertThat(consoleWriter.toString()).contains(LOG_PATTERN_4); - - } finally { - safeClose(client); - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createDocumentWithTraceLevelAtRoot() throws Exception { - LogManager.getRootLogger().setLevel(Level.INFO); - LogManager.getLogger(COSMOS_DB_LOGGING_CATEGORY).setLevel(Level.TRACE); - StringWriter consoleWriter = new StringWriter(); - WriterAppender appender = new WriterAppender(new PatternLayout(), consoleWriter); - Logger.getLogger(NETWORK_LOGGING_CATEGORY).addAppender(appender); - - AsyncDocumentClient client = clientBuilder.build(); - try { - Document docDefinition = getDocumentDefinition(); - Observable> createObservable = client - .createDocument(getCollectionLink(), docDefinition, null, false); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - validateSuccess(createObservable, validator); - - assertThat(consoleWriter.toString()).contains(LOG_PATTERN_1); - assertThat(consoleWriter.toString()).contains(LOG_PATTERN_2); - assertThat(consoleWriter.toString()).contains(LOG_PATTERN_3); - assertThat(consoleWriter.toString()).contains(LOG_PATTERN_4); - } finally { - safeClose(client); - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createDocumentWithDebugLevelAtRoot() throws Exception { - LogManager.getRootLogger().setLevel(Level.INFO); - LogManager.getLogger(COSMOS_DB_LOGGING_CATEGORY).setLevel(Level.DEBUG); - StringWriter consoleWriter = new StringWriter(); - WriterAppender appender = new WriterAppender(new PatternLayout(), consoleWriter); - Logger.getLogger(NETWORK_LOGGING_CATEGORY).addAppender(appender); - - AsyncDocumentClient client = clientBuilder.build(); - try { - Document docDefinition = getDocumentDefinition(); - Observable> createObservable = client - .createDocument(getCollectionLink(), docDefinition, null, false); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - validateSuccess(createObservable, validator); - - assertThat(consoleWriter.toString()).isEmpty(); - } finally { - safeClose(client); - } - } - - /** - * This test will try to create document with netty wire ERROR logging and validate it. - * - * @throws Exception - */ - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createDocumentWithErrorClient() throws Exception { - LogManager.getRootLogger().setLevel(Level.INFO); - LogManager.getLogger(NETWORK_LOGGING_CATEGORY).setLevel(Level.ERROR); - StringWriter consoleWriter = new StringWriter(); - WriterAppender appender = new WriterAppender(new PatternLayout(), consoleWriter); - Logger.getLogger(NETWORK_LOGGING_CATEGORY).addAppender(appender); - - AsyncDocumentClient client = clientBuilder.build(); - try { - Document docDefinition = getDocumentDefinition(); - Observable> createObservable = client - .createDocument(getCollectionLink(), docDefinition, null, false); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - validateSuccess(createObservable, validator); - - assertThat(consoleWriter.toString()).isEmpty(); - } finally { - safeClose(client); - } - } - - /** - * This test will try to create document with netty wire INFO logging and validate it. - * - * @throws Exception - */ - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createDocumentWithInfoLevel() throws Exception { - LogManager.getRootLogger().setLevel(Level.INFO); - LogManager.getLogger(NETWORK_LOGGING_CATEGORY).setLevel(Level.INFO); - StringWriter consoleWriter = new StringWriter(); - WriterAppender appender = new WriterAppender(new PatternLayout(), consoleWriter); - Logger.getLogger(NETWORK_LOGGING_CATEGORY).addAppender(appender); - - AsyncDocumentClient client = clientBuilder.build(); - try { - Document docDefinition = getDocumentDefinition(); - Observable> createObservable = client - .createDocument(getCollectionLink(), docDefinition, null, false); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - validateSuccess(createObservable, validator); - - assertThat(consoleWriter.toString()).isEmpty(); - } finally { - safeClose(client); - } - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } - - @BeforeMethod(groups = { "simple"}) - public void beforeMethod(Method method) { - super.beforeMethod(method); - LogManager.resetConfiguration(); - PropertyConfigurator.configure(this.getClass().getClassLoader().getResource("log4j.properties")); - } - - @AfterMethod(groups = { "simple" }) - public void afterMethod() { - LogManager.resetConfiguration(); - PropertyConfigurator.configure(this.getClass().getClassLoader().getResource("log4j.properties")); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT) - public void afterClass() { - LogManager.resetConfiguration(); - PropertyConfigurator.configure(this.getClass().getClassLoader().getResource("log4j.properties")); - } - - private String getCollectionLink() { - return createdCollection.getSelfLink(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/MultiMasterConflictResolutionTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/MultiMasterConflictResolutionTest.java deleted file mode 100644 index 05ce9cee9b9f..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/MultiMasterConflictResolutionTest.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.BridgeUtils; -import com.microsoft.azure.cosmosdb.ConflictResolutionMode; -import com.microsoft.azure.cosmosdb.ConflictResolutionPolicy; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Observable; - -import javax.net.ssl.SSLException; -import java.util.UUID; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; - -// assumes multi master is enabled in endpoint -public class MultiMasterConflictResolutionTest extends TestSuiteBase { - private static final int TIMEOUT = 40000; - - private final String databaseId = DatabaseForTest.generateId(); - - private AsyncDocumentClient client; - private Database database; - - @Factory(dataProvider = "clientBuilders") - public MultiMasterConflictResolutionTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = "multi-master", timeOut = TIMEOUT) - public void conflictResolutionPolicyCRUD() { - - // default last writer wins, path _ts - DocumentCollection collection = new DocumentCollection(); - collection.setId(UUID.randomUUID().toString()); - collection = getResource(client.createCollection(getDatabaseLink(database), collection, null)); - - assertThat(collection.getConflictResolutionPolicy().getConflictResolutionMode()).isEqualTo(ConflictResolutionMode.LastWriterWins); - - // LWW without path specified, should default to _ts - collection.setConflictResolutionPolicy(ConflictResolutionPolicy.createLastWriterWinsPolicy()); - collection = getResource(client.replaceCollection(collection, null)); - - - assertThat(collection.getConflictResolutionPolicy().getConflictResolutionMode()).isEqualTo(ConflictResolutionMode.LastWriterWins); - assertThat(collection.getConflictResolutionPolicy().getConflictResolutionPath()).isEqualTo("/_ts"); - - // Tests the following scenarios - // 1. LWW with valid path - // 2. LWW with null path, should default to _ts - // 3. LWW with empty path, should default to _ts - testConflictResolutionPolicyRequiringPath(ConflictResolutionMode.LastWriterWins, - new String[] { "/a", null, "" }, new String[] { "/a", "/_ts", "/_ts" }); - - // LWW invalid path - collection.setConflictResolutionPolicy(ConflictResolutionPolicy.createLastWriterWinsPolicy("/a/b")); - - try { - collection = getResource(client.replaceCollection(collection, null)); - fail("Expected exception on invalid path."); - } catch (Exception e) { - - // when (e.StatusCode == HttpStatusCode.BadRequest) - DocumentClientException dce = com.microsoft.azure.cosmosdb.rx.internal.Utils.as(e.getCause(), DocumentClientException.class); - if (dce != null && dce.getStatusCode() == 400) { - assertThat(dce.getMessage()).contains("Invalid path '\\/a\\/b' for last writer wins conflict resolution"); - } else { - throw e; - } - } - - // LWW invalid path - - collection.setConflictResolutionPolicy(ConflictResolutionPolicy.createLastWriterWinsPolicy("someText")); - - try { - collection = getResource(client.replaceCollection(collection, null)); - fail("Expected exception on invalid path."); - } catch (Exception e) { - // when (e.StatusCode == HttpStatusCode.BadRequest) - DocumentClientException dce = com.microsoft.azure.cosmosdb.rx.internal.Utils.as(e.getCause(), DocumentClientException.class); - if (dce != null && dce.getStatusCode() == 400) { - assertThat(dce.getMessage()).contains("Invalid path 'someText' for last writer wins conflict resolution"); - } else { - throw e; - } - } - - // Tests the following scenarios - // 1. Custom with valid sprocLink - // 2. Custom with null sprocLink, should default to empty string - // 3. Custom with empty sprocLink, should default to empty string - testConflictResolutionPolicyRequiringPath(ConflictResolutionMode.Custom, - new String[] { "randomSprocName", null, "" }, new String[] { "randomSprocName", "", "" }); - } - - private void testConflictResolutionPolicyRequiringPath(ConflictResolutionMode conflictResolutionMode, - String[] paths, String[] expectedPaths) { - for (int i = 0; i < paths.length; i++) { - DocumentCollection collection = new DocumentCollection(); - collection.setId(UUID.randomUUID().toString()); - - if (conflictResolutionMode == ConflictResolutionMode.LastWriterWins) { - collection.setConflictResolutionPolicy(ConflictResolutionPolicy.createLastWriterWinsPolicy(paths[i])); - } else { - collection.setConflictResolutionPolicy(ConflictResolutionPolicy.createCustomPolicy(paths[i])); - } - collection = getResource(client.createCollection("dbs/" + database.getId(), collection, null)); - assertThat(collection.getConflictResolutionPolicy().getConflictResolutionMode()).isEqualTo(conflictResolutionMode); - - if (conflictResolutionMode == ConflictResolutionMode.LastWriterWins) { - assertThat(collection.getConflictResolutionPolicy().getConflictResolutionPath()).isEqualTo(expectedPaths[i]); - } else { - assertThat(collection.getConflictResolutionPolicy().getConflictResolutionProcedure()).isEqualTo(expectedPaths[i]); - } - } - } - - @Test(groups = "multi-master", timeOut = TIMEOUT) - public void invalidConflictResolutionPolicy_LastWriterWinsWithStoredProc() throws Exception { - DocumentCollection collection = new DocumentCollection(); - collection.setId(UUID.randomUUID().toString()); - - // LWW without path specified, should default to _ts - ConflictResolutionPolicy policy = BridgeUtils.createConflictResolutionPolicy(); - BridgeUtils.setMode(policy, ConflictResolutionMode.LastWriterWins); - BridgeUtils.setStoredProc(policy,"randomSprocName"); - collection.setConflictResolutionPolicy(policy); - - Observable> createObservable = client.createCollection( - getDatabaseLink(database), - collection, - null); - - FailureValidator validator = new FailureValidator.Builder() - .instanceOf(DocumentClientException.class) - .statusCode(400) - .errorMessageContains("LastWriterWins conflict resolution mode should not have conflict resolution procedure set.") - .build(); - validateFailure(createObservable, validator); - } - - @Test(groups = "multi-master", timeOut = TIMEOUT) - public void invalidConflictResolutionPolicy_CustomWithPath() throws Exception { - DocumentCollection collection = new DocumentCollection(); - collection.setId(UUID.randomUUID().toString()); - - // LWW without path specified, should default to _ts - ConflictResolutionPolicy policy = BridgeUtils.createConflictResolutionPolicy(); - BridgeUtils.setMode(policy, ConflictResolutionMode.Custom); - BridgeUtils.setPath(policy,"/mypath"); - collection.setConflictResolutionPolicy(policy); - - Observable> createObservable = client.createCollection( - getDatabaseLink(database), - collection, - null); - - FailureValidator validator = new FailureValidator.Builder() - .instanceOf(DocumentClientException.class) - .statusCode(400) - .errorMessageContains("Custom conflict resolution mode should not have conflict resolution path set.") - .build(); - validateFailure(createObservable, validator); - } - - @BeforeClass(groups = {"multi-master"}, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - // set up the client - - client = clientBuilder.build(); - database = createDatabase(client, databaseId); - } - - private T getResource(Observable> obs) { - return obs.toBlocking().single().getResource(); - } - - @AfterClass(groups = {"multi-master"}, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, database); - safeClose(client); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/MultiOrderByQueryTests.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/MultiOrderByQueryTests.java deleted file mode 100644 index 9734948d38e3..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/MultiOrderByQueryTests.java +++ /dev/null @@ -1,343 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; -import java.util.Random; -import java.util.UUID; - -import org.apache.commons.collections4.ComparatorUtils; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.microsoft.azure.cosmosdb.CompositePath; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.CompositePathSortOrder; -import com.microsoft.azure.cosmosdb.Document; - -public class MultiOrderByQueryTests extends TestSuiteBase { - - private static final int TIMEOUT = 35000; - private static final String NUMBER_FIELD = "numberField"; - private static final String STRING_FIELD = "stringField"; - private static final String NUMBER_FIELD_2 = "numberField2"; - private static final String STRING_FIELD_2 = "stringField2"; - private static final String BOOL_FIELD = "boolField"; - private static final String NULL_FIELD = "nullField"; - private static final String OBJECT_FIELD = "objectField"; - private static final String ARRAY_FIELD = "arrayField"; - private static final String SHORT_STRING_FIELD = "shortStringField"; - private static final String MEDIUM_STRING_FIELD = "mediumStringField"; - private static final String LONG_STRING_FIELD = "longStringField"; - private static final String PARTITION_KEY = "pk"; - private ArrayList documents = new ArrayList(); - private DocumentCollection documentCollection; - private Builder clientBuilder; - private AsyncDocumentClient client; - - class CustomComparator implements Comparator { - String path; - CompositePathSortOrder order; - boolean isNumericPath = false; - boolean isStringPath = false; - boolean isBooleanPath = false; - boolean isNullPath = false; - - public CustomComparator(String path, CompositePathSortOrder order) { - this.path = path; - this.order = order; - if (this.path.contains("number")) { - isNumericPath = true; - } else if (this.path.toLowerCase().contains("string")) { - isStringPath = true; - } else if (this.path.contains("bool")) { - isBooleanPath = true; - } else if (this.path.contains("null")) { - isNullPath = true; - } - } - - @Override - public int compare(Document doc1, Document doc2) { - boolean isAsc = order == CompositePathSortOrder.Ascending; - if (isNumericPath) { - if (doc1.getInt(path) < doc2.getInt(path)) - return isAsc ? -1 : 1; - else if (doc1.getInt(path) > doc2.getInt(path)) - return isAsc ? 1 : -1; - else - return 0; - } else if (isStringPath) { - if (!isAsc) { - Document temp = doc1; - doc1 = doc2; - doc2 = temp; - } - return doc1.getString(path).compareTo(doc2.getString(path)); - } else if (isBooleanPath) { - if (doc1.getBoolean(path) == false && doc2.getBoolean(path) == true) - return isAsc ? -1 : 1; - else if (doc1.getBoolean(path) == true && doc2.getBoolean(path) == false) - return isAsc ? 1 : -1; - else - return 0; - } else if (isNullPath) { - // all nulls are equal - return 0; - } else { - throw new IllegalStateException("data type not handled by comparator!"); - } - } - } - - @Factory(dataProvider = "clientBuilders") - public MultiOrderByQueryTests(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - documentCollection = SHARED_MULTI_PARTITION_COLLECTION_WITH_COMPOSITE_AND_SPATIAL_INDEXES; - truncateCollection(SHARED_MULTI_PARTITION_COLLECTION_WITH_COMPOSITE_AND_SPATIAL_INDEXES); - - int numberOfDocuments = 4; - - Random random = new Random(); - for (int i = 0; i < numberOfDocuments; ++i) { - Document multiOrderByDocument = generateMultiOrderByDocument(); - String multiOrderByDocumentString = multiOrderByDocument.toJson(); - int numberOfDuplicates = 5; - - for (int j = 0; j < numberOfDuplicates; j++) { - // Add the document itself for exact duplicates - Document initialDocument = new Document(multiOrderByDocumentString); - initialDocument.setId(UUID.randomUUID().toString()); - this.documents.add(initialDocument); - - // Permute all the fields so that there are duplicates with tie breaks - Document numberClone = new Document(multiOrderByDocumentString); - numberClone.set(NUMBER_FIELD, random.nextInt(5)); - numberClone.setId(UUID.randomUUID().toString()); - this.documents.add(numberClone); - - Document stringClone = new Document(multiOrderByDocumentString); - stringClone.set(STRING_FIELD, Integer.toString(random.nextInt(5))); - stringClone.setId(UUID.randomUUID().toString()); - this.documents.add(stringClone); - - Document boolClone = new Document(multiOrderByDocumentString); - boolClone.set(BOOL_FIELD, random.nextInt(2) % 2 == 0); - boolClone.setId(UUID.randomUUID().toString()); - this.documents.add(boolClone); - - // Also fuzz what partition it goes to - Document partitionClone = new Document(multiOrderByDocumentString); - partitionClone.set(PARTITION_KEY, random.nextInt(5)); - partitionClone.setId(UUID.randomUUID().toString()); - this.documents.add(partitionClone); - } - } - - bulkInsertBlocking(client, documentCollection.getSelfLink(), documents); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - private Document generateMultiOrderByDocument() { - Random random = new Random(); - Document document = new Document(); - document.setId(UUID.randomUUID().toString()); - document.set(NUMBER_FIELD, random.nextInt(5)); - document.set(NUMBER_FIELD_2, random.nextInt(5)); - document.set(BOOL_FIELD, (random.nextInt() % 2) == 0); - document.set(STRING_FIELD, Integer.toString(random.nextInt(5))); - document.set(STRING_FIELD_2, Integer.toString(random.nextInt(5))); - document.set(NULL_FIELD, null); - document.set(OBJECT_FIELD, ""); - document.set(ARRAY_FIELD, (new ObjectMapper()).createArrayNode()); - document.set(SHORT_STRING_FIELD, "a" + random.nextInt(100)); - document.set(MEDIUM_STRING_FIELD, "a" + random.nextInt(128) + 100); - document.set(LONG_STRING_FIELD, "a" + random.nextInt(255) + 128); - document.set(PARTITION_KEY, random.nextInt(5)); - return document; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryDocumentsWithMultiOrder() throws DocumentClientException, InterruptedException { - FeedOptions feedOptions = new FeedOptions(); - feedOptions.setEnableCrossPartitionQuery(true); - - boolean[] booleanValues = new boolean[] {true, false}; - Iterator> compositeIndexesIterator = documentCollection.getIndexingPolicy().getCompositeIndexes().iterator(); - while (compositeIndexesIterator.hasNext()) { - ArrayList compositeIndex = compositeIndexesIterator.next(); - // for every order - for (boolean invert : booleanValues) { - // for normal and inverted order - for (boolean hasTop : booleanValues) { - // with and without top - for (boolean hasFilter : booleanValues) { - // with and without filter - // Generate a multi order by from that index - List orderByItems = new ArrayList(); - List selectItems = new ArrayList(); - boolean isDesc; - Iterator compositeIndexiterator = compositeIndex.iterator(); - while (compositeIndexiterator.hasNext()) { - CompositePath compositePath = compositeIndexiterator.next(); - isDesc = compositePath.getOrder() == CompositePathSortOrder.Descending ? true : false; - if (invert) { - isDesc = !isDesc; - } - - String isDescString = isDesc ? "DESC" : "ASC"; - String compositePathName = compositePath.getPath().replaceAll("/", ""); - String orderByItemsString = "root." + compositePathName + " " + isDescString; - String selectItemsString = "root." + compositePathName; - orderByItems.add(orderByItemsString); - selectItems.add(selectItemsString); - } - - int topCount = 10; - StringBuilder selectItemStringBuilder = new StringBuilder(); - for (String selectItem: selectItems) { - selectItemStringBuilder.append(selectItem); - selectItemStringBuilder.append(","); - } - selectItemStringBuilder.deleteCharAt(selectItemStringBuilder.length() - 1); - StringBuilder orderByItemStringBuilder = new StringBuilder(); - for (String orderByItem : orderByItems) { - orderByItemStringBuilder.append(orderByItem); - orderByItemStringBuilder.append(","); - } - orderByItemStringBuilder.deleteCharAt(orderByItemStringBuilder.length() - 1); - - String topString = hasTop ? "TOP " + topCount : ""; - String whereString = hasFilter ? "WHERE root." + NUMBER_FIELD + " % 2 = 0" : ""; - String query = "SELECT " + topString + " [" + selectItemStringBuilder.toString() + "] " + - "FROM root " + whereString + " " + - "ORDER BY " + orderByItemStringBuilder.toString(); - - ArrayList expectedOrderedList = top(sort(filter(this.documents, hasFilter), compositeIndex, invert), hasTop, topCount) ; - - Observable> queryObservable = client - .queryDocuments(documentCollection.getSelfLink(), query, feedOptions); - - FeedResponseListValidator validator = new FeedResponseListValidator - .Builder() - .withOrderedResults(expectedOrderedList, compositeIndex) - .build(); - - validateQuerySuccess(queryObservable, validator); - } - } - } - } - - // Create document with numberField not set. - // This query would then be invalid. - Document documentWithEmptyField = generateMultiOrderByDocument(); - documentWithEmptyField.remove(NUMBER_FIELD); - client.createDocument(documentCollection.getSelfLink(), documentWithEmptyField, null, false).toBlocking().single(); - String query = "SELECT [root." + NUMBER_FIELD + ",root." + STRING_FIELD + "] FROM root ORDER BY root." + NUMBER_FIELD + " ASC ,root." + STRING_FIELD + " DESC"; - Observable> queryObservable = client - .queryDocuments(documentCollection.getSelfLink(), query, feedOptions); - - FailureValidator validator = new FailureValidator.Builder() - .instanceOf(UnsupportedOperationException.class) - .build(); - - validateQueryFailure(queryObservable, validator); - } - - private ArrayList top(ArrayList documents, boolean hasTop, int topCount) { - ArrayList result = new ArrayList(); - int counter = 0; - if (hasTop) { - while (counter < topCount && counter < documents.size()) { - result.add(documents.get(counter)); - counter++; - } - } else { - result.addAll(documents); - } - return result; - } - - private ArrayList sort(ArrayList documents, ArrayList compositeIndex, - boolean invert) { - Collection> comparators = new ArrayList>(); - Iterator compositeIndexIterator = compositeIndex.iterator(); - while (compositeIndexIterator.hasNext()) { - CompositePath compositePath = compositeIndexIterator.next(); - CompositePathSortOrder order = compositePath.getOrder(); - if (invert) { - if (order == CompositePathSortOrder.Descending) { - order = CompositePathSortOrder.Ascending; - } else { - order = CompositePathSortOrder.Descending; - } - } - String path = compositePath.getPath().replace("/", ""); - comparators.add(new CustomComparator(path, order)); - } - Collections.sort(documents, ComparatorUtils.chainedComparator(comparators)); - return documents; - } - - private ArrayList filter(ArrayList documents, boolean hasFilter) { - ArrayList result = new ArrayList(); - if (hasFilter) { - for (Document document : documents) { - if (document.getInt(NUMBER_FIELD) % 2 == 0) { - result.add(document); - } - } - } else { - result.addAll(documents); - } - return result; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/OfferQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/OfferQueryTest.java deleted file mode 100644 index 5554c8c1ee7a..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/OfferQueryTest.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.assertj.core.util.Strings; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Offer; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - -public class OfferQueryTest extends TestSuiteBase { - - public final static int SETUP_TIMEOUT = 40000; - public final String databaseId = DatabaseForTest.generateId(); - - private List createdCollections = new ArrayList<>(); - - private AsyncDocumentClient client; - - private String getDatabaseLink() { - return Utils.getDatabaseNameLink(databaseId); - } - - @Factory(dataProvider = "clientBuilders") - public OfferQueryTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void queryOffersWithFilter() throws Exception { - String collectionResourceId = createdCollections.get(0).getResourceId(); - String query = String.format("SELECT * from c where c.offerResourceId = '%s'", collectionResourceId); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - Observable> queryObservable = client.queryOffers(query, null); - - List allOffers = client.readOffers(null).flatMap(f -> Observable.from(f.getResults())).toList().toBlocking().single(); - List expectedOffers = allOffers.stream().filter(o -> collectionResourceId.equals(o.getString("offerResourceId"))).collect(Collectors.toList()); - - assertThat(expectedOffers).isNotEmpty(); - - int expectedPageSize = (expectedOffers.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedOffers.size()) - .exactlyContainsInAnyOrder(expectedOffers.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(queryObservable, validator, 10000); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT * 100) - public void queryOffersFilterMorePages() throws Exception { - - List collectionResourceIds = createdCollections.stream().map(c -> c.getResourceId()).collect(Collectors.toList()); - String query = String.format("SELECT * from c where c.offerResourceId in (%s)", - Strings.join(collectionResourceIds.stream().map(s -> "'" + s + "'").collect(Collectors.toList())).with(",")); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(1); - Observable> queryObservable = client.queryOffers(query, options); - - List expectedOffers = client.readOffers(null).flatMap(f -> Observable.from(f.getResults())).toList().toBlocking().single() - .stream().filter(o -> collectionResourceIds.contains(o.getOfferResourceId())) - .collect(Collectors.toList()); - - assertThat(expectedOffers).hasSize(createdCollections.size()); - - int expectedPageSize = (expectedOffers.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedOffers.size()) - .exactlyContainsInAnyOrder(expectedOffers.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(queryObservable, validator, 10000); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void queryCollections_NoResults() throws Exception { - - String query = "SELECT * from root r where r.id = '2'"; - FeedOptions options = new FeedOptions(); - Observable> queryObservable = client.queryCollections(getDatabaseLink(), query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(new ArrayList<>()) - .numberOfPages(1) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @BeforeClass(groups = { "emulator" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - - Database d1 = new Database(); - d1.setId(databaseId); - createDatabase(client, d1); - - for(int i = 0; i < 3; i++) { - DocumentCollection collection = new DocumentCollection(); - collection.setId(UUID.randomUUID().toString()); - createdCollections.add(createCollection(client, databaseId, collection)); - } - } - - @AfterClass(groups = { "emulator" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, databaseId); - safeClose(client); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/OfferReadReplaceTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/OfferReadReplaceTest.java deleted file mode 100644 index 6a5d9e9fdfd0..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/OfferReadReplaceTest.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.List; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.Offer; -import com.microsoft.azure.cosmosdb.ResourceResponse; - -import rx.Observable; - -import javax.net.ssl.SSLException; - -public class OfferReadReplaceTest extends TestSuiteBase { - - public final String databaseId = DatabaseForTest.generateId(); - - private Database createdDatabase; - private DocumentCollection createdCollection; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuilders") - public OfferReadReplaceTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void readAndReplaceOffer() { - - client.readOffers(null).toBlocking().subscribe((offersFeed) -> { - try { - int i; - List offers = offersFeed.getResults(); - for (i = 0; i < offers.size(); i++) { - if (offers.get(i).getOfferResourceId().equals(createdCollection.getResourceId())) { - break; - } - } - - Offer rOffer = client.readOffer(offers.get(i).getSelfLink()).toBlocking().single().getResource(); - int oldThroughput = rOffer.getThroughput(); - - Observable> readObservable = client.readOffer(offers.get(i).getSelfLink()); - - // validate offer read - ResourceResponseValidator validatorForRead = new ResourceResponseValidator.Builder() - .withOfferThroughput(oldThroughput) - .notNullEtag() - .build(); - - validateSuccess(readObservable, validatorForRead); - - // update offer - int newThroughput = oldThroughput + 100; - offers.get(i).setThroughput(newThroughput); - Observable> replaceObservable = client.replaceOffer(offers.get(i)); - - // validate offer replace - ResourceResponseValidator validatorForReplace = new ResourceResponseValidator.Builder() - .withOfferThroughput(newThroughput) - .notNullEtag() - .build(); - - validateSuccess(replaceObservable, validatorForReplace); - - } catch (Exception e) { - e.printStackTrace(); - } - - }); - } - - @BeforeClass(groups = { "emulator" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = createDatabase(client, databaseId); - createdCollection = createCollection(client, createdDatabase.getId(), - getCollectionDefinition()); - } - - @AfterClass(groups = { "emulator" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, createdDatabase); - safeClose(client); - } - -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/OrderbyDocumentQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/OrderbyDocumentQueryTest.java deleted file mode 100644 index cca649efba67..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/OrderbyDocumentQueryTest.java +++ /dev/null @@ -1,589 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.function.Function; -import java.util.stream.Collectors; - -import org.apache.commons.lang3.StringUtils; - -import com.fasterxml.jackson.core.JsonProcessingException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.internal.query.QueryItem; -import com.microsoft.azure.cosmosdb.internal.routing.Range; -import com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; -import com.microsoft.azure.cosmosdb.rx.internal.query.CompositeContinuationToken; -import com.microsoft.azure.cosmosdb.rx.internal.query.OrderByContinuationToken; - -import rx.Observable; -import rx.observers.TestSubscriber; - -public class OrderbyDocumentQueryTest extends TestSuiteBase { - private final double minQueryRequestChargePerPartition = 2.0; - - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdDocuments = new ArrayList<>(); - - private AsyncDocumentClient client; - - private int numberOfPartitions; - - @Factory(dataProvider = "clientBuildersWithDirect") - public OrderbyDocumentQueryTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "queryMetricsArgProvider") - public void queryDocumentsValidateContent(boolean qmEnabled) throws Exception { - Document expectedDocument = createdDocuments.get(0); - - String query = String.format("SELECT * from root r where r.propStr = '%s'" - + " ORDER BY r.propInt" - , expectedDocument.getString("propStr")); - - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - options.setPopulateQueryMetrics(qmEnabled); - - Observable> queryObservable = client.queryDocuments(getCollectionLink(), query, options); - - List expectedResourceIds = new ArrayList<>(); - expectedResourceIds.add(expectedDocument.getResourceId()); - - Map> resourceIDToValidator = new HashMap<>(); - - resourceIDToValidator.put(expectedDocument.getResourceId(), - new ResourceValidator.Builder().areEqual(expectedDocument).build()); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .numberOfPages(1) - .containsExactly(expectedResourceIds) - .validateAllResources(resourceIDToValidator) - .totalRequestChargeIsAtLeast(numberOfPartitions * minQueryRequestChargePerPartition) - .allPagesSatisfy(new FeedResponseValidator.Builder().hasRequestChargeHeader().build()) - .hasValidQueryMetrics(qmEnabled) - .build(); - - try { - validateQuerySuccess(queryObservable, validator); - } catch (Throwable error) { - // TODO: DANOBLE: report this detailed information in all failures produced by TestSuiteBase classes - // work item: https://msdata.visualstudio.com/CosmosDB/_workitems/edit/370015 - String message = String.format("%s %s mode with %s consistency test failure", - this.clientBuilder.connectionPolicy.getConnectionMode(), - this.clientBuilder.configs.getProtocol(), - this.clientBuilder.desiredConsistencyLevel); - throw new AssertionError(message, error); - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryDocuments_NoResults() throws Exception { - String query = "SELECT * from root r where r.id = '2' ORDER BY r.propInt"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(new ArrayList<>()) - .numberOfPages(1) - .totalRequestChargeIsAtLeast(numberOfPartitions * minQueryRequestChargePerPartition) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .hasRequestChargeHeader().build()) - .build(); - - validateQuerySuccess(queryObservable, validator); - } - - @DataProvider(name = "sortOrder") - public Object[][] sortOrder() { - return new Object[][] { { "ASC" }, {"DESC"} }; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "sortOrder") - public void queryOrderBy(String sortOrder) throws Exception { - String query = String.format("SELECT * FROM r ORDER BY r.propInt %s", sortOrder); - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - int pageSize = 3; - options.setMaxItemCount(pageSize); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - Comparator validatorComparator = Comparator.nullsFirst(Comparator.naturalOrder()); - - List expectedResourceIds = sortDocumentsAndCollectResourceIds("propInt", d -> d.getInt("propInt"), validatorComparator); - if ("DESC".equals(sortOrder)) { - Collections.reverse(expectedResourceIds); - } - - int expectedPageSize = expectedNumberOfPages(expectedResourceIds.size(), pageSize); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(expectedResourceIds) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .hasRequestChargeHeader().build()) - .totalRequestChargeIsAtLeast(numberOfPartitions * minQueryRequestChargePerPartition) - .build(); - - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryOrderByInt() throws Exception { - String query = "SELECT * FROM r ORDER BY r.propInt"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - int pageSize = 3; - options.setMaxItemCount(pageSize); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - Comparator validatorComparator = Comparator.nullsFirst(Comparator.naturalOrder()); - List expectedResourceIds = sortDocumentsAndCollectResourceIds("propInt", d -> d.getInt("propInt"), validatorComparator); - int expectedPageSize = expectedNumberOfPages(expectedResourceIds.size(), pageSize); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(expectedResourceIds) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .hasRequestChargeHeader().build()) - .totalRequestChargeIsAtLeast(numberOfPartitions * minQueryRequestChargePerPartition) - .build(); - - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryOrderByString() throws Exception { - String query = "SELECT * FROM r ORDER BY r.propStr"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - int pageSize = 3; - options.setMaxItemCount(pageSize); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - Comparator validatorComparator = Comparator.nullsFirst(Comparator.naturalOrder()); - List expectedResourceIds = sortDocumentsAndCollectResourceIds("propStr", d -> d.getString("propStr"), validatorComparator); - int expectedPageSize = expectedNumberOfPages(expectedResourceIds.size(), pageSize); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(expectedResourceIds) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .hasRequestChargeHeader().build()) - .totalRequestChargeIsAtLeast(numberOfPartitions * minQueryRequestChargePerPartition) - .build(); - - validateQuerySuccess(queryObservable, validator); - } - - @DataProvider(name = "topValue") - public Object[][] topValueParameter() { - return new Object[][] { { 0 }, { 1 }, { 5 }, { createdDocuments.size() - 1 }, { createdDocuments.size() }, - { createdDocuments.size() + 1 }, { 2 * createdDocuments.size() } }; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "topValue") - public void queryOrderWithTop(int topValue) throws Exception { - String query = String.format("SELECT TOP %d * FROM r ORDER BY r.propInt", topValue); - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - int pageSize = 3; - options.setMaxItemCount(pageSize); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - Comparator validatorComparator = Comparator.nullsFirst(Comparator.naturalOrder()); - - List expectedResourceIds = - sortDocumentsAndCollectResourceIds("propInt", d -> d.getInt("propInt"), validatorComparator) - .stream().limit(topValue).collect(Collectors.toList()); - - int expectedPageSize = expectedNumberOfPages(expectedResourceIds.size(), pageSize); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(expectedResourceIds) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .hasRequestChargeHeader().build()) - .totalRequestChargeIsAtLeast(numberOfPartitions * (topValue > 0 ? minQueryRequestChargePerPartition : 1)) - .build(); - - validateQuerySuccess(queryObservable, validator); - } - - private List sortDocumentsAndCollectResourceIds(String propName, Function extractProp, Comparator comparer) { - return createdDocuments.stream() - .filter(d -> d.getHashMap().containsKey(propName)) // removes undefined - .sorted((d1, d2) -> comparer.compare(extractProp.apply(d1), extractProp.apply(d2))) - .map(d -> d.getResourceId()).collect(Collectors.toList()); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void crossPartitionQueryNotEnabled() throws Exception { - String query = "SELECT * FROM r ORDER BY r.propInt"; - FeedOptions options = new FeedOptions(); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - FailureValidator validator = new FailureValidator.Builder() - .instanceOf(DocumentClientException.class) - .statusCode(400) - .build(); - validateQueryFailure(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryScopedToSinglePartition_StartWithContinuationToken() throws Exception { - String query = "SELECT * FROM r ORDER BY r.propScopedPartitionInt ASC"; - FeedOptions options = new FeedOptions(); - options.setPartitionKey(new PartitionKey("duplicateParitionKeyValue")); - options.setMaxItemCount(3); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - - TestSubscriber> subscriber = new TestSubscriber<>(); - queryObservable.first().subscribe(subscriber); - - subscriber.awaitTerminalEvent(); - subscriber.assertCompleted(); - subscriber.assertNoErrors(); - assertThat(subscriber.getValueCount()).isEqualTo(1); - FeedResponse page = subscriber.getOnNextEvents().get(0); - assertThat(page.getResults()).hasSize(3); - - assertThat(page.getResponseContinuation()).isNotEmpty(); - - - options.setRequestContinuation(page.getResponseContinuation()); - queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - - List expectedDocs = createdDocuments.stream() - .filter(d -> (StringUtils.equals("duplicateParitionKeyValue", d.getString("mypk")))) - .filter(d -> (d.getInt("propScopedPartitionInt") > 2)).collect(Collectors.toList()); - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - assertThat(expectedDocs).hasSize(10 - 3); - - FeedResponseListValidator validator = null; - - validator = new FeedResponseListValidator.Builder() - .containsExactly(expectedDocs.stream() - .sorted((e1, e2) -> Integer.compare(e1.getInt("propScopedPartitionInt"), e2.getInt("propScopedPartitionInt"))) - .map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void orderByContinuationTokenRoundTrip() throws Exception { - { - // Positive - OrderByContinuationToken orderByContinuationToken = new OrderByContinuationToken( - new CompositeContinuationToken( - "asdf", - new Range("A", "D", false, true)), - new QueryItem[] {new QueryItem("{\"item\" : 42}")}, - "rid", - false); - String serialized = orderByContinuationToken.toString(); - ValueHolder outOrderByContinuationToken = new ValueHolder(); - - assertThat(OrderByContinuationToken.tryParse(serialized, outOrderByContinuationToken)).isTrue(); - OrderByContinuationToken deserialized = outOrderByContinuationToken.v; - CompositeContinuationToken compositeContinuationToken = deserialized.getCompositeContinuationToken(); - String token = compositeContinuationToken.getToken(); - Range range = compositeContinuationToken.getRange(); - assertThat(token).isEqualTo("asdf"); - assertThat(range.getMin()).isEqualTo("A"); - assertThat(range.getMax()).isEqualTo("D"); - assertThat(range.isMinInclusive()).isEqualTo(false); - assertThat(range.isMaxInclusive()).isEqualTo(true); - - QueryItem[] orderByItems = deserialized.getOrderByItems(); - assertThat(orderByItems).isNotNull(); - assertThat(orderByItems.length).isEqualTo(1); - assertThat(orderByItems[0].getItem()).isEqualTo(42); - - String rid = deserialized.getRid(); - assertThat(rid).isEqualTo("rid"); - - boolean inclusive = deserialized.getInclusive(); - assertThat(inclusive).isEqualTo(false); - } - - { - // Negative - ValueHolder outOrderByContinuationToken = new ValueHolder(); - assertThat(OrderByContinuationToken.tryParse("{\"property\" : \"Not a valid Order By Token\"}", outOrderByContinuationToken)).isFalse(); - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT * 10, dataProvider = "sortOrder") - public void queryDocumentsWithOrderByContinuationTokensInteger(String sortOrder) throws Exception { - // Get Actual - String query = String.format("SELECT * FROM c ORDER BY c.propInt %s", sortOrder); - - // Get Expected - Comparator order = sortOrder.equals("ASC")?Comparator.naturalOrder():Comparator.reverseOrder(); - Comparator validatorComparator = Comparator.nullsFirst(order); - - List expectedResourceIds = sortDocumentsAndCollectResourceIds("propInt", d -> d.getInt("propInt"), validatorComparator); - this.queryWithContinuationTokensAndPageSizes(query, new int[] { 1, 5, 10, 100}, expectedResourceIds); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT * 10, dataProvider = "sortOrder") - public void queryDocumentsWithOrderByContinuationTokensString(String sortOrder) throws Exception { - // Get Actual - String query = String.format("SELECT * FROM c ORDER BY c.id %s", sortOrder); - - // Get Expected - Comparator order = sortOrder.equals("ASC")?Comparator.naturalOrder():Comparator.reverseOrder(); - Comparator validatorComparator = Comparator.nullsFirst(order); - - List expectedResourceIds = sortDocumentsAndCollectResourceIds("id", d -> d.getString("id"), validatorComparator); - this.queryWithContinuationTokensAndPageSizes(query, new int[] { 1, 5, 10, 100 }, expectedResourceIds); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT * 10, dataProvider = "sortOrder") - public void queryDocumentsWithInvalidOrderByContinuationTokensString(String sortOrder) throws Exception { - // Get Actual - String query = String.format("SELECT * FROM c ORDER BY c.id %s", sortOrder); - - // Get Expected - Comparator validatorComparator; - if(sortOrder.equals("ASC")) { - validatorComparator = Comparator.nullsFirst(Comparator.naturalOrder()); - }else{ - validatorComparator = Comparator.nullsFirst(Comparator.reverseOrder()); - } - List expectedResourceIds = sortDocumentsAndCollectResourceIds("id", d -> d.getString("id"), validatorComparator); - this.assertInvalidContinuationToken(query, new int[] { 1, 5, 10, 100 }, expectedResourceIds); - } - - public Document createDocument(AsyncDocumentClient client, Map keyValueProps) - throws DocumentClientException { - Document docDefinition = getDocumentDefinition(keyValueProps); - return client.createDocument(getCollectionLink(), docDefinition, null, false) - .toBlocking().single() - .getResource(); - } - - public List bulkInsert(AsyncDocumentClient client, List> keyValuePropsList) { - - ArrayList>> result = new ArrayList>>(); - - for(Map keyValueProps: keyValuePropsList) { - Document docDefinition = getDocumentDefinition(keyValueProps); - Observable> obs = client.createDocument(getCollectionLink(), docDefinition, null, false); - result.add(obs); - } - - return Observable.merge(result, 100). - map(resp -> resp.getResource()) - .toList().toBlocking().single(); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - truncateCollection(SHARED_MULTI_PARTITION_COLLECTION); - - List> keyValuePropsList = new ArrayList<>(); - Map props; - - for(int i = 0; i < 30; i++) { - props = new HashMap<>(); - props.put("propInt", i); - props.put("propStr", String.valueOf(i)); - keyValuePropsList.add(props); - } - - //undefined values - props = new HashMap<>(); - keyValuePropsList.add(props); - - createdDocuments = bulkInsert(client, keyValuePropsList); - - for(int i = 0; i < 10; i++) { - Map p = new HashMap<>(); - p.put("propScopedPartitionInt", i); - Document doc = getDocumentDefinition("duplicateParitionKeyValue", UUID.randomUUID().toString(), p); - createdDocuments.add(client.createDocument(getCollectionLink(), doc, null, false).toBlocking().single().getResource()); - - } - numberOfPartitions = client - .readPartitionKeyRanges(getCollectionLink(), null) - .flatMap(p -> Observable.from(p.getResults())).toList().toBlocking().single().size(); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private void assertInvalidContinuationToken(String query, int[] pageSize, List expectedIds) { - String requestContinuation = null; - do { - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(1); - options.setEnableCrossPartitionQuery(true); - options.setMaxDegreeOfParallelism(2); - OrderByContinuationToken orderByContinuationToken = new OrderByContinuationToken( - new CompositeContinuationToken( - "asdf", - new Range("A", "D", false, true)), - new QueryItem[] {new QueryItem("{\"item\" : 42}")}, - "rid", - false); - options.setRequestContinuation(orderByContinuationToken.toString()); - Observable> queryObservable = client.queryDocuments(getCollectionLink(), query, - options); - - Observable> firstPageObservable = queryObservable.first(); - TestSubscriber> testSubscriber = new VerboseTestSubscriber<>(); - firstPageObservable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(TIMEOUT, TimeUnit.MILLISECONDS); - testSubscriber.assertError(DocumentClientException.class); - } while (requestContinuation != null); - } - - private void queryWithContinuationTokensAndPageSizes(String query, int[] pageSizes, List expectedIds) { - for (int pageSize : pageSizes) { - List receivedDocuments = this.queryWithContinuationTokens(query, pageSize); - List actualIds = new ArrayList(); - for (Document document : receivedDocuments) { - actualIds.add(document.getResourceId()); - } - - assertThat(actualIds).containsExactlyElementsOf(expectedIds); - } - } - - private List queryWithContinuationTokens(String query, int pageSize) { - String requestContinuation = null; - List continuationTokens = new ArrayList(); - List receivedDocuments = new ArrayList(); - do { - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(pageSize); - options.setEnableCrossPartitionQuery(true); - options.setMaxDegreeOfParallelism(2); - options.setRequestContinuation(requestContinuation); - Observable> queryObservable = client.queryDocuments(getCollectionLink(), query, - options); - - Observable> firstPageObservable = queryObservable.first(); - TestSubscriber> testSubscriber = new VerboseTestSubscriber<>(); - firstPageObservable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(TIMEOUT, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - - FeedResponse firstPage = testSubscriber.getOnNextEvents().get(0); - requestContinuation = firstPage.getResponseContinuation(); - receivedDocuments.addAll(firstPage.getResults()); - continuationTokens.add(requestContinuation); - } while (requestContinuation != null); - - return receivedDocuments; - } - - private static Document getDocumentDefinition(String partitionKey, String id, Map keyValuePair) { - StringBuilder sb = new StringBuilder(); - sb.append("{\n"); - - for(String key: keyValuePair.keySet()) { - Object val = keyValuePair.get(key); - sb.append(" "); - sb.append("\"").append(key).append("\"").append(" :" ); - if (val == null) { - sb.append("null"); - } else { - sb.append(toJson(val)); - } - sb.append(",\n"); - } - - sb.append(String.format(" \"id\": \"%s\",\n", id)); - sb.append(String.format(" \"mypk\": \"%s\"\n", partitionKey)); - sb.append("}"); - - return new Document(sb.toString()); - } - - private static Document getDocumentDefinition(Map keyValuePair) { - String uuid = UUID.randomUUID().toString(); - return getDocumentDefinition(uuid, uuid, keyValuePair); - } - - public String getCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId()); - } - - private static String toJson(Object object){ - try { - return com.microsoft.azure.cosmosdb.internal.Utils.getSimpleObjectMapper().writeValueAsString(object); - } catch (JsonProcessingException e) { - throw new IllegalStateException(e); - } - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ParallelDocumentQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ParallelDocumentQueryTest.java deleted file mode 100644 index 14aacf69af53..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ParallelDocumentQueryTest.java +++ /dev/null @@ -1,438 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.QueryMetrics; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; - -import org.testng.SkipException; -import org.testng.annotations.DataProvider; -import com.microsoft.azure.cosmosdb.internal.routing.Range; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; -import com.microsoft.azure.cosmosdb.rx.internal.query.CompositeContinuationToken; - -import rx.Observable; -import rx.observers.TestSubscriber; - -import java.util.Map; - -public class ParallelDocumentQueryTest extends TestSuiteBase { - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdDocuments; - - private AsyncDocumentClient client; - - public String getCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId()); - } - - @Factory(dataProvider = "clientBuildersWithDirect") - public ParallelDocumentQueryTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @DataProvider(name = "queryMetricsArgProvider") - public Object[][] queryMetricsArgProvider() { - return new Object[][]{ - {true}, - {false}, - }; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "queryMetricsArgProvider") - public void queryDocuments(boolean qmEnabled) { - String query = "SELECT * from c where c.prop = 99"; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(5); - options.setEnableCrossPartitionQuery(true); - options.setPopulateQueryMetrics(qmEnabled); - options.setMaxDegreeOfParallelism(2); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - List expectedDocs = createdDocuments.stream().filter(d -> 99 == d.getInt("prop") ).collect(Collectors.toList()); - assertThat(expectedDocs).isNotEmpty(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedDocs.size()) - .exactlyContainsInAnyOrder(expectedDocs.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .hasValidQueryMetrics(qmEnabled) - .build(); - - try { - validateQuerySuccess(queryObservable, validator, TIMEOUT); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format(String.format("Direct TCP test failure: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel)); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryMetricEquality() throws Exception { - String query = "SELECT * from c where c.prop = 99"; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(5); - options.setEnableCrossPartitionQuery(true); - options.setPopulateQueryMetrics(true); - options.setMaxDegreeOfParallelism(0); - - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - List> resultList1 = queryObservable.toList().toBlocking().single(); - - options.setMaxDegreeOfParallelism(4); - Observable> threadedQueryObs = client.queryDocuments(getCollectionLink(), query, - options); - List> resultList2 = threadedQueryObs.toList().toBlocking().single(); - - assertThat(resultList1.size()).isEqualTo(resultList2.size()); - for(int i = 0; i < resultList1.size(); i++){ - compareQueryMetrics(resultList1.get(i).getQueryMetrics(), resultList2.get(i).getQueryMetrics()); - } - } - - private void compareQueryMetrics(Map qm1, Map qm2) { - assertThat(qm1.keySet().size()).isEqualTo(qm2.keySet().size()); - QueryMetrics queryMetrics1 = BridgeInternal.createQueryMetricsFromCollection(qm1.values()); - QueryMetrics queryMetrics2 = BridgeInternal.createQueryMetricsFromCollection(qm2.values()); - assertThat(queryMetrics1.getRetrievedDocumentSize()).isEqualTo(queryMetrics2.getRetrievedDocumentSize()); - assertThat(queryMetrics1.getRetrievedDocumentCount()).isEqualTo(queryMetrics2.getRetrievedDocumentCount()); - assertThat(queryMetrics1.getIndexHitDocumentCount()).isEqualTo(queryMetrics2.getIndexHitDocumentCount()); - assertThat(queryMetrics1.getOutputDocumentCount()).isEqualTo(queryMetrics2.getOutputDocumentCount()); - assertThat(queryMetrics1.getOutputDocumentSize()).isEqualTo(queryMetrics2.getOutputDocumentSize()); - assertThat(BridgeInternal.getClientSideMetrics(queryMetrics1).getRequestCharge()) - .isEqualTo(BridgeInternal.getClientSideMetrics(queryMetrics1).getRequestCharge()); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryDocuments_NoResults() { - String query = "SELECT * from root r where r.id = '2'"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(new ArrayList<>()) - .numberOfPagesIsGreaterThanOrEqualTo(1) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .pageSizeIsLessThanOrEqualTo(0) - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - // TODO: DANOBLE: Investigate Direct TCP performance issue - // See: https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028 - - @Test(groups = { "simple" }, timeOut = 2 * TIMEOUT) - public void queryDocumentsWithPageSize() { - String query = "SELECT * from root"; - FeedOptions options = new FeedOptions(); - int pageSize = 3; - options.setMaxItemCount(pageSize); - options.setMaxDegreeOfParallelism(-1); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - List expectedDocs = createdDocuments; - assertThat(expectedDocs).isNotEmpty(); - - FeedResponseListValidator validator = new FeedResponseListValidator - .Builder() - .exactlyContainsInAnyOrder(expectedDocs - .stream() - .map(d -> d.getResourceId()) - .collect(Collectors.toList())) - .numberOfPagesIsGreaterThanOrEqualTo((expectedDocs.size() + 1) / 3) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0) - .pageSizeIsLessThanOrEqualTo(pageSize) - .build()) - .build(); - try { - validateQuerySuccess(queryObservable, validator, 2 * subscriberValidationTimeout); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void invalidQuerySyntax() { - String query = "I am an invalid query"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - FailureValidator validator = new FailureValidator.Builder() - .instanceOf(DocumentClientException.class) - .statusCode(400) - .notNullActivityId() - .build(); - validateQueryFailure(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void crossPartitionQueryNotEnabled() { - String query = "SELECT * from root"; - FeedOptions options = new FeedOptions(); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - FailureValidator validator = new FailureValidator.Builder() - .instanceOf(DocumentClientException.class) - .statusCode(400) - .build(); - validateQueryFailure(queryObservable, validator); - } - - // TODO: DANOBLE: Investigate Direct TCP performance issue - // Links: - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028 - - @Test(groups = { "simple" }, timeOut = 2 * TIMEOUT) - public void partitionKeyRangeId() { - int sum = 0; - try { - for (String partitionKeyRangeId : client.readPartitionKeyRanges(getCollectionLink(), null) - .flatMap(p -> Observable.from(p.getResults())) - .map(pkr -> pkr.getId()).toList().toBlocking().single()) { - String query = "SELECT * from root"; - FeedOptions options = new FeedOptions(); - options.setPartitionKeyRangeIdInternal(partitionKeyRangeId); - int queryResultCount = client - .queryDocuments(getCollectionLink(), query, options) - .flatMap(p -> Observable.from(p.getResults())) - .toList().toBlocking().single().size(); - - sum += queryResultCount; - } - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - - assertThat(sum).isEqualTo(createdDocuments.size()); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void compositeContinuationTokenRoundTrip() throws Exception { - { - // Positive - CompositeContinuationToken compositeContinuationToken = new CompositeContinuationToken("asdf", - new Range("A", "D", false, true)); - String serialized = compositeContinuationToken.toString(); - ValueHolder outCompositeContinuationToken = new ValueHolder(); - boolean succeeed = CompositeContinuationToken.tryParse(serialized, outCompositeContinuationToken); - assertThat(succeeed).isTrue(); - CompositeContinuationToken deserialized = outCompositeContinuationToken.v; - String token = deserialized.getToken(); - Range range = deserialized.getRange(); - assertThat(token).isEqualTo("asdf"); - assertThat(range.getMin()).isEqualTo("A"); - assertThat(range.getMax()).isEqualTo("D"); - assertThat(range.isMinInclusive()).isEqualTo(false); - assertThat(range.isMaxInclusive()).isEqualTo(true); - } - - { - // Negative - ValueHolder outCompositeContinuationToken = new ValueHolder(); - boolean succeeed = CompositeContinuationToken.tryParse("{\"property\" : \"not a valid composite continuation token\"}", outCompositeContinuationToken); - assertThat(succeeed).isFalse(); - } - - { - // Negative - Gateway composite continuation token - ValueHolder outCompositeContinuationToken = new ValueHolder(); - boolean succeeed = CompositeContinuationToken.tryParse("{\"token\":\"-RID:tZFQAImzNLQLAAAAAAAAAA==#RT:1#TRC:10\",\"range\":{\"min\":\"\",\"max\":\"FF\"}}", outCompositeContinuationToken); - assertThat(succeeed).isFalse(); - } - } - - // TODO: This test has been timing out on build, related work item - https://msdata.visualstudio.com/CosmosDB/_workitems/edit/402438/ - @Test(groups = { "non-emulator" }, timeOut = TIMEOUT * 10) - public void queryDocumentsWithCompositeContinuationTokens() throws Exception { - String query = "SELECT * FROM c"; - - // Get Expected - List expectedDocs = createdDocuments - .stream() - .collect(Collectors.toList()); - assertThat(expectedDocs).isNotEmpty(); - - this.queryWithContinuationTokensAndPageSizes(query, new int[] {1, 10, 100}, expectedDocs); - } - - // TODO: DANOBLE: Investigate Direct TCP performance issue - // Links: - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028 - // Notes: - // When I've watch this method execute in the debugger and seen that the code sometimes pauses for quite a while in - // the middle of the second group of 21 documents. I test against a debug instance of the public emulator and so - // what I'm seeing could be the result of a public emulator performance issue. Of course, it might also be the - // result of a Tcp protocol performance problem. - - @BeforeClass(groups = { "simple", "non-emulator" }, timeOut = 2 * SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - truncateCollection(SHARED_MULTI_PARTITION_COLLECTION); - List docDefList = new ArrayList<>(); - for(int i = 0; i < 13; i++) { - docDefList.add(getDocumentDefinition(i)); - } - - for(int i = 0; i < 21; i++) { - docDefList.add(getDocumentDefinition(99)); - } - - createdDocuments = bulkInsertBlocking(client, getCollectionLink(), docDefList); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple", "non-emulator" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private static Document getDocumentDefinition(int cnt) { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"prop\" : %d, " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, cnt, uuid)); - return doc; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, enabled = false) - public void invalidQuerySytax() throws Exception { - - String query = "I am an invalid query"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client.queryDocuments(getCollectionLink(), query, options); - - FailureValidator validator = new FailureValidator.Builder().instanceOf(DocumentClientException.class) - .statusCode(400).notNullActivityId().build(); - validateQueryFailure(queryObservable, validator); - } - - public Document createDocument(AsyncDocumentClient client, int cnt) throws DocumentClientException { - - Document docDefinition = getDocumentDefinition(cnt); - - return client.createDocument(getCollectionLink(), docDefinition, null, false).toBlocking().single() - .getResource(); - } - - private void queryWithContinuationTokensAndPageSizes(String query, int[] pageSizes, List expectedDocs) { - for (int pageSize : pageSizes) { - List receivedDocuments = this.queryWithContinuationTokens(query, pageSize); - List actualIds = new ArrayList(); - for (Document document : receivedDocuments) { - actualIds.add(document.getResourceId()); - } - - List expectedIds = new ArrayList(); - for (Document document : expectedDocs) { - expectedIds.add(document.getResourceId()); - } - - assertThat(actualIds).containsOnlyElementsOf(expectedIds); - } - } - - private List queryWithContinuationTokens(String query, int pageSize) { - String requestContinuation = null; - List continuationTokens = new ArrayList(); - List receivedDocuments = new ArrayList(); - do { - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(pageSize); - options.setEnableCrossPartitionQuery(true); - options.setMaxDegreeOfParallelism(2); - options.setRequestContinuation(requestContinuation); - Observable> queryObservable = client.queryDocuments(getCollectionLink(), query, - options); - - Observable> firstPageObservable = queryObservable.first(); - TestSubscriber> testSubscriber = new TestSubscriber<>(); - firstPageObservable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(TIMEOUT, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - - FeedResponse firstPage = testSubscriber.getOnNextEvents().get(0); - requestContinuation = firstPage.getResponseContinuation(); - receivedDocuments.addAll(firstPage.getResults()); - continuationTokens.add(requestContinuation); - } while (requestContinuation != null); - - return receivedDocuments; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/PermissionCrudTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/PermissionCrudTest.java deleted file mode 100644 index 45c5132499c7..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/PermissionCrudTest.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.Document; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Permission; -import com.microsoft.azure.cosmosdb.PermissionMode; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.User; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; - -import rx.Observable; - -import javax.net.ssl.SSLException; - -public class PermissionCrudTest extends TestSuiteBase { - - private Database createdDatabase; - private User createdUser; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuilders") - public PermissionCrudTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createPermission() throws Exception { - - createdUser = safeCreateUser(client, createdDatabase.getId(), getUserDefinition()); - //create permission - Permission permission = new Permission(); - permission.setId(UUID.randomUUID().toString()); - permission.setPermissionMode(PermissionMode.Read); - permission.setResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgTc="); - - - Observable> createObservable = client.createPermission(getUserLink(), permission, null); - - // validate permission creation - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(permission.getId()) - .withPermissionMode(PermissionMode.Read) - .withPermissionResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgTc=") - .notNullEtag() - .build(); - validateSuccess(createObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void readPermission() throws Exception { - createdUser = safeCreateUser(client, createdDatabase.getId(), getUserDefinition()); - - // create permission - Permission permission = new Permission(); - permission.setId(UUID.randomUUID().toString()); - permission.setPermissionMode(PermissionMode.Read); - permission.setResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgTc="); - Permission readBackPermission = client.createPermission(getUserLink(), permission, null).toBlocking().single().getResource(); - - // read Permission - Observable> readObservable = client.readPermission(readBackPermission.getSelfLink(), null); - - // validate permission read - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(permission.getId()) - .withPermissionMode(PermissionMode.Read) - .withPermissionResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgTc=") - .notNullEtag() - .build(); - validateSuccess(readObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void deletePermission() throws Exception { - - createdUser = safeCreateUser(client, createdDatabase.getId(), getUserDefinition()); - - // create permission - Permission permission = new Permission(); - permission.setId(UUID.randomUUID().toString()); - permission.setPermissionMode(PermissionMode.Read); - permission.setResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgTc="); - Permission readBackPermission = client.createPermission(getUserLink(), permission, null).toBlocking().single().getResource(); - - // delete - Observable> deleteObservable = client.deletePermission(readBackPermission.getSelfLink(), null); - - // validate delete permission - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .nullResource() - .build(); - validateSuccess(deleteObservable, validator); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - - // attempt to read the permission which was deleted - Observable> readObservable = client.readPermission(readBackPermission.getSelfLink(), null); - FailureValidator notFoundValidator = new FailureValidator.Builder().resourceNotFound().build(); - validateFailure(readObservable, notFoundValidator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void upsertPermission() throws Exception { - - createdUser = safeCreateUser(client, createdDatabase.getId(), getUserDefinition()); - - // create permission - Permission permission = new Permission(); - permission.setId(UUID.randomUUID().toString()); - permission.setPermissionMode(PermissionMode.Read); - permission.setResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgTc="); - Permission readBackPermission = client.upsertPermission(getUserLink(), permission, null).toBlocking().single().getResource(); - - // read Permission - Observable> readObservable = client.readPermission(readBackPermission.getSelfLink(), null); - - // validate permission creation - ResourceResponseValidator validatorForRead = new ResourceResponseValidator.Builder() - .withId(readBackPermission.getId()) - .withPermissionMode(PermissionMode.Read) - .withPermissionResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgTc=") - .notNullEtag() - .build(); - validateSuccess(readObservable, validatorForRead); - - //update permission - readBackPermission.setPermissionMode(PermissionMode.All); - - Observable> updateObservable = client.upsertPermission(getUserLink(), readBackPermission, null); - - // validate permission update - ResourceResponseValidator validatorForUpdate = new ResourceResponseValidator.Builder() - .withId(readBackPermission.getId()) - .withPermissionMode(PermissionMode.All) - .withPermissionResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgTc=") - .notNullEtag() - .build(); - validateSuccess(updateObservable, validatorForUpdate); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void replacePermission() throws Exception { - - createdUser = safeCreateUser(client, createdDatabase.getId(), getUserDefinition()); - - // create permission - Permission permission = new Permission(); - permission.setId(UUID.randomUUID().toString()); - permission.setPermissionMode(PermissionMode.Read); - permission.setResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgTc="); - Permission readBackPermission = client.createPermission(getUserLink(), permission, null).toBlocking().single().getResource(); - - // read Permission - Observable> readObservable = client.readPermission(readBackPermission.getSelfLink(), null); - - // validate permission creation - ResourceResponseValidator validatorForRead = new ResourceResponseValidator.Builder() - .withId(readBackPermission.getId()) - .withPermissionMode(PermissionMode.Read) - .withPermissionResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgTc=") - .notNullEtag() - .build(); - validateSuccess(readObservable, validatorForRead); - - //update permission - readBackPermission.setPermissionMode(PermissionMode.All); - - Observable> updateObservable = client.replacePermission(readBackPermission, null); - - // validate permission replace - ResourceResponseValidator validatorForUpdate = new ResourceResponseValidator.Builder() - .withId(readBackPermission.getId()) - .withPermissionMode(PermissionMode.All) - .withPermissionResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgTc=") - .notNullEtag() - .build(); - validateSuccess(updateObservable, validatorForUpdate); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private static User getUserDefinition() { - User user = new User(); - user.setId(UUID.randomUUID().toString()); - return user; - } - - private String getUserLink() { - return createdUser.getSelfLink(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/PermissionQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/PermissionQueryTest.java deleted file mode 100644 index f53e7da02ede..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/PermissionQueryTest.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Permission; -import com.microsoft.azure.cosmosdb.PermissionMode; -import com.microsoft.azure.cosmosdb.User; - -import rx.Observable; - -import javax.net.ssl.SSLException; - -public class PermissionQueryTest extends TestSuiteBase { - - public final String databaseId = DatabaseForTest.generateId(); - - private Database createdDatabase; - private User createdUser; - private List createdPermissions = new ArrayList<>(); - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuilders") - public PermissionQueryTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryWithFilter() throws Exception { - - String filterId = createdPermissions.get(0).getId(); - String query = String.format("SELECT * from c where c.id = '%s'", filterId); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(5); - Observable> queryObservable = client - .queryPermissions(getUserLink(), query, options); - - List expectedDocs = createdPermissions.stream().filter(sp -> filterId.equals(sp.getId()) ).collect(Collectors.toList()); - assertThat(expectedDocs).isNotEmpty(); - - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedDocs.size()) - .exactlyContainsInAnyOrder(expectedDocs.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator, TIMEOUT); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void query_NoResults() throws Exception { - - String query = "SELECT * from root r where r.id = '2'"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryPermissions(getUserLink(), query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(new ArrayList<>()) - .numberOfPages(1) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryAll() throws Exception { - - String query = "SELECT * from root"; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(3); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryPermissions(getUserLink(), query, options); - - int expectedPageSize = (createdPermissions.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator - .Builder() - .exactlyContainsInAnyOrder(createdPermissions - .stream() - .map(d -> d.getResourceId()) - .collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void invalidQuerySytax() throws Exception { - String query = "I am an invalid query"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryPermissions(getUserLink(), query, options); - - FailureValidator validator = new FailureValidator.Builder() - .instanceOf(DocumentClientException.class) - .statusCode(400) - .notNullActivityId() - .build(); - validateQueryFailure(queryObservable, validator); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - Database d = new Database(); - d.setId(databaseId); - createdDatabase = createDatabase(client, d); - createdUser = safeCreateUser(client, createdDatabase.getId(), getUserDefinition()); - - for(int i = 0; i < 5; i++) { - createdPermissions.add(createPermissions(client, i)); - } - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, createdDatabase); - safeClose(client); - } - - private static User getUserDefinition() { - User user = new User(); - user.setId(UUID.randomUUID().toString()); - return user; - } - - public Permission createPermissions(AsyncDocumentClient client, int index) { - DocumentCollection collection = new DocumentCollection(); - collection.setId(UUID.randomUUID().toString()); - - Permission permission = new Permission(); - permission.setId(UUID.randomUUID().toString()); - permission.setPermissionMode(PermissionMode.Read); - permission.setResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgT" + Integer.toString(index) + "="); - - return client.createPermission(getUserLink(), permission, null).toBlocking().single().getResource(); - } - - private String getUserLink() { - return "dbs/" + getDatabaseId() + "/users/" + getUserId(); - } - - private String getDatabaseId() { - return createdDatabase.getId(); - } - - private String getUserId() { - return createdUser.getId(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ProxyHostTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ProxyHostTest.java deleted file mode 100644 index f982df926d24..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ProxyHostTest.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.io.StringWriter; -import java.lang.reflect.Method; -import java.util.UUID; -import java.util.concurrent.TimeUnit; - -import org.apache.log4j.Level; -import org.apache.log4j.LogManager; -import org.apache.log4j.Logger; -import org.apache.log4j.PatternLayout; -import org.apache.log4j.PropertyConfigurator; -import org.apache.log4j.WriterAppender; -import org.testng.Assert; -import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.rx.proxy.HttpProxyServer; - -import io.netty.handler.logging.LogLevel; -import io.netty.handler.logging.LoggingHandler; - -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * This class help to test proxy host feature scenarios where user can provide proxy - * host server during AsyncDocumentClient initialization and all its request will - * go through that particular host. - * - */ -public class ProxyHostTest extends TestSuiteBase { - - private static Database createdDatabase; - private static DocumentCollection createdCollection; - - private AsyncDocumentClient client; - private final String PROXY_HOST = "localhost"; - private final int PROXY_PORT = 8080; - private HttpProxyServer httpProxyServer; - - public ProxyHostTest() { - this.clientBuilder = createGatewayRxDocumentClient(); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION; - httpProxyServer = new HttpProxyServer(); - httpProxyServer.start(); - // wait for proxy server to be ready - TimeUnit.SECONDS.sleep(1); - } - - /** - * This test will try to create document via http proxy server and validate it. - * - * @throws Exception - */ - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createDocumentWithValidHttpProxy() throws Exception { - AsyncDocumentClient clientWithRightProxy = null; - try { - ConnectionPolicy connectionPolicy =new ConnectionPolicy(); - connectionPolicy.setProxy(PROXY_HOST, PROXY_PORT); - clientWithRightProxy = new Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session).build(); - Document docDefinition = getDocumentDefinition(); - Observable> createObservable = clientWithRightProxy - .createDocument(getCollectionLink(), docDefinition, null, false); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - validateSuccess(createObservable, validator); - } finally { - safeClose(clientWithRightProxy); - } - } - - /** - * This test will try to create document via http proxy server with netty wire logging and validate it. - * - * @throws Exception - */ - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createDocumentWithValidHttpProxyWithNettyWireLogging() throws Exception { - LogManager.getRootLogger().setLevel(Level.INFO); - LogManager.getLogger(LogLevelTest.NETWORK_LOGGING_CATEGORY).setLevel(Level.TRACE); - AsyncDocumentClient clientWithRightProxy = null; - try { - StringWriter consoleWriter = new StringWriter(); - WriterAppender appender = new WriterAppender(new PatternLayout(), consoleWriter); - Logger.getLogger(LogLevelTest.NETWORK_LOGGING_CATEGORY).addAppender(appender); - - ConnectionPolicy connectionPolicy =new ConnectionPolicy(); - connectionPolicy.setProxy(PROXY_HOST, PROXY_PORT); - clientWithRightProxy = new Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session).build(); - Document docDefinition = getDocumentDefinition(); - Observable> createObservable = clientWithRightProxy - .createDocument(getCollectionLink(), docDefinition, null, false); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - validateSuccess(createObservable, validator); - - assertThat(consoleWriter.toString()).contains(LogLevelTest.LOG_PATTERN_1); - assertThat(consoleWriter.toString()).contains(LogLevelTest.LOG_PATTERN_2); - assertThat(consoleWriter.toString()).contains(LogLevelTest.LOG_PATTERN_3); - } finally { - safeClose(clientWithRightProxy); - } - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() throws Exception { - safeClose(client); - httpProxyServer.shutDown(); - // wait for proxy server to be shutdown - TimeUnit.SECONDS.sleep(1); - - LogManager.resetConfiguration(); - PropertyConfigurator.configure(this.getClass().getClassLoader().getResource("log4j.properties")); - } - - @BeforeMethod(groups = { "simple"}) - public void beforeMethod() { - LogManager.resetConfiguration(); - PropertyConfigurator.configure(this.getClass().getClassLoader().getResource("log4j.properties")); - } - - @AfterMethod(groups = { "simple" }) - public void afterMethod(Method method) { - super.beforeMethod(method); - LogManager.resetConfiguration(); - PropertyConfigurator.configure(this.getClass().getClassLoader().getResource("log4j.properties")); - } - - private String getCollectionLink() { - return createdCollection.getSelfLink(); - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedAttachmentsTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedAttachmentsTest.java deleted file mode 100644 index bf61c7d7414a..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedAttachmentsTest.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.apache.commons.io.IOUtils; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Attachment; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.MediaOptions; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; - -import rx.Observable; -import rx.observers.TestSubscriber; - -import javax.net.ssl.SSLException; - -public class ReadFeedAttachmentsTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - private Document createdDocument; - - private AsyncDocumentClient client; - - private PartitionKey pk; - @Factory(dataProvider = "clientBuildersWithDirect") - public ReadFeedAttachmentsTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = 30000000) - public void readExternalAttachments() throws Exception { - createdDocument = createDocument(client, createdDatabase.getId(), - createdCollection.getId(), getDocumentDefinition()); - - List createdAttachments = new ArrayList<>(); - for(int i = 0; i < 5; i++) { - createdAttachments.add(createAttachments(client)); - } - waitIfNeededForReplicasToCatchUp(clientBuilder); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - options.setPartitionKey(pk); - - Observable> feedObservable = client.readAttachments(getDocumentLink(), options); - - int expectedPageSize = (createdAttachments.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator - .Builder() - .totalSize(createdAttachments.size()) - .exactlyContainsInAnyOrder(createdAttachments - .stream() - .map(d -> d.getResourceId()) - .collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(feedObservable, validator, FEED_TIMEOUT); - } - - //@Test(groups = { "simple" }, timeOut = FEED_TIMEOUT) - public void readAndUpdateEmbededAttachments() throws Exception { - createdDocument = createDocument(client, createdDatabase.getId(), - createdCollection.getId(), getDocumentDefinition()); - - FeedOptions feedOptions = new FeedOptions(); - feedOptions.setMaxItemCount(1); - feedOptions.setPartitionKey(pk); - String documentLink = "dbs/" + getDatabaseId() + "/colls/" + getCollectionId() + "/docs/" + getDocumentId(); - - MediaOptions options = new MediaOptions(); - options.setContentType("application/octet-stream"); - - RequestOptions reqOptions = new RequestOptions(); - reqOptions.setPartitionKey(pk); - - - try(InputStream ipStream = getMedia1Stream()) { - TestSubscriber> subscriber = new TestSubscriber<>(); - client.createAttachment(documentLink, ipStream, options, reqOptions) - .toBlocking() - .subscribe(subscriber); - subscriber.assertNoErrors(); - } - - try(InputStream ipStream = getMedia1Stream()) { - validateReadEmbededAttachment(documentLink, ipStream, feedOptions); - } - - validateUpdateEmbededAttachment(documentLink, options, feedOptions); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION; - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private void validateUpdateEmbededAttachment(String documentLink, MediaOptions mediaOptions, FeedOptions feedOptions) throws Exception { - String mediaLink = client.readAttachments(documentLink, feedOptions) - .map( response -> response.getResults().iterator().next().getMediaLink()) - .toBlocking() - .first(); - - try (InputStream ipStream = getMedia2Stream()) { - client.updateMedia(mediaLink, ipStream, mediaOptions) - .toBlocking().first(); - } - - try (InputStream ipStream = getMedia2Stream()) { - validateReadEmbededAttachment(documentLink, ipStream, feedOptions); - } - } - - private void validateReadEmbededAttachment(String documentLink, InputStream ipStream, FeedOptions feedOptions) { - TestSubscriber subscriber = new TestSubscriber<>(); - client.readAttachments(documentLink, feedOptions) - .map( response -> response.getResults().iterator().next().getMediaLink()) - .flatMap(mediaLink -> client.readMedia(mediaLink)) - .map(mediaResponse -> { - - try(InputStream responseMediaStream = mediaResponse.getMedia()) { - return IOUtils.contentEquals(ipStream, responseMediaStream); - } catch (IOException e) { - return false; - } - }) - .filter(x -> x) // Filter only right extractions back - .toBlocking() - .subscribe(subscriber); - - subscriber.assertNoErrors(); - subscriber.assertCompleted(); - subscriber.assertValueCount(1); - } - - private InputStream getMedia1Stream() - { - return this.getClass().getResourceAsStream("/cosmosdb-1.png"); - } - - private InputStream getMedia2Stream() - { - return this.getClass().getResourceAsStream("/Microsoft.jpg"); - } - - private String getCollectionId() { - return createdCollection.getId(); - } - - private String getDatabaseId() { - return createdDatabase.getId(); - } - - private String getDocumentId() { - return createdDocument.getId(); - } - - public Attachment createAttachments(AsyncDocumentClient client) { - Attachment attachment = getAttachmentDefinition(); - RequestOptions options = new RequestOptions(); - options.setPartitionKey(pk); - return client.createAttachment(getDocumentLink(), attachment, options).toBlocking().single().getResource(); - } - - public String getDocumentLink() { - return "dbs/" + getDatabaseId() + "/colls/" + getCollectionId() + "/docs/" + getDocumentId(); - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - pk = new PartitionKey(uuid); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } - - private static Attachment getAttachmentDefinition() { - String uuid = UUID.randomUUID().toString(); - String type = "application/text"; - return new Attachment(String.format( - "{" + - " 'id': '%s'," + - " 'media': 'http://xstore.'," + - " 'MediaType': 'Book'," + - " 'Author': 'My Book Author'," + - " 'Title': 'My Book Title'," + - " 'contentType': '%s'" + - "}", uuid, type)); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedCollectionsTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedCollectionsTest.java deleted file mode 100644 index fb3c735ea867..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedCollectionsTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; - -import rx.Observable; - -import javax.net.ssl.SSLException; - -public class ReadFeedCollectionsTest extends TestSuiteBase { - - protected static final int FEED_TIMEOUT = 60000; - protected static final int SETUP_TIMEOUT = 60000; - protected static final int SHUTDOWN_TIMEOUT = 20000; - - public final String databaseId = DatabaseForTest.generateId(); - - private Database createdDatabase; - private List createdCollections = new ArrayList<>(); - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuilders") - public ReadFeedCollectionsTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = FEED_TIMEOUT) - public void readCollections() throws Exception { - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - - Observable> feedObservable = client.readCollections(getDatabaseLink(), options); - - int expectedPageSize = (createdCollections.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(createdCollections.size()) - .exactlyContainsInAnyOrder(createdCollections.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(feedObservable, validator, FEED_TIMEOUT); - - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = createDatabase(client, databaseId); - - for(int i = 0; i < 3; i++) { - createdCollections.add(createCollections(client)); - } - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, createdDatabase); - safeClose(client); - } - - public DocumentCollection createCollections(AsyncDocumentClient client) { - DocumentCollection collection = new DocumentCollection(); - collection.setId(UUID.randomUUID().toString()); - return client.createCollection(getDatabaseLink(), collection, null).toBlocking().single().getResource(); - } - - private String getDatabaseLink() { - return "dbs/" + createdDatabase.getId(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedDatabasesTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedDatabasesTest.java deleted file mode 100644 index 823118868ec5..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedDatabasesTest.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; - -import rx.Observable; - -import javax.net.ssl.SSLException; - -public class ReadFeedDatabasesTest extends TestSuiteBase { - - private List createdDatabases = new ArrayList<>(); - private List allDatabases = new ArrayList<>(); - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuilders") - public ReadFeedDatabasesTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = FEED_TIMEOUT) - public void readDatabases() throws Exception { - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - - Observable> feedObservable = client.readDatabases(options); - - int expectedPageSize = (allDatabases.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(allDatabases.size()) - .exactlyContainsInAnyOrder(allDatabases.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(feedObservable, validator, FEED_TIMEOUT); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws URISyntaxException { - client = clientBuilder.build(); - allDatabases = client.readDatabases(null) - .map(frp -> frp.getResults()) - .toList() - .map(list -> list.stream().flatMap(x -> x.stream()).collect(Collectors.toList())) - .toBlocking() - .single(); - for(int i = 0; i < 5; i++) { - createdDatabases.add(createDatabase(client)); - } - allDatabases.addAll(createdDatabases); - } - - public Database createDatabase(AsyncDocumentClient client) { - Database db = new Database(); - db.setId(UUID.randomUUID().toString()); - return client.createDatabase(db, null).toBlocking().single().getResource(); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - for (int i = 0; i < 5; i ++) { - safeDeleteDatabase(client, createdDatabases.get(i).getId()); - } - safeClose(client); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedDocumentsTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedDocumentsTest.java deleted file mode 100644 index fd59b372ffe6..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedDocumentsTest.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Observable; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -public class ReadFeedDocumentsTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdDocuments; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public ReadFeedDocumentsTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = FEED_TIMEOUT) - public void readDocuments() { - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - options.setMaxItemCount(2); - - Observable> feedObservable = client.readDocuments(getCollectionLink(), options); - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(createdDocuments.size()) - .numberOfPagesIsGreaterThanOrEqualTo(1) - .exactlyContainsInAnyOrder(createdDocuments.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0) - .pageSizeIsLessThanOrEqualTo(options.getMaxItemCount()) - .build()) - .build(); - validateQuerySuccess(feedObservable, validator, FEED_TIMEOUT); - } - - @Test(groups = { "simple" }, timeOut = FEED_TIMEOUT) - public void readDocuments_withoutEnableCrossPartitionQuery() { - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - - Observable> feedObservable = client.readDocuments(getCollectionLink(), options); - FailureValidator validator = FailureValidator.builder().instanceOf(DocumentClientException.class) - .statusCode(400) - .errorMessageContains("Cross partition query is required but disabled." + - " Please set x-ms-documentdb-query-enablecrosspartition to true," + - " specify x-ms-documentdb-partitionkey," + - " or revise your query to avoid this exception.") - .build(); - validateQueryFailure(feedObservable, validator, FEED_TIMEOUT); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT, alwaysRun = true) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - - truncateCollection(SHARED_MULTI_PARTITION_COLLECTION); - List docDefList = new ArrayList<>(); - - for(int i = 0; i < 100; i++) { - docDefList.add(getDocumentDefinition()); - } - - createdDocuments = bulkInsertBlocking(client, getCollectionLink(), docDefList); - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } - - public String getCollectionLink() { - return "dbs/" + getDatabaseId() + "/colls/" + getCollectionId(); - } - - private String getCollectionId() { - return createdCollection.getId(); - } - - private String getDatabaseId() { - return createdDatabase.getId(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedExceptionHandlingTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedExceptionHandlingTest.java deleted file mode 100644 index 044d2a6e9910..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedExceptionHandlingTest.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.concurrent.CountDownLatch; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import org.mockito.Mockito; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.BridgeUtils; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.FeedResponse; - -import rx.Observable; -import rx.Subscriber; - - -public class ReadFeedExceptionHandlingTest extends TestSuiteBase { - - public class ExceptionSubscriber extends Subscriber> { - - public int onNextCount; - CountDownLatch latch = new CountDownLatch(1); - public ExceptionSubscriber() { - onNextCount = 0; - } - - @Override - public void onCompleted() { - latch.countDown(); - } - - @Override - public void onError(Throwable e) { - DocumentClientException exception = (DocumentClientException) e; - assertThat(exception).isNotNull(); - assertThat(exception.getStatusCode()).isEqualTo(0); - latch.countDown(); - } - - @Override - public void onNext(FeedResponse page) { - assertThat(page.getResults().size()).isEqualTo(2); - onNextCount ++; - } - } - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public ReadFeedExceptionHandlingTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void readFeedException() throws Exception { - - ArrayList dbs = new ArrayList(); - dbs.add(new Database()); - dbs.add(new Database()); - - ArrayList> frps = new ArrayList>(); - frps.add(BridgeInternal.createFeedResponse(dbs, null)); - frps.add(BridgeInternal.createFeedResponse(dbs, null)); - - Observable> response = Observable.from(frps) - .concatWith(Observable.error(new DocumentClientException(0))) - .concatWith(Observable.from(frps)); - - final AsyncDocumentClient mockClient = Mockito.spy(client); - Mockito.when(mockClient.readDatabases(null)).thenReturn(response); - ExceptionSubscriber subscriber = new ExceptionSubscriber(); - mockClient.readDatabases(null).subscribe(subscriber); - subscriber.latch.await(); - assertThat(subscriber.onNextCount).isEqualTo(2); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(this.client); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedOffersTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedOffersTest.java deleted file mode 100644 index 7b7e46d9dd01..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedOffersTest.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Offer; - -import rx.Observable; - -import javax.net.ssl.SSLException; - -public class ReadFeedOffersTest extends TestSuiteBase { - - protected static final int FEED_TIMEOUT = 60000; - protected static final int SETUP_TIMEOUT = 60000; - protected static final int SHUTDOWN_TIMEOUT = 20000; - - public final String databaseId = DatabaseForTest.generateId(); - - private Database createdDatabase; - private List allOffers = new ArrayList<>(); - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuilders") - public ReadFeedOffersTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "emulator" }, timeOut = FEED_TIMEOUT) - public void readOffers() throws Exception { - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - - Observable> feedObservable = client.readOffers(options); - - int expectedPageSize = (allOffers.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(allOffers.size()) - .exactlyContainsInAnyOrder(allOffers.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(feedObservable, validator, FEED_TIMEOUT); - } - - @BeforeClass(groups = { "emulator" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = createDatabase(client, databaseId); - - for(int i = 0; i < 3; i++) { - createCollections(client); - } - - allOffers = client.readOffers(null) - .map(frp -> frp.getResults()) - .toList() - .map(list -> list.stream().flatMap(x -> x.stream()).collect(Collectors.toList())) - .toBlocking() - .single(); - } - - @AfterClass(groups = { "emulator" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, createdDatabase); - safeClose(client); - } - - public DocumentCollection createCollections(AsyncDocumentClient client) { - DocumentCollection collection = new DocumentCollection(); - collection.setId(UUID.randomUUID().toString()); - return client.createCollection(getDatabaseLink(), collection, null).toBlocking().single().getResource(); - } - - private String getDatabaseLink() { - return "dbs/" + createdDatabase.getId(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedPermissionsTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedPermissionsTest.java deleted file mode 100644 index 6959a305bd5c..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedPermissionsTest.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Permission; -import com.microsoft.azure.cosmosdb.PermissionMode; -import com.microsoft.azure.cosmosdb.User; - -import rx.Observable; - -import javax.net.ssl.SSLException; - -public class ReadFeedPermissionsTest extends TestSuiteBase { - - public final String databaseId = DatabaseForTest.generateId(); - - private Database createdDatabase; - private User createdUser; - private List createdPermissions = new ArrayList<>(); - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuilders") - public ReadFeedPermissionsTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = FEED_TIMEOUT) - public void readPermissions() throws Exception { - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - - Observable> feedObservable = client.readPermissions(getUserLink(), options); - - int expectedPageSize = (createdPermissions.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(createdPermissions.size()) - .numberOfPages(expectedPageSize) - .exactlyContainsInAnyOrder(createdPermissions.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(feedObservable, validator, FEED_TIMEOUT); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - Database d = new Database(); - d.setId(databaseId); - createdDatabase = createDatabase(client, d); - createdUser = safeCreateUser(client, createdDatabase.getId(), getUserDefinition()); - - for(int i = 0; i < 5; i++) { - createdPermissions.add(createPermissions(client, i)); - } - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, databaseId); - safeClose(client); - } - - private static User getUserDefinition() { - User user = new User(); - user.setId(UUID.randomUUID().toString()); - return user; - } - - public Permission createPermissions(AsyncDocumentClient client, int index) { - DocumentCollection collection = new DocumentCollection(); - collection.setId(UUID.randomUUID().toString()); - Permission permission = new Permission(); - permission.setId(UUID.randomUUID().toString()); - permission.setPermissionMode(PermissionMode.Read); - permission.setResourceLink("dbs/AQAAAA==/colls/AQAAAJ0fgT" + Integer.toString(index) + "="); - return client.createPermission(getUserLink(), permission, null).toBlocking().single().getResource(); - } - - private String getUserLink() { - return "dbs/" + getDatabaseId() + "/users/" + getUserId(); - } - - private String getDatabaseId() { - return createdDatabase.getId(); - } - - private String getUserId() { - return createdUser.getId(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedPkrTests.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedPkrTests.java deleted file mode 100644 index 6fbd5e74ad5a..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedPkrTests.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import javax.net.ssl.SSLException; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; - -import rx.Observable; - -public class ReadFeedPkrTests extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public ReadFeedPkrTests(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "emulator" }, timeOut = FEED_TIMEOUT) - public void readPartitionKeyRanges() throws Exception { - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - - Observable> feedObservable = client.readPartitionKeyRanges(getCollectionLink(), options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(1) - .numberOfPages(1) - .build(); - validateQuerySuccess(feedObservable, validator, FEED_TIMEOUT); - } - - @BeforeClass(groups = { "emulator" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - createdDatabase = SHARED_DATABASE; - createdCollection = createCollection(createdDatabase.getId(), - getCollectionDefinition(), - null); - client = clientBuilder.build(); - } - - @AfterClass(groups = { "emulator" }, timeOut = SETUP_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteCollection(client, createdCollection); - safeClose(client); - } - - private String getCollectionLink() { - return "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedStoredProceduresTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedStoredProceduresTest.java deleted file mode 100644 index 0f7d2aa156ea..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedStoredProceduresTest.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.StoredProcedure; - -import rx.Observable; - -import javax.net.ssl.SSLException; - -public class ReadFeedStoredProceduresTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdStoredProcedures = new ArrayList<>(); - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public ReadFeedStoredProceduresTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = FEED_TIMEOUT) - public void readStoredProcedures() throws Exception { - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - - Observable> feedObservable = client.readStoredProcedures(getCollectionLink(), options); - - int expectedPageSize = (createdStoredProcedures.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator - .Builder() - .totalSize(createdStoredProcedures.size()) - .exactlyContainsInAnyOrder(createdStoredProcedures - .stream() - .map(d -> d.getResourceId()) - .collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(feedObservable, validator, FEED_TIMEOUT); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY); - - for(int i = 0; i < 5; i++) { - createdStoredProcedures.add(createStoredProcedures(client)); - } - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - public StoredProcedure createStoredProcedures(AsyncDocumentClient client) { - StoredProcedure sproc = new StoredProcedure(); - sproc.setId(UUID.randomUUID().toString()); - sproc.setBody("function() {var x = 10;}"); - return client.createStoredProcedure(getCollectionLink(), sproc, null).toBlocking().single().getResource(); - } - - private String getCollectionLink() { - return "dbs/" + getDatabaseId() + "/colls/" + getCollectionId(); - } - - private String getCollectionId() { - return createdCollection.getId(); - } - - private String getDatabaseId() { - return createdDatabase.getId(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedTriggersTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedTriggersTest.java deleted file mode 100644 index 2b2c40780718..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedTriggersTest.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Trigger; -import com.microsoft.azure.cosmosdb.TriggerOperation; -import com.microsoft.azure.cosmosdb.TriggerType; - -import rx.Observable; - -public class ReadFeedTriggersTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdTriggers = new ArrayList<>(); - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public ReadFeedTriggersTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = FEED_TIMEOUT) - public void readTriggers() throws Exception { - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - - Observable> feedObservable = client.readTriggers(getCollectionLink(), options); - - int expectedPageSize = (createdTriggers.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator - .Builder() - .totalSize(createdTriggers.size()) - .exactlyContainsInAnyOrder(createdTriggers - .stream() - .map(d -> d.getResourceId()) - .collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(feedObservable, validator, FEED_TIMEOUT); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - - this.client = clientBuilder.build(); - this.createdDatabase = SHARED_DATABASE; - this.createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - this.truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY); - - for(int i = 0; i < 5; i++) { - this.createdTriggers.add(this.createTriggers(client)); - } - - this.waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - public Trigger createTriggers(AsyncDocumentClient client) { - Trigger trigger = new Trigger(); - trigger.setId(UUID.randomUUID().toString()); - trigger.setBody("function() {var x = 10;}"); - trigger.setTriggerOperation(TriggerOperation.Create); - trigger.setTriggerType(TriggerType.Pre); - return client.createTrigger(getCollectionLink(), trigger, null).toBlocking().single().getResource(); - } - - private String getCollectionLink() { - return "dbs/" + getDatabaseId() + "/colls/" + getCollectionId(); - } - - private String getCollectionId() { - return createdCollection.getId(); - } - - private String getDatabaseId() { - return createdDatabase.getId(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedUdfsTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedUdfsTest.java deleted file mode 100644 index 4bd2ccbbbfde..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedUdfsTest.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.UserDefinedFunction; - -import rx.Observable; - -import javax.net.ssl.SSLException; - -public class ReadFeedUdfsTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdUserDefinedFunctions = new ArrayList<>(); - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public ReadFeedUdfsTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = FEED_TIMEOUT) - public void readUserDefinedFunctions() throws Exception { - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - - Observable> feedObservable = client.readUserDefinedFunctions(getCollectionLink(), options); - - int expectedPageSize = (createdUserDefinedFunctions.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator - .Builder() - .totalSize(createdUserDefinedFunctions.size()) - .exactlyContainsInAnyOrder(createdUserDefinedFunctions - .stream() - .map(d -> d.getResourceId()) - .collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(feedObservable, validator, FEED_TIMEOUT); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY); - - for(int i = 0; i < 5; i++) { - createdUserDefinedFunctions.add(createUserDefinedFunctions(client)); - } - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - public UserDefinedFunction createUserDefinedFunctions(AsyncDocumentClient client) { - UserDefinedFunction udf = new UserDefinedFunction(); - udf.setId(UUID.randomUUID().toString()); - udf.setBody("function() {var x = 10;}"); - return client.createUserDefinedFunction(getCollectionLink(), udf, null).toBlocking().single().getResource(); - } - - private String getCollectionLink() { - return "dbs/" + getDatabaseId() + "/colls/" + getCollectionId(); - } - - private String getCollectionId() { - return createdCollection.getId(); - } - - private String getDatabaseId() { - return createdDatabase.getId(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedUsersTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedUsersTest.java deleted file mode 100644 index 68186ec977d5..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ReadFeedUsersTest.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.User; - -import rx.Observable; - -import javax.net.ssl.SSLException; - -public class ReadFeedUsersTest extends TestSuiteBase { - - public final String databaseId = DatabaseForTest.generateId(); - private Database createdDatabase; - - private AsyncDocumentClient client; - private List createdUsers = new ArrayList<>(); - - @Factory(dataProvider = "clientBuilders") - public ReadFeedUsersTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = FEED_TIMEOUT) - public void readUsers() throws Exception { - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - - Observable> feedObservable = client.readUsers(getDatabaseLink(), options); - - int expectedPageSize = (createdUsers.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(createdUsers.size()) - .exactlyContainsInAnyOrder(createdUsers.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(feedObservable, validator, FEED_TIMEOUT); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - Database d = new Database(); - d.setId(databaseId); - createdDatabase = createDatabase(client, d); - - for(int i = 0; i < 5; i++) { - createdUsers.add(createUsers(client)); - } - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, createdDatabase.getId()); - safeClose(client); - } - - public User createUsers(AsyncDocumentClient client) { - User user = new User(); - user.setId(UUID.randomUUID().toString()); - return client.createUser(getDatabaseLink(), user, null).toBlocking().single().getResource(); - } - - private String getDatabaseLink() { - return "dbs/" + createdDatabase.getId(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ResourceTokenTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ResourceTokenTest.java deleted file mode 100644 index c5587f7b7482..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/ResourceTokenTest.java +++ /dev/null @@ -1,547 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.apache.commons.lang3.StringUtils; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.Permission; -import com.microsoft.azure.cosmosdb.PermissionMode; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.User; - -import rx.Observable; - -/** - * This class try to test different scenario related to fetching various - * resources from resource token directly or via permission feed . - * - */ -public class ResourceTokenTest extends TestSuiteBase { - public final String databaseId = DatabaseForTest.generateId(); - - private Database createdDatabase; - private DocumentCollection createdCollection; - private DocumentCollection createdCollectionWithPartitionKey; - private Document createdDocument; - private Document createdDocumentWithPartitionKey; - private Document createdDocumentWithPartitionKey2; - private User createdUser; - private Permission createdCollPermission; - private Permission createdCollPermissionWithName; - private Permission createdDocPermission; - private Permission createdDocPermissionWithName; - private Permission createdDocPermissionWithPartitionKey; - private Permission createdDocPermissionWithPartitionKeyWithName; - private Permission createdDocPermissionWithPartitionKey2; - private Permission createdDocPermissionWithPartitionKey2WithName; - private Permission createdColPermissionWithPartitionKey; - private Permission createdColPermissionWithPartitionKeyWithName; - private Permission createdColPermissionWithPartitionKey2; - private Permission createdColPermissionWithPartitionKey2WithName; - - private AsyncDocumentClient client; - - // All static string used in below test cases - private final static String DOCUMENT_DEFINITION = "{ 'id': 'doc%d', 'counter': '%d'}"; - private final static String DOCUMENT_DEFINITION_WITH_PERMISSION_KEY = "{ " + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" + "}"; - private final static String PARTITION_KEY_PATH = "/mypk"; - - private static final String PARTITION_KEY_VALUE = "1"; - private static final String PARTITION_KEY_VALUE_2 = "2"; - private static final String PERMISSION_DEFINITION = "{" + " 'id': 'PermissionForDocWithPartitionKey'," - + " 'permissionMode': 'read'," + " 'resource': '%s'," + " 'resourcePartitionKey': ['%s']" + "}"; - private static final String COLLECTION_PERMISSION_DEFINITION = "{" + " 'id': 'PermissionForColWithPartitionKey'," - + " 'permissionMode': 'read'," + " 'resource': '%s'," + " 'resourcePartitionKey': ['%s']" + "}"; - private static final String USER_NAME = "TestUser"; - private static final String PERMISSION_FOR_COLL = "PermissionForColl"; - private static final String PERMISSION_FOR_COLL_WITH_NAME = "PermissionForCollWithName"; - private static final String PERMISSION_FOR_DOC = "PermissionForDoc"; - private static final String PERMISSION_FOR_DOC_WITH_NAME = "PermissionForDocWithName"; - - @Factory(dataProvider = "clientBuilders") - public ResourceTokenTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - Database d = new Database(); - d.setId(databaseId); - createdDatabase = createDatabase(client, d); - // Create collection - createdCollection = createCollection(client, createdDatabase.getId(), getCollectionDefinition()); - // Create document - createdDocument = createDocument(client, createdDatabase.getId(),createdCollection.getId(), getDocument()); - // Create collection with partition key - createdCollectionWithPartitionKey = createCollection(client, createdDatabase.getId(), getCollectionDefinitionWithPartitionKey()); - // Create document with partition key - createdDocumentWithPartitionKey = createDocument(client, createdDatabase.getId(), createdCollectionWithPartitionKey.getId(), - getDocumentDefinitionWithPartitionKey()); - // Create second document with partition key - createdDocumentWithPartitionKey2 = createDocument(client, createdDatabase.getId(),createdCollectionWithPartitionKey.getId(), - getDocumentDefinitionWithPartitionKey2()); - // Create user - createdUser = createUser(client, createdDatabase.getId(), getUserDefinition()); - // Create permission for collection - createdCollPermission = client.createPermission(getUserLink(), getCollPermission(), null).toBlocking().single() - .getResource(); - createdCollPermissionWithName = client.createPermission(getUserLink(), getCollPermissionWithName(), null).toBlocking().single() - .getResource(); - // Create permission for document - createdDocPermission = client.createPermission(getUserLink(), getDocPermission(), null).toBlocking().single() - .getResource(); - createdDocPermissionWithName = client.createPermission(getUserLink(), getDocPermissionWithName(), null).toBlocking().single() - .getResource(); - // Create permission for document with partition key - createdDocPermissionWithPartitionKey = client - .createPermission(getUserLink(), getDocPermissionWithPartitionKey(), null).toBlocking().single() - .getResource(); - createdDocPermissionWithPartitionKeyWithName = client - .createPermission(getUserLink(), getDocPermissionWithPartitionKeyWithName(), null).toBlocking().single() - .getResource(); - // Create permission for document with partition key 2 - createdDocPermissionWithPartitionKey2 = client - .createPermission(getUserLink(), getDocPermissionWithPartitionKey2(), null).toBlocking().single() - .getResource(); - createdDocPermissionWithPartitionKey2WithName = client - .createPermission(getUserLink(), getDocPermissionWithPartitionKey2WithName(), null).toBlocking().single() - .getResource(); - // Create permission for collection with partition key - createdColPermissionWithPartitionKey = client - .createPermission(getUserLink(), getColPermissionWithPartitionKey(), null).toBlocking().single() - .getResource(); - createdColPermissionWithPartitionKeyWithName = client - .createPermission(getUserLink(), getColPermissionWithPartitionKeyWithName(), null).toBlocking().single() - .getResource(); - // Create permission for collection with partition key - createdColPermissionWithPartitionKey2 = client - .createPermission(getUserLink(), getColPermissionWithPartitionKey2(), null).toBlocking().single() - .getResource(); - createdColPermissionWithPartitionKey2WithName = client - .createPermission(getUserLink(), getColPermissionWithPartitionKey2WithName(), null).toBlocking().single() - .getResource(); - } - - @DataProvider(name = "collectionAndPermissionData") - public Object[][] collectionAndPermissionData() { - return new Object[][]{ - //This test will try to read collection from its own permission and validate it, both with request Id and name. - {createdCollection.getSelfLink(), createdCollPermission}, - {Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId()), createdDocPermissionWithName}, - }; - } - - @DataProvider(name = "documentAndPermissionData") - public Object[][] documentAndPermissionData() { - return new Object[][]{ - //These tests will try to read document from its own permission and validate it, both with request Id and name. - {createdDocument.getSelfLink(), createdDocPermission, createdDocument.getId(), null}, - {Utils.getDocumentNameLink(createdDatabase.getId(), createdCollection.getId(), createdDocument.getId()), createdDocPermissionWithName, createdDocument.getId(), null}, - - //These tests will try to read document from its permission having partition key 1 and validate it, both with request Id and name. - {createdDocumentWithPartitionKey.getSelfLink(), createdDocPermissionWithPartitionKey, createdDocumentWithPartitionKey.getId(), PARTITION_KEY_VALUE}, - {Utils.getDocumentNameLink(createdDatabase.getId(), createdCollectionWithPartitionKey.getId(), createdDocumentWithPartitionKey.getId()), createdDocPermissionWithPartitionKeyWithName - , createdDocumentWithPartitionKey.getId(), PARTITION_KEY_VALUE}, - - //These tests will try to read document from its permission having partition key 2 and validate it, both with request Id and name. - {createdDocumentWithPartitionKey2.getSelfLink(), createdDocPermissionWithPartitionKey2, createdDocumentWithPartitionKey2.getId(), PARTITION_KEY_VALUE_2}, - {Utils.getDocumentNameLink(createdDatabase.getId(), createdCollectionWithPartitionKey.getId(), createdDocumentWithPartitionKey2.getId()), - createdDocPermissionWithPartitionKey2WithName, createdDocumentWithPartitionKey2.getId(), PARTITION_KEY_VALUE_2}, - - // These tests will try to read document from its parent collection permission and validate it, both with request Id and name. - {createdDocument.getSelfLink(), createdCollPermission, createdDocument.getId(), null}, - {Utils.getDocumentNameLink(createdDatabase.getId(), createdCollection.getId(), createdDocument.getId()), createdCollPermissionWithName, createdDocument.getId(), null}, - - //This test will try to read document from collection permission having partition key 1 and validate it, both with request Id and name. - {createdDocumentWithPartitionKey.getSelfLink(), createdColPermissionWithPartitionKey, createdDocumentWithPartitionKey.getId(), PARTITION_KEY_VALUE}, - {Utils.getDocumentNameLink(createdDatabase.getId(), createdCollectionWithPartitionKey.getId(), createdDocumentWithPartitionKey.getId()), createdColPermissionWithPartitionKeyWithName, createdDocumentWithPartitionKey.getId(), PARTITION_KEY_VALUE}, - - //This test will try to read document from collection permission having partition key 2 and validate it, both with request Id and name. - {createdDocumentWithPartitionKey2.getSelfLink(), createdColPermissionWithPartitionKey2, createdDocumentWithPartitionKey2.getId(), PARTITION_KEY_VALUE_2}, - {Utils.getDocumentNameLink(createdDatabase.getId(), createdCollectionWithPartitionKey.getId(), createdDocumentWithPartitionKey2.getId()), createdColPermissionWithPartitionKey2WithName, createdDocumentWithPartitionKey2.getId(), PARTITION_KEY_VALUE_2} - - }; - } - - @DataProvider(name = "documentAndPermissionDataForResourceNotFound") - public Object[][] documentAndPermissionDataForResourceNotFound() { - return new Object[][]{ - //This test will try to read document from its resource token directly and validate it. - {createdDocumentWithPartitionKey2.getSelfLink(), createdColPermissionWithPartitionKey, PARTITION_KEY_VALUE}, - //This test will try to read document from its parent collection resource token directly and validate it. - {Utils.getDocumentNameLink(createdDatabase.getId(), createdCollectionWithPartitionKey.getId(), createdDocumentWithPartitionKey2.getId()), - createdColPermissionWithPartitionKeyWithName, PARTITION_KEY_VALUE} - }; - } - - @DataProvider(name = "documentAndMultipleCollPermissionData") - public Object[][] documentAndMultipleCollPermissionData() { - return new Object[][]{ - //These tests will try to read document from partition 1 with two collection permissions having different partition keys and validate it, both with request Id and name. - {createdDocumentWithPartitionKey.getSelfLink(), createdColPermissionWithPartitionKey, createdColPermissionWithPartitionKey2, createdDocumentWithPartitionKey.getId(), - PARTITION_KEY_VALUE}, - {Utils.getDocumentNameLink(createdDatabase.getId(), createdCollectionWithPartitionKey.getId(), createdDocumentWithPartitionKey.getId()), createdColPermissionWithPartitionKeyWithName - , createdColPermissionWithPartitionKey2WithName, createdDocumentWithPartitionKey.getId(), PARTITION_KEY_VALUE}, - - //These tests will try to read document from partition 1 with two collection permissions having different partition keys and validate it, both with request Id and name. - {createdDocumentWithPartitionKey2.getSelfLink(), createdColPermissionWithPartitionKey, createdColPermissionWithPartitionKey2, createdDocumentWithPartitionKey2.getId(), - PARTITION_KEY_VALUE_2}, - {Utils.getDocumentNameLink(createdDatabase.getId(), createdCollectionWithPartitionKey.getId(), createdDocumentWithPartitionKey2.getId()), createdColPermissionWithPartitionKeyWithName - , createdColPermissionWithPartitionKey2WithName, createdDocumentWithPartitionKey2.getId(), PARTITION_KEY_VALUE_2} - }; - } - - @DataProvider(name = "resourceToken") - public Object[][] resourceToken() { - return new Object[][]{ - //This test will try to read document from its resource token directly and validate it. - {createdDocPermission.getToken()}, - //This test will try to read document from its parent collection resource token directly and validate it. - {createdCollPermission.getToken()} - }; - } - - /** - * This test will try to read collection from permission and validate it. - * - * @throws Exception - */ - @Test(groups = { "simple" }, dataProvider = "collectionAndPermissionData", timeOut = TIMEOUT) - public void readCollectionFromPermissionFeed(String collectionUrl, Permission permission) throws Exception { - AsyncDocumentClient asyncClientResourceToken = null ; - try { - List permissionFeed = new ArrayList<>(); - permissionFeed.add(permission); - asyncClientResourceToken = new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withPermissionFeed(permissionFeed).withConnectionPolicy(ConnectionPolicy.GetDefault()) - .withConsistencyLevel(ConsistencyLevel.Session).build(); - Observable> readObservable = asyncClientResourceToken - .readCollection(collectionUrl, null); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(createdCollection.getId()).build(); - validateSuccess(readObservable, validator); - } finally { - safeClose(asyncClientResourceToken); - } - } - - /** - * This test will try to read document from permission and validate it. - * - * @throws Exception - */ - @Test(groups = { "simple" }, dataProvider = "documentAndPermissionData", timeOut = TIMEOUT) - public void readDocumentFromPermissionFeed(String documentUrl, Permission permission, String documentId, String partitionKey) throws Exception { - AsyncDocumentClient asyncClientResourceToken = null; - try { - List permissionFeed = new ArrayList<>(); - permissionFeed.add(permission); - asyncClientResourceToken = new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withPermissionFeed(permissionFeed).withConnectionPolicy(ConnectionPolicy.GetDefault()) - .withConsistencyLevel(ConsistencyLevel.Session).build(); - RequestOptions options = null; - if(StringUtils.isNotEmpty(partitionKey)) { - options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(partitionKey)); - } - Observable> readObservable = asyncClientResourceToken - .readDocument(documentUrl, options); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(documentId).build(); - validateSuccess(readObservable, validator); - } finally { - safeClose(asyncClientResourceToken); - } - } - - /** - * This test will try to read document from resource token directly and validate it. - * - * @throws Exception - */ - @Test(groups = { "simple" }, dataProvider = "resourceToken", timeOut = TIMEOUT) - public void readDocumentFromResouceToken(String resourceToken) throws Exception { - AsyncDocumentClient asyncClientResourceToken = null; - try { - asyncClientResourceToken = new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(resourceToken) - .withConnectionPolicy(ConnectionPolicy.GetDefault()).withConsistencyLevel(ConsistencyLevel.Session) - .build(); - Observable> readObservable = asyncClientResourceToken - .readDocument(createdDocument.getSelfLink(), null); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(createdDocument.getId()).build(); - validateSuccess(readObservable, validator); - } finally { - safeClose(asyncClientResourceToken); - } - } - - /** - * This test will try to read document from multiple collection permissions having different keys and validate it. - * - * @throws Exception - */ - @Test(groups = {"simple"}, dataProvider = "documentAndMultipleCollPermissionData", timeOut = TIMEOUT) - public void readDocumentOfParKeyFromTwoCollPermissionWithDiffPartitionKeys(String documentUrl, Permission collPermission1, Permission collPermission2, String documentId, String partitionKey) throws Exception { - AsyncDocumentClient asyncClientResourceToken = null; - try { - List permissionFeed = new ArrayList<>(); - permissionFeed.add(collPermission1); - permissionFeed.add(collPermission2); - asyncClientResourceToken = new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withPermissionFeed(permissionFeed).withConnectionPolicy(ConnectionPolicy.GetDefault()) - .withConsistencyLevel(ConsistencyLevel.Session).build(); - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(partitionKey)); - Observable> readObservable = asyncClientResourceToken - .readDocument(documentUrl, options); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(documentId).build(); - validateSuccess(readObservable, validator); - } finally { - safeClose(asyncClientResourceToken); - } - } - - /** - * This test will try to read document with wrong collection permission hence - * expecting resource not found failure. - * - * @throws Exception - */ - @Test(groups = { "simple" },dataProvider = "documentAndPermissionDataForResourceNotFound", timeOut = TIMEOUT) - public void readDocumentFromCollPermissionWithDiffPartitionKey_ResourceNotFound(String documentUrl, Permission permission, String partitionKey) throws Exception { - AsyncDocumentClient asyncClientResourceToken = null; - try { - List permissionFeed = new ArrayList<>(); - permissionFeed.add(permission); - asyncClientResourceToken = new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withPermissionFeed(permissionFeed).withConnectionPolicy(ConnectionPolicy.GetDefault()) - .withConsistencyLevel(ConsistencyLevel.Session).build(); - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(partitionKey)); - Observable> readObservable = asyncClientResourceToken - .readDocument(documentUrl, options); - FailureValidator validator = new FailureValidator.Builder().resourceNotFound().build(); - validateFailure(readObservable, validator); - } finally { - safeClose(asyncClientResourceToken); - } - } - - /** - * This test will try to read document with collection permissions and passing wrong partitionkey - * in request options hence expecting exception. - * - * @throws Exception - */ - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void readDocumentFromCollPermissionWithDiffPartitionKey_WithException() throws Exception { - AsyncDocumentClient asyncClientResourceToken = null; - try { - List permissionFeed = new ArrayList<>(); - permissionFeed.add(createdColPermissionWithPartitionKey); - asyncClientResourceToken = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withConnectionPolicy(ConnectionPolicy.GetDefault()) - .withConsistencyLevel(ConsistencyLevel.Session) - .withPermissionFeed(permissionFeed) - .build(); - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(PARTITION_KEY_VALUE_2)); - Observable> readObservable = asyncClientResourceToken - .readDocument(createdDocumentWithPartitionKey.getSelfLink(), options); - FailureValidator validator = new FailureValidator.Builder().resourceTokenNotFound().build(); - validateFailure(readObservable, validator); - } finally { - safeClose(asyncClientResourceToken); - } - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, databaseId); - safeClose(client); - } - - private static User getUserDefinition() { - User user = new User(); - user.setId(USER_NAME); - return user; - } - - private static Document getDocument() { - Document doc = new Document(String.format(DOCUMENT_DEFINITION, 1, 1)); - return doc; - } - - private Permission getCollPermission() { - Permission permission = new Permission(); - permission.setId(PERMISSION_FOR_COLL); - permission.setPermissionMode(PermissionMode.Read); - permission.setResourceLink(createdCollection.getSelfLink()); - return permission; - } - - private Permission getCollPermissionWithName() { - Permission permission = new Permission(); - permission.setId(PERMISSION_FOR_COLL_WITH_NAME); - permission.setPermissionMode(PermissionMode.Read); - permission.setResourceLink(Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId())); - return permission; - } - - private Permission getDocPermission() { - Permission permission = new Permission(); - permission.setId(PERMISSION_FOR_DOC); - permission.setPermissionMode(PermissionMode.Read); - permission.setResourceLink(createdDocument.getSelfLink()); - return permission; - } - private Permission getDocPermissionWithName() { - Permission permission = new Permission(); - permission.setId(PERMISSION_FOR_DOC_WITH_NAME); - permission.setPermissionMode(PermissionMode.Read); - permission.setResourceLink(Utils.getDocumentNameLink(createdDatabase.getId(),createdCollection.getId(),createdDocument.getId())); - return permission; - } - - private Permission getDocPermissionWithPartitionKey() { - String permissionStr = String.format(PERMISSION_DEFINITION, createdDocumentWithPartitionKey.getSelfLink(), - PARTITION_KEY_VALUE); - Permission permission = new Permission(permissionStr); - return permission; - } - - private Permission getDocPermissionWithPartitionKeyWithName() { - String permissionStr = String.format(PERMISSION_DEFINITION, Utils.getDocumentNameLink(createdDatabase.getId(), createdCollectionWithPartitionKey.getId(), createdDocumentWithPartitionKey.getId()), - PARTITION_KEY_VALUE); - Permission permission = new Permission(permissionStr); - permission.setId("PermissionForDocWithPartitionKeyWithName"); - return permission; - } - - private Permission getDocPermissionWithPartitionKey2() { - String permissionStr = String.format(PERMISSION_DEFINITION, createdDocumentWithPartitionKey2.getSelfLink(), - PARTITION_KEY_VALUE_2); - Permission permission = new Permission(permissionStr); - permission.setId("PermissionForDocWithPartitionKey2"); - return permission; - } - - private Permission getDocPermissionWithPartitionKey2WithName() { - String permissionStr = String.format(PERMISSION_DEFINITION, Utils.getDocumentNameLink(createdDatabase.getId(),createdCollectionWithPartitionKey.getId(),createdDocumentWithPartitionKey2.getId()), - PARTITION_KEY_VALUE_2); - Permission permission = new Permission(permissionStr); - permission.setId("PermissionForDocWithPartitionKey2WithName"); - return permission; - } - - private Permission getColPermissionWithPartitionKey() { - String permissionStr = String.format(COLLECTION_PERMISSION_DEFINITION, createdCollectionWithPartitionKey.getSelfLink(), - PARTITION_KEY_VALUE); - Permission permission = new Permission(permissionStr); - return permission; - } - - private Permission getColPermissionWithPartitionKeyWithName() { - String permissionStr = String.format(COLLECTION_PERMISSION_DEFINITION, Utils.getCollectionNameLink(createdDatabase.getId(), createdCollectionWithPartitionKey.getId()), - PARTITION_KEY_VALUE); - Permission permission = new Permission(permissionStr); - permission.setId("PermissionForColWithPartitionKeyWithName"); - return permission; - } - - private Permission getColPermissionWithPartitionKey2() { - String permissionStr = String.format(COLLECTION_PERMISSION_DEFINITION, createdCollectionWithPartitionKey.getSelfLink(), - PARTITION_KEY_VALUE_2); - Permission permission = new Permission(permissionStr); - permission.setId("PermissionForColWithPartitionKey2"); - return permission; - } - - private Permission getColPermissionWithPartitionKey2WithName() { - String permissionStr = String.format(COLLECTION_PERMISSION_DEFINITION, Utils.getCollectionNameLink(createdDatabase.getId(), createdCollectionWithPartitionKey.getId()), - PARTITION_KEY_VALUE_2); - Permission permission = new Permission(permissionStr); - permission.setId("PermissionForColWithPartitionKey2WithName"); - return permission; - } - - private String getUserLink() { - return createdUser.getSelfLink(); - } - - static protected DocumentCollection getCollectionDefinition() { - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - return collectionDefinition; - } - - private Document getDocumentDefinitionWithPartitionKey() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format(DOCUMENT_DEFINITION_WITH_PERMISSION_KEY, uuid, PARTITION_KEY_VALUE)); - return doc; - } - private Document getDocumentDefinitionWithPartitionKey2() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format(DOCUMENT_DEFINITION_WITH_PERMISSION_KEY, uuid, PARTITION_KEY_VALUE_2)); - return doc; - } - - private DocumentCollection getCollectionDefinitionWithPartitionKey() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); - paths.add(PARTITION_KEY_PATH); - partitionKeyDef.setPaths(paths); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - collectionDefinition.setPartitionKey(partitionKeyDef); - - return collectionDefinition; - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/SimpleSerializationTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/SimpleSerializationTest.java deleted file mode 100644 index 338f5b7004c7..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/SimpleSerializationTest.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.JsonSerializer; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; -import org.apache.commons.lang3.NotImplementedException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Observable; - -import java.io.IOException; -import java.time.Instant; -import java.util.UUID; - -import static org.assertj.core.api.Assertions.assertThat; - -public class SimpleSerializationTest extends TestSuiteBase { - - private DocumentCollection createdCollection; - private AsyncDocumentClient client; - - private static class TestObject { - public static class BadSerializer extends JsonSerializer { - @Override - public void serialize(String value, JsonGenerator gen, SerializerProvider serializers) { - throw new NotImplementedException("bad"); - } - } - - @JsonProperty("mypk") - private String mypk; - - @JsonProperty("id") - private String id; - - @JsonProperty("prop") - @JsonSerialize(using = BadSerializer.class) - private String prop; - } - - @Factory(dataProvider = "clientBuildersWithDirect") - public SimpleSerializationTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = {"simple"}, timeOut = TIMEOUT) - public void createDocument() { - TestObject testObject = new TestObject(); - testObject.id = UUID.randomUUID().toString(); - testObject.mypk = UUID.randomUUID().toString(); - testObject.prop = UUID.randomUUID().toString(); - - Observable> createObservable = client - .createDocument(getCollectionLink(), testObject, null, false); - - FailureValidator failureValidator = FailureValidator.builder().instanceOf(IllegalArgumentException.class) - .causeOfCauseInstanceOf(NotImplementedException.class) - .errorMessageContains("Can't serialize the object into the json string").build(); - - validateFailure(createObservable, failureValidator); - } - - @BeforeClass(groups = {"simple"}, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - client = clientBuilder.build(); - } - - @AfterClass(groups = {"simple"}, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private String getCollectionLink() { - return createdCollection.getSelfLink(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/SinglePartitionDocumentQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/SinglePartitionDocumentQueryTest.java deleted file mode 100644 index fdca1855021f..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/SinglePartitionDocumentQueryTest.java +++ /dev/null @@ -1,370 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.SqlParameter; -import com.microsoft.azure.cosmosdb.SqlParameterCollection; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; -import rx.observers.TestSubscriber; - - -public class SinglePartitionDocumentQueryTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdDocuments = new ArrayList<>(); - - private AsyncDocumentClient client; - - public String getCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId()); - } - - @Factory(dataProvider = "clientBuildersWithDirect") - public SinglePartitionDocumentQueryTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "queryMetricsArgProvider") - public void queryDocuments(boolean queryMetricsEnabled) throws Exception { - - String query = "SELECT * from c where c.prop = 99"; - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(5); - options.setPopulateQueryMetrics(queryMetricsEnabled); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - List expectedDocs = createdDocuments.stream().filter(d -> 99 == d.getInt("prop") ).collect(Collectors.toList()); - assertThat(expectedDocs).isNotEmpty(); - - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedDocs.size()) - .exactlyContainsInAnyOrder(expectedDocs.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .hasValidQueryMetrics(queryMetricsEnabled) - .build(); - - try { - validateQuerySuccess(queryObservable, validator, 10000); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryDocuments_ParameterizedQueryWithInClause() throws Exception { - String query = "SELECT * from c where c.prop IN (@param1, @param2)"; - SqlParameterCollection params = new SqlParameterCollection(new SqlParameter("@param1", 3), new SqlParameter("@param2", 4)); - SqlQuerySpec sqs = new SqlQuerySpec(query, params); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(5); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), sqs, options); - - List expectedDocs = createdDocuments.stream().filter(d -> (3 == d.getInt("prop") || 4 == d.getInt("prop"))).collect(Collectors.toList()); - assertThat(expectedDocs).isNotEmpty(); - - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedDocs.size()) - .exactlyContainsInAnyOrder(expectedDocs.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - try { - validateQuerySuccess(queryObservable, validator, 10000); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryDocuments_ParameterizedQuery() throws Exception { - String query = "SELECT * from c where c.prop = @param"; - SqlParameterCollection params = new SqlParameterCollection(new SqlParameter("@param", 3)); - SqlQuerySpec sqs = new SqlQuerySpec(query, params); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(5); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), sqs, options); - - List expectedDocs = createdDocuments.stream().filter(d -> 3 == d.getInt("prop")).collect(Collectors.toList()); - assertThat(expectedDocs).isNotEmpty(); - - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedDocs.size()) - .exactlyContainsInAnyOrder(expectedDocs.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - try { - validateQuerySuccess(queryObservable, validator, 10000); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryDocuments_NoResults() throws Exception { - - String query = "SELECT * from root r where r.id = '2'"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(new ArrayList<>()) - .numberOfPages(1) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryDocumentsWithPageSize() throws Exception { - - String query = "SELECT * from root"; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(3); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - List expectedDocs = createdDocuments; - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator - .Builder() - .exactlyContainsInAnyOrder(createdDocuments - .stream() - .map(d -> d.getResourceId()) - .collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - try { - validateQuerySuccess(queryObservable, validator); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryOrderBy() throws Exception { - - String query = "SELECT * FROM r ORDER BY r.prop ASC"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - options.setMaxItemCount(3); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - List expectedDocs = createdDocuments; - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(createdDocuments.stream() - .sorted((e1, e2) -> Integer.compare(e1.getInt("prop"), e2.getInt("prop"))) - .map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - try { - validateQuerySuccess(queryObservable, validator); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT * 1000) - public void continuationToken() throws Exception { - String query = "SELECT * FROM r ORDER BY r.prop ASC"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - options.setMaxItemCount(3); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - - TestSubscriber> subscriber = new TestSubscriber<>(); - queryObservable.first().subscribe(subscriber); - - subscriber.awaitTerminalEvent(); - subscriber.assertCompleted(); - subscriber.assertNoErrors(); - assertThat(subscriber.getValueCount()).isEqualTo(1); - FeedResponse page = subscriber.getOnNextEvents().get(0); - assertThat(page.getResults()).hasSize(3); - - assertThat(page.getResponseContinuation()).isNotEmpty(); - - - options.setRequestContinuation(page.getResponseContinuation()); - queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - - List expectedDocs = createdDocuments.stream().filter(d -> (d.getInt("prop") > 2)).collect(Collectors.toList()); - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - assertThat(expectedDocs).hasSize(createdDocuments.size() -3); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(expectedDocs.stream() - .sorted((e1, e2) -> Integer.compare(e1.getInt("prop"), e2.getInt("prop"))) - .map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void invalidQuerySytax() throws Exception { - String query = "I am an invalid query"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryDocuments(getCollectionLink(), query, options); - - FailureValidator validator = new FailureValidator.Builder() - .instanceOf(DocumentClientException.class) - .statusCode(400) - .notNullActivityId() - .build(); - validateQueryFailure(queryObservable, validator); - } - - public Document createDocument(AsyncDocumentClient client, int cnt) { - Document docDefinition = getDocumentDefinition(cnt); - return client.createDocument(getCollectionLink(), docDefinition, null, false).toBlocking().single().getResource(); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY); - - for(int i = 0; i < 5; i++) { - createdDocuments.add(createDocument(client, i)); - } - - for(int i = 0; i < 8; i++) { - createdDocuments.add(createDocument(client, 99)); - } - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private static Document getDocumentDefinition(int cnt) { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"prop\" : %d, " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, cnt, uuid)); - return doc; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/SinglePartitionReadFeedDocumentsTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/SinglePartitionReadFeedDocumentsTest.java deleted file mode 100644 index 6ea1db1f0c3b..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/SinglePartitionReadFeedDocumentsTest.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Observable; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -public class SinglePartitionReadFeedDocumentsTest extends TestSuiteBase { - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdDocuments; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public SinglePartitionReadFeedDocumentsTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = FEED_TIMEOUT) - public void readDocuments() { - final FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - final Observable> feedObservable = client.readDocuments(getCollectionLink(), options); - final int expectedPageSize = (createdDocuments.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(createdDocuments.size()) - .numberOfPages(expectedPageSize) - .exactlyContainsInAnyOrder(createdDocuments.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(feedObservable, validator, FEED_TIMEOUT); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY); - - List docDefList = new ArrayList<>(); - - for(int i = 0; i < 5; i++) { - docDefList.add(getDocumentDefinition()); - } - - createdDocuments = bulkInsertBlocking(client, getCollectionLink(), docDefList); - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } - - public String getCollectionLink() { - return "dbs/" + getDatabaseId() + "/colls/" + getCollectionId(); - } - - private String getCollectionId() { - return createdCollection.getId(); - } - - private String getDatabaseId() { - return createdDatabase.getId(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/SpyClientBuilder.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/SpyClientBuilder.java deleted file mode 100644 index 7e575659681e..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/SpyClientBuilder.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.rx.internal.SpyClientUnderTestFactory; - -public class SpyClientBuilder extends AsyncDocumentClient.Builder { - - public SpyClientBuilder(AsyncDocumentClient.Builder builder) { - super(); - super.configs = builder.configs; - super.connectionPolicy = builder.connectionPolicy; - super.desiredConsistencyLevel = builder.desiredConsistencyLevel; - super.masterKeyOrResourceToken = builder.masterKeyOrResourceToken; - super.serviceEndpoint = builder.serviceEndpoint; - } - - public SpyClientUnderTestFactory.ClientUnderTest build() { - return SpyClientUnderTestFactory.createClientUnderTest( - serviceEndpoint, - masterKeyOrResourceToken, - connectionPolicy, - desiredConsistencyLevel, - configs); - } - - public SpyClientUnderTestFactory.ClientWithGatewaySpy buildWithGatewaySpy() { - return SpyClientUnderTestFactory.createClientWithGatewaySpy( - serviceEndpoint, - masterKeyOrResourceToken, - connectionPolicy, - desiredConsistencyLevel, - configs); - } - - public SpyClientUnderTestFactory.DirectHttpsClientUnderTest buildWithDirectHttps() { - return SpyClientUnderTestFactory.createDirectHttpsClientUnderTest( - serviceEndpoint, - masterKeyOrResourceToken, - connectionPolicy, - desiredConsistencyLevel); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/StoredProcedureCrudTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/StoredProcedureCrudTest.java deleted file mode 100644 index e963d5322d5a..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/StoredProcedureCrudTest.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.UUID; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.StoredProcedure; - -import rx.Observable; - - -public class StoredProcedureCrudTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public StoredProcedureCrudTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createStoredProcedure() throws Exception { - - // create a stored procedure - StoredProcedure storedProcedureDef = new StoredProcedure(); - storedProcedureDef.setId(UUID.randomUUID().toString()); - storedProcedureDef.setBody("function() {var x = 10;}"); - - Observable> createObservable = client.createStoredProcedure(getCollectionLink(), storedProcedureDef, null); - - // validate stored procedure creation - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(storedProcedureDef.getId()) - .withStoredProcedureBody("function() {var x = 10;}") - .notNullEtag() - .build(); - validateSuccess(createObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void readStoredProcedure() throws Exception { - // create a stored procedure - StoredProcedure storedProcedureDef = new StoredProcedure(); - storedProcedureDef.setId(UUID.randomUUID().toString()); - storedProcedureDef.setBody("function() {var x = 10;}"); - StoredProcedure storedProcedure = client.createStoredProcedure(getCollectionLink(), storedProcedureDef, null).toBlocking().single().getResource(); - - // read stored procedure - waitIfNeededForReplicasToCatchUp(clientBuilder); - Observable> readObservable = client.readStoredProcedure(storedProcedure.getSelfLink(), null); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(storedProcedureDef.getId()) - .withStoredProcedureBody("function() {var x = 10;}") - .notNullEtag() - .build(); - validateSuccess(readObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void deleteStoredProcedure() throws Exception { - // create a stored procedure - StoredProcedure storedProcedureDef = new StoredProcedure(); - storedProcedureDef.setId(UUID.randomUUID().toString()); - storedProcedureDef.setBody("function() {var x = 10;}"); - StoredProcedure storedProcedure = client.createStoredProcedure(getCollectionLink(), storedProcedureDef, null).toBlocking().single().getResource(); - - // delete - Observable> deleteObservable = client.deleteStoredProcedure(storedProcedure.getSelfLink(), null); - - // validate - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .nullResource() - .build(); - validateSuccess(deleteObservable, validator); - - // attempt to read stored procedure which was deleted - waitIfNeededForReplicasToCatchUp(clientBuilder); - - Observable> readObservable = client.readStoredProcedure(storedProcedure.getSelfLink(), null); - FailureValidator notFoundValidator = new FailureValidator.Builder().resourceNotFound().build(); - validateFailure(readObservable, notFoundValidator); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION; - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private String getCollectionLink() { - return createdCollection.getSelfLink(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/StoredProcedureQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/StoredProcedureQueryTest.java deleted file mode 100644 index c10eb81aaf6e..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/StoredProcedureQueryTest.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.StoredProcedure; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - - -public class StoredProcedureQueryTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdStoredProcs = new ArrayList<>(); - - private AsyncDocumentClient client; - - public String getCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId()); - } - - @Factory(dataProvider = "clientBuildersWithDirect") - public StoredProcedureQueryTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryWithFilter() throws Exception { - - String filterId = createdStoredProcs.get(0).getId(); - String query = String.format("SELECT * from c where c.id = '%s'", filterId); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(5); - Observable> queryObservable = client - .queryStoredProcedures(getCollectionLink(), query, options); - - List expectedDocs = createdStoredProcs.stream().filter(sp -> filterId.equals(sp.getId()) ).collect(Collectors.toList()); - assertThat(expectedDocs).isNotEmpty(); - - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedDocs.size()) - .exactlyContainsInAnyOrder(expectedDocs.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - try { - validateQuerySuccess(queryObservable, validator, 10000); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void query_NoResults() throws Exception { - - String query = "SELECT * from root r where r.id = '2'"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryStoredProcedures(getCollectionLink(), query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(new ArrayList<>()) - .numberOfPages(1) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryAll() throws Exception { - - String query = "SELECT * from root"; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(3); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryStoredProcedures(getCollectionLink(), query, options); - - List expectedDocs = createdStoredProcs; - - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator - .Builder() - .exactlyContainsInAnyOrder(expectedDocs - .stream() - .map(d -> d.getResourceId()) - .collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - try { - validateQuerySuccess(queryObservable, validator); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void invalidQuerySytax() throws Exception { - String query = "I am an invalid query"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryStoredProcedures(getCollectionLink(), query, options); - - FailureValidator validator = new FailureValidator.Builder() - .instanceOf(DocumentClientException.class) - .statusCode(400) - .notNullActivityId() - .build(); - validateQueryFailure(queryObservable, validator); - } - - public StoredProcedure createStoredProc(AsyncDocumentClient client) { - StoredProcedure storedProcedure = getStoredProcedureDef(); - return client.createStoredProcedure(getCollectionLink(), storedProcedure, null).toBlocking().single().getResource(); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY); - - for(int i = 0; i < 5; i++) { - createdStoredProcs.add(createStoredProc(client)); - } - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private static StoredProcedure getStoredProcedureDef() { - StoredProcedure storedProcedureDef = new StoredProcedure(); - storedProcedureDef.setId(UUID.randomUUID().toString()); - storedProcedureDef.setBody("function() {var x = 10;}"); - return storedProcedureDef; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/StoredProcedureUpsertReplaceTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/StoredProcedureUpsertReplaceTest.java deleted file mode 100644 index 62870762d1b3..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/StoredProcedureUpsertReplaceTest.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.StoredProcedure; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; - -import rx.Observable; - -import javax.net.ssl.SSLException; - - -public class StoredProcedureUpsertReplaceTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public StoredProcedureUpsertReplaceTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void upsertStoredProcedure() throws Exception { - - // create a stored procedure - StoredProcedure storedProcedureDef = new StoredProcedure(); - storedProcedureDef.setId(UUID.randomUUID().toString()); - storedProcedureDef.setBody("function() {var x = 10;}"); - StoredProcedure readBackSp = client.upsertStoredProcedure(getCollectionLink(), storedProcedureDef, null).toBlocking().single().getResource(); - - //read back stored procedure - waitIfNeededForReplicasToCatchUp(clientBuilder); - Observable> readObservable = client.readStoredProcedure(readBackSp.getSelfLink(), null); - - // validate stored procedure creation - ResourceResponseValidator validatorForRead = new ResourceResponseValidator.Builder() - .withId(readBackSp.getId()) - .withStoredProcedureBody("function() {var x = 10;}") - .notNullEtag() - .build(); - validateSuccess(readObservable, validatorForRead); - - //update stored procedure - readBackSp.setBody("function() {var x = 11;}"); - - Observable> updateObservable = client.upsertStoredProcedure(getCollectionLink(), readBackSp, null); - - // validate stored procedure update - ResourceResponseValidator validatorForUpdate = new ResourceResponseValidator.Builder() - .withId(readBackSp.getId()) - .withStoredProcedureBody("function() {var x = 11;}") - .notNullEtag() - .build(); - validateSuccess(updateObservable, validatorForUpdate); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void replaceStoredProcedure() throws Exception { - - // create a stored procedure - StoredProcedure storedProcedureDef = new StoredProcedure(); - storedProcedureDef.setId(UUID.randomUUID().toString()); - storedProcedureDef.setBody("function() {var x = 10;}"); - StoredProcedure readBackSp = client.createStoredProcedure(getCollectionLink(), storedProcedureDef, null).toBlocking().single().getResource(); - - // read stored procedure to validate creation - waitIfNeededForReplicasToCatchUp(clientBuilder); - Observable> readObservable = client.readStoredProcedure(readBackSp.getSelfLink(), null); - - // validate stored procedure creation - ResourceResponseValidator validatorForRead = new ResourceResponseValidator.Builder() - .withId(readBackSp.getId()) - .withStoredProcedureBody("function() {var x = 10;}") - .notNullEtag() - .build(); - validateSuccess(readObservable, validatorForRead); - - //update stored procedure - readBackSp.setBody("function() {var x = 11;}"); - - Observable> replaceObservable = client.replaceStoredProcedure(readBackSp, null); - - //validate stored procedure replace - ResourceResponseValidator validatorForReplace = new ResourceResponseValidator.Builder() - .withId(readBackSp.getId()) - .withStoredProcedureBody("function() {var x = 11;}") - .notNullEtag() - .build(); - validateSuccess(replaceObservable, validatorForReplace); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void executeStoredProcedure() throws Exception { - // create a stored procedure - StoredProcedure storedProcedureDef = new StoredProcedure( - "{" + - " 'id': '" +UUID.randomUUID().toString() + "'," + - " 'body':" + - " 'function () {" + - " for (var i = 0; i < 10; i++) {" + - " getContext().getResponse().appendValue(\"Body\", i);" + - " }" + - " }'" + - "}"); - - StoredProcedure storedProcedure = null; - - try { - storedProcedure = client.createStoredProcedure(getCollectionLink(), storedProcedureDef, null).toBlocking().single().getResource(); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - - String result = null; - - try { - result = client.executeStoredProcedure(storedProcedure.getSelfLink(), null).toBlocking().single().getResponseAsString(); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - - assertThat(result).isEqualTo("\"0123456789\""); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private String getCollectionLink() { - return createdCollection.getSelfLink(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TestSuiteBase.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TestSuiteBase.java deleted file mode 100644 index d77fd497ccd4..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TestSuiteBase.java +++ /dev/null @@ -1,1010 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.spy; - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.microsoft.azure.cosmosdb.DataType; -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.IncludedPath; -import com.microsoft.azure.cosmosdb.Index; -import com.microsoft.azure.cosmosdb.IndexingPolicy; -import com.microsoft.azure.cosmosdb.RetryOptions; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.Undefined; -import com.microsoft.azure.cosmosdb.internal.PathParser; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import com.microsoft.azure.cosmosdb.rx.internal.Configs; -import org.apache.commons.lang3.StringUtils; -import org.mockito.stubbing.Answer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.AfterSuite; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.BeforeSuite; -import org.testng.annotations.DataProvider; - -import com.microsoft.azure.cosmosdb.CompositePath; -import com.microsoft.azure.cosmosdb.CompositePathSortOrder; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.User; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import org.testng.annotations.Test; -import rx.Observable; -import rx.observers.TestSubscriber; - -public class TestSuiteBase { - private static final int DEFAULT_BULK_INSERT_CONCURRENCY_LEVEL = 500; - private static final ObjectMapper objectMapper = new ObjectMapper(); - protected static Logger logger = LoggerFactory.getLogger(TestSuiteBase.class.getSimpleName()); - protected static final int TIMEOUT = 8000; - protected static final int FEED_TIMEOUT = 12000; - protected static final int SETUP_TIMEOUT = 30000; - protected static final int SHUTDOWN_TIMEOUT = 12000; - - protected static final int SUITE_SETUP_TIMEOUT = 120000; - protected static final int SUITE_SHUTDOWN_TIMEOUT = 60000; - - protected static final int WAIT_REPLICA_CATCH_UP_IN_MILLIS = 4000; - - protected int subscriberValidationTimeout = TIMEOUT; - - protected static ConsistencyLevel accountConsistency; - - protected Builder clientBuilder; - - protected static Database SHARED_DATABASE; - protected static DocumentCollection SHARED_MULTI_PARTITION_COLLECTION; - protected static DocumentCollection SHARED_SINGLE_PARTITION_COLLECTION; - protected static DocumentCollection SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - protected static DocumentCollection SHARED_MULTI_PARTITION_COLLECTION_WITH_COMPOSITE_AND_SPATIAL_INDEXES; - - - protected TestSuiteBase() { - objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - objectMapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); - objectMapper.configure(JsonParser.Feature.ALLOW_TRAILING_COMMA, true); - objectMapper.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true); - logger.debug("Initializing {} ...", this.getClass().getSimpleName()); - } - - @BeforeMethod(groups = { "simple", "long", "direct", "multi-master", "emulator", "non-emulator" }) - public void beforeMethod(Method method) { - if (this.clientBuilder != null) { - logger.info("Starting {}::{} using {} {} mode with {} consistency", - method.getDeclaringClass().getSimpleName(), method.getName(), - this.clientBuilder.connectionPolicy.getConnectionMode(), - this.clientBuilder.configs.getProtocol(), - this.clientBuilder.desiredConsistencyLevel); - return; - } - logger.info("Starting {}::{}", method.getDeclaringClass().getSimpleName(), method.getName()); - } - - @AfterMethod(groups = { "simple", "long", "direct", "multi-master", "emulator", "non-emulator" }) - public void afterMethod(Method m) { - Test t = m.getAnnotation(Test.class); - logger.info("Finished {}:{}.", m.getDeclaringClass().getSimpleName(), m.getName()); - } - - private static class DatabaseManagerImpl implements DatabaseForTest.DatabaseManager { - public static DatabaseManagerImpl getInstance(AsyncDocumentClient client) { - return new DatabaseManagerImpl(client); - } - - private final AsyncDocumentClient client; - - private DatabaseManagerImpl(AsyncDocumentClient client) { - this.client = client; - } - - @Override - public Observable> queryDatabases(SqlQuerySpec query) { - return client.queryDatabases(query, null); - } - - @Override - public Observable> createDatabase(Database databaseDefinition) { - return client.createDatabase(databaseDefinition, null); - } - - @Override - public Observable> deleteDatabase(String id) { - - return client.deleteDatabase("dbs/" + id, null); - } - } - - @BeforeSuite(groups = { "simple", "long", "direct", "multi-master", "emulator", "non-emulator" }, timeOut = SUITE_SETUP_TIMEOUT) - public static void beforeSuite() { - logger.info("beforeSuite Started"); - AsyncDocumentClient houseKeepingClient = createGatewayHouseKeepingDocumentClient().build(); - try { - DatabaseForTest dbForTest = DatabaseForTest.create(DatabaseManagerImpl.getInstance(houseKeepingClient)); - SHARED_DATABASE = dbForTest.createdDatabase; - RequestOptions options = new RequestOptions(); - options.setOfferThroughput(10100); - SHARED_MULTI_PARTITION_COLLECTION = createCollection(houseKeepingClient, SHARED_DATABASE.getId(), getCollectionDefinitionWithRangeRangeIndex(), options); - SHARED_SINGLE_PARTITION_COLLECTION = createCollection(houseKeepingClient, SHARED_DATABASE.getId(), getCollectionDefinition(), null); - SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY = createCollection(houseKeepingClient, SHARED_DATABASE.getId(), getCollectionDefinitionSinglePartitionWithoutPartitionKey()); - SHARED_MULTI_PARTITION_COLLECTION_WITH_COMPOSITE_AND_SPATIAL_INDEXES = createCollection(houseKeepingClient, SHARED_DATABASE.getId(), getCollectionDefinitionMultiPartitionWithCompositeAndSpatialIndexes(), options); - } finally { - houseKeepingClient.close(); - } - } - - @AfterSuite(groups = { "simple", "long", "direct", "multi-master", "emulator", "non-emulator" }, timeOut = SUITE_SHUTDOWN_TIMEOUT) - public static void afterSuite() { - logger.info("afterSuite Started"); - AsyncDocumentClient houseKeepingClient = createGatewayHouseKeepingDocumentClient().build(); - try { - safeDeleteDatabase(houseKeepingClient, SHARED_DATABASE); - DatabaseForTest.cleanupStaleTestDatabases(DatabaseManagerImpl.getInstance(houseKeepingClient)); - } finally { - safeClose(houseKeepingClient); - } - } - - protected static void truncateCollection(DocumentCollection collection) { - logger.info("Truncating collection {} ...", collection.getId()); - AsyncDocumentClient houseKeepingClient = createGatewayHouseKeepingDocumentClient().build(); - try { - List paths = collection.getPartitionKey().getPaths(); - - FeedOptions options = new FeedOptions(); - options.setMaxDegreeOfParallelism(-1); - options.setEnableCrossPartitionQuery(true); - options.setMaxItemCount(100); - - logger.info("Truncating collection {} documents ...", collection.getId()); - - houseKeepingClient.queryDocuments(collection.getSelfLink(), "SELECT * FROM root", options) - .flatMap(page -> Observable.from(page.getResults())) - .flatMap(doc -> { - RequestOptions requestOptions = new RequestOptions(); - - if (paths != null && !paths.isEmpty()) { - List pkPath = PathParser.getPathParts(paths.get(0)); - Object propertyValue = doc.getObjectByPath(pkPath); - if (propertyValue == null) { - propertyValue = Undefined.Value(); - } - - requestOptions.setPartitionKey(new PartitionKey(propertyValue)); - } - - return houseKeepingClient.deleteDocument(doc.getSelfLink(), requestOptions); - }).toCompletable().await(); - - logger.info("Truncating collection {} triggers ...", collection.getId()); - - houseKeepingClient.queryTriggers(collection.getSelfLink(), "SELECT * FROM root", options) - .flatMap(page -> Observable.from(page.getResults())) - .flatMap(trigger -> { - RequestOptions requestOptions = new RequestOptions(); - -// if (paths != null && !paths.isEmpty()) { -// Object propertyValue = trigger.getObjectByPath(PathParser.getPathParts(paths.get(0))); -// requestOptions.setPartitionKey(new PartitionKey(propertyValue)); -// } - - return houseKeepingClient.deleteTrigger(trigger.getSelfLink(), requestOptions); - }).toCompletable().await(); - - logger.info("Truncating collection {} storedProcedures ...", collection.getId()); - - houseKeepingClient.queryStoredProcedures(collection.getSelfLink(), "SELECT * FROM root", options) - .flatMap(page -> Observable.from(page.getResults())) - .flatMap(storedProcedure -> { - RequestOptions requestOptions = new RequestOptions(); - -// if (paths != null && !paths.isEmpty()) { -// Object propertyValue = storedProcedure.getObjectByPath(PathParser.getPathParts(paths.get(0))); -// requestOptions.setPartitionKey(new PartitionKey(propertyValue)); -// } - - return houseKeepingClient.deleteStoredProcedure(storedProcedure.getSelfLink(), requestOptions); - }).toCompletable().await(); - - logger.info("Truncating collection {} udfs ...", collection.getId()); - - houseKeepingClient.queryUserDefinedFunctions(collection.getSelfLink(), "SELECT * FROM root", options) - .flatMap(page -> Observable.from(page.getResults())) - .flatMap(udf -> { - RequestOptions requestOptions = new RequestOptions(); - -// if (paths != null && !paths.isEmpty()) { -// Object propertyValue = udf.getObjectByPath(PathParser.getPathParts(paths.get(0))); -// requestOptions.setPartitionKey(new PartitionKey(propertyValue)); -// } - - return houseKeepingClient.deleteUserDefinedFunction(udf.getSelfLink(), requestOptions); - }).toCompletable().await(); - - } finally { - houseKeepingClient.close(); - } - - logger.info("Finished truncating collection {}.", collection.getId()); - } - - protected static void waitIfNeededForReplicasToCatchUp(Builder clientBuilder) { - switch (clientBuilder.desiredConsistencyLevel) { - case Eventual: - case ConsistentPrefix: - logger.info(" additional wait in Eventual mode so the replica catch up"); - // give times to replicas to catch up after a write - try { - TimeUnit.MILLISECONDS.sleep(WAIT_REPLICA_CATCH_UP_IN_MILLIS); - } catch (Exception e) { - logger.error("unexpected failure", e); - } - - case Session: - case BoundedStaleness: - case Strong: - default: - break; - } - } - - private static DocumentCollection getCollectionDefinitionSinglePartitionWithoutPartitionKey() { - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - - return collectionDefinition; - } - - - public static DocumentCollection createCollection(String databaseId, - DocumentCollection collection, - RequestOptions options) { - AsyncDocumentClient client = createGatewayHouseKeepingDocumentClient().build(); - try { - return client.createCollection("dbs/" + databaseId, collection, options).toBlocking().single().getResource(); - } finally { - client.close(); - } - } - - public static DocumentCollection createCollection(AsyncDocumentClient client, String databaseId, - DocumentCollection collection, RequestOptions options) { - return client.createCollection("dbs/" + databaseId, collection, options).toBlocking().single().getResource(); - } - - public static DocumentCollection createCollection(AsyncDocumentClient client, String databaseId, - DocumentCollection collection) { - return client.createCollection("dbs/" + databaseId, collection, null).toBlocking().single().getResource(); - } - - private static DocumentCollection getCollectionDefinitionMultiPartitionWithCompositeAndSpatialIndexes() { - final String NUMBER_FIELD = "numberField"; - final String STRING_FIELD = "stringField"; - final String NUMBER_FIELD_2 = "numberField2"; - final String STRING_FIELD_2 = "stringField2"; - final String BOOL_FIELD = "boolField"; - final String NULL_FIELD = "nullField"; - final String OBJECT_FIELD = "objectField"; - final String ARRAY_FIELD = "arrayField"; - final String SHORT_STRING_FIELD = "shortStringField"; - final String MEDIUM_STRING_FIELD = "mediumStringField"; - final String LONG_STRING_FIELD = "longStringField"; - final String PARTITION_KEY = "pk"; - - DocumentCollection documentCollection = new DocumentCollection(); - - IndexingPolicy indexingPolicy = new IndexingPolicy(); - Collection> compositeIndexes = new ArrayList>(); - - //Simple - ArrayList compositeIndexSimple = new ArrayList(); - CompositePath compositePath1 = new CompositePath(); - compositePath1.setPath("/" + NUMBER_FIELD); - compositePath1.setOrder(CompositePathSortOrder.Ascending); - - CompositePath compositePath2 = new CompositePath(); - compositePath2.setPath("/" + STRING_FIELD); - compositePath2.setOrder(CompositePathSortOrder.Descending); - - compositeIndexSimple.add(compositePath1); - compositeIndexSimple.add(compositePath2); - - //Max Columns - ArrayList compositeIndexMaxColumns = new ArrayList(); - CompositePath compositePath3 = new CompositePath(); - compositePath3.setPath("/" + NUMBER_FIELD); - compositePath3.setOrder(CompositePathSortOrder.Descending); - - CompositePath compositePath4 = new CompositePath(); - compositePath4.setPath("/" + STRING_FIELD); - compositePath4.setOrder(CompositePathSortOrder.Ascending); - - CompositePath compositePath5 = new CompositePath(); - compositePath5.setPath("/" + NUMBER_FIELD_2); - compositePath5.setOrder(CompositePathSortOrder.Descending); - - CompositePath compositePath6 = new CompositePath(); - compositePath6.setPath("/" + STRING_FIELD_2); - compositePath6.setOrder(CompositePathSortOrder.Ascending); - - compositeIndexMaxColumns.add(compositePath3); - compositeIndexMaxColumns.add(compositePath4); - compositeIndexMaxColumns.add(compositePath5); - compositeIndexMaxColumns.add(compositePath6); - - //Primitive Values - ArrayList compositeIndexPrimitiveValues = new ArrayList(); - CompositePath compositePath7 = new CompositePath(); - compositePath7.setPath("/" + NUMBER_FIELD); - compositePath7.setOrder(CompositePathSortOrder.Descending); - - CompositePath compositePath8 = new CompositePath(); - compositePath8.setPath("/" + STRING_FIELD); - compositePath8.setOrder(CompositePathSortOrder.Ascending); - - CompositePath compositePath9 = new CompositePath(); - compositePath9.setPath("/" + BOOL_FIELD); - compositePath9.setOrder(CompositePathSortOrder.Descending); - - CompositePath compositePath10 = new CompositePath(); - compositePath10.setPath("/" + NULL_FIELD); - compositePath10.setOrder(CompositePathSortOrder.Ascending); - - compositeIndexPrimitiveValues.add(compositePath7); - compositeIndexPrimitiveValues.add(compositePath8); - compositeIndexPrimitiveValues.add(compositePath9); - compositeIndexPrimitiveValues.add(compositePath10); - - //Long Strings - ArrayList compositeIndexLongStrings = new ArrayList(); - CompositePath compositePath11 = new CompositePath(); - compositePath11.setPath("/" + STRING_FIELD); - - CompositePath compositePath12 = new CompositePath(); - compositePath12.setPath("/" + SHORT_STRING_FIELD); - - CompositePath compositePath13 = new CompositePath(); - compositePath13.setPath("/" + MEDIUM_STRING_FIELD); - - CompositePath compositePath14 = new CompositePath(); - compositePath14.setPath("/" + LONG_STRING_FIELD); - - compositeIndexLongStrings.add(compositePath11); - compositeIndexLongStrings.add(compositePath12); - compositeIndexLongStrings.add(compositePath13); - compositeIndexLongStrings.add(compositePath14); - - compositeIndexes.add(compositeIndexSimple); - compositeIndexes.add(compositeIndexMaxColumns); - compositeIndexes.add(compositeIndexPrimitiveValues); - compositeIndexes.add(compositeIndexLongStrings); - - indexingPolicy.setCompositeIndexes(compositeIndexes); - documentCollection.setIndexingPolicy(indexingPolicy); - - PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition(); - ArrayList partitionKeyPaths = new ArrayList(); - partitionKeyPaths.add("/" + PARTITION_KEY); - partitionKeyDefinition.setPaths(partitionKeyPaths); - documentCollection.setPartitionKey(partitionKeyDefinition); - - documentCollection.setId(UUID.randomUUID().toString()); - - return documentCollection; - } - - public static Document createDocument(AsyncDocumentClient client, String databaseId, String collectionId, Document document) { - return createDocument(client, databaseId, collectionId, document, null); - } - - public static Document createDocument(AsyncDocumentClient client, String databaseId, String collectionId, Document document, RequestOptions options) { - return client.createDocument(Utils.getCollectionNameLink(databaseId, collectionId), document, options, false).toBlocking().single().getResource(); - } - - public Observable> bulkInsert(AsyncDocumentClient client, - String collectionLink, - List documentDefinitionList, - int concurrencyLevel) { - ArrayList>> result = new ArrayList>>(documentDefinitionList.size()); - for (Document docDef : documentDefinitionList) { - result.add(client.createDocument(collectionLink, docDef, null, false)); - } - - return Observable.merge(result, concurrencyLevel); - } - - public Observable> bulkInsert(AsyncDocumentClient client, - String collectionLink, - List documentDefinitionList) { - return bulkInsert(client, collectionLink, documentDefinitionList, DEFAULT_BULK_INSERT_CONCURRENCY_LEVEL); - } - - public List bulkInsertBlocking(AsyncDocumentClient client, - String collectionLink, - List documentDefinitionList) { - return bulkInsert(client, collectionLink, documentDefinitionList, DEFAULT_BULK_INSERT_CONCURRENCY_LEVEL) - .map(ResourceResponse::getResource) - .toList() - .toBlocking() - .single(); - } - - public static ConsistencyLevel getAccountDefaultConsistencyLevel(AsyncDocumentClient client) { - return client.getDatabaseAccount().toBlocking().single().getConsistencyPolicy().getDefaultConsistencyLevel(); - } - - public static User createUser(AsyncDocumentClient client, String databaseId, User user) { - return client.createUser("dbs/" + databaseId, user, null).toBlocking().single().getResource(); - } - - public static User safeCreateUser(AsyncDocumentClient client, String databaseId, User user) { - deleteUserIfExists(client, databaseId, user.getId()); - return createUser(client, databaseId, user); - } - - private static DocumentCollection safeCreateCollection(AsyncDocumentClient client, String databaseId, DocumentCollection collection, RequestOptions options) { - deleteCollectionIfExists(client, databaseId, collection.getId()); - return createCollection(client, databaseId, collection, options); - } - - public static String getCollectionLink(DocumentCollection collection) { - return collection.getSelfLink(); - } - - static protected DocumentCollection getCollectionDefinition() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - collectionDefinition.setPartitionKey(partitionKeyDef); - - return collectionDefinition; - } - - static protected DocumentCollection getCollectionDefinitionWithRangeRangeIndex() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList<>(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - IndexingPolicy indexingPolicy = new IndexingPolicy(); - Collection includedPaths = new ArrayList<>(); - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath("/*"); - Collection indexes = new ArrayList<>(); - Index stringIndex = Index.Range(DataType.String); - stringIndex.set("precision", -1); - indexes.add(stringIndex); - - Index numberIndex = Index.Range(DataType.Number); - numberIndex.set("precision", -1); - indexes.add(numberIndex); - includedPath.setIndexes(indexes); - includedPaths.add(includedPath); - indexingPolicy.setIncludedPaths(includedPaths); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setIndexingPolicy(indexingPolicy); - collectionDefinition.setId(UUID.randomUUID().toString()); - collectionDefinition.setPartitionKey(partitionKeyDef); - - return collectionDefinition; - } - - public static void deleteCollectionIfExists(AsyncDocumentClient client, String databaseId, String collectionId) { - List res = client.queryCollections("dbs/" + databaseId, - String.format("SELECT * FROM root r where r.id = '%s'", collectionId), null).toBlocking().single() - .getResults(); - if (!res.isEmpty()) { - deleteCollection(client, Utils.getCollectionNameLink(databaseId, collectionId)); - } - } - - public static void deleteCollection(AsyncDocumentClient client, String collectionLink) { - client.deleteCollection(collectionLink, null).toBlocking().single(); - } - - public static void deleteDocumentIfExists(AsyncDocumentClient client, String databaseId, String collectionId, String docId) { - FeedOptions options = new FeedOptions(); - options.setPartitionKey(new PartitionKey(docId)); - List res = client - .queryDocuments(Utils.getCollectionNameLink(databaseId, collectionId), String.format("SELECT * FROM root r where r.id = '%s'", docId), options) - .toBlocking().single().getResults(); - if (!res.isEmpty()) { - deleteDocument(client, Utils.getDocumentNameLink(databaseId, collectionId, docId)); - } - } - - public static void safeDeleteDocument(AsyncDocumentClient client, String documentLink, RequestOptions options) { - if (client != null && documentLink != null) { - try { - client.deleteDocument(documentLink, options).toBlocking().single(); - } catch (Exception e) { - DocumentClientException dce = com.microsoft.azure.cosmosdb.rx.internal.Utils.as(e, DocumentClientException.class); - if (dce == null || dce.getStatusCode() != 404) { - throw e; - } - } - } - } - - public static void deleteDocument(AsyncDocumentClient client, String documentLink) { - client.deleteDocument(documentLink, null).toBlocking().single(); - } - - public static void deleteUserIfExists(AsyncDocumentClient client, String databaseId, String userId) { - List res = client - .queryUsers("dbs/" + databaseId, String.format("SELECT * FROM root r where r.id = '%s'", userId), null) - .toBlocking().single().getResults(); - if (!res.isEmpty()) { - deleteUser(client, Utils.getUserNameLink(databaseId, userId)); - } - } - - public static void deleteUser(AsyncDocumentClient client, String userLink) { - client.deleteUser(userLink, null).toBlocking().single(); - } - - public static String getDatabaseLink(Database database) { - return database.getSelfLink(); - } - - static private Database safeCreateDatabase(AsyncDocumentClient client, Database database) { - safeDeleteDatabase(client, database.getId()); - return createDatabase(client, database); - } - - static protected Database createDatabase(AsyncDocumentClient client, Database database) { - Observable> databaseObservable = client.createDatabase(database, null); - return databaseObservable.toBlocking().single().getResource(); - } - - static protected Database createDatabase(AsyncDocumentClient client, String databaseId) { - Database databaseDefinition = new Database(); - databaseDefinition.setId(databaseId); - return createDatabase(client, databaseDefinition); - } - - static protected Database createDatabaseIfNotExists(AsyncDocumentClient client, String databaseId) { - return client.queryDatabases(String.format("SELECT * FROM r where r.id = '%s'", databaseId), null).flatMap(p -> Observable.from(p.getResults())).switchIfEmpty( - Observable.defer(() -> { - - Database databaseDefinition = new Database(); - databaseDefinition.setId(databaseId); - - return client.createDatabase(databaseDefinition, null).map(ResourceResponse::getResource); - }) - ).toBlocking().single(); - } - - static protected void safeDeleteDatabase(AsyncDocumentClient client, Database database) { - if (database != null) { - safeDeleteDatabase(client, database.getId()); - } - } - - static protected void safeDeleteDatabase(AsyncDocumentClient client, String databaseId) { - if (client != null) { - try { - client.deleteDatabase(Utils.getDatabaseNameLink(databaseId), null).toBlocking().single(); - } catch (Exception e) { - } - } - } - - static protected void safeDeleteAllCollections(AsyncDocumentClient client, Database database) { - if (database != null) { - List collections = client.readCollections(database.getSelfLink(), null) - .flatMap(p -> Observable.from(p.getResults())) - .toList() - .toBlocking() - .single(); - - for(DocumentCollection collection: collections) { - client.deleteCollection(collection.getSelfLink(), null).toBlocking().single().getResource(); - } - } - } - - static protected void safeDeleteCollection(AsyncDocumentClient client, DocumentCollection collection) { - if (client != null && collection != null) { - try { - client.deleteCollection(collection.getSelfLink(), null).toBlocking().single(); - } catch (Exception e) { - } - } - } - - static protected void safeDeleteCollection(AsyncDocumentClient client, String databaseId, String collectionId) { - if (client != null && databaseId != null && collectionId != null) { - try { - client.deleteCollection("/dbs/" + databaseId + "/colls/" + collectionId, null).toBlocking().single(); - } catch (Exception e) { - } - } - } - - static protected void safeClose(AsyncDocumentClient client) { - if (client != null) { - try { - client.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - public void validateSuccess(Observable> observable, - ResourceResponseValidator validator) { - validateSuccess(observable, validator, subscriberValidationTimeout); - } - - public static void validateSuccess(Observable> observable, - ResourceResponseValidator validator, long timeout) { - - VerboseTestSubscriber> testSubscriber = new VerboseTestSubscriber<>(); - - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - public void validateFailure(Observable> observable, - FailureValidator validator) { - validateFailure(observable, validator, subscriberValidationTimeout); - } - - public static void validateFailure(Observable> observable, - FailureValidator validator, long timeout) { - - VerboseTestSubscriber> testSubscriber = new VerboseTestSubscriber<>(); - - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - validator.validate(testSubscriber.getOnErrorEvents().get(0)); - } - - public void validateQuerySuccess(Observable> observable, - FeedResponseListValidator validator) { - validateQuerySuccess(observable, validator, subscriberValidationTimeout); - } - - public static void validateQuerySuccess(Observable> observable, - FeedResponseListValidator validator, long timeout) { - - VerboseTestSubscriber> testSubscriber = new VerboseTestSubscriber<>(); - - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - validator.validate(testSubscriber.getOnNextEvents()); - } - - public void validateQueryFailure(Observable> observable, - FailureValidator validator) { - validateQueryFailure(observable, validator, subscriberValidationTimeout); - } - - public static void validateQueryFailure(Observable> observable, - FailureValidator validator, long timeout) { - - VerboseTestSubscriber> testSubscriber = new VerboseTestSubscriber<>(); - - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - validator.validate(testSubscriber.getOnErrorEvents().get(0)); - } - - @DataProvider - public static Object[][] clientBuilders() { - return new Object[][] { { createGatewayRxDocumentClient(ConsistencyLevel.Session, false, null) } }; - } - - @DataProvider - public static Object[][] clientBuildersWithSessionConsistency() { - return new Object[][] { - { createGatewayRxDocumentClient(ConsistencyLevel.Session, false, null) }, - { createDirectRxDocumentClient(ConsistencyLevel.Session, Protocol.Https, false, null) }, - { createDirectRxDocumentClient(ConsistencyLevel.Session, Protocol.Tcp, false, null) } - }; - } - - private static ConsistencyLevel parseConsistency(String consistency) { - if (consistency != null) { - for (ConsistencyLevel consistencyLevel : ConsistencyLevel.values()) { - if (consistencyLevel.name().toLowerCase().equals(consistency.toLowerCase())) { - return consistencyLevel; - } - } - } - - logger.error("Invalid configured test consistency [{}].", consistency); - throw new IllegalStateException("Invalid configured test consistency " + consistency); - } - - private static List parsePreferredLocation(String preferredLocations) { - if (StringUtils.isEmpty(preferredLocations)) { - return null; - } - - try { - return objectMapper.readValue(preferredLocations, new TypeReference>(){}); - } catch (Exception e) { - logger.error("Invalid configured test preferredLocations [{}].", preferredLocations); - throw new IllegalStateException("Invalid configured test preferredLocations " + preferredLocations); - } - } - - @DataProvider - public static Object[][] simpleClientBuildersWithDirect() { - return simpleClientBuildersWithDirect(Protocol.Https, Protocol.Tcp); - } - - @DataProvider - public static Object[][] simpleClientBuildersWithDirectHttps() { - return simpleClientBuildersWithDirect(Protocol.Https); - } - - @DataProvider - public static Object[][] simpleClientBuildersWithDirectTcp() { - return simpleClientBuildersWithDirect(Protocol.Tcp); - } - - private static Object[][] simpleClientBuildersWithDirect(Protocol... protocols) { - - accountConsistency = parseConsistency(TestConfigurations.CONSISTENCY); - logger.info("Max test consistency to use is [{}]", accountConsistency); - List testConsistencies = new ArrayList<>(); - - switch (accountConsistency) { - case Strong: - case BoundedStaleness: - case Session: - case ConsistentPrefix: - case Eventual: - testConsistencies.add(ConsistencyLevel.Eventual); - break; - default: - throw new IllegalStateException("Invalid configured test consistency " + accountConsistency); - } - - List preferredLocation = parsePreferredLocation(TestConfigurations.PREFERRED_LOCATIONS); - boolean isMultiMasterEnabled = preferredLocation != null && accountConsistency == ConsistencyLevel.Session; - - List builders = new ArrayList<>(); - builders.add(createGatewayRxDocumentClient(ConsistencyLevel.Session, false, null)); - - for (Protocol protocol : protocols) { - testConsistencies.forEach(consistencyLevel -> builders.add(createDirectRxDocumentClient(consistencyLevel, - protocol, - isMultiMasterEnabled, - preferredLocation))); - } - - builders.forEach(b -> logger.info("Will Use ConnectionMode [{}], Consistency [{}], Protocol [{}]", - b.connectionPolicy.getConnectionMode(), - b.desiredConsistencyLevel, - b.configs.getProtocol() - )); - - return builders.stream().map(b -> new Object[]{b}).collect(Collectors.toList()).toArray(new Object[0][]); - } - - @DataProvider - public static Object[][] clientBuildersWithDirect() { - return clientBuildersWithDirectAllConsistencies(Protocol.Https, Protocol.Tcp); - } - - @DataProvider - public static Object[][] clientBuildersWithDirectHttps() { - return clientBuildersWithDirectAllConsistencies(Protocol.Https); - } - - @DataProvider - public static Object[][] clientBuildersWithDirectTcp() { - return clientBuildersWithDirectAllConsistencies(Protocol.Tcp); - } - - @DataProvider - public static Object[][] clientBuildersWithDirectSession() { - return clientBuildersWithDirectSession(Protocol.Https, Protocol.Tcp); - } - - private static Object[][] clientBuildersWithDirectSession(Protocol... protocols) { - return clientBuildersWithDirect(new ArrayList(){{add(ConsistencyLevel.Session);}} , protocols); - } - - private static Object[][] clientBuildersWithDirectAllConsistencies(Protocol... protocols) { - accountConsistency = parseConsistency(TestConfigurations.CONSISTENCY); - logger.info("Max test consistency to use is [{}]", accountConsistency); - List testConsistencies = new ArrayList<>(); - - switch (accountConsistency) { - case Strong: - testConsistencies.add(ConsistencyLevel.Strong); - case BoundedStaleness: - testConsistencies.add(ConsistencyLevel.BoundedStaleness); - case Session: - testConsistencies.add(ConsistencyLevel.Session); - case ConsistentPrefix: - testConsistencies.add(ConsistencyLevel.ConsistentPrefix); - case Eventual: - testConsistencies.add(ConsistencyLevel.Eventual); - break; - default: - throw new IllegalStateException("Invalid configured test consistency " + accountConsistency); - } - return clientBuildersWithDirect(testConsistencies, protocols); - } - - private static Object[][] clientBuildersWithDirect(List testConsistencies, Protocol... protocols) { - - List preferredLocation = parsePreferredLocation(TestConfigurations.PREFERRED_LOCATIONS); - boolean isMultiMasterEnabled = preferredLocation != null && accountConsistency == ConsistencyLevel.Session; - - List builders = new ArrayList<>(); - builders.add(createGatewayRxDocumentClient(ConsistencyLevel.Session, isMultiMasterEnabled, preferredLocation)); - - for (Protocol protocol : protocols) { - testConsistencies.forEach(consistencyLevel -> builders.add(createDirectRxDocumentClient(consistencyLevel, - protocol, - isMultiMasterEnabled, - preferredLocation))); - } - - builders.forEach(b -> logger.info("Will Use ConnectionMode [{}], Consistency [{}], Protocol [{}]", - b.connectionPolicy.getConnectionMode(), - b.desiredConsistencyLevel, - b.configs.getProtocol() - )); - - return builders.stream().map(b -> new Object[]{b}).collect(Collectors.toList()).toArray(new Object[0][]); - } - - static protected Builder createGatewayHouseKeepingDocumentClient() { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - RetryOptions options = new RetryOptions(); - options.setMaxRetryWaitTimeInSeconds(SUITE_SETUP_TIMEOUT); - connectionPolicy.setRetryOptions(options); - return new Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session); - } - - static protected Builder createGatewayRxDocumentClient(ConsistencyLevel consistencyLevel, boolean multiMasterEnabled, List preferredLocations) { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - connectionPolicy.setUsingMultipleWriteLocations(multiMasterEnabled); - connectionPolicy.setPreferredLocations(preferredLocations); - return new Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(consistencyLevel); - } - - static protected Builder createGatewayRxDocumentClient() { - return createGatewayRxDocumentClient(ConsistencyLevel.Session, false, null); - } - - static protected Builder createDirectRxDocumentClient(ConsistencyLevel consistencyLevel, - Protocol protocol, - boolean multiMasterEnabled, - List preferredLocations) { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - - if (preferredLocations != null) { - connectionPolicy.setPreferredLocations(preferredLocations); - } - - if (multiMasterEnabled && consistencyLevel == ConsistencyLevel.Session) { - connectionPolicy.setUsingMultipleWriteLocations(true); - } - - Configs configs = spy(new Configs()); - doAnswer((Answer)invocation -> protocol).when(configs).getProtocol(); - - return new Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(consistencyLevel) - .withConfigs(configs); - } - - protected int expectedNumberOfPages(int totalExpectedResult, int maxPageSize) { - return Math.max((totalExpectedResult + maxPageSize - 1 ) / maxPageSize, 1); - } - - @DataProvider(name = "queryMetricsArgProvider") - public Object[][] queryMetricsArgProvider() { - return new Object[][]{ - {true}, - {false}, - }; - } - - public static class VerboseTestSubscriber extends TestSubscriber { - @Override - public void assertNoErrors() { - List onErrorEvents = getOnErrorEvents(); - StringBuilder errorMessageBuilder = new StringBuilder(); - if (!onErrorEvents.isEmpty()) { - for(Throwable throwable : onErrorEvents) { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - throwable.printStackTrace(pw); - String sStackTrace = sw.toString(); // stack trace as a string - errorMessageBuilder.append(sStackTrace); - } - - AssertionError ae = new AssertionError(errorMessageBuilder.toString()); - throw ae; - } - } - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TokenResolverTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TokenResolverTest.java deleted file mode 100644 index cc9ea0fef0f8..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TokenResolverTest.java +++ /dev/null @@ -1,566 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ChangeFeedOptions; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.CosmosResourceType; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.Permission; -import com.microsoft.azure.cosmosdb.PermissionMode; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.StoredProcedure; -import com.microsoft.azure.cosmosdb.StoredProcedureResponse; -import com.microsoft.azure.cosmosdb.TokenResolver; -import com.microsoft.azure.cosmosdb.User; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; - -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Observable; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.UUID; -import java.util.Map; - -public class TokenResolverTest extends TestSuiteBase { - - private class UserClass { - public String userName; - public int userId; - - public UserClass(String userName, int userId) { - this.userName = userName; - this.userId = userId; - } - } - - private Database createdDatabase; - private DocumentCollection createdCollection; - private User userWithReadPermission; - private User userWithAllPermission; - - private Permission readPermission; - private Permission allPermission; - - private AsyncDocumentClient.Builder clientBuilder; - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuilders") - public TokenResolverTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @DataProvider(name = "connectionMode") - public Object[][] connectionMode() { - return new Object[][]{ - {ConnectionMode.Gateway}, - {ConnectionMode.Direct}, - }; - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION; - - client = clientBuilder.build(); - - userWithReadPermission = createUser(client, createdDatabase.getId(), getUserDefinition()); - readPermission = client.createPermission(userWithReadPermission.getSelfLink(), getPermission(createdCollection, "ReadPermissionOnColl", PermissionMode.Read), null).toBlocking().single() - .getResource(); - - userWithAllPermission = createUser(client, createdDatabase.getId(), getUserDefinition()); - allPermission = client.createPermission(userWithAllPermission.getSelfLink(), getPermission(createdCollection, "AllPermissionOnColl", PermissionMode.All), null).toBlocking().single() - .getResource(); - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) - public void readDocumentWithReadPermission(ConnectionMode connectionMode) { - Document docDefinition = getDocumentDefinition(); - ResourceResponse resourceResponse = client - .createDocument(BridgeInternal.getAltLink(createdCollection), docDefinition, null, false).toBlocking().first(); - AsyncDocumentClient asyncClientWithTokenResolver = null; - try { - asyncClientWithTokenResolver = buildClient(connectionMode, PermissionMode.Read); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(resourceResponse.getResource().get("mypk"))); - HashMap properties = new HashMap(); - properties.put("UserId", "readUser"); - requestOptions.setProperties(properties); - Observable> readObservable = asyncClientWithTokenResolver.readDocument(resourceResponse.getResource().getSelfLink(), requestOptions); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(resourceResponse.getResource().getId()).build(); - validateSuccess(readObservable, validator); - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) - public void deleteDocumentWithReadPermission(ConnectionMode connectionMode) { - Document docDefinition = getDocumentDefinition(); - ResourceResponse resourceResponse = client - .createDocument(BridgeInternal.getAltLink(createdCollection), docDefinition, null, false).toBlocking().first(); - AsyncDocumentClient asyncClientWithTokenResolver = null; - try { - asyncClientWithTokenResolver = buildClient(connectionMode, PermissionMode.Read); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(resourceResponse.getResource().get("mypk"))); - Observable> readObservable = asyncClientWithTokenResolver.deleteDocument(resourceResponse.getResource().getSelfLink(), requestOptions); - FailureValidator validator = new FailureValidator.Builder().statusCode(HttpConstants.StatusCodes.FORBIDDEN).build(); - validateFailure(readObservable, validator); - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) - public void writeDocumentWithReadPermission(ConnectionMode connectionMode) { - AsyncDocumentClient asyncClientWithTokenResolver = null; - try { - asyncClientWithTokenResolver = buildClient(connectionMode, PermissionMode.Read); - Observable> readObservable = asyncClientWithTokenResolver.createDocument(createdCollection.getSelfLink(), getDocumentDefinition(), null, true); - FailureValidator validator = new FailureValidator.Builder().statusCode(HttpConstants.StatusCodes.FORBIDDEN).build(); - validateFailure(readObservable, validator); - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) - public void writeDocumentWithAllPermission(ConnectionMode connectionMode) { - AsyncDocumentClient asyncClientWithTokenResolver = null; - try { - asyncClientWithTokenResolver = buildClient(connectionMode, PermissionMode.All); - Document documentDefinition = getDocumentDefinition(); - Observable> readObservable = asyncClientWithTokenResolver.createDocument(createdCollection.getSelfLink(), documentDefinition, null, true); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(documentDefinition.getId()).build(); - validateSuccess(readObservable, validator); - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) - public void deleteDocumentWithAllPermission(ConnectionMode connectionMode) { - Document docDefinition = getDocumentDefinition(); - ResourceResponse resourceResponse = client - .createDocument(BridgeInternal.getAltLink(createdCollection), docDefinition, null, false).toBlocking().first(); - AsyncDocumentClient asyncClientWithTokenResolver = null; - try { - asyncClientWithTokenResolver = buildClient(connectionMode, PermissionMode.All); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(resourceResponse.getResource().get("mypk"))); - Observable> readObservable = asyncClientWithTokenResolver.deleteDocument(resourceResponse.getResource().getSelfLink(), requestOptions); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .nullResource().build(); - validateSuccess(readObservable, validator); - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) - public void readCollectionWithReadPermission(ConnectionMode connectionMode) { - AsyncDocumentClient asyncClientWithTokenResolver = null; - try { - asyncClientWithTokenResolver = buildClient(connectionMode, PermissionMode.Read); - Observable> readObservable = asyncClientWithTokenResolver.readCollection(createdCollection.getSelfLink(), null); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(createdCollection.getId()).build(); - validateSuccess(readObservable, validator); - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) - public void deleteCollectionWithReadPermission(ConnectionMode connectionMode) { - AsyncDocumentClient asyncClientWithTokenResolver = null; - try { - asyncClientWithTokenResolver = buildClient(connectionMode, PermissionMode.Read); - Observable> readObservable = asyncClientWithTokenResolver.deleteCollection(createdCollection.getSelfLink(), null); - FailureValidator validator = new FailureValidator.Builder().statusCode(HttpConstants.StatusCodes.FORBIDDEN).build(); - validateFailure(readObservable, validator); - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) - public void verifyingAuthTokenAPISequence(ConnectionMode connectionMode) { - Document docDefinition = getDocumentDefinition(); - ResourceResponse resourceResponse = client - .createDocument(BridgeInternal.getAltLink(createdCollection), docDefinition, null, false).toBlocking().first(); - AsyncDocumentClient asyncClientWithTokenResolver = null; - try { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(connectionMode); - - //Unauthorized error with invalid token resolver, valid master key and valid permission feed, making it sure tokenResolver has higher priority than all. - List permissionFeed = new ArrayList<>(); - permissionFeed.add(readPermission); - asyncClientWithTokenResolver = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .withTokenResolver(getTokenResolver(null)) //TokenResolver always generating invalid token. - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withPermissionFeed(permissionFeed) - .build(); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(resourceResponse.getResource().get("mypk"))); - Observable> readObservable = asyncClientWithTokenResolver.readDocument(resourceResponse.getResource().getSelfLink(), requestOptions); - FailureValidator failureValidator = new FailureValidator.Builder().statusCode(HttpConstants.StatusCodes.UNAUTHORIZED).build(); - validateFailure(readObservable, failureValidator); - - //Success read operation with valid token resolver, invalid master key and invalid permission feed, making it sure tokenResolver has higher priority than all. - asyncClientWithTokenResolver = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .withTokenResolver(getTokenResolver(PermissionMode.Read)) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withPermissionFeed(permissionFeed) - .build(); - readObservable = asyncClientWithTokenResolver.readDocument(resourceResponse.getResource().getSelfLink(), requestOptions); - ResourceResponseValidator sucessValidator = new ResourceResponseValidator.Builder() - .withId(resourceResponse.getResource().getId()).build(); - validateSuccess(readObservable, sucessValidator); - - - //Success read operation with valid permission feed, supporting above hypothesis. - asyncClientWithTokenResolver = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .withPermissionFeed(permissionFeed) - .build(); - readObservable = asyncClientWithTokenResolver.readDocument(resourceResponse.getResource().getSelfLink(), requestOptions); - validateSuccess(readObservable, sucessValidator); - - - //Success read operation with valid master key, supporting above hypothesis. - asyncClientWithTokenResolver = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .build(); - readObservable = asyncClientWithTokenResolver.readDocument(resourceResponse.getResource().getSelfLink(), requestOptions); - validateSuccess(readObservable, sucessValidator); - - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = 6000000) - public void createAndExecuteSprocWithWritePermission(ConnectionMode connectionMode) throws InterruptedException { - AsyncDocumentClient asyncClientWithTokenResolver = null; - try { - asyncClientWithTokenResolver = buildClient(connectionMode, PermissionMode.All); - String sprocId = "storedProcedure" + UUID.randomUUID().toString(); - StoredProcedure sproc = new StoredProcedure( - "{" + - " 'id':'" + sprocId + "'," + - " 'body':" + - " 'function() {" + - " var mytext = \"x\";" + - " var myval = 1;" + - " try {" + - " getContext().getResponse().setBody(\"Success!\");" + - " }" + - " catch(err) {" + - " getContext().getResponse().setBody(\"inline err: [\" + err.number + \"] \" + err);" + - " }" + - " }'" + - "}"); - - Observable> createObservable = asyncClientWithTokenResolver.createStoredProcedure(createdCollection.getSelfLink(), sproc, null); - ResourceResponseValidator createSucessValidator = new ResourceResponseValidator.Builder() - .withId(sprocId).build(); - validateSuccess(createObservable, createSucessValidator); - - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey("")); - String sprocLink = "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId() + "/sprocs/" + sprocId; - StoredProcedureResponse result = asyncClientWithTokenResolver.executeStoredProcedure(sprocLink, options, null).toBlocking().single(); - assertThat(result.getResponseAsString()).isEqualTo("\"Success!\""); - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) - public void readDocumentsWithAllPermission(ConnectionMode connectionMode) { - AsyncDocumentClient asyncClientWithTokenResolver = null; - String id1 = UUID.randomUUID().toString(); - String id2 = UUID.randomUUID().toString(); - - try { - asyncClientWithTokenResolver = buildClient(connectionMode, PermissionMode.All); - Document document1 = asyncClientWithTokenResolver.createDocument(createdCollection.getSelfLink(), new Document("{'id': '" + id1 + "'}"), null, false) - .toBlocking().single().getResource(); - Document document2 = asyncClientWithTokenResolver.createDocument(createdCollection.getSelfLink(), new Document("{'id': '" + id2 + "'}"), null, false) - .toBlocking().single().getResource(); - List expectedIds = new ArrayList(); - String rid1 = document1.getResourceId(); - String rid2 = document2.getResourceId(); - expectedIds.add(rid1); - expectedIds.add(rid2); - String query = "SELECT * FROM r WHERE r._rid=\"" + rid1 + "\" or r._rid=\"" + rid2 + "\""; - - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = asyncClientWithTokenResolver.queryDocuments(createdCollection.getSelfLink(), query, options); - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .numberOfPages(1) - .exactlyContainsInAnyOrder(expectedIds).build(); - validateQuerySuccess(queryObservable, validator, 10000); - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) - public void readChangeFeedWithAllPermission(ConnectionMode connectionMode) throws InterruptedException { - - //setStartDateTime is not currently supported in multimaster mode. So skipping the test - if(BridgeInternal.isEnableMultipleWriteLocations(client.getDatabaseAccount().toBlocking().single())){ - throw new SkipException("StartTime/IfModifiedSince is not currently supported when EnableMultipleWriteLocations is set"); - } - - AsyncDocumentClient asyncClientWithTokenResolver = null; - String id1 = UUID.randomUUID().toString(); - String id2 = UUID.randomUUID().toString(); - String partitionKey = createdCollection.getPartitionKey().getPaths().get(0).substring(1); - String partitionKeyValue = "pk"; - Document document1 = new Document(); - document1.setId(id1); - document1.set(partitionKey, partitionKeyValue); - Document document2 = new Document(); - document2.setId(id2); - document2.set(partitionKey, partitionKeyValue); - try { - asyncClientWithTokenResolver = buildClient(connectionMode, PermissionMode.All); - ZonedDateTime befTime = ZonedDateTime.now(); - Thread.sleep(1000); - - document1 = asyncClientWithTokenResolver - .createDocument(createdCollection.getSelfLink(), document1, null, false).toBlocking().single() - .getResource(); - document2 = asyncClientWithTokenResolver - .createDocument(createdCollection.getSelfLink(), document2, null, false).toBlocking().single() - .getResource(); - List expectedIds = new ArrayList(); - String rid1 = document1.getResourceId(); - String rid2 = document2.getResourceId(); - expectedIds.add(rid1); - expectedIds.add(rid2); - - ChangeFeedOptions options = new ChangeFeedOptions(); - options.setPartitionKey(new PartitionKey(partitionKeyValue)); - options.setStartDateTime(befTime); - - Thread.sleep(1000); - Observable> queryObservable = asyncClientWithTokenResolver - .queryDocumentChangeFeed(createdCollection.getSelfLink(), options); - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .exactlyContainsInAnyOrder(expectedIds).build(); - validateQuerySuccess(queryObservable, validator, 10000); - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) - public void verifyRuntimeExceptionWhenUserModifiesProperties(ConnectionMode connectionMode) { - AsyncDocumentClient asyncClientWithTokenResolver = null; - - try { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(connectionMode); - asyncClientWithTokenResolver = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .withTokenResolver(getBadTokenResolver()) - .build(); - - RequestOptions options = new RequestOptions(); - options.setProperties(new HashMap()); - Observable> readObservable = asyncClientWithTokenResolver.readCollection(createdCollection.getSelfLink(), options); - FailureValidator validator = new FailureValidator.Builder().withRuntimeExceptionClass(UnsupportedOperationException.class).build(); - validateFailure(readObservable, validator); - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) - public void verifyBlockListedUserThrows(ConnectionMode connectionMode) { - String field = "user"; - UserClass blockListedUser = new UserClass("block listed user", 0); - String errorMessage = "block listed user! access denied!"; - - AsyncDocumentClient asyncClientWithTokenResolver = null; - try { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(connectionMode); - asyncClientWithTokenResolver = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .withTokenResolver(getTokenResolverWithBlockList(PermissionMode.Read, field, blockListedUser, errorMessage)) - .build(); - - RequestOptions options = new RequestOptions(); - HashMap properties = new HashMap(); - properties.put(field, blockListedUser); - options.setProperties(properties); - Observable> readObservable = asyncClientWithTokenResolver.readCollection(createdCollection.getSelfLink(), options); - FailureValidator validator = new FailureValidator.Builder().withRuntimeExceptionMessage(errorMessage).build(); - validateFailure(readObservable, validator); - - properties.put(field, new UserClass("valid user", 1)); - options.setProperties(properties); - readObservable = asyncClientWithTokenResolver.readCollection(createdCollection.getSelfLink(), options); - ResourceResponseValidator sucessValidator = new ResourceResponseValidator.Builder() - .withId(createdCollection.getId()).build(); - validateSuccess(readObservable, sucessValidator); - } finally { - safeClose(asyncClientWithTokenResolver); - } - } - - @AfterClass(groups = {"simple"}, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - client.close(); - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } - - private AsyncDocumentClient buildClient(ConnectionMode connectionMode, PermissionMode permissionMode) { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(connectionMode); - return new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .withTokenResolver(getTokenResolver(permissionMode)) - .build(); - } - - private static User getUserDefinition() { - User user = new User(); - user.setId(UUID.randomUUID().toString()); - return user; - } - - private Permission getPermission(Resource resource, String permissionId, PermissionMode permissionMode) { - Permission permission = new Permission(); - permission.setId(permissionId); - permission.setPermissionMode(permissionMode); - permission.setResourceLink(resource.getSelfLink()); - return permission; - } - - private TokenResolver getTokenResolver(PermissionMode permissionMode) { - return (String requestVerb, String resourceIdOrFullName, CosmosResourceType resourceType, Map properties) -> { - if (permissionMode == null) { - return "invalid"; - } else if (permissionMode.equals(PermissionMode.Read)) { - return readPermission.getToken(); - } else { - return allPermission.getToken(); - } - }; - } - - private TokenResolver getBadTokenResolver() { - return (String requestVerb, String resourceIdOrFullName, CosmosResourceType resourceType, Map properties) -> { - if (resourceType == CosmosResourceType.System) { - return readPermission.getToken(); - } - if (properties != null) { - properties.put("key", "value"); - } - return null; - }; - } - - private TokenResolver getTokenResolverWithBlockList(PermissionMode permissionMode, String field, UserClass blockListedUser, String errorMessage) { - return (String requestVerb, String resourceIdOrFullName, CosmosResourceType resourceType, Map properties) -> { - UserClass currentUser = null; - if (properties != null && properties.get(field) != null) { - currentUser = (UserClass) properties.get(field); - } - - if (resourceType == CosmosResourceType.System) { - return readPermission.getToken(); - } else if (currentUser != null && - !currentUser.userName.equals(blockListedUser.userName) && - currentUser.userId != blockListedUser.userId) { - if (permissionMode.equals(PermissionMode.Read)) { - return readPermission.getToken(); - } else { - return allPermission.getToken(); - } - } else { - throw new RuntimeException(errorMessage); - } - }; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TopQueryTests.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TopQueryTests.java deleted file mode 100644 index f2b1cbb7a163..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TopQueryTests.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.TimeUnit; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.internal.Utils.ValueHolder; -import com.microsoft.azure.cosmosdb.rx.internal.query.TakeContinuationToken; - -import rx.Observable; - -public class TopQueryTests extends TestSuiteBase { - private Database createdDatabase; - private DocumentCollection createdCollection; - private ArrayList docs = new ArrayList(); - - private String partitionKey = "mypk"; - private int firstPk = 0; - private int secondPk = 1; - private String field = "field"; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public TopQueryTests(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "queryMetricsArgProvider") - public void queryDocumentsWithTop(boolean qmEnabled) throws Exception { - - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - options.setMaxItemCount(9); - options.setMaxDegreeOfParallelism(2); - options.setPopulateQueryMetrics(qmEnabled); - - int expectedTotalSize = 20; - int expectedNumberOfPages = 3; - int[] expectedPageLengths = new int[] { 9, 9, 2 }; - - for (int i = 0; i < 2; i++) { - Observable> queryObservable1 = client.queryDocuments(createdCollection.getSelfLink(), - "SELECT TOP 0 value AVG(c.field) from c", options); - - FeedResponseListValidator validator1 = new FeedResponseListValidator.Builder() - .totalSize(0).build(); - - try { - validateQuerySuccess(queryObservable1, validator1, TIMEOUT); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", - this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - - Observable> queryObservable2 = client.queryDocuments(createdCollection.getSelfLink(), - "SELECT TOP 1 value AVG(c.field) from c", options); - - FeedResponseListValidator validator2 = new FeedResponseListValidator.Builder() - .totalSize(1).build(); - - validateQuerySuccess(queryObservable2, validator2, TIMEOUT); - - Observable> queryObservable3 = client.queryDocuments(createdCollection.getSelfLink(), - "SELECT TOP 20 * from c", options); - - FeedResponseListValidator validator3 = new FeedResponseListValidator.Builder() - .totalSize(expectedTotalSize).numberOfPages(expectedNumberOfPages).pageLengths(expectedPageLengths) - .hasValidQueryMetrics(qmEnabled).build(); - - validateQuerySuccess(queryObservable3, validator3, TIMEOUT); - - if (i == 0) { - options.setPartitionKey(new PartitionKey(firstPk)); - options.setEnableCrossPartitionQuery(false); - - expectedTotalSize = 10; - expectedNumberOfPages = 2; - expectedPageLengths = new int[] { 9, 1 }; - - } - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void topContinuationTokenRoundTrips() throws Exception { - { - // Positive - TakeContinuationToken takeContinuationToken = new TakeContinuationToken(42, "asdf"); - String serialized = takeContinuationToken.toString(); - ValueHolder outTakeContinuationToken = new ValueHolder(); - - assertThat(TakeContinuationToken.tryParse(serialized, outTakeContinuationToken)).isTrue(); - TakeContinuationToken deserialized = outTakeContinuationToken.v; - - assertThat(deserialized.getTakeCount()).isEqualTo(42); - assertThat(deserialized.getSourceToken()).isEqualTo("asdf"); - } - - { - // Negative - ValueHolder outTakeContinuationToken = new ValueHolder(); - assertThat( - TakeContinuationToken.tryParse("{\"property\": \"Not a valid token\"}", outTakeContinuationToken)) - .isFalse(); - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT * 10) - public void queryDocumentsWithTopContinuationTokens() throws Exception { - String query = "SELECT TOP 8 * FROM c"; - this.queryWithContinuationTokensAndPageSizes(query, new int[] { 1, 5, 10 }, 8); - } - - private void queryWithContinuationTokensAndPageSizes(String query, int[] pageSizes, int topCount) { - for (int pageSize : pageSizes) { - List receivedDocuments = this.queryWithContinuationTokens(query, pageSize); - Set actualIds = new HashSet(); - for (Document document : receivedDocuments) { - actualIds.add(document.getResourceId()); - } - - assertThat(actualIds.size()).describedAs("total number of results").isEqualTo(topCount); - } - } - - private List queryWithContinuationTokens(String query, int pageSize) { - String requestContinuation = null; - List continuationTokens = new ArrayList(); - List receivedDocuments = new ArrayList(); - - do { - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(pageSize); - options.setEnableCrossPartitionQuery(true); - options.setMaxDegreeOfParallelism(2); - options.setRequestContinuation(requestContinuation); - Observable> queryObservable = client.queryDocuments(createdCollection.getSelfLink(), - query, options); - - Observable> firstPageObservable = queryObservable.first(); - VerboseTestSubscriber> testSubscriber = new VerboseTestSubscriber<>(); - firstPageObservable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(TIMEOUT, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - - FeedResponse firstPage = testSubscriber.getOnNextEvents().get(0); - requestContinuation = firstPage.getResponseContinuation(); - receivedDocuments.addAll(firstPage.getResults()); - continuationTokens.add(requestContinuation); - } while (requestContinuation != null); - - return receivedDocuments; - } - - public void bulkInsert(AsyncDocumentClient client) { - generateTestData(); - - for (int i = 0; i < docs.size(); i++) { - createDocument(client, createdDatabase.getId(), createdCollection.getId(), docs.get(i)); - } - } - - public void generateTestData() { - - for (int i = 0; i < 10; i++) { - Document d = new Document(); - d.setId(Integer.toString(i)); - d.set(field, i); - d.set(partitionKey, firstPk); - docs.add(d); - } - - for (int i = 10; i < 20; i++) { - Document d = new Document(); - d.setId(Integer.toString(i)); - d.set(field, i); - d.set(partitionKey, secondPk); - docs.add(d); - } - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION; - truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION); - - bulkInsert(client); - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TriggerCrudTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TriggerCrudTest.java deleted file mode 100644 index 5a729f2ce424..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TriggerCrudTest.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.UUID; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.Trigger; -import com.microsoft.azure.cosmosdb.TriggerOperation; -import com.microsoft.azure.cosmosdb.TriggerType; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; - -import rx.Observable; - -import javax.net.ssl.SSLException; - - -public class TriggerCrudTest extends TestSuiteBase { - private Database createdDatabase; - private DocumentCollection createdCollection; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public TriggerCrudTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createTrigger() throws Exception { - - // create a trigger - Trigger trigger = new Trigger(); - trigger.setId(UUID.randomUUID().toString()); - trigger.setBody("function() {var x = 10;}"); - trigger.setTriggerOperation(TriggerOperation.Create); - trigger.setTriggerType(TriggerType.Pre); - - Observable> createObservable = client.createTrigger(getCollectionLink(), trigger, null); - - // validate trigger creation - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(trigger.getId()) - .withTriggerBody("function() {var x = 10;}") - .withTriggerInternals(TriggerType.Pre, TriggerOperation.Create) - .notNullEtag() - .build(); - validateSuccess(createObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void readTrigger() throws Exception { - // create a trigger - Trigger trigger = new Trigger(); - trigger.setId(UUID.randomUUID().toString()); - trigger.setBody("function() {var x = 10;}"); - trigger.setTriggerOperation(TriggerOperation.Create); - trigger.setTriggerType(TriggerType.Pre); - Trigger readBackTrigger = client.createTrigger(getCollectionLink(), trigger, null).toBlocking().single().getResource(); - - // read trigger - waitIfNeededForReplicasToCatchUp(clientBuilder); - Observable> readObservable = client.readTrigger(readBackTrigger.getSelfLink(), null); - - // validate read trigger - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(trigger.getId()) - .withTriggerBody("function() {var x = 10;}") - .withTriggerInternals(TriggerType.Pre, TriggerOperation.Create) - .notNullEtag() - .build(); - validateSuccess(readObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void deleteTrigger() throws Exception { - // create a trigger - Trigger trigger = new Trigger(); - trigger.setId(UUID.randomUUID().toString()); - trigger.setBody("function() {var x = 10;}"); - trigger.setTriggerOperation(TriggerOperation.Create); - trigger.setTriggerType(TriggerType.Pre); - Trigger readBackTrigger = client.createTrigger(getCollectionLink(), trigger, null).toBlocking().single().getResource(); - - // delete trigger - Observable> deleteObservable = client.deleteTrigger(readBackTrigger.getSelfLink(), null); - - // validate delete trigger - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .nullResource() - .build(); - validateSuccess(deleteObservable, validator); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private String getCollectionLink() { - return createdCollection.getSelfLink(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TriggerQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TriggerQueryTest.java deleted file mode 100644 index af8ea0a1bdd4..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TriggerQueryTest.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Trigger; -import com.microsoft.azure.cosmosdb.TriggerOperation; -import com.microsoft.azure.cosmosdb.TriggerType; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - - -public class TriggerQueryTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdTriggers = new ArrayList<>(); - - private AsyncDocumentClient client; - - public String getCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId()); - } - - @Factory(dataProvider = "clientBuildersWithDirect") - public TriggerQueryTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryWithFilter() throws Exception { - - String filterId = createdTriggers.get(0).getId(); - String query = String.format("SELECT * from c where c.id = '%s'", filterId); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(5); - Observable> queryObservable = client - .queryTriggers(getCollectionLink(), query, options); - - List expectedDocs = createdTriggers.stream().filter(sp -> filterId.equals(sp.getId()) ).collect(Collectors.toList()); - assertThat(expectedDocs).isNotEmpty(); - - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedDocs.size()) - .exactlyContainsInAnyOrder(expectedDocs.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(queryObservable, validator, 10000); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void query_NoResults() throws Exception { - - String query = "SELECT * from root r where r.id = '2'"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryTriggers(getCollectionLink(), query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(new ArrayList<>()) - .numberOfPages(1) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryAll() throws Exception { - - String query = "SELECT * from root"; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(3); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryTriggers(getCollectionLink(), query, options); - - List expectedDocs = createdTriggers; - - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator - .Builder() - .exactlyContainsInAnyOrder(expectedDocs - .stream() - .map(d -> d.getResourceId()) - .collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void invalidQuerySytax() throws Exception { - String query = "I am an invalid query"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryTriggers(getCollectionLink(), query, options); - - FailureValidator validator = new FailureValidator.Builder() - .instanceOf(DocumentClientException.class) - .statusCode(400) - .notNullActivityId() - .build(); - validateQueryFailure(queryObservable, validator); - } - - public Trigger createTrigger(AsyncDocumentClient client) { - Trigger storedProcedure = getTriggerDef(); - return client.createTrigger(getCollectionLink(), storedProcedure, null).toBlocking().single().getResource(); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY); - - for(int i = 0; i < 5; i++) { - createdTriggers.add(createTrigger(client)); - } - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private static Trigger getTriggerDef() { - Trigger trigger = new Trigger(); - trigger.setId(UUID.randomUUID().toString()); - trigger.setBody("function() {var x = 10;}"); - trigger.setTriggerOperation(TriggerOperation.Create); - trigger.setTriggerType(TriggerType.Pre); - return trigger; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TriggerUpsertReplaceTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TriggerUpsertReplaceTest.java deleted file mode 100644 index 7ef831e458eb..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/TriggerUpsertReplaceTest.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.UUID; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.Trigger; -import com.microsoft.azure.cosmosdb.TriggerOperation; -import com.microsoft.azure.cosmosdb.TriggerType; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; - -import rx.Observable; - -import javax.net.ssl.SSLException; - - -public class TriggerUpsertReplaceTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public TriggerUpsertReplaceTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void upsertTrigger() throws Exception { - - // create a trigger - Trigger trigger = new Trigger(); - trigger.setId(UUID.randomUUID().toString()); - trigger.setBody("function() {var x = 10;}"); - trigger.setTriggerOperation(TriggerOperation.Create); - trigger.setTriggerType(TriggerType.Pre); - Trigger readBackTrigger = client.upsertTrigger(getCollectionLink(), trigger, null).toBlocking().single().getResource(); - - // read trigger to validate creation - waitIfNeededForReplicasToCatchUp(clientBuilder); - Observable> readObservable = client.readTrigger(readBackTrigger.getSelfLink(), null); - - // validate trigger creation - ResourceResponseValidator validatorForRead = new ResourceResponseValidator.Builder() - .withId(readBackTrigger.getId()) - .withTriggerBody("function() {var x = 10;}") - .withTriggerInternals(TriggerType.Pre, TriggerOperation.Create) - .notNullEtag() - .build(); - validateSuccess(readObservable, validatorForRead); - - //update trigger - readBackTrigger.setBody("function() {var x = 11;}"); - - Observable> updateObservable = client.upsertTrigger(getCollectionLink(), readBackTrigger, null); - - // validate trigger update - ResourceResponseValidator validatorForUpdate = new ResourceResponseValidator.Builder() - .withId(readBackTrigger.getId()) - .withTriggerBody("function() {var x = 11;}") - .withTriggerInternals(TriggerType.Pre, TriggerOperation.Create) - .notNullEtag() - .build(); - validateSuccess(updateObservable, validatorForUpdate); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void replaceTrigger() throws Exception { - - // create a trigger - Trigger trigger = new Trigger(); - trigger.setId(UUID.randomUUID().toString()); - trigger.setBody("function() {var x = 10;}"); - trigger.setTriggerOperation(TriggerOperation.Create); - trigger.setTriggerType(TriggerType.Pre); - Trigger readBackTrigger = client.createTrigger(getCollectionLink(), trigger, null).toBlocking().single().getResource(); - - // read trigger to validate creation - waitIfNeededForReplicasToCatchUp(clientBuilder); - Observable> readObservable = client.readTrigger(readBackTrigger.getSelfLink(), null); - - // validate trigger creation - ResourceResponseValidator validatorForRead = new ResourceResponseValidator.Builder() - .withId(readBackTrigger.getId()) - .withTriggerBody("function() {var x = 10;}") - .withTriggerInternals(TriggerType.Pre, TriggerOperation.Create) - .notNullEtag() - .build(); - validateSuccess(readObservable, validatorForRead); - - //update trigger - readBackTrigger.setBody("function() {var x = 11;}"); - - Observable> updateObservable = client.replaceTrigger(readBackTrigger, null); - - // validate trigger replace - ResourceResponseValidator validatorForUpdate = new ResourceResponseValidator.Builder() - .withId(readBackTrigger.getId()) - .withTriggerBody("function() {var x = 11;}") - .withTriggerInternals(TriggerType.Pre, TriggerOperation.Create) - .notNullEtag() - .build(); - validateSuccess(updateObservable, validatorForUpdate); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private String getCollectionLink() { - return createdCollection.getSelfLink(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UniqueIndexTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UniqueIndexTest.java deleted file mode 100644 index d6bd7f40c6b2..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UniqueIndexTest.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; - -import java.util.Collections; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - -import javax.net.ssl.SSLException; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.fasterxml.jackson.databind.util.JSONPObject; -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableList; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DataType; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ExcludedPath; -import com.microsoft.azure.cosmosdb.HashIndex; -import com.microsoft.azure.cosmosdb.IncludedPath; -import com.microsoft.azure.cosmosdb.IndexingMode; -import com.microsoft.azure.cosmosdb.IndexingPolicy; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.UniqueKey; -import com.microsoft.azure.cosmosdb.UniqueKeyPolicy; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; - -import rx.Observable; -import rx.observers.TestSubscriber; - -public class UniqueIndexTest extends TestSuiteBase { - protected static final int TIMEOUT = 30000; - protected static final int SETUP_TIMEOUT = 20000; - protected static final int SHUTDOWN_TIMEOUT = 20000; - - private final String databaseId = DatabaseForTest.generateId(); - private AsyncDocumentClient client; - private Database database; - - private DocumentCollection collection; - - @Test(groups = { "long" }, timeOut = TIMEOUT) - public void insertWithUniqueIndex() throws Exception { - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - UniqueKeyPolicy uniqueKeyPolicy = new UniqueKeyPolicy(); - UniqueKey uniqueKey = new UniqueKey(); - uniqueKey.setPaths(ImmutableList.of("/name", "/description")); - uniqueKeyPolicy.setUniqueKeys(Collections.singleton(uniqueKey)); - collectionDefinition.setUniqueKeyPolicy(uniqueKeyPolicy); - - IndexingPolicy indexingPolicy = new IndexingPolicy(); - indexingPolicy.setIndexingMode(IndexingMode.Consistent); - ExcludedPath excludedPath = new ExcludedPath(); - excludedPath.setPath("/*"); - indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); - - IncludedPath includedPath1 = new IncludedPath(); - includedPath1.setPath("/name/?"); - includedPath1.setIndexes(Collections.singletonList(new HashIndex(DataType.String, 7))); - - IncludedPath includedPath2 = new IncludedPath(); - includedPath2.setPath("/description/?"); - includedPath2.setIndexes(Collections.singletonList(new HashIndex(DataType.String, 7))); - indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); - - ObjectMapper om = new ObjectMapper(); - - JsonNode doc1 = om.readValue("{\"name\":\"Alexander Pushkin\",\"description\":\"poet\"}", JsonNode.class); - JsonNode doc2 = om.readValue("{\"name\":\"Alexander Pushkin\",\"description\":\"playwright\"}", JsonNode.class); - JsonNode doc3 = om.readValue("{\"name\":\"حافظ شیرازی\",\"description\":\"poet\"}", JsonNode.class); - - collection = client.createCollection(getDatabaseLink(), collectionDefinition, null).toBlocking().single().getResource(); - - Document dd = client.createDocument(getCollectionLink(collection), doc1, null, false).toBlocking().single().getResource(); - - client.readDocument(dd.getSelfLink(), null).toBlocking().single(); - - try { - client.createDocument(getCollectionLink(collection), doc1, null, false).toBlocking().single(); - fail("Did not throw due to unique constraint (create)"); - } catch (RuntimeException e) { - assertThat(getDocumentClientException(e).getStatusCode()).isEqualTo(HttpConstants.StatusCodes.CONFLICT); - } - - client.createDocument(getCollectionLink(collection), doc2, null, false).toBlocking().single(); - client.createDocument(getCollectionLink(collection), doc3, null, false).toBlocking().single(); - } - - @Test(groups = { "long" }, timeOut = TIMEOUT) - public void replaceAndDeleteWithUniqueIndex() throws Exception { - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - UniqueKeyPolicy uniqueKeyPolicy = new UniqueKeyPolicy(); - UniqueKey uniqueKey = new UniqueKey(); - uniqueKey.setPaths(ImmutableList.of("/name", "/description")); - uniqueKeyPolicy.setUniqueKeys(Collections.singleton(uniqueKey)); - collectionDefinition.setUniqueKeyPolicy(uniqueKeyPolicy); - - collection = client.createCollection(getDatabaseLink(), collectionDefinition, null).toBlocking().single().getResource(); - - ObjectMapper om = new ObjectMapper(); - - ObjectNode doc1 = om.readValue("{\"name\":\"عمر خیّام\",\"description\":\"poet\"}", ObjectNode.class); - ObjectNode doc3 = om.readValue("{\"name\":\"Rabindranath Tagore\",\"description\":\"poet\"}", ObjectNode.class); - ObjectNode doc2 = om.readValue("{\"name\":\"عمر خیّام\",\"description\":\"mathematician\"}", ObjectNode.class); - - Document doc1Inserted = client.createDocument( - getCollectionLink(collection), doc1, null, false).toBlocking().single().getResource(); - - client.replaceDocument(doc1Inserted.getSelfLink(), doc1Inserted, null).toBlocking().single(); // Replace with same values -- OK. - - Document doc2Inserted = client.createDocument(getCollectionLink(collection), doc2, null, false).toBlocking().single().getResource(); - Document doc2Replacement = new Document(doc1Inserted.toJson()); - doc2Replacement.setId( doc2Inserted.getId()); - - try { - client.replaceDocument(doc2Inserted.getSelfLink(), doc2Replacement, null).toBlocking().single(); // Replace doc2 with values from doc1 -- Conflict. - fail("Did not throw due to unique constraint"); - } - catch (RuntimeException ex) { - assertThat(getDocumentClientException(ex).getStatusCode()).isEqualTo(HttpConstants.StatusCodes.CONFLICT); - } - - doc3.put("id", doc1Inserted.getId()); - client.replaceDocument(doc1Inserted.getSelfLink(), doc3, null).toBlocking().single(); // Replace with values from doc3 -- OK. - - client.deleteDocument(doc1Inserted.getSelfLink(), null).toBlocking().single(); - client.createDocument(getCollectionLink(collection), doc1, null, false).toBlocking().single(); - } - - @Test(groups = { "long" }, timeOut = TIMEOUT) - public void uniqueKeySerializationDeserialization() { - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - UniqueKeyPolicy uniqueKeyPolicy = new UniqueKeyPolicy(); - UniqueKey uniqueKey = new UniqueKey(); - uniqueKey.setPaths(ImmutableList.of("/name", "/description")); - uniqueKeyPolicy.setUniqueKeys(Collections.singleton(uniqueKey)); - collectionDefinition.setUniqueKeyPolicy(uniqueKeyPolicy); - - IndexingPolicy indexingPolicy = new IndexingPolicy(); - indexingPolicy.setIndexingMode(IndexingMode.Consistent); - ExcludedPath excludedPath = new ExcludedPath(); - excludedPath.setPath("/*"); - indexingPolicy.setExcludedPaths(Collections.singletonList(excludedPath)); - - IncludedPath includedPath1 = new IncludedPath(); - includedPath1.setPath("/name/?"); - includedPath1.setIndexes(Collections.singletonList(new HashIndex(DataType.String, 7))); - - IncludedPath includedPath2 = new IncludedPath(); - includedPath2.setPath("/description/?"); - includedPath2.setIndexes(Collections.singletonList(new HashIndex(DataType.String, 7))); - indexingPolicy.setIncludedPaths(ImmutableList.of(includedPath1, includedPath2)); - - collectionDefinition.setIndexingPolicy(indexingPolicy); - - DocumentCollection createdCollection = client.createCollection(database.getSelfLink(), collectionDefinition, - null).toBlocking().single().getResource(); - - DocumentCollection collection = client.readCollection(getCollectionLink(createdCollection), null) - .toBlocking().single().getResource(); - - assertThat(collection.getUniqueKeyPolicy()).isNotNull(); - assertThat(collection.getUniqueKeyPolicy().getUniqueKeys()).isNotNull(); - assertThat(collection.getUniqueKeyPolicy().getUniqueKeys()) - .hasSameSizeAs(collectionDefinition.getUniqueKeyPolicy().getUniqueKeys()); - assertThat(collection.getUniqueKeyPolicy().getUniqueKeys() - .stream().map(ui -> ui.getPaths()).collect(Collectors.toList())) - .containsExactlyElementsOf( - ImmutableList.of(ImmutableList.of("/name", "/description"))); - } - - private DocumentClientException getDocumentClientException(RuntimeException e) { - DocumentClientException dce = com.microsoft.azure.cosmosdb.rx.internal.Utils.as(e.getCause(), DocumentClientException.class); - assertThat(dce).isNotNull(); - return dce; - } - - private String getDatabaseLink() { - return database.getSelfLink(); - } - - public String getCollectionLink() { - return "dbs/" + database.getId() + "/colls/" + collection.getId(); - } - - @BeforeClass(groups = { "long" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - // set up the client - client = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(ConnectionPolicy.GetDefault()) - .withConsistencyLevel(ConsistencyLevel.Session).build(); - - database = createDatabase(client, databaseId); - } - - @AfterClass(groups = { "long" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, databaseId); - safeClose(client); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserCrudTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserCrudTest.java deleted file mode 100644 index ce47630b91ad..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserCrudTest.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import com.microsoft.azure.cosmosdb.Permission; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.User; - -import rx.Observable; - -import javax.net.ssl.SSLException; - - -public class UserCrudTest extends TestSuiteBase { - - public final String databaseId = DatabaseForTest.generateId(); - - private Database createdDatabase; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuilders") - public UserCrudTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void createUser() throws Exception { - //create user - User user = new User(); - user.setId(UUID.randomUUID().toString()); - - Observable> createObservable = client.createUser(getDatabaseLink(), user, null); - - // validate user creation - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(user.getId()) - .notNullEtag() - .build(); - validateSuccess(createObservable, validator); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void readUser() throws Exception { - - //create user - User user = new User(); - user.setId(UUID.randomUUID().toString()); - - User readBackUser = client.createUser(getDatabaseLink(), user, null).toBlocking().single().getResource(); - - // read user - Observable> readObservable = client.readUser(readBackUser.getSelfLink(), null); - - //validate user read - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(readBackUser.getId()) - .notNullEtag() - .build(); - - validateSuccess(readObservable, validator); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void deleteUser() throws Exception { - //create user - User user = new User(); - user.setId(UUID.randomUUID().toString()); - - User readBackUser = client.createUser(getDatabaseLink(), user, null).toBlocking().single().getResource(); - - // delete user - Observable> deleteObservable = client.deleteUser(readBackUser.getSelfLink(), null); - - // validate user delete - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .nullResource() - .build(); - validateSuccess(deleteObservable, validator); - - // attempt to read the user which was deleted - Observable> readObservable = client.readUser(readBackUser.getSelfLink(), null); - FailureValidator notFoundValidator = new FailureValidator.Builder().resourceNotFound().build(); - validateFailure(readObservable, notFoundValidator); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void upsertUser() throws Exception { - - //create user - User user = new User(); - user.setId(UUID.randomUUID().toString()); - - User readBackUser = client.upsertUser(getDatabaseLink(), user, null).toBlocking().single().getResource(); - - // read user to validate creation - Observable> readObservable = client.readUser(readBackUser.getSelfLink(), null); - - //validate user read - ResourceResponseValidator validatorForRead = new ResourceResponseValidator.Builder() - .withId(readBackUser.getId()) - .notNullEtag() - .build(); - - validateSuccess(readObservable, validatorForRead); - - client.readUsers(getDatabaseLink(), null).toBlocking().subscribe(users -> { - try { - int initialNumberOfUsers = users.getResults().size(); - //update user - readBackUser.setId(UUID.randomUUID().toString()); - - Observable> updateObservable = client.upsertUser(getDatabaseLink(), readBackUser, null); - - // validate user upsert - ResourceResponseValidator validatorForUpdate = new ResourceResponseValidator.Builder() - .withId(readBackUser.getId()) - .notNullEtag() - .build(); - - validateSuccess(updateObservable, validatorForUpdate); - - //verify that new user is added due to upsert with changed id - client.readUsers(getDatabaseLink(), null).toBlocking().subscribe(newUsers ->{ - int finalNumberOfUsers = newUsers.getResults().size(); - assertThat(finalNumberOfUsers).isEqualTo(initialNumberOfUsers + 1); - }); - } catch (Exception e) { - e.printStackTrace(); - } - }); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void replaceUser() throws Exception { - - //create user - User user = new User(); - user.setId(UUID.randomUUID().toString()); - - User readBackUser = client.createUser(getDatabaseLink(), user, null).toBlocking().single().getResource(); - - // read user to validate creation - Observable> readObservable = client.readUser(readBackUser.getSelfLink(), null); - - //validate user read - ResourceResponseValidator validatorForRead = new ResourceResponseValidator.Builder() - .withId(readBackUser.getId()) - .notNullEtag() - .build(); - - validateSuccess(readObservable, validatorForRead); - - //update user - readBackUser.setId(UUID.randomUUID().toString()); - - Observable> updateObservable = client.replaceUser(readBackUser, null); - - // validate user replace - ResourceResponseValidator validatorForUpdate = new ResourceResponseValidator.Builder() - .withId(readBackUser.getId()) - .notNullEtag() - .build(); - - validateSuccess(updateObservable, validatorForUpdate); - } - - @BeforeClass(groups = { "emulator" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - Database d = new Database(); - d.setId(databaseId); - createdDatabase = createDatabase(client, d); - } - - @AfterClass(groups = { "emulator" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, createdDatabase.getId()); - safeClose(client); - } - - private String getDatabaseLink() { - return createdDatabase.getSelfLink(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserDefinedFunctionCrudTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserDefinedFunctionCrudTest.java deleted file mode 100644 index ed03ec2026b2..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserDefinedFunctionCrudTest.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.UUID; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.UserDefinedFunction; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; - -import rx.Observable; - - -public class UserDefinedFunctionCrudTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public UserDefinedFunctionCrudTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createUserDefinedFunction() throws Exception { - // create udf - UserDefinedFunction udf = new UserDefinedFunction(); - udf.setId(UUID.randomUUID().toString()); - udf.setBody("function() {var x = 10;}"); - - Observable> createObservable = client.createUserDefinedFunction(getCollectionLink(), udf, null); - - // validate udf creation - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(udf.getId()) - .withUserDefinedFunctionBody("function() {var x = 10;}") - .notNullEtag() - .build(); - validateSuccess(createObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void readUserDefinedFunction() throws Exception { - // create a udf - UserDefinedFunction udf = new UserDefinedFunction(); - udf.setId(UUID.randomUUID().toString()); - udf.setBody("function() {var x = 10;}"); - UserDefinedFunction readBackUdf = client.createUserDefinedFunction(getCollectionLink(), udf, null).toBlocking().single().getResource(); - - - // read udf - waitIfNeededForReplicasToCatchUp(clientBuilder); - Observable> readObservable = client.readUserDefinedFunction(readBackUdf.getSelfLink(), null); - - //validate udf read - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(udf.getId()) - .withUserDefinedFunctionBody("function() {var x = 10;}") - .notNullEtag() - .build(); - validateSuccess(readObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void deleteUserDefinedFunction() throws Exception { - // create a udf - UserDefinedFunction udf = new UserDefinedFunction(); - udf.setId(UUID.randomUUID().toString()); - udf.setBody("function() {var x = 10;}"); - UserDefinedFunction readBackUdf = client.createUserDefinedFunction(getCollectionLink(), udf, null).toBlocking().single().getResource(); - - // delete udf - Observable> deleteObservable = client.deleteUserDefinedFunction(readBackUdf.getSelfLink(), null); - - // validate udf delete - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .nullResource() - .build(); - validateSuccess(deleteObservable, validator); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private String getCollectionLink() { - return createdCollection.getSelfLink(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserDefinedFunctionQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserDefinedFunctionQueryTest.java deleted file mode 100644 index b8ffbc79fe9f..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserDefinedFunctionQueryTest.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.UserDefinedFunction; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - - -public class UserDefinedFunctionQueryTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - private List createdUDF = new ArrayList<>(); - - private AsyncDocumentClient client; - - public String getCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId()); - } - - @Factory(dataProvider = "clientBuildersWithDirect") - public UserDefinedFunctionQueryTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryWithFilter() throws Exception { - - String filterId = createdUDF.get(0).getId(); - String query = String.format("SELECT * from c where c.id = '%s'", filterId); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(5); - Observable> queryObservable = client - .queryUserDefinedFunctions(getCollectionLink(), query, options); - - List expectedDocs = createdUDF.stream().filter(sp -> filterId.equals(sp.getId()) ).collect(Collectors.toList()); - assertThat(expectedDocs).isNotEmpty(); - - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedDocs.size()) - .exactlyContainsInAnyOrder(expectedDocs.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(queryObservable, validator, 10000); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void query_NoResults() throws Exception { - - String query = "SELECT * from root r where r.id = '2'"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryUserDefinedFunctions(getCollectionLink(), query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(new ArrayList<>()) - .numberOfPages(1) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryAll() throws Exception { - - String query = "SELECT * from root"; - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(3); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryUserDefinedFunctions(getCollectionLink(), query, options); - - List expectedDocs = createdUDF; - - int expectedPageSize = (expectedDocs.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator - .Builder() - .exactlyContainsInAnyOrder(expectedDocs - .stream() - .map(d -> d.getResourceId()) - .collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .allPagesSatisfy(new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void invalidQuerySytax() throws Exception { - String query = "I am an invalid query"; - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - Observable> queryObservable = client - .queryUserDefinedFunctions(getCollectionLink(), query, options); - - FailureValidator validator = new FailureValidator.Builder() - .instanceOf(DocumentClientException.class) - .statusCode(400) - .notNullActivityId() - .build(); - validateQueryFailure(queryObservable, validator); - } - - public UserDefinedFunction createUserDefinedFunction(AsyncDocumentClient client) { - UserDefinedFunction storedProcedure = getUserDefinedFunctionDef(); - return client.createUserDefinedFunction(getCollectionLink(), storedProcedure, null).toBlocking().single().getResource(); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY); - - for(int i = 0; i < 5; i++) { - createdUDF.add(createUserDefinedFunction(client)); - } - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private static UserDefinedFunction getUserDefinedFunctionDef() { - UserDefinedFunction udf = new UserDefinedFunction(); - udf.setId(UUID.randomUUID().toString()); - udf.setBody("function() {var x = 10;}"); - return udf; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserDefinedFunctionUpsertReplaceTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserDefinedFunctionUpsertReplaceTest.java deleted file mode 100644 index 5d35cf792b2b..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserDefinedFunctionUpsertReplaceTest.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import java.util.UUID; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.UserDefinedFunction; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; - -import rx.Observable; - -import javax.net.ssl.SSLException; - - -public class UserDefinedFunctionUpsertReplaceTest extends TestSuiteBase { - - private Database createdDatabase; - private DocumentCollection createdCollection; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public UserDefinedFunctionUpsertReplaceTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void upsertUserDefinedFunction() throws Exception { - - // create a udf - UserDefinedFunction udf = new UserDefinedFunction(); - udf.setId(UUID.randomUUID().toString()); - udf.setBody("function() {var x = 10;}"); - - UserDefinedFunction readBackUdf = null; - - try { - readBackUdf = client.upsertUserDefinedFunction(getCollectionLink(), udf, null).toBlocking().single().getResource(); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - - // read udf to validate creation - waitIfNeededForReplicasToCatchUp(clientBuilder); - Observable> readObservable = client.readUserDefinedFunction(readBackUdf.getSelfLink(), null); - - // validate udf create - ResourceResponseValidator validatorForRead = new ResourceResponseValidator.Builder() - .withId(readBackUdf.getId()) - .withUserDefinedFunctionBody("function() {var x = 10;}") - .notNullEtag() - .build(); - validateSuccess(readObservable, validatorForRead); - - //update udf - readBackUdf.setBody("function() {var x = 11;}"); - - Observable> updateObservable = client.upsertUserDefinedFunction(getCollectionLink(), readBackUdf, null); - - // validate udf update - ResourceResponseValidator validatorForUpdate = new ResourceResponseValidator.Builder() - .withId(readBackUdf.getId()) - .withUserDefinedFunctionBody("function() {var x = 11;}") - .notNullEtag() - .build(); - validateSuccess(updateObservable, validatorForUpdate); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void replaceUserDefinedFunction() throws Exception { - - // create a udf - UserDefinedFunction udf = new UserDefinedFunction(); - udf.setId(UUID.randomUUID().toString()); - udf.setBody("function() {var x = 10;}"); - - UserDefinedFunction readBackUdf = null; - - try { - readBackUdf = client.createUserDefinedFunction(getCollectionLink(), udf, null).toBlocking().single().getResource(); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - - // read udf to validate creation - waitIfNeededForReplicasToCatchUp(clientBuilder); - Observable> readObservable = client.readUserDefinedFunction(readBackUdf.getSelfLink(), null); - - // validate udf creation - ResourceResponseValidator validatorForRead = new ResourceResponseValidator.Builder() - .withId(readBackUdf.getId()) - .withUserDefinedFunctionBody("function() {var x = 10;}") - .notNullEtag() - .build(); - validateSuccess(readObservable, validatorForRead); - - //update udf - readBackUdf.setBody("function() {var x = 11;}"); - - Observable> replaceObservable = client.replaceUserDefinedFunction(readBackUdf, null); - - //validate udf replace - ResourceResponseValidator validatorForReplace = new ResourceResponseValidator.Builder() - .withId(readBackUdf.getId()) - .withUserDefinedFunctionBody("function() {var x = 11;}") - .notNullEtag() - .build(); - validateSuccess(replaceObservable, validatorForReplace); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - truncateCollection(createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private String getCollectionLink() { - return createdCollection.getSelfLink(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserQueryTest.java deleted file mode 100644 index a1feb7046b18..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/UserQueryTest.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import org.apache.commons.lang3.StringUtils; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.User; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; - -import rx.Observable; - -public class UserQueryTest extends TestSuiteBase { - - public final String databaseId = DatabaseForTest.generateId(); - - private List createdUsers = new ArrayList<>(); - - private AsyncDocumentClient client; - - private String getDatabaseLink() { - return Utils.getDatabaseNameLink(databaseId); - } - - @Factory(dataProvider = "clientBuilders") - public UserQueryTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryUsersWithFilter() throws Exception { - - String filterUserId = createdUsers.get(0).getId(); - String query = String.format("SELECT * from c where c.id = '%s'", filterUserId); - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(5); - Observable> queryObservable = client.queryUsers(getDatabaseLink(), query, options); - - List expectedUsers = createdUsers.stream() - .filter(c -> StringUtils.equals(filterUserId, c.getId()) ).collect(Collectors.toList()); - - assertThat(expectedUsers).isNotEmpty(); - - int expectedPageSize = (expectedUsers.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedUsers.size()) - .exactlyContainsInAnyOrder(expectedUsers.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(queryObservable, validator, 10000); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryAllUsers() throws Exception { - - String query = "SELECT * from c"; - - FeedOptions options = new FeedOptions(); - options.setMaxItemCount(2); - String databaseLink = Utils.getDatabaseNameLink(databaseId); - Observable> queryObservable = client.queryUsers(databaseLink, query, options); - - List expectedUsers = createdUsers; - - assertThat(expectedUsers).isNotEmpty(); - - int expectedPageSize = (expectedUsers.size() + options.getMaxItemCount() - 1) / options.getMaxItemCount(); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .totalSize(expectedUsers.size()) - .exactlyContainsInAnyOrder(expectedUsers.stream().map(d -> d.getResourceId()).collect(Collectors.toList())) - .numberOfPages(expectedPageSize) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - - validateQuerySuccess(queryObservable, validator, 10000); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void queryUsers_NoResults() throws Exception { - - String query = "SELECT * from root r where r.id = '2'"; - FeedOptions options = new FeedOptions(); - Observable> queryObservable = client.queryUsers(getDatabaseLink(), query, options); - - FeedResponseListValidator validator = new FeedResponseListValidator.Builder() - .containsExactly(new ArrayList<>()) - .numberOfPages(1) - .pageSatisfy(0, new FeedResponseValidator.Builder() - .requestChargeGreaterThanOrEqualTo(1.0).build()) - .build(); - validateQuerySuccess(queryObservable, validator); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - - Database d1 = new Database(); - d1.setId(databaseId); - createDatabase(client, d1); - - for(int i = 0; i < 5; i++) { - User user = new User(); - user.setId(UUID.randomUUID().toString()); - createdUsers.add(createUser(client, databaseId, user)); - } - - waitIfNeededForReplicasToCatchUp(clientBuilder); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteDatabase(client, databaseId); - safeClose(client); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/VeryLargeDocumentQueryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/VeryLargeDocumentQueryTest.java deleted file mode 100644 index b196a888e376..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/VeryLargeDocumentQueryTest.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; -import org.apache.commons.lang3.StringUtils; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Observable; - -import java.util.UUID; - -import static org.apache.commons.io.FileUtils.ONE_MB; - -public class VeryLargeDocumentQueryTest extends TestSuiteBase { - private final static int TIMEOUT = 60000; - private final static int SETUP_TIMEOUT = 60000; - private Database createdDatabase; - private DocumentCollection createdCollection; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "simpleClientBuildersWithDirect") - public VeryLargeDocumentQueryTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void queryLargeDocuments() { - int cnt = 5; - for(int i = 0; i < cnt; i++) { - createLargeDocument(); - } - - try { - validateQuerySuccess(client.queryDocuments(getCollectionLink(), "SELECT * FROM r", null), - new FeedResponseListValidator.Builder().totalSize(cnt).build()); - } catch (Throwable error) { - if (this.clientBuilder.configs.getProtocol() == Protocol.Tcp) { - String message = String.format("Direct TCP test failure ignored: desiredConsistencyLevel=%s", this.clientBuilder.desiredConsistencyLevel); - logger.info(message, error); - throw new SkipException(message, error); - } - throw error; - } - } - - private void createLargeDocument() { - Document docDefinition = getDocumentDefinition(); - - //Keep size as ~ 1.999MB to account for size of other props - int size = (int) (ONE_MB * 1.999); - docDefinition.set("largeString", StringUtils.repeat("x", size)); - - Observable> createObservable = client - .createDocument(getCollectionLink(), docDefinition, null, false); - - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()) - .build(); - - validateSuccess(createObservable, validator); - } - - @BeforeClass(groups = { "emulator" }, timeOut = 2 * SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = clientBuilder.build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY); - } - - @AfterClass(groups = { "emulator" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private static Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "}" - , uuid, uuid)); - return doc; - } - - public String getCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdCollection.getId()); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConnectionPoolExhaustedRetryTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConnectionPoolExhaustedRetryTest.java deleted file mode 100644 index 395a8a19d805..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConnectionPoolExhaustedRetryTest.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.RetryOptions; -import io.reactivex.netty.client.PoolExhaustedException; -import org.mockito.Mockito; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -import java.net.URL; - -import static org.assertj.core.api.Assertions.assertThat; - -public class ConnectionPoolExhaustedRetryTest { - private static final int TIMEOUT = 10000; - - @DataProvider(name = "exceptionProvider") - public Object[][] exceptionProvider() { - return new Object[][]{ - {Mockito.mock(PoolExhaustedException.class)}, - {new DocumentClientException(-1, Mockito.mock(PoolExhaustedException.class))}, - }; - } - - @Test(groups = {"unit"}, timeOut = TIMEOUT, dataProvider = "exceptionProvider") - public void retryOnConnectionPoolExhausted(Exception exception) throws Exception { - GlobalEndpointManager globalEndpointManager = Mockito.mock(GlobalEndpointManager.class); - Mockito.doReturn(new URL("http://localhost")).when(globalEndpointManager).resolveServiceEndpoint(Mockito.any(RxDocumentServiceRequest.class)); - ClientRetryPolicy clientRetryPolicy = new ClientRetryPolicy(globalEndpointManager, false, Mockito.mock(RetryOptions.class)); - - clientRetryPolicy.onBeforeSendRequest(Mockito.mock(RxDocumentServiceRequest.class)); - IRetryPolicy.ShouldRetryResult shouldRetryResult = clientRetryPolicy.shouldRetry(exception).toBlocking().value(); - assertThat(shouldRetryResult.shouldRetry).isTrue(); - assertThat(shouldRetryResult.backOffTime).isGreaterThanOrEqualTo(ConnectionPoolExhaustedRetry.RETRY_WAIT_TIME); - - Mockito.verify(globalEndpointManager, Mockito.times(1)).resolveServiceEndpoint(Mockito.any(RxDocumentServiceRequest.class)); - Mockito.verify(globalEndpointManager, Mockito.times(1)).CanUseMultipleWriteLocations(Mockito.any(RxDocumentServiceRequest.class)); - Mockito.verifyNoMoreInteractions(globalEndpointManager); - } - - @Test(groups = {"unit"}, timeOut = TIMEOUT, dataProvider = "exceptionProvider") - public void retryOnConnectionPoolExhausted_Exhausted(Exception exception) throws Exception { - GlobalEndpointManager globalEndpointManager = Mockito.mock(GlobalEndpointManager.class); - Mockito.doReturn(new URL("http://localhost")).when(globalEndpointManager).resolveServiceEndpoint(Mockito.any(RxDocumentServiceRequest.class)); - ClientRetryPolicy clientRetryPolicy = new ClientRetryPolicy(globalEndpointManager, false, Mockito.mock(RetryOptions.class)); - - clientRetryPolicy.onBeforeSendRequest(Mockito.mock(RxDocumentServiceRequest.class)); - for (int i = 0; i < ConnectionPoolExhaustedRetry.MAX_RETRY_COUNT; i++) { - IRetryPolicy.ShouldRetryResult shouldRetryResult = clientRetryPolicy.shouldRetry(exception).toBlocking().value(); - assertThat(shouldRetryResult.shouldRetry).isTrue(); - assertThat(shouldRetryResult.backOffTime).isGreaterThanOrEqualTo(ConnectionPoolExhaustedRetry.RETRY_WAIT_TIME); - } - - IRetryPolicy.ShouldRetryResult shouldRetryResult = clientRetryPolicy.shouldRetry(exception).toBlocking().value(); - assertThat(shouldRetryResult.shouldRetry).isFalse(); - assertThat(shouldRetryResult.backOffTime).isNull(); - // no interaction with global endpoint manager - Mockito.verify(globalEndpointManager, Mockito.times(1)).resolveServiceEndpoint(Mockito.any(RxDocumentServiceRequest.class)); - Mockito.verify(globalEndpointManager, Mockito.times(1)).CanUseMultipleWriteLocations(Mockito.any(RxDocumentServiceRequest.class)); - Mockito.verifyNoMoreInteractions(globalEndpointManager); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConsistencyTests1.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConsistencyTests1.java deleted file mode 100644 index a7d110a9b8c3..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConsistencyTests1.java +++ /dev/null @@ -1,306 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.PartitionKind; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.User; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.ResourceResponseValidator; -import com.microsoft.azure.cosmosdb.rx.TestConfigurations; -import org.testng.SkipException; -import org.testng.annotations.Test; -import rx.Observable; - -import java.util.ArrayList; -import java.util.UUID; - -import static org.assertj.core.api.Assertions.assertThat; - -public class ConsistencyTests1 extends ConsistencyTestsBase { - - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateStrongConsistencyOnSyncReplication() throws Exception { - if (!TestConfigurations.CONSISTENCY.equalsIgnoreCase(ConsistencyLevel.Strong.toString())) { - throw new SkipException("Endpoint does not have strong consistency"); - } - - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - this.writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Strong).build(); - - this.readClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Strong).build(); - User userDefinition = getUserDefinition(); - userDefinition.setId(userDefinition.getId() + "validateStrongConsistencyOnSyncReplication"); - User user = safeCreateUser(this.initClient, createdDatabase.getId(), userDefinition); - validateStrongConsistency(user); - } - - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT, enabled = false) - public void validateConsistentLSNForDirectTCPClient() { - //TODO Need to test with TCP protocol - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355057 - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - this.writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .build(); - - this.readClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .build(); - validateConsistentLSN(); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateConsistentLSNForDirectHttpsClient() { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - this.writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .build(); - - this.readClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .build(); - validateConsistentLSN(); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT, enabled = false) - public void validateConsistentLSNAndQuorumAckedLSNForDirectTCPClient() { - //TODO Need to test with TCP protocol - //https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355057 - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - this.writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .build(); - - this.readClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .build(); - validateConsistentLSNAndQuorumAckedLSN(); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateStrongDynamicQuorum() { - if (!TestConfigurations.CONSISTENCY.equalsIgnoreCase(ConsistencyLevel.Strong.toString())) { - throw new SkipException("Endpoint does not have strong consistency"); - } - - validateReadQuorum(ConsistencyLevel.Strong, ResourceType.Document, false); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateBoundedStalenessDynamicQuorumSyncReplication() { - if (!(TestConfigurations.CONSISTENCY.equalsIgnoreCase(ConsistencyLevel.Strong.toString()) || TestConfigurations.CONSISTENCY.equalsIgnoreCase(ConsistencyLevel.BoundedStaleness.toString()))) { - throw new SkipException("Endpoint does not have strong consistency"); - } - - validateReadQuorum(ConsistencyLevel.BoundedStaleness, ResourceType.Document, true); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateConsistentLSNAndQuorumAckedLSNForDirectHttpsClient() { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - this.writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .build(); - - this.readClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .build(); - validateConsistentLSNAndQuorumAckedLSN(); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateStrongConsistencyOnAsyncReplicationGW() throws InterruptedException { - validateStrongConsistencyOnAsyncReplication(true); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateStrongConsistencyOnAsyncReplicationDirect() throws InterruptedException { - validateStrongConsistencyOnAsyncReplication(false); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateSessionContainerAfterCollectionCreateReplace() { - //TODO Need to test with TCP protocol - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355057 - //validateSessionContainerAfterCollectionCreateReplace(false, Protocol.Tcp); - validateSessionContainerAfterCollectionCreateReplace(false); - validateSessionContainerAfterCollectionCreateReplace(true); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateConsistentPrefixOnSyncReplication() throws InterruptedException { - if (!(TestConfigurations.CONSISTENCY.equalsIgnoreCase(ConsistencyLevel.Strong.toString()) || TestConfigurations.CONSISTENCY.equalsIgnoreCase(ConsistencyLevel.BoundedStaleness.toString()))) { - throw new SkipException("Endpoint does not have strong consistency"); - } - - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - this.writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.BoundedStaleness).build(); - - this.readClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.BoundedStaleness).build(); - User user = safeCreateUser(this.initClient, createdDatabase.getId(), getUserDefinition()); - boolean readLagging = validateConsistentPrefix(user); - assertThat(readLagging).isFalse(); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateConsistentPrefixOnAsyncReplication() throws InterruptedException { - if (!(TestConfigurations.CONSISTENCY.equalsIgnoreCase(ConsistencyLevel.Strong.toString()) || TestConfigurations.CONSISTENCY.equalsIgnoreCase(ConsistencyLevel.BoundedStaleness.toString()))) { - throw new SkipException("Endpoint does not have strong consistency"); - } - - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - this.writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.BoundedStaleness) - .build(); - - this.readClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.BoundedStaleness) - .build(); - Document documentDefinition = getDocumentDefinition(); - Document document = createDocument(this.initClient, createdDatabase.getId(), createdCollection.getId(), documentDefinition); - boolean readLagging = validateConsistentPrefix(document); - //assertThat(readLagging).isTrue(); //Will fail if batch repl is turned off - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT, enabled = false) - public void validateConsistentPrefixWithReplicaRestartWithPause() { - //TODO this need to complete once we implement emulator container in java, and the we can do operation - // like pause, resume, stop, recycle on it needed for this test. - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355053 - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT, enabled = false) - public void validateConsistentPrefixWithReplicaRestart() { - //TODO this need to complete once we implement emulator container in java, and the we can do operation - // like pause, resume, stop, recycle on it needed for this test. - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355053 - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateSubstatusCodeOnNotFoundExceptionInSessionReadAsync() { - validateSubstatusCodeOnNotFoundExceptionInSessionReadAsync(false); - validateSubstatusCodeOnNotFoundExceptionInSessionReadAsync(true); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT, enabled = false) - public void validateBarrierStrongConsistencyForMasterResources() { - //TODO this need to complete once we implement emulator container in java, and the we can do operation - // like pause, resume, stop, recycle on it needed for this test. - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355053 - } - - private void validateSubstatusCodeOnNotFoundExceptionInSessionReadAsync(boolean useGateway) { - - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - if (useGateway) { - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - } else { - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - } - AsyncDocumentClient client = new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - try { - DocumentCollection documentCollection = new DocumentCollection(); - documentCollection.setId(UUID.randomUUID().toString()); - PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition(); - partitionKeyDefinition.setKind(PartitionKind.Hash); - ArrayList paths = new ArrayList(); - paths.add("/id"); - partitionKeyDefinition.setPaths(paths); - documentCollection.setPartitionKey(partitionKeyDefinition); - - DocumentCollection collection = client.createCollection(createdDatabase.getSelfLink(), documentCollection, null).toBlocking().first().getResource(); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey("1")); - - Document documentDefinition = new Document(); - documentDefinition.setId("1"); - Document document = client.createDocument(collection.getSelfLink(), documentDefinition, requestOptions, false).toBlocking().first().getResource(); - - Observable> deleteObservable = client.deleteDocument(document.getSelfLink(), requestOptions); - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .nullResource().build(); - validateSuccess(deleteObservable, validator); - Observable> readObservable = client.readDocument(document.getSelfLink(), requestOptions); - FailureValidator notFoundValidator = new FailureValidator.Builder().resourceNotFound().unknownSubStatusCode().build(); - validateFailure(readObservable, notFoundValidator); - - } finally { - safeClose(client); - } - } - - private static User getUserDefinition() { - User user = new User(); - user.setId(USER_NAME); - return user; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConsistencyTests2.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConsistencyTests2.java deleted file mode 100644 index 0d61a14ed528..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConsistencyTests2.java +++ /dev/null @@ -1,307 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.ISessionToken; -import com.microsoft.azure.cosmosdb.internal.SessionTokenHelper; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.WFConstants; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternal; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.TestConfigurations; -import org.apache.commons.lang3.Range; -import org.testng.annotations.Test; -import rx.Completable; -import rx.Observable; -import rx.functions.Action1; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import static org.assertj.core.api.Assertions.assertThat; - -public class ConsistencyTests2 extends ConsistencyTestsBase { - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateReadSessionOnAsyncReplication() throws InterruptedException { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - this.writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session).build(); - - this.readClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session).build(); - - Document document = this.initClient.createDocument(createdCollection.getSelfLink(), getDocumentDefinition(), null, false).toBlocking().first().getResource(); - Thread.sleep(5000);//WaitForServerReplication - boolean readLagging = this.validateReadSession(document); - //assertThat(readLagging).isTrue(); //Will fail if batch repl is turned off - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateWriteSessionOnAsyncReplication() throws InterruptedException { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - this.writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session).build(); - - this.readClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session).build(); - - Document document = this.initClient.createDocument(createdCollection.getSelfLink(), getDocumentDefinition(), null, false).toBlocking().first().getResource(); - Thread.sleep(5000);//WaitForServerReplication - boolean readLagging = this.validateWriteSession(document); - //assertThat(readLagging).isTrue(); //Will fail if batch repl is turned off - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT, enabled = false) - public void validateEventualConsistencyOnAsyncReplicationDirect() { - //TODO this need to complete once we implement emulator container in java, and the we can do operation - // like pause, resume, stop, recycle on it needed for this test. - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355053 - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT, enabled = false) - public void validateEventualConsistencyOnAsyncReplicationGateway() { - //TODO this need to complete once we implement emulator container in java, and the we can do operation - // like pause, resume, stop, recycle on it needed for this test. - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355053 - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateSessionContainerAfterCollectionDeletion() throws Exception { - //TODO Need to test with TCP protocol - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355057 - // Verify the collection deletion will trigger the session token clean up (even for different client) - //this.ValidateSessionContainerAfterCollectionDeletion(true, Protocol.Tcp); - this.validateSessionContainerAfterCollectionDeletion(true); - this.validateSessionContainerAfterCollectionDeletion(false); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT, enabled = false) - public void validateReadDistributionForSessionReads() { - // .NET uses lock method which is eventfully using LastReadAddress only for the test case to pass, we are not implementing this in java - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateSessionTokenWithPreConditionFailure() throws Exception { - //TODO Need to test with TCP protocol - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355057 - //this.validateSessionTokenWithPreConditionFailure(false, Protocol.Tcp); - this.validateSessionTokenWithPreConditionFailure(false); - this.validateSessionTokenWithPreConditionFailure(true); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateSessionTokenWithDocumentNotFound() throws Exception { - //TODO Need to test with TCP protocol - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355057 - //this.validateSessionTokenWithDocumentNotFoundException(false, Protocol.Tcp); - this.validateSessionTokenWithDocumentNotFoundException(false); - this.validateSessionTokenWithDocumentNotFoundException(true); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateSessionTokenWithExpectedException() throws Exception { - //TODO Need to test with TCP protocol - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355057 - //this.validateSessionTokenWithExpectedException(false, Protocol.Tcp); - this.validateSessionTokenWithExpectedException(false); - this.validateSessionTokenWithExpectedException(true); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateSessionTokenWithConflictException() { - //TODO Need to test with TCP protocol - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355057 - //this.validateSessionTokenWithConflictException(false, Protocol.Tcp); - this.validateSessionTokenWithConflictException(false); - this.validateSessionTokenWithConflictException(true); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateSessionTokenMultiPartitionCollection() throws Exception { - //TODO Need to test with TCP protocol - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355057 - //this.validateSessionTokenMultiPartitionCollection(false, Protocol.Tcp); - this.validateSessionTokenMultiPartitionCollection(false); - this.validateSessionTokenMultiPartitionCollection(true); - } - - @Test(groups = {"direct"}, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateSessionTokenFromCollectionReplaceIsServerToken() { - //TODO Need to test with TCP protocol - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355057 - //this.validateSessionTokenFromCollectionReplaceIsServerToken(false, Protocol.Tcp); - this.validateSessionTokenFromCollectionReplaceIsServerToken(false); - this.validateSessionTokenFromCollectionReplaceIsServerToken(true); - } - - //TODO ReadFeed is broken, will enable the test case once it get fixed - //https://msdata.visualstudio.com/CosmosDB/_workitems/edit/358715 - @Test(groups = {"direct"}, enabled = false, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateNoChargeOnFailedSessionRead() throws Exception { - // Direct clients for read and write operations - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - RxDocumentClientImpl writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - // Client locked to replica for pause/resume - RxDocumentClientImpl readSecondaryClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - try { - // Create collection - DocumentCollection parentResource = writeClient.createCollection(createdDatabase.getSelfLink(), getCollectionDefinition(), null).toBlocking().first().getResource(); - - // Document to lock pause/resume clients - Document documentDefinition = getDocumentDefinition(); - documentDefinition.setId("test" + documentDefinition.getId()); - ResourceResponse childResource = writeClient.createDocument(parentResource.getSelfLink(), documentDefinition, null, true).toBlocking().first(); - logger.info("Created {} child resource", childResource.getResource().getResourceId()); - - String token = childResource.getSessionToken().split(":")[0] + ":" + this.createSessionToken(SessionTokenHelper.parse(childResource.getSessionToken()), 100000000).convertToString(); - - FeedOptions feedOptions = new FeedOptions(); - feedOptions.setPartitionKey(new PartitionKey(PartitionKeyInternal.Empty.toJson())); - feedOptions.setSessionToken(token); - FailureValidator validator = new FailureValidator.Builder().statusCode(HttpConstants.StatusCodes.NOTFOUND).subStatusCode(HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE).build(); - Observable> feedObservable = readSecondaryClient.readDocuments(parentResource.getSelfLink(), feedOptions); - validateQueryFailure(feedObservable, validator); - } finally { - safeClose(writeClient); - safeClose(readSecondaryClient); - } - } - - @Test(groups = {"direct"}, enabled = false, timeOut = CONSISTENCY_TEST_TIMEOUT) - public void validateStrongReadOnOldDocument() { - //TODO this need to complete once we implement emulator container in java, and the we can do operation - // like pause, resume, stop, recycle on it needed for this test. - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355053 - } - - // TODO: DANOBLE: Investigate Direct TCP performance issue - // Note that we need multiple CONSISTENCY_TEST_TIMEOUT - // SEE: https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028https://msdata.visualstudio.com/CosmosDB/_workitems/edit/367028 - - @Test(groups = {"direct"}, timeOut = 2 * CONSISTENCY_TEST_TIMEOUT) - public void validateSessionTokenAsync() { - // Validate that document query never fails - // with NotFoundException - List documents = new ArrayList<>(); - for (int i = 0; i < 1000; i++) { - Document documentDefinition = getDocumentDefinition(); - documentDefinition.set(UUID.randomUUID().toString(), UUID.randomUUID().toString()); - documents.add(documentDefinition); - } - - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - RxDocumentClientImpl client = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - - try { - Document lastDocument = client.createDocument(createdCollection.getSelfLink(), getDocumentDefinition(), null, true) - .toBlocking() - .first() - .getResource(); - - Completable task1 = ParallelAsync.forEachAsync(Range.between(0, 1000), 5, new Action1() { - @Override - public void call(Integer index) { - client.createDocument(createdCollection.getSelfLink(), documents.get(index % documents.size()), null, true).toBlocking().first(); - } - }); - - Completable task2 = ParallelAsync.forEachAsync(Range.between(0, 1000), 5, new Action1() { - @Override - public void call(Integer index) { - try { - FeedOptions feedOptions = new FeedOptions(); - feedOptions.setEnableCrossPartitionQuery(true); - FeedResponse queryResponse = client.queryDocuments(createdCollection.getSelfLink(), "SELECT * FROM c WHERE c.Id = 'foo'", feedOptions).toBlocking().first(); - String lsnHeaderValue = queryResponse.getResponseHeaders().get(WFConstants.BackendHeaders.LSN); - long lsn = Long.valueOf(lsnHeaderValue); - String sessionTokenHeaderValue = queryResponse.getResponseHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); - ISessionToken sessionToken = SessionTokenHelper.parse(sessionTokenHeaderValue); - logger.info("Session Token = {}, LSN = {}", sessionToken.convertToString(), lsn); - assertThat(lsn).isEqualTo(sessionToken.getLSN()); - } catch (Exception ex) { - DocumentClientException clientException = (DocumentClientException) ex.getCause(); - if (clientException.getStatusCode() != 0) { - if (clientException.getStatusCode() == HttpConstants.StatusCodes.REQUEST_TIMEOUT) { - // ignore - } else if (clientException.getStatusCode() == HttpConstants.StatusCodes.NOTFOUND) { - String lsnHeaderValue = clientException.getResponseHeaders().get(WFConstants.BackendHeaders.LSN); - long lsn = Long.valueOf(lsnHeaderValue); - String sessionTokenHeaderValue = clientException.getResponseHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); - ISessionToken sessionToken = SessionTokenHelper.parse(sessionTokenHeaderValue); - - logger.info("Session Token = {}, LSN = {}", sessionToken.convertToString(), lsn); - assertThat(lsn).isEqualTo(sessionToken.getLSN()); - } else { - throw ex; - } - } else { - throw ex; - } - } - } - }); - Completable.mergeDelayError(task1, task2).await(); - } finally { - safeClose(client); - } - } - -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConsistencyTestsBase.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConsistencyTestsBase.java deleted file mode 100644 index c26246436094..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ConsistencyTestsBase.java +++ /dev/null @@ -1,861 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - - -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.AccessCondition; -import com.microsoft.azure.cosmosdb.AccessConditionType; -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.PartitionKind; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.User; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.ISessionToken; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.SessionContainer; -import com.microsoft.azure.cosmosdb.internal.SessionTokenHelper; -import com.microsoft.azure.cosmosdb.internal.VectorSessionToken; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.WFConstants; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternalHelper; -import com.microsoft.azure.cosmosdb.internal.routing.Range; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.ResourceResponseValidator; -import com.microsoft.azure.cosmosdb.rx.TestConfigurations; -import com.microsoft.azure.cosmosdb.rx.TestSuiteBase; -import org.apache.commons.collections4.map.UnmodifiableMap; -import org.apache.commons.lang3.StringUtils; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import rx.Observable; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.util.Arrays; -import java.util.Date; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; - -import static org.assertj.core.api.Assertions.assertThat; - -public class ConsistencyTestsBase extends TestSuiteBase { - static final int CONSISTENCY_TEST_TIMEOUT = 120000; - static final String USER_NAME = "TestUser"; - RxDocumentClientImpl writeClient; - RxDocumentClientImpl readClient; - AsyncDocumentClient initClient; - Database createdDatabase; - DocumentCollection createdCollection; - - @BeforeClass(groups = {"direct"}, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - initClient = createGatewayRxDocumentClient().build(); - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - } - - void validateStrongConsistency(Resource resourceToWorkWith) throws Exception { - int numberOfTestIteration = 5; - Resource writeResource = resourceToWorkWith; - while (numberOfTestIteration-- > 0) //Write from a client and do point read through second client and ensure TS matches. - { - Date sourceTimestamp = writeResource.getTimestamp(); - Thread.sleep(1000); //Timestamp is in granularity of seconds. - Resource updatedResource = null; - if (resourceToWorkWith instanceof User) { - updatedResource = this.writeClient.upsertUser(createdDatabase.getSelfLink(), (User) writeResource, null).toBlocking().first().getResource(); - } else if (resourceToWorkWith instanceof Document) { - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(resourceToWorkWith.get("mypk"))); - updatedResource = this.writeClient.upsertDocument(createdCollection.getSelfLink(), (Document) writeResource, options, false).toBlocking().first().getResource(); - } - assertThat(updatedResource.getTimestamp().after(sourceTimestamp)).isTrue(); - - User readResource = this.readClient.readUser(resourceToWorkWith.getSelfLink(), null).toBlocking().first().getResource(); - assertThat(updatedResource.getTimestamp().equals(readResource.getTimestamp())); - } - } - - void validateConsistentLSN() { - Document documentDefinition = getDocumentDefinition(); - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(documentDefinition.get("mypk"))); - Document document = createDocument(this.writeClient, createdDatabase.getId(), createdCollection.getId(), documentDefinition); - ResourceResponse response = this.writeClient.deleteDocument(document.getSelfLink(), options).toBlocking().single(); - assertThat(response.getStatusCode()).isEqualTo(204); - - long quorumAckedLSN = Long.parseLong((String) response.getResponseHeaders().get(WFConstants.BackendHeaders.QUORUM_ACKED_LSN)); - assertThat(quorumAckedLSN > 0).isTrue(); - FailureValidator validator = new FailureValidator.Builder().statusCode(404).lsnGreaterThan(quorumAckedLSN).build(); - Observable> readObservable = this.readClient.readDocument(document.getSelfLink(), options); - validateFailure(readObservable, validator); - } - - void validateConsistentLSNAndQuorumAckedLSN() { - Document documentDefinition = getDocumentDefinition(); - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(documentDefinition.get("mypk"))); - Document document = createDocument(this.writeClient, createdDatabase.getId(), createdCollection.getId(), documentDefinition); - ResourceResponse response = this.writeClient.deleteDocument(document.getSelfLink(), options).toBlocking().single(); - assertThat(response.getStatusCode()).isEqualTo(204); - - long quorumAckedLSN = Long.parseLong((String) response.getResponseHeaders().get(WFConstants.BackendHeaders.QUORUM_ACKED_LSN)); - assertThat(quorumAckedLSN > 0).isTrue(); - - FailureValidator validator = new FailureValidator.Builder().statusCode(404).lsnGreaterThanEqualsTo(quorumAckedLSN).exceptionQuorumAckedLSNInNotNull().build(); - Observable> readObservable = this.readClient.deleteDocument(document.getSelfLink(), options); - validateFailure(readObservable, validator); - - } - - void validateReadQuorum(ConsistencyLevel consistencyLevel, ResourceType childResourceType, boolean isBoundedStaleness) { - //TODO this need to complete once we implement emulator container in java, and then we can do operation - // like pause, resume, stop, recycle on it needed for this test. - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/355053 - } - - void validateStrongConsistencyOnAsyncReplication(boolean useGateway) throws InterruptedException { - if (!TestConfigurations.CONSISTENCY.equalsIgnoreCase(ConsistencyLevel.Strong.toString())) { - throw new SkipException("Endpoint does not have strong consistency"); - } - - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - if (useGateway) { - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - } - - this.writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Strong).build(); - - this.readClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Strong).build(); - - Document documentDefinition = getDocumentDefinition(); - Document document = createDocument(this.writeClient, createdDatabase.getId(), createdCollection.getId(), documentDefinition); - validateStrongConsistency(document); - } - - void validateStrongConsistency(Document documentToWorkWith) throws InterruptedException { - int numberOfTestIteration = 5; - Document writeDocument = documentToWorkWith; - while (numberOfTestIteration-- > 0) { - Date sourceTimestamp = writeDocument.getTimestamp(); - Thread.sleep(1000);//Timestamp is in granularity of seconds. - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(documentToWorkWith.get("mypk"))); - Document updatedDocument = this.writeClient.replaceDocument(writeDocument, options).toBlocking().first().getResource(); - assertThat(updatedDocument.getTimestamp().after(sourceTimestamp)).isTrue(); - - Document readDocument = this.readClient.readDocument(documentToWorkWith.getSelfLink(), options).toBlocking().first().getResource(); - assertThat(updatedDocument.getTimestamp().equals(readDocument.getTimestamp())); - } - } - - void validateSessionContainerAfterCollectionCreateReplace(boolean useGateway) { - // Direct clients for read and write operations - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - if (useGateway) { - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - } else { - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - } - - RxDocumentClientImpl writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session).build(); - - try { - PartitionKeyDefinition partitionKey = new PartitionKeyDefinition(); - partitionKey.setPaths(Arrays.asList("/customerid")); - partitionKey.setKind(PartitionKind.Hash); - DocumentCollection coll = null; - { - // self link - ResourceResponse collection = writeClient.createCollection(createdDatabase.getSelfLink(), getCollectionDefinition(), null).toBlocking().first(); - String globalSessionToken1 = ((SessionContainer) writeClient.getSession()).getSessionToken(collection.getResource().getSelfLink()); - String globalSessionToken2 = ((SessionContainer) writeClient.getSession()).getSessionToken(BridgeInternal.getAltLink(collection.getResource())); - System.out.println("BridgeInternal.getAltLink(collection.getResource()) " + BridgeInternal.getAltLink(collection.getResource())); - assertThat(collection.getSessionToken()).isEqualTo(globalSessionToken1); - assertThat(collection.getSessionToken()).isEqualTo(globalSessionToken2); - - coll = collection.getResource(); - ResourceResponse collectionRead = writeClient.readCollection(coll.getSelfLink(), null).toBlocking().first(); - // timesync might bump the version, comment out the check - //assertThat(collection.getSessionToken()).isEqualTo(collectionRead.getSessionToken()); - } - { - // name link - ResourceResponse collection = writeClient.createCollection(BridgeInternal.getAltLink(createdDatabase), getCollectionDefinition(), null).toBlocking().first(); - - String globalSessionToken1 = ((SessionContainer) writeClient.getSession()).getSessionToken(collection.getResource().getSelfLink()); - String globalSessionToken2 = ((SessionContainer) writeClient.getSession()).getSessionToken(BridgeInternal.getAltLink(collection.getResource())); - assertThat(collection.getSessionToken()).isEqualTo(globalSessionToken1); - //assertThat(collection.getSessionToken()).isEqualTo(globalSessionToken2); - - ResourceResponse collectionRead = - writeClient.readCollection(BridgeInternal.getAltLink(collection.getResource()), null).toBlocking().first(); - // timesync might bump the version, comment out the check - //assertThat(collection.getSessionToken()).isEqualTo(collectionRead.getSessionToken()); - } - { - Document document2 = new Document(); - document2.setId("test" + UUID.randomUUID().toString()); - document2.set("customerid", 2); - // name link - ResourceResponse document = writeClient.createDocument(BridgeInternal.getAltLink(coll), document2, null, false).toBlocking().first(); - String globalSessionToken1 = ((SessionContainer) writeClient.getSession()).getSessionToken(coll.getSelfLink()); - String globalSessionToken2 = ((SessionContainer) writeClient.getSession()).getSessionToken(BridgeInternal.getAltLink(coll)); - - assertThat(globalSessionToken1.indexOf(document.getSessionToken())).isNotNegative(); - assertThat(globalSessionToken2.indexOf(document.getSessionToken())).isNotNegative(); - } - { - Document document2 = new Document(); - document2.setId("test" + UUID.randomUUID().toString()); - document2.set("customerid", 3); - // name link - ResourceResponse document = writeClient.createDocument(BridgeInternal.getAltLink(coll), document2, null, false).toBlocking().first(); - String globalSessionToken1 = ((SessionContainer) writeClient.getSession()).getSessionToken(coll.getSelfLink()); - String globalSessionToken2 = ((SessionContainer) writeClient.getSession()).getSessionToken(BridgeInternal.getAltLink(coll)); - - assertThat(globalSessionToken1.indexOf(document.getSessionToken())).isNotNegative(); - assertThat(globalSessionToken2.indexOf(document.getSessionToken())).isNotNegative(); - } - } finally { - safeClose(writeClient); - } - } - - boolean validateConsistentPrefix(Resource resourceToWorkWith) throws InterruptedException { - int numberOfTestIteration = 5; - Date lastReadDateTime = resourceToWorkWith.getTimestamp(); - boolean readLagging = false; - Resource writeResource = resourceToWorkWith; - - while (numberOfTestIteration-- > 0) { //Write from a client and do point read through second client and ensure TS monotonically increases. - Date sourceTimestamp = writeResource.getTimestamp(); - Thread.sleep(1000); //Timestamp is in granularity of seconds. - Resource updatedResource = null; - if (resourceToWorkWith instanceof User) { - updatedResource = this.writeClient.upsertUser(createdDatabase.getSelfLink(), (User) writeResource, null).toBlocking().first().getResource(); - } else if (resourceToWorkWith instanceof Document) { - updatedResource = this.writeClient.upsertDocument(createdCollection.getSelfLink(), (Document) writeResource, null, false).toBlocking().first().getResource(); - } - assertThat(updatedResource.getTimestamp().after(sourceTimestamp)).isTrue(); - writeResource = updatedResource; - - Resource readResource = null; - if (resourceToWorkWith instanceof User) { - readResource = this.readClient.readUser(resourceToWorkWith.getSelfLink(), null).toBlocking().first().getResource(); - } else if (resourceToWorkWith instanceof Document) { - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(resourceToWorkWith.get("mypk"))); - readResource = this.readClient.readDocument(resourceToWorkWith.getSelfLink(), options).toBlocking().first().getResource(); - } - assertThat(readResource.getTimestamp().compareTo(lastReadDateTime) >= 0).isTrue(); - lastReadDateTime = readResource.getTimestamp(); - if (readResource.getTimestamp().before(updatedResource.getTimestamp())) { - readLagging = true; - } - } - return readLagging; - } - - boolean validateReadSession(Resource resourceToWorkWith) throws InterruptedException { - int numberOfTestIteration = 5; - Date lastReadDateTime = new java.sql.Date(0); - boolean readLagging = false; - Resource writeResource = resourceToWorkWith; - - while (numberOfTestIteration-- > 0) { - Date sourceTimestamp = writeResource.getTimestamp(); - Thread.sleep(1000); - Resource updatedResource = null; - if (resourceToWorkWith instanceof Document) { - updatedResource = this.writeClient.upsertDocument(createdCollection.getSelfLink(), writeResource, null, false).toBlocking().single().getResource(); - } - assertThat(updatedResource.getTimestamp().after(sourceTimestamp)).isTrue(); - writeResource = updatedResource; - - Resource readResource = null; - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(resourceToWorkWith.get("mypk"))); - if (resourceToWorkWith instanceof Document) { - readResource = this.readClient.readDocument(resourceToWorkWith.getSelfLink(), requestOptions).toBlocking().first().getResource(); - } - assertThat(readResource.getTimestamp().compareTo(lastReadDateTime) >= 0).isTrue(); - lastReadDateTime = readResource.getTimestamp(); - - if (readResource.getTimestamp().before(updatedResource.getTimestamp())) { - readLagging = true; - } - } - return readLagging; - } - - boolean validateWriteSession(Resource resourceToWorkWith) throws InterruptedException { - int numberOfTestIteration = 5; - Date lastReadDateTime = new java.sql.Date(0); - boolean readLagging = false; - Resource writeResource = resourceToWorkWith; - - while (numberOfTestIteration-- > 0) { - Date sourceTimestamp = writeResource.getTimestamp(); - Thread.sleep(1000); - Resource updatedResource = null; - if (resourceToWorkWith instanceof Document) { - updatedResource = this.writeClient.upsertDocument(createdCollection.getSelfLink(), writeResource, null, false).toBlocking().single().getResource(); - } - assertThat(updatedResource.getTimestamp().after(sourceTimestamp)).isTrue(); - writeResource = updatedResource; - - Resource readResource = null; - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(resourceToWorkWith.get("mypk"))); - if (resourceToWorkWith instanceof Document) { - readResource = this.readClient.readDocument(resourceToWorkWith.getSelfLink(), requestOptions).toBlocking().first().getResource(); - } - assertThat(readResource.getTimestamp().compareTo(lastReadDateTime) >= 0).isTrue(); - lastReadDateTime = readResource.getTimestamp(); - - if (readResource.getTimestamp().before(updatedResource.getTimestamp())) { - readLagging = true; - } - - //Now perform write on session and update our session token and lastReadTS - Thread.sleep(1000); - if (resourceToWorkWith instanceof Document) { - readResource = this.writeClient.upsertDocument(createdCollection.getSelfLink(), readResource, requestOptions, false).toBlocking().first().getResource(); //Now perform write on session - } - assertThat(readResource.getTimestamp().after(lastReadDateTime)); - - this.readClient.setSession(this.writeClient.getSession()); - } - return readLagging; - } - - void validateSessionContainerAfterCollectionDeletion(boolean useGateway) throws Exception { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - if (useGateway) { - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - } else { - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - } - RxDocumentClientImpl client1 = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - RxDocumentClientImpl client2 = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - - String collectionId = UUID.randomUUID().toString(); - try { - DocumentCollection collectionDefinition = getCollectionDefinition(); - collectionDefinition.setId(collectionId); - DocumentCollection collection = createCollection(client2, createdDatabase.getId(), collectionDefinition, null); - ResourceResponseValidator successValidatorCollection = new ResourceResponseValidator.Builder() - .withId(collection.getId()) - .build(); - Observable> readObservableCollection = client2.readCollection(collection.getSelfLink(), null); - validateSuccess(readObservableCollection, successValidatorCollection); - - for (int i = 0; i < 5; i++) { - String documentId = "Generation1-" + i; - Document documentDefinition = getDocumentDefinition(); - documentDefinition.setId(documentId); - Document documentCreated = client2.createDocument(collection.getSelfLink(), documentDefinition, null, true).toBlocking().first().getResource(); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(documentCreated.get("mypk"))); - client2.readDocument(BridgeInternal.getAltLink(documentCreated), requestOptions).toBlocking().first(); - client2.readDocument(documentCreated.getSelfLink(), requestOptions).toBlocking().first(); - } - - { - // just create the second for fun - DocumentCollection collection2 = createCollection(client2, createdDatabase.getId(), getCollectionDefinition(), null); - successValidatorCollection = new ResourceResponseValidator.Builder() - .withId(collection2.getId()) - .build(); - readObservableCollection = client2.readCollection(collection2.getSelfLink(), null); - validateSuccess(readObservableCollection, successValidatorCollection); - } - // verify the client2 has the same token. - { - String token1 = ((SessionContainer) client2.getSession()).getSessionToken(BridgeInternal.getAltLink(collection)); - String token2 = ((SessionContainer) client2.getSession()).getSessionToken(collection.getSelfLink()); - assertThat(token1).isEqualTo(token2); - } - - // now delete collection use different client - client1.deleteCollection(collection.getSelfLink(), null).toBlocking().first(); - - DocumentCollection collectionRandom1 = createCollection(client2, createdDatabase.getId(), getCollectionDefinition()); - DocumentCollection documentCollection = getCollectionDefinition(); - collectionDefinition.setId(collectionId); - DocumentCollection collectionSameName = createCollection(client2, createdDatabase.getId(), collectionDefinition); - String documentId1 = "Generation2-" + 0; - Document databaseDefinition2 = getDocumentDefinition(); - databaseDefinition2.setId(documentId1); - Document createdDocument = client1.createDocument(collectionSameName.getSelfLink(), databaseDefinition2, null, true).toBlocking().first().getResource(); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(createdDocument.get("mypk"))); - ResourceResponseValidator successValidator = new ResourceResponseValidator.Builder() - .withId(createdDocument.getId()) - .build(); - Observable> readObservable = client1.readDocument(createdDocument.getSelfLink(), requestOptions); - validateSuccess(readObservable, successValidator); - { - String token1 = ((SessionContainer) client1.getSession()).getSessionToken(BridgeInternal.getAltLink(collectionSameName)); - String token2 = ((SessionContainer) client1.getSession()).getSessionToken(collectionSameName.getSelfLink()); - assertThat(token1).isEqualTo(token2); - } - - { - // Client2 read using name link should fail with higher LSN. - String token = ((SessionContainer) client1.getSession()).getSessionToken(collectionSameName.getSelfLink()); - // artificially bump to higher LSN - String higherLsnToken = this.getDifferentLSNToken(token, 2000); - RequestOptions requestOptions1 = new RequestOptions(); - requestOptions1.setSessionToken(higherLsnToken); - requestOptions1.setPartitionKey(new PartitionKey(createdDocument.get("mypk"))); - readObservable = client2.readDocument(BridgeInternal.getAltLink(createdDocument), requestOptions1); - FailureValidator failureValidator = new FailureValidator.Builder().subStatusCode(1002).build(); - validateFailure(readObservable, failureValidator); - } - // this will trigger client2 to clear the token - { - // verify token by altlink is gone! - String token1 = ((SessionContainer) client2.getSession()).getSessionToken(BridgeInternal.getAltLink(collectionSameName)); - String token2 = ((SessionContainer) client2.getSession()).getSessionToken(collection.getSelfLink()); - assertThat(token1).isEmpty(); - //assertThat(token2).isNotEmpty(); In java both SelfLink and AltLink token remain in sync. - } - { - // second read should succeed! - readObservable = client2.readDocument(BridgeInternal.getAltLink(createdDocument), requestOptions); - validateSuccess(readObservable, successValidator); - } - // verify deleting indeed delete the collection session token - { - Document documentTest = - client1.createDocument(BridgeInternal.getAltLink(collectionSameName), getDocumentDefinition(), null, true).toBlocking().first().getResource(); - RequestOptions options = new RequestOptions(); - options.setPartitionKey(new PartitionKey(documentTest.get("mypk"))); - successValidator = new ResourceResponseValidator.Builder() - .withId(documentTest.getId()) - .build(); - readObservable = client1.readDocument(documentTest.getSelfLink(), options); - validateSuccess(readObservable, successValidator); - - client1.deleteCollection(collectionSameName.getSelfLink(), null).toBlocking().first(); - String token1 = ((SessionContainer) client2.getSession()).getSessionToken(BridgeInternal.getAltLink(collectionSameName)); - String token2 = ((SessionContainer) client2.getSession()).getSessionToken(collectionSameName.getSelfLink()); - // currently we can't delete the token from Altlink when deleting using selflink - assertThat(token1).isNotEmpty(); - //assertThat(token2).isEmpty(); In java both SelfLink and AltLink token remain in sync. - } - } finally { - safeClose(client1); - safeClose(client2); - } - - } - - void validateSessionTokenWithPreConditionFailure(boolean useGateway) throws Exception { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - if (useGateway) { - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - } else { - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - } - RxDocumentClientImpl writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - RxDocumentClientImpl validationClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - try { - // write a document, and upsert to it to update etag. - ResourceResponse documentResponse = writeClient.createDocument(BridgeInternal.getAltLink(createdCollection), getDocumentDefinition(), null, true).toBlocking().first(); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(documentResponse.getResource().get("mypk"))); - ResourceResponse upsertResponse = - writeClient.upsertDocument(BridgeInternal.getAltLink(createdCollection), documentResponse.getResource(), requestOptions, true).toBlocking().first(); - - // create a conditioned read request, with first write request's etag, so the read fails with PreconditionFailure - AccessCondition ac = new AccessCondition(); - ac.setCondition(documentResponse.getResource().getETag()); - ac.setType(AccessConditionType.IfMatch); - RequestOptions requestOptions1 = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(documentResponse.getResource().get("mypk"))); - requestOptions1.setAccessCondition(ac); - Observable> preConditionFailureResponseObservable = validationClient.upsertDocument(BridgeInternal.getAltLink(createdCollection), - documentResponse.getResource(), requestOptions1, true); - FailureValidator failureValidator = new FailureValidator.Builder().statusCode(HttpConstants.StatusCodes.PRECONDITION_FAILED).build(); - validateFailure(preConditionFailureResponseObservable, failureValidator); - assertThat(isSessionEqual(((SessionContainer) validationClient.getSession()), (SessionContainer) writeClient.getSession())).isTrue(); - - } finally { - safeClose(writeClient); - safeClose(validationClient); - } - } - - void validateSessionTokenWithDocumentNotFoundException(boolean useGateway) throws Exception { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - if (useGateway) { - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - } else { - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - } - RxDocumentClientImpl writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - RxDocumentClientImpl validationClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - try { - DocumentCollection collectionDefinition = getCollectionDefinition(); - collectionDefinition.setId("TestCollection"); - - ResourceResponse documentResponse = writeClient.createDocument(BridgeInternal.getAltLink(createdCollection), getDocumentDefinition(), null, true).toBlocking().first(); - - FailureValidator failureValidator = new FailureValidator.Builder().statusCode(HttpConstants.StatusCodes.NOTFOUND).build(); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(documentResponse.getResource().get("mypk"))); - // try to read a non existent document in the same partition that we previously wrote to - Observable> readObservable = validationClient.readDocument(BridgeInternal.getAltLink(documentResponse.getResource()) + "dummy", requestOptions); - validateFailure(readObservable, failureValidator); - assertThat(isSessionEqual(((SessionContainer) validationClient.getSession()), (SessionContainer) writeClient.getSession())).isTrue(); - } finally { - safeClose(writeClient); - safeClose(validationClient); - } - } - - void validateSessionTokenWithExpectedException(boolean useGateway) throws Exception { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - if (useGateway) { - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - } else { - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - } - RxDocumentClientImpl writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - try { - ResourceResponse documentResponse = - writeClient.createDocument(BridgeInternal.getAltLink(createdCollection), getDocumentDefinition(), null, false).toBlocking().first(); - String token = documentResponse.getResponseHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN); - - // artificially bump to higher LSN - String higherLsnToken = this.getDifferentLSNToken(token, 2000); - FailureValidator failureValidator = new FailureValidator.Builder().subStatusCode(HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE).build(); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(documentResponse.getResource().get("mypk"))); - requestOptions.setSessionToken(higherLsnToken); - // try to read a non existent document in the same partition that we previously wrote to - Observable> readObservable = writeClient.readDocument(BridgeInternal.getAltLink(documentResponse.getResource()), - requestOptions); - validateFailure(readObservable, failureValidator); - - } finally { - safeClose(writeClient); - } - } - - void validateSessionTokenWithConflictException(boolean useGateway) { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - if (useGateway) { - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - } else { - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - } - RxDocumentClientImpl writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - RxDocumentClientImpl validationClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - try { - Document documentDefinition = getDocumentDefinition(); - ResourceResponse documentResponse = - writeClient.createDocument(BridgeInternal.getAltLink(createdCollection), documentDefinition, null, true).toBlocking().first(); - - FailureValidator failureValidator = new FailureValidator.Builder().statusCode(HttpConstants.StatusCodes.CONFLICT).build(); - Observable> conflictDocumentResponse = validationClient.createDocument(BridgeInternal.getAltLink(createdCollection), - documentDefinition, null, - true); - validateFailure(conflictDocumentResponse, failureValidator); - } finally { - safeClose(writeClient); - safeClose(validationClient); - } - } - - void validateSessionTokenMultiPartitionCollection(boolean useGateway) throws Exception { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - if (useGateway) { - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - } else { - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - } - RxDocumentClientImpl writeClient = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - try { - - Range fullRange = new Range(PartitionKeyInternalHelper.MinimumInclusiveEffectivePartitionKey, - PartitionKeyInternalHelper.MaximumExclusiveEffectivePartitionKey, true, false); - - IRoutingMapProvider routingMapProvider = writeClient.getPartitionKeyRangeCache(); - // assertThat(routingMapProvider.tryGetOverlappingRangesAsync(collection.getResourceId(), fullRange, false).toBlocking().value().size()).isEqualTo(5); - - // Document to lock pause/resume clients - Document document1 = new Document(); - document1.setId("test" + UUID.randomUUID().toString()); - document1.set("mypk", 1); - ResourceResponse childResource1 = writeClient.createDocument(createdCollection.getSelfLink(), document1, null, true).toBlocking().first(); - logger.info("Created {} child resource", childResource1.getResource().getResourceId()); - assertThat(childResource1.getSessionToken()).isNotNull(); - assertThat(childResource1.getSessionToken().contains(":")).isTrue(); - String globalSessionToken1 = ((SessionContainer) writeClient.getSession()).getSessionToken(createdCollection.getSelfLink()); - assertThat(globalSessionToken1.contains(childResource1.getSessionToken())); - - // Document to lock pause/resume clients - Document document2 = new Document(); - document2.setId("test" + UUID.randomUUID().toString()); - document2.set("mypk", 2); - ResourceResponse childResource2 = writeClient.createDocument(createdCollection.getSelfLink(), document2, null, true).toBlocking().first(); - assertThat(childResource2.getSessionToken()).isNotNull(); - assertThat(childResource2.getSessionToken().contains(":")).isTrue(); - String globalSessionToken2 = ((SessionContainer) writeClient.getSession()).getSessionToken(createdCollection.getSelfLink()); - logger.info("globalsessiontoken2 {}, childtoken1 {}, childtoken2 {}", globalSessionToken2, childResource1.getSessionToken(), childResource2.getSessionToken()); - assertThat(globalSessionToken2.contains(childResource2.getSessionToken())).isTrue(); - - // this token can read childresource2 but not childresource1 - String sessionToken = - StringUtils.split(childResource1.getSessionToken(), ':')[0] + ":" + createSessionToken(SessionTokenHelper.parse(childResource1.getSessionToken()), 100000000).convertToString() + "," + childResource2.getSessionToken(); - - RequestOptions option = new RequestOptions(); - option.setSessionToken(sessionToken); - option.setPartitionKey(new PartitionKey(2)); - writeClient.readDocument(childResource2.getResource().getSelfLink(), option).toBlocking().first(); - - option = new RequestOptions(); - option.setSessionToken(StringUtils.EMPTY); - option.setPartitionKey(new PartitionKey(1)); - writeClient.readDocument(childResource1.getResource().getSelfLink(), option).toBlocking().first(); - - option = new RequestOptions(); - option.setSessionToken(sessionToken); - option.setPartitionKey(new PartitionKey(1)); - Observable> readObservable = writeClient.readDocument(childResource1.getResource().getSelfLink(), option); - FailureValidator failureValidator = - new FailureValidator.Builder().statusCode(HttpConstants.StatusCodes.NOTFOUND).subStatusCode(HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE).build(); - validateFailure(readObservable, failureValidator); - - readObservable = writeClient.readDocument(childResource2.getResource().getSelfLink(), option); - failureValidator = - new FailureValidator.Builder().statusCode(HttpConstants.StatusCodes.NOTFOUND).subStatusCode(HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE).build(); - validateFailure(readObservable, failureValidator); - - assertThat(((SessionContainer) writeClient.getSession()).getSessionToken(createdCollection.getSelfLink())).isEqualTo - (((SessionContainer) writeClient.getSession()).getSessionToken(BridgeInternal.getAltLink(createdCollection))); - - assertThat(((SessionContainer) writeClient.getSession()).getSessionToken("asdfasdf")).isEmpty(); - assertThat(((SessionContainer) writeClient.getSession()).getSessionToken(createdDatabase.getSelfLink())).isEmpty(); - } finally { - safeClose(writeClient); - } - } - - void validateSessionTokenFromCollectionReplaceIsServerToken(boolean useGateway) { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - if (useGateway) { - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - } else { - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - } - RxDocumentClientImpl client1 = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - RxDocumentClientImpl client2 = null; - try { - Document doc = client1.createDocument(createdCollection.getSelfLink(), getDocumentDefinition(), null, true).toBlocking().first().getResource(); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setPartitionKey(new PartitionKey(doc.get("mypk"))); - Document doc1 = client1.readDocument(BridgeInternal.getAltLink(doc), requestOptions).toBlocking().first().getResource(); - - String token1 = ((SessionContainer) client1.getSession()).getSessionToken(createdCollection.getSelfLink()); - client2 = (RxDocumentClientImpl) new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session) - .build(); - client2.replaceCollection(createdCollection, null).toBlocking().first(); - String token2 = ((SessionContainer) client2.getSession()).getSessionToken(createdCollection.getSelfLink()); - - logger.info("Token after document and after collection replace {} = {}", token1, token2); - } finally { - safeClose(client1); - safeClose(client2); - } - } - - @AfterClass(groups = {"direct"}, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(this.initClient); - safeClose(this.writeClient); - safeClose(this.readClient); - } - - private String getDifferentLSNToken(String token, long lsnDifferent) throws Exception { - String[] tokenParts = StringUtils.split(token, ':'); - ISessionToken sessionToken = SessionTokenHelper.parse(tokenParts[1]); - ISessionToken differentSessionToken = createSessionToken(sessionToken, sessionToken.getLSN() + lsnDifferent); - return String.format("%s:%s", tokenParts[0], differentSessionToken.convertToString()); - } - - public static ISessionToken createSessionToken(ISessionToken from, long globalLSN) throws Exception { - // Creates session token with specified GlobalLSN - if (from instanceof VectorSessionToken) { - VectorSessionToken fromSessionToken = (VectorSessionToken) from; - Field fieldVersion = VectorSessionToken.class.getDeclaredField("version"); - fieldVersion.setAccessible(true); - Long version = (Long) fieldVersion.get(fromSessionToken); - - Field fieldLocalLsnByRegion = VectorSessionToken.class.getDeclaredField("localLsnByRegion"); - fieldLocalLsnByRegion.setAccessible(true); - UnmodifiableMap localLsnByRegion = (UnmodifiableMap) fieldLocalLsnByRegion.get(fromSessionToken); - - Constructor constructor = VectorSessionToken.class.getDeclaredConstructor(long.class, long.class, UnmodifiableMap.class); - constructor.setAccessible(true); - VectorSessionToken vectorSessionToken = constructor.newInstance(version, globalLSN, localLsnByRegion); - return vectorSessionToken; - } else { - throw new IllegalArgumentException(); - } - } - - Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } - - private boolean isSessionEqual(SessionContainer sessionContainer1, SessionContainer sessionContainer2) throws Exception { - if (sessionContainer1 == null) { - return false; - } - - if (sessionContainer2 == null) { - return false; - } - - if (sessionContainer1 == sessionContainer2) { - return true; - } - - Field fieldCollectionResourceIdToSessionTokens1 = SessionContainer.class.getDeclaredField("collectionResourceIdToSessionTokens"); - Field fieldCollectionNameToCollectionResourceId1 = SessionContainer.class.getDeclaredField("collectionNameToCollectionResourceId"); - fieldCollectionResourceIdToSessionTokens1.setAccessible(true); - fieldCollectionNameToCollectionResourceId1.setAccessible(true); - ConcurrentHashMap> collectionResourceIdToSessionTokens1 = - (ConcurrentHashMap>) fieldCollectionResourceIdToSessionTokens1.get(sessionContainer1); - ConcurrentHashMap collectionNameToCollectionResourceId1 = (ConcurrentHashMap) fieldCollectionNameToCollectionResourceId1.get(sessionContainer1); - - - Field fieldCollectionResourceIdToSessionTokens2 = SessionContainer.class.getDeclaredField("collectionResourceIdToSessionTokens"); - Field fieldCollectionNameToCollectionResourceId2 = SessionContainer.class.getDeclaredField("collectionNameToCollectionResourceId"); - fieldCollectionResourceIdToSessionTokens2.setAccessible(true); - fieldCollectionNameToCollectionResourceId2.setAccessible(true); - ConcurrentHashMap> collectionResourceIdToSessionTokens2 = - (ConcurrentHashMap>) fieldCollectionResourceIdToSessionTokens2.get(sessionContainer2); - ConcurrentHashMap collectionNameToCollectionResourceId2 = (ConcurrentHashMap) fieldCollectionNameToCollectionResourceId2.get(sessionContainer2); - - if (collectionResourceIdToSessionTokens1.size() != collectionResourceIdToSessionTokens2.size() || - collectionNameToCollectionResourceId1.size() != collectionNameToCollectionResourceId2.size()) { - return false; - } - - // get keys, and compare entries - for (Long resourceId : collectionResourceIdToSessionTokens1.keySet()) { - if (!collectionResourceIdToSessionTokens1.get(resourceId).equals(collectionResourceIdToSessionTokens2.get(resourceId))) { - return false; - } - } - - for (String collectionName : collectionNameToCollectionResourceId1.keySet()) { - if (!collectionNameToCollectionResourceId1.get(collectionName).equals(collectionNameToCollectionResourceId2.get(collectionName))) { - return false; - } - } - - return true; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/DocumentQuerySpyWireContentTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/DocumentQuerySpyWireContentTest.java deleted file mode 100644 index 79e792a5c0cf..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/DocumentQuerySpyWireContentTest.java +++ /dev/null @@ -1,222 +0,0 @@ -/** - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.TimeUnit; - -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.DataType; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.IncludedPath; -import com.microsoft.azure.cosmosdb.Index; -import com.microsoft.azure.cosmosdb.IndexingPolicy; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; -import com.microsoft.azure.cosmosdb.rx.SpyClientBuilder; -import com.microsoft.azure.cosmosdb.rx.TestSuiteBase; -import com.microsoft.azure.cosmosdb.rx.Utils; - -import io.netty.buffer.ByteBuf; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; -import rx.Observable; - -public class DocumentQuerySpyWireContentTest extends TestSuiteBase { - private Database createdDatabase; - private DocumentCollection createdSinglePartitionCollection; - private DocumentCollection createdMultiPartitionCollection; - - private List createdDocumentsInSinglePartitionCollection = new ArrayList<>(); - private List createdDocumentsInMultiPartitionCollection = new ArrayList<>(); - - private SpyClientUnderTestFactory.ClientUnderTest client; - - public String getSinglePartitionCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdSinglePartitionCollection.getId()); - } - - public String getMultiPartitionCollectionLink() { - return Utils.getCollectionNameLink(createdDatabase.getId(), createdMultiPartitionCollection.getId()); - } - - @Factory(dataProvider = "clientBuilders") - public DocumentQuerySpyWireContentTest(Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @DataProvider(name = "responseContinuationTokenLimitParamProvider") - public static Object[][] responseContinuationTokenLimitParamProvider() { - - FeedOptions options1 = new FeedOptions(); - options1.setMaxItemCount(1); - options1.setResponseContinuationTokenLimitInKb(5); - options1.setPartitionKey(new PartitionKey("99")); - String query1 = "Select * from r"; - boolean multiPartitionCollection1 = true; - - FeedOptions options2 = new FeedOptions(); - options2.setMaxItemCount(1); - options2.setResponseContinuationTokenLimitInKb(5); - options2.setPartitionKey(new PartitionKey("99")); - String query2 = "Select * from r order by r.prop"; - boolean multiPartitionCollection2 = false; - - FeedOptions options3 = new FeedOptions(); - options3.setMaxItemCount(1); - options3.setResponseContinuationTokenLimitInKb(5); - options3.setPartitionKey(new PartitionKey("99")); - String query3 = "Select * from r"; - boolean multiPartitionCollection3 = false; - - FeedOptions options4 = new FeedOptions(); - options4.setPartitionKey(new PartitionKey("99")); - String query4 = "Select * from r order by r.prop"; - boolean multiPartitionCollection4 = false; - - return new Object[][]{ - {options1, query1, multiPartitionCollection1}, - {options2, query2, multiPartitionCollection2}, - {options3, query3, multiPartitionCollection3}, - {options4, query4, multiPartitionCollection4}, - }; - } - - @Test(dataProvider = "responseContinuationTokenLimitParamProvider", groups = { "simple" }, timeOut = TIMEOUT) - public void queryWithContinuationTokenLimit(FeedOptions options, String query, boolean isMultiParitionCollection) throws Exception { - String collectionLink; - if (isMultiParitionCollection) { - collectionLink = getMultiPartitionCollectionLink(); - } else { - collectionLink = getSinglePartitionCollectionLink(); - } - - client.clearCapturedRequests(); - - Observable> queryObservable = client - .queryDocuments(collectionLink, query, options); - - List results = queryObservable.flatMap(p -> Observable.from(p.getResults())) - .toList().toBlocking().single(); - - assertThat(results.size()).describedAs("total results").isGreaterThanOrEqualTo(1); - - List> requests = client.getCapturedRequests(); - - for(HttpClientRequest req: requests) { - validateRequestHasContinuationTokenLimit(req, options.getResponseContinuationTokenLimitInKb()); - } - } - - private void validateRequestHasContinuationTokenLimit(HttpClientRequest request, Integer expectedValue) { - if (expectedValue != null && expectedValue > 0) { - assertThat(request.getHeaders() - .contains(HttpConstants.HttpHeaders.RESPONSE_CONTINUATION_TOKEN_LIMIT_IN_KB)) - .isTrue(); - assertThat(request.getHeaders() - .get("x-ms-documentdb-responsecontinuationtokenlimitinkb")) - .isEqualTo(Integer.toString(expectedValue)); - } else { - assertThat(request.getHeaders() - .contains(HttpConstants.HttpHeaders.RESPONSE_CONTINUATION_TOKEN_LIMIT_IN_KB)) - .isFalse(); - } - } - - public Document createDocument(AsyncDocumentClient client, String collectionLink, int cnt) { - - Document docDefinition = getDocumentDefinition(cnt); - return client - .createDocument(collectionLink, docDefinition, null, false).toBlocking().single().getResource(); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() throws Exception { - client = new SpyClientBuilder(clientBuilder).build(); - createdDatabase = SHARED_DATABASE; - createdSinglePartitionCollection = SHARED_SINGLE_PARTITION_COLLECTION; - truncateCollection(SHARED_SINGLE_PARTITION_COLLECTION); - - createdMultiPartitionCollection = SHARED_MULTI_PARTITION_COLLECTION; - truncateCollection(SHARED_MULTI_PARTITION_COLLECTION); - - for(int i = 0; i < 3; i++) { - createdDocumentsInSinglePartitionCollection.add(createDocument(client, getCollectionLink(createdSinglePartitionCollection), i)); - createdDocumentsInMultiPartitionCollection.add(createDocument(client, getCollectionLink(createdMultiPartitionCollection), i)); - } - - for(int i = 0; i < 5; i++) { - createdDocumentsInSinglePartitionCollection.add(createDocument(client, getCollectionLink(createdSinglePartitionCollection), 99)); - createdDocumentsInMultiPartitionCollection.add(createDocument(client, getCollectionLink(createdMultiPartitionCollection), 99)); - } - - // wait for catch up - TimeUnit.SECONDS.sleep(1); - - FeedOptions options = new FeedOptions(); - options.setEnableCrossPartitionQuery(true); - - // do the query once to ensure the collection is cached. - client.queryDocuments(getMultiPartitionCollectionLink(), "select * from root", options) - .toCompletable().await(); - - // do the query once to ensure the collection is cached. - client.queryDocuments(getSinglePartitionCollectionLink(), "select * from root", options) - .toCompletable().await(); - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private static Document getDocumentDefinition(int cnt) { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"prop\" : %d, " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, cnt, cnt)); - return doc; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/NetworkFailureTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/NetworkFailureTest.java deleted file mode 100644 index 4ce4abf58452..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/NetworkFailureTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.CollectionCrudTest; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.TestSuiteBase; -import org.mockito.Mockito; -import org.testng.annotations.AfterClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Observable; - -import java.net.UnknownHostException; -import java.time.Instant; - -import static org.assertj.core.api.Java6Assertions.assertThat; - -public class NetworkFailureTest extends TestSuiteBase { - private static final int TIMEOUT = ClientRetryPolicy.MaxRetryCount * ClientRetryPolicy.RetryIntervalInMS + 60000; - private final DocumentCollection collectionDefinition; - - @Factory(dataProvider = "simpleClientBuildersWithDirect") - public NetworkFailureTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - this.collectionDefinition = getCollectionDefinition(); - } - - @Test(groups = { "emulator" }, timeOut = TIMEOUT) - public void createCollectionWithUnreachableHost() { - SpyClientUnderTestFactory.ClientWithGatewaySpy client = null; - - try { - client = SpyClientUnderTestFactory.createClientWithGatewaySpy(clientBuilder); - - Database database = SHARED_DATABASE; - - Observable> createObservable = client - .createCollection(database.getSelfLink(), collectionDefinition, null); - - - final RxGatewayStoreModel origGatewayStoreModel = client.getOrigGatewayStoreModel(); - - Mockito.doAnswer(invocation -> { - RxDocumentServiceRequest request = invocation.getArgumentAt(0, RxDocumentServiceRequest.class); - - if (request.getResourceType() == ResourceType.DocumentCollection) { - return Observable.error(new UnknownHostException()); - } - - return origGatewayStoreModel.processMessage(request); - - }).when(client.getSpyGatewayStoreModel()).processMessage(Mockito.any()); - - - FailureValidator validator = new FailureValidator.Builder().instanceOf(UnknownHostException.class).build(); - Instant start = Instant.now(); - validateFailure(createObservable, validator, TIMEOUT); - Instant after = Instant.now(); - assertThat(after.toEpochMilli() - start.toEpochMilli()) - .isGreaterThanOrEqualTo(ClientRetryPolicy.MaxRetryCount * ClientRetryPolicy.RetryIntervalInMS); - - } finally { - safeClose(client); - } - } - - @AfterClass(groups = { "emulator" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - AsyncDocumentClient client = createGatewayHouseKeepingDocumentClient().build(); - safeDeleteCollection(client, collectionDefinition); - client.close(); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ParallelAsync.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ParallelAsync.java deleted file mode 100644 index 47e7987673f1..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/ParallelAsync.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import org.apache.commons.lang3.Range; -import rx.Completable; -import rx.functions.Action1; - -import java.util.ArrayList; -import java.util.List; - -public class ParallelAsync { - - static Completable forEachAsync(Range range, int partition, Action1 func) { - - int partitionSize = (range.getMaximum() - range.getMinimum()) / partition; - List task = new ArrayList<>(); - int startRange = range.getMinimum(); - for (int i = 0; i < partition; i++) { - Range integerRange = Range.between(startRange, startRange + partitionSize); - task.add(Completable.defer(() -> { - for(int j = integerRange.getMinimum(); j < integerRange.getMaximum();j++) { - func.call(j); - } - return Completable.complete(); - })); - startRange = startRange + partitionSize ; - } - return Completable.mergeDelayError(task); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RetryCreateDocumentTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RetryCreateDocumentTest.java deleted file mode 100644 index 536ac8e7c38b..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RetryCreateDocumentTest.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.google.common.collect.ImmutableMap; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.ResourceResponseValidator; -import com.microsoft.azure.cosmosdb.rx.TestSuiteBase; -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; -import rx.Observable; - -import javax.net.ssl.SSLException; -import java.lang.reflect.Method; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; - -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.doAnswer; - -public class RetryCreateDocumentTest extends TestSuiteBase { - - private SpyClientUnderTestFactory.ClientWithGatewaySpy client; - - private Database database; - private DocumentCollection collection; - - @Factory(dataProvider = "clientBuilders") - public RetryCreateDocumentTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void retryDocumentCreate() throws Exception { - // create a document to ensure collection is cached - client.createDocument(collection.getSelfLink(), getDocumentDefinition(), null, false).toBlocking().single(); - - Document docDefinition = getDocumentDefinition(); - - Observable> createObservable = client - .createDocument(collection.getSelfLink(), docDefinition, null, false); - AtomicInteger count = new AtomicInteger(); - - doAnswer(new Answer< Observable>() { - @Override - public Observable answer(InvocationOnMock invocation) throws Throwable { - RxDocumentServiceRequest req = (RxDocumentServiceRequest) invocation.getArguments()[0]; - if (req.getOperationType() != OperationType.Create) { - return client.getOrigGatewayStoreModel().processMessage(req); - } - - int currentAttempt = count.getAndIncrement(); - if (currentAttempt == 0) { - Map header = ImmutableMap.of( - HttpConstants.HttpHeaders.SUB_STATUS, - Integer.toString(HttpConstants.SubStatusCodes.PARTITION_KEY_MISMATCH)); - - return Observable.error(new DocumentClientException(HttpConstants.StatusCodes.BADREQUEST, new Error() , header)); - } else { - return client.getOrigGatewayStoreModel().processMessage(req); - } - } - }).when(client.getSpyGatewayStoreModel()).processMessage(anyObject()); - - // validate - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()).build(); - validateSuccess(createObservable, validator); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createDocument_noRetryOnNonRetriableFailure() throws Exception { - - AtomicInteger count = new AtomicInteger(); - doAnswer(new Answer< Observable>() { - @Override - public Observable answer(InvocationOnMock invocation) throws Throwable { - RxDocumentServiceRequest req = (RxDocumentServiceRequest) invocation.getArguments()[0]; - - if (req.getResourceType() != ResourceType.Document) { - return client.getOrigGatewayStoreModel().processMessage(req); - } - - int currentAttempt = count.getAndIncrement(); - if (currentAttempt == 0) { - return client.getOrigGatewayStoreModel().processMessage(req); - } else { - Map header = ImmutableMap.of( - HttpConstants.HttpHeaders.SUB_STATUS, - Integer.toString(2)); - - return Observable.error(new DocumentClientException(1, new Error() , header)); - } - } - }).when(client.getSpyGatewayStoreModel()).processMessage(anyObject()); - - // create a document to ensure collection is cached - client.createDocument(collection.getSelfLink(), getDocumentDefinition(), null, false) - .toBlocking() - .single(); - - Document docDefinition = getDocumentDefinition(); - - Observable> createObservable = client - .createDocument(collection.getSelfLink(), docDefinition, null, false); - - // validate - FailureValidator validator = new FailureValidator.Builder().statusCode(1).subStatusCode(2).build(); - validateFailure(createObservable, validator, TIMEOUT); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void createDocument_failImmediatelyOnNonRetriable() throws Exception { - // create a document to ensure collection is cached - client.createDocument(collection.getSelfLink(), getDocumentDefinition(), null, false).toBlocking().single(); - AtomicInteger count = new AtomicInteger(); - - doAnswer(new Answer< Observable>() { - @Override - public Observable answer(InvocationOnMock invocation) throws Throwable { - RxDocumentServiceRequest req = (RxDocumentServiceRequest) invocation.getArguments()[0]; - if (req.getOperationType() != OperationType.Create) { - return client.getOrigGatewayStoreModel().processMessage(req); - } - int currentAttempt = count.getAndIncrement(); - if (currentAttempt == 0) { - Map header = ImmutableMap.of( - HttpConstants.HttpHeaders.SUB_STATUS, - Integer.toString(2)); - - return Observable.error(new DocumentClientException(1, new Error() , header)); - } else { - return client.getOrigGatewayStoreModel().processMessage(req); - } - } - }).when(client.getSpyGatewayStoreModel()).processMessage(anyObject()); - - Document docDefinition = getDocumentDefinition(); - - Observable> createObservable = client - .createDocument(collection.getSelfLink(), docDefinition, null, false); - // validate - - FailureValidator validator = new FailureValidator.Builder().statusCode(1).subStatusCode(2).build(); - validateFailure(createObservable.timeout(100, TimeUnit.MILLISECONDS), validator); - } - - @BeforeMethod(groups = { "simple" }) - public void beforeMethod(Method method) { - super.beforeMethod(method); - Mockito.reset(client.getSpyGatewayStoreModel()); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - // set up the client - client = SpyClientUnderTestFactory.createClientWithGatewaySpy(clientBuilder); - - database = SHARED_DATABASE; - collection = SHARED_SINGLE_PARTITION_COLLECTION; - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RetryThrottleTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RetryThrottleTest.java deleted file mode 100644 index 2f438b764604..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RetryThrottleTest.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.doAnswer; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicInteger; - -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import org.testng.annotations.AfterClass; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.RetryOptions; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.ResourceResponseValidator; -import com.microsoft.azure.cosmosdb.rx.TestConfigurations; -import com.microsoft.azure.cosmosdb.rx.TestSuiteBase; - -import rx.Observable; - -public class RetryThrottleTest extends TestSuiteBase { - private final static int TIMEOUT = 10000; - private final static int TOTAL_DOCS = 500; - private final static int LARGE_TIMEOUT = 30000; - - private SpyClientUnderTestFactory.ClientWithGatewaySpy client; - private Database database; - private DocumentCollection collection; - - @Test(groups = { "long" }, timeOut = LARGE_TIMEOUT ) - public void retryCreateDocumentsOnSpike() throws Exception { - ConnectionPolicy policy = new ConnectionPolicy(); - RetryOptions retryOptions = new RetryOptions(); - retryOptions.setMaxRetryAttemptsOnThrottledRequests(Integer.MAX_VALUE); - retryOptions.setMaxRetryWaitTimeInSeconds(LARGE_TIMEOUT); - policy.setRetryOptions(retryOptions); - - AsyncDocumentClient.Builder builder = new AsyncDocumentClient.Builder() - .withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(policy) - .withConsistencyLevel(ConsistencyLevel.Eventual); - - client = SpyClientUnderTestFactory.createClientWithGatewaySpy(builder); - - // create a document to ensure collection is cached - client.createDocument(getCollectionLink(collection), getDocumentDefinition(), null, false).toBlocking().single(); - - List>> list = new ArrayList<>(); - for(int i = 0; i < TOTAL_DOCS; i++) { - Observable> obs = client.createDocument(getCollectionLink(collection), getDocumentDefinition(), null, false); - list.add(obs); - } - - // registers a spy to count number of invocation - AtomicInteger totalCount = new AtomicInteger(); - AtomicInteger successCount = new AtomicInteger(); - - doAnswer(new Answer< Observable>() { - @Override - public Observable answer(InvocationOnMock invocation) throws Throwable { - RxDocumentServiceRequest req = (RxDocumentServiceRequest) invocation.getArguments()[0]; - if (req.getResourceType() == ResourceType.Document && req.getOperationType() == OperationType.Create) { - // increment the counter per Document Create operations - totalCount.incrementAndGet(); - } - return client.getOrigGatewayStoreModel().processMessage(req).doOnNext(rsp -> successCount.incrementAndGet()); - } - }).when(client.getSpyGatewayStoreModel()).processMessage(anyObject()); - - List> rsps = Observable.merge(list, 100).toList().toSingle().toBlocking().value(); - System.out.println("total: " + totalCount.get()); - assertThat(rsps).hasSize(TOTAL_DOCS); - assertThat(successCount.get()).isEqualTo(TOTAL_DOCS); - System.out.println("total count is " + totalCount.get()); - } - - @Test(groups = { "long" }, timeOut = TIMEOUT) - public void retryDocumentCreate() throws Exception { - client = SpyClientUnderTestFactory.createClientWithGatewaySpy(createGatewayRxDocumentClient()); - - // create a document to ensure collection is cached - client.createDocument(getCollectionLink(collection), getDocumentDefinition(), null, false).toBlocking().single(); - - Document docDefinition = getDocumentDefinition(); - - Observable> createObservable = client - .createDocument(collection.getSelfLink(), docDefinition, null, false); - AtomicInteger count = new AtomicInteger(); - - doAnswer(new Answer< Observable>() { - @Override - public Observable answer(InvocationOnMock invocation) throws Throwable { - RxDocumentServiceRequest req = (RxDocumentServiceRequest) invocation.getArguments()[0]; - if (req.getOperationType() != OperationType.Create) { - return client.getOrigGatewayStoreModel().processMessage(req); - } - int currentAttempt = count.getAndIncrement(); - if (currentAttempt == 0) { - return Observable.error(new DocumentClientException(HttpConstants.StatusCodes.TOO_MANY_REQUESTS)); - } else { - return client.getOrigGatewayStoreModel().processMessage(req); - } - } - }).when(client.getSpyGatewayStoreModel()).processMessage(anyObject()); - - // validate - ResourceResponseValidator validator = new ResourceResponseValidator.Builder() - .withId(docDefinition.getId()).build(); - validateSuccess(createObservable, validator, TIMEOUT); - } - - @AfterMethod(groups = { "long" }) - private void afterMethod() { - safeClose(client); - } - - @BeforeClass(groups = { "long" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - // set up the client - database = SHARED_DATABASE; - collection = SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } - - @AfterClass(groups = { "long" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentClientUnderTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentClientUnderTest.java deleted file mode 100644 index 3cf2844149a3..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/RxDocumentClientUnderTest.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.internal.QueryCompatibilityMode; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; - -import io.netty.buffer.ByteBuf; -import io.reactivex.netty.client.RxClient; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; -import io.reactivex.netty.protocol.http.client.HttpClientResponse; -import org.mockito.Mockito; -import org.mockito.stubbing.Answer; -import rx.Observable; - -import java.net.URI; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.doAnswer; - -/** - * This class in conjunction with {@link com.microsoft.azure.cosmosdb.rx.ClientUnderTestBuilder} - * provides the functionality for spying the client behavior and the http requests sent. - */ -public class RxDocumentClientUnderTest extends RxDocumentClientImpl { - - public CompositeHttpClient spyHttpClient; - public CompositeHttpClient origHttpClient; - - public List> httpRequests = Collections.synchronizedList( - new ArrayList>()); - - public RxDocumentClientUnderTest(URI serviceEndpoint, - String masterKey, - ConnectionPolicy connectionPolicy, - ConsistencyLevel consistencyLevel, - Configs configs) { - super(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, configs); - init(); - } - - RxGatewayStoreModel createRxGatewayProxy( - ISessionContainer sessionContainer, - ConsistencyLevel consistencyLevel, - QueryCompatibilityMode queryCompatibilityMode, - UserAgentContainer userAgentContainer, - GlobalEndpointManager globalEndpointManager, - CompositeHttpClient rxOrigClient) { - - origHttpClient = rxOrigClient; - spyHttpClient = Mockito.spy(rxOrigClient); - - doAnswer((Answer>>) invocationOnMock -> { - - RxClient.ServerInfo serverInfo = - invocationOnMock.getArgumentAt(0, RxClient.ServerInfo.class); - - HttpClientRequest request - = invocationOnMock.getArgumentAt(1, HttpClientRequest.class); - - httpRequests.add(request); - - Observable> httpRespObs = - origHttpClient.submit(serverInfo, request); - - return httpRespObs; - }).when(spyHttpClient).submit( anyObject(), - (HttpClientRequest) anyObject()); - - return super.createRxGatewayProxy(sessionContainer, - consistencyLevel, - queryCompatibilityMode, - userAgentContainer, - globalEndpointManager, - spyHttpClient); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/SessionTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/SessionTest.java deleted file mode 100644 index 209bc4e792df..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/SessionTest.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.TestSuiteBase; - -import io.netty.buffer.ByteBuf; -import io.netty.handler.codec.http.HttpMethod; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; - -import org.apache.commons.lang3.StringUtils; -import org.testng.SkipException; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import java.io.UnsupportedEncodingException; -import java.lang.reflect.Method; -import java.net.URLDecoder; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -import static org.assertj.core.api.Assertions.assertThat; - -public class SessionTest extends TestSuiteBase { - protected static final int TIMEOUT = 20000; - - private Database createdDatabase; - private DocumentCollection createdCollection; - private String collectionId = "+ -_,:.|~" + UUID.randomUUID().toString() + " +-_,:.|~"; - private SpyClientUnderTestFactory.SpyBaseClass> spyClient; - private AsyncDocumentClient houseKeepingClient; - private ConnectionMode connectionMode; - - @Factory(dataProvider = "clientBuildersWithDirectSession") - public SessionTest(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - this.subscriberValidationTimeout = TIMEOUT; - } - - @DataProvider(name = "sessionTestArgProvider") - public Object[] sessionTestArgProvider() { - return new Object[] { - // boolean indicating whether requests should be name based or not - true, - false - }; - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - createdDatabase = SHARED_DATABASE; - - DocumentCollection collection = new DocumentCollection(); - collection.setId(collectionId); - createdCollection = createCollection(createGatewayHouseKeepingDocumentClient().build(), createdDatabase.getId(), - collection, null); - houseKeepingClient = clientBuilder.build(); - connectionMode = houseKeepingClient.getConnectionPolicy().getConnectionMode(); - - if (connectionMode == ConnectionMode.Direct) { - spyClient = SpyClientUnderTestFactory.createDirectHttpsClientUnderTest(clientBuilder); - } else { - spyClient = SpyClientUnderTestFactory.createClientUnderTest(clientBuilder); - } - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeDeleteCollection(houseKeepingClient, createdCollection); - safeClose(houseKeepingClient); - safeClose(spyClient); - - } - - @BeforeMethod(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeTest(Method method) { - super.beforeMethod(method); - spyClient.clearCapturedRequests(); - } - - private List getSessionTokensInRequests() { - return spyClient.getCapturedRequests().stream() - .map(r -> r.getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN)).collect(Collectors.toList()); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "sessionTestArgProvider") - public void sessionConsistency_ReadYourWrites(boolean isNameBased) { - spyClient.readCollection(getCollectionLink(isNameBased), null).toBlocking().single(); - spyClient.createDocument(getCollectionLink(isNameBased), new Document(), null, false).toBlocking().single(); - - spyClient.clearCapturedRequests(); - - for (int i = 0; i < 10; i++) { - Document documentCreated = spyClient.createDocument(getCollectionLink(isNameBased), new Document(), null, false) - .toBlocking().single().getResource(); - - // We send session tokens on Writes in Gateway mode - if (connectionMode == ConnectionMode.Gateway) { - assertThat(getSessionTokensInRequests()).hasSize(3 * i + 1); - assertThat(getSessionTokensInRequests().get(3 * i + 0)).isNotEmpty(); - } - - spyClient.readDocument(getDocumentLink(documentCreated, isNameBased), null).toBlocking().single(); - - assertThat(getSessionTokensInRequests()).hasSize(3 * i + 2); - assertThat(getSessionTokensInRequests().get(3 * i + 1)).isNotEmpty(); - - spyClient.readDocument(getDocumentLink(documentCreated, isNameBased), null).toBlocking().single(); - - assertThat(getSessionTokensInRequests()).hasSize(3 * i + 3); - assertThat(getSessionTokensInRequests().get(3 * i + 2)).isNotEmpty(); - } - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "sessionTestArgProvider") - public void sessionTokenInDocumentRead(boolean isNameBased) throws UnsupportedEncodingException { - Document document = new Document(); - document.setId(UUID.randomUUID().toString()); - document.set("pk", "pk"); - document = spyClient.createDocument(getCollectionLink(isNameBased), document, null, false).toBlocking().single() - .getResource(); - - final String documentLink = getDocumentLink(document, isNameBased); - spyClient.readDocument(documentLink, null).toBlocking().single() - .getResource(); - - List> documentReadHttpRequests = spyClient.getCapturedRequests().stream() - .filter(r -> r.getMethod() == HttpMethod.GET) - .filter(r -> { - try { - return URLDecoder.decode(r.getUri().replaceAll("\\+", "%2b"), "UTF-8").contains( - StringUtils.removeEnd(documentLink, "/")); - } catch (UnsupportedEncodingException e) { - return false; - } - }).collect(Collectors.toList()); - - // Direct mode may make more than one call (multiple replicas) - assertThat(documentReadHttpRequests.size() >= 1).isTrue(); - assertThat(documentReadHttpRequests.get(0).getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN)).isNotEmpty(); - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "sessionTestArgProvider") - public void sessionTokenRemovedForMasterResource(boolean isNameBased) throws UnsupportedEncodingException { - if (connectionMode == ConnectionMode.Direct) { - throw new SkipException("Master resource access is only through gateway"); - } - String collectionLink = getCollectionLink(isNameBased); - spyClient.readCollection(collectionLink, null).toBlocking().single(); - - List> collectionReadHttpRequests = spyClient.getCapturedRequests().stream() - .filter(r -> r.getMethod() == HttpMethod.GET) - .filter(r -> { - try { - return URLDecoder.decode(r.getUri().replaceAll("\\+", "%2b"), "UTF-8").contains( - StringUtils.removeEnd(collectionLink, "/")); - } catch (UnsupportedEncodingException e) { - return false; - } - }) - .collect(Collectors.toList()); - - assertThat(collectionReadHttpRequests).hasSize(1); - assertThat(collectionReadHttpRequests.get(0).getHeaders().get(HttpConstants.HttpHeaders.SESSION_TOKEN)).isNull(); - } - - private String getCollectionLink(boolean isNameBased) { - return isNameBased ? "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId(): - createdCollection.getSelfLink(); - } - - private String getDocumentLink(Document doc, boolean isNameBased) { - return isNameBased ? "dbs/" + createdDatabase.getId() + "/colls/" + createdCollection.getId() + "/docs/" + doc.getId() : - "dbs/" + createdDatabase.getResourceId() + "/colls/" + createdCollection.getResourceId() + "/docs/" + doc.getResourceId() + "/"; - } -} \ No newline at end of file diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/SpyClientUnderTestFactory.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/SpyClientUnderTestFactory.java deleted file mode 100644 index b9082124c091..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/SpyClientUnderTestFactory.java +++ /dev/null @@ -1,317 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.ISessionContainer; -import com.microsoft.azure.cosmosdb.internal.QueryCompatibilityMode; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.SpyClientBuilder; -import com.microsoft.azure.cosmosdb.rx.internal.directconnectivity.ReflectionUtils; - -import io.netty.buffer.ByteBuf; -import io.reactivex.netty.client.RxClient; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import io.reactivex.netty.protocol.http.client.HttpClientRequest; -import io.reactivex.netty.protocol.http.client.HttpResponseHeaders; -import org.apache.commons.lang3.reflect.FieldUtils; -import org.apache.commons.lang3.tuple.Pair; -import org.mockito.Mockito; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; - -import java.net.URI; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Future; -import java.util.stream.Collectors; - -import static org.mockito.Mockito.doAnswer; - -public class SpyClientUnderTestFactory { - - public static abstract class SpyBaseClass extends RxDocumentClientImpl { - - public SpyBaseClass(URI serviceEndpoint, String masterKeyOrResourceToken, ConnectionPolicy connectionPolicy, ConsistencyLevel consistencyLevel, Configs configs) { - super(serviceEndpoint, masterKeyOrResourceToken, connectionPolicy, consistencyLevel, configs); - } - - public abstract List getCapturedRequests(); - - public abstract void clearCapturedRequests(); - } - - public static class ClientWithGatewaySpy extends SpyBaseClass { - - private RxGatewayStoreModel origRxGatewayStoreModel; - private RxGatewayStoreModel spyRxGatewayStoreModel; - - private List requests; - - - ClientWithGatewaySpy(URI serviceEndpoint, String masterKey, ConnectionPolicy connectionPolicy, ConsistencyLevel consistencyLevel, Configs configs) { - super(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, configs); - init(); - } - - @Override - public List getCapturedRequests() { - return requests; - } - - @Override - RxGatewayStoreModel createRxGatewayProxy(ISessionContainer sessionContainer, - ConsistencyLevel consistencyLevel, - QueryCompatibilityMode queryCompatibilityMode, - UserAgentContainer userAgentContainer, - GlobalEndpointManager globalEndpointManager, - CompositeHttpClient rxClient) { - this.origRxGatewayStoreModel = super.createRxGatewayProxy( - sessionContainer, - consistencyLevel, - queryCompatibilityMode, - userAgentContainer, - globalEndpointManager, - rxClient); - this.requests = Collections.synchronizedList(new ArrayList<>()); - this.spyRxGatewayStoreModel = Mockito.spy(this.origRxGatewayStoreModel); - this.initRequestCapture(); - return this.spyRxGatewayStoreModel; - } - - protected void initRequestCapture() { - doAnswer(new Answer() { - @Override - public Object answer(InvocationOnMock invocationOnMock) { - RxDocumentServiceRequest req = invocationOnMock.getArgumentAt(0, RxDocumentServiceRequest.class); - requests.add(req); - return ClientWithGatewaySpy.this.origRxGatewayStoreModel.processMessage(req); - } - }).when(ClientWithGatewaySpy.this.spyRxGatewayStoreModel).processMessage(Mockito.any(RxDocumentServiceRequest.class)); - } - - @Override - public void clearCapturedRequests() { - requests.clear(); - } - - public RxGatewayStoreModel getSpyGatewayStoreModel() { - return spyRxGatewayStoreModel; - } - - public RxGatewayStoreModel getOrigGatewayStoreModel() { - return origRxGatewayStoreModel; - } - } - - public static class ClientUnderTest extends SpyBaseClass> { - - CompositeHttpClient origHttpClient; - CompositeHttpClient spyHttpClient; - List, Future>> requestsResponsePairs = - Collections.synchronizedList(new ArrayList, Future>>()); - - ClientUnderTest(URI serviceEndpoint, String masterKey, ConnectionPolicy connectionPolicy, ConsistencyLevel consistencyLevel, Configs configs) { - super(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, configs); - init(); - } - - public List, Future>> capturedRequestResponseHeaderPairs() { - return requestsResponsePairs; - } - - @Override - public List> getCapturedRequests() { - return requestsResponsePairs.stream().map(pair -> pair.getLeft()).collect(Collectors.toList()); - } - - void initRequestCapture(CompositeHttpClient spyClient) { - - doAnswer(new Answer() { - @Override - public Object answer(InvocationOnMock invocationOnMock) throws Throwable { - RxClient.ServerInfo serverInfo = invocationOnMock.getArgumentAt(0, RxClient.ServerInfo.class); - HttpClientRequest httpReq = invocationOnMock.getArgumentAt(1, HttpClientRequest.class); - - CompletableFuture f = new CompletableFuture<>(); - requestsResponsePairs.add(Pair.of(httpReq, f)); - - return origHttpClient.submit(serverInfo, httpReq) - .doOnNext( - res -> f.complete(res.getHeaders()) - ).doOnError( - e -> f.completeExceptionally(e) - ); - - } - }).when(spyClient).submit(Mockito.any(RxClient.ServerInfo.class), Mockito.any(HttpClientRequest.class)); - } - - @Override - public void clearCapturedRequests() { - requestsResponsePairs.clear(); - } - - public ISessionContainer getSessionContainer() { - try { - return (ISessionContainer) FieldUtils.readField(this, "sessionContainer", true); - } catch (Exception e){ - throw new RuntimeException(e); - } - } - - public CompositeHttpClient getSpyHttpClient() { - return spyHttpClient; - } - } - - public static class DirectHttpsClientUnderTest extends SpyBaseClass> { - - CompositeHttpClient origHttpClient; - CompositeHttpClient spyHttpClient; - List, Future>> requestsResponsePairs = - Collections.synchronizedList(new ArrayList, Future>>()); - - DirectHttpsClientUnderTest(URI serviceEndpoint, String masterKey, ConnectionPolicy connectionPolicy, ConsistencyLevel consistencyLevel) { - // TODO: DANOBLE: ensure the configs instance instantiated here specifies Protocol.Https - super(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, new Configs()); - assert connectionPolicy.getConnectionMode() == ConnectionMode.Direct; - init(); - this.origHttpClient = ReflectionUtils.getDirectHttpsHttpClient(this); - this.spyHttpClient = Mockito.spy(this.origHttpClient); - ReflectionUtils.setDirectHttpsHttpClient(this, this.spyHttpClient); - this.initRequestCapture(this.spyHttpClient); - } - - public List, Future>> capturedRequestResponseHeaderPairs() { - return requestsResponsePairs; - } - - @Override - public List> getCapturedRequests() { - return requestsResponsePairs.stream().map(pair -> pair.getLeft()).collect(Collectors.toList()); - } - - void initRequestCapture(CompositeHttpClient spyClient) { - - doAnswer(new Answer() { - @Override - public Object answer(InvocationOnMock invocationOnMock) throws Throwable { - RxClient.ServerInfo serverInfo = invocationOnMock.getArgumentAt(0, RxClient.ServerInfo.class); - HttpClientRequest httpReq = invocationOnMock.getArgumentAt(1, HttpClientRequest.class); - - CompletableFuture f = new CompletableFuture<>(); - requestsResponsePairs.add(Pair.of(httpReq, f)); - - return origHttpClient.submit(serverInfo, httpReq) - .doOnNext( - res -> f.complete(res.getHeaders()) - ).doOnError( - e -> f.completeExceptionally(e) - ); - - } - }).when(spyClient).submit(Mockito.any(RxClient.ServerInfo.class), Mockito.any(HttpClientRequest.class)); - } - - @Override - public void clearCapturedRequests() { - requestsResponsePairs.clear(); - } - - public ISessionContainer getSessionContainer() { - try { - return (ISessionContainer) FieldUtils.readField(this, "sessionContainer", true); - } catch (Exception e){ - throw new RuntimeException(e); - } - } - - public CompositeHttpClient getSpyHttpClient() { - return spyHttpClient; - } - } - - public static ClientWithGatewaySpy createClientWithGatewaySpy(AsyncDocumentClient.Builder builder) { - return new SpyClientBuilder(builder).buildWithGatewaySpy(); - } - - public static ClientWithGatewaySpy createClientWithGatewaySpy(URI serviceEndpoint, - String masterKey, - ConnectionPolicy connectionPolicy, - ConsistencyLevel consistencyLevel, - Configs configs) { - return new ClientWithGatewaySpy(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, configs); - } - - public static ClientUnderTest createClientUnderTest(AsyncDocumentClient.Builder builder) { - return new SpyClientBuilder(builder).build(); - } - - public static DirectHttpsClientUnderTest createDirectHttpsClientUnderTest(AsyncDocumentClient.Builder builder) { - return new SpyClientBuilder(builder).buildWithDirectHttps(); - } - - public static ClientUnderTest createClientUnderTest(URI serviceEndpoint, - String masterKey, - ConnectionPolicy connectionPolicy, - ConsistencyLevel consistencyLevel, - Configs configs) { - return new ClientUnderTest(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, configs) { - - @Override - RxGatewayStoreModel createRxGatewayProxy(ISessionContainer sessionContainer, - ConsistencyLevel consistencyLevel, - QueryCompatibilityMode queryCompatibilityMode, - UserAgentContainer userAgentContainer, - GlobalEndpointManager globalEndpointManager, - CompositeHttpClient rxClient) { - - CompositeHttpClient spyClient = Mockito.spy(rxClient); - - this.origHttpClient = rxClient; - this.spyHttpClient = spyClient; - - this.initRequestCapture(spyHttpClient); - - return super.createRxGatewayProxy( - sessionContainer, - consistencyLevel, - queryCompatibilityMode, - userAgentContainer, - globalEndpointManager, - spyClient); - } - }; - } - - public static DirectHttpsClientUnderTest createDirectHttpsClientUnderTest(URI serviceEndpoint, String masterKey, - ConnectionPolicy connectionPolicy, ConsistencyLevel consistencyLevel) { - return new DirectHttpsClientUnderTest(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/StoreHeaderTests.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/StoreHeaderTests.java deleted file mode 100644 index ecdb689b542b..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/StoreHeaderTests.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.TestSuiteBase; -import org.testng.Assert; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Factory; -import org.testng.annotations.Test; - -import java.util.UUID; - -public class StoreHeaderTests extends TestSuiteBase { - - private static Database createdDatabase; - private static DocumentCollection createdCollection; - - private AsyncDocumentClient client; - - @Factory(dataProvider = "clientBuildersWithDirect") - public StoreHeaderTests(AsyncDocumentClient.Builder clientBuilder) { - this.clientBuilder = clientBuilder; - } - - @Test(groups = { "simple" }, timeOut = TIMEOUT) - public void validateStoreHeader() { - Document docDefinition1 = getDocumentDefinition(); - Document responseDoc1 = createDocument(client, createdDatabase.getId(), createdCollection.getId(), docDefinition1); - Assert.assertNotNull(responseDoc1.getSelfLink()); - Assert.assertNotNull(responseDoc1.get("_attachments")); - - Document docDefinition2 = getDocumentDefinition(); - RequestOptions requestOptions = new RequestOptions(); - requestOptions.setHeader("x-ms-exclude-system-properties", "true"); - Document responseDoc2 = createDocument(client, createdDatabase.getId(), createdCollection.getId(), docDefinition2, requestOptions); - Assert.assertNull(responseDoc2.getSelfLink()); - Assert.assertNull(responseDoc2.get("_attachments")); - } - - @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) - public void beforeClass() { - client = clientBuilder.build(); - - createdDatabase = SHARED_DATABASE; - createdCollection = SHARED_MULTI_PARTITION_COLLECTION; - } - - @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) - public void afterClass() { - safeClose(client); - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" - + "}" - , uuid, uuid)); - return doc; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/TestSuiteBase.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/TestSuiteBase.java deleted file mode 100644 index fa92ee2af634..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/TestSuiteBase.java +++ /dev/null @@ -1,1012 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.microsoft.azure.cosmosdb.CompositePath; -import com.microsoft.azure.cosmosdb.CompositePathSortOrder; -import com.microsoft.azure.cosmosdb.ConnectionMode; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.ConsistencyLevel; -import com.microsoft.azure.cosmosdb.DataType; -import com.microsoft.azure.cosmosdb.Database; -import com.microsoft.azure.cosmosdb.DatabaseForTest; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.IncludedPath; -import com.microsoft.azure.cosmosdb.Index; -import com.microsoft.azure.cosmosdb.IndexingPolicy; -import com.microsoft.azure.cosmosdb.PartitionKey; -import com.microsoft.azure.cosmosdb.PartitionKeyDefinition; -import com.microsoft.azure.cosmosdb.RequestOptions; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.ResourceResponse; -import com.microsoft.azure.cosmosdb.RetryOptions; -import com.microsoft.azure.cosmosdb.SqlQuerySpec; -import com.microsoft.azure.cosmosdb.Undefined; -import com.microsoft.azure.cosmosdb.User; -import com.microsoft.azure.cosmosdb.internal.PathParser; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient; -import com.microsoft.azure.cosmosdb.rx.AsyncDocumentClient.Builder; -import com.microsoft.azure.cosmosdb.rx.FailureValidator; -import com.microsoft.azure.cosmosdb.rx.FeedResponseListValidator; -import com.microsoft.azure.cosmosdb.rx.ResourceResponseValidator; -import com.microsoft.azure.cosmosdb.rx.TestConfigurations; -import org.apache.commons.lang3.StringUtils; -import org.mockito.stubbing.Answer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.AfterSuite; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.BeforeSuite; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import rx.Observable; -import rx.observers.TestSubscriber; - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.spy; - -public class TestSuiteBase { - private static final int DEFAULT_BULK_INSERT_CONCURRENCY_LEVEL = 500; - private static final ObjectMapper objectMapper = new ObjectMapper(); - protected static Logger logger = LoggerFactory.getLogger(TestSuiteBase.class.getSimpleName()); - protected static final int TIMEOUT = 8000; - protected static final int FEED_TIMEOUT = 12000; - protected static final int SETUP_TIMEOUT = 30000; - protected static final int SHUTDOWN_TIMEOUT = 12000; - - protected static final int SUITE_SETUP_TIMEOUT = 120000; - protected static final int SUITE_SHUTDOWN_TIMEOUT = 60000; - - protected static final int WAIT_REPLICA_CATCH_UP_IN_MILLIS = 4000; - - protected int subscriberValidationTimeout = TIMEOUT; - - protected static ConsistencyLevel accountConsistency; - - protected Builder clientBuilder; - - protected static Database SHARED_DATABASE; - protected static DocumentCollection SHARED_MULTI_PARTITION_COLLECTION; - protected static DocumentCollection SHARED_SINGLE_PARTITION_COLLECTION; - protected static DocumentCollection SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY; - protected static DocumentCollection SHARED_MULTI_PARTITION_COLLECTION_WITH_COMPOSITE_AND_SPATIAL_INDEXES; - - - protected TestSuiteBase() { - objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - objectMapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); - objectMapper.configure(JsonParser.Feature.ALLOW_TRAILING_COMMA, true); - objectMapper.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true); - logger.debug("Initializing {} ...", this.getClass().getSimpleName()); - } - - @BeforeMethod(groups = { "simple", "long", "direct", "multi-master", "emulator" }) - public void beforeMethod(Method method) { - if (this.clientBuilder != null) { - logger.info("Starting {}::{} using {} {} mode with {} consistency", - method.getDeclaringClass().getSimpleName(), method.getName(), - this.clientBuilder.getConnectionPolicy().getConnectionMode(), - this.clientBuilder.getConfigs().getProtocol(), - this.clientBuilder.getDesiredConsistencyLevel()); - return; - } - logger.info("Starting {}::{}", method.getDeclaringClass().getSimpleName(), method.getName()); - } - - @AfterMethod(groups = { "simple", "long", "direct", "multi-master", "emulator" }) - public void afterMethod(Method m) { - Test t = m.getAnnotation(Test.class); - logger.info("Finished {}:{}.", m.getDeclaringClass().getSimpleName(), m.getName()); - } - - private static class DatabaseManagerImpl implements DatabaseForTest.DatabaseManager { - public static DatabaseManagerImpl getInstance(AsyncDocumentClient client) { - return new DatabaseManagerImpl(client); - } - - private final AsyncDocumentClient client; - - private DatabaseManagerImpl(AsyncDocumentClient client) { - this.client = client; - } - - @Override - public Observable> queryDatabases(SqlQuerySpec query) { - return client.queryDatabases(query, null); - } - - @Override - public Observable> createDatabase(Database databaseDefinition) { - return client.createDatabase(databaseDefinition, null); - } - - @Override - public Observable> deleteDatabase(String id) { - - return client.deleteDatabase("dbs/" + id, null); - } - } - - @BeforeSuite(groups = { "simple", "long", "direct", "multi-master", "emulator" }, timeOut = SUITE_SETUP_TIMEOUT) - public static void beforeSuite() { - logger.info("beforeSuite Started"); - AsyncDocumentClient houseKeepingClient = createGatewayHouseKeepingDocumentClient().build(); - try { - DatabaseForTest dbForTest = DatabaseForTest.create(DatabaseManagerImpl.getInstance(houseKeepingClient)); - SHARED_DATABASE = dbForTest.createdDatabase; - RequestOptions options = new RequestOptions(); - options.setOfferThroughput(10100); - SHARED_MULTI_PARTITION_COLLECTION = createCollection(houseKeepingClient, SHARED_DATABASE.getId(), getCollectionDefinitionWithRangeRangeIndex(), options); - SHARED_SINGLE_PARTITION_COLLECTION = createCollection(houseKeepingClient, SHARED_DATABASE.getId(), getCollectionDefinition(), null); - SHARED_SINGLE_PARTITION_COLLECTION_WITHOUT_PARTITION_KEY = createCollection(houseKeepingClient, SHARED_DATABASE.getId(), getCollectionDefinitionSinglePartitionWithoutPartitionKey()); - SHARED_MULTI_PARTITION_COLLECTION_WITH_COMPOSITE_AND_SPATIAL_INDEXES = createCollection(houseKeepingClient, SHARED_DATABASE.getId(), getCollectionDefinitionMultiPartitionWithCompositeAndSpatialIndexes(), options); - } finally { - houseKeepingClient.close(); - } - } - - @AfterSuite(groups = { "simple", "long", "direct", "multi-master", "emulator" }, timeOut = SUITE_SHUTDOWN_TIMEOUT) - public static void afterSuite() { - logger.info("afterSuite Started"); - AsyncDocumentClient houseKeepingClient = createGatewayHouseKeepingDocumentClient().build(); - try { - safeDeleteDatabase(houseKeepingClient, SHARED_DATABASE); - DatabaseForTest.cleanupStaleTestDatabases(DatabaseManagerImpl.getInstance(houseKeepingClient)); - } finally { - safeClose(houseKeepingClient); - } - } - - protected static void truncateCollection(DocumentCollection collection) { - logger.info("Truncating collection {} ...", collection.getId()); - AsyncDocumentClient houseKeepingClient = createGatewayHouseKeepingDocumentClient().build(); - try { - List paths = collection.getPartitionKey().getPaths(); - - FeedOptions options = new FeedOptions(); - options.setMaxDegreeOfParallelism(-1); - options.setEnableCrossPartitionQuery(true); - options.setMaxItemCount(100); - - logger.info("Truncating collection {} documents ...", collection.getId()); - - houseKeepingClient.queryDocuments(collection.getSelfLink(), "SELECT * FROM root", options) - .flatMap(page -> Observable.from(page.getResults())) - .flatMap(doc -> { - RequestOptions requestOptions = new RequestOptions(); - - if (paths != null && !paths.isEmpty()) { - List pkPath = PathParser.getPathParts(paths.get(0)); - Object propertyValue = doc.getObjectByPath(pkPath); - if (propertyValue == null) { - propertyValue = Undefined.Value(); - } - - requestOptions.setPartitionKey(new PartitionKey(propertyValue)); - } - - return houseKeepingClient.deleteDocument(doc.getSelfLink(), requestOptions); - }).toCompletable().await(); - - logger.info("Truncating collection {} triggers ...", collection.getId()); - - houseKeepingClient.queryTriggers(collection.getSelfLink(), "SELECT * FROM root", options) - .flatMap(page -> Observable.from(page.getResults())) - .flatMap(trigger -> { - RequestOptions requestOptions = new RequestOptions(); - -// if (paths != null && !paths.isEmpty()) { -// Object propertyValue = trigger.getObjectByPath(PathParser.getPathParts(paths.get(0))); -// requestOptions.setPartitionKey(new PartitionKey(propertyValue)); -// } - - return houseKeepingClient.deleteTrigger(trigger.getSelfLink(), requestOptions); - }).toCompletable().await(); - - logger.info("Truncating collection {} storedProcedures ...", collection.getId()); - - houseKeepingClient.queryStoredProcedures(collection.getSelfLink(), "SELECT * FROM root", options) - .flatMap(page -> Observable.from(page.getResults())) - .flatMap(storedProcedure -> { - RequestOptions requestOptions = new RequestOptions(); - -// if (paths != null && !paths.isEmpty()) { -// Object propertyValue = storedProcedure.getObjectByPath(PathParser.getPathParts(paths.get(0))); -// requestOptions.setPartitionKey(new PartitionKey(propertyValue)); -// } - - return houseKeepingClient.deleteStoredProcedure(storedProcedure.getSelfLink(), requestOptions); - }).toCompletable().await(); - - logger.info("Truncating collection {} udfs ...", collection.getId()); - - houseKeepingClient.queryUserDefinedFunctions(collection.getSelfLink(), "SELECT * FROM root", options) - .flatMap(page -> Observable.from(page.getResults())) - .flatMap(udf -> { - RequestOptions requestOptions = new RequestOptions(); - -// if (paths != null && !paths.isEmpty()) { -// Object propertyValue = udf.getObjectByPath(PathParser.getPathParts(paths.get(0))); -// requestOptions.setPartitionKey(new PartitionKey(propertyValue)); -// } - - return houseKeepingClient.deleteUserDefinedFunction(udf.getSelfLink(), requestOptions); - }).toCompletable().await(); - - } finally { - houseKeepingClient.close(); - } - - logger.info("Finished truncating collection {}.", collection.getId()); - } - - protected static void waitIfNeededForReplicasToCatchUp(AsyncDocumentClient.Builder clientBuilder) { - switch (clientBuilder.getDesiredConsistencyLevel()) { - case Eventual: - case ConsistentPrefix: - logger.info(" additional wait in Eventual mode so the replica catch up"); - // give times to replicas to catch up after a write - try { - TimeUnit.MILLISECONDS.sleep(WAIT_REPLICA_CATCH_UP_IN_MILLIS); - } catch (Exception e) { - logger.error("unexpected failure", e); - } - - case Session: - case BoundedStaleness: - case Strong: - default: - break; - } - } - - private static DocumentCollection getCollectionDefinitionSinglePartitionWithoutPartitionKey() { - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - - return collectionDefinition; - } - - - public static DocumentCollection createCollection(String databaseId, - DocumentCollection collection, - RequestOptions options) { - AsyncDocumentClient client = createGatewayHouseKeepingDocumentClient().build(); - try { - return client.createCollection("dbs/" + databaseId, collection, options).toBlocking().single().getResource(); - } finally { - client.close(); - } - } - - public static DocumentCollection createCollection(AsyncDocumentClient client, String databaseId, - DocumentCollection collection, RequestOptions options) { - return client.createCollection("dbs/" + databaseId, collection, options).toBlocking().single().getResource(); - } - - public static DocumentCollection createCollection(AsyncDocumentClient client, String databaseId, - DocumentCollection collection) { - return client.createCollection("dbs/" + databaseId, collection, null).toBlocking().single().getResource(); - } - - private static DocumentCollection getCollectionDefinitionMultiPartitionWithCompositeAndSpatialIndexes() { - final String NUMBER_FIELD = "numberField"; - final String STRING_FIELD = "stringField"; - final String NUMBER_FIELD_2 = "numberField2"; - final String STRING_FIELD_2 = "stringField2"; - final String BOOL_FIELD = "boolField"; - final String NULL_FIELD = "nullField"; - final String OBJECT_FIELD = "objectField"; - final String ARRAY_FIELD = "arrayField"; - final String SHORT_STRING_FIELD = "shortStringField"; - final String MEDIUM_STRING_FIELD = "mediumStringField"; - final String LONG_STRING_FIELD = "longStringField"; - final String PARTITION_KEY = "pk"; - - DocumentCollection documentCollection = new DocumentCollection(); - - IndexingPolicy indexingPolicy = new IndexingPolicy(); - Collection> compositeIndexes = new ArrayList>(); - - //Simple - ArrayList compositeIndexSimple = new ArrayList(); - CompositePath compositePath1 = new CompositePath(); - compositePath1.setPath("/" + NUMBER_FIELD); - compositePath1.setOrder(CompositePathSortOrder.Ascending); - - CompositePath compositePath2 = new CompositePath(); - compositePath2.setPath("/" + STRING_FIELD); - compositePath2.setOrder(CompositePathSortOrder.Descending); - - compositeIndexSimple.add(compositePath1); - compositeIndexSimple.add(compositePath2); - - //Max Columns - ArrayList compositeIndexMaxColumns = new ArrayList(); - CompositePath compositePath3 = new CompositePath(); - compositePath3.setPath("/" + NUMBER_FIELD); - compositePath3.setOrder(CompositePathSortOrder.Descending); - - CompositePath compositePath4 = new CompositePath(); - compositePath4.setPath("/" + STRING_FIELD); - compositePath4.setOrder(CompositePathSortOrder.Ascending); - - CompositePath compositePath5 = new CompositePath(); - compositePath5.setPath("/" + NUMBER_FIELD_2); - compositePath5.setOrder(CompositePathSortOrder.Descending); - - CompositePath compositePath6 = new CompositePath(); - compositePath6.setPath("/" + STRING_FIELD_2); - compositePath6.setOrder(CompositePathSortOrder.Ascending); - - compositeIndexMaxColumns.add(compositePath3); - compositeIndexMaxColumns.add(compositePath4); - compositeIndexMaxColumns.add(compositePath5); - compositeIndexMaxColumns.add(compositePath6); - - //Primitive Values - ArrayList compositeIndexPrimitiveValues = new ArrayList(); - CompositePath compositePath7 = new CompositePath(); - compositePath7.setPath("/" + NUMBER_FIELD); - compositePath7.setOrder(CompositePathSortOrder.Descending); - - CompositePath compositePath8 = new CompositePath(); - compositePath8.setPath("/" + STRING_FIELD); - compositePath8.setOrder(CompositePathSortOrder.Ascending); - - CompositePath compositePath9 = new CompositePath(); - compositePath9.setPath("/" + BOOL_FIELD); - compositePath9.setOrder(CompositePathSortOrder.Descending); - - CompositePath compositePath10 = new CompositePath(); - compositePath10.setPath("/" + NULL_FIELD); - compositePath10.setOrder(CompositePathSortOrder.Ascending); - - compositeIndexPrimitiveValues.add(compositePath7); - compositeIndexPrimitiveValues.add(compositePath8); - compositeIndexPrimitiveValues.add(compositePath9); - compositeIndexPrimitiveValues.add(compositePath10); - - //Long Strings - ArrayList compositeIndexLongStrings = new ArrayList(); - CompositePath compositePath11 = new CompositePath(); - compositePath11.setPath("/" + STRING_FIELD); - - CompositePath compositePath12 = new CompositePath(); - compositePath12.setPath("/" + SHORT_STRING_FIELD); - - CompositePath compositePath13 = new CompositePath(); - compositePath13.setPath("/" + MEDIUM_STRING_FIELD); - - CompositePath compositePath14 = new CompositePath(); - compositePath14.setPath("/" + LONG_STRING_FIELD); - - compositeIndexLongStrings.add(compositePath11); - compositeIndexLongStrings.add(compositePath12); - compositeIndexLongStrings.add(compositePath13); - compositeIndexLongStrings.add(compositePath14); - - compositeIndexes.add(compositeIndexSimple); - compositeIndexes.add(compositeIndexMaxColumns); - compositeIndexes.add(compositeIndexPrimitiveValues); - compositeIndexes.add(compositeIndexLongStrings); - - indexingPolicy.setCompositeIndexes(compositeIndexes); - documentCollection.setIndexingPolicy(indexingPolicy); - - PartitionKeyDefinition partitionKeyDefinition = new PartitionKeyDefinition(); - ArrayList partitionKeyPaths = new ArrayList(); - partitionKeyPaths.add("/" + PARTITION_KEY); - partitionKeyDefinition.setPaths(partitionKeyPaths); - documentCollection.setPartitionKey(partitionKeyDefinition); - - documentCollection.setId(UUID.randomUUID().toString()); - - return documentCollection; - } - - public static Document createDocument(AsyncDocumentClient client, String databaseId, String collectionId, Document document) { - return createDocument(client, databaseId, collectionId, document, null); - } - - public static Document createDocument(AsyncDocumentClient client, String databaseId, String collectionId, Document document, RequestOptions options) { - return client.createDocument(com.microsoft.azure.cosmosdb.rx.Utils.getCollectionNameLink(databaseId, collectionId), document, options, false).toBlocking().single().getResource(); - } - - public Observable> bulkInsert(AsyncDocumentClient client, - String collectionLink, - List documentDefinitionList, - int concurrencyLevel) { - ArrayList>> result = new ArrayList>>(documentDefinitionList.size()); - for (Document docDef : documentDefinitionList) { - result.add(client.createDocument(collectionLink, docDef, null, false)); - } - - return Observable.merge(result, concurrencyLevel); - } - - public Observable> bulkInsert(AsyncDocumentClient client, - String collectionLink, - List documentDefinitionList) { - return bulkInsert(client, collectionLink, documentDefinitionList, DEFAULT_BULK_INSERT_CONCURRENCY_LEVEL); - } - - public List bulkInsertBlocking(AsyncDocumentClient client, - String collectionLink, - List documentDefinitionList) { - return bulkInsert(client, collectionLink, documentDefinitionList, DEFAULT_BULK_INSERT_CONCURRENCY_LEVEL) - .map(ResourceResponse::getResource) - .toList() - .toBlocking() - .single(); - } - - public static ConsistencyLevel getAccountDefaultConsistencyLevel(AsyncDocumentClient client) { - return client.getDatabaseAccount().toBlocking().single().getConsistencyPolicy().getDefaultConsistencyLevel(); - } - - public static User createUser(AsyncDocumentClient client, String databaseId, User user) { - return client.createUser("dbs/" + databaseId, user, null).toBlocking().single().getResource(); - } - - public static User safeCreateUser(AsyncDocumentClient client, String databaseId, User user) { - deleteUserIfExists(client, databaseId, user.getId()); - return createUser(client, databaseId, user); - } - - private static DocumentCollection safeCreateCollection(AsyncDocumentClient client, String databaseId, DocumentCollection collection, RequestOptions options) { - deleteCollectionIfExists(client, databaseId, collection.getId()); - return createCollection(client, databaseId, collection, options); - } - - public static String getCollectionLink(DocumentCollection collection) { - return collection.getSelfLink(); - } - - static protected DocumentCollection getCollectionDefinition() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - collectionDefinition.setPartitionKey(partitionKeyDef); - - return collectionDefinition; - } - - static protected DocumentCollection getCollectionDefinitionWithRangeRangeIndex() { - PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); - ArrayList paths = new ArrayList<>(); - paths.add("/mypk"); - partitionKeyDef.setPaths(paths); - IndexingPolicy indexingPolicy = new IndexingPolicy(); - Collection includedPaths = new ArrayList<>(); - IncludedPath includedPath = new IncludedPath(); - includedPath.setPath("/*"); - Collection indexes = new ArrayList<>(); - Index stringIndex = Index.Range(DataType.String); - stringIndex.set("precision", -1); - indexes.add(stringIndex); - - Index numberIndex = Index.Range(DataType.Number); - numberIndex.set("precision", -1); - indexes.add(numberIndex); - includedPath.setIndexes(indexes); - includedPaths.add(includedPath); - indexingPolicy.setIncludedPaths(includedPaths); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setIndexingPolicy(indexingPolicy); - collectionDefinition.setId(UUID.randomUUID().toString()); - collectionDefinition.setPartitionKey(partitionKeyDef); - - return collectionDefinition; - } - - public static void deleteCollectionIfExists(AsyncDocumentClient client, String databaseId, String collectionId) { - List res = client.queryCollections("dbs/" + databaseId, - String.format("SELECT * FROM root r where r.id = '%s'", collectionId), null).toBlocking().single() - .getResults(); - if (!res.isEmpty()) { - deleteCollection(client, com.microsoft.azure.cosmosdb.rx.Utils.getCollectionNameLink(databaseId, collectionId)); - } - } - - public static void deleteCollection(AsyncDocumentClient client, String collectionLink) { - client.deleteCollection(collectionLink, null).toBlocking().single(); - } - - public static void deleteDocumentIfExists(AsyncDocumentClient client, String databaseId, String collectionId, String docId) { - FeedOptions options = new FeedOptions(); - options.setPartitionKey(new PartitionKey(docId)); - List res = client - .queryDocuments(com.microsoft.azure.cosmosdb.rx.Utils.getCollectionNameLink(databaseId, collectionId), String.format("SELECT * FROM root r where r.id = '%s'", docId), options) - .toBlocking().single().getResults(); - if (!res.isEmpty()) { - deleteDocument(client, com.microsoft.azure.cosmosdb.rx.Utils.getDocumentNameLink(databaseId, collectionId, docId)); - } - } - - public static void safeDeleteDocument(AsyncDocumentClient client, String documentLink, RequestOptions options) { - if (client != null && documentLink != null) { - try { - client.deleteDocument(documentLink, options).toBlocking().single(); - } catch (Exception e) { - DocumentClientException dce = com.microsoft.azure.cosmosdb.rx.internal.Utils.as(e, DocumentClientException.class); - if (dce == null || dce.getStatusCode() != 404) { - throw e; - } - } - } - } - - public static void deleteDocument(AsyncDocumentClient client, String documentLink) { - client.deleteDocument(documentLink, null).toBlocking().single(); - } - - public static void deleteUserIfExists(AsyncDocumentClient client, String databaseId, String userId) { - List res = client - .queryUsers("dbs/" + databaseId, String.format("SELECT * FROM root r where r.id = '%s'", userId), null) - .toBlocking().single().getResults(); - if (!res.isEmpty()) { - deleteUser(client, com.microsoft.azure.cosmosdb.rx.Utils.getUserNameLink(databaseId, userId)); - } - } - - public static void deleteUser(AsyncDocumentClient client, String userLink) { - client.deleteUser(userLink, null).toBlocking().single(); - } - - public static String getDatabaseLink(Database database) { - return database.getSelfLink(); - } - - static private Database safeCreateDatabase(AsyncDocumentClient client, Database database) { - safeDeleteDatabase(client, database.getId()); - return createDatabase(client, database); - } - - static protected Database createDatabase(AsyncDocumentClient client, Database database) { - Observable> databaseObservable = client.createDatabase(database, null); - return databaseObservable.toBlocking().single().getResource(); - } - - static protected Database createDatabase(AsyncDocumentClient client, String databaseId) { - Database databaseDefinition = new Database(); - databaseDefinition.setId(databaseId); - return createDatabase(client, databaseDefinition); - } - - static protected Database createDatabaseIfNotExists(AsyncDocumentClient client, String databaseId) { - return client.queryDatabases(String.format("SELECT * FROM r where r.id = '%s'", databaseId), null).flatMap(p -> Observable.from(p.getResults())).switchIfEmpty( - Observable.defer(() -> { - - Database databaseDefinition = new Database(); - databaseDefinition.setId(databaseId); - - return client.createDatabase(databaseDefinition, null).map(ResourceResponse::getResource); - }) - ).toBlocking().single(); - } - - static protected void safeDeleteDatabase(AsyncDocumentClient client, Database database) { - if (database != null) { - safeDeleteDatabase(client, database.getId()); - } - } - - static protected void safeDeleteDatabase(AsyncDocumentClient client, String databaseId) { - if (client != null) { - try { - client.deleteDatabase(com.microsoft.azure.cosmosdb.rx.Utils.getDatabaseNameLink(databaseId), null).toBlocking().single(); - } catch (Exception e) { - } - } - } - - static protected void safeDeleteAllCollections(AsyncDocumentClient client, Database database) { - if (database != null) { - List collections = client.readCollections(database.getSelfLink(), null) - .flatMap(p -> Observable.from(p.getResults())) - .toList() - .toBlocking() - .single(); - - for(DocumentCollection collection: collections) { - client.deleteCollection(collection.getSelfLink(), null).toBlocking().single().getResource(); - } - } - } - - static protected void safeDeleteCollection(AsyncDocumentClient client, DocumentCollection collection) { - if (client != null && collection != null) { - try { - client.deleteCollection(collection.getSelfLink(), null).toBlocking().single(); - } catch (Exception e) { - } - } - } - - static protected void safeDeleteCollection(AsyncDocumentClient client, String databaseId, String collectionId) { - if (client != null && databaseId != null && collectionId != null) { - try { - client.deleteCollection("/dbs/" + databaseId + "/colls/" + collectionId, null).toBlocking().single(); - } catch (Exception e) { - } - } - } - - static protected void safeClose(AsyncDocumentClient client) { - if (client != null) { - try { - client.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - public void validateSuccess(Observable> observable, - ResourceResponseValidator validator) { - validateSuccess(observable, validator, subscriberValidationTimeout); - } - - public static void validateSuccess(Observable> observable, - ResourceResponseValidator validator, long timeout) { - - VerboseTestSubscriber> testSubscriber = new VerboseTestSubscriber<>(); - - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - testSubscriber.assertValueCount(1); - validator.validate(testSubscriber.getOnNextEvents().get(0)); - } - - public void validateFailure(Observable> observable, - FailureValidator validator) { - validateFailure(observable, validator, subscriberValidationTimeout); - } - - public static void validateFailure(Observable> observable, - FailureValidator validator, long timeout) { - - VerboseTestSubscriber> testSubscriber = new VerboseTestSubscriber<>(); - - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - validator.validate(testSubscriber.getOnErrorEvents().get(0)); - } - - public void validateQuerySuccess(Observable> observable, - FeedResponseListValidator validator) { - validateQuerySuccess(observable, validator, subscriberValidationTimeout); - } - - public static void validateQuerySuccess(Observable> observable, - FeedResponseListValidator validator, long timeout) { - - VerboseTestSubscriber> testSubscriber = new VerboseTestSubscriber<>(); - - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNoErrors(); - testSubscriber.assertCompleted(); - validator.validate(testSubscriber.getOnNextEvents()); - } - - public void validateQueryFailure(Observable> observable, - FailureValidator validator) { - validateQueryFailure(observable, validator, subscriberValidationTimeout); - } - - public static void validateQueryFailure(Observable> observable, - FailureValidator validator, long timeout) { - - VerboseTestSubscriber> testSubscriber = new VerboseTestSubscriber<>(); - - observable.subscribe(testSubscriber); - testSubscriber.awaitTerminalEvent(timeout, TimeUnit.MILLISECONDS); - testSubscriber.assertNotCompleted(); - testSubscriber.assertTerminalEvent(); - assertThat(testSubscriber.getOnErrorEvents()).hasSize(1); - validator.validate(testSubscriber.getOnErrorEvents().get(0)); - } - - @DataProvider - public static Object[][] clientBuilders() { - return new Object[][] { { createGatewayRxDocumentClient(ConsistencyLevel.Session, false, null) } }; - } - - @DataProvider - public static Object[][] clientBuildersWithSessionConsistency() { - return new Object[][] { - { createGatewayRxDocumentClient(ConsistencyLevel.Session, false, null) }, - { createDirectRxDocumentClient(ConsistencyLevel.Session, Protocol.Https, false, null) }, - { createDirectRxDocumentClient(ConsistencyLevel.Session, Protocol.Tcp, false, null) } - }; - } - - private static ConsistencyLevel parseConsistency(String consistency) { - if (consistency != null) { - for (ConsistencyLevel consistencyLevel : ConsistencyLevel.values()) { - if (consistencyLevel.name().toLowerCase().equals(consistency.toLowerCase())) { - return consistencyLevel; - } - } - } - - logger.error("Invalid configured test consistency [{}].", consistency); - throw new IllegalStateException("Invalid configured test consistency " + consistency); - } - - private static List parsePreferredLocation(String preferredLocations) { - if (StringUtils.isEmpty(preferredLocations)) { - return null; - } - - try { - return objectMapper.readValue(preferredLocations, new TypeReference>(){}); - } catch (Exception e) { - logger.error("Invalid configured test preferredLocations [{}].", preferredLocations); - throw new IllegalStateException("Invalid configured test preferredLocations " + preferredLocations); - } - } - - @DataProvider - public static Object[][] simpleClientBuildersWithDirect() { - return simpleClientBuildersWithDirect(Protocol.Https, Protocol.Tcp); - } - - @DataProvider - public static Object[][] simpleClientBuildersWithDirectHttps() { - return simpleClientBuildersWithDirect(Protocol.Https); - } - - @DataProvider - public static Object[][] simpleClientBuildersWithDirectTcp() { - return simpleClientBuildersWithDirect(Protocol.Tcp); - } - - private static Object[][] simpleClientBuildersWithDirect(Protocol... protocols) { - - accountConsistency = parseConsistency(TestConfigurations.CONSISTENCY); - logger.info("Max test consistency to use is [{}]", accountConsistency); - List testConsistencies = new ArrayList<>(); - - switch (accountConsistency) { - case Strong: - case BoundedStaleness: - case Session: - case ConsistentPrefix: - case Eventual: - testConsistencies.add(ConsistencyLevel.Eventual); - break; - default: - throw new IllegalStateException("Invalid configured test consistency " + accountConsistency); - } - - List preferredLocation = parsePreferredLocation(TestConfigurations.PREFERRED_LOCATIONS); - boolean isMultiMasterEnabled = preferredLocation != null && accountConsistency == ConsistencyLevel.Session; - - List builders = new ArrayList<>(); - builders.add(createGatewayRxDocumentClient(ConsistencyLevel.Session, false, null)); - - for (Protocol protocol : protocols) { - testConsistencies.forEach(consistencyLevel -> builders.add(createDirectRxDocumentClient(consistencyLevel, - protocol, - isMultiMasterEnabled, - preferredLocation))); - } - - builders.forEach(b -> logger.info("Will Use ConnectionMode [{}], Consistency [{}], Protocol [{}]", - b.getConnectionPolicy().getConnectionMode(), - b.getDesiredConsistencyLevel(), - b.getConfigs().getProtocol() - )); - - return builders.stream().map(b -> new Object[]{b}).collect(Collectors.toList()).toArray(new Object[0][]); - } - - @DataProvider - public static Object[][] clientBuildersWithDirect() { - return clientBuildersWithDirectAllConsistencies(Protocol.Https, Protocol.Tcp); - } - - @DataProvider - public static Object[][] clientBuildersWithDirectHttps() { - return clientBuildersWithDirectAllConsistencies(Protocol.Https); - } - - @DataProvider - public static Object[][] clientBuildersWithDirectTcp() { - return clientBuildersWithDirectAllConsistencies(Protocol.Tcp); - } - - @DataProvider - public static Object[][] clientBuildersWithDirectSession() { - return clientBuildersWithDirectSession(Protocol.Https, Protocol.Tcp); - } - - private static Object[][] clientBuildersWithDirectSession(Protocol... protocols) { - return clientBuildersWithDirect(new ArrayList(){{add(ConsistencyLevel.Session);}} , protocols); - } - - private static Object[][] clientBuildersWithDirectAllConsistencies(Protocol... protocols) { - accountConsistency = parseConsistency(TestConfigurations.CONSISTENCY); - logger.info("Max test consistency to use is [{}]", accountConsistency); - List testConsistencies = new ArrayList<>(); - - switch (accountConsistency) { - case Strong: - testConsistencies.add(ConsistencyLevel.Strong); - case BoundedStaleness: - testConsistencies.add(ConsistencyLevel.BoundedStaleness); - case Session: - testConsistencies.add(ConsistencyLevel.Session); - case ConsistentPrefix: - testConsistencies.add(ConsistencyLevel.ConsistentPrefix); - case Eventual: - testConsistencies.add(ConsistencyLevel.Eventual); - break; - default: - throw new IllegalStateException("Invalid configured test consistency " + accountConsistency); - } - return clientBuildersWithDirect(testConsistencies, protocols); - } - - private static Object[][] clientBuildersWithDirect(List testConsistencies, Protocol... protocols) { - - List preferredLocation = parsePreferredLocation(TestConfigurations.PREFERRED_LOCATIONS); - boolean isMultiMasterEnabled = preferredLocation != null && accountConsistency == ConsistencyLevel.Session; - - List builders = new ArrayList<>(); - builders.add(createGatewayRxDocumentClient(ConsistencyLevel.Session, isMultiMasterEnabled, preferredLocation)); - - for (Protocol protocol : protocols) { - testConsistencies.forEach(consistencyLevel -> builders.add(createDirectRxDocumentClient(consistencyLevel, - protocol, - isMultiMasterEnabled, - preferredLocation))); - } - - builders.forEach(b -> logger.info("Will Use ConnectionMode [{}], Consistency [{}], Protocol [{}]", - b.getConnectionPolicy().getConnectionMode(), - b.getDesiredConsistencyLevel(), - b.getConfigs().getProtocol() - )); - - return builders.stream().map(b -> new Object[]{b}).collect(Collectors.toList()).toArray(new Object[0][]); - } - - static protected AsyncDocumentClient.Builder createGatewayHouseKeepingDocumentClient() { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - RetryOptions options = new RetryOptions(); - options.setMaxRetryWaitTimeInSeconds(SUITE_SETUP_TIMEOUT); - connectionPolicy.setRetryOptions(options); - return new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(ConsistencyLevel.Session); - } - - static protected AsyncDocumentClient.Builder createGatewayRxDocumentClient(ConsistencyLevel consistencyLevel, boolean multiMasterEnabled, List preferredLocations) { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Gateway); - connectionPolicy.setUsingMultipleWriteLocations(multiMasterEnabled); - connectionPolicy.setPreferredLocations(preferredLocations); - return new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(consistencyLevel); - } - - static protected AsyncDocumentClient.Builder createGatewayRxDocumentClient() { - return createGatewayRxDocumentClient(ConsistencyLevel.Session, false, null); - } - - static protected AsyncDocumentClient.Builder createDirectRxDocumentClient(ConsistencyLevel consistencyLevel, - Protocol protocol, - boolean multiMasterEnabled, - List preferredLocations) { - ConnectionPolicy connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setConnectionMode(ConnectionMode.Direct); - - if (preferredLocations != null) { - connectionPolicy.setPreferredLocations(preferredLocations); - } - - if (multiMasterEnabled && consistencyLevel == ConsistencyLevel.Session) { - connectionPolicy.setUsingMultipleWriteLocations(true); - } - - Configs configs = spy(new Configs()); - doAnswer((Answer) invocation -> protocol).when(configs).getProtocol(); - - return new AsyncDocumentClient.Builder().withServiceEndpoint(TestConfigurations.HOST) - .withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY) - .withConnectionPolicy(connectionPolicy) - .withConsistencyLevel(consistencyLevel) - .withConfigs(configs); - } - - protected int expectedNumberOfPages(int totalExpectedResult, int maxPageSize) { - return Math.max((totalExpectedResult + maxPageSize - 1 ) / maxPageSize, 1); - } - - @DataProvider(name = "queryMetricsArgProvider") - public Object[][] queryMetricsArgProvider() { - return new Object[][]{ - {true}, - {false}, - }; - } - - public static class VerboseTestSubscriber extends TestSubscriber { - @Override - public void assertNoErrors() { - List onErrorEvents = getOnErrorEvents(); - StringBuilder errorMessageBuilder = new StringBuilder(); - if (!onErrorEvents.isEmpty()) { - for(Throwable throwable : onErrorEvents) { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - throwable.printStackTrace(pw); - String sStackTrace = sw.toString(); // stack trace as a string - errorMessageBuilder.append(sStackTrace); - } - - AssertionError ae = new AssertionError(errorMessageBuilder.toString()); - throw ae; - } - } - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/directconnectivity/GlobalAddressResolverTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/directconnectivity/GlobalAddressResolverTest.java deleted file mode 100644 index badd57df6db5..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/directconnectivity/GlobalAddressResolverTest.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal.directconnectivity; - - -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.DocumentCollection; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.OperationType; -import com.microsoft.azure.cosmosdb.internal.ResourceType; -import com.microsoft.azure.cosmosdb.internal.UserAgentContainer; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.GatewayAddressCache; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.GatewayServiceConfigurationReader; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.Protocol; -import com.microsoft.azure.cosmosdb.internal.routing.CollectionRoutingMap; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyInternalHelper; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import com.microsoft.azure.cosmosdb.rx.internal.GlobalEndpointManager; -import com.microsoft.azure.cosmosdb.rx.internal.IAuthorizationTokenProvider; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxCollectionCache; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxPartitionKeyRangeCache; -import io.netty.buffer.ByteBuf; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import org.apache.commons.collections4.list.UnmodifiableList; -import org.mockito.Matchers; -import org.mockito.Mockito; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import rx.Completable; -import rx.Single; -import rx.functions.Action0; - -import java.net.URL; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicInteger; - -import static org.assertj.core.api.Assertions.assertThat; - -public class GlobalAddressResolverTest { - - private CompositeHttpClient httpClient; - private GlobalEndpointManager endpointManager; - private IAuthorizationTokenProvider authorizationTokenProvider; - private UserAgentContainer userAgentContainer; - private RxCollectionCache collectionCache; - private GatewayServiceConfigurationReader serviceConfigReader; - private RxPartitionKeyRangeCache routingMapProvider; - private ConnectionPolicy connectionPolicy; - private URL urlforRead1; - private URL urlforRead2; - private URL urlforRead3; - - private URL urlforWrite1; - private URL urlforWrite2; - private URL urlforWrite3; - - @BeforeClass(groups = "unit") - public void setup() throws Exception { - urlforRead1 = new URL("http://testRead1.com/"); - urlforRead2 = new URL("http://testRead2.com/"); - urlforRead3 = new URL("http://testRead3.com/"); - urlforWrite1 = new URL("http://testWrite1.com/"); - urlforWrite2 = new URL("http://testWrite2.com/"); - urlforWrite3 = new URL("http://testWrite3.com/"); - - connectionPolicy = new ConnectionPolicy(); - connectionPolicy.setEnableReadRequestsFallback(true); - httpClient = Mockito.mock(CompositeHttpClient.class); - endpointManager = Mockito.mock(GlobalEndpointManager.class); - - List readEndPointList = new ArrayList<>(); - readEndPointList.add(urlforRead1); - readEndPointList.add(urlforRead2); - readEndPointList.add(urlforRead3); - UnmodifiableList readList = new UnmodifiableList(readEndPointList); - - List writeEndPointList = new ArrayList<>(); - writeEndPointList.add(urlforWrite1); - writeEndPointList.add(urlforWrite2); - writeEndPointList.add(urlforWrite3); - UnmodifiableList writeList = new UnmodifiableList(writeEndPointList); - - Mockito.when(endpointManager.getReadEndpoints()).thenReturn(readList); - Mockito.when(endpointManager.getWriteEndpoints()).thenReturn(writeList); - - authorizationTokenProvider = Mockito.mock(IAuthorizationTokenProvider.class); - - DocumentCollection collectionDefinition = new DocumentCollection(); - collectionDefinition.setId(UUID.randomUUID().toString()); - collectionCache = Mockito.mock(RxCollectionCache.class); - Mockito.when(collectionCache.resolveCollectionAsync(Matchers.any(RxDocumentServiceRequest.class))).thenReturn(Single.just(collectionDefinition)); - routingMapProvider = Mockito.mock(RxPartitionKeyRangeCache.class); - userAgentContainer = Mockito.mock(UserAgentContainer.class); - serviceConfigReader = Mockito.mock(GatewayServiceConfigurationReader.class); - - } - - @Test(groups = "unit") - public void resolveAsync() throws Exception { - - GlobalAddressResolver globalAddressResolver = new GlobalAddressResolver(httpClient, endpointManager, Protocol.Https, authorizationTokenProvider, collectionCache, routingMapProvider, - userAgentContainer, - serviceConfigReader, connectionPolicy); - RxDocumentServiceRequest request; - request = RxDocumentServiceRequest.createFromName( - OperationType.Read, - "dbs/db/colls/coll/docs/doc1", - ResourceType.Document); - - Set urlsBeforeResolve = globalAddressResolver.addressCacheByEndpoint.keySet(); - assertThat(urlsBeforeResolve.size()).isEqualTo(5); - assertThat(urlsBeforeResolve.contains(urlforRead3)).isFalse();//Last read will be removed from addressCacheByEndpoint after 5 endpoints - assertThat(urlsBeforeResolve.contains(urlforRead2)).isTrue(); - - URL testUrl = new URL("http://Test.com/"); - Mockito.when(endpointManager.resolveServiceEndpoint(Matchers.any(RxDocumentServiceRequest.class))).thenReturn(testUrl); - globalAddressResolver.resolveAsync(request, true); - Set urlsAfterResolve = globalAddressResolver.addressCacheByEndpoint.keySet(); - assertThat(urlsAfterResolve.size()).isEqualTo(5); - assertThat(urlsAfterResolve.contains(urlforRead2)).isFalse();//Last read will be removed from addressCacheByEndpoint after 5 endpoints - assertThat(urlsBeforeResolve.contains(testUrl)).isTrue();//New endpoint will be added in addressCacheByEndpoint - } - - @Test(groups = "unit") - public void openAsync() throws Exception { - GlobalAddressResolver globalAddressResolver = new GlobalAddressResolver(httpClient, endpointManager, Protocol.Https, authorizationTokenProvider, collectionCache, routingMapProvider, - userAgentContainer, - serviceConfigReader, connectionPolicy); - Map addressCacheByEndpoint = Mockito.spy(globalAddressResolver.addressCacheByEndpoint); - GlobalAddressResolver.EndpointCache endpointCache = new GlobalAddressResolver.EndpointCache(); - GatewayAddressCache gatewayAddressCache = Mockito.mock(GatewayAddressCache.class); - AtomicInteger numberOfTaskCompleted = new AtomicInteger(0); - endpointCache.addressCache = gatewayAddressCache; - globalAddressResolver.addressCacheByEndpoint.clear(); - globalAddressResolver.addressCacheByEndpoint.put(urlforRead1, endpointCache); - globalAddressResolver.addressCacheByEndpoint.put(urlforRead2, endpointCache); - - - DocumentCollection documentCollection = new DocumentCollection(); - documentCollection.setId("TestColl"); - documentCollection.setResourceId("IXYFAOHEBPM="); - CollectionRoutingMap collectionRoutingMap = Mockito.mock(CollectionRoutingMap.class); - PartitionKeyRange range = new PartitionKeyRange("0", PartitionKeyInternalHelper.MinimumInclusiveEffectivePartitionKey, - PartitionKeyInternalHelper.MaximumExclusiveEffectivePartitionKey); - List partitionKeyRanges = new ArrayList<>(); - partitionKeyRanges.add(range); - Mockito.when(collectionRoutingMap.getOrderedPartitionKeyRanges()).thenReturn(partitionKeyRanges); - Single collectionRoutingMapSingle = Single.just(collectionRoutingMap); - Mockito.when(routingMapProvider.tryLookupAsync(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(collectionRoutingMapSingle); - - List ranges = new ArrayList<>(); - for (PartitionKeyRange partitionKeyRange : (List) collectionRoutingMap.getOrderedPartitionKeyRanges()) { - PartitionKeyRangeIdentity partitionKeyRangeIdentity = new PartitionKeyRangeIdentity(documentCollection.getResourceId(), partitionKeyRange.getId()); - ranges.add(partitionKeyRangeIdentity); - } - Completable completable = Completable.fromAction(new Action0() { - @Override - public void call() { - numberOfTaskCompleted.getAndIncrement(); - } - }); - Mockito.when(gatewayAddressCache.openAsync(documentCollection, ranges)).thenReturn(completable); - - globalAddressResolver.openAsync(documentCollection).await(); - assertThat(numberOfTaskCompleted.get()).isEqualTo(2); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/directconnectivity/ReflectionUtils.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/directconnectivity/ReflectionUtils.java deleted file mode 100644 index 944089112f01..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/directconnectivity/ReflectionUtils.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal.directconnectivity; - -import com.microsoft.azure.cosmosdb.internal.directconnectivity.HttpTransportClient; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.ServerStoreModel; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.StoreClient; -import com.microsoft.azure.cosmosdb.internal.directconnectivity.TransportClient; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentClientImpl; -import io.netty.buffer.ByteBuf; -import io.reactivex.netty.protocol.http.client.CompositeHttpClient; -import org.apache.commons.lang3.reflect.FieldUtils; - -/** - * - * TransportClient transportClient = ReflectionUtils.getDirectHttpsHttpClient(documentClient); - * TransportClient spyTransportClient = Mockito.spy(transportClient); - * ReflectionUtils.setTransportClient(documentClient, spyTransportClient); - * - * // use the documentClient - * // do assertion on the request and response spyTransportClient recieves using Mockito - */ -public class ReflectionUtils { - - private static void set(Object object, T newValue, String fieldName) { - try { - FieldUtils.writeField(object, fieldName, newValue, true); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } - } - - private static T get(Class klass, Object object, String fieldName) { - try { - return (T) FieldUtils.readField(object, fieldName, true); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } - } - - public static ServerStoreModel getServerStoreModel(RxDocumentClientImpl client) { - return get(ServerStoreModel.class, client, "storeModel"); - } - - public static StoreClient getStoreClient(RxDocumentClientImpl client) { - ServerStoreModel serverStoreModel = getServerStoreModel(client); - return get(StoreClient.class, serverStoreModel, "storeClient"); - } - - public static TransportClient getTransportClient(RxDocumentClientImpl client) { - StoreClient storeClient = getStoreClient(client); - return get(TransportClient.class, storeClient, "transportClient"); - } - - public static void setTransportClient(RxDocumentClientImpl client, TransportClient transportClient) { - StoreClient storeClient = getStoreClient(client); - set(storeClient, transportClient, "transportClient"); - } - - public static CompositeHttpClient getDirectHttpsHttpClient(RxDocumentClientImpl client) { - TransportClient transportClient = getTransportClient(client); - assert transportClient instanceof HttpTransportClient; - return get(CompositeHttpClient.class, transportClient, "httpClient"); - } - - public static void setDirectHttpsHttpClient(RxDocumentClientImpl client, CompositeHttpClient newHttpClient) { - TransportClient transportClient = getTransportClient(client); - assert transportClient instanceof HttpTransportClient; - set(transportClient, newHttpClient, "httpClient"); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentProducerTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentProducerTest.java deleted file mode 100644 index 479fe761b0cc..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/query/DocumentProducerTest.java +++ /dev/null @@ -1,1076 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import com.fasterxml.jackson.databind.node.ObjectNode; -import com.google.common.base.Strings; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Iterables; -import com.google.common.collect.LinkedListMultimap; -import com.microsoft.azure.cosmosdb.ConnectionPolicy; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.DocumentClientException; -import com.microsoft.azure.cosmosdb.Error; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.PartitionKeyRange; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.internal.query.QueryItem; -import com.microsoft.azure.cosmosdb.internal.query.SortOrder; -import com.microsoft.azure.cosmosdb.internal.query.orderbyquery.OrderByRowResult; -import com.microsoft.azure.cosmosdb.internal.query.orderbyquery.OrderbyRowComparer; -import com.microsoft.azure.cosmosdb.internal.routing.PartitionKeyRangeIdentity; -import com.microsoft.azure.cosmosdb.internal.routing.Range; -import com.microsoft.azure.cosmosdb.rx.internal.GlobalEndpointManager; -import com.microsoft.azure.cosmosdb.rx.internal.IRetryPolicyFactory; -import com.microsoft.azure.cosmosdb.rx.internal.RetryPolicy; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; -import com.microsoft.azure.cosmosdb.rx.internal.caches.RxPartitionKeyRangeCache; -import org.apache.commons.lang3.RandomUtils; -import org.mockito.Matchers; -import org.mockito.Mockito; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; -import rx.Observable; -import rx.Single; -import rx.functions.Func1; -import rx.functions.Func3; -import rx.observers.TestSubscriber; - -import java.net.URL; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.BiFunction; -import java.util.function.Function; -import java.util.function.Supplier; -import java.util.stream.Collectors; -import java.util.stream.IntStream; -import java.util.stream.Stream; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyBoolean; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; - -public class DocumentProducerTest { - private final static Logger logger = LoggerFactory.getLogger(DocumentProducerTest.class); - private static final long TIMEOUT = 10000; - private final static String OrderByPayloadFieldName = "payload"; - private final static String OrderByItemsFieldName = "orderByItems"; - - private final static String OrderByIntFieldName = "propInt"; - private final static String DocumentPartitionKeyRangeIdFieldName = "_pkrId"; - private final static String DocumentPartitionKeyRangeMinInclusiveFieldName = "_pkrMinInclusive"; - private final static String DocumentPartitionKeyRangeMaxExclusiveFieldName = "_pkrMaxExclusive"; - - private final String collectionRid = "myrid"; - private final String collectionLink = "/dbs/mydb/colls/mycol"; - - @DataProvider(name = "splitParamProvider") - public Object[][] splitParamProvider() { - return new Object[][] { - // initial continuation token, - // # pages from parent before split, - // # pages from left child after split, - // # pages from right child after split - { "init-cp", 10, 5, 6 }, - { null, 10, 5, 6 }, - { null, 1000, 500, 600 }, - { "init-cp", 1000, 500, 600 }, - { "init-cp", 0, 10, 12 }, - { null, 0, 10, 12 }, - { null, 0, 1, 1 }, - { null, 10, 1, 1 }, - }; - } - - private IRetryPolicyFactory mockDocumentClientIRetryPolicyFactory() { - URL url; - try { - url = new URL("http://localhost"); - } catch (Exception e) { - throw new IllegalStateException(e); - } - - GlobalEndpointManager globalEndpointManager = Mockito.mock(GlobalEndpointManager.class); - Mockito.doReturn(url).when(globalEndpointManager).resolveServiceEndpoint(Mockito.any(RxDocumentServiceRequest.class)); - doReturn(false).when(globalEndpointManager).isClosed(); - return new RetryPolicy(globalEndpointManager, ConnectionPolicy.GetDefault()); - } - - @Test(groups = { "unit" }, dataProvider = "splitParamProvider", timeOut = TIMEOUT) - public void partitionSplit(String initialContinuationToken, - int numberOfResultPagesFromParentBeforeSplit, - int numberOfResultPagesFromLeftChildAfterSplit, - int numberOfResultPagesFromRightChildAfterSplit) { - int initialPageSize = 7; - int top = -1; - - String parentPartitionId = "1"; - String leftChildPartitionId = "2"; - String rightChildPartitionId = "3"; - - List> resultFromParentPartition = mockFeedResponses(parentPartitionId, numberOfResultPagesFromParentBeforeSplit, 3, false); - List> resultFromLeftChildPartition = mockFeedResponses(leftChildPartitionId, numberOfResultPagesFromLeftChildAfterSplit, 3, true); - List> resultFromRightChildPartition = mockFeedResponses(rightChildPartitionId, numberOfResultPagesFromRightChildAfterSplit, 3, true); - - // sanity check - sanityCheckSplitValidation(parentPartitionId, leftChildPartitionId, rightChildPartitionId, - numberOfResultPagesFromParentBeforeSplit, - numberOfResultPagesFromLeftChildAfterSplit, - numberOfResultPagesFromRightChildAfterSplit, - resultFromParentPartition, resultFromLeftChildPartition, resultFromRightChildPartition); - - // setting up behaviour - RequestExecutor.PartitionAnswer answerFromParentPartition = RequestExecutor.PartitionAnswer.just(parentPartitionId, resultFromParentPartition); - RequestExecutor.PartitionAnswer splitAnswerFromParentPartition = RequestExecutor.PartitionAnswer.alwaysPartitionSplit(parentPartitionId); - - RequestExecutor.PartitionAnswer answerFromLeftChildPartition = RequestExecutor.PartitionAnswer.just(leftChildPartitionId, resultFromLeftChildPartition); - RequestExecutor.PartitionAnswer answerFromRightChildPartition = RequestExecutor.PartitionAnswer.just(rightChildPartitionId, resultFromRightChildPartition); - - RequestCreator requestCreator = RequestCreator.simpleMock(); - RequestExecutor requestExecutor = RequestExecutor. - fromPartitionAnswer(ImmutableList.of(answerFromParentPartition, splitAnswerFromParentPartition, - answerFromLeftChildPartition, answerFromRightChildPartition)); - - PartitionKeyRange parentPartitionKeyRange = mockPartitionKeyRange(parentPartitionId); - PartitionKeyRange leftChildPartitionKeyRange = mockPartitionKeyRange(leftChildPartitionId); - PartitionKeyRange rightChildPartitionKeyRange = mockPartitionKeyRange(rightChildPartitionId); - - // this returns replacement ranges upon split detection - IDocumentQueryClient queryClient = mockQueryClient(ImmutableList.of(leftChildPartitionKeyRange, rightChildPartitionKeyRange)); - - DocumentProducer documentProducer = new DocumentProducer( - queryClient, - collectionRid, - null, - requestCreator, - requestExecutor, - parentPartitionKeyRange, - collectionLink, - () -> mockDocumentClientIRetryPolicyFactory().getRequestPolicy(), - Document.class, - null, - initialPageSize, - initialContinuationToken, - top); - - TestSubscriber.DocumentProducerFeedResponse> subscriber = new TestSubscriber<>(); - - documentProducer.produceAsync().subscribe(subscriber); - subscriber.awaitTerminalEvent(); - - subscriber.assertNoErrors(); - subscriber.assertCompleted(); - - validateSplitCaptureRequests( - requestCreator.invocations, - initialContinuationToken, - parentPartitionId, - leftChildPartitionId, - rightChildPartitionId, - resultFromParentPartition, - resultFromLeftChildPartition, - resultFromRightChildPartition); - - // page size match - assertThat(requestCreator.invocations.stream().map(i -> i.maxItemCount) - .distinct().collect(Collectors.toList())).containsExactlyElementsOf(Collections.singleton(initialPageSize)); - - // expected results - validateSplitResults(subscriber.getOnNextEvents(), parentPartitionId, leftChildPartitionId, rightChildPartitionId, resultFromParentPartition, - resultFromLeftChildPartition, resultFromRightChildPartition, false); - - Mockito.verify(queryClient, times(1)).getPartitionKeyRangeCache(); - } - - @Test(groups = { "unit" }, dataProvider = "splitParamProvider", timeOut = TIMEOUT) - public void orderByPartitionSplit(String initialContinuationToken, - int numberOfResultPagesFromParentBeforeSplit, - int numberOfResultPagesFromLeftChildAfterSplit, - int numberOfResultPagesFromRightChildAfterSplit) { - int initialPageSize = 7; - int top = -1; - - String parentPartitionId = "1"; - String leftChildPartitionId = "2"; - String rightChildPartitionId = "3"; - - Integer initialPropVal = 1; - List> resultFromParentPartition = mockFeedResponses( - parentPartitionId, numberOfResultPagesFromParentBeforeSplit, 3, initialPropVal, false); - Integer highestValInParentPage = getLastValueInAsc(initialPropVal, resultFromParentPartition); - - List> resultFromLeftChildPartition = mockFeedResponses(leftChildPartitionId, - numberOfResultPagesFromLeftChildAfterSplit, 3, highestValInParentPage,true); - - List> resultFromRightChildPartition = mockFeedResponses(rightChildPartitionId, - numberOfResultPagesFromRightChildAfterSplit, 3, highestValInParentPage,true); - - // sanity check - sanityCheckSplitValidation(parentPartitionId, leftChildPartitionId, rightChildPartitionId, - numberOfResultPagesFromParentBeforeSplit, - numberOfResultPagesFromLeftChildAfterSplit, - numberOfResultPagesFromRightChildAfterSplit, - resultFromParentPartition, resultFromLeftChildPartition, resultFromRightChildPartition); - - // setting up behaviour - RequestExecutor.PartitionAnswer answerFromParentPartition = RequestExecutor.PartitionAnswer.just( - parentPartitionId, resultFromParentPartition); - RequestExecutor.PartitionAnswer splitAnswerFromParentPartition = RequestExecutor - .PartitionAnswer.alwaysPartitionSplit(parentPartitionId); - - RequestExecutor.PartitionAnswer answerFromLeftChildPartition = RequestExecutor.PartitionAnswer.just(leftChildPartitionId, resultFromLeftChildPartition); - RequestExecutor.PartitionAnswer answerFromRightChildPartition = RequestExecutor.PartitionAnswer.just(rightChildPartitionId, resultFromRightChildPartition); - - RequestCreator requestCreator = RequestCreator.simpleMock(); - RequestExecutor requestExecutor = RequestExecutor. - fromPartitionAnswer(ImmutableList.of(answerFromParentPartition, splitAnswerFromParentPartition, - answerFromLeftChildPartition, answerFromRightChildPartition)); - - PartitionKeyRange parentPartitionKeyRange = mockPartitionKeyRange(parentPartitionId); - PartitionKeyRange leftChildPartitionKeyRange = mockPartitionKeyRange(leftChildPartitionId); - PartitionKeyRange rightChildPartitionKeyRange = mockPartitionKeyRange(rightChildPartitionId); - - // this returns replacement ranges upon split detection - IDocumentQueryClient queryCl = mockQueryClient( - ImmutableList.of(leftChildPartitionKeyRange, rightChildPartitionKeyRange)); - - OrderByDocumentProducer documentProducer = new OrderByDocumentProducer<>( - new OrderbyRowComparer<>(ImmutableList.of(SortOrder.Ascending)), - queryCl, - collectionRid, - null, - requestCreator, - requestExecutor, - parentPartitionKeyRange, - collectionLink, - null, - Document.class, - null, - initialPageSize, - initialContinuationToken, - top, - /*targetRangeToOrderByContinuationTokenMap*/new HashMap<>()); - - TestSubscriber.DocumentProducerFeedResponse> subscriber = new TestSubscriber<>(); - - documentProducer.produceAsync().subscribe(subscriber); - subscriber.awaitTerminalEvent(); - - subscriber.assertNoErrors(); - subscriber.assertCompleted(); - - validateSplitCaptureRequests( - requestCreator.invocations, - initialContinuationToken, - parentPartitionId, - leftChildPartitionId, - rightChildPartitionId, - resultFromParentPartition, - resultFromLeftChildPartition, - resultFromRightChildPartition); - - // page size match - assertThat(requestCreator.invocations.stream().map(i -> i.maxItemCount) - .distinct().collect(Collectors.toList())).containsExactlyElementsOf(Collections.singleton(initialPageSize)); - - // expected results - validateSplitResults(subscriber.getOnNextEvents(), - parentPartitionId, - leftChildPartitionId, - rightChildPartitionId, - resultFromParentPartition, - resultFromLeftChildPartition, resultFromRightChildPartition, true); - - Mockito.verify(queryCl, times(1)).getPartitionKeyRangeCache(); - } - - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void simple() { - int initialPageSize = 7; - int top = -1; - - String partitionId = "1"; - - List requests = new ArrayList<>(); - for(int i = 0; i < 10; i++) { - requests.add(mockRequest(partitionId)); - } - - List> responses = mockFeedResponses(partitionId, 10, 3, true); - - RequestCreator requestCreator = RequestCreator.give(requests); - RequestExecutor requestExecutor = RequestExecutor.fromPartitionAnswer( - RequestExecutor.PartitionAnswer.just("1", responses)); - - PartitionKeyRange targetRange = mockPartitionKeyRange(partitionId); - - IDocumentQueryClient queryClient = Mockito.mock(IDocumentQueryClient.class); - String initialContinuationToken = "initial-cp"; - DocumentProducer documentProducer = new DocumentProducer<>( - queryClient, - collectionRid, - null, - requestCreator, - requestExecutor, - targetRange, - collectionLink, - () -> mockDocumentClientIRetryPolicyFactory().getRequestPolicy(), - Document.class, - null, - initialPageSize, - initialContinuationToken, - top); - - TestSubscriber subscriber = new TestSubscriber<>(); - - documentProducer.produceAsync().subscribe(subscriber); - subscriber.awaitTerminalEvent(); - - subscriber.assertNoErrors(); - subscriber.assertCompleted(); - - subscriber.assertValueCount(responses.size()); - - // requests match - assertThat(requestCreator.invocations.stream().map(i -> i.invocationResult) - .collect(Collectors.toList())).containsExactlyElementsOf(requests); - - // requested max page size match - assertThat(requestCreator.invocations.stream().map(i -> i.maxItemCount) - .distinct().collect(Collectors.toList())).containsExactlyElementsOf(Collections.singleton(7)); - - // continuation tokens - assertThat(requestCreator.invocations.get(0).continuationToken).isEqualTo(initialContinuationToken); - assertThat(requestCreator.invocations.stream().skip(1).map(i -> i.continuationToken) - .collect(Collectors.toList())).containsExactlyElementsOf( - responses.stream().limit(9).map(r -> r.getResponseContinuation()).collect(Collectors.toList())); - - // source partition - assertThat(requestCreator.invocations.stream().map(i -> i.sourcePartition).distinct() - .collect(Collectors.toList())).containsExactlyElementsOf(Collections.singletonList(targetRange)); - } - - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void retries() { - int initialPageSize = 7; - int top = -1; - - String partitionKeyRangeId = "1"; - - RequestCreator requestCreator = RequestCreator.simpleMock(); - - List> responsesBeforeThrottle = mockFeedResponses(partitionKeyRangeId, 2, 1, false); - Exception throttlingException = mockThrottlingException(10); - List> responsesAfterThrottle = mockFeedResponses(partitionKeyRangeId, 5, 1, true); - - RequestExecutor.PartitionAnswer behaviourBeforeException = RequestExecutor.PartitionAnswer.just(partitionKeyRangeId, responsesBeforeThrottle); - RequestExecutor.PartitionAnswer exceptionBehaviour = RequestExecutor.PartitionAnswer.errors(partitionKeyRangeId, Collections.singletonList(throttlingException)); - RequestExecutor.PartitionAnswer behaviourAfterException = RequestExecutor.PartitionAnswer.just(partitionKeyRangeId, responsesAfterThrottle); - - RequestExecutor requestExecutor = RequestExecutor.fromPartitionAnswer(behaviourBeforeException, exceptionBehaviour, behaviourAfterException); - - PartitionKeyRange targetRange = mockPartitionKeyRange(partitionKeyRangeId); - - IDocumentQueryClient queryClient = Mockito.mock(IDocumentQueryClient.class); - String initialContinuationToken = "initial-cp"; - DocumentProducer documentProducer = new DocumentProducer<>( - queryClient, - collectionRid, - null, - requestCreator, - requestExecutor, - targetRange, - collectionLink, - () -> mockDocumentClientIRetryPolicyFactory().getRequestPolicy(), - Document.class, - null, - initialPageSize, - initialContinuationToken, - top); - - TestSubscriber subscriber = new TestSubscriber<>(); - - documentProducer.produceAsync().subscribe(subscriber); - subscriber.awaitTerminalEvent(); - - subscriber.assertNoErrors(); - subscriber.assertCompleted(); - - subscriber.assertValueCount(responsesBeforeThrottle.size() + responsesAfterThrottle.size()); - - // requested max page size match - assertThat(requestCreator.invocations.stream().map(i -> i.maxItemCount) - .distinct().collect(Collectors.toList())).containsExactlyElementsOf(Collections.singleton(7)); - - // continuation tokens - assertThat(requestCreator.invocations.get(0).continuationToken).isEqualTo(initialContinuationToken); - - // source partition - assertThat(requestCreator.invocations.stream().map(i -> i.sourcePartition).distinct() - .collect(Collectors.toList())).containsExactlyElementsOf(Collections.singletonList(targetRange)); - - List resultContinuationToken = subscriber.getOnNextEvents() - .stream().map(r -> r.pageResult.getResponseContinuation()).collect(Collectors.toList()); - List beforeExceptionContinuationTokens = responsesBeforeThrottle.stream() - .map(r -> r.getResponseContinuation()).collect(Collectors.toList()); - List afterExceptionContinuationTokens = responsesAfterThrottle.stream() - .map(r -> r.getResponseContinuation()).collect(Collectors.toList()); - - assertThat(resultContinuationToken).containsExactlyElementsOf( - Iterables.concat(beforeExceptionContinuationTokens, afterExceptionContinuationTokens)); - - String continuationTokenOnException = Iterables.getLast(beforeExceptionContinuationTokens); - - assertThat(requestCreator.invocations.stream().map(cr -> cr.continuationToken)).containsExactlyElementsOf( - Iterables.concat( - ImmutableList.of(initialContinuationToken), - Iterables.limit(resultContinuationToken, resultContinuationToken.size()-1))); - - assertThat(requestExecutor.partitionKeyRangeIdToCapturedInvocation.get(partitionKeyRangeId) - .stream().map(cr -> cr.request.getContinuation())).containsExactlyElementsOf( - Iterables.concat( - ImmutableList.of(initialContinuationToken), - beforeExceptionContinuationTokens, - Collections.singletonList(continuationTokenOnException), - Iterables.limit(afterExceptionContinuationTokens, afterExceptionContinuationTokens.size()-1))); - } - - @Test(groups = { "unit" }, timeOut = TIMEOUT) - public void retriesExhausted() { - int initialPageSize = 7; - int top = -1; - - String partitionKeyRangeId = "1"; - - RequestCreator requestCreator = RequestCreator.simpleMock(); - - List> responsesBeforeThrottle = mockFeedResponses(partitionKeyRangeId, 1, 1, false); - Exception throttlingException = mockThrottlingException(10); - - RequestExecutor.PartitionAnswer behaviourBeforeException = RequestExecutor.PartitionAnswer.just(partitionKeyRangeId, responsesBeforeThrottle); - RequestExecutor.PartitionAnswer exceptionBehaviour = RequestExecutor.PartitionAnswer.errors(partitionKeyRangeId, Collections.nCopies(10, throttlingException)); - - RequestExecutor requestExecutor = RequestExecutor.fromPartitionAnswer(behaviourBeforeException, exceptionBehaviour); - - PartitionKeyRange targetRange = mockPartitionKeyRange(partitionKeyRangeId); - - IDocumentQueryClient queryClient = Mockito.mock(IDocumentQueryClient.class); - String initialContinuationToken = "initial-cp"; - DocumentProducer documentProducer = new DocumentProducer<>( - queryClient, - collectionRid, - null, - requestCreator, - requestExecutor, - targetRange, - collectionRid, - () -> mockDocumentClientIRetryPolicyFactory().getRequestPolicy(), - Document.class, - null, - initialPageSize, - initialContinuationToken, - top); - - TestSubscriber subscriber = new TestSubscriber<>(); - - documentProducer.produceAsync().subscribe(subscriber); - subscriber.awaitTerminalEvent(); - - subscriber.assertError(throttlingException); - subscriber.assertValueCount(responsesBeforeThrottle.size()); - } - - private DocumentClientException mockThrottlingException(long retriesAfter) { - DocumentClientException throttleException = mock(DocumentClientException.class); - doReturn(429).when(throttleException).getStatusCode(); - doReturn(retriesAfter).when(throttleException).getRetryAfterInMilliseconds(); - return throttleException; - } - - private List> mockFeedResponses(String partitionKeyRangeId, - int numberOfPages, - int numberOfDocsPerPage, - boolean completed) { - return mockFeedResponsesPartiallySorted(partitionKeyRangeId, - numberOfPages, - numberOfDocsPerPage, - false, - -1, - completed); - } - - private List> mockFeedResponses(String partitionKeyRangeId, - int numberOfPages, - int numberOfDocsPerPage, - int orderByFieldInitialVal, - boolean completed) { - return mockFeedResponsesPartiallySorted(partitionKeyRangeId, - numberOfPages, - numberOfDocsPerPage, - true, - orderByFieldInitialVal, - completed); - } - - private List> mockFeedResponsesPartiallySorted(String partitionKeyRangeId, - int numberOfPages, - int numberOfDocsPerPage, - boolean isOrderby, - int orderByFieldInitialVal, - boolean completed) { - String uuid = UUID.randomUUID().toString(); - List> responses = new ArrayList<>(); - for(int i = 0; i < numberOfPages; i++) { - FeedResponseBuilder rfb = FeedResponseBuilder.queryFeedResponseBuilder(Document.class); - List res = new ArrayList<>(); - - for(int j = 0; j < numberOfDocsPerPage; j++) { - - Document d = getDocumentDefinition(); - if (isOrderby) { - d.set(OrderByIntFieldName, orderByFieldInitialVal + RandomUtils.nextInt(0, 3)); - d.set(DocumentPartitionKeyRangeIdFieldName, partitionKeyRangeId); - PartitionKeyRange pkr = mockPartitionKeyRange(partitionKeyRangeId); - - d.set(DocumentPartitionKeyRangeMinInclusiveFieldName, pkr.getMinInclusive()); - d.set(DocumentPartitionKeyRangeMaxExclusiveFieldName, pkr.getMaxExclusive()); - - QueryItem qi = new QueryItem( - "{ \"item\": " + Integer.toString(d.getInt(OrderByIntFieldName)) + " }"); - String json = "{\"" + OrderByPayloadFieldName + "\" : " + d.toJson() + ", \"" + OrderByItemsFieldName - + "\" : [ " + qi.toJson() + " ] }"; - - OrderByRowResult row = - new OrderByRowResult<>(Document.class, json, mockPartitionKeyRange(partitionKeyRangeId), "backend continuation token"); - res.add(row); - } else { - res.add(d); - } - } - rfb.withResults(res); - - if (!(completed && i == numberOfPages - 1)) { - rfb.withContinuationToken("cp:" + uuid + ":" + i); - } - - FeedResponse resp = rfb.build(); - responses.add(resp); - } - return responses; - } - - private int getLastValueInAsc(int initialValue, List> responsesList) { - Integer value = null; - for(FeedResponse page: responsesList) { - for(Document d: page.getResults()) { - Integer tmp = d.getInt(OrderByIntFieldName); - if (tmp != null) { - value = tmp; - } - } - } - if (value != null) { - return value; - } else { - return initialValue; - } - } - - private IDocumentQueryClient mockQueryClient(List replacementRanges) { - IDocumentQueryClient client = Mockito.mock(IDocumentQueryClient.class); - RxPartitionKeyRangeCache cache = Mockito.mock(RxPartitionKeyRangeCache.class); - doReturn(cache).when(client).getPartitionKeyRangeCache(); - doReturn(Single.just(replacementRanges)).when(cache). - tryGetOverlappingRangesAsync(anyString(), any(Range.class), anyBoolean(), Matchers.anyMap()); - return client; - } - - private PartitionKeyRange mockPartitionKeyRange(String partitionKeyRangeId) { - PartitionKeyRange pkr = Mockito.mock(PartitionKeyRange.class); - doReturn(partitionKeyRangeId).when(pkr).getId(); - doReturn(partitionKeyRangeId + ":AA").when(pkr).getMinInclusive(); - doReturn(partitionKeyRangeId + ":FF").when(pkr).getMaxExclusive(); - return pkr; - } - - private RxDocumentServiceRequest mockRequest(String partitionKeyRangeId) { - RxDocumentServiceRequest req = Mockito.mock(RxDocumentServiceRequest.class); - PartitionKeyRangeIdentity pkri = new PartitionKeyRangeIdentity(partitionKeyRangeId); - doReturn(pkri).when(req).getPartitionKeyRangeIdentity(); - return req; - } - - private static void validateSplitCaptureRequests( - List capturedInvocationList, - String initialContinuationToken, - String parentPartitionId, - String leftChildPartitionId, - String rightChildPartitionId, - List> expectedResultPagesFromParentPartitionBeforeSplit, - List> expectedResultPagesFromLeftChildPartition, - List> expectedResultPagesFromRightChildPartition) { - - int numberOfResultPagesFromParentBeforeSplit = expectedResultPagesFromParentPartitionBeforeSplit.size(); - int numberOfResultPagesFromLeftChildAfterSplit = expectedResultPagesFromLeftChildPartition.size(); - int numberOfResultPagesFromRightChildAfterSplit = expectedResultPagesFromRightChildPartition.size(); - - // numberOfResultPagesFromParentBeforeSplit + 1 requests to parent partition - assertThat(capturedInvocationList.stream().limit(numberOfResultPagesFromParentBeforeSplit + 1) - .filter(i -> i.sourcePartition.getId().equals(parentPartitionId))) - .hasSize(numberOfResultPagesFromParentBeforeSplit + 1); - - assertThat(capturedInvocationList.stream().skip(numberOfResultPagesFromParentBeforeSplit + 1) - .filter(i -> i.sourcePartition.getId().equals(leftChildPartitionId))) - .hasSize(numberOfResultPagesFromLeftChildAfterSplit); - - assertThat(capturedInvocationList.stream().skip(numberOfResultPagesFromParentBeforeSplit + 1) - .filter(i -> i.sourcePartition.getId().equals(rightChildPartitionId))) - .hasSize(numberOfResultPagesFromRightChildAfterSplit); - - - BiFunction, String, Stream> - filterByPartition = (stream, partitionId) - -> stream.filter(i -> i.sourcePartition.getId().equals(partitionId)); - - Function>, Stream> extractContinuationToken = - (list) -> list.stream().map(p -> p.getResponseContinuation()); - - assertThat(filterByPartition.apply(capturedInvocationList.stream(), parentPartitionId) - .map(r -> r.continuationToken)).containsExactlyElementsOf( - toList(Stream.concat( - Stream.of(initialContinuationToken), - extractContinuationToken.apply(expectedResultPagesFromParentPartitionBeforeSplit)))); - - String expectedInitialChildContinuationTokenInheritedFromParent = - expectedResultPagesFromParentPartitionBeforeSplit.size() > 0 ? - expectedResultPagesFromParentPartitionBeforeSplit.get( - expectedResultPagesFromParentPartitionBeforeSplit.size() - 1) - .getResponseContinuation() :initialContinuationToken; - - assertThat( - filterByPartition.andThen(s -> s.map(r -> r.continuationToken)) - .apply(capturedInvocationList.stream(), leftChildPartitionId) - ).containsExactlyElementsOf( - toList( - Stream.concat( - Stream.of(expectedInitialChildContinuationTokenInheritedFromParent), - extractContinuationToken.apply(expectedResultPagesFromLeftChildPartition) - //drop last page with null cp which doesn't trigger any request - .limit(expectedResultPagesFromLeftChildPartition.size() - 1) - ) - )); - - assertThat( - filterByPartition.andThen(s -> s.map(r -> r.continuationToken)) - .apply(capturedInvocationList.stream(), rightChildPartitionId) - ).containsExactlyElementsOf( - toList( - Stream.concat( - Stream.of(expectedInitialChildContinuationTokenInheritedFromParent), - extractContinuationToken.apply(expectedResultPagesFromRightChildPartition) - //drop last page with null cp which doesn't trigger any request - .limit(expectedResultPagesFromRightChildPartition.size() - 1) - ) - )); - } - - private static void sanityCheckSplitValidation(String parentPartitionId, - String leftChildPartitionId, - String rightChildPartitionId, - int numberOfResultPagesFromParentBeforeSplit, - int numberOfResultPagesFromLeftChildAfterSplit, - int numberOfResultPagesFromRightChildAfterSplit, - List> resultFromParent, - List> resultFromLeftChild, - List> resultFromRightChild) { - // test sanity check - assertThat(resultFromParent).hasSize(numberOfResultPagesFromParentBeforeSplit); - assertThat(resultFromLeftChild).hasSize(numberOfResultPagesFromLeftChildAfterSplit); - assertThat(resultFromRightChild).hasSize(numberOfResultPagesFromRightChildAfterSplit); - - //validate expected result continuation token - assertThat(toList(resultFromParent.stream().map(p -> p.getResponseContinuation()) - .filter(cp -> Strings.isNullOrEmpty(cp)))).isEmpty(); - - assertThat(toList(resultFromLeftChild.stream().map(p -> p.getResponseContinuation()) - .limit(resultFromLeftChild.size() - 1) - .filter(cp -> Strings.isNullOrEmpty(cp)))).isEmpty(); - - assertThat(resultFromLeftChild.get(resultFromLeftChild.size() - 1).getResponseContinuation()).isNullOrEmpty(); - - assertThat(toList(resultFromRightChild.stream().map(p -> p.getResponseContinuation()) - .limit(resultFromRightChild.size() - 1) - .filter(cp -> Strings.isNullOrEmpty(cp)))).isEmpty(); - - assertThat(resultFromRightChild.get(resultFromRightChild.size() - 1).getResponseContinuation()).isNullOrEmpty(); - } - - private void validateSplitResults(List.DocumentProducerFeedResponse> actualPages, - String parentPartitionId, - String leftChildPartitionId, - String rightChildPartitionId, - List> resultFromParent, - List> resultFromLeftChild, - List> resultFromRightChild, - boolean isOrderby) { - - if (isOrderby) { - Supplier> getStreamOfActualDocuments = - () -> actualPages.stream().flatMap(p -> p.pageResult.getResults().stream()); - - Comparator comparator = new Comparator() { - @Override - public int compare(Document o1, Document o2) { - ObjectNode obj1 = (ObjectNode) o1.get(OrderByPayloadFieldName); - ObjectNode obj2 = (ObjectNode) o1.get(OrderByPayloadFieldName); - - int cmp = (obj1).get(OrderByIntFieldName).asInt() - - (obj2).get(OrderByIntFieldName).asInt(); - if (cmp != 0) { - return cmp; - } - - return obj1.get(DocumentPartitionKeyRangeMinInclusiveFieldName).asText() - .compareTo(obj2.get(DocumentPartitionKeyRangeMinInclusiveFieldName).asText()); - } - }; - - List expectedDocuments = Stream.concat(Stream.concat(resultFromParent.stream(), - resultFromLeftChild.stream()), resultFromRightChild.stream()) - .flatMap(p -> p.getResults().stream()) - .sorted(comparator) - .collect(Collectors.toList()); - - List actualDocuments = getStreamOfActualDocuments.get().map(d -> d.getId()).collect(Collectors.toList()); - assertThat(actualDocuments) - .containsExactlyElementsOf(expectedDocuments.stream().map(d -> d.getId()).collect(Collectors.toList())); - - } else { - assertThat(actualPages).hasSize(resultFromParent.size() - + resultFromLeftChild.size() - + resultFromRightChild.size()); - - BiFunction> repeater = (v, cnt) -> { - return IntStream.range(0, cnt).mapToObj(i -> v); - }; - - List expectedCapturedPartitionIds = toList(Stream.concat(Stream.concat(repeater.apply(parentPartitionId, resultFromParent.size()), - repeater.apply(leftChildPartitionId, resultFromLeftChild.size())), - repeater.apply(rightChildPartitionId, resultFromRightChild.size()))); - - - - assertThat(toList(partitionKeyRangeIds(actualPages).stream())).containsExactlyInAnyOrderElementsOf( - expectedCapturedPartitionIds); - - validateResults(feedResponses(actualPages), ImmutableList.of(resultFromParent, resultFromLeftChild, resultFromRightChild)); - } - } - - private static List repeat(T t, int cnt) { - return IntStream.range(0, cnt).mapToObj(i -> t).collect(Collectors.toList()); - } - - private static List> feedResponses(List.DocumentProducerFeedResponse> responses) { - return responses.stream().map(dpFR -> dpFR.pageResult).collect(Collectors.toList()); - } - - private static List toList(Stream stream) { - return stream.collect(Collectors.toList()); - } - - private static List partitionKeyRangeIds(List.DocumentProducerFeedResponse> responses) { - return responses.stream().map(dpFR -> dpFR.sourcePartitionKeyRange.getId()).collect(Collectors.toList()); - } - - private static void validateResults(List> captured, List>> expectedResponsesFromPartitions) { - List> expected = expectedResponsesFromPartitions - .stream().flatMap(l -> l.stream()).collect(Collectors.toList()); - assertThat(captured).hasSameSizeAs(expected); - for(int i = 0; i < expected.size(); i++) { - FeedResponse actualPage = captured.get(i); - FeedResponse expectedPage = expected.get(i); - assertEqual(actualPage, expectedPage); - } - } - - private static void assertEqual(FeedResponse actualPage, FeedResponse expectedPage) { - assertThat(actualPage.getResults()).hasSameSizeAs(actualPage.getResults()); - assertThat(actualPage.getResponseContinuation()).isEqualTo(expectedPage.getResponseContinuation()); - - for(int i = 0; i < actualPage.getResults().size(); i++) { - Document actualDoc = actualPage.getResults().get(i); - Document expectedDoc = expectedPage.getResults().get(i); - assertThat(actualDoc.getId()).isEqualTo(expectedDoc.getId()); - assertThat(actualDoc.getString("prop")).isEqualTo(expectedDoc.getString("prop")); - } - } - - static abstract class RequestExecutor implements Func1>> { - - LinkedListMultimap partitionKeyRangeIdToCapturedInvocation = - LinkedListMultimap.create(); - class CapturedInvocation { - long time = System.nanoTime(); - RxDocumentServiceRequest request; - FeedResponse invocationResult; - Exception failureResult; - - public CapturedInvocation(RxDocumentServiceRequest request, Exception ex) { - this.request = request; - this.failureResult = ex; - } - - public CapturedInvocation(RxDocumentServiceRequest request, PartitionAnswer.Response resp) { - this.request = request; - this.invocationResult = resp.invocationResult; - this.failureResult = resp.failureResult; - } - } - - private static DocumentClientException partitionKeyRangeGoneException() { - Map headers = new HashMap<>(); - headers.put(HttpConstants.HttpHeaders.SUB_STATUS, - Integer.toString(HttpConstants.SubStatusCodes.PARTITION_KEY_RANGE_GONE)); - return new DocumentClientException(HttpConstants.StatusCodes.GONE, new Error(), headers); - } - - protected void capture(String partitionId, CapturedInvocation captureInvocation) { - partitionKeyRangeIdToCapturedInvocation.put(partitionId, captureInvocation); - } - - public static RequestExecutor fromPartitionAnswer(List answers) { - return new RequestExecutor() { - @Override - public Observable> call(RxDocumentServiceRequest request) { - synchronized (this) { - logger.debug("executing request: " + request + " cp is: " + request.getContinuation()); - for (PartitionAnswer a : answers) { - if (a.getPartitionKeyRangeId().equals( - request.getPartitionKeyRangeIdentity().getPartitionKeyRangeId())) { - try { - PartitionAnswer.Response resp = a.onRequest(request); - if (resp != null) { - CapturedInvocation ci = new CapturedInvocation(request, resp); - capture(a.getPartitionKeyRangeId(), ci); - return resp.toSingle().toObservable(); - } - - } catch (Exception e) { - capture(a.getPartitionKeyRangeId(), new CapturedInvocation(request, e)); - return Observable.error(e); - } - } - } - throw new RuntimeException(); - } - } - }; - } - - public static RequestExecutor fromPartitionAnswer(PartitionAnswer... answers) { - return fromPartitionAnswer(ImmutableList.copyOf(answers)); - } - - abstract static class PartitionAnswer { - class Response { - FeedResponse invocationResult; - Exception failureResult; - - public Response(FeedResponse invocationResult) { - this.invocationResult = invocationResult; - } - - public Response(Exception ex) { - this.failureResult = ex; - } - - public Single> toSingle() { - if (invocationResult != null) { - return Single.just(invocationResult); - } else { - return Single.error(failureResult); - } - } - } - - private String partitionKeyRangeId; - - private static boolean targetsPartition(RxDocumentServiceRequest req, String partitionKeyRangeId) { - return partitionKeyRangeId.equals(req.getPartitionKeyRangeIdentity().getPartitionKeyRangeId()); - } - - protected PartitionAnswer(String partitionKeyRangeId) { - this.partitionKeyRangeId = partitionKeyRangeId; - } - - public String getPartitionKeyRangeId() { - return partitionKeyRangeId; - } - - public abstract Response onRequest(final RxDocumentServiceRequest req); - - public static PartitionAnswer just(String partitionId, List> resps) { - AtomicInteger index = new AtomicInteger(); - return new PartitionAnswer(partitionId) { - @Override - public Response onRequest(RxDocumentServiceRequest request) { - if (!PartitionAnswer.targetsPartition(request, partitionId)) { - return null; - } - synchronized (this) { - if (index.get() < resps.size()) { - return new Response(resps.get(index.getAndIncrement())); - } - } - return null; - } - }; - } - - public static PartitionAnswer always(String partitionId, final Exception ex) { - return new PartitionAnswer(partitionId) { - @Override - public Response onRequest(RxDocumentServiceRequest request) { - if (!PartitionAnswer.targetsPartition(request, partitionId)) { - return null; - } - - return new Response(ex); - } - }; - } - - public static PartitionAnswer errors(String partitionId, List exs) { - AtomicInteger index = new AtomicInteger(); - return new PartitionAnswer(partitionId) { - @Override - public Response onRequest(RxDocumentServiceRequest request) { - if (!PartitionAnswer.targetsPartition(request, partitionId)) { - return null; - } - synchronized (this) { - if (index.get() < exs.size()) { - return new Response(exs.get(index.getAndIncrement())); - } - } - return null; - } - }; - } - - public static PartitionAnswer alwaysPartitionSplit(String partitionId) { - return new PartitionAnswer(partitionId) { - @Override - public Response onRequest(RxDocumentServiceRequest request) { - if (!PartitionAnswer.targetsPartition(request, partitionId)) { - return null; - } - return new Response(partitionKeyRangeGoneException()); - } - }; - } - } - } - - static abstract class RequestCreator implements - Func3 { - - public static RequestCreator give(List requests) { - AtomicInteger i = new AtomicInteger(0); - return new RequestCreator() { - - @Override - public RxDocumentServiceRequest call(PartitionKeyRange pkr, String cp, Integer ps) { - synchronized (this) { - RxDocumentServiceRequest req = requests.get(i.getAndIncrement()); - invocations.add(new CapturedInvocation(pkr, cp, ps, req)); - return req; - } - } - }; - } - - public static RequestCreator simpleMock() { - return new RequestCreator() { - @Override - public RxDocumentServiceRequest call(PartitionKeyRange pkr, String cp, Integer ps) { - synchronized (this) { - RxDocumentServiceRequest req = Mockito.mock(RxDocumentServiceRequest.class); - PartitionKeyRangeIdentity pkri = new PartitionKeyRangeIdentity(pkr.getId()); - doReturn(pkri).when(req).getPartitionKeyRangeIdentity(); - doReturn(cp).when(req).getContinuation(); - invocations.add(new CapturedInvocation(pkr, cp, ps, req)); - logger.debug("creating request: " + req + " cp is " + cp); - return req; - } - } - }; - } - - class CapturedInvocation { - PartitionKeyRange sourcePartition; - String continuationToken; - Integer maxItemCount; - RxDocumentServiceRequest invocationResult; - - public CapturedInvocation(PartitionKeyRange sourcePartition, - String continuationToken, - Integer maxItemCount, - RxDocumentServiceRequest invocationResult) { - this.sourcePartition = sourcePartition; - this.continuationToken = continuationToken; - this.maxItemCount = maxItemCount; - this.invocationResult = invocationResult; - } - } - - List invocations = Collections.synchronizedList(new ArrayList<>()); - - abstract public RxDocumentServiceRequest call(PartitionKeyRange pkr, String cp, Integer ps); - } - - private Document getDocumentDefinition() { - String uuid = UUID.randomUUID().toString(); - Document doc = new Document(String.format("{ " - + "\"id\": \"%s\", " - + "\"mypk\": \"%s\", " - + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]], " - + "\"prop\": \"%s\"" - + "}" - , uuid, uuid, uuid)); - return doc; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/query/FeedResponseBuilder.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/query/FeedResponseBuilder.java deleted file mode 100644 index 60be8309a2c6..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/query/FeedResponseBuilder.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import com.microsoft.azure.cosmosdb.BridgeInternal; -import com.microsoft.azure.cosmosdb.BridgeUtils; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.Resource; -import com.microsoft.azure.cosmosdb.internal.HttpConstants; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceResponse; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class FeedResponseBuilder { - private final boolean isChangeFeed; - private final Class klass; - - private Map headers = new HashMap<>(); - private boolean noMoreChangesInChangeFeed = false; - private List results; - - private FeedResponseBuilder(Class klass, boolean isChangeFeed) { - this.klass = klass; - this.isChangeFeed = isChangeFeed; - } - - public FeedResponseBuilder withContinuationToken(String continuationToken) { - - if (isChangeFeed) { - headers.put(HttpConstants.HttpHeaders.E_TAG, continuationToken); - } else { - headers.put(HttpConstants.HttpHeaders.CONTINUATION, continuationToken); - } - return this; - } - - public FeedResponseBuilder withResults(List results) { - this.results = results; - return this; - } - - public FeedResponseBuilder withResults(T... results) { - this.results = Arrays.asList(results); - return this; - } - - public FeedResponseBuilder lastChangeFeedPage() { - this.noMoreChangesInChangeFeed = true; - return this; - } - - public FeedResponse build() { - RxDocumentServiceResponse rsp = mock(RxDocumentServiceResponse.class); - when(rsp.getResponseHeaders()).thenReturn(headers); - when(rsp.getQueryResponse(klass)).thenReturn(results); - if (isChangeFeed) { - when(rsp.getStatusCode()).thenReturn(noMoreChangesInChangeFeed? - HttpConstants.StatusCodes.NOT_MODIFIED : 200); - return BridgeInternal.toChaneFeedResponsePage(rsp, klass); - } else { - return BridgeInternal.toFeedResponsePage(rsp, klass); - } - } - - public static FeedResponseBuilder queryFeedResponseBuilder(Class klass) { - return new FeedResponseBuilder(klass, false); - } - - public static FeedResponseBuilder changeFeedResponseBuilder(Class klass) { - return new FeedResponseBuilder(klass, true); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/query/FetcherTest.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/query/FetcherTest.java deleted file mode 100644 index f81bda40d3eb..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/internal/query/FetcherTest.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package com.microsoft.azure.cosmosdb.rx.internal.query; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; - -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; - -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -import com.microsoft.azure.cosmosdb.ChangeFeedOptions; -import com.microsoft.azure.cosmosdb.Document; -import com.microsoft.azure.cosmosdb.FeedOptions; -import com.microsoft.azure.cosmosdb.FeedOptionsBase; -import com.microsoft.azure.cosmosdb.FeedResponse; -import com.microsoft.azure.cosmosdb.rx.internal.RxDocumentServiceRequest; - -import rx.Observable; -import rx.functions.Func1; -import rx.functions.Func2; -import rx.observers.TestSubscriber; - -public class FetcherTest { - - @DataProvider(name = "queryParams") - public static Object[][] queryParamProvider() { - - FeedOptions options1 = new FeedOptions(); - options1.setMaxItemCount(100); - options1.setRequestContinuation("cp-init"); // initial continuation token - int top1 = -1; // no top - - // no continuation token - FeedOptions options2 = new FeedOptions(); - options2.setMaxItemCount(100); - int top2 = -1; // no top - - // top more than max item count - FeedOptions options3 = new FeedOptions(); - options3.setMaxItemCount(100); - int top3 = 200; - - // top less than max item count - FeedOptions options4 = new FeedOptions(); - options4.setMaxItemCount(100); - int top4 = 20; - - return new Object[][] { - { options1, top1 }, - { options2, top2 }, - { options3, top3 }, - { options4, top4 }}; - } - - @Test(groups = { "unit" }, dataProvider = "queryParams") - public void query(FeedOptions options, int top) { - - FeedResponse fp1 = FeedResponseBuilder.queryFeedResponseBuilder(Document.class) - .withContinuationToken("cp1") - .withResults(new Document(), new Document(), new Document()) - .build(); - - FeedResponse fp2 = FeedResponseBuilder.queryFeedResponseBuilder(Document.class) - .withContinuationToken(null) - .withResults(new Document()) - .build(); - - List> feedResponseList = Arrays.asList(fp1, fp2); - - AtomicInteger totalResultsReceived = new AtomicInteger(0); - - AtomicInteger requestIndex = new AtomicInteger(0); - - Func2 createRequestFunc = (token, maxItemCount) -> { - assertThat(maxItemCount).describedAs("max item count").isEqualTo( - getExpectedMaxItemCountInRequest(options, top, feedResponseList, requestIndex.get())); - assertThat(token).describedAs("continuation token").isEqualTo( - getExpectedContinuationTokenInRequest(options, feedResponseList, requestIndex.get())); - requestIndex.getAndIncrement(); - - return mock(RxDocumentServiceRequest.class); - }; - - AtomicInteger executeIndex = new AtomicInteger(0); - - Func1>> executeFunc = request -> { - FeedResponse rsp = feedResponseList.get(executeIndex.getAndIncrement()); - totalResultsReceived.addAndGet(rsp.getResults().size()); - return Observable.just(rsp); - }; - - Fetcher fetcher = - new Fetcher<>(createRequestFunc, executeFunc, options, false, top, - options.getMaxItemCount()); - - validateFetcher(fetcher, options, top, feedResponseList); - } - - private void validateFetcher(Fetcher fetcher, - FeedOptions options, - int top, - List> feedResponseList) { - - int totalNumberOfDocs = 0; - - int index = 0; - while(index < feedResponseList.size()) { - assertThat(fetcher.shouldFetchMore()).describedAs("should fetch more pages").isTrue(); - totalNumberOfDocs += validate(fetcher.nextPage()).getResults().size(); - - if ((top != -1) && (totalNumberOfDocs >= top)) { - break; - } - index++; - } - assertThat(fetcher.shouldFetchMore()).describedAs("should not fetch more pages").isFalse(); - } - - @Test(groups = { "unit" }) - public void changeFeed() { - - ChangeFeedOptions options = new ChangeFeedOptions(); - options.setMaxItemCount(100); - - boolean isChangeFeed = true; - int top = -1; - - FeedResponse fp1 = FeedResponseBuilder.changeFeedResponseBuilder(Document.class) - .withContinuationToken("cp1") - .withResults(new Document()) - .build(); - - FeedResponse fp2 = FeedResponseBuilder.changeFeedResponseBuilder(Document.class) - .withContinuationToken("cp2") - .lastChangeFeedPage() - .build(); - - List> feedResponseList = Arrays.asList(fp1, fp2); - - AtomicInteger requestIndex = new AtomicInteger(0); - - Func2 createRequestFunc = (token, maxItemCount) -> { - assertThat(maxItemCount).describedAs("max item count").isEqualTo(options.getMaxItemCount()); - assertThat(token).describedAs("continuation token").isEqualTo( - getExpectedContinuationTokenInRequest(options, feedResponseList, requestIndex.getAndIncrement())); - - return mock(RxDocumentServiceRequest.class); - }; - - AtomicInteger executeIndex = new AtomicInteger(0); - - Func1>> executeFunc = request -> { - return Observable.just(feedResponseList.get(executeIndex.getAndIncrement())); - }; - - Fetcher fetcher = - new Fetcher<>(createRequestFunc, executeFunc, options, isChangeFeed, top, - options.getMaxItemCount()); - - validateFetcher(fetcher, options, feedResponseList); - } - - private void validateFetcher(Fetcher fetcher, - ChangeFeedOptions options, - List> feedResponseList) { - - - for(FeedResponse change: feedResponseList) { - assertThat(fetcher.shouldFetchMore()).describedAs("should fetch more pages").isTrue(); - validate(fetcher.nextPage()); - } - - assertThat(fetcher.shouldFetchMore()).describedAs("should not fetch more pages").isFalse(); - } - - private FeedResponse validate(Observable> page) { - TestSubscriber> subscriber = new TestSubscriber(); - page.subscribe(subscriber); - subscriber.awaitTerminalEvent(); - subscriber.assertCompleted(); - subscriber.assertNoErrors(); - subscriber.assertValueCount(1); - return subscriber.getOnNextEvents().get(0); - } - - private String getExpectedContinuationTokenInRequest(FeedOptionsBase options, - List> feedResponseList, - int requestIndex) { - if (requestIndex == 0) { - return options.getRequestContinuation(); - } - - return feedResponseList.get(requestIndex - 1).getResponseContinuation(); - } - - private int getExpectedMaxItemCountInRequest(FeedOptionsBase options, - int top, - List> feedResponseList, - int requestIndex) { - if (top == -1) { - return options.getMaxItemCount(); - } - - int numberOfReceivedItemsSoFar = - feedResponseList.subList(0, requestIndex).stream().mapToInt(rsp -> rsp.getResults().size()).sum(); - - return Math.min(top - numberOfReceivedItemsSoFar, options.getMaxItemCount()); - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyChannelInitializer.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyChannelInitializer.java deleted file mode 100644 index 7b1f613713c1..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyChannelInitializer.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.proxy; - -import java.util.concurrent.atomic.AtomicLong; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import io.netty.channel.ChannelInitializer; -import io.netty.channel.socket.SocketChannel; - -/** - * The channel initializer. - * - */ -public class HttpProxyChannelInitializer extends ChannelInitializer { - private final Logger logger = LoggerFactory.getLogger(HttpProxyChannelInitializer.class); - private AtomicLong taskCounter = new AtomicLong(); - private HttpProxyClientHandler httpProxyClientHandler; - - @Override - protected void initChannel(SocketChannel ch) throws Exception { - httpProxyClientHandler = new HttpProxyClientHandler("task-" + taskCounter.getAndIncrement()); - logger.info("task-" + taskCounter.getAndIncrement()); - ch.pipeline().addLast(httpProxyClientHandler); - } - -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyClientHandler.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyClientHandler.java deleted file mode 100644 index 4afdcc7181a5..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyClientHandler.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.proxy; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import io.netty.bootstrap.Bootstrap; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.channel.Channel; -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelFutureListener; -import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.ChannelInboundHandlerAdapter; - -/** - * Handle data from client. - * - */ -public class HttpProxyClientHandler extends ChannelInboundHandlerAdapter { - private final Logger logger = LoggerFactory.getLogger(HttpProxyClientHandler.class); - private final String id; - private Channel clientChannel; - private Channel remoteChannel; - private HttpProxyClientHeader header ; - public HttpProxyClientHandler(String id) { - this.id = id; - header = new HttpProxyClientHeader(); - } - - @Override - public void channelActive(ChannelHandlerContext ctx) { - clientChannel = ctx.channel(); - } - - @Override - public void channelRead(ChannelHandlerContext ctx, Object msg) { - if (header.isComplete()) { - remoteChannel.writeAndFlush(msg); // just forward - return; - } - - ByteBuf in = (ByteBuf) msg; - header.digest(in); - - if (!header.isComplete()) { - in.release(); - return; - } - - logger.info(id + " {}", header); - clientChannel.config().setAutoRead(false); // disable AutoRead until remote connection is ready - - if (header.isHttps()) { // if https, respond 200 to create tunnel - clientChannel.writeAndFlush(Unpooled.wrappedBuffer("HTTP/1.1 200 Connection Established\r\n\r\n".getBytes())); - } - - Bootstrap b = new Bootstrap(); - b.group(clientChannel.eventLoop()) // use the same EventLoop - .channel(clientChannel.getClass()) - .handler(new HttpProxyRemoteHandler(id, clientChannel)); - ChannelFuture f = b.connect(header.getHost(), header.getPort()); - remoteChannel = f.channel(); - - f.addListener((ChannelFutureListener) future -> { - if (future.isSuccess()) { - clientChannel.config().setAutoRead(true); // connection is ready, enable AutoRead - if (!header.isHttps()) { // forward header and remaining bytes - remoteChannel.write(header.getByteBuf()); - } - - remoteChannel.writeAndFlush(in); - } else { - in.release(); - clientChannel.close(); - } - }); - } - - @Override - public void channelInactive(ChannelHandlerContext ctx) { - flushAndClose(remoteChannel); - } - - @Override - public void exceptionCaught(ChannelHandlerContext ctx, Throwable e) { - logger.error(id + " error occured", e); - flushAndClose(clientChannel); - } - - private void flushAndClose(Channel ch) { - if (ch != null && ch.isActive()) { - ch.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE); - } - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyClientHeader.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyClientHeader.java deleted file mode 100644 index 287f54151c8d..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyClientHeader.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.proxy; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; - -/** - * The http header of client. - * - */ -public class HttpProxyClientHeader { - private String method; - private String host; - private int port; - private boolean https; - private boolean complete; - private ByteBuf byteBuf = Unpooled.buffer(); - - private final StringBuilder lineBuf = new StringBuilder(); - - public boolean isComplete() { - return complete; - } - - public String getMethod() { - return method; - } - - public void setMethod(String method) { - this.method = method; - } - - public String getHost() { - return host; - } - - public void setHost(String host) { - this.host = host; - } - - public int getPort() { - return port; - } - - public void setPort(int port) { - this.port = port; - } - - public boolean isHttps() { - return https; - } - - public void setHttps(boolean https) { - this.https = https; - } - - public ByteBuf getByteBuf() { - return byteBuf; - } - - public void setByteBuf(ByteBuf byteBuf) { - this.byteBuf = byteBuf; - } - - public StringBuilder getLineBuf() { - return lineBuf; - } - - public void setComplete(boolean complete) { - this.complete = complete; - } - - public void digest(ByteBuf in) { - while (in.isReadable()) { - if (complete) { - throw new IllegalStateException("already complete"); - } - - String line = readLine(in); - if (line == null) { - return; - } - - if (method == null) { - method = line.split(" ")[0]; // the first word is http method name - https = method.equalsIgnoreCase("CONNECT"); // method CONNECT means https - } - - if (line.startsWith("Host: ") || line.startsWith("host: ")) { - String[] arr = line.split(":"); - host = arr[1].trim(); - if (arr.length == 3) { - port = Integer.parseInt(arr[2]); - } else if (https) { - port = 443; // https - } else { - port = 80; // http - } - } - - if (line.isEmpty()) { - if (host == null || port == 0) { - throw new IllegalStateException("cannot find header \'Host\'"); - } - - byteBuf = byteBuf.asReadOnly(); - complete = true; - break; - } - } - } - - private String readLine(ByteBuf in) { - while (in.isReadable()) { - byte b = in.readByte(); - byteBuf.writeByte(b); - lineBuf.append((char) b); - int len = lineBuf.length(); - if (len >= 2 && lineBuf.substring(len - 2).equals("\r\n")) { - String line = lineBuf.substring(0, len - 2); - lineBuf.delete(0, len); - return line; - } - - } - return null; - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyRemoteHandler.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyRemoteHandler.java deleted file mode 100644 index cf72b251d5fb..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyRemoteHandler.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.proxy; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import io.netty.buffer.Unpooled; -import io.netty.channel.Channel; -import io.netty.channel.ChannelFutureListener; -import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.ChannelInboundHandlerAdapter; - -/** - * Handle data from remote. - * - */ -public class HttpProxyRemoteHandler extends ChannelInboundHandlerAdapter { - private final Logger logger = LoggerFactory.getLogger(HttpProxyRemoteHandler.class); - private final String id; - private Channel clientChannel; - private Channel remoteChannel; - - public HttpProxyRemoteHandler(String id, Channel clientChannel) { - this.id = id; - this.clientChannel = clientChannel; - } - - @Override - public void channelActive(ChannelHandlerContext ctx) { - this.remoteChannel = ctx.channel(); - } - - @Override - public void channelRead(ChannelHandlerContext ctx, Object msg) { - clientChannel.writeAndFlush(msg); // just forward - } - - @Override - public void channelInactive(ChannelHandlerContext ctx) { - flushAndClose(clientChannel); - } - - @Override - public void exceptionCaught(ChannelHandlerContext ctx, Throwable e) { - logger.error(id + " error occured", e); - flushAndClose(remoteChannel); - } - - private void flushAndClose(Channel ch) { - if (ch != null && ch.isActive()) { - ch.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE); - } - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyServer.java b/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyServer.java deleted file mode 100644 index 49d49a86db5a..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/java/com/microsoft/azure/cosmosdb/rx/proxy/HttpProxyServer.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * The MIT License (MIT) - * Copyright (c) 2018 Microsoft Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.microsoft.azure.cosmosdb.rx.proxy; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import io.netty.bootstrap.ServerBootstrap; -import io.netty.channel.EventLoopGroup; -import io.netty.channel.nio.NioEventLoopGroup; -import io.netty.channel.socket.nio.NioServerSocketChannel; - -/** - * A http proxy server. - * - */ -public class HttpProxyServer { - private final Logger logger = LoggerFactory.getLogger(HttpProxyServer.class); - private HttpProxyChannelInitializer httpProxyChannelInitializer; - private int port = 8080; - EventLoopGroup bossGroup; - EventLoopGroup workerGroup; - public HttpProxyServer() { - bossGroup = new NioEventLoopGroup(1); - workerGroup = new NioEventLoopGroup(); - } - - public void start() { - new Thread(() -> { - logger.info("HttpProxyServer started on port: {}", port); - httpProxyChannelInitializer = new HttpProxyChannelInitializer(); - try { - ServerBootstrap bootstrap = new ServerBootstrap(); - bootstrap.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class) - .childHandler(httpProxyChannelInitializer) - .bind(port).sync().channel().closeFuture().sync(); - } catch (InterruptedException e) { - logger.error("Error occurred", e); - } - }).start(); - } - - public void shutDown() { - if(!workerGroup.isShutdown()) { - workerGroup.shutdownGracefully(); - } - - if(!bossGroup.isShutdown()) { - bossGroup.shutdownGracefully(); - } - } -} diff --git a/cosmosdb/data-plane/sdk/src/test/resources/Microsoft.jpg b/cosmosdb/data-plane/sdk/src/test/resources/Microsoft.jpg deleted file mode 100644 index cf6c76bba498..000000000000 Binary files a/cosmosdb/data-plane/sdk/src/test/resources/Microsoft.jpg and /dev/null differ diff --git a/cosmosdb/data-plane/sdk/src/test/resources/cosmosdb-1.png b/cosmosdb/data-plane/sdk/src/test/resources/cosmosdb-1.png deleted file mode 100644 index 60d23806107c..000000000000 Binary files a/cosmosdb/data-plane/sdk/src/test/resources/cosmosdb-1.png and /dev/null differ diff --git a/cosmosdb/data-plane/sdk/src/test/resources/databaseAccount.json b/cosmosdb/data-plane/sdk/src/test/resources/databaseAccount.json deleted file mode 100644 index b514a0dda813..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/resources/databaseAccount.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "_self": "", - "id": "localhost", - "_rid": "localhost", - "media": "//media/", - "addresses": "//addresses/", - "_dbs": "//dbs/", - "writableLocations": [ - { - "name": "South Central US", - "databaseAccountEndpoint": "https://127.0.0.1:8081/" - } - ], - "readableLocations": [ - { - "name": "South Central US", - "databaseAccountEndpoint": "https://127.0.0.1:8081/" - } - ], - "enableMultipleWriteLocations": false, - "userReplicationPolicy": { - "asyncReplication": false, - "minReplicaSetSize": 1, - "maxReplicasetSize": 4 - }, - "userConsistencyPolicy": { - "defaultConsistencyLevel": "Session" - }, - "systemReplicationPolicy": { - "minReplicaSetSize": 1, - "maxReplicasetSize": 4 - }, - "readPolicy": { - "primaryReadCoefficient": 1, - "secondaryReadCoefficient": 1 - }, - "queryEngineConfiguration": "{\"maxSqlQueryInputLength\":262144,\"maxJoinsPerSqlQuery\":5,\"maxLogicalAndPerSqlQuery\":500,\"maxLogicalOrPerSqlQuery\":500,\"maxUdfRefPerSqlQuery\":10,\"maxInExpressionItemsCount\":16000,\"queryMaxInMemorySortDocumentCount\":500,\"maxQueryRequestTimeoutFraction\":0.9,\"sqlAllowNonFiniteNumbers\":false,\"sqlAllowAggregateFunctions\":true,\"sqlAllowSubQuery\":true,\"sqlAllowScalarSubQuery\":true,\"allowNewKeywords\":true,\"sqlAllowLike\":false,\"maxSpatialQueryCells\":12,\"spatialMaxGeometryPointCount\":256,\"sqlAllowTop\":true,\"enableSpatialIndexing\":true}" -} \ No newline at end of file diff --git a/cosmosdb/data-plane/sdk/src/test/resources/emulator-testng.xml b/cosmosdb/data-plane/sdk/src/test/resources/emulator-testng.xml deleted file mode 100644 index 8af636bea2f5..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/resources/emulator-testng.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - diff --git a/cosmosdb/data-plane/sdk/src/test/resources/fast-testng.xml b/cosmosdb/data-plane/sdk/src/test/resources/fast-testng.xml deleted file mode 100644 index b4d5f30b252a..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/resources/fast-testng.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - diff --git a/cosmosdb/data-plane/sdk/src/test/resources/log4j.properties b/cosmosdb/data-plane/sdk/src/test/resources/log4j.properties deleted file mode 100644 index 1f3287c67a55..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/resources/log4j.properties +++ /dev/null @@ -1,15 +0,0 @@ -# this is the log4j configuration for tests - -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=INFO, A1 - -# Set HTTP components' logger to INFO - -log4j.category.io.netty=INFO -log4j.category.io.reactivex=INFO -# A1 is set to be a ConsoleAppender. -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%d %5X{pid} [%t] %-5p %c - %m%n diff --git a/cosmosdb/data-plane/sdk/src/test/resources/long-testng.xml b/cosmosdb/data-plane/sdk/src/test/resources/long-testng.xml deleted file mode 100644 index e96812dfbe41..000000000000 --- a/cosmosdb/data-plane/sdk/src/test/resources/long-testng.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - diff --git a/cosmosdb/resource-manager/v2015_04_08/pom.xml b/cosmosdb/resource-manager/v2015_04_08/pom.xml index 23412bcaf098..d4f42ec63e86 100644 --- a/cosmosdb/resource-manager/v2015_04_08/pom.xml +++ b/cosmosdb/resource-manager/v2015_04_08/pom.xml @@ -15,7 +15,7 @@ ../../../pom.management.xml azure-mgmt-cosmosdb - 1.0.0-beta-2 + 1.0.0-beta-3 jar Microsoft Azure SDK for CosmosDB Management This package contains Microsoft CosmosDB Management SDK. @@ -71,6 +71,8 @@ azure-arm-client-runtime test-jar test + + 1.6.5 diff --git a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/ConnectorOffer.java b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/ConnectorOffer.java new file mode 100644 index 000000000000..0c7b491f046e --- /dev/null +++ b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/ConnectorOffer.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2015_04_08; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ConnectorOffer. + */ +public final class ConnectorOffer extends ExpandableStringEnum { + /** Static value Small for ConnectorOffer. */ + public static final ConnectorOffer SMALL = fromString("Small"); + + /** + * Creates or finds a ConnectorOffer from its string representation. + * @param name a name to look for + * @return the corresponding ConnectorOffer + */ + @JsonCreator + public static ConnectorOffer fromString(String name) { + return fromString(name, ConnectorOffer.class); + } + + /** + * @return known ConnectorOffer values + */ + public static Collection values() { + return values(ConnectorOffer.class); + } +} diff --git a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/DatabaseAccount.java b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/DatabaseAccount.java index be9c08fbd3bb..b344cb239bad 100644 --- a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/DatabaseAccount.java +++ b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/DatabaseAccount.java @@ -30,6 +30,11 @@ public interface DatabaseAccount extends HasInner, Resourc */ List capabilities(); + /** + * @return the connectorOffer value. + */ + ConnectorOffer connectorOffer(); + /** * @return the consistencyPolicy value. */ @@ -50,6 +55,11 @@ public interface DatabaseAccount extends HasInner, Resourc */ Boolean enableAutomaticFailover(); + /** + * @return the enableCassandraConnector value. + */ + Boolean enableCassandraConnector(); + /** * @return the enableMultipleWriteLocations value. */ @@ -153,6 +163,18 @@ interface WithCapabilities { WithCreate withCapabilities(List capabilities); } + /** + * The stage of the databaseaccount definition allowing to specify ConnectorOffer. + */ + interface WithConnectorOffer { + /** + * Specifies connectorOffer. + * @param connectorOffer The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small' + * @return the next definition stage + */ + WithCreate withConnectorOffer(ConnectorOffer connectorOffer); + } + /** * The stage of the databaseaccount definition allowing to specify ConsistencyPolicy. */ @@ -177,6 +199,18 @@ interface WithEnableAutomaticFailover { WithCreate withEnableAutomaticFailover(Boolean enableAutomaticFailover); } + /** + * The stage of the databaseaccount definition allowing to specify EnableCassandraConnector. + */ + interface WithEnableCassandraConnector { + /** + * Specifies enableCassandraConnector. + * @param enableCassandraConnector Enables the cassandra connector on the Cosmos DB C* account + * @return the next definition stage + */ + WithCreate withEnableCassandraConnector(Boolean enableCassandraConnector); + } + /** * The stage of the databaseaccount definition allowing to specify EnableMultipleWriteLocations. */ @@ -242,7 +276,7 @@ interface WithVirtualNetworkRules { * the resource to be created (via {@link WithCreate#create()}), but also allows * for any other optional settings to be specified. */ - interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithCapabilities, DefinitionStages.WithConsistencyPolicy, DefinitionStages.WithEnableAutomaticFailover, DefinitionStages.WithEnableMultipleWriteLocations, DefinitionStages.WithIpRangeFilter, DefinitionStages.WithIsVirtualNetworkFilterEnabled, DefinitionStages.WithKind, DefinitionStages.WithVirtualNetworkRules { + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithCapabilities, DefinitionStages.WithConnectorOffer, DefinitionStages.WithConsistencyPolicy, DefinitionStages.WithEnableAutomaticFailover, DefinitionStages.WithEnableCassandraConnector, DefinitionStages.WithEnableMultipleWriteLocations, DefinitionStages.WithIpRangeFilter, DefinitionStages.WithIsVirtualNetworkFilterEnabled, DefinitionStages.WithKind, DefinitionStages.WithVirtualNetworkRules { } } /** diff --git a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/DatabaseAccountCreateUpdateParameters.java b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/DatabaseAccountCreateUpdateParameters.java index 57403672cffa..7240cfbf570b 100644 --- a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/DatabaseAccountCreateUpdateParameters.java +++ b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/DatabaseAccountCreateUpdateParameters.java @@ -89,6 +89,19 @@ public class DatabaseAccountCreateUpdateParameters extends Resource { @JsonProperty(value = "properties.enableMultipleWriteLocations") private Boolean enableMultipleWriteLocations; + /** + * Enables the cassandra connector on the Cosmos DB C* account. + */ + @JsonProperty(value = "properties.enableCassandraConnector") + private Boolean enableCassandraConnector; + + /** + * The cassandra connector offer type for the Cosmos DB database C* + * account. Possible values include: 'Small'. + */ + @JsonProperty(value = "properties.connectorOffer") + private ConnectorOffer connectorOffer; + /** * Creates an instance of DatabaseAccountCreateUpdateParameters class. * @param locations an array that contains the georeplication locations enabled for the Cosmos DB account. @@ -297,4 +310,44 @@ public DatabaseAccountCreateUpdateParameters withEnableMultipleWriteLocations(Bo return this; } + /** + * Get enables the cassandra connector on the Cosmos DB C* account. + * + * @return the enableCassandraConnector value + */ + public Boolean enableCassandraConnector() { + return this.enableCassandraConnector; + } + + /** + * Set enables the cassandra connector on the Cosmos DB C* account. + * + * @param enableCassandraConnector the enableCassandraConnector value to set + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withEnableCassandraConnector(Boolean enableCassandraConnector) { + this.enableCassandraConnector = enableCassandraConnector; + return this; + } + + /** + * Get the cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small'. + * + * @return the connectorOffer value + */ + public ConnectorOffer connectorOffer() { + return this.connectorOffer; + } + + /** + * Set the cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small'. + * + * @param connectorOffer the connectorOffer value to set + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withConnectorOffer(ConnectorOffer connectorOffer) { + this.connectorOffer = connectorOffer; + return this; + } + } diff --git a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountImpl.java b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountImpl.java index e5a46bd84c6e..6dc8f71cb170 100644 --- a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountImpl.java +++ b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountImpl.java @@ -15,6 +15,7 @@ import java.util.List; import com.microsoft.azure.management.cosmosdb.v2015_04_08.DatabaseAccountCreateUpdateParameters; import com.microsoft.azure.management.cosmosdb.v2015_04_08.Capability; +import com.microsoft.azure.management.cosmosdb.v2015_04_08.ConnectorOffer; import com.microsoft.azure.management.cosmosdb.v2015_04_08.ConsistencyPolicy; import com.microsoft.azure.management.cosmosdb.v2015_04_08.DatabaseAccountOfferType; import com.microsoft.azure.management.cosmosdb.v2015_04_08.FailoverPolicy; @@ -83,6 +84,11 @@ public List capabilities() { return this.inner().capabilities(); } + @Override + public ConnectorOffer connectorOffer() { + return this.inner().connectorOffer(); + } + @Override public ConsistencyPolicy consistencyPolicy() { return this.inner().consistencyPolicy(); @@ -103,6 +109,11 @@ public Boolean enableAutomaticFailover() { return this.inner().enableAutomaticFailover(); } + @Override + public Boolean enableCassandraConnector() { + return this.inner().enableCassandraConnector(); + } + @Override public Boolean enableMultipleWriteLocations() { return this.inner().enableMultipleWriteLocations(); @@ -160,6 +171,12 @@ public DatabaseAccountImpl withLocations(List locations) { return this; } + @Override + public DatabaseAccountImpl withConnectorOffer(ConnectorOffer connectorOffer) { + this.createParameter.withConnectorOffer(connectorOffer); + return this; + } + @Override public DatabaseAccountImpl withConsistencyPolicy(ConsistencyPolicy consistencyPolicy) { this.createParameter.withConsistencyPolicy(consistencyPolicy); @@ -172,6 +189,12 @@ public DatabaseAccountImpl withEnableAutomaticFailover(Boolean enableAutomaticFa return this; } + @Override + public DatabaseAccountImpl withEnableCassandraConnector(Boolean enableCassandraConnector) { + this.createParameter.withEnableCassandraConnector(enableCassandraConnector); + return this; + } + @Override public DatabaseAccountImpl withEnableMultipleWriteLocations(Boolean enableMultipleWriteLocations) { this.createParameter.withEnableMultipleWriteLocations(enableMultipleWriteLocations); diff --git a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountInner.java b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountInner.java index ea984513227a..f7924f4c005c 100644 --- a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountInner.java +++ b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountInner.java @@ -16,6 +16,7 @@ import com.microsoft.azure.management.cosmosdb.v2015_04_08.Location; import com.microsoft.azure.management.cosmosdb.v2015_04_08.FailoverPolicy; import com.microsoft.azure.management.cosmosdb.v2015_04_08.VirtualNetworkRule; +import com.microsoft.azure.management.cosmosdb.v2015_04_08.ConnectorOffer; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.rest.SkipParentValidation; @@ -121,6 +122,19 @@ public class DatabaseAccountInner extends Resource { @JsonProperty(value = "properties.enableMultipleWriteLocations") private Boolean enableMultipleWriteLocations; + /** + * Enables the cassandra connector on the Cosmos DB C* account. + */ + @JsonProperty(value = "properties.enableCassandraConnector") + private Boolean enableCassandraConnector; + + /** + * The cassandra connector offer type for the Cosmos DB database C* + * account. Possible values include: 'Small'. + */ + @JsonProperty(value = "properties.connectorOffer") + private ConnectorOffer connectorOffer; + /** * Get indicates the type of database account. This can only be set at database account creation. Possible values include: 'GlobalDocumentDB', 'MongoDB', 'Parse'. * @@ -346,4 +360,44 @@ public DatabaseAccountInner withEnableMultipleWriteLocations(Boolean enableMulti return this; } + /** + * Get enables the cassandra connector on the Cosmos DB C* account. + * + * @return the enableCassandraConnector value + */ + public Boolean enableCassandraConnector() { + return this.enableCassandraConnector; + } + + /** + * Set enables the cassandra connector on the Cosmos DB C* account. + * + * @param enableCassandraConnector the enableCassandraConnector value to set + * @return the DatabaseAccountInner object itself. + */ + public DatabaseAccountInner withEnableCassandraConnector(Boolean enableCassandraConnector) { + this.enableCassandraConnector = enableCassandraConnector; + return this; + } + + /** + * Get the cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small'. + * + * @return the connectorOffer value + */ + public ConnectorOffer connectorOffer() { + return this.connectorOffer; + } + + /** + * Set the cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small'. + * + * @param connectorOffer the connectorOffer value to set + * @return the DatabaseAccountInner object itself. + */ + public DatabaseAccountInner withConnectorOffer(ConnectorOffer connectorOffer) { + this.connectorOffer = connectorOffer; + return this; + } + } diff --git a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountListKeysResultInner.java b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountListKeysResultInner.java index 8cbe227be29c..463e70c4e4b1 100644 --- a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountListKeysResultInner.java +++ b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountListKeysResultInner.java @@ -9,13 +9,11 @@ package com.microsoft.azure.management.cosmosdb.v2015_04_08.implementation; import com.fasterxml.jackson.annotation.JsonProperty; -import com.microsoft.rest.serializer.JsonFlatten; /** * The access keys for the given database account. */ -@JsonFlatten -public class DatabaseAccountListKeysResultInner { +public class DatabaseAccountListKeysResultInner extends DatabaseAccountListReadOnlyKeysResultInner { /** * Base 64 encoded value of the primary read-write key. */ @@ -28,18 +26,6 @@ public class DatabaseAccountListKeysResultInner { @JsonProperty(value = "secondaryMasterKey", access = JsonProperty.Access.WRITE_ONLY) private String secondaryMasterKey; - /** - * Base 64 encoded value of the primary read-only key. - */ - @JsonProperty(value = "properties.primaryReadonlyMasterKey", access = JsonProperty.Access.WRITE_ONLY) - private String primaryReadonlyMasterKey; - - /** - * Base 64 encoded value of the secondary read-only key. - */ - @JsonProperty(value = "properties.secondaryReadonlyMasterKey", access = JsonProperty.Access.WRITE_ONLY) - private String secondaryReadonlyMasterKey; - /** * Get base 64 encoded value of the primary read-write key. * @@ -58,22 +44,4 @@ public String secondaryMasterKey() { return this.secondaryMasterKey; } - /** - * Get base 64 encoded value of the primary read-only key. - * - * @return the primaryReadonlyMasterKey value - */ - public String primaryReadonlyMasterKey() { - return this.primaryReadonlyMasterKey; - } - - /** - * Get base 64 encoded value of the secondary read-only key. - * - * @return the secondaryReadonlyMasterKey value - */ - public String secondaryReadonlyMasterKey() { - return this.secondaryReadonlyMasterKey; - } - } diff --git a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsImpl.java b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsImpl.java index f9f5a9d9338d..1a7827c3b95c 100644 --- a/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsImpl.java +++ b/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsImpl.java @@ -759,10 +759,14 @@ public Throughput call(ThroughputInner inner) { public Observable getSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { DatabaseAccountsInner client = this.inner(); return client.getSqlContainerAsync(resourceGroupName, accountName, databaseName, containerName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public SqlContainer call(SqlContainerInner inner) { - return wrapSqlContainerModel(inner); + public Observable call(SqlContainerInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((SqlContainer)wrapSqlContainerModel(inner)); + } } }); } @@ -795,10 +799,14 @@ public Completable deleteSqlContainerAsync(String resourceGroupName, String acco public Observable getMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { DatabaseAccountsInner client = this.inner(); return client.getMongoDBCollectionAsync(resourceGroupName, accountName, databaseName, collectionName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public MongoDBCollection call(MongoDBCollectionInner inner) { - return wrapMongoDBCollectionModel(inner); + public Observable call(MongoDBCollectionInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((MongoDBCollection)wrapMongoDBCollectionModel(inner)); + } } }); } @@ -951,10 +959,14 @@ public Completable deleteCassandraKeyspaceAsync(String resourceGroupName, String public Observable getGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { DatabaseAccountsInner client = this.inner(); return client.getGremlinGraphAsync(resourceGroupName, accountName, databaseName, graphName) - .map(new Func1() { - @Override - public GremlinGraph call(GremlinGraphInner inner) { - return wrapGremlinGraphModel(inner); + .flatMap(new Func1>() { + @Override + public Observable call(GremlinGraphInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((GremlinGraph)wrapGremlinGraphModel(inner)); + } } }); } diff --git a/eng/.docsettings.yml b/eng/.docsettings.yml index 3ae4c9aa409d..4fb91b2a5c7e 100644 --- a/eng/.docsettings.yml +++ b/eng/.docsettings.yml @@ -75,6 +75,9 @@ known_content_issues: - ['sdk/cosmos/changelog/README.md', '#3113'] - ['sdk/cosmos/microsoft-azure-cosmos-benchmark/README.md', '#3113'] - ['sdk/cosmos/README.md', '#3113'] + - ['sdk/storage/azure-storage-blob/swagger/README.md', '#3113'] + - ['sdk/storage/azure-storage-queue/swagger/README.md', '#3113'] + - ['sdk/storage/azure-storage-file/swagger/README.md', '#3113'] package_indexing_exclusion_list: - azure-loganalytics-sample - azure-applicationinsights-query-sample diff --git a/eng/code-quality-reports/pom.xml b/eng/code-quality-reports/pom.xml index d3f7756700b8..6d78b0930566 100755 --- a/eng/code-quality-reports/pom.xml +++ b/eng/code-quality-reports/pom.xml @@ -21,7 +21,7 @@ 1.8 1.8 - 8.18 + 8.24 4.12 diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/EnforceFinalFieldsCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/EnforceFinalFieldsCheck.java new file mode 100644 index 000000000000..34b71ddc486c --- /dev/null +++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/EnforceFinalFieldsCheck.java @@ -0,0 +1,250 @@ +// 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 com.puppycrawl.tools.checkstyle.utils.TokenUtil; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * Verify the whenever a field is assigned just once in constructor to be final + * Tree traversal will pre-compute and fill 3 private containers: + * nonFinalFields: keep an array of non private fields as tokens (to keep line number) + * assignmentsFromConstructor: Save a set of string for each field name that gets its value assigned in constructor + * assignmentsFromMethods: Save a set of strings for each field name that gets updated in any method + * + * On finish tree, check what non-final fields get a value only in constructor and nowhere else by looking for + * strings inside nonFinalFields AND assignmentsFromConstructor but NOT in assignmentsFromMethods + */ +public class EnforceFinalFieldsCheck extends AbstractCheck { + private static final String ERROR_SUGGESTION = "You should consider making the field final, " + + "or suppressing the warning."; + private static final String ERROR_MSG = "Field \"%s\" is only assigned in constructor and it is not final. " + + ERROR_SUGGESTION; + private static final String ERROR_FIELD_ALONE = "Field \"%s\" is not assigned in constructor or methods." + + ERROR_SUGGESTION; + + private List nonFinalFields; + private Set assignmentsFromConstructor; + private Set assignmentsFromMethods; + private DetailAST scopeParent = null; + private Set currentScopeParameterSet = null; + private String currentClassName = null; + + @Override + public int[] getDefaultTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getAcceptableTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getRequiredTokens() { + return new int[] { + TokenTypes.CLASS_DEF, + TokenTypes.ASSIGN, + TokenTypes.PLUS_ASSIGN, + TokenTypes.BAND_ASSIGN, + TokenTypes.BOR_ASSIGN, + TokenTypes.BSR_ASSIGN, + TokenTypes.BXOR_ASSIGN, + TokenTypes.DIV_ASSIGN, + TokenTypes.MINUS_ASSIGN, + TokenTypes.MOD_ASSIGN, + TokenTypes.SL_ASSIGN, + TokenTypes.SR_ASSIGN, + TokenTypes.STAR_ASSIGN, + TokenTypes.INC, + TokenTypes.POST_INC, + TokenTypes.DEC, + TokenTypes.POST_DEC, + TokenTypes.METHOD_DEF, + TokenTypes.CTOR_DEF, + }; + } + + @Override + public void beginTree(DetailAST root) { + nonFinalFields = new ArrayList<>(); + assignmentsFromConstructor = new HashSet<>(); + assignmentsFromMethods = new HashSet<>(); + } + + @Override + public void visitToken(DetailAST token) { + switch (token.getType()) { + case TokenTypes.CLASS_DEF: + this.currentClassName = token.findFirstToken(TokenTypes.IDENT).getText(); + fillClassFieldDefinitions(token); + break; + case TokenTypes.ASSIGN: + case TokenTypes.PLUS_ASSIGN: + case TokenTypes.BAND_ASSIGN: + case TokenTypes.BOR_ASSIGN: + case TokenTypes.BSR_ASSIGN: + case TokenTypes.BXOR_ASSIGN: + case TokenTypes.DIV_ASSIGN: + case TokenTypes.MINUS_ASSIGN: + case TokenTypes.MOD_ASSIGN: + case TokenTypes.SL_ASSIGN: + case TokenTypes.SR_ASSIGN: + case TokenTypes.STAR_ASSIGN: + case TokenTypes.INC: + case TokenTypes.POST_INC: + case TokenTypes.DEC: + case TokenTypes.POST_DEC: + checkAssignation(token); + break; + case TokenTypes.METHOD_DEF: + case TokenTypes.CTOR_DEF: + scopeParent = token; + break; + default: + // Checkstyle complains if there's no default block in switch + break; + } + } + + @Override + public void leaveToken(DetailAST token) { + switch (token.getType()) { + case TokenTypes.METHOD_DEF: + case TokenTypes.CTOR_DEF: + scopeParent = null; + currentScopeParameterSet = null; + break; + default: + break; + } + } + + @Override + public void finishTree(DetailAST token) { + for (DetailAST field : nonFinalFields) { + final String fieldName = field.findFirstToken(TokenTypes.IDENT).getText(); + if (assignmentsFromConstructor.contains(fieldName) && !assignmentsFromMethods.contains(fieldName)) { + log(field, String.format(ERROR_MSG, fieldName)); + } else if (field.branchContains(TokenTypes.ASSIGN) + && !assignmentsFromConstructor.contains(fieldName) + && !assignmentsFromMethods.contains(fieldName)) { + log(field, String.format(ERROR_FIELD_ALONE, fieldName)); + } + } + } + + /* + * Get the field token from an assignation token. + * This method handles cases for fields referenced as `this.field` or only `field` + * It will get parameters from the method definition to ignore assignations to those parameters + */ + private DetailAST getAssignedField(final DetailAST assignationToken) { + final Set scopeParentParameterSet = getParameterSet(scopeParent.findFirstToken( + TokenTypes.PARAMETERS)); + final DetailAST firstChild = assignationToken.getFirstChild(); + final DetailAST assignationWithDot = firstChild.getType() == TokenTypes.DOT ? firstChild : null; + + if (assignationWithDot != null) { + if (assignationWithDot.branchContains(TokenTypes.LITERAL_THIS)) { + return assignationWithDot.findFirstToken(TokenTypes.IDENT); + } else if (TokenUtil.findFirstTokenByPredicate(assignationWithDot, + token -> token.getText().equals(this.currentClassName)).isPresent()) { + // Case when referencing same class for private static fields + return assignationWithDot.getLastChild(); + } + } else { + final DetailAST variableNameToken = assignationToken.getFirstChild(); + // make sure the assignation is not for a method parameter + if (!scopeParentParameterSet.contains(variableNameToken.getText())) { + return variableNameToken; + } + } + + return null; + } + + /* + * Saves a field name to a container depending on the provided type + */ + private void saveField(final String fieldName, final int scopeParentType) { + if (scopeParentType == TokenTypes.METHOD_DEF) { + assignmentsFromMethods.add(fieldName); + } else if (scopeParentType == TokenTypes.CTOR_DEF) { + assignmentsFromConstructor.add(fieldName); + } + } + + /* + * Review an assignation to save fields that gets assigned in constructor or in any method + * + * @param assignationToken an assignation token + */ + private void checkAssignation(final DetailAST assignationToken) { + if (scopeParent == null || assignationToken.getChildCount() == 0) { + // not inside any method or constructor definition. No need to check anything + // or this is an assignation from a notation like @Test(timeout = 5000) where assignation has not ChildCount + return; + } + + final DetailAST assignationParent = assignationToken.getParent(); + if (assignationParent != null && TokenTypes.VARIABLE_DEF == assignationParent.getType()) { + // Assignation for a variable definition. No need to check this assignation + return; + } + + DetailAST fieldToken = getAssignedField(assignationToken); + + if (fieldToken != null) { + saveField(fieldToken.getText(), scopeParent.getType()); + } + } + + + /* + * Check each non-final field definition from a class and fill nonFinalFields + * + * @param classDefinitionAST a class definition AST + */ + private void fillClassFieldDefinitions(DetailAST classDefinitionAST) { + final DetailAST classObjBlockAst = classDefinitionAST.findFirstToken(TokenTypes.OBJBLOCK); + + TokenUtil.forEachChild(classObjBlockAst, TokenTypes.VARIABLE_DEF, (definitionToken) -> { + final DetailAST variableModifiersAst = definitionToken.findFirstToken(TokenTypes.MODIFIERS); + if (!variableModifiersAst.branchContains(TokenTypes.FINAL) + && !Utils.hasIllegalCombination(variableModifiersAst)) { + nonFinalFields.add(definitionToken); + } + }); + } + + /* + * Get a node AST with parameters definition and return the list of all parameter names + * The set of parameters is created the first time an assignation is check within a method or constructor + * and we don't need to generate it again until visiting a different method or constructor. + * Field `currentScopeParameterSet` ensures we don't create the set multiple times for the same method/constructor + * + * @param parametersAST a TokenTypes.PARAMETERS + * @return a set of parameter names + */ + private Set getParameterSet(DetailAST parametersAST) { + if (currentScopeParameterSet != null) { + return currentScopeParameterSet; + } + currentScopeParameterSet = new HashSet<>(); + TokenUtil.forEachChild(parametersAST, TokenTypes.PARAMETER_DEF, (paramDefToken) -> { + final String parameterName = paramDefToken.findFirstToken(TokenTypes.IDENT).getText(); + currentScopeParameterSet.add(parameterName); + }); + + return currentScopeParameterSet; + } +} diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ExternalDependencyExposedCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ExternalDependencyExposedCheck.java index 44522a4e8597..c7120c683069 100644 --- a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ExternalDependencyExposedCheck.java +++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ExternalDependencyExposedCheck.java @@ -21,9 +21,10 @@ * No external dependency exposed in public API */ public class ExternalDependencyExposedCheck extends AbstractCheck { - private static final String EXTERNAL_DEPENDENCY_ERROR = "Class ''%s'', is a class from external dependency. You should not use it as a %s type."; + private static final String EXTERNAL_DEPENDENCY_ERROR = + "Class ''%s'', is a class from external dependency. You should not use it as a %s type."; private static final Set VALID_DEPENDENCY_SET = Collections.unmodifiableSet(new HashSet<>(Arrays.asList( - "java", "com.azure", "reactor", "io.netty.buffer.ByteBuf" + "java", "com.azure", "reactor" ))); private final Map simpleClassNameToQualifiedNameMap = new HashMap<>(); @@ -58,7 +59,8 @@ public int[] getRequiredTokens() { public void visitToken(DetailAST token) { switch (token.getType()) { case TokenTypes.IMPORT: - // Add all imported classes into a map, key is the name of class and value is the full package path of class. + // Add all imported classes into a map, key is the name of class and value is the full package + // path of class. final String importClassPath = FullIdent.createFullIdentBelow(token).getText(); final String className = importClassPath.substring(importClassPath.lastIndexOf(".") + 1); simpleClassNameToQualifiedNameMap.put(className, importClassPath); @@ -67,7 +69,8 @@ public void visitToken(DetailAST token) { // CLASS_DEF always has MODIFIERS final AccessModifier accessModifier = CheckUtil.getAccessModifierFromModifiersToken( token.findFirstToken(TokenTypes.MODIFIERS)); - isPublicClass = accessModifier.equals(AccessModifier.PUBLIC) || accessModifier.equals(AccessModifier.PROTECTED); + isPublicClass = + accessModifier.equals(AccessModifier.PUBLIC) || accessModifier.equals(AccessModifier.PROTECTED); break; case TokenTypes.METHOD_DEF: if (!isPublicClass) { @@ -100,14 +103,18 @@ private void checkNoExternalDependencyExposed(DetailAST methodDefToken) { final DetailAST typeToken = methodDefToken.findFirstToken(TokenTypes.TYPE); if (typeToken != null) { getInvalidReturnTypes(typeToken).forEach( - (token, returnTypeName) -> log(token, String.format(EXTERNAL_DEPENDENCY_ERROR, returnTypeName, "return"))); + (token, returnTypeName) -> log( + token, + String.format(EXTERNAL_DEPENDENCY_ERROR, returnTypeName, "return"))); } // Checks for the parameters of the method final DetailAST parametersToken = methodDefToken.findFirstToken(TokenTypes.PARAMETERS); if (parametersToken != null) { getInvalidParameterTypes(parametersToken).forEach( - (token, parameterTypeName) -> log(token, String.format(EXTERNAL_DEPENDENCY_ERROR, parameterTypeName, "method argument"))); + (token, parameterTypeName) -> log( + token, + String.format(EXTERNAL_DEPENDENCY_ERROR, parameterTypeName, "method argument"))); } } diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/FluentMethodNameCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/FluentMethodNameCheck.java new file mode 100644 index 000000000000..0a855e77d2b9 --- /dev/null +++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/FluentMethodNameCheck.java @@ -0,0 +1,138 @@ +// 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 com.puppycrawl.tools.checkstyle.utils.TokenUtil; + +import java.util.ArrayDeque; +import java.util.Collections; +import java.util.HashSet; +import java.util.Queue; +import java.util.Set; + +/** + * Model Class Method check requirements: + *
    +*
  1. Fluent Methods: All methods that return an instance of the class, and that have one parameter.
  2. + *
  3. The method name should not start with {@code avoidStartWords}.
  4. + *
  5. All methods should not throw checked exceptions.
  6. + *
+ */ +public class FluentMethodNameCheck extends AbstractCheck { + /** + * This is a custom defined set which contains all prefixes that are not allowed. + */ + private final Set avoidStartWords = new HashSet<>(); + + /** + * A LIFO Queue tracks the status of the inner class names when traversals the AST tree. + */ + private final Queue classNameStack = Collections.asLifoQueue(new ArrayDeque<>()); + + /** + * Adds words that methods in fluent classes should not be prefixed with. + * @param avoidStartWords the starting strings that should not start with in fluent method + */ + public final void setAvoidStartWords(String... avoidStartWords) { + Collections.addAll(this.avoidStartWords, avoidStartWords); + } + + @Override + public int[] getDefaultTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getAcceptableTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getRequiredTokens() { + return new int[] { + TokenTypes.CLASS_DEF, + TokenTypes.METHOD_DEF + }; + } + + @Override + public void visitToken(DetailAST token) { + switch (token.getType()) { + case TokenTypes.CLASS_DEF: + classNameStack.offer(token.findFirstToken(TokenTypes.IDENT).getText()); + break; + case TokenTypes.METHOD_DEF: + if (!isFluentMethod(token)) { + return; + } + checkMethodNamePrefix(token); + + // logs error if the @Fluent method has 'throws' at the method declaration. + if (token.findFirstToken(TokenTypes.LITERAL_THROWS) != null) { + log(token, String.format( + "Fluent Method ''%s'' must not be declared to throw any checked exceptions")); + } + break; + default: + // Checkstyle complains if there's no default block in switch + break; + } + } + + @Override + public void leaveToken(DetailAST token) { + if (token.getType() == TokenTypes.CLASS_DEF && !classNameStack.isEmpty()) { + classNameStack.poll(); + } + } + + /** + * Log the error if the method name is not start with {@code avoidStartWord} + * @param methodDefToken METHOD_DEF AST node + */ + private void checkMethodNamePrefix(DetailAST methodDefToken) { + // A fluent method should only has one parameter. + if (TokenUtil.findFirstTokenByPredicate(methodDefToken, parameters -> + parameters.getType() == TokenTypes.PARAMETERS && parameters.getChildCount() != 1).isPresent()) { + log(methodDefToken, "A fluent method should only have one parameter."); + } + + // A fluent method's return type should be the class itself + final DetailAST typeToken = methodDefToken.findFirstToken(TokenTypes.TYPE); + if (TokenUtil.findFirstTokenByPredicate(typeToken, ident -> ident.getType() == TokenTypes.IDENT + && !ident.getText().equals(classNameStack.peek())).isPresent()) { + log(methodDefToken, "Return type of fluent method should be the class itself"); + } + + final String methodName = methodDefToken.findFirstToken(TokenTypes.IDENT).getText(); + // method name should not start with words in the avoid string list + avoidStartWords.forEach(avoidStartWord -> { + if (methodName.length() >= avoidStartWord.length() && methodName.startsWith(avoidStartWord)) { + log(methodDefToken, String.format("''%s'' fluent method name should not start with keyword ''%s''.", + methodName, avoidStartWord)); + } + }); + } + + /** + * Checks if the method is annotated with annotation @Fluent + * + * @param methodDefToken the METHOD_DEF AST node + * @return true if the class is annotated with @Fluent, false otherwise. + */ + private boolean isFluentMethod(DetailAST methodDefToken) { + // Always has MODIFIERS node + final DetailAST modifiersToken = methodDefToken.findFirstToken(TokenTypes.MODIFIERS); + // If no @Fluent annotated with this class, return false + return TokenUtil.findFirstTokenByPredicate(modifiersToken, + annotationToken -> annotationToken.getType() == TokenTypes.ANNOTATION + && TokenUtil.findFirstTokenByPredicate(annotationToken, + identToken -> identToken.getType() == TokenTypes.IDENT + && "Fluent".equals(identToken.getText())).isPresent()) + .isPresent(); + } +} diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/GoodLoggingCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/GoodLoggingCheck.java new file mode 100644 index 000000000000..7d90347c0ff8 --- /dev/null +++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/GoodLoggingCheck.java @@ -0,0 +1,187 @@ +// 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.FullIdent; +import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.TokenUtil; + +import java.util.ArrayDeque; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.Queue; +import java.util.Set; + +/** + * Good Logging Practice: + *
    + *
  1. A non-static instance logger.
  2. + *
  3. ClientLogger in public API should all named 'logger', public API classes are those classes that are declared + * as public and that do not exist in an implementation package or subpackage.
  4. + *
  5. Should not use any external logger class, only use ClientLogger. No slf4j, log4j, or other logging imports are + * allowed.
  6. + *
  7. 'System.out' and 'System.err' is not allowed as well.
  8. + *
+ */ +public class GoodLoggingCheck extends AbstractCheck { + private static final String CLIENT_LOGGER_PATH = "com.azure.core.util.logging.ClientLogger"; + private static final String CLIENT_LOGGER = "ClientLogger"; + private static final String LOGGER = "logger"; + + private static final String LOGGER_NAME_ERROR = + "ClientLogger instance naming: use ''%s'' instead of ''%s'' for consistency."; + private static final String STATIC_LOGGER_ERROR = "ClientLogger should not be static. Remove static modifier."; + private static final String NOT_CLIENT_LOGGER_ERROR = + "Do not use %s class. Use ''%s'' as a logging mechanism instead of ''%s''."; + + // Boolean indicator that indicates if the java class imports ClientLogger + private boolean hasClientLoggerImported; + // A LIFO queue stores the class names, pop top element if exist the class name AST node + private Queue classNameDeque = Collections.asLifoQueue(new ArrayDeque<>()); + // Collection of Invalid logging packages + private static final Set INVALID_LOGS = Collections.unmodifiableSet(new HashSet<>(Arrays.asList( + "org.slf4j", "org.apache.logging.log4j", "java.util.logging" + ))); + + @Override + public int[] getDefaultTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getAcceptableTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getRequiredTokens() { + return new int[] { + TokenTypes.IMPORT, + TokenTypes.CLASS_DEF, + TokenTypes.LITERAL_NEW, + TokenTypes.VARIABLE_DEF, + TokenTypes.METHOD_CALL + }; + } + + @Override + public void finishTree(DetailAST ast) { + hasClientLoggerImported = false; + } + + @Override + public void leaveToken(DetailAST ast) { + if (ast.getType() == TokenTypes.CLASS_DEF) { + classNameDeque.poll(); + } + } + + @Override + public void visitToken(DetailAST ast) { + switch (ast.getType()) { + case TokenTypes.IMPORT: + final String importClassPath = FullIdent.createFullIdentBelow(ast).getText(); + hasClientLoggerImported = hasClientLoggerImported || importClassPath.equals(CLIENT_LOGGER_PATH); + + INVALID_LOGS.forEach(item -> { + if (importClassPath.startsWith(item)) { + log(ast, String.format(NOT_CLIENT_LOGGER_ERROR, "external logger", CLIENT_LOGGER_PATH, item)); + } + }); + break; + case TokenTypes.CLASS_DEF: + classNameDeque.offer(ast.findFirstToken(TokenTypes.IDENT).getText()); + break; + case TokenTypes.LITERAL_NEW: + checkLoggerInstantiation(ast); + break; + case TokenTypes.VARIABLE_DEF: + checkLoggerNameMatch(ast); + break; + case TokenTypes.METHOD_CALL: + final DetailAST dotToken = ast.findFirstToken(TokenTypes.DOT); + if (dotToken == null) { + return; + } + final String methodCallName = FullIdent.createFullIdentBelow(dotToken).getText(); + if (methodCallName.startsWith("System.out") || methodCallName.startsWith("System.err")) { + log(ast, String.format(NOT_CLIENT_LOGGER_ERROR, "Java System", CLIENT_LOGGER_PATH, methodCallName)); + } + break; + default: + // Checkstyle complains if there's no default block in switch + break; + } + } + + /** + * Check if the VARIABLE_DEF AST node type is 'ClientLogger'. + * + * @param varDefAST VARIABLE_DEF AST node + * @return true if the variable type is 'ClientLogger'. + */ + private boolean isTypeClientLogger(DetailAST varDefAST) { + final DetailAST typeAST = varDefAST.findFirstToken(TokenTypes.TYPE); + if (typeAST == null) { + return false; + } + return TokenUtil.findFirstTokenByPredicate(typeAST, node -> + node.getType() == TokenTypes.IDENT && node.getText().equals(CLIENT_LOGGER) + ).isPresent(); + } + + /** + * Check if instantiating a matched class name for the same class. + * + * @param literalNewToken LITERAL_NEW node + */ + private void checkLoggerInstantiation(DetailAST literalNewToken) { + final DetailAST identToken = literalNewToken.findFirstToken(TokenTypes.IDENT); + // Not ClientLogger instance + if (identToken == null || !identToken.getText().equals(CLIENT_LOGGER)) { + return; + } + // LITERAL_NEW node always has ELIST node below + TokenUtil.findFirstTokenByPredicate(literalNewToken.findFirstToken(TokenTypes.ELIST), exprToken -> { + // Skip check if not EXPR node or if has no DOT node below. EXPR always has children below + if (exprToken.getType() != TokenTypes.EXPR || exprToken.getFirstChild().getType() != TokenTypes.DOT) { + return false; + } + // Check instantiation of ClientLogger + final String containerClassName = FullIdent.createFullIdent(exprToken.getFirstChild()).getText(); + // Add suffix of '.class' at the end of class name + final String className = classNameDeque.peek(); + if (!containerClassName.equals(className + ".class")) { + log(exprToken, String.format("Not newing a ClientLogger with matching class name. Use ''%s.class'' " + + "instead of ''%s''", className, containerClassName)); + } + return true; + }); + } + + /** + * Check if the given ClientLogger named 'logger' + * + * @param varToken VARIABLE_DEF node + */ + private void checkLoggerNameMatch(DetailAST varToken) { + if (!hasClientLoggerImported || !isTypeClientLogger(varToken)) { + return; + } + // Check if the Logger instance named as 'logger'. + final DetailAST identAST = varToken.findFirstToken(TokenTypes.IDENT); + if (identAST != null && !identAST.getText().equals(LOGGER)) { + log(varToken, String.format(LOGGER_NAME_ERROR, LOGGER, identAST.getText())); + } + // Check if the Logger is static instance, log as error if it is static instance logger. + if (TokenUtil.findFirstTokenByPredicate(varToken, + node -> node.getType() == TokenTypes.MODIFIERS + && node.branchContains(TokenTypes.LITERAL_STATIC)).isPresent()) { + log(varToken, STATIC_LOGGER_ERROR); + } + } +} diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/HttpPipelinePolicyCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/HttpPipelinePolicyCheck.java index a6c6b0b075b7..9168d5acb0c9 100644 --- a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/HttpPipelinePolicyCheck.java +++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/HttpPipelinePolicyCheck.java @@ -48,7 +48,7 @@ public void visitToken(DetailAST token) { switch (token.getType()) { case TokenTypes.PACKAGE_DEF: - final String packageName = FullIdent.createFullIdentBelow(token).getText(); + final String packageName = FullIdent.createFullIdent(token.findFirstToken(TokenTypes.DOT)).getText(); isImplementationPackage = packageName.contains("implementation"); break; case TokenTypes.CLASS_DEF: @@ -87,12 +87,14 @@ private void checkPublicNonImplementationPolicyClass(DetailAST classDefToken) { final String className = classDefToken.findFirstToken(TokenTypes.IDENT).getText(); // Public class check if (!accessModifier.equals(AccessModifier.PUBLIC)) { - log(modifiersToken, String.format("Class ''%s'' implementing ''%s'' and should be a public class", className, HTTP_PIPELINE_POLICY)); + log(modifiersToken, String.format("Class ''%s'' implementing ''%s'' and should be a public class", + className, HTTP_PIPELINE_POLICY)); } // Implementation and sub-package check if (isImplementationPackage) { - log(classDefToken, String.format("Class ''%s'' implementing ''%s'' and should not be a implementation package or sub-package of it", className, HTTP_PIPELINE_POLICY)); + log(classDefToken, String.format("Class ''%s'' implementing ''%s'' and should not be a implementation " + + "package or sub-package of it", className, HTTP_PIPELINE_POLICY)); } } } diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/JavaDocFormatting.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/JavaDocFormatting.java new file mode 100644 index 000000000000..10ed79ed0d8e --- /dev/null +++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/JavaDocFormatting.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.tools.checkstyle.checks; + +import com.puppycrawl.tools.checkstyle.api.DetailNode; +import com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes; +import com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck; +import com.puppycrawl.tools.checkstyle.utils.JavadocUtil; + +/** + * Description text should only have one space character after the parameter name or {@code @return} statement. + * Text should not start on a new line or have any additional spacing or indentation. + */ +public class JavaDocFormatting extends AbstractJavadocCheck { + + private static final String JAVA_DOC_RETURN = "javadoc return"; + private static final String JAVA_DOC_PARAMETER = "javadoc parameter"; + private static final String JAVA_DOC_THROW = "javadoc throw"; + private static final String JAVA_DOC_DEPRECATED = "javadoc deprecated"; + + private static final String ERROR_DESCRIPTION_ON_NEW_LINE = "Description for %s must be on same the same line."; + private static final String ERROR_NO_DESCRIPTION = "Description is missing for %s. Consider adding a description."; + private static final String ERROR_NO_WS_AFTER_IDENT = "No white space after %s. Consider fixing format."; + private static final String ERROR_EXTRA_SPACE = + "Only one white space is expected after %s. Consider removing extra spaces."; + + @Override + public int[] getAcceptableJavadocTokens() { + return getRequiredJavadocTokens(); + } + + @Override + public int[] getRequiredJavadocTokens() { + return new int[] { + JavadocTokenTypes.PARAMETER_NAME, + JavadocTokenTypes.RETURN_LITERAL, + JavadocTokenTypes.THROWS_LITERAL, + JavadocTokenTypes.DEPRECATED_LITERAL, + }; + } + + @Override + public int[] getDefaultJavadocTokens() { + return getRequiredJavadocTokens(); + } + + @Override + public void visitJavadocToken(DetailNode javaDocTag) { + switch (javaDocTag.getType()) { + case JavadocTokenTypes.RETURN_LITERAL: + evaluateValidFormat(javaDocTag, JAVA_DOC_RETURN); + break; + case JavadocTokenTypes.PARAMETER_NAME: + evaluateValidFormat(javaDocTag, JAVA_DOC_PARAMETER); + break; + case JavadocTokenTypes.THROWS_LITERAL: + // Evaluate what is the format after the CLASS_NAME of a @throw + DetailNode throwFormat = JavadocUtil.getNextSibling(javaDocTag, JavadocTokenTypes.CLASS_NAME); + evaluateValidFormat(throwFormat, JAVA_DOC_THROW); + break; + case JavadocTokenTypes.DEPRECATED_LITERAL: + evaluateValidFormat(javaDocTag, JAVA_DOC_DEPRECATED); + break; + default: + break; + } + } + + /* + * Function receives a DetailNode as the start token and then validates what comes after that node. + * valid format is: + * - A single white space is expected after the node. (no NEW_LINE) or other token + * + */ + private void evaluateValidFormat(DetailNode javaDocTag, String identifier) { + DetailNode nextNodeAfterParameterName = JavadocUtil.getNextSibling(javaDocTag); + + if (nextNodeAfterParameterName.getType() == JavadocTokenTypes.NEWLINE) { + if (JavadocUtil.getNextSibling(nextNodeAfterParameterName, JavadocTokenTypes.DESCRIPTION) != null) { + // Description on next line or after some other lines/spaces/staff + log(javaDocTag.getLineNumber(), String.format(ERROR_DESCRIPTION_ON_NEW_LINE, identifier)); + } else { + // No description for parameter name + log(javaDocTag.getLineNumber(), String.format(ERROR_NO_DESCRIPTION, identifier)); + } + } else if (nextNodeAfterParameterName.getType() != JavadocTokenTypes.WS) { + log(javaDocTag.getLineNumber(), String.format(ERROR_NO_WS_AFTER_IDENT, identifier)); + } else if (!nextNodeAfterParameterName.getText().equals(" ")) { + log(javaDocTag.getLineNumber(), String.format(ERROR_EXTRA_SPACE, identifier)); + } + } +} diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/JavadocCodeSnippetCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/JavadocCodeSnippetCheck.java new file mode 100644 index 000000000000..c99a7f51ad0a --- /dev/null +++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/JavadocCodeSnippetCheck.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.tools.checkstyle.checks; + +import com.puppycrawl.tools.checkstyle.DetailNodeTreeStringPrinter; +import com.puppycrawl.tools.checkstyle.api.AbstractCheck; +import com.puppycrawl.tools.checkstyle.api.DetailAST; +import com.puppycrawl.tools.checkstyle.api.DetailNode; +import com.puppycrawl.tools.checkstyle.api.FullIdent; +import com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes; +import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.BlockCommentPosition; +import com.puppycrawl.tools.checkstyle.utils.JavadocUtil; + +import java.util.ArrayDeque; +import java.util.Collections; +import java.util.Locale; +import java.util.Queue; + +/** + * Codesnippet description should match naming pattern requirement below: + *
    + *
  1. Package, class, and method names should be concatenated with a dot '.'. Ex., packageName.className + * .methodName
  2. + *
  3. Methods arguments should be concatenated with a dash '-'. Ex. String-String for methodName(String s, String + * s2)
  4. + *
  5. Use '#' to concatenate 1) and 2), ex packageName.className.methodName#String-String
  6. + *
  7. Ignore identifier after method arguments
  8. + *
+ */ +public class JavadocCodeSnippetCheck extends AbstractCheck { + + private static final String CODE_SNIPPET_ANNOTATION = "@codesnippet"; + private static final String MISSING_CODESNIPPET_TAG_MESSAGE = "There is a @codesnippet block in the JavaDoc, but it" + + " does not refer to any sample."; + + private static final int[] TOKENS = new int[] { + TokenTypes.PACKAGE_DEF, + TokenTypes.BLOCK_COMMENT_BEGIN, + TokenTypes.CLASS_DEF, + TokenTypes.METHOD_DEF + }; + + private String packageName; + // A LIFO queue contains all class name visited, remove the class name when leave the same token + private Queue classNameStack = Collections.asLifoQueue(new ArrayDeque<>()); + // Current METHOD_DEF token while traversal tree + private DetailAST methodDefToken = null; + + @Override + public int[] getDefaultTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getAcceptableTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getRequiredTokens() { + return TOKENS; + } + + @Override + public boolean isCommentNodesRequired() { + return true; + } + + @Override + public void leaveToken(DetailAST token) { + if (token.getType() == TokenTypes.CLASS_DEF && !classNameStack.isEmpty()) { + classNameStack.poll(); + } + } + + @Override + public void visitToken(DetailAST token) { + switch (token.getType()) { + case TokenTypes.PACKAGE_DEF: + packageName = FullIdent.createFullIdent(token.findFirstToken(TokenTypes.DOT)).getText(); + break; + case TokenTypes.CLASS_DEF: + classNameStack.offer(token.findFirstToken(TokenTypes.IDENT).getText()); + break; + case TokenTypes.METHOD_DEF: + methodDefToken = token; + break; + case TokenTypes.BLOCK_COMMENT_BEGIN: + checkNamingPattern(token); + break; + default: + // Checkstyle complains if there's no default block in switch + break; + } + } + + /** + * Check if the given block comment is on method. If not, skip the check. + * Otherwise, check if the codesnippet has matching the naming pattern + * + * @param blockCommentToken BLOCK_COMMENT_BEGIN token + */ + private void checkNamingPattern(DetailAST blockCommentToken) { + if (!BlockCommentPosition.isOnMethod(blockCommentToken)) { + return; + } + + // Turn the DetailAST into a Javadoc DetailNode. + DetailNode javadocNode = null; + try { + javadocNode = DetailNodeTreeStringPrinter.parseJavadocAsDetailNode(blockCommentToken); + } catch (IllegalArgumentException ex) { + // Exceptions are thrown if the JavaDoc has invalid formatting. + } + + if (javadocNode == null) { + return; + } + + // Iterate through all the top level nodes in the Javadoc, looking for the @codesnippet tag. + for (DetailNode node : javadocNode.getChildren()) { + if (node.getType() != JavadocTokenTypes.JAVADOC_INLINE_TAG) { + continue; + } + // Skip if not codesnippet + DetailNode customNameNode = JavadocUtil.findFirstToken(node, JavadocTokenTypes.CUSTOM_NAME); + if (customNameNode == null || !CODE_SNIPPET_ANNOTATION.equals(customNameNode.getText())) { + return; + } + // Missing Description + DetailNode descriptionNode = JavadocUtil.findFirstToken(node, JavadocTokenTypes.DESCRIPTION); + if (descriptionNode == null) { + log(node.getLineNumber(), MISSING_CODESNIPPET_TAG_MESSAGE); + return; + } + + // There will always have TEXT token if there is DESCRIPTION token exists. + String customDescription = JavadocUtil.findFirstToken(descriptionNode, JavadocTokenTypes.TEXT).getText(); + + // Find method name + final String methodName = methodDefToken.findFirstToken(TokenTypes.IDENT).getText(); + final String className = classNameStack.isEmpty() ? "" : classNameStack.peek(); + final String parameters = constructParametersString(methodDefToken); + String fullPath = packageName + "." + className + "." + methodName; + final String fullPathWithoutParameters = fullPath; + if (parameters != null) { + fullPath = fullPath + "#" + parameters; + } + + // Check for CodeSnippet naming pattern matching + if (customDescription == null || customDescription.isEmpty() + || !isNamingMatched(customDescription.toLowerCase(Locale.ROOT), + fullPathWithoutParameters.toLowerCase(Locale.ROOT), parameters)) { + log(node.getLineNumber(), String.format("Naming pattern mismatch. The @codesnippet description " + + "''%s'' does not match ''%s''. Case Insensitive.", customDescription, fullPath)); + } + } + } + + /** + * Construct a parameters string if the method has arguments. + * + * @param methodDefToken METHOD_DEF token + * @return a valid parameter string or null if no method arguments exist. + */ + private String constructParametersString(DetailAST methodDefToken) { + final StringBuilder sb = new StringBuilder(); + // Checks for the parameters of the method + final DetailAST parametersToken = methodDefToken.findFirstToken(TokenTypes.PARAMETERS); + for (DetailAST ast = parametersToken.getFirstChild(); ast != null; ast = ast.getNextSibling()) { + if (ast.getType() != TokenTypes.PARAMETER_DEF) { + continue; + } + + final DetailAST typeToken = ast.findFirstToken(TokenTypes.TYPE); + final DetailAST identToken = typeToken.findFirstToken(TokenTypes.IDENT); + String parameterType = ""; + if (identToken != null) { + // For example, Map, String, Mono types + parameterType = identToken.getText(); + } else { + + DetailAST arrayDeclarator = typeToken.findFirstToken(TokenTypes.ARRAY_DECLARATOR); + if (arrayDeclarator == null) { + // For example, int, boolean, byte primitive types + parameterType = typeToken.getFirstChild().getText(); + } + + DetailAST arrayDeclaratorIterator = arrayDeclarator; + while (arrayDeclaratorIterator != null) { + DetailAST temp = arrayDeclaratorIterator.findFirstToken(TokenTypes.ARRAY_DECLARATOR); + if (temp == null) { + // For example, int[][], byte[] types + parameterType = arrayDeclaratorIterator.getFirstChild().getText(); + break; + } + arrayDeclaratorIterator = temp; + } + } + sb.append(parameterType).append("-"); + } + int size = sb.length(); + if (size == 0) { + return null; + } + return sb.substring(0, size - 1); + } + + /** + * Check if the given customDescription from codesnippet matches the naming pattern rule. + * + * @param customDescription full sample code reference name from annotation codesnippet + * @param fullPathWithoutParameters a string contains package name, class name, and method name if exist. + * @param parameters parameters string which concatenate of argument types + * @return false if the given custom description not matched with naming rule. Otherwise, return true. + */ + private boolean isNamingMatched(String customDescription, String fullPathWithoutParameters, String parameters) { + // Two same codesnippet samples should have two different key names, + // For example, for method name methodName(string, string), + // (1) packagename.classname.methodname#string-string + // (2) packagename.classname.methodname#string-string-2 + final String[] descriptionSegments = customDescription.split("#"); + if (descriptionSegments.length == 1) { + // There exists parameters in the actual Java sample, but there is no custom parameters exist. + if (parameters != null) { + return false; + } + + final String pathUntilMethodName = descriptionSegments[0].split("-")[0]; + if (!fullPathWithoutParameters.equalsIgnoreCase(pathUntilMethodName)) { + return false; + } + } + + if (descriptionSegments.length == 2) { + // Both of codesnippet name and the method has parameters + if (parameters != null) { + return descriptionSegments[1].toLowerCase().startsWith(parameters.toLowerCase()); + } + + // Codesnippet name has parameters but the method does not. + return false; + } + return true; + } +} diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/JavadocInlineTagCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/JavadocInlineTagCheck.java new file mode 100644 index 000000000000..53753f3dea58 --- /dev/null +++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/JavadocInlineTagCheck.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.tools.checkstyle.checks; + +import com.puppycrawl.tools.checkstyle.api.DetailAST; +import com.puppycrawl.tools.checkstyle.api.DetailNode; +import com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes; +import com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck; +import com.puppycrawl.tools.checkstyle.utils.BlockCommentPosition; +import com.puppycrawl.tools.checkstyle.utils.JavadocUtil; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +/** + * Javadoc Inline tag check: + *
    + *
  1. Use {@literal {@codesnippet ...}} instead of {@literal }, {@literal
    }, or {@literal {@code ...}}
    + * if these tags span multiple lines. Inline code sample are fine as-is
  2. + *
  3. No check on class-level Javadoc
  4. + *
+ */ +public class JavadocInlineTagCheck extends AbstractJavadocCheck { + private static final String MULTIPLE_LINE_SPAN_ERROR = "Tag '%s' spans multiple lines. Use @codesnippet annotation" + + " instead of '%s' to ensure that the code block always compiles."; + + // HTML tag set that need to be checked to see if there tags span on multiple lines. + private static final Set CHECK_TAGS = Collections.unmodifiableSet(new HashSet<>( + Arrays.asList("pre", "code"))); + + @Override + public int[] getDefaultJavadocTokens() { + return getRequiredJavadocTokens(); + } + + @Override + public int[] getRequiredJavadocTokens() { + return new int[] { + JavadocTokenTypes.HTML_ELEMENT_START, + JavadocTokenTypes.JAVADOC_INLINE_TAG + }; + } + + @Override + public void visitJavadocToken(DetailNode token) { + DetailAST blockCommentToken = getBlockCommentAst(); + // Skip check on class-level Javadoc + if (!BlockCommentPosition.isOnMethod(blockCommentToken) + && !BlockCommentPosition.isOnConstructor(blockCommentToken)) { + return; + } + + switch (token.getType()) { + case JavadocTokenTypes.HTML_ELEMENT_START: + checkHtmlElementStart(token); + break; + case JavadocTokenTypes.JAVADOC_INLINE_TAG: + checkJavadocInlineTag(token); + break; + default: + // Checkstyle complains if there's no default block in switch + break; + } + } + + /** + * Use {@literal {@codesnippet ...}} instead of {@literal }, {@literal
}, or {@literal {@code ...}}
+     * if these tags span multiple lines. Inline code sample are fine as-is.
+     *
+     * @param htmlElementStartNode HTML_ELEMENT_START node
+     */
+    private void checkHtmlElementStart(DetailNode htmlElementStartNode) {
+        final DetailNode tagNameNode =
+            JavadocUtil.findFirstToken(htmlElementStartNode, JavadocTokenTypes.HTML_TAG_NAME);
+        // HTML tags are case-insensitive
+        final String tagName = tagNameNode.getText().toLowerCase();
+        if (!CHECK_TAGS.contains(tagName)) {
+            return;
+        }
+
+        final String tagNameBracket = "<" + tagName + ">";
+        final DetailNode htmlTagNode = htmlElementStartNode.getParent();
+        if (!isInlineCode(htmlTagNode)) {
+            log(htmlTagNode.getLineNumber(), htmlTagNode.getColumnNumber(),
+                String.format(MULTIPLE_LINE_SPAN_ERROR, tagNameBracket, tagNameBracket));
+        }
+    }
+
+    /**
+     * Check to see if the JAVADOC_INLINE_TAG node is {@literal @code} tag. If it is, check if the tag contains a new
+     * line or a leading asterisk, which implies the tag has spanned in multiple lines.
+     *
+     * @param inlineTagNode JAVADOC_INLINE_TAG javadoc node
+     */
+    private void checkJavadocInlineTag(DetailNode inlineTagNode) {
+        final DetailNode codeLiteralNode = JavadocUtil.findFirstToken(inlineTagNode, JavadocTokenTypes.CODE_LITERAL);
+        if (codeLiteralNode == null) {
+            return;
+        }
+
+        final String codeLiteral = codeLiteralNode.getText();
+        if (!isInlineCode(inlineTagNode)) {
+            log(codeLiteralNode.getLineNumber(), codeLiteralNode.getColumnNumber(),
+                String.format(MULTIPLE_LINE_SPAN_ERROR, codeLiteral, codeLiteral));
+        }
+    }
+
+    /**
+     * Find if the given tag node is in-line code sample.
+     * @param node A given node that could be HTML_TAG or JAVADOC_INLINE_TAG
+     * @return false if it is a code block, otherwise, return true if it is a in-line code.
+     */
+    private boolean isInlineCode(DetailNode node) {
+        for (final DetailNode child : node.getChildren()) {
+            final int childType = child.getType();
+            if (childType == JavadocTokenTypes.NEWLINE || childType == JavadocTokenTypes.LEADING_ASTERISK) {
+                return false;
+            }
+        }
+        return true;
+    }
+}
diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/JavadocThrowsChecks.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/JavadocThrowsChecks.java
index c12eeb540056..072a971c6c12 100644
--- a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/JavadocThrowsChecks.java
+++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/JavadocThrowsChecks.java
@@ -18,7 +18,8 @@
 import java.util.Map;
 
 public class JavadocThrowsChecks extends AbstractCheck {
-    private static final String MISSING_DESCRIPTION_MESSAGE = "@throws tag requires a description explaining when the error is thrown.";
+    private static final String MISSING_DESCRIPTION_MESSAGE =
+        "@throws tag requires a description explaining when the error is thrown.";
     private static final String MISSING_THROWS_TAG_MESSAGE = "Javadoc @throws tag required for unchecked throw.";
     private static final int[] TOKENS = new int[] {
         TokenTypes.CTOR_DEF,
@@ -105,7 +106,8 @@ public void visitToken(DetailAST token) {
      */
     private void setIdentifierAndCheckStatus(DetailAST scopeDefToken) {
         currentScopeIdentifier = scopeDefToken.findFirstToken(TokenTypes.IDENT).getText() + scopeDefToken.getLineNo();
-        currentScopeNeedsChecking = visibilityIsPublicOrProtectedAndNotAbstractOrOverride(scopeDefToken.findFirstToken(TokenTypes.MODIFIERS));
+        currentScopeNeedsChecking =
+            visibilityIsPublicOrProtectedAndNotAbstractOrOverride(scopeDefToken.findFirstToken(TokenTypes.MODIFIERS));
     }
 
     /*
@@ -151,7 +153,8 @@ private boolean isOverrideAnnotation(DetailAST modifierToken) {
      * @param blockCommentToken Block comment token.
      */
     private void findJavadocThrows(DetailAST blockCommentToken) {
-        if (!BlockCommentPosition.isOnMethod(blockCommentToken) && !BlockCommentPosition.isOnConstructor(blockCommentToken)) {
+        if (!BlockCommentPosition.isOnMethod(blockCommentToken)
+            && !BlockCommentPosition.isOnConstructor(blockCommentToken)) {
             return;
         }
 
@@ -172,7 +175,8 @@ private void findJavadocThrows(DetailAST blockCommentToken) {
 
         // Iterate through all the top level nodes in the Javadoc, looking for the @throws statements.
         for (DetailNode node : javadocNode.getChildren()) {
-            if (node.getType() != JavadocTokenTypes.JAVADOC_TAG || JavadocUtil.findFirstToken(node, JavadocTokenTypes.THROWS_LITERAL) == null) {
+            if (node.getType() != JavadocTokenTypes.JAVADOC_TAG
+                || JavadocUtil.findFirstToken(node, JavadocTokenTypes.THROWS_LITERAL) == null) {
                 continue;
             }
 
diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/NoImplInPublicAPI.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/NoImplInPublicAPI.java
index a21ed603ab72..d2aafb9ac99c 100644
--- a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/NoImplInPublicAPI.java
+++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/NoImplInPublicAPI.java
@@ -15,11 +15,14 @@ public class NoImplInPublicAPI extends AbstractCheck {
 
     private static final String COM_AZURE = "com.azure";
     private static final String DOT_IMPLEMENTATION = ".implementation";
-    private static final String PARAM_TYPE_ERROR = "\"%s\" class is in an implementation package, and it should not be used as a parameter type in public API. Alternatively, it can be removed from the implementation package and made public API, after appropriate API review.";
-    private static final String RETURN_TYPE_ERROR = "\"%s\" class is in an implementation package, and it should not be a return type from public API. Alternatively, it can be removed from the implementation package and made public API.";
+    private static final String PARAM_TYPE_ERROR =
+        "\"%s\" class is in an implementation package, and it should not be used as a parameter type in public API. "
+            + "Alternatively, it can be removed from the implementation package and made public API, after "
+            + "appropriate API review.";
+    private static final String RETURN_TYPE_ERROR =
+        "\"%s\" class is in an implementation package, and it should not be a return type from public API. "
+            + "Alternatively, it can be removed from the implementation package and made public API.";
 
-    private static boolean isTrackTwo;
-    private static boolean isImplPackage;
     private Set implementationClassSet = new HashSet<>();
 
     @Override
@@ -34,7 +37,7 @@ public int[] getAcceptableTokens() {
 
     @Override
     public int[] getRequiredTokens() {
-        return new int[] {
+        return new int[]{
             TokenTypes.PACKAGE_DEF,
             TokenTypes.IMPORT,
             TokenTypes.METHOD_DEF
@@ -43,28 +46,11 @@ public int[] getRequiredTokens() {
 
     @Override
     public void beginTree(DetailAST root) {
-        this.isImplPackage = false;
-        this.isTrackTwo = false;
         this.implementationClassSet.clear();
     }
 
     @Override
     public void visitToken(DetailAST ast) {
-        if (ast.getType() == TokenTypes.PACKAGE_DEF) {
-            String packageName = FullIdent.createFullIdent(ast.findFirstToken(TokenTypes.DOT)).getText();
-            this.isTrackTwo = packageName.startsWith(COM_AZURE);
-            this.isImplPackage = packageName.contains(DOT_IMPLEMENTATION);
-            return;
-        } else {
-            if (this.isTrackTwo) {
-                if (this.isImplPackage) {
-                    return;
-                }
-            } else {
-                return;
-            }
-        }
-
         switch (ast.getType()) {
             case TokenTypes.IMPORT:
                 String importClassPath = FullIdent.createFullIdentBelow(ast).getText();
diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/OnlyFinalFieldsForImmutableClassCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/OnlyFinalFieldsForImmutableClassCheck.java
index 85252a28a214..916c7533859f 100644
--- a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/OnlyFinalFieldsForImmutableClassCheck.java
+++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/OnlyFinalFieldsForImmutableClassCheck.java
@@ -1,5 +1,5 @@
-// Licensed under the MIT License.
 // Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
 
 package com.azure.tools.checkstyle.checks;
 
@@ -19,8 +19,8 @@
  */
 public class OnlyFinalFieldsForImmutableClassCheck extends AbstractCheck {
     private static final String IMMUTABLE_NOTATION = "Immutable";
-    private static final String ERROR_MSG = "The variable field ''%s'' should be final." +
-        "Classes annotated with @Immutable are supposed to be immutable.";
+    private static final String ERROR_MSG = "The variable field ''%s'' should be final."
+        + "Classes annotated with @Immutable are supposed to be immutable.";
 
     private boolean hasImmutableAnnotation;
 
diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientBuilderCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientBuilderCheck.java
index 8623828a9c63..64119d96a3a8 100644
--- a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientBuilderCheck.java
+++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientBuilderCheck.java
@@ -10,14 +10,17 @@
 import java.util.Stack;
 
 /**
- * The @ServiceClientBuilder class should have the following rules:
- *  1) All service client builder should be named ClientBuilder and annotated with @ServiceClientBuilder.
- *  2) No other method have prefix 'build' other than 'build*Client' or 'build*AsyncClient'.
+ * The {@literal @ServiceClientBuilder} class should have the following rules:
+ * 
    + *
  1. All service client builder should be named <ServiceName>ClientBuilder and annotated with + * {@literal @ServiceClientBuilder}.
  2. + *
  3. No other method have prefix 'build' other than 'build*Client' or 'build*AsyncClient'.
  4. + *
*/ public class ServiceClientBuilderCheck extends AbstractCheck { private static final String SERVICE_CLIENT_BUILDER = "ServiceClientBuilder"; - private Stack hasServiceClientBuilderAnnotationStack = new Stack(); + private Stack hasServiceClientBuilderAnnotationStack = new Stack<>(); private Stack hasBuildMethodStack = new Stack<>(); private boolean hasServiceClientBuilderAnnotation; private boolean hasBuildMethod; @@ -46,7 +49,8 @@ public void leaveToken(DetailAST token) { hasServiceClientBuilderAnnotation = hasServiceClientBuilderAnnotationStack.pop(); hasBuildMethod = hasBuildMethodStack.pop(); if (hasServiceClientBuilderAnnotation && !hasBuildMethod) { - log(token, "Class with @ServiceClientBuilder annotation must have a method starting with ''build'' and ending with ''Client''."); + log(token, "Class with @ServiceClientBuilder annotation must have a method starting with ''build'' " + + "and ending with ''Client''."); } } } @@ -63,16 +67,19 @@ public void visitToken(DetailAST token) { hasServiceClientBuilderAnnotation = serviceClientAnnotationBuilderToken != null; if (hasServiceClientBuilderAnnotation) { - // Don't need to check if the 'serviceClients' exist. It is required when using @ServiceClientBuilder + // Don't need to check if the 'serviceClients' exist. It is required when using + // @ServiceClientBuilder // HAS @ServiceClientBuilder annotation but NOT named the class ClientBuilder if (!className.endsWith("ClientBuilder")) { - log(token, String.format("Class annotated with @ServiceClientBuilder ''%s'' should be named ClientBuilder.", className)); + log(token, String.format("Class annotated with @ServiceClientBuilder ''%s'' should be named " + + "ClientBuilder.", className)); } } else { // No @ServiceClientBuilder annotation but HAS named the class ClientBuilder if (className.endsWith("ClientBuilder")) { - log(token, String.format("Class ''%s'' should be annotated with @ServiceClientBuilder.", className)); + log(token, String.format("Class ''%s'' should be annotated with @ServiceClientBuilder.", + className)); } } break; @@ -90,7 +97,8 @@ public void visitToken(DetailAST token) { // method name has prefix 'build' but not 'build*Client' or 'build*AsyncClient' if (!methodName.endsWith("Client")) { log(token, String.format( - "@ServiceClientBuilder class should not have a method name, ''%s'' starting with ''build'' but not ending with ''Client''." , methodName)); + "@ServiceClientBuilder class should not have a method name, ''%s'' starting with ''build'' " + + "but not ending with ''Client''.", methodName)); } break; default: diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientCheck.java new file mode 100644 index 000000000000..522c23cc2c2c --- /dev/null +++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientCheck.java @@ -0,0 +1,526 @@ +// 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.FullIdent; +import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import com.puppycrawl.tools.checkstyle.checks.naming.AccessModifier; +import com.puppycrawl.tools.checkstyle.utils.CheckUtil; +import com.puppycrawl.tools.checkstyle.utils.TokenUtil; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Optional; +import java.util.Set; + +/** + * Verify the classes with annotation @ServiceClient should have following rules: + *
    + *
  1. No public or protected constructors
  2. + *
  3. No public static method named 'builder'
  4. + *
  5. Since these classes are supposed to be immutable, all fields in the service client classes should be final
  6. + *
+ * + * All methods that has a @ServiceMethod annotation in a class annotated with @ServiceClient should follow below rules: + *
    + *
  1. Follows method naming pattern. Refer to + * Java Spec:
  2. + *
  3. Methods should not have "Async" added to the method name
  4. + *
  5. Return type of async and sync clients should be as per guidelines: + *
      + *
    1. The return type for async collection should be of type that extends PagedFlux
    2. + *
    3. The return type for async single value should be of type that extends Mono
    4. + *
    5. The return type for sync collection should be of type that extends PagedIterable
    6. + *
    7. The return type for sync single value should be of type that extends Response
    8. + *
    + *
  6. + *
+ */ +public class ServiceClientCheck extends AbstractCheck { + private static final String ASYNC = "Async"; + private static final String SERVICE_CLIENT = "ServiceClient"; + private static final String BUILDER = "builder"; + private static final String ASYNC_CLIENT = "AsyncClient"; + private static final String CLIENT = "Client"; + private static final String IS_ASYNC = "isAsync"; + private static final String CONTEXT = "Context"; + + private static final String RESPONSE_BRACKET = "Response<"; + private static final String MONO_BRACKET = "Mono<"; + private static final String MONO_RESPONSE_BRACKET = "Mono COMMON_NAMING_PREFIX_SET = Collections.unmodifiableSet(new HashSet<>(Arrays.asList( + "upsert", "set", "create", "update", "replace", "delete", "add", "get", "list" + ))); + + // Add all imported classes into a map, key is the name of class and value is the full package path of class. + private final Map simpleClassNameToQualifiedNameMap = new HashMap<>(); + + private boolean isAsync; + private boolean isServiceClientAnnotation; + + @Override + public int[] getDefaultTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getAcceptableTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getRequiredTokens() { + return new int[] { + TokenTypes.IMPORT, + TokenTypes.CLASS_DEF, + TokenTypes.CTOR_DEF, + TokenTypes.METHOD_DEF, + TokenTypes.OBJBLOCK + }; + } + + @Override + public void beginTree(DetailAST root) { + isServiceClientAnnotation = false; + isAsync = false; + } + + @Override + public void visitToken(DetailAST token) { + switch (token.getType()) { + case TokenTypes.IMPORT: + addImportedClassPath(token); + break; + case TokenTypes.CLASS_DEF: + isServiceClientAnnotation = hasServiceClientAnnotation(token); + if (!isServiceClientAnnotation) { + return; + } + checkServiceClientNaming(token); + break; + case TokenTypes.CTOR_DEF: + if (!isServiceClientAnnotation) { + return; + } + checkConstructor(token); + break; + case TokenTypes.METHOD_DEF: + if (!isServiceClientAnnotation) { + return; + } + checkMethodNameBuilder(token); + checkMethodNamingPattern(token); + break; + case TokenTypes.OBJBLOCK: + if (!isServiceClientAnnotation) { + return; + } + checkClassField(token); + break; + default: + // Checkstyle complains if there's no default block in switch + break; + } + } + + /** + * Checks for public or protected constructor for the service client class. + * Log error if the service client has public or protected constructor. + * + * @param ctorToken the CTOR_DEF AST node + */ + private void checkConstructor(DetailAST ctorToken) { + final DetailAST modifiersToken = ctorToken.findFirstToken(TokenTypes.MODIFIERS); + // find constructor's modifier accessibility, no public or protected constructor + final AccessModifier accessModifier = CheckUtil.getAccessModifierFromModifiersToken(modifiersToken); + if (accessModifier.equals(AccessModifier.PUBLIC) || accessModifier.equals(AccessModifier.PROTECTED)) { + log(modifiersToken, "@ServiceClient class should not have any public or protected constructor."); + } + } + + /** + * Checks for public static method named 'builder'. Should avoid to use method name, 'builder'. + * + * @param methodDefToken the METHOD_DEF AST node + */ + private void checkMethodNameBuilder(DetailAST methodDefToken) { + final DetailAST methodNameToken = methodDefToken.findFirstToken(TokenTypes.IDENT); + if (!BUILDER.equals(methodNameToken.getText())) { + return; + } + + final DetailAST modifiersToken = methodDefToken.findFirstToken(TokenTypes.MODIFIERS); + // find method's modifier accessibility, should not have a public static method called 'builder' + final AccessModifier accessModifier = CheckUtil.getAccessModifierFromModifiersToken(modifiersToken); + if (accessModifier.equals(AccessModifier.PUBLIC) && modifiersToken.branchContains(TokenTypes.LITERAL_STATIC)) { + log(modifiersToken, "@ServiceClient class should not have a public static method named ''builder''."); + } + } + + /** + * Checks that the field variables in the @ServiceClient are final. ServiceClients should be immutable. + * + * @param objBlockToken the OBJBLOCK AST node + */ + private void checkClassField(DetailAST objBlockToken) { + final Optional varDefTokenOption = TokenUtil.findFirstTokenByPredicate(objBlockToken, node -> + node.getType() == TokenTypes.VARIABLE_DEF + && !node.findFirstToken(TokenTypes.MODIFIERS).branchContains(TokenTypes.FINAL)); + if (varDefTokenOption.isPresent()) { + final DetailAST varDefToken = varDefTokenOption.get(); + final String varName = varDefToken.findFirstToken(TokenTypes.IDENT).getText(); + log(varDefToken, String.format("The variable field ''%s'' of class ''%s'' should be final. Classes " + + "annotated with @ServiceClient are supposed to be immutable.", varName, + objBlockToken.getPreviousSibling().getText())); + } + } + + /** + * Checks for the class name of Service Client. It should be named <ServiceName>AsyncClient or + * <ServiceName>Client. + * + * @param classDefToken the CLASS_DEF AST node + */ + private void checkServiceClientNaming(DetailAST classDefToken) { + final String className = classDefToken.findFirstToken(TokenTypes.IDENT).getText(); + // Async client must be named AsyncClient, and Sync client must be named Client + if (isAsync && !className.endsWith(ASYNC_CLIENT)) { + log(classDefToken, String.format("Asynchronous class ''%s'' must be named AsyncClient, which " + + "concatenates by service name and a fixed word 'AsyncClient'.", className)); + } else if (!isAsync && !className.endsWith(CLIENT)) { + log(classDefToken, String.format("Synchronous class %s must be named Client," + + " which concatenates by service name and a fixed word 'Client'.", className)); + } + + // Class named AsyncClient, the property 'isAsync' must set to true + // Class named Client, the property 'isAsync' must to be false or use the default value + if (className.endsWith(ASYNC_CLIENT) && !isAsync) { + log(classDefToken, String.format("class ''%s'' is an asynchronous client, must set property ''%s'' to " + + "true.", className, IS_ASYNC)); + } else if (className.endsWith(CLIENT) && !className.endsWith(ASYNC_CLIENT) && isAsync) { + log(classDefToken, String.format("class ''%s'' is a synchronous client, must set property ''%s'' to false" + + " or without the property.", className, IS_ASYNC)); + } + } + + /** + * Verify all methods that have a @ServiceMethod annotation in a class annotated with @ServiceClient should + * follow below rules: + * 1) Follows method naming pattern. Refer to Java Spec. + * 2) Methods should not have "Async" added to the method name. + * 3) The return type of async and sync clients should be as per guidelines: + * 3.1) The return type for async collection should be of type? extends PagedFlux. + * 3.2) The return type for async single value should be of type? extends Mono. + * 3.3) The return type for sync collection should be of type? extends PagedIterable. + * 3.4) The return type for sync single value should be of type? extends Response. + * 4) Naming pattern for 'WithResponse'. + * 5) Synchronous method with annotation @ServiceMethod has to have {@code Context} as a parameter. + * Asynchronous method with annotation @ServiceMethod must not has {@code Context} as a parameter. + * + * @param methodDefToken METHOD_DEF AST node + */ + private void checkMethodNamingPattern(DetailAST methodDefToken) { + final DetailAST modifiersToken = methodDefToken.findFirstToken(TokenTypes.MODIFIERS); + final Optional serviceMethodAnnotationOption = TokenUtil.findFirstTokenByPredicate(modifiersToken, + node -> { + if (node.getType() != TokenTypes.ANNOTATION) { + return false; + } + final DetailAST annotationIdentToken = node.findFirstToken(TokenTypes.IDENT); + return annotationIdentToken != null && "ServiceMethod".equals(annotationIdentToken.getText()); + }); + // NOT a @ServiceMethod method + if (!serviceMethodAnnotationOption.isPresent()) { + return; + } + + final DetailAST serviceMethodAnnotation = serviceMethodAnnotationOption.get(); + final String methodName = methodDefToken.findFirstToken(TokenTypes.IDENT).getText(); + + // 1) Follows method naming pattern. Refer to Java Spec. + // prefix of method name that contains all lower letters + final String prefix = methodName.split("[A-Z]", 2)[0]; + if (!methodName.endsWith("Exists") && !COMMON_NAMING_PREFIX_SET.contains(prefix)) { + log(methodDefToken, String.format( + "Method name ''%s'' should follow a common vocabulary. Refer to Java Spec: %s.", + methodName, JAVA_SPEC_LINK)); + } + + // 2) Methods should not have "Async" added to the method name + if (methodName.contains(ASYNC)) { + log(methodDefToken, String.format("Method name ''%s'' should not contain ''%s'' in the method name.", + methodName, ASYNC)); + } + + // 3) The return type of async and sync clients should be as per guidelines + checkServiceClientMethodReturnType(methodDefToken, serviceMethodAnnotation, methodName); + + // 4) Check 'withResponse' naming pattern + checkReturnTypeNamingPattern(methodDefToken, methodName); + + // 5) Synchronous method with annotation @ServiceMethod has to have {@code Context} as a parameter. + // Asynchronous method with annotation @ServiceMethod must not has {@code Context} as a parameter. + checkContextInRightPlace(methodDefToken); + } + + /** + * Checks for the return type of async and sync clients should be as per guidelines: + * 1) The return type for async collection should be of type? extends PagedFlux + * 2) The return type for async single value should be of type? extends Mono + * 3) The return type for sync collection should be of type? extends PagedIterable + * 4) The return type for sync single value should be of type? extends Response + * + * @param methodDefToken METHOD_DEF AST node + * @param serviceMethodAnnotation ANNOTATION AST node which used to find the if the annotation has 'return' key, + * @param methodName method name + * if found. return the value of member'return'. + */ + private void checkServiceClientMethodReturnType(DetailAST methodDefToken, DetailAST serviceMethodAnnotation, + String methodName) { + // Find the annotation member 'returns' value + String returnsAnnotationMemberValue = null; + final Optional returnValueOption = + TokenUtil.findFirstTokenByPredicate(serviceMethodAnnotation, node -> + node.getType() == TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR + && node.findFirstToken(TokenTypes.IDENT).getText().equals("returns") + && !FullIdent.createFullIdentBelow(node.findFirstToken(TokenTypes.EXPR)).getText().isEmpty()); + + if (returnValueOption.isPresent()) { + returnsAnnotationMemberValue = + FullIdent.createFullIdentBelow(returnValueOption.get().findFirstToken(TokenTypes.EXPR)).getText(); + } + + final String returnType = + getReturnType(methodDefToken.findFirstToken(TokenTypes.TYPE), new StringBuilder()).toString(); + + if (isAsync) { + if (SINGLE_RETURN_TYPE.equals(returnsAnnotationMemberValue)) { + // If value of 'returns' is SINGLE, and then log error if the return type of the method is not start + // with {@code Mono} + if (!returnType.startsWith(MONO_BRACKET)) { + log(methodDefToken, String.format(RETURN_TYPE_ERROR, "Asynchronous", SINGLE_RETURN_TYPE, MONO)); + } + } else if (COLLECTION_RETURN_TYPE.equals(returnsAnnotationMemberValue)) { + // If value of 'returns' is COLLECTION, and then log error if the return type of the method is not + // start with {@code PagedFlux} + if (!returnType.startsWith(PAGED_FLUX_BRACKET)) { + log(methodDefToken, String.format(RETURN_TYPE_ERROR, "Asynchronous", COLLECTION_RETURN_TYPE, + PAGED_FLUX)); + } + } + } else { + if (SINGLE_RETURN_TYPE.equals(returnsAnnotationMemberValue)) { + // If value of 'returns' is SINGLE, and then log error if the return type of the method is not start + // with {@code Response} when the method name ends with 'WithResponse'. + if ((returnType.startsWith(RESPONSE_BRACKET) && !methodName.endsWith(WITH_RESPONSE)) + || (!returnType.startsWith(RESPONSE_BRACKET) && methodName.endsWith(WITH_RESPONSE))) { + log(methodDefToken, String.format(RESPONSE_METHOD_NAME_ERROR, "Synchronous", SINGLE_RETURN_TYPE, + RESPONSE, WITH_RESPONSE, WITH_RESPONSE, RESPONSE)); + } + } else if (COLLECTION_RETURN_TYPE.equals(returnsAnnotationMemberValue)) { + // If value of 'returns' is COLLECTION, and then log error if the return type of the method is not + // start with {@code PagedIterable} + if (!returnType.startsWith(PAGED_ITERABLE_BRACKET)) { + log(methodDefToken, String.format(RETURN_TYPE_ERROR, "Synchronous", COLLECTION_RETURN_TYPE, + PAGED_ITERABLE)); + } + } + } + } + + /** + * Given the method is already annotated @ServiceMethod. Checks if the return type is {@code Response} or + * {@code Mono>}, + * Sync: + * If the return type is {@code Response}, the method name must end with WithResponse. + * If the return type is T, the method name must NOT end with WithResponse. + * Async: + * If the return type is {@code Mono}, the method name must end with WithResponse. + * If the return type is {@code Mono}, the method name must NOT end with WithResponse. + * + * @param methodDefToken METHOD_DEF AST node + */ + private void checkReturnTypeNamingPattern(DetailAST methodDefToken, String methodName) { + final DetailAST typeToken = methodDefToken.findFirstToken(TokenTypes.TYPE); + // Use recursion to get the return type + final String returnType = getReturnType(typeToken, new StringBuilder()).toString(); + + if (methodName.endsWith(WITH_RESPONSE)) { + if (!returnType.startsWith(RESPONSE_BRACKET) && !returnType.startsWith(MONO_RESPONSE_BRACKET)) { + log(methodDefToken, String.format(RETURN_TYPE_WITH_RESPONSE_ERROR, returnType, "must not", + WITH_RESPONSE)); + } + } else { + if (returnType.startsWith(RESPONSE_BRACKET) || returnType.startsWith(MONO_RESPONSE_BRACKET)) { + log(methodDefToken, String.format(RETURN_TYPE_WITH_RESPONSE_ERROR, returnType, "must", WITH_RESPONSE)); + } + } + } + + /** + * Checks the type Context should be in the right place. Context should be passed in as an argument to all public + * methods annotated with @ServiceMethod that return {@code Response} in synchronous clients. + * Synchronous method with annotation @ServiceMethod has to have {@code Context} as a parameter. + * Asynchronous method with annotation @ServiceMethod must not has {@code Context} as a parameter. + * + * @param methodDefToken METHOD_DEF AST token + */ + private void checkContextInRightPlace(DetailAST methodDefToken) { + final DetailAST parametersToken = methodDefToken.findFirstToken(TokenTypes.PARAMETERS); + final String returnType = + getReturnType(methodDefToken.findFirstToken(TokenTypes.TYPE), new StringBuilder()).toString(); + + final boolean containsContextParameter = TokenUtil.findFirstTokenByPredicate(parametersToken, + parameterToken -> { + if (parameterToken.getType() != TokenTypes.PARAMETER_DEF) { + return false; + } + final DetailAST paramTypeIdentToken = + parameterToken.findFirstToken(TokenTypes.TYPE).findFirstToken(TokenTypes.IDENT); + return paramTypeIdentToken != null && CONTEXT.equals(paramTypeIdentToken.getText()); + }) + .isPresent(); + + if (containsContextParameter) { + // MONO and PagedFlux return type implies Asynchronous method + if (returnType.startsWith(MONO_BRACKET) || returnType.startsWith(PAGED_FLUX_BRACKET)) { + log(methodDefToken, String.format(ASYNC_CONTEXT_ERROR, CONTEXT)); + } + } else { + // Context should be passed in as an argument to all public methods annotated with @ServiceMethod that + // return Response in sync clients. + if (returnType.startsWith(RESPONSE_BRACKET)) { + log(methodDefToken, String.format(SYNC_CONTEXT_ERROR, CONTEXT)); + } + } + } + + /** + * Checks if the class is annotated with annotation @ServiceClient. A class could have multiple annotations. + * + * @param classDefToken the CLASS_DEF AST node + * @return true if the class is annotated with @ServiceClient, false otherwise. + */ + private boolean hasServiceClientAnnotation(DetailAST classDefToken) { + // Always has MODIFIERS node + final DetailAST modifiersToken = classDefToken.findFirstToken(TokenTypes.MODIFIERS); + final Optional serviceClientAnnotationOption = TokenUtil.findFirstTokenByPredicate(modifiersToken, + node -> { + if (node.getType() != TokenTypes.ANNOTATION) { + return false; + } + final DetailAST annotationIdentToken = node.findFirstToken(TokenTypes.IDENT); + return annotationIdentToken != null && SERVICE_CLIENT.equals(annotationIdentToken.getText()); + } + ); + if (serviceClientAnnotationOption.isPresent()) { + isAsync = isAsyncServiceClient(serviceClientAnnotationOption.get()); + return true; + } + // If no @ServiceClient annotated with this class, return false + return false; + } + + /** + * Add all imported classes into a map, key is the name of class and value is the full package path of class. + * + * @param token the IMPORT AST node + */ + private void addImportedClassPath(DetailAST token) { + final String importClassPath = FullIdent.createFullIdentBelow(token).getText(); + final String className = importClassPath.substring(importClassPath.lastIndexOf(".") + 1); + simpleClassNameToQualifiedNameMap.put(className, importClassPath); + } + + /** + * A function checks if the annotation node has a member key is {@code IS_ASYNC} with value equals to 'true'. + * If the value equals 'true', which indicates the {@code @ServiceClient} is an asynchronous client. + * If the member pair is missing. By default, it is a synchronous service client. + * + * @param annotationToken the ANNOTATION AST node + * @return true if the annotation has {@code IS_ASYNC} value 'true', otherwise, false. + */ + private boolean isAsyncServiceClient(DetailAST annotationToken) { + for (DetailAST ast = annotationToken.getFirstChild(); ast != null; ast = ast.getNextSibling()) { + if (ast.getType() != TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR) { + continue; + } + + // skip this annotation member value pair if no IDENT found, since we are looking for member, 'isAsync'. + final DetailAST identToken = ast.findFirstToken(TokenTypes.IDENT); + if (identToken == null) { + continue; + } + + // skip this annotation member value pair if the member is not 'isAsync'. + if (!IS_ASYNC.equals(identToken.getText())) { + continue; + } + + // skip this annotation member value pair if the member has no EXPR value + final DetailAST exprToken = ast.findFirstToken(TokenTypes.EXPR); + if (exprToken == null) { + continue; + } + + // true if isAsync = true, false otherwise. + return exprToken.branchContains(TokenTypes.LITERAL_TRUE); + } + // By default, if the IS_ASYNC doesn't exist, the service client is a synchronous client. + return false; + } + + /** + * Get full name of return type. Such as Response, {@code Mono}. + * + * @param token a token could be a TYPE, TYPE_ARGUMENT, TYPE_ARGUMENTS token + * @param sb a StringBuilder that used to collect method return type. + */ + private StringBuilder getReturnType(DetailAST token, StringBuilder sb) { + for (DetailAST currentToken = token.getFirstChild(); currentToken != null; + currentToken = currentToken.getNextSibling()) { + switch (currentToken.getType()) { + case TokenTypes.TYPE_ARGUMENT: + case TokenTypes.TYPE_ARGUMENTS: + // Recursive call + getReturnType(currentToken, sb); + break; + default: + sb.append(currentToken.getText()); + } + } + return sb; + } +} diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientChecks.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientChecks.java deleted file mode 100644 index d5e15ce5f1f1..000000000000 --- a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientChecks.java +++ /dev/null @@ -1,179 +0,0 @@ -// 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.FullIdent; -import com.puppycrawl.tools.checkstyle.api.TokenTypes; -import com.puppycrawl.tools.checkstyle.utils.TokenUtil; - -/** - * Verifies that subclasses of ServiceClient meet a set of guidelines. - *
    - *
  1. No public or protected constructors
  2. - *
  3. Implements a public static method named builder
  4. - *
- */ -public class ServiceClientChecks extends AbstractCheck { - private static final String BUILDER_METHOD_NAME = "builder"; - private static final String SERVICE_CLIENT_CLASS_NAME = "com.azure.common.ServiceClient"; - - private static final String FAILED_TO_LOAD_MESSAGE = "%s class failed to load, ServiceClientChecks will be ignored."; - private static final String CONSTRUCTOR_ERROR_MESSAGE = "Descendants of ServiceClient cannot have public or protected constructors."; - private static final String BUILDER_ERROR_MESSAGE = "Descendants of ServiceClient must have a static method named builder."; - - private static final int[] TOKENS = new int[] { - TokenTypes.PACKAGE_DEF, - TokenTypes.CTOR_DEF, - TokenTypes.METHOD_DEF - }; - - private Class serviceClientClass; - private boolean extendsServiceClient; - private boolean hasStaticBuilder; - - @Override - public int[] getDefaultTokens() { - return getRequiredTokens(); - } - - @Override - public int[] getAcceptableTokens() { - return getRequiredTokens(); - } - - /** - * Array of tokens that trigger visitToken when the TreeWalker is traversing the AST. - * @return The list of tokens that trigger visitToken. - */ - @Override - public int[] getRequiredTokens() { - return TOKENS; - } - - @Override - public void init() { - try { - this.serviceClientClass = Class.forName(SERVICE_CLIENT_CLASS_NAME); - } catch (ClassNotFoundException ex) { - log(0, String.format(FAILED_TO_LOAD_MESSAGE, "ServiceClient")); - } - } - - /** - * Start of the TreeWalker traversal. - * @param rootAST Root of the AST. - */ - @Override - public void beginTree(DetailAST rootAST) { - this.extendsServiceClient = false; - this.hasStaticBuilder = false; - } - /** - * Processes a token from the required tokens list when the TreeWalker visits it. - * @param token Node in the AST. - */ - @Override - public void visitToken(DetailAST token) { - // Failed to load ServiceClient's class, don't validate anything. - if (this.serviceClientClass == null) { - return; - } - - switch (token.getType()) { - case TokenTypes.PACKAGE_DEF: - this.extendsServiceClient = extendsServiceClient(token); - break; - case TokenTypes.CTOR_DEF: - if (this.extendsServiceClient && visibilityIsPublicOrProtected(token)) { - log(token, CONSTRUCTOR_ERROR_MESSAGE); - } - break; - case TokenTypes.METHOD_DEF: - if (this.extendsServiceClient && !this.hasStaticBuilder && methodIsStaticBuilder(token)) { - this.hasStaticBuilder = true; - } - break; - default: - // Checkstyle complains if there's no default block in switch - break; - } - } - - /** - * End of the TreeWalker traversal. - * @param rootAST Root of the AST. - */ - @Override - public void finishTree(DetailAST rootAST) { - if (this.extendsServiceClient && !this.hasStaticBuilder) { - log(0, BUILDER_ERROR_MESSAGE); - } - } - - /** - * Determines if the class extends ServiceClient. - * @param packageDefinitionToken Package definition token. - * @return True if the package is not in "com.microsoft", the file is a class definition, and the class extends ServiceClient. - */ - private boolean extendsServiceClient(DetailAST packageDefinitionToken) { - String packageName = FullIdent.createFullIdent(packageDefinitionToken.findFirstToken(TokenTypes.DOT)).getText(); - if (packageName.startsWith("com.microsoft")) { - return false; - } - - DetailAST classDefinitionToken = packageDefinitionToken.findFirstToken(TokenTypes.CLASS_DEF); - if (classDefinitionToken == null) { - return false; - } - - String className = classDefinitionToken.findFirstToken(TokenTypes.IDENT).getText(); - try { - Class clazz = Class.forName(packageName + "." + className); - - return this.serviceClientClass.isAssignableFrom(clazz); - } catch (ClassNotFoundException ex) { - log(classDefinitionToken, String.format(FAILED_TO_LOAD_MESSAGE, className)); - return false; - } - } - - /** - * Checks if the constructor is using the public or protected scope. - * @param constructorToken Construction token. - * @return True if the constructor has a public or protected modifier token. - */ - private boolean visibilityIsPublicOrProtected(DetailAST constructorToken) { - DetailAST modifierToken = constructorToken.findFirstToken(TokenTypes.MODIFIERS); - - // No modifiers means package private. - if (modifierToken == null) { - return false; - } - - return TokenUtil.findFirstTokenByPredicate(modifierToken, - node -> node.getType() == TokenTypes.LITERAL_PUBLIC || node.getType() == TokenTypes.LITERAL_PROTECTED) - .isPresent(); - } - - /** - * Checks if the method node is public static and named builder. - * @param methodToken Method node - * @return True if the method is public static and is named builder - */ - private boolean methodIsStaticBuilder(DetailAST methodToken) { - DetailAST modifierToken = methodToken.findFirstToken(TokenTypes.MODIFIERS); - if (modifierToken == null) { - return false; - } - - if (modifierToken.findFirstToken(TokenTypes.LITERAL_STATIC) == null - || modifierToken.findFirstToken(TokenTypes.LITERAL_PUBLIC) == null) { - return false; - } - - return methodToken.findFirstToken(TokenTypes.IDENT).getText().equals(BUILDER_METHOD_NAME); - } -} diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java deleted file mode 100644 index 02669178d0ca..000000000000 --- a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceClientInstantiationCheck.java +++ /dev/null @@ -1,231 +0,0 @@ -// 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.FullIdent; -import com.puppycrawl.tools.checkstyle.api.TokenTypes; -import com.puppycrawl.tools.checkstyle.checks.naming.AccessModifier; -import com.puppycrawl.tools.checkstyle.utils.CheckUtil; - -/** - * Verify the classes with annotation @ServiceClient should have following rules: - *
    - *
  1. No public or protected constructors
  2. - *
  3. No public static method named 'builder'
  4. - *
  5. Since these classes are supposed to be immutable, all fields in the service client classes should be final.
  6. - *
- */ -public class ServiceClientInstantiationCheck extends AbstractCheck { - private static final String SERVICE_CLIENT = "ServiceClient"; - private static final String BUILDER = "builder"; - private static final String ASYNC_CLIENT = "AsyncClient"; - private static final String CLIENT = "Client"; - private static final String IS_ASYNC = "isAsync"; - - private static boolean hasServiceClientAnnotation; - private static boolean isAsync; - private static boolean isImplPackage; - - @Override - public int[] getDefaultTokens() { - return getRequiredTokens(); - } - - @Override - public int[] getAcceptableTokens() { - return getRequiredTokens(); - } - - @Override - public int[] getRequiredTokens() { - return new int[] { - TokenTypes.PACKAGE_DEF, - TokenTypes.CLASS_DEF, - TokenTypes.CTOR_DEF, - TokenTypes.METHOD_DEF, - TokenTypes.OBJBLOCK - }; - } - - @Override - public void beginTree(DetailAST root) { - hasServiceClientAnnotation = false; - isAsync = false; - isImplPackage = false; - } - - @Override - public void visitToken(DetailAST token) { - if (isImplPackage) { - return; - } - - switch (token.getType()) { - case TokenTypes.PACKAGE_DEF: - String packageName = FullIdent.createFullIdent(token.findFirstToken(TokenTypes.DOT)).getText(); - isImplPackage = packageName.contains(".implementation"); - break; - case TokenTypes.CLASS_DEF: - hasServiceClientAnnotation = hasServiceClientAnnotation(token); - if (hasServiceClientAnnotation) { - checkServiceClientNaming(token); - } - break; - case TokenTypes.CTOR_DEF: - if (hasServiceClientAnnotation) { - checkConstructor(token); - } - break; - case TokenTypes.METHOD_DEF: - if (hasServiceClientAnnotation) { - checkMethodName(token); - } - break; - case TokenTypes.OBJBLOCK: - if (hasServiceClientAnnotation) { - checkClassField(token); - } - break; - default: - // Checkstyle complains if there's no default block in switch - break; - } - } - - /** - * Checks if the class is annotated with annotation @ServiceClient. A class could have multiple annotations. - * - * @param classDefToken the CLASS_DEF AST node - * @return true if the class is annotated with @ServiceClient, false otherwise. - */ - private boolean hasServiceClientAnnotation(DetailAST classDefToken) { - // Always has MODIFIERS node - final DetailAST modifiersToken = classDefToken.findFirstToken(TokenTypes.MODIFIERS); - - for (DetailAST ast = modifiersToken.getFirstChild(); ast != null; ast = ast.getNextSibling()) { - if (ast.getType() != TokenTypes.ANNOTATION) { - continue; - } - // One class could have multiple annotations, return true if found one. - final DetailAST annotationIdent = ast.findFirstToken(TokenTypes.IDENT); - if (annotationIdent != null && SERVICE_CLIENT.equals(annotationIdent.getText())) { - isAsync = isAsyncServiceClient(ast); - return true; - } - } - // If no @ServiceClient annotated with this class, return false - return false; - } - - /** - * Checks for public or protected constructor for the service client class. - * Log error if the service client has public or protected constructor. - * - * @param ctorToken the CTOR_DEF AST node - */ - private void checkConstructor(DetailAST ctorToken) { - final DetailAST modifiersToken = ctorToken.findFirstToken(TokenTypes.MODIFIERS); - // find constructor's modifier accessibility, no public or protected constructor - final AccessModifier accessModifier = CheckUtil.getAccessModifierFromModifiersToken(modifiersToken); - if (accessModifier.equals(AccessModifier.PUBLIC) || accessModifier.equals(AccessModifier.PROTECTED)) { - log(modifiersToken, "@ServiceClient class should not have any public or protected constructor."); - } - } - - /** - * Checks for public static method named 'builder'. Should avoid to use method name, 'builder'. - * - * @param methodDefToken the METHOD_DEF AST node - */ - private void checkMethodName(DetailAST methodDefToken) { - final DetailAST methodNameToken = methodDefToken.findFirstToken(TokenTypes.IDENT); - if (!BUILDER.equals(methodNameToken.getText())) { - return; - } - - final DetailAST modifiersToken = methodDefToken.findFirstToken(TokenTypes.MODIFIERS); - // find method's modifier accessibility, should not have a public static method called 'builder' - final AccessModifier accessModifier = CheckUtil.getAccessModifierFromModifiersToken(modifiersToken); - if (accessModifier.equals(AccessModifier.PUBLIC) && modifiersToken.branchContains(TokenTypes.LITERAL_STATIC)) { - log(modifiersToken, "@ServiceClient class should not have a public static method named ''builder''."); - } - } - - /** - * Checks that the field variables in the @ServiceClient are final. ServiceClients should be immutable. - * - * @param objBlockToken the OBJBLOCK AST node - */ - private void checkClassField(DetailAST objBlockToken) { - for (DetailAST ast = objBlockToken.getFirstChild(); ast != null; ast = ast.getNextSibling()) { - if (TokenTypes.VARIABLE_DEF != ast.getType()) { - continue; - } - final DetailAST modifiersToken = ast.findFirstToken(TokenTypes.MODIFIERS); - // VARIABLE_DEF token will always MODIFIERS token. If there is no modifier at the variable, no child under - // MODIFIERS token. Also the previous sibling of OBJBLOCK will always be class name IDENT node. - if (!modifiersToken.branchContains(TokenTypes.FINAL)) { - log(modifiersToken, String.format("The variable field ''%s'' of class ''%s'' should be final. Classes annotated with @ServiceClient are supposed to be immutable.", - ast.findFirstToken(TokenTypes.IDENT).getText(), objBlockToken.getPreviousSibling().getText())); - } - } - } - - /** - * Checks for the class name of Service Client. It should be named AsyncClient or Client. - * - * @param classDefToken the CLASS_DEF AST node - */ - private void checkServiceClientNaming(DetailAST classDefToken) { - final String className = classDefToken.findFirstToken(TokenTypes.IDENT).getText(); - // Async service client - if (isAsync && !className.endsWith(ASYNC_CLIENT)) { - log(classDefToken, String.format("Async class ''%s'' must be named AsyncClient ", className)); - } - // Sync service client - if (!isAsync && !className.endsWith(CLIENT)) { - log(classDefToken, String.format("Sync class %s must be named Client.", className)); - } - } - - /** - * A function checks if the annotation node has a member key is {@code IS_ASYNC} with value equals to 'true'. - * If the value equals 'true', which indicates the @ServiceClient is an asynchronous client. - * If the member pair is missing. By default, it is a synchronous service client. - * - * @param annotationToken the ANNOTATION AST node - * @return true if the annotation has {@code IS_ASYNC} value 'true', otherwise, false. - */ - private boolean isAsyncServiceClient(DetailAST annotationToken) { - for (DetailAST ast = annotationToken.getFirstChild(); ast != null; ast = ast.getNextSibling()) { - if (ast.getType() != TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR) { - continue; - } - - // skip this annotation member value pair if no IDENT found, since we are looking for member, 'isAsync'. - final DetailAST identToken = ast.findFirstToken(TokenTypes.IDENT); - if (identToken == null) { - continue; - } - - // skip this annotation member value pair if the member is not 'isAsync'. - if (!IS_ASYNC.equals(identToken.getText())) { - continue; - } - - // skip this annotation member value pair if the member has no EXPR value - final DetailAST exprToken = ast.findFirstToken(TokenTypes.EXPR); - if (exprToken == null) { - continue; - } - - // true if isAsync = true, false otherwise. - return exprToken.branchContains(TokenTypes.LITERAL_TRUE); - } - // By default, if the IS_ASYNC doesn't exist, the service client is a synchronous client. - return false; - } -} diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceInterfaceCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceInterfaceCheck.java index 3ac00ff0cd08..381367d71a99 100644 --- a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceInterfaceCheck.java +++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ServiceInterfaceCheck.java @@ -85,8 +85,8 @@ private void checkServiceInterface(DetailAST interfaceDefToken) { Pattern serviceNamePattern = Pattern.compile("^[a-zA-Z0-9]{1,20}$"); if (!serviceNamePattern.matcher(nameValue).find()) { log(serviceInterfaceAnnotationNode, String.format( - "The ''name'' property of @ServiceInterface, ''%s'' should be non-empty, alphanumeric and not more than 10 characters", - nameValue)); + "The ''name'' property of @ServiceInterface, ''%s'' should be non-empty, alphanumeric and not more " + + "than 10 characters", nameValue)); } } diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ThrowFromClientLoggerCheck.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ThrowFromClientLoggerCheck.java new file mode 100644 index 000000000000..e3ca1b901450 --- /dev/null +++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/ThrowFromClientLoggerCheck.java @@ -0,0 +1,119 @@ +// 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.FullIdent; +import com.puppycrawl.tools.checkstyle.api.TokenTypes; + +import java.util.ArrayDeque; +import java.util.Collections; +import java.util.Queue; + +/** + * To throw an exception, Must throw it through a 'logger.logExceptionAsError', rather than by directly calling 'throw + * exception'. + * + * Skip check if throwing exception from + *
    + *
  1. Static method
  2. + *
  3. Static class
  4. + *
  5. Constructor
  6. + *
+ */ +public class ThrowFromClientLoggerCheck extends AbstractCheck { + private static final String LOGGER_LOG_EXCEPTION_AS_ERROR = "logger.logExceptionAsError"; + private static final String LOGGER_LOG_EXCEPTION_AS_WARNING = "logger.logExceptionAsWarning"; + private static final String THROW_LOGGER_EXCEPTION_MESSAGE = "Directly throwing an exception is disallowed. Must " + + "throw through ''ClientLogger'' API, either of ''%s'' or ''%s'' where ''logger'' is type of ClientLogger " + + "from Azure Core package."; + + // A LIFO queue stores the static status of class, skip this ThrowFromClientLoggerCheck if the class is static + private final Queue classStaticDeque = Collections.asLifoQueue(new ArrayDeque<>()); + // A LIFO queue stores the static status of method, skip this ThrowFromClientLoggerCheck if the method is static + private final Queue methodStaticDeque = Collections.asLifoQueue(new ArrayDeque<>()); + // The variable is used to indicate if current node is still inside of constructor. + private boolean isInConstructor = false; + + @Override + public int[] getDefaultTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getAcceptableTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getRequiredTokens() { + return new int[] { + TokenTypes.CLASS_DEF, + TokenTypes.CTOR_DEF, + TokenTypes.LITERAL_THROW, + TokenTypes.METHOD_DEF + }; + } + + @Override + public void leaveToken(DetailAST token) { + switch (token.getType()) { + case TokenTypes.CLASS_DEF: + classStaticDeque.poll(); + break; + case TokenTypes.CTOR_DEF: + isInConstructor = false; + break; + case TokenTypes.METHOD_DEF: + methodStaticDeque.poll(); + break; + default: + // Checkstyle complains if there's no default block in switch + break; + } + } + + @Override + public void visitToken(DetailAST token) { + switch (token.getType()) { + case TokenTypes.CLASS_DEF: + DetailAST modifiersToken = token.findFirstToken(TokenTypes.MODIFIERS); + classStaticDeque.offer(modifiersToken.branchContains(TokenTypes.LITERAL_STATIC)); + break; + case TokenTypes.CTOR_DEF: + isInConstructor = true; + break; + case TokenTypes.METHOD_DEF: + DetailAST methodModifiersToken = token.findFirstToken(TokenTypes.MODIFIERS); + methodStaticDeque.offer(methodModifiersToken.branchContains(TokenTypes.LITERAL_STATIC)); + break; + case TokenTypes.LITERAL_THROW: + // Skip check if the throw exception from static class, constructor or static method + if (classStaticDeque.isEmpty() || classStaticDeque.peek() || isInConstructor + || methodStaticDeque.isEmpty() || methodStaticDeque.peek()) { + return; + } + DetailAST methodCallToken = + token.findFirstToken(TokenTypes.EXPR).findFirstToken(TokenTypes.METHOD_CALL); + if (methodCallToken == null) { + log(token, String.format(THROW_LOGGER_EXCEPTION_MESSAGE, LOGGER_LOG_EXCEPTION_AS_ERROR, + LOGGER_LOG_EXCEPTION_AS_WARNING)); + return; + } + + String methodCallName = + FullIdent.createFullIdent(methodCallToken.findFirstToken(TokenTypes.DOT)).getText(); + if (!LOGGER_LOG_EXCEPTION_AS_ERROR.equals(methodCallName) + && !LOGGER_LOG_EXCEPTION_AS_WARNING.equals(methodCallName)) { + log(token, String.format(THROW_LOGGER_EXCEPTION_MESSAGE, LOGGER_LOG_EXCEPTION_AS_ERROR, + LOGGER_LOG_EXCEPTION_AS_WARNING)); + } + break; + default: + // Checkstyle complains if there's no default block in switch + break; + } + } +} diff --git a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/Utils.java b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/Utils.java index 5cc32d5249c2..903c0a706d6e 100644 --- a/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/Utils.java +++ b/eng/code-quality-reports/src/main/java/com/azure/tools/checkstyle/checks/Utils.java @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + package com.azure.tools.checkstyle.checks; import com.puppycrawl.tools.checkstyle.api.DetailAST; @@ -14,13 +17,23 @@ * Common utils amount custom checks */ public class Utils { + /* + * Set of modifiers that cannot be combined with final because it causes a violation. + */ private static final Set INVALID_FINAL_COMBINATION = Collections.unmodifiableSet(new HashSet<>(Arrays.asList( TokenTypes.LITERAL_TRANSIENT, - TokenTypes.LITERAL_VOLATILE + TokenTypes.LITERAL_VOLATILE, + TokenTypes.LITERAL_DEFAULT, + TokenTypes.LITERAL_PROTECTED ))); + /* + * Set of annotations that cannot be combined with modifier 'final' because it would break serialization. + */ private static final Set INVALID_FINAL_ANNOTATIONS = Collections.unmodifiableSet(new HashSet<>(Arrays.asList( - "JsonProperty" + "JsonProperty", + "JsonAlias", + "JacksonXmlProperty" ))); /** @@ -39,7 +52,7 @@ protected static boolean hasIllegalCombination(DetailAST modifiers) { Optional illegalCombination = TokenUtil.findFirstTokenByPredicate(modifiers, (node) -> { final int type = node.getType(); return INVALID_FINAL_COMBINATION.contains(node.getType()) || (TokenTypes.ANNOTATION == type - && INVALID_FINAL_ANNOTATIONS.contains(node.findFirstToken(TokenTypes.IDENT).getText())); + && INVALID_FINAL_ANNOTATIONS.contains(node.findFirstToken(TokenTypes.IDENT).getText())); }); return illegalCombination.isPresent(); diff --git a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml index 553c34ca080f..5ef1b8426a31 100755 --- a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml +++ b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml @@ -32,7 +32,7 @@ - + @@ -76,57 +76,122 @@ + + + - - - - - - - - + - - - - - - + + + + + + + + + + + + + - - - - - + + - - - + + - - + + + + + + + + + + + + - - - - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 d9856fa79891..048abcf4b52e 100755 --- a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml +++ b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml @@ -10,6 +10,11 @@ page at http://checkstyle.sourceforge.net/config.html --> + + + + + @@ -45,6 +50,13 @@ page at http://checkstyle.sourceforge.net/config.html --> + + + + + + + @@ -96,6 +108,8 @@ page at http://checkstyle.sourceforge.net/config.html --> + + @@ -267,6 +281,7 @@ page at http://checkstyle.sourceforge.net/config.html --> + @@ -274,39 +289,42 @@ page at http://checkstyle.sourceforge.net/config.html --> - - - - - - + - + 3) Since these classes are supposed to be immutable, all fields in the service client classes should be final. + + Also, verify all methods that have a @ServiceMethod annotation in a class annotated with @ServiceClient should + follow below rules: + 1) Follows method naming pattern. Refer to Java Spec. + 2) Methods should not have "Async" added to the method name + 3) The return type of async and sync clients should be as per guidelines: + 3.1) The return type for async collection should be of type? extends PagedFlux + 3.2) The return type for async single value should be of type? extends Mono + 3.3) The return type for sync collection should be of type? extends PagedIterable + 3.4) The return type for sync single value should be of type? extends Response --> + - + - + - + @@ -317,14 +335,55 @@ page at http://checkstyle.sourceforge.net/config.html --> 1) All fields must be final --> - + + + + + + + + + - + - + + + + + + + + + + + + + + + + + + + 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 6cfdbbd51923..3a406691ada4 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 @@ -65,6 +65,9 @@ + + + @@ -377,6 +380,7 @@ + @@ -446,18 +450,26 @@ - + + + + + + + + + @@ -476,6 +488,14 @@ + + + + + + + + @@ -509,10 +529,30 @@ + + + + + + + + + + + + + + + - + @@ -522,6 +562,7 @@ name="com.azure.data.appconfiguration.credentials.ConfigurationClientCredentials$AuthorizationHeaderProvider"/> + @@ -534,7 +575,40 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eng/jacoco-test-coverage/pom.xml b/eng/jacoco-test-coverage/pom.xml index bfe7f05dbccd..3360e808e496 100644 --- a/eng/jacoco-test-coverage/pom.xml +++ b/eng/jacoco-test-coverage/pom.xml @@ -10,7 +10,7 @@ com.azure azure-client-sdk-parent - 1.3.0 + 1.4.0 ../../pom.client.xml @@ -23,17 +23,22 @@ https://github.com/Azure/azure-sdk-for-java - 1.0.0-preview.4 - 1.0.0-preview.4 - 1.0.0-preview.4 - 1.0.0-preview.4 - 1.0.0-preview.3 - 1.0.0-preview.3 - 4.0.0-preview.3 - 5.0.0-preview.3 - 12.0.0-preview.3 - 12.0.0-preview.3 - 12.0.0-preview.3 + 1.0.0-preview.5 + 1.0.0-preview.5 + 1.0.0-preview.5 + 1.0.0-preview.5 + 1.0.0-preview.5 + 1.0.0-preview.4 + 1.0.0-preview.4 + 4.0.0-preview.4 + 5.0.0-preview.4 + 1.0.0-preview.2 + 12.0.0-preview.4 + 12.0.0-preview.4 + 12.0.0-preview.4 + 12.0.0-preview.4 + 12.0.0-preview.4 + 12.0.0-preview.4 @@ -60,6 +65,11 @@ azure-core-amqp ${azure-core.version} + + com.azure + azure-core-http-netty + ${azure-core-http-netty.version} + com.azure azure-core-management @@ -90,11 +100,26 @@ azure-messaging-eventhubs ${azure-messaging-eventhubs.version} + + com.azure + azure-messaging-eventhubs-checkpointstore-blob + ${azure-messaging-eventhubs-checkpointstore-blob.version} + + + com.azure + azure-storage-common + ${azure-storage-common.version} + com.azure azure-storage-blob ${azure-storage-blob.version} + + com.azure + azure-storage-blob-cryptography + ${azure-storage-blob-cryptography.version} + com.azure azure-storage-file @@ -105,6 +130,11 @@ azure-storage-queue ${azure-storage-queue.version} + + com.azure + azure-storage-queue-cryptography + ${azure-storage-queue-cryptography.version} + diff --git a/eng/pipelines/client.yml b/eng/pipelines/client.yml index af090116b59d..0c9912c5bf49 100644 --- a/eng/pipelines/client.yml +++ b/eng/pipelines/client.yml @@ -36,7 +36,7 @@ jobs: inputs: mavenPomFile: $(pomFile) goals: 'package' - options: '$(DefaultOptions) $(ProfileFlag) "-DpackageOutputDirectory=$(Build.ArtifactStagingDirectory)" -Dmaven.test.skip=true -Dinclude-template' # We include template-module so we ensure it always builds in CI + options: '$(DefaultOptions) $(ProfileFlag) "-DpackageOutputDirectory=$(Build.ArtifactStagingDirectory)" -DskipTests -Dinclude-template' # We include template-module so we ensure it always builds in CI mavenOptions: '$(LoggingOptions)' javaHomeOption: 'JDKVersion' jdkVersionOption: $(JavaVersion) @@ -202,7 +202,7 @@ jobs: ProfileFlag: '' Windows - Java 8: OSName: 'Windows' - OSVmImage: 'vs2017-win2016' + OSVmImage: 'windows-2019' JavaVersion: '1.8' ProfileFlag: '' Linux - Java LTS: @@ -217,7 +217,7 @@ jobs: ProfileFlag: '-Djava-lts' Windows - Java LTS: OSName: 'Windows' - OSVmImage: 'vs2017-win2016' + OSVmImage: 'windows-2019' JavaVersion: '1.11' ProfileFlag: '-Djava-lts' diff --git a/eng/pipelines/mgmt.yml b/eng/pipelines/mgmt.yml index c9c850dcc820..45f84e7cee2c 100644 --- a/eng/pipelines/mgmt.yml +++ b/eng/pipelines/mgmt.yml @@ -1,6 +1,19 @@ trigger: - - master - + branches: + include: + - master + paths: + exclude: + - sdk/ + +pr: + branches: + include: + - master + paths: + exclude: + - sdk/ + variables: MavenGoals: 'clean,compile' diff --git a/eng/pipelines/smoke-test.yml b/eng/pipelines/smoke-test.yml new file mode 100644 index 000000000000..d3aecfb1c19d --- /dev/null +++ b/eng/pipelines/smoke-test.yml @@ -0,0 +1,48 @@ +jobs: + - job: SmokeTest + variables: + - template: ./templates/variables/globals.yml + - name: PomFile + value: eng/smoke-tests/pom.xml + + strategy: + matrix: + Java 8: + ProfileFlag: '' + JavaVersion: '1.8' + Java LTS: + ProfileFlag: '-Djava-lts' + JavaVersion: '1.11' + + steps: + - task: Maven@3 + displayName: 'Build and Package' + inputs: + mavenPomFile: $(PomFile) + goals: 'package' + options: '$(DefaultOptions) $(ProfileFlag) -DskipTests' + javaHomeOption: 'JDKVersion' + jdkVersionOption: $(JavaVersion) + jdkArchitectureOption: 'x64' + publishJUnitResults: false + + - task: Maven@3 + displayName: 'Run Smoke Tests' + inputs: + mavenPomFile: $(PomFile) + goals: 'exec:java' + options: '$(DefaultOptions) $(ProfileFlag) -Dexec.mainClass="com.azure.App"' + javaHomeOption: 'JDKVersion' + jdkVersionOption: $(JavaVersion) + jdkArchitectureOption: 'x64' + publishJUnitResults: false + env: + AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret) + AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id) + AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id) + AZURE_PROJECT_URL: $(smoke-tests-key-vault-project-url) + AZURE_EVENT_HUBS_CONNECTION_STRING: $(smoke-tests-event-hubs-connection-string) + AZURE_STORAGE_CONNECTION_STRING: $(smoke-tests-storage-connection-string) + AZURE_COSMOS_KEY: $(smoke-tests-cosmos-key) + AZURE_COSMOS_ENDPOINT: $(smoke-tests-cosmos-endpoint) + AZURE_LOG_LEVEL: 2 \ No newline at end of file diff --git a/eng/pipelines/templates/jobs/archetype-sdk-client.yml b/eng/pipelines/templates/jobs/archetype-sdk-client.yml index 06ce79cd972c..638ac201fc3d 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-client.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-client.yml @@ -16,7 +16,7 @@ parameters: ProfileFlag: '' Windows - Java 8: OSName: 'Windows' - OSVmImage: 'vs2017-win2016' + OSVmImage: 'windows-2019' JavaVersion: '1.8' ProfileFlag: '' Linux - Java LTS: @@ -31,7 +31,7 @@ parameters: ProfileFlag: '-Djava-lts' Windows - Java LTS: OSName: 'Windows' - OSVmImage: 'vs2017-win2016' + OSVmImage: 'windows-2019' JavaVersion: '1.11' ProfileFlag: '-Djava-lts' @@ -61,13 +61,15 @@ jobs: displayName: 'Tag scheduled builds' condition: and(eq(variables['Build.SourceBranchName'],'master'),eq(variables['Build.Reason'],'Schedule')) + - template: ../steps/cache-maven-repository.yml + - task: Maven@3 displayName: 'Build and Package' inputs: mavenPomFile: sdk/${{parameters.ServiceDirectory}}/pom.service.xml goals: 'package' - options: '$(DefaultOptions) $(ProfileFlag) "-DpackageOutputDirectory=$(Build.ArtifactStagingDirectory)" -Dmaven.test.skip=true -Dinclude-template' # We include template-module so we ensure it always builds in CI - mavenOptions: '$(LoggingOptions)' + options: '$(DefaultOptions) $(ProfileFlag) "-DpackageOutputDirectory=$(Build.ArtifactStagingDirectory)" -DskipTests -Dinclude-template' # We include template-module so we ensure it always builds in CI + mavenOptions: '$(MemoryOptions) $(LoggingOptions)' javaHomeOption: 'JDKVersion' jdkVersionOption: $(JavaVersion) jdkArchitectureOption: 'x64' @@ -79,6 +81,7 @@ jobs: - job: 'Analyze' + condition: ne(variables['Skip.Analyze'], 'true') variables: - template: ../variables/globals.yml @@ -110,14 +113,26 @@ jobs: - template: ../steps/install-reporting-tools.yml parameters: Options: --batch-mode - MavenOptions: $(LoggingOptions) + MavenOptions: $(MemoryOptions) $(LoggingOptions) + + - task: Maven@3 + displayName: 'Install azure-sdk-parent' + inputs: + mavenPomFile: parent/pom.xml + options: '$(DefaultOptions) -DskipTests -Dgpg.skip' + mavenOptions: '$(MemoryOptions) $(LoggingOptions)' + javaHomeOption: 'JDKVersion' + jdkVersionOption: '1.11' + jdkArchitectureOption: 'x64' + publishJUnitResults: false + goals: 'install' - task: Maven@3 displayName: 'Install all client libraries (for SpotBugs analysis)' inputs: mavenPomFile: pom.client.xml options: '$(DefaultOptions) -Djava-lts -DskipTests -Dgpg.skip -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true' - mavenOptions: '$(LoggingOptions)' + mavenOptions: '$(MemoryOptions) $(LoggingOptions)' javaHomeOption: 'JDKVersion' jdkVersionOption: '1.11' jdkArchitectureOption: 'x64' @@ -141,11 +156,10 @@ jobs: # running as a PR check. - task: Maven@3 displayName: 'Generate Maven project site, including JavaDocs, SpotBugs, and CheckStyle reports' - condition: ne(variables['Build.Reason'], 'PullRequest') inputs: mavenPomFile: pom.client.xml options: '$(DefaultOptions) -Djava-lts -DskipTests -Dgpg.skip' - mavenOptions: '$(LoggingOptions)' + mavenOptions: '$(MemoryOptions) $(LoggingOptions)' javaHomeOption: 'JDKVersion' jdkVersionOption: '1.11' jdkArchitectureOption: 'x64' @@ -153,14 +167,13 @@ jobs: goals: 'install site:site site:stage' # We run a separate SpotBugs aggregate report step here to roll-up all the issues identified per-module in the - # previous step. This is only generated in non-PR builds (i.e. nightly runs, etc) + # previous step. - task: Maven@3 displayName: 'Run SpotBugs' - condition: ne(variables['Build.Reason'], 'PullRequest') inputs: mavenPomFile: eng/spotbugs-aggregate-report/pom.xml options: '--batch-mode -Djava-lts -DskipTests -Dgpg.skip' - mavenOptions: '$(LoggingOptions)' + mavenOptions: '$(MemoryOptions) $(LoggingOptions)' javaHomeOption: 'JDKVersion' jdkVersionOption: '1.11' jdkArchitectureOption: 'x64' @@ -172,24 +185,12 @@ jobs: mkdir input && cp dependencies.json input/ displayName: 'Download dependency checker' - - task: Maven@3 - displayName: 'Install azure-sdk-parent' - inputs: - mavenPomFile: parent/pom.xml - options: '$(DefaultOptions) -DskipTests -Dgpg.skip' - mavenOptions: '$(LoggingOptions)' - javaHomeOption: 'JDKVersion' - jdkVersionOption: '1.11' - jdkArchitectureOption: 'x64' - publishJUnitResults: false - goals: 'install' - - task: Maven@3 displayName: 'Analyze dependencies' inputs: mavenPomFile: 'DependencyChecker/pom.xml' options: '-Dexec.args="-showall -dependencymanagement"' - mavenOptions: '$(LoggingOptions)' + mavenOptions: '$(MemoryOptions) $(LoggingOptions)' javaHomeOption: 'JDKVersion' jdkVersionOption: '1.11' jdkArchitectureOption: 'x64' @@ -226,12 +227,15 @@ jobs: parameters: OSName: $(OSName) + - template: ../steps/cache-maven-repository.yml + - task: Maven@3 displayName: 'Start Jetty' + condition: ne(variables['SdkType'], 'client') inputs: mavenPomFile: pom.client.xml options: '$(DefaultOptions) $(ProfileFlag)' - mavenOptions: '$(LoggingOptions)' + mavenOptions: '$(MemoryOptions) $(LoggingOptions)' javaHomeOption: 'JDKVersion' jdkVersionOption: $(JavaVersion) jdkArchitectureOption: 'x64' @@ -245,7 +249,7 @@ jobs: inputs: mavenPomFile: sdk/${{parameters.ServiceDirectory}}/pom.service.xml options: ${{ parameters.TestOptions }} - mavenOptions: '-Xmx3072m $(LoggingOptions)' + mavenOptions: '$(MemoryOptions) $(LoggingOptions)' javaHomeOption: 'JDKVersion' jdkVersionOption: $(JavaVersion) jdkArchitectureOption: 'x64' diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests-pre-sdk.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests-pre-sdk.yml index 39f6941e5c8a..a6c2c36cecd8 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests-pre-sdk.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests-pre-sdk.yml @@ -8,7 +8,7 @@ jobs: - job: 'LiveTest' pool: - vmImage: 'vs2017-win2016' + vmImage: 'windows-2019' steps: - task: Maven@3 diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index e42186eac993..2fd7ef55242e 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -4,13 +4,13 @@ parameters: MaxParallel: 0 Matrix: Win2016: - OSVmImage: 'vs2017-win2016' + OSVmImage: 'windows-2019' DisplayName: 'Run Live tests' PreRunSteps: [] TestName: LiveTest TimeoutInMinutes: 60 TestStepMavenInputs: - options: '--batch-mode -Dmaven.wagon.http.pool=false -Dsurefire.rerunFailingTestsCount=3 --settings eng/settings.xml' + options: '--batch-mode --fail-at-end -Dmaven.wagon.http.pool=false -Dsurefire.rerunFailingTestsCount=3 --settings eng/settings.xml' mavenOptions: '-Xmx3072m -Dorg.slf4j.simpleLogger.defaultLogLevel=error -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' javaHomeOption: 'JDKVersion' jdkVersionOption: '1.8' @@ -23,6 +23,8 @@ jobs: - job: ${{ parameters.TestName }} timeoutInMinutes: ${{ parameters.TimeoutInMinutes }} + variables: + - template: ../variables/globals.yml strategy: matrix: ${{ parameters.Matrix }} maxParallel: ${{ parameters.MaxParallel }} @@ -46,4 +48,4 @@ jobs: mergeTestResults: true testRunTitle: 'Live tests for ${{ parameters.ServiceDirectory }} $(DisplayName)' ${{ if ne(parameters.TestResultsFiles, '') }}: - testResultsFiles: ${{ parameters.TestResultsFiles }} \ No newline at end of file + testResultsFiles: ${{ parameters.TestResultsFiles }} diff --git a/eng/pipelines/templates/stages/cosmos-sdk-client.yml b/eng/pipelines/templates/stages/cosmos-sdk-client.yml new file mode 100644 index 000000000000..4ac907f97669 --- /dev/null +++ b/eng/pipelines/templates/stages/cosmos-sdk-client.yml @@ -0,0 +1,118 @@ +parameters: + Artifacts: [] + ServiceDirectory: not-specified + +stages: + - stage: Build + jobs: + - template: ../jobs/archetype-sdk-client.yml + parameters: + ServiceDirectory: ${{parameters.ServiceDirectory}} + TestMatrix: + Windows - java8: + OSVmImage: 'windows-2019' + JavaVersion: '1.8' + OSName: Windows + ProfileFlag: '-Punit' + MacOS - java8: + OSVmImage: 'macOS-10.13' + JavaVersion: '1.8' + OSName: macOS + ProfileFlag: '-Punit' + PreTestSteps: + - template: ../steps/install-reporting-tools.yml + + - template: ../jobs/archetype-sdk-tests.yml + parameters: + TestName: Emulator + ServiceDirectory: cosmos + Matrix: + Tcp_Integration_Tests_Java8: + OSVmImage: 'windows-2019' + JavaVersion: '1.8' + ProfileFlag: '-Pemulator' + DisplayName: 'Emulator only Integration Tests' + PROTOCOLS: '["Tcp"]' + DESIRED_CONSISTENCIES: '["Strong", "Session"]' + Https_Integration_Tests_Java8: + OSVmImage: 'windows-2019' + JavaVersion: '1.8' + ProfileFlag: '-Pemulator' + DisplayName: 'Emulator only Integration Tests' + PROTOCOLS: '["Https"]' + DESIRED_CONSISTENCIES: '["Strong", "Session"]' + Examples_Integration_Tests_Java8: + OSVmImage: 'windows-2019' + JavaVersion: '1.8' + ProfileFlag: '-Pexamples' + DisplayName: 'Examples Integration Tests' + PROTOCOLS: '["Https", "Tcp"]' + DESIRED_CONSISTENCIES: '["Strong", "Session"]' + + TestStepMavenInputs: + goals: 'verify' + options: '$(ProfileFlag) -Dgpg.skip -DargLine="-DACCOUNT_HOST=https://localhost:8081/"' + mavenAuthenticateFeed: true + jdkVersionOption: $(JavaVersion) + + PreRunSteps: + - powershell: | + Write-Host "Downloading Cosmos Emulator - $(EmulatorMsiUrl)" + wget "$(EmulatorMsiUrl)" -outfile "$env:temp\azure-cosmosdb-emulator.msi" + Write-Host "Finished Downloading Cosmos Emulator - $env:temp\azure-cosmosdb-emulator.msi" + dir "$env:temp" + displayName: 'Download Public Cosmos DB Emulator' + + - script: | + choco install lessmsi + choco upgrade lessmsi + mkdir "%TEMP%\Azure Cosmos DB Emulator" + lessmsi x "%TEMP%\azure-cosmosdb-emulator.msi" "%TEMP%\Azure Cosmos DB Emulator\" + displayName: 'Install Public Cosmos DB Emulator' + + - powershell: | + Write-Host "Starting Comsos DB Emulator" + Start-Process "$env:Temp\Azure Cosmos DB Emulator\SourceDir\Azure Cosmos DB Emulator\CosmosDB.Emulator.exe" "/NoExplorer /NoUI /DisableRateLimiting /PartitionCount=100 /Consistency=Strong" -Verb RunAs + displayName: 'Run Public Cosmos DB Emulator' + + - powershell: | + Import-Module "$env:Temp\Azure Cosmos DB Emulator\SourceDir\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator" + + Do { + sleep 5 + $cosmosStatus = Get-CosmosDbEmulatorStatus + Write-Host "Cosmos Status: $cosmosStatus" + } While ($cosmosStatus -ne 'Running') + + Write-Host "Done" + displayName: 'Check Public Cosmos DB Emulator Status' + + - powershell: | + $Key = 'C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==' + $password = ConvertTo-SecureString -String $Key -Force -AsPlainText + $cert = Get-ChildItem cert:\LocalMachine\My | Where-Object { $_.FriendlyName -eq "DocumentDbEmulatorCertificate" } + Export-PfxCertificate -Cert $cert -FilePath ".\CosmosDbEmulatorCert.pfx" -Password $password | Out-Null + $cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 + $cert.Import(".\CosmosDbEmulatorCert.pfx", $Key, "DefaultKeySet") + $cert | Export-Certificate -FilePath "$env:temp\CosmosDbEmulatorCert.cer" -Type CERT + displayName: 'Export Cosmos DB Emulator Certificate' + + - powershell: | + cd $env:java_home\jre\lib\security + cp $env:temp\CosmosDbEmulatorCert.cer . + keytool -keystore cacerts -importcert -noprompt -trustcacerts -alias CosmosDbEmulatorCert -file CosmosDbEmulatorCert.cer -storepass changeit + displayName: 'Create Java TrustStore' + + # We `install` separately from running `site:site site:stage` so that the `install` brings in the non-shipping-modules, + # but we don't include them in the Maven site commands (so that we don't generate reports for the non-shipping modules). + - template: ../steps/install-reporting-tools.yml + + # The Prerelease and Release stages are conditioned on whether we are building a pull request and the branch. + - ${{if and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal'))}}: + - template: pipelines/stages/archetype-java-release.yml@azure-sdk-build-tools + parameters: + DependsOn: Build + Artifacts: ${{parameters.Artifacts}} + ArtifactName: packages + + \ No newline at end of file diff --git a/eng/pipelines/templates/steps/cache-maven-repository.yml b/eng/pipelines/templates/steps/cache-maven-repository.yml new file mode 100644 index 000000000000..a5354397d894 --- /dev/null +++ b/eng/pipelines/templates/steps/cache-maven-repository.yml @@ -0,0 +1,15 @@ +steps: +- script: | + echo "##vso[task.setvariable variable=Maven.RepositoryPath;]%USERPROFILE%\.m2\repository" + condition: eq(variables['Agent.OS'], 'Windows_NT') + displayName: Detecting Maven repository on Windows +- script: | + echo "##vso[task.setvariable variable=Maven.RepositoryPath;]$HOME/.m2/repository" + condition: ne(variables['Agent.OS'], 'Windows_NT') + displayName: Detecting Maven repository on Linux and macOS +- task: CacheBeta@0 + inputs: + key: $(Agent.JobName)|$(CacheSalt)|$(Build.SourcesDirectory)/sdk/**/pom.xml|$(Build.SourcesDirectory)/pom*.xml|$(Build.SourcesDirectory)/parent/pom.xml + path: $(Maven.RepositoryPath) + displayName: 'Download/upload cache' + condition: ne(variables['EnableCaching'], 'false') \ No newline at end of file diff --git a/eng/pipelines/templates/variables/globals.yml b/eng/pipelines/templates/variables/globals.yml index 72a7e440ad3f..82e14a0b4207 100644 --- a/eng/pipelines/templates/variables/globals.yml +++ b/eng/pipelines/templates/variables/globals.yml @@ -1,5 +1,7 @@ variables: - DefaultOptions: '--batch-mode -Dmaven.wagon.http.pool=false --settings eng/settings.xml' + DefaultOptions: '--batch-mode --fail-at-end --settings eng/settings.xml' LoggingOptions: '-Dorg.slf4j.simpleLogger.defaultLogLevel=error -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' - Agent.Source.Git.ShallowFetchDepth: 1 - skipComponentGovernanceDetection: true \ No newline at end of file + MemoryOptions: '-Xmx3072m' + #Agent.Source.Git.ShallowFetchDepth: 1 + skipComponentGovernanceDetection: true + EmulatorMsiUrl: 'https://acpedaily1.blob.core.windows.net/emulator/azure-cosmos-emulator.msi' diff --git a/eng/smoke-tests/README.md b/eng/smoke-tests/README.md new file mode 100644 index 000000000000..8c81bcb61e4e --- /dev/null +++ b/eng/smoke-tests/README.md @@ -0,0 +1,135 @@ +# Azure Smoke Test for Java +This sample code is a smoke test to ensure that Azure Preview for Java work while loaded into the same process by performing 2 or more actions with them. + +Libraries tested: +* keyvault-secrets +* identity +* storage-blob +* event-hubs +* cosmos + +## Getting started +### Setup Azure resources +For this sample, it is necessary to create/have the following resources in the [Azure Portal](https://portal.azure.com/): +* **App registration**: Register a new app or use an existing one. + * Under _Certificates & secrets_ create a new **client secret** and store the value in a safe place. +* **Key Vaults**: Create a new Key Vault resource or use an existing one. + * Under _Access policies_, add the app registrated in the previous step. +* **Storage acounts**: Create a container in a new or existing storage account. The container in this sample is named "mycontainer", if you want to use other name you can change the value in `BlobStorage.ts` file: +`const containerName = "mycontainer";` +* **Event Hubs**: Create an event hub inside a new or existing Event Hubs Namespace. The container in this sample is named "myeventhub", if you want to use other name you can change the value in `EventHubsTest.ts` file: `let eventHubName = "myeventhub";` +* **Azure Cosmos DB**: Create a new account or use an existing one. + +### Azure credentials +The following environment variables are needed: +* From **App Registration**, in the _Overview_ section: + * AZURE_TENANT_ID: The directory tentant ID. + * AZURE_CLIENT_ID: The application ID. + * AZURE_CLIENT_SECRET: The client secret stored previusly when creating the _client secret_. + +* From **Key Vault**, in the _Overview_ section: + * AZURE_PROJECT_URL: The DNS Name + +* From **Event Hubs**, in _Shared access policies_ section: + * AZURE_EVENT_HUBS_CONNECTION_STRING: Connection string from a policy + +* From **Storage Account**, in the _Access Keys_ section: + * AZURE_STORAGE_CONNECTION_STRING : A connection strings. + +* From **Azure Cosmos DB**, in the _Keys_ section, select the _Read-Write Keys_ tab: + * AZURE_COSMOS_ENDPOINT: URI. + * AZURE_COSMOS_KEY: Primary or secondary key. + +```bash +# Bash code to create the environment variables +export AZURE_CLIENT_ID="" +export AZURE_CLIENT_SECRET="" +export AZURE_TENANT_ID="" +export AZURE_EVENT_HUBS_CONNECTION_STRING="" +export AZURE_AZURE_PROJECT_URL="" +export AZURE_STORAGE_CONNECTION_STRING="" +export AZURE_COSMOS_ENDPOINT="" +export AZURE_COSMOS_KEY="" +``` +### Client Logger +The Azure clients use a ClientLogger. Create an environment variable `AZURE_LOG_LEVEL` and set it to the desire level: +* Verbose = 1 +* Informational = 2 +* Warnings = 3 +* Errors = 4 +* Disabled = 5 + +### Running the console app +[Java](https://www.java.com/en/) version 11.0.4 was used to run this sample. + +Install Maven dependencies: + +Run `App.main()`: + + +## Key concepts + +## Examples +All the classes in this sample not depend on each other. + +It is possible to run them individually: +```java +package com.azure; +import java.io.IOException; + +public class App { + public static void main(String[] args) throws IllegalArgumentException, IOException { + StorageBlob.main(null); + } +} +``` + +The classes can be used as base code and be changed to satisfied specific needs. For example, the method `EventHubs().sendAndReceiveEvents()` can be change to only send events from an array given from a parameter: +```java +private void sendEvents(String partitionId, Flux events) { + EventHubProducer producer = client.createProducer(new EventHubProducerOptions().partitionId(partitionId)); + + producer.send(events).subscribe( + (ignored) -> logger.info("sent"), + error -> logger.error("Error received:" + error), + () -> { + //Closing the producer once is done with sending the events + try { + producer.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + ); + } +``` + +**Note:** The methods in the classes are not necessary independent on each other, and the order matters. For example, in order to run `StorageBlob.deleteBlob();`, the method `StorageBlob.uploadBLob();` must be run before, since in the other way it will fail because there is not going to be a blob to delete. + +## Troubleshooting + +### Authentication +Be sure to set the environment variables and credentials required before running the sample. + +### SLF4J Logger +Be sure to include the SLF4J dependency in the `pom.xml` file. + +```xml + + org.slf4j + slf4j-simple + 1.7.28 + +``` + +## Next steps +Check the [Azure SDK for Java Repository](https://github.com/Azure/azure-sdk-for-java) for more samples. + +## Contributing +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com. + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. + +If you'd like to contribute to this library, please read the contributing guide to learn more about how to build and test the code. + +This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments. diff --git a/eng/smoke-tests/pom.xml b/eng/smoke-tests/pom.xml new file mode 100644 index 000000000000..a190d3297de2 --- /dev/null +++ b/eng/smoke-tests/pom.xml @@ -0,0 +1,73 @@ + + + 4.0.0 + com.azure + smoke-test + 1.0-SNAPSHOT + smoke-test + https://github.com/Azure/azure-sdk-for-java + + UTF-8 + 1.8 + 1.8 + + + + + junit + junit + 4.11 + test + + + + com.microsoft.azure + azure-cosmos + 3.1.0 + + + + com.azure + azure-identity + 1.0.0-preview.2 + + + + com.azure + azure-keyvault-secrets + 4.0.0-preview.2 + + + + com.azure + azure-messaging-eventhubs + 5.0.0-preview.2 + + + + com.azure + azure-storage-blob + 12.0.0-preview.2 + + + + org.slf4j + slf4j-simple + 1.7.28 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + + + diff --git a/eng/smoke-tests/src/main/java/com/azure/App.java b/eng/smoke-tests/src/main/java/com/azure/App.java new file mode 100644 index 000000000000..ba5978475f59 --- /dev/null +++ b/eng/smoke-tests/src/main/java/com/azure/App.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure; + +import java.io.IOException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class App { + private static final Logger LOGGER = LoggerFactory.getLogger(App.class); + + public static void main(String[] args) throws IllegalArgumentException, IOException { + LOGGER.info("================================"); + LOGGER.info(" AZURE SDK SMOKE TEST"); + LOGGER.info("================================"); + + KeyVaultSecrets.main(null); + StorageBlob.main(null); + EventHubs.main(null); + CosmosDB.main(null); + + } +} diff --git a/eng/smoke-tests/src/main/java/com/azure/CosmosDB.java b/eng/smoke-tests/src/main/java/com/azure/CosmosDB.java new file mode 100644 index 000000000000..b19b96bb1ac1 --- /dev/null +++ b/eng/smoke-tests/src/main/java/com/azure/CosmosDB.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure; + +import com.azure.data.cosmos.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.Arrays; +import java.util.List; +import java.util.UUID; + +public class CosmosDB { + private static final String DB_NAME = "JavaSolarSystem-" + UUID.randomUUID(); + private static final String COLLECTION_NAME = "Planets"; + + private static final String AZURE_COSMOS_ENDPOINT = System.getenv("AZURE_COSMOS_ENDPOINT"); + private static final String AZURE_COSMOS_KEY= System.getenv("AZURE_COSMOS_KEY"); + + private static final Logger LOGGER = LoggerFactory.getLogger(CosmosDB.class); + + private static Mono createDatabase(CosmosClient client) { + LOGGER.info("Creating database '{}'... ", DB_NAME); + return client.createDatabaseIfNotExists(DB_NAME).then(); + } + + private static Mono createCollection(CosmosClient client) { + LOGGER.info("Creating collection '{}'... ", COLLECTION_NAME); + return client.getDatabase(DB_NAME).createContainer(COLLECTION_NAME, "/id") + .map(response -> response.container()); + } + + private static Mono createDocuments(CosmosContainer container) { + LOGGER.info("Inserting Items... "); + List planets = Arrays.asList( + new Planet( + "Earth", + false, + 3959, + new Moon[]{ + new Moon("Moon") + }), + new Planet( + "Mars", + false, + 2106, + new Moon[]{ + new Moon("Phobos"), + new Moon("Deimos") + }) + ); + + return Flux.fromIterable(planets).flatMap(planet -> container.createItem(planet)).then(); + } + + private static Mono simpleQuery(CosmosContainer container) { + LOGGER.info("Querying collection..."); + FeedOptions options = new FeedOptions().enableCrossPartitionQuery(true); + Flux> queryResults = container.queryItems("SELECT c.id FROM c", options); + + return queryResults.map(cosmosItemPropertiesFeedResponse -> { + LOGGER.info("\t{}",cosmosItemPropertiesFeedResponse.results().toString()); + return cosmosItemPropertiesFeedResponse; + }).then(); + } + + private static Mono deleteDatabase(CosmosClient client) { + LOGGER.info("Cleaning up the resource..."); + return client.getDatabase(DB_NAME).delete().then(); + } + + public static void main(String[] args) { + LOGGER.info("---------------------"); + LOGGER.info("COSMOS DB"); + LOGGER.info("---------------------"); + + CosmosClient client = CosmosClient + .builder().endpoint(AZURE_COSMOS_ENDPOINT) + .key(AZURE_COSMOS_KEY) + .build(); + + try { + //if the database already exists, it is going to be deleted with all its content. + deleteDatabase(client).block(); + } catch (Exception e) { + //This means that the database does not exists already, it's fine + } + + try { + createDatabase(client) + .then(createCollection(client)) + .flatMap(collection -> createDocuments(collection) + .then(simpleQuery(collection)) + ) + .block(); + } finally { + deleteDatabase(client).block(); + client.close(); + } + } +} + +// Classes for this sample +class Planet { + public String id; + public boolean hasRings; + public int radius; + public Moon[] moons; + + public Planet(String id, boolean hasRings, int radius, Moon[] moons) { + this.id = id; + this.hasRings = hasRings; + this.radius = radius; + this.moons = moons; + } +} + +class Moon { + public String name; + + public Moon(String name) { + this.name = name; + } + +} diff --git a/eng/smoke-tests/src/main/java/com/azure/EventHubs.java b/eng/smoke-tests/src/main/java/com/azure/EventHubs.java new file mode 100644 index 000000000000..0628eb927d48 --- /dev/null +++ b/eng/smoke-tests/src/main/java/com/azure/EventHubs.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure; + +import com.azure.messaging.eventhubs.EventHubClientBuilder; +import com.azure.messaging.eventhubs.EventHubAsyncClient; +import com.azure.messaging.eventhubs.EventHubConsumer; +import com.azure.messaging.eventhubs.EventHubProducer; +import com.azure.messaging.eventhubs.EventData; +import com.azure.messaging.eventhubs.models.EventHubProducerOptions; +import com.azure.messaging.eventhubs.models.EventPosition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import reactor.core.Disposable; +import reactor.core.publisher.Flux; + +import java.time.Duration; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; + + +public class EventHubs { + private static final String EVENT_HUBS_CONNECTION_STRING = System.getenv("AZURE_EVENT_HUBS_CONNECTION_STRING"); + private static EventHubAsyncClient client; + + private static final Logger LOGGER = LoggerFactory.getLogger(EventHubs.class); + + private static String getPartitionID() { + LOGGER.info("Getting partition id... "); + Flux partitions = client.getPartitionIds(); + LOGGER.info("\tDONE."); + //In ths sample, the events are going to be send and consume from the first partition. + return partitions.blockFirst(); + } + + private static void sendAndReceiveEvents(String partitionId) { + LOGGER.info("Creating consumer... "); + EventHubConsumer consumer = client.createConsumer( + EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME, + partitionId, + EventPosition.latest()); + LOGGER.info("\tDONE."); + + LOGGER.info("Creating producer... "); + EventHubProducer producer = client.createProducer(new EventHubProducerOptions().partitionId(partitionId)); + LOGGER.info("\tDONE."); + + LOGGER.info("Sending Events... "); + Flux events = Flux.just( + new EventData(("Test event 1 in Java").getBytes(StandardCharsets.UTF_8)), + new EventData(("Test event 2 in Java").getBytes(StandardCharsets.UTF_8)), + new EventData(("Test event 3 in Java").getBytes(StandardCharsets.UTF_8)) + ); + + producer.send(events).subscribe( + (ignored) -> LOGGER.info("sent"), + error -> LOGGER.error("Error received:" + error), + () -> { + //Closing the producer once is done with sending the events + try { + producer.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + ); + LOGGER.info("\tDONE."); + + LOGGER.info("Consuming Events... "); + final int maxSeconds = 5; + final int numOfEventsExpected = 3; + CountDownLatch countDownLatch = new CountDownLatch(numOfEventsExpected); + Disposable consumerSubscription = consumer.receive().subscribe(e -> { + LOGGER.info("\tEvent received: " + StandardCharsets.UTF_8.decode(e.body())); + countDownLatch.countDown(); + }); + + //Wait to get all the events + try { + boolean isSuccessful = countDownLatch.await(Duration.ofSeconds(maxSeconds).getSeconds(), TimeUnit.SECONDS); + if (!isSuccessful) { + throw new Exception("Error, expecting 3 events but " + countDownLatch.getCount() + " are missing."); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + //Dispose both subscriptions and close the clients + consumerSubscription.dispose(); + try { + producer.close(); + consumer.close(); + } catch (IOException e) { + e.printStackTrace(); + } + client.close(); + } + + LOGGER.info("DONE."); + + } + + public static void main(String[] args) { + LOGGER.info("---------------------"); + LOGGER.info("EVENT HUBS"); + LOGGER.info("---------------------"); + + client = new EventHubClientBuilder().connectionString(EVENT_HUBS_CONNECTION_STRING).buildAsyncClient(); + + String partitionId = getPartitionID(); + sendAndReceiveEvents(partitionId); + } +} diff --git a/eng/smoke-tests/src/main/java/com/azure/KeyVaultSecrets.java b/eng/smoke-tests/src/main/java/com/azure/KeyVaultSecrets.java new file mode 100644 index 000000000000..a20296a8858e --- /dev/null +++ b/eng/smoke-tests/src/main/java/com/azure/KeyVaultSecrets.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure; + +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.secrets.SecretClient; +import com.azure.security.keyvault.secrets.SecretClientBuilder; +import com.azure.security.keyvault.secrets.models.DeletedSecret; +import com.azure.security.keyvault.secrets.models.Secret; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.UUID; + +public class KeyVaultSecrets { + private static SecretClient secretClient; + private static final String SECRET_NAME = "MySecretName-" + UUID.randomUUID(); + private static final String SECRET_VALUE = "MySecretValue"; + + private static final Logger LOGGER = LoggerFactory.getLogger(KeyVaultSecrets.class); + + private static void setSecret() { + LOGGER.info("Setting a secret..."); + Secret response = secretClient.setSecret(SECRET_NAME, SECRET_VALUE); + LOGGER.info("\tDONE: ({},{}).", response.name(), response.value()); + } + + private static void getSecret() { + LOGGER.info("Getting the secret... "); + Secret response = secretClient.getSecret(SECRET_NAME); + LOGGER.info("\tDONE: secret ({},{}) retrieved.", response.name(), response.value()); + } + + private static void deleteSecret() { + LOGGER.info("Deleting the secret... "); + DeletedSecret response = secretClient.deleteSecret(SECRET_NAME); + LOGGER.info("\tDONE: '{}' deleted.", response.name()); + } + + public static void main(String[] args) { + LOGGER.info("---------------------"); + LOGGER.info("KEY VAULT - SECRETS"); + LOGGER.info("IDENTITY - CREDENTIAL"); + LOGGER.info("---------------------"); + + /* DefaultAzureCredentialBuilder() is expecting the following environment variables: + * AZURE_CLIENT_ID + * AZURE_CLIENT_SECRET + * AZURE_TENANT_ID + */ + secretClient = new SecretClientBuilder() + .endpoint(System.getenv("AZURE_PROJECT_URL")) + .credential(new DefaultAzureCredentialBuilder().build()) + .buildClient(); + + try { + setSecret(); + getSecret(); + } finally { + deleteSecret(); + } + } +} diff --git a/eng/smoke-tests/src/main/java/com/azure/StorageBlob.java b/eng/smoke-tests/src/main/java/com/azure/StorageBlob.java new file mode 100644 index 000000000000..ee5373d180c4 --- /dev/null +++ b/eng/smoke-tests/src/main/java/com/azure/StorageBlob.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure; + +import com.azure.storage.blob.BlobServiceClient; +import com.azure.storage.blob.BlobServiceClientBuilder; +import com.azure.storage.blob.BlockBlobClient; +import com.azure.storage.blob.ContainerClient; +import com.azure.storage.blob.models.BlobItem; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.util.UUID; + +public class StorageBlob { + private static ContainerClient containerClient; + private static BlockBlobClient blobClient; + + private static final String STORAGE_CONNECTION_STRING = System.getenv("AZURE_STORAGE_CONNECTION_STRING"); + + private static final String CONTAINER_NAME = "mycontainer"; //This sample needs an existing container + private static final String BLOB_NAME = "javaSmokeTestBlob-"+ UUID.randomUUID() +".txt"; + + private static final Logger LOGGER = LoggerFactory.getLogger(CosmosDB.class); + + private static void uploadBlob() throws IOException { + LOGGER.info("Uploading blob... "); + String text = "This is a sample block blob created for SDK Smoke Test in Java!"; + ByteArrayInputStream data = new ByteArrayInputStream(text.getBytes()); + blobClient.upload(data, text.length()); + LOGGER.info("\tDONE."); + + } + + private static void listBlobsInContainer() { + LOGGER.info("Listing all blobs in container..."); + Iterable storageResponse = containerClient.listBlobsFlat(); + storageResponse.forEach(blobItem -> LOGGER.info("\t{}",blobItem.name())); + LOGGER.info("DONE."); + } + + private static void deleteBlob() { + LOGGER.info("Deleting blob... "); + blobClient.delete(); + LOGGER.info("\tDONE."); + } + + public static void main(String[] args) throws IOException { + LOGGER.info("---------------------"); + LOGGER.info("STORAGE - BLOB"); + LOGGER.info("---------------------"); + + BlobServiceClient serviceClient = new BlobServiceClientBuilder().connectionString(STORAGE_CONNECTION_STRING).buildClient(); + containerClient = serviceClient.getContainerClient(CONTAINER_NAME); + blobClient = containerClient.getBlockBlobClient(BLOB_NAME); + + try{ + uploadBlob(); + listBlobsInContainer(); + } + finally { + deleteBlob(); + } + } +} diff --git a/eng/spotbugs-aggregate-report/pom.xml b/eng/spotbugs-aggregate-report/pom.xml index 6f2b66734cfa..a242ce951871 100644 --- a/eng/spotbugs-aggregate-report/pom.xml +++ b/eng/spotbugs-aggregate-report/pom.xml @@ -6,7 +6,7 @@ azure-client-sdk-parent com.azure - 1.3.0 + 1.4.0 ../../pom.client.xml 4.0.0 @@ -22,14 +22,18 @@ 10.5.0 - 1.0.0-preview.4 - 1.0.0-preview.3 - 1.0.0-preview.3 - 4.0.0-preview.3 - 5.0.0-preview.3 - 12.0.0-preview.3 - 12.0.0-preview.3 - 12.0.0-preview.3 + 1.0.0-preview.5 + 1.0.0-preview.4 + 1.0.0-preview.4 + 4.0.0-preview.4 + 5.0.0-preview.4 + 1.0.0-preview.2 + 12.0.0-preview.4 + 12.0.0-preview.4 + 12.0.0-preview.4 + 12.0.0-preview.4 + 12.0.0-preview.4 + 12.0.0-preview.4 @@ -57,23 +61,31 @@ ..\..\sdk\core\azure-core\src\main\java ..\..\sdk\core\azure-core\src\samples\java ..\..\sdk\core\azure-core-amqp\src\main\java + ..\..\sdk\core\azure-core-http-netty\src\main\java + ..\..\sdk\core\azure-core-http-netty\src\samples\java + ..\..\sdk\core\azure-core-http-okhttp\src\main\java ..\..\sdk\core\azure-core-management\src\main\java ..\..\sdk\core\azure-core-test\src\main\java ..\..\sdk\eventhubs\azure-messaging-eventhubs\src\main\java ..\..\sdk\eventhubs\azure-messaging-eventhubs\src\samples\java + ..\..\sdk\eventhubs\azure-messaging-eventhubs-checkpointstore-blob\src\main\java + ..\..\sdk\eventhubs\azure-messaging-eventhubs-checkpointstore-blob\src\samples\java ..\..\sdk\identity\azure-identity\src\main\java ..\..\sdk\identity\azure-identity\src\samples\java - - - - - - - - - - - + + + + + ..\..\sdk\storage\azure-storage-common\src\main\java + ..\..\sdk\storage\azure-storage-blob\src\main\java + ..\..\sdk\storage\azure-storage-blob\src\samples\java + ..\..\sdk\storage\azure-storage-blob-cryptography\src\main\java + ..\..\sdk\storage\azure-storage-file\src\main\java + ..\..\sdk\storage\azure-storage-file\src\samples\java + ..\..\sdk\storage\azure-storage-queue\src\main\java + ..\..\sdk\storage\azure-storage-queue\src\samples\java + ..\..\sdk\storage\azure-storage-queue-cryptography\src\main\java + @@ -149,6 +161,16 @@ azure-core-amqp ${azure-core.version} + + com.azure + azure-core-http-netty + ${azure-core.version} + + + com.azure + azure-core-http-okhttp + ${azure-core.version} + com.azure azure-core-management @@ -164,6 +186,11 @@ azure-messaging-eventhubs ${azure-messaging-eventhubs.version} + + com.azure + azure-messaging-eventhubs-checkpointstore-blob + ${azure-messaging-eventhubs-checkpointstore-blob.version} + com.azure azure-identity @@ -179,11 +206,21 @@ azure-keyvault-secrets ${azure-keyvault.version} + + com.azure + azure-storage-common + ${azure-storage-common.version} + com.azure azure-storage-blob ${azure-storage-blob.version} + + com.azure + azure-storage-blob-cryptography + ${azure-storage-blob-cryptography.version} + com.azure azure-storage-file @@ -194,6 +231,11 @@ azure-storage-queue ${azure-storage-queue.version} + + com.azure + azure-storage-queue-cryptography + ${azure-storage-queue-cryptography.version} + diff --git a/kusto/resource-manager/v2019_05_15/pom.xml b/kusto/resource-manager/v2019_05_15/pom.xml new file mode 100644 index 000000000000..073ec691b875 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.kusto.v2019_05_15 + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-kusto + 1.0.0-beta + jar + Microsoft Azure SDK for Kusto Management + This package contains Microsoft Kusto Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + 1.6.5 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ +
]]> + + + + + + diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/AzureCapacity.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/AzureCapacity.java new file mode 100644 index 000000000000..260158c22de0 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/AzureCapacity.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Azure capacity definition. + */ +public class AzureCapacity { + /** + * Scale type. Possible values include: 'automatic', 'manual', 'none'. + */ + @JsonProperty(value = "scaleType", required = true) + private AzureScaleType scaleType; + + /** + * Minimum allowed capacity. + */ + @JsonProperty(value = "minimum", required = true) + private int minimum; + + /** + * Maximum allowed capacity. + */ + @JsonProperty(value = "maximum", required = true) + private int maximum; + + /** + * The default capacity that would be used. + */ + @JsonProperty(value = "default", required = true) + private int defaultProperty; + + /** + * Get scale type. Possible values include: 'automatic', 'manual', 'none'. + * + * @return the scaleType value + */ + public AzureScaleType scaleType() { + return this.scaleType; + } + + /** + * Set scale type. Possible values include: 'automatic', 'manual', 'none'. + * + * @param scaleType the scaleType value to set + * @return the AzureCapacity object itself. + */ + public AzureCapacity withScaleType(AzureScaleType scaleType) { + this.scaleType = scaleType; + return this; + } + + /** + * Get minimum allowed capacity. + * + * @return the minimum value + */ + public int minimum() { + return this.minimum; + } + + /** + * Set minimum allowed capacity. + * + * @param minimum the minimum value to set + * @return the AzureCapacity object itself. + */ + public AzureCapacity withMinimum(int minimum) { + this.minimum = minimum; + return this; + } + + /** + * Get maximum allowed capacity. + * + * @return the maximum value + */ + public int maximum() { + return this.maximum; + } + + /** + * Set maximum allowed capacity. + * + * @param maximum the maximum value to set + * @return the AzureCapacity object itself. + */ + public AzureCapacity withMaximum(int maximum) { + this.maximum = maximum; + return this; + } + + /** + * Get the default capacity that would be used. + * + * @return the defaultProperty value + */ + public int defaultProperty() { + return this.defaultProperty; + } + + /** + * Set the default capacity that would be used. + * + * @param defaultProperty the defaultProperty value to set + * @return the AzureCapacity object itself. + */ + public AzureCapacity withDefaultProperty(int defaultProperty) { + this.defaultProperty = defaultProperty; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/AzureEntityResource.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/AzureEntityResource.java new file mode 100644 index 000000000000..8c5c5fc4e9dc --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/AzureEntityResource.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.ProxyResource; + +/** + * The resource model definition for a Azure Resource Manager resource with an + * etag. + */ +public class AzureEntityResource extends ProxyResource { + /** + * Resource Etag. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get resource Etag. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/AzureResourceSku.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/AzureResourceSku.java new file mode 100644 index 000000000000..f842c18bff92 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/AzureResourceSku.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.AzureResourceSkuInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.KustoManager; + +/** + * Type representing AzureResourceSku. + */ +public interface AzureResourceSku extends HasInner, HasManager { + /** + * @return the capacity value. + */ + AzureCapacity capacity(); + + /** + * @return the resourceType value. + */ + String resourceType(); + + /** + * @return the sku value. + */ + AzureSku sku(); + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/AzureScaleType.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/AzureScaleType.java new file mode 100644 index 000000000000..b0c95baf5ef6 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/AzureScaleType.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for AzureScaleType. + */ +public final class AzureScaleType extends ExpandableStringEnum { + /** Static value automatic for AzureScaleType. */ + public static final AzureScaleType AUTOMATIC = fromString("automatic"); + + /** Static value manual for AzureScaleType. */ + public static final AzureScaleType MANUAL = fromString("manual"); + + /** Static value none for AzureScaleType. */ + public static final AzureScaleType NONE = fromString("none"); + + /** + * Creates or finds a AzureScaleType from its string representation. + * @param name a name to look for + * @return the corresponding AzureScaleType + */ + @JsonCreator + public static AzureScaleType fromString(String name) { + return fromString(name, AzureScaleType.class); + } + + /** + * @return known AzureScaleType values + */ + public static Collection values() { + return values(AzureScaleType.class); + } +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/AzureSku.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/AzureSku.java new file mode 100644 index 000000000000..190bf37f476e --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/AzureSku.java @@ -0,0 +1,99 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Azure SKU definition. + */ +public class AzureSku { + /** + * SKU name. Possible values include: 'Standard_DS13_v2+1TB_PS', + * 'Standard_DS13_v2+2TB_PS', 'Standard_DS14_v2+3TB_PS', + * 'Standard_DS14_v2+4TB_PS', 'Standard_D13_v2', 'Standard_D14_v2', + * 'Standard_L8s', 'Standard_L16s', 'Standard_D11_v2', 'Standard_D12_v2', + * 'Standard_L4s', 'Dev(No SLA)_Standard_D11_v2'. + */ + @JsonProperty(value = "name", required = true) + private AzureSkuName name; + + /** + * The number of instances of the cluster. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * SKU tier. Possible values include: 'Basic', 'Standard'. + */ + @JsonProperty(value = "tier", required = true) + private AzureSkuTier tier; + + /** + * Get sKU name. Possible values include: 'Standard_DS13_v2+1TB_PS', 'Standard_DS13_v2+2TB_PS', 'Standard_DS14_v2+3TB_PS', 'Standard_DS14_v2+4TB_PS', 'Standard_D13_v2', 'Standard_D14_v2', 'Standard_L8s', 'Standard_L16s', 'Standard_D11_v2', 'Standard_D12_v2', 'Standard_L4s', 'Dev(No SLA)_Standard_D11_v2'. + * + * @return the name value + */ + public AzureSkuName name() { + return this.name; + } + + /** + * Set sKU name. Possible values include: 'Standard_DS13_v2+1TB_PS', 'Standard_DS13_v2+2TB_PS', 'Standard_DS14_v2+3TB_PS', 'Standard_DS14_v2+4TB_PS', 'Standard_D13_v2', 'Standard_D14_v2', 'Standard_L8s', 'Standard_L16s', 'Standard_D11_v2', 'Standard_D12_v2', 'Standard_L4s', 'Dev(No SLA)_Standard_D11_v2'. + * + * @param name the name value to set + * @return the AzureSku object itself. + */ + public AzureSku withName(AzureSkuName name) { + this.name = name; + return this; + } + + /** + * Get the number of instances of the cluster. + * + * @return the capacity value + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the number of instances of the cluster. + * + * @param capacity the capacity value to set + * @return the AzureSku object itself. + */ + public AzureSku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + + /** + * Get sKU tier. Possible values include: 'Basic', 'Standard'. + * + * @return the tier value + */ + public AzureSkuTier tier() { + return this.tier; + } + + /** + * Set sKU tier. Possible values include: 'Basic', 'Standard'. + * + * @param tier the tier value to set + * @return the AzureSku object itself. + */ + public AzureSku withTier(AzureSkuTier tier) { + this.tier = tier; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/AzureSkuName.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/AzureSkuName.java new file mode 100644 index 000000000000..9c12b11a927a --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/AzureSkuName.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for AzureSkuName. + */ +public final class AzureSkuName extends ExpandableStringEnum { + /** Static value Standard_DS13_v2+1TB_PS for AzureSkuName. */ + public static final AzureSkuName STANDARD_DS13_V21TB_PS = fromString("Standard_DS13_v2+1TB_PS"); + + /** Static value Standard_DS13_v2+2TB_PS for AzureSkuName. */ + public static final AzureSkuName STANDARD_DS13_V22TB_PS = fromString("Standard_DS13_v2+2TB_PS"); + + /** Static value Standard_DS14_v2+3TB_PS for AzureSkuName. */ + public static final AzureSkuName STANDARD_DS14_V23TB_PS = fromString("Standard_DS14_v2+3TB_PS"); + + /** Static value Standard_DS14_v2+4TB_PS for AzureSkuName. */ + public static final AzureSkuName STANDARD_DS14_V24TB_PS = fromString("Standard_DS14_v2+4TB_PS"); + + /** Static value Standard_D13_v2 for AzureSkuName. */ + public static final AzureSkuName STANDARD_D13_V2 = fromString("Standard_D13_v2"); + + /** Static value Standard_D14_v2 for AzureSkuName. */ + public static final AzureSkuName STANDARD_D14_V2 = fromString("Standard_D14_v2"); + + /** Static value Standard_L8s for AzureSkuName. */ + public static final AzureSkuName STANDARD_L8S = fromString("Standard_L8s"); + + /** Static value Standard_L16s for AzureSkuName. */ + public static final AzureSkuName STANDARD_L16S = fromString("Standard_L16s"); + + /** Static value Standard_D11_v2 for AzureSkuName. */ + public static final AzureSkuName STANDARD_D11_V2 = fromString("Standard_D11_v2"); + + /** Static value Standard_D12_v2 for AzureSkuName. */ + public static final AzureSkuName STANDARD_D12_V2 = fromString("Standard_D12_v2"); + + /** Static value Standard_L4s for AzureSkuName. */ + public static final AzureSkuName STANDARD_L4S = fromString("Standard_L4s"); + + /** Static value Dev(No SLA)_Standard_D11_v2 for AzureSkuName. */ + public static final AzureSkuName DEV_NO_SLA_STANDARD_D11_V2 = fromString("Dev(No SLA)_Standard_D11_v2"); + + /** + * Creates or finds a AzureSkuName from its string representation. + * @param name a name to look for + * @return the corresponding AzureSkuName + */ + @JsonCreator + public static AzureSkuName fromString(String name) { + return fromString(name, AzureSkuName.class); + } + + /** + * @return known AzureSkuName values + */ + public static Collection values() { + return values(AzureSkuName.class); + } +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/AzureSkuTier.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/AzureSkuTier.java new file mode 100644 index 000000000000..e5917e4d6ef0 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/AzureSkuTier.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for AzureSkuTier. + */ +public final class AzureSkuTier extends ExpandableStringEnum { + /** Static value Basic for AzureSkuTier. */ + public static final AzureSkuTier BASIC = fromString("Basic"); + + /** Static value Standard for AzureSkuTier. */ + public static final AzureSkuTier STANDARD = fromString("Standard"); + + /** + * Creates or finds a AzureSkuTier from its string representation. + * @param name a name to look for + * @return the corresponding AzureSkuTier + */ + @JsonCreator + public static AzureSkuTier fromString(String name) { + return fromString(name, AzureSkuTier.class); + } + + /** + * @return known AzureSkuTier values + */ + public static Collection values() { + return values(AzureSkuTier.class); + } +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/CheckNameResult.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/CheckNameResult.java new file mode 100644 index 000000000000..4817fe8c69cc --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/CheckNameResult.java @@ -0,0 +1,40 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.KustoManager; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.CheckNameResultInner; + +/** + * Type representing CheckNameResult. + */ +public interface CheckNameResult extends HasInner, HasManager { + /** + * @return the message value. + */ + String message(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * @return the reason value. + */ + Reason reason(); + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/Cluster.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/Cluster.java new file mode 100644 index 000000000000..8d9c1f78e6af --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/Cluster.java @@ -0,0 +1,280 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.KustoManager; +import java.util.List; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.ClusterInner; + +/** + * Type representing Cluster. + */ +public interface Cluster extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the dataIngestionUri value. + */ + String dataIngestionUri(); + + /** + * @return the enableDiskEncryption value. + */ + Boolean enableDiskEncryption(); + + /** + * @return the enableStreamingIngest value. + */ + Boolean enableStreamingIngest(); + + /** + * @return the optimizedAutoscale value. + */ + OptimizedAutoscale optimizedAutoscale(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * @return the sku value. + */ + AzureSku sku(); + + /** + * @return the state value. + */ + State state(); + + /** + * @return the trustedExternalTenants value. + */ + List trustedExternalTenants(); + + /** + * @return the uri value. + */ + String uri(); + + /** + * @return the virtualNetworkConfiguration value. + */ + VirtualNetworkConfiguration virtualNetworkConfiguration(); + + /** + * @return the zones value. + */ + List zones(); + + /** + * The entirety of the Cluster definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithSku, DefinitionStages.WithCreate { + } + + /** + * Grouping of Cluster definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Cluster definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the Cluster definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the cluster definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The SKU of the cluster + * @return the next definition stage +*/ + WithCreate withSku(AzureSku sku); + } + + /** + * The stage of the cluster definition allowing to specify EnableDiskEncryption. + */ + interface WithEnableDiskEncryption { + /** + * Specifies enableDiskEncryption. + * @param enableDiskEncryption A boolean value that indicates if the cluster's disks are encrypted + * @return the next definition stage + */ + WithCreate withEnableDiskEncryption(Boolean enableDiskEncryption); + } + + /** + * The stage of the cluster definition allowing to specify EnableStreamingIngest. + */ + interface WithEnableStreamingIngest { + /** + * Specifies enableStreamingIngest. + * @param enableStreamingIngest A boolean value that indicates if the streaming ingest is enabled + * @return the next definition stage + */ + WithCreate withEnableStreamingIngest(Boolean enableStreamingIngest); + } + + /** + * The stage of the cluster definition allowing to specify OptimizedAutoscale. + */ + interface WithOptimizedAutoscale { + /** + * Specifies optimizedAutoscale. + * @param optimizedAutoscale Optimized auto scale definition + * @return the next definition stage + */ + WithCreate withOptimizedAutoscale(OptimizedAutoscale optimizedAutoscale); + } + + /** + * The stage of the cluster definition allowing to specify TrustedExternalTenants. + */ + interface WithTrustedExternalTenants { + /** + * Specifies trustedExternalTenants. + * @param trustedExternalTenants The cluster's external tenants + * @return the next definition stage + */ + WithCreate withTrustedExternalTenants(List trustedExternalTenants); + } + + /** + * The stage of the cluster definition allowing to specify VirtualNetworkConfiguration. + */ + interface WithVirtualNetworkConfiguration { + /** + * Specifies virtualNetworkConfiguration. + * @param virtualNetworkConfiguration Virtual network definition + * @return the next definition stage + */ + WithCreate withVirtualNetworkConfiguration(VirtualNetworkConfiguration virtualNetworkConfiguration); + } + + /** + * The stage of the cluster definition allowing to specify Zones. + */ + interface WithZones { + /** + * Specifies zones. + * @param zones The availability zones of the cluster + * @return the next definition stage + */ + WithCreate withZones(List zones); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithEnableDiskEncryption, DefinitionStages.WithEnableStreamingIngest, DefinitionStages.WithOptimizedAutoscale, DefinitionStages.WithTrustedExternalTenants, DefinitionStages.WithVirtualNetworkConfiguration, DefinitionStages.WithZones { + } + } + /** + * The template for a Cluster update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithEnableDiskEncryption, UpdateStages.WithEnableStreamingIngest, UpdateStages.WithOptimizedAutoscale, UpdateStages.WithSku, UpdateStages.WithTrustedExternalTenants, UpdateStages.WithVirtualNetworkConfiguration { + } + + /** + * Grouping of Cluster update stages. + */ + interface UpdateStages { + /** + * The stage of the cluster update allowing to specify EnableDiskEncryption. + */ + interface WithEnableDiskEncryption { + /** + * Specifies enableDiskEncryption. + * @param enableDiskEncryption A boolean value that indicates if the cluster's disks are encrypted + * @return the next update stage + */ + Update withEnableDiskEncryption(Boolean enableDiskEncryption); + } + + /** + * The stage of the cluster update allowing to specify EnableStreamingIngest. + */ + interface WithEnableStreamingIngest { + /** + * Specifies enableStreamingIngest. + * @param enableStreamingIngest A boolean value that indicates if the streaming ingest is enabled + * @return the next update stage + */ + Update withEnableStreamingIngest(Boolean enableStreamingIngest); + } + + /** + * The stage of the cluster update allowing to specify OptimizedAutoscale. + */ + interface WithOptimizedAutoscale { + /** + * Specifies optimizedAutoscale. + * @param optimizedAutoscale Optimized auto scale definition + * @return the next update stage + */ + Update withOptimizedAutoscale(OptimizedAutoscale optimizedAutoscale); + } + + /** + * The stage of the cluster update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The SKU of the cluster + * @return the next update stage + */ + Update withSku(AzureSku sku); + } + + /** + * The stage of the cluster update allowing to specify TrustedExternalTenants. + */ + interface WithTrustedExternalTenants { + /** + * Specifies trustedExternalTenants. + * @param trustedExternalTenants The cluster's external tenants + * @return the next update stage + */ + Update withTrustedExternalTenants(List trustedExternalTenants); + } + + /** + * The stage of the cluster update allowing to specify VirtualNetworkConfiguration. + */ + interface WithVirtualNetworkConfiguration { + /** + * Specifies virtualNetworkConfiguration. + * @param virtualNetworkConfiguration Virtual network definition + * @return the next update stage + */ + Update withVirtualNetworkConfiguration(VirtualNetworkConfiguration virtualNetworkConfiguration); + } + + } +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/ClusterCheckNameRequest.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/ClusterCheckNameRequest.java new file mode 100644 index 000000000000..0412e2e7e71c --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/ClusterCheckNameRequest.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The result returned from a cluster check name availability request. + */ +public class ClusterCheckNameRequest { + /** + * Cluster name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The type of resource, Microsoft.Kusto/clusters. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * Creates an instance of ClusterCheckNameRequest class. + * @param name cluster name. + */ + public ClusterCheckNameRequest() { + type = "Microsoft.Kusto/clusters"; + } + + /** + * Get cluster name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set cluster name. + * + * @param name the name value to set + * @return the ClusterCheckNameRequest object itself. + */ + public ClusterCheckNameRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type of resource, Microsoft.Kusto/clusters. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type of resource, Microsoft.Kusto/clusters. + * + * @param type the type value to set + * @return the ClusterCheckNameRequest object itself. + */ + public ClusterCheckNameRequest withType(String type) { + this.type = type; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/ClusterUpdate.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/ClusterUpdate.java new file mode 100644 index 000000000000..d858b023eeb7 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/ClusterUpdate.java @@ -0,0 +1,293 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import java.util.Map; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Class representing an update to a Kusto cluster. + */ +@JsonFlatten +public class ClusterUpdate extends ProxyResource { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Resource location. + */ + @JsonProperty(value = "location") + private String location; + + /** + * The SKU of the cluster. + */ + @JsonProperty(value = "sku") + private AzureSku sku; + + /** + * The state of the resource. Possible values include: 'Creating', + * 'Unavailable', 'Running', 'Deleting', 'Deleted', 'Stopping', 'Stopped', + * 'Starting', 'Updating'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private State state; + + /** + * The provisioned state of the resource. Possible values include: + * 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Moving'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * The cluster URI. + */ + @JsonProperty(value = "properties.uri", access = JsonProperty.Access.WRITE_ONLY) + private String uri; + + /** + * The cluster data ingestion URI. + */ + @JsonProperty(value = "properties.dataIngestionUri", access = JsonProperty.Access.WRITE_ONLY) + private String dataIngestionUri; + + /** + * The cluster's external tenants. + */ + @JsonProperty(value = "properties.trustedExternalTenants") + private List trustedExternalTenants; + + /** + * Optimized auto scale definition. + */ + @JsonProperty(value = "properties.optimizedAutoscale") + private OptimizedAutoscale optimizedAutoscale; + + /** + * A boolean value that indicates if the cluster's disks are encrypted. + */ + @JsonProperty(value = "properties.enableDiskEncryption") + private Boolean enableDiskEncryption; + + /** + * A boolean value that indicates if the streaming ingest is enabled. + */ + @JsonProperty(value = "properties.enableStreamingIngest") + private Boolean enableStreamingIngest; + + /** + * Virtual network definition. + */ + @JsonProperty(value = "properties.virtualNetworkConfiguration") + private VirtualNetworkConfiguration virtualNetworkConfiguration; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the ClusterUpdate object itself. + */ + public ClusterUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set resource location. + * + * @param location the location value to set + * @return the ClusterUpdate object itself. + */ + public ClusterUpdate withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the SKU of the cluster. + * + * @return the sku value + */ + public AzureSku sku() { + return this.sku; + } + + /** + * Set the SKU of the cluster. + * + * @param sku the sku value to set + * @return the ClusterUpdate object itself. + */ + public ClusterUpdate withSku(AzureSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the state of the resource. Possible values include: 'Creating', 'Unavailable', 'Running', 'Deleting', 'Deleted', 'Stopping', 'Stopped', 'Starting', 'Updating'. + * + * @return the state value + */ + public State state() { + return this.state; + } + + /** + * Get the provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Moving'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the cluster URI. + * + * @return the uri value + */ + public String uri() { + return this.uri; + } + + /** + * Get the cluster data ingestion URI. + * + * @return the dataIngestionUri value + */ + public String dataIngestionUri() { + return this.dataIngestionUri; + } + + /** + * Get the cluster's external tenants. + * + * @return the trustedExternalTenants value + */ + public List trustedExternalTenants() { + return this.trustedExternalTenants; + } + + /** + * Set the cluster's external tenants. + * + * @param trustedExternalTenants the trustedExternalTenants value to set + * @return the ClusterUpdate object itself. + */ + public ClusterUpdate withTrustedExternalTenants(List trustedExternalTenants) { + this.trustedExternalTenants = trustedExternalTenants; + return this; + } + + /** + * Get optimized auto scale definition. + * + * @return the optimizedAutoscale value + */ + public OptimizedAutoscale optimizedAutoscale() { + return this.optimizedAutoscale; + } + + /** + * Set optimized auto scale definition. + * + * @param optimizedAutoscale the optimizedAutoscale value to set + * @return the ClusterUpdate object itself. + */ + public ClusterUpdate withOptimizedAutoscale(OptimizedAutoscale optimizedAutoscale) { + this.optimizedAutoscale = optimizedAutoscale; + return this; + } + + /** + * Get a boolean value that indicates if the cluster's disks are encrypted. + * + * @return the enableDiskEncryption value + */ + public Boolean enableDiskEncryption() { + return this.enableDiskEncryption; + } + + /** + * Set a boolean value that indicates if the cluster's disks are encrypted. + * + * @param enableDiskEncryption the enableDiskEncryption value to set + * @return the ClusterUpdate object itself. + */ + public ClusterUpdate withEnableDiskEncryption(Boolean enableDiskEncryption) { + this.enableDiskEncryption = enableDiskEncryption; + return this; + } + + /** + * Get a boolean value that indicates if the streaming ingest is enabled. + * + * @return the enableStreamingIngest value + */ + public Boolean enableStreamingIngest() { + return this.enableStreamingIngest; + } + + /** + * Set a boolean value that indicates if the streaming ingest is enabled. + * + * @param enableStreamingIngest the enableStreamingIngest value to set + * @return the ClusterUpdate object itself. + */ + public ClusterUpdate withEnableStreamingIngest(Boolean enableStreamingIngest) { + this.enableStreamingIngest = enableStreamingIngest; + return this; + } + + /** + * Get virtual network definition. + * + * @return the virtualNetworkConfiguration value + */ + public VirtualNetworkConfiguration virtualNetworkConfiguration() { + return this.virtualNetworkConfiguration; + } + + /** + * Set virtual network definition. + * + * @param virtualNetworkConfiguration the virtualNetworkConfiguration value to set + * @return the ClusterUpdate object itself. + */ + public ClusterUpdate withVirtualNetworkConfiguration(VirtualNetworkConfiguration virtualNetworkConfiguration) { + this.virtualNetworkConfiguration = virtualNetworkConfiguration; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/Clusters.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/Clusters.java new file mode 100644 index 000000000000..1084997f22b8 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/Clusters.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Completable; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.ClustersInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.kusto.v2019_05_15.AzureResourceSku; + +/** + * Type representing Clusters. + */ +public interface Clusters extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Stops a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable stopAsync(String resourceGroupName, String clusterName); + + /** + * Starts a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable startAsync(String resourceGroupName, String clusterName); + + /** + * Checks that the cluster name is valid and is not already in use. + * + * @param location Azure location. + * @param name Cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkNameAvailabilityAsync(String location, String name); + + /** + * Returns the SKUs available for the provided resource. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listSkusByResourceAsync(String resourceGroupName, String clusterName); + + /** + * Lists eligible SKUs for Kusto resource provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listSkusAsync(); + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DataConnection.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DataConnection.java new file mode 100644 index 000000000000..10a107c9c66c --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DataConnection.java @@ -0,0 +1,118 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.DataConnectionInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.KustoManager; + +/** + * Type representing DataConnection. + */ +public interface DataConnection extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DataConnection definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabasis, DefinitionStages.WithCreate { + } + + /** + * Grouping of DataConnection definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DataConnection definition. + */ + interface Blank extends WithDatabasis { + } + + /** + * The stage of the dataconnection definition allowing to specify Databasis. + */ + interface WithDatabasis { + /** + * Specifies resourceGroupName, clusterName, databaseName. + * @param resourceGroupName The name of the resource group containing the Kusto cluster + * @param clusterName The name of the Kusto cluster + * @param databaseName The name of the database in the Kusto cluster + * @return the next definition stage + */ + WithCreate withExistingDatabasis(String resourceGroupName, String clusterName, String databaseName); + } + + /** + * The stage of the dataconnection definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location Resource location + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithLocation { + } + } + /** + * The template for a DataConnection update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithLocation { + } + + /** + * Grouping of DataConnection update stages. + */ + interface UpdateStages { + /** + * The stage of the dataconnection update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location Resource location + * @return the next update stage + */ + Update withLocation(String location); + } + + } +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DataConnectionCheckNameRequest.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DataConnectionCheckNameRequest.java new file mode 100644 index 000000000000..8ae13bbb112b --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DataConnectionCheckNameRequest.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The result returned from a data connections check name availability request. + */ +public class DataConnectionCheckNameRequest { + /** + * Data Connection name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The type of resource, + * Microsoft.Kusto/clusters/databases/dataConnections. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * Creates an instance of DataConnectionCheckNameRequest class. + * @param name data Connection name. + */ + public DataConnectionCheckNameRequest() { + type = "Microsoft.Kusto/clusters/databases/dataConnections"; + } + + /** + * Get data Connection name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set data Connection name. + * + * @param name the name value to set + * @return the DataConnectionCheckNameRequest object itself. + */ + public DataConnectionCheckNameRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type of resource, Microsoft.Kusto/clusters/databases/dataConnections. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type of resource, Microsoft.Kusto/clusters/databases/dataConnections. + * + * @param type the type value to set + * @return the DataConnectionCheckNameRequest object itself. + */ + public DataConnectionCheckNameRequest withType(String type) { + this.type = type; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DataConnectionValidation.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DataConnectionValidation.java new file mode 100644 index 000000000000..f7a4665f0488 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DataConnectionValidation.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.DataConnectionInner; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Class representing an data connection validation. + */ +public class DataConnectionValidation { + /** + * The name of the data connection. + */ + @JsonProperty(value = "dataConnectionName") + private String dataConnectionName; + + /** + * The data connection properties to validate. + */ + @JsonProperty(value = "properties") + private DataConnectionInner properties; + + /** + * Get the name of the data connection. + * + * @return the dataConnectionName value + */ + public String dataConnectionName() { + return this.dataConnectionName; + } + + /** + * Set the name of the data connection. + * + * @param dataConnectionName the dataConnectionName value to set + * @return the DataConnectionValidation object itself. + */ + public DataConnectionValidation withDataConnectionName(String dataConnectionName) { + this.dataConnectionName = dataConnectionName; + return this; + } + + /** + * Get the data connection properties to validate. + * + * @return the properties value + */ + public DataConnectionInner properties() { + return this.properties; + } + + /** + * Set the data connection properties to validate. + * + * @param properties the properties value to set + * @return the DataConnectionValidation object itself. + */ + public DataConnectionValidation withProperties(DataConnectionInner properties) { + this.properties = properties; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DataConnectionValidationListResult.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DataConnectionValidationListResult.java new file mode 100644 index 000000000000..cdc784ca6fa9 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DataConnectionValidationListResult.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.KustoManager; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.DataConnectionValidationListResultInner; +import java.util.List; + +/** + * Type representing DataConnectionValidationListResult. + */ +public interface DataConnectionValidationListResult extends HasInner, HasManager { + /** + * @return the value value. + */ + List value(); + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DataConnectionValidationResult.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DataConnectionValidationResult.java new file mode 100644 index 000000000000..984086cc8000 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DataConnectionValidationResult.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The result returned from a data connection validation request. + */ +public class DataConnectionValidationResult { + /** + * A message which indicates a problem in data connection validation. + */ + @JsonProperty(value = "errorMessage") + private String errorMessage; + + /** + * Get a message which indicates a problem in data connection validation. + * + * @return the errorMessage value + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Set a message which indicates a problem in data connection validation. + * + * @param errorMessage the errorMessage value to set + * @return the DataConnectionValidationResult object itself. + */ + public DataConnectionValidationResult withErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DataConnections.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DataConnections.java new file mode 100644 index 000000000000..3bf8559d3321 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DataConnections.java @@ -0,0 +1,80 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.DataConnectionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DataConnections. + */ +public interface DataConnections extends SupportsCreating, HasInner { + /** + * Returns a data connection. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName); + + /** + * Returns the list of data connections of the given Kusto database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAsync(String resourceGroupName, String clusterName, String databaseName); + + /** + * Deletes the data connection with the given name. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName); + + /** + * Checks that the data connection parameters are valid. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param parameters The data connection parameters supplied to the CreateOrUpdate operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable dataConnectionValidationMethodAsync(String resourceGroupName, String clusterName, String databaseName, DataConnectionValidation parameters); + + /** + * Checks that the data connection name is valid and is not already in use. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param name Data Connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkNameAvailabilityAsync(String resourceGroupName, String clusterName, String databaseName, String name); + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DataFormat.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DataFormat.java new file mode 100644 index 000000000000..ec6b7b444726 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DataFormat.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DataFormat. + */ +public final class DataFormat extends ExpandableStringEnum { + /** Static value MULTIJSON for DataFormat. */ + public static final DataFormat MULTIJSON = fromString("MULTIJSON"); + + /** Static value JSON for DataFormat. */ + public static final DataFormat JSON = fromString("JSON"); + + /** Static value CSV for DataFormat. */ + public static final DataFormat CSV = fromString("CSV"); + + /** Static value TSV for DataFormat. */ + public static final DataFormat TSV = fromString("TSV"); + + /** Static value SCSV for DataFormat. */ + public static final DataFormat SCSV = fromString("SCSV"); + + /** Static value SOHSV for DataFormat. */ + public static final DataFormat SOHSV = fromString("SOHSV"); + + /** Static value PSV for DataFormat. */ + public static final DataFormat PSV = fromString("PSV"); + + /** Static value TXT for DataFormat. */ + public static final DataFormat TXT = fromString("TXT"); + + /** Static value RAW for DataFormat. */ + public static final DataFormat RAW = fromString("RAW"); + + /** Static value SINGLEJSON for DataFormat. */ + public static final DataFormat SINGLEJSON = fromString("SINGLEJSON"); + + /** Static value AVRO for DataFormat. */ + public static final DataFormat AVRO = fromString("AVRO"); + + /** + * Creates or finds a DataFormat from its string representation. + * @param name a name to look for + * @return the corresponding DataFormat + */ + @JsonCreator + public static DataFormat fromString(String name) { + return fromString(name, DataFormat.class); + } + + /** + * @return known DataFormat values + */ + public static Collection values() { + return values(DataFormat.class); + } +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/Database.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/Database.java new file mode 100644 index 000000000000..324256c17676 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/Database.java @@ -0,0 +1,210 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.DatabaseInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.KustoManager; +import org.joda.time.Period; + +/** + * Type representing Database. + */ +public interface Database extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the hotCachePeriod value. + */ + Period hotCachePeriod(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * @return the softDeletePeriod value. + */ + Period softDeletePeriod(); + + /** + * @return the statistics value. + */ + DatabaseStatistics statistics(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the Database definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCluster, DefinitionStages.WithCreate { + } + + /** + * Grouping of Database definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Database definition. + */ + interface Blank extends WithCluster { + } + + /** + * The stage of the database definition allowing to specify Cluster. + */ + interface WithCluster { + /** + * Specifies resourceGroupName, clusterName. + * @param resourceGroupName The name of the resource group containing the Kusto cluster + * @param clusterName The name of the Kusto cluster + * @return the next definition stage + */ + WithCreate withExistingCluster(String resourceGroupName, String clusterName); + } + + /** + * The stage of the database definition allowing to specify HotCachePeriod. + */ + interface WithHotCachePeriod { + /** + * Specifies hotCachePeriod. + * @param hotCachePeriod The time the data should be kept in cache for fast queries in TimeSpan + * @return the next definition stage + */ + WithCreate withHotCachePeriod(Period hotCachePeriod); + } + + /** + * The stage of the database definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location Resource location + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the database definition allowing to specify SoftDeletePeriod. + */ + interface WithSoftDeletePeriod { + /** + * Specifies softDeletePeriod. + * @param softDeletePeriod The time the data should be kept before it stops being accessible to queries in TimeSpan + * @return the next definition stage + */ + WithCreate withSoftDeletePeriod(Period softDeletePeriod); + } + + /** + * The stage of the database definition allowing to specify Statistics. + */ + interface WithStatistics { + /** + * Specifies statistics. + * @param statistics The statistics of the database + * @return the next definition stage + */ + WithCreate withStatistics(DatabaseStatistics statistics); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithHotCachePeriod, DefinitionStages.WithLocation, DefinitionStages.WithSoftDeletePeriod, DefinitionStages.WithStatistics { + } + } + /** + * The template for a Database update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithHotCachePeriod, UpdateStages.WithLocation, UpdateStages.WithSoftDeletePeriod, UpdateStages.WithStatistics { + } + + /** + * Grouping of Database update stages. + */ + interface UpdateStages { + /** + * The stage of the database update allowing to specify HotCachePeriod. + */ + interface WithHotCachePeriod { + /** + * Specifies hotCachePeriod. + * @param hotCachePeriod The time the data should be kept in cache for fast queries in TimeSpan + * @return the next update stage + */ + Update withHotCachePeriod(Period hotCachePeriod); + } + + /** + * The stage of the database update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location Resource location + * @return the next update stage + */ + Update withLocation(String location); + } + + /** + * The stage of the database update allowing to specify SoftDeletePeriod. + */ + interface WithSoftDeletePeriod { + /** + * Specifies softDeletePeriod. + * @param softDeletePeriod The time the data should be kept before it stops being accessible to queries in TimeSpan + * @return the next update stage + */ + Update withSoftDeletePeriod(Period softDeletePeriod); + } + + /** + * The stage of the database update allowing to specify Statistics. + */ + interface WithStatistics { + /** + * Specifies statistics. + * @param statistics The statistics of the database + * @return the next update stage + */ + Update withStatistics(DatabaseStatistics statistics); + } + + } +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DatabaseCheckNameRequest.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DatabaseCheckNameRequest.java new file mode 100644 index 000000000000..578d54f53d28 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DatabaseCheckNameRequest.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The result returned from a database check name availability request. + */ +public class DatabaseCheckNameRequest { + /** + * Database name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The type of resource, Microsoft.Kusto/clusters/databases. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * Creates an instance of DatabaseCheckNameRequest class. + * @param name database name. + */ + public DatabaseCheckNameRequest() { + type = "Microsoft.Kusto/clusters/databases"; + } + + /** + * Get database name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set database name. + * + * @param name the name value to set + * @return the DatabaseCheckNameRequest object itself. + */ + public DatabaseCheckNameRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type of resource, Microsoft.Kusto/clusters/databases. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type of resource, Microsoft.Kusto/clusters/databases. + * + * @param type the type value to set + * @return the DatabaseCheckNameRequest object itself. + */ + public DatabaseCheckNameRequest withType(String type) { + this.type = type; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DatabasePrincipal.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DatabasePrincipal.java new file mode 100644 index 000000000000..3dd568a9cb87 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DatabasePrincipal.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.KustoManager; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.DatabasePrincipalInner; + +/** + * Type representing DatabasePrincipal. + */ +public interface DatabasePrincipal extends HasInner, HasManager { + /** + * @return the appId value. + */ + String appId(); + + /** + * @return the email value. + */ + String email(); + + /** + * @return the fqn value. + */ + String fqn(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the role value. + */ + DatabasePrincipalRole role(); + + /** + * @return the tenantName value. + */ + String tenantName(); + + /** + * @return the type value. + */ + DatabasePrincipalType type(); + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DatabasePrincipalListRequest.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DatabasePrincipalListRequest.java new file mode 100644 index 000000000000..2bd6e6718864 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DatabasePrincipalListRequest.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import java.util.List; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.DatabasePrincipalInner; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The list Kusto database principals operation request. + */ +public class DatabasePrincipalListRequest { + /** + * The list of Kusto database principals. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the list of Kusto database principals. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the list of Kusto database principals. + * + * @param value the value value to set + * @return the DatabasePrincipalListRequest object itself. + */ + public DatabasePrincipalListRequest withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DatabasePrincipalListResult.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DatabasePrincipalListResult.java new file mode 100644 index 000000000000..189af5ef5621 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DatabasePrincipalListResult.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.KustoManager; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.DatabasePrincipalListResultInner; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.DatabasePrincipalInner; +import java.util.List; + +/** + * Type representing DatabasePrincipalListResult. + */ +public interface DatabasePrincipalListResult extends HasInner, HasManager { + /** + * @return the value value. + */ + List value(); + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DatabasePrincipalRole.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DatabasePrincipalRole.java new file mode 100644 index 000000000000..7d8cf1b79010 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DatabasePrincipalRole.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DatabasePrincipalRole. + */ +public final class DatabasePrincipalRole extends ExpandableStringEnum { + /** Static value Admin for DatabasePrincipalRole. */ + public static final DatabasePrincipalRole ADMIN = fromString("Admin"); + + /** Static value Ingestor for DatabasePrincipalRole. */ + public static final DatabasePrincipalRole INGESTOR = fromString("Ingestor"); + + /** Static value Monitor for DatabasePrincipalRole. */ + public static final DatabasePrincipalRole MONITOR = fromString("Monitor"); + + /** Static value User for DatabasePrincipalRole. */ + public static final DatabasePrincipalRole USER = fromString("User"); + + /** Static value UnrestrictedViewers for DatabasePrincipalRole. */ + public static final DatabasePrincipalRole UNRESTRICTED_VIEWERS = fromString("UnrestrictedViewers"); + + /** Static value Viewer for DatabasePrincipalRole. */ + public static final DatabasePrincipalRole VIEWER = fromString("Viewer"); + + /** + * Creates or finds a DatabasePrincipalRole from its string representation. + * @param name a name to look for + * @return the corresponding DatabasePrincipalRole + */ + @JsonCreator + public static DatabasePrincipalRole fromString(String name) { + return fromString(name, DatabasePrincipalRole.class); + } + + /** + * @return known DatabasePrincipalRole values + */ + public static Collection values() { + return values(DatabasePrincipalRole.class); + } +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DatabasePrincipalType.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DatabasePrincipalType.java new file mode 100644 index 000000000000..86611555abf0 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DatabasePrincipalType.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DatabasePrincipalType. + */ +public final class DatabasePrincipalType extends ExpandableStringEnum { + /** Static value App for DatabasePrincipalType. */ + public static final DatabasePrincipalType APP = fromString("App"); + + /** Static value Group for DatabasePrincipalType. */ + public static final DatabasePrincipalType GROUP = fromString("Group"); + + /** Static value User for DatabasePrincipalType. */ + public static final DatabasePrincipalType USER = fromString("User"); + + /** + * Creates or finds a DatabasePrincipalType from its string representation. + * @param name a name to look for + * @return the corresponding DatabasePrincipalType + */ + @JsonCreator + public static DatabasePrincipalType fromString(String name) { + return fromString(name, DatabasePrincipalType.class); + } + + /** + * @return known DatabasePrincipalType values + */ + public static Collection values() { + return values(DatabasePrincipalType.class); + } +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DatabaseStatistics.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DatabaseStatistics.java new file mode 100644 index 000000000000..09451a6926df --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DatabaseStatistics.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A class that contains database statistics information. + */ +public class DatabaseStatistics { + /** + * The database size - the total size of compressed data and index in + * bytes. + */ + @JsonProperty(value = "size") + private Double size; + + /** + * Get the database size - the total size of compressed data and index in bytes. + * + * @return the size value + */ + public Double size() { + return this.size; + } + + /** + * Set the database size - the total size of compressed data and index in bytes. + * + * @param size the size value to set + * @return the DatabaseStatistics object itself. + */ + public DatabaseStatistics withSize(Double size) { + this.size = size; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DatabaseUpdate.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DatabaseUpdate.java new file mode 100644 index 000000000000..aa704fa69b9f --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/DatabaseUpdate.java @@ -0,0 +1,142 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Class representing an update to a Kusto database. + */ +@JsonFlatten +public class DatabaseUpdate extends ProxyResource { + /** + * Resource location. + */ + @JsonProperty(value = "location") + private String location; + + /** + * The provisioned state of the resource. Possible values include: + * 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Moving'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * The time the data should be kept before it stops being accessible to + * queries in TimeSpan. + */ + @JsonProperty(value = "properties.softDeletePeriod") + private Period softDeletePeriod; + + /** + * The time the data should be kept in cache for fast queries in TimeSpan. + */ + @JsonProperty(value = "properties.hotCachePeriod") + private Period hotCachePeriod; + + /** + * The statistics of the database. + */ + @JsonProperty(value = "properties.statistics") + private DatabaseStatistics statistics; + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set resource location. + * + * @param location the location value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Moving'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the time the data should be kept before it stops being accessible to queries in TimeSpan. + * + * @return the softDeletePeriod value + */ + public Period softDeletePeriod() { + return this.softDeletePeriod; + } + + /** + * Set the time the data should be kept before it stops being accessible to queries in TimeSpan. + * + * @param softDeletePeriod the softDeletePeriod value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSoftDeletePeriod(Period softDeletePeriod) { + this.softDeletePeriod = softDeletePeriod; + return this; + } + + /** + * Get the time the data should be kept in cache for fast queries in TimeSpan. + * + * @return the hotCachePeriod value + */ + public Period hotCachePeriod() { + return this.hotCachePeriod; + } + + /** + * Set the time the data should be kept in cache for fast queries in TimeSpan. + * + * @param hotCachePeriod the hotCachePeriod value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withHotCachePeriod(Period hotCachePeriod) { + this.hotCachePeriod = hotCachePeriod; + return this; + } + + /** + * Get the statistics of the database. + * + * @return the statistics value + */ + public DatabaseStatistics statistics() { + return this.statistics; + } + + /** + * Set the statistics of the database. + * + * @param statistics the statistics value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withStatistics(DatabaseStatistics statistics) { + this.statistics = statistics; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/Databases.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/Databases.java new file mode 100644 index 000000000000..a0f90598f5e8 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/Databases.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.DatabasesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Databases. + */ +public interface Databases extends SupportsCreating, HasInner { + /** + * Returns a list of database principals of the given Kusto cluster and database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listPrincipalsAsync(String resourceGroupName, String clusterName, String databaseName); + + /** + * Add Database principals permissions. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable addPrincipalsAsync(String resourceGroupName, String clusterName, String databaseName); + + /** + * Remove Database principals permissions. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable removePrincipalsAsync(String resourceGroupName, String clusterName, String databaseName); + + /** + * Returns a database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String clusterName, String databaseName); + + /** + * Returns the list of databases of the given Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByClusterAsync(String resourceGroupName, String clusterName); + + /** + * Deletes the database with the given name. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String clusterName, String databaseName); + + /** + * Checks that the database name is valid and is not already in use. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param name Database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkNameAvailabilityAsync(String resourceGroupName, String clusterName, String name); + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/EventGridDataConnection.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/EventGridDataConnection.java new file mode 100644 index 000000000000..019630d1f961 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/EventGridDataConnection.java @@ -0,0 +1,184 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.DataConnectionInner; + +/** + * Class representing an Event Grid data connection. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind", defaultImpl = EventGridDataConnection.class) +@JsonTypeName("EventGrid") +@JsonFlatten +public class EventGridDataConnection extends DataConnectionInner { + /** + * The resource ID of the storage account where the data resides. + */ + @JsonProperty(value = "properties.storageAccountResourceId", required = true) + private String storageAccountResourceId; + + /** + * The resource ID where the event grid is configured to send events. + */ + @JsonProperty(value = "properties.eventHubResourceId", required = true) + private String eventHubResourceId; + + /** + * The event hub consumer group. + */ + @JsonProperty(value = "properties.consumerGroup", required = true) + private String consumerGroup; + + /** + * The table where the data should be ingested. Optionally the table + * information can be added to each message. + */ + @JsonProperty(value = "properties.tableName", required = true) + private String tableName; + + /** + * The mapping rule to be used to ingest the data. Optionally the mapping + * information can be added to each message. + */ + @JsonProperty(value = "properties.mappingRuleName") + private String mappingRuleName; + + /** + * The data format of the message. Optionally the data format can be added + * to each message. Possible values include: 'MULTIJSON', 'JSON', 'CSV', + * 'TSV', 'SCSV', 'SOHSV', 'PSV', 'TXT', 'RAW', 'SINGLEJSON', 'AVRO'. + */ + @JsonProperty(value = "properties.dataFormat", required = true) + private DataFormat dataFormat; + + /** + * Get the resource ID of the storage account where the data resides. + * + * @return the storageAccountResourceId value + */ + public String storageAccountResourceId() { + return this.storageAccountResourceId; + } + + /** + * Set the resource ID of the storage account where the data resides. + * + * @param storageAccountResourceId the storageAccountResourceId value to set + * @return the EventGridDataConnection object itself. + */ + public EventGridDataConnection withStorageAccountResourceId(String storageAccountResourceId) { + this.storageAccountResourceId = storageAccountResourceId; + return this; + } + + /** + * Get the resource ID where the event grid is configured to send events. + * + * @return the eventHubResourceId value + */ + public String eventHubResourceId() { + return this.eventHubResourceId; + } + + /** + * Set the resource ID where the event grid is configured to send events. + * + * @param eventHubResourceId the eventHubResourceId value to set + * @return the EventGridDataConnection object itself. + */ + public EventGridDataConnection withEventHubResourceId(String eventHubResourceId) { + this.eventHubResourceId = eventHubResourceId; + return this; + } + + /** + * Get the event hub consumer group. + * + * @return the consumerGroup value + */ + public String consumerGroup() { + return this.consumerGroup; + } + + /** + * Set the event hub consumer group. + * + * @param consumerGroup the consumerGroup value to set + * @return the EventGridDataConnection object itself. + */ + public EventGridDataConnection withConsumerGroup(String consumerGroup) { + this.consumerGroup = consumerGroup; + return this; + } + + /** + * Get the table where the data should be ingested. Optionally the table information can be added to each message. + * + * @return the tableName value + */ + public String tableName() { + return this.tableName; + } + + /** + * Set the table where the data should be ingested. Optionally the table information can be added to each message. + * + * @param tableName the tableName value to set + * @return the EventGridDataConnection object itself. + */ + public EventGridDataConnection withTableName(String tableName) { + this.tableName = tableName; + return this; + } + + /** + * Get the mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. + * + * @return the mappingRuleName value + */ + public String mappingRuleName() { + return this.mappingRuleName; + } + + /** + * Set the mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. + * + * @param mappingRuleName the mappingRuleName value to set + * @return the EventGridDataConnection object itself. + */ + public EventGridDataConnection withMappingRuleName(String mappingRuleName) { + this.mappingRuleName = mappingRuleName; + return this; + } + + /** + * Get the data format of the message. Optionally the data format can be added to each message. Possible values include: 'MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'TXT', 'RAW', 'SINGLEJSON', 'AVRO'. + * + * @return the dataFormat value + */ + public DataFormat dataFormat() { + return this.dataFormat; + } + + /** + * Set the data format of the message. Optionally the data format can be added to each message. Possible values include: 'MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'TXT', 'RAW', 'SINGLEJSON', 'AVRO'. + * + * @param dataFormat the dataFormat value to set + * @return the EventGridDataConnection object itself. + */ + public EventGridDataConnection withDataFormat(DataFormat dataFormat) { + this.dataFormat = dataFormat; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/EventHubDataConnection.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/EventHubDataConnection.java new file mode 100644 index 000000000000..b1d8f9295c93 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/EventHubDataConnection.java @@ -0,0 +1,185 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.DataConnectionInner; + +/** + * Class representing an event hub data connection. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind", defaultImpl = EventHubDataConnection.class) +@JsonTypeName("EventHub") +@JsonFlatten +public class EventHubDataConnection extends DataConnectionInner { + /** + * The resource ID of the event hub to be used to create a data connection. + */ + @JsonProperty(value = "properties.eventHubResourceId", required = true) + private String eventHubResourceId; + + /** + * The event hub consumer group. + */ + @JsonProperty(value = "properties.consumerGroup", required = true) + private String consumerGroup; + + /** + * The table where the data should be ingested. Optionally the table + * information can be added to each message. + */ + @JsonProperty(value = "properties.tableName") + private String tableName; + + /** + * The mapping rule to be used to ingest the data. Optionally the mapping + * information can be added to each message. + */ + @JsonProperty(value = "properties.mappingRuleName") + private String mappingRuleName; + + /** + * The data format of the message. Optionally the data format can be added + * to each message. Possible values include: 'MULTIJSON', 'JSON', 'CSV', + * 'TSV', 'SCSV', 'SOHSV', 'PSV', 'TXT', 'RAW', 'SINGLEJSON', 'AVRO'. + */ + @JsonProperty(value = "properties.dataFormat") + private DataFormat dataFormat; + + /** + * System properties of the event hub. + */ + @JsonProperty(value = "properties.eventSystemProperties") + private List eventSystemProperties; + + /** + * Get the resource ID of the event hub to be used to create a data connection. + * + * @return the eventHubResourceId value + */ + public String eventHubResourceId() { + return this.eventHubResourceId; + } + + /** + * Set the resource ID of the event hub to be used to create a data connection. + * + * @param eventHubResourceId the eventHubResourceId value to set + * @return the EventHubDataConnection object itself. + */ + public EventHubDataConnection withEventHubResourceId(String eventHubResourceId) { + this.eventHubResourceId = eventHubResourceId; + return this; + } + + /** + * Get the event hub consumer group. + * + * @return the consumerGroup value + */ + public String consumerGroup() { + return this.consumerGroup; + } + + /** + * Set the event hub consumer group. + * + * @param consumerGroup the consumerGroup value to set + * @return the EventHubDataConnection object itself. + */ + public EventHubDataConnection withConsumerGroup(String consumerGroup) { + this.consumerGroup = consumerGroup; + return this; + } + + /** + * Get the table where the data should be ingested. Optionally the table information can be added to each message. + * + * @return the tableName value + */ + public String tableName() { + return this.tableName; + } + + /** + * Set the table where the data should be ingested. Optionally the table information can be added to each message. + * + * @param tableName the tableName value to set + * @return the EventHubDataConnection object itself. + */ + public EventHubDataConnection withTableName(String tableName) { + this.tableName = tableName; + return this; + } + + /** + * Get the mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. + * + * @return the mappingRuleName value + */ + public String mappingRuleName() { + return this.mappingRuleName; + } + + /** + * Set the mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. + * + * @param mappingRuleName the mappingRuleName value to set + * @return the EventHubDataConnection object itself. + */ + public EventHubDataConnection withMappingRuleName(String mappingRuleName) { + this.mappingRuleName = mappingRuleName; + return this; + } + + /** + * Get the data format of the message. Optionally the data format can be added to each message. Possible values include: 'MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'TXT', 'RAW', 'SINGLEJSON', 'AVRO'. + * + * @return the dataFormat value + */ + public DataFormat dataFormat() { + return this.dataFormat; + } + + /** + * Set the data format of the message. Optionally the data format can be added to each message. Possible values include: 'MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'TXT', 'RAW', 'SINGLEJSON', 'AVRO'. + * + * @param dataFormat the dataFormat value to set + * @return the EventHubDataConnection object itself. + */ + public EventHubDataConnection withDataFormat(DataFormat dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + /** + * Get system properties of the event hub. + * + * @return the eventSystemProperties value + */ + public List eventSystemProperties() { + return this.eventSystemProperties; + } + + /** + * Set system properties of the event hub. + * + * @param eventSystemProperties the eventSystemProperties value to set + * @return the EventHubDataConnection object itself. + */ + public EventHubDataConnection withEventSystemProperties(List eventSystemProperties) { + this.eventSystemProperties = eventSystemProperties; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/IotHubDataConnection.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/IotHubDataConnection.java new file mode 100644 index 000000000000..94447d53561f --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/IotHubDataConnection.java @@ -0,0 +1,211 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.DataConnectionInner; + +/** + * Class representing an iot hub data connection. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind", defaultImpl = IotHubDataConnection.class) +@JsonTypeName("IotHub") +@JsonFlatten +public class IotHubDataConnection extends DataConnectionInner { + /** + * The resource ID of the Iot hub to be used to create a data connection. + */ + @JsonProperty(value = "properties.iotHubResourceId", required = true) + private String iotHubResourceId; + + /** + * The iot hub consumer group. + */ + @JsonProperty(value = "properties.consumerGroup", required = true) + private String consumerGroup; + + /** + * The table where the data should be ingested. Optionally the table + * information can be added to each message. + */ + @JsonProperty(value = "properties.tableName") + private String tableName; + + /** + * The mapping rule to be used to ingest the data. Optionally the mapping + * information can be added to each message. + */ + @JsonProperty(value = "properties.mappingRuleName") + private String mappingRuleName; + + /** + * The data format of the message. Optionally the data format can be added + * to each message. Possible values include: 'MULTIJSON', 'JSON', 'CSV', + * 'TSV', 'SCSV', 'SOHSV', 'PSV', 'TXT', 'RAW', 'SINGLEJSON', 'AVRO'. + */ + @JsonProperty(value = "properties.dataFormat") + private DataFormat dataFormat; + + /** + * System properties of the iot hub. + */ + @JsonProperty(value = "properties.eventSystemProperties") + private List eventSystemProperties; + + /** + * The name of the share access policy name. + */ + @JsonProperty(value = "properties.sharedAccessPolicyName", required = true) + private String sharedAccessPolicyName; + + /** + * Get the resource ID of the Iot hub to be used to create a data connection. + * + * @return the iotHubResourceId value + */ + public String iotHubResourceId() { + return this.iotHubResourceId; + } + + /** + * Set the resource ID of the Iot hub to be used to create a data connection. + * + * @param iotHubResourceId the iotHubResourceId value to set + * @return the IotHubDataConnection object itself. + */ + public IotHubDataConnection withIotHubResourceId(String iotHubResourceId) { + this.iotHubResourceId = iotHubResourceId; + return this; + } + + /** + * Get the iot hub consumer group. + * + * @return the consumerGroup value + */ + public String consumerGroup() { + return this.consumerGroup; + } + + /** + * Set the iot hub consumer group. + * + * @param consumerGroup the consumerGroup value to set + * @return the IotHubDataConnection object itself. + */ + public IotHubDataConnection withConsumerGroup(String consumerGroup) { + this.consumerGroup = consumerGroup; + return this; + } + + /** + * Get the table where the data should be ingested. Optionally the table information can be added to each message. + * + * @return the tableName value + */ + public String tableName() { + return this.tableName; + } + + /** + * Set the table where the data should be ingested. Optionally the table information can be added to each message. + * + * @param tableName the tableName value to set + * @return the IotHubDataConnection object itself. + */ + public IotHubDataConnection withTableName(String tableName) { + this.tableName = tableName; + return this; + } + + /** + * Get the mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. + * + * @return the mappingRuleName value + */ + public String mappingRuleName() { + return this.mappingRuleName; + } + + /** + * Set the mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. + * + * @param mappingRuleName the mappingRuleName value to set + * @return the IotHubDataConnection object itself. + */ + public IotHubDataConnection withMappingRuleName(String mappingRuleName) { + this.mappingRuleName = mappingRuleName; + return this; + } + + /** + * Get the data format of the message. Optionally the data format can be added to each message. Possible values include: 'MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'TXT', 'RAW', 'SINGLEJSON', 'AVRO'. + * + * @return the dataFormat value + */ + public DataFormat dataFormat() { + return this.dataFormat; + } + + /** + * Set the data format of the message. Optionally the data format can be added to each message. Possible values include: 'MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'TXT', 'RAW', 'SINGLEJSON', 'AVRO'. + * + * @param dataFormat the dataFormat value to set + * @return the IotHubDataConnection object itself. + */ + public IotHubDataConnection withDataFormat(DataFormat dataFormat) { + this.dataFormat = dataFormat; + return this; + } + + /** + * Get system properties of the iot hub. + * + * @return the eventSystemProperties value + */ + public List eventSystemProperties() { + return this.eventSystemProperties; + } + + /** + * Set system properties of the iot hub. + * + * @param eventSystemProperties the eventSystemProperties value to set + * @return the IotHubDataConnection object itself. + */ + public IotHubDataConnection withEventSystemProperties(List eventSystemProperties) { + this.eventSystemProperties = eventSystemProperties; + return this; + } + + /** + * Get the name of the share access policy name. + * + * @return the sharedAccessPolicyName value + */ + public String sharedAccessPolicyName() { + return this.sharedAccessPolicyName; + } + + /** + * Set the name of the share access policy name. + * + * @param sharedAccessPolicyName the sharedAccessPolicyName value to set + * @return the IotHubDataConnection object itself. + */ + public IotHubDataConnection withSharedAccessPolicyName(String sharedAccessPolicyName) { + this.sharedAccessPolicyName = sharedAccessPolicyName; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/Operation.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/Operation.java new file mode 100644 index 000000000000..a818de2b22d9 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/Operation.java @@ -0,0 +1,40 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.KustoManager; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the origin value. + */ + String origin(); + + /** + * @return the properties value. + */ + Object properties(); + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/OperationDisplay.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/OperationDisplay.java new file mode 100644 index 000000000000..28f15e264f6c --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/OperationDisplay.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that describes the operation. + */ +public class OperationDisplay { + /** + * Friendly name of the resource provider. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * The operation type. + * For example: read, write, delete. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * The resource type on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * The friendly name of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider value. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider value. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get for example: read, write, delete. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set for example: read, write, delete. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the resource value. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource value. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the description value. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description value. + * + * @param description the description value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/Operations.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/Operations.java new file mode 100644 index 000000000000..b93cf9675a29 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import rx.Observable; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists available operations for the Microsoft.Kusto provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/OptimizedAutoscale.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/OptimizedAutoscale.java new file mode 100644 index 000000000000..a65896f75607 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/OptimizedAutoscale.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A class that contains the optimized auto scale definition. + */ +public class OptimizedAutoscale { + /** + * The version of the template defined, for instance 1. + */ + @JsonProperty(value = "version", required = true) + private int version; + + /** + * A boolean value that indicate if the optimized autoscale feature is + * enabled or not. + */ + @JsonProperty(value = "isEnabled", required = true) + private boolean isEnabled; + + /** + * Minimum allowed instances count. + */ + @JsonProperty(value = "minimum", required = true) + private int minimum; + + /** + * Maximum allowed instances count. + */ + @JsonProperty(value = "maximum", required = true) + private int maximum; + + /** + * Get the version of the template defined, for instance 1. + * + * @return the version value + */ + public int version() { + return this.version; + } + + /** + * Set the version of the template defined, for instance 1. + * + * @param version the version value to set + * @return the OptimizedAutoscale object itself. + */ + public OptimizedAutoscale withVersion(int version) { + this.version = version; + return this; + } + + /** + * Get a boolean value that indicate if the optimized autoscale feature is enabled or not. + * + * @return the isEnabled value + */ + public boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set a boolean value that indicate if the optimized autoscale feature is enabled or not. + * + * @param isEnabled the isEnabled value to set + * @return the OptimizedAutoscale object itself. + */ + public OptimizedAutoscale withIsEnabled(boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get minimum allowed instances count. + * + * @return the minimum value + */ + public int minimum() { + return this.minimum; + } + + /** + * Set minimum allowed instances count. + * + * @param minimum the minimum value to set + * @return the OptimizedAutoscale object itself. + */ + public OptimizedAutoscale withMinimum(int minimum) { + this.minimum = minimum; + return this; + } + + /** + * Get maximum allowed instances count. + * + * @return the maximum value + */ + public int maximum() { + return this.maximum; + } + + /** + * Set maximum allowed instances count. + * + * @param maximum the maximum value to set + * @return the OptimizedAutoscale object itself. + */ + public OptimizedAutoscale withMaximum(int maximum) { + this.maximum = maximum; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/ProvisioningState.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/ProvisioningState.java new file mode 100644 index 000000000000..2dfa8755ecb9 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/ProvisioningState.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ProvisioningState. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Running for ProvisioningState. */ + public static final ProvisioningState RUNNING = fromString("Running"); + + /** Static value Creating for ProvisioningState. */ + public static final ProvisioningState CREATING = fromString("Creating"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Moving for ProvisioningState. */ + public static final ProvisioningState MOVING = fromString("Moving"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * @param name a name to look for + * @return the corresponding ProvisioningState + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * @return known ProvisioningState values + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/Reason.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/Reason.java new file mode 100644 index 000000000000..3db10c3273c3 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/Reason.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Reason. + */ +public final class Reason extends ExpandableStringEnum { + /** Static value Invalid for Reason. */ + public static final Reason INVALID = fromString("Invalid"); + + /** Static value AlreadyExists for Reason. */ + public static final Reason ALREADY_EXISTS = fromString("AlreadyExists"); + + /** + * Creates or finds a Reason from its string representation. + * @param name a name to look for + * @return the corresponding Reason + */ + @JsonCreator + public static Reason fromString(String name) { + return fromString(name, Reason.class); + } + + /** + * @return known Reason values + */ + public static Collection values() { + return values(Reason.class); + } +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/SkuDescription.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/SkuDescription.java new file mode 100644 index 000000000000..d6c9816cea5b --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/SkuDescription.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.KustoManager; +import com.microsoft.azure.management.kusto.v2019_05_15.implementation.SkuDescriptionInner; +import java.util.List; + +/** + * Type representing SkuDescription. + */ +public interface SkuDescription extends HasInner, HasManager { + /** + * @return the locationInfo value. + */ + List locationInfo(); + + /** + * @return the locations value. + */ + List locations(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resourceType value. + */ + String resourceType(); + + /** + * @return the restrictions value. + */ + List restrictions(); + + /** + * @return the tier value. + */ + String tier(); + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/SkuLocationInfoItem.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/SkuLocationInfoItem.java new file mode 100644 index 000000000000..ca6cd7dcbcfe --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/SkuLocationInfoItem.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The locations and zones info for SKU. + */ +public class SkuLocationInfoItem { + /** + * The available location of the SKU. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * The available zone of the SKU. + */ + @JsonProperty(value = "zones") + private List zones; + + /** + * Get the available location of the SKU. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the available location of the SKU. + * + * @param location the location value to set + * @return the SkuLocationInfoItem object itself. + */ + public SkuLocationInfoItem withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the available zone of the SKU. + * + * @return the zones value + */ + public List zones() { + return this.zones; + } + + /** + * Set the available zone of the SKU. + * + * @param zones the zones value to set + * @return the SkuLocationInfoItem object itself. + */ + public SkuLocationInfoItem withZones(List zones) { + this.zones = zones; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/State.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/State.java new file mode 100644 index 000000000000..d58fec59362b --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/State.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for State. + */ +public final class State extends ExpandableStringEnum { + /** Static value Creating for State. */ + public static final State CREATING = fromString("Creating"); + + /** Static value Unavailable for State. */ + public static final State UNAVAILABLE = fromString("Unavailable"); + + /** Static value Running for State. */ + public static final State RUNNING = fromString("Running"); + + /** Static value Deleting for State. */ + public static final State DELETING = fromString("Deleting"); + + /** Static value Deleted for State. */ + public static final State DELETED = fromString("Deleted"); + + /** Static value Stopping for State. */ + public static final State STOPPING = fromString("Stopping"); + + /** Static value Stopped for State. */ + public static final State STOPPED = fromString("Stopped"); + + /** Static value Starting for State. */ + public static final State STARTING = fromString("Starting"); + + /** Static value Updating for State. */ + public static final State UPDATING = fromString("Updating"); + + /** + * Creates or finds a State from its string representation. + * @param name a name to look for + * @return the corresponding State + */ + @JsonCreator + public static State fromString(String name) { + return fromString(name, State.class); + } + + /** + * @return known State values + */ + public static Collection values() { + return values(State.class); + } +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/TrustedExternalTenant.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/TrustedExternalTenant.java new file mode 100644 index 000000000000..c757dbbf6d39 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/TrustedExternalTenant.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents a tenant ID that is trusted by the cluster. + */ +public class TrustedExternalTenant { + /** + * GUID representing an external tenant. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get gUID representing an external tenant. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set gUID representing an external tenant. + * + * @param value the value value to set + * @return the TrustedExternalTenant object itself. + */ + public TrustedExternalTenant withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/VirtualNetworkConfiguration.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/VirtualNetworkConfiguration.java new file mode 100644 index 000000000000..4b37021ac72d --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/VirtualNetworkConfiguration.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A class that contains virtual network definition. + */ +public class VirtualNetworkConfiguration { + /** + * The subnet resource id. + */ + @JsonProperty(value = "subnetId", required = true) + private String subnetId; + + /** + * Engine service's public IP address resource id. + */ + @JsonProperty(value = "enginePublicIpId", required = true) + private String enginePublicIpId; + + /** + * Data management's service public IP address resource id. + */ + @JsonProperty(value = "dataManagementPublicIpId", required = true) + private String dataManagementPublicIpId; + + /** + * Get the subnet resource id. + * + * @return the subnetId value + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set the subnet resource id. + * + * @param subnetId the subnetId value to set + * @return the VirtualNetworkConfiguration object itself. + */ + public VirtualNetworkConfiguration withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Get engine service's public IP address resource id. + * + * @return the enginePublicIpId value + */ + public String enginePublicIpId() { + return this.enginePublicIpId; + } + + /** + * Set engine service's public IP address resource id. + * + * @param enginePublicIpId the enginePublicIpId value to set + * @return the VirtualNetworkConfiguration object itself. + */ + public VirtualNetworkConfiguration withEnginePublicIpId(String enginePublicIpId) { + this.enginePublicIpId = enginePublicIpId; + return this; + } + + /** + * Get data management's service public IP address resource id. + * + * @return the dataManagementPublicIpId value + */ + public String dataManagementPublicIpId() { + return this.dataManagementPublicIpId; + } + + /** + * Set data management's service public IP address resource id. + * + * @param dataManagementPublicIpId the dataManagementPublicIpId value to set + * @return the VirtualNetworkConfiguration object itself. + */ + public VirtualNetworkConfiguration withDataManagementPublicIpId(String dataManagementPublicIpId) { + this.dataManagementPublicIpId = dataManagementPublicIpId; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/AzureResourceSkuImpl.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/AzureResourceSkuImpl.java new file mode 100644 index 000000000000..dd3c5904c18c --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/AzureResourceSkuImpl.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.microsoft.azure.management.kusto.v2019_05_15.AzureResourceSku; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.kusto.v2019_05_15.AzureCapacity; +import com.microsoft.azure.management.kusto.v2019_05_15.AzureSku; + +class AzureResourceSkuImpl extends WrapperImpl implements AzureResourceSku { + private final KustoManager manager; + + AzureResourceSkuImpl(AzureResourceSkuInner inner, KustoManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public KustoManager manager() { + return this.manager; + } + + + + @Override + public AzureCapacity capacity() { + return this.inner().capacity(); + } + + @Override + public String resourceType() { + return this.inner().resourceType(); + } + + @Override + public AzureSku sku() { + return this.inner().sku(); + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/AzureResourceSkuInner.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/AzureResourceSkuInner.java new file mode 100644 index 000000000000..6636608314a9 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/AzureResourceSkuInner.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.microsoft.azure.management.kusto.v2019_05_15.AzureSku; +import com.microsoft.azure.management.kusto.v2019_05_15.AzureCapacity; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Azure resource SKU definition. + */ +public class AzureResourceSkuInner { + /** + * Resource Namespace and Type. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /** + * The SKU details. + */ + @JsonProperty(value = "sku") + private AzureSku sku; + + /** + * The number of instances of the cluster. + */ + @JsonProperty(value = "capacity") + private AzureCapacity capacity; + + /** + * Get resource Namespace and Type. + * + * @return the resourceType value + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set resource Namespace and Type. + * + * @param resourceType the resourceType value to set + * @return the AzureResourceSkuInner object itself. + */ + public AzureResourceSkuInner withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the SKU details. + * + * @return the sku value + */ + public AzureSku sku() { + return this.sku; + } + + /** + * Set the SKU details. + * + * @param sku the sku value to set + * @return the AzureResourceSkuInner object itself. + */ + public AzureResourceSkuInner withSku(AzureSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the number of instances of the cluster. + * + * @return the capacity value + */ + public AzureCapacity capacity() { + return this.capacity; + } + + /** + * Set the number of instances of the cluster. + * + * @param capacity the capacity value to set + * @return the AzureResourceSkuInner object itself. + */ + public AzureResourceSkuInner withCapacity(AzureCapacity capacity) { + this.capacity = capacity; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/CheckNameResultImpl.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/CheckNameResultImpl.java new file mode 100644 index 000000000000..5981f230af13 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/CheckNameResultImpl.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.microsoft.azure.management.kusto.v2019_05_15.CheckNameResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.kusto.v2019_05_15.Reason; + +class CheckNameResultImpl extends WrapperImpl implements CheckNameResult { + private final KustoManager manager; + CheckNameResultImpl(CheckNameResultInner inner, KustoManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public KustoManager manager() { + return this.manager; + } + + @Override + public String message() { + return this.inner().message(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Boolean nameAvailable() { + return this.inner().nameAvailable(); + } + + @Override + public Reason reason() { + return this.inner().reason(); + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/CheckNameResultInner.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/CheckNameResultInner.java new file mode 100644 index 000000000000..8203c03a178b --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/CheckNameResultInner.java @@ -0,0 +1,124 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.microsoft.azure.management.kusto.v2019_05_15.Reason; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The result returned from a check name availability request. + */ +public class CheckNameResultInner { + /** + * Specifies a Boolean value that indicates if the name is available. + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /** + * The name that was checked. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Message indicating an unavailable name due to a conflict, or a + * description of the naming rules that are violated. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Message providing the reason why the given name is invalid. Possible + * values include: 'Invalid', 'AlreadyExists'. + */ + @JsonProperty(value = "reason") + private Reason reason; + + /** + * Get specifies a Boolean value that indicates if the name is available. + * + * @return the nameAvailable value + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set specifies a Boolean value that indicates if the name is available. + * + * @param nameAvailable the nameAvailable value to set + * @return the CheckNameResultInner object itself. + */ + public CheckNameResultInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the name that was checked. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name that was checked. + * + * @param name the name value to set + * @return the CheckNameResultInner object itself. + */ + public CheckNameResultInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get message indicating an unavailable name due to a conflict, or a description of the naming rules that are violated. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set message indicating an unavailable name due to a conflict, or a description of the naming rules that are violated. + * + * @param message the message value to set + * @return the CheckNameResultInner object itself. + */ + public CheckNameResultInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get message providing the reason why the given name is invalid. Possible values include: 'Invalid', 'AlreadyExists'. + * + * @return the reason value + */ + public Reason reason() { + return this.reason; + } + + /** + * Set message providing the reason why the given name is invalid. Possible values include: 'Invalid', 'AlreadyExists'. + * + * @param reason the reason value to set + * @return the CheckNameResultInner object itself. + */ + public CheckNameResultInner withReason(Reason reason) { + this.reason = reason; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/ClusterImpl.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/ClusterImpl.java new file mode 100644 index 000000000000..66e9bcd665d2 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/ClusterImpl.java @@ -0,0 +1,195 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.kusto.v2019_05_15.Cluster; +import rx.Observable; +import com.microsoft.azure.management.kusto.v2019_05_15.ClusterUpdate; +import java.util.List; +import com.microsoft.azure.management.kusto.v2019_05_15.AzureSku; +import com.microsoft.azure.management.kusto.v2019_05_15.State; +import com.microsoft.azure.management.kusto.v2019_05_15.ProvisioningState; +import com.microsoft.azure.management.kusto.v2019_05_15.TrustedExternalTenant; +import com.microsoft.azure.management.kusto.v2019_05_15.OptimizedAutoscale; +import com.microsoft.azure.management.kusto.v2019_05_15.VirtualNetworkConfiguration; +import rx.functions.Func1; + +class ClusterImpl extends GroupableResourceCoreImpl implements Cluster, Cluster.Definition, Cluster.Update { + private ClusterUpdate updateParameter; + ClusterImpl(String name, ClusterInner inner, KustoManager manager) { + super(name, inner, manager); + this.updateParameter = new ClusterUpdate(); + } + + @Override + public Observable createResourceAsync() { + ClustersInner client = this.manager().inner().clusters(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(new Func1() { + @Override + public ClusterInner call(ClusterInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ClustersInner client = this.manager().inner().clusters(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public ClusterInner call(ClusterInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ClustersInner client = this.manager().inner().clusters(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new ClusterUpdate(); + } + + @Override + public String dataIngestionUri() { + return this.inner().dataIngestionUri(); + } + + @Override + public Boolean enableDiskEncryption() { + return this.inner().enableDiskEncryption(); + } + + @Override + public Boolean enableStreamingIngest() { + return this.inner().enableStreamingIngest(); + } + + @Override + public OptimizedAutoscale optimizedAutoscale() { + return this.inner().optimizedAutoscale(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public AzureSku sku() { + return this.inner().sku(); + } + + @Override + public State state() { + return this.inner().state(); + } + + @Override + public List trustedExternalTenants() { + return this.inner().trustedExternalTenants(); + } + + @Override + public String uri() { + return this.inner().uri(); + } + + @Override + public VirtualNetworkConfiguration virtualNetworkConfiguration() { + return this.inner().virtualNetworkConfiguration(); + } + + @Override + public List zones() { + return this.inner().zones(); + } + + @Override + public ClusterImpl withZones(List zones) { + this.inner().withZones(zones); + return this; + } + + @Override + public ClusterImpl withSku(AzureSku sku) { + if (isInCreateMode()) { + this.inner().withSku(sku); + } else { + this.updateParameter.withSku(sku); + } + return this; + } + + @Override + public ClusterImpl withEnableDiskEncryption(Boolean enableDiskEncryption) { + if (isInCreateMode()) { + this.inner().withEnableDiskEncryption(enableDiskEncryption); + } else { + this.updateParameter.withEnableDiskEncryption(enableDiskEncryption); + } + return this; + } + + @Override + public ClusterImpl withEnableStreamingIngest(Boolean enableStreamingIngest) { + if (isInCreateMode()) { + this.inner().withEnableStreamingIngest(enableStreamingIngest); + } else { + this.updateParameter.withEnableStreamingIngest(enableStreamingIngest); + } + return this; + } + + @Override + public ClusterImpl withOptimizedAutoscale(OptimizedAutoscale optimizedAutoscale) { + if (isInCreateMode()) { + this.inner().withOptimizedAutoscale(optimizedAutoscale); + } else { + this.updateParameter.withOptimizedAutoscale(optimizedAutoscale); + } + return this; + } + + @Override + public ClusterImpl withTrustedExternalTenants(List trustedExternalTenants) { + if (isInCreateMode()) { + this.inner().withTrustedExternalTenants(trustedExternalTenants); + } else { + this.updateParameter.withTrustedExternalTenants(trustedExternalTenants); + } + return this; + } + + @Override + public ClusterImpl withVirtualNetworkConfiguration(VirtualNetworkConfiguration virtualNetworkConfiguration) { + if (isInCreateMode()) { + this.inner().withVirtualNetworkConfiguration(virtualNetworkConfiguration); + } else { + this.updateParameter.withVirtualNetworkConfiguration(virtualNetworkConfiguration); + } + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/ClusterInner.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/ClusterInner.java new file mode 100644 index 000000000000..68ea19f69295 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/ClusterInner.java @@ -0,0 +1,272 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.microsoft.azure.management.kusto.v2019_05_15.AzureSku; +import java.util.List; +import com.microsoft.azure.management.kusto.v2019_05_15.State; +import com.microsoft.azure.management.kusto.v2019_05_15.ProvisioningState; +import com.microsoft.azure.management.kusto.v2019_05_15.TrustedExternalTenant; +import com.microsoft.azure.management.kusto.v2019_05_15.OptimizedAutoscale; +import com.microsoft.azure.management.kusto.v2019_05_15.VirtualNetworkConfiguration; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Class representing a Kusto cluster. + */ +@JsonFlatten +public class ClusterInner extends Resource { + /** + * The SKU of the cluster. + */ + @JsonProperty(value = "sku", required = true) + private AzureSku sku; + + /** + * The availability zones of the cluster. + */ + @JsonProperty(value = "zones") + private List zones; + + /** + * The state of the resource. Possible values include: 'Creating', + * 'Unavailable', 'Running', 'Deleting', 'Deleted', 'Stopping', 'Stopped', + * 'Starting', 'Updating'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private State state; + + /** + * The provisioned state of the resource. Possible values include: + * 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Moving'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * The cluster URI. + */ + @JsonProperty(value = "properties.uri", access = JsonProperty.Access.WRITE_ONLY) + private String uri; + + /** + * The cluster data ingestion URI. + */ + @JsonProperty(value = "properties.dataIngestionUri", access = JsonProperty.Access.WRITE_ONLY) + private String dataIngestionUri; + + /** + * The cluster's external tenants. + */ + @JsonProperty(value = "properties.trustedExternalTenants") + private List trustedExternalTenants; + + /** + * Optimized auto scale definition. + */ + @JsonProperty(value = "properties.optimizedAutoscale") + private OptimizedAutoscale optimizedAutoscale; + + /** + * A boolean value that indicates if the cluster's disks are encrypted. + */ + @JsonProperty(value = "properties.enableDiskEncryption") + private Boolean enableDiskEncryption; + + /** + * A boolean value that indicates if the streaming ingest is enabled. + */ + @JsonProperty(value = "properties.enableStreamingIngest") + private Boolean enableStreamingIngest; + + /** + * Virtual network definition. + */ + @JsonProperty(value = "properties.virtualNetworkConfiguration") + private VirtualNetworkConfiguration virtualNetworkConfiguration; + + /** + * Get the SKU of the cluster. + * + * @return the sku value + */ + public AzureSku sku() { + return this.sku; + } + + /** + * Set the SKU of the cluster. + * + * @param sku the sku value to set + * @return the ClusterInner object itself. + */ + public ClusterInner withSku(AzureSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the availability zones of the cluster. + * + * @return the zones value + */ + public List zones() { + return this.zones; + } + + /** + * Set the availability zones of the cluster. + * + * @param zones the zones value to set + * @return the ClusterInner object itself. + */ + public ClusterInner withZones(List zones) { + this.zones = zones; + return this; + } + + /** + * Get the state of the resource. Possible values include: 'Creating', 'Unavailable', 'Running', 'Deleting', 'Deleted', 'Stopping', 'Stopped', 'Starting', 'Updating'. + * + * @return the state value + */ + public State state() { + return this.state; + } + + /** + * Get the provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Moving'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the cluster URI. + * + * @return the uri value + */ + public String uri() { + return this.uri; + } + + /** + * Get the cluster data ingestion URI. + * + * @return the dataIngestionUri value + */ + public String dataIngestionUri() { + return this.dataIngestionUri; + } + + /** + * Get the cluster's external tenants. + * + * @return the trustedExternalTenants value + */ + public List trustedExternalTenants() { + return this.trustedExternalTenants; + } + + /** + * Set the cluster's external tenants. + * + * @param trustedExternalTenants the trustedExternalTenants value to set + * @return the ClusterInner object itself. + */ + public ClusterInner withTrustedExternalTenants(List trustedExternalTenants) { + this.trustedExternalTenants = trustedExternalTenants; + return this; + } + + /** + * Get optimized auto scale definition. + * + * @return the optimizedAutoscale value + */ + public OptimizedAutoscale optimizedAutoscale() { + return this.optimizedAutoscale; + } + + /** + * Set optimized auto scale definition. + * + * @param optimizedAutoscale the optimizedAutoscale value to set + * @return the ClusterInner object itself. + */ + public ClusterInner withOptimizedAutoscale(OptimizedAutoscale optimizedAutoscale) { + this.optimizedAutoscale = optimizedAutoscale; + return this; + } + + /** + * Get a boolean value that indicates if the cluster's disks are encrypted. + * + * @return the enableDiskEncryption value + */ + public Boolean enableDiskEncryption() { + return this.enableDiskEncryption; + } + + /** + * Set a boolean value that indicates if the cluster's disks are encrypted. + * + * @param enableDiskEncryption the enableDiskEncryption value to set + * @return the ClusterInner object itself. + */ + public ClusterInner withEnableDiskEncryption(Boolean enableDiskEncryption) { + this.enableDiskEncryption = enableDiskEncryption; + return this; + } + + /** + * Get a boolean value that indicates if the streaming ingest is enabled. + * + * @return the enableStreamingIngest value + */ + public Boolean enableStreamingIngest() { + return this.enableStreamingIngest; + } + + /** + * Set a boolean value that indicates if the streaming ingest is enabled. + * + * @param enableStreamingIngest the enableStreamingIngest value to set + * @return the ClusterInner object itself. + */ + public ClusterInner withEnableStreamingIngest(Boolean enableStreamingIngest) { + this.enableStreamingIngest = enableStreamingIngest; + return this; + } + + /** + * Get virtual network definition. + * + * @return the virtualNetworkConfiguration value + */ + public VirtualNetworkConfiguration virtualNetworkConfiguration() { + return this.virtualNetworkConfiguration; + } + + /** + * Set virtual network definition. + * + * @param virtualNetworkConfiguration the virtualNetworkConfiguration value to set + * @return the ClusterInner object itself. + */ + public ClusterInner withVirtualNetworkConfiguration(VirtualNetworkConfiguration virtualNetworkConfiguration) { + this.virtualNetworkConfiguration = virtualNetworkConfiguration; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/ClustersImpl.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/ClustersImpl.java new file mode 100644 index 000000000000..5a9711521b6d --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/ClustersImpl.java @@ -0,0 +1,206 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * def + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.kusto.v2019_05_15.Clusters; +import com.microsoft.azure.management.kusto.v2019_05_15.Cluster; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import java.util.List; +import com.microsoft.azure.management.kusto.v2019_05_15.CheckNameResult; +import com.microsoft.azure.management.kusto.v2019_05_15.AzureResourceSku; +import com.microsoft.azure.management.kusto.v2019_05_15.SkuDescription; + +class ClustersImpl extends GroupableResourcesCoreImpl implements Clusters { + protected ClustersImpl(KustoManager manager) { + super(manager.inner().clusters(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + ClustersInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + ClustersInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + ClustersInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + ClustersInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public Cluster call(ClusterInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + ClustersInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + ClustersInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerList) { + return Observable.from(innerList.items()); + } + }) + .map(new Func1() { + @Override + public Cluster call(ClusterInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public ClusterImpl define(String name) { + return wrapModel(name); + } + + @Override + public Completable stopAsync(String resourceGroupName, String clusterName) { + ClustersInner client = this.inner(); + return client.stopAsync(resourceGroupName, clusterName).toCompletable(); + } + + @Override + public Completable startAsync(String resourceGroupName, String clusterName) { + ClustersInner client = this.inner(); + return client.startAsync(resourceGroupName, clusterName).toCompletable(); + } + + @Override + protected ClusterImpl wrapModel(ClusterInner inner) { + return new ClusterImpl(inner.name(), inner, manager()); + } + + @Override + protected ClusterImpl wrapModel(String name) { + return new ClusterImpl(name, new ClusterInner(), this.manager()); + } + + private AzureResourceSkuImpl wrapAzureResourceSkuModel(AzureResourceSkuInner inner) { + return new AzureResourceSkuImpl(inner, manager()); + } + + @Override + public Observable checkNameAvailabilityAsync(String location, String name) { + ClustersInner client = this.inner(); + return client.checkNameAvailabilityAsync(location, name) + .map(new Func1() { + @Override + public CheckNameResult call(CheckNameResultInner inner) { + return new CheckNameResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listSkusByResourceAsync(String resourceGroupName, String clusterName) { + ClustersInner client = this.inner(); + return client.listSkusByResourceAsync(resourceGroupName, clusterName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public AzureResourceSku call(AzureResourceSkuInner inner) { + return wrapAzureResourceSkuModel(inner); + } + }); + } + + @Override + public Observable listSkusAsync() { + ClustersInner client = this.inner(); + return client.listSkusAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public SkuDescription call(SkuDescriptionInner inner) { + return new SkuDescriptionImpl(inner, manager()); + } + }); + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/ClustersInner.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/ClustersInner.java new file mode 100644 index 000000000000..0f3abb72e5eb --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/ClustersInner.java @@ -0,0 +1,1458 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.kusto.v2019_05_15.ClusterCheckNameRequest; +import com.microsoft.azure.management.kusto.v2019_05_15.ClusterUpdate; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Clusters. + */ +public class ClustersInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ClustersService service; + /** The service client containing this operation class. */ + private KustoManagementClientImpl client; + + /** + * Initializes an instance of ClustersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ClustersInner(Retrofit retrofit, KustoManagementClientImpl client) { + this.service = retrofit.create(ClustersService.class); + this.client = client; + } + + /** + * The interface defining all the services for Clusters to be + * used by Retrofit to perform actually REST calls. + */ + interface ClustersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Clusters getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Clusters createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("subscriptionId") String subscriptionId, @Body ClusterInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Clusters beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("subscriptionId") String subscriptionId, @Body ClusterInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Clusters update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("subscriptionId") String subscriptionId, @Body ClusterUpdate parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Clusters beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("subscriptionId") String subscriptionId, @Body ClusterUpdate parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Clusters delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Clusters beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Clusters stop" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/stop") + Observable> stop(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Clusters beginStop" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/stop") + Observable> beginStop(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Clusters start" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/start") + Observable> start(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Clusters beginStart" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/start") + Observable> beginStart(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Clusters listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Clusters list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Kusto/clusters") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Clusters listSkus" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Kusto/skus") + Observable> listSkus(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Clusters checkNameAvailability" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/checkNameAvailability") + Observable> checkNameAvailability(@Path("subscriptionId") String subscriptionId, @Path("location") String location, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ClusterCheckNameRequest clusterName, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Clusters listSkusByResource" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/skus") + Observable> listSkusByResource(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ClusterInner object if successful. + */ + public ClusterInner getByResourceGroup(String resourceGroupName, String clusterName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body(); + } + + /** + * Gets a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String clusterName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, clusterName), serviceCallback); + } + + /** + * Gets a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ClusterInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String clusterName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1, ClusterInner>() { + @Override + public ClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ClusterInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String clusterName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(resourceGroupName, clusterName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Create or update a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param parameters The Kusto cluster parameters supplied to the CreateOrUpdate operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ClusterInner object if successful. + */ + public ClusterInner createOrUpdate(String resourceGroupName, String clusterName, ClusterInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).toBlocking().last().body(); + } + + /** + * Create or update a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param parameters The Kusto cluster parameters supplied to the CreateOrUpdate operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String clusterName, ClusterInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters), serviceCallback); + } + + /** + * Create or update a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param parameters The Kusto cluster parameters supplied to the CreateOrUpdate operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String clusterName, ClusterInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1, ClusterInner>() { + @Override + public ClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param parameters The Kusto cluster parameters supplied to the CreateOrUpdate operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String clusterName, ClusterInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdate(resourceGroupName, clusterName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param parameters The Kusto cluster parameters supplied to the CreateOrUpdate operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ClusterInner object if successful. + */ + public ClusterInner beginCreateOrUpdate(String resourceGroupName, String clusterName, ClusterInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).toBlocking().single().body(); + } + + /** + * Create or update a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param parameters The Kusto cluster parameters supplied to the CreateOrUpdate operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String clusterName, ClusterInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters), serviceCallback); + } + + /** + * Create or update a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param parameters The Kusto cluster parameters supplied to the CreateOrUpdate operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ClusterInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String clusterName, ClusterInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1, ClusterInner>() { + @Override + public ClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param parameters The Kusto cluster parameters supplied to the CreateOrUpdate operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ClusterInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String clusterName, ClusterInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdate(resourceGroupName, clusterName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Update a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param parameters The Kusto cluster parameters supplied to the Update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ClusterInner object if successful. + */ + public ClusterInner update(String resourceGroupName, String clusterName, ClusterUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).toBlocking().last().body(); + } + + /** + * Update a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param parameters The Kusto cluster parameters supplied to the Update operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String clusterName, ClusterUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, clusterName, parameters), serviceCallback); + } + + /** + * Update a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param parameters The Kusto cluster parameters supplied to the Update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String clusterName, ClusterUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1, ClusterInner>() { + @Override + public ClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param parameters The Kusto cluster parameters supplied to the Update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String clusterName, ClusterUpdate parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.update(resourceGroupName, clusterName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Update a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param parameters The Kusto cluster parameters supplied to the Update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ClusterInner object if successful. + */ + public ClusterInner beginUpdate(String resourceGroupName, String clusterName, ClusterUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).toBlocking().single().body(); + } + + /** + * Update a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param parameters The Kusto cluster parameters supplied to the Update operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateAsync(String resourceGroupName, String clusterName, ClusterUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters), serviceCallback); + } + + /** + * Update a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param parameters The Kusto cluster parameters supplied to the Update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ClusterInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String clusterName, ClusterUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1, ClusterInner>() { + @Override + public ClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param parameters The Kusto cluster parameters supplied to the Update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ClusterInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String clusterName, ClusterUpdate parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginUpdate(resourceGroupName, clusterName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String clusterName) { + deleteWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().last().body(); + } + + /** + * Deletes a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String clusterName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, clusterName), serviceCallback); + } + + /** + * Deletes a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String clusterName) { + return deleteWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String clusterName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, clusterName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String clusterName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body(); + } + + /** + * Deletes a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String clusterName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, clusterName), serviceCallback); + } + + /** + * Deletes a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String clusterName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String clusterName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, clusterName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Stops a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void stop(String resourceGroupName, String clusterName) { + stopWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().last().body(); + } + + /** + * Stops a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture stopAsync(String resourceGroupName, String clusterName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(stopWithServiceResponseAsync(resourceGroupName, clusterName), serviceCallback); + } + + /** + * Stops a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable stopAsync(String resourceGroupName, String clusterName) { + return stopWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Stops a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> stopWithServiceResponseAsync(String resourceGroupName, String clusterName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.stop(resourceGroupName, clusterName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Stops a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginStop(String resourceGroupName, String clusterName) { + beginStopWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body(); + } + + /** + * Stops a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginStopAsync(String resourceGroupName, String clusterName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginStopWithServiceResponseAsync(resourceGroupName, clusterName), serviceCallback); + } + + /** + * Stops a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginStopAsync(String resourceGroupName, String clusterName) { + return beginStopWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Stops a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginStopWithServiceResponseAsync(String resourceGroupName, String clusterName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginStop(resourceGroupName, clusterName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginStopDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginStopDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Starts a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void start(String resourceGroupName, String clusterName) { + startWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().last().body(); + } + + /** + * Starts a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture startAsync(String resourceGroupName, String clusterName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(startWithServiceResponseAsync(resourceGroupName, clusterName), serviceCallback); + } + + /** + * Starts a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable startAsync(String resourceGroupName, String clusterName) { + return startWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Starts a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> startWithServiceResponseAsync(String resourceGroupName, String clusterName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.start(resourceGroupName, clusterName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Starts a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginStart(String resourceGroupName, String clusterName) { + beginStartWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body(); + } + + /** + * Starts a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginStartAsync(String resourceGroupName, String clusterName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginStartWithServiceResponseAsync(resourceGroupName, clusterName), serviceCallback); + } + + /** + * Starts a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginStartAsync(String resourceGroupName, String clusterName) { + return beginStartWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Starts a Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginStartWithServiceResponseAsync(String resourceGroupName, String clusterName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginStart(resourceGroupName, clusterName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginStartDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginStartDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all Kusto clusters within a resource group. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl page = new PageImpl<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Lists all Kusto clusters within a resource group. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Lists all Kusto clusters within a resource group. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @return the observable to the List<ClusterInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Lists all Kusto clusters within a resource group. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @return the observable to the List<ClusterInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all Kusto clusters within a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ClusterInner> object if successful. + */ + public PagedList list() { + PageImpl page = new PageImpl<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Lists all Kusto clusters within a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Lists all Kusto clusters within a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ClusterInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Lists all Kusto clusters within a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ClusterInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists eligible SKUs for Kusto resource provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<SkuDescriptionInner> object if successful. + */ + public List listSkus() { + return listSkusWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Lists eligible SKUs for Kusto resource provider. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listSkusAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listSkusWithServiceResponseAsync(), serviceCallback); + } + + /** + * Lists eligible SKUs for Kusto resource provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<SkuDescriptionInner> object + */ + public Observable> listSkusAsync() { + return listSkusWithServiceResponseAsync().map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists eligible SKUs for Kusto resource provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<SkuDescriptionInner> object + */ + public Observable>> listSkusWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listSkus(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listSkusDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listSkusDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Checks that the cluster name is valid and is not already in use. + * + * @param location Azure location. + * @param name Cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CheckNameResultInner object if successful. + */ + public CheckNameResultInner checkNameAvailability(String location, String name) { + return checkNameAvailabilityWithServiceResponseAsync(location, name).toBlocking().single().body(); + } + + /** + * Checks that the cluster name is valid and is not already in use. + * + * @param location Azure location. + * @param name Cluster name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture checkNameAvailabilityAsync(String location, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkNameAvailabilityWithServiceResponseAsync(location, name), serviceCallback); + } + + /** + * Checks that the cluster name is valid and is not already in use. + * + * @param location Azure location. + * @param name Cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameResultInner object + */ + public Observable checkNameAvailabilityAsync(String location, String name) { + return checkNameAvailabilityWithServiceResponseAsync(location, name).map(new Func1, CheckNameResultInner>() { + @Override + public CheckNameResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks that the cluster name is valid and is not already in use. + * + * @param location Azure location. + * @param name Cluster name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameResultInner object + */ + public Observable> checkNameAvailabilityWithServiceResponseAsync(String location, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (location == null) { + throw new IllegalArgumentException("Parameter location is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + ClusterCheckNameRequest clusterName = new ClusterCheckNameRequest(); + clusterName.withName(name); + return service.checkNameAvailability(this.client.subscriptionId(), location, this.client.apiVersion(), this.client.acceptLanguage(), clusterName, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkNameAvailabilityDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkNameAvailabilityDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns the SKUs available for the provided resource. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<AzureResourceSkuInner> object if successful. + */ + public List listSkusByResource(String resourceGroupName, String clusterName) { + return listSkusByResourceWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body(); + } + + /** + * Returns the SKUs available for the provided resource. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listSkusByResourceAsync(String resourceGroupName, String clusterName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listSkusByResourceWithServiceResponseAsync(resourceGroupName, clusterName), serviceCallback); + } + + /** + * Returns the SKUs available for the provided resource. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<AzureResourceSkuInner> object + */ + public Observable> listSkusByResourceAsync(String resourceGroupName, String clusterName) { + return listSkusByResourceWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns the SKUs available for the provided resource. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<AzureResourceSkuInner> object + */ + public Observable>> listSkusByResourceWithServiceResponseAsync(String resourceGroupName, String clusterName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listSkusByResource(resourceGroupName, clusterName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listSkusByResourceDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listSkusByResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DataConnectionImpl.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DataConnectionImpl.java new file mode 100644 index 000000000000..1ff337e2c359 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DataConnectionImpl.java @@ -0,0 +1,108 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.microsoft.azure.management.kusto.v2019_05_15.DataConnection; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class DataConnectionImpl extends CreatableUpdatableImpl implements DataConnection, DataConnection.Definition, DataConnection.Update { + private final KustoManager manager; + private String resourceGroupName; + private String clusterName; + private String databaseName; + private String dataConnectionName; + + DataConnectionImpl(String name, KustoManager manager) { + super(name, new DataConnectionInner()); + this.manager = manager; + // Set resource name + this.dataConnectionName = name; + // + } + + DataConnectionImpl(DataConnectionInner inner, KustoManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.dataConnectionName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.clusterName = IdParsingUtils.getValueFromIdByName(inner.id(), "clusters"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + this.dataConnectionName = IdParsingUtils.getValueFromIdByName(inner.id(), "dataConnections"); + // + } + + @Override + public KustoManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DataConnectionsInner client = this.manager().inner().dataConnections(); + return client.createOrUpdateAsync(this.resourceGroupName, this.clusterName, this.databaseName, this.dataConnectionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DataConnectionsInner client = this.manager().inner().dataConnections(); + return client.updateAsync(this.resourceGroupName, this.clusterName, this.databaseName, this.dataConnectionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DataConnectionsInner client = this.manager().inner().dataConnections(); + return client.getAsync(this.resourceGroupName, this.clusterName, this.databaseName, this.dataConnectionName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DataConnectionImpl withExistingDatabasis(String resourceGroupName, String clusterName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.clusterName = clusterName; + this.databaseName = databaseName; + return this; + } + + @Override + public DataConnectionImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DataConnectionInner.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DataConnectionInner.java new file mode 100644 index 000000000000..f7b5d9df4997 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DataConnectionInner.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.microsoft.azure.ProxyResource; +import com.microsoft.azure.management.kusto.v2019_05_15.EventGridDataConnection; +import com.microsoft.azure.management.kusto.v2019_05_15.EventHubDataConnection; +import com.microsoft.azure.management.kusto.v2019_05_15.IotHubDataConnection; + +/** + * Class representing an data connection. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "kind", defaultImpl = DataConnectionInner.class) +@JsonTypeName("DataConnection") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "EventHub", value = EventHubDataConnection.class), + @JsonSubTypes.Type(name = "IotHub", value = IotHubDataConnection.class), + @JsonSubTypes.Type(name = "EventGrid", value = EventGridDataConnection.class) +}) +public class DataConnectionInner extends ProxyResource { + /** + * Resource location. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set resource location. + * + * @param location the location value to set + * @return the DataConnectionInner object itself. + */ + public DataConnectionInner withLocation(String location) { + this.location = location; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DataConnectionValidationListResultImpl.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DataConnectionValidationListResultImpl.java new file mode 100644 index 000000000000..b14a798a9130 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DataConnectionValidationListResultImpl.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.microsoft.azure.management.kusto.v2019_05_15.DataConnectionValidationListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.kusto.v2019_05_15.DataConnectionValidationResult; + +class DataConnectionValidationListResultImpl extends WrapperImpl implements DataConnectionValidationListResult { + private final KustoManager manager; + DataConnectionValidationListResultImpl(DataConnectionValidationListResultInner inner, KustoManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public KustoManager manager() { + return this.manager; + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DataConnectionValidationListResultInner.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DataConnectionValidationListResultInner.java new file mode 100644 index 000000000000..f63e79207da3 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DataConnectionValidationListResultInner.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import java.util.List; +import com.microsoft.azure.management.kusto.v2019_05_15.DataConnectionValidationResult; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The list Kusto data connection validation result. + */ +public class DataConnectionValidationListResultInner { + /** + * The list of Kusto data connection validation errors. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the list of Kusto data connection validation errors. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the list of Kusto data connection validation errors. + * + * @param value the value value to set + * @return the DataConnectionValidationListResultInner object itself. + */ + public DataConnectionValidationListResultInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DataConnectionsImpl.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DataConnectionsImpl.java new file mode 100644 index 000000000000..4ab78d53aa39 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DataConnectionsImpl.java @@ -0,0 +1,112 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.kusto.v2019_05_15.DataConnections; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.kusto.v2019_05_15.DataConnection; +import com.microsoft.azure.management.kusto.v2019_05_15.DataConnectionValidationListResult; +import com.microsoft.azure.management.kusto.v2019_05_15.CheckNameResult; +import com.microsoft.azure.management.kusto.v2019_05_15.DataConnectionValidation; + +class DataConnectionsImpl extends WrapperImpl implements DataConnections { + private final KustoManager manager; + + DataConnectionsImpl(KustoManager manager) { + super(manager.inner().dataConnections()); + this.manager = manager; + } + + public KustoManager manager() { + return this.manager; + } + + @Override + public DataConnectionImpl define(String name) { + return wrapModel(name); + } + + private DataConnectionImpl wrapModel(DataConnectionInner inner) { + return new DataConnectionImpl(inner, manager()); + } + + private DataConnectionImpl wrapModel(String name) { + return new DataConnectionImpl(name, this.manager()); + } + + @Override + public Observable listByDatabaseAsync(String resourceGroupName, String clusterName, String databaseName) { + DataConnectionsInner client = this.inner(); + return client.listByDatabaseAsync(resourceGroupName, clusterName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public DataConnection call(DataConnectionInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName) { + DataConnectionsInner client = this.inner(); + return client.getAsync(resourceGroupName, clusterName, databaseName, dataConnectionName) + .flatMap(new Func1>() { + @Override + public Observable call(DataConnectionInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((DataConnection)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName) { + DataConnectionsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, clusterName, databaseName, dataConnectionName).toCompletable(); + } + + @Override + public Observable dataConnectionValidationMethodAsync(String resourceGroupName, String clusterName, String databaseName, DataConnectionValidation parameters) { + DataConnectionsInner client = this.inner(); + return client.dataConnectionValidationMethodAsync(resourceGroupName, clusterName, databaseName, parameters) + .map(new Func1() { + @Override + public DataConnectionValidationListResult call(DataConnectionValidationListResultInner inner) { + return new DataConnectionValidationListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable checkNameAvailabilityAsync(String resourceGroupName, String clusterName, String databaseName, String name) { + DataConnectionsInner client = this.inner(); + return client.checkNameAvailabilityAsync(resourceGroupName, clusterName, databaseName, name) + .map(new Func1() { + @Override + public CheckNameResult call(CheckNameResultInner inner) { + return new CheckNameResultImpl(inner, manager()); + } + }); + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DataConnectionsInner.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DataConnectionsInner.java new file mode 100644 index 000000000000..92d4dc75bb23 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DataConnectionsInner.java @@ -0,0 +1,1091 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.kusto.v2019_05_15.DataConnectionCheckNameRequest; +import com.microsoft.azure.management.kusto.v2019_05_15.DataConnectionValidation; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DataConnections. + */ +public class DataConnectionsInner { + /** The Retrofit service to perform REST calls. */ + private DataConnectionsService service; + /** The service client containing this operation class. */ + private KustoManagementClientImpl client; + + /** + * Initializes an instance of DataConnectionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DataConnectionsInner(Retrofit retrofit, KustoManagementClientImpl client) { + this.service = retrofit.create(DataConnectionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DataConnections to be + * used by Retrofit to perform actually REST calls. + */ + interface DataConnectionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.DataConnections listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections") + Observable> listByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.DataConnections dataConnectionValidationMethod" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnectionValidation") + Observable> dataConnectionValidationMethod(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body DataConnectionValidation parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.DataConnections checkNameAvailability" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/checkNameAvailability") + Observable> checkNameAvailability(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body DataConnectionCheckNameRequest dataConnectionName, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.DataConnections get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("databaseName") String databaseName, @Path("dataConnectionName") String dataConnectionName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.DataConnections createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("databaseName") String databaseName, @Path("dataConnectionName") String dataConnectionName, @Path("subscriptionId") String subscriptionId, @Body DataConnectionInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.DataConnections beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("databaseName") String databaseName, @Path("dataConnectionName") String dataConnectionName, @Path("subscriptionId") String subscriptionId, @Body DataConnectionInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.DataConnections update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("databaseName") String databaseName, @Path("dataConnectionName") String dataConnectionName, @Path("subscriptionId") String subscriptionId, @Body DataConnectionInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.DataConnections beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("databaseName") String databaseName, @Path("dataConnectionName") String dataConnectionName, @Path("subscriptionId") String subscriptionId, @Body DataConnectionInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.DataConnections delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("databaseName") String databaseName, @Path("dataConnectionName") String dataConnectionName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.DataConnections beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("databaseName") String databaseName, @Path("dataConnectionName") String dataConnectionName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Returns the list of data connections of the given Kusto database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<DataConnectionInner> object if successful. + */ + public List listByDatabase(String resourceGroupName, String clusterName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, clusterName, databaseName).toBlocking().single().body(); + } + + /** + * Returns the list of data connections of the given Kusto database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseAsync(String resourceGroupName, String clusterName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseWithServiceResponseAsync(resourceGroupName, clusterName, databaseName), serviceCallback); + } + + /** + * Returns the list of data connections of the given Kusto database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DataConnectionInner> object + */ + public Observable> listByDatabaseAsync(String resourceGroupName, String clusterName, String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, clusterName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns the list of data connections of the given Kusto database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DataConnectionInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(String resourceGroupName, String clusterName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByDatabase(resourceGroupName, clusterName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Checks that the data connection parameters are valid. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param parameters The data connection parameters supplied to the CreateOrUpdate operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DataConnectionValidationListResultInner object if successful. + */ + public DataConnectionValidationListResultInner dataConnectionValidationMethod(String resourceGroupName, String clusterName, String databaseName, DataConnectionValidation parameters) { + return dataConnectionValidationMethodWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Checks that the data connection parameters are valid. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param parameters The data connection parameters supplied to the CreateOrUpdate operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture dataConnectionValidationMethodAsync(String resourceGroupName, String clusterName, String databaseName, DataConnectionValidation parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(dataConnectionValidationMethodWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, parameters), serviceCallback); + } + + /** + * Checks that the data connection parameters are valid. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param parameters The data connection parameters supplied to the CreateOrUpdate operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataConnectionValidationListResultInner object + */ + public Observable dataConnectionValidationMethodAsync(String resourceGroupName, String clusterName, String databaseName, DataConnectionValidation parameters) { + return dataConnectionValidationMethodWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, parameters).map(new Func1, DataConnectionValidationListResultInner>() { + @Override + public DataConnectionValidationListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks that the data connection parameters are valid. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param parameters The data connection parameters supplied to the CreateOrUpdate operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataConnectionValidationListResultInner object + */ + public Observable> dataConnectionValidationMethodWithServiceResponseAsync(String resourceGroupName, String clusterName, String databaseName, DataConnectionValidation parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.dataConnectionValidationMethod(resourceGroupName, clusterName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = dataConnectionValidationMethodDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse dataConnectionValidationMethodDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Checks that the data connection name is valid and is not already in use. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param name Data Connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CheckNameResultInner object if successful. + */ + public CheckNameResultInner checkNameAvailability(String resourceGroupName, String clusterName, String databaseName, String name) { + return checkNameAvailabilityWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, name).toBlocking().single().body(); + } + + /** + * Checks that the data connection name is valid and is not already in use. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param name Data Connection name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture checkNameAvailabilityAsync(String resourceGroupName, String clusterName, String databaseName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkNameAvailabilityWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, name), serviceCallback); + } + + /** + * Checks that the data connection name is valid and is not already in use. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param name Data Connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameResultInner object + */ + public Observable checkNameAvailabilityAsync(String resourceGroupName, String clusterName, String databaseName, String name) { + return checkNameAvailabilityWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, name).map(new Func1, CheckNameResultInner>() { + @Override + public CheckNameResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks that the data connection name is valid and is not already in use. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param name Data Connection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameResultInner object + */ + public Observable> checkNameAvailabilityWithServiceResponseAsync(String resourceGroupName, String clusterName, String databaseName, String name) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + DataConnectionCheckNameRequest dataConnectionName = new DataConnectionCheckNameRequest(); + dataConnectionName.withName(name); + return service.checkNameAvailability(resourceGroupName, clusterName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), dataConnectionName, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkNameAvailabilityDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkNameAvailabilityDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns a data connection. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DataConnectionInner object if successful. + */ + public DataConnectionInner get(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName) { + return getWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, dataConnectionName).toBlocking().single().body(); + } + + /** + * Returns a data connection. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, dataConnectionName), serviceCallback); + } + + /** + * Returns a data connection. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataConnectionInner object + */ + public Observable getAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName) { + return getWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, dataConnectionName).map(new Func1, DataConnectionInner>() { + @Override + public DataConnectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns a data connection. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataConnectionInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (dataConnectionName == null) { + throw new IllegalArgumentException("Parameter dataConnectionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, clusterName, databaseName, dataConnectionName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates a data connection. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @param parameters The data connection parameters supplied to the CreateOrUpdate operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DataConnectionInner object if successful. + */ + public DataConnectionInner createOrUpdate(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName, DataConnectionInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, dataConnectionName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a data connection. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @param parameters The data connection parameters supplied to the CreateOrUpdate operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName, DataConnectionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, dataConnectionName, parameters), serviceCallback); + } + + /** + * Creates or updates a data connection. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @param parameters The data connection parameters supplied to the CreateOrUpdate operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName, DataConnectionInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, dataConnectionName, parameters).map(new Func1, DataConnectionInner>() { + @Override + public DataConnectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a data connection. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @param parameters The data connection parameters supplied to the CreateOrUpdate operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName, DataConnectionInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (dataConnectionName == null) { + throw new IllegalArgumentException("Parameter dataConnectionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdate(resourceGroupName, clusterName, databaseName, dataConnectionName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates a data connection. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @param parameters The data connection parameters supplied to the CreateOrUpdate operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DataConnectionInner object if successful. + */ + public DataConnectionInner beginCreateOrUpdate(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName, DataConnectionInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, dataConnectionName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a data connection. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @param parameters The data connection parameters supplied to the CreateOrUpdate operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName, DataConnectionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, dataConnectionName, parameters), serviceCallback); + } + + /** + * Creates or updates a data connection. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @param parameters The data connection parameters supplied to the CreateOrUpdate operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataConnectionInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName, DataConnectionInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, dataConnectionName, parameters).map(new Func1, DataConnectionInner>() { + @Override + public DataConnectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a data connection. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @param parameters The data connection parameters supplied to the CreateOrUpdate operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataConnectionInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName, DataConnectionInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (dataConnectionName == null) { + throw new IllegalArgumentException("Parameter dataConnectionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdate(resourceGroupName, clusterName, databaseName, dataConnectionName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates a data connection. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @param parameters The data connection parameters supplied to the Update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DataConnectionInner object if successful. + */ + public DataConnectionInner update(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName, DataConnectionInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, dataConnectionName, parameters).toBlocking().last().body(); + } + + /** + * Updates a data connection. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @param parameters The data connection parameters supplied to the Update operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName, DataConnectionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, dataConnectionName, parameters), serviceCallback); + } + + /** + * Updates a data connection. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @param parameters The data connection parameters supplied to the Update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName, DataConnectionInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, dataConnectionName, parameters).map(new Func1, DataConnectionInner>() { + @Override + public DataConnectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a data connection. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @param parameters The data connection parameters supplied to the Update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName, DataConnectionInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (dataConnectionName == null) { + throw new IllegalArgumentException("Parameter dataConnectionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.update(resourceGroupName, clusterName, databaseName, dataConnectionName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a data connection. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @param parameters The data connection parameters supplied to the Update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DataConnectionInner object if successful. + */ + public DataConnectionInner beginUpdate(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName, DataConnectionInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, dataConnectionName, parameters).toBlocking().single().body(); + } + + /** + * Updates a data connection. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @param parameters The data connection parameters supplied to the Update operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName, DataConnectionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, dataConnectionName, parameters), serviceCallback); + } + + /** + * Updates a data connection. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @param parameters The data connection parameters supplied to the Update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataConnectionInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName, DataConnectionInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, dataConnectionName, parameters).map(new Func1, DataConnectionInner>() { + @Override + public DataConnectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a data connection. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @param parameters The data connection parameters supplied to the Update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataConnectionInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName, DataConnectionInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (dataConnectionName == null) { + throw new IllegalArgumentException("Parameter dataConnectionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginUpdate(resourceGroupName, clusterName, databaseName, dataConnectionName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes the data connection with the given name. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName) { + deleteWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, dataConnectionName).toBlocking().last().body(); + } + + /** + * Deletes the data connection with the given name. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, dataConnectionName), serviceCallback); + } + + /** + * Deletes the data connection with the given name. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName) { + return deleteWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, dataConnectionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the data connection with the given name. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (dataConnectionName == null) { + throw new IllegalArgumentException("Parameter dataConnectionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, clusterName, databaseName, dataConnectionName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes the data connection with the given name. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, dataConnectionName).toBlocking().single().body(); + } + + /** + * Deletes the data connection with the given name. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, dataConnectionName), serviceCallback); + } + + /** + * Deletes the data connection with the given name. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, dataConnectionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the data connection with the given name. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param dataConnectionName The name of the data connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String clusterName, String databaseName, String dataConnectionName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (dataConnectionName == null) { + throw new IllegalArgumentException("Parameter dataConnectionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, clusterName, databaseName, dataConnectionName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabaseImpl.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabaseImpl.java new file mode 100644 index 000000000000..88c40bb43949 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabaseImpl.java @@ -0,0 +1,184 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.microsoft.azure.management.kusto.v2019_05_15.Database; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.kusto.v2019_05_15.DatabaseUpdate; +import org.joda.time.Period; +import com.microsoft.azure.management.kusto.v2019_05_15.ProvisioningState; +import com.microsoft.azure.management.kusto.v2019_05_15.DatabaseStatistics; +import rx.functions.Func1; + +class DatabaseImpl extends CreatableUpdatableImpl implements Database, Database.Definition, Database.Update { + private final KustoManager manager; + private String resourceGroupName; + private String clusterName; + private String databaseName; + private DatabaseUpdate updateParameter; + + DatabaseImpl(String name, KustoManager manager) { + super(name, new DatabaseInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + this.updateParameter = new DatabaseUpdate(); + } + + DatabaseImpl(DatabaseInner inner, KustoManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.clusterName = IdParsingUtils.getValueFromIdByName(inner.id(), "clusters"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "databases"); + // + this.updateParameter = new DatabaseUpdate(); + } + + @Override + public KustoManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.createOrUpdateAsync(this.resourceGroupName, this.clusterName, this.databaseName, this.inner()) + .map(new Func1() { + @Override + public DatabaseInner call(DatabaseInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.updateAsync(this.resourceGroupName, this.clusterName, this.databaseName, this.updateParameter) + .map(new Func1() { + @Override + public DatabaseInner call(DatabaseInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabasesInner client = this.manager().inner().databases(); + return client.getAsync(this.resourceGroupName, this.clusterName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new DatabaseUpdate(); + } + + @Override + public Period hotCachePeriod() { + return this.inner().hotCachePeriod(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public Period softDeletePeriod() { + return this.inner().softDeletePeriod(); + } + + @Override + public DatabaseStatistics statistics() { + return this.inner().statistics(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DatabaseImpl withExistingCluster(String resourceGroupName, String clusterName) { + this.resourceGroupName = resourceGroupName; + this.clusterName = clusterName; + return this; + } + + @Override + public DatabaseImpl withHotCachePeriod(Period hotCachePeriod) { + if (isInCreateMode()) { + this.inner().withHotCachePeriod(hotCachePeriod); + } else { + this.updateParameter.withHotCachePeriod(hotCachePeriod); + } + return this; + } + + @Override + public DatabaseImpl withLocation(String location) { + if (isInCreateMode()) { + this.inner().withLocation(location); + } else { + this.updateParameter.withLocation(location); + } + return this; + } + + @Override + public DatabaseImpl withSoftDeletePeriod(Period softDeletePeriod) { + if (isInCreateMode()) { + this.inner().withSoftDeletePeriod(softDeletePeriod); + } else { + this.updateParameter.withSoftDeletePeriod(softDeletePeriod); + } + return this; + } + + @Override + public DatabaseImpl withStatistics(DatabaseStatistics statistics) { + if (isInCreateMode()) { + this.inner().withStatistics(statistics); + } else { + this.updateParameter.withStatistics(statistics); + } + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabaseInner.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabaseInner.java new file mode 100644 index 000000000000..a791445d17a8 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabaseInner.java @@ -0,0 +1,144 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.microsoft.azure.management.kusto.v2019_05_15.ProvisioningState; +import org.joda.time.Period; +import com.microsoft.azure.management.kusto.v2019_05_15.DatabaseStatistics; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Class representing a Kusto database. + */ +@JsonFlatten +public class DatabaseInner extends ProxyResource { + /** + * Resource location. + */ + @JsonProperty(value = "location") + private String location; + + /** + * The provisioned state of the resource. Possible values include: + * 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Moving'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * The time the data should be kept before it stops being accessible to + * queries in TimeSpan. + */ + @JsonProperty(value = "properties.softDeletePeriod") + private Period softDeletePeriod; + + /** + * The time the data should be kept in cache for fast queries in TimeSpan. + */ + @JsonProperty(value = "properties.hotCachePeriod") + private Period hotCachePeriod; + + /** + * The statistics of the database. + */ + @JsonProperty(value = "properties.statistics") + private DatabaseStatistics statistics; + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set resource location. + * + * @param location the location value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Moving'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the time the data should be kept before it stops being accessible to queries in TimeSpan. + * + * @return the softDeletePeriod value + */ + public Period softDeletePeriod() { + return this.softDeletePeriod; + } + + /** + * Set the time the data should be kept before it stops being accessible to queries in TimeSpan. + * + * @param softDeletePeriod the softDeletePeriod value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSoftDeletePeriod(Period softDeletePeriod) { + this.softDeletePeriod = softDeletePeriod; + return this; + } + + /** + * Get the time the data should be kept in cache for fast queries in TimeSpan. + * + * @return the hotCachePeriod value + */ + public Period hotCachePeriod() { + return this.hotCachePeriod; + } + + /** + * Set the time the data should be kept in cache for fast queries in TimeSpan. + * + * @param hotCachePeriod the hotCachePeriod value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withHotCachePeriod(Period hotCachePeriod) { + this.hotCachePeriod = hotCachePeriod; + return this; + } + + /** + * Get the statistics of the database. + * + * @return the statistics value + */ + public DatabaseStatistics statistics() { + return this.statistics; + } + + /** + * Set the statistics of the database. + * + * @param statistics the statistics value to set + * @return the DatabaseInner object itself. + */ + public DatabaseInner withStatistics(DatabaseStatistics statistics) { + this.statistics = statistics; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabasePrincipalImpl.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabasePrincipalImpl.java new file mode 100644 index 000000000000..845a6c09fc1b --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabasePrincipalImpl.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.microsoft.azure.management.kusto.v2019_05_15.DatabasePrincipal; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.kusto.v2019_05_15.DatabasePrincipalRole; +import com.microsoft.azure.management.kusto.v2019_05_15.DatabasePrincipalType; + +class DatabasePrincipalImpl extends WrapperImpl implements DatabasePrincipal { + private final KustoManager manager; + DatabasePrincipalImpl(DatabasePrincipalInner inner, KustoManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public KustoManager manager() { + return this.manager; + } + + @Override + public String appId() { + return this.inner().appId(); + } + + @Override + public String email() { + return this.inner().email(); + } + + @Override + public String fqn() { + return this.inner().fqn(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DatabasePrincipalRole role() { + return this.inner().role(); + } + + @Override + public String tenantName() { + return this.inner().tenantName(); + } + + @Override + public DatabasePrincipalType type() { + return this.inner().type(); + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabasePrincipalInner.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabasePrincipalInner.java new file mode 100644 index 000000000000..c382616c2546 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabasePrincipalInner.java @@ -0,0 +1,192 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.microsoft.azure.management.kusto.v2019_05_15.DatabasePrincipalRole; +import com.microsoft.azure.management.kusto.v2019_05_15.DatabasePrincipalType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A class representing database principal entity. + */ +public class DatabasePrincipalInner { + /** + * Database principal role. Possible values include: 'Admin', 'Ingestor', + * 'Monitor', 'User', 'UnrestrictedViewers', 'Viewer'. + */ + @JsonProperty(value = "role", required = true) + private DatabasePrincipalRole role; + + /** + * Database principal name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Database principal type. Possible values include: 'App', 'Group', + * 'User'. + */ + @JsonProperty(value = "type", required = true) + private DatabasePrincipalType type; + + /** + * Database principal fully qualified name. + */ + @JsonProperty(value = "fqn") + private String fqn; + + /** + * Database principal email if exists. + */ + @JsonProperty(value = "email") + private String email; + + /** + * Application id - relevant only for application principal type. + */ + @JsonProperty(value = "appId") + private String appId; + + /** + * The tenant name of the principal. + */ + @JsonProperty(value = "tenantName", access = JsonProperty.Access.WRITE_ONLY) + private String tenantName; + + /** + * Get database principal role. Possible values include: 'Admin', 'Ingestor', 'Monitor', 'User', 'UnrestrictedViewers', 'Viewer'. + * + * @return the role value + */ + public DatabasePrincipalRole role() { + return this.role; + } + + /** + * Set database principal role. Possible values include: 'Admin', 'Ingestor', 'Monitor', 'User', 'UnrestrictedViewers', 'Viewer'. + * + * @param role the role value to set + * @return the DatabasePrincipalInner object itself. + */ + public DatabasePrincipalInner withRole(DatabasePrincipalRole role) { + this.role = role; + return this; + } + + /** + * Get database principal name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set database principal name. + * + * @param name the name value to set + * @return the DatabasePrincipalInner object itself. + */ + public DatabasePrincipalInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get database principal type. Possible values include: 'App', 'Group', 'User'. + * + * @return the type value + */ + public DatabasePrincipalType type() { + return this.type; + } + + /** + * Set database principal type. Possible values include: 'App', 'Group', 'User'. + * + * @param type the type value to set + * @return the DatabasePrincipalInner object itself. + */ + public DatabasePrincipalInner withType(DatabasePrincipalType type) { + this.type = type; + return this; + } + + /** + * Get database principal fully qualified name. + * + * @return the fqn value + */ + public String fqn() { + return this.fqn; + } + + /** + * Set database principal fully qualified name. + * + * @param fqn the fqn value to set + * @return the DatabasePrincipalInner object itself. + */ + public DatabasePrincipalInner withFqn(String fqn) { + this.fqn = fqn; + return this; + } + + /** + * Get database principal email if exists. + * + * @return the email value + */ + public String email() { + return this.email; + } + + /** + * Set database principal email if exists. + * + * @param email the email value to set + * @return the DatabasePrincipalInner object itself. + */ + public DatabasePrincipalInner withEmail(String email) { + this.email = email; + return this; + } + + /** + * Get application id - relevant only for application principal type. + * + * @return the appId value + */ + public String appId() { + return this.appId; + } + + /** + * Set application id - relevant only for application principal type. + * + * @param appId the appId value to set + * @return the DatabasePrincipalInner object itself. + */ + public DatabasePrincipalInner withAppId(String appId) { + this.appId = appId; + return this; + } + + /** + * Get the tenant name of the principal. + * + * @return the tenantName value + */ + public String tenantName() { + return this.tenantName; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabasePrincipalListResultImpl.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabasePrincipalListResultImpl.java new file mode 100644 index 000000000000..f257504731d3 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabasePrincipalListResultImpl.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.microsoft.azure.management.kusto.v2019_05_15.DatabasePrincipalListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class DatabasePrincipalListResultImpl extends WrapperImpl implements DatabasePrincipalListResult { + private final KustoManager manager; + DatabasePrincipalListResultImpl(DatabasePrincipalListResultInner inner, KustoManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public KustoManager manager() { + return this.manager; + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabasePrincipalListResultInner.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabasePrincipalListResultInner.java new file mode 100644 index 000000000000..81e20ce06b57 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabasePrincipalListResultInner.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The list Kusto database principals operation response. + */ +public class DatabasePrincipalListResultInner { + /** + * The list of Kusto database principals. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the list of Kusto database principals. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the list of Kusto database principals. + * + * @param value the value value to set + * @return the DatabasePrincipalListResultInner object itself. + */ + public DatabasePrincipalListResultInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabasesImpl.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabasesImpl.java new file mode 100644 index 000000000000..5f288a033fbe --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabasesImpl.java @@ -0,0 +1,142 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.kusto.v2019_05_15.Databases; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.kusto.v2019_05_15.DatabasePrincipal; +import com.microsoft.azure.management.kusto.v2019_05_15.DatabasePrincipalListResult; +import com.microsoft.azure.management.kusto.v2019_05_15.Database; +import com.microsoft.azure.management.kusto.v2019_05_15.CheckNameResult; + +class DatabasesImpl extends WrapperImpl implements Databases { + private final KustoManager manager; + + DatabasesImpl(KustoManager manager) { + super(manager.inner().databases()); + this.manager = manager; + } + + public KustoManager manager() { + return this.manager; + } + + @Override + public DatabaseImpl define(String name) { + return wrapModel(name); + } + + private DatabaseImpl wrapModel(DatabaseInner inner) { + return new DatabaseImpl(inner, manager()); + } + + private DatabaseImpl wrapModel(String name) { + return new DatabaseImpl(name, this.manager()); + } + + @Override + public Observable listPrincipalsAsync(String resourceGroupName, String clusterName, String databaseName) { + DatabasesInner client = this.inner(); + return client.listPrincipalsAsync(resourceGroupName, clusterName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public DatabasePrincipal call(DatabasePrincipalInner inner) { + return new DatabasePrincipalImpl(inner, manager()); + } + }); + } + + @Override + public Observable addPrincipalsAsync(String resourceGroupName, String clusterName, String databaseName) { + DatabasesInner client = this.inner(); + return client.addPrincipalsAsync(resourceGroupName, clusterName, databaseName) + .map(new Func1() { + @Override + public DatabasePrincipalListResult call(DatabasePrincipalListResultInner inner) { + return new DatabasePrincipalListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable removePrincipalsAsync(String resourceGroupName, String clusterName, String databaseName) { + DatabasesInner client = this.inner(); + return client.removePrincipalsAsync(resourceGroupName, clusterName, databaseName) + .map(new Func1() { + @Override + public DatabasePrincipalListResult call(DatabasePrincipalListResultInner inner) { + return new DatabasePrincipalListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByClusterAsync(String resourceGroupName, String clusterName) { + DatabasesInner client = this.inner(); + return client.listByClusterAsync(resourceGroupName, clusterName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public Database call(DatabaseInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String clusterName, String databaseName) { + DatabasesInner client = this.inner(); + return client.getAsync(resourceGroupName, clusterName, databaseName) + .flatMap(new Func1>() { + @Override + public Observable call(DatabaseInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Database)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String clusterName, String databaseName) { + DatabasesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, clusterName, databaseName).toCompletable(); + } + + @Override + public Observable checkNameAvailabilityAsync(String resourceGroupName, String clusterName, String name) { + DatabasesInner client = this.inner(); + return client.checkNameAvailabilityAsync(resourceGroupName, clusterName, name) + .map(new Func1() { + @Override + public CheckNameResult call(CheckNameResultInner inner) { + return new CheckNameResultImpl(inner, manager()); + } + }); + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabasesInner.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabasesInner.java new file mode 100644 index 000000000000..0ae4786021d6 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/DatabasesInner.java @@ -0,0 +1,1412 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.kusto.v2019_05_15.DatabaseCheckNameRequest; +import com.microsoft.azure.management.kusto.v2019_05_15.DatabasePrincipalListRequest; +import com.microsoft.azure.management.kusto.v2019_05_15.DatabaseUpdate; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Databases. + */ +public class DatabasesInner { + /** The Retrofit service to perform REST calls. */ + private DatabasesService service; + /** The service client containing this operation class. */ + private KustoManagementClientImpl client; + + /** + * Initializes an instance of DatabasesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabasesInner(Retrofit retrofit, KustoManagementClientImpl client) { + this.service = retrofit.create(DatabasesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Databases to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabasesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Databases checkNameAvailability" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/checkNameAvailability") + Observable> checkNameAvailability(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body DatabaseCheckNameRequest databaseName, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Databases listByCluster" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases") + Observable> listByCluster(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Databases get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Databases createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Databases beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Databases update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseUpdate parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Databases beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseUpdate parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Databases delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Databases beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Databases listPrincipals" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/listPrincipals") + Observable> listPrincipals(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Databases addPrincipals" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/addPrincipals") + Observable> addPrincipals(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body DatabasePrincipalListRequest databasePrincipalsToAdd, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Databases removePrincipals" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/removePrincipals") + Observable> removePrincipals(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body DatabasePrincipalListRequest databasePrincipalsToRemove, @Header("User-Agent") String userAgent); + + } + + /** + * Checks that the database name is valid and is not already in use. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param name Database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CheckNameResultInner object if successful. + */ + public CheckNameResultInner checkNameAvailability(String resourceGroupName, String clusterName, String name) { + return checkNameAvailabilityWithServiceResponseAsync(resourceGroupName, clusterName, name).toBlocking().single().body(); + } + + /** + * Checks that the database name is valid and is not already in use. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param name Database name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture checkNameAvailabilityAsync(String resourceGroupName, String clusterName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkNameAvailabilityWithServiceResponseAsync(resourceGroupName, clusterName, name), serviceCallback); + } + + /** + * Checks that the database name is valid and is not already in use. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param name Database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameResultInner object + */ + public Observable checkNameAvailabilityAsync(String resourceGroupName, String clusterName, String name) { + return checkNameAvailabilityWithServiceResponseAsync(resourceGroupName, clusterName, name).map(new Func1, CheckNameResultInner>() { + @Override + public CheckNameResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks that the database name is valid and is not already in use. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param name Database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CheckNameResultInner object + */ + public Observable> checkNameAvailabilityWithServiceResponseAsync(String resourceGroupName, String clusterName, String name) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + DatabaseCheckNameRequest databaseName = new DatabaseCheckNameRequest(); + databaseName.withName(name); + return service.checkNameAvailability(resourceGroupName, clusterName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), databaseName, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkNameAvailabilityDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkNameAvailabilityDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns the list of databases of the given Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<DatabaseInner> object if successful. + */ + public List listByCluster(String resourceGroupName, String clusterName) { + return listByClusterWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body(); + } + + /** + * Returns the list of databases of the given Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByClusterAsync(String resourceGroupName, String clusterName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByClusterWithServiceResponseAsync(resourceGroupName, clusterName), serviceCallback); + } + + /** + * Returns the list of databases of the given Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DatabaseInner> object + */ + public Observable> listByClusterAsync(String resourceGroupName, String clusterName) { + return listByClusterWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns the list of databases of the given Kusto cluster. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DatabaseInner> object + */ + public Observable>> listByClusterWithServiceResponseAsync(String resourceGroupName, String clusterName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByCluster(resourceGroupName, clusterName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByClusterDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByClusterDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns a database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DatabaseInner object if successful. + */ + public DatabaseInner get(String resourceGroupName, String clusterName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, clusterName, databaseName).toBlocking().single().body(); + } + + /** + * Returns a database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String clusterName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, clusterName, databaseName), serviceCallback); + } + + /** + * Returns a database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable getAsync(String resourceGroupName, String clusterName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, clusterName, databaseName).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns a database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String clusterName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, clusterName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates a database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param parameters The database parameters supplied to the CreateOrUpdate operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DatabaseInner object if successful. + */ + public DatabaseInner createOrUpdate(String resourceGroupName, String clusterName, String databaseName, DatabaseInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param parameters The database parameters supplied to the CreateOrUpdate operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String clusterName, String databaseName, DatabaseInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, parameters), serviceCallback); + } + + /** + * Creates or updates a database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param parameters The database parameters supplied to the CreateOrUpdate operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String clusterName, String databaseName, DatabaseInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param parameters The database parameters supplied to the CreateOrUpdate operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String clusterName, String databaseName, DatabaseInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdate(resourceGroupName, clusterName, databaseName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates a database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param parameters The database parameters supplied to the CreateOrUpdate operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DatabaseInner object if successful. + */ + public DatabaseInner beginCreateOrUpdate(String resourceGroupName, String clusterName, String databaseName, DatabaseInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param parameters The database parameters supplied to the CreateOrUpdate operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String clusterName, String databaseName, DatabaseInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, parameters), serviceCallback); + } + + /** + * Creates or updates a database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param parameters The database parameters supplied to the CreateOrUpdate operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String clusterName, String databaseName, DatabaseInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param parameters The database parameters supplied to the CreateOrUpdate operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String clusterName, String databaseName, DatabaseInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdate(resourceGroupName, clusterName, databaseName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates a database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param parameters The database parameters supplied to the Update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DatabaseInner object if successful. + */ + public DatabaseInner update(String resourceGroupName, String clusterName, String databaseName, DatabaseUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, parameters).toBlocking().last().body(); + } + + /** + * Updates a database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param parameters The database parameters supplied to the Update operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String clusterName, String databaseName, DatabaseUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, parameters), serviceCallback); + } + + /** + * Updates a database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param parameters The database parameters supplied to the Update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String clusterName, String databaseName, DatabaseUpdate parameters) { + return updateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param parameters The database parameters supplied to the Update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String clusterName, String databaseName, DatabaseUpdate parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.update(resourceGroupName, clusterName, databaseName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param parameters The database parameters supplied to the Update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DatabaseInner object if successful. + */ + public DatabaseInner beginUpdate(String resourceGroupName, String clusterName, String databaseName, DatabaseUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Updates a database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param parameters The database parameters supplied to the Update operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateAsync(String resourceGroupName, String clusterName, String databaseName, DatabaseUpdate parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, parameters), serviceCallback); + } + + /** + * Updates a database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param parameters The database parameters supplied to the Update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String clusterName, String databaseName, DatabaseUpdate parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, parameters).map(new Func1, DatabaseInner>() { + @Override + public DatabaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param parameters The database parameters supplied to the Update operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String clusterName, String databaseName, DatabaseUpdate parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginUpdate(resourceGroupName, clusterName, databaseName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes the database with the given name. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String clusterName, String databaseName) { + deleteWithServiceResponseAsync(resourceGroupName, clusterName, databaseName).toBlocking().last().body(); + } + + /** + * Deletes the database with the given name. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String clusterName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, clusterName, databaseName), serviceCallback); + } + + /** + * Deletes the database with the given name. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String clusterName, String databaseName) { + return deleteWithServiceResponseAsync(resourceGroupName, clusterName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the database with the given name. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String clusterName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, clusterName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes the database with the given name. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String clusterName, String databaseName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, clusterName, databaseName).toBlocking().single().body(); + } + + /** + * Deletes the database with the given name. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String clusterName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, clusterName, databaseName), serviceCallback); + } + + /** + * Deletes the database with the given name. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String clusterName, String databaseName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, clusterName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the database with the given name. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String clusterName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, clusterName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns a list of database principals of the given Kusto cluster and database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<DatabasePrincipalInner> object if successful. + */ + public List listPrincipals(String resourceGroupName, String clusterName, String databaseName) { + return listPrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName).toBlocking().single().body(); + } + + /** + * Returns a list of database principals of the given Kusto cluster and database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listPrincipalsAsync(String resourceGroupName, String clusterName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listPrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName), serviceCallback); + } + + /** + * Returns a list of database principals of the given Kusto cluster and database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DatabasePrincipalInner> object + */ + public Observable> listPrincipalsAsync(String resourceGroupName, String clusterName, String databaseName) { + return listPrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns a list of database principals of the given Kusto cluster and database. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DatabasePrincipalInner> object + */ + public Observable>> listPrincipalsWithServiceResponseAsync(String resourceGroupName, String clusterName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listPrincipals(resourceGroupName, clusterName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listPrincipalsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listPrincipalsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Add Database principals permissions. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DatabasePrincipalListResultInner object if successful. + */ + public DatabasePrincipalListResultInner addPrincipals(String resourceGroupName, String clusterName, String databaseName) { + return addPrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName).toBlocking().single().body(); + } + + /** + * Add Database principals permissions. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture addPrincipalsAsync(String resourceGroupName, String clusterName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addPrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName), serviceCallback); + } + + /** + * Add Database principals permissions. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabasePrincipalListResultInner object + */ + public Observable addPrincipalsAsync(String resourceGroupName, String clusterName, String databaseName) { + return addPrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName).map(new Func1, DatabasePrincipalListResultInner>() { + @Override + public DatabasePrincipalListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Add Database principals permissions. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabasePrincipalListResultInner object + */ + public Observable> addPrincipalsWithServiceResponseAsync(String resourceGroupName, String clusterName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final List value = null; + DatabasePrincipalListRequest databasePrincipalsToAdd = new DatabasePrincipalListRequest(); + databasePrincipalsToAdd.withValue(null); + return service.addPrincipals(resourceGroupName, clusterName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), databasePrincipalsToAdd, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = addPrincipalsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Add Database principals permissions. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param value The list of Kusto database principals. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DatabasePrincipalListResultInner object if successful. + */ + public DatabasePrincipalListResultInner addPrincipals(String resourceGroupName, String clusterName, String databaseName, List value) { + return addPrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, value).toBlocking().single().body(); + } + + /** + * Add Database principals permissions. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param value The list of Kusto database principals. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture addPrincipalsAsync(String resourceGroupName, String clusterName, String databaseName, List value, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addPrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, value), serviceCallback); + } + + /** + * Add Database principals permissions. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param value The list of Kusto database principals. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabasePrincipalListResultInner object + */ + public Observable addPrincipalsAsync(String resourceGroupName, String clusterName, String databaseName, List value) { + return addPrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, value).map(new Func1, DatabasePrincipalListResultInner>() { + @Override + public DatabasePrincipalListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Add Database principals permissions. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param value The list of Kusto database principals. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabasePrincipalListResultInner object + */ + public Observable> addPrincipalsWithServiceResponseAsync(String resourceGroupName, String clusterName, String databaseName, List value) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(value); + DatabasePrincipalListRequest databasePrincipalsToAdd = new DatabasePrincipalListRequest(); + databasePrincipalsToAdd.withValue(value); + return service.addPrincipals(resourceGroupName, clusterName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), databasePrincipalsToAdd, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = addPrincipalsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse addPrincipalsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Remove Database principals permissions. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DatabasePrincipalListResultInner object if successful. + */ + public DatabasePrincipalListResultInner removePrincipals(String resourceGroupName, String clusterName, String databaseName) { + return removePrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName).toBlocking().single().body(); + } + + /** + * Remove Database principals permissions. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture removePrincipalsAsync(String resourceGroupName, String clusterName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(removePrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName), serviceCallback); + } + + /** + * Remove Database principals permissions. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabasePrincipalListResultInner object + */ + public Observable removePrincipalsAsync(String resourceGroupName, String clusterName, String databaseName) { + return removePrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName).map(new Func1, DatabasePrincipalListResultInner>() { + @Override + public DatabasePrincipalListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Remove Database principals permissions. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabasePrincipalListResultInner object + */ + public Observable> removePrincipalsWithServiceResponseAsync(String resourceGroupName, String clusterName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final List value = null; + DatabasePrincipalListRequest databasePrincipalsToRemove = new DatabasePrincipalListRequest(); + databasePrincipalsToRemove.withValue(null); + return service.removePrincipals(resourceGroupName, clusterName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), databasePrincipalsToRemove, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = removePrincipalsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Remove Database principals permissions. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param value The list of Kusto database principals. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DatabasePrincipalListResultInner object if successful. + */ + public DatabasePrincipalListResultInner removePrincipals(String resourceGroupName, String clusterName, String databaseName, List value) { + return removePrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, value).toBlocking().single().body(); + } + + /** + * Remove Database principals permissions. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param value The list of Kusto database principals. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture removePrincipalsAsync(String resourceGroupName, String clusterName, String databaseName, List value, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(removePrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, value), serviceCallback); + } + + /** + * Remove Database principals permissions. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param value The list of Kusto database principals. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabasePrincipalListResultInner object + */ + public Observable removePrincipalsAsync(String resourceGroupName, String clusterName, String databaseName, List value) { + return removePrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, value).map(new Func1, DatabasePrincipalListResultInner>() { + @Override + public DatabasePrincipalListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Remove Database principals permissions. + * + * @param resourceGroupName The name of the resource group containing the Kusto cluster. + * @param clusterName The name of the Kusto cluster. + * @param databaseName The name of the database in the Kusto cluster. + * @param value The list of Kusto database principals. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabasePrincipalListResultInner object + */ + public Observable> removePrincipalsWithServiceResponseAsync(String resourceGroupName, String clusterName, String databaseName, List value) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(value); + DatabasePrincipalListRequest databasePrincipalsToRemove = new DatabasePrincipalListRequest(); + databasePrincipalsToRemove.withValue(value); + return service.removePrincipals(resourceGroupName, clusterName, databaseName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), databasePrincipalsToRemove, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = removePrincipalsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse removePrincipalsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/IdParsingUtils.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..07124de32b22 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/KustoManagementClientImpl.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/KustoManagementClientImpl.java new file mode 100644 index 000000000000..a7a8eefe2850 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/KustoManagementClientImpl.java @@ -0,0 +1,238 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the KustoManagementClientImpl class. + */ +public class KustoManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. */ + private String subscriptionId; + + /** + * Gets Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public KustoManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** Client API Version. */ + private String apiVersion; + + /** + * Gets Client API Version. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public KustoManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public KustoManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public KustoManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The ClustersInner object to access its operations. + */ + private ClustersInner clusters; + + /** + * Gets the ClustersInner object to access its operations. + * @return the ClustersInner object. + */ + public ClustersInner clusters() { + return this.clusters; + } + + /** + * The DatabasesInner object to access its operations. + */ + private DatabasesInner databases; + + /** + * Gets the DatabasesInner object to access its operations. + * @return the DatabasesInner object. + */ + public DatabasesInner databases() { + return this.databases; + } + + /** + * The DataConnectionsInner object to access its operations. + */ + private DataConnectionsInner dataConnections; + + /** + * Gets the DataConnectionsInner object to access its operations. + * @return the DataConnectionsInner object. + */ + public DataConnectionsInner dataConnections() { + return this.dataConnections; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * Initializes an instance of KustoManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public KustoManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of KustoManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public KustoManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of KustoManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public KustoManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2019-05-15"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.clusters = new ClustersInner(restClient().retrofit(), this); + this.databases = new DatabasesInner(restClient().retrofit(), this); + this.dataConnections = new DataConnectionsInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "KustoManagementClient", "2019-05-15"); + } +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/KustoManager.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/KustoManager.java new file mode 100644 index 000000000000..dbda09805e69 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/KustoManager.java @@ -0,0 +1,135 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.kusto.v2019_05_15.Clusters; +import com.microsoft.azure.management.kusto.v2019_05_15.Databases; +import com.microsoft.azure.management.kusto.v2019_05_15.DataConnections; +import com.microsoft.azure.management.kusto.v2019_05_15.Operations; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Kusto resource management. + */ +public final class KustoManager extends ManagerCore { + private Clusters clusters; + private Databases databases; + private DataConnections dataConnections; + private Operations operations; + /** + * Get a Configurable instance that can be used to create KustoManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new KustoManager.ConfigurableImpl(); + } + /** + * Creates an instance of KustoManager that exposes Kusto resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the KustoManager + */ + public static KustoManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new KustoManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of KustoManager that exposes Kusto resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the KustoManager + */ + public static KustoManager authenticate(RestClient restClient, String subscriptionId) { + return new KustoManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of KustoManager that exposes Kusto management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Kusto management API entry points that work across subscriptions + */ + KustoManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage Clusters. + */ + public Clusters clusters() { + if (this.clusters == null) { + this.clusters = new ClustersImpl(this); + } + return this.clusters; + } + + /** + * @return Entry point to manage Databases. + */ + public Databases databases() { + if (this.databases == null) { + this.databases = new DatabasesImpl(this); + } + return this.databases; + } + + /** + * @return Entry point to manage DataConnections. + */ + public DataConnections dataConnections() { + if (this.dataConnections == null) { + this.dataConnections = new DataConnectionsImpl(this); + } + return this.dataConnections; + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public KustoManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return KustoManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private KustoManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new KustoManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/OperationImpl.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/OperationImpl.java new file mode 100644 index 000000000000..e5e8b6b7d12f --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/OperationImpl.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.microsoft.azure.management.kusto.v2019_05_15.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.kusto.v2019_05_15.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final KustoManager manager; + OperationImpl(OperationInner inner, KustoManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public KustoManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String origin() { + return this.inner().origin(); + } + + @Override + public Object properties() { + return this.inner().properties(); + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/OperationInner.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/OperationInner.java new file mode 100644 index 000000000000..0452af3b6dea --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/OperationInner.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.microsoft.azure.management.kusto.v2019_05_15.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A REST API operation. + */ +public class OperationInner { + /** + * The operation name. + * This is of the format {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The object that describes the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * The intended executor of the operation. + */ + @JsonProperty(value = "origin") + private String origin; + + /** + * Properties of the operation. + */ + @JsonProperty(value = "properties") + private Object properties; + + /** + * Get this is of the format {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set this is of the format {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display value. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display value. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin value. + * + * @return the origin value + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin value. + * + * @param origin the origin value to set + * @return the OperationInner object itself. + */ + public OperationInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get the properties value. + * + * @return the properties value + */ + public Object properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the OperationInner object itself. + */ + public OperationInner withProperties(Object properties) { + this.properties = properties; + return this; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/OperationsImpl.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/OperationsImpl.java new file mode 100644 index 000000000000..35e6041da82a --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.kusto.v2019_05_15.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.kusto.v2019_05_15.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final KustoManager manager; + + OperationsImpl(KustoManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public KustoManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/OperationsInner.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/OperationsInner.java new file mode 100644 index 000000000000..1a509bd35e85 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private KustoManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, KustoManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Operations list" }) + @GET("providers/Microsoft.Kusto/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.kusto.v2019_05_15.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists available operations for the Microsoft.Kusto provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists available operations for the Microsoft.Kusto provider. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists available operations for the Microsoft.Kusto provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists available operations for the Microsoft.Kusto provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists available operations for the Microsoft.Kusto provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists available operations for the Microsoft.Kusto provider. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists available operations for the Microsoft.Kusto provider. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists available operations for the Microsoft.Kusto provider. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists available operations for the Microsoft.Kusto provider. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists available operations for the Microsoft.Kusto provider. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/PageImpl.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/PageImpl.java new file mode 100644 index 000000000000..bc3e5f85636e --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/PageImpl1.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/PageImpl1.java new file mode 100644 index 000000000000..fead0348dc42 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/SkuDescriptionImpl.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/SkuDescriptionImpl.java new file mode 100644 index 000000000000..ee9117bba13e --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/SkuDescriptionImpl.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import com.microsoft.azure.management.kusto.v2019_05_15.SkuDescription; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.kusto.v2019_05_15.SkuLocationInfoItem; + +class SkuDescriptionImpl extends WrapperImpl implements SkuDescription { + private final KustoManager manager; + SkuDescriptionImpl(SkuDescriptionInner inner, KustoManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public KustoManager manager() { + return this.manager; + } + + @Override + public List locationInfo() { + return this.inner().locationInfo(); + } + + @Override + public List locations() { + return this.inner().locations(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String resourceType() { + return this.inner().resourceType(); + } + + @Override + public List restrictions() { + return this.inner().restrictions(); + } + + @Override + public String tier() { + return this.inner().tier(); + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/SkuDescriptionInner.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/SkuDescriptionInner.java new file mode 100644 index 000000000000..bd17c6c3d9b9 --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/SkuDescriptionInner.java @@ -0,0 +1,109 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; + +import java.util.List; +import com.microsoft.azure.management.kusto.v2019_05_15.SkuLocationInfoItem; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Kusto SKU description of given resource type. + */ +public class SkuDescriptionInner { + /** + * The resource type. + */ + @JsonProperty(value = "resourceType", access = JsonProperty.Access.WRITE_ONLY) + private String resourceType; + + /** + * The name of the SKU. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The tier of the SKU. + */ + @JsonProperty(value = "tier", access = JsonProperty.Access.WRITE_ONLY) + private String tier; + + /** + * The set of locations that the SKU is available. + */ + @JsonProperty(value = "locations", access = JsonProperty.Access.WRITE_ONLY) + private List locations; + + /** + * Locations and zones. + */ + @JsonProperty(value = "locationInfo", access = JsonProperty.Access.WRITE_ONLY) + private List locationInfo; + + /** + * The restrictions because of which SKU cannot be used. + */ + @JsonProperty(value = "restrictions", access = JsonProperty.Access.WRITE_ONLY) + private List restrictions; + + /** + * Get the resource type. + * + * @return the resourceType value + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Get the name of the SKU. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the tier of the SKU. + * + * @return the tier value + */ + public String tier() { + return this.tier; + } + + /** + * Get the set of locations that the SKU is available. + * + * @return the locations value + */ + public List locations() { + return this.locations; + } + + /** + * Get locations and zones. + * + * @return the locationInfo value + */ + public List locationInfo() { + return this.locationInfo; + } + + /** + * Get the restrictions because of which SKU cannot be used. + * + * @return the restrictions value + */ + public List restrictions() { + return this.restrictions; + } + +} diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/package-info.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/package-info.java new file mode 100644 index 000000000000..4842fb4c7aef --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for KustoManagementClient. + * The Azure Kusto management API provides a RESTful set of web services that interact with Azure Kusto services to manage your clusters and databases. The API enables you to create, update, and delete clusters and databases. + */ +package com.microsoft.azure.management.kusto.v2019_05_15.implementation; diff --git a/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/package-info.java b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/package-info.java new file mode 100644 index 000000000000..bc5203aec45e --- /dev/null +++ b/kusto/resource-manager/v2019_05_15/src/main/java/com/microsoft/azure/management/kusto/v2019_05_15/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for KustoManagementClient. + * The Azure Kusto management API provides a RESTful set of web services that interact with Azure Kusto services to manage your clusters and databases. The API enables you to create, update, and delete clusters and databases. + */ +package com.microsoft.azure.management.kusto.v2019_05_15; diff --git a/network/resource-manager/v2019_06_01/pom.xml b/network/resource-manager/v2019_06_01/pom.xml index 2c5ed872eb71..512de75073b2 100644 --- a/network/resource-manager/v2019_06_01/pom.xml +++ b/network/resource-manager/v2019_06_01/pom.xml @@ -15,7 +15,7 @@ ../../../pom.management.xml azure-mgmt-network - 1.0.0-beta + 1.0.0-beta-1 jar Microsoft Azure SDK for Network Management This package contains Microsoft Network Management SDK. diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/ApplicationGatewayOnDemandProbe.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/ApplicationGatewayOnDemandProbe.java index 51e0e4d71d94..6f2694d6bb58 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/ApplicationGatewayOnDemandProbe.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/ApplicationGatewayOnDemandProbe.java @@ -8,6 +8,7 @@ package com.microsoft.azure.management.network.v2019_06_01; +import com.microsoft.azure.SubResource; import com.fasterxml.jackson.annotation.JsonProperty; /** @@ -56,18 +57,18 @@ public class ApplicationGatewayOnDemandProbe { private ApplicationGatewayProbeHealthResponseMatch match; /** - * Name of backend pool of application gateway to which probe request will - * be sent. + * Reference of backend pool of application gateway to which probe request + * will be sent. */ - @JsonProperty(value = "backendPoolName") - private String backendPoolName; + @JsonProperty(value = "backendAddressPool") + private SubResource backendAddressPool; /** - * Name of backend http setting of application gateway to be used for test - * probe. + * Reference of backend http setting of application gateway to be used for + * test probe. */ - @JsonProperty(value = "backendHttpSettingName") - private String backendHttpSettingName; + @JsonProperty(value = "backendHttpSettings") + private SubResource backendHttpSettings; /** * Get the protocol used for the probe. Possible values include: 'Http', 'Https'. @@ -190,42 +191,42 @@ public ApplicationGatewayOnDemandProbe withMatch(ApplicationGatewayProbeHealthRe } /** - * Get name of backend pool of application gateway to which probe request will be sent. + * Get reference of backend pool of application gateway to which probe request will be sent. * - * @return the backendPoolName value + * @return the backendAddressPool value */ - public String backendPoolName() { - return this.backendPoolName; + public SubResource backendAddressPool() { + return this.backendAddressPool; } /** - * Set name of backend pool of application gateway to which probe request will be sent. + * Set reference of backend pool of application gateway to which probe request will be sent. * - * @param backendPoolName the backendPoolName value to set + * @param backendAddressPool the backendAddressPool value to set * @return the ApplicationGatewayOnDemandProbe object itself. */ - public ApplicationGatewayOnDemandProbe withBackendPoolName(String backendPoolName) { - this.backendPoolName = backendPoolName; + public ApplicationGatewayOnDemandProbe withBackendAddressPool(SubResource backendAddressPool) { + this.backendAddressPool = backendAddressPool; return this; } /** - * Get name of backend http setting of application gateway to be used for test probe. + * Get reference of backend http setting of application gateway to be used for test probe. * - * @return the backendHttpSettingName value + * @return the backendHttpSettings value */ - public String backendHttpSettingName() { - return this.backendHttpSettingName; + public SubResource backendHttpSettings() { + return this.backendHttpSettings; } /** - * Set name of backend http setting of application gateway to be used for test probe. + * Set reference of backend http setting of application gateway to be used for test probe. * - * @param backendHttpSettingName the backendHttpSettingName value to set + * @param backendHttpSettings the backendHttpSettings value to set * @return the ApplicationGatewayOnDemandProbe object itself. */ - public ApplicationGatewayOnDemandProbe withBackendHttpSettingName(String backendHttpSettingName) { - this.backendHttpSettingName = backendHttpSettingName; + public ApplicationGatewayOnDemandProbe withBackendHttpSettings(SubResource backendHttpSettings) { + this.backendHttpSettings = backendHttpSettings; return this; } diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/ApplicationRuleCondition.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/ApplicationRuleCondition.java new file mode 100644 index 000000000000..f55c53c63f34 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/ApplicationRuleCondition.java @@ -0,0 +1,152 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Rule condition of type application. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleConditionType", defaultImpl = ApplicationRuleCondition.class) +@JsonTypeName("ApplicationRuleCondition") +public class ApplicationRuleCondition extends FirewallPolicyRuleCondition { + /** + * List of source IP addresses for this rule. + */ + @JsonProperty(value = "sourceAddresses") + private List sourceAddresses; + + /** + * List of destination IP addresses or Service Tags. + */ + @JsonProperty(value = "destinationAddresses") + private List destinationAddresses; + + /** + * Array of Application Protocols. + */ + @JsonProperty(value = "protocols") + private List protocols; + + /** + * List of FQDNs for this rule condition. + */ + @JsonProperty(value = "targetFqdns") + private List targetFqdns; + + /** + * List of FQDN Tags for this rule condition. + */ + @JsonProperty(value = "fqdnTags") + private List fqdnTags; + + /** + * Get list of source IP addresses for this rule. + * + * @return the sourceAddresses value + */ + public List sourceAddresses() { + return this.sourceAddresses; + } + + /** + * Set list of source IP addresses for this rule. + * + * @param sourceAddresses the sourceAddresses value to set + * @return the ApplicationRuleCondition object itself. + */ + public ApplicationRuleCondition withSourceAddresses(List sourceAddresses) { + this.sourceAddresses = sourceAddresses; + return this; + } + + /** + * Get list of destination IP addresses or Service Tags. + * + * @return the destinationAddresses value + */ + public List destinationAddresses() { + return this.destinationAddresses; + } + + /** + * Set list of destination IP addresses or Service Tags. + * + * @param destinationAddresses the destinationAddresses value to set + * @return the ApplicationRuleCondition object itself. + */ + public ApplicationRuleCondition withDestinationAddresses(List destinationAddresses) { + this.destinationAddresses = destinationAddresses; + return this; + } + + /** + * Get array of Application Protocols. + * + * @return the protocols value + */ + public List protocols() { + return this.protocols; + } + + /** + * Set array of Application Protocols. + * + * @param protocols the protocols value to set + * @return the ApplicationRuleCondition object itself. + */ + public ApplicationRuleCondition withProtocols(List protocols) { + this.protocols = protocols; + return this; + } + + /** + * Get list of FQDNs for this rule condition. + * + * @return the targetFqdns value + */ + public List targetFqdns() { + return this.targetFqdns; + } + + /** + * Set list of FQDNs for this rule condition. + * + * @param targetFqdns the targetFqdns value to set + * @return the ApplicationRuleCondition object itself. + */ + public ApplicationRuleCondition withTargetFqdns(List targetFqdns) { + this.targetFqdns = targetFqdns; + return this; + } + + /** + * Get list of FQDN Tags for this rule condition. + * + * @return the fqdnTags value + */ + public List fqdnTags() { + return this.fqdnTags; + } + + /** + * Set list of FQDN Tags for this rule condition. + * + * @param fqdnTags the fqdnTags value to set + * @return the ApplicationRuleCondition object itself. + */ + public ApplicationRuleCondition withFqdnTags(List fqdnTags) { + this.fqdnTags = fqdnTags; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/AzureFirewall.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/AzureFirewall.java index 25e1e50a0546..bc5afeb64027 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/AzureFirewall.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/AzureFirewall.java @@ -19,6 +19,7 @@ import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.network.v2019_06_01.implementation.NetworkManager; import java.util.List; +import com.microsoft.azure.SubResource; import com.microsoft.azure.management.network.v2019_06_01.implementation.AzureFirewallInner; /** @@ -35,6 +36,16 @@ public interface AzureFirewall extends HasInner, Resource, G */ String etag(); + /** + * @return the firewallPolicy value. + */ + SubResource firewallPolicy(); + + /** + * @return the hubIpAddresses value. + */ + HubIPAddresses hubIpAddresses(); + /** * @return the ipConfigurations value. */ @@ -60,6 +71,11 @@ public interface AzureFirewall extends HasInner, Resource, G */ AzureFirewallThreatIntelMode threatIntelMode(); + /** + * @return the virtualHub value. + */ + SubResource virtualHub(); + /** * @return the zones value. */ @@ -99,6 +115,18 @@ interface WithApplicationRuleCollections { WithCreate withApplicationRuleCollections(List applicationRuleCollections); } + /** + * The stage of the azurefirewall definition allowing to specify FirewallPolicy. + */ + interface WithFirewallPolicy { + /** + * Specifies firewallPolicy. + * @param firewallPolicy The firewallPolicy associated with this azure firewall + * @return the next definition stage + */ + WithCreate withFirewallPolicy(SubResource firewallPolicy); + } + /** * The stage of the azurefirewall definition allowing to specify IpConfigurations. */ @@ -159,6 +187,18 @@ interface WithThreatIntelMode { WithCreate withThreatIntelMode(AzureFirewallThreatIntelMode threatIntelMode); } + /** + * The stage of the azurefirewall definition allowing to specify VirtualHub. + */ + interface WithVirtualHub { + /** + * Specifies virtualHub. + * @param virtualHub The virtualHub to which the firewall belongs + * @return the next definition stage + */ + WithCreate withVirtualHub(SubResource virtualHub); + } + /** * The stage of the azurefirewall definition allowing to specify Zones. */ @@ -176,13 +216,13 @@ interface WithZones { * the resource to be created (via {@link WithCreate#create()}), but also allows * for any other optional settings to be specified. */ - interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithApplicationRuleCollections, DefinitionStages.WithIpConfigurations, DefinitionStages.WithNatRuleCollections, DefinitionStages.WithNetworkRuleCollections, DefinitionStages.WithProvisioningState, DefinitionStages.WithThreatIntelMode, DefinitionStages.WithZones { + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithApplicationRuleCollections, DefinitionStages.WithFirewallPolicy, DefinitionStages.WithIpConfigurations, DefinitionStages.WithNatRuleCollections, DefinitionStages.WithNetworkRuleCollections, DefinitionStages.WithProvisioningState, DefinitionStages.WithThreatIntelMode, DefinitionStages.WithVirtualHub, DefinitionStages.WithZones { } } /** * The template for a AzureFirewall update operation, containing all the settings that can be modified. */ - interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithApplicationRuleCollections, UpdateStages.WithIpConfigurations, UpdateStages.WithNatRuleCollections, UpdateStages.WithNetworkRuleCollections, UpdateStages.WithProvisioningState, UpdateStages.WithThreatIntelMode, UpdateStages.WithZones { + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithApplicationRuleCollections, UpdateStages.WithFirewallPolicy, UpdateStages.WithIpConfigurations, UpdateStages.WithNatRuleCollections, UpdateStages.WithNetworkRuleCollections, UpdateStages.WithProvisioningState, UpdateStages.WithThreatIntelMode, UpdateStages.WithVirtualHub, UpdateStages.WithZones { } /** @@ -201,6 +241,18 @@ interface WithApplicationRuleCollections { Update withApplicationRuleCollections(List applicationRuleCollections); } + /** + * The stage of the azurefirewall update allowing to specify FirewallPolicy. + */ + interface WithFirewallPolicy { + /** + * Specifies firewallPolicy. + * @param firewallPolicy The firewallPolicy associated with this azure firewall + * @return the next update stage + */ + Update withFirewallPolicy(SubResource firewallPolicy); + } + /** * The stage of the azurefirewall update allowing to specify IpConfigurations. */ @@ -261,6 +313,18 @@ interface WithThreatIntelMode { Update withThreatIntelMode(AzureFirewallThreatIntelMode threatIntelMode); } + /** + * The stage of the azurefirewall update allowing to specify VirtualHub. + */ + interface WithVirtualHub { + /** + * Specifies virtualHub. + * @param virtualHub The virtualHub to which the firewall belongs + * @return the next update stage + */ + Update withVirtualHub(SubResource virtualHub); + } + /** * The stage of the azurefirewall update allowing to specify Zones. */ diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/AzureFirewallPublicIPAddress.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/AzureFirewallPublicIPAddress.java new file mode 100644 index 000000000000..589d2a121a9f --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/AzureFirewallPublicIPAddress.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Public IP Address associated with azure firewall. + */ +public class AzureFirewallPublicIPAddress { + /** + * Public IP Address value. + */ + @JsonProperty(value = "address") + private String address; + + /** + * Get public IP Address value. + * + * @return the address value + */ + public String address() { + return this.address; + } + + /** + * Set public IP Address value. + * + * @param address the address value to set + * @return the AzureFirewallPublicIPAddress object itself. + */ + public AzureFirewallPublicIPAddress withAddress(String address) { + this.address = address; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicies.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicies.java new file mode 100644 index 000000000000..cf0089b32b64 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicies.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.network.v2019_06_01.implementation.FirewallPoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing FirewallPolicies. + */ +public interface FirewallPolicies extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicy.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicy.java new file mode 100644 index 000000000000..c0c4408df172 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicy.java @@ -0,0 +1,177 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.network.v2019_06_01.implementation.NetworkManager; +import java.util.List; +import com.microsoft.azure.SubResource; +import com.microsoft.azure.management.network.v2019_06_01.implementation.FirewallPolicyInner; + +/** + * Type representing FirewallPolicy. + */ +public interface FirewallPolicy extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the basePolicy value. + */ + SubResource basePolicy(); + + /** + * @return the childPolicies value. + */ + List childPolicies(); + + /** + * @return the etag value. + */ + String etag(); + + /** + * @return the firewalls value. + */ + List firewalls(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * @return the ruleGroups value. + */ + List ruleGroups(); + + /** + * @return the threatIntelMode value. + */ + AzureFirewallThreatIntelMode threatIntelMode(); + + /** + * The entirety of the FirewallPolicy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of FirewallPolicy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a FirewallPolicy definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the FirewallPolicy definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the firewallpolicy definition allowing to specify BasePolicy. + */ + interface WithBasePolicy { + /** + * Specifies basePolicy. + * @param basePolicy The parent firewall policy from which rules are inherited + * @return the next definition stage + */ + WithCreate withBasePolicy(SubResource basePolicy); + } + + /** + * The stage of the firewallpolicy definition allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + * @return the next definition stage + */ + WithCreate withProvisioningState(ProvisioningState provisioningState); + } + + /** + * The stage of the firewallpolicy definition allowing to specify ThreatIntelMode. + */ + interface WithThreatIntelMode { + /** + * Specifies threatIntelMode. + * @param threatIntelMode The operation mode for Threat Intelligence. Possible values include: 'Alert', 'Deny', 'Off' + * @return the next definition stage + */ + WithCreate withThreatIntelMode(AzureFirewallThreatIntelMode threatIntelMode); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithBasePolicy, DefinitionStages.WithProvisioningState, DefinitionStages.WithThreatIntelMode { + } + } + /** + * The template for a FirewallPolicy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithBasePolicy, UpdateStages.WithProvisioningState, UpdateStages.WithThreatIntelMode { + } + + /** + * Grouping of FirewallPolicy update stages. + */ + interface UpdateStages { + /** + * The stage of the firewallpolicy update allowing to specify BasePolicy. + */ + interface WithBasePolicy { + /** + * Specifies basePolicy. + * @param basePolicy The parent firewall policy from which rules are inherited + * @return the next update stage + */ + Update withBasePolicy(SubResource basePolicy); + } + + /** + * The stage of the firewallpolicy update allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + * @return the next update stage + */ + Update withProvisioningState(ProvisioningState provisioningState); + } + + /** + * The stage of the firewallpolicy update allowing to specify ThreatIntelMode. + */ + interface WithThreatIntelMode { + /** + * Specifies threatIntelMode. + * @param threatIntelMode The operation mode for Threat Intelligence. Possible values include: 'Alert', 'Deny', 'Off' + * @return the next update stage + */ + Update withThreatIntelMode(AzureFirewallThreatIntelMode threatIntelMode); + } + + } +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyFilterRule.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyFilterRule.java new file mode 100644 index 000000000000..98ea6d614ff1 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyFilterRule.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Firewall Policy Filter Rule. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType", defaultImpl = FirewallPolicyFilterRule.class) +@JsonTypeName("FirewallPolicyFilterRule") +public class FirewallPolicyFilterRule extends FirewallPolicyRule { + /** + * The action type of a Filter rule. + */ + @JsonProperty(value = "action") + private FirewallPolicyFilterRuleAction action; + + /** + * Collection of rule conditions used by a rule. + */ + @JsonProperty(value = "ruleConditions") + private List ruleConditions; + + /** + * Get the action type of a Filter rule. + * + * @return the action value + */ + public FirewallPolicyFilterRuleAction action() { + return this.action; + } + + /** + * Set the action type of a Filter rule. + * + * @param action the action value to set + * @return the FirewallPolicyFilterRule object itself. + */ + public FirewallPolicyFilterRule withAction(FirewallPolicyFilterRuleAction action) { + this.action = action; + return this; + } + + /** + * Get collection of rule conditions used by a rule. + * + * @return the ruleConditions value + */ + public List ruleConditions() { + return this.ruleConditions; + } + + /** + * Set collection of rule conditions used by a rule. + * + * @param ruleConditions the ruleConditions value to set + * @return the FirewallPolicyFilterRule object itself. + */ + public FirewallPolicyFilterRule withRuleConditions(List ruleConditions) { + this.ruleConditions = ruleConditions; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyFilterRuleAction.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyFilterRuleAction.java new file mode 100644 index 000000000000..00384f4a762d --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyFilterRuleAction.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the FirewallPolicyFilterRuleAction. + */ +public class FirewallPolicyFilterRuleAction { + /** + * The type of action. Possible values include: 'Allow', 'Deny', 'Alert '. + */ + @JsonProperty(value = "type") + private FirewallPolicyFilterRuleActionType type; + + /** + * Get the type of action. Possible values include: 'Allow', 'Deny', 'Alert '. + * + * @return the type value + */ + public FirewallPolicyFilterRuleActionType type() { + return this.type; + } + + /** + * Set the type of action. Possible values include: 'Allow', 'Deny', 'Alert '. + * + * @param type the type value to set + * @return the FirewallPolicyFilterRuleAction object itself. + */ + public FirewallPolicyFilterRuleAction withType(FirewallPolicyFilterRuleActionType type) { + this.type = type; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyFilterRuleActionType.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyFilterRuleActionType.java new file mode 100644 index 000000000000..c9314890a681 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyFilterRuleActionType.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for FirewallPolicyFilterRuleActionType. + */ +public final class FirewallPolicyFilterRuleActionType extends ExpandableStringEnum { + /** Static value Allow for FirewallPolicyFilterRuleActionType. */ + public static final FirewallPolicyFilterRuleActionType ALLOW = fromString("Allow"); + + /** Static value Deny for FirewallPolicyFilterRuleActionType. */ + public static final FirewallPolicyFilterRuleActionType DENY = fromString("Deny"); + + /** Static value Alert for FirewallPolicyFilterRuleActionType. */ + public static final FirewallPolicyFilterRuleActionType ALERT_ = fromString("Alert "); + + /** + * Creates or finds a FirewallPolicyFilterRuleActionType from its string representation. + * @param name a name to look for + * @return the corresponding FirewallPolicyFilterRuleActionType + */ + @JsonCreator + public static FirewallPolicyFilterRuleActionType fromString(String name) { + return fromString(name, FirewallPolicyFilterRuleActionType.class); + } + + /** + * @return known FirewallPolicyFilterRuleActionType values + */ + public static Collection values() { + return values(FirewallPolicyFilterRuleActionType.class); + } +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyNatRule.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyNatRule.java new file mode 100644 index 000000000000..cf3f43dc9408 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyNatRule.java @@ -0,0 +1,125 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Firewall Policy NAT Rule. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType", defaultImpl = FirewallPolicyNatRule.class) +@JsonTypeName("FirewallPolicyNatRule") +public class FirewallPolicyNatRule extends FirewallPolicyRule { + /** + * The action type of a Nat rule, SNAT or DNAT. + */ + @JsonProperty(value = "action") + private FirewallPolicyNatRuleAction action; + + /** + * The translated address for this NAT rule. + */ + @JsonProperty(value = "translatedAddress") + private String translatedAddress; + + /** + * The translated port for this NAT rule. + */ + @JsonProperty(value = "translatedPort") + private String translatedPort; + + /** + * The match conditions for incoming traffic. + */ + @JsonProperty(value = "ruleCondition") + private FirewallPolicyRuleCondition ruleCondition; + + /** + * Get the action type of a Nat rule, SNAT or DNAT. + * + * @return the action value + */ + public FirewallPolicyNatRuleAction action() { + return this.action; + } + + /** + * Set the action type of a Nat rule, SNAT or DNAT. + * + * @param action the action value to set + * @return the FirewallPolicyNatRule object itself. + */ + public FirewallPolicyNatRule withAction(FirewallPolicyNatRuleAction action) { + this.action = action; + return this; + } + + /** + * Get the translated address for this NAT rule. + * + * @return the translatedAddress value + */ + public String translatedAddress() { + return this.translatedAddress; + } + + /** + * Set the translated address for this NAT rule. + * + * @param translatedAddress the translatedAddress value to set + * @return the FirewallPolicyNatRule object itself. + */ + public FirewallPolicyNatRule withTranslatedAddress(String translatedAddress) { + this.translatedAddress = translatedAddress; + return this; + } + + /** + * Get the translated port for this NAT rule. + * + * @return the translatedPort value + */ + public String translatedPort() { + return this.translatedPort; + } + + /** + * Set the translated port for this NAT rule. + * + * @param translatedPort the translatedPort value to set + * @return the FirewallPolicyNatRule object itself. + */ + public FirewallPolicyNatRule withTranslatedPort(String translatedPort) { + this.translatedPort = translatedPort; + return this; + } + + /** + * Get the match conditions for incoming traffic. + * + * @return the ruleCondition value + */ + public FirewallPolicyRuleCondition ruleCondition() { + return this.ruleCondition; + } + + /** + * Set the match conditions for incoming traffic. + * + * @param ruleCondition the ruleCondition value to set + * @return the FirewallPolicyNatRule object itself. + */ + public FirewallPolicyNatRule withRuleCondition(FirewallPolicyRuleCondition ruleCondition) { + this.ruleCondition = ruleCondition; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyNatRuleAction.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyNatRuleAction.java new file mode 100644 index 000000000000..e7b7760d891f --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyNatRuleAction.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the FirewallPolicyNatRuleAction. + */ +public class FirewallPolicyNatRuleAction { + /** + * The type of action. Possible values include: 'DNAT', 'SNAT'. + */ + @JsonProperty(value = "type") + private FirewallPolicyNatRuleActionType type; + + /** + * Get the type of action. Possible values include: 'DNAT', 'SNAT'. + * + * @return the type value + */ + public FirewallPolicyNatRuleActionType type() { + return this.type; + } + + /** + * Set the type of action. Possible values include: 'DNAT', 'SNAT'. + * + * @param type the type value to set + * @return the FirewallPolicyNatRuleAction object itself. + */ + public FirewallPolicyNatRuleAction withType(FirewallPolicyNatRuleActionType type) { + this.type = type; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyNatRuleActionType.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyNatRuleActionType.java new file mode 100644 index 000000000000..38137eead757 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyNatRuleActionType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for FirewallPolicyNatRuleActionType. + */ +public final class FirewallPolicyNatRuleActionType extends ExpandableStringEnum { + /** Static value DNAT for FirewallPolicyNatRuleActionType. */ + public static final FirewallPolicyNatRuleActionType DNAT = fromString("DNAT"); + + /** Static value SNAT for FirewallPolicyNatRuleActionType. */ + public static final FirewallPolicyNatRuleActionType SNAT = fromString("SNAT"); + + /** + * Creates or finds a FirewallPolicyNatRuleActionType from its string representation. + * @param name a name to look for + * @return the corresponding FirewallPolicyNatRuleActionType + */ + @JsonCreator + public static FirewallPolicyNatRuleActionType fromString(String name) { + return fromString(name, FirewallPolicyNatRuleActionType.class); + } + + /** + * @return known FirewallPolicyNatRuleActionType values + */ + public static Collection values() { + return values(FirewallPolicyNatRuleActionType.class); + } +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRule.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRule.java new file mode 100644 index 000000000000..d44082c64d72 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRule.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * Properties of the rule. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleType", defaultImpl = FirewallPolicyRule.class) +@JsonTypeName("FirewallPolicyRule") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "FirewallPolicyNatRule", value = FirewallPolicyNatRule.class), + @JsonSubTypes.Type(name = "FirewallPolicyFilterRule", value = FirewallPolicyFilterRule.class) +}) +public class FirewallPolicyRule { + /** + * Name of the Rule. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Priority of the Firewall Policy Rule resource. + */ + @JsonProperty(value = "priority") + private Integer priority; + + /** + * Get name of the Rule. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of the Rule. + * + * @param name the name value to set + * @return the FirewallPolicyRule object itself. + */ + public FirewallPolicyRule withName(String name) { + this.name = name; + return this; + } + + /** + * Get priority of the Firewall Policy Rule resource. + * + * @return the priority value + */ + public Integer priority() { + return this.priority; + } + + /** + * Set priority of the Firewall Policy Rule resource. + * + * @param priority the priority value to set + * @return the FirewallPolicyRule object itself. + */ + public FirewallPolicyRule withPriority(Integer priority) { + this.priority = priority; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleCondition.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleCondition.java new file mode 100644 index 000000000000..83baae2c4846 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleCondition.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * Properties of a rule. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleConditionType", defaultImpl = FirewallPolicyRuleCondition.class) +@JsonTypeName("FirewallPolicyRuleCondition") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "ApplicationRuleCondition", value = ApplicationRuleCondition.class), + @JsonSubTypes.Type(name = "NetworkRuleCondition", value = NetworkRuleCondition.class) +}) +public class FirewallPolicyRuleCondition { + /** + * Name of the rule condition. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Description of the rule condition. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get name of the rule condition. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of the rule condition. + * + * @param name the name value to set + * @return the FirewallPolicyRuleCondition object itself. + */ + public FirewallPolicyRuleCondition withName(String name) { + this.name = name; + return this; + } + + /** + * Get description of the rule condition. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of the rule condition. + * + * @param description the description value to set + * @return the FirewallPolicyRuleCondition object itself. + */ + public FirewallPolicyRuleCondition withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleConditionApplicationProtocol.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleConditionApplicationProtocol.java new file mode 100644 index 000000000000..f73a53d6ae11 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleConditionApplicationProtocol.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the application rule protocol. + */ +public class FirewallPolicyRuleConditionApplicationProtocol { + /** + * Protocol type. Possible values include: 'Http', 'Https'. + */ + @JsonProperty(value = "protocolType") + private FirewallPolicyRuleConditionApplicationProtocolType protocolType; + + /** + * Port number for the protocol, cannot be greater than 64000. + */ + @JsonProperty(value = "port") + private Integer port; + + /** + * Get protocol type. Possible values include: 'Http', 'Https'. + * + * @return the protocolType value + */ + public FirewallPolicyRuleConditionApplicationProtocolType protocolType() { + return this.protocolType; + } + + /** + * Set protocol type. Possible values include: 'Http', 'Https'. + * + * @param protocolType the protocolType value to set + * @return the FirewallPolicyRuleConditionApplicationProtocol object itself. + */ + public FirewallPolicyRuleConditionApplicationProtocol withProtocolType(FirewallPolicyRuleConditionApplicationProtocolType protocolType) { + this.protocolType = protocolType; + return this; + } + + /** + * Get port number for the protocol, cannot be greater than 64000. + * + * @return the port value + */ + public Integer port() { + return this.port; + } + + /** + * Set port number for the protocol, cannot be greater than 64000. + * + * @param port the port value to set + * @return the FirewallPolicyRuleConditionApplicationProtocol object itself. + */ + public FirewallPolicyRuleConditionApplicationProtocol withPort(Integer port) { + this.port = port; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleConditionApplicationProtocolType.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleConditionApplicationProtocolType.java new file mode 100644 index 000000000000..637b75d7b7fe --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleConditionApplicationProtocolType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for FirewallPolicyRuleConditionApplicationProtocolType. + */ +public final class FirewallPolicyRuleConditionApplicationProtocolType extends ExpandableStringEnum { + /** Static value Http for FirewallPolicyRuleConditionApplicationProtocolType. */ + public static final FirewallPolicyRuleConditionApplicationProtocolType HTTP = fromString("Http"); + + /** Static value Https for FirewallPolicyRuleConditionApplicationProtocolType. */ + public static final FirewallPolicyRuleConditionApplicationProtocolType HTTPS = fromString("Https"); + + /** + * Creates or finds a FirewallPolicyRuleConditionApplicationProtocolType from its string representation. + * @param name a name to look for + * @return the corresponding FirewallPolicyRuleConditionApplicationProtocolType + */ + @JsonCreator + public static FirewallPolicyRuleConditionApplicationProtocolType fromString(String name) { + return fromString(name, FirewallPolicyRuleConditionApplicationProtocolType.class); + } + + /** + * @return known FirewallPolicyRuleConditionApplicationProtocolType values + */ + public static Collection values() { + return values(FirewallPolicyRuleConditionApplicationProtocolType.class); + } +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleConditionNetworkProtocol.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleConditionNetworkProtocol.java new file mode 100644 index 000000000000..47f4c457dd62 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleConditionNetworkProtocol.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for FirewallPolicyRuleConditionNetworkProtocol. + */ +public final class FirewallPolicyRuleConditionNetworkProtocol extends ExpandableStringEnum { + /** Static value TCP for FirewallPolicyRuleConditionNetworkProtocol. */ + public static final FirewallPolicyRuleConditionNetworkProtocol TCP = fromString("TCP"); + + /** Static value UDP for FirewallPolicyRuleConditionNetworkProtocol. */ + public static final FirewallPolicyRuleConditionNetworkProtocol UDP = fromString("UDP"); + + /** Static value Any for FirewallPolicyRuleConditionNetworkProtocol. */ + public static final FirewallPolicyRuleConditionNetworkProtocol ANY = fromString("Any"); + + /** Static value ICMP for FirewallPolicyRuleConditionNetworkProtocol. */ + public static final FirewallPolicyRuleConditionNetworkProtocol ICMP = fromString("ICMP"); + + /** + * Creates or finds a FirewallPolicyRuleConditionNetworkProtocol from its string representation. + * @param name a name to look for + * @return the corresponding FirewallPolicyRuleConditionNetworkProtocol + */ + @JsonCreator + public static FirewallPolicyRuleConditionNetworkProtocol fromString(String name) { + return fromString(name, FirewallPolicyRuleConditionNetworkProtocol.class); + } + + /** + * @return known FirewallPolicyRuleConditionNetworkProtocol values + */ + public static Collection values() { + return values(FirewallPolicyRuleConditionNetworkProtocol.class); + } +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleGroup.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleGroup.java new file mode 100644 index 000000000000..665cbba3a074 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleGroup.java @@ -0,0 +1,229 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.network.v2019_06_01.implementation.FirewallPolicyRuleGroupInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.network.v2019_06_01.implementation.NetworkManager; +import java.util.List; + +/** + * Type representing FirewallPolicyRuleGroup. + */ +public interface FirewallPolicyRuleGroup extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the etag value. + */ + String etag(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the priority value. + */ + Integer priority(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * @return the rules value. + */ + List rules(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the FirewallPolicyRuleGroup definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithFirewallPolicy, DefinitionStages.WithCreate { + } + + /** + * Grouping of FirewallPolicyRuleGroup definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a FirewallPolicyRuleGroup definition. + */ + interface Blank extends WithFirewallPolicy { + } + + /** + * The stage of the firewallpolicyrulegroup definition allowing to specify FirewallPolicy. + */ + interface WithFirewallPolicy { + /** + * Specifies resourceGroupName, firewallPolicyName. + * @param resourceGroupName The name of the resource group + * @param firewallPolicyName The name of the Firewall Policy + * @return the next definition stage + */ + WithCreate withExistingFirewallPolicy(String resourceGroupName, String firewallPolicyName); + } + + /** + * The stage of the firewallpolicyrulegroup definition allowing to specify Id. + */ + interface WithId { + /** + * Specifies id. + * @param id Resource ID + * @return the next definition stage + */ + WithCreate withId(String id); + } + + /** + * The stage of the firewallpolicyrulegroup definition allowing to specify Name. + */ + interface WithName { + /** + * Specifies name. + * @param name Gets name of the resource that is unique within a resource group. This name can be used to access the resource + * @return the next definition stage + */ + WithCreate withName(String name); + } + + /** + * The stage of the firewallpolicyrulegroup definition allowing to specify Priority. + */ + interface WithPriority { + /** + * Specifies priority. + * @param priority Priority of the Firewall Policy Rule Group resource + * @return the next definition stage + */ + WithCreate withPriority(Integer priority); + } + + /** + * The stage of the firewallpolicyrulegroup definition allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + * @return the next definition stage + */ + WithCreate withProvisioningState(ProvisioningState provisioningState); + } + + /** + * The stage of the firewallpolicyrulegroup definition allowing to specify Rules. + */ + interface WithRules { + /** + * Specifies rules. + * @param rules Group of Firewall Policy rules + * @return the next definition stage + */ + WithCreate withRules(List rules); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithId, DefinitionStages.WithName, DefinitionStages.WithPriority, DefinitionStages.WithProvisioningState, DefinitionStages.WithRules { + } + } + /** + * The template for a FirewallPolicyRuleGroup update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithId, UpdateStages.WithName, UpdateStages.WithPriority, UpdateStages.WithProvisioningState, UpdateStages.WithRules { + } + + /** + * Grouping of FirewallPolicyRuleGroup update stages. + */ + interface UpdateStages { + /** + * The stage of the firewallpolicyrulegroup update allowing to specify Id. + */ + interface WithId { + /** + * Specifies id. + * @param id Resource ID + * @return the next update stage + */ + Update withId(String id); + } + + /** + * The stage of the firewallpolicyrulegroup update allowing to specify Name. + */ + interface WithName { + /** + * Specifies name. + * @param name Gets name of the resource that is unique within a resource group. This name can be used to access the resource + * @return the next update stage + */ + Update withName(String name); + } + + /** + * The stage of the firewallpolicyrulegroup update allowing to specify Priority. + */ + interface WithPriority { + /** + * Specifies priority. + * @param priority Priority of the Firewall Policy Rule Group resource + * @return the next update stage + */ + Update withPriority(Integer priority); + } + + /** + * The stage of the firewallpolicyrulegroup update allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + * @return the next update stage + */ + Update withProvisioningState(ProvisioningState provisioningState); + } + + /** + * The stage of the firewallpolicyrulegroup update allowing to specify Rules. + */ + interface WithRules { + /** + * Specifies rules. + * @param rules Group of Firewall Policy rules + * @return the next update stage + */ + Update withRules(List rules); + } + + } +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleGroups.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleGroups.java new file mode 100644 index 000000000000..75ddbc77f160 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/FirewallPolicyRuleGroups.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.network.v2019_06_01.implementation.FirewallPolicyRuleGroupsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing FirewallPolicyRuleGroups. + */ +public interface FirewallPolicyRuleGroups extends SupportsCreating, HasInner { + /** + * Gets the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName); + + /** + * Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String firewallPolicyName); + + /** + * Deletes the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName); + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/HubIPAddresses.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/HubIPAddresses.java new file mode 100644 index 000000000000..b43f1237a6c7 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/HubIPAddresses.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * IP addresses associated with azure firewall. + */ +public class HubIPAddresses { + /** + * List of Public IP addresses associated with azure firewall. + */ + @JsonProperty(value = "publicIPAddresses") + private List publicIPAddresses; + + /** + * Private IP Address associated with azure firewall. + */ + @JsonProperty(value = "privateIPAddress") + private String privateIPAddress; + + /** + * Get list of Public IP addresses associated with azure firewall. + * + * @return the publicIPAddresses value + */ + public List publicIPAddresses() { + return this.publicIPAddresses; + } + + /** + * Set list of Public IP addresses associated with azure firewall. + * + * @param publicIPAddresses the publicIPAddresses value to set + * @return the HubIPAddresses object itself. + */ + public HubIPAddresses withPublicIPAddresses(List publicIPAddresses) { + this.publicIPAddresses = publicIPAddresses; + return this; + } + + /** + * Get private IP Address associated with azure firewall. + * + * @return the privateIPAddress value + */ + public String privateIPAddress() { + return this.privateIPAddress; + } + + /** + * Set private IP Address associated with azure firewall. + * + * @param privateIPAddress the privateIPAddress value to set + * @return the HubIPAddresses object itself. + */ + public HubIPAddresses withPrivateIPAddress(String privateIPAddress) { + this.privateIPAddress = privateIPAddress; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/NetworkRuleCondition.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/NetworkRuleCondition.java new file mode 100644 index 000000000000..b69f1b4fb70d --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/NetworkRuleCondition.java @@ -0,0 +1,126 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Rule condition of type network. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "ruleConditionType", defaultImpl = NetworkRuleCondition.class) +@JsonTypeName("NetworkRuleCondition") +public class NetworkRuleCondition extends FirewallPolicyRuleCondition { + /** + * Array of FirewallPolicyRuleConditionNetworkProtocols. + */ + @JsonProperty(value = "ipProtocols") + private List ipProtocols; + + /** + * List of source IP addresses for this rule. + */ + @JsonProperty(value = "sourceAddresses") + private List sourceAddresses; + + /** + * List of destination IP addresses or Service Tags. + */ + @JsonProperty(value = "destinationAddresses") + private List destinationAddresses; + + /** + * List of destination ports. + */ + @JsonProperty(value = "destinationPorts") + private List destinationPorts; + + /** + * Get array of FirewallPolicyRuleConditionNetworkProtocols. + * + * @return the ipProtocols value + */ + public List ipProtocols() { + return this.ipProtocols; + } + + /** + * Set array of FirewallPolicyRuleConditionNetworkProtocols. + * + * @param ipProtocols the ipProtocols value to set + * @return the NetworkRuleCondition object itself. + */ + public NetworkRuleCondition withIpProtocols(List ipProtocols) { + this.ipProtocols = ipProtocols; + return this; + } + + /** + * Get list of source IP addresses for this rule. + * + * @return the sourceAddresses value + */ + public List sourceAddresses() { + return this.sourceAddresses; + } + + /** + * Set list of source IP addresses for this rule. + * + * @param sourceAddresses the sourceAddresses value to set + * @return the NetworkRuleCondition object itself. + */ + public NetworkRuleCondition withSourceAddresses(List sourceAddresses) { + this.sourceAddresses = sourceAddresses; + return this; + } + + /** + * Get list of destination IP addresses or Service Tags. + * + * @return the destinationAddresses value + */ + public List destinationAddresses() { + return this.destinationAddresses; + } + + /** + * Set list of destination IP addresses or Service Tags. + * + * @param destinationAddresses the destinationAddresses value to set + * @return the NetworkRuleCondition object itself. + */ + public NetworkRuleCondition withDestinationAddresses(List destinationAddresses) { + this.destinationAddresses = destinationAddresses; + return this; + } + + /** + * Get list of destination ports. + * + * @return the destinationPorts value + */ + public List destinationPorts() { + return this.destinationPorts; + } + + /** + * Set list of destination ports. + * + * @param destinationPorts the destinationPorts value to set + * @return the NetworkRuleCondition object itself. + */ + public NetworkRuleCondition withDestinationPorts(List destinationPorts) { + this.destinationPorts = destinationPorts; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateEndpoint.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateEndpoint.java index 2354b744fa94..58eab488ec41 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateEndpoint.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateEndpoint.java @@ -49,7 +49,7 @@ public interface PrivateEndpoint extends HasInner, Resourc /** * @return the provisioningState value. */ - String provisioningState(); + ProvisioningState provisioningState(); /** * @return the subnet value. @@ -84,7 +84,7 @@ interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup privateLinkServiceConnections); } + /** + * The stage of the privateendpoint definition allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning state of the private endpoint. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + * @return the next definition stage + */ + WithCreate withProvisioningState(ProvisioningState provisioningState); + } + /** * The stage of the privateendpoint definition allowing to specify Subnet. */ @@ -131,13 +143,13 @@ interface WithSubnet { * the resource to be created (via {@link WithCreate#create()}), but also allows * for any other optional settings to be specified. */ - interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithEtag, DefinitionStages.WithManualPrivateLinkServiceConnections, DefinitionStages.WithPrivateLinkServiceConnections, DefinitionStages.WithSubnet { + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithEtag, DefinitionStages.WithManualPrivateLinkServiceConnections, DefinitionStages.WithPrivateLinkServiceConnections, DefinitionStages.WithProvisioningState, DefinitionStages.WithSubnet { } } /** * The template for a PrivateEndpoint update operation, containing all the settings that can be modified. */ - interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithEtag, UpdateStages.WithManualPrivateLinkServiceConnections, UpdateStages.WithPrivateLinkServiceConnections, UpdateStages.WithSubnet { + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithEtag, UpdateStages.WithManualPrivateLinkServiceConnections, UpdateStages.WithPrivateLinkServiceConnections, UpdateStages.WithProvisioningState, UpdateStages.WithSubnet { } /** @@ -150,7 +162,7 @@ interface UpdateStages { interface WithEtag { /** * Specifies etag. - * @param etag Gets a unique read-only string that changes whenever the resource is updated + * @param etag A unique read-only string that changes whenever the resource is updated * @return the next update stage */ Update withEtag(String etag); @@ -180,6 +192,18 @@ interface WithPrivateLinkServiceConnections { Update withPrivateLinkServiceConnections(List privateLinkServiceConnections); } + /** + * The stage of the privateendpoint update allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning state of the private endpoint. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + * @return the next update stage + */ + Update withProvisioningState(ProvisioningState provisioningState); + } + /** * The stage of the privateendpoint update allowing to specify Subnet. */ diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateEndpointConnection.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateEndpointConnection.java index c24be5c2a812..623399d59cc7 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateEndpointConnection.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateEndpointConnection.java @@ -21,6 +21,11 @@ * Type representing PrivateEndpointConnection. */ public interface PrivateEndpointConnection extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the etag value. + */ + String etag(); + /** * @return the id value. */ @@ -41,10 +46,20 @@ public interface PrivateEndpointConnection extends HasInner, UpdateStages.WithId, UpdateStages.WithName, UpdateStages.WithPrivateEndpoint, UpdateStages.WithPrivateLinkServiceConnectionState { + interface Update extends Appliable, UpdateStages.WithId, UpdateStages.WithName, UpdateStages.WithPrivateEndpoint, UpdateStages.WithPrivateLinkServiceConnectionState, UpdateStages.WithProvisioningState { } /** @@ -99,5 +114,17 @@ interface WithPrivateLinkServiceConnectionState { Update withPrivateLinkServiceConnectionState(PrivateLinkServiceConnectionState privateLinkServiceConnectionState); } + /** + * The stage of the privateendpointconnection update allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning state of the private endpoint connection. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + * @return the next update stage + */ + Update withProvisioningState(ProvisioningState provisioningState); + } + } } diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateLinkService.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateLinkService.java index 8c5316610645..aff516f9142d 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateLinkService.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateLinkService.java @@ -70,7 +70,7 @@ public interface PrivateLinkService extends HasInner, R /** * @return the provisioningState value. */ - String provisioningState(); + ProvisioningState provisioningState(); /** * @return the visibility value. @@ -117,7 +117,7 @@ interface WithAutoApproval { interface WithEtag { /** * Specifies etag. - * @param etag Gets a unique read-only string that changes whenever the resource is updated + * @param etag A unique read-only string that changes whenever the resource is updated * @return the next definition stage */ WithCreate withEtag(String etag); @@ -171,6 +171,18 @@ interface WithPrivateEndpointConnections { WithCreate withPrivateEndpointConnections(List privateEndpointConnections); } + /** + * The stage of the privatelinkservice definition allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning state of the private link service. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + * @return the next definition stage + */ + WithCreate withProvisioningState(ProvisioningState provisioningState); + } + /** * The stage of the privatelinkservice definition allowing to specify Visibility. */ @@ -188,13 +200,13 @@ interface WithVisibility { * the resource to be created (via {@link WithCreate#create()}), but also allows * for any other optional settings to be specified. */ - interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithAutoApproval, DefinitionStages.WithEtag, DefinitionStages.WithFqdns, DefinitionStages.WithIpConfigurations, DefinitionStages.WithLoadBalancerFrontendIpConfigurations, DefinitionStages.WithPrivateEndpointConnections, DefinitionStages.WithVisibility { + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithAutoApproval, DefinitionStages.WithEtag, DefinitionStages.WithFqdns, DefinitionStages.WithIpConfigurations, DefinitionStages.WithLoadBalancerFrontendIpConfigurations, DefinitionStages.WithPrivateEndpointConnections, DefinitionStages.WithProvisioningState, DefinitionStages.WithVisibility { } } /** * The template for a PrivateLinkService update operation, containing all the settings that can be modified. */ - interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAutoApproval, UpdateStages.WithEtag, UpdateStages.WithFqdns, UpdateStages.WithIpConfigurations, UpdateStages.WithLoadBalancerFrontendIpConfigurations, UpdateStages.WithPrivateEndpointConnections, UpdateStages.WithVisibility { + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAutoApproval, UpdateStages.WithEtag, UpdateStages.WithFqdns, UpdateStages.WithIpConfigurations, UpdateStages.WithLoadBalancerFrontendIpConfigurations, UpdateStages.WithPrivateEndpointConnections, UpdateStages.WithProvisioningState, UpdateStages.WithVisibility { } /** @@ -219,7 +231,7 @@ interface WithAutoApproval { interface WithEtag { /** * Specifies etag. - * @param etag Gets a unique read-only string that changes whenever the resource is updated + * @param etag A unique read-only string that changes whenever the resource is updated * @return the next update stage */ Update withEtag(String etag); @@ -273,6 +285,18 @@ interface WithPrivateEndpointConnections { Update withPrivateEndpointConnections(List privateEndpointConnections); } + /** + * The stage of the privatelinkservice update allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning state of the private link service. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + * @return the next update stage + */ + Update withProvisioningState(ProvisioningState provisioningState); + } + /** * The stage of the privatelinkservice update allowing to specify Visibility. */ diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateLinkServiceConnection.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateLinkServiceConnection.java index 48acebdc7ee4..459674eb0867 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateLinkServiceConnection.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateLinkServiceConnection.java @@ -18,6 +18,13 @@ */ @JsonFlatten public class PrivateLinkServiceConnection extends SubResource { + /** + * The provisioning state of the private link service connection. Possible + * values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + */ + @JsonProperty(value = "properties.provisioningState") + private ProvisioningState provisioningState; + /** * The resource id of private link service. */ @@ -52,6 +59,38 @@ public class PrivateLinkServiceConnection extends SubResource { @JsonProperty(value = "name") private String name; + /** + * The resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * A unique read-only string that changes whenever the resource is updated. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the provisioning state of the private link service connection. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioning state of the private link service connection. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @param provisioningState the provisioningState value to set + * @return the PrivateLinkServiceConnection object itself. + */ + public PrivateLinkServiceConnection withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + /** * Get the resource id of private link service. * @@ -152,4 +191,22 @@ public PrivateLinkServiceConnection withName(String name) { return this; } + /** + * Get the resource type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get a unique read-only string that changes whenever the resource is updated. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + } diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateLinkServiceIpConfiguration.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateLinkServiceIpConfiguration.java index 6869bc0cf203..4a7109f4bfaa 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateLinkServiceIpConfiguration.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PrivateLinkServiceIpConfiguration.java @@ -9,15 +9,15 @@ package com.microsoft.azure.management.network.v2019_06_01; import com.microsoft.azure.management.network.v2019_06_01.implementation.SubnetInner; -import com.microsoft.azure.management.network.v2019_06_01.implementation.PublicIPAddressInner; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.SubResource; /** * The private link service ip configuration. */ @JsonFlatten -public class PrivateLinkServiceIpConfiguration { +public class PrivateLinkServiceIpConfiguration extends SubResource { /** * The private IP address of the IP configuration. */ @@ -38,17 +38,17 @@ public class PrivateLinkServiceIpConfiguration { private SubnetInner subnet; /** - * The reference of the public IP resource. + * Whether the ip configuration is primary or not. */ - @JsonProperty(value = "properties.publicIPAddress") - private PublicIPAddressInner publicIPAddress; + @JsonProperty(value = "properties.primary") + private Boolean primary; /** - * Gets the provisioning state of the public IP resource. Possible values - * are: 'Updating', 'Deleting', and 'Failed'. + * The provisioning state of the private link service ip configuration. + * Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. */ @JsonProperty(value = "properties.provisioningState") - private String provisioningState; + private ProvisioningState provisioningState; /** * Available from Api-Version 2016-03-30 onwards, it represents whether the @@ -64,6 +64,18 @@ public class PrivateLinkServiceIpConfiguration { @JsonProperty(value = "name") private String name; + /** + * A unique read-only string that changes whenever the resource is updated. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * The resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + /** * Get the private IP address of the IP configuration. * @@ -125,41 +137,41 @@ public PrivateLinkServiceIpConfiguration withSubnet(SubnetInner subnet) { } /** - * Get the reference of the public IP resource. + * Get whether the ip configuration is primary or not. * - * @return the publicIPAddress value + * @return the primary value */ - public PublicIPAddressInner publicIPAddress() { - return this.publicIPAddress; + public Boolean primary() { + return this.primary; } /** - * Set the reference of the public IP resource. + * Set whether the ip configuration is primary or not. * - * @param publicIPAddress the publicIPAddress value to set + * @param primary the primary value to set * @return the PrivateLinkServiceIpConfiguration object itself. */ - public PrivateLinkServiceIpConfiguration withPublicIPAddress(PublicIPAddressInner publicIPAddress) { - this.publicIPAddress = publicIPAddress; + public PrivateLinkServiceIpConfiguration withPrimary(Boolean primary) { + this.primary = primary; return this; } /** - * Get gets the provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * Get the provisioning state of the private link service ip configuration. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. * * @return the provisioningState value */ - public String provisioningState() { + public ProvisioningState provisioningState() { return this.provisioningState; } /** - * Set gets the provisioning state of the public IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * Set the provisioning state of the private link service ip configuration. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. * * @param provisioningState the provisioningState value to set * @return the PrivateLinkServiceIpConfiguration object itself. */ - public PrivateLinkServiceIpConfiguration withProvisioningState(String provisioningState) { + public PrivateLinkServiceIpConfiguration withProvisioningState(ProvisioningState provisioningState) { this.provisioningState = provisioningState; return this; } @@ -204,4 +216,22 @@ public PrivateLinkServiceIpConfiguration withName(String name) { return this; } + /** + * Get a unique read-only string that changes whenever the resource is updated. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + + /** + * Get the resource type. + * + * @return the type value + */ + public String type() { + return this.type; + } + } diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PublicIPPrefix.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PublicIPPrefix.java index 651a29a4f093..df05289ea5c0 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PublicIPPrefix.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/PublicIPPrefix.java @@ -19,6 +19,7 @@ import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.network.v2019_06_01.implementation.NetworkManager; import java.util.List; +import com.microsoft.azure.SubResource; import com.microsoft.azure.management.network.v2019_06_01.implementation.PublicIPPrefixInner; /** @@ -40,6 +41,11 @@ public interface PublicIPPrefix extends HasInner, Resource, */ List ipTags(); + /** + * @return the loadBalancerFrontendIpConfiguration value. + */ + SubResource loadBalancerFrontendIpConfiguration(); + /** * @return the prefixLength value. */ diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/ServiceTags.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/ServiceTags.java index 3b5456c2c4ff..2c8a63d707a5 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/ServiceTags.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/ServiceTags.java @@ -19,7 +19,7 @@ public interface ServiceTags extends HasInner { /** * Gets a list of service tag information resources. * - * @param location The location. + * @param location The location that will be used as a reference for version (not as a filter based on location, you will get the list of service tags with prefix details across all regions but limited to the cloud that your subscription belongs to). * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/Subnets.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/Subnets.java index 40695f84f6dd..0822a5a7db6b 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/Subnets.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/Subnets.java @@ -30,6 +30,17 @@ public interface Subnets extends SupportsCreating */ Completable prepareNetworkPoliciesAsync(String resourceGroupName, String virtualNetworkName, String subnetName, PrepareNetworkPoliciesRequest prepareNetworkPoliciesRequestParameters); + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable unprepareNetworkPoliciesAsync(String resourceGroupName, String virtualNetworkName, String subnetName); + /** * Gets the specified subnet by virtual network and resource group. * diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/UnprepareNetworkPoliciesRequest.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/UnprepareNetworkPoliciesRequest.java new file mode 100644 index 000000000000..73db7523285e --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/UnprepareNetworkPoliciesRequest.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details of UnprepareNetworkPolicies for Subnet. + */ +public class UnprepareNetworkPoliciesRequest { + /** + * The name of the service for which subnet is being unprepared for. + */ + @JsonProperty(value = "serviceName") + private String serviceName; + + /** + * Get the name of the service for which subnet is being unprepared for. + * + * @return the serviceName value + */ + public String serviceName() { + return this.serviceName; + } + + /** + * Set the name of the service for which subnet is being unprepared for. + * + * @param serviceName the serviceName value to set + * @return the UnprepareNetworkPoliciesRequest object itself. + */ + public UnprepareNetworkPoliciesRequest withServiceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ApplicationGatewaysImpl.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ApplicationGatewaysImpl.java index 84712071560c..22b2f3d4ee74 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ApplicationGatewaysImpl.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ApplicationGatewaysImpl.java @@ -106,13 +106,13 @@ public ApplicationGateway call(ApplicationGatewayInner inner) { @Override public PagedList list() { ApplicationGatewaysInner client = this.inner(); - return this.wrapList(client.listAll()); + return this.wrapList(client.list()); } @Override public Observable listAsync() { ApplicationGatewaysInner client = this.inner(); - return client.listAllAsync() + return client.listAsync() .flatMapIterable(new Func1, Iterable>() { @Override public Iterable call(Page page) { diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ApplicationGatewaysInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ApplicationGatewaysInner.java index c7213cbcb0b8..fa09ea989dc4 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ApplicationGatewaysInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ApplicationGatewaysInner.java @@ -10,6 +10,7 @@ import com.microsoft.azure.arm.collection.InnerSupportsGet; import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceFuture; @@ -44,14 +45,12 @@ import rx.Observable; import com.microsoft.azure.LongRunningFinalState; import com.microsoft.azure.LongRunningOperationOptions; -import com.microsoft.azure.LongRunningFinalState; -import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined * in ApplicationGateways. */ -public class ApplicationGatewaysInner implements InnerSupportsGet, InnerSupportsDelete { +public class ApplicationGatewaysInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { /** The Retrofit service to perform REST calls. */ private ApplicationGatewaysService service; /** The service client containing this operation class. */ @@ -105,9 +104,9 @@ interface ApplicationGatewaysService { @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways") Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.ApplicationGateways listAll" }) + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.ApplicationGateways list" }) @GET("subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGateways") - Observable> listAll(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.ApplicationGateways start" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start") @@ -173,9 +172,9 @@ interface ApplicationGatewaysService { @GET Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.ApplicationGateways listAllNext" }) + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.ApplicationGateways listNext" }) @GET - Observable> listAllNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.ApplicationGateways listAvailableSslPredefinedPoliciesNext" }) @GET @@ -1021,12 +1020,12 @@ private ServiceResponse> listByResourceGroupDe * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PagedList<ApplicationGatewayInner> object if successful. */ - public PagedList listAll() { - ServiceResponse> response = listAllSinglePageAsync().toBlocking().single(); + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); return new PagedList(response.body()) { @Override public Page nextPage(String nextPageLink) { - return listAllNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } @@ -1038,13 +1037,13 @@ public Page nextPage(String nextPageLink) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listAllAsync(final ListOperationCallback serviceCallback) { + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( - listAllSinglePageAsync(), + listSinglePageAsync(), new Func1>>>() { @Override public Observable>> call(String nextPageLink) { - return listAllNextSinglePageAsync(nextPageLink); + return listNextSinglePageAsync(nextPageLink); } }, serviceCallback); @@ -1056,8 +1055,8 @@ public Observable>> call(String ne * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<ApplicationGatewayInner> object */ - public Observable> listAllAsync() { - return listAllWithServiceResponseAsync() + public Observable> listAsync() { + return listWithServiceResponseAsync() .map(new Func1>, Page>() { @Override public Page call(ServiceResponse> response) { @@ -1072,8 +1071,8 @@ public Page call(ServiceResponse>> listAllWithServiceResponseAsync() { - return listAllSinglePageAsync() + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() .concatMap(new Func1>, Observable>>>() { @Override public Observable>> call(ServiceResponse> page) { @@ -1081,7 +1080,7 @@ public Observable>> call(ServiceRe if (nextPageLink == null) { return Observable.just(page); } - return Observable.just(page).concatWith(listAllNextWithServiceResponseAsync(nextPageLink)); + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); } }); } @@ -1092,17 +1091,17 @@ public Observable>> call(ServiceRe * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<ApplicationGatewayInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listAllSinglePageAsync() { + public Observable>> listSinglePageAsync() { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2019-06-01"; - return service.listAll(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listAllDelegate(response); + ServiceResponse> result = listDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -1111,7 +1110,7 @@ public Observable>> call(Response< }); } - private ServiceResponse> listAllDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) @@ -2712,12 +2711,12 @@ private ServiceResponse> listByResourceGroupNe * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the PagedList<ApplicationGatewayInner> object if successful. */ - public PagedList listAllNext(final String nextPageLink) { - ServiceResponse> response = listAllNextSinglePageAsync(nextPageLink).toBlocking().single(); + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); return new PagedList(response.body()) { @Override public Page nextPage(String nextPageLink) { - return listAllNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } @@ -2731,13 +2730,13 @@ public Page nextPage(String nextPageLink) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listAllNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( - listAllNextSinglePageAsync(nextPageLink), + listNextSinglePageAsync(nextPageLink), new Func1>>>() { @Override public Observable>> call(String nextPageLink) { - return listAllNextSinglePageAsync(nextPageLink); + return listNextSinglePageAsync(nextPageLink); } }, serviceCallback); @@ -2750,8 +2749,8 @@ public Observable>> call(String ne * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<ApplicationGatewayInner> object */ - public Observable> listAllNextAsync(final String nextPageLink) { - return listAllNextWithServiceResponseAsync(nextPageLink) + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) .map(new Func1>, Page>() { @Override public Page call(ServiceResponse> response) { @@ -2767,8 +2766,8 @@ public Page call(ServiceResponse>> listAllNextWithServiceResponseAsync(final String nextPageLink) { - return listAllNextSinglePageAsync(nextPageLink) + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) .concatMap(new Func1>, Observable>>>() { @Override public Observable>> call(ServiceResponse> page) { @@ -2776,7 +2775,7 @@ public Observable>> call(ServiceRe if (nextPageLink == null) { return Observable.just(page); } - return Observable.just(page).concatWith(listAllNextWithServiceResponseAsync(nextPageLink)); + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); } }); } @@ -2788,17 +2787,17 @@ public Observable>> call(ServiceRe * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<ApplicationGatewayInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listAllNextSinglePageAsync(final String nextPageLink) { + public Observable>> listNextSinglePageAsync(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } String nextUrl = String.format("%s", nextPageLink); - return service.listAllNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { try { - ServiceResponse> result = listAllNextDelegate(response); + ServiceResponse> result = listNextDelegate(response); return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); @@ -2807,7 +2806,7 @@ public Observable>> call(Response< }); } - private ServiceResponse> listAllNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/AzureFirewallImpl.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/AzureFirewallImpl.java index 1a54dcc1a582..8728726bb8a4 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/AzureFirewallImpl.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/AzureFirewallImpl.java @@ -18,6 +18,8 @@ import com.microsoft.azure.management.network.v2019_06_01.AzureFirewallIPConfiguration; import com.microsoft.azure.management.network.v2019_06_01.ProvisioningState; import com.microsoft.azure.management.network.v2019_06_01.AzureFirewallThreatIntelMode; +import com.microsoft.azure.SubResource; +import com.microsoft.azure.management.network.v2019_06_01.HubIPAddresses; class AzureFirewallImpl extends GroupableResourceCoreImpl implements AzureFirewall, AzureFirewall.Definition, AzureFirewall.Update { AzureFirewallImpl(String name, AzureFirewallInner inner, NetworkManager manager) { @@ -60,6 +62,16 @@ public String etag() { return this.inner().etag(); } + @Override + public SubResource firewallPolicy() { + return this.inner().firewallPolicy(); + } + + @Override + public HubIPAddresses hubIpAddresses() { + return this.inner().hubIpAddresses(); + } + @Override public List ipConfigurations() { return this.inner().ipConfigurations(); @@ -85,6 +97,11 @@ public AzureFirewallThreatIntelMode threatIntelMode() { return this.inner().threatIntelMode(); } + @Override + public SubResource virtualHub() { + return this.inner().virtualHub(); + } + @Override public List zones() { return this.inner().zones(); @@ -96,6 +113,12 @@ public AzureFirewallImpl withApplicationRuleCollections(List ipConfigurations) { this.inner().withIpConfigurations(ipConfigurations); @@ -126,6 +149,12 @@ public AzureFirewallImpl withThreatIntelMode(AzureFirewallThreatIntelMode threat return this; } + @Override + public AzureFirewallImpl withVirtualHub(SubResource virtualHub) { + this.inner().withVirtualHub(virtualHub); + return this; + } + @Override public AzureFirewallImpl withZones(List zones) { this.inner().withZones(zones); diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/AzureFirewallInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/AzureFirewallInner.java index 4d813f99f13d..8c4d2c4c3ec9 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/AzureFirewallInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/AzureFirewallInner.java @@ -15,6 +15,8 @@ import com.microsoft.azure.management.network.v2019_06_01.AzureFirewallIPConfiguration; import com.microsoft.azure.management.network.v2019_06_01.ProvisioningState; import com.microsoft.azure.management.network.v2019_06_01.AzureFirewallThreatIntelMode; +import com.microsoft.azure.SubResource; +import com.microsoft.azure.management.network.v2019_06_01.HubIPAddresses; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.rest.SkipParentValidation; @@ -64,6 +66,24 @@ public class AzureFirewallInner extends Resource { @JsonProperty(value = "properties.threatIntelMode") private AzureFirewallThreatIntelMode threatIntelMode; + /** + * The virtualHub to which the firewall belongs. + */ + @JsonProperty(value = "properties.virtualHub") + private SubResource virtualHub; + + /** + * The firewallPolicy associated with this azure firewall. + */ + @JsonProperty(value = "properties.firewallPolicy") + private SubResource firewallPolicy; + + /** + * IP addresses associated with AzureFirewall. + */ + @JsonProperty(value = "properties.hubIpAddresses", access = JsonProperty.Access.WRITE_ONLY) + private HubIPAddresses hubIpAddresses; + /** * A list of availability zones denoting where the resource needs to come * from. @@ -204,6 +224,55 @@ public AzureFirewallInner withThreatIntelMode(AzureFirewallThreatIntelMode threa return this; } + /** + * Get the virtualHub to which the firewall belongs. + * + * @return the virtualHub value + */ + public SubResource virtualHub() { + return this.virtualHub; + } + + /** + * Set the virtualHub to which the firewall belongs. + * + * @param virtualHub the virtualHub value to set + * @return the AzureFirewallInner object itself. + */ + public AzureFirewallInner withVirtualHub(SubResource virtualHub) { + this.virtualHub = virtualHub; + return this; + } + + /** + * Get the firewallPolicy associated with this azure firewall. + * + * @return the firewallPolicy value + */ + public SubResource firewallPolicy() { + return this.firewallPolicy; + } + + /** + * Set the firewallPolicy associated with this azure firewall. + * + * @param firewallPolicy the firewallPolicy value to set + * @return the AzureFirewallInner object itself. + */ + public AzureFirewallInner withFirewallPolicy(SubResource firewallPolicy) { + this.firewallPolicy = firewallPolicy; + return this; + } + + /** + * Get iP addresses associated with AzureFirewall. + * + * @return the hubIpAddresses value + */ + public HubIPAddresses hubIpAddresses() { + return this.hubIpAddresses; + } + /** * Get a list of availability zones denoting where the resource needs to come from. * diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ConnectionMonitorsInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ConnectionMonitorsInner.java index 268f86843902..a6211edc5dbd 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ConnectionMonitorsInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ConnectionMonitorsInner.java @@ -32,8 +32,6 @@ import rx.Observable; import com.microsoft.azure.LongRunningFinalState; import com.microsoft.azure.LongRunningOperationOptions; -import com.microsoft.azure.LongRunningFinalState; -import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ExpressRouteCircuitsInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ExpressRouteCircuitsInner.java index 88a1f8304595..9f9fa1eee4a7 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ExpressRouteCircuitsInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ExpressRouteCircuitsInner.java @@ -43,8 +43,6 @@ import rx.Observable; import com.microsoft.azure.LongRunningFinalState; import com.microsoft.azure.LongRunningOperationOptions; -import com.microsoft.azure.LongRunningFinalState; -import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ExpressRouteCrossConnectionsInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ExpressRouteCrossConnectionsInner.java index 75c4e3fb8e65..e290547d5731 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ExpressRouteCrossConnectionsInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ExpressRouteCrossConnectionsInner.java @@ -41,8 +41,6 @@ import rx.Observable; import com.microsoft.azure.LongRunningFinalState; import com.microsoft.azure.LongRunningOperationOptions; -import com.microsoft.azure.LongRunningFinalState; -import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPoliciesImpl.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPoliciesImpl.java new file mode 100644 index 000000000000..b7e135790bc0 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPoliciesImpl.java @@ -0,0 +1,138 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * def + */ + +package com.microsoft.azure.management.network.v2019_06_01.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.network.v2019_06_01.FirewallPolicies; +import com.microsoft.azure.management.network.v2019_06_01.FirewallPolicy; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; + +class FirewallPoliciesImpl extends GroupableResourcesCoreImpl implements FirewallPolicies { + protected FirewallPoliciesImpl(NetworkManager manager) { + super(manager.inner().firewallPolicies(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + FirewallPoliciesInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + FirewallPoliciesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + FirewallPoliciesInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + FirewallPoliciesInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public FirewallPolicy call(FirewallPolicyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + FirewallPoliciesInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + FirewallPoliciesInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public FirewallPolicy call(FirewallPolicyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public FirewallPolicyImpl define(String name) { + return wrapModel(name); + } + + @Override + protected FirewallPolicyImpl wrapModel(FirewallPolicyInner inner) { + return new FirewallPolicyImpl(inner.name(), inner, manager()); + } + + @Override + protected FirewallPolicyImpl wrapModel(String name) { + return new FirewallPolicyImpl(name, new FirewallPolicyInner(), this.manager()); + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPoliciesInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPoliciesInner.java new file mode 100644 index 000000000000..6463ff23fea8 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPoliciesInner.java @@ -0,0 +1,1209 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.network.v2019_06_01.ErrorException; +import com.microsoft.azure.management.network.v2019_06_01.TagsObject; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in FirewallPolicies. + */ +public class FirewallPoliciesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private FirewallPoliciesService service; + /** The service client containing this operation class. */ + private NetworkManagementClientImpl client; + + /** + * Initializes an instance of FirewallPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public FirewallPoliciesInner(Retrofit retrofit, NetworkManagementClientImpl client) { + this.service = retrofit.create(FirewallPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for FirewallPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface FirewallPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicies delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicies beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicies getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicies updateTags" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}") + Observable> updateTags(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TagsObject firewallPolicyParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("subscriptionId") String subscriptionId, @Body FirewallPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicies beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("subscriptionId") String subscriptionId, @Body FirewallPolicyInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicies listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicies list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Network/firewallPolicies") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicies listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicies listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Deletes the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String firewallPolicyName) { + deleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName).toBlocking().last().body(); + } + + /** + * Deletes the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String firewallPolicyName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName), serviceCallback); + } + + /** + * Deletes the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String firewallPolicyName) { + return deleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + Observable> observable = service.delete(resourceGroupName, firewallPolicyName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String firewallPolicyName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName).toBlocking().single().body(); + } + + /** + * Deletes the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String firewallPolicyName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName), serviceCallback); + } + + /** + * Deletes the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String firewallPolicyName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + return service.beginDelete(resourceGroupName, firewallPolicyName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FirewallPolicyInner object if successful. + */ + public FirewallPolicyInner getByResourceGroup(String resourceGroupName, String firewallPolicyName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, firewallPolicyName).toBlocking().single().body(); + } + + /** + * Gets the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String firewallPolicyName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, firewallPolicyName), serviceCallback); + } + + /** + * Gets the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String firewallPolicyName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, firewallPolicyName).map(new Func1, FirewallPolicyInner>() { + @Override + public FirewallPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + final String expand = null; + return service.getByResourceGroup(resourceGroupName, firewallPolicyName, this.client.subscriptionId(), apiVersion, expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param expand Expands referenced resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FirewallPolicyInner object if successful. + */ + public FirewallPolicyInner getByResourceGroup(String resourceGroupName, String firewallPolicyName, String expand) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, firewallPolicyName, expand).toBlocking().single().body(); + } + + /** + * Gets the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param expand Expands referenced resources. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String firewallPolicyName, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, firewallPolicyName, expand), serviceCallback); + } + + /** + * Gets the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param expand Expands referenced resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String firewallPolicyName, String expand) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, firewallPolicyName, expand).map(new Func1, FirewallPolicyInner>() { + @Override + public FirewallPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param expand Expands referenced resources. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName, String expand) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + return service.getByResourceGroup(resourceGroupName, firewallPolicyName, this.client.subscriptionId(), apiVersion, expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates a Firewall Policy Tags. + * + * @param resourceGroupName The resource group name of the Firewall Policy. + * @param firewallPolicyName The name of the Firewall Policy being updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FirewallPolicyInner object if successful. + */ + public FirewallPolicyInner updateTags(String resourceGroupName, String firewallPolicyName) { + return updateTagsWithServiceResponseAsync(resourceGroupName, firewallPolicyName).toBlocking().single().body(); + } + + /** + * Updates a Firewall Policy Tags. + * + * @param resourceGroupName The resource group name of the Firewall Policy. + * @param firewallPolicyName The name of the Firewall Policy being updated. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateTagsAsync(String resourceGroupName, String firewallPolicyName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateTagsWithServiceResponseAsync(resourceGroupName, firewallPolicyName), serviceCallback); + } + + /** + * Updates a Firewall Policy Tags. + * + * @param resourceGroupName The resource group name of the Firewall Policy. + * @param firewallPolicyName The name of the Firewall Policy being updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyInner object + */ + public Observable updateTagsAsync(String resourceGroupName, String firewallPolicyName) { + return updateTagsWithServiceResponseAsync(resourceGroupName, firewallPolicyName).map(new Func1, FirewallPolicyInner>() { + @Override + public FirewallPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a Firewall Policy Tags. + * + * @param resourceGroupName The resource group name of the Firewall Policy. + * @param firewallPolicyName The name of the Firewall Policy being updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyInner object + */ + public Observable> updateTagsWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + final Map tags = null; + TagsObject firewallPolicyParameters = new TagsObject(); + firewallPolicyParameters.withTags(null); + return service.updateTags(this.client.subscriptionId(), resourceGroupName, firewallPolicyName, apiVersion, this.client.acceptLanguage(), firewallPolicyParameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateTagsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates a Firewall Policy Tags. + * + * @param resourceGroupName The resource group name of the Firewall Policy. + * @param firewallPolicyName The name of the Firewall Policy being updated. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FirewallPolicyInner object if successful. + */ + public FirewallPolicyInner updateTags(String resourceGroupName, String firewallPolicyName, Map tags) { + return updateTagsWithServiceResponseAsync(resourceGroupName, firewallPolicyName, tags).toBlocking().single().body(); + } + + /** + * Updates a Firewall Policy Tags. + * + * @param resourceGroupName The resource group name of the Firewall Policy. + * @param firewallPolicyName The name of the Firewall Policy being updated. + * @param tags Resource tags. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateTagsAsync(String resourceGroupName, String firewallPolicyName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateTagsWithServiceResponseAsync(resourceGroupName, firewallPolicyName, tags), serviceCallback); + } + + /** + * Updates a Firewall Policy Tags. + * + * @param resourceGroupName The resource group name of the Firewall Policy. + * @param firewallPolicyName The name of the Firewall Policy being updated. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyInner object + */ + public Observable updateTagsAsync(String resourceGroupName, String firewallPolicyName, Map tags) { + return updateTagsWithServiceResponseAsync(resourceGroupName, firewallPolicyName, tags).map(new Func1, FirewallPolicyInner>() { + @Override + public FirewallPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a Firewall Policy Tags. + * + * @param resourceGroupName The resource group name of the Firewall Policy. + * @param firewallPolicyName The name of the Firewall Policy being updated. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyInner object + */ + public Observable> updateTagsWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName, Map tags) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + Validator.validate(tags); + final String apiVersion = "2019-06-01"; + TagsObject firewallPolicyParameters = new TagsObject(); + firewallPolicyParameters.withTags(tags); + return service.updateTags(this.client.subscriptionId(), resourceGroupName, firewallPolicyName, apiVersion, this.client.acceptLanguage(), firewallPolicyParameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateTagsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateTagsDelegate(Response response) throws ErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorException.class) + .build(response); + } + + /** + * Creates or updates the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param parameters Parameters supplied to the create or update Firewall Policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FirewallPolicyInner object if successful. + */ + public FirewallPolicyInner createOrUpdate(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param parameters Parameters supplied to the create or update Firewall Policy operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, parameters), serviceCallback); + } + + /** + * Creates or updates the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param parameters Parameters supplied to the create or update Firewall Policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, parameters).map(new Func1, FirewallPolicyInner>() { + @Override + public FirewallPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param parameters Parameters supplied to the create or update Firewall Policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2019-06-01"; + Observable> observable = service.createOrUpdate(resourceGroupName, firewallPolicyName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param parameters Parameters supplied to the create or update Firewall Policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FirewallPolicyInner object if successful. + */ + public FirewallPolicyInner beginCreateOrUpdate(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param parameters Parameters supplied to the create or update Firewall Policy operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, parameters), serviceCallback); + } + + /** + * Creates or updates the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param parameters Parameters supplied to the create or update Firewall Policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, parameters).map(new Func1, FirewallPolicyInner>() { + @Override + public FirewallPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the specified Firewall Policy. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param parameters Parameters supplied to the create or update Firewall Policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2019-06-01"; + return service.beginCreateOrUpdate(resourceGroupName, firewallPolicyName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all Firewall Policies in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<FirewallPolicyInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all Firewall Policies in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all Firewall Policies in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FirewallPolicyInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all Firewall Policies in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FirewallPolicyInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all Firewall Policies in a resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<FirewallPolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all the Firewall Policies in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<FirewallPolicyInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the Firewall Policies in a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the Firewall Policies in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FirewallPolicyInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the Firewall Policies in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FirewallPolicyInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the Firewall Policies in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<FirewallPolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all Firewall Policies in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<FirewallPolicyInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all Firewall Policies in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all Firewall Policies in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FirewallPolicyInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all Firewall Policies in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FirewallPolicyInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all Firewall Policies in a resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<FirewallPolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all the Firewall Policies in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<FirewallPolicyInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the Firewall Policies in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the Firewall Policies in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FirewallPolicyInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the Firewall Policies in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FirewallPolicyInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the Firewall Policies in a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<FirewallPolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyImpl.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyImpl.java new file mode 100644 index 000000000000..ba1541abccf9 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyImpl.java @@ -0,0 +1,103 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.network.v2019_06_01.FirewallPolicy; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.SubResource; +import com.microsoft.azure.management.network.v2019_06_01.ProvisioningState; +import com.microsoft.azure.management.network.v2019_06_01.AzureFirewallThreatIntelMode; + +class FirewallPolicyImpl extends GroupableResourceCoreImpl implements FirewallPolicy, FirewallPolicy.Definition, FirewallPolicy.Update { + FirewallPolicyImpl(String name, FirewallPolicyInner inner, NetworkManager manager) { + super(name, inner, manager); + } + + @Override + public Observable createResourceAsync() { + FirewallPoliciesInner client = this.manager().inner().firewallPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + FirewallPoliciesInner client = this.manager().inner().firewallPolicies(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + FirewallPoliciesInner client = this.manager().inner().firewallPolicies(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public SubResource basePolicy() { + return this.inner().basePolicy(); + } + + @Override + public List childPolicies() { + return this.inner().childPolicies(); + } + + @Override + public String etag() { + return this.inner().etag(); + } + + @Override + public List firewalls() { + return this.inner().firewalls(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public List ruleGroups() { + return this.inner().ruleGroups(); + } + + @Override + public AzureFirewallThreatIntelMode threatIntelMode() { + return this.inner().threatIntelMode(); + } + + @Override + public FirewallPolicyImpl withBasePolicy(SubResource basePolicy) { + this.inner().withBasePolicy(basePolicy); + return this; + } + + @Override + public FirewallPolicyImpl withProvisioningState(ProvisioningState provisioningState) { + this.inner().withProvisioningState(provisioningState); + return this; + } + + @Override + public FirewallPolicyImpl withThreatIntelMode(AzureFirewallThreatIntelMode threatIntelMode) { + this.inner().withThreatIntelMode(threatIntelMode); + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyInner.java new file mode 100644 index 000000000000..48838025c9b2 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyInner.java @@ -0,0 +1,194 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01.implementation; + +import java.util.List; +import com.microsoft.azure.SubResource; +import com.microsoft.azure.management.network.v2019_06_01.ProvisioningState; +import com.microsoft.azure.management.network.v2019_06_01.AzureFirewallThreatIntelMode; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * FirewallPolicy Resource. + */ +@JsonFlatten +@SkipParentValidation +public class FirewallPolicyInner extends Resource { + /** + * List of references to FirewallPolicyRuleGroups. + */ + @JsonProperty(value = "properties.ruleGroups", access = JsonProperty.Access.WRITE_ONLY) + private List ruleGroups; + + /** + * The provisioning state of the resource. Possible values include: + * 'Succeeded', 'Updating', 'Deleting', 'Failed'. + */ + @JsonProperty(value = "properties.provisioningState") + private ProvisioningState provisioningState; + + /** + * The parent firewall policy from which rules are inherited. + */ + @JsonProperty(value = "properties.basePolicy") + private SubResource basePolicy; + + /** + * List of references to Azure Firewalls that this Firewall Policy is + * associated with. + */ + @JsonProperty(value = "properties.firewalls", access = JsonProperty.Access.WRITE_ONLY) + private List firewalls; + + /** + * List of references to Child Firewall Policies. + */ + @JsonProperty(value = "properties.childPolicies", access = JsonProperty.Access.WRITE_ONLY) + private List childPolicies; + + /** + * The operation mode for Threat Intelligence. Possible values include: + * 'Alert', 'Deny', 'Off'. + */ + @JsonProperty(value = "properties.threatIntelMode") + private AzureFirewallThreatIntelMode threatIntelMode; + + /** + * Gets a unique read-only string that changes whenever the resource is + * updated. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Resource ID. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get list of references to FirewallPolicyRuleGroups. + * + * @return the ruleGroups value + */ + public List ruleGroups() { + return this.ruleGroups; + } + + /** + * Get the provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @param provisioningState the provisioningState value to set + * @return the FirewallPolicyInner object itself. + */ + public FirewallPolicyInner withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the parent firewall policy from which rules are inherited. + * + * @return the basePolicy value + */ + public SubResource basePolicy() { + return this.basePolicy; + } + + /** + * Set the parent firewall policy from which rules are inherited. + * + * @param basePolicy the basePolicy value to set + * @return the FirewallPolicyInner object itself. + */ + public FirewallPolicyInner withBasePolicy(SubResource basePolicy) { + this.basePolicy = basePolicy; + return this; + } + + /** + * Get list of references to Azure Firewalls that this Firewall Policy is associated with. + * + * @return the firewalls value + */ + public List firewalls() { + return this.firewalls; + } + + /** + * Get list of references to Child Firewall Policies. + * + * @return the childPolicies value + */ + public List childPolicies() { + return this.childPolicies; + } + + /** + * Get the operation mode for Threat Intelligence. Possible values include: 'Alert', 'Deny', 'Off'. + * + * @return the threatIntelMode value + */ + public AzureFirewallThreatIntelMode threatIntelMode() { + return this.threatIntelMode; + } + + /** + * Set the operation mode for Threat Intelligence. Possible values include: 'Alert', 'Deny', 'Off'. + * + * @param threatIntelMode the threatIntelMode value to set + * @return the FirewallPolicyInner object itself. + */ + public FirewallPolicyInner withThreatIntelMode(AzureFirewallThreatIntelMode threatIntelMode) { + this.threatIntelMode = threatIntelMode; + return this; + } + + /** + * Get gets a unique read-only string that changes whenever the resource is updated. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + + /** + * Get resource ID. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set resource ID. + * + * @param id the id value to set + * @return the FirewallPolicyInner object itself. + */ + public FirewallPolicyInner withId(String id) { + this.id = id; + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyRuleGroupImpl.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyRuleGroupImpl.java new file mode 100644 index 000000000000..3cc084afc3fb --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyRuleGroupImpl.java @@ -0,0 +1,147 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01.implementation; + +import com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRuleGroup; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRule; +import com.microsoft.azure.management.network.v2019_06_01.ProvisioningState; + +class FirewallPolicyRuleGroupImpl extends CreatableUpdatableImpl implements FirewallPolicyRuleGroup, FirewallPolicyRuleGroup.Definition, FirewallPolicyRuleGroup.Update { + private final NetworkManager manager; + private String resourceGroupName; + private String firewallPolicyName; + private String ruleGroupName; + + FirewallPolicyRuleGroupImpl(String name, NetworkManager manager) { + super(name, new FirewallPolicyRuleGroupInner()); + this.manager = manager; + // Set resource name + this.ruleGroupName = name; + // + } + + FirewallPolicyRuleGroupImpl(FirewallPolicyRuleGroupInner inner, NetworkManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.ruleGroupName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.firewallPolicyName = IdParsingUtils.getValueFromIdByName(inner.id(), "firewallPolicies"); + this.ruleGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "ruleGroups"); + // + } + + @Override + public NetworkManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + FirewallPolicyRuleGroupsInner client = this.manager().inner().firewallPolicyRuleGroups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.firewallPolicyName, this.ruleGroupName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + FirewallPolicyRuleGroupsInner client = this.manager().inner().firewallPolicyRuleGroups(); + return client.createOrUpdateAsync(this.resourceGroupName, this.firewallPolicyName, this.ruleGroupName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + FirewallPolicyRuleGroupsInner client = this.manager().inner().firewallPolicyRuleGroups(); + return client.getAsync(this.resourceGroupName, this.firewallPolicyName, this.ruleGroupName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String etag() { + return this.inner().etag(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Integer priority() { + return this.inner().priority(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public List rules() { + return this.inner().rules(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public FirewallPolicyRuleGroupImpl withExistingFirewallPolicy(String resourceGroupName, String firewallPolicyName) { + this.resourceGroupName = resourceGroupName; + this.firewallPolicyName = firewallPolicyName; + return this; + } + + @Override + public FirewallPolicyRuleGroupImpl withId(String id) { + this.inner().withId(id); + return this; + } + + @Override + public FirewallPolicyRuleGroupImpl withName(String name) { + this.inner().withName(name); + return this; + } + + @Override + public FirewallPolicyRuleGroupImpl withPriority(Integer priority) { + this.inner().withPriority(priority); + return this; + } + + @Override + public FirewallPolicyRuleGroupImpl withProvisioningState(ProvisioningState provisioningState) { + this.inner().withProvisioningState(provisioningState); + return this; + } + + @Override + public FirewallPolicyRuleGroupImpl withRules(List rules) { + this.inner().withRules(rules); + return this; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyRuleGroupInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyRuleGroupInner.java new file mode 100644 index 000000000000..cd0c9d673f7a --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyRuleGroupInner.java @@ -0,0 +1,160 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRule; +import com.microsoft.azure.management.network.v2019_06_01.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.SubResource; + +/** + * Rule Group resource. + */ +@JsonFlatten +public class FirewallPolicyRuleGroupInner extends SubResource { + /** + * Priority of the Firewall Policy Rule Group resource. + */ + @JsonProperty(value = "properties.priority") + private Integer priority; + + /** + * Group of Firewall Policy rules. + */ + @JsonProperty(value = "properties.rules") + private List rules; + + /** + * The provisioning state of the resource. Possible values include: + * 'Succeeded', 'Updating', 'Deleting', 'Failed'. + */ + @JsonProperty(value = "properties.provisioningState") + private ProvisioningState provisioningState; + + /** + * Gets name of the resource that is unique within a resource group. This + * name can be used to access the resource. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Gets a unique read-only string that changes whenever the resource is + * updated. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Rule Group type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Get priority of the Firewall Policy Rule Group resource. + * + * @return the priority value + */ + public Integer priority() { + return this.priority; + } + + /** + * Set priority of the Firewall Policy Rule Group resource. + * + * @param priority the priority value to set + * @return the FirewallPolicyRuleGroupInner object itself. + */ + public FirewallPolicyRuleGroupInner withPriority(Integer priority) { + this.priority = priority; + return this; + } + + /** + * Get group of Firewall Policy rules. + * + * @return the rules value + */ + public List rules() { + return this.rules; + } + + /** + * Set group of Firewall Policy rules. + * + * @param rules the rules value to set + * @return the FirewallPolicyRuleGroupInner object itself. + */ + public FirewallPolicyRuleGroupInner withRules(List rules) { + this.rules = rules; + return this; + } + + /** + * Get the provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioning state of the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @param provisioningState the provisioningState value to set + * @return the FirewallPolicyRuleGroupInner object itself. + */ + public FirewallPolicyRuleGroupInner withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get gets name of the resource that is unique within a resource group. This name can be used to access the resource. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set gets name of the resource that is unique within a resource group. This name can be used to access the resource. + * + * @param name the name value to set + * @return the FirewallPolicyRuleGroupInner object itself. + */ + public FirewallPolicyRuleGroupInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get gets a unique read-only string that changes whenever the resource is updated. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + + /** + * Get rule Group type. + * + * @return the type value + */ + public String type() { + return this.type; + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyRuleGroupsImpl.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyRuleGroupsImpl.java new file mode 100644 index 000000000000..43e45f050972 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyRuleGroupsImpl.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.network.v2019_06_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRuleGroups; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRuleGroup; + +class FirewallPolicyRuleGroupsImpl extends WrapperImpl implements FirewallPolicyRuleGroups { + private final NetworkManager manager; + + FirewallPolicyRuleGroupsImpl(NetworkManager manager) { + super(manager.inner().firewallPolicyRuleGroups()); + this.manager = manager; + } + + public NetworkManager manager() { + return this.manager; + } + + @Override + public FirewallPolicyRuleGroupImpl define(String name) { + return wrapModel(name); + } + + private FirewallPolicyRuleGroupImpl wrapModel(FirewallPolicyRuleGroupInner inner) { + return new FirewallPolicyRuleGroupImpl(inner, manager()); + } + + private FirewallPolicyRuleGroupImpl wrapModel(String name) { + return new FirewallPolicyRuleGroupImpl(name, this.manager()); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String firewallPolicyName) { + FirewallPolicyRuleGroupsInner client = this.inner(); + return client.listAsync(resourceGroupName, firewallPolicyName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public FirewallPolicyRuleGroup call(FirewallPolicyRuleGroupInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName) { + FirewallPolicyRuleGroupsInner client = this.inner(); + return client.getAsync(resourceGroupName, firewallPolicyName, ruleGroupName) + .flatMap(new Func1>() { + @Override + public Observable call(FirewallPolicyRuleGroupInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((FirewallPolicyRuleGroup)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName) { + FirewallPolicyRuleGroupsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, firewallPolicyName, ruleGroupName).toCompletable(); + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyRuleGroupsInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyRuleGroupsInner.java new file mode 100644 index 000000000000..feefe0270181 --- /dev/null +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/FirewallPolicyRuleGroupsInner.java @@ -0,0 +1,764 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.network.v2019_06_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in FirewallPolicyRuleGroups. + */ +public class FirewallPolicyRuleGroupsInner { + /** The Retrofit service to perform REST calls. */ + private FirewallPolicyRuleGroupsService service; + /** The service client containing this operation class. */ + private NetworkManagementClientImpl client; + + /** + * Initializes an instance of FirewallPolicyRuleGroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public FirewallPolicyRuleGroupsInner(Retrofit retrofit, NetworkManagementClientImpl client) { + this.service = retrofit.create(FirewallPolicyRuleGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for FirewallPolicyRuleGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface FirewallPolicyRuleGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRuleGroups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleGroups/{ruleGroupName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("ruleGroupName") String ruleGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRuleGroups beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleGroups/{ruleGroupName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("ruleGroupName") String ruleGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRuleGroups get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleGroups/{ruleGroupName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("ruleGroupName") String ruleGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRuleGroups createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleGroups/{ruleGroupName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("ruleGroupName") String ruleGroupName, @Path("subscriptionId") String subscriptionId, @Body FirewallPolicyRuleGroupInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRuleGroups beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleGroups/{ruleGroupName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("ruleGroupName") String ruleGroupName, @Path("subscriptionId") String subscriptionId, @Body FirewallPolicyRuleGroupInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRuleGroups list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleGroups") + Observable> list(@Path("resourceGroupName") String resourceGroupName, @Path("firewallPolicyName") String firewallPolicyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRuleGroups listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Deletes the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String firewallPolicyName, String ruleGroupName) { + deleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName).toBlocking().last().body(); + } + + /** + * Deletes the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName), serviceCallback); + } + + /** + * Deletes the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName) { + return deleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + if (ruleGroupName == null) { + throw new IllegalArgumentException("Parameter ruleGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + Observable> observable = service.delete(resourceGroupName, firewallPolicyName, ruleGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String firewallPolicyName, String ruleGroupName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName).toBlocking().single().body(); + } + + /** + * Deletes the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName), serviceCallback); + } + + /** + * Deletes the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + if (ruleGroupName == null) { + throw new IllegalArgumentException("Parameter ruleGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + return service.beginDelete(resourceGroupName, firewallPolicyName, ruleGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FirewallPolicyRuleGroupInner object if successful. + */ + public FirewallPolicyRuleGroupInner get(String resourceGroupName, String firewallPolicyName, String ruleGroupName) { + return getWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName).toBlocking().single().body(); + } + + /** + * Gets the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName), serviceCallback); + } + + /** + * Gets the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyRuleGroupInner object + */ + public Observable getAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName) { + return getWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName).map(new Func1, FirewallPolicyRuleGroupInner>() { + @Override + public FirewallPolicyRuleGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyRuleGroupInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + if (ruleGroupName == null) { + throw new IllegalArgumentException("Parameter ruleGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + return service.get(resourceGroupName, firewallPolicyName, ruleGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @param parameters Parameters supplied to the create or update FirewallPolicyRuleGroup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FirewallPolicyRuleGroupInner object if successful. + */ + public FirewallPolicyRuleGroupInner createOrUpdate(String resourceGroupName, String firewallPolicyName, String ruleGroupName, FirewallPolicyRuleGroupInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @param parameters Parameters supplied to the create or update FirewallPolicyRuleGroup operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName, FirewallPolicyRuleGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName, parameters), serviceCallback); + } + + /** + * Creates or updates the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @param parameters Parameters supplied to the create or update FirewallPolicyRuleGroup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName, FirewallPolicyRuleGroupInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName, parameters).map(new Func1, FirewallPolicyRuleGroupInner>() { + @Override + public FirewallPolicyRuleGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @param parameters Parameters supplied to the create or update FirewallPolicyRuleGroup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName, FirewallPolicyRuleGroupInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + if (ruleGroupName == null) { + throw new IllegalArgumentException("Parameter ruleGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2019-06-01"; + Observable> observable = service.createOrUpdate(resourceGroupName, firewallPolicyName, ruleGroupName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @param parameters Parameters supplied to the create or update FirewallPolicyRuleGroup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FirewallPolicyRuleGroupInner object if successful. + */ + public FirewallPolicyRuleGroupInner beginCreateOrUpdate(String resourceGroupName, String firewallPolicyName, String ruleGroupName, FirewallPolicyRuleGroupInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @param parameters Parameters supplied to the create or update FirewallPolicyRuleGroup operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName, FirewallPolicyRuleGroupInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName, parameters), serviceCallback); + } + + /** + * Creates or updates the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @param parameters Parameters supplied to the create or update FirewallPolicyRuleGroup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyRuleGroupInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName, FirewallPolicyRuleGroupInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName, parameters).map(new Func1, FirewallPolicyRuleGroupInner>() { + @Override + public FirewallPolicyRuleGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the specified FirewallPolicyRuleGroup. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param ruleGroupName The name of the FirewallPolicyRuleGroup. + * @param parameters Parameters supplied to the create or update FirewallPolicyRuleGroup operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FirewallPolicyRuleGroupInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String firewallPolicyName, String ruleGroupName, FirewallPolicyRuleGroupInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + if (ruleGroupName == null) { + throw new IllegalArgumentException("Parameter ruleGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2019-06-01"; + return service.beginCreateOrUpdate(resourceGroupName, firewallPolicyName, ruleGroupName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<FirewallPolicyRuleGroupInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String firewallPolicyName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, firewallPolicyName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String firewallPolicyName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, firewallPolicyName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FirewallPolicyRuleGroupInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String firewallPolicyName) { + return listWithServiceResponseAsync(resourceGroupName, firewallPolicyName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + * + * @param resourceGroupName The name of the resource group. + * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FirewallPolicyRuleGroupInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String firewallPolicyName) { + return listSinglePageAsync(resourceGroupName, firewallPolicyName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param firewallPolicyName The name of the Firewall Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<FirewallPolicyRuleGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String firewallPolicyName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (firewallPolicyName == null) { + throw new IllegalArgumentException("Parameter firewallPolicyName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + return service.list(resourceGroupName, firewallPolicyName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<FirewallPolicyRuleGroupInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FirewallPolicyRuleGroupInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FirewallPolicyRuleGroupInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<FirewallPolicyRuleGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/NetworkInterfacesInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/NetworkInterfacesInner.java index 5d44a85c9707..3cc1c17f3dea 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/NetworkInterfacesInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/NetworkInterfacesInner.java @@ -43,8 +43,6 @@ import rx.Observable; import com.microsoft.azure.LongRunningFinalState; import com.microsoft.azure.LongRunningOperationOptions; -import com.microsoft.azure.LongRunningFinalState; -import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/NetworkManagementClientImpl.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/NetworkManagementClientImpl.java index 909b73e1ec0d..cf1caddeff97 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/NetworkManagementClientImpl.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/NetworkManagementClientImpl.java @@ -449,6 +449,32 @@ public ExpressRouteLinksInner expressRouteLinks() { return this.expressRouteLinks; } + /** + * The FirewallPoliciesInner object to access its operations. + */ + private FirewallPoliciesInner firewallPolicies; + + /** + * Gets the FirewallPoliciesInner object to access its operations. + * @return the FirewallPoliciesInner object. + */ + public FirewallPoliciesInner firewallPolicies() { + return this.firewallPolicies; + } + + /** + * The FirewallPolicyRuleGroupsInner object to access its operations. + */ + private FirewallPolicyRuleGroupsInner firewallPolicyRuleGroups; + + /** + * Gets the FirewallPolicyRuleGroupsInner object to access its operations. + * @return the FirewallPolicyRuleGroupsInner object. + */ + public FirewallPolicyRuleGroupsInner firewallPolicyRuleGroups() { + return this.firewallPolicyRuleGroups; + } + /** * The LoadBalancersInner object to access its operations. */ @@ -1248,6 +1274,8 @@ protected void initialize() { this.expressRoutePortsLocations = new ExpressRoutePortsLocationsInner(restClient().retrofit(), this); this.expressRoutePorts = new ExpressRoutePortsInner(restClient().retrofit(), this); this.expressRouteLinks = new ExpressRouteLinksInner(restClient().retrofit(), this); + this.firewallPolicies = new FirewallPoliciesInner(restClient().retrofit(), this); + this.firewallPolicyRuleGroups = new FirewallPolicyRuleGroupsInner(restClient().retrofit(), this); this.loadBalancers = new LoadBalancersInner(restClient().retrofit(), this); this.loadBalancerBackendAddressPools = new LoadBalancerBackendAddressPoolsInner(restClient().retrofit(), this); this.loadBalancerFrontendIPConfigurations = new LoadBalancerFrontendIPConfigurationsInner(restClient().retrofit(), this); diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/NetworkManager.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/NetworkManager.java index 5a516353d3cd..d8c9edc9370d 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/NetworkManager.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/NetworkManager.java @@ -39,6 +39,8 @@ import com.microsoft.azure.management.network.v2019_06_01.ExpressRoutePortsLocations; import com.microsoft.azure.management.network.v2019_06_01.ExpressRoutePorts; import com.microsoft.azure.management.network.v2019_06_01.ExpressRouteLinks; +import com.microsoft.azure.management.network.v2019_06_01.FirewallPolicies; +import com.microsoft.azure.management.network.v2019_06_01.FirewallPolicyRuleGroups; import com.microsoft.azure.management.network.v2019_06_01.LoadBalancers; import com.microsoft.azure.management.network.v2019_06_01.LoadBalancerBackendAddressPools; import com.microsoft.azure.management.network.v2019_06_01.LoadBalancerFrontendIPConfigurations; @@ -126,6 +128,8 @@ public final class NetworkManager extends ManagerCore implements PrivateEndpointConnection, PrivateEndpointConnection.Update { @@ -70,6 +71,11 @@ public boolean isInCreateMode() { } + @Override + public String etag() { + return this.inner().etag(); + } + @Override public String id() { return this.inner().id(); @@ -95,6 +101,16 @@ public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { return this.inner().privateLinkServiceConnectionState(); } + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public String type() { + return this.inner().type(); + } + @Override public PrivateEndpointConnectionImpl withId(String id) { this.inner().withId(id); @@ -119,4 +135,10 @@ public PrivateEndpointConnectionImpl withPrivateLinkServiceConnectionState(Priva return this; } + @Override + public PrivateEndpointConnectionImpl withProvisioningState(ProvisioningState provisioningState) { + this.inner().withProvisioningState(provisioningState); + return this; + } + } diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PrivateEndpointConnectionInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PrivateEndpointConnectionInner.java index cb1cf987c683..aee49d0a8a14 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PrivateEndpointConnectionInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PrivateEndpointConnectionInner.java @@ -9,6 +9,7 @@ package com.microsoft.azure.management.network.v2019_06_01.implementation; import com.microsoft.azure.management.network.v2019_06_01.PrivateLinkServiceConnectionState; +import com.microsoft.azure.management.network.v2019_06_01.ProvisioningState; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.azure.SubResource; @@ -31,6 +32,13 @@ public class PrivateEndpointConnectionInner extends SubResource { @JsonProperty(value = "properties.privateLinkServiceConnectionState") private PrivateLinkServiceConnectionState privateLinkServiceConnectionState; + /** + * The provisioning state of the private endpoint connection. Possible + * values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + */ + @JsonProperty(value = "properties.provisioningState") + private ProvisioningState provisioningState; + /** * The name of the resource that is unique within a resource group. This * name can be used to access the resource. @@ -38,6 +46,18 @@ public class PrivateEndpointConnectionInner extends SubResource { @JsonProperty(value = "name") private String name; + /** + * The resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * A unique read-only string that changes whenever the resource is updated. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + /** * Get the resource of private end point. * @@ -78,6 +98,26 @@ public PrivateEndpointConnectionInner withPrivateLinkServiceConnectionState(Priv return this; } + /** + * Get the provisioning state of the private endpoint connection. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioning state of the private endpoint connection. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @param provisioningState the provisioningState value to set + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + /** * Get the name of the resource that is unique within a resource group. This name can be used to access the resource. * @@ -98,4 +138,22 @@ public PrivateEndpointConnectionInner withName(String name) { return this; } + /** + * Get the resource type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get a unique read-only string that changes whenever the resource is updated. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + } diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PrivateEndpointImpl.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PrivateEndpointImpl.java index b9d4f83f9a18..918e9b37cc25 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PrivateEndpointImpl.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PrivateEndpointImpl.java @@ -12,6 +12,7 @@ import com.microsoft.azure.management.network.v2019_06_01.PrivateEndpoint; import rx.Observable; import java.util.List; +import com.microsoft.azure.management.network.v2019_06_01.ProvisioningState; import com.microsoft.azure.management.network.v2019_06_01.PrivateLinkServiceConnection; import java.util.ArrayList; import com.microsoft.azure.management.network.v2019_06_01.NetworkInterface; @@ -75,7 +76,7 @@ public List privateLinkServiceConnections() { } @Override - public String provisioningState() { + public ProvisioningState provisioningState() { return this.inner().provisioningState(); } @@ -107,6 +108,12 @@ public PrivateEndpointImpl withPrivateLinkServiceConnections(List networkInterfaces; /** - * The provisioning state of the private endpoint. Possible values are: - * 'Updating', 'Deleting', and 'Failed'. + * The provisioning state of the private endpoint. Possible values include: + * 'Succeeded', 'Updating', 'Deleting', 'Failed'. */ - @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) - private String provisioningState; + @JsonProperty(value = "properties.provisioningState") + private ProvisioningState provisioningState; /** * A grouping of information about the connection to the remote resource. @@ -56,8 +57,7 @@ public class PrivateEndpointInner extends Resource { private List manualPrivateLinkServiceConnections; /** - * Gets a unique read-only string that changes whenever the resource is - * updated. + * A unique read-only string that changes whenever the resource is updated. */ @JsonProperty(value = "etag") private String etag; @@ -98,14 +98,25 @@ public List networkInterfaces() { } /** - * Get the provisioning state of the private endpoint. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * Get the provisioning state of the private endpoint. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. * * @return the provisioningState value */ - public String provisioningState() { + public ProvisioningState provisioningState() { return this.provisioningState; } + /** + * Set the provisioning state of the private endpoint. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @param provisioningState the provisioningState value to set + * @return the PrivateEndpointInner object itself. + */ + public PrivateEndpointInner withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + /** * Get a grouping of information about the connection to the remote resource. * @@ -147,7 +158,7 @@ public PrivateEndpointInner withManualPrivateLinkServiceConnections(List privateEndpointConnections() { } @Override - public String provisioningState() { + public ProvisioningState provisioningState() { return this.inner().provisioningState(); } @@ -155,6 +156,12 @@ public PrivateLinkServiceImpl withPrivateEndpointConnections(List networkInterfaces; /** - * The provisioning state of the private link service. Possible values are: - * 'Updating', 'Succeeded', and 'Failed'. + * The provisioning state of the private link service. Possible values + * include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. */ - @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) - private String provisioningState; + @JsonProperty(value = "properties.provisioningState") + private ProvisioningState provisioningState; /** * An array of list about connections to the private endpoint. @@ -80,8 +81,7 @@ public class PrivateLinkServiceInner extends Resource { private String alias; /** - * Gets a unique read-only string that changes whenever the resource is - * updated. + * A unique read-only string that changes whenever the resource is updated. */ @JsonProperty(value = "etag") private String etag; @@ -142,14 +142,25 @@ public List networkInterfaces() { } /** - * Get the provisioning state of the private link service. Possible values are: 'Updating', 'Succeeded', and 'Failed'. + * Get the provisioning state of the private link service. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. * * @return the provisioningState value */ - public String provisioningState() { + public ProvisioningState provisioningState() { return this.provisioningState; } + /** + * Set the provisioning state of the private link service. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. + * + * @param provisioningState the provisioningState value to set + * @return the PrivateLinkServiceInner object itself. + */ + public PrivateLinkServiceInner withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + /** * Get an array of list about connections to the private endpoint. * @@ -240,7 +251,7 @@ public String alias() { } /** - * Get gets a unique read-only string that changes whenever the resource is updated. + * Get a unique read-only string that changes whenever the resource is updated. * * @return the etag value */ @@ -249,7 +260,7 @@ public String etag() { } /** - * Set gets a unique read-only string that changes whenever the resource is updated. + * Set a unique read-only string that changes whenever the resource is updated. * * @param etag the etag value to set * @return the PrivateLinkServiceInner object itself. diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PublicIPPrefixImpl.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PublicIPPrefixImpl.java index a3cefb967d23..13f787da412e 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PublicIPPrefixImpl.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PublicIPPrefixImpl.java @@ -16,6 +16,7 @@ import java.util.List; import com.microsoft.azure.management.network.v2019_06_01.IpTag; import com.microsoft.azure.management.network.v2019_06_01.ReferencedPublicIpAddress; +import com.microsoft.azure.SubResource; class PublicIPPrefixImpl extends GroupableResourceCoreImpl implements PublicIPPrefix, PublicIPPrefix.Definition, PublicIPPrefix.Update { PublicIPPrefixImpl(String name, PublicIPPrefixInner inner, NetworkManager manager) { @@ -63,6 +64,11 @@ public List ipTags() { return this.inner().ipTags(); } + @Override + public SubResource loadBalancerFrontendIpConfiguration() { + return this.inner().loadBalancerFrontendIpConfiguration(); + } + @Override public Integer prefixLength() { return this.inner().prefixLength(); diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PublicIPPrefixInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PublicIPPrefixInner.java index d6418f70bdfe..3c7c4aac0dd8 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PublicIPPrefixInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/PublicIPPrefixInner.java @@ -13,6 +13,7 @@ import java.util.List; import com.microsoft.azure.management.network.v2019_06_01.IpTag; import com.microsoft.azure.management.network.v2019_06_01.ReferencedPublicIpAddress; +import com.microsoft.azure.SubResource; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.rest.SkipParentValidation; @@ -60,6 +61,13 @@ public class PublicIPPrefixInner extends Resource { @JsonProperty(value = "properties.publicIPAddresses") private List publicIPAddresses; + /** + * The reference to load balancer frontend IP configuration associated with + * the public IP prefix. + */ + @JsonProperty(value = "properties.loadBalancerFrontendIpConfiguration", access = JsonProperty.Access.WRITE_ONLY) + private SubResource loadBalancerFrontendIpConfiguration; + /** * The resource GUID property of the public IP prefix resource. */ @@ -212,6 +220,15 @@ public PublicIPPrefixInner withPublicIPAddresses(List return this; } + /** + * Get the reference to load balancer frontend IP configuration associated with the public IP prefix. + * + * @return the loadBalancerFrontendIpConfiguration value + */ + public SubResource loadBalancerFrontendIpConfiguration() { + return this.loadBalancerFrontendIpConfiguration; + } + /** * Get the resource GUID property of the public IP prefix resource. * diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ServiceTagsInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ServiceTagsInner.java index ac7caf22444b..a501945b13a7 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ServiceTagsInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/ServiceTagsInner.java @@ -60,7 +60,7 @@ interface ServiceTagsService { /** * Gets a list of service tag information resources. * - * @param location The location. + * @param location The location that will be used as a reference for version (not as a filter based on location, you will get the list of service tags with prefix details across all regions but limited to the cloud that your subscription belongs to). * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @@ -73,7 +73,7 @@ public ServiceTagsListResultInner list(String location) { /** * Gets a list of service tag information resources. * - * @param location The location. + * @param location The location that will be used as a reference for version (not as a filter based on location, you will get the list of service tags with prefix details across all regions but limited to the cloud that your subscription belongs to). * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -85,7 +85,7 @@ public ServiceFuture listAsync(String location, fina /** * Gets a list of service tag information resources. * - * @param location The location. + * @param location The location that will be used as a reference for version (not as a filter based on location, you will get the list of service tags with prefix details across all regions but limited to the cloud that your subscription belongs to). * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ServiceTagsListResultInner object */ @@ -101,7 +101,7 @@ public ServiceTagsListResultInner call(ServiceResponse listAsync(final String resourceGroupName, final String virtualNetworkName) { SubnetsInner client = this.inner(); diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/SubnetsInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/SubnetsInner.java index d652fb1fe4d3..842c732d0000 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/SubnetsInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/SubnetsInner.java @@ -14,6 +14,7 @@ import com.microsoft.azure.CloudException; import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.network.v2019_06_01.PrepareNetworkPoliciesRequest; +import com.microsoft.azure.management.network.v2019_06_01.UnprepareNetworkPoliciesRequest; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; @@ -38,8 +39,6 @@ import rx.Observable; import com.microsoft.azure.LongRunningFinalState; import com.microsoft.azure.LongRunningOperationOptions; -import com.microsoft.azure.LongRunningFinalState; -import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined @@ -95,6 +94,14 @@ interface SubnetsService { @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/PrepareNetworkPolicies") Observable> beginPrepareNetworkPolicies(@Path("resourceGroupName") String resourceGroupName, @Path("virtualNetworkName") String virtualNetworkName, @Path("subnetName") String subnetName, @Path("subscriptionId") String subscriptionId, @Body PrepareNetworkPoliciesRequest prepareNetworkPoliciesRequestParameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.Subnets unprepareNetworkPolicies" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/UnprepareNetworkPolicies") + Observable> unprepareNetworkPolicies(@Path("resourceGroupName") String resourceGroupName, @Path("virtualNetworkName") String virtualNetworkName, @Path("subnetName") String subnetName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body UnprepareNetworkPoliciesRequest unprepareNetworkPoliciesRequestParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.Subnets beginUnprepareNetworkPolicies" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/UnprepareNetworkPolicies") + Observable> beginUnprepareNetworkPolicies(@Path("resourceGroupName") String resourceGroupName, @Path("virtualNetworkName") String virtualNetworkName, @Path("subnetName") String subnetName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body UnprepareNetworkPoliciesRequest unprepareNetworkPoliciesRequestParameters, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.v2019_06_01.Subnets list" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets") Observable> list(@Path("resourceGroupName") String resourceGroupName, @Path("virtualNetworkName") String virtualNetworkName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -812,6 +819,343 @@ private ServiceResponse beginPrepareNetworkPoliciesDelegate(Response unprepareNetworkPoliciesAsync(String resourceGroupName, String virtualNetworkName, String subnetName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(unprepareNetworkPoliciesWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName), serviceCallback); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable unprepareNetworkPoliciesAsync(String resourceGroupName, String virtualNetworkName, String subnetName) { + return unprepareNetworkPoliciesWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> unprepareNetworkPoliciesWithServiceResponseAsync(String resourceGroupName, String virtualNetworkName, String subnetName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (virtualNetworkName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null."); + } + if (subnetName == null) { + throw new IllegalArgumentException("Parameter subnetName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + final String serviceName = null; + UnprepareNetworkPoliciesRequest unprepareNetworkPoliciesRequestParameters = new UnprepareNetworkPoliciesRequest(); + unprepareNetworkPoliciesRequestParameters.withServiceName(null); + Observable> observable = service.unprepareNetworkPolicies(resourceGroupName, virtualNetworkName, subnetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), unprepareNetworkPoliciesRequestParameters, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType()); + } + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @param serviceName The name of the service for which subnet is being unprepared for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void unprepareNetworkPolicies(String resourceGroupName, String virtualNetworkName, String subnetName, String serviceName) { + unprepareNetworkPoliciesWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName, serviceName).toBlocking().last().body(); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @param serviceName The name of the service for which subnet is being unprepared for. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture unprepareNetworkPoliciesAsync(String resourceGroupName, String virtualNetworkName, String subnetName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(unprepareNetworkPoliciesWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName, serviceName), serviceCallback); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @param serviceName The name of the service for which subnet is being unprepared for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable unprepareNetworkPoliciesAsync(String resourceGroupName, String virtualNetworkName, String subnetName, String serviceName) { + return unprepareNetworkPoliciesWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName, serviceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @param serviceName The name of the service for which subnet is being unprepared for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> unprepareNetworkPoliciesWithServiceResponseAsync(String resourceGroupName, String virtualNetworkName, String subnetName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (virtualNetworkName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null."); + } + if (subnetName == null) { + throw new IllegalArgumentException("Parameter subnetName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + UnprepareNetworkPoliciesRequest unprepareNetworkPoliciesRequestParameters = new UnprepareNetworkPoliciesRequest(); + unprepareNetworkPoliciesRequestParameters.withServiceName(serviceName); + Observable> observable = service.unprepareNetworkPolicies(resourceGroupName, virtualNetworkName, subnetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), unprepareNetworkPoliciesRequestParameters, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType()); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginUnprepareNetworkPolicies(String resourceGroupName, String virtualNetworkName, String subnetName) { + beginUnprepareNetworkPoliciesWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName).toBlocking().single().body(); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUnprepareNetworkPoliciesAsync(String resourceGroupName, String virtualNetworkName, String subnetName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUnprepareNetworkPoliciesWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName), serviceCallback); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginUnprepareNetworkPoliciesAsync(String resourceGroupName, String virtualNetworkName, String subnetName) { + return beginUnprepareNetworkPoliciesWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginUnprepareNetworkPoliciesWithServiceResponseAsync(String resourceGroupName, String virtualNetworkName, String subnetName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (virtualNetworkName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null."); + } + if (subnetName == null) { + throw new IllegalArgumentException("Parameter subnetName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + final String serviceName = null; + UnprepareNetworkPoliciesRequest unprepareNetworkPoliciesRequestParameters = new UnprepareNetworkPoliciesRequest(); + unprepareNetworkPoliciesRequestParameters.withServiceName(null); + return service.beginUnprepareNetworkPolicies(resourceGroupName, virtualNetworkName, subnetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), unprepareNetworkPoliciesRequestParameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUnprepareNetworkPoliciesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @param serviceName The name of the service for which subnet is being unprepared for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginUnprepareNetworkPolicies(String resourceGroupName, String virtualNetworkName, String subnetName, String serviceName) { + beginUnprepareNetworkPoliciesWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName, serviceName).toBlocking().single().body(); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @param serviceName The name of the service for which subnet is being unprepared for. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUnprepareNetworkPoliciesAsync(String resourceGroupName, String virtualNetworkName, String subnetName, String serviceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUnprepareNetworkPoliciesWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName, serviceName), serviceCallback); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @param serviceName The name of the service for which subnet is being unprepared for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginUnprepareNetworkPoliciesAsync(String resourceGroupName, String virtualNetworkName, String subnetName, String serviceName) { + return beginUnprepareNetworkPoliciesWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName, serviceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Unprepares a subnet by removing network intent policies. + * + * @param resourceGroupName The name of the resource group. + * @param virtualNetworkName The name of the virtual network. + * @param subnetName The name of the subnet. + * @param serviceName The name of the service for which subnet is being unprepared for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginUnprepareNetworkPoliciesWithServiceResponseAsync(String resourceGroupName, String virtualNetworkName, String subnetName, String serviceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (virtualNetworkName == null) { + throw new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null."); + } + if (subnetName == null) { + throw new IllegalArgumentException("Parameter subnetName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-06-01"; + UnprepareNetworkPoliciesRequest unprepareNetworkPoliciesRequestParameters = new UnprepareNetworkPoliciesRequest(); + unprepareNetworkPoliciesRequestParameters.withServiceName(serviceName); + return service.beginUnprepareNetworkPolicies(resourceGroupName, virtualNetworkName, subnetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), unprepareNetworkPoliciesRequestParameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUnprepareNetworkPoliciesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUnprepareNetworkPoliciesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + /** * Gets all subnets in a virtual network. * diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VirtualNetworkGatewayConnectionsInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VirtualNetworkGatewayConnectionsInner.java index 3840a6900f24..0781e91aa089 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VirtualNetworkGatewayConnectionsInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VirtualNetworkGatewayConnectionsInner.java @@ -42,8 +42,6 @@ import rx.Observable; import com.microsoft.azure.LongRunningFinalState; import com.microsoft.azure.LongRunningOperationOptions; -import com.microsoft.azure.LongRunningFinalState; -import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined @@ -842,6 +840,7 @@ public Observable> call(Re private ServiceResponse beginUpdateTagsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VirtualNetworkGatewaysInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VirtualNetworkGatewaysInner.java index 10349caef887..ca319c80d262 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VirtualNetworkGatewaysInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VirtualNetworkGatewaysInner.java @@ -44,8 +44,6 @@ import rx.Observable; import com.microsoft.azure.LongRunningFinalState; import com.microsoft.azure.LongRunningOperationOptions; -import com.microsoft.azure.LongRunningFinalState; -import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined @@ -928,6 +926,7 @@ public Observable> call(Response beginUpdateTagsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) .registerError(CloudException.class) .build(response); } diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VpnGatewaysInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VpnGatewaysInner.java index 27991484fb1a..929a07aed149 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VpnGatewaysInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VpnGatewaysInner.java @@ -44,8 +44,6 @@ import rx.Observable; import com.microsoft.azure.LongRunningFinalState; import com.microsoft.azure.LongRunningOperationOptions; -import com.microsoft.azure.LongRunningFinalState; -import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined diff --git a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VpnSitesConfigurationsInner.java b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VpnSitesConfigurationsInner.java index d9935c0dce8b..0b63491735c9 100644 --- a/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VpnSitesConfigurationsInner.java +++ b/network/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VpnSitesConfigurationsInner.java @@ -29,8 +29,6 @@ import rx.Observable; import com.microsoft.azure.LongRunningFinalState; import com.microsoft.azure.LongRunningOperationOptions; -import com.microsoft.azure.LongRunningFinalState; -import com.microsoft.azure.LongRunningOperationOptions; /** * An instance of this class provides access to all the operations defined diff --git a/parent/pom.xml b/parent/pom.xml index 29eb19b7c990..76f2d8c1eb6b 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -6,7 +6,7 @@ com.azure azure-sdk-parent pom - 1.2.0 + 1.3.0 Microsoft Azure SDK for Java Parent Parent POM for Microsoft Azure SDK for Java @@ -100,20 +100,23 @@ 2.9.9 + 2.9.9.3 1.6.12 1.10 4.0.0-beta3 - 3.1.12 + 3.1.12.2 0.31.0 - 1.2.0 + 1.2.1 2.11.1 - 2.9.3-01 - 2.4.16-03 + 3.4.0-01 + 2.5.8-01 2.1.1 1.7.6 1.7.0 + 3.2.10.RELEASE 0.8.3.RELEASE 4.1.33.Final + 4.1.0 2.5.2 0.20.0 1.2.4 @@ -132,6 +135,7 @@ 1.6 4.2 1.58 + 2.3.1 1.6.3 @@ -143,7 +147,7 @@ 1.3.0 1.3.0 8.0.0 - 1.1-groovy-2.4 + 1.3-groovy-2.5 3.2.7 1.2.0 3.2.3.RELEASE @@ -161,7 +165,7 @@ 1.0.0 3.0.1 2.5.3 - 3.8.0 + 3.8.1 9.3.22.v20171030 1.0.0 2.4.3 @@ -176,8 +180,8 @@ 3.0.0 1.8 3.1.0 - 8.19 - 2.28.2 + 8.24 + 3.0.0 1.7.4 0.8.4 1.2.1 @@ -235,10 +239,11 @@ com.fasterxml.jackson.core jackson-databind - ${jackson.version} + ${jackson-databind.version} + com.fasterxml.jackson.core jackson-annotations ${jackson.version} @@ -331,6 +336,11 @@ ${slf4j-log4j12.version} + + io.projectreactor + reactor-core + ${reactor-core.version} + io.projectreactor.netty reactor-netty @@ -343,6 +353,18 @@ ${netty.version} + + org.nanohttpd + nanohttpd + ${nanohttpd.version} + + + + com.squareup.okhttp3 + okhttp + ${okhttp.version} + + junit junit @@ -433,6 +455,12 @@ ${oauth2-oidc-sdk.version} + + org.codehaus.groovy + groovy-eclipse-compiler + ${groovy-eclipse-compiler.version} + + com.microsoft.azure diff --git a/policy/resource-manager/v2019_06_01/pom.xml b/policy/resource-manager/v2019_06_01/pom.xml new file mode 100644 index 000000000000..09c789ccf8c7 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.policy.v2019_06_01 + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-policy + 1.0.0-beta + jar + Microsoft Azure SDK for Authorization Management + This package contains Microsoft Authorization Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + 1.6.5 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/EnforcementMode.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/EnforcementMode.java new file mode 100644 index 000000000000..1b09d6cb8e18 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/EnforcementMode.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_06_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for EnforcementMode. + */ +public final class EnforcementMode extends ExpandableStringEnum { + /** Static value Default for EnforcementMode. */ + public static final EnforcementMode DEFAULT = fromString("Default"); + + /** Static value DoNotEnforce for EnforcementMode. */ + public static final EnforcementMode DO_NOT_ENFORCE = fromString("DoNotEnforce"); + + /** + * Creates or finds a EnforcementMode from its string representation. + * @param name a name to look for + * @return the corresponding EnforcementMode + */ + @JsonCreator + public static EnforcementMode fromString(String name) { + return fromString(name, EnforcementMode.class); + } + + /** + * @return known EnforcementMode values + */ + public static Collection values() { + return values(EnforcementMode.class); + } +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/ErrorResponse.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/ErrorResponse.java new file mode 100644 index 000000000000..f4d9ca081774 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/ErrorResponse.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates Azure Resource Manager is not able to process the + * incoming request. The reason is provided in the error message. + */ +public class ErrorResponse { + /** + * Http status code. + */ + @JsonProperty(value = "httpStatus") + private String httpStatus; + + /** + * Error code. + */ + @JsonProperty(value = "errorCode") + private String errorCode; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "errorMessage") + private String errorMessage; + + /** + * Get http status code. + * + * @return the httpStatus value + */ + public String httpStatus() { + return this.httpStatus; + } + + /** + * Set http status code. + * + * @param httpStatus the httpStatus value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withHttpStatus(String httpStatus) { + this.httpStatus = httpStatus; + return this; + } + + /** + * Get error code. + * + * @return the errorCode value + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Set error code. + * + * @param errorCode the errorCode value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withErrorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the errorMessage value + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Set error message indicating why the operation failed. + * + * @param errorMessage the errorMessage value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/ErrorResponseException.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/ErrorResponseException.java new file mode 100644 index 000000000000..0a33b7bbad8d --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_06_01; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/Identity.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/Identity.java new file mode 100644 index 000000000000..8ce61ced5fb4 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/Identity.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Identity for the resource. + */ +public class Identity { + /** + * The principal ID of the resource identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /** + * The tenant ID of the resource identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * The identity type. Possible values include: 'SystemAssigned', 'None'. + */ + @JsonProperty(value = "type") + private ResourceIdentityType type; + + /** + * Get the principal ID of the resource identity. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenant ID of the resource identity. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the identity type. Possible values include: 'SystemAssigned', 'None'. + * + * @return the type value + */ + public ResourceIdentityType type() { + return this.type; + } + + /** + * Set the identity type. Possible values include: 'SystemAssigned', 'None'. + * + * @param type the type value to set + * @return the Identity object itself. + */ + public Identity withType(ResourceIdentityType type) { + this.type = type; + return this; + } + +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicyAssignment.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicyAssignment.java new file mode 100644 index 000000000000..288048c43a42 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicyAssignment.java @@ -0,0 +1,407 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_06_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.policy.v2019_06_01.implementation.PolicyAssignmentInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.policy.v2019_06_01.implementation.PolicyManager; +import java.util.List; + +/** + * Type representing PolicyAssignment. + */ +public interface PolicyAssignment extends HasInner, Indexable, Updatable, Refreshable, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the enforcementMode value. + */ + EnforcementMode enforcementMode(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the identity value. + */ + Identity identity(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the metadata value. + */ + Object metadata(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the notScopes value. + */ + List notScopes(); + + /** + * @return the parameters value. + */ + Object parameters(); + + /** + * @return the policyDefinitionId value. + */ + String policyDefinitionId(); + + /** + * @return the scopeProperty value. + */ + String scopeProperty(); + + /** + * @return the sku value. + */ + PolicySku sku(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the PolicyAssignment definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + + /** + * Grouping of PolicyAssignment definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a PolicyAssignment definition. + */ + interface Blank extends WithScope { + } + + /** + * The stage of the policyassignment definition allowing to specify Scope. + */ + interface WithScope { + /** + * Specifies scope. + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @return the next definition stage + */ + WithCreate withScope(String scope); + } + + /** + * The stage of the policyassignment definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description This message will be part of response in case of policy violation + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the policyassignment definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The display name of the policy assignment + * @return the next definition stage + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the policyassignment definition allowing to specify EnforcementMode. + */ + interface WithEnforcementMode { + /** + * Specifies enforcementMode. + * @param enforcementMode The policy assignment enforcement mode. Possible values are Default and DoNotEnforce. Possible values include: 'Default', 'DoNotEnforce' + * @return the next definition stage + */ + WithCreate withEnforcementMode(EnforcementMode enforcementMode); + } + + /** + * The stage of the policyassignment definition allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + * @param identity The managed identity associated with the policy assignment + * @return the next definition stage + */ + WithCreate withIdentity(Identity identity); + } + + /** + * The stage of the policyassignment definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the policy assignment. Only required when utilizing managed identity + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the policyassignment definition allowing to specify Metadata. + */ + interface WithMetadata { + /** + * Specifies metadata. + * @param metadata The policy assignment metadata + * @return the next definition stage + */ + WithCreate withMetadata(Object metadata); + } + + /** + * The stage of the policyassignment definition allowing to specify NotScopes. + */ + interface WithNotScopes { + /** + * Specifies notScopes. + * @param notScopes The policy's excluded scopes + * @return the next definition stage + */ + WithCreate withNotScopes(List notScopes); + } + + /** + * The stage of the policyassignment definition allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters Required if a parameter is used in policy rule + * @return the next definition stage + */ + WithCreate withParameters(Object parameters); + } + + /** + * The stage of the policyassignment definition allowing to specify PolicyDefinitionId. + */ + interface WithPolicyDefinitionId { + /** + * Specifies policyDefinitionId. + * @param policyDefinitionId The ID of the policy definition or policy set definition being assigned + * @return the next definition stage + */ + WithCreate withPolicyDefinitionId(String policyDefinitionId); + } + + /** + * The stage of the policyassignment definition allowing to specify ScopeProperty. + */ + interface WithScopeProperty { + /** + * Specifies scopeProperty. + * @param scopeProperty The scope for the policy assignment + * @return the next definition stage + */ + WithCreate withScopeProperty(String scopeProperty); + } + + /** + * The stage of the policyassignment definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The policy sku. This property is optional, obsolete, and will be ignored + * @return the next definition stage + */ + WithCreate withSku(PolicySku sku); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithDescription, DefinitionStages.WithDisplayName, DefinitionStages.WithEnforcementMode, DefinitionStages.WithIdentity, DefinitionStages.WithLocation, DefinitionStages.WithMetadata, DefinitionStages.WithNotScopes, DefinitionStages.WithParameters, DefinitionStages.WithPolicyDefinitionId, DefinitionStages.WithScopeProperty, DefinitionStages.WithSku { + } + } + /** + * The template for a PolicyAssignment update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDescription, UpdateStages.WithDisplayName, UpdateStages.WithEnforcementMode, UpdateStages.WithIdentity, UpdateStages.WithLocation, UpdateStages.WithMetadata, UpdateStages.WithNotScopes, UpdateStages.WithParameters, UpdateStages.WithPolicyDefinitionId, UpdateStages.WithScopeProperty, UpdateStages.WithSku { + } + + /** + * Grouping of PolicyAssignment update stages. + */ + interface UpdateStages { + /** + * The stage of the policyassignment update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description This message will be part of response in case of policy violation + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the policyassignment update allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The display name of the policy assignment + * @return the next update stage + */ + Update withDisplayName(String displayName); + } + + /** + * The stage of the policyassignment update allowing to specify EnforcementMode. + */ + interface WithEnforcementMode { + /** + * Specifies enforcementMode. + * @param enforcementMode The policy assignment enforcement mode. Possible values are Default and DoNotEnforce. Possible values include: 'Default', 'DoNotEnforce' + * @return the next update stage + */ + Update withEnforcementMode(EnforcementMode enforcementMode); + } + + /** + * The stage of the policyassignment update allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + * @param identity The managed identity associated with the policy assignment + * @return the next update stage + */ + Update withIdentity(Identity identity); + } + + /** + * The stage of the policyassignment update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the policy assignment. Only required when utilizing managed identity + * @return the next update stage + */ + Update withLocation(String location); + } + + /** + * The stage of the policyassignment update allowing to specify Metadata. + */ + interface WithMetadata { + /** + * Specifies metadata. + * @param metadata The policy assignment metadata + * @return the next update stage + */ + Update withMetadata(Object metadata); + } + + /** + * The stage of the policyassignment update allowing to specify NotScopes. + */ + interface WithNotScopes { + /** + * Specifies notScopes. + * @param notScopes The policy's excluded scopes + * @return the next update stage + */ + Update withNotScopes(List notScopes); + } + + /** + * The stage of the policyassignment update allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters Required if a parameter is used in policy rule + * @return the next update stage + */ + Update withParameters(Object parameters); + } + + /** + * The stage of the policyassignment update allowing to specify PolicyDefinitionId. + */ + interface WithPolicyDefinitionId { + /** + * Specifies policyDefinitionId. + * @param policyDefinitionId The ID of the policy definition or policy set definition being assigned + * @return the next update stage + */ + Update withPolicyDefinitionId(String policyDefinitionId); + } + + /** + * The stage of the policyassignment update allowing to specify ScopeProperty. + */ + interface WithScopeProperty { + /** + * Specifies scopeProperty. + * @param scopeProperty The scope for the policy assignment + * @return the next update stage + */ + Update withScopeProperty(String scopeProperty); + } + + /** + * The stage of the policyassignment update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The policy sku. This property is optional, obsolete, and will be ignored + * @return the next update stage + */ + Update withSku(PolicySku sku); + } + + } +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicyAssignments.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicyAssignments.java new file mode 100644 index 000000000000..953d573da552 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicyAssignments.java @@ -0,0 +1,91 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_06_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.policy.v2019_06_01.implementation.PolicyAssignmentInner; +import com.microsoft.azure.management.policy.v2019_06_01.implementation.PolicyAssignmentsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PolicyAssignments. + */ +public interface PolicyAssignments extends SupportsCreating, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Deletes a policy assignment. + * This operation deletes a policy assignment, given its name and the scope it was created in. The scope of a policy assignment is the part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteAsync(String scope, String policyAssignmentName); + + /** + * Retrieves a policy assignment. + * This operation retrieves a single policy assignment, given its name and the scope it was created at. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String scope, String policyAssignmentName); + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName); + + /** + * Deletes a policy assignment. + * This operation deletes the policy with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' (management group), '/subscriptions/{subscriptionId}' (subscription), '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource group), or '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' (resource). + * + * @param policyAssignmentId The ID of the policy assignment to delete. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteByIdAsync(String policyAssignmentId); + + /** + * Creates or updates a policy assignment. + * This operation creates or updates the policy assignment with the given ID. Policy assignments made on a scope apply to all resources contained in that scope. For example, when you assign a policy to a resource group that policy applies to all resources in the group. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @param parameters Parameters for policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createByIdAsync(String policyAssignmentId, PolicyAssignmentInner parameters); + + /** + * Retrieves the policy assignment with the given ID. + * The operation retrieves the policy assignment with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to get. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByIdAsync(String policyAssignmentId); + +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicyDefinition.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicyDefinition.java new file mode 100644 index 000000000000..600048c6bd04 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicyDefinition.java @@ -0,0 +1,278 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_06_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.policy.v2019_06_01.implementation.PolicyDefinitionInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.policy.v2019_06_01.implementation.PolicyManager; + +/** + * Type representing PolicyDefinition. + */ +public interface PolicyDefinition extends HasInner, Indexable, Updatable, Refreshable, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the metadata value. + */ + Object metadata(); + + /** + * @return the mode value. + */ + String mode(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the parameters value. + */ + Object parameters(); + + /** + * @return the policyRule value. + */ + Object policyRule(); + + /** + * @return the policyType value. + */ + PolicyType policyType(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the PolicyDefinition definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { + } + + /** + * Grouping of PolicyDefinition definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a PolicyDefinition definition. + */ + interface Blank extends WithCreate { + } + + /** + * The stage of the policydefinition definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description The policy definition description + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the policydefinition definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The display name of the policy definition + * @return the next definition stage + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the policydefinition definition allowing to specify Metadata. + */ + interface WithMetadata { + /** + * Specifies metadata. + * @param metadata The policy definition metadata + * @return the next definition stage + */ + WithCreate withMetadata(Object metadata); + } + + /** + * The stage of the policydefinition definition allowing to specify Mode. + */ + interface WithMode { + /** + * Specifies mode. + * @param mode The policy definition mode. Some examples are All, Indexed, Microsoft.KeyVault.Data + * @return the next definition stage + */ + WithCreate withMode(String mode); + } + + /** + * The stage of the policydefinition definition allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters Required if a parameter is used in policy rule + * @return the next definition stage + */ + WithCreate withParameters(Object parameters); + } + + /** + * The stage of the policydefinition definition allowing to specify PolicyRule. + */ + interface WithPolicyRule { + /** + * Specifies policyRule. + * @param policyRule The policy rule + * @return the next definition stage + */ + WithCreate withPolicyRule(Object policyRule); + } + + /** + * The stage of the policydefinition definition allowing to specify PolicyType. + */ + interface WithPolicyType { + /** + * Specifies policyType. + * @param policyType The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom' + * @return the next definition stage + */ + WithCreate withPolicyType(PolicyType policyType); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithDescription, DefinitionStages.WithDisplayName, DefinitionStages.WithMetadata, DefinitionStages.WithMode, DefinitionStages.WithParameters, DefinitionStages.WithPolicyRule, DefinitionStages.WithPolicyType { + } + } + /** + * The template for a PolicyDefinition update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDescription, UpdateStages.WithDisplayName, UpdateStages.WithMetadata, UpdateStages.WithMode, UpdateStages.WithParameters, UpdateStages.WithPolicyRule, UpdateStages.WithPolicyType { + } + + /** + * Grouping of PolicyDefinition update stages. + */ + interface UpdateStages { + /** + * The stage of the policydefinition update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description The policy definition description + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the policydefinition update allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The display name of the policy definition + * @return the next update stage + */ + Update withDisplayName(String displayName); + } + + /** + * The stage of the policydefinition update allowing to specify Metadata. + */ + interface WithMetadata { + /** + * Specifies metadata. + * @param metadata The policy definition metadata + * @return the next update stage + */ + Update withMetadata(Object metadata); + } + + /** + * The stage of the policydefinition update allowing to specify Mode. + */ + interface WithMode { + /** + * Specifies mode. + * @param mode The policy definition mode. Some examples are All, Indexed, Microsoft.KeyVault.Data + * @return the next update stage + */ + Update withMode(String mode); + } + + /** + * The stage of the policydefinition update allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters Required if a parameter is used in policy rule + * @return the next update stage + */ + Update withParameters(Object parameters); + } + + /** + * The stage of the policydefinition update allowing to specify PolicyRule. + */ + interface WithPolicyRule { + /** + * Specifies policyRule. + * @param policyRule The policy rule + * @return the next update stage + */ + Update withPolicyRule(Object policyRule); + } + + /** + * The stage of the policydefinition update allowing to specify PolicyType. + */ + interface WithPolicyType { + /** + * Specifies policyType. + * @param policyType The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom' + * @return the next update stage + */ + Update withPolicyType(PolicyType policyType); + } + + } +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicyDefinitionReference.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicyDefinitionReference.java new file mode 100644 index 000000000000..b410fbe40127 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicyDefinitionReference.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The policy definition reference. + */ +public class PolicyDefinitionReference { + /** + * The ID of the policy definition or policy set definition. + */ + @JsonProperty(value = "policyDefinitionId") + private String policyDefinitionId; + + /** + * Required if a parameter is used in policy rule. + */ + @JsonProperty(value = "parameters") + private Object parameters; + + /** + * Get the ID of the policy definition or policy set definition. + * + * @return the policyDefinitionId value + */ + public String policyDefinitionId() { + return this.policyDefinitionId; + } + + /** + * Set the ID of the policy definition or policy set definition. + * + * @param policyDefinitionId the policyDefinitionId value to set + * @return the PolicyDefinitionReference object itself. + */ + public PolicyDefinitionReference withPolicyDefinitionId(String policyDefinitionId) { + this.policyDefinitionId = policyDefinitionId; + return this; + } + + /** + * Get required if a parameter is used in policy rule. + * + * @return the parameters value + */ + public Object parameters() { + return this.parameters; + } + + /** + * Set required if a parameter is used in policy rule. + * + * @param parameters the parameters value to set + * @return the PolicyDefinitionReference object itself. + */ + public PolicyDefinitionReference withParameters(Object parameters) { + this.parameters = parameters; + return this; + } + +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicyDefinitions.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicyDefinitions.java new file mode 100644 index 000000000000..3a3f8d12b162 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicyDefinitions.java @@ -0,0 +1,106 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_06_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.policy.v2019_06_01.implementation.PolicyDefinitionInner; +import com.microsoft.azure.management.policy.v2019_06_01.implementation.PolicyDefinitionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PolicyDefinitions. + */ +public interface PolicyDefinitions extends SupportsCreating, SupportsListing, HasInner { + /** + * Deletes a policy definition in a subscription. + * This operation deletes the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String policyDefinitionName); + + /** + * Retrieves a policy definition in a subscription. + * This operation retrieves the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String policyDefinitionName); + + /** + * Retrieves a built-in policy definition. + * This operation retrieves the built-in policy definition with the given name. + * + * @param policyDefinitionName The name of the built-in policy definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getBuiltInAsync(String policyDefinitionName); + + /** + * Creates or updates a policy definition in a management group. + * This operation creates or updates a policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAtManagementGroupAsync(String policyDefinitionName, String managementGroupId, PolicyDefinitionInner parameters); + + /** + * Deletes a policy definition in a management group. + * This operation deletes the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAtManagementGroupAsync(String policyDefinitionName, String managementGroupId); + + /** + * Retrieve a policy definition in a management group. + * This operation retrieves the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAtManagementGroupAsync(String policyDefinitionName, String managementGroupId); + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByManagementGroupAsync(final String managementGroupId); + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listBuiltInAsync(); + +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicySetDefinition.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicySetDefinition.java new file mode 100644 index 000000000000..76b9873aed38 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicySetDefinition.java @@ -0,0 +1,238 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_06_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.policy.v2019_06_01.implementation.PolicySetDefinitionInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.policy.v2019_06_01.implementation.PolicyManager; +import java.util.List; + +/** + * Type representing PolicySetDefinition. + */ +public interface PolicySetDefinition extends HasInner, Indexable, Updatable, Refreshable, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the metadata value. + */ + Object metadata(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the parameters value. + */ + Object parameters(); + + /** + * @return the policyDefinitions value. + */ + List policyDefinitions(); + + /** + * @return the policyType value. + */ + PolicyType policyType(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the PolicySetDefinition definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithPolicyDefinitions, DefinitionStages.WithCreate { + } + + /** + * Grouping of PolicySetDefinition definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a PolicySetDefinition definition. + */ + interface Blank extends WithPolicyDefinitions { + } + + /** + * The stage of the policysetdefinition definition allowing to specify PolicyDefinitions. + */ + interface WithPolicyDefinitions { + /** + * Specifies policyDefinitions. + * @param policyDefinitions An array of policy definition references + * @return the next definition stage + */ + WithCreate withPolicyDefinitions(List policyDefinitions); + } + + /** + * The stage of the policysetdefinition definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description The policy set definition description + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the policysetdefinition definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The display name of the policy set definition + * @return the next definition stage + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the policysetdefinition definition allowing to specify Metadata. + */ + interface WithMetadata { + /** + * Specifies metadata. + * @param metadata The policy set definition metadata + * @return the next definition stage + */ + WithCreate withMetadata(Object metadata); + } + + /** + * The stage of the policysetdefinition definition allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters The policy set definition parameters that can be used in policy definition references + * @return the next definition stage + */ + WithCreate withParameters(Object parameters); + } + + /** + * The stage of the policysetdefinition definition allowing to specify PolicyType. + */ + interface WithPolicyType { + /** + * Specifies policyType. + * @param policyType The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom' + * @return the next definition stage + */ + WithCreate withPolicyType(PolicyType policyType); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithDescription, DefinitionStages.WithDisplayName, DefinitionStages.WithMetadata, DefinitionStages.WithParameters, DefinitionStages.WithPolicyType { + } + } + /** + * The template for a PolicySetDefinition update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDescription, UpdateStages.WithDisplayName, UpdateStages.WithMetadata, UpdateStages.WithParameters, UpdateStages.WithPolicyType { + } + + /** + * Grouping of PolicySetDefinition update stages. + */ + interface UpdateStages { + /** + * The stage of the policysetdefinition update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description The policy set definition description + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the policysetdefinition update allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The display name of the policy set definition + * @return the next update stage + */ + Update withDisplayName(String displayName); + } + + /** + * The stage of the policysetdefinition update allowing to specify Metadata. + */ + interface WithMetadata { + /** + * Specifies metadata. + * @param metadata The policy set definition metadata + * @return the next update stage + */ + Update withMetadata(Object metadata); + } + + /** + * The stage of the policysetdefinition update allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters The policy set definition parameters that can be used in policy definition references + * @return the next update stage + */ + Update withParameters(Object parameters); + } + + /** + * The stage of the policysetdefinition update allowing to specify PolicyType. + */ + interface WithPolicyType { + /** + * Specifies policyType. + * @param policyType The type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom' + * @return the next update stage + */ + Update withPolicyType(PolicyType policyType); + } + + } +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicySetDefinitions.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicySetDefinitions.java new file mode 100644 index 000000000000..7b4e9be284b4 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicySetDefinitions.java @@ -0,0 +1,106 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_06_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.policy.v2019_06_01.implementation.PolicySetDefinitionInner; +import com.microsoft.azure.management.policy.v2019_06_01.implementation.PolicySetDefinitionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PolicySetDefinitions. + */ +public interface PolicySetDefinitions extends SupportsCreating, SupportsListing, HasInner { + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String policySetDefinitionName); + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String policySetDefinitionName); + + /** + * Retrieves a built in policy set definition. + * This operation retrieves the built-in policy set definition with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getBuiltInAsync(String policySetDefinitionName); + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy set definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId, PolicySetDefinitionInner parameters); + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId); + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId); + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByManagementGroupAsync(final String managementGroupId); + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listBuiltInAsync(); + +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicySku.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicySku.java new file mode 100644 index 000000000000..6e32d7f8d62a --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicySku.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The policy sku. This property is optional, obsolete, and will be ignored. + */ +public class PolicySku { + /** + * The name of the policy sku. Possible values are A0 and A1. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The policy sku tier. Possible values are Free and Standard. + */ + @JsonProperty(value = "tier") + private String tier; + + /** + * Get the name of the policy sku. Possible values are A0 and A1. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the policy sku. Possible values are A0 and A1. + * + * @param name the name value to set + * @return the PolicySku object itself. + */ + public PolicySku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the policy sku tier. Possible values are Free and Standard. + * + * @return the tier value + */ + public String tier() { + return this.tier; + } + + /** + * Set the policy sku tier. Possible values are Free and Standard. + * + * @param tier the tier value to set + * @return the PolicySku object itself. + */ + public PolicySku withTier(String tier) { + this.tier = tier; + return this; + } + +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicyType.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicyType.java new file mode 100644 index 000000000000..04323e195aa5 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/PolicyType.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_06_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PolicyType. + */ +public final class PolicyType extends ExpandableStringEnum { + /** Static value NotSpecified for PolicyType. */ + public static final PolicyType NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value BuiltIn for PolicyType. */ + public static final PolicyType BUILT_IN = fromString("BuiltIn"); + + /** Static value Custom for PolicyType. */ + public static final PolicyType CUSTOM = fromString("Custom"); + + /** + * Creates or finds a PolicyType from its string representation. + * @param name a name to look for + * @return the corresponding PolicyType + */ + @JsonCreator + public static PolicyType fromString(String name) { + return fromString(name, PolicyType.class); + } + + /** + * @return known PolicyType values + */ + public static Collection values() { + return values(PolicyType.class); + } +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/ResourceIdentityType.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/ResourceIdentityType.java new file mode 100644 index 000000000000..97e693a50301 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/ResourceIdentityType.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ResourceIdentityType. + */ +public enum ResourceIdentityType { + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"), + + /** Enum value None. */ + NONE("None"); + + /** The actual serialized value for a ResourceIdentityType instance. */ + private String value; + + ResourceIdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceIdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceIdentityType object, or null if unable to parse. + */ + @JsonCreator + public static ResourceIdentityType fromString(String value) { + ResourceIdentityType[] items = ResourceIdentityType.values(); + for (ResourceIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/IdParsingUtils.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..205c08f22ffd --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_06_01.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PageImpl.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PageImpl.java new file mode 100644 index 000000000000..6fe3ec9216a9 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_06_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyAssignmentImpl.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyAssignmentImpl.java new file mode 100644 index 000000000000..fcd6a6b7a5c2 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyAssignmentImpl.java @@ -0,0 +1,217 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.policy.v2019_06_01.implementation; + +import com.microsoft.azure.management.policy.v2019_06_01.PolicyAssignment; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.policy.v2019_06_01.EnforcementMode; +import com.microsoft.azure.management.policy.v2019_06_01.PolicySku; +import com.microsoft.azure.management.policy.v2019_06_01.Identity; + +class PolicyAssignmentImpl extends CreatableUpdatableImpl implements PolicyAssignment, PolicyAssignment.Definition, PolicyAssignment.Update { + private String scope; + private String policyAssignmentName; + private final PolicyManager manager; + + PolicyAssignmentImpl(String name, PolicyManager manager) { + super(name, new PolicyAssignmentInner()); + this.manager = manager; + // Set resource name + this.policyAssignmentName = name; + // + } + + PolicyAssignmentImpl(PolicyAssignmentInner inner, PolicyManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.policyAssignmentName = inner.name(); + // set resource ancestor and positional variables + this.policyAssignmentName = IdParsingUtils.getValueFromIdByName(inner.id(), "policyAssignments"); + this.scope = IdParsingUtils.getValueFromIdByPosition(inner.id(), 0); + // set other parameters for create and update + } + + @Override + public PolicyManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + PolicyAssignmentsInner client = this.manager().inner().policyAssignments(); + return client.createAsync(this.scope, this.policyAssignmentName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + PolicyAssignmentsInner client = this.manager().inner().policyAssignments(); + return client.createAsync(this.scope, this.policyAssignmentName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + PolicyAssignmentsInner client = this.manager().inner().policyAssignments(); + return client.getAsync(this.scope, this.policyAssignmentName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public EnforcementMode enforcementMode() { + return this.inner().enforcementMode(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Identity identity() { + return this.inner().identity(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public Object metadata() { + return this.inner().metadata(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List notScopes() { + return this.inner().notScopes(); + } + + @Override + public Object parameters() { + return this.inner().parameters(); + } + + @Override + public String policyDefinitionId() { + return this.inner().policyDefinitionId(); + } + + @Override + public String scopeProperty() { + return this.inner().scopeProperty(); + } + + @Override + public PolicySku sku() { + return this.inner().sku(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public PolicyAssignmentImpl withScope(String scope) { + this.scope = scope; + return this; + } + + @Override + public PolicyAssignmentImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public PolicyAssignmentImpl withDisplayName(String displayName) { + this.inner().withDisplayName(displayName); + return this; + } + + @Override + public PolicyAssignmentImpl withEnforcementMode(EnforcementMode enforcementMode) { + this.inner().withEnforcementMode(enforcementMode); + return this; + } + + @Override + public PolicyAssignmentImpl withIdentity(Identity identity) { + this.inner().withIdentity(identity); + return this; + } + + @Override + public PolicyAssignmentImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public PolicyAssignmentImpl withMetadata(Object metadata) { + this.inner().withMetadata(metadata); + return this; + } + + @Override + public PolicyAssignmentImpl withNotScopes(List notScopes) { + this.inner().withNotScopes(notScopes); + return this; + } + + @Override + public PolicyAssignmentImpl withParameters(Object parameters) { + this.inner().withParameters(parameters); + return this; + } + + @Override + public PolicyAssignmentImpl withPolicyDefinitionId(String policyDefinitionId) { + this.inner().withPolicyDefinitionId(policyDefinitionId); + return this; + } + + @Override + public PolicyAssignmentImpl withScopeProperty(String scopeProperty) { + this.inner().withScopeProperty(scopeProperty); + return this; + } + + @Override + public PolicyAssignmentImpl withSku(PolicySku sku) { + this.inner().withSku(sku); + return this; + } + +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyAssignmentInner.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyAssignmentInner.java new file mode 100644 index 000000000000..f86d0b80041d --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyAssignmentInner.java @@ -0,0 +1,313 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_06_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.policy.v2019_06_01.EnforcementMode; +import com.microsoft.azure.management.policy.v2019_06_01.PolicySku; +import com.microsoft.azure.management.policy.v2019_06_01.Identity; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The policy assignment. + */ +@JsonFlatten +public class PolicyAssignmentInner extends ProxyResource { + /** + * The display name of the policy assignment. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * The ID of the policy definition or policy set definition being assigned. + */ + @JsonProperty(value = "properties.policyDefinitionId") + private String policyDefinitionId; + + /** + * The scope for the policy assignment. + */ + @JsonProperty(value = "properties.scope") + private String scopeProperty; + + /** + * The policy's excluded scopes. + */ + @JsonProperty(value = "properties.notScopes") + private List notScopes; + + /** + * Required if a parameter is used in policy rule. + */ + @JsonProperty(value = "properties.parameters") + private Object parameters; + + /** + * This message will be part of response in case of policy violation. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The policy assignment metadata. + */ + @JsonProperty(value = "properties.metadata") + private Object metadata; + + /** + * The policy assignment enforcement mode. Possible values are Default and + * DoNotEnforce. Possible values include: 'Default', 'DoNotEnforce'. + */ + @JsonProperty(value = "properties.enforcementMode") + private EnforcementMode enforcementMode; + + /** + * The policy sku. This property is optional, obsolete, and will be + * ignored. + */ + @JsonProperty(value = "sku") + private PolicySku sku; + + /** + * The location of the policy assignment. Only required when utilizing + * managed identity. + */ + @JsonProperty(value = "location") + private String location; + + /** + * The managed identity associated with the policy assignment. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /** + * Get the display name of the policy assignment. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name of the policy assignment. + * + * @param displayName the displayName value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the ID of the policy definition or policy set definition being assigned. + * + * @return the policyDefinitionId value + */ + public String policyDefinitionId() { + return this.policyDefinitionId; + } + + /** + * Set the ID of the policy definition or policy set definition being assigned. + * + * @param policyDefinitionId the policyDefinitionId value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withPolicyDefinitionId(String policyDefinitionId) { + this.policyDefinitionId = policyDefinitionId; + return this; + } + + /** + * Get the scope for the policy assignment. + * + * @return the scopeProperty value + */ + public String scopeProperty() { + return this.scopeProperty; + } + + /** + * Set the scope for the policy assignment. + * + * @param scopeProperty the scopeProperty value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withScopeProperty(String scopeProperty) { + this.scopeProperty = scopeProperty; + return this; + } + + /** + * Get the policy's excluded scopes. + * + * @return the notScopes value + */ + public List notScopes() { + return this.notScopes; + } + + /** + * Set the policy's excluded scopes. + * + * @param notScopes the notScopes value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withNotScopes(List notScopes) { + this.notScopes = notScopes; + return this; + } + + /** + * Get required if a parameter is used in policy rule. + * + * @return the parameters value + */ + public Object parameters() { + return this.parameters; + } + + /** + * Set required if a parameter is used in policy rule. + * + * @param parameters the parameters value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withParameters(Object parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get this message will be part of response in case of policy violation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set this message will be part of response in case of policy violation. + * + * @param description the description value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the policy assignment metadata. + * + * @return the metadata value + */ + public Object metadata() { + return this.metadata; + } + + /** + * Set the policy assignment metadata. + * + * @param metadata the metadata value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withMetadata(Object metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the policy assignment enforcement mode. Possible values are Default and DoNotEnforce. Possible values include: 'Default', 'DoNotEnforce'. + * + * @return the enforcementMode value + */ + public EnforcementMode enforcementMode() { + return this.enforcementMode; + } + + /** + * Set the policy assignment enforcement mode. Possible values are Default and DoNotEnforce. Possible values include: 'Default', 'DoNotEnforce'. + * + * @param enforcementMode the enforcementMode value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withEnforcementMode(EnforcementMode enforcementMode) { + this.enforcementMode = enforcementMode; + return this; + } + + /** + * Get the policy sku. This property is optional, obsolete, and will be ignored. + * + * @return the sku value + */ + public PolicySku sku() { + return this.sku; + } + + /** + * Set the policy sku. This property is optional, obsolete, and will be ignored. + * + * @param sku the sku value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withSku(PolicySku sku) { + this.sku = sku; + return this; + } + + /** + * Get the location of the policy assignment. Only required when utilizing managed identity. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location of the policy assignment. Only required when utilizing managed identity. + * + * @param location the location value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the managed identity associated with the policy assignment. + * + * @return the identity value + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the managed identity associated with the policy assignment. + * + * @param identity the identity value to set + * @return the PolicyAssignmentInner object itself. + */ + public PolicyAssignmentInner withIdentity(Identity identity) { + this.identity = identity; + return this; + } + +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyAssignmentsImpl.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyAssignmentsImpl.java new file mode 100644 index 000000000000..5a2d699adff6 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyAssignmentsImpl.java @@ -0,0 +1,179 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * jkl + */ + +package com.microsoft.azure.management.policy.v2019_06_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.policy.v2019_06_01.PolicyAssignments; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.policy.v2019_06_01.PolicyAssignment; +import com.microsoft.azure.arm.utils.PagedListConverter; + +class PolicyAssignmentsImpl extends WrapperImpl implements PolicyAssignments { + private PagedListConverter converter; + private final PolicyManager manager; + + PolicyAssignmentsImpl(PolicyManager manager) { + super(manager.inner().policyAssignments()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(PolicyAssignmentInner inner) { + return Observable.just((PolicyAssignment) wrapModel(inner)); + } + }; + } + + public PolicyManager manager() { + return this.manager; + } + + @Override + public PolicyAssignmentImpl define(String name) { + return wrapModel(name); + } + + private PolicyAssignmentImpl wrapModel(PolicyAssignmentInner inner) { + return new PolicyAssignmentImpl(inner, manager()); + } + + private PolicyAssignmentImpl wrapModel(String name) { + return new PolicyAssignmentImpl(name, this.manager()); + } + + @Override + public Observable deleteAsync(String scope, String policyAssignmentName) { + PolicyAssignmentsInner client = this.inner(); + return client.deleteAsync(scope, policyAssignmentName) + .map(new Func1() { + @Override + public PolicyAssignment call(PolicyAssignmentInner inner) { + return new PolicyAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String scope, String policyAssignmentName) { + PolicyAssignmentsInner client = this.inner(); + return client.getAsync(scope, policyAssignmentName) + .map(new Func1() { + @Override + public PolicyAssignment call(PolicyAssignmentInner inner) { + return new PolicyAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) { + PolicyAssignmentsInner client = this.inner(); + return client.listForResourceAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyAssignment call(PolicyAssignmentInner inner) { + return new PolicyAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable deleteByIdAsync(String policyAssignmentId) { + PolicyAssignmentsInner client = this.inner(); + return client.deleteByIdAsync(policyAssignmentId) + .map(new Func1() { + @Override + public PolicyAssignment call(PolicyAssignmentInner inner) { + return new PolicyAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable createByIdAsync(String policyAssignmentId, PolicyAssignmentInner parameters) { + PolicyAssignmentsInner client = this.inner(); + return client.createByIdAsync(policyAssignmentId, parameters) + .map(new Func1() { + @Override + public PolicyAssignment call(PolicyAssignmentInner inner) { + return new PolicyAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByIdAsync(String policyAssignmentId) { + PolicyAssignmentsInner client = this.inner(); + return client.getByIdAsync(policyAssignmentId) + .map(new Func1() { + @Override + public PolicyAssignment call(PolicyAssignmentInner inner) { + return new PolicyAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public PagedList list() { + PolicyAssignmentsInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + PolicyAssignmentsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyAssignment call(PolicyAssignmentInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + PolicyAssignmentsInner client = this.inner(); + return converter.convert(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + PolicyAssignmentsInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyAssignment call(PolicyAssignmentInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyAssignmentsInner.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyAssignmentsInner.java new file mode 100644 index 000000000000..53f4904b2532 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyAssignmentsInner.java @@ -0,0 +1,1748 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_06_01.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.policy.v2019_06_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PolicyAssignments. + */ +public class PolicyAssignmentsInner implements InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private PolicyAssignmentsService service; + /** The service client containing this operation class. */ + private PolicyClientImpl client; + + /** + * Initializes an instance of PolicyAssignmentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PolicyAssignmentsInner(Retrofit retrofit, PolicyClientImpl client) { + this.service = retrofit.create(PolicyAssignmentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PolicyAssignments to be + * used by Retrofit to perform actually REST calls. + */ + interface PolicyAssignmentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyAssignments delete" }) + @HTTP(path = "{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}", method = "DELETE", hasBody = true) + Observable> delete(@Path(value = "scope", encoded = true) String scope, @Path("policyAssignmentName") String policyAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyAssignments create" }) + @PUT("{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}") + Observable> create(@Path(value = "scope", encoded = true) String scope, @Path("policyAssignmentName") String policyAssignmentName, @Body PolicyAssignmentInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyAssignments get" }) + @GET("{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}") + Observable> get(@Path(value = "scope", encoded = true) String scope, @Path("policyAssignmentName") String policyAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyAssignments listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query(value = "$filter", encoded = true) String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyAssignments listForResource" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments") + Observable> listForResource(@Path("resourceGroupName") String resourceGroupName, @Path("resourceProviderNamespace") String resourceProviderNamespace, @Path(value = "parentResourcePath", encoded = true) String parentResourcePath, @Path(value = "resourceType", encoded = true) String resourceType, @Path("resourceName") String resourceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyAssignments list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyAssignments deleteById" }) + @HTTP(path = "{policyAssignmentId}", method = "DELETE", hasBody = true) + Observable> deleteById(@Path(value = "policyAssignmentId", encoded = true) String policyAssignmentId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyAssignments createById" }) + @PUT("{policyAssignmentId}") + Observable> createById(@Path(value = "policyAssignmentId", encoded = true) String policyAssignmentId, @Body PolicyAssignmentInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyAssignments getById" }) + @GET("{policyAssignmentId}") + Observable> getById(@Path(value = "policyAssignmentId", encoded = true) String policyAssignmentId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyAssignments listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyAssignments listForResourceNext" }) + @GET + Observable> listForResourceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyAssignments listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Deletes a policy assignment. + * This operation deletes a policy assignment, given its name and the scope it was created in. The scope of a policy assignment is the part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyAssignmentInner object if successful. + */ + public PolicyAssignmentInner delete(String scope, String policyAssignmentName) { + return deleteWithServiceResponseAsync(scope, policyAssignmentName).toBlocking().single().body(); + } + + /** + * Deletes a policy assignment. + * This operation deletes a policy assignment, given its name and the scope it was created in. The scope of a policy assignment is the part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to delete. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String scope, String policyAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(scope, policyAssignmentName), serviceCallback); + } + + /** + * Deletes a policy assignment. + * This operation deletes a policy assignment, given its name and the scope it was created in. The scope of a policy assignment is the part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable deleteAsync(String scope, String policyAssignmentName) { + return deleteWithServiceResponseAsync(scope, policyAssignmentName).map(new Func1, PolicyAssignmentInner>() { + @Override + public PolicyAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a policy assignment. + * This operation deletes a policy assignment, given its name and the scope it was created in. The scope of a policy assignment is the part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable> deleteWithServiceResponseAsync(String scope, String policyAssignmentName) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (policyAssignmentName == null) { + throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(scope, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates or updates a policy assignment. + * This operation creates or updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment. + * @param parameters Parameters for the policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyAssignmentInner object if successful. + */ + public PolicyAssignmentInner create(String scope, String policyAssignmentName, PolicyAssignmentInner parameters) { + return createWithServiceResponseAsync(scope, policyAssignmentName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a policy assignment. + * This operation creates or updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment. + * @param parameters Parameters for the policy assignment. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String scope, String policyAssignmentName, PolicyAssignmentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(scope, policyAssignmentName, parameters), serviceCallback); + } + + /** + * Creates or updates a policy assignment. + * This operation creates or updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment. + * @param parameters Parameters for the policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable createAsync(String scope, String policyAssignmentName, PolicyAssignmentInner parameters) { + return createWithServiceResponseAsync(scope, policyAssignmentName, parameters).map(new Func1, PolicyAssignmentInner>() { + @Override + public PolicyAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a policy assignment. + * This operation creates or updates a policy assignment with the given scope and name. Policy assignments apply to all resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies to all resources in the group. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment. + * @param parameters Parameters for the policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable> createWithServiceResponseAsync(String scope, String policyAssignmentName, PolicyAssignmentInner parameters) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (policyAssignmentName == null) { + throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.create(scope, policyAssignmentName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves a policy assignment. + * This operation retrieves a single policy assignment, given its name and the scope it was created at. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyAssignmentInner object if successful. + */ + public PolicyAssignmentInner get(String scope, String policyAssignmentName) { + return getWithServiceResponseAsync(scope, policyAssignmentName).toBlocking().single().body(); + } + + /** + * Retrieves a policy assignment. + * This operation retrieves a single policy assignment, given its name and the scope it was created at. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to get. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String scope, String policyAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(scope, policyAssignmentName), serviceCallback); + } + + /** + * Retrieves a policy assignment. + * This operation retrieves a single policy assignment, given its name and the scope it was created at. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable getAsync(String scope, String policyAssignmentName) { + return getWithServiceResponseAsync(scope, policyAssignmentName).map(new Func1, PolicyAssignmentInner>() { + @Override + public PolicyAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves a policy assignment. + * This operation retrieves a single policy assignment, given its name and the scope it was created at. + * + * @param scope The scope of the policy assignment. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' + * @param policyAssignmentName The name of the policy assignment to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable> getWithServiceResponseAsync(String scope, String policyAssignmentName) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (policyAssignmentName == null) { + throw new IllegalArgumentException("Parameter policyAssignmentName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(scope, policyAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName, final String filter) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName, final String filter) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param resourceGroupName The name of the resource group that contains policy assignments. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String filter) { + return listByResourceGroupSinglePageAsync(resourceGroupName, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains policy assignments. + ServiceResponse> * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName, final String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) { + ServiceResponse> response = listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) { + return listForResourceWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listForResourceWithServiceResponseAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) { + return listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForResourceSinglePageAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (parentResourcePath == null) { + throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) { + ServiceResponse> response = listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) { + return listForResourceWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param resourceGroupName The name of the resource group containing the resource. + * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + * @param parentResourcePath The parent resource path. Use empty string if there is none. + * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + * @param resourceName The name of the resource. + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listForResourceWithServiceResponseAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) { + return listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + ServiceResponse> * @param resourceGroupName The name of the resource group containing the resource. + ServiceResponse> * @param resourceProviderNamespace The namespace of the resource provider. For example, the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines) + ServiceResponse> * @param parentResourcePath The parent resource path. Use empty string if there is none. + ServiceResponse> * @param resourceType The resource type name. For example the type name of a web app is 'sites' (from Microsoft.Web/sites). + ServiceResponse> * @param resourceName The name of the resource. + ServiceResponse> * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForResourceSinglePageAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceProviderNamespace == null) { + throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null."); + } + if (parentResourcePath == null) { + throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForResourceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.list(this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList list(final String filter) { + ServiceResponse> response = listSinglePageAsync(filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listAsync(final String filter) { + return listWithServiceResponseAsync(filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listWithServiceResponseAsync(final String filter) { + return listSinglePageAsync(filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + ServiceResponse> * @param filter The filter to apply on the operation. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, no filtering is performed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a policy assignment. + * This operation deletes the policy with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' (management group), '/subscriptions/{subscriptionId}' (subscription), '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource group), or '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' (resource). + * + * @param policyAssignmentId The ID of the policy assignment to delete. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyAssignmentInner object if successful. + */ + public PolicyAssignmentInner deleteById(String policyAssignmentId) { + return deleteByIdWithServiceResponseAsync(policyAssignmentId).toBlocking().single().body(); + } + + /** + * Deletes a policy assignment. + * This operation deletes the policy with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' (management group), '/subscriptions/{subscriptionId}' (subscription), '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource group), or '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' (resource). + * + * @param policyAssignmentId The ID of the policy assignment to delete. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteByIdAsync(String policyAssignmentId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteByIdWithServiceResponseAsync(policyAssignmentId), serviceCallback); + } + + /** + * Deletes a policy assignment. + * This operation deletes the policy with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' (management group), '/subscriptions/{subscriptionId}' (subscription), '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource group), or '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' (resource). + * + * @param policyAssignmentId The ID of the policy assignment to delete. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable deleteByIdAsync(String policyAssignmentId) { + return deleteByIdWithServiceResponseAsync(policyAssignmentId).map(new Func1, PolicyAssignmentInner>() { + @Override + public PolicyAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a policy assignment. + * This operation deletes the policy with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' (management group), '/subscriptions/{subscriptionId}' (subscription), '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource group), or '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' (resource). + * + * @param policyAssignmentId The ID of the policy assignment to delete. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable> deleteByIdWithServiceResponseAsync(String policyAssignmentId) { + if (policyAssignmentId == null) { + throw new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteById(policyAssignmentId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteByIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteByIdDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates or updates a policy assignment. + * This operation creates or updates the policy assignment with the given ID. Policy assignments made on a scope apply to all resources contained in that scope. For example, when you assign a policy to a resource group that policy applies to all resources in the group. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @param parameters Parameters for policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyAssignmentInner object if successful. + */ + public PolicyAssignmentInner createById(String policyAssignmentId, PolicyAssignmentInner parameters) { + return createByIdWithServiceResponseAsync(policyAssignmentId, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a policy assignment. + * This operation creates or updates the policy assignment with the given ID. Policy assignments made on a scope apply to all resources contained in that scope. For example, when you assign a policy to a resource group that policy applies to all resources in the group. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @param parameters Parameters for policy assignment. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createByIdAsync(String policyAssignmentId, PolicyAssignmentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createByIdWithServiceResponseAsync(policyAssignmentId, parameters), serviceCallback); + } + + /** + * Creates or updates a policy assignment. + * This operation creates or updates the policy assignment with the given ID. Policy assignments made on a scope apply to all resources contained in that scope. For example, when you assign a policy to a resource group that policy applies to all resources in the group. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @param parameters Parameters for policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable createByIdAsync(String policyAssignmentId, PolicyAssignmentInner parameters) { + return createByIdWithServiceResponseAsync(policyAssignmentId, parameters).map(new Func1, PolicyAssignmentInner>() { + @Override + public PolicyAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a policy assignment. + * This operation creates or updates the policy assignment with the given ID. Policy assignments made on a scope apply to all resources contained in that scope. For example, when you assign a policy to a resource group that policy applies to all resources in the group. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to create. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @param parameters Parameters for policy assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable> createByIdWithServiceResponseAsync(String policyAssignmentId, PolicyAssignmentInner parameters) { + if (policyAssignmentId == null) { + throw new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createById(policyAssignmentId, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createByIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createByIdDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves the policy assignment with the given ID. + * The operation retrieves the policy assignment with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to get. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyAssignmentInner object if successful. + */ + public PolicyAssignmentInner getById(String policyAssignmentId) { + return getByIdWithServiceResponseAsync(policyAssignmentId).toBlocking().single().body(); + } + + /** + * Retrieves the policy assignment with the given ID. + * The operation retrieves the policy assignment with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to get. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByIdAsync(String policyAssignmentId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByIdWithServiceResponseAsync(policyAssignmentId), serviceCallback); + } + + /** + * Retrieves the policy assignment with the given ID. + * The operation retrieves the policy assignment with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to get. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable getByIdAsync(String policyAssignmentId) { + return getByIdWithServiceResponseAsync(policyAssignmentId).map(new Func1, PolicyAssignmentInner>() { + @Override + public PolicyAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves the policy assignment with the given ID. + * The operation retrieves the policy assignment with the given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), subscription (format: '/subscriptions/{subscriptionId}'), resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'. + * + * @param policyAssignmentId The ID of the policy assignment to get. Use the format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyAssignmentInner object + */ + public Observable> getByIdWithServiceResponseAsync(String policyAssignmentId) { + if (policyAssignmentId == null) { + throw new IllegalArgumentException("Parameter policyAssignmentId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getById(policyAssignmentId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByIdDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource group. + * This operation retrieves the list of all policy assignments associated with the given resource group in the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource group, including those that apply directly or apply from containing scopes, as well as any applied to resources contained within the resource group. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource group, which is everything in the unfiltered list except those applied to resources contained within the resource group. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList listForResourceNext(final String nextPageLink) { + ServiceResponse> response = listForResourceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listForResourceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForResourceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listForResourceNextAsync(final String nextPageLink) { + return listForResourceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listForResourceNextWithServiceResponseAsync(final String nextPageLink) { + return listForResourceNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listForResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a resource. + * This operation retrieves the list of all policy assignments associated with the specified resource in the given resource group and subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the resource, including those that apply directly or from all containing scopes, as well as any applied to resources contained within the resource. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the resource, which is everything in the unfiltered list except those applied to resources contained within the resource. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value} that apply to the resource. Three parameters plus the resource name are used to identify a specific resource. If the resource is not part of a parent resource (the more common case), the parent resource path should not be provided (or provided as ''). For example a web app could be specified as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). If the resource is part of a parent resource, then all parameters should be provided. For example a virtual machine DNS name could be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} == 'domainNames', {resourceName} == 'MyComputerName'). A convenient alternative to providing the namespace and type name separately is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', {resourceName} == 'MyWebApp'). + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForResourceNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listForResourceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForResourceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForResourceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyAssignmentInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyAssignmentInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy assignments that apply to a subscription. + * This operation retrieves the list of all policy assignments associated with the given subscription that match the optional given $filter. Valid values for $filter are: 'atScope()' or 'policyDefinitionId eq '{value}''. If $filter is not provided, the unfiltered list includes all policy assignments associated with the subscription, including those that apply directly or from management groups that contain the given subscription, as well as any applied to objects contained within the subscription. If $filter=atScope() is provided, the returned list includes all policy assignments that apply to the subscription, which is everything in the unfiltered list except those applied to objects contained within the subscription. If $filter=policyDefinitionId eq '{value}' is provided, the returned list includes all policy assignments of the policy definition whose id is {value}. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyClientImpl.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyClientImpl.java new file mode 100644 index 000000000000..34f79fd282c1 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyClientImpl.java @@ -0,0 +1,224 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_06_01.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the PolicyClientImpl class. + */ +public class PolicyClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The ID of the target subscription. */ + private String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public PolicyClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The API version to use for the operation. */ + private String apiVersion; + + /** + * Gets The API version to use for the operation. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public PolicyClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public PolicyClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public PolicyClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The PolicyAssignmentsInner object to access its operations. + */ + private PolicyAssignmentsInner policyAssignments; + + /** + * Gets the PolicyAssignmentsInner object to access its operations. + * @return the PolicyAssignmentsInner object. + */ + public PolicyAssignmentsInner policyAssignments() { + return this.policyAssignments; + } + + /** + * The PolicyDefinitionsInner object to access its operations. + */ + private PolicyDefinitionsInner policyDefinitions; + + /** + * Gets the PolicyDefinitionsInner object to access its operations. + * @return the PolicyDefinitionsInner object. + */ + public PolicyDefinitionsInner policyDefinitions() { + return this.policyDefinitions; + } + + /** + * The PolicySetDefinitionsInner object to access its operations. + */ + private PolicySetDefinitionsInner policySetDefinitions; + + /** + * Gets the PolicySetDefinitionsInner object to access its operations. + * @return the PolicySetDefinitionsInner object. + */ + public PolicySetDefinitionsInner policySetDefinitions() { + return this.policySetDefinitions; + } + + /** + * Initializes an instance of PolicyClient client. + * + * @param credentials the management credentials for Azure + */ + public PolicyClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of PolicyClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public PolicyClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of PolicyClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public PolicyClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2019-06-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.policyAssignments = new PolicyAssignmentsInner(restClient().retrofit(), this); + this.policyDefinitions = new PolicyDefinitionsInner(restClient().retrofit(), this); + this.policySetDefinitions = new PolicySetDefinitionsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "PolicyClient", "2019-06-01"); + } +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyDefinitionImpl.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyDefinitionImpl.java new file mode 100644 index 000000000000..9827664f8629 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyDefinitionImpl.java @@ -0,0 +1,162 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.policy.v2019_06_01.implementation; + +import com.microsoft.azure.management.policy.v2019_06_01.PolicyDefinition; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.policy.v2019_06_01.PolicyType; + +class PolicyDefinitionImpl extends CreatableUpdatableImpl implements PolicyDefinition, PolicyDefinition.Definition, PolicyDefinition.Update { + private String policyDefinitionName; + private final PolicyManager manager; + + PolicyDefinitionImpl(String name, PolicyManager manager) { + super(name, new PolicyDefinitionInner()); + this.manager = manager; + // Set resource name + this.policyDefinitionName = name; + // + } + + PolicyDefinitionImpl(PolicyDefinitionInner inner, PolicyManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.policyDefinitionName = inner.name(); + // set resource ancestor and positional variables + this.policyDefinitionName = IdParsingUtils.getValueFromIdByName(inner.id(), "policyDefinitions"); + // set other parameters for create and update + } + + @Override + public PolicyManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + PolicyDefinitionsInner client = this.manager().inner().policyDefinitions(); + return client.createOrUpdateAsync(this.policyDefinitionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + PolicyDefinitionsInner client = this.manager().inner().policyDefinitions(); + return client.createOrUpdateAsync(this.policyDefinitionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + PolicyDefinitionsInner client = this.manager().inner().policyDefinitions(); + return client.getAsync(this.policyDefinitionName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Object metadata() { + return this.inner().metadata(); + } + + @Override + public String mode() { + return this.inner().mode(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Object parameters() { + return this.inner().parameters(); + } + + @Override + public Object policyRule() { + return this.inner().policyRule(); + } + + @Override + public PolicyType policyType() { + return this.inner().policyType(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public PolicyDefinitionImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public PolicyDefinitionImpl withDisplayName(String displayName) { + this.inner().withDisplayName(displayName); + return this; + } + + @Override + public PolicyDefinitionImpl withMetadata(Object metadata) { + this.inner().withMetadata(metadata); + return this; + } + + @Override + public PolicyDefinitionImpl withMode(String mode) { + this.inner().withMode(mode); + return this; + } + + @Override + public PolicyDefinitionImpl withParameters(Object parameters) { + this.inner().withParameters(parameters); + return this; + } + + @Override + public PolicyDefinitionImpl withPolicyRule(Object policyRule) { + this.inner().withPolicyRule(policyRule); + return this; + } + + @Override + public PolicyDefinitionImpl withPolicyType(PolicyType policyType) { + this.inner().withPolicyType(policyType); + return this; + } + +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyDefinitionInner.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyDefinitionInner.java new file mode 100644 index 000000000000..c6929e183999 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyDefinitionInner.java @@ -0,0 +1,206 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_06_01.implementation; + +import com.microsoft.azure.management.policy.v2019_06_01.PolicyType; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The policy definition. + */ +@JsonFlatten +public class PolicyDefinitionInner extends ProxyResource { + /** + * The type of policy definition. Possible values are NotSpecified, + * BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', + * 'Custom'. + */ + @JsonProperty(value = "properties.policyType") + private PolicyType policyType; + + /** + * The policy definition mode. Some examples are All, Indexed, + * Microsoft.KeyVault.Data. + */ + @JsonProperty(value = "properties.mode") + private String mode; + + /** + * The display name of the policy definition. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * The policy definition description. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The policy rule. + */ + @JsonProperty(value = "properties.policyRule") + private Object policyRule; + + /** + * The policy definition metadata. + */ + @JsonProperty(value = "properties.metadata") + private Object metadata; + + /** + * Required if a parameter is used in policy rule. + */ + @JsonProperty(value = "properties.parameters") + private Object parameters; + + /** + * Get the type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom'. + * + * @return the policyType value + */ + public PolicyType policyType() { + return this.policyType; + } + + /** + * Set the type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom'. + * + * @param policyType the policyType value to set + * @return the PolicyDefinitionInner object itself. + */ + public PolicyDefinitionInner withPolicyType(PolicyType policyType) { + this.policyType = policyType; + return this; + } + + /** + * Get the policy definition mode. Some examples are All, Indexed, Microsoft.KeyVault.Data. + * + * @return the mode value + */ + public String mode() { + return this.mode; + } + + /** + * Set the policy definition mode. Some examples are All, Indexed, Microsoft.KeyVault.Data. + * + * @param mode the mode value to set + * @return the PolicyDefinitionInner object itself. + */ + public PolicyDefinitionInner withMode(String mode) { + this.mode = mode; + return this; + } + + /** + * Get the display name of the policy definition. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name of the policy definition. + * + * @param displayName the displayName value to set + * @return the PolicyDefinitionInner object itself. + */ + public PolicyDefinitionInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the policy definition description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the policy definition description. + * + * @param description the description value to set + * @return the PolicyDefinitionInner object itself. + */ + public PolicyDefinitionInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the policy rule. + * + * @return the policyRule value + */ + public Object policyRule() { + return this.policyRule; + } + + /** + * Set the policy rule. + * + * @param policyRule the policyRule value to set + * @return the PolicyDefinitionInner object itself. + */ + public PolicyDefinitionInner withPolicyRule(Object policyRule) { + this.policyRule = policyRule; + return this; + } + + /** + * Get the policy definition metadata. + * + * @return the metadata value + */ + public Object metadata() { + return this.metadata; + } + + /** + * Set the policy definition metadata. + * + * @param metadata the metadata value to set + * @return the PolicyDefinitionInner object itself. + */ + public PolicyDefinitionInner withMetadata(Object metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get required if a parameter is used in policy rule. + * + * @return the parameters value + */ + public Object parameters() { + return this.parameters; + } + + /** + * Set required if a parameter is used in policy rule. + * + * @param parameters the parameters value to set + * @return the PolicyDefinitionInner object itself. + */ + public PolicyDefinitionInner withParameters(Object parameters) { + this.parameters = parameters; + return this; + } + +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyDefinitionsImpl.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyDefinitionsImpl.java new file mode 100644 index 000000000000..b0044be7a8ea --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyDefinitionsImpl.java @@ -0,0 +1,174 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * jkl + */ + +package com.microsoft.azure.management.policy.v2019_06_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.policy.v2019_06_01.PolicyDefinitions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import rx.Completable; +import com.microsoft.azure.management.policy.v2019_06_01.PolicyDefinition; +import com.microsoft.azure.arm.utils.PagedListConverter; + +class PolicyDefinitionsImpl extends WrapperImpl implements PolicyDefinitions { + private PagedListConverter converter; + private final PolicyManager manager; + + PolicyDefinitionsImpl(PolicyManager manager) { + super(manager.inner().policyDefinitions()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(PolicyDefinitionInner inner) { + return Observable.just((PolicyDefinition) wrapModel(inner)); + } + }; + } + + public PolicyManager manager() { + return this.manager; + } + + @Override + public PolicyDefinitionImpl define(String name) { + return wrapModel(name); + } + + private PolicyDefinitionImpl wrapModel(PolicyDefinitionInner inner) { + return new PolicyDefinitionImpl(inner, manager()); + } + + private PolicyDefinitionImpl wrapModel(String name) { + return new PolicyDefinitionImpl(name, this.manager()); + } + + @Override + public Completable deleteAsync(String policyDefinitionName) { + PolicyDefinitionsInner client = this.inner(); + return client.deleteAsync(policyDefinitionName).toCompletable(); + } + + @Override + public Observable getAsync(String policyDefinitionName) { + PolicyDefinitionsInner client = this.inner(); + return client.getAsync(policyDefinitionName) + .map(new Func1() { + @Override + public PolicyDefinition call(PolicyDefinitionInner inner) { + return new PolicyDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable getBuiltInAsync(String policyDefinitionName) { + PolicyDefinitionsInner client = this.inner(); + return client.getBuiltInAsync(policyDefinitionName) + .map(new Func1() { + @Override + public PolicyDefinition call(PolicyDefinitionInner inner) { + return new PolicyDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable createOrUpdateAtManagementGroupAsync(String policyDefinitionName, String managementGroupId, PolicyDefinitionInner parameters) { + PolicyDefinitionsInner client = this.inner(); + return client.createOrUpdateAtManagementGroupAsync(policyDefinitionName, managementGroupId, parameters) + .map(new Func1() { + @Override + public PolicyDefinition call(PolicyDefinitionInner inner) { + return new PolicyDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAtManagementGroupAsync(String policyDefinitionName, String managementGroupId) { + PolicyDefinitionsInner client = this.inner(); + return client.deleteAtManagementGroupAsync(policyDefinitionName, managementGroupId).toCompletable(); + } + + @Override + public Observable getAtManagementGroupAsync(String policyDefinitionName, String managementGroupId) { + PolicyDefinitionsInner client = this.inner(); + return client.getAtManagementGroupAsync(policyDefinitionName, managementGroupId) + .map(new Func1() { + @Override + public PolicyDefinition call(PolicyDefinitionInner inner) { + return new PolicyDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByManagementGroupAsync(final String managementGroupId) { + PolicyDefinitionsInner client = this.inner(); + return client.listByManagementGroupAsync(managementGroupId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyDefinition call(PolicyDefinitionInner inner) { + return new PolicyDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listBuiltInAsync() { + PolicyDefinitionsInner client = this.inner(); + return client.listBuiltInAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyDefinition call(PolicyDefinitionInner inner) { + return new PolicyDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public PagedList list() { + PolicyDefinitionsInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + PolicyDefinitionsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicyDefinition call(PolicyDefinitionInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyDefinitionsInner.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyDefinitionsInner.java new file mode 100644 index 000000000000..1d27397287c9 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyDefinitionsInner.java @@ -0,0 +1,1410 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_06_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PolicyDefinitions. + */ +public class PolicyDefinitionsInner { + /** The Retrofit service to perform REST calls. */ + private PolicyDefinitionsService service; + /** The service client containing this operation class. */ + private PolicyClientImpl client; + + /** + * Initializes an instance of PolicyDefinitionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PolicyDefinitionsInner(Retrofit retrofit, PolicyClientImpl client) { + this.service = retrofit.create(PolicyDefinitionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PolicyDefinitions to be + * used by Retrofit to perform actually REST calls. + */ + interface PolicyDefinitionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyDefinitions createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}") + Observable> createOrUpdate(@Path("policyDefinitionName") String policyDefinitionName, @Path("subscriptionId") String subscriptionId, @Body PolicyDefinitionInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyDefinitions delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("policyDefinitionName") String policyDefinitionName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyDefinitions get" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}") + Observable> get(@Path("policyDefinitionName") String policyDefinitionName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyDefinitions getBuiltIn" }) + @GET("providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}") + Observable> getBuiltIn(@Path("policyDefinitionName") String policyDefinitionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyDefinitions createOrUpdateAtManagementGroup" }) + @PUT("providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}") + Observable> createOrUpdateAtManagementGroup(@Path("policyDefinitionName") String policyDefinitionName, @Path("managementGroupId") String managementGroupId, @Body PolicyDefinitionInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyDefinitions deleteAtManagementGroup" }) + @HTTP(path = "providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", method = "DELETE", hasBody = true) + Observable> deleteAtManagementGroup(@Path("policyDefinitionName") String policyDefinitionName, @Path("managementGroupId") String managementGroupId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyDefinitions getAtManagementGroup" }) + @GET("providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}") + Observable> getAtManagementGroup(@Path("policyDefinitionName") String policyDefinitionName, @Path("managementGroupId") String managementGroupId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyDefinitions list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyDefinitions listBuiltIn" }) + @GET("providers/Microsoft.Authorization/policyDefinitions") + Observable> listBuiltIn(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyDefinitions listByManagementGroup" }) + @GET("providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions") + Observable> listByManagementGroup(@Path("managementGroupId") String managementGroupId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyDefinitions listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyDefinitions listBuiltInNext" }) + @GET + Observable> listBuiltInNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicyDefinitions listByManagementGroupNext" }) + @GET + Observable> listByManagementGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates a policy definition in a subscription. + * This operation creates or updates a policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param parameters The policy definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyDefinitionInner object if successful. + */ + public PolicyDefinitionInner createOrUpdate(String policyDefinitionName, PolicyDefinitionInner parameters) { + return createOrUpdateWithServiceResponseAsync(policyDefinitionName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a policy definition in a subscription. + * This operation creates or updates a policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param parameters The policy definition properties. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String policyDefinitionName, PolicyDefinitionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(policyDefinitionName, parameters), serviceCallback); + } + + /** + * Creates or updates a policy definition in a subscription. + * This operation creates or updates a policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param parameters The policy definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable createOrUpdateAsync(String policyDefinitionName, PolicyDefinitionInner parameters) { + return createOrUpdateWithServiceResponseAsync(policyDefinitionName, parameters).map(new Func1, PolicyDefinitionInner>() { + @Override + public PolicyDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a policy definition in a subscription. + * This operation creates or updates a policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param parameters The policy definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String policyDefinitionName, PolicyDefinitionInner parameters) { + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(policyDefinitionName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a policy definition in a subscription. + * This operation deletes the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String policyDefinitionName) { + deleteWithServiceResponseAsync(policyDefinitionName).toBlocking().single().body(); + } + + /** + * Deletes a policy definition in a subscription. + * This operation deletes the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String policyDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(policyDefinitionName), serviceCallback); + } + + /** + * Deletes a policy definition in a subscription. + * This operation deletes the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String policyDefinitionName) { + return deleteWithServiceResponseAsync(policyDefinitionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a policy definition in a subscription. + * This operation deletes the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String policyDefinitionName) { + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(policyDefinitionName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves a policy definition in a subscription. + * This operation retrieves the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyDefinitionInner object if successful. + */ + public PolicyDefinitionInner get(String policyDefinitionName) { + return getWithServiceResponseAsync(policyDefinitionName).toBlocking().single().body(); + } + + /** + * Retrieves a policy definition in a subscription. + * This operation retrieves the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String policyDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(policyDefinitionName), serviceCallback); + } + + /** + * Retrieves a policy definition in a subscription. + * This operation retrieves the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable getAsync(String policyDefinitionName) { + return getWithServiceResponseAsync(policyDefinitionName).map(new Func1, PolicyDefinitionInner>() { + @Override + public PolicyDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves a policy definition in a subscription. + * This operation retrieves the policy definition in the given subscription with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable> getWithServiceResponseAsync(String policyDefinitionName) { + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(policyDefinitionName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves a built-in policy definition. + * This operation retrieves the built-in policy definition with the given name. + * + * @param policyDefinitionName The name of the built-in policy definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyDefinitionInner object if successful. + */ + public PolicyDefinitionInner getBuiltIn(String policyDefinitionName) { + return getBuiltInWithServiceResponseAsync(policyDefinitionName).toBlocking().single().body(); + } + + /** + * Retrieves a built-in policy definition. + * This operation retrieves the built-in policy definition with the given name. + * + * @param policyDefinitionName The name of the built-in policy definition to get. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getBuiltInAsync(String policyDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getBuiltInWithServiceResponseAsync(policyDefinitionName), serviceCallback); + } + + /** + * Retrieves a built-in policy definition. + * This operation retrieves the built-in policy definition with the given name. + * + * @param policyDefinitionName The name of the built-in policy definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable getBuiltInAsync(String policyDefinitionName) { + return getBuiltInWithServiceResponseAsync(policyDefinitionName).map(new Func1, PolicyDefinitionInner>() { + @Override + public PolicyDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves a built-in policy definition. + * This operation retrieves the built-in policy definition with the given name. + * + * @param policyDefinitionName The name of the built-in policy definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable> getBuiltInWithServiceResponseAsync(String policyDefinitionName) { + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getBuiltIn(policyDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getBuiltInDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getBuiltInDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates a policy definition in a management group. + * This operation creates or updates a policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyDefinitionInner object if successful. + */ + public PolicyDefinitionInner createOrUpdateAtManagementGroup(String policyDefinitionName, String managementGroupId, PolicyDefinitionInner parameters) { + return createOrUpdateAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a policy definition in a management group. + * This operation creates or updates a policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy definition properties. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAtManagementGroupAsync(String policyDefinitionName, String managementGroupId, PolicyDefinitionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId, parameters), serviceCallback); + } + + /** + * Creates or updates a policy definition in a management group. + * This operation creates or updates a policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable createOrUpdateAtManagementGroupAsync(String policyDefinitionName, String managementGroupId, PolicyDefinitionInner parameters) { + return createOrUpdateAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId, parameters).map(new Func1, PolicyDefinitionInner>() { + @Override + public PolicyDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a policy definition in a management group. + * This operation creates or updates a policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable> createOrUpdateAtManagementGroupWithServiceResponseAsync(String policyDefinitionName, String managementGroupId, PolicyDefinitionInner parameters) { + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdateAtManagementGroup(policyDefinitionName, managementGroupId, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateAtManagementGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a policy definition in a management group. + * This operation deletes the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteAtManagementGroup(String policyDefinitionName, String managementGroupId) { + deleteAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId).toBlocking().single().body(); + } + + /** + * Deletes a policy definition in a management group. + * This operation deletes the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @param managementGroupId The ID of the management group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAtManagementGroupAsync(String policyDefinitionName, String managementGroupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId), serviceCallback); + } + + /** + * Deletes a policy definition in a management group. + * This operation deletes the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAtManagementGroupAsync(String policyDefinitionName, String managementGroupId) { + return deleteAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a policy definition in a management group. + * This operation deletes the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to delete. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteAtManagementGroupWithServiceResponseAsync(String policyDefinitionName, String managementGroupId) { + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteAtManagementGroup(policyDefinitionName, managementGroupId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteAtManagementGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieve a policy definition in a management group. + * This operation retrieves the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyDefinitionInner object if successful. + */ + public PolicyDefinitionInner getAtManagementGroup(String policyDefinitionName, String managementGroupId) { + return getAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId).toBlocking().single().body(); + } + + /** + * Retrieve a policy definition in a management group. + * This operation retrieves the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @param managementGroupId The ID of the management group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAtManagementGroupAsync(String policyDefinitionName, String managementGroupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId), serviceCallback); + } + + /** + * Retrieve a policy definition in a management group. + * This operation retrieves the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable getAtManagementGroupAsync(String policyDefinitionName, String managementGroupId) { + return getAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId).map(new Func1, PolicyDefinitionInner>() { + @Override + public PolicyDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieve a policy definition in a management group. + * This operation retrieves the policy definition in the given management group with the given name. + * + * @param policyDefinitionName The name of the policy definition to get. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyDefinitionInner object + */ + public Observable> getAtManagementGroupWithServiceResponseAsync(String policyDefinitionName, String managementGroupId) { + if (policyDefinitionName == null) { + throw new IllegalArgumentException("Parameter policyDefinitionName is required and cannot be null."); + } + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getAtManagementGroup(policyDefinitionName, managementGroupId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAtManagementGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyDefinitionInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyDefinitionInner> object if successful. + */ + public PagedList listBuiltIn() { + ServiceResponse> response = listBuiltInSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listBuiltInAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBuiltInSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable> listBuiltInAsync() { + return listBuiltInWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable>> listBuiltInWithServiceResponseAsync() { + return listBuiltInSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listBuiltInNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBuiltInSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listBuiltIn(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBuiltInDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBuiltInDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyDefinitionInner> object if successful. + */ + public PagedList listByManagementGroup(final String managementGroupId) { + ServiceResponse> response = listByManagementGroupSinglePageAsync(managementGroupId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param managementGroupId The ID of the management group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByManagementGroupAsync(final String managementGroupId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByManagementGroupSinglePageAsync(managementGroupId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable> listByManagementGroupAsync(final String managementGroupId) { + return listByManagementGroupWithServiceResponseAsync(managementGroupId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable>> listByManagementGroupWithServiceResponseAsync(final String managementGroupId) { + return listByManagementGroupSinglePageAsync(managementGroupId) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + ServiceResponse> * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByManagementGroupSinglePageAsync(final String managementGroupId) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByManagementGroup(managementGroupId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByManagementGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyDefinitionInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves policy definitions in a subscription. + * This operation retrieves a list of all the policy definitions in a given subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyDefinitionInner> object if successful. + */ + public PagedList listBuiltInNext(final String nextPageLink) { + ServiceResponse> response = listBuiltInNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listBuiltInNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBuiltInNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable> listBuiltInNextAsync(final String nextPageLink) { + return listBuiltInNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable>> listBuiltInNextWithServiceResponseAsync(final String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listBuiltInNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieve built-in policy definitions. + * This operation retrieves a list of all the built-in policy definitions. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBuiltInNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listBuiltInNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBuiltInNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBuiltInNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyDefinitionInner> object if successful. + */ + public PagedList listByManagementGroupNext(final String nextPageLink) { + ServiceResponse> response = listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByManagementGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByManagementGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable> listByManagementGroupNextAsync(final String nextPageLink) { + return listByManagementGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyDefinitionInner> object + */ + public Observable>> listByManagementGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieve policy definitions in a management group. + * This operation retrieves a list of all the policy definitions in a given management group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByManagementGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByManagementGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByManagementGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByManagementGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyManager.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyManager.java new file mode 100644 index 000000000000..d1af9e54755a --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicyManager.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_06_01.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.policy.v2019_06_01.PolicyAssignments; +import com.microsoft.azure.management.policy.v2019_06_01.PolicyDefinitions; +import com.microsoft.azure.management.policy.v2019_06_01.PolicySetDefinitions; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Authorization resource management. + */ +public final class PolicyManager extends ManagerCore { + private PolicyAssignments policyAssignments; + private PolicyDefinitions policyDefinitions; + private PolicySetDefinitions policySetDefinitions; + /** + * Get a Configurable instance that can be used to create PolicyManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new PolicyManager.ConfigurableImpl(); + } + /** + * Creates an instance of PolicyManager that exposes Authorization resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the PolicyManager + */ + public static PolicyManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new PolicyManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of PolicyManager that exposes Authorization resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the PolicyManager + */ + public static PolicyManager authenticate(RestClient restClient, String subscriptionId) { + return new PolicyManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of PolicyManager that exposes Authorization management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Authorization management API entry points that work across subscriptions + */ + PolicyManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage PolicyAssignments. + */ + public PolicyAssignments policyAssignments() { + if (this.policyAssignments == null) { + this.policyAssignments = new PolicyAssignmentsImpl(this); + } + return this.policyAssignments; + } + + /** + * @return Entry point to manage PolicyDefinitions. + */ + public PolicyDefinitions policyDefinitions() { + if (this.policyDefinitions == null) { + this.policyDefinitions = new PolicyDefinitionsImpl(this); + } + return this.policyDefinitions; + } + + /** + * @return Entry point to manage PolicySetDefinitions. + */ + public PolicySetDefinitions policySetDefinitions() { + if (this.policySetDefinitions == null) { + this.policySetDefinitions = new PolicySetDefinitionsImpl(this); + } + return this.policySetDefinitions; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public PolicyManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return PolicyManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private PolicyManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new PolicyClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicySetDefinitionImpl.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicySetDefinitionImpl.java new file mode 100644 index 000000000000..29dfdc922fcd --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicySetDefinitionImpl.java @@ -0,0 +1,153 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.policy.v2019_06_01.implementation; + +import com.microsoft.azure.management.policy.v2019_06_01.PolicySetDefinition; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.policy.v2019_06_01.PolicyType; +import java.util.List; +import com.microsoft.azure.management.policy.v2019_06_01.PolicyDefinitionReference; + +class PolicySetDefinitionImpl extends CreatableUpdatableImpl implements PolicySetDefinition, PolicySetDefinition.Definition, PolicySetDefinition.Update { + private String policySetDefinitionName; + private final PolicyManager manager; + + PolicySetDefinitionImpl(String name, PolicyManager manager) { + super(name, new PolicySetDefinitionInner()); + this.manager = manager; + // Set resource name + this.policySetDefinitionName = name; + // + } + + PolicySetDefinitionImpl(PolicySetDefinitionInner inner, PolicyManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.policySetDefinitionName = inner.name(); + // set resource ancestor and positional variables + this.policySetDefinitionName = IdParsingUtils.getValueFromIdByName(inner.id(), "policySetDefinitions"); + // set other parameters for create and update + } + + @Override + public PolicyManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + PolicySetDefinitionsInner client = this.manager().inner().policySetDefinitions(); + return client.createOrUpdateAsync(this.policySetDefinitionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + PolicySetDefinitionsInner client = this.manager().inner().policySetDefinitions(); + return client.createOrUpdateAsync(this.policySetDefinitionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + PolicySetDefinitionsInner client = this.manager().inner().policySetDefinitions(); + return client.getAsync(this.policySetDefinitionName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Object metadata() { + return this.inner().metadata(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Object parameters() { + return this.inner().parameters(); + } + + @Override + public List policyDefinitions() { + return this.inner().policyDefinitions(); + } + + @Override + public PolicyType policyType() { + return this.inner().policyType(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public PolicySetDefinitionImpl withPolicyDefinitions(List policyDefinitions) { + this.inner().withPolicyDefinitions(policyDefinitions); + return this; + } + + @Override + public PolicySetDefinitionImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public PolicySetDefinitionImpl withDisplayName(String displayName) { + this.inner().withDisplayName(displayName); + return this; + } + + @Override + public PolicySetDefinitionImpl withMetadata(Object metadata) { + this.inner().withMetadata(metadata); + return this; + } + + @Override + public PolicySetDefinitionImpl withParameters(Object parameters) { + this.inner().withParameters(parameters); + return this; + } + + @Override + public PolicySetDefinitionImpl withPolicyType(PolicyType policyType) { + this.inner().withPolicyType(policyType); + return this; + } + +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicySetDefinitionInner.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicySetDefinitionInner.java new file mode 100644 index 000000000000..e1dcaff779c4 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicySetDefinitionInner.java @@ -0,0 +1,182 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_06_01.implementation; + +import com.microsoft.azure.management.policy.v2019_06_01.PolicyType; +import java.util.List; +import com.microsoft.azure.management.policy.v2019_06_01.PolicyDefinitionReference; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The policy set definition. + */ +@JsonFlatten +public class PolicySetDefinitionInner extends ProxyResource { + /** + * The type of policy definition. Possible values are NotSpecified, + * BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', + * 'Custom'. + */ + @JsonProperty(value = "properties.policyType") + private PolicyType policyType; + + /** + * The display name of the policy set definition. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * The policy set definition description. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The policy set definition metadata. + */ + @JsonProperty(value = "properties.metadata") + private Object metadata; + + /** + * The policy set definition parameters that can be used in policy + * definition references. + */ + @JsonProperty(value = "properties.parameters") + private Object parameters; + + /** + * An array of policy definition references. + */ + @JsonProperty(value = "properties.policyDefinitions", required = true) + private List policyDefinitions; + + /** + * Get the type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom'. + * + * @return the policyType value + */ + public PolicyType policyType() { + return this.policyType; + } + + /** + * Set the type of policy definition. Possible values are NotSpecified, BuiltIn, and Custom. Possible values include: 'NotSpecified', 'BuiltIn', 'Custom'. + * + * @param policyType the policyType value to set + * @return the PolicySetDefinitionInner object itself. + */ + public PolicySetDefinitionInner withPolicyType(PolicyType policyType) { + this.policyType = policyType; + return this; + } + + /** + * Get the display name of the policy set definition. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name of the policy set definition. + * + * @param displayName the displayName value to set + * @return the PolicySetDefinitionInner object itself. + */ + public PolicySetDefinitionInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the policy set definition description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the policy set definition description. + * + * @param description the description value to set + * @return the PolicySetDefinitionInner object itself. + */ + public PolicySetDefinitionInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the policy set definition metadata. + * + * @return the metadata value + */ + public Object metadata() { + return this.metadata; + } + + /** + * Set the policy set definition metadata. + * + * @param metadata the metadata value to set + * @return the PolicySetDefinitionInner object itself. + */ + public PolicySetDefinitionInner withMetadata(Object metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the policy set definition parameters that can be used in policy definition references. + * + * @return the parameters value + */ + public Object parameters() { + return this.parameters; + } + + /** + * Set the policy set definition parameters that can be used in policy definition references. + * + * @param parameters the parameters value to set + * @return the PolicySetDefinitionInner object itself. + */ + public PolicySetDefinitionInner withParameters(Object parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get an array of policy definition references. + * + * @return the policyDefinitions value + */ + public List policyDefinitions() { + return this.policyDefinitions; + } + + /** + * Set an array of policy definition references. + * + * @param policyDefinitions the policyDefinitions value to set + * @return the PolicySetDefinitionInner object itself. + */ + public PolicySetDefinitionInner withPolicyDefinitions(List policyDefinitions) { + this.policyDefinitions = policyDefinitions; + return this; + } + +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicySetDefinitionsImpl.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicySetDefinitionsImpl.java new file mode 100644 index 000000000000..017705ec938a --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicySetDefinitionsImpl.java @@ -0,0 +1,174 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * jkl + */ + +package com.microsoft.azure.management.policy.v2019_06_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.policy.v2019_06_01.PolicySetDefinitions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import rx.Completable; +import com.microsoft.azure.management.policy.v2019_06_01.PolicySetDefinition; +import com.microsoft.azure.arm.utils.PagedListConverter; + +class PolicySetDefinitionsImpl extends WrapperImpl implements PolicySetDefinitions { + private PagedListConverter converter; + private final PolicyManager manager; + + PolicySetDefinitionsImpl(PolicyManager manager) { + super(manager.inner().policySetDefinitions()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(PolicySetDefinitionInner inner) { + return Observable.just((PolicySetDefinition) wrapModel(inner)); + } + }; + } + + public PolicyManager manager() { + return this.manager; + } + + @Override + public PolicySetDefinitionImpl define(String name) { + return wrapModel(name); + } + + private PolicySetDefinitionImpl wrapModel(PolicySetDefinitionInner inner) { + return new PolicySetDefinitionImpl(inner, manager()); + } + + private PolicySetDefinitionImpl wrapModel(String name) { + return new PolicySetDefinitionImpl(name, this.manager()); + } + + @Override + public Completable deleteAsync(String policySetDefinitionName) { + PolicySetDefinitionsInner client = this.inner(); + return client.deleteAsync(policySetDefinitionName).toCompletable(); + } + + @Override + public Observable getAsync(String policySetDefinitionName) { + PolicySetDefinitionsInner client = this.inner(); + return client.getAsync(policySetDefinitionName) + .map(new Func1() { + @Override + public PolicySetDefinition call(PolicySetDefinitionInner inner) { + return new PolicySetDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable getBuiltInAsync(String policySetDefinitionName) { + PolicySetDefinitionsInner client = this.inner(); + return client.getBuiltInAsync(policySetDefinitionName) + .map(new Func1() { + @Override + public PolicySetDefinition call(PolicySetDefinitionInner inner) { + return new PolicySetDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable createOrUpdateAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId, PolicySetDefinitionInner parameters) { + PolicySetDefinitionsInner client = this.inner(); + return client.createOrUpdateAtManagementGroupAsync(policySetDefinitionName, managementGroupId, parameters) + .map(new Func1() { + @Override + public PolicySetDefinition call(PolicySetDefinitionInner inner) { + return new PolicySetDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId) { + PolicySetDefinitionsInner client = this.inner(); + return client.deleteAtManagementGroupAsync(policySetDefinitionName, managementGroupId).toCompletable(); + } + + @Override + public Observable getAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId) { + PolicySetDefinitionsInner client = this.inner(); + return client.getAtManagementGroupAsync(policySetDefinitionName, managementGroupId) + .map(new Func1() { + @Override + public PolicySetDefinition call(PolicySetDefinitionInner inner) { + return new PolicySetDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByManagementGroupAsync(final String managementGroupId) { + PolicySetDefinitionsInner client = this.inner(); + return client.listByManagementGroupAsync(managementGroupId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicySetDefinition call(PolicySetDefinitionInner inner) { + return new PolicySetDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listBuiltInAsync() { + PolicySetDefinitionsInner client = this.inner(); + return client.listBuiltInAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicySetDefinition call(PolicySetDefinitionInner inner) { + return new PolicySetDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public PagedList list() { + PolicySetDefinitionsInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + PolicySetDefinitionsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PolicySetDefinition call(PolicySetDefinitionInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicySetDefinitionsInner.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicySetDefinitionsInner.java new file mode 100644 index 000000000000..bdaf5233bed0 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/PolicySetDefinitionsInner.java @@ -0,0 +1,1412 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.policy.v2019_06_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.policy.v2019_06_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PolicySetDefinitions. + */ +public class PolicySetDefinitionsInner { + /** The Retrofit service to perform REST calls. */ + private PolicySetDefinitionsService service; + /** The service client containing this operation class. */ + private PolicyClientImpl client; + + /** + * Initializes an instance of PolicySetDefinitionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PolicySetDefinitionsInner(Retrofit retrofit, PolicyClientImpl client) { + this.service = retrofit.create(PolicySetDefinitionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PolicySetDefinitions to be + * used by Retrofit to perform actually REST calls. + */ + interface PolicySetDefinitionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicySetDefinitions createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}") + Observable> createOrUpdate(@Path("policySetDefinitionName") String policySetDefinitionName, @Path("subscriptionId") String subscriptionId, @Body PolicySetDefinitionInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicySetDefinitions delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("policySetDefinitionName") String policySetDefinitionName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicySetDefinitions get" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}") + Observable> get(@Path("policySetDefinitionName") String policySetDefinitionName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicySetDefinitions getBuiltIn" }) + @GET("providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}") + Observable> getBuiltIn(@Path("policySetDefinitionName") String policySetDefinitionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicySetDefinitions list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicySetDefinitions listBuiltIn" }) + @GET("providers/Microsoft.Authorization/policySetDefinitions") + Observable> listBuiltIn(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicySetDefinitions createOrUpdateAtManagementGroup" }) + @PUT("providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}") + Observable> createOrUpdateAtManagementGroup(@Path("policySetDefinitionName") String policySetDefinitionName, @Path("managementGroupId") String managementGroupId, @Body PolicySetDefinitionInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicySetDefinitions deleteAtManagementGroup" }) + @HTTP(path = "providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", method = "DELETE", hasBody = true) + Observable> deleteAtManagementGroup(@Path("policySetDefinitionName") String policySetDefinitionName, @Path("managementGroupId") String managementGroupId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicySetDefinitions getAtManagementGroup" }) + @GET("providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}") + Observable> getAtManagementGroup(@Path("policySetDefinitionName") String policySetDefinitionName, @Path("managementGroupId") String managementGroupId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicySetDefinitions listByManagementGroup" }) + @GET("providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions") + Observable> listByManagementGroup(@Path("managementGroupId") String managementGroupId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicySetDefinitions listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicySetDefinitions listBuiltInNext" }) + @GET + Observable> listBuiltInNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.policy.v2019_06_01.PolicySetDefinitions listByManagementGroupNext" }) + @GET + Observable> listByManagementGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param parameters The policy set definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicySetDefinitionInner object if successful. + */ + public PolicySetDefinitionInner createOrUpdate(String policySetDefinitionName, PolicySetDefinitionInner parameters) { + return createOrUpdateWithServiceResponseAsync(policySetDefinitionName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param parameters The policy set definition properties. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String policySetDefinitionName, PolicySetDefinitionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(policySetDefinitionName, parameters), serviceCallback); + } + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param parameters The policy set definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable createOrUpdateAsync(String policySetDefinitionName, PolicySetDefinitionInner parameters) { + return createOrUpdateWithServiceResponseAsync(policySetDefinitionName, parameters).map(new Func1, PolicySetDefinitionInner>() { + @Override + public PolicySetDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param parameters The policy set definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String policySetDefinitionName, PolicySetDefinitionInner parameters) { + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(policySetDefinitionName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String policySetDefinitionName) { + deleteWithServiceResponseAsync(policySetDefinitionName).toBlocking().single().body(); + } + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String policySetDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(policySetDefinitionName), serviceCallback); + } + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String policySetDefinitionName) { + return deleteWithServiceResponseAsync(policySetDefinitionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String policySetDefinitionName) { + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(policySetDefinitionName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicySetDefinitionInner object if successful. + */ + public PolicySetDefinitionInner get(String policySetDefinitionName) { + return getWithServiceResponseAsync(policySetDefinitionName).toBlocking().single().body(); + } + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String policySetDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(policySetDefinitionName), serviceCallback); + } + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable getAsync(String policySetDefinitionName) { + return getWithServiceResponseAsync(policySetDefinitionName).map(new Func1, PolicySetDefinitionInner>() { + @Override + public PolicySetDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given subscription with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable> getWithServiceResponseAsync(String policySetDefinitionName) { + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(policySetDefinitionName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves a built in policy set definition. + * This operation retrieves the built-in policy set definition with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicySetDefinitionInner object if successful. + */ + public PolicySetDefinitionInner getBuiltIn(String policySetDefinitionName) { + return getBuiltInWithServiceResponseAsync(policySetDefinitionName).toBlocking().single().body(); + } + + /** + * Retrieves a built in policy set definition. + * This operation retrieves the built-in policy set definition with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getBuiltInAsync(String policySetDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getBuiltInWithServiceResponseAsync(policySetDefinitionName), serviceCallback); + } + + /** + * Retrieves a built in policy set definition. + * This operation retrieves the built-in policy set definition with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable getBuiltInAsync(String policySetDefinitionName) { + return getBuiltInWithServiceResponseAsync(policySetDefinitionName).map(new Func1, PolicySetDefinitionInner>() { + @Override + public PolicySetDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves a built in policy set definition. + * This operation retrieves the built-in policy set definition with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable> getBuiltInWithServiceResponseAsync(String policySetDefinitionName) { + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getBuiltIn(policySetDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getBuiltInDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getBuiltInDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicySetDefinitionInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicySetDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicySetDefinitionInner> object if successful. + */ + public PagedList listBuiltIn() { + ServiceResponse> response = listBuiltInSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listBuiltInAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBuiltInSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable> listBuiltInAsync() { + return listBuiltInWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable>> listBuiltInWithServiceResponseAsync() { + return listBuiltInSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listBuiltInNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicySetDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBuiltInSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listBuiltIn(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBuiltInDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBuiltInDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy set definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicySetDefinitionInner object if successful. + */ + public PolicySetDefinitionInner createOrUpdateAtManagementGroup(String policySetDefinitionName, String managementGroupId, PolicySetDefinitionInner parameters) { + return createOrUpdateAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy set definition properties. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId, PolicySetDefinitionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId, parameters), serviceCallback); + } + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy set definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable createOrUpdateAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId, PolicySetDefinitionInner parameters) { + return createOrUpdateAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId, parameters).map(new Func1, PolicySetDefinitionInner>() { + @Override + public PolicySetDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a policy set definition. + * This operation creates or updates a policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to create. + * @param managementGroupId The ID of the management group. + * @param parameters The policy set definition properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable> createOrUpdateAtManagementGroupWithServiceResponseAsync(String policySetDefinitionName, String managementGroupId, PolicySetDefinitionInner parameters) { + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdateAtManagementGroup(policySetDefinitionName, managementGroupId, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateAtManagementGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteAtManagementGroup(String policySetDefinitionName, String managementGroupId) { + deleteAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId).toBlocking().single().body(); + } + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @param managementGroupId The ID of the management group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId), serviceCallback); + } + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId) { + return deleteAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a policy set definition. + * This operation deletes the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to delete. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteAtManagementGroupWithServiceResponseAsync(String policySetDefinitionName, String managementGroupId) { + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteAtManagementGroup(policySetDefinitionName, managementGroupId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteAtManagementGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicySetDefinitionInner object if successful. + */ + public PolicySetDefinitionInner getAtManagementGroup(String policySetDefinitionName, String managementGroupId) { + return getAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId).toBlocking().single().body(); + } + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @param managementGroupId The ID of the management group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId), serviceCallback); + } + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable getAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId) { + return getAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId).map(new Func1, PolicySetDefinitionInner>() { + @Override + public PolicySetDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves a policy set definition. + * This operation retrieves the policy set definition in the given management group with the given name. + * + * @param policySetDefinitionName The name of the policy set definition to get. + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicySetDefinitionInner object + */ + public Observable> getAtManagementGroupWithServiceResponseAsync(String policySetDefinitionName, String managementGroupId) { + if (policySetDefinitionName == null) { + throw new IllegalArgumentException("Parameter policySetDefinitionName is required and cannot be null."); + } + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getAtManagementGroup(policySetDefinitionName, managementGroupId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAtManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAtManagementGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicySetDefinitionInner> object if successful. + */ + public PagedList listByManagementGroup(final String managementGroupId) { + ServiceResponse> response = listByManagementGroupSinglePageAsync(managementGroupId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param managementGroupId The ID of the management group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByManagementGroupAsync(final String managementGroupId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByManagementGroupSinglePageAsync(managementGroupId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable> listByManagementGroupAsync(final String managementGroupId) { + return listByManagementGroupWithServiceResponseAsync(managementGroupId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable>> listByManagementGroupWithServiceResponseAsync(final String managementGroupId) { + return listByManagementGroupSinglePageAsync(managementGroupId) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + ServiceResponse> * @param managementGroupId The ID of the management group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicySetDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByManagementGroupSinglePageAsync(final String managementGroupId) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByManagementGroup(managementGroupId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByManagementGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicySetDefinitionInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves the policy set definitions for a subscription. + * This operation retrieves a list of all the policy set definitions in the given subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicySetDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicySetDefinitionInner> object if successful. + */ + public PagedList listBuiltInNext(final String nextPageLink) { + ServiceResponse> response = listBuiltInNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listBuiltInNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listBuiltInNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable> listBuiltInNextAsync(final String nextPageLink) { + return listBuiltInNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable>> listBuiltInNextWithServiceResponseAsync(final String nextPageLink) { + return listBuiltInNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listBuiltInNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves built-in policy set definitions. + * This operation retrieves a list of all the built-in policy set definitions. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicySetDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listBuiltInNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listBuiltInNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listBuiltInNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listBuiltInNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicySetDefinitionInner> object if successful. + */ + public PagedList listByManagementGroupNext(final String nextPageLink) { + ServiceResponse> response = listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByManagementGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByManagementGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable> listByManagementGroupNextAsync(final String nextPageLink) { + return listByManagementGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicySetDefinitionInner> object + */ + public Observable>> listByManagementGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves all policy set definitions in management group. + * This operation retrieves a list of all the a policy set definition in the given management group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicySetDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByManagementGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByManagementGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByManagementGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByManagementGroupNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/package-info.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/package-info.java new file mode 100644 index 000000000000..28b89c5a6082 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for PolicyClient. + * To manage and control access to your resources, you can define customized policies and assign them at a scope. + */ +package com.microsoft.azure.management.policy.v2019_06_01.implementation; diff --git a/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/package-info.java b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/package-info.java new file mode 100644 index 000000000000..84d889280ab3 --- /dev/null +++ b/policy/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/policy/v2019_06_01/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for PolicyClient. + * To manage and control access to your resources, you can define customized policies and assign them at a scope. + */ +package com.microsoft.azure.management.policy.v2019_06_01; diff --git a/pom.client.xml b/pom.client.xml index ce6957bcaeed..991550966990 100644 --- a/pom.client.xml +++ b/pom.client.xml @@ -1,12 +1,13 @@ - 4.0.0 com.azure azure-client-sdk-parent pom - 1.3.0 + 1.4.0 Microsoft Azure SDK for Java - Client Libraries Parent POM for Microsoft Azure SDK for Java @@ -19,7 +20,7 @@ com.azure azure-sdk-parent - 1.2.0 + 1.3.0 ./parent/pom.xml @@ -126,7 +127,8 @@ eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml - eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml + eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml + eng/code-quality-reports/src/main/resources/checkstyle/java.header samedir= UTF-8 @@ -164,12 +166,13 @@
- Max + max Low true ${project.build.directory}/spotbugs spotbugs/spotbugs-exclude.xml true + true @@ -243,6 +246,7 @@ ${packageOutputDirectory} true true + all @@ -341,7 +345,6 @@ false - com.microsoft.azure.template: *.impl*: *.implementation*: com.azure.tools.checkstyle* @@ -361,6 +364,14 @@ Azure Core - Authentication com.azure.core.auth* + + Azure Core - HTTP - Netty + com.azure.core.http.netty* + + + Azure Core - HTTP - OkHttp + com.azure.core.http.okhttp* + Azure Core - Management com.azure.core.management* @@ -393,6 +404,10 @@ Azure Storage - Blobs com.azure.storage.blob* + + Azure Storage Blobs - Cryptography + com.azure.storage.blob.cryptography* + Azure Storage - Files com.azure.storage.file* @@ -401,6 +416,14 @@ Azure Storage - Queues com.azure.storage.queue* + + Azure Storage Queues - Cryptography + com.azure.storage.queue.cryptography* + + + Azure Telemetry + com.azure.tracing.opentelemetry* + https://docs.oracle.com/javase/8/docs/api/ @@ -415,9 +438,13 @@ codesnippet-doclet ${codesnippet4javadoc.version} - -maxLineLength 120 -snippetpath ${project.basedir}/src/samples/java + + -maxLineLength 120 + -snippetpath ${project.basedir}/src/samples/java + false false + all @@ -438,12 +465,13 @@ - Max + max Low true ${project.build.directory}/spotbugs spotbugs/spotbugs-exclude.xml true + true @@ -480,7 +508,8 @@ ${maven-checkstyle-plugin.version} eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml - eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml + eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml + eng/code-quality-reports/src/main/resources/checkstyle/java.header samedir= UTF-8 @@ -511,12 +540,14 @@ spotbugs-maven-plugin ${spotbugs.maven.version} - Max + max Low true ${project.build.directory}/spotbugs - eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml + eng/code-quality-reports/src/main/resources/spotbugs/spotbugs-exclude.xml + true + true @@ -542,13 +573,16 @@ -maxLineLength 120 -snippetpath ${project.basedir}/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java -snippetpath ${project.basedir}/sdk/core/azure-core/src/samples/java + -snippetpath ${project.basedir}/sdk/core/azure-core-http-netty/src/samples/java -snippetpath ${project.basedir}/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java + -snippetpath ${project.basedir}/sdk/keyvault/azure-keyvault-certificates/src/samples/java -snippetpath ${project.basedir}/sdk/keyvault/azure-keyvault-keys/src/samples/java -snippetpath ${project.basedir}/sdk/keyvault/azure-keyvault-secrets/src/samples/java -snippetpath ${project.basedir}/sdk/storage/azure-storage-blob/src/samples/java -snippetpath ${project.basedir}/sdk/storage/azure-storage-file/src/samples/java -snippetpath ${project.basedir}/sdk/storage/azure-storage-queue/src/samples/java + all @@ -671,6 +705,32 @@ + + + modulename + + + src/main/java/module-info.java + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + + ${project.automatic.module.name} + + + + + + + + @@ -729,7 +789,8 @@ template-module - include-template + env.ENABLETEMPLATEDOCS + true @@ -743,15 +804,21 @@ ./sdk/core/azure-core ./sdk/core/azure-core-amqp ./sdk/core/azure-core-management + ./sdk/core/azure-core-http-netty + ./sdk/core/azure-core-http-okhttp ./sdk/core/azure-core-test ./sdk/eventhubs/azure-messaging-eventhubs - ./sdk/keyvault/azure-keyvault-secrets - ./sdk/keyvault/azure-keyvault-keys - ./sdk/tracing/tracing-opentelemetry + ./sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob ./sdk/identity/azure-identity + ./sdk/keyvault/azure-keyvault-certificates + ./sdk/keyvault/azure-keyvault-keys + ./sdk/keyvault/azure-keyvault-secrets ./sdk/storage/azure-storage-blob + ./sdk/storage/azure-storage-blob-cryptography ./sdk/storage/azure-storage-common ./sdk/storage/azure-storage-file ./sdk/storage/azure-storage-queue + ./sdk/storage/azure-storage-queue-cryptography + ./sdk/tracing/tracing-opentelemetry diff --git a/pom.data.xml b/pom.data.xml index b29bea93bc9d..515f7cf0366d 100644 --- a/pom.data.xml +++ b/pom.data.xml @@ -6,7 +6,7 @@ com.azure azure-data-sdk-parent pom - 1.1.0 + 1.2.0 Microsoft Azure SDK for Java - Data Plane Libraries Parent POM for Microsoft Azure SDK for Java @@ -19,7 +19,7 @@ com.azure azure-sdk-parent - 1.2.0 + 1.3.0 ./parent/pom.xml @@ -70,6 +70,7 @@ org.apache.maven.plugins maven-checkstyle-plugin + ${maven-checkstyle-plugin.version} com.azure @@ -259,6 +260,10 @@ false com.microsoft.azure.template:*.impl.*:*.implementation.* + + Azure Application Insights + com.microsoft.azure.applicationinsights* + Azure Batch com.microsoft.azure.batch* @@ -515,7 +520,7 @@ - non-shippping-modules + non-shipping-modules include-non-shipping-modules @@ -542,10 +547,19 @@ ./sdk/batch/microsoft-azure-batch + ./sdk/applicationinsights/microsoft-azure-applicationinsights-query ./sdk/cosmos - ./sdk/eventhubs/pom.data.xml - ./sdk/keyvault/pom.data.xml - ./sdk/servicebus/azure-servicebus + ./sdk/eventhubs/microsoft-azure-eventhubs/pom.xml + ./sdk/eventhubs/microsoft-azure-eventhubs-eph/pom.xml + ./sdk/eventhubs/microsoft-azure-eventhubs-extensions/pom.xml + ./sdk/keyvault/microsoft-azure-keyvault/pom.xml + ./sdk/keyvault/microsoft-azure-keyvault-complete/pom.xml + ./sdk/keyvault/microsoft-azure-keyvault-core/pom.xml + ./sdk/keyvault/microsoft-azure-keyvault-cryptography/pom.xml + ./sdk/keyvault/microsoft-azure-keyvault-extensions/pom.xml + ./sdk/keyvault/microsoft-azure-keyvault-test/pom.xml + ./sdk/keyvault/microsoft-azure-keyvault-webkey/pom.xml + ./sdk/servicebus/microsoft-azure-servicebus ./sdk/storage/microsoft-azure-storage-blob diff --git a/resources/resource-manager/v2019_06_01/pom.xml b/resources/resource-manager/v2019_06_01/pom.xml new file mode 100644 index 000000000000..33b38c1b9afa --- /dev/null +++ b/resources/resource-manager/v2019_06_01/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.resources.v2019_06_01 + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-resources + 1.0.0-beta + jar + Microsoft Azure SDK for Resources Management + This package contains Microsoft Resources Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + 1.6.5 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/Location.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/Location.java new file mode 100644 index 000000000000..8a0e7f091cfc --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/Location.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2019_06_01.implementation.LocationInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_06_01.implementation.ResourcesManager; + +/** + * Type representing Location. + */ +public interface Location extends HasInner, HasManager { + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the latitude value. + */ + String latitude(); + + /** + * @return the longitude value. + */ + String longitude(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the subscriptionId value. + */ + String subscriptionId(); + +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/ManagedByTenant.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/ManagedByTenant.java new file mode 100644 index 000000000000..0258358a910d --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/ManagedByTenant.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about a tenant managing the subscription. + */ +public class ManagedByTenant { + /** + * The tenant ID of the managing tenant. This is a GUID. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * Get the tenant ID of the managing tenant. This is a GUID. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/Operation.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/Operation.java new file mode 100644 index 000000000000..19c2b66abee0 --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/Operation.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_06_01.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2019_06_01.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/OperationDisplay.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/OperationDisplay.java new file mode 100644 index 000000000000..815f44394fe8 --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/OperationDisplay.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Resources. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Resource on which the operation is performed: Profile, endpoint, etc. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Description of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get service provider: Microsoft.Resources. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set service provider: Microsoft.Resources. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get resource on which the operation is performed: Profile, endpoint, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource on which the operation is performed: Profile, endpoint, etc. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set operation type: Read, write, delete, etc. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get description of the operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of the operation. + * + * @param description the description value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/Operations.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/Operations.java new file mode 100644 index 000000000000..03fb93d77da0 --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01; + +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_06_01.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/SpendingLimit.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/SpendingLimit.java new file mode 100644 index 000000000000..cd9afaa9429b --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/SpendingLimit.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SpendingLimit. + */ +public enum SpendingLimit { + /** Enum value On. */ + ON("On"), + + /** Enum value Off. */ + OFF("Off"), + + /** Enum value CurrentPeriodOff. */ + CURRENT_PERIOD_OFF("CurrentPeriodOff"); + + /** The actual serialized value for a SpendingLimit instance. */ + private String value; + + SpendingLimit(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SpendingLimit instance. + * + * @param value the serialized value to parse. + * @return the parsed SpendingLimit object, or null if unable to parse. + */ + @JsonCreator + public static SpendingLimit fromString(String value) { + SpendingLimit[] items = SpendingLimit.values(); + for (SpendingLimit item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/Subscription.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/Subscription.java new file mode 100644 index 000000000000..cdeaa2a084e0 --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/Subscription.java @@ -0,0 +1,61 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_06_01.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2019_06_01.implementation.SubscriptionInner; +import java.util.List; + +/** + * Type representing Subscription. + */ +public interface Subscription extends HasInner, HasManager { + /** + * @return the authorizationSource value. + */ + String authorizationSource(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the managedByTenants value. + */ + List managedByTenants(); + + /** + * @return the state value. + */ + SubscriptionState state(); + + /** + * @return the subscriptionId value. + */ + String subscriptionId(); + + /** + * @return the subscriptionPolicies value. + */ + SubscriptionPolicies subscriptionPolicies(); + + /** + * @return the tenantId value. + */ + String tenantId(); + +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/SubscriptionPolicies.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/SubscriptionPolicies.java new file mode 100644 index 000000000000..b7e5122d45a2 --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/SubscriptionPolicies.java @@ -0,0 +1,66 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Subscription policies. + */ +public class SubscriptionPolicies { + /** + * The subscription location placement ID. The ID indicates which regions + * are visible for a subscription. For example, a subscription with a + * location placement Id of Public_2014-09-01 has access to Azure public + * regions. + */ + @JsonProperty(value = "locationPlacementId", access = JsonProperty.Access.WRITE_ONLY) + private String locationPlacementId; + + /** + * The subscription quota ID. + */ + @JsonProperty(value = "quotaId", access = JsonProperty.Access.WRITE_ONLY) + private String quotaId; + + /** + * The subscription spending limit. Possible values include: 'On', 'Off', + * 'CurrentPeriodOff'. + */ + @JsonProperty(value = "spendingLimit", access = JsonProperty.Access.WRITE_ONLY) + private SpendingLimit spendingLimit; + + /** + * Get the subscription location placement ID. The ID indicates which regions are visible for a subscription. For example, a subscription with a location placement Id of Public_2014-09-01 has access to Azure public regions. + * + * @return the locationPlacementId value + */ + public String locationPlacementId() { + return this.locationPlacementId; + } + + /** + * Get the subscription quota ID. + * + * @return the quotaId value + */ + public String quotaId() { + return this.quotaId; + } + + /** + * Get the subscription spending limit. Possible values include: 'On', 'Off', 'CurrentPeriodOff'. + * + * @return the spendingLimit value + */ + public SpendingLimit spendingLimit() { + return this.spendingLimit; + } + +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/SubscriptionState.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/SubscriptionState.java new file mode 100644 index 000000000000..30ad84396800 --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/SubscriptionState.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SubscriptionState. + */ +public enum SubscriptionState { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Warned. */ + WARNED("Warned"), + + /** Enum value PastDue. */ + PAST_DUE("PastDue"), + + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value Deleted. */ + DELETED("Deleted"); + + /** The actual serialized value for a SubscriptionState instance. */ + private String value; + + SubscriptionState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SubscriptionState instance. + * + * @param value the serialized value to parse. + * @return the parsed SubscriptionState object, or null if unable to parse. + */ + @JsonCreator + public static SubscriptionState fromString(String value) { + SubscriptionState[] items = SubscriptionState.values(); + for (SubscriptionState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/Subscriptions.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/Subscriptions.java new file mode 100644 index 000000000000..74649ce0f147 --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/Subscriptions.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01; + +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_06_01.implementation.SubscriptionsInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.resources.v2019_06_01.Location; + +/** + * Type representing Subscriptions. + */ +public interface Subscriptions extends HasInner { + /** + * Gets details about a specified subscription. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String subscriptionId); + + /** + * Gets all subscriptions for a tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + + /** + * Gets all available geo-locations. + * This operation provides all the locations that are available for resource providers; however, each resource provider may support a subset of this list. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listLocationsAsync(String subscriptionId); + +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/TenantIdDescription.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/TenantIdDescription.java new file mode 100644 index 000000000000..e2be7984a998 --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/TenantIdDescription.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.resources.v2019_06_01.implementation.ResourcesManager; +import com.microsoft.azure.management.resources.v2019_06_01.implementation.TenantIdDescriptionInner; + +/** + * Type representing TenantIdDescription. + */ +public interface TenantIdDescription extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the tenantId value. + */ + String tenantId(); + +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/Tenants.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/Tenants.java new file mode 100644 index 000000000000..20efb142ea17 --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/Tenants.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01; + +import rx.Observable; +import com.microsoft.azure.management.resources.v2019_06_01.implementation.TenantsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Tenants. + */ +public interface Tenants extends HasInner { + /** + * Gets the tenants for your account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/IdParsingUtils.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..6f7cb4f1b03a --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/LocationImpl.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/LocationImpl.java new file mode 100644 index 000000000000..349b2755bb62 --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/LocationImpl.java @@ -0,0 +1,60 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01.implementation; + +import com.microsoft.azure.management.resources.v2019_06_01.Location; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; + +class LocationImpl extends WrapperImpl implements Location { + private final ResourcesManager manager; + + LocationImpl(LocationInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String latitude() { + return this.inner().latitude(); + } + + @Override + public String longitude() { + return this.inner().longitude(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String subscriptionId() { + return this.inner().subscriptionId(); + } + +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/LocationInner.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/LocationInner.java new file mode 100644 index 000000000000..0f08beb36d06 --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/LocationInner.java @@ -0,0 +1,108 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Location information. + */ +public class LocationInner { + /** + * The fully qualified ID of the location. For example, + * /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The subscription ID. + */ + @JsonProperty(value = "subscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionId; + + /** + * The location name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The display name of the location. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * The latitude of the location. + */ + @JsonProperty(value = "latitude", access = JsonProperty.Access.WRITE_ONLY) + private String latitude; + + /** + * The longitude of the location. + */ + @JsonProperty(value = "longitude", access = JsonProperty.Access.WRITE_ONLY) + private String longitude; + + /** + * Get the fully qualified ID of the location. For example, /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the subscription ID. + * + * @return the subscriptionId value + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Get the location name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the display name of the location. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the latitude of the location. + * + * @return the latitude value + */ + public String latitude() { + return this.latitude; + } + + /** + * Get the longitude of the location. + * + * @return the longitude value + */ + public String longitude() { + return this.longitude; + } + +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/OperationImpl.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/OperationImpl.java new file mode 100644 index 000000000000..b28ccb98a7f1 --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01.implementation; + +import com.microsoft.azure.management.resources.v2019_06_01.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_06_01.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ResourcesManager manager; + OperationImpl(OperationInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/OperationInner.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/OperationInner.java new file mode 100644 index 000000000000..c0dbbd49fb76 --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/OperationInner.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01.implementation; + +import com.microsoft.azure.management.resources.v2019_06_01.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Microsoft.Resources operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/OperationsImpl.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/OperationsImpl.java new file mode 100644 index 000000000000..39359558215f --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.resources.v2019_06_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_06_01.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2019_06_01.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ResourcesManager manager; + + OperationsImpl(ResourcesManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ResourcesManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/OperationsInner.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/OperationsInner.java new file mode 100644 index 000000000000..d4bd4d37581a --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private SubscriptionClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, SubscriptionClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_06_01.Operations list" }) + @GET("providers/Microsoft.Resources/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_06_01.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available Microsoft.Resources REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/PageImpl.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/PageImpl.java new file mode 100644 index 000000000000..560fc4766ac4 --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/PageImpl1.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/PageImpl1.java new file mode 100644 index 000000000000..9323af15b19e --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/ResourcesManager.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/ResourcesManager.java new file mode 100644 index 000000000000..1cf1aa1e8ede --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/ResourcesManager.java @@ -0,0 +1,120 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.resources.v2019_06_01.Operations; +import com.microsoft.azure.management.resources.v2019_06_01.Subscriptions; +import com.microsoft.azure.management.resources.v2019_06_01.Tenants; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Resources resource management. + */ +public final class ResourcesManager extends ManagerCore { + private Operations operations; + private Subscriptions subscriptions; + private Tenants tenants; + /** + * Get a Configurable instance that can be used to create ResourcesManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new ResourcesManager.ConfigurableImpl(); + } + /** + * Creates an instance of ResourcesManager that exposes Resources resource management API entry points. + * + * @param credentials the credentials to use + * @return the ResourcesManager + */ + public static ResourcesManager authenticate(AzureTokenCredentials credentials) { + return new ResourcesManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build()); + } + /** + * Creates an instance of ResourcesManager that exposes Resources resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @return the ResourcesManager + */ + public static ResourcesManager authenticate(RestClient restClient) { + return new ResourcesManager(restClient); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of ResourcesManager that exposes Resources management API entry points. + * + * @param credentials the credentials to use + * @return the interface exposing Resources management API entry points that work across subscriptions + */ + ResourcesManager authenticate(AzureTokenCredentials credentials); + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage Subscriptions. + */ + public Subscriptions subscriptions() { + if (this.subscriptions == null) { + this.subscriptions = new SubscriptionsImpl(this); + } + return this.subscriptions; + } + + /** + * @return Entry point to manage Tenants. + */ + public Tenants tenants() { + if (this.tenants == null) { + this.tenants = new TenantsImpl(this); + } + return this.tenants; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public ResourcesManager authenticate(AzureTokenCredentials credentials) { + return ResourcesManager.authenticate(buildRestClient(credentials)); + } + } + private ResourcesManager(RestClient restClient) { + super( + restClient, + null, + new SubscriptionClientImpl(restClient)); + } +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/SubscriptionClientImpl.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/SubscriptionClientImpl.java new file mode 100644 index 000000000000..59a693d9a68d --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/SubscriptionClientImpl.java @@ -0,0 +1,201 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the SubscriptionClientImpl class. + */ +public class SubscriptionClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The API version to use for the operation. */ + private String apiVersion; + + /** + * Gets The API version to use for the operation. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public SubscriptionClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public SubscriptionClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public SubscriptionClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The SubscriptionsInner object to access its operations. + */ + private SubscriptionsInner subscriptions; + + /** + * Gets the SubscriptionsInner object to access its operations. + * @return the SubscriptionsInner object. + */ + public SubscriptionsInner subscriptions() { + return this.subscriptions; + } + + /** + * The TenantsInner object to access its operations. + */ + private TenantsInner tenants; + + /** + * Gets the TenantsInner object to access its operations. + * @return the TenantsInner object. + */ + public TenantsInner tenants() { + return this.tenants; + } + + /** + * Initializes an instance of SubscriptionClient client. + * + * @param credentials the management credentials for Azure + */ + public SubscriptionClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of SubscriptionClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public SubscriptionClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of SubscriptionClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public SubscriptionClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2019-06-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.operations = new OperationsInner(restClient().retrofit(), this); + this.subscriptions = new SubscriptionsInner(restClient().retrofit(), this); + this.tenants = new TenantsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "SubscriptionClient", "2019-06-01"); + } +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/SubscriptionImpl.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/SubscriptionImpl.java new file mode 100644 index 000000000000..eb009f562d05 --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/SubscriptionImpl.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01.implementation; + +import com.microsoft.azure.management.resources.v2019_06_01.Subscription; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.resources.v2019_06_01.ManagedByTenant; +import com.microsoft.azure.management.resources.v2019_06_01.SubscriptionState; +import com.microsoft.azure.management.resources.v2019_06_01.SubscriptionPolicies; + +class SubscriptionImpl extends WrapperImpl implements Subscription { + private final ResourcesManager manager; + SubscriptionImpl(SubscriptionInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public String authorizationSource() { + return this.inner().authorizationSource(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public List managedByTenants() { + return this.inner().managedByTenants(); + } + + @Override + public SubscriptionState state() { + return this.inner().state(); + } + + @Override + public String subscriptionId() { + return this.inner().subscriptionId(); + } + + @Override + public SubscriptionPolicies subscriptionPolicies() { + return this.inner().subscriptionPolicies(); + } + + @Override + public String tenantId() { + return this.inner().tenantId(); + } + +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/SubscriptionInner.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/SubscriptionInner.java new file mode 100644 index 000000000000..592dff482554 --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/SubscriptionInner.java @@ -0,0 +1,179 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01.implementation; + +import com.microsoft.azure.management.resources.v2019_06_01.SubscriptionState; +import com.microsoft.azure.management.resources.v2019_06_01.SubscriptionPolicies; +import java.util.List; +import com.microsoft.azure.management.resources.v2019_06_01.ManagedByTenant; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Subscription information. + */ +public class SubscriptionInner { + /** + * The fully qualified ID for the subscription. For example, + * /subscriptions/00000000-0000-0000-0000-000000000000. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The subscription ID. + */ + @JsonProperty(value = "subscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionId; + + /** + * The subscription display name. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * The subscription tenant ID. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * The subscription state. Possible values are Enabled, Warned, PastDue, + * Disabled, and Deleted. Possible values include: 'Enabled', 'Warned', + * 'PastDue', 'Disabled', 'Deleted'. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private SubscriptionState state; + + /** + * The subscription policies. + */ + @JsonProperty(value = "subscriptionPolicies") + private SubscriptionPolicies subscriptionPolicies; + + /** + * The authorization source of the request. Valid values are one or more + * combinations of Legacy, RoleBased, Bypassed, Direct and Management. For + * example, 'Legacy, RoleBased'. + */ + @JsonProperty(value = "authorizationSource") + private String authorizationSource; + + /** + * An array containing the tenants managing the subscription. + */ + @JsonProperty(value = "managedByTenants") + private List managedByTenants; + + /** + * Get the fully qualified ID for the subscription. For example, /subscriptions/00000000-0000-0000-0000-000000000000. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the subscription ID. + * + * @return the subscriptionId value + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Get the subscription display name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the subscription tenant ID. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the subscription state. Possible values are Enabled, Warned, PastDue, Disabled, and Deleted. Possible values include: 'Enabled', 'Warned', 'PastDue', 'Disabled', 'Deleted'. + * + * @return the state value + */ + public SubscriptionState state() { + return this.state; + } + + /** + * Get the subscription policies. + * + * @return the subscriptionPolicies value + */ + public SubscriptionPolicies subscriptionPolicies() { + return this.subscriptionPolicies; + } + + /** + * Set the subscription policies. + * + * @param subscriptionPolicies the subscriptionPolicies value to set + * @return the SubscriptionInner object itself. + */ + public SubscriptionInner withSubscriptionPolicies(SubscriptionPolicies subscriptionPolicies) { + this.subscriptionPolicies = subscriptionPolicies; + return this; + } + + /** + * Get the authorization source of the request. Valid values are one or more combinations of Legacy, RoleBased, Bypassed, Direct and Management. For example, 'Legacy, RoleBased'. + * + * @return the authorizationSource value + */ + public String authorizationSource() { + return this.authorizationSource; + } + + /** + * Set the authorization source of the request. Valid values are one or more combinations of Legacy, RoleBased, Bypassed, Direct and Management. For example, 'Legacy, RoleBased'. + * + * @param authorizationSource the authorizationSource value to set + * @return the SubscriptionInner object itself. + */ + public SubscriptionInner withAuthorizationSource(String authorizationSource) { + this.authorizationSource = authorizationSource; + return this; + } + + /** + * Get an array containing the tenants managing the subscription. + * + * @return the managedByTenants value + */ + public List managedByTenants() { + return this.managedByTenants; + } + + /** + * Set an array containing the tenants managing the subscription. + * + * @param managedByTenants the managedByTenants value to set + * @return the SubscriptionInner object itself. + */ + public SubscriptionInner withManagedByTenants(List managedByTenants) { + this.managedByTenants = managedByTenants; + return this; + } + +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/SubscriptionsImpl.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/SubscriptionsImpl.java new file mode 100644 index 000000000000..cb904a0e452c --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/SubscriptionsImpl.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.resources.v2019_06_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_06_01.Subscriptions; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2019_06_01.Subscription; +import java.util.List; +import com.microsoft.azure.management.resources.v2019_06_01.Location; + +class SubscriptionsImpl extends WrapperImpl implements Subscriptions { + private final ResourcesManager manager; + + SubscriptionsImpl(ResourcesManager manager) { + super(manager.inner().subscriptions()); + this.manager = manager; + } + + public ResourcesManager manager() { + return this.manager; + } + + @Override + public Observable getAsync(String subscriptionId) { + SubscriptionsInner client = this.inner(); + return client.getAsync(subscriptionId) + .map(new Func1() { + @Override + public Subscription call(SubscriptionInner inner) { + return new SubscriptionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync() { + SubscriptionsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Subscription call(SubscriptionInner inner) { + return new SubscriptionImpl(inner, manager()); + } + }); + } + + private LocationImpl wrapLocationModel(LocationInner inner) { + return new LocationImpl(inner, manager()); + } + + @Override + public Observable listLocationsAsync(String subscriptionId) { + SubscriptionsInner client = this.inner(); + return client.listLocationsAsync(subscriptionId) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public Location call(LocationInner inner) { + return wrapLocationModel(inner); + } + }); + } + +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/SubscriptionsInner.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/SubscriptionsInner.java new file mode 100644 index 000000000000..8441d3aba94a --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/SubscriptionsInner.java @@ -0,0 +1,454 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Subscriptions. + */ +public class SubscriptionsInner { + /** The Retrofit service to perform REST calls. */ + private SubscriptionsService service; + /** The service client containing this operation class. */ + private SubscriptionClientImpl client; + + /** + * Initializes an instance of SubscriptionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SubscriptionsInner(Retrofit retrofit, SubscriptionClientImpl client) { + this.service = retrofit.create(SubscriptionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Subscriptions to be + * used by Retrofit to perform actually REST calls. + */ + interface SubscriptionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_06_01.Subscriptions listLocations" }) + @GET("subscriptions/{subscriptionId}/locations") + Observable> listLocations(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_06_01.Subscriptions get" }) + @GET("subscriptions/{subscriptionId}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_06_01.Subscriptions list" }) + @GET("subscriptions") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_06_01.Subscriptions listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all available geo-locations. + * This operation provides all the locations that are available for resource providers; however, each resource provider may support a subset of this list. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<LocationInner> object if successful. + */ + public List listLocations(String subscriptionId) { + return listLocationsWithServiceResponseAsync(subscriptionId).toBlocking().single().body(); + } + + /** + * Gets all available geo-locations. + * This operation provides all the locations that are available for resource providers; however, each resource provider may support a subset of this list. + * + * @param subscriptionId The ID of the target subscription. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listLocationsAsync(String subscriptionId, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listLocationsWithServiceResponseAsync(subscriptionId), serviceCallback); + } + + /** + * Gets all available geo-locations. + * This operation provides all the locations that are available for resource providers; however, each resource provider may support a subset of this list. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LocationInner> object + */ + public Observable> listLocationsAsync(String subscriptionId) { + return listLocationsWithServiceResponseAsync(subscriptionId).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all available geo-locations. + * This operation provides all the locations that are available for resource providers; however, each resource provider may support a subset of this list. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LocationInner> object + */ + public Observable>> listLocationsWithServiceResponseAsync(String subscriptionId) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listLocations(subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listLocationsDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listLocationsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets details about a specified subscription. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SubscriptionInner object if successful. + */ + public SubscriptionInner get(String subscriptionId) { + return getWithServiceResponseAsync(subscriptionId).toBlocking().single().body(); + } + + /** + * Gets details about a specified subscription. + * + * @param subscriptionId The ID of the target subscription. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String subscriptionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(subscriptionId), serviceCallback); + } + + /** + * Gets details about a specified subscription. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionInner object + */ + public Observable getAsync(String subscriptionId) { + return getWithServiceResponseAsync(subscriptionId).map(new Func1, SubscriptionInner>() { + @Override + public SubscriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets details about a specified subscription. + * + * @param subscriptionId The ID of the target subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SubscriptionInner object + */ + public Observable> getWithServiceResponseAsync(String subscriptionId) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(subscriptionId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all subscriptions for a tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SubscriptionInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all subscriptions for a tenant. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all subscriptions for a tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all subscriptions for a tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all subscriptions for a tenant. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SubscriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all subscriptions for a tenant. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SubscriptionInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all subscriptions for a tenant. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all subscriptions for a tenant. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all subscriptions for a tenant. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SubscriptionInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all subscriptions for a tenant. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SubscriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/TenantIdDescriptionImpl.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/TenantIdDescriptionImpl.java new file mode 100644 index 000000000000..91f580bdbf9c --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/TenantIdDescriptionImpl.java @@ -0,0 +1,36 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01.implementation; + +import com.microsoft.azure.management.resources.v2019_06_01.TenantIdDescription; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class TenantIdDescriptionImpl extends WrapperImpl implements TenantIdDescription { + private final ResourcesManager manager; + TenantIdDescriptionImpl(TenantIdDescriptionInner inner, ResourcesManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ResourcesManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String tenantId() { + return this.inner().tenantId(); + } + +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/TenantIdDescriptionInner.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/TenantIdDescriptionInner.java new file mode 100644 index 000000000000..ee2db511d6ab --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/TenantIdDescriptionInner.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Tenant Id information. + */ +public class TenantIdDescriptionInner { + /** + * The fully qualified ID of the tenant. For example, + * /tenants/00000000-0000-0000-0000-000000000000. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The tenant ID. For example, 00000000-0000-0000-0000-000000000000. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * Get the fully qualified ID of the tenant. For example, /tenants/00000000-0000-0000-0000-000000000000. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the tenant ID. For example, 00000000-0000-0000-0000-000000000000. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/TenantsImpl.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/TenantsImpl.java new file mode 100644 index 000000000000..7f76b313c349 --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/TenantsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.resources.v2019_06_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.resources.v2019_06_01.Tenants; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.resources.v2019_06_01.TenantIdDescription; + +class TenantsImpl extends WrapperImpl implements Tenants { + private final ResourcesManager manager; + + TenantsImpl(ResourcesManager manager) { + super(manager.inner().tenants()); + this.manager = manager; + } + + public ResourcesManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + TenantsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TenantIdDescription call(TenantIdDescriptionInner inner) { + return new TenantIdDescriptionImpl(inner, manager()); + } + }); + } + +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/TenantsInner.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/TenantsInner.java new file mode 100644 index 000000000000..ceb08b0b99e3 --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/TenantsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.resources.v2019_06_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Tenants. + */ +public class TenantsInner { + /** The Retrofit service to perform REST calls. */ + private TenantsService service; + /** The service client containing this operation class. */ + private SubscriptionClientImpl client; + + /** + * Initializes an instance of TenantsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TenantsInner(Retrofit retrofit, SubscriptionClientImpl client) { + this.service = retrofit.create(TenantsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Tenants to be + * used by Retrofit to perform actually REST calls. + */ + interface TenantsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_06_01.Tenants list" }) + @GET("tenants") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.resources.v2019_06_01.Tenants listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the tenants for your account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TenantIdDescriptionInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the tenants for your account. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the tenants for your account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TenantIdDescriptionInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the tenants for your account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TenantIdDescriptionInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the tenants for your account. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TenantIdDescriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the tenants for your account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TenantIdDescriptionInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the tenants for your account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the tenants for your account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TenantIdDescriptionInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the tenants for your account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TenantIdDescriptionInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the tenants for your account. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TenantIdDescriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/package-info.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/package-info.java new file mode 100644 index 000000000000..2322ab913e58 --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for SubscriptionClient. + * All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization. + */ +package com.microsoft.azure.management.resources.v2019_06_01.implementation; diff --git a/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/package-info.java b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/package-info.java new file mode 100644 index 000000000000..c8905302ac69 --- /dev/null +++ b/resources/resource-manager/v2019_06_01/src/main/java/com/microsoft/azure/management/resources/v2019_06_01/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for SubscriptionClient. + * All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization. + */ +package com.microsoft.azure.management.resources.v2019_06_01; diff --git a/sdk/appconfiguration/azure-data-appconfiguration/CHANGELOG.md b/sdk/appconfiguration/azure-data-appconfiguration/CHANGELOG.md index c89e585b7f4b..a48fa603cdce 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/CHANGELOG.md +++ b/sdk/appconfiguration/azure-data-appconfiguration/CHANGELOG.md @@ -1,27 +1,47 @@ # Change Log azure-data-appconfiguration -## Version 1.0.0-preview.2: +## Version 1.0.0-preview.3 (2019-09-10) +For details on the Azure SDK for Java (September 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview3-java). +- Removed dependency on Netty. +- Added logging when throwing `RutimeException`s. + +This package's +[documentation](https://github.com/Azure/azure-sdk-for-java/blob/4375acbb70d4b85db238d6b5147b697d9355f45e/sdk/appconfiguration/azure-data-appconfiguration/README.md) +and +[samples](https://github.com/Azure/azure-sdk-for-java/tree/4375acbb70d4b85db238d6b5147b697d9355f45e/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration) +demonstrate the new API. + +## Version 1.0.0-preview.2 (2019-08-06) For details on the Azure SDK for Java (August 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview2-java). - Merged ConfigurationClientBuilder and ConfigurationAsyncClientBuilder into ConfigurationClientBuilder. Method to build each client were added. - ConfigurationClientBuilder was made instantiable, static builder method removed from ConfigurationClient and ConfigurationAsyncClient. - Builder method credentials renamed to credential and serviceEndpoint to endpoint. - Listing operations return PagedFlux and PagedIterable in their respective clients. -- Non-maximal overloads return response value instead of Response. - Asynchronous calls check subscriberContext for tracing context. - Synchronous calls support passing tracing context in maximal overloads. -## Version 1.0.0-preview.1: +**Breaking changes: New API Design** +- Simplified API to return model types directly on non-maximal overloads. Maximal overloads return `Response` and suffixed with WithResponse. + +This package's +[documentation](https://github.com/Azure/azure-sdk-for-java/blob/azure-data-appconfiguration_1.0.0-preview.2/sdk/appconfiguration/azure-data-appconfiguration/README.md) +and +[samples](https://github.com/Azure/azure-sdk-for-java/tree/azure-data-appconfiguration_1.0.0-preview.2/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration) +demonstrate the new API. +## Version 1.0.0-preview.1 (2019-06-28) Version 1.0.0-preview.1 is a preview of our efforts in creating a client library that is developer-friendly, idiomatic to the Java ecosystem, and as consistent across different languages and platforms as possible. The principles that guide -our efforts can be found in the [Azure SDK Design Guidelines for Java](https://azuresdkspecs.z5.web.core.windows.net/JavaSpec.html). +our efforts can be found in the [Azure SDK Design Guidelines for Java](https://azure.github.io/azure-sdk/java_introduction.html). For details on the Azure SDK for Java (July 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview1-java). -This package's [documentation](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/appconfiguration/azure-data-appconfiguration/README.md) -and [samples](https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration) +This package's +[documentation](https://github.com/Azure/azure-sdk-for-java/blob/azure-data-appconfiguration_1.0.0-preview.1/appconfiguration/client/README.md) +and +[samples](https://github.com/Azure/azure-sdk-for-java/tree/azure-data-appconfiguration_1.0.0-preview.1/appconfiguration/client/src/samples/java) demonstrate the new API. - Initial release. Please see the README and wiki for information on the new design. diff --git a/sdk/appconfiguration/azure-data-appconfiguration/README.md b/sdk/appconfiguration/azure-data-appconfiguration/README.md index cf9bfa46796e..9087be9541dc 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/README.md +++ b/sdk/appconfiguration/azure-data-appconfiguration/README.md @@ -22,10 +22,45 @@ Use the client library for App Configuration to create and manage application co com.azure azure-data-appconfiguration - 1.0.0-preview.2 + 1.0.0-preview.3 ``` +### 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-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(); +``` + ### Create an App Configuration Store To create a Configuration Store you can use the Azure Portal or [Azure CLI][azure_cli]. @@ -197,3 +232,5 @@ If you would like to become an active contributor to this project please follow [samples]: src/samples/java/com/azure/data/appconfiguration [source_code]: src [spring_quickstart]: https://docs.microsoft.com/azure/azure-app-configuration/quickstart-java-spring-app + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/appconfiguration/azure-data-appconfiguration/README.png) diff --git a/sdk/appconfiguration/azure-data-appconfiguration/pom.xml b/sdk/appconfiguration/azure-data-appconfiguration/pom.xml index 17733f2f7427..1a9ed2292927 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/pom.xml +++ b/sdk/appconfiguration/azure-data-appconfiguration/pom.xml @@ -7,13 +7,13 @@ com.azure azure-client-sdk-parent - 1.3.0 + 1.4.0 ../../../pom.client.xml com.azure azure-data-appconfiguration - 1.0.0-preview.3 + 1.0.0-preview.4 Microsoft Azure client library for App Configuration This package contains the Microsoft Azure App Configuration client library. @@ -32,11 +32,15 @@ HEAD + + com.azure.data.appconfiguration + + com.azure azure-core - 1.0.0-preview.4 + 1.0.0-preview.5 org.slf4j @@ -46,7 +50,13 @@ com.azure azure-core-test - 1.0.0-preview.4 + 1.0.0-preview.5 + test + + + com.azure + azure-core-http-netty + 1.0.0-preview.5 test diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/AzureConfiguration.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/AzureConfiguration.java index c51a4e31bcd6..555ec6dd065d 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/AzureConfiguration.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/AzureConfiguration.java @@ -9,5 +9,5 @@ class AzureConfiguration { //TODO: Eventually remove these hardcoded strings with https://github.com/Azure/azure-sdk-for-java/issues/3141 static final String NAME = "application-configuration"; - static final String VERSION = "1.0.0-preview.3"; + static final String VERSION = "1.0.0-preview.4"; } diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationAsyncClient.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationAsyncClient.java index 7a5c36bb2418..baf546a630c2 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationAsyncClient.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationAsyncClient.java @@ -3,13 +3,6 @@ package com.azure.data.appconfiguration; -import com.azure.core.implementation.annotation.ReturnType; -import com.azure.core.implementation.annotation.ServiceClient; -import com.azure.core.implementation.annotation.ServiceMethod; -import com.azure.data.appconfiguration.credentials.ConfigurationClientCredentials; -import com.azure.data.appconfiguration.models.ConfigurationSetting; -import com.azure.data.appconfiguration.models.SettingFields; -import com.azure.data.appconfiguration.models.SettingSelector; import com.azure.core.exception.HttpResponseException; import com.azure.core.exception.ResourceModifiedException; import com.azure.core.exception.ResourceNotFoundException; @@ -18,9 +11,16 @@ import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.Response; import com.azure.core.implementation.RestProxy; -import com.azure.core.util.logging.ClientLogger; +import com.azure.core.implementation.annotation.ReturnType; +import com.azure.core.implementation.annotation.ServiceClient; +import com.azure.core.implementation.annotation.ServiceMethod; import com.azure.core.implementation.util.ImplUtils; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.data.appconfiguration.credentials.ConfigurationClientCredentials; +import com.azure.data.appconfiguration.models.ConfigurationSetting; +import com.azure.data.appconfiguration.models.SettingFields; +import com.azure.data.appconfiguration.models.SettingSelector; import org.reactivestreams.Publisher; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -44,7 +44,8 @@ * @see ConfigurationClientBuilder * @see ConfigurationClientCredentials */ -@ServiceClient(builder = ConfigurationClientBuilder.class, isAsync = true, serviceInterfaces = ConfigurationService.class) +@ServiceClient(builder = ConfigurationClientBuilder.class, isAsync = true, + serviceInterfaces = ConfigurationService.class) public final class ConfigurationAsyncClient { private final ClientLogger logger = new ClientLogger(ConfigurationAsyncClient.class); @@ -77,8 +78,8 @@ public final class ConfigurationAsyncClient { * * @param key The key of the configuration setting to add. * @param value The value associated with this configuration setting key. - * @return The {@link ConfigurationSetting} that was created, if a key collision occurs or the key - * is an invalid value (which will also throw HttpResponseException described below). + * @return The {@link ConfigurationSetting} that was created, if a key collision occurs or the key is an invalid + * value (which will also throw HttpResponseException described below). * @throws IllegalArgumentException If {@code key} is {@code null}. * @throws ResourceModifiedException If a ConfigurationSetting with the same key exists. * @throws HttpResponseException If {@code key} is an empty string. @@ -86,8 +87,8 @@ public final class ConfigurationAsyncClient { @ServiceMethod(returns = ReturnType.SINGLE) public Mono addSetting(String key, String value) { return withContext( - context -> addSetting(new ConfigurationSetting().key(key).value(value), context)) - .flatMap(response -> Mono.justOrEmpty(response.value())); + context -> addSetting(new ConfigurationSetting().setKey(key).setValue(value), context)) + .flatMap(response -> Mono.justOrEmpty(response.getValue())); } /** @@ -101,17 +102,17 @@ public Mono addSetting(String key, String value) { * {@codesnippet com.azure.data.appconfiguration.configurationasyncclient.addSetting#ConfigurationSetting} * * @param setting The setting to add to the configuration service. - * @return The {@link ConfigurationSetting} that was created, if a key collision occurs or the key - * is an invalid value (which will also throw HttpResponseException described below). + * @return The {@link ConfigurationSetting} that was created, if a key collision occurs or the key is an invalid + * value (which will also throw HttpResponseException described below). * @throws NullPointerException If {@code setting} is {@code null}. - * @throws IllegalArgumentException If {@link ConfigurationSetting#key() key} is {@code null}. + * @throws IllegalArgumentException If {@link ConfigurationSetting#getKey() key} is {@code null}. * @throws ResourceModifiedException If a ConfigurationSetting with the same key and label exists. * @throws HttpResponseException If {@code key} is an empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono addSetting(ConfigurationSetting setting) { return withContext(context -> addSetting(setting, context)) - .flatMap(response -> Mono.justOrEmpty(response.value())); + .flatMap(response -> Mono.justOrEmpty(response.getValue())); } /** @@ -125,10 +126,10 @@ public Mono addSetting(ConfigurationSetting setting) { * {@codesnippet com.azure.data.appconfiguration.configurationasyncclient.addSettingWithResponse#ConfigurationSetting} * * @param setting The setting to add to the configuration service. - * @return A REST response containing the {@link ConfigurationSetting} that was created, if a key collision occurs or the key - * is an invalid value (which will also throw HttpResponseException described below). + * @return A REST response containing the {@link ConfigurationSetting} that was created, if a key collision occurs + * or the key is an invalid value (which will also throw HttpResponseException described below). * @throws NullPointerException If {@code setting} is {@code null}. - * @throws IllegalArgumentException If {@link ConfigurationSetting#key() key} is {@code null}. + * @throws IllegalArgumentException If {@link ConfigurationSetting#getKey() key} is {@code null}. * @throws ResourceModifiedException If a ConfigurationSetting with the same key and label exists. * @throws HttpResponseException If {@code key} is an empty string. */ @@ -143,9 +144,17 @@ Mono> addSetting(ConfigurationSetting setting, Co // This service method call is similar to setSetting except we're passing If-Not-Match = "*". If the service // finds any existing configuration settings, then its e-tag will match and the service will return an error. - return service.setKey(serviceEndpoint, setting.key(), setting.label(), setting, null, getETagValue(ETAG_ANY), context) + return service + .setKey( + serviceEndpoint, + setting.getKey(), + setting.getLabel(), + setting, + null, + getETagValue(ETAG_ANY), + context) .doOnRequest(ignoredValue -> logger.info("Adding ConfigurationSetting - {}", setting)) - .doOnSuccess(response -> logger.info("Added ConfigurationSetting - {}", response.value())) + .doOnSuccess(response -> logger.info("Added ConfigurationSetting - {}", response.getValue())) .onErrorMap(ConfigurationAsyncClient::addSettingExceptionMapper) .doOnError(error -> logger.warning("Failed to add ConfigurationSetting - {}", setting, error)); } @@ -157,12 +166,12 @@ Mono> addSetting(ConfigurationSetting setting, Co * *

Add a setting with the key "prodDBConnection" and value "db_connection".

* - * {@codesnippet com.azure.data.appconfiguration.configurationasyncclient.setSettingWithResponse#ConfigurationSetting} + * {@codesnippet com.azure.data.appconfiguration.configurationasyncclient.setSetting#string-string} * * @param key The key of the configuration setting to create or update. * @param value The value of this configuration setting. - * @return The {@link ConfigurationSetting} that was created or updated, if the key is an invalid - * value (which will also throw HttpResponseException described below). + * @return The {@link ConfigurationSetting} that was created or updated, if the key is an invalid value (which will + * also throw HttpResponseException described below). * @throws IllegalArgumentException If {@code key} is {@code null}. * @throws ResourceModifiedException If the setting exists and is locked. * @throws HttpResponseException If {@code key} is an empty string. @@ -170,17 +179,17 @@ Mono> addSetting(ConfigurationSetting setting, Co @ServiceMethod(returns = ReturnType.SINGLE) public Mono setSetting(String key, String value) { return withContext( - context -> setSetting(new ConfigurationSetting().key(key).value(value), context)) - .flatMap(response -> Mono.justOrEmpty(response.value())); + context -> setSetting(new ConfigurationSetting().setKey(key).setValue(value), context)) + .flatMap(response -> Mono.justOrEmpty(response.getValue())); } /** * Creates or updates a configuration value in the service. Partial updates are not supported and the entire * configuration setting is updated. * - * If {@link ConfigurationSetting#etag() etag} is specified, the configuration value is updated if the current - * setting's etag matches. If the etag's value is equal to the wildcard character ({@code "*"}), the setting - * will always be updated. + * If {@link ConfigurationSetting#getETag() etag} is specified, the configuration value is updated if the current + * setting's etag matches. If the etag's value is equal to the wildcard character ({@code "*"}), the setting will + * always be updated. * *

Code Samples

* @@ -189,29 +198,29 @@ public Mono setSetting(String key, String value) { * {@codesnippet com.azure.data.appconfiguration.configurationasyncclient.setSetting#ConfigurationSetting} * * @param setting The configuration setting to create or update. - * @return The {@link ConfigurationSetting} that was created or updated, if the key is an invalid - * value, the setting is locked, or an etag was provided but does not match the service's current etag value (which - * will also throw HttpResponseException described below). + * @return The {@link ConfigurationSetting} that was created or updated, if the key is an invalid value, the setting + * is locked, or an etag was provided but does not match the service's current etag value (which will also throw + * HttpResponseException described below). * @throws NullPointerException If {@code setting} is {@code null}. - * @throws IllegalArgumentException If {@link ConfigurationSetting#key() key} is {@code null}. - * @throws ResourceModifiedException If the {@link ConfigurationSetting#etag() etag} was specified, is not the - * wildcard character, and the current configuration value's etag does not match, or the - * setting exists and is locked. + * @throws IllegalArgumentException If {@link ConfigurationSetting#getKey() key} is {@code null}. + * @throws ResourceModifiedException If the {@link ConfigurationSetting#getETag() etag} was specified, is not the + * wildcard character, and the current configuration value's etag does not match, or the setting exists and is + * locked. * @throws HttpResponseException If {@code key} is an empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono setSetting(ConfigurationSetting setting) { return withContext(context -> setSetting(setting, context)) - .flatMap(response -> Mono.justOrEmpty(response.value())); + .flatMap(response -> Mono.justOrEmpty(response.getValue())); } /** * Creates or updates a configuration value in the service. Partial updates are not supported and the entire * configuration setting is updated. * - * If {@link ConfigurationSetting#etag() etag} is specified, the configuration value is updated if the current - * setting's etag matches. If the etag's value is equal to the wildcard character ({@code "*"}), the setting - * will always be updated. + * If {@link ConfigurationSetting#getETag() etag} is specified, the configuration value is updated if the current + * setting's etag matches. If the etag's value is equal to the wildcard character ({@code "*"}), the setting will + * always be updated. * *

Code Samples

* @@ -220,14 +229,14 @@ public Mono setSetting(ConfigurationSetting setting) { * {@codesnippet com.azure.data.appconfiguration.configurationasyncclient.setSettingWithResponse#ConfigurationSetting} * * @param setting The configuration setting to create or update. - * @return A REST response containing the {@link ConfigurationSetting} that was created or updated, if the key is an invalid - * value, the setting is locked, or an etag was provided but does not match the service's current etag value (which - * will also throw HttpResponseException described below). + * @return A REST response containing the {@link ConfigurationSetting} that was created or updated, if the key is an + * invalid value, the setting is locked, or an etag was provided but does not match the service's current etag value + * (which will also throw HttpResponseException described below). * @throws NullPointerException If {@code setting} is {@code null}. - * @throws IllegalArgumentException If {@link ConfigurationSetting#key() key} is {@code null}. - * @throws ResourceModifiedException If the {@link ConfigurationSetting#etag() etag} was specified, is not the - * wildcard character, and the current configuration value's etag does not match, or the - * setting exists and is locked. + * @throws IllegalArgumentException If {@link ConfigurationSetting#getKey() key} is {@code null}. + * @throws ResourceModifiedException If the {@link ConfigurationSetting#getETag() etag} was specified, is not the + * wildcard character, and the current configuration value's etag does not match, or the setting exists and is + * locked. * @throws HttpResponseException If {@code key} is an empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -245,17 +254,17 @@ Mono> setSetting(ConfigurationSetting setting, Co // Otherwise, the service throws an exception because the current configuration value was updated and we have an // old value locally. // If no etag value was passed in, then the value is always added or updated. - return service.setKey(serviceEndpoint, setting.key(), setting.label(), setting, getETagValue(setting.etag()), null, context) + return service.setKey(serviceEndpoint, setting.getKey(), setting.getLabel(), setting, + getETagValue(setting.getETag()), null, context) .doOnRequest(ignoredValue -> logger.info("Setting ConfigurationSetting - {}", setting)) - .doOnSuccess(response -> logger.info("Set ConfigurationSetting - {}", response.value())) + .doOnSuccess(response -> logger.info("Set ConfigurationSetting - {}", response.getValue())) .doOnError(error -> logger.warning("Failed to set ConfigurationSetting - {}", setting, error)); } /** * Updates an existing configuration value in the service with the given key. The setting must already exist. * - * - * >Code Samples

+ * Code Samples

* *

Update a setting with the key "prodDBConnection" to have the value "updated_db_connection".

* @@ -263,68 +272,73 @@ Mono> setSetting(ConfigurationSetting setting, Co * * @param key The key of the configuration setting to update. * @param value The updated value of this configuration setting. - * @return The {@link ConfigurationSetting} that was updated, if the configuration value does not - * exist, is locked, or the key is an invalid value (which will also throw HttpResponseException described below). + * @return The {@link ConfigurationSetting} that was updated, if the configuration value does not exist, is locked, + * or the key is an invalid value (which will also throw HttpResponseException described below). * @throws IllegalArgumentException If {@code key} is {@code null}. - * @throws HttpResponseException If a ConfigurationSetting with the key does not exist or the configuration value - * is locked. + * @throws HttpResponseException If a ConfigurationSetting with the key does not exist or the configuration value is + * locked. * @throws HttpResponseException If {@code key} is an empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono updateSetting(String key, String value) { return withContext( - context -> updateSetting(new ConfigurationSetting().key(key).value(value), context)) - .flatMap(response -> Mono.justOrEmpty(response.value())); + context -> updateSetting(new ConfigurationSetting().setKey(key).setValue(value), context)) + .flatMap(response -> Mono.justOrEmpty(response.getValue())); } /** * Updates an existing configuration value in the service. The setting must already exist. Partial updates are not * supported, the entire configuration value is replaced. * - * If {@link ConfigurationSetting#etag() etag} is specified, the configuration value is only updated if it matches. + * If {@link ConfigurationSetting#getETag() etag} is specified, the configuration value is only updated if it + * matches. * *

Code Samples

* - *

Update the setting with the key-label pair "prodDBConnection"-"westUS" to have the value "updated_db_connection".

+ *

Update the setting with the key-label pair "prodDBConnection"-"westUS" to have the value + * "updated_db_connection".

* * {@codesnippet com.azure.data.appconfiguration.configurationasyncclient.updateSetting#ConfigurationSetting} * * @param setting The setting to add or update in the service. - * @return The {@link ConfigurationSetting} that was updated, if the configuration value does not - * exist, is locked, or the key is an invalid value (which will also throw HttpResponseException described below). + * @return The {@link ConfigurationSetting} that was updated, if the configuration value does not exist, is locked, + * or the key is an invalid value (which will also throw HttpResponseException described below). * @throws NullPointerException If {@code setting} is {@code null}. - * @throws IllegalArgumentException If {@link ConfigurationSetting#key() key} is {@code null}. - * @throws ResourceModifiedException If a ConfigurationSetting with the same key and label does not - * exist, the setting is locked, or {@link ConfigurationSetting#etag() etag} is specified but does not match - * the current value. + * @throws IllegalArgumentException If {@link ConfigurationSetting#getKey() key} is {@code null}. + * @throws ResourceModifiedException If a ConfigurationSetting with the same key and label does not exist, the + * setting is locked, or {@link ConfigurationSetting#getETag() etag} is specified but does not match the current + * value. * @throws HttpResponseException If {@code key} is an empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono updateSetting(ConfigurationSetting setting) { return withContext(context -> updateSetting(setting, context)) - .flatMap(response -> Mono.justOrEmpty(response.value())); + .flatMap(response -> Mono.justOrEmpty(response.getValue())); } /** * Updates an existing configuration value in the service. The setting must already exist. Partial updates are not * supported, the entire configuration value is replaced. * - * If {@link ConfigurationSetting#etag() etag} is specified, the configuration value is only updated if it matches. + * If {@link ConfigurationSetting#getETag() etag} is specified, the configuration value is only updated if it + * matches. * *

Code Samples

* - *

Update the setting with the key-label pair "prodDBConnection"-"westUS" to have the value "updated_db_connection".

+ *

Update the setting with the key-label pair "prodDBConnection"-"westUS" to have the value + * "updated_db_connection".

* * {@codesnippet com.azure.data.appconfiguration.configurationasyncclient.updateSettingWithResponse#ConfigurationSetting} * * @param setting The setting to add or update in the service. - * @return A REST response containing the {@link ConfigurationSetting} that was updated, if the configuration value does not - * exist, is locked, or the key is an invalid value (which will also throw HttpResponseException described below). + * @return A REST response containing the {@link ConfigurationSetting} that was updated, if the configuration value + * does not exist, is locked, or the key is an invalid value (which will also throw HttpResponseException described + * below). * @throws NullPointerException If {@code setting} is {@code null}. - * @throws IllegalArgumentException If {@link ConfigurationSetting#key() key} is {@code null}. - * @throws ResourceModifiedException If a ConfigurationSetting with the same key and label does not - * exist, the setting is locked, or {@link ConfigurationSetting#etag() etag} is specified but does not match - * the current value. + * @throws IllegalArgumentException If {@link ConfigurationSetting#getKey() key} is {@code null}. + * @throws ResourceModifiedException If a ConfigurationSetting with the same key and label does not exist, the + * setting is locked, or {@link ConfigurationSetting#getETag() etag} is specified but does not match the current + * value. * @throws HttpResponseException If {@code key} is an empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -336,11 +350,12 @@ Mono> updateSetting(ConfigurationSetting setting, // Validate that setting and key is not null. The key is used in the service URL so it cannot be null. validateSetting(setting); - String etag = setting.etag() == null ? ETAG_ANY : setting.etag(); + String etag = setting.getETag() == null ? ETAG_ANY : setting.getETag(); - return service.setKey(serviceEndpoint, setting.key(), setting.label(), setting, getETagValue(etag), null, context) + return service.setKey(serviceEndpoint, setting.getKey(), setting.getLabel(), setting, getETagValue(etag), + null, context) .doOnRequest(ignoredValue -> logger.info("Updating ConfigurationSetting - {}", setting)) - .doOnSuccess(response -> logger.info("Updated ConfigurationSetting - {}", response.value())) + .doOnSuccess(response -> logger.info("Updated ConfigurationSetting - {}", response.getValue())) .doOnError(error -> logger.warning("Failed to update ConfigurationSetting - {}", setting, error)); } @@ -354,8 +369,8 @@ Mono> updateSetting(ConfigurationSetting setting, * {@codesnippet com.azure.data.appconfiguration.configurationasyncclient.getSetting#string} * * @param key The key of the setting to retrieve. - * @return The {@link ConfigurationSetting} stored in the service, if the configuration value does - * not exist or the key is an invalid value (which will also throw HttpResponseException described below). + * @return The {@link ConfigurationSetting} stored in the service, if the configuration value does not exist or the + * key is an invalid value (which will also throw HttpResponseException described below). * @throws IllegalArgumentException If {@code key} is {@code null}. * @throws ResourceNotFoundException If a ConfigurationSetting with {@code key} does not exist. * @throws HttpResponseException If {@code key} is an empty string. @@ -363,8 +378,8 @@ Mono> updateSetting(ConfigurationSetting setting, @ServiceMethod(returns = ReturnType.SINGLE) public Mono getSetting(String key) { return withContext( - context -> getSetting(new ConfigurationSetting().key(key), context)) - .flatMap(response -> Mono.justOrEmpty(response.value())); + context -> getSetting(new ConfigurationSetting().setKey(key), context)) + .flatMap(response -> Mono.justOrEmpty(response.getValue())); } /** @@ -377,17 +392,17 @@ public Mono getSetting(String key) { * {@codesnippet com.azure.data.appconfiguration.configurationasyncclient.getSetting#ConfigurationSetting} * * @param setting The setting to retrieve based on its key and optional label combination. - * @return The {@link ConfigurationSetting} stored in the service, if the configuration value does - * not exist or the key is an invalid value (which will also throw HttpResponseException described below). + * @return The {@link ConfigurationSetting} stored in the service, if the configuration value does not exist or the + * key is an invalid value (which will also throw HttpResponseException described below). * @throws NullPointerException If {@code setting} is {@code null}. - * @throws IllegalArgumentException If {@link ConfigurationSetting#key() key} is {@code null}. + * @throws IllegalArgumentException If {@link ConfigurationSetting#getKey() key} is {@code null}. * @throws ResourceNotFoundException If a ConfigurationSetting with the same key and label does not exist. * @throws HttpResponseException If the {@code} key is an empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getSetting(ConfigurationSetting setting) { return withContext(context -> getSetting(setting, context)) - .flatMap(response -> Mono.justOrEmpty(response.value())); + .flatMap(response -> Mono.justOrEmpty(response.getValue())); } /** @@ -400,10 +415,11 @@ public Mono getSetting(ConfigurationSetting setting) { * {@codesnippet com.azure.data.appconfiguration.configurationasyncclient.getSettingWithResponse#ConfigurationSetting} * * @param setting The setting to retrieve based on its key and optional label combination. - * @return A REST response containing the {@link ConfigurationSetting} stored in the service, if the configuration value does - * not exist or the key is an invalid value (which will also throw HttpResponseException described below). + * @return A REST response containing the {@link ConfigurationSetting} stored in the service, if the configuration + * value does not exist or the key is an invalid value (which will also throw HttpResponseException described + * below). * @throws NullPointerException If {@code setting} is {@code null}. - * @throws IllegalArgumentException If {@link ConfigurationSetting#key() key} is {@code null}. + * @throws IllegalArgumentException If {@link ConfigurationSetting#getKey() key} is {@code null}. * @throws ResourceNotFoundException If a ConfigurationSetting with the same key and label does not exist. * @throws HttpResponseException If the {@code} key is an empty string. */ @@ -416,9 +432,10 @@ Mono> getSetting(ConfigurationSetting setting, Co // Validate that setting and key is not null. The key is used in the service URL so it cannot be null. validateSetting(setting); - return service.getKeyValue(serviceEndpoint, setting.key(), setting.label(), null, null, null, null, context) + return service.getKeyValue(serviceEndpoint, setting.getKey(), setting.getLabel(), null, null, null, null, + context) .doOnRequest(ignoredValue -> logger.info("Retrieving ConfigurationSetting - {}", setting)) - .doOnSuccess(response -> logger.info("Retrieved ConfigurationSetting - {}", response.value())) + .doOnSuccess(response -> logger.info("Retrieved ConfigurationSetting - {}", response.getValue())) .doOnError(error -> logger.warning("Failed to get ConfigurationSetting - {}", setting, error)); } @@ -432,8 +449,8 @@ Mono> getSetting(ConfigurationSetting setting, Co * {@codesnippet com.azure.data.appconfiguration.configurationasyncclient.deleteSetting#string} * * @param key The key of the setting to delete. - * @return The deleted ConfigurationSetting or {@code null} if it didn't exist. {@code null} is also returned if - * the {@code key} is an invalid value (which will also throw HttpResponseException described below). + * @return The deleted ConfigurationSetting or {@code null} if it didn't exist. {@code null} is also returned if the + * {@code key} is an invalid value (which will also throw HttpResponseException described below). * @throws IllegalArgumentException If {@code key} is {@code null}. * @throws ResourceModifiedException If the ConfigurationSetting is locked. * @throws HttpResponseException If {@code key} is an empty string. @@ -441,16 +458,16 @@ Mono> getSetting(ConfigurationSetting setting, Co @ServiceMethod(returns = ReturnType.SINGLE) public Mono deleteSetting(String key) { return withContext( - context -> deleteSetting(new ConfigurationSetting().key(key), context)) - .flatMap(response -> Mono.justOrEmpty(response.value())); + context -> deleteSetting(new ConfigurationSetting().setKey(key), context)) + .flatMap(response -> Mono.justOrEmpty(response.getValue())); } /** * Deletes the {@link ConfigurationSetting} with a matching key, along with the given label and etag. * - * If {@link ConfigurationSetting#etag() etag} is specified and is not the wildcard character ({@code "*"}), - * then the setting is only deleted if the etag matches the current etag; this means that no one has updated - * the ConfigurationSetting yet. + * If {@link ConfigurationSetting#getETag() etag} is specified and is not the wildcard character ({@code "*"}), then + * the setting is only deleted if the etag matches the current etag; this means that no one has updated the + * ConfigurationSetting yet. * *

Code Samples

* @@ -459,28 +476,28 @@ public Mono deleteSetting(String key) { * {@codesnippet com.azure.data.appconfiguration.configurationasyncclient.deleteSetting#ConfigurationSetting} * * @param setting The ConfigurationSetting to delete. - * @return The deleted ConfigurationSetting or {@code null} if didn't exist. {@code null} is also returned if - * the {@code key} is an invalid value or {@link ConfigurationSetting#etag() etag} is set but does not match the + * @return The deleted ConfigurationSetting or {@code null} if didn't exist. {@code null} is also returned if the + * {@code key} is an invalid value or {@link ConfigurationSetting#getETag() etag} is set but does not match the * current etag (which will also throw HttpResponseException described below). - * @throws IllegalArgumentException If {@link ConfigurationSetting#key() key} is {@code null}. + * @throws IllegalArgumentException If {@link ConfigurationSetting#getKey() key} is {@code null}. * @throws NullPointerException When {@code setting} is {@code null}. * @throws ResourceModifiedException If the ConfigurationSetting is locked. - * @throws ResourceNotFoundException If {@link ConfigurationSetting#etag() etag} is specified, not the wildcard + * @throws ResourceNotFoundException If {@link ConfigurationSetting#getETag() etag} is specified, not the wildcard * character, and does not match the current etag value. * @throws HttpResponseException If {@code key} is an empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono deleteSetting(ConfigurationSetting setting) { return withContext(context -> deleteSetting(setting, context)) - .flatMap(response -> Mono.justOrEmpty(response.value())); + .flatMap(response -> Mono.justOrEmpty(response.getValue())); } /** * Deletes the {@link ConfigurationSetting} with a matching key, along with the given label and etag. * - * If {@link ConfigurationSetting#etag() etag} is specified and is not the wildcard character ({@code "*"}), - * then the setting is only deleted if the etag matches the current etag; this means that no one has updated - * the ConfigurationSetting yet. + * If {@link ConfigurationSetting#getETag() etag} is specified and is not the wildcard character ({@code "*"}), then + * the setting is only deleted if the etag matches the current etag; this means that no one has updated the + * ConfigurationSetting yet. * *

Code Samples

* @@ -489,13 +506,13 @@ public Mono deleteSetting(ConfigurationSetting setting) { * {@codesnippet com.azure.data.appconfiguration.configurationasyncclient.deleteSettingWithResponse#ConfigurationSetting} * * @param setting The ConfigurationSetting to delete. - * @return A REST response containing the deleted ConfigurationSetting or {@code null} if didn't exist. {@code null} is also returned if - * the {@code key} is an invalid value or {@link ConfigurationSetting#etag() etag} is set but does not match the - * current etag (which will also throw HttpResponseException described below). - * @throws IllegalArgumentException If {@link ConfigurationSetting#key() key} is {@code null}. + * @return A REST response containing the deleted ConfigurationSetting or {@code null} if didn't exist. {@code null} + * is also returned if the {@code key} is an invalid value or {@link ConfigurationSetting#getETag() etag} is set but + * does not match the current etag (which will also throw HttpResponseException described below). + * @throws IllegalArgumentException If {@link ConfigurationSetting#getKey() key} is {@code null}. * @throws NullPointerException When {@code setting} is {@code null}. * @throws ResourceModifiedException If the ConfigurationSetting is locked. - * @throws ResourceNotFoundException If {@link ConfigurationSetting#etag() etag} is specified, not the wildcard + * @throws ResourceNotFoundException If {@link ConfigurationSetting#getETag() etag} is specified, not the wildcard * character, and does not match the current etag value. * @throws HttpResponseException If {@code key} is an empty string. */ @@ -508,9 +525,10 @@ Mono> deleteSetting(ConfigurationSetting setting, // Validate that setting and key is not null. The key is used in the service URL so it cannot be null. validateSetting(setting); - return service.delete(serviceEndpoint, setting.key(), setting.label(), getETagValue(setting.etag()), null, context) + return service.delete(serviceEndpoint, setting.getKey(), setting.getLabel(), getETagValue(setting.getETag()), + null, context) .doOnRequest(ignoredValue -> logger.info("Deleting ConfigurationSetting - {}", setting)) - .doOnSuccess(response -> logger.info("Deleted ConfigurationSetting - {}", response.value())) + .doOnSuccess(response -> logger.info("Deleted ConfigurationSetting - {}", response.getValue())) .doOnError(error -> logger.warning("Failed to delete ConfigurationSetting - {}", setting, error)); } @@ -559,11 +577,11 @@ private Mono> listFirstPageSettings(SettingS .doOnError(error -> logger.warning("Failed to list all ConfigurationSetting", error)); } - String fields = ImplUtils.arrayToString(options.fields(), SettingFields::toStringMapper); - String keys = ImplUtils.arrayToString(options.keys(), key -> key); - String labels = ImplUtils.arrayToString(options.labels(), label -> label); + String fields = ImplUtils.arrayToString(options.getFields(), SettingFields::toStringMapper); + String keys = ImplUtils.arrayToString(options.getKeys(), key -> key); + String labels = ImplUtils.arrayToString(options.getLabels(), label -> label); - return service.listKeyValues(serviceEndpoint, keys, labels, fields, options.acceptDateTime(), context) + return service.listKeyValues(serviceEndpoint, keys, labels, fields, options.getAcceptDateTime(), context) .doOnRequest(ignoredValue -> logger.info("Listing ConfigurationSettings - {}", options)) .doOnSuccess(response -> logger.info("Listed ConfigurationSettings - {}", options)) .doOnError(error -> logger.warning("Failed to list ConfigurationSetting - {}", options, error)); @@ -572,7 +590,7 @@ private Mono> listFirstPageSettings(SettingS /** * Lists chronological/historical representation of {@link ConfigurationSetting} resource(s). Revisions are provided - * in descending order from their {@link ConfigurationSetting#lastModified() lastModified} date. Revisions expire + * in descending order from their {@link ConfigurationSetting#getLastModified() lastModified} date. Revisions expire * after a period of time. The service maintains change history for up to 7 days. * * If {@code options} is {@code null}, then all the {@link ConfigurationSetting ConfigurationSettings} are fetched @@ -598,15 +616,18 @@ Mono> listSettingRevisionsFirstPage(SettingS Mono> result; if (selector != null) { - String fields = ImplUtils.arrayToString(selector.fields(), SettingFields::toStringMapper); - String keys = ImplUtils.arrayToString(selector.keys(), key -> key); - String labels = ImplUtils.arrayToString(selector.labels(), label -> label); - String range = selector.range() != null ? String.format(RANGE_QUERY, selector.range()) : null; - - result = service.listKeyValueRevisions(serviceEndpoint, keys, labels, fields, selector.acceptDateTime(), range, context) - .doOnRequest(ignoredValue -> logger.info("Listing ConfigurationSetting revisions - {}", selector)) - .doOnSuccess(response -> logger.info("Listed ConfigurationSetting revisions - {}", selector)) - .doOnError(error -> logger.warning("Failed to list ConfigurationSetting revisions - {}", selector, error)); + String fields = ImplUtils.arrayToString(selector.getFields(), SettingFields::toStringMapper); + String keys = ImplUtils.arrayToString(selector.getKeys(), key -> key); + String labels = ImplUtils.arrayToString(selector.getLabels(), label -> label); + String range = selector.getRange() != null ? String.format(RANGE_QUERY, selector.getRange()) : null; + + result = + service.listKeyValueRevisions( + serviceEndpoint, keys, labels, fields, selector.getAcceptDateTime(), range, context) + .doOnRequest(ignoredValue -> logger.info("Listing ConfigurationSetting revisions - {}", selector)) + .doOnSuccess(response -> logger.info("Listed ConfigurationSetting revisions - {}", selector)) + .doOnError( + error -> logger.warning("Failed to list ConfigurationSetting revisions - {}", selector, error)); } else { result = service.listKeyValueRevisions(serviceEndpoint, null, null, null, null, null, context) .doOnRequest(ignoredValue -> logger.info("Listing ConfigurationSetting revisions")) @@ -621,7 +642,8 @@ Mono> listSettingRevisionsNextPage(String ne Mono> result = service.listKeyValues(serviceEndpoint, nextPageLink, context) .doOnRequest(ignoredValue -> logger.info("Retrieving the next listing page - Page {}", nextPageLink)) .doOnSuccess(response -> logger.info("Retrieved the next listing page - Page {}", nextPageLink)) - .doOnError(error -> logger.warning("Failed to retrieve the next listing page - Page {}", nextPageLink, error)); + .doOnError(error -> logger.warning("Failed to retrieve the next listing page - Page {}", nextPageLink, + error)); return result; } @@ -635,12 +657,14 @@ private Flux listSettings(String nextPageLink, Context con Mono> result = service.listKeyValues(serviceEndpoint, nextPageLink, context) .doOnRequest(ignoredValue -> logger.info("Retrieving the next listing page - Page {}", nextPageLink)) .doOnSuccess(response -> logger.info("Retrieved the next listing page - Page {}", nextPageLink)) - .doOnError(error -> logger.warning("Failed to retrieve the next listing page - Page {}", nextPageLink, error)); + .doOnError(error -> logger.warning("Failed to retrieve the next listing page - Page {}", nextPageLink, + error)); return result.flatMapMany(r -> extractAndFetchConfigurationSettings(r, context)); } - private Publisher extractAndFetchConfigurationSettings(PagedResponse page, Context context) { + private Publisher extractAndFetchConfigurationSettings( + PagedResponse page, Context context) { return ImplUtils.extractAndFetch(page, context, this::listSettings); } @@ -660,7 +684,7 @@ private static String getETagValue(String etag) { private static void validateSetting(ConfigurationSetting setting) { Objects.requireNonNull(setting); - if (setting.key() == null) { + if (setting.getKey() == null) { throw new IllegalArgumentException("Parameter 'key' is required and cannot be null."); } } @@ -681,6 +705,6 @@ private static Throwable addSettingExceptionMapper(Throwable throwable) { } ResourceNotFoundException notFoundException = (ResourceNotFoundException) throwable; - return new ResourceModifiedException(notFoundException.getMessage(), notFoundException.response()); + return new ResourceModifiedException(notFoundException.getMessage(), notFoundException.getResponse()); } } diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClient.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClient.java index 33337dcb5734..b93faff66b51 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClient.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClient.java @@ -3,18 +3,18 @@ package com.azure.data.appconfiguration; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; import com.azure.core.implementation.annotation.ReturnType; import com.azure.core.implementation.annotation.ServiceClient; import com.azure.core.implementation.annotation.ServiceMethod; +import com.azure.core.util.Context; import com.azure.data.appconfiguration.credentials.ConfigurationClientCredentials; import com.azure.data.appconfiguration.models.ConfigurationSetting; import com.azure.data.appconfiguration.models.SettingSelector; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; /** * This class provides a client that contains all the operations for {@link ConfigurationSetting ConfigurationSettings} @@ -35,8 +35,8 @@ public final class ConfigurationClient { private final ConfigurationAsyncClient client; /** - * Creates a ConfigurationClient that sends requests to the configuration service at {@code serviceEndpoint}. - * Each service call goes through the {@code pipeline}. + * Creates a ConfigurationClient that sends requests to the configuration service at {@code serviceEndpoint}. Each + * service call goes through the {@code pipeline}. * * @param client The {@link ConfigurationAsyncClient} that the client routes its request through. */ @@ -51,7 +51,7 @@ public final class ConfigurationClient { * *

Add a setting with the key "prodDBConnection" and value "db_connection".

* - * {@codesnippet com.azure.data.applicationconfig.configurationclient.addSetting#string-string} + * {@codesnippet com.azure.data.appconfiguration.ConfigurationClient.addSetting#String-String} * * @param key The key of the configuration setting to add. * @param value The value associated with this configuration setting key. @@ -63,7 +63,7 @@ public final class ConfigurationClient { */ @ServiceMethod(returns = ReturnType.SINGLE) public ConfigurationSetting addSetting(String key, String value) { - return addSetting(new ConfigurationSetting().key(key).value(value), Context.NONE).value(); + return addSetting(new ConfigurationSetting().setKey(key).setValue(value), Context.NONE).getValue(); } /** @@ -74,19 +74,19 @@ public ConfigurationSetting addSetting(String key, String value) { * *

Add a setting with the key "prodDBConnection", label "westUS", and value "db_connection".

* - * {@codesnippet com.azure.data.applicationconfig.configurationclient.addSetting#ConfigurationSetting} + * {@codesnippet com.azure.data.appconfiguration.ConfigurationClient.addSetting#ConfigurationSetting} * * @param setting The setting to add to the configuration service. * @return The {@link ConfigurationSetting} that was created, or {@code null}, if a key collision occurs or the key * is an invalid value (which will also throw ServiceRequestException described below). * @throws NullPointerException If {@code setting} is {@code null}. - * @throws IllegalArgumentException If {@link ConfigurationSetting#key() key} is {@code null}. + * @throws IllegalArgumentException If {@link ConfigurationSetting#getKey() key} is {@code null}. * @throws ResourceModifiedException If a ConfigurationSetting with the same key and label exists. * @throws HttpResponseException If {@code key} is an empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) public ConfigurationSetting addSetting(ConfigurationSetting setting) { - return addSetting(setting, Context.NONE).value(); + return addSetting(setting, Context.NONE).getValue(); } /** @@ -97,14 +97,15 @@ public ConfigurationSetting addSetting(ConfigurationSetting setting) { * *

Add a setting with the key "prodDBConnection", label "westUS", and value "db_connection".

* - * {@codesnippet com.azure.data.applicationconfig.configurationclient.addSettingWithResponse#ConfigurationSetting-Context} + * {@codesnippet com.azure.data.appconfiguration.ConfigurationClient.addSettingWithResponse#ConfigurationSetting-Context} * * @param setting The setting to add to the configuration service. * @param context Additional context that is passed through the Http pipeline during the service call. - * @return A REST response containing the the {@link ConfigurationSetting} that was created, or {@code null}, if a key collision occurs or the key - * is an invalid value (which will also throw ServiceRequestException described below). + * @return A REST response containing the the {@link ConfigurationSetting} that was created, or {@code null}, if a + * key collision occurs or the key is an invalid value (which will also throw ServiceRequestException described + * below). * @throws NullPointerException If {@code setting} is {@code null}. - * @throws IllegalArgumentException If {@link ConfigurationSetting#key() key} is {@code null}. + * @throws IllegalArgumentException If {@link ConfigurationSetting#getKey() key} is {@code null}. * @throws ResourceModifiedException If a ConfigurationSetting with the same key and label exists. * @throws HttpResponseException If {@code key} is an empty string. */ @@ -124,7 +125,7 @@ private Response addSetting(ConfigurationSetting setting, * *

Add a setting with the key "prodDBConnection" and value "db_connection".

* - * {@codesnippet com.azure.data.applicationconfig.configurationclient.setSetting#string-string} + * {@codesnippet com.azure.data.appconfiguration.ConfigurationClient.setSetting#String-String} * * @param key The key of the configuration setting to create or update. * @param value The value of this configuration setting. @@ -136,52 +137,52 @@ private Response addSetting(ConfigurationSetting setting, */ @ServiceMethod(returns = ReturnType.SINGLE) public ConfigurationSetting setSetting(String key, String value) { - return setSetting(new ConfigurationSetting().key(key).value(value), Context.NONE).value(); + return setSettingWithResponse(new ConfigurationSetting().setKey(key).setValue(value), Context.NONE).getValue(); } /** * Creates or updates a configuration value in the service. Partial updates are not supported and the entire * configuration setting is updated. * - * If {@link ConfigurationSetting#etag() etag} is specified, the configuration value is updated if the current - * setting's etag matches. If the etag's value is equal to the wildcard character ({@code "*"}), the setting - * will always be updated. + * If {@link ConfigurationSetting#getETag() etag} is specified, the configuration value is updated if the current + * setting's etag matches. If the etag's value is equal to the wildcard character ({@code "*"}), the setting will + * always be updated. * *

Code Samples

* *

Add a setting with the key "prodDBConnection", label "westUS", and value "db_connection".

* - * {@codesnippet com.azure.data.applicationconfig.configurationclient.setSetting#ConfigurationSetting} + * {@codesnippet com.azure.data.appconfiguration.ConfigurationClient.setSetting#ConfigurationSetting} * * @param setting The configuration setting to create or update. * @return The {@link ConfigurationSetting} that was created or updated, or {@code null}, if the key is an invalid * value, the setting is locked, or an etag was provided but does not match the service's current etag value (which * will also throw ServiceRequestException described below). * @throws NullPointerException If {@code setting} is {@code null}. - * @throws IllegalArgumentException If {@link ConfigurationSetting#key() key} is {@code null}. - * @throws ResourceModifiedException If the {@link ConfigurationSetting#etag() etag} was specified, is not the - * wildcard character, and the current configuration value's etag does not match, or the - * setting exists and is locked. + * @throws IllegalArgumentException If {@link ConfigurationSetting#getKey() key} is {@code null}. + * @throws ResourceModifiedException If the {@link ConfigurationSetting#getETag() etag} was specified, is not the + * wildcard character, and the current configuration value's etag does not match, or the setting exists and is + * locked. * @throws HttpResponseException If {@code key} is an empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) public ConfigurationSetting setSetting(ConfigurationSetting setting) { - return setSetting(setting, Context.NONE).value(); + return setSettingWithResponse(setting, Context.NONE).getValue(); } /** * Creates or updates a configuration value in the service. Partial updates are not supported and the entire * configuration setting is updated. * - * If {@link ConfigurationSetting#etag() etag} is specified, the configuration value is updated if the current - * setting's etag matches. If the etag's value is equal to the wildcard character ({@code "*"}), the setting - * will always be updated. + * If {@link ConfigurationSetting#getETag() etag} is specified, the configuration value is updated if the current + * setting's etag matches. If the etag's value is equal to the wildcard character ({@code "*"}), the setting will + * always be updated. * *

Code Samples

* *

Add a setting with the key "prodDBConnection" and value "db_connection".

* - * {@codesnippet com.azure.data.applicationconfig.configurationclient.setSettingWithResponse#ConfigurationSetting-Context} + * {@codesnippet com.azure.data.appconfiguration.ConfigurationClient.setSettingWithResponse#ConfigurationSetting-Context} * * @param setting The configuration setting to create or update. * @param context Additional context that is passed through the Http pipeline during the service call. @@ -189,20 +190,15 @@ public ConfigurationSetting setSetting(ConfigurationSetting setting) { * value, the setting is locked, or an etag was provided but does not match the service's current etag value (which * will also throw ServiceRequestException described below). * @throws NullPointerException If {@code setting} is {@code null}. - * @throws IllegalArgumentException If {@link ConfigurationSetting#key() key} is {@code null}. - * @throws ResourceModifiedException If the {@link ConfigurationSetting#etag() etag} was specified, is not the - * wildcard character, and the current configuration value's etag does not match, or the - * setting exists and is locked. + * @throws IllegalArgumentException If {@link ConfigurationSetting#getKey() key} is {@code null}. + * @throws ResourceModifiedException If the {@link ConfigurationSetting#getETag() etag} was specified, is not the + * wildcard character, and the current configuration value's etag does not match, or the setting exists and is + * locked. * @throws HttpResponseException If {@code key} is an empty string. */ public Response setSettingWithResponse(ConfigurationSetting setting, Context context) { return client.setSetting(setting, context).block(); } - - private Response setSetting(ConfigurationSetting setting, Context context) { - return client.setSetting(setting, context).block(); - } - /** * Updates an existing configuration value in the service with the given key. The setting must already exist. * @@ -210,70 +206,77 @@ private Response setSetting(ConfigurationSetting setting, * *

Update a setting with the key "prodDBConnection" to have the value "updated_db_connection".

* - * {@codesnippet com.azure.data.applicationconfig.configurationclient.updateSetting#string-string} + * {@codesnippet com.azure.data.appconfiguration.ConfigurationClient.updateSetting#String-String} * * @param key The key of the configuration setting to update. * @param value The updated value of this configuration setting. * @return The {@link ConfigurationSetting} that was updated, or {@code null}, if the configuration value does not - * exist, is locked, or the key is an invalid value (which will also throw ServiceRequestException described below). + * exist, is locked, or the key is an invalid value (which will also throw ServiceRequestException described + * below). * @throws IllegalArgumentException If {@code key} is {@code null}. - * @throws HttpResponseException If a ConfigurationSetting with the key does not exist or the configuration value - * is locked. + * @throws HttpResponseException If a ConfigurationSetting with the key does not exist or the configuration value is + * locked. * @throws HttpResponseException If {@code key} is an empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) public ConfigurationSetting updateSetting(String key, String value) { - return updateSetting(new ConfigurationSetting().key(key).value(value), Context.NONE).value(); + return updateSetting(new ConfigurationSetting().setKey(key).setValue(value), Context.NONE).getValue(); } /** * Updates an existing configuration value in the service. The setting must already exist. Partial updates are not * supported, the entire configuration value is replaced. * - * If {@link ConfigurationSetting#etag() etag} is specified, the configuration value is only updated if it matches. + * If {@link ConfigurationSetting#getETag() etag} is specified, the configuration value is only updated if it + * matches. * *

Code Samples

* - *

Update the setting with the key-label pair "prodDBConnection"-"westUS" to have the value "updated_db_connection".

+ *

Update the setting with the key-label pair "prodDBConnection"-"westUS" to have the value + * "updated_db_connection".

* * {@codesnippet com.azure.data.applicationconfig.configurationclient.updateSetting#ConfigurationSetting} * * @param setting The setting to add or update in the service. * @return The {@link ConfigurationSetting} that was updated, or {@code null}, if the configuration value does not - * exist, is locked, or the key is an invalid value (which will also throw ServiceRequestException described below). + * exist, is locked, or the key is an invalid value (which will also throw ServiceRequestException described + * below). * @throws NullPointerException If {@code setting} is {@code null}. - * @throws IllegalArgumentException If {@link ConfigurationSetting#key() key} is {@code null}. - * @throws ResourceModifiedException If a ConfigurationSetting with the same key and label does not - * exist, the setting is locked, or {@link ConfigurationSetting#etag() etag} is specified but does not match - * the current value. + * @throws IllegalArgumentException If {@link ConfigurationSetting#getKey() key} is {@code null}. + * @throws ResourceModifiedException If a ConfigurationSetting with the same key and label does not exist, the + * setting is locked, or {@link ConfigurationSetting#getETag() etag} is specified but does not match the current + * value. * @throws HttpResponseException If {@code key} is an empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) public ConfigurationSetting updateSetting(ConfigurationSetting setting) { - return updateSetting(setting, Context.NONE).value(); + return updateSetting(setting, Context.NONE).getValue(); } /** * Updates an existing configuration value in the service. The setting must already exist. Partial updates are not * supported, the entire configuration value is replaced. * - * If {@link ConfigurationSetting#etag() etag} is specified, the configuration value is only updated if it matches. + * If {@link ConfigurationSetting#getETag() etag} is specified, the configuration value is only updated if it + * matches. * *

Code Samples

* - *

Update the setting with the key-label pair "prodDBConnection"-"westUS" to have the value "updated_db_connection".

+ *

Update the setting with the key-label pair "prodDBConnection"-"westUS" to have the value + * "updated_db_connection".

* * {@codesnippet com.azure.data.applicationconfig.configurationclient.updateSettingWithResponse#ConfigurationSetting-Context} * * @param setting The setting to add or update in the service. * @param context Additional context that is passed through the Http pipeline during the service call. - * @return A REST response containing the {@link ConfigurationSetting} that was updated, or {@code null}, if the configuration value does not - * exist, is locked, or the key is an invalid value (which will also throw ServiceRequestException described below). + * @return A REST response containing the {@link ConfigurationSetting} that was updated, or {@code null}, if the + * configuration value does not exist, is locked, or the key is an invalid value (which will also throw + * ServiceRequestException described below). * @throws NullPointerException If {@code setting} is {@code null}. - * @throws IllegalArgumentException If {@link ConfigurationSetting#key() key} is {@code null}. - * @throws ResourceModifiedException If a ConfigurationSetting with the same key and label does not - * exist, the setting is locked, or {@link ConfigurationSetting#etag() etag} is specified but does not match - * the current value. + * @throws IllegalArgumentException If {@link ConfigurationSetting#getKey() key} is {@code null}. + * @throws ResourceModifiedException If a ConfigurationSetting with the same key and label does not exist, the + * setting is locked, or {@link ConfigurationSetting#getETag() etag} is specified but does not match the current + * value. * @throws HttpResponseException If {@code key} is an empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -303,7 +306,7 @@ private Response updateSetting(ConfigurationSetting settin */ @ServiceMethod(returns = ReturnType.SINGLE) public ConfigurationSetting getSetting(String key) { - return getSetting(new ConfigurationSetting().key(key), Context.NONE).value(); + return getSetting(new ConfigurationSetting().setKey(key), Context.NONE).getValue(); } /** @@ -319,13 +322,13 @@ public ConfigurationSetting getSetting(String key) { * @return The {@link ConfigurationSetting} stored in the service, or {@code null}, if the configuration value does * not exist or the key is an invalid value (which will also throw ServiceRequestException described below). * @throws NullPointerException If {@code setting} is {@code null}. - * @throws IllegalArgumentException If {@link ConfigurationSetting#key() key} is {@code null}. + * @throws IllegalArgumentException If {@link ConfigurationSetting#getKey() key} is {@code null}. * @throws ResourceNotFoundException If a ConfigurationSetting with the same key and label does not exist. * @throws HttpResponseException If the {@code} key is an empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) public ConfigurationSetting getSetting(ConfigurationSetting setting) { - return getSetting(setting, Context.NONE).value(); + return getSetting(setting, Context.NONE).getValue(); } /** @@ -339,10 +342,11 @@ public ConfigurationSetting getSetting(ConfigurationSetting setting) { * * @param setting The setting to retrieve based on its key and optional label combination. * @param context Additional context that is passed through the Http pipeline during the service call. - * @return A REST response containg the {@link ConfigurationSetting} stored in the service, or {@code null}, if the configuration value does - * not exist or the key is an invalid value (which will also throw ServiceRequestException described below). + * @return A REST response containg the {@link ConfigurationSetting} stored in the service, or {@code null}, if the + * configuration value does not exist or the key is an invalid value (which will also throw ServiceRequestException + * described below). * @throws NullPointerException If {@code setting} is {@code null}. - * @throws IllegalArgumentException If {@link ConfigurationSetting#key() key} is {@code null}. + * @throws IllegalArgumentException If {@link ConfigurationSetting#getKey() key} is {@code null}. * @throws ResourceNotFoundException If a ConfigurationSetting with the same key and label does not exist. * @throws HttpResponseException If the {@code} key is an empty string. */ @@ -365,23 +369,23 @@ private Response getSetting(ConfigurationSetting setting, * {@codesnippet com.azure.data.applicationconfig.configurationclient.deleteSetting#string} * * @param key The key of the setting to delete. - * @return The deleted ConfigurationSetting or {@code null} if it didn't exist. {@code null} is also returned if - * the {@code key} is an invalid value (which will also throw ServiceRequestException described below). + * @return The deleted ConfigurationSetting or {@code null} if it didn't exist. {@code null} is also returned if the + * {@code key} is an invalid value (which will also throw ServiceRequestException described below). * @throws IllegalArgumentException If {@code key} is {@code null}. * @throws ResourceModifiedException If the ConfigurationSetting is locked. * @throws HttpResponseException If {@code key} is an empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) public ConfigurationSetting deleteSetting(String key) { - return deleteSetting(new ConfigurationSetting().key(key), Context.NONE).value(); + return deleteSetting(new ConfigurationSetting().setKey(key), Context.NONE).getValue(); } /** * Deletes the {@link ConfigurationSetting} with a matching key, along with the given label and etag. * - * If {@link ConfigurationSetting#etag() etag} is specified and is not the wildcard character ({@code "*"}), - * then the setting is only deleted if the etag matches the current etag; this means that no one has updated - * the ConfigurationSetting yet. + * If {@link ConfigurationSetting#getETag() etag} is specified and is not the wildcard character ({@code "*"}), then + * the setting is only deleted if the etag matches the current etag; this means that no one has updated the + * ConfigurationSetting yet. * *

Code Samples

* @@ -390,27 +394,27 @@ public ConfigurationSetting deleteSetting(String key) { * {@codesnippet com.azure.data.applicationconfig.configurationclient.deleteSetting#ConfigurationSetting} * * @param setting The ConfigurationSetting to delete. - * @return The deleted ConfigurationSetting or {@code null} if didn't exist. {@code null} is also returned if - * the {@code key} is an invalid value or {@link ConfigurationSetting#etag() etag} is set but does not match the + * @return The deleted ConfigurationSetting or {@code null} if didn't exist. {@code null} is also returned if the + * {@code key} is an invalid value or {@link ConfigurationSetting#getETag() etag} is set but does not match the * current etag (which will also throw ServiceRequestException described below). - * @throws IllegalArgumentException If {@link ConfigurationSetting#key() key} is {@code null}. + * @throws IllegalArgumentException If {@link ConfigurationSetting#getKey() key} is {@code null}. * @throws NullPointerException When {@code setting} is {@code null}. * @throws ResourceModifiedException If the ConfigurationSetting is locked. - * @throws ResourceNotFoundException If {@link ConfigurationSetting#etag() etag} is specified, not the wildcard + * @throws ResourceNotFoundException If {@link ConfigurationSetting#getETag() etag} is specified, not the wildcard * character, and does not match the current etag value. * @throws HttpResponseException If {@code key} is an empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) public ConfigurationSetting deleteSetting(ConfigurationSetting setting) { - return deleteSetting(setting, Context.NONE).value(); + return deleteSetting(setting, Context.NONE).getValue(); } /** * Deletes the {@link ConfigurationSetting} with a matching key, along with the given label and etag. * - * If {@link ConfigurationSetting#etag() etag} is specified and is not the wildcard character ({@code "*"}), - * then the setting is only deleted if the etag matches the current etag; this means that no one has updated - * the ConfigurationSetting yet. + * If {@link ConfigurationSetting#getETag() etag} is specified and is not the wildcard character ({@code "*"}), then + * the setting is only deleted if the etag matches the current etag; this means that no one has updated the + * ConfigurationSetting yet. * *

Code Samples

* @@ -420,13 +424,13 @@ public ConfigurationSetting deleteSetting(ConfigurationSetting setting) { * * @param setting The ConfigurationSetting to delete. * @param context Additional context that is passed through the Http pipeline during the service call. - * @return A REST response containing the deleted ConfigurationSetting or {@code null} if didn't exist. {@code null} is also returned if - * the {@code key} is an invalid value or {@link ConfigurationSetting#etag() etag} is set but does not match the - * current etag (which will also throw ServiceRequestException described below). - * @throws IllegalArgumentException If {@link ConfigurationSetting#key() key} is {@code null}. + * @return A REST response containing the deleted ConfigurationSetting or {@code null} if didn't exist. {@code null} + * is also returned if the {@code key} is an invalid value or {@link ConfigurationSetting#getETag() etag} is set but + * does not match the current etag (which will also throw ServiceRequestException described below). + * @throws IllegalArgumentException If {@link ConfigurationSetting#getKey() key} is {@code null}. * @throws NullPointerException When {@code setting} is {@code null}. * @throws ResourceModifiedException If the ConfigurationSetting is locked. - * @throws ResourceNotFoundException If {@link ConfigurationSetting#etag() etag} is specified, not the wildcard + * @throws ResourceNotFoundException If {@link ConfigurationSetting#getETag() etag} is specified, not the wildcard * character, and does not match the current etag value. * @throws HttpResponseException If {@code key} is an empty string. */ @@ -450,8 +454,8 @@ private Response deleteSetting(ConfigurationSetting settin * {@codesnippet com.azure.data.applicationconfig.configurationclient.listSettings#settingSelector} * * @param options Optional. Options to filter configuration setting results from the service. - * @return A {@link PagedIterable} of ConfigurationSettings that matches the {@code options}. If no options were provided, the List - * contains all of the current settings in the service. + * @return A {@link PagedIterable} of ConfigurationSettings that matches the {@code options}. If no options were + * provided, the List contains all of the current settings in the service. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listSettings(SettingSelector options) { @@ -470,8 +474,8 @@ public PagedIterable listSettings(SettingSelector options) * * @param options Optional. Options to filter configuration setting results from the service. * @param context Additional context that is passed through the Http pipeline during the service call. - * @return A {@link PagedIterable} of ConfigurationSettings that matches the {@code options}. If no options were provided, the {@link PagedIterable} - * contains all of the current settings in the service. + * @return A {@link PagedIterable} of ConfigurationSettings that matches the {@code options}. If no options were + * provided, the {@link PagedIterable} contains all of the current settings in the service. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listSettings(SettingSelector options, Context context) { @@ -480,7 +484,7 @@ public PagedIterable listSettings(SettingSelector options, /** * Lists chronological/historical representation of {@link ConfigurationSetting} resource(s). Revisions are provided - * in descending order from their {@link ConfigurationSetting#lastModified() lastModified} date. Revisions expire + * in descending order from their {@link ConfigurationSetting#getLastModified() lastModified} date. Revisions expire * after a period of time. The service maintains change history for up to 7 days. * * If {@code options} is {@code null}, then all the {@link ConfigurationSetting ConfigurationSettings} are fetched @@ -502,7 +506,7 @@ public PagedIterable listSettingRevisions(SettingSelector /** * Lists chronological/historical representation of {@link ConfigurationSetting} resource(s). Revisions are provided - * in descending order from their {@link ConfigurationSetting#lastModified() lastModified} date. Revisions expire + * in descending order from their {@link ConfigurationSetting#getLastModified() lastModified} date. Revisions expire * after a period of time. The service maintains change history for up to 7 days. * * If {@code options} is {@code null}, then all the {@link ConfigurationSetting ConfigurationSettings} are fetched diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java index 41d70711b853..d1d4d8734d5f 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java @@ -83,7 +83,7 @@ public final class ConfigurationClientBuilder { private HttpClient httpClient; private HttpLogDetailLevel httpLogDetailLevel; private HttpPipeline pipeline; - private RetryPolicy retryPolicy; + private final RetryPolicy retryPolicy; private Configuration configuration; /** @@ -110,8 +110,8 @@ public ConfigurationClientBuilder() { * * @return A ConfigurationClient with the options set from the builder. * @throws NullPointerException If {@code endpoint} has not been set. This setting is automatically set when - * {@link #credential(ConfigurationClientCredentials) credential} are set through the builder. Or can be set - * explicitly by calling {@link #endpoint(String)}. + * {@link #credential(ConfigurationClientCredentials) credential} are set through the builder. Or can be set + * explicitly by calling {@link #endpoint(String)}. * @throws IllegalStateException If {@link #credential(ConfigurationClientCredentials)} has not been set. */ public ConfigurationClient buildClient() { @@ -130,12 +130,13 @@ public ConfigurationClient buildClient() { * * @return A ConfigurationAsyncClient with the options set from the builder. * @throws NullPointerException If {@code endpoint} has not been set. This setting is automatically set when - * {@link #credential(ConfigurationClientCredentials) credential} are set through the builder. Or can be set - * explicitly by calling {@link #endpoint(String)}. + * {@link #credential(ConfigurationClientCredentials) credential} are set through the builder. Or can be set + * explicitly by calling {@link #endpoint(String)}. * @throws IllegalStateException If {@link #credential(ConfigurationClientCredentials)} has not been set. */ public ConfigurationAsyncClient buildAsyncClient() { - Configuration buildConfiguration = (configuration == null) ? ConfigurationManager.getConfiguration().clone() : configuration; + Configuration buildConfiguration = + (configuration == null) ? ConfigurationManager.getConfiguration().clone() : configuration; ConfigurationClientCredentials configurationCredentials = getConfigurationCredentials(buildConfiguration); URL buildEndpoint = getBuildEndpoint(configurationCredentials); @@ -178,7 +179,7 @@ public ConfigurationAsyncClient buildAsyncClient() { * Sets the service endpoint for the Azure App Configuration instance. * * @param endpoint The URL of the Azure App Configuration instance to send {@link ConfigurationSetting} - * service requests to and receive responses from. + * service requests to and receive responses from. * @return The updated ConfigurationClientBuilder object. * @throws IllegalArgumentException if {@code endpoint} is null or it cannot be parsed into a valid URL. */ @@ -202,7 +203,7 @@ public ConfigurationClientBuilder endpoint(String endpoint) { */ public ConfigurationClientBuilder credential(ConfigurationClientCredentials credential) { this.credential = Objects.requireNonNull(credential); - this.endpoint = credential.baseUri(); + this.endpoint = credential.getBaseUri(); return this; } @@ -250,7 +251,8 @@ public ConfigurationClientBuilder httpClient(HttpClient client) { * Sets the HTTP pipeline to use for the service client. * * If {@code pipeline} is set, all other settings are ignored, aside from - * {@link ConfigurationClientBuilder#endpoint(String) endpoint} to build {@link ConfigurationAsyncClient} or {@link ConfigurationClient}. + * {@link ConfigurationClientBuilder#endpoint(String) endpoint} to build {@link ConfigurationAsyncClient} or {@link + * ConfigurationClient}. * * @param pipeline The HTTP pipeline to use for sending service requests and receiving responses. * @return The updated ConfigurationClientBuilder object. @@ -295,7 +297,7 @@ private URL getBuildEndpoint(ConfigurationClientCredentials buildCredentials) { if (endpoint != null) { return endpoint; } else if (buildCredentials != null) { - return buildCredentials.baseUri(); + return buildCredentials.getBaseUri(); } else { return null; } diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationService.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationService.java index 20a1f59d4f20..a5e39c5863bf 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationService.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationService.java @@ -40,67 +40,98 @@ interface ConfigurationService { @ExpectedResponses({200}) @UnexpectedResponseExceptionType(code = {404}, value = ResourceNotFoundException.class) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getKeyValue(@HostParam("url") String url, @PathParam("key") String key, @QueryParam("label") String label, - @QueryParam("$select") String fields, @HeaderParam("Accept-Datetime") String acceptDatetime, - @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, - Context context); + Mono> getKeyValue( + @HostParam("url") String url, + @PathParam("key") String key, + @QueryParam("label") String label, + @QueryParam("$select") String fields, + @HeaderParam("Accept-Datetime") String acceptDatetime, + @HeaderParam("If-Match") String ifMatch, + @HeaderParam("If-None-Match") String ifNoneMatch, + Context context); @Put("kv/{key}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(code = {409}, value = ResourceModifiedException.class) @UnexpectedResponseExceptionType(code = {412}, value = ResourceNotFoundException.class) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> setKey(@HostParam("url") String url, @PathParam("key") String key, @QueryParam("label") String label, - @BodyParam(ContentType.APPLICATION_JSON) ConfigurationSetting keyValueParameters, - @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, - Context context); + Mono> setKey( + @HostParam("url") String url, + @PathParam("key") String key, + @QueryParam("label") String label, + @BodyParam(ContentType.APPLICATION_JSON) ConfigurationSetting keyValueParameters, + @HeaderParam("If-Match") String ifMatch, + @HeaderParam("If-None-Match") String ifNoneMatch, + Context context); @Delete("kv/{key}") @ExpectedResponses({200, 204}) @UnexpectedResponseExceptionType(code = {409}, value = ResourceModifiedException.class) @UnexpectedResponseExceptionType(code = {412}, value = ResourceNotFoundException.class) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> delete(@HostParam("url") String url, @PathParam("key") String key, @QueryParam("label") String label, - @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, - Context context); + Mono> delete( + @HostParam("url") String url, + @PathParam("key") String key, + @QueryParam("label") String label, + @HeaderParam("If-Match") String ifMatch, + @HeaderParam("If-None-Match") String ifNoneMatch, + Context context); @Put("locks/{key}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(code = {404}, value = ResourceNotFoundException.class) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> lockKeyValue(@HostParam("url") String url, @PathParam("key") String key, @QueryParam("label") String label, - @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, - Context context); + Mono> lockKeyValue( + @HostParam("url") String url, + @PathParam("key") String key, + @QueryParam("label") String label, + @HeaderParam("If-Match") String ifMatch, + @HeaderParam("If-None-Match") String ifNoneMatch, + Context context); @Delete("locks/{key}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(code = {404}, value = ResourceNotFoundException.class) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> unlockKeyValue(@HostParam("url") String url, @PathParam("key") String key, @QueryParam("label") String label, - @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, - Context context); + Mono> unlockKeyValue( + @HostParam("url") String url, + @PathParam("key") String key, + @QueryParam("label") String label, + @HeaderParam("If-Match") String ifMatch, + @HeaderParam("If-None-Match") String ifNoneMatch, + Context context); @Get("kv") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(HttpResponseException.class) @ReturnValueWireType(ConfigurationSettingPage.class) - Mono> listKeyValues(@HostParam("url") String url, @QueryParam("key") String key, @QueryParam("label") String label, - @QueryParam("$select") String fields, @HeaderParam("Accept-Datetime") String acceptDatetime, - Context context); + Mono> listKeyValues( + @HostParam("url") String url, + @QueryParam("key") String key, + @QueryParam("label") String label, + @QueryParam("$select") String fields, + @HeaderParam("Accept-Datetime") String acceptDatetime, + Context context); @Get("{nextUrl}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(HttpResponseException.class) @ReturnValueWireType(ConfigurationSettingPage.class) - Mono> listKeyValues(@HostParam("url") String url, @PathParam(value = "nextUrl", encoded = true) String nextUrl, - Context context); + Mono> listKeyValues( + @HostParam("url") String url, + @PathParam(value = "nextUrl", encoded = true) String nextUrl, + Context context); @Get("revisions") @ExpectedResponses({200, 206}) @UnexpectedResponseExceptionType(HttpResponseException.class) @ReturnValueWireType(ConfigurationSettingPage.class) - Mono> listKeyValueRevisions(@HostParam("url") String url, @QueryParam("key") String key, - @QueryParam("label") String label, @QueryParam("$select") String fields, - @HeaderParam("Accept-Datetime") String acceptDatetime, @HeaderParam("Range") String range, - Context context); + Mono> listKeyValueRevisions( + @HostParam("url") String url, + @QueryParam("key") String key, + @QueryParam("label") String label, + @QueryParam("$select") String fields, + @HeaderParam("Accept-Datetime") String acceptDatetime, + @HeaderParam("Range") String range, + Context context); } diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/credentials/ConfigurationClientCredentials.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/credentials/ConfigurationClientCredentials.java index 6370024bb578..eb94c806a724 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/credentials/ConfigurationClientCredentials.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/credentials/ConfigurationClientCredentials.java @@ -2,10 +2,10 @@ // Licensed under the MIT License. package com.azure.data.appconfiguration.credentials; +import com.azure.core.util.logging.ClientLogger; import com.azure.data.appconfiguration.ConfigurationClientBuilder; import com.azure.data.appconfiguration.policy.ConfigurationCredentialsPolicy; import com.azure.core.implementation.util.ImplUtils; -import io.netty.buffer.ByteBuf; import reactor.core.Exceptions; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -14,6 +14,7 @@ import javax.crypto.spec.SecretKeySpec; import java.net.MalformedURLException; import java.net.URL; +import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.security.InvalidKeyException; import java.security.MessageDigest; @@ -37,6 +38,8 @@ * @see ConfigurationClientBuilder */ public class ConfigurationClientCredentials { + private final ClientLogger logger = new ClientLogger(ConfigurationClientCredentials.class); + private static final String HOST_HEADER = "Host"; private static final String DATE_HEADER = "Date"; private static final String CONTENT_HASH_HEADER = "x-ms-content-sha256"; @@ -49,11 +52,14 @@ public class ConfigurationClientCredentials { /** * Creates an instance that is able to authorize requests to Azure App Configuration service. * - * @param connectionString Connection string in the format "endpoint={endpoint_value};id={id_value};secret={secret_value}" + * @param connectionString Connection string in the format "endpoint={endpoint_value};id={id_value}; + * secret={secret_value}" * @throws NoSuchAlgorithmException When the HMAC-SHA256 MAC algorithm cannot be instantiated. - * @throws InvalidKeyException When the {@code connectionString} secret is invalid and cannot instantiate the HMAC-SHA256 algorithm. + * @throws InvalidKeyException When the {@code connectionString} secret is invalid and cannot instantiate the + * HMAC-SHA256 algorithm. */ - public ConfigurationClientCredentials(String connectionString) throws InvalidKeyException, NoSuchAlgorithmException { + public ConfigurationClientCredentials(String connectionString) + throws InvalidKeyException, NoSuchAlgorithmException { credentials = new CredentialInformation(connectionString); headerProvider = new AuthorizationHeaderProvider(credentials); } @@ -63,7 +69,7 @@ public ConfigurationClientCredentials(String connectionString) throws InvalidKey * * @return The base URI of the configuration service extracted from connection string provided. */ - public URL baseUri() { + public URL getBaseUri() { return this.credentials.baseUri(); } @@ -75,35 +81,42 @@ public URL baseUri() { * @return a flux of headers to add for authorization * @throws NoSuchAlgorithmException If the SHA-256 algorithm doesn't exist. */ - public Mono> getAuthorizationHeadersAsync(URL url, String httpMethod, Flux contents) { + public Mono> getAuthorizationHeadersAsync(URL url, String httpMethod, + Flux contents) { return contents .collect(() -> { try { return MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { - throw Exceptions.propagate(e); + throw logger.logExceptionAsError(Exceptions.propagate(e)); } }, (messageDigest, byteBuffer) -> { if (messageDigest != null) { - messageDigest.update(byteBuffer.nioBuffer()); + messageDigest.update(byteBuffer); } }) - .flatMap(messageDigest -> Mono.just(headerProvider.getAuthenticationHeaders(url, httpMethod, messageDigest))); + .flatMap(messageDigest -> Mono.just(headerProvider.getAuthenticationHeaders( + url, + httpMethod, + messageDigest))); } private static class AuthorizationHeaderProvider { private final String signedHeadersValue = String.join(";", SIGNED_HEADERS); + private static final String HMAC_SHA256 = "HMAC-SHA256 Credential=%s, SignedHeaders=%s, Signature=%s"; private final CredentialInformation credentials; private final Mac sha256HMAC; - AuthorizationHeaderProvider(CredentialInformation credentials) throws NoSuchAlgorithmException, InvalidKeyException { + AuthorizationHeaderProvider(CredentialInformation credentials) + throws NoSuchAlgorithmException, InvalidKeyException { this.credentials = credentials; sha256HMAC = Mac.getInstance("HmacSHA256"); sha256HMAC.init(new SecretKeySpec(credentials.secret(), "HmacSHA256")); } - private Map getAuthenticationHeaders(final URL url, final String httpMethod, final MessageDigest messageDigest) { + private Map getAuthenticationHeaders(final URL url, final String httpMethod, + final MessageDigest messageDigest) { final Map headers = new HashMap<>(); final String contentHash = Base64.getEncoder().encodeToString(messageDigest.digest()); @@ -136,11 +149,10 @@ private void addSignatureHeader(final URL url, final String httpMethod, final Ma // The line separator has to be \n. Using %n with String.format will result in a 401 from the service. String stringToSign = httpMethod.toUpperCase(Locale.US) + "\n" + pathAndQuery + "\n" + signed; - final String signature = Base64.getEncoder().encodeToString(sha256HMAC.doFinal(stringToSign.getBytes(StandardCharsets.UTF_8))); - httpHeaders.put(AUTHORIZATION_HEADER, String.format("HMAC-SHA256 Credential=%s, SignedHeaders=%s, Signature=%s", - credentials.id(), - signedHeadersValue, - signature)); + final String signature = + Base64.getEncoder().encodeToString(sha256HMAC.doFinal(stringToSign.getBytes(StandardCharsets.UTF_8))); + httpHeaders.put(AUTHORIZATION_HEADER, + String.format(HMAC_SHA256, credentials.id(), signedHeadersValue, signature)); } } @@ -149,9 +161,9 @@ private static class CredentialInformation { private static final String ID = "id="; private static final String SECRET = "secret="; - private URL baseUri; - private String id; - private byte[] secret; + private final URL baseUri; + private final String id; + private final byte[] secret; URL baseUri() { return baseUri; @@ -175,24 +187,32 @@ byte[] secret() { throw new IllegalArgumentException("invalid connection string segment count"); } + URL baseUri = null; + String id = null; + byte[] secret = null; + for (String arg : args) { String segment = arg.trim(); String lowerCase = segment.toLowerCase(Locale.US); if (lowerCase.startsWith(ENDPOINT)) { try { - this.baseUri = new URL(segment.substring(ENDPOINT.length())); + baseUri = new URL(segment.substring(ENDPOINT.length())); } catch (MalformedURLException ex) { throw new IllegalArgumentException(ex); } } else if (lowerCase.startsWith(ID)) { - this.id = segment.substring(ID.length()); + id = segment.substring(ID.length()); } else if (lowerCase.startsWith(SECRET)) { String secretBase64 = segment.substring(SECRET.length()); - this.secret = Base64.getDecoder().decode(secretBase64); + secret = Base64.getDecoder().decode(secretBase64); } } + this.baseUri = baseUri; + this.id = id; + this.secret = secret; + if (this.baseUri == null || this.id == null || this.secret == null) { throw new IllegalArgumentException("Could not parse 'connectionString'." + " Expected format: 'endpoint={endpoint};id={id};secret={secret}'. Actual:" + connectionString); diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingPage.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingPage.java index 3ee39c33eff7..bd45c81f8352 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingPage.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingPage.java @@ -25,7 +25,7 @@ public final class ConfigurationSettingPage implements Page items() { + public List getItems() { return items; } } diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/ConfigurationSetting.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/ConfigurationSetting.java index 27be16892dea..e6cbfc83005c 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/ConfigurationSetting.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/ConfigurationSetting.java @@ -11,15 +11,14 @@ import java.util.Objects; /** - * ConfigurationSetting is a resource identified by unique combination of {@link #key() key} and {@link #label() label}. - * By default, the label is {@code null}. To explicitly reference the default label use {@link #NO_LABEL}. + * ConfigurationSetting is a resource identified by unique combination of {@link #getKey() key} and {@link #getLabel() + * label}. By default, the label is {@code null}. To explicitly reference the default label use {@link #NO_LABEL}. */ @Fluent public class ConfigurationSetting { /** - * The default label for configuration settings is the label, "\0". - * Users use this value when they want to explicitly reference a configuration setting that has no label. - * This gets URL encoded as "%00". + * The default label for configuration settings is the label, "\0". Users use this value when they want to + * explicitly reference a configuration setting that has no label. This gets URL encoded as "%00". */ public static final String NO_LABEL = "\0"; @@ -58,7 +57,7 @@ public ConfigurationSetting() { * * @return The key for this configuration setting. */ - public String key() { + public String getKey() { return key; } @@ -68,7 +67,7 @@ public String key() { * @param key The name of the configuration key. * @return ConfigurationSetting object itself. */ - public ConfigurationSetting key(String key) { + public ConfigurationSetting setKey(String key) { this.key = key; return this; } @@ -78,18 +77,18 @@ public ConfigurationSetting key(String key) { * * @return The label of this setting. */ - public String label() { + public String getLabel() { return label; } /** - * Sets the label of this configuration setting. {@link #NO_LABEL} is the default label used when this value is - * not set. + * Sets the label of this configuration setting. {@link #NO_LABEL} is the default label used when this value is not + * set. * * @param label The label of this configuration setting. * @return The updated ConfigurationSetting object. */ - public ConfigurationSetting label(String label) { + public ConfigurationSetting setLabel(String label) { this.label = label; return this; } @@ -99,7 +98,7 @@ public ConfigurationSetting label(String label) { * * @return The value of this configuration setting. */ - public String value() { + public String getValue() { return value; } @@ -109,7 +108,7 @@ public String value() { * @param value The value to associate with this configuration setting. * @return The updated ConfigurationSetting object. */ - public ConfigurationSetting value(String value) { + public ConfigurationSetting setValue(String value) { this.value = value; return this; } @@ -119,7 +118,7 @@ public ConfigurationSetting value(String value) { * * @return The content type of this setting. */ - public String contentType() { + public String getContentType() { return contentType; } @@ -129,7 +128,7 @@ public String contentType() { * @param contentType The content type of this configuration setting. * @return The updated ConfigurationSetting object. */ - public ConfigurationSetting contentType(String contentType) { + public ConfigurationSetting setContentType(String contentType) { this.contentType = contentType; return this; } @@ -139,7 +138,7 @@ public ConfigurationSetting contentType(String contentType) { * * @return etag The etag for the setting. */ - public String etag() { + public String getETag() { return etag; } @@ -149,7 +148,7 @@ public String etag() { * @param etag The etag for the configuration setting. * @return The updated ConfigurationSetting object. */ - public ConfigurationSetting etag(String etag) { + public ConfigurationSetting setETag(String etag) { this.etag = etag; return this; } @@ -159,7 +158,7 @@ public ConfigurationSetting etag(String etag) { * * @return The time when the configuration was last modified. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { return lastModified; } @@ -167,8 +166,7 @@ public OffsetDateTime lastModified() { * Gets whether or not the configuration setting is locked. If the setting is locked, then no modifications can be * made to this setting. * - * This is a readonly property. It is populated from responses from the Azure App Configuration - * service. + * This is a readonly property. It is populated from responses from the Azure App Configuration service. * * @return true if locked; false otherwise. */ @@ -181,7 +179,7 @@ public boolean isLocked() { * * @return tags Gets tags for this configuration setting. */ - public Map tags() { + public Map getTags() { return tags; } @@ -191,7 +189,7 @@ public Map tags() { * @param tags The tags to add to this configuration setting. * @return The updated ConfigurationSetting object. */ - public ConfigurationSetting tags(Map tags) { + public ConfigurationSetting setTags(Map tags) { this.tags = tags; return this; } @@ -238,12 +236,12 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash(this.key, - this.label, - this.value, - this.etag, - this.lastModified, - this.locked, - this.contentType, - this.tags); + this.label, + this.value, + this.etag, + this.lastModified, + this.locked, + this.contentType, + this.tags); } } diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/Range.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/Range.java index b5a5e92463a1..85cfd8d198da 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/Range.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/Range.java @@ -13,7 +13,7 @@ * * @see ConfigurationAsyncClient#listSettingRevisions(SettingSelector) * @see ConfigurationClient#listSettingRevisions(SettingSelector) - * @see SettingSelector#range(Range) + * @see SettingSelector#setRange(Range) */ @Immutable public class Range { @@ -33,14 +33,14 @@ public Range(int start, int end) { /** * @return the start of the range. */ - public int start() { + public int getStart() { return start; } /** * @return the end of the range. */ - public int end() { + public int getEnd() { return end; } diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/SettingFields.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/SettingFields.java index 80514ad57329..d948c591b3d4 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/SettingFields.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/SettingFields.java @@ -14,27 +14,27 @@ */ public enum SettingFields { /** - * Populates the {@link ConfigurationSetting#key()} from the service. + * Populates the {@link ConfigurationSetting#getKey()} from the service. */ KEY, /** - * Populates the {@link ConfigurationSetting#label()} from the service. + * Populates the {@link ConfigurationSetting#getLabel()} from the service. */ LABEL, /** - * Populates the {@link ConfigurationSetting#value()} from the service. + * Populates the {@link ConfigurationSetting#getValue()} from the service. */ VALUE, /** - * Populates the {@link ConfigurationSetting#contentType()} from the service. + * Populates the {@link ConfigurationSetting#getContentType()} from the service. */ CONTENT_TYPE, /** - * Populates the {@link ConfigurationSetting#etag()} from the service. + * Populates the {@link ConfigurationSetting#getETag()} from the service. */ ETAG, /** - * Populates the {@link ConfigurationSetting#lastModified()} from the service. + * Populates the {@link ConfigurationSetting#getLastModified()} from the service. */ LAST_MODIFIED, /** @@ -42,7 +42,7 @@ public enum SettingFields { */ LOCKED, /** - * Populates the {@link ConfigurationSetting#tags()} from the service. + * Populates the {@link ConfigurationSetting#getTags()} from the service. */ TAGS; diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/SettingSelector.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/SettingSelector.java index 59c0a33bc028..ec4313633a65 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/SettingSelector.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/SettingSelector.java @@ -4,27 +4,28 @@ package com.azure.data.appconfiguration.models; import com.azure.core.implementation.annotation.Fluent; -import com.azure.data.appconfiguration.ConfigurationAsyncClient; import com.azure.core.implementation.util.ImplUtils; +import com.azure.data.appconfiguration.ConfigurationAsyncClient; import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; + /** * A set of options for selecting configuration settings from App Configuration service. * *
    - *
  • - * Providing {@link #labels() labels} will filter {@link ConfigurationSetting ConfigurationSettings} that match - * any label name in conjunction with the keys that are passed in to the service request. - *
  • - *
  • - * Providing {@link #acceptDateTime() acceptDateTime} will return the representation of matching - * {@link ConfigurationSetting} at that given {@link OffsetDateTime}. - *
  • - *
  • - * Providing {@link #fields() fields} will populate only those {@link ConfigurationSetting} fields in the - * response. By default, all of the fields are returned. - *
  • + *
  • + * Providing {@link #getLabels() labels} will filter {@link ConfigurationSetting ConfigurationSettings} that match any + * label name in conjunction with the keys that are passed in to the service request. + *
  • + *
  • + * Providing {@link #getAcceptDateTime() acceptDateTime} will return the representation of matching {@link + * ConfigurationSetting} at that given {@link OffsetDateTime}. + *
  • + *
  • + * Providing {@link #getFields() fields} will populate only those {@link ConfigurationSetting} fields in the response. + * By default, all of the fields are returned. + *
  • *
* * @see ConfigurationAsyncClient @@ -38,108 +39,108 @@ public class SettingSelector { private Range range; /** - * Creates a setting selector that will populate responses with all of the - * {@link ConfigurationSetting ConfigurationSetting's} properties and select all - * {@link ConfigurationSetting#key() keys}. + * Creates a setting selector that will populate responses with all of the {@link ConfigurationSetting + * ConfigurationSetting's} properties and select all {@link ConfigurationSetting#getKey() keys}. */ public SettingSelector() { } /** - * Gets the expressions to filter {@link ConfigurationSetting#key() keys} on for the request. + * Gets the expressions to filter {@link ConfigurationSetting#getKey() keys} on for the request. * *

* Examples: *

    - *
  1. If keys = "*", settings with any key are returned.
  2. - *
  3. If keys = "abc1234", settings with a key equal to "abc1234" are returned.
  4. - *
  5. If keys = "abc*", settings with a key starting with "abc" are returned.
  6. - *
  7. If keys = "*abc*", settings with a key containing "abc" are returned.
  8. + *
  9. If keys = "*", settings with any key are returned.
  10. + *
  11. If keys = "abc1234", settings with a key equal to "abc1234" are returned.
  12. + *
  13. If keys = "abc*", settings with a key starting with "abc" are returned.
  14. + *
  15. If keys = "*abc*", settings with a key containing "abc" are returned.
  16. *
* * @return The expressions to filter ConfigurationSetting keys on. */ - public String[] keys() { + public String[] getKeys() { return keys == null ? new String[0] : ImplUtils.clone(keys); } /** - * Sets the expressions to filter {@link ConfigurationSetting#key() keys} on for the request. + * Sets the expressions to filter {@link ConfigurationSetting#getKey() keys} on for the request. * *

* Examples: *

    - *
  • If {@code keys = "*"}, settings with any key are returned.
  • - *
  • If {@code keys = "abc1234"}, settings with a key equal to "abc1234" are returned.
  • - *
  • If {@code keys = "abc*"}, settings with a key starting with "abc" are returned.
  • - *
  • If {@code keys = "*abc*"}, settings with a key containing "abc" are returned.
  • - *
  • If {@code keys = "abc,def"}, settings with a key equal to "abc" or "def" are returned.
  • + *
  • If {@code keys = "*"}, settings with any key are returned.
  • + *
  • If {@code keys = "abc1234"}, settings with a key equal to "abc1234" are returned.
  • + *
  • If {@code keys = "abc*"}, settings with a key starting with "abc" are returned.
  • + *
  • If {@code keys = "*abc*"}, settings with a key containing "abc" are returned.
  • + *
  • If {@code keys = "abc,def"}, settings with a key equal to "abc" or "def" are returned.
  • *
* * @param keys The expressions to filter ConfigurationSetting keys on. * @return The updated SettingSelector object */ - public SettingSelector keys(String... keys) { + public SettingSelector setKeys(String... keys) { this.keys = keys; return this; } /** - * Gets the labels used to filter settings based on their {@link ConfigurationSetting#label() label} in the service. + * Gets the labels used to filter settings based on their {@link ConfigurationSetting#getLabel() label} in the + * service. * - * If the value is {@code null} or an empty string, all ConfigurationSettings with - * {@link ConfigurationSetting#NO_LABEL} are returned. + * If the value is {@code null} or an empty string, all ConfigurationSettings with {@link + * ConfigurationSetting#NO_LABEL} are returned. * *

* Examples: *

    - *
  • If {@code labels = "*"}, settings with any label are returned.
  • - *
  • If {@code labels = "\0"}, settings without any label are returned.
  • - *
  • If {@code labels = ""}, settings without any label are returned.
  • - *
  • If {@code labels = null}, settings without any label are returned.
  • - *
  • If {@code labels = "abc1234"}, settings with a label equal to "abc1234" are returned.
  • - *
  • If {@code labels = "abc*"}, settings with a label starting with "abc" are returned.
  • - *
  • If {@code labels = "*abc*"}, settings with a label containing "abc" are returned.
  • - *
  • If {@code labels = "abc,def"}, settings with labels "abc" or "def" are returned.
  • + *
  • If {@code labels = "*"}, settings with any label are returned.
  • + *
  • If {@code labels = "\0"}, settings without any label are returned.
  • + *
  • If {@code labels = ""}, settings without any label are returned.
  • + *
  • If {@code labels = null}, settings without any label are returned.
  • + *
  • If {@code labels = "abc1234"}, settings with a label equal to "abc1234" are returned.
  • + *
  • If {@code labels = "abc*"}, settings with a label starting with "abc" are returned.
  • + *
  • If {@code labels = "*abc*"}, settings with a label containing "abc" are returned.
  • + *
  • If {@code labels = "abc,def"}, settings with labels "abc" or "def" are returned.
  • *
* * @return labels The labels used to filter GET requests from the service. */ - public String[] labels() { + public String[] getLabels() { return labels == null ? new String[0] : ImplUtils.clone(labels); } /** - * Sets the query to match {@link ConfigurationSetting#label() labels} in the service. + * Sets the query to match {@link ConfigurationSetting#getLabel() labels} in the service. * *

* Examples: *

    - *
  • If {@code labels = "*"}, settings with any label are returned.
  • - *
  • If {@code labels = "\0"}, settings without any label are returned. (This is the default label.)
  • - *
  • If {@code labels = "abc1234"}, settings with a label equal to "abc1234" are returned.
  • - *
  • If {@code labels = "abc*"}, settings with a label starting with "abc" are returned.
  • - *
  • If {@code labels = "*abc*"}, settings with a label containing "abc" are returned.
  • - *
  • If {@code labels = "abc,def"}, settings with labels "abc" or "def" are returned.
  • + *
  • If {@code labels = "*"}, settings with any label are returned.
  • + *
  • If {@code labels = "\0"}, settings without any label are returned. (This is the default label.)
  • + *
  • If {@code labels = "abc1234"}, settings with a label equal to "abc1234" are returned.
  • + *
  • If {@code labels = "abc*"}, settings with a label starting with "abc" are returned.
  • + *
  • If {@code labels = "*abc*"}, settings with a label containing "abc" are returned.
  • + *
  • If {@code labels = "abc,def"}, settings with labels "abc" or "def" are returned.
  • *
* * @param labels The ConfigurationSetting labels to match. If the provided value is {@code null} or {@code ""}, all * ConfigurationSettings will be returned regardless of their label. * @return SettingSelector The updated SettingSelector object. */ - public SettingSelector labels(String... labels) { + public SettingSelector setLabels(String... labels) { this.labels = labels; return this; } /** * Gets the date time for the request query. When the query is performed, if {@code acceptDateTime} is set, the - * {@link ConfigurationSetting#value() configuration setting value} at that point in time is returned. Otherwise, + * {@link ConfigurationSetting#getValue() configuration setting value} at that point in time is returned. Otherwise, * the current value is returned. * * @return Gets the currently set datetime in {@link DateTimeFormatter#RFC_1123_DATE_TIME} format. */ - public String acceptDateTime() { + public String getAcceptDateTime() { return this.acceptDatetime; } @@ -150,7 +151,7 @@ public String acceptDateTime() { * @param datetime The value of the configuration setting at that given {@link OffsetDateTime}. * @return The updated SettingSelector object. */ - public SettingSelector acceptDatetime(OffsetDateTime datetime) { + public SettingSelector setAcceptDatetime(OffsetDateTime datetime) { this.acceptDatetime = DateTimeFormatter.RFC_1123_DATE_TIME.toFormat().format(datetime); return this; } @@ -161,38 +162,40 @@ public SettingSelector acceptDatetime(OffsetDateTime datetime) { * * @return The set of {@link ConfigurationSetting} fields to return for a GET request. */ - public SettingFields[] fields() { + public SettingFields[] getFields() { return fields == null ? new SettingFields[0] : ImplUtils.clone(fields); } /** - * Sets fields that will be returned in the response corresponding to properties in {@link ConfigurationSetting}. - * If none are set, the service returns ConfigurationSettings with all of their fields populated. + * Sets fields that will be returned in the response corresponding to properties in {@link ConfigurationSetting}. If + * none are set, the service returns ConfigurationSettings with all of their fields populated. * * @param fields The fields to select for the query response. If none are set, the service will return the * ConfigurationSettings with a default set of properties. * @return The updated SettingSelector object. */ - public SettingSelector fields(SettingFields... fields) { + public SettingSelector setFields(SettingFields... fields) { this.fields = fields; return this; } /** - * Gets the {@link Range} used to select a specific range of revisions with {@code listSettingRevisions}. - * If {@code null}, the service returns all revisions. + * Gets the {@link Range} used to select a specific range of revisions with {@code listSettingRevisions}. If + * {@code null}, the service returns all revisions. + * * @return The {@link Range} used to select a range of revisions. */ - public Range range() { + public Range getRange() { return range; } /** * Sets the {@link Range} used to select a specific range of revisions. If null, the service returns all revisions. + * * @param range The range of revisions to select. * @return The updated SettingSelector object. */ - public SettingSelector range(Range range) { + public SettingSelector setRange(Range range) { this.range = range; return this; } diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/policy/ConfigurationCredentialsPolicy.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/policy/ConfigurationCredentialsPolicy.java index 7d32848c2041..f638b10adafa 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/policy/ConfigurationCredentialsPolicy.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/policy/ConfigurationCredentialsPolicy.java @@ -9,12 +9,11 @@ import com.azure.core.http.HttpPipelineNextPolicy; import com.azure.core.http.HttpResponse; import com.azure.core.http.policy.HttpPipelinePolicy; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.EmptyByteBuf; -import io.netty.buffer.UnpooledByteBufAllocator; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import java.nio.ByteBuffer; + /** * A policy that authenticates requests with Azure App Configuration service. The content added by this policy * is leveraged in {@link ConfigurationClientCredentials} to generate the correct "Authorization" header value. @@ -30,11 +29,12 @@ public final class ConfigurationCredentialsPolicy implements HttpPipelinePolicy private final ConfigurationClientCredentials credentials; /** - * Creates an instance that is able to apply a {@link ConfigurationClientCredentials} credential to a request in the pipeline. + * Creates an instance that is able to apply a {@link ConfigurationClientCredentials} credential to a request in the + * pipeline. * * @param credentials the credential information to authenticate to Azure App Configuration service */ - public ConfigurationCredentialsPolicy(ConfigurationClientCredentials credentials) { + public ConfigurationCredentialsPolicy(ConfigurationClientCredentials credentials) { this.credentials = credentials; } @@ -42,24 +42,29 @@ public ConfigurationCredentialsPolicy(ConfigurationClientCredentials credentials * Adds the required headers to authenticate a request to Azure App Configuration service. * * @param context The request context - * @param next The next HTTP pipeline policy to process the {@code context's} request after this policy completes. + * @param next The next HTTP pipeline policy to process the {@code context's} request after this policy + * completes. * @return A {@link Mono} representing the HTTP response that will arrive asynchronously. */ @Override public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { - final Flux contents = context.httpRequest().body() == null - ? Flux.just(getEmptyBuffer()) - : context.httpRequest().body(); + final Flux contents = context.getHttpRequest().getBody() == null + ? Flux.just(getEmptyBuffer()) + : context.getHttpRequest().getBody(); - return credentials.getAuthorizationHeadersAsync(context.httpRequest().url(), context.httpRequest().httpMethod().toString(), contents.defaultIfEmpty(getEmptyBuffer())) + return credentials + .getAuthorizationHeadersAsync( + context.getHttpRequest().getUrl(), + context.getHttpRequest().getHttpMethod().toString(), + contents.defaultIfEmpty(getEmptyBuffer())) .flatMapMany(headers -> Flux.fromIterable(headers.entrySet())) - .map(header -> context.httpRequest().header(header.getKey(), header.getValue())) + .map(header -> context.getHttpRequest().setHeader(header.getKey(), header.getValue())) .last() .flatMap(request -> next.process()); } - private ByteBuf getEmptyBuffer() { - return new EmptyByteBuf(UnpooledByteBufAllocator.DEFAULT); + private ByteBuffer getEmptyBuffer() { + return ByteBuffer.allocate(0); } } diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/ConfigurationAsyncClientJavaDocCodeSnippets.java b/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/ConfigurationAsyncClientJavaDocCodeSnippets.java index 84e60816b136..353404648ff2 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/ConfigurationAsyncClientJavaDocCodeSnippets.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/ConfigurationAsyncClientJavaDocCodeSnippets.java @@ -5,8 +5,12 @@ import com.azure.data.appconfiguration.models.ConfigurationSetting; import com.azure.data.appconfiguration.models.SettingSelector; +import com.azure.data.appconfiguration.credentials.ConfigurationClientCredentials; import reactor.util.context.Context; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; + /** * Code snippets for {@link ConfigurationAsyncClient} */ @@ -26,7 +30,7 @@ public void addSettingsCodeSnippet() { client.addSetting("prodDBConnection", "db_connection") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(response -> { - System.out.printf("Key: %s, Value: %s", response.key(), response.value()); + System.out.printf("Key: %s, Value: %s", response.getKey(), response.getValue()); }); // END: com.azure.data.appconfiguration.configurationasyncclient.addSetting#string-string @@ -34,10 +38,10 @@ public void addSettingsCodeSnippet() { * Code snippets for {@link ConfigurationAsyncClient#addSettins(ConfigurationSetting)} */ // BEGIN: com.azure.data.appconfiguration.configurationasyncclient.addSetting#ConfigurationSetting - client.addSetting(new ConfigurationSetting().key("prodDBConnection").label("westUS").value("db_connection")) + client.addSetting(new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS").setValue("db_connection")) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(response -> { - System.out.printf("Key: %s, Value: %s", response.key(), response.value()); + System.out.printf("Key: %s, Value: %s", response.getKey(), response.getValue()); }); // END: com.azure.data.appconfiguration.configurationasyncclient.addSetting#ConfigurationSetting @@ -45,12 +49,12 @@ public void addSettingsCodeSnippet() { * Code snippets for {@link ConfigurationAsyncClient#addSettingWithResponse(String, String)} */ // BEGIN: com.azure.data.appconfiguration.configurationasyncclient.addSettingWithResponse#ConfigurationSetting - client.addSettingWithResponse(new ConfigurationSetting().key("prodDBConnection").label("westUS") - .value("db_connection")) + client.addSettingWithResponse(new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS") + .setValue("db_connection")) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(response -> { - ConfigurationSetting responseSetting = response.value(); - System.out.printf("Key: %s, Value: %s", responseSetting.key(), responseSetting.value()); + ConfigurationSetting responseSetting = response.getValue(); + System.out.printf("Key: %s, Value: %s", responseSetting.getKey(), responseSetting.getValue()); }); // END: com.azure.data.appconfiguration.configurationasyncclient.addSettingWithResponse#ConfigurationSetting } @@ -64,29 +68,29 @@ public void setSettingsCodeSnippet() { client.setSetting("prodDBConnection", "db_connection") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(response -> { - System.out.printf("Key: %s, Value: %s", response.key(), response.value()); + System.out.printf("Key: %s, Value: %s", response.getKey(), response.getValue()); }); // Update the value of the setting to "updated_db_connection" client.setSetting("prodDBConnection", "updated_db_connection") - .subscribe(response -> { - System.out.printf("Key: %s, Value: %s", response.key(), response.value()); - }); + .subscribe(response -> { + System.out.printf("Key: %s, Value: %s", response.getKey(), response.getValue()); + }); // END: com.azure.data.appconfiguration.configurationasyncclient.setSetting#string-string /** * Code snippets for {@link ConfigurationAsyncClient#setSetting(ConfigurationSetting)} */ // BEGIN: com.azure.data.appconfiguration.configurationasyncclient.setSetting#ConfigurationSetting - client.setSetting(new ConfigurationSetting().key("prodDBConnection").label("westUS").value("db_connection")) + client.setSetting(new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS").setValue("db_connection")) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(response -> { - System.out.printf("Key: %s, Value: %s", response.key(), response.value()); + System.out.printf("Key: %s, Value: %s", response.getKey(), response.getValue()); }); // Update the value of the setting to "updated_db_connection" - client.setSetting(new ConfigurationSetting().key("prodDBConnection").label("westUS") - .value("updated_db_connection")) + client.setSetting(new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS") + .setValue("updated_db_connection")) .subscribe(response -> { - System.out.printf("Key: %s, Value: %s", response.key(), response.value()); + System.out.printf("Key: %s, Value: %s", response.getKey(), response.getValue()); }); // END: com.azure.data.appconfiguration.configurationasyncclient.setSetting#ConfigurationSetting @@ -94,19 +98,19 @@ public void setSettingsCodeSnippet() { * Code snippets for {@link ConfigurationAsyncClient#setSettingWithResponse(ConfigurationSetting)} */ // BEGIN: com.azure.data.appconfiguration.configurationasyncclient.setSettingWithResponse#ConfigurationSetting - client.setSettingWithResponse(new ConfigurationSetting().key("prodDBConnection").label("westUS") - .value("db_connection")) + client.setSettingWithResponse(new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS") + .setValue("db_connection")) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(response -> { - ConfigurationSetting result = response.value(); - System.out.printf("Key: %s, Value: %s", result.key(), result.value()); + ConfigurationSetting result = response.getValue(); + System.out.printf("Key: %s, Value: %s", result.getKey(), result.getValue()); }); // Update the value of the setting to "updated_db_connection" - client.setSettingWithResponse(new ConfigurationSetting().key("prodDBConnection").label("westUS") - .value("updated_db_connection")) + client.setSettingWithResponse(new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS") + .setValue("updated_db_connection")) .subscribe(response -> { - ConfigurationSetting responseSetting = response.value(); - System.out.printf("Key: %s, Value: %s", responseSetting.key(), responseSetting.value()); + ConfigurationSetting responseSetting = response.getValue(); + System.out.printf("Key: %s, Value: %s", responseSetting.getKey(), responseSetting.getValue()); }); // END: com.azure.data.appconfiguration.configurationasyncclient.setSettingWithResponse#ConfigurationSetting } @@ -120,7 +124,7 @@ public void updateSettingsCodeSnippet() { client.updateSetting("prodDBConnection", "updated_db_connection") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(response -> { - System.out.printf("Key: %s, Value: %s", response.key(), response.value()); + System.out.printf("Key: %s, Value: %s", response.getKey(), response.getValue()); }); // END: com.azure.data.appconfiguration.configurationasyncclient.updateSetting#string-string @@ -128,11 +132,11 @@ public void updateSettingsCodeSnippet() { * Code snippets for {@link ConfigurationAsyncClient#updateSetting(ConfigurationSetting)} */ // BEGIN: com.azure.data.appconfiguration.configurationasyncclient.updateSetting#ConfigurationSetting - client.updateSetting(new ConfigurationSetting().key("prodDBConnection").label("westUS") - .value("updated_db_connection")) + client.updateSetting(new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS") + .setValue("updated_db_connection")) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(response -> { - System.out.printf("Key: %s, Value: %s", response.key(), response.value()); + System.out.printf("Key: %s, Value: %s", response.getKey(), response.getValue()); }); // END: com.azure.data.appconfiguration.configurationasyncclient.updateSetting#ConfigurationSetting @@ -140,12 +144,12 @@ public void updateSettingsCodeSnippet() { * Code snippets for {@link ConfigurationAsyncClient#updateSettingWithResponse(ConfigurationSetting)} */ // BEGIN: com.azure.data.appconfiguration.configurationasyncclient.updateSettingWithResponse#ConfigurationSetting - client.updateSettingWithResponse(new ConfigurationSetting().key("prodDBConnection").label("westUS") - .value("updated_db_connection")) + client.updateSettingWithResponse(new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS") + .setValue("updated_db_connection")) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(response -> { - ConfigurationSetting responseSetting = response.value(); - System.out.printf("Key: %s, Value: %s", responseSetting.key(), responseSetting.value()); + ConfigurationSetting responseSetting = response.getValue(); + System.out.printf("Key: %s, Value: %s", responseSetting.getKey(), responseSetting.getValue()); }); // END: com.azure.data.appconfiguration.configurationasyncclient.updateSettingWithResponse#ConfigurationSetting } @@ -159,7 +163,7 @@ public void getSettingsCodeSnippet() { client.getSetting("prodDBConnection") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(response -> { - System.out.printf("Key: %s, Value: %s", response.key(), response.value()); + System.out.printf("Key: %s, Value: %s", response.getKey(), response.getValue()); }); // END: com.azure.data.appconfiguration.configurationasyncclient.getSetting#string @@ -167,10 +171,10 @@ public void getSettingsCodeSnippet() { * Code snippets for {@link ConfigurationAsyncClient#getSetting(ConfigurationSetting)} */ // BEGIN: com.azure.data.appconfiguration.configurationasyncclient.getSetting#ConfigurationSetting - client.getSetting(new ConfigurationSetting().key("prodDBConnection").label("westUS")) + client.getSetting(new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS")) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(response -> { - System.out.printf("Key: %s, Value: %s", response.key(), response.value()); + System.out.printf("Key: %s, Value: %s", response.getKey(), response.getValue()); }); // END: com.azure.data.appconfiguration.configurationasyncclient.getSetting#ConfigurationSetting @@ -178,16 +182,16 @@ public void getSettingsCodeSnippet() { * Code snippets for {@link ConfigurationAsyncClient#getSettingWithResponse(String, String)} */ // BEGIN: com.azure.data.appconfiguration.configurationasyncclient.getSettingWithResponse#ConfigurationSetting - client.getSettingWithResponse(new ConfigurationSetting().key("prodDBConnection").label("westUS")) + client.getSettingWithResponse(new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS")) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(response -> { - ConfigurationSetting result = response.value(); - System.out.printf("Key: %s, Value: %s", result.key(), result.value()); + ConfigurationSetting result = response.getValue(); + System.out.printf("Key: %s, Value: %s", result.getKey(), result.getValue()); }); // END: com.azure.data.appconfiguration.configurationasyncclient.getSettingWithResponse#ConfigurationSetting } - /** + /** * Code snippets for {@link ConfigurationAsyncClient#deleteSetting(String)} */ public void deleteSettingsCodeSnippet() { @@ -196,7 +200,7 @@ public void deleteSettingsCodeSnippet() { client.deleteSetting("prodDBConnection") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(response -> { - System.out.printf("Key: %s, Value: %s", response.key(), response.value()); + System.out.printf("Key: %s, Value: %s", response.getKey(), response.getValue()); }); // END: com.azure.data.appconfiguration.configurationasyncclient.deleteSetting#string @@ -204,10 +208,10 @@ public void deleteSettingsCodeSnippet() { * Code snippets for {@link ConfigurationAsyncClient#deleteSetting(ConfigurationSetting)} */ // BEGIN: com.azure.data.appconfiguration.configurationasyncclient.deleteSetting#ConfigurationSetting - client.deleteSetting(new ConfigurationSetting().key("prodDBConnection").label("westUS")) + client.deleteSetting(new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS")) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(response -> { - System.out.printf("Key: %s, Value: %s", response.key(), response.value()); + System.out.printf("Key: %s, Value: %s", response.getKey(), response.getValue()); }); // END: com.azure.data.appconfiguration.configurationasyncclient.deleteSetting#ConfigurationSetting @@ -215,11 +219,11 @@ public void deleteSettingsCodeSnippet() { * Code snippets for {@link ConfigurationAsyncClient#deleteSettingWithResponse(String, String)} */ // BEGIN: com.azure.data.appconfiguration.configurationasyncclient.deleteSettingWithResponse#ConfigurationSetting - client.deleteSettingWithResponse(new ConfigurationSetting().key("prodDBConnection").label("westUS")) + client.deleteSettingWithResponse(new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS")) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(response -> { - ConfigurationSetting result = response.value(); - System.out.printf("Key: %s, Value: %s", result.key(), result.value()); + ConfigurationSetting result = response.getValue(); + System.out.printf("Key: %s, Value: %s", result.getKey(), result.getValue()); }); // END: com.azure.data.appconfiguration.configurationasyncclient.deleteSettingWithResponse#ConfigurationSetting } @@ -230,10 +234,10 @@ public void deleteSettingsCodeSnippet() { public void listSettingCodeSnippet() { ConfigurationAsyncClient client = getAsyncClient(); // BEGIN: com.azure.data.appconfiguration.configurationasyncclient.listsettings - client.listSettings(new SettingSelector().keys("prodDBConnection")) + client.listSettings(new SettingSelector().setKeys("prodDBConnection")) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(setting -> - System.out.printf("Key: %s, Value: %s", setting.key(), setting.value())); + System.out.printf("Key: %s, Value: %s", setting.getKey(), setting.getValue())); // END: com.azure.data.appconfiguration.configurationasyncclient.listsettings } @@ -243,18 +247,26 @@ public void listSettingCodeSnippet() { public void listSettingRevisionsCodeSnippet() { ConfigurationAsyncClient client = getAsyncClient(); // BEGIN: com.azure.data.appconfiguration.configurationasyncclient.listsettingrevisions - client.listSettingRevisions(new SettingSelector().keys("prodDBConnection")) + client.listSettingRevisions(new SettingSelector().setKeys("prodDBConnection")) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(setting -> - System.out.printf("Key: %s, Value: %s", setting.key(), setting.value())); + System.out.printf("Key: %s, Value: %s", setting.getKey(), setting.getValue())); // END: com.azure.data.appconfiguration.configurationasyncclient.listsettingrevisions } /** * Implementation not provided + * * @return {@code null} */ private ConfigurationAsyncClient getAsyncClient() { - return new ConfigurationClientBuilder().buildAsyncClient(); + try { + return new ConfigurationClientBuilder().credential(new ConfigurationClientCredentials("connectionString")).buildAsyncClient(); + } catch (InvalidKeyException e) { + e.printStackTrace(); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + return null; } } diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/ConfigurationClientJavaDocCodeSnippets.java b/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/ConfigurationClientJavaDocCodeSnippets.java index 379cce877425..7cdcb70512ac 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/ConfigurationClientJavaDocCodeSnippets.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/ConfigurationClientJavaDocCodeSnippets.java @@ -6,8 +6,6 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.rest.Response; -import com.azure.core.test.models.RecordedData; -import com.azure.core.test.policy.RecordNetworkCallPolicy; import com.azure.core.util.Context; import com.azure.data.appconfiguration.credentials.ConfigurationClientCredentials; import com.azure.data.appconfiguration.models.ConfigurationSetting; @@ -27,6 +25,7 @@ public final class ConfigurationClientJavaDocCodeSnippets { /** * Generates code sample for creating a {@link ConfigurationClient} + * * @return An instance of {@link ConfigurationClient} * @throws IllegalStateException If configuration credentials cannot be created. */ @@ -34,8 +33,9 @@ public ConfigurationClient createAsyncConfigurationClientWithPipeline() { try { String connectionString = getConnectionString(); // BEGIN: com.azure.data.applicationconfig.configurationclient.pipeline.instantiation - RecordedData networkData = new RecordedData(); - HttpPipeline pipeline = new HttpPipelineBuilder().policies(new RecordNetworkCallPolicy(networkData)).build(); + HttpPipeline pipeline = new HttpPipelineBuilder() + .policies(/* add policies */) + .build(); ConfigurationClient configurationClient = new ConfigurationClientBuilder() .pipeline(pipeline) @@ -51,6 +51,7 @@ public ConfigurationClient createAsyncConfigurationClientWithPipeline() { /** * Generates code sample for creating a {@link ConfigurationClient} + * * @return An instance of {@link ConfigurationClient} * @throws IllegalStateException If configuration credentials cannot be created */ @@ -58,7 +59,7 @@ public ConfigurationAsyncClient createAsyncConfigurationClient() { try { String connectionString = getConnectionString(); // BEGIN: com.azure.data.applicationconfig.async.configurationclient.instantiation - ConfigurationAsyncClient configurationAsyncClient = new ConfigurationClientBuilder() + ConfigurationAsyncClient configurationAsyncClient = new ConfigurationClientBuilder() .credential(new ConfigurationClientCredentials(connectionString)) .buildAsyncClient(); // END: com.azure.data.applicationconfig.async.configurationclient.instantiation @@ -70,6 +71,7 @@ public ConfigurationAsyncClient createAsyncConfigurationClient() { /** * Generates code sample for creating a {@link ConfigurationClient} + * * @return An instance of {@link ConfigurationClient} * @throws IllegalStateException If configuration credentials cannot be created */ @@ -92,31 +94,34 @@ public ConfigurationClient createSyncConfigurationClient() { */ public void addSetting() { ConfigurationClient configurationClient = createSyncConfigurationClient(); - // BEGIN: com.azure.data.applicationconfig.configurationclient.addSetting#string-string + // BEGIN: com.azure.data.appconfiguration.ConfigurationClient.addSetting#String-String ConfigurationSetting result = configurationClient .addSetting("prodDBConnection", "db_connection"); - System.out.printf("Key: %s, Value: %s", result.key(), result.value()); - // END: com.azure.data.applicationconfig.configurationclient.addSetting#string-string + System.out.printf("Key: %s, Value: %s", result.getKey(), result.getValue()); + // END: com.azure.data.appconfiguration.ConfigurationClient.addSetting#String-String /* Generates code sample for using {@link ConfigurationClient#addSetting(ConfigurationSetting)} */ - // BEGIN: com.azure.data.applicationconfig.configurationclient.addSetting#ConfigurationSetting + // BEGIN: com.azure.data.appconfiguration.ConfigurationClient.addSetting#ConfigurationSetting ConfigurationSetting resultSetting = configurationClient - .addSetting(new ConfigurationSetting().key("prodDBConnection").label("westUS").value("db_connection")); - System.out.printf("Key: %s, Value: %s", resultSetting.key(), resultSetting.value()); - // END: com.azure.data.applicationconfig.configurationclient.addSetting#ConfigurationSetting + .addSetting( + new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS").setValue("db_connection")); + System.out.printf("Key: %s, Value: %s", resultSetting.getKey(), resultSetting.getValue()); + // END: com.azure.data.appconfiguration.ConfigurationClient.addSetting#ConfigurationSetting /* Generates code sample for using {@link ConfigurationClient#addSettingWithResponse(ConfigurationSetting, Context)} */ - // BEGIN: com.azure.data.applicationconfig.configurationclient.addSettingWithResponse#ConfigurationSetting-Context + // BEGIN: com.azure.data.appconfiguration.ConfigurationClient.addSettingWithResponse#ConfigurationSetting-Context Response responseResultSetting = configurationClient .addSettingWithResponse( new ConfigurationSetting() - .key("prodDBConnection").label("westUS").value("db_connection"), new Context(key1, value1)); - System.out.printf("Key: %s, Value: %s", responseResultSetting.value().key(), responseResultSetting.value().value()); - // END: com.azure.data.applicationconfig.configurationclient.addSettingWithResponse#ConfigurationSetting-Context + .setKey("prodDBConnection").setLabel("westUS").setValue("db_connection"), + new Context(key1, value1)); + System.out.printf("Key: %s, Value: %s", responseResultSetting.getValue().getKey(), + responseResultSetting.getValue().getValue()); + // END: com.azure.data.appconfiguration.ConfigurationClient.addSettingWithResponse#ConfigurationSetting-Context } /** @@ -124,48 +129,51 @@ public void addSetting() { */ public void setSetting() { ConfigurationClient configurationClient = createSyncConfigurationClient(); - // BEGIN: com.azure.data.applicationconfig.configurationclient.setSetting#string-string + // BEGIN: com.azure.data.appconfiguration.ConfigurationClient.setSetting#String-String ConfigurationSetting result = configurationClient .setSetting("prodDBConnection", "db_connection"); - System.out.printf("Key: %s, Value: %s", result.key(), result.value()); + System.out.printf("Key: %s, Value: %s", result.getKey(), result.getValue()); // Update the value of the setting to "updated_db_connection". result = configurationClient.setSetting("prodDBConnection", "updated_db_connection"); - System.out.printf("Key: %s, Value: %s", result.key(), result.value()); - // END: com.azure.data.applicationconfig.configurationclient.setSetting#string-string + System.out.printf("Key: %s, Value: %s", result.getKey(), result.getValue()); + // END: com.azure.data.appconfiguration.ConfigurationClient.setSetting#String-String /* Generates code sample for using {@link ConfigurationClient#setSetting(ConfigurationSetting)} */ - // BEGIN: com.azure.data.applicationconfig.configurationclient.setSetting#ConfigurationSetting + // BEGIN: com.azure.data.appconfiguration.ConfigurationClient.setSetting#ConfigurationSetting // Add a setting with the key "prodDBConnection", label "westUS", and value "db_connection" ConfigurationSetting resultSetting = configurationClient - .setSetting(new ConfigurationSetting().key("prodDBConnection").label("westUS").value("db_connection")); - System.out.printf("Key: %s, Value: %s", resultSetting.key(), resultSetting.value()); + .setSetting( + new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS").setValue("db_connection")); + System.out.printf("Key: %s, Value: %s", resultSetting.getKey(), resultSetting.getValue()); // Update the value of the setting to "updated_db_connection". resultSetting = configurationClient - .setSetting(new ConfigurationSetting() - .key("prodDBConnection").label("westUS").value("updated_db_connection")); - System.out.printf("Key: %s, Value: %s", resultSetting.key(), resultSetting.value()); - // END: com.azure.data.applicationconfig.configurationclient.setSetting#ConfigurationSetting + .setSetting(new ConfigurationSetting() + .setKey("prodDBConnection").setLabel("westUS").setValue("updated_db_connection")); + System.out.printf("Key: %s, Value: %s", resultSetting.getKey(), resultSetting.getValue()); + // END: com.azure.data.appconfiguration.ConfigurationClient.setSetting#ConfigurationSetting /* Generates code sample for using {@link ConfigurationClient#setSettingWithResponse(ConfigurationSetting, Context)} */ - // BEGIN: com.azure.data.applicationconfig.configurationclient.setSettingWithResponse#ConfigurationSetting-Context + // BEGIN: com.azure.data.appconfiguration.ConfigurationClient.setSettingWithResponse#ConfigurationSetting-Context // Add a setting with the key "prodDBConnection", label "westUS", and value "db_connection" Response responseSetting = configurationClient - .setSettingWithResponse(new ConfigurationSetting().key("prodDBConnection").label("westUS") - .value("db_connection"), new Context(key2, value2)); - System.out.printf("Key: %s, Value: %s", responseSetting.value().key(), responseSetting.value().value()); + .setSettingWithResponse(new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS") + .setValue("db_connection"), new Context(key2, value2)); + System.out + .printf("Key: %s, Value: %s", responseSetting.getValue().getKey(), responseSetting.getValue().getValue()); // Update the value of the setting to "updated_db_connection". responseSetting = configurationClient - .setSettingWithResponse(new ConfigurationSetting().key("prodDBConnection").label("westUS") - .value("updated_db_connection"), new Context(key2, value2)); - System.out.printf("Key: %s, Value: %s", responseSetting.value().key(), responseSetting.value().value()); - // END: com.azure.data.applicationconfig.configurationclient.setSettingWithResponse#ConfigurationSetting-Context + .setSettingWithResponse(new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS") + .setValue("updated_db_connection"), new Context(key2, value2)); + System.out + .printf("Key: %s, Value: %s", responseSetting.getValue().getKey(), responseSetting.getValue().getValue()); + // END: com.azure.data.appconfiguration.ConfigurationClient.setSettingWithResponse#ConfigurationSetting-Context } /** @@ -175,7 +183,7 @@ public void getSetting() { ConfigurationClient configurationClient = createSyncConfigurationClient(); // BEGIN: com.azure.data.applicationconfig.configurationclient.getSetting#string ConfigurationSetting result = configurationClient.getSetting("prodDBConnection"); - System.out.printf("Key: %s, Value: %s", result.key(), result.value()); + System.out.printf("Key: %s, Value: %s", result.getKey(), result.getValue()); // END: com.azure.data.applicationconfig.configurationclient.getSetting#string /* @@ -184,8 +192,8 @@ public void getSetting() { // BEGIN: com.azure.data.applicationconfig.configurationclient.getSetting#ConfigurationSetting // Retrieve the setting with the key-label "prodDBConnection"-"westUS". ConfigurationSetting resultSetting = configurationClient - .getSetting(new ConfigurationSetting().key("prodDBConnection").label("westUS")); - System.out.printf("Key: %s, Value: %s", resultSetting.key(), resultSetting.value()); + .getSetting(new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS")); + System.out.printf("Key: %s, Value: %s", resultSetting.getKey(), resultSetting.getValue()); // END: com.azure.data.applicationconfig.configurationclient.getSetting#ConfigurationSetting /* @@ -194,10 +202,10 @@ public void getSetting() { // BEGIN: com.azure.data.applicationconfig.configurationclient.getSettingWithResponse#ConfigurationSetting-Context // Retrieve the setting with the key-label "prodDBConnection"-"westUS". Response responseResultSetting = configurationClient - .getSettingWithResponse(new ConfigurationSetting().key("prodDBConnection").label("westUS"), + .getSettingWithResponse(new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS"), new Context(key1, value1)); - System.out.printf("Key: %s, Value: %s", responseResultSetting.value().key(), - responseResultSetting.value().value()); + System.out.printf("Key: %s, Value: %s", responseResultSetting.getValue().getKey(), + responseResultSetting.getValue().getValue()); // END: com.azure.data.applicationconfig.configurationclient.getSettingWithResponse#ConfigurationSetting-Context } @@ -206,13 +214,11 @@ public void getSetting() { */ public void updateSetting() { ConfigurationClient configurationClient = createSyncConfigurationClient(); - // BEGIN: com.azure.data.applicationconfig.configurationclient.updateSetting#string-string - + // BEGIN: com.azure.data.appconfiguration.ConfigurationClient.updateSetting#String-String // Update a setting with the key "prodDBConnection" to have the value "updated_db_connection". - ConfigurationSetting result = configurationClient.updateSetting("prodDBConnection", "updated_db_connection"); - System.out.printf("Key: %s, Value: %s", result.key(), result.value()); - // END: com.azure.data.applicationconfig.configurationclient.updateSetting#string-string + System.out.printf("Key: %s, Value: %s", result.getKey(), result.getValue()); + // END: com.azure.data.appconfiguration.ConfigurationClient.updateSetting#String-String /* Generates code sample for using {@link ConfigurationClient#updateSetting(ConfigurationSetting)} @@ -221,8 +227,9 @@ public void updateSetting() { // Update the setting with the key-label pair "prodDBConnection"-"westUS" to have the value "updated_db_connection". ConfigurationSetting resultSetting = configurationClient .updateSetting( - new ConfigurationSetting().key("prodDBConnection").label("westUS").value("updated_db_connection")); - System.out.printf("Key: %s, Value: %s", resultSetting.key(), resultSetting.value()); + new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS") + .setValue("updated_db_connection")); + System.out.printf("Key: %s, Value: %s", resultSetting.getKey(), resultSetting.getValue()); // END: com.azure.data.applicationconfig.configurationclient.updateSetting#ConfigurationSetting /* @@ -231,10 +238,10 @@ public void updateSetting() { // BEGIN: com.azure.data.applicationconfig.configurationclient.updateSettingWithResponse#ConfigurationSetting-Context // Update the setting with the key-label pair "prodDBConnection"-"westUS" to have the value "updated_db_connection". Response responseResultSetting = configurationClient - .updateSettingWithResponse(new ConfigurationSetting().key("prodDBConnection").label("westUS") - .value("updated_db_connection"), new Context(key1, value1)); - System.out.printf("Key: %s, Value: %s", responseResultSetting.value().key(), - responseResultSetting.value().value()); + .updateSettingWithResponse(new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS") + .setValue("updated_db_connection"), new Context(key1, value1)); + System.out.printf("Key: %s, Value: %s", responseResultSetting.getValue().getKey(), + responseResultSetting.getValue().getValue()); // END: com.azure.data.applicationconfig.configurationclient.updateSettingWithResponse#ConfigurationSetting-Context } @@ -246,7 +253,7 @@ public void deleteSetting() { // BEGIN: com.azure.data.applicationconfig.configurationclient.deleteSetting#string ConfigurationSetting result = configurationClient .deleteSetting("prodDBConnection"); - System.out.printf("Key: %s, Value: %s", result.key(), result.value()); + System.out.printf("Key: %s, Value: %s", result.getKey(), result.getValue()); // END: com.azure.data.applicationconfig.configurationclient.deleteSetting#string @@ -255,8 +262,8 @@ public void deleteSetting() { */ // BEGIN: com.azure.data.applicationconfig.configurationclient.deleteSetting#ConfigurationSetting ConfigurationSetting resultSetting = configurationClient - .deleteSetting(new ConfigurationSetting().key("prodDBConnection").label("westUS")); - System.out.printf("Key: %s, Value: %s", resultSetting.key(), resultSetting.value()); + .deleteSetting(new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS")); + System.out.printf("Key: %s, Value: %s", resultSetting.getKey(), resultSetting.getValue()); // END: com.azure.data.applicationconfig.configurationclient.deleteSetting#ConfigurationSetting /** @@ -264,9 +271,10 @@ public void deleteSetting() { */ // BEGIN: com.azure.data.applicationconfig.configurationclient.deleteSettingWithResponse#ConfigurationSetting-Context Response responseSetting = configurationClient - .deleteSettingWithResponse(new ConfigurationSetting().key("prodDBConnection").label("westUS"), + .deleteSettingWithResponse(new ConfigurationSetting().setKey("prodDBConnection").setLabel("westUS"), new Context(key2, value2)); - System.out.printf("Key: %s, Value: %s", responseSetting.value().key(), responseSetting.value().value()); + System.out + .printf("Key: %s, Value: %s", responseSetting.getValue().getKey(), responseSetting.getValue().getValue()); // END: com.azure.data.applicationconfig.configurationclient.deleteSettingWithResponse#ConfigurationSetting-Context } @@ -276,9 +284,9 @@ public void deleteSetting() { public void listSettings() { ConfigurationClient configurationClient = createSyncConfigurationClient(); // BEGIN: com.azure.data.applicationconfig.configurationclient.listSettings#settingSelector - SettingSelector settingSelector = new SettingSelector().keys("prodDBConnection"); + SettingSelector settingSelector = new SettingSelector().setKeys("prodDBConnection"); configurationClient.listSettings(settingSelector).forEach(setting -> { - System.out.printf("Key: %s, Value: %s", setting.key(), setting.value()); + System.out.printf("Key: %s, Value: %s", setting.getKey(), setting.getValue()); }); // END: com.azure.data.applicationconfig.configurationclient.listSettings#settingSelector } @@ -289,10 +297,10 @@ public void listSettings() { public void listSettingsContext() { ConfigurationClient configurationClient = createSyncConfigurationClient(); // BEGIN: com.azure.data.applicationconfig.configurationclient.listSettings#settingSelector-context - SettingSelector settingSelector = new SettingSelector().keys("prodDBConnection"); + SettingSelector settingSelector = new SettingSelector().setKeys("prodDBConnection"); Context ctx = new Context(key2, value2); configurationClient.listSettings(settingSelector, ctx).forEach(setting -> { - System.out.printf("Key: %s, Value: %s", setting.key(), setting.value()); + System.out.printf("Key: %s, Value: %s", setting.getKey(), setting.getValue()); }); // END: com.azure.data.applicationconfig.configurationclient.listSettings#settingSelector-context } @@ -303,11 +311,11 @@ public void listSettingsContext() { public void listSettingRevisions() { ConfigurationClient client = createSyncConfigurationClient(); // BEGIN: com.azure.data.applicationconfig.configurationclient.listSettingRevisions#settingSelector - SettingSelector settingSelector = new SettingSelector().keys("prodDBConnection"); + SettingSelector settingSelector = new SettingSelector().setKeys("prodDBConnection"); client.listSettingRevisions(settingSelector).streamByPage().forEach(resp -> { - System.out.printf("Response headers are %s. Url %s and status code %d %n", resp.headers(), - resp.request().url(), resp.statusCode()); - resp.items().forEach(value -> { + System.out.printf("Response headers are %s. Url %s and status code %d %n", resp.getHeaders(), + resp.getRequest().getUrl(), resp.getStatusCode()); + resp.getItems().forEach(value -> { System.out.printf("Response value is %d %n", value); }); }); @@ -320,16 +328,17 @@ public void listSettingRevisions() { public void listSettingRevisionsContext() { ConfigurationClient configurationClient = createSyncConfigurationClient(); // BEGIN: com.azure.data.applicationconfig.configurationclient.listSettingRevisions#settingSelector-context - SettingSelector settingSelector = new SettingSelector().keys("prodDBConnection"); + SettingSelector settingSelector = new SettingSelector().setKeys("prodDBConnection"); Context ctx = new Context(key2, value2); configurationClient.listSettingRevisions(settingSelector, ctx).forEach(setting -> { - System.out.printf("Key: %s, Value: %s", setting.key(), setting.value()); + System.out.printf("Key: %s, Value: %s", setting.getKey(), setting.getValue()); }); // END: com.azure.data.applicationconfig.configurationclient.listSettingRevisions#settingSelector-context } /** * Implementation not provided for this method + * * @return {@code null} */ private String getConnectionString() { diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/ConfigurationSets.java b/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/ConfigurationSets.java index 8e05a8dbe5e1..cd0cef5638df 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/ConfigurationSets.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/ConfigurationSets.java @@ -70,26 +70,26 @@ public static void main(String[] args) throws NoSuchAlgorithmException, InvalidK // For your services, you can select settings with "beta" or "production" label, depending on what you want your // services to communicate with. The sample below fetches all of the "beta" settings. - SettingSelector selector = new SettingSelector().labels(BETA); + SettingSelector selector = new SettingSelector().setLabels(BETA); client.listSettings(selector).toStream().forEach(setting -> { - System.out.println("Key: " + setting.key()); - if ("application/json".equals(setting.contentType())) { + System.out.println("Key: " + setting.getKey()); + if ("application/json".equals(setting.getContentType())) { try { - ComplexConfiguration kv = MAPPER.readValue(setting.value(), ComplexConfiguration.class); + ComplexConfiguration kv = MAPPER.readValue(setting.getValue(), ComplexConfiguration.class); System.out.println("Value: " + kv.toString()); } catch (IOException e) { - System.err.println(String.format("Could not deserialize %s%n%s", setting.value(), e.toString())); + System.err.println(String.format("Could not deserialize %s%n%s", setting.getValue(), e.toString())); } } else { - System.out.println("Value: " + setting.value()); + System.out.println("Value: " + setting.getValue()); } }); // For the BETA and PRODUCTION sets, we fetch all of the settings we created in each set, and delete them. // Blocking so that the program does not exit before these tasks have completed. Flux.fromArray(new String[]{BETA, PRODUCTION}) - .flatMap(set -> client.listSettings(new SettingSelector().labels(set))) + .flatMap(set -> client.listSettings(new SettingSelector().setLabels(set))) .map(client::deleteSetting) .blockLast(); } @@ -100,14 +100,14 @@ public static void main(String[] args) throws NoSuchAlgorithmException, InvalidK private static Mono addConfigurations(ConfigurationAsyncClient client, String configurationSet, String storageEndpoint, ComplexConfiguration complexConfiguration) throws JsonProcessingException { ConfigurationSetting endpointSetting = new ConfigurationSetting() - .key(CONNECTION_STRING_KEY) - .label(configurationSet) - .value(storageEndpoint); + .setKey(CONNECTION_STRING_KEY) + .setLabel(configurationSet) + .setValue(storageEndpoint); ConfigurationSetting keyVaultSetting = new ConfigurationSetting() - .key(COMPLEX_SETTING_KEY) - .label(configurationSet) - .value(MAPPER.writeValueAsString(complexConfiguration)) - .contentType("application/json"); + .setKey(COMPLEX_SETTING_KEY) + .setLabel(configurationSet) + .setValue(MAPPER.writeValueAsString(complexConfiguration)) + .setContentType("application/json"); return Flux.merge(client.addSetting(keyVaultSetting), client.addSetting(endpointSetting)).then(); } diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/HelloWorld.java b/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/HelloWorld.java index 08862170d392..a19fd58477ed 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/HelloWorld.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/HelloWorld.java @@ -43,7 +43,7 @@ public static void main(String[] args) throws NoSuchAlgorithmException, InvalidK client.setSetting(key, "world").subscribe( result -> { ConfigurationSetting setting = result; - System.out.println(String.format("Key: %s, Value: %s", setting.key(), setting.value())); + System.out.println(String.format("Key: %s, Value: %s", setting.getKey(), setting.getValue())); }, error -> System.err.println("There was an error adding the setting: " + error.toString()), () -> { diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/PipelineSample.java b/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/PipelineSample.java index 0c4b385f6019..f22af1e6eb04 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/PipelineSample.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/PipelineSample.java @@ -50,9 +50,9 @@ public static void main(String[] args) throws NoSuchAlgorithmException, Invalid .buildAsyncClient(); // Adding a couple of settings and then fetching all the settings in our repository. - final List settings = Flux.concat(client.addSetting(new ConfigurationSetting().key("hello").value("world")), - client.setSetting(new ConfigurationSetting().key("newSetting").value("newValue"))) - .then(client.listSettings(new SettingSelector().keys("*")).collectList()) + final List settings = Flux.concat(client.addSetting(new ConfigurationSetting().setKey("hello").setValue("world")), + client.setSetting(new ConfigurationSetting().setKey("newSetting").setValue("newValue"))) + .then(client.listSettings(new SettingSelector().setKeys("*")).collectList()) .block(); // Cleaning up after ourselves by deleting the values. @@ -97,7 +97,7 @@ static class HttpMethodRequestTrackingPolicy implements HttpPipelinePolicy { @Override public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { - tracker.increment(context.httpRequest().httpMethod()); + tracker.increment(context.getHttpRequest().getHttpMethod()); return next.process(); } } diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationAsyncClientTest.java b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationAsyncClientTest.java index 8b29dc51d313..7e693eaeda6f 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationAsyncClientTest.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationAsyncClientTest.java @@ -4,7 +4,7 @@ import com.azure.core.exception.ResourceModifiedException; import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpClient; +import com.azure.core.http.netty.NettyAsyncHttpClientBuilder; import com.azure.core.http.policy.HttpLogDetailLevel; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.rest.PagedFlux; @@ -14,11 +14,11 @@ import com.azure.data.appconfiguration.models.Range; import com.azure.data.appconfiguration.models.SettingFields; import com.azure.data.appconfiguration.models.SettingSelector; -import io.netty.handler.codec.http.HttpResponseStatus; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; +import java.net.HttpURLConnection; import java.time.Duration; import java.util.ArrayList; import java.util.List; @@ -44,7 +44,7 @@ protected void beforeTest() { } else { client = clientSetup(credentials -> new ConfigurationClientBuilder() .credential(credentials) - .httpClient(HttpClient.createDefault().wiretap(true)) + .httpClient(new NettyAsyncHttpClientBuilder().wiretap(true).build()) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) .addPolicy(interceptorManager.getRecordPolicy()) .addPolicy(new RetryPolicy()) @@ -55,9 +55,9 @@ protected void beforeTest() { @Override protected void afterTest() { logger.info("Cleaning up created key values."); - client.listSettings(new SettingSelector().keys(keyPrefix + "*")) + client.listSettings(new SettingSelector().setKeys(keyPrefix + "*")) .flatMap(configurationSetting -> { - logger.info("Deleting key:label [{}:{}]. isLocked? {}", configurationSetting.key(), configurationSetting.label(), configurationSetting.isLocked()); + logger.info("Deleting key:label [{}:{}]. isLocked? {}", configurationSetting.getKey(), configurationSetting.getLabel(), configurationSetting.isLocked()); return client.deleteSetting(configurationSetting); }) .blockLast(); @@ -80,7 +80,7 @@ public void addSetting() { */ public void addSettingEmptyKey() { StepVerifier.create(client.addSetting("", "A value")) - .verifyErrorSatisfies(ex -> assertRestException(ex, HttpResponseStatus.METHOD_NOT_ALLOWED.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, HttpURLConnection.HTTP_BAD_METHOD)); } /** @@ -88,11 +88,11 @@ public void addSettingEmptyKey() { */ public void addSettingEmptyValue() { addSettingEmptyValueRunner((setting) -> { - StepVerifier.create(client.addSetting(setting.key(), setting.value())) + StepVerifier.create(client.addSetting(setting.getKey(), setting.getValue())) .assertNext(response -> assertConfigurationEquals(setting, response)) .verifyComplete(); - StepVerifier.create(client.getSetting(setting.key())) + StepVerifier.create(client.getSetting(setting.getKey())) .assertNext(response -> assertConfigurationEquals(setting, response)) .verifyComplete(); }); @@ -112,7 +112,7 @@ public void addSettingNullKey() { public void addExistingSetting() { addExistingSettingRunner((expected) -> StepVerifier.create(client.addSetting(expected).then(client.addSetting(expected))) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpResponseStatus.PRECONDITION_FAILED.code()))); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpURLConnection.HTTP_PRECON_FAILED))); } /** @@ -134,17 +134,17 @@ public void setSetting() { public void setSettingIfEtag() { setSettingIfEtagRunner((initial, update) -> { // This etag is not the correct format. It is not the correct hash that the service is expecting. - StepVerifier.create(client.setSetting(initial.etag("badEtag"))) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.PRECONDITION_FAILED.code())); + StepVerifier.create(client.setSetting(initial.setETag("badEtag"))) + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_PRECON_FAILED)); - final String etag = client.addSetting(initial).block().etag(); + final String etag = client.addSetting(initial).block().getETag(); - StepVerifier.create(client.setSetting(update.etag(etag))) + StepVerifier.create(client.setSetting(update.setETag(etag))) .assertNext(response -> assertConfigurationEquals(update, response)) .verifyComplete(); StepVerifier.create(client.setSetting(initial)) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.PRECONDITION_FAILED.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_PRECON_FAILED)); StepVerifier.create(client.getSetting(update)) .assertNext(response -> assertConfigurationEquals(update, response)) @@ -157,7 +157,7 @@ public void setSettingIfEtag() { */ public void setSettingEmptyKey() { StepVerifier.create(client.setSetting("", "A value")) - .verifyErrorSatisfies(ex -> assertRestException(ex, HttpResponseStatus.METHOD_NOT_ALLOWED.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, HttpURLConnection.HTTP_BAD_METHOD)); } /** @@ -166,11 +166,11 @@ public void setSettingEmptyKey() { */ public void setSettingEmptyValue() { setSettingEmptyValueRunner((setting) -> { - StepVerifier.create(client.setSetting(setting.key(), setting.value())) + StepVerifier.create(client.setSetting(setting.getKey(), setting.getValue())) .assertNext(response -> assertConfigurationEquals(setting, response)) .verifyComplete(); - StepVerifier.create(client.getSetting(setting.key())) + StepVerifier.create(client.getSetting(setting.getKey())) .assertNext(response -> assertConfigurationEquals(setting, response)) .verifyComplete(); }); @@ -191,7 +191,7 @@ public void setSettingNullKey() { public void updateNoExistingSetting() { updateNoExistingSettingRunner((expected) -> StepVerifier.create(client.updateSetting(expected)) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.PRECONDITION_FAILED.code()))); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_PRECON_FAILED))); } /** @@ -211,11 +211,11 @@ public void updateSetting() { */ public void updateSettingOverload() { updateSettingOverloadRunner((original, updated) -> { - StepVerifier.create(client.addSetting(original.key(), original.value())) + StepVerifier.create(client.addSetting(original.getKey(), original.getValue())) .assertNext(response -> assertConfigurationEquals(original, response)) .verifyComplete(); - StepVerifier.create(client.updateSetting(updated.key(), updated.value())) + StepVerifier.create(client.updateSetting(updated.getKey(), updated.getValue())) .assertNext(response -> assertConfigurationEquals(updated, response)) .verifyComplete(); }); @@ -239,18 +239,18 @@ public void updateSettingIfEtag() { final ConfigurationSetting update = settings.get(1); final ConfigurationSetting last = settings.get(2); - final String initialEtag = client.addSetting(initial).block().etag(); - final String updateEtag = client.updateSetting(update).block().etag(); + final String initialEtag = client.addSetting(initial).block().getETag(); + final String updateEtag = client.updateSetting(update).block().getETag(); // The setting does not exist in the service yet, so we cannot update it. - StepVerifier.create(client.updateSetting(new ConfigurationSetting().key(last.key()).label(last.label()).value(last.value()).etag(initialEtag))) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.PRECONDITION_FAILED.code())); + StepVerifier.create(client.updateSetting(new ConfigurationSetting().setKey(last.getKey()).setLabel(last.getLabel()).setValue(last.getValue()).setETag(initialEtag))) + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_PRECON_FAILED)); StepVerifier.create(client.getSetting(update)) .assertNext(response -> assertConfigurationEquals(update, response)) .verifyComplete(); - StepVerifier.create(client.updateSetting(new ConfigurationSetting().key(last.key()).label(last.label()).value(last.value()).etag(updateEtag))) + StepVerifier.create(client.updateSetting(new ConfigurationSetting().setKey(last.getKey()).setLabel(last.getLabel()).setValue(last.getValue()).setETag(updateEtag))) .assertNext(response -> assertConfigurationEquals(last, response)) .verifyComplete(); @@ -258,8 +258,8 @@ public void updateSettingIfEtag() { .assertNext(response -> assertConfigurationEquals(last, response)) .verifyComplete(); - StepVerifier.create(client.updateSetting(new ConfigurationSetting().key(initial.key()).label(initial.label()).value(initial.value()).etag(updateEtag))) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.PRECONDITION_FAILED.code())); + StepVerifier.create(client.updateSetting(new ConfigurationSetting().setKey(initial.getKey()).setLabel(initial.getLabel()).setValue(initial.getValue()).setETag(updateEtag))) + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_PRECON_FAILED)); }); } @@ -278,19 +278,19 @@ public void getSetting() { */ public void getSettingNotFound() { final String key = getKey(); - final ConfigurationSetting neverRetrievedConfiguration = new ConfigurationSetting().key(key).value("myNeverRetreivedValue"); - final ConfigurationSetting nonExistentLabel = new ConfigurationSetting().key(key).label("myNonExistentLabel"); + final ConfigurationSetting neverRetrievedConfiguration = new ConfigurationSetting().setKey(key).setValue("myNeverRetreivedValue"); + final ConfigurationSetting nonExistentLabel = new ConfigurationSetting().setKey(key).setLabel("myNonExistentLabel"); StepVerifier.create(client.addSetting(neverRetrievedConfiguration)) .assertNext(response -> assertConfigurationEquals(neverRetrievedConfiguration, response)) .verifyComplete(); StepVerifier.create(client.getSetting("myNonExistentKey")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); StepVerifier.create(client.getSetting(nonExistentLabel)) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); } /** @@ -309,7 +309,7 @@ public void deleteSetting() { .verifyComplete(); StepVerifier.create(client.getSetting(expected)) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); }); } @@ -318,21 +318,21 @@ public void deleteSetting() { */ public void deleteSettingNotFound() { final String key = getKey(); - final ConfigurationSetting neverDeletedConfiguration = new ConfigurationSetting().key(key).value("myNeverDeletedValue"); + final ConfigurationSetting neverDeletedConfiguration = new ConfigurationSetting().setKey(key).setValue("myNeverDeletedValue"); StepVerifier.create(client.addSetting(neverDeletedConfiguration)) .assertNext(response -> assertConfigurationEquals(neverDeletedConfiguration, response)) .verifyComplete(); - StepVerifier.create(client.deleteSettingWithResponse(new ConfigurationSetting().key("myNonExistentKey"))) - .assertNext(response -> assertConfigurationEquals(null, response, HttpResponseStatus.NO_CONTENT.code())) + StepVerifier.create(client.deleteSettingWithResponse(new ConfigurationSetting().setKey("myNonExistentKey"))) + .assertNext(response -> assertConfigurationEquals(null, response, HttpURLConnection.HTTP_NO_CONTENT)) .verifyComplete(); - StepVerifier.create(client.deleteSettingWithResponse(new ConfigurationSetting().key(neverDeletedConfiguration.key()).label("myNonExistentLabel"))) - .assertNext(response -> assertConfigurationEquals(null, response, HttpResponseStatus.NO_CONTENT.code())) + StepVerifier.create(client.deleteSettingWithResponse(new ConfigurationSetting().setKey(neverDeletedConfiguration.getKey()).setLabel("myNonExistentLabel"))) + .assertNext(response -> assertConfigurationEquals(null, response, HttpURLConnection.HTTP_NO_CONTENT)) .verifyComplete(); - StepVerifier.create(client.getSetting(neverDeletedConfiguration.key())) + StepVerifier.create(client.getSetting(neverDeletedConfiguration.getKey())) .assertNext(response -> assertConfigurationEquals(neverDeletedConfiguration, response)) .verifyComplete(); } @@ -351,14 +351,14 @@ public void deleteSettingWithETag() { .verifyComplete(); StepVerifier.create(client.deleteSetting(initiallyAddedConfig)) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.PRECONDITION_FAILED.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_PRECON_FAILED)); StepVerifier.create(client.deleteSetting(updatedConfig)) .assertNext(response -> assertConfigurationEquals(update, response)) .verifyComplete(); StepVerifier.create(client.getSetting(initial)) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); }); } @@ -378,17 +378,17 @@ public void listWithKeyAndLabel() { final String value = "myValue"; final String key = testResourceNamer.randomName(keyPrefix, 16); final String label = testResourceNamer.randomName("lbl", 8); - final ConfigurationSetting expected = new ConfigurationSetting().key(key).value(value).label(label); + final ConfigurationSetting expected = new ConfigurationSetting().setKey(key).setValue(value).setLabel(label); StepVerifier.create(client.setSetting(expected)) .assertNext(response -> assertConfigurationEquals(expected, response)) .verifyComplete(); - StepVerifier.create(client.listSettings(new SettingSelector().keys(key).labels(label))) + StepVerifier.create(client.listSettings(new SettingSelector().setKeys(key).setLabels(label))) .assertNext(configurationSetting -> assertConfigurationEquals(expected, configurationSetting)) .verifyComplete(); - StepVerifier.create(client.listSettings(new SettingSelector().keys(key))) + StepVerifier.create(client.listSettings(new SettingSelector().setKeys(key))) .assertNext(configurationSetting -> assertConfigurationEquals(expected, configurationSetting)) .verifyComplete(); } @@ -412,7 +412,7 @@ public void listWithMultipleKeys() { .assertNext(response -> assertConfigurationEquals(setting2, response)) .verifyComplete(); - StepVerifier.create(client.listSettings(new SettingSelector().keys(key, key2))) + StepVerifier.create(client.listSettings(new SettingSelector().setKeys(key, key2))) .consumeNextWith(selected::add) .consumeNextWith(selected::add) .verifyComplete(); @@ -441,7 +441,7 @@ public void listWithMultipleLabels() { .assertNext(response -> assertConfigurationEquals(setting2, response)) .verifyComplete(); - StepVerifier.create(client.listSettings(new SettingSelector().keys(key).labels(label, label2))) + StepVerifier.create(client.listSettings(new SettingSelector().setKeys(key).setLabels(label, label2))) .consumeNextWith(selected::add) .consumeNextWith(selected::add) .verifyComplete(); @@ -478,9 +478,9 @@ public void listSettingsSelectFields() { */ public void listSettingsAcceptDateTime() { final String keyName = testResourceNamer.randomName(keyPrefix, 16); - final ConfigurationSetting original = new ConfigurationSetting().key(keyName).value("myValue"); - final ConfigurationSetting updated = new ConfigurationSetting().key(original.key()).value("anotherValue"); - final ConfigurationSetting updated2 = new ConfigurationSetting().key(original.key()).value("anotherValue2"); + final ConfigurationSetting original = new ConfigurationSetting().setKey(keyName).setValue("myValue"); + final ConfigurationSetting updated = new ConfigurationSetting().setKey(original.getKey()).setValue("anotherValue"); + final ConfigurationSetting updated2 = new ConfigurationSetting().setKey(original.getKey()).setValue("anotherValue2"); // Create 3 revisions of the same key. StepVerifier.create(client.setSetting(original)) @@ -494,13 +494,13 @@ public void listSettingsAcceptDateTime() { .verifyComplete(); // Gets all versions of this value so we can get the one we want at that particular date. - List revisions = client.listSettingRevisions(new SettingSelector().keys(keyName)).collectList().block(); + List revisions = client.listSettingRevisions(new SettingSelector().setKeys(keyName)).collectList().block(); assertNotNull(revisions); assertEquals(3, revisions.size()); // We want to fetch the configuration setting when we first updated its value. - SettingSelector options = new SettingSelector().keys(keyName).acceptDatetime(revisions.get(1).lastModified()); + SettingSelector options = new SettingSelector().setKeys(keyName).setAcceptDatetime(revisions.get(1).getLastModified()); StepVerifier.create(client.listSettings(options)) .assertNext(response -> assertConfigurationEquals(updated, response)) .verifyComplete(); @@ -512,9 +512,9 @@ public void listSettingsAcceptDateTime() { */ public void listRevisions() { final String keyName = testResourceNamer.randomName(keyPrefix, 16); - final ConfigurationSetting original = new ConfigurationSetting().key(keyName).value("myValue"); - final ConfigurationSetting updated = new ConfigurationSetting().key(original.key()).value("anotherValue"); - final ConfigurationSetting updated2 = new ConfigurationSetting().key(original.key()).value("anotherValue2"); + final ConfigurationSetting original = new ConfigurationSetting().setKey(keyName).setValue("myValue"); + final ConfigurationSetting updated = new ConfigurationSetting().setKey(original.getKey()).setValue("anotherValue"); + final ConfigurationSetting updated2 = new ConfigurationSetting().setKey(original.getKey()).setValue("anotherValue2"); // Create 3 revisions of the same key. StepVerifier.create(client.setSetting(original)) @@ -528,14 +528,14 @@ public void listRevisions() { .verifyComplete(); // Get all revisions for a key, they are listed in descending order. - StepVerifier.create(client.listSettingRevisions(new SettingSelector().keys(keyName))) + StepVerifier.create(client.listSettingRevisions(new SettingSelector().setKeys(keyName))) .assertNext(response -> assertConfigurationEquals(updated2, response)) .assertNext(response -> assertConfigurationEquals(updated, response)) .assertNext(response -> assertConfigurationEquals(original, response)) .verifyComplete(); // Verifies that we can select specific fields. - StepVerifier.create(client.listSettingRevisions(new SettingSelector().keys(keyName).fields(SettingFields.KEY, SettingFields.ETAG))) + StepVerifier.create(client.listSettingRevisions(new SettingSelector().setKeys(keyName).setFields(SettingFields.KEY, SettingFields.ETAG))) .assertNext(response -> validateListRevisions(updated2, response)) .assertNext(response -> validateListRevisions(updated, response)) .assertNext(response -> validateListRevisions(original, response)) @@ -568,7 +568,7 @@ public void listRevisionsWithMultipleKeys() { .assertNext(response -> assertConfigurationEquals(testInput.get(3), response)) .verifyComplete(); - StepVerifier.create(client.listSettingRevisions(new SettingSelector().keys(key, key2))) + StepVerifier.create(client.listSettingRevisions(new SettingSelector().setKeys(key, key2))) .consumeNextWith(selected::add) .consumeNextWith(selected::add) .consumeNextWith(selected::add) @@ -606,7 +606,7 @@ public void listRevisionsWithMultipleLabels() { .assertNext(response -> assertConfigurationEquals(testInput.get(3), response)) .verifyComplete(); - StepVerifier.create(client.listSettingRevisions(new SettingSelector().keys(key).labels(label, label2))) + StepVerifier.create(client.listSettingRevisions(new SettingSelector().setKeys(key).setLabels(label, label2))) .consumeNextWith(selected::add) .consumeNextWith(selected::add) .consumeNextWith(selected::add) @@ -622,9 +622,9 @@ public void listRevisionsWithMultipleLabels() { */ public void listRevisionsWithRange() { final String key = getKey(); - final ConfigurationSetting original = new ConfigurationSetting().key(key).value("myValue"); - final ConfigurationSetting updated = new ConfigurationSetting().key(original.key()).value("anotherValue"); - final ConfigurationSetting updated2 = new ConfigurationSetting().key(original.key()).value("anotherValue2"); + final ConfigurationSetting original = new ConfigurationSetting().setKey(key).setValue("myValue"); + final ConfigurationSetting updated = new ConfigurationSetting().setKey(original.getKey()).setValue("anotherValue"); + final ConfigurationSetting updated2 = new ConfigurationSetting().setKey(original.getKey()).setValue("anotherValue2"); StepVerifier.create(client.addSetting(original)) .assertNext(response -> assertConfigurationEquals(original, response)) @@ -638,7 +638,7 @@ public void listRevisionsWithRange() { .assertNext(response -> assertConfigurationEquals(updated2, response)) .verifyComplete(); - StepVerifier.create(client.listSettingRevisions(new SettingSelector().keys(key).range(new Range(1, 2)))) + StepVerifier.create(client.listSettingRevisions(new SettingSelector().setKeys(key).setRange(new Range(1, 2)))) .assertNext(response -> assertConfigurationEquals(updated, response)) .assertNext(response -> assertConfigurationEquals(original, response)) .verifyComplete(); @@ -649,14 +649,14 @@ public void listRevisionsWithRange() { */ public void listRevisionsInvalidRange() { final String key = getKey(); - final ConfigurationSetting original = new ConfigurationSetting().key(key).value("myValue"); + final ConfigurationSetting original = new ConfigurationSetting().setKey(key).setValue("myValue"); StepVerifier.create(client.addSetting(original)) .assertNext(response -> assertConfigurationEquals(original, response)) .verifyComplete(); - StepVerifier.create(client.listSettingRevisions(new SettingSelector().keys(key).range(new Range(0, 10)))) - .verifyErrorSatisfies(exception -> assertRestException(exception, HttpResponseStatus.REQUESTED_RANGE_NOT_SATISFIABLE.code())); + StepVerifier.create(client.listSettingRevisions(new SettingSelector().setKeys(key).setRange(new Range(0, 10)))) + .verifyErrorSatisfies(exception -> assertRestException(exception, 416)); // REQUESTED_RANGE_NOT_SATISFIABLE } /** @@ -664,9 +664,9 @@ public void listRevisionsInvalidRange() { */ public void listRevisionsAcceptDateTime() { final String keyName = testResourceNamer.randomName(keyPrefix, 16); - final ConfigurationSetting original = new ConfigurationSetting().key(keyName).value("myValue"); - final ConfigurationSetting updated = new ConfigurationSetting().key(original.key()).value("anotherValue"); - final ConfigurationSetting updated2 = new ConfigurationSetting().key(original.key()).value("anotherValue2"); + final ConfigurationSetting original = new ConfigurationSetting().setKey(keyName).setValue("myValue"); + final ConfigurationSetting updated = new ConfigurationSetting().setKey(original.getKey()).setValue("anotherValue"); + final ConfigurationSetting updated2 = new ConfigurationSetting().setKey(original.getKey()).setValue("anotherValue2"); // Create 3 revisions of the same key. StepVerifier.create(client.setSetting(original)) @@ -680,14 +680,14 @@ public void listRevisionsAcceptDateTime() { .verifyComplete(); // Gets all versions of this value. - List revisions = client.listSettingRevisions(new SettingSelector().keys(keyName)).collectList().block(); + List revisions = client.listSettingRevisions(new SettingSelector().setKeys(keyName)).collectList().block(); assertNotNull(revisions); assertEquals(3, revisions.size()); // We want to fetch all the revisions that existed up and including when the first revision was created. // Revisions are returned in descending order from creation date. - SettingSelector options = new SettingSelector().keys(keyName).acceptDatetime(revisions.get(1).lastModified()); + SettingSelector options = new SettingSelector().setKeys(keyName).setAcceptDatetime(revisions.get(1).getLastModified()); StepVerifier.create(client.listSettingRevisions(options)) .assertNext(response -> assertConfigurationEquals(updated, response)) .assertNext(response -> assertConfigurationEquals(original, response)) @@ -702,7 +702,7 @@ public void listRevisionsWithPagination() { final int numberExpected = 50; List settings = new ArrayList<>(numberExpected); for (int value = 0; value < numberExpected; value++) { - settings.add(new ConfigurationSetting().key(keyPrefix).value("myValue" + value).label(labelPrefix)); + settings.add(new ConfigurationSetting().setKey(keyPrefix).setValue("myValue" + value).setLabel(labelPrefix)); } List>> results = new ArrayList<>(); @@ -710,7 +710,7 @@ public void listRevisionsWithPagination() { results.add(client.setSettingWithResponse(setting)); } - SettingSelector filter = new SettingSelector().keys(keyPrefix).labels(labelPrefix); + SettingSelector filter = new SettingSelector().setKeys(keyPrefix).setLabels(labelPrefix); Flux.merge(results).blockLast(); StepVerifier.create(client.listSettingRevisions(filter)) @@ -727,12 +727,12 @@ public void listRevisionsWithPaginationAndRepeatStream() { List settings = new ArrayList<>(numberExpected); List>> results = new ArrayList<>(); for (int value = 0; value < numberExpected; value++) { - ConfigurationSetting setting = new ConfigurationSetting().key(keyPrefix).value("myValue" + value).label(labelPrefix); + ConfigurationSetting setting = new ConfigurationSetting().setKey(keyPrefix).setValue("myValue" + value).setLabel(labelPrefix); settings.add(setting); results.add(client.setSettingWithResponse(setting)); } - SettingSelector filter = new SettingSelector().keys(keyPrefix).labels(labelPrefix); + SettingSelector filter = new SettingSelector().setKeys(keyPrefix).setLabels(labelPrefix); Flux.merge(results).blockLast(); @@ -756,12 +756,12 @@ public void listRevisionsWithPaginationAndRepeatIterator() { List settings = new ArrayList<>(numberExpected); List>> results = new ArrayList<>(); for (int value = 0; value < numberExpected; value++) { - ConfigurationSetting setting = new ConfigurationSetting().key(keyPrefix).value("myValue" + value).label(labelPrefix); + ConfigurationSetting setting = new ConfigurationSetting().setKey(keyPrefix).setValue("myValue" + value).setLabel(labelPrefix); settings.add(setting); results.add(client.setSettingWithResponse(setting)); } - SettingSelector filter = new SettingSelector().keys(keyPrefix).labels(labelPrefix); + SettingSelector filter = new SettingSelector().setKeys(keyPrefix).setLabels(labelPrefix); Flux.merge(results).blockLast(); @@ -783,7 +783,7 @@ public void listSettingsWithPagination() { final int numberExpected = 50; List settings = new ArrayList<>(numberExpected); for (int value = 0; value < numberExpected; value++) { - settings.add(new ConfigurationSetting().key(keyPrefix + "-" + value).value("myValue").label(labelPrefix)); + settings.add(new ConfigurationSetting().setKey(keyPrefix + "-" + value).setValue("myValue").setLabel(labelPrefix)); } List>> results = new ArrayList<>(); @@ -791,7 +791,7 @@ public void listSettingsWithPagination() { results.add(client.setSettingWithResponse(setting)); } - SettingSelector filter = new SettingSelector().keys(keyPrefix + "-*").labels(labelPrefix); + SettingSelector filter = new SettingSelector().setKeys(keyPrefix + "-*").setLabels(labelPrefix); Flux.merge(results).blockLast(); StepVerifier.create(client.listSettings(filter)) @@ -805,8 +805,8 @@ public void listSettingsWithPagination() { */ public void getSettingWhenValueNotUpdated() { final String key = testResourceNamer.randomName(keyPrefix, 16); - final ConfigurationSetting expected = new ConfigurationSetting().key(key).value("myValue"); - final ConfigurationSetting newExpected = new ConfigurationSetting().key(key).value("myNewValue"); + final ConfigurationSetting expected = new ConfigurationSetting().setKey(key).setValue("myValue"); + final ConfigurationSetting newExpected = new ConfigurationSetting().setKey(key).setValue("myNewValue"); final ConfigurationSetting block = client.addSetting(expected).single().block(); assertNotNull(block); @@ -818,9 +818,9 @@ public void getSettingWhenValueNotUpdated() { } public void deleteAllSettings() { - client.listSettings(new SettingSelector().keys("*")) + client.listSettings(new SettingSelector().setKeys("*")) .flatMap(configurationSetting -> { - logger.info("Deleting key:label [{}:{}]. isLocked? {}", configurationSetting.key(), configurationSetting.label(), configurationSetting.isLocked()); + logger.info("Deleting key:label [{}:{}]. isLocked? {}", configurationSetting.getKey(), configurationSetting.getLabel(), configurationSetting.isLocked()); return client.deleteSetting(configurationSetting); }).blockLast(); } diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTest.java b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTest.java index 1f243bb73ec2..bdcb9ff0d0f2 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTest.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTest.java @@ -2,20 +2,20 @@ // Licensed under the MIT License. package com.azure.data.appconfiguration; +import com.azure.core.http.netty.NettyAsyncHttpClientBuilder; import com.azure.data.appconfiguration.models.ConfigurationSetting; import com.azure.data.appconfiguration.models.Range; import com.azure.data.appconfiguration.models.SettingFields; import com.azure.data.appconfiguration.models.SettingSelector; import com.azure.core.exception.ResourceModifiedException; import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.HttpClient; import com.azure.core.http.policy.HttpLogDetailLevel; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import io.netty.handler.codec.http.HttpResponseStatus; +import java.net.HttpURLConnection; import java.util.ArrayList; import java.util.List; @@ -43,7 +43,7 @@ protected void beforeTest() { } else { client = clientSetup(credentials -> new ConfigurationClientBuilder() .credential(credentials) - .httpClient(HttpClient.createDefault().wiretap(true)) + .httpClient(new NettyAsyncHttpClientBuilder().wiretap(true).build()) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) .addPolicy(interceptorManager.getRecordPolicy()) .addPolicy(new RetryPolicy()) @@ -54,8 +54,8 @@ protected void beforeTest() { @Override protected void afterTest() { logger.info("Cleaning up created key values."); - client.listSettings(new SettingSelector().keys(keyPrefix + "*")).forEach(configurationSetting -> { - logger.info("Deleting key:label [{}:{}]. isLocked? {}", configurationSetting.key(), configurationSetting.label(), configurationSetting.isLocked()); + client.listSettings(new SettingSelector().setKeys(keyPrefix + "*")).forEach(configurationSetting -> { + logger.info("Deleting key:label [{}:{}]. isLocked? {}", configurationSetting.getKey(), configurationSetting.getLabel(), configurationSetting.isLocked()); client.deleteSetting(configurationSetting); }); @@ -73,7 +73,7 @@ public void addSetting() { * Tests that we cannot add a configuration setting when the key is an empty string. */ public void addSettingEmptyKey() { - assertRestException(() -> client.addSetting("", "A value"), HttpResponseStatus.METHOD_NOT_ALLOWED.code()); + assertRestException(() -> client.addSetting("", "A value"), HttpURLConnection.HTTP_BAD_METHOD); } /** @@ -81,8 +81,8 @@ public void addSettingEmptyKey() { */ public void addSettingEmptyValue() { addSettingEmptyValueRunner((setting) -> { - assertConfigurationEquals(setting, client.addSetting(setting.key(), setting.value())); - assertConfigurationEquals(setting, client.getSetting(setting.key())); + assertConfigurationEquals(setting, client.addSetting(setting.getKey(), setting.getValue())); + assertConfigurationEquals(setting, client.getSetting(setting.getKey())); }); } @@ -100,7 +100,7 @@ public void addSettingNullKey() { public void addExistingSetting() { addExistingSettingRunner((expected) -> { client.addSetting(expected); - assertRestException(() -> client.addSetting(expected), ResourceModifiedException.class, HttpResponseStatus.PRECONDITION_FAILED.code()); + assertRestException(() -> client.addSetting(expected), ResourceModifiedException.class, HttpURLConnection.HTTP_PRECON_FAILED); }); } @@ -120,12 +120,12 @@ public void setSetting() { public void setSettingIfEtag() { setSettingIfEtagRunner((initial, update) -> { // This etag is not the correct format. It is not the correct hash that the service is expecting. - assertRestException(() -> client.setSetting(initial.etag("badEtag")), ResourceNotFoundException.class, HttpResponseStatus.PRECONDITION_FAILED.code()); + assertRestException(() -> client.setSetting(initial.setETag("badEtag")), ResourceNotFoundException.class, HttpURLConnection.HTTP_PRECON_FAILED); - final String etag = client.addSetting(initial).etag(); + final String etag = client.addSetting(initial).getETag(); - assertConfigurationEquals(update, client.setSetting(update.etag(etag))); - assertRestException(() -> client.setSetting(initial), ResourceNotFoundException.class, HttpResponseStatus.PRECONDITION_FAILED.code()); + assertConfigurationEquals(update, client.setSetting(update.setETag(etag))); + assertRestException(() -> client.setSetting(initial), ResourceNotFoundException.class, HttpURLConnection.HTTP_PRECON_FAILED); assertConfigurationEquals(update, client.getSetting(update)); }); } @@ -134,7 +134,7 @@ public void setSettingIfEtag() { * Tests that we cannot set a configuration setting when the key is an empty string. */ public void setSettingEmptyKey() { - assertRestException(() -> client.setSetting("", "A value"), HttpResponseStatus.METHOD_NOT_ALLOWED.code()); + assertRestException(() -> client.setSetting("", "A value"), HttpURLConnection.HTTP_BAD_METHOD); } /** @@ -143,8 +143,8 @@ public void setSettingEmptyKey() { */ public void setSettingEmptyValue() { setSettingEmptyValueRunner((setting) -> { - assertConfigurationEquals(setting, client.setSetting(setting.key(), setting.value())); - assertConfigurationEquals(setting, client.getSetting(setting.key())); + assertConfigurationEquals(setting, client.setSetting(setting.getKey(), setting.getValue())); + assertConfigurationEquals(setting, client.getSetting(setting.getKey())); }); } @@ -162,7 +162,7 @@ public void setSettingNullKey() { */ public void updateNoExistingSetting() { updateNoExistingSettingRunner((expected) -> - assertRestException(() -> client.updateSetting(expected), ResourceNotFoundException.class, HttpResponseStatus.PRECONDITION_FAILED.code()) + assertRestException(() -> client.updateSetting(expected), ResourceNotFoundException.class, HttpURLConnection.HTTP_PRECON_FAILED) ); } @@ -180,8 +180,8 @@ public void updateSetting() { */ public void updateSettingOverload() { updateSettingOverloadRunner((original, updated) -> { - assertConfigurationEquals(original, client.addSetting(original.key(), original.value())); - assertConfigurationEquals(updated, client.updateSetting(updated.key(), updated.value())); + assertConfigurationEquals(original, client.addSetting(original.getKey(), original.getValue())); + assertConfigurationEquals(updated, client.updateSetting(updated.getKey(), updated.getValue())); }); } @@ -195,21 +195,21 @@ public void updateSettingIfEtag() { final ConfigurationSetting update = settings.get(1); final ConfigurationSetting last = settings.get(2); - final String initialEtag = client.addSetting(initial).etag(); - final String updateEtag = client.updateSetting(update).etag(); + final String initialEtag = client.addSetting(initial).getETag(); + final String updateEtag = client.updateSetting(update).getETag(); // The setting does not exist in the service yet, so we cannot update it. - assertRestException(() -> client.updateSetting(new ConfigurationSetting().key(last.key()).label(last.label()).value(last.value()).etag(initialEtag)), + assertRestException(() -> client.updateSetting(new ConfigurationSetting().setKey(last.getKey()).setLabel(last.getLabel()).setValue(last.getValue()).setETag(initialEtag)), ResourceNotFoundException.class, - HttpResponseStatus.PRECONDITION_FAILED.code()); + HttpURLConnection.HTTP_PRECON_FAILED); assertConfigurationEquals(update, client.getSetting(update)); - assertConfigurationEquals(last, client.updateSetting(new ConfigurationSetting().key(last.key()).label(last.label()).value(last.value()).etag(updateEtag))); + assertConfigurationEquals(last, client.updateSetting(new ConfigurationSetting().setKey(last.getKey()).setLabel(last.getLabel()).setValue(last.getValue()).setETag(updateEtag))); assertConfigurationEquals(last, client.getSetting(last)); - assertRestException(() -> client.updateSetting(new ConfigurationSetting().key(initial.key()).label(initial.label()).value(initial.value()).etag(updateEtag)), + assertRestException(() -> client.updateSetting(new ConfigurationSetting().setKey(initial.getKey()).setLabel(initial.getLabel()).setValue(initial.getValue()).setETag(updateEtag)), ResourceNotFoundException.class, - HttpResponseStatus.PRECONDITION_FAILED.code()); + HttpURLConnection.HTTP_PRECON_FAILED); }); } @@ -236,13 +236,13 @@ public void getSetting() { */ public void getSettingNotFound() { final String key = getKey(); - final ConfigurationSetting neverRetrievedConfiguration = new ConfigurationSetting().key(key).value("myNeverRetreivedValue"); - final ConfigurationSetting nonExistentLabel = new ConfigurationSetting().key(key).label("myNonExistentLabel"); + final ConfigurationSetting neverRetrievedConfiguration = new ConfigurationSetting().setKey(key).setValue("myNeverRetreivedValue"); + final ConfigurationSetting nonExistentLabel = new ConfigurationSetting().setKey(key).setLabel("myNonExistentLabel"); assertConfigurationEquals(neverRetrievedConfiguration, client.addSetting(neverRetrievedConfiguration)); - assertRestException(() -> client.getSetting("myNonExistentKey"), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); - assertRestException(() -> client.getSetting(nonExistentLabel), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.getSetting("myNonExistentKey"), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); + assertRestException(() -> client.getSetting(nonExistentLabel), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); } /** @@ -256,7 +256,7 @@ public void deleteSetting() { assertConfigurationEquals(expected, client.getSetting(expected)); assertConfigurationEquals(expected, client.deleteSetting(expected)); - assertRestException(() -> client.getSetting(expected), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.getSetting(expected), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); }); } @@ -265,15 +265,15 @@ public void deleteSetting() { */ public void deleteSettingNotFound() { final String key = getKey(); - final ConfigurationSetting neverDeletedConfiguation = new ConfigurationSetting().key(key).value("myNeverDeletedValue"); - final ConfigurationSetting notFoundDelete = new ConfigurationSetting().key(key).label("myNonExistentLabel"); + final ConfigurationSetting neverDeletedConfiguation = new ConfigurationSetting().setKey(key).setValue("myNeverDeletedValue"); + final ConfigurationSetting notFoundDelete = new ConfigurationSetting().setKey(key).setLabel("myNonExistentLabel"); assertConfigurationEquals(neverDeletedConfiguation, client.addSetting(neverDeletedConfiguation)); assertConfigurationEquals(null, client.deleteSetting("myNonExistentKey")); - assertConfigurationEquals(null, client.deleteSettingWithResponse(notFoundDelete, Context.NONE), HttpResponseStatus.NO_CONTENT.code()); + assertConfigurationEquals(null, client.deleteSettingWithResponse(notFoundDelete, Context.NONE), HttpURLConnection.HTTP_NO_CONTENT); - assertConfigurationEquals(neverDeletedConfiguation, client.getSetting(neverDeletedConfiguation.key())); + assertConfigurationEquals(neverDeletedConfiguation, client.getSetting(neverDeletedConfiguation.getKey())); } /** @@ -286,9 +286,9 @@ public void deleteSettingWithETag() { final ConfigurationSetting updatedConfig = client.updateSetting(update); assertConfigurationEquals(update, client.getSetting(initial)); - assertRestException(() -> client.deleteSetting(initiallyAddedConfig), ResourceNotFoundException.class, HttpResponseStatus.PRECONDITION_FAILED.code()); + assertRestException(() -> client.deleteSetting(initiallyAddedConfig), ResourceNotFoundException.class, HttpURLConnection.HTTP_PRECON_FAILED); assertConfigurationEquals(update, client.deleteSetting(updatedConfig)); - assertRestException(() -> client.getSetting(initial), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.getSetting(initial), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); }); } @@ -309,11 +309,11 @@ public void listWithKeyAndLabel() { final String value = "myValue"; final String key = getKey(); final String label = getLabel(); - final ConfigurationSetting expected = new ConfigurationSetting().key(key).value(value).label(label); + final ConfigurationSetting expected = new ConfigurationSetting().setKey(key).setValue(value).setLabel(label); assertConfigurationEquals(expected, client.setSetting(expected)); - assertConfigurationEquals(expected, client.listSettings(new SettingSelector().keys(key).labels(label)).iterator().next()); - assertConfigurationEquals(expected, client.listSettings(new SettingSelector().keys(key)).iterator().next()); + assertConfigurationEquals(expected, client.listSettings(new SettingSelector().setKeys(key).setLabels(label)).iterator().next()); + assertConfigurationEquals(expected, client.listSettings(new SettingSelector().setKeys(key)).iterator().next()); } /** @@ -328,7 +328,7 @@ public void listWithMultipleKeys() { assertConfigurationEquals(setting, client.addSetting(setting)); assertConfigurationEquals(setting2, client.addSetting(setting2)); - return client.listSettings(new SettingSelector().keys(key, key2)); + return client.listSettings(new SettingSelector().setKeys(key, key2)); }); } @@ -345,7 +345,7 @@ public void listWithMultipleLabels() { assertConfigurationEquals(setting, client.addSetting(setting)); assertConfigurationEquals(setting2, client.addSetting(setting2)); - return client.listSettings(new SettingSelector().keys(key).labels(label, label2)); + return client.listSettings(new SettingSelector().setKeys(key).setLabels(label, label2)); }); } @@ -364,9 +364,9 @@ public void listSettingsSelectFields() { */ public void listSettingsAcceptDateTime() { final String keyName = getKey(); - final ConfigurationSetting original = new ConfigurationSetting().key(keyName).value("myValue"); - final ConfigurationSetting updated = new ConfigurationSetting().key(original.key()).value("anotherValue"); - final ConfigurationSetting updated2 = new ConfigurationSetting().key(original.key()).value("anotherValue2"); + final ConfigurationSetting original = new ConfigurationSetting().setKey(keyName).setValue("myValue"); + final ConfigurationSetting updated = new ConfigurationSetting().setKey(original.getKey()).setValue("anotherValue"); + final ConfigurationSetting updated2 = new ConfigurationSetting().setKey(original.getKey()).setValue("anotherValue2"); // Create 3 revisions of the same key. try { @@ -380,13 +380,13 @@ public void listSettingsAcceptDateTime() { } // Gets all versions of this value so we can get the one we want at that particular date. - List revisions = client.listSettingRevisions(new SettingSelector().keys(keyName)).stream().collect(Collectors.toList()); + List revisions = client.listSettingRevisions(new SettingSelector().setKeys(keyName)).stream().collect(Collectors.toList()); assertNotNull(revisions); assertEquals(3, revisions.size()); // We want to fetch the configuration setting when we first updated its value. - SettingSelector options = new SettingSelector().keys(keyName).acceptDatetime(revisions.get(1).lastModified()); + SettingSelector options = new SettingSelector().setKeys(keyName).setAcceptDatetime(revisions.get(1).getLastModified()); assertConfigurationEquals(updated, (client.listSettings(options).stream().collect(Collectors.toList())).get(0)); } @@ -396,9 +396,9 @@ public void listSettingsAcceptDateTime() { */ public void listRevisions() { final String keyName = getKey(); - final ConfigurationSetting original = new ConfigurationSetting().key(keyName).value("myValue"); - final ConfigurationSetting updated = new ConfigurationSetting().key(original.key()).value("anotherValue"); - final ConfigurationSetting updated2 = new ConfigurationSetting().key(original.key()).value("anotherValue2"); + final ConfigurationSetting original = new ConfigurationSetting().setKey(keyName).setValue("myValue"); + final ConfigurationSetting updated = new ConfigurationSetting().setKey(original.getKey()).setValue("anotherValue"); + final ConfigurationSetting updated2 = new ConfigurationSetting().setKey(original.getKey()).setValue("anotherValue2"); // Create 3 revisions of the same key. assertConfigurationEquals(original, client.setSetting(original)); @@ -406,13 +406,13 @@ public void listRevisions() { assertConfigurationEquals(updated2, client.setSetting(updated2)); // Get all revisions for a key, they are listed in descending order. - List revisions = client.listSettingRevisions(new SettingSelector().keys(keyName)).stream().collect(Collectors.toList()); + List revisions = client.listSettingRevisions(new SettingSelector().setKeys(keyName)).stream().collect(Collectors.toList()); assertConfigurationEquals(updated2, revisions.get(0)); assertConfigurationEquals(updated, revisions.get(1)); assertConfigurationEquals(original, revisions.get(2)); // Verifies that we can select specific fields. - revisions = client.listSettingRevisions(new SettingSelector().keys(keyName).fields(SettingFields.KEY, SettingFields.ETAG)).stream().collect(Collectors.toList()); + revisions = client.listSettingRevisions(new SettingSelector().setKeys(keyName).setFields(SettingFields.KEY, SettingFields.ETAG)).stream().collect(Collectors.toList()); validateListRevisions(updated2, revisions.get(0)); validateListRevisions(updated, revisions.get(1)); validateListRevisions(original, revisions.get(2)); @@ -431,7 +431,7 @@ public void listRevisionsWithMultipleKeys() { assertConfigurationEquals(testInput.get(2), client.addSetting(testInput.get(2))); assertConfigurationEquals(testInput.get(3), client.updateSetting(testInput.get(3))); - return client.listSettingRevisions(new SettingSelector().keys(key, key2)); + return client.listSettingRevisions(new SettingSelector().setKeys(key, key2)); }); } @@ -449,7 +449,7 @@ public void listRevisionsWithMultipleLabels() { assertConfigurationEquals(testInput.get(2), client.addSetting(testInput.get(2))); assertConfigurationEquals(testInput.get(3), client.updateSetting(testInput.get(3))); - return client.listSettingRevisions(new SettingSelector().keys(key).labels(label, label2)); + return client.listSettingRevisions(new SettingSelector().setKeys(key).setLabels(label, label2)); }); } @@ -458,15 +458,15 @@ public void listRevisionsWithMultipleLabels() { */ public void listRevisionsWithRange() { final String key = getKey(); - final ConfigurationSetting original = new ConfigurationSetting().key(key).value("myValue"); - final ConfigurationSetting updated = new ConfigurationSetting().key(original.key()).value("anotherValue"); - final ConfigurationSetting updated2 = new ConfigurationSetting().key(original.key()).value("anotherValue2"); + final ConfigurationSetting original = new ConfigurationSetting().setKey(key).setValue("myValue"); + final ConfigurationSetting updated = new ConfigurationSetting().setKey(original.getKey()).setValue("anotherValue"); + final ConfigurationSetting updated2 = new ConfigurationSetting().setKey(original.getKey()).setValue("anotherValue2"); assertConfigurationEquals(original, client.addSetting(original)); assertConfigurationEquals(updated, client.updateSetting(updated)); assertConfigurationEquals(updated2, client.updateSetting(updated2)); - List revisions = client.listSettingRevisions(new SettingSelector().keys(key).range(new Range(1, 2))).stream().collect(Collectors.toList()); + List revisions = client.listSettingRevisions(new SettingSelector().setKeys(key).setRange(new Range(1, 2))).stream().collect(Collectors.toList()); assertConfigurationEquals(updated, revisions.get(0)); assertConfigurationEquals(original, revisions.get(1)); } @@ -474,13 +474,14 @@ public void listRevisionsWithRange() { /** * Verifies that an exception will be thrown from the service if it cannot satisfy the range request. */ + @Override public void listRevisionsInvalidRange() { final String key = getKey(); - final ConfigurationSetting original = new ConfigurationSetting().key(key).value("myValue"); + final ConfigurationSetting original = new ConfigurationSetting().setKey(key).setValue("myValue"); assertConfigurationEquals(original, client.addSetting(original)); - assertRestException(() -> client.listSettingRevisions(new SettingSelector().keys(key).range(new Range(0, 10))).forEach(cs -> cs.key()), - HttpResponseStatus.REQUESTED_RANGE_NOT_SATISFIABLE.code()); + assertRestException(() -> client.listSettingRevisions(new SettingSelector().setKeys(key).setRange(new Range(0, 10))), + 416); // REQUESTED_RANGE_NOT_SATISFIABLE } /** @@ -488,9 +489,9 @@ public void listRevisionsInvalidRange() { */ public void listRevisionsAcceptDateTime() { final String keyName = getKey(); - final ConfigurationSetting original = new ConfigurationSetting().key(keyName).value("myValue"); - final ConfigurationSetting updated = new ConfigurationSetting().key(original.key()).value("anotherValue"); - final ConfigurationSetting updated2 = new ConfigurationSetting().key(original.key()).value("anotherValue2"); + final ConfigurationSetting original = new ConfigurationSetting().setKey(keyName).setValue("myValue"); + final ConfigurationSetting updated = new ConfigurationSetting().setKey(original.getKey()).setValue("anotherValue"); + final ConfigurationSetting updated2 = new ConfigurationSetting().setKey(original.getKey()).setValue("anotherValue2"); // Create 3 revisions of the same key. try { @@ -504,14 +505,14 @@ public void listRevisionsAcceptDateTime() { } // Gets all versions of this value. - List revisions = client.listSettingRevisions(new SettingSelector().keys(keyName)).stream().collect(Collectors.toList()); + List revisions = client.listSettingRevisions(new SettingSelector().setKeys(keyName)).stream().collect(Collectors.toList()); assertNotNull(revisions); assertEquals(3, revisions.size()); // We want to fetch all the revisions that existed up and including when the first revision was created. // Revisions are returned in descending order from creation date. - SettingSelector options = new SettingSelector().keys(keyName).acceptDatetime(revisions.get(1).lastModified()); + SettingSelector options = new SettingSelector().setKeys(keyName).setAcceptDatetime(revisions.get(1).getLastModified()); revisions = client.listSettingRevisions(options).stream().collect(Collectors.toList()); assertConfigurationEquals(updated, revisions.get(0)); assertConfigurationEquals(original, revisions.get(1)); @@ -524,10 +525,10 @@ public void listRevisionsAcceptDateTime() { public void listRevisionsWithPagination() { final int numberExpected = 50; for (int value = 0; value < numberExpected; value++) { - client.setSetting(new ConfigurationSetting().key(keyPrefix).value("myValue" + value).label(labelPrefix)); + client.setSetting(new ConfigurationSetting().setKey(keyPrefix).setValue("myValue" + value).setLabel(labelPrefix)); } - SettingSelector filter = new SettingSelector().keys(keyPrefix).labels(labelPrefix); + SettingSelector filter = new SettingSelector().setKeys(keyPrefix).setLabels(labelPrefix); assertEquals(numberExpected, client.listSettingRevisions(filter).stream().collect(Collectors.toList()).size()); } @@ -538,10 +539,10 @@ public void listRevisionsWithPagination() { public void listRevisionsWithPaginationAndRepeatStream() { final int numberExpected = 50; for (int value = 0; value < numberExpected; value++) { - client.setSetting(new ConfigurationSetting().key(keyPrefix).value("myValue" + value).label(labelPrefix)); + client.setSetting(new ConfigurationSetting().setKey(keyPrefix).setValue("myValue" + value).setLabel(labelPrefix)); } - SettingSelector filter = new SettingSelector().keys(keyPrefix).labels(labelPrefix); + SettingSelector filter = new SettingSelector().setKeys(keyPrefix).setLabels(labelPrefix); PagedIterable configurationSettingPagedIterable = client.listSettingRevisions(filter); assertEquals(numberExpected, configurationSettingPagedIterable.stream().collect(Collectors.toList()).size()); @@ -555,10 +556,10 @@ public void listRevisionsWithPaginationAndRepeatStream() { public void listRevisionsWithPaginationAndRepeatIterator() { final int numberExpected = 50; for (int value = 0; value < numberExpected; value++) { - client.setSetting(new ConfigurationSetting().key(keyPrefix).value("myValue" + value).label(labelPrefix)); + client.setSetting(new ConfigurationSetting().setKey(keyPrefix).setValue("myValue" + value).setLabel(labelPrefix)); } - SettingSelector filter = new SettingSelector().keys(keyPrefix).labels(labelPrefix); + SettingSelector filter = new SettingSelector().setKeys(keyPrefix).setLabels(labelPrefix); PagedIterable configurationSettingPagedIterable = client.listSettingRevisions(filter); List configurationSettingList1 = new ArrayList<>(); @@ -580,9 +581,9 @@ public void listRevisionsWithPaginationAndRepeatIterator() { public void listSettingsWithPagination() { final int numberExpected = 50; for (int value = 0; value < numberExpected; value++) { - client.setSetting(new ConfigurationSetting().key(keyPrefix + "-" + value).value("myValue").label(labelPrefix)); + client.setSetting(new ConfigurationSetting().setKey(keyPrefix + "-" + value).setValue("myValue").setLabel(labelPrefix)); } - SettingSelector filter = new SettingSelector().keys(keyPrefix + "-*").labels(labelPrefix); + SettingSelector filter = new SettingSelector().setKeys(keyPrefix + "-*").setLabels(labelPrefix); assertEquals(numberExpected, client.listSettings(filter).stream().count()); } @@ -593,8 +594,8 @@ public void listSettingsWithPagination() { */ public void getSettingWhenValueNotUpdated() { final String key = getKey(); - final ConfigurationSetting expected = new ConfigurationSetting().key(key).value("myValue"); - final ConfigurationSetting newExpected = new ConfigurationSetting().key(key).value("myNewValue"); + final ConfigurationSetting expected = new ConfigurationSetting().setKey(key).setValue("myValue"); + final ConfigurationSetting newExpected = new ConfigurationSetting().setKey(key).setValue("myNewValue"); final ConfigurationSetting block = client.addSetting(expected); assertNotNull(block); @@ -604,8 +605,8 @@ public void getSettingWhenValueNotUpdated() { public void deleteAllSettings() { - client.listSettings(new SettingSelector().keys("*")).forEach(configurationSetting -> { - logger.info("Deleting key:label [{}:{}]. isLocked? {}", configurationSetting.key(), configurationSetting.label(), configurationSetting.isLocked()); + client.listSettings(new SettingSelector().setKeys("*")).forEach(configurationSetting -> { + logger.info("Deleting key:label [{}:{}]. isLocked? {}", configurationSetting.getKey(), configurationSetting.getLabel(), configurationSetting.isLocked()); client.deleteSetting(configurationSetting); }); } diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTestBase.java b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTestBase.java index 097d604b5be8..ea737e96183e 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTestBase.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTestBase.java @@ -58,7 +58,7 @@ public abstract class ConfigurationClientTestBase extends TestBase { public TestName testName = new TestName(); @Override - public String testName() { + public String getTestName() { return testName.getMethodName(); } @@ -105,13 +105,13 @@ void addSettingRunner(Consumer testRunner) { tags.put("AnotherTag", "AnotherTagValue"); final ConfigurationSetting newConfiguration = new ConfigurationSetting() - .key(getKey()) - .value("myNewValue") - .tags(tags) - .contentType("text"); + .setKey(getKey()) + .setValue("myNewValue") + .setTags(tags) + .setContentType("text"); testRunner.accept(newConfiguration); - testRunner.accept(newConfiguration.label(getLabel())); + testRunner.accept(newConfiguration.setLabel(getLabel())); } @Test @@ -122,8 +122,8 @@ void addSettingRunner(Consumer testRunner) { void addSettingEmptyValueRunner(Consumer testRunner) { String key = getKey(); - ConfigurationSetting setting = new ConfigurationSetting().key(key); - ConfigurationSetting setting2 = new ConfigurationSetting().key(key + "-1").value(""); + ConfigurationSetting setting = new ConfigurationSetting().setKey(key); + ConfigurationSetting setting2 = new ConfigurationSetting().setKey(key + "-1").setValue(""); testRunner.accept(setting); testRunner.accept(setting2); @@ -136,10 +136,10 @@ void addSettingEmptyValueRunner(Consumer testRunner) { public abstract void addExistingSetting(); void addExistingSettingRunner(Consumer testRunner) { - final ConfigurationSetting newConfiguration = new ConfigurationSetting().key(getKey()).value("myNewValue"); + final ConfigurationSetting newConfiguration = new ConfigurationSetting().setKey(getKey()).setValue("myNewValue"); testRunner.accept(newConfiguration); - testRunner.accept(newConfiguration.label(getLabel())); + testRunner.accept(newConfiguration.setLabel(getLabel())); } @Test @@ -149,11 +149,11 @@ void setSettingRunner(BiConsumer tes String key = getKey(); String label = getLabel(); - final ConfigurationSetting setConfiguration = new ConfigurationSetting().key(key).value("myNewValue"); - final ConfigurationSetting updateConfiguration = new ConfigurationSetting().key(key).value("myUpdatedValue"); + final ConfigurationSetting setConfiguration = new ConfigurationSetting().setKey(key).setValue("myNewValue"); + final ConfigurationSetting updateConfiguration = new ConfigurationSetting().setKey(key).setValue("myUpdatedValue"); testRunner.accept(setConfiguration, updateConfiguration); - testRunner.accept(setConfiguration.label(label), updateConfiguration.label(label)); + testRunner.accept(setConfiguration.setLabel(label), updateConfiguration.setLabel(label)); } @Test @@ -163,11 +163,11 @@ void setSettingIfEtagRunner(BiConsumer testRunner) { String key = getKey(); - ConfigurationSetting setting = new ConfigurationSetting().key(key); - ConfigurationSetting setting2 = new ConfigurationSetting().key(key + "-1").value(""); + ConfigurationSetting setting = new ConfigurationSetting().setKey(key); + ConfigurationSetting setting2 = new ConfigurationSetting().setKey(key + "-1").setValue(""); testRunner.accept(setting); testRunner.accept(setting2); @@ -192,10 +192,10 @@ void setSettingEmptyValueRunner(Consumer testRunner) { public abstract void updateNoExistingSetting(); void updateNoExistingSettingRunner(Consumer testRunner) { - final ConfigurationSetting expectedFail = new ConfigurationSetting().key(getKey()).value("myFailingUpdate"); + final ConfigurationSetting expectedFail = new ConfigurationSetting().setKey(getKey()).setValue("myFailingUpdate"); testRunner.accept(expectedFail); - testRunner.accept(expectedFail.label(getLabel())); + testRunner.accept(expectedFail.setLabel(getLabel())); } @Test @@ -209,20 +209,20 @@ void updateSettingRunner(BiConsumer tags.put("first tag", "first value"); tags.put("second tag", "second value"); final ConfigurationSetting original = new ConfigurationSetting() - .key(key) - .value("myNewValue") - .tags(tags) - .contentType("json"); + .setKey(key) + .setValue("myNewValue") + .setTags(tags) + .setContentType("json"); final Map updatedTags = new HashMap<>(tags); final ConfigurationSetting updated = new ConfigurationSetting() - .key(original.key()) - .value("myUpdatedValue") - .tags(updatedTags) - .contentType("text"); + .setKey(original.getKey()) + .setValue("myUpdatedValue") + .setTags(updatedTags) + .setContentType("text"); testRunner.accept(original, updated); - testRunner.accept(original.label(label), updated.label(label)); + testRunner.accept(original.setLabel(label), updated.setLabel(label)); } @Test @@ -231,8 +231,8 @@ void updateSettingRunner(BiConsumer void updateSettingOverloadRunner(BiConsumer testRunner) { String key = getKey(); - ConfigurationSetting original = new ConfigurationSetting().key(key).value("A Value"); - ConfigurationSetting updated = new ConfigurationSetting().key(key).value("A New Value"); + ConfigurationSetting original = new ConfigurationSetting().setKey(key).setValue("A Value"); + ConfigurationSetting updated = new ConfigurationSetting().setKey(key).setValue("A New Value"); testRunner.accept(original, updated); } @@ -246,12 +246,12 @@ void updateSettingOverloadRunner(BiConsumer> testRunner) { final String key = getKey(); final String label = getLabel(); - final ConfigurationSetting newConfiguration = new ConfigurationSetting().key(key).value("myNewValue"); - final ConfigurationSetting updateConfiguration = new ConfigurationSetting().key(key).value("myUpdateValue"); - final ConfigurationSetting finalConfiguration = new ConfigurationSetting().key(key).value("myFinalValue"); + final ConfigurationSetting newConfiguration = new ConfigurationSetting().setKey(key).setValue("myNewValue"); + final ConfigurationSetting updateConfiguration = new ConfigurationSetting().setKey(key).setValue("myUpdateValue"); + final ConfigurationSetting finalConfiguration = new ConfigurationSetting().setKey(key).setValue("myFinalValue"); testRunner.accept(Arrays.asList(newConfiguration, updateConfiguration, finalConfiguration)); - testRunner.accept(Arrays.asList(newConfiguration.label(label), updateConfiguration.label(label), finalConfiguration.label(label))); + testRunner.accept(Arrays.asList(newConfiguration.setLabel(label), updateConfiguration.setLabel(label), finalConfiguration.setLabel(label))); } @Test @@ -260,10 +260,10 @@ void updateSettingIfEtagRunner(Consumer> testRunner) void getSettingRunner(Consumer testRunner) { String key = getKey(); - final ConfigurationSetting newConfiguration = new ConfigurationSetting().key(key).value("myNewValue"); + final ConfigurationSetting newConfiguration = new ConfigurationSetting().setKey(key).setValue("myNewValue"); testRunner.accept(newConfiguration); - testRunner.accept(newConfiguration.label("myLabel")); + testRunner.accept(newConfiguration.setLabel("myLabel")); } @Test @@ -276,10 +276,10 @@ void deleteSettingRunner(Consumer testRunner) { String key = getKey(); String label = getLabel(); - final ConfigurationSetting deletableConfiguration = new ConfigurationSetting().key(key).value("myValue"); + final ConfigurationSetting deletableConfiguration = new ConfigurationSetting().setKey(key).setValue("myValue"); testRunner.accept(deletableConfiguration); - testRunner.accept(deletableConfiguration.label(label)); + testRunner.accept(deletableConfiguration.setLabel(label)); } @Test @@ -292,11 +292,11 @@ void deleteSettingWithETagRunner(BiConsumer> testRunner) { - final ConfigurationSetting setting = new ConfigurationSetting().key(key).value("value"); - final ConfigurationSetting setting2 = new ConfigurationSetting().key(key2).value("value"); + final ConfigurationSetting setting = new ConfigurationSetting().setKey(key).setValue("value"); + final ConfigurationSetting setting2 = new ConfigurationSetting().setKey(key2).setValue("value"); final Set expectedSelection = new HashSet<>(Arrays.asList(setting, setting2)); testRunner.apply(setting, setting2).forEach(actual -> expectedSelection.removeIf(expected -> expected.equals(cleanResponse(expected, actual)))); assertTrue(expectedSelection.isEmpty()); @@ -320,8 +320,8 @@ void listWithMultipleKeysRunner(String key, String key2, BiFunction> testRunner) { - final ConfigurationSetting setting = new ConfigurationSetting().key(key).value("value").label(label); - final ConfigurationSetting setting2 = new ConfigurationSetting().key(key).value("value").label(label2); + final ConfigurationSetting setting = new ConfigurationSetting().setKey(key).setValue("value").setLabel(label); + final ConfigurationSetting setting2 = new ConfigurationSetting().setKey(key).setValue("value").setLabel(label2); final Set expectedSelection = new HashSet<>(Arrays.asList(setting, setting2)); for (ConfigurationSetting actual : testRunner.apply(setting, setting2)) { @@ -343,27 +343,27 @@ void listSettingsSelectFieldsRunner(BiFunction, Setti tags.put("tag2", "value2"); final SettingSelector selector = new SettingSelector() - .labels("*-second*") - .keys(keyPrefix + "-fetch-*") - .fields(SettingFields.KEY, SettingFields.ETAG, SettingFields.CONTENT_TYPE, SettingFields.TAGS); + .setLabels("*-second*") + .setKeys(keyPrefix + "-fetch-*") + .setFields(SettingFields.KEY, SettingFields.ETAG, SettingFields.CONTENT_TYPE, SettingFields.TAGS); List settings = new ArrayList<>(numberToCreate); for (int value = 0; value < numberToCreate; value++) { String key = value % 2 == 0 ? keyPrefix + "-" + value : keyPrefix + "-fetch-" + value; String lbl = value / 4 == 0 ? label : label2; - settings.add(new ConfigurationSetting().key(key).value("myValue2").label(lbl).tags(tags)); + settings.add(new ConfigurationSetting().setKey(key).setValue("myValue2").setLabel(lbl).setTags(tags)); } for (ConfigurationSetting setting : testRunner.apply(settings, selector)) { - assertNotNull(setting.etag()); - assertNotNull(setting.key()); - assertTrue(setting.key().contains(keyPrefix)); - assertNotNull(setting.tags()); - assertEquals(tags.size(), setting.tags().size()); - - assertNull(setting.lastModified()); - assertNull(setting.contentType()); - assertNull(setting.label()); + assertNotNull(setting.getETag()); + assertNotNull(setting.getKey()); + assertTrue(setting.getKey().contains(keyPrefix)); + assertNotNull(setting.getTags()); + assertEquals(tags.size(), setting.getTags().size()); + + assertNull(setting.getLastModified()); + assertNull(setting.getContentType()); + assertNull(setting.getLabel()); } } @@ -374,20 +374,20 @@ void listSettingsSelectFieldsRunner(BiFunction, Setti public abstract void listRevisions(); static void validateListRevisions(ConfigurationSetting expected, ConfigurationSetting actual) { - assertEquals(expected.key(), actual.key()); - assertNotNull(actual.etag()); - assertNull(actual.value()); - assertNull(actual.lastModified()); + assertEquals(expected.getKey(), actual.getKey()); + assertNotNull(actual.getETag()); + assertNull(actual.getValue()); + assertNull(actual.getLastModified()); } @Test public abstract void listRevisionsWithMultipleKeys(); void listRevisionsWithMultipleKeysRunner(String key, String key2, Function, Iterable> testRunner) { - final ConfigurationSetting setting = new ConfigurationSetting().key(key).value("value"); - final ConfigurationSetting settingUpdate = new ConfigurationSetting().key(setting.key()).value("updatedValue"); - final ConfigurationSetting setting2 = new ConfigurationSetting().key(key2).value("value"); - final ConfigurationSetting setting2Update = new ConfigurationSetting().key(setting2.key()).value("updatedValue"); + final ConfigurationSetting setting = new ConfigurationSetting().setKey(key).setValue("value"); + final ConfigurationSetting settingUpdate = new ConfigurationSetting().setKey(setting.getKey()).setValue("updatedValue"); + final ConfigurationSetting setting2 = new ConfigurationSetting().setKey(key2).setValue("value"); + final ConfigurationSetting setting2Update = new ConfigurationSetting().setKey(setting2.getKey()).setValue("updatedValue"); final List testInput = Arrays.asList(setting, settingUpdate, setting2, setting2Update); final Set expectedSelection = new HashSet<>(testInput); @@ -402,10 +402,10 @@ void listRevisionsWithMultipleKeysRunner(String key, String key2, Function, Iterable> testRunner) { - final ConfigurationSetting setting = new ConfigurationSetting().key(key).value("value").label(label); - final ConfigurationSetting settingUpdate = new ConfigurationSetting().key(setting.key()).label(setting.label()).value("updatedValue"); - final ConfigurationSetting setting2 = new ConfigurationSetting().key(key).value("value").label(label2); - final ConfigurationSetting setting2Update = new ConfigurationSetting().key(setting2.key()).label(setting2.label()).value("updatedValue"); + final ConfigurationSetting setting = new ConfigurationSetting().setKey(key).setValue("value").setLabel(label); + final ConfigurationSetting settingUpdate = new ConfigurationSetting().setKey(setting.getKey()).setLabel(setting.getLabel()).setValue("updatedValue"); + final ConfigurationSetting setting2 = new ConfigurationSetting().setKey(key).setValue("value").setLabel(label2); + final ConfigurationSetting setting2Update = new ConfigurationSetting().setKey(setting2.getKey()).setLabel(setting2.getLabel()).setValue("updatedValue"); final List testInput = Arrays.asList(setting, settingUpdate, setting2, setting2Update); final Set expectedSelection = new HashSet<>(testInput); @@ -420,6 +420,7 @@ void listRevisionsWithMultipleLabelsRunner(String key, String label, String labe public abstract void listRevisionsWithRange(); @Test + @Ignore("alzimmermsft to investigate") public abstract void listRevisionsInvalidRange(); @Test @@ -464,9 +465,9 @@ static void assertConfigurationEquals(ConfigurationSetting expected, Response response, final int expectedStatusCode) { assertNotNull(response); - assertEquals(expectedStatusCode, response.statusCode()); + assertEquals(expectedStatusCode, response.getStatusCode()); - assertConfigurationEquals(expected, response.value()); + assertConfigurationEquals(expected, response.getValue()); } /** @@ -491,23 +492,23 @@ static void assertConfigurationEquals(ConfigurationSetting expected, Configurati */ private static ConfigurationSetting cleanResponse(ConfigurationSetting expected, ConfigurationSetting actual) { ConfigurationSetting cleanedActual = new ConfigurationSetting() - .key(actual.key()) - .label(actual.label()) - .value(actual.value()) - .tags(actual.tags()) - .contentType(actual.contentType()) - .etag(expected.etag()); + .setKey(actual.getKey()) + .setLabel(actual.getLabel()) + .setValue(actual.getValue()) + .setTags(actual.getTags()) + .setContentType(actual.getContentType()) + .setETag(expected.getETag()); try { Field lastModified = ConfigurationSetting.class.getDeclaredField("lastModified"); lastModified.setAccessible(true); - lastModified.set(actual, expected.lastModified()); + lastModified.set(actual, expected.getLastModified()); } catch (NoSuchFieldException | IllegalAccessException ex) { // Shouldn't happen. } - if (ConfigurationSetting.NO_LABEL.equals(expected.label()) && actual.label() == null) { - cleanedActual.label(ConfigurationSetting.NO_LABEL); + if (ConfigurationSetting.NO_LABEL.equals(expected.getLabel()) && actual.getLabel() == null) { + cleanedActual.setLabel(ConfigurationSetting.NO_LABEL); } return cleanedActual; @@ -538,7 +539,7 @@ static void assertRestException(Throwable exception, int expectedStatusCode) { static void assertRestException(Throwable exception, Class expectedExceptionType, int expectedStatusCode) { assertEquals(expectedExceptionType, exception.getClass()); - assertEquals(expectedStatusCode, ((HttpResponseException) exception).response().statusCode()); + assertEquals(expectedStatusCode, ((HttpResponseException) exception).getResponse().getStatusCode()); } /** diff --git a/sdk/appconfiguration/ci.yml b/sdk/appconfiguration/ci.yml index 75985c51833a..aa7e15af9d76 100644 --- a/sdk/appconfiguration/ci.yml +++ b/sdk/appconfiguration/ci.yml @@ -35,4 +35,5 @@ stages: ServiceDirectory: appconfiguration Artifacts: - name: azure-data-appconfiguration - safeName: azuredataappconfiguration \ No newline at end of file + safeName: azuredataappconfiguration + stagingProfileId: 88192f04117501 \ No newline at end of file diff --git a/sdk/appconfiguration/pom.service.xml b/sdk/appconfiguration/pom.service.xml index 1dcb85086aea..fbb523f353b6 100644 --- a/sdk/appconfiguration/pom.service.xml +++ b/sdk/appconfiguration/pom.service.xml @@ -11,6 +11,7 @@ ../core/azure-core ../core/azure-core-test + ../core/azure-core-http-netty azure-data-appconfiguration diff --git a/sdk/appconfiguration/tests.yml b/sdk/appconfiguration/tests.yml index 53d1bd0ccd1f..688142d8f8bf 100644 --- a/sdk/appconfiguration/tests.yml +++ b/sdk/appconfiguration/tests.yml @@ -5,4 +5,5 @@ jobs: parameters: ServiceDirectory: appconfiguration EnvVars: - AZCONFIG_CONNECTION_STRING: $(java-azconfig-test-connection-string) + AZURE_TEST_MODE: RECORD + AZURE_APPCONFIG_CONNECTION_STRING: $(java-azconfig-test-connection-string) diff --git a/sdk/applicationinsights/ci.yml b/sdk/applicationinsights/ci.yml index 63952b81e94b..c1941bac908f 100644 --- a/sdk/applicationinsights/ci.yml +++ b/sdk/applicationinsights/ci.yml @@ -1,10 +1,19 @@ # DO NOT EDIT THIS FILE # This file is generated automatically and any changes will be lost. +resources: + repositories: + - repository: azure-sdk-build-tools + type: git + name: internal/azure-sdk-build-tools + trigger: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/applicationinsights/ @@ -13,11 +22,18 @@ pr: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/applicationinsights/ -jobs: - - template: ../../eng/pipelines/templates/jobs/archetype-sdk-client.yml +stages: + - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: - ServiceDirectory: applicationinsights \ No newline at end of file + ServiceDirectory: applicationinsights + Artifacts: + - name: azure-applicationinsights-query + safeName: azureapplicationinsightsquery + stagingProfileId: 534d15ee3800f4 \ No newline at end of file diff --git a/sdk/applicationinsights/microsoft-azure-applicationinsights-query/pom.xml b/sdk/applicationinsights/microsoft-azure-applicationinsights-query/pom.xml index 23e58f5ec147..bd00aa6a0703 100644 --- a/sdk/applicationinsights/microsoft-azure-applicationinsights-query/pom.xml +++ b/sdk/applicationinsights/microsoft-azure-applicationinsights-query/pom.xml @@ -9,7 +9,7 @@ 4.0.0 com.microsoft.azure azure-applicationinsights-query - 1.0.0-Preview-1 + 1.0.0-preview-2 jar Microsoft Azure SDK for Application Insights Query API This package contains Microsoft Application Insights SDK for retrieving metrics, events, and running queries. @@ -17,7 +17,7 @@ com.azure azure-data-sdk-parent - 1.0.0 + 1.2.0 ../../../pom.data.xml @@ -134,7 +134,6 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.8 *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search diff --git a/sdk/authorization/ci.yml b/sdk/authorization/ci.yml index 3ca739a2628b..54ccec628f4f 100644 --- a/sdk/authorization/ci.yml +++ b/sdk/authorization/ci.yml @@ -1,10 +1,19 @@ # DO NOT EDIT THIS FILE # This file is generated automatically and any changes will be lost. +resources: + repositories: + - repository: azure-sdk-build-tools + type: git + name: internal/azure-sdk-build-tools + trigger: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/authorization/ @@ -13,11 +22,18 @@ pr: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/authorization/ -jobs: - - template: ../../eng/pipelines/templates/jobs/archetype-sdk-client.yml +stages: + - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: - ServiceDirectory: authorization \ No newline at end of file + ServiceDirectory: authorization + Artifacts: + - name: azure-authentication-msi-token-provider + safeName: azureauthenticationmsitokenprovider + stagingProfileId: 534d15ee3800f4 \ No newline at end of file diff --git a/sdk/authorization/microsoft-azure-authentication-msi-token-provider/pom.xml b/sdk/authorization/microsoft-azure-authentication-msi-token-provider/pom.xml index cc9e7463a08d..8fe8159eaa67 100644 --- a/sdk/authorization/microsoft-azure-authentication-msi-token-provider/pom.xml +++ b/sdk/authorization/microsoft-azure-authentication-msi-token-provider/pom.xml @@ -9,12 +9,19 @@ azure-authentication-msi-token-provider jar - 1.0.0-Beta-2 + 1.1.0-preview.1 Azure Java Client MSI Authorization Token Provoider Library This package contains the MSI token provider classes for Azure. https://github.com/Azure/azure-sdk-for-java + + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml + + The MIT License (MIT) diff --git a/sdk/batch/ci.yml b/sdk/batch/ci.yml index b1d6f5dba929..aaeab77c5fe1 100644 --- a/sdk/batch/ci.yml +++ b/sdk/batch/ci.yml @@ -35,4 +35,5 @@ stages: ServiceDirectory: batch Artifacts: - name: azure-batch - safeName: azurebatch \ No newline at end of file + safeName: azurebatch + stagingProfileId: 534d15ee3800f4 \ No newline at end of file diff --git a/sdk/batch/microsoft-azure-batch/pom.xml b/sdk/batch/microsoft-azure-batch/pom.xml index 2d0da994779b..3796d0e6927e 100644 --- a/sdk/batch/microsoft-azure-batch/pom.xml +++ b/sdk/batch/microsoft-azure-batch/pom.xml @@ -9,14 +9,14 @@ com.azure azure-data-sdk-parent - 1.1.0 + 1.2.0 ../../../pom.data.xml - + com.microsoft.azure azure-batch jar - 7.0.0 + 7.1.0-preview.1 Microsoft Azure Batch SDK Root This package contains the root module of Microsoft Azure Batch SDK. diff --git a/sdk/cognitiveservices/ci.yml b/sdk/cognitiveservices/ci.yml index 509ffbc81865..e82f1985e1b1 100644 --- a/sdk/cognitiveservices/ci.yml +++ b/sdk/cognitiveservices/ci.yml @@ -1,10 +1,19 @@ # DO NOT EDIT THIS FILE # This file is generated automatically and any changes will be lost. +resources: + repositories: + - repository: azure-sdk-build-tools + type: git + name: internal/azure-sdk-build-tools + trigger: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/cognitiveservices/ @@ -13,11 +22,69 @@ pr: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/cognitiveservices/ -jobs: - - template: ../../eng/pipelines/templates/jobs/archetype-sdk-client.yml +stages: + - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: - ServiceDirectory: cognitiveservices \ No newline at end of file + ServiceDirectory: cognitiveservices + Artifacts: + - name: azure-cognitiveservices-autosuggest + safeName: azurecognitiveservicesautosuggest + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-computervision + safeName: azurecognitiveservicescomputervision + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-contentmoderator + safeName: azurecognitiveservicescontentmoderator + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-customimagesearch + safeName: azurecognitiveservicescustomimagesearch + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-customsearch + safeName: azurecognitiveservicescustomsearch + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-customvision-prediction + safeName: azurecognitiveservicescustomvisionprediction + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-customvision-training + safeName: azurecognitiveservicescustomvisiontraining + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-entitysearch + safeName: azurecognitiveservicesentitysearch + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-faceapi + safeName: azurecognitiveservicesfaceapi + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-imagesearch + safeName: azurecognitiveservicesimagesearch + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-luis-authoring + safeName: azurecognitiveservicesluisauthoring + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-luis-runtime + safeName: azurecognitiveservicesluisruntime + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-newssearch + safeName: azurecognitiveservicesnewssearch + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-spellcheck + safeName: azurecognitiveservicesspellcheck + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-textanalytics + safeName: azurecognitiveservicestextanalytics + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-videosearch + safeName: azurecognitiveservicesvideosearch + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-visualsearch + safeName: azurecognitiveservicesvisualsearch + stagingProfileId: 534d15ee3800f4 + - name: azure-cognitiveservices-websearch + safeName: azurecognitiveserviceswebsearch + stagingProfileId: 534d15ee3800f4 \ No newline at end of file diff --git a/sdk/cognitiveservices/ms-azure-cs-autosuggest/pom.xml b/sdk/cognitiveservices/ms-azure-cs-autosuggest/pom.xml index 5b91d450eed0..2d327802af47 100644 --- a/sdk/cognitiveservices/ms-azure-cs-autosuggest/pom.xml +++ b/sdk/cognitiveservices/ms-azure-cs-autosuggest/pom.xml @@ -6,13 +6,13 @@ 4.0.0 - com.microsoft.azure.cognitiveservices - azure-cognitiveservices-parent - 1.0.2 - ../pom.xml + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml azure-cognitiveservices-autosuggest - 1.0.2-beta + 1.1.0-preview.1 jar Microsoft Azure SDK for Cognitive Services Auto Suggest This package contains Microsoft Cognitive Service Auto Suggest SDK. diff --git a/sdk/cognitiveservices/ms-azure-cs-computervision/pom.xml b/sdk/cognitiveservices/ms-azure-cs-computervision/pom.xml index 67d7daafb80b..4af92526fc53 100644 --- a/sdk/cognitiveservices/ms-azure-cs-computervision/pom.xml +++ b/sdk/cognitiveservices/ms-azure-cs-computervision/pom.xml @@ -7,14 +7,14 @@ --> 4.0.0 - - com.microsoft.azure.cognitiveservices - azure-cognitiveservices-parent - 1.0.2 - ../pom.xml - + + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml + azure-cognitiveservices-computervision - 1.0.2-beta + 1.1.0-preview.1 jar Microsoft Azure SDK for Cognitive Service Computer Vision This package contains Microsoft Cognitive Service Computer Vision SDK. diff --git a/sdk/cognitiveservices/ms-azure-cs-contentmoderator/pom.xml b/sdk/cognitiveservices/ms-azure-cs-contentmoderator/pom.xml index 0678ef83bea8..b66809b4e53e 100644 --- a/sdk/cognitiveservices/ms-azure-cs-contentmoderator/pom.xml +++ b/sdk/cognitiveservices/ms-azure-cs-contentmoderator/pom.xml @@ -7,14 +7,14 @@ --> 4.0.0 - - com.microsoft.azure.cognitiveservices - azure-cognitiveservices-parent - 1.0.2 - ../pom.xml - + + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml + azure-cognitiveservices-contentmoderator - 1.0.2-beta + 1.1.0-preview.1 jar Microsoft Azure SDK for Cognitive Service Content Moderator This package contains Microsoft Cognitive Service Content Moderator SDK. diff --git a/sdk/cognitiveservices/ms-azure-cs-customimagesearch/pom.xml b/sdk/cognitiveservices/ms-azure-cs-customimagesearch/pom.xml index 2d99abaad5d7..9ddbb3e8e808 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customimagesearch/pom.xml +++ b/sdk/cognitiveservices/ms-azure-cs-customimagesearch/pom.xml @@ -6,13 +6,13 @@ 4.0.0 - com.microsoft.azure.cognitiveservices - azure-cognitiveservices-parent - 1.0.2 - ../pom.xml + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml azure-cognitiveservices-customimagesearch - 1.0.2-beta + 1.1.0-preview.1 jar Microsoft Azure SDK for Cognitive Service Custom Image Search This package contains Microsoft Cognitive Service Custom Image Search SDK. diff --git a/sdk/cognitiveservices/ms-azure-cs-customsearch/pom.xml b/sdk/cognitiveservices/ms-azure-cs-customsearch/pom.xml index 5b6ac07a479a..319b9cda91c3 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customsearch/pom.xml +++ b/sdk/cognitiveservices/ms-azure-cs-customsearch/pom.xml @@ -6,13 +6,13 @@ 4.0.0 - com.microsoft.azure.cognitiveservices - azure-cognitiveservices-parent - 1.0.2 - ../pom.xml + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml azure-cognitiveservices-customsearch - 1.0.2 + 1.1.0-preview.1 jar Microsoft Azure SDK for Cognitive Service Custom Search This package contains Microsoft Cognitive Service Custom Search SDK. diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/pom.xml b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/pom.xml index f4ee4cec9cb4..821f65b7c513 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/pom.xml +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/pom.xml @@ -7,14 +7,14 @@ --> 4.0.0 - - com.microsoft.azure.cognitiveservices - azure-cognitiveservices-parent - 1.0.2 - ../pom.xml - + + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml + azure-cognitiveservices-customvision-prediction - 1.0.2-beta + 1.1.0-preview.2 jar Microsoft Azure SDK for Cognitive Service Custom Vision Prediction This package contains Microsoft Cognitive Service Custom Vision Prediction SDK. @@ -88,4 +88,4 @@ - \ No newline at end of file + diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/CustomVisionPredictionClient.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/CustomVisionPredictionClient.java new file mode 100644 index 000000000000..013701ba15d7 --- /dev/null +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/CustomVisionPredictionClient.java @@ -0,0 +1,119 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.customvision.prediction; + +import com.microsoft.azure.AzureClient; +import com.microsoft.rest.RestClient; + +/** + * The interface for CustomVisionPredictionClient class. + */ +public interface CustomVisionPredictionClient { + /** + * Gets the REST client. + * + * @return the {@link RestClient} object. + */ + RestClient restClient(); + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + AzureClient getAzureClient(); + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + String userAgent(); + + /** + * Gets API key.. + * + * @return the apiKey value. + */ + String apiKey(); + + /** + * Sets API key.. + * + * @param apiKey the apiKey value. + * @return the service client itself + */ + CustomVisionPredictionClient withApiKey(String apiKey); + + /** + * Gets Supported Cognitive Services endpoints.. + * + * @return the endpoint value. + */ + String endpoint(); + + /** + * Sets Supported Cognitive Services endpoints.. + * + * @param endpoint the endpoint value. + * @return the service client itself + */ + CustomVisionPredictionClient withEndpoint(String endpoint); + + /** + * Gets Gets or sets the preferred language for the response.. + * + * @return the acceptLanguage value. + */ + String acceptLanguage(); + + /** + * Sets Gets or sets the preferred language for the response.. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + CustomVisionPredictionClient withAcceptLanguage(String acceptLanguage); + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. + * + * @return the longRunningOperationRetryTimeout value. + */ + int longRunningOperationRetryTimeout(); + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + CustomVisionPredictionClient withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. + * + * @return the generateClientRequestId value. + */ + boolean generateClientRequestId(); + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + CustomVisionPredictionClient withGenerateClientRequestId(boolean generateClientRequestId); + + /** + * Gets the Predictions object to access its operations. + * @return the Predictions object. + */ + Predictions predictions(); + +} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/CustomVisionPredictionManager.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/CustomVisionPredictionManager.java index cd0c09735463..09e46676aa62 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/CustomVisionPredictionManager.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/CustomVisionPredictionManager.java @@ -6,7 +6,7 @@ package com.microsoft.azure.cognitiveservices.vision.customvision.prediction; -import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.implementation.PredictionEndpointImpl; +import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.implementation.CustomVisionPredictionClientImpl; import com.microsoft.rest.RestClient; import com.microsoft.rest.credentials.ServiceClientCredentials; import okhttp3.OkHttpClient; @@ -21,7 +21,7 @@ public class CustomVisionPredictionManager { * @param apiKey the Custom Vision Prediction API key * @return the Computer Vision API client */ - public static PredictionEndpoint authenticate(String apiKey) { + public static CustomVisionPredictionClient authenticate(String apiKey) { return authenticate("https://southcentralus.api.cognitive.microsoft.com/customvision/v2.0/Prediction/", apiKey); } @@ -32,7 +32,7 @@ public static PredictionEndpoint authenticate(String apiKey) { * @param apiKey the Custom Vision Prediction API key * @return the Custom Vision Prediction API client */ - public static PredictionEndpoint authenticate(String baseUrl, final String apiKey) { + public static CustomVisionPredictionClient authenticate(String baseUrl, final String apiKey) { ServiceClientCredentials serviceClientCredentials = new ServiceClientCredentials() { @Override public void applyCredentialsFilter(OkHttpClient.Builder builder) { @@ -48,7 +48,7 @@ public void applyCredentialsFilter(OkHttpClient.Builder builder) { * @param apiKey the Custom Vision Prediction API key * @return the Computer Vision API client */ - public static PredictionEndpoint authenticate(ServiceClientCredentials credentials, final String apiKey) { + public static CustomVisionPredictionClient authenticate(ServiceClientCredentials credentials, final String apiKey) { return authenticate("https://southcentralus.api.cognitive.microsoft.com/customvision/v2.0/Prediction/", credentials, apiKey); } @@ -60,8 +60,8 @@ public static PredictionEndpoint authenticate(ServiceClientCredentials credentia * @param apiKey the Custom Vision Prediction API key * @return the Custom Vision Prediction API client */ - public static PredictionEndpoint authenticate(String baseUrl, ServiceClientCredentials credentials, final String apiKey) { - return new PredictionEndpointImpl(baseUrl, credentials).withApiKey(apiKey); + public static CustomVisionPredictionClient authenticate(String baseUrl, ServiceClientCredentials credentials, final String apiKey) { + return new CustomVisionPredictionClientImpl(baseUrl, credentials).withApiKey(apiKey); } /** @@ -71,7 +71,7 @@ public static PredictionEndpoint authenticate(String baseUrl, ServiceClientCrede * @param apiKey the Custom Vision Prediction API key * @return the Custom Vision Prediction API client */ - public static PredictionEndpoint authenticate(RestClient restClient, final String apiKey) { - return new PredictionEndpointImpl(restClient).withApiKey(apiKey); + public static CustomVisionPredictionClient authenticate(RestClient restClient, final String apiKey) { + return new CustomVisionPredictionClientImpl(restClient).withApiKey(apiKey); } } diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/PredictionEndpoint.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/PredictionEndpoint.java deleted file mode 100644 index af52578febfc..000000000000 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/PredictionEndpoint.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - */ - -package com.microsoft.azure.cognitiveservices.vision.customvision.prediction; - -import com.microsoft.azure.AzureClient; -import com.microsoft.rest.RestClient; - -/** - * The interface for PredictionEndpoint class. - */ -public interface PredictionEndpoint { - /** - * Gets the REST client. - * - * @return the {@link RestClient} object. - */ - RestClient restClient(); - - /** - * Gets the {@link AzureClient} used for long running operations. - * @return the azure client; - */ - AzureClient getAzureClient(); - - /** - * Gets the User-Agent header for the client. - * - * @return the user agent string. - */ - String userAgent(); - - /** - * Gets . - * - * @return the apiKey value. - */ - String apiKey(); - - /** - * Sets . - * - * @param apiKey the apiKey value. - * @return the service client itself - */ - PredictionEndpoint withApiKey(String apiKey); - - /** - * Gets Gets or sets the preferred language for the response.. - * - * @return the acceptLanguage value. - */ - String acceptLanguage(); - - /** - * Sets Gets or sets the preferred language for the response.. - * - * @param acceptLanguage the acceptLanguage value. - * @return the service client itself - */ - PredictionEndpoint withAcceptLanguage(String acceptLanguage); - - /** - * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. - * - * @return the longRunningOperationRetryTimeout value. - */ - int longRunningOperationRetryTimeout(); - - /** - * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. - * - * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. - * @return the service client itself - */ - PredictionEndpoint withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); - - /** - * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. - * - * @return the generateClientRequestId value. - */ - boolean generateClientRequestId(); - - /** - * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. - * - * @param generateClientRequestId the generateClientRequestId value. - * @return the service client itself - */ - PredictionEndpoint withGenerateClientRequestId(boolean generateClientRequestId); - - /** - * Gets the Predictions object to access its operations. - * @return the Predictions object. - */ - Predictions predictions(); - -} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/Predictions.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/Predictions.java index 75bf2eefb553..99c8be336d42 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/Predictions.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/Predictions.java @@ -8,12 +8,17 @@ package com.microsoft.azure.cognitiveservices.vision.customvision.prediction; -import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.PredictImageWithNoStoreOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.PredictImageUrlWithNoStoreOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.PredictImageOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.PredictImageUrlOptionalParameter; -import com.microsoft.azure.CloudException; +import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.DetectImageWithNoStoreOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.DetectImageUrlWithNoStoreOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.DetectImageOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.DetectImageUrlOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.ClassifyImageWithNoStoreOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.ClassifyImageUrlWithNoStoreOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.ClassifyImageOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.ClassifyImageUrlOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.CustomVisionErrorException; import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.ImagePrediction; +import java.io.IOException; import java.util.UUID; import rx.Observable; @@ -23,42 +28,42 @@ */ public interface Predictions { /** - * Predict an image without saving the result. + * Detect objects in an image without saving the result. * * @param projectId The project id. - * @param imageData the InputStream value. - * @param predictImageWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 0MB. + * @param detectImageWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ImagePrediction object if successful. */ - @Deprecated - ImagePrediction predictImageWithNoStore(UUID projectId, byte[] imageData, PredictImageWithNoStoreOptionalParameter predictImageWithNoStoreOptionalParameter); + ImagePrediction detectImageWithNoStore(UUID projectId, String publishedName, byte[] imageData, DetectImageWithNoStoreOptionalParameter detectImageWithNoStoreOptionalParameter); /** - * Predict an image without saving the result. + * Detect objects in an image without saving the result. * * @param projectId The project id. - * @param imageData the InputStream value. - * @param predictImageWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 0MB. + * @param detectImageWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object */ - @Deprecated - Observable predictImageWithNoStoreAsync(UUID projectId, byte[] imageData, PredictImageWithNoStoreOptionalParameter predictImageWithNoStoreOptionalParameter); + Observable detectImageWithNoStoreAsync(UUID projectId, String publishedName, byte[] imageData, DetectImageWithNoStoreOptionalParameter detectImageWithNoStoreOptionalParameter); /** - * Predict an image without saving the result. + * Detect objects in an image without saving the result. * - * @return the first stage of the predictImageWithNoStore call + * @return the first stage of the detectImageWithNoStore call */ - PredictionsPredictImageWithNoStoreDefinitionStages.WithProjectId predictImageWithNoStore(); + PredictionsDetectImageWithNoStoreDefinitionStages.WithProjectId detectImageWithNoStore(); /** - * Grouping of predictImageWithNoStore definition stages. + * Grouping of detectImageWithNoStore definition stages. */ - interface PredictionsPredictImageWithNoStoreDefinitionStages { + interface PredictionsDetectImageWithNoStoreDefinitionStages { /** * The stage of the definition to be specify projectId. */ @@ -68,18 +73,29 @@ interface WithProjectId { * * @return next definition stage */ - WithImageData withProjectId(UUID projectId); + WithPublishedName withProjectId(UUID projectId); + } + /** + * The stage of the definition to be specify publishedName. + */ + interface WithPublishedName { + /** + * Specifies the name of the model to evaluate against. + * + * @return next definition stage + */ + WithImageData withPublishedName(String publishedName); } /** * The stage of the definition to be specify imageData. */ interface WithImageData { /** - * + * Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 0MB. * * @return next definition stage */ - PredictionsPredictImageWithNoStoreDefinitionStages.WithExecute withImageData(byte[] imageData); + PredictionsDetectImageWithNoStoreDefinitionStages.WithExecute withImageData(byte[] imageData); } /** @@ -87,26 +103,132 @@ interface WithImageData { */ interface WithAllOptions { /** - * Optional. Specifies the id of a particular iteration to evaluate against. - * The default iteration for the project will be used when not specified. + * Optional. Specifies the name of application using the endpoint. * * @return next definition stage */ - PredictionsPredictImageWithNoStoreDefinitionStages.WithExecute withIterationId(UUID iterationId); + PredictionsDetectImageWithNoStoreDefinitionStages.WithExecute withApplication(String application); + + } + + /** + * The last stage of the definition which will make the operation call. + */ + interface WithExecute extends PredictionsDetectImageWithNoStoreDefinitionStages.WithAllOptions { + /** + * Execute the request. + * + * @return the ImagePrediction object if successful. + */ + ImagePrediction execute(); + /** + * Execute the request asynchronously. + * + * @return the observable to the ImagePrediction object + */ + Observable executeAsync(); + } + } + + /** + * The entirety of detectImageWithNoStore definition. + */ + interface PredictionsDetectImageWithNoStoreDefinition extends + PredictionsDetectImageWithNoStoreDefinitionStages.WithProjectId, + PredictionsDetectImageWithNoStoreDefinitionStages.WithPublishedName, + PredictionsDetectImageWithNoStoreDefinitionStages.WithImageData, + PredictionsDetectImageWithNoStoreDefinitionStages.WithExecute { + } + + /** + * Detect objects in an image url without saving the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param detectImageUrlWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImagePrediction object if successful. + */ + ImagePrediction detectImageUrlWithNoStore(UUID projectId, String publishedName, String url, DetectImageUrlWithNoStoreOptionalParameter detectImageUrlWithNoStoreOptionalParameter); + + /** + * Detect objects in an image url without saving the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param detectImageUrlWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImagePrediction object + */ + Observable detectImageUrlWithNoStoreAsync(UUID projectId, String publishedName, String url, DetectImageUrlWithNoStoreOptionalParameter detectImageUrlWithNoStoreOptionalParameter); + + /** + * Detect objects in an image url without saving the result. + * + * @return the first stage of the detectImageUrlWithNoStore call + */ + PredictionsDetectImageUrlWithNoStoreDefinitionStages.WithProjectId detectImageUrlWithNoStore(); + + /** + * Grouping of detectImageUrlWithNoStore definition stages. + */ + interface PredictionsDetectImageUrlWithNoStoreDefinitionStages { + /** + * The stage of the definition to be specify projectId. + */ + interface WithProjectId { + /** + * The project id. + * + * @return next definition stage + */ + WithPublishedName withProjectId(UUID projectId); + } + /** + * The stage of the definition to be specify publishedName. + */ + interface WithPublishedName { + /** + * Specifies the name of the model to evaluate against. + * + * @return next definition stage + */ + WithUrl withPublishedName(String publishedName); + } + /** + * The stage of the definition to be specify url. + */ + interface WithUrl { + /** + * Url of the image. + * + * @return next definition stage + */ + PredictionsDetectImageUrlWithNoStoreDefinitionStages.WithExecute withUrl(String url); + } + + /** + * The stage of the definition which allows for any other optional settings to be specified. + */ + interface WithAllOptions { /** * Optional. Specifies the name of application using the endpoint. * * @return next definition stage */ - PredictionsPredictImageWithNoStoreDefinitionStages.WithExecute withApplication(String application); + PredictionsDetectImageUrlWithNoStoreDefinitionStages.WithExecute withApplication(String application); } /** * The last stage of the definition which will make the operation call. */ - interface WithExecute extends PredictionsPredictImageWithNoStoreDefinitionStages.WithAllOptions { + interface WithExecute extends PredictionsDetectImageUrlWithNoStoreDefinitionStages.WithAllOptions { /** * Execute the request. * @@ -124,49 +246,52 @@ interface WithExecute extends PredictionsPredictImageWithNoStoreDefinitionStages } /** - * The entirety of predictImageWithNoStore definition. + * The entirety of detectImageUrlWithNoStore definition. */ - interface PredictionsPredictImageWithNoStoreDefinition extends - PredictionsPredictImageWithNoStoreDefinitionStages.WithProjectId, - PredictionsPredictImageWithNoStoreDefinitionStages.WithImageData, - PredictionsPredictImageWithNoStoreDefinitionStages.WithExecute { + interface PredictionsDetectImageUrlWithNoStoreDefinition extends + PredictionsDetectImageUrlWithNoStoreDefinitionStages.WithProjectId, + PredictionsDetectImageUrlWithNoStoreDefinitionStages.WithPublishedName, + PredictionsDetectImageUrlWithNoStoreDefinitionStages.WithUrl, + PredictionsDetectImageUrlWithNoStoreDefinitionStages.WithExecute { } /** - * Predict an image url without saving the result. + * Detect objects in an image and saves the result. * * @param projectId The project id. - * @param predictImageUrlWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 4MB. + * @param detectImageOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ImagePrediction object if successful. */ - @Deprecated - ImagePrediction predictImageUrlWithNoStore(UUID projectId, PredictImageUrlWithNoStoreOptionalParameter predictImageUrlWithNoStoreOptionalParameter); + ImagePrediction detectImage(UUID projectId, String publishedName, byte[] imageData, DetectImageOptionalParameter detectImageOptionalParameter); /** - * Predict an image url without saving the result. + * Detect objects in an image and saves the result. * * @param projectId The project id. - * @param predictImageUrlWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 4MB. + * @param detectImageOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object */ - @Deprecated - Observable predictImageUrlWithNoStoreAsync(UUID projectId, PredictImageUrlWithNoStoreOptionalParameter predictImageUrlWithNoStoreOptionalParameter); + Observable detectImageAsync(UUID projectId, String publishedName, byte[] imageData, DetectImageOptionalParameter detectImageOptionalParameter); /** - * Predict an image url without saving the result. + * Detect objects in an image and saves the result. * - * @return the first stage of the predictImageUrlWithNoStore call + * @return the first stage of the detectImage call */ - PredictionsPredictImageUrlWithNoStoreDefinitionStages.WithProjectId predictImageUrlWithNoStore(); + PredictionsDetectImageDefinitionStages.WithProjectId detectImage(); /** - * Grouping of predictImageUrlWithNoStore definition stages. + * Grouping of detectImage definition stages. */ - interface PredictionsPredictImageUrlWithNoStoreDefinitionStages { + interface PredictionsDetectImageDefinitionStages { /** * The stage of the definition to be specify projectId. */ @@ -176,7 +301,29 @@ interface WithProjectId { * * @return next definition stage */ - PredictionsPredictImageUrlWithNoStoreDefinitionStages.WithExecute withProjectId(UUID projectId); + WithPublishedName withProjectId(UUID projectId); + } + /** + * The stage of the definition to be specify publishedName. + */ + interface WithPublishedName { + /** + * Specifies the name of the model to evaluate against. + * + * @return next definition stage + */ + WithImageData withPublishedName(String publishedName); + } + /** + * The stage of the definition to be specify imageData. + */ + interface WithImageData { + /** + * Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 4MB. + * + * @return next definition stage + */ + PredictionsDetectImageDefinitionStages.WithExecute withImageData(byte[] imageData); } /** @@ -184,33 +331,132 @@ interface WithProjectId { */ interface WithAllOptions { /** - * Optional. Specifies the id of a particular iteration to evaluate against. - * The default iteration for the project will be used when not specified. + * Optional. Specifies the name of application using the endpoint. * * @return next definition stage */ - PredictionsPredictImageUrlWithNoStoreDefinitionStages.WithExecute withIterationId(UUID iterationId); + PredictionsDetectImageDefinitionStages.WithExecute withApplication(String application); + } + + /** + * The last stage of the definition which will make the operation call. + */ + interface WithExecute extends PredictionsDetectImageDefinitionStages.WithAllOptions { /** - * Optional. Specifies the name of application using the endpoint. + * Execute the request. * - * @return next definition stage + * @return the ImagePrediction object if successful. */ - PredictionsPredictImageUrlWithNoStoreDefinitionStages.WithExecute withApplication(String application); + ImagePrediction execute(); /** + * Execute the request asynchronously. * + * @return the observable to the ImagePrediction object + */ + Observable executeAsync(); + } + } + + /** + * The entirety of detectImage definition. + */ + interface PredictionsDetectImageDefinition extends + PredictionsDetectImageDefinitionStages.WithProjectId, + PredictionsDetectImageDefinitionStages.WithPublishedName, + PredictionsDetectImageDefinitionStages.WithImageData, + PredictionsDetectImageDefinitionStages.WithExecute { + } + + /** + * Detect objects in an image url and saves the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param detectImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImagePrediction object if successful. + */ + ImagePrediction detectImageUrl(UUID projectId, String publishedName, String url, DetectImageUrlOptionalParameter detectImageUrlOptionalParameter); + + /** + * Detect objects in an image url and saves the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param detectImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImagePrediction object + */ + Observable detectImageUrlAsync(UUID projectId, String publishedName, String url, DetectImageUrlOptionalParameter detectImageUrlOptionalParameter); + + /** + * Detect objects in an image url and saves the result. + * + * @return the first stage of the detectImageUrl call + */ + PredictionsDetectImageUrlDefinitionStages.WithProjectId detectImageUrl(); + + /** + * Grouping of detectImageUrl definition stages. + */ + interface PredictionsDetectImageUrlDefinitionStages { + /** + * The stage of the definition to be specify projectId. + */ + interface WithProjectId { + /** + * The project id. + * + * @return next definition stage + */ + WithPublishedName withProjectId(UUID projectId); + } + /** + * The stage of the definition to be specify publishedName. + */ + interface WithPublishedName { + /** + * Specifies the name of the model to evaluate against. + * + * @return next definition stage + */ + WithUrl withPublishedName(String publishedName); + } + /** + * The stage of the definition to be specify url. + */ + interface WithUrl { + /** + * Url of the image. + * + * @return next definition stage + */ + PredictionsDetectImageUrlDefinitionStages.WithExecute withUrl(String url); + } + + /** + * The stage of the definition which allows for any other optional settings to be specified. + */ + interface WithAllOptions { + /** + * Optional. Specifies the name of application using the endpoint. * * @return next definition stage */ - PredictionsPredictImageUrlWithNoStoreDefinitionStages.WithExecute withUrl(String url); + PredictionsDetectImageUrlDefinitionStages.WithExecute withApplication(String application); } /** * The last stage of the definition which will make the operation call. */ - interface WithExecute extends PredictionsPredictImageUrlWithNoStoreDefinitionStages.WithAllOptions { + interface WithExecute extends PredictionsDetectImageUrlDefinitionStages.WithAllOptions { /** * Execute the request. * @@ -228,50 +474,52 @@ interface WithExecute extends PredictionsPredictImageUrlWithNoStoreDefinitionSta } /** - * The entirety of predictImageUrlWithNoStore definition. + * The entirety of detectImageUrl definition. */ - interface PredictionsPredictImageUrlWithNoStoreDefinition extends - PredictionsPredictImageUrlWithNoStoreDefinitionStages.WithProjectId, - PredictionsPredictImageUrlWithNoStoreDefinitionStages.WithExecute { + interface PredictionsDetectImageUrlDefinition extends + PredictionsDetectImageUrlDefinitionStages.WithProjectId, + PredictionsDetectImageUrlDefinitionStages.WithPublishedName, + PredictionsDetectImageUrlDefinitionStages.WithUrl, + PredictionsDetectImageUrlDefinitionStages.WithExecute { } /** - * Predict an image and saves the result. + * Classify an image without saving the result. * * @param projectId The project id. - * @param imageData the InputStream value. - * @param predictImageOptionalParameter the object representing the optional parameters to be set before calling this API + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 0MB. + * @param classifyImageWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ImagePrediction object if successful. */ - @Deprecated - ImagePrediction predictImage(UUID projectId, byte[] imageData, PredictImageOptionalParameter predictImageOptionalParameter); + ImagePrediction classifyImageWithNoStore(UUID projectId, String publishedName, byte[] imageData, ClassifyImageWithNoStoreOptionalParameter classifyImageWithNoStoreOptionalParameter); /** - * Predict an image and saves the result. + * Classify an image without saving the result. * * @param projectId The project id. - * @param imageData the InputStream value. - * @param predictImageOptionalParameter the object representing the optional parameters to be set before calling this API + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 0MB. + * @param classifyImageWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object */ - @Deprecated - Observable predictImageAsync(UUID projectId, byte[] imageData, PredictImageOptionalParameter predictImageOptionalParameter); + Observable classifyImageWithNoStoreAsync(UUID projectId, String publishedName, byte[] imageData, ClassifyImageWithNoStoreOptionalParameter classifyImageWithNoStoreOptionalParameter); /** - * Predict an image and saves the result. + * Classify an image without saving the result. * - * @return the first stage of the predictImage call + * @return the first stage of the classifyImageWithNoStore call */ - PredictionsPredictImageDefinitionStages.WithProjectId predictImage(); + PredictionsClassifyImageWithNoStoreDefinitionStages.WithProjectId classifyImageWithNoStore(); /** - * Grouping of predictImage definition stages. + * Grouping of classifyImageWithNoStore definition stages. */ - interface PredictionsPredictImageDefinitionStages { + interface PredictionsClassifyImageWithNoStoreDefinitionStages { /** * The stage of the definition to be specify projectId. */ @@ -281,18 +529,29 @@ interface WithProjectId { * * @return next definition stage */ - WithImageData withProjectId(UUID projectId); + WithPublishedName withProjectId(UUID projectId); + } + /** + * The stage of the definition to be specify publishedName. + */ + interface WithPublishedName { + /** + * Specifies the name of the model to evaluate against. + * + * @return next definition stage + */ + WithImageData withPublishedName(String publishedName); } /** * The stage of the definition to be specify imageData. */ interface WithImageData { /** - * + * Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 0MB. * * @return next definition stage */ - PredictionsPredictImageDefinitionStages.WithExecute withImageData(byte[] imageData); + PredictionsClassifyImageWithNoStoreDefinitionStages.WithExecute withImageData(byte[] imageData); } /** @@ -300,26 +559,132 @@ interface WithImageData { */ interface WithAllOptions { /** - * Optional. Specifies the id of a particular iteration to evaluate against. - * The default iteration for the project will be used when not specified. + * Optional. Specifies the name of application using the endpoint. * * @return next definition stage */ - PredictionsPredictImageDefinitionStages.WithExecute withIterationId(UUID iterationId); + PredictionsClassifyImageWithNoStoreDefinitionStages.WithExecute withApplication(String application); + + } + + /** + * The last stage of the definition which will make the operation call. + */ + interface WithExecute extends PredictionsClassifyImageWithNoStoreDefinitionStages.WithAllOptions { + /** + * Execute the request. + * + * @return the ImagePrediction object if successful. + */ + ImagePrediction execute(); + /** + * Execute the request asynchronously. + * + * @return the observable to the ImagePrediction object + */ + Observable executeAsync(); + } + } + + /** + * The entirety of classifyImageWithNoStore definition. + */ + interface PredictionsClassifyImageWithNoStoreDefinition extends + PredictionsClassifyImageWithNoStoreDefinitionStages.WithProjectId, + PredictionsClassifyImageWithNoStoreDefinitionStages.WithPublishedName, + PredictionsClassifyImageWithNoStoreDefinitionStages.WithImageData, + PredictionsClassifyImageWithNoStoreDefinitionStages.WithExecute { + } + + /** + * Classify an image url without saving the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param classifyImageUrlWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImagePrediction object if successful. + */ + ImagePrediction classifyImageUrlWithNoStore(UUID projectId, String publishedName, String url, ClassifyImageUrlWithNoStoreOptionalParameter classifyImageUrlWithNoStoreOptionalParameter); + + /** + * Classify an image url without saving the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param classifyImageUrlWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImagePrediction object + */ + Observable classifyImageUrlWithNoStoreAsync(UUID projectId, String publishedName, String url, ClassifyImageUrlWithNoStoreOptionalParameter classifyImageUrlWithNoStoreOptionalParameter); + + /** + * Classify an image url without saving the result. + * + * @return the first stage of the classifyImageUrlWithNoStore call + */ + PredictionsClassifyImageUrlWithNoStoreDefinitionStages.WithProjectId classifyImageUrlWithNoStore(); + + /** + * Grouping of classifyImageUrlWithNoStore definition stages. + */ + interface PredictionsClassifyImageUrlWithNoStoreDefinitionStages { + /** + * The stage of the definition to be specify projectId. + */ + interface WithProjectId { + /** + * The project id. + * + * @return next definition stage + */ + WithPublishedName withProjectId(UUID projectId); + } + /** + * The stage of the definition to be specify publishedName. + */ + interface WithPublishedName { + /** + * Specifies the name of the model to evaluate against. + * + * @return next definition stage + */ + WithUrl withPublishedName(String publishedName); + } + /** + * The stage of the definition to be specify url. + */ + interface WithUrl { + /** + * Url of the image. + * + * @return next definition stage + */ + PredictionsClassifyImageUrlWithNoStoreDefinitionStages.WithExecute withUrl(String url); + } + + /** + * The stage of the definition which allows for any other optional settings to be specified. + */ + interface WithAllOptions { /** * Optional. Specifies the name of application using the endpoint. * * @return next definition stage */ - PredictionsPredictImageDefinitionStages.WithExecute withApplication(String application); + PredictionsClassifyImageUrlWithNoStoreDefinitionStages.WithExecute withApplication(String application); } /** * The last stage of the definition which will make the operation call. */ - interface WithExecute extends PredictionsPredictImageDefinitionStages.WithAllOptions { + interface WithExecute extends PredictionsClassifyImageUrlWithNoStoreDefinitionStages.WithAllOptions { /** * Execute the request. * @@ -337,49 +702,52 @@ interface WithExecute extends PredictionsPredictImageDefinitionStages.WithAllOpt } /** - * The entirety of predictImage definition. + * The entirety of classifyImageUrlWithNoStore definition. */ - interface PredictionsPredictImageDefinition extends - PredictionsPredictImageDefinitionStages.WithProjectId, - PredictionsPredictImageDefinitionStages.WithImageData, - PredictionsPredictImageDefinitionStages.WithExecute { + interface PredictionsClassifyImageUrlWithNoStoreDefinition extends + PredictionsClassifyImageUrlWithNoStoreDefinitionStages.WithProjectId, + PredictionsClassifyImageUrlWithNoStoreDefinitionStages.WithPublishedName, + PredictionsClassifyImageUrlWithNoStoreDefinitionStages.WithUrl, + PredictionsClassifyImageUrlWithNoStoreDefinitionStages.WithExecute { } /** - * Predict an image url and saves the result. + * Classify an image and saves the result. * * @param projectId The project id. - * @param predictImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 4MB. + * @param classifyImageOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ImagePrediction object if successful. */ - @Deprecated - ImagePrediction predictImageUrl(UUID projectId, PredictImageUrlOptionalParameter predictImageUrlOptionalParameter); + ImagePrediction classifyImage(UUID projectId, String publishedName, byte[] imageData, ClassifyImageOptionalParameter classifyImageOptionalParameter); /** - * Predict an image url and saves the result. + * Classify an image and saves the result. * * @param projectId The project id. - * @param predictImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 4MB. + * @param classifyImageOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object */ - @Deprecated - Observable predictImageUrlAsync(UUID projectId, PredictImageUrlOptionalParameter predictImageUrlOptionalParameter); + Observable classifyImageAsync(UUID projectId, String publishedName, byte[] imageData, ClassifyImageOptionalParameter classifyImageOptionalParameter); /** - * Predict an image url and saves the result. + * Classify an image and saves the result. * - * @return the first stage of the predictImageUrl call + * @return the first stage of the classifyImage call */ - PredictionsPredictImageUrlDefinitionStages.WithProjectId predictImageUrl(); + PredictionsClassifyImageDefinitionStages.WithProjectId classifyImage(); /** - * Grouping of predictImageUrl definition stages. + * Grouping of classifyImage definition stages. */ - interface PredictionsPredictImageUrlDefinitionStages { + interface PredictionsClassifyImageDefinitionStages { /** * The stage of the definition to be specify projectId. */ @@ -389,7 +757,29 @@ interface WithProjectId { * * @return next definition stage */ - PredictionsPredictImageUrlDefinitionStages.WithExecute withProjectId(UUID projectId); + WithPublishedName withProjectId(UUID projectId); + } + /** + * The stage of the definition to be specify publishedName. + */ + interface WithPublishedName { + /** + * Specifies the name of the model to evaluate against. + * + * @return next definition stage + */ + WithImageData withPublishedName(String publishedName); + } + /** + * The stage of the definition to be specify imageData. + */ + interface WithImageData { + /** + * Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 4MB. + * + * @return next definition stage + */ + PredictionsClassifyImageDefinitionStages.WithExecute withImageData(byte[] imageData); } /** @@ -397,33 +787,132 @@ interface WithProjectId { */ interface WithAllOptions { /** - * Optional. Specifies the id of a particular iteration to evaluate against. - * The default iteration for the project will be used when not specified. + * Optional. Specifies the name of application using the endpoint. * * @return next definition stage */ - PredictionsPredictImageUrlDefinitionStages.WithExecute withIterationId(UUID iterationId); + PredictionsClassifyImageDefinitionStages.WithExecute withApplication(String application); + } + + /** + * The last stage of the definition which will make the operation call. + */ + interface WithExecute extends PredictionsClassifyImageDefinitionStages.WithAllOptions { /** - * Optional. Specifies the name of application using the endpoint. + * Execute the request. * - * @return next definition stage + * @return the ImagePrediction object if successful. */ - PredictionsPredictImageUrlDefinitionStages.WithExecute withApplication(String application); + ImagePrediction execute(); /** + * Execute the request asynchronously. * + * @return the observable to the ImagePrediction object + */ + Observable executeAsync(); + } + } + + /** + * The entirety of classifyImage definition. + */ + interface PredictionsClassifyImageDefinition extends + PredictionsClassifyImageDefinitionStages.WithProjectId, + PredictionsClassifyImageDefinitionStages.WithPublishedName, + PredictionsClassifyImageDefinitionStages.WithImageData, + PredictionsClassifyImageDefinitionStages.WithExecute { + } + + /** + * Classify an image url and saves the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param classifyImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImagePrediction object if successful. + */ + ImagePrediction classifyImageUrl(UUID projectId, String publishedName, String url, ClassifyImageUrlOptionalParameter classifyImageUrlOptionalParameter); + + /** + * Classify an image url and saves the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param classifyImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImagePrediction object + */ + Observable classifyImageUrlAsync(UUID projectId, String publishedName, String url, ClassifyImageUrlOptionalParameter classifyImageUrlOptionalParameter); + + /** + * Classify an image url and saves the result. + * + * @return the first stage of the classifyImageUrl call + */ + PredictionsClassifyImageUrlDefinitionStages.WithProjectId classifyImageUrl(); + + /** + * Grouping of classifyImageUrl definition stages. + */ + interface PredictionsClassifyImageUrlDefinitionStages { + /** + * The stage of the definition to be specify projectId. + */ + interface WithProjectId { + /** + * The project id. + * + * @return next definition stage + */ + WithPublishedName withProjectId(UUID projectId); + } + /** + * The stage of the definition to be specify publishedName. + */ + interface WithPublishedName { + /** + * Specifies the name of the model to evaluate against. + * + * @return next definition stage + */ + WithUrl withPublishedName(String publishedName); + } + /** + * The stage of the definition to be specify url. + */ + interface WithUrl { + /** + * Url of the image. + * + * @return next definition stage + */ + PredictionsClassifyImageUrlDefinitionStages.WithExecute withUrl(String url); + } + + /** + * The stage of the definition which allows for any other optional settings to be specified. + */ + interface WithAllOptions { + /** + * Optional. Specifies the name of application using the endpoint. * * @return next definition stage */ - PredictionsPredictImageUrlDefinitionStages.WithExecute withUrl(String url); + PredictionsClassifyImageUrlDefinitionStages.WithExecute withApplication(String application); } /** * The last stage of the definition which will make the operation call. */ - interface WithExecute extends PredictionsPredictImageUrlDefinitionStages.WithAllOptions { + interface WithExecute extends PredictionsClassifyImageUrlDefinitionStages.WithAllOptions { /** * Execute the request. * @@ -441,11 +930,13 @@ interface WithExecute extends PredictionsPredictImageUrlDefinitionStages.WithAll } /** - * The entirety of predictImageUrl definition. + * The entirety of classifyImageUrl definition. */ - interface PredictionsPredictImageUrlDefinition extends - PredictionsPredictImageUrlDefinitionStages.WithProjectId, - PredictionsPredictImageUrlDefinitionStages.WithExecute { + interface PredictionsClassifyImageUrlDefinition extends + PredictionsClassifyImageUrlDefinitionStages.WithProjectId, + PredictionsClassifyImageUrlDefinitionStages.WithPublishedName, + PredictionsClassifyImageUrlDefinitionStages.WithUrl, + PredictionsClassifyImageUrlDefinitionStages.WithExecute { } } diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/CustomVisionPredictionClientImpl.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/CustomVisionPredictionClientImpl.java new file mode 100644 index 000000000000..02d866db49cc --- /dev/null +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/CustomVisionPredictionClientImpl.java @@ -0,0 +1,208 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.customvision.prediction.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.CustomVisionPredictionClient; +import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.Predictions; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the CustomVisionPredictionClientImpl class. + */ +public class CustomVisionPredictionClientImpl extends AzureServiceClient implements CustomVisionPredictionClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** API key. */ + private String apiKey; + + /** + * Gets API key. + * + * @return the apiKey value. + */ + public String apiKey() { + return this.apiKey; + } + + /** + * Sets API key. + * + * @param apiKey the apiKey value. + * @return the service client itself + */ + public CustomVisionPredictionClientImpl withApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** Supported Cognitive Services endpoints. */ + private String endpoint; + + /** + * Gets Supported Cognitive Services endpoints. + * + * @return the endpoint value. + */ + public String endpoint() { + return this.endpoint; + } + + /** + * Sets Supported Cognitive Services endpoints. + * + * @param endpoint the endpoint value. + * @return the service client itself + */ + public CustomVisionPredictionClientImpl withEndpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public CustomVisionPredictionClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public CustomVisionPredictionClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public CustomVisionPredictionClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The Predictions object to access its operations. + */ + private Predictions predictions; + + /** + * Gets the Predictions object to access its operations. + * @return the Predictions object. + */ + public Predictions predictions() { + return this.predictions; + } + + /** + * Initializes an instance of CustomVisionPredictionClient client. + * + * @param credentials the management credentials for Azure + */ + public CustomVisionPredictionClientImpl(ServiceClientCredentials credentials) { + this("https://{Endpoint}/customvision/v3.0/prediction", credentials); + } + + /** + * Initializes an instance of CustomVisionPredictionClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public CustomVisionPredictionClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of CustomVisionPredictionClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public CustomVisionPredictionClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.predictions = new PredictionsImpl(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "CustomVisionPredictionClient", "3.0"); + } +} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionEndpointImpl.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionEndpointImpl.java deleted file mode 100644 index bef91917e5e5..000000000000 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionEndpointImpl.java +++ /dev/null @@ -1,185 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - */ - -package com.microsoft.azure.cognitiveservices.vision.customvision.prediction.implementation; - -import com.microsoft.azure.AzureClient; -import com.microsoft.azure.AzureServiceClient; -import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.PredictionEndpoint; -import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.Predictions; -import com.microsoft.rest.credentials.ServiceClientCredentials; -import com.microsoft.rest.RestClient; - -/** - * Initializes a new instance of the PredictionEndpointImpl class. - */ -public class PredictionEndpointImpl extends AzureServiceClient implements PredictionEndpoint { - /** the {@link AzureClient} used for long running operations. */ - private AzureClient azureClient; - - /** - * Gets the {@link AzureClient} used for long running operations. - * @return the azure client; - */ - public AzureClient getAzureClient() { - return this.azureClient; - } - - /** The API key. */ - private String apiKey; - - /** - * Gets the API key. - * - * @return the apiKey value. - */ - public String apiKey() { - return this.apiKey; - } - - /** - * Sets the API key. - * - * @param apiKey the apiKey value. - * @return the service client itself - */ - public PredictionEndpointImpl withApiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - - /** Gets or sets the preferred language for the response. */ - private String acceptLanguage; - - /** - * Gets Gets or sets the preferred language for the response. - * - * @return the acceptLanguage value. - */ - public String acceptLanguage() { - return this.acceptLanguage; - } - - /** - * Sets Gets or sets the preferred language for the response. - * - * @param acceptLanguage the acceptLanguage value. - * @return the service client itself - */ - public PredictionEndpointImpl withAcceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ - private int longRunningOperationRetryTimeout; - - /** - * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. - * - * @return the longRunningOperationRetryTimeout value. - */ - public int longRunningOperationRetryTimeout() { - return this.longRunningOperationRetryTimeout; - } - - /** - * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. - * - * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. - * @return the service client itself - */ - public PredictionEndpointImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { - this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; - return this; - } - - /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ - private boolean generateClientRequestId; - - /** - * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. - * - * @return the generateClientRequestId value. - */ - public boolean generateClientRequestId() { - return this.generateClientRequestId; - } - - /** - * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. - * - * @param generateClientRequestId the generateClientRequestId value. - * @return the service client itself - */ - public PredictionEndpointImpl withGenerateClientRequestId(boolean generateClientRequestId) { - this.generateClientRequestId = generateClientRequestId; - return this; - } - - /** - * The Predictions object to access its operations. - */ - private Predictions predictions; - - /** - * Gets the Predictions object to access its operations. - * @return the Predictions object. - */ - public Predictions predictions() { - return this.predictions; - } - - /** - * Initializes an instance of PredictionEndpoint client. - * - * @param credentials the management credentials for Azure - */ - public PredictionEndpointImpl(ServiceClientCredentials credentials) { - this("https://southcentralus.api.cognitive.microsoft.com/customvision/v2.0/Prediction", credentials); - } - - /** - * Initializes an instance of PredictionEndpoint client. - * - * @param baseUrl the base URL of the host - * @param credentials the management credentials for Azure - */ - public PredictionEndpointImpl(String baseUrl, ServiceClientCredentials credentials) { - super(baseUrl, credentials); - initialize(); - } - - /** - * Initializes an instance of PredictionEndpoint client. - * - * @param restClient the REST client to connect to Azure. - */ - public PredictionEndpointImpl(RestClient restClient) { - super(restClient); - initialize(); - } - - protected void initialize() { - this.acceptLanguage = "en-US"; - this.longRunningOperationRetryTimeout = 30; - this.generateClientRequestId = true; - this.predictions = new PredictionsImpl(restClient().retrofit(), this); - this.azureClient = new AzureClient(this); - } - - /** - * Gets the User-Agent header for the client. - * - * @return the user agent string. - */ - @Override - public String userAgent() { - return String.format("%s (%s, %s)", super.userAgent(), "PredictionEndpoint", "2.0"); - } -} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java index cd0b38cef52e..8dd87314aa76 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java @@ -8,21 +8,27 @@ package com.microsoft.azure.cognitiveservices.vision.customvision.prediction.implementation; -import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.PredictImageWithNoStoreOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.PredictImageUrlWithNoStoreOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.PredictImageOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.PredictImageUrlOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.DetectImageWithNoStoreOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.DetectImageUrlWithNoStoreOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.DetectImageOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.DetectImageUrlOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.ClassifyImageWithNoStoreOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.ClassifyImageUrlWithNoStoreOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.ClassifyImageOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.ClassifyImageUrlOptionalParameter; import okhttp3.MediaType; import okhttp3.RequestBody; import retrofit2.Retrofit; import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.Predictions; +import com.google.common.base.Joiner; import com.google.common.reflect.TypeToken; -import com.microsoft.azure.CloudException; +import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.CustomVisionErrorException; import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.ImagePrediction; import com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models.ImageUrl; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import com.microsoft.rest.ServiceResponse; +import java.io.InputStream; import java.io.IOException; import java.util.UUID; import okhttp3.ResponseBody; @@ -46,7 +52,7 @@ public class PredictionsImpl implements Predictions { /** The Retrofit service to perform REST calls. */ private PredictionsService service; /** The service client containing this operation class. */ - private PredictionEndpointImpl client; + private CustomVisionPredictionClientImpl client; /** * Initializes an instance of PredictionsImpl. @@ -54,7 +60,7 @@ public class PredictionsImpl implements Predictions { * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public PredictionsImpl(Retrofit retrofit, PredictionEndpointImpl client) { + public PredictionsImpl(Retrofit retrofit, CustomVisionPredictionClientImpl client) { this.service = retrofit.create(PredictionsService.class); this.client = client; } @@ -65,64 +71,83 @@ public PredictionsImpl(Retrofit retrofit, PredictionEndpointImpl client) { */ interface PredictionsService { @Multipart - @POST("{projectId}/image/nostore") - Observable> predictImageWithNoStore(@Path("projectId") UUID projectId, @Query("iterationId") UUID iterationId, @Query("application") String application, @Part("imageData") RequestBody imageData, @Header("Prediction-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @POST("{projectId}/detect/iterations/{publishedName}/image/nostore") + Observable> detectImageWithNoStore(@Path("projectId") UUID projectId, @Path("publishedName") String publishedName, @Query("application") String application, @Part("imageData") RequestBody imageData, @Header("Prediction-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.prediction.Predictions predictImageUrlWithNoStore" }) - @POST("{projectId}/url/nostore") - Observable> predictImageUrlWithNoStore(@Path("projectId") UUID projectId, @Query("iterationId") UUID iterationId, @Query("application") String application, @Header("Prediction-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.prediction.Predictions detectImageUrlWithNoStore" }) + @POST("{projectId}/detect/iterations/{publishedName}/url/nostore") + Observable> detectImageUrlWithNoStore(@Path("projectId") UUID projectId, @Path("publishedName") String publishedName, @Query("application") String application, @Header("Prediction-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Multipart - @POST("{projectId}/image") - Observable> predictImage(@Path("projectId") UUID projectId, @Query("iterationId") UUID iterationId, @Query("application") String application, @Part("imageData") RequestBody imageData, @Header("Prediction-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @POST("{projectId}/detect/iterations/{publishedName}/image") + Observable> detectImage(@Path("projectId") UUID projectId, @Path("publishedName") String publishedName, @Query("application") String application, @Part("imageData") RequestBody imageData, @Header("Prediction-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.prediction.Predictions predictImageUrl" }) - @POST("{projectId}/url") - Observable> predictImageUrl(@Path("projectId") UUID projectId, @Query("iterationId") UUID iterationId, @Query("application") String application, @Header("Prediction-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.prediction.Predictions detectImageUrl" }) + @POST("{projectId}/detect/iterations/{publishedName}/url") + Observable> detectImageUrl(@Path("projectId") UUID projectId, @Path("publishedName") String publishedName, @Query("application") String application, @Header("Prediction-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Multipart + @POST("{projectId}/classify/iterations/{publishedName}/image/nostore") + Observable> classifyImageWithNoStore(@Path("projectId") UUID projectId, @Path("publishedName") String publishedName, @Query("application") String application, @Part("imageData") RequestBody imageData, @Header("Prediction-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.prediction.Predictions classifyImageUrlWithNoStore" }) + @POST("{projectId}/classify/iterations/{publishedName}/url/nostore") + Observable> classifyImageUrlWithNoStore(@Path("projectId") UUID projectId, @Path("publishedName") String publishedName, @Query("application") String application, @Header("Prediction-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Multipart + @POST("{projectId}/classify/iterations/{publishedName}/image") + Observable> classifyImage(@Path("projectId") UUID projectId, @Path("publishedName") String publishedName, @Query("application") String application, @Part("imageData") RequestBody imageData, @Header("Prediction-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.prediction.Predictions classifyImageUrl" }) + @POST("{projectId}/classify/iterations/{publishedName}/url") + Observable> classifyImageUrl(@Path("projectId") UUID projectId, @Path("publishedName") String publishedName, @Query("application") String application, @Header("Prediction-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); } /** - * Predict an image without saving the result. + * Detect objects in an image without saving the result. * - * @param projectId The project id - * @param imageData the InputStream value - * @param predictImageWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 0MB. + * @param detectImageWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ImagePrediction object if successful. */ - public ImagePrediction predictImageWithNoStore(UUID projectId, byte[] imageData, PredictImageWithNoStoreOptionalParameter predictImageWithNoStoreOptionalParameter) { - return predictImageWithNoStoreWithServiceResponseAsync(projectId, imageData, predictImageWithNoStoreOptionalParameter).toBlocking().single().body(); + public ImagePrediction detectImageWithNoStore(UUID projectId, String publishedName, byte[] imageData, DetectImageWithNoStoreOptionalParameter detectImageWithNoStoreOptionalParameter) { + return detectImageWithNoStoreWithServiceResponseAsync(projectId, publishedName, imageData, detectImageWithNoStoreOptionalParameter).toBlocking().single().body(); } /** - * Predict an image without saving the result. + * Detect objects in an image without saving the result. * - * @param projectId The project id - * @param imageData the InputStream value - * @param predictImageWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 0MB. + * @param detectImageWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture predictImageWithNoStoreAsync(UUID projectId, byte[] imageData, PredictImageWithNoStoreOptionalParameter predictImageWithNoStoreOptionalParameter, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(predictImageWithNoStoreWithServiceResponseAsync(projectId, imageData, predictImageWithNoStoreOptionalParameter), serviceCallback); + public ServiceFuture detectImageWithNoStoreAsync(UUID projectId, String publishedName, byte[] imageData, DetectImageWithNoStoreOptionalParameter detectImageWithNoStoreOptionalParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(detectImageWithNoStoreWithServiceResponseAsync(projectId, publishedName, imageData, detectImageWithNoStoreOptionalParameter), serviceCallback); } /** - * Predict an image without saving the result. + * Detect objects in an image without saving the result. * - * @param projectId The project id - * @param imageData the InputStream value - * @param predictImageWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 0MB. + * @param detectImageWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object */ - public Observable predictImageWithNoStoreAsync(UUID projectId, byte[] imageData, PredictImageWithNoStoreOptionalParameter predictImageWithNoStoreOptionalParameter) { - return predictImageWithNoStoreWithServiceResponseAsync(projectId, imageData, predictImageWithNoStoreOptionalParameter).map(new Func1, ImagePrediction>() { + public Observable detectImageWithNoStoreAsync(UUID projectId, String publishedName, byte[] imageData, DetectImageWithNoStoreOptionalParameter detectImageWithNoStoreOptionalParameter) { + return detectImageWithNoStoreWithServiceResponseAsync(projectId, publishedName, imageData, detectImageWithNoStoreOptionalParameter).map(new Func1, ImagePrediction>() { @Override public ImagePrediction call(ServiceResponse response) { return response.body(); @@ -131,58 +156,70 @@ public ImagePrediction call(ServiceResponse response) { } /** - * Predict an image without saving the result. + * Detect objects in an image without saving the result. * - * @param projectId The project id - * @param imageData the InputStream value - * @param predictImageWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 0MB. + * @param detectImageWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object */ - public Observable> predictImageWithNoStoreWithServiceResponseAsync(UUID projectId, byte[] imageData, PredictImageWithNoStoreOptionalParameter predictImageWithNoStoreOptionalParameter) { + public Observable> detectImageWithNoStoreWithServiceResponseAsync(UUID projectId, String publishedName, byte[] imageData, DetectImageWithNoStoreOptionalParameter detectImageWithNoStoreOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } + if (publishedName == null) { + throw new IllegalArgumentException("Parameter publishedName is required and cannot be null."); + } if (imageData == null) { throw new IllegalArgumentException("Parameter imageData is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - final UUID iterationId = predictImageWithNoStoreOptionalParameter != null ? predictImageWithNoStoreOptionalParameter.iterationId() : null; - final String application = predictImageWithNoStoreOptionalParameter != null ? predictImageWithNoStoreOptionalParameter.application() : null; + final String application = detectImageWithNoStoreOptionalParameter != null ? detectImageWithNoStoreOptionalParameter.application() : null; - return predictImageWithNoStoreWithServiceResponseAsync(projectId, imageData, iterationId, application); + return detectImageWithNoStoreWithServiceResponseAsync(projectId, publishedName, imageData, application); } /** - * Predict an image without saving the result. + * Detect objects in an image without saving the result. * - * @param projectId The project id - * @param imageData the InputStream value - * @param iterationId Optional. Specifies the id of a particular iteration to evaluate against. - The default iteration for the project will be used when not specified - * @param application Optional. Specifies the name of application using the endpoint + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 0MB. + * @param application Optional. Specifies the name of application using the endpoint. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object */ - public Observable> predictImageWithNoStoreWithServiceResponseAsync(UUID projectId, byte[] imageData, UUID iterationId, String application) { + public Observable> detectImageWithNoStoreWithServiceResponseAsync(UUID projectId, String publishedName, byte[] imageData, String application) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } + if (publishedName == null) { + throw new IllegalArgumentException("Parameter publishedName is required and cannot be null."); + } if (imageData == null) { throw new IllegalArgumentException("Parameter imageData is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); RequestBody imageDataConverted = RequestBody.create(MediaType.parse("multipart/form-data"), imageData); - return service.predictImageWithNoStore(projectId, iterationId, application, imageDataConverted, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) + return service.detectImageWithNoStore(projectId, publishedName, application, imageDataConverted, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = predictImageWithNoStoreDelegate(response); + ServiceResponse clientResponse = detectImageWithNoStoreDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -191,68 +228,68 @@ public Observable> call(Response }); } - private ServiceResponse predictImageWithNoStoreDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse detectImageWithNoStoreDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .registerError(CustomVisionErrorException.class) .build(response); } @Override - public PredictionsPredictImageWithNoStoreParameters predictImageWithNoStore() { - return new PredictionsPredictImageWithNoStoreParameters(this); + public PredictionsDetectImageWithNoStoreParameters detectImageWithNoStore() { + return new PredictionsDetectImageWithNoStoreParameters(this); } /** - * Internal class implementing PredictionsPredictImageWithNoStoreDefinition. + * Internal class implementing PredictionsDetectImageWithNoStoreDefinition. */ - class PredictionsPredictImageWithNoStoreParameters implements PredictionsPredictImageWithNoStoreDefinition { + class PredictionsDetectImageWithNoStoreParameters implements PredictionsDetectImageWithNoStoreDefinition { private PredictionsImpl parent; private UUID projectId; + private String publishedName; private byte[] imageData; - private UUID iterationId; private String application; /** * Constructor. * @param parent the parent object. */ - PredictionsPredictImageWithNoStoreParameters(PredictionsImpl parent) { + PredictionsDetectImageWithNoStoreParameters(PredictionsImpl parent) { this.parent = parent; } @Override - public PredictionsPredictImageWithNoStoreParameters withProjectId(UUID projectId) { + public PredictionsDetectImageWithNoStoreParameters withProjectId(UUID projectId) { this.projectId = projectId; return this; } @Override - public PredictionsPredictImageWithNoStoreParameters withImageData(byte[] imageData) { - this.imageData = imageData; + public PredictionsDetectImageWithNoStoreParameters withPublishedName(String publishedName) { + this.publishedName = publishedName; return this; } @Override - public PredictionsPredictImageWithNoStoreParameters withIterationId(UUID iterationId) { - this.iterationId = iterationId; + public PredictionsDetectImageWithNoStoreParameters withImageData(byte[] imageData) { + this.imageData = imageData; return this; } @Override - public PredictionsPredictImageWithNoStoreParameters withApplication(String application) { + public PredictionsDetectImageWithNoStoreParameters withApplication(String application) { this.application = application; return this; } @Override public ImagePrediction execute() { - return predictImageWithNoStoreWithServiceResponseAsync(projectId, imageData, iterationId, application).toBlocking().single().body(); + return detectImageWithNoStoreWithServiceResponseAsync(projectId, publishedName, imageData, application).toBlocking().single().body(); } @Override public Observable executeAsync() { - return predictImageWithNoStoreWithServiceResponseAsync(projectId, imageData, iterationId, application).map(new Func1, ImagePrediction>() { + return detectImageWithNoStoreWithServiceResponseAsync(projectId, publishedName, imageData, application).map(new Func1, ImagePrediction>() { @Override public ImagePrediction call(ServiceResponse response) { return response.body(); @@ -263,42 +300,48 @@ public ImagePrediction call(ServiceResponse response) { /** - * Predict an image url without saving the result. + * Detect objects in an image url without saving the result. * - * @param projectId The project id - * @param predictImageUrlWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param detectImageUrlWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ImagePrediction object if successful. */ - public ImagePrediction predictImageUrlWithNoStore(UUID projectId, PredictImageUrlWithNoStoreOptionalParameter predictImageUrlWithNoStoreOptionalParameter) { - return predictImageUrlWithNoStoreWithServiceResponseAsync(projectId, predictImageUrlWithNoStoreOptionalParameter).toBlocking().single().body(); + public ImagePrediction detectImageUrlWithNoStore(UUID projectId, String publishedName, String url, DetectImageUrlWithNoStoreOptionalParameter detectImageUrlWithNoStoreOptionalParameter) { + return detectImageUrlWithNoStoreWithServiceResponseAsync(projectId, publishedName, url, detectImageUrlWithNoStoreOptionalParameter).toBlocking().single().body(); } /** - * Predict an image url without saving the result. + * Detect objects in an image url without saving the result. * - * @param projectId The project id - * @param predictImageUrlWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param detectImageUrlWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture predictImageUrlWithNoStoreAsync(UUID projectId, PredictImageUrlWithNoStoreOptionalParameter predictImageUrlWithNoStoreOptionalParameter, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(predictImageUrlWithNoStoreWithServiceResponseAsync(projectId, predictImageUrlWithNoStoreOptionalParameter), serviceCallback); + public ServiceFuture detectImageUrlWithNoStoreAsync(UUID projectId, String publishedName, String url, DetectImageUrlWithNoStoreOptionalParameter detectImageUrlWithNoStoreOptionalParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(detectImageUrlWithNoStoreWithServiceResponseAsync(projectId, publishedName, url, detectImageUrlWithNoStoreOptionalParameter), serviceCallback); } /** - * Predict an image url without saving the result. + * Detect objects in an image url without saving the result. * - * @param projectId The project id - * @param predictImageUrlWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param detectImageUrlWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object */ - public Observable predictImageUrlWithNoStoreAsync(UUID projectId, PredictImageUrlWithNoStoreOptionalParameter predictImageUrlWithNoStoreOptionalParameter) { - return predictImageUrlWithNoStoreWithServiceResponseAsync(projectId, predictImageUrlWithNoStoreOptionalParameter).map(new Func1, ImagePrediction>() { + public Observable detectImageUrlWithNoStoreAsync(UUID projectId, String publishedName, String url, DetectImageUrlWithNoStoreOptionalParameter detectImageUrlWithNoStoreOptionalParameter) { + return detectImageUrlWithNoStoreWithServiceResponseAsync(projectId, publishedName, url, detectImageUrlWithNoStoreOptionalParameter).map(new Func1, ImagePrediction>() { @Override public ImagePrediction call(ServiceResponse response) { return response.body(); @@ -307,53 +350,71 @@ public ImagePrediction call(ServiceResponse response) { } /** - * Predict an image url without saving the result. + * Detect objects in an image url without saving the result. * - * @param projectId The project id - * @param predictImageUrlWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param detectImageUrlWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object */ - public Observable> predictImageUrlWithNoStoreWithServiceResponseAsync(UUID projectId, PredictImageUrlWithNoStoreOptionalParameter predictImageUrlWithNoStoreOptionalParameter) { + public Observable> detectImageUrlWithNoStoreWithServiceResponseAsync(UUID projectId, String publishedName, String url, DetectImageUrlWithNoStoreOptionalParameter detectImageUrlWithNoStoreOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } + if (publishedName == null) { + throw new IllegalArgumentException("Parameter publishedName is required and cannot be null."); + } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - final UUID iterationId = predictImageUrlWithNoStoreOptionalParameter != null ? predictImageUrlWithNoStoreOptionalParameter.iterationId() : null; - final String application = predictImageUrlWithNoStoreOptionalParameter != null ? predictImageUrlWithNoStoreOptionalParameter.application() : null; - final String url = predictImageUrlWithNoStoreOptionalParameter != null ? predictImageUrlWithNoStoreOptionalParameter.url() : null; + if (url == null) { + throw new IllegalArgumentException("Parameter url is required and cannot be null."); + } + final String application = detectImageUrlWithNoStoreOptionalParameter != null ? detectImageUrlWithNoStoreOptionalParameter.application() : null; - return predictImageUrlWithNoStoreWithServiceResponseAsync(projectId, iterationId, application, url); + return detectImageUrlWithNoStoreWithServiceResponseAsync(projectId, publishedName, url, application); } /** - * Predict an image url without saving the result. + * Detect objects in an image url without saving the result. * - * @param projectId The project id - * @param iterationId Optional. Specifies the id of a particular iteration to evaluate against. - The default iteration for the project will be used when not specified - * @param application Optional. Specifies the name of application using the endpoint - * @param url the String value + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param application Optional. Specifies the name of application using the endpoint. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object */ - public Observable> predictImageUrlWithNoStoreWithServiceResponseAsync(UUID projectId, UUID iterationId, String application, String url) { + public Observable> detectImageUrlWithNoStoreWithServiceResponseAsync(UUID projectId, String publishedName, String url, String application) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } + if (publishedName == null) { + throw new IllegalArgumentException("Parameter publishedName is required and cannot be null."); + } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } + if (url == null) { + throw new IllegalArgumentException("Parameter url is required and cannot be null."); + } ImageUrl imageUrl = new ImageUrl(); imageUrl.withUrl(url); - return service.predictImageUrlWithNoStore(projectId, iterationId, application, this.client.apiKey(), this.client.acceptLanguage(), imageUrl, this.client.userAgent()) + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.detectImageUrlWithNoStore(projectId, publishedName, application, this.client.apiKey(), this.client.acceptLanguage(), imageUrl, parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = predictImageUrlWithNoStoreDelegate(response); + ServiceResponse clientResponse = detectImageUrlWithNoStoreDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -362,68 +423,68 @@ public Observable> call(Response }); } - private ServiceResponse predictImageUrlWithNoStoreDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse detectImageUrlWithNoStoreDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .registerError(CustomVisionErrorException.class) .build(response); } @Override - public PredictionsPredictImageUrlWithNoStoreParameters predictImageUrlWithNoStore() { - return new PredictionsPredictImageUrlWithNoStoreParameters(this); + public PredictionsDetectImageUrlWithNoStoreParameters detectImageUrlWithNoStore() { + return new PredictionsDetectImageUrlWithNoStoreParameters(this); } /** - * Internal class implementing PredictionsPredictImageUrlWithNoStoreDefinition. + * Internal class implementing PredictionsDetectImageUrlWithNoStoreDefinition. */ - class PredictionsPredictImageUrlWithNoStoreParameters implements PredictionsPredictImageUrlWithNoStoreDefinition { + class PredictionsDetectImageUrlWithNoStoreParameters implements PredictionsDetectImageUrlWithNoStoreDefinition { private PredictionsImpl parent; private UUID projectId; - private UUID iterationId; - private String application; + private String publishedName; private String url; + private String application; /** * Constructor. * @param parent the parent object. */ - PredictionsPredictImageUrlWithNoStoreParameters(PredictionsImpl parent) { + PredictionsDetectImageUrlWithNoStoreParameters(PredictionsImpl parent) { this.parent = parent; } @Override - public PredictionsPredictImageUrlWithNoStoreParameters withProjectId(UUID projectId) { + public PredictionsDetectImageUrlWithNoStoreParameters withProjectId(UUID projectId) { this.projectId = projectId; return this; } @Override - public PredictionsPredictImageUrlWithNoStoreParameters withIterationId(UUID iterationId) { - this.iterationId = iterationId; + public PredictionsDetectImageUrlWithNoStoreParameters withPublishedName(String publishedName) { + this.publishedName = publishedName; return this; } @Override - public PredictionsPredictImageUrlWithNoStoreParameters withApplication(String application) { - this.application = application; + public PredictionsDetectImageUrlWithNoStoreParameters withUrl(String url) { + this.url = url; return this; } @Override - public PredictionsPredictImageUrlWithNoStoreParameters withUrl(String url) { - this.url = url; + public PredictionsDetectImageUrlWithNoStoreParameters withApplication(String application) { + this.application = application; return this; } @Override public ImagePrediction execute() { - return predictImageUrlWithNoStoreWithServiceResponseAsync(projectId, iterationId, application, url).toBlocking().single().body(); + return detectImageUrlWithNoStoreWithServiceResponseAsync(projectId, publishedName, url, application).toBlocking().single().body(); } @Override public Observable executeAsync() { - return predictImageUrlWithNoStoreWithServiceResponseAsync(projectId, iterationId, application, url).map(new Func1, ImagePrediction>() { + return detectImageUrlWithNoStoreWithServiceResponseAsync(projectId, publishedName, url, application).map(new Func1, ImagePrediction>() { @Override public ImagePrediction call(ServiceResponse response) { return response.body(); @@ -434,45 +495,48 @@ public ImagePrediction call(ServiceResponse response) { /** - * Predict an image and saves the result. + * Detect objects in an image and saves the result. * - * @param projectId The project id - * @param imageData the InputStream value - * @param predictImageOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 4MB. + * @param detectImageOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ImagePrediction object if successful. */ - public ImagePrediction predictImage(UUID projectId, byte[] imageData, PredictImageOptionalParameter predictImageOptionalParameter) { - return predictImageWithServiceResponseAsync(projectId, imageData, predictImageOptionalParameter).toBlocking().single().body(); + public ImagePrediction detectImage(UUID projectId, String publishedName, byte[] imageData, DetectImageOptionalParameter detectImageOptionalParameter) { + return detectImageWithServiceResponseAsync(projectId, publishedName, imageData, detectImageOptionalParameter).toBlocking().single().body(); } /** - * Predict an image and saves the result. + * Detect objects in an image and saves the result. * - * @param projectId The project id - * @param imageData the InputStream value - * @param predictImageOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 4MB. + * @param detectImageOptionalParameter the object representing the optional parameters to be set before calling this API * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture predictImageAsync(UUID projectId, byte[] imageData, PredictImageOptionalParameter predictImageOptionalParameter, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(predictImageWithServiceResponseAsync(projectId, imageData, predictImageOptionalParameter), serviceCallback); + public ServiceFuture detectImageAsync(UUID projectId, String publishedName, byte[] imageData, DetectImageOptionalParameter detectImageOptionalParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(detectImageWithServiceResponseAsync(projectId, publishedName, imageData, detectImageOptionalParameter), serviceCallback); } /** - * Predict an image and saves the result. + * Detect objects in an image and saves the result. * - * @param projectId The project id - * @param imageData the InputStream value - * @param predictImageOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 4MB. + * @param detectImageOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object */ - public Observable predictImageAsync(UUID projectId, byte[] imageData, PredictImageOptionalParameter predictImageOptionalParameter) { - return predictImageWithServiceResponseAsync(projectId, imageData, predictImageOptionalParameter).map(new Func1, ImagePrediction>() { + public Observable detectImageAsync(UUID projectId, String publishedName, byte[] imageData, DetectImageOptionalParameter detectImageOptionalParameter) { + return detectImageWithServiceResponseAsync(projectId, publishedName, imageData, detectImageOptionalParameter).map(new Func1, ImagePrediction>() { @Override public ImagePrediction call(ServiceResponse response) { return response.body(); @@ -481,58 +545,70 @@ public ImagePrediction call(ServiceResponse response) { } /** - * Predict an image and saves the result. + * Detect objects in an image and saves the result. * - * @param projectId The project id - * @param imageData the InputStream value - * @param predictImageOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 4MB. + * @param detectImageOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object */ - public Observable> predictImageWithServiceResponseAsync(UUID projectId, byte[] imageData, PredictImageOptionalParameter predictImageOptionalParameter) { + public Observable> detectImageWithServiceResponseAsync(UUID projectId, String publishedName, byte[] imageData, DetectImageOptionalParameter detectImageOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } + if (publishedName == null) { + throw new IllegalArgumentException("Parameter publishedName is required and cannot be null."); + } if (imageData == null) { throw new IllegalArgumentException("Parameter imageData is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - final UUID iterationId = predictImageOptionalParameter != null ? predictImageOptionalParameter.iterationId() : null; - final String application = predictImageOptionalParameter != null ? predictImageOptionalParameter.application() : null; + final String application = detectImageOptionalParameter != null ? detectImageOptionalParameter.application() : null; - return predictImageWithServiceResponseAsync(projectId, imageData, iterationId, application); + return detectImageWithServiceResponseAsync(projectId, publishedName, imageData, application); } /** - * Predict an image and saves the result. + * Detect objects in an image and saves the result. * - * @param projectId The project id - * @param imageData the InputStream value - * @param iterationId Optional. Specifies the id of a particular iteration to evaluate against. - The default iteration for the project will be used when not specified - * @param application Optional. Specifies the name of application using the endpoint + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 4MB. + * @param application Optional. Specifies the name of application using the endpoint. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object */ - public Observable> predictImageWithServiceResponseAsync(UUID projectId, byte[] imageData, UUID iterationId, String application) { + public Observable> detectImageWithServiceResponseAsync(UUID projectId, String publishedName, byte[] imageData, String application) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } + if (publishedName == null) { + throw new IllegalArgumentException("Parameter publishedName is required and cannot be null."); + } if (imageData == null) { throw new IllegalArgumentException("Parameter imageData is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); RequestBody imageDataConverted = RequestBody.create(MediaType.parse("multipart/form-data"), imageData); - return service.predictImage(projectId, iterationId, application, imageDataConverted, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) + return service.detectImage(projectId, publishedName, application, imageDataConverted, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = predictImageDelegate(response); + ServiceResponse clientResponse = detectImageDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -541,68 +617,68 @@ public Observable> call(Response }); } - private ServiceResponse predictImageDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse detectImageDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .registerError(CustomVisionErrorException.class) .build(response); } @Override - public PredictionsPredictImageParameters predictImage() { - return new PredictionsPredictImageParameters(this); + public PredictionsDetectImageParameters detectImage() { + return new PredictionsDetectImageParameters(this); } /** - * Internal class implementing PredictionsPredictImageDefinition. + * Internal class implementing PredictionsDetectImageDefinition. */ - class PredictionsPredictImageParameters implements PredictionsPredictImageDefinition { + class PredictionsDetectImageParameters implements PredictionsDetectImageDefinition { private PredictionsImpl parent; private UUID projectId; + private String publishedName; private byte[] imageData; - private UUID iterationId; private String application; /** * Constructor. * @param parent the parent object. */ - PredictionsPredictImageParameters(PredictionsImpl parent) { + PredictionsDetectImageParameters(PredictionsImpl parent) { this.parent = parent; } @Override - public PredictionsPredictImageParameters withProjectId(UUID projectId) { + public PredictionsDetectImageParameters withProjectId(UUID projectId) { this.projectId = projectId; return this; } @Override - public PredictionsPredictImageParameters withImageData(byte[] imageData) { - this.imageData = imageData; + public PredictionsDetectImageParameters withPublishedName(String publishedName) { + this.publishedName = publishedName; return this; } @Override - public PredictionsPredictImageParameters withIterationId(UUID iterationId) { - this.iterationId = iterationId; + public PredictionsDetectImageParameters withImageData(byte[] imageData) { + this.imageData = imageData; return this; } @Override - public PredictionsPredictImageParameters withApplication(String application) { + public PredictionsDetectImageParameters withApplication(String application) { this.application = application; return this; } @Override public ImagePrediction execute() { - return predictImageWithServiceResponseAsync(projectId, imageData, iterationId, application).toBlocking().single().body(); + return detectImageWithServiceResponseAsync(projectId, publishedName, imageData, application).toBlocking().single().body(); } @Override public Observable executeAsync() { - return predictImageWithServiceResponseAsync(projectId, imageData, iterationId, application).map(new Func1, ImagePrediction>() { + return detectImageWithServiceResponseAsync(projectId, publishedName, imageData, application).map(new Func1, ImagePrediction>() { @Override public ImagePrediction call(ServiceResponse response) { return response.body(); @@ -613,42 +689,48 @@ public ImagePrediction call(ServiceResponse response) { /** - * Predict an image url and saves the result. + * Detect objects in an image url and saves the result. * - * @param projectId The project id - * @param predictImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param detectImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ImagePrediction object if successful. */ - public ImagePrediction predictImageUrl(UUID projectId, PredictImageUrlOptionalParameter predictImageUrlOptionalParameter) { - return predictImageUrlWithServiceResponseAsync(projectId, predictImageUrlOptionalParameter).toBlocking().single().body(); + public ImagePrediction detectImageUrl(UUID projectId, String publishedName, String url, DetectImageUrlOptionalParameter detectImageUrlOptionalParameter) { + return detectImageUrlWithServiceResponseAsync(projectId, publishedName, url, detectImageUrlOptionalParameter).toBlocking().single().body(); } /** - * Predict an image url and saves the result. + * Detect objects in an image url and saves the result. * - * @param projectId The project id - * @param predictImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param detectImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture predictImageUrlAsync(UUID projectId, PredictImageUrlOptionalParameter predictImageUrlOptionalParameter, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(predictImageUrlWithServiceResponseAsync(projectId, predictImageUrlOptionalParameter), serviceCallback); + public ServiceFuture detectImageUrlAsync(UUID projectId, String publishedName, String url, DetectImageUrlOptionalParameter detectImageUrlOptionalParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(detectImageUrlWithServiceResponseAsync(projectId, publishedName, url, detectImageUrlOptionalParameter), serviceCallback); } /** - * Predict an image url and saves the result. + * Detect objects in an image url and saves the result. * - * @param projectId The project id - * @param predictImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param detectImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object */ - public Observable predictImageUrlAsync(UUID projectId, PredictImageUrlOptionalParameter predictImageUrlOptionalParameter) { - return predictImageUrlWithServiceResponseAsync(projectId, predictImageUrlOptionalParameter).map(new Func1, ImagePrediction>() { + public Observable detectImageUrlAsync(UUID projectId, String publishedName, String url, DetectImageUrlOptionalParameter detectImageUrlOptionalParameter) { + return detectImageUrlWithServiceResponseAsync(projectId, publishedName, url, detectImageUrlOptionalParameter).map(new Func1, ImagePrediction>() { @Override public ImagePrediction call(ServiceResponse response) { return response.body(); @@ -657,53 +739,71 @@ public ImagePrediction call(ServiceResponse response) { } /** - * Predict an image url and saves the result. + * Detect objects in an image url and saves the result. * - * @param projectId The project id - * @param predictImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param detectImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object */ - public Observable> predictImageUrlWithServiceResponseAsync(UUID projectId, PredictImageUrlOptionalParameter predictImageUrlOptionalParameter) { + public Observable> detectImageUrlWithServiceResponseAsync(UUID projectId, String publishedName, String url, DetectImageUrlOptionalParameter detectImageUrlOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } + if (publishedName == null) { + throw new IllegalArgumentException("Parameter publishedName is required and cannot be null."); + } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - final UUID iterationId = predictImageUrlOptionalParameter != null ? predictImageUrlOptionalParameter.iterationId() : null; - final String application = predictImageUrlOptionalParameter != null ? predictImageUrlOptionalParameter.application() : null; - final String url = predictImageUrlOptionalParameter != null ? predictImageUrlOptionalParameter.url() : null; + if (url == null) { + throw new IllegalArgumentException("Parameter url is required and cannot be null."); + } + final String application = detectImageUrlOptionalParameter != null ? detectImageUrlOptionalParameter.application() : null; - return predictImageUrlWithServiceResponseAsync(projectId, iterationId, application, url); + return detectImageUrlWithServiceResponseAsync(projectId, publishedName, url, application); } /** - * Predict an image url and saves the result. + * Detect objects in an image url and saves the result. * - * @param projectId The project id - * @param iterationId Optional. Specifies the id of a particular iteration to evaluate against. - The default iteration for the project will be used when not specified - * @param application Optional. Specifies the name of application using the endpoint - * @param url the String value + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param application Optional. Specifies the name of application using the endpoint. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object */ - public Observable> predictImageUrlWithServiceResponseAsync(UUID projectId, UUID iterationId, String application, String url) { + public Observable> detectImageUrlWithServiceResponseAsync(UUID projectId, String publishedName, String url, String application) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } + if (publishedName == null) { + throw new IllegalArgumentException("Parameter publishedName is required and cannot be null."); + } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } + if (url == null) { + throw new IllegalArgumentException("Parameter url is required and cannot be null."); + } ImageUrl imageUrl = new ImageUrl(); imageUrl.withUrl(url); - return service.predictImageUrl(projectId, iterationId, application, this.client.apiKey(), this.client.acceptLanguage(), imageUrl, this.client.userAgent()) + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.detectImageUrl(projectId, publishedName, application, this.client.apiKey(), this.client.acceptLanguage(), imageUrl, parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = predictImageUrlDelegate(response); + ServiceResponse clientResponse = detectImageUrlDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -712,68 +812,846 @@ public Observable> call(Response }); } - private ServiceResponse predictImageUrlDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse detectImageUrlDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .registerError(CustomVisionErrorException.class) .build(response); } @Override - public PredictionsPredictImageUrlParameters predictImageUrl() { - return new PredictionsPredictImageUrlParameters(this); + public PredictionsDetectImageUrlParameters detectImageUrl() { + return new PredictionsDetectImageUrlParameters(this); } /** - * Internal class implementing PredictionsPredictImageUrlDefinition. + * Internal class implementing PredictionsDetectImageUrlDefinition. */ - class PredictionsPredictImageUrlParameters implements PredictionsPredictImageUrlDefinition { + class PredictionsDetectImageUrlParameters implements PredictionsDetectImageUrlDefinition { private PredictionsImpl parent; private UUID projectId; - private UUID iterationId; - private String application; + private String publishedName; private String url; + private String application; /** * Constructor. * @param parent the parent object. */ - PredictionsPredictImageUrlParameters(PredictionsImpl parent) { + PredictionsDetectImageUrlParameters(PredictionsImpl parent) { this.parent = parent; } @Override - public PredictionsPredictImageUrlParameters withProjectId(UUID projectId) { + public PredictionsDetectImageUrlParameters withProjectId(UUID projectId) { this.projectId = projectId; return this; } @Override - public PredictionsPredictImageUrlParameters withIterationId(UUID iterationId) { - this.iterationId = iterationId; + public PredictionsDetectImageUrlParameters withPublishedName(String publishedName) { + this.publishedName = publishedName; + return this; + } + + @Override + public PredictionsDetectImageUrlParameters withUrl(String url) { + this.url = url; return this; } @Override - public PredictionsPredictImageUrlParameters withApplication(String application) { + public PredictionsDetectImageUrlParameters withApplication(String application) { this.application = application; return this; } @Override - public PredictionsPredictImageUrlParameters withUrl(String url) { - this.url = url; + public ImagePrediction execute() { + return detectImageUrlWithServiceResponseAsync(projectId, publishedName, url, application).toBlocking().single().body(); + } + + @Override + public Observable executeAsync() { + return detectImageUrlWithServiceResponseAsync(projectId, publishedName, url, application).map(new Func1, ImagePrediction>() { + @Override + public ImagePrediction call(ServiceResponse response) { + return response.body(); + } + }); + } + } + + + /** + * Classify an image without saving the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 0MB. + * @param classifyImageWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImagePrediction object if successful. + */ + public ImagePrediction classifyImageWithNoStore(UUID projectId, String publishedName, byte[] imageData, ClassifyImageWithNoStoreOptionalParameter classifyImageWithNoStoreOptionalParameter) { + return classifyImageWithNoStoreWithServiceResponseAsync(projectId, publishedName, imageData, classifyImageWithNoStoreOptionalParameter).toBlocking().single().body(); + } + + /** + * Classify an image without saving the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 0MB. + * @param classifyImageWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture classifyImageWithNoStoreAsync(UUID projectId, String publishedName, byte[] imageData, ClassifyImageWithNoStoreOptionalParameter classifyImageWithNoStoreOptionalParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(classifyImageWithNoStoreWithServiceResponseAsync(projectId, publishedName, imageData, classifyImageWithNoStoreOptionalParameter), serviceCallback); + } + + /** + * Classify an image without saving the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 0MB. + * @param classifyImageWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImagePrediction object + */ + public Observable classifyImageWithNoStoreAsync(UUID projectId, String publishedName, byte[] imageData, ClassifyImageWithNoStoreOptionalParameter classifyImageWithNoStoreOptionalParameter) { + return classifyImageWithNoStoreWithServiceResponseAsync(projectId, publishedName, imageData, classifyImageWithNoStoreOptionalParameter).map(new Func1, ImagePrediction>() { + @Override + public ImagePrediction call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Classify an image without saving the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 0MB. + * @param classifyImageWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImagePrediction object + */ + public Observable> classifyImageWithNoStoreWithServiceResponseAsync(UUID projectId, String publishedName, byte[] imageData, ClassifyImageWithNoStoreOptionalParameter classifyImageWithNoStoreOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (projectId == null) { + throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); + } + if (publishedName == null) { + throw new IllegalArgumentException("Parameter publishedName is required and cannot be null."); + } + if (imageData == null) { + throw new IllegalArgumentException("Parameter imageData is required and cannot be null."); + } + if (this.client.apiKey() == null) { + throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); + } + final String application = classifyImageWithNoStoreOptionalParameter != null ? classifyImageWithNoStoreOptionalParameter.application() : null; + + return classifyImageWithNoStoreWithServiceResponseAsync(projectId, publishedName, imageData, application); + } + + /** + * Classify an image without saving the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 0MB. + * @param application Optional. Specifies the name of application using the endpoint. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImagePrediction object + */ + public Observable> classifyImageWithNoStoreWithServiceResponseAsync(UUID projectId, String publishedName, byte[] imageData, String application) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (projectId == null) { + throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); + } + if (publishedName == null) { + throw new IllegalArgumentException("Parameter publishedName is required and cannot be null."); + } + if (imageData == null) { + throw new IllegalArgumentException("Parameter imageData is required and cannot be null."); + } + if (this.client.apiKey() == null) { + throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + RequestBody imageDataConverted = RequestBody.create(MediaType.parse("multipart/form-data"), imageData); + return service.classifyImageWithNoStore(projectId, publishedName, application, imageDataConverted, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = classifyImageWithNoStoreDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse classifyImageWithNoStoreDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) + .build(response); + } + + @Override + public PredictionsClassifyImageWithNoStoreParameters classifyImageWithNoStore() { + return new PredictionsClassifyImageWithNoStoreParameters(this); + } + + /** + * Internal class implementing PredictionsClassifyImageWithNoStoreDefinition. + */ + class PredictionsClassifyImageWithNoStoreParameters implements PredictionsClassifyImageWithNoStoreDefinition { + private PredictionsImpl parent; + private UUID projectId; + private String publishedName; + private byte[] imageData; + private String application; + + /** + * Constructor. + * @param parent the parent object. + */ + PredictionsClassifyImageWithNoStoreParameters(PredictionsImpl parent) { + this.parent = parent; + } + + @Override + public PredictionsClassifyImageWithNoStoreParameters withProjectId(UUID projectId) { + this.projectId = projectId; + return this; + } + + @Override + public PredictionsClassifyImageWithNoStoreParameters withPublishedName(String publishedName) { + this.publishedName = publishedName; + return this; + } + + @Override + public PredictionsClassifyImageWithNoStoreParameters withImageData(byte[] imageData) { + this.imageData = imageData; + return this; + } + + @Override + public PredictionsClassifyImageWithNoStoreParameters withApplication(String application) { + this.application = application; + return this; + } + + @Override + public ImagePrediction execute() { + return classifyImageWithNoStoreWithServiceResponseAsync(projectId, publishedName, imageData, application).toBlocking().single().body(); + } + + @Override + public Observable executeAsync() { + return classifyImageWithNoStoreWithServiceResponseAsync(projectId, publishedName, imageData, application).map(new Func1, ImagePrediction>() { + @Override + public ImagePrediction call(ServiceResponse response) { + return response.body(); + } + }); + } + } + + + /** + * Classify an image url without saving the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param classifyImageUrlWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImagePrediction object if successful. + */ + public ImagePrediction classifyImageUrlWithNoStore(UUID projectId, String publishedName, String url, ClassifyImageUrlWithNoStoreOptionalParameter classifyImageUrlWithNoStoreOptionalParameter) { + return classifyImageUrlWithNoStoreWithServiceResponseAsync(projectId, publishedName, url, classifyImageUrlWithNoStoreOptionalParameter).toBlocking().single().body(); + } + + /** + * Classify an image url without saving the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param classifyImageUrlWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture classifyImageUrlWithNoStoreAsync(UUID projectId, String publishedName, String url, ClassifyImageUrlWithNoStoreOptionalParameter classifyImageUrlWithNoStoreOptionalParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(classifyImageUrlWithNoStoreWithServiceResponseAsync(projectId, publishedName, url, classifyImageUrlWithNoStoreOptionalParameter), serviceCallback); + } + + /** + * Classify an image url without saving the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param classifyImageUrlWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImagePrediction object + */ + public Observable classifyImageUrlWithNoStoreAsync(UUID projectId, String publishedName, String url, ClassifyImageUrlWithNoStoreOptionalParameter classifyImageUrlWithNoStoreOptionalParameter) { + return classifyImageUrlWithNoStoreWithServiceResponseAsync(projectId, publishedName, url, classifyImageUrlWithNoStoreOptionalParameter).map(new Func1, ImagePrediction>() { + @Override + public ImagePrediction call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Classify an image url without saving the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param classifyImageUrlWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImagePrediction object + */ + public Observable> classifyImageUrlWithNoStoreWithServiceResponseAsync(UUID projectId, String publishedName, String url, ClassifyImageUrlWithNoStoreOptionalParameter classifyImageUrlWithNoStoreOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (projectId == null) { + throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); + } + if (publishedName == null) { + throw new IllegalArgumentException("Parameter publishedName is required and cannot be null."); + } + if (this.client.apiKey() == null) { + throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); + } + if (url == null) { + throw new IllegalArgumentException("Parameter url is required and cannot be null."); + } + final String application = classifyImageUrlWithNoStoreOptionalParameter != null ? classifyImageUrlWithNoStoreOptionalParameter.application() : null; + + return classifyImageUrlWithNoStoreWithServiceResponseAsync(projectId, publishedName, url, application); + } + + /** + * Classify an image url without saving the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param application Optional. Specifies the name of application using the endpoint. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImagePrediction object + */ + public Observable> classifyImageUrlWithNoStoreWithServiceResponseAsync(UUID projectId, String publishedName, String url, String application) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (projectId == null) { + throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); + } + if (publishedName == null) { + throw new IllegalArgumentException("Parameter publishedName is required and cannot be null."); + } + if (this.client.apiKey() == null) { + throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); + } + if (url == null) { + throw new IllegalArgumentException("Parameter url is required and cannot be null."); + } + ImageUrl imageUrl = new ImageUrl(); + imageUrl.withUrl(url); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.classifyImageUrlWithNoStore(projectId, publishedName, application, this.client.apiKey(), this.client.acceptLanguage(), imageUrl, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = classifyImageUrlWithNoStoreDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse classifyImageUrlWithNoStoreDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) + .build(response); + } + + @Override + public PredictionsClassifyImageUrlWithNoStoreParameters classifyImageUrlWithNoStore() { + return new PredictionsClassifyImageUrlWithNoStoreParameters(this); + } + + /** + * Internal class implementing PredictionsClassifyImageUrlWithNoStoreDefinition. + */ + class PredictionsClassifyImageUrlWithNoStoreParameters implements PredictionsClassifyImageUrlWithNoStoreDefinition { + private PredictionsImpl parent; + private UUID projectId; + private String publishedName; + private String url; + private String application; + + /** + * Constructor. + * @param parent the parent object. + */ + PredictionsClassifyImageUrlWithNoStoreParameters(PredictionsImpl parent) { + this.parent = parent; + } + + @Override + public PredictionsClassifyImageUrlWithNoStoreParameters withProjectId(UUID projectId) { + this.projectId = projectId; + return this; + } + + @Override + public PredictionsClassifyImageUrlWithNoStoreParameters withPublishedName(String publishedName) { + this.publishedName = publishedName; + return this; + } + + @Override + public PredictionsClassifyImageUrlWithNoStoreParameters withUrl(String url) { + this.url = url; + return this; + } + + @Override + public PredictionsClassifyImageUrlWithNoStoreParameters withApplication(String application) { + this.application = application; + return this; + } + + @Override + public ImagePrediction execute() { + return classifyImageUrlWithNoStoreWithServiceResponseAsync(projectId, publishedName, url, application).toBlocking().single().body(); + } + + @Override + public Observable executeAsync() { + return classifyImageUrlWithNoStoreWithServiceResponseAsync(projectId, publishedName, url, application).map(new Func1, ImagePrediction>() { + @Override + public ImagePrediction call(ServiceResponse response) { + return response.body(); + } + }); + } + } + + + /** + * Classify an image and saves the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 4MB. + * @param classifyImageOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImagePrediction object if successful. + */ + public ImagePrediction classifyImage(UUID projectId, String publishedName, byte[] imageData, ClassifyImageOptionalParameter classifyImageOptionalParameter) { + return classifyImageWithServiceResponseAsync(projectId, publishedName, imageData, classifyImageOptionalParameter).toBlocking().single().body(); + } + + /** + * Classify an image and saves the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 4MB. + * @param classifyImageOptionalParameter the object representing the optional parameters to be set before calling this API + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture classifyImageAsync(UUID projectId, String publishedName, byte[] imageData, ClassifyImageOptionalParameter classifyImageOptionalParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(classifyImageWithServiceResponseAsync(projectId, publishedName, imageData, classifyImageOptionalParameter), serviceCallback); + } + + /** + * Classify an image and saves the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 4MB. + * @param classifyImageOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImagePrediction object + */ + public Observable classifyImageAsync(UUID projectId, String publishedName, byte[] imageData, ClassifyImageOptionalParameter classifyImageOptionalParameter) { + return classifyImageWithServiceResponseAsync(projectId, publishedName, imageData, classifyImageOptionalParameter).map(new Func1, ImagePrediction>() { + @Override + public ImagePrediction call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Classify an image and saves the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 4MB. + * @param classifyImageOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImagePrediction object + */ + public Observable> classifyImageWithServiceResponseAsync(UUID projectId, String publishedName, byte[] imageData, ClassifyImageOptionalParameter classifyImageOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (projectId == null) { + throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); + } + if (publishedName == null) { + throw new IllegalArgumentException("Parameter publishedName is required and cannot be null."); + } + if (imageData == null) { + throw new IllegalArgumentException("Parameter imageData is required and cannot be null."); + } + if (this.client.apiKey() == null) { + throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); + } + final String application = classifyImageOptionalParameter != null ? classifyImageOptionalParameter.application() : null; + + return classifyImageWithServiceResponseAsync(projectId, publishedName, imageData, application); + } + + /** + * Classify an image and saves the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 4MB. + * @param application Optional. Specifies the name of application using the endpoint. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImagePrediction object + */ + public Observable> classifyImageWithServiceResponseAsync(UUID projectId, String publishedName, byte[] imageData, String application) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (projectId == null) { + throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); + } + if (publishedName == null) { + throw new IllegalArgumentException("Parameter publishedName is required and cannot be null."); + } + if (imageData == null) { + throw new IllegalArgumentException("Parameter imageData is required and cannot be null."); + } + if (this.client.apiKey() == null) { + throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + RequestBody imageDataConverted = RequestBody.create(MediaType.parse("multipart/form-data"), imageData); + return service.classifyImage(projectId, publishedName, application, imageDataConverted, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = classifyImageDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse classifyImageDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) + .build(response); + } + + @Override + public PredictionsClassifyImageParameters classifyImage() { + return new PredictionsClassifyImageParameters(this); + } + + /** + * Internal class implementing PredictionsClassifyImageDefinition. + */ + class PredictionsClassifyImageParameters implements PredictionsClassifyImageDefinition { + private PredictionsImpl parent; + private UUID projectId; + private String publishedName; + private byte[] imageData; + private String application; + + /** + * Constructor. + * @param parent the parent object. + */ + PredictionsClassifyImageParameters(PredictionsImpl parent) { + this.parent = parent; + } + + @Override + public PredictionsClassifyImageParameters withProjectId(UUID projectId) { + this.projectId = projectId; + return this; + } + + @Override + public PredictionsClassifyImageParameters withPublishedName(String publishedName) { + this.publishedName = publishedName; + return this; + } + + @Override + public PredictionsClassifyImageParameters withImageData(byte[] imageData) { + this.imageData = imageData; + return this; + } + + @Override + public PredictionsClassifyImageParameters withApplication(String application) { + this.application = application; + return this; + } + + @Override + public ImagePrediction execute() { + return classifyImageWithServiceResponseAsync(projectId, publishedName, imageData, application).toBlocking().single().body(); + } + + @Override + public Observable executeAsync() { + return classifyImageWithServiceResponseAsync(projectId, publishedName, imageData, application).map(new Func1, ImagePrediction>() { + @Override + public ImagePrediction call(ServiceResponse response) { + return response.body(); + } + }); + } + } + + + /** + * Classify an image url and saves the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param classifyImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImagePrediction object if successful. + */ + public ImagePrediction classifyImageUrl(UUID projectId, String publishedName, String url, ClassifyImageUrlOptionalParameter classifyImageUrlOptionalParameter) { + return classifyImageUrlWithServiceResponseAsync(projectId, publishedName, url, classifyImageUrlOptionalParameter).toBlocking().single().body(); + } + + /** + * Classify an image url and saves the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param classifyImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture classifyImageUrlAsync(UUID projectId, String publishedName, String url, ClassifyImageUrlOptionalParameter classifyImageUrlOptionalParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(classifyImageUrlWithServiceResponseAsync(projectId, publishedName, url, classifyImageUrlOptionalParameter), serviceCallback); + } + + /** + * Classify an image url and saves the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param classifyImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImagePrediction object + */ + public Observable classifyImageUrlAsync(UUID projectId, String publishedName, String url, ClassifyImageUrlOptionalParameter classifyImageUrlOptionalParameter) { + return classifyImageUrlWithServiceResponseAsync(projectId, publishedName, url, classifyImageUrlOptionalParameter).map(new Func1, ImagePrediction>() { + @Override + public ImagePrediction call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Classify an image url and saves the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param classifyImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImagePrediction object + */ + public Observable> classifyImageUrlWithServiceResponseAsync(UUID projectId, String publishedName, String url, ClassifyImageUrlOptionalParameter classifyImageUrlOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (projectId == null) { + throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); + } + if (publishedName == null) { + throw new IllegalArgumentException("Parameter publishedName is required and cannot be null."); + } + if (this.client.apiKey() == null) { + throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); + } + if (url == null) { + throw new IllegalArgumentException("Parameter url is required and cannot be null."); + } + final String application = classifyImageUrlOptionalParameter != null ? classifyImageUrlOptionalParameter.application() : null; + + return classifyImageUrlWithServiceResponseAsync(projectId, publishedName, url, application); + } + + /** + * Classify an image url and saves the result. + * + * @param projectId The project id. + * @param publishedName Specifies the name of the model to evaluate against. + * @param url Url of the image. + * @param application Optional. Specifies the name of application using the endpoint. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImagePrediction object + */ + public Observable> classifyImageUrlWithServiceResponseAsync(UUID projectId, String publishedName, String url, String application) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (projectId == null) { + throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); + } + if (publishedName == null) { + throw new IllegalArgumentException("Parameter publishedName is required and cannot be null."); + } + if (this.client.apiKey() == null) { + throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); + } + if (url == null) { + throw new IllegalArgumentException("Parameter url is required and cannot be null."); + } + ImageUrl imageUrl = new ImageUrl(); + imageUrl.withUrl(url); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.classifyImageUrl(projectId, publishedName, application, this.client.apiKey(), this.client.acceptLanguage(), imageUrl, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = classifyImageUrlDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse classifyImageUrlDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) + .build(response); + } + + @Override + public PredictionsClassifyImageUrlParameters classifyImageUrl() { + return new PredictionsClassifyImageUrlParameters(this); + } + + /** + * Internal class implementing PredictionsClassifyImageUrlDefinition. + */ + class PredictionsClassifyImageUrlParameters implements PredictionsClassifyImageUrlDefinition { + private PredictionsImpl parent; + private UUID projectId; + private String publishedName; + private String url; + private String application; + + /** + * Constructor. + * @param parent the parent object. + */ + PredictionsClassifyImageUrlParameters(PredictionsImpl parent) { + this.parent = parent; + } + + @Override + public PredictionsClassifyImageUrlParameters withProjectId(UUID projectId) { + this.projectId = projectId; + return this; + } + + @Override + public PredictionsClassifyImageUrlParameters withPublishedName(String publishedName) { + this.publishedName = publishedName; + return this; + } + + @Override + public PredictionsClassifyImageUrlParameters withUrl(String url) { + this.url = url; + return this; + } + + @Override + public PredictionsClassifyImageUrlParameters withApplication(String application) { + this.application = application; return this; } @Override public ImagePrediction execute() { - return predictImageUrlWithServiceResponseAsync(projectId, iterationId, application, url).toBlocking().single().body(); + return classifyImageUrlWithServiceResponseAsync(projectId, publishedName, url, application).toBlocking().single().body(); } @Override public Observable executeAsync() { - return predictImageUrlWithServiceResponseAsync(projectId, iterationId, application, url).map(new Func1, ImagePrediction>() { + return classifyImageUrlWithServiceResponseAsync(projectId, publishedName, url, application).map(new Func1, ImagePrediction>() { @Override public ImagePrediction call(ServiceResponse response) { return response.body(); diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/package-info.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/package-info.java index b57774622496..1b58a050731e 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/package-info.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/package-info.java @@ -5,6 +5,6 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * This package contains the implementation classes for PredictionEndpoint. + * This package contains the implementation classes for CustomVisionPredictionClient. */ package com.microsoft.azure.cognitiveservices.vision.customvision.prediction.implementation; diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/BoundingBox.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/BoundingBox.java index 48cce04f1dfa..4f9ce6ec99fb 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/BoundingBox.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/BoundingBox.java @@ -11,31 +11,31 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * The BoundingBox model. + * Bounding box that defines a region of an image. */ public class BoundingBox { /** - * The left property. + * Coordinate of the left boundary. */ - @JsonProperty(value = "left") + @JsonProperty(value = "left", required = true) private double left; /** - * The top property. + * Coordinate of the top boundary. */ - @JsonProperty(value = "top") + @JsonProperty(value = "top", required = true) private double top; /** - * The width property. + * Width. */ - @JsonProperty(value = "width") + @JsonProperty(value = "width", required = true) private double width; /** - * The height property. + * Height. */ - @JsonProperty(value = "height") + @JsonProperty(value = "height", required = true) private double height; /** diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/ClassifyImageOptionalParameter.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/ClassifyImageOptionalParameter.java new file mode 100644 index 000000000000..307b1abf3c8f --- /dev/null +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/ClassifyImageOptionalParameter.java @@ -0,0 +1,66 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models; + + +/** + * The ClassifyImageOptionalParameter model. + */ +public class ClassifyImageOptionalParameter { + /** + * Optional. Specifies the name of application using the endpoint. + */ + private String application; + + /** + * Gets or sets the preferred language for the response. + */ + private String thisclientacceptLanguage; + + /** + * Get the application value. + * + * @return the application value + */ + public String application() { + return this.application; + } + + /** + * Set the application value. + * + * @param application the application value to set + * @return the ClassifyImageOptionalParameter object itself. + */ + public ClassifyImageOptionalParameter withApplication(String application) { + this.application = application; + return this; + } + + /** + * Get the thisclientacceptLanguage value. + * + * @return the thisclientacceptLanguage value + */ + public String thisclientacceptLanguage() { + return this.thisclientacceptLanguage; + } + + /** + * Set the thisclientacceptLanguage value. + * + * @param thisclientacceptLanguage the thisclientacceptLanguage value to set + * @return the ClassifyImageOptionalParameter object itself. + */ + public ClassifyImageOptionalParameter withThisclientacceptLanguage(String thisclientacceptLanguage) { + this.thisclientacceptLanguage = thisclientacceptLanguage; + return this; + } + +} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/ClassifyImageUrlOptionalParameter.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/ClassifyImageUrlOptionalParameter.java new file mode 100644 index 000000000000..6d8eb4e0c3d7 --- /dev/null +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/ClassifyImageUrlOptionalParameter.java @@ -0,0 +1,66 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models; + + +/** + * The ClassifyImageUrlOptionalParameter model. + */ +public class ClassifyImageUrlOptionalParameter { + /** + * Optional. Specifies the name of application using the endpoint. + */ + private String application; + + /** + * Gets or sets the preferred language for the response. + */ + private String thisclientacceptLanguage; + + /** + * Get the application value. + * + * @return the application value + */ + public String application() { + return this.application; + } + + /** + * Set the application value. + * + * @param application the application value to set + * @return the ClassifyImageUrlOptionalParameter object itself. + */ + public ClassifyImageUrlOptionalParameter withApplication(String application) { + this.application = application; + return this; + } + + /** + * Get the thisclientacceptLanguage value. + * + * @return the thisclientacceptLanguage value + */ + public String thisclientacceptLanguage() { + return this.thisclientacceptLanguage; + } + + /** + * Set the thisclientacceptLanguage value. + * + * @param thisclientacceptLanguage the thisclientacceptLanguage value to set + * @return the ClassifyImageUrlOptionalParameter object itself. + */ + public ClassifyImageUrlOptionalParameter withThisclientacceptLanguage(String thisclientacceptLanguage) { + this.thisclientacceptLanguage = thisclientacceptLanguage; + return this; + } + +} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/ClassifyImageUrlWithNoStoreOptionalParameter.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/ClassifyImageUrlWithNoStoreOptionalParameter.java new file mode 100644 index 000000000000..31bb767d00f2 --- /dev/null +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/ClassifyImageUrlWithNoStoreOptionalParameter.java @@ -0,0 +1,66 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models; + + +/** + * The ClassifyImageUrlWithNoStoreOptionalParameter model. + */ +public class ClassifyImageUrlWithNoStoreOptionalParameter { + /** + * Optional. Specifies the name of application using the endpoint. + */ + private String application; + + /** + * Gets or sets the preferred language for the response. + */ + private String thisclientacceptLanguage; + + /** + * Get the application value. + * + * @return the application value + */ + public String application() { + return this.application; + } + + /** + * Set the application value. + * + * @param application the application value to set + * @return the ClassifyImageUrlWithNoStoreOptionalParameter object itself. + */ + public ClassifyImageUrlWithNoStoreOptionalParameter withApplication(String application) { + this.application = application; + return this; + } + + /** + * Get the thisclientacceptLanguage value. + * + * @return the thisclientacceptLanguage value + */ + public String thisclientacceptLanguage() { + return this.thisclientacceptLanguage; + } + + /** + * Set the thisclientacceptLanguage value. + * + * @param thisclientacceptLanguage the thisclientacceptLanguage value to set + * @return the ClassifyImageUrlWithNoStoreOptionalParameter object itself. + */ + public ClassifyImageUrlWithNoStoreOptionalParameter withThisclientacceptLanguage(String thisclientacceptLanguage) { + this.thisclientacceptLanguage = thisclientacceptLanguage; + return this; + } + +} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/ClassifyImageWithNoStoreOptionalParameter.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/ClassifyImageWithNoStoreOptionalParameter.java new file mode 100644 index 000000000000..fc36ddcf7771 --- /dev/null +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/ClassifyImageWithNoStoreOptionalParameter.java @@ -0,0 +1,66 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models; + + +/** + * The ClassifyImageWithNoStoreOptionalParameter model. + */ +public class ClassifyImageWithNoStoreOptionalParameter { + /** + * Optional. Specifies the name of application using the endpoint. + */ + private String application; + + /** + * Gets or sets the preferred language for the response. + */ + private String thisclientacceptLanguage; + + /** + * Get the application value. + * + * @return the application value + */ + public String application() { + return this.application; + } + + /** + * Set the application value. + * + * @param application the application value to set + * @return the ClassifyImageWithNoStoreOptionalParameter object itself. + */ + public ClassifyImageWithNoStoreOptionalParameter withApplication(String application) { + this.application = application; + return this; + } + + /** + * Get the thisclientacceptLanguage value. + * + * @return the thisclientacceptLanguage value + */ + public String thisclientacceptLanguage() { + return this.thisclientacceptLanguage; + } + + /** + * Set the thisclientacceptLanguage value. + * + * @param thisclientacceptLanguage the thisclientacceptLanguage value to set + * @return the ClassifyImageWithNoStoreOptionalParameter object itself. + */ + public ClassifyImageWithNoStoreOptionalParameter withThisclientacceptLanguage(String thisclientacceptLanguage) { + this.thisclientacceptLanguage = thisclientacceptLanguage; + return this; + } + +} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/CustomVisionError.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/CustomVisionError.java new file mode 100644 index 000000000000..a08e32d38567 --- /dev/null +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/CustomVisionError.java @@ -0,0 +1,135 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The CustomVisionError model. + */ +public class CustomVisionError { + /** + * The error code. Possible values include: 'NoError', 'BadRequest', + * 'BadRequestExceededBatchSize', 'BadRequestNotSupported', + * 'BadRequestInvalidIds', 'BadRequestProjectName', + * 'BadRequestProjectNameNotUnique', 'BadRequestProjectDescription', + * 'BadRequestProjectUnknownDomain', + * 'BadRequestProjectUnknownClassification', + * 'BadRequestProjectUnsupportedDomainTypeChange', + * 'BadRequestProjectUnsupportedExportPlatform', 'BadRequestIterationName', + * 'BadRequestIterationNameNotUnique', 'BadRequestIterationDescription', + * 'BadRequestIterationIsNotTrained', + * 'BadRequestWorkspaceCannotBeModified', + * 'BadRequestWorkspaceNotDeletable', 'BadRequestTagName', + * 'BadRequestTagNameNotUnique', 'BadRequestTagDescription', + * 'BadRequestTagType', 'BadRequestMultipleNegativeTag', + * 'BadRequestImageTags', 'BadRequestImageRegions', + * 'BadRequestNegativeAndRegularTagOnSameImage', + * 'BadRequestRequiredParamIsNull', 'BadRequestIterationIsPublished', + * 'BadRequestInvalidPublishName', 'BadRequestInvalidPublishTarget', + * 'BadRequestUnpublishFailed', 'BadRequestSubscriptionApi', + * 'BadRequestExceedProjectLimit', + * 'BadRequestExceedIterationPerProjectLimit', + * 'BadRequestExceedTagPerProjectLimit', + * 'BadRequestExceedTagPerImageLimit', 'BadRequestExceededQuota', + * 'BadRequestCannotMigrateProjectWithName', 'BadRequestNotLimitedTrial', + * 'BadRequestImageBatch', 'BadRequestImageStream', 'BadRequestImageUrl', + * 'BadRequestImageFormat', 'BadRequestImageSizeBytes', + * 'BadRequestImageExceededCount', 'BadRequestTrainingNotNeeded', + * 'BadRequestTrainingNotNeededButTrainingPipelineUpdated', + * 'BadRequestTrainingValidationFailed', + * 'BadRequestClassificationTrainingValidationFailed', + * 'BadRequestMultiClassClassificationTrainingValidationFailed', + * 'BadRequestMultiLabelClassificationTrainingValidationFailed', + * 'BadRequestDetectionTrainingValidationFailed', + * 'BadRequestTrainingAlreadyInProgress', + * 'BadRequestDetectionTrainingNotAllowNegativeTag', + * 'BadRequestInvalidEmailAddress', + * 'BadRequestDomainNotSupportedForAdvancedTraining', + * 'BadRequestExportPlatformNotSupportedForAdvancedTraining', + * 'BadRequestReservedBudgetInHoursNotEnoughForAdvancedTraining', + * 'BadRequestExportValidationFailed', 'BadRequestExportAlreadyInProgress', + * 'BadRequestPredictionIdsMissing', + * 'BadRequestPredictionIdsExceededCount', + * 'BadRequestPredictionTagsExceededCount', + * 'BadRequestPredictionResultsExceededCount', + * 'BadRequestPredictionInvalidApplicationName', + * 'BadRequestPredictionInvalidQueryParameters', 'BadRequestInvalid', + * 'UnsupportedMediaType', 'Forbidden', 'ForbiddenUser', + * 'ForbiddenUserResource', 'ForbiddenUserSignupDisabled', + * 'ForbiddenUserSignupAllowanceExceeded', 'ForbiddenUserDoesNotExist', + * 'ForbiddenUserDisabled', 'ForbiddenUserInsufficientCapability', + * 'ForbiddenDRModeEnabled', 'ForbiddenInvalid', 'NotFound', + * 'NotFoundProject', 'NotFoundProjectDefaultIteration', + * 'NotFoundIteration', 'NotFoundIterationPerformance', 'NotFoundTag', + * 'NotFoundImage', 'NotFoundDomain', 'NotFoundApimSubscription', + * 'NotFoundInvalid', 'Conflict', 'ConflictInvalid', 'ErrorUnknown', + * 'ErrorProjectInvalidWorkspace', + * 'ErrorProjectInvalidPipelineConfiguration', 'ErrorProjectInvalidDomain', + * 'ErrorProjectTrainingRequestFailed', 'ErrorProjectExportRequestFailed', + * 'ErrorFeaturizationServiceUnavailable', + * 'ErrorFeaturizationQueueTimeout', 'ErrorFeaturizationInvalidFeaturizer', + * 'ErrorFeaturizationAugmentationUnavailable', + * 'ErrorFeaturizationUnrecognizedJob', + * 'ErrorFeaturizationAugmentationError', 'ErrorExporterInvalidPlatform', + * 'ErrorExporterInvalidFeaturizer', 'ErrorExporterInvalidClassifier', + * 'ErrorPredictionServiceUnavailable', 'ErrorPredictionModelNotFound', + * 'ErrorPredictionModelNotCached', 'ErrorPrediction', + * 'ErrorPredictionStorage', 'ErrorRegionProposal', 'ErrorInvalid'. + */ + @JsonProperty(value = "code", required = true) + private CustomVisionErrorCodes code; + + /** + * A message explaining the error reported by the service. + */ + @JsonProperty(value = "message", required = true) + private String message; + + /** + * Get the code value. + * + * @return the code value + */ + public CustomVisionErrorCodes code() { + return this.code; + } + + /** + * Set the code value. + * + * @param code the code value to set + * @return the CustomVisionError object itself. + */ + public CustomVisionError withCode(CustomVisionErrorCodes code) { + this.code = code; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the CustomVisionError object itself. + */ + public CustomVisionError withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/CustomVisionErrorCodes.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/CustomVisionErrorCodes.java new file mode 100644 index 000000000000..0cddaf7852c5 --- /dev/null +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/CustomVisionErrorCodes.java @@ -0,0 +1,371 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for CustomVisionErrorCodes. + */ +public final class CustomVisionErrorCodes extends ExpandableStringEnum { + /** Static value NoError for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes NO_ERROR = fromString("NoError"); + + /** Static value BadRequest for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST = fromString("BadRequest"); + + /** Static value BadRequestExceededBatchSize for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_EXCEEDED_BATCH_SIZE = fromString("BadRequestExceededBatchSize"); + + /** Static value BadRequestNotSupported for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_NOT_SUPPORTED = fromString("BadRequestNotSupported"); + + /** Static value BadRequestInvalidIds for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_INVALID_IDS = fromString("BadRequestInvalidIds"); + + /** Static value BadRequestProjectName for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PROJECT_NAME = fromString("BadRequestProjectName"); + + /** Static value BadRequestProjectNameNotUnique for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PROJECT_NAME_NOT_UNIQUE = fromString("BadRequestProjectNameNotUnique"); + + /** Static value BadRequestProjectDescription for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PROJECT_DESCRIPTION = fromString("BadRequestProjectDescription"); + + /** Static value BadRequestProjectUnknownDomain for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PROJECT_UNKNOWN_DOMAIN = fromString("BadRequestProjectUnknownDomain"); + + /** Static value BadRequestProjectUnknownClassification for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PROJECT_UNKNOWN_CLASSIFICATION = fromString("BadRequestProjectUnknownClassification"); + + /** Static value BadRequestProjectUnsupportedDomainTypeChange for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PROJECT_UNSUPPORTED_DOMAIN_TYPE_CHANGE = fromString("BadRequestProjectUnsupportedDomainTypeChange"); + + /** Static value BadRequestProjectUnsupportedExportPlatform for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PROJECT_UNSUPPORTED_EXPORT_PLATFORM = fromString("BadRequestProjectUnsupportedExportPlatform"); + + /** Static value BadRequestIterationName for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_ITERATION_NAME = fromString("BadRequestIterationName"); + + /** Static value BadRequestIterationNameNotUnique for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_ITERATION_NAME_NOT_UNIQUE = fromString("BadRequestIterationNameNotUnique"); + + /** Static value BadRequestIterationDescription for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_ITERATION_DESCRIPTION = fromString("BadRequestIterationDescription"); + + /** Static value BadRequestIterationIsNotTrained for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_ITERATION_IS_NOT_TRAINED = fromString("BadRequestIterationIsNotTrained"); + + /** Static value BadRequestWorkspaceCannotBeModified for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_WORKSPACE_CANNOT_BE_MODIFIED = fromString("BadRequestWorkspaceCannotBeModified"); + + /** Static value BadRequestWorkspaceNotDeletable for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_WORKSPACE_NOT_DELETABLE = fromString("BadRequestWorkspaceNotDeletable"); + + /** Static value BadRequestTagName for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_TAG_NAME = fromString("BadRequestTagName"); + + /** Static value BadRequestTagNameNotUnique for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_TAG_NAME_NOT_UNIQUE = fromString("BadRequestTagNameNotUnique"); + + /** Static value BadRequestTagDescription for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_TAG_DESCRIPTION = fromString("BadRequestTagDescription"); + + /** Static value BadRequestTagType for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_TAG_TYPE = fromString("BadRequestTagType"); + + /** Static value BadRequestMultipleNegativeTag for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_MULTIPLE_NEGATIVE_TAG = fromString("BadRequestMultipleNegativeTag"); + + /** Static value BadRequestImageTags for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_IMAGE_TAGS = fromString("BadRequestImageTags"); + + /** Static value BadRequestImageRegions for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_IMAGE_REGIONS = fromString("BadRequestImageRegions"); + + /** Static value BadRequestNegativeAndRegularTagOnSameImage for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_NEGATIVE_AND_REGULAR_TAG_ON_SAME_IMAGE = fromString("BadRequestNegativeAndRegularTagOnSameImage"); + + /** Static value BadRequestRequiredParamIsNull for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_REQUIRED_PARAM_IS_NULL = fromString("BadRequestRequiredParamIsNull"); + + /** Static value BadRequestIterationIsPublished for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_ITERATION_IS_PUBLISHED = fromString("BadRequestIterationIsPublished"); + + /** Static value BadRequestInvalidPublishName for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_INVALID_PUBLISH_NAME = fromString("BadRequestInvalidPublishName"); + + /** Static value BadRequestInvalidPublishTarget for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_INVALID_PUBLISH_TARGET = fromString("BadRequestInvalidPublishTarget"); + + /** Static value BadRequestUnpublishFailed for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_UNPUBLISH_FAILED = fromString("BadRequestUnpublishFailed"); + + /** Static value BadRequestSubscriptionApi for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_SUBSCRIPTION_API = fromString("BadRequestSubscriptionApi"); + + /** Static value BadRequestExceedProjectLimit for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_EXCEED_PROJECT_LIMIT = fromString("BadRequestExceedProjectLimit"); + + /** Static value BadRequestExceedIterationPerProjectLimit for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_EXCEED_ITERATION_PER_PROJECT_LIMIT = fromString("BadRequestExceedIterationPerProjectLimit"); + + /** Static value BadRequestExceedTagPerProjectLimit for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_EXCEED_TAG_PER_PROJECT_LIMIT = fromString("BadRequestExceedTagPerProjectLimit"); + + /** Static value BadRequestExceedTagPerImageLimit for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_EXCEED_TAG_PER_IMAGE_LIMIT = fromString("BadRequestExceedTagPerImageLimit"); + + /** Static value BadRequestExceededQuota for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_EXCEEDED_QUOTA = fromString("BadRequestExceededQuota"); + + /** Static value BadRequestCannotMigrateProjectWithName for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_CANNOT_MIGRATE_PROJECT_WITH_NAME = fromString("BadRequestCannotMigrateProjectWithName"); + + /** Static value BadRequestNotLimitedTrial for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_NOT_LIMITED_TRIAL = fromString("BadRequestNotLimitedTrial"); + + /** Static value BadRequestImageBatch for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_IMAGE_BATCH = fromString("BadRequestImageBatch"); + + /** Static value BadRequestImageStream for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_IMAGE_STREAM = fromString("BadRequestImageStream"); + + /** Static value BadRequestImageUrl for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_IMAGE_URL = fromString("BadRequestImageUrl"); + + /** Static value BadRequestImageFormat for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_IMAGE_FORMAT = fromString("BadRequestImageFormat"); + + /** Static value BadRequestImageSizeBytes for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_IMAGE_SIZE_BYTES = fromString("BadRequestImageSizeBytes"); + + /** Static value BadRequestImageExceededCount for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_IMAGE_EXCEEDED_COUNT = fromString("BadRequestImageExceededCount"); + + /** Static value BadRequestTrainingNotNeeded for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_TRAINING_NOT_NEEDED = fromString("BadRequestTrainingNotNeeded"); + + /** Static value BadRequestTrainingNotNeededButTrainingPipelineUpdated for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_TRAINING_NOT_NEEDED_BUT_TRAINING_PIPELINE_UPDATED = fromString("BadRequestTrainingNotNeededButTrainingPipelineUpdated"); + + /** Static value BadRequestTrainingValidationFailed for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_TRAINING_VALIDATION_FAILED = fromString("BadRequestTrainingValidationFailed"); + + /** Static value BadRequestClassificationTrainingValidationFailed for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_CLASSIFICATION_TRAINING_VALIDATION_FAILED = fromString("BadRequestClassificationTrainingValidationFailed"); + + /** Static value BadRequestMultiClassClassificationTrainingValidationFailed for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_MULTI_CLASS_CLASSIFICATION_TRAINING_VALIDATION_FAILED = fromString("BadRequestMultiClassClassificationTrainingValidationFailed"); + + /** Static value BadRequestMultiLabelClassificationTrainingValidationFailed for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_MULTI_LABEL_CLASSIFICATION_TRAINING_VALIDATION_FAILED = fromString("BadRequestMultiLabelClassificationTrainingValidationFailed"); + + /** Static value BadRequestDetectionTrainingValidationFailed for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_DETECTION_TRAINING_VALIDATION_FAILED = fromString("BadRequestDetectionTrainingValidationFailed"); + + /** Static value BadRequestTrainingAlreadyInProgress for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_TRAINING_ALREADY_IN_PROGRESS = fromString("BadRequestTrainingAlreadyInProgress"); + + /** Static value BadRequestDetectionTrainingNotAllowNegativeTag for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_DETECTION_TRAINING_NOT_ALLOW_NEGATIVE_TAG = fromString("BadRequestDetectionTrainingNotAllowNegativeTag"); + + /** Static value BadRequestInvalidEmailAddress for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_INVALID_EMAIL_ADDRESS = fromString("BadRequestInvalidEmailAddress"); + + /** Static value BadRequestDomainNotSupportedForAdvancedTraining for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_DOMAIN_NOT_SUPPORTED_FOR_ADVANCED_TRAINING = fromString("BadRequestDomainNotSupportedForAdvancedTraining"); + + /** Static value BadRequestExportPlatformNotSupportedForAdvancedTraining for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_EXPORT_PLATFORM_NOT_SUPPORTED_FOR_ADVANCED_TRAINING = fromString("BadRequestExportPlatformNotSupportedForAdvancedTraining"); + + /** Static value BadRequestReservedBudgetInHoursNotEnoughForAdvancedTraining for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_RESERVED_BUDGET_IN_HOURS_NOT_ENOUGH_FOR_ADVANCED_TRAINING = fromString("BadRequestReservedBudgetInHoursNotEnoughForAdvancedTraining"); + + /** Static value BadRequestExportValidationFailed for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_EXPORT_VALIDATION_FAILED = fromString("BadRequestExportValidationFailed"); + + /** Static value BadRequestExportAlreadyInProgress for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_EXPORT_ALREADY_IN_PROGRESS = fromString("BadRequestExportAlreadyInProgress"); + + /** Static value BadRequestPredictionIdsMissing for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PREDICTION_IDS_MISSING = fromString("BadRequestPredictionIdsMissing"); + + /** Static value BadRequestPredictionIdsExceededCount for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PREDICTION_IDS_EXCEEDED_COUNT = fromString("BadRequestPredictionIdsExceededCount"); + + /** Static value BadRequestPredictionTagsExceededCount for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PREDICTION_TAGS_EXCEEDED_COUNT = fromString("BadRequestPredictionTagsExceededCount"); + + /** Static value BadRequestPredictionResultsExceededCount for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PREDICTION_RESULTS_EXCEEDED_COUNT = fromString("BadRequestPredictionResultsExceededCount"); + + /** Static value BadRequestPredictionInvalidApplicationName for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PREDICTION_INVALID_APPLICATION_NAME = fromString("BadRequestPredictionInvalidApplicationName"); + + /** Static value BadRequestPredictionInvalidQueryParameters for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PREDICTION_INVALID_QUERY_PARAMETERS = fromString("BadRequestPredictionInvalidQueryParameters"); + + /** Static value BadRequestInvalid for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_INVALID = fromString("BadRequestInvalid"); + + /** Static value UnsupportedMediaType for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes UNSUPPORTED_MEDIA_TYPE = fromString("UnsupportedMediaType"); + + /** Static value Forbidden for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes FORBIDDEN = fromString("Forbidden"); + + /** Static value ForbiddenUser for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes FORBIDDEN_USER = fromString("ForbiddenUser"); + + /** Static value ForbiddenUserResource for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes FORBIDDEN_USER_RESOURCE = fromString("ForbiddenUserResource"); + + /** Static value ForbiddenUserSignupDisabled for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes FORBIDDEN_USER_SIGNUP_DISABLED = fromString("ForbiddenUserSignupDisabled"); + + /** Static value ForbiddenUserSignupAllowanceExceeded for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes FORBIDDEN_USER_SIGNUP_ALLOWANCE_EXCEEDED = fromString("ForbiddenUserSignupAllowanceExceeded"); + + /** Static value ForbiddenUserDoesNotExist for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes FORBIDDEN_USER_DOES_NOT_EXIST = fromString("ForbiddenUserDoesNotExist"); + + /** Static value ForbiddenUserDisabled for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes FORBIDDEN_USER_DISABLED = fromString("ForbiddenUserDisabled"); + + /** Static value ForbiddenUserInsufficientCapability for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes FORBIDDEN_USER_INSUFFICIENT_CAPABILITY = fromString("ForbiddenUserInsufficientCapability"); + + /** Static value ForbiddenDRModeEnabled for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes FORBIDDEN_DRMODE_ENABLED = fromString("ForbiddenDRModeEnabled"); + + /** Static value ForbiddenInvalid for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes FORBIDDEN_INVALID = fromString("ForbiddenInvalid"); + + /** Static value NotFound for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes NOT_FOUND = fromString("NotFound"); + + /** Static value NotFoundProject for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes NOT_FOUND_PROJECT = fromString("NotFoundProject"); + + /** Static value NotFoundProjectDefaultIteration for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes NOT_FOUND_PROJECT_DEFAULT_ITERATION = fromString("NotFoundProjectDefaultIteration"); + + /** Static value NotFoundIteration for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes NOT_FOUND_ITERATION = fromString("NotFoundIteration"); + + /** Static value NotFoundIterationPerformance for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes NOT_FOUND_ITERATION_PERFORMANCE = fromString("NotFoundIterationPerformance"); + + /** Static value NotFoundTag for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes NOT_FOUND_TAG = fromString("NotFoundTag"); + + /** Static value NotFoundImage for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes NOT_FOUND_IMAGE = fromString("NotFoundImage"); + + /** Static value NotFoundDomain for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes NOT_FOUND_DOMAIN = fromString("NotFoundDomain"); + + /** Static value NotFoundApimSubscription for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes NOT_FOUND_APIM_SUBSCRIPTION = fromString("NotFoundApimSubscription"); + + /** Static value NotFoundInvalid for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes NOT_FOUND_INVALID = fromString("NotFoundInvalid"); + + /** Static value Conflict for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes CONFLICT = fromString("Conflict"); + + /** Static value ConflictInvalid for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes CONFLICT_INVALID = fromString("ConflictInvalid"); + + /** Static value ErrorUnknown for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_UNKNOWN = fromString("ErrorUnknown"); + + /** Static value ErrorProjectInvalidWorkspace for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_PROJECT_INVALID_WORKSPACE = fromString("ErrorProjectInvalidWorkspace"); + + /** Static value ErrorProjectInvalidPipelineConfiguration for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_PROJECT_INVALID_PIPELINE_CONFIGURATION = fromString("ErrorProjectInvalidPipelineConfiguration"); + + /** Static value ErrorProjectInvalidDomain for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_PROJECT_INVALID_DOMAIN = fromString("ErrorProjectInvalidDomain"); + + /** Static value ErrorProjectTrainingRequestFailed for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_PROJECT_TRAINING_REQUEST_FAILED = fromString("ErrorProjectTrainingRequestFailed"); + + /** Static value ErrorProjectExportRequestFailed for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_PROJECT_EXPORT_REQUEST_FAILED = fromString("ErrorProjectExportRequestFailed"); + + /** Static value ErrorFeaturizationServiceUnavailable for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_FEATURIZATION_SERVICE_UNAVAILABLE = fromString("ErrorFeaturizationServiceUnavailable"); + + /** Static value ErrorFeaturizationQueueTimeout for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_FEATURIZATION_QUEUE_TIMEOUT = fromString("ErrorFeaturizationQueueTimeout"); + + /** Static value ErrorFeaturizationInvalidFeaturizer for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_FEATURIZATION_INVALID_FEATURIZER = fromString("ErrorFeaturizationInvalidFeaturizer"); + + /** Static value ErrorFeaturizationAugmentationUnavailable for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_FEATURIZATION_AUGMENTATION_UNAVAILABLE = fromString("ErrorFeaturizationAugmentationUnavailable"); + + /** Static value ErrorFeaturizationUnrecognizedJob for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_FEATURIZATION_UNRECOGNIZED_JOB = fromString("ErrorFeaturizationUnrecognizedJob"); + + /** Static value ErrorFeaturizationAugmentationError for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_FEATURIZATION_AUGMENTATION_ERROR = fromString("ErrorFeaturizationAugmentationError"); + + /** Static value ErrorExporterInvalidPlatform for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_EXPORTER_INVALID_PLATFORM = fromString("ErrorExporterInvalidPlatform"); + + /** Static value ErrorExporterInvalidFeaturizer for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_EXPORTER_INVALID_FEATURIZER = fromString("ErrorExporterInvalidFeaturizer"); + + /** Static value ErrorExporterInvalidClassifier for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_EXPORTER_INVALID_CLASSIFIER = fromString("ErrorExporterInvalidClassifier"); + + /** Static value ErrorPredictionServiceUnavailable for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_PREDICTION_SERVICE_UNAVAILABLE = fromString("ErrorPredictionServiceUnavailable"); + + /** Static value ErrorPredictionModelNotFound for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_PREDICTION_MODEL_NOT_FOUND = fromString("ErrorPredictionModelNotFound"); + + /** Static value ErrorPredictionModelNotCached for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_PREDICTION_MODEL_NOT_CACHED = fromString("ErrorPredictionModelNotCached"); + + /** Static value ErrorPrediction for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_PREDICTION = fromString("ErrorPrediction"); + + /** Static value ErrorPredictionStorage for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_PREDICTION_STORAGE = fromString("ErrorPredictionStorage"); + + /** Static value ErrorRegionProposal for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_REGION_PROPOSAL = fromString("ErrorRegionProposal"); + + /** Static value ErrorInvalid for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_INVALID = fromString("ErrorInvalid"); + + /** + * Creates or finds a CustomVisionErrorCodes from its string representation. + * @param name a name to look for + * @return the corresponding CustomVisionErrorCodes + */ + @JsonCreator + public static CustomVisionErrorCodes fromString(String name) { + return fromString(name, CustomVisionErrorCodes.class); + } + + /** + * @return known CustomVisionErrorCodes values + */ + public static Collection values() { + return values(CustomVisionErrorCodes.class); + } +} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/CustomVisionErrorException.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/CustomVisionErrorException.java new file mode 100644 index 000000000000..83643e572167 --- /dev/null +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/CustomVisionErrorException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with CustomVisionError information. + */ +public class CustomVisionErrorException extends RestException { + /** + * Initializes a new instance of the CustomVisionErrorException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public CustomVisionErrorException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the CustomVisionErrorException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public CustomVisionErrorException(final String message, final Response response, final CustomVisionError body) { + super(message, response, body); + } + + @Override + public CustomVisionError body() { + return (CustomVisionError) super.body(); + } +} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/DetectImageOptionalParameter.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/DetectImageOptionalParameter.java new file mode 100644 index 000000000000..d15dc04fcb34 --- /dev/null +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/DetectImageOptionalParameter.java @@ -0,0 +1,66 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models; + + +/** + * The DetectImageOptionalParameter model. + */ +public class DetectImageOptionalParameter { + /** + * Optional. Specifies the name of application using the endpoint. + */ + private String application; + + /** + * Gets or sets the preferred language for the response. + */ + private String thisclientacceptLanguage; + + /** + * Get the application value. + * + * @return the application value + */ + public String application() { + return this.application; + } + + /** + * Set the application value. + * + * @param application the application value to set + * @return the DetectImageOptionalParameter object itself. + */ + public DetectImageOptionalParameter withApplication(String application) { + this.application = application; + return this; + } + + /** + * Get the thisclientacceptLanguage value. + * + * @return the thisclientacceptLanguage value + */ + public String thisclientacceptLanguage() { + return this.thisclientacceptLanguage; + } + + /** + * Set the thisclientacceptLanguage value. + * + * @param thisclientacceptLanguage the thisclientacceptLanguage value to set + * @return the DetectImageOptionalParameter object itself. + */ + public DetectImageOptionalParameter withThisclientacceptLanguage(String thisclientacceptLanguage) { + this.thisclientacceptLanguage = thisclientacceptLanguage; + return this; + } + +} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/DetectImageUrlOptionalParameter.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/DetectImageUrlOptionalParameter.java new file mode 100644 index 000000000000..1a8e114ed794 --- /dev/null +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/DetectImageUrlOptionalParameter.java @@ -0,0 +1,66 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models; + + +/** + * The DetectImageUrlOptionalParameter model. + */ +public class DetectImageUrlOptionalParameter { + /** + * Optional. Specifies the name of application using the endpoint. + */ + private String application; + + /** + * Gets or sets the preferred language for the response. + */ + private String thisclientacceptLanguage; + + /** + * Get the application value. + * + * @return the application value + */ + public String application() { + return this.application; + } + + /** + * Set the application value. + * + * @param application the application value to set + * @return the DetectImageUrlOptionalParameter object itself. + */ + public DetectImageUrlOptionalParameter withApplication(String application) { + this.application = application; + return this; + } + + /** + * Get the thisclientacceptLanguage value. + * + * @return the thisclientacceptLanguage value + */ + public String thisclientacceptLanguage() { + return this.thisclientacceptLanguage; + } + + /** + * Set the thisclientacceptLanguage value. + * + * @param thisclientacceptLanguage the thisclientacceptLanguage value to set + * @return the DetectImageUrlOptionalParameter object itself. + */ + public DetectImageUrlOptionalParameter withThisclientacceptLanguage(String thisclientacceptLanguage) { + this.thisclientacceptLanguage = thisclientacceptLanguage; + return this; + } + +} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/DetectImageUrlWithNoStoreOptionalParameter.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/DetectImageUrlWithNoStoreOptionalParameter.java new file mode 100644 index 000000000000..32dccff93851 --- /dev/null +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/DetectImageUrlWithNoStoreOptionalParameter.java @@ -0,0 +1,66 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models; + + +/** + * The DetectImageUrlWithNoStoreOptionalParameter model. + */ +public class DetectImageUrlWithNoStoreOptionalParameter { + /** + * Optional. Specifies the name of application using the endpoint. + */ + private String application; + + /** + * Gets or sets the preferred language for the response. + */ + private String thisclientacceptLanguage; + + /** + * Get the application value. + * + * @return the application value + */ + public String application() { + return this.application; + } + + /** + * Set the application value. + * + * @param application the application value to set + * @return the DetectImageUrlWithNoStoreOptionalParameter object itself. + */ + public DetectImageUrlWithNoStoreOptionalParameter withApplication(String application) { + this.application = application; + return this; + } + + /** + * Get the thisclientacceptLanguage value. + * + * @return the thisclientacceptLanguage value + */ + public String thisclientacceptLanguage() { + return this.thisclientacceptLanguage; + } + + /** + * Set the thisclientacceptLanguage value. + * + * @param thisclientacceptLanguage the thisclientacceptLanguage value to set + * @return the DetectImageUrlWithNoStoreOptionalParameter object itself. + */ + public DetectImageUrlWithNoStoreOptionalParameter withThisclientacceptLanguage(String thisclientacceptLanguage) { + this.thisclientacceptLanguage = thisclientacceptLanguage; + return this; + } + +} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/DetectImageWithNoStoreOptionalParameter.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/DetectImageWithNoStoreOptionalParameter.java new file mode 100644 index 000000000000..5ef5ce2657ff --- /dev/null +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/DetectImageWithNoStoreOptionalParameter.java @@ -0,0 +1,66 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models; + + +/** + * The DetectImageWithNoStoreOptionalParameter model. + */ +public class DetectImageWithNoStoreOptionalParameter { + /** + * Optional. Specifies the name of application using the endpoint. + */ + private String application; + + /** + * Gets or sets the preferred language for the response. + */ + private String thisclientacceptLanguage; + + /** + * Get the application value. + * + * @return the application value + */ + public String application() { + return this.application; + } + + /** + * Set the application value. + * + * @param application the application value to set + * @return the DetectImageWithNoStoreOptionalParameter object itself. + */ + public DetectImageWithNoStoreOptionalParameter withApplication(String application) { + this.application = application; + return this; + } + + /** + * Get the thisclientacceptLanguage value. + * + * @return the thisclientacceptLanguage value + */ + public String thisclientacceptLanguage() { + return this.thisclientacceptLanguage; + } + + /** + * Set the thisclientacceptLanguage value. + * + * @param thisclientacceptLanguage the thisclientacceptLanguage value to set + * @return the DetectImageWithNoStoreOptionalParameter object itself. + */ + public DetectImageWithNoStoreOptionalParameter withThisclientacceptLanguage(String thisclientacceptLanguage) { + this.thisclientacceptLanguage = thisclientacceptLanguage; + return this; + } + +} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/ImagePrediction.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/ImagePrediction.java index 728d0f28c449..bccb9a66ae8c 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/ImagePrediction.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/ImagePrediction.java @@ -14,35 +14,35 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * The ImagePrediction model. + * Result of an image prediction request. */ public class ImagePrediction { /** - * The id property. + * Prediction Id. */ @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) private UUID id; /** - * The project property. + * Project Id. */ @JsonProperty(value = "project", access = JsonProperty.Access.WRITE_ONLY) private UUID project; /** - * The iteration property. + * Iteration Id. */ @JsonProperty(value = "iteration", access = JsonProperty.Access.WRITE_ONLY) private UUID iteration; /** - * The created property. + * Date this prediction was created. */ @JsonProperty(value = "created", access = JsonProperty.Access.WRITE_ONLY) private DateTime created; /** - * The predictions property. + * List of predictions. */ @JsonProperty(value = "predictions", access = JsonProperty.Access.WRITE_ONLY) private List predictions; diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/ImageUrl.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/ImageUrl.java index 079b6e21446e..9a62db2a994b 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/ImageUrl.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/ImageUrl.java @@ -11,13 +11,13 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * The ImageUrl model. + * Image url. */ public class ImageUrl { /** - * The url property. + * Url of the image. */ - @JsonProperty(value = "url") + @JsonProperty(value = "url", required = true) private String url; /** diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/PredictImageOptionalParameter.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/PredictImageOptionalParameter.java deleted file mode 100644 index 168100eb079f..000000000000 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/PredictImageOptionalParameter.java +++ /dev/null @@ -1,94 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - */ - -package com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models; - -import java.util.UUID; - -/** - * The PredictImageOptionalParameter model. - */ -public class PredictImageOptionalParameter { - /** - * Optional. Specifies the id of a particular iteration to evaluate - * against. - * The default iteration for the project will be used when not specified. - */ - private UUID iterationId; - - /** - * Optional. Specifies the name of application using the endpoint. - */ - private String application; - - /** - * Gets or sets the preferred language for the response. - */ - private String thisclientacceptLanguage; - - /** - * Get the iterationId value. - * - * @return the iterationId value - */ - public UUID iterationId() { - return this.iterationId; - } - - /** - * Set the iterationId value. - * - * @param iterationId the iterationId value to set - * @return the PredictImageOptionalParameter object itself. - */ - public PredictImageOptionalParameter withIterationId(UUID iterationId) { - this.iterationId = iterationId; - return this; - } - - /** - * Get the application value. - * - * @return the application value - */ - public String application() { - return this.application; - } - - /** - * Set the application value. - * - * @param application the application value to set - * @return the PredictImageOptionalParameter object itself. - */ - public PredictImageOptionalParameter withApplication(String application) { - this.application = application; - return this; - } - - /** - * Get the thisclientacceptLanguage value. - * - * @return the thisclientacceptLanguage value - */ - public String thisclientacceptLanguage() { - return this.thisclientacceptLanguage; - } - - /** - * Set the thisclientacceptLanguage value. - * - * @param thisclientacceptLanguage the thisclientacceptLanguage value to set - * @return the PredictImageOptionalParameter object itself. - */ - public PredictImageOptionalParameter withThisclientacceptLanguage(String thisclientacceptLanguage) { - this.thisclientacceptLanguage = thisclientacceptLanguage; - return this; - } - -} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/PredictImageUrlOptionalParameter.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/PredictImageUrlOptionalParameter.java deleted file mode 100644 index f43803123183..000000000000 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/PredictImageUrlOptionalParameter.java +++ /dev/null @@ -1,119 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - */ - -package com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models; - -import java.util.UUID; - -/** - * The PredictImageUrlOptionalParameter model. - */ -public class PredictImageUrlOptionalParameter { - /** - * Optional. Specifies the id of a particular iteration to evaluate - * against. - * The default iteration for the project will be used when not specified. - */ - private UUID iterationId; - - /** - * Optional. Specifies the name of application using the endpoint. - */ - private String application; - - /** - * The url property. - */ - private String url; - - /** - * Gets or sets the preferred language for the response. - */ - private String thisclientacceptLanguage; - - /** - * Get the iterationId value. - * - * @return the iterationId value - */ - public UUID iterationId() { - return this.iterationId; - } - - /** - * Set the iterationId value. - * - * @param iterationId the iterationId value to set - * @return the PredictImageUrlOptionalParameter object itself. - */ - public PredictImageUrlOptionalParameter withIterationId(UUID iterationId) { - this.iterationId = iterationId; - return this; - } - - /** - * Get the application value. - * - * @return the application value - */ - public String application() { - return this.application; - } - - /** - * Set the application value. - * - * @param application the application value to set - * @return the PredictImageUrlOptionalParameter object itself. - */ - public PredictImageUrlOptionalParameter withApplication(String application) { - this.application = application; - return this; - } - - /** - * Get the url value. - * - * @return the url value - */ - public String url() { - return this.url; - } - - /** - * Set the url value. - * - * @param url the url value to set - * @return the PredictImageUrlOptionalParameter object itself. - */ - public PredictImageUrlOptionalParameter withUrl(String url) { - this.url = url; - return this; - } - - /** - * Get the thisclientacceptLanguage value. - * - * @return the thisclientacceptLanguage value - */ - public String thisclientacceptLanguage() { - return this.thisclientacceptLanguage; - } - - /** - * Set the thisclientacceptLanguage value. - * - * @param thisclientacceptLanguage the thisclientacceptLanguage value to set - * @return the PredictImageUrlOptionalParameter object itself. - */ - public PredictImageUrlOptionalParameter withThisclientacceptLanguage(String thisclientacceptLanguage) { - this.thisclientacceptLanguage = thisclientacceptLanguage; - return this; - } - -} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/PredictImageUrlWithNoStoreOptionalParameter.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/PredictImageUrlWithNoStoreOptionalParameter.java deleted file mode 100644 index 9a9bf26f8407..000000000000 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/PredictImageUrlWithNoStoreOptionalParameter.java +++ /dev/null @@ -1,119 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - */ - -package com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models; - -import java.util.UUID; - -/** - * The PredictImageUrlWithNoStoreOptionalParameter model. - */ -public class PredictImageUrlWithNoStoreOptionalParameter { - /** - * Optional. Specifies the id of a particular iteration to evaluate - * against. - * The default iteration for the project will be used when not specified. - */ - private UUID iterationId; - - /** - * Optional. Specifies the name of application using the endpoint. - */ - private String application; - - /** - * The url property. - */ - private String url; - - /** - * Gets or sets the preferred language for the response. - */ - private String thisclientacceptLanguage; - - /** - * Get the iterationId value. - * - * @return the iterationId value - */ - public UUID iterationId() { - return this.iterationId; - } - - /** - * Set the iterationId value. - * - * @param iterationId the iterationId value to set - * @return the PredictImageUrlWithNoStoreOptionalParameter object itself. - */ - public PredictImageUrlWithNoStoreOptionalParameter withIterationId(UUID iterationId) { - this.iterationId = iterationId; - return this; - } - - /** - * Get the application value. - * - * @return the application value - */ - public String application() { - return this.application; - } - - /** - * Set the application value. - * - * @param application the application value to set - * @return the PredictImageUrlWithNoStoreOptionalParameter object itself. - */ - public PredictImageUrlWithNoStoreOptionalParameter withApplication(String application) { - this.application = application; - return this; - } - - /** - * Get the url value. - * - * @return the url value - */ - public String url() { - return this.url; - } - - /** - * Set the url value. - * - * @param url the url value to set - * @return the PredictImageUrlWithNoStoreOptionalParameter object itself. - */ - public PredictImageUrlWithNoStoreOptionalParameter withUrl(String url) { - this.url = url; - return this; - } - - /** - * Get the thisclientacceptLanguage value. - * - * @return the thisclientacceptLanguage value - */ - public String thisclientacceptLanguage() { - return this.thisclientacceptLanguage; - } - - /** - * Set the thisclientacceptLanguage value. - * - * @param thisclientacceptLanguage the thisclientacceptLanguage value to set - * @return the PredictImageUrlWithNoStoreOptionalParameter object itself. - */ - public PredictImageUrlWithNoStoreOptionalParameter withThisclientacceptLanguage(String thisclientacceptLanguage) { - this.thisclientacceptLanguage = thisclientacceptLanguage; - return this; - } - -} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/PredictImageWithNoStoreOptionalParameter.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/PredictImageWithNoStoreOptionalParameter.java deleted file mode 100644 index e5235494089b..000000000000 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/PredictImageWithNoStoreOptionalParameter.java +++ /dev/null @@ -1,94 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - */ - -package com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models; - -import java.util.UUID; - -/** - * The PredictImageWithNoStoreOptionalParameter model. - */ -public class PredictImageWithNoStoreOptionalParameter { - /** - * Optional. Specifies the id of a particular iteration to evaluate - * against. - * The default iteration for the project will be used when not specified. - */ - private UUID iterationId; - - /** - * Optional. Specifies the name of application using the endpoint. - */ - private String application; - - /** - * Gets or sets the preferred language for the response. - */ - private String thisclientacceptLanguage; - - /** - * Get the iterationId value. - * - * @return the iterationId value - */ - public UUID iterationId() { - return this.iterationId; - } - - /** - * Set the iterationId value. - * - * @param iterationId the iterationId value to set - * @return the PredictImageWithNoStoreOptionalParameter object itself. - */ - public PredictImageWithNoStoreOptionalParameter withIterationId(UUID iterationId) { - this.iterationId = iterationId; - return this; - } - - /** - * Get the application value. - * - * @return the application value - */ - public String application() { - return this.application; - } - - /** - * Set the application value. - * - * @param application the application value to set - * @return the PredictImageWithNoStoreOptionalParameter object itself. - */ - public PredictImageWithNoStoreOptionalParameter withApplication(String application) { - this.application = application; - return this; - } - - /** - * Get the thisclientacceptLanguage value. - * - * @return the thisclientacceptLanguage value - */ - public String thisclientacceptLanguage() { - return this.thisclientacceptLanguage; - } - - /** - * Set the thisclientacceptLanguage value. - * - * @param thisclientacceptLanguage the thisclientacceptLanguage value to set - * @return the PredictImageWithNoStoreOptionalParameter object itself. - */ - public PredictImageWithNoStoreOptionalParameter withThisclientacceptLanguage(String thisclientacceptLanguage) { - this.thisclientacceptLanguage = thisclientacceptLanguage; - return this; - } - -} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/Prediction.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/Prediction.java index 1735949fc348..2deada193085 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/Prediction.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/Prediction.java @@ -12,29 +12,29 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * The Prediction model. + * Prediction result. */ public class Prediction { /** - * The probability property. + * Probability of the tag. */ @JsonProperty(value = "probability", access = JsonProperty.Access.WRITE_ONLY) private double probability; /** - * The tagId property. + * Id of the predicted tag. */ @JsonProperty(value = "tagId", access = JsonProperty.Access.WRITE_ONLY) private UUID tagId; /** - * The tagName property. + * Name of the predicted tag. */ @JsonProperty(value = "tagName", access = JsonProperty.Access.WRITE_ONLY) private String tagName; /** - * The boundingBox property. + * Bounding box of the prediction. */ @JsonProperty(value = "boundingBox", access = JsonProperty.Access.WRITE_ONLY) private BoundingBox boundingBox; diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/package-info.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/package-info.java index 3a76c984fb2a..fa3b8487472b 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/package-info.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/models/package-info.java @@ -5,6 +5,6 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * This package contains the models classes for PredictionEndpoint. + * This package contains the models classes for CustomVisionPredictionClient. */ package com.microsoft.azure.cognitiveservices.vision.customvision.prediction.models; diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/package-info.java b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/package-info.java index b44683ce86ed..f90bebdd2fef 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/package-info.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/package-info.java @@ -5,6 +5,6 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * This package contains the classes for PredictionEndpoint. + * This package contains the classes for CustomVisionPredictionClient. */ package com.microsoft.azure.cognitiveservices.vision.customvision.prediction; diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/pom.xml b/sdk/cognitiveservices/ms-azure-cs-customvision-training/pom.xml index 491e94891644..215fa1de5555 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/pom.xml +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/pom.xml @@ -7,14 +7,14 @@ --> 4.0.0 - - com.microsoft.azure.cognitiveservices - azure-cognitiveservices-parent - 1.0.2 - ../pom.xml - + + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml + azure-cognitiveservices-customvision-training - 1.0.2-beta + 1.1.0-preview.2 jar Microsoft Azure SDK for Cognitive Service Custom Vision Training This package contains Microsoft Cognitive Service Custom Vision Training SDK. @@ -88,4 +88,4 @@
- \ No newline at end of file + diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/CustomVisionTrainingClient.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/CustomVisionTrainingClient.java new file mode 100644 index 000000000000..8471c0482dde --- /dev/null +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/CustomVisionTrainingClient.java @@ -0,0 +1,119 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.customvision.training; + +import com.microsoft.azure.AzureClient; +import com.microsoft.rest.RestClient; + +/** + * The interface for CustomVisionTrainingClient class. + */ +public interface CustomVisionTrainingClient { + /** + * Gets the REST client. + * + * @return the {@link RestClient} object. + */ + RestClient restClient(); + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + AzureClient getAzureClient(); + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + String userAgent(); + + /** + * Gets API key.. + * + * @return the apiKey value. + */ + String apiKey(); + + /** + * Sets API key.. + * + * @param apiKey the apiKey value. + * @return the service client itself + */ + CustomVisionTrainingClient withApiKey(String apiKey); + + /** + * Gets Supported Cognitive Services endpoints.. + * + * @return the endpoint value. + */ + String endpoint(); + + /** + * Sets Supported Cognitive Services endpoints.. + * + * @param endpoint the endpoint value. + * @return the service client itself + */ + CustomVisionTrainingClient withEndpoint(String endpoint); + + /** + * Gets Gets or sets the preferred language for the response.. + * + * @return the acceptLanguage value. + */ + String acceptLanguage(); + + /** + * Sets Gets or sets the preferred language for the response.. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + CustomVisionTrainingClient withAcceptLanguage(String acceptLanguage); + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. + * + * @return the longRunningOperationRetryTimeout value. + */ + int longRunningOperationRetryTimeout(); + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + CustomVisionTrainingClient withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. + * + * @return the generateClientRequestId value. + */ + boolean generateClientRequestId(); + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + CustomVisionTrainingClient withGenerateClientRequestId(boolean generateClientRequestId); + + /** + * Gets the Trainings object to access its operations. + * @return the Trainings object. + */ + Trainings trainings(); + +} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/CustomVisionTrainingManager.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/CustomVisionTrainingManager.java index 89b9f5daca58..c641c165b8e8 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/CustomVisionTrainingManager.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/CustomVisionTrainingManager.java @@ -6,7 +6,7 @@ package com.microsoft.azure.cognitiveservices.vision.customvision.training; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.implementation.TrainingApiImpl; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.implementation.CustomVisionTrainingClientImpl; import com.microsoft.rest.RestClient; import com.microsoft.rest.credentials.ServiceClientCredentials; import okhttp3.OkHttpClient; @@ -21,7 +21,7 @@ public class CustomVisionTrainingManager { * @param apiKey the Custom Vision Training API key * @return the Computer Vision Training API client */ - public static TrainingApi authenticate(String apiKey) { + public static CustomVisionTrainingClient authenticate(String apiKey) { return authenticate("https://southcentralus.api.cognitive.microsoft.com/customvision/v2.1/Training/", apiKey); } @@ -32,7 +32,7 @@ public static TrainingApi authenticate(String apiKey) { * @param apiKey the Custom Vision Training API key * @return the Custom Vision Training API client */ - public static TrainingApi authenticate(String baseUrl, final String apiKey) { + public static CustomVisionTrainingClient authenticate(String baseUrl, final String apiKey) { ServiceClientCredentials serviceClientCredentials = new ServiceClientCredentials() { @Override public void applyCredentialsFilter(OkHttpClient.Builder builder) { @@ -48,7 +48,7 @@ public void applyCredentialsFilter(OkHttpClient.Builder builder) { * @param apiKey the Custom Vision Training API key * @return the Computer Vision Training API client */ - public static TrainingApi authenticate(ServiceClientCredentials credentials, final String apiKey) { + public static CustomVisionTrainingClient authenticate(ServiceClientCredentials credentials, final String apiKey) { return authenticate("https://southcentralus.api.cognitive.microsoft.com/customvision/v2.1/Training/", credentials, apiKey); } @@ -60,8 +60,8 @@ public static TrainingApi authenticate(ServiceClientCredentials credentials, fin * @param apiKey the Custom Vision Training API key * @return the Custom Vision Training API client */ - public static TrainingApi authenticate(String baseUrl, ServiceClientCredentials credentials, final String apiKey) { - return new TrainingApiImpl(baseUrl, credentials).withApiKey(apiKey); + public static CustomVisionTrainingClient authenticate(String baseUrl, ServiceClientCredentials credentials, final String apiKey) { + return new CustomVisionTrainingClientImpl(baseUrl, credentials).withApiKey(apiKey); } /** @@ -71,7 +71,7 @@ public static TrainingApi authenticate(String baseUrl, ServiceClientCredentials * @param apiKey the Custom Vision Training API key * @return the Custom Vision Training API client */ - public static TrainingApi authenticate(RestClient restClient, final String apiKey) { - return new TrainingApiImpl(restClient).withApiKey(apiKey); + public static CustomVisionTrainingClient authenticate(RestClient restClient, final String apiKey) { + return new CustomVisionTrainingClientImpl(restClient).withApiKey(apiKey); } } diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/TrainingApi.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/TrainingApi.java deleted file mode 100644 index 9e411daf1695..000000000000 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/TrainingApi.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - */ - -package com.microsoft.azure.cognitiveservices.vision.customvision.training; - -import com.microsoft.azure.AzureClient; -import com.microsoft.rest.RestClient; - -/** - * The interface for TrainingApi class. - */ -public interface TrainingApi { - /** - * Gets the REST client. - * - * @return the {@link RestClient} object. - */ - RestClient restClient(); - - /** - * Gets the {@link AzureClient} used for long running operations. - * @return the azure client; - */ - AzureClient getAzureClient(); - - /** - * Gets the User-Agent header for the client. - * - * @return the user agent string. - */ - String userAgent(); - - /** - * Gets . - * - * @return the apiKey value. - */ - String apiKey(); - - /** - * Sets . - * - * @param apiKey the apiKey value. - * @return the service client itself - */ - TrainingApi withApiKey(String apiKey); - - /** - * Gets Gets or sets the preferred language for the response.. - * - * @return the acceptLanguage value. - */ - String acceptLanguage(); - - /** - * Sets Gets or sets the preferred language for the response.. - * - * @param acceptLanguage the acceptLanguage value. - * @return the service client itself - */ - TrainingApi withAcceptLanguage(String acceptLanguage); - - /** - * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. - * - * @return the longRunningOperationRetryTimeout value. - */ - int longRunningOperationRetryTimeout(); - - /** - * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.. - * - * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. - * @return the service client itself - */ - TrainingApi withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout); - - /** - * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. - * - * @return the generateClientRequestId value. - */ - boolean generateClientRequestId(); - - /** - * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.. - * - * @param generateClientRequestId the generateClientRequestId value. - * @return the service client itself - */ - TrainingApi withGenerateClientRequestId(boolean generateClientRequestId); - - /** - * Gets the Trainings object to access its operations. - * @return the Trainings object. - */ - Trainings trainings(); - -} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/Trainings.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/Trainings.java index 0e05ac114c5a..820b347f01fe 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/Trainings.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/Trainings.java @@ -8,27 +8,25 @@ package com.microsoft.azure.cognitiveservices.vision.customvision.training; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.CreateImageRegionsOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.CreateImageTagsOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.CreateImagesFromDataOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.CreateProjectOptionalParameter; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.CreateTagOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetTagsOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetTagOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.CustomVisionErrorException; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.Domain; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.Export; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.ExportIterationOptionalParameter; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetImagePerformanceCountOptionalParameter; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetImagePerformancesOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetIterationPerformanceOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.CreateProjectOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.QuickTestImageOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.QuickTestImageUrlOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.CreateImageRegionsOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.CreateImageTagsOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.CreateImagesFromDataOptionalParameter; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetImagesByIdsOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetUntaggedImageCountOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetIterationPerformanceOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetTagOptionalParameter; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetTaggedImageCountOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetUntaggedImagesOptionalParameter; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetTaggedImagesOptionalParameter; -import com.microsoft.azure.CloudException; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.Domain; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.Export; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetTagsOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetUntaggedImageCountOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetUntaggedImagesOptionalParameter; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.Image; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.ImageCreateSummary; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.ImageFileCreateBatch; @@ -46,10 +44,14 @@ import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.PredictionQueryResult; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.PredictionQueryToken; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.Project; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.QuickTestImageOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.QuickTestImageUrlOptionalParameter; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.Tag; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.TrainProjectOptionalParameter; +import rx.Observable; + import java.util.List; import java.util.UUID; -import rx.Observable; /** * An instance of this class provides access to all the operations defined @@ -63,11 +65,10 @@ public interface Trainings { * @param name The tag name. * @param createTagOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the Tag object if successful. */ - @Deprecated Tag createTag(UUID projectId, String name, CreateTagOptionalParameter createTagOptionalParameter); /** @@ -79,7 +80,6 @@ public interface Trainings { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the Tag object */ - @Deprecated Observable createTagAsync(UUID projectId, String name, CreateTagOptionalParameter createTagOptionalParameter); /** @@ -127,6 +127,13 @@ interface WithAllOptions { */ TrainingsCreateTagDefinitionStages.WithExecute withDescription(String description); + /** + * Optional type for the tag. Possible values include: 'Regular', 'Negative'. + * + * @return next definition stage + */ + TrainingsCreateTagDefinitionStages.WithExecute withType(String type); + } /** @@ -164,11 +171,10 @@ interface TrainingsCreateTagDefinition extends * @param projectId The project id. * @param getTagsOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the List<Tag> object if successful. */ - @Deprecated List getTags(UUID projectId, GetTagsOptionalParameter getTagsOptionalParameter); /** @@ -179,7 +185,6 @@ interface TrainingsCreateTagDefinition extends * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<Tag> object */ - @Deprecated Observable> getTagsAsync(UUID projectId, GetTagsOptionalParameter getTagsOptionalParameter); /** @@ -254,7 +259,7 @@ interface TrainingsGetTagsDefinition extends * @param tagId The id of the target tag. * @param updatedTag The updated tag model. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the Tag object if successful. */ @@ -279,7 +284,7 @@ interface TrainingsGetTagsDefinition extends * @param projectId The project id. * @param tagId Id of the tag to be deleted. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ void deleteTag(UUID projectId, UUID tagId); @@ -302,11 +307,10 @@ interface TrainingsGetTagsDefinition extends * @param tagId The tag id. * @param getTagOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the Tag object if successful. */ - @Deprecated Tag getTag(UUID projectId, UUID tagId, GetTagOptionalParameter getTagOptionalParameter); /** @@ -318,7 +322,6 @@ interface TrainingsGetTagsDefinition extends * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the Tag object */ - @Deprecated Observable getTagAsync(UUID projectId, UUID tagId, GetTagOptionalParameter getTagOptionalParameter); /** @@ -402,15 +405,13 @@ interface TrainingsGetTagDefinition extends * * @param projectId The project id. * @param iterationId The iteration id. - * @param platform The target platform (coreml or tensorflow). Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', - * 'ONNX'. + * @param platform The target platform. Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', 'ONNX', 'VAIDK'. * @param exportIterationOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the Export object if successful. */ - @Deprecated Export exportIteration(UUID projectId, UUID iterationId, String platform, ExportIterationOptionalParameter exportIterationOptionalParameter); /** @@ -418,13 +419,11 @@ interface TrainingsGetTagDefinition extends * * @param projectId The project id. * @param iterationId The iteration id. - * @param platform The target platform (coreml or tensorflow). Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', - * 'ONNX'. + * @param platform The target platform. Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', 'ONNX', 'VAIDK'. * @param exportIterationOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the Export object */ - @Deprecated Observable exportIterationAsync(UUID projectId, UUID iterationId, String platform, ExportIterationOptionalParameter exportIterationOptionalParameter); /** @@ -465,8 +464,7 @@ interface WithIterationId { */ interface WithPlatform { /** - * The target platform (coreml or tensorflow). Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', - * 'ONNX'. + * The target platform. Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', 'ONNX', 'VAIDK'. * * @return next definition stage */ @@ -478,8 +476,7 @@ interface WithPlatform { */ interface WithAllOptions { /** - * The flavor of the target platform (Windows, Linux, ARM, or GPU). Possible values include: 'Linux', - * 'Windows'. + * The flavor of the target platform. Possible values include: 'Linux', 'Windows', 'ONNX10', 'ONNX12', 'ARM'. * * @return next definition stage */ @@ -524,7 +521,7 @@ interface TrainingsExportIterationDefinition extends * @param projectId The project id. * @param iterationId The iteration id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the List<Export> object if successful. */ @@ -541,52 +538,185 @@ interface TrainingsExportIterationDefinition extends Observable> getExportsAsync(UUID projectId, UUID iterationId); + /** - * Gets the number of images tagged with the provided {tagIds} that have prediction results from - * training for the provided iteration {iterationId}. - * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and - * "Cat" tags, then only images tagged with Dog and/or Cat will be returned. + * Unpublish a specific iteration. * * @param projectId The project id. - * @param iterationId The iteration id. Defaults to workspace. - * @param getImagePerformanceCountOptionalParameter the object representing the optional parameters to be set before calling this API + * @param iterationId The iteration id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the int object if successful. */ - @Deprecated - int getImagePerformanceCount(UUID projectId, UUID iterationId, GetImagePerformanceCountOptionalParameter getImagePerformanceCountOptionalParameter); + void unpublishIteration(UUID projectId, UUID iterationId); /** - * Gets the number of images tagged with the provided {tagIds} that have prediction results from - * training for the provided iteration {iterationId}. - * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and - * "Cat" tags, then only images tagged with Dog and/or Cat will be returned. + * Unpublish a specific iteration. * * @param projectId The project id. - * @param iterationId The iteration id. Defaults to workspace. - * @param getImagePerformanceCountOptionalParameter the object representing the optional parameters to be set before calling this API + * @param iterationId The iteration id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the int object + * @return a representation of the deferred computation of this call if successful. */ - @Deprecated - Observable getImagePerformanceCountAsync(UUID projectId, UUID iterationId, GetImagePerformanceCountOptionalParameter getImagePerformanceCountOptionalParameter); + Observable unpublishIterationAsync(UUID projectId, UUID iterationId); + + /** - * Gets the number of images tagged with the provided {tagIds} that have prediction results from - * training for the provided iteration {iterationId}. - * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and - * "Cat" tags, then only images tagged with Dog and/or Cat will be returned. + * Publish a specific iteration. * - * @return the first stage of the getImagePerformanceCount call + * @param projectId The project id. + * @param iterationId The iteration id. + * @param publishName The name to give the published iteration. + * @param predictionId The id of the prediction resource to publish to. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the boolean object if successful. */ - TrainingsGetImagePerformanceCountDefinitionStages.WithProjectId getImagePerformanceCount(); + boolean publishIteration(UUID projectId, UUID iterationId, String publishName, String predictionId); /** - * Grouping of getImagePerformanceCount definition stages. + * Publish a specific iteration. + * + * @param projectId The project id. + * @param iterationId The iteration id. + * @param publishName The name to give the published iteration. + * @param predictionId The id of the prediction resource to publish to. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the boolean object */ - interface TrainingsGetImagePerformanceCountDefinitionStages { + Observable publishIterationAsync(UUID projectId, UUID iterationId, String publishName, String predictionId); + + + + /** + * Update a specific iteration. + * + * @param projectId Project id. + * @param iterationId Iteration id. + * @param name Gets or sets the name of the iteration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Iteration object if successful. + */ + Iteration updateIteration(UUID projectId, UUID iterationId, String name); + + /** + * Update a specific iteration. + * + * @param projectId Project id. + * @param iterationId Iteration id. + * @param name Gets or sets the name of the iteration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Iteration object + */ + Observable updateIterationAsync(UUID projectId, UUID iterationId, String name); + + + + /** + * Delete a specific iteration of a project. + * + * @param projectId The project id. + * @param iterationId The iteration id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void deleteIteration(UUID projectId, UUID iterationId); + + /** + * Delete a specific iteration of a project. + * + * @param projectId The project id. + * @param iterationId The iteration id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return a representation of the deferred computation of this call if successful. + */ + Observable deleteIterationAsync(UUID projectId, UUID iterationId); + + + + /** + * Get a specific iteration. + * + * @param projectId The id of the project the iteration belongs to. + * @param iterationId The id of the iteration to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Iteration object if successful. + */ + Iteration getIteration(UUID projectId, UUID iterationId); + + /** + * Get a specific iteration. + * + * @param projectId The id of the project the iteration belongs to. + * @param iterationId The id of the iteration to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Iteration object + */ + Observable getIterationAsync(UUID projectId, UUID iterationId); + + + + /** + * Get iterations for the project. + * + * @param projectId The project id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<Iteration> object if successful. + */ + List getIterations(UUID projectId); + + /** + * Get iterations for the project. + * + * @param projectId The project id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<Iteration> object + */ + Observable> getIterationsAsync(UUID projectId); + + + /** + * Queues project for training. + * + * @param projectId The project id. + * @param trainProjectOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Iteration object if successful. + */ + Iteration trainProject(UUID projectId, TrainProjectOptionalParameter trainProjectOptionalParameter); + + /** + * Queues project for training. + * + * @param projectId The project id. + * @param trainProjectOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Iteration object + */ + Observable trainProjectAsync(UUID projectId, TrainProjectOptionalParameter trainProjectOptionalParameter); + + /** + * Queues project for training. + * + * @return the first stage of the trainProject call + */ + TrainingsTrainProjectDefinitionStages.WithProjectId trainProject(); + + /** + * Grouping of trainProject definition stages. + */ + interface TrainingsTrainProjectDefinitionStages { /** * The stage of the definition to be specify projectId. */ @@ -596,135 +726,182 @@ interface WithProjectId { * * @return next definition stage */ - WithIterationId withProjectId(UUID projectId); + TrainingsTrainProjectDefinitionStages.WithExecute withProjectId(UUID projectId); } + /** - * The stage of the definition to be specify iterationId. + * The stage of the definition which allows for any other optional settings to be specified. */ - interface WithIterationId { + interface WithAllOptions { /** - * The iteration id. Defaults to workspace. + * The type of training to use to train the project (default: Regular). Possible values include: 'Regular', + * 'Advanced'. * * @return next definition stage */ - TrainingsGetImagePerformanceCountDefinitionStages.WithExecute withIterationId(UUID iterationId); - } + TrainingsTrainProjectDefinitionStages.WithExecute withTrainingType(String trainingType); - /** - * The stage of the definition which allows for any other optional settings to be specified. - */ - interface WithAllOptions { /** - * A list of tags ids to filter the images to count. Defaults to all tags when null. + * The number of hours reserved as budget for training (if applicable). + * + * @return next definition stage + */ + TrainingsTrainProjectDefinitionStages.WithExecute withReservedBudgetInHours(Integer reservedBudgetInHours); + + /** + * Whether to force train even if dataset and configuration does not change (default: false). + * + * @return next definition stage + */ + TrainingsTrainProjectDefinitionStages.WithExecute withForceTrain(Boolean forceTrain); + + /** + * The email address to send notification to when training finishes (default: null). * * @return next definition stage */ - TrainingsGetImagePerformanceCountDefinitionStages.WithExecute withTagIds(List tagIds); + TrainingsTrainProjectDefinitionStages.WithExecute withNotificationEmailAddress(String notificationEmailAddress); } /** * The last stage of the definition which will make the operation call. */ - interface WithExecute extends TrainingsGetImagePerformanceCountDefinitionStages.WithAllOptions { + interface WithExecute extends TrainingsTrainProjectDefinitionStages.WithAllOptions { /** * Execute the request. * - * @return the int object if successful. + * @return the Iteration object if successful. */ - int execute(); + Iteration execute(); /** * Execute the request asynchronously. * - * @return the observable to the int object + * @return the observable to the Iteration object */ - Observable executeAsync(); + Observable executeAsync(); } } /** - * The entirety of getImagePerformanceCount definition. + * The entirety of trainProject definition. */ - interface TrainingsGetImagePerformanceCountDefinition extends - TrainingsGetImagePerformanceCountDefinitionStages.WithProjectId, - TrainingsGetImagePerformanceCountDefinitionStages.WithIterationId, - TrainingsGetImagePerformanceCountDefinitionStages.WithExecute { + interface TrainingsTrainProjectDefinition extends + TrainingsTrainProjectDefinitionStages.WithProjectId, + TrainingsTrainProjectDefinitionStages.WithExecute { } + /** - * Get image with its prediction for a given project iteration. - * This API supports batching and range selection. By default it will only return first 50 images matching - * images. - * Use the {take} and {skip} parameters to control how many images to return in a given batch. - * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and - * "Cat" tags, then only images tagged with Dog and/or Cat will be returned. + * Update a specific project. * - * @param projectId The project id. - * @param iterationId The iteration id. Defaults to workspace. - * @param getImagePerformancesOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The id of the project to update. + * @param updatedProject The updated project model. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the List<ImagePerformance> object if successful. + * @return the Project object if successful. */ - @Deprecated - List getImagePerformances(UUID projectId, UUID iterationId, GetImagePerformancesOptionalParameter getImagePerformancesOptionalParameter); + Project updateProject(UUID projectId, Project updatedProject); /** - * Get image with its prediction for a given project iteration. - * This API supports batching and range selection. By default it will only return first 50 images matching - * images. - * Use the {take} and {skip} parameters to control how many images to return in a given batch. - * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and - * "Cat" tags, then only images tagged with Dog and/or Cat will be returned. + * Update a specific project. * - * @param projectId The project id. - * @param iterationId The iteration id. Defaults to workspace. - * @param getImagePerformancesOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The id of the project to update. + * @param updatedProject The updated project model. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<ImagePerformance> object + * @return the observable to the Project object */ - @Deprecated - Observable> getImagePerformancesAsync(UUID projectId, UUID iterationId, GetImagePerformancesOptionalParameter getImagePerformancesOptionalParameter); + Observable updateProjectAsync(UUID projectId, Project updatedProject); + + /** - * Get image with its prediction for a given project iteration. - * This API supports batching and range selection. By default it will only return first 50 images matching - * images. - * Use the {take} and {skip} parameters to control how many images to return in a given batch. - * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and - * "Cat" tags, then only images tagged with Dog and/or Cat will be returned. + * Delete a specific project. * - * @return the first stage of the getImagePerformances call + * @param projectId The project id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ - TrainingsGetImagePerformancesDefinitionStages.WithProjectId getImagePerformances(); + void deleteProject(UUID projectId); /** - * Grouping of getImagePerformances definition stages. + * Delete a specific project. + * + * @param projectId The project id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return a representation of the deferred computation of this call if successful. */ - interface TrainingsGetImagePerformancesDefinitionStages { - /** - * The stage of the definition to be specify projectId. - */ - interface WithProjectId { - /** - * The project id. - * - * @return next definition stage - */ - WithIterationId withProjectId(UUID projectId); - } + Observable deleteProjectAsync(UUID projectId); + + + + /** + * Get a specific project. + * + * @param projectId The id of the project to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Project object if successful. + */ + Project getProject(UUID projectId); + + /** + * Get a specific project. + * + * @param projectId The id of the project to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Project object + */ + Observable getProjectAsync(UUID projectId); + + + /** + * Create a project. + * + * @param name Name of the project. + * @param createProjectOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Project object if successful. + */ + Project createProject(String name, CreateProjectOptionalParameter createProjectOptionalParameter); + + /** + * Create a project. + * + * @param name Name of the project. + * @param createProjectOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Project object + */ + Observable createProjectAsync(String name, CreateProjectOptionalParameter createProjectOptionalParameter); + + /** + * Create a project. + * + * @return the first stage of the createProject call + */ + TrainingsCreateProjectDefinitionStages.WithName createProject(); + + /** + * Grouping of createProject definition stages. + */ + interface TrainingsCreateProjectDefinitionStages { /** - * The stage of the definition to be specify iterationId. + * The stage of the definition to be specify name. */ - interface WithIterationId { + interface WithName { /** - * The iteration id. Defaults to workspace. + * Name of the project. * * @return next definition stage */ - TrainingsGetImagePerformancesDefinitionStages.WithExecute withIterationId(UUID iterationId); + TrainingsCreateProjectDefinitionStages.WithExecute withName(String name); } /** @@ -732,107 +909,133 @@ interface WithIterationId { */ interface WithAllOptions { /** - * A list of tags ids to filter the images. Defaults to all tagged images when null. Limited to 20. + * The description of the project. * * @return next definition stage */ - TrainingsGetImagePerformancesDefinitionStages.WithExecute withTagIds(List tagIds); + TrainingsCreateProjectDefinitionStages.WithExecute withDescription(String description); /** - * The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest'. + * The id of the domain to use for this project. Defaults to General. * * @return next definition stage */ - TrainingsGetImagePerformancesDefinitionStages.WithExecute withOrderBy(String orderBy); + TrainingsCreateProjectDefinitionStages.WithExecute withDomainId(UUID domainId); /** - * Maximum number of images to return. Defaults to 50, limited to 256. + * The type of classifier to create for this project. Possible values include: 'Multiclass', 'Multilabel'. * * @return next definition stage */ - TrainingsGetImagePerformancesDefinitionStages.WithExecute withTake(Integer take); + TrainingsCreateProjectDefinitionStages.WithExecute withClassificationType(String classificationType); /** - * Number of images to skip before beginning the image batch. Defaults to 0. + * List of platforms the trained model is intending exporting to. * * @return next definition stage */ - TrainingsGetImagePerformancesDefinitionStages.WithExecute withSkip(Integer skip); + TrainingsCreateProjectDefinitionStages.WithExecute withTargetExportPlatforms(List targetExportPlatforms); } /** * The last stage of the definition which will make the operation call. */ - interface WithExecute extends TrainingsGetImagePerformancesDefinitionStages.WithAllOptions { + interface WithExecute extends TrainingsCreateProjectDefinitionStages.WithAllOptions { /** * Execute the request. * - * @return the List<ImagePerformance> object if successful. + * @return the Project object if successful. */ - List execute(); + Project execute(); /** * Execute the request asynchronously. * - * @return the observable to the List<ImagePerformance> object + * @return the observable to the Project object */ - Observable> executeAsync(); + Observable executeAsync(); } } /** - * The entirety of getImagePerformances definition. + * The entirety of createProject definition. */ - interface TrainingsGetImagePerformancesDefinition extends - TrainingsGetImagePerformancesDefinitionStages.WithProjectId, - TrainingsGetImagePerformancesDefinitionStages.WithIterationId, - TrainingsGetImagePerformancesDefinitionStages.WithExecute { + interface TrainingsCreateProjectDefinition extends + TrainingsCreateProjectDefinitionStages.WithName, + TrainingsCreateProjectDefinitionStages.WithExecute { } + /** - * Get detailed performance information about an iteration. + * Get your projects. * - * @param projectId The id of the project the iteration belongs to. - * @param iterationId The id of the iteration to get. - * @param getIterationPerformanceOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the IterationPerformance object if successful. + * @return the List<Project> object if successful. */ - @Deprecated - IterationPerformance getIterationPerformance(UUID projectId, UUID iterationId, GetIterationPerformanceOptionalParameter getIterationPerformanceOptionalParameter); + List getProjects(); /** - * Get detailed performance information about an iteration. + * Get your projects. * - * @param projectId The id of the project the iteration belongs to. - * @param iterationId The id of the iteration to get. - * @param getIterationPerformanceOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the IterationPerformance object + * @return the observable to the List<Project> object */ - @Deprecated - Observable getIterationPerformanceAsync(UUID projectId, UUID iterationId, GetIterationPerformanceOptionalParameter getIterationPerformanceOptionalParameter); + Observable> getProjectsAsync(); + /** - * Get detailed performance information about an iteration. + * Gets the number of images tagged with the provided {tagIds} that have prediction results from + * training for the provided iteration {iterationId}. + * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + * "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @return the first stage of the getIterationPerformance call + * @param projectId The project id. + * @param iterationId The iteration id. Defaults to workspace. + * @param getImagePerformanceCountOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the int object if successful. */ - TrainingsGetIterationPerformanceDefinitionStages.WithProjectId getIterationPerformance(); + int getImagePerformanceCount(UUID projectId, UUID iterationId, GetImagePerformanceCountOptionalParameter getImagePerformanceCountOptionalParameter); /** - * Grouping of getIterationPerformance definition stages. + * Gets the number of images tagged with the provided {tagIds} that have prediction results from + * training for the provided iteration {iterationId}. + * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + * "Cat" tags, then only images tagged with Dog and/or Cat will be returned. + * + * @param projectId The project id. + * @param iterationId The iteration id. Defaults to workspace. + * @param getImagePerformanceCountOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the int object */ - interface TrainingsGetIterationPerformanceDefinitionStages { + Observable getImagePerformanceCountAsync(UUID projectId, UUID iterationId, GetImagePerformanceCountOptionalParameter getImagePerformanceCountOptionalParameter); + + /** + * Gets the number of images tagged with the provided {tagIds} that have prediction results from + * training for the provided iteration {iterationId}. + * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + * "Cat" tags, then only images tagged with Dog and/or Cat will be returned. + * + * @return the first stage of the getImagePerformanceCount call + */ + TrainingsGetImagePerformanceCountDefinitionStages.WithProjectId getImagePerformanceCount(); + + /** + * Grouping of getImagePerformanceCount definition stages. + */ + interface TrainingsGetImagePerformanceCountDefinitionStages { /** * The stage of the definition to be specify projectId. */ interface WithProjectId { /** - * The id of the project the iteration belongs to. + * The project id. * * @return next definition stage */ @@ -843,11 +1046,11 @@ interface WithProjectId { */ interface WithIterationId { /** - * The id of the iteration to get. + * The iteration id. Defaults to workspace. * * @return next definition stage */ - TrainingsGetIterationPerformanceDefinitionStages.WithExecute withIterationId(UUID iterationId); + TrainingsGetImagePerformanceCountDefinitionStages.WithExecute withIterationId(UUID iterationId); } /** @@ -855,380 +1058,332 @@ interface WithIterationId { */ interface WithAllOptions { /** - * The threshold used to determine true predictions. - * - * @return next definition stage - */ - TrainingsGetIterationPerformanceDefinitionStages.WithExecute withThreshold(Double threshold); - - /** - * If applicable, the bounding box overlap threshold used to determine true predictions. + * A list of tags ids to filter the images to count. Defaults to all tags when null. * * @return next definition stage */ - TrainingsGetIterationPerformanceDefinitionStages.WithExecute withOverlapThreshold(Double overlapThreshold); + TrainingsGetImagePerformanceCountDefinitionStages.WithExecute withTagIds(List tagIds); } /** * The last stage of the definition which will make the operation call. */ - interface WithExecute extends TrainingsGetIterationPerformanceDefinitionStages.WithAllOptions { + interface WithExecute extends TrainingsGetImagePerformanceCountDefinitionStages.WithAllOptions { /** * Execute the request. * - * @return the IterationPerformance object if successful. + * @return the int object if successful. */ - IterationPerformance execute(); + int execute(); /** * Execute the request asynchronously. * - * @return the observable to the IterationPerformance object + * @return the observable to the int object */ - Observable executeAsync(); + Observable executeAsync(); } } /** - * The entirety of getIterationPerformance definition. + * The entirety of getImagePerformanceCount definition. */ - interface TrainingsGetIterationPerformanceDefinition extends - TrainingsGetIterationPerformanceDefinitionStages.WithProjectId, - TrainingsGetIterationPerformanceDefinitionStages.WithIterationId, - TrainingsGetIterationPerformanceDefinitionStages.WithExecute { + interface TrainingsGetImagePerformanceCountDefinition extends + TrainingsGetImagePerformanceCountDefinitionStages.WithProjectId, + TrainingsGetImagePerformanceCountDefinitionStages.WithIterationId, + TrainingsGetImagePerformanceCountDefinitionStages.WithExecute { } - /** - * Update a specific iteration. + * Get image with its prediction for a given project iteration. + * This API supports batching and range selection. By default it will only return first 50 images matching + * images. + * Use the {take} and {skip} parameters to control how many images to return in a given batch. + * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + * "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @param projectId Project id. - * @param iterationId Iteration id. - * @param updatedIteration The updated iteration model. + * @param projectId The project id. + * @param iterationId The iteration id. Defaults to workspace. + * @param getImagePerformancesOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the Iteration object if successful. + * @return the List<ImagePerformance> object if successful. */ - Iteration updateIteration(UUID projectId, UUID iterationId, Iteration updatedIteration); + List getImagePerformances(UUID projectId, UUID iterationId, GetImagePerformancesOptionalParameter getImagePerformancesOptionalParameter); /** - * Update a specific iteration. + * Get image with its prediction for a given project iteration. + * This API supports batching and range selection. By default it will only return first 50 images matching + * images. + * Use the {take} and {skip} parameters to control how many images to return in a given batch. + * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + * "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @param projectId Project id. - * @param iterationId Iteration id. - * @param updatedIteration The updated iteration model. + * @param projectId The project id. + * @param iterationId The iteration id. Defaults to workspace. + * @param getImagePerformancesOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Iteration object + * @return the observable to the List<ImagePerformance> object */ - Observable updateIterationAsync(UUID projectId, UUID iterationId, Iteration updatedIteration); - - + Observable> getImagePerformancesAsync(UUID projectId, UUID iterationId, GetImagePerformancesOptionalParameter getImagePerformancesOptionalParameter); /** - * Delete a specific iteration of a project. - * - * @param projectId The project id. - * @param iterationId The iteration id. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - */ - void deleteIteration(UUID projectId, UUID iterationId); - - /** - * Delete a specific iteration of a project. - * - * @param projectId The project id. - * @param iterationId The iteration id. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return a representation of the deferred computation of this call if successful. - */ - Observable deleteIterationAsync(UUID projectId, UUID iterationId); - - - - /** - * Get a specific iteration. - * - * @param projectId The id of the project the iteration belongs to. - * @param iterationId The id of the iteration to get. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the Iteration object if successful. - */ - Iteration getIteration(UUID projectId, UUID iterationId); - - /** - * Get a specific iteration. - * - * @param projectId The id of the project the iteration belongs to. - * @param iterationId The id of the iteration to get. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Iteration object - */ - Observable getIterationAsync(UUID projectId, UUID iterationId); - - - - /** - * Get iterations for the project. - * - * @param projectId The project id. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the List<Iteration> object if successful. - */ - List getIterations(UUID projectId); - - /** - * Get iterations for the project. - * - * @param projectId The project id. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<Iteration> object - */ - Observable> getIterationsAsync(UUID projectId); - - - - /** - * Update a specific project. + * Get image with its prediction for a given project iteration. + * This API supports batching and range selection. By default it will only return first 50 images matching + * images. + * Use the {take} and {skip} parameters to control how many images to return in a given batch. + * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + * "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @param projectId The id of the project to update. - * @param updatedProject The updated project model. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the Project object if successful. + * @return the first stage of the getImagePerformances call */ - Project updateProject(UUID projectId, Project updatedProject); + TrainingsGetImagePerformancesDefinitionStages.WithProjectId getImagePerformances(); /** - * Update a specific project. - * - * @param projectId The id of the project to update. - * @param updatedProject The updated project model. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Project object + * Grouping of getImagePerformances definition stages. */ - Observable updateProjectAsync(UUID projectId, Project updatedProject); + interface TrainingsGetImagePerformancesDefinitionStages { + /** + * The stage of the definition to be specify projectId. + */ + interface WithProjectId { + /** + * The project id. + * + * @return next definition stage + */ + WithIterationId withProjectId(UUID projectId); + } + /** + * The stage of the definition to be specify iterationId. + */ + interface WithIterationId { + /** + * The iteration id. Defaults to workspace. + * + * @return next definition stage + */ + TrainingsGetImagePerformancesDefinitionStages.WithExecute withIterationId(UUID iterationId); + } + /** + * The stage of the definition which allows for any other optional settings to be specified. + */ + interface WithAllOptions { + /** + * A list of tags ids to filter the images. Defaults to all tagged images when null. Limited to 20. + * + * @return next definition stage + */ + TrainingsGetImagePerformancesDefinitionStages.WithExecute withTagIds(List tagIds); + /** + * The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest'. + * + * @return next definition stage + */ + TrainingsGetImagePerformancesDefinitionStages.WithExecute withOrderBy(String orderBy); - /** - * Delete a specific project. - * - * @param projectId The project id. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - */ - void deleteProject(UUID projectId); + /** + * Maximum number of images to return. Defaults to 50, limited to 256. + * + * @return next definition stage + */ + TrainingsGetImagePerformancesDefinitionStages.WithExecute withTake(Integer take); - /** - * Delete a specific project. - * - * @param projectId The project id. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return a representation of the deferred computation of this call if successful. - */ - Observable deleteProjectAsync(UUID projectId); + /** + * Number of images to skip before beginning the image batch. Defaults to 0. + * + * @return next definition stage + */ + TrainingsGetImagePerformancesDefinitionStages.WithExecute withSkip(Integer skip); + } + /** + * The last stage of the definition which will make the operation call. + */ + interface WithExecute extends TrainingsGetImagePerformancesDefinitionStages.WithAllOptions { + /** + * Execute the request. + * + * @return the List<ImagePerformance> object if successful. + */ + List execute(); - /** - * Get a specific project. - * - * @param projectId The id of the project to get. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the Project object if successful. - */ - Project getProject(UUID projectId); + /** + * Execute the request asynchronously. + * + * @return the observable to the List<ImagePerformance> object + */ + Observable> executeAsync(); + } + } /** - * Get a specific project. - * - * @param projectId The id of the project to get. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Project object + * The entirety of getImagePerformances definition. */ - Observable getProjectAsync(UUID projectId); - + interface TrainingsGetImagePerformancesDefinition extends + TrainingsGetImagePerformancesDefinitionStages.WithProjectId, + TrainingsGetImagePerformancesDefinitionStages.WithIterationId, + TrainingsGetImagePerformancesDefinitionStages.WithExecute { + } /** - * Create a project. + * Get detailed performance information about an iteration. * - * @param name Name of the project. - * @param createProjectOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The id of the project the iteration belongs to. + * @param iterationId The id of the iteration to get. + * @param getIterationPerformanceOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the Project object if successful. + * @return the IterationPerformance object if successful. */ - @Deprecated - Project createProject(String name, CreateProjectOptionalParameter createProjectOptionalParameter); + IterationPerformance getIterationPerformance(UUID projectId, UUID iterationId, GetIterationPerformanceOptionalParameter getIterationPerformanceOptionalParameter); /** - * Create a project. + * Get detailed performance information about an iteration. * - * @param name Name of the project. - * @param createProjectOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The id of the project the iteration belongs to. + * @param iterationId The id of the iteration to get. + * @param getIterationPerformanceOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Project object + * @return the observable to the IterationPerformance object */ - @Deprecated - Observable createProjectAsync(String name, CreateProjectOptionalParameter createProjectOptionalParameter); + Observable getIterationPerformanceAsync(UUID projectId, UUID iterationId, GetIterationPerformanceOptionalParameter getIterationPerformanceOptionalParameter); /** - * Create a project. + * Get detailed performance information about an iteration. * - * @return the first stage of the createProject call + * @return the first stage of the getIterationPerformance call */ - TrainingsCreateProjectDefinitionStages.WithName createProject(); + TrainingsGetIterationPerformanceDefinitionStages.WithProjectId getIterationPerformance(); /** - * Grouping of createProject definition stages. + * Grouping of getIterationPerformance definition stages. */ - interface TrainingsCreateProjectDefinitionStages { + interface TrainingsGetIterationPerformanceDefinitionStages { /** - * The stage of the definition to be specify name. + * The stage of the definition to be specify projectId. */ - interface WithName { + interface WithProjectId { /** - * Name of the project. + * The id of the project the iteration belongs to. * * @return next definition stage */ - TrainingsCreateProjectDefinitionStages.WithExecute withName(String name); + WithIterationId withProjectId(UUID projectId); } - /** - * The stage of the definition which allows for any other optional settings to be specified. + * The stage of the definition to be specify iterationId. */ - interface WithAllOptions { + interface WithIterationId { /** - * The description of the project. + * The id of the iteration to get. * * @return next definition stage */ - TrainingsCreateProjectDefinitionStages.WithExecute withDescription(String description); + TrainingsGetIterationPerformanceDefinitionStages.WithExecute withIterationId(UUID iterationId); + } + /** + * The stage of the definition which allows for any other optional settings to be specified. + */ + interface WithAllOptions { /** - * The id of the domain to use for this project. Defaults to General. + * The threshold used to determine true predictions. * * @return next definition stage */ - TrainingsCreateProjectDefinitionStages.WithExecute withDomainId(UUID domainId); + TrainingsGetIterationPerformanceDefinitionStages.WithExecute withThreshold(Double threshold); /** - * The type of classifier to create for this project. Possible values include: 'Multiclass', 'Multilabel'. + * If applicable, the bounding box overlap threshold used to determine true predictions. * * @return next definition stage */ - TrainingsCreateProjectDefinitionStages.WithExecute withClassificationType(String classificationType); + TrainingsGetIterationPerformanceDefinitionStages.WithExecute withOverlapThreshold(Double overlapThreshold); } /** * The last stage of the definition which will make the operation call. */ - interface WithExecute extends TrainingsCreateProjectDefinitionStages.WithAllOptions { + interface WithExecute extends TrainingsGetIterationPerformanceDefinitionStages.WithAllOptions { /** * Execute the request. * - * @return the Project object if successful. + * @return the IterationPerformance object if successful. */ - Project execute(); + IterationPerformance execute(); /** * Execute the request asynchronously. * - * @return the observable to the Project object + * @return the observable to the IterationPerformance object */ - Observable executeAsync(); + Observable executeAsync(); } } /** - * The entirety of createProject definition. + * The entirety of getIterationPerformance definition. */ - interface TrainingsCreateProjectDefinition extends - TrainingsCreateProjectDefinitionStages.WithName, - TrainingsCreateProjectDefinitionStages.WithExecute { + interface TrainingsGetIterationPerformanceDefinition extends + TrainingsGetIterationPerformanceDefinitionStages.WithProjectId, + TrainingsGetIterationPerformanceDefinitionStages.WithIterationId, + TrainingsGetIterationPerformanceDefinitionStages.WithExecute { } /** - * Get your projects. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the List<Project> object if successful. - */ - List getProjects(); - - /** - * Get your projects. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<Project> object - */ - Observable> getProjectsAsync(); - - - - /** - * Queues project for training. + * Get images that were sent to your prediction endpoint. * * @param projectId The project id. + * @param query Parameters used to query the predictions. Limited to combining 2 tags. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the Iteration object if successful. + * @return the PredictionQueryResult object if successful. */ - Iteration trainProject(UUID projectId); + PredictionQueryResult queryPredictions(UUID projectId, PredictionQueryToken query); /** - * Queues project for training. + * Get images that were sent to your prediction endpoint. * * @param projectId The project id. + * @param query Parameters used to query the predictions. Limited to combining 2 tags. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Iteration object + * @return the observable to the PredictionQueryResult object */ - Observable trainProjectAsync(UUID projectId); + Observable queryPredictionsAsync(UUID projectId, PredictionQueryToken query); /** * Quick test an image. * * @param projectId The project id. - * @param imageData the InputStream value. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB. * @param quickTestImageOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ImagePrediction object if successful. */ - @Deprecated ImagePrediction quickTestImage(UUID projectId, byte[] imageData, QuickTestImageOptionalParameter quickTestImageOptionalParameter); /** * Quick test an image. * * @param projectId The project id. - * @param imageData the InputStream value. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB. * @param quickTestImageOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object */ - @Deprecated Observable quickTestImageAsync(UUID projectId, byte[] imageData, QuickTestImageOptionalParameter quickTestImageOptionalParameter); /** @@ -1258,7 +1413,7 @@ interface WithProjectId { */ interface WithImageData { /** - * + * Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB. * * @return next definition stage */ @@ -1312,25 +1467,25 @@ interface TrainingsQuickTestImageDefinition extends * Quick test an image url. * * @param projectId The project to evaluate against. + * @param url Url of the image. * @param quickTestImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ImagePrediction object if successful. */ - @Deprecated - ImagePrediction quickTestImageUrl(UUID projectId, QuickTestImageUrlOptionalParameter quickTestImageUrlOptionalParameter); + ImagePrediction quickTestImageUrl(UUID projectId, String url, QuickTestImageUrlOptionalParameter quickTestImageUrlOptionalParameter); /** * Quick test an image url. * * @param projectId The project to evaluate against. + * @param url Url of the image. * @param quickTestImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object */ - @Deprecated - Observable quickTestImageUrlAsync(UUID projectId, QuickTestImageUrlOptionalParameter quickTestImageUrlOptionalParameter); + Observable quickTestImageUrlAsync(UUID projectId, String url, QuickTestImageUrlOptionalParameter quickTestImageUrlOptionalParameter); /** * Quick test an image url. @@ -1352,7 +1507,18 @@ interface WithProjectId { * * @return next definition stage */ - TrainingsQuickTestImageUrlDefinitionStages.WithExecute withProjectId(UUID projectId); + WithUrl withProjectId(UUID projectId); + } + /** + * The stage of the definition to be specify url. + */ + interface WithUrl { + /** + * Url of the image. + * + * @return next definition stage + */ + TrainingsQuickTestImageUrlDefinitionStages.WithExecute withUrl(String url); } /** @@ -1367,13 +1533,6 @@ interface WithAllOptions { */ TrainingsQuickTestImageUrlDefinitionStages.WithExecute withIterationId(UUID iterationId); - /** - * - * - * @return next definition stage - */ - TrainingsQuickTestImageUrlDefinitionStages.WithExecute withUrl(String url); - } /** @@ -1401,44 +1560,21 @@ interface WithExecute extends TrainingsQuickTestImageUrlDefinitionStages.WithAll */ interface TrainingsQuickTestImageUrlDefinition extends TrainingsQuickTestImageUrlDefinitionStages.WithProjectId, + TrainingsQuickTestImageUrlDefinitionStages.WithUrl, TrainingsQuickTestImageUrlDefinitionStages.WithExecute { } - /** - * Get images that were sent to your prediction endpoint. - * - * @param projectId The project id. - * @param query Parameters used to query the predictions. Limited to combining 2 tags. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PredictionQueryResult object if successful. - */ - PredictionQueryResult queryPredictions(UUID projectId, PredictionQueryToken query); - - /** - * Get images that were sent to your prediction endpoint. - * - * @param projectId The project id. - * @param query Parameters used to query the predictions. Limited to combining 2 tags. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PredictionQueryResult object - */ - Observable queryPredictionsAsync(UUID projectId, PredictionQueryToken query); - - - /** * Delete a set of predicted images and their associated prediction results. * * @param projectId The project id. * @param ids The prediction ids. Limited to 64. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ - void deletePrediction(UUID projectId, List ids); + void deletePrediction(UUID projectId, List ids); /** * Delete a set of predicted images and their associated prediction results. @@ -1448,7 +1584,7 @@ interface TrainingsQuickTestImageUrlDefinition extends * @throws IllegalArgumentException thrown if parameters fail the validation * @return a representation of the deferred computation of this call if successful. */ - Observable deletePredictionAsync(UUID projectId, List ids); + Observable deletePredictionAsync(UUID projectId, List ids); @@ -1460,7 +1596,7 @@ interface TrainingsQuickTestImageUrlDefinition extends * @param projectId The project id. * @param imageId The image id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ImageRegionProposal object if successful. */ @@ -1481,71 +1617,259 @@ interface TrainingsQuickTestImageUrlDefinition extends /** - * Delete a set of image regions. + * Add the specified predicted images to the set of training images. + * This API creates a batch of images from predicted images specified. There is a limit of 64 images + * and 20 tags. * * @param projectId The project id. - * @param regionIds Regions to delete. Limited to 64. + * @param batch Image and tag ids. Limited to 64 images and 20 tags per batch. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImageCreateSummary object if successful. */ - void deleteImageRegions(UUID projectId, List regionIds); + ImageCreateSummary createImagesFromPredictions(UUID projectId, ImageIdCreateBatch batch); /** - * Delete a set of image regions. + * Add the specified predicted images to the set of training images. + * This API creates a batch of images from predicted images specified. There is a limit of 64 images + * and 20 tags. * * @param projectId The project id. - * @param regionIds Regions to delete. Limited to 64. + * @param batch Image and tag ids. Limited to 64 images and 20 tags per batch. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImageCreateSummary object + */ + Observable createImagesFromPredictionsAsync(UUID projectId, ImageIdCreateBatch batch); + + + + /** + * Add the provided images urls to the set of training images. + * This API accepts a batch of urls, and optionally tags, to create images. There is a limit of 64 + * images and 20 tags. + * + * @param projectId The project id. + * @param batch Image urls and tag ids. Limited to 64 images and 20 tags per batch. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImageCreateSummary object if successful. + */ + ImageCreateSummary createImagesFromUrls(UUID projectId, ImageUrlCreateBatch batch); + + /** + * Add the provided images urls to the set of training images. + * This API accepts a batch of urls, and optionally tags, to create images. There is a limit of 64 + * images and 20 tags. + * + * @param projectId The project id. + * @param batch Image urls and tag ids. Limited to 64 images and 20 tags per batch. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImageCreateSummary object + */ + Observable createImagesFromUrlsAsync(UUID projectId, ImageUrlCreateBatch batch); + + + + /** + * Add the provided batch of images to the set of training images. + * This API accepts a batch of files, and optionally tags, to create images. There is a limit of 64 + * images and 20 tags. + * + * @param projectId The project id. + * @param batch The batch of image files to add. Limited to 64 images and 20 tags per batch. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImageCreateSummary object if successful. + */ + ImageCreateSummary createImagesFromFiles(UUID projectId, ImageFileCreateBatch batch); + + /** + * Add the provided batch of images to the set of training images. + * This API accepts a batch of files, and optionally tags, to create images. There is a limit of 64 + * images and 20 tags. + * + * @param projectId The project id. + * @param batch The batch of image files to add. Limited to 64 images and 20 tags per batch. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImageCreateSummary object + */ + Observable createImagesFromFilesAsync(UUID projectId, ImageFileCreateBatch batch); + + + + /** + * Delete images from the set of training images. + * + * @param projectId The project id. + * @param imageIds Ids of the images to be deleted. Limited to 256 images per batch. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + void deleteImages(UUID projectId, List imageIds); + + /** + * Delete images from the set of training images. + * + * @param projectId The project id. + * @param imageIds Ids of the images to be deleted. Limited to 256 images per batch. * @throws IllegalArgumentException thrown if parameters fail the validation * @return a representation of the deferred computation of this call if successful. */ - Observable deleteImageRegionsAsync(UUID projectId, List regionIds); + Observable deleteImagesAsync(UUID projectId, List imageIds); + + + /** + * Add the provided images to the set of training images. + * This API accepts body content as multipart/form-data and application/octet-stream. When using multipart + * multiple image files can be sent at once, with a maximum of 64 files. + * + * @param projectId The project id. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB. + * @param createImagesFromDataOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImageCreateSummary object if successful. + */ + ImageCreateSummary createImagesFromData(UUID projectId, byte[] imageData, CreateImagesFromDataOptionalParameter createImagesFromDataOptionalParameter); + + /** + * Add the provided images to the set of training images. + * This API accepts body content as multipart/form-data and application/octet-stream. When using multipart + * multiple image files can be sent at once, with a maximum of 64 files. + * + * @param projectId The project id. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB. + * @param createImagesFromDataOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImageCreateSummary object + */ + Observable createImagesFromDataAsync(UUID projectId, byte[] imageData, CreateImagesFromDataOptionalParameter createImagesFromDataOptionalParameter); + + /** + * Add the provided images to the set of training images. + * This API accepts body content as multipart/form-data and application/octet-stream. When using multipart + * multiple image files can be sent at once, with a maximum of 64 files. + * + * @return the first stage of the createImagesFromData call + */ + TrainingsCreateImagesFromDataDefinitionStages.WithProjectId createImagesFromData(); + + /** + * Grouping of createImagesFromData definition stages. + */ + interface TrainingsCreateImagesFromDataDefinitionStages { + /** + * The stage of the definition to be specify projectId. + */ + interface WithProjectId { + /** + * The project id. + * + * @return next definition stage + */ + WithImageData withProjectId(UUID projectId); + } + /** + * The stage of the definition to be specify imageData. + */ + interface WithImageData { + /** + * Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB. + * + * @return next definition stage + */ + TrainingsCreateImagesFromDataDefinitionStages.WithExecute withImageData(byte[] imageData); + } + + /** + * The stage of the definition which allows for any other optional settings to be specified. + */ + interface WithAllOptions { + /** + * The tags ids with which to tag each image. Limited to 20. + * + * @return next definition stage + */ + TrainingsCreateImagesFromDataDefinitionStages.WithExecute withTagIds(List tagIds); + + } + + /** + * The last stage of the definition which will make the operation call. + */ + interface WithExecute extends TrainingsCreateImagesFromDataDefinitionStages.WithAllOptions { + /** + * Execute the request. + * + * @return the ImageCreateSummary object if successful. + */ + ImageCreateSummary execute(); + + /** + * Execute the request asynchronously. + * + * @return the observable to the ImageCreateSummary object + */ + Observable executeAsync(); + } + } + /** + * The entirety of createImagesFromData definition. + */ + interface TrainingsCreateImagesFromDataDefinition extends + TrainingsCreateImagesFromDataDefinitionStages.WithProjectId, + TrainingsCreateImagesFromDataDefinitionStages.WithImageData, + TrainingsCreateImagesFromDataDefinitionStages.WithExecute { + } /** - * Create a set of image regions. - * This API accepts a batch of image regions, and optionally tags, to update existing images with region - * information. - * There is a limit of 64 entries in the batch. + * Get images by id for a given project iteration. + * This API will return a set of Images for the specified tags and optionally iteration. If no iteration is + * specified the + * current workspace is used. * * @param projectId The project id. - * @param createImageRegionsOptionalParameter the object representing the optional parameters to be set before calling this API + * @param getImagesByIdsOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageRegionCreateSummary object if successful. + * @return the List<Image> object if successful. */ - @Deprecated - ImageRegionCreateSummary createImageRegions(UUID projectId, CreateImageRegionsOptionalParameter createImageRegionsOptionalParameter); + List getImagesByIds(UUID projectId, GetImagesByIdsOptionalParameter getImagesByIdsOptionalParameter); /** - * Create a set of image regions. - * This API accepts a batch of image regions, and optionally tags, to update existing images with region - * information. - * There is a limit of 64 entries in the batch. + * Get images by id for a given project iteration. + * This API will return a set of Images for the specified tags and optionally iteration. If no iteration is + * specified the + * current workspace is used. * * @param projectId The project id. - * @param createImageRegionsOptionalParameter the object representing the optional parameters to be set before calling this API + * @param getImagesByIdsOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageRegionCreateSummary object + * @return the observable to the List<Image> object */ - @Deprecated - Observable createImageRegionsAsync(UUID projectId, CreateImageRegionsOptionalParameter createImageRegionsOptionalParameter); + Observable> getImagesByIdsAsync(UUID projectId, GetImagesByIdsOptionalParameter getImagesByIdsOptionalParameter); /** - * Create a set of image regions. - * This API accepts a batch of image regions, and optionally tags, to update existing images with region - * information. - * There is a limit of 64 entries in the batch. + * Get images by id for a given project iteration. + * This API will return a set of Images for the specified tags and optionally iteration. If no iteration is + * specified the + * current workspace is used. * - * @return the first stage of the createImageRegions call + * @return the first stage of the getImagesByIds call */ - TrainingsCreateImageRegionsDefinitionStages.WithProjectId createImageRegions(); + TrainingsGetImagesByIdsDefinitionStages.WithProjectId getImagesByIds(); /** - * Grouping of createImageRegions definition stages. + * Grouping of getImagesByIds definition stages. */ - interface TrainingsCreateImageRegionsDefinitionStages { + interface TrainingsGetImagesByIdsDefinitionStages { /** * The stage of the definition to be specify projectId. */ @@ -1555,7 +1879,7 @@ interface WithProjectId { * * @return next definition stage */ - TrainingsCreateImageRegionsDefinitionStages.WithExecute withProjectId(UUID projectId); + TrainingsGetImagesByIdsDefinitionStages.WithExecute withProjectId(UUID projectId); } /** @@ -1563,102 +1887,213 @@ interface WithProjectId { */ interface WithAllOptions { /** + * The list of image ids to retrieve. Limited to 256. * + * @return next definition stage + */ + TrainingsGetImagesByIdsDefinitionStages.WithExecute withImageIds(List imageIds); + + /** + * The iteration id. Defaults to workspace. * * @return next definition stage */ - TrainingsCreateImageRegionsDefinitionStages.WithExecute withRegions(List regions); + TrainingsGetImagesByIdsDefinitionStages.WithExecute withIterationId(UUID iterationId); } /** * The last stage of the definition which will make the operation call. */ - interface WithExecute extends TrainingsCreateImageRegionsDefinitionStages.WithAllOptions { + interface WithExecute extends TrainingsGetImagesByIdsDefinitionStages.WithAllOptions { /** * Execute the request. * - * @return the ImageRegionCreateSummary object if successful. + * @return the List<Image> object if successful. */ - ImageRegionCreateSummary execute(); + List execute(); /** * Execute the request asynchronously. * - * @return the observable to the ImageRegionCreateSummary object + * @return the observable to the List<Image> object */ - Observable executeAsync(); + Observable> executeAsync(); } } /** - * The entirety of createImageRegions definition. + * The entirety of getImagesByIds definition. */ - interface TrainingsCreateImageRegionsDefinition extends - TrainingsCreateImageRegionsDefinitionStages.WithProjectId, - TrainingsCreateImageRegionsDefinitionStages.WithExecute { + interface TrainingsGetImagesByIdsDefinition extends + TrainingsGetImagesByIdsDefinitionStages.WithProjectId, + TrainingsGetImagesByIdsDefinitionStages.WithExecute { } - /** - * Remove a set of tags from a set of images. + * Get untagged images for a given project iteration. + * This API supports batching and range selection. By default it will only return first 50 images matching + * images. + * Use the {take} and {skip} parameters to control how many images to return in a given batch. * * @param projectId The project id. - * @param imageIds Image ids. Limited to 64 images. - * @param tagIds Tags to be deleted from the specified images. Limted to 20 tags. + * @param getUntaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<Image> object if successful. */ - void deleteImageTags(UUID projectId, List imageIds, List tagIds); + List getUntaggedImages(UUID projectId, GetUntaggedImagesOptionalParameter getUntaggedImagesOptionalParameter); /** - * Remove a set of tags from a set of images. + * Get untagged images for a given project iteration. + * This API supports batching and range selection. By default it will only return first 50 images matching + * images. + * Use the {take} and {skip} parameters to control how many images to return in a given batch. * * @param projectId The project id. - * @param imageIds Image ids. Limited to 64 images. - * @param tagIds Tags to be deleted from the specified images. Limted to 20 tags. + * @param getUntaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return a representation of the deferred computation of this call if successful. + * @return the observable to the List<Image> object */ - Observable deleteImageTagsAsync(UUID projectId, List imageIds, List tagIds); + Observable> getUntaggedImagesAsync(UUID projectId, GetUntaggedImagesOptionalParameter getUntaggedImagesOptionalParameter); + /** + * Get untagged images for a given project iteration. + * This API supports batching and range selection. By default it will only return first 50 images matching + * images. + * Use the {take} and {skip} parameters to control how many images to return in a given batch. + * + * @return the first stage of the getUntaggedImages call + */ + TrainingsGetUntaggedImagesDefinitionStages.WithProjectId getUntaggedImages(); /** - * Associate a set of images with a set of tags. + * Grouping of getUntaggedImages definition stages. + */ + interface TrainingsGetUntaggedImagesDefinitionStages { + /** + * The stage of the definition to be specify projectId. + */ + interface WithProjectId { + /** + * The project id. + * + * @return next definition stage + */ + TrainingsGetUntaggedImagesDefinitionStages.WithExecute withProjectId(UUID projectId); + } + + /** + * The stage of the definition which allows for any other optional settings to be specified. + */ + interface WithAllOptions { + /** + * The iteration id. Defaults to workspace. + * + * @return next definition stage + */ + TrainingsGetUntaggedImagesDefinitionStages.WithExecute withIterationId(UUID iterationId); + + /** + * The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest'. + * + * @return next definition stage + */ + TrainingsGetUntaggedImagesDefinitionStages.WithExecute withOrderBy(String orderBy); + + /** + * Maximum number of images to return. Defaults to 50, limited to 256. + * + * @return next definition stage + */ + TrainingsGetUntaggedImagesDefinitionStages.WithExecute withTake(Integer take); + + /** + * Number of images to skip before beginning the image batch. Defaults to 0. + * + * @return next definition stage + */ + TrainingsGetUntaggedImagesDefinitionStages.WithExecute withSkip(Integer skip); + + } + + /** + * The last stage of the definition which will make the operation call. + */ + interface WithExecute extends TrainingsGetUntaggedImagesDefinitionStages.WithAllOptions { + /** + * Execute the request. + * + * @return the List<Image> object if successful. + */ + List execute(); + + /** + * Execute the request asynchronously. + * + * @return the observable to the List<Image> object + */ + Observable> executeAsync(); + } + } + + /** + * The entirety of getUntaggedImages definition. + */ + interface TrainingsGetUntaggedImagesDefinition extends + TrainingsGetUntaggedImagesDefinitionStages.WithProjectId, + TrainingsGetUntaggedImagesDefinitionStages.WithExecute { + } + + /** + * Get tagged images for a given project iteration. + * This API supports batching and range selection. By default it will only return first 50 images matching + * images. + * Use the {take} and {skip} parameters to control how many images to return in a given batch. + * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + * "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * * @param projectId The project id. - * @param createImageTagsOptionalParameter the object representing the optional parameters to be set before calling this API + * @param getTaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageTagCreateSummary object if successful. + * @return the List<Image> object if successful. */ - @Deprecated - ImageTagCreateSummary createImageTags(UUID projectId, CreateImageTagsOptionalParameter createImageTagsOptionalParameter); + List getTaggedImages(UUID projectId, GetTaggedImagesOptionalParameter getTaggedImagesOptionalParameter); /** - * Associate a set of images with a set of tags. + * Get tagged images for a given project iteration. + * This API supports batching and range selection. By default it will only return first 50 images matching + * images. + * Use the {take} and {skip} parameters to control how many images to return in a given batch. + * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + * "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * * @param projectId The project id. - * @param createImageTagsOptionalParameter the object representing the optional parameters to be set before calling this API + * @param getTaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageTagCreateSummary object + * @return the observable to the List<Image> object */ - @Deprecated - Observable createImageTagsAsync(UUID projectId, CreateImageTagsOptionalParameter createImageTagsOptionalParameter); + Observable> getTaggedImagesAsync(UUID projectId, GetTaggedImagesOptionalParameter getTaggedImagesOptionalParameter); /** - * Associate a set of images with a set of tags. + * Get tagged images for a given project iteration. + * This API supports batching and range selection. By default it will only return first 50 images matching + * images. + * Use the {take} and {skip} parameters to control how many images to return in a given batch. + * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + * "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @return the first stage of the createImageTags call + * @return the first stage of the getTaggedImages call */ - TrainingsCreateImageTagsDefinitionStages.WithProjectId createImageTags(); + TrainingsGetTaggedImagesDefinitionStages.WithProjectId getTaggedImages(); /** - * Grouping of createImageTags definition stages. + * Grouping of getTaggedImages definition stages. */ - interface TrainingsCreateImageTagsDefinitionStages { + interface TrainingsGetTaggedImagesDefinitionStages { /** * The stage of the definition to be specify projectId. */ @@ -1668,7 +2103,7 @@ interface WithProjectId { * * @return next definition stage */ - TrainingsCreateImageTagsDefinitionStages.WithExecute withProjectId(UUID projectId); + TrainingsGetTaggedImagesDefinitionStages.WithExecute withProjectId(UUID projectId); } /** @@ -1676,192 +2111,135 @@ interface WithProjectId { */ interface WithAllOptions { /** - * + * The iteration id. Defaults to workspace. + * + * @return next definition stage + */ + TrainingsGetTaggedImagesDefinitionStages.WithExecute withIterationId(UUID iterationId); + + /** + * A list of tags ids to filter the images. Defaults to all tagged images when null. Limited to 20. + * + * @return next definition stage + */ + TrainingsGetTaggedImagesDefinitionStages.WithExecute withTagIds(List tagIds); + + /** + * The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest'. + * + * @return next definition stage + */ + TrainingsGetTaggedImagesDefinitionStages.WithExecute withOrderBy(String orderBy); + + /** + * Maximum number of images to return. Defaults to 50, limited to 256. + * + * @return next definition stage + */ + TrainingsGetTaggedImagesDefinitionStages.WithExecute withTake(Integer take); + + /** + * Number of images to skip before beginning the image batch. Defaults to 0. * * @return next definition stage */ - TrainingsCreateImageTagsDefinitionStages.WithExecute withTags(List tags); + TrainingsGetTaggedImagesDefinitionStages.WithExecute withSkip(Integer skip); } /** * The last stage of the definition which will make the operation call. */ - interface WithExecute extends TrainingsCreateImageTagsDefinitionStages.WithAllOptions { + interface WithExecute extends TrainingsGetTaggedImagesDefinitionStages.WithAllOptions { /** * Execute the request. * - * @return the ImageTagCreateSummary object if successful. + * @return the List<Image> object if successful. */ - ImageTagCreateSummary execute(); + List execute(); /** * Execute the request asynchronously. * - * @return the observable to the ImageTagCreateSummary object + * @return the observable to the List<Image> object */ - Observable executeAsync(); + Observable> executeAsync(); } } /** - * The entirety of createImageTags definition. + * The entirety of getTaggedImages definition. */ - interface TrainingsCreateImageTagsDefinition extends - TrainingsCreateImageTagsDefinitionStages.WithProjectId, - TrainingsCreateImageTagsDefinitionStages.WithExecute { + interface TrainingsGetTaggedImagesDefinition extends + TrainingsGetTaggedImagesDefinitionStages.WithProjectId, + TrainingsGetTaggedImagesDefinitionStages.WithExecute { } /** - * Add the specified predicted images to the set of training images. - * This API creates a batch of images from predicted images specified. There is a limit of 64 images - * and 20 tags. - * - * @param projectId The project id. - * @param batch Image and tag ids. Limted to 64 images and 20 tags per batch. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageCreateSummary object if successful. - */ - ImageCreateSummary createImagesFromPredictions(UUID projectId, ImageIdCreateBatch batch); - - /** - * Add the specified predicted images to the set of training images. - * This API creates a batch of images from predicted images specified. There is a limit of 64 images - * and 20 tags. - * - * @param projectId The project id. - * @param batch Image and tag ids. Limted to 64 images and 20 tags per batch. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageCreateSummary object - */ - Observable createImagesFromPredictionsAsync(UUID projectId, ImageIdCreateBatch batch); - - - - /** - * Add the provided images urls to the set of training images. - * This API accepts a batch of urls, and optionally tags, to create images. There is a limit of 64 - * images and 20 tags. - * - * @param projectId The project id. - * @param batch Image urls and tag ids. Limited to 64 images and 20 tags per batch. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageCreateSummary object if successful. - */ - ImageCreateSummary createImagesFromUrls(UUID projectId, ImageUrlCreateBatch batch); - - /** - * Add the provided images urls to the set of training images. - * This API accepts a batch of urls, and optionally tags, to create images. There is a limit of 64 - * images and 20 tags. - * - * @param projectId The project id. - * @param batch Image urls and tag ids. Limited to 64 images and 20 tags per batch. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageCreateSummary object - */ - Observable createImagesFromUrlsAsync(UUID projectId, ImageUrlCreateBatch batch); - - - - /** - * Add the provided batch of images to the set of training images. - * This API accepts a batch of files, and optionally tags, to create images. There is a limit of 64 - * images and 20 tags. - * - * @param projectId The project id. - * @param batch The batch of image files to add. Limited to 64 images and 20 tags per batch. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageCreateSummary object if successful. - */ - ImageCreateSummary createImagesFromFiles(UUID projectId, ImageFileCreateBatch batch); - - /** - * Add the provided batch of images to the set of training images. - * This API accepts a batch of files, and optionally tags, to create images. There is a limit of 64 - * images and 20 tags. - * - * @param projectId The project id. - * @param batch The batch of image files to add. Limited to 64 images and 20 tags per batch. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageCreateSummary object - */ - Observable createImagesFromFilesAsync(UUID projectId, ImageFileCreateBatch batch); - - - - /** - * Delete images from the set of training images. + * Delete a set of image regions. * * @param projectId The project id. - * @param imageIds Ids of the images to be deleted. Limted to 256 images per batch. + * @param regionIds Regions to delete. Limited to 64. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ - void deleteImages(UUID projectId, List imageIds); + void deleteImageRegions(UUID projectId, List regionIds); /** - * Delete images from the set of training images. + * Delete a set of image regions. * * @param projectId The project id. - * @param imageIds Ids of the images to be deleted. Limted to 256 images per batch. + * @param regionIds Regions to delete. Limited to 64. * @throws IllegalArgumentException thrown if parameters fail the validation * @return a representation of the deferred computation of this call if successful. */ - Observable deleteImagesAsync(UUID projectId, List imageIds); + Observable deleteImageRegionsAsync(UUID projectId, List regionIds); /** - * Add the provided images to the set of training images. - * This API accepts body content as multipart/form-data and application/octet-stream. When using multipart - * multiple image files can be sent at once, with a maximum of 64 files. + * Create a set of image regions. + * This API accepts a batch of image regions, and optionally tags, to update existing images with region + * information. + * There is a limit of 64 entries in the batch. * * @param projectId The project id. - * @param imageData the InputStream value. - * @param createImagesFromDataOptionalParameter the object representing the optional parameters to be set before calling this API + * @param createImageRegionsOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageCreateSummary object if successful. + * @return the ImageRegionCreateSummary object if successful. */ - @Deprecated - ImageCreateSummary createImagesFromData(UUID projectId, byte[] imageData, CreateImagesFromDataOptionalParameter createImagesFromDataOptionalParameter); + ImageRegionCreateSummary createImageRegions(UUID projectId, CreateImageRegionsOptionalParameter createImageRegionsOptionalParameter); /** - * Add the provided images to the set of training images. - * This API accepts body content as multipart/form-data and application/octet-stream. When using multipart - * multiple image files can be sent at once, with a maximum of 64 files. + * Create a set of image regions. + * This API accepts a batch of image regions, and optionally tags, to update existing images with region + * information. + * There is a limit of 64 entries in the batch. * * @param projectId The project id. - * @param imageData the InputStream value. - * @param createImagesFromDataOptionalParameter the object representing the optional parameters to be set before calling this API + * @param createImageRegionsOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageCreateSummary object + * @return the observable to the ImageRegionCreateSummary object */ - @Deprecated - Observable createImagesFromDataAsync(UUID projectId, byte[] imageData, CreateImagesFromDataOptionalParameter createImagesFromDataOptionalParameter); + Observable createImageRegionsAsync(UUID projectId, CreateImageRegionsOptionalParameter createImageRegionsOptionalParameter); /** - * Add the provided images to the set of training images. - * This API accepts body content as multipart/form-data and application/octet-stream. When using multipart - * multiple image files can be sent at once, with a maximum of 64 files. + * Create a set of image regions. + * This API accepts a batch of image regions, and optionally tags, to update existing images with region + * information. + * There is a limit of 64 entries in the batch. * - * @return the first stage of the createImagesFromData call + * @return the first stage of the createImageRegions call */ - TrainingsCreateImagesFromDataDefinitionStages.WithProjectId createImagesFromData(); + TrainingsCreateImageRegionsDefinitionStages.WithProjectId createImageRegions(); /** - * Grouping of createImagesFromData definition stages. + * Grouping of createImageRegions definition stages. */ - interface TrainingsCreateImagesFromDataDefinitionStages { + interface TrainingsCreateImageRegionsDefinitionStages { /** * The stage of the definition to be specify projectId. */ @@ -1871,18 +2249,7 @@ interface WithProjectId { * * @return next definition stage */ - WithImageData withProjectId(UUID projectId); - } - /** - * The stage of the definition to be specify imageData. - */ - interface WithImageData { - /** - * - * - * @return next definition stage - */ - TrainingsCreateImagesFromDataDefinitionStages.WithExecute withImageData(byte[] imageData); + TrainingsCreateImageRegionsDefinitionStages.WithExecute withProjectId(UUID projectId); } /** @@ -1890,87 +2257,100 @@ interface WithImageData { */ interface WithAllOptions { /** - * The tags ids with which to tag each image. Limited to 20. + * * * @return next definition stage */ - TrainingsCreateImagesFromDataDefinitionStages.WithExecute withTagIds(List tagIds); + TrainingsCreateImageRegionsDefinitionStages.WithExecute withRegions(List regions); } /** * The last stage of the definition which will make the operation call. */ - interface WithExecute extends TrainingsCreateImagesFromDataDefinitionStages.WithAllOptions { + interface WithExecute extends TrainingsCreateImageRegionsDefinitionStages.WithAllOptions { /** * Execute the request. * - * @return the ImageCreateSummary object if successful. + * @return the ImageRegionCreateSummary object if successful. */ - ImageCreateSummary execute(); + ImageRegionCreateSummary execute(); /** * Execute the request asynchronously. * - * @return the observable to the ImageCreateSummary object + * @return the observable to the ImageRegionCreateSummary object */ - Observable executeAsync(); + Observable executeAsync(); } } /** - * The entirety of createImagesFromData definition. + * The entirety of createImageRegions definition. */ - interface TrainingsCreateImagesFromDataDefinition extends - TrainingsCreateImagesFromDataDefinitionStages.WithProjectId, - TrainingsCreateImagesFromDataDefinitionStages.WithImageData, - TrainingsCreateImagesFromDataDefinitionStages.WithExecute { + interface TrainingsCreateImageRegionsDefinition extends + TrainingsCreateImageRegionsDefinitionStages.WithProjectId, + TrainingsCreateImageRegionsDefinitionStages.WithExecute { } + /** - * Get images by id for a given project iteration. - * This API will return a set of Images for the specified tags and optionally iteration. If no iteration is - * specified the - * current workspace is used. + * Remove a set of tags from a set of images. * * @param projectId The project id. - * @param getImagesByIdsOptionalParameter the object representing the optional parameters to be set before calling this API + * @param imageIds Image ids. Limited to 64 images. + * @param tagIds Tags to be deleted from the specified images. Limited to 20 tags. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the List<Image> object if successful. */ - @Deprecated - List getImagesByIds(UUID projectId, GetImagesByIdsOptionalParameter getImagesByIdsOptionalParameter); + void deleteImageTags(UUID projectId, List imageIds, List tagIds); /** - * Get images by id for a given project iteration. - * This API will return a set of Images for the specified tags and optionally iteration. If no iteration is - * specified the - * current workspace is used. + * Remove a set of tags from a set of images. * * @param projectId The project id. - * @param getImagesByIdsOptionalParameter the object representing the optional parameters to be set before calling this API + * @param imageIds Image ids. Limited to 64 images. + * @param tagIds Tags to be deleted from the specified images. Limited to 20 tags. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<Image> object + * @return a representation of the deferred computation of this call if successful. */ - @Deprecated - Observable> getImagesByIdsAsync(UUID projectId, GetImagesByIdsOptionalParameter getImagesByIdsOptionalParameter); + Observable deleteImageTagsAsync(UUID projectId, List imageIds, List tagIds); + /** - * Get images by id for a given project iteration. - * This API will return a set of Images for the specified tags and optionally iteration. If no iteration is - * specified the - * current workspace is used. + * Associate a set of images with a set of tags. * - * @return the first stage of the getImagesByIds call + * @param projectId The project id. + * @param createImageTagsOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImageTagCreateSummary object if successful. */ - TrainingsGetImagesByIdsDefinitionStages.WithProjectId getImagesByIds(); + ImageTagCreateSummary createImageTags(UUID projectId, CreateImageTagsOptionalParameter createImageTagsOptionalParameter); /** - * Grouping of getImagesByIds definition stages. + * Associate a set of images with a set of tags. + * + * @param projectId The project id. + * @param createImageTagsOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImageTagCreateSummary object */ - interface TrainingsGetImagesByIdsDefinitionStages { + Observable createImageTagsAsync(UUID projectId, CreateImageTagsOptionalParameter createImageTagsOptionalParameter); + + /** + * Associate a set of images with a set of tags. + * + * @return the first stage of the createImageTags call + */ + TrainingsCreateImageTagsDefinitionStages.WithProjectId createImageTags(); + + /** + * Grouping of createImageTags definition stages. + */ + interface TrainingsCreateImageTagsDefinitionStages { /** * The stage of the definition to be specify projectId. */ @@ -1980,7 +2360,7 @@ interface WithProjectId { * * @return next definition stage */ - TrainingsGetImagesByIdsDefinitionStages.WithExecute withProjectId(UUID projectId); + TrainingsCreateImageTagsDefinitionStages.WithExecute withProjectId(UUID projectId); } /** @@ -1988,47 +2368,40 @@ interface WithProjectId { */ interface WithAllOptions { /** - * The list of image ids to retrieve. Limited to 256. - * - * @return next definition stage - */ - TrainingsGetImagesByIdsDefinitionStages.WithExecute withImageIds(List imageIds); - - /** - * The iteration id. Defaults to workspace. + * Image Tag entries to include in this batch. * * @return next definition stage */ - TrainingsGetImagesByIdsDefinitionStages.WithExecute withIterationId(UUID iterationId); + TrainingsCreateImageTagsDefinitionStages.WithExecute withTags(List tags); } /** * The last stage of the definition which will make the operation call. */ - interface WithExecute extends TrainingsGetImagesByIdsDefinitionStages.WithAllOptions { + interface WithExecute extends TrainingsCreateImageTagsDefinitionStages.WithAllOptions { /** * Execute the request. * - * @return the List<Image> object if successful. + * @return the ImageTagCreateSummary object if successful. */ - List execute(); + ImageTagCreateSummary execute(); /** * Execute the request asynchronously. * - * @return the observable to the List<Image> object + * @return the observable to the ImageTagCreateSummary object */ - Observable> executeAsync(); + Observable executeAsync(); } } /** - * The entirety of getImagesByIds definition. + * The entirety of createImageTags definition. */ - interface TrainingsGetImagesByIdsDefinition extends - TrainingsGetImagesByIdsDefinitionStages.WithProjectId, - TrainingsGetImagesByIdsDefinitionStages.WithExecute { + interface TrainingsCreateImageTagsDefinition extends + TrainingsCreateImageTagsDefinitionStages.WithProjectId, + TrainingsCreateImageTagsDefinitionStages.WithExecute { } /** @@ -2040,11 +2413,10 @@ interface TrainingsGetImagesByIdsDefinition extends * @param projectId The project id. * @param getUntaggedImageCountOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the int object if successful. */ - @Deprecated int getUntaggedImageCount(UUID projectId, GetUntaggedImageCountOptionalParameter getUntaggedImageCountOptionalParameter); /** @@ -2058,7 +2430,6 @@ interface TrainingsGetImagesByIdsDefinition extends * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the int object */ - @Deprecated Observable getUntaggedImageCountAsync(UUID projectId, GetUntaggedImageCountOptionalParameter getUntaggedImageCountOptionalParameter); /** @@ -2136,11 +2507,10 @@ interface TrainingsGetUntaggedImageCountDefinition extends * @param projectId The project id. * @param getTaggedImageCountOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the int object if successful. */ - @Deprecated int getTaggedImageCount(UUID projectId, GetTaggedImageCountOptionalParameter getTaggedImageCountOptionalParameter); /** @@ -2153,7 +2523,6 @@ interface TrainingsGetUntaggedImageCountDefinition extends * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the int object */ - @Deprecated Observable getTaggedImageCountAsync(UUID projectId, GetTaggedImageCountOptionalParameter getTaggedImageCountOptionalParameter); /** @@ -2197,7 +2566,7 @@ interface WithAllOptions { * * @return next definition stage */ - TrainingsGetTaggedImageCountDefinitionStages.WithExecute withTagIds(List tagIds); + TrainingsGetTaggedImageCountDefinitionStages.WithExecute withTagIds(List tagIds); } @@ -2229,262 +2598,13 @@ interface TrainingsGetTaggedImageCountDefinition extends TrainingsGetTaggedImageCountDefinitionStages.WithExecute { } - /** - * Get untagged images for a given project iteration. - * This API supports batching and range selection. By default it will only return first 50 images matching - * images. - * Use the {take} and {skip} parameters to control how many images to return in a given batch. - * - * @param projectId The project id. - * @param getUntaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the List<Image> object if successful. - */ - @Deprecated - List getUntaggedImages(UUID projectId, GetUntaggedImagesOptionalParameter getUntaggedImagesOptionalParameter); - - /** - * Get untagged images for a given project iteration. - * This API supports batching and range selection. By default it will only return first 50 images matching - * images. - * Use the {take} and {skip} parameters to control how many images to return in a given batch. - * - * @param projectId The project id. - * @param getUntaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<Image> object - */ - @Deprecated - Observable> getUntaggedImagesAsync(UUID projectId, GetUntaggedImagesOptionalParameter getUntaggedImagesOptionalParameter); - - /** - * Get untagged images for a given project iteration. - * This API supports batching and range selection. By default it will only return first 50 images matching - * images. - * Use the {take} and {skip} parameters to control how many images to return in a given batch. - * - * @return the first stage of the getUntaggedImages call - */ - TrainingsGetUntaggedImagesDefinitionStages.WithProjectId getUntaggedImages(); - - /** - * Grouping of getUntaggedImages definition stages. - */ - interface TrainingsGetUntaggedImagesDefinitionStages { - /** - * The stage of the definition to be specify projectId. - */ - interface WithProjectId { - /** - * The project id. - * - * @return next definition stage - */ - TrainingsGetUntaggedImagesDefinitionStages.WithExecute withProjectId(UUID projectId); - } - - /** - * The stage of the definition which allows for any other optional settings to be specified. - */ - interface WithAllOptions { - /** - * The iteration id. Defaults to workspace. - * - * @return next definition stage - */ - TrainingsGetUntaggedImagesDefinitionStages.WithExecute withIterationId(UUID iterationId); - - /** - * The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest'. - * - * @return next definition stage - */ - TrainingsGetUntaggedImagesDefinitionStages.WithExecute withOrderBy(String orderBy); - - /** - * Maximum number of images to return. Defaults to 50, limited to 256. - * - * @return next definition stage - */ - TrainingsGetUntaggedImagesDefinitionStages.WithExecute withTake(Integer take); - - /** - * Number of images to skip before beginning the image batch. Defaults to 0. - * - * @return next definition stage - */ - TrainingsGetUntaggedImagesDefinitionStages.WithExecute withSkip(Integer skip); - - } - - /** - * The last stage of the definition which will make the operation call. - */ - interface WithExecute extends TrainingsGetUntaggedImagesDefinitionStages.WithAllOptions { - /** - * Execute the request. - * - * @return the List<Image> object if successful. - */ - List execute(); - - /** - * Execute the request asynchronously. - * - * @return the observable to the List<Image> object - */ - Observable> executeAsync(); - } - } - - /** - * The entirety of getUntaggedImages definition. - */ - interface TrainingsGetUntaggedImagesDefinition extends - TrainingsGetUntaggedImagesDefinitionStages.WithProjectId, - TrainingsGetUntaggedImagesDefinitionStages.WithExecute { - } - - /** - * Get tagged images for a given project iteration. - * This API supports batching and range selection. By default it will only return first 50 images matching - * images. - * Use the {take} and {skip} parameters to control how many images to return in a given batch. - * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and - * "Cat" tags, then only images tagged with Dog and/or Cat will be returned. - * - * @param projectId The project id. - * @param getTaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the List<Image> object if successful. - */ - @Deprecated - List getTaggedImages(UUID projectId, GetTaggedImagesOptionalParameter getTaggedImagesOptionalParameter); - - /** - * Get tagged images for a given project iteration. - * This API supports batching and range selection. By default it will only return first 50 images matching - * images. - * Use the {take} and {skip} parameters to control how many images to return in a given batch. - * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and - * "Cat" tags, then only images tagged with Dog and/or Cat will be returned. - * - * @param projectId The project id. - * @param getTaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<Image> object - */ - @Deprecated - Observable> getTaggedImagesAsync(UUID projectId, GetTaggedImagesOptionalParameter getTaggedImagesOptionalParameter); - - /** - * Get tagged images for a given project iteration. - * This API supports batching and range selection. By default it will only return first 50 images matching - * images. - * Use the {take} and {skip} parameters to control how many images to return in a given batch. - * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and - * "Cat" tags, then only images tagged with Dog and/or Cat will be returned. - * - * @return the first stage of the getTaggedImages call - */ - TrainingsGetTaggedImagesDefinitionStages.WithProjectId getTaggedImages(); - - /** - * Grouping of getTaggedImages definition stages. - */ - interface TrainingsGetTaggedImagesDefinitionStages { - /** - * The stage of the definition to be specify projectId. - */ - interface WithProjectId { - /** - * The project id. - * - * @return next definition stage - */ - TrainingsGetTaggedImagesDefinitionStages.WithExecute withProjectId(UUID projectId); - } - - /** - * The stage of the definition which allows for any other optional settings to be specified. - */ - interface WithAllOptions { - /** - * The iteration id. Defaults to workspace. - * - * @return next definition stage - */ - TrainingsGetTaggedImagesDefinitionStages.WithExecute withIterationId(UUID iterationId); - - /** - * A list of tags ids to filter the images. Defaults to all tagged images when null. Limited to 20. - * - * @return next definition stage - */ - TrainingsGetTaggedImagesDefinitionStages.WithExecute withTagIds(List tagIds); - - /** - * The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest'. - * - * @return next definition stage - */ - TrainingsGetTaggedImagesDefinitionStages.WithExecute withOrderBy(String orderBy); - - /** - * Maximum number of images to return. Defaults to 50, limited to 256. - * - * @return next definition stage - */ - TrainingsGetTaggedImagesDefinitionStages.WithExecute withTake(Integer take); - - /** - * Number of images to skip before beginning the image batch. Defaults to 0. - * - * @return next definition stage - */ - TrainingsGetTaggedImagesDefinitionStages.WithExecute withSkip(Integer skip); - - } - - /** - * The last stage of the definition which will make the operation call. - */ - interface WithExecute extends TrainingsGetTaggedImagesDefinitionStages.WithAllOptions { - /** - * Execute the request. - * - * @return the List<Image> object if successful. - */ - List execute(); - - /** - * Execute the request asynchronously. - * - * @return the observable to the List<Image> object - */ - Observable> executeAsync(); - } - } - - /** - * The entirety of getTaggedImages definition. - */ - interface TrainingsGetTaggedImagesDefinition extends - TrainingsGetTaggedImagesDefinitionStages.WithProjectId, - TrainingsGetTaggedImagesDefinitionStages.WithExecute { - } - /** * Get information about a specific domain. * * @param domainId The id of the domain to get information about. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the Domain object if successful. */ @@ -2505,7 +2625,7 @@ interface TrainingsGetTaggedImagesDefinition extends * Get a list of the available domains. * * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the List<Domain> object if successful. */ diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/CustomVisionTrainingClientImpl.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/CustomVisionTrainingClientImpl.java new file mode 100644 index 000000000000..ba4edb36f0c3 --- /dev/null +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/CustomVisionTrainingClientImpl.java @@ -0,0 +1,208 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.customvision.training.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.CustomVisionTrainingClient; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings; +import com.microsoft.rest.RestClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; + +/** + * Initializes a new instance of the CustomVisionTrainingClientImpl class. + */ +public class CustomVisionTrainingClientImpl extends AzureServiceClient implements CustomVisionTrainingClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** API key. */ + private String apiKey; + + /** + * Gets API key. + * + * @return the apiKey value. + */ + public String apiKey() { + return this.apiKey; + } + + /** + * Sets API key. + * + * @param apiKey the apiKey value. + * @return the service client itself + */ + public CustomVisionTrainingClientImpl withApiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** Supported Cognitive Services endpoints. */ + private String endpoint; + + /** + * Gets Supported Cognitive Services endpoints. + * + * @return the endpoint value. + */ + public String endpoint() { + return this.endpoint; + } + + /** + * Sets Supported Cognitive Services endpoints. + * + * @param endpoint the endpoint value. + * @return the service client itself + */ + public CustomVisionTrainingClientImpl withEndpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public CustomVisionTrainingClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public CustomVisionTrainingClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public CustomVisionTrainingClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The Trainings object to access its operations. + */ + private Trainings trainings; + + /** + * Gets the Trainings object to access its operations. + * @return the Trainings object. + */ + public Trainings trainings() { + return this.trainings; + } + + /** + * Initializes an instance of CustomVisionTrainingClient client. + * + * @param credentials the management credentials for Azure + */ + public CustomVisionTrainingClientImpl(ServiceClientCredentials credentials) { + this("https://{Endpoint}/customvision/v3.0/training", credentials); + } + + /** + * Initializes an instance of CustomVisionTrainingClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public CustomVisionTrainingClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of CustomVisionTrainingClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public CustomVisionTrainingClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.trainings = new TrainingsImpl(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "CustomVisionTrainingClient", "3.0"); + } +} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingApiImpl.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingApiImpl.java deleted file mode 100644 index 6f3f10fcb6b8..000000000000 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingApiImpl.java +++ /dev/null @@ -1,185 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - */ - -package com.microsoft.azure.cognitiveservices.vision.customvision.training.implementation; - -import com.microsoft.azure.AzureClient; -import com.microsoft.azure.AzureServiceClient; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.TrainingApi; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings; -import com.microsoft.rest.credentials.ServiceClientCredentials; -import com.microsoft.rest.RestClient; - -/** - * Initializes a new instance of the TrainingApiImpl class. - */ -public class TrainingApiImpl extends AzureServiceClient implements TrainingApi { - /** the {@link AzureClient} used for long running operations. */ - private AzureClient azureClient; - - /** - * Gets the {@link AzureClient} used for long running operations. - * @return the azure client; - */ - public AzureClient getAzureClient() { - return this.azureClient; - } - - /** The API key. */ - private String apiKey; - - /** - * Gets the API key. - * - * @return the apiKey value. - */ - public String apiKey() { - return this.apiKey; - } - - /** - * Sets the API key. - * - * @param apiKey the apiKey value. - * @return the service client itself - */ - public TrainingApiImpl withApiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - - /** Gets or sets the preferred language for the response. */ - private String acceptLanguage; - - /** - * Gets Gets or sets the preferred language for the response. - * - * @return the acceptLanguage value. - */ - public String acceptLanguage() { - return this.acceptLanguage; - } - - /** - * Sets Gets or sets the preferred language for the response. - * - * @param acceptLanguage the acceptLanguage value. - * @return the service client itself - */ - public TrainingApiImpl withAcceptLanguage(String acceptLanguage) { - this.acceptLanguage = acceptLanguage; - return this; - } - - /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ - private int longRunningOperationRetryTimeout; - - /** - * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. - * - * @return the longRunningOperationRetryTimeout value. - */ - public int longRunningOperationRetryTimeout() { - return this.longRunningOperationRetryTimeout; - } - - /** - * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. - * - * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. - * @return the service client itself - */ - public TrainingApiImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { - this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; - return this; - } - - /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ - private boolean generateClientRequestId; - - /** - * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. - * - * @return the generateClientRequestId value. - */ - public boolean generateClientRequestId() { - return this.generateClientRequestId; - } - - /** - * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. - * - * @param generateClientRequestId the generateClientRequestId value. - * @return the service client itself - */ - public TrainingApiImpl withGenerateClientRequestId(boolean generateClientRequestId) { - this.generateClientRequestId = generateClientRequestId; - return this; - } - - /** - * The Trainings object to access its operations. - */ - private Trainings trainings; - - /** - * Gets the Trainings object to access its operations. - * @return the Trainings object. - */ - public Trainings trainings() { - return this.trainings; - } - - /** - * Initializes an instance of TrainingApi client. - * - * @param credentials the management credentials for Azure - */ - public TrainingApiImpl(ServiceClientCredentials credentials) { - this("https://southcentralus.api.cognitive.microsoft.com/customvision/v2.1/Training", credentials); - } - - /** - * Initializes an instance of TrainingApi client. - * - * @param baseUrl the base URL of the host - * @param credentials the management credentials for Azure - */ - public TrainingApiImpl(String baseUrl, ServiceClientCredentials credentials) { - super(baseUrl, credentials); - initialize(); - } - - /** - * Initializes an instance of TrainingApi client. - * - * @param restClient the REST client to connect to Azure. - */ - public TrainingApiImpl(RestClient restClient) { - super(restClient); - initialize(); - } - - protected void initialize() { - this.acceptLanguage = "en-US"; - this.longRunningOperationRetryTimeout = 30; - this.generateClientRequestId = true; - this.trainings = new TrainingsImpl(restClient().retrofit(), this); - this.azureClient = new AzureClient(this); - } - - /** - * Gets the User-Agent header for the client. - * - * @return the user agent string. - */ - @Override - public String userAgent() { - return String.format("%s (%s, %s)", super.userAgent(), "TrainingApi", "2.1"); - } -} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java index dc65c44bcee9..c23833e1c4ef 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java @@ -8,32 +8,28 @@ package com.microsoft.azure.cognitiveservices.vision.customvision.training.implementation; +import com.google.common.base.Joiner; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.CreateImageRegionsOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.CreateImageTagsOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.CreateImagesFromDataOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.CreateProjectOptionalParameter; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.CreateTagOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetTagsOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetTagOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.CustomVisionErrorException; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.Domain; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.Export; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.ExportIterationOptionalParameter; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetImagePerformanceCountOptionalParameter; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetImagePerformancesOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetIterationPerformanceOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.CreateProjectOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.QuickTestImageOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.QuickTestImageUrlOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.CreateImageRegionsOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.CreateImageTagsOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.CreateImagesFromDataOptionalParameter; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetImagesByIdsOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetUntaggedImageCountOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetIterationPerformanceOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetTagOptionalParameter; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetTaggedImageCountOptionalParameter; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetUntaggedImagesOptionalParameter; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetTaggedImagesOptionalParameter; -import okhttp3.MediaType; -import okhttp3.RequestBody; -import retrofit2.Retrofit; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings; -import com.google.common.reflect.TypeToken; -import com.microsoft.azure.CloudException; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.Domain; -import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.Export; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetTagsOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetUntaggedImageCountOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.GetUntaggedImagesOptionalParameter; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.Image; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.ImageCreateSummary; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.ImageFileCreateBatch; @@ -54,30 +50,37 @@ import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.PredictionQueryResult; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.PredictionQueryToken; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.Project; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.QuickTestImageOptionalParameter; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.QuickTestImageUrlOptionalParameter; import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.Tag; +import com.microsoft.azure.cognitiveservices.vision.customvision.training.models.TrainProjectOptionalParameter; import com.microsoft.rest.CollectionFormat; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.Validator; -import java.io.IOException; -import java.util.List; -import java.util.UUID; +import okhttp3.MediaType; +import okhttp3.RequestBody; import okhttp3.ResponseBody; +import retrofit2.Response; +import retrofit2.Retrofit; import retrofit2.http.Body; import retrofit2.http.GET; +import retrofit2.http.HTTP; import retrofit2.http.Header; import retrofit2.http.Headers; -import retrofit2.http.HTTP; import retrofit2.http.Multipart; -import retrofit2.http.Part; import retrofit2.http.PATCH; -import retrofit2.http.Path; import retrofit2.http.POST; +import retrofit2.http.Part; +import retrofit2.http.Path; import retrofit2.http.Query; -import retrofit2.Response; -import rx.functions.Func1; import rx.Observable; +import rx.functions.Func1; + +import java.io.IOException; +import java.util.List; +import java.util.UUID; /** * An instance of this class provides access to all the operations defined @@ -87,7 +90,7 @@ public class TrainingsImpl implements Trainings { /** The Retrofit service to perform REST calls. */ private TrainingsService service; /** The service client containing this operation class. */ - private TrainingApiImpl client; + private CustomVisionTrainingClientImpl client; /** * Initializes an instance of TrainingsImpl. @@ -95,7 +98,7 @@ public class TrainingsImpl implements Trainings { * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ - public TrainingsImpl(Retrofit retrofit, TrainingApiImpl client) { + public TrainingsImpl(Retrofit retrofit, CustomVisionTrainingClientImpl client) { this.service = retrofit.create(TrainingsService.class); this.client = client; } @@ -107,167 +110,175 @@ public TrainingsImpl(Retrofit retrofit, TrainingApiImpl client) { interface TrainingsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings createTag" }) @POST("projects/{projectId}/tags") - Observable> createTag(@Path("projectId") UUID projectId, @Query("name") String name, @Query("description") String description, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> createTag(@Path("projectId") UUID projectId, @Query("name") String name, @Query("description") String description, @Query("type") String type, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings getTags" }) @GET("projects/{projectId}/tags") - Observable> getTags(@Path("projectId") UUID projectId, @Query("iterationId") UUID iterationId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> getTags(@Path("projectId") UUID projectId, @Query("iterationId") UUID iterationId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings updateTag" }) @PATCH("projects/{projectId}/tags/{tagId}") - Observable> updateTag(@Path("projectId") UUID projectId, @Path("tagId") UUID tagId, @Body Tag updatedTag, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> updateTag(@Path("projectId") UUID projectId, @Path("tagId") UUID tagId, @Body Tag updatedTag, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings deleteTag" }) @HTTP(path = "projects/{projectId}/tags/{tagId}", method = "DELETE", hasBody = true) - Observable> deleteTag(@Path("projectId") UUID projectId, @Path("tagId") UUID tagId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> deleteTag(@Path("projectId") UUID projectId, @Path("tagId") UUID tagId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings getTag" }) @GET("projects/{projectId}/tags/{tagId}") - Observable> getTag(@Path("projectId") UUID projectId, @Path("tagId") UUID tagId, @Query("iterationId") UUID iterationId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> getTag(@Path("projectId") UUID projectId, @Path("tagId") UUID tagId, @Query("iterationId") UUID iterationId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings exportIteration" }) @POST("projects/{projectId}/iterations/{iterationId}/export") - Observable> exportIteration(@Path("projectId") UUID projectId, @Path("iterationId") UUID iterationId, @Query("platform") String platform, @Query("flavor") String flavor, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> exportIteration(@Path("projectId") UUID projectId, @Path("iterationId") UUID iterationId, @Query("platform") String platform, @Query("flavor") String flavor, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings getExports" }) @GET("projects/{projectId}/iterations/{iterationId}/export") - Observable> getExports(@Path("projectId") UUID projectId, @Path("iterationId") UUID iterationId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings getImagePerformanceCount" }) - @GET("projects/{projectId}/iterations/{iterationId}/performance/images/count") - Observable> getImagePerformanceCount(@Path("projectId") UUID projectId, @Path("iterationId") UUID iterationId, @Query("tagIds") String tagIds, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> getExports(@Path("projectId") UUID projectId, @Path("iterationId") UUID iterationId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings getImagePerformances" }) - @GET("projects/{projectId}/iterations/{iterationId}/performance/images") - Observable> getImagePerformances(@Path("projectId") UUID projectId, @Path("iterationId") UUID iterationId, @Query("tagIds") String tagIds, @Query("orderBy") String orderBy, @Query("take") Integer take, @Query("skip") Integer skip, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings unpublishIteration" }) + @HTTP(path = "projects/{projectId}/iterations/{iterationId}/publish", method = "DELETE", hasBody = true) + Observable> unpublishIteration(@Path("projectId") UUID projectId, @Path("iterationId") UUID iterationId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings getIterationPerformance" }) - @GET("projects/{projectId}/iterations/{iterationId}/performance") - Observable> getIterationPerformance(@Path("projectId") UUID projectId, @Path("iterationId") UUID iterationId, @Query("threshold") Double threshold, @Query("overlapThreshold") Double overlapThreshold, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings publishIteration" }) + @POST("projects/{projectId}/iterations/{iterationId}/publish") + Observable> publishIteration(@Path("projectId") UUID projectId, @Path("iterationId") UUID iterationId, @Query("publishName") String publishName, @Query("predictionId") String predictionId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings updateIteration" }) @PATCH("projects/{projectId}/iterations/{iterationId}") - Observable> updateIteration(@Path("projectId") UUID projectId, @Path("iterationId") UUID iterationId, @Body Iteration updatedIteration, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> updateIteration(@Path("projectId") UUID projectId, @Path("iterationId") UUID iterationId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Body Iteration updatedIteration, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings deleteIteration" }) @HTTP(path = "projects/{projectId}/iterations/{iterationId}", method = "DELETE", hasBody = true) - Observable> deleteIteration(@Path("projectId") UUID projectId, @Path("iterationId") UUID iterationId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> deleteIteration(@Path("projectId") UUID projectId, @Path("iterationId") UUID iterationId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings getIteration" }) @GET("projects/{projectId}/iterations/{iterationId}") - Observable> getIteration(@Path("projectId") UUID projectId, @Path("iterationId") UUID iterationId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> getIteration(@Path("projectId") UUID projectId, @Path("iterationId") UUID iterationId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings getIterations" }) @GET("projects/{projectId}/iterations") - Observable> getIterations(@Path("projectId") UUID projectId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> getIterations(@Path("projectId") UUID projectId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings trainProject" }) + @POST("projects/{projectId}/train") + Observable> trainProject(@Path("projectId") UUID projectId, @Query("trainingType") String trainingType, @Query("reservedBudgetInHours") Integer reservedBudgetInHours, @Query("forceTrain") Boolean forceTrain, @Query("notificationEmailAddress") String notificationEmailAddress, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings updateProject" }) @PATCH("projects/{projectId}") - Observable> updateProject(@Path("projectId") UUID projectId, @Body Project updatedProject, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> updateProject(@Path("projectId") UUID projectId, @Body Project updatedProject, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings deleteProject" }) @HTTP(path = "projects/{projectId}", method = "DELETE", hasBody = true) - Observable> deleteProject(@Path("projectId") UUID projectId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> deleteProject(@Path("projectId") UUID projectId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings getProject" }) @GET("projects/{projectId}") - Observable> getProject(@Path("projectId") UUID projectId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> getProject(@Path("projectId") UUID projectId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings createProject" }) @POST("projects") - Observable> createProject(@Query("name") String name, @Query("description") String description, @Query("domainId") UUID domainId, @Query("classificationType") String classificationType, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> createProject(@Query("name") String name, @Query("description") String description, @Query("domainId") UUID domainId, @Query("classificationType") String classificationType, @Query("targetExportPlatforms") String targetExportPlatforms, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings getProjects" }) @GET("projects") - Observable> getProjects(@Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> getProjects(@Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings trainProject" }) - @POST("projects/{projectId}/train") - Observable> trainProject(@Path("projectId") UUID projectId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings getImagePerformanceCount" }) + @GET("projects/{projectId}/iterations/{iterationId}/performance/images/count") + Observable> getImagePerformanceCount(@Path("projectId") UUID projectId, @Path("iterationId") UUID iterationId, @Query("tagIds") String tagIds, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings getImagePerformances" }) + @GET("projects/{projectId}/iterations/{iterationId}/performance/images") + Observable> getImagePerformances(@Path("projectId") UUID projectId, @Path("iterationId") UUID iterationId, @Query("tagIds") String tagIds, @Query("orderBy") String orderBy, @Query("take") Integer take, @Query("skip") Integer skip, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings getIterationPerformance" }) + @GET("projects/{projectId}/iterations/{iterationId}/performance") + Observable> getIterationPerformance(@Path("projectId") UUID projectId, @Path("iterationId") UUID iterationId, @Query("threshold") Double threshold, @Query("overlapThreshold") Double overlapThreshold, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings queryPredictions" }) + @POST("projects/{projectId}/predictions/query") + Observable> queryPredictions(@Path("projectId") UUID projectId, @Body PredictionQueryToken query, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Multipart @POST("projects/{projectId}/quicktest/image") - Observable> quickTestImage(@Path("projectId") UUID projectId, @Query("iterationId") UUID iterationId, @Part("imageData") RequestBody imageData, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> quickTestImage(@Path("projectId") UUID projectId, @Query("iterationId") UUID iterationId, @Part("imageData") RequestBody imageData, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings quickTestImageUrl" }) @POST("projects/{projectId}/quicktest/url") - Observable> quickTestImageUrl(@Path("projectId") UUID projectId, @Query("iterationId") UUID iterationId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("User-Agent") String userAgent); - - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings queryPredictions" }) - @POST("projects/{projectId}/predictions/query") - Observable> queryPredictions(@Path("projectId") UUID projectId, @Body PredictionQueryToken query, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> quickTestImageUrl(@Path("projectId") UUID projectId, @Query("iterationId") UUID iterationId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Body ImageUrl imageUrl, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings deletePrediction" }) @HTTP(path = "projects/{projectId}/predictions", method = "DELETE", hasBody = true) - Observable> deletePrediction(@Path("projectId") UUID projectId, @Query("ids") String ids, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> deletePrediction(@Path("projectId") UUID projectId, @Query("ids") String ids, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings getImageRegionProposals" }) - @POST("{projectId}/images/{imageId}/regionproposals") - Observable> getImageRegionProposals(@Path("projectId") UUID projectId, @Path("imageId") UUID imageId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings deleteImageRegions" }) - @HTTP(path = "projects/{projectId}/images/regions", method = "DELETE", hasBody = true) - Observable> deleteImageRegions(@Path("projectId") UUID projectId, @Query("regionIds") String regionIds, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings createImageRegions" }) - @POST("projects/{projectId}/images/regions") - Observable> createImageRegions(@Path("projectId") UUID projectId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Body ImageRegionCreateBatch batch, @Header("User-Agent") String userAgent); - - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings deleteImageTags" }) - @HTTP(path = "projects/{projectId}/images/tags", method = "DELETE", hasBody = true) - Observable> deleteImageTags(@Path("projectId") UUID projectId, @Query("imageIds") String imageIds, @Query("tagIds") String tagIds, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings createImageTags" }) - @POST("projects/{projectId}/images/tags") - Observable> createImageTags(@Path("projectId") UUID projectId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Body ImageTagCreateBatch batch, @Header("User-Agent") String userAgent); + @POST("projects/{projectId}/images/{imageId}/regionproposals") + Observable> getImageRegionProposals(@Path("projectId") UUID projectId, @Path("imageId") UUID imageId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings createImagesFromPredictions" }) @POST("projects/{projectId}/images/predictions") - Observable> createImagesFromPredictions(@Path("projectId") UUID projectId, @Body ImageIdCreateBatch batch, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> createImagesFromPredictions(@Path("projectId") UUID projectId, @Body ImageIdCreateBatch batch, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings createImagesFromUrls" }) @POST("projects/{projectId}/images/urls") - Observable> createImagesFromUrls(@Path("projectId") UUID projectId, @Body ImageUrlCreateBatch batch, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> createImagesFromUrls(@Path("projectId") UUID projectId, @Body ImageUrlCreateBatch batch, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings createImagesFromFiles" }) @POST("projects/{projectId}/images/files") - Observable> createImagesFromFiles(@Path("projectId") UUID projectId, @Body ImageFileCreateBatch batch, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> createImagesFromFiles(@Path("projectId") UUID projectId, @Body ImageFileCreateBatch batch, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings deleteImages" }) @HTTP(path = "projects/{projectId}/images", method = "DELETE", hasBody = true) - Observable> deleteImages(@Path("projectId") UUID projectId, @Query("imageIds") String imageIds, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> deleteImages(@Path("projectId") UUID projectId, @Query("imageIds") String imageIds, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Multipart @POST("projects/{projectId}/images") - Observable> createImagesFromData(@Path("projectId") UUID projectId, @Query("tagIds") String tagIds, @Part("imageData") RequestBody imageData, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> createImagesFromData(@Path("projectId") UUID projectId, @Query("tagIds") String tagIds, @Part("imageData") RequestBody imageData, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings getImagesByIds" }) @GET("projects/{projectId}/images/id") - Observable> getImagesByIds(@Path("projectId") UUID projectId, @Query("imageIds") String imageIds, @Query("iterationId") UUID iterationId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings getUntaggedImageCount" }) - @GET("projects/{projectId}/images/untagged/count") - Observable> getUntaggedImageCount(@Path("projectId") UUID projectId, @Query("iterationId") UUID iterationId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); - - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings getTaggedImageCount" }) - @GET("projects/{projectId}/images/tagged/count") - Observable> getTaggedImageCount(@Path("projectId") UUID projectId, @Query("iterationId") UUID iterationId, @Query("tagIds") String tagIds, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> getImagesByIds(@Path("projectId") UUID projectId, @Query("imageIds") String imageIds, @Query("iterationId") UUID iterationId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings getUntaggedImages" }) @GET("projects/{projectId}/images/untagged") - Observable> getUntaggedImages(@Path("projectId") UUID projectId, @Query("iterationId") UUID iterationId, @Query("orderBy") String orderBy, @Query("take") Integer take, @Query("skip") Integer skip, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> getUntaggedImages(@Path("projectId") UUID projectId, @Query("iterationId") UUID iterationId, @Query("orderBy") String orderBy, @Query("take") Integer take, @Query("skip") Integer skip, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings getTaggedImages" }) @GET("projects/{projectId}/images/tagged") - Observable> getTaggedImages(@Path("projectId") UUID projectId, @Query("iterationId") UUID iterationId, @Query("tagIds") String tagIds, @Query("orderBy") String orderBy, @Query("take") Integer take, @Query("skip") Integer skip, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> getTaggedImages(@Path("projectId") UUID projectId, @Query("iterationId") UUID iterationId, @Query("tagIds") String tagIds, @Query("orderBy") String orderBy, @Query("take") Integer take, @Query("skip") Integer skip, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings deleteImageRegions" }) + @HTTP(path = "projects/{projectId}/images/regions", method = "DELETE", hasBody = true) + Observable> deleteImageRegions(@Path("projectId") UUID projectId, @Query("regionIds") String regionIds, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings createImageRegions" }) + @POST("projects/{projectId}/images/regions") + Observable> createImageRegions(@Path("projectId") UUID projectId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Body ImageRegionCreateBatch batch, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings deleteImageTags" }) + @HTTP(path = "projects/{projectId}/images/tags", method = "DELETE", hasBody = true) + Observable> deleteImageTags(@Path("projectId") UUID projectId, @Query("imageIds") String imageIds, @Query("tagIds") String tagIds, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings createImageTags" }) + @POST("projects/{projectId}/images/tags") + Observable> createImageTags(@Path("projectId") UUID projectId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Body ImageTagCreateBatch batch, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings getUntaggedImageCount" }) + @GET("projects/{projectId}/images/untagged/count") + Observable> getUntaggedImageCount(@Path("projectId") UUID projectId, @Query("iterationId") UUID iterationId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings getTaggedImageCount" }) + @GET("projects/{projectId}/images/tagged/count") + Observable> getTaggedImageCount(@Path("projectId") UUID projectId, @Query("iterationId") UUID iterationId, @Query("tagIds") String tagIds, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings getDomain" }) @GET("domains/{domainId}") - Observable> getDomain(@Path("domainId") UUID domainId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> getDomain(@Path("domainId") UUID domainId, @Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.cognitiveservices.vision.customvision.training.Trainings getDomains" }) @GET("domains") - Observable> getDomains(@Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> getDomains(@Header("Training-Key") String apiKey, @Header("accept-language") String acceptLanguage, @Header("x-ms-parameterized-host") String parameterizedHost, @Header("User-Agent") String userAgent); } @@ -275,11 +286,11 @@ interface TrainingsService { /** * Create a tag for the project. * - * @param projectId The project id - * @param name The tag name + * @param projectId The project id. + * @param name The tag name. * @param createTagOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the Tag object if successful. */ @@ -290,8 +301,8 @@ public Tag createTag(UUID projectId, String name, CreateTagOptionalParameter cre /** * Create a tag for the project. * - * @param projectId The project id - * @param name The tag name + * @param projectId The project id. + * @param name The tag name. * @param createTagOptionalParameter the object representing the optional parameters to be set before calling this API * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -304,8 +315,8 @@ public ServiceFuture createTagAsync(UUID projectId, String name, CreateTagO /** * Create a tag for the project. * - * @param projectId The project id - * @param name The tag name + * @param projectId The project id. + * @param name The tag name. * @param createTagOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the Tag object @@ -322,13 +333,16 @@ public Tag call(ServiceResponse response) { /** * Create a tag for the project. * - * @param projectId The project id - * @param name The tag name + * @param projectId The project id. + * @param name The tag name. * @param createTagOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the Tag object */ public Observable> createTagWithServiceResponseAsync(UUID projectId, String name, CreateTagOptionalParameter createTagOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } @@ -339,20 +353,25 @@ public Observable> createTagWithServiceResponseAsync(UUID p throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } final String description = createTagOptionalParameter != null ? createTagOptionalParameter.description() : null; + final String type = createTagOptionalParameter != null ? createTagOptionalParameter.type() : null; - return createTagWithServiceResponseAsync(projectId, name, description); + return createTagWithServiceResponseAsync(projectId, name, description, type); } /** * Create a tag for the project. * - * @param projectId The project id - * @param name The tag name - * @param description Optional description for the tag + * @param projectId The project id. + * @param name The tag name. + * @param description Optional description for the tag. + * @param type Optional type for the tag. Possible values include: 'Regular', 'Negative' * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the Tag object */ - public Observable> createTagWithServiceResponseAsync(UUID projectId, String name, String description) { + public Observable> createTagWithServiceResponseAsync(UUID projectId, String name, String description, String type) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } @@ -362,7 +381,8 @@ public Observable> createTagWithServiceResponseAsync(UUID p if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - return service.createTag(projectId, name, description, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.createTag(projectId, name, description, type, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -376,10 +396,10 @@ public Observable> call(Response response) { }); } - private ServiceResponse createTagDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse createTagDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .registerError(CustomVisionErrorException.class) .build(response); } @@ -396,6 +416,7 @@ class TrainingsCreateTagParameters implements TrainingsCreateTagDefinition { private UUID projectId; private String name; private String description; + private String type; /** * Constructor. @@ -423,14 +444,20 @@ public TrainingsCreateTagParameters withDescription(String description) { return this; } + @Override + public TrainingsCreateTagParameters withType(String type) { + this.type = type; + return this; + } + @Override public Tag execute() { - return createTagWithServiceResponseAsync(projectId, name, description).toBlocking().single().body(); + return createTagWithServiceResponseAsync(projectId, name, description, type).toBlocking().single().body(); } @Override public Observable executeAsync() { - return createTagWithServiceResponseAsync(projectId, name, description).map(new Func1, Tag>() { + return createTagWithServiceResponseAsync(projectId, name, description, type).map(new Func1, Tag>() { @Override public Tag call(ServiceResponse response) { return response.body(); @@ -443,10 +470,10 @@ public Tag call(ServiceResponse response) { /** * Get the tags for a given project and iteration. * - * @param projectId The project id + * @param projectId The project id. * @param getTagsOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the List<Tag> object if successful. */ @@ -457,7 +484,7 @@ public List getTags(UUID projectId, GetTagsOptionalParameter getTagsOptiona /** * Get the tags for a given project and iteration. * - * @param projectId The project id + * @param projectId The project id. * @param getTagsOptionalParameter the object representing the optional parameters to be set before calling this API * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -470,7 +497,7 @@ public ServiceFuture> getTagsAsync(UUID projectId, GetTagsOptionalPara /** * Get the tags for a given project and iteration. * - * @param projectId The project id + * @param projectId The project id. * @param getTagsOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<Tag> object @@ -487,12 +514,15 @@ public List call(ServiceResponse> response) { /** * Get the tags for a given project and iteration. * - * @param projectId The project id + * @param projectId The project id. * @param getTagsOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<Tag> object */ public Observable>> getTagsWithServiceResponseAsync(UUID projectId, GetTagsOptionalParameter getTagsOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } @@ -507,19 +537,23 @@ public Observable>> getTagsWithServiceResponseAsync(UU /** * Get the tags for a given project and iteration. * - * @param projectId The project id - * @param iterationId The iteration id. Defaults to workspace + * @param projectId The project id. + * @param iterationId The iteration id. Defaults to workspace. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<Tag> object */ public Observable>> getTagsWithServiceResponseAsync(UUID projectId, UUID iterationId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - return service.getTags(projectId, iterationId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.getTags(projectId, iterationId, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -533,10 +567,10 @@ public Observable>> call(Response respon }); } - private ServiceResponse> getTagsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + private ServiceResponse> getTagsDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CustomVisionErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken>() { }.getType()) - .registerError(CloudException.class) + .registerError(CustomVisionErrorException.class) .build(response); } @@ -592,11 +626,11 @@ public List call(ServiceResponse> response) { /** * Update a tag. * - * @param projectId The project id - * @param tagId The id of the target tag - * @param updatedTag The updated tag model + * @param projectId The project id. + * @param tagId The id of the target tag. + * @param updatedTag The updated tag model. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the Tag object if successful. */ @@ -607,9 +641,9 @@ public Tag updateTag(UUID projectId, UUID tagId, Tag updatedTag) { /** * Update a tag. * - * @param projectId The project id - * @param tagId The id of the target tag - * @param updatedTag The updated tag model + * @param projectId The project id. + * @param tagId The id of the target tag. + * @param updatedTag The updated tag model. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -621,9 +655,9 @@ public ServiceFuture updateTagAsync(UUID projectId, UUID tagId, Tag updated /** * Update a tag. * - * @param projectId The project id - * @param tagId The id of the target tag - * @param updatedTag The updated tag model + * @param projectId The project id. + * @param tagId The id of the target tag. + * @param updatedTag The updated tag model. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the Tag object */ @@ -639,13 +673,16 @@ public Tag call(ServiceResponse response) { /** * Update a tag. * - * @param projectId The project id - * @param tagId The id of the target tag - * @param updatedTag The updated tag model + * @param projectId The project id. + * @param tagId The id of the target tag. + * @param updatedTag The updated tag model. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the Tag object */ public Observable> updateTagWithServiceResponseAsync(UUID projectId, UUID tagId, Tag updatedTag) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } @@ -659,7 +696,8 @@ public Observable> updateTagWithServiceResponseAsync(UUID p throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } Validator.validate(updatedTag); - return service.updateTag(projectId, tagId, updatedTag, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.updateTag(projectId, tagId, updatedTag, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -673,20 +711,20 @@ public Observable> call(Response response) { }); } - private ServiceResponse updateTagDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse updateTagDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .registerError(CustomVisionErrorException.class) .build(response); } /** * Delete a tag from the project. * - * @param projectId The project id - * @param tagId Id of the tag to be deleted + * @param projectId The project id. + * @param tagId Id of the tag to be deleted. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void deleteTag(UUID projectId, UUID tagId) { @@ -696,8 +734,8 @@ public void deleteTag(UUID projectId, UUID tagId) { /** * Delete a tag from the project. * - * @param projectId The project id - * @param tagId Id of the tag to be deleted + * @param projectId The project id. + * @param tagId Id of the tag to be deleted. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -709,8 +747,8 @@ public ServiceFuture deleteTagAsync(UUID projectId, UUID tagId, final Serv /** * Delete a tag from the project. * - * @param projectId The project id - * @param tagId Id of the tag to be deleted + * @param projectId The project id. + * @param tagId Id of the tag to be deleted. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ @@ -726,12 +764,15 @@ public Void call(ServiceResponse response) { /** * Delete a tag from the project. * - * @param projectId The project id - * @param tagId Id of the tag to be deleted + * @param projectId The project id. + * @param tagId Id of the tag to be deleted. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable> deleteTagWithServiceResponseAsync(UUID projectId, UUID tagId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } @@ -741,7 +782,8 @@ public Observable> deleteTagWithServiceResponseAsync(UUID if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - return service.deleteTag(projectId, tagId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.deleteTag(projectId, tagId, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -755,10 +797,10 @@ public Observable> call(Response response) { }); } - private ServiceResponse deleteTagDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse deleteTagDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(204, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .registerError(CustomVisionErrorException.class) .build(response); } @@ -766,11 +808,11 @@ private ServiceResponse deleteTagDelegate(Response response) /** * Get information about a specific tag. * - * @param projectId The project this tag belongs to - * @param tagId The tag id + * @param projectId The project this tag belongs to. + * @param tagId The tag id. * @param getTagOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the Tag object if successful. */ @@ -781,8 +823,8 @@ public Tag getTag(UUID projectId, UUID tagId, GetTagOptionalParameter getTagOpti /** * Get information about a specific tag. * - * @param projectId The project this tag belongs to - * @param tagId The tag id + * @param projectId The project this tag belongs to. + * @param tagId The tag id. * @param getTagOptionalParameter the object representing the optional parameters to be set before calling this API * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -795,8 +837,8 @@ public ServiceFuture getTagAsync(UUID projectId, UUID tagId, GetTagOptional /** * Get information about a specific tag. * - * @param projectId The project this tag belongs to - * @param tagId The tag id + * @param projectId The project this tag belongs to. + * @param tagId The tag id. * @param getTagOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the Tag object @@ -813,13 +855,16 @@ public Tag call(ServiceResponse response) { /** * Get information about a specific tag. * - * @param projectId The project this tag belongs to - * @param tagId The tag id + * @param projectId The project this tag belongs to. + * @param tagId The tag id. * @param getTagOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the Tag object */ public Observable> getTagWithServiceResponseAsync(UUID projectId, UUID tagId, GetTagOptionalParameter getTagOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } @@ -837,13 +882,16 @@ public Observable> getTagWithServiceResponseAsync(UUID proj /** * Get information about a specific tag. * - * @param projectId The project this tag belongs to - * @param tagId The tag id - * @param iterationId The iteration to retrieve this tag from. Optional, defaults to current training set + * @param projectId The project this tag belongs to. + * @param tagId The tag id. + * @param iterationId The iteration to retrieve this tag from. Optional, defaults to current training set. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the Tag object */ public Observable> getTagWithServiceResponseAsync(UUID projectId, UUID tagId, UUID iterationId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } @@ -853,7 +901,8 @@ public Observable> getTagWithServiceResponseAsync(UUID proj if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - return service.getTag(projectId, tagId, iterationId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.getTag(projectId, tagId, iterationId, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -867,10 +916,10 @@ public Observable> call(Response response) { }); } - private ServiceResponse getTagDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse getTagDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .registerError(CustomVisionErrorException.class) .build(response); } @@ -934,12 +983,12 @@ public Tag call(ServiceResponse response) { /** * Export a trained iteration. * - * @param projectId The project id - * @param iterationId The iteration id - * @param platform The target platform (coreml or tensorflow). Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', 'ONNX' + * @param projectId The project id. + * @param iterationId The iteration id. + * @param platform The target platform. Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', 'ONNX', 'VAIDK' * @param exportIterationOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the Export object if successful. */ @@ -950,9 +999,9 @@ public Export exportIteration(UUID projectId, UUID iterationId, String platform, /** * Export a trained iteration. * - * @param projectId The project id - * @param iterationId The iteration id - * @param platform The target platform (coreml or tensorflow). Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', 'ONNX' + * @param projectId The project id. + * @param iterationId The iteration id. + * @param platform The target platform. Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', 'ONNX', 'VAIDK' * @param exportIterationOptionalParameter the object representing the optional parameters to be set before calling this API * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -965,9 +1014,9 @@ public ServiceFuture exportIterationAsync(UUID projectId, UUID iteration /** * Export a trained iteration. * - * @param projectId The project id - * @param iterationId The iteration id - * @param platform The target platform (coreml or tensorflow). Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', 'ONNX' + * @param projectId The project id. + * @param iterationId The iteration id. + * @param platform The target platform. Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', 'ONNX', 'VAIDK' * @param exportIterationOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the Export object @@ -984,14 +1033,17 @@ public Export call(ServiceResponse response) { /** * Export a trained iteration. * - * @param projectId The project id - * @param iterationId The iteration id - * @param platform The target platform (coreml or tensorflow). Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', 'ONNX' + * @param projectId The project id. + * @param iterationId The iteration id. + * @param platform The target platform. Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', 'ONNX', 'VAIDK' * @param exportIterationOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the Export object */ public Observable> exportIterationWithServiceResponseAsync(UUID projectId, UUID iterationId, String platform, ExportIterationOptionalParameter exportIterationOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } @@ -1012,14 +1064,17 @@ public Observable> exportIterationWithServiceResponseAsy /** * Export a trained iteration. * - * @param projectId The project id - * @param iterationId The iteration id - * @param platform The target platform (coreml or tensorflow). Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', 'ONNX' - * @param flavor The flavor of the target platform (Windows, Linux, ARM, or GPU). Possible values include: 'Linux', 'Windows' + * @param projectId The project id. + * @param iterationId The iteration id. + * @param platform The target platform. Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', 'ONNX', 'VAIDK' + * @param flavor The flavor of the target platform. Possible values include: 'Linux', 'Windows', 'ONNX10', 'ONNX12', 'ARM' * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the Export object */ public Observable> exportIterationWithServiceResponseAsync(UUID projectId, UUID iterationId, String platform, String flavor) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } @@ -1032,7 +1087,8 @@ public Observable> exportIterationWithServiceResponseAsy if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - return service.exportIteration(projectId, iterationId, platform, flavor, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.exportIteration(projectId, iterationId, platform, flavor, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1046,10 +1102,10 @@ public Observable> call(Response response) }); } - private ServiceResponse exportIterationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse exportIterationDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .registerError(CustomVisionErrorException.class) .build(response); } @@ -1119,10 +1175,10 @@ public Export call(ServiceResponse response) { /** * Get the list of exports for a specific iteration. * - * @param projectId The project id - * @param iterationId The iteration id + * @param projectId The project id. + * @param iterationId The iteration id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the List<Export> object if successful. */ @@ -1133,8 +1189,8 @@ public List getExports(UUID projectId, UUID iterationId) { /** * Get the list of exports for a specific iteration. * - * @param projectId The project id - * @param iterationId The iteration id + * @param projectId The project id. + * @param iterationId The iteration id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -1146,8 +1202,8 @@ public ServiceFuture> getExportsAsync(UUID projectId, UUID iteratio /** * Get the list of exports for a specific iteration. * - * @param projectId The project id - * @param iterationId The iteration id + * @param projectId The project id. + * @param iterationId The iteration id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<Export> object */ @@ -1163,12 +1219,15 @@ public List call(ServiceResponse> response) { /** * Get the list of exports for a specific iteration. * - * @param projectId The project id - * @param iterationId The iteration id + * @param projectId The project id. + * @param iterationId The iteration id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<Export> object */ public Observable>> getExportsWithServiceResponseAsync(UUID projectId, UUID iterationId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } @@ -1178,7 +1237,8 @@ public Observable>> getExportsWithServiceResponseAs if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - return service.getExports(projectId, iterationId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.getExports(projectId, iterationId, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -1192,83 +1252,68 @@ public Observable>> call(Response res }); } - private ServiceResponse> getExportsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + private ServiceResponse> getExportsDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CustomVisionErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken>() { }.getType()) - .registerError(CloudException.class) + .registerError(CustomVisionErrorException.class) .build(response); } - /** - * Gets the number of images tagged with the provided {tagIds} that have prediction results from - training for the provided iteration {iterationId}. - * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and - "Cat" tags, then only images tagged with Dog and/or Cat will be returned. + * Unpublish a specific iteration. * - * @param projectId The project id - * @param iterationId The iteration id. Defaults to workspace - * @param getImagePerformanceCountOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param iterationId The iteration id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the int object if successful. */ - public int getImagePerformanceCount(UUID projectId, UUID iterationId, GetImagePerformanceCountOptionalParameter getImagePerformanceCountOptionalParameter) { - return getImagePerformanceCountWithServiceResponseAsync(projectId, iterationId, getImagePerformanceCountOptionalParameter).toBlocking().single().body(); + public void unpublishIteration(UUID projectId, UUID iterationId) { + unpublishIterationWithServiceResponseAsync(projectId, iterationId).toBlocking().single().body(); } /** - * Gets the number of images tagged with the provided {tagIds} that have prediction results from - training for the provided iteration {iterationId}. - * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and - "Cat" tags, then only images tagged with Dog and/or Cat will be returned. + * Unpublish a specific iteration. * - * @param projectId The project id - * @param iterationId The iteration id. Defaults to workspace - * @param getImagePerformanceCountOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param iterationId The iteration id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture getImagePerformanceCountAsync(UUID projectId, UUID iterationId, GetImagePerformanceCountOptionalParameter getImagePerformanceCountOptionalParameter, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getImagePerformanceCountWithServiceResponseAsync(projectId, iterationId, getImagePerformanceCountOptionalParameter), serviceCallback); + public ServiceFuture unpublishIterationAsync(UUID projectId, UUID iterationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(unpublishIterationWithServiceResponseAsync(projectId, iterationId), serviceCallback); } /** - * Gets the number of images tagged with the provided {tagIds} that have prediction results from - training for the provided iteration {iterationId}. - * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and - "Cat" tags, then only images tagged with Dog and/or Cat will be returned. + * Unpublish a specific iteration. * - * @param projectId The project id - * @param iterationId The iteration id. Defaults to workspace - * @param getImagePerformanceCountOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param iterationId The iteration id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Integer object + * @return the {@link ServiceResponse} object if successful. */ - public Observable getImagePerformanceCountAsync(UUID projectId, UUID iterationId, GetImagePerformanceCountOptionalParameter getImagePerformanceCountOptionalParameter) { - return getImagePerformanceCountWithServiceResponseAsync(projectId, iterationId, getImagePerformanceCountOptionalParameter).map(new Func1, Integer>() { + public Observable unpublishIterationAsync(UUID projectId, UUID iterationId) { + return unpublishIterationWithServiceResponseAsync(projectId, iterationId).map(new Func1, Void>() { @Override - public Integer call(ServiceResponse response) { + public Void call(ServiceResponse response) { return response.body(); } }); } /** - * Gets the number of images tagged with the provided {tagIds} that have prediction results from - training for the provided iteration {iterationId}. - * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and - "Cat" tags, then only images tagged with Dog and/or Cat will be returned. + * Unpublish a specific iteration. * - * @param projectId The project id - * @param iterationId The iteration id. Defaults to workspace - * @param getImagePerformanceCountOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param iterationId The iteration id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Integer object + * @return the {@link ServiceResponse} object if successful. */ - public Observable> getImagePerformanceCountWithServiceResponseAsync(UUID projectId, UUID iterationId, GetImagePerformanceCountOptionalParameter getImagePerformanceCountOptionalParameter) { + public Observable> unpublishIterationWithServiceResponseAsync(UUID projectId, UUID iterationId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } @@ -1278,41 +1323,114 @@ public Observable> getImagePerformanceCountWithServiceR if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - final List tagIds = getImagePerformanceCountOptionalParameter != null ? getImagePerformanceCountOptionalParameter.tagIds() : null; + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.unpublishIteration(projectId, iterationId, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = unpublishIterationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } - return getImagePerformanceCountWithServiceResponseAsync(projectId, iterationId, tagIds); + private ServiceResponse unpublishIterationDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) + .build(response); } /** - * Gets the number of images tagged with the provided {tagIds} that have prediction results from - training for the provided iteration {iterationId}. - * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and - "Cat" tags, then only images tagged with Dog and/or Cat will be returned. + * Publish a specific iteration. * - * @param projectId The project id - * @param iterationId The iteration id. Defaults to workspace - * @param tagIds A list of tags ids to filter the images to count. Defaults to all tags when null. + * @param projectId The project id. + * @param iterationId The iteration id. + * @param publishName The name to give the published iteration. + * @param predictionId The id of the prediction resource to publish to. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Integer object + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the boolean object if successful. + */ + public boolean publishIteration(UUID projectId, UUID iterationId, String publishName, String predictionId) { + return publishIterationWithServiceResponseAsync(projectId, iterationId, publishName, predictionId).toBlocking().single().body(); + } + + /** + * Publish a specific iteration. + * + * @param projectId The project id. + * @param iterationId The iteration id. + * @param publishName The name to give the published iteration. + * @param predictionId The id of the prediction resource to publish to. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture publishIterationAsync(UUID projectId, UUID iterationId, String publishName, String predictionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(publishIterationWithServiceResponseAsync(projectId, iterationId, publishName, predictionId), serviceCallback); + } + + /** + * Publish a specific iteration. + * + * @param projectId The project id. + * @param iterationId The iteration id. + * @param publishName The name to give the published iteration. + * @param predictionId The id of the prediction resource to publish to. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable publishIterationAsync(UUID projectId, UUID iterationId, String publishName, String predictionId) { + return publishIterationWithServiceResponseAsync(projectId, iterationId, publishName, predictionId).map(new Func1, Boolean>() { + @Override + public Boolean call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Publish a specific iteration. + * + * @param projectId The project id. + * @param iterationId The iteration id. + * @param publishName The name to give the published iteration. + * @param predictionId The id of the prediction resource to publish to. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object */ - public Observable> getImagePerformanceCountWithServiceResponseAsync(UUID projectId, UUID iterationId, List tagIds) { + public Observable> publishIterationWithServiceResponseAsync(UUID projectId, UUID iterationId, String publishName, String predictionId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (iterationId == null) { throw new IllegalArgumentException("Parameter iterationId is required and cannot be null."); } + if (publishName == null) { + throw new IllegalArgumentException("Parameter publishName is required and cannot be null."); + } + if (predictionId == null) { + throw new IllegalArgumentException("Parameter predictionId is required and cannot be null."); + } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - Validator.validate(tagIds); - String tagIdsConverted = this.client.serializerAdapter().serializeList(tagIds, CollectionFormat.CSV); - return service.getImagePerformanceCount(projectId, iterationId, tagIdsConverted, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.publishIteration(projectId, iterationId, publishName, predictionId, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = getImagePerformanceCountDelegate(response); + ServiceResponse clientResponse = publishIterationDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1321,177 +1439,164 @@ public Observable> call(Response response }); } - private ServiceResponse getImagePerformanceCountDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse publishIterationDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } - @Override - public TrainingsGetImagePerformanceCountParameters getImagePerformanceCount() { - return new TrainingsGetImagePerformanceCountParameters(this); + /** + * Update a specific iteration. + * + * @param projectId Project id. + * @param iterationId Iteration id. + * @param name Gets or sets the name of the iteration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Iteration object if successful. + */ + public Iteration updateIteration(UUID projectId, UUID iterationId, String name) { + return updateIterationWithServiceResponseAsync(projectId, iterationId, name).toBlocking().single().body(); } /** - * Internal class implementing TrainingsGetImagePerformanceCountDefinition. + * Update a specific iteration. + * + * @param projectId Project id. + * @param iterationId Iteration id. + * @param name Gets or sets the name of the iteration. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object */ - class TrainingsGetImagePerformanceCountParameters implements TrainingsGetImagePerformanceCountDefinition { - private TrainingsImpl parent; - private UUID projectId; - private UUID iterationId; - private List tagIds; - - /** - * Constructor. - * @param parent the parent object. - */ - TrainingsGetImagePerformanceCountParameters(TrainingsImpl parent) { - this.parent = parent; - } - - @Override - public TrainingsGetImagePerformanceCountParameters withProjectId(UUID projectId) { - this.projectId = projectId; - return this; - } + public ServiceFuture updateIterationAsync(UUID projectId, UUID iterationId, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateIterationWithServiceResponseAsync(projectId, iterationId, name), serviceCallback); + } - @Override - public TrainingsGetImagePerformanceCountParameters withIterationId(UUID iterationId) { - this.iterationId = iterationId; - return this; - } - - @Override - public TrainingsGetImagePerformanceCountParameters withTagIds(List tagIds) { - this.tagIds = tagIds; - return this; - } - - @Override - public int execute() { - return getImagePerformanceCountWithServiceResponseAsync(projectId, iterationId, tagIds).toBlocking().single().body(); + /** + * Update a specific iteration. + * + * @param projectId Project id. + * @param iterationId Iteration id. + * @param name Gets or sets the name of the iteration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Iteration object + */ + public Observable updateIterationAsync(UUID projectId, UUID iterationId, String name) { + return updateIterationWithServiceResponseAsync(projectId, iterationId, name).map(new Func1, Iteration>() { + @Override + public Iteration call(ServiceResponse response) { + return response.body(); + } + }); } - @Override - public Observable executeAsync() { - return getImagePerformanceCountWithServiceResponseAsync(projectId, iterationId, tagIds).map(new Func1, Integer>() { + /** + * Update a specific iteration. + * + * @param projectId Project id. + * @param iterationId Iteration id. + * @param name Gets or sets the name of the iteration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Iteration object + */ + public Observable> updateIterationWithServiceResponseAsync(UUID projectId, UUID iterationId, String name) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (projectId == null) { + throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); + } + if (iterationId == null) { + throw new IllegalArgumentException("Parameter iterationId is required and cannot be null."); + } + if (this.client.apiKey() == null) { + throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + Iteration updatedIteration = new Iteration(); + updatedIteration.withName(name); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.updateIteration(projectId, iterationId, this.client.apiKey(), this.client.acceptLanguage(), updatedIteration, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Integer call(ServiceResponse response) { - return response.body(); + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateIterationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } } }); - } } + private ServiceResponse updateIterationDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) + .build(response); + } /** - * Get image with its prediction for a given project iteration. - * This API supports batching and range selection. By default it will only return first 50 images matching images. - Use the {take} and {skip} parameters to control how many images to return in a given batch. - The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and - "Cat" tags, then only images tagged with Dog and/or Cat will be returned. + * Delete a specific iteration of a project. * - * @param projectId The project id - * @param iterationId The iteration id. Defaults to workspace - * @param getImagePerformancesOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param iterationId The iteration id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the List<ImagePerformance> object if successful. */ - public List getImagePerformances(UUID projectId, UUID iterationId, GetImagePerformancesOptionalParameter getImagePerformancesOptionalParameter) { - return getImagePerformancesWithServiceResponseAsync(projectId, iterationId, getImagePerformancesOptionalParameter).toBlocking().single().body(); + public void deleteIteration(UUID projectId, UUID iterationId) { + deleteIterationWithServiceResponseAsync(projectId, iterationId).toBlocking().single().body(); } /** - * Get image with its prediction for a given project iteration. - * This API supports batching and range selection. By default it will only return first 50 images matching images. - Use the {take} and {skip} parameters to control how many images to return in a given batch. - The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and - "Cat" tags, then only images tagged with Dog and/or Cat will be returned. + * Delete a specific iteration of a project. * - * @param projectId The project id - * @param iterationId The iteration id. Defaults to workspace - * @param getImagePerformancesOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param iterationId The iteration id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> getImagePerformancesAsync(UUID projectId, UUID iterationId, GetImagePerformancesOptionalParameter getImagePerformancesOptionalParameter, final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(getImagePerformancesWithServiceResponseAsync(projectId, iterationId, getImagePerformancesOptionalParameter), serviceCallback); + public ServiceFuture deleteIterationAsync(UUID projectId, UUID iterationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteIterationWithServiceResponseAsync(projectId, iterationId), serviceCallback); } /** - * Get image with its prediction for a given project iteration. - * This API supports batching and range selection. By default it will only return first 50 images matching images. - Use the {take} and {skip} parameters to control how many images to return in a given batch. - The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and - "Cat" tags, then only images tagged with Dog and/or Cat will be returned. + * Delete a specific iteration of a project. * - * @param projectId The project id - * @param iterationId The iteration id. Defaults to workspace - * @param getImagePerformancesOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param iterationId The iteration id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<ImagePerformance> object + * @return the {@link ServiceResponse} object if successful. */ - public Observable> getImagePerformancesAsync(UUID projectId, UUID iterationId, GetImagePerformancesOptionalParameter getImagePerformancesOptionalParameter) { - return getImagePerformancesWithServiceResponseAsync(projectId, iterationId, getImagePerformancesOptionalParameter).map(new Func1>, List>() { + public Observable deleteIterationAsync(UUID projectId, UUID iterationId) { + return deleteIterationWithServiceResponseAsync(projectId, iterationId).map(new Func1, Void>() { @Override - public List call(ServiceResponse> response) { + public Void call(ServiceResponse response) { return response.body(); } }); } /** - * Get image with its prediction for a given project iteration. - * This API supports batching and range selection. By default it will only return first 50 images matching images. - Use the {take} and {skip} parameters to control how many images to return in a given batch. - The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and - "Cat" tags, then only images tagged with Dog and/or Cat will be returned. + * Delete a specific iteration of a project. * - * @param projectId The project id - * @param iterationId The iteration id. Defaults to workspace - * @param getImagePerformancesOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param iterationId The iteration id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<ImagePerformance> object + * @return the {@link ServiceResponse} object if successful. */ - public Observable>> getImagePerformancesWithServiceResponseAsync(UUID projectId, UUID iterationId, GetImagePerformancesOptionalParameter getImagePerformancesOptionalParameter) { - if (projectId == null) { - throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); - } - if (iterationId == null) { - throw new IllegalArgumentException("Parameter iterationId is required and cannot be null."); - } - if (this.client.apiKey() == null) { - throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); + public Observable> deleteIterationWithServiceResponseAsync(UUID projectId, UUID iterationId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } - final List tagIds = getImagePerformancesOptionalParameter != null ? getImagePerformancesOptionalParameter.tagIds() : null; - final String orderBy = getImagePerformancesOptionalParameter != null ? getImagePerformancesOptionalParameter.orderBy() : null; - final Integer take = getImagePerformancesOptionalParameter != null ? getImagePerformancesOptionalParameter.take() : null; - final Integer skip = getImagePerformancesOptionalParameter != null ? getImagePerformancesOptionalParameter.skip() : null; - - return getImagePerformancesWithServiceResponseAsync(projectId, iterationId, tagIds, orderBy, take, skip); - } - - /** - * Get image with its prediction for a given project iteration. - * This API supports batching and range selection. By default it will only return first 50 images matching images. - Use the {take} and {skip} parameters to control how many images to return in a given batch. - The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and - "Cat" tags, then only images tagged with Dog and/or Cat will be returned. - * - * @param projectId The project id - * @param iterationId The iteration id. Defaults to workspace - * @param tagIds A list of tags ids to filter the images. Defaults to all tagged images when null. Limited to 20 - * @param orderBy The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest' - * @param take Maximum number of images to return. Defaults to 50, limited to 256 - * @param skip Number of images to skip before beginning the image batch. Defaults to 0 - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<ImagePerformance> object - */ - public Observable>> getImagePerformancesWithServiceResponseAsync(UUID projectId, UUID iterationId, List tagIds, String orderBy, Integer take, Integer skip) { if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } @@ -1501,14 +1606,13 @@ public Observable>> getImagePerformancesW if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - Validator.validate(tagIds); - String tagIdsConverted = this.client.serializerAdapter().serializeList(tagIds, CollectionFormat.CSV); - return service.getImagePerformances(projectId, iterationId, tagIdsConverted, orderBy, take, skip, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.deleteIteration(projectId, iterationId, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable>> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse> clientResponse = getImagePerformancesDelegate(response); + ServiceResponse clientResponse = deleteIterationDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1517,148 +1621,69 @@ public Observable>> call(Response> getImagePerformancesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse deleteIterationDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } - @Override - public TrainingsGetImagePerformancesParameters getImagePerformances() { - return new TrainingsGetImagePerformancesParameters(this); - } - - /** - * Internal class implementing TrainingsGetImagePerformancesDefinition. - */ - class TrainingsGetImagePerformancesParameters implements TrainingsGetImagePerformancesDefinition { - private TrainingsImpl parent; - private UUID projectId; - private UUID iterationId; - private List tagIds; - private String orderBy; - private Integer take; - private Integer skip; - - /** - * Constructor. - * @param parent the parent object. - */ - TrainingsGetImagePerformancesParameters(TrainingsImpl parent) { - this.parent = parent; - } - - @Override - public TrainingsGetImagePerformancesParameters withProjectId(UUID projectId) { - this.projectId = projectId; - return this; - } - - @Override - public TrainingsGetImagePerformancesParameters withIterationId(UUID iterationId) { - this.iterationId = iterationId; - return this; - } - - @Override - public TrainingsGetImagePerformancesParameters withTagIds(List tagIds) { - this.tagIds = tagIds; - return this; - } - - @Override - public TrainingsGetImagePerformancesParameters withOrderBy(String orderBy) { - this.orderBy = orderBy; - return this; - } - - @Override - public TrainingsGetImagePerformancesParameters withTake(Integer take) { - this.take = take; - return this; - } - - @Override - public TrainingsGetImagePerformancesParameters withSkip(Integer skip) { - this.skip = skip; - return this; - } - - @Override - public List execute() { - return getImagePerformancesWithServiceResponseAsync(projectId, iterationId, tagIds, orderBy, take, skip).toBlocking().single().body(); - } - - @Override - public Observable> executeAsync() { - return getImagePerformancesWithServiceResponseAsync(projectId, iterationId, tagIds, orderBy, take, skip).map(new Func1>, List>() { - @Override - public List call(ServiceResponse> response) { - return response.body(); - } - }); - } - } - - /** - * Get detailed performance information about an iteration. + * Get a specific iteration. * - * @param projectId The id of the project the iteration belongs to - * @param iterationId The id of the iteration to get - * @param getIterationPerformanceOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The id of the project the iteration belongs to. + * @param iterationId The id of the iteration to get. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the IterationPerformance object if successful. + * @return the Iteration object if successful. */ - public IterationPerformance getIterationPerformance(UUID projectId, UUID iterationId, GetIterationPerformanceOptionalParameter getIterationPerformanceOptionalParameter) { - return getIterationPerformanceWithServiceResponseAsync(projectId, iterationId, getIterationPerformanceOptionalParameter).toBlocking().single().body(); + public Iteration getIteration(UUID projectId, UUID iterationId) { + return getIterationWithServiceResponseAsync(projectId, iterationId).toBlocking().single().body(); } /** - * Get detailed performance information about an iteration. + * Get a specific iteration. * - * @param projectId The id of the project the iteration belongs to - * @param iterationId The id of the iteration to get - * @param getIterationPerformanceOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The id of the project the iteration belongs to. + * @param iterationId The id of the iteration to get. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture getIterationPerformanceAsync(UUID projectId, UUID iterationId, GetIterationPerformanceOptionalParameter getIterationPerformanceOptionalParameter, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getIterationPerformanceWithServiceResponseAsync(projectId, iterationId, getIterationPerformanceOptionalParameter), serviceCallback); + public ServiceFuture getIterationAsync(UUID projectId, UUID iterationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getIterationWithServiceResponseAsync(projectId, iterationId), serviceCallback); } /** - * Get detailed performance information about an iteration. + * Get a specific iteration. * - * @param projectId The id of the project the iteration belongs to - * @param iterationId The id of the iteration to get - * @param getIterationPerformanceOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The id of the project the iteration belongs to. + * @param iterationId The id of the iteration to get. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the IterationPerformance object + * @return the observable to the Iteration object */ - public Observable getIterationPerformanceAsync(UUID projectId, UUID iterationId, GetIterationPerformanceOptionalParameter getIterationPerformanceOptionalParameter) { - return getIterationPerformanceWithServiceResponseAsync(projectId, iterationId, getIterationPerformanceOptionalParameter).map(new Func1, IterationPerformance>() { + public Observable getIterationAsync(UUID projectId, UUID iterationId) { + return getIterationWithServiceResponseAsync(projectId, iterationId).map(new Func1, Iteration>() { @Override - public IterationPerformance call(ServiceResponse response) { + public Iteration call(ServiceResponse response) { return response.body(); } }); } /** - * Get detailed performance information about an iteration. + * Get a specific iteration. * - * @param projectId The id of the project the iteration belongs to - * @param iterationId The id of the iteration to get - * @param getIterationPerformanceOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The id of the project the iteration belongs to. + * @param iterationId The id of the iteration to get. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the IterationPerformance object + * @return the observable to the Iteration object */ - public Observable> getIterationPerformanceWithServiceResponseAsync(UUID projectId, UUID iterationId, GetIterationPerformanceOptionalParameter getIterationPerformanceOptionalParameter) { + public Observable> getIterationWithServiceResponseAsync(UUID projectId, UUID iterationId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } @@ -1668,38 +1693,207 @@ public Observable> getIterationPerformance if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - final Double threshold = getIterationPerformanceOptionalParameter != null ? getIterationPerformanceOptionalParameter.threshold() : null; - final Double overlapThreshold = getIterationPerformanceOptionalParameter != null ? getIterationPerformanceOptionalParameter.overlapThreshold() : null; + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.getIteration(projectId, iterationId, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getIterationDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } - return getIterationPerformanceWithServiceResponseAsync(projectId, iterationId, threshold, overlapThreshold); + private ServiceResponse getIterationDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) + .build(response); } /** - * Get detailed performance information about an iteration. + * Get iterations for the project. * - * @param projectId The id of the project the iteration belongs to - * @param iterationId The id of the iteration to get - * @param threshold The threshold used to determine true predictions - * @param overlapThreshold If applicable, the bounding box overlap threshold used to determine true predictions + * @param projectId The project id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the IterationPerformance object + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<Iteration> object if successful. */ - public Observable> getIterationPerformanceWithServiceResponseAsync(UUID projectId, UUID iterationId, Double threshold, Double overlapThreshold) { + public List getIterations(UUID projectId) { + return getIterationsWithServiceResponseAsync(projectId).toBlocking().single().body(); + } + + /** + * Get iterations for the project. + * + * @param projectId The project id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> getIterationsAsync(UUID projectId, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(getIterationsWithServiceResponseAsync(projectId), serviceCallback); + } + + /** + * Get iterations for the project. + * + * @param projectId The project id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<Iteration> object + */ + public Observable> getIterationsAsync(UUID projectId) { + return getIterationsWithServiceResponseAsync(projectId).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get iterations for the project. + * + * @param projectId The project id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<Iteration> object + */ + public Observable>> getIterationsWithServiceResponseAsync(UUID projectId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } - if (iterationId == null) { - throw new IllegalArgumentException("Parameter iterationId is required and cannot be null."); + if (this.client.apiKey() == null) { + throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.getIterations(projectId, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> clientResponse = getIterationsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> getIterationsDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CustomVisionErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CustomVisionErrorException.class) + .build(response); + } + + + /** + * Queues project for training. + * + * @param projectId The project id. + * @param trainProjectOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Iteration object if successful. + */ + public Iteration trainProject(UUID projectId, TrainProjectOptionalParameter trainProjectOptionalParameter) { + return trainProjectWithServiceResponseAsync(projectId, trainProjectOptionalParameter).toBlocking().single().body(); + } + + /** + * Queues project for training. + * + * @param projectId The project id. + * @param trainProjectOptionalParameter the object representing the optional parameters to be set before calling this API + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture trainProjectAsync(UUID projectId, TrainProjectOptionalParameter trainProjectOptionalParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(trainProjectWithServiceResponseAsync(projectId, trainProjectOptionalParameter), serviceCallback); + } + + /** + * Queues project for training. + * + * @param projectId The project id. + * @param trainProjectOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Iteration object + */ + public Observable trainProjectAsync(UUID projectId, TrainProjectOptionalParameter trainProjectOptionalParameter) { + return trainProjectWithServiceResponseAsync(projectId, trainProjectOptionalParameter).map(new Func1, Iteration>() { + @Override + public Iteration call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Queues project for training. + * + * @param projectId The project id. + * @param trainProjectOptionalParameter the object representing the optional parameters to be set before calling this API + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Iteration object + */ + public Observable> trainProjectWithServiceResponseAsync(UUID projectId, TrainProjectOptionalParameter trainProjectOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (projectId == null) { + throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - return service.getIterationPerformance(projectId, iterationId, threshold, overlapThreshold, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + final String trainingType = trainProjectOptionalParameter != null ? trainProjectOptionalParameter.trainingType() : null; + final Integer reservedBudgetInHours = trainProjectOptionalParameter != null ? trainProjectOptionalParameter.reservedBudgetInHours() : null; + final Boolean forceTrain = trainProjectOptionalParameter != null ? trainProjectOptionalParameter.forceTrain() : null; + final String notificationEmailAddress = trainProjectOptionalParameter != null ? trainProjectOptionalParameter.notificationEmailAddress() : null; + + return trainProjectWithServiceResponseAsync(projectId, trainingType, reservedBudgetInHours, forceTrain, notificationEmailAddress); + } + + /** + * Queues project for training. + * + * @param projectId The project id. + * @param trainingType The type of training to use to train the project (default: Regular). Possible values include: 'Regular', 'Advanced' + * @param reservedBudgetInHours The number of hours reserved as budget for training (if applicable). + * @param forceTrain Whether to force train even if dataset and configuration does not change (default: false). + * @param notificationEmailAddress The email address to send notification to when training finishes (default: null). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Iteration object + */ + public Observable> trainProjectWithServiceResponseAsync(UUID projectId, String trainingType, Integer reservedBudgetInHours, Boolean forceTrain, String notificationEmailAddress) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (projectId == null) { + throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); + } + if (this.client.apiKey() == null) { + throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.trainProject(projectId, trainingType, reservedBudgetInHours, forceTrain, notificationEmailAddress, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = getIterationPerformanceDelegate(response); + ServiceResponse clientResponse = trainProjectDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1708,70 +1902,77 @@ public Observable> call(Response getIterationPerformanceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse trainProjectDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } @Override - public TrainingsGetIterationPerformanceParameters getIterationPerformance() { - return new TrainingsGetIterationPerformanceParameters(this); + public TrainingsTrainProjectParameters trainProject() { + return new TrainingsTrainProjectParameters(this); } /** - * Internal class implementing TrainingsGetIterationPerformanceDefinition. + * Internal class implementing TrainingsTrainProjectDefinition. */ - class TrainingsGetIterationPerformanceParameters implements TrainingsGetIterationPerformanceDefinition { + class TrainingsTrainProjectParameters implements TrainingsTrainProjectDefinition { private TrainingsImpl parent; private UUID projectId; - private UUID iterationId; - private Double threshold; - private Double overlapThreshold; + private String trainingType; + private Integer reservedBudgetInHours; + private Boolean forceTrain; + private String notificationEmailAddress; /** * Constructor. * @param parent the parent object. */ - TrainingsGetIterationPerformanceParameters(TrainingsImpl parent) { + TrainingsTrainProjectParameters(TrainingsImpl parent) { this.parent = parent; } @Override - public TrainingsGetIterationPerformanceParameters withProjectId(UUID projectId) { + public TrainingsTrainProjectParameters withProjectId(UUID projectId) { this.projectId = projectId; return this; } @Override - public TrainingsGetIterationPerformanceParameters withIterationId(UUID iterationId) { - this.iterationId = iterationId; + public TrainingsTrainProjectParameters withTrainingType(String trainingType) { + this.trainingType = trainingType; return this; } @Override - public TrainingsGetIterationPerformanceParameters withThreshold(Double threshold) { - this.threshold = threshold; + public TrainingsTrainProjectParameters withReservedBudgetInHours(Integer reservedBudgetInHours) { + this.reservedBudgetInHours = reservedBudgetInHours; return this; } @Override - public TrainingsGetIterationPerformanceParameters withOverlapThreshold(Double overlapThreshold) { - this.overlapThreshold = overlapThreshold; + public TrainingsTrainProjectParameters withForceTrain(Boolean forceTrain) { + this.forceTrain = forceTrain; return this; } @Override - public IterationPerformance execute() { - return getIterationPerformanceWithServiceResponseAsync(projectId, iterationId, threshold, overlapThreshold).toBlocking().single().body(); + public TrainingsTrainProjectParameters withNotificationEmailAddress(String notificationEmailAddress) { + this.notificationEmailAddress = notificationEmailAddress; + return this; + } + + @Override + public Iteration execute() { + return trainProjectWithServiceResponseAsync(projectId, trainingType, reservedBudgetInHours, forceTrain, notificationEmailAddress).toBlocking().single().body(); } @Override - public Observable executeAsync() { - return getIterationPerformanceWithServiceResponseAsync(projectId, iterationId, threshold, overlapThreshold).map(new Func1, IterationPerformance>() { + public Observable executeAsync() { + return trainProjectWithServiceResponseAsync(projectId, trainingType, reservedBudgetInHours, forceTrain, notificationEmailAddress).map(new Func1, Iteration>() { @Override - public IterationPerformance call(ServiceResponse response) { + public Iteration call(ServiceResponse response) { return response.body(); } }); @@ -1779,81 +1980,78 @@ public IterationPerformance call(ServiceResponse response) } /** - * Update a specific iteration. + * Update a specific project. * - * @param projectId Project id - * @param iterationId Iteration id - * @param updatedIteration The updated iteration model + * @param projectId The id of the project to update. + * @param updatedProject The updated project model. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the Iteration object if successful. + * @return the Project object if successful. */ - public Iteration updateIteration(UUID projectId, UUID iterationId, Iteration updatedIteration) { - return updateIterationWithServiceResponseAsync(projectId, iterationId, updatedIteration).toBlocking().single().body(); + public Project updateProject(UUID projectId, Project updatedProject) { + return updateProjectWithServiceResponseAsync(projectId, updatedProject).toBlocking().single().body(); } /** - * Update a specific iteration. + * Update a specific project. * - * @param projectId Project id - * @param iterationId Iteration id - * @param updatedIteration The updated iteration model + * @param projectId The id of the project to update. + * @param updatedProject The updated project model. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture updateIterationAsync(UUID projectId, UUID iterationId, Iteration updatedIteration, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(updateIterationWithServiceResponseAsync(projectId, iterationId, updatedIteration), serviceCallback); + public ServiceFuture updateProjectAsync(UUID projectId, Project updatedProject, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateProjectWithServiceResponseAsync(projectId, updatedProject), serviceCallback); } /** - * Update a specific iteration. + * Update a specific project. * - * @param projectId Project id - * @param iterationId Iteration id - * @param updatedIteration The updated iteration model + * @param projectId The id of the project to update. + * @param updatedProject The updated project model. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Iteration object + * @return the observable to the Project object */ - public Observable updateIterationAsync(UUID projectId, UUID iterationId, Iteration updatedIteration) { - return updateIterationWithServiceResponseAsync(projectId, iterationId, updatedIteration).map(new Func1, Iteration>() { + public Observable updateProjectAsync(UUID projectId, Project updatedProject) { + return updateProjectWithServiceResponseAsync(projectId, updatedProject).map(new Func1, Project>() { @Override - public Iteration call(ServiceResponse response) { + public Project call(ServiceResponse response) { return response.body(); } }); } /** - * Update a specific iteration. + * Update a specific project. * - * @param projectId Project id - * @param iterationId Iteration id - * @param updatedIteration The updated iteration model + * @param projectId The id of the project to update. + * @param updatedProject The updated project model. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Iteration object + * @return the observable to the Project object */ - public Observable> updateIterationWithServiceResponseAsync(UUID projectId, UUID iterationId, Iteration updatedIteration) { + public Observable> updateProjectWithServiceResponseAsync(UUID projectId, Project updatedProject) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } - if (iterationId == null) { - throw new IllegalArgumentException("Parameter iterationId is required and cannot be null."); - } - if (updatedIteration == null) { - throw new IllegalArgumentException("Parameter updatedIteration is required and cannot be null."); + if (updatedProject == null) { + throw new IllegalArgumentException("Parameter updatedProject is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - Validator.validate(updatedIteration); - return service.updateIteration(projectId, iterationId, updatedIteration, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + Validator.validate(updatedProject); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.updateProject(projectId, updatedProject, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = updateIterationDelegate(response); + ServiceResponse clientResponse = updateProjectDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1862,49 +2060,46 @@ public Observable> call(Response respon }); } - private ServiceResponse updateIterationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse updateProjectDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } /** - * Delete a specific iteration of a project. + * Delete a specific project. * - * @param projectId The project id - * @param iterationId The iteration id + * @param projectId The project id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ - public void deleteIteration(UUID projectId, UUID iterationId) { - deleteIterationWithServiceResponseAsync(projectId, iterationId).toBlocking().single().body(); + public void deleteProject(UUID projectId) { + deleteProjectWithServiceResponseAsync(projectId).toBlocking().single().body(); } /** - * Delete a specific iteration of a project. + * Delete a specific project. * - * @param projectId The project id - * @param iterationId The iteration id + * @param projectId The project id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture deleteIterationAsync(UUID projectId, UUID iterationId, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(deleteIterationWithServiceResponseAsync(projectId, iterationId), serviceCallback); + public ServiceFuture deleteProjectAsync(UUID projectId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteProjectWithServiceResponseAsync(projectId), serviceCallback); } /** - * Delete a specific iteration of a project. + * Delete a specific project. * - * @param projectId The project id - * @param iterationId The iteration id + * @param projectId The project id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ - public Observable deleteIterationAsync(UUID projectId, UUID iterationId) { - return deleteIterationWithServiceResponseAsync(projectId, iterationId).map(new Func1, Void>() { + public Observable deleteProjectAsync(UUID projectId) { + return deleteProjectWithServiceResponseAsync(projectId).map(new Func1, Void>() { @Override public Void call(ServiceResponse response) { return response.body(); @@ -1913,29 +2108,29 @@ public Void call(ServiceResponse response) { } /** - * Delete a specific iteration of a project. + * Delete a specific project. * - * @param projectId The project id - * @param iterationId The iteration id + * @param projectId The project id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ - public Observable> deleteIterationWithServiceResponseAsync(UUID projectId, UUID iterationId) { + public Observable> deleteProjectWithServiceResponseAsync(UUID projectId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } - if (iterationId == null) { - throw new IllegalArgumentException("Parameter iterationId is required and cannot be null."); - } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - return service.deleteIteration(projectId, iterationId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.deleteProject(projectId, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = deleteIterationDelegate(response); + ServiceResponse clientResponse = deleteProjectDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1944,81 +2139,78 @@ public Observable> call(Response response) { }); } - private ServiceResponse deleteIterationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse deleteProjectDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(204, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .registerError(CustomVisionErrorException.class) .build(response); } /** - * Get a specific iteration. + * Get a specific project. * - * @param projectId The id of the project the iteration belongs to - * @param iterationId The id of the iteration to get + * @param projectId The id of the project to get. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the Iteration object if successful. + * @return the Project object if successful. */ - public Iteration getIteration(UUID projectId, UUID iterationId) { - return getIterationWithServiceResponseAsync(projectId, iterationId).toBlocking().single().body(); + public Project getProject(UUID projectId) { + return getProjectWithServiceResponseAsync(projectId).toBlocking().single().body(); } /** - * Get a specific iteration. + * Get a specific project. * - * @param projectId The id of the project the iteration belongs to - * @param iterationId The id of the iteration to get + * @param projectId The id of the project to get. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture getIterationAsync(UUID projectId, UUID iterationId, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getIterationWithServiceResponseAsync(projectId, iterationId), serviceCallback); + public ServiceFuture getProjectAsync(UUID projectId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getProjectWithServiceResponseAsync(projectId), serviceCallback); } /** - * Get a specific iteration. + * Get a specific project. * - * @param projectId The id of the project the iteration belongs to - * @param iterationId The id of the iteration to get + * @param projectId The id of the project to get. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Iteration object + * @return the observable to the Project object */ - public Observable getIterationAsync(UUID projectId, UUID iterationId) { - return getIterationWithServiceResponseAsync(projectId, iterationId).map(new Func1, Iteration>() { + public Observable getProjectAsync(UUID projectId) { + return getProjectWithServiceResponseAsync(projectId).map(new Func1, Project>() { @Override - public Iteration call(ServiceResponse response) { + public Project call(ServiceResponse response) { return response.body(); } }); } /** - * Get a specific iteration. + * Get a specific project. * - * @param projectId The id of the project the iteration belongs to - * @param iterationId The id of the iteration to get + * @param projectId The id of the project to get. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Iteration object + * @return the observable to the Project object */ - public Observable> getIterationWithServiceResponseAsync(UUID projectId, UUID iterationId) { + public Observable> getProjectWithServiceResponseAsync(UUID projectId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } - if (iterationId == null) { - throw new IllegalArgumentException("Parameter iterationId is required and cannot be null."); - } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - return service.getIteration(projectId, iterationId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.getProject(projectId, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = getIterationDelegate(response); + ServiceResponse clientResponse = getProjectDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -2027,74 +2219,114 @@ public Observable> call(Response respon }); } - private ServiceResponse getIterationDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse getProjectDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } + /** - * Get iterations for the project. + * Create a project. * - * @param projectId The project id + * @param name Name of the project. + * @param createProjectOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the List<Iteration> object if successful. + * @return the Project object if successful. */ - public List getIterations(UUID projectId) { - return getIterationsWithServiceResponseAsync(projectId).toBlocking().single().body(); + public Project createProject(String name, CreateProjectOptionalParameter createProjectOptionalParameter) { + return createProjectWithServiceResponseAsync(name, createProjectOptionalParameter).toBlocking().single().body(); } /** - * Get iterations for the project. + * Create a project. * - * @param projectId The project id + * @param name Name of the project. + * @param createProjectOptionalParameter the object representing the optional parameters to be set before calling this API * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> getIterationsAsync(UUID projectId, final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(getIterationsWithServiceResponseAsync(projectId), serviceCallback); + public ServiceFuture createProjectAsync(String name, CreateProjectOptionalParameter createProjectOptionalParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createProjectWithServiceResponseAsync(name, createProjectOptionalParameter), serviceCallback); } /** - * Get iterations for the project. + * Create a project. * - * @param projectId The project id + * @param name Name of the project. + * @param createProjectOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<Iteration> object + * @return the observable to the Project object */ - public Observable> getIterationsAsync(UUID projectId) { - return getIterationsWithServiceResponseAsync(projectId).map(new Func1>, List>() { + public Observable createProjectAsync(String name, CreateProjectOptionalParameter createProjectOptionalParameter) { + return createProjectWithServiceResponseAsync(name, createProjectOptionalParameter).map(new Func1, Project>() { @Override - public List call(ServiceResponse> response) { + public Project call(ServiceResponse response) { return response.body(); } }); } /** - * Get iterations for the project. + * Create a project. * - * @param projectId The project id + * @param name Name of the project. + * @param createProjectOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<Iteration> object + * @return the observable to the Project object */ - public Observable>> getIterationsWithServiceResponseAsync(UUID projectId) { - if (projectId == null) { - throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); + public Observable> createProjectWithServiceResponseAsync(String name, CreateProjectOptionalParameter createProjectOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - return service.getIterations(projectId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + final String description = createProjectOptionalParameter != null ? createProjectOptionalParameter.description() : null; + final UUID domainId = createProjectOptionalParameter != null ? createProjectOptionalParameter.domainId() : null; + final String classificationType = createProjectOptionalParameter != null ? createProjectOptionalParameter.classificationType() : null; + final List targetExportPlatforms = createProjectOptionalParameter != null ? createProjectOptionalParameter.targetExportPlatforms() : null; + + return createProjectWithServiceResponseAsync(name, description, domainId, classificationType, targetExportPlatforms); + } + + /** + * Create a project. + * + * @param name Name of the project. + * @param description The description of the project. + * @param domainId The id of the domain to use for this project. Defaults to General. + * @param classificationType The type of classifier to create for this project. Possible values include: 'Multiclass', 'Multilabel' + * @param targetExportPlatforms List of platforms the trained model is intending exporting to. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Project object + */ + public Observable> createProjectWithServiceResponseAsync(String name, String description, UUID domainId, String classificationType, List targetExportPlatforms) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiKey() == null) { + throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); + } + Validator.validate(targetExportPlatforms); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + String targetExportPlatformsConverted = this.client.serializerAdapter().serializeList(targetExportPlatforms, CollectionFormat.CSV); + return service.createProject(name, description, domainId, classificationType, targetExportPlatformsConverted, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable>> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse> clientResponse = getIterationsDelegate(response); + ServiceResponse clientResponse = createProjectDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -2103,82 +2335,141 @@ public Observable>> call(Response }); } - private ServiceResponse> getIterationsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse createProjectDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } + @Override + public TrainingsCreateProjectParameters createProject() { + return new TrainingsCreateProjectParameters(this); + } + /** - * Update a specific project. + * Internal class implementing TrainingsCreateProjectDefinition. + */ + class TrainingsCreateProjectParameters implements TrainingsCreateProjectDefinition { + private TrainingsImpl parent; + private String name; + private String description; + private UUID domainId; + private String classificationType; + private List targetExportPlatforms; + + /** + * Constructor. + * @param parent the parent object. + */ + TrainingsCreateProjectParameters(TrainingsImpl parent) { + this.parent = parent; + } + + @Override + public TrainingsCreateProjectParameters withName(String name) { + this.name = name; + return this; + } + + @Override + public TrainingsCreateProjectParameters withDescription(String description) { + this.description = description; + return this; + } + + @Override + public TrainingsCreateProjectParameters withDomainId(UUID domainId) { + this.domainId = domainId; + return this; + } + + @Override + public TrainingsCreateProjectParameters withClassificationType(String classificationType) { + this.classificationType = classificationType; + return this; + } + + @Override + public TrainingsCreateProjectParameters withTargetExportPlatforms(List targetExportPlatforms) { + this.targetExportPlatforms = targetExportPlatforms; + return this; + } + + @Override + public Project execute() { + return createProjectWithServiceResponseAsync(name, description, domainId, classificationType, targetExportPlatforms).toBlocking().single().body(); + } + + @Override + public Observable executeAsync() { + return createProjectWithServiceResponseAsync(name, description, domainId, classificationType, targetExportPlatforms).map(new Func1, Project>() { + @Override + public Project call(ServiceResponse response) { + return response.body(); + } + }); + } + } + + /** + * Get your projects. * - * @param projectId The id of the project to update - * @param updatedProject The updated project model * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the Project object if successful. + * @return the List<Project> object if successful. */ - public Project updateProject(UUID projectId, Project updatedProject) { - return updateProjectWithServiceResponseAsync(projectId, updatedProject).toBlocking().single().body(); + public List getProjects() { + return getProjectsWithServiceResponseAsync().toBlocking().single().body(); } /** - * Update a specific project. + * Get your projects. * - * @param projectId The id of the project to update - * @param updatedProject The updated project model * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture updateProjectAsync(UUID projectId, Project updatedProject, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(updateProjectWithServiceResponseAsync(projectId, updatedProject), serviceCallback); + public ServiceFuture> getProjectsAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(getProjectsWithServiceResponseAsync(), serviceCallback); } /** - * Update a specific project. + * Get your projects. * - * @param projectId The id of the project to update - * @param updatedProject The updated project model * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Project object + * @return the observable to the List<Project> object */ - public Observable updateProjectAsync(UUID projectId, Project updatedProject) { - return updateProjectWithServiceResponseAsync(projectId, updatedProject).map(new Func1, Project>() { + public Observable> getProjectsAsync() { + return getProjectsWithServiceResponseAsync().map(new Func1>, List>() { @Override - public Project call(ServiceResponse response) { + public List call(ServiceResponse> response) { return response.body(); } }); } /** - * Update a specific project. + * Get your projects. * - * @param projectId The id of the project to update - * @param updatedProject The updated project model * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Project object + * @return the observable to the List<Project> object */ - public Observable> updateProjectWithServiceResponseAsync(UUID projectId, Project updatedProject) { - if (projectId == null) { - throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); - } - if (updatedProject == null) { - throw new IllegalArgumentException("Parameter updatedProject is required and cannot be null."); + public Observable>> getProjectsWithServiceResponseAsync() { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - Validator.validate(updatedProject); - return service.updateProject(projectId, updatedProject, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.getProjects(this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = updateProjectDelegate(response); + ServiceResponse> clientResponse = getProjectsDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -2187,149 +2478,134 @@ public Observable> call(Response response }); } - private ServiceResponse updateProjectDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse> getProjectsDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CustomVisionErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } + /** - * Delete a specific project. + * Gets the number of images tagged with the provided {tagIds} that have prediction results from + training for the provided iteration {iterationId}. + * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @param projectId The project id + * @param projectId The project id. + * @param iterationId The iteration id. Defaults to workspace. + * @param getImagePerformanceCountOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the int object if successful. */ - public void deleteProject(UUID projectId) { - deleteProjectWithServiceResponseAsync(projectId).toBlocking().single().body(); + public int getImagePerformanceCount(UUID projectId, UUID iterationId, GetImagePerformanceCountOptionalParameter getImagePerformanceCountOptionalParameter) { + return getImagePerformanceCountWithServiceResponseAsync(projectId, iterationId, getImagePerformanceCountOptionalParameter).toBlocking().single().body(); } /** - * Delete a specific project. + * Gets the number of images tagged with the provided {tagIds} that have prediction results from + training for the provided iteration {iterationId}. + * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @param projectId The project id + * @param projectId The project id. + * @param iterationId The iteration id. Defaults to workspace. + * @param getImagePerformanceCountOptionalParameter the object representing the optional parameters to be set before calling this API * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture deleteProjectAsync(UUID projectId, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(deleteProjectWithServiceResponseAsync(projectId), serviceCallback); + public ServiceFuture getImagePerformanceCountAsync(UUID projectId, UUID iterationId, GetImagePerformanceCountOptionalParameter getImagePerformanceCountOptionalParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getImagePerformanceCountWithServiceResponseAsync(projectId, iterationId, getImagePerformanceCountOptionalParameter), serviceCallback); } /** - * Delete a specific project. + * Gets the number of images tagged with the provided {tagIds} that have prediction results from + training for the provided iteration {iterationId}. + * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @param projectId The project id + * @param projectId The project id. + * @param iterationId The iteration id. Defaults to workspace. + * @param getImagePerformanceCountOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. + * @return the observable to the Integer object */ - public Observable deleteProjectAsync(UUID projectId) { - return deleteProjectWithServiceResponseAsync(projectId).map(new Func1, Void>() { + public Observable getImagePerformanceCountAsync(UUID projectId, UUID iterationId, GetImagePerformanceCountOptionalParameter getImagePerformanceCountOptionalParameter) { + return getImagePerformanceCountWithServiceResponseAsync(projectId, iterationId, getImagePerformanceCountOptionalParameter).map(new Func1, Integer>() { @Override - public Void call(ServiceResponse response) { + public Integer call(ServiceResponse response) { return response.body(); } }); } /** - * Delete a specific project. + * Gets the number of images tagged with the provided {tagIds} that have prediction results from + training for the provided iteration {iterationId}. + * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @param projectId The project id + * @param projectId The project id. + * @param iterationId The iteration id. Defaults to workspace. + * @param getImagePerformanceCountOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. + * @return the observable to the Integer object */ - public Observable> deleteProjectWithServiceResponseAsync(UUID projectId) { + public Observable> getImagePerformanceCountWithServiceResponseAsync(UUID projectId, UUID iterationId, GetImagePerformanceCountOptionalParameter getImagePerformanceCountOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } + if (iterationId == null) { + throw new IllegalArgumentException("Parameter iterationId is required and cannot be null."); + } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - return service.deleteProject(projectId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = deleteProjectDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse deleteProjectDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(204, new TypeToken() { }.getType()) - .registerError(CloudException.class) - .build(response); - } - - /** - * Get a specific project. - * - * @param projectId The id of the project to get - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the Project object if successful. - */ - public Project getProject(UUID projectId) { - return getProjectWithServiceResponseAsync(projectId).toBlocking().single().body(); - } - - /** - * Get a specific project. - * - * @param projectId The id of the project to get - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceFuture} object - */ - public ServiceFuture getProjectAsync(UUID projectId, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getProjectWithServiceResponseAsync(projectId), serviceCallback); - } + final List tagIds = getImagePerformanceCountOptionalParameter != null ? getImagePerformanceCountOptionalParameter.tagIds() : null; - /** - * Get a specific project. - * - * @param projectId The id of the project to get - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Project object - */ - public Observable getProjectAsync(UUID projectId) { - return getProjectWithServiceResponseAsync(projectId).map(new Func1, Project>() { - @Override - public Project call(ServiceResponse response) { - return response.body(); - } - }); + return getImagePerformanceCountWithServiceResponseAsync(projectId, iterationId, tagIds); } /** - * Get a specific project. + * Gets the number of images tagged with the provided {tagIds} that have prediction results from + training for the provided iteration {iterationId}. + * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @param projectId The id of the project to get + * @param projectId The project id. + * @param iterationId The iteration id. Defaults to workspace. + * @param tagIds A list of tags ids to filter the images to count. Defaults to all tags when null. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Project object + * @return the observable to the Integer object */ - public Observable> getProjectWithServiceResponseAsync(UUID projectId) { + public Observable> getImagePerformanceCountWithServiceResponseAsync(UUID projectId, UUID iterationId, List tagIds) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } + if (iterationId == null) { + throw new IllegalArgumentException("Parameter iterationId is required and cannot be null."); + } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - return service.getProject(projectId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + Validator.validate(tagIds); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + String tagIdsConverted = this.client.serializerAdapter().serializeList(tagIds, CollectionFormat.CSV); + return service.getImagePerformanceCount(projectId, iterationId, tagIdsConverted, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = getProjectDelegate(response); + ServiceResponse clientResponse = getImagePerformanceCountDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -2338,103 +2614,201 @@ public Observable> call(Response response }); } - private ServiceResponse getProjectDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse getImagePerformanceCountDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } + @Override + public TrainingsGetImagePerformanceCountParameters getImagePerformanceCount() { + return new TrainingsGetImagePerformanceCountParameters(this); + } /** - * Create a project. + * Internal class implementing TrainingsGetImagePerformanceCountDefinition. + */ + class TrainingsGetImagePerformanceCountParameters implements TrainingsGetImagePerformanceCountDefinition { + private TrainingsImpl parent; + private UUID projectId; + private UUID iterationId; + private List tagIds; + + /** + * Constructor. + * @param parent the parent object. + */ + TrainingsGetImagePerformanceCountParameters(TrainingsImpl parent) { + this.parent = parent; + } + + @Override + public TrainingsGetImagePerformanceCountParameters withProjectId(UUID projectId) { + this.projectId = projectId; + return this; + } + + @Override + public TrainingsGetImagePerformanceCountParameters withIterationId(UUID iterationId) { + this.iterationId = iterationId; + return this; + } + + @Override + public TrainingsGetImagePerformanceCountParameters withTagIds(List tagIds) { + this.tagIds = tagIds; + return this; + } + + @Override + public int execute() { + return getImagePerformanceCountWithServiceResponseAsync(projectId, iterationId, tagIds).toBlocking().single().body(); + } + + @Override + public Observable executeAsync() { + return getImagePerformanceCountWithServiceResponseAsync(projectId, iterationId, tagIds).map(new Func1, Integer>() { + @Override + public Integer call(ServiceResponse response) { + return response.body(); + } + }); + } + } + + + /** + * Get image with its prediction for a given project iteration. + * This API supports batching and range selection. By default it will only return first 50 images matching images. + Use the {take} and {skip} parameters to control how many images to return in a given batch. + The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @param name Name of the project - * @param createProjectOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param iterationId The iteration id. Defaults to workspace. + * @param getImagePerformancesOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the Project object if successful. + * @return the List<ImagePerformance> object if successful. */ - public Project createProject(String name, CreateProjectOptionalParameter createProjectOptionalParameter) { - return createProjectWithServiceResponseAsync(name, createProjectOptionalParameter).toBlocking().single().body(); + public List getImagePerformances(UUID projectId, UUID iterationId, GetImagePerformancesOptionalParameter getImagePerformancesOptionalParameter) { + return getImagePerformancesWithServiceResponseAsync(projectId, iterationId, getImagePerformancesOptionalParameter).toBlocking().single().body(); } /** - * Create a project. + * Get image with its prediction for a given project iteration. + * This API supports batching and range selection. By default it will only return first 50 images matching images. + Use the {take} and {skip} parameters to control how many images to return in a given batch. + The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @param name Name of the project - * @param createProjectOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param iterationId The iteration id. Defaults to workspace. + * @param getImagePerformancesOptionalParameter the object representing the optional parameters to be set before calling this API * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture createProjectAsync(String name, CreateProjectOptionalParameter createProjectOptionalParameter, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(createProjectWithServiceResponseAsync(name, createProjectOptionalParameter), serviceCallback); + public ServiceFuture> getImagePerformancesAsync(UUID projectId, UUID iterationId, GetImagePerformancesOptionalParameter getImagePerformancesOptionalParameter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(getImagePerformancesWithServiceResponseAsync(projectId, iterationId, getImagePerformancesOptionalParameter), serviceCallback); } /** - * Create a project. + * Get image with its prediction for a given project iteration. + * This API supports batching and range selection. By default it will only return first 50 images matching images. + Use the {take} and {skip} parameters to control how many images to return in a given batch. + The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @param name Name of the project - * @param createProjectOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param iterationId The iteration id. Defaults to workspace. + * @param getImagePerformancesOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Project object + * @return the observable to the List<ImagePerformance> object */ - public Observable createProjectAsync(String name, CreateProjectOptionalParameter createProjectOptionalParameter) { - return createProjectWithServiceResponseAsync(name, createProjectOptionalParameter).map(new Func1, Project>() { + public Observable> getImagePerformancesAsync(UUID projectId, UUID iterationId, GetImagePerformancesOptionalParameter getImagePerformancesOptionalParameter) { + return getImagePerformancesWithServiceResponseAsync(projectId, iterationId, getImagePerformancesOptionalParameter).map(new Func1>, List>() { @Override - public Project call(ServiceResponse response) { + public List call(ServiceResponse> response) { return response.body(); } }); } /** - * Create a project. + * Get image with its prediction for a given project iteration. + * This API supports batching and range selection. By default it will only return first 50 images matching images. + Use the {take} and {skip} parameters to control how many images to return in a given batch. + The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @param name Name of the project - * @param createProjectOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param iterationId The iteration id. Defaults to workspace. + * @param getImagePerformancesOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Project object + * @return the observable to the List<ImagePerformance> object */ - public Observable> createProjectWithServiceResponseAsync(String name, CreateProjectOptionalParameter createProjectOptionalParameter) { - if (name == null) { - throw new IllegalArgumentException("Parameter name is required and cannot be null."); + public Observable>> getImagePerformancesWithServiceResponseAsync(UUID projectId, UUID iterationId, GetImagePerformancesOptionalParameter getImagePerformancesOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (projectId == null) { + throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); + } + if (iterationId == null) { + throw new IllegalArgumentException("Parameter iterationId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - final String description = createProjectOptionalParameter != null ? createProjectOptionalParameter.description() : null; - final UUID domainId = createProjectOptionalParameter != null ? createProjectOptionalParameter.domainId() : null; - final String classificationType = createProjectOptionalParameter != null ? createProjectOptionalParameter.classificationType() : null; + final List tagIds = getImagePerformancesOptionalParameter != null ? getImagePerformancesOptionalParameter.tagIds() : null; + final String orderBy = getImagePerformancesOptionalParameter != null ? getImagePerformancesOptionalParameter.orderBy() : null; + final Integer take = getImagePerformancesOptionalParameter != null ? getImagePerformancesOptionalParameter.take() : null; + final Integer skip = getImagePerformancesOptionalParameter != null ? getImagePerformancesOptionalParameter.skip() : null; - return createProjectWithServiceResponseAsync(name, description, domainId, classificationType); + return getImagePerformancesWithServiceResponseAsync(projectId, iterationId, tagIds, orderBy, take, skip); } /** - * Create a project. + * Get image with its prediction for a given project iteration. + * This API supports batching and range selection. By default it will only return first 50 images matching images. + Use the {take} and {skip} parameters to control how many images to return in a given batch. + The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @param name Name of the project - * @param description The description of the project - * @param domainId The id of the domain to use for this project. Defaults to General - * @param classificationType The type of classifier to create for this project. Possible values include: 'Multiclass', 'Multilabel' + * @param projectId The project id. + * @param iterationId The iteration id. Defaults to workspace. + * @param tagIds A list of tags ids to filter the images. Defaults to all tagged images when null. Limited to 20. + * @param orderBy The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest' + * @param take Maximum number of images to return. Defaults to 50, limited to 256. + * @param skip Number of images to skip before beginning the image batch. Defaults to 0. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Project object + * @return the observable to the List<ImagePerformance> object */ - public Observable> createProjectWithServiceResponseAsync(String name, String description, UUID domainId, String classificationType) { - if (name == null) { - throw new IllegalArgumentException("Parameter name is required and cannot be null."); + public Observable>> getImagePerformancesWithServiceResponseAsync(UUID projectId, UUID iterationId, List tagIds, String orderBy, Integer take, Integer skip) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (projectId == null) { + throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); + } + if (iterationId == null) { + throw new IllegalArgumentException("Parameter iterationId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - return service.createProject(name, description, domainId, classificationType, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + Validator.validate(tagIds); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + String tagIdsConverted = this.client.serializerAdapter().serializeList(tagIds, CollectionFormat.CSV); + return service.getImagePerformances(projectId, iterationId, tagIdsConverted, orderBy, take, skip, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = createProjectDelegate(response); + ServiceResponse> clientResponse = getImagePerformancesDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -2443,130 +2817,196 @@ public Observable> call(Response response }); } - private ServiceResponse createProjectDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse> getImagePerformancesDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CustomVisionErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } @Override - public TrainingsCreateProjectParameters createProject() { - return new TrainingsCreateProjectParameters(this); + public TrainingsGetImagePerformancesParameters getImagePerformances() { + return new TrainingsGetImagePerformancesParameters(this); } /** - * Internal class implementing TrainingsCreateProjectDefinition. + * Internal class implementing TrainingsGetImagePerformancesDefinition. */ - class TrainingsCreateProjectParameters implements TrainingsCreateProjectDefinition { + class TrainingsGetImagePerformancesParameters implements TrainingsGetImagePerformancesDefinition { private TrainingsImpl parent; - private String name; - private String description; - private UUID domainId; - private String classificationType; + private UUID projectId; + private UUID iterationId; + private List tagIds; + private String orderBy; + private Integer take; + private Integer skip; /** * Constructor. * @param parent the parent object. */ - TrainingsCreateProjectParameters(TrainingsImpl parent) { + TrainingsGetImagePerformancesParameters(TrainingsImpl parent) { this.parent = parent; } @Override - public TrainingsCreateProjectParameters withName(String name) { - this.name = name; + public TrainingsGetImagePerformancesParameters withProjectId(UUID projectId) { + this.projectId = projectId; return this; } @Override - public TrainingsCreateProjectParameters withDescription(String description) { - this.description = description; + public TrainingsGetImagePerformancesParameters withIterationId(UUID iterationId) { + this.iterationId = iterationId; return this; } @Override - public TrainingsCreateProjectParameters withDomainId(UUID domainId) { - this.domainId = domainId; + public TrainingsGetImagePerformancesParameters withTagIds(List tagIds) { + this.tagIds = tagIds; return this; } @Override - public TrainingsCreateProjectParameters withClassificationType(String classificationType) { - this.classificationType = classificationType; + public TrainingsGetImagePerformancesParameters withOrderBy(String orderBy) { + this.orderBy = orderBy; return this; } @Override - public Project execute() { - return createProjectWithServiceResponseAsync(name, description, domainId, classificationType).toBlocking().single().body(); + public TrainingsGetImagePerformancesParameters withTake(Integer take) { + this.take = take; + return this; + } + + @Override + public TrainingsGetImagePerformancesParameters withSkip(Integer skip) { + this.skip = skip; + return this; + } + + @Override + public List execute() { + return getImagePerformancesWithServiceResponseAsync(projectId, iterationId, tagIds, orderBy, take, skip).toBlocking().single().body(); } @Override - public Observable executeAsync() { - return createProjectWithServiceResponseAsync(name, description, domainId, classificationType).map(new Func1, Project>() { + public Observable> executeAsync() { + return getImagePerformancesWithServiceResponseAsync(projectId, iterationId, tagIds, orderBy, take, skip).map(new Func1>, List>() { @Override - public Project call(ServiceResponse response) { + public List call(ServiceResponse> response) { return response.body(); } }); } } + /** - * Get your projects. + * Get detailed performance information about an iteration. * + * @param projectId The id of the project the iteration belongs to. + * @param iterationId The id of the iteration to get. + * @param getIterationPerformanceOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the List<Project> object if successful. + * @return the IterationPerformance object if successful. */ - public List getProjects() { - return getProjectsWithServiceResponseAsync().toBlocking().single().body(); + public IterationPerformance getIterationPerformance(UUID projectId, UUID iterationId, GetIterationPerformanceOptionalParameter getIterationPerformanceOptionalParameter) { + return getIterationPerformanceWithServiceResponseAsync(projectId, iterationId, getIterationPerformanceOptionalParameter).toBlocking().single().body(); } /** - * Get your projects. + * Get detailed performance information about an iteration. * + * @param projectId The id of the project the iteration belongs to. + * @param iterationId The id of the iteration to get. + * @param getIterationPerformanceOptionalParameter the object representing the optional parameters to be set before calling this API * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> getProjectsAsync(final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(getProjectsWithServiceResponseAsync(), serviceCallback); + public ServiceFuture getIterationPerformanceAsync(UUID projectId, UUID iterationId, GetIterationPerformanceOptionalParameter getIterationPerformanceOptionalParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getIterationPerformanceWithServiceResponseAsync(projectId, iterationId, getIterationPerformanceOptionalParameter), serviceCallback); } /** - * Get your projects. + * Get detailed performance information about an iteration. * + * @param projectId The id of the project the iteration belongs to. + * @param iterationId The id of the iteration to get. + * @param getIterationPerformanceOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<Project> object + * @return the observable to the IterationPerformance object */ - public Observable> getProjectsAsync() { - return getProjectsWithServiceResponseAsync().map(new Func1>, List>() { + public Observable getIterationPerformanceAsync(UUID projectId, UUID iterationId, GetIterationPerformanceOptionalParameter getIterationPerformanceOptionalParameter) { + return getIterationPerformanceWithServiceResponseAsync(projectId, iterationId, getIterationPerformanceOptionalParameter).map(new Func1, IterationPerformance>() { @Override - public List call(ServiceResponse> response) { + public IterationPerformance call(ServiceResponse response) { return response.body(); } }); } /** - * Get your projects. + * Get detailed performance information about an iteration. * + * @param projectId The id of the project the iteration belongs to. + * @param iterationId The id of the iteration to get. + * @param getIterationPerformanceOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<Project> object + * @return the observable to the IterationPerformance object */ - public Observable>> getProjectsWithServiceResponseAsync() { + public Observable> getIterationPerformanceWithServiceResponseAsync(UUID projectId, UUID iterationId, GetIterationPerformanceOptionalParameter getIterationPerformanceOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (projectId == null) { + throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); + } + if (iterationId == null) { + throw new IllegalArgumentException("Parameter iterationId is required and cannot be null."); + } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - return service.getProjects(this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + final Double threshold = getIterationPerformanceOptionalParameter != null ? getIterationPerformanceOptionalParameter.threshold() : null; + final Double overlapThreshold = getIterationPerformanceOptionalParameter != null ? getIterationPerformanceOptionalParameter.overlapThreshold() : null; + + return getIterationPerformanceWithServiceResponseAsync(projectId, iterationId, threshold, overlapThreshold); + } + + /** + * Get detailed performance information about an iteration. + * + * @param projectId The id of the project the iteration belongs to. + * @param iterationId The id of the iteration to get. + * @param threshold The threshold used to determine true predictions. + * @param overlapThreshold If applicable, the bounding box overlap threshold used to determine true predictions. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IterationPerformance object + */ + public Observable> getIterationPerformanceWithServiceResponseAsync(UUID projectId, UUID iterationId, Double threshold, Double overlapThreshold) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (projectId == null) { + throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); + } + if (iterationId == null) { + throw new IllegalArgumentException("Parameter iterationId is required and cannot be null."); + } + if (this.client.apiKey() == null) { + throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); + } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.getIterationPerformance(projectId, iterationId, threshold, overlapThreshold, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable>> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse> clientResponse = getProjectsDelegate(response); + ServiceResponse clientResponse = getIterationPerformanceDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -2575,74 +3015,149 @@ public Observable>> call(Response re }); } - private ServiceResponse> getProjectsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse getIterationPerformanceDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } + @Override + public TrainingsGetIterationPerformanceParameters getIterationPerformance() { + return new TrainingsGetIterationPerformanceParameters(this); + } + /** - * Queues project for training. + * Internal class implementing TrainingsGetIterationPerformanceDefinition. + */ + class TrainingsGetIterationPerformanceParameters implements TrainingsGetIterationPerformanceDefinition { + private TrainingsImpl parent; + private UUID projectId; + private UUID iterationId; + private Double threshold; + private Double overlapThreshold; + + /** + * Constructor. + * @param parent the parent object. + */ + TrainingsGetIterationPerformanceParameters(TrainingsImpl parent) { + this.parent = parent; + } + + @Override + public TrainingsGetIterationPerformanceParameters withProjectId(UUID projectId) { + this.projectId = projectId; + return this; + } + + @Override + public TrainingsGetIterationPerformanceParameters withIterationId(UUID iterationId) { + this.iterationId = iterationId; + return this; + } + + @Override + public TrainingsGetIterationPerformanceParameters withThreshold(Double threshold) { + this.threshold = threshold; + return this; + } + + @Override + public TrainingsGetIterationPerformanceParameters withOverlapThreshold(Double overlapThreshold) { + this.overlapThreshold = overlapThreshold; + return this; + } + + @Override + public IterationPerformance execute() { + return getIterationPerformanceWithServiceResponseAsync(projectId, iterationId, threshold, overlapThreshold).toBlocking().single().body(); + } + + @Override + public Observable executeAsync() { + return getIterationPerformanceWithServiceResponseAsync(projectId, iterationId, threshold, overlapThreshold).map(new Func1, IterationPerformance>() { + @Override + public IterationPerformance call(ServiceResponse response) { + return response.body(); + } + }); + } + } + + /** + * Get images that were sent to your prediction endpoint. * - * @param projectId The project id + * @param projectId The project id. + * @param query Parameters used to query the predictions. Limited to combining 2 tags. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the Iteration object if successful. + * @return the PredictionQueryResult object if successful. */ - public Iteration trainProject(UUID projectId) { - return trainProjectWithServiceResponseAsync(projectId).toBlocking().single().body(); + public PredictionQueryResult queryPredictions(UUID projectId, PredictionQueryToken query) { + return queryPredictionsWithServiceResponseAsync(projectId, query).toBlocking().single().body(); } /** - * Queues project for training. + * Get images that were sent to your prediction endpoint. * - * @param projectId The project id + * @param projectId The project id. + * @param query Parameters used to query the predictions. Limited to combining 2 tags. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture trainProjectAsync(UUID projectId, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(trainProjectWithServiceResponseAsync(projectId), serviceCallback); + public ServiceFuture queryPredictionsAsync(UUID projectId, PredictionQueryToken query, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(queryPredictionsWithServiceResponseAsync(projectId, query), serviceCallback); } /** - * Queues project for training. + * Get images that were sent to your prediction endpoint. * - * @param projectId The project id + * @param projectId The project id. + * @param query Parameters used to query the predictions. Limited to combining 2 tags. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Iteration object + * @return the observable to the PredictionQueryResult object */ - public Observable trainProjectAsync(UUID projectId) { - return trainProjectWithServiceResponseAsync(projectId).map(new Func1, Iteration>() { + public Observable queryPredictionsAsync(UUID projectId, PredictionQueryToken query) { + return queryPredictionsWithServiceResponseAsync(projectId, query).map(new Func1, PredictionQueryResult>() { @Override - public Iteration call(ServiceResponse response) { + public PredictionQueryResult call(ServiceResponse response) { return response.body(); } }); } /** - * Queues project for training. + * Get images that were sent to your prediction endpoint. * - * @param projectId The project id + * @param projectId The project id. + * @param query Parameters used to query the predictions. Limited to combining 2 tags. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Iteration object + * @return the observable to the PredictionQueryResult object */ - public Observable> trainProjectWithServiceResponseAsync(UUID projectId) { + public Observable> queryPredictionsWithServiceResponseAsync(UUID projectId, PredictionQueryToken query) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } + if (query == null) { + throw new IllegalArgumentException("Parameter query is required and cannot be null."); + } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - return service.trainProject(projectId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + Validator.validate(query); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.queryPredictions(projectId, query, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = trainProjectDelegate(response); + ServiceResponse clientResponse = queryPredictionsDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -2651,10 +3166,10 @@ public Observable> call(Response respon }); } - private ServiceResponse trainProjectDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse queryPredictionsDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } @@ -2662,11 +3177,11 @@ private ServiceResponse trainProjectDelegate(Response r /** * Quick test an image. * - * @param projectId The project id - * @param imageData the InputStream value + * @param projectId The project id. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB. * @param quickTestImageOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ImagePrediction object if successful. */ @@ -2677,8 +3192,8 @@ public ImagePrediction quickTestImage(UUID projectId, byte[] imageData, QuickTes /** * Quick test an image. * - * @param projectId The project id - * @param imageData the InputStream value + * @param projectId The project id. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB. * @param quickTestImageOptionalParameter the object representing the optional parameters to be set before calling this API * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -2691,8 +3206,8 @@ public ServiceFuture quickTestImageAsync(UUID projectId, byte[] /** * Quick test an image. * - * @param projectId The project id - * @param imageData the InputStream value + * @param projectId The project id. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB. * @param quickTestImageOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object @@ -2709,13 +3224,16 @@ public ImagePrediction call(ServiceResponse response) { /** * Quick test an image. * - * @param projectId The project id - * @param imageData the InputStream value + * @param projectId The project id. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB. * @param quickTestImageOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object */ public Observable> quickTestImageWithServiceResponseAsync(UUID projectId, byte[] imageData, QuickTestImageOptionalParameter quickTestImageOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } @@ -2733,14 +3251,17 @@ public Observable> quickTestImageWithServiceRes /** * Quick test an image. * - * @param projectId The project id - * @param imageData the InputStream value + * @param projectId The project id. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB. * @param iterationId Optional. Specifies the id of a particular iteration to evaluate against. The default iteration for the project will be used when not specified. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object */ public Observable> quickTestImageWithServiceResponseAsync(UUID projectId, byte[] imageData, UUID iterationId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } @@ -2750,8 +3271,9 @@ public Observable> quickTestImageWithServiceRes if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); RequestBody imageDataConverted = RequestBody.create(MediaType.parse("multipart/form-data"), imageData); - return service.quickTestImage(projectId, iterationId, imageDataConverted, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) + return service.quickTestImage(projectId, iterationId, imageDataConverted, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2765,10 +3287,10 @@ public Observable> call(Response }); } - private ServiceResponse quickTestImageDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse quickTestImageDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .registerError(CustomVisionErrorException.class) .build(response); } @@ -2832,40 +3354,43 @@ public ImagePrediction call(ServiceResponse response) { /** * Quick test an image url. * - * @param projectId The project to evaluate against + * @param projectId The project to evaluate against. + * @param url Url of the image. * @param quickTestImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ImagePrediction object if successful. */ - public ImagePrediction quickTestImageUrl(UUID projectId, QuickTestImageUrlOptionalParameter quickTestImageUrlOptionalParameter) { - return quickTestImageUrlWithServiceResponseAsync(projectId, quickTestImageUrlOptionalParameter).toBlocking().single().body(); + public ImagePrediction quickTestImageUrl(UUID projectId, String url, QuickTestImageUrlOptionalParameter quickTestImageUrlOptionalParameter) { + return quickTestImageUrlWithServiceResponseAsync(projectId, url, quickTestImageUrlOptionalParameter).toBlocking().single().body(); } /** * Quick test an image url. * - * @param projectId The project to evaluate against + * @param projectId The project to evaluate against. + * @param url Url of the image. * @param quickTestImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture quickTestImageUrlAsync(UUID projectId, QuickTestImageUrlOptionalParameter quickTestImageUrlOptionalParameter, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(quickTestImageUrlWithServiceResponseAsync(projectId, quickTestImageUrlOptionalParameter), serviceCallback); + public ServiceFuture quickTestImageUrlAsync(UUID projectId, String url, QuickTestImageUrlOptionalParameter quickTestImageUrlOptionalParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(quickTestImageUrlWithServiceResponseAsync(projectId, url, quickTestImageUrlOptionalParameter), serviceCallback); } /** * Quick test an image url. * - * @param projectId The project to evaluate against + * @param projectId The project to evaluate against. + * @param url Url of the image. * @param quickTestImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object */ - public Observable quickTestImageUrlAsync(UUID projectId, QuickTestImageUrlOptionalParameter quickTestImageUrlOptionalParameter) { - return quickTestImageUrlWithServiceResponseAsync(projectId, quickTestImageUrlOptionalParameter).map(new Func1, ImagePrediction>() { + public Observable quickTestImageUrlAsync(UUID projectId, String url, QuickTestImageUrlOptionalParameter quickTestImageUrlOptionalParameter) { + return quickTestImageUrlWithServiceResponseAsync(projectId, url, quickTestImageUrlOptionalParameter).map(new Func1, ImagePrediction>() { @Override public ImagePrediction call(ServiceResponse response) { return response.body(); @@ -2876,44 +3401,57 @@ public ImagePrediction call(ServiceResponse response) { /** * Quick test an image url. * - * @param projectId The project to evaluate against + * @param projectId The project to evaluate against. + * @param url Url of the image. * @param quickTestImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object */ - public Observable> quickTestImageUrlWithServiceResponseAsync(UUID projectId, QuickTestImageUrlOptionalParameter quickTestImageUrlOptionalParameter) { + public Observable> quickTestImageUrlWithServiceResponseAsync(UUID projectId, String url, QuickTestImageUrlOptionalParameter quickTestImageUrlOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } + if (url == null) { + throw new IllegalArgumentException("Parameter url is required and cannot be null."); + } final UUID iterationId = quickTestImageUrlOptionalParameter != null ? quickTestImageUrlOptionalParameter.iterationId() : null; - final String url = quickTestImageUrlOptionalParameter != null ? quickTestImageUrlOptionalParameter.url() : null; - return quickTestImageUrlWithServiceResponseAsync(projectId, iterationId, url); + return quickTestImageUrlWithServiceResponseAsync(projectId, url, iterationId); } /** * Quick test an image url. * - * @param projectId The project to evaluate against + * @param projectId The project to evaluate against. + * @param url Url of the image. * @param iterationId Optional. Specifies the id of a particular iteration to evaluate against. The default iteration for the project will be used when not specified. - * @param url the String value * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImagePrediction object */ - public Observable> quickTestImageUrlWithServiceResponseAsync(UUID projectId, UUID iterationId, String url) { + public Observable> quickTestImageUrlWithServiceResponseAsync(UUID projectId, String url, UUID iterationId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } + if (url == null) { + throw new IllegalArgumentException("Parameter url is required and cannot be null."); + } ImageUrl imageUrl = new ImageUrl(); imageUrl.withUrl(url); - return service.quickTestImageUrl(projectId, iterationId, this.client.apiKey(), this.client.acceptLanguage(), imageUrl, this.client.userAgent()) + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.quickTestImageUrl(projectId, iterationId, this.client.apiKey(), this.client.acceptLanguage(), imageUrl, parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2927,10 +3465,10 @@ public Observable> call(Response }); } - private ServiceResponse quickTestImageUrlDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse quickTestImageUrlDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .registerError(CustomVisionErrorException.class) .build(response); } @@ -2945,8 +3483,8 @@ public TrainingsQuickTestImageUrlParameters quickTestImageUrl() { class TrainingsQuickTestImageUrlParameters implements TrainingsQuickTestImageUrlDefinition { private TrainingsImpl parent; private UUID projectId; - private UUID iterationId; private String url; + private UUID iterationId; /** * Constructor. @@ -2963,25 +3501,25 @@ public TrainingsQuickTestImageUrlParameters withProjectId(UUID projectId) { } @Override - public TrainingsQuickTestImageUrlParameters withIterationId(UUID iterationId) { - this.iterationId = iterationId; + public TrainingsQuickTestImageUrlParameters withUrl(String url) { + this.url = url; return this; } @Override - public TrainingsQuickTestImageUrlParameters withUrl(String url) { - this.url = url; + public TrainingsQuickTestImageUrlParameters withIterationId(UUID iterationId) { + this.iterationId = iterationId; return this; } @Override public ImagePrediction execute() { - return quickTestImageUrlWithServiceResponseAsync(projectId, iterationId, url).toBlocking().single().body(); + return quickTestImageUrlWithServiceResponseAsync(projectId, url, iterationId).toBlocking().single().body(); } @Override public Observable executeAsync() { - return quickTestImageUrlWithServiceResponseAsync(projectId, iterationId, url).map(new Func1, ImagePrediction>() { + return quickTestImageUrlWithServiceResponseAsync(projectId, url, iterationId).map(new Func1, ImagePrediction>() { @Override public ImagePrediction call(ServiceResponse response) { return response.body(); @@ -2991,74 +3529,78 @@ public ImagePrediction call(ServiceResponse response) { } /** - * Get images that were sent to your prediction endpoint. + * Delete a set of predicted images and their associated prediction results. * - * @param projectId The project id - * @param query Parameters used to query the predictions. Limited to combining 2 tags + * @param projectId The project id. + * @param ids The prediction ids. Limited to 64. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the PredictionQueryResult object if successful. */ - public PredictionQueryResult queryPredictions(UUID projectId, PredictionQueryToken query) { - return queryPredictionsWithServiceResponseAsync(projectId, query).toBlocking().single().body(); + public void deletePrediction(UUID projectId, List ids) { + deletePredictionWithServiceResponseAsync(projectId, ids).toBlocking().single().body(); } /** - * Get images that were sent to your prediction endpoint. + * Delete a set of predicted images and their associated prediction results. * - * @param projectId The project id - * @param query Parameters used to query the predictions. Limited to combining 2 tags + * @param projectId The project id. + * @param ids The prediction ids. Limited to 64. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture queryPredictionsAsync(UUID projectId, PredictionQueryToken query, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(queryPredictionsWithServiceResponseAsync(projectId, query), serviceCallback); + public ServiceFuture deletePredictionAsync(UUID projectId, List ids, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deletePredictionWithServiceResponseAsync(projectId, ids), serviceCallback); } /** - * Get images that were sent to your prediction endpoint. + * Delete a set of predicted images and their associated prediction results. * - * @param projectId The project id - * @param query Parameters used to query the predictions. Limited to combining 2 tags + * @param projectId The project id. + * @param ids The prediction ids. Limited to 64. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PredictionQueryResult object + * @return the {@link ServiceResponse} object if successful. */ - public Observable queryPredictionsAsync(UUID projectId, PredictionQueryToken query) { - return queryPredictionsWithServiceResponseAsync(projectId, query).map(new Func1, PredictionQueryResult>() { + public Observable deletePredictionAsync(UUID projectId, List ids) { + return deletePredictionWithServiceResponseAsync(projectId, ids).map(new Func1, Void>() { @Override - public PredictionQueryResult call(ServiceResponse response) { + public Void call(ServiceResponse response) { return response.body(); } }); } /** - * Get images that were sent to your prediction endpoint. + * Delete a set of predicted images and their associated prediction results. * - * @param projectId The project id - * @param query Parameters used to query the predictions. Limited to combining 2 tags + * @param projectId The project id. + * @param ids The prediction ids. Limited to 64. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PredictionQueryResult object + * @return the {@link ServiceResponse} object if successful. */ - public Observable> queryPredictionsWithServiceResponseAsync(UUID projectId, PredictionQueryToken query) { + public Observable> deletePredictionWithServiceResponseAsync(UUID projectId, List ids) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } - if (query == null) { - throw new IllegalArgumentException("Parameter query is required and cannot be null."); + if (ids == null) { + throw new IllegalArgumentException("Parameter ids is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - Validator.validate(query); - return service.queryPredictions(projectId, query, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + Validator.validate(ids); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + String idsConverted = this.client.serializerAdapter().serializeList(ids, CollectionFormat.CSV); + return service.deletePrediction(projectId, idsConverted, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = queryPredictionsDelegate(response); + ServiceResponse clientResponse = deletePredictionDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -3067,82 +3609,89 @@ public Observable> call(Response queryPredictionsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse deletePredictionDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } /** - * Delete a set of predicted images and their associated prediction results. + * Get region proposals for an image. Returns empty array if no proposals are found. + * This API will get region proposals for an image along with confidences for the region. It returns an empty array if no proposals are found. * - * @param projectId The project id - * @param ids The prediction ids. Limited to 64 + * @param projectId The project id. + * @param imageId The image id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImageRegionProposal object if successful. */ - public void deletePrediction(UUID projectId, List ids) { - deletePredictionWithServiceResponseAsync(projectId, ids).toBlocking().single().body(); + public ImageRegionProposal getImageRegionProposals(UUID projectId, UUID imageId) { + return getImageRegionProposalsWithServiceResponseAsync(projectId, imageId).toBlocking().single().body(); } /** - * Delete a set of predicted images and their associated prediction results. + * Get region proposals for an image. Returns empty array if no proposals are found. + * This API will get region proposals for an image along with confidences for the region. It returns an empty array if no proposals are found. * - * @param projectId The project id - * @param ids The prediction ids. Limited to 64 + * @param projectId The project id. + * @param imageId The image id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture deletePredictionAsync(UUID projectId, List ids, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(deletePredictionWithServiceResponseAsync(projectId, ids), serviceCallback); + public ServiceFuture getImageRegionProposalsAsync(UUID projectId, UUID imageId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getImageRegionProposalsWithServiceResponseAsync(projectId, imageId), serviceCallback); } /** - * Delete a set of predicted images and their associated prediction results. + * Get region proposals for an image. Returns empty array if no proposals are found. + * This API will get region proposals for an image along with confidences for the region. It returns an empty array if no proposals are found. * - * @param projectId The project id - * @param ids The prediction ids. Limited to 64 + * @param projectId The project id. + * @param imageId The image id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. + * @return the observable to the ImageRegionProposal object */ - public Observable deletePredictionAsync(UUID projectId, List ids) { - return deletePredictionWithServiceResponseAsync(projectId, ids).map(new Func1, Void>() { + public Observable getImageRegionProposalsAsync(UUID projectId, UUID imageId) { + return getImageRegionProposalsWithServiceResponseAsync(projectId, imageId).map(new Func1, ImageRegionProposal>() { @Override - public Void call(ServiceResponse response) { + public ImageRegionProposal call(ServiceResponse response) { return response.body(); } }); } /** - * Delete a set of predicted images and their associated prediction results. + * Get region proposals for an image. Returns empty array if no proposals are found. + * This API will get region proposals for an image along with confidences for the region. It returns an empty array if no proposals are found. * - * @param projectId The project id - * @param ids The prediction ids. Limited to 64 + * @param projectId The project id. + * @param imageId The image id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. + * @return the observable to the ImageRegionProposal object */ - public Observable> deletePredictionWithServiceResponseAsync(UUID projectId, List ids) { + public Observable> getImageRegionProposalsWithServiceResponseAsync(UUID projectId, UUID imageId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } - if (ids == null) { - throw new IllegalArgumentException("Parameter ids is required and cannot be null."); + if (imageId == null) { + throw new IllegalArgumentException("Parameter imageId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - Validator.validate(ids); - String idsConverted = this.client.serializerAdapter().serializeList(ids, CollectionFormat.CSV); - return service.deletePrediction(projectId, idsConverted, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.getImageRegionProposals(projectId, imageId, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = deletePredictionDelegate(response); + ServiceResponse clientResponse = getImageRegionProposalsDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -3151,85 +3700,90 @@ public Observable> call(Response response) { }); } - private ServiceResponse deletePredictionDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(204, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse getImageRegionProposalsDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } /** - * Get region proposals for an image. Returns empty array if no proposals are found. - * This API will get region proposals for an image along with confidences for the region. It returns an empty array if no proposals are found. + * Add the specified predicted images to the set of training images. + * This API creates a batch of images from predicted images specified. There is a limit of 64 images and 20 tags. * - * @param projectId The project id - * @param imageId The image id + * @param projectId The project id. + * @param batch Image and tag ids. Limited to 64 images and 20 tags per batch. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageRegionProposal object if successful. + * @return the ImageCreateSummary object if successful. */ - public ImageRegionProposal getImageRegionProposals(UUID projectId, UUID imageId) { - return getImageRegionProposalsWithServiceResponseAsync(projectId, imageId).toBlocking().single().body(); + public ImageCreateSummary createImagesFromPredictions(UUID projectId, ImageIdCreateBatch batch) { + return createImagesFromPredictionsWithServiceResponseAsync(projectId, batch).toBlocking().single().body(); } /** - * Get region proposals for an image. Returns empty array if no proposals are found. - * This API will get region proposals for an image along with confidences for the region. It returns an empty array if no proposals are found. + * Add the specified predicted images to the set of training images. + * This API creates a batch of images from predicted images specified. There is a limit of 64 images and 20 tags. * - * @param projectId The project id - * @param imageId The image id + * @param projectId The project id. + * @param batch Image and tag ids. Limited to 64 images and 20 tags per batch. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture getImageRegionProposalsAsync(UUID projectId, UUID imageId, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getImageRegionProposalsWithServiceResponseAsync(projectId, imageId), serviceCallback); + public ServiceFuture createImagesFromPredictionsAsync(UUID projectId, ImageIdCreateBatch batch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createImagesFromPredictionsWithServiceResponseAsync(projectId, batch), serviceCallback); } /** - * Get region proposals for an image. Returns empty array if no proposals are found. - * This API will get region proposals for an image along with confidences for the region. It returns an empty array if no proposals are found. + * Add the specified predicted images to the set of training images. + * This API creates a batch of images from predicted images specified. There is a limit of 64 images and 20 tags. * - * @param projectId The project id - * @param imageId The image id + * @param projectId The project id. + * @param batch Image and tag ids. Limited to 64 images and 20 tags per batch. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageRegionProposal object + * @return the observable to the ImageCreateSummary object */ - public Observable getImageRegionProposalsAsync(UUID projectId, UUID imageId) { - return getImageRegionProposalsWithServiceResponseAsync(projectId, imageId).map(new Func1, ImageRegionProposal>() { + public Observable createImagesFromPredictionsAsync(UUID projectId, ImageIdCreateBatch batch) { + return createImagesFromPredictionsWithServiceResponseAsync(projectId, batch).map(new Func1, ImageCreateSummary>() { @Override - public ImageRegionProposal call(ServiceResponse response) { + public ImageCreateSummary call(ServiceResponse response) { return response.body(); } }); } /** - * Get region proposals for an image. Returns empty array if no proposals are found. - * This API will get region proposals for an image along with confidences for the region. It returns an empty array if no proposals are found. + * Add the specified predicted images to the set of training images. + * This API creates a batch of images from predicted images specified. There is a limit of 64 images and 20 tags. * - * @param projectId The project id - * @param imageId The image id + * @param projectId The project id. + * @param batch Image and tag ids. Limited to 64 images and 20 tags per batch. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageRegionProposal object + * @return the observable to the ImageCreateSummary object */ - public Observable> getImageRegionProposalsWithServiceResponseAsync(UUID projectId, UUID imageId) { + public Observable> createImagesFromPredictionsWithServiceResponseAsync(UUID projectId, ImageIdCreateBatch batch) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } - if (imageId == null) { - throw new IllegalArgumentException("Parameter imageId is required and cannot be null."); + if (batch == null) { + throw new IllegalArgumentException("Parameter batch is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - return service.getImageRegionProposals(projectId, imageId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + Validator.validate(batch); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.createImagesFromPredictions(projectId, batch, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = getImageRegionProposalsDelegate(response); + ServiceResponse clientResponse = createImagesFromPredictionsDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -3238,82 +3792,90 @@ public Observable> call(Response getImageRegionProposalsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse createImagesFromPredictionsDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } /** - * Delete a set of image regions. + * Add the provided images urls to the set of training images. + * This API accepts a batch of urls, and optionally tags, to create images. There is a limit of 64 images and 20 tags. * - * @param projectId The project id - * @param regionIds Regions to delete. Limited to 64 + * @param projectId The project id. + * @param batch Image urls and tag ids. Limited to 64 images and 20 tags per batch. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ImageCreateSummary object if successful. */ - public void deleteImageRegions(UUID projectId, List regionIds) { - deleteImageRegionsWithServiceResponseAsync(projectId, regionIds).toBlocking().single().body(); + public ImageCreateSummary createImagesFromUrls(UUID projectId, ImageUrlCreateBatch batch) { + return createImagesFromUrlsWithServiceResponseAsync(projectId, batch).toBlocking().single().body(); } /** - * Delete a set of image regions. + * Add the provided images urls to the set of training images. + * This API accepts a batch of urls, and optionally tags, to create images. There is a limit of 64 images and 20 tags. * - * @param projectId The project id - * @param regionIds Regions to delete. Limited to 64 + * @param projectId The project id. + * @param batch Image urls and tag ids. Limited to 64 images and 20 tags per batch. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture deleteImageRegionsAsync(UUID projectId, List regionIds, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(deleteImageRegionsWithServiceResponseAsync(projectId, regionIds), serviceCallback); + public ServiceFuture createImagesFromUrlsAsync(UUID projectId, ImageUrlCreateBatch batch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createImagesFromUrlsWithServiceResponseAsync(projectId, batch), serviceCallback); } /** - * Delete a set of image regions. + * Add the provided images urls to the set of training images. + * This API accepts a batch of urls, and optionally tags, to create images. There is a limit of 64 images and 20 tags. * - * @param projectId The project id - * @param regionIds Regions to delete. Limited to 64 + * @param projectId The project id. + * @param batch Image urls and tag ids. Limited to 64 images and 20 tags per batch. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. + * @return the observable to the ImageCreateSummary object */ - public Observable deleteImageRegionsAsync(UUID projectId, List regionIds) { - return deleteImageRegionsWithServiceResponseAsync(projectId, regionIds).map(new Func1, Void>() { + public Observable createImagesFromUrlsAsync(UUID projectId, ImageUrlCreateBatch batch) { + return createImagesFromUrlsWithServiceResponseAsync(projectId, batch).map(new Func1, ImageCreateSummary>() { @Override - public Void call(ServiceResponse response) { + public ImageCreateSummary call(ServiceResponse response) { return response.body(); } }); } /** - * Delete a set of image regions. + * Add the provided images urls to the set of training images. + * This API accepts a batch of urls, and optionally tags, to create images. There is a limit of 64 images and 20 tags. * - * @param projectId The project id - * @param regionIds Regions to delete. Limited to 64 + * @param projectId The project id. + * @param batch Image urls and tag ids. Limited to 64 images and 20 tags per batch. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. + * @return the observable to the ImageCreateSummary object */ - public Observable> deleteImageRegionsWithServiceResponseAsync(UUID projectId, List regionIds) { + public Observable> createImagesFromUrlsWithServiceResponseAsync(UUID projectId, ImageUrlCreateBatch batch) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } - if (regionIds == null) { - throw new IllegalArgumentException("Parameter regionIds is required and cannot be null."); + if (batch == null) { + throw new IllegalArgumentException("Parameter batch is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - Validator.validate(regionIds); - String regionIdsConverted = this.client.serializerAdapter().serializeList(regionIds, CollectionFormat.CSV); - return service.deleteImageRegions(projectId, regionIdsConverted, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + Validator.validate(batch); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.createImagesFromUrls(projectId, batch, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = deleteImageRegionsDelegate(response); + ServiceResponse clientResponse = createImagesFromUrlsDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -3322,112 +3884,90 @@ public Observable> call(Response response) { }); } - private ServiceResponse deleteImageRegionsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(204, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse createImagesFromUrlsDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } - /** - * Create a set of image regions. - * This API accepts a batch of image regions, and optionally tags, to update existing images with region information. - There is a limit of 64 entries in the batch. + * Add the provided batch of images to the set of training images. + * This API accepts a batch of files, and optionally tags, to create images. There is a limit of 64 images and 20 tags. * - * @param projectId The project id - * @param createImageRegionsOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param batch The batch of image files to add. Limited to 64 images and 20 tags per batch. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageRegionCreateSummary object if successful. + * @return the ImageCreateSummary object if successful. */ - public ImageRegionCreateSummary createImageRegions(UUID projectId, CreateImageRegionsOptionalParameter createImageRegionsOptionalParameter) { - return createImageRegionsWithServiceResponseAsync(projectId, createImageRegionsOptionalParameter).toBlocking().single().body(); + public ImageCreateSummary createImagesFromFiles(UUID projectId, ImageFileCreateBatch batch) { + return createImagesFromFilesWithServiceResponseAsync(projectId, batch).toBlocking().single().body(); } /** - * Create a set of image regions. - * This API accepts a batch of image regions, and optionally tags, to update existing images with region information. - There is a limit of 64 entries in the batch. + * Add the provided batch of images to the set of training images. + * This API accepts a batch of files, and optionally tags, to create images. There is a limit of 64 images and 20 tags. * - * @param projectId The project id - * @param createImageRegionsOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param batch The batch of image files to add. Limited to 64 images and 20 tags per batch. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture createImageRegionsAsync(UUID projectId, CreateImageRegionsOptionalParameter createImageRegionsOptionalParameter, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(createImageRegionsWithServiceResponseAsync(projectId, createImageRegionsOptionalParameter), serviceCallback); + public ServiceFuture createImagesFromFilesAsync(UUID projectId, ImageFileCreateBatch batch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createImagesFromFilesWithServiceResponseAsync(projectId, batch), serviceCallback); } /** - * Create a set of image regions. - * This API accepts a batch of image regions, and optionally tags, to update existing images with region information. - There is a limit of 64 entries in the batch. + * Add the provided batch of images to the set of training images. + * This API accepts a batch of files, and optionally tags, to create images. There is a limit of 64 images and 20 tags. * - * @param projectId The project id - * @param createImageRegionsOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param batch The batch of image files to add. Limited to 64 images and 20 tags per batch. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageRegionCreateSummary object + * @return the observable to the ImageCreateSummary object */ - public Observable createImageRegionsAsync(UUID projectId, CreateImageRegionsOptionalParameter createImageRegionsOptionalParameter) { - return createImageRegionsWithServiceResponseAsync(projectId, createImageRegionsOptionalParameter).map(new Func1, ImageRegionCreateSummary>() { + public Observable createImagesFromFilesAsync(UUID projectId, ImageFileCreateBatch batch) { + return createImagesFromFilesWithServiceResponseAsync(projectId, batch).map(new Func1, ImageCreateSummary>() { @Override - public ImageRegionCreateSummary call(ServiceResponse response) { + public ImageCreateSummary call(ServiceResponse response) { return response.body(); } }); } /** - * Create a set of image regions. - * This API accepts a batch of image regions, and optionally tags, to update existing images with region information. - There is a limit of 64 entries in the batch. + * Add the provided batch of images to the set of training images. + * This API accepts a batch of files, and optionally tags, to create images. There is a limit of 64 images and 20 tags. * - * @param projectId The project id - * @param createImageRegionsOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param batch The batch of image files to add. Limited to 64 images and 20 tags per batch. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageRegionCreateSummary object + * @return the observable to the ImageCreateSummary object */ - public Observable> createImageRegionsWithServiceResponseAsync(UUID projectId, CreateImageRegionsOptionalParameter createImageRegionsOptionalParameter) { - if (projectId == null) { - throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); - } - if (this.client.apiKey() == null) { - throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); + public Observable> createImagesFromFilesWithServiceResponseAsync(UUID projectId, ImageFileCreateBatch batch) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } - final List regions = createImageRegionsOptionalParameter != null ? createImageRegionsOptionalParameter.regions() : null; - - return createImageRegionsWithServiceResponseAsync(projectId, regions); - } - - /** - * Create a set of image regions. - * This API accepts a batch of image regions, and optionally tags, to update existing images with region information. - There is a limit of 64 entries in the batch. - * - * @param projectId The project id - * @param regions the List<ImageRegionCreateEntry> value - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageRegionCreateSummary object - */ - public Observable> createImageRegionsWithServiceResponseAsync(UUID projectId, List regions) { if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } + if (batch == null) { + throw new IllegalArgumentException("Parameter batch is required and cannot be null."); + } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - Validator.validate(regions); - ImageRegionCreateBatch batch = new ImageRegionCreateBatch(); - batch.withRegions(regions); - return service.createImageRegions(projectId, this.client.apiKey(), this.client.acceptLanguage(), batch, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + Validator.validate(batch); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.createImagesFromFiles(projectId, batch, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = createImageRegionsDelegate(response); + ServiceResponse clientResponse = createImagesFromFilesDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -3436,101 +3976,49 @@ public Observable> call(Response createImageRegionsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse createImagesFromFilesDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } - @Override - public TrainingsCreateImageRegionsParameters createImageRegions() { - return new TrainingsCreateImageRegionsParameters(this); + /** + * Delete images from the set of training images. + * + * @param projectId The project id. + * @param imageIds Ids of the images to be deleted. Limited to 256 images per batch. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteImages(UUID projectId, List imageIds) { + deleteImagesWithServiceResponseAsync(projectId, imageIds).toBlocking().single().body(); } /** - * Internal class implementing TrainingsCreateImageRegionsDefinition. + * Delete images from the set of training images. + * + * @param projectId The project id. + * @param imageIds Ids of the images to be deleted. Limited to 256 images per batch. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object */ - class TrainingsCreateImageRegionsParameters implements TrainingsCreateImageRegionsDefinition { - private TrainingsImpl parent; - private UUID projectId; - private List regions; - - /** - * Constructor. - * @param parent the parent object. - */ - TrainingsCreateImageRegionsParameters(TrainingsImpl parent) { - this.parent = parent; - } - - @Override - public TrainingsCreateImageRegionsParameters withProjectId(UUID projectId) { - this.projectId = projectId; - return this; - } - - @Override - public TrainingsCreateImageRegionsParameters withRegions(List regions) { - this.regions = regions; - return this; - } - - @Override - public ImageRegionCreateSummary execute() { - return createImageRegionsWithServiceResponseAsync(projectId, regions).toBlocking().single().body(); - } - - @Override - public Observable executeAsync() { - return createImageRegionsWithServiceResponseAsync(projectId, regions).map(new Func1, ImageRegionCreateSummary>() { - @Override - public ImageRegionCreateSummary call(ServiceResponse response) { - return response.body(); - } - }); - } - } - - /** - * Remove a set of tags from a set of images. - * - * @param projectId The project id - * @param imageIds Image ids. Limited to 64 images - * @param tagIds Tags to be deleted from the specified images. Limted to 20 tags - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - */ - public void deleteImageTags(UUID projectId, List imageIds, List tagIds) { - deleteImageTagsWithServiceResponseAsync(projectId, imageIds, tagIds).toBlocking().single().body(); - } - - /** - * Remove a set of tags from a set of images. - * - * @param projectId The project id - * @param imageIds Image ids. Limited to 64 images - * @param tagIds Tags to be deleted from the specified images. Limted to 20 tags - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceFuture} object - */ - public ServiceFuture deleteImageTagsAsync(UUID projectId, List imageIds, List tagIds, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(deleteImageTagsWithServiceResponseAsync(projectId, imageIds, tagIds), serviceCallback); - } + public ServiceFuture deleteImagesAsync(UUID projectId, List imageIds, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteImagesWithServiceResponseAsync(projectId, imageIds), serviceCallback); + } /** - * Remove a set of tags from a set of images. + * Delete images from the set of training images. * - * @param projectId The project id - * @param imageIds Image ids. Limited to 64 images - * @param tagIds Tags to be deleted from the specified images. Limted to 20 tags + * @param projectId The project id. + * @param imageIds Ids of the images to be deleted. Limited to 256 images per batch. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ - public Observable deleteImageTagsAsync(UUID projectId, List imageIds, List tagIds) { - return deleteImageTagsWithServiceResponseAsync(projectId, imageIds, tagIds).map(new Func1, Void>() { + public Observable deleteImagesAsync(UUID projectId, List imageIds) { + return deleteImagesWithServiceResponseAsync(projectId, imageIds).map(new Func1, Void>() { @Override public Void call(ServiceResponse response) { return response.body(); @@ -3539,37 +4027,35 @@ public Void call(ServiceResponse response) { } /** - * Remove a set of tags from a set of images. + * Delete images from the set of training images. * - * @param projectId The project id - * @param imageIds Image ids. Limited to 64 images - * @param tagIds Tags to be deleted from the specified images. Limted to 20 tags + * @param projectId The project id. + * @param imageIds Ids of the images to be deleted. Limited to 256 images per batch. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ - public Observable> deleteImageTagsWithServiceResponseAsync(UUID projectId, List imageIds, List tagIds) { + public Observable> deleteImagesWithServiceResponseAsync(UUID projectId, List imageIds) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (imageIds == null) { throw new IllegalArgumentException("Parameter imageIds is required and cannot be null."); } - if (tagIds == null) { - throw new IllegalArgumentException("Parameter tagIds is required and cannot be null."); - } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } Validator.validate(imageIds); - Validator.validate(tagIds); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); String imageIdsConverted = this.client.serializerAdapter().serializeList(imageIds, CollectionFormat.CSV); - String tagIdsConverted = this.client.serializerAdapter().serializeList(tagIds, CollectionFormat.CSV); - return service.deleteImageTags(projectId, imageIdsConverted, tagIdsConverted, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) + return service.deleteImages(projectId, imageIdsConverted, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = deleteImageTagsDelegate(response); + ServiceResponse clientResponse = deleteImagesDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -3578,102 +4064,130 @@ public Observable> call(Response response) { }); } - private ServiceResponse deleteImageTagsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse deleteImagesDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(204, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .registerError(CustomVisionErrorException.class) .build(response); } /** - * Associate a set of images with a set of tags. + * Add the provided images to the set of training images. + * This API accepts body content as multipart/form-data and application/octet-stream. When using multipart + multiple image files can be sent at once, with a maximum of 64 files. * - * @param projectId The project id - * @param createImageTagsOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB. + * @param createImagesFromDataOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageTagCreateSummary object if successful. + * @return the ImageCreateSummary object if successful. */ - public ImageTagCreateSummary createImageTags(UUID projectId, CreateImageTagsOptionalParameter createImageTagsOptionalParameter) { - return createImageTagsWithServiceResponseAsync(projectId, createImageTagsOptionalParameter).toBlocking().single().body(); + public ImageCreateSummary createImagesFromData(UUID projectId, byte[] imageData, CreateImagesFromDataOptionalParameter createImagesFromDataOptionalParameter) { + return createImagesFromDataWithServiceResponseAsync(projectId, imageData, createImagesFromDataOptionalParameter).toBlocking().single().body(); } /** - * Associate a set of images with a set of tags. + * Add the provided images to the set of training images. + * This API accepts body content as multipart/form-data and application/octet-stream. When using multipart + multiple image files can be sent at once, with a maximum of 64 files. * - * @param projectId The project id - * @param createImageTagsOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB. + * @param createImagesFromDataOptionalParameter the object representing the optional parameters to be set before calling this API * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture createImageTagsAsync(UUID projectId, CreateImageTagsOptionalParameter createImageTagsOptionalParameter, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(createImageTagsWithServiceResponseAsync(projectId, createImageTagsOptionalParameter), serviceCallback); + public ServiceFuture createImagesFromDataAsync(UUID projectId, byte[] imageData, CreateImagesFromDataOptionalParameter createImagesFromDataOptionalParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createImagesFromDataWithServiceResponseAsync(projectId, imageData, createImagesFromDataOptionalParameter), serviceCallback); } /** - * Associate a set of images with a set of tags. + * Add the provided images to the set of training images. + * This API accepts body content as multipart/form-data and application/octet-stream. When using multipart + multiple image files can be sent at once, with a maximum of 64 files. * - * @param projectId The project id - * @param createImageTagsOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB. + * @param createImagesFromDataOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageTagCreateSummary object + * @return the observable to the ImageCreateSummary object */ - public Observable createImageTagsAsync(UUID projectId, CreateImageTagsOptionalParameter createImageTagsOptionalParameter) { - return createImageTagsWithServiceResponseAsync(projectId, createImageTagsOptionalParameter).map(new Func1, ImageTagCreateSummary>() { + public Observable createImagesFromDataAsync(UUID projectId, byte[] imageData, CreateImagesFromDataOptionalParameter createImagesFromDataOptionalParameter) { + return createImagesFromDataWithServiceResponseAsync(projectId, imageData, createImagesFromDataOptionalParameter).map(new Func1, ImageCreateSummary>() { @Override - public ImageTagCreateSummary call(ServiceResponse response) { + public ImageCreateSummary call(ServiceResponse response) { return response.body(); } }); } /** - * Associate a set of images with a set of tags. + * Add the provided images to the set of training images. + * This API accepts body content as multipart/form-data and application/octet-stream. When using multipart + multiple image files can be sent at once, with a maximum of 64 files. * - * @param projectId The project id - * @param createImageTagsOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB. + * @param createImagesFromDataOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageTagCreateSummary object + * @return the observable to the ImageCreateSummary object */ - public Observable> createImageTagsWithServiceResponseAsync(UUID projectId, CreateImageTagsOptionalParameter createImageTagsOptionalParameter) { + public Observable> createImagesFromDataWithServiceResponseAsync(UUID projectId, byte[] imageData, CreateImagesFromDataOptionalParameter createImagesFromDataOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } + if (imageData == null) { + throw new IllegalArgumentException("Parameter imageData is required and cannot be null."); + } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - final List tags = createImageTagsOptionalParameter != null ? createImageTagsOptionalParameter.tags() : null; + final List tagIds = createImagesFromDataOptionalParameter != null ? createImagesFromDataOptionalParameter.tagIds() : null; - return createImageTagsWithServiceResponseAsync(projectId, tags); + return createImagesFromDataWithServiceResponseAsync(projectId, imageData, tagIds); } /** - * Associate a set of images with a set of tags. + * Add the provided images to the set of training images. + * This API accepts body content as multipart/form-data and application/octet-stream. When using multipart + multiple image files can be sent at once, with a maximum of 64 files. * - * @param projectId The project id - * @param tags the List<ImageTagCreateEntry> value + * @param projectId The project id. + * @param imageData Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB. + * @param tagIds The tags ids with which to tag each image. Limited to 20. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageTagCreateSummary object + * @return the observable to the ImageCreateSummary object */ - public Observable> createImageTagsWithServiceResponseAsync(UUID projectId, List tags) { + public Observable> createImagesFromDataWithServiceResponseAsync(UUID projectId, byte[] imageData, List tagIds) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } + if (imageData == null) { + throw new IllegalArgumentException("Parameter imageData is required and cannot be null."); + } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - Validator.validate(tags); - ImageTagCreateBatch batch = new ImageTagCreateBatch(); - batch.withTags(tags); - return service.createImageTags(projectId, this.client.apiKey(), this.client.acceptLanguage(), batch, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + Validator.validate(tagIds); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + String tagIdsConverted = this.client.serializerAdapter().serializeList(tagIds, CollectionFormat.CSV); + RequestBody imageDataConverted = RequestBody.create(MediaType.parse("multipart/form-data"), imageData); + return service.createImagesFromData(projectId, tagIdsConverted, imageDataConverted, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = createImageTagsDelegate(response); + ServiceResponse clientResponse = createImagesFromDataDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -3682,135 +4196,176 @@ public Observable> call(Response createImageTagsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse createImagesFromDataDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } @Override - public TrainingsCreateImageTagsParameters createImageTags() { - return new TrainingsCreateImageTagsParameters(this); + public TrainingsCreateImagesFromDataParameters createImagesFromData() { + return new TrainingsCreateImagesFromDataParameters(this); } /** - * Internal class implementing TrainingsCreateImageTagsDefinition. + * Internal class implementing TrainingsCreateImagesFromDataDefinition. */ - class TrainingsCreateImageTagsParameters implements TrainingsCreateImageTagsDefinition { + class TrainingsCreateImagesFromDataParameters implements TrainingsCreateImagesFromDataDefinition { private TrainingsImpl parent; private UUID projectId; - private List tags; + private byte[] imageData; + private List tagIds; /** * Constructor. * @param parent the parent object. */ - TrainingsCreateImageTagsParameters(TrainingsImpl parent) { + TrainingsCreateImagesFromDataParameters(TrainingsImpl parent) { this.parent = parent; } @Override - public TrainingsCreateImageTagsParameters withProjectId(UUID projectId) { + public TrainingsCreateImagesFromDataParameters withProjectId(UUID projectId) { this.projectId = projectId; return this; } @Override - public TrainingsCreateImageTagsParameters withTags(List tags) { - this.tags = tags; + public TrainingsCreateImagesFromDataParameters withImageData(byte[] imageData) { + this.imageData = imageData; return this; } @Override - public ImageTagCreateSummary execute() { - return createImageTagsWithServiceResponseAsync(projectId, tags).toBlocking().single().body(); + public TrainingsCreateImagesFromDataParameters withTagIds(List tagIds) { + this.tagIds = tagIds; + return this; + } + + @Override + public ImageCreateSummary execute() { + return createImagesFromDataWithServiceResponseAsync(projectId, imageData, tagIds).toBlocking().single().body(); } @Override - public Observable executeAsync() { - return createImageTagsWithServiceResponseAsync(projectId, tags).map(new Func1, ImageTagCreateSummary>() { + public Observable executeAsync() { + return createImagesFromDataWithServiceResponseAsync(projectId, imageData, tagIds).map(new Func1, ImageCreateSummary>() { @Override - public ImageTagCreateSummary call(ServiceResponse response) { + public ImageCreateSummary call(ServiceResponse response) { return response.body(); } }); } } + /** - * Add the specified predicted images to the set of training images. - * This API creates a batch of images from predicted images specified. There is a limit of 64 images and 20 tags. + * Get images by id for a given project iteration. + * This API will return a set of Images for the specified tags and optionally iteration. If no iteration is specified the + current workspace is used. * - * @param projectId The project id - * @param batch Image and tag ids. Limted to 64 images and 20 tags per batch + * @param projectId The project id. + * @param getImagesByIdsOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageCreateSummary object if successful. + * @return the List<Image> object if successful. */ - public ImageCreateSummary createImagesFromPredictions(UUID projectId, ImageIdCreateBatch batch) { - return createImagesFromPredictionsWithServiceResponseAsync(projectId, batch).toBlocking().single().body(); + public List getImagesByIds(UUID projectId, GetImagesByIdsOptionalParameter getImagesByIdsOptionalParameter) { + return getImagesByIdsWithServiceResponseAsync(projectId, getImagesByIdsOptionalParameter).toBlocking().single().body(); } /** - * Add the specified predicted images to the set of training images. - * This API creates a batch of images from predicted images specified. There is a limit of 64 images and 20 tags. + * Get images by id for a given project iteration. + * This API will return a set of Images for the specified tags and optionally iteration. If no iteration is specified the + current workspace is used. * - * @param projectId The project id - * @param batch Image and tag ids. Limted to 64 images and 20 tags per batch + * @param projectId The project id. + * @param getImagesByIdsOptionalParameter the object representing the optional parameters to be set before calling this API * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture createImagesFromPredictionsAsync(UUID projectId, ImageIdCreateBatch batch, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(createImagesFromPredictionsWithServiceResponseAsync(projectId, batch), serviceCallback); + public ServiceFuture> getImagesByIdsAsync(UUID projectId, GetImagesByIdsOptionalParameter getImagesByIdsOptionalParameter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(getImagesByIdsWithServiceResponseAsync(projectId, getImagesByIdsOptionalParameter), serviceCallback); } /** - * Add the specified predicted images to the set of training images. - * This API creates a batch of images from predicted images specified. There is a limit of 64 images and 20 tags. + * Get images by id for a given project iteration. + * This API will return a set of Images for the specified tags and optionally iteration. If no iteration is specified the + current workspace is used. * - * @param projectId The project id - * @param batch Image and tag ids. Limted to 64 images and 20 tags per batch + * @param projectId The project id. + * @param getImagesByIdsOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageCreateSummary object + * @return the observable to the List<Image> object */ - public Observable createImagesFromPredictionsAsync(UUID projectId, ImageIdCreateBatch batch) { - return createImagesFromPredictionsWithServiceResponseAsync(projectId, batch).map(new Func1, ImageCreateSummary>() { + public Observable> getImagesByIdsAsync(UUID projectId, GetImagesByIdsOptionalParameter getImagesByIdsOptionalParameter) { + return getImagesByIdsWithServiceResponseAsync(projectId, getImagesByIdsOptionalParameter).map(new Func1>, List>() { @Override - public ImageCreateSummary call(ServiceResponse response) { + public List call(ServiceResponse> response) { return response.body(); } }); } /** - * Add the specified predicted images to the set of training images. - * This API creates a batch of images from predicted images specified. There is a limit of 64 images and 20 tags. + * Get images by id for a given project iteration. + * This API will return a set of Images for the specified tags and optionally iteration. If no iteration is specified the + current workspace is used. * - * @param projectId The project id - * @param batch Image and tag ids. Limted to 64 images and 20 tags per batch + * @param projectId The project id. + * @param getImagesByIdsOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageCreateSummary object + * @return the observable to the List<Image> object */ - public Observable> createImagesFromPredictionsWithServiceResponseAsync(UUID projectId, ImageIdCreateBatch batch) { + public Observable>> getImagesByIdsWithServiceResponseAsync(UUID projectId, GetImagesByIdsOptionalParameter getImagesByIdsOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } - if (batch == null) { - throw new IllegalArgumentException("Parameter batch is required and cannot be null."); + if (this.client.apiKey() == null) { + throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); + } + final List imageIds = getImagesByIdsOptionalParameter != null ? getImagesByIdsOptionalParameter.imageIds() : null; + final UUID iterationId = getImagesByIdsOptionalParameter != null ? getImagesByIdsOptionalParameter.iterationId() : null; + + return getImagesByIdsWithServiceResponseAsync(projectId, imageIds, iterationId); + } + + /** + * Get images by id for a given project iteration. + * This API will return a set of Images for the specified tags and optionally iteration. If no iteration is specified the + current workspace is used. + * + * @param projectId The project id. + * @param imageIds The list of image ids to retrieve. Limited to 256. + * @param iterationId The iteration id. Defaults to workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<Image> object + */ + public Observable>> getImagesByIdsWithServiceResponseAsync(UUID projectId, List imageIds, UUID iterationId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (projectId == null) { + throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - Validator.validate(batch); - return service.createImagesFromPredictions(projectId, batch, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + Validator.validate(imageIds); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + String imageIdsConverted = this.client.serializerAdapter().serializeList(imageIds, CollectionFormat.CSV); + return service.getImagesByIds(projectId, imageIdsConverted, iterationId, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = createImagesFromPredictionsDelegate(response); + ServiceResponse> clientResponse = getImagesByIdsDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -3819,174 +4374,178 @@ public Observable> call(Response createImagesFromPredictionsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse> getImagesByIdsDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CustomVisionErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } - /** - * Add the provided images urls to the set of training images. - * This API accepts a batch of urls, and optionally tags, to create images. There is a limit of 64 images and 20 tags. - * - * @param projectId The project id - * @param batch Image urls and tag ids. Limited to 64 images and 20 tags per batch - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageCreateSummary object if successful. - */ - public ImageCreateSummary createImagesFromUrls(UUID projectId, ImageUrlCreateBatch batch) { - return createImagesFromUrlsWithServiceResponseAsync(projectId, batch).toBlocking().single().body(); + @Override + public TrainingsGetImagesByIdsParameters getImagesByIds() { + return new TrainingsGetImagesByIdsParameters(this); } /** - * Add the provided images urls to the set of training images. - * This API accepts a batch of urls, and optionally tags, to create images. There is a limit of 64 images and 20 tags. - * - * @param projectId The project id - * @param batch Image urls and tag ids. Limited to 64 images and 20 tags per batch - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceFuture} object + * Internal class implementing TrainingsGetImagesByIdsDefinition. */ - public ServiceFuture createImagesFromUrlsAsync(UUID projectId, ImageUrlCreateBatch batch, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(createImagesFromUrlsWithServiceResponseAsync(projectId, batch), serviceCallback); - } + class TrainingsGetImagesByIdsParameters implements TrainingsGetImagesByIdsDefinition { + private TrainingsImpl parent; + private UUID projectId; + private List imageIds; + private UUID iterationId; - /** - * Add the provided images urls to the set of training images. - * This API accepts a batch of urls, and optionally tags, to create images. There is a limit of 64 images and 20 tags. - * - * @param projectId The project id - * @param batch Image urls and tag ids. Limited to 64 images and 20 tags per batch - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageCreateSummary object - */ - public Observable createImagesFromUrlsAsync(UUID projectId, ImageUrlCreateBatch batch) { - return createImagesFromUrlsWithServiceResponseAsync(projectId, batch).map(new Func1, ImageCreateSummary>() { - @Override - public ImageCreateSummary call(ServiceResponse response) { - return response.body(); - } - }); - } + /** + * Constructor. + * @param parent the parent object. + */ + TrainingsGetImagesByIdsParameters(TrainingsImpl parent) { + this.parent = parent; + } - /** - * Add the provided images urls to the set of training images. - * This API accepts a batch of urls, and optionally tags, to create images. There is a limit of 64 images and 20 tags. - * - * @param projectId The project id - * @param batch Image urls and tag ids. Limited to 64 images and 20 tags per batch - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageCreateSummary object - */ - public Observable> createImagesFromUrlsWithServiceResponseAsync(UUID projectId, ImageUrlCreateBatch batch) { - if (projectId == null) { - throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); + @Override + public TrainingsGetImagesByIdsParameters withProjectId(UUID projectId) { + this.projectId = projectId; + return this; } - if (batch == null) { - throw new IllegalArgumentException("Parameter batch is required and cannot be null."); + + @Override + public TrainingsGetImagesByIdsParameters withImageIds(List imageIds) { + this.imageIds = imageIds; + return this; } - if (this.client.apiKey() == null) { - throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); + + @Override + public TrainingsGetImagesByIdsParameters withIterationId(UUID iterationId) { + this.iterationId = iterationId; + return this; } - Validator.validate(batch); - return service.createImagesFromUrls(projectId, batch, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + + @Override + public List execute() { + return getImagesByIdsWithServiceResponseAsync(projectId, imageIds, iterationId).toBlocking().single().body(); + } + + @Override + public Observable> executeAsync() { + return getImagesByIdsWithServiceResponseAsync(projectId, imageIds, iterationId).map(new Func1>, List>() { @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = createImagesFromUrlsDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } + public List call(ServiceResponse> response) { + return response.body(); } }); + } } - private ServiceResponse createImagesFromUrlsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) - .build(response); - } /** - * Add the provided batch of images to the set of training images. - * This API accepts a batch of files, and optionally tags, to create images. There is a limit of 64 images and 20 tags. + * Get untagged images for a given project iteration. + * This API supports batching and range selection. By default it will only return first 50 images matching images. + Use the {take} and {skip} parameters to control how many images to return in a given batch. * - * @param projectId The project id - * @param batch The batch of image files to add. Limited to 64 images and 20 tags per batch + * @param projectId The project id. + * @param getUntaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageCreateSummary object if successful. + * @return the List<Image> object if successful. */ - public ImageCreateSummary createImagesFromFiles(UUID projectId, ImageFileCreateBatch batch) { - return createImagesFromFilesWithServiceResponseAsync(projectId, batch).toBlocking().single().body(); + public List getUntaggedImages(UUID projectId, GetUntaggedImagesOptionalParameter getUntaggedImagesOptionalParameter) { + return getUntaggedImagesWithServiceResponseAsync(projectId, getUntaggedImagesOptionalParameter).toBlocking().single().body(); } /** - * Add the provided batch of images to the set of training images. - * This API accepts a batch of files, and optionally tags, to create images. There is a limit of 64 images and 20 tags. + * Get untagged images for a given project iteration. + * This API supports batching and range selection. By default it will only return first 50 images matching images. + Use the {take} and {skip} parameters to control how many images to return in a given batch. * - * @param projectId The project id - * @param batch The batch of image files to add. Limited to 64 images and 20 tags per batch + * @param projectId The project id. + * @param getUntaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture createImagesFromFilesAsync(UUID projectId, ImageFileCreateBatch batch, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(createImagesFromFilesWithServiceResponseAsync(projectId, batch), serviceCallback); + public ServiceFuture> getUntaggedImagesAsync(UUID projectId, GetUntaggedImagesOptionalParameter getUntaggedImagesOptionalParameter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(getUntaggedImagesWithServiceResponseAsync(projectId, getUntaggedImagesOptionalParameter), serviceCallback); } /** - * Add the provided batch of images to the set of training images. - * This API accepts a batch of files, and optionally tags, to create images. There is a limit of 64 images and 20 tags. + * Get untagged images for a given project iteration. + * This API supports batching and range selection. By default it will only return first 50 images matching images. + Use the {take} and {skip} parameters to control how many images to return in a given batch. * - * @param projectId The project id - * @param batch The batch of image files to add. Limited to 64 images and 20 tags per batch + * @param projectId The project id. + * @param getUntaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageCreateSummary object + * @return the observable to the List<Image> object */ - public Observable createImagesFromFilesAsync(UUID projectId, ImageFileCreateBatch batch) { - return createImagesFromFilesWithServiceResponseAsync(projectId, batch).map(new Func1, ImageCreateSummary>() { + public Observable> getUntaggedImagesAsync(UUID projectId, GetUntaggedImagesOptionalParameter getUntaggedImagesOptionalParameter) { + return getUntaggedImagesWithServiceResponseAsync(projectId, getUntaggedImagesOptionalParameter).map(new Func1>, List>() { @Override - public ImageCreateSummary call(ServiceResponse response) { + public List call(ServiceResponse> response) { return response.body(); } }); } /** - * Add the provided batch of images to the set of training images. - * This API accepts a batch of files, and optionally tags, to create images. There is a limit of 64 images and 20 tags. + * Get untagged images for a given project iteration. + * This API supports batching and range selection. By default it will only return first 50 images matching images. + Use the {take} and {skip} parameters to control how many images to return in a given batch. * - * @param projectId The project id - * @param batch The batch of image files to add. Limited to 64 images and 20 tags per batch + * @param projectId The project id. + * @param getUntaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageCreateSummary object + * @return the observable to the List<Image> object */ - public Observable> createImagesFromFilesWithServiceResponseAsync(UUID projectId, ImageFileCreateBatch batch) { + public Observable>> getUntaggedImagesWithServiceResponseAsync(UUID projectId, GetUntaggedImagesOptionalParameter getUntaggedImagesOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } - if (batch == null) { - throw new IllegalArgumentException("Parameter batch is required and cannot be null."); + if (this.client.apiKey() == null) { + throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); + } + final UUID iterationId = getUntaggedImagesOptionalParameter != null ? getUntaggedImagesOptionalParameter.iterationId() : null; + final String orderBy = getUntaggedImagesOptionalParameter != null ? getUntaggedImagesOptionalParameter.orderBy() : null; + final Integer take = getUntaggedImagesOptionalParameter != null ? getUntaggedImagesOptionalParameter.take() : null; + final Integer skip = getUntaggedImagesOptionalParameter != null ? getUntaggedImagesOptionalParameter.skip() : null; + + return getUntaggedImagesWithServiceResponseAsync(projectId, iterationId, orderBy, take, skip); + } + + /** + * Get untagged images for a given project iteration. + * This API supports batching and range selection. By default it will only return first 50 images matching images. + Use the {take} and {skip} parameters to control how many images to return in a given batch. + * + * @param projectId The project id. + * @param iterationId The iteration id. Defaults to workspace. + * @param orderBy The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest' + * @param take Maximum number of images to return. Defaults to 50, limited to 256. + * @param skip Number of images to skip before beginning the image batch. Defaults to 0. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<Image> object + */ + public Observable>> getUntaggedImagesWithServiceResponseAsync(UUID projectId, UUID iterationId, String orderBy, Integer take, Integer skip) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (projectId == null) { + throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - Validator.validate(batch); - return service.createImagesFromFiles(projectId, batch, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.getUntaggedImages(projectId, iterationId, orderBy, take, skip, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = createImagesFromFilesDelegate(response); + ServiceResponse> clientResponse = getUntaggedImagesDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -3995,207 +4554,206 @@ public Observable> call(Response createImagesFromFilesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse> getUntaggedImagesDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CustomVisionErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } - /** - * Delete images from the set of training images. - * - * @param projectId The project id - * @param imageIds Ids of the images to be deleted. Limted to 256 images per batch - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - */ - public void deleteImages(UUID projectId, List imageIds) { - deleteImagesWithServiceResponseAsync(projectId, imageIds).toBlocking().single().body(); + @Override + public TrainingsGetUntaggedImagesParameters getUntaggedImages() { + return new TrainingsGetUntaggedImagesParameters(this); } /** - * Delete images from the set of training images. - * - * @param projectId The project id - * @param imageIds Ids of the images to be deleted. Limted to 256 images per batch - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceFuture} object + * Internal class implementing TrainingsGetUntaggedImagesDefinition. */ - public ServiceFuture deleteImagesAsync(UUID projectId, List imageIds, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(deleteImagesWithServiceResponseAsync(projectId, imageIds), serviceCallback); - } + class TrainingsGetUntaggedImagesParameters implements TrainingsGetUntaggedImagesDefinition { + private TrainingsImpl parent; + private UUID projectId; + private UUID iterationId; + private String orderBy; + private Integer take; + private Integer skip; - /** - * Delete images from the set of training images. - * - * @param projectId The project id - * @param imageIds Ids of the images to be deleted. Limted to 256 images per batch - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. - */ - public Observable deleteImagesAsync(UUID projectId, List imageIds) { - return deleteImagesWithServiceResponseAsync(projectId, imageIds).map(new Func1, Void>() { - @Override - public Void call(ServiceResponse response) { - return response.body(); - } - }); - } + /** + * Constructor. + * @param parent the parent object. + */ + TrainingsGetUntaggedImagesParameters(TrainingsImpl parent) { + this.parent = parent; + } - /** - * Delete images from the set of training images. - * - * @param projectId The project id - * @param imageIds Ids of the images to be deleted. Limted to 256 images per batch - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. - */ - public Observable> deleteImagesWithServiceResponseAsync(UUID projectId, List imageIds) { - if (projectId == null) { - throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); + @Override + public TrainingsGetUntaggedImagesParameters withProjectId(UUID projectId) { + this.projectId = projectId; + return this; } - if (imageIds == null) { - throw new IllegalArgumentException("Parameter imageIds is required and cannot be null."); + + @Override + public TrainingsGetUntaggedImagesParameters withIterationId(UUID iterationId) { + this.iterationId = iterationId; + return this; } - if (this.client.apiKey() == null) { - throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); + + @Override + public TrainingsGetUntaggedImagesParameters withOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; } - Validator.validate(imageIds); - String imageIdsConverted = this.client.serializerAdapter().serializeList(imageIds, CollectionFormat.CSV); - return service.deleteImages(projectId, imageIdsConverted, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + + @Override + public TrainingsGetUntaggedImagesParameters withTake(Integer take) { + this.take = take; + return this; + } + + @Override + public TrainingsGetUntaggedImagesParameters withSkip(Integer skip) { + this.skip = skip; + return this; + } + + @Override + public List execute() { + return getUntaggedImagesWithServiceResponseAsync(projectId, iterationId, orderBy, take, skip).toBlocking().single().body(); + } + + @Override + public Observable> executeAsync() { + return getUntaggedImagesWithServiceResponseAsync(projectId, iterationId, orderBy, take, skip).map(new Func1>, List>() { @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = deleteImagesDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } + public List call(ServiceResponse> response) { + return response.body(); } }); - } - - private ServiceResponse deleteImagesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(204, new TypeToken() { }.getType()) - .registerError(CloudException.class) - .build(response); + } } /** - * Add the provided images to the set of training images. - * This API accepts body content as multipart/form-data and application/octet-stream. When using multipart - multiple image files can be sent at once, with a maximum of 64 files. + * Get tagged images for a given project iteration. + * This API supports batching and range selection. By default it will only return first 50 images matching images. + Use the {take} and {skip} parameters to control how many images to return in a given batch. + The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @param projectId The project id - * @param imageData the InputStream value - * @param createImagesFromDataOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param getTaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ImageCreateSummary object if successful. + * @return the List<Image> object if successful. */ - public ImageCreateSummary createImagesFromData(UUID projectId, byte[] imageData, CreateImagesFromDataOptionalParameter createImagesFromDataOptionalParameter) { - return createImagesFromDataWithServiceResponseAsync(projectId, imageData, createImagesFromDataOptionalParameter).toBlocking().single().body(); + public List getTaggedImages(UUID projectId, GetTaggedImagesOptionalParameter getTaggedImagesOptionalParameter) { + return getTaggedImagesWithServiceResponseAsync(projectId, getTaggedImagesOptionalParameter).toBlocking().single().body(); } /** - * Add the provided images to the set of training images. - * This API accepts body content as multipart/form-data and application/octet-stream. When using multipart - multiple image files can be sent at once, with a maximum of 64 files. + * Get tagged images for a given project iteration. + * This API supports batching and range selection. By default it will only return first 50 images matching images. + Use the {take} and {skip} parameters to control how many images to return in a given batch. + The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @param projectId The project id - * @param imageData the InputStream value - * @param createImagesFromDataOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param getTaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture createImagesFromDataAsync(UUID projectId, byte[] imageData, CreateImagesFromDataOptionalParameter createImagesFromDataOptionalParameter, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(createImagesFromDataWithServiceResponseAsync(projectId, imageData, createImagesFromDataOptionalParameter), serviceCallback); + public ServiceFuture> getTaggedImagesAsync(UUID projectId, GetTaggedImagesOptionalParameter getTaggedImagesOptionalParameter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(getTaggedImagesWithServiceResponseAsync(projectId, getTaggedImagesOptionalParameter), serviceCallback); } /** - * Add the provided images to the set of training images. - * This API accepts body content as multipart/form-data and application/octet-stream. When using multipart - multiple image files can be sent at once, with a maximum of 64 files. + * Get tagged images for a given project iteration. + * This API supports batching and range selection. By default it will only return first 50 images matching images. + Use the {take} and {skip} parameters to control how many images to return in a given batch. + The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @param projectId The project id - * @param imageData the InputStream value - * @param createImagesFromDataOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param getTaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageCreateSummary object + * @return the observable to the List<Image> object */ - public Observable createImagesFromDataAsync(UUID projectId, byte[] imageData, CreateImagesFromDataOptionalParameter createImagesFromDataOptionalParameter) { - return createImagesFromDataWithServiceResponseAsync(projectId, imageData, createImagesFromDataOptionalParameter).map(new Func1, ImageCreateSummary>() { + public Observable> getTaggedImagesAsync(UUID projectId, GetTaggedImagesOptionalParameter getTaggedImagesOptionalParameter) { + return getTaggedImagesWithServiceResponseAsync(projectId, getTaggedImagesOptionalParameter).map(new Func1>, List>() { @Override - public ImageCreateSummary call(ServiceResponse response) { + public List call(ServiceResponse> response) { return response.body(); } }); } /** - * Add the provided images to the set of training images. - * This API accepts body content as multipart/form-data and application/octet-stream. When using multipart - multiple image files can be sent at once, with a maximum of 64 files. + * Get tagged images for a given project iteration. + * This API supports batching and range selection. By default it will only return first 50 images matching images. + Use the {take} and {skip} parameters to control how many images to return in a given batch. + The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @param projectId The project id - * @param imageData the InputStream value - * @param createImagesFromDataOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param getTaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageCreateSummary object + * @return the observable to the List<Image> object */ - public Observable> createImagesFromDataWithServiceResponseAsync(UUID projectId, byte[] imageData, CreateImagesFromDataOptionalParameter createImagesFromDataOptionalParameter) { + public Observable>> getTaggedImagesWithServiceResponseAsync(UUID projectId, GetTaggedImagesOptionalParameter getTaggedImagesOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } - if (imageData == null) { - throw new IllegalArgumentException("Parameter imageData is required and cannot be null."); - } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - final List tagIds = createImagesFromDataOptionalParameter != null ? createImagesFromDataOptionalParameter.tagIds() : null; + final UUID iterationId = getTaggedImagesOptionalParameter != null ? getTaggedImagesOptionalParameter.iterationId() : null; + final List tagIds = getTaggedImagesOptionalParameter != null ? getTaggedImagesOptionalParameter.tagIds() : null; + final String orderBy = getTaggedImagesOptionalParameter != null ? getTaggedImagesOptionalParameter.orderBy() : null; + final Integer take = getTaggedImagesOptionalParameter != null ? getTaggedImagesOptionalParameter.take() : null; + final Integer skip = getTaggedImagesOptionalParameter != null ? getTaggedImagesOptionalParameter.skip() : null; - return createImagesFromDataWithServiceResponseAsync(projectId, imageData, tagIds); + return getTaggedImagesWithServiceResponseAsync(projectId, iterationId, tagIds, orderBy, take, skip); } /** - * Add the provided images to the set of training images. - * This API accepts body content as multipart/form-data and application/octet-stream. When using multipart - multiple image files can be sent at once, with a maximum of 64 files. + * Get tagged images for a given project iteration. + * This API supports batching and range selection. By default it will only return first 50 images matching images. + Use the {take} and {skip} parameters to control how many images to return in a given batch. + The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @param projectId The project id - * @param imageData the InputStream value - * @param tagIds The tags ids with which to tag each image. Limited to 20 + * @param projectId The project id. + * @param iterationId The iteration id. Defaults to workspace. + * @param tagIds A list of tags ids to filter the images. Defaults to all tagged images when null. Limited to 20. + * @param orderBy The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest' + * @param take Maximum number of images to return. Defaults to 50, limited to 256. + * @param skip Number of images to skip before beginning the image batch. Defaults to 0. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ImageCreateSummary object + * @return the observable to the List<Image> object */ - public Observable> createImagesFromDataWithServiceResponseAsync(UUID projectId, byte[] imageData, List tagIds) { + public Observable>> getTaggedImagesWithServiceResponseAsync(UUID projectId, UUID iterationId, List tagIds, String orderBy, Integer take, Integer skip) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } - if (imageData == null) { - throw new IllegalArgumentException("Parameter imageData is required and cannot be null."); - } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } Validator.validate(tagIds); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); String tagIdsConverted = this.client.serializerAdapter().serializeList(tagIds, CollectionFormat.CSV); - RequestBody imageDataConverted = RequestBody.create(MediaType.parse("multipart/form-data"), imageData); - return service.createImagesFromData(projectId, tagIdsConverted, imageDataConverted, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.getTaggedImages(projectId, iterationId, tagIdsConverted, orderBy, take, skip, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = createImagesFromDataDelegate(response); + ServiceResponse> clientResponse = getTaggedImagesDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -4204,169 +4762,284 @@ public Observable> call(Response createImagesFromDataDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse> getTaggedImagesDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CustomVisionErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } @Override - public TrainingsCreateImagesFromDataParameters createImagesFromData() { - return new TrainingsCreateImagesFromDataParameters(this); + public TrainingsGetTaggedImagesParameters getTaggedImages() { + return new TrainingsGetTaggedImagesParameters(this); } /** - * Internal class implementing TrainingsCreateImagesFromDataDefinition. + * Internal class implementing TrainingsGetTaggedImagesDefinition. */ - class TrainingsCreateImagesFromDataParameters implements TrainingsCreateImagesFromDataDefinition { + class TrainingsGetTaggedImagesParameters implements TrainingsGetTaggedImagesDefinition { private TrainingsImpl parent; private UUID projectId; - private byte[] imageData; - private List tagIds; + private UUID iterationId; + private List tagIds; + private String orderBy; + private Integer take; + private Integer skip; /** * Constructor. * @param parent the parent object. */ - TrainingsCreateImagesFromDataParameters(TrainingsImpl parent) { + TrainingsGetTaggedImagesParameters(TrainingsImpl parent) { this.parent = parent; } @Override - public TrainingsCreateImagesFromDataParameters withProjectId(UUID projectId) { + public TrainingsGetTaggedImagesParameters withProjectId(UUID projectId) { this.projectId = projectId; return this; } @Override - public TrainingsCreateImagesFromDataParameters withImageData(byte[] imageData) { - this.imageData = imageData; + public TrainingsGetTaggedImagesParameters withIterationId(UUID iterationId) { + this.iterationId = iterationId; return this; } @Override - public TrainingsCreateImagesFromDataParameters withTagIds(List tagIds) { + public TrainingsGetTaggedImagesParameters withTagIds(List tagIds) { this.tagIds = tagIds; return this; } @Override - public ImageCreateSummary execute() { - return createImagesFromDataWithServiceResponseAsync(projectId, imageData, tagIds).toBlocking().single().body(); + public TrainingsGetTaggedImagesParameters withOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + + @Override + public TrainingsGetTaggedImagesParameters withTake(Integer take) { + this.take = take; + return this; + } + + @Override + public TrainingsGetTaggedImagesParameters withSkip(Integer skip) { + this.skip = skip; + return this; + } + + @Override + public List execute() { + return getTaggedImagesWithServiceResponseAsync(projectId, iterationId, tagIds, orderBy, take, skip).toBlocking().single().body(); } @Override - public Observable executeAsync() { - return createImagesFromDataWithServiceResponseAsync(projectId, imageData, tagIds).map(new Func1, ImageCreateSummary>() { + public Observable> executeAsync() { + return getTaggedImagesWithServiceResponseAsync(projectId, iterationId, tagIds, orderBy, take, skip).map(new Func1>, List>() { @Override - public ImageCreateSummary call(ServiceResponse response) { + public List call(ServiceResponse> response) { return response.body(); } }); } } + /** + * Delete a set of image regions. + * + * @param projectId The project id. + * @param regionIds Regions to delete. Limited to 64. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CustomVisionErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteImageRegions(UUID projectId, List regionIds) { + deleteImageRegionsWithServiceResponseAsync(projectId, regionIds).toBlocking().single().body(); + } /** - * Get images by id for a given project iteration. - * This API will return a set of Images for the specified tags and optionally iteration. If no iteration is specified the - current workspace is used. + * Delete a set of image regions. * - * @param projectId The project id - * @param getImagesByIdsOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param regionIds Regions to delete. Limited to 64. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteImageRegionsAsync(UUID projectId, List regionIds, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteImageRegionsWithServiceResponseAsync(projectId, regionIds), serviceCallback); + } + + /** + * Delete a set of image regions. + * + * @param projectId The project id. + * @param regionIds Regions to delete. Limited to 64. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteImageRegionsAsync(UUID projectId, List regionIds) { + return deleteImageRegionsWithServiceResponseAsync(projectId, regionIds).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete a set of image regions. + * + * @param projectId The project id. + * @param regionIds Regions to delete. Limited to 64. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteImageRegionsWithServiceResponseAsync(UUID projectId, List regionIds) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } + if (projectId == null) { + throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); + } + if (regionIds == null) { + throw new IllegalArgumentException("Parameter regionIds is required and cannot be null."); + } + if (this.client.apiKey() == null) { + throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); + } + Validator.validate(regionIds); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + String regionIdsConverted = this.client.serializerAdapter().serializeList(regionIds, CollectionFormat.CSV); + return service.deleteImageRegions(projectId, regionIdsConverted, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteImageRegionsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteImageRegionsDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) + .build(response); + } + + + /** + * Create a set of image regions. + * This API accepts a batch of image regions, and optionally tags, to update existing images with region information. + There is a limit of 64 entries in the batch. + * + * @param projectId The project id. + * @param createImageRegionsOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the List<Image> object if successful. + * @return the ImageRegionCreateSummary object if successful. */ - public List getImagesByIds(UUID projectId, GetImagesByIdsOptionalParameter getImagesByIdsOptionalParameter) { - return getImagesByIdsWithServiceResponseAsync(projectId, getImagesByIdsOptionalParameter).toBlocking().single().body(); + public ImageRegionCreateSummary createImageRegions(UUID projectId, CreateImageRegionsOptionalParameter createImageRegionsOptionalParameter) { + return createImageRegionsWithServiceResponseAsync(projectId, createImageRegionsOptionalParameter).toBlocking().single().body(); } /** - * Get images by id for a given project iteration. - * This API will return a set of Images for the specified tags and optionally iteration. If no iteration is specified the - current workspace is used. + * Create a set of image regions. + * This API accepts a batch of image regions, and optionally tags, to update existing images with region information. + There is a limit of 64 entries in the batch. * - * @param projectId The project id - * @param getImagesByIdsOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param createImageRegionsOptionalParameter the object representing the optional parameters to be set before calling this API * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> getImagesByIdsAsync(UUID projectId, GetImagesByIdsOptionalParameter getImagesByIdsOptionalParameter, final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(getImagesByIdsWithServiceResponseAsync(projectId, getImagesByIdsOptionalParameter), serviceCallback); + public ServiceFuture createImageRegionsAsync(UUID projectId, CreateImageRegionsOptionalParameter createImageRegionsOptionalParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createImageRegionsWithServiceResponseAsync(projectId, createImageRegionsOptionalParameter), serviceCallback); } /** - * Get images by id for a given project iteration. - * This API will return a set of Images for the specified tags and optionally iteration. If no iteration is specified the - current workspace is used. + * Create a set of image regions. + * This API accepts a batch of image regions, and optionally tags, to update existing images with region information. + There is a limit of 64 entries in the batch. * - * @param projectId The project id - * @param getImagesByIdsOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param createImageRegionsOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<Image> object + * @return the observable to the ImageRegionCreateSummary object */ - public Observable> getImagesByIdsAsync(UUID projectId, GetImagesByIdsOptionalParameter getImagesByIdsOptionalParameter) { - return getImagesByIdsWithServiceResponseAsync(projectId, getImagesByIdsOptionalParameter).map(new Func1>, List>() { + public Observable createImageRegionsAsync(UUID projectId, CreateImageRegionsOptionalParameter createImageRegionsOptionalParameter) { + return createImageRegionsWithServiceResponseAsync(projectId, createImageRegionsOptionalParameter).map(new Func1, ImageRegionCreateSummary>() { @Override - public List call(ServiceResponse> response) { + public ImageRegionCreateSummary call(ServiceResponse response) { return response.body(); } }); } /** - * Get images by id for a given project iteration. - * This API will return a set of Images for the specified tags and optionally iteration. If no iteration is specified the - current workspace is used. + * Create a set of image regions. + * This API accepts a batch of image regions, and optionally tags, to update existing images with region information. + There is a limit of 64 entries in the batch. * - * @param projectId The project id - * @param getImagesByIdsOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param createImageRegionsOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<Image> object + * @return the observable to the ImageRegionCreateSummary object */ - public Observable>> getImagesByIdsWithServiceResponseAsync(UUID projectId, GetImagesByIdsOptionalParameter getImagesByIdsOptionalParameter) { + public Observable> createImageRegionsWithServiceResponseAsync(UUID projectId, CreateImageRegionsOptionalParameter createImageRegionsOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - final List imageIds = getImagesByIdsOptionalParameter != null ? getImagesByIdsOptionalParameter.imageIds() : null; - final UUID iterationId = getImagesByIdsOptionalParameter != null ? getImagesByIdsOptionalParameter.iterationId() : null; + final List regions = createImageRegionsOptionalParameter != null ? createImageRegionsOptionalParameter.regions() : null; - return getImagesByIdsWithServiceResponseAsync(projectId, imageIds, iterationId); + return createImageRegionsWithServiceResponseAsync(projectId, regions); } /** - * Get images by id for a given project iteration. - * This API will return a set of Images for the specified tags and optionally iteration. If no iteration is specified the - current workspace is used. + * Create a set of image regions. + * This API accepts a batch of image regions, and optionally tags, to update existing images with region information. + There is a limit of 64 entries in the batch. * - * @param projectId The project id - * @param imageIds The list of image ids to retrieve. Limited to 256 - * @param iterationId The iteration id. Defaults to workspace + * @param projectId The project id. + * @param regions the List<ImageRegionCreateEntry> value * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<Image> object + * @return the observable to the ImageRegionCreateSummary object */ - public Observable>> getImagesByIdsWithServiceResponseAsync(UUID projectId, List imageIds, UUID iterationId) { + public Observable> createImageRegionsWithServiceResponseAsync(UUID projectId, List regions) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - Validator.validate(imageIds); - String imageIdsConverted = this.client.serializerAdapter().serializeList(imageIds, CollectionFormat.CSV); - return service.getImagesByIds(projectId, imageIdsConverted, iterationId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + Validator.validate(regions); + ImageRegionCreateBatch batch = new ImageRegionCreateBatch(); + batch.withRegions(regions); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.createImageRegions(projectId, this.client.apiKey(), this.client.acceptLanguage(), batch, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable>> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse> clientResponse = getImagesByIdsDelegate(response); + ServiceResponse clientResponse = createImageRegionsDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -4375,165 +5048,144 @@ public Observable>> call(Response resp }); } - private ServiceResponse> getImagesByIdsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse createImageRegionsDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } @Override - public TrainingsGetImagesByIdsParameters getImagesByIds() { - return new TrainingsGetImagesByIdsParameters(this); + public TrainingsCreateImageRegionsParameters createImageRegions() { + return new TrainingsCreateImageRegionsParameters(this); } /** - * Internal class implementing TrainingsGetImagesByIdsDefinition. + * Internal class implementing TrainingsCreateImageRegionsDefinition. */ - class TrainingsGetImagesByIdsParameters implements TrainingsGetImagesByIdsDefinition { + class TrainingsCreateImageRegionsParameters implements TrainingsCreateImageRegionsDefinition { private TrainingsImpl parent; private UUID projectId; - private List imageIds; - private UUID iterationId; + private List regions; /** * Constructor. * @param parent the parent object. */ - TrainingsGetImagesByIdsParameters(TrainingsImpl parent) { + TrainingsCreateImageRegionsParameters(TrainingsImpl parent) { this.parent = parent; } @Override - public TrainingsGetImagesByIdsParameters withProjectId(UUID projectId) { + public TrainingsCreateImageRegionsParameters withProjectId(UUID projectId) { this.projectId = projectId; return this; } @Override - public TrainingsGetImagesByIdsParameters withImageIds(List imageIds) { - this.imageIds = imageIds; - return this; - } - - @Override - public TrainingsGetImagesByIdsParameters withIterationId(UUID iterationId) { - this.iterationId = iterationId; + public TrainingsCreateImageRegionsParameters withRegions(List regions) { + this.regions = regions; return this; } @Override - public List execute() { - return getImagesByIdsWithServiceResponseAsync(projectId, imageIds, iterationId).toBlocking().single().body(); + public ImageRegionCreateSummary execute() { + return createImageRegionsWithServiceResponseAsync(projectId, regions).toBlocking().single().body(); } @Override - public Observable> executeAsync() { - return getImagesByIdsWithServiceResponseAsync(projectId, imageIds, iterationId).map(new Func1>, List>() { + public Observable executeAsync() { + return createImageRegionsWithServiceResponseAsync(projectId, regions).map(new Func1, ImageRegionCreateSummary>() { @Override - public List call(ServiceResponse> response) { + public ImageRegionCreateSummary call(ServiceResponse response) { return response.body(); } }); } } - /** - * Gets the number of untagged images. - * This API returns the images which have no tags for a given project and optionally an iteration. If no iteration is specified the - current workspace is used. + * Remove a set of tags from a set of images. * - * @param projectId The project id - * @param getUntaggedImageCountOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param imageIds Image ids. Limited to 64 images. + * @param tagIds Tags to be deleted from the specified images. Limited to 20 tags. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the int object if successful. */ - public int getUntaggedImageCount(UUID projectId, GetUntaggedImageCountOptionalParameter getUntaggedImageCountOptionalParameter) { - return getUntaggedImageCountWithServiceResponseAsync(projectId, getUntaggedImageCountOptionalParameter).toBlocking().single().body(); + public void deleteImageTags(UUID projectId, List imageIds, List tagIds) { + deleteImageTagsWithServiceResponseAsync(projectId, imageIds, tagIds).toBlocking().single().body(); } /** - * Gets the number of untagged images. - * This API returns the images which have no tags for a given project and optionally an iteration. If no iteration is specified the - current workspace is used. + * Remove a set of tags from a set of images. * - * @param projectId The project id - * @param getUntaggedImageCountOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param imageIds Image ids. Limited to 64 images. + * @param tagIds Tags to be deleted from the specified images. Limited to 20 tags. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture getUntaggedImageCountAsync(UUID projectId, GetUntaggedImageCountOptionalParameter getUntaggedImageCountOptionalParameter, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getUntaggedImageCountWithServiceResponseAsync(projectId, getUntaggedImageCountOptionalParameter), serviceCallback); + public ServiceFuture deleteImageTagsAsync(UUID projectId, List imageIds, List tagIds, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteImageTagsWithServiceResponseAsync(projectId, imageIds, tagIds), serviceCallback); } /** - * Gets the number of untagged images. - * This API returns the images which have no tags for a given project and optionally an iteration. If no iteration is specified the - current workspace is used. + * Remove a set of tags from a set of images. * - * @param projectId The project id - * @param getUntaggedImageCountOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param imageIds Image ids. Limited to 64 images. + * @param tagIds Tags to be deleted from the specified images. Limited to 20 tags. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Integer object + * @return the {@link ServiceResponse} object if successful. */ - public Observable getUntaggedImageCountAsync(UUID projectId, GetUntaggedImageCountOptionalParameter getUntaggedImageCountOptionalParameter) { - return getUntaggedImageCountWithServiceResponseAsync(projectId, getUntaggedImageCountOptionalParameter).map(new Func1, Integer>() { + public Observable deleteImageTagsAsync(UUID projectId, List imageIds, List tagIds) { + return deleteImageTagsWithServiceResponseAsync(projectId, imageIds, tagIds).map(new Func1, Void>() { @Override - public Integer call(ServiceResponse response) { + public Void call(ServiceResponse response) { return response.body(); } }); } /** - * Gets the number of untagged images. - * This API returns the images which have no tags for a given project and optionally an iteration. If no iteration is specified the - current workspace is used. + * Remove a set of tags from a set of images. * - * @param projectId The project id - * @param getUntaggedImageCountOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param imageIds Image ids. Limited to 64 images. + * @param tagIds Tags to be deleted from the specified images. Limited to 20 tags. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Integer object + * @return the {@link ServiceResponse} object if successful. */ - public Observable> getUntaggedImageCountWithServiceResponseAsync(UUID projectId, GetUntaggedImageCountOptionalParameter getUntaggedImageCountOptionalParameter) { + public Observable> deleteImageTagsWithServiceResponseAsync(UUID projectId, List imageIds, List tagIds) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } - if (this.client.apiKey() == null) { - throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); + if (imageIds == null) { + throw new IllegalArgumentException("Parameter imageIds is required and cannot be null."); } - final UUID iterationId = getUntaggedImageCountOptionalParameter != null ? getUntaggedImageCountOptionalParameter.iterationId() : null; - - return getUntaggedImageCountWithServiceResponseAsync(projectId, iterationId); - } - - /** - * Gets the number of untagged images. - * This API returns the images which have no tags for a given project and optionally an iteration. If no iteration is specified the - current workspace is used. - * - * @param projectId The project id - * @param iterationId The iteration id. Defaults to workspace - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Integer object - */ - public Observable> getUntaggedImageCountWithServiceResponseAsync(UUID projectId, UUID iterationId) { - if (projectId == null) { - throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); + if (tagIds == null) { + throw new IllegalArgumentException("Parameter tagIds is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - return service.getUntaggedImageCount(projectId, iterationId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + Validator.validate(imageIds); + Validator.validate(tagIds); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + String imageIdsConverted = this.client.serializerAdapter().serializeList(imageIds, CollectionFormat.CSV); + String tagIdsConverted = this.client.serializerAdapter().serializeList(tagIds, CollectionFormat.CSV); + return service.deleteImageTags(projectId, imageIdsConverted, tagIdsConverted, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = getUntaggedImageCountDelegate(response); + ServiceResponse clientResponse = deleteImageTagsDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -4542,162 +5194,109 @@ public Observable> call(Response response }); } - private ServiceResponse getUntaggedImageCountDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse deleteImageTagsDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } - @Override - public TrainingsGetUntaggedImageCountParameters getUntaggedImageCount() { - return new TrainingsGetUntaggedImageCountParameters(this); - } - - /** - * Internal class implementing TrainingsGetUntaggedImageCountDefinition. - */ - class TrainingsGetUntaggedImageCountParameters implements TrainingsGetUntaggedImageCountDefinition { - private TrainingsImpl parent; - private UUID projectId; - private UUID iterationId; - - /** - * Constructor. - * @param parent the parent object. - */ - TrainingsGetUntaggedImageCountParameters(TrainingsImpl parent) { - this.parent = parent; - } - - @Override - public TrainingsGetUntaggedImageCountParameters withProjectId(UUID projectId) { - this.projectId = projectId; - return this; - } - - @Override - public TrainingsGetUntaggedImageCountParameters withIterationId(UUID iterationId) { - this.iterationId = iterationId; - return this; - } - - @Override - public int execute() { - return getUntaggedImageCountWithServiceResponseAsync(projectId, iterationId).toBlocking().single().body(); - } - - @Override - public Observable executeAsync() { - return getUntaggedImageCountWithServiceResponseAsync(projectId, iterationId).map(new Func1, Integer>() { - @Override - public Integer call(ServiceResponse response) { - return response.body(); - } - }); - } - } - /** - * Gets the number of images tagged with the provided {tagIds}. - * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and - "Cat" tags, then only images tagged with Dog and/or Cat will be returned. + * Associate a set of images with a set of tags. * - * @param projectId The project id - * @param getTaggedImageCountOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param createImageTagsOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the int object if successful. + * @return the ImageTagCreateSummary object if successful. */ - public int getTaggedImageCount(UUID projectId, GetTaggedImageCountOptionalParameter getTaggedImageCountOptionalParameter) { - return getTaggedImageCountWithServiceResponseAsync(projectId, getTaggedImageCountOptionalParameter).toBlocking().single().body(); + public ImageTagCreateSummary createImageTags(UUID projectId, CreateImageTagsOptionalParameter createImageTagsOptionalParameter) { + return createImageTagsWithServiceResponseAsync(projectId, createImageTagsOptionalParameter).toBlocking().single().body(); } /** - * Gets the number of images tagged with the provided {tagIds}. - * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and - "Cat" tags, then only images tagged with Dog and/or Cat will be returned. + * Associate a set of images with a set of tags. * - * @param projectId The project id - * @param getTaggedImageCountOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param createImageTagsOptionalParameter the object representing the optional parameters to be set before calling this API * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture getTaggedImageCountAsync(UUID projectId, GetTaggedImageCountOptionalParameter getTaggedImageCountOptionalParameter, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getTaggedImageCountWithServiceResponseAsync(projectId, getTaggedImageCountOptionalParameter), serviceCallback); + public ServiceFuture createImageTagsAsync(UUID projectId, CreateImageTagsOptionalParameter createImageTagsOptionalParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createImageTagsWithServiceResponseAsync(projectId, createImageTagsOptionalParameter), serviceCallback); } /** - * Gets the number of images tagged with the provided {tagIds}. - * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and - "Cat" tags, then only images tagged with Dog and/or Cat will be returned. + * Associate a set of images with a set of tags. * - * @param projectId The project id - * @param getTaggedImageCountOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param createImageTagsOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Integer object + * @return the observable to the ImageTagCreateSummary object */ - public Observable getTaggedImageCountAsync(UUID projectId, GetTaggedImageCountOptionalParameter getTaggedImageCountOptionalParameter) { - return getTaggedImageCountWithServiceResponseAsync(projectId, getTaggedImageCountOptionalParameter).map(new Func1, Integer>() { + public Observable createImageTagsAsync(UUID projectId, CreateImageTagsOptionalParameter createImageTagsOptionalParameter) { + return createImageTagsWithServiceResponseAsync(projectId, createImageTagsOptionalParameter).map(new Func1, ImageTagCreateSummary>() { @Override - public Integer call(ServiceResponse response) { + public ImageTagCreateSummary call(ServiceResponse response) { return response.body(); } }); } /** - * Gets the number of images tagged with the provided {tagIds}. - * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and - "Cat" tags, then only images tagged with Dog and/or Cat will be returned. + * Associate a set of images with a set of tags. * - * @param projectId The project id - * @param getTaggedImageCountOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param createImageTagsOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Integer object + * @return the observable to the ImageTagCreateSummary object */ - public Observable> getTaggedImageCountWithServiceResponseAsync(UUID projectId, GetTaggedImageCountOptionalParameter getTaggedImageCountOptionalParameter) { + public Observable> createImageTagsWithServiceResponseAsync(UUID projectId, CreateImageTagsOptionalParameter createImageTagsOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - final UUID iterationId = getTaggedImageCountOptionalParameter != null ? getTaggedImageCountOptionalParameter.iterationId() : null; - final List tagIds = getTaggedImageCountOptionalParameter != null ? getTaggedImageCountOptionalParameter.tagIds() : null; + final List tags = createImageTagsOptionalParameter != null ? createImageTagsOptionalParameter.tags() : null; - return getTaggedImageCountWithServiceResponseAsync(projectId, iterationId, tagIds); + return createImageTagsWithServiceResponseAsync(projectId, tags); } /** - * Gets the number of images tagged with the provided {tagIds}. - * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and - "Cat" tags, then only images tagged with Dog and/or Cat will be returned. + * Associate a set of images with a set of tags. * - * @param projectId The project id - * @param iterationId The iteration id. Defaults to workspace - * @param tagIds A list of tags ids to filter the images to count. Defaults to all tags when null. + * @param projectId The project id. + * @param tags Image Tag entries to include in this batch. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the Integer object + * @return the observable to the ImageTagCreateSummary object */ - public Observable> getTaggedImageCountWithServiceResponseAsync(UUID projectId, UUID iterationId, List tagIds) { + public Observable> createImageTagsWithServiceResponseAsync(UUID projectId, List tags) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - Validator.validate(tagIds); - String tagIdsConverted = this.client.serializerAdapter().serializeList(tagIds, CollectionFormat.CSV); - return service.getTaggedImageCount(projectId, iterationId, tagIdsConverted, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + Validator.validate(tags); + ImageTagCreateBatch batch = new ImageTagCreateBatch(); + batch.withTags(tags); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.createImageTags(projectId, this.client.apiKey(), this.client.acceptLanguage(), batch, parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = getTaggedImageCountDelegate(response); + ServiceResponse clientResponse = createImageTagsDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -4706,63 +5305,56 @@ public Observable> call(Response response }); } - private ServiceResponse getTaggedImageCountDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse createImageTagsDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } @Override - public TrainingsGetTaggedImageCountParameters getTaggedImageCount() { - return new TrainingsGetTaggedImageCountParameters(this); + public TrainingsCreateImageTagsParameters createImageTags() { + return new TrainingsCreateImageTagsParameters(this); } /** - * Internal class implementing TrainingsGetTaggedImageCountDefinition. + * Internal class implementing TrainingsCreateImageTagsDefinition. */ - class TrainingsGetTaggedImageCountParameters implements TrainingsGetTaggedImageCountDefinition { + class TrainingsCreateImageTagsParameters implements TrainingsCreateImageTagsDefinition { private TrainingsImpl parent; private UUID projectId; - private UUID iterationId; - private List tagIds; + private List tags; /** * Constructor. * @param parent the parent object. */ - TrainingsGetTaggedImageCountParameters(TrainingsImpl parent) { + TrainingsCreateImageTagsParameters(TrainingsImpl parent) { this.parent = parent; } @Override - public TrainingsGetTaggedImageCountParameters withProjectId(UUID projectId) { + public TrainingsCreateImageTagsParameters withProjectId(UUID projectId) { this.projectId = projectId; return this; } @Override - public TrainingsGetTaggedImageCountParameters withIterationId(UUID iterationId) { - this.iterationId = iterationId; - return this; - } - - @Override - public TrainingsGetTaggedImageCountParameters withTagIds(List tagIds) { - this.tagIds = tagIds; + public TrainingsCreateImageTagsParameters withTags(List tags) { + this.tags = tags; return this; } @Override - public int execute() { - return getTaggedImageCountWithServiceResponseAsync(projectId, iterationId, tagIds).toBlocking().single().body(); + public ImageTagCreateSummary execute() { + return createImageTagsWithServiceResponseAsync(projectId, tags).toBlocking().single().body(); } @Override - public Observable executeAsync() { - return getTaggedImageCountWithServiceResponseAsync(projectId, iterationId, tagIds).map(new Func1, Integer>() { + public Observable executeAsync() { + return createImageTagsWithServiceResponseAsync(projectId, tags).map(new Func1, ImageTagCreateSummary>() { @Override - public Integer call(ServiceResponse response) { + public ImageTagCreateSummary call(ServiceResponse response) { return response.body(); } }); @@ -4771,106 +5363,107 @@ public Integer call(ServiceResponse response) { /** - * Get untagged images for a given project iteration. - * This API supports batching and range selection. By default it will only return first 50 images matching images. - Use the {take} and {skip} parameters to control how many images to return in a given batch. + * Gets the number of untagged images. + * This API returns the images which have no tags for a given project and optionally an iteration. If no iteration is specified the + current workspace is used. * - * @param projectId The project id - * @param getUntaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param getUntaggedImageCountOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the List<Image> object if successful. + * @return the int object if successful. */ - public List getUntaggedImages(UUID projectId, GetUntaggedImagesOptionalParameter getUntaggedImagesOptionalParameter) { - return getUntaggedImagesWithServiceResponseAsync(projectId, getUntaggedImagesOptionalParameter).toBlocking().single().body(); + public int getUntaggedImageCount(UUID projectId, GetUntaggedImageCountOptionalParameter getUntaggedImageCountOptionalParameter) { + return getUntaggedImageCountWithServiceResponseAsync(projectId, getUntaggedImageCountOptionalParameter).toBlocking().single().body(); } /** - * Get untagged images for a given project iteration. - * This API supports batching and range selection. By default it will only return first 50 images matching images. - Use the {take} and {skip} parameters to control how many images to return in a given batch. + * Gets the number of untagged images. + * This API returns the images which have no tags for a given project and optionally an iteration. If no iteration is specified the + current workspace is used. * - * @param projectId The project id - * @param getUntaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param getUntaggedImageCountOptionalParameter the object representing the optional parameters to be set before calling this API * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> getUntaggedImagesAsync(UUID projectId, GetUntaggedImagesOptionalParameter getUntaggedImagesOptionalParameter, final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(getUntaggedImagesWithServiceResponseAsync(projectId, getUntaggedImagesOptionalParameter), serviceCallback); + public ServiceFuture getUntaggedImageCountAsync(UUID projectId, GetUntaggedImageCountOptionalParameter getUntaggedImageCountOptionalParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getUntaggedImageCountWithServiceResponseAsync(projectId, getUntaggedImageCountOptionalParameter), serviceCallback); } /** - * Get untagged images for a given project iteration. - * This API supports batching and range selection. By default it will only return first 50 images matching images. - Use the {take} and {skip} parameters to control how many images to return in a given batch. + * Gets the number of untagged images. + * This API returns the images which have no tags for a given project and optionally an iteration. If no iteration is specified the + current workspace is used. * - * @param projectId The project id - * @param getUntaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param getUntaggedImageCountOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<Image> object + * @return the observable to the Integer object */ - public Observable> getUntaggedImagesAsync(UUID projectId, GetUntaggedImagesOptionalParameter getUntaggedImagesOptionalParameter) { - return getUntaggedImagesWithServiceResponseAsync(projectId, getUntaggedImagesOptionalParameter).map(new Func1>, List>() { + public Observable getUntaggedImageCountAsync(UUID projectId, GetUntaggedImageCountOptionalParameter getUntaggedImageCountOptionalParameter) { + return getUntaggedImageCountWithServiceResponseAsync(projectId, getUntaggedImageCountOptionalParameter).map(new Func1, Integer>() { @Override - public List call(ServiceResponse> response) { + public Integer call(ServiceResponse response) { return response.body(); } }); } /** - * Get untagged images for a given project iteration. - * This API supports batching and range selection. By default it will only return first 50 images matching images. - Use the {take} and {skip} parameters to control how many images to return in a given batch. + * Gets the number of untagged images. + * This API returns the images which have no tags for a given project and optionally an iteration. If no iteration is specified the + current workspace is used. * - * @param projectId The project id - * @param getUntaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param getUntaggedImageCountOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<Image> object + * @return the observable to the Integer object */ - public Observable>> getUntaggedImagesWithServiceResponseAsync(UUID projectId, GetUntaggedImagesOptionalParameter getUntaggedImagesOptionalParameter) { + public Observable> getUntaggedImageCountWithServiceResponseAsync(UUID projectId, GetUntaggedImageCountOptionalParameter getUntaggedImageCountOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - final UUID iterationId = getUntaggedImagesOptionalParameter != null ? getUntaggedImagesOptionalParameter.iterationId() : null; - final String orderBy = getUntaggedImagesOptionalParameter != null ? getUntaggedImagesOptionalParameter.orderBy() : null; - final Integer take = getUntaggedImagesOptionalParameter != null ? getUntaggedImagesOptionalParameter.take() : null; - final Integer skip = getUntaggedImagesOptionalParameter != null ? getUntaggedImagesOptionalParameter.skip() : null; + final UUID iterationId = getUntaggedImageCountOptionalParameter != null ? getUntaggedImageCountOptionalParameter.iterationId() : null; - return getUntaggedImagesWithServiceResponseAsync(projectId, iterationId, orderBy, take, skip); + return getUntaggedImageCountWithServiceResponseAsync(projectId, iterationId); } /** - * Get untagged images for a given project iteration. - * This API supports batching and range selection. By default it will only return first 50 images matching images. - Use the {take} and {skip} parameters to control how many images to return in a given batch. + * Gets the number of untagged images. + * This API returns the images which have no tags for a given project and optionally an iteration. If no iteration is specified the + current workspace is used. * - * @param projectId The project id - * @param iterationId The iteration id. Defaults to workspace - * @param orderBy The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest' - * @param take Maximum number of images to return. Defaults to 50, limited to 256 - * @param skip Number of images to skip before beginning the image batch. Defaults to 0 + * @param projectId The project id. + * @param iterationId The iteration id. Defaults to workspace. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<Image> object + * @return the observable to the Integer object */ - public Observable>> getUntaggedImagesWithServiceResponseAsync(UUID projectId, UUID iterationId, String orderBy, Integer take, Integer skip) { + public Observable> getUntaggedImageCountWithServiceResponseAsync(UUID projectId, UUID iterationId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - return service.getUntaggedImages(projectId, iterationId, orderBy, take, skip, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.getUntaggedImageCount(projectId, iterationId, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable>> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse> clientResponse = getUntaggedImagesDelegate(response); + ServiceResponse clientResponse = getUntaggedImageCountDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -4879,77 +5472,56 @@ public Observable>> call(Response resp }); } - private ServiceResponse> getUntaggedImagesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse getUntaggedImageCountDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } @Override - public TrainingsGetUntaggedImagesParameters getUntaggedImages() { - return new TrainingsGetUntaggedImagesParameters(this); + public TrainingsGetUntaggedImageCountParameters getUntaggedImageCount() { + return new TrainingsGetUntaggedImageCountParameters(this); } /** - * Internal class implementing TrainingsGetUntaggedImagesDefinition. + * Internal class implementing TrainingsGetUntaggedImageCountDefinition. */ - class TrainingsGetUntaggedImagesParameters implements TrainingsGetUntaggedImagesDefinition { + class TrainingsGetUntaggedImageCountParameters implements TrainingsGetUntaggedImageCountDefinition { private TrainingsImpl parent; private UUID projectId; private UUID iterationId; - private String orderBy; - private Integer take; - private Integer skip; /** * Constructor. * @param parent the parent object. */ - TrainingsGetUntaggedImagesParameters(TrainingsImpl parent) { + TrainingsGetUntaggedImageCountParameters(TrainingsImpl parent) { this.parent = parent; } @Override - public TrainingsGetUntaggedImagesParameters withProjectId(UUID projectId) { + public TrainingsGetUntaggedImageCountParameters withProjectId(UUID projectId) { this.projectId = projectId; return this; } @Override - public TrainingsGetUntaggedImagesParameters withIterationId(UUID iterationId) { + public TrainingsGetUntaggedImageCountParameters withIterationId(UUID iterationId) { this.iterationId = iterationId; return this; } @Override - public TrainingsGetUntaggedImagesParameters withOrderBy(String orderBy) { - this.orderBy = orderBy; - return this; - } - - @Override - public TrainingsGetUntaggedImagesParameters withTake(Integer take) { - this.take = take; - return this; - } - - @Override - public TrainingsGetUntaggedImagesParameters withSkip(Integer skip) { - this.skip = skip; - return this; - } - - @Override - public List execute() { - return getUntaggedImagesWithServiceResponseAsync(projectId, iterationId, orderBy, take, skip).toBlocking().single().body(); + public int execute() { + return getUntaggedImageCountWithServiceResponseAsync(projectId, iterationId).toBlocking().single().body(); } @Override - public Observable> executeAsync() { - return getUntaggedImagesWithServiceResponseAsync(projectId, iterationId, orderBy, take, skip).map(new Func1>, List>() { + public Observable executeAsync() { + return getUntaggedImageCountWithServiceResponseAsync(projectId, iterationId).map(new Func1, Integer>() { @Override - public List call(ServiceResponse> response) { + public Integer call(ServiceResponse response) { return response.body(); } }); @@ -4958,106 +5530,96 @@ public List call(ServiceResponse> response) { /** - * Get tagged images for a given project iteration. - * This API supports batching and range selection. By default it will only return first 50 images matching images. - Use the {take} and {skip} parameters to control how many images to return in a given batch. - The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + * Gets the number of images tagged with the provided {tagIds}. + * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @param projectId The project id - * @param getTaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param getTaggedImageCountOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the List<Image> object if successful. + * @return the int object if successful. */ - public List getTaggedImages(UUID projectId, GetTaggedImagesOptionalParameter getTaggedImagesOptionalParameter) { - return getTaggedImagesWithServiceResponseAsync(projectId, getTaggedImagesOptionalParameter).toBlocking().single().body(); + public int getTaggedImageCount(UUID projectId, GetTaggedImageCountOptionalParameter getTaggedImageCountOptionalParameter) { + return getTaggedImageCountWithServiceResponseAsync(projectId, getTaggedImageCountOptionalParameter).toBlocking().single().body(); } /** - * Get tagged images for a given project iteration. - * This API supports batching and range selection. By default it will only return first 50 images matching images. - Use the {take} and {skip} parameters to control how many images to return in a given batch. - The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + * Gets the number of images tagged with the provided {tagIds}. + * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @param projectId The project id - * @param getTaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param getTaggedImageCountOptionalParameter the object representing the optional parameters to be set before calling this API * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> getTaggedImagesAsync(UUID projectId, GetTaggedImagesOptionalParameter getTaggedImagesOptionalParameter, final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(getTaggedImagesWithServiceResponseAsync(projectId, getTaggedImagesOptionalParameter), serviceCallback); + public ServiceFuture getTaggedImageCountAsync(UUID projectId, GetTaggedImageCountOptionalParameter getTaggedImageCountOptionalParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getTaggedImageCountWithServiceResponseAsync(projectId, getTaggedImageCountOptionalParameter), serviceCallback); } /** - * Get tagged images for a given project iteration. - * This API supports batching and range selection. By default it will only return first 50 images matching images. - Use the {take} and {skip} parameters to control how many images to return in a given batch. - The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + * Gets the number of images tagged with the provided {tagIds}. + * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @param projectId The project id - * @param getTaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param getTaggedImageCountOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<Image> object + * @return the observable to the Integer object */ - public Observable> getTaggedImagesAsync(UUID projectId, GetTaggedImagesOptionalParameter getTaggedImagesOptionalParameter) { - return getTaggedImagesWithServiceResponseAsync(projectId, getTaggedImagesOptionalParameter).map(new Func1>, List>() { + public Observable getTaggedImageCountAsync(UUID projectId, GetTaggedImageCountOptionalParameter getTaggedImageCountOptionalParameter) { + return getTaggedImageCountWithServiceResponseAsync(projectId, getTaggedImageCountOptionalParameter).map(new Func1, Integer>() { @Override - public List call(ServiceResponse> response) { + public Integer call(ServiceResponse response) { return response.body(); } }); } /** - * Get tagged images for a given project iteration. - * This API supports batching and range selection. By default it will only return first 50 images matching images. - Use the {take} and {skip} parameters to control how many images to return in a given batch. - The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + * Gets the number of images tagged with the provided {tagIds}. + * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @param projectId The project id - * @param getTaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API + * @param projectId The project id. + * @param getTaggedImageCountOptionalParameter the object representing the optional parameters to be set before calling this API * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<Image> object + * @return the observable to the Integer object */ - public Observable>> getTaggedImagesWithServiceResponseAsync(UUID projectId, GetTaggedImagesOptionalParameter getTaggedImagesOptionalParameter) { + public Observable> getTaggedImageCountWithServiceResponseAsync(UUID projectId, GetTaggedImageCountOptionalParameter getTaggedImageCountOptionalParameter) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - final UUID iterationId = getTaggedImagesOptionalParameter != null ? getTaggedImagesOptionalParameter.iterationId() : null; - final List tagIds = getTaggedImagesOptionalParameter != null ? getTaggedImagesOptionalParameter.tagIds() : null; - final String orderBy = getTaggedImagesOptionalParameter != null ? getTaggedImagesOptionalParameter.orderBy() : null; - final Integer take = getTaggedImagesOptionalParameter != null ? getTaggedImagesOptionalParameter.take() : null; - final Integer skip = getTaggedImagesOptionalParameter != null ? getTaggedImagesOptionalParameter.skip() : null; + final UUID iterationId = getTaggedImageCountOptionalParameter != null ? getTaggedImageCountOptionalParameter.iterationId() : null; + final List tagIds = getTaggedImageCountOptionalParameter != null ? getTaggedImageCountOptionalParameter.tagIds() : null; - return getTaggedImagesWithServiceResponseAsync(projectId, iterationId, tagIds, orderBy, take, skip); + return getTaggedImageCountWithServiceResponseAsync(projectId, iterationId, tagIds); } /** - * Get tagged images for a given project iteration. - * This API supports batching and range selection. By default it will only return first 50 images matching images. - Use the {take} and {skip} parameters to control how many images to return in a given batch. - The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and + * Gets the number of images tagged with the provided {tagIds}. + * The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and "Cat" tags, then only images tagged with Dog and/or Cat will be returned. * - * @param projectId The project id - * @param iterationId The iteration id. Defaults to workspace - * @param tagIds A list of tags ids to filter the images. Defaults to all tagged images when null. Limited to 20 - * @param orderBy The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest' - * @param take Maximum number of images to return. Defaults to 50, limited to 256 - * @param skip Number of images to skip before beginning the image batch. Defaults to 0 + * @param projectId The project id. + * @param iterationId The iteration id. Defaults to workspace. + * @param tagIds A list of tags ids to filter the images to count. Defaults to all tags when null. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<Image> object + * @return the observable to the Integer object */ - public Observable>> getTaggedImagesWithServiceResponseAsync(UUID projectId, UUID iterationId, List tagIds, String orderBy, Integer take, Integer skip) { + public Observable> getTaggedImageCountWithServiceResponseAsync(UUID projectId, UUID iterationId, List tagIds) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } @@ -5065,13 +5627,14 @@ public Observable>> getTaggedImagesWithServiceRespon throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } Validator.validate(tagIds); + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); String tagIdsConverted = this.client.serializerAdapter().serializeList(tagIds, CollectionFormat.CSV); - return service.getTaggedImages(projectId, iterationId, tagIdsConverted, orderBy, take, skip, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + return service.getTaggedImageCount(projectId, iterationId, tagIdsConverted, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable>> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse> clientResponse = getTaggedImagesDelegate(response); + ServiceResponse clientResponse = getTaggedImageCountDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -5080,84 +5643,63 @@ public Observable>> call(Response resp }); } - private ServiceResponse> getTaggedImagesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) - .registerError(CloudException.class) + private ServiceResponse getTaggedImageCountDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CustomVisionErrorException.class) .build(response); } @Override - public TrainingsGetTaggedImagesParameters getTaggedImages() { - return new TrainingsGetTaggedImagesParameters(this); + public TrainingsGetTaggedImageCountParameters getTaggedImageCount() { + return new TrainingsGetTaggedImageCountParameters(this); } /** - * Internal class implementing TrainingsGetTaggedImagesDefinition. + * Internal class implementing TrainingsGetTaggedImageCountDefinition. */ - class TrainingsGetTaggedImagesParameters implements TrainingsGetTaggedImagesDefinition { + class TrainingsGetTaggedImageCountParameters implements TrainingsGetTaggedImageCountDefinition { private TrainingsImpl parent; private UUID projectId; private UUID iterationId; - private List tagIds; - private String orderBy; - private Integer take; - private Integer skip; + private List tagIds; /** * Constructor. * @param parent the parent object. */ - TrainingsGetTaggedImagesParameters(TrainingsImpl parent) { + TrainingsGetTaggedImageCountParameters(TrainingsImpl parent) { this.parent = parent; } @Override - public TrainingsGetTaggedImagesParameters withProjectId(UUID projectId) { + public TrainingsGetTaggedImageCountParameters withProjectId(UUID projectId) { this.projectId = projectId; return this; } @Override - public TrainingsGetTaggedImagesParameters withIterationId(UUID iterationId) { + public TrainingsGetTaggedImageCountParameters withIterationId(UUID iterationId) { this.iterationId = iterationId; return this; } @Override - public TrainingsGetTaggedImagesParameters withTagIds(List tagIds) { + public TrainingsGetTaggedImageCountParameters withTagIds(List tagIds) { this.tagIds = tagIds; return this; } @Override - public TrainingsGetTaggedImagesParameters withOrderBy(String orderBy) { - this.orderBy = orderBy; - return this; - } - - @Override - public TrainingsGetTaggedImagesParameters withTake(Integer take) { - this.take = take; - return this; - } - - @Override - public TrainingsGetTaggedImagesParameters withSkip(Integer skip) { - this.skip = skip; - return this; - } - - @Override - public List execute() { - return getTaggedImagesWithServiceResponseAsync(projectId, iterationId, tagIds, orderBy, take, skip).toBlocking().single().body(); + public int execute() { + return getTaggedImageCountWithServiceResponseAsync(projectId, iterationId, tagIds).toBlocking().single().body(); } @Override - public Observable> executeAsync() { - return getTaggedImagesWithServiceResponseAsync(projectId, iterationId, tagIds, orderBy, take, skip).map(new Func1>, List>() { + public Observable executeAsync() { + return getTaggedImageCountWithServiceResponseAsync(projectId, iterationId, tagIds).map(new Func1, Integer>() { @Override - public List call(ServiceResponse> response) { + public Integer call(ServiceResponse response) { return response.body(); } }); @@ -5167,9 +5709,9 @@ public List call(ServiceResponse> response) { /** * Get information about a specific domain. * - * @param domainId The id of the domain to get information about + * @param domainId The id of the domain to get information about. * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the Domain object if successful. */ @@ -5180,7 +5722,7 @@ public Domain getDomain(UUID domainId) { /** * Get information about a specific domain. * - * @param domainId The id of the domain to get information about + * @param domainId The id of the domain to get information about. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -5192,7 +5734,7 @@ public ServiceFuture getDomainAsync(UUID domainId, final ServiceCallback /** * Get information about a specific domain. * - * @param domainId The id of the domain to get information about + * @param domainId The id of the domain to get information about. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the Domain object */ @@ -5208,18 +5750,22 @@ public Domain call(ServiceResponse response) { /** * Get information about a specific domain. * - * @param domainId The id of the domain to get information about + * @param domainId The id of the domain to get information about. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the Domain object */ public Observable> getDomainWithServiceResponseAsync(UUID domainId) { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (domainId == null) { throw new IllegalArgumentException("Parameter domainId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - return service.getDomain(domainId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.getDomain(domainId, this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -5233,10 +5779,10 @@ public Observable> call(Response response) }); } - private ServiceResponse getDomainDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse getDomainDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .registerError(CustomVisionErrorException.class) .build(response); } @@ -5244,7 +5790,7 @@ private ServiceResponse getDomainDelegate(Response respons * Get a list of the available domains. * * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws CloudException thrown if the request is rejected by server + * @throws CustomVisionErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the List<Domain> object if successful. */ @@ -5285,10 +5831,14 @@ public List call(ServiceResponse> response) { * @return the observable to the List<Domain> object */ public Observable>> getDomainsWithServiceResponseAsync() { + if (this.client.endpoint() == null) { + throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); + } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } - return service.getDomains(this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent()) + String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint()); + return service.getDomains(this.client.apiKey(), this.client.acceptLanguage(), parameterizedHost, this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { @@ -5302,10 +5852,10 @@ public Observable>> call(Response res }); } - private ServiceResponse> getDomainsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + private ServiceResponse> getDomainsDelegate(Response response) throws CustomVisionErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CustomVisionErrorException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken>() { }.getType()) - .registerError(CloudException.class) + .registerError(CustomVisionErrorException.class) .build(response); } diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/package-info.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/package-info.java index 660ca0524a9a..6f29966a919a 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/package-info.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/package-info.java @@ -5,6 +5,6 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * This package contains the implementation classes for TrainingApi. + * This package contains the implementation classes for CustomVisionTrainingClient. */ package com.microsoft.azure.cognitiveservices.vision.customvision.training.implementation; diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/BoundingBox.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/BoundingBox.java index 6576f1ce2f8b..e21d6499aa72 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/BoundingBox.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/BoundingBox.java @@ -11,31 +11,31 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * The BoundingBox model. + * Bounding box that defines a region of an image. */ public class BoundingBox { /** - * The left property. + * Coordinate of the left boundary. */ - @JsonProperty(value = "left") + @JsonProperty(value = "left", required = true) private double left; /** - * The top property. + * Coordinate of the top boundary. */ - @JsonProperty(value = "top") + @JsonProperty(value = "top", required = true) private double top; /** - * The width property. + * Width. */ - @JsonProperty(value = "width") + @JsonProperty(value = "width", required = true) private double width; /** - * The height property. + * Height. */ - @JsonProperty(value = "height") + @JsonProperty(value = "height", required = true) private double height; /** diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CreateImageTagsOptionalParameter.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CreateImageTagsOptionalParameter.java index 0d799023b94c..3967d2bf2027 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CreateImageTagsOptionalParameter.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CreateImageTagsOptionalParameter.java @@ -15,7 +15,7 @@ */ public class CreateImageTagsOptionalParameter { /** - * The tags property. + * Image Tag entries to include in this batch. */ private List tags; diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CreateImagesFromDataOptionalParameter.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CreateImagesFromDataOptionalParameter.java index 330ca1ae6afb..93437dbc5b81 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CreateImagesFromDataOptionalParameter.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CreateImagesFromDataOptionalParameter.java @@ -9,6 +9,7 @@ package com.microsoft.azure.cognitiveservices.vision.customvision.training.models; import java.util.List; +import java.util.UUID; /** * The CreateImagesFromDataOptionalParameter model. @@ -17,7 +18,7 @@ public class CreateImagesFromDataOptionalParameter { /** * The tags ids with which to tag each image. Limited to 20. */ - private List tagIds; + private List tagIds; /** * Gets or sets the preferred language for the response. @@ -29,7 +30,7 @@ public class CreateImagesFromDataOptionalParameter { * * @return the tagIds value */ - public List tagIds() { + public List tagIds() { return this.tagIds; } @@ -39,7 +40,7 @@ public List tagIds() { * @param tagIds the tagIds value to set * @return the CreateImagesFromDataOptionalParameter object itself. */ - public CreateImagesFromDataOptionalParameter withTagIds(List tagIds) { + public CreateImagesFromDataOptionalParameter withTagIds(List tagIds) { this.tagIds = tagIds; return this; } diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CreateProjectOptionalParameter.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CreateProjectOptionalParameter.java index 50a620f1ddaa..32477a7764e4 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CreateProjectOptionalParameter.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CreateProjectOptionalParameter.java @@ -9,6 +9,7 @@ package com.microsoft.azure.cognitiveservices.vision.customvision.training.models; import java.util.UUID; +import java.util.List; /** * The CreateProjectOptionalParameter model. @@ -30,6 +31,11 @@ public class CreateProjectOptionalParameter { */ private String classificationType; + /** + * List of platforms the trained model is intending exporting to. + */ + private List targetExportPlatforms; + /** * Gets or sets the preferred language for the response. */ @@ -95,6 +101,26 @@ public CreateProjectOptionalParameter withClassificationType(String classificati return this; } + /** + * Get the targetExportPlatforms value. + * + * @return the targetExportPlatforms value + */ + public List targetExportPlatforms() { + return this.targetExportPlatforms; + } + + /** + * Set the targetExportPlatforms value. + * + * @param targetExportPlatforms the targetExportPlatforms value to set + * @return the CreateProjectOptionalParameter object itself. + */ + public CreateProjectOptionalParameter withTargetExportPlatforms(List targetExportPlatforms) { + this.targetExportPlatforms = targetExportPlatforms; + return this; + } + /** * Get the thisclientacceptLanguage value. * diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CreateTagOptionalParameter.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CreateTagOptionalParameter.java index c1af590bef1f..6cf8f585a4bc 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CreateTagOptionalParameter.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CreateTagOptionalParameter.java @@ -18,6 +18,12 @@ public class CreateTagOptionalParameter { */ private String description; + /** + * Optional type for the tag. Possible values include: 'Regular', + * 'Negative'. + */ + private String type; + /** * Gets or sets the preferred language for the response. */ @@ -43,6 +49,26 @@ public CreateTagOptionalParameter withDescription(String description) { return this; } + /** + * Get the type value. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type value. + * + * @param type the type value to set + * @return the CreateTagOptionalParameter object itself. + */ + public CreateTagOptionalParameter withType(String type) { + this.type = type; + return this; + } + /** * Get the thisclientacceptLanguage value. * diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CustomVisionError.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CustomVisionError.java new file mode 100644 index 000000000000..961d749c090c --- /dev/null +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CustomVisionError.java @@ -0,0 +1,135 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.customvision.training.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The CustomVisionError model. + */ +public class CustomVisionError { + /** + * The error code. Possible values include: 'NoError', 'BadRequest', + * 'BadRequestExceededBatchSize', 'BadRequestNotSupported', + * 'BadRequestInvalidIds', 'BadRequestProjectName', + * 'BadRequestProjectNameNotUnique', 'BadRequestProjectDescription', + * 'BadRequestProjectUnknownDomain', + * 'BadRequestProjectUnknownClassification', + * 'BadRequestProjectUnsupportedDomainTypeChange', + * 'BadRequestProjectUnsupportedExportPlatform', 'BadRequestIterationName', + * 'BadRequestIterationNameNotUnique', 'BadRequestIterationDescription', + * 'BadRequestIterationIsNotTrained', + * 'BadRequestWorkspaceCannotBeModified', + * 'BadRequestWorkspaceNotDeletable', 'BadRequestTagName', + * 'BadRequestTagNameNotUnique', 'BadRequestTagDescription', + * 'BadRequestTagType', 'BadRequestMultipleNegativeTag', + * 'BadRequestImageTags', 'BadRequestImageRegions', + * 'BadRequestNegativeAndRegularTagOnSameImage', + * 'BadRequestRequiredParamIsNull', 'BadRequestIterationIsPublished', + * 'BadRequestInvalidPublishName', 'BadRequestInvalidPublishTarget', + * 'BadRequestUnpublishFailed', 'BadRequestIterationNotPublished', + * 'BadRequestSubscriptionApi', 'BadRequestExceedProjectLimit', + * 'BadRequestExceedIterationPerProjectLimit', + * 'BadRequestExceedTagPerProjectLimit', + * 'BadRequestExceedTagPerImageLimit', 'BadRequestExceededQuota', + * 'BadRequestCannotMigrateProjectWithName', 'BadRequestNotLimitedTrial', + * 'BadRequestImageBatch', 'BadRequestImageStream', 'BadRequestImageUrl', + * 'BadRequestImageFormat', 'BadRequestImageSizeBytes', + * 'BadRequestImageExceededCount', 'BadRequestTrainingNotNeeded', + * 'BadRequestTrainingNotNeededButTrainingPipelineUpdated', + * 'BadRequestTrainingValidationFailed', + * 'BadRequestClassificationTrainingValidationFailed', + * 'BadRequestMultiClassClassificationTrainingValidationFailed', + * 'BadRequestMultiLabelClassificationTrainingValidationFailed', + * 'BadRequestDetectionTrainingValidationFailed', + * 'BadRequestTrainingAlreadyInProgress', + * 'BadRequestDetectionTrainingNotAllowNegativeTag', + * 'BadRequestInvalidEmailAddress', + * 'BadRequestDomainNotSupportedForAdvancedTraining', + * 'BadRequestExportPlatformNotSupportedForAdvancedTraining', + * 'BadRequestReservedBudgetInHoursNotEnoughForAdvancedTraining', + * 'BadRequestExportValidationFailed', 'BadRequestExportAlreadyInProgress', + * 'BadRequestPredictionIdsMissing', + * 'BadRequestPredictionIdsExceededCount', + * 'BadRequestPredictionTagsExceededCount', + * 'BadRequestPredictionResultsExceededCount', + * 'BadRequestPredictionInvalidApplicationName', + * 'BadRequestPredictionInvalidQueryParameters', 'BadRequestInvalid', + * 'UnsupportedMediaType', 'Forbidden', 'ForbiddenUser', + * 'ForbiddenUserResource', 'ForbiddenUserSignupDisabled', + * 'ForbiddenUserSignupAllowanceExceeded', 'ForbiddenUserDoesNotExist', + * 'ForbiddenUserDisabled', 'ForbiddenUserInsufficientCapability', + * 'ForbiddenDRModeEnabled', 'ForbiddenInvalid', 'NotFound', + * 'NotFoundProject', 'NotFoundProjectDefaultIteration', + * 'NotFoundIteration', 'NotFoundIterationPerformance', 'NotFoundTag', + * 'NotFoundImage', 'NotFoundDomain', 'NotFoundApimSubscription', + * 'NotFoundInvalid', 'Conflict', 'ConflictInvalid', 'ErrorUnknown', + * 'ErrorProjectInvalidWorkspace', + * 'ErrorProjectInvalidPipelineConfiguration', 'ErrorProjectInvalidDomain', + * 'ErrorProjectTrainingRequestFailed', 'ErrorProjectExportRequestFailed', + * 'ErrorFeaturizationServiceUnavailable', + * 'ErrorFeaturizationQueueTimeout', 'ErrorFeaturizationInvalidFeaturizer', + * 'ErrorFeaturizationAugmentationUnavailable', + * 'ErrorFeaturizationUnrecognizedJob', + * 'ErrorFeaturizationAugmentationError', 'ErrorExporterInvalidPlatform', + * 'ErrorExporterInvalidFeaturizer', 'ErrorExporterInvalidClassifier', + * 'ErrorPredictionServiceUnavailable', 'ErrorPredictionModelNotFound', + * 'ErrorPredictionModelNotCached', 'ErrorPrediction', + * 'ErrorPredictionStorage', 'ErrorRegionProposal', 'ErrorInvalid'. + */ + @JsonProperty(value = "code", required = true) + private CustomVisionErrorCodes code; + + /** + * A message explaining the error reported by the service. + */ + @JsonProperty(value = "message", required = true) + private String message; + + /** + * Get the code value. + * + * @return the code value + */ + public CustomVisionErrorCodes code() { + return this.code; + } + + /** + * Set the code value. + * + * @param code the code value to set + * @return the CustomVisionError object itself. + */ + public CustomVisionError withCode(CustomVisionErrorCodes code) { + this.code = code; + return this; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message value. + * + * @param message the message value to set + * @return the CustomVisionError object itself. + */ + public CustomVisionError withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CustomVisionErrorCodes.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CustomVisionErrorCodes.java new file mode 100644 index 000000000000..d0ede44dddb1 --- /dev/null +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CustomVisionErrorCodes.java @@ -0,0 +1,374 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.customvision.training.models; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for CustomVisionErrorCodes. + */ +public final class CustomVisionErrorCodes extends ExpandableStringEnum { + /** Static value NoError for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes NO_ERROR = fromString("NoError"); + + /** Static value BadRequest for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST = fromString("BadRequest"); + + /** Static value BadRequestExceededBatchSize for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_EXCEEDED_BATCH_SIZE = fromString("BadRequestExceededBatchSize"); + + /** Static value BadRequestNotSupported for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_NOT_SUPPORTED = fromString("BadRequestNotSupported"); + + /** Static value BadRequestInvalidIds for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_INVALID_IDS = fromString("BadRequestInvalidIds"); + + /** Static value BadRequestProjectName for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PROJECT_NAME = fromString("BadRequestProjectName"); + + /** Static value BadRequestProjectNameNotUnique for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PROJECT_NAME_NOT_UNIQUE = fromString("BadRequestProjectNameNotUnique"); + + /** Static value BadRequestProjectDescription for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PROJECT_DESCRIPTION = fromString("BadRequestProjectDescription"); + + /** Static value BadRequestProjectUnknownDomain for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PROJECT_UNKNOWN_DOMAIN = fromString("BadRequestProjectUnknownDomain"); + + /** Static value BadRequestProjectUnknownClassification for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PROJECT_UNKNOWN_CLASSIFICATION = fromString("BadRequestProjectUnknownClassification"); + + /** Static value BadRequestProjectUnsupportedDomainTypeChange for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PROJECT_UNSUPPORTED_DOMAIN_TYPE_CHANGE = fromString("BadRequestProjectUnsupportedDomainTypeChange"); + + /** Static value BadRequestProjectUnsupportedExportPlatform for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PROJECT_UNSUPPORTED_EXPORT_PLATFORM = fromString("BadRequestProjectUnsupportedExportPlatform"); + + /** Static value BadRequestIterationName for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_ITERATION_NAME = fromString("BadRequestIterationName"); + + /** Static value BadRequestIterationNameNotUnique for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_ITERATION_NAME_NOT_UNIQUE = fromString("BadRequestIterationNameNotUnique"); + + /** Static value BadRequestIterationDescription for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_ITERATION_DESCRIPTION = fromString("BadRequestIterationDescription"); + + /** Static value BadRequestIterationIsNotTrained for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_ITERATION_IS_NOT_TRAINED = fromString("BadRequestIterationIsNotTrained"); + + /** Static value BadRequestWorkspaceCannotBeModified for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_WORKSPACE_CANNOT_BE_MODIFIED = fromString("BadRequestWorkspaceCannotBeModified"); + + /** Static value BadRequestWorkspaceNotDeletable for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_WORKSPACE_NOT_DELETABLE = fromString("BadRequestWorkspaceNotDeletable"); + + /** Static value BadRequestTagName for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_TAG_NAME = fromString("BadRequestTagName"); + + /** Static value BadRequestTagNameNotUnique for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_TAG_NAME_NOT_UNIQUE = fromString("BadRequestTagNameNotUnique"); + + /** Static value BadRequestTagDescription for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_TAG_DESCRIPTION = fromString("BadRequestTagDescription"); + + /** Static value BadRequestTagType for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_TAG_TYPE = fromString("BadRequestTagType"); + + /** Static value BadRequestMultipleNegativeTag for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_MULTIPLE_NEGATIVE_TAG = fromString("BadRequestMultipleNegativeTag"); + + /** Static value BadRequestImageTags for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_IMAGE_TAGS = fromString("BadRequestImageTags"); + + /** Static value BadRequestImageRegions for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_IMAGE_REGIONS = fromString("BadRequestImageRegions"); + + /** Static value BadRequestNegativeAndRegularTagOnSameImage for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_NEGATIVE_AND_REGULAR_TAG_ON_SAME_IMAGE = fromString("BadRequestNegativeAndRegularTagOnSameImage"); + + /** Static value BadRequestRequiredParamIsNull for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_REQUIRED_PARAM_IS_NULL = fromString("BadRequestRequiredParamIsNull"); + + /** Static value BadRequestIterationIsPublished for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_ITERATION_IS_PUBLISHED = fromString("BadRequestIterationIsPublished"); + + /** Static value BadRequestInvalidPublishName for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_INVALID_PUBLISH_NAME = fromString("BadRequestInvalidPublishName"); + + /** Static value BadRequestInvalidPublishTarget for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_INVALID_PUBLISH_TARGET = fromString("BadRequestInvalidPublishTarget"); + + /** Static value BadRequestUnpublishFailed for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_UNPUBLISH_FAILED = fromString("BadRequestUnpublishFailed"); + + /** Static value BadRequestIterationNotPublished for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_ITERATION_NOT_PUBLISHED = fromString("BadRequestIterationNotPublished"); + + /** Static value BadRequestSubscriptionApi for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_SUBSCRIPTION_API = fromString("BadRequestSubscriptionApi"); + + /** Static value BadRequestExceedProjectLimit for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_EXCEED_PROJECT_LIMIT = fromString("BadRequestExceedProjectLimit"); + + /** Static value BadRequestExceedIterationPerProjectLimit for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_EXCEED_ITERATION_PER_PROJECT_LIMIT = fromString("BadRequestExceedIterationPerProjectLimit"); + + /** Static value BadRequestExceedTagPerProjectLimit for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_EXCEED_TAG_PER_PROJECT_LIMIT = fromString("BadRequestExceedTagPerProjectLimit"); + + /** Static value BadRequestExceedTagPerImageLimit for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_EXCEED_TAG_PER_IMAGE_LIMIT = fromString("BadRequestExceedTagPerImageLimit"); + + /** Static value BadRequestExceededQuota for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_EXCEEDED_QUOTA = fromString("BadRequestExceededQuota"); + + /** Static value BadRequestCannotMigrateProjectWithName for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_CANNOT_MIGRATE_PROJECT_WITH_NAME = fromString("BadRequestCannotMigrateProjectWithName"); + + /** Static value BadRequestNotLimitedTrial for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_NOT_LIMITED_TRIAL = fromString("BadRequestNotLimitedTrial"); + + /** Static value BadRequestImageBatch for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_IMAGE_BATCH = fromString("BadRequestImageBatch"); + + /** Static value BadRequestImageStream for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_IMAGE_STREAM = fromString("BadRequestImageStream"); + + /** Static value BadRequestImageUrl for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_IMAGE_URL = fromString("BadRequestImageUrl"); + + /** Static value BadRequestImageFormat for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_IMAGE_FORMAT = fromString("BadRequestImageFormat"); + + /** Static value BadRequestImageSizeBytes for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_IMAGE_SIZE_BYTES = fromString("BadRequestImageSizeBytes"); + + /** Static value BadRequestImageExceededCount for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_IMAGE_EXCEEDED_COUNT = fromString("BadRequestImageExceededCount"); + + /** Static value BadRequestTrainingNotNeeded for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_TRAINING_NOT_NEEDED = fromString("BadRequestTrainingNotNeeded"); + + /** Static value BadRequestTrainingNotNeededButTrainingPipelineUpdated for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_TRAINING_NOT_NEEDED_BUT_TRAINING_PIPELINE_UPDATED = fromString("BadRequestTrainingNotNeededButTrainingPipelineUpdated"); + + /** Static value BadRequestTrainingValidationFailed for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_TRAINING_VALIDATION_FAILED = fromString("BadRequestTrainingValidationFailed"); + + /** Static value BadRequestClassificationTrainingValidationFailed for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_CLASSIFICATION_TRAINING_VALIDATION_FAILED = fromString("BadRequestClassificationTrainingValidationFailed"); + + /** Static value BadRequestMultiClassClassificationTrainingValidationFailed for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_MULTI_CLASS_CLASSIFICATION_TRAINING_VALIDATION_FAILED = fromString("BadRequestMultiClassClassificationTrainingValidationFailed"); + + /** Static value BadRequestMultiLabelClassificationTrainingValidationFailed for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_MULTI_LABEL_CLASSIFICATION_TRAINING_VALIDATION_FAILED = fromString("BadRequestMultiLabelClassificationTrainingValidationFailed"); + + /** Static value BadRequestDetectionTrainingValidationFailed for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_DETECTION_TRAINING_VALIDATION_FAILED = fromString("BadRequestDetectionTrainingValidationFailed"); + + /** Static value BadRequestTrainingAlreadyInProgress for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_TRAINING_ALREADY_IN_PROGRESS = fromString("BadRequestTrainingAlreadyInProgress"); + + /** Static value BadRequestDetectionTrainingNotAllowNegativeTag for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_DETECTION_TRAINING_NOT_ALLOW_NEGATIVE_TAG = fromString("BadRequestDetectionTrainingNotAllowNegativeTag"); + + /** Static value BadRequestInvalidEmailAddress for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_INVALID_EMAIL_ADDRESS = fromString("BadRequestInvalidEmailAddress"); + + /** Static value BadRequestDomainNotSupportedForAdvancedTraining for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_DOMAIN_NOT_SUPPORTED_FOR_ADVANCED_TRAINING = fromString("BadRequestDomainNotSupportedForAdvancedTraining"); + + /** Static value BadRequestExportPlatformNotSupportedForAdvancedTraining for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_EXPORT_PLATFORM_NOT_SUPPORTED_FOR_ADVANCED_TRAINING = fromString("BadRequestExportPlatformNotSupportedForAdvancedTraining"); + + /** Static value BadRequestReservedBudgetInHoursNotEnoughForAdvancedTraining for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_RESERVED_BUDGET_IN_HOURS_NOT_ENOUGH_FOR_ADVANCED_TRAINING = fromString("BadRequestReservedBudgetInHoursNotEnoughForAdvancedTraining"); + + /** Static value BadRequestExportValidationFailed for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_EXPORT_VALIDATION_FAILED = fromString("BadRequestExportValidationFailed"); + + /** Static value BadRequestExportAlreadyInProgress for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_EXPORT_ALREADY_IN_PROGRESS = fromString("BadRequestExportAlreadyInProgress"); + + /** Static value BadRequestPredictionIdsMissing for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PREDICTION_IDS_MISSING = fromString("BadRequestPredictionIdsMissing"); + + /** Static value BadRequestPredictionIdsExceededCount for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PREDICTION_IDS_EXCEEDED_COUNT = fromString("BadRequestPredictionIdsExceededCount"); + + /** Static value BadRequestPredictionTagsExceededCount for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PREDICTION_TAGS_EXCEEDED_COUNT = fromString("BadRequestPredictionTagsExceededCount"); + + /** Static value BadRequestPredictionResultsExceededCount for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PREDICTION_RESULTS_EXCEEDED_COUNT = fromString("BadRequestPredictionResultsExceededCount"); + + /** Static value BadRequestPredictionInvalidApplicationName for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PREDICTION_INVALID_APPLICATION_NAME = fromString("BadRequestPredictionInvalidApplicationName"); + + /** Static value BadRequestPredictionInvalidQueryParameters for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_PREDICTION_INVALID_QUERY_PARAMETERS = fromString("BadRequestPredictionInvalidQueryParameters"); + + /** Static value BadRequestInvalid for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes BAD_REQUEST_INVALID = fromString("BadRequestInvalid"); + + /** Static value UnsupportedMediaType for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes UNSUPPORTED_MEDIA_TYPE = fromString("UnsupportedMediaType"); + + /** Static value Forbidden for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes FORBIDDEN = fromString("Forbidden"); + + /** Static value ForbiddenUser for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes FORBIDDEN_USER = fromString("ForbiddenUser"); + + /** Static value ForbiddenUserResource for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes FORBIDDEN_USER_RESOURCE = fromString("ForbiddenUserResource"); + + /** Static value ForbiddenUserSignupDisabled for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes FORBIDDEN_USER_SIGNUP_DISABLED = fromString("ForbiddenUserSignupDisabled"); + + /** Static value ForbiddenUserSignupAllowanceExceeded for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes FORBIDDEN_USER_SIGNUP_ALLOWANCE_EXCEEDED = fromString("ForbiddenUserSignupAllowanceExceeded"); + + /** Static value ForbiddenUserDoesNotExist for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes FORBIDDEN_USER_DOES_NOT_EXIST = fromString("ForbiddenUserDoesNotExist"); + + /** Static value ForbiddenUserDisabled for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes FORBIDDEN_USER_DISABLED = fromString("ForbiddenUserDisabled"); + + /** Static value ForbiddenUserInsufficientCapability for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes FORBIDDEN_USER_INSUFFICIENT_CAPABILITY = fromString("ForbiddenUserInsufficientCapability"); + + /** Static value ForbiddenDRModeEnabled for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes FORBIDDEN_DRMODE_ENABLED = fromString("ForbiddenDRModeEnabled"); + + /** Static value ForbiddenInvalid for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes FORBIDDEN_INVALID = fromString("ForbiddenInvalid"); + + /** Static value NotFound for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes NOT_FOUND = fromString("NotFound"); + + /** Static value NotFoundProject for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes NOT_FOUND_PROJECT = fromString("NotFoundProject"); + + /** Static value NotFoundProjectDefaultIteration for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes NOT_FOUND_PROJECT_DEFAULT_ITERATION = fromString("NotFoundProjectDefaultIteration"); + + /** Static value NotFoundIteration for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes NOT_FOUND_ITERATION = fromString("NotFoundIteration"); + + /** Static value NotFoundIterationPerformance for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes NOT_FOUND_ITERATION_PERFORMANCE = fromString("NotFoundIterationPerformance"); + + /** Static value NotFoundTag for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes NOT_FOUND_TAG = fromString("NotFoundTag"); + + /** Static value NotFoundImage for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes NOT_FOUND_IMAGE = fromString("NotFoundImage"); + + /** Static value NotFoundDomain for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes NOT_FOUND_DOMAIN = fromString("NotFoundDomain"); + + /** Static value NotFoundApimSubscription for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes NOT_FOUND_APIM_SUBSCRIPTION = fromString("NotFoundApimSubscription"); + + /** Static value NotFoundInvalid for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes NOT_FOUND_INVALID = fromString("NotFoundInvalid"); + + /** Static value Conflict for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes CONFLICT = fromString("Conflict"); + + /** Static value ConflictInvalid for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes CONFLICT_INVALID = fromString("ConflictInvalid"); + + /** Static value ErrorUnknown for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_UNKNOWN = fromString("ErrorUnknown"); + + /** Static value ErrorProjectInvalidWorkspace for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_PROJECT_INVALID_WORKSPACE = fromString("ErrorProjectInvalidWorkspace"); + + /** Static value ErrorProjectInvalidPipelineConfiguration for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_PROJECT_INVALID_PIPELINE_CONFIGURATION = fromString("ErrorProjectInvalidPipelineConfiguration"); + + /** Static value ErrorProjectInvalidDomain for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_PROJECT_INVALID_DOMAIN = fromString("ErrorProjectInvalidDomain"); + + /** Static value ErrorProjectTrainingRequestFailed for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_PROJECT_TRAINING_REQUEST_FAILED = fromString("ErrorProjectTrainingRequestFailed"); + + /** Static value ErrorProjectExportRequestFailed for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_PROJECT_EXPORT_REQUEST_FAILED = fromString("ErrorProjectExportRequestFailed"); + + /** Static value ErrorFeaturizationServiceUnavailable for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_FEATURIZATION_SERVICE_UNAVAILABLE = fromString("ErrorFeaturizationServiceUnavailable"); + + /** Static value ErrorFeaturizationQueueTimeout for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_FEATURIZATION_QUEUE_TIMEOUT = fromString("ErrorFeaturizationQueueTimeout"); + + /** Static value ErrorFeaturizationInvalidFeaturizer for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_FEATURIZATION_INVALID_FEATURIZER = fromString("ErrorFeaturizationInvalidFeaturizer"); + + /** Static value ErrorFeaturizationAugmentationUnavailable for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_FEATURIZATION_AUGMENTATION_UNAVAILABLE = fromString("ErrorFeaturizationAugmentationUnavailable"); + + /** Static value ErrorFeaturizationUnrecognizedJob for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_FEATURIZATION_UNRECOGNIZED_JOB = fromString("ErrorFeaturizationUnrecognizedJob"); + + /** Static value ErrorFeaturizationAugmentationError for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_FEATURIZATION_AUGMENTATION_ERROR = fromString("ErrorFeaturizationAugmentationError"); + + /** Static value ErrorExporterInvalidPlatform for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_EXPORTER_INVALID_PLATFORM = fromString("ErrorExporterInvalidPlatform"); + + /** Static value ErrorExporterInvalidFeaturizer for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_EXPORTER_INVALID_FEATURIZER = fromString("ErrorExporterInvalidFeaturizer"); + + /** Static value ErrorExporterInvalidClassifier for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_EXPORTER_INVALID_CLASSIFIER = fromString("ErrorExporterInvalidClassifier"); + + /** Static value ErrorPredictionServiceUnavailable for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_PREDICTION_SERVICE_UNAVAILABLE = fromString("ErrorPredictionServiceUnavailable"); + + /** Static value ErrorPredictionModelNotFound for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_PREDICTION_MODEL_NOT_FOUND = fromString("ErrorPredictionModelNotFound"); + + /** Static value ErrorPredictionModelNotCached for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_PREDICTION_MODEL_NOT_CACHED = fromString("ErrorPredictionModelNotCached"); + + /** Static value ErrorPrediction for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_PREDICTION = fromString("ErrorPrediction"); + + /** Static value ErrorPredictionStorage for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_PREDICTION_STORAGE = fromString("ErrorPredictionStorage"); + + /** Static value ErrorRegionProposal for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_REGION_PROPOSAL = fromString("ErrorRegionProposal"); + + /** Static value ErrorInvalid for CustomVisionErrorCodes. */ + public static final CustomVisionErrorCodes ERROR_INVALID = fromString("ErrorInvalid"); + + /** + * Creates or finds a CustomVisionErrorCodes from its string representation. + * @param name a name to look for + * @return the corresponding CustomVisionErrorCodes + */ + @JsonCreator + public static CustomVisionErrorCodes fromString(String name) { + return fromString(name, CustomVisionErrorCodes.class); + } + + /** + * @return known CustomVisionErrorCodes values + */ + public static Collection values() { + return values(CustomVisionErrorCodes.class); + } +} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CustomVisionErrorException.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CustomVisionErrorException.java new file mode 100644 index 000000000000..8e371bfcc331 --- /dev/null +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/CustomVisionErrorException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.customvision.training.models; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with CustomVisionError information. + */ +public class CustomVisionErrorException extends RestException { + /** + * Initializes a new instance of the CustomVisionErrorException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public CustomVisionErrorException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the CustomVisionErrorException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public CustomVisionErrorException(final String message, final Response response, final CustomVisionError body) { + super(message, response, body); + } + + @Override + public CustomVisionError body() { + return (CustomVisionError) super.body(); + } +} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Export.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Export.java index c4dc3d42098e..5fe29812eb8e 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Export.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Export.java @@ -15,31 +15,35 @@ */ public class Export { /** - * Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', 'ONNX'. + * Platform of the export. Possible values include: 'CoreML', 'TensorFlow', + * 'DockerFile', 'ONNX', 'VAIDK'. */ @JsonProperty(value = "platform", access = JsonProperty.Access.WRITE_ONLY) private ExportPlatform platform; /** - * Possible values include: 'Exporting', 'Failed', 'Done'. + * Status of the export. Possible values include: 'Exporting', 'Failed', + * 'Done'. */ @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private ExportStatusModel status; + private ExportStatus status; /** - * The downloadUri property. + * URI used to download the model. */ @JsonProperty(value = "downloadUri", access = JsonProperty.Access.WRITE_ONLY) private String downloadUri; /** - * Possible values include: 'Linux', 'Windows'. + * Flavor of the export. Possible values include: 'Linux', 'Windows', + * 'ONNX10', 'ONNX12', 'ARM'. */ @JsonProperty(value = "flavor", access = JsonProperty.Access.WRITE_ONLY) private ExportFlavor flavor; /** - * The newerVersionAvailable property. + * Indicates an updated version of the export package is available and + * should be re-exported for the latest changes. */ @JsonProperty(value = "newerVersionAvailable", access = JsonProperty.Access.WRITE_ONLY) private boolean newerVersionAvailable; @@ -58,7 +62,7 @@ public ExportPlatform platform() { * * @return the status value */ - public ExportStatusModel status() { + public ExportStatus status() { return this.status; } diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ExportFlavor.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ExportFlavor.java index 72aeb179147e..0239305e6183 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ExportFlavor.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ExportFlavor.java @@ -22,6 +22,15 @@ public final class ExportFlavor extends ExpandableStringEnum { /** Static value Windows for ExportFlavor. */ public static final ExportFlavor WINDOWS = fromString("Windows"); + /** Static value ONNX10 for ExportFlavor. */ + public static final ExportFlavor ONNX10 = fromString("ONNX10"); + + /** Static value ONNX12 for ExportFlavor. */ + public static final ExportFlavor ONNX12 = fromString("ONNX12"); + + /** Static value ARM for ExportFlavor. */ + public static final ExportFlavor ARM = fromString("ARM"); + /** * Creates or finds a ExportFlavor from its string representation. * @param name a name to look for diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ExportIterationOptionalParameter.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ExportIterationOptionalParameter.java index 9afa55cc54bd..db5a063def32 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ExportIterationOptionalParameter.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ExportIterationOptionalParameter.java @@ -14,8 +14,8 @@ */ public class ExportIterationOptionalParameter { /** - * The flavor of the target platform (Windows, Linux, ARM, or GPU). - * Possible values include: 'Linux', 'Windows'. + * The flavor of the target platform. Possible values include: 'Linux', + * 'Windows', 'ONNX10', 'ONNX12', 'ARM'. */ private String flavor; diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ExportPlatform.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ExportPlatform.java index 563148e4ad36..45cd5acc80b1 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ExportPlatform.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ExportPlatform.java @@ -28,6 +28,9 @@ public final class ExportPlatform extends ExpandableStringEnum { /** Static value ONNX for ExportPlatform. */ public static final ExportPlatform ONNX = fromString("ONNX"); + /** Static value VAIDK for ExportPlatform. */ + public static final ExportPlatform VAIDK = fromString("VAIDK"); + /** * Creates or finds a ExportPlatform from its string representation. * @param name a name to look for diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ExportStatus.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ExportStatus.java new file mode 100644 index 000000000000..458772522e8f --- /dev/null +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ExportStatus.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.customvision.training.models; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ExportStatus. + */ +public final class ExportStatus extends ExpandableStringEnum { + /** Static value Exporting for ExportStatus. */ + public static final ExportStatus EXPORTING = fromString("Exporting"); + + /** Static value Failed for ExportStatus. */ + public static final ExportStatus FAILED = fromString("Failed"); + + /** Static value Done for ExportStatus. */ + public static final ExportStatus DONE = fromString("Done"); + + /** + * Creates or finds a ExportStatus from its string representation. + * @param name a name to look for + * @return the corresponding ExportStatus + */ + @JsonCreator + public static ExportStatus fromString(String name) { + return fromString(name, ExportStatus.class); + } + + /** + * @return known ExportStatus values + */ + public static Collection values() { + return values(ExportStatus.class); + } +} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ExportStatusModel.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ExportStatusModel.java deleted file mode 100644 index 533c5e883c50..000000000000 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ExportStatusModel.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - */ - -package com.microsoft.azure.cognitiveservices.vision.customvision.training.models; - -import java.util.Collection; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.microsoft.rest.ExpandableStringEnum; - -/** - * Defines values for ExportStatusModel. - */ -public final class ExportStatusModel extends ExpandableStringEnum { - /** Static value Exporting for ExportStatusModel. */ - public static final ExportStatusModel EXPORTING = fromString("Exporting"); - - /** Static value Failed for ExportStatusModel. */ - public static final ExportStatusModel FAILED = fromString("Failed"); - - /** Static value Done for ExportStatusModel. */ - public static final ExportStatusModel DONE = fromString("Done"); - - /** - * Creates or finds a ExportStatusModel from its string representation. - * @param name a name to look for - * @return the corresponding ExportStatusModel - */ - @JsonCreator - public static ExportStatusModel fromString(String name) { - return fromString(name, ExportStatusModel.class); - } - - /** - * @return known ExportStatusModel values - */ - public static Collection values() { - return values(ExportStatusModel.class); - } -} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/GetImagePerformanceCountOptionalParameter.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/GetImagePerformanceCountOptionalParameter.java index 5d049896a99e..4475eb19adf9 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/GetImagePerformanceCountOptionalParameter.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/GetImagePerformanceCountOptionalParameter.java @@ -9,6 +9,7 @@ package com.microsoft.azure.cognitiveservices.vision.customvision.training.models; import java.util.List; +import java.util.UUID; /** * The GetImagePerformanceCountOptionalParameter model. @@ -18,7 +19,7 @@ public class GetImagePerformanceCountOptionalParameter { * A list of tags ids to filter the images to count. Defaults to all tags * when null. */ - private List tagIds; + private List tagIds; /** * Gets or sets the preferred language for the response. @@ -30,7 +31,7 @@ public class GetImagePerformanceCountOptionalParameter { * * @return the tagIds value */ - public List tagIds() { + public List tagIds() { return this.tagIds; } @@ -40,7 +41,7 @@ public List tagIds() { * @param tagIds the tagIds value to set * @return the GetImagePerformanceCountOptionalParameter object itself. */ - public GetImagePerformanceCountOptionalParameter withTagIds(List tagIds) { + public GetImagePerformanceCountOptionalParameter withTagIds(List tagIds) { this.tagIds = tagIds; return this; } diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/GetImagePerformancesOptionalParameter.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/GetImagePerformancesOptionalParameter.java index 0ec8af788ad8..edd718142b28 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/GetImagePerformancesOptionalParameter.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/GetImagePerformancesOptionalParameter.java @@ -9,6 +9,7 @@ package com.microsoft.azure.cognitiveservices.vision.customvision.training.models; import java.util.List; +import java.util.UUID; /** * The GetImagePerformancesOptionalParameter model. @@ -18,7 +19,7 @@ public class GetImagePerformancesOptionalParameter { * A list of tags ids to filter the images. Defaults to all tagged images * when null. Limited to 20. */ - private List tagIds; + private List tagIds; /** * The ordering. Defaults to newest. Possible values include: 'Newest', @@ -47,7 +48,7 @@ public class GetImagePerformancesOptionalParameter { * * @return the tagIds value */ - public List tagIds() { + public List tagIds() { return this.tagIds; } @@ -57,7 +58,7 @@ public List tagIds() { * @param tagIds the tagIds value to set * @return the GetImagePerformancesOptionalParameter object itself. */ - public GetImagePerformancesOptionalParameter withTagIds(List tagIds) { + public GetImagePerformancesOptionalParameter withTagIds(List tagIds) { this.tagIds = tagIds; return this; } diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/GetImagesByIdsOptionalParameter.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/GetImagesByIdsOptionalParameter.java index 442d8ebd1965..2f3e86e7a6fd 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/GetImagesByIdsOptionalParameter.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/GetImagesByIdsOptionalParameter.java @@ -18,7 +18,7 @@ public class GetImagesByIdsOptionalParameter { /** * The list of image ids to retrieve. Limited to 256. */ - private List imageIds; + private List imageIds; /** * The iteration id. Defaults to workspace. @@ -35,7 +35,7 @@ public class GetImagesByIdsOptionalParameter { * * @return the imageIds value */ - public List imageIds() { + public List imageIds() { return this.imageIds; } @@ -45,7 +45,7 @@ public List imageIds() { * @param imageIds the imageIds value to set * @return the GetImagesByIdsOptionalParameter object itself. */ - public GetImagesByIdsOptionalParameter withImageIds(List imageIds) { + public GetImagesByIdsOptionalParameter withImageIds(List imageIds) { this.imageIds = imageIds; return this; } diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/GetTaggedImageCountOptionalParameter.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/GetTaggedImageCountOptionalParameter.java index fe834425ae31..6dbd64af1340 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/GetTaggedImageCountOptionalParameter.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/GetTaggedImageCountOptionalParameter.java @@ -24,7 +24,7 @@ public class GetTaggedImageCountOptionalParameter { * A list of tags ids to filter the images to count. Defaults to all tags * when null. */ - private List tagIds; + private List tagIds; /** * Gets or sets the preferred language for the response. @@ -56,7 +56,7 @@ public GetTaggedImageCountOptionalParameter withIterationId(UUID iterationId) { * * @return the tagIds value */ - public List tagIds() { + public List tagIds() { return this.tagIds; } @@ -66,7 +66,7 @@ public List tagIds() { * @param tagIds the tagIds value to set * @return the GetTaggedImageCountOptionalParameter object itself. */ - public GetTaggedImageCountOptionalParameter withTagIds(List tagIds) { + public GetTaggedImageCountOptionalParameter withTagIds(List tagIds) { this.tagIds = tagIds; return this; } diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/GetTaggedImagesOptionalParameter.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/GetTaggedImagesOptionalParameter.java index 306b1f337a02..3314442c7d13 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/GetTaggedImagesOptionalParameter.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/GetTaggedImagesOptionalParameter.java @@ -24,7 +24,7 @@ public class GetTaggedImagesOptionalParameter { * A list of tags ids to filter the images. Defaults to all tagged images * when null. Limited to 20. */ - private List tagIds; + private List tagIds; /** * The ordering. Defaults to newest. Possible values include: 'Newest', @@ -73,7 +73,7 @@ public GetTaggedImagesOptionalParameter withIterationId(UUID iterationId) { * * @return the tagIds value */ - public List tagIds() { + public List tagIds() { return this.tagIds; } @@ -83,7 +83,7 @@ public List tagIds() { * @param tagIds the tagIds value to set * @return the GetTaggedImagesOptionalParameter object itself. */ - public GetTaggedImagesOptionalParameter withTagIds(List tagIds) { + public GetTaggedImagesOptionalParameter withTagIds(List tagIds) { this.tagIds = tagIds; return this; } diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Image.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Image.java index 2dd19b767654..f91a8f0fa3eb 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Image.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Image.java @@ -18,49 +18,55 @@ */ public class Image { /** - * The id property. + * Id of the image. */ @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) private UUID id; /** - * The created property. + * Date the image was created. */ @JsonProperty(value = "created", access = JsonProperty.Access.WRITE_ONLY) private DateTime created; /** - * The width property. + * Width of the image. */ @JsonProperty(value = "width", access = JsonProperty.Access.WRITE_ONLY) private int width; /** - * The height property. + * Height of the image. */ @JsonProperty(value = "height", access = JsonProperty.Access.WRITE_ONLY) private int height; /** - * The imageUri property. + * The URI to the (resized) image used for training. */ - @JsonProperty(value = "imageUri", access = JsonProperty.Access.WRITE_ONLY) - private String imageUri; + @JsonProperty(value = "resizedImageUri", access = JsonProperty.Access.WRITE_ONLY) + private String resizedImageUri; /** - * The thumbnailUri property. + * The URI to the thumbnail of the original image. */ @JsonProperty(value = "thumbnailUri", access = JsonProperty.Access.WRITE_ONLY) private String thumbnailUri; /** - * The tags property. + * The URI to the original uploaded image. + */ + @JsonProperty(value = "originalImageUri", access = JsonProperty.Access.WRITE_ONLY) + private String originalImageUri; + + /** + * Tags associated with this image. */ @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) private List tags; /** - * The regions property. + * Regions associated with this image. */ @JsonProperty(value = "regions", access = JsonProperty.Access.WRITE_ONLY) private List regions; @@ -102,12 +108,12 @@ public int height() { } /** - * Get the imageUri value. + * Get the resizedImageUri value. * - * @return the imageUri value + * @return the resizedImageUri value */ - public String imageUri() { - return this.imageUri; + public String resizedImageUri() { + return this.resizedImageUri; } /** @@ -119,6 +125,15 @@ public String thumbnailUri() { return this.thumbnailUri; } + /** + * Get the originalImageUri value. + * + * @return the originalImageUri value + */ + public String originalImageUri() { + return this.originalImageUri; + } + /** * Get the tags value. * diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageCreateResult.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageCreateResult.java index 550d0a0ec3b7..160f0e627e13 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageCreateResult.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageCreateResult.java @@ -15,22 +15,23 @@ */ public class ImageCreateResult { /** - * The sourceUrl property. + * Source URL of the image. */ @JsonProperty(value = "sourceUrl", access = JsonProperty.Access.WRITE_ONLY) private String sourceUrl; /** - * Possible values include: 'OK', 'OKDuplicate', 'ErrorSource', - * 'ErrorImageFormat', 'ErrorImageSize', 'ErrorStorage', - * 'ErrorLimitExceed', 'ErrorTagLimitExceed', 'ErrorRegionLimitExceed', - * 'ErrorUnknown'. + * Status of the image creation. Possible values include: 'OK', + * 'OKDuplicate', 'ErrorSource', 'ErrorImageFormat', 'ErrorImageSize', + * 'ErrorStorage', 'ErrorLimitExceed', 'ErrorTagLimitExceed', + * 'ErrorRegionLimitExceed', 'ErrorUnknown', + * 'ErrorNegativeAndRegularTagOnSameImage'. */ @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private ImageUploadStatus status; + private ImageCreateStatus status; /** - * The image property. + * The image. */ @JsonProperty(value = "image", access = JsonProperty.Access.WRITE_ONLY) private Image image; @@ -49,7 +50,7 @@ public String sourceUrl() { * * @return the status value */ - public ImageUploadStatus status() { + public ImageCreateStatus status() { return this.status; } diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageCreateStatus.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageCreateStatus.java new file mode 100644 index 000000000000..b3cdf60e41ff --- /dev/null +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageCreateStatus.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.customvision.training.models; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ImageCreateStatus. + */ +public final class ImageCreateStatus extends ExpandableStringEnum { + /** Static value OK for ImageCreateStatus. */ + public static final ImageCreateStatus OK = fromString("OK"); + + /** Static value OKDuplicate for ImageCreateStatus. */ + public static final ImageCreateStatus OKDUPLICATE = fromString("OKDuplicate"); + + /** Static value ErrorSource for ImageCreateStatus. */ + public static final ImageCreateStatus ERROR_SOURCE = fromString("ErrorSource"); + + /** Static value ErrorImageFormat for ImageCreateStatus. */ + public static final ImageCreateStatus ERROR_IMAGE_FORMAT = fromString("ErrorImageFormat"); + + /** Static value ErrorImageSize for ImageCreateStatus. */ + public static final ImageCreateStatus ERROR_IMAGE_SIZE = fromString("ErrorImageSize"); + + /** Static value ErrorStorage for ImageCreateStatus. */ + public static final ImageCreateStatus ERROR_STORAGE = fromString("ErrorStorage"); + + /** Static value ErrorLimitExceed for ImageCreateStatus. */ + public static final ImageCreateStatus ERROR_LIMIT_EXCEED = fromString("ErrorLimitExceed"); + + /** Static value ErrorTagLimitExceed for ImageCreateStatus. */ + public static final ImageCreateStatus ERROR_TAG_LIMIT_EXCEED = fromString("ErrorTagLimitExceed"); + + /** Static value ErrorRegionLimitExceed for ImageCreateStatus. */ + public static final ImageCreateStatus ERROR_REGION_LIMIT_EXCEED = fromString("ErrorRegionLimitExceed"); + + /** Static value ErrorUnknown for ImageCreateStatus. */ + public static final ImageCreateStatus ERROR_UNKNOWN = fromString("ErrorUnknown"); + + /** Static value ErrorNegativeAndRegularTagOnSameImage for ImageCreateStatus. */ + public static final ImageCreateStatus ERROR_NEGATIVE_AND_REGULAR_TAG_ON_SAME_IMAGE = fromString("ErrorNegativeAndRegularTagOnSameImage"); + + /** + * Creates or finds a ImageCreateStatus from its string representation. + * @param name a name to look for + * @return the corresponding ImageCreateStatus + */ + @JsonCreator + public static ImageCreateStatus fromString(String name) { + return fromString(name, ImageCreateStatus.class); + } + + /** + * @return known ImageCreateStatus values + */ + public static Collection values() { + return values(ImageCreateStatus.class); + } +} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageCreateSummary.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageCreateSummary.java index 16597571a075..69f18a1ac396 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageCreateSummary.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageCreateSummary.java @@ -16,13 +16,14 @@ */ public class ImageCreateSummary { /** - * The isBatchSuccessful property. + * True if all of the images in the batch were created successfully, + * otherwise false. */ @JsonProperty(value = "isBatchSuccessful", access = JsonProperty.Access.WRITE_ONLY) private boolean isBatchSuccessful; /** - * The images property. + * List of the image creation results. */ @JsonProperty(value = "images", access = JsonProperty.Access.WRITE_ONLY) private List images; diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageIdCreateEntry.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageIdCreateEntry.java index 050efd57101b..c1fdc9ffb23a 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageIdCreateEntry.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageIdCreateEntry.java @@ -17,7 +17,7 @@ */ public class ImageIdCreateEntry { /** - * The id property. + * Id of the image. */ @JsonProperty(value = "id") private UUID id; diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImagePrediction.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImagePrediction.java index 81f0107ce3ae..6e05bb928dc6 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImagePrediction.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImagePrediction.java @@ -14,35 +14,35 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * The ImagePrediction model. + * Result of an image prediction request. */ public class ImagePrediction { /** - * The id property. + * Prediction Id. */ @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) private UUID id; /** - * The project property. + * Project Id. */ @JsonProperty(value = "project", access = JsonProperty.Access.WRITE_ONLY) private UUID project; /** - * The iteration property. + * Iteration Id. */ @JsonProperty(value = "iteration", access = JsonProperty.Access.WRITE_ONLY) private UUID iteration; /** - * The created property. + * Date this prediction was created. */ @JsonProperty(value = "created", access = JsonProperty.Access.WRITE_ONLY) private DateTime created; /** - * The predictions property. + * List of predictions. */ @JsonProperty(value = "predictions", access = JsonProperty.Access.WRITE_ONLY) private List predictions; diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageRegion.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageRegion.java index 36e160ed153d..d7b35cefc8bb 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageRegion.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageRegion.java @@ -35,33 +35,33 @@ public class ImageRegion { private DateTime created; /** - * The tagId property. + * Id of the tag associated with this region. */ - @JsonProperty(value = "tagId") + @JsonProperty(value = "tagId", required = true) private UUID tagId; /** - * The left property. + * Coordinate of the left boundary. */ - @JsonProperty(value = "left") + @JsonProperty(value = "left", required = true) private double left; /** - * The top property. + * Coordinate of the top boundary. */ - @JsonProperty(value = "top") + @JsonProperty(value = "top", required = true) private double top; /** - * The width property. + * Width. */ - @JsonProperty(value = "width") + @JsonProperty(value = "width", required = true) private double width; /** - * The height property. + * Height. */ - @JsonProperty(value = "height") + @JsonProperty(value = "height", required = true) private double height; /** diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageRegionCreateEntry.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageRegionCreateEntry.java index 077f0d78db63..6bbd00436744 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageRegionCreateEntry.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageRegionCreateEntry.java @@ -12,43 +12,43 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * The ImageRegionCreateEntry model. + * Entry associating a region to an image. */ public class ImageRegionCreateEntry { /** - * The imageId property. + * Id of the image. */ - @JsonProperty(value = "imageId") + @JsonProperty(value = "imageId", required = true) private UUID imageId; /** - * The tagId property. + * Id of the tag associated with this region. */ - @JsonProperty(value = "tagId") + @JsonProperty(value = "tagId", required = true) private UUID tagId; /** - * The left property. + * Coordinate of the left boundary. */ - @JsonProperty(value = "left") + @JsonProperty(value = "left", required = true) private double left; /** - * The top property. + * Coordinate of the top boundary. */ - @JsonProperty(value = "top") + @JsonProperty(value = "top", required = true) private double top; /** - * The width property. + * Width. */ - @JsonProperty(value = "width") + @JsonProperty(value = "width", required = true) private double width; /** - * The height property. + * Height. */ - @JsonProperty(value = "height") + @JsonProperty(value = "height", required = true) private double height; /** diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageRegionCreateResult.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageRegionCreateResult.java index 212f89ba2b42..40718249da72 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageRegionCreateResult.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageRegionCreateResult.java @@ -41,33 +41,33 @@ public class ImageRegionCreateResult { private DateTime created; /** - * The tagId property. + * Id of the tag associated with this region. */ - @JsonProperty(value = "tagId") + @JsonProperty(value = "tagId", required = true) private UUID tagId; /** - * The left property. + * Coordinate of the left boundary. */ - @JsonProperty(value = "left") + @JsonProperty(value = "left", required = true) private double left; /** - * The top property. + * Coordinate of the top boundary. */ - @JsonProperty(value = "top") + @JsonProperty(value = "top", required = true) private double top; /** - * The width property. + * Width. */ - @JsonProperty(value = "width") + @JsonProperty(value = "width", required = true) private double width; /** - * The height property. + * Height. */ - @JsonProperty(value = "height") + @JsonProperty(value = "height", required = true) private double height; /** diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageTagCreateBatch.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageTagCreateBatch.java index 1a6645dd0e2f..146245b37965 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageTagCreateBatch.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageTagCreateBatch.java @@ -12,11 +12,11 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * The ImageTagCreateBatch model. + * Batch of image tags. */ public class ImageTagCreateBatch { /** - * The tags property. + * Image Tag entries to include in this batch. */ @JsonProperty(value = "tags") private List tags; diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageTagCreateEntry.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageTagCreateEntry.java index f907b176be74..f0272b308f5b 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageTagCreateEntry.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageTagCreateEntry.java @@ -12,17 +12,17 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * The ImageTagCreateEntry model. + * Entry associating a tag to an image. */ public class ImageTagCreateEntry { /** - * The imageId property. + * Id of the image. */ @JsonProperty(value = "imageId") private UUID imageId; /** - * The tagId property. + * Id of the tag. */ @JsonProperty(value = "tagId") private UUID tagId; diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageUploadStatus.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageUploadStatus.java deleted file mode 100644 index 83f41cec498e..000000000000 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageUploadStatus.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - */ - -package com.microsoft.azure.cognitiveservices.vision.customvision.training.models; - -import java.util.Collection; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.microsoft.rest.ExpandableStringEnum; - -/** - * Defines values for ImageUploadStatus. - */ -public final class ImageUploadStatus extends ExpandableStringEnum { - /** Static value OK for ImageUploadStatus. */ - public static final ImageUploadStatus OK = fromString("OK"); - - /** Static value OKDuplicate for ImageUploadStatus. */ - public static final ImageUploadStatus OKDUPLICATE = fromString("OKDuplicate"); - - /** Static value ErrorSource for ImageUploadStatus. */ - public static final ImageUploadStatus ERROR_SOURCE = fromString("ErrorSource"); - - /** Static value ErrorImageFormat for ImageUploadStatus. */ - public static final ImageUploadStatus ERROR_IMAGE_FORMAT = fromString("ErrorImageFormat"); - - /** Static value ErrorImageSize for ImageUploadStatus. */ - public static final ImageUploadStatus ERROR_IMAGE_SIZE = fromString("ErrorImageSize"); - - /** Static value ErrorStorage for ImageUploadStatus. */ - public static final ImageUploadStatus ERROR_STORAGE = fromString("ErrorStorage"); - - /** Static value ErrorLimitExceed for ImageUploadStatus. */ - public static final ImageUploadStatus ERROR_LIMIT_EXCEED = fromString("ErrorLimitExceed"); - - /** Static value ErrorTagLimitExceed for ImageUploadStatus. */ - public static final ImageUploadStatus ERROR_TAG_LIMIT_EXCEED = fromString("ErrorTagLimitExceed"); - - /** Static value ErrorRegionLimitExceed for ImageUploadStatus. */ - public static final ImageUploadStatus ERROR_REGION_LIMIT_EXCEED = fromString("ErrorRegionLimitExceed"); - - /** Static value ErrorUnknown for ImageUploadStatus. */ - public static final ImageUploadStatus ERROR_UNKNOWN = fromString("ErrorUnknown"); - - /** - * Creates or finds a ImageUploadStatus from its string representation. - * @param name a name to look for - * @return the corresponding ImageUploadStatus - */ - @JsonCreator - public static ImageUploadStatus fromString(String name) { - return fromString(name, ImageUploadStatus.class); - } - - /** - * @return known ImageUploadStatus values - */ - public static Collection values() { - return values(ImageUploadStatus.class); - } -} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageUrl.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageUrl.java index 2fb58d808300..c92df04647ee 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageUrl.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageUrl.java @@ -11,13 +11,13 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * The ImageUrl model. + * Image url. */ public class ImageUrl { /** - * The url property. + * Url of the image. */ - @JsonProperty(value = "url") + @JsonProperty(value = "url", required = true) private String url; /** diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageUrlCreateEntry.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageUrlCreateEntry.java index c5077f75461e..809a81616da0 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageUrlCreateEntry.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ImageUrlCreateEntry.java @@ -17,9 +17,9 @@ */ public class ImageUrlCreateEntry { /** - * The url property. + * Url of the image. */ - @JsonProperty(value = "url") + @JsonProperty(value = "url", required = true) private String url; /** diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Iteration.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Iteration.java index 2f3eb95aeab3..30237bfdf44e 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Iteration.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Iteration.java @@ -10,6 +10,7 @@ import java.util.UUID; import org.joda.time.DateTime; +import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; /** @@ -25,16 +26,9 @@ public class Iteration { /** * Gets or sets the name of the iteration. */ - @JsonProperty(value = "name") + @JsonProperty(value = "name", required = true) private String name; - /** - * Gets or sets a value indicating whether the iteration is the default - * iteration for the project. - */ - @JsonProperty(value = "isDefault") - private boolean isDefault; - /** * Gets the current iteration status. */ @@ -71,6 +65,12 @@ public class Iteration { @JsonProperty(value = "exportable", access = JsonProperty.Access.WRITE_ONLY) private boolean exportable; + /** + * A set of platforms this iteration can export to. + */ + @JsonProperty(value = "exportableTo", access = JsonProperty.Access.WRITE_ONLY) + private List exportableTo; + /** * Get or sets a guid of the domain the iteration has been trained on. */ @@ -84,6 +84,31 @@ public class Iteration { @JsonProperty(value = "classificationType", access = JsonProperty.Access.WRITE_ONLY) private Classifier classificationType; + /** + * Gets the training type of the iteration. Possible values include: + * 'Regular', 'Advanced'. + */ + @JsonProperty(value = "trainingType", access = JsonProperty.Access.WRITE_ONLY) + private TrainingType trainingType; + + /** + * Gets the reserved advanced training budget for the iteration. + */ + @JsonProperty(value = "reservedBudgetInHours", access = JsonProperty.Access.WRITE_ONLY) + private int reservedBudgetInHours; + + /** + * Name of the published model. + */ + @JsonProperty(value = "publishName", access = JsonProperty.Access.WRITE_ONLY) + private String publishName; + + /** + * Resource Provider Id this iteration was originally published to. + */ + @JsonProperty(value = "originalPublishResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String originalPublishResourceId; + /** * Get the id value. * @@ -113,26 +138,6 @@ public Iteration withName(String name) { return this; } - /** - * Get the isDefault value. - * - * @return the isDefault value - */ - public boolean isDefault() { - return this.isDefault; - } - - /** - * Set the isDefault value. - * - * @param isDefault the isDefault value to set - * @return the Iteration object itself. - */ - public Iteration withIsDefault(boolean isDefault) { - this.isDefault = isDefault; - return this; - } - /** * Get the status value. * @@ -187,6 +192,15 @@ public boolean exportable() { return this.exportable; } + /** + * Get the exportableTo value. + * + * @return the exportableTo value + */ + public List exportableTo() { + return this.exportableTo; + } + /** * Get the domainId value. * @@ -205,4 +219,40 @@ public Classifier classificationType() { return this.classificationType; } + /** + * Get the trainingType value. + * + * @return the trainingType value + */ + public TrainingType trainingType() { + return this.trainingType; + } + + /** + * Get the reservedBudgetInHours value. + * + * @return the reservedBudgetInHours value + */ + public int reservedBudgetInHours() { + return this.reservedBudgetInHours; + } + + /** + * Get the publishName value. + * + * @return the publishName value + */ + public String publishName() { + return this.publishName; + } + + /** + * Get the originalPublishResourceId value. + * + * @return the originalPublishResourceId value + */ + public String originalPublishResourceId() { + return this.originalPublishResourceId; + } + } diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Prediction.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Prediction.java index 7b22c84704c6..cd639ba1e5be 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Prediction.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Prediction.java @@ -12,29 +12,29 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * The Prediction model. + * Prediction result. */ public class Prediction { /** - * The probability property. + * Probability of the tag. */ @JsonProperty(value = "probability", access = JsonProperty.Access.WRITE_ONLY) private double probability; /** - * The tagId property. + * Id of the predicted tag. */ @JsonProperty(value = "tagId", access = JsonProperty.Access.WRITE_ONLY) private UUID tagId; /** - * The tagName property. + * Name of the predicted tag. */ @JsonProperty(value = "tagName", access = JsonProperty.Access.WRITE_ONLY) private String tagName; /** - * The boundingBox property. + * Bounding box of the prediction. */ @JsonProperty(value = "boundingBox", access = JsonProperty.Access.WRITE_ONLY) private BoundingBox boundingBox; diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Project.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Project.java index 31dd5e249e6e..79a878a120dd 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Project.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Project.java @@ -25,19 +25,19 @@ public class Project { /** * Gets or sets the name of the project. */ - @JsonProperty(value = "name") + @JsonProperty(value = "name", required = true) private String name; /** * Gets or sets the description of the project. */ - @JsonProperty(value = "description") + @JsonProperty(value = "description", required = true) private String description; /** * Gets or sets the project settings. */ - @JsonProperty(value = "settings") + @JsonProperty(value = "settings", required = true) private ProjectSettings settings; /** @@ -47,17 +47,23 @@ public class Project { private DateTime created; /** - * Gets the date this project was last modifed. + * Gets the date this project was last modified. */ @JsonProperty(value = "lastModified", access = JsonProperty.Access.WRITE_ONLY) private DateTime lastModified; /** - * Gets the thumbnail url representing the project. + * Gets the thumbnail url representing the image. */ @JsonProperty(value = "thumbnailUri", access = JsonProperty.Access.WRITE_ONLY) private String thumbnailUri; + /** + * Gets if the DR mode is on. + */ + @JsonProperty(value = "drModeEnabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean drModeEnabled; + /** * Get the id value. * @@ -154,4 +160,13 @@ public String thumbnailUri() { return this.thumbnailUri; } + /** + * Get the drModeEnabled value. + * + * @return the drModeEnabled value + */ + public Boolean drModeEnabled() { + return this.drModeEnabled; + } + } diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ProjectSettings.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ProjectSettings.java index ba8855458e12..a9f9d4b7c589 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ProjectSettings.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/ProjectSettings.java @@ -9,6 +9,7 @@ package com.microsoft.azure.cognitiveservices.vision.customvision.training.models; import java.util.UUID; +import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; /** @@ -28,6 +29,13 @@ public class ProjectSettings { @JsonProperty(value = "classificationType") private Classifier classificationType; + /** + * A list of ExportPlatform that the trained model should be able to + * support. + */ + @JsonProperty(value = "targetExportPlatforms") + private List targetExportPlatforms; + /** * Get the domainId value. * @@ -68,4 +76,24 @@ public ProjectSettings withClassificationType(Classifier classificationType) { return this; } + /** + * Get the targetExportPlatforms value. + * + * @return the targetExportPlatforms value + */ + public List targetExportPlatforms() { + return this.targetExportPlatforms; + } + + /** + * Set the targetExportPlatforms value. + * + * @param targetExportPlatforms the targetExportPlatforms value to set + * @return the ProjectSettings object itself. + */ + public ProjectSettings withTargetExportPlatforms(List targetExportPlatforms) { + this.targetExportPlatforms = targetExportPlatforms; + return this; + } + } diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/QuickTestImageUrlOptionalParameter.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/QuickTestImageUrlOptionalParameter.java index 6e63337d65a1..255e4835eb10 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/QuickTestImageUrlOptionalParameter.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/QuickTestImageUrlOptionalParameter.java @@ -21,11 +21,6 @@ public class QuickTestImageUrlOptionalParameter { */ private UUID iterationId; - /** - * The url property. - */ - private String url; - /** * Gets or sets the preferred language for the response. */ @@ -51,26 +46,6 @@ public QuickTestImageUrlOptionalParameter withIterationId(UUID iterationId) { return this; } - /** - * Get the url value. - * - * @return the url value - */ - public String url() { - return this.url; - } - - /** - * Set the url value. - * - * @param url the url value to set - * @return the QuickTestImageUrlOptionalParameter object itself. - */ - public QuickTestImageUrlOptionalParameter withUrl(String url) { - this.url = url; - return this; - } - /** * Get the thisclientacceptLanguage value. * diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Region.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Region.java index 1c9cf038292c..5f8f0fefb9a5 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Region.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Region.java @@ -16,33 +16,33 @@ */ public class Region { /** - * The tagId property. + * Id of the tag associated with this region. */ - @JsonProperty(value = "tagId") + @JsonProperty(value = "tagId", required = true) private UUID tagId; /** - * The left property. + * Coordinate of the left boundary. */ - @JsonProperty(value = "left") + @JsonProperty(value = "left", required = true) private double left; /** - * The top property. + * Coordinate of the top boundary. */ - @JsonProperty(value = "top") + @JsonProperty(value = "top", required = true) private double top; /** - * The width property. + * Width. */ - @JsonProperty(value = "width") + @JsonProperty(value = "width", required = true) private double width; /** - * The height property. + * Height. */ - @JsonProperty(value = "height") + @JsonProperty(value = "height", required = true) private double height; /** diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/StoredImagePrediction.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/StoredImagePrediction.java index 763004edf3f6..6ca7fd05455f 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/StoredImagePrediction.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/StoredImagePrediction.java @@ -18,60 +18,66 @@ */ public class StoredImagePrediction { /** - * The imageUri property. + * The URI to the (resized) prediction image. */ - @JsonProperty(value = "imageUri", access = JsonProperty.Access.WRITE_ONLY) - private String imageUri; + @JsonProperty(value = "resizedImageUri", access = JsonProperty.Access.WRITE_ONLY) + private String resizedImageUri; /** - * The thumbnailUri property. + * The URI to the thumbnail of the original prediction image. */ @JsonProperty(value = "thumbnailUri", access = JsonProperty.Access.WRITE_ONLY) private String thumbnailUri; /** - * The domain property. + * The URI to the original prediction image. + */ + @JsonProperty(value = "originalImageUri", access = JsonProperty.Access.WRITE_ONLY) + private String originalImageUri; + + /** + * Domain used for the prediction. */ @JsonProperty(value = "domain", access = JsonProperty.Access.WRITE_ONLY) private UUID domain; /** - * The id property. + * Prediction Id. */ @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) private UUID id; /** - * The project property. + * Project Id. */ @JsonProperty(value = "project", access = JsonProperty.Access.WRITE_ONLY) private UUID project; /** - * The iteration property. + * Iteration Id. */ @JsonProperty(value = "iteration", access = JsonProperty.Access.WRITE_ONLY) private UUID iteration; /** - * The created property. + * Date this prediction was created. */ @JsonProperty(value = "created", access = JsonProperty.Access.WRITE_ONLY) private DateTime created; /** - * The predictions property. + * List of predictions. */ @JsonProperty(value = "predictions", access = JsonProperty.Access.WRITE_ONLY) private List predictions; /** - * Get the imageUri value. + * Get the resizedImageUri value. * - * @return the imageUri value + * @return the resizedImageUri value */ - public String imageUri() { - return this.imageUri; + public String resizedImageUri() { + return this.resizedImageUri; } /** @@ -83,6 +89,15 @@ public String thumbnailUri() { return this.thumbnailUri; } + /** + * Get the originalImageUri value. + * + * @return the originalImageUri value + */ + public String originalImageUri() { + return this.originalImageUri; + } + /** * Get the domain value. * diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Tag.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Tag.java index 42de469690e0..cc08395abc8f 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Tag.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/Tag.java @@ -24,15 +24,22 @@ public class Tag { /** * Gets or sets the name of the tag. */ - @JsonProperty(value = "name") + @JsonProperty(value = "name", required = true) private String name; /** * Gets or sets the description of the tag. */ - @JsonProperty(value = "description") + @JsonProperty(value = "description", required = true) private String description; + /** + * Gets or sets the type of the tag. Possible values include: 'Regular', + * 'Negative'. + */ + @JsonProperty(value = "type", required = true) + private TagType type; + /** * Gets the number of images with this tag. */ @@ -88,6 +95,26 @@ public Tag withDescription(String description) { return this; } + /** + * Get the type value. + * + * @return the type value + */ + public TagType type() { + return this.type; + } + + /** + * Set the type value. + * + * @param type the type value to set + * @return the Tag object itself. + */ + public Tag withType(TagType type) { + this.type = type; + return this; + } + /** * Get the imageCount value. * diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/TagType.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/TagType.java new file mode 100644 index 000000000000..de7e24225dfb --- /dev/null +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/TagType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.customvision.training.models; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for TagType. + */ +public final class TagType extends ExpandableStringEnum { + /** Static value Regular for TagType. */ + public static final TagType REGULAR = fromString("Regular"); + + /** Static value Negative for TagType. */ + public static final TagType NEGATIVE = fromString("Negative"); + + /** + * Creates or finds a TagType from its string representation. + * @param name a name to look for + * @return the corresponding TagType + */ + @JsonCreator + public static TagType fromString(String name) { + return fromString(name, TagType.class); + } + + /** + * @return known TagType values + */ + public static Collection values() { + return values(TagType.class); + } +} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/TrainProjectOptionalParameter.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/TrainProjectOptionalParameter.java new file mode 100644 index 000000000000..9848368d8f05 --- /dev/null +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/TrainProjectOptionalParameter.java @@ -0,0 +1,144 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.customvision.training.models; + + +/** + * The TrainProjectOptionalParameter model. + */ +public class TrainProjectOptionalParameter { + /** + * The type of training to use to train the project (default: Regular). + * Possible values include: 'Regular', 'Advanced'. + */ + private String trainingType; + + /** + * The number of hours reserved as budget for training (if applicable). + */ + private Integer reservedBudgetInHours; + + /** + * Whether to force train even if dataset and configuration does not change + * (default: false). + */ + private Boolean forceTrain; + + /** + * The email address to send notification to when training finishes + * (default: null). + */ + private String notificationEmailAddress; + + /** + * Gets or sets the preferred language for the response. + */ + private String thisclientacceptLanguage; + + /** + * Get the trainingType value. + * + * @return the trainingType value + */ + public String trainingType() { + return this.trainingType; + } + + /** + * Set the trainingType value. + * + * @param trainingType the trainingType value to set + * @return the TrainProjectOptionalParameter object itself. + */ + public TrainProjectOptionalParameter withTrainingType(String trainingType) { + this.trainingType = trainingType; + return this; + } + + /** + * Get the reservedBudgetInHours value. + * + * @return the reservedBudgetInHours value + */ + public Integer reservedBudgetInHours() { + return this.reservedBudgetInHours; + } + + /** + * Set the reservedBudgetInHours value. + * + * @param reservedBudgetInHours the reservedBudgetInHours value to set + * @return the TrainProjectOptionalParameter object itself. + */ + public TrainProjectOptionalParameter withReservedBudgetInHours(Integer reservedBudgetInHours) { + this.reservedBudgetInHours = reservedBudgetInHours; + return this; + } + + /** + * Get the forceTrain value. + * + * @return the forceTrain value + */ + public Boolean forceTrain() { + return this.forceTrain; + } + + /** + * Set the forceTrain value. + * + * @param forceTrain the forceTrain value to set + * @return the TrainProjectOptionalParameter object itself. + */ + public TrainProjectOptionalParameter withForceTrain(Boolean forceTrain) { + this.forceTrain = forceTrain; + return this; + } + + /** + * Get the notificationEmailAddress value. + * + * @return the notificationEmailAddress value + */ + public String notificationEmailAddress() { + return this.notificationEmailAddress; + } + + /** + * Set the notificationEmailAddress value. + * + * @param notificationEmailAddress the notificationEmailAddress value to set + * @return the TrainProjectOptionalParameter object itself. + */ + public TrainProjectOptionalParameter withNotificationEmailAddress(String notificationEmailAddress) { + this.notificationEmailAddress = notificationEmailAddress; + return this; + } + + /** + * Get the thisclientacceptLanguage value. + * + * @return the thisclientacceptLanguage value + */ + public String thisclientacceptLanguage() { + return this.thisclientacceptLanguage; + } + + /** + * Set the thisclientacceptLanguage value. + * + * @param thisclientacceptLanguage the thisclientacceptLanguage value to set + * @return the TrainProjectOptionalParameter object itself. + */ + public TrainProjectOptionalParameter withThisclientacceptLanguage(String thisclientacceptLanguage) { + this.thisclientacceptLanguage = thisclientacceptLanguage; + return this; + } + +} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/TrainingType.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/TrainingType.java new file mode 100644 index 000000000000..5ee70ee1b563 --- /dev/null +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/TrainingType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.cognitiveservices.vision.customvision.training.models; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for TrainingType. + */ +public final class TrainingType extends ExpandableStringEnum { + /** Static value Regular for TrainingType. */ + public static final TrainingType REGULAR = fromString("Regular"); + + /** Static value Advanced for TrainingType. */ + public static final TrainingType ADVANCED = fromString("Advanced"); + + /** + * Creates or finds a TrainingType from its string representation. + * @param name a name to look for + * @return the corresponding TrainingType + */ + @JsonCreator + public static TrainingType fromString(String name) { + return fromString(name, TrainingType.class); + } + + /** + * @return known TrainingType values + */ + public static Collection values() { + return values(TrainingType.class); + } +} diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/package-info.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/package-info.java index a23776b5606c..06f9626aacbd 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/package-info.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/models/package-info.java @@ -5,6 +5,6 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * This package contains the models classes for TrainingApi. + * This package contains the models classes for CustomVisionTrainingClient. */ package com.microsoft.azure.cognitiveservices.vision.customvision.training.models; diff --git a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/package-info.java b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/package-info.java index 40cf7938d6de..92a37b7d2484 100644 --- a/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/package-info.java +++ b/sdk/cognitiveservices/ms-azure-cs-customvision-training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/package-info.java @@ -5,6 +5,6 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * This package contains the classes for TrainingApi. + * This package contains the classes for CustomVisionTrainingClient. */ package com.microsoft.azure.cognitiveservices.vision.customvision.training; diff --git a/sdk/cognitiveservices/ms-azure-cs-entitysearch/pom.xml b/sdk/cognitiveservices/ms-azure-cs-entitysearch/pom.xml index e43ccb17c512..826144233652 100644 --- a/sdk/cognitiveservices/ms-azure-cs-entitysearch/pom.xml +++ b/sdk/cognitiveservices/ms-azure-cs-entitysearch/pom.xml @@ -5,14 +5,14 @@ --> 4.0.0 - - com.microsoft.azure.cognitiveservices - azure-cognitiveservices-parent - 1.0.2 - ../pom.xml - + + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml + azure-cognitiveservices-entitysearch - 1.0.2 + 1.1.0-preview.1 jar Microsoft Azure SDK for Cognitive Service Entity Search This package contains Microsoft Cognitive Service Entity Search SDK. diff --git a/sdk/cognitiveservices/ms-azure-cs-faceapi/pom.xml b/sdk/cognitiveservices/ms-azure-cs-faceapi/pom.xml index 75833fdba581..4064f6224aab 100644 --- a/sdk/cognitiveservices/ms-azure-cs-faceapi/pom.xml +++ b/sdk/cognitiveservices/ms-azure-cs-faceapi/pom.xml @@ -5,14 +5,14 @@ --> 4.0.0 - - com.microsoft.azure.cognitiveservices - azure-cognitiveservices-parent - 1.0.2 - ../pom.xml - + + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml + azure-cognitiveservices-faceapi - 1.0.2-beta + 1.1.0-preview.1 jar Microsoft Azure SDK for Cognitive Service Face API This package contains Microsoft Cognitive Service Face API SDK. diff --git a/sdk/cognitiveservices/ms-azure-cs-imagesearch/pom.xml b/sdk/cognitiveservices/ms-azure-cs-imagesearch/pom.xml index 629742c83a1d..729d2a4eabed 100644 --- a/sdk/cognitiveservices/ms-azure-cs-imagesearch/pom.xml +++ b/sdk/cognitiveservices/ms-azure-cs-imagesearch/pom.xml @@ -5,14 +5,14 @@ --> 4.0.0 - - com.microsoft.azure.cognitiveservices - azure-cognitiveservices-parent - 1.0.2 - ../pom.xml - + + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml + azure-cognitiveservices-imagesearch - 1.0.2 + 1.1.0-preview.1 jar Microsoft Azure SDK for Cognitive Service Image Search This package contains Microsoft Cognitive Service Image Search SDK. diff --git a/sdk/cognitiveservices/ms-azure-cs-luis-authoring/pom.xml b/sdk/cognitiveservices/ms-azure-cs-luis-authoring/pom.xml index 9989b6af3ece..730128be5010 100644 --- a/sdk/cognitiveservices/ms-azure-cs-luis-authoring/pom.xml +++ b/sdk/cognitiveservices/ms-azure-cs-luis-authoring/pom.xml @@ -6,13 +6,13 @@ 4.0.0 - com.microsoft.azure.cognitiveservices - azure-cognitiveservices-parent - 1.0.2 - ../pom.xml + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml azure-cognitiveservices-luis-authoring - 1.0.2-beta + 1.1.0-preview.1 jar Microsoft Azure SDK for Cognitive Service Language Understanding (LUIS) This package contains Microsoft Cognitive Service Language Understanding (LUIS). diff --git a/sdk/cognitiveservices/ms-azure-cs-luis-runtime/pom.xml b/sdk/cognitiveservices/ms-azure-cs-luis-runtime/pom.xml index 5975fc3328ad..8e1c6232552d 100644 --- a/sdk/cognitiveservices/ms-azure-cs-luis-runtime/pom.xml +++ b/sdk/cognitiveservices/ms-azure-cs-luis-runtime/pom.xml @@ -5,14 +5,14 @@ --> 4.0.0 - - com.microsoft.azure.cognitiveservices - azure-cognitiveservices-parent - 1.0.2 - ../pom.xml - + + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml + azure-cognitiveservices-luis-runtime - 1.0.2-beta + 1.1.0-preview.1 jar Microsoft Azure SDK for Cognitive Service Language Understanding (LUIS) Runtime This package contains Microsoft Cognitive Service Language Understanding (LUIS) Runtime. diff --git a/sdk/cognitiveservices/ms-azure-cs-newssearch/pom.xml b/sdk/cognitiveservices/ms-azure-cs-newssearch/pom.xml index e876be271200..c7eab8f3ceb6 100644 --- a/sdk/cognitiveservices/ms-azure-cs-newssearch/pom.xml +++ b/sdk/cognitiveservices/ms-azure-cs-newssearch/pom.xml @@ -5,14 +5,14 @@ --> 4.0.0 - - com.microsoft.azure.cognitiveservices - azure-cognitiveservices-parent - 1.0.2 - ../pom.xml - + + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml + azure-cognitiveservices-newssearch - 1.0.2 + 1.1.0-preview.1 jar Microsoft Azure SDK for Cognitive Service News Search This package contains Microsoft Cognitive Service News Search SDK. diff --git a/sdk/cognitiveservices/ms-azure-cs-spellcheck/pom.xml b/sdk/cognitiveservices/ms-azure-cs-spellcheck/pom.xml index 3d2478a24cae..28db6be3695b 100644 --- a/sdk/cognitiveservices/ms-azure-cs-spellcheck/pom.xml +++ b/sdk/cognitiveservices/ms-azure-cs-spellcheck/pom.xml @@ -6,12 +6,12 @@ 4.0.0 - com.microsoft.azure.cognitiveservices - azure-cognitiveservices-parent - 1.0.2 - ../pom.xml + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml - 1.0.2 + 1.1.0-preview.1 azure-cognitiveservices-spellcheck jar Microsoft Azure SDK for Cognitive Service Spell Check diff --git a/sdk/cognitiveservices/ms-azure-cs-textanalytics/pom.xml b/sdk/cognitiveservices/ms-azure-cs-textanalytics/pom.xml index ed884313899d..df085d3b9bf6 100644 --- a/sdk/cognitiveservices/ms-azure-cs-textanalytics/pom.xml +++ b/sdk/cognitiveservices/ms-azure-cs-textanalytics/pom.xml @@ -7,14 +7,14 @@ --> 4.0.0 - - com.microsoft.azure.cognitiveservices - azure-cognitiveservices-parent - 1.0.2 - ../pom.xml - + + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml + azure-cognitiveservices-textanalytics - 1.0.2-beta + 1.1.0-preview.1 jar Microsoft Azure SDK for Cognitive Service Text Analytics This package contains Microsoft Cognitive Service Text Analytics SDK. diff --git a/sdk/cognitiveservices/ms-azure-cs-videosearch/pom.xml b/sdk/cognitiveservices/ms-azure-cs-videosearch/pom.xml index 665291eabc7f..4300a0427b61 100644 --- a/sdk/cognitiveservices/ms-azure-cs-videosearch/pom.xml +++ b/sdk/cognitiveservices/ms-azure-cs-videosearch/pom.xml @@ -5,14 +5,14 @@ --> 4.0.0 - - com.microsoft.azure.cognitiveservices - azure-cognitiveservices-parent - 1.0.2 - ../pom.xml - + + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml + azure-cognitiveservices-videosearch - 1.0.2 + 1.1.0-preview.1 jar Microsoft Azure SDK for Cognitive Service Video Search This package contains Microsoft Cognitive Service Video Search SDK. diff --git a/sdk/cognitiveservices/ms-azure-cs-visualsearch/pom.xml b/sdk/cognitiveservices/ms-azure-cs-visualsearch/pom.xml index 1ba947143e7a..687fbd1080fd 100644 --- a/sdk/cognitiveservices/ms-azure-cs-visualsearch/pom.xml +++ b/sdk/cognitiveservices/ms-azure-cs-visualsearch/pom.xml @@ -5,14 +5,14 @@ --> 4.0.0 - - com.microsoft.azure.cognitiveservices - azure-cognitiveservices-parent - 1.0.2 - ../pom.xml - + + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml + azure-cognitiveservices-visualsearch - 1.0.2-beta + 1.1.0-preview.1 jar Microsoft Azure SDK for Cognitive Service Visual Search This package contains Microsoft Cognitive Service Visual Search SDK. diff --git a/sdk/cognitiveservices/ms-azure-cs-websearch/pom.xml b/sdk/cognitiveservices/ms-azure-cs-websearch/pom.xml index 1fad4bab508b..c8fd44a03c62 100644 --- a/sdk/cognitiveservices/ms-azure-cs-websearch/pom.xml +++ b/sdk/cognitiveservices/ms-azure-cs-websearch/pom.xml @@ -5,14 +5,14 @@ --> 4.0.0 - - com.microsoft.azure.cognitiveservices - azure-cognitiveservices-parent - 1.0.2 - ../pom.xml - + + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml + azure-cognitiveservices-websearch - 1.0.2 + 1.1.0-preview.1 jar Microsoft Azure SDK for Cognitive Service Web Search This package contains Microsoft Cognitive Service Web Search SDK. diff --git a/sdk/cognitiveservices/pom.xml b/sdk/cognitiveservices/pom.xml deleted file mode 100644 index b563ba399f47..000000000000 --- a/sdk/cognitiveservices/pom.xml +++ /dev/null @@ -1,318 +0,0 @@ - - - 4.0.0 - com.microsoft.azure.cognitiveservices - azure-cognitiveservices-parent - 1.0.2 - pom - - Microsoft Azure Cognitive Services SDK Parent - This package contains the parent module of Microsoft Azure Cognitive Services SDK. - https://github.com/Azure/azure-sdk-for-java - - - - The MIT License (MIT) - http://opensource.org/licenses/MIT - repo - - - - - scm:git:https://github.com/Azure/azure-sdk-for-java - scm:git:git@github.com:Azure/azure-sdk-for-java.git - HEAD - - - - UTF-8 - - playback - 11080 - 0.9.8 - 1.4.0 - 1.4.0 - 2.4 - 1.10 - 2.9.9 - 0.5.1 - 24.1.1-jre - 1.2.4 - 4.12 - - - - - microsoft - Microsoft - - - - - - ossrh - Sonatype Snapshots - https://oss.sonatype.org/content/repositories/snapshots/ - true - default - - - - - - - com.microsoft.azure - azure-client-runtime - ${azure.runtime.version} - - - - org.slf4j - slf4j-api - 1.7.22 - - - commons-codec - commons-codec - ${commons.codec.version} - - - io.reactivex - rxjava - ${rxjava.version} - - - com.microsoft.azure - azure-client-authentication - ${azure.runtime.version} - - - com.google.guava - guava - ${guava.version} - - - com.microsoft.azure - azure-core - ${azure.core.version} - - - com.microsoft.azure - adal4j - 1.2.0 - - - org.apache.httpcomponents - httpclient - 4.3.6 - - - javax.xml.bind - jaxb-api - 2.2.7 - provided - - - javax.mail - mail - 1.4.5 - - - javax.inject - javax.inject - 1 - - - com.sun.jersey - jersey-client - 1.19 - - - com.sun.jersey - jersey-json - 1.19 - - - commons-logging - commons-logging - 1.1.1 - - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - - - com.fasterxml.jackson.core - jackson-annotations - ${jackson.version} - - - com.fasterxml.jackson.core - jackson-core - ${jackson.version} - - - io.jsonwebtoken - jjwt - ${jjwt.version} - - - - - junit - junit - ${junit.version} - test - - - - - - - org.eclipse.jetty - jetty-maven-plugin - 9.2.22.v20170606 - - 0 - 11079 - STOP - - ${playbackServerPort} - - - - - org.codehaus.mojo - properties-maven-plugin - 1.0.0 - - - generate-resources - - write-project-properties - - - - ${project.build.outputDirectory}/maven.properties - - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - 2.17 - - - com.microsoft.azure - autorest-build-tools - ${azure.runtime.version} - - - com.puppycrawl.tools - checkstyle - 8.18 - - - - checkstyle.xml - samedir=runtimes/build-tools/src/main/resources - suppressions.xml - true - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 1.7 - 1.7 - true - true - -Xlint:unchecked - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.8 - - *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.storage - /** -
* Copyright (c) Microsoft Corporation. All rights reserved. -
* Licensed under the MIT License. See License.txt in the project root for -
* license information. -
*/]]>
-
-
- - - org.apache.maven.plugins - maven-release-plugin - 2.5.3 - -
- - - - org.apache.maven.plugins - maven-resources-plugin - 2.4.3 - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.20 - - false - - **/Test*.java - **/*Test.java - **/*Tests.java - **/*TestCase.java - - - ${testMode} - - - - - - org.apache.maven.plugins - maven-release-plugin - 2.5.2 - - - -
- - ms-azure-cs-spellcheck - ms-azure-cs-luis-authoring - ms-azure-cs-luis-runtime - ms-azure-cs-textanalytics - ms-azure-cs-autosuggest - ms-azure-cs-customimagesearch - ms-azure-cs-customsearch - ms-azure-cs-entitysearch - ms-azure-cs-imagesearch - ms-azure-cs-newssearch - ms-azure-cs-videosearch - ms-azure-cs-visualsearch - ms-azure-cs-websearch - ms-azure-cs-computervision - ms-azure-cs-contentmoderator - ms-azure-cs-customvision-prediction - ms-azure-cs-customvision-training - ms-azure-cs-faceapi - -
\ No newline at end of file diff --git a/sdk/core/README.md b/sdk/core/README.md index ec88ce9e1a07..bfea4dfc3f68 100644 --- a/sdk/core/README.md +++ b/sdk/core/README.md @@ -2,7 +2,7 @@ [![Build Documentation](https://img.shields.io/badge/documentation-published-blue.svg)](https://azure.github.io/azure-sdk-for-java/track2reports/index.html) -Azure Core provides shared primitives, abstractions, and helpers for modern Java Azure SDK client libraries. These libraries follow the [Azure SDK Design Guidelines for JavaT](https://azuresdkspecs.z5.web.core.windows.net/JavaSpec.html) and can be easily identified by package names starting with `com.azure` and module names starting with `azure-`, e.g. `com.azure.storage.blobs` would be found within the `/sdk/storage/azure-storage-blob` directory. A more complete list of client libraries using Azure Core can be found [here](https://github.com/Azure/azure-sdk-for-java). +Azure Core provides shared primitives, abstractions, and helpers for modern Java Azure SDK client libraries. These libraries follow the [Azure SDK Design Guidelines for Java](https://azuresdkspecs.z5.web.core.windows.net/JavaSpec.html) and can be easily identified by package names starting with `com.azure` and module names starting with `azure-`, e.g. `com.azure.storage.blobs` would be found within the `/sdk/storage/azure-storage-blob` directory. A more complete list of client libraries using Azure Core can be found [here](https://github.com/Azure/azure-sdk-for-java). Azure Core allows client libraries to expose common functionality in a consistent fashion, so that once you learn how to use these APIs in one client library, you will know how to use them in other client libraries. @@ -25,3 +25,5 @@ Azure Core is split into a number of sub-components: * [azure-core-test](azure-core-test) provides utilities and API to make writing tests for Azure Core simpler and consistent. For documentation on using Azure Core, refer to the [azure-core readme](azure-core). + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/core/README.png) diff --git a/sdk/core/azure-core-amqp/README.md b/sdk/core/azure-core-amqp/README.md index 38e2442aabd5..d948d741a3f8 100644 --- a/sdk/core/azure-core-amqp/README.md +++ b/sdk/core/azure-core-amqp/README.md @@ -40,3 +40,5 @@ Azure Projects Contribution Guidelines](http://azure.github.io/guidelines.html). 1. Commit your changes (`git commit -am 'Add some feature'`) 1. Push to the branch (`git push origin my-new-feature`) 1. Create new Pull Request + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/core/azure-core-amqp/README.png) diff --git a/sdk/core/azure-core-amqp/pom.xml b/sdk/core/azure-core-amqp/pom.xml index 34afa7dce2db..f59c94d5c32a 100644 --- a/sdk/core/azure-core-amqp/pom.xml +++ b/sdk/core/azure-core-amqp/pom.xml @@ -7,13 +7,13 @@ com.azure azure-client-sdk-parent - 1.3.0 + 1.4.0 ../../../pom.client.xml com.azure azure-core-amqp - 1.0.0-preview.4 + 1.0.0-preview.5 jar Microsoft Azure Java Core AMQP Library @@ -44,6 +44,7 @@ UTF-8 + com.azure.core.amqp @@ -57,7 +58,7 @@ com.azure azure-core - 1.0.0-preview.4 + 1.0.0-preview.5 @@ -76,5 +77,10 @@ slf4j-simple test + + org.mockito + mockito-core + test +
diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/AmqpLink.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/AmqpLink.java index f696cf6f7840..b1387c7adc92 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/AmqpLink.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/AmqpLink.java @@ -22,4 +22,11 @@ public interface AmqpLink extends EndpointStateNotifier, Closeable { * @return The remote endpoint path this link is connected to. */ String getEntityPath(); + + /** + * The host name of the message broker that this link that is connected to. + * + * @return The host name of the message broker that this link that is connected to. + */ + String getHostname(); } diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/AmqpShutdownSignal.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/AmqpShutdownSignal.java index 59107914d55a..a105e8416fb2 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/AmqpShutdownSignal.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/AmqpShutdownSignal.java @@ -30,7 +30,7 @@ public AmqpShutdownSignal(boolean isTransient, boolean isInitiatedByClient, Stri * Gets whether or not this shutdown signal is transient or if it can be restarted. * * @return {@code true} if the shutdown signal is transient and the connection, session, or link can be recreated. - * {@code false} otherwise. + * {@code false} otherwise. */ public boolean isTransient() { return isTransient; @@ -40,7 +40,7 @@ public boolean isTransient() { * Gets whether or not this shutdown signal was initiated by the client. * * @return {@code true} if the shutdown signal was initiated by the client, {@code false} if the shutdown signal - * occurred in the underlying AMQP layer or from the AMQP message broker. + * occurred in the underlying AMQP layer or from the AMQP message broker. */ public boolean isInitiatedByClient() { return isInitiatedByClient; @@ -51,6 +51,7 @@ public boolean isInitiatedByClient() { */ @Override public String toString() { - return String.format(Locale.US, "%s, isTransient[%s], initiatedByClient[%s]", message, isTransient, isInitiatedByClient); + return String.format(Locale.US, "%s, isTransient[%s], initiatedByClient[%s]", message, isTransient, + isInitiatedByClient); } } diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/ExponentialRetryPolicy.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/ExponentialRetryPolicy.java index bfbdcfabed5b..d87d826e6fe9 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/ExponentialRetryPolicy.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/ExponentialRetryPolicy.java @@ -79,9 +79,9 @@ public RetryPolicy clone() { private double computeRetryFactor() { final RetryOptions options = getRetryOptions(); - final Duration maxBackoff = options.maxDelay(); - final Duration minBackoff = options.delay(); - final int maximumRetries = options.maxRetries(); + final Duration maxBackoff = options.getMaxDelay(); + final Duration minBackoff = options.getDelay(); + final int maximumRetries = options.getMaxRetries(); final long deltaBackoff = maxBackoff.minus(minBackoff).getSeconds(); if (deltaBackoff <= 0 || maximumRetries <= 0) { diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/FixedRetryPolicy.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/FixedRetryPolicy.java index 56e84b7ea43d..844c53c845fb 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/FixedRetryPolicy.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/FixedRetryPolicy.java @@ -23,14 +23,15 @@ public FixedRetryPolicy(RetryOptions retryOptions) { * Calculates the delay for a fixed backoff. * * @param retryCount The number of attempts that have been made, including the initial attempt before any - * retries. + * retries. * @param baseDelay The delay to use for the fixed backoff. * @param baseJitter The duration to use for the basis of the random jitter value. * @param random The random number generator used to calculate the jitter. * @return The duration to delay before retrying a request. */ @Override - protected Duration calculateRetryDelay(int retryCount, Duration baseDelay, Duration baseJitter, ThreadLocalRandom random) { + protected Duration calculateRetryDelay(int retryCount, Duration baseDelay, Duration baseJitter, + ThreadLocalRandom random) { final Double jitterNanos = random.nextDouble() * baseJitter.getSeconds() * RetryPolicy.NANOS_PER_SECOND; final Duration jitter = Duration.ofNanos(jitterNanos.longValue()); diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/RetryOptions.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/RetryOptions.java index 58a426ecc3e5..3a574e8c00eb 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/RetryOptions.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/RetryOptions.java @@ -33,7 +33,7 @@ public RetryOptions() { * @param retryMode The retry approach to use for calculating delays. * @return The updated {@link RetryOptions} object. */ - public RetryOptions retryMode(RetryMode retryMode) { + public RetryOptions setRetryMode(RetryMode retryMode) { this.retryMode = retryMode; return this; } @@ -44,7 +44,7 @@ public RetryOptions retryMode(RetryMode retryMode) { * @param numberOfRetries The maximum number of retry attempts. * @return The updated {@link RetryOptions} object. */ - public RetryOptions maxRetries(int numberOfRetries) { + public RetryOptions setMaxRetries(int numberOfRetries) { this.maxRetries = numberOfRetries; return this; } @@ -56,7 +56,7 @@ public RetryOptions maxRetries(int numberOfRetries) { * @param delay The delay between retry attempts. * @return The updated {@link RetryOptions} object. */ - public RetryOptions delay(Duration delay) { + public RetryOptions setDelay(Duration delay) { this.delay = delay; return this; } @@ -67,7 +67,7 @@ public RetryOptions delay(Duration delay) { * @param maximumDelay The maximum permissible delay between retry attempts. * @return The updated {@link RetryOptions} object. */ - public RetryOptions maxDelay(Duration maximumDelay) { + public RetryOptions setMaxDelay(Duration maximumDelay) { this.maxDelay = maximumDelay; return this; } @@ -78,7 +78,7 @@ public RetryOptions maxDelay(Duration maximumDelay) { * @param tryTimeout The maximum duration to wait for completion. * @return The updated {@link RetryOptions} object. */ - public RetryOptions tryTimeout(Duration tryTimeout) { + public RetryOptions setTryTimeout(Duration tryTimeout) { this.tryTimeout = tryTimeout; return this; } @@ -88,7 +88,7 @@ public RetryOptions tryTimeout(Duration tryTimeout) { * * @return The approach to use for calculating retry delays. */ - public RetryMode retryMode() { + public RetryMode getRetryMode() { return retryMode; } @@ -97,7 +97,7 @@ public RetryMode retryMode() { * * @return The maximum number of retry attempts before considering the associated operation to have failed. */ - public int maxRetries() { + public int getMaxRetries() { return maxRetries; } @@ -107,7 +107,7 @@ public int maxRetries() { * * @return The delay between retry attempts. */ - public Duration delay() { + public Duration getDelay() { return delay; } @@ -116,7 +116,7 @@ public Duration delay() { * * @return The maximum permissible delay between retry attempts. */ - public Duration maxDelay() { + public Duration getMaxDelay() { return maxDelay; } @@ -125,7 +125,7 @@ public Duration maxDelay() { * * @return The maximum duration to wait for completion of a single attempt, whether the initial attempt or a retry. */ - public Duration tryTimeout() { + public Duration getTryTimeout() { return tryTimeout; } @@ -144,11 +144,11 @@ public RetryOptions clone() { clone = new RetryOptions(); } - return clone.delay(delay) - .maxDelay(maxDelay) - .maxRetries(maxRetries) - .tryTimeout(tryTimeout) - .retryMode(retryMode); + return clone.setDelay(delay) + .setMaxDelay(maxDelay) + .setMaxRetries(maxRetries) + .setTryTimeout(tryTimeout) + .setRetryMode(retryMode); } /** @@ -166,11 +166,11 @@ public boolean equals(Object obj) { final RetryOptions other = (RetryOptions) obj; - return this.maxRetries() == other.maxRetries() - && this.retryMode() == other.retryMode() - && Objects.equals(this.maxDelay(), other.maxDelay()) - && Objects.equals(this.delay(), other.delay()) - && Objects.equals(this.tryTimeout(), other.tryTimeout()); + return this.getMaxRetries() == other.getMaxRetries() + && this.getRetryMode() == other.getRetryMode() + && Objects.equals(this.getMaxDelay(), other.getMaxDelay()) + && Objects.equals(this.getDelay(), other.getDelay()) + && Objects.equals(this.getTryTimeout(), other.getTryTimeout()); } /** diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/RetryPolicy.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/RetryPolicy.java index 5424f705ff1f..5097acf8beb2 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/RetryPolicy.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/RetryPolicy.java @@ -26,9 +26,9 @@ public abstract class RetryPolicy implements Cloneable { private final Duration baseJitter; /** - * Creates an instance with the given retry options. If {@link RetryOptions#maxDelay()}, {@link - * RetryOptions#delay()}, or {@link RetryOptions#maxRetries()} is equal to {@link Duration#ZERO} or zero, requests - * failing with a retriable exception will not be retried. + * Creates an instance with the given retry options. If {@link RetryOptions#getMaxDelay()}, {@link + * RetryOptions#getDelay()}, or {@link RetryOptions#getMaxRetries()} is equal to {@link Duration#ZERO} or zero, + * requests failing with a retriable exception will not be retried. * * @param retryOptions The options to set on this retry policy. * @throws NullPointerException if {@code retryOptions} is {@code null}. @@ -39,8 +39,8 @@ protected RetryPolicy(RetryOptions retryOptions) { this.retryOptions = retryOptions; // 1 second = 1.0 * 10^9 nanoseconds. - final Double jitterInNanos = retryOptions.delay().getSeconds() * JITTER_FACTOR * NANOS_PER_SECOND; - baseJitter = Duration.ofNanos(jitterInNanos.longValue()); + final double jitterInNanos = retryOptions.getDelay().getSeconds() * JITTER_FACTOR * NANOS_PER_SECOND; + baseJitter = Duration.ofNanos((long) jitterInNanos); } /** @@ -58,32 +58,31 @@ protected RetryOptions getRetryOptions() { * @return The maximum number of retry attempts. */ public int getMaxRetries() { - return retryOptions.maxRetries(); + return retryOptions.getMaxRetries(); } /** * Calculates the amount of time to delay before the next retry attempt. * * @param lastException The last exception that was observed for the operation to be retried. - * @param retryCount The number of attempts that have been made, including the initial attempt before any - * retries. + * @param retryCount The number of attempts that have been made, including the initial attempt before any retries. * @return The amount of time to delay before retrying the associated operation; if {@code null}, then the operation - * is no longer eligible to be retried. + * is no longer eligible to be retried. */ public Duration calculateRetryDelay(Exception lastException, int retryCount) { - if (retryOptions.delay() == Duration.ZERO - || retryOptions.maxDelay() == Duration.ZERO - || retryCount > retryOptions.maxRetries()) { + if (retryOptions.getDelay() == Duration.ZERO + || retryOptions.getMaxDelay() == Duration.ZERO + || retryCount > retryOptions.getMaxRetries()) { return null; } final Duration baseDelay; if (lastException instanceof AmqpException && isRetriableException(lastException)) { baseDelay = ((AmqpException) lastException).getErrorCondition() == SERVER_BUSY_ERROR - ? retryOptions.delay().plus(SERVER_BUSY_WAIT_TIME) - : retryOptions.delay(); + ? retryOptions.getDelay().plus(SERVER_BUSY_WAIT_TIME) + : retryOptions.getDelay(); } else if (lastException instanceof TimeoutException) { - baseDelay = retryOptions.delay(); + baseDelay = retryOptions.getDelay(); } else { baseDelay = null; } @@ -95,26 +94,24 @@ public Duration calculateRetryDelay(Exception lastException, int retryCount) { final Duration delay = calculateRetryDelay(retryCount, baseDelay, baseJitter, ThreadLocalRandom.current()); // If delay is smaller or equal to the maximum delay, return the maximum delay. - return delay.compareTo(retryOptions.maxDelay()) <= 0 + return delay.compareTo(retryOptions.getMaxDelay()) <= 0 ? delay - : retryOptions.maxDelay(); + : retryOptions.getMaxDelay(); } /** - * Calculates the amount of time to delay before the next retry attempt based on the {@code retryCound}, {@code - * baseDelay}, and {@code baseJitter}. + * Calculates the amount of time to delay before the next retry attempt based on the {@code retryCount}, + * {@code baseDelay}, and {@code baseJitter}. * - * @param retryCount The number of attempts that have been made, including the initial attempt before any - * retries. + * @param retryCount The number of attempts that have been made, including the initial attempt before any retries. * @param baseDelay The base delay for a retry attempt. * @param baseJitter The base jitter delay. - * @param random The random number generator. Can be utilised to calculate a random jitter value for the - * retry. + * @param random The random number generator. Can be utilised to calculate a random jitter value for the retry. * @return The amount of time to delay before retrying to associated operation; or {@code null} if the it cannot be - * retried. + * retried. */ protected abstract Duration calculateRetryDelay(int retryCount, Duration baseDelay, Duration baseJitter, - ThreadLocalRandom random); + ThreadLocalRandom random); /** * Creates a clone of the retry policy. diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpException.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpException.java index 57c96388c9b9..a8a0d0167642 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpException.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpException.java @@ -12,7 +12,8 @@ * General exception for AMQP related failures. * * @see ErrorCondition - * @see Azure Messaging Exceptions + * @see Azure Messaging + * Exceptions */ public class AmqpException extends AzureException { private static final long serialVersionUID = -3654294093967132325L; @@ -24,8 +25,8 @@ public class AmqpException extends AzureException { /** * Initializes a new instance of the AmqpException class. * - * @param isTransient A boolean indicating if the exception is a transient error or not. If true, then the request - * can be retried; otherwise not. + * @param isTransient A boolean indicating if the exception is a transient error or not. If true, then the + * request can be retried; otherwise not. * @param message Text containing any supplementary details of the exception. * @param errorContext The context that caused this AMQP error. */ @@ -36,14 +37,15 @@ public AmqpException(boolean isTransient, String message, ErrorContext errorCont /** * Initializes a new instance of the AmqpException class. * - * @param isTransient A boolean indicating if the exception is a transient error or not. If true, then the request - * can be retried; otherwise not. + * @param isTransient A boolean indicating if the exception is a transient error or not. If true, then the + * request can be retried; otherwise not. * @param errorCondition The symbolic value indicating the error condition. * @param message Text containing any supplementary details not indicated by the condition field. This text can - * be logged as an aid to resolving issues. + * be logged as an aid to resolving issues. * @param errorContext The context that caused this AMQP error. */ - public AmqpException(boolean isTransient, ErrorCondition errorCondition, String message, ErrorContext errorContext) { + public AmqpException(boolean isTransient, ErrorCondition errorCondition, String message, + ErrorContext errorContext) { super(message); this.errorCondition = errorCondition; this.isTransient = isTransient; @@ -53,11 +55,11 @@ public AmqpException(boolean isTransient, ErrorCondition errorCondition, String /** * Initializes a new instance of the AmqpException class. * - * @param isTransient A boolean indicating if the exception is a transient error or not. If true, then the request - * can be retried; otherwise not. + * @param isTransient A boolean indicating if the exception is a transient error or not. If true, then the + * request can be retried; otherwise not. * @param errorCondition The symbolic value indicating the error condition. * @param message Text containing any supplementary details not indicated by the condition field. This text can - * be logged as an aid to resolving issues. + * be logged as an aid to resolving issues. * @param cause The Throwable which caused the creation of this AmqpException. * @param errorContext The context that caused this AMQP error. */ @@ -72,13 +74,14 @@ public AmqpException(boolean isTransient, ErrorCondition errorCondition, String /** * Initializes a new instance of the AmqpException class. * - * @param isTransient A boolean indicating if the exception is a transient error or not. If true, then the request - * can be retried; otherwise not. + * @param isTransient A boolean indicating if the exception is a transient error or not. If true, then the + * request can be retried; otherwise not. * @param errorCondition The symbolic value indicating the error condition. * @param cause The Throwable which caused the creation of this AmqpException. * @param errorContext The context that caused this AMQP error. */ - public AmqpException(boolean isTransient, ErrorCondition errorCondition, Throwable cause, ErrorContext errorContext) { + public AmqpException(boolean isTransient, ErrorCondition errorCondition, Throwable cause, + ErrorContext errorContext) { super(cause.getMessage(), cause); this.errorCondition = errorCondition; this.isTransient = isTransient; @@ -88,10 +91,10 @@ public AmqpException(boolean isTransient, ErrorCondition errorCondition, Throwab /** * Initializes a new instance of the AmqpException class. * - * @param isTransient A boolean indicating if the exception is a transient error or not. If true, then the request - * can be retried; otherwise not. + * @param isTransient A boolean indicating if the exception is a transient error or not. If true, then the + * request can be retried; otherwise not. * @param message Text containing any supplementary details not indicated by the condition field. This text can - * be logged as an aid to resolving issues. + * be logged as an aid to resolving issues. * @param cause The Throwable which caused the creation of this AmqpException. * @param errorContext The context that caused this AMQP error. */ @@ -118,7 +121,8 @@ public String getMessage() { /** * A boolean indicating if the exception is a transient error or not. * - * @return returns true when user can retry the operation that generated the exception without additional intervention. + * @return returns true when user can retry the operation that generated the exception without additional + * intervention. */ public boolean isTransient() { return this.isTransient; diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/ErrorCondition.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/ErrorCondition.java index 294f0ee0a47e..104ef47879a4 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/ErrorCondition.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/ErrorCondition.java @@ -11,8 +11,9 @@ * Contains constants common to the AMQP protocol and constants shared by Azure services. * * @see AMQP - * 1.0: Transport Errors - * @see Azure Messaging Exceptions + * 1.0: Transport Errors + * @see Azure Messaging + * Exceptions */ public enum ErrorCondition { /** diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/ExceptionUtil.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/ExceptionUtil.java index 4033340f1185..b43e6a034593 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/ExceptionUtil.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/ExceptionUtil.java @@ -12,7 +12,8 @@ */ public final class ExceptionUtil { private static final String AMQP_REQUEST_FAILED_ERROR = "status-code: %s, status-description: %s"; - private static final Pattern ENTITY_NOT_FOUND_PATTERN = Pattern.compile("The messaging entity .* could not be found"); + private static final Pattern ENTITY_NOT_FOUND_PATTERN = + Pattern.compile("The messaging entity .* could not be found"); /** * Creates an {@link AmqpException} or Exception based on the {@code errorCondition} from the AMQP request. @@ -22,7 +23,7 @@ public final class ExceptionUtil { * @param errorContext The context that this error occurred in. * @return An exception that maps to the {@code errorCondition} provided. * @throws IllegalArgumentException when 'errorCondition' is {@code null} or empty, cannot be translated into an - * {@link ErrorCondition}, or cannot be determined whether the {@link ErrorCondition} is transient or not. + * {@link ErrorCondition}, or cannot be determined whether the {@link ErrorCondition} is transient or not. * @see ErrorCondition */ public static Exception toException(String errorCondition, String description, ErrorContext errorContext) { @@ -33,7 +34,8 @@ public static Exception toException(String errorCondition, String description, E final ErrorCondition condition = ErrorCondition.fromString(errorCondition); if (condition == null) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "'%s' is not a known ErrorCondition.", errorCondition)); + throw new IllegalArgumentException(String.format(Locale.ROOT, "'%s' is not a known ErrorCondition.", + errorCondition)); } boolean isTransient; @@ -62,7 +64,8 @@ public static Exception toException(String errorCondition, String description, E case NOT_FOUND: return distinguishNotFound(description, errorContext); default: - throw new IllegalArgumentException(String.format(Locale.ROOT, "This condition '%s' is not known.", condition)); + throw new IllegalArgumentException(String.format(Locale.ROOT, "This condition '%s' is not known.", + condition)); } return new AmqpException(isTransient, condition, description, errorContext); diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/RetryUtil.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/RetryUtil.java index bbf800bcf402..0f7f9a85a322 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/RetryUtil.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/RetryUtil.java @@ -28,17 +28,17 @@ private RetryUtil() { * * @param options A set of options used to configure the retry policy. * @return A new retry policy configured with the given {@code options}. - * @throws IllegalArgumentException If {@link RetryOptions#retryMode()} is not a supported mode. + * @throws IllegalArgumentException If {@link RetryOptions#getRetryMode()} is not a supported mode. */ public static RetryPolicy getRetryPolicy(RetryOptions options) { - switch (options.retryMode()) { + switch (options.getRetryMode()) { case FIXED: return new FixedRetryPolicy(options); case EXPONENTIAL: return new ExponentialRetryPolicy(options); default: throw new IllegalArgumentException( - String.format(Locale.ROOT, "Mode is not supported: %s", options.retryMode())); + String.format(Locale.ROOT, "Mode is not supported: %s", options.getRetryMode())); } } diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/TracerProvider.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/TracerProvider.java new file mode 100644 index 000000000000..a3442e06f384 --- /dev/null +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/TracerProvider.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.core.amqp.implementation; + +import com.azure.core.amqp.exception.AmqpException; +import com.azure.core.implementation.tracing.ProcessKind; +import com.azure.core.implementation.tracing.Tracer; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import reactor.core.publisher.Signal; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +import static com.azure.core.implementation.tracing.Tracer.OPENTELEMETRY_SPAN_KEY; + +public class TracerProvider { + private final ClientLogger logger = new ClientLogger(TracerProvider.class); + private final List tracers = new ArrayList<>(); + + public TracerProvider(Iterable tracers) { + Objects.requireNonNull(tracers, "'tracers' cannot be null."); + tracers.forEach(e -> this.tracers.add(e)); + } + + public boolean isEnabled() { + return tracers.size() > 0; + } + + /** + * For each tracer plugged into the SDK a new tracing span is created. + * + * 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. + * + * @param context Additional metadata that is passed through the call stack. + * @param processKind the invoking process type. + * @return An updated context object. + */ + public Context startSpan(Context context, ProcessKind processKind) { + Context local = Objects.requireNonNull(context, "'context' cannot be null"); + Objects.requireNonNull(processKind, "'processKind' cannot be null"); + String spanName = getSpanName(processKind); + + for (Tracer tracer : tracers) { + local = tracer.start(spanName, local, processKind); + } + + return local; + } + + /** + * Given a context containing the current tracing span the span is marked completed with status info from + * {@link Signal}. For each tracer plugged into the SDK the current tracing span is marked as completed. + * + * @param context Additional metadata that is passed through the call stack. + * @param signal The signal indicates the status and contains the metadata we need to end the tracing span. + */ + public void endSpan(Context context, Signal signal) { + Objects.requireNonNull(context, "'context' cannot be null"); + Objects.requireNonNull(signal, "'signal' cannot be null"); + + // Get the context that was added to the mono, this will contain the information needed to end the span. + if (!context.getData(OPENTELEMETRY_SPAN_KEY).isPresent()) { + return; + } + + switch (signal.getType()) { + case ON_COMPLETE: + end("success", null, context); + break; + case ON_ERROR: + String errorCondition = ""; + Throwable throwable = null; + if (signal.hasError()) { + // The last status available is on error, this contains the thrown error. + throwable = signal.getThrowable(); + + if (throwable instanceof AmqpException) { + AmqpException exception = (AmqpException) throwable; + errorCondition = exception.getErrorCondition().getErrorCondition(); + } + } + end(errorCondition, throwable, context); + break; + default: + // ON_SUBSCRIBE and ON_NEXT don't have the information to end the span so just return. + break; + } + } + + /** + * For each tracer plugged into the SDK a link is created between the parent tracing span and + * the current service call. + * + * @param context Additional metadata that is passed through the call stack. + */ + public void addSpanLinks(Context context) { + Objects.requireNonNull(context, "'context' cannot be null"); + tracers.forEach(tracer -> tracer.addLink(context)); + } + + /** + * For each tracer plugged into the SDK a new context is extracted from the event's diagnostic Id. + * + * @param diagnosticId Unique identifier of an external call from producer to the queue. + */ + public Context extractContext(String diagnosticId, Context context) { + Context local = Objects.requireNonNull(context, "'context' cannot be null"); + Objects.requireNonNull(diagnosticId, "'diagnosticId' cannot be null"); + for (Tracer tracer : tracers) { + local = tracer.extractContext(diagnosticId, local); + } + return local; + } + + private void end(String statusMessage, Throwable throwable, Context context) { + for (Tracer tracer : tracers) { + tracer.end(statusMessage, throwable, context); + } + } + + private String getSpanName(ProcessKind processKind) { + String spanName = "Azure.eventhubs."; + switch (processKind) { + case SEND: + spanName += "send"; + break; + case RECEIVE: + spanName += "message"; + break; + case PROCESS: + spanName += "process"; + break; + default: + logger.warning("Unknown processKind type: {}", processKind); + break; + } + + return spanName; + } +} diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/ExponentialRetryPolicyTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/ExponentialRetryPolicyTest.java index fa6049ad6e28..b396530b8836 100644 --- a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/ExponentialRetryPolicyTest.java +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/ExponentialRetryPolicyTest.java @@ -19,10 +19,10 @@ public class ExponentialRetryPolicyTest { private final Duration tolerance = Duration.ofSeconds(1); private final int retryAttempts = 5; private final RetryOptions options = new RetryOptions() - .delay(minBackoff) - .maxDelay(maxBackoff) - .maxRetries(retryAttempts) - .retryMode(RetryMode.EXPONENTIAL); + .setDelay(minBackoff) + .setMaxDelay(maxBackoff) + .setMaxRetries(retryAttempts) + .setRetryMode(RetryMode.EXPONENTIAL); /** * Verifies that when the service is busy and we retry an exception multiple times, the retry duration gets longer. @@ -73,10 +73,10 @@ public void isEquals() { final ExponentialRetryPolicy policy = new ExponentialRetryPolicy(options); final RetryOptions otherOptions = new RetryOptions() - .delay(minBackoff) - .maxDelay(maxBackoff) - .maxRetries(retryAttempts) - .retryMode(RetryMode.EXPONENTIAL); + .setDelay(minBackoff) + .setMaxDelay(maxBackoff) + .setMaxRetries(retryAttempts) + .setRetryMode(RetryMode.EXPONENTIAL); final ExponentialRetryPolicy otherPolicy = new ExponentialRetryPolicy(otherOptions); // Assert diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/FixedRetryPolicyTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/FixedRetryPolicyTest.java index 1ed9c257ed08..b26bd26777b0 100644 --- a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/FixedRetryPolicyTest.java +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/FixedRetryPolicyTest.java @@ -19,10 +19,10 @@ public class FixedRetryPolicyTest { private final Duration tolerance = Duration.ofSeconds(1); private final int retryAttempts = 5; private final RetryOptions options = new RetryOptions() - .delay(minBackoff) - .maxDelay(maxBackoff) - .maxRetries(retryAttempts) - .retryMode(RetryMode.FIXED); + .setDelay(minBackoff) + .setMaxDelay(maxBackoff) + .setMaxRetries(retryAttempts) + .setRetryMode(RetryMode.FIXED); /** * Verifies that when the service is busy and we retry an exception multiple times, the retry duration gets longer. @@ -79,10 +79,10 @@ public void isEquals() { final FixedRetryPolicy policy = new FixedRetryPolicy(options); final RetryOptions otherOptions = new RetryOptions() - .delay(minBackoff) - .maxDelay(maxBackoff) - .maxRetries(retryAttempts) - .retryMode(RetryMode.FIXED); + .setDelay(minBackoff) + .setMaxDelay(maxBackoff) + .setMaxRetries(retryAttempts) + .setRetryMode(RetryMode.FIXED); final FixedRetryPolicy otherPolicy = new FixedRetryPolicy(otherOptions); // Assert diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/RetryOptionsTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/RetryOptionsTest.java index e2af9cd90239..09ce7ee0301c 100644 --- a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/RetryOptionsTest.java +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/RetryOptionsTest.java @@ -22,10 +22,10 @@ public void constructor() { final RetryOptions options = new RetryOptions(); // Assert - Assert.assertEquals(maxRetries, options.maxRetries()); - Assert.assertEquals(RetryMode.EXPONENTIAL, options.retryMode()); - Assert.assertEquals(defaultTimeout, options.maxDelay()); - Assert.assertEquals(defaultTimeout, options.tryTimeout()); + Assert.assertEquals(maxRetries, options.getMaxRetries()); + Assert.assertEquals(RetryMode.EXPONENTIAL, options.getRetryMode()); + Assert.assertEquals(defaultTimeout, options.getMaxDelay()); + Assert.assertEquals(defaultTimeout, options.getTryTimeout()); } /** @@ -42,18 +42,18 @@ public void canSetProperties() { final RetryOptions options = new RetryOptions(); // Act - final RetryOptions actual = options.retryMode(retryMode) - .maxDelay(maxDelay) - .delay(delay) - .maxRetries(retries) - .tryTimeout(tryTimeout); + final RetryOptions actual = options.setRetryMode(retryMode) + .setMaxDelay(maxDelay) + .setDelay(delay) + .setMaxRetries(retries) + .setTryTimeout(tryTimeout); // Assert - Assert.assertEquals(delay, actual.delay()); - Assert.assertEquals(maxDelay, actual.maxDelay()); - Assert.assertEquals(tryTimeout, actual.tryTimeout()); - Assert.assertEquals(retries, actual.maxRetries()); - Assert.assertEquals(retryMode, actual.retryMode()); + Assert.assertEquals(delay, actual.getDelay()); + Assert.assertEquals(maxDelay, actual.getMaxDelay()); + Assert.assertEquals(tryTimeout, actual.getTryTimeout()); + Assert.assertEquals(retries, actual.getMaxRetries()); + Assert.assertEquals(retryMode, actual.getRetryMode()); } /** @@ -74,11 +74,11 @@ public void canClone() { final int newRetries = 5; final RetryMode newRetryMode = RetryMode.EXPONENTIAL; - final RetryOptions original = new RetryOptions().retryMode(retryMode) - .maxDelay(maxDelay) - .delay(delay) - .maxRetries(retries) - .tryTimeout(tryTimeout); + final RetryOptions original = new RetryOptions().setRetryMode(retryMode) + .setMaxDelay(maxDelay) + .setDelay(delay) + .setMaxRetries(retries) + .setTryTimeout(tryTimeout); // Act final RetryOptions clone = original.clone(); @@ -86,43 +86,43 @@ public void canClone() { Assert.assertEquals(original, clone); final RetryOptions actual = clone - .retryMode(newRetryMode) - .maxDelay(newMaxDelay) - .delay(newDelay) - .maxRetries(newRetries) - .tryTimeout(newTryTimeout); + .setRetryMode(newRetryMode) + .setMaxDelay(newMaxDelay) + .setDelay(newDelay) + .setMaxRetries(newRetries) + .setTryTimeout(newTryTimeout); // Assert Assert.assertNotSame(original, actual); - Assert.assertEquals(delay, original.delay()); - Assert.assertEquals(maxDelay, original.maxDelay()); - Assert.assertEquals(tryTimeout, original.tryTimeout()); - Assert.assertEquals(retries, original.maxRetries()); - Assert.assertEquals(retryMode, original.retryMode()); - - Assert.assertEquals(newDelay, actual.delay()); - Assert.assertEquals(newMaxDelay, actual.maxDelay()); - Assert.assertEquals(newTryTimeout, actual.tryTimeout()); - Assert.assertEquals(newRetries, actual.maxRetries()); - Assert.assertEquals(newRetryMode, actual.retryMode()); + Assert.assertEquals(delay, original.getDelay()); + Assert.assertEquals(maxDelay, original.getMaxDelay()); + Assert.assertEquals(tryTimeout, original.getTryTimeout()); + Assert.assertEquals(retries, original.getMaxRetries()); + Assert.assertEquals(retryMode, original.getRetryMode()); + + Assert.assertEquals(newDelay, actual.getDelay()); + Assert.assertEquals(newMaxDelay, actual.getMaxDelay()); + Assert.assertEquals(newTryTimeout, actual.getTryTimeout()); + Assert.assertEquals(newRetries, actual.getMaxRetries()); + Assert.assertEquals(newRetryMode, actual.getRetryMode()); } @Test public void isEqual() { // Arrange final RetryOptions first = new RetryOptions() - .retryMode(RetryMode.FIXED) - .maxDelay(Duration.ofMinutes(10)) - .delay(Duration.ofMillis(1000)) - .maxRetries(10) - .tryTimeout(Duration.ofMinutes(2)); + .setRetryMode(RetryMode.FIXED) + .setMaxDelay(Duration.ofMinutes(10)) + .setDelay(Duration.ofMillis(1000)) + .setMaxRetries(10) + .setTryTimeout(Duration.ofMinutes(2)); final RetryOptions second = new RetryOptions() - .retryMode(RetryMode.FIXED) - .maxDelay(Duration.ofMinutes(10)) - .delay(Duration.ofMillis(1000)) - .maxRetries(10) - .tryTimeout(Duration.ofMinutes(2)); + .setRetryMode(RetryMode.FIXED) + .setMaxDelay(Duration.ofMinutes(10)) + .setDelay(Duration.ofMillis(1000)) + .setMaxRetries(10) + .setTryTimeout(Duration.ofMinutes(2)); Assert.assertEquals(first, second); Assert.assertEquals(first.hashCode(), second.hashCode()); diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/RetryPolicyTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/RetryPolicyTest.java index 420d5c273ad0..59f3bea8297c 100644 --- a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/RetryPolicyTest.java +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/RetryPolicyTest.java @@ -18,9 +18,9 @@ public class RetryPolicyTest { private final Duration maxDelay = Duration.ofSeconds(120); private final Duration delay = Duration.ofSeconds(20); private final RetryOptions options = new RetryOptions() - .maxRetries(maxRetries) - .maxDelay(maxDelay) - .delay(delay); + .setMaxRetries(maxRetries) + .setMaxDelay(maxDelay) + .setDelay(delay); /** * Verifies we retry on a retriable AmqpException. @@ -96,7 +96,7 @@ public void notRetriableExceptionNotTransient() { } /** - * Verifies that we return {@link RetryOptions#maxDelay()} if the returned delay is larger than the maximum. + * Verifies that we return {@link RetryOptions#getMaxDelay()} if the returned delay is larger than the maximum. */ @Test public void returnsMaxDelayIfDelayLarger() { diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/RetryUtilTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/RetryUtilTest.java index 0da0ac848499..d2dfc041637d 100644 --- a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/RetryUtilTest.java +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/RetryUtilTest.java @@ -24,7 +24,7 @@ public class RetryUtilTest { public void getCorrectModeFixed() { // Act final RetryOptions retryOptions = new RetryOptions() - .retryMode(RetryMode.FIXED); + .setRetryMode(RetryMode.FIXED); final RetryPolicy retryPolicy = RetryUtil.getRetryPolicy(retryOptions); // Assert @@ -36,7 +36,7 @@ public void getCorrectModeFixed() { public void getCorrectModeExponential() { // Act final RetryOptions retryOptions = new RetryOptions() - .retryMode(RetryMode.EXPONENTIAL); + .setRetryMode(RetryMode.EXPONENTIAL); final RetryPolicy retryPolicy = RetryUtil.getRetryPolicy(retryOptions); // Assert @@ -48,9 +48,9 @@ public void getCorrectModeExponential() { public void withRetryFlux() { // Arrange final RetryOptions options = new RetryOptions() - .delay(Duration.ofSeconds(1)) - .maxRetries(2); - final Duration totalWaitTime = Duration.ofSeconds(options.maxRetries() * options.delay().getSeconds()); + .setDelay(Duration.ofSeconds(1)) + .setMaxRetries(2); + final Duration totalWaitTime = Duration.ofSeconds(options.getMaxRetries() * options.getDelay().getSeconds()); final Duration timeout = Duration.ofMillis(500); final AtomicInteger resubscribe = new AtomicInteger(); @@ -65,16 +65,16 @@ public void withRetryFlux() { .expectError(TimeoutException.class) .verify(); - Assert.assertEquals(options.maxRetries() + 1, resubscribe.get()); + Assert.assertEquals(options.getMaxRetries() + 1, resubscribe.get()); } @Test public void withRetryMono() { // Arrange final RetryOptions options = new RetryOptions() - .delay(Duration.ofSeconds(1)) - .maxRetries(2); - final Duration totalWaitTime = Duration.ofSeconds(options.maxRetries() * options.delay().getSeconds()); + .setDelay(Duration.ofSeconds(1)) + .setMaxRetries(2); + final Duration totalWaitTime = Duration.ofSeconds(options.getMaxRetries() * options.getDelay().getSeconds()); final Duration timeout = Duration.ofMillis(500); final AtomicInteger resubscribe = new AtomicInteger(); @@ -89,6 +89,6 @@ public void withRetryMono() { .expectError(TimeoutException.class) .verify(); - Assert.assertEquals(options.maxRetries() + 1, resubscribe.get()); + Assert.assertEquals(options.getMaxRetries() + 1, resubscribe.get()); } } diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/TracerProviderTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/TracerProviderTest.java new file mode 100644 index 000000000000..753a86896360 --- /dev/null +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/TracerProviderTest.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.amqp.implementation; + +import com.azure.core.amqp.exception.AmqpException; +import com.azure.core.amqp.exception.ErrorCondition; +import com.azure.core.implementation.tracing.ProcessKind; +import com.azure.core.implementation.tracing.Tracer; +import com.azure.core.util.Context; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import reactor.core.publisher.Signal; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Optional; + +import static com.azure.core.implementation.tracing.Tracer.OPENTELEMETRY_SPAN_KEY; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class TracerProviderTest { + private static final String METHOD_NAME = "Azure.eventhubs.send"; + + @Mock + private Tracer tracer; + @Mock + private Tracer tracer2; + + private List tracers; + private TracerProvider tracerProvider; + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + + tracers = Arrays.asList(tracer, tracer2); + tracerProvider = new TracerProvider(tracers); + } + + @After + public void teardown() { + Mockito.framework().clearInlineMocks(); + } + + @Test + public void startSpan() { + // Act + tracerProvider.startSpan(Context.NONE, ProcessKind.SEND); + + // Assert + for (Tracer t : tracers) { + verify(t, times(1)) + .start(eq(METHOD_NAME), any(), eq(ProcessKind.SEND)); + } + } + + @Test + public void notEnabledWhenNoTracers() { + // Arrange + final TracerProvider provider = new TracerProvider(Collections.emptyList()); + + // Act & Assert + Assert.assertFalse(provider.isEnabled()); + } + + @Test + public void startSpanReturnsUpdatedContext() { + // Arrange + final String parentKey = "parent-key"; + final String parentValue = "parent-value"; + final String childKey = "child-key"; + final String childValue = "child-value"; + final Context startingContext = Context.NONE; + when(tracer.start(METHOD_NAME, startingContext, ProcessKind.SEND)).thenAnswer( + invocation -> { + Context passed = invocation.getArgument(1, Context.class); + return passed.addData(parentKey, parentValue); + } + ); + when(tracer2.start(eq(METHOD_NAME), any(), eq(ProcessKind.SEND))).thenAnswer( + invocation -> { + Context passed = invocation.getArgument(1, Context.class); + return passed.addData(childKey, childValue); + } + ); + + // Act + final Context updatedContext = tracerProvider.startSpan(startingContext, ProcessKind.SEND); + + // Assert + // Want to ensure that the data added to the parent and child are available. + final Optional parentData = updatedContext.getData(parentKey); + Assert.assertTrue(parentData.isPresent()); + Assert.assertEquals(parentValue, parentData.get()); + + final Optional childData = updatedContext.getData(childKey); + Assert.assertTrue(childData.isPresent()); + Assert.assertEquals(childValue, childData.get()); + } + + @Test + public void endSpanSuccess() { + // Act + tracerProvider.endSpan(new Context(OPENTELEMETRY_SPAN_KEY, "value"), Signal.complete()); + + // Assert + for (Tracer t : tracers) { + verify(t, times(1)).end(eq("success"), isNull(), any(Context.class)); + } + } + + @Test + public void endSpanNoKey() { + // Act + tracerProvider.endSpan(Context.NONE, Signal.complete()); + + // Assert + for (Tracer t : tracers) { + verify(t, never()).end("", null, Context.NONE); + } + } + + @Test + public void endSpanError() { + // Arrange + Throwable testThrow = new Throwable("testError"); + Context sendContext = new Context(OPENTELEMETRY_SPAN_KEY, "value"); + + // Act + tracerProvider.endSpan(sendContext, Signal.error(testThrow)); + + // Assert + for (Tracer t : tracers) { + verify(t, times(1)).end("", testThrow, sendContext); + } + } + + @Test + public void endSpanOnSubscribe() { + // Arrange + Throwable testThrow = new Throwable("testError"); + Context sendContext = new Context(OPENTELEMETRY_SPAN_KEY, "value"); + + // Act + tracerProvider.endSpan(sendContext, Signal.error(testThrow)); + + // Assert + for (Tracer t : tracers) { + verify(t, times(1)).end("", testThrow, sendContext); + } + } + + @Test + public void endSpanAmqpException() { + // Arrange + final ErrorCondition errorCondition = ErrorCondition.NOT_FOUND; + final Exception exception = new AmqpException(true, errorCondition, "", null); + Context sendContext = new Context(OPENTELEMETRY_SPAN_KEY, "value"); + + // Act + tracerProvider.endSpan(sendContext, Signal.error(exception)); + + // Assert + for (Tracer t : tracers) { + verify(t, times(1)) + .end(errorCondition.getErrorCondition(), exception, sendContext); + } + } + + @Test(expected = NullPointerException.class) + public void addSpanLinksNoContext() { + // Act + tracerProvider.addSpanLinks(null); + } + + /** + * Verify that we add spans for all the tracers. + */ + @Test(expected = NullPointerException.class) + public void addSpanLinks() { + // Act + tracerProvider.addSpanLinks(null); + } +} diff --git a/sdk/core/azure-core-http-netty/README.md b/sdk/core/azure-core-http-netty/README.md new file mode 100644 index 000000000000..bf8bc5624604 --- /dev/null +++ b/sdk/core/azure-core-http-netty/README.md @@ -0,0 +1,38 @@ +# Azure Core Netty HTTP client library for Java + +Azure Core Netty HTTP client is a plugin for the azure-core HTTP client API. + +## Getting started + +### Prerequisites + +- Java Development Kit (JDK) with version 8 or above + +### Adding the package to your product + +```xml + + com.azure + azure-core-http-netty + 1.0.0-preview.4 + +``` + +## Key concepts + +## Examples + +## Troubleshooting + +## Next steps + +## Contributing + +If you would like to become an active contributor to this project please follow the instructions provided in [Microsoft +Azure Projects Contribution Guidelines](http://azure.github.io/guidelines.html). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request diff --git a/sdk/core/azure-core-http-netty/pom.xml b/sdk/core/azure-core-http-netty/pom.xml new file mode 100644 index 000000000000..685be5813174 --- /dev/null +++ b/sdk/core/azure-core-http-netty/pom.xml @@ -0,0 +1,113 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.4.0 + ../../../pom.client.xml + + + com.azure + azure-core-http-netty + jar + 1.0.0-preview.5 + + Microsoft Azure Netty HTTP Client Library + This package contains the Netty HTTP client plugin for azure-core. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + + azure-java-build-docs + ${site.url}/site/${project.artifactId} + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:https://github.com/Azure/azure-sdk-for-java.git + scm:git:https://github.com/Azure/azure-sdk-for-java.git + + + + UTF-8 + + com.azure.core.http.netty + + + + + microsoft + Microsoft + + + + + + com.azure + azure-core + 1.0.0-preview.5 + + + + io.netty + netty-handler + + + io.netty + netty-handler-proxy + + + io.netty + netty-buffer + + + io.netty + netty-codec-http + + + + io.projectreactor.netty + reactor-netty + + + + + com.azure + azure-core + 1.0.0-preview.5 + test-jar + test + + + io.projectreactor + reactor-test + test + + + + junit + junit + test + + + + com.github.tomakehurst + wiremock-standalone + test + + + diff --git a/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/NettyAsyncHttpClient.java b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/NettyAsyncHttpClient.java new file mode 100644 index 000000000000..087076100036 --- /dev/null +++ b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/NettyAsyncHttpClient.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.netty; + +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeader; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.ProxyOptions; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.handler.codec.http.HttpMethod; +import org.reactivestreams.Publisher; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.netty.ByteBufFlux; +import reactor.netty.Connection; +import reactor.netty.NettyOutbound; +import reactor.netty.http.client.HttpClientRequest; +import reactor.netty.http.client.HttpClientResponse; + +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.util.Objects; +import java.util.function.BiFunction; + +/** + * This class provides a Netty-based implementation for the {@link HttpClient} interface. Creating an instance of + * this class can be achieved by using the {@link NettyAsyncHttpClientBuilder} class, which offers Netty-specific API + * for features such as {@link NettyAsyncHttpClientBuilder#nioEventLoopGroup(NioEventLoopGroup) thread pooling}, + * {@link NettyAsyncHttpClientBuilder#wiretap(boolean) wiretapping}, + * {@link NettyAsyncHttpClientBuilder#proxy(ProxyOptions) setProxy configuration}, and much more. + * + * @see HttpClient + * @see NettyAsyncHttpClientBuilder + */ +public class NettyAsyncHttpClient implements HttpClient { + final reactor.netty.http.client.HttpClient nettyClient; + + /** + * Creates default NettyAsyncHttpClient. + */ + NettyAsyncHttpClient() { + this(reactor.netty.http.client.HttpClient.create()); + } + + /** + * Creates NettyAsyncHttpClient with provided http client. + * + * @param nettyClient the reactor-netty http client + */ + NettyAsyncHttpClient(reactor.netty.http.client.HttpClient nettyClient) { + this.nettyClient = nettyClient; + } + + /** {@inheritDoc} */ + @Override + public Mono send(final HttpRequest request) { + Objects.requireNonNull(request.getHttpMethod()); + Objects.requireNonNull(request.getUrl()); + Objects.requireNonNull(request.getUrl().getProtocol()); + + return nettyClient + .request(HttpMethod.valueOf(request.getHttpMethod().toString())) + .uri(request.getUrl().toString()) + .send(bodySendDelegate(request)) + .responseConnection(responseDelegate(request)) + .single(); + } + + /** + * Delegate to send the request content. + * + * @param restRequest the Rest request contains the body to be sent + * @return a delegate upon invocation sets the request body in reactor-netty outbound object + */ + private static BiFunction> bodySendDelegate( + final HttpRequest restRequest) { + return (reactorNettyRequest, reactorNettyOutbound) -> { + for (HttpHeader header : restRequest.getHeaders()) { + if (header.getValue() != null) { + reactorNettyRequest.header(header.getName(), header.getValue()); + } + } + if (restRequest.getBody() != null) { + Flux nettyByteBufFlux = restRequest.getBody().map(Unpooled::wrappedBuffer); + return reactorNettyOutbound.send(nettyByteBufFlux); + } else { + return reactorNettyOutbound; + } + }; + } + + /** + * Delegate to receive response. + * + * @param restRequest the Rest request whose response this delegate handles + * @return a delegate upon invocation setup Rest response object + */ + private static BiFunction> responseDelegate( + final HttpRequest restRequest) { + return (reactorNettyResponse, reactorNettyConnection) -> + Mono.just(new ReactorNettyHttpResponse(reactorNettyResponse, reactorNettyConnection) + .setRequest(restRequest)); + } + + static class ReactorNettyHttpResponse extends HttpResponse { + private final HttpClientResponse reactorNettyResponse; + private final Connection reactorNettyConnection; + + ReactorNettyHttpResponse(HttpClientResponse reactorNettyResponse, Connection reactorNettyConnection) { + this.reactorNettyResponse = reactorNettyResponse; + this.reactorNettyConnection = reactorNettyConnection; + } + + @Override + public int getStatusCode() { + return reactorNettyResponse.status().code(); + } + + @Override + public String getHeaderValue(String name) { + return reactorNettyResponse.responseHeaders().get(name); + } + + @Override + public HttpHeaders getHeaders() { + HttpHeaders headers = new HttpHeaders(); + reactorNettyResponse.responseHeaders().forEach(e -> headers.put(e.getKey(), e.getValue())); + return headers; + } + + @Override + public Flux getBody() { + return bodyIntern().doFinally(s -> { + if (!reactorNettyConnection.isDisposed()) { + reactorNettyConnection.channel().eventLoop().execute(reactorNettyConnection::dispose); + } + }).map(ByteBuf::nioBuffer); + } + + @Override + public Mono getBodyAsByteArray() { + return bodyIntern().aggregate().asByteArray().doFinally(s -> { + if (!reactorNettyConnection.isDisposed()) { + reactorNettyConnection.channel().eventLoop().execute(reactorNettyConnection::dispose); + } + }); + } + + @Override + public Mono getBodyAsString() { + return bodyIntern().aggregate().asString().doFinally(s -> { + if (!reactorNettyConnection.isDisposed()) { + reactorNettyConnection.channel().eventLoop().execute(reactorNettyConnection::dispose); + } + }); + } + + @Override + public Mono getBodyAsString(Charset charset) { + return bodyIntern().aggregate().asString(charset).doFinally(s -> { + if (!reactorNettyConnection.isDisposed()) { + reactorNettyConnection.channel().eventLoop().execute(reactorNettyConnection::dispose); + } + }); + } + + @Override + public void close() { + if (!reactorNettyConnection.isDisposed()) { + reactorNettyConnection.channel().eventLoop().execute(reactorNettyConnection::dispose); + } + } + + private ByteBufFlux bodyIntern() { + return reactorNettyConnection.inbound().receive(); + } + + // used for testing only + Connection internConnection() { + return reactorNettyConnection; + } + } +} diff --git a/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/NettyAsyncHttpClientBuilder.java b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/NettyAsyncHttpClientBuilder.java new file mode 100644 index 000000000000..f22648a979fa --- /dev/null +++ b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/NettyAsyncHttpClientBuilder.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.netty; + +import com.azure.core.http.ProxyOptions; +import com.azure.core.util.logging.ClientLogger; +import io.netty.channel.nio.NioEventLoopGroup; +import reactor.netty.http.client.HttpClient; +import reactor.netty.tcp.ProxyProvider; + +/** + * Builder class responsible for creating instances of {@link NettyAsyncHttpClient}. + * + *

Building a new HttpClient instance

+ * + * {@codesnippet com.azure.core.http.netty.instantiation-simple} + * + * @see NettyAsyncHttpClient + * @see HttpClient + */ +public class NettyAsyncHttpClientBuilder { + private final ClientLogger logger = new ClientLogger(NettyAsyncHttpClientBuilder.class); + + private ProxyOptions proxyOptions; + private boolean enableWiretap; + private int port = 80; + private NioEventLoopGroup nioEventLoopGroup; + + /** + * Creates a new builder instance, where a builder is capable of generating multiple instances of + * {@link NettyAsyncHttpClient}. + */ + public NettyAsyncHttpClientBuilder() { + } + + /** + * Creates a new {@link NettyAsyncHttpClient} instance on every call, using the configuration set in the builder at + * the time of the build method call. + * + * @return A new NettyAsyncHttpClient instance. + * @throws IllegalStateException If the builder is configured to use an unknown proxy type. + */ + public NettyAsyncHttpClient build() { + HttpClient nettyHttpClient = HttpClient.create() + .port(port) + .wiretap(enableWiretap) + .tcpConfiguration(tcpConfig -> { + if (nioEventLoopGroup != null) { + tcpConfig = tcpConfig.runOn(nioEventLoopGroup); + } + + if (proxyOptions != null) { + ProxyProvider.Proxy nettyProxy; + switch (proxyOptions.getType()) { + case HTTP: + nettyProxy = ProxyProvider.Proxy.HTTP; + break; + case SOCKS4: + nettyProxy = ProxyProvider.Proxy.SOCKS4; + break; + case SOCKS5: + nettyProxy = ProxyProvider.Proxy.SOCKS5; + break; + default: + throw logger.logExceptionAsWarning( + new IllegalStateException( + "Unknown Proxy type '" + proxyOptions.getType() + + "' in use. Not configuring Netty proxy.")); + } + + return tcpConfig.proxy(ts -> ts.type(nettyProxy).address(proxyOptions.getAddress())); + } + + return tcpConfig; + }); + return new NettyAsyncHttpClient(nettyHttpClient); + } + + /** + * Sets the {@link ProxyOptions proxy options} that the client will use. + * + * @param proxyOptions The proxy configuration to use. + * @return the updated NettyAsyncHttpClientBuilder object + */ + public NettyAsyncHttpClientBuilder proxy(ProxyOptions proxyOptions) { + this.proxyOptions = proxyOptions; + return this; + } + + /** + * Enables the Netty wiretap feature. + * + * @param enableWiretap Flag indicating wiretap status + * @return the updated NettyAsyncHttpClientBuilder object + */ + public NettyAsyncHttpClientBuilder wiretap(boolean enableWiretap) { + this.enableWiretap = enableWiretap; + return this; + } + + /** + * Sets the port which this client should connect, which by default will be set to port 80. + * + * @param port The port to connect to. + * @return the updated NettyAsyncHttpClientBuilder object + */ + public NettyAsyncHttpClientBuilder port(int port) { + this.port = port; + return this; + } + + /** + * Sets the NIO event loop group that will be used to run IO loops. For example, a fixed thread pool can be + * specified as shown below: + * + * {@codesnippet com.azure.core.http.netty.NettyAsyncHttpClientBuilder#NioEventLoopGroup} + * + * @param nioEventLoopGroup The {@link NioEventLoopGroup} that will run IO loops. + * @return the updated NettyAsyncHttpClientBuilder object + */ + public NettyAsyncHttpClientBuilder nioEventLoopGroup(NioEventLoopGroup nioEventLoopGroup) { + this.nioEventLoopGroup = nioEventLoopGroup; + return this; + } +} diff --git a/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/implementation/ReactorNettyClientProvider.java b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/implementation/ReactorNettyClientProvider.java new file mode 100644 index 000000000000..6362c4fa9d83 --- /dev/null +++ b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/implementation/ReactorNettyClientProvider.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.netty.implementation; + +import com.azure.core.http.HttpClient; +import com.azure.core.http.netty.NettyAsyncHttpClientBuilder; +import com.azure.core.implementation.http.spi.HttpClientProvider; + +public class ReactorNettyClientProvider implements HttpClientProvider { + + @Override + public HttpClient createInstance() { + return new NettyAsyncHttpClientBuilder().build(); + } +} diff --git a/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/package-info.java b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/package-info.java new file mode 100644 index 000000000000..5bfbe324584b --- /dev/null +++ b/sdk/core/azure-core-http-netty/src/main/java/com/azure/core/http/netty/package-info.java @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +/** + * Package containing the types for instantiating and using the Netty HTTP client. + */ +package com.azure.core.http.netty; diff --git a/sdk/core/azure-core-http-netty/src/main/resources/META-INF/services/com.azure.core.implementation.http.spi.HttpClientProvider b/sdk/core/azure-core-http-netty/src/main/resources/META-INF/services/com.azure.core.implementation.http.spi.HttpClientProvider new file mode 100644 index 000000000000..e14f80af27db --- /dev/null +++ b/sdk/core/azure-core-http-netty/src/main/resources/META-INF/services/com.azure.core.implementation.http.spi.HttpClientProvider @@ -0,0 +1 @@ +com.azure.core.http.netty.implementation.ReactorNettyClientProvider diff --git a/sdk/core/azure-core-http-netty/src/samples/java/com/azure/core/http/netty/NettyAsyncHttpClientBuilderJavaDocCodeSnippets.java b/sdk/core/azure-core-http-netty/src/samples/java/com/azure/core/http/netty/NettyAsyncHttpClientBuilderJavaDocCodeSnippets.java new file mode 100644 index 000000000000..5f5557ed9db4 --- /dev/null +++ b/sdk/core/azure-core-http-netty/src/samples/java/com/azure/core/http/netty/NettyAsyncHttpClientBuilderJavaDocCodeSnippets.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.netty; + +import com.azure.core.http.HttpClient; +import io.netty.channel.nio.NioEventLoopGroup; + +/** + * Code snippets for {@link NettyAsyncHttpClientBuilder} + */ +public class NettyAsyncHttpClientBuilderJavaDocCodeSnippets { + + /** + * Code snippet for simple http client instantiation. + */ + public void simpleInstantiation() { + + // BEGIN: com.azure.core.http.netty.instantiation-simple + HttpClient client = new NettyAsyncHttpClientBuilder() + .port(8080) + .wiretap(true) + .build(); + // END: com.azure.core.http.netty.instantiation-simple + } + + /** + * Code snippet for creating http client with fixed thread pool. + */ + public void fixedThreadPoolSample() { + + // BEGIN: com.azure.core.http.netty.NettyAsyncHttpClientBuilder#NioEventLoopGroup + int threadCount = 5; + HttpClient client = new NettyAsyncHttpClientBuilder() + .nioEventLoopGroup(new NioEventLoopGroup(threadCount)) + .build(); + // END: com.azure.core.http.netty.NettyAsyncHttpClientBuilder#NioEventLoopGroup + } + +} diff --git a/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/ReactorNettyClientTests.java b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/ReactorNettyClientTests.java new file mode 100644 index 000000000000..3d857d411826 --- /dev/null +++ b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/ReactorNettyClientTests.java @@ -0,0 +1,343 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.netty; + +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpMethod; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.github.tomakehurst.wiremock.WireMockServer; +import com.github.tomakehurst.wiremock.client.WireMock; +import com.github.tomakehurst.wiremock.core.WireMockConfiguration; +import io.netty.buffer.ByteBuf; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.core.scheduler.Schedulers; +import reactor.test.StepVerifier; +import reactor.test.StepVerifierOptions; + +import java.io.IOException; +import java.io.OutputStream; +import java.net.MalformedURLException; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.URL; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.atomic.AtomicReference; + +import static com.azure.core.http.netty.NettyAsyncHttpClient.ReactorNettyHttpResponse; + +public class ReactorNettyClientTests { + + private static final String SHORT_BODY = "hi there"; + private static final String LONG_BODY = createLongBody(); + + private static WireMockServer server; + + @BeforeClass + public static void beforeClass() { + server = new WireMockServer(WireMockConfiguration.options().dynamicPort().disableRequestJournal()); + server.stubFor( + WireMock.get("/short").willReturn(WireMock.aResponse().withBody(SHORT_BODY))); + server.stubFor(WireMock.get("/long").willReturn(WireMock.aResponse().withBody(LONG_BODY))); + server.stubFor(WireMock.get("/error") + .willReturn(WireMock.aResponse().withBody("error").withStatus(500))); + server.stubFor( + WireMock.post("/shortPost").willReturn(WireMock.aResponse().withBody(SHORT_BODY))); + server.start(); + // ResourceLeakDetector.setLevel(Level.PARANOID); + } + + @AfterClass + public static void afterClass() { + if (server != null) { + server.shutdown(); + } + } + + @Test + public void testFlowableResponseShortBodyAsByteArrayAsync() { + checkBodyReceived(SHORT_BODY, "/short"); + } + + @Test + public void testFlowableResponseLongBodyAsByteArrayAsync() { + checkBodyReceived(LONG_BODY, "/long"); + } + + @Test + public void testMultipleSubscriptionsEmitsError() { + HttpResponse response = getResponse("/short"); + // Subscription:1 + response.getBodyAsByteArray().block(); + // Subscription:2 + StepVerifier.create(response.getBodyAsByteArray()) + .expectNextCount(0) // TODO: Check with smaldini, what is the verifier operator equivalent to .awaitDone(20, TimeUnit.SECONDS) + .verifyError(IllegalStateException.class); + + } + + @Test + public void testDispose() throws InterruptedException { + ReactorNettyHttpResponse response = getResponse("/long"); + response.getBody().subscribe().dispose(); + // Wait for scheduled connection disposal action to execute on netty event-loop + Thread.sleep(5000); + Assert.assertTrue(response.internConnection().isDisposed()); + } + + @Test + public void testCancel() { + ReactorNettyHttpResponse response = getResponse("/long"); + // + StepVerifierOptions stepVerifierOptions = StepVerifierOptions.create(); + stepVerifierOptions.initialRequest(0); + // + StepVerifier.create(response.getBody(), stepVerifierOptions) + .expectNextCount(0) + .thenRequest(1) + .expectNextCount(1) + .thenCancel() + .verify(); + Assert.assertTrue(response.internConnection().isDisposed()); + } + + @Test + public void testFlowableWhenServerReturnsBodyAndNoErrorsWhenHttp500Returned() { + HttpResponse response = getResponse("/error"); + StepVerifier.create(response.getBodyAsString()) + .expectNext("error") // TODO: .awaitDone(20, TimeUnit.SECONDS) [See previous todo] + .verifyComplete(); + Assert.assertEquals(500, response.getStatusCode()); + } + + @Test + @Ignore("Not working accurately at present") + public void testFlowableBackpressure() { + HttpResponse response = getResponse("/long"); + // + StepVerifierOptions stepVerifierOptions = StepVerifierOptions.create(); + stepVerifierOptions.initialRequest(0); + // + StepVerifier.create(response.getBody(), stepVerifierOptions) + .expectNextCount(0) + .thenRequest(1) + .expectNextCount(1) + .thenRequest(3) + .expectNextCount(3) + .thenRequest(Long.MAX_VALUE)// TODO: Check with smaldini, what is the verifier operator to ignore all next emissions + .expectNextCount(1507) + .verifyComplete(); + } + + @Test + public void testRequestBodyIsErrorShouldPropagateToResponse() { + HttpClient client = HttpClient.createDefault(); + HttpRequest request = new HttpRequest(HttpMethod.POST, url(server, "/shortPost")) + .setHeader("Content-Length", "123") + .setBody(Flux.error(new RuntimeException("boo"))); + + StepVerifier.create(client.send(request)) + .expectErrorMessage("boo") + .verify(); + } + + @Test + public void testRequestBodyEndsInErrorShouldPropagateToResponse() { + HttpClient client = HttpClient.createDefault(); + String contentChunk = "abcdefgh"; + int repetitions = 1000; + HttpRequest request = new HttpRequest(HttpMethod.POST, url(server, "/shortPost")) + .setHeader("Content-Length", String.valueOf(contentChunk.length() * repetitions)) + .setBody(Flux.just(contentChunk) + .repeat(repetitions) + .map(s -> ByteBuffer.wrap(s.getBytes(StandardCharsets.UTF_8))) + .concatWith(Flux.error(new RuntimeException("boo")))); + StepVerifier.create(client.send(request)) + // .awaitDone(10, TimeUnit.SECONDS) + .expectErrorMessage("boo") + .verify(); + } + + @Test(timeout = 5000) + public void testServerShutsDownSocketShouldPushErrorToContentFlowable() + throws IOException, InterruptedException { + CountDownLatch latch = new CountDownLatch(1); + AtomicReference sock = new AtomicReference<>(); + ServerSocket ss = new ServerSocket(0); + try { + Mono.fromCallable(() -> { + latch.countDown(); + Socket socket = ss.accept(); + sock.set(socket); + // give the client time to get request across + Thread.sleep(500); + // respond but don't send the complete response + byte[] bytes = new byte[1024]; + int n = socket.getInputStream().read(bytes); + System.out.println(new String(bytes, 0, n, StandardCharsets.UTF_8)); + String response = "HTTP/1.1 200 OK\r\n" // + + "Content-Type: text/plain\r\n" // + + "Content-Length: 10\r\n" // + + "\r\n" // + + "zi"; + OutputStream out = socket.getOutputStream(); + out.write(response.getBytes()); + out.flush(); + // kill the socket with HTTP response body incomplete + socket.close(); + return 1; + }) + .subscribeOn(Schedulers.elastic()) + .subscribe(); + // + latch.await(); + HttpClient client = HttpClient.createDefault(); + HttpRequest request = new HttpRequest(HttpMethod.GET, + new URL("http://localhost:" + ss.getLocalPort() + "/get")); + HttpResponse response = client.send(request).block(); + Assert.assertEquals(200, response.getStatusCode()); + System.out.println("reading body"); + // + StepVerifier.create(response.getBodyAsByteArray()) + // .awaitDone(20, TimeUnit.SECONDS) + .verifyError(IOException.class); + } finally { + ss.close(); + } + } + + @Ignore("This flakey test fails often on MacOS. https://github.com/Azure/azure-sdk-for-java/issues/4357.") + @Test + public void testConcurrentRequests() throws NoSuchAlgorithmException { +// long t = System.currentTimeMillis(); +// int numRequests = 100; // 100 = 1GB of data read +// long timeoutSeconds = 60; +// ReactorNettyClient client = new ReactorNettyClient(); +// byte[] expectedDigest = digest(LONG_BODY); +// +// Mono numBytesMono = Flux.range(1, numRequests) +// .parallel(10) +// .runOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) +// .flatMap(n -> Mono.fromCallable(() -> getResponse(client, "/long")).flatMapMany(response -> { +// MessageDigest md = md5Digest(); +// return response.body() +// .doOnNext(bb -> { +// bb.retain(); +// if (bb.hasArray()) { +// // Heap buffer +// md.update(bb.array()); +// } else { +// // Direct buffer +// int len = bb.readableBytes(); +// byte[] array = new byte[len]; +// bb.getBytes(bb.readerIndex(), array); +// md.update(array); +// } +// }) +// .map(bb -> new NumberedByteBuf(n, bb)) +//// .doOnComplete(() -> System.out.println("completed " + n)) +// .doOnComplete(() -> Assert.assertArrayEquals("wrong digest!", expectedDigest, +// md.digest())); +// })) +// .sequential() +// // enable the doOnNext call to see request numbers and thread names +// // .doOnNext(g -> System.out.println(g.n + " " + +// // Thread.currentThread().getName())) +// .map(nbb -> { +// long bytesCount = (long) nbb.bb.readableBytes(); +// ReferenceCountUtil.release(nbb.bb); +// return bytesCount; +// }) +// .reduce((x, y) -> x + y) +// .subscribeOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) +// .publishOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)); +// +// StepVerifier.create(numBytesMono) +//// .awaitDone(timeoutSeconds, TimeUnit.SECONDS) +// .expectNext((long) (numRequests * LONG_BODY.getBytes(StandardCharsets.UTF_8).length)) +// .verifyComplete(); +//// +//// long numBytes = numBytesMono.block(); +//// t = System.currentTimeMillis() - t; +//// System.out.println("totalBytesRead=" + numBytes / 1024 / 1024 + "MB in " + t / 1000.0 + "s"); +//// assertEquals(numRequests * LONG_BODY.getBytes(StandardCharsets.UTF_8).length, numBytes); + + Assert.fail("Method needs to be reimplemented"); + } + + private static MessageDigest md5Digest() { + try { + return MessageDigest.getInstance("MD5"); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } + } + + private static byte[] digest(String s) throws NoSuchAlgorithmException { + MessageDigest md = MessageDigest.getInstance("MD5"); + md.update(s.getBytes(StandardCharsets.UTF_8)); + byte[] expectedDigest = md.digest(); + return expectedDigest; + } + + private static final class NumberedByteBuf { + final long n; + final ByteBuf bb; + + NumberedByteBuf(long n, ByteBuf bb) { + this.n = n; + this.bb = bb; + } + } + + private static ReactorNettyHttpResponse getResponse(String path) { + NettyAsyncHttpClient client = new NettyAsyncHttpClient(); + return getResponse(client, path); + } + + private static ReactorNettyHttpResponse getResponse(NettyAsyncHttpClient client, String path) { + HttpRequest request = new HttpRequest(HttpMethod.GET, url(server, path)); + return (ReactorNettyHttpResponse) client.send(request).block(); + } + + private static URL url(WireMockServer server, String path) { + try { + return new URL("http://localhost:" + server.port() + path); + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } + } + + private static String createLongBody() { + StringBuilder s = new StringBuilder(10000000); + for (int i = 0; i < 1000000; i++) { + s.append("abcdefghijk"); + } + return s.toString(); + } + + private void checkBodyReceived(String expectedBody, String path) { + NettyAsyncHttpClient client = new NettyAsyncHttpClient(); + HttpResponse response = doRequest(client, path); + String s = new String(response.getBodyAsByteArray().block(), + StandardCharsets.UTF_8); + Assert.assertEquals(expectedBody, s); + } + + private ReactorNettyHttpResponse doRequest(NettyAsyncHttpClient client, String path) { + HttpRequest request = new HttpRequest(HttpMethod.GET, url(server, path)); + ReactorNettyHttpResponse response = (ReactorNettyHttpResponse) client.send(request).block(); + return response; + } +} diff --git a/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/NettyFluxTestUtils.java b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/NettyFluxTestUtils.java new file mode 100644 index 000000000000..026d46efeb01 --- /dev/null +++ b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/NettyFluxTestUtils.java @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.netty.implementation; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufAllocator; +import org.reactivestreams.Subscriber; +import org.reactivestreams.Subscription; +import reactor.core.CoreSubscriber; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Operators; + +import java.nio.channels.AsynchronousFileChannel; +import java.nio.channels.CompletionHandler; +import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; +import java.util.concurrent.atomic.AtomicLongFieldUpdater; + +public class NettyFluxTestUtils { + private static final int DEFAULT_CHUNK_SIZE = 1024 * 64; + + /** + * Splits a ByteBuffer into ByteBuf chunks. + * + * @param whole the ByteBuffer to split + * @param chunkSize the maximum size of each ByteBuf chunk + * @return A stream that emits chunks of the original whole ByteBuf + */ + public static Flux split(final ByteBuf whole, final int chunkSize) { + return Flux.generate(whole::readerIndex, (readFromIndex, synchronousSync) -> { + final int writerIndex = whole.writerIndex(); + // + if (readFromIndex >= writerIndex) { + synchronousSync.complete(); + return writerIndex; + } else { + int readSize = Math.min(writerIndex - readFromIndex, chunkSize); + // Netty slice operation will not increment the ref count. + // + // Here we invoke 'retain' on each slice, since + // consumer of the returned Flux stream is responsible for + // releasing each chunk as it gets consumed. + // + synchronousSync.next(whole.slice(readFromIndex, readSize).retain()); + return readFromIndex + readSize; + } + }); + } + + /** + * Creates a {@link Flux} from an {@link AsynchronousFileChannel} + * which reads part of a file into chunks of the given size. + * + * @param fileChannel The file channel. + * @param chunkSize the size of file chunks to read. + * @param offset The offset in the file to begin reading. + * @param length The number of bytes to read from the file. + * @return the Flowable. + */ + public static Flux byteBufStreamFromFile(AsynchronousFileChannel fileChannel, int chunkSize, long offset, long length) { + return new ByteBufStreamFromFile(fileChannel, chunkSize, offset, length); + } + + /** + * Creates a {@link Flux} from an {@link AsynchronousFileChannel} + * which reads part of a file. + * + * @param fileChannel The file channel. + * @param offset The offset in the file to begin reading. + * @param length The number of bytes to read from the file. + * @return the Flowable. + */ + public static Flux byteBufStreamFromFile(AsynchronousFileChannel fileChannel, long offset, long length) { + return byteBufStreamFromFile(fileChannel, DEFAULT_CHUNK_SIZE, offset, length); + } + + //region ByteBufStreamFromFile implementation + private static final class ByteBufStreamFromFile extends Flux { + private final ByteBufAllocator alloc; + private final AsynchronousFileChannel fileChannel; + private final int chunkSize; + private final long offset; + private final long length; + + ByteBufStreamFromFile(AsynchronousFileChannel fileChannel, int chunkSize, long offset, long length) { + this.alloc = ByteBufAllocator.DEFAULT; + this.fileChannel = fileChannel; + this.chunkSize = chunkSize; + this.offset = offset; + this.length = length; + } + + @Override + public void subscribe(CoreSubscriber actual) { + FileReadSubscription subscription = new FileReadSubscription(actual, fileChannel, alloc, chunkSize, offset, length); + actual.onSubscribe(subscription); + } + + static final class FileReadSubscription implements Subscription, CompletionHandler { + private static final int NOT_SET = -1; + private static final long serialVersionUID = -6831808726875304256L; + // + private final Subscriber subscriber; + private volatile long position; + // + private final AsynchronousFileChannel fileChannel; + private final ByteBufAllocator alloc; + private final int chunkSize; + private final long offset; + private final long length; + // + private volatile boolean done; + private Throwable error; + private volatile ByteBuf next; + private volatile boolean cancelled; + // + volatile int wip; + @SuppressWarnings("rawtypes") + static final AtomicIntegerFieldUpdater WIP = AtomicIntegerFieldUpdater.newUpdater(FileReadSubscription.class, "wip"); + volatile long requested; + @SuppressWarnings("rawtypes") + static final AtomicLongFieldUpdater REQUESTED = AtomicLongFieldUpdater.newUpdater(FileReadSubscription.class, "requested"); + // + + FileReadSubscription(Subscriber subscriber, AsynchronousFileChannel fileChannel, ByteBufAllocator alloc, int chunkSize, long offset, long length) { + this.subscriber = subscriber; + // + this.fileChannel = fileChannel; + this.alloc = alloc; + this.chunkSize = chunkSize; + this.offset = offset; + this.length = length; + // + this.position = NOT_SET; + } + + //region Subscription implementation + + @Override + public void request(long n) { + if (Operators.validate(n)) { + Operators.addCap(REQUESTED, this, n); + drain(); + } + } + + @Override + public void cancel() { + this.cancelled = true; + } + + //endregion + + //region CompletionHandler implementation + + @Override + public void completed(Integer bytesRead, ByteBuf buffer) { + if (!cancelled) { + if (bytesRead == -1) { + done = true; + } else { + // use local variable to perform fewer volatile reads + long pos = position; + // + int bytesWanted = Math.min(bytesRead, maxRequired(pos)); + buffer.writerIndex(bytesWanted); + long position2 = pos + bytesWanted; + //noinspection NonAtomicOperationOnVolatileField + position = position2; + next = buffer; + if (position2 >= offset + length) { + done = true; + } + } + drain(); + } + } + + @Override + public void failed(Throwable exc, ByteBuf attachment) { + if (!cancelled) { + // must set error before setting done to true + // so that is visible in drain loop + error = exc; + done = true; + drain(); + } + } + + //endregion + + private void drain() { + if (WIP.getAndIncrement(this) != 0) { + return; + } + // on first drain (first request) we initiate the first read + if (position == NOT_SET) { + position = offset; + doRead(); + } + int missed = 1; + for (;;) { + if (cancelled) { + return; + } + if (REQUESTED.get(this) > 0) { + boolean emitted = false; + // read d before next to avoid race + boolean d = done; + ByteBuf bb = next; + if (bb != null) { + next = null; + // + // try { + subscriber.onNext(bb); + // } finally { + // Note: Don't release here, we follow netty disposal pattern + // it's consumers responsiblity to release chunks after consumption. + // + // ReferenceCountUtil.release(bb); + // } + // + emitted = true; + } else { + emitted = false; + } + if (d) { + if (error != null) { + subscriber.onError(error); + // exit without reducing wip so that further drains will be NOOP + return; + } else { + subscriber.onComplete(); + // exit without reducing wip so that further drains will be NOOP + return; + } + } + if (emitted) { + // do this after checking d to avoid calling read + // when done + Operators.produced(REQUESTED, this, 1); + // + doRead(); + } + } + missed = WIP.addAndGet(this, -missed); + if (missed == 0) { + return; + } + } + } + + private void doRead() { + // use local variable to limit volatile reads + long pos = position; + int readSize = Math.min(chunkSize, maxRequired(pos)); + ByteBuf innerBuf = alloc.buffer(readSize, readSize); + fileChannel.read(innerBuf.nioBuffer(0, readSize), pos, innerBuf, this); + } + + private int maxRequired(long pos) { + long maxRequired = offset + length - pos; + if (maxRequired <= 0) { + return 0; + } else { + int m = (int) (maxRequired); + // support really large files by checking for overflow + if (m < 0) { + return Integer.MAX_VALUE; + } else { + return m; + } + } + } + } + } +} diff --git a/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/NettyFluxTests.java b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/NettyFluxTests.java new file mode 100644 index 000000000000..7d279bd8ba46 --- /dev/null +++ b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/NettyFluxTests.java @@ -0,0 +1,435 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.netty.implementation; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpMethod; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.implementation.http.PagedResponseBase; +import com.azure.core.implementation.util.FluxUtil; +import com.azure.core.util.Context; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import io.netty.handler.codec.http.HttpResponseStatus; +import io.netty.util.ReferenceCountUtil; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; +import reactor.core.Exceptions; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.io.BufferedOutputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.nio.channels.AsynchronousFileChannel; +import java.nio.charset.StandardCharsets; +import java.nio.file.StandardOpenOption; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class NettyFluxTests { + + @Test + public void testCanReadSlice() throws IOException { + File file = createFileIfNotExist("target/test1"); + FileOutputStream stream = new FileOutputStream(file); + stream.write("hello there".getBytes(StandardCharsets.UTF_8)); + stream.close(); + + try (AsynchronousFileChannel channel = AsynchronousFileChannel.open(file.toPath(), StandardOpenOption.READ)) { + byte[] bytes = NettyFluxTestUtils.byteBufStreamFromFile(channel, 1, 3) + .map(bb -> { + byte[] bt = toBytes(bb); + ReferenceCountUtil.release(bb); + return bt; + }) + .collect(() -> new ByteArrayOutputStream(), + (bos, b) -> { + try { + bos.write(b); + } catch (IOException ioe) { + throw Exceptions.propagate(ioe); + } + }) + .block() + .toByteArray(); + assertEquals("ell", new String(bytes, StandardCharsets.UTF_8)); + } catch (IOException ioe) { + + } + + } + + @Test + public void testCanReadEmptyFile() throws IOException { + File file = createFileIfNotExist("target/test2"); + + try (AsynchronousFileChannel channel = AsynchronousFileChannel.open(file.toPath(), StandardOpenOption.READ)) { + byte[] bytes = NettyFluxTestUtils.byteBufStreamFromFile(channel, 1, 3) + .map(bb -> { + byte[] bt = bb.array(); + ReferenceCountUtil.release(bb); + return bt; + }) + .collect(() -> new ByteArrayOutputStream(), + (bos, b) -> { + try { + bos.write(b); + } catch (IOException ioe) { + throw Exceptions.propagate(ioe); + } + }) + .block().toByteArray(); + assertEquals(0, bytes.length); + } + assertTrue(file.delete()); + } + + @Test + public void testAsynchronyShortInput() throws IOException { + File file = createFileIfNotExist("target/test3"); + FileOutputStream stream = new FileOutputStream(file); + stream.write("hello there".getBytes(StandardCharsets.UTF_8)); + stream.close(); + try (AsynchronousFileChannel channel = AsynchronousFileChannel.open(file.toPath(), StandardOpenOption.READ)) { + byte[] bytes = FluxUtil.readFile(channel) + .map(bb -> { + byte[] bt = new byte[bb.remaining()]; + bb.get(bt); + return bt; + }) + .limitRequest(1) + .subscribeOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) + .publishOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) + .collect(() -> new ByteArrayOutputStream(), + (bos, b) -> { + try { + bos.write(b); + } catch (IOException ioe) { + throw Exceptions.propagate(ioe); + } + }) + .block() + .toByteArray(); + assertEquals("hello there", new String(bytes, StandardCharsets.UTF_8)); + } + assertTrue(file.delete()); + } + + private static final int NUM_CHUNKS_IN_LONG_INPUT = 10_000_000; + + @Test + public void testAsynchronyLongInput() throws IOException, NoSuchAlgorithmException { + File file = createFileIfNotExist("target/test4"); + byte[] array = "1234567690".getBytes(StandardCharsets.UTF_8); + MessageDigest digest = MessageDigest.getInstance("MD5"); + try (BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file))) { + for (int i = 0; i < NUM_CHUNKS_IN_LONG_INPUT; i++) { + out.write(array); + digest.update(array); + } + } + System.out.println("long input file size=" + file.length() / (1024 * 1024) + "MB"); + byte[] expected = digest.digest(); + digest.reset(); + try (AsynchronousFileChannel channel = AsynchronousFileChannel.open(file.toPath(), StandardOpenOption.READ)) { + FluxUtil.readFile(channel) + .subscribeOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) + .publishOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) + .toIterable().forEach(digest::update); + + assertArrayEquals(expected, digest.digest()); + } + assertTrue(file.delete()); + } + + @Test + @Ignore("Need to sync with smaldini to find equivalent for rx.test.awaitDone") + public void testBackpressureLongInput() throws IOException, NoSuchAlgorithmException { +// File file = new File("target/test4"); +// byte[] array = "1234567690".getBytes(StandardCharsets.UTF_8); +// MessageDigest digest = MessageDigest.getInstance("MD5"); +// try (BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file))) { +// for (int i = 0; i < NUM_CHUNKS_IN_LONG_INPUT; i++) { +// out.write(array); +// digest.update(array); +// } +// } +// byte[] expected = digest.digest(); +// digest.reset(); +// +// try (AsynchronousFileChannel channel = AsynchronousFileChannel.open(file.toPath(), StandardOpenOption.READ)) { +// FluxUtil1.byteBufferStreamFromFile(channel) +// .rebatchRequests(1) +// .subscribeOn(Schedulers.io()) +// .observeOn(Schedulers.io()) +// .doOnNext(bb -> digest.update(bb)) +// .test(0) +// .assertNoValues() +// .requestMore(1) +// .awaitCount(1) +// .assertValueCount(1) +// .requestMore(1) +// .awaitCount(2) +// .assertValueCount(2) +// .requestMore(Long.MAX_VALUE) +// .awaitDone(20, TimeUnit.SECONDS) +// .assertComplete(); +// } +// +// assertArrayEquals(expected, digest.digest()); +// assertTrue(file.delete()); + } + + @Test + public void testSplitForMultipleSplitSizesFromOneTo16() throws NoSuchAlgorithmException { + ByteBuf bb = null; + try { + bb = Unpooled.directBuffer(1000); + byte[] oneByte = new byte[1]; + for (int i = 0; i < 1000; i++) { + oneByte[0] = (byte) i; + bb.writeBytes(oneByte); + } + MessageDigest digest = MessageDigest.getInstance("MD5"); + digest.update(bb.nioBuffer()); + byte[] expected = digest.digest(); + for (int size = 1; size < 16; size++) { + System.out.println("size=" + size); + digest.reset(); + bb.readerIndex(0); + // + NettyFluxTestUtils.split(bb, 3) + .doOnNext(b -> digest.update(b.nioBuffer())) + .subscribe(); +// +// StepVerifier.create(FluxUtil1.split(bb, 3).doOnNext(b -> digest.update(b))) +// .expectNextCount(?) // TODO: ? is Unknown. Check with smaldini - what is the Verifier way to ignore all next calls and simply check stream completes? +// .verifyComplete(); +// + assertArrayEquals(expected, digest.digest()); + } + } finally { + if (bb != null) { + bb.release(); + } + } + } + + @Test + public void testSplitOnEmptyContent() { + ByteBuf bb = null; + try { + bb = Unpooled.directBuffer(16); + StepVerifier.create(NettyFluxTestUtils.split(bb, 3)) + .expectNextCount(0) + .expectComplete() + .verify(); + } finally { + if (bb != null) { + bb.release(); + } + } + } + +// @Test +// public void toByteArrayWithEmptyByteBuffer() { +// assertArrayEquals(new byte[0], byteBufToArray(Unpooled.wrappedBuffer(new byte[0]))); +// } +// +// @Test +// public void toByteArrayWithNonEmptyByteBuffer() { +// final ByteBuf byteBuffer = Unpooled.wrappedBuffer(new byte[] { 0, 1, 2, 3, 4 }); +// assertEquals(5, byteBuffer.readableBytes()); +// final byte[] byteArray = byteBufToArray(byteBuffer); +// assertArrayEquals(new byte[] { 0, 1, 2, 3, 4 }, byteArray); +// assertEquals(5, byteBuffer.readableBytes()); +// } +// +// @Test +// public void testCollectByteBufStream() { +// Flux byteBufFlux = Flux +// .just(Unpooled.copyInt(1), Unpooled.copyInt(255), Unpooled.copyInt(256)); +// Mono result = collectByteBufStream(byteBufFlux, false); +// byte[] bytes = ByteBufUtil.getBytes(result.block()); +// assertEquals(12, bytes.length); +// assertArrayEquals(new byte[]{ +// 0, 0, 0, 1, +// 0, 0, 0, (byte) 255, +// 0, 0, 1, 0}, bytes); +// } +// +// @Test +// public void testToMono() { +// String value = "test"; +// Assert.assertEquals(getMonoRestResponse(value).flatMap(FluxUtil::toMono).block(), value); +// Assert.assertEquals(getMonoRestResponse("").flatMap(FluxUtil::toMono).block(), ""); +// } + + @Test + public void testCallWithContextGetSingle() { + String response = getSingle("Hello, ") + .subscriberContext(reactor.util.context.Context.of("FirstName", "Foo", "LastName", "Bar")) + .block(); + Assert.assertEquals("Hello, Foo Bar", response); + } + + @Test + public void testCallWithContextGetCollection() { + List expectedLines = Arrays.asList("Hello,", "Foo", "Bar"); + List actualLines = new ArrayList<>(); + getCollection("Hello, ") + .subscriberContext(reactor.util.context.Context.of("FirstName", "Foo", "LastName", "Bar")) + .doOnNext(line -> actualLines.add(line)) + .subscribe(); + Assert.assertEquals(expectedLines, actualLines); + } + + @Test + public void testCallWithContextGetPagedCollection() throws Exception { + // Simulates the customer code that includes context + getPagedCollection() + .subscriberContext( + reactor.util.context.Context.of("Key1", "Val1", "Key2", "Val2")) + .doOnNext(System.out::println) + .subscribe(); + } + + private PagedFlux getPagedCollection() + throws Exception { + // Simulates the client library API + List> pagedResponses = getPagedResponses(4); + return new PagedFlux<>( + () -> FluxUtil.withContext(context -> getFirstPage(pagedResponses, context)), + continuationToken -> FluxUtil + .withContext(context -> getNextPage(continuationToken, pagedResponses, context))); + } + + private List> getPagedResponses(int noOfPages) + throws MalformedURLException { + HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1") + .put("header2", "value2"); + HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, new URL("http://localhost")); + String deserializedHeaders = "header1,value1,header2,value2"; + return IntStream.range(0, noOfPages) + .boxed() + .map(i -> createPagedResponse(httpRequest, httpHeaders, deserializedHeaders, i, noOfPages)) + .collect(Collectors.toList()); + } + + private Mono> getFirstPage(List> pagedResponses, + Context context) { + // Simulates the service side code which should get the context provided by customer code + Assert.assertEquals("Val1", context.getData("Key1").get()); + return pagedResponses.isEmpty() ? Mono.empty() : Mono.just(pagedResponses.get(0)); + } + + private Mono> getNextPage(String continuationToken, + List> pagedResponses, Context context) { + // Simulates the service side code which should get the context provided by customer code + Assert.assertEquals("Val2", context.getData("Key2").get()); + if (continuationToken == null || continuationToken.isEmpty()) { + return Mono.empty(); + } + return Mono.just(pagedResponses.get(Integer.valueOf(continuationToken))); + } + + private PagedResponseBase createPagedResponse(HttpRequest httpRequest, + HttpHeaders httpHeaders, String deserializedHeaders, int i, int noOfPages) { + return new PagedResponseBase<>(httpRequest, HttpResponseStatus.OK.code(), + httpHeaders, + getItems(i), + i < noOfPages - 1 ? String.valueOf(i + 1) : null, + deserializedHeaders); + } + + private List getItems(Integer i) { + return IntStream.range(i * 3, i * 3 + 3).boxed().collect(Collectors.toList()); + } + + + private Mono getSingle(String prefix) { + return FluxUtil.withContext(context -> serviceCallSingle(prefix, context)); + } + + private Flux getCollection(String prefix) { + return FluxUtil + .fluxContext(context -> serviceCallCollection(prefix, context)); + } + + private Mono serviceCallSingle(String prefix, Context context) { + String msg = prefix + + context.getData("FirstName").orElse("Stranger") + + " " + + context.getData("LastName").orElse(""); + return Mono.just(msg); + } + + private Flux serviceCallCollection(String prefix, Context context) { + String msg = prefix + + context.getData("FirstName").orElse("Stranger") + + " " + + context.getData("LastName").orElse(""); + + return Flux.just(msg.split(" ")); + } +// + private static byte[] toBytes(ByteBuf bb) { + byte[] bytes = new byte[bb.readableBytes()]; + bb.readBytes(bytes); + return bytes; + } + + private File createFileIfNotExist(String fileName) throws IOException { + File file = new File(fileName); + if (file.getParentFile() != null) { + file.getParentFile().mkdirs(); + } + file.createNewFile(); + return file; + } + + private Mono> getMonoRestResponse(T value) { + Response response = new Response() { + @Override + public int getStatusCode() { + return 200; + } + + @Override + public HttpHeaders getHeaders() { + return null; + } + + @Override + public HttpRequest getRequest() { + return null; + } + + @Override + public T getValue() { + return value; + } + }; + return Mono.just(response); + } +} diff --git a/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/RestProxyWithHttpProxyNettyTests.java b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/RestProxyWithHttpProxyNettyTests.java new file mode 100644 index 000000000000..448d0e9beb70 --- /dev/null +++ b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/RestProxyWithHttpProxyNettyTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.netty.implementation; + +import com.azure.core.http.HttpClient; +import com.azure.core.http.ProxyOptions; +import com.azure.core.http.netty.NettyAsyncHttpClientBuilder; +import com.azure.core.implementation.RestProxyTests; +import org.junit.Ignore; + +import java.net.InetSocketAddress; + +@Ignore("Should only be run manually when a local proxy server (e.g. Fiddler) is running") +public class RestProxyWithHttpProxyNettyTests extends RestProxyTests { + + @Override + protected HttpClient createHttpClient() { + InetSocketAddress address = new InetSocketAddress("localhost", 8888); + return new NettyAsyncHttpClientBuilder().proxy(new ProxyOptions(ProxyOptions.Type.HTTP, address)).build(); + } +} diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyWithNettyTests.java b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/RestProxyWithNettyTests.java similarity index 75% rename from sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyWithNettyTests.java rename to sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/RestProxyWithNettyTests.java index d5fec7bdffbd..6e879462f09b 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyWithNettyTests.java +++ b/sdk/core/azure-core-http-netty/src/test/java/com/azure/core/http/netty/implementation/RestProxyWithNettyTests.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.core.implementation; +package com.azure.core.http.netty.implementation; import com.azure.core.http.HttpClient; +import com.azure.core.implementation.RestProxyTests; public class RestProxyWithNettyTests extends RestProxyTests { diff --git a/sdk/core/azure-core-http-netty/src/test/resources/upload.txt b/sdk/core/azure-core-http-netty/src/test/resources/upload.txt new file mode 100644 index 000000000000..ff3bb63948b4 --- /dev/null +++ b/sdk/core/azure-core-http-netty/src/test/resources/upload.txt @@ -0,0 +1 @@ +The quick brown fox jumps over the lazy dog \ No newline at end of file diff --git a/sdk/core/azure-core-http-okhttp/README.md b/sdk/core/azure-core-http-okhttp/README.md new file mode 100644 index 000000000000..c02a1301e729 --- /dev/null +++ b/sdk/core/azure-core-http-okhttp/README.md @@ -0,0 +1,38 @@ +# Azure Core OkHttp HTTP client library for Java + +Azure Core OkHttp HTTP client is a plugin for the azure-core HTTP client API. + +## Getting started + +### Prerequisites + +- Java Development Kit (JDK) with version 8 or above + +### Adding the package to your product + +```xml + + com.azure + azure-core-http-okhttp + 1.0.0-preview.4 + +``` + +## Key concepts + +## Examples + +## Troubleshooting + +## Next steps + +## Contributing + +If you would like to become an active contributor to this project please follow the instructions provided in [Microsoft +Azure Projects Contribution Guidelines](http://azure.github.io/guidelines.html). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request diff --git a/sdk/core/azure-core-http-okhttp/pom.xml b/sdk/core/azure-core-http-okhttp/pom.xml new file mode 100644 index 000000000000..f6b828917a54 --- /dev/null +++ b/sdk/core/azure-core-http-okhttp/pom.xml @@ -0,0 +1,96 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.4.0 + ../../../pom.client.xml + + + com.azure + azure-core-http-okhttp + jar + 1.0.0-preview.5 + + Microsoft Azure OkHttp HTTP Client Library + This package contains the OkHttp HTTP client plugin for azure-core. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + + azure-java-build-docs + ${site.url}/site/${project.artifactId} + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:https://github.com/Azure/azure-sdk-for-java.git + scm:git:https://github.com/Azure/azure-sdk-for-java.git + + + + UTF-8 + + + + + + + microsoft + Microsoft + + + + + + com.azure + azure-core + 1.0.0-preview.5 + + + + com.squareup.okhttp3 + okhttp + + + + + com.azure + azure-core + 1.0.0-preview.5 + test-jar + test + + + io.projectreactor + reactor-test + test + + + + junit + junit + test + + + + com.github.tomakehurst + wiremock-standalone + test + + + diff --git a/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/OkHttpAsyncHttpClient.java b/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/OkHttpAsyncHttpClient.java new file mode 100644 index 000000000000..6e1794f20b14 --- /dev/null +++ b/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/OkHttpAsyncHttpClient.java @@ -0,0 +1,320 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.okhttp; + +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpMethod; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import okhttp3.Headers; +import okhttp3.MediaType; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import okio.ByteString; +import reactor.core.Exceptions; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.core.publisher.MonoSink; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.util.HashMap; +import java.util.Objects; +import java.util.function.Function; + +/** + * HttpClient implementation for OkHttp. + */ +class OkHttpAsyncHttpClient implements HttpClient { + private final OkHttpClient httpClient; + // + private static final Mono EMPTY_BYTE_STRING_MONO = Mono.just(okio.ByteString.EMPTY); + private static final MediaType MEDIA_TYPE_OCTET_STREAM = MediaType.parse("application/octet-stream"); + + OkHttpAsyncHttpClient(OkHttpClient httpClient) { + this.httpClient = httpClient; + } + + @Override + public Mono send(HttpRequest request) { + return Mono.create(sink -> sink.onRequest(value -> { + // Using MonoSink::onRequest for back pressure support. + + // The blocking behavior toOkHttpRequest(r).subscribe call: + // + // The okhttp3.Request emitted by toOkHttpRequest(r) is chained from the body of request Flux: + // 1. If Flux synchronous and send(r) caller does not apply subscribeOn then + // subscribe block on caller thread. + // 2. If Flux synchronous and send(r) caller apply subscribeOn then + // does not block caller thread but block on scheduler thread. + // 3. If Flux asynchronous then subscribe does not block caller thread + // but block on the thread backing flux. This ignore any subscribeOn applied to send(r) + // + toOkHttpRequest(request).subscribe(okHttpRequest -> { + httpClient.newCall(okHttpRequest).enqueue(new OkHttpCallback(sink, request)); + }, sink::error); + })); + } + + /** + * Converts the given azure-core request to okhttp request. + * + * @param request the azure-core request + * @return the Mono emitting okhttp request + */ + private static Mono toOkHttpRequest(HttpRequest request) { + return Mono.just(new okhttp3.Request.Builder()) + .map(rb -> { + rb.url(request.getUrl()); + if (request.getHeaders() != null) { + return rb.headers(okhttp3.Headers.of(request.getHeaders().toMap())); + } else { + return rb.headers(okhttp3.Headers.of(new HashMap<>())); + } + }) + .flatMap((Function>) rb -> { + if (request.getHttpMethod() == HttpMethod.GET) { + return Mono.just(rb.get()); + } else if (request.getHttpMethod() == HttpMethod.HEAD) { + return Mono.just(rb.head()); + } else { + return toOkHttpRequestBody(request.getBody(), request.getHeaders()) + .map(requestBody -> rb.method(request.getHttpMethod().toString(), requestBody)); + } + }) + .map(rb -> rb.build()); + } + + /** + * Create a Mono of okhttp3.RequestBody from the given java.nio.ByteBuffer Flux. + * + * @param bbFlux stream of java.nio.ByteBuffer representing request content + * @param headers the headers associated with the original request + * @return the Mono emitting okhttp3.RequestBody + */ + private static Mono toOkHttpRequestBody(Flux bbFlux, HttpHeaders headers) { + Mono bsMono = bbFlux == null + ? EMPTY_BYTE_STRING_MONO + : toByteString(bbFlux); + + return bsMono.map(bs -> { + String contentType = headers.value("Content-Type"); + if (contentType == null) { + return RequestBody.create(bs, MEDIA_TYPE_OCTET_STREAM); + } else { + return RequestBody.create(bs, MediaType.parse(contentType)); + } + }); + } + + /** + * Aggregate Flux of java.nio.ByteBuffer to single okio.ByteString. + * + * Pooled okio.Buffer type is used to buffer emitted ByteBuffer instances. + * Content of each ByteBuffer will be written (i.e copied) to the internal okio.Buffer slots. + * Once the stream terminates, the contents of all slots get copied to one single byte array + * and okio.ByteString will be created referring this byte array. + * Finally the initial okio.Buffer will be returned to the pool. + * + * @param bbFlux the Flux of ByteBuffer to aggregate + * @return a mono emitting aggregated ByteString + */ + private static Mono toByteString(Flux bbFlux) { + Objects.requireNonNull(bbFlux); + return Mono.using(okio.Buffer::new, + buffer -> bbFlux.reduce(buffer, (b, byteBuffer) -> { + try { + b.write(byteBuffer); + return b; + } catch (IOException ioe) { + throw Exceptions.propagate(ioe); + } + }) + .map(b -> ByteString.of(b.readByteArray())), + okio.Buffer::clear) + .switchIfEmpty(EMPTY_BYTE_STRING_MONO); + } + + private static class OkHttpCallback implements okhttp3.Callback { + private final MonoSink sink; + private final HttpRequest request; + + OkHttpCallback(MonoSink sink, HttpRequest request) { + this.sink = sink; + this.request = request; + } + + @Override + public void onFailure(okhttp3.Call call, IOException e) { + sink.error(e); + } + + @Override + public void onResponse(okhttp3.Call call, okhttp3.Response response) { + sink.success(new OkHttpResponse(response, request)); + } + } + + /** + * An implementation of {@link HttpResponse} for OkHttp. + */ + private static class OkHttpResponse extends HttpResponse { + private final int statusCode; + private final HttpHeaders headers; + private final Mono responseBodyMono; + // using 4K as default buffer size: https://stackoverflow.com/a/237495/1473510 + private static final int BYTE_BUFFER_CHUNK_SIZE = 4096; + + OkHttpResponse(Response innerResponse, HttpRequest request) { + this.statusCode = innerResponse.code(); + this.headers = fromOkHttpHeaders(innerResponse.headers()); + if (innerResponse.body() == null) { + // innerResponse.body() getter will not return null for server returned responses. + // It can be null: + // [a]. if response is built manually with null body (e.g for mocking) + // [b]. for the cases described here + // [ref](https://square.github.io/okhttp/4.x/okhttp/okhttp3/-response/body/). + // + this.responseBodyMono = Mono.empty(); + } else { + this.responseBodyMono = Mono.using(() -> innerResponse.body(), + rb -> Mono.just(rb), + // Resource cleanup + // square.github.io/okhttp/4.x/okhttp/okhttp3/-response-body/#the-response-body-must-be-closed + ResponseBody::close); + } + super.setRequest(request); + } + + @Override + public int getStatusCode() { + return this.statusCode; + } + + @Override + public String getHeaderValue(String name) { + return this.headers.value(name); + } + + @Override + public HttpHeaders getHeaders() { + return this.headers; + } + + @Override + public Flux getBody() { + return this.responseBodyMono + .flatMapMany(irb -> toFluxByteBuffer(irb.byteStream())); + } + + @Override + public Mono getBodyAsByteArray() { + return this.responseBodyMono + .flatMap(rb -> { + try { + byte[] content = rb.bytes(); + return content.length == 0 ? Mono.empty() : Mono.just(content); + } catch (IOException ioe) { + throw Exceptions.propagate(ioe); + } + }); + } + + @Override + public Mono getBodyAsString() { + return this.responseBodyMono + .flatMap(rb -> { + try { + String content = rb.string(); + return content.length() == 0 ? Mono.empty() : Mono.just(content); + } catch (IOException ioe) { + throw Exceptions.propagate(ioe); + } + }); + } + + @Override + public Mono getBodyAsString(Charset charset) { + return getBodyAsByteArray() + .map(bytes -> new String(bytes, charset)); + } + + @Override + public void close() { + this.responseBodyMono.subscribe().dispose(); + } + + /** + * Creates azure-core HttpHeaders from okhttp headers. + * + * @param headers okhttp headers + * @return azure-core HttpHeaders + */ + private static HttpHeaders fromOkHttpHeaders(Headers headers) { + HttpHeaders httpHeaders = new HttpHeaders(); + for (String headerName : headers.names()) { + httpHeaders.put(headerName, headers.get(headerName)); + } + return httpHeaders; + } + + /** + * Creates a Flux of ByteBuffer, with each ByteBuffer wrapping bytes read from the given + * InputStream. + * + * @param inputStream InputStream to back the Flux + * @return Flux of ByteBuffer backed by the InputStream + */ + private static Flux toFluxByteBuffer(InputStream inputStream) { + Pair pair = new Pair(); + return Flux.just(true) + .repeat() + .map(ignore -> { + byte[] buffer = new byte[BYTE_BUFFER_CHUNK_SIZE]; + try { + int numBytes = inputStream.read(buffer); + if (numBytes > 0) { + return pair.buffer(ByteBuffer.wrap(buffer, 0, numBytes)).readBytes(numBytes); + } else { + return pair.buffer(null).readBytes(numBytes); + } + } catch (IOException ioe) { + throw Exceptions.propagate(ioe); + } + }) + .takeUntil(p -> p.readBytes() == -1) + .filter(p -> p.readBytes() > 0) + .map(Pair::buffer); + } + + private static class Pair { + private ByteBuffer byteBuffer; + private int readBytes; + + ByteBuffer buffer() { + return this.byteBuffer; + } + + int readBytes() { + return this.readBytes; + } + + Pair buffer(ByteBuffer byteBuffer) { + this.byteBuffer = byteBuffer; + return this; + } + + Pair readBytes(int cnt) { + this.readBytes = cnt; + return this; + } + } + } +} diff --git a/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/OkHttpAsyncHttpClientBuilder.java b/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/OkHttpAsyncHttpClientBuilder.java new file mode 100644 index 000000000000..31a5a1652ae4 --- /dev/null +++ b/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/OkHttpAsyncHttpClientBuilder.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.okhttp; + +import com.azure.core.http.HttpClient; +import okhttp3.Authenticator; +import okhttp3.ConnectionPool; +import okhttp3.Dispatcher; +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; + +import java.time.Duration; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * Builder to configure and build an implementation of {@link HttpClient} for OkHttp. + */ +public class OkHttpAsyncHttpClientBuilder { + private final okhttp3.OkHttpClient okHttpClient; + + private static final Duration DEFAULT_READ_TIMEOUT = Duration.ofSeconds(120); + private static final Duration DEFAULT_CONNECT_TIMEOUT = Duration.ofSeconds(60); + + private List networkInterceptors = new ArrayList<>(); + private Duration readTimeout; + private Duration connectionTimeout; + private ConnectionPool connectionPool; + private Dispatcher dispatcher; + private java.net.Proxy proxy; + private Authenticator proxyAuthenticator; + + /** + * Creates OkHttpAsyncHttpClientBuilder. + */ + public OkHttpAsyncHttpClientBuilder() { + this.okHttpClient = null; + } + + /** + * Creates OkHttpAsyncHttpClientBuilder from the builder of an existing OkHttpClient. + * + * @param okHttpClient the httpclient + */ + public OkHttpAsyncHttpClientBuilder(OkHttpClient okHttpClient) { + this.okHttpClient = Objects.requireNonNull(okHttpClient, "okHttpClient cannot be null."); + } + + /** + * Add a network layer interceptor to Http request pipeline. + * + * @param networkInterceptor the interceptor to add + * @return the updated OkHttpAsyncHttpClientBuilder object + */ + public OkHttpAsyncHttpClientBuilder addNetworkInterceptor(Interceptor networkInterceptor) { + Objects.requireNonNull(networkInterceptor); + this.networkInterceptors.add(networkInterceptor); + return this; + } + + /** + * Add network layer interceptors to Http request pipeline. + * + * This replaces all previously-set interceptors. + * + * @param networkInterceptors the interceptors to add + * @return the updated OkHttpAsyncHttpClientBuilder object + */ + public OkHttpAsyncHttpClientBuilder setNetworkInterceptors(List networkInterceptors) { + this.networkInterceptors = Objects.requireNonNull(networkInterceptors, "networkInterceptors cannot be null."); + return this; + } + + /** + * Sets the read timeout. + * + * The default read timeout is 120 seconds. + * + * @param readTimeout the read timeout + * @return the updated OkHttpAsyncHttpClientBuilder object + */ + public OkHttpAsyncHttpClientBuilder setReadTimeout(Duration readTimeout) { + // setReadTimeout can be null + this.readTimeout = readTimeout; + return this; + } + + /** + * Sets the connection timeout. + * + * The default connection timeout is 60 seconds. + * + * @param connectionTimeout the connection timeout + * @return the updated OkHttpAsyncHttpClientBuilder object + */ + public OkHttpAsyncHttpClientBuilder setConnectionTimeout(Duration connectionTimeout) { + // setConnectionTimeout can be null + this.connectionTimeout = connectionTimeout; + return this; + } + + /** + * Sets the Http connection pool. + * + * @param connectionPool the OkHttp connection pool to use + * @return the updated OkHttpAsyncHttpClientBuilder object + */ + public OkHttpAsyncHttpClientBuilder setConnectionPool(ConnectionPool connectionPool) { + // Null ConnectionPool is not allowed + this.connectionPool = Objects.requireNonNull(connectionPool, "connectionPool cannot be null."); + return this; + } + + /** + * Sets the dispatcher that also composes the thread pool for executing HTTP requests. + * + * @param dispatcher the dispatcher to use + * @return the updated OkHttpAsyncHttpClientBuilder object + */ + public OkHttpAsyncHttpClientBuilder setDispatcher(Dispatcher dispatcher) { + // Null Dispatcher is not allowed + this.dispatcher = Objects.requireNonNull(dispatcher, "dispatcher cannot be null."); + return this; + } + + /** + * Sets the proxy. + * + * @param proxy the proxy + * @return the updated OkHttpAsyncHttpClientBuilder object + */ + public OkHttpAsyncHttpClientBuilder setProxy(java.net.Proxy proxy) { + // Proxy can be null + this.proxy = proxy; + return this; + } + + /** + * Sets the proxy authenticator. + * + * @param proxyAuthenticator the proxy authenticator + * @return the updated OkHttpAsyncHttpClientBuilder object + */ + public OkHttpAsyncHttpClientBuilder setProxyAuthenticator(Authenticator proxyAuthenticator) { + // Null Authenticator is not allowed + this.proxyAuthenticator = Objects.requireNonNull(proxyAuthenticator, "proxyAuthenticator cannot be null."); + return this; + } + + /** + * Build a HttpClient with current configurations. + * + * @return a {@link HttpClient}. + */ + public HttpClient build() { + OkHttpClient.Builder httpClientBuilder = this.okHttpClient == null + ? new OkHttpClient.Builder() + : this.okHttpClient.newBuilder(); + // + for (Interceptor interceptor : this.networkInterceptors) { + httpClientBuilder = httpClientBuilder.addNetworkInterceptor(interceptor); + } + if (this.readTimeout != null) { + httpClientBuilder = httpClientBuilder.readTimeout(this.readTimeout); + } else { + httpClientBuilder = httpClientBuilder.readTimeout(DEFAULT_READ_TIMEOUT); + } + if (this.connectionTimeout != null) { + httpClientBuilder = httpClientBuilder.connectTimeout(this.connectionTimeout); + } else { + httpClientBuilder = httpClientBuilder.connectTimeout(DEFAULT_CONNECT_TIMEOUT); + } + if (this.connectionPool != null) { + httpClientBuilder = httpClientBuilder.connectionPool(connectionPool); + } + if (this.dispatcher != null) { + httpClientBuilder = httpClientBuilder.dispatcher(dispatcher); + } + httpClientBuilder = httpClientBuilder.proxy(this.proxy); + if (this.proxyAuthenticator != null) { + httpClientBuilder = httpClientBuilder.authenticator(this.proxyAuthenticator); + } + return new OkHttpAsyncHttpClient(httpClientBuilder.build()); + } +} diff --git a/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/implementation/OkHttpClientProvider.java b/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/implementation/OkHttpClientProvider.java new file mode 100644 index 000000000000..43e17da71702 --- /dev/null +++ b/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/implementation/OkHttpClientProvider.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.okhttp.implementation; + +import com.azure.core.http.HttpClient; +import com.azure.core.http.okhttp.OkHttpAsyncHttpClientBuilder; +import com.azure.core.implementation.http.spi.HttpClientProvider; + +public class OkHttpClientProvider implements HttpClientProvider { + + @Override + public HttpClient createInstance() { + return new OkHttpAsyncHttpClientBuilder().build(); + } +} diff --git a/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/package-info.java b/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/package-info.java new file mode 100644 index 000000000000..c6948efc4659 --- /dev/null +++ b/sdk/core/azure-core-http-okhttp/src/main/java/com/azure/core/http/okhttp/package-info.java @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +/** + * Package containing OkHttp HTTP client plugin for azure-core. + */ +package com.azure.core.http.okhttp; diff --git a/sdk/core/azure-core-http-okhttp/src/main/resources/META-INF/services/com.azure.core.implementation.http.spi.HttpClientProvider b/sdk/core/azure-core-http-okhttp/src/main/resources/META-INF/services/com.azure.core.implementation.http.spi.HttpClientProvider new file mode 100644 index 000000000000..405d6aa951dd --- /dev/null +++ b/sdk/core/azure-core-http-okhttp/src/main/resources/META-INF/services/com.azure.core.implementation.http.spi.HttpClientProvider @@ -0,0 +1 @@ +com.azure.core.http.okhttp.implementation.OkHttpClientProvider diff --git a/sdk/core/azure-core-http-okhttp/src/samples/java/com/azure/core/http/okhttp/OkHttpAsyncHttpClientBuilderJavaDocCodeSnippets.java b/sdk/core/azure-core-http-okhttp/src/samples/java/com/azure/core/http/okhttp/OkHttpAsyncHttpClientBuilderJavaDocCodeSnippets.java new file mode 100644 index 000000000000..651856a0544a --- /dev/null +++ b/sdk/core/azure-core-http-okhttp/src/samples/java/com/azure/core/http/okhttp/OkHttpAsyncHttpClientBuilderJavaDocCodeSnippets.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.okhttp; + +import com.azure.core.http.HttpClient; +import okhttp3.Credentials; +import okhttp3.OkHttpClient; + +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.time.Duration; + +/** + * Code snippets for {@link OkHttpAsyncHttpClientBuilder} + */ +public class OkHttpAsyncHttpClientBuilderJavaDocCodeSnippets { + + private void simpleInstantiation() { + + // BEGIN: com.azure.core.http.okhttp.instantiation-simple + HttpClient client = new OkHttpAsyncHttpClientBuilder() + .build(); + // END: com.azure.core.http.okhttp.instantiation-simple + } + + private void proxySample() { + + // BEGIN: com.azure.core.http.okhttp.OkHttpAsyncHttpClientBuilder#setProxy + final String proxyHost = ""; // e.g. localhost + final int proxyPort = 9999; // Proxy port + Proxy proxy = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress(proxyHost, proxyPort)); + HttpClient client = new OkHttpAsyncHttpClientBuilder() + .setProxy(proxy) + .build(); + // END: com.azure.core.http.okhttp.OkHttpAsyncHttpClientBuilder#setProxy + + } + + private void proxyBasicAuthenticationSample() { + + // BEGIN: com.azure.core.http.okhttp.OkHttpAsyncHttpClientBuilder#setProxyAuthenticator + final String proxyHost = ""; // e.g. localhost + final int proxyPort = 9999; // Proxy port + final String proxyUser = ""; + final String proxyPassword = ""; + // + Proxy proxy = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress(proxyHost, proxyPort)); + HttpClient client = new OkHttpAsyncHttpClientBuilder() + .setProxy(proxy) + .setProxyAuthenticator((route, response) -> { + String credential = Credentials.basic(proxyUser, proxyPassword); + return response.request().newBuilder() + .header("Proxy-Authorization", credential) + .build(); + }) + .build(); + // END: com.azure.core.http.okhttp.OkHttpAsyncHttpClientBuilder#setProxyAuthenticator + + } + + private void connectionTimeoutSample() { + + // BEGIN: com.azure.core.http.okhttp.OkHttpAsyncHttpClientBuilder#setConnectionTimeout + final Duration connectionTimeout = Duration.ofSeconds(250); // connection timeout of 250 seconds + HttpClient client = new OkHttpAsyncHttpClientBuilder() + .setConnectionTimeout(connectionTimeout) + .build(); + // END: com.azure.core.http.okhttp.OkHttpAsyncHttpClientBuilder#setConnectionTimeout + + } + + private void readTimeoutTimeoutSample() { + + // BEGIN: com.azure.core.http.okhttp.OkHttpAsyncHttpClientBuilder#setConnectionTimeout + final Duration readTimeout = Duration.ofSeconds(100); // read timeout of 100 seconds + HttpClient client = new OkHttpAsyncHttpClientBuilder() + .setReadTimeout(readTimeout) + .build(); + // END: com.azure.core.http.okhttp.OkHttpAsyncHttpClientBuilder#setConnectionTimeout + + } + + private void usingExistingHttpClientSample() { + + // BEGIN: com.azure.core.http.okhttp.using-existing-okhttp + // Create an OkHttpClient with connection timeout of 250 seconds. + OkHttpClient okHttpClient = new OkHttpClient().newBuilder() + .connectTimeout(Duration.ofSeconds(250)) + .build(); + // Use "okHttpClient" instance to create an azure-core HttpClient "client". + // Both "okHttpClient" and "client" share same underlying resources such as + // connection pool, thread pool. + // "client" inherits connection timeout settings and add proxy. + HttpClient client = new OkHttpAsyncHttpClientBuilder(okHttpClient) + .setProxy(new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("", 9999))) + .build(); + // END: com.azure.core.http.okhttp.using-existing-okhttp + + } +} diff --git a/sdk/core/azure-core-http-okhttp/src/test/java/com/azure/core/http/okhttp/OkHttpClientTests.java b/sdk/core/azure-core-http-okhttp/src/test/java/com/azure/core/http/okhttp/OkHttpClientTests.java new file mode 100644 index 000000000000..aa98e1570286 --- /dev/null +++ b/sdk/core/azure-core-http-okhttp/src/test/java/com/azure/core/http/okhttp/OkHttpClientTests.java @@ -0,0 +1,296 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.okhttp; + +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpMethod; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.github.tomakehurst.wiremock.WireMockServer; +import com.github.tomakehurst.wiremock.client.WireMock; +import com.github.tomakehurst.wiremock.core.WireMockConfiguration; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.core.scheduler.Schedulers; +import reactor.test.StepVerifier; +import reactor.test.StepVerifierOptions; + +import java.io.IOException; +import java.io.OutputStream; +import java.net.MalformedURLException; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.URL; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.atomic.AtomicReference; + +public class OkHttpClientTests { + + private static final String SHORT_BODY = "hi there"; + private static final String LONG_BODY = createLongBody(); + + private static WireMockServer server; + + @BeforeClass + public static void beforeClass() { + server = new WireMockServer(WireMockConfiguration.options().dynamicPort().disableRequestJournal()); + server.stubFor( + WireMock.get("/short").willReturn(WireMock.aResponse().withBody(SHORT_BODY))); + server.stubFor(WireMock.get("/long").willReturn(WireMock.aResponse().withBody(LONG_BODY))); + server.stubFor(WireMock.get("/error") + .willReturn(WireMock.aResponse().withBody("error").withStatus(500))); + server.stubFor( + WireMock.post("/shortPost").willReturn(WireMock.aResponse().withBody(SHORT_BODY))); + server.start(); + } + + @AfterClass + public static void afterClass() { + if (server != null) { + server.shutdown(); + } + } + + @Test + public void testFlowableResponseShortBodyAsByteArrayAsync() { + checkBodyReceived(SHORT_BODY, "/short"); + } + + @Test + public void testFlowableResponseLongBodyAsByteArrayAsync() { + checkBodyReceived(LONG_BODY, "/long"); + } + + @Test + @Ignore("This tests behaviour of reactor netty's ByteBufFlux, not applicable for OkHttp") + public void testMultipleSubscriptionsEmitsError() { + HttpResponse response = getResponse("/short"); + // Subscription:1 + response.getBodyAsByteArray().block(); + // Subscription:2 + StepVerifier.create(response.getBodyAsByteArray()) + .expectNextCount(0) // TODO: Check with smaldini, what is the verifier operator equivalent to .awaitDone(20, TimeUnit.SECONDS) + .verifyError(IllegalStateException.class); + + } + + @Test + public void testFlowableWhenServerReturnsBodyAndNoErrorsWhenHttp500Returned() { + HttpResponse response = getResponse("/error"); + StepVerifier.create(response.getBodyAsString()) + .expectNext("error") // TODO: .awaitDone(20, TimeUnit.SECONDS) [See previous todo] + .verifyComplete(); + Assert.assertEquals(500, response.getStatusCode()); + } + + @Ignore("Not working accurately at present") + @Test + public void testFlowableBackpressure() { + HttpResponse response = getResponse("/long"); + // + StepVerifierOptions stepVerifierOptions = StepVerifierOptions.create(); + stepVerifierOptions.initialRequest(0); + // + StepVerifier.create(response.getBody(), stepVerifierOptions) + .expectNextCount(0) + .thenRequest(1) + .expectNextCount(1) + .thenRequest(3) + .expectNextCount(3) + .thenRequest(Long.MAX_VALUE)// TODO: Check with smaldini, what is the verifier operator to ignore all next emissions + .expectNextCount(1507) + .verifyComplete(); + } + + @Test + public void testRequestBodyIsErrorShouldPropagateToResponse() { + HttpClient client = HttpClient.createDefault(); + HttpRequest request = new HttpRequest(HttpMethod.POST, url(server, "/shortPost")) + .setHeader("Content-Length", "123") + .setBody(Flux.error(new RuntimeException("boo"))); + + StepVerifier.create(client.send(request)) + .expectErrorMessage("boo") + .verify(); + } + + @Test + public void testRequestBodyEndsInErrorShouldPropagateToResponse() { + HttpClient client = HttpClient.createDefault(); + String contentChunk = "abcdefgh"; + int repetitions = 1000; + HttpRequest request = new HttpRequest(HttpMethod.POST, url(server, "/shortPost")) + .setHeader("Content-Length", String.valueOf(contentChunk.length() * repetitions)) + .setBody(Flux.just(contentChunk) + .repeat(repetitions) + .map(s -> ByteBuffer.wrap(s.getBytes(StandardCharsets.UTF_8))) + .concatWith(Flux.error(new RuntimeException("boo")))); + StepVerifier.create(client.send(request)) + // .awaitDone(10, TimeUnit.SECONDS) + .expectErrorMessage("boo") + .verify(); + } + + @Test(timeout = 5000) + public void testServerShutsDownSocketShouldPushErrorToContentFlowable() + throws IOException, InterruptedException { + CountDownLatch latch = new CountDownLatch(1); + AtomicReference sock = new AtomicReference<>(); + ServerSocket ss = new ServerSocket(0); + try { + Mono.fromCallable(() -> { + latch.countDown(); + Socket socket = ss.accept(); + sock.set(socket); + // give the client time to get request across + Thread.sleep(500); + // respond but don't send the complete response + byte[] bytes = new byte[1024]; + int n = socket.getInputStream().read(bytes); + System.out.println(new String(bytes, 0, n, StandardCharsets.UTF_8)); + String response = "HTTP/1.1 200 OK\r\n" // + + "Content-Type: text/plain\r\n" // + + "Content-Length: 10\r\n" // + + "\r\n" // + + "zi"; + OutputStream out = socket.getOutputStream(); + out.write(response.getBytes()); + out.flush(); + // kill the socket with HTTP response body incomplete + socket.close(); + return 1; + }) + .subscribeOn(Schedulers.elastic()) + .subscribe(); + // + latch.await(); + HttpClient client = HttpClient.createDefault(); + HttpRequest request = new HttpRequest(HttpMethod.GET, + new URL("http://localhost:" + ss.getLocalPort() + "/get")); + HttpResponse response = client.send(request).block(); + Assert.assertEquals(200, response.getStatusCode()); + System.out.println("reading body"); + // + StepVerifier.create(response.getBodyAsByteArray()) + // .awaitDone(20, TimeUnit.SECONDS) + .verifyError(IOException.class); + } finally { + ss.close(); + } + } + + @Ignore("This flakey test fails often on MacOS. https://github.com/Azure/azure-sdk-for-java/issues/4357.") + @Test + public void testConcurrentRequests() throws NoSuchAlgorithmException { + long t = System.currentTimeMillis(); + int numRequests = 100; // 100 = 1GB of data read + long timeoutSeconds = 60; + HttpClient client = HttpClient.createDefault(); + byte[] expectedDigest = digest(LONG_BODY); + + Mono numBytesMono = Flux.range(1, numRequests) + .parallel(10) + .runOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) + .flatMap(n -> Mono.fromCallable(() -> getResponse(client, "/long")).flatMapMany(response -> { + MessageDigest md = md5Digest(); + return response.getBody() + .doOnNext(bb -> md.update(bb)) + .map(bb -> new NumberedByteBuffer(n, bb)) +// .doOnComplete(() -> System.out.println("completed " + n)) + .doOnComplete(() -> Assert.assertArrayEquals("wrong digest!", expectedDigest, + md.digest())); + })) + .sequential() + // enable the doOnNext call to see request numbers and thread names + // .doOnNext(g -> System.out.println(g.n + " " + + // Thread.currentThread().getName())) + .map(nbb -> (long) nbb.bb.limit()) + .reduce((x, y) -> x + y) + .subscribeOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) + .publishOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)); + + StepVerifier.create(numBytesMono) +// .awaitDone(timeoutSeconds, TimeUnit.SECONDS) + .expectNext((long) (numRequests * LONG_BODY.getBytes(StandardCharsets.UTF_8).length)) + .verifyComplete(); +// +// long numBytes = numBytesMono.block(); +// t = System.currentTimeMillis() - t; +// System.out.println("totalBytesRead=" + numBytes / 1024 / 1024 + "MB in " + t / 1000.0 + "s"); +// assertEquals(numRequests * LONG_BODY.getBytes(StandardCharsets.UTF_8).length, numBytes); + } + + private static MessageDigest md5Digest() { + try { + return MessageDigest.getInstance("MD5"); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } + } + + private static byte[] digest(String s) throws NoSuchAlgorithmException { + MessageDigest md = MessageDigest.getInstance("MD5"); + md.update(s.getBytes(StandardCharsets.UTF_8)); + byte[] expectedDigest = md.digest(); + return expectedDigest; + } + + private static final class NumberedByteBuffer { + final long n; + final ByteBuffer bb; + + NumberedByteBuffer(long n, ByteBuffer bb) { + this.n = n; + this.bb = bb; + } + } + + private static HttpResponse getResponse(String path) { + HttpClient client = new OkHttpAsyncHttpClientBuilder().build(); + return getResponse(client, path); + } + + private static HttpResponse getResponse(HttpClient client, String path) { + HttpRequest request = new HttpRequest(HttpMethod.GET, url(server, path)); + return client.send(request).block(); + } + + private static URL url(WireMockServer server, String path) { + try { + return new URL("http://localhost:" + server.port() + path); + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } + } + + private static String createLongBody() { + StringBuilder s = new StringBuilder(10000000); + for (int i = 0; i < 1000000; i++) { + s.append("abcdefghijk"); + } + return s.toString(); + } + + private void checkBodyReceived(String expectedBody, String path) { + HttpClient client = new OkHttpAsyncHttpClientBuilder().build(); + HttpResponse response = doRequest(client, path); + String s = new String(response.getBodyAsByteArray().block(), + StandardCharsets.UTF_8); + Assert.assertEquals(expectedBody, s); + } + + private HttpResponse doRequest(HttpClient client, String path) { + HttpRequest request = new HttpRequest(HttpMethod.GET, url(server, path)); + return client.send(request).block(); + } +} diff --git a/sdk/core/azure-core-http-okhttp/src/test/java/com/azure/core/http/okhttp/implementation/RestProxyWithHttpProxyOkHttpTests.java b/sdk/core/azure-core-http-okhttp/src/test/java/com/azure/core/http/okhttp/implementation/RestProxyWithHttpProxyOkHttpTests.java new file mode 100644 index 000000000000..a1bc75bf37f5 --- /dev/null +++ b/sdk/core/azure-core-http-okhttp/src/test/java/com/azure/core/http/okhttp/implementation/RestProxyWithHttpProxyOkHttpTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.okhttp.implementation; + +import com.azure.core.http.HttpClient; +import com.azure.core.http.okhttp.OkHttpAsyncHttpClientBuilder; +import com.azure.core.implementation.RestProxyTests; +import org.junit.Ignore; +import org.junit.Test; + +import java.net.InetSocketAddress; +import java.net.Proxy; + +@Ignore("Should only be run manually when a local proxy server (e.g. Fiddler) is running") +public class RestProxyWithHttpProxyOkHttpTests extends RestProxyTests { + + @Override + protected HttpClient createHttpClient() { + + return new OkHttpAsyncHttpClientBuilder() + .setProxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("localhost", 8888))) + .build(); + } + + @Test + @Override + @Ignore("OKHttp does not support setting null as header value.") + public void syncGetRequestWithNullHeader() { + super.syncGetRequestWithNullHeader(); + } +} diff --git a/sdk/core/azure-core-http-okhttp/src/test/java/com/azure/core/http/okhttp/implementation/RestProxyWithOkHttpTests.java b/sdk/core/azure-core-http-okhttp/src/test/java/com/azure/core/http/okhttp/implementation/RestProxyWithOkHttpTests.java new file mode 100644 index 000000000000..1a937f54ab1c --- /dev/null +++ b/sdk/core/azure-core-http-okhttp/src/test/java/com/azure/core/http/okhttp/implementation/RestProxyWithOkHttpTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.okhttp.implementation; + +import com.azure.core.http.HttpClient; +import com.azure.core.http.okhttp.OkHttpAsyncHttpClientBuilder; +import com.azure.core.implementation.RestProxyTests; +import org.junit.Ignore; +import org.junit.Test; + +public class RestProxyWithOkHttpTests extends RestProxyTests { + + @Override + protected HttpClient createHttpClient() { + return new OkHttpAsyncHttpClientBuilder().build(); + } + + @Test + @Override + @Ignore("OKHttp does not support setting null as header value.") + public void syncGetRequestWithNullHeader() { + super.syncGetRequestWithNullHeader(); + } +} diff --git a/sdk/core/azure-core-http-okhttp/src/test/resources/upload.txt b/sdk/core/azure-core-http-okhttp/src/test/resources/upload.txt new file mode 100644 index 000000000000..ff3bb63948b4 --- /dev/null +++ b/sdk/core/azure-core-http-okhttp/src/test/resources/upload.txt @@ -0,0 +1 @@ +The quick brown fox jumps over the lazy dog \ No newline at end of file diff --git a/sdk/core/azure-core-management/pom.xml b/sdk/core/azure-core-management/pom.xml index 0644c64e9532..8fb8f5c6b492 100644 --- a/sdk/core/azure-core-management/pom.xml +++ b/sdk/core/azure-core-management/pom.xml @@ -7,13 +7,13 @@ com.azure azure-client-sdk-parent - 1.3.0 + 1.4.0 ../../../pom.client.xml com.azure azure-core-management - 1.0.0-preview.4 + 1.0.0-preview.5 jar Microsoft Azure Management Java Core Library @@ -44,6 +44,7 @@ UTF-8 + com.azure.core.management @@ -57,7 +58,7 @@ com.azure azure-core - 1.0.0-preview.4 + 1.0.0-preview.5 @@ -69,7 +70,13 @@ com.azure azure-core-test - 1.0.0-preview.3 + 1.0.0-preview.5 + test + + + com.azure + azure-core-http-netty + 1.0.0-preview.5 test @@ -79,4 +86,5 @@ test + diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/AsyncOperationResource.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/AsyncOperationResource.java index f15529cd9c26..ebeb0e599f10 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/AsyncOperationResource.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/AsyncOperationResource.java @@ -16,7 +16,7 @@ public class AsyncOperationResource { * The status of the asynchronous operation. * @return The status of the asynchronous operation. */ - public String status() { + public String getStatus() { return status; } @@ -34,7 +34,7 @@ public void setStatus(String status) { /** * @return The resource's id. */ - public String id() { + public String getId() { return id; } diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/CloudError.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/CloudError.java index 462ccbf967c2..88bdf8ee42bc 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/CloudError.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/CloudError.java @@ -28,7 +28,7 @@ public final class CloudError { /** * Details for the error. */ - private List details; + private final List details; /** * Initializes a new instance of CloudError. @@ -40,7 +40,7 @@ public CloudError() { /** * @return the error code parsed from the body of the http error response */ - public String code() { + public String getCode() { return code; } @@ -50,7 +50,7 @@ public String code() { * @param code the error code * @return the CloudError object itself */ - public CloudError withCode(String code) { + public CloudError setCode(String code) { this.code = code; return this; } @@ -58,7 +58,7 @@ public CloudError withCode(String code) { /** * @return the error message */ - public String message() { + public String getMessage() { return message; } @@ -68,7 +68,7 @@ public String message() { * @param message the error message * @return the CloudError object itself */ - public CloudError withMessage(String message) { + public CloudError setMessage(String message) { this.message = message; return this; } @@ -76,7 +76,7 @@ public CloudError withMessage(String message) { /** * @return the target of the error */ - public String target() { + public String getTarget() { return target; } @@ -86,7 +86,7 @@ public String target() { * @param target the target of the error * @return the CloudError object itself */ - public CloudError withTarget(String target) { + public CloudError setTarget(String target) { this.target = target; return this; } @@ -94,7 +94,7 @@ public CloudError withTarget(String target) { /** * @return the details for the error */ - public List details() { + public List getDetails() { return details; } } diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/CloudException.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/CloudException.java index fd1fe353bba8..a682c536d5c6 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/CloudException.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/CloudException.java @@ -36,15 +36,15 @@ public CloudException(String message, HttpResponse response, CloudError body) { } @Override - public CloudError value() { - return (CloudError) super.value(); + public CloudError getValue() { + return (CloudError) super.getValue(); } @Override public String toString() { String message = super.toString(); - if (value() != null && value().message() != null) { - message = message + ": " + value().message(); + if (getValue() != null && getValue().getMessage() != null) { + message = message + ": " + getValue().getMessage(); } return message; } diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/Page.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/Page.java index c2f8b32403ee..9fdcd2452bed 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/Page.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/Page.java @@ -16,12 +16,12 @@ public interface Page { * * @return the link. */ - String nextPageLink(); + String getNextPageLink(); /** * Gets the list of items. * * @return the list of items. */ - List items(); + List getItems(); } diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/PagedList.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/PagedList.java index 60af05f9a643..4e4356d2a011 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/PagedList.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/PagedList.java @@ -4,6 +4,7 @@ package com.azure.core.management; import com.azure.core.exception.HttpResponseException; +import com.azure.core.util.logging.ClientLogger; import java.io.IOException; import java.util.ArrayList; @@ -21,8 +22,10 @@ * @param the element type. */ public abstract class PagedList implements List { + private final ClientLogger logger = new ClientLogger(PagedList.class); + /** The actual items in the list. */ - private List items; + private final List items; /** Stores the latest page fetched. */ private Page currentPage; /** Cached page right after the current one. */ @@ -45,12 +48,12 @@ public PagedList(Page page) { if (page == null) { return; } - List retrievedItems = page.items(); + List retrievedItems = page.getItems(); if (retrievedItems != null) { items.addAll(retrievedItems); } currentPage = page; - cachePage(page.nextPageLink()); + cachePage(page.getNextPageLink()); } private void cachePage(String nextPageLink) { @@ -60,14 +63,14 @@ private void cachePage(String nextPageLink) { if (cachedPage == null) { break; } - nextPageLink = cachedPage.nextPageLink(); + nextPageLink = cachedPage.getNextPageLink(); if (hasNextPage()) { // a legit, non-empty page has been fetched, otherwise keep fetching break; } } } catch (IOException ex) { - throw new RuntimeException(ex); + throw logger.logExceptionAsError(new RuntimeException(ex)); } } @@ -87,7 +90,7 @@ private void cachePage(String nextPageLink) { * @return true if there are more pages to load. False otherwise. */ public boolean hasNextPage() { - return this.cachedPage != null && this.cachedPage.items() != null && !this.cachedPage.items().isEmpty(); + return this.cachedPage != null && this.cachedPage.getItems() != null && !this.cachedPage.getItems().isEmpty(); } /** @@ -97,8 +100,8 @@ public boolean hasNextPage() { public void loadNextPage() { this.currentPage = cachedPage; cachedPage = null; - this.items.addAll(currentPage.items()); - cachePage(currentPage.nextPageLink()); + this.items.addAll(currentPage.getItems()); + cachePage(currentPage.getNextPageLink()); } /** @@ -115,7 +118,7 @@ public void loadAll() { * * @return the latest page. */ - public Page currentPage() { + public Page getCurrentPage() { return currentPage; } @@ -126,17 +129,19 @@ public Page currentPage() { */ protected void setCurrentPage(Page currentPage) { this.currentPage = currentPage; - List retrievedItems = currentPage.items(); + List retrievedItems = currentPage.getItems(); if (retrievedItems != null) { items.addAll(retrievedItems); } - cachePage(currentPage.nextPageLink()); + cachePage(currentPage.getNextPageLink()); } /** * The implementation of {@link ListIterator} for PagedList. */ private class ListItr implements ListIterator { + private final ClientLogger logger = new ClientLogger(ListItr.class); + /** * index of next element to return. */ @@ -164,7 +169,7 @@ public boolean hasNext() { public E next() { if (this.nextIndex >= items.size()) { if (!hasNextPage()) { - throw new NoSuchElementException(); + throw logger.logExceptionAsError(new NoSuchElementException()); } else { loadNextPage(); } @@ -179,7 +184,7 @@ public E next() { } catch (IndexOutOfBoundsException ex) { // The nextIndex got invalid means a different instance of iterator // removed item from this index. - throw new ConcurrentModificationException(); + throw logger.logExceptionAsError(new ConcurrentModificationException(ex)); } } } @@ -187,14 +192,14 @@ public E next() { @Override public void remove() { if (this.lastRetIndex < 0) { - throw new IllegalStateException(); + throw logger.logExceptionAsError(new IllegalStateException()); } else { try { items.remove(this.lastRetIndex); this.nextIndex = this.lastRetIndex; this.lastRetIndex = -1; } catch (IndexOutOfBoundsException ex) { - throw new ConcurrentModificationException(); + throw logger.logExceptionAsError(new ConcurrentModificationException(ex)); } } } @@ -208,16 +213,16 @@ public boolean hasPrevious() { public E previous() { int i = this.nextIndex - 1; if (i < 0) { - throw new NoSuchElementException(); + throw logger.logExceptionAsError(new NoSuchElementException()); } else if (i >= items.size()) { - throw new ConcurrentModificationException(); + throw logger.logExceptionAsError(new ConcurrentModificationException()); } else { try { this.nextIndex = i; this.lastRetIndex = i; return items.get(this.lastRetIndex); } catch (IndexOutOfBoundsException ex) { - throw new ConcurrentModificationException(); + throw logger.logExceptionAsError(new ConcurrentModificationException(ex)); } } } @@ -235,12 +240,12 @@ public int previousIndex() { @Override public void set(E e) { if (this.lastRetIndex < 0) { - throw new IllegalStateException(); + throw logger.logExceptionAsError(new IllegalStateException()); } else { try { items.set(this.lastRetIndex, e); } catch (IndexOutOfBoundsException ex) { - throw new ConcurrentModificationException(); + throw logger.logExceptionAsError(new ConcurrentModificationException(ex)); } } } @@ -252,7 +257,7 @@ public void add(E e) { this.nextIndex = this.nextIndex + 1; this.lastRetIndex = -1; } catch (IndexOutOfBoundsException ex) { - throw new ConcurrentModificationException(); + throw logger.logExceptionAsError(new ConcurrentModificationException(ex)); } } } diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/Resource.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/Resource.java index 64b42bf929b0..f65531774514 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/Resource.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/Resource.java @@ -45,7 +45,7 @@ public class Resource { * * @return the id value */ - public String id() { + public String getId() { return this.id; } @@ -54,7 +54,7 @@ public String id() { * * @return the name value */ - public String name() { + public String getName() { return this.name; } @@ -63,7 +63,7 @@ public String name() { * * @return the type value */ - public String type() { + public String getType() { return this.type; } @@ -72,7 +72,7 @@ public String type() { * * @return the location value */ - public String location() { + public String getLocation() { return this.location; } @@ -82,7 +82,7 @@ public String location() { * @param location the location value to set * @return the resource itself */ - public Resource withLocation(String location) { + public Resource setLocation(String location) { this.location = location; return this; } @@ -102,7 +102,7 @@ public Map getTags() { * @param tags the tags value to set * @return the resource itself */ - public Resource withTags(Map tags) { + public Resource setTags(Map tags) { this.tags = tags; return this; } diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/SubResource.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/SubResource.java index 5bef2782160b..fa13ad24a608 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/SubResource.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/SubResource.java @@ -17,7 +17,7 @@ public class SubResource { * * @return the id value */ - public String id() { + public String getId() { return this.id; } @@ -27,7 +27,7 @@ public String id() { * @param id the id value to set * @return the sub resource itself */ - public SubResource withId(String id) { + public SubResource setId(String id) { this.id = id; return this; } diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/annotations/AzureHost.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/annotations/AzureHost.java index 14a055963925..a140029a579d 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/annotations/AzureHost.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/annotations/AzureHost.java @@ -21,19 +21,21 @@ * * Example 1: Azure Resource Manager * - * {@literal @}AzureHost(AzureEnvironment.Endpoint.RESOURCE_MANAGER) - * interface VirtualMachinesService { - * {@literal @}GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}") - * VirtualMachine getByResourceGroup(@PathParam("resourceGroupName") String rgName, @PathParam("vmName") String vmName, @PathParam("subscriptionId") String subscriptionId); - * } + * {@literal @}AzureHost(AzureEnvironment.Endpoint.RESOURCE_MANAGER) + * interface VirtualMachinesService { + * {@literal @}GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft + * .Compute/virtualMachines/{vmName}") + * VirtualMachine getByResourceGroup(@PathParam("resourceGroupName") String rgName, @PathParam("vmName") String + * vmName, @PathParam("subscriptionId") String subscriptionId); + * } * * Example 2: Azure Key Vault * - * {@literal @}AzureHost(AzureEnvironment.Endpoint.KEY_VAULT) - * interface KeyVaultService { - * {@literal @}GET("secrets/{secretName}") - * Secret getSecret(@HostParam String vaultName, @PathParam("secretName") String secretName); - * } + * {@literal @}AzureHost(AzureEnvironment.Endpoint.KEY_VAULT) + * interface KeyVaultService { + * {@literal @}GET("secrets/{secretName}") + * Secret getSecret(@HostParam String vaultName, @PathParam("secretName") String secretName); + * } */ @Target(value = {TYPE}) @Retention(RetentionPolicy.RUNTIME) diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/AzureAsyncOperationPollStrategy.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/AzureAsyncOperationPollStrategy.java index cd83e122cbd1..319a3bd323fb 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/AzureAsyncOperationPollStrategy.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/AzureAsyncOperationPollStrategy.java @@ -11,6 +11,7 @@ import com.azure.core.management.AsyncOperationResource; import com.azure.core.management.CloudException; import com.azure.core.management.OperationState; +import com.azure.core.util.logging.ClientLogger; import reactor.core.publisher.Mono; import java.io.IOException; @@ -23,6 +24,8 @@ * running operation. */ public final class AzureAsyncOperationPollStrategy extends PollStrategy { + private final ClientLogger logger = new ClientLogger(AzureAsyncOperationPollStrategy.class); + private AzureAsyncOperationPollStrategyData data; /** @@ -59,14 +62,16 @@ private static class AzureAsyncOperationPollStrategyData extends PollStrategyDat * Create a new AzureAsyncOperationPollStrategyData object that will poll the provided operation * resource URL. * @param operationResourceUrl The URL of the operation resource this pollStrategy will poll. - * @param originalResourceUrl The URL of the resource that the long running operation is - * operating on. - * @param locationUrl The location uri received from service along with operationResourceUrl. - * @param initialHttpMethod The http method used to initiate the long running operation - * @param delayInMilliseconds The delay (in milliseconds) that the pollStrategy will use when - * polling. + * @param originalResourceUrl The URL of the resource that the long running operation is + * operating on. + * @param locationUrl The location uri received from service along with operationResourceUrl. + * @param initialHttpMethod The http method used to initiate the long running operation + * @param delayInMilliseconds The delay (in milliseconds) that the pollStrategy will use when + * polling. */ - AzureAsyncOperationPollStrategyData(RestProxy restProxy, SwaggerMethodParser methodParser, URL operationResourceUrl, URL originalResourceUrl, URL locationUrl, HttpMethod initialHttpMethod, long delayInMilliseconds) { + AzureAsyncOperationPollStrategyData(RestProxy restProxy, SwaggerMethodParser methodParser, + URL operationResourceUrl, URL originalResourceUrl, URL locationUrl, + HttpMethod initialHttpMethod, long delayInMilliseconds) { super(restProxy, methodParser, delayInMilliseconds); this.operationResourceUrl = operationResourceUrl; this.originalResourceUrl = originalResourceUrl; @@ -100,7 +105,8 @@ public HttpRequest createPollRequest() { pollUrl = data.originalResourceUrl; } } else { - throw new IllegalStateException("Polling is completed and did not succeed. Cannot create a polling request."); + throw logger.logExceptionAsError(new IllegalStateException( + "Polling is completed and did not succeed. Cannot create a polling request.")); } return new HttpRequest(HttpMethod.GET, pollUrl); @@ -109,53 +115,60 @@ public HttpRequest createPollRequest() { @Override public Mono updateFromAsync(HttpResponse httpPollResponse) { return ensureExpectedStatus(httpPollResponse) - .flatMap(response -> { - updateDelayInMillisecondsFrom(response); - Mono result; - if (!data.pollingCompleted) { - final HttpResponse bufferedHttpPollResponse = response.buffer(); - result = bufferedHttpPollResponse.bodyAsString() - .map(bodyString -> { - AsyncOperationResource operationResource = null; - try { - operationResource = deserialize(bodyString, AsyncOperationResource.class); - } catch (IOException ignored) { } - // - if (operationResource == null || operationResource.status() == null) { - throw new CloudException("The polling response does not contain a valid body", bufferedHttpPollResponse, null); - } else { - final String status = operationResource.status(); - setStatus(status); - - data.pollingCompleted = OperationState.isCompleted(status); - if (data.pollingCompleted) { - data.pollingSucceeded = OperationState.SUCCEEDED.equalsIgnoreCase(status); - clearDelayInMilliseconds(); - - if (!data.pollingSucceeded) { - throw new CloudException("Async operation failed with provisioning state: " + status, bufferedHttpPollResponse); - } - - if (operationResource.id() != null) { - data.gotResourceResponse = true; - } - } - return bufferedHttpPollResponse; + .flatMap(response -> { + updateDelayInMillisecondsFrom(response); + Mono result; + if (!data.pollingCompleted) { + final HttpResponse bufferedHttpPollResponse = response.buffer(); + result = bufferedHttpPollResponse.getBodyAsString() + .map(bodyString -> { + AsyncOperationResource operationResource = null; + try { + operationResource = deserialize(bodyString, AsyncOperationResource.class); + } catch (IOException ignored) { + } + // + if (operationResource == null || operationResource.getStatus() == null) { + throw logger.logExceptionAsError(new CloudException( + "The polling response does not contain a valid body", + bufferedHttpPollResponse, + null)); + } else { + final String status = operationResource.getStatus(); + setStatus(status); + + data.pollingCompleted = OperationState.isCompleted(status); + if (data.pollingCompleted) { + data.pollingSucceeded = OperationState.SUCCEEDED.equalsIgnoreCase(status); + clearDelayInMilliseconds(); + + if (!data.pollingSucceeded) { + throw logger.logExceptionAsError(new CloudException( + "Async operation failed with provisioning state: " + status, + bufferedHttpPollResponse)); + } + + if (operationResource.getId() != null) { + data.gotResourceResponse = true; } - }); - } else { - if (data.pollingSucceeded) { - data.gotResourceResponse = true; - } - result = Mono.just(response); + } + return bufferedHttpPollResponse; + } + }); + } else { + if (data.pollingSucceeded) { + data.gotResourceResponse = true; } - return result; - }); + result = Mono.just(response); + } + return result; + }); } @Override public boolean isDone() { - return data.pollingCompleted && (!data.pollingSucceeded || !expectsResourceResponse() || data.gotResourceResponse); + return data.pollingCompleted + && (!data.pollingSucceeded || !expectsResourceResponse() || data.gotResourceResponse); } /** @@ -164,15 +177,17 @@ public boolean isDone() { * header or if the header is empty, then null will be returned. * @param restProxy The proxy object that is attempting to create a PollStrategy. * @param methodParser The method parser that describes the service interface method that - * initiated the long running operation. + * initiated the long running operation. * @param originalHttpRequest The original HTTP request that initiated the long running - * operation. + * operation. * @param httpResponse The HTTP response that the required header values for this pollStrategy - * will be read from. + * will be read from. * @param delayInMilliseconds The delay (in milliseconds) that the resulting pollStrategy will - * use when polling. + * use when polling. */ - static PollStrategy tryToCreate(RestProxy restProxy, SwaggerMethodParser methodParser, HttpRequest originalHttpRequest, HttpResponse httpResponse, long delayInMilliseconds) { + static PollStrategy tryToCreate(RestProxy restProxy, SwaggerMethodParser methodParser, + HttpRequest originalHttpRequest, HttpResponse httpResponse, + long delayInMilliseconds) { String urlHeader = getHeader(httpResponse); URL azureAsyncOperationUrl = null; if (urlHeader != null) { @@ -182,7 +197,7 @@ static PollStrategy tryToCreate(RestProxy restProxy, SwaggerMethodParser methodP } } - urlHeader = httpResponse.headerValue("Location"); + urlHeader = httpResponse.getHeaderValue("Location"); URL locationUrl = null; if (urlHeader != null) { try { @@ -192,17 +207,18 @@ static PollStrategy tryToCreate(RestProxy restProxy, SwaggerMethodParser methodP } return azureAsyncOperationUrl != null - ? new AzureAsyncOperationPollStrategy( - new AzureAsyncOperationPollStrategyData(restProxy, methodParser, azureAsyncOperationUrl, originalHttpRequest.url(), locationUrl, originalHttpRequest.httpMethod(), delayInMilliseconds)) - : null; + ? new AzureAsyncOperationPollStrategy( + new AzureAsyncOperationPollStrategyData(restProxy, methodParser, azureAsyncOperationUrl, + originalHttpRequest.getUrl(), locationUrl, originalHttpRequest.getHttpMethod(), delayInMilliseconds)) + : null; } static String getHeader(HttpResponse httpResponse) { - return httpResponse.headerValue(HEADER_NAME); + return httpResponse.getHeaderValue(HEADER_NAME); } @Override - public Serializable strategyData() { + public Serializable getStrategyData() { return this.data; } } diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/AzureProxy.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/AzureProxy.java index d892d00ce718..32895aec57bf 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/AzureProxy.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/AzureProxy.java @@ -7,13 +7,13 @@ import com.azure.core.credentials.TokenCredential; import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.CookiePolicy; import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.implementation.OperationDescription; import com.azure.core.implementation.RestProxy; @@ -30,6 +30,7 @@ import com.azure.core.management.annotations.AzureHost; import com.azure.core.management.serializer.AzureJacksonAdapter; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import reactor.core.Exceptions; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -47,17 +48,18 @@ import java.util.function.Supplier; /** - * This class can be used to create an Azure specific proxy implementation for a provided Swagger - * generated interface. + * This class can be used to create an Azure specific proxy implementation for a provided Swagger generated interface. */ public final class AzureProxy extends RestProxy { private static long defaultPollingDelayInMilliseconds = 30 * 1000; + private final ClientLogger logger = new ClientLogger(AzureProxy.class); /** * Create a new instance of RestProxy. + * * @param httpPipeline The HttpPipeline that will be used by this AzureProxy to send HttpRequests. - * @param interfaceParser The parser that contains information about the swagger interface that - * this RestProxy "implements". + * @param interfaceParser The parser that contains information about the swagger interface that this RestProxy + * "implements". */ private AzureProxy(HttpPipeline httpPipeline, SwaggerInterfaceParser interfaceParser) { super(httpPipeline, createDefaultSerializer(), interfaceParser); @@ -66,14 +68,15 @@ private AzureProxy(HttpPipeline httpPipeline, SwaggerInterfaceParser interfacePa /** * @return The millisecond delay that will occur by default between long running operation polls. */ - public static long defaultDelayInMilliseconds() { + public static long getDefaultDelayInMilliseconds() { return AzureProxy.defaultPollingDelayInMilliseconds; } /** * Set the millisecond delay that will occur by default between long running operation polls. - * @param defaultPollingDelayInMilliseconds The number of milliseconds to delay before sending the next - * long running operation status poll. + * + * @param defaultPollingDelayInMilliseconds The number of milliseconds to delay before sending the next long running + * operation status poll. */ public static void setDefaultPollingDelayInMilliseconds(long defaultPollingDelayInMilliseconds) { AzureProxy.defaultPollingDelayInMilliseconds = defaultPollingDelayInMilliseconds; @@ -81,6 +84,7 @@ public static void setDefaultPollingDelayInMilliseconds(long defaultPollingDelay /** * Get the default serializer. + * * @return the default serializer. */ private static SerializerAdapter createDefaultSerializer() { @@ -88,6 +92,7 @@ private static SerializerAdapter createDefaultSerializer() { } private static String operatingSystem; + private static String operatingSystem() { if (operatingSystem == null) { operatingSystem = System.getProperty("os.name") + "/" + System.getProperty("os.version"); @@ -96,6 +101,7 @@ private static String operatingSystem() { } private static String macAddressHash; + private static String macAddressHash() { if (macAddressHash == null) { byte[] macBytes = null; @@ -112,9 +118,9 @@ private static String macAddressHash() { MessageDigest digest = MessageDigest.getInstance("SHA-256"); byte[] hash = digest.digest(macBytes); - StringBuffer builder = new StringBuffer(); - for (int i = 0; i < hash.length; i++) { - builder.append(String.format("%02x", hash[i])); + StringBuilder builder = new StringBuilder(); + for (byte b : hash) { + builder.append(String.format("%02x", b)); } macAddressHash = builder.toString(); } catch (Throwable t) { @@ -130,6 +136,7 @@ private static String macAddressHash() { } private static String javaVersion; + private static String javaVersion() { if (javaVersion == null) { final String versionProperty = System.getProperty("java.version"); @@ -139,21 +146,22 @@ private static String javaVersion() { } private static String getDefaultUserAgentString(Class swaggerInterface) { - final String packageImplementationVersion = swaggerInterface == null ? "" : "/" + swaggerInterface.getPackage().getImplementationVersion(); + final String packageImplementationVersion = + swaggerInterface == null ? "" : "/" + swaggerInterface.getPackage().getImplementationVersion(); final String operatingSystem = operatingSystem(); final String macAddressHash = macAddressHash(); final String javaVersion = javaVersion(); return String.format("Azure-SDK-For-Java%s OS:%s MacAddressHash:%s Java:%s", - packageImplementationVersion, - operatingSystem, - macAddressHash, - javaVersion); + packageImplementationVersion, + operatingSystem, + macAddressHash, + javaVersion); } /** * Create the default HttpPipeline. - * @param swaggerInterface The interface that the pipeline will use to generate a user-agent - * string. + * + * @param swaggerInterface The interface that the pipeline will use to generate a user-agent string. * @return the default HttpPipeline. */ public static HttpPipeline createDefaultPipeline(Class swaggerInterface) { @@ -162,8 +170,8 @@ public static HttpPipeline createDefaultPipeline(Class swaggerInterface) { /** * Create the default HttpPipeline. - * @param swaggerInterface The interface that the pipeline will use to generate a user-agent - * string. + * + * @param swaggerInterface The interface that the pipeline will use to generate a user-agent string. * @param credentials The credentials to use to apply authentication to the pipeline. * @return the default HttpPipeline. */ @@ -173,10 +181,9 @@ public static HttpPipeline createDefaultPipeline(Class swaggerInterface, Toke /** * Create the default HttpPipeline. - * @param swaggerInterface The interface that the pipeline will use to generate a user-agent - * string. - * @param credentialsPolicy The credentials policy factory to use to apply authentication to the - * pipeline. + * + * @param swaggerInterface The interface that the pipeline will use to generate a user-agent string. + * @param credentialsPolicy The credentials policy factory to use to apply authentication to the pipeline. * @return the default HttpPipeline. */ public static HttpPipeline createDefaultPipeline(Class swaggerInterface, HttpPipelinePolicy credentialsPolicy) { @@ -197,16 +204,17 @@ public static HttpPipeline createDefaultPipeline(Class swaggerInterface, Http /** * Create a proxy implementation of the provided Swagger interface. + * * @param swaggerInterface The Swagger interface to provide a proxy implementation for. * @param azureEnvironment The azure environment that the proxy implementation will target. - * @param httpPipeline The HTTP httpPipeline will be used to make REST calls. - //* @param serializer The serializer that will be used to convert POJOs to and from request and - * response bodies. + * @param httpPipeline The HTTP httpPipeline will be used to make REST calls. //* @param serializer The serializer + * that will be used to convert POJOs to and from request and response bodies. * @param The type of the Swagger interface. * @return A proxy implementation of the provided Swagger interface. */ @SuppressWarnings("unchecked") - public static A create(Class swaggerInterface, AzureEnvironment azureEnvironment, HttpPipeline httpPipeline) { + public static A create(Class swaggerInterface, AzureEnvironment azureEnvironment, + HttpPipeline httpPipeline) { String baseUrl = null; if (azureEnvironment != null) { @@ -216,152 +224,197 @@ public static A create(Class swaggerInterface, AzureEnvironment azureEnvi } } - final SwaggerInterfaceParser interfaceParser = new SwaggerInterfaceParser(swaggerInterface, createDefaultSerializer(), baseUrl); + final SwaggerInterfaceParser interfaceParser = + new SwaggerInterfaceParser(swaggerInterface, createDefaultSerializer(), baseUrl); final AzureProxy azureProxy = new AzureProxy(httpPipeline, interfaceParser); - return (A) Proxy.newProxyInstance(swaggerInterface.getClassLoader(), new Class[]{swaggerInterface}, azureProxy); + return (A) Proxy + .newProxyInstance(swaggerInterface.getClassLoader(), new Class[]{swaggerInterface}, azureProxy); } @Override - protected Object handleHttpResponse(final HttpRequest httpRequest, Mono asyncHttpResponse, final SwaggerMethodParser methodParser, Type returnType, Context context) { + protected Object handleHttpResponse(final HttpRequest httpRequest, Mono asyncHttpResponse, + final SwaggerMethodParser methodParser, Type returnType, Context context) { if (TypeUtil.isTypeOrSubTypeOf(returnType, Flux.class)) { final Type operationStatusType = ((ParameterizedType) returnType).getActualTypeArguments()[0]; if (!TypeUtil.isTypeOrSubTypeOf(operationStatusType, OperationStatus.class)) { - throw new InvalidReturnTypeException("AzureProxy only supports swagger interface methods that return Flux (such as " + methodParser.fullyQualifiedMethodName() + "()) if the Flux's inner type that is OperationStatus (not " + returnType.toString() + ")."); + throw logger.logExceptionAsError(new InvalidReturnTypeException("AzureProxy only supports swagger " + + "interface methods that return Flux (such as " + methodParser.getFullyQualifiedMethodName() + + "()) if the Flux's inner type that is OperationStatus (not " + returnType.toString() + ").")); } else { // Get ResultTypeT in OperationStatus - final Type operationStatusResultType = ((ParameterizedType) operationStatusType).getActualTypeArguments()[0]; + final Type operationStatusResultType = + ((ParameterizedType) operationStatusType).getActualTypeArguments()[0]; // - return asyncHttpResponse.flatMapMany(httpResponse -> { - return createPollStrategy(httpRequest, Mono.just(httpResponse), methodParser) - .flatMapMany(pollStrategy -> { - Mono> first = handleBodyReturnType(httpResponse, methodParser, operationStatusResultType) - .map(operationResult -> new OperationStatus(operationResult, pollStrategy.status())) - .switchIfEmpty(Mono.defer((Supplier>>) () -> Mono.just(new OperationStatus<>((Object) null, pollStrategy.status())))); - Flux> rest = pollStrategy.pollUntilDoneWithStatusUpdates(httpRequest, methodParser, operationStatusResultType, context); - return first.concatWith(rest); - }); - }); + return asyncHttpResponse.flatMapMany(httpResponse -> createPollStrategy(httpRequest, + Mono.just(httpResponse), methodParser).flatMapMany(pollStrategy -> { + Mono> first = + handleBodyReturnType(httpResponse, methodParser, operationStatusResultType) + .map(operationResult -> new OperationStatus( + operationResult, + pollStrategy.getStatus())) + .switchIfEmpty( + Mono.defer((Supplier>>) () -> Mono.just( + new OperationStatus<>((Object) null, pollStrategy.getStatus())))); + Flux> rest = + pollStrategy.pollUntilDoneWithStatusUpdates(httpRequest, methodParser, + operationStatusResultType, context); + return first.concatWith(rest); + })); } } else { - final Mono lastAsyncHttpResponse = createPollStrategy(httpRequest, asyncHttpResponse, methodParser) - .flatMap((Function>) pollStrategy -> pollStrategy.pollUntilDone()); - return handleRestReturnType(new HttpResponseDecoder(this.serializer()).decode(lastAsyncHttpResponse, methodParser), methodParser, returnType, context); + final Mono lastAsyncHttpResponse = + createPollStrategy(httpRequest, asyncHttpResponse, methodParser) + .flatMap((Function>) PollStrategy::pollUntilDone); + return handleRestReturnType(new HttpResponseDecoder(this.getSerializer()).decode(lastAsyncHttpResponse, + methodParser), methodParser, returnType, context); } } @Override - protected Object handleResumeOperation(final HttpRequest httpRequest, - OperationDescription operationDescription, - final SwaggerMethodParser methodParser, - Type returnType, - Context context) { + protected Object handleResumeOperation(final HttpRequest httpRequest, OperationDescription operationDescription, + final SwaggerMethodParser methodParser, Type returnType, Context context) { final Type operationStatusType = ((ParameterizedType) returnType).getActualTypeArguments()[0]; if (!TypeUtil.isTypeOrSubTypeOf(operationStatusType, OperationStatus.class)) { - throw new InvalidReturnTypeException("AzureProxy only supports swagger interface methods that return Flux (such as " + methodParser.fullyQualifiedMethodName() + "()) if the Flux's inner type that is OperationStatus (not " + returnType.toString() + ")."); + throw logger.logExceptionAsError(new InvalidReturnTypeException("AzureProxy only supports swagger " + + "interface methods that return Flux (such as " + methodParser.getFullyQualifiedMethodName() + + "()) if the Flux's inner type that is OperationStatus (not " + returnType.toString() + ").")); } PollStrategy.PollStrategyData pollStrategyData = - (PollStrategy.PollStrategyData) operationDescription.pollStrategyData(); + (PollStrategy.PollStrategyData) operationDescription.getPollStrategyData(); PollStrategy pollStrategy = pollStrategyData.initializeStrategy(this, methodParser); return pollStrategy.pollUntilDoneWithStatusUpdates(httpRequest, methodParser, operationStatusType, context); } - private Mono createPollStrategy(final HttpRequest originalHttpRequest, final Mono asyncOriginalHttpDecodedResponse, final SwaggerMethodParser methodParser) { + private Mono createPollStrategy(final HttpRequest originalHttpRequest, + final Mono asyncOriginalHttpDecodedResponse, final SwaggerMethodParser methodParser) { return asyncOriginalHttpDecodedResponse - .flatMap((Function>) originalHttpDecodedResponse -> { - final int httpStatusCode = originalHttpDecodedResponse.sourceResponse().statusCode(); - final HttpResponse originalHttpResponse = originalHttpDecodedResponse.sourceResponse(); - final int[] longRunningOperationStatusCodes = new int[] {200, 201, 202}; - return ensureExpectedStatus(originalHttpDecodedResponse, methodParser, longRunningOperationStatusCodes) - .flatMap(response -> { - Mono result = null; - - final Long parsedDelayInMilliseconds = PollStrategy.delayInMillisecondsFrom(originalHttpResponse); - final long delayInMilliseconds = parsedDelayInMilliseconds != null ? parsedDelayInMilliseconds : AzureProxy.defaultDelayInMilliseconds(); - - final HttpMethod originalHttpRequestMethod = originalHttpRequest.httpMethod(); - - PollStrategy pollStrategy = null; - if (httpStatusCode == 200) { - pollStrategy = AzureAsyncOperationPollStrategy.tryToCreate(AzureProxy.this, methodParser, originalHttpRequest, originalHttpResponse, delayInMilliseconds); - if (pollStrategy != null) { - result = Mono.just(pollStrategy); - } else { - result = createProvisioningStateOrCompletedPollStrategy(originalHttpRequest, originalHttpResponse, methodParser, delayInMilliseconds); - } - } else if (originalHttpRequestMethod == HttpMethod.PUT || originalHttpRequestMethod == HttpMethod.PATCH) { - if (httpStatusCode == 201) { - pollStrategy = AzureAsyncOperationPollStrategy.tryToCreate(AzureProxy.this, methodParser, originalHttpRequest, originalHttpResponse, delayInMilliseconds); - if (pollStrategy == null) { - result = createProvisioningStateOrCompletedPollStrategy(originalHttpRequest, originalHttpResponse, methodParser, delayInMilliseconds); - } - } else if (httpStatusCode == 202) { - pollStrategy = AzureAsyncOperationPollStrategy.tryToCreate(AzureProxy.this, methodParser, originalHttpRequest, originalHttpResponse, delayInMilliseconds); - if (pollStrategy == null) { - pollStrategy = LocationPollStrategy.tryToCreate(AzureProxy.this, methodParser, originalHttpRequest, originalHttpDecodedResponse.sourceResponse(), delayInMilliseconds); - } - } - } else { - if (httpStatusCode == 202) { - pollStrategy = AzureAsyncOperationPollStrategy.tryToCreate(AzureProxy.this, methodParser, originalHttpRequest, originalHttpResponse, delayInMilliseconds); - if (pollStrategy == null) { - pollStrategy = LocationPollStrategy.tryToCreate(AzureProxy.this, methodParser, originalHttpRequest, originalHttpResponse, delayInMilliseconds); - if (pollStrategy == null) { - throw new CloudException("Response does not contain an Azure-AsyncOperation or Location header.", originalHttpResponse); - } - } + .flatMap((Function>) originalHttpDecodedResponse -> { + final int httpStatusCode = originalHttpDecodedResponse.getSourceResponse().getStatusCode(); + final HttpResponse originalHttpResponse = originalHttpDecodedResponse.getSourceResponse(); + final int[] longRunningOperationStatusCodes = new int[]{200, 201, 202}; + return ensureExpectedStatus(originalHttpDecodedResponse, methodParser, longRunningOperationStatusCodes) + .flatMap(response -> { + Mono result = null; + + final Long parsedDelayInMilliseconds = + PollStrategy.delayInMillisecondsFrom(originalHttpResponse); + final long delayInMilliseconds = + parsedDelayInMilliseconds != null + ? parsedDelayInMilliseconds + : AzureProxy.getDefaultDelayInMilliseconds(); + + final HttpMethod originalHttpRequestMethod = originalHttpRequest.getHttpMethod(); + + PollStrategy pollStrategy = null; + if (httpStatusCode == 200) { + pollStrategy = + AzureAsyncOperationPollStrategy.tryToCreate(AzureProxy.this, methodParser, + originalHttpRequest, originalHttpResponse, delayInMilliseconds); + if (pollStrategy != null) { + result = Mono.just(pollStrategy); + } else { + result = + createProvisioningStateOrCompletedPollStrategy(originalHttpRequest, + originalHttpResponse, methodParser, delayInMilliseconds); + } + } else if (originalHttpRequestMethod == HttpMethod.PUT + || originalHttpRequestMethod == HttpMethod.PATCH) { + if (httpStatusCode == 201) { + pollStrategy = + AzureAsyncOperationPollStrategy.tryToCreate(AzureProxy.this, methodParser, + originalHttpRequest, originalHttpResponse, delayInMilliseconds); + if (pollStrategy == null) { + result = + createProvisioningStateOrCompletedPollStrategy(originalHttpRequest, + originalHttpResponse, methodParser, delayInMilliseconds); + } + } else if (httpStatusCode == 202) { + pollStrategy = + AzureAsyncOperationPollStrategy.tryToCreate(AzureProxy.this, methodParser, + originalHttpRequest, originalHttpResponse, delayInMilliseconds); + if (pollStrategy == null) { + pollStrategy = + LocationPollStrategy.tryToCreate(AzureProxy.this, methodParser, + originalHttpRequest, originalHttpDecodedResponse.getSourceResponse(), + delayInMilliseconds); + } + } + } else { + if (httpStatusCode == 202) { + pollStrategy = + AzureAsyncOperationPollStrategy.tryToCreate(AzureProxy.this, methodParser, + originalHttpRequest, originalHttpResponse, delayInMilliseconds); + if (pollStrategy == null) { + pollStrategy = + LocationPollStrategy.tryToCreate(AzureProxy.this, methodParser, + originalHttpRequest, originalHttpResponse, delayInMilliseconds); + if (pollStrategy == null) { + throw logger.logExceptionAsError(new CloudException("Response does not " + + "contain an Azure-AsyncOperation or Location header.", + originalHttpResponse)); } } + } + } - if (pollStrategy == null && result == null) { - pollStrategy = new CompletedPollStrategy( - new CompletedPollStrategy.CompletedPollStrategyData(AzureProxy.this, methodParser, originalHttpResponse)); - } + if (pollStrategy == null && result == null) { + pollStrategy = new CompletedPollStrategy( + new CompletedPollStrategy.CompletedPollStrategyData(AzureProxy.this, methodParser, + originalHttpResponse)); + } - if (pollStrategy != null) { - result = Mono.just(pollStrategy); - } + if (pollStrategy != null) { + result = Mono.just(pollStrategy); + } - return result; - }); - }); + return result; + }); + }); } - private Mono createProvisioningStateOrCompletedPollStrategy(final HttpRequest httpRequest, HttpResponse httpResponse, final SwaggerMethodParser methodParser, final long delayInMilliseconds) { + private Mono createProvisioningStateOrCompletedPollStrategy(final HttpRequest httpRequest, + HttpResponse httpResponse, final SwaggerMethodParser methodParser, final long delayInMilliseconds) { Mono pollStrategyMono; - final HttpMethod httpRequestMethod = httpRequest.httpMethod(); + final HttpMethod httpRequestMethod = httpRequest.getHttpMethod(); if (httpRequestMethod == HttpMethod.DELETE - || httpRequestMethod == HttpMethod.GET - || httpRequestMethod == HttpMethod.HEAD - || !methodParser.expectsResponseBody()) { - pollStrategyMono = Mono.just(new CompletedPollStrategy( - new CompletedPollStrategy.CompletedPollStrategyData(AzureProxy.this, methodParser, httpResponse))); + || httpRequestMethod == HttpMethod.GET + || httpRequestMethod == HttpMethod.HEAD + || !methodParser.expectsResponseBody()) { + pollStrategyMono = Mono.just(new CompletedPollStrategy( + new CompletedPollStrategy.CompletedPollStrategyData(AzureProxy.this, methodParser, httpResponse))); } else { final HttpResponse bufferedOriginalHttpResponse = httpResponse.buffer(); - pollStrategyMono = bufferedOriginalHttpResponse.bodyAsString() - .map(originalHttpResponseBody -> { - if (originalHttpResponseBody == null || originalHttpResponseBody.isEmpty()) { - throw new CloudException("The HTTP response does not contain a body.", bufferedOriginalHttpResponse); - } - PollStrategy pollStrategy; - try { - final SerializerAdapter serializer = serializer(); - final ResourceWithProvisioningState resource = serializer.deserialize(originalHttpResponseBody, ResourceWithProvisioningState.class, SerializerEncoding.JSON); - if (resource != null && resource.properties() != null && !OperationState.isCompleted(resource.properties().provisioningState())) { - pollStrategy = new ProvisioningStatePollStrategy( - new ProvisioningStatePollStrategy.ProvisioningStatePollStrategyData( - AzureProxy.this, methodParser, httpRequest, resource.properties().provisioningState(), delayInMilliseconds)); - } else { - pollStrategy = new CompletedPollStrategy( - new CompletedPollStrategy.CompletedPollStrategyData( - AzureProxy.this, methodParser, bufferedOriginalHttpResponse)); - } - } catch (IOException e) { - throw Exceptions.propagate(e); + pollStrategyMono = bufferedOriginalHttpResponse.getBodyAsString() + .map(originalHttpResponseBody -> { + if (originalHttpResponseBody == null || originalHttpResponseBody.isEmpty()) { + throw logger.logExceptionAsError(new CloudException( + "The HTTP response does not contain a body.", bufferedOriginalHttpResponse)); + } + PollStrategy pollStrategy; + try { + final SerializerAdapter serializer = getSerializer(); + final ResourceWithProvisioningState resource = + serializer.deserialize(originalHttpResponseBody, ResourceWithProvisioningState.class, + SerializerEncoding.JSON); + if (resource != null + && resource.getProperties() != null + && !OperationState.isCompleted(resource.getProperties().getProvisioningState())) { + pollStrategy = new ProvisioningStatePollStrategy( + new ProvisioningStatePollStrategy.ProvisioningStatePollStrategyData( + AzureProxy.this, methodParser, httpRequest, + resource.getProperties().getProvisioningState(), delayInMilliseconds)); + } else { + pollStrategy = new CompletedPollStrategy( + new CompletedPollStrategy.CompletedPollStrategyData( + AzureProxy.this, methodParser, bufferedOriginalHttpResponse)); } - return pollStrategy; - }); + } catch (IOException e) { + throw logger.logExceptionAsError(Exceptions.propagate(e)); + } + return pollStrategy; + }); } return pollStrategyMono; } diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/CompletedPollStrategy.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/CompletedPollStrategy.java index cfda53c45496..9a03ee96e05f 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/CompletedPollStrategy.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/CompletedPollStrategy.java @@ -9,6 +9,7 @@ import com.azure.core.implementation.SwaggerMethodParser; import com.azure.core.management.OperationState; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -20,6 +21,8 @@ * further polling. */ public class CompletedPollStrategy extends PollStrategy { + private final ClientLogger logger = new ClientLogger(CompletedPollStrategy.class); + private final HttpResponse firstHttpResponse; private CompletedPollStrategyData data; @@ -47,10 +50,11 @@ public static class CompletedPollStrategyData extends PollStrategyData { * Create a new CompletedPollStrategyData. * @param restProxy The RestProxy that created this PollStrategy. * @param methodParser The method parser that describes the service interface method that - * initiated the long running operation. + * initiated the long running operation. * @param firstHttpResponse The HTTP response to the original HTTP request. */ - public CompletedPollStrategyData(RestProxy restProxy, SwaggerMethodParser methodParser, HttpResponse firstHttpResponse) { + public CompletedPollStrategyData(RestProxy restProxy, SwaggerMethodParser methodParser, + HttpResponse firstHttpResponse) { super(restProxy, methodParser, 0); this.firstHttpResponse = firstHttpResponse; } @@ -65,7 +69,7 @@ PollStrategy initializeStrategy(RestProxy restProxy, @Override public HttpRequest createPollRequest() { - throw new UnsupportedOperationException(); + throw logger.logExceptionAsError(new UnsupportedOperationException()); } @Override @@ -78,9 +82,13 @@ boolean isDone() { return true; } - Flux> pollUntilDoneWithStatusUpdates(final HttpRequest originalHttpRequest, final SwaggerMethodParser methodParser, final Type operationStatusResultType, Context context) { - return createOperationStatusMono(originalHttpRequest, firstHttpResponse, methodParser, operationStatusResultType, context) - .flatMapMany(cos -> Flux.just(cos)); + Flux> pollUntilDoneWithStatusUpdates(final HttpRequest originalHttpRequest, + final SwaggerMethodParser methodParser, + final Type operationStatusResultType, + Context context) { + return createOperationStatusMono(originalHttpRequest, firstHttpResponse, methodParser, + operationStatusResultType, context) + .flatMapMany(cos -> Flux.just(cos)); } Mono pollUntilDone() { @@ -88,7 +96,7 @@ Mono pollUntilDone() { } @Override - public Serializable strategyData() { + public Serializable getStrategyData() { return this.data; } } diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/LocationPollStrategy.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/LocationPollStrategy.java index 89d7af92d12f..3fb904c34b52 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/LocationPollStrategy.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/LocationPollStrategy.java @@ -8,6 +8,7 @@ import com.azure.core.http.HttpResponse; import com.azure.core.implementation.RestProxy; import com.azure.core.implementation.SwaggerMethodParser; +import com.azure.core.util.logging.ClientLogger; import reactor.core.Exceptions; import reactor.core.publisher.Mono; @@ -21,6 +22,8 @@ * operation. */ public final class LocationPollStrategy extends PollStrategy { + private final ClientLogger logger = new ClientLogger(LocationPollStrategy.class); + LocationPollStrategyData data; /** @@ -54,7 +57,7 @@ public LocationPollStrategyData() { * Create a new LocationPollStrategyData. * @param restProxy The RestProxy that created this PollStrategy. * @param methodParser The method parser that describes the service interface method that - * initiated the long running operation. + * initiated the long running operation. * @param locationUrl The location url. * @param delayInMilliseconds The delay value. */ @@ -81,24 +84,24 @@ public HttpRequest createPollRequest() { @Override public Mono updateFromAsync(HttpResponse httpPollResponse) { - return ensureExpectedStatus(httpPollResponse, new int[] {202}) - .map(response -> { - final int httpStatusCode = response.statusCode(); - updateDelayInMillisecondsFrom(response); - if (httpStatusCode == 202) { - String newLocationUrl = getHeader(response); - if (newLocationUrl != null) { - try { - data.locationUrl = new URL(newLocationUrl); - } catch (MalformedURLException mfue) { - throw Exceptions.propagate(mfue); - } + return ensureExpectedStatus(httpPollResponse, new int[]{202}) + .map(response -> { + final int httpStatusCode = response.getStatusCode(); + updateDelayInMillisecondsFrom(response); + if (httpStatusCode == 202) { + String newLocationUrl = getHeader(response); + if (newLocationUrl != null) { + try { + data.locationUrl = new URL(newLocationUrl); + } catch (MalformedURLException mfue) { + throw logger.logExceptionAsError(Exceptions.propagate(mfue)); } - } else { - data.done = true; } - return response; - }); + } else { + data.done = true; + } + return response; + }); } @Override @@ -112,20 +115,22 @@ public boolean isDone() { * then null will be returned. * @param originalHttpRequest The original HTTP request. * @param methodParser The method parser that describes the service interface method that - * initiated the long running operation. + * initiated the long running operation. * @param httpResponse The HTTP response that the required header values for this pollStrategy - * will be read from. + * will be read from. * @param delayInMilliseconds The delay (in milliseconds) that the resulting pollStrategy will - * use when polling. + * use when polling. */ - static PollStrategy tryToCreate(RestProxy restProxy, SwaggerMethodParser methodParser, HttpRequest originalHttpRequest, HttpResponse httpResponse, long delayInMilliseconds) { + static PollStrategy tryToCreate(RestProxy restProxy, SwaggerMethodParser methodParser, + HttpRequest originalHttpRequest, HttpResponse httpResponse, + long delayInMilliseconds) { final String locationUrl = getHeader(httpResponse); URL pollUrl = null; if (locationUrl != null && !locationUrl.isEmpty()) { if (locationUrl.startsWith("/")) { try { - final URL originalRequestUrl = originalHttpRequest.url(); + final URL originalRequestUrl = originalHttpRequest.getUrl(); pollUrl = new URL(originalRequestUrl, locationUrl); } catch (MalformedURLException ignored) { } @@ -141,17 +146,17 @@ static PollStrategy tryToCreate(RestProxy restProxy, SwaggerMethodParser methodP } return pollUrl == null - ? null - : new LocationPollStrategy( - new LocationPollStrategyData(restProxy, methodParser, pollUrl, delayInMilliseconds)); + ? null + : new LocationPollStrategy( + new LocationPollStrategyData(restProxy, methodParser, pollUrl, delayInMilliseconds)); } static String getHeader(HttpResponse httpResponse) { - return httpResponse.headerValue(HEADER_NAME); + return httpResponse.getHeaderValue(HEADER_NAME); } @Override - public Serializable strategyData() { + public Serializable getStrategyData() { return this.data; } } diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/OperationStatus.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/OperationStatus.java index 925fe82fbc31..8ac2cfab361a 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/OperationStatus.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/OperationStatus.java @@ -28,7 +28,7 @@ public class OperationStatus { this.pollStrategy = pollStrategy; this.result = null; this.error = null; - this.status = pollStrategy.status(); + this.status = pollStrategy.getStatus(); } /** @@ -61,7 +61,7 @@ public boolean isDone() { /** * @return the current status of the long running operation. */ - public String status() { + public String getStatus() { return status; } @@ -70,7 +70,7 @@ public String status() { * not done or if the operation failed, then return null. * @return The result of the operation, or null if the operation isn't done yet or if it failed. */ - public T result() { + public T getResult() { return result; } @@ -79,7 +79,7 @@ public T result() { * done or did not fail, then return null. * @return The error of the operation, or null if the operation isn't done or didn't fail. */ - public HttpResponseException error() { + public HttpResponseException getError() { return error; } @@ -93,8 +93,8 @@ public OperationDescription buildDescription() { } return new OperationDescription( - this.pollStrategy.methodParser().fullyQualifiedMethodName(), - this.pollStrategy.strategyData(), + this.pollStrategy.getMethodParser().getFullyQualifiedMethodName(), + this.pollStrategy.getStrategyData(), this.originalHttpRequest); } diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/PollStrategy.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/PollStrategy.java index 608c68193dee..a650f1c3d165 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/PollStrategy.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/PollStrategy.java @@ -45,20 +45,20 @@ abstract static class PollStrategyData implements Serializable { long delayInMilliseconds; PollStrategyData(RestProxy restProxy, - SwaggerMethodParser methodParser, - long delayInMilliseconds) { + SwaggerMethodParser methodParser, + long delayInMilliseconds) { this.restProxy = restProxy; this.methodParser = methodParser; this.delayInMilliseconds = delayInMilliseconds; } abstract PollStrategy initializeStrategy(RestProxy restProxy, - SwaggerMethodParser methodParser); + SwaggerMethodParser methodParser); } @SuppressWarnings("unchecked") protected T deserialize(String value, Type returnType) throws IOException { - return (T) restProxy.serializer().deserialize(value, returnType, SerializerEncoding.JSON); + return (T) restProxy.getSerializer().deserialize(value, returnType, SerializerEncoding.JSON); } protected Mono ensureExpectedStatus(HttpResponse httpResponse) { @@ -66,14 +66,15 @@ protected Mono ensureExpectedStatus(HttpResponse httpResponse) { } protected Mono ensureExpectedStatus(HttpResponse httpResponse, int[] additionalAllowedStatusCodes) { - Mono asyncDecodedResponse = new HttpResponseDecoder(restProxy.serializer()).decode(Mono.just(httpResponse), this.methodParser); + Mono asyncDecodedResponse = + new HttpResponseDecoder(restProxy.getSerializer()).decode(Mono.just(httpResponse), this.methodParser); return asyncDecodedResponse.flatMap(decodedResponse -> { return restProxy.ensureExpectedStatus(decodedResponse, methodParser, additionalAllowedStatusCodes); }).map(decodedResponse -> httpResponse); } - protected String fullyQualifiedMethodName() { - return methodParser.fullyQualifiedMethodName(); + protected String getFullyQualifiedMethodName() { + return methodParser.getFullyQualifiedMethodName(); } protected boolean expectsResourceResponse() { @@ -101,7 +102,7 @@ final void updateDelayInMillisecondsFrom(HttpResponse httpPollResponse) { static Long delayInMillisecondsFrom(HttpResponse httpResponse) { Long result = null; - final String retryAfterSecondsString = httpResponse.headerValue("Retry-After"); + final String retryAfterSecondsString = httpResponse.getHeaderValue("Retry-After"); if (retryAfterSecondsString != null && !retryAfterSecondsString.isEmpty()) { result = Long.parseLong(retryAfterSecondsString) * 1000; } @@ -126,7 +127,7 @@ Mono delayAsync() { /** * @return the current status of the long running operation. */ - String status() { + String getStatus() { return status; } @@ -160,18 +161,23 @@ void setStatus(String status) { Mono sendPollRequestWithDelay() { return Mono.defer(() -> delayAsync().then(Mono.defer(() -> { final HttpRequest pollRequest = createPollRequest(); - return restProxy.send(pollRequest, new Context("caller-method", fullyQualifiedMethodName())); + return restProxy.send(pollRequest, new Context("caller-method", getFullyQualifiedMethodName())); })).flatMap(response -> updateFromAsync(response))); } - Mono> createOperationStatusMono(HttpRequest httpRequest, HttpResponse httpResponse, SwaggerMethodParser methodParser, Type operationStatusResultType, Context context) { + Mono> createOperationStatusMono(HttpRequest httpRequest, HttpResponse httpResponse, + SwaggerMethodParser methodParser, Type operationStatusResultType, Context context) { OperationStatus operationStatus; if (!isDone()) { operationStatus = new OperationStatus<>(this, httpRequest); } else { try { - final Object resultObject = restProxy.handleRestReturnType(new HttpResponseDecoder(restProxy.serializer()).decode(Mono.just(httpResponse), this.methodParser), methodParser, operationStatusResultType, context); - operationStatus = new OperationStatus<>(resultObject, status()); + final Object resultObject = + restProxy.handleRestReturnType( + new HttpResponseDecoder(restProxy.getSerializer()).decode(Mono.just(httpResponse), + this.methodParser), + methodParser, operationStatusResultType, context); + operationStatus = new OperationStatus<>(resultObject, getStatus()); } catch (HttpResponseException e) { operationStatus = new OperationStatus<>(e, OperationState.FAILED); } @@ -179,26 +185,28 @@ Mono> createOperationStatusMono(HttpRequest httpRequest, return Mono.just(operationStatus); } - Flux> pollUntilDoneWithStatusUpdates(final HttpRequest originalHttpRequest, final SwaggerMethodParser methodParser, final Type operationStatusResultType, Context context) { + Flux> pollUntilDoneWithStatusUpdates(final HttpRequest originalHttpRequest, + final SwaggerMethodParser methodParser, final Type operationStatusResultType, final Context context) { return sendPollRequestWithDelay() - .flatMap(httpResponse -> createOperationStatusMono(originalHttpRequest, httpResponse, methodParser, operationStatusResultType, context)) - .repeat() - .takeUntil(operationStatus -> isDone()); + .flatMap(httpResponse -> createOperationStatusMono(originalHttpRequest, httpResponse, methodParser, + operationStatusResultType, context)) + .repeat() + .takeUntil(operationStatus -> isDone()); } Mono pollUntilDone() { return sendPollRequestWithDelay() - .repeat() - .takeUntil(ignored -> isDone()) - .last(); + .repeat() + .takeUntil(ignored -> isDone()) + .last(); } /** * @return The data for the strategy. */ - public abstract Serializable strategyData(); + public abstract Serializable getStrategyData(); - SwaggerMethodParser methodParser() { + SwaggerMethodParser getMethodParser() { return this.methodParser; } } diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/ProvisioningStatePollStrategy.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/ProvisioningStatePollStrategy.java index affef85b7a56..7ec03c4e6d3b 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/ProvisioningStatePollStrategy.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/ProvisioningStatePollStrategy.java @@ -10,6 +10,7 @@ import com.azure.core.implementation.SwaggerMethodParser; import com.azure.core.management.CloudException; import com.azure.core.management.OperationState; +import com.azure.core.util.logging.ClientLogger; import reactor.core.publisher.Mono; import java.io.IOException; @@ -20,7 +21,7 @@ * state property is in a completed state. */ public final class ProvisioningStatePollStrategy extends PollStrategy { - + private final ClientLogger logger = new ClientLogger(ProvisioningStatePollStrategy.class); private ProvisioningStatePollStrategyData data; ProvisioningStatePollStrategy(ProvisioningStatePollStrategyData data) { @@ -44,7 +45,7 @@ public static class ProvisioningStatePollStrategyData extends PollStrategy.PollS * Create a new ProvisioningStatePollStrategyData. * @param restProxy The RestProxy that created this PollStrategy. * @param methodParser The method parser that describes the service interface method that - * initiated the long running operation. + * initiated the long running operation. * @param originalRequest The HTTP response to the original HTTP request. * @param provisioningState The provisioning state. * @param delayInMilliseconds The delay value. @@ -60,7 +61,7 @@ public ProvisioningStatePollStrategyData(RestProxy restProxy, } PollStrategy initializeStrategy(RestProxy restProxy, - SwaggerMethodParser methodParser) { + SwaggerMethodParser methodParser) { this.restProxy = restProxy; this.methodParser = methodParser; return new ProvisioningStatePollStrategy(this); @@ -70,7 +71,7 @@ PollStrategy initializeStrategy(RestProxy restProxy, @Override HttpRequest createPollRequest() { - return new HttpRequest(HttpMethod.GET, data.originalRequest.url()); + return new HttpRequest(HttpMethod.GET, data.originalRequest.getUrl()); } @Override @@ -78,7 +79,7 @@ Mono updateFromAsync(HttpResponse pollResponse) { return ensureExpectedStatus(pollResponse) .flatMap(response -> { final HttpResponse bufferedHttpPollResponse = response.buffer(); - return bufferedHttpPollResponse.bodyAsString() + return bufferedHttpPollResponse.getBodyAsString() .map(responseBody -> { ResourceWithProvisioningState resource = null; try { @@ -86,12 +87,17 @@ Mono updateFromAsync(HttpResponse pollResponse) { } catch (IOException ignored) { } - if (resource == null || resource.properties() == null || resource.properties().provisioningState() == null) { - throw new CloudException("The polling response does not contain a valid body", bufferedHttpPollResponse, null); - } else if (OperationState.isFailedOrCanceled(resource.properties().provisioningState())) { - throw new CloudException("Async operation failed with provisioning state: " + resource.properties().provisioningState(), bufferedHttpPollResponse); + if (resource == null + || resource.getProperties() == null + || resource.getProperties().getProvisioningState() == null) { + throw logger.logExceptionAsError(new CloudException("The polling response does not " + + "contain a valid body", bufferedHttpPollResponse, null)); + } else if (OperationState.isFailedOrCanceled(resource.getProperties().getProvisioningState())) { + throw logger.logExceptionAsError(new CloudException("Async operation failed with " + + "provisioning state: " + resource.getProperties().getProvisioningState(), + bufferedHttpPollResponse)); } else { - setStatus(resource.properties().provisioningState()); + setStatus(resource.getProperties().getProvisioningState()); } return bufferedHttpPollResponse; }); @@ -100,11 +106,11 @@ Mono updateFromAsync(HttpResponse pollResponse) { @Override boolean isDone() { - return OperationState.isCompleted(status()); + return OperationState.isCompleted(getStatus()); } @Override - public Serializable strategyData() { + public Serializable getStrategyData() { return this.data; } } diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/ResourceWithProvisioningState.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/ResourceWithProvisioningState.java index 6f53ed833aef..14b6d3b32998 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/ResourceWithProvisioningState.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/ResourceWithProvisioningState.java @@ -16,7 +16,7 @@ public class ResourceWithProvisioningState { /** * @return The inner properties object. */ - public Properties properties() { + public Properties getProperties() { return properties; } @@ -38,7 +38,7 @@ public static class Properties { /** * @return The provisioning state of the resource. */ - String provisioningState() { + String getProvisioningState() { return provisioningState; } diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/serializer/CloudErrorDeserializer.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/serializer/CloudErrorDeserializer.java index d189374d4f7d..fdb443dcbd52 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/serializer/CloudErrorDeserializer.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/serializer/CloudErrorDeserializer.java @@ -19,7 +19,7 @@ */ final class CloudErrorDeserializer extends JsonDeserializer { /** Object mapper for default deserializations. */ - private ObjectMapper mapper; + private final ObjectMapper mapper; /** * Creates an instance of CloudErrorDeserializer. 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 c61f36a953b2..0935a2ebedb6 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 @@ -405,11 +405,11 @@ public void syncPutRequestWithUnexpectedResponse() { .putWithUnexpectedResponse("I'm the body!"); fail("Expected RestException would be thrown."); } catch (HttpResponseException e) { - assertNotNull(e.value()); - assertTrue(e.value() instanceof LinkedHashMap); + assertNotNull(e.getValue()); + assertTrue(e.getValue() instanceof LinkedHashMap); @SuppressWarnings("unchecked") - final LinkedHashMap expectedBody = (LinkedHashMap) e.value(); + final LinkedHashMap expectedBody = (LinkedHashMap) e.getValue(); assertEquals("I'm the body!", expectedBody.get("data")); } } @@ -421,8 +421,8 @@ public void syncPutRequestWithUnexpectedResponseAndExceptionType() { .putWithUnexpectedResponseAndExceptionType("I'm the body!"); fail("Expected RestException would be thrown."); } catch (MyAzureException e) { - assertNotNull(e.value()); - assertEquals("I'm the body!", e.value().data()); + assertNotNull(e.getValue()); + assertEquals("I'm the body!", e.getValue().data()); } catch (Throwable e) { fail("Throwable of wrong type thrown."); } @@ -453,7 +453,7 @@ private interface Service10 { public void syncRestResponseHeadRequest() { ResponseBase res = createService(Service10.class) .restResponseHead(); - assertNull(res.value()); + assertNull(res.getValue()); } @Test @@ -468,7 +468,7 @@ public void asyncRestResponseHeadRequest() { .restResponseHeadAsync() .block(); - assertNull(res.value()); + assertNull(res.getValue()); } @Test diff --git a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/AzureProxyToRestProxyWithNettyTests.java b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/AzureProxyToRestProxyWithNettyTests.java deleted file mode 100644 index 30fdd2481542..000000000000 --- a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/AzureProxyToRestProxyWithNettyTests.java +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.management; - -import com.azure.core.http.HttpClient; - -public class AzureProxyToRestProxyWithNettyTests extends AzureProxyToRestProxyTests { - - @Override - protected HttpClient createHttpClient() { - return HttpClient.createDefault(); - } -} diff --git a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/MyAzureException.java b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/MyAzureException.java index 08b6c60a6970..ee5edf0d700e 100644 --- a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/MyAzureException.java +++ b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/MyAzureException.java @@ -19,7 +19,7 @@ public MyAzureException(String message, HttpResponse response, HttpBinJSON body) } @Override - public HttpBinJSON value() { - return (HttpBinJSON) super.value(); + public HttpBinJSON getValue() { + return (HttpBinJSON) super.getValue(); } } diff --git a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/PagedListTests.java b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/PagedListTests.java index 6fd9eb84483e..47eaa783f998 100644 --- a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/PagedListTests.java +++ b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/PagedListTests.java @@ -195,12 +195,12 @@ public void testRemoveViaIteratorWhileIterating() { public void canHandleIntermediateEmptyPage() { List pagedList = new PagedList(new Page() { @Override - public String nextPageLink() { + public String getNextPageLink() { return "A"; } @Override - public List items() { + public List getItems() { List list = new ArrayList<>(); list.add(1); list.add(2); @@ -212,24 +212,24 @@ public Page nextPage(String nextPageLink) { if (nextPageLink == "A") { return new Page() { @Override - public String nextPageLink() { + public String getNextPageLink() { return "B"; } @Override - public List items() { + public List getItems() { return new ArrayList<>(); // EMPTY PAGE } }; } else if (nextPageLink == "B") { return new Page() { @Override - public String nextPageLink() { + public String getNextPageLink() { return "C"; } @Override - public List items() { + public List getItems() { List list = new ArrayList<>(); list.add(3); list.add(4); @@ -239,12 +239,12 @@ public List items() { } else if (nextPageLink == "C") { return new Page() { @Override - public String nextPageLink() { + public String getNextPageLink() { return null; } @Override - public List items() { + public List getItems() { List list = new ArrayList<>(); list.add(5); list.add(6); @@ -276,7 +276,7 @@ Flux toFlux() { } Flux firstFlux() { - return Flux.defer((Supplier>) () -> Flux.fromIterable(list.currentPage().items())); + return Flux.defer((Supplier>) () -> Flux.fromIterable(list.getCurrentPage().getItems())); } Flux nextFlux() { @@ -284,7 +284,7 @@ Flux nextFlux() { if (list.hasNextPage()) { list.loadNextPage(); loadNextPageCallCount++; - return Flux.fromIterable(list.currentPage().items()).concatWith(Flux.defer(new Supplier>() { + return Flux.fromIterable(list.getCurrentPage().getItems()).concatWith(Flux.defer(new Supplier>() { @Override public Flux get() { return nextFlux(); @@ -319,7 +319,7 @@ public TestPage(int page, int max) { } @Override - public String nextPageLink() { + public String getNextPageLink() { if (page + 1 == max) { return null; } @@ -327,7 +327,7 @@ public String nextPageLink() { } @Override - public List items() { + public List getItems() { if (page + 1 != max) { List items = new ArrayList<>(); items.add(page); diff --git a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/http/AzureProxyToRestProxyWithDefaultHttpClientTests.java b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/http/AzureProxyToRestProxyWithDefaultHttpClientTests.java new file mode 100644 index 000000000000..82e0054186ee --- /dev/null +++ b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/http/AzureProxyToRestProxyWithDefaultHttpClientTests.java @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.management.http; + +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureProxyToRestProxyTests; + +public class AzureProxyToRestProxyWithDefaultHttpClientTests extends AzureProxyToRestProxyTests { + + @Override + protected HttpClient createHttpClient() { + return HttpClient.createDefault(); + } +} 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 00f5e943a014..350fb156b78b 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 @@ -9,7 +9,6 @@ import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; -import com.azure.core.http.ProxyOptions; import com.azure.core.implementation.util.FluxUtil; import com.azure.core.management.AsyncOperationResource; import com.azure.core.management.HttpBinJSON; @@ -25,7 +24,6 @@ import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; -import java.util.function.Supplier; /** * This HttpClient attempts to mimic the behavior of http://httpbin.org without ever making a network call. @@ -59,20 +57,20 @@ public Mono send(HttpRequest request) { MockHttpResponse response = null; try { - final URL requestUrl = request.url(); + final URL requestUrl = request.getUrl(); final String requestHost = requestUrl.getHost(); final String requestPath = requestUrl.getPath(); final String requestPathLower = requestPath.toLowerCase(); if (requestHost.equalsIgnoreCase("httpbin.org")) { if (requestPathLower.equals("/anything") || requestPathLower.startsWith("/anything/")) { - if ("HEAD".equals(request.httpMethod())) { + if ("HEAD".equals(request.getHttpMethod())) { response = new MockHttpResponse(request, 200, responseHeaders(), ""); } else { final HttpBinJSON json = new HttpBinJSON(); - json.url(request.url().toString() + json.url(request.getUrl().toString() // This is just to mimic the behavior we've seen with httpbin.org. .replace("%20", " ")); - json.headers(toMap(request.headers())); + json.headers(toMap(request.getHeaders())); response = new MockHttpResponse(request, 200, responseHeaders(), json); } } else if (requestPathLower.startsWith("/bytes/")) { @@ -81,27 +79,27 @@ public Mono send(HttpRequest request) { response = new MockHttpResponse(request, 200, responseHeaders(), new byte[byteCount]); } else if (requestPathLower.equals("/delete")) { final HttpBinJSON json = new HttpBinJSON(); - json.url(request.url().toString()); + 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(); - json.url(request.url().toString()); - json.headers(toMap(request.headers())); + 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(); - json.url(request.url().toString()); + 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(); - json.url(request.url().toString()); + 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(); - json.url(request.url().toString()); + json.url(request.getUrl().toString()); json.data(bodyToString(request)); response = new MockHttpResponse(request, 200, responseHeaders(), json); } else if (requestPathLower.startsWith("/status/")) { @@ -110,7 +108,7 @@ public Mono send(HttpRequest request) { response = new MockHttpResponse(request, statusCode, responseHeaders(), new byte[0]); } } else if (requestHost.equalsIgnoreCase("mock.azure.com")) { - if (request.httpMethod() == HttpMethod.GET) { + if (request.getHttpMethod() == HttpMethod.GET) { if (requestPathLower.contains("/mockprovider/mockresources/")) { ++getRequests; --pollsRemaining; @@ -150,11 +148,11 @@ public Mono send(HttpRequest request) { } else { --pollsRemaining; response = new MockHttpResponse(request, 202, responseHeaders(), new byte[0]) - .addHeader(LocationPollStrategy.HEADER_NAME, request.url().toString()); + .addHeader(LocationPollStrategy.HEADER_NAME, request.getUrl().toString()); } } } - } else if (request.httpMethod() == HttpMethod.PUT) { + } else if (request.getHttpMethod() == HttpMethod.PUT) { ++createRequests; final Map requestQueryMap = queryToMap(requestUrl.getQuery()); @@ -209,7 +207,7 @@ public Mono send(HttpRequest request) { response.addHeader(LocationPollStrategy.HEADER_NAME, pollUrl + "?PollType=" + LocationPollStrategy.HEADER_NAME); } } - } else if (request.httpMethod() == HttpMethod.DELETE) { + } else if (request.getHttpMethod() == HttpMethod.DELETE) { ++deleteRequests; final Map requestQueryMap = queryToMap(requestUrl.getQuery()); @@ -254,21 +252,6 @@ public Mono send(HttpRequest request) { return Mono.just(response); } - @Override - public HttpClient proxy(Supplier proxyOptions) { - throw new IllegalStateException("MockHttpClient.proxy"); - } - - @Override - public HttpClient wiretap(boolean enableWiretap) { - throw new IllegalStateException("MockHttpClient.wiretap"); - } - - @Override - public HttpClient port(int port) { - throw new IllegalStateException("MockHttpClient.port"); - } - private static Map queryToMap(String url) { final Map result = new HashMap<>(); @@ -288,7 +271,7 @@ private static Map queryToMap(String url) { } private static String bodyToString(HttpRequest request) throws IOException { - Mono asyncString = FluxUtil.collectBytesInByteBufStream(request.body(), false) + Mono asyncString = FluxUtil.collectBytesInByteBufferStream(request.getBody()) .map(bytes -> new String(bytes, StandardCharsets.UTF_8)); return asyncString.block(); } @@ -296,7 +279,7 @@ private static String bodyToString(HttpRequest request) throws IOException { private static Map toMap(HttpHeaders headers) { final Map result = new HashMap<>(); for (final HttpHeader header : headers) { - result.put(header.name(), header.value()); + result.put(header.getName(), header.getValue()); } return result; } diff --git a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/implementation/AzureProxyTests.java b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/implementation/AzureProxyTests.java index 05adb15d5994..162c984966b5 100644 --- a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/implementation/AzureProxyTests.java +++ b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/implementation/AzureProxyTests.java @@ -46,7 +46,7 @@ public class AzureProxyTests { @Before public void beforeTest() { - delayInMillisecondsBackup = AzureProxy.defaultDelayInMilliseconds(); + delayInMillisecondsBackup = AzureProxy.getDefaultDelayInMilliseconds(); AzureProxy.setDefaultPollingDelayInMilliseconds(0); } @@ -518,7 +518,7 @@ public void accept(OperationStatus operationStatus) { if (!operationStatus.isDone()) { inProgressCount.incrementAndGet(); } else { - resource.set(operationStatus.result()); + resource.set(operationStatus.getResult()); } } }); @@ -561,7 +561,7 @@ public void accept(OperationStatus operationStatus) { } inProgressCount.incrementAndGet(); } else { - resource.set(operationStatus.result()); + resource.set(operationStatus.getResult()); } } }); @@ -570,7 +570,7 @@ public void accept(OperationStatus operationStatus) { PollStrategy.PollStrategyData pollData = null; try { operationDescription = mapper.readValue(data.toString(), OperationDescription.class); - pollData = (PollStrategy.PollStrategyData) operationDescription.pollStrategyData(); + pollData = (PollStrategy.PollStrategyData) operationDescription.getPollStrategyData(); } catch (IOException e) { fail("Error deserializing OperationDescription object"); e.printStackTrace(); @@ -594,7 +594,7 @@ public void accept(OperationStatus operationStatus) { } inProgressCount.incrementAndGet(); } else { - resource.set(operationStatus.result()); + resource.set(operationStatus.getResult()); } } }); @@ -616,7 +616,7 @@ public void accept(OperationStatus operationStatus) { if (!operationStatus.isDone()) { inProgressCount.incrementAndGet(); } else { - resource.set(operationStatus.result()); + resource.set(operationStatus.getResult()); } } }); @@ -646,7 +646,7 @@ public void accept(OperationStatus operationStatus) { if (!operationStatus.isDone()) { inProgressCount.incrementAndGet(); } else { - resource.set(operationStatus.result()); + resource.set(operationStatus.getResult()); } } }); @@ -676,7 +676,7 @@ public void accept(OperationStatus operationStatus) { if (!operationStatus.isDone()) { inProgressCount.incrementAndGet(); } else { - resource.set(operationStatus.result()); + resource.set(operationStatus.getResult()); } } }); @@ -846,7 +846,7 @@ public Mono send(HttpRequest request) { service.deleteAsyncWithForbiddenResponse().block(); fail("Expected RestException to be thrown."); } catch (HttpResponseException e) { - assertEquals(403, e.response().statusCode()); + assertEquals(403, e.getResponse().getStatusCode()); assertEquals("Status code 403, (empty body)", e.getMessage()); } } diff --git a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/implementation/Value.java b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/implementation/Value.java index eb1191d90f12..d78c093467d4 100644 --- a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/implementation/Value.java +++ b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/implementation/Value.java @@ -6,7 +6,7 @@ /** * A container for a generic type. Serves a similar purpose as pointers in C/C++. It's a workaround * for the fact that Java doesn't allow mutation of local variables in closure. - * @param + * @param The type of the object stored within the {@link Value} instance */ public class Value { private T value; @@ -19,7 +19,7 @@ public class Value { /** * Create a new Value with the provided inner value. - * @param value + * @param value The type of the object stored within the {@link Value} instance */ Value(T value) { set(value); diff --git a/sdk/core/azure-core-test/README.md b/sdk/core/azure-core-test/README.md index 6bd321f2e250..1f208b0159c0 100644 --- a/sdk/core/azure-core-test/README.md +++ b/sdk/core/azure-core-test/README.md @@ -116,3 +116,5 @@ If you would like to become an active contributor to this project please follow [RecordedData.java]: ./src/main/java/com/azure/core/test/models/RecordedData.java [RecordNetworkCallPolicy.java]: ./src/main/java/com/azure/core/test/policy/RecordNetworkCallPolicy.java [TestBase.java]: ./src/main/java/com/azure/core/test/TestBase.java + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/core/azure-core-test/README.png) diff --git a/sdk/core/azure-core-test/pom.xml b/sdk/core/azure-core-test/pom.xml index 1dfe550f3e2e..0cd229792cb5 100644 --- a/sdk/core/azure-core-test/pom.xml +++ b/sdk/core/azure-core-test/pom.xml @@ -6,14 +6,14 @@ com.azure azure-client-sdk-parent - 1.3.0 + 1.4.0 ../../../pom.client.xml com.azure azure-core-test jar - 1.0.0-preview.4 + 1.0.0-preview.5 Microsoft Azure Java Core Test Library This package contains core test types for Azure Java clients. @@ -32,11 +32,15 @@ scm:git:https://github.com/Azure/azure-sdk-for-java.git + + com.azure.core.test + + com.azure azure-core - 1.0.0-preview.4 + 1.0.0-preview.5 diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/InterceptorManager.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/InterceptorManager.java index f1a3fba56d91..24af3196398b 100644 --- a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/InterceptorManager.java +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/InterceptorManager.java @@ -8,10 +8,9 @@ import com.azure.core.test.models.NetworkCallRecord; import com.azure.core.test.models.RecordedData; import com.azure.core.test.policy.RecordNetworkCallPolicy; +import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; @@ -38,7 +37,7 @@ public class InterceptorManager implements AutoCloseable { private static final String RECORD_FOLDER = "session-records/"; - private final Logger logger = LoggerFactory.getLogger(InterceptorManager.class); + private final ClientLogger logger = new ClientLogger(InterceptorManager.class); private final Map textReplacementRules; private final String testName; private final TestMode testMode; @@ -80,12 +79,12 @@ public InterceptorManager(String testName, TestMode testMode) throws IOException /** * Creates a new InterceptorManager that replays test session records. It takes a set of * {@code textReplacementRules}, that can be used by {@link PlaybackClient} to replace values in a - * {@link NetworkCallRecord#response()}. + * {@link NetworkCallRecord#getResponse()}. * * The test session records are read from: "session-records/{@code testName}.json" * * @param testName Name of the test session record. - * @param textReplacementRules A set of rules to replace text in {@link NetworkCallRecord#response()} when playing + * @param textReplacementRules A set of rules to replace text in {@link NetworkCallRecord#getResponse()} when playing * back network calls. * @throws IOException An existing test session record could not be located or the data could not be deserialized * into an instance of {@link RecordedData}. @@ -174,8 +173,8 @@ private void writeDataToFile() throws IOException { mapper.enable(SerializationFeature.INDENT_OUTPUT); File recordFile = getRecordFile(testName); - if (recordFile.createNewFile() && logger.isTraceEnabled()) { - logger.trace("Created record file: {}", recordFile.getPath()); + if (recordFile.createNewFile()) { + logger.verbose("Created record file: {}", recordFile.getPath()); } mapper.writeValue(recordFile, recordedData); @@ -186,15 +185,13 @@ private File getRecordFile(String testName) { File folderFile = new File(folderUrl.getPath() + RECORD_FOLDER); if (!folderFile.exists()) { - if (folderFile.mkdir() && logger.isTraceEnabled()) { - logger.trace("Created directory: {}", folderFile.getPath()); + if (folderFile.mkdir()) { + logger.verbose("Created directory: {}", folderFile.getPath()); } } String filePath = folderFile.getPath() + "/" + testName + ".json"; - if (logger.isInfoEnabled()) { - logger.info("==> Playback file path: " + filePath); - } + logger.info("==> Playback file path: " + filePath); return new File(filePath); } diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/TestBase.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/TestBase.java index 6bc1b4a0e6ae..4bb24e800651 100644 --- a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/TestBase.java +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/TestBase.java @@ -43,7 +43,7 @@ public static void setupClass() { */ @Before public void setupTest() { - final String testName = testName(); + final String testName = getTestName(); if (logger.isInfoEnabled()) { logger.info("Test Mode: {}, Name: {}", testMode, testName); } @@ -82,12 +82,12 @@ public TestMode getTestMode() { /** * Gets the name of the current test being run. *

- * NOTE: This could not be implemented in the base class using {@link TestName} because it always returns {@code - * null}. See https://stackoverflow.com/a/16113631/4220757. + * NOTE: This could not be implemented in the base class using {@link TestName} because it always returns + * {@code null}. See https://stackoverflow.com/a/16113631/4220757. * * @return The name of the current test. */ - protected abstract String testName(); + protected abstract String getTestName(); /** * Performs any set-up before each test case. Any initialization that occurs in TestBase occurs first before this. diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/MockHttpResponse.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/MockHttpResponse.java index 92e995f8c9a0..ae27783c0fba 100644 --- a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/MockHttpResponse.java +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/MockHttpResponse.java @@ -10,12 +10,11 @@ import com.azure.core.implementation.serializer.SerializerEncoding; import com.azure.core.implementation.serializer.jackson.JacksonAdapter; import com.azure.core.implementation.util.ImplUtils; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.io.IOException; +import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.Objects; @@ -68,7 +67,7 @@ public MockHttpResponse(HttpRequest request, int statusCode, HttpHeaders headers this.statusCode = statusCode; this.headers = headers; this.bodyBytes = ImplUtils.clone(bodyBytes); - this.request(request); + this.setRequest(request); } /** @@ -99,7 +98,7 @@ private static byte[] serialize(Object serializable) { * {@inheritDoc} */ @Override - public int statusCode() { + public int getStatusCode() { return statusCode; } @@ -107,7 +106,7 @@ public int statusCode() { * {@inheritDoc} */ @Override - public String headerValue(String name) { + public String getHeaderValue(String name) { return headers.value(name); } @@ -115,7 +114,7 @@ public String headerValue(String name) { * {@inheritDoc} */ @Override - public HttpHeaders headers() { + public HttpHeaders getHeaders() { return new HttpHeaders(headers); } @@ -123,7 +122,7 @@ public HttpHeaders headers() { * {@inheritDoc} */ @Override - public Mono bodyAsByteArray() { + public Mono getBodyAsByteArray() { if (bodyBytes == null) { return Mono.empty(); } else { @@ -135,11 +134,11 @@ public Mono bodyAsByteArray() { * {@inheritDoc} */ @Override - public Flux body() { + public Flux getBody() { if (bodyBytes == null) { return Flux.empty(); } else { - return Flux.just(Unpooled.wrappedBuffer(bodyBytes)); + return Flux.just(ByteBuffer.wrap(bodyBytes)); } } @@ -147,15 +146,15 @@ public Flux body() { * {@inheritDoc} */ @Override - public Mono bodyAsString() { - return bodyAsString(StandardCharsets.UTF_8); + public Mono getBodyAsString() { + return getBodyAsString(StandardCharsets.UTF_8); } /** * {@inheritDoc} */ @Override - public Mono bodyAsString(Charset charset) { + public Mono getBodyAsString(Charset charset) { Objects.requireNonNull(charset); return bodyBytes == null diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/PlaybackClient.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/PlaybackClient.java index fc3641a95017..1e46f15d39bc 100644 --- a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/PlaybackClient.java +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/http/PlaybackClient.java @@ -6,33 +6,34 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; -import com.azure.core.http.ProxyOptions; +import com.azure.core.implementation.http.UrlBuilder; import com.azure.core.test.models.NetworkCallRecord; import com.azure.core.test.models.RecordedData; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import com.azure.core.util.logging.ClientLogger; +import reactor.core.Exceptions; import reactor.core.publisher.Mono; -import java.net.URI; +import java.io.ByteArrayOutputStream; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.Supplier; /** * HTTP client that plays back {@link NetworkCallRecord NetworkCallRecords}. */ public final class PlaybackClient implements HttpClient { - private final Logger logger = LoggerFactory.getLogger(PlaybackClient.class); + private static final String X_MS_CLIENT_REQUEST_ID = "x-ms-client-request-id"; + private static final String X_MS_ENCRYPTION_KEY_SHA256 = "x-ms-encryption-key-sha256"; + private final ClientLogger logger = new ClientLogger(PlaybackClient.class); private final AtomicInteger count = new AtomicInteger(0); private final Map textReplacementRules; private final RecordedData recordedData; /** - * Creates a PlaybackClient that replays network calls from {@code recordedData} and replaces - * {@link NetworkCallRecord#response() response text} for any rules specified in {@code textReplacementRules}. + * Creates a PlaybackClient that replays network calls from {@code recordedData} and replaces {@link + * NetworkCallRecord#getResponse() response text} for any rules specified in {@code textReplacementRules}. * * @param recordedData The data to playback. * @param textReplacementRules A set of rules to replace text in network call responses. @@ -52,54 +53,41 @@ public Mono send(final HttpRequest request) { return Mono.defer(() -> playbackHttpResponse(request)); } - /** - * {@inheritDoc} - */ - @Override - public HttpClient proxy(Supplier supplier) { - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public HttpClient wiretap(boolean b) { - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public HttpClient port(int i) { - return this; - } - private Mono playbackHttpResponse(final HttpRequest request) { - final String incomingUrl = applyReplacementRule(request.url().toString()); - final String incomingMethod = request.httpMethod().toString(); + final String incomingUrl = applyReplacementRule(request.getUrl().toString()); + final String incomingMethod = request.getHttpMethod().toString(); final String matchingUrl = removeHost(incomingUrl); NetworkCallRecord networkCallRecord = recordedData.findFirstAndRemoveNetworkCall(record -> - record.method().equalsIgnoreCase(incomingMethod) && removeHost(record.uri()).equalsIgnoreCase(matchingUrl)); + record.getMethod().equalsIgnoreCase(incomingMethod) && removeHost(record.getUri()).equalsIgnoreCase(matchingUrl)); count.incrementAndGet(); if (networkCallRecord == null) { - if (logger.isWarnEnabled()) { - logger.warn("NOT FOUND - Method: {} URL: {}", incomingMethod, incomingUrl); - logger.warn("Records requested: {}.", count); - } + logger.warning("NOT FOUND - Method: {} URL: {}", incomingMethod, incomingUrl); + logger.warning("Records requested: {}.", count); return Mono.error(new IllegalStateException("==> Unexpected request: " + incomingMethod + " " + incomingUrl)); } - int recordStatusCode = Integer.parseInt(networkCallRecord.response().get("StatusCode")); + if (networkCallRecord.getException() != null) { + throw logger.logExceptionAsWarning(Exceptions.propagate(networkCallRecord.getException().get())); + } + + // Overwrite the request header if any. + if (networkCallRecord.getHeaders().containsKey(X_MS_CLIENT_REQUEST_ID)) { + request.setHeader(X_MS_CLIENT_REQUEST_ID, networkCallRecord.getHeaders().get(X_MS_CLIENT_REQUEST_ID)); + } + if (request.getHeaders().value(X_MS_ENCRYPTION_KEY_SHA256) != null) { + networkCallRecord.getResponse().put(X_MS_ENCRYPTION_KEY_SHA256, + request.getHeaders().value(X_MS_ENCRYPTION_KEY_SHA256)); + } + + int recordStatusCode = Integer.parseInt(networkCallRecord.getResponse().get("StatusCode")); HttpHeaders headers = new HttpHeaders(); - for (Map.Entry pair : networkCallRecord.response().entrySet()) { + for (Map.Entry pair : networkCallRecord.getResponse().entrySet()) { if (!pair.getKey().equals("StatusCode") && !pair.getKey().equals("Body")) { String rawHeader = pair.getValue(); for (Map.Entry rule : textReplacementRules.entrySet()) { @@ -111,8 +99,8 @@ private Mono playbackHttpResponse(final HttpRequest request) { } } - String rawBody = networkCallRecord.response().get("Body"); - byte[] bytes = new byte[0]; + String rawBody = networkCallRecord.getResponse().get("Body"); + byte[] bytes = null; if (rawBody != null) { for (Map.Entry rule : textReplacementRules.entrySet()) { @@ -121,7 +109,20 @@ private Mono playbackHttpResponse(final HttpRequest request) { } } - bytes = rawBody.getBytes(StandardCharsets.UTF_8); + String contentType = networkCallRecord.getResponse().get("Content-Type"); + + // octet-stream's are written to disk using Arrays.toString() which creates an output such as "[12, -1]". + if (contentType != null && contentType.equalsIgnoreCase("application/octet-stream")) { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + for (String piece : rawBody.substring(1, rawBody.length() - 1).split(", ")) { + outputStream.write(Byte.parseByte(piece)); + } + + bytes = outputStream.toByteArray(); + } else { + bytes = rawBody.getBytes(StandardCharsets.UTF_8); + } + if (bytes.length > 0) { headers.put("Content-Length", String.valueOf(bytes.length)); } @@ -141,7 +142,12 @@ private String applyReplacementRule(String text) { } private static String removeHost(String url) { - URI uri = URI.create(url); - return String.format("%s?%s", uri.getPath(), uri.getQuery()); + UrlBuilder urlBuilder = UrlBuilder.parse(url); + + if (urlBuilder.getQuery().containsKey("sig")) { + urlBuilder.setQueryParameter("sig", "REDACTED"); + } + + return String.format("%s%s", urlBuilder.getPath(), urlBuilder.queryString()); } } diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/models/NetworkCallError.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/models/NetworkCallError.java new file mode 100644 index 000000000000..a222d0640ab5 --- /dev/null +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/models/NetworkCallError.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.test.models; + +import com.azure.core.exception.UnexpectedLengthException; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.net.UnknownHostException; + +/** + * This class represents a caught throwable during a network call. It is used to serialize exceptions that were thrown + * during the pipeline and deserialize them back into their actual throwable class when running in playback mode. + */ +public class NetworkCallError { + @JsonProperty("ClassName") + private String className; + + @JsonProperty("ErrorMessage") + private String errorMessage; + + private Throwable throwable; + + /** + * Empty constructor used by deserialization. + */ + public NetworkCallError() { + } + + /** + * Constructs the class setting the throwable and its class name. + * + * @param throwable Throwable thrown during a network call. + */ + public NetworkCallError(Throwable throwable) { + this.throwable = throwable; + this.className = throwable.getClass().getName(); + this.errorMessage = throwable.getMessage(); + } + + /** + * @return the thrown throwable as the class it was thrown as by converting is using its class name. + */ + public Throwable get() { + switch (className) { + case "java.lang.NullPointerException": + return new NullPointerException(this.errorMessage); + + case "java.lang.IndexOutOfBoundsException": + return new IndexOutOfBoundsException(this.errorMessage); + + case "java.net.UnknownHostException": + return new UnknownHostException(this.errorMessage); + + case "com.azure.core.exception.UnexpectedLengthException": + return new UnexpectedLengthException(this.errorMessage, 0L, 0L); + + default: + return throwable; + } + } + + /** + * Sets the throwable that was thrown during a network call. + * + * @param throwable Throwable that was thrown. + */ + public void setThrowable(Throwable throwable) { + this.throwable = throwable; + } + + /** + * Sets the name of the class of the throwable. This is used during deserialization the construct the throwable + * as the actual class that was thrown. + * + * @param className Class name of the throwable. + */ + public void setClassName(String className) { + this.className = className; + } + + /** + * Sets the error message of the class of the throwable. This is used during deserialization the construct the + * throwable as the actual class that was thrown. + * + * @param errorMessage Error msg from the exception. + */ + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } +} diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/models/NetworkCallRecord.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/models/NetworkCallRecord.java index e7a080912a2b..790c1f2aef32 100644 --- a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/models/NetworkCallRecord.java +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/models/NetworkCallRecord.java @@ -23,12 +23,15 @@ public class NetworkCallRecord { @JsonProperty("Response") private Map response; + @JsonProperty("Exception") + private NetworkCallError exception; + /** * Gets the HTTP method for with this network call * * @return The HTTP method. */ - public String method() { + public String getMethod() { return method; } @@ -37,7 +40,7 @@ public String method() { * * @param method HTTP method for this network call. */ - public void method(String method) { + public void setMethod(String method) { this.method = method; } @@ -46,7 +49,7 @@ public void method(String method) { * * @return The URL for this network call. */ - public String uri() { + public String getUri() { return uri; } @@ -55,7 +58,7 @@ public String uri() { * * @param uri The URL for this network call. */ - public void uri(String uri) { + public void setUri(String uri) { this.uri = uri; } @@ -64,7 +67,7 @@ public void uri(String uri) { * * @return The HTTP headers for the network call. */ - public Map headers() { + public Map getHeaders() { return headers; } @@ -73,7 +76,7 @@ public Map headers() { * * @param headers The HTTP headers for the network call. */ - public void headers(Map headers) { + public void setHeaders(Map headers) { this.headers = headers; } @@ -83,7 +86,7 @@ public void headers(Map headers) { * * @return Contents of the HTTP response. */ - public Map response() { + public Map getResponse() { return response; } @@ -93,7 +96,25 @@ public Map response() { * * @param response Contents of the HTTP response. */ - public void response(Map response) { + public void setResponse(Map response) { this.response = response; } + + /** + * Gets the throwable thrown during evaluation of the network call. + * + * @return Throwable thrown during the network call. + */ + public NetworkCallError getException() { + return exception; + } + + /** + * Sets the throwable thrown during evaluation of the network call. + * + * @param exception Throwable thrown during the network call. + */ + public void setException(NetworkCallError exception) { + this.exception = exception; + } } diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/policy/RecordNetworkCallPolicy.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/policy/RecordNetworkCallPolicy.java index df9d27cabe25..709329bd6cae 100644 --- a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/policy/RecordNetworkCallPolicy.java +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/policy/RecordNetworkCallPolicy.java @@ -4,34 +4,55 @@ package com.azure.core.test.policy; import com.azure.core.http.HttpHeader; +import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpPipelineCallContext; import com.azure.core.http.HttpPipelineNextPolicy; import com.azure.core.http.HttpResponse; import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.implementation.http.UrlBuilder; +import com.azure.core.test.models.NetworkCallError; import com.azure.core.test.models.NetworkCallRecord; import com.azure.core.test.models.RecordedData; -import io.netty.handler.codec.http.HttpResponseStatus; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import com.azure.core.util.logging.ClientLogger; import reactor.core.Exceptions; import reactor.core.publisher.Mono; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.net.HttpURLConnection; import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.Base64; import java.util.HashMap; import java.util.Map; import java.util.Objects; +import java.util.UUID; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.zip.GZIPInputStream; /** - * HTTP Pipeline policy that keeps track of each HTTP request and response that flows through the pipeline. - * Data is recorded into {@link RecordedData}. + * HTTP Pipeline policy that keeps track of each HTTP request and response that flows through the pipeline. Data is + * recorded into {@link RecordedData}. */ public class RecordNetworkCallPolicy implements HttpPipelinePolicy { private static final int DEFAULT_BUFFER_LENGTH = 1024; - private final Logger logger = LoggerFactory.getLogger(RecordNetworkCallPolicy.class); + private static final String CONTENT_TYPE = "Content-Type"; + private static final String CONTENT_ENCODING = "Content-Encoding"; + private static final String X_MS_CLIENT_REQUEST_ID = "x-ms-client-request-id"; + private static final String X_MS_ENCRYPTION_KEY_SHA256 = "x-ms-encryption-key-sha256"; + private static final String X_MS_VERSION = "x-ms-version"; + private static final String USER_AGENT = "User-Agent"; + private static final String STATUS_CODE = "StatusCode"; + private static final String BODY = "Body"; + private static final String SIG = "sig"; + + private static final Pattern DELEGATIONKEY_KEY_PATTERN = Pattern.compile("(?:)(.*)(?:)"); + private static final Pattern DELEGATIONKEY_CLIENTID_PATTERN = Pattern.compile("(?:)(.*)(?:)"); + private static final Pattern DELEGATIONKEY_TENANTID_PATTERN = Pattern.compile("(?:)(.*)(?:)"); + + private final ClientLogger logger = new ClientLogger(RecordNetworkCallPolicy.class); private final RecordedData recordedData; /** @@ -49,95 +70,150 @@ public Mono process(HttpPipelineCallContext context, HttpPipelineN final NetworkCallRecord networkCallRecord = new NetworkCallRecord(); Map headers = new HashMap<>(); - if (context.httpRequest().headers().value("Content-Type") != null) { - headers.put("Content-Type", context.httpRequest().headers().value("Content-Type")); - } - if (context.httpRequest().headers().value("x-ms-version") != null) { - headers.put("x-ms-version", context.httpRequest().headers().value("x-ms-version")); - } - if (context.httpRequest().headers().value("User-Agent") != null) { - headers.put("User-Agent", context.httpRequest().headers().value("User-Agent")); - } - - networkCallRecord.headers(headers); - networkCallRecord.method(context.httpRequest().httpMethod().toString()); - networkCallRecord.uri(context.httpRequest().url().toString().replaceAll("\\?$", "")); + captureRequestHeaders(context.getHttpRequest().getHeaders(), headers, + X_MS_CLIENT_REQUEST_ID, + CONTENT_TYPE, + X_MS_VERSION, + USER_AGENT); - return next.process().flatMap(httpResponse -> { - final HttpResponse bufferedResponse = httpResponse.buffer(); + networkCallRecord.setHeaders(headers); + networkCallRecord.setMethod(context.getHttpRequest().getHttpMethod().toString()); - return extractResponseData(bufferedResponse).map(responseData -> { - networkCallRecord.response(responseData); - String body = responseData.get("Body"); - - // Remove pre-added header if this is a waiting or redirection - if (body != null && body.contains("InProgress") - || Integer.parseInt(responseData.get("StatusCode")) == HttpResponseStatus.TEMPORARY_REDIRECT.code()) { - if (logger.isInfoEnabled()) { + // Remove sensitive information such as SAS token signatures from the recording. + UrlBuilder urlBuilder = UrlBuilder.parse(context.getHttpRequest().getUrl()); + if (urlBuilder.getQuery().containsKey(SIG)) { + urlBuilder.setQueryParameter(SIG, "REDACTED"); + } + networkCallRecord.setUri(urlBuilder.toString().replaceAll("\\?$", "")); + + return next.process() + .doOnError(throwable -> { + networkCallRecord.setException(new NetworkCallError(throwable)); + recordedData.addNetworkCall(networkCallRecord); + throw logger.logExceptionAsWarning(Exceptions.propagate(throwable)); + }).flatMap(httpResponse -> { + final HttpResponse bufferedResponse = httpResponse.buffer(); + + return extractResponseData(bufferedResponse).map(responseData -> { + networkCallRecord.setResponse(responseData); + String body = responseData.get(BODY); + + // Remove pre-added header if this is a waiting or redirection + if (body != null && body.contains("InProgress") + || Integer.parseInt(responseData.get(STATUS_CODE)) == HttpURLConnection.HTTP_MOVED_TEMP) { logger.info("Waiting for a response or redirection."); + } else { + recordedData.addNetworkCall(networkCallRecord); } - } else { - recordedData.addNetworkCall(networkCallRecord); - } - return bufferedResponse; + return bufferedResponse; + }); }); - }); + } + + private void captureRequestHeaders(HttpHeaders requestHeaders, Map captureHeaders, + String... headerNames) { + for (String headerName : headerNames) { + if (requestHeaders.value(headerName) != null) { + captureHeaders.put(headerName, requestHeaders.value(headerName)); + } + } } private Mono> extractResponseData(final HttpResponse response) { final Map responseData = new HashMap<>(); - responseData.put("StatusCode", Integer.toString(response.statusCode())); + responseData.put(STATUS_CODE, Integer.toString(response.getStatusCode())); boolean addedRetryAfter = false; - for (HttpHeader header : response.headers()) { - String headerValueToStore = header.value(); + for (HttpHeader header : response.getHeaders()) { + String headerValueToStore = header.getValue(); - if (header.name().equalsIgnoreCase("retry-after")) { + if (header.getName().equalsIgnoreCase("retry-after")) { headerValueToStore = "0"; addedRetryAfter = true; + } else if (header.getName().equalsIgnoreCase(X_MS_ENCRYPTION_KEY_SHA256)) { + // The encryption key is sensitive information so capture it with a hidden value. + headerValueToStore = "REDACTED"; } - responseData.put(header.name(), headerValueToStore); + + responseData.put(header.getName(), headerValueToStore); } if (!addedRetryAfter) { responseData.put("retry-after", "0"); } - String contentType = response.headerValue("content-type"); + String contentType = response.getHeaderValue(CONTENT_TYPE); if (contentType == null) { return Mono.just(responseData); - } else if (contentType.contains("json") || response.headerValue("content-encoding") == null) { - return response.bodyAsString().switchIfEmpty(Mono.just("")).map(content -> { - responseData.put("Body", content); + } else if (contentType.equalsIgnoreCase("application/octet-stream")) { + return response.getBodyAsByteArray().switchIfEmpty(Mono.just(new byte[0])).map(bytes -> { + if (bytes.length == 0) { + return responseData; + } + + responseData.put(BODY, Arrays.toString(bytes)); + return responseData; + }); + } else if (contentType.contains("json") || response.getHeaderValue(CONTENT_ENCODING) == null) { + return response.getBodyAsString(StandardCharsets.UTF_8).switchIfEmpty(Mono.just("")).map(content -> { + responseData.put(BODY, redactUserDelegationKey(content)); return responseData; }); } else { - return response.bodyAsByteArray().map(bytes -> { + return response.getBodyAsByteArray().switchIfEmpty(Mono.just(new byte[0])).map(bytes -> { + if (bytes.length == 0) { + return responseData; + } + String content; - try (GZIPInputStream gis = new GZIPInputStream(new ByteArrayInputStream(bytes)); - ByteArrayOutputStream output = new ByteArrayOutputStream()) { - byte[] buffer = new byte[DEFAULT_BUFFER_LENGTH]; - int position = 0; - int bytesRead = gis.read(buffer, position, buffer.length); - - while (bytesRead != -1) { - output.write(buffer, 0, bytesRead); - position += bytesRead; - bytesRead = gis.read(buffer, position, buffer.length); + if ("gzip".equalsIgnoreCase(response.getHeaderValue(CONTENT_ENCODING))) { + try (GZIPInputStream gis = new GZIPInputStream(new ByteArrayInputStream(bytes)); + ByteArrayOutputStream output = new ByteArrayOutputStream()) { + byte[] buffer = new byte[DEFAULT_BUFFER_LENGTH]; + int position = 0; + int bytesRead = gis.read(buffer, position, buffer.length); + + while (bytesRead != -1) { + output.write(buffer, 0, bytesRead); + position += bytesRead; + bytesRead = gis.read(buffer, position, buffer.length); + } + + content = new String(output.toByteArray(), StandardCharsets.UTF_8); + } catch (IOException e) { + throw logger.logExceptionAsWarning(Exceptions.propagate(e)); } - - content = new String(output.toByteArray(), StandardCharsets.UTF_8); - } catch (IOException e) { - throw Exceptions.propagate(e); + } else { + content = new String(bytes, StandardCharsets.UTF_8); } - responseData.remove("content-encoding"); - responseData.put("content-length", Integer.toString(content.length())); + responseData.remove(CONTENT_ENCODING); + responseData.put("Content-Length", Integer.toString(content.length())); - responseData.put("body", content); + responseData.put(BODY, content); return responseData; }); } } + + private String redactUserDelegationKey(String content) { + if (!content.contains("UserDelegationKey")) { + return content; + } + + content = redactionReplacement(content, DELEGATIONKEY_KEY_PATTERN.matcher(content), Base64.getEncoder().encodeToString("REDACTED".getBytes(StandardCharsets.UTF_8))); + content = redactionReplacement(content, DELEGATIONKEY_CLIENTID_PATTERN.matcher(content), UUID.randomUUID().toString()); + content = redactionReplacement(content, DELEGATIONKEY_TENANTID_PATTERN.matcher(content), UUID.randomUUID().toString()); + + return content; + } + + private String redactionReplacement(String content, Matcher matcher, String replacement) { + while (matcher.find()) { + content = content.replace(matcher.group(1), replacement); + } + + return content; + } } diff --git a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/utils/TestResourceNamer.java b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/utils/TestResourceNamer.java index c5b939230f0e..423d3843eb2c 100644 --- a/sdk/core/azure-core-test/src/main/java/com/azure/core/test/utils/TestResourceNamer.java +++ b/sdk/core/azure-core-test/src/main/java/com/azure/core/test/utils/TestResourceNamer.java @@ -6,6 +6,8 @@ import com.azure.core.test.TestMode; import com.azure.core.test.models.RecordedData; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; import java.util.Objects; /** @@ -64,4 +66,19 @@ public String randomUuid() { return uuid; } } + + /** + * Gets an OffsetDateTime of UTC now. + * + * @return OffsetDateTime of UTC now. + */ + public OffsetDateTime now() { + if (testMode == TestMode.PLAYBACK) { + return OffsetDateTime.parse(recordedData.removeVariable()); + } else { + OffsetDateTime now = OffsetDateTime.now(ZoneOffset.UTC); + recordedData.addVariable(now.toString()); + return now; + } + } } diff --git a/sdk/core/azure-core/README.md b/sdk/core/azure-core/README.md index 1cb9a0ffe9c6..677e58a6c630 100644 --- a/sdk/core/azure-core/README.md +++ b/sdk/core/azure-core/README.md @@ -2,7 +2,7 @@ [![Build Documentation](https://img.shields.io/badge/documentation-published-blue.svg)](https://azure.github.io/azure-sdk-for-java/track2reports/index.html) -Azure Core provides shared primitives, abstractions, and helpers for modern Java Azure SDK client libraries. These libraries follow the [Azure SDK Design Guidelines for JavaT](https://azuresdkspecs.z5.web.core.windows.net/JavaSpec.html) and can be easily identified by package names starting with `com.azure` and module names starting with `azure-`, e.g. `com.azure.storage.blobs` would be found within the `/sdk/storage/azure-storage-blob` directory. A more complete list of client libraries using Azure Core can be found [here](https://github.com/Azure/azure-sdk-for-java). +Azure Core provides shared primitives, abstractions, and helpers for modern Java Azure SDK client libraries. These libraries follow the [Azure SDK Design Guidelines for Java](https://azuresdkspecs.z5.web.core.windows.net/JavaSpec.html) and can be easily identified by package names starting with `com.azure` and module names starting with `azure-`, e.g. `com.azure.storage.blobs` would be found within the `/sdk/storage/azure-storage-blob` directory. A more complete list of client libraries using Azure Core can be found [here](https://github.com/Azure/azure-sdk-for-java). Azure Core allows client libraries to expose common functionality in a consistent fashion, so that once you learn how to use these APIs in one client library, you will know how to use them in other client libraries. @@ -75,3 +75,5 @@ If you would like to become an active contributor to this project please follow 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/core/azure-core/README.png) diff --git a/sdk/core/azure-core/pom.xml b/sdk/core/azure-core/pom.xml index 445d02a09685..d7283d125a1e 100644 --- a/sdk/core/azure-core/pom.xml +++ b/sdk/core/azure-core/pom.xml @@ -7,14 +7,14 @@ com.azure azure-client-sdk-parent - 1.3.0 + 1.4.0 ../../../pom.client.xml com.azure azure-core jar - 1.0.0-preview.4 + 1.0.0-preview.5 Microsoft Azure Java Core Library This package contains core types for Azure Java clients. @@ -44,6 +44,7 @@ UTF-8 + com.azure.core @@ -54,22 +55,6 @@ - - io.netty - netty-handler - - - io.netty - netty-handler-proxy - - - io.netty - netty-buffer - - - io.netty - netty-codec-http - com.fasterxml.jackson.datatype jackson-datatype-jsr310 @@ -94,8 +79,9 @@ - io.projectreactor.netty - reactor-netty + io.projectreactor + reactor-core + 3.2.10.RELEASE io.projectreactor @@ -162,6 +148,20 @@ test + + + + maven-jar-plugin + + + test-jar + test-compile + + test-jar + + + + diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/AzureEnvironment.java b/sdk/core/azure-core/src/main/java/com/azure/core/AzureEnvironment.java index bf75906c56c4..c95c82ab5491 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/AzureEnvironment.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/AzureEnvironment.java @@ -67,7 +67,8 @@ public AzureEnvironment(Map endpoints) { put("activeDirectoryGraphApiVersion", "2013-04-05"); put("storageEndpointSuffix", ".core.chinacloudapi.cn"); put("keyVaultDnsSuffix", ".vault.azure.cn"); - // TODO: add dns suffixes for the china cloud for datalake store and datalake analytics once they are defined. + // TODO: add dns suffixes for the china cloud for datalake store and datalake analytics once they are + // defined. put("azureDataLakeStoreFileSystemEndpointSuffix", "N/A"); put("azureDataLakeAnalyticsCatalogAndJobEndpointSuffix", "N/A"); put("azureLogAnalyticsResourceId", "N/A"); @@ -93,7 +94,8 @@ public AzureEnvironment(Map endpoints) { put("activeDirectoryGraphApiVersion", "2013-04-05"); put("storageEndpointSuffix", ".core.usgovcloudapi.net"); put("keyVaultDnsSuffix", ".vault.usgovcloudapi.net"); - // TODO: add dns suffixes for the US government for datalake store and datalake analytics once they are defined. + // TODO: add dns suffixes for the US government for datalake store and datalake analytics once they are + // defined. put("azureDataLakeStoreFileSystemEndpointSuffix", "N/A"); put("azureDataLakeAnalyticsCatalogAndJobEndpointSuffix", "N/A"); put("azureLogAnalyticsResourceId", "https://api.loganalytics.us/"); @@ -119,7 +121,8 @@ public AzureEnvironment(Map endpoints) { put("activeDirectoryGraphApiVersion", "2013-04-05"); put("storageEndpointSuffix", ".core.cloudapi.de"); put("keyVaultDnsSuffix", ".vault.microsoftazure.de"); - // TODO: add dns suffixes for the germany cloud for datalake store and datalake analytics once they are defined. + // TODO: add dns suffixes for the germany cloud for datalake store and datalake analytics once they are + // defined. put("azureDataLakeStoreFileSystemEndpointSuffix", "N/A"); put("azureDataLakeAnalyticsCatalogAndJobEndpointSuffix", "N/A"); put("azureLogAnalyticsResourceId", "N/A"); @@ -144,126 +147,126 @@ public static AzureEnvironment[] knownEnvironments() { /** * @return the management portal URL. */ - public String portal() { + public String getPortal() { return endpoints.get("portalUrl"); } /** * @return the publish settings file URL. */ - public String publishingProfile() { + public String getPublishingProfile() { return endpoints.get("publishingProfileUrl"); } /** * @return the management service endpoint. */ - public String managementEndpoint() { + public String getManagementEndpoint() { return endpoints.get("managementEndpointUrl"); } /** * @return the resource management endpoint. */ - public String resourceManagerEndpoint() { + public String getResourceManagerEndpoint() { return endpoints.get("resourceManagerEndpointUrl"); } /** * @return the sql server management endpoint for mobile commands. */ - public String sqlManagementEndpoint() { + public String getSqlManagementEndpoint() { return endpoints.get("sqlManagementEndpointUrl"); } /** * @return the dns suffix for sql servers. */ - public String sqlServerHostnameSuffix() { + public String getSqlServerHostnameSuffix() { return endpoints.get("sqlServerHostnameSuffix"); } /** * @return the Active Directory login endpoint. */ - public String activeDirectoryEndpoint() { + public String getActiveDirectoryEndpoint() { return endpoints.get("activeDirectoryEndpointUrl").replaceAll("/$", "") + "/"; } /** * @return The resource ID to obtain AD tokens for. */ - public String activeDirectoryResourceId() { + public String getActiveDirectoryResourceId() { return endpoints.get("activeDirectoryResourceId"); } /** * @return the template gallery endpoint. */ - public String galleryEndpoint() { + public String getGalleryEndpoint() { return endpoints.get("galleryEndpointUrl"); } /** * @return the Active Directory resource ID. */ - public String graphEndpoint() { + public String getGraphEndpoint() { return endpoints.get("activeDirectoryGraphResourceId"); } /** * @return the Data Lake resource ID. */ - public String dataLakeEndpointResourceId() { + public String getDataLakeEndpointResourceId() { return endpoints.get("dataLakeEndpointResourceId"); } /** * @return the Active Directory api version. */ - public String activeDirectoryGraphApiVersion() { + public String getActiveDirectoryGraphApiVersion() { return endpoints.get("activeDirectoryGraphApiVersion"); } /** * @return the endpoint suffix for storage accounts. */ - public String storageEndpointSuffix() { + public String getStorageEndpointSuffix() { return endpoints.get("storageEndpointSuffix"); } /** * @return the keyvault service dns suffix. */ - public String keyVaultDnsSuffix() { + public String getKeyVaultDnsSuffix() { return endpoints.get("keyVaultDnsSuffix"); } /** * @return the data lake store filesystem service dns suffix. */ - public String azureDataLakeStoreFileSystemEndpointSuffix() { + public String getAzureDataLakeStoreFileSystemEndpointSuffix() { return endpoints.get("azureDataLakeStoreFileSystemEndpointSuffix"); } /** * @return the data lake analytics job and catalog service dns suffix. */ - public String azureDataLakeAnalyticsCatalogAndJobEndpointSuffix() { + public String getAzureDataLakeAnalyticsCatalogAndJobEndpointSuffix() { return endpoints.get("azureDataLakeAnalyticsCatalogAndJobEndpointSuffix"); } /** * @return the log analytics endpoint. */ - public String logAnalyticsEndpoint() { + public String getLogAnalyticsEndpoint() { return endpoints.get("azureLogAnalyticsResourceId"); } /** * @return the log analytics endpoint. */ - public String applicationInsightsEndpoint() { + public String getApplicationInsightsEndpoint() { return endpoints.get("azureApplicationInsightsResourceId"); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/credentials/AccessToken.java b/sdk/core/azure-core/src/main/java/com/azure/core/credentials/AccessToken.java index 711bd4ba3118..7ba833c650e4 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/credentials/AccessToken.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/credentials/AccessToken.java @@ -9,8 +9,8 @@ * Represents an immutable access token with a token string and an expiration time. */ public class AccessToken { - private String token; - private OffsetDateTime expiresOn; + private final String token; + private final OffsetDateTime expiresOn; /** * Creates an access token instance. @@ -25,14 +25,14 @@ public AccessToken(String token, OffsetDateTime expiresOn) { /** * @return the token string. */ - public String token() { + public String getToken() { return token; } /** * @return the time when the token expires, in UTC. */ - public OffsetDateTime expiresOn() { + public OffsetDateTime getExpiresOn() { return expiresOn; } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/credentials/BasicAuthenticationCredential.java b/sdk/core/azure-core/src/main/java/com/azure/core/credentials/BasicAuthenticationCredential.java index a86eeeb09a20..6a1426039eee 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/credentials/BasicAuthenticationCredential.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/credentials/BasicAuthenticationCredential.java @@ -4,6 +4,7 @@ package com.azure.core.credentials; import com.azure.core.implementation.util.Base64Util; +import com.azure.core.util.logging.ClientLogger; import reactor.core.publisher.Mono; import java.io.UnsupportedEncodingException; @@ -13,15 +14,16 @@ * Basic Auth credentials for use with a REST Service Client. */ public class BasicAuthenticationCredential implements TokenCredential { + private final ClientLogger logger = new ClientLogger(BasicAuthenticationCredential.class); /** * Basic auth user name. */ - private String userName; + private final String userName; /** * Basic auth password. */ - private String password; + private final String password; /** * Creates a basic authentication credential. @@ -45,7 +47,7 @@ public Mono getToken(String... scopes) { encodedCredential = Base64Util.encodeToString(credential.getBytes("UTF8")); } catch (UnsupportedEncodingException e) { // The encoding is hard-coded, so if it's unsupported, it needs to be fixed right here. - throw new RuntimeException(e); + throw logger.logExceptionAsError(new RuntimeException(e)); } return Mono.just(new AccessToken(encodedCredential, OffsetDateTime.MAX)); diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/exception/ClientAuthenticationException.java b/sdk/core/azure-core/src/main/java/com/azure/core/exception/ClientAuthenticationException.java index dbe1e0837428..cc61e03030cf 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/exception/ClientAuthenticationException.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/exception/ClientAuthenticationException.java @@ -6,11 +6,14 @@ import com.azure.core.http.HttpResponse; /** - * The exception thrown when failed to authenticate the client request with status code of 4XX, typically 401 unauthorized. + * The exception thrown when failed to authenticate the client request with status code of 4XX, typically 401 + * unauthorized. * * A runtime exception indicating request authorization failure caused by one of the following scenarios: - * A client did not send the required authorization credentials to access the requested resource, i.e. Authorization HTTP header is missing in the request, - * OR - In case the request already contains the HTTP Authorization header - then the exception indicates that authorization has been refused for the credentials contained in the request header. + * A client did not send the required authorization credentials to access the requested resource, i.e. Authorization + * HTTP header is missing in the request, + * OR - In case the request already contains the HTTP Authorization header - then the exception indicates that + * authorization has been refused for the credentials contained in the request header. */ public class ClientAuthenticationException extends HttpResponseException { diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/exception/HttpRequestException.java b/sdk/core/azure-core/src/main/java/com/azure/core/exception/HttpRequestException.java index ec74a2c2f5a0..a0fa25dd68aa 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/exception/HttpRequestException.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/exception/HttpRequestException.java @@ -44,7 +44,7 @@ public HttpRequestException(final String message, final HttpRequest request, fin /** * @return information about the associated HTTP response */ - public HttpRequest request() { + public HttpRequest getRequest() { return request; } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/exception/HttpResponseException.java b/sdk/core/azure-core/src/main/java/com/azure/core/exception/HttpResponseException.java index 559b0e5934fc..3689c873c156 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/exception/HttpResponseException.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/exception/HttpResponseException.java @@ -14,7 +14,7 @@ public class HttpResponseException extends AzureException { /** * The HTTP response value. */ - private Object value; + private final Object value; /** * Information about the associated HTTP response. @@ -29,6 +29,7 @@ public class HttpResponseException extends AzureException { */ public HttpResponseException(final String message, final HttpResponse response) { super(message); + this.value = null; this.response = response; } @@ -54,6 +55,7 @@ public HttpResponseException(final String message, final HttpResponse response, */ public HttpResponseException(final String message, final HttpResponse response, final Throwable cause) { super(message, cause); + this.value = null; this.response = response; } @@ -61,14 +63,14 @@ public HttpResponseException(final String message, final HttpResponse response, /** * @return information about the associated HTTP response */ - public HttpResponse response() { + public HttpResponse getResponse() { return response; } /** * @return the HTTP response value */ - public Object value() { + public Object getValue() { return value; } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/exception/ResourceExistsException.java b/sdk/core/azure-core/src/main/java/com/azure/core/exception/ResourceExistsException.java index b6bc3bd9aa6e..34451575010e 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/exception/ResourceExistsException.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/exception/ResourceExistsException.java @@ -6,7 +6,8 @@ import com.azure.core.http.HttpResponse; /** - * The exception thrown when HTTP request tried to create an already existing resource with status code of 4XX, typically 412 conflict. + * The exception thrown when HTTP request tried to create an already existing resource with status code of 4XX, + * typically 412 conflict. */ public class ResourceExistsException extends HttpResponseException { diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/exception/ServiceResponseException.java b/sdk/core/azure-core/src/main/java/com/azure/core/exception/ServiceResponseException.java index 06c0e653621c..51a60c862200 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/exception/ServiceResponseException.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/exception/ServiceResponseException.java @@ -5,7 +5,8 @@ /** * A runtime exception indicating service response failure caused by one of the following scenarios: - * 1. The request was sent, but the client failed to understand the response. (Not in the right format, partial response etc.) + * 1. The request was sent, but the client failed to understand the response. (Not in the right format, partial response + * etc.) * 2. The connection may have timed out. These errors can be retried for idempotent or * safe operations. */ diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/exception/UnexpectedLengthException.java b/sdk/core/azure-core/src/main/java/com/azure/core/exception/UnexpectedLengthException.java new file mode 100644 index 000000000000..63414b265684 --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/exception/UnexpectedLengthException.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.exception; + +/** + * This exception class represents an error when the specified input length doesn't match the data length. + */ +public final class UnexpectedLengthException extends IllegalStateException { + private final long bytesRead; + private final long bytesExpected; + + /** + * Constructor of the UnexpectedLengthException. + * @param message The message for the exception. + * @param bytesRead The number of bytes read from resource. + * @param bytesExpected The number of bytes expected from the receiver. + */ + public UnexpectedLengthException(String message, long bytesRead, long bytesExpected) { + super(message); + this.bytesRead = bytesRead; + this.bytesExpected = bytesExpected; + } + + /** + * @return the number of bytes read from the input + */ + public long getBytesRead() { + return this.bytesRead; + } + + /** + * @return the number of bytes that were expected to be read from the input + */ + public long getBytesExpected() { + return this.bytesExpected; + } +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpClient.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpClient.java index de3f86fc5994..941b6af49e16 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpClient.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpClient.java @@ -3,10 +3,9 @@ package com.azure.core.http; +import com.azure.core.implementation.http.spi.HttpClientProviders; import reactor.core.publisher.Mono; -import java.util.function.Supplier; - /** * A generic interface for sending HTTP requests and getting responses. */ @@ -25,30 +24,6 @@ public interface HttpClient { * @return the HttpClient */ static HttpClient createDefault() { - return new ReactorNettyClient(); + return HttpClientProviders.createInstance(); } - - /** - * Apply the provided proxy configuration to the HttpClient. - * - * @param proxyOptions the proxy configuration supplier - * @return a HttpClient with proxy applied - */ - HttpClient proxy(Supplier proxyOptions); - - /** - * Apply or remove a wire logger configuration. - * - * @param enableWiretap wiretap config - * @return a HttpClient with wire logging enabled or disabled - */ - HttpClient wiretap(boolean enableWiretap); - - /** - * Set the port that client should connect to. - * - * @param port the port - * @return a HttpClient with port applied - */ - HttpClient port(int port); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpHeader.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpHeader.java index 65c9d774dd5f..d34bd084a901 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpHeader.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpHeader.java @@ -30,7 +30,7 @@ public HttpHeader(String name, String value) { * * @return the name of this Header */ - public String name() { + public String getName() { return name; } @@ -39,7 +39,7 @@ public String name() { * * @return the value of this Header */ - public String value() { + public String getValue() { return value; } @@ -48,7 +48,7 @@ public String value() { * * @return the values of this Header that are separated by a comma */ - public String[] values() { + public String[] getValues() { return value == null ? null : value.split(","); } 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 ee0ad8cfdb57..54f8f2664d6a 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 @@ -40,7 +40,7 @@ public HttpHeaders(Iterable headers) { this(); for (final HttpHeader header : headers) { - this.put(header.name(), header.value()); + this.put(header.getName(), header.getValue()); } } @@ -49,7 +49,7 @@ public HttpHeaders(Iterable headers) { * * @return the number of headers in this collection. */ - public int size() { + public int getSize() { return headers.size(); } @@ -86,7 +86,7 @@ public HttpHeader get(String name) { */ public String value(String name) { final HttpHeader header = get(name); - return header == null ? null : header.value(); + return header == null ? null : header.getValue(); } /** @@ -98,7 +98,7 @@ public String value(String name) { */ public String[] values(String name) { final HttpHeader header = get(name); - return header == null ? null : header.values(); + return header == null ? null : header.getValues(); } private String formatKey(final String key) { @@ -113,7 +113,7 @@ private String formatKey(final String key) { public Map toMap() { final Map result = new HashMap<>(); for (final HttpHeader header : headers.values()) { - result.put(header.name(), header.value()); + result.put(header.getName(), header.getValue()); } return result; } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpPipeline.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpPipeline.java index c0ae2db65d2e..7c33b97b2922 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpPipeline.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpPipeline.java @@ -24,8 +24,8 @@ public final class HttpPipeline { * * @param httpClient the http client to write request to wire and receive response from wire. * @param pipelinePolicies pipeline policies in the order they need to applied, a copy of this array will - * be made hence changing the original array after the creation of pipeline - * will not mutate the pipeline + * be made hence changing the original array after the creation of pipeline + * will not mutate the pipeline */ HttpPipeline(HttpClient httpClient, List pipelinePolicies) { Objects.requireNonNull(httpClient); @@ -64,7 +64,8 @@ public HttpClient httpClient() { * Wraps the request in a context and send it through pipeline. * * @param request the request - * @return a publisher upon subscription flows the context through policies, sends the request and emits response upon completion + * @return a publisher upon subscription flows the context through policies, sends the request and emits response + * upon completion */ public Mono send(HttpRequest request) { return this.send(new HttpPipelineCallContext(request)); @@ -74,7 +75,8 @@ public Mono send(HttpRequest request) { * Wraps the request in a context with additional metadata and sends it through the pipeline. * @param request the request * @param data additional metadata to pass along in the request - * @return a publisher upon subscription flows the context through policies, sends the request and emits response upon completion + * @return a publisher upon subscription flows the context through policies, sends the request and emits response + * upon completion */ public Mono send(HttpRequest request, Context data) { return this.send(new HttpPipelineCallContext(request, data)); @@ -84,7 +86,8 @@ public Mono send(HttpRequest request, Context data) { * Sends the context (containing request) through pipeline. * * @param context the request context - * @return a publisher upon subscription flows the context through policies, sends the request and emits response upon completion + * @return a publisher upon subscription flows the context through policies, sends the request and emits response + * upon completion */ public Mono send(HttpPipelineCallContext context) { // Return deferred to mono for complete lazy behaviour. diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpPipelineCallContext.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpPipelineCallContext.java index 6e9e5438d9c2..2a3f2aa45242 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpPipelineCallContext.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpPipelineCallContext.java @@ -75,7 +75,7 @@ public Optional getData(String key) { * * @return the request. */ - public HttpRequest httpRequest() { + public HttpRequest getHttpRequest() { return this.httpRequest; } @@ -85,7 +85,7 @@ public HttpRequest httpRequest() { * @param request request object * @return HttpPipelineCallContext */ - public HttpPipelineCallContext httpRequest(HttpRequest request) { + public HttpPipelineCallContext setHttpRequest(HttpRequest request) { this.httpRequest = request; return this; } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpPipelineNextPolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpPipelineNextPolicy.java index 9d7a54e1792d..efbaddf1ce37 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpPipelineNextPolicy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpPipelineNextPolicy.java @@ -41,7 +41,7 @@ public Mono process() { this.currentPolicyIndex++; if (this.currentPolicyIndex == size) { - return this.pipeline.httpClient().send(this.context.httpRequest()); + return this.pipeline.httpClient().send(this.context.getHttpRequest()); } else { return this.pipeline.getPolicy(this.currentPolicyIndex).process(this.context, this); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpRequest.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpRequest.java index 930153ab1459..2314e38502d3 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpRequest.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpRequest.java @@ -3,12 +3,11 @@ package com.azure.core.http; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import reactor.core.publisher.Flux; import java.io.Serializable; import java.net.URL; +import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; /** @@ -20,7 +19,7 @@ public class HttpRequest implements Serializable { private HttpMethod httpMethod; private URL url; private HttpHeaders headers; - private Flux body; + private Flux body; /** * Create a new HttpRequest instance. @@ -42,7 +41,7 @@ public HttpRequest(HttpMethod httpMethod, URL url) { * @param headers the HTTP headers to use with this request * @param body the request content */ - public HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers, Flux body) { + public HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers, Flux body) { this.httpMethod = httpMethod; this.url = url; this.headers = headers; @@ -54,7 +53,7 @@ public HttpRequest(HttpMethod httpMethod, URL url, HttpHeaders headers, Flux body() { + public Flux getBody() { return body; } @@ -137,9 +136,9 @@ public Flux body() { * @param content the request content * @return this HttpRequest */ - public HttpRequest body(String content) { + public HttpRequest setBody(String content) { final byte[] bodyBytes = content.getBytes(StandardCharsets.UTF_8); - return body(bodyBytes); + return setBody(bodyBytes); } /** @@ -149,10 +148,9 @@ public HttpRequest body(String content) { * @param content the request content * @return this HttpRequest */ - public HttpRequest body(byte[] content) { + public HttpRequest setBody(byte[] content) { headers.put("Content-Length", String.valueOf(content.length)); - // Unpooled.wrappedBuffer(body) allocates ByteBuf from unpooled heap - return body(Flux.defer(() -> Flux.just(Unpooled.wrappedBuffer(content)))); + return setBody(Flux.defer(() -> Flux.just(ByteBuffer.wrap(content)))); } /** @@ -164,7 +162,7 @@ public HttpRequest body(byte[] content) { * @param content the request content * @return this HttpRequest */ - public HttpRequest body(Flux content) { + public HttpRequest setBody(Flux content) { this.body = content; return this; } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpResponse.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpResponse.java index 1761b6bbbc0d..beb9efe5f945 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpResponse.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpResponse.java @@ -4,12 +4,11 @@ package com.azure.core.http; import com.azure.core.implementation.http.BufferedHttpResponse; -import io.netty.buffer.ByteBuf; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import reactor.netty.Connection; import java.io.Closeable; +import java.nio.ByteBuffer; import java.nio.charset.Charset; /** @@ -23,7 +22,7 @@ public abstract class HttpResponse implements Closeable { * * @return the response status code */ - public abstract int statusCode(); + public abstract int getStatusCode(); /** * Lookup a response header with the provided name. @@ -31,14 +30,14 @@ public abstract class HttpResponse implements Closeable { * @param name the name of the header to lookup. * @return the value of the header, or null if the header doesn't exist in the response. */ - public abstract String headerValue(String name); + public abstract String getHeaderValue(String name); /** * Get all response headers. * * @return the response headers */ - public abstract HttpHeaders headers(); + public abstract HttpHeaders getHeaders(); /** * Get the publisher emitting response content chunks. @@ -66,23 +65,23 @@ public abstract class HttpResponse implements Closeable { * the `subscribeOn` and `observeOn` but should be considered a template for * more complex situations. * - * @return The response's content as a stream of {@link ByteBuf}. + * @return The response's content as a stream of {@link ByteBuffer}. */ - public abstract Flux body(); + public abstract Flux getBody(); /** * Get the response content as a byte[]. * * @return this response content as a byte[] */ - public abstract Mono bodyAsByteArray(); + public abstract Mono getBodyAsByteArray(); /** * Get the response content as a string. * * @return This response content as a string */ - public abstract Mono bodyAsString(); + public abstract Mono getBodyAsString(); /** * Get the response content as a string. @@ -90,14 +89,14 @@ public abstract class HttpResponse implements Closeable { * @param charset the charset to use as encoding * @return This response content as a string */ - public abstract Mono bodyAsString(Charset charset); + public abstract Mono getBodyAsString(Charset charset); /** * Get the request which resulted in this response. * * @return the request which resulted in this response. */ - public final HttpRequest request() { + public final HttpRequest getRequest() { return request; } @@ -107,7 +106,7 @@ public final HttpRequest request() { * @param request the request * @return this HTTP response */ - public final HttpResponse request(HttpRequest request) { + public final HttpResponse setRequest(HttpRequest request) { this.request = request; return this; } @@ -128,9 +127,4 @@ public HttpResponse buffer() { @Override public void close() { } - - // package private for test purpose - Connection internConnection() { - return null; - } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/ProxyOptions.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/ProxyOptions.java index f8d4aecb3c94..1093ef5e3e85 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/ProxyOptions.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/ProxyOptions.java @@ -3,8 +3,6 @@ package com.azure.core.http; -import reactor.netty.tcp.ProxyProvider.Proxy; - import java.net.InetSocketAddress; /** @@ -28,14 +26,14 @@ public ProxyOptions(Type type, InetSocketAddress address) { /** * @return the address of the proxy. */ - public InetSocketAddress address() { + public InetSocketAddress getAddress() { return address; } /** * @return the type of the proxy. */ - public Type type() { + public Type getType() { return type; } @@ -46,24 +44,14 @@ public enum Type { /** * HTTP proxy type. */ - HTTP(Proxy.HTTP), + HTTP(), /** * SOCKS4 proxy type. */ - SOCKS4(Proxy.SOCKS4), + SOCKS4(), /** * SOCKS5 proxy type. */ - SOCKS5(Proxy.SOCKS5); - - private final Proxy value; - - Type(Proxy reactorProxyType) { - this.value = reactorProxyType; - } - - Proxy value() { - return value; - } + SOCKS5() } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/ReactorNettyClient.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/ReactorNettyClient.java deleted file mode 100644 index 0b17d052e1be..000000000000 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/ReactorNettyClient.java +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.http; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.handler.codec.http.HttpMethod; -import org.reactivestreams.Publisher; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import reactor.netty.ByteBufFlux; -import reactor.netty.Connection; -import reactor.netty.NettyOutbound; -import reactor.netty.http.client.HttpClientRequest; -import reactor.netty.http.client.HttpClientResponse; - -import java.nio.charset.Charset; -import java.util.Objects; -import java.util.function.BiFunction; -import java.util.function.Function; -import java.util.function.Supplier; - -/** - * HttpClient that is implemented using reactor-netty. - */ -class ReactorNettyClient implements HttpClient { - private reactor.netty.http.client.HttpClient httpClient; - - /** - * Creates default ReactorNettyClient. - */ - ReactorNettyClient() { - this(reactor.netty.http.client.HttpClient.create()); - } - - /** - * Creates ReactorNettyClient with provided http client. - * - * @param httpClient the reactor http client - */ - private ReactorNettyClient(reactor.netty.http.client.HttpClient httpClient) { - this.httpClient = httpClient; - } - - /** - * Creates ReactorNettyClient with provided http client with configuration applied. - * - * @param httpClient the reactor http client - * @param config the configuration to apply on the http client - */ - private ReactorNettyClient(reactor.netty.http.client.HttpClient httpClient, Function config) { - this.httpClient = config.apply(httpClient); - } - - @Override - public Mono send(final HttpRequest request) { - Objects.requireNonNull(request.httpMethod()); - Objects.requireNonNull(request.url()); - Objects.requireNonNull(request.url().getProtocol()); - // - return httpClient - .request(HttpMethod.valueOf(request.httpMethod().toString())) - .uri(request.url().toString()) - .send(bodySendDelegate(request)) - .responseConnection(responseDelegate(request)) - .single(); - } - - /** - * Delegate to send the request content. - * - * @param restRequest the Rest request contains the body to be sent - * @return a delegate upon invocation sets the request body in reactor-netty outbound object - */ - private static BiFunction> bodySendDelegate(final HttpRequest restRequest) { - return (reactorNettyRequest, reactorNettyOutbound) -> { - for (HttpHeader header : restRequest.headers()) { - if (header.value() != null) { - reactorNettyRequest.header(header.name(), header.value()); - } - } - if (restRequest.body() != null) { - Flux nettyByteBufFlux = restRequest.body().map(Unpooled::wrappedBuffer); - return reactorNettyOutbound.send(nettyByteBufFlux); - } else { - return reactorNettyOutbound; - } - }; - } - - /** - * Delegate to receive response. - * - * @param restRequest the Rest request whose response this delegate handles - * @return a delegate upon invocation setup Rest response object - */ - private static BiFunction> responseDelegate(final HttpRequest restRequest) { - return (reactorNettyResponse, reactorNettyConnection) -> - Mono.just(new ReactorNettyHttpResponse(reactorNettyResponse, reactorNettyConnection).request(restRequest)); - } - - @Override - public final HttpClient proxy(Supplier proxyOptionsSupplier) { - return new ReactorNettyClient(this.httpClient, client -> client.tcpConfiguration(c -> { - ProxyOptions options = proxyOptionsSupplier.get(); - return c.proxy(ts -> ts.type(options.type().value()).address(options.address())); - })); - } - - @Override - public final HttpClient wiretap(boolean enableWiretap) { - return new ReactorNettyClient(this.httpClient, client -> client.wiretap(enableWiretap)); - } - - @Override - public final HttpClient port(int port) { - return new ReactorNettyClient(this.httpClient, client -> client.port(port)); - } - - private static class ReactorNettyHttpResponse extends HttpResponse { - private final HttpClientResponse reactorNettyResponse; - private final Connection reactorNettyConnection; - - ReactorNettyHttpResponse(HttpClientResponse reactorNettyResponse, Connection reactorNettyConnection) { - this.reactorNettyResponse = reactorNettyResponse; - this.reactorNettyConnection = reactorNettyConnection; - } - - @Override - public int statusCode() { - return reactorNettyResponse.status().code(); - } - - @Override - public String headerValue(String name) { - return reactorNettyResponse.responseHeaders().get(name); - } - - @Override - public HttpHeaders headers() { - HttpHeaders headers = new HttpHeaders(); - reactorNettyResponse.responseHeaders().forEach(e -> headers.put(e.getKey(), e.getValue())); - return headers; - } - - @Override - public Flux body() { - return bodyIntern().doFinally(s -> { - if (!reactorNettyConnection.isDisposed()) { - reactorNettyConnection.channel().eventLoop().execute(reactorNettyConnection::dispose); - } - }); - } - - @Override - public Mono bodyAsByteArray() { - return bodyIntern().aggregate().asByteArray().doFinally(s -> { - if (!reactorNettyConnection.isDisposed()) { - reactorNettyConnection.channel().eventLoop().execute(reactorNettyConnection::dispose); - } - }); - } - - @Override - public Mono bodyAsString() { - return bodyIntern().aggregate().asString().doFinally(s -> { - if (!reactorNettyConnection.isDisposed()) { - reactorNettyConnection.channel().eventLoop().execute(reactorNettyConnection::dispose); - } - }); - } - - @Override - public Mono bodyAsString(Charset charset) { - return bodyIntern().aggregate().asString(charset).doFinally(s -> { - if (!reactorNettyConnection.isDisposed()) { - reactorNettyConnection.channel().eventLoop().execute(reactorNettyConnection::dispose); - } - }); - } - - @Override - public void close() { - if (!reactorNettyConnection.isDisposed()) { - reactorNettyConnection.channel().eventLoop().execute(reactorNettyConnection::dispose); - } - } - - private ByteBufFlux bodyIntern() { - return reactorNettyConnection.inbound().receive(); - } - - @Override - Connection internConnection() { - return reactorNettyConnection; - } - } -} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/AddDatePolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/AddDatePolicy.java index b3344c8a7f8e..75d3cc4b40bb 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/AddDatePolicy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/AddDatePolicy.java @@ -25,7 +25,7 @@ public class AddDatePolicy implements HttpPipelinePolicy { @Override public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { return Mono.defer(() -> { - context.httpRequest().headers().put("Date", format.format(OffsetDateTime.now())); + context.getHttpRequest().getHeaders().put("Date", format.format(OffsetDateTime.now())); return next.process(); }); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/AddHeadersPolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/AddHeadersPolicy.java index a452eec26e76..347f9c05365c 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/AddHeadersPolicy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/AddHeadersPolicy.java @@ -28,7 +28,7 @@ public AddHeadersPolicy(HttpHeaders headers) { @Override public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { for (HttpHeader header : headers) { - context.httpRequest().header(header.name(), header.value()); + context.getHttpRequest().setHeader(header.getName(), header.getValue()); } return next.process(); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/BearerTokenAuthenticationPolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/BearerTokenAuthenticationPolicy.java index 4c8e37bc9a7c..3333216237ba 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/BearerTokenAuthenticationPolicy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/BearerTokenAuthenticationPolicy.java @@ -53,7 +53,7 @@ public BearerTokenAuthenticationPolicy(TokenCredential credential, String... sco public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { return cache.getToken() .flatMap(token -> { - context.httpRequest().headers().put(AUTHORIZATION_HEADER, BEARER + " " + token.token()); + context.getHttpRequest().getHeaders().put(AUTHORIZATION_HEADER, BEARER + " " + token.getToken()); return next.process(); }); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/CookiePolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/CookiePolicy.java index a9e84bb6ad44..1157deb2d284 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/CookiePolicy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/CookiePolicy.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpPipelineCallContext; import com.azure.core.http.HttpPipelineNextPolicy; import com.azure.core.http.HttpResponse; +import com.azure.core.util.logging.ClientLogger; import reactor.core.Exceptions; import reactor.core.publisher.Mono; @@ -25,33 +26,35 @@ * The Pipeline policy that which stores cookies based on the response Set-Cookie header and adds cookies to requests. */ public class CookiePolicy implements HttpPipelinePolicy { + private final ClientLogger logger = new ClientLogger(CookiePolicy.class); private final CookieHandler cookies = new CookieManager(); @Override public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { try { - final URI uri = context.httpRequest().url().toURI(); + final URI uri = context.getHttpRequest().getUrl().toURI(); Map> cookieHeaders = new HashMap<>(); - for (HttpHeader header : context.httpRequest().headers()) { - cookieHeaders.put(header.name(), Arrays.asList(context.httpRequest().headers().values(header.name()))); + for (HttpHeader header : context.getHttpRequest().getHeaders()) { + cookieHeaders.put(header.getName(), Arrays.asList(context.getHttpRequest().getHeaders() + .values(header.getName()))); } Map> requestCookies = cookies.get(uri, cookieHeaders); for (Map.Entry> entry : requestCookies.entrySet()) { - context.httpRequest().headers().put(entry.getKey(), String.join(",", entry.getValue())); + context.getHttpRequest().getHeaders().put(entry.getKey(), String.join(",", entry.getValue())); } return next.process().map(httpResponse -> { Map> responseHeaders = new HashMap<>(); - for (HttpHeader header : httpResponse.headers()) { - responseHeaders.put(header.name(), Collections.singletonList(header.value())); + for (HttpHeader header : httpResponse.getHeaders()) { + responseHeaders.put(header.getName(), Collections.singletonList(header.getValue())); } try { cookies.put(uri, responseHeaders); } catch (IOException e) { - throw Exceptions.propagate(e); + throw logger.logExceptionAsError(Exceptions.propagate(e)); } return httpResponse; }); 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 71576d93cbb5..25ca980904a5 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 @@ -7,8 +7,8 @@ import com.azure.core.http.HttpPipelineNextPolicy; import com.azure.core.http.HttpResponse; import com.azure.core.implementation.http.UrlBuilder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; + +import com.azure.core.util.logging.ClientLogger; import reactor.core.publisher.Mono; import java.net.MalformedURLException; @@ -18,7 +18,7 @@ */ public class HostPolicy implements HttpPipelinePolicy { private final String host; - private static final Logger LOGGER = LoggerFactory.getLogger(HostPolicy.class); + private final ClientLogger logger = new ClientLogger(HostPolicy.class); /** * Create HostPolicy. @@ -31,12 +31,12 @@ public HostPolicy(String host) { @Override public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { - LOGGER.info("Setting host to {}", host); + logger.info("Setting host to {}", host); Mono result; - final UrlBuilder urlBuilder = UrlBuilder.parse(context.httpRequest().url()); + final UrlBuilder urlBuilder = UrlBuilder.parse(context.getHttpRequest().getUrl()); try { - context.httpRequest().url(urlBuilder.host(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/HttpLoggingPolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpLoggingPolicy.java index 7668f1e1d5c8..7e44496a0e7d 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpLoggingPolicy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/HttpLoggingPolicy.java @@ -13,7 +13,6 @@ import com.azure.core.implementation.util.FluxUtil; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; -import io.netty.handler.codec.http.HttpResponseStatus; import reactor.core.publisher.Mono; import java.net.URL; @@ -45,7 +44,7 @@ public HttpLoggingPolicy(HttpLogDetailLevel detailLevel) { * * @param detailLevel The HTTP logging detail level. * @param prettyPrintJSON If true, pretty prints JSON message bodies when logging. - * If the detailLevel does not include body logging, this flag does nothing. + * If the detailLevel does not include body logging, this flag does nothing. */ public HttpLoggingPolicy(HttpLogDetailLevel detailLevel, boolean prettyPrintJSON) { this.detailLevel = detailLevel; @@ -61,20 +60,21 @@ public Mono process(HttpPipelineCallContext context, HttpPipelineN final ClientLogger logger = new ClientLogger(callerMethod); final long startNs = System.nanoTime(); // - Mono logRequest = logRequest(logger, context.httpRequest()); - Function> logResponseDelegate = logResponseDelegate(logger, context.httpRequest().url(), startNs); + Mono logRequest = logRequest(logger, context.getHttpRequest()); + Function> logResponseDelegate = + logResponseDelegate(logger, context.getHttpRequest().getUrl(), startNs); // return logRequest.then(next.process()).flatMap(logResponseDelegate) - .doOnError(throwable -> logger.warning("<-- HTTP FAILED: ", throwable)); + .doOnError(throwable -> logger.warning("<-- HTTP FAILED: ", throwable)); } private Mono logRequest(final ClientLogger logger, final HttpRequest request) { if (detailLevel.shouldLogURL()) { - logger.info("--> {} {}", request.httpMethod(), request.url()); + logger.info("--> {} {}", request.getHttpMethod(), request.getUrl()); } if (detailLevel.shouldLogHeaders()) { - for (HttpHeader header : request.headers()) { + for (HttpHeader header : request.getHeaders()) { logger.info(header.toString()); } } @@ -82,21 +82,25 @@ private Mono logRequest(final ClientLogger logger, final HttpRequest reque Mono reqBodyLoggingMono = Mono.empty(); // if (detailLevel.shouldLogBody()) { - if (request.body() == null) { + if (request.getBody() == null) { logger.info("(empty body)"); - logger.info("--> END {}", request.httpMethod()); + logger.info("--> END {}", request.getHttpMethod()); } else { - boolean isHumanReadableContentType = !"application/octet-stream".equalsIgnoreCase(request.headers().value("Content-Type")); - final long contentLength = getContentLength(request.headers()); + boolean isHumanReadableContentType = + !"application/octet-stream".equalsIgnoreCase(request.getHeaders().value("Content-Type")); + final long contentLength = getContentLength(request.getHeaders()); if (contentLength < MAX_BODY_LOG_SIZE && isHumanReadableContentType) { try { - Mono collectedBytes = FluxUtil.collectBytesInByteBufStream(request.body(), true); + Mono collectedBytes = FluxUtil.collectBytesInByteBufferStream(request.getBody()); reqBodyLoggingMono = collectedBytes.flatMap(bytes -> { String bodyString = new String(bytes, StandardCharsets.UTF_8); - bodyString = prettyPrintIfNeeded(logger, request.headers().value("Content-Type"), bodyString); + bodyString = prettyPrintIfNeeded( + logger, + request.getHeaders().value("Content-Type"), + bodyString); logger.info("{}-byte body:%n{}", contentLength, bodyString); - logger.info("--> END {}", request.httpMethod()); + logger.info("--> END {}", request.getHttpMethod()); return Mono.empty(); }); } catch (Exception e) { @@ -104,18 +108,19 @@ private Mono logRequest(final ClientLogger logger, final HttpRequest reque } } else { logger.info("{}-byte body: (content not logged)", contentLength); - logger.info("--> END {}", request.httpMethod()); + logger.info("--> END {}", request.getHttpMethod()); } } } return reqBodyLoggingMono; } - private Function> logResponseDelegate(final ClientLogger logger, final URL url, final long startNs) { + private Function> logResponseDelegate(final ClientLogger logger, final URL url, + final long startNs) { return (HttpResponse response) -> { long tookMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNs); // - String contentLengthString = response.headerValue("Content-Length"); + String contentLengthString = response.getHeaderValue("Content-Length"); String bodySize; if (contentLengthString == null || contentLengthString.isEmpty()) { bodySize = "unknown-length"; @@ -123,24 +128,24 @@ private Function> logResponseDelegate(final Cli bodySize = contentLengthString + "-byte"; } - HttpResponseStatus responseStatus = HttpResponseStatus.valueOf(response.statusCode()); + // HttpResponseStatus responseStatus = HttpResponseStatus.valueOf(response.statusCode()); if (detailLevel.shouldLogURL()) { - logger.info("<-- {} {} {} ({} ms, {} body)", response.statusCode(), responseStatus.reasonPhrase(), url, tookMs, bodySize); + logger.info("<-- {} {} ({} ms, {} body)", response.getStatusCode(), url, tookMs, bodySize); } if (detailLevel.shouldLogHeaders()) { - for (HttpHeader header : response.headers()) { + for (HttpHeader header : response.getHeaders()) { logger.info(header.toString()); } } if (detailLevel.shouldLogBody()) { - long contentLength = getContentLength(response.headers()); - final String contentTypeHeader = response.headerValue("Content-Type"); + long contentLength = getContentLength(response.getHeaders()); + final String contentTypeHeader = response.getHeaderValue("Content-Type"); if (!"application/octet-stream".equalsIgnoreCase(contentTypeHeader) - && contentLength != 0 && contentLength < MAX_BODY_LOG_SIZE) { + && contentLength != 0 && contentLength < MAX_BODY_LOG_SIZE) { final HttpResponse bufferedResponse = response.buffer(); - return bufferedResponse.bodyAsString().map(bodyStr -> { + return bufferedResponse.getBodyAsString().map(bodyStr -> { bodyStr = prettyPrintIfNeeded(logger, contentTypeHeader, bodyStr); logger.info("Response body:\n{}", bodyStr); logger.info("<-- END HTTP"); @@ -159,7 +164,8 @@ private Function> logResponseDelegate(final Cli private String prettyPrintIfNeeded(ClientLogger logger, String contentType, String body) { String result = body; - if (prettyPrintJSON && contentType != null && (contentType.startsWith("application/json") || contentType.startsWith("text/json"))) { + if (prettyPrintJSON && contentType != null + && (contentType.startsWith("application/json") || contentType.startsWith("text/json"))) { try { final Object deserialized = PRETTY_PRINTER.readTree(body); result = PRETTY_PRINTER.writeValueAsString(deserialized); 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 f585187067c7..665e29d67662 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 @@ -7,8 +7,7 @@ import com.azure.core.http.HttpPipelineNextPolicy; import com.azure.core.http.HttpResponse; import com.azure.core.implementation.http.UrlBuilder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import com.azure.core.util.logging.ClientLogger; import reactor.core.publisher.Mono; import java.net.MalformedURLException; @@ -19,7 +18,7 @@ public class PortPolicy implements HttpPipelinePolicy { private final int port; private final boolean overwrite; - private static final Logger LOGGER = LoggerFactory.getLogger(PortPolicy.class); + private final ClientLogger logger = new ClientLogger(PortPolicy.class); /** * Create a new PortPolicy object. @@ -34,12 +33,12 @@ public PortPolicy(int port, boolean overwrite) { @Override public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { - final UrlBuilder urlBuilder = UrlBuilder.parse(context.httpRequest().url()); - if (overwrite || urlBuilder.port() == null) { - LOGGER.info("Changing port to {}", port); + final UrlBuilder urlBuilder = UrlBuilder.parse(context.getHttpRequest().getUrl()); + if (overwrite || urlBuilder.getPort() == null) { + logger.info("Changing port to {}", port); try { - context.httpRequest().url(urlBuilder.port(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 393e51221c6a..0b618d260287 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 @@ -7,8 +7,7 @@ import com.azure.core.http.HttpPipelineNextPolicy; import com.azure.core.http.HttpResponse; import com.azure.core.implementation.http.UrlBuilder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import com.azure.core.util.logging.ClientLogger; import reactor.core.publisher.Mono; import java.net.MalformedURLException; @@ -19,7 +18,7 @@ public class ProtocolPolicy implements HttpPipelinePolicy { private final String protocol; private final boolean overwrite; - private static final Logger LOGGER = LoggerFactory.getLogger(ProtocolPolicy.class); + private final ClientLogger logger = new ClientLogger(ProtocolPolicy.class); /** * Create a new ProtocolPolicy. @@ -34,12 +33,12 @@ public ProtocolPolicy(String protocol, boolean overwrite) { @Override public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { - final UrlBuilder urlBuilder = UrlBuilder.parse(context.httpRequest().url()); - if (overwrite || urlBuilder.scheme() == null) { - LOGGER.info("Setting protocol to {}", protocol); + final UrlBuilder urlBuilder = UrlBuilder.parse(context.getHttpRequest().getUrl()); + if (overwrite || urlBuilder.getScheme() == null) { + logger.info("Setting protocol to {}", protocol); try { - context.httpRequest().url(urlBuilder.scheme(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/http/policy/ProxyAuthenticationPolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/ProxyAuthenticationPolicy.java index 3b6596abf553..b1447b692acf 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/ProxyAuthenticationPolicy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/ProxyAuthenticationPolicy.java @@ -33,7 +33,7 @@ public ProxyAuthenticationPolicy(String username, String password) { public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { String auth = username + ":" + password; String encodedAuth = Base64Util.encodeToString(auth.getBytes(StandardCharsets.UTF_8)); - context.httpRequest().header("Proxy-Authentication", "Basic " + encodedAuth); + context.getHttpRequest().setHeader("Proxy-Authentication", "Basic " + encodedAuth); return next.process(); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RequestIdPolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RequestIdPolicy.java index ebc90f64eaae..e9e804dfb6fb 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RequestIdPolicy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RequestIdPolicy.java @@ -19,9 +19,9 @@ public class RequestIdPolicy implements HttpPipelinePolicy { @Override public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { - String requestId = context.httpRequest().headers().value(REQUEST_ID_HEADER); + String requestId = context.getHttpRequest().getHeaders().value(REQUEST_ID_HEADER); if (requestId == null) { - context.httpRequest().headers().put(REQUEST_ID_HEADER, UUID.randomUUID().toString()); + context.getHttpRequest().getHeaders().put(REQUEST_ID_HEADER, UUID.randomUUID().toString()); } return next.process(); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RetryPolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RetryPolicy.java index 2267cb7896c0..d8e1c45ee48a 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RetryPolicy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RetryPolicy.java @@ -7,9 +7,9 @@ import com.azure.core.http.HttpPipelineNextPolicy; import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; -import io.netty.handler.codec.http.HttpResponseStatus; import reactor.core.publisher.Mono; +import java.net.HttpURLConnection; import java.time.Duration; import java.time.temporal.ChronoUnit; @@ -45,53 +45,56 @@ public RetryPolicy(int maxRetries, Duration delayDuration) { @Override public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { - return attemptAsync(context, next, context.httpRequest(), 0); + return attemptAsync(context, next, context.getHttpRequest(), 0); } - private Mono attemptAsync(final HttpPipelineCallContext context, final HttpPipelineNextPolicy next, final HttpRequest originalHttpRequest, final int tryCount) { - context.httpRequest(originalHttpRequest.buffer()); + private Mono attemptAsync(final HttpPipelineCallContext context, final HttpPipelineNextPolicy next, + final HttpRequest originalHttpRequest, final int tryCount) { + context.setHttpRequest(originalHttpRequest.buffer()); return next.clone().process() - .flatMap(httpResponse -> { - if (shouldRetry(httpResponse, tryCount)) { - return attemptAsync(context, next, originalHttpRequest, tryCount + 1).delaySubscription(determineDelayDuration(httpResponse)); - } else { - return Mono.just(httpResponse); - } - }) - .onErrorResume(err -> { - if (tryCount < maxRetries) { - return attemptAsync(context, next, originalHttpRequest, tryCount + 1).delaySubscription(this.delayDuration); - } else { - return Mono.error(err); - } - }); + .flatMap(httpResponse -> { + if (shouldRetry(httpResponse, tryCount)) { + return attemptAsync(context, next, originalHttpRequest, tryCount + 1) + .delaySubscription(determineDelayDuration(httpResponse)); + } else { + return Mono.just(httpResponse); + } + }) + .onErrorResume(err -> { + if (tryCount < maxRetries) { + return attemptAsync(context, next, originalHttpRequest, tryCount + 1) + .delaySubscription(this.delayDuration); + } else { + return Mono.error(err); + } + }); } private boolean shouldRetry(HttpResponse response, int tryCount) { - int code = response.statusCode(); + int code = response.getStatusCode(); return tryCount < maxRetries - && (code == HttpResponseStatus.REQUEST_TIMEOUT.code() - || (code >= HttpResponseStatus.INTERNAL_SERVER_ERROR.code() - && code != HttpResponseStatus.NOT_IMPLEMENTED.code() - && code != HttpResponseStatus.HTTP_VERSION_NOT_SUPPORTED.code())); + && (code == HttpURLConnection.HTTP_CLIENT_TIMEOUT + || (code >= HttpURLConnection.HTTP_INTERNAL_ERROR + && code != HttpURLConnection.HTTP_NOT_IMPLEMENTED + && code != HttpURLConnection.HTTP_VERSION)); } /** * Determines the delay duration that should be waited before retrying. * @param response HTTP response * @return If the HTTP response has a retry-after-ms header that will be returned, - * otherwise the duration used during the construction of the policy. + * otherwise the duration used during the construction of the policy. */ private Duration determineDelayDuration(HttpResponse response) { - int code = response.statusCode(); + int code = response.getStatusCode(); // Response will not have a retry-after-ms header. - if (code != HttpResponseStatus.TOO_MANY_REQUESTS.code() - && code != HttpResponseStatus.SERVICE_UNAVAILABLE.code()) { + if (code != 429 // too many requests + && code != 503) { // service unavailable return this.delayDuration; } - String retryHeader = response.headerValue(RETRY_AFTER_MS_HEADER); + String retryHeader = response.getHeaderValue(RETRY_AFTER_MS_HEADER); // Retry header is missing or empty, return the default delay duration. if (retryHeader == null || retryHeader.isEmpty()) { diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/UserAgentPolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/UserAgentPolicy.java index a4540edf5e9a..53bdfe357b3b 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/UserAgentPolicy.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/UserAgentPolicy.java @@ -82,13 +82,13 @@ public UserAgentPolicy(String sdkName, String sdkVersion, Configuration configur */ @Override public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { - String header = context.httpRequest().headers().value("User-Agent"); + String header = context.getHttpRequest().getHeaders().value("User-Agent"); if (header == null || header.startsWith(DEFAULT_USER_AGENT_HEADER)) { header = userAgent; } else { header = userAgent + " " + header; } - context.httpRequest().headers().put("User-Agent", header); + context.getHttpRequest().getHeaders().put("User-Agent", header); return next.process(); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/IterableResponse.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/IterableResponse.java deleted file mode 100644 index abdb328a556c..000000000000 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/IterableResponse.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.http.rest; - -import reactor.core.publisher.Flux; - -import java.util.Iterator; -import java.util.stream.Stream; - -/** - * This class provides utility to iterate over values. All the values are preserved even if they are traversed multiple times. - * - *

Code sample using Stream

- * - * {@codesnippet com.azure.core.http.rest.iterableResponse.stream} - * - *

Code sample using Iterator

- * - * {@codesnippet com.azure.core.http.rest.iterableResponse.iterator.while} - * - *

Code sample using Stream and filter

- * - * {@codesnippet com.azure.core.http.rest.iterableResponse.stream.filter} - * - * @param The type of value in this {@link Iterable}. - * @see Iterable - */ -public class IterableResponse implements Iterable { - private final Flux flux; - - /** - * Creates instance given {@link Flux}. - * @param flux to iterate over - */ - public IterableResponse(Flux flux) { - this.flux = flux; - } - - /** - * Utility function to provide {@link Stream} of value T. - * It will provide same stream of T values if called multiple times. - * @return {@link Stream} of value T. - */ - public Stream stream() { - return flux.toStream(); - } - - /** - * Utility function to provide {@link Iterator} of value T. - * It will provide same collection of T values if called multiple times. - * @return {@link Iterator} of value T. - */ - @Override - public Iterator iterator() { - return flux.toIterable().iterator(); - } - -} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java index d75e3e2c8b18..3eff80dfdddb 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Page.java @@ -15,10 +15,10 @@ public interface Page { /** * @return A list of items from that service. */ - List items(); + List getItems(); /** * @return A link to the next page, or null if there are no more results. */ - String nextLink(); + String getNextLink(); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java index 0ddf3a89cd82..fedc81ce7753 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFlux.java @@ -3,11 +3,8 @@ package com.azure.core.http.rest; -import java.util.Objects; import java.util.function.Function; import java.util.function.Supplier; -import org.reactivestreams.Publisher; -import reactor.core.CoreSubscriber; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -36,107 +33,34 @@ * @see Page * @see Flux */ -public class PagedFlux extends Flux { - private final Supplier>> firstPageRetriever; - private final Function>> nextPageRetriever; +public class PagedFlux extends PagedFluxBase> { /** - * Creates an instance of {@link PagedFlux}. The constructor takes in two arguments. The first - * argument is a supplier that fetches the first page of {@code T}. The second argument is a - * function that fetches subsequent pages of {@code T} - *

Code sample

- * {@codesnippet com.azure.core.http.rest.pagedflux.instantiation} - * - * @param firstPageRetriever Supplier that retrieves the first page - * @param nextPageRetriever Function that retrieves the next page given a continuation token - */ - public PagedFlux(Supplier>> firstPageRetriever, - Function>> nextPageRetriever) { - Objects.requireNonNull(firstPageRetriever, "First page supplier cannot be null"); - Objects.requireNonNull(nextPageRetriever, "Next page retriever function cannot be null"); - this.firstPageRetriever = firstPageRetriever; - this.nextPageRetriever = nextPageRetriever; - } - - /** - * Creates a flux of {@link PagedResponse} starting from the first page. - * - *

Code sample

- * {@codesnippet com.azure.core.http.rest.pagedflux.bypage} - * - * @return A {@link PagedFlux} starting from the first page - */ - public Flux> byPage() { - return firstPageRetriever.get().flatMapMany(this::extractAndFetchPage); - } - - /** - * Creates a flux of {@link PagedResponse} starting from the next page associated with the given - * continuation token. To start from first page, use {@link #byPage()} instead. + * Creates an instance of {@link PagedFlux} that consists of only a single page of results. The only + * argument to this constructor therefore is a supplier that fetches the first (and known-only) page of {@code T}. * *

Code sample

- * {@codesnippet com.azure.core.http.rest.pagedflux.bypage#String} + * {@codesnippet com.azure.core.http.rest.pagedflux.singlepage.instantiation} * - * @param continuationToken The continuation token used to fetch the next page - * @return A {@link PagedFlux} starting from the page associated with the continuation token + * @param firstPageRetriever Supplier that retrieves the first page. */ - public Flux> byPage(String continuationToken) { - return nextPageRetriever.apply(continuationToken).flatMapMany(this::extractAndFetchPage); + public PagedFlux(Supplier>> firstPageRetriever) { + super(firstPageRetriever); } /** - * Subscribe to consume all items of type {@code T} in the sequence respectively. - * This is recommended for most common scenarios. This will seamlessly fetch next - * page when required and provide with a {@link Flux} of items. + * Creates an instance of {@link PagedFlux}. The constructor takes in two arguments. The first + * argument is a supplier that fetches the first page of {@code T}. The second argument is a + * function that fetches subsequent pages of {@code T} * *

Code sample

- * {@codesnippet com.azure.core.http.rest.pagedflux.subscribe} - * - * @param coreSubscriber The subscriber for this {@link PagedFlux} - */ - @Override - public void subscribe(CoreSubscriber coreSubscriber) { - byT(null).subscribe(coreSubscriber); - } - - /** - * Helper method to return the flux of items starting from the page associated with the {@code continuationToken} + * {@codesnippet com.azure.core.http.rest.pagedflux.instantiation} * - * @param continuationToken The continuation token that is used to fetch the next page - * @return A {@link Flux} of items in this page - */ - private Flux byT(String continuationToken) { - if (continuationToken == null) { - return firstPageRetriever.get().flatMapMany(this::extractAndFetchT); - } - return nextPageRetriever.apply(continuationToken).flatMapMany(this::extractAndFetchT); - } - - /** - * Helper method to string together a flux of items transparently extracting items from - * next pages, if available. - * @param page Starting page - * @return A {@link Flux} of items - */ - private Publisher extractAndFetchT(PagedResponse page) { - String nextPageLink = page.nextLink(); - if (nextPageLink == null) { - return Flux.fromIterable(page.items()); - } - return Flux.fromIterable(page.items()).concatWith(byT(nextPageLink)); - } - - /** - * Helper method to string together a flux of {@link PagedResponse} transparently - * fetching next pages, if available - * @param page Starting page - * @return A {@link Flux} of {@link PagedResponse} + * @param firstPageRetriever Supplier that retrieves the first page + * @param nextPageRetriever Function that retrieves the next page given a continuation token */ - private Publisher> extractAndFetchPage(PagedResponse page) { - String nextPageLink = page.nextLink(); - if (nextPageLink == null) { - return Flux.just(page); - } - return Flux.just(page).concatWith(byPage(page.nextLink())); + public PagedFlux(Supplier>> firstPageRetriever, + Function>> nextPageRetriever) { + super(firstPageRetriever, nextPageRetriever); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java new file mode 100644 index 000000000000..af1a949636bf --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedFluxBase.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.rest; + +import org.reactivestreams.Publisher; +import reactor.core.CoreSubscriber; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.Objects; +import java.util.function.Function; +import java.util.function.Supplier; + +/** + * This class is a flux that can operate on any type that extends {@link PagedResponse} and + * also provides the ability to operate on individual items. When processing the response by page, + * each response will contain the items in the page as well as the request details like + * status code and headers. + * + *

To process one item at a time, simply subscribe to this flux as shown below

+ *

Code sample

+ * {@codesnippet com.azure.core.http.rest.pagedfluxbase.items} + * + *

To process one page at a time, use {@link #byPage} method as shown below

+ *

Code sample

+ * {@codesnippet com.azure.core.http.rest.pagedfluxbase.pages} + * + *

To process items one page at a time starting from any page associated with a continuation token, + * use {@link #byPage(String)} as shown below

+ *

Code sample

+ * {@codesnippet com.azure.core.http.rest.pagedfluxbase.pagesWithContinuationToken} + * + * @param The type of items in {@code P} + * @param

The {@link PagedResponse} holding items of type {@code T} + * + * @see PagedResponse + * @see Page + * @see Flux + */ +public class PagedFluxBase> extends Flux { + private final Supplier> firstPageRetriever; + private final Function> nextPageRetriever; + + /** + * Creates an instance of {@link PagedFluxBase} that consists of only a single page of results. The only + * argument to this constructor therefore is a supplier that fetches the first (and known-only) page from {@code P}. + * + *

Code sample

+ * {@codesnippet com.azure.core.http.rest.pagedfluxbase.singlepage.instantiation} + * + * @param firstPageRetriever Supplier that retrieves the first page + */ + public PagedFluxBase(Supplier> firstPageRetriever) { + this(firstPageRetriever, token -> Mono.empty()); + } + + /** + * Creates an instance of {@link PagedFluxBase}. The constructor takes in two arguments. The first + * argument is a supplier that fetches the first page from {@code P}. The second argument is a + * function that fetches subsequent pages from {@code P}. + * + *

Code sample

+ * {@codesnippet com.azure.core.http.rest.pagedfluxbase.instantiation} + * + * @param firstPageRetriever Supplier that retrieves the first page + * @param nextPageRetriever Function that retrieves the next page given a continuation token + */ + public PagedFluxBase(Supplier> firstPageRetriever, + Function> nextPageRetriever) { + Objects.requireNonNull(firstPageRetriever, "First page supplier cannot be null"); + Objects.requireNonNull(nextPageRetriever, "Next page retriever function cannot be null"); + this.firstPageRetriever = firstPageRetriever; + this.nextPageRetriever = nextPageRetriever; + } + + /** + * Creates a flux of {@link PagedResponse} starting from the first page. + * + *

Code sample

+ * {@codesnippet com.azure.core.http.rest.pagedfluxbase.bypage} + * + * @return A {@link PagedFluxBase} starting from the first page + */ + public Flux

byPage() { + return firstPageRetriever.get().flatMapMany(this::extractAndFetchPage); + } + + /** + * Creates a flux of {@link PagedResponse} starting from the next page associated with the given + * continuation token. To start from first page, use {@link #byPage()} instead. + * + *

Code sample

+ * {@codesnippet com.azure.core.http.rest.pagedfluxbase.bypage#String} + * + * @param continuationToken The continuation token used to fetch the next page + * @return A {@link PagedFluxBase} starting from the page associated with the continuation token + */ + public Flux

byPage(String continuationToken) { + return nextPageRetriever.apply(continuationToken).flatMapMany(this::extractAndFetchPage); + } + + /** + * Subscribe to consume all items of type {@code T} in the sequence respectively. + * This is recommended for most common scenarios. This will seamlessly fetch next + * page when required and provide with a {@link Flux} of items. + * + *

Code sample

+ * {@codesnippet com.azure.core.http.rest.pagedfluxbase.subscribe} + * + * @param coreSubscriber The subscriber for this {@link PagedFluxBase} + */ + @Override + public void subscribe(CoreSubscriber coreSubscriber) { + byT(null).subscribe(coreSubscriber); + } + + /** + * Helper method to return the flux of items starting from the page associated with the {@code continuationToken} + * + * @param continuationToken The continuation token that is used to fetch the next page + * @return A {@link Flux} of items in this page + */ + private Flux byT(String continuationToken) { + if (continuationToken == null) { + return firstPageRetriever.get().flatMapMany(this::extractAndFetchT); + } + return nextPageRetriever.apply(continuationToken).flatMapMany(this::extractAndFetchT); + } + + /** + * Helper method to string together a flux of items transparently extracting items from + * next pages, if available. + * @param page Starting page + * @return A {@link Flux} of items + */ + private Publisher extractAndFetchT(PagedResponse page) { + String nextPageLink = page.getNextLink(); + if (nextPageLink == null) { + return Flux.fromIterable(page.getItems()); + } + return Flux.fromIterable(page.getItems()).concatWith(byT(nextPageLink)); + } + + /** + * Helper method to string together a flux of {@link PagedResponse} transparently + * fetching next pages, if available + * @param page Starting page + * @return A {@link Flux} of {@link PagedResponse} + */ + private Publisher extractAndFetchPage(P page) { + String nextPageLink = page.getNextLink(); + if (nextPageLink == null) { + return Flux.just(page); + } + return Flux.just(page).concatWith(byPage(page.getNextLink())); + } +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedIterable.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedIterable.java index cac6c353efae..3a994db3045b 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedIterable.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedIterable.java @@ -3,10 +3,13 @@ package com.azure.core.http.rest; +import com.azure.core.util.IterableStream; + import java.util.stream.Stream; /** - * This class provides utility to iterate over {@link PagedResponse} using {@link Stream} and {@link Iterable} interfaces. + * This class provides utility to iterate over {@link PagedResponse} using {@link Stream} and {@link Iterable} + * interfaces. * *

Code sample using {@link Stream} by page

* @@ -20,11 +23,11 @@ * * {@codesnippet com.azure.core.http.rest.pagedIterable.iterableByPage.while} * - * @param The type of value contained in this {@link IterableResponse}. + * @param The type of value contained in this {@link IterableStream}. * @see PagedResponse - * @see IterableResponse + * @see IterableStream */ -public class PagedIterable extends IterableResponse { +public class PagedIterable extends IterableStream { private final PagedFlux pagedFlux; /** @@ -45,6 +48,18 @@ public Stream> streamByPage() { return pagedFlux.byPage().toStream(); } + /** + * Retrieve the {@link Stream}, one page at a time, starting from the next page associated with the given + * continuation token. To start from first page, use {@link #streamByPage()} instead. + * + * @param continuationToken The continuation token used to fetch the next page + * + * @return {@link Stream} of {@link PagedResponse}, starting from the page associated with the continuation token + */ + public Stream> streamByPage(String continuationToken) { + return pagedFlux.byPage(continuationToken).toStream(); + } + /** * Provides {@link Iterable} API for{ @link PagedResponse} * It will provide same collection of T values from starting if called multiple times. @@ -54,4 +69,16 @@ public Iterable> iterableByPage() { return pagedFlux.byPage().toIterable(); } + /** + * Provides {@link Iterable} API for {@link PagedResponse}, starting from the next page associated with the given + * continuation token. To start from first page, use {@link #streamByPage()} instead. + * It will provide same collection of T values from starting if called multiple times. + * + * @param continuationToken The continuation token used to fetch the next page + * + * @return {@link Iterable} interface + */ + public Iterable> iterableByPage(String continuationToken) { + return pagedFlux.byPage(continuationToken).toIterable(); + } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponse.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponse.java index 223dc4ba03c9..28c898ab53bc 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponse.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedResponse.java @@ -17,7 +17,7 @@ public interface PagedResponse extends Page, Response>, Closeable * * @return The items in the page. */ - default List value() { - return items(); + default List getValue() { + return getItems(); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Response.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Response.java index 560f76135c95..546756a88bc2 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Response.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/Response.java @@ -8,7 +8,7 @@ /** * REST response with a strongly-typed content specified. * - * @param The deserialized type of the response content, available from {@link #value()}. + * @param The deserialized type of the response content, available from {@link #getValue()}. * @see ResponseBase */ public interface Response { @@ -18,24 +18,24 @@ public interface Response { * * @return the status code of the HTTP response. */ - int statusCode(); + int getStatusCode(); /** * Get the headers from the HTTP response. * * @return an HttpHeaders instance containing the HTTP response headers. */ - HttpHeaders headers(); + HttpHeaders getHeaders(); /** * Get the HTTP request which resulted in this response. * * @return the HTTP request. */ - HttpRequest request(); + HttpRequest getRequest(); /** * @return the deserialized value of the HTTP response. */ - T value(); + T getValue(); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/ResponseBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/ResponseBase.java index d1beeb29e171..556b43ad8af9 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/ResponseBase.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/ResponseBase.java @@ -9,7 +9,7 @@ * The response of a REST request. * * @param The deserialized type of the response headers. - * @param The deserialized type of the response value, available from {@link #value()}. + * @param The deserialized type of the response value, available from {@link Response#getValue()}. */ public class ResponseBase implements Response { private final HttpRequest request; @@ -39,7 +39,7 @@ public ResponseBase(HttpRequest request, int statusCode, HttpHeaders headers, T * @return the request which resulted in this RestResponseBase. */ @Override - public HttpRequest request() { + public HttpRequest getRequest() { return request; } @@ -47,7 +47,7 @@ public HttpRequest request() { * {@inheritDoc} */ @Override - public int statusCode() { + public int getStatusCode() { return statusCode; } @@ -55,7 +55,7 @@ public int statusCode() { * {@inheritDoc} */ @Override - public HttpHeaders headers() { + public HttpHeaders getHeaders() { return headers; } @@ -64,7 +64,7 @@ public HttpHeaders headers() { * * @return an instance of header type H, containing the HTTP response headers. */ - public H deserializedHeaders() { + public H getDeserializedHeaders() { return deserializedHeaders; } @@ -72,7 +72,7 @@ public H deserializedHeaders() { * {@inheritDoc} */ @Override - public T value() { + public T getValue() { return value; } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/SimpleResponse.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/SimpleResponse.java index ec5175b7adec..b286bfcd2bd1 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/SimpleResponse.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/SimpleResponse.java @@ -38,9 +38,9 @@ public SimpleResponse(HttpRequest request, int statusCode, HttpHeaders headers, * @param value the value to put into the new response */ public SimpleResponse(Response response, T value) { - this.request = response.request(); - this.statusCode = response.statusCode(); - this.headers = response.headers(); + this.request = response.getRequest(); + this.statusCode = response.getStatusCode(); + this.headers = response.getHeaders(); this.value = value; } @@ -48,7 +48,7 @@ public SimpleResponse(Response response, T value) { * @return the request which resulted in this RestResponse. */ @Override - public HttpRequest request() { + public HttpRequest getRequest() { return request; } @@ -56,7 +56,7 @@ public HttpRequest request() { * @return the status code of the HTTP response. */ @Override - public int statusCode() { + public int getStatusCode() { return statusCode; } @@ -64,7 +64,7 @@ public int statusCode() { * {@inheritDoc} */ @Override - public HttpHeaders headers() { + public HttpHeaders getHeaders() { return headers; } @@ -72,7 +72,7 @@ public HttpHeaders headers() { * @return the deserialized value of the HTTP response. */ @Override - public T value() { + public T getValue() { return value; } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/StreamResponse.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/StreamResponse.java index 2d425664720b..8ed7e5eeeaa5 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/StreamResponse.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/StreamResponse.java @@ -4,15 +4,15 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; -import io.netty.buffer.ByteBuf; import reactor.core.publisher.Flux; import java.io.Closeable; +import java.nio.ByteBuffer; /** * REST response with a streaming content. */ -public final class StreamResponse extends SimpleResponse> implements Closeable { +public final class StreamResponse extends SimpleResponse> implements Closeable { /** * Creates StreamResponse. * @@ -21,7 +21,7 @@ public final class StreamResponse extends SimpleResponse> implemen * @param headers the headers of the HTTP response * @param value the streaming value */ - public StreamResponse(HttpRequest request, int statusCode, HttpHeaders headers, Flux value) { + public StreamResponse(HttpRequest request, int statusCode, HttpHeaders headers, Flux value) { super(request, statusCode, headers, value); } @@ -29,8 +29,8 @@ public StreamResponse(HttpRequest request, int statusCode, HttpHeaders headers, * @return the stream content */ @Override - public Flux value() { - return super.value(); + public Flux getValue() { + return super.getValue(); } /** @@ -38,6 +38,6 @@ public Flux value() { */ @Override public void close() { - value().subscribe().dispose(); + getValue().subscribe().dispose(); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/VoidResponse.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/VoidResponse.java index 355cc01321fb..a9da7b546bb2 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/VoidResponse.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/VoidResponse.java @@ -26,6 +26,6 @@ public VoidResponse(HttpRequest request, int statusCode, HttpHeaders headers) { * @param response a response used to construct the void response. */ public VoidResponse(Response response) { - super(response.request(), response.statusCode(), response.headers(), null); + super(response.getRequest(), response.getStatusCode(), response.getHeaders(), null); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/CollectionFormat.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/CollectionFormat.java index 52d4ae44b807..81914822fa65 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/CollectionFormat.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/CollectionFormat.java @@ -6,7 +6,9 @@ /** * Swagger collection format to use for joining {@link java.util.List} parameters in * paths, queries, and headers. - * See https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#fixed-fields-7. + * See + * + * https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#fixed-fields-7. */ public enum CollectionFormat { /** diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/DateTimeRfc1123.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/DateTimeRfc1123.java index 0258bd5aab45..c4bebc8aac86 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/DateTimeRfc1123.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/DateTimeRfc1123.java @@ -16,7 +16,7 @@ public final class DateTimeRfc1123 { * The pattern of the datetime used for RFC1123 datetime format. */ private static final DateTimeFormatter RFC1123_DATE_TIME_FORMATTER = - DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss 'GMT'").withZone(ZoneId.of("UTC")).withLocale(Locale.US); + DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss 'GMT'").withZone(ZoneId.of("UTC")).withLocale(Locale.US); /** * The actual datetime object. */ @@ -42,7 +42,7 @@ public DateTimeRfc1123(String formattedString) { * Returns the underlying DateTime. * @return The underlying DateTime. */ - public OffsetDateTime dateTime() { + public OffsetDateTime getDateTime() { if (this.dateTime == null) { return null; } @@ -70,6 +70,6 @@ public boolean equals(Object obj) { } DateTimeRfc1123 rhs = (DateTimeRfc1123) obj; - return this.dateTime.equals(rhs.dateTime()); + return this.dateTime.equals(rhs.getDateTime()); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/EncodedParameter.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/EncodedParameter.java index e10bcbf60f1f..cd982d24db93 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/EncodedParameter.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/EncodedParameter.java @@ -28,7 +28,7 @@ class EncodedParameter { * * @return the name of this parameter */ - public String name() { + public String getName() { return name; } @@ -37,7 +37,7 @@ public String name() { * * @return the encoded value for this parameter */ - public String encodedValue() { + public String getEncodedValue() { return encodedValue; } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/OperationDescription.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/OperationDescription.java index 6ddf3552e68b..824234c86286 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/OperationDescription.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/OperationDescription.java @@ -44,9 +44,9 @@ public OperationDescription(String fullyQualifiedMethodName, HttpRequest originalHttpRequest) { this.fullyQualifiedMethodName = fullyQualifiedMethodName; this.pollStrategyData = pollStrategyData; - this.headers = originalHttpRequest.headers().toMap(); - this.url = originalHttpRequest.url(); - this.httpMethod = originalHttpRequest.httpMethod().toString(); + this.headers = originalHttpRequest.getHeaders().toMap(); + this.url = originalHttpRequest.getUrl(); + this.httpMethod = originalHttpRequest.getHttpMethod().toString(); } /** @@ -54,7 +54,7 @@ public OperationDescription(String fullyQualifiedMethodName, * * @return the Serializable poll strategy data */ - public Serializable pollStrategyData() { + public Serializable getPollStrategyData() { return this.pollStrategyData; } @@ -63,14 +63,14 @@ public Serializable pollStrategyData() { * * @return the originating requests url */ - public URL url() { + public URL getUrl() { return this.url; } /** * @return the originating requests http method. */ - public String httpMethod() { + public String getHttpMethod() { return this.httpMethod; } @@ -79,7 +79,7 @@ public String httpMethod() { * * @return the originating requests headers */ - public Map headers() { + public Map getHeaders() { return this.headers; } @@ -88,7 +88,7 @@ public Map headers() { * * @return the originating method name */ - String methodName() { + String getMethodName() { int lastIndex = this.fullyQualifiedMethodName.lastIndexOf("."); return this.fullyQualifiedMethodName.substring(lastIndex + 1); } 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 107a3c410b24..a7d7a059ab10 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 @@ -22,6 +22,7 @@ import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.ResponseBase; +import com.azure.core.exception.UnexpectedLengthException; import com.azure.core.implementation.http.ContentType; import com.azure.core.implementation.http.PagedResponseBase; import com.azure.core.implementation.http.UrlBuilder; @@ -35,7 +36,7 @@ import com.azure.core.implementation.util.ImplUtils; import com.azure.core.implementation.util.TypeUtil; import com.azure.core.util.Context; -import io.netty.buffer.ByteBuf; +import com.azure.core.util.logging.ClientLogger; import reactor.core.Exceptions; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -49,6 +50,7 @@ import java.lang.reflect.Proxy; import java.lang.reflect.Type; import java.net.URL; +import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; @@ -66,6 +68,7 @@ * deserialized Java object. */ public class RestProxy implements InvocationHandler { + private final ClientLogger logger = new ClientLogger(RestProxy.class); private final HttpPipeline httpPipeline; private final SerializerAdapter serializer; private final SwaggerInterfaceParser interfaceParser; @@ -75,10 +78,10 @@ public class RestProxy implements InvocationHandler { * Create a RestProxy. * * @param httpPipeline the HttpPipelinePolicy and HttpClient httpPipeline that will be used to send HTTP - * requests. + * requests. * @param serializer the serializer that will be used to convert response bodies to POJOs. * @param interfaceParser the parser that contains information about the interface describing REST API methods - * that this RestProxy "implements". + * that this RestProxy "implements". */ public RestProxy(HttpPipeline httpPipeline, SerializerAdapter serializer, SwaggerInterfaceParser interfaceParser) { this.httpPipeline = httpPipeline; @@ -94,8 +97,8 @@ public RestProxy(HttpPipeline httpPipeline, SerializerAdapter serializer, Swagge * @param method the method to get a SwaggerMethodParser for * @return the SwaggerMethodParser for the provided method */ - private SwaggerMethodParser methodParser(Method method) { - return interfaceParser.methodParser(method); + private SwaggerMethodParser getMethodParser(Method method) { + return interfaceParser.getMethodParser(method); } /** @@ -103,7 +106,7 @@ private SwaggerMethodParser methodParser(Method method) { * * @return The SerializerAdapter used by this RestProxy */ - public SerializerAdapter serializer() { + public SerializerAdapter getSerializer() { return serializer; } @@ -125,33 +128,74 @@ public Object invoke(Object proxy, final Method method, Object[] args) { final HttpRequest request; if (method.isAnnotationPresent(ResumeOperation.class)) { OperationDescription opDesc = ImplUtils.findFirstOfType(args, OperationDescription.class); - Method resumeMethod = determineResumeMethod(method, opDesc.methodName()); + Method resumeMethod = determineResumeMethod(method, opDesc.getMethodName()); - methodParser = methodParser(resumeMethod); + methodParser = getMethodParser(resumeMethod); request = createHttpRequest(opDesc, methodParser, args); - final Type returnType = methodParser.returnType(); - - // Track 2 clients don't use ResumeOperation yet, but they need to be thought about while implementing tracing. - return handleResumeOperation(request, opDesc, methodParser, returnType, startTracingSpan(resumeMethod, Context.NONE)); - + final Type returnType = methodParser.getReturnType(); + + // Track 2 clients don't use ResumeOperation yet, but they need to be thought about while + // implementing tracing. + return handleResumeOperation( + request, + opDesc, + methodParser, + returnType, + startTracingSpan(resumeMethod, Context.NONE)); } else { - methodParser = methodParser(method); + methodParser = getMethodParser(method); request = createHttpRequest(methodParser, args); - Context context = methodParser.context(args).addData("caller-method", methodParser.fullyQualifiedMethodName()); + Context context = + methodParser.setContext(args).addData("caller-method", methodParser.getFullyQualifiedMethodName()); context = startTracingSpan(method, context); + if (request.getBody() != null) { + request.setBody(validateLength(request)); + } + final Mono asyncResponse = send(request, context); - // + Mono asyncDecodedResponse = this.decoder.decode(asyncResponse, methodParser); - // - return handleHttpResponse(request, asyncDecodedResponse, methodParser, methodParser.returnType(), context); + + return handleHttpResponse(request, asyncDecodedResponse, methodParser, methodParser.getReturnType(), + context); } } catch (Exception e) { - throw Exceptions.propagate(e); + throw logger.logExceptionAsError(Exceptions.propagate(e)); } } + private Flux validateLength(final HttpRequest request) { + final Flux bbFlux = request.getBody(); + if (bbFlux == null) { + return Flux.empty(); + } + + return Flux.defer(() -> { + Long expectedLength = Long.valueOf(request.getHeaders().value("Content-Length")); + final long[] currentTotalLength = new long[1]; + return bbFlux.doOnEach(s -> { + if (s.isOnNext()) { + ByteBuffer byteBuffer = s.get(); + int currentLength = (byteBuffer == null) ? 0 : byteBuffer.remaining(); + currentTotalLength[0] += currentLength; + if (currentTotalLength[0] > expectedLength) { + throw logger.logExceptionAsError(new UnexpectedLengthException( + String.format("Request body emitted %d bytes more than the expected %d bytes.", + currentTotalLength[0], expectedLength), currentTotalLength[0], expectedLength)); + } + } else if (s.isOnComplete()) { + if (expectedLength.compareTo(currentTotalLength[0]) != 0) { + throw logger.logExceptionAsError(new UnexpectedLengthException( + String.format("Request body emitted %d bytes less than the expected %d bytes.", + currentTotalLength[0], expectedLength), currentTotalLength[0], expectedLength)); + } + } + }); + }); + } + private Method determineResumeMethod(Method method, String resumeMethodName) { for (Method potentialResumeMethod : method.getDeclaringClass().getMethods()) { if (potentialResumeMethod.getName().equals(resumeMethodName)) { @@ -170,7 +214,7 @@ private Method determineResumeMethod(Method method, String resumeMethodName) { * @return The updated context containing the span context. */ private Context startTracingSpan(Method method, Context context) { - String spanName = String.format("Azure.%s/%s", interfaceParser.serviceName(), method.getName()); + String spanName = String.format("Azure.%s/%s", interfaceParser.getServiceName(), method.getName()); context = TracerProxy.setSpanName(spanName, context); return TracerProxy.start(spanName, context); } @@ -189,35 +233,42 @@ private HttpRequest createHttpRequest(SwaggerMethodParser methodParser, Object[] // Sometimes people pass in a full URL for the value of their PathParam annotated argument. // This definitely happens in paging scenarios. In that case, just use the full URL and // ignore the Host annotation. - final String path = methodParser.path(args); + final String path = methodParser.setPath(args); final UrlBuilder pathUrlBuilder = UrlBuilder.parse(path); - if (pathUrlBuilder.scheme() != null) { + if (pathUrlBuilder.getScheme() != null) { urlBuilder = pathUrlBuilder; } else { urlBuilder = new UrlBuilder(); - // We add path to the UrlBuilder first because this is what is - // provided to the HTTP Method annotation. Any path substitutions - // from other substitution annotations will overwrite this. - urlBuilder.path(path); + final String scheme = methodParser.setScheme(args); + urlBuilder.setScheme(scheme); - final String scheme = methodParser.scheme(args); - urlBuilder.scheme(scheme); + final String host = methodParser.setHost(args); + urlBuilder.setHost(host); - final String host = methodParser.host(args); - urlBuilder.host(host); + // Set the path after host, concatenating the path + // segment in the host. + if (path != null && !path.isEmpty() && !path.equals("/")) { + String hostPath = urlBuilder.getPath(); + if (hostPath == null || hostPath.isEmpty() || hostPath.equals("/")) { + urlBuilder.setPath(path); + } else { + urlBuilder.setPath(hostPath + "/" + path); + } + } } - for (final EncodedParameter queryParameter : methodParser.encodedQueryParameters(args)) { - urlBuilder.setQueryParameter(queryParameter.name(), queryParameter.encodedValue()); + for (final EncodedParameter queryParameter : methodParser.setEncodedQueryParameters(args)) { + urlBuilder.setQueryParameter(queryParameter.getName(), queryParameter.getEncodedValue()); } final URL url = urlBuilder.toURL(); - final HttpRequest request = configRequest(new HttpRequest(methodParser.httpMethod(), url), methodParser, args); + final HttpRequest request = configRequest(new HttpRequest(methodParser.getHttpMethod(), url), + methodParser, args); // Headers from Swagger method arguments always take precedence over inferred headers from body types - for (final HttpHeader header : methodParser.headers(args)) { - request.header(header.name(), header.value()); + for (final HttpHeader header : methodParser.setHeaders(args)) { + request.setHeader(header.getName(), header.getValue()); } return request; @@ -231,24 +282,28 @@ private HttpRequest createHttpRequest(SwaggerMethodParser methodParser, Object[] * @return a HttpRequest * @throws IOException thrown if the body contents cannot be serialized */ - private HttpRequest createHttpRequest(OperationDescription operationDescription, SwaggerMethodParser methodParser, Object[] args) throws IOException { - final HttpRequest request = configRequest(new HttpRequest(methodParser.httpMethod(), operationDescription.url()), methodParser, args); + private HttpRequest createHttpRequest(OperationDescription operationDescription, SwaggerMethodParser methodParser, + Object[] args) throws IOException { + final HttpRequest request = + configRequest(new HttpRequest(methodParser.getHttpMethod(), operationDescription.getUrl()), + methodParser, args); // Headers from Swagger method arguments always take precedence over inferred headers from body types - for (final String headerName : operationDescription.headers().keySet()) { - request.header(headerName, operationDescription.headers().get(headerName)); + for (final String headerName : operationDescription.getHeaders().keySet()) { + request.setHeader(headerName, operationDescription.getHeaders().get(headerName)); } return request; } @SuppressWarnings("unchecked") - private HttpRequest configRequest(HttpRequest request, SwaggerMethodParser methodParser, Object[] args) throws IOException { - final Object bodyContentObject = methodParser.body(args); + private HttpRequest configRequest(HttpRequest request, SwaggerMethodParser methodParser, Object[] args) + throws IOException { + final Object bodyContentObject = methodParser.setBody(args); if (bodyContentObject == null) { - request.headers().put("Content-Length", "0"); + request.getHeaders().put("Content-Length", "0"); } else { - String contentType = methodParser.bodyContentType(); + String contentType = methodParser.getBodyContentType(); if (contentType == null || contentType.isEmpty()) { if (bodyContentObject instanceof byte[] || bodyContentObject instanceof String) { contentType = ContentType.APPLICATION_OCTET_STREAM; @@ -257,7 +312,7 @@ private HttpRequest configRequest(HttpRequest request, SwaggerMethodParser metho } } - request.headers().put("Content-Type", contentType); + request.getHeaders().put("Content-Type", contentType); boolean isJson = false; final String[] contentTypeParts = contentType.split(";"); @@ -270,55 +325,60 @@ private HttpRequest configRequest(HttpRequest request, SwaggerMethodParser metho if (isJson) { final String bodyContentString = serializer.serialize(bodyContentObject, SerializerEncoding.JSON); - request.body(bodyContentString); - } else if (FluxUtil.isFluxByteBuf(methodParser.bodyJavaType())) { - // Content-Length or Transfer-Encoding: chunked must be provided by a user-specified header when a Flowable is given for the body. + request.setBody(bodyContentString); + } else if (FluxUtil.isFluxByteBuffer(methodParser.getBodyJavaType())) { + // Content-Length or Transfer-Encoding: chunked must be provided by a user-specified header when a + // Flowable is given for the body. //noinspection ConstantConditions - request.body((Flux) bodyContentObject); + request.setBody((Flux) bodyContentObject); } else if (bodyContentObject instanceof byte[]) { - request.body((byte[]) bodyContentObject); + request.setBody((byte[]) bodyContentObject); } else if (bodyContentObject instanceof String) { final String bodyContentString = (String) bodyContentObject; if (!bodyContentString.isEmpty()) { - request.body(bodyContentString); + request.setBody(bodyContentString); } + } else if (bodyContentObject instanceof ByteBuffer) { + request.setBody(Flux.just((ByteBuffer) bodyContentObject)); } else { - final String bodyContentString = serializer.serialize(bodyContentObject, SerializerEncoding.fromHeaders(request.headers())); - request.body(bodyContentString); + final String bodyContentString = + serializer.serialize(bodyContentObject, SerializerEncoding.fromHeaders(request.getHeaders())); + request.setBody(bodyContentString); } } return request; } - private Mono ensureExpectedStatus(Mono asyncDecodedResponse, final SwaggerMethodParser methodParser) { + private Mono ensureExpectedStatus(Mono asyncDecodedResponse, + final SwaggerMethodParser methodParser) { return asyncDecodedResponse - .flatMap(decodedHttpResponse -> ensureExpectedStatus(decodedHttpResponse, methodParser, null)); + .flatMap(decodedHttpResponse -> ensureExpectedStatus(decodedHttpResponse, methodParser, null)); } private static Exception instantiateUnexpectedException(UnexpectedExceptionInformation exception, - HttpResponse httpResponse, - String responseContent, - Object responseDecodedContent) { - final int responseStatusCode = httpResponse.statusCode(); - String contentType = httpResponse.headerValue("Content-Type"); + HttpResponse httpResponse, String responseContent, Object responseDecodedContent) { + final int responseStatusCode = httpResponse.getStatusCode(); + String contentType = httpResponse.getHeaderValue("Content-Type"); String bodyRepresentation; if ("application/octet-stream".equalsIgnoreCase(contentType)) { - bodyRepresentation = "(" + httpResponse.headerValue("Content-Length") + "-byte body)"; + bodyRepresentation = "(" + httpResponse.getHeaderValue("Content-Length") + "-byte body)"; } else { bodyRepresentation = responseContent.isEmpty() ? "(empty body)" : "\"" + responseContent + "\""; } Exception result; try { - final Constructor exceptionConstructor = exception.exceptionType().getConstructor(String.class, HttpResponse.class, exception.exceptionBodyType()); + final Constructor exceptionConstructor = + exception.getExceptionType().getConstructor(String.class, HttpResponse.class, + exception.getExceptionBodyType()); result = exceptionConstructor.newInstance("Status code " + responseStatusCode + ", " + bodyRepresentation, - httpResponse, - responseDecodedContent); + httpResponse, + responseDecodedContent); } catch (ReflectiveOperationException e) { String message = "Status code " + responseStatusCode + ", but an instance of " - + exception.exceptionType().getCanonicalName() + " cannot be created." - + " Response body: " + bodyRepresentation; + + exception.getExceptionType().getCanonicalName() + " cannot be created." + + " Response body: " + bodyRepresentation; result = new IOException(message, e); } @@ -334,43 +394,51 @@ private static Exception instantiateUnexpectedException(UnexpectedExceptionInfor * * @param decodedResponse The HttpResponse to check. * @param methodParser The method parser that contains information about the service interface - * method that initiated the HTTP request. + * method that initiated the HTTP request. * @param additionalAllowedStatusCodes Additional allowed status codes that are permitted based - * on the context of the HTTP request. + * on the context of the HTTP request. * @return An async-version of the provided decodedResponse. */ - public Mono ensureExpectedStatus(final HttpDecodedResponse decodedResponse, final SwaggerMethodParser methodParser, int[] additionalAllowedStatusCodes) { - final int responseStatusCode = decodedResponse.sourceResponse().statusCode(); + public Mono ensureExpectedStatus(final HttpDecodedResponse decodedResponse, + final SwaggerMethodParser methodParser, int[] additionalAllowedStatusCodes) { + final int responseStatusCode = decodedResponse.getSourceResponse().getStatusCode(); final Mono asyncResult; if (!methodParser.isExpectedResponseStatusCode(responseStatusCode, additionalAllowedStatusCodes)) { - Mono bodyAsString = decodedResponse.sourceResponse().bodyAsString(); + Mono bodyAsString = decodedResponse.getSourceResponse().getBodyAsString(); // asyncResult = bodyAsString.flatMap((Function>) responseContent -> { // bodyAsString() emits non-empty string, now look for decoded version of same string - Mono decodedErrorBody = decodedResponse.decodedBody(); + Mono decodedErrorBody = decodedResponse.getDecodedBody(); // - return decodedErrorBody.flatMap((Function>) responseDecodedErrorObject -> { - // decodedBody() emits 'responseDecodedErrorObject' the successfully decoded exception body object - Throwable exception = instantiateUnexpectedException(methodParser.getUnexpectedException(responseStatusCode), - decodedResponse.sourceResponse(), - responseContent, - responseDecodedErrorObject); - return Mono.error(exception); - // - }).switchIfEmpty(Mono.defer((Supplier>) () -> { - // decodedBody() emits empty, indicate unable to decode 'responseContent', - // create exception with un-decodable content string and without exception body object. - Throwable exception = instantiateUnexpectedException(methodParser.getUnexpectedException(responseStatusCode), - decodedResponse.sourceResponse(), - responseContent, - null); - return Mono.error(exception); - // - })); + return decodedErrorBody + .flatMap((Function>) responseDecodedErrorObject -> { + // decodedBody() emits 'responseDecodedErrorObject' the successfully decoded exception + // body object + Throwable exception = + instantiateUnexpectedException(methodParser.getUnexpectedException(responseStatusCode), + decodedResponse.getSourceResponse(), + responseContent, + responseDecodedErrorObject); + return Mono.error(exception); + // + }) + .switchIfEmpty(Mono.defer((Supplier>) () -> { + // decodedBody() emits empty, indicate unable to decode 'responseContent', + // create exception with un-decodable content string and without exception body object. + Throwable exception = + instantiateUnexpectedException(methodParser.getUnexpectedException(responseStatusCode), + decodedResponse.getSourceResponse(), + responseContent, + null); + return Mono.error(exception); + // + })); }).switchIfEmpty(Mono.defer((Supplier>) () -> { - // bodyAsString() emits empty, indicate no body, create exception empty content string no exception body object. - Throwable exception = instantiateUnexpectedException(methodParser.getUnexpectedException(responseStatusCode), - decodedResponse.sourceResponse(), + // bodyAsString() emits empty, indicate no body, create exception empty content string no exception + // body object. + Throwable exception = + instantiateUnexpectedException(methodParser.getUnexpectedException(responseStatusCode), + decodedResponse.getSourceResponse(), "", null); return Mono.error(exception); @@ -382,19 +450,22 @@ public Mono ensureExpectedStatus(final HttpDecodedResponse return asyncResult; } - private Mono handleRestResponseReturnType(HttpDecodedResponse response, SwaggerMethodParser methodParser, Type entityType) { + private Mono handleRestResponseReturnType(HttpDecodedResponse response, SwaggerMethodParser methodParser, + Type entityType) { Mono asyncResult; if (TypeUtil.isTypeOrSubTypeOf(entityType, Response.class)) { Type bodyType = TypeUtil.getRestResponseBodyType(entityType); if (TypeUtil.isTypeOrSubTypeOf(bodyType, Void.class)) { - asyncResult = response.sourceResponse().body().ignoreElements() - .then(Mono.just(createResponse(response, entityType, null))); + asyncResult = response.getSourceResponse().getBody().ignoreElements() + .then(Mono.just(createResponse(response, entityType, null))); } else { asyncResult = handleBodyReturnType(response, methodParser, bodyType) - .map((Function>) bodyAsObject -> createResponse(response, entityType, bodyAsObject)) - .switchIfEmpty(Mono.defer((Supplier>>) () -> Mono.just(createResponse(response, entityType, null)))); + .map((Function>) bodyAsObject -> createResponse(response, entityType, + bodyAsObject)) + .switchIfEmpty(Mono.defer((Supplier>>) () -> Mono.just(createResponse(response, + entityType, null)))); } } else { // For now we're just throwing if the Maybe didn't emit a value. @@ -406,10 +477,10 @@ private Mono handleRestResponseReturnType(HttpDecodedResponse response, Swagg @SuppressWarnings("unchecked") private Response createResponse(HttpDecodedResponse response, Type entityType, Object bodyAsObject) { - final HttpResponse httpResponse = response.sourceResponse(); - final HttpRequest httpRequest = httpResponse.request(); - final int responseStatusCode = httpResponse.statusCode(); - final HttpHeaders responseHeaders = httpResponse.headers(); + final HttpResponse httpResponse = response.getSourceResponse(); + final HttpRequest httpRequest = httpResponse.getRequest(); + final int responseStatusCode = httpResponse.getStatusCode(); + final HttpHeaders responseHeaders = httpResponse.getHeaders(); // determine the type of response class. If the type is the 'RestResponse' interface, we will use the // 'RestResponseBase' class instead. @@ -420,7 +491,8 @@ private Response createResponse(HttpDecodedResponse response, Type entityType cls = (Class>) (Object) PagedResponseBase.class; if (bodyAsObject != null && !TypeUtil.isTypeOrSubTypeOf(bodyAsObject.getClass(), Page.class)) { - throw new RuntimeException("Unable to create PagedResponse. Body must be of a type that implements: " + Page.class); + throw logger.logExceptionAsError(new RuntimeException( + "Unable to create PagedResponse. Body must be of a type that implements: " + Page.class)); } } @@ -437,7 +509,7 @@ private Response createResponse(HttpDecodedResponse response, Type entityType .collect(Collectors.toList()); if (constructors.isEmpty()) { - throw new RuntimeException("Cannot find suitable constructor for class " + cls); + throw logger.logExceptionAsError(new RuntimeException("Cannot find suitable constructor for class " + cls)); } // try to create an instance using our list of potential candidates @@ -453,53 +525,61 @@ private Response createResponse(HttpDecodedResponse response, Type entityType case 4: return ctor.newInstance(httpRequest, responseStatusCode, responseHeaders, bodyAsObject); case 5: - return ctor.newInstance(httpRequest, responseStatusCode, responseHeaders, bodyAsObject, response.decodedHeaders().block()); + return ctor.newInstance(httpRequest, responseStatusCode, responseHeaders, bodyAsObject, + response.getDecodedHeaders().block()); default: - throw new IllegalStateException("Response constructor with expected parameters not found."); + throw logger.logExceptionAsError(new IllegalStateException( + "Response constructor with expected parameters not found.")); } } catch (IllegalAccessException | InvocationTargetException | InstantiationException e) { - throw reactor.core.Exceptions.propagate(e); + throw logger.logExceptionAsError(reactor.core.Exceptions.propagate(e)); } } // error - throw new RuntimeException("Cannot find suitable constructor for class " + cls); + throw logger.logExceptionAsError(new RuntimeException("Cannot find suitable constructor for class " + cls)); } - protected final Mono handleBodyReturnType(final HttpDecodedResponse response, final SwaggerMethodParser methodParser, final Type entityType) { - final int responseStatusCode = response.sourceResponse().statusCode(); - final HttpMethod httpMethod = methodParser.httpMethod(); - final Type returnValueWireType = methodParser.returnValueWireType(); + protected final Mono handleBodyReturnType(final HttpDecodedResponse response, + final SwaggerMethodParser methodParser, final Type entityType) { + final int responseStatusCode = response.getSourceResponse().getStatusCode(); + final HttpMethod httpMethod = methodParser.getHttpMethod(); + final Type returnValueWireType = methodParser.getReturnValueWireType(); final Mono asyncResult; if (httpMethod == HttpMethod.HEAD - && (TypeUtil.isTypeOrSubTypeOf(entityType, Boolean.TYPE) || TypeUtil.isTypeOrSubTypeOf(entityType, Boolean.class))) { + && (TypeUtil.isTypeOrSubTypeOf( + entityType, Boolean.TYPE) || TypeUtil.isTypeOrSubTypeOf(entityType, Boolean.class))) { boolean isSuccess = (responseStatusCode / 100) == 2; asyncResult = Mono.just(isSuccess); } else if (TypeUtil.isTypeOrSubTypeOf(entityType, byte[].class)) { // Mono - Mono responseBodyBytesAsync = response.sourceResponse().bodyAsByteArray(); + Mono responseBodyBytesAsync = response.getSourceResponse().getBodyAsByteArray(); if (returnValueWireType == Base64Url.class) { // Mono - responseBodyBytesAsync = responseBodyBytesAsync.map(base64UrlBytes -> new Base64Url(base64UrlBytes).decodedBytes()); + responseBodyBytesAsync = + responseBodyBytesAsync.map(base64UrlBytes -> new Base64Url(base64UrlBytes).decodedBytes()); } asyncResult = responseBodyBytesAsync; - } else if (FluxUtil.isFluxByteBuf(entityType)) { - // Mono> - asyncResult = Mono.just(response.sourceResponse().body()); + } else if (FluxUtil.isFluxByteBuffer(entityType)) { + // Mono> + asyncResult = Mono.just(response.getSourceResponse().getBody()); } else { // Mono or Mono> - asyncResult = response.decodedBody(); + asyncResult = response.getDecodedBody(); } return asyncResult; } - protected Object handleHttpResponse(final HttpRequest httpRequest, Mono asyncDecodedHttpResponse, SwaggerMethodParser methodParser, Type returnType, Context context) { + protected Object handleHttpResponse(final HttpRequest httpRequest, + Mono asyncDecodedHttpResponse, SwaggerMethodParser methodParser, Type returnType, + Context context) { return handleRestReturnType(asyncDecodedHttpResponse, methodParser, returnType, context); } - protected Object handleResumeOperation(HttpRequest httpRequest, OperationDescription operationDescription, SwaggerMethodParser methodParser, Type returnType, Context context) - throws Exception { - throw new Exception("The resume operation is not available in the base RestProxy class."); + protected Object handleResumeOperation(HttpRequest httpRequest, OperationDescription operationDescription, + SwaggerMethodParser methodParser, Type returnType, Context context) { + throw logger.logExceptionAsError(Exceptions.propagate(new Exception( + "The resume operation is not available in the base RestProxy class."))); } /** @@ -511,10 +591,12 @@ protected Object handleResumeOperation(HttpRequest httpRequest, OperationDescrip * @param context Additional context that is passed through the Http pipeline during the service call. * @return the deserialized result */ - public final Object handleRestReturnType(Mono asyncHttpDecodedResponse, final SwaggerMethodParser methodParser, final Type returnType, Context context) { - final Mono asyncExpectedResponse = ensureExpectedStatus(asyncHttpDecodedResponse, methodParser) - .doOnEach(RestProxy::endTracingSpan) - .subscriberContext(reactor.util.context.Context.of("TRACING_CONTEXT", context)); + public final Object handleRestReturnType(Mono asyncHttpDecodedResponse, + final SwaggerMethodParser methodParser, final Type returnType, Context context) { + final Mono asyncExpectedResponse = + ensureExpectedStatus(asyncHttpDecodedResponse, methodParser) + .doOnEach(RestProxy::endTracingSpan) + .subscriberContext(reactor.util.context.Context.of("TRACING_CONTEXT", context)); final Object result; if (TypeUtil.isTypeOrSubTypeOf(returnType, Mono.class)) { @@ -525,12 +607,13 @@ public final Object handleRestReturnType(Mono asyncHttpDeco } else { // ProxyMethod ReturnType: Mono> result = asyncExpectedResponse.flatMap(response -> - handleRestResponseReturnType(response, methodParser, monoTypeParam)); + handleRestResponseReturnType(response, methodParser, monoTypeParam)); } - } else if (FluxUtil.isFluxByteBuf(returnType)) { - // ProxyMethod ReturnType: Flux - result = asyncExpectedResponse.flatMapMany(ar -> ar.sourceResponse().body()); - } else if (TypeUtil.isTypeOrSubTypeOf(returnType, void.class) || TypeUtil.isTypeOrSubTypeOf(returnType, Void.class)) { + } else if (FluxUtil.isFluxByteBuffer(returnType)) { + // ProxyMethod ReturnType: Flux + result = asyncExpectedResponse.flatMapMany(ar -> ar.getSourceResponse().getBody()); + } else if (TypeUtil.isTypeOrSubTypeOf(returnType, void.class) || TypeUtil.isTypeOrSubTypeOf(returnType, + Void.class)) { // ProxyMethod ReturnType: Void asyncExpectedResponse.block(); result = null; @@ -538,8 +621,8 @@ public final Object handleRestReturnType(Mono asyncHttpDeco // ProxyMethod ReturnType: T where T != async (Mono, Flux) or sync Void // Block the deserialization until a value T is received result = asyncExpectedResponse - .flatMap(httpResponse -> handleRestResponseReturnType(httpResponse, methodParser, returnType)) - .block(); + .flatMap(httpResponse -> handleRestResponseReturnType(httpResponse, methodParser, returnType)) + .block(); } return result; } @@ -567,7 +650,7 @@ private static void endTracingSpan(Signal signal) { // On next contains the response information. if (signal.hasValue()) { httpDecodedResponse = signal.get(); - statusCode = httpDecodedResponse.sourceResponse().statusCode(); + statusCode = httpDecodedResponse.getSourceResponse().getStatusCode(); } else if (signal.hasError()) { // The last status available is on error, this contains the error thrown by the REST response. throwable = signal.getThrowable(); @@ -575,7 +658,7 @@ private static void endTracingSpan(Signal signal) { // Only HttpResponseException contain a status code, this is the base REST response. if (throwable instanceof HttpResponseException) { HttpResponseException exception = (HttpResponseException) throwable; - statusCode = exception.response().statusCode(); + statusCode = exception.getResponse().getStatusCode(); } } @@ -613,7 +696,7 @@ public static HttpPipeline createDefaultPipeline(TokenCredential credentials) { /** * Create the default HttpPipeline. * @param credentialsPolicy the credentials policy factory to use to apply authentication to the - * pipeline + * pipeline * @return the default HttpPipeline */ public static HttpPipeline createDefaultPipeline(HttpPipelinePolicy credentialsPolicy) { @@ -658,9 +741,9 @@ public static A create(Class swaggerInterface, HttpPipeline httpPipeline) * * @param swaggerInterface the Swagger interface to provide a proxy implementation for * @param httpPipeline the HttpPipelinePolicy and HttpClient pipline that will be used to send Http - * requests + * requests * @param serializer the serializer that will be used to convert POJOs to and from request and - * response bodies + * response bodies * @param the type of the Swagger interface. * @return a proxy implementation of the provided Swagger interface */ @@ -668,6 +751,7 @@ public static A create(Class swaggerInterface, HttpPipeline httpPipeline) public static A create(Class swaggerInterface, HttpPipeline httpPipeline, SerializerAdapter serializer) { final SwaggerInterfaceParser interfaceParser = new SwaggerInterfaceParser(swaggerInterface, serializer); final RestProxy restProxy = new RestProxy(httpPipeline, serializer, interfaceParser); - return (A) Proxy.newProxyInstance(swaggerInterface.getClassLoader(), new Class[]{swaggerInterface}, restProxy); + return (A) Proxy.newProxyInstance(swaggerInterface.getClassLoader(), new Class[]{swaggerInterface}, + restProxy); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/Substitution.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/Substitution.java index 6460da800251..42c9d9f88cb7 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/Substitution.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/Substitution.java @@ -32,7 +32,7 @@ class Substitution { * Get the placeholder's name. * @return The name of the placeholder. */ - public String urlParameterName() { + public String getUrlParameterName() { return urlParameterName; } @@ -40,7 +40,7 @@ public String urlParameterName() { * Get the index of the method parameter where the replacement value is. * @return The index of the method parameter where the replacement value is. */ - public int methodParameterIndex() { + public int getMethodParameterIndex() { return methodParameterIndex; } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/SwaggerInterfaceParser.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/SwaggerInterfaceParser.java index 8edbdad06a78..23e45d3276ba 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/SwaggerInterfaceParser.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/SwaggerInterfaceParser.java @@ -66,10 +66,10 @@ public SwaggerInterfaceParser(Class swaggerInterface, SerializerAdapter seria * @param swaggerMethod the method to generate a parser for * @return the SwaggerMethodParser associated with the provided swaggerMethod */ - public SwaggerMethodParser methodParser(Method swaggerMethod) { + public SwaggerMethodParser getMethodParser(Method swaggerMethod) { SwaggerMethodParser result = methodParsers.get(swaggerMethod); if (result == null) { - result = new SwaggerMethodParser(swaggerMethod, host()); + result = new SwaggerMethodParser(swaggerMethod, getHost()); methodParsers.put(swaggerMethod, result); } return result; @@ -80,11 +80,11 @@ public SwaggerMethodParser methodParser(Method swaggerMethod) { * calls. This value is retrieved from the @Host annotation placed on the Swagger interface. * @return The value of the @Host annotation. */ - String host() { + String getHost() { return host; } - String serviceName() { + String getServiceName() { return serviceName; } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/SwaggerMethodParser.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/SwaggerMethodParser.java index 1fd98ca0298c..75d018b98f84 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/SwaggerMethodParser.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/SwaggerMethodParser.java @@ -77,9 +77,8 @@ public class SwaggerMethodParser implements HttpResponseDecodeData { * Create a SwaggerMethodParser object using the provided fully qualified method name. * * @param swaggerMethod the Swagger method to parse. - * @param rawHost the raw host value from the @Host annotation. Before this can be used as the - * host value in an HTTP request, it must be processed through the possible host - * substitutions. + * @param rawHost the raw host value from the @Host annotation. Before this can be used as the host value in an HTTP + * request, it must be processed through the possible host substitutions. */ SwaggerMethodParser(Method swaggerMethod, String rawHost) { this.serializer = JacksonAdapter.createDefaultSerializerAdapter(); @@ -114,10 +113,13 @@ public class SwaggerMethodParser implements HttpResponseDecodeData { returnType = swaggerMethod.getGenericReturnType(); - final ReturnValueWireType returnValueWireTypeAnnotation = swaggerMethod.getAnnotation(ReturnValueWireType.class); + final ReturnValueWireType returnValueWireTypeAnnotation = + swaggerMethod.getAnnotation(ReturnValueWireType.class); if (returnValueWireTypeAnnotation != null) { Class returnValueWireType = returnValueWireTypeAnnotation.value(); - if (returnValueWireType == Base64Url.class || returnValueWireType == UnixTime.class || returnValueWireType == DateTimeRfc1123.class) { + if (returnValueWireType == Base64Url.class + || returnValueWireType == UnixTime.class + || returnValueWireType == DateTimeRfc1123.class) { this.returnValueWireType = returnValueWireType; } else if (TypeUtil.isTypeOrSubTypeOf(returnValueWireType, List.class)) { this.returnValueWireType = returnValueWireType.getGenericInterfaces()[0]; @@ -157,13 +159,16 @@ public class SwaggerMethodParser implements HttpResponseDecodeData { final Class annotationType = annotation.annotationType(); if (annotationType.equals(HostParam.class)) { final HostParam hostParamAnnotation = (HostParam) annotation; - hostSubstitutions.add(new Substitution(hostParamAnnotation.value(), parameterIndex, !hostParamAnnotation.encoded())); + hostSubstitutions.add(new Substitution(hostParamAnnotation.value(), parameterIndex, + !hostParamAnnotation.encoded())); } else if (annotationType.equals(PathParam.class)) { final PathParam pathParamAnnotation = (PathParam) annotation; - pathSubstitutions.add(new Substitution(pathParamAnnotation.value(), parameterIndex, !pathParamAnnotation.encoded())); + pathSubstitutions.add(new Substitution(pathParamAnnotation.value(), parameterIndex, + !pathParamAnnotation.encoded())); } else if (annotationType.equals(QueryParam.class)) { final QueryParam queryParamAnnotation = (QueryParam) annotation; - querySubstitutions.add(new Substitution(queryParamAnnotation.value(), parameterIndex, !queryParamAnnotation.encoded())); + querySubstitutions.add(new Substitution(queryParamAnnotation.value(), parameterIndex, + !queryParamAnnotation.encoded())); } else if (annotationType.equals(HeaderParam.class)) { final HeaderParam headerParamAnnotation = (HeaderParam) annotation; headerSubstitutions.add(new Substitution(headerParamAnnotation.value(), parameterIndex, false)); @@ -174,7 +179,8 @@ public class SwaggerMethodParser implements HttpResponseDecodeData { bodyJavaType = swaggerMethod.getGenericParameterTypes()[parameterIndex]; } else if (annotationType.equals(FormParam.class)) { final FormParam formParamAnnotation = (FormParam) annotation; - formSubstitutions.add(new Substitution(formParamAnnotation.value(), parameterIndex, !formParamAnnotation.encoded())); + formSubstitutions.add(new Substitution(formParamAnnotation.value(), parameterIndex, + !formParamAnnotation.encoded())); bodyContentType = ContentType.APPLICATION_X_WWW_FORM_URLENCODED; bodyJavaType = String.class; } @@ -187,7 +193,7 @@ public class SwaggerMethodParser implements HttpResponseDecodeData { * * @return the fully qualified method that was called to invoke this HTTP request */ - public String fullyQualifiedMethodName() { + public String getFullyQualifiedMethodName() { return fullyQualifiedMethodName; } @@ -196,20 +202,19 @@ public String fullyQualifiedMethodName() { * * @return the HTTP method that will be used to complete the Swagger method's request */ - public HttpMethod httpMethod() { + public HttpMethod getHttpMethod() { return httpMethod; } /** - * Get the HTTP response status codes that are expected when a request is sent out for this - * Swagger method. If the returned int[] is null, then all status codes less than 400 are - * allowed. + * Get the HTTP response status codes that are expected when a request is sent out for this Swagger method. If the + * returned int[] is null, then all status codes less than 400 are allowed. * - * @return the expected HTTP response status codes for this Swagger method or null if all status - * codes less than 400 are allowed. + * @return the expected HTTP response status codes for this Swagger method or null if all status codes less than 400 + * are allowed. */ @Override - public int[] expectedStatusCodes() { + public int[] getExpectedStatusCodes() { return ImplUtils.clone(expectedStatusCodes); } @@ -219,8 +224,9 @@ public int[] expectedStatusCodes() { * @param swaggerMethodArguments the arguments to use for scheme/host substitutions. * @return the final host to use for HTTP requests for this Swagger method. */ - public String scheme(Object[] swaggerMethodArguments) { - final String substitutedHost = applySubstitutions(rawHost, hostSubstitutions, swaggerMethodArguments, UrlEscapers.PATH_ESCAPER); + public String setScheme(Object[] swaggerMethodArguments) { + final String substitutedHost = + applySubstitutions(rawHost, hostSubstitutions, swaggerMethodArguments, UrlEscapers.PATH_ESCAPER); final String[] substitutedHostParts = substitutedHost.split("://"); return substitutedHostParts.length < 1 ? null : substitutedHostParts[0]; } @@ -231,8 +237,9 @@ public String scheme(Object[] swaggerMethodArguments) { * @param swaggerMethodArguments the arguments to use for host substitutions * @return the final host to use for HTTP requests for this Swagger method */ - public String host(Object[] swaggerMethodArguments) { - final String substitutedHost = applySubstitutions(rawHost, hostSubstitutions, swaggerMethodArguments, UrlEscapers.PATH_ESCAPER); + public String setHost(Object[] swaggerMethodArguments) { + final String substitutedHost = + applySubstitutions(rawHost, hostSubstitutions, swaggerMethodArguments, UrlEscapers.PATH_ESCAPER); final String[] substitutedHostParts = substitutedHost.split("://"); return substitutedHostParts.length < 2 ? substitutedHost : substitutedHost.split("://")[1]; } @@ -243,7 +250,7 @@ public String host(Object[] swaggerMethodArguments) { * @param methodArguments the method arguments to use with the path substitutions * @return the path value with its placeholders replaced by the matching substitutions */ - public String path(Object[] methodArguments) { + public String setPath(Object[] methodArguments) { return applySubstitutions(relativePath, pathSubstitutions, methodArguments, UrlEscapers.PATH_ESCAPER); } @@ -251,11 +258,10 @@ public String path(Object[] methodArguments) { * Get the encoded query parameters that have been added to this value based on the provided * method arguments. * - * @param swaggerMethodArguments the arguments that will be used to create the query parameters' - * values + * @param swaggerMethodArguments the arguments that will be used to create the query parameters' values * @return an Iterable with the encoded query parameters */ - public Iterable encodedQueryParameters(Object[] swaggerMethodArguments) { + public Iterable setEncodedQueryParameters(Object[] swaggerMethodArguments) { return encodeParameters(swaggerMethodArguments, querySubstitutions); } @@ -263,32 +269,31 @@ public Iterable encodedQueryParameters(Object[] swaggerMethodA * Get the encoded form parameters that have been added to this value based on the provided * method arguments. * - * @param swaggerMethodArguments the arguments that will be used to create the form parameters' - * values + * @param swaggerMethodArguments the arguments that will be used to create the form parameters' values * @return an Iterable with the encoded form parameters */ - public Iterable encodedFormParameters(Object[] swaggerMethodArguments) { + public Iterable setEncodedFormParameters(Object[] swaggerMethodArguments) { return encodeParameters(swaggerMethodArguments, formSubstitutions); } private Iterable encodeParameters(Object[] swaggerMethodArguments, - List substitutions) { + List substitutions) { if (substitutions == null) { return Collections.emptyList(); } - + final List result = new ArrayList<>(); final PercentEscaper escaper = UrlEscapers.QUERY_ESCAPER; for (Substitution substitution : substitutions) { - final int parameterIndex = substitution.methodParameterIndex(); + final int parameterIndex = substitution.getMethodParameterIndex(); if (0 <= parameterIndex && parameterIndex < swaggerMethodArguments.length) { - final Object methodArgument = swaggerMethodArguments[substitution.methodParameterIndex()]; + final Object methodArgument = swaggerMethodArguments[substitution.getMethodParameterIndex()]; String parameterValue = serialize(methodArgument); if (parameterValue != null) { if (substitution.shouldEncode() && escaper != null) { parameterValue = escaper.escape(parameterValue); } - result.add(new EncodedParameter(substitution.urlParameterName(), parameterValue)); + result.add(new EncodedParameter(substitution.getUrlParameterName(), parameterValue)); } } } @@ -300,25 +305,25 @@ private Iterable encodeParameters(Object[] swaggerMethodArgume * @param swaggerMethodArguments The arguments that will be used to create the headers' values. * @return An Iterable with the headers. */ - public Iterable headers(Object[] swaggerMethodArguments) { + public Iterable setHeaders(Object[] swaggerMethodArguments) { final HttpHeaders result = new HttpHeaders(headers); if (headerSubstitutions != null) { for (Substitution headerSubstitution : headerSubstitutions) { - final int parameterIndex = headerSubstitution.methodParameterIndex(); + final int parameterIndex = headerSubstitution.getMethodParameterIndex(); if (0 <= parameterIndex && parameterIndex < swaggerMethodArguments.length) { - final Object methodArgument = swaggerMethodArguments[headerSubstitution.methodParameterIndex()]; + final Object methodArgument = swaggerMethodArguments[headerSubstitution.getMethodParameterIndex()]; if (methodArgument instanceof Map) { - @SuppressWarnings("unchecked") - final Map headerCollection = (Map) methodArgument; - final String headerCollectionPrefix = headerSubstitution.urlParameterName(); + @SuppressWarnings("unchecked") final Map headerCollection = + (Map) methodArgument; + final String headerCollectionPrefix = headerSubstitution.getUrlParameterName(); for (final Map.Entry headerCollectionEntry : headerCollection.entrySet()) { final String headerName = headerCollectionPrefix + headerCollectionEntry.getKey(); final String headerValue = serialize(headerCollectionEntry.getValue()); result.put(headerName, headerValue); } } else { - final String headerName = headerSubstitution.urlParameterName(); + final String headerName = headerSubstitution.getUrlParameterName(); final String headerValue = serialize(methodArgument); result.put(headerName, headerValue); } @@ -334,7 +339,7 @@ public Iterable headers(Object[] swaggerMethodArguments) { * @param swaggerMethodArguments the arguments passed to the proxy method * @return the context, or {@link Context#NONE} if no context was provided */ - public Context context(Object[] swaggerMethodArguments) { + public Context setContext(Object[] swaggerMethodArguments) { Context context = ImplUtils.findFirstOfType(swaggerMethodArguments, Context.class); return (context != null) ? context : Context.NONE; @@ -345,11 +350,10 @@ public Context context(Object[] swaggerMethodArguments) { * this Swagger method. * * @param responseStatusCode the status code that was returned in the HTTP response - * @param additionalAllowedStatusCodes an additional set of allowed status codes that will be - * merged with the existing set of allowed status codes for - * this query - * @return whether or not the provided response status code is one of the expected status codes - * for this Swagger method + * @param additionalAllowedStatusCodes an additional set of allowed status codes that will be merged with the + * existing set of allowed status codes for this query + * @return whether or not the provided response status code is one of the expected status codes for this Swagger + * method */ public boolean isExpectedResponseStatusCode(int responseStatusCode, int[] additionalAllowedStatusCodes) { boolean result; @@ -358,7 +362,7 @@ public boolean isExpectedResponseStatusCode(int responseStatusCode, int[] additi result = (responseStatusCode < 400); } else { result = contains(expectedStatusCodes, responseStatusCode) - || contains(additionalAllowedStatusCodes, responseStatusCode); + || contains(additionalAllowedStatusCodes, responseStatusCode); } return result; @@ -380,10 +384,11 @@ private static boolean contains(int[] values, int searchValue) { } /** - * Get the {@link UnexpectedExceptionInformation} that will be used to generate a RestException if the HTTP response status - * code is not one of the expected status codes. + * Get the {@link UnexpectedExceptionInformation} that will be used to generate a RestException if the HTTP response + * status code is not one of the expected status codes. * - * If an UnexpectedExceptionInformation is not found for the status code the default UnexpectedExceptionInformation will be returned. + * If an UnexpectedExceptionInformation is not found for the status code the default UnexpectedExceptionInformation + * will be returned. * * @param code Exception HTTP status code return from a REST API. * @return the UnexpectedExceptionInformation to generate an exception to throw or return. @@ -403,21 +408,22 @@ public UnexpectedExceptionInformation getUnexpectedException(int code) { * @param swaggerMethodArguments the method arguments to get the value object from * @return the object that will be used as the body of the HTTP request */ - public Object body(Object[] swaggerMethodArguments) { + public Object setBody(Object[] swaggerMethodArguments) { Object result = null; if (bodyContentMethodParameterIndex != null - && swaggerMethodArguments != null - && 0 <= bodyContentMethodParameterIndex - && bodyContentMethodParameterIndex < swaggerMethodArguments.length) { + && swaggerMethodArguments != null + && 0 <= bodyContentMethodParameterIndex + && bodyContentMethodParameterIndex < swaggerMethodArguments.length) { result = swaggerMethodArguments[bodyContentMethodParameterIndex]; } if (formSubstitutions != null - && !formSubstitutions.isEmpty() - && swaggerMethodArguments != null) { + && !formSubstitutions.isEmpty() + && swaggerMethodArguments != null) { result = formSubstitutions.stream() - .map(s -> serializeFormData(s.urlParameterName(), swaggerMethodArguments[s.methodParameterIndex()])) + .map(s -> serializeFormData(s.getUrlParameterName(), + swaggerMethodArguments[s.getMethodParameterIndex()])) .collect(Collectors.joining("&")); } @@ -429,7 +435,7 @@ public Object body(Object[] swaggerMethodArguments) { * * @return the Content-Type of the body of this Swagger method */ - public String bodyContentType() { + public String getBodyContentType() { return bodyContentType; } @@ -439,7 +445,7 @@ public String bodyContentType() { * @return the return type for the method that this object describes. */ @Override - public Type returnType() { + public Type getReturnType() { return returnType; } @@ -449,7 +455,7 @@ public Type returnType() { * * @return the return type of the body parameter to this method */ - public Type bodyJavaType() { + public Type getBodyJavaType() { return bodyJavaType; } @@ -461,7 +467,7 @@ public Type bodyJavaType() { * @return the type that the raw HTTP response body will be sent as */ @Override - public Type returnValueWireType() { + public Type getReturnValueWireType() { return returnValueWireType; } @@ -475,13 +481,16 @@ public boolean expectsResponseBody() { if (TypeUtil.isTypeOrSubTypeOf(returnType, Void.class)) { result = false; - } else if (TypeUtil.isTypeOrSubTypeOf(returnType, Mono.class) || TypeUtil.isTypeOrSubTypeOf(returnType, Flux.class)) { + } else if (TypeUtil.isTypeOrSubTypeOf(returnType, Mono.class) + || TypeUtil.isTypeOrSubTypeOf(returnType, Flux.class)) { final ParameterizedType asyncReturnType = (ParameterizedType) returnType; final Type syncReturnType = asyncReturnType.getActualTypeArguments()[0]; if (TypeUtil.isTypeOrSubTypeOf(syncReturnType, Void.class)) { result = false; } else if (TypeUtil.isTypeOrSubTypeOf(syncReturnType, Response.class)) { - result = TypeUtil.restResponseTypeExpectsBody((ParameterizedType) TypeUtil.getSuperType(syncReturnType, Response.class)); + result = + TypeUtil.restResponseTypeExpectsBody((ParameterizedType) TypeUtil.getSuperType(syncReturnType, + Response.class)); } } else if (TypeUtil.isTypeOrSubTypeOf(returnType, Response.class)) { result = TypeUtil.restResponseTypeExpectsBody((ParameterizedType) returnType); @@ -495,8 +504,7 @@ public boolean expectsResponseBody() { * request. * * @param httpMethod the HTTP method that will be used to complete the Swagger method's request - * @param relativePath the path in the URL that will be used to complete the Swagger method's - * request + * @param relativePath the path in the URL that will be used to complete the Swagger method's request */ private void setHttpMethodAndRelativePath(HttpMethod httpMethod, String relativePath) { this.httpMethod = httpMethod; @@ -529,22 +537,28 @@ private String serializeFormData(String key, Object value) { return result; } - private String applySubstitutions(String originalValue, Iterable substitutions, Object[] methodArguments, PercentEscaper escaper) { + private String applySubstitutions(String originalValue, Iterable substitutions, + Object[] methodArguments, PercentEscaper escaper) { String result = originalValue; if (methodArguments != null) { for (Substitution substitution : substitutions) { - final int substitutionParameterIndex = substitution.methodParameterIndex(); + final int substitutionParameterIndex = substitution.getMethodParameterIndex(); if (0 <= substitutionParameterIndex && substitutionParameterIndex < methodArguments.length) { final Object methodArgument = methodArguments[substitutionParameterIndex]; String substitutionValue = serialize(methodArgument); - if (substitutionValue != null && !substitutionValue.isEmpty() && substitution.shouldEncode() && escaper != null) { + if (substitutionValue != null + && !substitutionValue.isEmpty() + && substitution.shouldEncode() && escaper != null) { substitutionValue = escaper.escape(substitutionValue); } - if (substitutionValue != null) { - result = result.replace("{" + substitution.urlParameterName() + "}", substitutionValue); + // if a parameter is null, we treat it as empty string. This is + // assuming no {...} will be allowed otherwise in a path template + if (substitutionValue == null) { + substitutionValue = ""; } + result = result.replace("{" + substitution.getUrlParameterName() + "}", substitutionValue); } } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/UnexpectedExceptionInformation.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/UnexpectedExceptionInformation.java index ce482df4f7f0..be6764509517 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/UnexpectedExceptionInformation.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/UnexpectedExceptionInformation.java @@ -12,7 +12,7 @@ * an error status code. */ public class UnexpectedExceptionInformation { - private static final String EXCEPTION_BODY_METHOD = "value"; + private static final String EXCEPTION_BODY_METHOD = "getValue"; private Class exceptionType; private Class exceptionBodyType; @@ -35,14 +35,14 @@ public UnexpectedExceptionInformation(Class exc /** * @return the exception type. */ - public Class exceptionType() { + public Class getExceptionType() { return exceptionType; } /** * @return the exception's response body. */ - public Class exceptionBodyType() { + public Class getExceptionBodyType() { return exceptionBodyType; } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/UnixTime.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/UnixTime.java index a34f80ea6824..400204e9a8e3 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/UnixTime.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/UnixTime.java @@ -8,7 +8,8 @@ import java.time.ZoneOffset; /** - * A wrapper over java.time.OffsetDateTime used for specifying unix seconds format during serialization and deserialization. + * A wrapper over java.time.OffsetDateTime used for specifying unix seconds format during serialization and + * deserialization. */ public final class UnixTime { /** @@ -39,7 +40,7 @@ public UnixTime(long unixSeconds) { * * @return The underlying DateTime */ - public OffsetDateTime dateTime() { + public OffsetDateTime getDateTime() { if (this.dateTime == null) { return null; } @@ -67,6 +68,6 @@ public boolean equals(Object obj) { } UnixTime rhs = (UnixTime) obj; - return this.dateTime.equals(rhs.dateTime()); + return this.dateTime.equals(rhs.getDateTime()); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Beta.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Beta.java index 3b35b9c79cb8..9b8814fa3f1e 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Beta.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Beta.java @@ -22,8 +22,9 @@ @Target({ TYPE, METHOD, PARAMETER, CONSTRUCTOR }) @Inherited /** - * Indicates functionality that is in preview and as such is subject to change in non-backwards compatible ways in future releases, - * including removal, regardless of any compatibility expectations set by the containing library version. + * Indicates functionality that is in preview and as such is subject to change in non-backwards compatible ways in + * future releases, including removal, regardless of any compatibility expectations set by the containing library + * version. * * Examples: * @@ -34,7 +35,8 @@ */ public @interface Beta { /** - * @return the free-form value for the annotation (used if details cannot be provided using since and reason attributes). + * @return the free-form value for the annotation (used if details cannot be provided using since and reason + * attributes). */ String value() default ""; @@ -51,5 +53,7 @@ /** * @return the warning message. */ - String warningText() default "This functionality is in preview and as such is subject to change in non-backwards compatible ways in future releases, including removal, regardless of any compatibility expectations set by the containing library version."; + String warningText() default "This functionality is in preview and as such is subject to change in non-backwards " + + "compatible ways in future releases, including removal, regardless of any compatibility expectations set by" + + " the containing library version."; } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/BodyParam.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/BodyParam.java index 099fbf0b0c4e..1d1efc739a0c 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/BodyParam.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/BodyParam.java @@ -12,15 +12,18 @@ /** * Annotation to annotate a parameter to send to a REST endpoint as HTTP Request content. * - *

If the parameter type extends InputStream, this payload is streamed to server through "application/octet-stream". - * Otherwise, the body is serialized first and sent as "application/json" or "application/xml", based on the serializer. + *

If the parameter type extends InputStream, this payload is streamed to server through + * "application/octet-stream". Otherwise, the body is serialized first and sent as "application/json" or + * "application/xml", based on the serializer. *

* *

Example 1: Put JSON

* *
- * {@literal @}PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}")
- *  VirtualMachine createOrUpdate(@PathParam("resourceGroupName") String rgName, @PathParam("vmName") String vmName, @PathParam("subscriptionId") String subscriptionId, @BodyParam("application/json") VirtualMachine vm);
+ * {@literal @}PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/ + * Microsoft.Compute/virtualMachines/{vmName}") + * VirtualMachine createOrUpdate(@PathParam("resourceGroupName") String rgName, @PathParam("vmName") String + * vmName, @PathParam("subscriptionId") String subscriptionId, @BodyParam("application/json") VirtualMachine vm); * *

Example 2: Stream

* diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Delete.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Delete.java index 8763fc23da0a..934e137ee230 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Delete.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Delete.java @@ -17,14 +17,17 @@ *

Example 1: Relative path segments

* *
- * {@literal @}Delete("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}")
- *  void delete(@PathParam("resourceGroupName") String rgName, @PathParam("vmName") String vmName, @PathParam("subscriptionId") String subscriptionId);
+ * {@literal @}Delete("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft + * .Compute/virtualMachines/{vmName}") + * void delete(@PathParam("resourceGroupName") String rgName, @PathParam("vmName") String vmName, @PathParam + * ("subscriptionId") String subscriptionId); * *

Example 2: Absolute path segment

* *
  * {@literal @}Delete({vaultBaseUrl}/secrets/{secretName})
- *  void delete(@PathParam("vaultBaseUrl" encoded = true) String vaultBaseUrl, @PathParam("secretName") String secretName);
+ * void delete(@PathParam("vaultBaseUrl" encoded = true) String vaultBaseUrl, @PathParam("secretName") String + * secretName); */ @Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/ExpectedResponses.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/ExpectedResponses.java index f8f532a51c4d..35a2941f27ba 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/ExpectedResponses.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/ExpectedResponses.java @@ -16,8 +16,10 @@ * *
  * {@literal @}ExpectedResponses({200, 201})
- * {@literal @}POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/images/getEntityTypeImageUploadUrl")
- *  void getUploadUrlForEntityType(@Path("resourceGroupName") String resourceGroupName, @Path("hubName") String hubName, @Path("subscriptionId") String subscriptionId, @Body GetImageUploadUrlInputInner parameters);
+ * {@literal @}POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft + * .CustomerInsights/hubs/{hubName}/images/getEntityTypeImageUploadUrl") + * void getUploadUrlForEntityType(@Path("resourceGroupName") String resourceGroupName, @Path("hubName") String + * hubName, @Path("subscriptionId") String subscriptionId, @Body GetImageUploadUrlInputInner parameters); */ @Retention(RUNTIME) @Target(METHOD) diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Fluent.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Fluent.java index ad97642d5fc5..879aaea3d542 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Fluent.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Fluent.java @@ -10,9 +10,9 @@ import static java.lang.annotation.ElementType.TYPE; /** - * Annotation given to all classes that are expected to provide a fluent API to end users. If a class has this annotation, - * checks can be made to ensure all API meets this expectation. Similarly, classes that are not annotated with this - * annotation should not have fluent APIs. + * Annotation given to all classes that are expected to provide a fluent API to end users. If a class has this + * annotation, checks can be made to ensure all API meets this expectation. Similarly, classes that are not annotated + * with this annotation should not have fluent APIs. */ @Target({TYPE}) @Retention(RetentionPolicy.SOURCE) diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/FormParam.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/FormParam.java index 39b9e127b55f..7890075cdf27 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/FormParam.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/FormParam.java @@ -16,10 +16,10 @@ * *
  * {@literal @}POST("spellcheck")
- * {@literal Observable>} spellChecker(@Header("X-BingApis-SDK") String xBingApisSDK, @Query("UserId") String userId, @FormParam("Text") String text);
+ * {@literal Observable>} spellChecker(@Header("X-BingApis-SDK") String xBingApisSDK, @Query + * ("UserId") String userId, @FormParam("Text") String text); * *

The value of parameter text will be encoded and encoded value will be added to the form data sent to the API.

- * */ @Retention(RUNTIME) @Target(PARAMETER) diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Get.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Get.java index f367d9a0c3f6..3784b46afa88 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Get.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Get.java @@ -17,8 +17,10 @@ *

Example 1: Relative path segments

* *
- * {@literal @}Get("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}")
- *  VirtualMachine getByResourceGroup(@PathParam("resourceGroupName") String rgName, @PathParam("vmName") String vmName, @PathParam("subscriptionId") String subscriptionId);
+ * {@literal @}Get("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft + * .Compute/virtualMachines/{vmName}") + * VirtualMachine getByResourceGroup(@PathParam("resourceGroupName") String rgName, @PathParam("vmName") String + * vmName, @PathParam("subscriptionId") String subscriptionId); * *

Example 2: Absolute path segment

* diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Head.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Head.java index 70352ca05e68..bcba4c9d7b8d 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Head.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Head.java @@ -17,8 +17,10 @@ *

Example 1: Relative path segments

* *
- * {@literal @}Head("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}")
- *  boolean checkNameAvailability(@PathParam("resourceGroupName") String rgName, @PathParam("vmName") String vmName, @PathParam("subscriptionId") String subscriptionId);
+ * {@literal @}Head("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft + * .Compute/virtualMachines/{vmName}") + * boolean checkNameAvailability(@PathParam("resourceGroupName") String rgName, @PathParam("vmName") String + * vmName, @PathParam("subscriptionId") String subscriptionId); * *

Example 2: Absolute path segment

* diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/HeaderParam.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/HeaderParam.java index 9977b63d7c91..20e729dc4ddf 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/HeaderParam.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/HeaderParam.java @@ -19,7 +19,8 @@ * *
  * {@code @PUT("{functionId}")}
- * {@code Mono>} createOrReplace(@PathParam("functionId", encoded = true) String functionId, @BodyParam FunctionInner function, @HeaderParam("If-Match") String ifMatch);
+ * {@code Mono>} createOrReplace(@PathParam("functionId", encoded = true) String + * functionId, @BodyParam FunctionInner function, @HeaderParam("If-Match") String ifMatch); * *

"If-Match: user passed value" will show up as one of the headers.

* @@ -27,7 +28,8 @@ * *
  * {@code @}GET("subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces")
- * {@code Mono>} list(@Path("subscriptionId") String subscriptionId, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
+ * {@code Mono>} list(@Path("subscriptionId") String subscriptionId, @Header + * ("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); * *

"accept-language" generated by the HTTP client will be overwritten by the user passed value.

* @@ -35,7 +37,8 @@ * *
  * {@code @GET("subscriptions/{subscriptionId}/providers/Microsoft.ServiceBus/namespaces")}
- * {@code Mono>} list(@Path("subscriptionId") String subscriptionId, @Header("Authorization") String token);
+ * {@code Mono>} list(@Path("subscriptionId") String subscriptionId, @Header + * ("Authorization") String token); * *

The token parameter will replace the effect of any credentials in the HTTP pipeline.

* @@ -44,7 +47,12 @@ *
  * {@code @PUT("{containerName}/{blob}")}
  * {@code @ExpectedResponses({200})}
- * {@code Mono> setMetadata(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") String ifModifiedSince, @HeaderParam("If-Unmodified-Since") String ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatches, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp);}
+ * {@code Mono> setMetadata(@HostParam("url") String url, @QueryParam + * ("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam + * ("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") String ifModifiedSince, @HeaderParam + * ("If-Unmodified-Since") String ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatches, @HeaderParam + * ("If-None-Match") String ifNoneMatch, @HeaderParam("x-ms-version") String version, @HeaderParam + * ("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp);} * *

The metadata parameter will be expanded out so that each entry becomes * "x-ms-meta-{@literal }: {@literal }".

@@ -56,7 +64,7 @@ * The name of the variable in the endpoint uri template which will be replaced with the value * of the parameter annotated with this annotation. * @return The name of the variable in the endpoint uri template which will be replaced with the - * value of the parameter annotated with this annotation. + * value of the parameter annotated with this annotation. */ String value(); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Headers.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Headers.java index 727356cf8196..f391f61485bb 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Headers.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Headers.java @@ -18,8 +18,10 @@ * *
  * {@literal @}Headers({ "Content-Type: application/json; charset=utf-8", "accept-language: en-US" })
- * {@literal @}POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/images/getEntityTypeImageUploadUrl")
- *  void getUploadUrlForEntityType(@Path("resourceGroupName") String resourceGroupName, @Path("hubName") String hubName, @Path("subscriptionId") String subscriptionId, @Body GetImageUploadUrlInputInner parameters);
+ * {@literal @}POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft + * .CustomerInsights/hubs/{hubName}/images/getEntityTypeImageUploadUrl") + * void getUploadUrlForEntityType(@Path("resourceGroupName") String resourceGroupName, @Path("hubName") String + * hubName, @Path("subscriptionId") String subscriptionId, @Body GetImageUploadUrlInputInner parameters); */ @Retention(RUNTIME) @Target(METHOD) diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Host.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Host.java index efa90564c4b5..aca483ddebec 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Host.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Host.java @@ -13,8 +13,8 @@ * Annotation for parameterized host name targeting a REST service. * *

This is the 'host' field or 'x-ms-parameterized-host.hostTemplate' field in a Swagger document. parameters are - * enclosed in {}s, e.g. {accountName}. An HTTP client must accept the parameterized host as the base URL for the request, - * replacing the parameters during runtime with the actual values users provide.

+ * enclosed in {}s, e.g. {accountName}. An HTTP client must accept the parameterized host as the base URL for the + * request, replacing the parameters during runtime with the actual values users provide.

* *

For parameterized hosts, parameters annotated with {@link HostParam} must be provided. See Java docs in * {@link HostParam} for directions for host parameters.

@@ -27,8 +27,10 @@ *
  * {@literal @}Host("https://management.azure.com")
  *  interface VirtualMachinesService {
- *   {@literal @}GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}")
- *    VirtualMachine getByResourceGroup(@PathParam("resourceGroupName") String rgName, @PathParam("vmName") String vmName, @PathParam("subscriptionId") String subscriptionId);
+ *   {@literal @}GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft
+ *   .Compute/virtualMachines/{vmName}")
+ *    VirtualMachine getByResourceGroup(@PathParam("resourceGroupName") String rgName, @PathParam("vmName") String
+ *    vmName, @PathParam("subscriptionId") String subscriptionId);
  *  }
* *

Example 2: Dynamic annotation

@@ -41,7 +43,8 @@ * } */ @Target(value = {TYPE}) -@Retention(RetentionPolicy.RUNTIME) // Record this annotation in the class file and make it available during runtime. +// Record this annotation in the class file and make it available during runtime. +@Retention(RetentionPolicy.RUNTIME) public @interface Host { /** * Get the protocol/scheme, host, and optional port number in a single string. diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/HostParam.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/HostParam.java index 288156ac6b3b..95a320f417cd 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/HostParam.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/HostParam.java @@ -22,7 +22,8 @@ * {@literal @}Host("{accountName}.{suffix}") * interface DatalakeService { * {@literal @}GET("jobs/{jobIdentity}") - * Job getJob(@HostParam("accountName") String accountName, @HostParam("suffix") String suffix, @PathParam("jobIdentity") jobIdentity); + * Job getJob(@HostParam("accountName") String accountName, @HostParam("suffix") String suffix, @PathParam + * ("jobIdentity") jobIdentity); * } * *

Example 2: Unnamed parameter

@@ -41,7 +42,7 @@ * The name of the variable in the endpoint uri template which will be replaced with the value * of the parameter annotated with this annotation. * @return The name of the variable in the endpoint uri template which will be replaced with the - * value of the parameter annotated with this annotation. + * value of the parameter annotated with this annotation. */ String value(); /** diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Patch.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Patch.java index 13ec9e5c100b..9aa90fae0866 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Patch.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Patch.java @@ -17,14 +17,18 @@ *

Example 1: Relative path segments

* *
- * {@literal @}Patch("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}")
- *  VirtualMachine patch(@PathParam("resourceGroupName") String rgName, @PathParam("vmName") String vmName, @PathParam("subscriptionId") String subscriptionId, @BodyParam VirtualMachineUpdateParameters updateParameters);
+ * {@literal @}Patch("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/ + * Microsoft.Compute/virtualMachines/{vmName}") + * VirtualMachine patch(@PathParam("resourceGroupName") String rgName, @PathParam("vmName") String + * vmName, @PathParam("subscriptionId") String subscriptionId, @BodyParam VirtualMachineUpdateParameters + * updateParameters); * *

Example 2: Absolute path segment

* *
  * {@literal @}Patch({vaultBaseUrl}/secrets/{secretName})
- *  Secret patch(@PathParam("vaultBaseUrl" encoded = true) String vaultBaseUrl, @PathParam("secretName") String secretName, @BodyParam SecretUpdateParameters updateParameters);
+ * Secret patch(@PathParam("vaultBaseUrl" encoded = true) String vaultBaseUrl, @PathParam("secretName") String + * secretName, @BodyParam SecretUpdateParameters updateParameters); */ @Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/PathParam.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/PathParam.java index 24381975a2fe..d1e3bbadbaf0 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/PathParam.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/PathParam.java @@ -18,8 +18,10 @@ *

Example 1:

* *
- * {@literal @}GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/")
- *  VirtualMachine getByResourceGroup(@PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String rgName, @PathParam("foo") String bar);
+ * {@literal @}GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft + * .Compute/virtualMachines/") + * VirtualMachine getByResourceGroup(@PathParam("subscriptionId") String subscriptionId, @PathParam + * ("resourceGroupName") String rgName, @PathParam("foo") String bar); * *

The value of parameters subscriptionId, resourceGroupName will be encoded and encoded value will be used to * replace the corresponding path segment {subscriptionId}, {resourceGroupName} @@ -52,7 +54,7 @@ * The name of the variable in the endpoint uri template which will be replaced with the value * of the parameter annotated with this annotation. * @return The name of the variable in the endpoint uri template which will be replaced with the - * value of the parameter annotated with this annotation. + * value of the parameter annotated with this annotation. */ String value(); /** diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Post.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Post.java index ebf4757e7634..466c7925a887 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Post.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Post.java @@ -17,14 +17,17 @@ *

Example 1: Relative path segments

* *
- * {@literal @}Post("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart")
- *  void restart(@PathParam("resourceGroupName") String rgName, @PathParam("vmName") String vmName, @PathParam("subscriptionId") String subscriptionId);
+ * {@literal @}Post("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft + * .Compute/virtualMachines/{vmName}/restart") + * void restart(@PathParam("resourceGroupName") String rgName, @PathParam("vmName") String vmName, @PathParam + * ("subscriptionId") String subscriptionId); * *

Example 2: Absolute path segment

* *
  * {@literal @}Post(https://{functionApp}.azurewebsites.net/admin/functions/{name}/keys/{keyName})
- *  NameValuePair generateFunctionKey(@PathParam("functionApp") String functionApp, @PathParam("name") String function, @PathParam("keyName") String keyName);
+ * NameValuePair generateFunctionKey(@PathParam("functionApp") String functionApp, @PathParam("name") String + * function, @PathParam("keyName") String keyName); */ @Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Put.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Put.java index 181304db748b..b813107b21a6 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Put.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/Put.java @@ -9,7 +9,8 @@ import java.lang.annotation.Target; /** - * HTTP PUT method annotation describing the parameterized relative path to a REST endpoint for resource creation or update. + * HTTP PUT method annotation describing the parameterized relative path to a REST endpoint for resource creation or + * update. * *

The required value can be either a relative path or an absolute path. When it's an absolute path, it must start * with a protocol or a parameterized segment (Otherwise the parse cannot tell if it's absolute or relative).

@@ -17,14 +18,17 @@ *

Example 1: Relative path segments

* *
- * {@literal @}Put("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}")
- *  VirtualMachine createOrUpdate(@PathParam("resourceGroupName") String rgName, @PathParam("vmName") String vmName, @PathParam("subscriptionId") String subscriptionId, @BodyParam VirtualMachine vm);
+ * {@literal @}Put("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft + * .Compute/virtualMachines/{vmName}") + * VirtualMachine createOrUpdate(@PathParam("resourceGroupName") String rgName, @PathParam("vmName") String + * vmName, @PathParam("subscriptionId") String subscriptionId, @BodyParam VirtualMachine vm); * *

Example 2: Absolute path segment

* *
  * {@literal @}Put({vaultBaseUrl}/secrets/{secretName})
- *  Secret createOrUpdate(@PathParam("vaultBaseUrl" encoded = true) String vaultBaseUrl, @PathParam("secretName") String secretName, @BodyParam SecretCreateParameters secret);
+ * Secret createOrUpdate(@PathParam("vaultBaseUrl" encoded = true) String vaultBaseUrl, @PathParam("secretName") + * String secretName, @BodyParam SecretCreateParameters secret); */ @Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/QueryParam.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/QueryParam.java index 26def14b15b9..3a2b4d766c2a 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/QueryParam.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/QueryParam.java @@ -16,9 +16,13 @@ * *
  * {@literal @}GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/resources")
- * {@literal Single>} listByResourceGroup(@PathParam("resourceGroupName") String resourceGroupName, @PathParam("subscriptionId") String subscriptionId, @QueryParam("$filter") String filter, @QueryParam("$expand") String expand, @QueryParam("$top") Integer top, @QueryParam("api-version") String apiVersion);
+ * {@literal Single>} listByResourceGroup(@PathParam("resourceGroupName") String + * resourceGroupName, @PathParam("subscriptionId") String subscriptionId, @QueryParam("$filter") String + * filter, @QueryParam("$expand") String expand, @QueryParam("$top") Integer top, @QueryParam("api-version") String + * apiVersion); * - *

The value of parameters filter, expand, top, apiVersion will be encoded and encoded value will be used to replace the corresponding path segment {$filter}, + *

The value of parameters filter, expand, top, apiVersion will be encoded and encoded value will be used to replace + * the corresponding path segment {$filter}, * {$expand}, {$top}, {api-version} respectively.

* *

Example 2: (A use case where PathParam.encoded=true will be used)

@@ -48,7 +52,7 @@ * The name of the variable in the endpoint uri template which will be replaced with the value * of the parameter annotated with this annotation. * @return The name of the variable in the endpoint uri template which will be replaced with the - * value of the parameter annotated with this annotation. + * value of the parameter annotated with this annotation. */ String value(); /** diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/UnexpectedResponseExceptionType.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/UnexpectedResponseExceptionType.java index 93e159da2f83..1cb9569363f3 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/UnexpectedResponseExceptionType.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/annotation/UnexpectedResponseExceptionType.java @@ -22,13 +22,17 @@ * *
  * {@literal @}UnexpectedResponseExceptionType(MyCustomException.class)
- * {@literal @}POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/images/getEntityTypeImageUploadUrl")
- *  void getUploadUrlForEntityType(@Path("resourceGroupName") String resourceGroupName, @Path("hubName") String hubName, @Path("subscriptionId") String subscriptionId, @Body GetImageUploadUrlInputInner parameters);
-
+ * {@literal @}POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft
+ * .CustomerInsights/hubs/{hubName}/images/getEntityTypeImageUploadUrl")
+ *  void getUploadUrlForEntityType(@Path("resourceGroupName") String resourceGroupName, @Path("hubName") String
+ *  hubName, @Path("subscriptionId") String subscriptionId, @Body GetImageUploadUrlInputInner parameters);
+ *
  * {@literal @}UnexpectedResponseExceptionType(code = {404}, value = NotFoundException.class)
  * {@literal @}UnexpectedResponseExceptionType(DefaultException.class)
- * {@literal @}POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CustomerInsights/hubs/{hubName}/images/getEntityTypeImageUploadUrl")
- *  void getUploadUrlForEntityType(@Path("resourceGroupName") String resourceGroupName, @Path("hubName") String hubName, @Path("subscriptionId") String subscriptionId, @Body GetImageUploadUrlInputInner parameters);
+ * {@literal @}POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft
+ * .CustomerInsights/hubs/{hubName}/images/getEntityTypeImageUploadUrl")
+ *  void getUploadUrlForEntityType(@Path("resourceGroupName") String resourceGroupName, @Path("hubName") String
+ *  hubName, @Path("subscriptionId") String subscriptionId, @Body GetImageUploadUrlInputInner parameters);
  * 
* * If multiple annotations share the same HTTP status code or there is multiple default annotations the exception diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/exception/MissingRequiredAnnotationException.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/exception/MissingRequiredAnnotationException.java index 2642d5449b0c..87bc8683b9f4 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/exception/MissingRequiredAnnotationException.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/exception/MissingRequiredAnnotationException.java @@ -18,8 +18,10 @@ public class MissingRequiredAnnotationException extends RuntimeException { * @param requiredAnnotation The annotation that is required. * @param swaggerInterface The swagger interface that is missing the required annotation. */ - public MissingRequiredAnnotationException(Class requiredAnnotation, Class swaggerInterface) { - super("A " + getAnnotationName(requiredAnnotation) + " annotation must be defined on " + swaggerInterface.getName() + "."); + public MissingRequiredAnnotationException(Class requiredAnnotation, + Class swaggerInterface) { + super("A " + getAnnotationName(requiredAnnotation) + " annotation must be defined on " + + swaggerInterface.getName() + "."); } /** @@ -28,8 +30,10 @@ public MissingRequiredAnnotationException(Class requiredAn * @param requiredAnnotation The annotation that is required. * @param swaggerInterfaceMethod The swagger interface method that is missing the required annotation. */ - public MissingRequiredAnnotationException(Class requiredAnnotation, Method swaggerInterfaceMethod) { - super("A " + getAnnotationName(requiredAnnotation) + " annotation must be defined on the method " + methodFullName(swaggerInterfaceMethod) + "."); + public MissingRequiredAnnotationException(Class requiredAnnotation, + Method swaggerInterfaceMethod) { + super("A " + getAnnotationName(requiredAnnotation) + " annotation must be defined on the method " + + methodFullName(swaggerInterfaceMethod) + "."); } /** @@ -38,8 +42,10 @@ public MissingRequiredAnnotationException(Class requiredAn * @param requiredAnnotationOptions The options for the annotation that is required. * @param swaggerInterfaceMethod The swagger interface method that is missing the required annotation. */ - public MissingRequiredAnnotationException(List> requiredAnnotationOptions, Method swaggerInterfaceMethod) { - super("Either " + optionsToString(requiredAnnotationOptions) + " annotation must be defined on the method " + methodFullName(swaggerInterfaceMethod) + "."); + public MissingRequiredAnnotationException(List> requiredAnnotationOptions, + Method swaggerInterfaceMethod) { + super("Either " + optionsToString(requiredAnnotationOptions) + " annotation must be defined on the method " + + methodFullName(swaggerInterfaceMethod) + "."); } private static String getAnnotationName(Class annotation) { diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/BufferedHttpResponse.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/BufferedHttpResponse.java index 8363b150176d..017a492ce4fa 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/BufferedHttpResponse.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/BufferedHttpResponse.java @@ -5,11 +5,10 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpResponse; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; @@ -27,44 +26,44 @@ public final class BufferedHttpResponse extends HttpResponse { */ public BufferedHttpResponse(HttpResponse innerHttpResponse) { this.innerHttpResponse = innerHttpResponse; - this.cachedBody = innerHttpResponse.bodyAsByteArray().cache(); - this.request(innerHttpResponse.request()); + this.cachedBody = innerHttpResponse.getBodyAsByteArray().cache(); + this.setRequest(innerHttpResponse.getRequest()); } @Override - public int statusCode() { - return innerHttpResponse.statusCode(); + public int getStatusCode() { + return innerHttpResponse.getStatusCode(); } @Override - public String headerValue(String name) { - return innerHttpResponse.headerValue(name); + public String getHeaderValue(String name) { + return innerHttpResponse.getHeaderValue(name); } @Override - public HttpHeaders headers() { - return innerHttpResponse.headers(); + public HttpHeaders getHeaders() { + return innerHttpResponse.getHeaders(); } @Override - public Mono bodyAsByteArray() { + public Mono getBodyAsByteArray() { return cachedBody; } @Override - public Flux body() { - return bodyAsByteArray().flatMapMany(bytes -> Flux.just(Unpooled.wrappedBuffer(bytes))); + public Flux getBody() { + return getBodyAsByteArray().flatMapMany(bytes -> Flux.just(ByteBuffer.wrap(bytes))); } @Override - public Mono bodyAsString() { - return bodyAsByteArray() + public Mono getBodyAsString() { + return getBodyAsByteArray() .map(bytes -> bytes == null ? null : new String(bytes, StandardCharsets.UTF_8)); } @Override - public Mono bodyAsString(Charset charset) { - return bodyAsByteArray() + public Mono getBodyAsString(Charset charset) { + return getBodyAsByteArray() .map(bytes -> bytes == null ? null : new String(bytes, charset)); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/PagedResponseBase.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/PagedResponseBase.java index a19b32397e56..54bfca660cd0 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/PagedResponseBase.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/PagedResponseBase.java @@ -25,11 +25,13 @@ public class PagedResponseBase implements PagedResponse { private final List items; private final String nextLink; - public PagedResponseBase(HttpRequest request, int statusCode, HttpHeaders headers, Page page, H deserializedHeaders) { - this(request, statusCode, headers, page.items(), page.nextLink(), deserializedHeaders); + public PagedResponseBase(HttpRequest request, int statusCode, HttpHeaders headers, Page page, + H deserializedHeaders) { + this(request, statusCode, headers, page.getItems(), page.getNextLink(), deserializedHeaders); } - public PagedResponseBase(HttpRequest request, int statusCode, HttpHeaders headers, List items, String nextLink, H deserializedHeaders) { + public PagedResponseBase(HttpRequest request, int statusCode, HttpHeaders headers, List items, String nextLink, + H deserializedHeaders) { this.request = request; this.statusCode = statusCode; this.headers = headers; @@ -42,7 +44,7 @@ public PagedResponseBase(HttpRequest request, int statusCode, HttpHeaders header * {@inheritDoc} */ @Override - public List items() { + public List getItems() { return items; } @@ -50,7 +52,7 @@ public List items() { * {@inheritDoc} */ @Override - public String nextLink() { + public String getNextLink() { return nextLink; } @@ -58,7 +60,7 @@ public String nextLink() { * {@inheritDoc} */ @Override - public int statusCode() { + public int getStatusCode() { return statusCode; } @@ -66,7 +68,7 @@ public int statusCode() { * {@inheritDoc} */ @Override - public HttpHeaders headers() { + public HttpHeaders getHeaders() { return headers; } @@ -74,7 +76,7 @@ public HttpHeaders headers() { * @return the request which resulted in this PagedRequestResponse. */ @Override - public HttpRequest request() { + public HttpRequest getRequest() { return request; } @@ -83,7 +85,7 @@ public HttpRequest request() { * * @return an instance of header type H, containing the HTTP response headers. */ - public H deserializedHeaders() { + public H getDeserializedHeaders() { return deserializedHeaders; } 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 fb9d7e56ccd4..917ae12c7674 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 @@ -3,6 +3,8 @@ package com.azure.core.implementation.http; +import com.azure.core.util.logging.ClientLogger; + import java.net.MalformedURLException; import java.net.URL; import java.util.LinkedHashMap; @@ -12,6 +14,8 @@ * A builder class that is used to create URLs. */ public final class UrlBuilder { + private final ClientLogger logger = new ClientLogger(UrlBuilder.class); + private String scheme; private String host; private String port; @@ -22,10 +26,11 @@ public final class UrlBuilder { /** * Set the scheme/protocol that will be used to build the final URL. + * * @param scheme The scheme/protocol that will be used to build the final URL. * @return This UrlBuilder so that multiple setters can be chained together. */ - public UrlBuilder scheme(String scheme) { + public UrlBuilder setScheme(String scheme) { if (scheme == null || scheme.isEmpty()) { this.scheme = null; } else { @@ -36,18 +41,20 @@ public UrlBuilder scheme(String scheme) { /** * Get the scheme/protocol that has been assigned to this UrlBuilder. + * * @return the scheme/protocol that has been assigned to this UrlBuilder. */ - public String scheme() { + public String getScheme() { return scheme; } /** * Set the host that will be used to build the final URL. + * * @param host The host that will be used to build the final URL. * @return This UrlBuilder so that multiple setters can be chained together. */ - public UrlBuilder host(String host) { + public UrlBuilder setHost(String host) { if (host == null || host.isEmpty()) { this.host = null; } else { @@ -58,18 +65,20 @@ public UrlBuilder host(String host) { /** * Get the host that has been assigned to this UrlBuilder. + * * @return the host that has been assigned to this UrlBuilder. */ - public String host() { + public String getHost() { return host; } /** * Set the port that will be used to build the final URL. + * * @param port The port that will be used to build the final URL. * @return This UrlBuilder so that multiple setters can be chained together. */ - public UrlBuilder port(String port) { + public UrlBuilder setPort(String port) { if (port == null || port.isEmpty()) { this.port = null; } else { @@ -80,27 +89,30 @@ public UrlBuilder port(String port) { /** * Set the port that will be used to build the final URL. + * * @param port The port that will be used to build the final URL. * @return This UrlBuilder so that multiple setters can be chained together. */ - public UrlBuilder port(int port) { - return port(Integer.toString(port)); + public UrlBuilder setPort(int port) { + return setPort(Integer.toString(port)); } /** * Get the port that has been assigned to this UrlBuilder. + * * @return the port that has been assigned to this UrlBuilder. */ - public Integer port() { + public Integer getPort() { return port == null ? null : Integer.valueOf(port); } /** * Set the path that will be used to build the final URL. + * * @param path The path that will be used to build the final URL. * @return This UrlBuilder so that multiple setters can be chained together. */ - public UrlBuilder path(String path) { + public UrlBuilder setPath(String path) { if (path == null || path.isEmpty()) { this.path = null; } else { @@ -111,18 +123,19 @@ public UrlBuilder path(String path) { /** * Get the path that has been assigned to this UrlBuilder. + * * @return the path that has been assigned to this UrlBuilder. */ - public String path() { + public String getPath() { return path; } /** * Set the provided query parameter name and encoded value to query string for the final URL. + * * @param queryParameterName The name of the query parameter. * @param queryParameterEncodedValue The encoded value of the query parameter. - * @return The provided query parameter name and encoded value to query string for the final - * URL. + * @return The provided query parameter name and encoded value to query string for the final URL. */ public UrlBuilder setQueryParameter(String queryParameterName, String queryParameterEncodedValue) { query.put(queryParameterName, queryParameterEncodedValue); @@ -131,10 +144,11 @@ public UrlBuilder setQueryParameter(String queryParameterName, String queryParam /** * Set the query that will be used to build the final URL. + * * @param query The query that will be used to build the final URL. * @return This UrlBuilder so that multiple setters can be chained together. */ - public UrlBuilder query(String query) { + public UrlBuilder setQuery(String query) { if (query == null || query.isEmpty()) { this.query.clear(); } else { @@ -145,12 +159,31 @@ public UrlBuilder query(String query) { /** * Get the query that has been assigned to this UrlBuilder. + * * @return the query that has been assigned to this UrlBuilder. */ - public Map query() { + public Map getQuery() { return query; } + public String queryString() { + if (query.isEmpty()) { + return ""; + } + + StringBuilder queryBuilder = new StringBuilder("?"); + for (Map.Entry entry : query.entrySet()) { + if (queryBuilder.length() > 1) { + queryBuilder.append("&"); + } + queryBuilder.append(entry.getKey()); + queryBuilder.append("="); + queryBuilder.append(entry.getValue()); + } + + return queryBuilder.toString(); + } + private UrlBuilder with(String text, UrlTokenizerState startState) { final UrlTokenizer tokenizer = new UrlTokenizer(text, startState); @@ -190,7 +223,7 @@ private UrlBuilder with(String text, UrlTokenizerState startState) { if (nameValue.length == 2) { setQueryParameter(nameValue[0], nameValue[1]); } else { - throw new IllegalArgumentException("Malformed query entry: " + entry); + setQueryParameter(nameValue[0], ""); } } } @@ -206,6 +239,7 @@ private UrlBuilder with(String text, UrlTokenizerState startState) { /** * Get the URL that is being built. + * * @return The URL that is being built. * @throws MalformedURLException if the URL is not fully formed. */ @@ -215,6 +249,7 @@ public URL toURL() throws MalformedURLException { /** * Get the string representation of the URL that is being built. + * * @return The string representation of the URL that is being built. */ public String toString() { @@ -247,25 +282,14 @@ public String toString() { result.append(path); } - if (!query.isEmpty()) { - StringBuilder queryBuilder = new StringBuilder("?"); - for (Map.Entry entry : query.entrySet()) { - if (queryBuilder.length() > 1) { - queryBuilder.append("&"); - } - queryBuilder.append(entry.getKey()); - queryBuilder.append("="); - queryBuilder.append(entry.getValue()); - } - - result.append(queryBuilder.toString()); - } + result.append(queryString()); return result.toString(); } /** * Parse a UrlBuilder from the provided URL string. + * * @param url The string to parse. * @return The UrlBuilder that was parsed from the string. */ @@ -277,6 +301,7 @@ public static UrlBuilder parse(String url) { /** * Parse a UrlBuilder from the provided URL object. + * * @param url The URL object to parse. * @return The UrlBuilder that was parsed from the URL object. */ @@ -286,27 +311,27 @@ public static UrlBuilder parse(URL url) { if (url != null) { final String protocol = url.getProtocol(); if (protocol != null && !protocol.isEmpty()) { - result.scheme(protocol); + result.setScheme(protocol); } final String host = url.getHost(); if (host != null && !host.isEmpty()) { - result.host(host); + result.setHost(host); } final int port = url.getPort(); if (port != -1) { - result.port(port); + result.setPort(port); } final String path = url.getPath(); if (path != null && !path.isEmpty()) { - result.path(path); + result.setPath(path); } final String query = url.getQuery(); if (query != null && !query.isEmpty()) { - result.query(query); + result.setQuery(query); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/policy/spi/HttpPolicyProviders.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/policy/spi/HttpPolicyProviders.java index c6e76fd04280..d077f1c7241f 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/policy/spi/HttpPolicyProviders.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/policy/spi/HttpPolicyProviders.java @@ -16,7 +16,8 @@ */ public final class HttpPolicyProviders { - private static Map, ServiceLoader> serviceLoaders = new HashMap<>(); + private static Map, ServiceLoader> serviceLoaders = + new HashMap<>(); private HttpPolicyProviders() { // no-op @@ -38,20 +39,24 @@ public static void addAfterRetryPolicies(List policies) { addRetryPolicies(policies, () -> getPolicyProviders(false, AfterRetryPolicyProvider.class)); } - private static void addRetryPolicies(List policies, Supplier> policySupplier) { + private static void addRetryPolicies(List policies, + Supplier> policySupplier) { Iterator it = policySupplier.get(); while (it.hasNext()) { PolicyProvider policyProvider = it.next(); HttpPipelinePolicy policy = policyProvider.create(); if (policy == null) { - throw new NullPointerException("HttpPipelinePolicy created with " + policyProvider.getClass() + " resulted in a null policy"); + throw new NullPointerException("HttpPipelinePolicy created with " + policyProvider.getClass() + + " resulted in a null policy"); } policies.add(policy); } } - private static Iterator getPolicyProviders(boolean reload, Class cls) { - ServiceLoader serviceLoader = serviceLoaders.computeIfAbsent(cls, ServiceLoader::load); + private static Iterator getPolicyProviders(boolean reload, + Class cls) { + ServiceLoader serviceLoader = + serviceLoaders.computeIfAbsent(cls, ServiceLoader::load); if (reload) { serviceLoader.reload(); diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/spi/HttpClientProvider.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/spi/HttpClientProvider.java new file mode 100644 index 000000000000..dcf9f05fc31c --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/spi/HttpClientProvider.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.implementation.http.spi; + +import com.azure.core.http.HttpClient; + +/** + * An interface to be implemented by any azure-core plugin that wishes to provide an alternate {@link HttpClient} + * implementation. + */ +@FunctionalInterface +public interface HttpClientProvider { + + /** + * Creates a new instance of the {@link HttpClient} that this HttpClientProvider is configured to create. + * + * @return A new {@link HttpClient} instance, entirely unrelated to all other instances that were created + * previously. + */ + HttpClient createInstance(); +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/spi/HttpClientProviders.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/spi/HttpClientProviders.java new file mode 100644 index 000000000000..8fb6de32739b --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/http/spi/HttpClientProviders.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.core.implementation.http.spi; + +import com.azure.core.http.HttpClient; + +import java.util.Iterator; +import java.util.ServiceLoader; + +/** + * This class handles loading available HTTP clients + */ +public final class HttpClientProviders { + private static HttpClientProvider defaultProvider; + private static final String CANNOT_FIND_HTTP_CLIENT = + "Cannot find any HttpClient provider on the classpath - unable to create a default HttpClient instance"; + + static { + ServiceLoader serviceLoader = ServiceLoader.load(HttpClientProvider.class); + + // Use the first provider found in the service loader iterator. + Iterator it = serviceLoader.iterator(); + if (it.hasNext()) { + defaultProvider = it.next(); + } + } + + private HttpClientProviders() { + // no-op + } + + public static HttpClient createInstance() { + if (defaultProvider == null) { + throw new IllegalStateException(CANNOT_FIND_HTTP_CLIENT); + } + + return defaultProvider.createInstance(); + } +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseBodyDecoder.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseBodyDecoder.java index 0d3fc8995365..ff999c83d51f 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseBodyDecoder.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseBodyDecoder.java @@ -3,7 +3,6 @@ package com.azure.core.implementation.serializer; -import com.azure.core.implementation.annotation.ReturnValueWireType; import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpResponse; @@ -14,6 +13,7 @@ import com.azure.core.implementation.Base64Url; import com.azure.core.implementation.DateTimeRfc1123; import com.azure.core.implementation.UnixTime; +import com.azure.core.implementation.annotation.ReturnValueWireType; import com.azure.core.implementation.http.PagedResponseBase; import com.azure.core.implementation.util.FluxUtil; import com.azure.core.implementation.util.TypeUtil; @@ -43,49 +43,51 @@ final class HttpResponseBodyDecoder { * @param serializer the adapter to use for decoding * @param decodeData the necessary data required to decode a Http response * @return publisher that emits decoded response body upon subscription if body is decodable, - * no emission if the body is not-decodable + * no emission if the body is not-decodable */ - static Mono decode(HttpResponse httpResponse, SerializerAdapter serializer, HttpResponseDecodeData decodeData) { + static Mono decode(HttpResponse httpResponse, SerializerAdapter serializer, + HttpResponseDecodeData decodeData) { ensureRequestSet(httpResponse); // return Mono.defer(() -> { if (isErrorStatus(httpResponse, decodeData)) { - return httpResponse.bodyAsString() - .flatMap(bodyString -> { - try { - final Object decodedErrorEntity = deserializeBody(bodyString, - decodeData.getUnexpectedException(httpResponse.statusCode()).exceptionBodyType(), - null, - serializer, - SerializerEncoding.fromHeaders(httpResponse.headers())); - return decodedErrorEntity == null ? Mono.empty() : Mono.just(decodedErrorEntity); - } catch (IOException | MalformedValueException ignored) { - // This translates in RestProxy as a RestException with no deserialized body. - // The response content will still be accessible via the .response() member. - } - return Mono.empty(); - }); - } else if (httpResponse.request().httpMethod() == HttpMethod.HEAD) { + return httpResponse.getBodyAsString() + .flatMap(bodyString -> { + try { + final Object decodedErrorEntity = deserializeBody(bodyString, + decodeData.getUnexpectedException(httpResponse.getStatusCode()).getExceptionBodyType(), + null, + serializer, + SerializerEncoding.fromHeaders(httpResponse.getHeaders())); + return decodedErrorEntity == null ? Mono.empty() : Mono.just(decodedErrorEntity); + } catch (IOException | MalformedValueException ignored) { + // This translates in RestProxy as a RestException with no deserialized body. + // The response content will still be accessible via the .response() member. + } + return Mono.empty(); + }); + } else if (httpResponse.getRequest().getHttpMethod() == HttpMethod.HEAD) { // RFC: A response to a HEAD method should not have a body. If so, it must be ignored return Mono.empty(); } else if (!isReturnTypeDecodable(decodeData)) { return Mono.empty(); } else { - return httpResponse.bodyAsString() - .flatMap(bodyString -> { - try { - final Object decodedSuccessEntity = deserializeBody(bodyString, - extractEntityTypeFromReturnType(decodeData), - decodeData.returnValueWireType(), - serializer, - SerializerEncoding.fromHeaders(httpResponse.headers())); - return decodedSuccessEntity == null ? Mono.empty() : Mono.just(decodedSuccessEntity); - } catch (MalformedValueException e) { - return Mono.error(new HttpResponseException("HTTP response has a malformed body.", httpResponse, e)); - } catch (IOException e) { - return Mono.error(new HttpResponseException("Deserialization Failed.", httpResponse, e)); - } - }); + return httpResponse.getBodyAsString() + .flatMap(bodyString -> { + try { + final Object decodedSuccessEntity = deserializeBody(bodyString, + extractEntityTypeFromReturnType(decodeData), + decodeData.getReturnValueWireType(), + serializer, + SerializerEncoding.fromHeaders(httpResponse.getHeaders())); + return decodedSuccessEntity == null ? Mono.empty() : Mono.just(decodedSuccessEntity); + } catch (MalformedValueException e) { + return Mono.error(new HttpResponseException("HTTP response has a malformed body.", + httpResponse, e)); + } catch (IOException e) { + return Mono.error(new HttpResponseException("Deserialization Failed.", httpResponse, e)); + } + }); } }); } @@ -100,7 +102,7 @@ static boolean isDecodable(HttpResponse httpResponse, HttpResponseDecodeData dec // For error cases we always try to decode the non-empty response body // either to a strongly typed exception model or to Object return true; - } else if (httpResponse.request().httpMethod() == HttpMethod.HEAD) { + } else if (httpResponse.getRequest().getHttpMethod() == HttpMethod.HEAD) { // RFC: A response to a HEAD method should not have a body. If so, it must be ignored return false; } else { @@ -117,8 +119,8 @@ static Type decodedType(HttpResponse httpResponse, HttpResponseDecodeData decode if (isErrorStatus(httpResponse, decodeData)) { // For error cases we always try to decode the non-empty response body // either to a strongly typed exception model or to Object - return decodeData.getUnexpectedException(httpResponse.statusCode()).exceptionBodyType(); - } else if (httpResponse.request().httpMethod() == HttpMethod.HEAD) { + return decodeData.getUnexpectedException(httpResponse.getStatusCode()).getExceptionBodyType(); + } else if (httpResponse.getRequest().getHttpMethod() == HttpMethod.HEAD) { // RFC: A response to a HEAD method should not have a body. If so, it must be ignored return null; } else if (!isReturnTypeDecodable(decodeData)) { @@ -136,11 +138,11 @@ static Type decodedType(HttpResponse httpResponse, HttpResponseDecodeData decode * @return true if the response status code is considered as error, false otherwise. */ static boolean isErrorStatus(HttpResponse httpResponse, HttpResponseDecodeData decodeData) { - final int[] expectedStatuses = decodeData.expectedStatusCodes(); + final int[] expectedStatuses = decodeData.getExpectedStatusCodes(); if (expectedStatuses != null) { - return !contains(expectedStatuses, httpResponse.statusCode()); + return !contains(expectedStatuses, httpResponse.getStatusCode()); } else { - return httpResponse.statusCode() / 100 != 2; + return httpResponse.getStatusCode() / 100 != 2; } } @@ -152,13 +154,14 @@ static boolean isErrorStatus(HttpResponse httpResponse, HttpResponseDecodeData d * * @param value the string value to deserialize * @param resultType the return type of the java proxy method - * @param wireType value of optional {@link ReturnValueWireType} annotation present in java proxy method indicating - * 'entity type' (wireType) of REST API wire response body + * @param wireType value of optional {@link ReturnValueWireType} annotation present in java proxy method + * indicating 'entity type' (wireType) of REST API wire response body * @param encoding the encoding format of value * @return Deserialized object * @throws IOException When the body cannot be deserialized */ - private static Object deserializeBody(String value, Type resultType, Type wireType, SerializerAdapter serializer, SerializerEncoding encoding) throws IOException { + private static Object deserializeBody(String value, Type resultType, Type wireType, SerializerAdapter serializer, + SerializerEncoding encoding) throws IOException { if (wireType == null) { return serializer.deserialize(value, resultType, encoding); } else if (TypeUtil.isTypeOrSubTypeOf(wireType, Page.class)) { @@ -175,7 +178,7 @@ private static Object deserializeBody(String value, Type resultType, Type wireTy * Given: * (1). the {@code java.lang.reflect.Type} (resultType) of java proxy method return value * (2). and {@link ReturnValueWireType} annotation value indicating 'entity type' (wireType) - * of same REST API's wire response body + * of same REST API's wire response body * this method construct 'response body Type'. * * Note: When {@link ReturnValueWireType} annotation is applied to a proxy method, then the raw @@ -208,14 +211,15 @@ private static Type constructWireResponseType(Type resultType, Type wireType) { final Type wireResponseElementType = constructWireResponseType(resultElementType, wireType); wireResponseType = TypeUtil.createParameterizedType( - (Class) ((ParameterizedType) resultType).getRawType(), wireResponseElementType); - } else if (TypeUtil.isTypeOrSubTypeOf(resultType, Map.class) || TypeUtil.isTypeOrSubTypeOf(resultType, Response.class)) { + (Class) ((ParameterizedType) resultType).getRawType(), wireResponseElementType); + } else if (TypeUtil.isTypeOrSubTypeOf(resultType, Map.class) || TypeUtil.isTypeOrSubTypeOf(resultType, + Response.class)) { Type[] typeArguments = TypeUtil.getTypeArguments(resultType); final Type resultValueType = typeArguments[1]; final Type wireResponseValueType = constructWireResponseType(resultValueType, wireType); wireResponseType = TypeUtil.createParameterizedType( - (Class) ((ParameterizedType) resultType).getRawType(), typeArguments[0], wireResponseValueType); + (Class) ((ParameterizedType) resultType).getRawType(), typeArguments[0], wireResponseValueType); } } return wireResponseType; @@ -234,11 +238,13 @@ private static Type constructWireResponseType(Type resultType, Type wireType) { * @return An object representing an instance of {@param wireType} * @throws IOException if the serializer is unable to deserialize the value. */ - private static Object deserializePage(String value, Type resultType, Type wireType, SerializerAdapter serializer, SerializerEncoding encoding) throws IOException { + private static Object deserializePage(String value, Type resultType, Type wireType, SerializerAdapter serializer, + SerializerEncoding encoding) throws IOException { final Type wireResponseType; if (wireType == Page.class) { - // If the type is the 'Page' interface [i.e. `@ReturnValueWireType(Page.class)`], we will use the 'ItemPage' class instead. + // If the type is the 'Page' interface [i.e. `@ReturnValueWireType(Page.class)`], we will use the + // 'ItemPage' class instead. wireResponseType = TypeUtil.createParameterizedType(ItemPage.class, resultType); } else { wireResponseType = wireType; @@ -266,21 +272,21 @@ private static Object convertToResultType(Object wireResponse, Type resultType, } } else if (resultType == OffsetDateTime.class) { if (wireType == DateTimeRfc1123.class) { - result = ((DateTimeRfc1123) wireResponse).dateTime(); + result = ((DateTimeRfc1123) wireResponse).getDateTime(); } else if (wireType == UnixTime.class) { - result = ((UnixTime) wireResponse).dateTime(); + result = ((UnixTime) wireResponse).getDateTime(); } } else { if (TypeUtil.isTypeOrSubTypeOf(resultType, List.class)) { final Type resultElementType = TypeUtil.getTypeArgument(resultType); - @SuppressWarnings("unchecked") - final List wireResponseList = (List) wireResponse; + @SuppressWarnings("unchecked") final List wireResponseList = (List) wireResponse; final int wireResponseListSize = wireResponseList.size(); for (int i = 0; i < wireResponseListSize; ++i) { final Object wireResponseElement = wireResponseList.get(i); - final Object resultElement = convertToResultType(wireResponseElement, resultElementType, wireType); + final Object resultElement = + convertToResultType(wireResponseElement, resultElementType, wireType); if (wireResponseElement != resultElement) { wireResponseList.set(i, resultElement); } @@ -290,8 +296,8 @@ private static Object convertToResultType(Object wireResponse, Type resultType, } else if (TypeUtil.isTypeOrSubTypeOf(resultType, Map.class)) { final Type resultValueType = TypeUtil.getTypeArguments(resultType)[1]; - @SuppressWarnings("unchecked") - final Map wireResponseMap = (Map) wireResponse; + @SuppressWarnings("unchecked") final Map wireResponseMap = + (Map) wireResponse; final Set> wireResponseEntries = wireResponseMap.entrySet(); for (Map.Entry wireResponseEntry : wireResponseEntries) { @@ -305,26 +311,37 @@ private static Object convertToResultType(Object wireResponse, Type resultType, result = wireResponseMap; } else if (TypeUtil.isTypeOrSubTypeOf(resultType, PagedResponseBase.class)) { PagedResponseBase restResponse = (PagedResponseBase) wireResponse; - result = new PagedResponseBase<>(restResponse.request(), restResponse.statusCode(), restResponse.headers(), restResponse.items(), restResponse.nextLink(), restResponse.deserializedHeaders()); + result = + new PagedResponseBase<>(restResponse.getRequest(), restResponse.getStatusCode(), + restResponse.getHeaders(), restResponse.getItems(), restResponse.getNextLink(), + restResponse.getDeserializedHeaders()); } else if (TypeUtil.isTypeOrSubTypeOf(resultType, ResponseBase.class)) { ResponseBase restResponseBase = (ResponseBase) wireResponse; - Object wireResponseBody = restResponseBase.value(); + Object wireResponseBody = restResponseBase.getValue(); - // TODO: anuchan - RestProxy is always in charge of creating RestResponseBase--so this doesn't seem right - Object resultBody = convertToResultType(wireResponseBody, TypeUtil.getTypeArguments(resultType)[1], wireType); + // TODO: anuchan - RestProxy is always in charge of creating RestResponseBase--so this doesn't + // seem right + Object resultBody = + convertToResultType(wireResponseBody, TypeUtil.getTypeArguments(resultType)[1], wireType); if (wireResponseBody != resultBody) { - result = new ResponseBase<>(restResponseBase.request(), restResponseBase.statusCode(), restResponseBase.headers(), resultBody, restResponseBase.deserializedHeaders()); + result = + new ResponseBase<>(restResponseBase.getRequest(), restResponseBase.getStatusCode(), + restResponseBase.getHeaders(), resultBody, restResponseBase.getDeserializedHeaders()); } else { result = restResponseBase; } } else if (TypeUtil.isTypeOrSubTypeOf(resultType, Response.class)) { Response restResponse = (Response) wireResponse; - Object wireResponseBody = restResponse.value(); + Object wireResponseBody = restResponse.getValue(); - // TODO: anuchan - RestProxy is always in charge of creating RestResponseBase--so this doesn't seem right - Object resultBody = convertToResultType(wireResponseBody, TypeUtil.getTypeArguments(resultType)[1], wireType); + // TODO: anuchan - RestProxy is always in charge of creating RestResponseBase--so this doesn't + // seem right + Object resultBody = + convertToResultType(wireResponseBody, TypeUtil.getTypeArguments(resultType)[1], wireType); if (wireResponseBody != resultBody) { - result = new SimpleResponse<>(restResponse.request(), restResponse.statusCode(), restResponse.headers(), resultBody); + result = + new SimpleResponse<>(restResponse.getRequest(), restResponse.getStatusCode(), + restResponse.getHeaders(), resultBody); } else { result = restResponse; } @@ -339,22 +356,22 @@ private static Object convertToResultType(Object wireResponse, Type resultType, * * In the declaration of a java proxy method corresponding to the REST API, the 'returned entity' can be: * - * 1. emission value of the reactor publisher returned by proxy method + * 1. emission value of the reactor publisher returned by proxy method * - * e.g. {@code Mono getFoo(args);} - * {@code Flux getFoos(args);} - * where Foo is the REST API 'returned entity'. + * e.g. {@code Mono getFoo(args);} + * {@code Flux getFoos(args);} + * where Foo is the REST API 'returned entity'. * - * 2. OR content (value) of {@link ResponseBase} emitted by the reactor publisher returned from proxy method + * 2. OR content (value) of {@link ResponseBase} emitted by the reactor publisher returned from proxy method * - * e.g. {@code Mono> getFoo(args);} - * {@code Flux> getFoos(args);} - * where Foo is the REST API return entity. + * e.g. {@code Mono> getFoo(args);} + * {@code Flux> getFoos(args);} + * where Foo is the REST API return entity. * * @return the entity type. */ private static Type extractEntityTypeFromReturnType(HttpResponseDecodeData decodeData) { - Type token = decodeData.returnType(); + Type token = decodeData.getReturnType(); if (token != null) { if (TypeUtil.isTypeOrSubTypeOf(token, Mono.class)) { token = TypeUtil.getTypeArgument(token); @@ -363,7 +380,8 @@ private static Type extractEntityTypeFromReturnType(HttpResponseDecodeData decod try { // TODO: anuchan - unwrap OperationStatus a different way // Check for OperationStatus - if (TypeUtil.isTypeOrSubTypeOf(t, Class.forName("com.azure.core.management.implementation.OperationStatus"))) { + if (TypeUtil.isTypeOrSubTypeOf(t, Class.forName( + "com.azure.core.management.implementation.OperationStatus"))) { token = t; } } catch (ClassNotFoundException ignored) { @@ -376,7 +394,8 @@ private static Type extractEntityTypeFromReturnType(HttpResponseDecodeData decod try { // TODO: anuchan - unwrap OperationStatus a different way - if (TypeUtil.isTypeOrSubTypeOf(token, Class.forName("com.azure.core.management.implementation.OperationStatus"))) { + if (TypeUtil.isTypeOrSubTypeOf(token, Class.forName( + "com.azure.core.management.implementation.OperationStatus"))) { // Get Type of 'T' from OperationStatus token = TypeUtil.getTypeArgument(token); } @@ -393,15 +412,30 @@ private static Type extractEntityTypeFromReturnType(HttpResponseDecodeData decod * @return true if decodable, false otherwise. */ private static boolean isReturnTypeDecodable(HttpResponseDecodeData decodeData) { - Type returnType = decodeData.returnType(); + Type returnType = decodeData.getReturnType(); if (returnType == null) { return false; - } else { - return !FluxUtil.isFluxByteBuf(returnType) - && !(TypeUtil.isTypeOrSubTypeOf(returnType, Mono.class) && TypeUtil.isTypeOrSubTypeOf(TypeUtil.getTypeArgument(returnType), Void.class)) - && !TypeUtil.isTypeOrSubTypeOf(returnType, byte[].class) - && !TypeUtil.isTypeOrSubTypeOf(returnType, Void.TYPE) && !TypeUtil.isTypeOrSubTypeOf(returnType, Void.class); } + + // Unwrap from Mono + if (TypeUtil.isTypeOrSubTypeOf(returnType, Mono.class)) { + returnType = TypeUtil.getTypeArgument(returnType); + } + + // Find body for complex responses + if (TypeUtil.isTypeOrSubTypeOf(returnType, ResponseBase.class)) { + ParameterizedType parameterizedType = + (ParameterizedType) TypeUtil.getSuperType(returnType, ResponseBase.class); + if (parameterizedType.getActualTypeArguments().length == 2) { + // check body type + returnType = parameterizedType.getActualTypeArguments()[1]; + } + } + + return !FluxUtil.isFluxByteBuffer(returnType) + && !TypeUtil.isTypeOrSubTypeOf(returnType, byte[].class) + && !TypeUtil.isTypeOrSubTypeOf(returnType, Void.TYPE) + && !TypeUtil.isTypeOrSubTypeOf(returnType, Void.class); } /** @@ -428,8 +462,8 @@ private static boolean contains(int[] values, int searchValue) { * @return the validated response */ private static HttpResponse ensureRequestSet(HttpResponse httpResponse) { - Objects.requireNonNull(httpResponse.request()); - Objects.requireNonNull(httpResponse.request().httpMethod()); + Objects.requireNonNull(httpResponse.getRequest()); + Objects.requireNonNull(httpResponse.getRequest().getHttpMethod()); return httpResponse; } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseDecodeData.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseDecodeData.java index c6f7ae9f93f4..0dd45b7f9682 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseDecodeData.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseDecodeData.java @@ -22,7 +22,7 @@ public interface HttpResponseDecodeData { * * @return the return type */ - Type returnType(); + Type getReturnType(); /** * Get the type of the entity to be used to deserialize 'Matching' headers. @@ -30,13 +30,14 @@ public interface HttpResponseDecodeData { * The 'header entity' is optional and client can choose it when a strongly typed model is needed for headers. * * 'Matching' headers are the HTTP response headers those with: - * 1. header names same as name of a properties in the 'header entity'. - * 2. header names start with value of {@link HeaderCollection} annotation applied to the properties in the 'header entity'. + * 1. header names same as name of a properties in the 'header entity'. + * 2. header names start with value of {@link HeaderCollection} annotation applied to the properties in the 'header + * entity'. * * @return headers entity type */ - default Type headersType() { - Type token = this.returnType(); + default Type getHeadersType() { + Type token = this.getReturnType(); Type headersType = null; if (TypeUtil.isTypeOrSubTypeOf(token, Mono.class)) { @@ -59,7 +60,7 @@ default Type headersType() { * * @return the expected HTTP response status codes */ - default int[] expectedStatusCodes() { + default int[] getExpectedStatusCodes() { return null; } @@ -72,13 +73,13 @@ default int[] expectedStatusCodes() { * * @return the type that the raw HTTP response content will be sent as */ - default Type returnValueWireType() { + default Type getReturnValueWireType() { return null; } /** - * Get the {@link UnexpectedExceptionInformation} that will be used to generate a RestException if the HTTP response status - * code is not one of the expected status codes. + * Get the {@link UnexpectedExceptionInformation} that will be used to generate a RestException if the HTTP response + * status code is not one of the expected status codes. * * @param code Exception HTTP status code return from a REST API. * @return the UnexpectedExceptionInformation to generate an exception to throw or return. diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseDecoder.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseDecoder.java index 5248dbfccec0..50035a6e790b 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseDecoder.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseDecoder.java @@ -57,7 +57,8 @@ public static final class HttpDecodedResponse implements Closeable { * @param serializer the decoder * @param decodeData the necessary data required to decode a Http response */ - HttpDecodedResponse(final HttpResponse response, SerializerAdapter serializer, HttpResponseDecodeData decodeData) { + HttpDecodedResponse(final HttpResponse response, SerializerAdapter serializer, + HttpResponseDecodeData decodeData) { if (HttpResponseBodyDecoder.isDecodable(response, decodeData)) { this.response = response.buffer(); } else { @@ -70,7 +71,7 @@ public static final class HttpDecodedResponse implements Closeable { /** * @return get the raw response that this decoded response based on */ - public HttpResponse sourceResponse() { + public HttpResponse getSourceResponse() { return this.response; } @@ -81,11 +82,11 @@ public HttpResponse sourceResponse() { * * @return publisher that emits decoded http content */ - public Mono decodedBody() { + public Mono getDecodedBody() { if (this.bodyCached == null) { this.bodyCached = HttpResponseBodyDecoder.decode(this.response, - this.serializer, - this.decodeData).cache(); + this.serializer, + this.decodeData).cache(); } return this.bodyCached; } @@ -96,20 +97,20 @@ public Mono decodedBody() { * * @return publisher that emits entity instance representing decoded http headers */ - public Mono decodedHeaders() { + public Mono getDecodedHeaders() { if (this.headersCached == null) { this.headersCached = HttpResponseHeaderDecoder.decode(this.response, - this.serializer, - this.decodeData).cache(); + this.serializer, + this.decodeData).cache(); } return this.headersCached; } /** * @return the {@code java.lang.reflect.Type} used to decode the response body, - * null if the body is not decodable + * null if the body is not decodable */ - public Type decodedType() { + public Type getDecodedType() { return HttpResponseBodyDecoder.decodedType(this.response, this.decodeData); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseHeaderDecoder.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseHeaderDecoder.java index 1621f23e6ff5..62ead3f22515 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseHeaderDecoder.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/HttpResponseHeaderDecoder.java @@ -33,18 +33,22 @@ final class HttpResponseHeaderDecoder { * @param serializer the adapter to use for decoding * @param decodeData the necessary data required to decode a Http response * @return publisher that emits decoded response header upon subscription if header is decodable, - * no emission if the header is not-decodable + * no emission if the header is not-decodable */ - static Mono decode(HttpResponse httpResponse, SerializerAdapter serializer, HttpResponseDecodeData decodeData) { - Type headerType = decodeData.headersType(); + static Mono decode(HttpResponse httpResponse, SerializerAdapter serializer, + HttpResponseDecodeData decodeData) { + Type headerType = decodeData.getHeadersType(); if (headerType == null) { return Mono.empty(); } else { return Mono.defer(() -> { try { - return Mono.justOrEmpty(deserializeHeaders(httpResponse.headers(), serializer, decodeData)); + return Mono.justOrEmpty(deserializeHeaders(httpResponse.getHeaders(), serializer, decodeData)); } catch (IOException e) { - return Mono.error(new HttpResponseException("HTTP response has malformed headers", httpResponse, e)); + return Mono.error(new HttpResponseException( + "HTTP response has malformed headers", + httpResponse, + e)); } }); } @@ -55,11 +59,11 @@ static Mono decode(HttpResponse httpResponse, SerializerAdapter serializ * the model to hold 'Matching' headers. * * 'Matching' headers are the REST API returned headers those with: - * 1. header names same as name of a properties in the entity. - * 2. header names start with value of {@link HeaderCollection} annotation applied to the properties in the entity. + * 1. header names same as name of a properties in the entity. + * 2. header names start with value of {@link HeaderCollection} annotation applied to the properties in the entity. * - * When needed, the 'header entity' types must be declared as first generic argument of {@link ResponseBase} returned - * by java proxy method corresponding to the REST API. + * When needed, the 'header entity' types must be declared as first generic argument of {@link ResponseBase} + * returned by java proxy method corresponding to the REST API. * e.g. * {@code Mono> getMetadata(args);} * {@code @@ -74,16 +78,18 @@ static Mono decode(HttpResponse httpResponse, SerializerAdapter serializ * * @param headers the REST API returned headers * @return instance of header entity type created based on provided {@headers}, if header entity model does - * not exists then return null - * @throws IOException + * not exists then return null + * @throws IOException If an I/O error occurs */ - private static Object deserializeHeaders(HttpHeaders headers, SerializerAdapter serializer, HttpResponseDecodeData decodeData) throws IOException { - final Type deserializedHeadersType = decodeData.headersType(); + private static Object deserializeHeaders(HttpHeaders headers, SerializerAdapter serializer, + HttpResponseDecodeData decodeData) throws IOException { + final Type deserializedHeadersType = decodeData.getHeadersType(); if (deserializedHeadersType == null) { return null; } else { final String headersJsonString = serializer.serialize(headers, SerializerEncoding.JSON); - Object deserializedHeaders = serializer.deserialize(headersJsonString, deserializedHeadersType, SerializerEncoding.JSON); + Object deserializedHeaders = + serializer.deserialize(headersJsonString, deserializedHeadersType, SerializerEncoding.JSON); final Class deserializedHeadersClass = TypeUtil.getRawClass(deserializedHeadersType); final Field[] declaredFields = deserializedHeadersClass.getDeclaredFields(); @@ -92,16 +98,21 @@ private static Object deserializeHeaders(HttpHeaders headers, SerializerAdapter final Type declaredFieldType = declaredField.getGenericType(); if (TypeUtil.isTypeOrSubTypeOf(declaredField.getType(), Map.class)) { final Type[] mapTypeArguments = TypeUtil.getTypeArguments(declaredFieldType); - if (mapTypeArguments.length == 2 && mapTypeArguments[0] == String.class && mapTypeArguments[1] == String.class) { - final HeaderCollection headerCollectionAnnotation = declaredField.getAnnotation(HeaderCollection.class); - final String headerCollectionPrefix = headerCollectionAnnotation.value().toLowerCase(Locale.ROOT); + if (mapTypeArguments.length == 2 + && mapTypeArguments[0] == String.class + && mapTypeArguments[1] == String.class) { + final HeaderCollection headerCollectionAnnotation = + declaredField.getAnnotation(HeaderCollection.class); + final String headerCollectionPrefix = + headerCollectionAnnotation.value().toLowerCase(Locale.ROOT); final int headerCollectionPrefixLength = headerCollectionPrefix.length(); if (headerCollectionPrefixLength > 0) { final Map headerCollection = new HashMap<>(); for (final HttpHeader header : headers) { - final String headerName = header.name(); + final String headerName = header.getName(); if (headerName.toLowerCase(Locale.ROOT).startsWith(headerCollectionPrefix)) { - headerCollection.put(headerName.substring(headerCollectionPrefixLength), header.value()); + headerCollection.put(headerName.substring(headerCollectionPrefixLength), + header.getValue()); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/ItemPage.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/ItemPage.java index 48bcd6e5ca06..b9f7fa58aa19 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/ItemPage.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/ItemPage.java @@ -20,7 +20,7 @@ * "items": [{ serialized(T) }, ... ] * } * or any other cases where the property names of that type are swapped - * @param + * @param The type of the object stored within the {@link ItemPage} instance */ class ItemPage implements Page { @JsonAlias({"items", "value"}) @@ -30,12 +30,12 @@ class ItemPage implements Page { private String nextLink; @Override - public List items() { + public List getItems() { return items; } @Override - public String nextLink() { + public String getNextLink() { return nextLink; } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/AdditionalPropertiesDeserializer.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/AdditionalPropertiesDeserializer.java index 2da6cc7c88cd..cfa06e00c421 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/AdditionalPropertiesDeserializer.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/AdditionalPropertiesDeserializer.java @@ -45,7 +45,8 @@ final class AdditionalPropertiesDeserializer extends StdDeserializer imp * @param defaultDeserializer the default JSON mapperAdapter * @param mapper the object mapper for default deserializations */ - protected AdditionalPropertiesDeserializer(Class vc, JsonDeserializer defaultDeserializer, ObjectMapper mapper) { + protected AdditionalPropertiesDeserializer(Class vc, JsonDeserializer defaultDeserializer, + ObjectMapper mapper) { super(vc); this.defaultDeserializer = defaultDeserializer; this.mapper = mapper; @@ -62,14 +63,16 @@ public static SimpleModule getModule(final ObjectMapper mapper) { SimpleModule module = new SimpleModule(); module.setDeserializerModifier(new BeanDeserializerModifier() { @Override - public JsonDeserializer modifyDeserializer(DeserializationConfig config, BeanDescription beanDesc, JsonDeserializer deserializer) { + public JsonDeserializer modifyDeserializer(DeserializationConfig config, BeanDescription beanDesc, + JsonDeserializer deserializer) { for (Class c : TypeUtil.getAllClasses(beanDesc.getBeanClass())) { Field[] fields = c.getDeclaredFields(); for (Field field : fields) { if ("additionalProperties".equalsIgnoreCase(field.getName())) { JsonProperty property = field.getAnnotation(JsonProperty.class); if (property != null && property.value().isEmpty()) { - return new AdditionalPropertiesDeserializer(beanDesc.getBeanClass(), deserializer, mapper); + return new AdditionalPropertiesDeserializer(beanDesc.getBeanClass(), deserializer, + mapper); } } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/AdditionalPropertiesSerializer.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/AdditionalPropertiesSerializer.java index 429e7b95a855..b3bc17927d17 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/AdditionalPropertiesSerializer.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/AdditionalPropertiesSerializer.java @@ -65,7 +65,8 @@ public static SimpleModule getModule(final ObjectMapper mapper) { SimpleModule module = new SimpleModule(); module.setSerializerModifier(new BeanSerializerModifier() { @Override - public JsonSerializer modifySerializer(SerializationConfig config, BeanDescription beanDesc, JsonSerializer serializer) { + public JsonSerializer modifySerializer(SerializationConfig config, BeanDescription beanDesc, + JsonSerializer serializer) { for (Class c : TypeUtil.getAllClasses(beanDesc.getBeanClass())) { if (c.isAssignableFrom(Object.class)) { continue; @@ -120,7 +121,8 @@ public void resolve(SerializerProvider provider) throws JsonMappingException { } @Override - public void serializeWithType(Object value, JsonGenerator gen, SerializerProvider provider, TypeSerializer typeSerializer) throws IOException { + public void serializeWithType(Object value, JsonGenerator gen, SerializerProvider provider, + TypeSerializer typeSerializer) throws IOException { serialize(value, gen, provider); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/DateTimeRfc1123Serializer.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/DateTimeRfc1123Serializer.java index b8c493644e41..e56ff948b94e 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/DateTimeRfc1123Serializer.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/DateTimeRfc1123Serializer.java @@ -31,7 +31,7 @@ public static SimpleModule getModule() { @Override public void serialize(DateTimeRfc1123 value, JsonGenerator jgen, SerializerProvider provider) throws IOException { if (provider.isEnabled(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)) { - jgen.writeNumber(value.dateTime().toInstant().toEpochMilli()); + jgen.writeNumber(value.getDateTime().toInstant().toEpochMilli()); } else { jgen.writeString(value.toString()); //Use the default toString as it is RFC1123. } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/DurationSerializer.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/DurationSerializer.java index 6686c13318f6..540500c7e977 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/DurationSerializer.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/DurationSerializer.java @@ -28,7 +28,8 @@ public static SimpleModule getModule() { } @Override - public void serialize(Duration duration, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + public void serialize(Duration duration, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) + throws IOException { jsonGenerator.writeString(DurationSerializer.toString(duration)); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/FlatteningDeserializer.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/FlatteningDeserializer.java index 89e5a2bde882..bdf9120b75f7 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/FlatteningDeserializer.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/FlatteningDeserializer.java @@ -63,7 +63,8 @@ public static SimpleModule getModule(final ObjectMapper mapper) { SimpleModule module = new SimpleModule(); module.setDeserializerModifier(new BeanDeserializerModifier() { @Override - public JsonDeserializer modifyDeserializer(DeserializationConfig config, BeanDescription beanDesc, JsonDeserializer deserializer) { + public JsonDeserializer modifyDeserializer(DeserializationConfig config, BeanDescription beanDesc, + JsonDeserializer deserializer) { if (beanDesc.getBeanClass().getAnnotation(JsonFlatten.class) != null) { return new FlatteningDeserializer(beanDesc.getBeanClass(), deserializer, mapper); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/FlatteningSerializer.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/FlatteningSerializer.java index 1fd47d6f0823..f36993a2fbcc 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/FlatteningSerializer.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/FlatteningSerializer.java @@ -4,6 +4,7 @@ package com.azure.core.implementation.serializer.jackson; import com.azure.core.implementation.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.BeanDescription; import com.fasterxml.jackson.databind.JsonMappingException; @@ -41,6 +42,8 @@ * {'properties' : { 'name' : 'my_name' }} in the serialized payload. */ class FlatteningSerializer extends StdSerializer implements ResolvableSerializer { + private final ClientLogger logger = new ClientLogger(FlatteningSerializer.class); + /** * The default mapperAdapter for the current type. */ @@ -74,7 +77,8 @@ public static SimpleModule getModule(final ObjectMapper mapper) { SimpleModule module = new SimpleModule(); module.setSerializerModifier(new BeanSerializerModifier() { @Override - public JsonSerializer modifySerializer(SerializationConfig config, BeanDescription beanDesc, JsonSerializer serializer) { + public JsonSerializer modifySerializer(SerializationConfig config, BeanDescription beanDesc, + JsonSerializer serializer) { if (beanDesc.getBeanClass().getAnnotation(JsonFlatten.class) != null) { return new FlatteningSerializer(beanDesc.getBeanClass(), serializer, mapper); } @@ -105,10 +109,10 @@ private void escapeMapKeys(Object value) { } if (value.getClass().isPrimitive() - || value.getClass().isEnum() - || value instanceof OffsetDateTime - || value instanceof Duration - || value instanceof String) { + || value.getClass().isEnum() + || value instanceof OffsetDateTime + || value instanceof Duration + || value instanceof String) { return; } @@ -143,7 +147,7 @@ private void escapeMapKeys(Object value) { try { escapeMapKeys(f.get(value)); } catch (IllegalAccessException e) { - throw new RuntimeException(e); + throw logger.logExceptionAsError(new RuntimeException(e)); } } } @@ -203,8 +207,8 @@ public void serialize(Object value, JsonGenerator jgen, SerializerProvider provi source.add((ObjectNode) field.getValue()); target.add((ObjectNode) outNode); } else if (field.getValue() instanceof ArrayNode - && (field.getValue()).size() > 0 - && (field.getValue()).get(0) instanceof ObjectNode) { + && (field.getValue()).size() > 0 + && (field.getValue()).get(0) instanceof ObjectNode) { Iterator sourceIt = field.getValue().elements(); Iterator targetIt = outNode.elements(); while (sourceIt.hasNext()) { @@ -223,7 +227,8 @@ public void resolve(SerializerProvider provider) throws JsonMappingException { } @Override - public void serializeWithType(Object value, JsonGenerator gen, SerializerProvider provider, TypeSerializer typeSerializer) throws IOException { + public void serializeWithType(Object value, JsonGenerator gen, SerializerProvider provider, + TypeSerializer typeSerializer) throws IOException { serialize(value, gen, provider); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/JacksonAdapter.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/JacksonAdapter.java index abfe37c5caf6..59b4be3b3f4e 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/JacksonAdapter.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/JacksonAdapter.java @@ -7,6 +7,7 @@ import com.azure.core.implementation.serializer.MalformedValueException; import com.azure.core.implementation.serializer.SerializerAdapter; import com.azure.core.implementation.serializer.SerializerEncoding; +import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.core.JsonParseException; @@ -29,6 +30,8 @@ * Implementation of {@link SerializerAdapter} for Jackson. */ public class JacksonAdapter implements SerializerAdapter { + private final ClientLogger logger = new ClientLogger(JacksonAdapter.class); + /** * An instance of {@link ObjectMapper} to serialize/deserialize objects. */ @@ -156,7 +159,7 @@ public T deserialize(String value, final Type type, SerializerEncoding encod return (T) serializer().readValue(value, javaType); } } catch (JsonParseException jpe) { - throw new MalformedValueException(jpe.getMessage(), jpe); + throw logger.logExceptionAsError(new MalformedValueException(jpe.getMessage(), jpe)); } } @@ -202,9 +205,11 @@ private JavaType createJavaType(Type type) { for (int i = 0; i != actualTypeArguments.length; i++) { javaTypeArguments[i] = createJavaType(actualTypeArguments[i]); } - result = mapper.getTypeFactory().constructParametricType((Class) parameterizedType.getRawType(), javaTypeArguments); + result = mapper + .getTypeFactory().constructParametricType((Class) parameterizedType.getRawType(), javaTypeArguments); } else { - result = mapper.getTypeFactory().constructType(type); + result = mapper + .getTypeFactory().constructType(type); } return result; } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/tracing/ProcessKind.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/tracing/ProcessKind.java new file mode 100644 index 000000000000..36525024c9e9 --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/tracing/ProcessKind.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.core.implementation.tracing; + +/** + * Contains constants common AMQP protocol process calls. + * + */ +public enum ProcessKind { + /** + * Amqp Send Message process call to send data. + */ + SEND, + /** + * Amqp message process call to receive data. + */ + RECEIVE, + /** + * Custom process call to process received messages. + */ + PROCESS +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/tracing/Tracer.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/tracing/Tracer.java index b131ee76e199..2b7407a21f46 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/tracing/Tracer.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/tracing/Tracer.java @@ -19,12 +19,37 @@ public interface Tracer { String OPENTELEMETRY_SPAN_KEY = "opentelemetry-span"; /** - * Key for {@link Context} which indicates that the context contains the name for the OpenTelemetry spans that are created. + * Key for {@link Context} which indicates that the context contains the name for the OpenTelemetry spans that are + * created. * * If no span name is listed when the span is created it will default to using the calling method's name. */ String OPENTELEMETRY_SPAN_NAME_KEY = "opentelemetry-span-name"; + /** + * Key for {@link Context} which indicates that the context contains the Entity Path, remote endpoint path. + * + */ + String ENTITY_PATH = "entity-path"; + + /** + * 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 message Span Context. + * + */ + String SPAN_CONTEXT = "span-context"; + + /** + * Key for {@link Context} which indicates that the context contains the Diagnostic Id for the service call. + * + */ + String DIAGNOSTIC_ID_KEY = "diagnostic-id"; + /** * Creates a new tracing span. * @@ -38,6 +63,19 @@ public interface Tracer { */ Context start(String methodName, Context context); + /** + * 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 span will be created and added to the context and any downstream + * 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. + */ + Context start(String methodName, Context context, ProcessKind processKind); + /** * Completes the current tracing span. * @@ -47,6 +85,15 @@ public interface Tracer { */ void end(int responseCode, Throwable error, Context context); + /** + * Completes the current tracing span. + * + * @param errorCondition the error message that occurred during the call. + * @param error Potential throwable that happened during the span. + * @param context Additional metadata that is passed through the call stack. + */ + void end(String errorCondition, 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. @@ -95,4 +142,21 @@ public interface Tracer { * @return An updated context object. */ Context setSpanName(String spanName, Context context); + + /** + * Adds a link to the tracing span. + * Used in batching operations to relate multiple requests under a single batch. + * + * @param context Additional metadata that is passed through the call stack. + */ + void addLink(Context context); + + /** + * Extracts the span's {@link Context} from the given event's diagnostic id. + * + * @param diagnosticId Unique identifier for the trace information of the span. + * @param context Additional metadata that is passed through the call stack. + * @return An updated context object. + */ + Context extractContext(String diagnosticId, Context context); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/FluxUtil.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/FluxUtil.java index 032fed01998b..957b286e1ec1 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/FluxUtil.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/FluxUtil.java @@ -5,13 +5,17 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; -import io.netty.buffer.CompositeByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.util.ReferenceCountUtil; +import org.reactivestreams.Subscriber; +import org.reactivestreams.Subscription; +import reactor.core.CoreSubscriber; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.core.publisher.Operators; + +import java.io.ByteArrayOutputStream; import java.io.IOException; import java.lang.reflect.Type; +import java.nio.ByteBuffer; import java.nio.channels.AsynchronousFileChannel; import java.nio.channels.CompletionHandler; import java.util.Map; @@ -20,28 +24,21 @@ import java.util.concurrent.atomic.AtomicLongFieldUpdater; import java.util.function.Function; import java.util.stream.Collectors; -import org.reactivestreams.Subscriber; -import org.reactivestreams.Subscription; -import reactor.core.CoreSubscriber; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import reactor.core.publisher.MonoSink; -import reactor.core.publisher.Operators; /** * Utility type exposing methods to deal with {@link Flux}. */ public final class FluxUtil { /** - * Checks if a type is Flux<ByteBuf>. + * Checks if a type is Flux<ByteBuffer>. * * @param entityType the type to check - * @return whether the type represents a Flux that emits ByteBuf + * @return whether the type represents a Flux that emits ByteBuffer */ - public static boolean isFluxByteBuf(Type entityType) { + public static boolean isFluxByteBuffer(Type entityType) { if (TypeUtil.isTypeOrSubTypeOf(entityType, Flux.class)) { final Type innerType = TypeUtil.getTypeArguments(entityType)[0]; - if (TypeUtil.isTypeOrSubTypeOf(innerType, ByteBuf.class)) { + if (TypeUtil.isTypeOrSubTypeOf(innerType, ByteBuffer.class)) { return true; } } @@ -49,142 +46,45 @@ public static boolean isFluxByteBuf(Type entityType) { } /** - * Collects ByteBuf emitted by a Flux into a byte array. - * @param stream A stream which emits ByteBuf instances. - * @param autoReleaseEnabled if ByteBuf instances in stream gets automatically released as they consumed - * @return A Mono which emits the concatenation of all the ByteBuf instances given by the source Flux. + * Collects ByteBuffer emitted by a Flux into a byte array. + * + * @param stream A stream which emits ByteBuffer instances. + * @return A Mono which emits the concatenation of all the ByteBuffer instances given by the source Flux. */ - public static Mono collectBytesInByteBufStream(Flux stream, boolean autoReleaseEnabled) { - if (autoReleaseEnabled) { - // A stream is auto-release enabled means - the ByteBuf chunks in the stream get - // released as consumer consumes each chunk. - return Mono.using(Unpooled::compositeBuffer, - cbb -> stream.collect(() -> cbb, - (cbb1, buffer) -> cbb1.addComponent(true, Unpooled.wrappedBuffer(buffer).retain())), - ReferenceCountUtil::release) - .filter((CompositeByteBuf cbb) -> cbb.isReadable()) - .map(FluxUtil::byteBufToArray); - } else { - return stream.collect(Unpooled::compositeBuffer, - (cbb1, buffer) -> cbb1.addComponent(true, Unpooled.wrappedBuffer(buffer))) - .filter((CompositeByteBuf cbb) -> cbb.isReadable()) - .map(FluxUtil::byteBufToArray); - } + public static Mono collectBytesInByteBufferStream(Flux stream) { + return stream + .collect(ByteArrayOutputStream::new, FluxUtil::accept) + .map(ByteArrayOutputStream::toByteArray); } - /** - * Splits a ByteBuf into ByteBuf chunks. - * - * @param whole the ByteBuf to split - * @param chunkSize the maximum size of each ByteBuf chunk - * @return A stream that emits chunks of the original whole ByteBuf - */ - public static Flux split(final ByteBuf whole, final int chunkSize) { - return Flux.generate(whole::readerIndex, (readFromIndex, synchronousSync) -> { - final int writerIndex = whole.writerIndex(); - // - if (readFromIndex >= writerIndex) { - synchronousSync.complete(); - return writerIndex; - } else { - int readSize = Math.min(writerIndex - readFromIndex, chunkSize); - // Netty slice operation will not increment the ref count. - // - // Here we invoke 'retain' on each slice, since - // consumer of the returned Flux stream is responsible for - // releasing each chunk as it gets consumed. - // - synchronousSync.next(whole.slice(readFromIndex, readSize).retain()); - return readFromIndex + readSize; - } - }); + private static void accept(ByteArrayOutputStream byteOutputStream, ByteBuffer byteBuffer) { + try { + byteOutputStream.write(byteBufferToArray(byteBuffer)); + } catch (IOException e) { + throw new RuntimeException(e); + } } /** - * Gets the content of the provided ByteBuf as a byte array. - * This method will create a new byte array even if the ByteBuf can - * have optionally backing array. - * + * Gets the content of the provided ByteBuffer as a byte array. This method will create a new byte array even if the + * ByteBuffer can have optionally backing array. * - * @param byteBuf the byte buffer + * @param byteBuffer the byte buffer * @return the byte array */ - public static byte[] byteBufToArray(ByteBuf byteBuf) { - int length = byteBuf.readableBytes(); + public static byte[] byteBufferToArray(ByteBuffer byteBuffer) { + int length = byteBuffer.remaining(); byte[] byteArray = new byte[length]; - byteBuf.getBytes(byteBuf.readerIndex(), byteArray); + byteBuffer.get(byteArray); return byteArray; } - /** - * Collects byte buffers emitted by a Flux into a ByteBuf. - * - * @param stream A stream which emits ByteBuf instances. - * @param autoReleaseEnabled if ByteBuf instances in stream gets automatically released as they consumed - * @return A Mono which emits the concatenation of all the byte buffers given by the source Flux. - */ - public static Mono collectByteBufStream(Flux stream, boolean autoReleaseEnabled) { - if (autoReleaseEnabled) { - Mono mergedCbb = Mono.using( - // Resource supplier - () -> { - CompositeByteBuf initialCbb = Unpooled.compositeBuffer(); - return initialCbb; - }, - // source Mono creator - (CompositeByteBuf initialCbb) -> { - Mono reducedCbb = stream.reduce(initialCbb, (CompositeByteBuf currentCbb, ByteBuf nextBb) -> { - CompositeByteBuf updatedCbb = currentCbb.addComponent(nextBb.retain()); - return updatedCbb; - }); - // - return reducedCbb - .doOnNext((CompositeByteBuf cbb) -> cbb.writerIndex(cbb.capacity())) - .filter((CompositeByteBuf cbb) -> cbb.isReadable()); - }, - // Resource cleaner - (CompositeByteBuf finalCbb) -> finalCbb.release()); - return mergedCbb; - } else { - return stream.collect(Unpooled::compositeBuffer, - (cbb1, buffer) -> cbb1.addComponent(true, Unpooled.wrappedBuffer(buffer))) - .filter((CompositeByteBuf cbb) -> cbb.isReadable()) - .map(bb -> bb); - } - } - - private static final int DEFAULT_CHUNK_SIZE = 1024 * 64; - - /** - * Writes the bytes emitted by a Flux to an AsynchronousFileChannel. - * - * @param content the Flux content - * @param outFile the file channel - * @return a Completable which performs the write operation when subscribed - */ - public static Mono bytebufStreamToFile(Flux content, AsynchronousFileChannel outFile) { - return bytebufStreamToFile(content, outFile, 0); - } - - /** - * Writes the bytes emitted by a Flux to an AsynchronousFileChannel - * starting at the given position in the file. - * - * @param content the Flux content - * @param outFile the file channel - * @param position the position in the file to begin writing - * @return a Mono<Void> which performs the write operation when subscribed - */ - public static Mono bytebufStreamToFile(Flux content, AsynchronousFileChannel outFile, long position) { - return Mono.create(emitter -> content.subscribe(new ByteBufToFileSubscriber(outFile, position, emitter))); - } - /** * This method converts the incoming {@code subscriberContext} from {@link reactor.util.context.Context Reactor * Context} to {@link Context Azure Context} and calls the given lambda function with this context and returns a * single entity of type {@code T} *

- * If the reactor context is empty, {@link Context#NONE} will be used to call the lambda function + * If the reactor context is empty, {@link Context#NONE} will be used to call the lambda function *

* *

Code samples

@@ -203,11 +103,11 @@ public static Mono withContext(Function> serviceCall) { /** * Converts the incoming content to Mono. * - * @param response whose {@link Response#value() value} is to be converted + * @param response whose {@link Response#getValue() value} is to be converted * @return The converted {@link Mono} */ public static Mono toMono(Response response) { - return Mono.justOrEmpty(response.value()); + return Mono.justOrEmpty(response.getValue()); } /** @@ -215,11 +115,11 @@ public static Mono toMono(Response response) { * Context} to {@link Context Azure Context} and calls the given lambda function with this context and returns a * collection of type {@code T} *

- * If the reactor context is empty, {@link Context#NONE} will be used to call the lambda function + * If the reactor context is empty, {@link Context#NONE} will be used to call the lambda function *

* - *

Code samples

- * {@codesnippet com.azure.core.implementation.util.fluxutil.fluxcontext} + *

Code samples

+ * {@codesnippet com.azure.core.implementation.util.fluxutil.fluxcontext} * * @param serviceCall The lambda function that makes the service call into which the context will be passed * @param The type of response returned from the service call @@ -232,146 +132,148 @@ public static Flux fluxContext(Function> serviceCall) { } /** - * Converts a reactor context to azure context. If the reactor context is {@code null} or empty, - * {@link Context#NONE} will be returned. + * Converts a reactor context to azure context. If the reactor context is {@code null} or empty, {@link + * Context#NONE} will be returned. * * @param context The reactor context * @return The azure context */ private static Context toAzureContext(reactor.util.context.Context context) { - Map keyValues = context.stream() - .collect(Collectors.toMap(Entry::getKey, Entry::getValue)); + Map keyValues = context.stream().collect(Collectors.toMap(Entry::getKey, Entry::getValue)); if (ImplUtils.isNullOrEmpty(keyValues)) { return Context.NONE; } return Context.of(keyValues); } - private static class ByteBufToFileSubscriber implements Subscriber { - private ByteBufToFileSubscriber(AsynchronousFileChannel outFile, long position, MonoSink emitter) { - this.outFile = outFile; - this.pos = position; - this.emitter = emitter; - } - - // volatile ensures that writes to these fields by one thread will be immediately visible to other threads. - // An I/O pool thread will write to isWriting and read isCompleted, - // while another thread may read isWriting and write to isCompleted. - volatile boolean isWriting = false; - volatile boolean isCompleted = false; - volatile Subscription subscription; - volatile long pos; - AsynchronousFileChannel outFile; - MonoSink emitter; + /** + * Writes the bytes emitted by a Flux to an AsynchronousFileChannel. + * + * @param content the Flux content + * @param outFile the file channel + * @return a Mono which performs the write operation when subscribed + */ + public static Mono writeFile(Flux content, AsynchronousFileChannel outFile) { + return writeFile(content, outFile, 0); + } - @Override - public void onSubscribe(Subscription s) { - subscription = s; - s.request(1); - } + /** + * Writes the bytes emitted by a Flux to an AsynchronousFileChannel starting at the given position in the file. + * + * @param content the Flux content + * @param outFile the file channel + * @param position the position in the file to begin writing + * @return a Mono which performs the write operation when subscribed + */ + public static Mono writeFile(Flux content, AsynchronousFileChannel outFile, long position) { + return Mono.create(emitter -> content.subscribe(new Subscriber() { + // volatile ensures that writes to these fields by one thread will be immediately visible to other threads. + // An I/O pool thread will write to isWriting and read isCompleted, + // while another thread may read isWriting and write to isCompleted. + volatile boolean isWriting = false; + volatile boolean isCompleted = false; + volatile Subscription subscription; + volatile long pos = position; - @Override - public void onNext(ByteBuf bytes) { - isWriting = true; - outFile.write(bytes.nioBuffer(), pos, null, onWriteCompleted); - } + @Override + public void onSubscribe(Subscription s) { + subscription = s; + s.request(1); + } - CompletionHandler onWriteCompleted = new CompletionHandler() { @Override - public void completed(Integer bytesWritten, Object attachment) { - isWriting = false; - if (isCompleted) { - emitter.success(); - } - //noinspection NonAtomicOperationOnVolatileField - pos += bytesWritten; - if (subscription != null) { + public void onNext(ByteBuffer bytes) { + isWriting = true; + outFile.write(bytes, pos, null, onWriteCompleted); + } + + + CompletionHandler onWriteCompleted = new CompletionHandler() { + @Override + public void completed(Integer bytesWritten, Object attachment) { + isWriting = false; + if (isCompleted) { + emitter.success(); + } + //noinspection NonAtomicOperationOnVolatileField + pos += bytesWritten; subscription.request(1); } - } - @Override - public void failed(Throwable exc, Object attachment) { - if (subscription != null) { + @Override + public void failed(Throwable exc, Object attachment) { subscription.cancel(); + emitter.error(exc); } - emitter.error(exc); - } - }; + }; - @Override - public void onError(Throwable throwable) { - if (subscription != null) { + @Override + public void onError(Throwable throwable) { subscription.cancel(); + emitter.error(throwable); } - emitter.error(throwable); - } - @Override - public void onComplete() { - isCompleted = true; - if (!isWriting) { - emitter.success(); + @Override + public void onComplete() { + isCompleted = true; + if (!isWriting) { + emitter.success(); + } } - } + })); } - //region Utility methods to create Flux that read and emits chunks from AsynchronousFileChannel. - /** - * Creates a {@link Flux} from an {@link AsynchronousFileChannel} - * which reads part of a file into chunks of the given size. + * Creates a {@link Flux} from an {@link AsynchronousFileChannel} which reads part of a file into chunks of the + * given size. * * @param fileChannel The file channel. * @param chunkSize the size of file chunks to read. * @param offset The offset in the file to begin reading. * @param length The number of bytes to read from the file. - * @return the Flowable. + * @return the Flux. */ - public static Flux byteBufStreamFromFile(AsynchronousFileChannel fileChannel, int chunkSize, long offset, long length) { - return new ByteBufStreamFromFile(fileChannel, chunkSize, offset, length); + public static Flux readFile(AsynchronousFileChannel fileChannel, int chunkSize, long offset, + long length) { + return new FileReadFlux(fileChannel, chunkSize, offset, length); } /** - * Creates a {@link Flux} from an {@link AsynchronousFileChannel} - * which reads part of a file. + * Creates a {@link Flux} from an {@link AsynchronousFileChannel} which reads part of a file. * * @param fileChannel The file channel. * @param offset The offset in the file to begin reading. * @param length The number of bytes to read from the file. - * @return the Flowable. + * @return the Flux. */ - public static Flux byteBufStreamFromFile(AsynchronousFileChannel fileChannel, long offset, long length) { - return byteBufStreamFromFile(fileChannel, DEFAULT_CHUNK_SIZE, offset, length); + public static Flux readFile(AsynchronousFileChannel fileChannel, long offset, long length) { + return readFile(fileChannel, DEFAULT_CHUNK_SIZE, offset, length); } /** - * Creates a {@link Flux} from an {@link AsynchronousFileChannel} - * which reads the entire file. + * Creates a {@link Flux} from an {@link AsynchronousFileChannel} which reads the entire file. * * @param fileChannel The file channel. * @return The AsyncInputStream. */ - public static Flux byteBufStreamFromFile(AsynchronousFileChannel fileChannel) { + public static Flux readFile(AsynchronousFileChannel fileChannel) { try { long size = fileChannel.size(); - return byteBufStreamFromFile(fileChannel, DEFAULT_CHUNK_SIZE, 0, size); + return readFile(fileChannel, DEFAULT_CHUNK_SIZE, 0, size); } catch (IOException e) { return Flux.error(e); } } - //endregion - //region ByteBufStreamFromFile implementation - private static final class ByteBufStreamFromFile extends Flux { - private final ByteBufAllocator alloc; + private static final int DEFAULT_CHUNK_SIZE = 1024 * 64; + + private static final class FileReadFlux extends Flux { private final AsynchronousFileChannel fileChannel; private final int chunkSize; private final long offset; private final long length; - ByteBufStreamFromFile(AsynchronousFileChannel fileChannel, int chunkSize, long offset, long length) { - this.alloc = ByteBufAllocator.DEFAULT; + FileReadFlux(AsynchronousFileChannel fileChannel, int chunkSize, long offset, long length) { this.fileChannel = fileChannel; this.chunkSize = chunkSize; this.offset = offset; @@ -379,42 +281,44 @@ private static final class ByteBufStreamFromFile extends Flux { } @Override - public void subscribe(CoreSubscriber actual) { - FileReadSubscription subscription = new FileReadSubscription(actual, fileChannel, alloc, chunkSize, offset, length); + public void subscribe(CoreSubscriber actual) { + FileReadSubscription subscription = + new FileReadSubscription(actual, fileChannel, chunkSize, offset, length); actual.onSubscribe(subscription); } - static final class FileReadSubscription implements Subscription, CompletionHandler { + static final class FileReadSubscription implements Subscription, CompletionHandler { private static final int NOT_SET = -1; private static final long serialVersionUID = -6831808726875304256L; // - private final Subscriber subscriber; + private final Subscriber subscriber; private volatile long position; // private final AsynchronousFileChannel fileChannel; - private final ByteBufAllocator alloc; private final int chunkSize; private final long offset; private final long length; // private volatile boolean done; private Throwable error; - private volatile ByteBuf next; + private volatile ByteBuffer next; private volatile boolean cancelled; // volatile int wip; @SuppressWarnings("rawtypes") - static final AtomicIntegerFieldUpdater WIP = AtomicIntegerFieldUpdater.newUpdater(FileReadSubscription.class, "wip"); + static final AtomicIntegerFieldUpdater WIP = + AtomicIntegerFieldUpdater.newUpdater(FileReadSubscription.class, "wip"); volatile long requested; @SuppressWarnings("rawtypes") - static final AtomicLongFieldUpdater REQUESTED = AtomicLongFieldUpdater.newUpdater(FileReadSubscription.class, "requested"); + static final AtomicLongFieldUpdater REQUESTED = + AtomicLongFieldUpdater.newUpdater(FileReadSubscription.class, "requested"); // - FileReadSubscription(Subscriber subscriber, AsynchronousFileChannel fileChannel, ByteBufAllocator alloc, int chunkSize, long offset, long length) { + FileReadSubscription(Subscriber subscriber, AsynchronousFileChannel fileChannel, + int chunkSize, long offset, long length) { this.subscriber = subscriber; // this.fileChannel = fileChannel; - this.alloc = alloc; this.chunkSize = chunkSize; this.offset = offset; this.length = length; @@ -442,19 +346,19 @@ public void cancel() { //region CompletionHandler implementation @Override - public void completed(Integer bytesRead, ByteBuf buffer) { + public void completed(Integer bytesRead, ByteBuffer buffer) { if (!cancelled) { if (bytesRead == -1) { done = true; } else { // use local variable to perform fewer volatile reads long pos = position; - // int bytesWanted = Math.min(bytesRead, maxRequired(pos)); - buffer.writerIndex(bytesWanted); long position2 = pos + bytesWanted; //noinspection NonAtomicOperationOnVolatileField position = position2; + buffer.position(bytesWanted); + buffer.flip(); next = buffer; if (position2 >= offset + length) { done = true; @@ -465,7 +369,7 @@ public void completed(Integer bytesRead, ByteBuf buffer) { } @Override - public void failed(Throwable exc, ByteBuf attachment) { + public void failed(Throwable exc, ByteBuffer attachment) { if (!cancelled) { // must set error before setting done to true // so that is visible in drain loop @@ -495,19 +399,10 @@ private void drain() { boolean emitted = false; // read d before next to avoid race boolean d = done; - ByteBuf bb = next; + ByteBuffer bb = next; if (bb != null) { next = null; - // - // try { subscriber.onNext(bb); - // } finally { - // Note: Don't release here, we follow netty disposal pattern - // it's consumers responsiblity to release chunks after consumption. - // - // ReferenceCountUtil.release(bb); - // } - // emitted = true; } else { emitted = false; @@ -541,9 +436,8 @@ private void drain() { private void doRead() { // use local variable to limit volatile reads long pos = position; - int readSize = Math.min(chunkSize, maxRequired(pos)); - ByteBuf innerBuf = alloc.buffer(readSize, readSize); - fileChannel.read(innerBuf.nioBuffer(0, readSize), pos, innerBuf, this); + ByteBuffer innerBuf = ByteBuffer.allocate(Math.min(chunkSize, maxRequired(pos))); + fileChannel.read(innerBuf, pos, innerBuf, this); } private int maxRequired(long pos) { @@ -563,7 +457,6 @@ private int maxRequired(long pos) { } } - //endregion // Private Ctr private FluxUtil() { diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/ImplUtils.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/ImplUtils.java index 57e8f593632f..938cc02e712d 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/ImplUtils.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/ImplUtils.java @@ -147,11 +147,12 @@ public static T findFirstOfType(Object[] args, Class clazz) { * @param The type of the item being returned in the paged response. * @return The publisher holding all the generic items combined. */ - public static Publisher extractAndFetch(PagedResponse page, Context context, BiFunction> content) { - String nextPageLink = page.nextLink(); + public static Publisher extractAndFetch(PagedResponse page, Context context, + BiFunction> content) { + String nextPageLink = page.getNextLink(); if (nextPageLink == null) { - return Flux.fromIterable(page.items()); + return Flux.fromIterable(page.getItems()); } - return Flux.fromIterable(page.items()).concatWith(content.apply(nextPageLink, context)); + return Flux.fromIterable(page.getItems()).concatWith(content.apply(nextPageLink, context)); } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/ScopeUtil.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/ScopeUtil.java index 954c57846257..9184eb8ad0c8 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/ScopeUtil.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/ScopeUtil.java @@ -21,7 +21,8 @@ public final class ScopeUtil { public static String scopesToResource(String[] scopes) { Objects.requireNonNull(scopes); if (scopes.length != 1) { - throw new IllegalArgumentException("To convert to a resource string the specified array must be exactly length 1"); + throw new IllegalArgumentException( + "To convert to a resource string the specified array must be exactly length 1"); } if (!scopes[0].endsWith(DEFAULT_SUFFIX)) { diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/TypeUtil.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/TypeUtil.java index 0323961c2a7b..15876bcc2018 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/TypeUtil.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/TypeUtil.java @@ -84,7 +84,8 @@ public static Type getSuperType(Type type) { * with actual type arguments from the parameterized type */ Type[] superTypeArguments = getTypeArguments(genericSuperClass); - List typeParameters = Arrays.asList(((Class) parameterizedType.getRawType()).getTypeParameters()); + List typeParameters = + Arrays.asList(((Class) parameterizedType.getRawType()).getTypeParameters()); int j = 0; for (int i = 0; i != superTypeArguments.length; i++) { if (typeParameters.contains(superTypeArguments[i])) { @@ -132,7 +133,7 @@ public static Type getSuperType(Type subType, Class rawSuperType) { /** * Determines if a type is the same or a subtype for another type. - * + * * @param subType the supposed sub type * @param superType the supposed super type * @return true if the first type is the same or a subtype for the second type @@ -171,8 +172,8 @@ public Type getOwnerType() { } /** - * Returns whether the rest response expects to have any body (by checking if the body parameter type is set to Void, - * in which case no body is expected). + * Returns whether the rest response expects to have any body (by checking if the body parameter type is set to + * Void, in which case no body is expected). * * @param restResponseReturnType The RestResponse subtype containing the type arguments we are inspecting. * @return True if a body is expected, false if a Void body is expected. diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/Context.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/Context.java index bb58ed298737..2945cf00f5d4 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/Context.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/Context.java @@ -5,6 +5,8 @@ import com.azure.core.implementation.annotation.Immutable; import com.azure.core.implementation.util.ImplUtils; +import com.azure.core.util.logging.ClientLogger; + import java.util.Map; import java.util.Optional; @@ -16,6 +18,8 @@ */ @Immutable public class Context { + private final ClientLogger logger = new ClientLogger(Context.class); + // All fields must be immutable. // /** @@ -60,7 +64,7 @@ private Context(Context parent, Object key, Object value) { */ public Context addData(Object key, Object value) { if (key == null) { - throw new IllegalArgumentException("key cannot be null"); + throw logger.logExceptionAsError(new IllegalArgumentException("key cannot be null")); } return new Context(this, key, value); } @@ -99,7 +103,7 @@ public static Context of(Map keyValues) { */ public Optional getData(Object key) { if (key == null) { - throw new IllegalArgumentException("key cannot be null"); + throw logger.logExceptionAsError(new IllegalArgumentException("key cannot be null")); } for (Context c = this; c != null; c = c.parent) { if (key.equals(c.key)) { diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/ExpandableStringEnum.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/ExpandableStringEnum.java index 7f65ab94dfc5..075bbbd22a92 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/ExpandableStringEnum.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/ExpandableStringEnum.java @@ -17,7 +17,8 @@ * @param a specific expandable enum type */ public abstract class ExpandableStringEnum> { - private static ConcurrentMap> valuesByName = new ConcurrentHashMap<>(); + private static final ConcurrentMap> VALUES_BY_NAME = new ConcurrentHashMap<>(); private String name; private Class clazz; @@ -34,7 +35,7 @@ private static String uniqueKey(Class clazz, String name) { T nameValue(String name, T value, Class clazz) { this.name = name; this.clazz = clazz; - ((ConcurrentMap) valuesByName).put(uniqueKey(clazz, name), value); + ((ConcurrentMap) VALUES_BY_NAME).put(uniqueKey(clazz, name), value); return (T) this; } @@ -49,8 +50,8 @@ T nameValue(String name, T value, Class clazz) { protected static > T fromString(String name, Class clazz) { if (name == null) { return null; - } else if (valuesByName != null) { - T value = (T) valuesByName.get(uniqueKey(clazz, name)); + } else if (VALUES_BY_NAME != null) { + T value = (T) VALUES_BY_NAME.get(uniqueKey(clazz, name)); if (value != null) { return value; } @@ -73,7 +74,7 @@ protected static > T fromString(String name, C @SuppressWarnings("unchecked") protected static > Collection values(Class clazz) { // Make a copy of all values - Collection> values = new ArrayList<>(valuesByName.values()); + Collection> values = new ArrayList<>(VALUES_BY_NAME.values()); Collection list = new HashSet(); for (ExpandableStringEnum value : values) { diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/IterableStream.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/IterableStream.java new file mode 100644 index 000000000000..7c7d68551b50 --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/IterableStream.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.util; + +import reactor.core.publisher.Flux; + +import java.util.Iterator; +import java.util.stream.Stream; + +/** + * This class provides utility to iterate over values using standard 'for-each' style loops, or to convert them into a + * Stream and operate in that fashion. All the values are preserved even if they are traversed multiple times. + * + *

Code sample using Stream

+ * + * {@codesnippet com.azure.core.util.iterableStream.stream} + * + *

Code sample using Iterator

+ * + * {@codesnippet com.azure.core.util.iterableStream.iterator.while} + * + *

Code sample using Stream and filter

+ * + * {@codesnippet com.azure.core.util.iterableStream.stream.filter} + * + * @param The type of value in this {@link Iterable}. + * @see Iterable + */ +public class IterableStream implements Iterable { + private final Flux flux; + + /** + * Creates instance given {@link Flux}. + * @param flux to iterate over + */ + public IterableStream(Flux flux) { + this.flux = flux; + } + + /** + * Utility function to provide {@link Stream} of value T. + * It will provide same stream of T values if called multiple times. + * @return {@link Stream} of value T. + */ + public Stream stream() { + return flux.toStream(); + } + + /** + * Utility function to provide {@link Iterator} of value T. + * It will provide same collection of T values if called multiple times. + * @return {@link Iterator} of value T. + */ + @Override + public Iterator iterator() { + return flux.toIterable().iterator(); + } + +} diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/configuration/Configuration.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/configuration/Configuration.java index f4f4365af3c0..b561987700e1 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/configuration/Configuration.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/configuration/Configuration.java @@ -24,13 +24,14 @@ public class Configuration implements Cloneable { private final ClientLogger logger = new ClientLogger(Configuration.class); - private ConcurrentMap configurations = new ConcurrentHashMap<>(); + private final ConcurrentMap configurations; private boolean loadedBaseConfigurations = false; /** * Constructs an empty configuration. */ public Configuration() { + this.configurations = new ConcurrentHashMap<>(); } private Configuration(ConcurrentMap configurations) { diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/configuration/ConfigurationManager.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/configuration/ConfigurationManager.java index 4f74b634d1b2..6ff272ab05a2 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/configuration/ConfigurationManager.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/configuration/ConfigurationManager.java @@ -7,12 +7,12 @@ * Manages the global configuration store. */ public final class ConfigurationManager { - private static Configuration configuration = new Configuration(); + private static final Configuration CONFIGURATION = new Configuration(); /** * @return the global configuration store. */ public static Configuration getConfiguration() { - return configuration; + return CONFIGURATION; } } 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 6d278ce243f8..00ed223971ad 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 @@ -16,8 +16,8 @@ * This is a fluent logger helper class that wraps a plug-able {@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.

+ * 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.

* *

A minimum logging level threshold is determined by the {@link BaseConfigurations#AZURE_LOG_LEVEL AZURE_LOG_LEVEL} * environment configuration, by default logging is disabled.

@@ -218,11 +218,13 @@ private void performLogging(int logLevel, String format, Object... args) { /* * Helper method that determines if logging is enabled at a given level. * @param level Logging level - * @return True if the logging level is higher than the minimum logging level and if logging is enabled at the given level. + * @return True if the logging level is higher than the minimum logging level and if logging is enabled at the + * given level. */ private boolean canLogAtLevel(int level) { // Check the configuration level every time the logger is called in case it has changed. - int configurationLevel = ConfigurationManager.getConfiguration().get(BaseConfigurations.AZURE_LOG_LEVEL, DISABLED_LEVEL); + int configurationLevel = + ConfigurationManager.getConfiguration().get(BaseConfigurations.AZURE_LOG_LEVEL, DISABLED_LEVEL); if (level < configurationLevel) { return false; } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/util/polling/PollResponse.java b/sdk/core/azure-core/src/main/java/com/azure/core/util/polling/PollResponse.java index e5d4254c9573..13b0f709b227 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/util/polling/PollResponse.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/util/polling/PollResponse.java @@ -10,18 +10,17 @@ import java.util.Objects; /** - * PollResponse represents a single response from a service for a long-running polling operation. It provides information such as - * the current {@link OperationStatus status} of the long-running operation, any {@link #getValue value} returned in the poll, as well - * as other useful information provided by the service. + * PollResponse represents a single response from a service for a long-running polling operation. It provides + * information such as the current {@link OperationStatus status} of the long-running operation, any + * {@link #getValue value} returned in the poll, as well as other useful information provided by the service. * - *

Code Sample Creating PollResponse Object

+ *

Code Sample Creating PollResponse Object

* {@codesnippet com.azure.core.util.polling.pollresponse.status.value} * *

Code Sample Creating PollResponse Object with custom status

* {@codesnippet com.azure.core.util.polling.pollresponse.custom.status.value} * * @param Type of poll response value. - * * @see OperationStatus * @see Poller */ @@ -34,26 +33,30 @@ public final class PollResponse { /** * An enum to represent all possible states that a long-running operation may find itself in. - * The poll operation is considered complete when the status is one of {@code SUCCESSFULLY_COMPLETED}, {@code USER_CANCELLED} or {@code FAILED}. + * The poll operation is considered complete when the status is one of {@code SUCCESSFULLY_COMPLETED}, + * {@code USER_CANCELLED} or {@code FAILED}. */ public static final class OperationStatus extends ExpandableStringEnum { - /** Represents that polling has not yet started for this long-running operation.*/ + /** Represents that polling has not yet started for this long-running operation. */ public static final OperationStatus NOT_STARTED = fromString("NOT_STARTED"); - /** Represents that this long-running operation is in progress and not yet complete.*/ + /** Represents that this long-running operation is in progress and not yet complete. */ public static final OperationStatus IN_PROGRESS = fromString("IN_PROGRESS"); - /** Represent that this long-running operation is completed successfully.*/ + /** Represent that this long-running operation is completed successfully. */ public static final OperationStatus SUCCESSFULLY_COMPLETED = fromString("SUCCESSFULLY_COMPLETED"); /** * Represents that this long-running operation has failed to successfully complete, however this is still - * considered as complete long-running operation, meaning that the {@link Poller} instance will report that it is complete. + * considered as complete long-running operation, meaning that the {@link Poller} instance will report that it + * is complete. */ public static final OperationStatus FAILED = fromString("FAILED"); - /** Represents that this long-running operation is cancelled by user, however this is still - * considered as complete long-running operation.*/ + /** + * Represents that this long-running operation is cancelled by user, however this is still + * considered as complete long-running operation. + */ public static final OperationStatus USER_CANCELLED = fromString("USER_CANCELLED"); /** @@ -73,13 +76,16 @@ public static OperationStatus fromString(String name) { * {@codesnippet com.azure.core.util.polling.pollresponse.status.value.retryAfter.properties} * * @param status Mandatory operation status as defined in {@link OperationStatus}. - * @param value The value as a result of poll operation. This can be any custom user-defined object. Null is also valid. - * @param retryAfter Represents the delay the service has requested until the next polling operation is performed. - * A {@code null}, zero or negative value will be taken to mean that the {@link Poller} should determine on its own when the next poll operation is to occur. - * @param properties A map of properties provided by the service that will be made available into the next poll operation. + * @param value The value as a result of poll operation. This can be any custom user-defined object. Null is also + * valid. + * @param retryAfter Represents the delay the service has requested until the next polling operation is performed. A + * {@code null}, zero or negative value will be taken to mean that the {@link Poller} should determine on its + * own when the next poll operation is to occur. + * @param properties A map of properties provided by the service that will be made available into the next poll + * operation. * @throws NullPointerException If {@code status} is {@code null}. */ - public PollResponse(OperationStatus status, T value, Duration retryAfter, Map properties) { + public PollResponse(OperationStatus status, T value, Duration retryAfter, Map properties) { Objects.requireNonNull(status, "The status input parameter cannot be null."); this.status = status; this.value = value; @@ -94,9 +100,11 @@ public PollResponse(OperationStatus status, T value, Duration retryAfter, MapCode Sample Creating PollResponse Object

+ *

Code Sample Creating PollResponse Object

* {@codesnippet com.azure.core.util.polling.pollresponse.status.value} * * @param status Mandatory operation status as defined in {@link OperationStatus}. - * @param value The value as a result of poll operation. This can be any custom user-defined object. Null is also valid. + * @param value The value as a result of poll operation. This can be any custom user-defined object. Null is also + * valid. * @throws NullPointerException If {@code status} is {@code null}. */ public PollResponse(OperationStatus status, T value) { @@ -136,17 +145,20 @@ public T getValue() { } /** - * Returns the delay the service has requested until the next polling operation is performed. A null or negative value will be - * taken to mean that the {@link Poller} should determine on its own when the next poll operation is to occur. + * Returns the delay the service has requested until the next polling operation is performed. A null or negative + * value will be taken to mean that the {@link Poller} should determine on its own when the next poll operation is + * to occur. * @return Duration How long to wait before next retry. */ public Duration getRetryAfter() { - return retryAfter; + return retryAfter; } /** * A map of properties provided by the service that will be made available into the next poll operation. - * @return Map of properties that were returned from the service, and which will be made available into the next poll operation. + * + * @return Map of properties that were returned from the service, and which will be made available into the next + * poll operation. */ public Map getProperties() { return properties; 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 e20d7d32f5f5..0050f79f6d4d 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 @@ -17,7 +17,7 @@ * 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. *

- * It provides the following functionality: + * It provides the following functionality: * *

    *
  • Querying the current state of long-running operations.
  • @@ -28,17 +28,23 @@ *
* *

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

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

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. + *

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

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}. + *

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. + * + *

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}. * *

Code Samples

* @@ -49,7 +55,7 @@ * {@codesnippet com.azure.core.util.polling.poller.block} * *

Disable auto polling and polling manually

- * {@codesnippet com.azure.core.util.polling.poller.poll} + * {@codesnippet com.azure.core.util.polling.poller.poll-manually} * * @param Type of poll response value * @see PollResponse @@ -59,15 +65,16 @@ public class Poller { private final ClientLogger logger = new ClientLogger(Poller.class); /* - * poll operation is a function that takes the previous PollResponse, and - * returns a new Mono of PollResponse to represent the current state + * poll operation is a function that takes the previous PollResponse, and returns a new Mono of PollResponse to + * represent the current state */ private final Function, Mono>> pollOperation; /* - * poll interval before next auto poll. This value will be used if the PollResponse does not include retryAfter from the service. + * poll interval before next auto poll. This value will be used if the PollResponse does not include retryAfter + * from the service. */ - private Duration pollInterval; + private final Duration pollInterval; /* * This will save last poll response. @@ -77,7 +84,7 @@ public class Poller { /* * This will be called when cancel operation is triggered. */ - private Consumer> cancelOperation; + private final Consumer> cancelOperation; /* * Indicate to poll automatically or not when poller is created. @@ -90,37 +97,63 @@ public class Poller { * This could be shared among many subscriber. One of the subscriber will be this poller itself. * Once subscribed, this Flux will continue to poll for status until poll operation is done/complete. */ - private Flux> fluxHandle; + private final Flux> fluxHandle; /* - * Since constructor create a subscriber and start auto polling. - * This handle will be used to dispose the subscriber when - * client disable auto polling. + * Since constructor create a subscriber and start auto polling. This handle will be used to dispose the subscriber + * when client disable auto polling. */ private Disposable fluxDisposable; /** - * Create 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}. + * Create 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

* {@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. - * @throws IllegalArgumentException if {@code pollInterval} is less than or equal to zero and if {@code pollInterval} or {@code pollOperation} are {@code null} + * @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. + * @throws IllegalArgumentException if {@code pollInterval} is less than or equal to zero and if + * {@code pollInterval} or {@code pollOperation} are {@code null} */ public Poller(Duration pollInterval, Function, Mono>> pollOperation) { + this(pollInterval, pollOperation, null); + } + + /** + * Create a {@link Poller} instance with poll interval, poll operation and cancel operation. The polling starts + * immediately by invoking {@code pollOperation}. The next poll cycle will be defined by retryAfter value in + * {@link PollResponse}. In absence of {@link PollResponse#getRetryAfter()}, the {@link Poller} will use + * {@code pollInterval}. + * + * @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 handle it 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 cancelOperation cancel operation if cancellation is supported by the service. It can be {@code null} which + * will indicate to the {@link Poller} that cancel operation is not supported by Azure service. + * @throws IllegalArgumentException if {@code pollInterval} is less than or equal to zero and if + * {@code pollInterval} or {@code pollOperation} are {@code null} + */ + public Poller(Duration pollInterval, Function, Mono>> pollOperation, + Consumer> cancelOperation) { if (pollInterval == null || pollInterval.toNanos() <= 0) { - throw logger.logExceptionAsWarning(new IllegalArgumentException("Null, negative or zero value for poll interval is not allowed.")); + throw logger.logExceptionAsWarning(new IllegalArgumentException( + "Null, negative or zero value for poll interval is not allowed.")); } if (pollOperation == null) { - throw logger.logExceptionAsWarning(new IllegalArgumentException("Null value for poll operation is not allowed.")); + throw logger.logExceptionAsWarning(new IllegalArgumentException( + "Null value for poll operation is not allowed.")); } this.pollInterval = pollInterval; @@ -136,31 +169,12 @@ public Poller(Duration pollInterval, Function, Mono, Mono>> pollOperation, Consumer> cancelOperation) { - this(pollInterval, pollOperation); this.cancelOperation = cancelOperation; } /** - * Attempts to cancel the long-running operation that this {@link Poller} represents. This is possible only if the service supports it, - * otherwise an {@code UnsupportedOperationException} will be thrown. + * Attempts to cancel the long-running operation that this {@link Poller} represents. This is possible only if the + * service supports it, otherwise an {@code UnsupportedOperationException} will be thrown. *

* It will call cancelOperation if status is {@link OperationStatus#IN_PROGRESS} otherwise it does nothing. * @@ -168,7 +182,8 @@ public Poller(Duration pollInterval, Function, Mono> getObserver() { * *

Manual Polling

*

- * {@codesnippet com.azure.core.util.polling.poller.poll.indepth} + * {@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 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. */ public Mono> poll() { return this.pollOperation.apply(this.pollResponse) @@ -214,7 +229,8 @@ public Mono> poll() { } /** - * Blocks execution and wait for polling to complete. The polling is considered complete based on status defined in {@link OperationStatus}. + * 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. * * @return returns final {@link PollResponse} when polling is complete as defined in {@link OperationStatus}. @@ -228,7 +244,9 @@ 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. + * + * @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. * @throws IllegalArgumentException If {@code statusToBlockFor} is {@code null}. */ @@ -237,36 +255,45 @@ 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. - * @param statusToBlockFor The desired {@link OperationStatus} to block for and it can be any valid {@link OperationStatus} value. - * @param timeout The time after which it will stop blocking. A {@code null} value will cause to block indefinitely. Zero or negative are not valid values. + * 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. + * + * @param statusToBlockFor The desired {@link OperationStatus} to block for and it can be any valid + * {@link OperationStatus} value. + * @param timeout The time after which it will stop blocking. A {@code null} value will cause to block + * indefinitely. Zero or negative are not valid values. * @return {@link PollResponse} for matching desired status to block for. - * @throws IllegalArgumentException if {@code timeout} is zero or negative and if {@code statusToBlockFor} is {@code null}. + * @throws IllegalArgumentException if {@code timeout} is zero or negative and if {@code statusToBlockFor} is + * {@code null}. */ public PollResponse blockUntil(OperationStatus statusToBlockFor, Duration timeout) { if (statusToBlockFor == null) { throw logger.logExceptionAsWarning(new IllegalArgumentException("Null value for status is not allowed.")); } if (timeout != null && timeout.toNanos() <= 0) { - throw logger.logExceptionAsWarning(new IllegalArgumentException("Negative or zero value for timeout is not allowed.")); + throw logger.logExceptionAsWarning(new IllegalArgumentException( + "Negative or zero value for timeout is not allowed.")); } if (!isAutoPollingEnabled()) { setAutoPollingEnabled(true); } if (timeout != null) { - return this.fluxHandle.filter(tPollResponse -> matchStatus(tPollResponse, statusToBlockFor)).blockFirst(timeout); + return this.fluxHandle + .filter(tPollResponse -> matchStatus(tPollResponse, statusToBlockFor)).blockFirst(timeout); } else { - return this.fluxHandle.filter(tPollResponse -> matchStatus(tPollResponse, statusToBlockFor)).blockFirst(); + return this.fluxHandle + .filter(tPollResponse -> matchStatus(tPollResponse, statusToBlockFor)).blockFirst(); } } /* - * Indicate that the @{link PollResponse} matches with the status to block for. + * Indicate that the {@link PollResponse} matches with the status to block for. * @param currentPollResponse The poll response which we have received from the flux. - * @param statusToBlockFor The {@link OperationStatus} to block and it can be any valid {@link OperationStatus} value. + * @param statusToBlockFor The {@link OperationStatus} to block and it can be any valid {@link OperationStatus} + * value. * @return True if the {@link PollResponse} return status matches the status to block for. */ - private boolean matchStatus(PollResponse currentPollResponse, OperationStatus statusToBlockFor) { + private boolean matchStatus(PollResponse currentPollResponse, OperationStatus statusToBlockFor) { // perform validation if (currentPollResponse == null || statusToBlockFor == null) { return false; @@ -279,7 +306,7 @@ private boolean matchStatus(PollResponse currentPollResponse, OperationStatu /* * This function will apply delay and call poll operation function async. - * We expect Mono from pollOperation should never return Mono.error() . If any unexpected + * We expect Mono from pollOperation should never return Mono.error(). If any unexpected * scenario happens in pollOperation, it should catch it and return a valid PollResponse. * This is because poller does not know what to do in case on Mono.error. * This function will return empty mono in case of Mono.error() returned by poll operation. @@ -311,7 +338,8 @@ private Duration getCurrentDelay() { } /** - * Controls whether auto-polling is enabled or disabled. Refer to the {@link Poller} class-level JavaDoc for more details on auto-polling. + * Controls whether auto-polling is enabled or disabled. Refer to the {@link Poller} class-level JavaDoc for more + * details on auto-polling. * *

Disable auto polling

* {@codesnippet com.azure.core.util.polling.poller.disableautopolling} @@ -319,8 +347,8 @@ private Duration getCurrentDelay() { *

Enable auto polling

* {@codesnippet com.azure.core.util.polling.poller.enableautopolling} * - * @param autoPollingEnabled If true, auto-polling will occur transparently in the background, otherwise it requires - * manual polling by the user to get the latest state. + * @param autoPollingEnabled If true, auto-polling will occur transparently in the background, otherwise it + * requires manual polling by the user to get the latest state. */ public final void setAutoPollingEnabled(boolean autoPollingEnabled) { this.autoPollingEnabled = autoPollingEnabled; @@ -359,7 +387,9 @@ private boolean activeSubscriber() { } /** - * Indicates if auto polling is enabled. Refer to the {@link Poller} class-level JavaDoc for more details on auto-polling. + * 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.. */ public boolean isAutoPollingEnabled() { diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/IterableResponseJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/IterableResponseJavaDocCodeSnippets.java deleted file mode 100644 index 9ccdd4157ed4..000000000000 --- a/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/IterableResponseJavaDocCodeSnippets.java +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.http.rest; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpMethod; -import com.azure.core.http.HttpRequest; -import com.azure.core.implementation.http.PagedResponseBase; -import reactor.core.publisher.Flux; - -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Iterator; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.IntStream; - -/** - * Code snippets for {@link IterableResponse} - */ -public class IterableResponseJavaDocCodeSnippets { - - /** - * Iterate over {@link java.util.stream.Stream} - * @throws MalformedURLException if can not create URL object. - */ - public void streamSnippet() throws MalformedURLException { - HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1") - .put("header2", "value2"); - HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, new URL("http://localhost")); - - String deserializedHeaders = "header1,value1,header2,value2"; - - IterableResponse> myIterableResponse = - new IterableResponse<>(Flux.just(createPagedResponse(httpRequest, httpHeaders, deserializedHeaders, 1, 3))); - - // BEGIN: com.azure.core.http.rest.iterableResponse.stream - // process the stream - myIterableResponse.stream().forEach(resp -> { - if (resp.statusCode() == HttpURLConnection.HTTP_OK) { - System.out.printf("Response headers are %s. Url %s%n", resp.deserializedHeaders(), resp.request().url()); - resp.items().forEach(value -> { - System.out.printf("Response value is %d%n", value); - }); - } - }); - // END: com.azure.core.http.rest.iterableResponse.stream - } - - /** - * Iterate with {@link Iterator} interface. - * @throws MalformedURLException if can not create URL object. - */ - public void iteratorwhileSnippet() throws MalformedURLException { - HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1") - .put("header2", "value2"); - HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, new URL("http://localhost")); - - String deserializedHeaders = "header1,value1,header2,value2"; - - IterableResponse> myIterableResponse = - new IterableResponse<>(Flux.just(createPagedResponse(httpRequest, httpHeaders, deserializedHeaders, 1, 3))); - - // BEGIN: com.azure.core.http.rest.iterableResponse.iterator.while - // Iterate over iterator - Iterator> ite = myIterableResponse.iterator(); - while (ite.hasNext()) { - PagedResponseBase resp = ite.next(); - if (resp.statusCode() == HttpURLConnection.HTTP_OK) { - System.out.printf("Response headers are %s. Url %s%n", resp.deserializedHeaders(), resp.request().url()); - resp.items().forEach(value -> { - System.out.printf("Response value is %d%n", value); - }); - } - } - // END: com.azure.core.http.rest.iterableResponse.iterator.while - } - - /** - * Iterate over {@link java.util.stream.Stream} - * @throws MalformedURLException if can not create URL object. - */ - public void iteratorStreamFilterSnippet() throws MalformedURLException { - HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1") - .put("header2", "value2"); - HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, new URL("http://localhost")); - - String deserializedHeaders = "header1,value1,header2,value2"; - - IterableResponse> myIterableResponse = - new IterableResponse<>(Flux.just(createPagedResponse(httpRequest, httpHeaders, deserializedHeaders, 1, 3))); - - // BEGIN: com.azure.core.http.rest.iterableResponse.stream.filter - // process the stream - myIterableResponse.stream().filter(resp -> resp.statusCode() == HttpURLConnection.HTTP_OK) - .limit(10) - .forEach(resp -> { - System.out.printf("Response headers are %s. Url %s%n", resp.deserializedHeaders(), resp.request().url()); - resp.items().forEach(value -> { - System.out.printf("Response value is %d%n", value); - }); - }); - // END: com.azure.core.http.rest.iterableResponse.stream.filter - } - - private PagedResponseBase createPagedResponse(HttpRequest httpRequest, HttpHeaders httpHeaders, - String deserializedHeaders, int i, int noOfPages) { - return new PagedResponseBase<>(httpRequest, HttpURLConnection.HTTP_OK, - httpHeaders, - getItems(i), - i < noOfPages - 1 ? String.valueOf(i + 1) : null, - deserializedHeaders); - } - - private List getItems(Integer i) { - return IntStream.range(i * 3, i * 3 + 3).boxed().collect(Collectors.toList()); - } -} diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxBaseJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxBaseJavaDocCodeSnippets.java new file mode 100644 index 000000000000..128e00958dda --- /dev/null +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxBaseJavaDocCodeSnippets.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.rest; + +import reactor.core.CoreSubscriber; +import reactor.core.publisher.Mono; + +import java.util.function.Function; +import java.util.function.Supplier; + +/** + * Code snippets for {@link PagedFluxBase} + */ +public final class PagedFluxBaseJavaDocCodeSnippets { + + /** + * Code snippets for showing usage of {@link PagedFluxBase} in class docs + */ + public void classDocSnippet() { + PagedFluxBase> pagedFluxBase = createAnInstance(); + // BEGIN: com.azure.core.http.rest.pagedfluxbase.items + // Subscribe to process one item at a time + pagedFluxBase + .log() + .doOnSubscribe( + ignoredVal -> System.out.println("Subscribed to paged flux processing items")) + .doOnNext(item -> System.out.println("Processing item " + item)) + .doOnComplete(() -> System.out.println("Completed processing")) + .subscribe(); + // END: com.azure.core.http.rest.pagedfluxbase.items + + // BEGIN: com.azure.core.http.rest.pagedfluxbase.pages + // Subscribe to process one page at a time from the beginning + pagedFluxBase + .byPage() + .log() + .doOnSubscribe(ignoredVal -> System.out + .println("Subscribed to paged flux processing pages starting from first page")) + .doOnNext(page -> System.out.println("Processing page containing " + page.getItems())) + .doOnComplete(() -> System.out.println("Completed processing")) + .subscribe(); + // END: com.azure.core.http.rest.pagedfluxbase.pages + + // BEGIN: com.azure.core.http.rest.pagedfluxbase.pagesWithContinuationToken + // Subscribe to process one page at a time starting from a page associated with + // a continuation token + String continuationToken = getContinuationToken(); + pagedFluxBase + .byPage(continuationToken) + .log() + .doOnSubscribe(ignoredVal -> System.out + .println("Subscribed to paged flux processing pages starting from first page")) + .doOnNext(page -> System.out.println("Processing page containing " + page.getItems())) + .doOnComplete(() -> System.out.println("Completed processing")) + .subscribe(); + // END: com.azure.core.http.rest.pagedfluxbase.pagesWithContinuationToken + } + /** + * Code snippets for creating an instance of {@link PagedFluxBase} + * @return An instance of {@link PagedFluxBase} + */ + public PagedFluxBase> createAnInstance() { + + // BEGIN: com.azure.core.http.rest.pagedfluxbase.instantiation + // A supplier that fetches the first page of data from source/service + Supplier>> firstPageRetriever = () -> getFirstPage(); + + // A function that fetches subsequent pages of data from source/service given a continuation token + Function>> nextPageRetriever = + continuationToken -> getNextPage(continuationToken); + + PagedFluxBase> pagedFluxBase = new PagedFluxBase<>(firstPageRetriever, + nextPageRetriever); + // END: com.azure.core.http.rest.pagedfluxbase.instantiation + + // BEGIN: com.azure.core.http.rest.pagedfluxbase.singlepage.instantiation + // A supplier that fetches the first page of data from source/service + Supplier>> firstPageRetrieverFunction = () -> getFirstPage(); + + PagedFluxBase> pagedFluxBaseInstance = new PagedFluxBase<>(firstPageRetrieverFunction, + nextPageRetriever); + // END: com.azure.core.http.rest.pagedfluxbase.singlepage.instantiation + return pagedFluxBase; + } + + /** + * Code snippets for using {@link PagedFluxBase#byPage()} and {@link PagedFluxBase#byPage(String)} + */ + public void byPageSnippet() { + PagedFluxBase> pagedFluxBase = createAnInstance(); + + // BEGIN: com.azure.core.http.rest.pagedfluxbase.bypage + // Start processing the results from first page + pagedFluxBase.byPage() + .log() + .doOnSubscribe(ignoredVal -> System.out + .println("Subscribed to paged flux processing pages starting from first page")) + .doOnNext(page -> System.out.println("Processing page containing " + page.getItems())) + .doOnComplete(() -> System.out.println("Completed processing")) + .subscribe(); + // END: com.azure.core.http.rest.pagedfluxbase.bypage + + // BEGIN: com.azure.core.http.rest.pagedfluxbase.bypage#String + // Start processing the results from a page associated with the continuation token + String continuationToken = getContinuationToken(); + pagedFluxBase.byPage(continuationToken) + .log() + .doOnSubscribe(ignoredVal -> System.out.println( + "Subscribed to paged flux processing page starting from " + continuationToken)) + .doOnNext(page -> System.out.println("Processing page containing " + page.getItems())) + .doOnComplete(() -> System.out.println("Completed processing")) + .subscribe(); + // END: com.azure.core.http.rest.pagedfluxbase.bypage#String + } + + /** + * Code snippets for using {@link PagedFluxBase#subscribe(CoreSubscriber)} + */ + public void byTSnippet() { + PagedFluxBase> pagedFluxBase = createAnInstance(); + + // BEGIN: com.azure.core.http.rest.pagedfluxbase.subscribe + pagedFluxBase.log() + .doOnSubscribe(ignoredVal -> System.out.println("Subscribed to paged flux processing items")) + .doOnNext(item -> System.out.println("Processing item " + item)) + .doOnComplete(() -> System.out.println("Completed processing")) + .subscribe(); + // END: com.azure.core.http.rest.pagedfluxbase.subscribe + } + + /** + * Implementation not provided + * + * @return A continuation token + */ + private String getContinuationToken() { + return null; + } + + /** + * Implementation not provided + * + * @param continuationToken Token to fetch the next page + * @return A {@link Mono} of {@link PagedResponse} containing items of type {@code Integer} + */ + private Mono> getNextPage(String continuationToken) { + return null; + } + + /** + * Implementation not provided + * + * @return A {@link Mono} of {@link PagedResponse} containing items of type {@code Integer} + */ + private Mono> getFirstPage() { + return null; + } +} diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxJavaDocCodeSnippets.java index b0bc35b4996c..9064b6b32dbe 100644 --- a/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxJavaDocCodeSnippets.java +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedFluxJavaDocCodeSnippets.java @@ -36,7 +36,7 @@ public void classDocSnippet() { .log() .doOnSubscribe(ignoredVal -> System.out .println("Subscribed to paged flux processing pages starting from first page")) - .doOnNext(page -> System.out.println("Processing page containing " + page.items())) + .doOnNext(page -> System.out.println("Processing page containing " + page.getItems())) .doOnComplete(() -> System.out.println("Completed processing")) .subscribe(); // END: com.azure.core.http.rest.pagedflux.pages @@ -50,7 +50,7 @@ public void classDocSnippet() { .log() .doOnSubscribe(ignoredVal -> System.out .println("Subscribed to paged flux processing pages starting from first page")) - .doOnNext(page -> System.out.println("Processing page containing " + page.items())) + .doOnNext(page -> System.out.println("Processing page containing " + page.getItems())) .doOnComplete(() -> System.out.println("Completed processing")) .subscribe(); // END: com.azure.core.http.rest.pagedflux.pagesWithContinuationToken @@ -72,6 +72,14 @@ public PagedFlux createAnInstance() { PagedFlux pagedFlux = new PagedFlux<>(firstPageRetriever, nextPageRetriever); // END: com.azure.core.http.rest.pagedflux.instantiation + + // BEGIN: com.azure.core.http.rest.pagedflux.singlepage.instantiation + // A supplier that fetches the first page of data from source/service + Supplier>> firstPageRetrieverFunction = () -> getFirstPage(); + + PagedFlux pagedFluxInstance = new PagedFlux<>(firstPageRetrieverFunction, + nextPageRetriever); + // END: com.azure.core.http.rest.pagedflux.singlepage.instantiation return pagedFlux; } @@ -87,7 +95,7 @@ public void byPageSnippet() { .log() .doOnSubscribe(ignoredVal -> System.out .println("Subscribed to paged flux processing pages starting from first page")) - .doOnNext(page -> System.out.println("Processing page containing " + page.items())) + .doOnNext(page -> System.out.println("Processing page containing " + page.getItems())) .doOnComplete(() -> System.out.println("Completed processing")) .subscribe(); // END: com.azure.core.http.rest.pagedflux.bypage @@ -99,7 +107,7 @@ public void byPageSnippet() { .log() .doOnSubscribe(ignoredVal -> System.out.println( "Subscribed to paged flux processing page starting from " + continuationToken)) - .doOnNext(page -> System.out.println("Processing page containing " + page.items())) + .doOnNext(page -> System.out.println("Processing page containing " + page.getItems())) .doOnComplete(() -> System.out.println("Completed processing")) .subscribe(); // END: com.azure.core.http.rest.pagedflux.bypage#String diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedIterableJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedIterableJavaDocCodeSnippets.java index 23e2b4be8a61..36177075e6a2 100644 --- a/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedIterableJavaDocCodeSnippets.java +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedIterableJavaDocCodeSnippets.java @@ -23,9 +23,9 @@ public void streamByPageSnippet() { // BEGIN: com.azure.core.http.rest.pagedIterable.streamByPage // process the streamByPage pagedIterableResponse.streamByPage().forEach(resp -> { - System.out.printf("Response headers are %s. Url %s and status code %d %n", resp.headers(), - resp.request().url(), resp.statusCode()); - resp.items().forEach(value -> { + System.out.printf("Response headers are %s. Url %s and status code %d %n", resp.getHeaders(), + resp.getRequest().getUrl(), resp.getStatusCode()); + resp.getItems().forEach(value -> { System.out.printf("Response value is %d %n", value); }); }); @@ -41,9 +41,9 @@ public void iterateByPageSnippet() { // BEGIN: com.azure.core.http.rest.pagedIterable.iterableByPage // process the iterableByPage pagedIterableResponse.iterableByPage().forEach(resp -> { - System.out.printf("Response headers are %s. Url %s and status code %d %n", resp.headers(), - resp.request().url(), resp.statusCode()); - resp.items().forEach(value -> { + System.out.printf("Response headers are %s. Url %s and status code %d %n", resp.getHeaders(), + resp.getRequest().getUrl(), resp.getStatusCode()); + resp.getItems().forEach(value -> { System.out.printf("Response value is %d %n", value); }); }); @@ -61,9 +61,9 @@ public void iterableByPageWhileSnippet() { Iterator> ite = pagedIterableResponse.iterableByPage().iterator(); while (ite.hasNext()) { PagedResponse resp = ite.next(); - System.out.printf("Response headers are %s. Url %s and status code %d %n", resp.headers(), - resp.request().url(), resp.statusCode()); - resp.items().forEach(value -> { + System.out.printf("Response headers are %s. Url %s and status code %d %n", resp.getHeaders(), + resp.getRequest().getUrl(), resp.getStatusCode()); + resp.getItems().forEach(value -> { System.out.printf("Response value is %d %n", value); }); } diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/util/IterableStreamJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/util/IterableStreamJavaDocCodeSnippets.java new file mode 100644 index 000000000000..b7b060bbd561 --- /dev/null +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/util/IterableStreamJavaDocCodeSnippets.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.util; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpMethod; +import com.azure.core.http.HttpRequest; +import com.azure.core.implementation.http.PagedResponseBase; +import reactor.core.publisher.Flux; + +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Iterator; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +/** + * Code snippets for {@link IterableStream} + */ +public class IterableStreamJavaDocCodeSnippets { + + /** + * Iterate over {@link java.util.stream.Stream} + * + * @throws MalformedURLException if can not create URL object. + */ + public void streamSnippet() throws MalformedURLException { + HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1") + .put("header2", "value2"); + HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, new URL("http://localhost")); + + String deserializedHeaders = "header1,value1,header2,value2"; + + IterableStream> myIterableStream = + new IterableStream<>(Flux.just(createPagedResponse(httpRequest, httpHeaders, deserializedHeaders, 1, 3))); + + // BEGIN: com.azure.core.util.iterableStream.stream + // process the stream + myIterableStream.stream().forEach(resp -> { + if (resp.getStatusCode() == HttpURLConnection.HTTP_OK) { + System.out.printf("Response headers are %s. Url %s%n", resp.getDeserializedHeaders(), + resp.getRequest().getUrl()); + resp.getItems().forEach(value -> { + System.out.printf("Response value is %d%n", value); + }); + } + }); + // END: com.azure.core.util.iterableStream.stream + } + + /** + * Iterate with {@link Iterator} interface. + * + * @throws MalformedURLException if can not create URL object. + */ + public void iteratorwhileSnippet() throws MalformedURLException { + HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1") + .put("header2", "value2"); + HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, new URL("http://localhost")); + + String deserializedHeaders = "header1,value1,header2,value2"; + + IterableStream> myIterableStream = + new IterableStream<>(Flux.just(createPagedResponse(httpRequest, httpHeaders, deserializedHeaders, 1, 3))); + + // BEGIN: com.azure.core.util.iterableStream.iterator.while + // Iterate over iterator + for (PagedResponseBase resp : myIterableStream) { + if (resp.getStatusCode() == HttpURLConnection.HTTP_OK) { + System.out.printf("Response headers are %s. Url %s%n", resp.getDeserializedHeaders(), + resp.getRequest().getUrl()); + resp.getItems().forEach(value -> { + System.out.printf("Response value is %d%n", value); + }); + } + } + // END: com.azure.core.util.iterableStream.iterator.while + } + + /** + * Iterate over {@link java.util.stream.Stream} + * + * @throws MalformedURLException if can not create URL object. + */ + public void iteratorStreamFilterSnippet() throws MalformedURLException { + HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1") + .put("header2", "value2"); + HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, new URL("http://localhost")); + + String deserializedHeaders = "header1,value1,header2,value2"; + + IterableStream> myIterableStream = + new IterableStream<>(Flux.just(createPagedResponse(httpRequest, httpHeaders, deserializedHeaders, 1, 3))); + + // BEGIN: com.azure.core.util.iterableStream.stream.filter + // process the stream + myIterableStream.stream().filter(resp -> resp.getStatusCode() == HttpURLConnection.HTTP_OK) + .limit(10) + .forEach(resp -> { + System.out.printf("Response headers are %s. Url %s%n", resp.getDeserializedHeaders(), + resp.getRequest().getUrl()); + resp.getItems().forEach(value -> { + System.out.printf("Response value is %d%n", value); + }); + }); + // END: com.azure.core.util.iterableStream.stream.filter + } + + private PagedResponseBase createPagedResponse(HttpRequest httpRequest, HttpHeaders httpHeaders, + String deserializedHeaders, int i, int noOfPages) { + return new PagedResponseBase<>(httpRequest, HttpURLConnection.HTTP_OK, + httpHeaders, + getItems(i), + i < noOfPages - 1 ? String.valueOf(i + 1) : null, + deserializedHeaders); + } + + private List getItems(Integer i) { + return IntStream.range(i * 3, i * 3 + 3).boxed().collect(Collectors.toList()); + } +} diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/util/polling/PollResponseJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/util/polling/PollResponseJavaDocCodeSnippets.java index 24dd473bfbad..5f33118da9d2 100644 --- a/sdk/core/azure-core/src/samples/java/com/azure/core/util/polling/PollResponseJavaDocCodeSnippets.java +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/util/polling/PollResponseJavaDocCodeSnippets.java @@ -11,7 +11,7 @@ /** * Code snipper for PollResponse * - * @param + * @param The type of the object stored within the {@link PollResponseJavaDocCodeSnippets} instance */ 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 3cabbac3a8a4..acbdf8420ba8 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 @@ -173,7 +173,7 @@ public void poll() { Poller myPoller = null; - // BEGIN: com.azure.core.util.polling.poller.poll + // BEGIN: com.azure.core.util.polling.poller.poll-manually myPoller.setAutoPollingEnabled(false); PollResponse pollResponse = null; // We assume that we get SUCCESSFULLY_COMPLETED status from pollOperation when polling is complete. @@ -187,7 +187,7 @@ public void poll() { } } System.out.println("Polling complete with status " + myPoller.getStatus().toString()); - // END: com.azure.core.util.polling.poller.poll + // END: com.azure.core.util.polling.poller.poll-manually } /** @@ -197,7 +197,7 @@ public void pollIndepth() { Poller myPoller = null; - // BEGIN: com.azure.core.util.polling.poller.poll.indepth + // BEGIN: com.azure.core.util.polling.poller.poll-indepth // Turn off auto polling and this code will take control of polling myPoller.setAutoPollingEnabled(false); @@ -216,6 +216,6 @@ public void pollIndepth() { } } System.out.println("Polling complete with status " + myPoller.getStatus().toString()); - // END: com.azure.core.util.polling.poller.poll.indepth + // END: com.azure.core.util.polling.poller.poll-indepth } } 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 12fc70a8e670..7f39a9cfd5df 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 @@ -20,7 +20,7 @@ public MyOtherRestException(String message, HttpResponse response, HttpBinJSON b } @Override - public HttpBinJSON value() { - return (HttpBinJSON) super.value(); + 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 93d7877874f9..997af223afec 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 @@ -20,7 +20,7 @@ public MyRestException(String message, HttpResponse response, HttpBinJSON body) } @Override - public HttpBinJSON value() { - return (HttpBinJSON) super.value(); + public HttpBinJSON getValue() { + return (HttpBinJSON) super.getValue(); } } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/UserAgentTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/UserAgentTests.java index c97baf2b59ad..e11384b32ad1 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/UserAgentTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/UserAgentTests.java @@ -5,11 +5,11 @@ import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; -import com.azure.core.http.MockHttpClient; import com.azure.core.http.MockHttpResponse; +import com.azure.core.http.clients.NoOpHttpClient; import com.azure.core.http.policy.UserAgentPolicy; import org.junit.Assert; import org.junit.Test; @@ -21,13 +21,13 @@ public class UserAgentTests { @Test public void defaultUserAgentTests() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() - .httpClient(new MockHttpClient() { + .httpClient(new NoOpHttpClient() { @Override public Mono send(HttpRequest request) { Assert.assertEquals( - request.headers().value("User-Agent"), + request.getHeaders().value("User-Agent"), "AutoRest-Java"); - return Mono.just(new MockHttpResponse(request, 200)); + return Mono.just(new MockHttpResponse(request, 200)); } }) .policies(new UserAgentPolicy("AutoRest-Java")) @@ -36,18 +36,18 @@ public Mono send(HttpRequest request) { HttpResponse response = pipeline.send(new HttpRequest( HttpMethod.GET, new URL("http://localhost"))).block(); - Assert.assertEquals(200, response.statusCode()); + Assert.assertEquals(200, response.getStatusCode()); } @Test public void customUserAgentTests() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() - .httpClient(new MockHttpClient() { + .httpClient(new NoOpHttpClient() { @Override public Mono send(HttpRequest request) { - String header = request.headers().value("User-Agent"); + String header = request.getHeaders().value("User-Agent"); Assert.assertEquals("Awesome", header); - return Mono.just(new MockHttpResponse(request, 200)); + return Mono.just(new MockHttpResponse(request, 200)); } }) .policies(new UserAgentPolicy("Awesome")) @@ -55,6 +55,6 @@ public Mono send(HttpRequest request) { HttpResponse response = pipeline.send(new HttpRequest(HttpMethod.GET, new URL("http://localhost"))).block(); - Assert.assertEquals(200, response.statusCode()); + Assert.assertEquals(200, response.getStatusCode()); } } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/credentials/CredentialsTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/credentials/CredentialsTests.java index 581042362bc4..4ae3b550b19b 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/credentials/CredentialsTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/credentials/CredentialsTests.java @@ -7,7 +7,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.HttpRequest; -import com.azure.core.http.MockHttpClient; +import com.azure.core.http.clients.NoOpHttpClient; import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; import org.junit.Assert; @@ -24,16 +24,16 @@ public void basicCredentialsTest() throws Exception { BasicAuthenticationCredential credentials = new BasicAuthenticationCredential("user", "pass"); HttpPipelinePolicy auditorPolicy = (context, next) -> { - String headerValue = context.httpRequest().headers().value("Authorization"); + String headerValue = context.getHttpRequest().getHeaders().value("Authorization"); Assert.assertEquals("Basic dXNlcjpwYXNz", headerValue); return next.process(); }; // final HttpPipeline pipeline = new HttpPipelineBuilder() - .httpClient(new MockHttpClient()) + .httpClient(new NoOpHttpClient()) .policies((context, next) -> credentials.getToken("scope./default") .flatMap(token -> { - context.httpRequest().headers().put("Authorization", "Basic " + token.token()); + context.getHttpRequest().getHeaders().put("Authorization", "Basic " + token.getToken()); return next.process(); }), auditorPolicy) .build(); @@ -52,13 +52,13 @@ public Mono getToken(String... scopes) { }; HttpPipelinePolicy auditorPolicy = (context, next) -> { - String headerValue = context.httpRequest().headers().value("Authorization"); + String headerValue = context.getHttpRequest().getHeaders().value("Authorization"); Assert.assertEquals("Bearer this_is_a_token", headerValue); return next.process(); }; final HttpPipeline pipeline = new HttpPipelineBuilder() - .httpClient(new MockHttpClient()) + .httpClient(new NoOpHttpClient()) .policies(new BearerTokenAuthenticationPolicy(credentials, "scope./default"), auditorPolicy) .build(); diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/credentials/TokenCacheTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/credentials/TokenCacheTests.java index 321a62c52002..2fa932a5f7c2 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/credentials/TokenCacheTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/credentials/TokenCacheTests.java @@ -100,7 +100,7 @@ private static class Token extends AccessToken { private OffsetDateTime expiry; @Override - public String token() { + public String getToken() { return token; } @@ -115,7 +115,7 @@ public String token() { } @Override - public OffsetDateTime expiresOn() { + public OffsetDateTime getExpiresOn() { return expiry; } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/HttpPipelineTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/HttpPipelineTests.java index fc4d59e79685..804b92cf4018 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/HttpPipelineTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/HttpPipelineTests.java @@ -3,6 +3,7 @@ package com.azure.core.http; +import com.azure.core.http.clients.NoOpHttpClient; import com.azure.core.http.policy.PortPolicy; import com.azure.core.http.policy.ProtocolPolicy; import com.azure.core.http.policy.RequestIdPolicy; @@ -13,20 +14,24 @@ import java.net.MalformedURLException; import java.net.URL; -import java.util.function.Supplier; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; public class HttpPipelineTests { @Test public void constructorWithNoArguments() { - HttpPipeline pipeline = new HttpPipelineBuilder().build(); + HttpPipeline pipeline = new HttpPipelineBuilder() + .httpClient(new NoOpHttpClient() { + @Override + public Mono send(HttpRequest request) { + // do nothing + return null; + } + }).build(); assertEquals(0, pipeline.getPolicyCount()); assertNotNull(pipeline.httpClient()); - assertTrue(pipeline.httpClient() instanceof ReactorNettyClient); } @Test @@ -35,14 +40,19 @@ public void withRequestPolicy() { .policies(new PortPolicy(80, true), new ProtocolPolicy("ftp", true), new RetryPolicy()) - .build(); + .httpClient(new NoOpHttpClient() { + @Override + public Mono send(HttpRequest request) { + // do nothing + return null; + } + }).build(); assertEquals(3, pipeline.getPolicyCount()); assertEquals(PortPolicy.class, pipeline.getPolicy(0).getClass()); assertEquals(ProtocolPolicy.class, pipeline.getPolicy(1).getClass()); assertEquals(RetryPolicy.class, pipeline.getPolicy(2).getClass()); assertNotNull(pipeline.httpClient()); - assertTrue(pipeline.httpClient() instanceof ReactorNettyClient); } @Test @@ -51,12 +61,17 @@ public void withRequestOptions() throws MalformedURLException { .policies(new PortPolicy(80, true), new ProtocolPolicy("ftp", true), new RetryPolicy()) - .build(); + .httpClient(new NoOpHttpClient() { + @Override + public Mono send(HttpRequest request) { + // do nothing + return null; + } + }).build(); HttpPipelineCallContext context = new HttpPipelineCallContext(new HttpRequest(HttpMethod.GET, new URL("http://foo.com"))); assertNotNull(context); assertNotNull(pipeline.httpClient()); - assertTrue(pipeline.httpClient() instanceof ReactorNettyClient); } @Test @@ -64,20 +79,20 @@ public void withNoRequestPolicies() throws MalformedURLException { final HttpMethod expectedHttpMethod = HttpMethod.GET; final URL expectedUrl = new URL("http://my.site.com"); final HttpPipeline httpPipeline = new HttpPipelineBuilder() - .httpClient(new MockHttpClient() { + .httpClient(new NoOpHttpClient() { @Override public Mono send(HttpRequest request) { - assertEquals(0, request.headers().size()); - assertEquals(expectedHttpMethod, request.httpMethod()); - assertEquals(expectedUrl, request.url()); - return Mono.just(new MockHttpResponse(request, 200)); + assertEquals(0, request.getHeaders().getSize()); + assertEquals(expectedHttpMethod, request.getHttpMethod()); + assertEquals(expectedUrl, request.getUrl()); + return Mono.just(new MockHttpResponse(request, 200)); } }) .build(); final HttpResponse response = httpPipeline.send(new HttpRequest(expectedHttpMethod, expectedUrl)).block(); assertNotNull(response); - assertEquals(200, response.statusCode()); + assertEquals(200, response.getStatusCode()); } @Test @@ -85,14 +100,14 @@ public void withUserAgentRequestPolicy() throws MalformedURLException { final HttpMethod expectedHttpMethod = HttpMethod.GET; final URL expectedUrl = new URL("http://my.site.com/1"); final String expectedUserAgent = "my-user-agent"; - final HttpClient httpClient = new MockHttpClient() { + final HttpClient httpClient = new NoOpHttpClient() { @Override public Mono send(HttpRequest request) { - assertEquals(1, request.headers().size()); - assertEquals(expectedUserAgent, request.headers().value("User-Agent")); - assertEquals(expectedHttpMethod, request.httpMethod()); - assertEquals(expectedUrl, request.url()); - return Mono.just(new MockHttpResponse(request, 200)); + assertEquals(1, request.getHeaders().getSize()); + assertEquals(expectedUserAgent, request.getHeaders().value("User-Agent")); + assertEquals(expectedHttpMethod, request.getHttpMethod()); + assertEquals(expectedUrl, request.getUrl()); + return Mono.just(new MockHttpResponse(request, 200)); } }; @@ -103,7 +118,7 @@ public Mono send(HttpRequest request) { final HttpResponse response = httpPipeline.send(new HttpRequest(expectedHttpMethod, expectedUrl)).block(); assertNotNull(response); - assertEquals(200, response.statusCode()); + assertEquals(200, response.getStatusCode()); } @Test @@ -111,17 +126,17 @@ public void withRequestIdRequestPolicy() throws MalformedURLException { final HttpMethod expectedHttpMethod = HttpMethod.GET; final URL expectedUrl = new URL("http://my.site.com/1"); final HttpPipeline httpPipeline = new HttpPipelineBuilder() - .httpClient(new MockHttpClient() { + .httpClient(new NoOpHttpClient() { @Override public Mono send(HttpRequest request) { - assertEquals(1, request.headers().size()); - final String requestId = request.headers().value("x-ms-client-request-id"); + assertEquals(1, request.getHeaders().getSize()); + final String requestId = request.getHeaders().value("x-ms-client-request-id"); assertNotNull(requestId); assertFalse(requestId.isEmpty()); - assertEquals(expectedHttpMethod, request.httpMethod()); - assertEquals(expectedUrl, request.url()); - return Mono.just(new MockHttpResponse(request, 200)); + assertEquals(expectedHttpMethod, request.getHttpMethod()); + assertEquals(expectedUrl, request.getUrl()); + return Mono.just(new MockHttpResponse(request, 200)); } }) .policies(new RequestIdPolicy()) @@ -129,27 +144,6 @@ public Mono send(HttpRequest request) { final HttpResponse response = httpPipeline.send(new HttpRequest(expectedHttpMethod, expectedUrl)).block(); assertNotNull(response); - assertEquals(200, response.statusCode()); - } - - private abstract static class MockHttpClient implements HttpClient { - - @Override - public abstract Mono send(HttpRequest request); - - @Override - public HttpClient proxy(Supplier proxyOptions) { - throw new IllegalStateException("MockHttpClient.proxy"); - } - - @Override - public HttpClient wiretap(boolean enableWiretap) { - throw new IllegalStateException("MockHttpClient.wiretap"); - } - - @Override - public HttpClient port(int port) { - throw new IllegalStateException("MockHttpClient.port"); - } + assertEquals(200, response.getStatusCode()); } } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/HttpRequestTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/HttpRequestTests.java index ea3dcd688592..137d18fdfade 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/HttpRequestTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/HttpRequestTests.java @@ -3,7 +3,6 @@ package com.azure.core.http; -import io.netty.buffer.Unpooled; import org.junit.Test; import reactor.core.publisher.Flux; @@ -19,8 +18,8 @@ public class HttpRequestTests { @Test public void constructor() throws MalformedURLException { final HttpRequest request = new HttpRequest(HttpMethod.POST, new URL("http://request.url")); - assertEquals(HttpMethod.POST, request.httpMethod()); - assertEquals(new URL("http://request.url"), request.url()); + assertEquals(HttpMethod.POST, request.getHttpMethod()); + assertEquals(new URL("http://request.url"), request.getUrl()); } @Test @@ -32,25 +31,25 @@ public void testClone() throws IOException { HttpMethod.PUT, new URL("http://request.url"), headers, - Flux.just(Unpooled.buffer(0, 0))); + Flux.empty()); final HttpRequest bufferedRequest = request.buffer(); assertNotSame(request, bufferedRequest); - assertEquals(request.httpMethod(), bufferedRequest.httpMethod()); - assertEquals(request.url(), bufferedRequest.url()); + assertEquals(request.getHttpMethod(), bufferedRequest.getHttpMethod()); + assertEquals(request.getUrl(), bufferedRequest.getUrl()); - assertNotSame(request.headers(), bufferedRequest.headers()); - assertEquals(request.headers().size(), bufferedRequest.headers().size()); - for (HttpHeader clonedHeader : bufferedRequest.headers()) { - for (HttpHeader originalHeader : request.headers()) { + assertNotSame(request.getHeaders(), bufferedRequest.getHeaders()); + assertEquals(request.getHeaders().getSize(), bufferedRequest.getHeaders().getSize()); + for (HttpHeader clonedHeader : bufferedRequest.getHeaders()) { + for (HttpHeader originalHeader : request.getHeaders()) { assertNotSame(clonedHeader, originalHeader); } - assertEquals(clonedHeader.value(), request.headers().value(clonedHeader.name())); + assertEquals(clonedHeader.getValue(), request.getHeaders().value(clonedHeader.getName())); } - assertSame(request.body(), bufferedRequest.body()); + assertSame(request.getBody(), bufferedRequest.getBody()); } } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/MockHttpResponse.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/MockHttpResponse.java index 02285a3428d2..f37c872a0ef6 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/MockHttpResponse.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/MockHttpResponse.java @@ -6,12 +6,11 @@ import com.azure.core.implementation.serializer.SerializerAdapter; import com.azure.core.implementation.serializer.SerializerEncoding; import com.azure.core.implementation.serializer.jackson.JacksonAdapter; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.io.IOException; +import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; @@ -28,7 +27,7 @@ public MockHttpResponse(HttpRequest request, int statusCode, HttpHeaders headers this.statusCode = statusCode; this.headers = headers; this.bodyBytes = bodyBytes; - this.request(request); + this.setRequest(request); } public MockHttpResponse(HttpRequest request, int statusCode) { @@ -59,22 +58,22 @@ private static byte[] serialize(Object serializable) { } @Override - public int statusCode() { + public int getStatusCode() { return statusCode; } @Override - public String headerValue(String name) { + public String getHeaderValue(String name) { return headers.value(name); } @Override - public HttpHeaders headers() { + public HttpHeaders getHeaders() { return new HttpHeaders(headers); } @Override - public Mono bodyAsByteArray() { + public Mono getBodyAsByteArray() { if (bodyBytes == null) { return Mono.empty(); } else { @@ -83,16 +82,16 @@ public Mono bodyAsByteArray() { } @Override - public Flux body() { + public Flux getBody() { if (bodyBytes == null) { return Flux.empty(); } else { - return Flux.just(Unpooled.wrappedBuffer(bodyBytes)); + return Flux.just(ByteBuffer.wrap(bodyBytes)); } } @Override - public Mono bodyAsString() { + public Mono getBodyAsString() { if (bodyBytes == null) { return Mono.empty(); } else { @@ -101,7 +100,7 @@ public Mono bodyAsString() { } @Override - public Mono bodyAsString(Charset charset) { + public Mono getBodyAsString(Charset charset) { if (bodyBytes == null) { return Mono.empty(); } else { diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/ReactorNettyClientTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/ReactorNettyClientTests.java deleted file mode 100644 index d5b182d58592..000000000000 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/ReactorNettyClientTests.java +++ /dev/null @@ -1,338 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.http; - -import com.github.tomakehurst.wiremock.WireMockServer; -import com.github.tomakehurst.wiremock.client.WireMock; -import com.github.tomakehurst.wiremock.core.WireMockConfiguration; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.util.ReferenceCountUtil; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import reactor.core.scheduler.Schedulers; -import reactor.test.StepVerifier; -import reactor.test.StepVerifierOptions; - -import java.io.IOException; -import java.io.OutputStream; -import java.net.MalformedURLException; -import java.net.ServerSocket; -import java.net.Socket; -import java.net.URL; -import java.nio.charset.StandardCharsets; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.atomic.AtomicReference; - -import static org.junit.Assert.assertEquals; - -public class ReactorNettyClientTests { - - private static final String SHORT_BODY = "hi there"; - private static final String LONG_BODY = createLongBody(); - - private static WireMockServer server; - - @BeforeClass - public static void beforeClass() { - server = new WireMockServer(WireMockConfiguration.options().dynamicPort().disableRequestJournal()); - server.stubFor( - WireMock.get("/short").willReturn(WireMock.aResponse().withBody(SHORT_BODY))); - server.stubFor(WireMock.get("/long").willReturn(WireMock.aResponse().withBody(LONG_BODY))); - server.stubFor(WireMock.get("/error") - .willReturn(WireMock.aResponse().withBody("error").withStatus(500))); - server.stubFor( - WireMock.post("/shortPost").willReturn(WireMock.aResponse().withBody(SHORT_BODY))); - server.start(); - // ResourceLeakDetector.setLevel(Level.PARANOID); - } - - @AfterClass - public static void afterClass() { - if (server != null) { - server.shutdown(); - } - } - - @Test - public void testFlowableResponseShortBodyAsByteArrayAsync() { - checkBodyReceived(SHORT_BODY, "/short"); - } - - @Test - public void testFlowableResponseLongBodyAsByteArrayAsync() { - checkBodyReceived(LONG_BODY, "/long"); - } - - @Test - public void testMultipleSubscriptionsEmitsError() { - HttpResponse response = getResponse("/short"); - // Subscription:1 - response.bodyAsByteArray().block(); - // Subscription:2 - StepVerifier.create(response.bodyAsByteArray()) - .expectNextCount(0) // TODO: Check with smaldini, what is the verifier operator equivalent to .awaitDone(20, TimeUnit.SECONDS) - .verifyError(IllegalStateException.class); - - } - - @Test - public void testDispose() throws InterruptedException { - HttpResponse response = getResponse("/long"); - response.body().subscribe().dispose(); - // Wait for scheduled connection disposal action to execute on netty event-loop - Thread.sleep(5000); - Assert.assertTrue(response.internConnection().isDisposed()); - } - - @Test - public void testCancel() { - HttpResponse response = getResponse("/long"); - // - StepVerifierOptions stepVerifierOptions = StepVerifierOptions.create(); - stepVerifierOptions.initialRequest(0); - // - StepVerifier.create(response.body(), stepVerifierOptions) - .expectNextCount(0) - .thenRequest(1) - .expectNextCount(1) - .thenCancel() - .verify(); - Assert.assertTrue(response.internConnection().isDisposed()); - } - - @Test - public void testFlowableWhenServerReturnsBodyAndNoErrorsWhenHttp500Returned() { - HttpResponse response = getResponse("/error"); - StepVerifier.create(response.bodyAsString()) - .expectNext("error") // TODO: .awaitDone(20, TimeUnit.SECONDS) [See previous todo] - .verifyComplete(); - assertEquals(500, response.statusCode()); - } - - @Test - @Ignore("Not working accurately at present") - public void testFlowableBackpressure() { - HttpResponse response = getResponse("/long"); - // - StepVerifierOptions stepVerifierOptions = StepVerifierOptions.create(); - stepVerifierOptions.initialRequest(0); - // - StepVerifier.create(response.body(), stepVerifierOptions) - .expectNextCount(0) - .thenRequest(1) - .expectNextCount(1) - .thenRequest(3) - .expectNextCount(3) - .thenRequest(Long.MAX_VALUE)// TODO: Check with smaldini, what is the verifier operator to ignore all next emissions - .expectNextCount(1507) - .verifyComplete(); - } - - @Test - public void testRequestBodyIsErrorShouldPropagateToResponse() { - HttpClient client = HttpClient.createDefault(); - HttpRequest request = new HttpRequest(HttpMethod.POST, url(server, "/shortPost")) - .header("Content-Length", "123") - .body(Flux.error(new RuntimeException("boo"))); - - StepVerifier.create(client.send(request)) - .expectErrorMessage("boo") - .verify(); - } - - @Test - public void testRequestBodyEndsInErrorShouldPropagateToResponse() { - HttpClient client = HttpClient.createDefault(); - String contentChunk = "abcdefgh"; - int repetitions = 1000; - HttpRequest request = new HttpRequest(HttpMethod.POST, url(server, "/shortPost")) - .header("Content-Length", String.valueOf(contentChunk.length() * repetitions)) - .body(Flux.just(contentChunk) - .repeat(repetitions) - .map(s -> Unpooled.wrappedBuffer(s.getBytes(StandardCharsets.UTF_8))) - .concatWith(Flux.error(new RuntimeException("boo")))); - StepVerifier.create(client.send(request)) - // .awaitDone(10, TimeUnit.SECONDS) - .expectErrorMessage("boo") - .verify(); - } - - @Test(timeout = 5000) - public void testServerShutsDownSocketShouldPushErrorToContentFlowable() - throws IOException, InterruptedException { - CountDownLatch latch = new CountDownLatch(1); - AtomicReference sock = new AtomicReference<>(); - ServerSocket ss = new ServerSocket(0); - try { - Mono.fromCallable(() -> { - latch.countDown(); - Socket socket = ss.accept(); - sock.set(socket); - // give the client time to get request across - Thread.sleep(500); - // respond but don't send the complete response - byte[] bytes = new byte[1024]; - int n = socket.getInputStream().read(bytes); - System.out.println(new String(bytes, 0, n, StandardCharsets.UTF_8)); - String response = "HTTP/1.1 200 OK\r\n" // - + "Content-Type: text/plain\r\n" // - + "Content-Length: 10\r\n" // - + "\r\n" // - + "zi"; - OutputStream out = socket.getOutputStream(); - out.write(response.getBytes()); - out.flush(); - // kill the socket with HTTP response body incomplete - socket.close(); - return 1; - }) - .subscribeOn(Schedulers.elastic()) - .subscribe(); - // - latch.await(); - HttpClient client = HttpClient.createDefault(); - HttpRequest request = new HttpRequest(HttpMethod.GET, - new URL("http://localhost:" + ss.getLocalPort() + "/get")); - HttpResponse response = client.send(request).block(); - assertEquals(200, response.statusCode()); - System.out.println("reading body"); - // - StepVerifier.create(response.bodyAsByteArray()) - // .awaitDone(20, TimeUnit.SECONDS) - .verifyError(IOException.class); - } finally { - ss.close(); - } - } - - @Ignore("This flakey test fails often on MacOS. https://github.com/Azure/azure-sdk-for-java/issues/4357.") - @Test - public void testConcurrentRequests() throws NoSuchAlgorithmException { - long t = System.currentTimeMillis(); - int numRequests = 100; // 100 = 1GB of data read - long timeoutSeconds = 60; - HttpClient client = HttpClient.createDefault(); - byte[] expectedDigest = digest(LONG_BODY); - - Mono numBytesMono = Flux.range(1, numRequests) - .parallel(10) - .runOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) - .flatMap(n -> Mono.fromCallable(() -> getResponse(client, "/long")).flatMapMany(response -> { - MessageDigest md = md5Digest(); - return response.body() - .doOnNext(bb -> { - bb.retain(); - if (bb.hasArray()) { - // Heap buffer - md.update(bb.array()); - } else { - // Direct buffer - int len = bb.readableBytes(); - byte[] array = new byte[len]; - bb.getBytes(bb.readerIndex(), array); - md.update(array); - } - }) - .map(bb -> new NumberedByteBuf(n, bb)) -// .doOnComplete(() -> System.out.println("completed " + n)) - .doOnComplete(() -> Assert.assertArrayEquals("wrong digest!", expectedDigest, - md.digest())); - })) - .sequential() - // enable the doOnNext call to see request numbers and thread names - // .doOnNext(g -> System.out.println(g.n + " " + - // Thread.currentThread().getName())) - .map(nbb -> { - long bytesCount = (long) nbb.bb.readableBytes(); - ReferenceCountUtil.release(nbb.bb); - return bytesCount; - }) - .reduce((x, y) -> x + y) - .subscribeOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) - .publishOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)); - - StepVerifier.create(numBytesMono) -// .awaitDone(timeoutSeconds, TimeUnit.SECONDS) - .expectNext((long) (numRequests * LONG_BODY.getBytes(StandardCharsets.UTF_8).length)) - .verifyComplete(); -// -// long numBytes = numBytesMono.block(); -// t = System.currentTimeMillis() - t; -// System.out.println("totalBytesRead=" + numBytes / 1024 / 1024 + "MB in " + t / 1000.0 + "s"); -// assertEquals(numRequests * LONG_BODY.getBytes(StandardCharsets.UTF_8).length, numBytes); - } - - private static MessageDigest md5Digest() { - try { - return MessageDigest.getInstance("MD5"); - } catch (NoSuchAlgorithmException e) { - throw new RuntimeException(e); - } - } - - private static byte[] digest(String s) throws NoSuchAlgorithmException { - MessageDigest md = MessageDigest.getInstance("MD5"); - md.update(s.getBytes(StandardCharsets.UTF_8)); - byte[] expectedDigest = md.digest(); - return expectedDigest; - } - - private static final class NumberedByteBuf { - final long n; - final ByteBuf bb; - - NumberedByteBuf(long n, ByteBuf bb) { - this.n = n; - this.bb = bb; - } - } - - private static HttpResponse getResponse(String path) { - HttpClient client = HttpClient.createDefault(); - return getResponse(client, path); - } - - private static HttpResponse getResponse(HttpClient client, String path) { - HttpRequest request = new HttpRequest(HttpMethod.GET, url(server, path)); - return client.send(request).block(); - } - - private static URL url(WireMockServer server, String path) { - try { - return new URL("http://localhost:" + server.port() + path); - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - } - - private static String createLongBody() { - StringBuilder s = new StringBuilder(10000000); - for (int i = 0; i < 1000000; i++) { - s.append("abcdefghijk"); - } - return s.toString(); - } - - private void checkBodyReceived(String expectedBody, String path) { - HttpClient client = HttpClient.createDefault(); - HttpResponse response = doRequest(client, path); - String s = new String(response.bodyAsByteArray().block(), - StandardCharsets.UTF_8); - assertEquals(expectedBody, s); - } - - private HttpResponse doRequest(HttpClient client, String path) { - HttpRequest request = new HttpRequest(HttpMethod.GET, url(server, path)); - HttpResponse response = client.send(request).block(); - return response; - } -} diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/MockHttpClient.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/clients/MockHttpClient.java similarity index 83% rename from sdk/core/azure-core/src/test/java/com/azure/core/http/MockHttpClient.java rename to sdk/core/azure-core/src/test/java/com/azure/core/http/clients/MockHttpClient.java index dad19ec73036..1b6e9bf90651 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/MockHttpClient.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/clients/MockHttpClient.java @@ -1,21 +1,23 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.core.http; +package com.azure.core.http.clients; import com.azure.core.entities.HttpBinFormDataJSON; import com.azure.core.entities.HttpBinFormDataJSON.Form; import com.azure.core.entities.HttpBinFormDataJSON.PizzaSize; import com.azure.core.entities.HttpBinJSON; +import com.azure.core.http.HttpHeader; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.MockHttpResponse; import com.azure.core.implementation.Base64Url; import com.azure.core.implementation.DateTimeRfc1123; import com.azure.core.implementation.util.FluxUtil; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import reactor.core.publisher.Mono; import java.net.URL; -import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.time.Instant; import java.time.OffsetDateTime; @@ -25,12 +27,11 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.function.Supplier; /** * This HttpClient attempts to mimic the behavior of http://httpbin.org without ever making a network call. */ -public class MockHttpClient implements HttpClient { +public class MockHttpClient extends NoOpHttpClient { private static final HttpHeaders RESPONSE_HEADERS = new HttpHeaders() .put("Date", "Fri, 13 Oct 2017 20:33:09 GMT") .put("Via", "1.1 vegur") @@ -44,21 +45,21 @@ public Mono send(HttpRequest request) { HttpResponse response = null; try { - final URL requestUrl = request.url(); + final URL requestUrl = request.getUrl(); final String requestHost = requestUrl.getHost(); - final String contentType = request.headers().value("Content-Type"); + final String contentType = request.getHeaders().value("Content-Type"); if ("httpbin.org".equalsIgnoreCase(requestHost)) { final String requestPath = requestUrl.getPath(); final String requestPathLower = requestPath.toLowerCase(); if (requestPathLower.equals("/anything") || requestPathLower.startsWith("/anything/")) { - if ("HEAD".equals(request.httpMethod())) { + if ("HEAD".equals(request.getHttpMethod())) { response = new MockHttpResponse(request, 200, new byte[0]); } else { final HttpBinJSON json = new HttpBinJSON(); - json.url(request.url().toString() + json.url(request.getUrl().toString() // This is just to mimic the behavior we've seen with httpbin.org. .replace("%20", " ")); - json.headers(toMap(request.headers())); + json.headers(toMap(request.getHeaders())); response = new MockHttpResponse(request, 200, json); } } else if (requestPathLower.startsWith("/bytes/")) { @@ -129,21 +130,21 @@ public Mono send(HttpRequest request) { response = new MockHttpResponse(request, 200, RESPONSE_HEADERS, 0); } else if (requestPathLower.equals("/delete")) { final HttpBinJSON json = new HttpBinJSON(); - json.url(request.url().toString()); + 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(); - json.url(request.url().toString()); - json.headers(toMap(request.headers())); + 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(); - json.url(request.url().toString()); + json.url(request.getUrl().toString()); json.data(createHttpBinResponseDataForRequest(request)); response = new MockHttpResponse(request, 200, json); } else if (requestPathLower.equals("/post")) { - if ("x-www-form-urlencoded".equalsIgnoreCase(contentType)) { + if (contentType != null && contentType.contains("x-www-form-urlencoded")) { Map parsed = bodyToMap(request); final HttpBinFormDataJSON json = new HttpBinFormDataJSON(); Form form = new Form(); @@ -153,18 +154,19 @@ public Mono send(HttpRequest request) { form.pizzaSize(PizzaSize.valueOf(parsed.get("size"))); form.toppings(Arrays.asList(parsed.get("toppings").split(","))); json.form(form); + response = new MockHttpResponse(request, 200, RESPONSE_HEADERS, json); } else { final HttpBinJSON json = new HttpBinJSON(); - json.url(request.url().toString()); + json.url(request.getUrl().toString()); json.data(createHttpBinResponseDataForRequest(request)); - json.headers(toMap(request.headers())); + json.headers(toMap(request.getHeaders())); response = new MockHttpResponse(request, 200, json); } } else if (requestPathLower.equals("/put")) { final HttpBinJSON json = new HttpBinJSON(); - json.url(request.url().toString()); + json.url(request.getUrl().toString()); json.data(createHttpBinResponseDataForRequest(request)); - json.headers(toMap(request.headers())); + json.headers(toMap(request.getHeaders())); response = new MockHttpResponse(request, 200, RESPONSE_HEADERS, json); } else if (requestPathLower.startsWith("/status/")) { final String statusCodeString = requestPathLower.substring("/status/".length()); @@ -172,13 +174,8 @@ public Mono send(HttpRequest request) { response = new MockHttpResponse(request, statusCode); } } else if ("echo.org".equalsIgnoreCase(requestHost)) { - return request.body() - .map(ByteBuf::nioBuffer) - .collectList() - .map(list -> { - byte[] bytes = Unpooled.wrappedBuffer(list.toArray(new ByteBuffer[0])).array(); - return new MockHttpResponse(request, 200, new HttpHeaders(request.headers()), bytes); - }); + return FluxUtil.collectBytesInByteBufferStream(request.getBody()) + .map(bytes -> new MockHttpResponse(request, 200, new HttpHeaders(request.getHeaders()), bytes)); } } catch (Exception ex) { return Mono.error(ex); @@ -191,21 +188,6 @@ public Mono send(HttpRequest request) { return Mono.just(response); } - @Override - public HttpClient proxy(Supplier proxyOptions) { - throw new IllegalStateException("MockHttpClient.proxy"); - } - - @Override - public HttpClient wiretap(boolean enableWiretap) { - throw new IllegalStateException("MockHttpClient.wiretap"); - } - - @Override - public HttpClient port(int port) { - throw new IllegalStateException("MockHttpClient.port"); - } - private static String createHttpBinResponseDataForRequest(HttpRequest request) { String body = bodyToString(request); if (body == null) { @@ -217,8 +199,8 @@ private static String createHttpBinResponseDataForRequest(HttpRequest request) { private static String bodyToString(HttpRequest request) { String body = ""; - if (request.body() != null) { - Mono asyncString = FluxUtil.collectBytesInByteBufStream(request.body(), true) + if (request.getBody() != null) { + Mono asyncString = FluxUtil.collectBytesInByteBufferStream(request.getBody()) .map(bytes -> new String(bytes, StandardCharsets.UTF_8)); body = asyncString.block(); } @@ -228,7 +210,7 @@ private static String bodyToString(HttpRequest request) { private static Map toMap(HttpHeaders headers) { final Map result = new HashMap<>(); for (final HttpHeader header : headers) { - result.put(header.name(), header.value()); + result.put(header.getName(), header.getValue()); } return result; } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/clients/NoOpHttpClient.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/clients/NoOpHttpClient.java new file mode 100644 index 000000000000..5f2dfe4d4146 --- /dev/null +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/clients/NoOpHttpClient.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.clients; + +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import reactor.core.publisher.Mono; + +public class NoOpHttpClient implements HttpClient { + + @Override + public Mono send(HttpRequest request) { + return Mono.empty(); // NOP + } + +} diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/HostPolicyTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/HostPolicyTests.java index beb4a130ad97..237476b467d7 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/HostPolicyTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/HostPolicyTests.java @@ -3,19 +3,15 @@ package com.azure.core.http.policy; -import com.azure.core.http.HttpClient; import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpRequest; +import com.azure.core.http.clients.NoOpHttpClient; import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.ProxyOptions; import org.junit.Test; -import reactor.core.publisher.Mono; import java.net.MalformedURLException; import java.net.URL; -import java.util.function.Supplier; import static org.junit.Assert.assertEquals; @@ -34,10 +30,10 @@ public void withPort() throws MalformedURLException { private static HttpPipeline createPipeline(String host, String expectedUrl) { return new HttpPipelineBuilder() - .httpClient(new MockHttpClient()) + .httpClient(new NoOpHttpClient()) .policies(new HostPolicy(host), (context, next) -> { - assertEquals(expectedUrl, context.httpRequest().url().toString()); + assertEquals(expectedUrl, context.getHttpRequest().getUrl().toString()); return next.process(); }) .build(); @@ -46,27 +42,4 @@ private static HttpPipeline createPipeline(String host, String expectedUrl) { private static HttpRequest createHttpRequest(String url) throws MalformedURLException { return new HttpRequest(HttpMethod.GET, new URL(url)); } - - private static class MockHttpClient implements HttpClient { - - @Override - public Mono send(HttpRequest request) { - return Mono.empty(); // NOP - } - - @Override - public HttpClient proxy(Supplier proxyOptions) { - throw new IllegalStateException("MockHttpClient.proxy"); - } - - @Override - public HttpClient wiretap(boolean enableWiretap) { - throw new IllegalStateException("MockHttpClient.wiretap"); - } - - @Override - public HttpClient port(int port) { - throw new IllegalStateException("MockHttpClient.port"); - } - } } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/ProtocolPolicyTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/ProtocolPolicyTests.java index 3701b984d40d..084f68a9c793 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/ProtocolPolicyTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/ProtocolPolicyTests.java @@ -3,19 +3,15 @@ package com.azure.core.http.policy; -import com.azure.core.http.HttpClient; import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.ProxyOptions; +import com.azure.core.http.clients.NoOpHttpClient; import org.junit.Test; -import reactor.core.publisher.Mono; import java.net.MalformedURLException; import java.net.URL; -import java.util.function.Supplier; import static org.junit.Assert.assertEquals; @@ -34,10 +30,10 @@ public void withNoOverwrite() throws MalformedURLException { } private static HttpPipeline createPipeline(String protocol, String expectedUrl) { return new HttpPipelineBuilder() - .httpClient(new MockHttpClient()) + .httpClient(new NoOpHttpClient()) .policies(new ProtocolPolicy(protocol, true), (context, next) -> { - assertEquals(expectedUrl, context.httpRequest().url().toString()); + assertEquals(expectedUrl, context.getHttpRequest().getUrl().toString()); return next.process(); }) .build(); @@ -45,10 +41,10 @@ private static HttpPipeline createPipeline(String protocol, String expectedUrl) private static HttpPipeline createPipeline(String protocol, boolean overwrite, String expectedUrl) { return new HttpPipelineBuilder() - .httpClient(new MockHttpClient()) + .httpClient(new NoOpHttpClient()) .policies(new ProtocolPolicy(protocol, overwrite), (context, next) -> { - assertEquals(expectedUrl, context.httpRequest().url().toString()); + assertEquals(expectedUrl, context.getHttpRequest().getUrl().toString()); return next.process(); }) .build(); @@ -57,27 +53,4 @@ private static HttpPipeline createPipeline(String protocol, boolean overwrite, S private static HttpRequest createHttpRequest(String url) throws MalformedURLException { return new HttpRequest(HttpMethod.GET, new URL(url)); } - - private static class MockHttpClient implements HttpClient { - - @Override - public Mono send(HttpRequest request) { - return Mono.empty(); - } - - @Override - public HttpClient proxy(Supplier proxyOptions) { - throw new IllegalStateException("MockHttpClient.proxy"); - } - - @Override - public HttpClient wiretap(boolean enableWiretap) { - throw new IllegalStateException("MockHttpClient.wiretap"); - } - - @Override - public HttpClient port(int port) { - throw new IllegalStateException("MockHttpClient.port"); - } - } } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/ProxyAuthenticationPolicyTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/ProxyAuthenticationPolicyTests.java index 7c0331086ae0..800c85d7586e 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/ProxyAuthenticationPolicyTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/ProxyAuthenticationPolicyTests.java @@ -7,7 +7,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.HttpRequest; -import com.azure.core.http.MockHttpClient; +import com.azure.core.http.clients.NoOpHttpClient; import org.junit.Test; import java.net.MalformedURLException; @@ -25,10 +25,10 @@ public void test() throws MalformedURLException { final String password = "testpass"; // final HttpPipeline pipeline = new HttpPipelineBuilder() - .httpClient(new MockHttpClient()) + .httpClient(new NoOpHttpClient()) .policies(new ProxyAuthenticationPolicy(username, password), (context, next) -> { - assertEquals("Basic dGVzdHVzZXI6dGVzdHBhc3M=", context.httpRequest().headers().value("Proxy-Authentication")); + assertEquals("Basic dGVzdHVzZXI6dGVzdHBhc3M=", context.getHttpRequest().getHeaders().value("Proxy-Authentication")); auditorVisited.set(true); return next.process(); }) diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/RequestIdPolicyTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/RequestIdPolicyTests.java index 035a0ded64c8..3d7719d43be8 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/RequestIdPolicyTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/RequestIdPolicyTests.java @@ -9,14 +9,14 @@ import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.HttpResponse; -import com.azure.core.http.MockHttpClient; -import io.netty.buffer.ByteBuf; +import com.azure.core.http.clients.NoOpHttpClient; import org.junit.Assert; import org.junit.Test; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.net.URL; +import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.time.Duration; import java.time.temporal.ChronoUnit; @@ -24,37 +24,37 @@ public class RequestIdPolicyTests { private final HttpResponse mockResponse = new HttpResponse() { @Override - public int statusCode() { + public int getStatusCode() { return 500; } @Override - public String headerValue(String name) { + public String getHeaderValue(String name) { return null; } @Override - public HttpHeaders headers() { + public HttpHeaders getHeaders() { return new HttpHeaders(); } @Override - public Mono bodyAsByteArray() { + public Mono getBodyAsByteArray() { return Mono.empty(); } @Override - public Flux body() { + public Flux getBody() { return Flux.empty(); } @Override - public Mono bodyAsString() { + public Mono getBodyAsString() { return Mono.empty(); } @Override - public Mono bodyAsString(Charset charset) { + public Mono getBodyAsString(Charset charset) { return Mono.empty(); } }; @@ -64,17 +64,17 @@ public Mono bodyAsString(Charset charset) { @Test public void newRequestIdForEachCall() throws Exception { HttpPipeline pipeline = new HttpPipelineBuilder() - .httpClient(new MockHttpClient() { + .httpClient(new NoOpHttpClient() { String firstRequestId = null; @Override public Mono send(HttpRequest request) { if (firstRequestId != null) { - String newRequestId = request.headers().value(REQUEST_ID_HEADER); + String newRequestId = request.getHeaders().value(REQUEST_ID_HEADER); Assert.assertNotNull(newRequestId); Assert.assertNotEquals(newRequestId, firstRequestId); } - firstRequestId = request.headers().value(REQUEST_ID_HEADER); + firstRequestId = request.getHeaders().value(REQUEST_ID_HEADER); if (firstRequestId == null) { Assert.fail(); } @@ -91,17 +91,17 @@ public Mono send(HttpRequest request) { @Test public void sameRequestIdForRetry() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() - .httpClient(new MockHttpClient() { + .httpClient(new NoOpHttpClient() { String firstRequestId = null; @Override public Mono send(HttpRequest request) { if (firstRequestId != null) { - String newRequestId = request.headers().value(REQUEST_ID_HEADER); + String newRequestId = request.getHeaders().value(REQUEST_ID_HEADER); Assert.assertNotNull(newRequestId); Assert.assertEquals(newRequestId, firstRequestId); } - firstRequestId = request.headers().value(REQUEST_ID_HEADER); + firstRequestId = request.getHeaders().value(REQUEST_ID_HEADER); if (firstRequestId == null) { Assert.fail(); } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/RetryPolicyTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/RetryPolicyTests.java index 03eb57f79fb6..f064015bc069 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/RetryPolicyTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/RetryPolicyTests.java @@ -5,11 +5,11 @@ import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; -import com.azure.core.http.MockHttpClient; import com.azure.core.http.MockHttpResponse; +import com.azure.core.http.clients.NoOpHttpClient; import org.junit.Assert; import org.junit.Test; import reactor.core.publisher.Mono; @@ -22,14 +22,14 @@ public class RetryPolicyTests { @Test public void exponentialRetryEndOn501() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() - .httpClient(new MockHttpClient() { + .httpClient(new NoOpHttpClient() { // Send 408, 500, 502, all retried, with a 501 ending private final int[] codes = new int[]{408, 500, 502, 501}; private int count = 0; @Override public Mono send(HttpRequest request) { - return Mono.just(new MockHttpResponse(request, codes[count++])); + return Mono.just(new MockHttpResponse(request, codes[count++])); } }) .policies(new RetryPolicy(3, Duration.of(0, ChronoUnit.MILLIS))) @@ -38,20 +38,20 @@ public Mono send(HttpRequest request) { HttpResponse response = pipeline.send(new HttpRequest(HttpMethod.GET, new URL("http://localhost/"))).block(); - Assert.assertEquals(501, response.statusCode()); + Assert.assertEquals(501, response.getStatusCode()); } @Test public void exponentialRetryMax() throws Exception { final int maxRetries = 5; final HttpPipeline pipeline = new HttpPipelineBuilder() - .httpClient(new MockHttpClient() { + .httpClient(new NoOpHttpClient() { int count = -1; @Override public Mono send(HttpRequest request) { Assert.assertTrue(count++ < maxRetries); - return Mono.just(new MockHttpResponse(request, 500)); + return Mono.just(new MockHttpResponse(request, 500)); } }) .policies(new RetryPolicy(maxRetries, Duration.of(0, ChronoUnit.MILLIS))) @@ -61,6 +61,6 @@ public Mono send(HttpRequest request) { HttpResponse response = pipeline.send(new HttpRequest(HttpMethod.GET, new URL("http://localhost/"))).block(); - Assert.assertEquals(500, response.statusCode()); + Assert.assertEquals(500, response.getStatusCode()); } } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/IterableResponseTest.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/IterableResponseTest.java index e74104f1a6b6..a5b05348eee7 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/IterableResponseTest.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/IterableResponseTest.java @@ -8,6 +8,7 @@ import java.util.List; import java.util.stream.Collectors; +import com.azure.core.util.IterableStream; import org.junit.Assert; import org.junit.Before; import org.junit.Rule; @@ -30,7 +31,7 @@ public void setup() { /*Ensure that if we call stream multiple times, it always returns same values and they are same as original list of values.*/ @Test public void testIterableResponseStreamFromStart() { - IterableResponse iterableResponse = getIntegerIterableResponse(2, 5); + IterableStream iterableResponse = getIntegerIterableResponse(2, 5); Assert.assertEquals(iterableResponse.stream().collect(Collectors.toList()).size(), iterableResponse.stream().collect(Collectors.toList()).size()); // ensure original list of values are same after calling iterator() @@ -41,7 +42,7 @@ public void testIterableResponseStreamFromStart() { /*Ensure that if we call iterator multiple times, it always returns same values and they are same as original list of values.*/ @Test public void testIterableResponseIteratorFromStart() { - IterableResponse iterableResponse = getIntegerIterableResponse(2, 5); + IterableStream iterableResponse = getIntegerIterableResponse(2, 5); List actualNumberValues1 = new ArrayList<>(); List actualNumberValues2 = new ArrayList<>(); iterableResponse.iterator().forEachRemaining(number -> actualNumberValues1.add(number)); @@ -53,8 +54,8 @@ public void testIterableResponseIteratorFromStart() { iterableResponse.iterator().forEachRemaining(number -> Assert.assertTrue(originalIntegerList.contains(number))); } - private IterableResponse getIntegerIterableResponse(int startNumber, int noOfValues) { + private IterableStream getIntegerIterableResponse(int startNumber, int noOfValues) { Flux integerFlux = Flux.range(startNumber, noOfValues); - return new IterableResponse<>(integerFlux); + return new IterableStream<>(integerFlux); } } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/PagedFluxTest.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/PagedFluxTest.java index ebbc020f8529..4e9fe4310a1d 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/PagedFluxTest.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/PagedFluxTest.java @@ -7,7 +7,6 @@ import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpRequest; import com.azure.core.implementation.http.PagedResponseBase; -import io.netty.handler.codec.http.HttpResponseStatus; import java.net.MalformedURLException; import java.net.URL; import java.util.List; @@ -84,6 +83,23 @@ public void testPagedFluxSubscribeToPagesWithSinglePageResult() throws Malformed .verifyComplete(); } + @Test + public void testPagedFluxSubscribeToPagesWithSinglePageResultWithoutNextPageRetriever() throws MalformedURLException { + PagedFlux pagedFlux = getIntegerPagedFluxSinglePage(); + StepVerifier.create(pagedFlux.byPage().log()) + .expectNext(pagedResponses.get(0)) + .verifyComplete(); + + pagedFlux = getIntegerPagedFluxSinglePage(); + StepVerifier.create(pagedFlux.byPage(null).log()) + .verifyComplete(); + + pagedFlux = getIntegerPagedFluxSinglePage(); + StepVerifier.create(pagedFlux.log()) + .expectNext(0, 1, 2) + .verifyComplete(); + } + @Test public void testPagedFluxSubscribeToPagesWithTwoPages() throws MalformedURLException { PagedFlux pagedFlux = getIntegerPagedFlux(2); @@ -124,9 +140,23 @@ private PagedFlux getIntegerPagedFlux(int noOfPages) throws MalformedUR continuationToken -> getNextPage(continuationToken, pagedResponses)); } + private PagedFlux getIntegerPagedFluxSinglePage() throws MalformedURLException { + HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1") + .put("header2", "value2"); + HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, new URL("http://localhost")); + + String deserializedHeaders = "header1,value1,header2,value2"; + pagedResponses = IntStream.range(0, 1) + .boxed() + .map(i -> createPagedResponse(httpRequest, httpHeaders, deserializedHeaders, i, 1)) + .collect(Collectors.toList()); + + return new PagedFlux<>(() -> pagedResponses.isEmpty() ? Mono.empty() : Mono.just(pagedResponses.get(0))); + } + private PagedResponseBase createPagedResponse(HttpRequest httpRequest, HttpHeaders httpHeaders, String deserializedHeaders, int i, int noOfPages) { - return new PagedResponseBase<>(httpRequest, HttpResponseStatus.OK.code(), + return new PagedResponseBase<>(httpRequest, 200, httpHeaders, getItems(i), i < noOfPages - 1 ? String.valueOf(i + 1) : null, diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/EncodedParameterTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/EncodedParameterTests.java index 28d5677bf57c..c10348c0e93d 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/EncodedParameterTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/EncodedParameterTests.java @@ -11,7 +11,7 @@ public class EncodedParameterTests { @Test public void constructor() { final EncodedParameter ep = new EncodedParameter("ABC", "123"); - assertEquals("ABC", ep.name()); - assertEquals("123", ep.encodedValue()); + assertEquals("ABC", ep.getName()); + assertEquals("123", ep.getEncodedValue()); } } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyStressTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyStressTests.java index a8a7258c419f..89364f1501cb 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyStressTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyStressTests.java @@ -4,14 +4,6 @@ package com.azure.core.implementation; import com.azure.core.MockServer; -import com.azure.core.implementation.annotation.BodyParam; -import com.azure.core.implementation.annotation.Delete; -import com.azure.core.implementation.annotation.ExpectedResponses; -import com.azure.core.implementation.annotation.Get; -import com.azure.core.implementation.annotation.HeaderParam; -import com.azure.core.implementation.annotation.Host; -import com.azure.core.implementation.annotation.Put; -import com.azure.core.implementation.annotation.PathParam; import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpPipelineBuilder; @@ -26,11 +18,15 @@ import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.http.rest.StreamResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.implementation.annotation.BodyParam; +import com.azure.core.implementation.annotation.Delete; +import com.azure.core.implementation.annotation.ExpectedResponses; +import com.azure.core.implementation.annotation.Get; +import com.azure.core.implementation.annotation.HeaderParam; +import com.azure.core.implementation.annotation.Host; +import com.azure.core.implementation.annotation.PathParam; +import com.azure.core.implementation.annotation.Put; import com.azure.core.implementation.http.ContentType; -import com.azure.core.implementation.util.FluxUtil; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.util.ResourceLeakDetector; import org.junit.AfterClass; import org.junit.Assert; import org.junit.Assume; @@ -46,16 +42,13 @@ import java.io.File; import java.io.IOException; import java.lang.ProcessBuilder.Redirect; -import java.nio.MappedByteBuffer; -import java.nio.channels.AsynchronousFileChannel; -import java.nio.channels.FileChannel; +import java.nio.ByteBuffer; import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.NoSuchFileException; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.SimpleFileVisitor; -import java.nio.file.StandardOpenOption; import java.nio.file.attribute.BasicFileAttributes; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; @@ -65,10 +58,10 @@ import java.util.ArrayList; import java.util.Base64; import java.util.List; -import java.util.Random; import java.util.concurrent.ThreadLocalRandom; import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.fail; public class RestProxyStressTests { private static IOService service; @@ -84,9 +77,6 @@ public static void beforeClass() throws IOException { "Set the environment variable JAVA_SDK_STRESS_TESTS to \"true\" to run stress tests", Boolean.parseBoolean(System.getenv("JAVA_SDK_STRESS_TESTS"))); - ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.PARANOID); - LoggerFactory.getLogger(RestProxyStressTests.class).info("ResourceLeakDetector level: " + ResourceLeakDetector.getLevel()); - String tempFolderPath = System.getenv("JAVA_STRESS_TEST_TEMP_PATH"); if (tempFolderPath == null || tempFolderPath.isEmpty()) { tempFolderPath = "temp"; @@ -150,12 +140,12 @@ public Mono process(HttpPipelineCallContext context, HttpPipelineN Mono process(final int waitTimeSeconds, final HttpPipelineCallContext context, final HttpPipelineNextPolicy nextPolicy) { return nextPolicy.clone().process().flatMap(httpResponse -> { - if (httpResponse.statusCode() != 503 && httpResponse.statusCode() != 500) { + if (httpResponse.getStatusCode() != 503 && httpResponse.getStatusCode() != 500) { return Mono.just(httpResponse); } else { - LoggerFactory.getLogger(getClass()).warn("Received " + httpResponse.statusCode() + " for request. Waiting " + waitTimeSeconds + " seconds before retry."); + LoggerFactory.getLogger(getClass()).warn("Received " + httpResponse.getStatusCode() + " for request. Waiting " + waitTimeSeconds + " seconds before retry."); final int nextWaitTime = 5 + ThreadLocalRandom.current().nextInt(10); - httpResponse.body().subscribe().dispose(); // TODO: Anu re-evaluate this + httpResponse.getBody().subscribe().dispose(); // TODO: Anu re-evaluate this return Mono.delay(Duration.of(waitTimeSeconds, ChronoUnit.SECONDS)) .then(process(nextWaitTime, context, nextPolicy)); } @@ -174,7 +164,7 @@ Mono process(final int waitTimeSeconds, final HttpPipelineCallCont interface IOService { @ExpectedResponses({201}) @Put("/javasdktest/upload/100m-{id}.dat?{sas}") - Mono upload100MB(@PathParam("id") String id, @PathParam(value = "sas", encoded = true) String sas, @HeaderParam("x-ms-blob-type") String blobType, @BodyParam(ContentType.APPLICATION_OCTET_STREAM) Flux stream, @HeaderParam("content-length") long contentLength); + Mono upload100MB(@PathParam("id") String id, @PathParam(value = "sas", encoded = true) String sas, @HeaderParam("x-ms-blob-type") String blobType, @BodyParam(ContentType.APPLICATION_OCTET_STREAM) Flux stream, @HeaderParam("content-length") long contentLength); @Get("/javasdktest/upload/100m-{id}.dat?{sas}") Mono download100M(@PathParam("id") String id, @PathParam(value = "sas", encoded = true) String sas); @@ -218,50 +208,53 @@ public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOEx } private static void create100MFiles(boolean recreate) throws IOException { - final Flux contentGenerator = Flux.generate(Random::new, (random, emitter) -> { - byte[] ba = new byte[CHUNK_SIZE]; - random.nextBytes(ba); - emitter.next(Unpooled.wrappedBuffer(ba)); - return random; - }); - - if (recreate) { - deleteRecursive(tempFolderPath); - } - - if (Files.exists(tempFolderPath)) { - LoggerFactory.getLogger(RestProxyStressTests.class).info("Temp files directory already exists: " + tempFolderPath.toAbsolutePath()); - } else { - LoggerFactory.getLogger(RestProxyStressTests.class).info("Generating temp files in directory: " + tempFolderPath.toAbsolutePath()); - Files.createDirectory(tempFolderPath); - Flux.range(0, NUM_FILES).flatMap(integer -> { - try { - final int i = integer; - final Path filePath = tempFolderPath.resolve("100m-" + i + ".dat"); - - Files.deleteIfExists(filePath); - Files.createFile(filePath); - final AsynchronousFileChannel file = AsynchronousFileChannel.open(filePath, StandardOpenOption.READ, StandardOpenOption.WRITE); - final MessageDigest messageDigest = MessageDigest.getInstance("MD5"); - - Flux fileContent = contentGenerator - .take(CHUNKS_PER_FILE) - .doOnNext(buf -> messageDigest.update(buf.array())); - - return FluxUtil.bytebufStreamToFile(fileContent, file).then(Mono.fromRunnable(() -> { - try { - file.close(); - Files.write(tempFolderPath.resolve("100m-" + i + "-md5.dat"), messageDigest.digest()); - LoggerFactory.getLogger(RestProxyStressTests.class).info("Finished writing file " + i); - } catch (Exception e) { - throw Exceptions.propagate(e); - } - })); - } catch (Exception e) { - return Flux.error(e); - } - }).blockLast(); - } +// final Flux contentGenerator = Flux.generate(Random::new, (random, emitter) -> { +// byte[] ba = new byte[CHUNK_SIZE]; +// random.nextBytes(ba); +// emitter.next(ByteBuffer.wrap(ba)); +// return random; +// }); +// +// if (recreate) { +// deleteRecursive(tempFolderPath); +// } +// +// if (Files.exists(tempFolderPath)) { +// LoggerFactory.getLogger(RestProxyStressTests.class).info("Temp files directory already exists: " + tempFolderPath.toAbsolutePath()); +// } else { +// LoggerFactory.getLogger(RestProxyStressTests.class).info("Generating temp files in directory: " + tempFolderPath.toAbsolutePath()); +// Files.createDirectory(tempFolderPath); +// Flux.range(0, NUM_FILES).flatMap(integer -> { +// try { +// final int i = integer; +// final Path filePath = tempFolderPath.resolve("100m-" + i + ".dat"); +// +// Files.deleteIfExists(filePath); +// Files.createFile(filePath); +// final AsynchronousFileChannel file = AsynchronousFileChannel.open(filePath, StandardOpenOption.READ, StandardOpenOption.WRITE); +// final MessageDigest messageDigest = MessageDigest.getInstance("MD5"); +// +// Flux fileContent = contentGenerator +// .take(CHUNKS_PER_FILE) +// .doOnNext(buf -> messageDigest.update(buf.array())); +// +// return FluxUtil.bytebufStreamToFile(fileContent, file).then(Mono.fromRunnable(() -> { +// try { +// file.close(); +// Files.write(tempFolderPath.resolve("100m-" + i + "-md5.dat"), messageDigest.digest()); +// LoggerFactory.getLogger(RestProxyStressTests.class).info("Finished writing file " + i); +// } catch (Exception e) { +// throw Exceptions.propagate(e); +// } +// })); +// } catch (Exception e) { +// return Flux.error(e); +// } +// }).blockLast(); +// } + + // TODO + fail("This method is not yet re-implemented"); } @Test @@ -272,90 +265,92 @@ public void prepare100MFiles() throws Exception { @Test public void upload100MParallelTest() { - final String sas = System.getenv("JAVA_SDK_TEST_SAS") == null ? "" : System.getenv("JAVA_SDK_TEST_SAS"); - - Flux md5s = Flux.range(0, NUM_FILES) - .map(integer -> { - final Path filePath = tempFolderPath.resolve("100m-" + integer + "-md5.dat"); - try { - return Files.readAllBytes(filePath); - } catch (IOException ioe) { - throw Exceptions.propagate(ioe); - } - }); - // - Instant uploadStart = Instant.now(); - // - Flux.range(0, NUM_FILES) - .zipWith(md5s, (id, md5) -> { - AsynchronousFileChannel fileStream = null; - try { - fileStream = AsynchronousFileChannel.open(tempFolderPath.resolve("100m-" + id + ".dat")); - } catch (IOException ioe) { - Exceptions.propagate(ioe); - } - return service.upload100MB(String.valueOf(id), sas, "BlockBlob", FluxUtil.byteBufStreamFromFile(fileStream), FILE_SIZE).map(response -> { - String base64MD5 = response.headers().value("Content-MD5"); - byte[] receivedMD5 = Base64.getDecoder().decode(base64MD5); - Assert.assertArrayEquals(md5, receivedMD5); - return response; - }); - }) - .flatMapDelayError(m -> m, 15, 1) - .blockLast(); - // - long durationMilliseconds = Duration.between(uploadStart, Instant.now()).toMillis(); - LoggerFactory.getLogger(getClass()).info("Upload took " + durationMilliseconds + " milliseconds."); +// final String sas = System.getenv("JAVA_SDK_TEST_SAS") == null ? "" : System.getenv("JAVA_SDK_TEST_SAS"); +// +// Flux md5s = Flux.range(0, NUM_FILES) +// .map(integer -> { +// final Path filePath = tempFolderPath.resolve("100m-" + integer + "-md5.dat"); +// try { +// return Files.readAllBytes(filePath); +// } catch (IOException ioe) { +// throw Exceptions.propagate(ioe); +// } +// }); +// // +// Instant uploadStart = Instant.now(); +// // +// Flux.range(0, NUM_FILES) +// .zipWith(md5s, (id, md5) -> { +// AsynchronousFileChannel fileStream = null; +// try { +// fileStream = AsynchronousFileChannel.open(tempFolderPath.resolve("100m-" + id + ".dat")); +// } catch (IOException ioe) { +// Exceptions.propagate(ioe); +// } +// return service.upload100MB(String.valueOf(id), sas, "BlockBlob", FluxUtil.byteBufStreamFromFile(fileStream), FILE_SIZE).map(response -> { +// String base64MD5 = response.headers().value("Content-MD5"); +// byte[] receivedMD5 = Base64.getDecoder().decode(base64MD5); +// Assert.assertArrayEquals(md5, receivedMD5); +// return response; +// }); +// }) +// .flatMapDelayError(m -> m, 15, 1) +// .blockLast(); +// // +// long durationMilliseconds = Duration.between(uploadStart, Instant.now()).toMillis(); +// LoggerFactory.getLogger(getClass()).info("Upload took " + durationMilliseconds + " milliseconds."); + Assert.fail("Need to implement this test again"); } @Test public void uploadMemoryMappedTest() { - final String sas = System.getenv("JAVA_SDK_TEST_SAS") == null ? "" : System.getenv("JAVA_SDK_TEST_SAS"); - - Flux md5s = Flux.range(0, NUM_FILES) - .map(integer -> { - final Path filePath = tempFolderPath.resolve("100m-" + integer + "-md5.dat"); - try { - return Files.readAllBytes(filePath); - } catch (IOException ioe) { - throw Exceptions.propagate(ioe); - } - }); - - Instant uploadStart = Instant.now(); - // - Flux.range(0, NUM_FILES) - .zipWith(md5s, (id, md5) -> { - FileChannel fileStream = null; - try { - fileStream = FileChannel.open(tempFolderPath.resolve("100m-" + id + ".dat"), StandardOpenOption.READ); - } catch (IOException ioe) { - Exceptions.propagate(ioe); - } - // - ByteBuf mappedByteBufFile = null; - Flux stream = null; - try { - MappedByteBuffer mappedByteBufferFile = fileStream.map(FileChannel.MapMode.READ_ONLY, 0, fileStream.size()); - mappedByteBufFile = Unpooled.wrappedBuffer(mappedByteBufferFile); - stream = FluxUtil.split(mappedByteBufFile, CHUNK_SIZE); - } catch (IOException ioe) { - mappedByteBufFile.release(); - Exceptions.propagate(ioe); - } - // - return service.upload100MB(String.valueOf(id), sas, "BlockBlob", stream, FILE_SIZE).map(response -> { - String base64MD5 = response.headers().value("Content-MD5"); - byte[] receivedMD5 = Base64.getDecoder().decode(base64MD5); - Assert.assertArrayEquals(md5, receivedMD5); - return response; - }); - }) - .flatMapDelayError(m -> m, 15, 1) - .blockLast(); - // - long durationMilliseconds = Duration.between(uploadStart, Instant.now()).toMillis(); - LoggerFactory.getLogger(getClass()).info("Upload took " + durationMilliseconds + " milliseconds."); +// final String sas = System.getenv("JAVA_SDK_TEST_SAS") == null ? "" : System.getenv("JAVA_SDK_TEST_SAS"); +// +// Flux md5s = Flux.range(0, NUM_FILES) +// .map(integer -> { +// final Path filePath = tempFolderPath.resolve("100m-" + integer + "-md5.dat"); +// try { +// return Files.readAllBytes(filePath); +// } catch (IOException ioe) { +// throw Exceptions.propagate(ioe); +// } +// }); +// +// Instant uploadStart = Instant.now(); +// // +// Flux.range(0, NUM_FILES) +// .zipWith(md5s, (id, md5) -> { +// FileChannel fileStream = null; +// try { +// fileStream = FileChannel.open(tempFolderPath.resolve("100m-" + id + ".dat"), StandardOpenOption.READ); +// } catch (IOException ioe) { +// Exceptions.propagate(ioe); +// } +// // +// ByteBuffer mappedByteBufFile = null; +// Flux stream = null; +// try { +// MappedByteBuffer mappedByteBufferFile = fileStream.map(FileChannel.MapMode.READ_ONLY, 0, fileStream.size()); +// mappedByteBufFile = Unpooled.wrappedBuffer(mappedByteBufferFile); +// stream = FluxUtil.split(mappedByteBufFile, CHUNK_SIZE); +// } catch (IOException ioe) { +// mappedByteBufFile.release(); +// Exceptions.propagate(ioe); +// } +// // +// return service.upload100MB(String.valueOf(id), sas, "BlockBlob", stream, FILE_SIZE).map(response -> { +// String base64MD5 = response.headers().value("Content-MD5"); +// byte[] receivedMD5 = Base64.getDecoder().decode(base64MD5); +// Assert.assertArrayEquals(md5, receivedMD5); +// return response; +// }); +// }) +// .flatMapDelayError(m -> m, 15, 1) +// .blockLast(); +// // +// long durationMilliseconds = Duration.between(uploadStart, Instant.now()).toMillis(); +// LoggerFactory.getLogger(getClass()).info("Upload took " + durationMilliseconds + " milliseconds."); + Assert.fail("Need to implement this test again"); } @@ -381,11 +376,11 @@ public void download100MParallelTest() { Flux.range(0, NUM_FILES) .zipWith(md5s, (id, md5) -> { return service.download100M(String.valueOf(id), sas).flatMap(response -> { - Flux content; + Flux content; try { MessageDigest messageDigest = MessageDigest.getInstance("MD5"); - content = response.value() - .doOnNext(buf -> messageDigest.update(buf.slice().nioBuffer())); + content = response.getValue() + .doOnNext(buf -> messageDigest.update(buf.slice())); return content.last().doOnSuccess(b -> { assertArrayEquals(md5, messageDigest.digest()); @@ -424,10 +419,10 @@ public void downloadUploadStreamingTest() { Flux.range(0, NUM_FILES) .zipWith(md5s, (integer, md5) -> { final int id = integer; - Flux downloadContent = service.download100M(String.valueOf(id), sas) + Flux downloadContent = service.download100M(String.valueOf(id), sas) // Ideally we would intercept this content to load an MD5 to check consistency between download and upload directly, // but it's sufficient to demonstrate that no corruption occurred between preparation->upload->download->upload. - .flatMapMany(StreamResponse::value) + .flatMapMany(StreamResponse::getValue) .map(reactorNettybb -> { // // This test 'downloadUploadStreamingTest' exercises piping scenario. @@ -453,12 +448,14 @@ public void downloadUploadStreamingTest() { // // Solution is to aware of ByteBufFlux auto-release property and retain each chunk before passing to Netty.write(). // - return reactorNettybb.retain(); +// return reactorNettybb.retain(); + // TODO + throw new IllegalStateException("This method is not yet re-implemented"); }); // return service.upload100MB("copy-" + integer, sas, "BlockBlob", downloadContent, FILE_SIZE) .flatMap(uploadResponse -> { - String base64MD5 = uploadResponse.headers().value("Content-MD5"); + String base64MD5 = uploadResponse.getHeaders().value("Content-MD5"); byte[] uploadMD5 = Base64.getDecoder().decode(base64MD5); assertArrayEquals(md5, uploadMD5); LoggerFactory.getLogger(getClass()).info("Finished upload and validation for id " + id); @@ -478,7 +475,7 @@ public void cancellationTest() throws Exception { final Disposable d = Flux.range(0, NUM_FILES) .flatMap(integer -> service.download100M(String.valueOf(integer), sas) - .flatMapMany(StreamResponse::value)) + .flatMapMany(StreamResponse::getValue)) .subscribe(); Mono.delay(Duration.ofSeconds(10)).then(Mono.defer(() -> { @@ -519,7 +516,7 @@ public void testHighParallelism() { .onErrorResume(throwable -> { if (throwable instanceof HttpResponseException) { HttpResponseException restException = (HttpResponseException) throwable; - if ((restException.response().statusCode() == 409 || restException.response().statusCode() == 404)) { + if ((restException.getResponse().getStatusCode() == 409 || restException.getResponse().getStatusCode() == 404)) { return Mono.empty(); } } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyTests.java index 36137bf7e205..ab5abc128346 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyTests.java @@ -36,18 +36,21 @@ import com.azure.core.http.rest.ResponseBase; import com.azure.core.http.rest.StreamResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.exception.UnexpectedLengthException; import com.azure.core.implementation.http.ContentType; import com.azure.core.implementation.serializer.SerializerAdapter; import com.azure.core.implementation.serializer.jackson.JacksonAdapter; import com.azure.core.implementation.util.FluxUtil; -import io.netty.buffer.ByteBuf; -import io.netty.util.ReferenceCountUtil; +import java.nio.charset.StandardCharsets; import org.junit.Assert; import org.junit.Ignore; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.ExpectedException; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import java.nio.ByteBuffer; import java.nio.channels.AsynchronousFileChannel; import java.nio.file.Files; import java.nio.file.Path; @@ -58,6 +61,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import reactor.test.StepVerifier; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; @@ -75,6 +79,9 @@ public abstract class RestProxyTests { */ protected abstract HttpClient createHttpClient(); + @Rule + public ExpectedException thrown = ExpectedException.none(); + @Host("http://httpbin.org") @ServiceInterface(name = "Service1") private interface Service1 { @@ -431,6 +438,16 @@ private interface Service9 { @ExpectedResponses({200}) 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); + + @Put("put") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(MyRestException.class) + 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); @@ -501,6 +518,79 @@ public void asyncPutRequestWithIntBody() { assertEquals("42", json.data()); } + // Test all scenarios for the body length and content length comparison for sync API + @Test + public void syncPutRequestWithBodyAndEqualContentLength() { + ByteBuffer body = ByteBuffer.wrap("test".getBytes(StandardCharsets.UTF_8)); + final HttpBinJSON json = createService(Service9.class) + .putBodyAndContentLength(body, 4L); + assertEquals("test", json.data()); + assertEquals("application/octet-stream", json.headers().get(("Content-Type"))); + assertEquals("4", json.headers().get(("Content-Length"))); + body.clear(); + } + + @Test + public void syncPutRequestWithBodyLessThanContentLength() { + ByteBuffer body = ByteBuffer.wrap("test".getBytes(StandardCharsets.UTF_8)); + thrown.expect(UnexpectedLengthException.class); + thrown.expectMessage("less than"); + createService(Service9.class) + .putBodyAndContentLength(body, 5L); + body.clear(); + } + + @Test + public void syncPutRequestWithBodyMoreThanContentLength() { + ByteBuffer body = ByteBuffer.wrap("test".getBytes(StandardCharsets.UTF_8)); + thrown.expect(UnexpectedLengthException.class); + thrown.expectMessage("more than"); + createService(Service9.class) + .putBodyAndContentLength(body, 3L); + body.clear(); + } + + // Test all scenarios for the body length and content length comparison for Async API + @Test + public void asyncPutRequestWithBodyAndEqualContentLength() { + Flux body = Flux.just(ByteBuffer.wrap("test".getBytes(StandardCharsets.UTF_8))); + StepVerifier.create(createService(Service9.class) + .putAsyncBodyAndContentLength(body, 4L)) + .assertNext( + json -> { + assertEquals("test", json.data()); + assertEquals("application/octet-stream", json.headers().get(("Content-Type"))); + assertEquals("4", json.headers().get(("Content-Length"))); + } + ).verifyComplete(); + } + + @Test + public void asyncPutRequestWithBodyAndLessThanContentLength() { + Flux body = Flux.just(ByteBuffer.wrap("test".getBytes(StandardCharsets.UTF_8))); + StepVerifier.create(createService(Service9.class) + .putAsyncBodyAndContentLength(body, 5L)) + .verifyErrorSatisfies( + exception -> { + assertTrue(exception instanceof UnexpectedLengthException); + assertTrue(exception.getMessage().contains("less than")); + } + ); + } + + @Test + public void asyncPutRequestWithBodyAndMoreThanContentLength() { + Flux body = Flux.just(ByteBuffer.wrap("test".getBytes(StandardCharsets.UTF_8))); + StepVerifier.create(createService(Service9.class) + .putAsyncBodyAndContentLength(body, 3L)) + .verifyErrorSatisfies( + exception -> { + assertTrue(exception instanceof UnexpectedLengthException); + assertTrue(exception.getMessage().contains("more than")); + } + ); + } + @Test public void syncPutRequestWithUnexpectedResponse() { try { @@ -508,11 +598,11 @@ public void syncPutRequestWithUnexpectedResponse() { .putWithUnexpectedResponse("I'm the body!"); fail("Expected HttpResponseException would be thrown."); } catch (HttpResponseException e) { - assertNotNull(e.value()); - assertTrue(e.value() instanceof LinkedHashMap); + assertNotNull(e.getValue()); + assertTrue(e.getValue() instanceof LinkedHashMap); @SuppressWarnings("unchecked") - final LinkedHashMap expectedBody = (LinkedHashMap) e.value(); + final LinkedHashMap expectedBody = (LinkedHashMap) e.getValue(); assertEquals("I'm the body!", expectedBody.get("data")); } } @@ -525,11 +615,11 @@ public void asyncPutRequestWithUnexpectedResponse() { .block(); fail("Expected HttpResponseException would be thrown."); } catch (HttpResponseException e) { - assertNotNull(e.value()); - assertTrue(e.value() instanceof LinkedHashMap); + assertNotNull(e.getValue()); + assertTrue(e.getValue() instanceof LinkedHashMap); @SuppressWarnings("unchecked") - final LinkedHashMap expectedBody = (LinkedHashMap) e.value(); + final LinkedHashMap expectedBody = (LinkedHashMap) e.getValue(); assertEquals("I'm the body!", expectedBody.get("data")); } } @@ -541,8 +631,8 @@ public void syncPutRequestWithUnexpectedResponseAndExceptionType() { .putWithUnexpectedResponseAndExceptionType("I'm the body!"); fail("Expected HttpResponseException would be thrown."); } catch (MyRestException e) { - assertNotNull(e.value()); - Assert.assertEquals("I'm the body!", e.value().data()); + assertNotNull(e.getValue()); + Assert.assertEquals("I'm the body!", e.getValue().data()); } catch (Throwable e) { fail("Expected MyRestException would be thrown. Instead got " + e.getClass().getSimpleName()); } @@ -556,8 +646,8 @@ public void asyncPutRequestWithUnexpectedResponseAndExceptionType() { .block(); fail("Expected HttpResponseException would be thrown."); } catch (MyRestException e) { - assertNotNull(e.value()); - Assert.assertEquals("I'm the body!", e.value().data()); + assertNotNull(e.getValue()); + Assert.assertEquals("I'm the body!", e.getValue().data()); } catch (Throwable e) { fail("Expected MyRestException would be thrown. Instead got " + e.getClass().getSimpleName()); } @@ -570,8 +660,8 @@ public void syncPutRequestWithUnexpectedResponseAndDeterminedExceptionType() { .putWithUnexpectedResponseAndDeterminedExceptionType("I'm the body!"); fail("Expected HttpResponseException would be thrown."); } catch (MyRestException e) { - assertNotNull(e.value()); - Assert.assertEquals("I'm the body!", e.value().data()); + assertNotNull(e.getValue()); + Assert.assertEquals("I'm the body!", e.getValue().data()); } catch (Throwable e) { fail("Expected MyRestException would be thrown. Instead got " + e.getClass().getSimpleName()); } @@ -585,8 +675,8 @@ public void asyncPutRequestWithUnexpectedResponseAndDeterminedExceptionType() { .block(); fail("Expected HttpResponseException would be thrown."); } catch (MyRestException e) { - assertNotNull(e.value()); - Assert.assertEquals("I'm the body!", e.value().data()); + assertNotNull(e.getValue()); + Assert.assertEquals("I'm the body!", e.getValue().data()); } catch (Throwable e) { fail("Expected MyRestException would be thrown. Instead got " + e.getClass().getSimpleName()); } @@ -599,8 +689,8 @@ public void syncPutRequestWithUnexpectedResponseAndFallthroughExceptionType() { .putWithUnexpectedResponseAndFallthroughExceptionType("I'm the body!"); fail("Expected HttpResponseException would be thrown."); } catch (MyRestException e) { - assertNotNull(e.value()); - Assert.assertEquals("I'm the body!", e.value().data()); + assertNotNull(e.getValue()); + Assert.assertEquals("I'm the body!", e.getValue().data()); } catch (Throwable e) { fail("Expected MyRestException would be thrown. Instead got " + e.getClass().getSimpleName()); } @@ -614,8 +704,8 @@ public void asyncPutRequestWithUnexpectedResponseAndFallthroughExceptionType() { .block(); fail("Expected HttpResponseException would be thrown."); } catch (MyRestException e) { - assertNotNull(e.value()); - Assert.assertEquals("I'm the body!", e.value().data()); + assertNotNull(e.getValue()); + Assert.assertEquals("I'm the body!", e.getValue().data()); } catch (Throwable e) { fail("Expected MyRestException would be thrown. Instead got " + e.getClass().getSimpleName()); } @@ -628,11 +718,11 @@ public void syncPutRequestWithUnexpectedResponseAndNoFallthroughExceptionType() .putWithUnexpectedResponseAndNoFallthroughExceptionType("I'm the body!"); fail("Expected HttpResponseException would be thrown."); } catch (HttpResponseException e) { - assertNotNull(e.value()); - assertTrue(e.value() instanceof LinkedHashMap); + assertNotNull(e.getValue()); + assertTrue(e.getValue() instanceof LinkedHashMap); @SuppressWarnings("unchecked") - final LinkedHashMap expectedBody = (LinkedHashMap) e.value(); + final LinkedHashMap expectedBody = (LinkedHashMap) e.getValue(); assertEquals("I'm the body!", expectedBody.get("data")); } catch (Throwable e) { fail("Expected MyRestException would be thrown. Instead got " + e.getClass().getSimpleName()); @@ -647,11 +737,11 @@ public void asyncPutRequestWithUnexpectedResponseAndNoFallthroughExceptionType() .block(); fail("Expected HttpResponseException would be thrown."); } catch (HttpResponseException e) { - assertNotNull(e.value()); - assertTrue(e.value() instanceof LinkedHashMap); + assertNotNull(e.getValue()); + assertTrue(e.getValue() instanceof LinkedHashMap); @SuppressWarnings("unchecked") - final LinkedHashMap expectedBody = (LinkedHashMap) e.value(); + final LinkedHashMap expectedBody = (LinkedHashMap) e.getValue(); assertEquals("I'm the body!", expectedBody.get("data")); } catch (Throwable e) { fail("Expected MyRestException would be thrown. Instead got " + e.getClass().getSimpleName()); @@ -690,7 +780,7 @@ private interface Service10 { public void syncHeadRequest() { final Void body = createService(Service10.class) .head() - .value(); + .getValue(); assertNull(body); } @@ -711,7 +801,7 @@ public void asyncHeadRequest() { final Void body = createService(Service10.class) .headAsync() .block() - .value(); + .getValue(); assertNull(body); } @@ -1331,9 +1421,9 @@ public void service20GetBytes100OnlyHeaders() { .getBytes100OnlyHeaders(); assertNotNull(response); - assertEquals(200, response.statusCode()); + assertEquals(200, response.getStatusCode()); - final HttpBinHeaders headers = response.deserializedHeaders(); + final HttpBinHeaders headers = response.getDeserializedHeaders(); assertNotNull(headers); assertEquals(true, headers.accessControlAllowCredentials()); assertEquals("keep-alive", headers.connection().toLowerCase()); @@ -1348,13 +1438,13 @@ public void service20GetBytes100BodyAndHeaders() { .getBytes100BodyAndHeaders(); assertNotNull(response); - assertEquals(200, response.statusCode()); + assertEquals(200, response.getStatusCode()); - final byte[] body = response.value(); + final byte[] body = response.getValue(); assertNotNull(body); assertEquals(100, body.length); - final HttpBinHeaders headers = response.deserializedHeaders(); + final HttpBinHeaders headers = response.getDeserializedHeaders(); assertNotNull(headers); assertEquals(true, headers.accessControlAllowCredentials()); assertNotNull(headers.date()); @@ -1367,7 +1457,7 @@ public void service20GetBytesOnlyStatus() { final Response response = createService(Service20.class) .getBytesOnlyStatus(); assertNotNull(response); - assertEquals(200, response.statusCode()); + assertEquals(200, response.getStatusCode()); } @Test @@ -1376,9 +1466,9 @@ public void service20GetBytesOnlyHeaders() { .getBytes100OnlyRawHeaders(); assertNotNull(response); - assertEquals(200, response.statusCode()); - assertNotNull(response.headers()); - assertNotEquals(0, response.headers().size()); + assertEquals(200, response.getStatusCode()); + assertNotNull(response.getHeaders()); + assertNotEquals(0, response.getHeaders().getSize()); } @Test @@ -1387,9 +1477,9 @@ public void service20PutOnlyHeaders() { .putOnlyHeaders("body string"); assertNotNull(response); - assertEquals(200, response.statusCode()); + assertEquals(200, response.getStatusCode()); - final HttpBinHeaders headers = response.deserializedHeaders(); + final HttpBinHeaders headers = response.getDeserializedHeaders(); assertNotNull(headers); assertEquals(true, headers.accessControlAllowCredentials()); assertEquals("keep-alive", headers.connection().toLowerCase()); @@ -1404,14 +1494,14 @@ public void service20PutBodyAndHeaders() { .putBodyAndHeaders("body string"); assertNotNull(response); - assertEquals(200, response.statusCode()); + assertEquals(200, response.getStatusCode()); - final HttpBinJSON body = response.value(); + final HttpBinJSON body = response.getValue(); assertNotNull(body); assertMatchWithHttpOrHttps("httpbin.org/put", body.url()); assertEquals("body string", body.data()); - final HttpBinHeaders headers = response.deserializedHeaders(); + final HttpBinHeaders headers = response.getDeserializedHeaders(); assertNotNull(headers); assertEquals(true, headers.accessControlAllowCredentials()); assertEquals("keep-alive", headers.connection().toLowerCase()); @@ -1424,21 +1514,21 @@ public void service20PutBodyAndHeaders() { public void service20GetVoidResponse() { final VoidResponse response = createService(Service20.class).getVoidResponse(); assertNotNull(response); - assertEquals(200, response.statusCode()); + assertEquals(200, response.getStatusCode()); } @Test public void service20GetResponseBody() { final Response response = createService(Service20.class).putBody("body string"); assertNotNull(response); - assertEquals(200, response.statusCode()); + assertEquals(200, response.getStatusCode()); - final HttpBinJSON body = response.value(); + final HttpBinJSON body = response.getValue(); assertNotNull(body); assertMatchWithHttpOrHttps("httpbin.org/put", body.url()); assertEquals("body string", body.data()); - final HttpHeaders headers = response.headers(); + final HttpHeaders headers = response.getHeaders(); assertNotNull(headers); } @@ -1483,17 +1573,16 @@ interface DownloadService { StreamResponse getBytes(); @Get("/bytes/30720") - Flux getBytesFlowable(); + Flux getBytesFlowable(); } @Test public void simpleDownloadTest() { try (StreamResponse response = createService(DownloadService.class).getBytes()) { int count = 0; - for (ByteBuf byteBuf : response.value().doOnNext(b -> b.retain()).toIterable()) { + for (ByteBuffer byteBuf : response.getValue().toIterable()) { // assertEquals(1, byteBuf.refCnt()); - count += byteBuf.readableBytes(); - ReferenceCountUtil.refCnt(byteBuf); + count += byteBuf.remaining(); } assertEquals(30720, count); } @@ -1501,11 +1590,10 @@ public void simpleDownloadTest() { @Test public void rawFlowableDownloadTest() { - Flux response = createService(DownloadService.class).getBytesFlowable(); + Flux response = createService(DownloadService.class).getBytesFlowable(); int count = 0; - for (ByteBuf byteBuf : response.doOnNext(b -> b.retain()).toIterable()) { - count += byteBuf.readableBytes(); - ReferenceCountUtil.refCnt(byteBuf); + for (ByteBuffer byteBuf : response.toIterable()) { + count += byteBuf.remaining(); } assertEquals(30720, count); } @@ -1514,13 +1602,13 @@ 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 - public void flowableUploadTest() throws Exception { + public void fluxUploadTest() throws Exception { Path filePath = Paths.get(getClass().getClassLoader().getResource("upload.txt").toURI()); - Flux stream = FluxUtil.byteBufStreamFromFile(AsynchronousFileChannel.open(filePath)); + Flux stream = FluxUtil.readFile(AsynchronousFileChannel.open(filePath)); final HttpClient httpClient = createHttpClient(); // Scenario: Log the body so that body buffering/replay behavior is exercised. @@ -1534,7 +1622,7 @@ public void flowableUploadTest() throws Exception { // Response response = RestProxy.create(FlowableUploadService.class, httpPipeline, SERIALIZER).put(stream, Files.size(filePath)); - assertEquals("The quick brown fox jumps over the lazy dog", response.value().data()); + assertEquals("The quick brown fox jumps over the lazy dog", response.getValue().data()); } @Test @@ -1542,15 +1630,15 @@ 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) - .put(FluxUtil.byteBufStreamFromFile(fileChannel, 4, 15), 15); + .put(FluxUtil.readFile(fileChannel, 4, 15), 15); - assertEquals("quick brown fox", response.value().data()); + assertEquals("quick brown fox", response.getValue().data()); } @Host("{url}") @ServiceInterface(name = "Service22") interface Service22 { - @Get("{container}/{blob}") + @Get("/") byte[] getBytes(@HostParam("url") String url); } @@ -1640,7 +1728,7 @@ interface Service26 { @Test public void postUrlFormEncoded() { - Service26 service = RestProxy.create(Service26.class, new HttpPipelineBuilder().build()); + Service26 service = createService(Service26.class); HttpBinFormDataJSON response = service.postForm("Foo", "123", "foo@bar.com", PizzaSize.LARGE, Arrays.asList("Bacon", "Onion")); assertNotNull(response); assertNotNull(response.form()); diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyWithHttpProxyNettyTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyWithHttpProxyNettyTests.java deleted file mode 100644 index 4cd0e9cb04a4..000000000000 --- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyWithHttpProxyNettyTests.java +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.implementation; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.ProxyOptions; -import com.azure.core.http.ProxyOptions.Type; -import org.junit.Ignore; - -import java.net.InetSocketAddress; - -@Ignore("Should only be run manually when a local proxy server (e.g. Fiddler) is running") -public class RestProxyWithHttpProxyNettyTests extends RestProxyTests { - - @Override - protected HttpClient createHttpClient() { - InetSocketAddress address = new InetSocketAddress("localhost", 8888); - return HttpClient.createDefault().proxy(() -> new ProxyOptions(Type.HTTP, address)); - } -} diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyWithMockTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyWithMockTests.java index 32ae6b6789fb..7b83056e4982 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyWithMockTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyWithMockTests.java @@ -3,6 +3,7 @@ package com.azure.core.implementation; +import com.azure.core.http.clients.NoOpHttpClient; import com.azure.core.implementation.annotation.BodyParam; import com.azure.core.implementation.annotation.ExpectedResponses; import com.azure.core.implementation.annotation.Get; @@ -18,9 +19,8 @@ import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; -import com.azure.core.http.MockHttpClient; +import com.azure.core.http.clients.MockHttpClient; import com.azure.core.http.MockHttpResponse; -import com.azure.core.http.ProxyOptions; import com.azure.core.http.rest.Page; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.Response; @@ -40,7 +40,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.function.Supplier; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -328,7 +327,7 @@ interface ServiceHeaderCollections { ResponseBase packagePrivateFields(); } - private static final HttpClient HEADER_COLLECTION_HTTP_CLIENT = new MockHttpClient() { + private static final HttpClient HEADER_COLLECTION_HTTP_CLIENT = new NoOpHttpClient() { @Override public Mono send(HttpRequest request) { final HttpHeaders headers = new HttpHeaders().put("name", "Phillip") @@ -336,7 +335,7 @@ public Mono send(HttpRequest request) { .put("header-collection-prefix-two", "2") .put("header-collection-prefix-three", "3"); final MockHttpResponse response = new MockHttpResponse(request, 200, headers); - return Mono.just(response); + return Mono.just(response); } }; @@ -345,12 +344,12 @@ private ServiceHeaderCollections createHeaderCollectionsService() { } private static void assertHeaderCollectionsRawHeaders(Response response) { - final HttpHeaders responseRawHeaders = response.headers(); + final HttpHeaders responseRawHeaders = response.getHeaders(); assertEquals("Phillip", responseRawHeaders.value("name")); assertEquals("1", responseRawHeaders.value("header-collection-prefix-one")); assertEquals("2", responseRawHeaders.value("header-collection-prefix-two")); assertEquals("3", responseRawHeaders.value("header-collection-prefix-three")); - assertEquals(4, responseRawHeaders.size()); + assertEquals(4, responseRawHeaders.getSize()); } private static void assertHeaderCollections(Map headerCollections) { @@ -372,7 +371,7 @@ public void serviceHeaderCollectionPublicFields() { assertNotNull(response); assertHeaderCollectionsRawHeaders(response); - final HeaderCollectionTypePublicFields responseHeaders = response.deserializedHeaders(); + final HeaderCollectionTypePublicFields responseHeaders = response.getDeserializedHeaders(); assertNotNull(responseHeaders); assertEquals("Phillip", responseHeaders.name()); assertHeaderCollections(responseHeaders.headerCollection()); @@ -385,7 +384,7 @@ public void serviceHeaderCollectionProtectedFields() { assertNotNull(response); assertHeaderCollectionsRawHeaders(response); - final HeaderCollectionTypeProtectedFields responseHeaders = response.deserializedHeaders(); + final HeaderCollectionTypeProtectedFields responseHeaders = response.getDeserializedHeaders(); assertNotNull(responseHeaders); assertEquals("Phillip", responseHeaders.name); assertHeaderCollections(responseHeaders.headerCollection); @@ -398,7 +397,7 @@ public void serviceHeaderCollectionPrivateFields() { assertNotNull(response); assertHeaderCollectionsRawHeaders(response); - final HeaderCollectionTypePrivateFields responseHeaders = response.deserializedHeaders(); + final HeaderCollectionTypePrivateFields responseHeaders = response.getDeserializedHeaders(); assertNotNull(responseHeaders); assertEquals("Phillip", responseHeaders.name); assertHeaderCollections(responseHeaders.headerCollection); @@ -411,7 +410,7 @@ public void serviceHeaderCollectionPackagePrivateFields() { assertNotNull(response); assertHeaderCollectionsRawHeaders(response); - final HeaderCollectionTypePackagePrivateFields responseHeaders = response.deserializedHeaders(); + final HeaderCollectionTypePackagePrivateFields responseHeaders = response.getDeserializedHeaders(); assertNotNull(responseHeaders); assertEquals("Phillip", responseHeaders.name); assertHeaderCollections(responseHeaders.headerCollection); @@ -425,21 +424,6 @@ private abstract static class SimpleMockHttpClient implements HttpClient { @Override public abstract Mono send(HttpRequest request); - - @Override - public HttpClient proxy(Supplier proxyOptions) { - throw new IllegalStateException("MockHttpClient.proxy not implemented."); - } - - @Override - public HttpClient wiretap(boolean enableWiretap) { - throw new IllegalStateException("MockHttpClient.wiretap not implemented."); - } - - @Override - public HttpClient port(int port) { - throw new IllegalStateException("MockHttpClient.port not implemented."); - } } @@ -481,12 +465,12 @@ static class KeyValuePage implements Page { } @Override - public List items() { + public List getItems() { return items; } @Override - public String nextLink() { + public String getNextLink() { return nextLink; } } @@ -501,12 +485,12 @@ static class ConformingPage implements Page { } @Override - public List items() { + public List getItems() { return items; } @Override - public String nextLink() { + public String getNextLink() { return nextLink; } } @@ -570,7 +554,7 @@ public void service2getPage() { PagedResponse response = createService(Service2.class).getPage(page); assertNotNull(response); - assertEquals(array.size(), response.value().size()); + assertEquals(array.size(), response.getValue().size()); } /** @@ -591,10 +575,10 @@ public void service2getPageAsync() { StepVerifier.create(createService(Service2.class).getPageAsync(page)) .assertNext(r -> { - assertEquals(page.nextLink, r.nextLink()); + assertEquals(page.nextLink, r.getNextLink()); - assertEquals(r.items().size(), 3); - for (KeyValue keyValue : r.value()) { + assertEquals(r.getItems().size(), 3); + for (KeyValue keyValue : r.getValue()) { assertTrue(array.removeIf(kv -> kv.key == keyValue.key && kv.value().equals(keyValue.value()))); } assertTrue(array.isEmpty()); @@ -622,8 +606,8 @@ public void service2getPageSerializes() { StepVerifier.create(createService(Service2.class).getPageAsyncSerializes(page)) .assertNext(response -> { - assertEquals(page.nextLink(), response.nextLink()); - assertNull(response.items()); + assertEquals(page.nextLink(), response.getNextLink()); + assertNull(response.getItems()); }) .verifyComplete(); } 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 b533a6ff9103..eb3bc07c86f9 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 @@ -20,7 +20,6 @@ import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; import com.azure.core.http.MockHttpResponse; -import com.azure.core.http.ProxyOptions; import com.azure.core.implementation.serializer.SerializerEncoding; import com.azure.core.implementation.serializer.jackson.JacksonAdapter; import com.azure.core.implementation.util.FluxUtil; @@ -36,7 +35,6 @@ import java.time.OffsetDateTime; import java.util.Collections; import java.util.List; -import java.util.function.Supplier; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; @@ -56,9 +54,9 @@ private HttpResponse response(HttpRequest request, String resource) throws IOExc @Override public Mono send(HttpRequest request) { try { - if (request.url().toString().endsWith("GetContainerACLs")) { + if (request.getUrl().toString().endsWith("GetContainerACLs")) { return Mono.just(response(request, "GetContainerACLs.xml")); - } else if (request.url().toString().endsWith("GetXMLWithAttributes")) { + } else if (request.getUrl().toString().endsWith("GetXMLWithAttributes")) { return Mono.just(response(request, "GetXMLWithAttributes.xml")); } else { return Mono.just(new MockHttpResponse(request, 404)); @@ -67,21 +65,6 @@ public Mono send(HttpRequest request) { return Mono.error(e); } } - - @Override - public HttpClient proxy(Supplier proxyOptions) { - throw new IllegalStateException("MockHttpClient.proxy"); - } - - @Override - public HttpClient wiretap(boolean enableWiretap) { - throw new IllegalStateException("MockHttpClient.wiretap"); - } - - @Override - public HttpClient port(int port) { - throw new IllegalStateException("MockHttpClient.port"); - } } @Host("http://unused") @@ -115,8 +98,8 @@ static class MockXMLReceiverClient implements HttpClient { @Override public Mono send(HttpRequest request) { - if (request.url().toString().endsWith("SetContainerACLs")) { - return FluxUtil.collectBytesInByteBufStream(request.body(), false) + if (request.getUrl().toString().endsWith("SetContainerACLs")) { + return FluxUtil.collectBytesInByteBufferStream(request.getBody()) .map(bytes -> { receivedBytes = bytes; return new MockHttpResponse(request, 200); @@ -125,21 +108,6 @@ public Mono send(HttpRequest request) { return Mono.just(new MockHttpResponse(request, 404)); } } - - @Override - public HttpClient proxy(Supplier proxyOptions) { - throw new IllegalStateException("MockHttpClient.proxy"); - } - - @Override - public HttpClient wiretap(boolean enableWiretap) { - throw new IllegalStateException("MockHttpClient.wiretap"); - } - - @Override - public HttpClient port(int port) { - throw new IllegalStateException("MockHttpClient.port"); - } } @Test @@ -147,7 +115,7 @@ 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")); - request.body(bytes); + request.setBody(bytes); SignedIdentifierInner si = new SignedIdentifierInner(); si.withId("MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="); diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/SubstitutionTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/SubstitutionTests.java index 8fb692f85cea..f77b60292586 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/SubstitutionTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/SubstitutionTests.java @@ -11,8 +11,8 @@ public class SubstitutionTests { @Test public void constructor() { final Substitution s = new Substitution("A", 2, true); - assertEquals("A", s.urlParameterName()); - assertEquals(2, s.methodParameterIndex()); + assertEquals("A", s.getUrlParameterName()); + assertEquals(2, s.getMethodParameterIndex()); assertEquals(true, s.shouldEncode()); } } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/SwaggerInterfaceParserTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/SwaggerInterfaceParserTests.java index a37791f863f5..3b4d1719f64e 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/SwaggerInterfaceParserTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/SwaggerInterfaceParserTests.java @@ -44,8 +44,8 @@ public void hostWithNoServiceNameAnnotation() { @Test public void hostWithHostAnnotation() { final SwaggerInterfaceParser interfaceParser = new SwaggerInterfaceParser(TestInterface3.class, null); - assertEquals("https://management.azure.com", interfaceParser.host()); - assertEquals("myService", interfaceParser.serviceName()); + assertEquals("https://management.azure.com", interfaceParser.getHost()); + assertEquals("myService", interfaceParser.getServiceName()); } @Host("https://azure.com") @@ -62,11 +62,11 @@ public void methodParser() { final Method testMethod3 = TestInterface4.class.getDeclaredMethods()[0]; assertEquals("testMethod4", testMethod3.getName()); - final SwaggerMethodParser methodParser = interfaceParser.methodParser(testMethod3); + final SwaggerMethodParser methodParser = interfaceParser.getMethodParser(testMethod3); assertNotNull(methodParser); - assertEquals("com.azure.core.implementation.SwaggerInterfaceParserTests$TestInterface4.testMethod4", methodParser.fullyQualifiedMethodName()); + assertEquals("com.azure.core.implementation.SwaggerInterfaceParserTests$TestInterface4.testMethod4", methodParser.getFullyQualifiedMethodName()); - final SwaggerMethodParser methodDetails2 = interfaceParser.methodParser(testMethod3); + final SwaggerMethodParser methodDetails2 = interfaceParser.getMethodParser(testMethod3); assertSame(methodParser, methodDetails2); } } 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 808b8bc3841d..93df7cbd8364 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 @@ -46,14 +46,14 @@ public void withOnlyExpectedResponse() throws IOException { assertEquals("testMethod2", testMethod2.getName()); final SwaggerMethodParser methodParser = new SwaggerMethodParser(testMethod2, "https://raw.host.com"); - assertEquals("com.azure.core.implementation.SwaggerMethodParserTests$TestInterface2.testMethod2", methodParser.fullyQualifiedMethodName()); - assertEquals(HttpMethod.PATCH, methodParser.httpMethod()); - assertArrayEquals(new int[] { 200 }, methodParser.expectedStatusCodes()); - assertEquals(HttpResponseException.class, methodParser.getUnexpectedException(-1).exceptionType()); - assertEquals(Object.class, methodParser.getUnexpectedException(-1).exceptionBodyType()); - assertEquals(false, methodParser.headers(null).iterator().hasNext()); - assertEquals("https", methodParser.scheme(null)); - assertEquals("raw.host.com", methodParser.host(null)); + assertEquals("com.azure.core.implementation.SwaggerMethodParserTests$TestInterface2.testMethod2", methodParser.getFullyQualifiedMethodName()); + assertEquals(HttpMethod.PATCH, methodParser.getHttpMethod()); + assertArrayEquals(new int[] { 200 }, methodParser.getExpectedStatusCodes()); + assertEquals(HttpResponseException.class, methodParser.getUnexpectedException(-1).getExceptionType()); + assertEquals(Object.class, methodParser.getUnexpectedException(-1).getExceptionBodyType()); + assertEquals(false, methodParser.setHeaders(null).iterator().hasNext()); + assertEquals("https", methodParser.setScheme(null)); + assertEquals("raw.host.com", methodParser.setHost(null)); } interface TestInterface3 { @@ -69,14 +69,14 @@ public void withExpectedResponseAndUnexpectedResponseExceptionType() throws IOEx assertEquals("testMethod3", testMethod3.getName()); final SwaggerMethodParser methodParser = new SwaggerMethodParser(testMethod3, "https://raw.host.com"); - assertEquals("com.azure.core.implementation.SwaggerMethodParserTests$TestInterface3.testMethod3", methodParser.fullyQualifiedMethodName()); - assertEquals(HttpMethod.PATCH, methodParser.httpMethod()); - assertArrayEquals(new int[] { 200 }, methodParser.expectedStatusCodes()); - assertEquals(MyRestException.class, methodParser.getUnexpectedException(-1).exceptionType()); - assertEquals(HttpBinJSON.class, methodParser.getUnexpectedException(-1).exceptionBodyType()); - assertEquals(false, methodParser.headers(null).iterator().hasNext()); - assertEquals("https", methodParser.scheme(null)); - assertEquals("raw.host.com", methodParser.host(null)); + assertEquals("com.azure.core.implementation.SwaggerMethodParserTests$TestInterface3.testMethod3", methodParser.getFullyQualifiedMethodName()); + 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(false, methodParser.setHeaders(null).iterator().hasNext()); + assertEquals("https", methodParser.setScheme(null)); + assertEquals("raw.host.com", methodParser.setHost(null)); } interface TestInterface4 { @@ -93,16 +93,16 @@ public void withExpectedResponseAndMappedUnexpectedResponseExceptionTypeWithFall assertEquals("testMethod4", testMethod4.getName()); final SwaggerMethodParser methodParser = new SwaggerMethodParser(testMethod4, "https://raw.host.com"); - assertEquals("com.azure.core.implementation.SwaggerMethodParserTests$TestInterface4.testMethod4", methodParser.fullyQualifiedMethodName()); - assertEquals(HttpMethod.PATCH, methodParser.httpMethod()); - assertArrayEquals(new int[] { 200 }, methodParser.expectedStatusCodes()); - assertEquals(HttpResponseException.class, methodParser.getUnexpectedException(400).exceptionType()); - assertEquals(Object.class, methodParser.getUnexpectedException(400).exceptionBodyType()); - assertEquals(MyRestException.class, methodParser.getUnexpectedException(-1).exceptionType()); - assertEquals(HttpBinJSON.class, methodParser.getUnexpectedException(-1).exceptionBodyType()); - assertEquals(false, methodParser.headers(null).iterator().hasNext()); - assertEquals("https", methodParser.scheme(null)); - assertEquals("raw.host.com", methodParser.host(null)); + assertEquals("com.azure.core.implementation.SwaggerMethodParserTests$TestInterface4.testMethod4", methodParser.getFullyQualifiedMethodName()); + assertEquals(HttpMethod.PATCH, methodParser.getHttpMethod()); + assertArrayEquals(new int[] { 200 }, methodParser.getExpectedStatusCodes()); + 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(false, methodParser.setHeaders(null).iterator().hasNext()); + assertEquals("https", methodParser.setScheme(null)); + assertEquals("raw.host.com", methodParser.setHost(null)); } interface TestInterface5 { @@ -118,16 +118,16 @@ public void withExpectedResponseAndMappedUnexpectedResponseExceptionTypeWithoutF assertEquals("testMethod5", testMethod5.getName()); final SwaggerMethodParser methodParser = new SwaggerMethodParser(testMethod5, "https://raw.host.com"); - assertEquals("com.azure.core.implementation.SwaggerMethodParserTests$TestInterface5.testMethod5", methodParser.fullyQualifiedMethodName()); - assertEquals(HttpMethod.PATCH, methodParser.httpMethod()); - assertArrayEquals(new int[] { 200 }, methodParser.expectedStatusCodes()); - assertEquals(MyRestException.class, methodParser.getUnexpectedException(400).exceptionType()); - assertEquals(HttpBinJSON.class, methodParser.getUnexpectedException(400).exceptionBodyType()); - assertEquals(HttpResponseException.class, methodParser.getUnexpectedException(-1).exceptionType()); - assertEquals(Object.class, methodParser.getUnexpectedException(-1).exceptionBodyType()); - assertEquals(false, methodParser.headers(null).iterator().hasNext()); - assertEquals("https", methodParser.scheme(null)); - assertEquals("raw.host.com", methodParser.host(null)); + assertEquals("com.azure.core.implementation.SwaggerMethodParserTests$TestInterface5.testMethod5", methodParser.getFullyQualifiedMethodName()); + 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(HttpResponseException.class, methodParser.getUnexpectedException(-1).getExceptionType()); + assertEquals(Object.class, methodParser.getUnexpectedException(-1).getExceptionBodyType()); + assertEquals(false, methodParser.setHeaders(null).iterator().hasNext()); + assertEquals("https", methodParser.setScheme(null)); + assertEquals("raw.host.com", methodParser.setHost(null)); } interface TestInterface6 { @@ -145,22 +145,22 @@ public void withExpectedResponseAndMultipleMappedUnexpectedResponseExceptionType assertEquals("testMethod6", testMethod6.getName()); final SwaggerMethodParser methodParser = new SwaggerMethodParser(testMethod6, "https://raw.host.com"); - assertEquals("com.azure.core.implementation.SwaggerMethodParserTests$TestInterface6.testMethod6", methodParser.fullyQualifiedMethodName()); - assertEquals(HttpMethod.PATCH, methodParser.httpMethod()); - assertArrayEquals(new int[] { 200 }, methodParser.expectedStatusCodes()); - assertEquals(MyRestException.class, methodParser.getUnexpectedException(400).exceptionType()); - assertEquals(HttpBinJSON.class, methodParser.getUnexpectedException(400).exceptionBodyType()); - assertEquals(MyRestException.class, methodParser.getUnexpectedException(401).exceptionType()); - assertEquals(HttpBinJSON.class, methodParser.getUnexpectedException(401).exceptionBodyType()); - assertEquals(HttpResponseException.class, methodParser.getUnexpectedException(404).exceptionType()); - assertEquals(Object.class, methodParser.getUnexpectedException(404).exceptionBodyType()); - assertEquals(HttpResponseException.class, methodParser.getUnexpectedException(409).exceptionType()); - assertEquals(Object.class, methodParser.getUnexpectedException(409).exceptionBodyType()); - assertEquals(MyOtherRestException.class, methodParser.getUnexpectedException(-1).exceptionType()); - assertEquals(HttpBinJSON.class, methodParser.getUnexpectedException(-1).exceptionBodyType()); - assertEquals(false, methodParser.headers(null).iterator().hasNext()); - assertEquals("https", methodParser.scheme(null)); - assertEquals("raw.host.com", methodParser.host(null)); + assertEquals("com.azure.core.implementation.SwaggerMethodParserTests$TestInterface6.testMethod6", methodParser.getFullyQualifiedMethodName()); + 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(MyRestException.class, methodParser.getUnexpectedException(401).getExceptionType()); + 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(false, methodParser.setHeaders(null).iterator().hasNext()); + assertEquals("https", methodParser.setScheme(null)); + assertEquals("raw.host.com", methodParser.setHost(null)); } interface TestInterface7 { @@ -176,12 +176,12 @@ public void withInvalidUnexpectedResponseAnnotationsExceptionByDefaultAnnotation assertEquals("testMethod7", testMethod7.getName()); final SwaggerMethodParser methodParser = new SwaggerMethodParser(testMethod7, "https://raw.host.com"); - assertEquals("com.azure.core.implementation.SwaggerMethodParserTests$TestInterface7.testMethod7", methodParser.fullyQualifiedMethodName()); - assertEquals(HttpResponseException.class, methodParser.getUnexpectedException(-1).exceptionType()); - assertEquals(Object.class, methodParser.getUnexpectedException(-1).exceptionBodyType()); - assertEquals(false, methodParser.headers(null).iterator().hasNext()); - assertEquals("https", methodParser.scheme(null)); - assertEquals("raw.host.com", methodParser.host(null)); + assertEquals("com.azure.core.implementation.SwaggerMethodParserTests$TestInterface7.testMethod7", methodParser.getFullyQualifiedMethodName()); + assertEquals(HttpResponseException.class, methodParser.getUnexpectedException(-1).getExceptionType()); + assertEquals(Object.class, methodParser.getUnexpectedException(-1).getExceptionBodyType()); + assertEquals(false, methodParser.setHeaders(null).iterator().hasNext()); + assertEquals("https", methodParser.setScheme(null)); + assertEquals("raw.host.com", methodParser.setHost(null)); } interface TestInterface8 { @@ -197,13 +197,13 @@ public void withInvalidUnexpectedResponseAnnotationsExceptionByRepeatCodes() { assertEquals("testMethod8", testMethod8.getName()); final SwaggerMethodParser methodParser = new SwaggerMethodParser(testMethod8, "https://raw.host.com"); - assertEquals("com.azure.core.implementation.SwaggerMethodParserTests$TestInterface8.testMethod8", methodParser.fullyQualifiedMethodName()); - assertEquals(HttpResponseException.class, methodParser.getUnexpectedException(404).exceptionType()); - assertEquals(Object.class, methodParser.getUnexpectedException(404).exceptionBodyType()); - assertEquals(HttpResponseException.class, methodParser.getUnexpectedException(-1).exceptionType()); - assertEquals(Object.class, methodParser.getUnexpectedException(-1).exceptionBodyType()); - assertEquals(false, methodParser.headers(null).iterator().hasNext()); - assertEquals("https", methodParser.scheme(null)); - assertEquals("raw.host.com", methodParser.host(null)); + assertEquals("com.azure.core.implementation.SwaggerMethodParserTests$TestInterface8.testMethod8", methodParser.getFullyQualifiedMethodName()); + assertEquals(HttpResponseException.class, methodParser.getUnexpectedException(404).getExceptionType()); + assertEquals(Object.class, methodParser.getUnexpectedException(404).getExceptionBodyType()); + assertEquals(HttpResponseException.class, methodParser.getUnexpectedException(-1).getExceptionType()); + assertEquals(Object.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 13b950c80c2a..ec8b91cd0aea 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 @@ -17,167 +17,167 @@ public class UrlBuilderTests { @Test public void scheme() { final UrlBuilder builder = new UrlBuilder() - .scheme("http"); + .setScheme("http"); assertEquals("http://", builder.toString()); } @Test public void schemeWhenSchemeIsNull() { final UrlBuilder builder = new UrlBuilder() - .scheme("http"); - builder.scheme(null); - assertNull(builder.scheme()); + .setScheme("http"); + builder.setScheme(null); + assertNull(builder.getScheme()); } @Test public void schemeWhenSchemeIsEmpty() { final UrlBuilder builder = new UrlBuilder() - .scheme("http"); - builder.scheme(""); - assertNull(builder.scheme()); + .setScheme("http"); + builder.setScheme(""); + assertNull(builder.getScheme()); } @Test public void schemeWhenSchemeIsNotEmpty() { final UrlBuilder builder = new UrlBuilder() - .scheme("http"); - builder.scheme("https"); - assertEquals("https", builder.scheme()); + .setScheme("http"); + builder.setScheme("https"); + assertEquals("https", builder.getScheme()); } @Test public void schemeWhenSchemeContainsTerminator() { final UrlBuilder builder = new UrlBuilder() - .scheme("http://"); - assertEquals("http", builder.scheme()); - assertNull(builder.host()); + .setScheme("http://"); + assertEquals("http", builder.getScheme()); + assertNull(builder.getHost()); assertEquals("http://", builder.toString()); } @Test public void schemeWhenSchemeContainsHost() { final UrlBuilder builder = new UrlBuilder() - .scheme("http://www.example.com"); - assertEquals("http", builder.scheme()); - assertEquals("www.example.com", builder.host()); + .setScheme("http://www.example.com"); + assertEquals("http", builder.getScheme()); + assertEquals("www.example.com", builder.getHost()); assertEquals("http://www.example.com", builder.toString()); } @Test public void schemeAndHost() { final UrlBuilder builder = new UrlBuilder() - .scheme("http") - .host("www.example.com"); + .setScheme("http") + .setHost("www.example.com"); assertEquals("http://www.example.com", builder.toString()); } @Test public void schemeAndHostWhenHostHasWhitespace() { final UrlBuilder builder = new UrlBuilder() - .scheme("http") - .host("www.exa mple.com"); + .setScheme("http") + .setHost("www.exa mple.com"); assertEquals("http://www.exa mple.com", builder.toString()); } @Test public void host() { final UrlBuilder builder = new UrlBuilder() - .host("www.example.com"); + .setHost("www.example.com"); assertEquals("www.example.com", builder.toString()); } @Test public void hostWhenHostIsNull() { final UrlBuilder builder = new UrlBuilder() - .host("www.example.com"); - builder.host(null); - assertNull(builder.host()); + .setHost("www.example.com"); + builder.setHost(null); + assertNull(builder.getHost()); } @Test public void hostWhenHostIsEmpty() { final UrlBuilder builder = new UrlBuilder() - .host("www.example.com"); - builder.host(""); - assertNull(builder.host()); + .setHost("www.example.com"); + builder.setHost(""); + assertNull(builder.getHost()); } @Test public void hostWhenHostIsNotEmpty() { final UrlBuilder builder = new UrlBuilder() - .host("www.example.com"); - builder.host("www.bing.com"); - assertEquals("www.bing.com", builder.host()); + .setHost("www.example.com"); + builder.setHost("www.bing.com"); + assertEquals("www.bing.com", builder.getHost()); } @Test public void hostWhenHostContainsSchemeTerminator() { final UrlBuilder builder = new UrlBuilder() - .host("://www.example.com"); - assertNull(builder.scheme()); - assertEquals("www.example.com", builder.host()); + .setHost("://www.example.com"); + assertNull(builder.getScheme()); + assertEquals("www.example.com", builder.getHost()); assertEquals("www.example.com", builder.toString()); } @Test public void hostWhenHostContainsScheme() { final UrlBuilder builder = new UrlBuilder() - .host("https://www.example.com"); - assertEquals("https", builder.scheme()); - assertEquals("www.example.com", builder.host()); + .setHost("https://www.example.com"); + assertEquals("https", builder.getScheme()); + assertEquals("www.example.com", builder.getHost()); assertEquals("https://www.example.com", builder.toString()); } @Test public void hostWhenHostContainsColonButNoPort() { final UrlBuilder builder = new UrlBuilder() - .host("www.example.com:"); - assertEquals("www.example.com", builder.host()); - assertNull(builder.port()); + .setHost("www.example.com:"); + assertEquals("www.example.com", builder.getHost()); + assertNull(builder.getPort()); assertEquals("www.example.com", builder.toString()); } @Test public void hostWhenHostContainsPort() { final UrlBuilder builder = new UrlBuilder() - .host("www.example.com:1234"); - assertEquals("www.example.com", builder.host()); - assertEquals(1234, builder.port().intValue()); + .setHost("www.example.com:1234"); + assertEquals("www.example.com", builder.getHost()); + assertEquals(1234, builder.getPort().intValue()); assertEquals("www.example.com:1234", builder.toString()); } @Test public void hostWhenHostContainsForwardSlashButNoPath() { final UrlBuilder builder = new UrlBuilder() - .host("www.example.com/"); - assertEquals("www.example.com", builder.host()); - assertEquals("/", builder.path()); + .setHost("www.example.com/"); + assertEquals("www.example.com", builder.getHost()); + assertEquals("/", builder.getPath()); assertEquals("www.example.com/", builder.toString()); } @Test public void hostWhenHostContainsPath() { final UrlBuilder builder = new UrlBuilder() - .host("www.example.com/index.html"); - assertEquals("www.example.com", builder.host()); - assertEquals("/index.html", builder.path()); + .setHost("www.example.com/index.html"); + assertEquals("www.example.com", builder.getHost()); + assertEquals("/index.html", builder.getPath()); assertEquals("www.example.com/index.html", builder.toString()); } @Test public void hostWhenHostContainsQuestionMarkButNoQuery() { final UrlBuilder builder = new UrlBuilder() - .host("www.example.com?"); - assertEquals("www.example.com", builder.host()); - assertEquals(0, builder.query().size()); + .setHost("www.example.com?"); + assertEquals("www.example.com", builder.getHost()); + assertEquals(0, builder.getQuery().size()); assertEquals("www.example.com", builder.toString()); } @Test public void hostWhenHostContainsQuery() { final UrlBuilder builder = new UrlBuilder() - .host("www.example.com?a=b"); - assertEquals("www.example.com", builder.host()); + .setHost("www.example.com?a=b"); + assertEquals("www.example.com", builder.getHost()); assertThat(builder.toString(), CoreMatchers.containsString("a=b")); assertEquals("www.example.com?a=b", builder.toString()); } @@ -185,130 +185,130 @@ public void hostWhenHostContainsQuery() { @Test public void hostWhenHostHasWhitespace() { final UrlBuilder builder = new UrlBuilder() - .host("www.exampl e.com"); + .setHost("www.exampl e.com"); assertEquals("www.exampl e.com", builder.toString()); } @Test public void hostAndPath() { final UrlBuilder builder = new UrlBuilder() - .host("www.example.com") - .path("my/path"); + .setHost("www.example.com") + .setPath("my/path"); assertEquals("www.example.com/my/path", builder.toString()); } @Test public void hostAndPathWithSlashAfterHost() { final UrlBuilder builder = new UrlBuilder() - .host("www.example.com/") - .path("my/path"); + .setHost("www.example.com/") + .setPath("my/path"); assertEquals("www.example.com/my/path", builder.toString()); } @Test public void hostAndPathWithSlashBeforePath() { final UrlBuilder builder = new UrlBuilder() - .host("www.example.com") - .path("/my/path"); + .setHost("www.example.com") + .setPath("/my/path"); assertEquals("www.example.com/my/path", builder.toString()); } @Test public void hostAndPathWithSlashAfterHostAndBeforePath() { final UrlBuilder builder = new UrlBuilder() - .host("www.example.com/") - .path("/my/path"); + .setHost("www.example.com/") + .setPath("/my/path"); assertEquals("www.example.com/my/path", builder.toString()); } @Test public void hostAndPathWithWhitespaceInPath() { final UrlBuilder builder = new UrlBuilder() - .host("www.example.com") - .path("my path"); + .setHost("www.example.com") + .setPath("my path"); assertEquals("www.example.com/my path", builder.toString()); } @Test public void hostAndPathWithPlusInPath() { final UrlBuilder builder = new UrlBuilder() - .host("www.example.com") - .path("my+path"); + .setHost("www.example.com") + .setPath("my+path"); assertEquals("www.example.com/my+path", builder.toString()); } @Test public void hostAndPathWithPercent20InPath() { final UrlBuilder builder = new UrlBuilder() - .host("www.example.com") - .path("my%20path"); + .setHost("www.example.com") + .setPath("my%20path"); assertEquals("www.example.com/my%20path", builder.toString()); } @Test public void portInt() { final UrlBuilder builder = new UrlBuilder() - .port(50); - assertEquals(50, builder.port().intValue()); + .setPort(50); + assertEquals(50, builder.getPort().intValue()); assertEquals(":50", builder.toString()); } @Test public void portStringWithNull() { final UrlBuilder builder = new UrlBuilder() - .port(null); - assertNull(builder.port()); + .setPort(null); + assertNull(builder.getPort()); assertEquals("", builder.toString()); } @Test public void portStringWithEmpty() { final UrlBuilder builder = new UrlBuilder() - .port(""); - assertNull(builder.port()); + .setPort(""); + assertNull(builder.getPort()); assertEquals("", builder.toString()); } @Test public void portString() { final UrlBuilder builder = new UrlBuilder() - .port("50"); - assertEquals(50, builder.port().intValue()); + .setPort("50"); + assertEquals(50, builder.getPort().intValue()); assertEquals(":50", builder.toString()); } @Test public void portStringWithForwardSlashButNoPath() { final UrlBuilder builder = new UrlBuilder() - .port("50/"); - assertEquals(50, builder.port().intValue()); - assertEquals("/", builder.path()); + .setPort("50/"); + assertEquals(50, builder.getPort().intValue()); + assertEquals("/", builder.getPath()); assertEquals(":50/", builder.toString()); } @Test public void portStringpath() { final UrlBuilder builder = new UrlBuilder() - .port("50/index.html"); - assertEquals(50, builder.port().intValue()); - assertEquals("/index.html", builder.path()); + .setPort("50/index.html"); + assertEquals(50, builder.getPort().intValue()); + assertEquals("/index.html", builder.getPath()); assertEquals(":50/index.html", builder.toString()); } @Test public void portStringWithQuestionMarkButNoQuery() { final UrlBuilder builder = new UrlBuilder() - .port("50?"); - assertEquals(50, builder.port().intValue()); - assertEquals(0, builder.query().size()); + .setPort("50?"); + assertEquals(50, builder.getPort().intValue()); + assertEquals(0, builder.getQuery().size()); assertEquals(":50", builder.toString()); } @Test public void portStringquery() { final UrlBuilder builder = new UrlBuilder() - .port("50?a=b&c=d"); - assertEquals(50, builder.port().intValue()); + .setPort("50?a=b&c=d"); + assertEquals(50, builder.getPort().intValue()); assertThat(builder.toString(), CoreMatchers.containsString("?a=b&c=d")); assertEquals(":50?a=b&c=d", builder.toString()); } @@ -316,32 +316,32 @@ public void portStringquery() { @Test public void portStringWhenPortIsNull() { final UrlBuilder builder = new UrlBuilder() - .port(8080); - builder.port(null); - assertNull(builder.port()); + .setPort(8080); + builder.setPort(null); + assertNull(builder.getPort()); } @Test public void portStringWhenPortIsEmpty() { final UrlBuilder builder = new UrlBuilder() - .port(8080); - builder.port(""); - assertNull(builder.port()); + .setPort(8080); + builder.setPort(""); + assertNull(builder.getPort()); } @Test public void portStringWhenPortIsNotEmpty() { final UrlBuilder builder = new UrlBuilder() - .port(8080); - builder.port("123"); - assertEquals(123, builder.port().intValue()); + .setPort(8080); + builder.setPort("123"); + assertEquals(123, builder.getPort().intValue()); } @Test public void schemeAndHostAndOneQueryParameter() { final UrlBuilder builder = new UrlBuilder() - .scheme("http") - .host("www.example.com") + .setScheme("http") + .setHost("www.example.com") .setQueryParameter("A", "B"); assertEquals("http://www.example.com?A=B", builder.toString()); } @@ -349,8 +349,8 @@ public void schemeAndHostAndOneQueryParameter() { @Test public void schemeAndHostAndOneQueryParameterWhenQueryParameterNameHasWhitespace() { final UrlBuilder builder = new UrlBuilder() - .scheme("http") - .host("www.example.com") + .setScheme("http") + .setHost("www.example.com") .setQueryParameter("App les", "B"); assertEquals("http://www.example.com?App les=B", builder.toString()); } @@ -358,8 +358,8 @@ public void schemeAndHostAndOneQueryParameterWhenQueryParameterNameHasWhitespace @Test public void schemeAndHostAndOneQueryParameterWhenQueryParameterNameHasPercent20() { final UrlBuilder builder = new UrlBuilder() - .scheme("http") - .host("www.example.com") + .setScheme("http") + .setHost("www.example.com") .setQueryParameter("App%20les", "B"); assertEquals("http://www.example.com?App%20les=B", builder.toString()); } @@ -367,8 +367,8 @@ public void schemeAndHostAndOneQueryParameterWhenQueryParameterNameHasPercent20( @Test public void schemeAndHostAndOneQueryParameterWhenQueryParameterValueHasWhitespace() { final UrlBuilder builder = new UrlBuilder() - .scheme("http") - .host("www.example.com") + .setScheme("http") + .setHost("www.example.com") .setQueryParameter("Apples", "Go od"); assertEquals("http://www.example.com?Apples=Go od", builder.toString()); } @@ -376,8 +376,8 @@ public void schemeAndHostAndOneQueryParameterWhenQueryParameterValueHasWhitespac @Test public void schemeAndHostAndOneQueryParameterWhenQueryParameterValueHasPercent20() { final UrlBuilder builder = new UrlBuilder() - .scheme("http") - .host("www.example.com") + .setScheme("http") + .setHost("www.example.com") .setQueryParameter("Apples", "Go%20od"); assertEquals("http://www.example.com?Apples=Go%20od", builder.toString()); } @@ -385,8 +385,8 @@ public void schemeAndHostAndOneQueryParameterWhenQueryParameterValueHasPercent20 @Test public void schemeAndHostAndTwoQueryParameters() { final UrlBuilder builder = new UrlBuilder() - .scheme("http") - .host("www.example.com") + .setScheme("http") + .setHost("www.example.com") .setQueryParameter("A", "B") .setQueryParameter("C", "D"); assertEquals("http://www.example.com?A=B&C=D", builder.toString()); @@ -395,89 +395,129 @@ public void schemeAndHostAndTwoQueryParameters() { @Test public void schemeAndHostAndPathAndTwoQueryParameters() { final UrlBuilder builder = new UrlBuilder() - .scheme("http") - .host("www.example.com") + .setScheme("http") + .setHost("www.example.com") .setQueryParameter("A", "B") .setQueryParameter("C", "D") - .path("index.html"); + .setPath("index.html"); assertEquals("http://www.example.com/index.html?A=B&C=D", builder.toString()); } @Test public void pathWhenBuilderPathIsNullAndPathIsNull() { final UrlBuilder builder = new UrlBuilder(); - builder.path(null); - assertNull(builder.path()); + builder.setPath(null); + assertNull(builder.getPath()); } @Test public void pathWhenBuilderPathIsNullAndPathIsEmptyString() { final UrlBuilder builder = new UrlBuilder(); - builder.path(""); - assertNull(builder.path()); + builder.setPath(""); + assertNull(builder.getPath()); } @Test public void pathWhenBuilderPathIsNullAndPathIsForwardSlash() { final UrlBuilder builder = new UrlBuilder(); - builder.path("/"); - assertEquals("/", builder.path()); + builder.setPath("/"); + assertEquals("/", builder.getPath()); } @Test public void pathWhenBuilderPathIsNullAndPath() { final UrlBuilder builder = new UrlBuilder(); - builder.path("test/path.html"); - assertEquals("test/path.html", builder.path()); + builder.setPath("test/path.html"); + assertEquals("test/path.html", builder.getPath()); } @Test public void pathWhenBuilderPathIsForwardSlashAndPathIsNull() { final UrlBuilder builder = new UrlBuilder() - .path("/"); - builder.path(null); - assertNull(builder.path()); + .setPath("/"); + builder.setPath(null); + assertNull(builder.getPath()); } @Test public void pathWhenBuilderPathIsForwardSlashAndPathIsEmptyString() { final UrlBuilder builder = new UrlBuilder() - .path("/"); - builder.path(""); - assertNull(builder.path()); + .setPath("/"); + builder.setPath(""); + assertNull(builder.getPath()); } @Test public void pathWhenBuilderPathIsForwardSlashAndPathIsForwardSlash() { final UrlBuilder builder = new UrlBuilder() - .path("/"); - builder.path("/"); - assertEquals("/", builder.path()); + .setPath("/"); + builder.setPath("/"); + assertEquals("/", builder.getPath()); } @Test public void pathWhenBuilderPathIsForwardSlashAndPath() { final UrlBuilder builder = new UrlBuilder() - .path("/"); - builder.path("test/path.html"); - assertEquals("test/path.html", builder.path()); + .setPath("/"); + builder.setPath("test/path.html"); + assertEquals("test/path.html", builder.getPath()); + } + + @Test + public void pathWhenHostContainsPath() { + final UrlBuilder builder = new UrlBuilder() + .setHost("www.example.com/site") + .setPath("index.html"); + assertEquals("www.example.com", builder.getHost()); + assertEquals("index.html", builder.getPath()); + assertEquals("www.example.com/index.html", builder.toString()); + } + + @Test + public void pathFirstWhenHostContainsPath() { + final UrlBuilder builder = new UrlBuilder() + .setPath("index.html") + .setHost("www.example.com/site"); + assertEquals("www.example.com", builder.getHost()); + assertEquals("/site", builder.getPath()); + assertEquals("www.example.com/site", builder.toString()); + } + + @Test + public void emptyPathWhenHostContainsPath() { + final UrlBuilder builder = new UrlBuilder() + .setPath("") + .setHost("www.example.com/site"); + assertEquals("www.example.com", builder.getHost()); + assertEquals("/site", builder.getPath()); + assertEquals("www.example.com/site", builder.toString()); + } + + @Test + public void slashPathWhenHostContainsPath() { + final UrlBuilder builder = new UrlBuilder() + .setPath("//") + .setHost("www.example.com/site"); + assertEquals("www.example.com", builder.getHost()); + assertEquals("/site", builder.getPath()); + assertEquals("www.example.com/site", builder.toString()); } @Test public void withAbsolutePath() { final UrlBuilder builder = new UrlBuilder() - .scheme("http") - .host("www.example.com") - .path("http://www.othersite.com"); + .setScheme("http") + .setHost("www.example.com") + .setPath("http://www.othersite.com"); assertEquals("http://www.othersite.com", builder.toString()); } @Test public void queryInPath() { final UrlBuilder builder = new UrlBuilder() - .scheme("http") - .host("www.example.com") - .path("mypath?thing=stuff") + .setScheme("http") + .setHost("www.example.com") + .setPath("mypath?thing=stuff") .setQueryParameter("otherthing", "otherstuff"); assertEquals("http://www.example.com/mypath?thing=stuff&otherthing=otherstuff", builder.toString()); } @@ -485,9 +525,9 @@ public void queryInPath() { @Test public void withAbsolutePathAndQuery() { final UrlBuilder builder = new UrlBuilder() - .scheme("http") - .host("www.example.com") - .path("http://www.othersite.com/mypath?thing=stuff") + .setScheme("http") + .setHost("www.example.com") + .setPath("http://www.othersite.com/mypath?thing=stuff") .setQueryParameter("otherthing", "otherstuff"); assertEquals("http://www.othersite.com/mypath?thing=stuff&otherthing=otherstuff", builder.toString()); } @@ -495,24 +535,24 @@ public void withAbsolutePathAndQuery() { @Test public void queryWithNull() { final UrlBuilder builder = new UrlBuilder() - .query(null); - assertEquals(0, builder.query().size()); + .setQuery(null); + assertEquals(0, builder.getQuery().size()); assertEquals("", builder.toString()); } @Test public void queryWithEmpty() { final UrlBuilder builder = new UrlBuilder() - .query(""); - assertEquals(0, builder.query().size()); + .setQuery(""); + assertEquals(0, builder.getQuery().size()); assertEquals("", builder.toString()); } @Test public void queryWithQuestionMark() { final UrlBuilder builder = new UrlBuilder() - .query("?"); - assertEquals(0, builder.query().size()); + .setQuery("?"); + assertEquals(0, builder.getQuery().size()); assertEquals("", builder.toString()); } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/util/FluxUtilTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/util/FluxUtilTests.java deleted file mode 100644 index 3ebeb7544b14..000000000000 --- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/util/FluxUtilTests.java +++ /dev/null @@ -1,437 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.implementation.util; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpMethod; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedResponse; -import com.azure.core.http.rest.Response; -import com.azure.core.implementation.http.PagedResponseBase; -import com.azure.core.util.Context; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufUtil; -import io.netty.buffer.Unpooled; -import io.netty.handler.codec.http.HttpResponseStatus; -import io.netty.util.ReferenceCountUtil; -import java.io.BufferedOutputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.nio.channels.AsynchronousFileChannel; -import java.nio.charset.StandardCharsets; -import java.nio.file.StandardOpenOption; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.IntStream; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import reactor.core.Exceptions; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import reactor.test.StepVerifier; - -public class FluxUtilTests { - - @Test - public void testCanReadSlice() throws IOException { - File file = createFileIfNotExist("target/test1"); - FileOutputStream stream = new FileOutputStream(file); - stream.write("hello there".getBytes(StandardCharsets.UTF_8)); - stream.close(); - - try (AsynchronousFileChannel channel = AsynchronousFileChannel.open(file.toPath(), StandardOpenOption.READ)) { - byte[] bytes = FluxUtil.byteBufStreamFromFile(channel, 1, 3) - .map(bb -> { - byte[] bt = toBytes(bb); - ReferenceCountUtil.release(bb); - return bt; - }) - .collect(() -> new ByteArrayOutputStream(), - (bos, b) -> { - try { - bos.write(b); - } catch (IOException ioe) { - throw Exceptions.propagate(ioe); - } - }) - .block() - .toByteArray(); - assertEquals("ell", new String(bytes, StandardCharsets.UTF_8)); - } catch (IOException ioe) { - - } - - } - - @Test - public void testCanReadEmptyFile() throws IOException { - File file = createFileIfNotExist("target/test2"); - - try (AsynchronousFileChannel channel = AsynchronousFileChannel.open(file.toPath(), StandardOpenOption.READ)) { - byte[] bytes = FluxUtil.byteBufStreamFromFile(channel, 1, 3) - .map(bb -> { - byte[] bt = toBytes(bb); - ReferenceCountUtil.release(bb); - return bt; - }) - .collect(() -> new ByteArrayOutputStream(), - (bos, b) -> { - try { - bos.write(b); - } catch (IOException ioe) { - throw Exceptions.propagate(ioe); - } - }) - .block().toByteArray(); - assertEquals(0, bytes.length); - } - assertTrue(file.delete()); - } - - @Test - public void testAsynchronyShortInput() throws IOException { - File file = createFileIfNotExist("target/test3"); - FileOutputStream stream = new FileOutputStream(file); - stream.write("hello there".getBytes(StandardCharsets.UTF_8)); - stream.close(); - try (AsynchronousFileChannel channel = AsynchronousFileChannel.open(file.toPath(), StandardOpenOption.READ)) { - byte[] bytes = FluxUtil.byteBufStreamFromFile(channel) - .map(bb -> { - byte[] bt = toBytes(bb); - ReferenceCountUtil.release(bb); - return bt; - }) - .limitRequest(1) - .subscribeOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) - .publishOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) - .collect(() -> new ByteArrayOutputStream(), - (bos, b) -> { - try { - bos.write(b); - } catch (IOException ioe) { - throw Exceptions.propagate(ioe); - } - }) - .block() - .toByteArray(); - assertEquals("hello there", new String(bytes, StandardCharsets.UTF_8)); - } - assertTrue(file.delete()); - } - - private static final int NUM_CHUNKS_IN_LONG_INPUT = 10_000_000; - - @Test - public void testAsynchronyLongInput() throws IOException, NoSuchAlgorithmException { - File file = createFileIfNotExist("target/test4"); - byte[] array = "1234567690".getBytes(StandardCharsets.UTF_8); - MessageDigest digest = MessageDigest.getInstance("MD5"); - try (BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file))) { - for (int i = 0; i < NUM_CHUNKS_IN_LONG_INPUT; i++) { - out.write(array); - digest.update(array); - } - } - System.out.println("long input file size=" + file.length() / (1024 * 1024) + "MB"); - byte[] expected = digest.digest(); - digest.reset(); - try (AsynchronousFileChannel channel = AsynchronousFileChannel.open(file.toPath(), StandardOpenOption.READ)) { - FluxUtil.byteBufStreamFromFile(channel) - .subscribeOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) - .publishOn(reactor.core.scheduler.Schedulers.newElastic("io", 30)) - .toIterable().forEach(bb -> { - digest.update(bb.nioBuffer()); - ReferenceCountUtil.release(bb); - }); - - assertArrayEquals(expected, digest.digest()); - } - assertTrue(file.delete()); - } - - @Test - @Ignore("Need to sync with smaldini to find equivalent for rx.test.awaitDone") - public void testBackpressureLongInput() throws IOException, NoSuchAlgorithmException { -// File file = new File("target/test4"); -// byte[] array = "1234567690".getBytes(StandardCharsets.UTF_8); -// MessageDigest digest = MessageDigest.getInstance("MD5"); -// try (BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file))) { -// for (int i = 0; i < NUM_CHUNKS_IN_LONG_INPUT; i++) { -// out.write(array); -// digest.update(array); -// } -// } -// byte[] expected = digest.digest(); -// digest.reset(); -// -// try (AsynchronousFileChannel channel = AsynchronousFileChannel.open(file.toPath(), StandardOpenOption.READ)) { -// FluxUtil1.byteBufferStreamFromFile(channel) -// .rebatchRequests(1) -// .subscribeOn(Schedulers.io()) -// .observeOn(Schedulers.io()) -// .doOnNext(bb -> digest.update(bb)) -// .test(0) -// .assertNoValues() -// .requestMore(1) -// .awaitCount(1) -// .assertValueCount(1) -// .requestMore(1) -// .awaitCount(2) -// .assertValueCount(2) -// .requestMore(Long.MAX_VALUE) -// .awaitDone(20, TimeUnit.SECONDS) -// .assertComplete(); -// } -// -// assertArrayEquals(expected, digest.digest()); -// assertTrue(file.delete()); - } - - @Test - public void testSplitForMultipleSplitSizesFromOneTo16() throws NoSuchAlgorithmException { - ByteBuf bb = null; - try { - bb = Unpooled.directBuffer(1000); - byte[] oneByte = new byte[1]; - for (int i = 0; i < 1000; i++) { - oneByte[0] = (byte) i; - bb.writeBytes(oneByte); - } - MessageDigest digest = MessageDigest.getInstance("MD5"); - digest.update(bb.nioBuffer()); - byte[] expected = digest.digest(); - for (int size = 1; size < 16; size++) { - System.out.println("size=" + size); - digest.reset(); - bb.readerIndex(0); - // - FluxUtil.split(bb, 3).doOnNext(b -> digest.update(b.nioBuffer())) - .subscribe(); -// -// StepVerifier.create(FluxUtil1.split(bb, 3).doOnNext(b -> digest.update(b))) -// .expectNextCount(?) // TODO: ? is Unknown. Check with smaldini - what is the Verifier way to ignore all next calls and simply check stream completes? -// .verifyComplete(); -// - assertArrayEquals(expected, digest.digest()); - } - } finally { - if (bb != null) { - bb.release(); - } - } - } - - @Test - public void testSplitOnEmptyContent() { - ByteBuf bb = null; - try { - bb = Unpooled.directBuffer(16); - StepVerifier.create(FluxUtil.split(bb, 3)) - .expectNextCount(0) - .expectComplete() - .verify(); - } finally { - if (bb != null) { - bb.release(); - } - } - } - - @Test - public void toByteArrayWithEmptyByteBuffer() { - assertArrayEquals(new byte[0], FluxUtil.byteBufToArray(Unpooled.wrappedBuffer(new byte[0]))); - } - - @Test - public void toByteArrayWithNonEmptyByteBuffer() { - final ByteBuf byteBuffer = Unpooled.wrappedBuffer(new byte[] { 0, 1, 2, 3, 4 }); - assertEquals(5, byteBuffer.readableBytes()); - final byte[] byteArray = FluxUtil.byteBufToArray(byteBuffer); - assertArrayEquals(new byte[] { 0, 1, 2, 3, 4 }, byteArray); - assertEquals(5, byteBuffer.readableBytes()); - } - - @Test - public void testCollectByteBufStream() { - Flux byteBufFlux = Flux - .just(Unpooled.copyInt(1), Unpooled.copyInt(255), Unpooled.copyInt(256)); - Mono result = FluxUtil.collectByteBufStream(byteBufFlux, false); - byte[] bytes = ByteBufUtil.getBytes(result.block()); - assertEquals(12, bytes.length); - assertArrayEquals(new byte[]{ - 0, 0, 0, 1, - 0, 0, 0, (byte) 255, - 0, 0, 1, 0}, bytes); - } - - @Test - public void testToMono() { - String value = "test"; - Assert.assertEquals(getMonoRestResponse(value).flatMap(FluxUtil::toMono).block(), value); - Assert.assertEquals(getMonoRestResponse("").flatMap(FluxUtil::toMono).block(), ""); - } - - @Test - public void testCallWithContextGetSingle() { - String response = getSingle("Hello, ") - .subscriberContext(reactor.util.context.Context.of("FirstName", "Foo", "LastName", "Bar")) - .block(); - Assert.assertEquals("Hello, Foo Bar", response); - } - - @Test - public void testCallWithContextGetCollection() { - List expectedLines = Arrays.asList("Hello,", "Foo", "Bar"); - List actualLines = new ArrayList<>(); - getCollection("Hello, ") - .subscriberContext(reactor.util.context.Context.of("FirstName", "Foo", "LastName", "Bar")) - .doOnNext(line -> actualLines.add(line)) - .subscribe(); - Assert.assertEquals(expectedLines, actualLines); - } - - @Test - public void testCallWithContextGetPagedCollection() throws Exception { - // Simulates the customer code that includes context - getPagedCollection() - .subscriberContext( - reactor.util.context.Context.of("Key1", "Val1", "Key2", "Val2")) - .doOnNext(System.out::println) - .subscribe(); - } - - private PagedFlux getPagedCollection() - throws Exception { - // Simulates the client library API - List> pagedResponses = getPagedResponses(4); - return new PagedFlux<>( - () -> FluxUtil.withContext(context -> getFirstPage(pagedResponses, context)), - continuationToken -> FluxUtil - .withContext(context -> getNextPage(continuationToken, pagedResponses, context))); - } - - private List> getPagedResponses(int noOfPages) - throws MalformedURLException { - HttpHeaders httpHeaders = new HttpHeaders().put("header1", "value1") - .put("header2", "value2"); - HttpRequest httpRequest = new HttpRequest(HttpMethod.GET, new URL("http://localhost")); - String deserializedHeaders = "header1,value1,header2,value2"; - return IntStream.range(0, noOfPages) - .boxed() - .map(i -> createPagedResponse(httpRequest, httpHeaders, deserializedHeaders, i, noOfPages)) - .collect(Collectors.toList()); - } - - private Mono> getFirstPage(List> pagedResponses, - Context context) { - // Simulates the service side code which should get the context provided by customer code - Assert.assertEquals("Val1", context.getData("Key1").get()); - return pagedResponses.isEmpty() ? Mono.empty() : Mono.just(pagedResponses.get(0)); - } - - private Mono> getNextPage(String continuationToken, - List> pagedResponses, Context context) { - // Simulates the service side code which should get the context provided by customer code - Assert.assertEquals("Val2", context.getData("Key2").get()); - if (continuationToken == null || continuationToken.isEmpty()) { - return Mono.empty(); - } - return Mono.just(pagedResponses.get(Integer.valueOf(continuationToken))); - } - - private PagedResponseBase createPagedResponse(HttpRequest httpRequest, - HttpHeaders httpHeaders, String deserializedHeaders, int i, int noOfPages) { - return new PagedResponseBase<>(httpRequest, HttpResponseStatus.OK.code(), - httpHeaders, - getItems(i), - i < noOfPages - 1 ? String.valueOf(i + 1) : null, - deserializedHeaders); - } - - private List getItems(Integer i) { - return IntStream.range(i * 3, i * 3 + 3).boxed().collect(Collectors.toList()); - } - - - private Mono getSingle(String prefix) { - return FluxUtil.withContext(context -> serviceCallSingle(prefix, context)); - } - - private Flux getCollection(String prefix) { - return FluxUtil - .fluxContext(context -> serviceCallCollection(prefix, context)); - } - - private Mono serviceCallSingle(String prefix, Context context) { - String msg = prefix - + context.getData("FirstName").orElse("Stranger") - + " " - + context.getData("LastName").orElse(""); - return Mono.just(msg); - } - - private Flux serviceCallCollection(String prefix, Context context) { - String msg = prefix - + context.getData("FirstName").orElse("Stranger") - + " " - + context.getData("LastName").orElse(""); - - return Flux.just(msg.split(" ")); - } -// - private static byte[] toBytes(ByteBuf bb) { - byte[] bytes = new byte[bb.readableBytes()]; - bb.readBytes(bytes); - return bytes; - } - - private File createFileIfNotExist(String fileName) throws IOException { - File file = new File(fileName); - if (file.getParentFile() != null) { - file.getParentFile().mkdirs(); - } - file.createNewFile(); - return file; - } - - private Mono> getMonoRestResponse(T value) { - Response response = new Response() { - @Override - public int statusCode() { - return 200; - } - - @Override - public HttpHeaders headers() { - return null; - } - - @Override - public HttpRequest request() { - return null; - } - - @Override - public T value() { - return value; - } - }; - return Mono.just(response); - } - -} diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/util/polling/PollerTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/util/polling/PollerTests.java index c03e1b19ef51..5f780df8845c 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/util/polling/PollerTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/util/polling/PollerTests.java @@ -4,6 +4,7 @@ package com.azure.core.util.polling; import com.azure.core.exception.HttpResponseException; +import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.PollResponse.OperationStatus; import org.junit.Assert; @@ -22,6 +23,7 @@ public class PollerTests { + private final ClientLogger logger = new ClientLogger(PollerTests.class); private boolean debug = true; int count; @@ -436,11 +438,12 @@ public void run() { private void debug(String... messages) { if (debug) { - StringBuffer sb = new StringBuffer(new Date().toString()).append(" ").append(getClass().getName()).append(" ").append(count).append(" "); + StringBuilder sb = + new StringBuilder(new Date().toString()).append(" ").append(getClass().getName()).append(" ").append(count).append(" "); for (String m : messages) { sb.append(m); } - System.out.println(sb.toString()); + logger.info(sb.toString()); } } diff --git a/sdk/core/ci.yml b/sdk/core/ci.yml index 1f44374c8d28..71e02997bd72 100644 --- a/sdk/core/ci.yml +++ b/sdk/core/ci.yml @@ -6,7 +6,7 @@ resources: - repository: azure-sdk-build-tools type: git name: internal/azure-sdk-build-tools - + trigger: branches: include: @@ -36,9 +36,19 @@ stages: Artifacts: - name: azure-core safeName: azurecore + stagingProfileId: 88192f04117501 - name: azure-core-amqp safeName: azurecoreamqp + stagingProfileId: 88192f04117501 + - name: azure-core-http-netty + safeName: azurecorehttpnetty + stagingProfileId: 88192f04117501 + - name: azure-core-http-okhttp + safeName: azurecorehttpokhttp + stagingProfileId: 88192f04117501 - name: azure-core-management safeName: azurecoremanagement + stagingProfileId: 88192f04117501 - name: azure-core-test - safeName: azurecoretest \ No newline at end of file + safeName: azurecoretest + stagingProfileId: 88192f04117501 diff --git a/sdk/core/pom.service.xml b/sdk/core/pom.service.xml index 10c012fa679b..c2af4ecf5ff0 100644 --- a/sdk/core/pom.service.xml +++ b/sdk/core/pom.service.xml @@ -11,6 +11,8 @@ azure-core azure-core-amqp + azure-core-http-netty + azure-core-http-okhttp azure-core-management azure-core-test diff --git a/sdk/cosmos/README.md b/sdk/cosmos/README.md index f7854c9ae68e..db27f10b1c75 100644 --- a/sdk/cosmos/README.md +++ b/sdk/cosmos/README.md @@ -1,4 +1,4 @@ -# Java SDK for SQL API of Azure Cosmos DB +# Java SDK for SQL API of Azure Cosmos DB [![Maven Central](https://img.shields.io/maven-central/v/com.microsoft.azure/azure-cosmos.svg)](https://search.maven.org/artifact/com.microsoft.azure/azure-cosmos) [![Known Vulnerabilities](https://snyk.io/test/github/Azure/azure-cosmosdb-java/badge.svg?targetFile=sdk%2Fpom.xml)](https://snyk.io/test/github/Azure/azure-cosmosdb-java?targetFile=sdk%2Fpom.xml) @@ -248,3 +248,5 @@ If you encounter any bugs with the SDK please file an [issue](https://github.com [MIT License](LICENSE) Copyright (c) 2018 Copyright (c) Microsoft Corporation + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/cosmos/README.png) diff --git a/sdk/cosmos/ci.yml b/sdk/cosmos/ci.yml index 3b1fbf6fa17e..3d5b6a219100 100644 --- a/sdk/cosmos/ci.yml +++ b/sdk/cosmos/ci.yml @@ -1,122 +1,39 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +resources: + repositories: + - repository: azure-sdk-build-tools + type: git + name: internal/azure-sdk-build-tools + trigger: branches: include: - - master + - master + - feature/* + - hotfix/* + - release/* paths: include: - - sdk/cosmos/ + - sdk/cosmos/ pr: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/cosmos/ -variables: - EmulatorMsiUrl: 'https://acpedaily1.blob.core.windows.net/emulator/azure-cosmos-emulator.msi' - -jobs: - - template: ../../eng/pipelines/templates/jobs/archetype-sdk-client.yml +stages: + - template: ../../eng/pipelines/templates/stages/cosmos-sdk-client.yml #NOTE: Non-standard template. parameters: ServiceDirectory: cosmos - TestGoals: test - TestMatrix: - Windows - java8: - OSVmImage: 'vs2017-win2016' - JavaVersion: '1.8' - OSName: Windows - ProfileFlag: '-Punit' - MacOS - java8: - OSVmImage: 'macOS-10.13' - JavaVersion: '1.8' - OSName: macOS - ProfileFlag: '-Punit' - PreTestSteps: - - template: ../steps/install-reporting-tools.yml - - - template: ../../eng/pipelines/templates/jobs/archetype-sdk-tests.yml - parameters: - TestName: Emulator - ServiceDirectory: cosmos - Matrix: - Tcp_Integration_Tests_Java8: - OSVmImage: 'vs2017-win2016' - JavaVersion: '1.8' - ProfileFlag: '-Pemulator' - DisplayName: 'Emulator only Integration Tests' - PROTOCOLS: '["Tcp"]' - DESIRED_CONSISTENCIES: '["Strong", "Session"]' - Https_Integration_Tests_Java8: - OSVmImage: 'vs2017-win2016' - JavaVersion: '1.8' - ProfileFlag: '-Pemulator' - DisplayName: 'Emulator only Integration Tests' - PROTOCOLS: '["Https"]' - DESIRED_CONSISTENCIES: '["Strong", "Session"]' - Examples_Integration_Tests_Java8: - OSVmImage: 'vs2017-win2016' - JavaVersion: '1.8' - ProfileFlag: '-Pexamples' - DisplayName: 'Examples Integration Tests' - PROTOCOLS: '["Https", "Tcp"]' - DESIRED_CONSISTENCIES: '["Strong", "Session"]' - - TestStepMavenInputs: - goals: 'verify' - options: '$(ProfileFlag) -Dgpg.skip -DargLine="-DACCOUNT_HOST=https://localhost:8081/"' - mavenAuthenticateFeed: true - jdkVersionOption: $(JavaVersion) - - PreRunSteps: - - powershell: | - Write-Host "Downloading Cosmos Emulator - $(EmulatorMsiUrl)" - wget "$(EmulatorMsiUrl)" -outfile "$env:temp\azure-cosmosdb-emulator.msi" - Write-Host "Finished Downloading Cosmos Emulator - $env:temp\azure-cosmosdb-emulator.msi" - dir "$env:temp" - displayName: 'Download Public Cosmos DB Emulator' - - - script: | - choco install lessmsi - choco upgrade lessmsi - mkdir "%TEMP%\Azure Cosmos DB Emulator" - lessmsi x "%TEMP%\azure-cosmosdb-emulator.msi" "%TEMP%\Azure Cosmos DB Emulator\" - displayName: 'Install Public Cosmos DB Emulator' - - - powershell: | - Write-Host "Starting Comsos DB Emulator" - Start-Process "$env:Temp\Azure Cosmos DB Emulator\SourceDir\Azure Cosmos DB Emulator\CosmosDB.Emulator.exe" "/NoExplorer /NoUI /DisableRateLimiting /PartitionCount=100 /Consistency=Strong" -Verb RunAs - displayName: 'Run Public Cosmos DB Emulator' - - - powershell: | - Import-Module "$env:Temp\Azure Cosmos DB Emulator\SourceDir\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator" - - Do { - sleep 5 - $cosmosStatus = Get-CosmosDbEmulatorStatus - Write-Host "Cosmos Status: $cosmosStatus" - } While ($cosmosStatus -ne 'Running') - - Write-Host "Done" - displayName: 'Check Public Cosmos DB Emulator Status' - - - powershell: | - $Key = 'C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==' - $password = ConvertTo-SecureString -String $Key -Force -AsPlainText - $cert = Get-ChildItem cert:\LocalMachine\My | Where-Object { $_.FriendlyName -eq "DocumentDbEmulatorCertificate" } - Export-PfxCertificate -Cert $cert -FilePath ".\CosmosDbEmulatorCert.pfx" -Password $password | Out-Null - $cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 - $cert.Import(".\CosmosDbEmulatorCert.pfx", $Key, "DefaultKeySet") - $cert | Export-Certificate -FilePath "$env:temp\CosmosDbEmulatorCert.cer" -Type CERT - displayName: 'Export Cosmos DB Emulator Certificate' - - - powershell: | - cd $env:java_home\jre\lib\security - cp $env:temp\CosmosDbEmulatorCert.cer . - keytool -keystore cacerts -importcert -noprompt -trustcacerts -alias CosmosDbEmulatorCert -file CosmosDbEmulatorCert.cer -storepass changeit - displayName: 'Create Java TrustStore' - - # We `install` separately from running `site:site site:stage` so that the `install` brings in the non-shipping-modules, - # but we don't include them in the Maven site commands (so that we don't generate reports for the non-shipping modules). - - template: ../steps/install-reporting-tools.yml + Artifacts: + - name: azure-cosmos + safeName: azurecosmos + stagingProfileId: 534d15ee3800f4 \ No newline at end of file diff --git a/sdk/cosmos/microsoft-azure-cosmos-benchmark/pom.xml b/sdk/cosmos/microsoft-azure-cosmos-benchmark/pom.xml index 69d8a67066ab..5b8454119ab9 100644 --- a/sdk/cosmos/microsoft-azure-cosmos-benchmark/pom.xml +++ b/sdk/cosmos/microsoft-azure-cosmos-benchmark/pom.xml @@ -8,7 +8,7 @@ Licensed under the MIT License. com.microsoft.azure azure-cosmos-parent - 3.1.0 + 3.2.0 com.microsoft.azure @@ -43,28 +43,46 @@ Licensed under the MIT License. com.google.guava guava + ${guava.version} io.dropwizard.metrics metrics-core + ${metrics.version} io.dropwizard.metrics metrics-jvm + ${metrics.version} io.dropwizard.metrics metrics-graphite + ${metrics.version} + + io.micrometer + micrometer-registry-azure-monitor + ${micrometer.version} + + + + io.micrometer + micrometer-registry-graphite + ${micrometer.version} + + + log4j diff --git a/sdk/cosmos/microsoft-azure-cosmos-benchmark/src/main/java/com/azure/data/cosmos/benchmark/AsyncBenchmark.java b/sdk/cosmos/microsoft-azure-cosmos-benchmark/src/main/java/com/azure/data/cosmos/benchmark/AsyncBenchmark.java index 6aae3eb043ee..cc654b35fb7b 100644 --- a/sdk/cosmos/microsoft-azure-cosmos-benchmark/src/main/java/com/azure/data/cosmos/benchmark/AsyncBenchmark.java +++ b/sdk/cosmos/microsoft-azure-cosmos-benchmark/src/main/java/com/azure/data/cosmos/benchmark/AsyncBenchmark.java @@ -21,6 +21,7 @@ import com.codahale.metrics.jvm.CachedThreadStatesGaugeSet; import com.codahale.metrics.jvm.GarbageCollectorMetricSet; import com.codahale.metrics.jvm.MemoryUsageGaugeSet; +import io.micrometer.core.instrument.MeterRegistry; import org.apache.commons.lang3.RandomStringUtils; import org.reactivestreams.Subscription; import org.slf4j.Logger; @@ -114,6 +115,18 @@ abstract class AsyncBenchmark { reporter = ConsoleReporter.forRegistry(metricsRegistry).convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS).build(); } + + MeterRegistry registry = configuration.getAzureMonitorMeterRegistry(); + + if (registry != null) { + BridgeInternal.monitorTelemetry(registry); + } + + registry = configuration.getGraphiteMeterRegistry(); + + if (registry != null) { + BridgeInternal.monitorTelemetry(registry); + } } protected void init() { diff --git a/sdk/cosmos/microsoft-azure-cosmos-benchmark/src/main/java/com/azure/data/cosmos/benchmark/Configuration.java b/sdk/cosmos/microsoft-azure-cosmos-benchmark/src/main/java/com/azure/data/cosmos/benchmark/Configuration.java index da084832dedc..1ab63af0d5cf 100644 --- a/sdk/cosmos/microsoft-azure-cosmos-benchmark/src/main/java/com/azure/data/cosmos/benchmark/Configuration.java +++ b/sdk/cosmos/microsoft-azure-cosmos-benchmark/src/main/java/com/azure/data/cosmos/benchmark/Configuration.java @@ -11,15 +11,30 @@ import com.beust.jcommander.Parameter; import com.beust.jcommander.ParameterException; import com.google.common.base.Strings; +import com.google.common.net.HostAndPort; +import com.google.common.net.PercentEscaper; +import io.micrometer.azuremonitor.AzureMonitorConfig; +import io.micrometer.azuremonitor.AzureMonitorMeterRegistry; +import io.micrometer.core.instrument.Clock; +import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.config.NamingConvention; +import io.micrometer.core.lang.Nullable; +import io.micrometer.graphite.GraphiteConfig; +import io.micrometer.graphite.GraphiteMeterRegistry; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; +import java.net.InetAddress; +import java.net.UnknownHostException; import java.time.Duration; import java.util.Arrays; class Configuration { - private final static int GRAPHITE_SERVER_DEFAULT_PORT = 2003; + + private final static int DEFAULT_GRAPHITE_SERVER_PORT = 2003; + private MeterRegistry azureMonitorMeterRegistry; + private MeterRegistry graphiteMeterRegistry; @Parameter(names = "-serviceEndpoint", description = "Service Endpoint") private String serviceEndpoint; @@ -246,6 +261,20 @@ public boolean isEnableJvmStats() { return enableJvmStats; } + public MeterRegistry getAzureMonitorMeterRegistry() { + String instrumentationKey = System.getProperty("azure.cosmos.monitoring.azureMonitor.instrumentationKey", + StringUtils.defaultString(Strings.emptyToNull( + System.getenv().get("AZURE_INSTRUMENTATION_KEY")), null)); + return instrumentationKey == null ? null : this.azureMonitorMeterRegistry(instrumentationKey); + } + + public MeterRegistry getGraphiteMeterRegistry() { + String serviceAddress = System.getProperty("azure.cosmos.monitoring.graphite.serviceAddress", + StringUtils.defaultString(Strings.emptyToNull( + System.getenv().get("GRAPHITE_SERVICE_ADDRESS")), null)); + return serviceAddress == null ? null : this.graphiteMeterRegistry(serviceAddress); + } + public String getGraphiteEndpoint() { if (graphiteEndpoint == null) { return null; @@ -261,7 +290,7 @@ public int getGraphiteEndpointPort() { String portAsString = Strings.emptyToNull(StringUtils.substringAfterLast(graphiteEndpoint, ":")); if (portAsString == null) { - return GRAPHITE_SERVER_DEFAULT_PORT; + return DEFAULT_GRAPHITE_SERVER_PORT; } else { return Integer.parseInt(portAsString); } @@ -306,4 +335,112 @@ void tryGetValuesFromSystem() { Strings.emptyToNull(System.getenv().get("NUMBER_OF_OPERATIONS")), Integer.toString(numberOfOperations)); numberOfOperations = Integer.parseInt(numberOfOperationsValue); } + + private synchronized MeterRegistry azureMonitorMeterRegistry(String instrumentationKey) { + + if (this.azureMonitorMeterRegistry == null) { + + Duration step = Duration.ofSeconds(Integer.getInteger("azure.cosmos.monitoring.azureMonitor.step", this.printingInterval)); + boolean enabled = !Boolean.getBoolean("azure.cosmos.monitoring.azureMonitor.disabled"); + + final AzureMonitorConfig config = new AzureMonitorConfig() { + + @Override + @Nullable + public String get(@Nullable String key) { + return null; + } + + @Override + @Nullable + public String instrumentationKey() { + return instrumentationKey; + } + + @Override + public Duration step() { + return step; + } + + @Override + public boolean enabled() { + return enabled; + } + }; + + this.azureMonitorMeterRegistry = new AzureMonitorMeterRegistry(config, Clock.SYSTEM); + } + + return this.azureMonitorMeterRegistry; + } + + @SuppressWarnings("UnstableApiUsage") + private synchronized MeterRegistry graphiteMeterRegistry(String serviceAddress) { + + if (this.graphiteMeterRegistry == null) { + + HostAndPort address = HostAndPort.fromString(serviceAddress); + + String host = address.getHost(); + int port = address.getPortOrDefault(DEFAULT_GRAPHITE_SERVER_PORT); + boolean enabled = !Boolean.getBoolean("azure.cosmos.monitoring.graphite.disabled"); + Duration step = Duration.ofSeconds(Integer.getInteger("azure.cosmos.monitoring.graphite.step", this.printingInterval)); + + final GraphiteConfig config = new GraphiteConfig() { + + private String[] tagNames = { "source" }; + + @Override + @Nullable + public String get(@Nullable String key) { + return null; + } + + @Override + public boolean enabled() { + return enabled; + } + + @Override + @Nullable + public String host() { + return host; + } + + @Override + @Nullable + public int port() { + return port; + } + + @Override + @Nullable + public Duration step() { + return step; + } + + @Override + @Nullable + public String[] tagsAsPrefix() { + return this.tagNames; + } + }; + + this.graphiteMeterRegistry = new GraphiteMeterRegistry(config, Clock.SYSTEM); + String source; + + try { + PercentEscaper escaper = new PercentEscaper("_-", false); + source = escaper.escape(InetAddress.getLocalHost().getHostName()); + } catch (UnknownHostException error) { + source = "unknown-host"; + } + + this.graphiteMeterRegistry.config() + .namingConvention(NamingConvention.dot) + .commonTags("source", source); + } + + return this.graphiteMeterRegistry; + } } diff --git a/sdk/cosmos/microsoft-azure-cosmos-benchmark/src/test/java/com/azure/data/cosmos/benchmark/ReadMyWritesConsistencyTest.java b/sdk/cosmos/microsoft-azure-cosmos-benchmark/src/test/java/com/azure/data/cosmos/benchmark/ReadMyWritesConsistencyTest.java index 584353ee6362..4cc7b35e01b0 100644 --- a/sdk/cosmos/microsoft-azure-cosmos-benchmark/src/test/java/com/azure/data/cosmos/benchmark/ReadMyWritesConsistencyTest.java +++ b/sdk/cosmos/microsoft-azure-cosmos-benchmark/src/test/java/com/azure/data/cosmos/benchmark/ReadMyWritesConsistencyTest.java @@ -3,27 +3,28 @@ package com.azure.data.cosmos.benchmark; -import com.azure.data.cosmos.internal.AsyncDocumentClient; import com.azure.data.cosmos.BridgeInternal; import com.azure.data.cosmos.DataType; -import com.azure.data.cosmos.internal.Database; -import com.azure.data.cosmos.internal.DocumentCollection; import com.azure.data.cosmos.IncludedPath; import com.azure.data.cosmos.Index; import com.azure.data.cosmos.IndexingPolicy; import com.azure.data.cosmos.PartitionKeyDefinition; +import com.azure.data.cosmos.internal.AsyncDocumentClient; +import com.azure.data.cosmos.internal.Database; +import com.azure.data.cosmos.internal.DocumentCollection; import com.azure.data.cosmos.internal.RequestOptions; import com.azure.data.cosmos.internal.TestConfigurations; +import com.azure.data.cosmos.internal.directconnectivity.Protocol; import com.beust.jcommander.JCommander; import com.google.common.base.CaseFormat; import com.google.common.base.Strings; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; import reactor.core.publisher.Flux; import reactor.core.scheduler.Schedulers; @@ -38,52 +39,91 @@ import static org.assertj.core.api.Assertions.assertThat; public class ReadMyWritesConsistencyTest { + private final static Logger logger = LoggerFactory.getLogger(ReadMyWritesConsistencyTest.class); - private final int initialCollectionThroughput = 10_000; - private final int newCollectionThroughput = 100_000; + + private final AtomicBoolean collectionScaleUpFailed = new AtomicBoolean(false); + private final Duration defaultMaxRunningTime = Duration.ofMinutes(45); private final int delayForInitiationCollectionScaleUpInSeconds = 60; - private final Duration defaultMaxRunningTimeInSeconds = Duration.ofMinutes(45); + + private final String desiredConsistency = + System.getProperty("DESIRED_CONSISTENCY", + StringUtils.defaultString(Strings.emptyToNull( + System.getenv().get("DESIRED_CONSISTENCY")), "Session")); + + private final int initialCollectionThroughput = 10_000; private final String maxRunningTime = - System.getProperty("MAX_RUNNING_TIME", StringUtils.defaultString(Strings.emptyToNull( - System.getenv().get("MAX_RUNNING_TIME")), defaultMaxRunningTimeInSeconds.toString())); + System.getProperty("MAX_RUNNING_TIME", StringUtils.defaultString(Strings.emptyToNull( + System.getenv().get("MAX_RUNNING_TIME")), defaultMaxRunningTime.toString())); - private final AtomicBoolean collectionScaleUpFailed = new AtomicBoolean(false); - private final String desiredConsistency = - System.getProperty("DESIRED_CONSISTENCY", - StringUtils.defaultString(Strings.emptyToNull( - System.getenv().get("DESIRED_CONSISTENCY")), "Session")); + private final int newCollectionThroughput = 100_000; private final String numberOfOperationsAsString = - System.getProperty("NUMBER_OF_OPERATIONS", - StringUtils.defaultString(Strings.emptyToNull( - System.getenv().get("NUMBER_OF_OPERATIONS")), "-1")); + System.getProperty("NUMBER_OF_OPERATIONS", + StringUtils.defaultString(Strings.emptyToNull( + System.getenv().get("NUMBER_OF_OPERATIONS")), "-1")); - private Database database; private DocumentCollection collection; + private Database database; + + @AfterClass(groups = "e2e") + public void afterClass() { + AsyncDocumentClient housekeepingClient = Utils.housekeepingClient(); + Utils.safeCleanDatabases(housekeepingClient); + Utils.safeClean(housekeepingClient, database); + Utils.safeClose(housekeepingClient); + } + + @BeforeClass(groups = "e2e") + public void beforeClass() { + RequestOptions options = new RequestOptions(); + options.setOfferThroughput(initialCollectionThroughput); + AsyncDocumentClient housekeepingClient = Utils.housekeepingClient(); + database = Utils.createDatabaseForTest(housekeepingClient); + collection = housekeepingClient.createCollection("dbs/" + database.id(), + getCollectionDefinitionWithRangeRangeIndex(), + options).single().block().getResource(); + housekeepingClient.close(); + } + + @DataProvider(name = "collectionLinkTypeArgProvider") + public Object[][] collectionLinkTypeArgProvider() { + return new Object[][] { + // is namebased + { true }, + }; + } - //FIXME: Test is flaky, fails inconsistently + // FIXME: Test is flaky, fails inconsistently @Test(dataProvider = "collectionLinkTypeArgProvider", groups = "e2e") public void readMyWrites(boolean useNameLink) throws Exception { + int concurrency = 5; + String cmdFormat = "-serviceEndpoint %s -masterKey %s" + - " -databaseId %s -collectionId %s" + - " -consistencyLevel %s -concurrency %d" + - " -numberOfOperations %s" + - " -maxRunningTimeDuration %s" + - " -operation ReadMyWrites -connectionMode DIRECT -numberOfPreCreatedDocuments 100 " + - " -printingInterval 60"; - - String cmd = String.format(cmdFormat, - TestConfigurations.HOST, - TestConfigurations.MASTER_KEY, - database.id(), - collection.id(), - CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, desiredConsistency), - concurrency, - numberOfOperationsAsString, - maxRunningTime) - + (useNameLink ? " -useNameLink" : ""); + " -databaseId %s" + + " -collectionId %s" + + " -consistencyLevel %s" + + " -concurrency %s" + + " -numberOfOperations %s" + + " -maxRunningTimeDuration %s" + + " -operation ReadMyWrites" + + " -connectionMode Direct" + + " -numberOfPreCreatedDocuments 100" + + " -printingInterval 60" + + "%s"; + + String cmd = Strings.lenientFormat(cmdFormat, + TestConfigurations.HOST, + TestConfigurations.MASTER_KEY, + database.id(), + collection.id(), + CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, desiredConsistency), + concurrency, + numberOfOperationsAsString, + maxRunningTime, + (useNameLink ? " -useNameLink" : "")); Configuration cfg = new Configuration(); new JCommander(cfg, StringUtils.split(cmd)); @@ -119,35 +159,6 @@ protected void onSuccess() { } } - @BeforeClass(groups = "e2e") - public void beforeClass() { - RequestOptions options = new RequestOptions(); - options.setOfferThroughput(initialCollectionThroughput); - AsyncDocumentClient housekeepingClient = Utils.housekeepingClient(); - database = Utils.createDatabaseForTest(housekeepingClient); - collection = housekeepingClient.createCollection("dbs/" + database.id(), - getCollectionDefinitionWithRangeRangeIndex(), - options) - .single().block().getResource(); - housekeepingClient.close(); - } - - @DataProvider(name = "collectionLinkTypeArgProvider") - public Object[][] collectionLinkTypeArgProvider() { - return new Object[][]{ - // is namebased - {true}, - }; - } - - @AfterClass(groups = "e2e") - public void afterClass() { - AsyncDocumentClient housekeepingClient = Utils.housekeepingClient(); - Utils.safeCleanDatabases(housekeepingClient); - Utils.safeClean(housekeepingClient, database); - Utils.safeClose(housekeepingClient); - } - DocumentCollection getCollectionDefinitionWithRangeRangeIndex() { PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); ArrayList paths = new ArrayList<>(); @@ -184,24 +195,24 @@ private void scheduleScaleUp(int delayStartInSeconds, int newThroughput) { // increase throughput to max for a single partition collection to avoid throttling // for bulk insert and later queries. return housekeepingClient.queryOffers( - String.format("SELECT * FROM r WHERE r.offerResourceId = '%s'", - collection.resourceId()) - , null).flatMap(page -> Flux.fromIterable(page.results())) - .take(1).flatMap(offer -> { - logger.info("going to scale up collection, newThroughput {}", newThroughput); - offer.setThroughput(newThroughput); - return housekeepingClient.replaceOffer(offer); - }); + String.format("SELECT * FROM r WHERE r.offerResourceId = '%s'", + collection.resourceId()) + , null).flatMap(page -> Flux.fromIterable(page.results())) + .take(1).flatMap(offer -> { + logger.info("going to scale up collection, newThroughput {}", newThroughput); + offer.setThroughput(newThroughput); + return housekeepingClient.replaceOffer(offer); + }); }).doOnTerminate(housekeepingClient::close) - .subscribe(aVoid -> { - }, e -> { - logger.error("collectionScaleUpFailed to scale up collection", e); - collectionScaleUpFailed.set(true); - }, - () -> { - logger.info("Collection Scale up request sent to the service"); - - } - ); + .subscribe(aVoid -> { + }, e -> { + logger.error("collectionScaleUpFailed to scale up collection", e); + collectionScaleUpFailed.set(true); + }, + () -> { + logger.info("Collection Scale up request sent to the service"); + + } + ); } -} \ No newline at end of file +} diff --git a/sdk/cosmos/microsoft-azure-cosmos-examples/pom.xml b/sdk/cosmos/microsoft-azure-cosmos-examples/pom.xml index ec2bb86780a4..b891b9057fd3 100644 --- a/sdk/cosmos/microsoft-azure-cosmos-examples/pom.xml +++ b/sdk/cosmos/microsoft-azure-cosmos-examples/pom.xml @@ -8,7 +8,7 @@ Licensed under the MIT License. com.microsoft.azure azure-cosmos-parent - 3.1.0 + 3.2.0 com.microsoft.azure diff --git a/sdk/cosmos/microsoft-azure-cosmos-examples/src/main/java/com/azure/data/cosmos/examples/AccountSettings.java b/sdk/cosmos/microsoft-azure-cosmos-examples/src/main/java/com/azure/data/cosmos/examples/AccountSettings.java index 71c4b3190e44..c29d55586a15 100644 --- a/sdk/cosmos/microsoft-azure-cosmos-examples/src/main/java/com/azure/data/cosmos/examples/AccountSettings.java +++ b/sdk/cosmos/microsoft-azure-cosmos-examples/src/main/java/com/azure/data/cosmos/examples/AccountSettings.java @@ -7,17 +7,17 @@ /** * Contains the account configurations for Sample. - * + * * For running tests, you can pass a customized endpoint configuration in one of the following * ways: *
    - *
  • -DACCOUNT_KEY="[your-key]" -ACCOUNT_HOST="[your-endpoint]" as JVM + *
  • -DACCOUNT_KEY="[your-key]" -DACCOUNT_HOST="[your-endpoint]" as JVM * command-line option.
  • - *
  • You can set ACCOUNT_KEY and ACCOUNT_HOST as environment variables.
  • + *
  • You can set COSMOS_ACCOUNT_KEY and COSMOS_ACCOUNT_HOST as environment variables.
  • *
- * + * * If none of the above is set, emulator endpoint will be used. - * Emulator http cert is self signed. If you are using emulator, + * Emulator http cert is self signed. If you are using emulator, * make sure emulator https certificate is imported * to java trusted cert store: * https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator-export-ssl-certificates @@ -25,15 +25,14 @@ public class AccountSettings { // REPLACE MASTER_KEY and HOST with values from your Azure Cosmos DB account. // The default values are credentials of the local emulator, which are not used in any production environment. - public static String MASTER_KEY = - System.getProperty("ACCOUNT_KEY", - StringUtils.defaultString(StringUtils.trimToNull( - System.getenv().get("COSMOS_ACCOUNT_KEY")), - "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==")); - - public static String HOST = - System.getProperty("ACCOUNT_HOST", - StringUtils.defaultString(StringUtils.trimToNull( - System.getenv().get("COSMOS_ACCOUNT_HOST")), - "https://localhost:8081/")); + public static final String HOST = + System.getProperty("ACCOUNT_HOST", + StringUtils.defaultString(StringUtils.trimToNull( + System.getenv().get("COSMOS_ACCOUNT_HOST")), + "https://localhost:8081/")); + public static final String MASTER_KEY = + System.getProperty("ACCOUNT_KEY", + StringUtils.defaultString(StringUtils.trimToNull( + System.getenv().get("COSMOS_ACCOUNT_KEY")), + "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==")); } diff --git a/sdk/cosmos/microsoft-azure-cosmos/pom.xml b/sdk/cosmos/microsoft-azure-cosmos/pom.xml index 7e1565f41e72..f8d67ec8e87d 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/pom.xml +++ b/sdk/cosmos/microsoft-azure-cosmos/pom.xml @@ -7,7 +7,7 @@ Licensed under the MIT License. com.microsoft.azure azure-cosmos-parent - 3.1.0 + 3.2.0 com.microsoft.azure @@ -113,6 +113,18 @@ Licensed under the MIT License. guava
+ + io.dropwizard.metrics + metrics-core + ${metrics.version} + + + + io.micrometer + micrometer-core + ${micrometer.version} + + io.projectreactor reactor-test @@ -129,16 +141,12 @@ Licensed under the MIT License. reactor-netty - - io.dropwizard.metrics - metrics-core - - org.mockito mockito-core test + diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/BridgeInternal.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/BridgeInternal.java index 44ab64c860af..7147e743e23d 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/BridgeInternal.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/BridgeInternal.java @@ -5,7 +5,6 @@ import com.azure.data.cosmos.internal.Configs; import com.azure.data.cosmos.internal.Constants; -import com.azure.data.cosmos.internal.DatabaseAccount; import com.azure.data.cosmos.internal.Document; import com.azure.data.cosmos.internal.HttpConstants; import com.azure.data.cosmos.internal.QueryMetrics; @@ -21,6 +20,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; +import io.micrometer.core.instrument.MeterRegistry; import java.net.URI; import java.time.OffsetDateTime; @@ -52,6 +52,10 @@ public static Document documentFromObject(Object document, ObjectMapper mapper) return Document.FromObject(document, mapper); } + public static void monitorTelemetry(MeterRegistry registry) { + CosmosClient.monitorTelemetry(registry); + } + public static ResourceResponse toResourceResponse(RxDocumentServiceResponse response, Class cls) { return new ResourceResponse(response, cls); @@ -86,6 +90,10 @@ public static DatabaseAccount toDatabaseAccount(RxDocumentServiceResponse respon return account; } + public static String getAddressesLink(DatabaseAccount databaseAccount) { + return databaseAccount.getAddressesLink(); + } + public static Map getFeedHeaders(ChangeFeedOptions options) { if (options == null) @@ -212,7 +220,7 @@ public static E setPartitionKeyRangeId(E e, St } public static boolean isEnableMultipleWriteLocations(DatabaseAccount account) { - return account.isEnableMultipleWriteLocations(); + return account.enableMultipleWriteLocations(); } public static boolean getUseMultipleWriteLocations(ConnectionPolicy policy) { @@ -238,7 +246,7 @@ public static Map getRequestHe } public static Map getQueryEngineConfiuration(DatabaseAccount databaseAccount) { - return databaseAccount.getQueryEngineConfiuration(); + return databaseAccount.getQueryEngineConfiguration(); } public static ReplicationPolicy getReplicationPolicy(DatabaseAccount databaseAccount) { @@ -380,7 +388,7 @@ public static void setMapper(JsonSerializable jsonSerializable, ObjectMapper om) public static void setTimestamp(Resource resource, OffsetDateTime date) { resource.timestamp(date); } - + public static CosmosResponseDiagnostics createCosmosResponseDiagnostics() { return new CosmosResponseDiagnostics(); } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/ConnectionMode.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/ConnectionMode.java index 2589b156dee5..5e31532fadf5 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/ConnectionMode.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/ConnectionMode.java @@ -6,7 +6,7 @@ /** * Represents the connection mode to be used by the client in the Azure Cosmos DB database service. *

- * DIRECT and GATEWAY connectivity modes are supported. GATEWAY is the default. + * DIRECT and GATEWAY connectivity modes are supported. DIRECT is the default. * Refer to <see>http://azure.microsoft.com/documentation/articles/documentdb- * interactions-with-resources/#connectivity-options</see> for additional * details. diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/ConnectionPolicy.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/ConnectionPolicy.java index 7e5992482575..328a3453d1b6 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/ConnectionPolicy.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/ConnectionPolicy.java @@ -38,7 +38,7 @@ public final class ConnectionPolicy { * Constructor. */ public ConnectionPolicy() { - this.connectionMode = ConnectionMode.GATEWAY; + this.connectionMode = ConnectionMode.DIRECT; this.enableReadRequestsFallback = null; this.idleConnectionTimeoutInMillis = DEFAULT_IDLE_CONNECTION_TIMEOUT_IN_MILLIS; this.maxPoolSize = DEFAULT_MAX_POOL_SIZE; @@ -62,7 +62,7 @@ public static ConnectionPolicy defaultPolicy() { /** * Gets the request timeout (time to wait for response from network peer) in - * milliseconds. + * milliseconds. * * @return the request timeout in milliseconds. */ diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosBridgeInternal.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosBridgeInternal.java index 4c48a5bd2065..a1725f6dcb98 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosBridgeInternal.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosBridgeInternal.java @@ -4,7 +4,6 @@ package com.azure.data.cosmos; import com.azure.data.cosmos.internal.AsyncDocumentClient; -import com.azure.data.cosmos.internal.DatabaseAccount; import com.azure.data.cosmos.internal.DocumentCollection; import reactor.core.publisher.Mono; @@ -30,7 +29,7 @@ public static CosmosContainer getCosmosContainerWithNewClient(CosmosContainer co } public static Mono getDatabaseAccount(CosmosClient client) { - return client.getDatabaseAccount(); + return client.readDatabaseAccount(); } public static AsyncDocumentClient getContextClient(CosmosDatabase database) { diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClient.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClient.java index cafe847f1b5b..2740ead28186 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClient.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClient.java @@ -5,9 +5,10 @@ import com.azure.data.cosmos.internal.AsyncDocumentClient; import com.azure.data.cosmos.internal.Configs; import com.azure.data.cosmos.internal.Database; -import com.azure.data.cosmos.internal.DatabaseAccount; import com.azure.data.cosmos.internal.HttpConstants; import com.azure.data.cosmos.internal.Permission; +import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdMetrics; +import io.micrometer.core.instrument.MeterRegistry; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -20,7 +21,7 @@ */ public class CosmosClient implements AutoCloseable { - //Document client wrapper + // Async document client wrapper private final Configs configs; private final AsyncDocumentClient asyncDocumentClient; private final String serviceEndpoint; @@ -64,6 +65,14 @@ public static CosmosClientBuilder builder(){ return new CosmosClientBuilder(); } + /** + * Monitor Cosmos client performance and resource utilization using the specified meter registry + * @param registry meter registry to use for performance monitoring + */ + static void monitorTelemetry(MeterRegistry registry) { + RntbdMetrics.add(registry); + } + /** * Get the service endpoint * @return the service endpoint @@ -347,7 +356,7 @@ public Flux> queryDatabases(SqlQuerySpec response.responseHeaders())); } - Mono getDatabaseAccount() { + public Mono readDatabaseAccount() { return asyncDocumentClient.getDatabaseAccount().single(); } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClientException.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClientException.java index 0ee13f2bfa38..cf4c22abae08 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClientException.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/CosmosClientException.java @@ -43,7 +43,7 @@ public class CosmosClientException extends Exception { String resourceAddress; CosmosClientException(int statusCode, String message, Map responseHeaders, Throwable cause) { - super(message, cause, /* enableSuppression */ true, /* writableStackTrace */ false); + super(message, cause); this.statusCode = statusCode; this.responseHeaders = responseHeaders == null ? new HashMap<>() : new HashMap<>(responseHeaders); } @@ -107,7 +107,7 @@ public class CosmosClientException extends Exception { /** * Creates a new instance of the CosmosClientException class. - * + * * @param message the string message. * @param statusCode the http status code of the response. * @param exception the exception object. diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/DatabaseAccount.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/DatabaseAccount.java new file mode 100644 index 000000000000..92f4d3628031 --- /dev/null +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/DatabaseAccount.java @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.data.cosmos; + +import com.azure.data.cosmos.internal.Constants; +import com.azure.data.cosmos.internal.ReplicationPolicy; +import com.azure.data.cosmos.internal.Utils; +import com.fasterxml.jackson.core.type.TypeReference; +import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import static com.azure.data.cosmos.BridgeInternal.populatePropertyBagJsonSerializable; +import static com.azure.data.cosmos.BridgeInternal.setProperty; +import static com.azure.data.cosmos.BridgeInternal.setResourceSelfLink; + +/** + * Represents a database account in the Azure Cosmos DB database service. + */ +public class DatabaseAccount extends Resource { + private ConsistencyPolicy consistencyPolicy; + + private long maxMediaStorageUsageInMB; + private long mediaStorageUsageInMB; + private ReplicationPolicy replicationPolicy; + private ReplicationPolicy systemReplicationPolicy; + private Map queryEngineConfiguration; + + /** + * Constructor. + */ + public DatabaseAccount() { + setResourceSelfLink(this, ""); + } + + /** + * Initialize a database account object from json string. + * + * @param jsonString the json string that represents the database account. + */ + public DatabaseAccount(String jsonString) { + super(jsonString); + } + + /** + * Get the databases link of the databaseAccount. + * + * @return the databases link. + */ + String getDatabasesLink() { + return super.getString(Constants.Properties.DATABASES_LINK); + } + + /** + * Set the databases of the databaseAccount. + * + * @param databasesLink the databases link. + */ + void setDatabasesLink(String databasesLink) { + setProperty(this, Constants.Properties.DATABASES_LINK, databasesLink); + } + + /** + * Get the medialink of the databaseAccount. + * + * @return the media link. + */ + String getMediaLink() { + return super.getString(Constants.Properties.MEDIA_LINK); + } + + /** + * Set the medialink of the databaseAccount. + * + * @param medialink the media link. + */ + void setMediaLink(String medialink) { + setProperty(this, Constants.Properties.MEDIA_LINK, medialink); + } + + /** + * Get the addresseslink of the databaseAccount. + * + * @return the addresses link. + */ + String getAddressesLink() { + return super.getString(Constants.Properties.ADDRESS_LINK); + } + + /** + * Set the addresseslink of the databaseAccount. + * + * @param addresseslink the addresses link. + */ + void setAddressesLink(String addresseslink) { + setProperty(this, Constants.Properties.ADDRESS_LINK, addresseslink); + } + + /** + * Attachment content (media) storage quota in MBs Retrieved from gateway. + * + * @return the max media storage usage in MB. + */ + long getMaxMediaStorageUsageInMB() { + return this.maxMediaStorageUsageInMB; + } + + void setMaxMediaStorageUsageInMB(long value) { + this.maxMediaStorageUsageInMB = value; + } + + /** + * Current attachment content (media) usage in MBs. + *

+ * Retrieved from gateway. Value is returned from cached information updated + * periodically and is not guaranteed to be real time. + * + * @return the media storage usage in MB. + */ + long getMediaStorageUsageInMB() { + return this.mediaStorageUsageInMB; + } + + void setMediaStorageUsageInMB(long value) { + this.mediaStorageUsageInMB = value; + } + + /** + * Gets the ConsistencyPolicy properties. + * + * @return the consistency policy. + */ + ConsistencyPolicy getConsistencyPolicy() { + if (this.consistencyPolicy == null) { + this.consistencyPolicy = super.getObject(Constants.Properties.USER_CONSISTENCY_POLICY, + ConsistencyPolicy.class); + + if (this.consistencyPolicy == null) { + this.consistencyPolicy = new ConsistencyPolicy(); + } + } + return this.consistencyPolicy; + } + + /** + * Gets the ReplicationPolicy properties. + * + * @return the replication policy. + */ + ReplicationPolicy getReplicationPolicy() { + if (this.replicationPolicy == null) { + this.replicationPolicy = super.getObject(Constants.Properties.USER_REPLICATION_POLICY, + ReplicationPolicy.class); + + if (this.replicationPolicy == null) { + this.replicationPolicy = new ReplicationPolicy(); + } + } + + return this.replicationPolicy; + } + + /** + * Gets the SystemReplicationPolicy properties. + * + * @return the system replication policy. + */ + ReplicationPolicy getSystemReplicationPolicy() { + if (this.systemReplicationPolicy == null) { + this.systemReplicationPolicy = super.getObject(Constants.Properties.SYSTEM_REPLICATION_POLICY, + ReplicationPolicy.class); + + if (this.systemReplicationPolicy == null) { + this.systemReplicationPolicy = new ReplicationPolicy(); + } + } + + return this.systemReplicationPolicy; + } + + /** + * Gets the QueryEngineConfiuration properties. + * + * @return the query engine configuration. + */ + Map getQueryEngineConfiguration() { + if (this.queryEngineConfiguration == null) { + String queryEngineConfigurationJsonString = super.getObject(Constants.Properties.QUERY_ENGINE_CONFIGURATION, + String.class); + if (StringUtils.isNotEmpty(queryEngineConfigurationJsonString)) { + TypeReference> typeRef = new TypeReference>() { + }; + try { + this.queryEngineConfiguration = Utils.getSimpleObjectMapper() + .readValue(queryEngineConfigurationJsonString, typeRef); + } catch (IOException e) { + throw new IllegalArgumentException(e); + } + if (this.queryEngineConfiguration == null) { + this.queryEngineConfiguration = new HashMap<>(); + } + } + } + + return this.queryEngineConfiguration; + } + + /** + * Gets the list of writable locations for this database account. + * + * @return the list of writable locations. + */ + public Iterable writableLocations() { + return super.getCollection(Constants.Properties.WRITABLE_LOCATIONS, DatabaseAccountLocation.class); + } + + /** + * Sets the list of writable locations for this database account. + *

+ * The list of writable locations are returned by the service. + * + * @param locations the list of writable locations. + */ + void setWritableLocations(Iterable locations) { + setProperty(this, Constants.Properties.WRITABLE_LOCATIONS, locations); + } + + /** + * Gets the list of readable locations for this database account. + * + * @return the list of readable locations. + */ + public Iterable readableLocations() { + return super.getCollection(Constants.Properties.READABLE_LOCATIONS, DatabaseAccountLocation.class); + } + + /** + * Sets the list of readable locations for this database account. + *

+ * The list of readable locations are returned by the service. + * + * @param locations the list of readable locations. + */ + void setReadableLocations(Iterable locations) { + setProperty(this, Constants.Properties.READABLE_LOCATIONS, locations); + } + + public boolean enableMultipleWriteLocations() { + return ObjectUtils.defaultIfNull(super.getBoolean(Constants.Properties.ENABLE_MULTIPLE_WRITE_LOCATIONS), false); + } + + void setEnableMultipleWriteLocations(boolean value) { + setProperty(this, Constants.Properties.ENABLE_MULTIPLE_WRITE_LOCATIONS, value); + } + + void populatePropertyBag() { + if (this.consistencyPolicy != null) { + populatePropertyBagJsonSerializable(this.consistencyPolicy); + setProperty(this, Constants.Properties.USER_CONSISTENCY_POLICY, this.consistencyPolicy); + } + } + + @Override + public String toJson() { + this.populatePropertyBag(); + return super.toJson(); + } +} diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/DatabaseAccountLocation.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/DatabaseAccountLocation.java new file mode 100644 index 000000000000..449af8cb538f --- /dev/null +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/DatabaseAccountLocation.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.data.cosmos; + +import com.azure.data.cosmos.JsonSerializable; +import com.azure.data.cosmos.internal.Constants; + +import static com.azure.data.cosmos.BridgeInternal.setProperty; + +/** + * Represents the location of a database account in the Azure Cosmos DB database service. + */ +public class DatabaseAccountLocation extends JsonSerializable { + + /** + * DEFAULT Constructor. Creates a new instance of the + * DatabaseAccountLocation object. + */ + public DatabaseAccountLocation() { + super(); + } + + /** + * Creates a new instance of the DatabaseAccountLocation object from a JSON + * string. + * + * @param jsonString the JSON string that represents the DatabaseAccountLocation object. + */ + public DatabaseAccountLocation(String jsonString) { + super(jsonString); + } + + /** + * Gets The name of the database account location. + * + * @return the name of the database account location. + */ + public String name() { + return super.getString(Constants.Properties.Name); + } + + /** + * Sets the name of the database account location. + * + * @param name the name of the database account location. + */ + void setName(String name) { + setProperty(this, Constants.Properties.Name, name); + } + + /** + * Gets The endpoint (the URI) of the database account location. + * + * @return the endpoint of the database account location. + */ + public String endpoint() { + return super.getString(Constants.Properties.DATABASE_ACCOUNT_ENDPOINT); + } + + /** + * Sets the endpoint (the URI) of the database account location. + * + * @param endpoint the endpoint of the database account location. + */ + void setEndpoint(String endpoint) { + setProperty(this, Constants.Properties.DATABASE_ACCOUNT_ENDPOINT, endpoint); + } +} diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/AsyncDocumentClient.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/AsyncDocumentClient.java index 0a0d95eb6c41..b58914e96a98 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/AsyncDocumentClient.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/AsyncDocumentClient.java @@ -6,6 +6,7 @@ import com.azure.data.cosmos.ConnectionPolicy; import com.azure.data.cosmos.ConsistencyLevel; import com.azure.data.cosmos.CosmosKeyCredential; +import com.azure.data.cosmos.DatabaseAccount; import com.azure.data.cosmos.FeedOptions; import com.azure.data.cosmos.FeedResponse; import com.azure.data.cosmos.SqlQuerySpec; diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/BaseDatabaseAccountConfigurationProvider.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/BaseDatabaseAccountConfigurationProvider.java index 01ee68c92dbf..76f62c035250 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/BaseDatabaseAccountConfigurationProvider.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/BaseDatabaseAccountConfigurationProvider.java @@ -3,7 +3,9 @@ package com.azure.data.cosmos.internal; +import com.azure.data.cosmos.BridgeInternal; import com.azure.data.cosmos.ConsistencyLevel; +import com.azure.data.cosmos.DatabaseAccount; /** * Used internally to provides functionality to work with database account configuration in the Azure Cosmos DB database service. @@ -18,7 +20,7 @@ public BaseDatabaseAccountConfigurationProvider(DatabaseAccount databaseAccount, } public ConsistencyLevel getStoreConsistencyPolicy() { - ConsistencyLevel databaseAccountConsistency = this.databaseAccount.getConsistencyPolicy().defaultConsistencyLevel(); + ConsistencyLevel databaseAccountConsistency = BridgeInternal.getConsistencyPolicy(this.databaseAccount).defaultConsistencyLevel(); if (this.desiredConsistencyLevel == null) { return databaseAccountConsistency; } else if (!Utils.isValidConsistency(databaseAccountConsistency, this.desiredConsistencyLevel)) { @@ -32,7 +34,7 @@ public ConsistencyLevel getStoreConsistencyPolicy() { } public int getMaxReplicaSetSize() { - return this.databaseAccount.getReplicationPolicy().getMaxReplicaSetSize(); + return BridgeInternal.getReplicationPolicy(this.databaseAccount).getMaxReplicaSetSize(); } @Override diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/Configs.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/Configs.java index 23a0bc075b90..e747ffa0ed6f 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/Configs.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/Configs.java @@ -12,11 +12,19 @@ import javax.net.ssl.SSLException; +import static com.google.common.base.MoreObjects.firstNonNull; +import static com.google.common.base.Strings.emptyToNull; + public class Configs { private static final Logger logger = LoggerFactory.getLogger(Configs.class); private final SslContext sslContext; - private static final String PROTOCOL = "cosmos.directModeProtocol"; + // The names we use are consistent with the: + // * Azure environment variable naming conventions documented at https://azure.github.io/azure-sdk/java_implementation.html and + // * Java property naming conventions as illustrated by the name/value pairs returned by System.getProperties. + + private static final String PROTOCOL_ENVIRONMENT_VARIABLE = "AZURE_COSMOS_DIRECT_MODE_PROTOCOL"; + private static final String PROTOCOL_PROPERTY = "azure.cosmos.directModeProtocol"; private static final Protocol DEFAULT_PROTOCOL = Protocol.TCP; private static final String UNAVAILABLE_LOCATIONS_EXPIRATION_TIME_IN_SECONDS = "COSMOS.UNAVAILABLE_LOCATIONS_EXPIRATION_TIME_IN_SECONDS"; @@ -68,9 +76,11 @@ public SslContext getSslContext() { } public Protocol getProtocol() { - String protocol = getJVMConfigAsString(PROTOCOL, DEFAULT_PROTOCOL.toString()); + String protocol = System.getProperty(PROTOCOL_PROPERTY, firstNonNull( + emptyToNull(System.getenv().get(PROTOCOL_ENVIRONMENT_VARIABLE)), + DEFAULT_PROTOCOL.name())); try { - return Protocol.valueOf(StringUtils.upperCase(protocol.toLowerCase())); + return Protocol.valueOf(protocol.toUpperCase()); } catch (Exception e) { logger.error("Parsing protocol {} failed. Using the default {}.", protocol, DEFAULT_PROTOCOL, e); return DEFAULT_PROTOCOL; diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/DatabaseAccount.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/DatabaseAccount.java deleted file mode 100644 index 8e96b99b9766..000000000000 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/DatabaseAccount.java +++ /dev/null @@ -1,271 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.data.cosmos.internal; - -import com.azure.data.cosmos.ConsistencyPolicy; -import com.azure.data.cosmos.Resource; -import com.fasterxml.jackson.core.type.TypeReference; -import org.apache.commons.lang3.ObjectUtils; -import org.apache.commons.lang3.StringUtils; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -import static com.azure.data.cosmos.BridgeInternal.setProperty; -import static com.azure.data.cosmos.BridgeInternal.setResourceSelfLink; -import static com.azure.data.cosmos.BridgeInternal.populatePropertyBagJsonSerializable; - -/** - * Represents a database account in the Azure Cosmos DB database service. - */ -public class DatabaseAccount extends Resource { - private ConsistencyPolicy consistencyPolicy; - - private long maxMediaStorageUsageInMB; - private long mediaStorageUsageInMB; - private ReplicationPolicy replicationPolicy; - private ReplicationPolicy systemReplicationPolicy; - private Map queryEngineConfiguration; - - /** - * Constructor. - */ - public DatabaseAccount() { - setResourceSelfLink(this, ""); - } - - /** - * Initialize a database account object from json string. - * - * @param jsonString the json string that represents the database account. - */ - public DatabaseAccount(String jsonString) { - super(jsonString); - } - - /** - * Get the databases link of the databaseAccount. - * - * @return the databases link. - */ - public String getDatabasesLink() { - return super.getString(Constants.Properties.DATABASES_LINK); - } - - /** - * Set the databases of the databaseAccount. - * - * @param databasesLink the databases link. - */ - public void setDatabasesLink(String databasesLink) { - setProperty(this, Constants.Properties.DATABASES_LINK, databasesLink); - } - - /** - * Get the medialink of the databaseAccount. - * - * @return the media link. - */ - public String getMediaLink() { - return super.getString(Constants.Properties.MEDIA_LINK); - } - - /** - * Set the medialink of the databaseAccount. - * - * @param medialink the media link. - */ - public void setMediaLink(String medialink) { - setProperty(this, Constants.Properties.MEDIA_LINK, medialink); - } - - /** - * Get the addresseslink of the databaseAccount. - * - * @return the addresses link. - */ - public String getAddressesLink() { - return super.getString(Constants.Properties.ADDRESS_LINK); - } - - /** - * Set the addresseslink of the databaseAccount. - * - * @param addresseslink the addresses link. - */ - public void setAddressesLink(String addresseslink) { - setProperty(this, Constants.Properties.ADDRESS_LINK, addresseslink); - } - - /** - * Attachment content (media) storage quota in MBs Retrieved from gateway. - * - * @return the max media storage usage in MB. - */ - public long getMaxMediaStorageUsageInMB() { - return this.maxMediaStorageUsageInMB; - } - - public void setMaxMediaStorageUsageInMB(long value) { - this.maxMediaStorageUsageInMB = value; - } - - /** - * Current attachment content (media) usage in MBs. - *

- * Retrieved from gateway. Value is returned from cached information updated - * periodically and is not guaranteed to be real time. - * - * @return the media storage usage in MB. - */ - public long getMediaStorageUsageInMB() { - return this.mediaStorageUsageInMB; - } - - public void setMediaStorageUsageInMB(long value) { - this.mediaStorageUsageInMB = value; - } - - /** - * Gets the ConsistencyPolicy properties. - * - * @return the consistency policy. - */ - public ConsistencyPolicy getConsistencyPolicy() { - if (this.consistencyPolicy == null) { - this.consistencyPolicy = super.getObject(Constants.Properties.USER_CONSISTENCY_POLICY, - ConsistencyPolicy.class); - - if (this.consistencyPolicy == null) { - this.consistencyPolicy = new ConsistencyPolicy(); - } - } - return this.consistencyPolicy; - } - - /** - * Gets the ReplicationPolicy properties. - * - * @return the replication policy. - */ - public ReplicationPolicy getReplicationPolicy() { - if (this.replicationPolicy == null) { - this.replicationPolicy = super.getObject(Constants.Properties.USER_REPLICATION_POLICY, - ReplicationPolicy.class); - - if (this.replicationPolicy == null) { - this.replicationPolicy = new ReplicationPolicy(); - } - } - - return this.replicationPolicy; - } - - /** - * Gets the SystemReplicationPolicy properties. - * - * @return the system replication policy. - */ - public ReplicationPolicy getSystemReplicationPolicy() { - if (this.systemReplicationPolicy == null) { - this.systemReplicationPolicy = super.getObject(Constants.Properties.SYSTEM_REPLICATION_POLICY, - ReplicationPolicy.class); - - if (this.systemReplicationPolicy == null) { - this.systemReplicationPolicy = new ReplicationPolicy(); - } - } - - return this.systemReplicationPolicy; - } - - /** - * Gets the QueryEngineConfiuration properties. - * - * @return the query engine configuration. - */ - public Map getQueryEngineConfiuration() { - if (this.queryEngineConfiguration == null) { - String queryEngineConfigurationJsonString = super.getObject(Constants.Properties.QUERY_ENGINE_CONFIGURATION, - String.class); - if (StringUtils.isNotEmpty(queryEngineConfigurationJsonString)) { - TypeReference> typeRef = new TypeReference>() { - }; - try { - this.queryEngineConfiguration = Utils.getSimpleObjectMapper() - .readValue(queryEngineConfigurationJsonString, typeRef); - } catch (IOException e) { - throw new IllegalArgumentException(e); - } - if (this.queryEngineConfiguration == null) { - this.queryEngineConfiguration = new HashMap<>(); - } - } - } - - return this.queryEngineConfiguration; - } - - /** - * Gets the list of writable locations for this database account. - * - * @return the list of writable locations. - */ - public Iterable getWritableLocations() { - return super.getCollection(Constants.Properties.WRITABLE_LOCATIONS, DatabaseAccountLocation.class); - } - - /** - * Sets the list of writable locations for this database account. - *

- * The list of writable locations are returned by the service. - * - * @param locations the list of writable locations. - */ - public void setWritableLocations(Iterable locations) { - setProperty(this, Constants.Properties.WRITABLE_LOCATIONS, locations); - } - - /** - * Gets the list of readable locations for this database account. - * - * @return the list of readable locations. - */ - public Iterable getReadableLocations() { - return super.getCollection(Constants.Properties.READABLE_LOCATIONS, DatabaseAccountLocation.class); - } - - /** - * Sets the list of readable locations for this database account. - *

- * The list of readable locations are returned by the service. - * - * @param locations the list of readable locations. - */ - public void setReadableLocations(Iterable locations) { - setProperty(this, Constants.Properties.READABLE_LOCATIONS, locations); - } - - public boolean isEnableMultipleWriteLocations() { - return ObjectUtils.defaultIfNull(super.getBoolean(Constants.Properties.ENABLE_MULTIPLE_WRITE_LOCATIONS), false); - } - - public void setEnableMultipleWriteLocations(boolean value) { - setProperty(this, Constants.Properties.ENABLE_MULTIPLE_WRITE_LOCATIONS, value); - } - - public void populatePropertyBag() { - if (this.consistencyPolicy != null) { - populatePropertyBagJsonSerializable(this.consistencyPolicy); - setProperty(this, Constants.Properties.USER_CONSISTENCY_POLICY, this.consistencyPolicy); - } - } - - @Override - public String toJson() { - this.populatePropertyBag(); - return super.toJson(); - } -} diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/DatabaseAccountLocation.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/DatabaseAccountLocation.java deleted file mode 100644 index 592ce5f4ccca..000000000000 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/DatabaseAccountLocation.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.data.cosmos.internal; - -import com.azure.data.cosmos.JsonSerializable; - -import static com.azure.data.cosmos.BridgeInternal.setProperty; - -/** - * Represents the location of a database account in the Azure Cosmos DB database service. - */ -public class DatabaseAccountLocation extends JsonSerializable { - - /** - * DEFAULT Constructor. Creates a new instance of the - * DatabaseAccountLocation object. - */ - public DatabaseAccountLocation() { - super(); - } - - /** - * Creates a new instance of the DatabaseAccountLocation object from a JSON - * string. - * - * @param jsonString the JSON string that represents the DatabaseAccountLocation object. - */ - public DatabaseAccountLocation(String jsonString) { - super(jsonString); - } - - /** - * Gets The name of the database account location. - * - * @return the name of the database account location. - */ - public String getName() { - return super.getString(Constants.Properties.Name); - } - - /** - * Sets the name of the database account location. - * - * @param name the name of the database account location. - */ - public void setName(String name) { - setProperty(this, Constants.Properties.Name, name); - } - - /** - * Gets The endpoint (the URI) of the database account location. - * - * @return the endpoint of the database account location. - */ - public String getEndpoint() { - return super.getString(Constants.Properties.DATABASE_ACCOUNT_ENDPOINT); - } - - /** - * Sets the endpoint (the URI) of the database account location. - * - * @param endpoint the endpoint of the database account location. - */ - public void setEndpoint(String endpoint) { - setProperty(this, Constants.Properties.DATABASE_ACCOUNT_ENDPOINT, endpoint); - } -} diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/DatabaseAccountManagerInternal.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/DatabaseAccountManagerInternal.java index 712c3186f50e..4a6f6ebcf2a3 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/DatabaseAccountManagerInternal.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/DatabaseAccountManagerInternal.java @@ -3,6 +3,7 @@ package com.azure.data.cosmos.internal; import com.azure.data.cosmos.ConnectionPolicy; +import com.azure.data.cosmos.DatabaseAccount; import reactor.core.publisher.Flux; import java.net.URI; diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/GlobalEndpointManager.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/GlobalEndpointManager.java index b00e729dbf0e..22643869cbaa 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/GlobalEndpointManager.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/GlobalEndpointManager.java @@ -5,6 +5,7 @@ import com.azure.data.cosmos.BridgeInternal; import com.azure.data.cosmos.ConnectionPolicy; +import com.azure.data.cosmos.DatabaseAccount; import com.azure.data.cosmos.internal.routing.LocationCache; import com.azure.data.cosmos.internal.routing.LocationHelper; import org.apache.commons.collections4.list.UnmodifiableList; diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/HttpConstants.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/HttpConstants.java index e529c19b9989..8530ba2816e4 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/HttpConstants.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/HttpConstants.java @@ -252,7 +252,7 @@ public static class Versions { // TODO: FIXME we can use maven plugin for generating a version file // @see // https://stackoverflow.com/questions/2469922/generate-a-version-java-file-in-maven - public static final String SDK_VERSION = "3.1.0"; + public static final String SDK_VERSION = "3.2.0"; public static final String SDK_NAME = "cosmosdb-java-sdk"; } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/RxDocumentClientImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/RxDocumentClientImpl.java index b70cc47dfbad..3e0bcc0d1506 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/RxDocumentClientImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/RxDocumentClientImpl.java @@ -10,6 +10,7 @@ import com.azure.data.cosmos.ConsistencyLevel; import com.azure.data.cosmos.CosmosKeyCredential; import com.azure.data.cosmos.CosmosResourceType; +import com.azure.data.cosmos.DatabaseAccount; import com.azure.data.cosmos.FeedOptions; import com.azure.data.cosmos.FeedResponse; import com.azure.data.cosmos.JsonSerializable; diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedObserver.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedObserver.java index 3e76eca2ffd4..39adb35794db 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedObserver.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedObserver.java @@ -3,6 +3,7 @@ package com.azure.data.cosmos.internal.changefeed; import com.azure.data.cosmos.CosmosItemProperties; +import reactor.core.publisher.Mono; import java.util.List; @@ -30,6 +31,7 @@ public interface ChangeFeedObserver { * * @param context the context specifying partition for this observer, etc. * @param docs the documents changed. + * @return a deferred operation of this call. */ - void processChanges(ChangeFeedObserverContext context, List docs); + Mono processChanges(ChangeFeedObserverContext context, List docs); } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionLoadBalancer.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionLoadBalancer.java index 75b81c5a99d9..d34638851d38 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionLoadBalancer.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionLoadBalancer.java @@ -21,4 +21,12 @@ public interface PartitionLoadBalancer { * @return a representation of the deferred computation of this call. */ Mono stop(); + + /** + * Returns true if the instance is running. + * + * @return true if the instance is running. + */ + boolean isRunning(); + } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionManager.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionManager.java index a7833f7df154..be26a4bd050a 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionManager.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionManager.java @@ -21,4 +21,11 @@ public interface PartitionManager { * @return a representation of the deferred computation of this call. */ Mono stop(); + + /** + * Returns true if the instance is running. + * + * @return true if the instance is running. + */ + boolean isRunning(); } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ServiceItemLease.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ServiceItemLease.java index 5da6f441e384..c989c823b5d0 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ServiceItemLease.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ServiceItemLease.java @@ -192,23 +192,37 @@ public String getConcurrencyToken() { } public static ServiceItemLease fromDocument(Document document) { - return new ServiceItemLease() + ServiceItemLease lease = new ServiceItemLease() .withId(document.id()) .withEtag(document.etag()) .withTs(document.getString(Constants.Properties.LAST_MODIFIED)) .withOwner(document.getString("Owner")) .withLeaseToken(document.getString("LeaseToken")) .withContinuationToken(document.getString("ContinuationToken")); + + String leaseTimestamp = document.getString("timestamp"); + if (leaseTimestamp != null) { + return lease.withTimestamp(ZonedDateTime.parse(leaseTimestamp)); + } else { + return lease; + } } public static ServiceItemLease fromDocument(CosmosItemProperties document) { - return new ServiceItemLease() + ServiceItemLease lease = new ServiceItemLease() .withId(document.id()) .withEtag(document.etag()) .withTs(document.getString(Constants.Properties.LAST_MODIFIED)) .withOwner(document.getString("Owner")) .withLeaseToken(document.getString("LeaseToken")) .withContinuationToken(document.getString("ContinuationToken")); + + String leaseTimestamp = document.getString("timestamp"); + if (leaseTimestamp != null) { + return lease.withTimestamp(ZonedDateTime.parse(leaseTimestamp)); + } else { + return lease; + } } @Override diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/ObserverException.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/ObserverException.java index e5ef270984da..7a7784286689 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/ObserverException.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/ObserverException.java @@ -11,9 +11,9 @@ public class ObserverException extends RuntimeException { /** * Initializes a new instance of the {@link ObserverException} class using the specified internal exception. * - * @param originalException {@link Exception} thrown by the user code. + * @param originalException {@link Throwable} thrown by the user code. */ - public ObserverException(Exception originalException) { - super(DefaultMessage, originalException.getCause()); + public ObserverException(Throwable originalException) { + super(DefaultMessage, originalException); } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/AutoCheckpointer.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/AutoCheckpointer.java index 8b35b706ac9f..b064834a1c1b 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/AutoCheckpointer.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/AutoCheckpointer.java @@ -7,6 +7,7 @@ import com.azure.data.cosmos.internal.changefeed.ChangeFeedObserverCloseReason; import com.azure.data.cosmos.internal.changefeed.ChangeFeedObserverContext; import com.azure.data.cosmos.internal.changefeed.CheckpointFrequency; +import reactor.core.publisher.Mono; import java.time.Duration; import java.time.ZoneId; @@ -19,12 +20,17 @@ class AutoCheckpointer implements ChangeFeedObserver { private final CheckpointFrequency checkpointFrequency; private final ChangeFeedObserver observer; - private int processedDocCount; - private ZonedDateTime lastCheckpointTime; + private volatile int processedDocCount; + private volatile ZonedDateTime lastCheckpointTime; public AutoCheckpointer(CheckpointFrequency checkpointFrequency, ChangeFeedObserver observer) { - if (checkpointFrequency == null) throw new IllegalArgumentException("checkpointFrequency"); - if (observer == null) throw new IllegalArgumentException("observer"); + if (checkpointFrequency == null) { + throw new IllegalArgumentException("checkpointFrequency"); + } + + if (observer == null) { + throw new IllegalArgumentException("observer"); + } this.checkpointFrequency = checkpointFrequency; this.observer = observer; @@ -42,15 +48,22 @@ public void close(ChangeFeedObserverContext context, ChangeFeedObserverCloseReas } @Override - public void processChanges(ChangeFeedObserverContext context, List docs) { - this.observer.processChanges(context, docs); + public Mono processChanges(ChangeFeedObserverContext context, List docs) { + return this.observer.processChanges(context, docs) + .then(this.afterProcessChanges(context)); + } + + private Mono afterProcessChanges(ChangeFeedObserverContext context) { this.processedDocCount ++; if (this.isCheckpointNeeded()) { - context.checkpoint().block(); - this.processedDocCount = 0; - this.lastCheckpointTime = ZonedDateTime.now(ZoneId.of("UTC")); + return context.checkpoint() + .doOnSuccess((Void) -> { + this.processedDocCount = 0; + this.lastCheckpointTime = ZonedDateTime.now(ZoneId.of("UTC")); + }); } + return Mono.empty(); } private boolean isCheckpointNeeded() { @@ -64,10 +77,6 @@ private boolean isCheckpointNeeded() { Duration delta = Duration.between(this.lastCheckpointTime, ZonedDateTime.now(ZoneId.of("UTC"))); - if (delta.compareTo(this.checkpointFrequency.getTimeInterval()) >= 0) { - return true; - } - - return false; + return delta.compareTo(this.checkpointFrequency.getTimeInterval()) >= 0; } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/BootstrapperImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/BootstrapperImpl.java index 63dbdcc835ac..ab4b5385d56a 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/BootstrapperImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/BootstrapperImpl.java @@ -21,56 +21,71 @@ class BootstrapperImpl implements Bootstrapper { private final Duration lockTime; private final Duration sleepTime; - public BootstrapperImpl(PartitionSynchronizer synchronizer, LeaseStore leaseStore, Duration lockTime, Duration sleepTime) - { - if (synchronizer == null) throw new IllegalArgumentException("synchronizer"); - if (leaseStore == null) throw new IllegalArgumentException("leaseStore"); - if (lockTime == null || lockTime.isNegative() || lockTime.isZero()) throw new IllegalArgumentException("lockTime should be non-null and positive"); - if (sleepTime == null || sleepTime.isNegative() || sleepTime.isZero()) throw new IllegalArgumentException("sleepTime should be non-null and positive"); + private volatile boolean isInitialized; + private volatile boolean isLockAcquired; + + public BootstrapperImpl(PartitionSynchronizer synchronizer, LeaseStore leaseStore, Duration lockTime, Duration sleepTime) { + if (synchronizer == null) { + throw new IllegalArgumentException("synchronizer"); + } + + if (leaseStore == null) { + throw new IllegalArgumentException("leaseStore"); + } + + if (lockTime == null || lockTime.isNegative() || lockTime.isZero()) { + throw new IllegalArgumentException("lockTime should be non-null and positive"); + } + + if (sleepTime == null || sleepTime.isNegative() || sleepTime.isZero()) { + throw new IllegalArgumentException("sleepTime should be non-null and positive"); + } this.synchronizer = synchronizer; this.leaseStore = leaseStore; this.lockTime = lockTime; this.sleepTime = sleepTime; + + this.isInitialized = false; } @Override public Mono initialize() { - BootstrapperImpl self = this; + this.isInitialized = false; - return Mono.fromRunnable( () -> { - while (true) { - boolean initialized = self.leaseStore.isInitialized().block(); + return Mono.just(this) + .flatMap( value -> this.leaseStore.isInitialized()) + .flatMap(initialized -> { + this.isInitialized = initialized; - if (initialized) break; + if (initialized) { + return Mono.empty(); + } else { + return this.leaseStore.acquireInitializationLock(this.lockTime) + .flatMap(lockAcquired -> { + this.isLockAcquired = lockAcquired; - boolean isLockAcquired = self.leaseStore.acquireInitializationLock(self.lockTime).block(); - - try { - if (!isLockAcquired) { - logger.info("Another instance is initializing the store"); - try { - Thread.sleep(self.sleepTime.toMillis()); - } catch (InterruptedException ex) { - logger.warn("Unexpected exception caught", ex); - } - continue; - } - - logger.info("Initializing the store"); - self.synchronizer.createMissingLeases().block(); - self.leaseStore.markInitialized().block(); - - } catch (RuntimeException ex) { - break; - } finally { - if (isLockAcquired) { - self.leaseStore.releaseInitializationLock().block(); - } + if (!this.isLockAcquired) { + logger.info("Another instance is initializing the store"); + return Mono.just(isLockAcquired).delayElement(this.sleepTime); + } else { + return this.synchronizer.createMissingLeases() + .then(this.leaseStore.markInitialized()); + } + }) + .onErrorResume(throwable -> { + logger.warn("Unexpected exception caught", throwable); + return Mono.just(this.isLockAcquired); + }) + .flatMap(lockAcquired -> { + if (this.isLockAcquired) { + return this.leaseStore.releaseInitializationLock(); + } + return Mono.just(lockAcquired); + }); } - } - - logger.info("The store is initialized"); - }); + }) + .repeat( () -> !this.isInitialized) + .then(); } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedContextClientImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedContextClientImpl.java index 4de1c3a5f98c..0f28122fa5be 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedContextClientImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedContextClientImpl.java @@ -20,6 +20,8 @@ import com.azure.data.cosmos.SqlQuerySpec; import com.azure.data.cosmos.internal.PartitionKeyRange; import com.azure.data.cosmos.internal.changefeed.ChangeFeedContextClient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.core.scheduler.Scheduler; @@ -33,6 +35,8 @@ * Implementation for ChangeFeedDocumentClient. */ public class ChangeFeedContextClientImpl implements ChangeFeedContextClient { + private final Logger logger = LoggerFactory.getLogger(ChangeFeedContextClientImpl.class); + private final AsyncDocumentClient documentClient; private final CosmosContainer cosmosContainer; private Scheduler rxScheduler; @@ -41,8 +45,7 @@ public class ChangeFeedContextClientImpl implements ChangeFeedContextClient { * Initializes a new instance of the {@link ChangeFeedContextClient} interface. * @param cosmosContainer existing client. */ - public ChangeFeedContextClientImpl(CosmosContainer cosmosContainer) - { + public ChangeFeedContextClientImpl(CosmosContainer cosmosContainer) { if (cosmosContainer == null) { throw new IllegalArgumentException("cosmosContainer"); } @@ -57,8 +60,7 @@ public ChangeFeedContextClientImpl(CosmosContainer cosmosContainer) * @param cosmosContainer existing client. * @param rxScheduler the RX Java scheduler to observe on. */ - public ChangeFeedContextClientImpl(CosmosContainer cosmosContainer, Scheduler rxScheduler) - { + public ChangeFeedContextClientImpl(CosmosContainer cosmosContainer, Scheduler rxScheduler) { if (cosmosContainer == null) { throw new IllegalArgumentException("cosmosContainer"); } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedHelper.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedHelper.java index da0b2bf54120..a4280cc3d4fb 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedHelper.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedHelper.java @@ -133,8 +133,7 @@ public static class KeyValuePair implements Map.Entry private K key; private V value; - public KeyValuePair(K key, V value) - { + public KeyValuePair(K key, V value) { this.key = key; this.value = value; } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedObserverContextImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedObserverContextImpl.java index 0166064eb76d..d15d45a486c0 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedObserverContextImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedObserverContextImpl.java @@ -24,8 +24,7 @@ public ChangeFeedObserverContextImpl(String leaseToken) { this.feedResponse = null; } - public ChangeFeedObserverContextImpl(String leaseToken, FeedResponse feedResponse, PartitionCheckpointer checkpointer) - { + public ChangeFeedObserverContextImpl(String leaseToken, FeedResponse feedResponse, PartitionCheckpointer checkpointer) { this.partitionKeyRangeId = leaseToken; this.feedResponse = feedResponse; this.checkpointer = checkpointer; diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedProcessorBuilderImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedProcessorBuilderImpl.java index 52e4df15789f..dfcbaddadcf1 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedProcessorBuilderImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedProcessorBuilderImpl.java @@ -22,13 +22,12 @@ import com.azure.data.cosmos.internal.changefeed.PartitionSupervisorFactory; import com.azure.data.cosmos.internal.changefeed.RequestOptionsFactory; import reactor.core.publisher.Mono; +import reactor.core.scheduler.Scheduler; import reactor.core.scheduler.Schedulers; import java.net.URI; import java.time.Duration; import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; import java.util.function.Consumer; /** @@ -63,16 +62,16 @@ public class ChangeFeedProcessorBuilderImpl implements ChangeFeedProcessor.Build private ChangeFeedContextClient feedContextClient; private ChangeFeedProcessorOptions changeFeedProcessorOptions; private ChangeFeedObserverFactory observerFactory; - private String databaseResourceId; - private String collectionResourceId; + private volatile String databaseResourceId; + private volatile String collectionResourceId; private ChangeFeedContextClient leaseContextClient; private PartitionLoadBalancingStrategy loadBalancingStrategy; private PartitionProcessorFactory partitionProcessorFactory; private LeaseStoreManager leaseStoreManager; private HealthMonitor healthMonitor; - private PartitionManager partitionManager; + private volatile PartitionManager partitionManager; - private ExecutorService executorService; + private Scheduler scheduler; /** * Start listening for changes asynchronously. @@ -81,7 +80,18 @@ public class ChangeFeedProcessorBuilderImpl implements ChangeFeedProcessor.Build */ @Override public Mono start() { - return partitionManager.start(); + if (this.partitionManager == null) { + return this.initializeCollectionPropertiesForBuild() + .flatMap( value -> this.getLeaseStoreManager() + .flatMap(leaseStoreManager -> this.buildPartitionManager(leaseStoreManager))) + .flatMap(partitionManager1 -> { + this.partitionManager = partitionManager1; + return this.partitionManager.start(); + }); + + } else { + return partitionManager.start(); + } } /** @@ -91,7 +101,10 @@ public Mono start() { */ @Override public Mono stop() { - return partitionManager.stop(); + if (this.partitionManager == null || !this.partitionManager.isRunning()) { + throw new IllegalStateException("The ChangeFeedProcessor instance has not fully started"); + } + return this.partitionManager.stop(); } /** @@ -278,29 +291,19 @@ public ChangeFeedProcessorBuilderImpl withHealthMonitor(HealthMonitor healthMoni */ @Override public ChangeFeedProcessor build() { - ChangeFeedProcessorBuilderImpl self = this; - - if (this.hostName == null) - { + if (this.hostName == null) { throw new IllegalArgumentException("Host name was not specified"); } - if (this.observerFactory == null) - { + if (this.observerFactory == null) { throw new IllegalArgumentException("Observer was not specified"); } - if (this.executorService == null) { - this.executorService = Executors.newCachedThreadPool(); + if (this.scheduler == null) { + this.scheduler = Schedulers.elastic(); } - // TBD: Move this initialization code as part of the start() call. - return this.initializeCollectionPropertiesForBuild() - .then(self.getLeaseStoreManager().flatMap(leaseStoreManager -> self.buildPartitionManager(leaseStoreManager))) - .map(partitionManager1 -> { - self.partitionManager = partitionManager1; - return self; - }).block(); + return this; } public ChangeFeedProcessorBuilderImpl() { @@ -312,9 +315,7 @@ public ChangeFeedProcessorBuilderImpl(PartitionManager partitionManager) { this.partitionManager = partitionManager; } - private Mono initializeCollectionPropertiesForBuild() { - ChangeFeedProcessorBuilderImpl self = this; - + private Mono initializeCollectionPropertiesForBuild() { if (this.changeFeedProcessorOptions == null) { this.changeFeedProcessorOptions = new ChangeFeedProcessorOptions(); } @@ -322,21 +323,18 @@ private Mono initializeCollectionPropertiesForBuild() { return this.feedContextClient .readDatabase(this.feedContextClient.getDatabaseClient(), null) .map( databaseResourceResponse -> { - self.databaseResourceId = databaseResourceResponse.database().id(); - return self.databaseResourceId; + this.databaseResourceId = databaseResourceResponse.database().id(); + return this.databaseResourceId; }) - .flatMap( id -> self.feedContextClient - .readContainer(self.feedContextClient.getContainerClient(), null) + .flatMap( id -> this.feedContextClient + .readContainer(this.feedContextClient.getContainerClient(), null) .map(documentCollectionResourceResponse -> { - self.collectionResourceId = documentCollectionResourceResponse.container().id(); - return self.collectionResourceId; - })) - .then(); + this.collectionResourceId = documentCollectionResourceResponse.container().id(); + return this; + })); } private Mono getLeaseStoreManager() { - ChangeFeedProcessorBuilderImpl self = this; - if (this.leaseStoreManager == null) { return this.leaseContextClient.readContainerSettings(this.leaseContextClient.getContainerClient(), null) @@ -352,18 +350,18 @@ private Mono getLeaseStoreManager() { RequestOptionsFactory requestOptionsFactory = new PartitionedByIdCollectionRequestOptionsFactory(); - String leasePrefix = self.getLeasePrefix(); + String leasePrefix = this.getLeasePrefix(); return LeaseStoreManager.Builder() .leasePrefix(leasePrefix) - .leaseCollectionLink(self.leaseContextClient.getContainerClient()) - .leaseContextClient(self.leaseContextClient) + .leaseCollectionLink(this.leaseContextClient.getContainerClient()) + .leaseContextClient(this.leaseContextClient) .requestOptionsFactory(requestOptionsFactory) - .hostName(self.hostName) + .hostName(this.hostName) .build() .map(manager -> { - self.leaseStoreManager = manager; - return self.leaseStoreManager; + this.leaseStoreManager = manager; + return this.leaseStoreManager; }); }); } @@ -389,8 +387,6 @@ private String getLeasePrefix() { } private Mono buildPartitionManager(LeaseStoreManager leaseStoreManager) { - ChangeFeedProcessorBuilderImpl self = this; - CheckpointerObserverFactory factory = new CheckpointerObserverFactory(this.observerFactory, new CheckpointFrequency()); PartitionSynchronizerImpl synchronizer = new PartitionSynchronizerImpl( @@ -412,7 +408,7 @@ private Mono buildPartitionManager(LeaseStoreManager leaseStor leaseStoreManager, this.feedContextClient.getContainerClient()), this.changeFeedProcessorOptions, - executorService + this.scheduler ); if (this.loadBalancingStrategy == null) { @@ -423,7 +419,7 @@ private Mono buildPartitionManager(LeaseStoreManager leaseStor this.changeFeedProcessorOptions.leaseExpirationInterval()); } - PartitionController partitionController = new PartitionControllerImpl(leaseStoreManager, leaseStoreManager, partitionSupervisorFactory, synchronizer, executorService); + PartitionController partitionController = new PartitionControllerImpl(leaseStoreManager, leaseStoreManager, partitionSupervisorFactory, synchronizer, scheduler); if (this.healthMonitor == null) { this.healthMonitor = new TraceHealthMonitor(); @@ -436,7 +432,7 @@ private Mono buildPartitionManager(LeaseStoreManager leaseStor leaseStoreManager, this.loadBalancingStrategy, this.changeFeedProcessorOptions.leaseAcquireInterval(), - this.executorService + this.scheduler ); PartitionManager partitionManager = new PartitionManagerImpl(bootstrapper, partitionController, partitionLoadBalancer); diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/CheckpointerObserverFactory.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/CheckpointerObserverFactory.java index a77ea13957c2..b9912d94a00f 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/CheckpointerObserverFactory.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/CheckpointerObserverFactory.java @@ -19,10 +19,14 @@ class CheckpointerObserverFactory implements ChangeFeedObserverFactory { * @param observerFactory the instance of observer factory. * @param checkpointFrequency the the frequency of lease event. */ - public CheckpointerObserverFactory(ChangeFeedObserverFactory observerFactory, CheckpointFrequency checkpointFrequency) - { - if (observerFactory == null) throw new IllegalArgumentException("observerFactory"); - if (checkpointFrequency == null) throw new IllegalArgumentException("checkpointFrequency"); + public CheckpointerObserverFactory(ChangeFeedObserverFactory observerFactory, CheckpointFrequency checkpointFrequency) { + if (observerFactory == null) { + throw new IllegalArgumentException("observerFactory"); + } + + if (checkpointFrequency == null) { + throw new IllegalArgumentException("checkpointFrequency"); + } this.observerFactory = observerFactory; this.checkpointFrequency = checkpointFrequency; @@ -34,7 +38,9 @@ public CheckpointerObserverFactory(ChangeFeedObserverFactory observerFactory, Ch @Override public ChangeFeedObserver createObserver() { ChangeFeedObserver observer = new ObserverExceptionWrappingChangeFeedObserverDecorator(this.observerFactory.createObserver()); - if (this.checkpointFrequency.isExplicitCheckpoint()) return observer; + if (this.checkpointFrequency.isExplicitCheckpoint()) { + return observer; + } return new AutoCheckpointer(this.checkpointFrequency, observer); } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DefaultObserver.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DefaultObserver.java index 2f26e3813211..cc64f34c94ca 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DefaultObserver.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DefaultObserver.java @@ -8,13 +8,14 @@ import com.azure.data.cosmos.internal.changefeed.ChangeFeedObserverContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import reactor.core.publisher.Mono; import java.util.List; import java.util.function.Consumer; class DefaultObserver implements ChangeFeedObserver { - private final Logger log = LoggerFactory.getLogger(DefaultObserver.class); - private Consumer> consumer; + private static final Logger log = LoggerFactory.getLogger(DefaultObserver.class); + private final Consumer> consumer; public DefaultObserver(Consumer> consumer) { this.consumer = consumer; @@ -31,9 +32,11 @@ public void close(ChangeFeedObserverContext context, ChangeFeedObserverCloseReas } @Override - public void processChanges(ChangeFeedObserverContext context, List docs) { + public Mono processChanges(ChangeFeedObserverContext context, List docs) { log.info("Start processing from thread {}", Thread.currentThread().getId()); consumer.accept(docs); log.info("Done processing from thread {}", Thread.currentThread().getId()); + + return Mono.empty(); } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DocumentServiceLeaseStore.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DocumentServiceLeaseStore.java index 05bfeb29e75c..8e29ae6f4112 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DocumentServiceLeaseStore.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DocumentServiceLeaseStore.java @@ -26,14 +26,14 @@ class DocumentServiceLeaseStore implements LeaseStore { private String containerNamePrefix; private CosmosContainer leaseCollectionLink; private RequestOptionsFactory requestOptionsFactory; - private String lockETag; + private volatile String lockETag; // TODO: rename to LeaseStoreImpl public DocumentServiceLeaseStore( - ChangeFeedContextClient client, - String containerNamePrefix, - CosmosContainer leaseCollectionLink, - RequestOptionsFactory requestOptionsFactory) { + ChangeFeedContextClient client, + String containerNamePrefix, + CosmosContainer leaseCollectionLink, + RequestOptionsFactory requestOptionsFactory) { this.client = client; this.containerNamePrefix = containerNamePrefix; @@ -91,12 +91,10 @@ public Mono acquireInitializationLock(Duration lockExpirationTime) { containerDocument.id(lockId); BridgeInternal.setProperty(containerDocument, com.azure.data.cosmos.internal.Constants.Properties.TTL, Long.valueOf(lockExpirationTime.getSeconds()).intValue()); - DocumentServiceLeaseStore self = this; - return this.client.createItem(this.leaseCollectionLink, containerDocument, null, false) .map(documentResourceResponse -> { if (documentResourceResponse.item() != null) { - self.lockETag = documentResourceResponse.properties().etag(); + this.lockETag = documentResourceResponse.properties().etag(); return true; } else { return false; @@ -130,13 +128,12 @@ public Mono releaseInitializationLock() { accessCondition.type(AccessConditionType.IF_MATCH); accessCondition.condition(this.lockETag); requestOptions.accessCondition(accessCondition); - DocumentServiceLeaseStore self = this; CosmosItem docItem = this.client.getContainerClient().getItem(lockId, "/id"); return this.client.deleteItem(docItem, requestOptions) .map(documentResourceResponse -> { if (documentResourceResponse.item() != null) { - self.lockETag = null; + this.lockETag = null; return true; } else { return false; diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DocumentServiceLeaseUpdaterImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DocumentServiceLeaseUpdaterImpl.java index 104b2c2bfbec..e28c13cbf500 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DocumentServiceLeaseUpdaterImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DocumentServiceLeaseUpdaterImpl.java @@ -15,7 +15,6 @@ import com.azure.data.cosmos.internal.changefeed.exceptions.LeaseLostException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import reactor.core.Exceptions; import reactor.core.publisher.Mono; import java.time.ZoneId; @@ -44,7 +43,6 @@ public DocumentServiceLeaseUpdaterImpl(ChangeFeedContextClient client) { @Override public Mono updateLease(Lease cachedLease, CosmosItem itemLink, CosmosItemRequestOptions requestOptions, Function updateLease) { - DocumentServiceLeaseUpdaterImpl self = this; Lease arrayLease[] = {cachedLease}; arrayLease[0] = updateLease.apply(cachedLease); @@ -54,7 +52,7 @@ public Mono updateLease(Lease cachedLease, CosmosItem itemLink, CosmosIte arrayLease[0].setTimestamp(ZonedDateTime.now(ZoneId.of("UTC"))); - return self.tryReplaceLease(arrayLease[0], itemLink) + return this.tryReplaceLease(arrayLease[0], itemLink) .map(leaseDocument -> { arrayLease[0] = ServiceItemLease.fromDocument(leaseDocument); return arrayLease[0]; @@ -71,7 +69,7 @@ public Mono updateLease(Lease cachedLease, CosmosItem itemLink, CosmosIte CosmosClientException ex = (CosmosClientException) throwable; if (ex.statusCode() == HTTP_STATUS_CODE_NOT_FOUND) { // Partition lease no longer exists - throw Exceptions.propagate(new LeaseLostException(arrayLease[0])); + throw new LeaseLostException(arrayLease[0]); } } return Mono.error(throwable); @@ -87,7 +85,7 @@ public Mono updateLease(Lease cachedLease, CosmosItem itemLink, CosmosIte serverLease.getConcurrencyToken()); arrayLease[0] = serverLease; - throw Exceptions.propagate(new RuntimeException("")); + throw new RuntimeException("Partition update failed"); }); }) .retry(RETRY_COUNT_ON_CONFLICT, throwable -> { @@ -96,57 +94,9 @@ public Mono updateLease(Lease cachedLease, CosmosItem itemLink, CosmosIte } return false; }); - -// Lease lease = cachedLease; -// -// for (int retryCount = RETRY_COUNT_ON_CONFLICT; retryCount > 0; retryCount--) { -// lease = updateLease.apply(lease); -// -// if (lease == null) { -// return Mono.empty(); -// } -// -// lease.setTimestamp(ZonedDateTime.now(ZoneId.of("UTC"))); -// CosmosItemProperties leaseDocument = this.tryReplaceLease(lease, itemLink).block(); -// -// if (leaseDocument != null) { -// return Mono.just(ServiceItemLease.fromDocument(leaseDocument)); -// } -// -// // Partition lease update conflict. Reading the current version of lease. -// CosmosItemProperties document = null; -// try { -// CosmosItemResponse response = this.client.readItem(itemLink, requestOptions) -// .block(); -// document = response.properties(); -// } catch (RuntimeException re) { -// if (re.getCause() instanceof CosmosClientException) { -// CosmosClientException ex = (CosmosClientException) re.getCause(); -// if (ex.statusCode() == HTTP_STATUS_CODE_NOT_FOUND) { -// // Partition lease no longer exists -// throw new LeaseLostException(lease); -// } -// } -// throw re; -// } -// -// ServiceItemLease serverLease = ServiceItemLease.fromDocument(document); -// logger.info( -// "Partition {} update failed because the lease with token '{}' was updated by host '{}' with token '{}'. Will retry, {} retry(s) left.", -// lease.getLeaseToken(), -// lease.getConcurrencyToken(), -// serverLease.getOwner(), -// serverLease.getConcurrencyToken(), -// retryCount); -// -// lease = serverLease; -// } -// -// throw new LeaseLostException(lease); } private Mono tryReplaceLease(Lease lease, CosmosItem itemLink) throws LeaseLostException { - DocumentServiceLeaseUpdaterImpl self = this; return this.client.replaceItem(itemLink, lease, this.getCreateIfMatchOptions(lease)) .map(cosmosItemResponse -> cosmosItemResponse.properties()) .onErrorResume(re -> { @@ -157,10 +107,10 @@ private Mono tryReplaceLease(Lease lease, CosmosItem itemL return Mono.empty(); } case HTTP_STATUS_CODE_CONFLICT: { - throw Exceptions.propagate( new LeaseLostException(lease, ex, false)); + throw new LeaseLostException(lease, ex, false); } case HTTP_STATUS_CODE_NOT_FOUND: { - throw Exceptions.propagate( new LeaseLostException(lease, ex, true)); + throw new LeaseLostException(lease, ex, true); } default: { return Mono.error(re); diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/EqualPartitionsBalancingStrategy.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/EqualPartitionsBalancingStrategy.java index acf7c0adaf5e..1996e2f00c54 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/EqualPartitionsBalancingStrategy.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/EqualPartitionsBalancingStrategy.java @@ -26,7 +26,10 @@ class EqualPartitionsBalancingStrategy implements PartitionLoadBalancingStrategy private final Duration leaseExpirationInterval; public EqualPartitionsBalancingStrategy(String hostName, int minPartitionCount, int maxPartitionCount, Duration leaseExpirationInterval) { - if (hostName == null) throw new IllegalArgumentException("hostName"); + if (hostName == null) { + throw new IllegalArgumentException("hostName"); + } + this.hostName = hostName; this.minPartitionCount = minPartitionCount; this.maxPartitionCount = maxPartitionCount; @@ -43,8 +46,10 @@ public List selectLeasesToTake(List allLeases) { int partitionCount = allPartitions.size(); int workerCount = workerToPartitionCount.size(); - if (partitionCount <= 0) + + if (partitionCount <= 0) { return new ArrayList(); + } int target = this.calculateTargetPartitionCount(partitionCount, workerCount); int myCount = workerToPartitionCount.get(this.hostName); @@ -102,6 +107,7 @@ private static Lease getLeaseToSteal( private static Map.Entry findWorkerWithMostPartitions(Map workerToPartitionCount) { Map.Entry workerToStealFrom = new ChangeFeedHelper.KeyValuePair<>("", 0); + for (Map.Entry entry : workerToPartitionCount.entrySet()) { if (workerToStealFrom.getValue() <= entry.getValue()) { workerToStealFrom = entry; @@ -113,6 +119,7 @@ private static Map.Entry findWorkerWithMostPartitions(Map workerCount) { target = (int)Math.ceil((double)partitionCount / workerCount); } @@ -140,7 +147,7 @@ private void categorizeLeases( allPartitions.put(lease.getLeaseToken(), lease); if (lease.getOwner() == null || lease.getOwner().isEmpty() || this.isExpired(lease)) { - // Logger.DebugFormat("Found unused or expired lease: {0}", lease); + this.logger.info("Found unused or expired lease {}", lease.getLeaseToken()); expiredLeases.add(lease); } else { String assignedTo = lease.getOwner(); @@ -163,7 +170,10 @@ private boolean isExpired(Lease lease) { if (lease.getOwner() == null || lease.getOwner().isEmpty() || lease.getTimestamp() == null) { return true; } - ZonedDateTime time = ZonedDateTime.parse(lease.getTimestamp()); - return time.plus(this.leaseExpirationInterval).isBefore(ZonedDateTime.now(ZoneId.of("UTC"))); + + + ZonedDateTime leaseExpireTime = ZonedDateTime.parse(lease.getTimestamp()).plus(this.leaseExpirationInterval); + this.logger.debug("Current lease timestamp: {}, current time: {}", leaseExpireTime, ZonedDateTime.now(ZoneId.of("UTC"))); + return leaseExpireTime.isBefore(ZonedDateTime.now(ZoneId.of("UTC"))); } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ExceptionClassifier.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ExceptionClassifier.java index c70552c429d6..cdf19f79d55d 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ExceptionClassifier.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ExceptionClassifier.java @@ -23,20 +23,23 @@ class ExceptionClassifier { public static StatusCodeErrorType classifyClientException(CosmosClientException clientException) { Integer subStatusCode = clientException.subStatusCode(); - if (clientException.statusCode() == ChangeFeedHelper.HTTP_STATUS_CODE_NOT_FOUND && subStatusCode != SubStatusCode_ReadSessionNotAvailable) + if (clientException.statusCode() == ChangeFeedHelper.HTTP_STATUS_CODE_NOT_FOUND && subStatusCode != SubStatusCode_ReadSessionNotAvailable) { return StatusCodeErrorType.PARTITION_NOT_FOUND; + } - if (clientException.statusCode() == ChangeFeedHelper.HTTP_STATUS_CODE_GONE && (subStatusCode == SubStatusCode_PartitionKeyRangeGone || subStatusCode == SubStatusCode_Splitting)) + if (clientException.statusCode() == ChangeFeedHelper.HTTP_STATUS_CODE_GONE && (subStatusCode == SubStatusCode_PartitionKeyRangeGone || subStatusCode == SubStatusCode_Splitting)) { return StatusCodeErrorType.PARTITION_SPLIT; + } - if (clientException.statusCode() == ChangeFeedHelper.HTTP_STATUS_CODE_TOO_MANY_REQUESTS || clientException.statusCode() >= ChangeFeedHelper.HTTP_STATUS_CODE_INTERNAL_SERVER_ERROR) + if (clientException.statusCode() == ChangeFeedHelper.HTTP_STATUS_CODE_TOO_MANY_REQUESTS || clientException.statusCode() >= ChangeFeedHelper.HTTP_STATUS_CODE_INTERNAL_SERVER_ERROR) { return StatusCodeErrorType.TRANSIENT_ERROR; + } // Temporary workaround to compare exception message, until server provides better way of handling this case. - if (clientException.getMessage().contains("Reduce page size and try again.")) + if (clientException.getMessage().contains("Reduce page size and try again.")) { return StatusCodeErrorType.MAX_ITEM_COUNT_TOO_LARGE; + } return StatusCodeErrorType.UNDEFINED; - } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/HealthMonitoringPartitionControllerDecorator.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/HealthMonitoringPartitionControllerDecorator.java index 8a40ed04a439..185558f97556 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/HealthMonitoringPartitionControllerDecorator.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/HealthMonitoringPartitionControllerDecorator.java @@ -17,8 +17,13 @@ class HealthMonitoringPartitionControllerDecorator implements PartitionControlle private final HealthMonitor monitor; public HealthMonitoringPartitionControllerDecorator(PartitionController inner, HealthMonitor monitor) { - if (inner == null) throw new IllegalArgumentException("inner"); - if (monitor == null) throw new IllegalArgumentException("monitor"); + if (inner == null) { + throw new IllegalArgumentException("inner"); + } + + if (monitor == null) { + throw new IllegalArgumentException("monitor"); + } this.inner = inner; this.monitor = monitor; diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/LeaseRenewerImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/LeaseRenewerImpl.java index 62a3bbdb6bc4..cf466b109d03 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/LeaseRenewerImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/LeaseRenewerImpl.java @@ -12,19 +12,19 @@ import reactor.core.publisher.Mono; import java.time.Duration; +import java.time.ZonedDateTime; /** * Implementation for the {@link LeaseRenewer}. */ class LeaseRenewerImpl implements LeaseRenewer { - private final Logger logger = LoggerFactory.getLogger(LeaseRenewerImpl.class); + private static final Logger logger = LoggerFactory.getLogger(LeaseRenewerImpl.class); private final LeaseManager leaseManager; private final Duration leaseRenewInterval; private Lease lease; private RuntimeException resultException; - public LeaseRenewerImpl(Lease lease, LeaseManager leaseManager, Duration leaseRenewInterval) - { + public LeaseRenewerImpl(Lease lease, LeaseManager leaseManager, Duration leaseRenewInterval) { this.lease = lease; this.leaseManager = leaseManager; this.leaseRenewInterval = leaseRenewInterval; @@ -32,44 +32,40 @@ public LeaseRenewerImpl(Lease lease, LeaseManager leaseManager, Duration leaseRe @Override public Mono run(CancellationToken cancellationToken) { - LeaseRenewerImpl self = this; + logger.info("Partition {}: renewer task started.", this.lease.getLeaseToken()); - return Mono.fromRunnable( () -> { - try { - logger.info(String.format("Partition %s: renewer task started.", self.lease.getLeaseToken())); - long remainingWork = this.leaseRenewInterval.toMillis() / 2; - - try { - while (!cancellationToken.isCancellationRequested() && remainingWork > 0) { - Thread.sleep(100); - remainingWork -= 100; - } - } catch (InterruptedException ex) { - // exception caught - logger.info(String.format("Partition %s: renewer task stopped.", self.lease.getLeaseToken())); + return Mono.just(this) + .flatMap(value -> { + if (cancellationToken.isCancellationRequested()) { + return Mono.empty(); } - while (!cancellationToken.isCancellationRequested()) { - self.renew().block(); - - remainingWork = this.leaseRenewInterval.toMillis(); - - try { - while (!cancellationToken.isCancellationRequested() && remainingWork > 0) { - Thread.sleep(100); - remainingWork -= 100; - } - } catch (InterruptedException ex) { - // exception caught - logger.info(String.format("Partition %s: renewer task stopped.", self.lease.getLeaseToken())); - break; - } + ZonedDateTime stopTimer = ZonedDateTime.now().plus(this.leaseRenewInterval); + return Mono.just(value) + .delayElement(Duration.ofMillis(100)) + .repeat( () -> { + ZonedDateTime currentTime = ZonedDateTime.now(); + return !cancellationToken.isCancellationRequested() && currentTime.isBefore(stopTimer); + }).last(); + }) + .flatMap(value -> { + if (cancellationToken.isCancellationRequested()) { + return Mono.empty(); + } + return this.renew(cancellationToken); + }) + .repeat(() -> { + if (cancellationToken.isCancellationRequested()) { + logger.info("Partition {}: renewer task stopped.", this.lease.getLeaseToken()); } - } catch (RuntimeException ex) { - logger.error(String.format("Partition %s: renew lease loop failed.", self.lease.getLeaseToken()), ex); - self.resultException = ex; - } - }); + + return !cancellationToken.isCancellationRequested(); + }) + .then() + .onErrorResume(throwable -> { + logger.error("Partition {}: renew lease loop failed.", this.lease.getLeaseToken(), throwable); + return Mono.error(throwable); + }); } @Override @@ -77,23 +73,30 @@ public RuntimeException getResultException() { return this.resultException; } - private Mono renew() { - LeaseRenewerImpl self = this; + private Mono renew(CancellationToken cancellationToken) { + if (cancellationToken.isCancellationRequested()) { + return Mono.empty(); + } - return Mono.fromRunnable( () -> { - try { - Lease renewedLease = self.leaseManager.renew(this.lease).block(); - if (renewedLease != null) this.lease = renewedLease; + return this.leaseManager.renew(this.lease) + .map(renewedLease -> { + if (renewedLease != null) { + this.lease = renewedLease; + } + logger.info("Partition {}: renewed lease with result {}", this.lease.getLeaseToken(), renewedLease != null); + return renewedLease; + }) + .onErrorResume(throwable -> { + if (throwable instanceof LeaseLostException) { + LeaseLostException lle = (LeaseLostException) throwable; + this.resultException = lle; + logger.error("Partition {}: lost lease on renew.", this.lease.getLeaseToken(), lle); + return Mono.error(lle); + } - logger.info(String.format("Partition %s: renewed lease with result %s", self.lease.getLeaseToken(), renewedLease != null)); - } catch (LeaseLostException leaseLostException) { - logger.error(String.format("Partition %s: lost lease on renew.", self.lease.getLeaseToken()), leaseLostException); - self.resultException = leaseLostException; - throw leaseLostException; - } catch (Exception ex) { - logger.error(String.format("Partition %s: failed to renew lease.", self.lease.getLeaseToken()), ex); - } - }); + logger.error("Partition {}: failed to renew lease.", this.lease.getLeaseToken(), throwable); + return Mono.empty(); + }); } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/LeaseStoreManagerImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/LeaseStoreManagerImpl.java index 993f220205de..af6ae3dccd67 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/LeaseStoreManagerImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/LeaseStoreManagerImpl.java @@ -21,7 +21,6 @@ import com.azure.data.cosmos.internal.changefeed.exceptions.LeaseLostException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import reactor.core.Exceptions; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -32,6 +31,7 @@ * For the actual creation of lease manager instance, delegates to lease manager factory. */ public class LeaseStoreManagerImpl implements LeaseStoreManager, LeaseStoreManager.LeaseStoreManagerBuilderDefinition { + private final String LEASE_STORE_MANAGER_LEASE_SUFFIX = ".."; private final Logger logger = LoggerFactory.getLogger(LeaseStoreManagerImpl.class); private LeaseStoreManagerSettings settings; @@ -101,12 +101,30 @@ public LeaseStoreManagerBuilderDefinition hostName(String hostName) { @Override public Mono build() { - if (this.settings == null) throw new IllegalArgumentException("properties"); - if (this.settings.getContainerNamePrefix() == null) throw new IllegalArgumentException("properties.containerNamePrefix"); - if (this.settings.getLeaseCollectionLink() == null) throw new IllegalArgumentException("properties.leaseCollectionLink"); - if (this.settings.getHostName() == null || this.settings.getHostName().isEmpty()) throw new IllegalArgumentException("properties.hostName"); - if (this.leaseDocumentClient == null) throw new IllegalArgumentException("leaseDocumentClient"); - if (this.requestOptionsFactory == null) throw new IllegalArgumentException("requestOptionsFactory"); + if (this.settings == null) { + throw new IllegalArgumentException("properties"); + } + + if (this.settings.getContainerNamePrefix() == null) { + throw new IllegalArgumentException("properties.containerNamePrefix"); + } + + if (this.settings.getLeaseCollectionLink() == null) { + throw new IllegalArgumentException("properties.leaseCollectionLink"); + } + + if (this.settings.getHostName() == null || this.settings.getHostName().isEmpty()) { + throw new IllegalArgumentException("properties.hostName"); + } + + if (this.leaseDocumentClient == null) { + throw new IllegalArgumentException("leaseDocumentClient"); + } + + if (this.requestOptionsFactory == null) { + throw new IllegalArgumentException("requestOptionsFactory"); + } + if (this.leaseUpdater == null) { this.leaseUpdater = new DocumentServiceLeaseUpdaterImpl(leaseDocumentClient); } @@ -117,13 +135,15 @@ public Mono build() { this.settings.getLeaseCollectionLink(), this.requestOptionsFactory); - LeaseStoreManagerImpl self = this; - if (this.settings.getLeaseCollectionLink() == null) + if (this.settings.getLeaseCollectionLink() == null) { throw new IllegalArgumentException("leaseCollectionLink was not specified"); - if (this.requestOptionsFactory == null) + } + + if (this.requestOptionsFactory == null) { throw new IllegalArgumentException("requestOptionsFactory was not specified"); + } - return Mono.just(self); + return Mono.just(this); } @Override @@ -134,14 +154,15 @@ public Flux getAllLeases() { @Override public Flux getOwnedLeases() { - LeaseStoreManagerImpl self = this; return this.getAllLeases() - .filter(lease -> lease.getOwner() != null && lease.getOwner().equalsIgnoreCase(self.settings.getHostName())); + .filter(lease -> lease.getOwner() != null && lease.getOwner().equalsIgnoreCase(this.settings.getHostName())); } @Override public Mono createLeaseIfNotExist(String leaseToken, String continuationToken) { - if (leaseToken == null) throw new IllegalArgumentException("leaseToken"); + if (leaseToken == null) { + throw new IllegalArgumentException("leaseToken"); + } String leaseDocId = this.getDocumentId(leaseToken); ServiceItemLease documentServiceLease = new ServiceItemLease() @@ -162,7 +183,9 @@ public Mono createLeaseIfNotExist(String leaseToken, String continuationT return Mono.error(ex); }) .map(documentResourceResponse -> { - if (documentResourceResponse == null) return null; + if (documentResourceResponse == null) { + return null; + } CosmosItemProperties document = documentResourceResponse.properties(); @@ -177,7 +200,9 @@ public Mono createLeaseIfNotExist(String leaseToken, String continuationT @Override public Mono delete(Lease lease) { - if (lease == null || lease.getId() == null) throw Exceptions.propagate(new IllegalArgumentException("lease")); + if (lease == null || lease.getId() == null) { + throw new IllegalArgumentException("lease"); + } CosmosItem itemForLease = this.createItemForLease(lease.getId()); @@ -201,7 +226,9 @@ public Mono delete(Lease lease) { @Override public Mono acquire(Lease lease) { - if (lease == null) throw Exceptions.propagate(new IllegalArgumentException("lease")); + if (lease == null) { + throw new IllegalArgumentException("lease"); + } String oldOwner = lease.getOwner(); @@ -212,7 +239,7 @@ public Mono acquire(Lease lease) { serverLease -> { if (serverLease.getOwner() != null && !serverLease.getOwner().equalsIgnoreCase(oldOwner)) { logger.info("Partition {} lease was taken over by owner '{}'", lease.getLeaseToken(), serverLease.getOwner()); - throw Exceptions.propagate(new LeaseLostException(lease)); + throw new LeaseLostException(lease); } serverLease.setOwner(this.settings.getHostName()); serverLease.setProperties(lease.getProperties()); @@ -223,10 +250,11 @@ public Mono acquire(Lease lease) { @Override public Mono release(Lease lease) { - if (lease == null) throw Exceptions.propagate(new IllegalArgumentException("lease")); + if (lease == null) { + throw new IllegalArgumentException("lease"); + } CosmosItem itemForLease = this.createItemForLease(lease.getId()); - LeaseStoreManagerImpl self = this; return this.leaseDocumentClient.readItem(itemForLease, this.requestOptionsFactory.createRequestOptions(lease)) .onErrorResume( ex -> { @@ -234,23 +262,23 @@ public Mono release(Lease lease) { CosmosClientException e = (CosmosClientException) ex; if (e.statusCode() == ChangeFeedHelper.HTTP_STATUS_CODE_NOT_FOUND) { logger.info("Partition {} failed to renew lease. The lease is gone already.", lease.getLeaseToken()); - throw Exceptions.propagate(new LeaseLostException(lease)); + throw new LeaseLostException(lease); } } return Mono.error(ex); }) .map( documentResourceResponse -> ServiceItemLease.fromDocument(documentResourceResponse.properties())) - .flatMap( refreshedLease -> self.leaseUpdater.updateLease( + .flatMap( refreshedLease -> this.leaseUpdater.updateLease( refreshedLease, - self.createItemForLease(refreshedLease.getId()), - self.requestOptionsFactory.createRequestOptions(lease), + this.createItemForLease(refreshedLease.getId()), + this.requestOptionsFactory.createRequestOptions(lease), serverLease -> { if (serverLease.getOwner() != null) { if (!serverLease.getOwner().equalsIgnoreCase(lease.getOwner())) { logger.info("Partition {} no need to release lease. The lease was already taken by another host '{}'.", lease.getLeaseToken(), serverLease.getOwner()); - throw Exceptions.propagate(new LeaseLostException(lease)); + throw new LeaseLostException(lease); } } @@ -263,12 +291,13 @@ public Mono release(Lease lease) { @Override public Mono renew(Lease lease) { - if (lease == null) throw Exceptions.propagate(new IllegalArgumentException("lease")); + if (lease == null) { + throw new IllegalArgumentException("lease"); + } // Get fresh lease. The assumption here is that check-pointing is done with higher frequency than lease renewal so almost // certainly the lease was updated in between. CosmosItem itemForLease = this.createItemForLease(lease.getId()); - LeaseStoreManagerImpl self = this; return this.leaseDocumentClient.readItem(itemForLease, this.requestOptionsFactory.createRequestOptions(lease)) .onErrorResume( ex -> { @@ -276,22 +305,22 @@ public Mono renew(Lease lease) { CosmosClientException e = (CosmosClientException) ex; if (e.statusCode() == ChangeFeedHelper.HTTP_STATUS_CODE_NOT_FOUND) { logger.info("Partition {} failed to renew lease. The lease is gone already.", lease.getLeaseToken()); - throw Exceptions.propagate(new LeaseLostException(lease)); + throw new LeaseLostException(lease); } } return Mono.error(ex); }) .map( documentResourceResponse -> ServiceItemLease.fromDocument(documentResourceResponse.properties())) - .flatMap( refreshedLease -> self.leaseUpdater.updateLease( + .flatMap( refreshedLease -> this.leaseUpdater.updateLease( refreshedLease, - self.createItemForLease(refreshedLease.getId()), - self.requestOptionsFactory.createRequestOptions(lease), + this.createItemForLease(refreshedLease.getId()), + this.requestOptionsFactory.createRequestOptions(lease), serverLease -> { if (!serverLease.getOwner().equalsIgnoreCase(lease.getOwner())) { logger.info("Partition {} lease was taken over by owner '{}'", lease.getLeaseToken(), serverLease.getOwner()); - throw Exceptions.propagate(new LeaseLostException(lease)); + throw new LeaseLostException(lease); } return serverLease; @@ -301,10 +330,11 @@ public Mono renew(Lease lease) { @Override public Mono updateProperties(Lease lease) { - if (lease == null) throw Exceptions.propagate(new IllegalArgumentException("lease")); + if (lease == null) { + throw new IllegalArgumentException("lease"); + } - if (!lease.getOwner().equalsIgnoreCase(this.settings.getHostName())) - { + if (!lease.getOwner().equalsIgnoreCase(this.settings.getHostName())) { logger.info("Partition '{}' lease was taken over by owner '{}' before lease item update", lease.getLeaseToken(), lease.getOwner()); throw new LeaseLostException(lease); } @@ -316,7 +346,7 @@ public Mono updateProperties(Lease lease) { serverLease -> { if (!serverLease.getOwner().equalsIgnoreCase(lease.getOwner())) { logger.info("Partition '{}' lease was taken over by owner '{}'", lease.getLeaseToken(), serverLease.getOwner()); - throw Exceptions.propagate(new LeaseLostException(lease)); + throw new LeaseLostException(lease); } serverLease.setProperties(lease.getProperties()); return serverLease; @@ -325,7 +355,9 @@ public Mono updateProperties(Lease lease) { @Override public Mono checkpoint(Lease lease, String continuationToken) { - if (lease == null) throw Exceptions.propagate(new IllegalArgumentException("lease")); + if (lease == null) { + throw new IllegalArgumentException("lease"); + } if (continuationToken == null || continuationToken.isEmpty()) { throw new IllegalArgumentException("continuationToken must be a non-empty string"); @@ -338,7 +370,7 @@ public Mono checkpoint(Lease lease, String continuationToken) { serverLease -> { if (serverLease.getOwner() != null && !serverLease.getOwner().equalsIgnoreCase(lease.getOwner())) { logger.info("Partition {} lease was taken over by owner '{}'", lease.getLeaseToken(), serverLease.getOwner()); - throw Exceptions.propagate(new LeaseLostException(lease)); + throw new LeaseLostException(lease); } serverLease.setContinuationToken(continuationToken); @@ -404,7 +436,7 @@ private Flux listDocuments(String prefix) { this.requestOptionsFactory.createFeedOptions()); return query.flatMap( documentFeedResponse -> Flux.fromIterable(documentFeedResponse.results())) - .map( ServiceItemLease::fromDocument); + .map(ServiceItemLease::fromDocument); } private String getDocumentId(String leaseToken) @@ -412,9 +444,8 @@ private String getDocumentId(String leaseToken) return this.getPartitionLeasePrefix() + leaseToken; } - private String getPartitionLeasePrefix() - { - return this.settings.getContainerNamePrefix() + ".."; + private String getPartitionLeasePrefix() { + return this.settings.getContainerNamePrefix() + LEASE_STORE_MANAGER_LEASE_SUFFIX; } private CosmosItem createItemForLease(String leaseId) { diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ObserverExceptionWrappingChangeFeedObserverDecorator.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ObserverExceptionWrappingChangeFeedObserverDecorator.java index 75a2781dc680..301c5230df7d 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ObserverExceptionWrappingChangeFeedObserverDecorator.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ObserverExceptionWrappingChangeFeedObserverDecorator.java @@ -7,6 +7,9 @@ import com.azure.data.cosmos.internal.changefeed.ChangeFeedObserverCloseReason; import com.azure.data.cosmos.internal.changefeed.ChangeFeedObserverContext; import com.azure.data.cosmos.internal.changefeed.exceptions.ObserverException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import reactor.core.publisher.Mono; import java.util.List; @@ -14,49 +17,44 @@ * Exception wrapping decorator implementation for {@link ChangeFeedObserver}. */ class ObserverExceptionWrappingChangeFeedObserverDecorator implements ChangeFeedObserver { + private final Logger logger = LoggerFactory.getLogger(ObserverExceptionWrappingChangeFeedObserverDecorator.class); + private ChangeFeedObserver changeFeedObserver; - public ObserverExceptionWrappingChangeFeedObserverDecorator(ChangeFeedObserver changeFeedObserver) - { + public ObserverExceptionWrappingChangeFeedObserverDecorator(ChangeFeedObserver changeFeedObserver) { this.changeFeedObserver = changeFeedObserver; } @Override public void open(ChangeFeedObserverContext context) { - try - { + try { this.changeFeedObserver.open(context); } catch (RuntimeException userException) { - // Logger.WarnException("Exception happened on Observer.OpenAsync", userException); + this.logger.warn("Exception happened on ChangeFeedObserver.open", userException); throw new ObserverException(userException); } } @Override public void close(ChangeFeedObserverContext context, ChangeFeedObserverCloseReason reason) { - try - { + try { this.changeFeedObserver.close(context, reason); } catch (RuntimeException userException) { - // Logger.WarnException("Exception happened on Observer.CloseAsync", userException); + this.logger.warn("Exception happened on ChangeFeedObserver.close", userException); throw new ObserverException(userException); } } @Override - public void processChanges(ChangeFeedObserverContext context, List docs) { - try - { - this.changeFeedObserver.processChanges(context, docs); - } - catch (Exception userException) - { - // Logger.WarnException("Exception happened on Observer.OpenAsync", userException); - throw new ObserverException(userException); - } + public Mono processChanges(ChangeFeedObserverContext context, List docs) { + return this.changeFeedObserver.processChanges(context, docs) + .onErrorResume(throwable -> { + this.logger.warn("Exception happened on ChangeFeedObserver.processChanges", throwable); + return Mono.error(new ObserverException(throwable)); + }); } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionCheckpointerImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionCheckpointerImpl.java index 1aaa8fcd7ad0..894f7c17e1d1 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionCheckpointerImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionCheckpointerImpl.java @@ -24,11 +24,10 @@ public PartitionCheckpointerImpl(LeaseCheckpointer leaseCheckpointer, Lease leas @Override public Mono checkpointPartition(String сontinuationToken) { - PartitionCheckpointerImpl self = this; return this.leaseCheckpointer.checkpoint(this.lease, сontinuationToken) .map(lease1 -> { - self.lease = lease1; - logger.info(String.format("Checkpoint: partition %s, new continuation %s", self.lease.getLeaseToken(), self.lease.getContinuationToken())); + this.lease = lease1; + logger.info("Checkpoint: partition {}, new continuation {}", this.lease.getLeaseToken(), this.lease.getContinuationToken()); return lease1; }) .then(); diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionControllerImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionControllerImpl.java index 4d346471a80d..3a3ff5708f26 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionControllerImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionControllerImpl.java @@ -16,16 +16,16 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import reactor.core.publisher.Mono; +import reactor.core.scheduler.Scheduler; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ExecutorService; /** * Implementation for {@link PartitionController}. */ class PartitionControllerImpl implements PartitionController { - private final Logger logger = LoggerFactory.getLogger(PartitionControllerImpl.class); + private static final Logger logger = LoggerFactory.getLogger(PartitionControllerImpl.class); private final Map currentlyOwnedPartitions = new ConcurrentHashMap<>(); private final LeaseContainer leaseContainer; @@ -34,20 +34,20 @@ class PartitionControllerImpl implements PartitionController { private final PartitionSynchronizer synchronizer; private CancellationTokenSource shutdownCts; - private final ExecutorService executorService; + private final Scheduler scheduler; public PartitionControllerImpl( - LeaseContainer leaseContainer, - LeaseManager leaseManager, - PartitionSupervisorFactory partitionSupervisorFactory, - PartitionSynchronizer synchronizer, - ExecutorService executorService) { + LeaseContainer leaseContainer, + LeaseManager leaseManager, + PartitionSupervisorFactory partitionSupervisorFactory, + PartitionSynchronizer synchronizer, + Scheduler scheduler) { this.leaseContainer = leaseContainer; this.leaseManager = leaseManager; this.partitionSupervisorFactory = partitionSupervisorFactory; this.synchronizer = synchronizer; - this.executorService = executorService; + this.scheduler = scheduler; } @Override @@ -57,28 +57,25 @@ public Mono initialize() { } @Override - public synchronized Mono addOrUpdateLease(Lease lease) { + public synchronized Mono addOrUpdateLease(final Lease lease) { WorkerTask workerTask = this.currentlyOwnedPartitions.get(lease.getLeaseToken()); if ( workerTask != null && workerTask.isRunning()) { - Lease updatedLease = this.leaseManager.updateProperties(lease).block(); - logger.debug(String.format("Partition %s: updated.", lease.getLeaseToken())); - return Mono.just(updatedLease); - } - - try { - Lease updatedLease = this.leaseManager.acquire(lease).block(); - if (updatedLease != null) lease = updatedLease; - - logger.info(String.format("Partition %s: acquired.", lease.getLeaseToken())); - } catch (RuntimeException ex) { - this.removeLease(lease).block(); - throw ex; + return this.leaseManager.updateProperties(lease) + .map(updatedLease -> { + logger.debug("Partition {}: updated.", updatedLease.getLeaseToken()); + return updatedLease; + }); } - PartitionSupervisor supervisor = this.partitionSupervisorFactory.create(lease); - this.currentlyOwnedPartitions.put(lease.getLeaseToken(), this.processPartition(supervisor, lease)); - - return Mono.just(lease); + return this.leaseManager.acquire(lease) + .defaultIfEmpty(lease) + .map(updatedLease -> { + logger.info("Partition {}: acquired.", updatedLease.getLeaseToken()); + PartitionSupervisor supervisor = this.partitionSupervisorFactory.create(updatedLease); + this.currentlyOwnedPartitions.put(updatedLease.getLeaseToken(), this.processPartition(supervisor, updatedLease)); + return updatedLease; + }) + .onErrorResume(throwable -> this.removeLease(lease).then(Mono.error(throwable))); } @Override @@ -91,13 +88,12 @@ public Mono shutdown() { } private Mono loadLeases() { - PartitionControllerImpl self = this; logger.debug("Starting renew leases assigned to this host on initialize."); return this.leaseContainer.getOwnedLeases() .flatMap( lease -> { - logger.info(String.format("Acquired lease for PartitionId '%s' on startup.", lease.getLeaseToken())); - return self.addOrUpdateLease(lease); + logger.info("Acquired lease for PartitionId '{}' on startup.", lease.getLeaseToken()); + return this.addOrUpdateLease(lease); }).then(); } @@ -109,12 +105,12 @@ private Mono removeLease(Lease lease) { workerTask.interrupt(); } - logger.info(String.format("Partition %s: released.", lease.getLeaseToken())); + logger.info("Partition {}: released.", lease.getLeaseToken()); } return this.leaseManager.release(lease) .onErrorResume(e -> { - logger.warn(String.format("Partition %s: failed to remove lease.", lease.getLeaseToken()), e); + logger.warn("Partition {}: failed to remove lease.", lease.getLeaseToken(), e); return Mono.empty(); } ).doOnSuccess(aVoid -> { @@ -123,8 +119,6 @@ private Mono removeLease(Lease lease) { } private WorkerTask processPartition(PartitionSupervisor partitionSupervisor, Lease lease) { - PartitionControllerImpl self = this; - CancellationToken cancellationToken = this.shutdownCts.getToken(); WorkerTask partitionSupervisorTask = new WorkerTask(lease, () -> { @@ -132,34 +126,32 @@ private WorkerTask processPartition(PartitionSupervisor partitionSupervisor, Lea .onErrorResume(throwable -> { if (throwable instanceof PartitionSplitException) { PartitionSplitException ex = (PartitionSplitException) throwable; - return self.handleSplit(lease, ex.getLastContinuation()); + return this.handleSplit(lease, ex.getLastContinuation()); } else if (throwable instanceof TaskCancelledException) { - logger.debug(String.format("Partition %s: processing canceled.", lease.getLeaseToken())); + logger.debug("Partition {}: processing canceled.", lease.getLeaseToken()); } else { - logger.warn(String.format("Partition %s: processing failed.", lease.getLeaseToken()), throwable); + logger.warn("Partition {}: processing failed.", lease.getLeaseToken(), throwable); } return Mono.empty(); }) - .then(self.removeLease(lease)).subscribe(); + .then(this.removeLease(lease)).subscribe(); }); - this.executorService.execute(partitionSupervisorTask); + this.scheduler.schedule(partitionSupervisorTask); return partitionSupervisorTask; } private Mono handleSplit(Lease lease, String lastContinuationToken) { - PartitionControllerImpl self = this; - lease.setContinuationToken(lastContinuationToken); return this.synchronizer.splitPartition(lease) .flatMap(l -> { l.setProperties(lease.getProperties()); - return self.addOrUpdateLease(l); - }).then(self.leaseManager.delete(lease)) + return this.addOrUpdateLease(l); + }).then(this.leaseManager.delete(lease)) .onErrorResume(throwable -> { - logger.warn(String.format("partition %s: failed to split", lease.getLeaseToken()), throwable); + logger.warn("Partition {}: failed to split", lease.getLeaseToken(), throwable); return Mono.empty(); }); } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionLoadBalancerImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionLoadBalancerImpl.java index d95c2a9d0707..9e6d93fce388 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionLoadBalancerImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionLoadBalancerImpl.java @@ -11,11 +11,13 @@ import com.azure.data.cosmos.internal.changefeed.PartitionLoadBalancingStrategy; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import reactor.core.scheduler.Scheduler; import java.time.Duration; +import java.time.ZonedDateTime; import java.util.List; -import java.util.concurrent.ExecutorService; /** * Implementation for {@link PartitionLoadBalancer}. @@ -26,7 +28,7 @@ class PartitionLoadBalancerImpl implements PartitionLoadBalancer { private final LeaseContainer leaseContainer; private final PartitionLoadBalancingStrategy partitionLoadBalancingStrategy; private final Duration leaseAcquireInterval; - private final ExecutorService executorService; + private final Scheduler scheduler; private CancellationTokenSource cancellationTokenSource; @@ -35,22 +37,33 @@ class PartitionLoadBalancerImpl implements PartitionLoadBalancer { private final Object lock; public PartitionLoadBalancerImpl( - PartitionController partitionController, - LeaseContainer leaseContainer, - PartitionLoadBalancingStrategy partitionLoadBalancingStrategy, - Duration leaseAcquireInterval, - ExecutorService executorService) { + PartitionController partitionController, + LeaseContainer leaseContainer, + PartitionLoadBalancingStrategy partitionLoadBalancingStrategy, + Duration leaseAcquireInterval, + Scheduler scheduler) { - if (partitionController == null) throw new IllegalArgumentException("partitionController"); - if (leaseContainer == null) throw new IllegalArgumentException("leaseContainer"); - if (partitionLoadBalancingStrategy == null) throw new IllegalArgumentException("partitionLoadBalancingStrategy"); - if (executorService == null) throw new IllegalArgumentException("executorService"); + if (partitionController == null) { + throw new IllegalArgumentException("partitionController"); + } + + if (leaseContainer == null) { + throw new IllegalArgumentException("leaseContainer"); + } + + if (partitionLoadBalancingStrategy == null) { + throw new IllegalArgumentException("partitionLoadBalancingStrategy"); + } + + if (scheduler == null) { + throw new IllegalArgumentException("executorService"); + } this.partitionController = partitionController; this.leaseContainer = leaseContainer; this.partitionLoadBalancingStrategy = partitionLoadBalancingStrategy; this.leaseAcquireInterval = leaseAcquireInterval; - this.executorService = executorService; + this.scheduler = scheduler; this.started = false; this.lock = new Object(); @@ -58,66 +71,74 @@ public PartitionLoadBalancerImpl( @Override public Mono start() { - PartitionLoadBalancerImpl self = this; - - return Mono.fromRunnable( () -> { - synchronized (lock) { - if (this.started) { - throw new IllegalStateException("Partition load balancer already started"); - } - - this.started = true; - this.cancellationTokenSource = new CancellationTokenSource(); + synchronized (lock) { + if (this.started) { + throw new IllegalStateException("Partition load balancer already started"); } - CancellationToken cancellationToken = this.cancellationTokenSource.getToken(); + this.cancellationTokenSource = new CancellationTokenSource(); + this.started = true; + } - this.executorService.execute(() -> self.run(cancellationToken).block()); + return Mono.fromRunnable( () -> { + scheduler.schedule(() -> this.run(this.cancellationTokenSource.getToken()).subscribe()); }); } @Override public Mono stop() { - return Mono.fromRunnable( () -> { - synchronized (lock) { - this.started = false; - this.cancellationTokenSource.cancel(); - } + synchronized (lock) { + this.started = false; + this.cancellationTokenSource.cancel(); + } - this.partitionController.shutdown().block(); - this.cancellationTokenSource = null; - }); + return this.partitionController.shutdown(); } - private Mono run(CancellationToken cancellationToken) { - PartitionLoadBalancerImpl self = this; + @Override + public boolean isRunning() { + return this.started; + } - return Mono.fromRunnable( () -> { - try { - while (!cancellationToken.isCancellationRequested()) { - List allLeases = self.leaseContainer.getAllLeases().collectList().block(); - List leasesToTake = self.partitionLoadBalancingStrategy.selectLeasesToTake(allLeases); - for (Lease lease : leasesToTake) { - self.partitionController.addOrUpdateLease(lease).block(); - } - - long remainingWork = this.leaseAcquireInterval.toMillis(); - - try { - while (!cancellationToken.isCancellationRequested() && remainingWork > 0) { - Thread.sleep(100); - remainingWork -= 100; - } - } catch (InterruptedException ex) { - // exception caught - logger.warn("Partition load balancer caught an interrupted exception", ex); - } - } - } catch (Exception ex) { + private Mono run(CancellationToken cancellationToken) { + return Flux.just(this) + .flatMap(value -> this.leaseContainer.getAllLeases()) + .collectList() + .flatMap(allLeases -> { + if (cancellationToken.isCancellationRequested()) return Mono.empty(); + List leasesToTake = this.partitionLoadBalancingStrategy.selectLeasesToTake(allLeases); + this.logger.debug("Found {} leases, taking {}", allLeases.size(), leasesToTake.size()); + + if (cancellationToken.isCancellationRequested()) return Mono.empty(); + return Flux.fromIterable(leasesToTake) + .flatMap(lease -> { + if (cancellationToken.isCancellationRequested()) return Mono.empty(); + return this.partitionController.addOrUpdateLease(lease); + }) + .then(Mono.just(this) + .flatMap(value -> { + if (cancellationToken.isCancellationRequested()) { + return Mono.empty(); + } + + ZonedDateTime stopTimer = ZonedDateTime.now().plus(this.leaseAcquireInterval); + return Mono.just(value) + .delayElement(Duration.ofMillis(100)) + .repeat( () -> { + ZonedDateTime currentTime = ZonedDateTime.now(); + return !cancellationToken.isCancellationRequested() && currentTime.isBefore(stopTimer); + }).last(); + }) + ); + }) + .repeat(() -> { + return !cancellationToken.isCancellationRequested(); + }) + .then() + .onErrorResume(throwable -> { // We should not get here. logger.info("Partition load balancer task stopped."); - this.stop(); - } - }); + return this.stop(); + }); } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionManagerImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionManagerImpl.java index 4f8e2903977a..8c30c0274e10 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionManagerImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionManagerImpl.java @@ -24,16 +24,18 @@ public PartitionManagerImpl(Bootstrapper bootstrapper, PartitionController parti @Override public Mono start() { - PartitionManagerImpl self = this; - - return self.bootstrapper.initialize() - .then(self.partitionController.initialize()) - .then(self.partitionLoadBalancer.start()); + return this.bootstrapper.initialize() + .then(this.partitionController.initialize()) + .then(this.partitionLoadBalancer.start()); } @Override public Mono stop() { - PartitionManagerImpl self = this; - return self.partitionLoadBalancer.stop(); + return this.partitionLoadBalancer.stop(); + } + + @Override + public boolean isRunning() { + return this.partitionLoadBalancer.isRunning(); } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionProcessorFactoryImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionProcessorFactoryImpl.java index 5801b71250ed..e508129d91f8 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionProcessorFactoryImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionProcessorFactoryImpl.java @@ -23,15 +23,26 @@ class PartitionProcessorFactoryImpl implements PartitionProcessorFactory { private final CosmosContainer collectionSelfLink; public PartitionProcessorFactoryImpl( - ChangeFeedContextClient documentClient, - ChangeFeedProcessorOptions changeFeedProcessorOptions, - LeaseCheckpointer leaseCheckpointer, - CosmosContainer collectionSelfLink) { + ChangeFeedContextClient documentClient, + ChangeFeedProcessorOptions changeFeedProcessorOptions, + LeaseCheckpointer leaseCheckpointer, + CosmosContainer collectionSelfLink) { - if (documentClient == null) throw new IllegalArgumentException("documentClient"); - if (changeFeedProcessorOptions == null) throw new IllegalArgumentException("changeFeedProcessorOptions"); - if (leaseCheckpointer == null) throw new IllegalArgumentException("leaseCheckpointer"); - if (collectionSelfLink == null) throw new IllegalArgumentException("collectionSelfLink"); + if (documentClient == null) { + throw new IllegalArgumentException("documentClient"); + } + + if (changeFeedProcessorOptions == null) { + throw new IllegalArgumentException("changeFeedProcessorOptions"); + } + + if (leaseCheckpointer == null) { + throw new IllegalArgumentException("leaseCheckpointer"); + } + + if (collectionSelfLink == null) { + throw new IllegalArgumentException("collectionSelfLink"); + } this.documentClient = documentClient; this.changeFeedProcessorOptions = changeFeedProcessorOptions; @@ -41,8 +52,13 @@ public PartitionProcessorFactoryImpl( @Override public PartitionProcessor create(Lease lease, ChangeFeedObserver observer) { - if (observer == null) throw new IllegalArgumentException("observer"); - if (lease == null) throw new IllegalArgumentException("lease"); + if (observer == null) { + throw new IllegalArgumentException("observer"); + } + + if (lease == null) { + throw new IllegalArgumentException("lease"); + } String startContinuation = lease.getContinuationToken(); diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionProcessorImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionProcessorImpl.java index 68a1d1ce81dd..a32f1f4e5d52 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionProcessorImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionProcessorImpl.java @@ -16,10 +16,13 @@ import com.azure.data.cosmos.internal.changefeed.exceptions.PartitionNotFoundException; import com.azure.data.cosmos.internal.changefeed.exceptions.PartitionSplitException; import com.azure.data.cosmos.internal.changefeed.exceptions.TaskCancelledException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.time.Duration; -import java.util.List; +import java.time.ZonedDateTime; import static com.azure.data.cosmos.CommonsBridgeInternal.partitionKeyRangeIdInternal; @@ -27,16 +30,19 @@ * Implementation for {@link PartitionProcessor}. */ class PartitionProcessorImpl implements PartitionProcessor { + private static final Logger logger = LoggerFactory.getLogger(PartitionProcessorImpl.class); + private static final int DefaultMaxItemCount = 100; - // private final Observable> query; private final ProcessorSettings settings; private final PartitionCheckpointer checkpointer; private final ChangeFeedObserver observer; private final ChangeFeedOptions options; private final ChangeFeedContextClient documentClient; - private RuntimeException resultException; + private volatile RuntimeException resultException; + + private volatile String lastContinuation; + private volatile boolean isFirstQueryForChangeFeeds; - private String lastContinuation; public PartitionProcessorImpl(ChangeFeedObserver observer, ChangeFeedContextClient documentClient, ProcessorSettings settings, PartitionCheckpointer checkpointer) { this.observer = observer; @@ -51,95 +57,113 @@ public PartitionProcessorImpl(ChangeFeedObserver observer, ChangeFeedContextClie this.options.startFromBeginning(settings.isStartFromBeginning()); this.options.requestContinuation(settings.getStartContinuation()); this.options.startDateTime(settings.getStartTime()); - - //this.query = documentClient.createDocumentChangeFeedQuery(self.properties.getCollectionSelfLink(), this.options); } @Override public Mono run(CancellationToken cancellationToken) { - PartitionProcessorImpl self = this; this.lastContinuation = this.settings.getStartContinuation(); + this.isFirstQueryForChangeFeeds = true; - return Mono.fromRunnable( () -> { - while (!cancellationToken.isCancellationRequested()) { - Duration delay = self.settings.getFeedPollDelay(); + this.options.requestContinuation(this.lastContinuation); - try { - self.options.requestContinuation(self.lastContinuation); - List> documentFeedResponseList = self.documentClient.createDocumentChangeFeedQuery(self.settings.getCollectionSelfLink(), self.options) - .collectList() - .block(); + return Flux.just(this) + .flatMap( value -> { + if (cancellationToken.isCancellationRequested()) { + return Flux.empty(); + } - for (FeedResponse documentFeedResponse : documentFeedResponseList) { - self.lastContinuation = documentFeedResponse.continuationToken(); - if (documentFeedResponse.results() != null && documentFeedResponse.results().size() > 0) { - self.dispatchChanges(documentFeedResponse); - } + if(this.isFirstQueryForChangeFeeds) { + this.isFirstQueryForChangeFeeds = false; + return Flux.just(value); + } - self.options.requestContinuation(self.lastContinuation); + ZonedDateTime stopTimer = ZonedDateTime.now().plus(this.settings.getFeedPollDelay()); + return Mono.just(value) + .delayElement(Duration.ofMillis(100)) + .repeat( () -> { + ZonedDateTime currentTime = ZonedDateTime.now(); + return !cancellationToken.isCancellationRequested() && currentTime.isBefore(stopTimer); + }).last(); + + }) + .flatMap(value -> this.documentClient.createDocumentChangeFeedQuery(this.settings.getCollectionSelfLink(), this.options) + .limitRequest(1) + ) + .flatMap(documentFeedResponse -> { + if (cancellationToken.isCancellationRequested()) return Flux.error(new TaskCancelledException()); + + this.lastContinuation = documentFeedResponse.continuationToken(); + if (documentFeedResponse.results() != null && documentFeedResponse.results().size() > 0) { + return this.dispatchChanges(documentFeedResponse) + .doFinally( (Void) -> { + this.options.requestContinuation(this.lastContinuation); + + if (cancellationToken.isCancellationRequested()) throw new TaskCancelledException(); + }).flux(); + } + this.options.requestContinuation(this.lastContinuation); - if (cancellationToken.isCancellationRequested()) { - // Observation was cancelled. - throw new TaskCancelledException(); - } - } + if (cancellationToken.isCancellationRequested()) { + return Flux.error(new TaskCancelledException()); + } - if (this.options.maxItemCount().compareTo(this.settings.getMaxItemCount()) == 0) { - this.options.maxItemCount(this.settings.getMaxItemCount()); // Reset after successful execution. - } - } catch (RuntimeException ex) { - if (ex.getCause() instanceof CosmosClientException) { + return Flux.empty(); + }) + .doOnComplete(() -> { + if (this.options.maxItemCount().compareTo(this.settings.getMaxItemCount()) != 0) { + this.options.maxItemCount(this.settings.getMaxItemCount()); // Reset after successful execution. + } + }) + .onErrorResume(throwable -> { + if (throwable instanceof CosmosClientException) { - CosmosClientException clientException = (CosmosClientException) ex.getCause(); - // this.logger.WarnException("exception: partition '{0}'", clientException, this.properties.PartitionKeyRangeId); - StatusCodeErrorType docDbError = ExceptionClassifier.classifyClientException(clientException); + CosmosClientException clientException = (CosmosClientException) throwable; + this.logger.warn("Exception: partition {}", this.options.partitionKey().getInternalPartitionKey(), clientException); + StatusCodeErrorType docDbError = ExceptionClassifier.classifyClientException(clientException); - switch (docDbError) { - case PARTITION_NOT_FOUND: { - self.resultException = new PartitionNotFoundException("Partition not found.", self.lastContinuation); - } - case PARTITION_SPLIT: { - self.resultException = new PartitionSplitException("Partition split.", self.lastContinuation); - } - case UNDEFINED: { - self.resultException = ex; - } - case MAX_ITEM_COUNT_TOO_LARGE: { - if (this.options.maxItemCount() == null) { - this.options.maxItemCount(DefaultMaxItemCount); - } else if (this.options.maxItemCount() <= 1) { - // this.logger.ErrorFormat("Cannot reduce maxItemCount further as it's already at {0}.", this.options.MaxItemCount); - throw ex; - } - - this.options.maxItemCount(this.options.maxItemCount() / 2); - // this.logger.WarnFormat("Reducing maxItemCount, new value: {0}.", this.options.MaxItemCount); - break; - } - default: { - // this.logger.Fatal($"Unrecognized DocDbError enum value {docDbError}"); - // Debug.Fail($"Unrecognized DocDbError enum value {docDbError}"); - self.resultException = ex; + switch (docDbError) { + case PARTITION_NOT_FOUND: { + this.resultException = new PartitionNotFoundException("Partition not found.", this.lastContinuation); + } + case PARTITION_SPLIT: { + this.resultException = new PartitionSplitException("Partition split.", this.lastContinuation); + } + case UNDEFINED: { + this.resultException = new RuntimeException(clientException); + } + case MAX_ITEM_COUNT_TOO_LARGE: { + if (this.options.maxItemCount() == null) { + this.options.maxItemCount(DefaultMaxItemCount); + } else if (this.options.maxItemCount() <= 1) { + this.logger.error("Cannot reduce maxItemCount further as it's already at {}", this.options.maxItemCount(), clientException); + this.resultException = new RuntimeException(clientException); } + + this.options.maxItemCount(this.options.maxItemCount() / 2); + this.logger.warn("Reducing maxItemCount, new value: {}", this.options.maxItemCount()); + return Flux.empty(); + } + default: { + this.logger.error("Unrecognized DocDbError enum value {}", docDbError, clientException); + this.resultException = new RuntimeException(clientException); } - } else if (ex instanceof TaskCancelledException) { - // this.logger.WarnException("exception: partition '{0}'", canceledException, this.properties.PartitionKeyRangeId); - self.resultException = ex; } + } else if (throwable instanceof TaskCancelledException) { + this.logger.debug("Exception: partition {}", this.settings.getPartitionKeyRangeId(), throwable); + this.resultException = (TaskCancelledException) throwable; } - - long remainingWork = delay.toMillis(); - - try { - while (!cancellationToken.isCancellationRequested() && remainingWork > 0) { - Thread.sleep(100); - remainingWork -= 100; - } - } catch (InterruptedException iex) { - // exception caught + return Flux.error(throwable); + }) + .repeat(() -> { + if (cancellationToken.isCancellationRequested()) { + this.resultException = new TaskCancelledException(); + return false; } - } - }); + + return true; + }) + .onErrorResume(throwable -> Flux.empty()) + .then(); } @Override @@ -147,9 +171,10 @@ public RuntimeException getResultException() { return this.resultException; } - private void dispatchChanges(FeedResponse response) { + private Mono dispatchChanges(FeedResponse response) { ChangeFeedObserverContext context = new ChangeFeedObserverContextImpl(this.settings.getPartitionKeyRangeId(), response, this.checkpointer); this.observer.processChanges(context, response.results()); + return Mono.empty(); } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSupervisorFactoryImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSupervisorFactoryImpl.java index 8ba904934348..e6101e43b80d 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSupervisorFactoryImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSupervisorFactoryImpl.java @@ -12,6 +12,7 @@ import com.azure.data.cosmos.internal.changefeed.PartitionProcessorFactory; import com.azure.data.cosmos.internal.changefeed.PartitionSupervisor; import com.azure.data.cosmos.internal.changefeed.PartitionSupervisorFactory; +import reactor.core.scheduler.Scheduler; import java.util.concurrent.ExecutorService; @@ -23,35 +24,49 @@ class PartitionSupervisorFactoryImpl implements PartitionSupervisorFactory { private final LeaseManager leaseManager; private final ChangeFeedProcessorOptions changeFeedProcessorOptions; private final PartitionProcessorFactory partitionProcessorFactory; - private final ExecutorService executorService; + private final Scheduler scheduler; public PartitionSupervisorFactoryImpl( - ChangeFeedObserverFactory observerFactory, - LeaseManager leaseManager, - PartitionProcessorFactory partitionProcessorFactory, - ChangeFeedProcessorOptions options, - ExecutorService executorService) { - if (observerFactory == null) throw new IllegalArgumentException("observerFactory"); - if (leaseManager == null) throw new IllegalArgumentException("leaseManager"); - if (options == null) throw new IllegalArgumentException("options"); - if (partitionProcessorFactory == null) throw new IllegalArgumentException("partitionProcessorFactory"); + ChangeFeedObserverFactory observerFactory, + LeaseManager leaseManager, + PartitionProcessorFactory partitionProcessorFactory, + ChangeFeedProcessorOptions options, + Scheduler scheduler) { + + if (observerFactory == null) { + throw new IllegalArgumentException("observerFactory"); + } + + if (leaseManager == null) { + throw new IllegalArgumentException("leaseManager"); + } + + if (options == null) { + throw new IllegalArgumentException("options"); + } + + if (partitionProcessorFactory == null) { + throw new IllegalArgumentException("partitionProcessorFactory"); + } this.observerFactory = observerFactory; this.leaseManager = leaseManager; this.changeFeedProcessorOptions = options; this.partitionProcessorFactory = partitionProcessorFactory; - this.executorService = executorService; + this.scheduler = scheduler; } @Override public PartitionSupervisor create(Lease lease) { - if (lease == null) throw new IllegalArgumentException("lease"); + if (lease == null) { + throw new IllegalArgumentException("lease"); + } ChangeFeedObserver changeFeedObserver = this.observerFactory.createObserver(); PartitionProcessor processor = this.partitionProcessorFactory.create(lease, changeFeedObserver); LeaseRenewer renewer = new LeaseRenewerImpl(lease, this.leaseManager, this.changeFeedProcessorOptions.leaseRenewInterval()); - return new PartitionSupervisorImpl(lease, changeFeedObserver, processor, renewer, this.executorService); + return new PartitionSupervisorImpl(lease, changeFeedObserver, processor, renewer, this.scheduler); } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSupervisorImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSupervisorImpl.java index 7e4831e56e6e..3bbf420c16df 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSupervisorImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSupervisorImpl.java @@ -16,11 +16,12 @@ import com.azure.data.cosmos.internal.changefeed.exceptions.PartitionSplitException; import com.azure.data.cosmos.internal.changefeed.exceptions.TaskCancelledException; import reactor.core.publisher.Mono; +import reactor.core.scheduler.Scheduler; +import reactor.core.scheduler.Schedulers; import java.io.Closeable; import java.io.IOException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; +import java.time.Duration; /** * Implementation for {@link PartitionSupervisor}. @@ -33,72 +34,61 @@ class PartitionSupervisorImpl implements PartitionSupervisor, Closeable { private CancellationTokenSource renewerCancellation; private CancellationTokenSource processorCancellation; - private RuntimeException resultException; + private volatile RuntimeException resultException; - private ExecutorService executorService; + private Scheduler scheduler; - public PartitionSupervisorImpl(Lease lease, ChangeFeedObserver observer, PartitionProcessor processor, LeaseRenewer renewer, ExecutorService executorService) { + public PartitionSupervisorImpl(Lease lease, ChangeFeedObserver observer, PartitionProcessor processor, LeaseRenewer renewer, Scheduler scheduler) { this.lease = lease; this.observer = observer; this.processor = processor; this.renewer = renewer; - this.executorService = executorService; + this.scheduler = scheduler; - if (executorService == null) { - this.executorService = Executors.newFixedThreadPool(3); + if (scheduler == null) { + this.scheduler = Schedulers.elastic(); } } @Override public Mono run(CancellationToken shutdownToken) { - PartitionSupervisorImpl self = this; this.resultException = null; - ChangeFeedObserverContext context = new ChangeFeedObserverContextImpl(self.lease.getLeaseToken()); + ChangeFeedObserverContext context = new ChangeFeedObserverContextImpl(this.lease.getLeaseToken()); - self.observer.open(context); + this.observer.open(context); + this.processorCancellation = new CancellationTokenSource(); + + this.scheduler.schedule(() -> this.processor.run(this.processorCancellation.getToken()) + .subscribe()); + + this.renewerCancellation = new CancellationTokenSource(); + + this.scheduler.schedule(() -> this.renewer.run(this.renewerCancellation.getToken()) + .subscribe()); + + return Mono.just(this) + .delayElement(Duration.ofMillis(100)) + .repeat( () -> !shutdownToken.isCancellationRequested() && this.processor.getResultException() == null && this.renewer.getResultException() == null) + .last() + .flatMap( value -> this.afterRun(context, shutdownToken)); + } + + private Mono afterRun(ChangeFeedObserverContext context, CancellationToken shutdownToken) { ChangeFeedObserverCloseReason closeReason = ChangeFeedObserverCloseReason.UNKNOWN; try { - self.processorCancellation = new CancellationTokenSource(); - - Thread processorThread = new Thread(new Runnable() { - @Override - public void run() { - self.processor.run(self.processorCancellation.getToken()).block(); - } - }); - - self.renewerCancellation = new CancellationTokenSource(); - - Thread renewerThread = new Thread(new Runnable() { - @Override - public void run() { - self.renewer.run(self.renewerCancellation.getToken()).block(); - } - }); - - self.executorService.execute(processorThread); - self.executorService.execute(renewerThread); - - while (!shutdownToken.isCancellationRequested() && self.processor.getResultException() == null && self.renewer.getResultException() == null) { - try { - Thread.sleep(100); - } catch (InterruptedException iex) { - break; - } - } this.processorCancellation.cancel(); this.renewerCancellation.cancel(); - if (self.processor.getResultException() != null) { - throw self.processor.getResultException(); + if (this.processor.getResultException() != null) { + throw this.processor.getResultException(); } - if (self.renewer.getResultException() != null) { - throw self.renewer.getResultException(); + if (this.renewer.getResultException() != null) { + throw this.renewer.getResultException(); } closeReason = shutdownToken.isCancellationRequested() ? @@ -107,24 +97,24 @@ public void run() { } catch (LeaseLostException llex) { closeReason = ChangeFeedObserverCloseReason.LEASE_LOST; - self.resultException = llex; + this.resultException = llex; } catch (PartitionSplitException pex) { closeReason = ChangeFeedObserverCloseReason.LEASE_GONE; - self.resultException = pex; + this.resultException = pex; } catch (TaskCancelledException tcex) { closeReason = ChangeFeedObserverCloseReason.SHUTDOWN; - self.resultException = null; + this.resultException = null; } catch (ObserverException oex) { closeReason = ChangeFeedObserverCloseReason.OBSERVER_ERROR; - self.resultException = oex; + this.resultException = oex; } catch (Exception ex) { closeReason = ChangeFeedObserverCloseReason.UNKNOWN; } finally { - self.observer.close(context, closeReason); + this.observer.close(context, closeReason); } - if (self.resultException != null) { - return Mono.error(self.resultException); + if (this.resultException != null) { + return Mono.error(this.resultException); } else { return Mono.empty(); } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSynchronizerImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSynchronizerImpl.java index 951a2b584544..8811f075c514 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSynchronizerImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSynchronizerImpl.java @@ -33,13 +33,13 @@ class PartitionSynchronizerImpl implements PartitionSynchronizer { private final int maxBatchSize; public PartitionSynchronizerImpl( - ChangeFeedContextClient documentClient, - CosmosContainer collectionSelfLink, - LeaseContainer leaseContainer, - LeaseManager leaseManager, - int degreeOfParallelism, - int maxBatchSize) - { + ChangeFeedContextClient documentClient, + CosmosContainer collectionSelfLink, + LeaseContainer leaseContainer, + LeaseManager leaseManager, + int degreeOfParallelism, + int maxBatchSize) { + this.documentClient = documentClient; this.collectionSelfLink = collectionSelfLink; this.leaseContainer = leaseContainer; @@ -50,8 +50,6 @@ public PartitionSynchronizerImpl( @Override public Mono createMissingLeases() { - PartitionSynchronizerImpl self = this; - return this.enumPartitionKeyRanges() .map(partitionKeyRange -> { // TODO: log the partition key ID found. @@ -60,7 +58,7 @@ public Mono createMissingLeases() { .collectList() .flatMap( partitionKeyRangeIds -> { Set leaseTokens = new HashSet<>(partitionKeyRangeIds); - return self.createLeases(leaseTokens).then(); + return this.createLeases(leaseTokens).then(); }) .onErrorResume( throwable -> { // TODO: log the exception. @@ -70,13 +68,14 @@ public Mono createMissingLeases() { @Override public Flux splitPartition(Lease lease) { - if (lease == null) throw new IllegalArgumentException("lease"); + if (lease == null) { + throw new IllegalArgumentException("lease"); + } - PartitionSynchronizerImpl self = this; String leaseToken = lease.getLeaseToken(); String lastContinuationToken = lease.getContinuationToken(); - logger.info(String.format("Partition %s is gone due to split.", leaseToken)); + logger.info("Partition {} is gone due to split.", leaseToken); // After a split, the children are either all or none available return this.enumPartitionKeyRanges() @@ -85,23 +84,22 @@ public Flux splitPartition(Lease lease) { .collectList() .flatMapMany(addedLeaseTokens -> { if (addedLeaseTokens.size() == 0) { - logger.error(String.format("Partition %s had split but we failed to find at least one child partition", leaseToken)); + logger.error("Partition {} had split but we failed to find at least one child partition", leaseToken); throw new RuntimeException(String.format("Partition %s had split but we failed to find at least one child partition", leaseToken)); } return Flux.fromIterable(addedLeaseTokens); }) .flatMap(addedRangeId -> { // Creating new lease. - return self.leaseManager.createLeaseIfNotExist(addedRangeId, lastContinuationToken); - }, self.degreeOfParallelism) + return this.leaseManager.createLeaseIfNotExist(addedRangeId, lastContinuationToken); + }, this.degreeOfParallelism) .map(newLease -> { - logger.info(String.format("Partition %s split into new partition with lease token %s.", leaseToken, newLease.getLeaseToken())); + logger.info("Partition {} split into new partition with lease token {}.", leaseToken, newLease.getLeaseToken()); return newLease; }); } private Flux enumPartitionKeyRanges() { - // STRING partitionKeyRangesPath = STRING.format("%spkranges", this.collectionSelfLink); String partitionKeyRangesPath = extractContainerSelfLink(this.collectionSelfLink); FeedOptions feedOptions = new FeedOptions(); feedOptions.maxItemCount(this.maxBatchSize); @@ -129,7 +127,6 @@ private Flux enumPartitionKeyRanges() { */ private Flux createLeases(Set leaseTokens) { - PartitionSynchronizerImpl self = this; Set addedLeaseTokens = new HashSet<>(leaseTokens); return this.leaseContainer.getAllLeases() @@ -144,7 +141,7 @@ private Flux createLeases(Set leaseTokens) }) .thenMany(Flux.fromIterable(addedLeaseTokens) .flatMap( addedRangeId -> - self.leaseManager.createLeaseIfNotExist(addedRangeId, null), self.degreeOfParallelism) + this.leaseManager.createLeaseIfNotExist(addedRangeId, null), this.degreeOfParallelism) .map( lease -> { // TODO: log the lease info that was added. return lease; diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/RemainingPartitionWorkImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/RemainingPartitionWorkImpl.java index e0b83b0d9d4a..5e1da46ec0ea 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/RemainingPartitionWorkImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/RemainingPartitionWorkImpl.java @@ -18,7 +18,9 @@ class RemainingPartitionWorkImpl implements RemainingPartitionWork { * @param remainingWork the amount of documents remaining to be processed. */ public RemainingPartitionWorkImpl(String partitionKeyRangeId, long remainingWork) { - if (partitionKeyRangeId == null || partitionKeyRangeId.isEmpty()) throw new IllegalArgumentException("partitionKeyRangeId"); + if (partitionKeyRangeId == null || partitionKeyRangeId.isEmpty()) { + throw new IllegalArgumentException("partitionKeyRangeId"); + } this.partitionKeyRangeId = partitionKeyRangeId; this.remainingWork = remainingWork; diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/RemainingWorkEstimatorImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/RemainingWorkEstimatorImpl.java index 4f5341aedc5b..fd2511242a9c 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/RemainingWorkEstimatorImpl.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/RemainingWorkEstimatorImpl.java @@ -27,10 +27,21 @@ public RemainingWorkEstimatorImpl( String collectionSelfLink, int degreeOfParallelism) { - if (leaseContainer == null) throw new IllegalArgumentException("leaseContainer"); - if (collectionSelfLink == null || collectionSelfLink.isEmpty()) throw new IllegalArgumentException("collectionSelfLink"); - if (feedDocumentClient == null) throw new IllegalArgumentException("feedDocumentClient"); - if (degreeOfParallelism < 1) throw new IllegalArgumentException("degreeOfParallelism - Degree of parallelism is out of range"); + if (leaseContainer == null) { + throw new IllegalArgumentException("leaseContainer"); + } + + if (collectionSelfLink == null || collectionSelfLink.isEmpty()) { + throw new IllegalArgumentException("collectionSelfLink"); + } + + if (feedDocumentClient == null) { + throw new IllegalArgumentException("feedDocumentClient"); + } + + if (degreeOfParallelism < 1) { + throw new IllegalArgumentException("degreeOfParallelism - Degree of parallelism is out of range"); + } this.leaseContainer = leaseContainer; this.collectionSelfLink = collectionSelfLink; diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/TraceHealthMonitor.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/TraceHealthMonitor.java index 4bfc6e433c02..e4be68a9bd05 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/TraceHealthMonitor.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/TraceHealthMonitor.java @@ -17,7 +17,7 @@ class TraceHealthMonitor implements HealthMonitor { public Mono inspect(HealthMonitoringRecord record) { return Mono.fromRunnable(() -> { if (record.getSeverity() == HealthMonitoringRecord.HealthSeverity.ERROR) { - logger.error(String.format("Unhealthiness detected in the operation %s for %s.", record.operation.name(), record.lease.getId()), record.throwable); + logger.error("Unhealthiness detected in the operation {} for {}.", record.operation.name(), record.lease.getId(), record.throwable); } }); } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfigurationReader.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfigurationReader.java index a281231933b6..33397da58c6d 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfigurationReader.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfigurationReader.java @@ -3,11 +3,12 @@ package com.azure.data.cosmos.internal.directconnectivity; +import com.azure.data.cosmos.BridgeInternal; import com.azure.data.cosmos.ConnectionPolicy; import com.azure.data.cosmos.ConsistencyLevel; import com.azure.data.cosmos.internal.BaseAuthorizationTokenProvider; import com.azure.data.cosmos.internal.Constants; -import com.azure.data.cosmos.internal.DatabaseAccount; +import com.azure.data.cosmos.DatabaseAccount; import com.azure.data.cosmos.internal.GlobalEndpointManager; import com.azure.data.cosmos.internal.HttpConstants; import com.azure.data.cosmos.internal.ReplicationPolicy; @@ -139,10 +140,10 @@ public Mono initializeReaderAsync() { throw new IllegalArgumentException("URI " + url); } }).doOnSuccess(databaseAccount -> { - userReplicationPolicy = databaseAccount.getReplicationPolicy(); - systemReplicationPolicy = databaseAccount.getSystemReplicationPolicy(); - queryEngineConfiguration = databaseAccount.getQueryEngineConfiuration(); - consistencyLevel = databaseAccount.getConsistencyPolicy().defaultConsistencyLevel(); + userReplicationPolicy = BridgeInternal.getReplicationPolicy(databaseAccount); + systemReplicationPolicy = BridgeInternal.getSystemReplicationPolicy(databaseAccount); + queryEngineConfiguration = BridgeInternal.getQueryEngineConfiuration(databaseAccount); + consistencyLevel = BridgeInternal.getConsistencyPolicy(databaseAccount).defaultConsistencyLevel(); initialized = true; }); } catch (MalformedURLException e) { diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClient.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClient.java index 8b0951801807..52007f9e426e 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClient.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClient.java @@ -7,7 +7,6 @@ import com.azure.data.cosmos.internal.RxDocumentServiceRequest; import com.azure.data.cosmos.internal.UserAgentContainer; import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdEndpoint; -import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdMetrics; import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdObjectMapper; import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdRequestArgs; import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdRequestRecord; @@ -16,6 +15,8 @@ import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.google.common.base.Strings; +import io.micrometer.core.instrument.Tag; import io.netty.handler.ssl.SslContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,27 +38,30 @@ public final class RntbdTransportClient extends TransportClient { // region Fields + private static final String TAG_NAME = RntbdTransportClient.class.getSimpleName(); + private static final AtomicLong instanceCount = new AtomicLong(); private static final Logger logger = LoggerFactory.getLogger(RntbdTransportClient.class); - private static final String namePrefix = RntbdTransportClient.class.getSimpleName() + '-'; private final AtomicBoolean closed = new AtomicBoolean(); private final RntbdEndpoint.Provider endpointProvider; - private final RntbdMetrics metrics; - private final String name; + private final long id; + private final Tag tag; // endregion // region Constructors RntbdTransportClient(final RntbdEndpoint.Provider endpointProvider) { - this.name = RntbdTransportClient.namePrefix + RntbdTransportClient.instanceCount.incrementAndGet(); this.endpointProvider = endpointProvider; - this.metrics = new RntbdMetrics(this.name); + this.id = instanceCount.incrementAndGet(); + this.tag = RntbdTransportClient.tag(this.id); } RntbdTransportClient(final Options options, final SslContext sslContext) { - this(new RntbdServiceEndpoint.Provider(options, sslContext)); + this.endpointProvider = new RntbdServiceEndpoint.Provider(this, options, sslContext); + this.id = instanceCount.incrementAndGet(); + this.tag = RntbdTransportClient.tag(this.id); } RntbdTransportClient(final Configs configs, final int requestTimeoutInSeconds, final UserAgentContainer userAgent) { @@ -66,6 +70,30 @@ public final class RntbdTransportClient extends TransportClient { // endregion + // region Accessors + + public int endpointCount() { + return this.endpointProvider.count(); + } + + public int endpointEvictionCount() { + return this.endpointProvider.evictions(); + } + + public long id() { + return this.id; + } + + public boolean isClosed() { + return this.closed.get(); + } + + public Tag tag() { + return this.tag; + } + + // endregion + // region Methods @Override @@ -75,7 +103,6 @@ public void close() { if (this.closed.compareAndSet(false, true)) { this.endpointProvider.close(); - this.metrics.close(); return; } @@ -90,24 +117,11 @@ public Mono invokeStoreAsync(final URI physicalAddress, final RxD this.throwIfClosed(); final RntbdRequestArgs requestArgs = new RntbdRequestArgs(request, physicalAddress); - - if (logger.isDebugEnabled()) { - requestArgs.traceOperation(logger, null, "invokeStoreAsync"); - logger.debug("\n [{}]\n {}\n INVOKE_STORE_ASYNC", this, requestArgs); - } + requestArgs.traceOperation(logger, null, "invokeStoreAsync"); final RntbdEndpoint endpoint = this.endpointProvider.get(physicalAddress); - this.metrics.incrementRequestCount(); - final RntbdRequestRecord requestRecord = endpoint.request(requestArgs); - requestRecord.whenComplete((response, error) -> { - this.metrics.incrementResponseCount(); - if (error != null) { - this.metrics.incrementErrorResponseCount(); - } - }); - return Mono.fromFuture(requestRecord).doFinally(signal -> { if (signal == SignalType.CANCEL) { requestRecord.cancel(false); @@ -117,7 +131,7 @@ public Mono invokeStoreAsync(final URI physicalAddress, final RxD @Override public String toString() { - return RntbdObjectMapper.toJson(this); + return RntbdObjectMapper.toString(this); } private void throwIfClosed() { @@ -126,37 +140,40 @@ private void throwIfClosed() { // endregion + // region Privates + + private static Tag tag(long id) { + return Tag.of(TAG_NAME, Strings.padStart(Long.toHexString(id).toUpperCase(), 4, '0')); + } + + // endregion + // region Types static final class JsonSerializer extends StdSerializer { public JsonSerializer() { - this(null); - } - - public JsonSerializer(Class type) { - super(type); + super(RntbdTransportClient.class); } @Override public void serialize(RntbdTransportClient value, JsonGenerator generator, SerializerProvider provider) throws IOException { generator.writeStartObject(); - - generator.writeArrayFieldStart(value.name); + generator.writeNumberField("id", value.id()); + generator.writeBooleanField("isClosed", value.isClosed()); + generator.writeObjectField("configuration", value.endpointProvider.config()); + generator.writeArrayFieldStart("serviceEndpoints"); value.endpointProvider.list().forEach(endpoint -> { try { generator.writeObject(endpoint); } catch (IOException error) { - logger.error("failed to serialize {} due to ", endpoint.getName(), error); + logger.error("failed to serialize instance {} due to:", value.id(), error); } }); generator.writeEndArray(); - - generator.writeObjectField("config", value.endpointProvider.config()); - generator.writeObjectField("metrics", value.metrics); generator.writeEndObject(); } } @@ -165,14 +182,19 @@ public static final class Options { // region Fields + private final int bufferPageSize; private final String certificateHostNameOverride; + private final Duration connectionTimeout; + private final Duration idleChannelTimeout; + private final Duration idleEndpointTimeout; + private final int maxBufferCapacity; private final int maxChannelsPerEndpoint; private final int maxRequestsPerChannel; - private final Duration connectionTimeout; private final int partitionCount; private final Duration receiveHangDetectionTime; private final Duration requestTimeout; private final Duration sendHangDetectionTime; + private final Duration shutdownTimeout; private final UserAgentContainer userAgent; // endregion @@ -180,15 +202,19 @@ public static final class Options { // region Constructors private Options(Builder builder) { - + this.bufferPageSize = builder.bufferPageSize; this.certificateHostNameOverride = builder.certificateHostNameOverride; + this.connectionTimeout = builder.connectionTimeout == null ? builder.requestTimeout : builder.connectionTimeout; + this.idleChannelTimeout = builder.idleChannelTimeout; + this.idleEndpointTimeout = builder.idleEndpointTimeout; + this.maxBufferCapacity = builder.maxBufferCapacity; this.maxChannelsPerEndpoint = builder.maxChannelsPerEndpoint; this.maxRequestsPerChannel = builder.maxRequestsPerChannel; - this.connectionTimeout = builder.connectionTimeout == null ? builder.requestTimeout : builder.connectionTimeout; this.partitionCount = builder.partitionCount; - this.requestTimeout = builder.requestTimeout; this.receiveHangDetectionTime = builder.receiveHangDetectionTime; + this.requestTimeout = builder.requestTimeout; this.sendHangDetectionTime = builder.sendHangDetectionTime; + this.shutdownTimeout = builder.shutdownTimeout; this.userAgent = builder.userAgent; } @@ -196,39 +222,59 @@ private Options(Builder builder) { // region Accessors - public String getCertificateHostNameOverride() { + public int bufferPageSize() { + return this.bufferPageSize; + } + + public String certificateHostNameOverride() { return this.certificateHostNameOverride; } - public int getMaxChannelsPerEndpoint() { - return this.maxChannelsPerEndpoint; + public Duration connectionTimeout() { + return this.connectionTimeout; } - public int getMaxRequestsPerChannel() { - return this.maxRequestsPerChannel; + public Duration idleChannelTimeout() { + return this.idleChannelTimeout; } - public Duration getConnectionTimeout() { - return this.connectionTimeout; + public Duration idleEndpointTimeout() { + return this.idleEndpointTimeout; } - public int getPartitionCount() { + public int maxBufferCapacity() { + return this.maxBufferCapacity; + } + + public int maxChannelsPerEndpoint() { + return this.maxChannelsPerEndpoint; + } + + public int maxRequestsPerChannel() { + return this.maxRequestsPerChannel; + } + + public int partitionCount() { return this.partitionCount; } - public Duration getReceiveHangDetectionTime() { + public Duration receiveHangDetectionTime() { return this.receiveHangDetectionTime; } - public Duration getRequestTimeout() { + public Duration requestTimeout() { return this.requestTimeout; } - public Duration getSendHangDetectionTime() { + public Duration sendHangDetectionTime() { return this.sendHangDetectionTime; } - public UserAgentContainer getUserAgent() { + public Duration shutdownTimeout() { + return this.shutdownTimeout; + } + + public UserAgentContainer userAgent() { return this.userAgent; } @@ -250,22 +296,24 @@ public static class Builder { // region Fields private static final UserAgentContainer DEFAULT_USER_AGENT_CONTAINER = new UserAgentContainer(); + private static final Duration FIFTEEN_SECONDS = Duration.ofSeconds(15L); + private static final Duration SEVENTY_SECONDS = Duration.ofSeconds(70L); private static final Duration SIXTY_FIVE_SECONDS = Duration.ofSeconds(65L); private static final Duration TEN_SECONDS = Duration.ofSeconds(10L); - // Required parameters - + private int bufferPageSize = 8192; private String certificateHostNameOverride = null; - - // Optional parameters - + private Duration connectionTimeout = null; + private Duration idleChannelTimeout = Duration.ZERO; + private Duration idleEndpointTimeout = SEVENTY_SECONDS; + private int maxBufferCapacity = 8192 << 10; private int maxChannelsPerEndpoint = 10; private int maxRequestsPerChannel = 30; - private Duration connectionTimeout = null; private int partitionCount = 1; private Duration receiveHangDetectionTime = SIXTY_FIVE_SECONDS; private Duration requestTimeout; private Duration sendHangDetectionTime = TEN_SECONDS; + private Duration shutdownTimeout = FIFTEEN_SECONDS; private UserAgentContainer userAgent = DEFAULT_USER_AGENT_CONTAINER; // endregion @@ -285,9 +333,18 @@ public Builder(int requestTimeoutInSeconds) { // region Methods public Options build() { + checkState(this.bufferPageSize <= this.maxBufferCapacity, "bufferPageSize (%s) > maxBufferCapacity (%s)", + this.bufferPageSize, this.maxBufferCapacity + ); return new Options(this); } + public Builder bufferPageSize(final int value) { + checkArgument(value >= 4096 && (value & (value - 1)) == 0, "value: %s", value); + this.bufferPageSize = value; + return this; + } + public Builder certificateHostNameOverride(final String value) { this.certificateHostNameOverride = value; return this; @@ -299,9 +356,21 @@ public Builder connectionTimeout(final Duration value) { return this; } - public Builder maxRequestsPerChannel(final int value) { - checkArgument(value > 0, "value: %s", value); - this.maxRequestsPerChannel = value; + public Builder idleChannelTimeout(final Duration value) { + checkNotNull(value, "value: null"); + this.idleChannelTimeout = value; + return this; + } + + public Builder idleEndpointTimeout(final Duration value) { + checkArgument(value != null && value.compareTo(Duration.ZERO) > 0, "value: %s", value); + this.idleEndpointTimeout = value; + return this; + } + + public Builder maxBufferCapacity(final int value) { + checkArgument(value > 0 && (value & (value - 1)) == 0, "value: %s", value); + this.maxBufferCapacity = value; return this; } @@ -311,6 +380,12 @@ public Builder maxChannelsPerEndpoint(final int value) { return this; } + public Builder maxRequestsPerChannel(final int value) { + checkArgument(value > 0, "value: %s", value); + this.maxRequestsPerChannel = value; + return this; + } + public Builder partitionCount(final int value) { checkArgument(value > 0, "value: %s", value); this.partitionCount = value; @@ -344,6 +419,15 @@ public Builder sendHangDetectionTime(final Duration value) { return this; } + public Builder shutdownTimeout(final Duration value) { + + checkNotNull(value, "value: null"); + checkArgument(value.compareTo(Duration.ZERO) > 0, "value: %s", value); + + this.shutdownTimeout = value; + return this; + } + public Builder userAgent(final UserAgentContainer value) { checkNotNull(value, "value: null"); this.userAgent = value; diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelHandler.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelHandler.java index c52d3b3fb3f3..5d8fcf81fe1a 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelHandler.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelHandler.java @@ -7,27 +7,31 @@ import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelPipeline; import io.netty.channel.EventLoop; +import io.netty.channel.pool.ChannelHealthChecker; import io.netty.channel.pool.ChannelPool; import io.netty.channel.pool.ChannelPoolHandler; import io.netty.handler.logging.LoggingHandler; -import io.netty.handler.ssl.SslHandler; -import io.netty.handler.timeout.ReadTimeoutHandler; -import io.netty.handler.timeout.WriteTimeoutHandler; +import io.netty.handler.timeout.IdleStateHandler; +import io.netty.util.AttributeKey; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.net.ssl.SSLEngine; import java.util.concurrent.TimeUnit; +import static com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdEndpoint.Config; import static com.google.common.base.Preconditions.checkNotNull; public class RntbdClientChannelHandler extends ChannelInitializer implements ChannelPoolHandler { - private static Logger logger = LoggerFactory.getLogger(RntbdClientChannelHandler.class); - private final RntbdEndpoint.Config config; + private static final AttributeKey REQUEST_MANAGER = AttributeKey.newInstance("requestManager"); + private static final Logger logger = LoggerFactory.getLogger(RntbdClientChannelHandler.class); + private final ChannelHealthChecker healthChecker; + private final Config config; - RntbdClientChannelHandler(final RntbdEndpoint.Config config) { + RntbdClientChannelHandler(final Config config, final ChannelHealthChecker healthChecker) { + checkNotNull(healthChecker, "healthChecker"); checkNotNull(config, "config"); + this.healthChecker = healthChecker; this.config = config; } @@ -74,13 +78,13 @@ public void channelReleased(final Channel channel) { * This method constructs this pipeline: *

{@code
      * ChannelPipeline {
-     *     (ReadTimeoutHandler#0 = io.netty.handler.timeout.ReadTimeoutHandler),
      *     (SslHandler#0 = io.netty.handler.ssl.SslHandler),
-     *     (RntbdContextNegotiator#0 = com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdContextNegotiator),
-     *     (RntbdResponseDecoder#0 = com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdResponseDecoder),
-     *     (RntbdRequestEncoder#0 = com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdRequestEncoder),
-     *     (WriteTimeoutHandler#0 = io.netty.handler.timeout.WriteTimeoutHandler),
-     *     (RntbdRequestManager#0 = com.microsoft.azure.cosmosdb.internal.directconnectivity.rntbd.RntbdRequestManager),
+     *     (IdleTimeoutHandler#0 = io.netty.handler.timeout.IdleTimeoutHandler),
+     *     (LoggingHandler#0 = io.netty.handler.logging.LoggingHandler),  // iff RntbdClientChannelHandler.config.wireLogLevel != null
+     *     (RntbdContextNegotiator#0 = com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdContextNegotiator),
+     *     (RntbdResponseDecoder#0 = com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdResponseDecoder),
+     *     (RntbdRequestEncoder#0 = com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdRequestEncoder),
+     *     (RntbdRequestManager#0 = com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdRequestManager),
      * }
      * }
* @@ -91,28 +95,28 @@ protected void initChannel(final Channel channel) { checkNotNull(channel); - final RntbdRequestManager requestManager = new RntbdRequestManager(this.config.getMaxRequestsPerChannel()); - final long readerIdleTime = this.config.getReceiveHangDetectionTime(); - final long writerIdleTime = this.config.getSendHangDetectionTime(); + final RntbdRequestManager requestManager = new RntbdRequestManager(this.healthChecker, this.config.maxRequestsPerChannel()); + final long readerIdleTime = this.config.receiveHangDetectionTime(); + final long writerIdleTime = this.config.sendHangDetectionTime(); + final long allIdleTime = this.config.idleConnectionTimeout(); final ChannelPipeline pipeline = channel.pipeline(); pipeline.addFirst( - new RntbdContextNegotiator(requestManager, this.config.getUserAgent()), + new RntbdContextNegotiator(requestManager, this.config.userAgent()), new RntbdResponseDecoder(), new RntbdRequestEncoder(), - new WriteTimeoutHandler(writerIdleTime, TimeUnit.NANOSECONDS), requestManager ); - if (this.config.getWireLogLevel() != null) { - pipeline.addFirst(new LoggingHandler(this.config.getWireLogLevel())); + if (this.config.wireLogLevel() != null) { + pipeline.addFirst(new LoggingHandler(this.config.wireLogLevel())); } - final SSLEngine sslEngine = this.config.getSslContext().newEngine(channel.alloc()); - pipeline.addFirst( - new ReadTimeoutHandler(readerIdleTime, TimeUnit.NANOSECONDS), - new SslHandler(sslEngine) + this.config.sslContext().newHandler(channel.alloc()), + new IdleStateHandler(readerIdleTime, writerIdleTime, allIdleTime, TimeUnit.NANOSECONDS) ); + + channel.attr(REQUEST_MANAGER).set(requestManager); } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelHealthChecker.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelHealthChecker.java new file mode 100644 index 000000000000..934e05e4fabc --- /dev/null +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelHealthChecker.java @@ -0,0 +1,285 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.data.cosmos.internal.directconnectivity.rntbd; + +import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdEndpoint.Config; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import io.netty.channel.Channel; +import io.netty.channel.pool.ChannelHealthChecker; +import io.netty.util.concurrent.Future; +import io.netty.util.concurrent.Promise; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.Optional; +import java.util.concurrent.atomic.AtomicLongFieldUpdater; + +import static com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdReporter.reportIssueUnless; +import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; +import static java.util.concurrent.atomic.AtomicLongFieldUpdater.newUpdater; + +@JsonSerialize(using = RntbdClientChannelHealthChecker.JsonSerializer.class) +public final class RntbdClientChannelHealthChecker implements ChannelHealthChecker { + + // region Fields + + private static final Logger logger = LoggerFactory.getLogger(RntbdClientChannelHealthChecker.class); + + // A channel will be declared healthy if a read succeeded recently as defined by this value. + private static final long recentReadWindow = 1_000_000_000L; + + // A channel should not be declared unhealthy if a write succeeded recently. As such gaps between + // Timestamps.lastChannelWrite and Timestamps.lastChannelRead lower than this value are ignored. + // Guidance: The grace period should be large enough to accommodate the round trip time of the slowest server + // request. Assuming 1s of network RTT, a 2 MB request, a 2 MB response, a connection that can sustain 1 MB/s + // both ways, and a 5-second deadline at the server, 10 seconds should be enough. + private static final long readHangGracePeriod = 10L * 1_000_000_000L; + + // A channel will not be declared unhealthy if a write was attempted recently. As such gaps between + // Timestamps.lastChannelWriteAttempt and Timestamps.lastChannelWrite lower than this value are ignored. + // Guidance: The grace period should be large enough to accommodate slow writes. For example, a value of 2s requires + // that the client can sustain data rates of at least 1 MB/s when writing 2 MB documents. + private static final long writeHangGracePeriod = 2L * 1_000_000_000L; + + // A channel is considered idle if: + // idleConnectionTimeout > 0L && System.nanoTime() - Timestamps.lastChannelRead() >= idleConnectionTimeout + private final long idleConnectionTimeout; + + // A channel will be declared unhealthy if the gap between Timestamps.lastChannelWrite and Timestamps.lastChannelRead + // grows beyond this value. + // Constraint: readDelayLimit > readHangGracePeriod + private final long readDelayLimit; + + // A channel will be declared unhealthy if the gap between Timestamps.lastChannelWriteAttempt and Timestamps.lastChannelWrite + // grows beyond this value. + // Constraint: writeDelayLimit > writeHangGracePeriod + private final long writeDelayLimit; + + // endregion + + // region Constructors + + public RntbdClientChannelHealthChecker(final Config config) { + + checkNotNull(config, "config: null"); + + this.idleConnectionTimeout = config.idleConnectionTimeout(); + + this.readDelayLimit = config.receiveHangDetectionTime(); + checkArgument(this.readDelayLimit > readHangGracePeriod, "config.receiveHangDetectionTime: %s", this.readDelayLimit); + + this.writeDelayLimit = config.sendHangDetectionTime(); + checkArgument(this.writeDelayLimit > writeHangGracePeriod, "config.sendHangDetectionTime: %s", this.writeDelayLimit); + } + + // endregion + + // region Methods + + public long idleConnectionTimeout() { + return this.idleConnectionTimeout; + } + + public long readDelayLimit() { + return this.readDelayLimit; + } + + public long writeDelayLimit() { + return this.writeDelayLimit; + } + + public Future isHealthy(final Channel channel) { + + checkNotNull(channel, "channel: null"); + + final RntbdRequestManager requestManager = channel.pipeline().get(RntbdRequestManager.class); + final Promise promise = channel.eventLoop().newPromise(); + + if (requestManager == null) { + reportIssueUnless(logger, !channel.isActive(), channel, "active with no request manager"); + return promise.setSuccess(Boolean.FALSE); + } + + final Timestamps timestamps = requestManager.snapshotTimestamps(); + final long currentTime = System.nanoTime(); + + if (currentTime - timestamps.lastChannelRead() < recentReadWindow) { + return promise.setSuccess(Boolean.TRUE); // because we recently received data + } + + // Black hole detection, part 1: + // Treat the channel as unhealthy if the gap between the last attempted write and the last successful write + // grew beyond acceptable limits, unless a write was attempted recently. This is a sign of a hung write. + + final long writeDelay = timestamps.lastChannelWriteAttempt() - timestamps.lastChannelWrite(); + + if (writeDelay > this.writeDelayLimit && currentTime - timestamps.lastChannelWriteAttempt() > writeHangGracePeriod) { + + final Optional rntbdContext = requestManager.rntbdContext(); + final int pendingRequestCount = requestManager.pendingRequestCount(); + + logger.warn("{} health check failed due to hung write: {lastChannelWriteAttempt: {}, lastChannelWrite: {}, " + + "writeDelay: {}, writeDelayLimit: {}, rntbdContext: {}, pendingRequestCount: {}}", channel, + timestamps.lastChannelWriteAttempt(), timestamps.lastChannelWrite(), writeDelay, + this.writeDelayLimit, rntbdContext, pendingRequestCount); + + return promise.setSuccess(Boolean.FALSE); + } + + // Black hole detection, part 2: + // Treat the connection as unhealthy if the gap between the last successful write and the last successful read + // grew beyond acceptable limits, unless a write succeeded recently. This is a sign of a hung read. + + final long readDelay = timestamps.lastChannelWrite() - timestamps.lastChannelRead(); + + if (readDelay > this.readDelayLimit && currentTime - timestamps.lastChannelWrite() > readHangGracePeriod) { + + final Optional rntbdContext = requestManager.rntbdContext(); + final int pendingRequestCount = requestManager.pendingRequestCount(); + + logger.warn("{} health check failed due to hung read: {lastChannelWrite: {}, lastChannelRead: {}, " + + "readDelay: {}, readDelayLimit: {}, rntbdContext: {}, pendingRequestCount: {}}", channel, + timestamps.lastChannelWrite(), timestamps.lastChannelRead(), readDelay, + this.readDelayLimit, rntbdContext, pendingRequestCount); + + return promise.setSuccess(Boolean.FALSE); + } + + if (this.idleConnectionTimeout > 0L) { + if (currentTime - timestamps.lastChannelRead() > this.idleConnectionTimeout) { + return promise.setSuccess(Boolean.FALSE); + } + } + + channel.writeAndFlush(RntbdHealthCheckRequest.MESSAGE).addListener(completed -> { + if (completed.isSuccess()) { + promise.setSuccess(Boolean.TRUE); + } else { + logger.warn("{} health check request failed due to:", channel, completed.cause()); + promise.setSuccess(Boolean.FALSE); + } + }); + + return promise; + } + + @Override + public String toString() { + return RntbdObjectMapper.toString(this); + } + + // endregion + + // region Types + + static final class JsonSerializer extends StdSerializer { + + JsonSerializer() { + super(RntbdClientChannelHealthChecker.class); + } + + @Override + public void serialize(RntbdClientChannelHealthChecker value, JsonGenerator generator, SerializerProvider provider) throws IOException { + generator.writeStartObject(); + generator.writeNumberField("idleConnectionTimeout", value.idleConnectionTimeout()); + generator.writeNumberField("readDelayLimit", value.readDelayLimit()); + generator.writeNumberField("writeDelayLimit", value.writeDelayLimit()); + generator.writeEndObject(); + } + } + + @JsonSerialize(using = Timestamps.JsonSerializer.class) + static final class Timestamps { + + private static final AtomicLongFieldUpdater lastPingUpdater = + newUpdater(Timestamps.class, "lastPing"); + + private static final AtomicLongFieldUpdater lastReadUpdater = + newUpdater(Timestamps.class, "lastRead"); + + private static final AtomicLongFieldUpdater lastWriteUpdater = + newUpdater(Timestamps.class, "lastWrite"); + + private static final AtomicLongFieldUpdater lastWriteAttemptUpdater = + newUpdater(Timestamps.class, "lastWriteAttempt"); + + private volatile long lastPing; + private volatile long lastRead; + private volatile long lastWrite; + private volatile long lastWriteAttempt; + + public Timestamps() { + } + + @SuppressWarnings("CopyConstructorMissesField") + public Timestamps(Timestamps other) { + checkNotNull(other, "other: null"); + this.lastPing = lastPingUpdater.get(other); + this.lastRead = lastReadUpdater.get(other); + this.lastWrite = lastWriteUpdater.get(other); + this.lastWriteAttempt = lastWriteAttemptUpdater.get(other); + } + + public void channelPingCompleted() { + lastPingUpdater.set(this, System.nanoTime()); + } + + public void channelReadCompleted() { + lastReadUpdater.set(this, System.nanoTime()); + } + + public void channelWriteAttempted() { + lastWriteUpdater.set(this, System.nanoTime()); + } + + public void channelWriteCompleted() { + lastWriteAttemptUpdater.set(this, System.nanoTime()); + } + + public long lastChannelPing() { + return lastPingUpdater.get(this); + } + + public long lastChannelRead() { + return lastReadUpdater.get(this); + } + + public long lastChannelWrite() { + return lastWriteUpdater.get(this); + } + + public long lastChannelWriteAttempt() { + return lastWriteAttemptUpdater.get(this); + } + + @Override + public String toString() { + return "RntbdClientChannelHealthChecker.Timestamps(" + RntbdObjectMapper.toJson(this) + ')'; + } + + static final class JsonSerializer extends StdSerializer { + + JsonSerializer() { + super(Timestamps.class); + } + + @Override + public void serialize(Timestamps value, JsonGenerator generator, SerializerProvider provider) throws IOException { + generator.writeStartObject(); + generator.writeNumberField("lastChannelPing", value.lastChannelPing()); + generator.writeNumberField("lastChannelRead", value.lastChannelRead()); + generator.writeNumberField("lastChannelWrite", value.lastChannelWrite()); + generator.writeNumberField("lastChannelWriteAttempt", value.lastChannelWriteAttempt()); + generator.writeEndObject(); + } + } + } + + // endregion +} diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelPool.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelPool.java index cb3fa29561fe..54443ae53d8f 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelPool.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelPool.java @@ -3,87 +3,179 @@ package com.azure.data.cosmos.internal.directconnectivity.rntbd; +import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdEndpoint.Config; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.StdSerializer; import io.netty.bootstrap.Bootstrap; +import io.netty.buffer.PooledByteBufAllocatorMetric; import io.netty.channel.Channel; -import io.netty.channel.pool.ChannelHealthChecker; -import io.netty.channel.pool.FixedChannelPool; +import io.netty.channel.ChannelPipeline; +import io.netty.channel.pool.ChannelPool; +import io.netty.channel.pool.SimpleChannelPool; +import io.netty.util.concurrent.EventExecutor; import io.netty.util.concurrent.Future; +import io.netty.util.concurrent.FutureListener; +import io.netty.util.concurrent.GlobalEventExecutor; import io.netty.util.concurrent.Promise; -import org.apache.commons.lang3.reflect.FieldUtils; +import io.netty.util.internal.ThrowableUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; -import java.lang.reflect.Field; import java.net.SocketAddress; +import java.nio.channels.ClosedChannelException; +import java.time.Duration; +import java.util.ArrayDeque; +import java.util.Queue; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicReference; -import static com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdReporter.reportIssue; import static com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdReporter.reportIssueUnless; import static com.google.common.base.Preconditions.checkState; +/** + * {@link ChannelPool} implementation that enforces a maximum number of concurrent direct TCP Cosmos connections + */ @JsonSerialize(using = RntbdClientChannelPool.JsonSerializer.class) -public final class RntbdClientChannelPool extends FixedChannelPool { +public final class RntbdClientChannelPool extends SimpleChannelPool { - // region Fields + private static final TimeoutException ACQUISITION_TIMEOUT = ThrowableUtil.unknownStackTrace( + new TimeoutException("Acquisition took longer than the configured maximum time"), + RntbdClientChannelPool.class, ""); + + private static final ClosedChannelException CHANNEL_CLOSED_ON_ACQUIRE = ThrowableUtil.unknownStackTrace( + new ClosedChannelException(), RntbdClientChannelPool.class, "acquire0(...)"); + + private static final IllegalStateException POOL_CLOSED_ON_ACQUIRE = ThrowableUtil.unknownStackTrace( + new IllegalStateException("RntbdClientChannelPool was closed"), + RntbdClientChannelPool.class, "acquire0"); + + private static final IllegalStateException POOL_CLOSED_ON_RELEASE = ThrowableUtil.unknownStackTrace( + new IllegalStateException("RntbdClientChannelPool was closed"), + RntbdClientChannelPool.class, "release"); + + private static final IllegalStateException TOO_MANY_PENDING_ACQUISITIONS = ThrowableUtil.unknownStackTrace( + new IllegalStateException("Too many outstanding acquire operations"), + RntbdClientChannelPool.class, "acquire0"); private static final Logger logger = LoggerFactory.getLogger(RntbdClientChannelPool.class); - private static final AtomicReference pendingAcquireCount = new AtomicReference<>(); - private final AtomicInteger availableChannelCount; - private final AtomicBoolean closed; + private final long acquisitionTimeoutNanos; + private final PooledByteBufAllocatorMetric allocatorMetric; + private final EventExecutor executor; + private final ScheduledFuture idleStateDetectionScheduledFuture; private final int maxChannels; + private final int maxPendingAcquisitions; private final int maxRequestsPerChannel; - // endregion + // No need to worry about synchronization as everything that modified the queue or counts is done by this.executor - // region Methods + private final Queue pendingAcquisitionQueue = new ArrayDeque(); + private final Runnable acquisitionTimeoutTask; + + // Because these values can be requested on any thread... + + private final AtomicInteger acquiredChannelCount = new AtomicInteger(); + private final AtomicInteger availableChannelCount = new AtomicInteger(); + private final AtomicBoolean closed = new AtomicBoolean(); /** * Initializes a newly created {@link RntbdClientChannelPool} object - * - * @param bootstrap the {@link Bootstrap} that is used for connections - * @param config the {@link RntbdEndpoint.Config} that is used for the channel pool instance created + * @param bootstrap the {@link Bootstrap} that is used for connections + * @param config the {@link Config} that is used for the channel pool instance created */ - RntbdClientChannelPool(final Bootstrap bootstrap, final RntbdEndpoint.Config config) { + RntbdClientChannelPool(final RntbdServiceEndpoint endpoint, final Bootstrap bootstrap, final Config config) { + this(endpoint, bootstrap, config, new RntbdClientChannelHealthChecker(config)); + } - super(bootstrap, new RntbdClientChannelHandler(config), ChannelHealthChecker.ACTIVE, null, - -1L, config.getMaxChannelsPerEndpoint(), Integer.MAX_VALUE, true - ); + private RntbdClientChannelPool( + final RntbdServiceEndpoint endpoint, final Bootstrap bootstrap, final Config config, + final RntbdClientChannelHealthChecker healthChecker + ) { + + super(bootstrap, new RntbdClientChannelHandler(config, healthChecker), healthChecker, true, true); + + this.allocatorMetric = config.allocator().metric(); + this.executor = bootstrap.config().group().next(); + this.maxChannels = config.maxChannelsPerEndpoint(); + this.maxPendingAcquisitions = Integer.MAX_VALUE; + this.maxRequestsPerChannel = config.maxRequestsPerChannel(); + + // TODO: DANOBLE: Add RntbdEndpoint.Config settings for acquisition timeout and acquisition timeout action + // Alternatively: drop acquisition timeout and acquisition timeout action + // Decision should be based on performance, reliability, and usability considerations + + final AcquisitionTimeoutAction acquisitionTimeoutAction = null; + final long acquisitionTimeoutNanos = -1L; + + if (acquisitionTimeoutAction == null) { + + this.acquisitionTimeoutNanos = -1L; + this.acquisitionTimeoutTask = null; + + } else { + + this.acquisitionTimeoutNanos = acquisitionTimeoutNanos; + + switch (acquisitionTimeoutAction) { + case FAIL: + this.acquisitionTimeoutTask = new AcquireTimeoutTask(this) { + @Override + public void onTimeout(AcquireTask task) { + task.promise.setFailure(ACQUISITION_TIMEOUT); + } + }; + break; + case NEW: + this.acquisitionTimeoutTask = new AcquireTimeoutTask(this) { + @Override + public void onTimeout(AcquireTask task) { + // Increment the acquire count and get a new Channel by delegating to super.acquire + task.acquired(); + RntbdClientChannelPool.super.acquire(task.promise); + } + }; + break; + default: + throw new Error(); + } + } - this.maxRequestsPerChannel = config.getMaxRequestsPerChannel(); - this.maxChannels = config.getMaxChannelsPerEndpoint(); - this.availableChannelCount = new AtomicInteger(); - this.closed = new AtomicBoolean(); - } + final long idleEndpointTimeout = config.idleEndpointTimeout(); - @Override - public Future acquire(Promise promise) { - this.throwIfClosed(); - return super.acquire(promise); - } + this.idleStateDetectionScheduledFuture = this.executor.scheduleAtFixedRate( + () -> { - @Override - public Future release(Channel channel, Promise promise) { - this.throwIfClosed(); - return super.release(channel, promise); + final long currentTime = System.nanoTime(); + final long lastRequestTime = endpoint.lastRequestTime(); + final long elapsedTime = currentTime - lastRequestTime; + + if (elapsedTime > idleEndpointTimeout) { + + if (logger.isWarnEnabled()) { + logger.warn( + "{} closing due to inactivity (time elapsed since last request: {} > idleEndpointTimeout: {})", + endpoint, Duration.ofNanos(elapsedTime), Duration.ofNanos(idleEndpointTimeout)); + } + + endpoint.close(); + } + + }, idleEndpointTimeout, idleEndpointTimeout, TimeUnit.NANOSECONDS); } - @Override - public void close() { - if (this.closed.compareAndSet(false, true)) { - this.availableChannelCount.set(0); - super.close(); - } + // region Accessors + + public int channelsAcquired() { + return this.acquiredChannelCount.get(); } - public int availableChannelCount() { + public int channelsAvailable() { return this.availableChannelCount.get(); } @@ -95,38 +187,125 @@ public int maxRequestsPerChannel() { return this.maxRequestsPerChannel; } - public int pendingAcquisitionCount() { + public SocketAddress remoteAddress() { + return this.bootstrap().config().remoteAddress(); + } - Field field = pendingAcquireCount.get(); + public int requestQueueLength() { + return this.pendingAcquisitionQueue.size(); + } - if (field == null) { - synchronized (pendingAcquireCount) { - field = pendingAcquireCount.get(); - if (field == null) { - field = FieldUtils.getDeclaredField(FixedChannelPool.class, "pendingAcquireCount", true); - pendingAcquireCount.set(field); - } + public long usedDirectMemory() { + return this.allocatorMetric.usedDirectMemory(); + } + + public long usedHeapMemory() { + return this.allocatorMetric.usedHeapMemory(); + } + + // endregion + + // region Methods + + public boolean isClosed() { + return this.closed.get(); + } + + @Override + public Future acquire(final Promise promise) { + + this.throwIfClosed(); + + try { + if (this.executor.inEventLoop()) { + this.acquire0(promise); + } else { + this.executor.execute(() -> this.acquire0(promise)); } + } catch (Throwable cause) { + promise.setFailure(cause); } - try { - return (int)FieldUtils.readField(field, this); - } catch (IllegalAccessException error) { - reportIssue(logger, this, "could not access field due to ", error); + return promise; + } + + @Override + public void close() { + if (this.closed.compareAndSet(false, true)) { + if (this.executor.inEventLoop()) { + this.close0(); + } else { + this.executor.submit(this::close0).awaitUninterruptibly(); + } } + } - return -1; + @Override + public Future release(final Channel channel, final Promise promise) { + + // We do not call this.throwIfClosed because a channel may be released back to the pool during close + + super.release(channel, this.executor.newPromise().addListener((FutureListener)future -> { + + checkState(this.executor.inEventLoop()); + + if (this.isClosed()) { + // Since the pool is closed, we have no choice but to close the channel + promise.setFailure(POOL_CLOSED_ON_RELEASE); + channel.close(); + return; + } + + if (future.isSuccess()) { + + this.decrementAndRunTaskQueue(); + promise.setSuccess(null); + + } else { + + final Throwable cause = future.cause(); + + if (!(cause instanceof IllegalArgumentException)) { + this.decrementAndRunTaskQueue(); + } + + promise.setFailure(cause); + } + })); + + return promise; + } + + @Override + public String toString() { + return RntbdObjectMapper.toString(this); + } + + /** + * Offer a {@link Channel} back to the internal storage + *

+ * Maintainers: Implementations of this method must be thread-safe. + * + * @param channel the {@link Channel} to return to internal storage + * @return {@code true}, if the {@link Channel} could be added to internal storage; otherwise {@code false} + */ + @Override + protected boolean offerChannel(final Channel channel) { + if (super.offerChannel(channel)) { + this.availableChannelCount.incrementAndGet(); + return true; + } + return false; } /** * Poll a {@link Channel} out of internal storage to reuse it *

- * Maintainers: Implementations of this method must be thread-safe and this type's base class, {@link FixedChannelPool}, - * ensures thread safety. It does this by calling this method serially on a single-threaded EventExecutor. As a - * result this method need not (and should not) be synchronized. + * Maintainers: Implementations of this method must be thread-safe and this type ensures thread safety by calling + * this method serially on a single-threaded EventExecutor. As a result this method need not (and should not) be + * synchronized. * * @return a value of {@code null}, if no {@link Channel} is ready to be reused - * * @see #acquire(Promise) */ @Override @@ -138,18 +317,18 @@ protected Channel pollChannel() { return null; } - if (this.closed.get()) { - return first; // because we're being called following a call to close (from super.close) + if (this.isClosed()) { + return first; // because this.close -> this.close0 -> super.close -> this.pollChannel } - if (this.isInactiveOrServiceableChannel(first)) { + if (this.isServiceableOrInactiveChannel(first)) { return this.decrementAvailableChannelCountAndAccept(first); } super.offerChannel(first); // because we need a non-null sentinel to stop the search for a channel for (Channel next = super.pollChannel(); next != first; super.offerChannel(next), next = super.pollChannel()) { - if (this.isInactiveOrServiceableChannel(next)) { + if (this.isServiceableOrInactiveChannel(next)) { return this.decrementAvailableChannelCountAndAccept(next); } } @@ -158,42 +337,102 @@ protected Channel pollChannel() { return null; } - /** - * Offer a {@link Channel} back to the internal storage - *

- * Maintainers: Implementations of this method must be thread-safe. - * - * @param channel the {@link Channel} to return to internal storage - * @return {@code true}, if the {@link Channel} could be added to internal storage; otherwise {@code false} - */ - @Override - protected boolean offerChannel(final Channel channel) { - if (super.offerChannel(channel)) { - this.availableChannelCount.incrementAndGet(); - return true; + // endregion + + // region Privates + + private void acquire0(final Promise promise) { + + checkState(this.executor.inEventLoop()); + + if (this.isClosed()) { + promise.setFailure(POOL_CLOSED_ON_ACQUIRE); + return; } - return false; - } - public SocketAddress remoteAddress() { - return this.bootstrap().config().remoteAddress(); + if (this.acquiredChannelCount.get() < this.maxChannels) { + + // We need to create a new promise to ensure the AcquireListener runs in the correct event loop + + checkState(this.acquiredChannelCount.get() >= 0); + + final AcquireListener l = new AcquireListener(this, promise); + l.acquired(); + + final Promise p = this.executor.newPromise(); + p.addListener(l); + + super.acquire(p); // acquire an existing channel or create and acquire a new channel + + } else { + + if (this.pendingAcquisitionQueue.size() >= this.maxPendingAcquisitions) { + + promise.setFailure(TOO_MANY_PENDING_ACQUISITIONS); + + } else { + + // Add a task to the pending acquisition queue and we'll satisfy the request later + + AcquireTask task = new AcquireTask(this, promise); + + if (this.pendingAcquisitionQueue.offer(task)) { + + if (acquisitionTimeoutTask != null) { + task.timeoutFuture = executor.schedule(acquisitionTimeoutTask, acquisitionTimeoutNanos, TimeUnit.NANOSECONDS); + } + + } else { + promise.setFailure(TOO_MANY_PENDING_ACQUISITIONS); + } + } + + checkState(this.pendingAcquisitionQueue.size() > 0); + } } - @Override - public String toString() { - return "RntbdClientChannelPool(" + RntbdObjectMapper.toJson(this) + ")"; + private void close0() { + + checkState(this.executor.inEventLoop()); + + this.idleStateDetectionScheduledFuture.cancel(false); + this.acquiredChannelCount.set(0); + this.availableChannelCount.set(0); + + for (; ; ) { + final AcquireTask task = this.pendingAcquisitionQueue.poll(); + if (task == null) { + break; + } + final ScheduledFuture timeoutFuture = task.timeoutFuture; + if (timeoutFuture != null) { + timeoutFuture.cancel(false); + } + task.promise.setFailure(new ClosedChannelException()); + } + + // Ensure we dispatch this on another Thread as close0 will be called from the EventExecutor and we need + // to ensure we will not block in an EventExecutor + + GlobalEventExecutor.INSTANCE.execute(RntbdClientChannelPool.super::close); } - // endregion + private void decrementAndRunTaskQueue() { - // region Privates + checkState(acquiredChannelCount.decrementAndGet() >= 0); + + // Run the pending acquisition tasks before notifying the original promise so that if the user tries to + // acquire again from the ChannelFutureListener and the pendingChannelAcquisitionCount is greater than + // maxPendingAcquisitions we may be able to run some pending tasks first and so allow to add more + runTaskQueue(); + } private Channel decrementAvailableChannelCountAndAccept(final Channel first) { this.availableChannelCount.decrementAndGet(); return first; } - private boolean isInactiveOrServiceableChannel(final Channel channel) { + private boolean isServiceableOrInactiveChannel(final Channel channel) { if (!channel.isActive()) { return true; @@ -202,44 +441,236 @@ private boolean isInactiveOrServiceableChannel(final Channel channel) { final RntbdRequestManager requestManager = channel.pipeline().get(RntbdRequestManager.class); if (requestManager == null) { - reportIssueUnless(!channel.isActive(), logger, this, "{} active with no request manager", channel); + reportIssueUnless(logger, !channel.isActive(), channel, "active with no request manager"); return true; // inactive } - return requestManager.isServiceable(this.maxRequestsPerChannel); + return requestManager.isServiceable(1 /* this.maxRequestsPerChannel */); + } + + private void runTaskQueue() { + + while (this.acquiredChannelCount.get() < this.maxChannels) { + + final AcquireTask task = this.pendingAcquisitionQueue.poll(); + + if (task == null) { + break; + } + + final ScheduledFuture timeoutFuture = task.timeoutFuture; + + if (timeoutFuture != null) { + timeoutFuture.cancel(false); + } + + task.acquired(); + + super.acquire(task.promise); + } + + checkState(this.acquiredChannelCount.get() >= 0); // we should never have negative values } private void throwIfClosed() { - checkState(!this.closed.get(), "%s is closed", this); + checkState(!this.isClosed(), "%s is closed", this); } // endregion // region Types - static final class JsonSerializer extends StdSerializer { + private enum AcquisitionTimeoutAction { + + /** + * Create a new connection when the timeout is detected. + */ + NEW, + + /** + * Fail the {@link Future} of the acquire call with a {@link TimeoutException}. + */ + FAIL + } + + private static class AcquireListener implements FutureListener { + + private final Promise originalPromise; + private final RntbdClientChannelPool pool; + private boolean acquired; + + AcquireListener(RntbdClientChannelPool pool, Promise originalPromise) { + this.originalPromise = originalPromise; + this.pool = pool; + } + + public void acquired() { + if (this.acquired) { + return; + } + this.pool.acquiredChannelCount.incrementAndGet(); + this.acquired = true; + } + + @Override + public void operationComplete(Future future) { + + checkState(this.pool.executor.inEventLoop()); + + if (this.pool.isClosed()) { + if (future.isSuccess()) { + // Since the pool is closed, we have no choice but to close the channel + future.getNow().close(); + } + this.originalPromise.setFailure(POOL_CLOSED_ON_ACQUIRE); + return; + } + + if (future.isSuccess()) { + + // Ensure that the channel is active and ready to receive requests + // A Direct TCP channel is ready to receive requests when it: + // * is active and + // * has an RntbdContext + // We send a health check request on a channel without an RntbdContext to force: + // 1. SSL negotiation + // 2. RntbdContextRequest -> RntbdContext + // 3. RntbdHealthCheckRequest -> receive acknowledgement + + final Channel channel = future.getNow(); + + channel.eventLoop().execute(() -> { + + if (!channel.isActive()) { + this.fail(CHANNEL_CLOSED_ON_ACQUIRE); + return; + } + + final ChannelPipeline pipeline = channel.pipeline(); + checkState(pipeline != null); + + final RntbdRequestManager requestManager = pipeline.get(RntbdRequestManager.class); + checkState(requestManager != null); + + if (requestManager.hasRequestedRntbdContext()) { + + this.originalPromise.setSuccess(channel); + + } else { + + channel.writeAndFlush(RntbdHealthCheckRequest.MESSAGE).addListener(completed -> { + + if (completed.isSuccess()) { + + reportIssueUnless(logger, this.acquired && requestManager.hasRntbdContext(), + channel,"acquired: {}, rntbdContext: {}", this.acquired, + requestManager.rntbdContext()); + + this.originalPromise.setSuccess(channel); + + } else { + + logger.warn("Channel({}) health check request failed due to:", channel, completed.cause()); + this.fail(completed.cause()); + } + }); + } + }); + + } else { + logger.warn("channel acquisition failed due to:", future.cause()); + this.fail(future.cause()); + } + } + + private void fail(Throwable cause) { + if (this.acquired) { + this.pool.decrementAndRunTaskQueue(); + } else { + this.pool.runTaskQueue(); + } + this.originalPromise.setFailure(cause); + } + } + + private static final class AcquireTask extends AcquireListener { + + // AcquireTask extends AcquireListener to reduce object creations and so GC pressure + + final long expireNanoTime; + final Promise promise; + + ScheduledFuture timeoutFuture; + + AcquireTask(RntbdClientChannelPool pool, Promise promise) { + // We need to create a new promise to ensure the AcquireListener runs in the correct event loop + super(pool, promise); + this.promise = pool.executor.newPromise().addListener(this); + this.expireNanoTime = System.nanoTime() + pool.acquisitionTimeoutNanos; + } + } + + private static abstract class AcquireTimeoutTask implements Runnable { + + final RntbdClientChannelPool pool; - public JsonSerializer() { - this(null); + public AcquireTimeoutTask(RntbdClientChannelPool pool) { + this.pool = pool; } - public JsonSerializer(Class type) { - super(type); + public abstract void onTimeout(AcquireTask task); + + @Override + public final void run() { + + checkState(this.pool.executor.inEventLoop()); + final long nanoTime = System.nanoTime(); + + for (; ; ) { + AcquireTask task = this.pool.pendingAcquisitionQueue.peek(); + // Compare nanoTime as described in the System.nanoTime documentation + // See: + // * https://docs.oracle.com/javase/7/docs/api/java/lang/System.html#nanoTime() + // * https://github.com/netty/netty/issues/3705 + if (task == null || nanoTime - task.expireNanoTime < 0) { + break; + } + this.pool.pendingAcquisitionQueue.remove(); + this.onTimeout(task); + } + } + } + + static final class JsonSerializer extends StdSerializer { + + JsonSerializer() { + super(RntbdClientChannelPool.class); } @Override - public void serialize(RntbdClientChannelPool value, JsonGenerator generator, SerializerProvider provider) throws IOException { + public void serialize(final RntbdClientChannelPool value, final JsonGenerator generator, final SerializerProvider provider) throws IOException { + + RntbdClientChannelHealthChecker healthChecker = (RntbdClientChannelHealthChecker)value.healthChecker(); + generator.writeStartObject(); - generator.writeStringField("remoteAddress", value.remoteAddress().toString()); + generator.writeBooleanField("isClosed", value.isClosed()); + generator.writeObjectFieldStart("configuration"); generator.writeNumberField("maxChannels", value.maxChannels()); generator.writeNumberField("maxRequestsPerChannel", value.maxRequestsPerChannel()); + generator.writeNumberField("idleConnectionTimeout", healthChecker.idleConnectionTimeout()); + generator.writeNumberField("readDelayLimit", healthChecker.readDelayLimit()); + generator.writeNumberField("writeDelayLimit", healthChecker.writeDelayLimit()); + generator.writeEndObject(); generator.writeObjectFieldStart("state"); - generator.writeBooleanField("isClosed", value.closed.get()); - generator.writeNumberField("acquiredChannelCount", value.acquiredChannelCount()); - generator.writeNumberField("availableChannelCount", value.availableChannelCount()); - generator.writeNumberField("pendingAcquisitionCount", value.pendingAcquisitionCount()); + generator.writeNumberField("channelsAcquired", value.channelsAcquired()); + generator.writeNumberField("channelsAvailable", value.channelsAvailable()); + generator.writeNumberField("requestQueueLength", value.requestQueueLength()); + generator.writeNumberField("usedDirectMemory", value.usedDirectMemory()); + generator.writeNumberField("usedHeapMemory", value.usedHeapMemory()); generator.writeEndObject(); generator.writeEndObject(); } } + + // endregion } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdConstants.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdConstants.java index 6933093496fc..f80162c545ed 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdConstants.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdConstants.java @@ -3,6 +3,7 @@ package com.azure.data.cosmos.internal.directconnectivity.rntbd; +import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; @@ -618,7 +619,7 @@ public static RntbdResourceType fromId(final short id) throws IllegalArgumentExc case 0x001D: return RntbdResourceType.UserDefinedType; } - throw new IllegalArgumentException(String.format("id: %d", id)); + throw new IllegalArgumentException(Strings.lenientFormat("id: %s", id)); } public short id() { diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContext.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContext.java index 65aa87d375d3..6c3f56776908 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContext.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContext.java @@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.node.ObjectNode; import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.HttpResponseStatus; import java.util.Collections; @@ -20,65 +21,81 @@ public final class RntbdContext { - private final RntbdResponseStatus frame; - private final Headers headers; - private ServerProperties serverProperties; + private final UUID activityId; + private final HttpResponseStatus status; + private final String clientVersion; + private final long idleTimeoutInSeconds; + private final int protocolVersion; + private final ServerProperties serverProperties; + private final long unauthenticatedTimeoutInSeconds; - private RntbdContext(final RntbdResponseStatus frame, final Headers headers) { - this.frame = frame; - this.headers = headers; + private RntbdContext(final RntbdResponseStatus responseStatus, final Headers headers) { + + this.activityId = responseStatus.getActivityId(); + this.status = responseStatus.getStatus(); + + this.clientVersion = headers.clientVersion.getValue(String.class); + this.idleTimeoutInSeconds = headers.idleTimeoutInSeconds.getValue(Long.class); + this.protocolVersion = headers.protocolVersion.getValue(Long.class).intValue(); + this.unauthenticatedTimeoutInSeconds = headers.unauthenticatedTimeoutInSeconds.getValue(Long.class); + + this.serverProperties = new ServerProperties( + headers.serverAgent.getValue(String.class), headers.serverVersion.getValue(String.class) + ); } @JsonProperty - public UUID getActivityId() { - return this.frame.getActivityId(); + public UUID activityId() { + return this.activityId; } @JsonProperty - public String getClientVersion() { - return this.headers.clientVersion.getValue(String.class); + public String clientVersion() { + return this.clientVersion; } @JsonProperty - public long getIdleTimeoutInSeconds() { - return this.headers.idleTimeoutInSeconds.getValue(Long.class); + public long idleTimeoutInSeconds() { + return this.idleTimeoutInSeconds; } @JsonProperty - public int getProtocolVersion() { - return this.headers.protocolVersion.getValue(Long.class).intValue(); + public int protocolVersion() { + return this.protocolVersion; } @JsonProperty - public ServerProperties getServerProperties() { - return this.serverProperties == null ? (this.serverProperties = new ServerProperties( - this.headers.serverAgent.getValue(String.class), - this.headers.serverVersion.getValue(String.class)) - ) : this.serverProperties; + public ServerProperties serverProperties() { + return this.serverProperties; } @JsonIgnore - public String getServerVersion() { - return this.headers.serverVersion.getValue(String.class); + public String serverVersion() { + return this.serverProperties.getVersion(); + } + + @JsonIgnore + public HttpResponseStatus status() { + return this.status; } @JsonProperty public int getStatusCode() { - return this.frame.getStatusCode(); + return this.status.code(); } @JsonProperty public long getUnauthenticatedTimeoutInSeconds() { - return this.headers.unauthenticatedTimeoutInSeconds.getValue(Long.class); + return this.unauthenticatedTimeoutInSeconds; } public static RntbdContext decode(final ByteBuf in) { in.markReaderIndex(); - final RntbdResponseStatus frame = RntbdResponseStatus.decode(in); - final int statusCode = frame.getStatusCode(); - final int headersLength = frame.getHeadersLength(); + final RntbdResponseStatus responseStatus = RntbdResponseStatus.decode(in); + final int statusCode = responseStatus.getStatusCode(); + final int headersLength = responseStatus.getHeadersLength(); if (statusCode < 200 || statusCode >= 400) { if (!RntbdFramer.canDecodePayload(in, in.readerIndex() + headersLength)) { @@ -110,21 +127,31 @@ public static RntbdContext decode(final ByteBuf in) { map.put("serverVersion", headers.serverVersion.getValue()); } - throw new RntbdContextException(frame.getStatus(), details, Collections.unmodifiableMap(map)); - } + headers.releaseBuffers(); + throw new RntbdContextException(responseStatus.getStatus(), details, Collections.unmodifiableMap(map)); - return new RntbdContext(frame, headers); + } else { + RntbdContext context = new RntbdContext(responseStatus, headers); + headers.releaseBuffers(); + return context; + } } public void encode(final ByteBuf out) { + final Headers headers = new Headers(this); + final int length = RntbdResponseStatus.LENGTH + headers.computeLength(); + final RntbdResponseStatus responseStatus = new RntbdResponseStatus(length, this.status(), this.activityId()); + final int start = out.writerIndex(); - this.frame.encode(out); - this.headers.encode(out); + responseStatus.encode(out); + headers.encode(out); + headers.releaseBuffers(); + + final int end = out.writerIndex(); - final int length = out.writerIndex() - start; - checkState(length == this.frame.getLength()); + checkState(end - start == responseStatus.getLength()); } public static RntbdContext from(final RntbdContextRequest request, final ServerProperties properties, final HttpResponseStatus status) { @@ -134,7 +161,7 @@ public static RntbdContext from(final RntbdContextRequest request, final ServerP // In its current form this method is meant to enable a limited set of test scenarios. It will be revised as // required to support test scenarios as they are developed. - final Headers headers = new Headers(); + final Headers headers = new Headers(Unpooled.EMPTY_BUFFER); headers.clientVersion.setValue(request.getClientVersion()); headers.idleTimeoutInSeconds.setValue(0); @@ -146,29 +173,37 @@ public static RntbdContext from(final RntbdContextRequest request, final ServerP final int length = RntbdResponseStatus.LENGTH + headers.computeLength(); final UUID activityId = request.getActivityId(); - final RntbdResponseStatus frame = new RntbdResponseStatus(length, status, activityId); + final RntbdResponseStatus responseStatus = new RntbdResponseStatus(length, status, activityId); - return new RntbdContext(frame, headers); + return new RntbdContext(responseStatus, headers); } @Override public String toString() { - return RntbdObjectMapper.toJson(this); + return RntbdObjectMapper.toString(this); } private static final class Headers extends RntbdTokenStream { - RntbdToken clientVersion; - RntbdToken idleTimeoutInSeconds; - RntbdToken protocolVersion; - RntbdToken serverAgent; - RntbdToken serverVersion; - RntbdToken unauthenticatedTimeoutInSeconds; - - Headers() { - - super(RntbdContextHeader.set, RntbdContextHeader.map); + final RntbdToken clientVersion; + final RntbdToken idleTimeoutInSeconds; + final RntbdToken protocolVersion; + final RntbdToken serverAgent; + final RntbdToken serverVersion; + final RntbdToken unauthenticatedTimeoutInSeconds; + + private Headers(final RntbdContext context) { + this(Unpooled.EMPTY_BUFFER); + this.clientVersion.setValue(context.clientVersion()); + this.idleTimeoutInSeconds.setValue(context.idleTimeoutInSeconds()); + this.protocolVersion.setValue(context.protocolVersion()); + this.serverAgent.setValue(context.serverProperties().getAgent()); + this.serverVersion.setValue(context.serverProperties().getVersion()); + this.unauthenticatedTimeoutInSeconds.setValue(context.unauthenticatedTimeoutInSeconds); + } + Headers(final ByteBuf in) { + super(RntbdContextHeader.set, RntbdContextHeader.map, in); this.clientVersion = this.get(RntbdContextHeader.ClientVersion); this.idleTimeoutInSeconds = this.get(RntbdContextHeader.IdleTimeoutInSeconds); this.protocolVersion = this.get(RntbdContextHeader.ProtocolVersion); @@ -178,8 +213,8 @@ private static final class Headers extends RntbdTokenStream } static Headers decode(final ByteBuf in) { - final Headers headers = new Headers(); - Headers.decode(in, headers); + final Headers headers = new Headers(in); + Headers.decode(headers); return headers; } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextNegotiator.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextNegotiator.java index 46f0490e1766..21489ae1f58b 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextNegotiator.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextNegotiator.java @@ -50,9 +50,7 @@ public RntbdContextNegotiator(final RntbdRequestManager manager, final UserAgent * @throws Exception thrown if an error occurs */ @Override - public void write( - final ChannelHandlerContext context, final Object message, final ChannelPromise promise - ) throws Exception { + public void write(final ChannelHandlerContext context, final Object message, final ChannelPromise promise) throws Exception { checkArgument(message instanceof ByteBuf, "message: %s", message.getClass()); final ByteBuf out = (ByteBuf)message; @@ -77,7 +75,7 @@ private void startRntbdContextRequest(final ChannelHandlerContext context) throw final Channel channel = context.channel(); final RntbdContextRequest request = new RntbdContextRequest(Utils.randomUUID(), this.userAgent); - final CompletableFuture contextRequestFuture = this.manager.getRntbdContextRequestFuture(); + final CompletableFuture contextRequestFuture = this.manager.rntbdContextRequestFuture(); super.write(context, request, channel.newPromise().addListener((ChannelFutureListener)future -> { diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextRequest.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextRequest.java index baa1f09cb5aa..13eda1ccb8b1 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextRequest.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextRequest.java @@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectWriter; +import com.google.common.base.Strings; import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; import io.netty.handler.codec.CorruptedFrameException; import java.nio.charset.StandardCharsets; @@ -62,7 +64,7 @@ public static RntbdContextRequest decode(final ByteBuf in) { final int observedLength = in.readerIndex() - start; if (observedLength != expectedLength) { - final String reason = String.format("expectedLength=%d, observeredLength=%d", expectedLength, observedLength); + final String reason = Strings.lenientFormat("expectedLength=%s, observedLength=%s", expectedLength, observedLength); throw new IllegalStateException(reason); } @@ -84,7 +86,7 @@ public void encode(final ByteBuf out) { final int observedLength = out.writerIndex() - start; if (observedLength != expectedLength) { - final String reason = String.format("expectedLength=%d, observeredLength=%d", expectedLength, observedLength); + final String reason = Strings.lenientFormat("expectedLength=%s, observedLength=%s", expectedLength, observedLength); throw new IllegalStateException(reason); } } @@ -113,17 +115,15 @@ private static final class Headers extends RntbdTokenStream list(); @@ -38,6 +73,7 @@ interface Provider extends AutoCloseable { final class Config { + private final PooledByteBufAllocator allocator; private final Options options; private final SslContext sslContext; private final LogLevel wireLogLevel; @@ -47,52 +83,99 @@ public Config(final Options options, final SslContext sslContext, final LogLevel checkNotNull(options, "options"); checkNotNull(sslContext, "sslContext"); + int directArenaCount = PooledByteBufAllocator.defaultNumDirectArena(); + int heapArenaCount = PooledByteBufAllocator.defaultNumHeapArena(); + int pageSize = options.bufferPageSize(); + int maxOrder = Integer.numberOfTrailingZeros(options.maxBufferCapacity()) - Integer.numberOfTrailingZeros(pageSize); + + this.allocator = new PooledByteBufAllocator(heapArenaCount, directArenaCount, pageSize, maxOrder); this.options = options; this.sslContext = sslContext; this.wireLogLevel = wireLogLevel; } - public int getConnectionTimeout() { - final long value = this.options.getConnectionTimeout().toMillis(); + @JsonIgnore + public PooledByteBufAllocator allocator() { + return this.allocator; + } + + @JsonProperty + public int bufferPageSize() { + return this.options.bufferPageSize(); + } + + @JsonProperty + public int connectionTimeout() { + final long value = this.options.connectionTimeout().toMillis(); assert value <= Integer.MAX_VALUE; return (int)value; } - public int getMaxChannelsPerEndpoint() { - return this.options.getMaxChannelsPerEndpoint(); + @JsonProperty + public long idleConnectionTimeout() { + return this.options.idleChannelTimeout().toNanos(); + } + + @JsonProperty + public long idleEndpointTimeout() { + return this.options.idleEndpointTimeout().toNanos(); } - public int getMaxRequestsPerChannel() { - return this.options.getMaxRequestsPerChannel(); + @JsonProperty + public int maxBufferCapacity() { + return this.options.maxBufferCapacity(); } - public long getReceiveHangDetectionTime() { - return this.options.getReceiveHangDetectionTime().toNanos(); + @JsonProperty + public int maxChannelsPerEndpoint() { + return this.options.maxChannelsPerEndpoint(); } - public long getRequestTimeout() { - return this.options.getRequestTimeout().toNanos(); + @JsonProperty + public int maxRequestsPerChannel() { + return this.options.maxRequestsPerChannel(); } - public long getSendHangDetectionTime() { - return this.options.getSendHangDetectionTime().toNanos(); + @JsonProperty + public long receiveHangDetectionTime() { + return this.options.receiveHangDetectionTime().toNanos(); } - public SslContext getSslContext() { + @JsonProperty + public long requestTimeout() { + return this.options.requestTimeout().toNanos(); + } + + @JsonProperty + public long sendHangDetectionTime() { + return this.options.sendHangDetectionTime().toNanos(); + } + + @JsonProperty + public long shutdownTimeout() { + return this.options.shutdownTimeout().toNanos(); + } + + @JsonIgnore + public SslContext sslContext() { return this.sslContext; } - public UserAgentContainer getUserAgent() { - return this.options.getUserAgent(); + @JsonProperty + public UserAgentContainer userAgent() { + return this.options.userAgent(); } - public LogLevel getWireLogLevel() { + @JsonProperty + public LogLevel wireLogLevel() { return this.wireLogLevel; } @Override public String toString() { - return RntbdObjectMapper.toJson(this); + return RntbdObjectMapper.toString(this); } } + + // endregion } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdFramer.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdFramer.java index 7a612c85b5b5..6a8a070f2735 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdFramer.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdFramer.java @@ -3,6 +3,7 @@ package com.azure.data.cosmos.internal.directconnectivity.rntbd; +import com.google.common.base.Strings; import io.netty.buffer.ByteBuf; import io.netty.handler.codec.CorruptedFrameException; @@ -25,14 +26,14 @@ static boolean canDecodeHead(final ByteBuf in) throws CorruptedFrameException { final long length = in.getUnsignedIntLE(start); if (length > Integer.MAX_VALUE) { - final String reason = String.format("Head frame length exceeds Integer.MAX_VALUE, %d: %d", + final String reason = Strings.lenientFormat("Head frame length exceeds Integer.MAX_VALUE, %s: %s", Integer.MAX_VALUE, length ); throw new CorruptedFrameException(reason); } if (length < Integer.BYTES) { - final String reason = String.format("Head frame length is less than size of length field, %d: %d", + final String reason = Strings.lenientFormat("Head frame length is less than size of length field, %s: %s", Integer.BYTES, length ); throw new CorruptedFrameException(reason); @@ -60,7 +61,7 @@ static boolean canDecodePayload(final ByteBuf in, final int start) { final long length = in.getUnsignedIntLE(start); if (length > Integer.MAX_VALUE) { - final String reason = String.format("Payload frame length exceeds Integer.MAX_VALUE, %d: %d", + final String reason = Strings.lenientFormat("Payload frame length exceeds Integer.MAX_VALUE, %s: %s", Integer.MAX_VALUE, length ); throw new CorruptedFrameException(reason); diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdHealthCheckRequest.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdHealthCheckRequest.java new file mode 100644 index 000000000000..ce2b0347ef3c --- /dev/null +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdHealthCheckRequest.java @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.data.cosmos.internal.directconnectivity.rntbd; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + +final class RntbdHealthCheckRequest { + + public static final ByteBuf MESSAGE = Unpooled.EMPTY_BUFFER; + + private RntbdHealthCheckRequest() { + } +} diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdMetrics.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdMetrics.java index a32b86bff43a..a6f9dc5a5c91 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdMetrics.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdMetrics.java @@ -3,136 +3,266 @@ package com.azure.data.cosmos.internal.directconnectivity.rntbd; -import com.codahale.metrics.Gauge; -import com.codahale.metrics.Meter; -import com.codahale.metrics.MetricFilter; +import com.azure.data.cosmos.internal.directconnectivity.RntbdTransportClient; +import com.codahale.metrics.ConsoleReporter; import com.codahale.metrics.MetricRegistry; -import com.codahale.metrics.RatioGauge; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.google.common.base.Stopwatch; - -import java.time.Duration; - +import com.google.common.net.PercentEscaper; +import io.micrometer.core.instrument.Clock; +import io.micrometer.core.instrument.Gauge; +import io.micrometer.core.instrument.Measurement; +import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.Tag; +import io.micrometer.core.instrument.Tags; +import io.micrometer.core.instrument.Timer; +import io.micrometer.core.instrument.composite.CompositeMeterRegistry; +import io.micrometer.core.instrument.config.NamingConvention; +import io.micrometer.core.instrument.dropwizard.DropwizardConfig; +import io.micrometer.core.instrument.dropwizard.DropwizardMeterRegistry; +import io.micrometer.core.instrument.util.HierarchicalNameMapper; +import io.micrometer.core.lang.Nullable; + +import java.util.concurrent.TimeUnit; + +@SuppressWarnings("UnstableApiUsage") @JsonPropertyOrder({ - "lifetime", "requests", "responses", "errorResponses", "responseRate", "completionRate", "throughput" + "tags", "concurrentRequests", "requests", "responseErrors", "responseSuccesses", "completionRate", "responseRate", + "channelsAcquired", "channelsAvailable", "requestQueueLength", "usedDirectMemory", "usedHeapMemory" }) -public final class RntbdMetrics implements AutoCloseable { +public final class RntbdMetrics { // region Fields - private static final MetricRegistry registry = new MetricRegistry(); + private static final PercentEscaper escaper = new PercentEscaper("_-", false); + private static final CompositeMeterRegistry registry = new CompositeMeterRegistry(); - private final Gauge completionRate; - private final Meter errorResponses; - private final Stopwatch lifetime; - private final String prefix; - private final Meter requests; - private final Gauge responseRate; - private final Meter responses; + private static final String prefix = "azure.cosmos.directTcp."; + private static MeterRegistry consoleLoggingRegistry; - // endregion + private final RntbdTransportClient transportClient; + private final RntbdEndpoint endpoint; - // region Constructors + private final Timer requests; + private final Timer responseErrors; + private final Timer responseSuccesses; + private final Tags tags; - public RntbdMetrics(final String name) { + static { + int step = Integer.getInteger("azure.cosmos.monitoring.consoleLogging.step", 0); + if (step > 0) { + RntbdMetrics.add(RntbdMetrics.consoleLoggingRegistry(step)); + } + } - this.lifetime = Stopwatch.createStarted(); - this.prefix = name + '.'; + // endregion + + // region Constructors - this.requests = registry.register(this.prefix + "requests", new Meter()); - this.responses = registry.register(this.prefix + "responses", new Meter()); - this.errorResponses = registry.register(this.prefix + "errorResponses", new Meter()); - this.responseRate = registry.register(this.prefix + "responseRate", new ResponseRate(this)); - this.completionRate = registry.register(this.prefix + "completionRate", new CompletionRate(this)); + public RntbdMetrics(RntbdTransportClient client, RntbdEndpoint endpoint) { + + this.transportClient = client; + this.endpoint = endpoint; + + this.tags = Tags.of(client.tag(), endpoint.tag()); + this.requests = registry.timer(nameOf("requests"), tags); + this.responseErrors = registry.timer(nameOf("responseErrors"), tags); + this.responseSuccesses = registry.timer(nameOf("responseSuccesses"), tags); + + Gauge.builder(nameOf("endpoints"), client, RntbdTransportClient::endpointCount) + .description("endpoint count") + .tag(client.tag().getKey(), client.tag().getValue()) + .register(registry); + + Gauge.builder(nameOf("endpointsEvicted"), client, RntbdTransportClient::endpointEvictionCount) + .description("endpoint eviction count") + .tag(client.tag().getKey(), client.tag().getValue()) + .register(registry); + + Gauge.builder(nameOf("concurrentRequests"), endpoint, RntbdEndpoint::concurrentRequests) + .description("executing or queued request count") + .tags(this.tags) + .register(registry); + + Gauge.builder(nameOf("requestQueueLength"), endpoint, RntbdEndpoint::requestQueueLength) + .description("queued request count") + .tags(this.tags) + .register(registry); + + Gauge.builder(nameOf("channelsAcquired"), endpoint, RntbdEndpoint::channelsAcquired) + .description("acquired channel count") + .tags(this.tags) + .register(registry); + + Gauge.builder(nameOf("channelsAvailable"), endpoint, RntbdEndpoint::channelsAvailable) + .description("available channel count") + .tags(this.tags) + .register(registry); + + Gauge.builder(nameOf("usedDirectMemory"), endpoint, x -> x.usedDirectMemory()) + .description("Java direct memory usage") + .baseUnit("bytes") + .tags(this.tags) + .register(registry); + + Gauge.builder(nameOf("usedHeapMemory"), endpoint, x -> x.usedHeapMemory()) + .description("Java heap memory usage") + .baseUnit("MiB") + .tags(this.tags) + .register(registry); } // endregion // region Accessors - public double getCompletionRate() { - return this.completionRate.getValue(); + @JsonIgnore + private static synchronized MeterRegistry consoleLoggingRegistry(final int step) { + + if (consoleLoggingRegistry == null) { + + MetricRegistry dropwizardRegistry = new MetricRegistry(); + + ConsoleReporter consoleReporter = ConsoleReporter + .forRegistry(dropwizardRegistry) + .convertRatesTo(TimeUnit.SECONDS) + .convertDurationsTo(TimeUnit.MILLISECONDS) + .build(); + + consoleReporter.start(step, TimeUnit.SECONDS); + + DropwizardConfig dropwizardConfig = new DropwizardConfig() { + + @Override + public String get(@Nullable String key) { + return null; + } + + @Override + public String prefix() { + return "console"; + } + + }; + + consoleLoggingRegistry = new DropwizardMeterRegistry(dropwizardConfig, dropwizardRegistry, HierarchicalNameMapper.DEFAULT, Clock.SYSTEM) { + @Override + @Nullable + protected Double nullGaugeValue() { + return null; + } + }; + + consoleLoggingRegistry.config().namingConvention(NamingConvention.dot); + } + + return consoleLoggingRegistry; } - public long getErrorResponses() { - return this.errorResponses.getCount(); + @JsonProperty + public int channelsAcquired() { + return this.endpoint.channelsAcquired(); } - public double getLifetime() { - final Duration elapsed = this.lifetime.elapsed(); - return elapsed.getSeconds() + (1E-9D * elapsed.getNano()); + @JsonProperty + public int channelsAvailable() { + return this.endpoint.channelsAvailable(); } - public long getRequests() { - return this.requests.getCount(); + /*** + * Computes the number of successful (non-error) responses received divided by the number of completed requests + * + * @return The number of successful (non-error) responses received divided by the number of completed requests + */ + @JsonProperty + public double completionRate() { + return this.responseSuccesses.count() / (double)this.requests.count(); } - public double getResponseRate() { - return this.responseRate.getValue(); + @JsonProperty + public long concurrentRequests() { + return this.endpoint.concurrentRequests(); } - public long getResponses() { - return this.responses.getCount(); + @JsonProperty + public int endpoints() { + return this.transportClient.endpointCount(); } - public double getThroughput() { - return this.responses.getMeanRate(); + @JsonProperty + public int requestQueueLength() { + return this.endpoint.requestQueueLength(); } - // endregion + @JsonProperty + public Iterable requests() { + return this.requests.measure(); + } - // region Methods + @JsonProperty + public Iterable responseErrors() { + return this.responseErrors.measure(); + } - @Override - public void close() { - registry.removeMatching(MetricFilter.startsWith(this.prefix)); + /*** + * Computes the number of successful (non-error) responses received divided by the number of requests sent + * + * @return The number of successful (non-error) responses received divided by the number of requests sent + */ + @JsonProperty + public double responseRate() { + return this.responseSuccesses.count() / (double)(this.requests.count() + this.endpoint.concurrentRequests()); } - public final void incrementErrorResponseCount() { - this.errorResponses.mark(); + @JsonProperty + public Iterable responseSuccesses() { + return this.responseSuccesses.measure(); } - public final void incrementRequestCount() { - this.requests.mark(); + @JsonProperty + public Iterable tags() { + return this.tags; } - public final void incrementResponseCount() { - this.responses.mark(); + @JsonProperty + public long usedDirectMemory() { + return this.endpoint.usedDirectMemory(); } - @Override - public String toString() { - return RntbdObjectMapper.toJson(this); + @JsonProperty + public long usedHeapMemory() { + return this.endpoint.usedHeapMemory(); } // endregion - private static final class CompletionRate extends RatioGauge { + // region Methods - private final RntbdMetrics metrics; + public static void add(MeterRegistry registry) { + RntbdMetrics.registry.add(registry); + } - private CompletionRate(RntbdMetrics metrics) { - this.metrics = metrics; - } + public void markComplete(RntbdRequestRecord record) { + record.stop(this.requests, record.isCompletedExceptionally() ? this.responseErrors : this.responseSuccesses); + } - @Override - protected Ratio getRatio() { - return Ratio.of(this.metrics.responses.getCount() - this.metrics.errorResponses.getCount(), - this.metrics.requests.getCount()); - } + public static String escape(String value) { + return escaper.escape(value); } - private static final class ResponseRate extends RatioGauge { + @Override + public String toString() { + return RntbdObjectMapper.toString(this); + } - private final RntbdMetrics metrics; + // endregion - private ResponseRate(RntbdMetrics metrics) { - this.metrics = metrics; - } + // region Private - @Override - protected Ratio getRatio() { - return Ratio.of(this.metrics.responses.getCount(), this.metrics.requests.getCount()); - } + private static String nameOf(final String member) { + return prefix + member; } + + // endregion } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdObjectMapper.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdObjectMapper.java index 77fe5133756e..de59bf295b36 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdObjectMapper.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdObjectMapper.java @@ -11,28 +11,50 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.ser.PropertyFilter; import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; +import com.google.common.base.Strings; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufInputStream; import io.netty.handler.codec.CorruptedFrameException; -import io.netty.handler.codec.EncoderException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; import java.io.InputStream; +import java.util.concurrent.ConcurrentHashMap; import static com.google.common.base.Preconditions.checkNotNull; public final class RntbdObjectMapper { - private static final SimpleFilterProvider filterProvider; - private static final ObjectMapper objectMapper; - private static final ObjectWriter objectWriter; + private static final Logger logger = LoggerFactory.getLogger(RntbdObjectMapper.class); + private static final SimpleFilterProvider filterProvider = new SimpleFilterProvider(); + private static final ObjectMapper objectMapper = new ObjectMapper().setFilterProvider(filterProvider); + private static final ObjectWriter objectWriter = objectMapper.writer(); + private static final ConcurrentHashMap, String> simpleClassNames = new ConcurrentHashMap<>(); - static { - objectMapper = new ObjectMapper().setFilterProvider(filterProvider = new SimpleFilterProvider()); - objectWriter = objectMapper.writer(); + private RntbdObjectMapper() { } - private RntbdObjectMapper() { + public static String toJson(final Object value) { + try { + return objectWriter.writeValueAsString(value); + } catch (final JsonProcessingException error) { + logger.error("could not convert {} value to JSON due to:", value.getClass(), error); + try { + return Strings.lenientFormat("{\"error\":%s", objectWriter.writeValueAsString(error.toString())); + } catch (final JsonProcessingException exception) { + return "null"; + } + } + } + + public static String toString(final Object value) { + final String name = simpleClassNames.computeIfAbsent(value.getClass(), Class::getSimpleName); + return Strings.lenientFormat("%s(%s)", name, toJson(value)); + } + + public static ObjectWriter writer() { + return objectWriter; } static ObjectNode readTree(final RntbdResponse response) { @@ -55,7 +77,7 @@ static ObjectNode readTree(final ByteBuf in) { return (ObjectNode)node; } - final String cause = String.format("Expected %s, not %s", JsonNodeType.OBJECT, node.getNodeType()); + final String cause = Strings.lenientFormat("Expected %s, not %s", JsonNodeType.OBJECT, node.getNodeType()); throw new CorruptedFrameException(cause); } @@ -70,16 +92,4 @@ static void registerPropertyFilter(final Class type, final Class arg == null ? "null" : arg.toString()).collect(Collectors.joining(",") ), @@ -106,4 +128,6 @@ public void traceOperation(final Logger logger, final ChannelHandlerContext cont ); } } + + // endregion } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestFrame.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestFrame.java index aadbe1e1cd28..53e172414f4d 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestFrame.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestFrame.java @@ -5,9 +5,9 @@ import com.azure.data.cosmos.internal.OperationType; import com.azure.data.cosmos.internal.ResourceType; +import com.google.common.base.Strings; import io.netty.buffer.ByteBuf; -import java.util.Locale; import java.util.UUID; import static com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdConstants.RntbdOperationType; @@ -129,7 +129,7 @@ private static RntbdResourceType map(final ResourceType resourceType) { case RidRange: return RntbdResourceType.RidRange; default: - final String reason = String.format(Locale.ROOT, "Unrecognized resource type: %s", resourceType); + final String reason = Strings.lenientFormat("Unrecognized resource type: %s", resourceType); throw new UnsupportedOperationException(reason); } } @@ -204,7 +204,7 @@ private static RntbdOperationType map(final OperationType operationType) { case AddComputeGatewayRequestCharges: return RntbdOperationType.AddComputeGatewayRequestCharges; default: - final String reason = String.format(Locale.ROOT, "Unrecognized operation type: %s", operationType); + final String reason = Strings.lenientFormat("Unrecognized operation type: %s", operationType); throw new UnsupportedOperationException(reason); } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestHeaders.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestHeaders.java index 86224ce7a91a..e3223d17cf05 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestHeaders.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestHeaders.java @@ -3,7 +3,6 @@ package com.azure.data.cosmos.internal.directconnectivity.rntbd; - import com.azure.data.cosmos.ConsistencyLevel; import com.azure.data.cosmos.IndexingDirective; import com.azure.data.cosmos.internal.ContentSerializationFormat; @@ -18,6 +17,7 @@ import com.azure.data.cosmos.internal.RxDocumentServiceRequest; import com.fasterxml.jackson.annotation.JsonFilter; import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; import org.apache.commons.lang3.EnumUtils; import org.apache.commons.lang3.StringUtils; @@ -53,17 +53,17 @@ final class RntbdRequestHeaders extends RntbdTokenStream { RntbdRequestHeaders(final RntbdRequestArgs args, final RntbdRequestFrame frame) { - this(); + this(Unpooled.EMPTY_BUFFER); checkNotNull(args, "args"); checkNotNull(frame, "frame"); - final RxDocumentServiceRequest request = args.getServiceRequest(); + final RxDocumentServiceRequest request = args.serviceRequest(); final byte[] content = request.getContent(); this.getPayloadPresent().setValue(content != null && content.length > 0); - this.getReplicaPath().setValue(args.getReplicaPath()); - this.getTransportRequestID().setValue(args.getTransportRequestId()); + this.getReplicaPath().setValue(args.replicaPath()); + this.getTransportRequestID().setValue(args.transportRequestId()); final Map headers = request.getHeaders(); @@ -156,8 +156,8 @@ final class RntbdRequestHeaders extends RntbdTokenStream { this.fillTokenFromHeader(headers, this::getClientVersion, HttpHeaders.VERSION); } - private RntbdRequestHeaders() { - super(RntbdRequestHeader.set, RntbdRequestHeader.map); + private RntbdRequestHeaders(ByteBuf in) { + super(RntbdRequestHeader.set, RntbdRequestHeader.map, in); } // endregion @@ -165,8 +165,8 @@ private RntbdRequestHeaders() { // region Methods static RntbdRequestHeaders decode(final ByteBuf in) { - final RntbdRequestHeaders metadata = new RntbdRequestHeaders(); - return RntbdRequestHeaders.decode(in, metadata); + final RntbdRequestHeaders metadata = new RntbdRequestHeaders(in); + return RntbdRequestHeaders.decode(metadata); } // endregion diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestManager.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestManager.java index 66532b30050f..426242e1804a 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestManager.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestManager.java @@ -26,7 +26,6 @@ import com.azure.data.cosmos.ServiceUnavailableException; import com.azure.data.cosmos.UnauthorizedException; import com.azure.data.cosmos.internal.directconnectivity.StoreResponse; -import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdConstants.RntbdResponseHeader; import com.google.common.base.Strings; import io.netty.buffer.ByteBuf; import io.netty.channel.Channel; @@ -40,15 +39,20 @@ import io.netty.channel.ChannelPromise; import io.netty.channel.CoalescingBufferQueue; import io.netty.channel.EventLoop; +import io.netty.channel.pool.ChannelHealthChecker; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.handler.ssl.SslHandler; -import io.netty.util.ReferenceCountUtil; +import io.netty.handler.timeout.IdleStateEvent; +import io.netty.util.ReferenceCounted; import io.netty.util.Timeout; import io.netty.util.concurrent.EventExecutor; +import io.netty.util.concurrent.Future; +import io.netty.util.internal.ThrowableUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.net.SocketAddress; +import java.nio.channels.ClosedChannelException; import java.util.Map; import java.util.Optional; import java.util.UUID; @@ -58,31 +62,46 @@ import static com.azure.data.cosmos.internal.HttpConstants.StatusCodes; import static com.azure.data.cosmos.internal.HttpConstants.SubStatusCodes; -import static com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdReporter.reportIssue; -import static com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdReporter.reportIssueUnless; +import static com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdClientChannelHealthChecker.Timestamps; +import static com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdConstants.RntbdResponseHeader; import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkState; +import static com.google.common.base.Preconditions.checkNotNull; public final class RntbdRequestManager implements ChannelHandler, ChannelInboundHandler, ChannelOutboundHandler { // region Fields + private static final ClosedChannelException ON_CHANNEL_UNREGISTERED = + ThrowableUtil.unknownStackTrace(new ClosedChannelException(), RntbdRequestManager.class, "channelUnregistered"); + + private static final ClosedChannelException ON_CLOSE = + ThrowableUtil.unknownStackTrace(new ClosedChannelException(), RntbdRequestManager.class, "close"); + + private static final ClosedChannelException ON_DEREGISTER = + ThrowableUtil.unknownStackTrace(new ClosedChannelException(), RntbdRequestManager.class, "deregister"); + private static final Logger logger = LoggerFactory.getLogger(RntbdRequestManager.class); private final CompletableFuture contextFuture = new CompletableFuture<>(); private final CompletableFuture contextRequestFuture = new CompletableFuture<>(); - private final ConcurrentHashMap pendingRequests; + private final ChannelHealthChecker healthChecker; private final int pendingRequestLimit; + private final ConcurrentHashMap pendingRequests; + private final Timestamps timestamps = new Timestamps(); private boolean closingExceptionally = false; private CoalescingBufferQueue pendingWrites; // endregion - public RntbdRequestManager(int capacity) { - checkArgument(capacity > 0, "capacity: %s", capacity); - this.pendingRequests = new ConcurrentHashMap<>(capacity); - this.pendingRequestLimit = capacity; + public RntbdRequestManager(final ChannelHealthChecker healthChecker, final int pendingRequestLimit) { + + checkArgument(pendingRequestLimit > 0, "pendingRequestLimit: %s", pendingRequestLimit); + checkNotNull(healthChecker, "healthChecker"); + + this.pendingRequests = new ConcurrentHashMap<>(pendingRequestLimit); + this.pendingRequestLimit = pendingRequestLimit; + this.healthChecker = healthChecker; } // region ChannelHandler methods @@ -124,7 +143,7 @@ public void channelActive(final ChannelHandlerContext context) { } /** - * Completes all pending requests exceptionally when a channel reaches the end of its lifetime + * The {@link Channel} of the {@link ChannelHandlerContext} was registered and has reached the end of its lifetime *

* This method will only be called after the channel is closed. * @@ -136,39 +155,51 @@ public void channelInactive(final ChannelHandlerContext context) { context.fireChannelInactive(); } + /** + * The {@link Channel} of the {@link ChannelHandlerContext} has read a message from its peer + *

+ * + * @param context {@link ChannelHandlerContext} to which this {@link RntbdRequestManager} belongs + * @param message The message read + */ @Override public void channelRead(final ChannelHandlerContext context, final Object message) { this.traceOperation(context, "channelRead"); - if (message instanceof RntbdResponse) { + try { + if (message instanceof RntbdResponse) { - try { - this.messageReceived(context, (RntbdResponse)message); - } catch (Throwable throwable) { - reportIssue(logger, context, "{} ", message, throwable); - this.exceptionCaught(context, throwable); - } finally { - ReferenceCountUtil.release(message); - } + try { + this.messageReceived(context, (RntbdResponse)message); + } catch (Throwable throwable) { + reportIssue(context, "{} ", message, throwable); + this.exceptionCaught(context, throwable); + } - } else { + } else { - final IllegalStateException error = new IllegalStateException( - Strings.lenientFormat("expected message of %s, not %s: %s", - RntbdResponse.class, message.getClass(), message - ) - ); + final IllegalStateException error = new IllegalStateException( + Strings.lenientFormat("expected message of %s, not %s: %s", + RntbdResponse.class, message.getClass(), message + ) + ); - reportIssue(logger, context, "", error); - this.exceptionCaught(context, error); + reportIssue(context, "", error); + this.exceptionCaught(context, error); + } + } finally { + if (message instanceof ReferenceCounted) { + boolean released = ((ReferenceCounted)message).release(); + reportIssueUnless(released, context, "failed to release message: {}", message); + } } } /** - * Invoked when the last message read by the current read operation has been consumed + * The {@link Channel} of the {@link ChannelHandlerContext} has fully consumed the most-recent message read *

- * If {@link ChannelOption#AUTO_READ} is off, no further attempt to read an inbound data from the current + * If {@link ChannelOption#AUTO_READ} is off, no further attempt to read inbound data from the current * {@link Channel} will be made until {@link ChannelHandlerContext#read} is called. This leaves time * for outbound messages to be written. * @@ -177,6 +208,7 @@ public void channelRead(final ChannelHandlerContext context, final Object messag @Override public void channelReadComplete(final ChannelHandlerContext context) { this.traceOperation(context, "channelReadComplete"); + this.timestamps.channelReadCompleted(); context.fireChannelReadComplete(); } @@ -195,7 +227,7 @@ public void channelRegistered(final ChannelHandlerContext context) { this.traceOperation(context, "channelRegistered"); - checkState(this.pendingWrites == null, "pendingWrites: %s", this.pendingWrites); + reportIssueUnless(this.pendingWrites == null, context, "pendingWrites: {}", pendingWrites); this.pendingWrites = new CoalescingBufferQueue(context.channel()); context.fireChannelRegistered(); @@ -211,9 +243,11 @@ public void channelUnregistered(final ChannelHandlerContext context) { this.traceOperation(context, "channelUnregistered"); - checkState(this.pendingWrites != null, "pendingWrites: null"); - this.completeAllPendingRequestsExceptionally(context, ClosedWithPendingRequestsException.INSTANCE); - this.pendingWrites = null; + if (!this.closingExceptionally) { + this.completeAllPendingRequestsExceptionally(context, ON_CHANNEL_UNREGISTERED); + } else { + logger.warn("{} channelUnregistered exceptionally", context); + } context.fireChannelUnregistered(); } @@ -253,12 +287,9 @@ public void exceptionCaught(final ChannelHandlerContext context, final Throwable this.traceOperation(context, "exceptionCaught", cause); if (!this.closingExceptionally) { - - reportIssueUnless(cause != ClosedWithPendingRequestsException.INSTANCE, logger, context, - "expected an exception other than ", ClosedWithPendingRequestsException.INSTANCE); - this.completeAllPendingRequestsExceptionally(context, cause); - context.pipeline().flush().close(); + logger.warn("{} closing due to:", context, cause); + context.flush().close(); } } @@ -276,6 +307,27 @@ public void userEventTriggered(final ChannelHandlerContext context, final Object this.traceOperation(context, "userEventTriggered", event); try { + + if (event instanceof IdleStateEvent) { + + this.healthChecker.isHealthy(context.channel()).addListener((Future future) -> { + + final Throwable cause; + + if (future.isSuccess()) { + if (future.get()) { + return; + } + cause = UnhealthyChannelException.INSTANCE; + } else { + cause = future.cause(); + } + + this.exceptionCaught(context, cause); + }); + + return; + } if (event instanceof RntbdContext) { this.contextFuture.complete((RntbdContext)event); this.removeContextNegotiatorAndFlushPendingWrites(context); @@ -289,7 +341,7 @@ public void userEventTriggered(final ChannelHandlerContext context, final Object context.fireUserEventTriggered(event); } catch (Throwable error) { - reportIssue(logger, context, "{}: ", event, error); + reportIssue(context, "{}: ", event, error); this.exceptionCaught(context, error); } } @@ -322,7 +374,12 @@ public void close(final ChannelHandlerContext context, final ChannelPromise prom this.traceOperation(context, "close"); - this.completeAllPendingRequestsExceptionally(context, ClosedWithPendingRequestsException.INSTANCE); + if (!this.closingExceptionally) { + this.completeAllPendingRequestsExceptionally(context, ON_CLOSE); + } else { + logger.warn("{} closed exceptionally", context); + } + final SslHandler sslHandler = context.pipeline().get(SslHandler.class); if (sslHandler != null) { @@ -355,12 +412,20 @@ public void connect( /** * Called once a deregister operation is made from the current registered {@link EventLoop}. * - * @param context the {@link ChannelHandlerContext} for which the close operation is made + * @param context the {@link ChannelHandlerContext} for which the deregister operation is made * @param promise the {@link ChannelPromise} to notify once the operation completes */ @Override public void deregister(final ChannelHandlerContext context, final ChannelPromise promise) { + this.traceOperation(context, "deregister"); + + if (!this.closingExceptionally) { + this.completeAllPendingRequestsExceptionally(context, ON_DEREGISTER); + } else { + logger.warn("{} deregistered exceptionally", context); + } + context.deregister(promise); } @@ -414,34 +479,59 @@ public void read(final ChannelHandlerContext context) { public void write(final ChannelHandlerContext context, final Object message, final ChannelPromise promise) { // TODO: DANOBLE: Ensure that all write errors are reported with a root cause of type EncoderException + // Requires a full scan of the rntbd code this.traceOperation(context, "write", message); if (message instanceof RntbdRequestRecord) { - context.write(this.addPendingRequestRecord(context, (RntbdRequestRecord)message), promise); + this.timestamps.channelWriteAttempted(); - } else { + context.write(this.addPendingRequestRecord(context, (RntbdRequestRecord)message), promise).addListener(completed -> { + if (completed.isSuccess()) { + this.timestamps.channelWriteCompleted(); + } + }); - final IllegalStateException error = new IllegalStateException( - Strings.lenientFormat("expected message of %s, not %s: %s", - RntbdRequestRecord.class, message.getClass(), message - ) - ); + return; + } - reportIssue(logger, context, "", error); - this.exceptionCaught(context, error); + if (message == RntbdHealthCheckRequest.MESSAGE) { + + context.write(RntbdHealthCheckRequest.MESSAGE, promise).addListener(completed -> { + if (completed.isSuccess()) { + this.timestamps.channelPingCompleted(); + } + }); + + return; } + + final IllegalStateException error = new IllegalStateException(Strings.lenientFormat("message of %s: %s", message.getClass(), message)); + reportIssue(context, "", error); + this.exceptionCaught(context, error); } // endregion - // region Private and package private methods + // region Package private methods - CompletableFuture getRntbdContextRequestFuture() { + int pendingRequestCount() { + return this.pendingRequests.size(); + } + + Optional rntbdContext() { + return Optional.of(this.contextFuture.getNow(null)); + } + + CompletableFuture rntbdContextRequestFuture() { return this.contextRequestFuture; } + boolean hasRequestedRntbdContext() { + return this.contextRequestFuture.getNow(null) != null; + } + boolean hasRntbdContext() { return this.contextFuture.getNow(null) != null; } @@ -455,11 +545,22 @@ void pendWrite(final ByteBuf out, final ChannelPromise promise) { this.pendingWrites.add(out, promise); } + RntbdClientChannelHealthChecker.Timestamps snapshotTimestamps() { + return new RntbdClientChannelHealthChecker.Timestamps(this.timestamps); + } + + // endregion + + // region Private methods + private RntbdRequestArgs addPendingRequestRecord(final ChannelHandlerContext context, final RntbdRequestRecord record) { - return this.pendingRequests.compute(record.getTransportRequestId(), (id, current) -> { + return this.pendingRequests.compute(record.transportRequestId(), (id, current) -> { + + boolean predicate = current == null; + String format = "id: {}, current: {}, request: {}"; - reportIssueUnless(current == null, logger, context, "id: {}, current: {}, request: {}", id, current, record); + reportIssueUnless(predicate, context, format, record); final Timeout pendingRequestTimeout = record.newTimeout(timeout -> { @@ -481,31 +582,17 @@ private RntbdRequestArgs addPendingRequestRecord(final ChannelHandlerContext con return record; - }).getArgs(); - } - - private Optional getRntbdContext() { - return Optional.of(this.contextFuture.getNow(null)); + }).args(); } private void completeAllPendingRequestsExceptionally(final ChannelHandlerContext context, final Throwable throwable) { - if (this.closingExceptionally) { - - reportIssueUnless(throwable == ClosedWithPendingRequestsException.INSTANCE, logger, context, - "throwable: ", throwable); - - reportIssueUnless(this.pendingRequests.isEmpty() && this.pendingWrites.isEmpty(), logger, context, - "pendingRequests: {}, pendingWrites: {}", this.pendingRequests.isEmpty(), - this.pendingWrites.isEmpty()); - - return; - } - + reportIssueUnless(!this.closingExceptionally, context, "", throwable); this.closingExceptionally = true; - if (!this.pendingWrites.isEmpty()) { - this.pendingWrites.releaseAndFailAll(context, ClosedWithPendingRequestsException.INSTANCE); + if (this.pendingWrites != null && !this.pendingWrites.isEmpty()) { + // an expensive call that fires at least one exceptionCaught event + this.pendingWrites.releaseAndFailAll(context, throwable); } if (!this.pendingRequests.isEmpty()) { @@ -560,10 +647,10 @@ private void completeAllPendingRequestsExceptionally(final ChannelHandlerContext final String message = Strings.lenientFormat("%s %s with %s pending requests", context, phrase, count); final Exception cause; - if (throwable == ClosedWithPendingRequestsException.INSTANCE) { + if (throwable instanceof ClosedChannelException) { cause = contextRequestException == null - ? ClosedWithPendingRequestsException.INSTANCE + ? (ClosedChannelException)throwable : contextRequestException; } else { @@ -575,8 +662,8 @@ private void completeAllPendingRequestsExceptionally(final ChannelHandlerContext for (RntbdRequestRecord record : this.pendingRequests.values()) { - final Map requestHeaders = record.getArgs().getServiceRequest().getHeaders(); - final String requestUri = record.getArgs().getPhysicalAddress().toString(); + final Map requestHeaders = record.args().serviceRequest().getHeaders(); + final String requestUri = record.args().physicalAddress().toString(); final GoneException error = new GoneException(message, cause, (Map)null, requestUri); BridgeInternal.setRequestHeaders(error, requestHeaders); @@ -597,14 +684,14 @@ private void messageReceived(final ChannelHandlerContext context, final RntbdRes final Long transportRequestId = response.getTransportRequestId(); if (transportRequestId == null) { - reportIssue(logger, context, "{} ignored because there is no transport request identifier, response"); + reportIssue(context, "response ignored because its transport request identifier is missing: {}", response); return; } final RntbdRequestRecord pendingRequest = this.pendingRequests.get(transportRequestId); if (pendingRequest == null) { - reportIssue(logger, context, "{} ignored because there is no matching pending request", response); + logger.warn("{} response ignored because there is no matching pending request: {}", context, response); return; } @@ -629,14 +716,14 @@ private void messageReceived(final ChannelHandlerContext context, final RntbdRes // ..Create Error instance - final CosmosError cosmosError = response.hasPayload() ? + final CosmosError error = response.hasPayload() ? BridgeInternal.createCosmosError(RntbdObjectMapper.readTree(response)) : new CosmosError(Integer.toString(status.code()), status.reasonPhrase(), status.codeClass().name()); // ..Map RNTBD response headers to HTTP response headers final Map responseHeaders = response.getHeaders().asMap( - this.getRntbdContext().orElseThrow(IllegalStateException::new), activityId + this.rntbdContext().orElseThrow(IllegalStateException::new), activityId ); // ..Create CosmosClientException based on status and sub-status codes @@ -644,15 +731,15 @@ private void messageReceived(final ChannelHandlerContext context, final RntbdRes switch (status.code()) { case StatusCodes.BADREQUEST: - cause = new BadRequestException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new BadRequestException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.CONFLICT: - cause = new ConflictException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new ConflictException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.FORBIDDEN: - cause = new ForbiddenException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new ForbiddenException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.GONE: @@ -661,69 +748,69 @@ private void messageReceived(final ChannelHandlerContext context, final RntbdRes switch (subStatusCode) { case SubStatusCodes.COMPLETING_SPLIT: - cause = new PartitionKeyRangeIsSplittingException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new PartitionKeyRangeIsSplittingException(error, lsn, partitionKeyRangeId, responseHeaders); break; case SubStatusCodes.COMPLETING_PARTITION_MIGRATION: - cause = new PartitionIsMigratingException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new PartitionIsMigratingException(error, lsn, partitionKeyRangeId, responseHeaders); break; case SubStatusCodes.NAME_CACHE_IS_STALE: - cause = new InvalidPartitionException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new InvalidPartitionException(error, lsn, partitionKeyRangeId, responseHeaders); break; case SubStatusCodes.PARTITION_KEY_RANGE_GONE: - cause = new PartitionKeyRangeGoneException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new PartitionKeyRangeGoneException(error, lsn, partitionKeyRangeId, responseHeaders); break; default: - cause = new GoneException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new GoneException(error, lsn, partitionKeyRangeId, responseHeaders); break; } break; case StatusCodes.INTERNAL_SERVER_ERROR: - cause = new InternalServerErrorException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new InternalServerErrorException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.LOCKED: - cause = new LockedException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new LockedException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.METHOD_NOT_ALLOWED: - cause = new MethodNotAllowedException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new MethodNotAllowedException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.NOTFOUND: - cause = new NotFoundException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new NotFoundException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.PRECONDITION_FAILED: - cause = new PreconditionFailedException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new PreconditionFailedException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.REQUEST_ENTITY_TOO_LARGE: - cause = new RequestEntityTooLargeException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new RequestEntityTooLargeException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.REQUEST_TIMEOUT: - cause = new RequestTimeoutException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new RequestTimeoutException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.RETRY_WITH: - cause = new RetryWithException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new RetryWithException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.SERVICE_UNAVAILABLE: - cause = new ServiceUnavailableException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new ServiceUnavailableException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.TOO_MANY_REQUESTS: - cause = new RequestRateTooLargeException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new RequestRateTooLargeException(error, lsn, partitionKeyRangeId, responseHeaders); break; case StatusCodes.UNAUTHORIZED: - cause = new UnauthorizedException(cosmosError, lsn, partitionKeyRangeId, responseHeaders); + cause = new UnauthorizedException(error, lsn, partitionKeyRangeId, responseHeaders); break; default: - cause = BridgeInternal.createCosmosClientException(status.code(), cosmosError, responseHeaders); + cause = BridgeInternal.createCosmosClientException(status.code(), error, responseHeaders); break; } @@ -739,9 +826,20 @@ private void removeContextNegotiatorAndFlushPendingWrites(final ChannelHandlerCo if (!this.pendingWrites.isEmpty()) { this.pendingWrites.writeAndRemoveAll(context); + context.flush(); } } + private static void reportIssue(final Object subject, final String format, final Object... args) { + RntbdReporter.reportIssue(logger, subject, format, args); + } + + private static void reportIssueUnless( + final boolean predicate, final Object subject, final String format, final Object... args + ) { + RntbdReporter.reportIssueUnless(logger, predicate, subject, format, args); + } + private void traceOperation(final ChannelHandlerContext context, final String operationName, final Object... args) { logger.trace("{}\n{}\n{}", operationName, context, args); } @@ -750,25 +848,17 @@ private void traceOperation(final ChannelHandlerContext context, final String op // region Types - private static class ClosedWithPendingRequestsException extends RuntimeException { + private static final class UnhealthyChannelException extends ChannelException { - static ClosedWithPendingRequestsException INSTANCE = new ClosedWithPendingRequestsException(); + static final UnhealthyChannelException INSTANCE = new UnhealthyChannelException(); - // TODO: DANOBLE: Consider revising strategy for closing an RntbdTransportClient with pending requests - // One possibility: - // A channel associated with an RntbdTransportClient will not be closed immediately, if there are any pending - // requests on it. Instead it will be scheduled to close after the request timeout interval (default: 60s) has - // elapsed. - // Algorithm: - // When the RntbdTransportClient is closed, it closes each of its RntbdServiceEndpoint instances. In turn each - // RntbdServiceEndpoint closes its RntbdClientChannelPool. The RntbdClientChannelPool.close method should - // schedule closure of any channel with pending requests for later; when the request timeout interval has - // elapsed or--ideally--when all pending requests have completed. - // Links: - // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/388987 + private UnhealthyChannelException() { + super("health check failed"); + } - private ClosedWithPendingRequestsException() { - super(null, null, /* enableSuppression */ false, /* writableStackTrace */ false); + @Override + public Throwable fillInStackTrace() { + return this; } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestRecord.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestRecord.java index 719bb6b3c0af..d983db42b347 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestRecord.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestRecord.java @@ -6,6 +6,7 @@ import com.azure.data.cosmos.BridgeInternal; import com.azure.data.cosmos.RequestTimeoutException; import com.azure.data.cosmos.internal.directconnectivity.StoreResponse; +import io.micrometer.core.instrument.Timer; import io.netty.util.Timeout; import io.netty.util.TimerTask; @@ -18,8 +19,6 @@ public final class RntbdRequestRecord extends CompletableFuture { - private static final String simpleClassName = RntbdRequestRecord.class.getSimpleName(); - private final RntbdRequestArgs args; private final RntbdRequestTimer timer; @@ -32,33 +31,39 @@ public RntbdRequestRecord(final RntbdRequestArgs args, final RntbdRequestTimer t this.timer = timer; } - public UUID getActivityId() { - return this.args.getActivityId(); + // region Accessors + + public UUID activityId() { + return this.args.activityId(); } - public RntbdRequestArgs getArgs() { + public RntbdRequestArgs args() { return this.args; } - public long getBirthTime() { - return this.args.getBirthTime(); + public long creationTime() { + return this.args.creationTime(); } - public Duration getLifetime() { - return this.args.getLifetime(); + public Duration lifetime() { + return this.args.lifetime(); } - public long getTransportRequestId() { - return this.args.getTransportRequestId(); + public long transportRequestId() { + return this.args.transportRequestId(); } + // endregion + + // region Methods + public boolean expire() { final long timeoutInterval = this.timer.getRequestTimeout(TimeUnit.MILLISECONDS); final String message = String.format("Request timeout interval (%,d ms) elapsed", timeoutInterval); - final RequestTimeoutException error = new RequestTimeoutException(message, this.args.getPhysicalAddress()); + final RequestTimeoutException error = new RequestTimeoutException(message, this.args.physicalAddress()); - BridgeInternal.setRequestHeaders(error, this.args.getServiceRequest().getHeaders()); + BridgeInternal.setRequestHeaders(error, this.args.serviceRequest().getHeaders()); return this.completeExceptionally(error); } @@ -67,8 +72,14 @@ public Timeout newTimeout(final TimerTask task) { return this.timer.newTimeout(task); } + public long stop(Timer requests, Timer responses) { + return this.args.stop(requests, responses); + } + @Override public String toString() { - return simpleClassName + '(' + RntbdObjectMapper.toJson(this.args) + ')'; + return RntbdObjectMapper.toString(this.args); } + + // endregion } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponse.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponse.java index 7af4d0e56c1a..279189b1247e 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponse.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponse.java @@ -13,7 +13,7 @@ import com.fasterxml.jackson.databind.ser.std.StdSerializer; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufUtil; -import io.netty.buffer.EmptyByteBuf; +import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.ReferenceCounted; import io.netty.util.ResourceLeakDetector; @@ -34,10 +34,8 @@ public final class RntbdResponse implements ReferenceCounted { // region Fields - private static final String simpleClassName = RntbdResponse.class.getSimpleName(); - - @JsonProperty @JsonSerialize(using = PayloadSerializer.class) + @JsonProperty private final ByteBuf content; @JsonProperty @@ -46,14 +44,17 @@ public final class RntbdResponse implements ReferenceCounted { @JsonProperty private final RntbdResponseHeaders headers; - private AtomicInteger referenceCount = new AtomicInteger(); + private final ByteBuf in; + + private final AtomicInteger referenceCount = new AtomicInteger(); // endregion public RntbdResponse(final UUID activityId, final int statusCode, final Map map, final ByteBuf content) { this.headers = RntbdResponseHeaders.fromMap(map, content.readableBytes() > 0); - this.content = content.retain(); + this.in = Unpooled.EMPTY_BUFFER; + this.content = content.copy().retain(); final HttpResponseStatus status = HttpResponseStatus.valueOf(statusCode); final int length = RntbdResponseStatus.LENGTH + this.headers.computeLength(); @@ -61,8 +62,10 @@ public RntbdResponse(final UUID activityId, final int statusCode, final Map { + return this.referenceCount.accumulateAndGet(decrement, (value, n) -> { + value = value - min(value, n); + if (value == 0) { - assert this.headers != null && this.content != null; + + checkState(this.headers != null && this.content != null); this.headers.releaseBuffers(); - this.content.release(); + + if (this.in != Unpooled.EMPTY_BUFFER) { + this.in.release(); + } + + if (this.content != Unpooled.EMPTY_BUFFER) { + this.content.release(); + } + + checkState(this.in == Unpooled.EMPTY_BUFFER || this.in.refCnt() == 0); + checkState(this.content == Unpooled.EMPTY_BUFFER || this.content.refCnt() == 0); } + return value; + }) == 0; } @@ -219,7 +241,7 @@ StoreResponse toStoreResponse(final RntbdContext context) { @Override public String toString() { - return simpleClassName + '(' + RntbdObjectMapper.toJson(this) + ')'; + return RntbdObjectMapper.toString(this); } /** diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseDecoder.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseDecoder.java index 5c4d06af57d4..1c963e97cfd4 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseDecoder.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseDecoder.java @@ -34,7 +34,8 @@ protected void decode(final ChannelHandlerContext context, final ByteBuf in, fin if (response != null) { Logger.debug("{} DECODE COMPLETE: {}", context.channel(), response); in.discardReadBytes(); - out.add(response.retain()); + response.retain(); + out.add(response); } } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseHeaders.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseHeaders.java index 1b6a9a95704f..c2732927b90c 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseHeaders.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseHeaders.java @@ -10,6 +10,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; import io.netty.handler.codec.CorruptedFrameException; import java.math.BigDecimal; @@ -131,9 +132,9 @@ class RntbdResponseHeaders extends RntbdTokenStream { // endregion - private RntbdResponseHeaders() { + private RntbdResponseHeaders(ByteBuf in) { - super(RntbdResponseHeader.set, RntbdResponseHeader.map); + super(RntbdResponseHeader.set, RntbdResponseHeader.map, in); this.LSN = this.get(RntbdResponseHeader.LSN); this.collectionLazyIndexProgress = this.get(RntbdResponseHeader.CollectionLazyIndexProgress); @@ -193,7 +194,7 @@ boolean isPayloadPresent() { List> asList(final RntbdContext context, final UUID activityId) { final ImmutableList.Builder> builder = ImmutableList.builderWithExpectedSize(this.computeCount() + 2); - builder.add(new Entry(HttpHeaders.SERVER_VERSION, context.getServerVersion())); + builder.add(new Entry(HttpHeaders.SERVER_VERSION, context.serverVersion())); builder.add(new Entry(HttpHeaders.ACTIVITY_ID, activityId.toString())); this.collectEntries((token, toEntry) -> { @@ -208,7 +209,7 @@ List> asList(final RntbdContext context, final UUID ac public Map asMap(final RntbdContext context, final UUID activityId) { final ImmutableMap.Builder builder = ImmutableMap.builderWithExpectedSize(this.computeCount() + 2); - builder.put(new Entry(HttpHeaders.SERVER_VERSION, context.getServerVersion())); + builder.put(new Entry(HttpHeaders.SERVER_VERSION, context.serverVersion())); builder.put(new Entry(HttpHeaders.ACTIVITY_ID, activityId.toString())); this.collectEntries((token, toEntry) -> { @@ -221,14 +222,14 @@ public Map asMap(final RntbdContext context, final UUID activity } static RntbdResponseHeaders decode(final ByteBuf in) { - final RntbdResponseHeaders headers = new RntbdResponseHeaders(); - RntbdTokenStream.decode(in, headers); + final RntbdResponseHeaders headers = new RntbdResponseHeaders(in); + RntbdTokenStream.decode(headers); return headers; } public static RntbdResponseHeaders fromMap(final Map map, final boolean payloadPresent) { - final RntbdResponseHeaders headers = new RntbdResponseHeaders(); + final RntbdResponseHeaders headers = new RntbdResponseHeaders(Unpooled.EMPTY_BUFFER); headers.payloadPresent.setValue(payloadPresent); headers.setValues(map); diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseStatus.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseStatus.java index ffdfabd0a0e6..30332ca7870f 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseStatus.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseStatus.java @@ -7,6 +7,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectWriter; +import com.google.common.base.Strings; import io.netty.buffer.ByteBuf; import io.netty.handler.codec.CorruptedFrameException; import io.netty.handler.codec.http.HttpResponseStatus; @@ -64,7 +65,7 @@ static RntbdResponseStatus decode(final ByteBuf in) { final long length = in.readUnsignedIntLE(); if (!(LENGTH <= length && length <= Integer.MAX_VALUE)) { - final String reason = String.format("frame length: %d", length); + final String reason = Strings.lenientFormat("frame length: %s", length); throw new CorruptedFrameException(reason); } @@ -72,7 +73,7 @@ static RntbdResponseStatus decode(final ByteBuf in) { final HttpResponseStatus status = HttpResponseStatus.valueOf(code); if (status == null) { - final String reason = String.format("status code: %d", code); + final String reason = Strings.lenientFormat("status code: %s", code); throw new CorruptedFrameException(reason); } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdServiceEndpoint.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdServiceEndpoint.java index 34ad472777d2..d3a4e6466b2e 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdServiceEndpoint.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdServiceEndpoint.java @@ -5,14 +5,16 @@ import com.azure.data.cosmos.BridgeInternal; import com.azure.data.cosmos.GoneException; -import com.azure.data.cosmos.internal.HttpConstants; -import com.azure.data.cosmos.internal.directconnectivity.RntbdTransportClient.Options; +import com.azure.data.cosmos.internal.directconnectivity.RntbdTransportClient; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; +import io.micrometer.core.instrument.Tag; import io.netty.bootstrap.Bootstrap; +import io.netty.channel.AdaptiveRecvByteBufAllocator; import io.netty.channel.Channel; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelOption; @@ -29,47 +31,71 @@ import java.net.URI; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; import java.util.stream.Stream; +import static com.azure.data.cosmos.internal.HttpConstants.HttpHeaders; +import static com.azure.data.cosmos.internal.directconnectivity.RntbdTransportClient.Options; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; @JsonSerialize(using = RntbdServiceEndpoint.JsonSerializer.class) public final class RntbdServiceEndpoint implements RntbdEndpoint { + // region Fields + + private static final String TAG_NAME = RntbdServiceEndpoint.class.getSimpleName(); + private static final long QUIET_PERIOD = 2L * 1_000_000_000L; + private static final AtomicLong instanceCount = new AtomicLong(); private static final Logger logger = LoggerFactory.getLogger(RntbdServiceEndpoint.class); - private static final String namePrefix = RntbdServiceEndpoint.class.getSimpleName() + '-'; + private static final AdaptiveRecvByteBufAllocator receiveBufferAllocator = new AdaptiveRecvByteBufAllocator(); private final RntbdClientChannelPool channelPool; private final AtomicBoolean closed; + private final AtomicInteger concurrentRequests; + private final long id; + private final AtomicLong lastRequestTime; private final RntbdMetrics metrics; - private final String name; + private final Provider provider; private final SocketAddress remoteAddress; private final RntbdRequestTimer requestTimer; + private final Tag tag; + + // endregion // region Constructors private RntbdServiceEndpoint( - final Config config, final NioEventLoopGroup group, final RntbdRequestTimer timer, final URI physicalAddress + final Provider provider, final Config config, final NioEventLoopGroup group, final RntbdRequestTimer timer, + final URI physicalAddress ) { final Bootstrap bootstrap = new Bootstrap() .channel(NioSocketChannel.class) .group(group) + .option(ChannelOption.ALLOCATOR, config.allocator()) .option(ChannelOption.AUTO_READ, true) - .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, config.getConnectionTimeout()) + .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, config.connectionTimeout()) + .option(ChannelOption.RCVBUF_ALLOCATOR, receiveBufferAllocator) .option(ChannelOption.SO_KEEPALIVE, true) .remoteAddress(physicalAddress.getHost(), physicalAddress.getPort()); - this.name = RntbdServiceEndpoint.namePrefix + instanceCount.incrementAndGet(); - this.channelPool = new RntbdClientChannelPool(bootstrap, config); + this.channelPool = new RntbdClientChannelPool(this, bootstrap, config); this.remoteAddress = bootstrap.config().remoteAddress(); - this.metrics = new RntbdMetrics(this.name); + this.concurrentRequests = new AtomicInteger(); + this.lastRequestTime = new AtomicLong(); this.closed = new AtomicBoolean(); this.requestTimer = timer; + + this.tag = Tag.of(TAG_NAME, RntbdMetrics.escape(this.remoteAddress.toString())); + this.id = instanceCount.incrementAndGet(); + this.provider = provider; + + this.metrics = new RntbdMetrics(provider.transportClient, this); } // endregion @@ -77,8 +103,57 @@ private RntbdServiceEndpoint( // region Accessors @Override - public String getName() { - return this.name; + public int channelsAcquired() { + return this.channelPool.channelsAcquired(); + } + + @Override + public int channelsAvailable() { + return this.channelPool.channelsAvailable(); + } + + @Override + public int concurrentRequests() { + return this.concurrentRequests.get(); + } + + @Override + public long id() { + return this.id; + } + + @Override + public boolean isClosed() { + return this.closed.get(); + } + + public long lastRequestTime() { + return this.lastRequestTime.get(); + } + + @Override + public SocketAddress remoteAddress() { + return this.remoteAddress; + } + + @Override + public int requestQueueLength() { + return this.channelPool.requestQueueLength(); + } + + @Override + public Tag tag() { + return this.tag; + } + + @Override + public long usedDirectMemory() { + return this.channelPool.usedDirectMemory(); + } + + @Override + public long usedHeapMemory() { + return this.channelPool.usedHeapMemory(); } // endregion @@ -88,8 +163,8 @@ public String getName() { @Override public void close() { if (this.closed.compareAndSet(false, true)) { + this.provider.evict(this); this.channelPool.close(); - this.metrics.close(); } } @@ -97,39 +172,36 @@ public RntbdRequestRecord request(final RntbdRequestArgs args) { this.throwIfClosed(); + this.concurrentRequests.incrementAndGet(); + this.lastRequestTime.set(args.creationTime()); + if (logger.isDebugEnabled()) { args.traceOperation(logger, null, "request"); logger.debug("\n {}\n {}\n REQUEST", this, args); } - final RntbdRequestRecord requestRecord = this.write(args); - this.metrics.incrementRequestCount(); + final RntbdRequestRecord record = this.write(args); - requestRecord.whenComplete((response, error) -> { + record.whenComplete((response, error) -> { args.traceOperation(logger, null, "requestComplete", response, error); - this.metrics.incrementResponseCount(); - if (error != null) { - this.metrics.incrementErrorResponseCount(); + if (error == null) { + logger.debug("\n [{}]\n {}\n request succeeded with response status: {}", this, args, response.getStatus()); + } else { + logger.debug("\n [{}]\n {}\n request failed due to ", this, args, error); } - if (logger.isDebugEnabled()) { - if (error == null) { - final int status = response.getStatus(); - logger.debug("\n [{}]\n {}\n request succeeded with response status: {}", this, args, status); - } else { - logger.debug("\n [{}]\n {}\n request failed due to ", this, args, error); - } - } + this.concurrentRequests.decrementAndGet(); + this.metrics.markComplete(record); }); - return requestRecord; + return record; } @Override public String toString() { - return RntbdObjectMapper.toJson(this); + return RntbdObjectMapper.toString(this); } // endregion @@ -170,15 +242,12 @@ private RntbdRequestRecord write(final RntbdRequestArgs requestArgs) { channel.write(requestRecord).addListener((ChannelFuture future) -> { requestArgs.traceOperation(logger, null, "writeComplete", channel); - if (!future.isSuccess()) { - this.metrics.incrementErrorResponseCount(); - } }); return; } - final UUID activityId = requestArgs.getActivityId(); + final UUID activityId = requestArgs.activityId(); final Throwable cause = connected.cause(); if (connected.isCancelled()) { @@ -192,13 +261,13 @@ private RntbdRequestRecord write(final RntbdRequestArgs requestArgs) { final String reason = cause.getMessage(); final GoneException goneException = new GoneException( - String.format("failed to establish connection to %s: %s", this.remoteAddress, reason), + Strings.lenientFormat("failed to establish connection to %s: %s", this.remoteAddress, reason), cause instanceof Exception ? (Exception)cause : new IOException(reason, cause), - ImmutableMap.of(HttpConstants.HttpHeaders.ACTIVITY_ID, activityId.toString()), - requestArgs.getReplicaPath() + ImmutableMap.of(HttpHeaders.ACTIVITY_ID, activityId.toString()), + requestArgs.replicaPath() ); - BridgeInternal.setRequestHeaders(goneException, requestArgs.getServiceRequest().getHeaders()); + BridgeInternal.setRequestHeaders(goneException, requestArgs.serviceRequest().getHeaders()); requestRecord.completeExceptionally(goneException); } }); @@ -213,19 +282,17 @@ private RntbdRequestRecord write(final RntbdRequestArgs requestArgs) { static final class JsonSerializer extends StdSerializer { public JsonSerializer() { - this(null); - } - - public JsonSerializer(Class type) { - super(type); + super(RntbdServiceEndpoint.class); } @Override public void serialize(RntbdServiceEndpoint value, JsonGenerator generator, SerializerProvider provider) throws IOException { - generator.writeStartObject(); - generator.writeStringField(value.name, value.remoteAddress.toString()); + generator.writeNumberField("id", value.id); + generator.writeBooleanField("isClosed", value.isClosed()); + generator.writeNumberField("concurrentRequests", value.concurrentRequests()); + generator.writeStringField("remoteAddress", value.remoteAddress.toString()); generator.writeObjectField("channelPool", value.channelPool); generator.writeEndObject(); } @@ -235,14 +302,17 @@ public static final class Provider implements RntbdEndpoint.Provider { private static final Logger logger = LoggerFactory.getLogger(Provider.class); - private final AtomicBoolean closed = new AtomicBoolean(); + private final AtomicBoolean closed; private final Config config; - private final ConcurrentHashMap endpoints = new ConcurrentHashMap<>(); + private final ConcurrentHashMap endpoints; private final NioEventLoopGroup eventLoopGroup; + private final AtomicInteger evictions; private final RntbdRequestTimer requestTimer; + private final RntbdTransportClient transportClient; - public Provider(final Options options, final SslContext sslContext) { + public Provider(final RntbdTransportClient transportClient, final Options options, final SslContext sslContext) { + checkNotNull(transportClient, "provider"); checkNotNull(options, "options"); checkNotNull(sslContext, "sslContext"); @@ -258,13 +328,18 @@ public Provider(final Options options, final SslContext sslContext) { wireLogLevel = null; } + this.transportClient = transportClient; this.config = new Config(options, sslContext, wireLogLevel); - this.requestTimer = new RntbdRequestTimer(config.getRequestTimeout()); + this.requestTimer = new RntbdRequestTimer(config.requestTimeout()); this.eventLoopGroup = new NioEventLoopGroup(threadCount, threadFactory); + + this.endpoints = new ConcurrentHashMap<>(); + this.evictions = new AtomicInteger(); + this.closed = new AtomicBoolean(); } @Override - public void close() throws RuntimeException { + public void close() { if (this.closed.compareAndSet(false, true)) { @@ -274,7 +349,7 @@ public void close() throws RuntimeException { endpoint.close(); } - this.eventLoopGroup.shutdownGracefully().addListener(future -> { + this.eventLoopGroup.shutdownGracefully(QUIET_PERIOD, this.config.shutdownTimeout(), TimeUnit.NANOSECONDS).addListener(future -> { if (future.isSuccess()) { logger.debug("\n [{}]\n closed endpoints", this); return; @@ -297,10 +372,15 @@ public int count() { return this.endpoints.size(); } + @Override + public int evictions() { + return this.evictions.get(); + } + @Override public RntbdEndpoint get(URI physicalAddress) { return endpoints.computeIfAbsent(physicalAddress.getAuthority(), authority -> - new RntbdServiceEndpoint(config, eventLoopGroup, requestTimer, physicalAddress) + new RntbdServiceEndpoint(this, config, eventLoopGroup, requestTimer, physicalAddress) ); } @@ -309,7 +389,7 @@ public Stream list() { return this.endpoints.values().stream(); } - private void deleteEndpoint(final URI physicalAddress) { + private void evict(RntbdEndpoint endpoint) { // TODO: DANOBLE: Utilize this method of tearing down unhealthy endpoints // Specifically, ensure that this method is called when a Read/WriteTimeoutException occurs or a health @@ -318,13 +398,8 @@ private void deleteEndpoint(final URI physicalAddress) { // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/331552 // https://msdata.visualstudio.com/CosmosDB/_workitems/edit/331593 - checkNotNull(physicalAddress, "physicalAddress: %s", physicalAddress); - - final String authority = physicalAddress.getAuthority(); - final RntbdEndpoint endpoint = this.endpoints.remove(authority); - - if (endpoint != null) { - endpoint.close(); + if (this.endpoints.remove(endpoint.remoteAddress().toString()) != null) { + this.evictions.incrementAndGet(); } } } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdToken.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdToken.java index 187fe2a78114..8bb5f7f7f095 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdToken.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdToken.java @@ -10,11 +10,13 @@ import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.ser.PropertyWriter; import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; +import com.google.common.base.Strings; import io.netty.buffer.ByteBuf; import static com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdConstants.RntbdHeader; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Preconditions.checkState; @JsonPropertyOrder({ "id", "name", "type", "present", "required", "value" }) final class RntbdToken { @@ -86,8 +88,9 @@ public T getValue(final Class cls) { @JsonProperty public void setValue(final Object value) { this.ensureValid(value); - this.length = Integer.MIN_VALUE; + this.releaseBuffer(); this.value = value; + this.length = Integer.MIN_VALUE; } @JsonIgnore @@ -117,7 +120,7 @@ public int computeLength() { if (this.value instanceof ByteBuf) { final ByteBuf buffer = (ByteBuf)this.value; - assert buffer.readerIndex() == 0; + checkState(buffer.readerIndex() == 0); return HEADER_LENGTH + buffer.readableBytes(); } @@ -140,7 +143,7 @@ public void decode(final ByteBuf in) { ((ByteBuf)this.value).release(); } - this.value = this.header.type().codec().readSlice(in).retain(); // No data transfer until the first call to RntbdToken.getValue + this.value = this.header.type().codec().readSlice(in).retain(); // No data transfer until first call to RntbdToken.getValue } public void encode(final ByteBuf out) { @@ -149,7 +152,7 @@ public void encode(final ByteBuf out) { if (!this.isPresent()) { if (this.isRequired()) { - final String message = String.format("Missing value for required header: %s", this); + final String message = Strings.lenientFormat("Missing value for required header: %s", this); throw new IllegalStateException(message); } return; @@ -166,16 +169,13 @@ public void encode(final ByteBuf out) { } } - public void releaseBuffer() { - if (this.value instanceof ByteBuf) { - final ByteBuf buffer = (ByteBuf)this.value; - buffer.release(); - } + public boolean releaseBuffer() { + return this.value instanceof ByteBuf && ((ByteBuf)this.value).release(); } @Override public String toString() { - return RntbdObjectMapper.toJson(this); + return RntbdObjectMapper.toString(this); } // endregion @@ -183,8 +183,8 @@ public String toString() { // region Privates private void ensureValid(final Object value) { - checkNotNull(value, "value"); - checkArgument(this.header.type().codec().isValid(value), "value: %s", value.getClass()); + checkArgument(value != null, "value: null"); + checkArgument(this.header.type().codec().isValid(value), "value: %s = %s", value.getClass().getName(), value); } // endregion diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdTokenStream.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdTokenStream.java index c28724b9f905..9c60d50d71f7 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdTokenStream.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdTokenStream.java @@ -3,6 +3,7 @@ package com.azure.data.cosmos.internal.directconnectivity.rntbd; +import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Maps; @@ -16,17 +17,20 @@ @SuppressWarnings("UnstableApiUsage") abstract class RntbdTokenStream & RntbdHeader> { + final ByteBuf in; final ImmutableMap headers; final ImmutableMap tokens; - RntbdTokenStream(final ImmutableSet headers, final ImmutableMap ids) { + RntbdTokenStream(final ImmutableSet headers, final ImmutableMap ids, final ByteBuf in) { checkNotNull(headers, "headers"); checkNotNull(ids, "ids"); + checkNotNull(in, "in"); final Collector> collector = Maps.toImmutableEnumMap(h -> h, RntbdToken::create); this.tokens = headers.stream().collect(collector); this.headers = ids; + this.in = in.retain(); } final int computeCount() { @@ -53,7 +57,9 @@ final int computeLength() { return total; } - static > T decode(final ByteBuf in, final T stream) { + static > T decode(final T stream) { + + ByteBuf in = stream.in; while (in.readableBytes() > 0) { @@ -71,7 +77,7 @@ static > T decode(final ByteBuf in, final T stream for (final RntbdToken token : stream.tokens.values()) { if (!token.isPresent() && token.isRequired()) { - final String reason = String.format("Required token not found on RNTBD stream: type: %s, identifier: %s", + final String reason = Strings.lenientFormat("Required token not found on token stream: type=%s, identifier=%s", token.getTokenType(), token.getId()); throw new IllegalStateException(reason); } @@ -94,6 +100,7 @@ final void releaseBuffers() { for (final RntbdToken token : this.tokens.values()) { token.releaseBuffer(); } + in.release(); } private static final class UndefinedHeader implements RntbdHeader { diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdTokenType.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdTokenType.java index f441e432f2d1..3d31340966d7 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdTokenType.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdTokenType.java @@ -7,11 +7,14 @@ import com.google.common.base.Utf8; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufUtil; +import io.netty.handler.codec.CorruptedFrameException; import io.netty.handler.codec.DecoderException; import java.nio.charset.StandardCharsets; import java.util.UUID; +import static com.google.common.base.Preconditions.checkState; + enum RntbdTokenType { // All values are encoded as little endian byte sequences except for Guid @@ -88,6 +91,14 @@ public interface Codec { Class valueType(); void write(Object value, ByteBuf out); + + static void checkReadableBytes(final ByteBuf in, final long length, final long maxLength) { + if (length != in.readableBytes() || length > maxLength) { + String message = Strings.lenientFormat("maxLength: %s, length: %s, readableBytes: %s", + maxLength, length, in.readableBytes()); + throw new CorruptedFrameException(message); + } + } } private static class RntbdByte implements Codec { @@ -141,7 +152,7 @@ public final Class valueType() { @Override public final void write(final Object value, final ByteBuf out) { assert this.isValid(value); - out.writeByte(value instanceof java.lang.Byte ? (byte)value : ((boolean)value ? 0x01 : 0x00)); + out.writeByte(value instanceof Byte ? (byte)value : ((boolean)value ? 0x01 : 0x00)); } } @@ -178,6 +189,7 @@ public boolean isValid(final Object value) { @Override public Object read(final ByteBuf in) { final int length = in.readUnsignedShortLE(); + Codec.checkReadableBytes(in, length, 0xFFFF); return in.readBytes(length); } @@ -189,7 +201,7 @@ public ByteBuf readSlice(final ByteBuf in) { @Override public Class valueType() { - return java.lang.Byte[].class; + return Byte[].class; } @Override @@ -250,7 +262,7 @@ public final ByteBuf readSlice(final ByteBuf in) { @Override public Class valueType() { - return java.lang.Double.class; + return Double.class; } @Override @@ -301,7 +313,7 @@ public final ByteBuf readSlice(final ByteBuf in) { @Override public Class valueType() { - return java.lang.Float.class; + return Float.class; } @Override @@ -454,7 +466,7 @@ public final ByteBuf readSlice(final ByteBuf in) { @Override public Class valueType() { - return java.lang.Long.class; + return Long.class; } @Override @@ -479,28 +491,20 @@ public final int computeLength(final Object value) { @Override public final boolean isValid(final Object value) { - return value instanceof byte[] && ((byte[])value).length < 0xFFFF; + return value instanceof byte[]; } @Override public final Object read(final ByteBuf in) { - final long length = in.readUnsignedIntLE(); - - if (length > Integer.MAX_VALUE) { - throw new IllegalStateException(); - } + Codec.checkReadableBytes(in, length, Integer.MAX_VALUE); return in.readBytes((int)length); } @Override public final ByteBuf readSlice(final ByteBuf in) { - final long length = in.getUnsignedIntLE(in.readerIndex()); - - if (length > Integer.MAX_VALUE) { - throw new IllegalStateException(); - } + checkState(length <= Integer.MAX_VALUE); return in.readSlice(Integer.BYTES + (int)length); } @@ -529,19 +533,13 @@ public final int computeLength(final Object value) { @Override public final Object read(final ByteBuf in) { - final long length = in.readUnsignedIntLE(); - - if (length > Integer.MAX_VALUE) { - throw new IllegalStateException(); - } - + Codec.checkReadableBytes(in, length, Integer.MAX_VALUE); return in.readCharSequence((int)length, StandardCharsets.UTF_8).toString(); } @Override public final void write(final Object value, final ByteBuf out) { - final int length = this.computeLength(value, Integer.MAX_VALUE); out.writeIntLE(length); writeValue(out, value, length); @@ -607,13 +605,14 @@ public final int computeLength(final Object value) { @Override public final boolean isValid(final Object value) { - return value instanceof byte[] && ((byte[])value).length < 0xFFFF; + return value instanceof byte[] && ((byte[])value).length <= 0xFF; } @Override public final Object read(final ByteBuf in) { final int length = in.readUnsignedByte(); + Codec.checkReadableBytes(in, length, 0xFF); final byte[] bytes = new byte[length]; in.readBytes(bytes); @@ -656,7 +655,9 @@ public final int computeLength(final Object value) { @Override public final Object read(final ByteBuf in) { - return in.readCharSequence(in.readUnsignedByte(), StandardCharsets.UTF_8).toString(); + final int length = in.readUnsignedByte(); + Codec.checkReadableBytes(in, length, 0xFF); + return in.readCharSequence(length, StandardCharsets.UTF_8).toString(); } @Override @@ -685,9 +686,9 @@ final int computeLength(final Object value, final int maxLength) { assert this.isValid(value); final int length; - if (value instanceof java.lang.String) { + if (value instanceof String) { - final java.lang.String string = (java.lang.String)value; + final String string = (String)value; length = Utf8.encodedLength(string); } else { @@ -695,7 +696,7 @@ final int computeLength(final Object value, final int maxLength) { final byte[] string = (byte[])value; if (!Utf8.isWellFormed(string)) { - final java.lang.String reason = Strings.lenientFormat("UTF-8 byte string is ill-formed: %s", ByteBufUtil.hexDump(string)); + final String reason = Strings.lenientFormat("UTF-8 byte string is ill-formed: %s", ByteBufUtil.hexDump(string)); throw new DecoderException(reason); } @@ -703,7 +704,7 @@ final int computeLength(final Object value, final int maxLength) { } if (length > maxLength) { - final java.lang.String reason = Strings.lenientFormat("UTF-8 byte string exceeds %s bytes: %s bytes", maxLength, length); + final String reason = Strings.lenientFormat("UTF-8 byte string exceeds %s bytes: %s bytes", maxLength, length); throw new DecoderException(reason); } @@ -718,7 +719,7 @@ public int computeLength(final Object value) { @Override public final Object convert(final Object value) { assert this.isValid(value); - return value instanceof java.lang.String ? value : new String((byte[])value, StandardCharsets.UTF_8); + return value instanceof String ? value : new String((byte[])value, StandardCharsets.UTF_8); } @Override @@ -728,12 +729,13 @@ public final Object defaultValue() { @Override public final boolean isValid(final Object value) { - return value instanceof java.lang.String || value instanceof byte[]; + return value instanceof String || value instanceof byte[]; } @Override public Object read(final ByteBuf in) { final int length = in.readUnsignedShortLE(); + Codec.checkReadableBytes(in, length, 0xFFFF); return in.readCharSequence(length, StandardCharsets.UTF_8).toString(); } @@ -744,7 +746,7 @@ public ByteBuf readSlice(final ByteBuf in) { @Override public Class valueType() { - return java.lang.String.class; + return String.class; } @Override @@ -759,8 +761,8 @@ static void writeValue(final ByteBuf out, final Object value, final int length) final int start = out.writerIndex(); - if (value instanceof java.lang.String) { - out.writeCharSequence((java.lang.String)value, StandardCharsets.UTF_8); + if (value instanceof String) { + out.writeCharSequence((String)value, StandardCharsets.UTF_8); } else { out.writeBytes((byte[])value); } @@ -810,7 +812,7 @@ public final ByteBuf readSlice(final ByteBuf in) { @Override public Class valueType() { - return java.lang.Long.class; + return Long.class; } @Override diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdUUID.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdUUID.java index d63c6bbb8a84..c66bcf4a73f6 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdUUID.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdUUID.java @@ -3,6 +3,7 @@ package com.azure.data.cosmos.internal.directconnectivity.rntbd; +import com.google.common.base.Strings; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.CorruptedFrameException; @@ -39,7 +40,7 @@ public static UUID decode(final ByteBuf in) { checkNotNull(in, "in"); if (in.readableBytes() < 2 * Long.BYTES) { - final String reason = String.format("invalid frame length: %d", in.readableBytes()); + final String reason = Strings.lenientFormat("invalid frame length: %s", in.readableBytes()); throw new CorruptedFrameException(reason); } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/LocationCache.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/LocationCache.java index aa67be44a1c1..ba0596c8e5f5 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/LocationCache.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/LocationCache.java @@ -4,8 +4,8 @@ package com.azure.data.cosmos.internal.routing; import com.azure.data.cosmos.BridgeInternal; -import com.azure.data.cosmos.internal.DatabaseAccount; -import com.azure.data.cosmos.internal.DatabaseAccountLocation; +import com.azure.data.cosmos.DatabaseAccount; +import com.azure.data.cosmos.DatabaseAccountLocation; import com.azure.data.cosmos.internal.Configs; import com.azure.data.cosmos.internal.ResourceType; import com.azure.data.cosmos.internal.RxDocumentServiceRequest; @@ -119,8 +119,8 @@ public void markEndpointUnavailableForWrite(URL endpoint) { */ public void onDatabaseAccountRead(DatabaseAccount databaseAccount) { this.updateLocationCache( - databaseAccount.getWritableLocations(), - databaseAccount.getReadableLocations(), + databaseAccount.writableLocations(), + databaseAccount.readableLocations(), null, BridgeInternal.isEnableMultipleWriteLocations(databaseAccount)); } @@ -138,12 +138,12 @@ void onLocationPreferenceChanged(UnmodifiableList preferredLocations) { * Once the endpoint is marked unavailable, it is moved to the end of available write endpoint. Current request will * be retried on next preferred available write endpoint. * (ii) For all other resources, always resolve to first/second (regardless of preferred locations) - * write endpoint in {@link DatabaseAccount#getWritableLocations()}. - * Endpoint of first write location in {@link DatabaseAccount#getWritableLocations()} is the only endpoint that supports + * write endpoint in {@link DatabaseAccount#writableLocations()}. + * Endpoint of first write location in {@link DatabaseAccount#writableLocations()} is the only endpoint that supports * write operation on all resource types (except during that region's failover). - * Only during manual failover, client would retry write on second write location in {@link DatabaseAccount#getWritableLocations()}. - * (b) Else resolve the request to first write endpoint in {@link DatabaseAccount#getWritableLocations()} OR - * second write endpoint in {@link DatabaseAccount#getWritableLocations()} in case of manual failover of that location. + * Only during manual failover, client would retry write on second write location in {@link DatabaseAccount#writableLocations()}. + * (b) Else resolve the request to first write endpoint in {@link DatabaseAccount#writableLocations()} OR + * second write endpoint in {@link DatabaseAccount#writableLocations()} in case of manual failover of that location. * 2. Else resolve the request to most preferred available read endpoint (automatic failover for read requests) * @param request Request for which endpoint is to be resolved * @return Resolved endpoint @@ -440,16 +440,16 @@ private UnmodifiableMap getEndpointByLocation(Iterable parsedLocations = new ArrayList<>(); for (DatabaseAccountLocation location: locations) { - if (!Strings.isNullOrEmpty(location.getName())) { + if (!Strings.isNullOrEmpty(location.name())) { try { - URL endpoint = new URL(location.getEndpoint().toLowerCase()); - endpointsByLocation.put(location.getName().toLowerCase(), endpoint); - parsedLocations.add(location.getName()); + URL endpoint = new URL(location.endpoint().toLowerCase()); + endpointsByLocation.put(location.name().toLowerCase(), endpoint); + parsedLocations.add(location.name()); } catch (Exception e) { logger.warn("GetAvailableEndpointsByLocation() - skipping add for location = [{}] as it is location name is either empty or endpoint is malformed [{}]", - location.getName(), - location.getEndpoint()); + location.name(), + location.endpoint()); } } } @@ -559,4 +559,4 @@ public DatabaseAccountLocationsInfo(DatabaseAccountLocationsInfo other) { this.readEndpoints = other.readEndpoints; } } -} \ No newline at end of file +} diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncContainer.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncContainer.java index 6d34013a9d73..256eae410adf 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncContainer.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncContainer.java @@ -29,6 +29,7 @@ public class CosmosSyncContainer { private final CosmosContainer containerWrapper; private final CosmosSyncDatabase database; private final String id; + private CosmosSyncScripts scripts; /** * Instantiates a new Cosmos sync container. @@ -118,6 +119,27 @@ public CosmosSyncContainerResponse replace(CosmosContainerProperties containerPr return database.mapContainerResponseAndBlock(this.containerWrapper.replace(containerProperties, options)); } + /** + * Read provisioned throughput integer. + * + * @return the integer. null response indicates database doesn't have any provisioned RUs + * @throws CosmosClientException the cosmos client exception + */ + public Integer readProvisionedThroughput() throws CosmosClientException { + return CosmosSyncDatabase.throughputResponseToBlock(this.containerWrapper.readProvisionedThroughput()); + } + + /** + * Replace provisioned throughput integer. + * + * @param requestUnitsPerSecond the request units per second + * @return the integer + * @throws CosmosClientException the cosmos client exception + */ + public Integer replaceProvisionedThroughput(int requestUnitsPerSecond) throws CosmosClientException { + return CosmosSyncDatabase.throughputResponseToBlock(this.containerWrapper.replaceProvisionedThroughput(requestUnitsPerSecond)); + } + /* CosmosItem operations */ @@ -246,13 +268,26 @@ public CosmosSyncItem getItem(String id, Object partitionKey) { containerWrapper.getItem(id, partitionKey)); } + /** + * Gets the cosmos sync scripts. + * + * @return the cosmos sync scripts + */ + public CosmosSyncScripts getScripts(){ + if (this.scripts == null) { + this.scripts = new CosmosSyncScripts(this, containerWrapper.getScripts()); + } + return this.scripts; + } + + // TODO: should make partitionkey public in CosmosItem and fix the below call /** * Convert response cosmos sync item response. * * @param response the cosmos item response * @return the cosmos sync item response */ - CosmosSyncItemResponse convertResponse(CosmosItemResponse response) { + private CosmosSyncItemResponse convertResponse(CosmosItemResponse response) { return new CosmosSyncItemResponse(response, null, this); } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncContainerResponse.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncContainerResponse.java index 874ae58ce85f..9e9a4d139af1 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncContainerResponse.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncContainerResponse.java @@ -14,12 +14,13 @@ /** * The synchronous cosmos container response */ -public class CosmosSyncContainerResponse { +public class CosmosSyncContainerResponse extends CosmosSyncResponse { private final CosmosContainerResponse responseWrapper; private final CosmosSyncContainer container; CosmosSyncContainerResponse(CosmosContainerResponse response, CosmosSyncDatabase database, CosmosSyncClient client) { + super(response); this.responseWrapper = response; if (responseWrapper.container() != null) { this.container = new CosmosSyncContainer(responseWrapper.container().id(), database, responseWrapper.container()); diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncDatabase.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncDatabase.java index 5875af50e8c0..5e41a32d534b 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncDatabase.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncDatabase.java @@ -9,10 +9,13 @@ import com.azure.data.cosmos.CosmosContainerResponse; import com.azure.data.cosmos.CosmosDatabase; import com.azure.data.cosmos.CosmosDatabaseRequestOptions; +import com.azure.data.cosmos.CosmosUserProperties; +import com.azure.data.cosmos.CosmosUserResponse; import com.azure.data.cosmos.FeedOptions; import com.azure.data.cosmos.FeedResponse; import com.azure.data.cosmos.SqlQuerySpec; import reactor.core.Exceptions; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.util.Iterator; @@ -338,9 +341,159 @@ public CosmosSyncContainer getContainer(String id) { * @param response the response * @return the cosmos sync container response */ - /* */ CosmosSyncContainerResponse convertResponse(CosmosContainerResponse response) { return new CosmosSyncContainerResponse(response, this, client); } + /* Users */ + + /** + * Create user cosmos sync user response. + * + * @param settings the settings + * @return the cosmos sync user response + * @throws CosmosClientException the cosmos client exception + */ + public CosmosSyncUserResponse createUser(CosmosUserProperties settings) throws CosmosClientException { + return mapUserResponseAndBlock(databaseWrapper.createUser(settings)); + } + + /** + * Upsert user cosmos sync user response. + * + * @param settings the settings + * @return the cosmos sync user response + * @throws CosmosClientException the cosmos client exception + */ + public CosmosSyncUserResponse upsertUser(CosmosUserProperties settings) throws CosmosClientException { + return mapUserResponseAndBlock(databaseWrapper.upsertUser(settings)); + } + + /** + * Read all users iterator. + * + * @return the iterator + */ + public Iterator> readAllUsers() { + return getFeedIterator(databaseWrapper.readAllUsers()); + } + + /** + * Read all users iterator. + * + * @param options the options + * @return the iterator + */ + public Iterator> readAllUsers(FeedOptions options) { + return getFeedIterator(databaseWrapper.readAllUsers(options)); + } + + /** + * Query users iterator. + * + * @param query the query + * @return the iterator + */ + public Iterator> queryUsers(String query) { + return getFeedIterator(databaseWrapper.queryUsers(query)); + } + + /** + * Query users iterator. + * + * @param query the query + * @param options the options + * @return the iterator + */ + public Iterator> queryUsers(String query, FeedOptions options) { + return getFeedIterator(databaseWrapper.queryUsers(query, options)); + } + + /** + * Query users iterator. + * + * @param querySpec the query spec + * @return the iterator + */ + public Iterator> queryUsers(SqlQuerySpec querySpec) { + return getFeedIterator(databaseWrapper.queryUsers(querySpec)); + } + + /** + * Query users iterator. + * + * @param querySpec the query spec + * @param options the options + * @return the iterator + */ + public Iterator> queryUsers(SqlQuerySpec querySpec, FeedOptions options) { + return getFeedIterator(databaseWrapper.queryUsers(querySpec, options)); + } + + /** + * Gets user. + * + * @param id the id + * @return the user + */ + public CosmosSyncUser getUser(String id) { + return new CosmosSyncUser(databaseWrapper.getUser(id), this, id); + } + + CosmosSyncUserResponse mapUserResponseAndBlock(Mono containerMono) + throws CosmosClientException { + try { + return containerMono.map(this::convertUserResponse).block(); + } catch (Exception ex) { + final Throwable throwable = Exceptions.unwrap(ex); + if (throwable instanceof CosmosClientException) { + throw (CosmosClientException) throwable; + } else { + throw ex; + } + } + } + + private CosmosSyncUserResponse convertUserResponse(CosmosUserResponse response) { + return new CosmosSyncUserResponse(response, this); + } + + /** + * Read provisioned throughput integer. + * + * @return the integer. null response indicates database doesn't have any provisioned RUs + * @throws CosmosClientException the cosmos client exception + */ + public Integer readProvisionedThroughput() throws CosmosClientException { + return throughputResponseToBlock(databaseWrapper.readProvisionedThroughput()); + } + + /** + * Replace provisioned throughput integer. + * + * @param requestUnitsPerSecond the request units per second + * @return the integer + * @throws CosmosClientException the cosmos client exception + */ + public Integer replaceProvisionedThroughput(int requestUnitsPerSecond) throws CosmosClientException { + return throughputResponseToBlock(databaseWrapper.replaceProvisionedThroughput(requestUnitsPerSecond)); + } + + static Integer throughputResponseToBlock(Mono throughputResponse) throws CosmosClientException { + try { + return throughputResponse.block(); + } catch (Exception ex) { + final Throwable throwable = Exceptions.unwrap(ex); + if (throwable instanceof CosmosClientException) { + throw (CosmosClientException) throwable; + } else { + throw ex; + } + } + } + + private Iterator> getFeedIterator(Flux> itemFlux) { + return itemFlux.toIterable(1).iterator(); + } + } diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncDatabaseResponse.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncDatabaseResponse.java index c765a416cd0f..0638999d6074 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncDatabaseResponse.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncDatabaseResponse.java @@ -6,11 +6,12 @@ import com.azure.data.cosmos.CosmosDatabaseProperties; import com.azure.data.cosmos.CosmosDatabaseResponse; -public class CosmosSyncDatabaseResponse { +public class CosmosSyncDatabaseResponse extends CosmosSyncResponse { private final CosmosDatabaseResponse responseWrapper; private final CosmosSyncDatabase database; CosmosSyncDatabaseResponse(CosmosDatabaseResponse response, CosmosSyncClient client) { + super(response); this.responseWrapper = response; if (responseWrapper.database() != null) { this.database = new CosmosSyncDatabase(responseWrapper.database().id(), client, responseWrapper.database()); diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncItemResponse.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncItemResponse.java index 3c379ccbaaef..3926fc5fd948 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncItemResponse.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncItemResponse.java @@ -7,12 +7,13 @@ import com.azure.data.cosmos.CosmosItemResponse; import com.azure.data.cosmos.PartitionKey; -public class CosmosSyncItemResponse { +public class CosmosSyncItemResponse extends CosmosSyncResponse { private final CosmosItemResponse responseWrapper; private final CosmosSyncItem item; CosmosSyncItemResponse(CosmosItemResponse response, PartitionKey partitionKey, CosmosSyncContainer container) { + super(response); this.responseWrapper = response; if (responseWrapper.item() != null) { this.item = new CosmosSyncItem(responseWrapper.item().id(), partitionKey, container, responseWrapper.item()); diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncResponse.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncResponse.java new file mode 100644 index 000000000000..eb9ca39aec93 --- /dev/null +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncResponse.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.data.cosmos.sync; + +import com.azure.data.cosmos.CosmosResponse; +import com.azure.data.cosmos.CosmosResponseDiagnostics; + +import java.time.Duration; +import java.util.Map; + +public class CosmosSyncResponse { + private final CosmosResponse resourceResponseWrapper; + + CosmosSyncResponse(CosmosResponse resourceResponse) { + this.resourceResponseWrapper = resourceResponse; + } + + /** + * Gets the maximum size limit for this entity (in megabytes (MB) for server resources and in count for master + * resources). + * + * @return the max resource quota. + */ + public String maxResourceQuota() { + return resourceResponseWrapper.maxResourceQuota(); + } + + /** + * Gets the current size of this entity (in megabytes (MB) for server resources and in count for master resources) + * + * @return the current resource quota usage. + */ + public String currentResourceQuotaUsage() { + return resourceResponseWrapper.currentResourceQuotaUsage(); + } + + /** + * Gets the Activity ID for the request. + * + * @return the activity id. + */ + public String activityId() { + return resourceResponseWrapper.activityId(); + } + + /** + * Gets the number of index paths (terms) generated by the operation. + * + * @return the request charge. + */ + public double requestCharge() { + return resourceResponseWrapper.requestCharge(); + } + + /** + * Gets the HTTP status code associated with the response. + * + * @return the status code. + */ + public int statusCode() { + return resourceResponseWrapper.statusCode(); + } + + /** + * Gets the token used for managing client's consistency requirements. + * + * @return the session token. + */ + public String sessionToken() { + return resourceResponseWrapper.sessionToken(); + } + + /** + * Gets the headers associated with the response. + * + * @return the response headers. + */ + public Map responseHeaders() { + return resourceResponseWrapper.responseHeaders(); + } + + /** + * Gets the diagnostics information for the current request to Azure Cosmos DB service. + * + * @return diagnostics information for the current request to Azure Cosmos DB service. + */ + public CosmosResponseDiagnostics cosmosResponseDiagnosticsString() { + return resourceResponseWrapper.cosmosResponseDiagnosticsString(); + } + + /** + * Gets the end-to-end request latency for the current request to Azure Cosmos DB service. + * + * @return end-to-end request latency for the current request to Azure Cosmos DB service. + */ + public Duration requestLatency() { + return resourceResponseWrapper.requestLatency(); + } +} diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncScripts.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncScripts.java new file mode 100644 index 000000000000..7d4fafff6faf --- /dev/null +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncScripts.java @@ -0,0 +1,375 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.data.cosmos.sync; + +import com.azure.data.cosmos.CosmosClientException; +import com.azure.data.cosmos.CosmosResponse; +import com.azure.data.cosmos.CosmosScripts; +import com.azure.data.cosmos.CosmosStoredProcedureProperties; +import com.azure.data.cosmos.CosmosStoredProcedureRequestOptions; +import com.azure.data.cosmos.CosmosStoredProcedureResponse; +import com.azure.data.cosmos.CosmosTriggerProperties; +import com.azure.data.cosmos.CosmosTriggerResponse; +import com.azure.data.cosmos.CosmosUserDefinedFunctionProperties; +import com.azure.data.cosmos.CosmosUserDefinedFunctionResponse; +import com.azure.data.cosmos.FeedOptions; +import com.azure.data.cosmos.FeedResponse; +import com.azure.data.cosmos.SqlQuerySpec; +import reactor.core.Exceptions; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.Iterator; + +/** + * The type Cosmos sync scripts. + */ +public class CosmosSyncScripts { + private final CosmosSyncContainer container; + private final CosmosScripts asyncScripts; + + /** + * Instantiates a new Cosmos sync scripts. + * + * @param container the container + * @param asyncScripts the async scripts + */ + CosmosSyncScripts(CosmosSyncContainer container, CosmosScripts asyncScripts) { + this.container = container; + this.asyncScripts = asyncScripts; + } + /* CosmosStoredProcedure operations */ + + /** + * Create stored procedure + * + * @param properties the properties + * @return the cosmos sync stored procedure response + * @throws CosmosClientException the cosmos client exception + */ + public CosmosSyncStoredProcedureResponse createStoredProcedure(CosmosStoredProcedureProperties properties) + throws CosmosClientException { + return mapStoredProcedureResponseAndBlock(asyncScripts.createStoredProcedure(properties, + new CosmosStoredProcedureRequestOptions())); + } + + /** + * Create stored procedure cosmos + * + * @param properties the properties + * @param options the options + * @return the cosmos sync stored procedure response + * @throws CosmosClientException the cosmos client exception + */ + public CosmosSyncStoredProcedureResponse createStoredProcedure(CosmosStoredProcedureProperties properties, + CosmosStoredProcedureRequestOptions options) throws CosmosClientException { + return mapStoredProcedureResponseAndBlock(asyncScripts.createStoredProcedure(properties, + options)); + } + + /** + * Read all stored procedures iterator. + * + * @param options the options + * @return the iterator + */ + public Iterator> readAllStoredProcedures(FeedOptions options) { + return getFeedIterator(asyncScripts.readAllStoredProcedures(options)); + } + + /** + * Query stored procedures iterator. + * + * @param query the query + * @param options the options + * @return the iterator + */ + public Iterator> queryStoredProcedures(String query, + FeedOptions options) { + return getFeedIterator(asyncScripts.queryStoredProcedures(query, options)); + } + + /** + * Query stored procedures iterator. + * + * @param querySpec the query spec + * @param options the options + * @return the iterator + */ + public Iterator> queryStoredProcedures(SqlQuerySpec querySpec, + FeedOptions options) { + return getFeedIterator(asyncScripts.queryStoredProcedures(querySpec, options)); + + } + + /** + * Gets stored procedure. + * + * @param id the id + * @return the stored procedure + */ + public CosmosSyncStoredProcedure getStoredProcedure(String id) { + return new CosmosSyncStoredProcedure(id, + this.container, + asyncScripts.getStoredProcedure(id)); + } + + + /* UDF Operations */ + + /** + * Create user defined function + * + * @param properties the properties + * @return the cosmos sync user defined function response + * @throws CosmosClientException the cosmos client exception + */ + public CosmosSyncUserDefinedFunctionResponse createUserDefinedFunction(CosmosUserDefinedFunctionProperties properties) throws CosmosClientException { + return mapUDFResponseAndBlock(asyncScripts.createUserDefinedFunction(properties)); + } + + /** + * Read all user defined functions iterator. + * + * @param options the options + * @return the iterator + */ + public Iterator> readAllUserDefinedFunctions(FeedOptions options) { + return getFeedIterator(asyncScripts.readAllUserDefinedFunctions(options)); + } + + /** + * Query user defined functions iterator. + * + * @param query the query + * @param options the options + * @return the iterator + */ + public Iterator> queryUserDefinedFunctions(String query, + FeedOptions options) { + return getFeedIterator(asyncScripts.queryUserDefinedFunctions(new SqlQuerySpec(query), options)); + } + + /** + * Query user defined functions iterator. + * + * @param querySpec the query spec + * @param options the options + * @return the iterator + */ + public Iterator> queryUserDefinedFunctions(SqlQuerySpec querySpec, + FeedOptions options) { + return getFeedIterator(asyncScripts.queryUserDefinedFunctions(querySpec, options)); + } + + /** + * Gets user defined function. + * + * @param id the id + * @return the user defined function + */ + public CosmosSyncUserDefinedFunction getUserDefinedFunction(String id) { + return new CosmosSyncUserDefinedFunction(id, + this.container, + asyncScripts.getUserDefinedFunction(id)); + } + + /** + * Create trigger + * + * @param properties the properties + * @return the cosmos sync trigger response + * @throws CosmosClientException the cosmos client exception + */ + /* Trigger Operations */ + public CosmosSyncTriggerResponse createTrigger(CosmosTriggerProperties properties) throws CosmosClientException { + return mapTriggerResponseAndBlock(asyncScripts.createTrigger(properties)); + } + + /** + * Read all triggers iterator. + * + * @param options the options + * @return the iterator + */ + public Iterator> readAllTriggers(FeedOptions options) { + return getFeedIterator(asyncScripts.readAllTriggers(options)); + } + + /** + * Query triggers iterator. + * + * @param query the query + * @param options the options + * @return the iterator + */ + public Iterator> queryTriggers(String query, FeedOptions options) { + return getFeedIterator(asyncScripts.queryTriggers(query, options)); + } + + /** + * Query triggers iterator. + * + * @param querySpec the query spec + * @param options the options + * @return the iterator + */ + public Iterator> queryTriggers(SqlQuerySpec querySpec, + FeedOptions options) { + return getFeedIterator(asyncScripts.queryTriggers(querySpec, options)); + } + + /** + * Gets trigger. + * + * @param id the id + * @return the trigger + */ + public CosmosSyncTrigger getTrigger(String id) { + return new CosmosSyncTrigger(id, + this.container, + asyncScripts.getTrigger(id)); + } + + /** + * Map stored procedure response and block cosmos sync stored procedure response. + * + * @param storedProcedureResponseMono the stored procedure response mono + * @return the cosmos sync stored procedure response + * @throws CosmosClientException the cosmos client exception + */ + CosmosSyncStoredProcedureResponse mapStoredProcedureResponseAndBlock(Mono storedProcedureResponseMono) + throws CosmosClientException { + try { + return storedProcedureResponseMono + .map(this::convertResponse) + .block(); + } catch (Exception ex) { + final Throwable throwable = Exceptions.unwrap(ex); + if (throwable instanceof CosmosClientException) { + throw (CosmosClientException) throwable; + } else { + throw ex; + } + } + } + + /** + * Map delete response and block cosmos sync response. + * + * @param responseMono the response mono + * @return the cosmos sync response + * @throws CosmosClientException the cosmos client exception + */ + CosmosSyncResponse mapDeleteResponseAndBlock(Mono responseMono) + throws CosmosClientException { + try { + return responseMono + .map(this::convertDeleteResponse) + .block(); + } catch (Exception ex) { + final Throwable throwable = Exceptions.unwrap(ex); + if (throwable instanceof CosmosClientException) { + throw (CosmosClientException) throwable; + } else { + throw ex; + } + } + } + + /** + * Convert delete response cosmos sync response. + * + * @param response the response + * @return the cosmos sync response + */ + CosmosSyncResponse convertDeleteResponse(CosmosResponse response) { + return new CosmosSyncResponse(response); + } + + /** + * Convert response cosmos sync stored procedure response. + * + * @param response the response + * @return the cosmos sync stored procedure response + */ + CosmosSyncStoredProcedureResponse convertResponse(CosmosStoredProcedureResponse response) { + return new CosmosSyncStoredProcedureResponse(response, getStoredProcedure(response.storedProcedure().id())); + } + + /** + * Map udf response and block cosmos sync user defined function response. + * + * @param responseMono the response mono + * @return the cosmos sync user defined function response + * @throws CosmosClientException the cosmos client exception + */ + CosmosSyncUserDefinedFunctionResponse mapUDFResponseAndBlock(Mono responseMono) + throws CosmosClientException { + try { + return responseMono + .map(this::convertResponse) + .block(); + } catch (Exception ex) { + final Throwable throwable = Exceptions.unwrap(ex); + if (throwable instanceof CosmosClientException) { + throw (CosmosClientException) throwable; + } else { + throw ex; + } + } + } + + /** + * Convert response cosmos sync user defined function response. + * + * @param response the response + * @return the cosmos sync user defined function response + */ + CosmosSyncUserDefinedFunctionResponse convertResponse(CosmosUserDefinedFunctionResponse response) { + return new CosmosSyncUserDefinedFunctionResponse(response, + getUserDefinedFunction(response.userDefinedFunction().id())); + } + + //Trigger + + /** + * Map trigger response and block cosmos sync trigger response. + * + * @param responseMono the response mono + * @return the cosmos sync trigger response + * @throws CosmosClientException the cosmos client exception + */ + CosmosSyncTriggerResponse mapTriggerResponseAndBlock(Mono responseMono) + throws CosmosClientException { + try { + return responseMono + .map(this::convertResponse) + .block(); + } catch (Exception ex) { + final Throwable throwable = Exceptions.unwrap(ex); + if (throwable instanceof CosmosClientException) { + throw (CosmosClientException) throwable; + } else { + throw ex; + } + } + } + + /** + * Convert response cosmos sync trigger response. + * + * @param response the response + * @return the cosmos sync trigger response + */ + CosmosSyncTriggerResponse convertResponse(CosmosTriggerResponse response) { + return new CosmosSyncTriggerResponse(response, + getTrigger(response.trigger().id())); + } + + private Iterator> getFeedIterator(Flux> itemFlux) { + return itemFlux.toIterable(1).iterator(); + } + +} diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncStoredProcedure.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncStoredProcedure.java new file mode 100644 index 000000000000..a6a16a518bc8 --- /dev/null +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncStoredProcedure.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.data.cosmos.sync; + +import com.azure.data.cosmos.CosmosClientException; +import com.azure.data.cosmos.CosmosStoredProcedure; +import com.azure.data.cosmos.CosmosStoredProcedureProperties; +import com.azure.data.cosmos.CosmosStoredProcedureRequestOptions; + +/** + * The type Cosmos sync stored procedure. + */ +public class CosmosSyncStoredProcedure { + private final String id; + private final CosmosSyncContainer container; + private final CosmosStoredProcedure storedProcedure; + + /** + * Instantiates a new Cosmos sync stored procedure. + * + * @param id the id + * @param container the container + * @param storedProcedure the stored procedure + */ + public CosmosSyncStoredProcedure(String id, CosmosSyncContainer container, CosmosStoredProcedure storedProcedure) { + + this.id = id; + this.container = container; + this.storedProcedure = storedProcedure; + } + + /** + * Id string. + * + * @return the string + */ + public String id() { + return id; + } + + /** + * Read cosmos sync stored procedure. + * + * @return the cosmos sync stored procedure response + * @throws CosmosClientException the cosmos client exception + */ + public CosmosSyncStoredProcedureResponse read() throws CosmosClientException { + return container.getScripts() + .mapStoredProcedureResponseAndBlock(storedProcedure.read()); + } + + /** + * Read cosmos sync stored procedure. + * + * @param options the options + * @return the cosmos sync stored procedure response + * @throws CosmosClientException the cosmos client exception + */ + public CosmosSyncStoredProcedureResponse read(CosmosStoredProcedureRequestOptions options) throws CosmosClientException { + return container.getScripts() + .mapStoredProcedureResponseAndBlock(storedProcedure.read(options)); + } + + /** + * Delete cosmos stored procedure. + * + * @return the cosmos sync response + * @throws CosmosClientException the cosmos client exception + */ + public CosmosSyncResponse delete() throws CosmosClientException { + return container.getScripts() + .mapDeleteResponseAndBlock(storedProcedure.delete()); + } + + /** + * Delete cosmos stored procedure. + * + * @param options the options + * @return the cosmos sync response + * @throws CosmosClientException the cosmos client exception + */ + CosmosSyncResponse delete(CosmosStoredProcedureRequestOptions options) throws CosmosClientException { + return container.getScripts() + .mapDeleteResponseAndBlock(storedProcedure.delete(options)); + } + + /** + * Execute cosmos sync stored procedure. + * + * @param procedureParams the procedure params + * @param options the options + * @return the cosmos sync stored procedure response + * @throws CosmosClientException the cosmos client exception + */ + public CosmosSyncStoredProcedureResponse execute(Object[] procedureParams, + CosmosStoredProcedureRequestOptions options) throws CosmosClientException { + return container.getScripts() + .mapStoredProcedureResponseAndBlock(storedProcedure.execute(procedureParams, options)); + } + + /** + * Replace cosmos sync stored procedure. + * + * @param storedProcedureSettings the stored procedure settings + * @return the cosmos sync stored procedure response + * @throws CosmosClientException the cosmos client exception + */ + public CosmosSyncStoredProcedureResponse replace(CosmosStoredProcedureProperties storedProcedureSettings) + throws CosmosClientException { + return container.getScripts() + .mapStoredProcedureResponseAndBlock(storedProcedure.replace(storedProcedureSettings)); + } + + /** + * Replace cosmos sync stored procedure. + * + * @param storedProcedureSettings the stored procedure settings + * @param options the options + * @return the cosmos sync stored procedure response + * @throws CosmosClientException the cosmos client exception + */ + public CosmosSyncStoredProcedureResponse replace(CosmosStoredProcedureProperties storedProcedureSettings, + CosmosStoredProcedureRequestOptions options) throws CosmosClientException { + return container.getScripts() + .mapStoredProcedureResponseAndBlock(storedProcedure.replace(storedProcedureSettings, options)); + + } +} diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncStoredProcedureResponse.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncStoredProcedureResponse.java new file mode 100644 index 000000000000..ecfd3dd0f093 --- /dev/null +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncStoredProcedureResponse.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.data.cosmos.sync; + +import com.azure.data.cosmos.CosmosStoredProcedureProperties; +import com.azure.data.cosmos.CosmosStoredProcedureResponse; + + +/** + * The type Cosmos sync stored procedure response. + */ +public class CosmosSyncStoredProcedureResponse extends CosmosSyncResponse { + private final CosmosSyncStoredProcedure cosmosSyncStoredProcedure; + private final CosmosStoredProcedureResponse asyncResponse; + + /** + * Instantiates a new Cosmos sync stored procedure response. + * + * @param resourceResponse the resource response + * @param storedProcedure the stored procedure + */ + CosmosSyncStoredProcedureResponse(CosmosStoredProcedureResponse resourceResponse, + CosmosSyncStoredProcedure storedProcedure) { + super(resourceResponse); + this.asyncResponse = resourceResponse; + this.cosmosSyncStoredProcedure = storedProcedure; + } + + /** + * Gets cosmos stored procedure properties. + * + * @return the cosmos stored procedure properties + */ + public CosmosStoredProcedureProperties properties() { + return asyncResponse.properties(); + } + + /** + * Gets cosmos sync stored procedure. + * + * @return the cosmos sync stored procedure + */ + public CosmosSyncStoredProcedure storedProcedure() { + return cosmosSyncStoredProcedure; + } + + @Override + public String activityId() { + return asyncResponse.activityId(); + } + + @Override + public String sessionToken() { + return asyncResponse.sessionToken(); + } + + @Override + public int statusCode() { + return asyncResponse.statusCode(); + } + + @Override + public double requestCharge() { + return asyncResponse.requestCharge(); + } + + /** + * Response as string string. + * + * @return the string + */ + public String responseAsString() { + return asyncResponse.responseAsString(); + } + + /** + * Script log string. + * + * @return the string + */ + public String scriptLog() { + return asyncResponse.scriptLog(); + } + + +} \ No newline at end of file diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncTrigger.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncTrigger.java new file mode 100644 index 000000000000..01ee1f975ce5 --- /dev/null +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncTrigger.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.data.cosmos.sync; + +import com.azure.data.cosmos.CosmosClientException; +import com.azure.data.cosmos.CosmosTrigger; +import com.azure.data.cosmos.CosmosTriggerProperties; + +/** + * The type Cosmos sync trigger. + */ +public class CosmosSyncTrigger { + private final String id; + private final CosmosSyncContainer container; + private final CosmosTrigger trigger; + + /** + * Instantiates a new Cosmos sync trigger. + * + * @param id the id + * @param container the container + * @param trigger the trigger + */ + CosmosSyncTrigger(String id, CosmosSyncContainer container, CosmosTrigger trigger) { + this.id = id; + this.container = container; + this.trigger = trigger; + } + + /** + * Gets id. + * + * @return the string + */ + public String id() { + return id; + } + + /** + * Read cosmos trigger. + * + * @return the cosmos sync trigger response + * @throws CosmosClientException the cosmos client exception + */ + public CosmosSyncTriggerResponse read() throws CosmosClientException { + return container.getScripts().mapTriggerResponseAndBlock(trigger.read()); + } + + /** + * Replace cosmos trigger. + * + * @param triggerSettings the trigger settings + * @return the cosmos sync trigger response + * @throws CosmosClientException the cosmos client exception + */ + public CosmosSyncTriggerResponse replace(CosmosTriggerProperties triggerSettings) throws CosmosClientException { + return container.getScripts().mapTriggerResponseAndBlock(trigger.replace(triggerSettings)); + } + + /** + * Delete cosmos trigger. + * + * @return the cosmos sync response + * @throws CosmosClientException the cosmos client exception + */ + public CosmosSyncResponse delete() throws CosmosClientException { + return container.getScripts().mapDeleteResponseAndBlock(trigger.delete()); + } + +} diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncTriggerResponse.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncTriggerResponse.java new file mode 100644 index 000000000000..7b4756a196ab --- /dev/null +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncTriggerResponse.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.data.cosmos.sync; + +import com.azure.data.cosmos.CosmosTriggerProperties; +import com.azure.data.cosmos.CosmosTriggerResponse; + +/** + * The type Cosmos sync trigger response. + */ +public class CosmosSyncTriggerResponse extends CosmosSyncResponse { + + private final CosmosSyncTrigger syncTrigger; + private final CosmosTriggerResponse asyncResponse; + + /** + * Instantiates a new Cosmos sync trigger response. + * + * @param asyncResponse the async response + * @param syncTrigger the sync trigger + */ + CosmosSyncTriggerResponse(CosmosTriggerResponse asyncResponse, + CosmosSyncTrigger syncTrigger) { + super(asyncResponse); + this.asyncResponse = asyncResponse; + this.syncTrigger = syncTrigger; + } + + /** + * Gets cosmos trigger properties. + * + * @return the cosmos trigger properties + */ + public CosmosTriggerProperties properties() { + return asyncResponse.properties(); + } + + /** + * Gets cosmos sync trigger. + * + * @return the cosmos sync trigger + */ + public CosmosSyncTrigger trigger() { + return syncTrigger; + } +} diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncUser.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncUser.java new file mode 100644 index 000000000000..393df1fa6270 --- /dev/null +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncUser.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.data.cosmos.sync; + +import com.azure.data.cosmos.CosmosClientException; +import com.azure.data.cosmos.CosmosUser; +import com.azure.data.cosmos.CosmosUserProperties; + +/** + * The type Cosmos sync user. + */ +public class CosmosSyncUser { + private final CosmosUser asyncUser; + private final CosmosSyncDatabase database; + private final String id; + + /** + * Instantiates a new Cosmos sync user. + * + * @param asyncUser the async user + * @param database the database + * @param id the id + */ + CosmosSyncUser(CosmosUser asyncUser, CosmosSyncDatabase database, String id) { + this.asyncUser = asyncUser; + this.database = database; + this.id = id; + } + + /** + * Id string. + * + * @return the string + */ + public String id() { + return id; + } + + /** + * Read cosmos user + * + * @return the cosmos sync user response + * @throws CosmosClientException the cosmos client exception + */ + public CosmosSyncUserResponse read() throws CosmosClientException { + return database.mapUserResponseAndBlock(asyncUser.read()); + } + + /** + * Replace cosmos user. + * + * @param userProperties the user properties + * @return the cosmos sync user response + * @throws CosmosClientException the cosmos client exception + */ + public CosmosSyncUserResponse replace(CosmosUserProperties userProperties) throws CosmosClientException { + return database.mapUserResponseAndBlock(asyncUser.replace(userProperties)); + } + + /** + * Delete cosmos user. + * + * @return the cosmos sync user response + * @throws CosmosClientException the cosmos client exception + */ + public CosmosSyncUserResponse delete() throws CosmosClientException { + return database.mapUserResponseAndBlock(asyncUser.delete()); + } + + +} diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncUserDefinedFunction.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncUserDefinedFunction.java new file mode 100644 index 000000000000..fbea2b3fcc5f --- /dev/null +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncUserDefinedFunction.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.data.cosmos.sync; + +import com.azure.data.cosmos.CosmosClientException; +import com.azure.data.cosmos.CosmosUserDefinedFunction; +import com.azure.data.cosmos.CosmosUserDefinedFunctionProperties; + +/** + * The type Cosmos sync user defined function. + */ +public class CosmosSyncUserDefinedFunction { + private final String id; + private final CosmosSyncContainer container; + private final CosmosUserDefinedFunction userDefinedFunction; + + /** + * Instantiates a new Cosmos sync user defined function. + * + * @param id the id + * @param container the container + * @param userDefinedFunction the user defined function + */ + CosmosSyncUserDefinedFunction(String id, CosmosSyncContainer container, CosmosUserDefinedFunction userDefinedFunction) { + + this.id = id; + this.container = container; + this.userDefinedFunction = userDefinedFunction; + } + + /** + * Id string. + * + * @return the string + */ + public String id() { + return id; + } + + /** + * Read cosmos user defined function. + * + * @return the cosmos sync user defined function response + * @throws CosmosClientException the cosmos client exception + */ + public CosmosSyncUserDefinedFunctionResponse read() throws CosmosClientException { + return container.getScripts().mapUDFResponseAndBlock(userDefinedFunction.read()); + } + + /** + * Replace cosmos user defined function. + * + * @param udfSettings the udf settings + * @return the cosmos sync user defined function response + * @throws CosmosClientException the cosmos client exception + */ + public CosmosSyncUserDefinedFunctionResponse replace(CosmosUserDefinedFunctionProperties udfSettings) + throws CosmosClientException { + return container.getScripts().mapUDFResponseAndBlock(userDefinedFunction.replace(udfSettings)); + } + + /** + * Delete cosmos user defined function. + * + * @return the cosmos sync response + * @throws CosmosClientException the cosmos client exception + */ + public CosmosSyncResponse delete() throws CosmosClientException { + return container.getScripts().mapDeleteResponseAndBlock(userDefinedFunction.delete()); + } +} diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncUserDefinedFunctionResponse.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncUserDefinedFunctionResponse.java new file mode 100644 index 000000000000..b9c6f728fc8e --- /dev/null +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncUserDefinedFunctionResponse.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.data.cosmos.sync; + +import com.azure.data.cosmos.CosmosUserDefinedFunctionProperties; +import com.azure.data.cosmos.CosmosUserDefinedFunctionResponse; + +/** + * The type Cosmos sync user defined function response. + */ +public class CosmosSyncUserDefinedFunctionResponse extends CosmosSyncResponse { + + private final CosmosSyncUserDefinedFunction userDefinedFunction; + private CosmosUserDefinedFunctionResponse asyncResponse; + + /** + * Instantiates a new Cosmos sync user defined function response. + * + * @param resourceResponse the resource response + * @param userDefinedFunction the user defined function + */ + CosmosSyncUserDefinedFunctionResponse(CosmosUserDefinedFunctionResponse resourceResponse, + CosmosSyncUserDefinedFunction userDefinedFunction) { + super(resourceResponse); + this.asyncResponse = resourceResponse; + this.userDefinedFunction = userDefinedFunction; + } + + /** + * Gets cosmos user defined function properties. + * + * @return the cosmos user defined function properties + */ + public CosmosUserDefinedFunctionProperties properties() { + return asyncResponse.properties(); + } + + /** + * Gets cosmos sync user defined function. + * + * @return the cosmos sync user defined function + */ + public CosmosSyncUserDefinedFunction userDefinedFunction() { + return userDefinedFunction; + } + +} diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncUserResponse.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncUserResponse.java new file mode 100644 index 000000000000..4d9e3c701db5 --- /dev/null +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/sync/CosmosSyncUserResponse.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.data.cosmos.sync; + +import com.azure.data.cosmos.CosmosUserProperties; +import com.azure.data.cosmos.CosmosUserResponse; + +/** + * The type Cosmos sync user response. + */ +public class CosmosSyncUserResponse extends CosmosSyncResponse { + private final CosmosUserResponse asyncResponse; + private final CosmosSyncUser user; + + /** + * Instantiates a new Cosmos sync user response. + * + * @param response the response + * @param database the database + */ + CosmosSyncUserResponse(CosmosUserResponse response, CosmosSyncDatabase database) { + super(response); + this.asyncResponse = response; + if (response.user() != null) { + this.user = new CosmosSyncUser(response.user(), database, response.user().id()); + } else { + // delete has null user client + this.user = null; + } + } + + /** + * Gets cosmos sync user. + * + * @return the cosmos sync user + */ + public CosmosSyncUser user() { + return this.user; + } + + /** + * Gets cosmos user properties. + * + * @return the cosmos user properties + */ + public CosmosUserProperties properties() { + return asyncResponse.properties(); + } +} diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/BridgeUtils.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/BridgeUtils.java index 48d5a8ad26a3..6dde420a393d 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/BridgeUtils.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/BridgeUtils.java @@ -3,9 +3,6 @@ package com.azure.data.cosmos; -import com.azure.data.cosmos.internal.DatabaseAccount; -import com.azure.data.cosmos.internal.DatabaseAccountLocation; - import java.util.List; /** diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ConfigsTests.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ConfigsTests.java index 556c42bb294b..9aa1ecd0db4a 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ConfigsTests.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ConfigsTests.java @@ -25,7 +25,7 @@ public void maxHttpBodyLength() { @Test(groups = { "unit" }) public void getProtocol() { Configs config = new Configs(); - assertThat(config.getProtocol()).isEqualTo(Protocol.valueOf(System.getProperty("cosmos.directModeProtocol", "TCP").toUpperCase())); + assertThat(config.getProtocol()).isEqualTo(Protocol.valueOf(System.getProperty("azure.cosmos.directModeProtocol", "TCP").toUpperCase())); } @Test(groups = { "unit" }) diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/TestSuiteBase.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/TestSuiteBase.java index e85c458048f0..36ee7b343595 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/TestSuiteBase.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/TestSuiteBase.java @@ -433,7 +433,7 @@ public Flux> bulkInsert(AsyncDocumentClient client, } public static ConsistencyLevel getAccountDefaultConsistencyLevel(AsyncDocumentClient client) { - return client.getDatabaseAccount().single().block().getConsistencyPolicy().defaultConsistencyLevel(); + return BridgeInternal.getConsistencyPolicy(client.getDatabaseAccount().single().block()).defaultConsistencyLevel(); } public static User createUser(AsyncDocumentClient client, String databaseId, User user) { @@ -965,4 +965,4 @@ public Object[][] queryMetricsArgProvider() { {false}, }; } -} \ No newline at end of file +} diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfigurationReaderTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfigurationReaderTest.java index 0401d60021aa..b78b9e6cc4c1 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfigurationReaderTest.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfigurationReaderTest.java @@ -8,7 +8,7 @@ import com.azure.data.cosmos.internal.AsyncDocumentClient.Builder; import com.azure.data.cosmos.BridgeInternal; import com.azure.data.cosmos.ConnectionPolicy; -import com.azure.data.cosmos.internal.DatabaseAccount; +import com.azure.data.cosmos.DatabaseAccount; import com.azure.data.cosmos.internal.BaseAuthorizationTokenProvider; import com.azure.data.cosmos.internal.SpyClientUnderTestFactory; import com.azure.data.cosmos.internal.TestSuiteBase; @@ -129,10 +129,10 @@ public static void validateSuccess(Mono observable, DatabaseAcc testSubscriber.assertValueCount(1); DatabaseAccount databaseAccount = testSubscriber.values().get(0); assertThat(databaseAccount.id()).isEqualTo(expectedDatabaseAccount.id()); - assertThat(databaseAccount.getAddressesLink()) - .isEqualTo(expectedDatabaseAccount.getAddressesLink()); - assertThat(databaseAccount.getWritableLocations().iterator().next().getEndpoint()) - .isEqualTo(expectedDatabaseAccount.getWritableLocations().iterator().next().getEndpoint()); + assertThat(BridgeInternal.getAddressesLink(databaseAccount)) + .isEqualTo(BridgeInternal.getAddressesLink(expectedDatabaseAccount)); + assertThat(databaseAccount.writableLocations().iterator().next().endpoint()) + .isEqualTo(expectedDatabaseAccount.writableLocations().iterator().next().endpoint()); assertThat(BridgeInternal.getSystemReplicationPolicy(databaseAccount).getMaxReplicaSetSize()) .isEqualTo(BridgeInternal.getSystemReplicationPolicy(expectedDatabaseAccount).getMaxReplicaSetSize()); assertThat(BridgeInternal.getSystemReplicationPolicy(databaseAccount).getMaxReplicaSetSize()) diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfiguratorReaderMock.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfiguratorReaderMock.java index aadca2e0ce73..ae176b13a990 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfiguratorReaderMock.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfiguratorReaderMock.java @@ -4,7 +4,7 @@ package com.azure.data.cosmos.internal.directconnectivity; import com.azure.data.cosmos.ConsistencyLevel; -import com.azure.data.cosmos.internal.DatabaseAccount; +import com.azure.data.cosmos.DatabaseAccount; import com.azure.data.cosmos.internal.ReplicationPolicy; import org.mockito.Mockito; import reactor.core.publisher.Mono; diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClientTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClientTest.java index 607d78fe57cb..be84e94dfcb0 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClientTest.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClientTest.java @@ -3,14 +3,20 @@ package com.azure.data.cosmos.internal.directconnectivity; +import com.azure.data.cosmos.BadRequestException; import com.azure.data.cosmos.ConflictException; import com.azure.data.cosmos.CosmosClientException; import com.azure.data.cosmos.CosmosKeyCredential; import com.azure.data.cosmos.ForbiddenException; import com.azure.data.cosmos.GoneException; +import com.azure.data.cosmos.InternalServerErrorException; +import com.azure.data.cosmos.InvalidPartitionException; import com.azure.data.cosmos.LockedException; import com.azure.data.cosmos.MethodNotAllowedException; +import com.azure.data.cosmos.NotFoundException; +import com.azure.data.cosmos.PartitionIsMigratingException; import com.azure.data.cosmos.PartitionKeyRangeGoneException; +import com.azure.data.cosmos.PartitionKeyRangeIsSplittingException; import com.azure.data.cosmos.PreconditionFailedException; import com.azure.data.cosmos.RequestEntityTooLargeException; import com.azure.data.cosmos.RequestRateTooLargeException; @@ -18,6 +24,15 @@ import com.azure.data.cosmos.RetryWithException; import com.azure.data.cosmos.ServiceUnavailableException; import com.azure.data.cosmos.UnauthorizedException; +import com.azure.data.cosmos.internal.BaseAuthorizationTokenProvider; +import com.azure.data.cosmos.internal.FailureValidator; +import com.azure.data.cosmos.internal.OperationType; +import com.azure.data.cosmos.internal.Paths; +import com.azure.data.cosmos.internal.ResourceType; +import com.azure.data.cosmos.internal.RxDocumentServiceRequest; +import com.azure.data.cosmos.internal.UserAgentContainer; +import com.azure.data.cosmos.internal.Utils; +import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdClientChannelHealthChecker; import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdContext; import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdContextNegotiator; import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdContextRequest; @@ -31,15 +46,9 @@ import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdResponse; import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdResponseDecoder; import com.azure.data.cosmos.internal.directconnectivity.rntbd.RntbdUUID; -import com.azure.data.cosmos.BadRequestException; -import com.azure.data.cosmos.internal.*; -import com.azure.data.cosmos.InternalServerErrorException; -import com.azure.data.cosmos.InvalidPartitionException; -import com.azure.data.cosmos.NotFoundException; -import com.azure.data.cosmos.PartitionIsMigratingException; -import com.azure.data.cosmos.PartitionKeyRangeIsSplittingException; import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; +import io.micrometer.core.instrument.Tag; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandler; @@ -50,14 +59,12 @@ import io.netty.handler.ssl.SslContextBuilder; import io.reactivex.subscribers.TestSubscriber; import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.testng.annotations.DataProvider; -import org.testng.annotations.Ignore; import org.testng.annotations.Test; import reactor.core.publisher.Mono; import java.net.ConnectException; +import java.net.SocketAddress; import java.net.URI; import java.time.Duration; import java.util.Arrays; @@ -76,7 +83,6 @@ public final class RntbdTransportClientTest { - private static final Logger logger = LoggerFactory.getLogger(RntbdTransportClientTest.class); private static final int lsn = 5; private static final ByteBuf noContent = Unpooled.wrappedBuffer(new byte[0]); private static final String partitionKeyRangeId = "3"; @@ -599,7 +605,7 @@ public Object[][] fromMockedRntbdResponseToExpectedDocumentClientException() { /** * Verifies that a request for a non-existent resource produces a {@link }GoneException} */ - @Test(enabled = false, groups = { "direct" }) + @Test(enabled = false, groups = "direct") public void verifyGoneResponseMapsToGoneException() throws Exception { final RntbdTransportClient.Options options = new RntbdTransportClient.Options.Builder(requestTimeout).build(); @@ -681,9 +687,7 @@ public void verifyNetworkFailure( * @param request An RNTBD request instance * @param response The RNTBD response instance to be returned as a result of the request */ - //FIXME: Test inconsistently flakes with assertion error. - @Ignore - @Test(enabled = true, groups = { "unit" }, dataProvider = "fromMockedRntbdResponseToExpectedDocumentClientException") + @Test(enabled = false, groups = "unit", dataProvider = "fromMockedRntbdResponseToExpectedDocumentClientException") public void verifyRequestFailures( final FailureValidator.Builder builder, final RxDocumentServiceRequest request, @@ -805,6 +809,7 @@ private static final class FakeEndpoint implements RntbdEndpoint { final RntbdRequestTimer requestTimer; final FakeChannel fakeChannel; final URI physicalAddress; + final Tag tag; private FakeEndpoint( final Config config, final RntbdRequestTimer timer, final URI physicalAddress, @@ -815,23 +820,76 @@ private FakeEndpoint( expected.length, true, Arrays.asList(expected) ); - RntbdRequestManager requestManager = new RntbdRequestManager(30); + RntbdRequestManager requestManager = new RntbdRequestManager(new RntbdClientChannelHealthChecker(config), 30); this.physicalAddress = physicalAddress; this.requestTimer = timer; this.fakeChannel = new FakeChannel(responses, - new RntbdContextNegotiator(requestManager, config.getUserAgent()), + new RntbdContextNegotiator(requestManager, config.userAgent()), new RntbdRequestEncoder(), new RntbdResponseDecoder(), requestManager ); + + this.tag = Tag.of(FakeEndpoint.class.getSimpleName(), this.fakeChannel.remoteAddress().toString()); + } + + // region Accessors + + @Override + public int channelsAcquired() { + return 0; + } + + @Override + public int channelsAvailable() { + return 0; + } + + @Override + public int concurrentRequests() { + return 0; } @Override - public String getName() { - return "FakeEndpoint"; + public long id() { + return 0L; } + @Override + public boolean isClosed() { + return !this.fakeChannel.isOpen(); + } + + @Override + public SocketAddress remoteAddress() { + return this.fakeChannel.remoteAddress(); + } + + @Override + public int requestQueueLength() { + return 0; + } + + @Override + public Tag tag() { + return this.tag; + } + + @Override + public long usedDirectMemory() { + return 0; + } + + @Override + public long usedHeapMemory() { + return 0; + } + + // endregion + + // region Methods + @Override public void close() { this.fakeChannel.close().syncUninterruptibly(); @@ -844,6 +902,10 @@ public RntbdRequestRecord request(final RntbdRequestArgs requestArgs) { return requestRecord; } + // endregion + + // region Types + static class Provider implements RntbdEndpoint.Provider { final Config config; @@ -852,7 +914,7 @@ static class Provider implements RntbdEndpoint.Provider { Provider(RntbdTransportClient.Options options, SslContext sslContext, RntbdResponse expected) { this.config = new Config(options, sslContext, LogLevel.WARN); - this.timer = new RntbdRequestTimer(config.getRequestTimeout()); + this.timer = new RntbdRequestTimer(config.requestTimeout()); this.expected = expected; } @@ -871,6 +933,11 @@ public int count() { return 1; } + @Override + public int evictions() { + return 0; + } + @Override public RntbdEndpoint get(URI physicalAddress) { return new FakeEndpoint(config, timer, physicalAddress, expected); @@ -881,6 +948,8 @@ public Stream list() { return Stream.empty(); } } + + // endregion } private static final class RntbdTestConfiguration { diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/routing/LocationCacheTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/routing/LocationCacheTest.java index 65604cbc2d88..a6f2d7953f4d 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/routing/LocationCacheTest.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/routing/LocationCacheTest.java @@ -6,8 +6,8 @@ import com.azure.data.cosmos.BridgeInternal; import com.azure.data.cosmos.BridgeUtils; import com.azure.data.cosmos.ConnectionPolicy; -import com.azure.data.cosmos.internal.DatabaseAccount; -import com.azure.data.cosmos.internal.DatabaseAccountLocation; +import com.azure.data.cosmos.DatabaseAccount; +import com.azure.data.cosmos.DatabaseAccountLocation; import com.azure.data.cosmos.internal.DatabaseAccountManagerInternal; import com.azure.data.cosmos.internal.*; import com.google.common.collect.ImmutableList; @@ -198,19 +198,19 @@ private void validateLocationCacheAsync( UnmodifiableList currentWriteEndpoints = this.cache.getWriteEndpoints(); UnmodifiableList currentReadEndpoints = this.cache.getReadEndpoints(); for (int i = 0; i < readLocationIndex; i++) { - this.cache.markEndpointUnavailableForRead(createUrl(Iterables.get(this.databaseAccount.getReadableLocations(), i).getEndpoint())); - this.endpointManager.markEndpointUnavailableForRead(createUrl(Iterables.get(this.databaseAccount.getReadableLocations(), i).getEndpoint()));; + this.cache.markEndpointUnavailableForRead(createUrl(Iterables.get(this.databaseAccount.readableLocations(), i).endpoint())); + this.endpointManager.markEndpointUnavailableForRead(createUrl(Iterables.get(this.databaseAccount.readableLocations(), i).endpoint()));; } for (int i = 0; i < writeLocationIndex; i++) { - this.cache.markEndpointUnavailableForWrite(createUrl(Iterables.get(this.databaseAccount.getWritableLocations(), i).getEndpoint())); - this.endpointManager.markEndpointUnavailableForWrite(createUrl(Iterables.get(this.databaseAccount.getWritableLocations(), i).getEndpoint())); + this.cache.markEndpointUnavailableForWrite(createUrl(Iterables.get(this.databaseAccount.writableLocations(), i).endpoint())); + this.endpointManager.markEndpointUnavailableForWrite(createUrl(Iterables.get(this.databaseAccount.writableLocations(), i).endpoint())); } - Map writeEndpointByLocation = toStream(this.databaseAccount.getWritableLocations()) - .collect(Collectors.toMap(i -> i.getName(), i -> createUrl(i.getEndpoint()))); + Map writeEndpointByLocation = toStream(this.databaseAccount.writableLocations()) + .collect(Collectors.toMap(i -> i.name(), i -> createUrl(i.endpoint()))); - Map readEndpointByLocation = toStream(this.databaseAccount.getReadableLocations()) - .collect(Collectors.toMap(i -> i.getName(), i -> createUrl(i.getEndpoint()))); + Map readEndpointByLocation = toStream(this.databaseAccount.readableLocations()) + .collect(Collectors.toMap(i -> i.name(), i -> createUrl(i.endpoint()))); URL[] preferredAvailableWriteEndpoints = toStream(this.preferredLocations).skip(writeLocationIndex) .filter(location -> writeEndpointByLocation.containsKey(location)) @@ -264,8 +264,8 @@ private void validateEndpointRefresh( false : isFirstWriteEndpointUnavailable; if (this.preferredLocations.size() > 0) { String mostPreferredReadLocationName = this.preferredLocations.stream() - .filter(location -> toStream(databaseAccount.getReadableLocations()) - .anyMatch(readLocation -> readLocation.getName().equals(location))) + .filter(location -> toStream(databaseAccount.readableLocations()) + .anyMatch(readLocation -> readLocation.name().equals(location))) .findFirst().orElse(null); URL mostPreferredReadEndpoint = LocationCacheTest.EndpointByLocation.get(mostPreferredReadLocationName); @@ -273,8 +273,8 @@ private void validateEndpointRefresh( true : (!areEqual(preferredAvailableReadEndpoints[0], mostPreferredReadEndpoint)); String mostPreferredWriteLocationName = this.preferredLocations.stream() - .filter(location -> toStream(databaseAccount.getWritableLocations()) - .anyMatch(writeLocation -> writeLocation.getName().equals(location))) + .filter(location -> toStream(databaseAccount.writableLocations()) + .anyMatch(writeLocation -> writeLocation.name().equals(location))) .findFirst().orElse(null); URL mostPreferredWriteEndpoint = LocationCacheTest.EndpointByLocation.get(mostPreferredWriteLocationName); @@ -335,18 +335,18 @@ private void validateRequestEndpointResolution( firstAvailableWriteEndpoint = LocationCacheTest.DefaultEndpoint; secondAvailableWriteEndpoint = LocationCacheTest.DefaultEndpoint; } else if (!useMultipleWriteLocations) { - firstAvailableWriteEndpoint = createUrl(Iterables.get(this.databaseAccount.getWritableLocations(), 0).getEndpoint()); - secondAvailableWriteEndpoint = createUrl(Iterables.get(this.databaseAccount.getWritableLocations(), 1).getEndpoint()); + firstAvailableWriteEndpoint = createUrl(Iterables.get(this.databaseAccount.writableLocations(), 0).endpoint()); + secondAvailableWriteEndpoint = createUrl(Iterables.get(this.databaseAccount.writableLocations(), 1).endpoint()); } else if (availableWriteEndpoints.length > 1) { firstAvailableWriteEndpoint = availableWriteEndpoints[0]; secondAvailableWriteEndpoint = availableWriteEndpoints[1]; } else if (availableWriteEndpoints.length > 0) { firstAvailableWriteEndpoint = availableWriteEndpoints[0]; - Iterator writeLocationsIterator = databaseAccount.getWritableLocations().iterator(); - String writeEndpoint = writeLocationsIterator.next().getEndpoint(); + Iterator writeLocationsIterator = databaseAccount.writableLocations().iterator(); + String writeEndpoint = writeLocationsIterator.next().endpoint(); secondAvailableWriteEndpoint = writeEndpoint != firstAvailableWriteEndpoint.toString() ? new URL(writeEndpoint) - : new URL(writeLocationsIterator.next().getEndpoint()); + : new URL(writeLocationsIterator.next().endpoint()); } else { firstAvailableWriteEndpoint = LocationCacheTest.DefaultEndpoint; secondAvailableWriteEndpoint = LocationCacheTest.DefaultEndpoint; @@ -366,11 +366,11 @@ private void validateRequestEndpointResolution( URL firstWriteEnpoint = !endpointDiscoveryEnabled ? LocationCacheTest.DefaultEndpoint : - createUrl(Iterables.get(this.databaseAccount.getWritableLocations(), 0).getEndpoint()); + createUrl(Iterables.get(this.databaseAccount.writableLocations(), 0).endpoint()); URL secondWriteEnpoint = !endpointDiscoveryEnabled ? LocationCacheTest.DefaultEndpoint : - createUrl(Iterables.get(this.databaseAccount.getWritableLocations(), 1).getEndpoint()); + createUrl(Iterables.get(this.databaseAccount.writableLocations(), 1).endpoint()); // If current write endpoint is unavailable, write endpoints order doesn't change // ALL write requests flip-flop between current write and alternate write endpoint diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ChangeFeedProcessorTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ChangeFeedProcessorTest.java index 021b3a813aac..18c700950de9 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ChangeFeedProcessorTest.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ChangeFeedProcessorTest.java @@ -2,6 +2,7 @@ // Licensed under the MIT License. package com.azure.data.cosmos.rx; +import com.azure.data.cosmos.BridgeInternal; import com.azure.data.cosmos.ChangeFeedProcessor; import com.azure.data.cosmos.ChangeFeedProcessorOptions; import com.azure.data.cosmos.CosmosClient; @@ -11,7 +12,15 @@ import com.azure.data.cosmos.CosmosContainerRequestOptions; import com.azure.data.cosmos.CosmosDatabase; import com.azure.data.cosmos.CosmosItemProperties; +import com.azure.data.cosmos.CosmosItemRequestOptions; +import com.azure.data.cosmos.CosmosItemResponse; +import com.azure.data.cosmos.FeedOptions; +import com.azure.data.cosmos.PartitionKey; import com.azure.data.cosmos.SerializationFormattingPolicy; +import com.azure.data.cosmos.SqlParameter; +import com.azure.data.cosmos.SqlParameterList; +import com.azure.data.cosmos.SqlQuerySpec; +import com.azure.data.cosmos.internal.changefeed.ServiceItemLease; import org.apache.commons.lang3.RandomStringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,6 +30,7 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.Factory; import org.testng.annotations.Test; +import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; import java.time.Duration; @@ -96,7 +106,7 @@ public void readFeedDocumentsStartFromBeginning() { try { Thread.sleep(2 * CHANGE_FEED_PROCESSOR_TIMEOUT); } catch (InterruptedException e) { - e.printStackTrace(); + log.error(e.getMessage()); } changeFeedProcessor.stop().subscribeOn(Schedulers.elastic()).timeout(Duration.ofMillis(CHANGE_FEED_PROCESSOR_TIMEOUT)).subscribe(); @@ -109,7 +119,7 @@ public void readFeedDocumentsStartFromBeginning() { try { Thread.sleep(CHANGE_FEED_PROCESSOR_TIMEOUT); } catch (InterruptedException e) { - e.printStackTrace(); + log.error(e.getMessage()); } receivedDocuments.clear(); } @@ -154,11 +164,11 @@ public void readFeedDocumentsStartFromCustomDate() { // Wait for the feed processor to receive and process the documents. long remainingWork = FEED_TIMEOUT; while (remainingWork > 0 && receivedDocuments.size() < FEED_COUNT) { - remainingWork -= CHANGE_FEED_PROCESSOR_TIMEOUT; + remainingWork -= 100; try { - Thread.sleep(CHANGE_FEED_PROCESSOR_TIMEOUT); + Thread.sleep(100); } catch (InterruptedException e) { - e.printStackTrace(); + log.error(e.getMessage()); } } @@ -174,12 +184,152 @@ public void readFeedDocumentsStartFromCustomDate() { try { Thread.sleep(CHANGE_FEED_PROCESSOR_TIMEOUT); } catch (InterruptedException e) { - e.printStackTrace(); + log.error(e.getMessage()); } receivedDocuments.clear(); } - @BeforeMethod(groups = { "emulator" }, timeOut = 2 * SETUP_TIMEOUT, alwaysRun = true) + @Test(groups = { "emulator" }, timeOut = 40 * CHANGE_FEED_PROCESSOR_TIMEOUT) + public void staledLeaseAcquiring() { + final String ownerFirst = "Owner_First"; + final String ownerSecond = "Owner_Second"; + final String leasePrefix = "TEST"; + + ChangeFeedProcessor changeFeedProcessorFirst = ChangeFeedProcessor.Builder() + .hostName(ownerFirst) + .handleChanges(docs -> { + ChangeFeedProcessorTest.log.info("START processing from thread {} using host {}", Thread.currentThread().getId(), ownerFirst); + ChangeFeedProcessorTest.log.info("END processing from thread {} using host {}", Thread.currentThread().getId(), ownerFirst); + }) + .feedContainer(createdFeedCollection) + .leaseContainer(createdLeaseCollection) + .options(new ChangeFeedProcessorOptions() + .leasePrefix(leasePrefix) + ) + .build(); + + ChangeFeedProcessor changeFeedProcessorSecond = ChangeFeedProcessor.Builder() + .hostName(ownerSecond) + .handleChanges(docs -> { + ChangeFeedProcessorTest.log.info("START processing from thread {} using host {}", Thread.currentThread().getId(), ownerSecond); + for (CosmosItemProperties item : docs) { + processItem(item); + } + ChangeFeedProcessorTest.log.info("END processing from thread {} using host {}", Thread.currentThread().getId(), ownerSecond); + }) + .feedContainer(createdFeedCollection) + .leaseContainer(createdLeaseCollection) + .options(new ChangeFeedProcessorOptions() + .leaseRenewInterval(Duration.ofSeconds(10)) + .leaseAcquireInterval(Duration.ofSeconds(5)) + .leaseExpirationInterval(Duration.ofSeconds(20)) + .feedPollDelay(Duration.ofSeconds(2)) + .leasePrefix(leasePrefix) + .maxItemCount(10) + .startFromBeginning(true) + .maxScaleCount(0) // unlimited + ) + .build(); + + receivedDocuments = new ConcurrentHashMap<>(); + + try { + changeFeedProcessorFirst.start().subscribeOn(Schedulers.elastic()) + .timeout(Duration.ofMillis(2 * CHANGE_FEED_PROCESSOR_TIMEOUT)) + .then(Mono.just(changeFeedProcessorFirst) + .delayElement(Duration.ofMillis(2 * CHANGE_FEED_PROCESSOR_TIMEOUT)) + .flatMap( value -> changeFeedProcessorFirst.stop() + .subscribeOn(Schedulers.elastic()) + .timeout(Duration.ofMillis(2 * CHANGE_FEED_PROCESSOR_TIMEOUT)) + )) + .then(Mono.just(changeFeedProcessorFirst) + .delayElement(Duration.ofMillis(CHANGE_FEED_PROCESSOR_TIMEOUT)) + ) + .doOnSuccess(aVoid -> { + try { + Thread.sleep(CHANGE_FEED_PROCESSOR_TIMEOUT / 2); + } catch (InterruptedException e) { + log.error(e.getMessage()); + } + ChangeFeedProcessorTest.log.info("Update leases for Change feed processor in thread {} using host {}", Thread.currentThread().getId(), "Owner_first"); + + SqlParameter param = new SqlParameter(); + param.name("@PartitionLeasePrefix"); + param.value(leasePrefix); + SqlQuerySpec querySpec = new SqlQuerySpec( + "SELECT * FROM c WHERE STARTSWITH(c.id, @PartitionLeasePrefix)", + new SqlParameterList(param)); + + FeedOptions feedOptions = new FeedOptions(); + feedOptions.enableCrossPartitionQuery(true); + + createdLeaseCollection.queryItems(querySpec, feedOptions) + .delayElements(Duration.ofMillis(CHANGE_FEED_PROCESSOR_TIMEOUT / 2)) + .flatMap(documentFeedResponse -> reactor.core.publisher.Flux.fromIterable(documentFeedResponse.results())) + .flatMap(doc -> { + BridgeInternal.setProperty(doc, "Owner", "TEMP_OWNER"); + CosmosItemRequestOptions options = new CosmosItemRequestOptions(); + options.partitionKey(new PartitionKey(doc.id())); + return createdLeaseCollection.getItem(doc.id(), "/id") + .replace(doc, options) + .map(CosmosItemResponse::properties); + }) + .map(ServiceItemLease::fromDocument) + .map(leaseDocument -> { + ChangeFeedProcessorTest.log.info("QueryItems after Change feed processor processing; found host {}", leaseDocument.getOwner()); + return leaseDocument; + }) + .last() + .delayElement(Duration.ofMillis(CHANGE_FEED_PROCESSOR_TIMEOUT / 2)) + .flatMap(leaseDocument -> { + ChangeFeedProcessorTest.log.info("Start creating documents"); + List docDefList = new ArrayList<>(); + + for(int i = 0; i < FEED_COUNT; i++) { + docDefList.add(getDocumentDefinition()); + } + + return bulkInsert(createdFeedCollection, docDefList, FEED_COUNT) + .last() + .delayElement(Duration.ofMillis(1000)) + .flatMap(cosmosItemResponse -> { + ChangeFeedProcessorTest.log.info("Start second Change feed processor"); + return changeFeedProcessorSecond.start().subscribeOn(Schedulers.elastic()) + .timeout(Duration.ofMillis(2 * CHANGE_FEED_PROCESSOR_TIMEOUT)); + }); + }) + .subscribe(); + }) + .subscribe(); + } catch (Exception ex) { + log.error("First change feed processor did not start in the expected time", ex); + } + + // Wait for the feed processor to receive and process the documents. + long remainingWork = 40 * CHANGE_FEED_PROCESSOR_TIMEOUT; + while (remainingWork > 0 && receivedDocuments.size() < FEED_COUNT) { + remainingWork -= 100; + try { + Thread.sleep(100); + } catch (InterruptedException e) { + log.error(e.getMessage()); + } + } + + assertThat(remainingWork >= 0).as("Failed to receive all the feed documents").isTrue(); + + changeFeedProcessorSecond.stop().subscribeOn(Schedulers.elastic()).timeout(Duration.ofMillis(2 * CHANGE_FEED_PROCESSOR_TIMEOUT)).subscribe(); + + // Wait for the feed processor to shutdown. + try { + Thread.sleep(2 * CHANGE_FEED_PROCESSOR_TIMEOUT); + } catch (InterruptedException e) { + log.error(e.getMessage()); + } + receivedDocuments.clear(); + } + + @BeforeMethod(groups = { "emulator" }, timeOut = 2 * SETUP_TIMEOUT, alwaysRun = true) public void beforeMethod() { createdFeedCollection = createFeedCollection(); createdLeaseCollection = createLeaseCollection(); diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/TestSuiteBase.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/TestSuiteBase.java index c92ca920a9d8..9a6387ae9e7e 100644 --- a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/TestSuiteBase.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/TestSuiteBase.java @@ -90,7 +90,7 @@ public class TestSuiteBase extends CosmosClientTest { protected static final int TIMEOUT = 40000; protected static final int FEED_TIMEOUT = 40000; protected static final int SETUP_TIMEOUT = 60000; - protected static final int SHUTDOWN_TIMEOUT = 12000; + protected static final int SHUTDOWN_TIMEOUT = 24000; protected static final int SUITE_SETUP_TIMEOUT = 120000; protected static final int SUITE_SHUTDOWN_TIMEOUT = 60000; @@ -440,7 +440,7 @@ public static CosmosItem createDocument(CosmosContainer cosmosContainer, CosmosI return cosmosContainer.createItem(item).block().item(); } - private Flux bulkInsert(CosmosContainer cosmosContainer, + public Flux bulkInsert(CosmosContainer cosmosContainer, List documentDefinitionList, int concurrencyLevel) { List> result = new ArrayList<>(documentDefinitionList.size()); diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/sync/CosmosSyncStoredProcTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/sync/CosmosSyncStoredProcTest.java new file mode 100644 index 000000000000..7836f9ba17f3 --- /dev/null +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/sync/CosmosSyncStoredProcTest.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.data.cosmos.sync; + +import com.azure.data.cosmos.CosmosClientBuilder; +import com.azure.data.cosmos.CosmosClientException; +import com.azure.data.cosmos.CosmosContainer; +import com.azure.data.cosmos.CosmosDatabaseForTest; +import com.azure.data.cosmos.CosmosStoredProcedureProperties; +import com.azure.data.cosmos.CosmosStoredProcedureRequestOptions; +import com.azure.data.cosmos.FeedOptions; +import com.azure.data.cosmos.FeedResponse; +import com.azure.data.cosmos.SqlQuerySpec; +import com.azure.data.cosmos.internal.HttpConstants; +import com.azure.data.cosmos.rx.TestSuiteBase; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Factory; +import org.testng.annotations.Test; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.UUID; + +import static org.assertj.core.api.Assertions.assertThat; + +public class CosmosSyncStoredProcTest extends TestSuiteBase { + private String preExistingDatabaseId = CosmosDatabaseForTest.generateId(); + private List databases = new ArrayList<>(); + private CosmosSyncClient client; + private CosmosSyncContainer container; + + @Factory(dataProvider = "clientBuilders") + public CosmosSyncStoredProcTest(CosmosClientBuilder clientBuilder) { + super(clientBuilder); + } + + + @BeforeClass(groups = {"simple"}, timeOut = SETUP_TIMEOUT) + public void beforeClass() { + assertThat(this.client).isNull(); + this.client = clientBuilder().buildSyncClient(); + CosmosContainer asyncContainer = getSharedMultiPartitionCosmosContainer(this.client.asyncClient()); + container = client.getDatabase(asyncContainer.getDatabase().id()).getContainer(asyncContainer.id()); + } + + @AfterClass(groups = {"simple"}, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) + public void afterClass() { + assertThat(this.client).isNotNull(); + this.client.close(); + } + + @Test(groups = {"simple"}, timeOut = TIMEOUT) + public void createStoredProcedure() throws Exception { + + CosmosStoredProcedureProperties storedProcedureDef = getCosmosStoredProcedureProperties(); + + CosmosSyncStoredProcedureResponse response = container.getScripts().createStoredProcedure(storedProcedureDef); + validateResponse(storedProcedureDef, response); + + storedProcedureDef.id(UUID.randomUUID().toString()); + storedProcedureDef.body("function() {var x = 11;}"); + CosmosSyncStoredProcedureResponse response1 = container.getScripts() + .createStoredProcedure(storedProcedureDef, + new CosmosStoredProcedureRequestOptions()); + validateResponse(storedProcedureDef, response1); + + } + + @Test(groups = {"simple"}, timeOut = TIMEOUT) + public void createSproc_alreadyExists() throws Exception { + CosmosStoredProcedureProperties storedProcedureDef = getCosmosStoredProcedureProperties(); + + CosmosSyncStoredProcedureResponse response = container.getScripts().createStoredProcedure(storedProcedureDef); + validateResponse(storedProcedureDef, response); + + // Test for conflict + try { + container.getScripts().createStoredProcedure(storedProcedureDef); + } catch (Exception e) { + assertThat(e).isInstanceOf(CosmosClientException.class); + assertThat(((CosmosClientException) e).statusCode()).isEqualTo(HttpConstants.StatusCodes.CONFLICT); + } + } + + @Test(groups = {"simple"}, timeOut = TIMEOUT) + public void readStoredProcedure() throws Exception { + CosmosStoredProcedureProperties storedProcedureDef = getCosmosStoredProcedureProperties(); + + CosmosSyncStoredProcedureResponse response = container.getScripts().createStoredProcedure(storedProcedureDef); + validateResponse(storedProcedureDef, response); + + CosmosSyncStoredProcedure storedProcedure = container.getScripts().getStoredProcedure(storedProcedureDef.id()); + CosmosSyncStoredProcedureResponse readResponse = storedProcedure.read(); + validateResponse(storedProcedureDef, readResponse); + + CosmosSyncStoredProcedureResponse readResponse2 = + storedProcedure.read(new CosmosStoredProcedureRequestOptions()); + validateResponse(storedProcedureDef, readResponse2); + } + + @Test(groups = {"simple"}, timeOut = TIMEOUT) + public void replaceStoredProcedure() throws Exception { + CosmosStoredProcedureProperties storedProcedureDef = getCosmosStoredProcedureProperties(); + + CosmosSyncStoredProcedureResponse response = container.getScripts().createStoredProcedure(storedProcedureDef); + validateResponse(storedProcedureDef, response); + + CosmosSyncStoredProcedureResponse readResponse = container.getScripts() + .getStoredProcedure(storedProcedureDef.id()) + .read(); + validateResponse(storedProcedureDef, readResponse); + //replace + storedProcedureDef = readResponse.properties(); + storedProcedureDef.body("function(){ var y = 20;}"); + CosmosSyncStoredProcedureResponse replaceResponse = container.getScripts() + .getStoredProcedure(storedProcedureDef.id()) + .replace(storedProcedureDef); + validateResponse(storedProcedureDef, replaceResponse); + + storedProcedureDef.body("function(){ var z = 2;}"); + CosmosSyncStoredProcedureResponse replaceResponse2 = container.getScripts() + .getStoredProcedure(storedProcedureDef.id()) + .replace(storedProcedureDef, + new CosmosStoredProcedureRequestOptions()); + validateResponse(storedProcedureDef, replaceResponse2); + + } + + private CosmosStoredProcedureProperties getCosmosStoredProcedureProperties() { + CosmosStoredProcedureProperties storedProcedureDef = new CosmosStoredProcedureProperties(); + storedProcedureDef.id(UUID.randomUUID().toString()); + storedProcedureDef.body("function() {var x = 10;}"); + return storedProcedureDef; + } + + @Test(groups = {"simple"}, timeOut = TIMEOUT) + public void deleteStoredProcedure() throws Exception { + CosmosStoredProcedureProperties storedProcedureDef = getCosmosStoredProcedureProperties(); + + CosmosSyncStoredProcedureResponse response = container.getScripts().createStoredProcedure(storedProcedureDef); + validateResponse(storedProcedureDef, response); + CosmosSyncResponse deleteResponse = container.getScripts() + .getStoredProcedure(storedProcedureDef.id()) + .delete(); + + } + + // TODO: Fix underlying async execute response issue before enabling this test +/* + @Test(groups = {"simple"}, timeOut = TIMEOUT) + public void executeStoredProcedure() throws Exception { + CosmosStoredProcedureProperties sproc = new CosmosStoredProcedureProperties() + .id(UUID.randomUUID().toString()); + sproc.body("function() {var x = 10;}"); + + CosmosSyncStoredProcedureResponse response = container.getScripts().createStoredProcedure(sproc); + CosmosStoredProcedureRequestOptions options = new CosmosStoredProcedureRequestOptions(); + options.partitionKey(PartitionKey.None); + container.getScripts() + .getStoredProcedure(sproc.id()) + .execute(null, options); + } +*/ + + @Test(groups = {"simple"}, timeOut = TIMEOUT) + private void readAllSprocs() throws Exception { + CosmosStoredProcedureProperties storedProcedureDef = getCosmosStoredProcedureProperties(); + container.getScripts().createStoredProcedure(storedProcedureDef); + + FeedOptions feedOptions = new FeedOptions(); + feedOptions.enableCrossPartitionQuery(true); + Iterator> feedResponseIterator3 = + container.getScripts().readAllStoredProcedures(feedOptions); + assertThat(feedResponseIterator3.hasNext()).isTrue(); + + } + + @Test(groups = {"simple"}, timeOut = TIMEOUT) + private void querySprocs() throws Exception { + CosmosStoredProcedureProperties properties = getCosmosStoredProcedureProperties(); + container.getScripts().createStoredProcedure(properties); + + String query = String.format("SELECT * from c where c.id = '%s'", properties.id()); + FeedOptions feedOptions = new FeedOptions().enableCrossPartitionQuery(true); + + Iterator> feedResponseIterator1 = + container.getScripts().queryStoredProcedures(query, feedOptions); + assertThat(feedResponseIterator1.hasNext()).isTrue(); + + SqlQuerySpec querySpec = new SqlQuerySpec(query); + Iterator> feedResponseIterator2 = + container.getScripts().queryStoredProcedures(query, feedOptions); + assertThat(feedResponseIterator2.hasNext()).isTrue(); + } + + private void validateResponse(CosmosStoredProcedureProperties properties, + CosmosSyncStoredProcedureResponse createResponse) { + // Basic validation + assertThat(createResponse.properties().id()).isNotNull(); + assertThat(createResponse.properties().id()) + .as("check Resource Id") + .isEqualTo(properties.id()); + + } +} diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/sync/CosmosSyncTriggerTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/sync/CosmosSyncTriggerTest.java new file mode 100644 index 000000000000..5f505d99b272 --- /dev/null +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/sync/CosmosSyncTriggerTest.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.data.cosmos.sync; + +import com.azure.data.cosmos.CosmosClientBuilder; +import com.azure.data.cosmos.CosmosContainer; +import com.azure.data.cosmos.CosmosTriggerProperties; +import com.azure.data.cosmos.FeedOptions; +import com.azure.data.cosmos.FeedResponse; +import com.azure.data.cosmos.SqlQuerySpec; +import com.azure.data.cosmos.TriggerOperation; +import com.azure.data.cosmos.TriggerType; +import com.azure.data.cosmos.rx.TestSuiteBase; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Factory; +import org.testng.annotations.Test; + +import java.util.Iterator; +import java.util.UUID; + +import static org.assertj.core.api.Assertions.assertThat; + +public class CosmosSyncTriggerTest extends TestSuiteBase { + private CosmosSyncClient client; + private CosmosSyncContainer container; + + @Factory(dataProvider = "clientBuilders") + public CosmosSyncTriggerTest(CosmosClientBuilder clientBuilder) { + super(clientBuilder); + } + + @BeforeClass(groups = {"simple"}, timeOut = SETUP_TIMEOUT) + public void beforeClass() { + assertThat(this.client).isNull(); + this.client = clientBuilder().buildSyncClient(); + CosmosContainer asyncContainer = getSharedMultiPartitionCosmosContainer(this.client.asyncClient()); + container = client.getDatabase(asyncContainer.getDatabase().id()).getContainer(asyncContainer.id()); + } + + @AfterClass(groups = {"simple"}, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) + public void afterClass() { + assertThat(this.client).isNotNull(); + this.client.close(); + } + + @Test(groups = {"simple"}, timeOut = TIMEOUT) + public void createTrigger() throws Exception { + CosmosTriggerProperties trigger = getCosmosTriggerProperties(); + + CosmosSyncTriggerResponse triggerResponse = container.getScripts().createTrigger(trigger); + validateResponse(trigger, triggerResponse); + + } + + @Test(groups = {"simple"}, timeOut = TIMEOUT) + public void readTrigger() throws Exception { + CosmosTriggerProperties trigger = getCosmosTriggerProperties(); + + container.getScripts().createTrigger(trigger); + + CosmosSyncTriggerResponse readResponse = container.getScripts().getTrigger(trigger.id()).read(); + validateResponse(trigger, readResponse); + + } + + @Test(groups = {"simple"}, timeOut = TIMEOUT) + public void replaceTrigger() throws Exception { + CosmosTriggerProperties trigger = getCosmosTriggerProperties(); + + container.getScripts().createTrigger(trigger); + + CosmosTriggerProperties readTrigger = container.getScripts().getTrigger(trigger.id()).read().properties(); + readTrigger.body("function() {var x = 11;}"); + + CosmosSyncTriggerResponse replace = container.getScripts().getTrigger(trigger.id()).replace(readTrigger); + validateResponse(trigger, replace); + } + + @Test(groups = {"simple"}, timeOut = TIMEOUT) + public void deleteTrigger() throws Exception { + CosmosTriggerProperties trigger = getCosmosTriggerProperties(); + + container.getScripts().createTrigger(trigger); + + CosmosSyncResponse delete = container.getScripts().getTrigger(trigger.id()).delete(); + } + + + @Test(groups = {"simple"}, timeOut = TIMEOUT) + public void readAllTriggers() throws Exception { + CosmosTriggerProperties trigger = getCosmosTriggerProperties(); + + container.getScripts().createTrigger(trigger); + + FeedOptions feedOptions = new FeedOptions(); + feedOptions.enableCrossPartitionQuery(true); + Iterator> feedResponseIterator3 = + container.getScripts().readAllTriggers(feedOptions); + assertThat(feedResponseIterator3.hasNext()).isTrue(); + } + + private CosmosTriggerProperties getCosmosTriggerProperties() { + CosmosTriggerProperties trigger = new CosmosTriggerProperties(); + trigger.id(UUID.randomUUID().toString()); + trigger.body("function() {var x = 10;}"); + trigger.triggerOperation(TriggerOperation.CREATE); + trigger.triggerType(TriggerType.PRE); + return trigger; + } + + @Test(groups = {"simple"}, timeOut = TIMEOUT) + public void queryTriggers() throws Exception { + CosmosTriggerProperties properties = getCosmosTriggerProperties(); + container.getScripts().createTrigger(properties); + String query = String.format("SELECT * from c where c.id = '%s'", properties.id()); + FeedOptions feedOptions = new FeedOptions().enableCrossPartitionQuery(true); + + Iterator> feedResponseIterator1 = + container.getScripts().queryTriggers(query, feedOptions); + assertThat(feedResponseIterator1.hasNext()).isTrue(); + + SqlQuerySpec querySpec = new SqlQuerySpec(query); + Iterator> feedResponseIterator2 = + container.getScripts().queryTriggers(query, feedOptions); + assertThat(feedResponseIterator2.hasNext()).isTrue(); + } + + private void validateResponse(CosmosTriggerProperties properties, + CosmosSyncTriggerResponse createResponse) { + // Basic validation + assertThat(createResponse.properties().id()).isNotNull(); + assertThat(createResponse.properties().id()) + .as("check Resource Id") + .isEqualTo(properties.id()); + + } + +} diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/sync/CosmosSyncUDFTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/sync/CosmosSyncUDFTest.java new file mode 100644 index 000000000000..9593f0f46793 --- /dev/null +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/sync/CosmosSyncUDFTest.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.data.cosmos.sync; + +import com.azure.data.cosmos.CosmosClientBuilder; +import com.azure.data.cosmos.CosmosContainer; +import com.azure.data.cosmos.CosmosUserDefinedFunctionProperties; +import com.azure.data.cosmos.FeedOptions; +import com.azure.data.cosmos.FeedResponse; +import com.azure.data.cosmos.SqlQuerySpec; +import com.azure.data.cosmos.rx.TestSuiteBase; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Factory; +import org.testng.annotations.Test; + +import java.util.Iterator; +import java.util.UUID; + +import static org.assertj.core.api.Assertions.assertThat; + +public class CosmosSyncUDFTest extends TestSuiteBase { + + private CosmosSyncClient client; + private CosmosSyncContainer container; + + @Factory(dataProvider = "clientBuilders") + public CosmosSyncUDFTest(CosmosClientBuilder clientBuilder) { + super(clientBuilder); + } + + @BeforeClass(groups = {"simple"}, timeOut = SETUP_TIMEOUT) + public void beforeClass() { + assertThat(this.client).isNull(); + this.client = clientBuilder().buildSyncClient(); + CosmosContainer asyncContainer = getSharedMultiPartitionCosmosContainer(this.client.asyncClient()); + container = client.getDatabase(asyncContainer.getDatabase().id()).getContainer(asyncContainer.id()); + } + + @AfterClass(groups = {"simple"}, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) + public void afterClass() { + assertThat(this.client).isNotNull(); + this.client.close(); + } + + @Test(groups = {"simple"}, timeOut = TIMEOUT) + public void createUDF() throws Exception { + CosmosUserDefinedFunctionProperties udf = getCosmosUserDefinedFunctionProperties(); + + CosmosSyncUserDefinedFunctionResponse createResponse = container.getScripts().createUserDefinedFunction(udf); + validateResponse(udf, createResponse); + + } + + @Test(groups = {"simple"}, timeOut = TIMEOUT) + public void readUDF() throws Exception { + CosmosUserDefinedFunctionProperties udf = getCosmosUserDefinedFunctionProperties(); + + CosmosSyncUserDefinedFunctionResponse createResponse = container.getScripts().createUserDefinedFunction(udf); + + CosmosSyncUserDefinedFunctionResponse read = container.getScripts().getUserDefinedFunction(udf.id()).read(); + validateResponse(udf, read); + } + + @Test(groups = {"simple"}, timeOut = TIMEOUT) + public void replaceUDF() throws Exception { + + CosmosUserDefinedFunctionProperties udf = getCosmosUserDefinedFunctionProperties(); + + CosmosSyncUserDefinedFunctionResponse createResponse = container.getScripts().createUserDefinedFunction(udf); + + CosmosUserDefinedFunctionProperties readUdf = container.getScripts() + .getUserDefinedFunction(udf.id()) + .read() + .properties(); + + readUdf.body("function() {var x = 11;}"); + CosmosSyncUserDefinedFunctionResponse replace = container.getScripts() + .getUserDefinedFunction(udf.id()) + .replace(readUdf); + validateResponse(udf, replace); + + } + + @Test(groups = {"simple"}, timeOut = TIMEOUT) + public void deleteUDF() throws Exception { + CosmosUserDefinedFunctionProperties udf = getCosmosUserDefinedFunctionProperties(); + + CosmosSyncUserDefinedFunctionResponse createResponse = container.getScripts().createUserDefinedFunction(udf); + + CosmosSyncResponse delete = container.getScripts() + .getUserDefinedFunction(udf.id()) + .delete(); + + } + + private CosmosUserDefinedFunctionProperties getCosmosUserDefinedFunctionProperties() { + CosmosUserDefinedFunctionProperties udf = new CosmosUserDefinedFunctionProperties(); + udf.id(UUID.randomUUID().toString()); + udf.body("function() {var x = 10;}"); + return udf; + } + + @Test(groups = {"simple"}, timeOut = TIMEOUT) + public void readAllUDFs() throws Exception { + CosmosUserDefinedFunctionProperties udf = getCosmosUserDefinedFunctionProperties(); + + container.getScripts().createUserDefinedFunction(udf); + + FeedOptions feedOptions = new FeedOptions(); + feedOptions.enableCrossPartitionQuery(true); + Iterator> feedResponseIterator3 = + container.getScripts().readAllUserDefinedFunctions(feedOptions); + assertThat(feedResponseIterator3.hasNext()).isTrue(); + } + + @Test(groups = {"simple"}, timeOut = TIMEOUT) + public void queryUDFs() throws Exception { + CosmosUserDefinedFunctionProperties properties = getCosmosUserDefinedFunctionProperties(); + + container.getScripts().createUserDefinedFunction(properties); + String query = String.format("SELECT * from c where c.id = '%s'", properties.id()); + FeedOptions feedOptions = new FeedOptions(); + feedOptions.enableCrossPartitionQuery(true); + + Iterator> feedResponseIterator1 = + container.getScripts().queryUserDefinedFunctions(query, feedOptions); + assertThat(feedResponseIterator1.hasNext()).isTrue(); + + SqlQuerySpec querySpec = new SqlQuerySpec(query); + Iterator> feedResponseIterator2 = + container.getScripts().queryUserDefinedFunctions(query, feedOptions); + assertThat(feedResponseIterator2.hasNext()).isTrue(); + } + + private void validateResponse(CosmosUserDefinedFunctionProperties properties, + CosmosSyncUserDefinedFunctionResponse createResponse) { + // Basic validation + assertThat(createResponse.properties().id()).isNotNull(); + assertThat(createResponse.properties().id()) + .as("check Resource Id") + .isEqualTo(properties.id()); + + } + +} diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/sync/CosmosSyncUserTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/sync/CosmosSyncUserTest.java new file mode 100644 index 000000000000..e56a90202605 --- /dev/null +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/sync/CosmosSyncUserTest.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.data.cosmos.sync; + +import com.azure.data.cosmos.CosmosClientBuilder; +import com.azure.data.cosmos.CosmosDatabaseForTest; +import com.azure.data.cosmos.CosmosUserProperties; +import com.azure.data.cosmos.FeedOptions; +import com.azure.data.cosmos.FeedResponse; +import com.azure.data.cosmos.SqlQuerySpec; +import com.azure.data.cosmos.rx.TestSuiteBase; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Factory; +import org.testng.annotations.Test; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.UUID; + +import static org.assertj.core.api.Assertions.assertThat; + +public class CosmosSyncUserTest extends TestSuiteBase { + + private String preExistingDatabaseId = CosmosDatabaseForTest.generateId(); + private List databases = new ArrayList<>(); + private CosmosSyncClient client; + private CosmosSyncDatabase createdDatabase; + + @Factory(dataProvider = "clientBuilders") + public CosmosSyncUserTest(CosmosClientBuilder clientBuilder) { + super(clientBuilder); + } + + @BeforeClass(groups = {"simple"}, timeOut = SETUP_TIMEOUT) + public void beforeClass() { + client = clientBuilder().buildSyncClient(); + createdDatabase = createSyncDatabase(client, preExistingDatabaseId); + } + + @AfterClass(groups = {"simple"}, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) + public void afterClass() { + safeDeleteSyncDatabase(createdDatabase); + for (String dbId : databases) { + safeDeleteSyncDatabase(client.getDatabase(dbId)); + } + safeCloseSyncClient(client); + } + + + @Test(groups = { "simple" }, timeOut = TIMEOUT) + public void createUser() throws Exception { + CosmosUserProperties user = getUserProperties(); + CosmosSyncUserResponse response = createdDatabase.createUser(user); + + validateResponse(user, response); + } + + private CosmosUserProperties getUserProperties() { + CosmosUserProperties user = new CosmosUserProperties(); + user.id(UUID.randomUUID().toString()); + return user; + } + + + @Test(groups = { "simple" }, timeOut = TIMEOUT) + public void readUser() throws Exception { + CosmosUserProperties userProperties = getUserProperties(); + CosmosSyncUserResponse response = createdDatabase.createUser(userProperties); + + CosmosSyncUser user = createdDatabase.getUser(userProperties.id()); + CosmosSyncUserResponse readResponse = user.read(); + validateResponse(userProperties, readResponse); + } + + @Test(groups = { "simple" }, timeOut = TIMEOUT) + public void deleteUser() throws Exception { + CosmosUserProperties userProperties = getUserProperties(); + CosmosSyncUserResponse response = createdDatabase.createUser(userProperties); + + CosmosSyncUser user = createdDatabase.getUser(userProperties.id()); + CosmosSyncUserResponse delete = user.delete(); + + } + + + + @Test(groups = { "simple" }, timeOut = TIMEOUT) + public void readAllUsers() throws Exception{ + CosmosUserProperties userProperties = getUserProperties(); + CosmosSyncUserResponse response = createdDatabase.createUser(userProperties); + + Iterator> feedResponseIterator = createdDatabase.readAllUsers(); + assertThat(feedResponseIterator.hasNext()).isTrue(); + + Iterator> feedResponseIterator2 = createdDatabase.readAllUsers(new FeedOptions()); + assertThat(feedResponseIterator2.hasNext()).isTrue(); + + } + + + @Test(groups = { "simple" }, timeOut = TIMEOUT) + public void queryUsers() throws Exception{ + CosmosUserProperties userProperties = getUserProperties(); + CosmosSyncUserResponse response = createdDatabase.createUser(userProperties); + + String query = String.format("SELECT * from c where c.id = '%s'", userProperties.id()); + FeedOptions feedOptions = new FeedOptions().enableCrossPartitionQuery(true); + + Iterator> feedResponseIterator1 = + createdDatabase.queryUsers(query, feedOptions); + assertThat(feedResponseIterator1.hasNext()).isTrue(); + + SqlQuerySpec querySpec = new SqlQuerySpec(query); + Iterator> feedResponseIterator2 = + createdDatabase.queryUsers(query, feedOptions); + assertThat(feedResponseIterator2.hasNext()).isTrue(); + + } + + private void validateResponse(CosmosUserProperties properties, + CosmosSyncUserResponse createResponse) { + // Basic validation + assertThat(createResponse.properties().id()).isNotNull(); + assertThat(createResponse.properties().id()) + .as("check Resource Id") + .isEqualTo(properties.id()); + + } +} diff --git a/sdk/cosmos/pom.xml b/sdk/cosmos/pom.xml index be5969442abd..87841441d5f1 100644 --- a/sdk/cosmos/pom.xml +++ b/sdk/cosmos/pom.xml @@ -7,13 +7,13 @@ Licensed under the MIT License. com.azure azure-data-sdk-parent - 1.1.0 + 1.2.0 ../../pom.data.xml com.microsoft.azure azure-cosmos-parent - 3.1.0 + 3.2.0 pom Microsoft Azure Cosmos DB SQL API @@ -34,14 +34,16 @@ Licensed under the MIT License. UTF-8 UTF-8 - 3.1.0 - 3.1.0 + 3.2.0 + 3.2.0 + 4.1.0 + 1.2.0 1.10.19 - 4.1.36.Final - 3.1.0 + 4.1.38.Final + 2.0.25.Final + 3.2.0 27.0.1-jre 3.2.9.RELEASE - 2.0.25.Final unit ${project.basedir}/target/collectedArtifactsForRelease diff --git a/sdk/cosmos/tests.yml b/sdk/cosmos/tests.yml index 771b32bcbb58..ba682d049594 100644 --- a/sdk/cosmos/tests.yml +++ b/sdk/cosmos/tests.yml @@ -20,7 +20,7 @@ jobs: # 59m 59s, timed out Http_E2E: DisplayName: ReadMyWrites Integration Tests - OSVmImage: 'vs2017-win2016' + OSVmImage: 'windows-2019' ProfileFlag: '-Pe2e' AdditionalArgs: '-DargLine="-Dcosmos.directModeProtocol=Https"' DESIRED_CONSISTENCY: 'Session' @@ -98,7 +98,7 @@ jobs: # 28m 42s, expect passed (rebalanced) Single_Region_Long: DisplayName: Long Integration Tests - OSVmImage: 'vs2017-win2016' + OSVmImage: 'windows-2019' ProfileFlag: '-e -Plong' DESIRED_CONSISTENCIES: '["Session"]' PREFERRED_LOCATIONS: null @@ -188,7 +188,7 @@ jobs: # 59m 58s, timed out Https_E2E: DisplayName: Single Region ReadMyWrites - OSVmImage: 'vs2017-win2016' + OSVmImage: 'windows-2019' ProfileFlag: '-Pe2e' AdditionalArgs: '-DargLine="-Dcosmos.directModeProtocol=Https"' DESIRED_CONSISTENCY: 'Strong' @@ -251,7 +251,7 @@ jobs: # 29m 23s, expect passed Long: DisplayName: Multimaster Multi Region Long - OSVmImage: 'vs2017-win2016' + OSVmImage: 'windows-2019' ProfileFlag: '-e -Plong' AdditionalArgs: '-DargLine="-Dcosmos.directModeProtocol=Https"' # 06m 34s, previously failing diff --git a/sdk/eventgrid/ci.yml b/sdk/eventgrid/ci.yml index cbbf63586bf3..b749a54d465d 100644 --- a/sdk/eventgrid/ci.yml +++ b/sdk/eventgrid/ci.yml @@ -1,10 +1,19 @@ # DO NOT EDIT THIS FILE # This file is generated automatically and any changes will be lost. +resources: + repositories: + - repository: azure-sdk-build-tools + type: git + name: internal/azure-sdk-build-tools + trigger: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/eventgrid/ @@ -13,11 +22,18 @@ pr: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/eventgrid/ -jobs: - - template: ../../eng/pipelines/templates/jobs/archetype-sdk-client.yml +stages: + - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: - ServiceDirectory: eventgrid \ No newline at end of file + ServiceDirectory: eventgrid + Artifacts: + - name: azure-eventgrid + safeName: azureeventgrid + stagingProfileId: 534d15ee3800f4 \ No newline at end of file diff --git a/sdk/eventgrid/microsoft-azure-eventgrid/pom.xml b/sdk/eventgrid/microsoft-azure-eventgrid/pom.xml index 674f7f407d61..0509c022e02a 100644 --- a/sdk/eventgrid/microsoft-azure-eventgrid/pom.xml +++ b/sdk/eventgrid/microsoft-azure-eventgrid/pom.xml @@ -5,16 +5,23 @@ * * Code generated by Microsoft (R) AutoRest Code Generator. --> - + 4.0.0 com.microsoft.azure azure-eventgrid - 1.3.0 + 1.4.0-preview.1 jar Microsoft Azure SDK for eventgrid This package contains Microsoft Azure EventGrid SDK. + + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml + https://github.com/Azure/azure-sdk-for-java - + The MIT License (MIT) http://opensource.org/licenses/MIT diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md new file mode 100644 index 000000000000..79c721eff657 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CHANGELOG.md @@ -0,0 +1,20 @@ +# Release History + +## 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 +to the Java ecosystem, and as consistent across different languages and platforms as possible. The principles that guide +our efforts can be found in the [Azure SDK Design Guidelines for Java](https://azure.github.io/azure-sdk/java_introduction.html). + +### Features + +- Reactive streams support using [Project Reactor](https://projectreactor.io/). +- Receive messages from all partitions of an Azure Event Hub using `EventProcessor`. +- Provide an instance of `BlobPartitionManager` to your Event Processor. `BlobPartitionManager` uses Storage Blobs to +store checkpoints and balance partition load among all instances of Event Processors. +- Store checkpoint and partition ownership details in [Azure Storage Blobs](https://azure.microsoft.com/en-us/services/storage/blobs/). + +### Known issues + +- Initial offset provider for each partition is not implemented. +- Interoperability with Event Processors of other language SDKs like Python is not supported. diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CONTRIBUTING.md b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CONTRIBUTING.md new file mode 100644 index 000000000000..06924f0d3a02 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CONTRIBUTING.md @@ -0,0 +1,83 @@ +# Contributing + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License +Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For +details, visit https://cla.microsoft.com. + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate +the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to +do this once across all repositories using our CLA. + +## Code of conduct + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact +[opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. + +## Getting started + +Before working on a contribution, it would be beneficial to familiarize yourself with the process and guidelines used +for the Azure SDKs so that your submission is consistent with the project standards and is ready to be accepted with +fewer changes requested. In particular, it is recommended to review: + +- [Azure SDK README][github-general], to learn more about the overall project and processes used. +- [Azure SDK Design Guidelines][design-guidelines], to understand the general guidelines for the SDKs across all + languages and platforms +- [Azure SDK Design Guidelines for Java][java-spec], to understand the guidelines specific to the Azure SDKs for Java. + +## Development environment setup + +### Prerequisites + +- Java Development Kit (JDK) with version 8 or above +- [Maven][maven] +- Git +- Microsoft Azure subscription + - You can create a free account at: https://azure.microsoft.com +- Azure Event Hubs instance + - Step-by-step guide for [creating an Event Hub using the Azure Portal][event_hubs_create] +- Azure Storage account + - Step-by-step guide for [creating a Storage account using the Azure Portal][storage_account] + +## Building all the client libraries + +Open a command prompt/terminal: +1. Execute `git clone https://github.com/Azure/azure-sdk-for-java.git` +1. Traverse to the repository root. +1. Execute `mvn compile -f pom.client.xml` +1. Install the tooling and build the product by executing: + * `mvn install -Dinclude-non-shipping-modules -DskipTests -Dgpg.skip -f pom.client.xml` + +## Building only the Azure SDK client library for Storage Blob Checkpoint Store + +After building the tooling and solution once from the section, +[Building all the client libraries](#building-all-the-client-libraries), you can build just the Azure SDK client library + for Checkpoint store using Storage Blobs by executing: +1. `mvn compile -f sdk\eventhubs\azure-messaging-eventhubs-checkpointstore-blob\pom.xml` + +## Running tests + +After following instructions in [Building all the client libraries](#building-all-the-client-libraries), you can run the +unit tests by executing: +1. `mvn test -f sdk\eventhubs\azure-messaging-eventhubs-checkpointstore-blob\pom.xml` + +For unit tests, there are no special considerations; these are self-contained and execute locally without any reliance +on external resources. These tests are run for all PR validations. + +## Logging output + +Log messages can be seen in the output window by: +1. Setting `AZURE_LOG_LEVEL` to the desired verbosity. Log levels can be found in [ClientLogger][log-level] +1. Adding an implementation of [slf4j][slf4j] to the classpath. Implementations can be found under section "[Binding with a + logging framework at deployment time][slf4j-implementations]". + + +[design-guidelines]: https://azure.github.io/azure-sdk/java_design.html# +[event_hubs_create]: https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-create +[github-general]: https://github.com/Azure/azure-sdk +[java-spec]: https://azure.github.io/azure-sdk/java_introduction.html +[log-level]: https://github.com/Azure/azure-sdk-for-java/blob/master/core/azure-core/src/main/java/com/azure/core/util/logging/ClientLogger.java#L40 +[maven]: https://maven.apache.org/ +[slf4j]: https://www.slf4j.org/ +[slf4j-implementations]: https://www.slf4j.org/manual.html#swapping +[storage_account]: https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md new file mode 100644 index 000000000000..0e9cb874a6c2 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/README.md @@ -0,0 +1,187 @@ +# Azure Event Hubs Checkpoint Store client library for Java using Storage Blobs + +Azure Event Hubs Checkpoint Store can be used for storing checkpoints while processing events from Azure Event Hubs. +This package uses Storage Blobs as a persistent store for maintaining checkpoints and partition ownership information. +The `BlobPartitionManager` provided in this package can be plugged in to `EventProcessor`. + +[Source code][source_code] | [API reference documentation][api_documentation] | [Product +documentation][event_hubs_product_docs] | [Samples][sample_examples] + +## Getting started + +### Prerequisites + +- Java Development Kit (JDK) with version 8 or above +- [Maven][maven] +- Microsoft Azure subscription + - You can create a free account at: https://azure.microsoft.com +- Azure Event Hubs instance + - Step-by-step guide for [creating an Event Hub using the Azure Portal][event_hubs_create] +- Azure Storage account + - Step-by-step guide for [creating a Storage account using the Azure Portal][storage_account] + +### Adding the package to your product + +```xml + + com.azure + azure-messaging-eventhubs-checkpointstore-blob + 1.0.0-preview.1 + +``` + +### 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 +(shared access signature) string of Storage account. Learn more at [SAS Token][sas_token]. + +## Key concepts + +### Checkpointing + +Checkpointing is a process by which readers mark or commit their position within a partition event sequence. +Checkpointing is the responsibility of the consumer and occurs on a per-partition basis within a consumer group. +This responsibility means that for each consumer group, each partition reader must keep track of its current position +in the event stream, and can inform the service when it considers the data stream complete. If a reader disconnects from +a partition, when it reconnects it begins reading at the checkpoint that was previously submitted by the last reader of +that partition in that consumer group. When the reader connects, it passes the offset to the event hub to specify the +location at which to start reading. In this way, you can use checkpointing to both mark events as "complete" by +downstream applications, and to provide resiliency if a failover between readers running on different machines occurs. +It is possible to return to older data by specifying a lower offset from this checkpointing process. Through this +mechanism, checkpointing enables both failover resiliency and event stream replay. + +### Offsets & sequence numbers +Both offset & sequence number refer to the position of an event within a partition. You can think of them as a +client-side cursor. The offset is a byte numbering of the event. The offset/sequence number enables an event consumer +(reader) to specify a point in the event stream from which they want to begin reading events. You can specify the a +timestamp such that you receive events that were enqueued only after the given timestamp. Consumers are responsible for +storing their own offset values outside of the Event Hubs service. Within a partition, each event includes an offset, +sequence number and the timestamp of when it was enqueued. + +## Examples +- [Create an instance of Storage Container client][sample_container_client] +- [Consume events from all Event Hub partitions][sample_event_processor] + +### Create an instance of Storage container with SAS token +```java +SASTokenCredential sasTokenCredential = SASTokenCredential.fromSASTokenString(""); +ContainerAsyncClient containerAsyncClient = new ContainerClientBuilder() + .connectionString("") + .containerName("") + .credential(sasTokenCredential) + .buildAsyncClient(); +``` + +### Consume events using an Event Processor + +To consume events for all partitions of an Event Hub, you'll create an [`EventProcessor`][source_eventprocessor] for a +specific consumer group. When an Event Hub is created, it provides a default consumer group that can be used to get +started. + +The [`EventProcessor`][source_eventprocessor] will delegate processing of events to a +[`PartitionProcessor`][source_partition_processor] implementation that you provide, allowing your application to focus on the +business logic needed to provide value while the processor holds responsibility for managing the underlying consumer operations. + +In our example, we will focus on building the [`EventProcessor`][source_eventprocessor], use the +[`BlobPartitionManager`][source_blobpartitionmanager], and a simple `PartitionProcessor` implementation that logs +events received from Event Hubs to console. + +```java +class Program { + public static void main(String[] args) { + EventProcessor eventProcessor = new EventHubClientBuilder() + .connectionString("<< CONNECTION STRING FOR THE EVENT HUB INSTANCE >>") + .consumerGroupName("<< CONSUMER GROUP NAME>>") + .partitionProcessorFactory(SimplePartitionProcessor::new) + .partitionManager(new BlobPartitionManager(containerAsyncClient)) + .buildEventProcessor(); + + // This will start the processor. It will start processing events from all partitions. + eventProcessor.start(); + + // When the user wishes to stop processing events, they can call `stop()`. + eventProcessor.stop(); + } +} + +class SimplePartitionProcessor extends PartitionProcessor { + @Override + Mono processEvent(PartitionContext partitionContext, EventData eventData) { + System.out.printf("Event received. Sequence number: %s%n.", eventData.sequenceNumber()); + return partitionContext.updateCheckpoint(eventData); + } +} +``` + +## Troubleshooting + +### Enable client logging + +You can set the `AZURE_LOG_LEVEL` environment variable to view logging statements made in the client library. For +example, setting `AZURE_LOG_LEVEL=2` would show all informational, warning, and error log messages. The log levels can +be found here: [log levels][source_loglevels]. + +## Next steps +Get started by exploring the following samples: + +1. [Blob Partition Manager samples][sample_examples] +1. [Event Hubs and Event Processor samples][sample_event_hubs] + +## Contributing + +If you would like to become an active contributor to this project please refer to our [Contribution +Guidelines](./CONTRIBUTING.md) for more information. + + +[api_documentation]: http://azure.github.io/azure-sdk-for-java/track2reports/index.html +[event_hubs_product_docs]: https://docs.microsoft.com/azure/event-hubs/ +[java_8_sdk_javadocs]: https://docs.oracle.com/javase/8/docs/api/java/util/logging/package-summary.html +[maven]: https://maven.apache.org/ +[sample_container_client]: ./src/samples/java/com/azure/messaging/eventhubs/checkpointstore/blob/BlobPartitionManagerSample.java +[sample_event_hubs]: ./src/samples/java/com/azure/messaging/eventhubs +[sample_event_processor]: ./src/samples/java/com/azure/messaging/eventhubs/checkpointstore/blob/EventProcessorBlobPartitionManagerSample.java +[sample_examples]: ./src/samples/java/com/azure/messaging/eventhubs/checkpointstore/blob +[sas_token]: https://docs.microsoft.com/azure/storage/common/storage-dotnet-shared-access-signature-part-1 +[source_code]: ./ +[source_eventprocessor]: ./src/main/java/com/azure/messaging/eventhubs/EventProcessor.java +[source_blobpartitionmanager]: ./src/main/java/com/azure/messaging/eventhubs/checkpointstore/blob/BlobPartitionManager.java +[source_loglevels]: ../../core/azure-core/src/main/java/com/azure/core/util/logging/ClientLogger.java +[source_partition_processor]: ./src/main/java/com/azure/messaging/eventhubs/PartitionProcessor.java +[storage_account]: https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/eventhubs/azure-messaging-eventhubs/README.png) diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/pom.xml b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/pom.xml new file mode 100644 index 000000000000..171193bc63c3 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/pom.xml @@ -0,0 +1,73 @@ + + + + + + azure-client-sdk-parent + com.azure + 1.4.0 + ../../../pom.client.xml + + 4.0.0 + + azure-messaging-eventhubs-checkpointstore-blob + 1.0.0-preview.2 + + Microsoft Azure client library for storing checkpoints in Storage Blobs + Library for using storing checkpoints in Storage Blobs + https://github.com/Azure/azure-sdk-for-java + + + + azure-java-build-docs + ${site.url}/site/${project.artifactId} + + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + + com.azure + azure-messaging-eventhubs + 5.0.0-preview.4 + + + com.azure + azure-storage-blob + 12.0.0-preview.4 + + + + + junit + junit + test + + + org.slf4j + slf4j-simple + test + + + io.projectreactor + reactor-test + test + + + org.mockito + mockito-core + test + + + + diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/main/java/com/azure/messaging/eventhubs/checkpointstore/blob/BlobPartitionManager.java b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/main/java/com/azure/messaging/eventhubs/checkpointstore/blob/BlobPartitionManager.java new file mode 100644 index 000000000000..13506b3d79ba --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/main/java/com/azure/messaging/eventhubs/checkpointstore/blob/BlobPartitionManager.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs.checkpointstore.blob; + +import com.azure.core.implementation.util.ImplUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.messaging.eventhubs.EventProcessor; +import com.azure.messaging.eventhubs.PartitionManager; +import com.azure.messaging.eventhubs.models.Checkpoint; +import com.azure.messaging.eventhubs.models.PartitionOwnership; +import com.azure.storage.blob.BlobAsyncClient; +import com.azure.storage.blob.ContainerAsyncClient; +import com.azure.storage.blob.models.BlobAccessConditions; +import com.azure.storage.blob.models.BlobItem; +import com.azure.storage.blob.models.BlobListDetails; +import com.azure.storage.blob.models.BlobProperties; +import com.azure.storage.blob.models.ListBlobsOptions; +import com.azure.storage.blob.models.Metadata; +import com.azure.storage.blob.models.ModifiedAccessConditions; +import reactor.core.Exceptions; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.nio.ByteBuffer; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import static java.nio.charset.StandardCharsets.UTF_8; + +/** + * Implementation of {@link PartitionManager} that uses + * Storage Blobs + * for persisting partition ownership and checkpoint information. {@link EventProcessor EventProcessors} can use this + * implementation to load balance and update checkpoints. + * + * @see EventProcessor + */ +public class BlobPartitionManager implements PartitionManager { + + private static final String SEQUENCE_NUMBER = "SequenceNumber"; + private static final String OFFSET = "Offset"; + private static final String OWNER_ID = "OwnerId"; + private static final String ETAG = "eTag"; + + private static final String BLOB_PATH_SEPARATOR = "/"; + private static final ByteBuffer UPLOAD_DATA = ByteBuffer.wrap("" .getBytes(UTF_8)); + + private final ContainerAsyncClient containerAsyncClient; + private final ClientLogger logger = new ClientLogger(BlobPartitionManager.class); + private final Map blobClients = new ConcurrentHashMap<>(); + + /** + * Creates an instance of BlobPartitionManager. + * + * @param containerAsyncClient The {@link ContainerAsyncClient} this instance will use to read and update blobs in + * the storage container. + */ + public BlobPartitionManager(ContainerAsyncClient containerAsyncClient) { + this.containerAsyncClient = containerAsyncClient; + } + + /** + * This method is called by the {@link EventProcessor} to get the list of all existing partition ownership from the + * Storage Blobs. Could return empty results if there are is no existing ownership information. + * + * @param eventHubName The Event Hub name to get ownership information. + * @param consumerGroupName The consumer group name. + * @return A flux of partition ownership details of all the partitions that have/had an owner. + */ + @Override + public Flux listOwnership(String eventHubName, String consumerGroupName) { + String prefix = getBlobPrefix(eventHubName, consumerGroupName); + BlobListDetails details = new BlobListDetails().setMetadata(true); + ListBlobsOptions options = new ListBlobsOptions().setPrefix(prefix).setDetails(details); + return containerAsyncClient.listBlobsFlat(options) + // Blob names should be of the pattern eventhub/consumergroup/ + // While we can further check if the partition id is numeric, it may not necessarily be the case in future. + .filter(blobItem -> blobItem.getName().split(BLOB_PATH_SEPARATOR).length == 3) + .map(this::convertToPartitionOwnership); + } + + /** + * This method is called by the {@link EventProcessor} to claim ownership of a list of partitions. This will return + * the list of partitions that were owned successfully. + * + * @param requestedPartitionOwnerships Array of partition ownerships this instance is requesting to own. + * @return A flux of partitions this instance successfully claimed ownership. + */ + @Override + public Flux claimOwnership(PartitionOwnership... requestedPartitionOwnerships) { + + return Flux.fromArray(requestedPartitionOwnerships).flatMap( + partitionOwnership -> { + + String partitionId = partitionOwnership.getPartitionId(); + String blobName = getBlobName(partitionOwnership.getEventHubName(), + partitionOwnership.getConsumerGroupName(), partitionId); + + if (!blobClients.containsKey(blobName)) { + blobClients.put(blobName, containerAsyncClient.getBlobAsyncClient(blobName)); + } + + BlobAsyncClient blobAsyncClient = blobClients.get(blobName); + + Metadata metadata = new Metadata(); + metadata.put(OWNER_ID, partitionOwnership.getOwnerId()); + Long offset = partitionOwnership.getOffset(); + metadata.put(OFFSET, offset == null ? null : String.valueOf(offset)); + Long sequenceNumber = partitionOwnership.getSequenceNumber(); + metadata.put(SEQUENCE_NUMBER, sequenceNumber == null ? null : String.valueOf(sequenceNumber)); + BlobAccessConditions blobAccessConditions = new BlobAccessConditions(); + if (ImplUtils.isNullOrEmpty(partitionOwnership.getETag())) { + // New blob should be created + blobAccessConditions.setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfNoneMatch("*")); + return blobAsyncClient.asBlockBlobAsyncClient() + .uploadWithResponse(Flux.just(UPLOAD_DATA), 0, null, metadata, null, + blobAccessConditions) + .flatMapMany(response -> { + partitionOwnership.setETag(response.getHeaders().get(ETAG).getValue()); + return Mono.just(partitionOwnership); + }, error -> { + logger.info("Couldn't claim ownership of partition {}, error {}", partitionId, + error.getMessage()); + return Mono.empty(); + }, Mono::empty); + } else { + // update existing blob + blobAccessConditions.setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfMatch(partitionOwnership.getETag())); + return blobAsyncClient.setMetadataWithResponse(metadata, blobAccessConditions) + .flatMapMany(response -> { + partitionOwnership.setETag(response.getHeaders().get(ETAG).getValue()); + return Mono.just(partitionOwnership); + }, error -> { + logger.info("Couldn't claim ownership of partition {}, error {}", partitionId, + error.getMessage()); + return Mono.empty(); + }, () -> Mono.empty()); + } + } + ); + } + + /** + * Updates the checkpoint in Storage Blobs for a partition. + * + * @param checkpoint Checkpoint information containing sequence number and offset to be stored for this partition. + * @return The new ETag on successful update. + */ + @Override + public Mono updateCheckpoint(Checkpoint checkpoint) { + if (checkpoint.getSequenceNumber() == null && checkpoint.getOffset() == null) { + throw logger.logExceptionAsWarning(Exceptions + .propagate(new IllegalStateException( + "Both sequence number and offset cannot be null when updating a checkpoint"))); + } + + String partitionId = checkpoint.getPartitionId(); + String blobName = getBlobName(checkpoint.getEventHubName(), checkpoint.getConsumerGroupName(), partitionId); + if (!blobClients.containsKey(blobName)) { + blobClients.put(blobName, containerAsyncClient.getBlobAsyncClient(blobName)); + } + + Metadata metadata = new Metadata(); + String sequenceNumber = checkpoint.getSequenceNumber() == null ? null + : String.valueOf(checkpoint.getSequenceNumber()); + + String offset = checkpoint.getOffset() == null ? null : String.valueOf(checkpoint.getOffset()); + metadata.put(SEQUENCE_NUMBER, sequenceNumber); + metadata.put(OFFSET, offset); + metadata.put(OWNER_ID, checkpoint.getOwnerId()); + BlobAsyncClient blobAsyncClient = blobClients.get(blobName); + BlobAccessConditions blobAccessConditions = new BlobAccessConditions() + .setModifiedAccessConditions(new ModifiedAccessConditions().setIfMatch(checkpoint.getETag())); + + return blobAsyncClient.setMetadataWithResponse(metadata, blobAccessConditions) + .map(response -> response.getHeaders().get(ETAG).getValue()); + } + + private String getBlobPrefix(String eventHubName, String consumerGroupName) { + return eventHubName + BLOB_PATH_SEPARATOR + consumerGroupName; + } + + private String getBlobName(String eventHubName, String consumerGroupName, String partitionId) { + return eventHubName + BLOB_PATH_SEPARATOR + consumerGroupName + BLOB_PATH_SEPARATOR + partitionId; + } + + private PartitionOwnership convertToPartitionOwnership(BlobItem blobItem) { + PartitionOwnership partitionOwnership = new PartitionOwnership(); + logger.info("Found blob for partition {}", blobItem.getName()); + + String[] names = blobItem.getName().split(BLOB_PATH_SEPARATOR); + partitionOwnership.setEventHubName(names[0]); + partitionOwnership.setConsumerGroupName(names[1]); + partitionOwnership.setPartitionId(names[2]); + + if (ImplUtils.isNullOrEmpty(blobItem.getMetadata())) { + logger.warning("No metadata available for blob {}", blobItem.getName()); + return partitionOwnership; + } + + blobItem.getMetadata().forEach((key, value) -> { + switch (key) { + case OWNER_ID: + partitionOwnership.setOwnerId(value); + break; + case SEQUENCE_NUMBER: + partitionOwnership.setSequenceNumber(Long.valueOf(value)); + break; + case OFFSET: + partitionOwnership.setOffset(Long.valueOf(value)); + break; + default: + // do nothing, other metadata that we don't use + break; + } + }); + BlobProperties blobProperties = blobItem.getProperties(); + partitionOwnership.setLastModifiedTime(blobProperties.getLastModified().toInstant().toEpochMilli()); + partitionOwnership.setETag(blobProperties.getEtag()); + return partitionOwnership; + } + +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/main/java/com/azure/messaging/eventhubs/checkpointstore/blob/package-info.java b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/main/java/com/azure/messaging/eventhubs/checkpointstore/blob/package-info.java new file mode 100644 index 000000000000..7281094ad284 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/main/java/com/azure/messaging/eventhubs/checkpointstore/blob/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +/** + * Package containing implementation for {@link com.azure.messaging.eventhubs.PartitionManager PartitionManager} that + * uses Storage + * blobs for persisting checkpoints and partition ownership details. + */ +package com.azure.messaging.eventhubs.checkpointstore.blob; 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 new file mode 100644 index 000000000000..44bcbc707465 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/samples/java/com/azure/messaging/eventhubs/checkpointstore/blob/BlobPartitionManagerSample.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs.checkpointstore.blob; + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.messaging.eventhubs.models.Checkpoint; +import com.azure.messaging.eventhubs.models.PartitionOwnership; +import com.azure.storage.blob.ContainerAsyncClient; +import com.azure.storage.blob.ContainerClientBuilder; +import com.azure.storage.common.credentials.SASTokenCredential; +import java.util.StringJoiner; + +/** + * Sample that demonstrates the use {@link BlobPartitionManager} for storing and updating partition ownership records in + * Storage Blobs. + */ +public class BlobPartitionManagerSample { + + /** + * The main method to run the sample. + * + * @param args Unused arguments to the sample. + * @throws Exception If there are any errors while running the sample. + */ + public static void main(String[] args) throws Exception { + SASTokenCredential sasTokenCredential = SASTokenCredential.fromSASTokenString(""); + ContainerAsyncClient containerAsyncClient = new ContainerClientBuilder() + .connectionString("") + .containerName("") + .credential(sasTokenCredential) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .buildAsyncClient(); + + BlobPartitionManager blobPartitionManager = new BlobPartitionManager(containerAsyncClient); + blobPartitionManager.listOwnership("abc", "xyz") + .subscribe(BlobPartitionManagerSample::printPartitionOwnership); + + System.out.println("Updating checkpoint"); + Checkpoint checkpoint = new Checkpoint() + .setConsumerGroupName("xyz") + .setEventHubName("abc") + .setOwnerId("owner1") + .setPartitionId("0") + .setETag("") + .setSequenceNumber(2L) + .setOffset(250L); + blobPartitionManager.updateCheckpoint(checkpoint) + .subscribe(etag -> System.out.println(etag), error -> System.out + .println(error.getMessage())); + + PartitionOwnership[] pos = new PartitionOwnership[5]; + for (int i = 0; i < 5; i++) { + PartitionOwnership po = new PartitionOwnership() + .setEventHubName("abc") + .setConsumerGroupName("xyz") + .setOwnerId("owner1") + .setPartitionId(String.valueOf(i)) + .setOwnerLevel(0); + pos[i] = po; + } + blobPartitionManager.claimOwnership(pos).subscribe(BlobPartitionManagerSample::printPartitionOwnership, + System.out::println); + } + + static void printPartitionOwnership(PartitionOwnership partitionOwnership) { + String po = + new StringJoiner(",") + .add("pid=" + partitionOwnership.getPartitionId()) + .add("ownerId=" + partitionOwnership.getOwnerId()) + .add("cg=" + partitionOwnership.getConsumerGroupName()) + .add("eh=" + partitionOwnership.getEventHubName()) + .add("offset=" + partitionOwnership.getOffset()) + .add("etag=" + partitionOwnership.getETag()) + .add("lastModified=" + partitionOwnership.getLastModifiedTime()) + .toString(); + System.out.println(po); + } + +} + 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 new file mode 100644 index 000000000000..a0e4b84c3b50 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/samples/java/com/azure/messaging/eventhubs/checkpointstore/blob/EventProcessorBlobPartitionManagerSample.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs.checkpointstore.blob; + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.messaging.eventhubs.EventData; +import com.azure.messaging.eventhubs.EventHubAsyncClient; +import com.azure.messaging.eventhubs.EventHubClientBuilder; +import com.azure.messaging.eventhubs.EventProcessor; +import com.azure.messaging.eventhubs.EventProcessorBuilder; +import com.azure.messaging.eventhubs.PartitionProcessor; +import com.azure.messaging.eventhubs.models.PartitionContext; +import com.azure.storage.blob.ContainerAsyncClient; +import com.azure.storage.blob.ContainerClientBuilder; +import com.azure.storage.common.credentials.SASTokenCredential; +import java.util.concurrent.TimeUnit; +import reactor.core.publisher.Mono; + +/** + * Sample for using {@link BlobPartitionManager} with {@link EventProcessor}. + */ +public class EventProcessorBlobPartitionManagerSample { + + private static final String EH_CONNECTION_STRING = ""; + private static final String SAS_TOKEN_STRING = ""; + private static final String STORAGE_CONNECTION_STRING = ""; + public static final PartitionProcessor PARTITION_PROCESSOR = new PartitionProcessor() { + + @Override + public Mono processEvent( + PartitionContext partitionContext, EventData eventData) { + System.out.printf("Processing event from partition %s with sequence number %d %n", + partitionContext.getPartitionId(), eventData.getSequenceNumber()); + + if (eventData.getSequenceNumber() % 10 == 0) { + return partitionContext.updateCheckpoint(eventData); + } + return Mono.empty(); + } + }; + + /** + * The main method to run the sample. + * + * @param args Unused arguments to the sample. + * @throws Exception if there are any errors while running the sample program. + */ + public static void main(String[] args) throws Exception { + EventHubAsyncClient eventHubAsyncClient = new EventHubClientBuilder() + .connectionString(EH_CONNECTION_STRING) + .buildAsyncClient(); + + SASTokenCredential sasTokenCredential = SASTokenCredential.fromSASTokenString(SAS_TOKEN_STRING); + ContainerAsyncClient containerAsyncClient = new ContainerClientBuilder() + .connectionString(STORAGE_CONNECTION_STRING) + .containerName("") + .credential(sasTokenCredential) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .buildAsyncClient(); + + EventProcessorBuilder eventProcessorBuilder = new EventProcessorBuilder() + .consumerGroup("") + .eventHubClient(eventHubAsyncClient) + .partitionProcessorFactory(() -> PARTITION_PROCESSOR) + .partitionManager(new BlobPartitionManager(containerAsyncClient)); + + EventProcessor ep1 = eventProcessorBuilder.buildEventProcessor(); + EventProcessor ep2 = eventProcessorBuilder.buildEventProcessor(); + ep1.start(); + ep2.start(); + TimeUnit.MINUTES.sleep(5); + ep1.stop(); + ep2.stop(); + } + +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/test/java/com/azure/messaging/eventhubs/checkpointstore/blob/BlobPartitionManagerTest.java b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/test/java/com/azure/messaging/eventhubs/checkpointstore/blob/BlobPartitionManagerTest.java new file mode 100644 index 000000000000..deecfc4966db --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/test/java/com/azure/messaging/eventhubs/checkpointstore/blob/BlobPartitionManagerTest.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs.checkpointstore.blob; + +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.ResponseBase; +import com.azure.core.http.rest.VoidResponse; +import com.azure.core.implementation.http.PagedResponseBase; +import com.azure.messaging.eventhubs.models.Checkpoint; +import com.azure.messaging.eventhubs.models.PartitionOwnership; +import com.azure.storage.blob.BlobAsyncClient; +import com.azure.storage.blob.BlockBlobAsyncClient; +import com.azure.storage.blob.ContainerAsyncClient; +import com.azure.storage.blob.models.BlobAccessConditions; +import com.azure.storage.blob.models.BlobItem; +import com.azure.storage.blob.models.BlobProperties; +import com.azure.storage.blob.models.ListBlobsOptions; +import com.azure.storage.blob.models.Metadata; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentMatchers; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.net.SocketTimeoutException; +import java.nio.ByteBuffer; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import static junit.framework.TestCase.assertNull; +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.Mockito.when; + +/** + * Unit tests for {@link BlobPartitionManager}. + */ +public class BlobPartitionManagerTest { + + @Mock + private ContainerAsyncClient containerAsyncClient; + + @Mock + private BlockBlobAsyncClient blockBlobAsyncClient; + + @Mock + private BlobAsyncClient blobAsyncClient; + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + } + + @Test + public void testListOwnerShip() { + BlobPartitionManager blobPartitionManager = new BlobPartitionManager(containerAsyncClient); + BlobItem blobItem = getBlobItem("owner1", "1", "230", "etag", "eh/cg/0"); + PagedFlux response = new PagedFlux(() -> Mono.just(new PagedResponseBase(null, 200, null, + Arrays.asList(blobItem), null, + null))); + when(containerAsyncClient.listBlobsFlat(any(ListBlobsOptions.class))).thenReturn(response); + + StepVerifier.create(blobPartitionManager.listOwnership("eh", "cg")) + .assertNext(partitionOwnership -> { + assertEquals("owner1", partitionOwnership.getOwnerId()); + assertEquals("0", partitionOwnership.getPartitionId()); + assertEquals(1, (long) partitionOwnership.getSequenceNumber()); + assertEquals(230, (long) partitionOwnership.getOffset()); + assertEquals("eh", partitionOwnership.getEventHubName()); + assertEquals("cg", partitionOwnership.getConsumerGroupName()); + assertEquals("etag", partitionOwnership.getETag()); + }).verifyComplete(); + } + + @Test + public void testUpdateCheckpoint() { + Checkpoint checkpoint = new Checkpoint() + .setEventHubName("eh") + .setConsumerGroupName("cg") + .setOwnerId("owner1") + .setPartitionId("0") + .setETag("etag") + .setSequenceNumber(2L) + .setOffset(100L); + + Map headers = new HashMap<>(); + headers.put("eTag", "etag2"); + when(containerAsyncClient.getBlobAsyncClient("eh/cg/0")).thenReturn(blobAsyncClient); + when(blobAsyncClient.setMetadataWithResponse(any(Metadata.class), any(BlobAccessConditions.class))) + .thenReturn(Mono.just(new VoidResponse(null, 200, new HttpHeaders(headers)))); + + BlobPartitionManager blobPartitionManager = new BlobPartitionManager(containerAsyncClient); + StepVerifier.create(blobPartitionManager.updateCheckpoint(checkpoint)) + .assertNext(etag -> assertEquals("etag2", etag)).verifyComplete(); + } + + + @SuppressWarnings("unchecked") + @Test + public void testClaimOwnership() { + PartitionOwnership po = createPartitionOwnership("eh", "cg", "0", "owner1"); + + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.put("eTag", "etag2"); + + when(containerAsyncClient.getBlobAsyncClient("eh/cg/0")).thenReturn(blobAsyncClient); + when(blobAsyncClient.asBlockBlobAsyncClient()).thenReturn(blockBlobAsyncClient); + when(blockBlobAsyncClient.uploadWithResponse(ArgumentMatchers.>any(), eq(0L), + isNull(), any(Metadata.class), isNull(), any(BlobAccessConditions.class))) + .thenReturn(Mono.just(new ResponseBase<>(null, 200, httpHeaders, null, null))); + + BlobPartitionManager blobPartitionManager = new BlobPartitionManager(containerAsyncClient); + StepVerifier.create(blobPartitionManager.claimOwnership(po)) + .assertNext(partitionOwnership -> { + assertEquals("owner1", partitionOwnership.getOwnerId()); + assertEquals("0", partitionOwnership.getPartitionId()); + assertEquals("eh", partitionOwnership.getEventHubName()); + assertEquals("cg", partitionOwnership.getConsumerGroupName()); + assertEquals("etag2", partitionOwnership.getETag()); + assertNull(partitionOwnership.getSequenceNumber()); + assertNull(partitionOwnership.getOffset()); + }).verifyComplete(); + } + + + @Test + public void testListOwnershipError() { + BlobPartitionManager blobPartitionManager = new BlobPartitionManager(containerAsyncClient); + PagedFlux response = new PagedFlux<>(() -> Mono.error(new SocketTimeoutException())); + when(containerAsyncClient.listBlobsFlat(any(ListBlobsOptions.class))).thenReturn(response); + + StepVerifier.create(blobPartitionManager.listOwnership("eh", "cg")) + .expectError(SocketTimeoutException.class).verify(); + } + + @Test + public void testUpdateCheckpointError() { + Checkpoint checkpoint = new Checkpoint() + .setEventHubName("eh") + .setConsumerGroupName("cg") + .setOwnerId("owner1") + .setPartitionId("0") + .setETag("etag") + .setSequenceNumber(2L) + .setOffset(100L); + + Map headers = new HashMap<>(); + headers.put("eTag", "etag2"); + when(containerAsyncClient.getBlobAsyncClient("eh/cg/0")).thenReturn(blobAsyncClient); + when(blobAsyncClient.setMetadataWithResponse(any(Metadata.class), any(BlobAccessConditions.class))) + .thenReturn(Mono.error(new SocketTimeoutException())); + + BlobPartitionManager blobPartitionManager = new BlobPartitionManager(containerAsyncClient); + StepVerifier.create(blobPartitionManager.updateCheckpoint(checkpoint)) + .expectError(SocketTimeoutException.class).verify(); + } + + @Test + public void testFailedOwnershipClaim() { + PartitionOwnership po = createPartitionOwnership("eh", "cg", "0", "owner1"); + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.put("eTag", "etag2"); + + when(containerAsyncClient.getBlobAsyncClient("eh/cg/0")).thenReturn(blobAsyncClient); + when(blobAsyncClient.asBlockBlobAsyncClient()).thenReturn(blockBlobAsyncClient); + when(blockBlobAsyncClient.uploadWithResponse(ArgumentMatchers.>any(), eq(0L), + isNull(), any(Metadata.class), isNull(), any(BlobAccessConditions.class))) + .thenReturn(Mono.error(new ResourceModifiedException("Etag did not match", null))); + BlobPartitionManager blobPartitionManager = new BlobPartitionManager(containerAsyncClient); + StepVerifier.create(blobPartitionManager.claimOwnership(po)).verifyComplete(); + } + + private PartitionOwnership createPartitionOwnership(String eventHubName, String consumerGroupName, + String partitionId, String ownerId) { + return new PartitionOwnership() + .setEventHubName(eventHubName) + .setConsumerGroupName(consumerGroupName) + .setPartitionId(partitionId) + .setOwnerId(ownerId); + } + + private BlobItem getBlobItem(String owner, String sequenceNumber, String offset, String etag, String blobName) { + Metadata metadata = getMetadata(owner, sequenceNumber, offset); + + BlobProperties properties = new BlobProperties() + .setLastModified(OffsetDateTime.now()) + .setEtag(etag); + + return new BlobItem() + .setName(blobName) + .setMetadata(metadata) + .setProperties(properties); + } + + private Metadata getMetadata(String owner, String sequenceNumber, String offset) { + Metadata metadata = new Metadata(); + metadata.put("OwnerId", owner); + metadata.put("SequenceNumber", sequenceNumber); + metadata.put("Offset", offset); + return metadata; + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker new file mode 100644 index 000000000000..1f0955d450f0 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -0,0 +1 @@ +mock-maker-inline diff --git a/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md b/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md index 6b39d40249b1..b3b5fd34a7e8 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md +++ b/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 5.0.0-preview.3 (2019-09-09) + +- Added synchronous `EventHubConsumer` and `EventHubProducer`. +- Added support for balancing partitions across multiple instances of `EventProcessor`. +- Added `EventProcessorBuilder` to create `EventProcessor` and removed that functionality from `EventHubClientBuilder`. +- Removed `CheckpointManager`. Checkpointing is done using the `PartitionContext` exposed in `PartitionProcessor` methods. +- Changed `PartitionProcessor` from an interface to an abstract base class. +- Changed `EventData.systemProperties` to exclude already exposed properties (ie. sequence number, enqueued time) from + the map. + ## 5.0.0-preview.2 (2019-08-06) - Added support for AMQP protocol using web sockets to connect to Azure Event Hubs. diff --git a/sdk/eventhubs/azure-messaging-eventhubs/README.md b/sdk/eventhubs/azure-messaging-eventhubs/README.md index 3c185370c177..2e26dcdc9c00 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/README.md +++ b/sdk/eventhubs/azure-messaging-eventhubs/README.md @@ -19,6 +19,30 @@ The Azure Event Hubs client library allows for publishing and consuming of Azure [Source code][source_code] | [API reference documentation][api_documentation] | [Product documentation][event_hubs_product_docs] | [Samples][sample_examples] +## Table of contents + +- [Table of contents](#table-of-contents) +- [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) +- [Key concepts](#key-concepts) +- [Examples](#examples) + - [Publish events to an Event Hub](#publish-events-to-an-event-hub) + - [Consume events from an Event Hub partition](#consume-events-from-an-event-hub-partition) + - [Consume events using an Event Processor](#consume-events-using-an-event-processor) +- [Troubleshooting](#troubleshooting) + - [Enable client logging](#enable-client-logging) + - [Enable AMQP transport logging](#enable-amqp-transport-logging) + - [Common exceptions](#common-exceptions) + - [Other exceptions](#other-exceptions) +- [Next steps](#next-steps) +- [Contributing](#contributing) + ## Getting started ### Prerequisites @@ -36,10 +60,45 @@ documentation][event_hubs_product_docs] | [Samples][sample_examples] com.azure azure-messaging-eventhubs - 5.0.0-preview.2 + 5.0.0-preview.3 + +``` + +### 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 @@ -51,7 +110,10 @@ The easiest means for doing so is to use a connection string, which is created a namespace. If you aren't familiar with shared access policies in Azure, you may wish to follow the step-by-step guide to [get an Event Hubs connection string][event_hubs_connection_string]. -Once the connection string is obtained, create an `EventHubAsyncClient` using the `EventHubClientBuilder`: +Both the asynchronous and synchronous Event Hub clients can be created using `EventHubClientBuilder`. Invoking +`.buildAsyncClient()` will create an `EventHubAsyncClient` and invoking `.buildClient()` will create an `EventHubClient`. + +The snippet below creates an asynchronous Event Hub client. ```java String connectionString = "<< CONNECTION STRING FOR THE EVENT HUBS NAMESPACE >>"; @@ -89,7 +151,7 @@ ClientSecretCredential credential = new ClientSecretCredential() .clientId("<< APPLICATION (CLIENT) ID >>") .tenantId("<< DIRECTORY (TENANT) ID >>"); -// The fully qualified host name for the Event Hubs namespace. This is likely to be similar to: +// The fully qualified domain name (FQDN) for the Event Hubs namespace. This is likely to be similar to: // {your-namespace}.servicebus.windows.net String host = "<< EVENT HUBS HOST >>" String eventHubName = "<< NAME OF THE EVENT HUB >>"; @@ -138,23 +200,28 @@ are well documented in [OASIS Advanced Messaging Queuing Protocol (AMQP) Version ### Publish events to an Event Hub -In order to publish events, you'll need to create an [`EventHubProducer`][source_eventhubconsumer]. Producers may be -dedicated to a specific partition, or allow the Event Hubs service to decide which partition events should be published -to. It is recommended to use automatic routing when the publishing of events needs to be highly available or when event -data should be distributed evenly among the partitions. In the our example, we will take advantage of automatic routing. +In order to publish events, you'll need to create an asynchronous +[`EventHubAsyncProducer`][source_eventhubasyncproducer] or a synchronous [`EventHubProducer`][source_eventhubproducer]. +Producers may be dedicated to a specific partition, or allow the Event Hubs service to decide which partition events +should be published to. It is recommended to use automatic routing when the publishing of events needs to be highly +available or when event data should be distributed evenly among the partitions. In the our example, we will take +advantage of automatic routing. -you can also use the send method to send multiple events using a single call. +#### Event Hub producer creation -#### Producer creation +With an existing [EventHubAsyncClient][source_eventhubasyncclient] or [EventHubClient][source_eventhubclient], +developers can create a producer by calling `createProducer()` or `createProducer(EventHubProducerOptions)`. If +`EventHubClient` is used, a synchronous `EventHubProducer` is created. If `EventHubAsyncClient` is used, an asynchronous +`EventHubAsyncProducer` is returned. -With an existing [EventHubAsyncClient][source_eventhubasyncclient], developers can create a producer by calling -`createProducer()` or `createProducer(EventHubProducerOptions)`. - -Creates a producer sends events to any partition, allowing Event Hubs service to route the event to an available -partition. +The snippet below creates a producer that sends events to any partition, allowing Event Hubs service to route the event +to an available partition. ```java -EventHubProducer producer = client.createProducer(); +EventHubAsyncClient client = new EventHubClientBuilder() + .connectionString("<< CONNECTION STRING FOR SPECIFIC EVENT HUB INSTANCE >>") + .buildAsyncClient(); +EventHubAsyncProducer producer = client.createProducer(); ``` To send events to a particular partition, set the optional parameter `partitionId` on @@ -185,18 +252,24 @@ producer.send(dataList, sendOptions).subscribe( ### Consume events from an Event Hub partition -In order to consume events, you'll need to create an `EventHubConsumer` for a specific partition and consumer group -combination. When an Event Hub is created, it starts with a default consumer group that can be used to get started. A -consumer also needs to specify where in the event stream to begin receiving events; in our example, we will focus on -reading new events as they are published. +In order to consume events, you'll need to create an `EventHubAsyncConsumer` or `EventHubConsumer` for a specific +partition and consumer group combination. When an Event Hub is created, it starts with a default consumer group that can +be used to get started. A consumer also needs to specify where in the event stream to begin receiving events; in our +example, we will focus on reading new events as they are published. -In the snippet below, we are creating a consumer that receives events from `partitionId` and only listens to newest -events that get pushed to the partition. Developers can begin receiving events by calling `.receive()` and subscribing -to the stream. +#### Consume events with EventHubAsyncConsumer + +In the snippet below, we are creating an asynchronous consumer that receives events from `partitionId` and only listens +to newest events that get pushed to the partition. Developers can begin receiving events by calling `.receive()` and +subscribing to the stream. ```java +EventHubAsyncClient client = new EventHubClientBuilder() + .connectionString("<< CONNECTION STRING FOR SPECIFIC EVENT HUB INSTANCE >>") + .buildAsyncClient(); + String partitionId = "<< EVENT HUB PARTITION ID >>" -EventHubConsumer consumer = client.createConsumer(EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME, partitionId, +EventHubAsyncConsumer consumer = client.createConsumer(EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME, partitionId, EventPosition.latest()); consumer.receive().subscribe(event -> { @@ -204,6 +277,30 @@ consumer.receive().subscribe(event -> { }); ``` +#### Consume events with EventHubConsumer + +Developers can create a synchronous consumer that returns events in batches using an `EventHubClient`. In the snippet +below, a consumer is created that starts reading events from the beginning of the partition's event stream. + +```java +EventHubClient client = new EventHubClientBuilder() + .connectionString("<< CONNECTION STRING FOR SPECIFIC EVENT HUB INSTANCE >>") + .buildClient(); + +String partitionId = "<< EVENT HUB PARTITION ID >>"; +EventHubConsumer consumer = client.createConsumer(EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME, partitionId, + EventPosition.earliest()); + +// Get the first 15 events in the stream, or as many events as can be received within 40 seconds. +IterableStream events = consumer.receive(15, Duration.ofSeconds(40)); +for (EventData event : events) { + // Process each event +} + +// Calling receive again returns the next 15 events in the stream, or as many as possible in 40 seconds. +IterableStream nextEvents = consumer.receive(15, Duration.ofSeconds(40)); +``` + ### Consume events using an Event Processor To consume events for all partitions of an Event Hub, you'll create an [`EventProcessor`][source_eventprocessor] for a @@ -216,15 +313,19 @@ logic needed to provide value while the processor holds responsibility for manag In our example, we will focus on building the [`EventProcessor`][source_eventprocessor], use the built-in [`InMemoryPartitionManager`][source_inmemorypartitionmanager], and a `PartitionProcessor` implementation that logs -events received and errors to console. +events received to console. ```java class Program { public static void main(String[] args) { - EventProcessor eventProcessor = new EventHubClientBuilder() + EventHubAsyncClient eventHubAsyncClient = new EventHubClientBuilder() .connectionString("<< CONNECTION STRING FOR THE EVENT HUB INSTANCE >>") - .consumerGroupName("<< CONSUMER GROUP NAME>>") - .partitionProcessorFactory(SimplePartitionProcessor::new) + .buildAsyncClient(); + + EventProcessor eventProcessor = new EventProcessorBuilder() + .consumerGroup("<< CONSUMER GROUP NAME>>") + .eventHubClient(eventHubAsyncClient) + .partitionProcessorFactory((SimplePartitionProcessor::new)) .partitionManager(new InMemoryPartitionManager()) .buildEventProcessor(); @@ -236,29 +337,14 @@ class Program { } } -class SimplePartitionProcessor implements PartitionProcessor { - SimplePartitionProcessor(PartitionContext partitionContext, CheckpointManager checkpointManager) { - } - - @Override - Mono initialize() { - return Mono.empty(); - } - - @Override - Mono processEvent(EventData eventData) { - System.out.printf("Event received. Sequence number: %s%n.", eventData.sequenceNumber()); - return Mono.empty(); - } - - @Override - void processError(Throwable throwable) { - System.err.println("Error received." + throwable.toString()); - } - +class SimplePartitionProcessor extends PartitionProcessor { + /** + * Processes the event data. + */ @Override - Mono close(CloseReason closeReason) { - return Mono.empty(); + public Mono processEvent(PartitionContext partitionContext, EventData eventData) { + System.out.println("Processing event with sequence number " + eventData.sequenceNumber()); + return partitionContext.updateCheckpoint(eventData); } } ``` @@ -380,9 +466,12 @@ Guidelines](./CONTRIBUTING.md) for more information. [source_errorcondition]: ../../core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/ErrorCondition.java [source_errorcontext]: ../../core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/ErrorContext.java [source_eventhubasyncclient]: ./src/main/java/com/azure/messaging/eventhubs/EventHubAsyncClient.java -[source_eventhubconsumer]: ./src/main/java/com/azure/messaging/eventhubs/EventHubProducer.java +[source_eventhubasyncproducer]: ./src/main/java/com/azure/messaging/eventhubs/EventHubAsyncProducer.java +[source_eventhubclient]: ./src/main/java/com/azure/messaging/eventhubs/EventHubClient.java [source_eventhubproduceroptions]: ./src/main/java/com/azure/messaging/eventhubs/models/EventHubProducerOptions.java [source_eventprocessor]: ./src/main/java/com/azure/messaging/eventhubs/EventProcessor.java [source_inmemorypartitionmanager]: ./src/main/java/com/azure/messaging/eventhubs/InMemoryPartitionManager.java [source_loglevels]: ../../core/azure-core/src/main/java/com/azure/core/util/logging/ClientLogger.java [source_partition_processor]: ./src/main/java/com/azure/messaging/eventhubs/PartitionProcessor.java + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/eventhubs/azure-messaging-eventhubs/README.png) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/pom.xml b/sdk/eventhubs/azure-messaging-eventhubs/pom.xml index 51c992af0178..03c86b00ef72 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/pom.xml +++ b/sdk/eventhubs/azure-messaging-eventhubs/pom.xml @@ -8,13 +8,13 @@ com.azure azure-client-sdk-parent - 1.3.0 + 1.4.0 ../../../pom.client.xml com.azure azure-messaging-eventhubs - 5.0.0-preview.3 + 5.0.0-preview.4 Microsoft Azure client library for Event Hubs Libraries built on Microsoft Azure Event Hubs @@ -33,16 +33,20 @@ HEAD + + com.azure.messaging.eventhubs + + com.azure azure-core - 1.0.0-preview.4 + 1.0.0-preview.5 com.azure azure-core-amqp - 1.0.0-preview.4 + 1.0.0-preview.5 com.microsoft.azure @@ -57,7 +61,7 @@ com.azure azure-core-test - 1.0.0-preview.4 + 1.0.0-preview.5 test diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/CheckpointManager.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/CheckpointManager.java deleted file mode 100644 index 3cfbb85f9597..000000000000 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/CheckpointManager.java +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.messaging.eventhubs; - -import com.azure.messaging.eventhubs.models.Checkpoint; -import com.azure.messaging.eventhubs.models.PartitionContext; - -import java.util.concurrent.atomic.AtomicReference; -import reactor.core.publisher.Mono; - -/** - * The checkpoint manager that clients should use to update checkpoints to track progress of events processed. Each - * instance of a {@link PartitionProcessor} will be provided with it's own instance of a CheckpointManager. - */ -public class CheckpointManager { - - private final PartitionContext partitionContext; - private final PartitionManager partitionManager; - private final AtomicReference eTag; - private final String ownerId; - - /** - * Creates a new checkpoint manager which {@link PartitionProcessor} can use to update checkpoints. - * - * @param ownerId The event processor identifier that is responsible for updating checkpoints. - * @param partitionContext The partition context providing necessary partition and event hub information for updating - * checkpoints. - * @param partitionManager The {@link PartitionManager} implementation that will be store the checkpoint information. - * @param eTag The last known ETag stored in {@link PartitionManager} for this partition. When the update checkpoint - * is called from this CheckpointManager, this ETag will be used to provide optimistic - * concurrency. - */ - CheckpointManager(String ownerId, PartitionContext partitionContext, PartitionManager partitionManager, - String eTag) { - this.ownerId = ownerId; - this.partitionContext = partitionContext; - this.partitionManager = partitionManager; - this.eTag = new AtomicReference<>(eTag); - } - - /** - * Updates the checkpoint for this partition using the event data. This will serve as the last known successfully - * processed event in this partition if the update is successful. - * - * @param eventData The event data to use for updating the checkpoint. - * @return a representation of deferred execution of this call. - */ - public Mono updateCheckpoint(EventData eventData) { - String previousETag = this.eTag.get(); - Checkpoint checkpoint = new Checkpoint() - .consumerGroupName(partitionContext.consumerGroupName()) - .eventHubName(partitionContext.eventHubName()) - .ownerId(ownerId) - .partitionId(partitionContext.partitionId()) - .sequenceNumber(eventData.sequenceNumber()) - .offset(eventData.offset()) - .eTag(previousETag); - return this.partitionManager.updateCheckpoint(checkpoint) - .map(eTag -> this.eTag.compareAndSet(previousETag, eTag)) - .then(); - } - - /** - * Updates a checkpoint using the given offset and sequence number. This will serve as the last known successfully - * processed event in this partition if the update is successful. - * - * @param sequenceNumber The sequence number to update the checkpoint. - * @param offset The offset to update the checkpoint. - * @return a representation of deferred execution of this call. - */ - public Mono updateCheckpoint(long sequenceNumber, String offset) { - String previousETag = this.eTag.get(); - Checkpoint checkpoint = new Checkpoint() - .consumerGroupName(partitionContext.consumerGroupName()) - .eventHubName(partitionContext.eventHubName()) - .ownerId(ownerId) - .partitionId(partitionContext.partitionId()) - .sequenceNumber(sequenceNumber) - .offset(offset) - .eTag(previousETag); - - return this.partitionManager.updateCheckpoint(checkpoint) - .map(eTag -> this.eTag.compareAndSet(previousETag, eTag)) - .then(); - } -} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/CloseReason.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/CloseReason.java index 6d942dfb9d51..fb9a44bcaaf8 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/CloseReason.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/CloseReason.java @@ -3,25 +3,27 @@ package com.azure.messaging.eventhubs; +import com.azure.messaging.eventhubs.models.PartitionContext; + /** * Enumeration of all possible reasons a {@link PartitionProcessor} may be closed. */ public enum CloseReason { /** * If another event processor instance stole the ownership of a partition, this reason will be provided to {@link - * PartitionProcessor#close(CloseReason)}. + * PartitionProcessor#close(PartitionContext, CloseReason)}. */ LOST_PARTITION_OWNERSHIP, /** * If the event processor is shutting down by calling {@link EventProcessor#stop()}, the {@link - * PartitionProcessor#close(CloseReason)} will be called with this reason. + * PartitionProcessor#close(PartitionContext, CloseReason)} will be called with this reason. */ EVENT_PROCESSOR_SHUTDOWN, /** - * If a non-retryable exception occured when receiving events from Event Hub, this reason will be provided when {@link - * PartitionProcessor#close(CloseReason)} is called. + * If a non-retryable exception occured when receiving events from Event Hub, this reason will be provided when + * {@link PartitionProcessor#close(PartitionContext, CloseReason)} is called. */ EVENT_HUB_EXCEPTION } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventData.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventData.java index 0d259a28fd56..0d7b37ef63af 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventData.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventData.java @@ -4,6 +4,7 @@ package com.azure.messaging.eventhubs; import com.azure.core.amqp.MessageConstant; +import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.messaging.Data; @@ -26,6 +27,7 @@ import static com.azure.core.amqp.MessageConstant.PARTITION_KEY_ANNOTATION_NAME; import static com.azure.core.amqp.MessageConstant.PUBLISHER_ANNOTATION_NAME; import static com.azure.core.amqp.MessageConstant.SEQUENCE_NUMBER_ANNOTATION_NAME; +import static java.nio.charset.StandardCharsets.UTF_8; /** * The data structure encapsulating the event being sent-to and received-from Event Hubs. Each Event Hub partition can @@ -36,8 +38,8 @@ * AMQP 1.0 specification * *

    - *
  1. {@link #properties()} - AMQPMessage.ApplicationProperties section
  2. - *
  3. {@link #body()} - if AMQPMessage.Body has Data section
  4. + *
  5. {@link #getProperties()} - AMQPMessage.ApplicationProperties section
  6. + *
  7. {@link #getBody()} - if AMQPMessage.Body has Data section
  8. *
* *

@@ -45,6 +47,7 @@ * types) and Data section is not supported. *

* + * @see EventHubProducer * @see EventHubAsyncProducer */ public class EventData implements Comparable { @@ -57,6 +60,7 @@ public class EventData implements Comparable { private final Map properties; private final ByteBuffer body; private final SystemProperties systemProperties; + private Context context; static { final Set properties = new HashSet<>(); @@ -75,7 +79,18 @@ public class EventData implements Comparable { * @param body The data to set for this event. */ public EventData(byte[] body) { - this(ByteBuffer.wrap(body)); + this(body, Context.NONE); + } + + /** + * Creates an event containing the {@code data}. + * + * @param body The data to set for this event. + * @param context A specified key-value pair of type {@link Context}. + * @throws NullPointerException if {@code body} or if {@code context} is {@code null}. + */ + public EventData(byte[] body, Context context) { + this(ByteBuffer.wrap(body), context); } /** @@ -85,20 +100,44 @@ public EventData(byte[] body) { * @throws NullPointerException if {@code body} is {@code null}. */ public EventData(ByteBuffer body) { - Objects.requireNonNull(body); + this(body, Context.NONE); + } + + /** + * Creates an event containing the {@code body}. + * + * @param body The data to set for this event. + * @param context A specified key-value pair of type {@link Context}. + * @throws NullPointerException if {@code body} or if {@code context} is {@code null}. + */ + public EventData(ByteBuffer body, Context context) { + Objects.requireNonNull(body, "'body' cannot be null."); + Objects.requireNonNull(body, "'context' cannot be null."); this.body = body; this.properties = new HashMap<>(); - this.systemProperties = new SystemProperties(Collections.emptyMap()); + this.systemProperties = new SystemProperties(); + this.context = context; + } + + /** + * Creates an event by encoding the {@code body} using UTF-8 charset. + * + * @param body The string that will be UTF-8 encoded to create an event. + */ + public EventData(String body) { + this(body.getBytes(UTF_8)); } /* - * Creates an event from a message + * Creates an event from a proton-j message + * + * @throws IllegalStateException if required the system properties, enqueued time, offset, or sequence number are + * not found in the message. + * @throws NullPointerException if {@code message} is null. */ EventData(Message message) { - if (message == null) { - throw new IllegalArgumentException("'message' cannot be null"); - } + Objects.requireNonNull(message, "'message' cannot be null."); final Map messageAnnotations = message.getMessageAnnotations().getValue(); final HashMap receiveProperties = new HashMap<>(); @@ -123,6 +162,7 @@ public EventData(ByteBuffer body) { addMapEntry(receiveProperties, MessageConstant.REPLY_TO_GROUP_ID, message.getReplyToGroupId()); } + this.context = Context.NONE; this.systemProperties = new SystemProperties(receiveProperties); this.properties = message.getApplicationProperties() == null ? new HashMap<>() @@ -148,8 +188,8 @@ public EventData(ByteBuffer body) { * the {@code key} exists in the map, its existing value is overwritten. * *

- * A common use case for {@link #properties()} is to associate serialization hints for the {@link #body()} as an aid - * to consumers who wish to deserialize the binary data. + * A common use case for {@link #getProperties()} is to associate serialization hints for the {@link #getBody()} as + * an aid to consumers who wish to deserialize the binary data. *

* *

@@ -164,42 +204,60 @@ public EventData(ByteBuffer body) { * @throws NullPointerException if {@code key} or {@code value} is null. */ public EventData addProperty(String key, Object value) { - Objects.requireNonNull(key); - Objects.requireNonNull(value); + Objects.requireNonNull(key, "'key' cannot be null."); + Objects.requireNonNull(value, "'value' cannot be null."); properties.put(key, value); return this; } + /** + * Adds a new key value pair to the existing context on Event Data. + * + * @param key The key for this context object + * @param value The value for this context object. + * @return The updated EventData object. + * @throws NullPointerException if {@code key} or {@code value} is null. + */ + public EventData addContext(String key, Object value) { + Objects.requireNonNull(key, "The 'key' parameter cannot be null."); + Objects.requireNonNull(value, "The 'value' parameter cannot be null."); + this.context = context.addData(key, value); + return this; + } + /** * The set of free-form event properties which may be used for passing metadata associated with the event with the * event body during Event Hubs operations. * *

- * A common use case for {@code properties()} is to associate serialization hints for the {@link #body()} as an aid - * to consumers who wish to deserialize the binary data. - *

- * - *

- * Adding serialization hint using {@link #addProperty(String, Object)} + * A common use case for {@code properties()} is to associate serialization hints for the {@link #getBody()} as an + * aid to consumers who wish to deserialize the binary data. See {@link #addProperty(String, Object)} for a sample. *

* - * {@codesnippet com.azure.messaging.eventhubs.eventdata.addProperty#string-object} - * * @return Application properties associated with this {@link EventData}. */ - public Map properties() { + public Map getProperties() { return properties; } + /** + * A specified key-value pair of type {@link Context} to set additional information on the event. + * + * @return the {@link Context} object set on the event + */ + public Context getContext() { + return context; + } + /** * Properties that are populated by EventHubService. As these are populated by Service, they are only present on a * received EventData. * * @return an encapsulation of all SystemProperties appended by EventHubs service into EventData. {@code null} if - * the {@link EventData} is not received and is created by the public constructors. + * the {@link EventData} is not received and is created by the public constructors. */ - public Map systemProperties() { + public Map getSystemProperties() { return systemProperties; } @@ -208,54 +266,65 @@ public Map systemProperties() { * *

* If the means for deserializing the raw data is not apparent to consumers, a common technique is to make use of - * {@link #properties()} when creating the event, to associate serialization hints as an aid to consumers who wish - * to deserialize the binary data. + * {@link #getProperties()} when creating the event, to associate serialization hints as an aid to consumers who + * wish to deserialize the binary data. *

* * @return ByteBuffer representing the data. */ - public ByteBuffer body() { + public ByteBuffer getBody() { return body.duplicate(); } + /** + * Returns event data as UTF-8 decoded string. + * + * @return UTF-8 decoded string representation of the event data. + */ + public String getBodyAsString() { + return UTF_8.decode(body).toString(); + } + /** * Gets the offset of the event when it was received from the associated Event Hub partition. * - * @return The offset within the Event Hub partition. + * @return The offset within the Event Hub partition of the received event. {@code null} if the EventData was not + * received from Event Hub service. */ - public String offset() { - return systemProperties.offset(); + public Long getOffset() { + return systemProperties.getOffset(); } /** * Gets a partition key used for message partitioning. If it exists, this value was used to compute a hash to select * a partition to send the message to. * - * @return A partition key for this Event Data. + * @return A partition key for this Event Data. {@code null} if the EventData was not received from Event Hub + * service or there was no partition key set when the event was sent to the Event Hub. */ - public String partitionKey() { - return systemProperties.partitionKey(); + public String getPartitionKey() { + return systemProperties.getPartitionKey(); } /** * Gets the instant, in UTC, of when the event was enqueued in the Event Hub partition. * - * @return The instant, in UTC, this was enqueued in the Event Hub partition. + * @return The instant, in UTC, this was enqueued in the Event Hub partition. {@code null} if the EventData was not + * received from Event Hub service. */ - public Instant enqueuedTime() { - return systemProperties.enqueuedTime(); + public Instant getEnqueuedTime() { + return systemProperties.getEnqueuedTime(); } /** * Gets the sequence number assigned to the event when it was enqueued in the associated Event Hub partition. This * is unique for every message received in the Event Hub partition. * - * @return Sequence number for this event. - * @throws IllegalStateException if {@link #systemProperties()} does not contain the sequence number in a - * retrieved event. + * @return The sequence number for this event. {@code null} if the EventData was not received from Event Hub + * service. */ - public long sequenceNumber() { - return systemProperties.sequenceNumber(); + public Long getSequenceNumber() { + return systemProperties.getSequenceNumber(); } private void addMapEntry(Map map, MessageConstant key, Object content) { @@ -272,8 +341,8 @@ private void addMapEntry(Map map, MessageConstant key, Object co @Override public int compareTo(EventData other) { return Long.compare( - this.sequenceNumber(), - other.sequenceNumber() + this.getSequenceNumber(), + other.getSequenceNumber() ); } @@ -306,9 +375,43 @@ public int hashCode() { */ private static class SystemProperties extends HashMap { private static final long serialVersionUID = -2827050124966993723L; + private final Long offset; + private final String partitionKey; + private final Instant enqueuedTime; + private final Long sequenceNumber; + + SystemProperties() { + super(); + offset = null; + partitionKey = null; + enqueuedTime = null; + sequenceNumber = null; + } SystemProperties(final Map map) { - super(Collections.unmodifiableMap(map)); + super(map); + this.partitionKey = removeSystemProperty(PARTITION_KEY_ANNOTATION_NAME.getValue()); + + final String offset = removeSystemProperty(OFFSET_ANNOTATION_NAME.getValue()); + if (offset == null) { + throw new IllegalStateException(String.format(Locale.US, + "offset: %s should always be in map.", OFFSET_ANNOTATION_NAME.getValue())); + } + this.offset = Long.valueOf(offset); + + final Date enqueuedTimeValue = removeSystemProperty(ENQUEUED_TIME_UTC_ANNOTATION_NAME.getValue()); + if (enqueuedTimeValue == null) { + throw new IllegalStateException(String.format(Locale.US, + "enqueuedTime: %s should always be in map.", ENQUEUED_TIME_UTC_ANNOTATION_NAME.getValue())); + } + this.enqueuedTime = enqueuedTimeValue.toInstant(); + + final Long sequenceNumber = removeSystemProperty(SEQUENCE_NUMBER_ANNOTATION_NAME.getValue()); + if (sequenceNumber == null) { + throw new IllegalStateException(String.format(Locale.US, + "sequenceNumber: %s should always be in map.", SEQUENCE_NUMBER_ANNOTATION_NAME.getValue())); + } + this.sequenceNumber = sequenceNumber; } /** @@ -316,8 +419,8 @@ private static class SystemProperties extends HashMap { * * @return The offset within the Event Hubs stream. */ - private String offset() { - return this.getSystemProperty(OFFSET_ANNOTATION_NAME.getValue()); + private Long getOffset() { + return offset; } /** @@ -326,8 +429,8 @@ private String offset() { * * @return A partition key for this Event Data. */ - private String partitionKey() { - return this.getSystemProperty(PARTITION_KEY_ANNOTATION_NAME.getValue()); + private String getPartitionKey() { + return partitionKey; } /** @@ -335,9 +438,8 @@ private String partitionKey() { * * @return The time this was enqueued in the service. */ - private Instant enqueuedTime() { - final Date enqueuedTimeValue = this.getSystemProperty(ENQUEUED_TIME_UTC_ANNOTATION_NAME.getValue()); - return enqueuedTimeValue != null ? enqueuedTimeValue.toInstant() : null; + private Instant getEnqueuedTime() { + return enqueuedTime; } /** @@ -345,23 +447,17 @@ private Instant enqueuedTime() { * Event Hub. * * @return Sequence number for this event. - * @throws IllegalStateException if {@link SystemProperties} does not contain the sequence number in a - * retrieved event. + * @throws IllegalStateException if {@link SystemProperties} does not contain the sequence number in a retrieved + * event. */ - private long sequenceNumber() { - final Long sequenceNumber = this.getSystemProperty(SEQUENCE_NUMBER_ANNOTATION_NAME.getValue()); - - if (sequenceNumber == null) { - throw new IllegalStateException(String.format(Locale.US, "sequenceNumber: %s should always be in map.", SEQUENCE_NUMBER_ANNOTATION_NAME.getValue())); - } - + private Long getSequenceNumber() { return sequenceNumber; } @SuppressWarnings("unchecked") - private T getSystemProperty(final String key) { + private T removeSystemProperty(final String key) { if (this.containsKey(key)) { - return (T) (this.get(key)); + return (T) (this.remove(key)); } return null; diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventDataBatch.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventDataBatch.java index 100a6df43caa..8968ac30634d 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventDataBatch.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventDataBatch.java @@ -9,7 +9,6 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.implementation.AmqpConstants; import com.azure.messaging.eventhubs.implementation.ErrorContextProvider; -import com.azure.messaging.eventhubs.models.BatchOptions; import org.apache.qpid.proton.Proton; import org.apache.qpid.proton.amqp.Binary; import org.apache.qpid.proton.amqp.Symbol; @@ -26,12 +25,13 @@ import java.util.Objects; /** - * A class for aggregating EventData into a single, size-limited, batch that will be treated as a single message when - * sent to the Azure Event Hubs service. + * A class for aggregating EventData into a single, size-limited, batch. It is treated as a single message when sent to + * the Azure Event Hubs service. * + * @see EventHubProducer#createBatch() * @see EventHubAsyncProducer#createBatch() - * @see EventHubAsyncProducer#createBatch(BatchOptions) - * @see EventHubAsyncProducer See EventHubAsyncProducer for examples. + * @see EventHubProducer See EventHubProducer for examples using the synchronous producer. + * @see EventHubAsyncProducer See EventHubAsyncProducer for examples using the asynchronous producer. */ public final class EventDataBatch { private final ClientLogger logger = new ClientLogger(EventDataBatch.class); @@ -75,10 +75,10 @@ public int getSizeInBytes() { * * @param eventData The {@link EventData} to add to the batch. * @return {@code true} if the event could be added to the batch; {@code false} if the event was too large to fit in - * the batch. + * the batch. * @throws IllegalArgumentException if {@code eventData} is {@code null}. * @throws AmqpException if {@code eventData} is larger than the maximum size of the {@link - * EventDataBatch}. + * EventDataBatch}. */ public boolean tryAdd(final EventData eventData) { if (eventData == null) { @@ -90,7 +90,8 @@ public boolean tryAdd(final EventData eventData) { size = getSize(eventData, events.isEmpty()); } catch (BufferOverflowException exception) { throw logger.logExceptionAsWarning(new AmqpException(false, ErrorCondition.LINK_PAYLOAD_SIZE_EXCEEDED, - String.format(Locale.US, "Size of the payload exceeded maximum message size: %s kb", maxMessageSize / 1024), + String.format(Locale.US, "Size of the payload exceeded maximum message size: %s kb", + maxMessageSize / 1024), contextProvider.getErrorContext())); } @@ -115,7 +116,7 @@ String getPartitionKey() { } private int getSize(final EventData eventData, final boolean isFirst) { - Objects.requireNonNull(eventData); + Objects.requireNonNull(eventData, "'eventData' cannot be null."); final Message amqpMessage = createAmqpMessage(eventData, partitionKey); int eventSize = amqpMessage.encode(this.eventBytes, 0, maxMessageSize); // actual encoded bytes size @@ -139,13 +140,13 @@ private int getSize(final EventData eventData, final boolean isFirst) { private Message createAmqpMessage(EventData event, String partitionKey) { final Message message = Proton.message(); - if (event.properties() != null && !event.properties().isEmpty()) { - final ApplicationProperties applicationProperties = new ApplicationProperties(event.properties()); + if (event.getProperties() != null && !event.getProperties().isEmpty()) { + final ApplicationProperties applicationProperties = new ApplicationProperties(event.getProperties()); message.setApplicationProperties(applicationProperties); } - if (event.systemProperties() != null) { - event.systemProperties().forEach((key, value) -> { + if (event.getSystemProperties() != null) { + event.getSystemProperties().forEach((key, value) -> { if (EventData.RESERVED_SYSTEM_PROPERTIES.contains(key)) { return; } @@ -194,7 +195,8 @@ private Message createAmqpMessage(EventData event, String partitionKey) { message.setReplyToGroupId((String) value); break; default: - throw logger.logExceptionAsWarning(new IllegalArgumentException(String.format(Locale.US, "Property is not a recognized reserved property name: %s", key))); + throw logger.logExceptionAsWarning(new IllegalArgumentException(String.format(Locale.US, + "Property is not a recognized reserved property name: %s", key))); } } else { final MessageAnnotations messageAnnotations = (message.getMessageAnnotations() == null) @@ -214,8 +216,8 @@ private Message createAmqpMessage(EventData event, String partitionKey) { message.setMessageAnnotations(messageAnnotations); } - if (event.body() != null) { - message.setBody(new Data(Binary.create(event.body()))); + if (event.getBody() != null) { + message.setBody(new Data(Binary.create(event.getBody()))); } return message; diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncClient.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncClient.java index b071a586319d..66ea51e0e818 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncClient.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncClient.java @@ -8,6 +8,7 @@ import com.azure.core.amqp.exception.AmqpException; import com.azure.core.amqp.exception.ErrorContext; import com.azure.core.amqp.implementation.RetryUtil; +import com.azure.core.amqp.implementation.TracerProvider; import com.azure.core.implementation.annotation.ReturnType; import com.azure.core.implementation.annotation.ServiceClient; import com.azure.core.implementation.annotation.ServiceMethod; @@ -45,19 +46,24 @@ import static com.azure.core.amqp.MessageConstant.SEQUENCE_NUMBER_ANNOTATION_NAME; /** - * The main point of interaction with Azure Event Hubs, the client offers a connection to a specific Event Hub within - * the Event Hubs namespace and offers operations for sending event data, receiving events, and inspecting the connected - * Event Hub. + * An asynchronous client that is the main point of interaction with Azure Event Hubs. It connects to a + * specific Event Hub and allows operations for sending event data, receiving data, and inspecting the Event Hub's + * metadata. * - *

Creating an {@link EventHubAsyncClient} using Event Hubs namespace connection string

+ *

+ * Instantiated through {@link EventHubClientBuilder}. + *

* - * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncclient.connectionString#string-string} + *

Creating an {@link EventHubAsyncClient} using an Event Hubs namespace connection string

* - *

Creating an {@link EventHubAsyncClient} using Event Hub instance connection string

+ * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncclient.instantiation#string-string} * - * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncclient.connectionstring#string} + *

Creating an {@link EventHubAsyncClient} using an Event Hub instance connection string

+ * + * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncclient.instantiation#string} * * @see EventHubClientBuilder + * @see EventHubClient See EventHubClient to communicate with an Event Hub using a synchronous client. * @see About Azure Event Hubs */ @ServiceClient(builder = EventHubClientBuilder.class, isAsync = true) @@ -78,14 +84,18 @@ public class EventHubAsyncClient implements Closeable { private final String eventHubName; private final EventHubProducerOptions defaultProducerOptions; private final EventHubConsumerOptions defaultConsumerOptions; + private final TracerProvider tracerProvider; - EventHubAsyncClient(ConnectionOptions connectionOptions, ReactorProvider provider, ReactorHandlerProvider handlerProvider) { - Objects.requireNonNull(connectionOptions); - Objects.requireNonNull(provider); - Objects.requireNonNull(handlerProvider); + EventHubAsyncClient(ConnectionOptions connectionOptions, ReactorProvider provider, + ReactorHandlerProvider handlerProvider, TracerProvider tracerProvider) { + Objects.requireNonNull(connectionOptions, "'connectionOptions' cannot be null."); + Objects.requireNonNull(provider, "'provider' cannot be null."); + Objects.requireNonNull(handlerProvider, "'handlerProvider' cannot be null."); + Objects.requireNonNull(tracerProvider, "'tracerProvider' cannot be null."); this.connectionOptions = connectionOptions; - this.eventHubName = connectionOptions.eventHubName(); + this.tracerProvider = tracerProvider; + this.eventHubName = connectionOptions.getEventHubName(); this.connectionId = StringUtil.getRandomString("MF"); this.connectionMono = Mono.fromCallable(() -> { return (EventHubConnection) new ReactorConnection(connectionId, connectionOptions, provider, @@ -94,10 +104,10 @@ public class EventHubAsyncClient implements Closeable { .cache(); this.defaultProducerOptions = new EventHubProducerOptions() - .retry(connectionOptions.retry()); + .setRetry(connectionOptions.getRetry()); this.defaultConsumerOptions = new EventHubConsumerOptions() - .retry(connectionOptions.retry()) - .scheduler(connectionOptions.scheduler()); + .setRetry(connectionOptions.getRetry()) + .setScheduler(connectionOptions.getScheduler()); } /** @@ -107,7 +117,9 @@ public class EventHubAsyncClient implements Closeable { */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getProperties() { - return connectionMono.flatMap(connection -> connection.getManagementNode().flatMap(EventHubManagementNode::getEventHubProperties)); + return connectionMono + .flatMap(connection -> connection + .getManagementNode().flatMap(EventHubManagementNode::getEventHubProperties)); } /** @@ -117,7 +129,7 @@ public Mono getProperties() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public Flux getPartitionIds() { - return getProperties().flatMapMany(properties -> Flux.fromArray(properties.partitionIds())); + return getProperties().flatMapMany(properties -> Flux.fromArray(properties.getPartitionIds())); } /** @@ -147,7 +159,7 @@ public EventHubAsyncProducer createProducer() { /** * Creates an Event Hub producer responsible for transmitting {@link EventData} to the Event Hub, grouped together - * in batches. If {@link EventHubProducerOptions#partitionId() options.partitionId()} is not {@code null}, the + * in batches. If {@link EventHubProducerOptions#getPartitionId() options.partitionId()} is not {@code null}, the * events are routed to that specific partition. Otherwise, events are automatically routed to an available * partition. * @@ -156,22 +168,22 @@ public EventHubAsyncProducer createProducer() { * @throws NullPointerException if {@code options} is {@code null}. */ public EventHubAsyncProducer createProducer(EventHubProducerOptions options) { - Objects.requireNonNull(options); + Objects.requireNonNull(options, "'options' cannot be null."); final EventHubProducerOptions clonedOptions = options.clone(); - if (clonedOptions.retry() == null) { - clonedOptions.retry(connectionOptions.retry()); + if (clonedOptions.getRetry() == null) { + clonedOptions.setRetry(connectionOptions.getRetry()); } final String entityPath; final String linkName; - if (ImplUtils.isNullOrEmpty(options.partitionId())) { + if (ImplUtils.isNullOrEmpty(options.getPartitionId())) { entityPath = eventHubName; linkName = StringUtil.getRandomString("EC"); } else { - entityPath = String.format(Locale.US, SENDER_ENTITY_PATH_FORMAT, eventHubName, options.partitionId()); + entityPath = String.format(Locale.US, SENDER_ENTITY_PATH_FORMAT, eventHubName, options.getPartitionId()); linkName = StringUtil.getRandomString("PS"); } @@ -179,13 +191,13 @@ public EventHubAsyncProducer createProducer(EventHubProducerOptions options) { .flatMap(connection -> connection.createSession(entityPath)) .flatMap(session -> { logger.verbose("Creating producer for {}", entityPath); - final RetryPolicy retryPolicy = RetryUtil.getRetryPolicy(clonedOptions.retry()); + final RetryPolicy retryPolicy = RetryUtil.getRetryPolicy(clonedOptions.getRetry()); - return session.createProducer(linkName, entityPath, clonedOptions.retry().tryTimeout(), retryPolicy) - .cast(AmqpSendLink.class); + return session.createProducer(linkName, entityPath, clonedOptions.getRetry().getTryTimeout(), + retryPolicy).cast(AmqpSendLink.class); }); - return new EventHubAsyncProducer(amqpLinkMono, clonedOptions); + return new EventHubAsyncProducer(amqpLinkMono, clonedOptions, tracerProvider); } /** @@ -196,15 +208,15 @@ public EventHubAsyncProducer createProducer(EventHubProducerOptions options) { * reading events from the partition. These non-exclusive consumers are sometimes referred to as "Non-epoch * Consumers". * - * @param consumerGroup The name of the consumer group this consumer is associated with. Events are read in - * the context of this group. The name of the consumer group that is created by default is {@link - * #DEFAULT_CONSUMER_GROUP_NAME "$Default"}. + * @param consumerGroup The name of the consumer group this consumer is associated with. Events are read in the + * context of this group. The name of the consumer group that is created by default is {@link + * #DEFAULT_CONSUMER_GROUP_NAME "$Default"}. * @param partitionId The identifier of the Event Hub partition. * @param eventPosition The position within the partition where the consumer should begin reading events. * @return A new {@link EventHubAsyncConsumer} that receives events from the partition at the given position. * @throws NullPointerException If {@code eventPosition}, or {@code options} is {@code null}. - * @throws IllegalArgumentException If {@code consumerGroup} or {@code partitionId} is {@code null} or an - * empty string. + * @throws IllegalArgumentException If {@code consumerGroup} or {@code partitionId} is {@code null} or an empty + * string. */ public EventHubAsyncConsumer createConsumer(String consumerGroup, String partitionId, EventPosition eventPosition) { return createConsumer(consumerGroup, partitionId, eventPosition, defaultConsumerOptions); @@ -224,58 +236,58 @@ public EventHubAsyncConsumer createConsumer(String consumerGroup, String partiti * Consumers." * * Designating a consumer as exclusive may be specified in the {@code options}, by setting {@link - * EventHubConsumerOptions#ownerLevel(Long)} to a non-null value. By default, consumers are created as + * EventHubConsumerOptions#setOwnerLevel(Long)} to a non-null value. By default, consumers are created as * non-exclusive. *

* - * @param consumerGroup The name of the consumer group this consumer is associated with. Events are read in - * the context of this group. The name of the consumer group that is created by default is {@link - * #DEFAULT_CONSUMER_GROUP_NAME "$Default"}. + * @param consumerGroup The name of the consumer group this consumer is associated with. Events are read in the + * context of this group. The name of the consumer group that is created by default is {@link + * #DEFAULT_CONSUMER_GROUP_NAME "$Default"}. * @param partitionId The identifier of the Event Hub partition from which events will be received. * @param eventPosition The position within the partition where the consumer should begin reading events. * @param options The set of options to apply when creating the consumer. * @return An new {@link EventHubAsyncConsumer} that receives events from the partition with all configured {@link - * EventHubConsumerOptions}. - * @throws NullPointerException If {@code eventPosition}, or {@code options} is {@code null}. - * @throws IllegalArgumentException If {@code consumerGroup} or {@code partitionId} is {@code null} or an - * empty string. + * EventHubConsumerOptions}. + * @throws NullPointerException If {@code eventPosition}, {@code consumerGroup}, {@code partitionId}, or + * {@code options} is {@code null}. + * @throws IllegalArgumentException If {@code consumerGroup} or {@code partitionId} is an empty string. */ public EventHubAsyncConsumer createConsumer(String consumerGroup, String partitionId, EventPosition eventPosition, - EventHubConsumerOptions options) { - Objects.requireNonNull(eventPosition); - Objects.requireNonNull(options); - - if (ImplUtils.isNullOrEmpty(consumerGroup)) { - throw new IllegalArgumentException("'consumerGroup' cannot be null or empty."); - } - if (ImplUtils.isNullOrEmpty(partitionId)) { - throw new IllegalArgumentException("'partitionId' cannot be null or empty."); + EventHubConsumerOptions options) { + Objects.requireNonNull(eventPosition, "'eventPosition' cannot be null."); + Objects.requireNonNull(options, "'options' cannot be null."); + Objects.requireNonNull(consumerGroup, "'consumerGroup' cannot be null."); + Objects.requireNonNull(partitionId, "'partitionId' cannot be null."); + + if (consumerGroup.isEmpty()) { + throw logger.logExceptionAsError( + new IllegalArgumentException("'consumerGroup' cannot be an empty string.")); + } else if (partitionId.isEmpty()) { + throw logger.logExceptionAsError( + new IllegalArgumentException("'partitionId' cannot be an empty string.")); } final EventHubConsumerOptions clonedOptions = options.clone(); - if (clonedOptions.scheduler() == null) { - clonedOptions.scheduler(connectionOptions.scheduler()); + if (clonedOptions.getScheduler() == null) { + clonedOptions.setScheduler(connectionOptions.getScheduler()); } - if (clonedOptions.retry() == null) { - clonedOptions.retry(connectionOptions.retry()); + if (clonedOptions.getRetry() == null) { + clonedOptions.setRetry(connectionOptions.getRetry()); } final String linkName = StringUtil.getRandomString("PR"); final String entityPath = String.format(Locale.US, RECEIVER_ENTITY_PATH_FORMAT, eventHubName, consumerGroup, partitionId); - final Mono receiveLinkMono = connectionMono.flatMap(connection -> { - return connection.createSession(entityPath).cast(EventHubSession.class); - }).flatMap(session -> { - logger.verbose("Creating consumer for path: {}", entityPath); + final Mono receiveLinkMono = connectionMono.flatMap(connection -> + connection.createSession(entityPath).cast(EventHubSession.class)).flatMap(session -> { + logger.verbose("Creating consumer for path: {}", entityPath); + final RetryPolicy retryPolicy = RetryUtil.getRetryPolicy(clonedOptions.getRetry()); - logger.verbose("Creating producer for {}", entityPath); - final RetryPolicy retryPolicy = RetryUtil.getRetryPolicy(clonedOptions.retry()); - - return session.createConsumer(linkName, entityPath, getExpression(eventPosition), - clonedOptions.retry().tryTimeout(), retryPolicy, options.ownerLevel(), options.identifier()) - .cast(AmqpReceiveLink.class); - }); + return session.createConsumer(linkName, entityPath, getExpression(eventPosition), + clonedOptions.getRetry().getTryTimeout(), retryPolicy, options.getOwnerLevel(), + options.getIdentifier()).cast(AmqpReceiveLink.class); + }); return new EventHubAsyncConsumer(receiveLinkMono, clonedOptions); } @@ -288,13 +300,14 @@ public EventHubAsyncConsumer createConsumer(String consumerGroup, String partiti public void close() { if (hasConnection.getAndSet(false)) { try { - final AmqpConnection connection = connectionMono.block(connectionOptions.retry().tryTimeout()); + final AmqpConnection connection = connectionMono.block(connectionOptions.getRetry().getTryTimeout()); if (connection != null) { connection.close(); } } catch (IOException exception) { - throw new AmqpException(false, "Unable to close connection to service", exception, - new ErrorContext(connectionOptions.host())); + throw logger.logExceptionAsError( + new AmqpException(false, "Unable to close connection to service", exception, + new ErrorContext(connectionOptions.getHost()))); } } } @@ -303,28 +316,43 @@ private static String getExpression(EventPosition eventPosition) { final String isInclusiveFlag = eventPosition.isInclusive() ? "=" : ""; // order of preference - if (eventPosition.offset() != null) { - return String.format(AmqpConstants.AMQP_ANNOTATION_FORMAT, OFFSET_ANNOTATION_NAME.getValue(), isInclusiveFlag, eventPosition.offset()); + if (eventPosition.getOffset() != null) { + return String.format( + AmqpConstants.AMQP_ANNOTATION_FORMAT, OFFSET_ANNOTATION_NAME.getValue(), + isInclusiveFlag, + eventPosition.getOffset()); } - if (eventPosition.sequenceNumber() != null) { - return String.format(AmqpConstants.AMQP_ANNOTATION_FORMAT, SEQUENCE_NUMBER_ANNOTATION_NAME.getValue(), isInclusiveFlag, eventPosition.sequenceNumber()); + if (eventPosition.getSequenceNumber() != null) { + return String.format( + AmqpConstants.AMQP_ANNOTATION_FORMAT, + SEQUENCE_NUMBER_ANNOTATION_NAME.getValue(), + isInclusiveFlag, + eventPosition.getSequenceNumber()); } - if (eventPosition.enqueuedDateTime() != null) { + if (eventPosition.getEnqueuedDateTime() != null) { String ms; try { - ms = Long.toString(eventPosition.enqueuedDateTime().toEpochMilli()); + ms = Long.toString(eventPosition.getEnqueuedDateTime().toEpochMilli()); } catch (ArithmeticException ex) { ms = Long.toString(Long.MAX_VALUE); } - return String.format(AmqpConstants.AMQP_ANNOTATION_FORMAT, ENQUEUED_TIME_UTC_ANNOTATION_NAME.getValue(), isInclusiveFlag, ms); + return String.format( + AmqpConstants.AMQP_ANNOTATION_FORMAT, + ENQUEUED_TIME_UTC_ANNOTATION_NAME.getValue(), + isInclusiveFlag, + ms); } throw new IllegalArgumentException("No starting position was set."); } + String getEventHubName() { + return this.eventHubName; + } + private static class ResponseMapper implements AmqpResponseMapper { @Override public EventHubProperties toEventHubProperties(Map amqpBody) { diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncConsumer.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncConsumer.java index d591a7f1612c..29fdbb333983 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncConsumer.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncConsumer.java @@ -24,11 +24,11 @@ * consumer group. * *
    - *
  • If {@link EventHubAsyncConsumer} is created where {@link EventHubConsumerOptions#ownerLevel()} has a + *
  • If {@link EventHubAsyncConsumer} is created where {@link EventHubConsumerOptions#getOwnerLevel()} has a * value, then Event Hubs service will guarantee only one active consumer exists per partitionId and consumer group * combination. This consumer is sometimes referred to as an "Epoch Consumer."
  • *
  • Multiple consumers per partitionId and consumer group combination can be created by not setting - * {@link EventHubConsumerOptions#ownerLevel()} when creating consumers. This non-exclusive consumer is sometimes + * {@link EventHubConsumerOptions#getOwnerLevel()} when creating consumers. This non-exclusive consumer is sometimes * referred to as a "Non-Epoch Consumer."
  • *
* @@ -48,11 +48,12 @@ */ @Immutable public class EventHubAsyncConsumer implements Closeable { - private static final AtomicReferenceFieldUpdater RECEIVE_LINK_FIELD_UPDATER = + private static final AtomicReferenceFieldUpdater + RECEIVE_LINK_FIELD_UPDATER = AtomicReferenceFieldUpdater.newUpdater(EventHubAsyncConsumer.class, AmqpReceiveLink.class, "receiveLink"); // We don't want to dump too many credits on the link at once. It's easy enough to ask for more. - private static final int MINIMUM_REQUEST = 1; + private static final int MINIMUM_REQUEST = 0; private static final int MAXIMUM_REQUEST = 100; private final AtomicInteger creditsToRequest = new AtomicInteger(1); @@ -64,13 +65,13 @@ public class EventHubAsyncConsumer implements Closeable { private volatile AmqpReceiveLink receiveLink; EventHubAsyncConsumer(Mono receiveLinkMono, EventHubConsumerOptions options) { - this.emitterProcessor = EmitterProcessor.create(options.prefetchCount(), false); + this.emitterProcessor = EmitterProcessor.create(options.getPrefetchCount(), false); // Caching the created link so we don't invoke another link creation. this.messageFlux = receiveLinkMono.cache().flatMapMany(link -> { if (RECEIVE_LINK_FIELD_UPDATER.compareAndSet(this, null, link)) { - logger.info("Created AMQP receive link. Initializing prefetch credits: {}", options.prefetchCount()); - link.addCredits(options.prefetchCount()); + logger.info("Created AMQP receive link. Initializing prefetch credits: {}", options.getPrefetchCount()); + link.addCredits(options.getPrefetchCount()); link.setEmptyCreditListener(() -> { if (emitterProcessor.hasDownstreams()) { @@ -125,7 +126,8 @@ public class EventHubAsyncConsumer implements Closeable { ? MAXIMUM_REQUEST : (int) request; - logger.verbose("Back pressure request. Old value: {}. New value: {}", creditsToRequest.get(), newRequest); + logger.verbose("Back pressure request. Old value: {}. New value: {}", creditsToRequest.get(), + newRequest); creditsToRequest.set(newRequest); }); } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncProducer.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncProducer.java index e4626ddf7045..99c1b4543041 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncProducer.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncProducer.java @@ -5,8 +5,11 @@ import com.azure.core.amqp.exception.AmqpException; import com.azure.core.amqp.exception.ErrorCondition; +import com.azure.core.amqp.implementation.TracerProvider; import com.azure.core.implementation.annotation.Immutable; +import com.azure.core.implementation.tracing.ProcessKind; import com.azure.core.implementation.util.ImplUtils; +import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.implementation.AmqpSendLink; import com.azure.messaging.eventhubs.implementation.ErrorContextProvider; @@ -17,6 +20,7 @@ import org.apache.qpid.proton.message.Message; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import reactor.core.publisher.Signal; import java.io.Closeable; import java.io.IOException; @@ -25,14 +29,21 @@ import java.util.List; import java.util.Locale; import java.util.Objects; +import java.util.Optional; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; import java.util.function.BiConsumer; import java.util.function.BinaryOperator; import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Collector; +import static com.azure.core.implementation.tracing.Tracer.DIAGNOSTIC_ID_KEY; +import static com.azure.core.implementation.tracing.Tracer.ENTITY_PATH; +import static com.azure.core.implementation.tracing.Tracer.HOST_NAME; +import static com.azure.core.implementation.tracing.Tracer.SPAN_CONTEXT; + /** * A producer responsible for transmitting {@link EventData} to a specific Event Hub, grouped together in batches. * Depending on the options specified at creation, the producer may be created to allow event data to be automatically @@ -57,29 +68,26 @@ * *

Create a producer that routes events to any partition

* To allow automatic routing of messages to available partition, do not specify the {@link - * EventHubProducerOptions#partitionId() partitionId} when creating the {@link EventHubAsyncProducer}. - *

+ * EventHubProducerOptions#getPartitionId() partitionId} when creating the {@link EventHubAsyncProducer}. * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncproducer.instantiation} * *

Create a producer that publishes events to partition "foo" with a timeout of 45 seconds.

- *

- * Developers can push events to a single partition by specifying the {@link EventHubProducerOptions#partitionId(String) - * partitionId} when creating an {@link EventHubAsyncProducer}. - *

+ * Developers can push events to a single partition by specifying the + * {@link EventHubProducerOptions#setPartitionId(String) partitionId} when creating an {@link EventHubAsyncProducer}. + * * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncproducer.instantiation#partitionId} * - *

Publish events to the same partition, grouped together using {@link SendOptions#partitionKey(String)}.

- *

+ *

Publish events to the same partition, grouped together using {@link SendOptions#setPartitionKey(String)} + * .

* If developers want to push similar events to end up at the same partition, but do not require them to go to a - * specific partition, they can use {@link SendOptions#partitionKey(String)}. + * specific partition, they can use {@link SendOptions#setPartitionKey(String)}. *

* In the sample below, all the "sandwiches" end up in the same partition, but it could end up in partition 0, 1, etc. * of the available partitions. All that matters to the end user is that they are grouped together. - *

+ *

* {@codesnippet com.azure.messaging.eventhubs.eventhubasyncproducer.send#publisher-sendOptions} * *

Publish events using an {@link EventDataBatch}.

- *

* Developers can create an {@link EventDataBatch}, add the events they want into it, and publish these * events together. When creating a {@link EventDataBatch batch}, developers can specify a set of {@link BatchOptions * options} to configure this batch. @@ -87,10 +95,12 @@ * In the scenario below, the developer is creating a networked video game. They want to receive telemetry about their * users' gaming systems, but do not want to slow down the network with telemetry. So they limit the size of their * {@link EventDataBatch batches} to be no larger than 256 bytes. The events within the batch also get hashed to the - * same partition because they all share the same {@link BatchOptions#partitionKey()}. - *

+ * same partition because they all share the same {@link BatchOptions#getPartitionKey()}. + *

* {@codesnippet com.azure.messaging.eventhubs.eventhubasyncproducer.send#eventDataBatch} + * * @see EventHubAsyncClient#createProducer() + * @see EventHubAsyncClient#createProducer(EventHubProducerOptions) */ @Immutable public class EventHubAsyncProducer implements Closeable { @@ -109,17 +119,20 @@ public class EventHubAsyncProducer implements Closeable { private final EventHubProducerOptions senderOptions; private final Mono sendLinkMono; private final boolean isPartitionSender; + private final TracerProvider tracerProvider; /** * Creates a new instance of this {@link EventHubAsyncProducer} that sends messages to {@link - * EventHubProducerOptions#partitionId() options.partitionId()} if it is not {@code null} or an empty string, + * EventHubProducerOptions#getPartitionId() options.partitionId()} if it is not {@code null} or an empty string, * otherwise, allows the service to load balance the messages amongst available partitions. */ - EventHubAsyncProducer(Mono amqpSendLinkMono, EventHubProducerOptions options) { + EventHubAsyncProducer(Mono amqpSendLinkMono, EventHubProducerOptions options, + TracerProvider tracerProvider) { // Caching the created link so we don't invoke another link creation. this.sendLinkMono = amqpSendLinkMono.cache(); this.senderOptions = options; - this.isPartitionSender = !ImplUtils.isNullOrEmpty(options.partitionId()); + this.isPartitionSender = !ImplUtils.isNullOrEmpty(options.getPartitionId()); + this.tracerProvider = tracerProvider; } /** @@ -133,15 +146,14 @@ public Mono createBatch() { /** * Creates an {@link EventDataBatch} that can fit as many events as the transport allows. * @param options A set of options used to configure the {@link EventDataBatch}. - * * @return A new {@link EventDataBatch} that can fit as many events as the transport allows. */ public Mono createBatch(BatchOptions options) { - Objects.requireNonNull(options); + Objects.requireNonNull(options, "'options' cannot be null."); final BatchOptions clone = options.clone(); - verifyPartitionKey(clone.partitionKey()); + verifyPartitionKey(clone.getPartitionKey()); return sendLinkMono.flatMap(link -> link.getLinkSize() .flatMap(size -> { @@ -149,33 +161,36 @@ public Mono createBatch(BatchOptions options) { ? size : MAX_MESSAGE_LENGTH_BYTES; - if (clone.maximumSizeInBytes() > maximumLinkSize) { + if (clone.getMaximumSizeInBytes() > maximumLinkSize) { return Mono.error(new IllegalArgumentException(String.format(Locale.US, "BatchOptions.maximumSizeInBytes (%s bytes) is larger than the link size (%s bytes).", - clone.maximumSizeInBytes(), maximumLinkSize))); + clone.getMaximumSizeInBytes(), maximumLinkSize))); } - final int batchSize = clone.maximumSizeInBytes() > 0 - ? clone.maximumSizeInBytes() + final int batchSize = clone.getMaximumSizeInBytes() > 0 + ? clone.getMaximumSizeInBytes() : maximumLinkSize; - return Mono.just(new EventDataBatch(batchSize, clone.partitionKey(), () -> link.getErrorContext())); + return Mono.just(new EventDataBatch(batchSize, clone.getPartitionKey(), link::getErrorContext)); })); } /** * Sends a single event to the associated Event Hub. If the size of the single event exceeds the maximum size * allowed, an exception will be triggered and the send will fail. + *

* For more information regarding the maximum event size allowed, see * Azure Event Hubs Quotas and * Limits. + *

+ * * @param event Event to send to the service. * * @return A {@link Mono} that completes when the event is pushed to the service. */ public Mono send(EventData event) { - Objects.requireNonNull(event); + Objects.requireNonNull(event, "'event' cannot be null."); return send(Flux.just(event)); } @@ -183,18 +198,20 @@ public Mono send(EventData event) { /** * Sends a single event to the associated Event Hub with the send options. If the size of the single event exceeds * the maximum size allowed, an exception will be triggered and the send will fail. + * *

* For more information regarding the maximum event size allowed, see * Azure Event Hubs Quotas and * Limits. - * @param event Event to send to the service. + *

+ * @param event Event to send to the service. * @param options The set of options to consider when sending this event. * * @return A {@link Mono} that completes when the event is pushed to the service. */ public Mono send(EventData event, SendOptions options) { - Objects.requireNonNull(event); - Objects.requireNonNull(options); + Objects.requireNonNull(event, "'event' cannot be null."); + Objects.requireNonNull(options, "'options' cannot be null."); return send(Flux.just(event), options); } @@ -208,7 +225,7 @@ public Mono send(EventData event, SendOptions options) { * @return A {@link Mono} that completes when all events are pushed to the service. */ public Mono send(Iterable events) { - Objects.requireNonNull(events); + Objects.requireNonNull(events, "'events' cannot be null."); return send(Flux.fromIterable(events)); } @@ -217,13 +234,13 @@ public Mono send(Iterable events) { * Sends a set of events to the associated Event Hub using a batched approach. If the size of events exceed the * maximum size of a single batch, an exception will be triggered and the send will fail. By default, the message * size is the max amount allowed on the link. - * @param events Events to send to the service. + * @param events Events to send to the service. * @param options The set of options to consider when sending this batch. * * @return A {@link Mono} that completes when all events are pushed to the service. */ public Mono send(Iterable events, SendOptions options) { - Objects.requireNonNull(events); + Objects.requireNonNull(events, "'options' cannot be null."); return send(Flux.fromIterable(events), options); } @@ -233,11 +250,10 @@ public Mono send(Iterable events, SendOptions options) { * maximum size of a single batch, an exception will be triggered and the send will fail. By default, the message * size is the max amount allowed on the link. * @param events Events to send to the service. - * * @return A {@link Mono} that completes when all events are pushed to the service. */ public Mono send(Flux events) { - Objects.requireNonNull(events); + Objects.requireNonNull(events, "'events' cannot be null."); return send(events, DEFAULT_SEND_OPTIONS); } @@ -246,29 +262,28 @@ public Mono send(Flux events) { * Sends a set of events to the associated Event Hub using a batched approach. If the size of events exceed the * maximum size of a single batch, an exception will be triggered and the send will fail. By default, the message * size is the max amount allowed on the link. - * @param events Events to send to the service. + * @param events Events to send to the service. * @param options The set of options to consider when sending this batch. - * * @return A {@link Mono} that completes when all events are pushed to the service. */ public Mono send(Flux events, SendOptions options) { - Objects.requireNonNull(events); - Objects.requireNonNull(options); + Objects.requireNonNull(events, "'events' cannot be null."); + Objects.requireNonNull(options, "'options' cannot be null."); return sendInternal(events, options); } /** * Sends the batch to the associated Event Hub. - * @param batch The batch to send to the service. * + * @param batch The batch to send to the service. * @return A {@link Mono} that completes when the batch is pushed to the service. * @throws NullPointerException if {@code batch} is {@code null}. * @see EventHubAsyncProducer#createBatch() * @see EventHubAsyncProducer#createBatch(BatchOptions) */ public Mono send(EventDataBatch batch) { - Objects.requireNonNull(batch); + Objects.requireNonNull(batch, "'batch' cannot be null."); if (batch.getEvents().isEmpty()) { logger.info("Cannot send an EventBatch that is empty."); @@ -285,24 +300,89 @@ public Mono send(EventDataBatch batch) { } private Mono sendInternal(Flux events, SendOptions options) { - final String partitionKey = options.partitionKey(); + final String partitionKey = options.getPartitionKey(); verifyPartitionKey(partitionKey); + if (tracerProvider.isEnabled()) { + return sendInternalTracingEnabled(events, partitionKey); + } else { + return sendInternalTracingDisabled(events, partitionKey); + } + } + private Mono sendInternalTracingDisabled(Flux events, String partitionKey) { return sendLinkMono.flatMap(link -> { return link.getLinkSize() .flatMap(size -> { final int batchSize = size > 0 ? size : MAX_MESSAGE_LENGTH_BYTES; final BatchOptions batchOptions = new BatchOptions() - .partitionKey(partitionKey) - .maximumSizeInBytes(batchSize); + .setPartitionKey(partitionKey) + .setMaximumSizeInBytes(batchSize); - return events.collect(new EventDataCollector(batchOptions, 1, () -> link.getErrorContext())); + return events.collect(new EventDataCollector(batchOptions, 1, link::getErrorContext)); }) .flatMap(list -> sendInternal(Flux.fromIterable(list))); }); } + private Mono sendInternalTracingEnabled(Flux events, String partitionKey) { + return sendLinkMono.flatMap(link -> { + final AtomicReference sendSpanContext = new AtomicReference<>(Context.NONE); + return link.getLinkSize() + .flatMap(size -> { + final int batchSize = size > 0 ? size : MAX_MESSAGE_LENGTH_BYTES; + final BatchOptions batchOptions = new BatchOptions() + .setPartitionKey(partitionKey) + .setMaximumSizeInBytes(batchSize); + + return events.map(eventData -> { + Context parentContext = eventData.getContext(); + Context entityContext = parentContext.addData(ENTITY_PATH, link.getEntityPath()); + sendSpanContext.set(tracerProvider + .startSpan(entityContext.addData(HOST_NAME, link.getHostname()), ProcessKind.SEND)); + // add span context on event data + return setSpanContext(eventData, parentContext); + }).collect(new EventDataCollector(batchOptions, 1, link::getErrorContext)); + }) + .flatMap(list -> sendInternal(Flux.fromIterable(list))) + .doOnEach(signal -> { + tracerProvider.endSpan(sendSpanContext.get(), signal); + }); + }); + } + + private EventData setSpanContext(EventData event, Context parentContext) { + Optional eventContextData = event.getContext().getData(SPAN_CONTEXT); + if (eventContextData.isPresent()) { + // if message has context (in case of retries), link it to the span + Object spanContextObject = eventContextData.get(); + if (spanContextObject instanceof Context) { + tracerProvider.addSpanLinks((Context) eventContextData.get()); + // TODO (samvaity): not supported in Opencensus yet + // builder.addLink((Context)eventContextData.get()); + } else { + logger.warning(String.format(Locale.US, + "Event Data context type is not of type Context, but type: %s. Not adding span links.", + spanContextObject != null ? spanContextObject.getClass() : "null")); + } + + return event; + } else { + // Starting the span makes the sampling decision (nothing is logged at this time) + Context eventSpanContext = tracerProvider.startSpan(parentContext, ProcessKind.RECEIVE); + if (eventSpanContext != null) { + Optional eventDiagnosticIdOptional = eventSpanContext.getData(DIAGNOSTIC_ID_KEY); + + if (eventDiagnosticIdOptional.isPresent()) { + event.addProperty(DIAGNOSTIC_ID_KEY, eventDiagnosticIdOptional.get().toString()); + tracerProvider.endSpan(eventSpanContext, Signal.complete()); + event.addContext(SPAN_CONTEXT, eventSpanContext); + } + } + } + return event; + } + private Mono sendInternal(Flux eventBatches) { return eventBatches .flatMap(this::send) @@ -318,25 +398,27 @@ private void verifyPartitionKey(String partitionKey) { } if (isPartitionSender) { - throw new IllegalArgumentException(String.format(Locale.US, + throw logger.logExceptionAsError(new IllegalArgumentException(String.format(Locale.US, "BatchOptions.partitionKey() cannot be set when an EventHubProducer is created with" - + "EventHubProducerOptions.partitionId() set. This EventHubProducer can only send events to partition '%s'.", - senderOptions.partitionId())); + + "EventHubProducerOptions.partitionId() set. This EventHubProducer can only send events to " + + "partition '%s'.", + senderOptions.getPartitionId()))); } else if (partitionKey.length() > MAX_PARTITION_KEY_LENGTH) { - throw new IllegalArgumentException(String.format(Locale.US, - "PartitionKey '%s' exceeds the maximum allowed length: '%s'.", partitionKey, MAX_PARTITION_KEY_LENGTH)); + throw logger.logExceptionAsError(new IllegalArgumentException(String.format(Locale.US, + "PartitionKey '%s' exceeds the maximum allowed length: '%s'.", partitionKey, + MAX_PARTITION_KEY_LENGTH))); } } /** * Disposes of the {@link EventHubAsyncProducer} by closing the underlying connection to the service. * @throws IOException if the underlying transport could not be closed and its resources could not be - * disposed. + * disposed. */ @Override public void close() throws IOException { if (!isDisposed.getAndSet(true)) { - final AmqpSendLink block = sendLinkMono.block(senderOptions.retry().tryTimeout()); + final AmqpSendLink block = sendLinkMono.block(senderOptions.getRetry().getTryTimeout()); if (block != null) { block.close(); } @@ -349,7 +431,8 @@ public void close() throws IOException { * maxNumberOfBatches}, then the collector throws a {@link AmqpException} with {@link * ErrorCondition#LINK_PAYLOAD_SIZE_EXCEEDED}. */ - private static class EventDataCollector implements Collector, List> { + private static class EventDataCollector implements Collector, + List> { private final String partitionKey; private final int maxMessageSize; private final Integer maxNumberOfBatches; @@ -359,13 +442,13 @@ private static class EventDataCollector implements Collector 0 - ? options.maximumSizeInBytes() + this.maxMessageSize = options.getMaximumSizeInBytes() > 0 + ? options.getMaximumSizeInBytes() : MAX_MESSAGE_LENGTH_BYTES; - this.partitionKey = options.partitionKey(); + this.partitionKey = options.getPartitionKey(); this.contextProvider = contextProvider; - currentBatch = new EventDataBatch(this.maxMessageSize, options.partitionKey(), contextProvider); + currentBatch = new EventDataBatch(this.maxMessageSize, options.getPartitionKey(), contextProvider); } @Override @@ -385,7 +468,8 @@ public BiConsumer, EventData> accumulator() { final String message = String.format(Locale.US, "EventData does not fit into maximum number of batches. '%s'", maxNumberOfBatches); - throw new AmqpException(false, ErrorCondition.LINK_PAYLOAD_SIZE_EXCEEDED, message, contextProvider.getErrorContext()); + throw new AmqpException(false, ErrorCondition.LINK_PAYLOAD_SIZE_EXCEEDED, message, + contextProvider.getErrorContext()); } currentBatch = new EventDataBatch(maxMessageSize, partitionKey, contextProvider); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClient.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClient.java new file mode 100644 index 000000000000..f6754a58de77 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClient.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import com.azure.core.amqp.RetryOptions; +import com.azure.core.implementation.annotation.ReturnType; +import com.azure.core.implementation.annotation.ServiceClient; +import com.azure.core.implementation.annotation.ServiceMethod; +import com.azure.core.util.IterableStream; +import com.azure.messaging.eventhubs.implementation.ConnectionOptions; +import com.azure.messaging.eventhubs.models.EventHubConsumerOptions; +import com.azure.messaging.eventhubs.models.EventHubProducerOptions; +import com.azure.messaging.eventhubs.models.EventPosition; + +import java.io.Closeable; +import java.time.Duration; +import java.util.Objects; + +/** + * A synchronous client that is the main point of interaction with Azure Event Hubs. It connects to a + * specific Event Hub and allows operations for sending event data, receiving data, and inspecting the Event Hub's + * metadata. + * + *

+ * Instantiated through {@link EventHubClientBuilder}. + *

+ * + *

+ * Creating a synchronous {@link EventHubClient} using an Event Hub instance connection string + *

+ * + * {@codesnippet com.azure.messaging.eventhubs.eventhubclient.instantiation} + * + * @see EventHubClientBuilder + * @see EventHubAsyncClient To communicate with Event Hub using an asynchronous client. + * @see About Azure Event Hubs + */ +@ServiceClient(builder = EventHubClientBuilder.class) +public class EventHubClient implements Closeable { + private final EventHubAsyncClient client; + private final RetryOptions retry; + private final EventHubProducerOptions defaultProducerOptions; + private final EventHubConsumerOptions defaultConsumerOptions; + + EventHubClient(EventHubAsyncClient client, ConnectionOptions connectionOptions) { + Objects.requireNonNull(connectionOptions, "'connectionOptions' cannot be null."); + + this.client = Objects.requireNonNull(client, "'client' cannot be null."); + this.retry = connectionOptions.getRetry(); + this.defaultProducerOptions = new EventHubProducerOptions() + .setRetry(connectionOptions.getRetry()); + this.defaultConsumerOptions = new EventHubConsumerOptions() + .setRetry(connectionOptions.getRetry()) + .setScheduler(connectionOptions.getScheduler()); + } + + /** + * Retrieves information about an Event Hub, including the number of partitions present and their identifiers. + * + * @return The set of information for the Event Hub that this client is associated with. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EventHubProperties getProperties() { + return client.getProperties().block(retry.getTryTimeout()); + } + + /** + * Retrieves the identifiers for all the partitions of an Event Hub. + * + * @return The identifiers for all partitions of an Event Hub. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public IterableStream getPartitionIds() { + return new IterableStream<>(client.getPartitionIds()); + } + + /** + * Retrieves information about a specific partition for an Event Hub, including elements that describe the available + * events in the partition event stream. + * + * @param partitionId The unique identifier of a partition associated with the Event Hub. + * @return The information for the requested partition under the Event Hub this client is associated with. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PartitionProperties getPartitionProperties(String partitionId) { + return client.getPartitionProperties(partitionId).block(retry.getTryTimeout()); + } + + /** + * Creates an Event Hub producer responsible for transmitting {@link EventData} to the Event Hub, grouped together + * in batches. Event data is automatically routed to an available partition. + * + * @return A new {@link EventHubProducer}. + */ + public EventHubProducer createProducer() { + return createProducer(defaultProducerOptions); + } + + /** + * Creates an Event Hub producer responsible for transmitting {@link EventData} to the Event Hub, grouped together + * in batches. If {@link EventHubProducerOptions#getPartitionId() options.partitionId()} is not {@code null}, the + * events are routed to that specific partition. Otherwise, events are automatically routed to an available + * partition. + * + * @param options The set of options to apply when creating the producer. + * @return A new {@link EventHubProducer}. + * @throws NullPointerException if {@code options} is {@code null}. + */ + public EventHubProducer createProducer(EventHubProducerOptions options) { + Objects.requireNonNull(options, "'options' cannot be null."); + + final EventHubAsyncProducer producer = client.createProducer(options); + + final Duration tryTimeout = options.getRetry() != null && options.getRetry().getTryTimeout() != null + ? options.getRetry().getTryTimeout() + : defaultProducerOptions.getRetry().getTryTimeout(); + + return new EventHubProducer(producer, tryTimeout); + } + + /** + * Creates an Event Hub consumer responsible for reading {@link EventData} from a specific Event Hub partition, as a + * member of the specified consumer group, and begins reading events from the {@code eventPosition}. + * + * The consumer created is non-exclusive, allowing multiple consumers from the same consumer group to be actively + * reading events from the partition. These non-exclusive consumers are sometimes referred to as "Non-epoch + * Consumers". + * + * @param consumerGroup The name of the consumer group this consumer is associated with. Events are read in the + * context of this group. The name of the consumer group that is created by default is {@link + * EventHubAsyncClient#DEFAULT_CONSUMER_GROUP_NAME "$Default"}. + * @param partitionId The identifier of the Event Hub partition. + * @param eventPosition The position within the partition where the consumer should begin reading events. + * @return A new {@link EventHubConsumer} that receives events from the partition at the given position. + * @throws NullPointerException If {@code eventPosition}, {@code consumerGroup}, {@code partitionId}, or + * {@code options} is {@code null}. + * @throws IllegalArgumentException If {@code consumerGroup} or {@code partitionId} is an empty string. + */ + public EventHubConsumer createConsumer(String consumerGroup, String partitionId, EventPosition eventPosition) { + final EventHubAsyncConsumer consumer = client.createConsumer(consumerGroup, partitionId, eventPosition); + return new EventHubConsumer(consumer, defaultConsumerOptions.getRetry().getTryTimeout()); + } + + /** + * Creates an Event Hub consumer responsible for reading {@link EventData} from a specific Event Hub partition, as a + * member of the configured consumer group, and begins reading events from the specified {@code eventPosition}. + * + *

+ * A consumer may be exclusive, which asserts ownership over the partition for the consumer group to ensure that + * only one consumer from that group is reading from the partition. These exclusive consumers are sometimes referred + * to as "Epoch Consumers." + * + * A consumer may also be non-exclusive, allowing multiple consumers from the same consumer group to be actively + * reading events from the partition. These non-exclusive consumers are sometimes referred to as "Non-epoch + * Consumers." + * + * Designating a consumer as exclusive may be specified in the {@code options}, by setting {@link + * EventHubConsumerOptions#setOwnerLevel(Long)} to a non-null value. By default, consumers are created as + * non-exclusive. + *

+ * + * @param consumerGroup The name of the consumer group this consumer is associated with. Events are read in the + * context of this group. The name of the consumer group that is created by default is {@link + * EventHubAsyncClient#DEFAULT_CONSUMER_GROUP_NAME "$Default"}. + * @param partitionId The identifier of the Event Hub partition from which events will be received. + * @param eventPosition The position within the partition where the consumer should begin reading events. + * @param options The set of options to apply when creating the consumer. + * @return An new {@link EventHubConsumer} that receives events from the partition with all configured {@link + * EventHubConsumerOptions}. + * @throws NullPointerException If {@code eventPosition}, {@code consumerGroup}, {@code partitionId}, or + * {@code options} is {@code null}. + * @throws IllegalArgumentException If {@code consumerGroup} or {@code partitionId} is an empty string. + */ + public EventHubConsumer createConsumer(String consumerGroup, String partitionId, EventPosition eventPosition, + EventHubConsumerOptions options) { + final EventHubAsyncConsumer consumer = + client.createConsumer(consumerGroup, partitionId, eventPosition, options); + final Duration timeout = options.getRetry() == null || options.getRetry().getTryTimeout() == null + ? defaultConsumerOptions.getRetry().getTryTimeout() + : options.getRetry().getTryTimeout(); + + return new EventHubConsumer(consumer, timeout); + } + + /** + * {@inheritDoc} + */ + @Override + public void close() { + client.close(); + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClientBuilder.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClientBuilder.java index 8fd54fc4b773..78451d900343 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClientBuilder.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClientBuilder.java @@ -5,20 +5,22 @@ import com.azure.core.amqp.RetryOptions; import com.azure.core.amqp.TransportType; +import com.azure.core.amqp.implementation.TracerProvider; import com.azure.core.credentials.TokenCredential; import com.azure.core.exception.AzureException; import com.azure.core.implementation.annotation.ServiceClientBuilder; +import com.azure.core.implementation.tracing.Tracer; import com.azure.core.implementation.util.ImplUtils; import com.azure.core.util.configuration.BaseConfigurations; import com.azure.core.util.configuration.Configuration; import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.implementation.CBSAuthorizationType; import com.azure.messaging.eventhubs.implementation.ClientConstants; import com.azure.messaging.eventhubs.implementation.ConnectionOptions; import com.azure.messaging.eventhubs.implementation.ConnectionStringProperties; import com.azure.messaging.eventhubs.implementation.ReactorHandlerProvider; import com.azure.messaging.eventhubs.implementation.ReactorProvider; -import com.azure.messaging.eventhubs.models.EventPosition; import com.azure.messaging.eventhubs.models.ProxyAuthenticationType; import com.azure.messaging.eventhubs.models.ProxyConfiguration; import reactor.core.scheduler.Scheduler; @@ -30,43 +32,48 @@ import java.security.NoSuchAlgorithmException; import java.util.Locale; import java.util.Objects; +import java.util.ServiceLoader; /** - * This class provides a fluent builder API to help aid the configuration and instantiation of the {@link - * EventHubAsyncClient}. Calling {@link #buildAsyncClient()} constructs an instant of the client. + * This class provides a fluent builder API to aid the instantiation of {@link EventHubAsyncClient} and {@link + * EventHubClient}. Calling {@link #buildAsyncClient() buildAsyncClient()} or {@link #buildClient() buildClient()} + * constructs an instance of the respective client. * *

- * The client requires credentials or a connection string to perform operations against Azure Event Hubs. Setting - * credentials by using {@link #connectionString(String)}, {@link #connectionString(String, String)}, or {@link - * #credential(String, String, TokenCredential)}, is required in order to construct an {@link EventHubAsyncClient}. - *

- * - *

Creating an {@link EventHubAsyncClient} using Event Hubs namespace connection string

- * - * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncclient.connectionString#string-string} + * Credentials are required to perform operations against Azure Event Hubs. They can be set by using + * one of the following methods: + *
    + *
  • {@link #connectionString(String) connectionString(String)} with a connection string to a specific Event Hub. + *
  • + *
  • {@link #connectionString(String, String) connectionString(String, String)} with an Event Hub namespace + * connection string and the Event Hub name.
  • + *
  • {@link #credential(String, String, TokenCredential) credential(String, String, TokenCredential)} with the + * fully qualified domain name (FQDN), Event Hub name, and a set of credentials authorized to use the Event Hub. + *
  • + *
* - *

Creating an {@link EventHubAsyncClient} using Event Hub instance connection string

- * - * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncclient.connectionstring#string} + *

+ * Creating an asynchronous {@link EventHubAsyncClient} using Event Hubs namespace connection string + *

* - *

Creating an {@link EventHubAsyncClient} using Event Hub with no retry, different timeout and new - * Scheduler

+ * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncclient.instantiation#string-string} * - * {@codesnippet com.azure.messaging.eventhubs.eventhubasyncclient.retry-timeout-scheduler} + *

+ * Creating a synchronous {@link EventHubClient} using an Event Hub instance connection string + *

* - *

Creating an {@link EventProcessor} instance using Event Hub instance connection - * string

- * {@codesnippet com.azure.messaging.eventhubs.eventprocessor.instantiation} + * {@codesnippet com.azure.messaging.eventhubs.eventhubclient.instantiation} * + * @see EventHubClient * @see EventHubAsyncClient - * @see EventProcessor */ -@ServiceClientBuilder(serviceClients = {EventHubAsyncClient.class, EventProcessor.class}) +@ServiceClientBuilder(serviceClients = {EventHubAsyncClient.class, EventHubClient.class}) public class EventHubClientBuilder { + private final ClientLogger logger = new ClientLogger(EventHubClientBuilder.class); private static final String AZURE_EVENT_HUBS_CONNECTION_STRING = "AZURE_EVENT_HUBS_CONNECTION_STRING"; private static final RetryOptions DEFAULT_RETRY = new RetryOptions() - .tryTimeout(ClientConstants.OPERATION_TIMEOUT); + .setTryTimeout(ClientConstants.OPERATION_TIMEOUT); private TokenCredential credentials; private Configuration configuration; @@ -76,10 +83,6 @@ public class EventHubClientBuilder { private TransportType transport; private String host; private String eventHubName; - private EventPosition initialEventPosition; - private PartitionProcessorFactory partitionProcessorFactory; - private String consumerGroupName; - private PartitionManager partitionManager; /** * Creates a new instance with the default transport {@link TransportType#AMQP}. @@ -102,64 +105,73 @@ public EventHubClientBuilder() { * from that Event Hub will result in a connection string that contains the name. *

* - * @param connectionString The connection string to use for connecting to the Event Hub instance. It is - * expected that the Event Hub name and the shared access key properties are contained in this connection - * string. + * @param connectionString The connection string to use for connecting to the Event Hub instance. It is expected + * that the Event Hub name and the shared access key properties are contained in this connection string. * @return The updated {@link EventHubClientBuilder} object. - * @throws IllegalArgumentException if {@code connectionString} is null or empty. Or, the {@code - * connectionString} does not contain the "EntityPath" key, which is the name of the Event Hub instance. - * @throws AzureException If the shared access signature token credential could not be created using the - * connection string. + * @throws IllegalArgumentException if {@code connectionString} is null or empty. Or, the {@code connectionString} + * does not contain the "EntityPath" key, which is the name of the Event Hub instance. + * @throws AzureException If the shared access signature token credential could not be created using the connection + * string. */ public EventHubClientBuilder connectionString(String connectionString) { final ConnectionStringProperties properties = new ConnectionStringProperties(connectionString); final TokenCredential tokenCredential; try { - tokenCredential = new EventHubSharedAccessKeyCredential(properties.sharedAccessKeyName(), - properties.sharedAccessKey(), ClientConstants.TOKEN_VALIDITY); + tokenCredential = new EventHubSharedAccessKeyCredential(properties.getSharedAccessKeyName(), + properties.getSharedAccessKey(), ClientConstants.TOKEN_VALIDITY); } catch (InvalidKeyException | NoSuchAlgorithmException e) { - throw new AzureException("Could not create the EventHubSharedAccessKeyCredential.", e); + throw logger.logExceptionAsError(new AzureException( + "Could not create the EventHubSharedAccessKeyCredential.", e)); } - return credential(properties.endpoint().getHost(), properties.eventHubName(), tokenCredential); + return credential(properties.getEndpoint().getHost(), properties.getEventHubName(), tokenCredential); } /** * Sets the credential information given a connection string to the Event Hubs namespace and name to a specific * Event Hub instance. * - * @param connectionString The connection string to use for connecting to the Event Hubs namespace; it is - * expected that the shared access key properties are contained in this connection string, but not the Event - * Hub name. + * @param connectionString The connection string to use for connecting to the Event Hubs namespace; it is expected + * that the shared access key properties are contained in this connection string, but not the Event Hub name. * @param eventHubName The name of the Event Hub to connect the client to. * @return The updated {@link EventHubClientBuilder} object. - * @throws IllegalArgumentException if {@code connectionString} or {@code eventHubName} is null or empty. - * Or, if the {@code connectionString} contains the Event Hub name. - * @throws AzureException If the shared access signature token credential could not be created using the - * connection string. + * @throws NullPointerException if {@code connectionString} or {@code eventHubName} is null. + * @throws IllegalArgumentException if {@code connectionString} or {@code eventHubName} is an empty string. Or, if + * the {@code connectionString} contains the Event Hub name. + * @throws AzureException If the shared access signature token credential could not be created using the connection + * string. */ public EventHubClientBuilder connectionString(String connectionString, String eventHubName) { - if (ImplUtils.isNullOrEmpty(eventHubName)) { - throw new IllegalArgumentException("'eventHubName' cannot be null or empty"); + Objects.requireNonNull(connectionString, "'connectionString' cannot be null."); + Objects.requireNonNull(eventHubName, "'eventHubName' cannot be null."); + + if (connectionString.isEmpty()) { + throw logger.logExceptionAsError(new IllegalArgumentException( + "'connectionString' cannot be an empty string.")); + } else if (eventHubName.isEmpty()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'eventHubName' cannot be an empty string.")); } final ConnectionStringProperties properties = new ConnectionStringProperties(connectionString); final TokenCredential tokenCredential; try { - tokenCredential = new EventHubSharedAccessKeyCredential(properties.sharedAccessKeyName(), - properties.sharedAccessKey(), ClientConstants.TOKEN_VALIDITY); + tokenCredential = new EventHubSharedAccessKeyCredential(properties.getSharedAccessKeyName(), + properties.getSharedAccessKey(), ClientConstants.TOKEN_VALIDITY); } catch (InvalidKeyException | NoSuchAlgorithmException e) { - throw new AzureException("Could not create the EventHubSharedAccessKeyCredential.", e); + throw logger.logExceptionAsError(new AzureException( + "Could not create the EventHubSharedAccessKeyCredential.", e)); } - if (!ImplUtils.isNullOrEmpty(properties.eventHubName())) { - throw new IllegalArgumentException(String.format(Locale.US, - "'connectionString' contains an Event Hub name [%s]. Please use the" - + " credentials(String connectionString) overload. Or supply a 'connectionString' without" - + " 'EntityPath' in it.", properties.eventHubName())); + if (!ImplUtils.isNullOrEmpty(properties.getEventHubName()) + && !eventHubName.equals(properties.getEventHubName())) { + throw logger.logExceptionAsError(new IllegalArgumentException(String.format(Locale.US, + "'connectionString' contains an Event Hub name [%s] and it does not match the given " + + "'eventHubName' parameter [%s]. Please use the credentials(String connectionString) overload. " + + "Or supply a 'connectionString' without 'EntityPath' in it.", + properties.getEventHubName(), eventHubName))); } - return credential(properties.endpoint().getHost(), eventHubName, tokenCredential); + return credential(properties.getEndpoint().getHost(), eventHubName, tokenCredential); } /** @@ -180,27 +192,25 @@ public EventHubClientBuilder configuration(Configuration configuration) { * Sets the credential information for which Event Hub instance to connect to, and how to authorize against it. * * @param host The fully qualified host name for the Event Hubs namespace. This is likely to be similar to - * {@literal "{your-namespace}.servicebus.windows.net}". + * {@literal "{your-namespace}.servicebus.windows.net}". * @param eventHubName The name of the Event Hub to connect the client to. - * @param credential The token credential to use for authorization. Access controls may be specified by the - * Event Hubs namespace or the requested Event Hub, depending on Azure configuration. + * @param credential The token credential to use for authorization. Access controls may be specified by the Event + * Hubs namespace or the requested Event Hub, depending on Azure configuration. * @return The updated {@link EventHubClientBuilder} object. - * @throws IllegalArgumentException if {@code host} or {@code eventHubName} is null or empty. - * @throws NullPointerException if {@code credentials} is null. + * @throws IllegalArgumentException if {@code host} or {@code eventHubName} is an empty string. + * @throws NullPointerException if {@code host}, {@code eventHubName}, {@code credentials} is null. */ public EventHubClientBuilder credential(String host, String eventHubName, TokenCredential credential) { + this.host = Objects.requireNonNull(host, "'host' cannot be null."); + this.credentials = Objects.requireNonNull(credential, "'credential' cannot be null."); + this.eventHubName = Objects.requireNonNull(eventHubName, "'eventHubName' cannot be null."); + if (ImplUtils.isNullOrEmpty(host)) { - throw new IllegalArgumentException("'host' cannot be null or empty"); + throw logger.logExceptionAsError(new IllegalArgumentException("'host' cannot be an empty string.")); + } else if (ImplUtils.isNullOrEmpty(eventHubName)) { + throw logger.logExceptionAsError(new IllegalArgumentException("'eventHubName' cannot be an empty string.")); } - if (ImplUtils.isNullOrEmpty(eventHubName)) { - throw new IllegalArgumentException("'eventHubName' cannot be null or empty."); - } - - Objects.requireNonNull(credential); - this.host = host; - this.credentials = credential; - this.eventHubName = eventHubName; return this; } @@ -220,8 +230,7 @@ public EventHubClientBuilder proxyConfiguration(ProxyConfiguration proxyConfigur * Sets the scheduler for operations such as connecting to and receiving or sending data to Event Hubs. If none is * specified, an elastic pool is used. * - * @param scheduler The scheduler for operations such as connecting to and receiving or sending data to - * Event Hubs. + * @param scheduler The scheduler for operations such as connecting to and receiving or sending data to Event Hubs. * @return The updated {@link EventHubClientBuilder} object. */ public EventHubClientBuilder scheduler(Scheduler scheduler) { @@ -253,8 +262,8 @@ public EventHubClientBuilder retry(RetryOptions retryOptions) { } /** - * Creates a new {@link EventHubAsyncClient} based on options set on this builder. Every time {@code - * buildAsyncClient()} is invoked, a new instance of {@link EventHubAsyncClient} is created. + * Creates a new {@link EventHubAsyncClient} based on options set on this builder. Every time + * {@code buildAsyncClient()} is invoked, a new instance of {@link EventHubAsyncClient} is created. * *

* The following options are used if ones are not specified in the builder: @@ -273,19 +282,64 @@ public EventHubClientBuilder retry(RetryOptions retryOptions) { * * @return A new {@link EventHubAsyncClient} instance with all the configured options. * @throws IllegalArgumentException if the credentials have not been set using either {@link - * #connectionString(String)} or {@link #credential(String, String, TokenCredential)}. Or, if a proxy is - * specified but the transport type is not {@link TransportType#AMQP_WEB_SOCKETS web sockets}. + * #connectionString(String)} or {@link #credential(String, String, TokenCredential)}. Or, if a proxy is specified + * but the transport type is not {@link TransportType#AMQP_WEB_SOCKETS web sockets}. */ public EventHubAsyncClient buildAsyncClient() { + final ConnectionOptions connectionOptions = getConnectionOptions(); + final ReactorProvider provider = new ReactorProvider(); + final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(provider); + final TracerProvider tracerProvider = new TracerProvider(ServiceLoader.load(Tracer.class)); + + return new EventHubAsyncClient(connectionOptions, provider, handlerProvider, tracerProvider); + } + + /** + * Creates a new {@link EventHubClient} based on options set on this builder. Every time {@code buildClient()} is + * invoked, a new instance of {@link EventHubClient} is created. + * + *

+ * The following options are used if ones are not specified in the builder: + * + *

    + *
  • If no configuration is specified, the {@link ConfigurationManager#getConfiguration() global configuration} + * is used to provide any shared configuration values. The configuration values read are the {@link + * BaseConfigurations#HTTP_PROXY}, {@link ProxyConfiguration#PROXY_USERNAME}, and {@link + * ProxyConfiguration#PROXY_PASSWORD}.
  • + *
  • If no retry is specified, the default retry options are used.
  • + *
  • If no proxy is specified, the builder checks the {@link ConfigurationManager#getConfiguration() global + * configuration} for a configured proxy, then it checks to see if a system proxy is configured.
  • + *
  • If no timeout is specified, a {@link ClientConstants#OPERATION_TIMEOUT timeout of one minute} is used.
  • + *
  • If no scheduler is specified, an {@link Schedulers#elastic() elastic scheduler} is used.
  • + *
+ * + * @return A new {@link EventHubClient} instance with all the configured options. + * @throws IllegalArgumentException if the credentials have not been set using either {@link + * #connectionString(String)} or {@link #credential(String, String, TokenCredential)}. Or, if a proxy is specified + * but the transport type is not {@link TransportType#AMQP_WEB_SOCKETS web sockets}. + */ + public EventHubClient buildClient() { + final ConnectionOptions connectionOptions = getConnectionOptions(); + final ReactorProvider provider = new ReactorProvider(); + final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(provider); + final TracerProvider tracerProvider = new TracerProvider(ServiceLoader.load(Tracer.class)); + final EventHubAsyncClient client = + new EventHubAsyncClient(connectionOptions, provider, handlerProvider, tracerProvider); + + return new EventHubClient(client, connectionOptions); + } + + private ConnectionOptions getConnectionOptions() { configuration = configuration == null ? ConfigurationManager.getConfiguration().clone() : configuration; if (credentials == null) { final String connectionString = configuration.get(AZURE_EVENT_HUBS_CONNECTION_STRING); if (ImplUtils.isNullOrEmpty(connectionString)) { - throw new IllegalArgumentException("Credentials have not been set using 'EventHubClientBuilder.credentials(String)'" - + "EventHubClientBuilder.credentials(String, String, TokenCredential). And the connection string is" - + "not set in the '" + AZURE_EVENT_HUBS_CONNECTION_STRING + "' environment variable."); + throw logger.logExceptionAsError(new IllegalArgumentException("Credentials have not been set. " + + "They can be set using: connectionString(String), connectionString(String, String), " + + "credentials(String, String, TokenCredential), or setting the environment variable '" + + AZURE_EVENT_HUBS_CONNECTION_STRING + "' with a connection string")); } connectionString(connectionString); @@ -299,7 +353,8 @@ public EventHubAsyncClient buildAsyncClient() { // is not AMQP_WEB_SOCKETS. if (proxyConfiguration != null && proxyConfiguration.isProxyAddressConfigured() && transport != TransportType.AMQP_WEB_SOCKETS) { - throw new IllegalArgumentException("Cannot use a proxy when TransportType is not AMQP."); + throw logger.logExceptionAsError(new IllegalArgumentException( + "Cannot use a proxy when TransportType is not AMQP.")); } if (proxyConfiguration == null) { @@ -310,21 +365,18 @@ public EventHubAsyncClient buildAsyncClient() { scheduler = Schedulers.elastic(); } - final ReactorProvider provider = new ReactorProvider(); - final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(provider); final CBSAuthorizationType authorizationType = credentials instanceof EventHubSharedAccessKeyCredential ? CBSAuthorizationType.SHARED_ACCESS_SIGNATURE : CBSAuthorizationType.JSON_WEB_TOKEN; - final ConnectionOptions parameters = new ConnectionOptions(host, eventHubName, credentials, authorizationType, - transport, retryOptions, proxyConfiguration, scheduler); - return new EventHubAsyncClient(parameters, provider, handlerProvider); + return new ConnectionOptions(host, eventHubName, credentials, authorizationType, + transport, retryOptions, proxyConfiguration, scheduler); } private ProxyConfiguration getDefaultProxyConfiguration(Configuration configuration) { ProxyAuthenticationType authentication = ProxyAuthenticationType.NONE; if (proxyConfiguration != null) { - authentication = proxyConfiguration.authentication(); + authentication = proxyConfiguration.getAuthentication(); } String proxyAddress = configuration.get(BaseConfigurations.HTTP_PROXY); @@ -335,7 +387,7 @@ private ProxyConfiguration getDefaultProxyConfiguration(Configuration configurat final String[] hostPort = proxyAddress.split(":"); if (hostPort.length < 2) { - throw new IllegalArgumentException("HTTP_PROXY cannot be parsed into a proxy"); + throw logger.logExceptionAsError(new IllegalArgumentException("HTTP_PROXY cannot be parsed into a proxy")); } final String host = hostPort[0]; @@ -346,87 +398,4 @@ private ProxyConfiguration getDefaultProxyConfiguration(Configuration configurat return new ProxyConfiguration(authentication, proxy, username, password); } - - /** - * This property must be set for building an {@link EventProcessor}. - * - * Sets the consumer group name from which the {@link EventProcessor} should consume events from. - * - * @param consumerGroupName The consumer group name this {@link EventProcessor} should consume events - * from. - * @return The updated {@link EventHubClientBuilder} object. - */ - public EventHubClientBuilder consumerGroupName(String consumerGroupName) { - this.consumerGroupName = consumerGroupName; - return this; - } - - /** - * This property can be optionally set when building an {@link EventProcessor}. - * - * Sets the initial event position. If this property is not set and if checkpoint for a partition doesn't exist, - * {@link EventPosition#earliest()} will be used as the initial event position to start consuming events. - * - * @param initialEventPosition The initial event position. - * @return The updated {@link EventHubClientBuilder} object. - */ - public EventHubClientBuilder initialEventPosition(EventPosition initialEventPosition) { - this.initialEventPosition = initialEventPosition; - return this; - } - - /** - * This property must be set when building an {@link EventProcessor}. - * - * Sets the {@link PartitionManager} the {@link EventProcessor} will use for storing partition - * ownership and checkpoint information. - * - * @param partitionManager Implementation of {@link PartitionManager}. - * @return The updated {@link EventHubClientBuilder} object. - */ - public EventHubClientBuilder partitionManager(PartitionManager partitionManager) { - // If this is not set, look for classes implementing PartitionManager interface - // in the classpath and use it automatically. (To be implemented) - this.partitionManager = partitionManager; - return this; - } - - /** - * This property must be set when building an {@link EventProcessor}. - * - * Sets the partition processor factory for creating new instance(s) of {@link PartitionProcessor}. - * - * @param partitionProcessorFactory The factory that creates new processor for each partition. - * @return The updated {@link EventHubClientBuilder} object. - */ - public EventHubClientBuilder partitionProcessorFactory(PartitionProcessorFactory partitionProcessorFactory) { - this.partitionProcessorFactory = partitionProcessorFactory; - return this; - } - - /** - * This will create a new {@link EventProcessor} configured with the options set in this builder. Each call - * to this method will return a new instance of {@link EventProcessor}. - * - *

- * A new instance of {@link EventHubAsyncClient} will be created with configured options by calling the {@link - * #buildAsyncClient()} that will be used by the {@link EventProcessor}. - *

- * - *

- * If the {@link #initialEventPosition(EventPosition) initial event position} is not set, all partitions processed by - * this {@link EventProcessor} will start processing from {@link EventPosition#earliest() earliest} - * available event in the respective partitions. - *

- * - * @return A new instance of {@link EventProcessor}. - */ - public EventProcessor buildEventProcessor() { - EventPosition initialEventPosition = - this.initialEventPosition == null ? EventPosition.earliest() - : this.initialEventPosition; - - return new EventProcessor(buildAsyncClient(), this.consumerGroupName, - this.partitionProcessorFactory, initialEventPosition, partitionManager, eventHubName); - } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubConsumer.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubConsumer.java new file mode 100644 index 000000000000..58cbb9e7d746 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubConsumer.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import com.azure.core.util.IterableStream; +import com.azure.core.util.logging.ClientLogger; +import com.azure.messaging.eventhubs.implementation.SynchronousEventSubscriber; +import com.azure.messaging.eventhubs.implementation.SynchronousReceiveWork; +import com.azure.messaging.eventhubs.models.EventHubConsumerOptions; +import com.azure.messaging.eventhubs.models.EventPosition; +import reactor.core.publisher.Flux; +import reactor.core.publisher.FluxSink; + +import java.io.Closeable; +import java.io.IOException; +import java.time.Duration; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicLong; +import java.util.concurrent.atomic.AtomicReferenceFieldUpdater; + +/** + * A consumer responsible for reading {@link EventData} from a specific Event Hub partition in the context of a specific + * consumer group. + * + *
    + *
  • If {@link EventHubConsumer} is created where {@link EventHubConsumerOptions#getOwnerLevel()} has a + * value, then Event Hubs service will guarantee only one active consumer exists per partitionId and consumer group + * combination. This consumer is sometimes referred to as an "Epoch Consumer."
  • + *
  • Multiple consumers per partitionId and consumer group combination can be created by not setting + * {@link EventHubConsumerOptions#getOwnerLevel()} when creating consumers. This non-exclusive consumer is sometimes + * referred to as a "Non-Epoch Consumer."
  • + *
+ * + *

Creating a synchronous consumer

+ * Create an {@link EventHubConsumer} using {@link EventHubClient}. + * {@codesnippet com.azure.messaging.eventhubs.eventhubconsumer.instantiation} + * + *

Consuming events from an Event Hub

+ * Events can be consumed using {@link #receive(int)} or {@link #receive(int, Duration)}. The call to `receive` + * completes and returns an {@link IterableStream} when either the number of events is reached, or the + * timeout duration is reached. + * {@codesnippet com.azure.messaging.eventhubs.eventhubconsumer.receive#int-duration} + * + * @see EventHubClient#createConsumer(String, String, EventPosition) + * @see EventHubClient#createConsumer(String, String, EventPosition, EventHubConsumerOptions) + */ +public class EventHubConsumer implements Closeable { + private static final AtomicReferenceFieldUpdater SUBSCRIBER = + AtomicReferenceFieldUpdater.newUpdater(EventHubConsumer.class, SynchronousEventSubscriber.class, + "eventSubscriber"); + + private final ClientLogger logger = new ClientLogger(EventHubConsumer.class); + private final AtomicLong idGenerator = new AtomicLong(); + + private final EventHubAsyncConsumer consumer; + private final Duration timeout; + private volatile SynchronousEventSubscriber eventSubscriber; + + EventHubConsumer(EventHubAsyncConsumer consumer, Duration tryTimeout) { + Objects.requireNonNull(tryTimeout, "'tryTimeout' cannot be null."); + + this.consumer = Objects.requireNonNull(consumer, "'consumer' cannot be null."); + this.timeout = tryTimeout; + } + + /** + * Receives a batch of EventData from the Event Hub partition. + * + * @param maximumMessageCount The maximum number of messages to receive in this batch. + * @return A set of {@link EventData} that was received. The iterable contains up to {@code maximumMessageCount} + * events. + * @throws IllegalArgumentException if {@code maximumMessageCount} is less than 1. + */ + public IterableStream receive(int maximumMessageCount) { + return receive(maximumMessageCount, timeout); + } + + /** + * Receives a batch of EventData from the Event Hub partition + * + * @param maximumMessageCount The maximum number of messages to receive in this batch. + * @param maximumWaitTime The maximum amount of time to wait to build up the requested message count for the + * batch; if not specified, the default wait time specified when the consumer was created will be used. + * @return A set of {@link EventData} that was received. The iterable contains up to {@code maximumMessageCount} + * events. + * @throws NullPointerException if {@code maximumWaitTime} is null. + * @throws IllegalArgumentException if {@code maximumMessageCount} is less than 1 or {@code maximumWaitTime} is + * zero or a negative duration. + */ + public IterableStream receive(int maximumMessageCount, Duration maximumWaitTime) { + Objects.requireNonNull(maximumWaitTime, "'maximumWaitTime' cannot be null."); + + if (maximumMessageCount < 1) { + throw logger.logExceptionAsError( + new IllegalArgumentException("'maximumMessageCount' cannot be less than 1.")); + } else if (maximumWaitTime.isNegative() || maximumWaitTime.isZero()) { + throw logger.logExceptionAsError( + new IllegalArgumentException("'maximumWaitTime' cannot be zero or less.")); + } + + final Flux events = Flux.create(emitter -> { + queueWork(maximumMessageCount, maximumWaitTime, emitter); + }); + + final Flux map = events.collectList().map(x -> { + logger.info("Number of events received: {}", x.size()); + return Flux.fromIterable(x); + }).block(); + return new IterableStream<>(map); + } + + /** + * Given an {@code emitter}, queues that work in {@link SynchronousEventSubscriber}. If the {@link #eventSubscriber} + * has not been initialised yet, will initialise it. + */ + private void queueWork(int maximumMessageCount, Duration maximumWaitTime, FluxSink emitter) { + final long id = idGenerator.getAndIncrement(); + final SynchronousReceiveWork work = new SynchronousReceiveWork(id, maximumMessageCount, maximumWaitTime, + emitter); + + if (SUBSCRIBER.compareAndSet(this, null, new SynchronousEventSubscriber(work))) { + logger.info("Started synchronous event subscriber."); + consumer.receive().subscribeWith(SUBSCRIBER.get(this)); + } else { + logger.info("Queueing work item in SynchronousEventSubscriber."); + SUBSCRIBER.get(this).queueReceiveWork(work); + } + } + + /** + * {@inheritDoc} + */ + @Override + public void close() throws IOException { + consumer.close(); + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProducer.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProducer.java new file mode 100644 index 000000000000..59c8fd94061f --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProducer.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import com.azure.core.implementation.annotation.Immutable; +import com.azure.messaging.eventhubs.models.BatchOptions; +import com.azure.messaging.eventhubs.models.EventHubProducerOptions; +import com.azure.messaging.eventhubs.models.SendOptions; + +import java.io.Closeable; +import java.io.IOException; +import java.time.Duration; +import java.util.Objects; + +/** + * A producer responsible for transmitting {@link EventData} to a specific Event Hub, grouped together in batches. + * Depending on the options specified at creation, the producer may be created to allow event data to be automatically + * routed to an available partition or specific to a partition. + * + *

+ * Allowing automatic routing of partitions is recommended when: + *

    + *
  • The sending of events needs to be highly available.
  • + *
  • The event data should be evenly distributed among all available partitions.
  • + *
+ *

+ * + *

+ * If no {@link EventHubProducerOptions#getPartitionId() partitionId} is specified, the following rules are used for + * automatically selecting one: + * + *

    + *
  1. Distribute the events equally amongst all available partitions using a round-robin approach.
  2. + *
  3. If a partition becomes unavailable, the Event Hubs service will automatically detect it and forward the + * message to another available partition.
  4. + *
+ *

+ * + *

Create a producer that routes events to any partition

+ * To allow automatic routing of messages to available partition, do not specify the {@link + * EventHubProducerOptions#getPartitionId() partitionId} when creating the {@link EventHubProducer}. + * + * {@codesnippet com.azure.messaging.eventhubs.eventhubproducer.instantiation} + * + *

Create a producer that publishes events to partition "foo" with a timeout of 45 seconds.

+ * Developers can push events to a single partition by specifying the + * {@link EventHubProducerOptions#setPartitionId(String) partitionId} when creating an {@link EventHubProducer}. + * + * {@codesnippet com.azure.messaging.eventhubs.eventhubproducer.instantiation#partitionId} + * + *

Publish events to the same partition, grouped together using {@link SendOptions#setPartitionKey(String)} + *

+ * If developers want to push similar events to end up at the same partition, but do not require them to go to a + * specific partition, they can use {@link SendOptions#setPartitionKey(String)}. + * + *

+ * In the sample below, all the "sandwiches" end up in the same partition, but it could end up in partition 0, 1, etc. + * of the available partitions. All that matters to the end user is that they are grouped together. + *

+ * + * {@codesnippet com.azure.messaging.eventhubs.eventhubproducer.send#publisher-sendOptions} + * + *

Publish events using an {@link EventDataBatch}

+ * Developers can create an {@link EventDataBatch}, add the events they want into it, and publish these events together. + * When creating a {@link EventDataBatch batch}, developers can specify a set of {@link BatchOptions options} to + * configure this batch. + * + *

+ * In the scenario below, the developer is creating a networked video game. They want to receive telemetry about their + * users' gaming systems, but do not want to slow down the network with telemetry. So they limit the size of their + * {@link EventDataBatch batches} to be no larger than 256 bytes. The events within the batch also get hashed to the + * same partition because they all share the same {@link BatchOptions#getPartitionKey()}. + *

+ * {@codesnippet com.azure.messaging.eventhubs.eventhubproducer.send#eventDataBatch} + * + * @see EventHubClient#createProducer() + * @see EventHubClient#createProducer(EventHubProducerOptions) + * @see EventHubAsyncProducer To asynchronously generate events to an Event Hub, see EventHubAsyncProducer. + */ +@Immutable +public class EventHubProducer implements Closeable { + private final EventHubAsyncProducer producer; + private final Duration tryTimeout; + + /** + * Creates a new instance of {@link EventHubProducer} that sends messages to an Azure Event Hub. + * + * @throws NullPointerException if {@code producer} or {@code tryTimeout} is null. + */ + EventHubProducer(EventHubAsyncProducer producer, Duration tryTimeout) { + this.producer = Objects.requireNonNull(producer, "'producer' cannot be null."); + this.tryTimeout = Objects.requireNonNull(tryTimeout, "'tryTimeout' cannot be null."); + } + + /** + * Creates an {@link EventDataBatch} that can fit as many events as the transport allows. + * + * @return A new {@link EventDataBatch} that can fit as many events as the transport allows. + */ + public EventDataBatch createBatch() { + return producer.createBatch().block(tryTimeout); + } + + /** + * Creates an {@link EventDataBatch} that can fit as many events as the transport allows. + * + * @param options A set of options used to configure the {@link EventDataBatch}. + * @return A new {@link EventDataBatch} that can fit as many events as the transport allows. + */ + public EventDataBatch createBatch(BatchOptions options) { + return producer.createBatch(options).block(tryTimeout); + } + + /** + * Sends a single event to the associated Event Hub. If the size of the single event exceeds the maximum size + * allowed, an exception will be triggered and the send will fail. + * + *

+ * For more information regarding the maximum event size allowed, see + * Azure Event Hubs Quotas and + * Limits. + *

+ * + * @param event Event to send to the service. + */ + public void send(EventData event) { + producer.send(event).block(); + } + + /** + * Sends a single event to the associated Event Hub with the send options. If the size of the single event exceeds + * the maximum size allowed, an exception will be triggered and the send will fail. + * + *

+ * For more information regarding the maximum event size allowed, see + * Azure Event Hubs Quotas and + * Limits. + *

+ * + * @param event Event to send to the service. + * @param options The set of options to consider when sending this event. + */ + public void send(EventData event, SendOptions options) { + producer.send(event, options).block(); + } + + /** + * Sends a set of events to the associated Event Hub using a batched approach. If the size of events exceed the + * maximum size of a single batch, an exception will be triggered and the send will fail. By default, the message + * size is the max amount allowed on the link. + * + *

+ * For more information regarding the maximum event size allowed, see + * Azure Event Hubs Quotas and + * Limits. + *

+ * + * @param events Events to send to the service. + */ + public void send(Iterable events) { + producer.send(events).block(); + } + + /** + * Sends a set of events to the associated Event Hub using a batched approach. If the size of events exceed the + * maximum size of a single batch, an exception will be triggered and the send will fail. By default, the message + * size is the max amount allowed on the link. + * + *

+ * For more information regarding the maximum event size allowed, see + * Azure Event Hubs Quotas and + * Limits. + *

+ * + * @param events Events to send to the service. + * @param options The set of options to consider when sending this batch. + */ + public void send(Iterable events, SendOptions options) { + producer.send(events, options).block(); + } + + /** + * Sends the batch to the associated Event Hub. + * + * @param batch The batch to send to the service. + * @throws NullPointerException if {@code batch} is {@code null}. + * @see EventHubProducer#createBatch() + * @see EventHubProducer#createBatch(BatchOptions) + */ + public void send(EventDataBatch batch) { + producer.send(batch).block(); + } + + /** + * {@inheritDoc} + */ + @Override + public void close() throws IOException { + producer.close(); + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProperties.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProperties.java index 8378b550b2d3..1d9350a7ad9c 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProperties.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProperties.java @@ -4,17 +4,17 @@ package com.azure.messaging.eventhubs; import com.azure.core.implementation.annotation.Immutable; -import com.azure.messaging.eventhubs.models.EventHubConsumerOptions; import com.azure.messaging.eventhubs.models.EventPosition; import java.time.Instant; import java.util.Arrays; /** - * Holds information about Event Hubs which can come handy while performing data-plane operations like - * {@link EventHubAsyncClient#createConsumer(String, String, EventPosition)} and - * {@link EventHubAsyncClient#createConsumer(String, String, EventPosition, EventHubConsumerOptions)}. + * Holds information about an Event Hub which can come handy while performing operations like + * {@link EventHubClient#createConsumer(String, String, EventPosition) creating an EventHubConsumer} or + * {@link EventHubAsyncClient#createConsumer(String, String, EventPosition) an EventHubAsyncConsumer}. * + * @see EventHubClient * @see EventHubAsyncClient */ @Immutable @@ -39,7 +39,7 @@ public final class EventHubProperties { * * @return Name of the Event Hub. */ - public String name() { + public String getName() { return name; } @@ -48,7 +48,7 @@ public String name() { * * @return The instant, in UTC, at which the Event Hub was created. */ - public Instant createdAt() { + public Instant getCreatedAt() { return createdAt; } @@ -57,7 +57,7 @@ public Instant createdAt() { * * @return The list of partition identifiers of the Event Hub. */ - public String[] partitionIds() { + public String[] getPartitionIds() { return partitionIds; } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubSharedAccessKeyCredential.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubSharedAccessKeyCredential.java index ae23b11a6eb3..b9af1cc50de9 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubSharedAccessKeyCredential.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubSharedAccessKeyCredential.java @@ -7,6 +7,7 @@ import com.azure.core.credentials.TokenCredential; import com.azure.core.implementation.annotation.Immutable; import com.azure.core.implementation.util.ImplUtils; +import com.azure.core.util.logging.ClientLogger; import reactor.core.publisher.Mono; import javax.crypto.Mac; @@ -27,48 +28,59 @@ /** * Authorizes with Azure Event Hubs service using a shared access key from either an Event Hubs namespace or a specific * Event Hub. + * + *

+ * The shared access key can be obtained by creating a shared access policy for the Event Hubs namespace or for + * a specific Event Hub instance. See + * Shared access authorization policies + * for more information. + *

+ * + * @see Authorize + * access with shared access signature. */ @Immutable public class EventHubSharedAccessKeyCredential implements TokenCredential { private static final String SHARED_ACCESS_SIGNATURE_FORMAT = "SharedAccessSignature sr=%s&sig=%s&se=%s&skn=%s"; private static final String HASH_ALGORITHM = "HMACSHA256"; - private final String keyName; + private final ClientLogger logger = new ClientLogger(EventHubSharedAccessKeyCredential.class); + + private final String policyName; private final Mac hmac; private final Duration tokenValidity; /** - * Creates an instance that authorizes using the {@code keyName} and {@code sharedAccessKey}. The authorization + * Creates an instance that authorizes using the {@code policyName} and {@code sharedAccessKey}. The authorization * lasts for a period of {@code tokenValidity} before another token must be requested. * - * @param keyName Name of the shared access key policy. + * @param policyName Name of the shared access key policy. * @param sharedAccessKey Value of the shared access key. * @param tokenValidity The duration for which the shared access signature is valid. - * @throws IllegalArgumentException if {@code keyName}, {@code sharedAccessKey} is null or empty. Or the duration of - * {@code tokenValidity} is zero or a negative value. - * @throws NoSuchAlgorithmException If the hashing algorithm cannot be instantiated, which is used to generate the - * shared access signatures. + * @throws IllegalArgumentException if {@code policyName}, {@code sharedAccessKey} is an empty string. Or the + * duration of {@code tokenValidity} is zero or a negative value. + * @throws NoSuchAlgorithmException If the hashing algorithm cannot be instantiated, which is used to generate + * the shared access signatures. * @throws InvalidKeyException If the {@code sharedAccessKey} is an invalid value for the hashing algorithm. - * @throws NullPointerException if {@code tokenValidity} is null. + * @throws NullPointerException if {@code policyName}, {@code sharedAccessKey}, or {@code tokenValidity} is + * null. */ - public EventHubSharedAccessKeyCredential(String keyName, String sharedAccessKey, Duration tokenValidity) + public EventHubSharedAccessKeyCredential(String policyName, String sharedAccessKey, Duration tokenValidity) throws NoSuchAlgorithmException, InvalidKeyException { - if (ImplUtils.isNullOrEmpty(keyName)) { - throw new IllegalArgumentException("keyName cannot be null or empty"); - } - if (ImplUtils.isNullOrEmpty(sharedAccessKey)) { - throw new IllegalArgumentException("sharedAccessKey cannot be null or empty."); - } + Objects.requireNonNull(sharedAccessKey, "'sharedAccessKey' cannot be null."); + this.policyName = Objects.requireNonNull(policyName, "'sharedAccessKey' cannot be null."); + this.tokenValidity = Objects.requireNonNull(tokenValidity, "'tokenValidity' cannot be null."); - Objects.requireNonNull(tokenValidity); - if (tokenValidity.isZero() || tokenValidity.isNegative()) { - throw new IllegalArgumentException("tokenTimeToLive has to positive and in the order-of seconds"); + if (policyName.isEmpty()) { + throw new IllegalArgumentException("'policyName' cannot be an empty string."); + } else if (sharedAccessKey.isEmpty()) { + throw new IllegalArgumentException("'sharedAccessKey' cannot be an empty string."); + } else if (tokenValidity.isZero() || tokenValidity.isNegative()) { + throw new IllegalArgumentException("'tokenTimeToLive' has to positive and in the order-of seconds"); } - this.keyName = keyName; - this.tokenValidity = tokenValidity; - hmac = Mac.getInstance(HASH_ALGORITHM); final byte[] sasKeyBytes = sharedAccessKey.getBytes(UTF_8); @@ -82,12 +94,14 @@ public EventHubSharedAccessKeyCredential(String keyName, String sharedAccessKey, * * @param scopes The name of the resource or token audience to obtain a token for. * @return A Mono that completes and returns the shared access signature. - * @throws IllegalArgumentException if {@code scopes} does not contain a single value, which is the token audience. + * @throws IllegalArgumentException if {@code scopes} does not contain a single value, which is the token + * audience. */ @Override public Mono getToken(String... scopes) { if (scopes.length != 1) { - throw new IllegalArgumentException("'scopes' should only contain a single argument that is the token audience or resource name."); + throw logger.logExceptionAsError(new IllegalArgumentException( + "'scopes' should only contain a single argument that is the token audience or resource name.")); } return Mono.fromCallable(() -> generateSharedAccessSignature(scopes[0])); @@ -95,7 +109,7 @@ public Mono getToken(String... scopes) { private AccessToken generateSharedAccessSignature(final String resource) throws UnsupportedEncodingException { if (ImplUtils.isNullOrEmpty(resource)) { - throw new IllegalArgumentException("resource cannot be empty"); + throw logger.logExceptionAsError(new IllegalArgumentException("resource cannot be empty")); } final String utf8Encoding = UTF_8.name(); @@ -111,7 +125,7 @@ private AccessToken generateSharedAccessSignature(final String resource) throws audienceUri, URLEncoder.encode(signature, utf8Encoding), URLEncoder.encode(expiresOnEpochSeconds, utf8Encoding), - URLEncoder.encode(keyName, utf8Encoding)); + URLEncoder.encode(policyName, utf8Encoding)); return new AccessToken(token, expiresOn); } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventProcessor.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventProcessor.java index 3c2b74671405..5db4f90fc72e 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventProcessor.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventProcessor.java @@ -3,58 +3,45 @@ package com.azure.messaging.eventhubs; +import com.azure.core.amqp.implementation.TracerProvider; import com.azure.core.util.logging.ClientLogger; -import com.azure.messaging.eventhubs.models.PartitionContext; -import com.azure.messaging.eventhubs.models.PartitionOwnership; -import com.azure.messaging.eventhubs.models.EventHubConsumerOptions; +import com.azure.messaging.eventhubs.implementation.PartitionBasedLoadBalancer; +import com.azure.messaging.eventhubs.implementation.PartitionPumpManager; import com.azure.messaging.eventhubs.models.EventPosition; - -import java.io.IOException; -import java.util.Map; import java.util.Objects; +import java.util.ServiceLoader; import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; - -import org.reactivestreams.Publisher; +import java.util.function.Supplier; import reactor.core.Disposable; -import reactor.core.publisher.Flux; import reactor.core.scheduler.Scheduler; import reactor.core.scheduler.Schedulers; /** - * This is the starting point for event processor. - *

- * Event Processor based application consists of one or more instances of {@link EventProcessor} which are - * set up to consume events from the same Event Hub + consumer group and to balance the workload across different - * instances and track progress when events are processed. - *

- * - *

Creating an {@link EventProcessor} instance using Event Hub instance connection - * string

+ * Event Processor provides a convenient mechanism to consume events from all partitions of an Event Hub in the context + * of a consumer group. Event Processor-based application consists of one or more instances of EventProcessor(s) which + * are set up to consume events from the same Event Hub, consumer group to balance the workload across different + * instances and track progress when events are processed. Based on the number of instances running, each Event + * Processor may own zero or more partitions to balance the workload among all the instances. * - * {@codesnippet com.azure.messaging.eventhubs.eventprocessor.instantiation} + *

To create an instance of EventProcessor, use the fluent {@link EventProcessorBuilder}.

* - * @see EventHubAsyncClient - * @see EventHubClientBuilder + * @see EventProcessorBuilder */ public class EventProcessor { - private static final long INTERVAL_IN_SECONDS = 10; // run every 10 seconds - private static final long INITIAL_DELAY = 0; // start immediately - private static final long OWNERSHIP_EXPIRATION_TIME_IN_MILLIS = TimeUnit.SECONDS.toMillis(30); + private static final long INTERVAL_IN_SECONDS = 10; // run the load balancer every 10 seconds + private static final long BASE_JITTER_IN_SECONDS = 2; // the initial delay jitter before starting the processor private final ClientLogger logger = new ClientLogger(EventProcessor.class); - private final EventHubAsyncClient eventHubAsyncClient; - private final String consumerGroupName; - private final EventPosition initialEventPosition; - private final PartitionProcessorFactory partitionProcessorFactory; - private final PartitionManager partitionManager; private final String identifier; - private final Map partitionConsumers = new ConcurrentHashMap<>(); - private final String eventHubName; private final AtomicBoolean started = new AtomicBoolean(false); + private final PartitionPumpManager partitionPumpManager; + private final PartitionBasedLoadBalancer partitionBasedLoadBalancer; + private final PartitionManager partitionManager; + private Disposable runner; private Scheduler scheduler; @@ -62,30 +49,67 @@ public class EventProcessor { * Package-private constructor. Use {@link EventHubClientBuilder} to create an instance. * * @param eventHubAsyncClient The {@link EventHubAsyncClient}. - * @param consumerGroupName The consumer group name used in this event processor to consumer events. + * @param consumerGroup The consumer group name used in this event processor to consumer events. * @param partitionProcessorFactory The factory to create new partition processor(s). * @param initialEventPosition Initial event position to start consuming events. - * @param partitionManager The partition manager. - * @param eventHubName The Event Hub name. + * @param partitionManager The partition manager used for reading and updating partition ownership and checkpoint + * information. + * @param tracerProvider The tracer implementation. */ - EventProcessor(EventHubAsyncClient eventHubAsyncClient, String consumerGroupName, - PartitionProcessorFactory partitionProcessorFactory, EventPosition initialEventPosition, - PartitionManager partitionManager, - String eventHubName) { - this.eventHubAsyncClient = Objects - .requireNonNull(eventHubAsyncClient, "eventHubAsyncClient cannot be null"); - this.consumerGroupName = Objects - .requireNonNull(consumerGroupName, "consumerGroupname cannot be null"); - this.partitionProcessorFactory = Objects - .requireNonNull(partitionProcessorFactory, "partitionProcessorFactory cannot be null"); - this.partitionManager = Objects - .requireNonNull(partitionManager, "partitionManager cannot be null"); - this.initialEventPosition = Objects - .requireNonNull(initialEventPosition, "initialEventPosition cannot be null"); - this.eventHubName = Objects - .requireNonNull(eventHubName, "eventHubName cannot be null"); + EventProcessor(EventHubAsyncClient eventHubAsyncClient, String consumerGroup, + Supplier partitionProcessorFactory, EventPosition initialEventPosition, + PartitionManager partitionManager, TracerProvider tracerProvider) { + + Objects.requireNonNull(eventHubAsyncClient, "eventHubAsyncClient cannot be null"); + Objects.requireNonNull(consumerGroup, "consumerGroup cannot be null"); + Objects.requireNonNull(partitionProcessorFactory, "partitionProcessorFactory cannot be null"); + Objects.requireNonNull(initialEventPosition, "initialEventPosition cannot be null"); + + this.partitionManager = partitionManager == null ? findPartitionManager() : partitionManager; this.identifier = UUID.randomUUID().toString(); logger.info("The instance ID for this event processors is {}", this.identifier); + this.partitionPumpManager = new PartitionPumpManager(partitionManager, partitionProcessorFactory, + initialEventPosition, eventHubAsyncClient, tracerProvider); + this.partitionBasedLoadBalancer = + new PartitionBasedLoadBalancer(this.partitionManager, eventHubAsyncClient, + eventHubAsyncClient.getEventHubName(), + consumerGroup, identifier, TimeUnit.MINUTES.toSeconds(1), partitionPumpManager); + } + + /** + * Looks for a user-defined PartitionManager implementation in classpath. + *

+ * If there are more than one user-defined PartitionManagers, this method will throw an exception. User has to + * specify a PartitionManager explicitly in {@link EventProcessorBuilder}. + *

+ * + * @return A {@link PartitionManager} implementation found in classpath, or {@link InMemoryPartitionManager} + * otherwise. + */ + private PartitionManager findPartitionManager() { + ServiceLoader partitionManagers = ServiceLoader.load(PartitionManager.class); + PartitionManager partitionManager = null; + + for (PartitionManager partitionManagerInClassPath : partitionManagers) { + if (partitionManager != null) { + // If more than one PartitionManager is found in classpath, throw an exception + // User has to specify which one to use. + throw logger.logExceptionAsWarning( + new IllegalStateException("Found multiple PartitionManagers in classpath. Specify one in " + + "EventProcessorOptions")); + } + if (!(partitionManagerInClassPath instanceof InMemoryPartitionManager)) { + // Don't consider InMemoryPartitionManager. + partitionManager = partitionManagerInClassPath; + } + } + + if (partitionManager == null) { + // No PartitionManagers found in classpath. + throw logger.logExceptionAsWarning( + new IllegalStateException("No PartitionManager implementation found in classpath.")); + } + return partitionManager; } /** @@ -93,7 +117,7 @@ public class EventProcessor { * * @return Identifier for this event processor. */ - public String identifier() { + public String getIdentifier() { return this.identifier; } @@ -116,7 +140,11 @@ public synchronized void start() { } logger.info("Starting a new event processor instance with id {}", this.identifier); scheduler = Schedulers.newElastic("EventProcessor"); - runner = scheduler.schedulePeriodically(this::run, INITIAL_DELAY, INTERVAL_IN_SECONDS, TimeUnit.SECONDS); + Double jitterInMillis = + ThreadLocalRandom.current().nextDouble() * TimeUnit.SECONDS.toMillis(BASE_JITTER_IN_SECONDS); + // Add a bit of jitter to initialDelay to minimize contention if multiple EventProcessors start at the same time + runner = scheduler.schedulePeriodically(partitionBasedLoadBalancer::loadBalance, jitterInMillis.longValue(), + TimeUnit.SECONDS.toMillis(INTERVAL_IN_SECONDS) /* TODO: make this configurable */, TimeUnit.MILLISECONDS); } /** @@ -134,109 +162,8 @@ public synchronized void stop() { logger.info("Event processor has already stopped"); return; } - this.partitionConsumers.forEach((key, value) -> { - try { - logger.info("Closing event hub consumer for partition {}", key); - value.close(); - logger.info("Closed event hub consumer for partition {}", key); - partitionConsumers.remove(key); - } catch (IOException ex) { - logger.warning("Unable to close event hub consumer for partition {}", key); - } - }); runner.dispose(); scheduler.dispose(); - } - - /* - * A simple implementation of an event processor that: - * 1. Fetches all partition ids from Event Hub - * 2. Gets the current ownership information of all the partitions from PartitionManager - * 3. Claims ownership of any partition that doesn't have an owner yet. - * 4. Starts a new PartitionProcessor and receives events from each of the partitions this instance owns - */ - private void run() { - /* This will run periodically to get new ownership details and close/open new - consumers when ownership of this instance has changed */ - final Flux ownershipFlux = partitionManager.listOwnership(eventHubName, consumerGroupName) - .cache(); - eventHubAsyncClient.getPartitionIds() - .flatMap(id -> getCandidatePartitions(ownershipFlux, id)) - .flatMap(this::claimOwnership) - .subscribe(this::receiveEvents, ex -> logger.warning("Failed to receive events {}", ex.getMessage()), - () -> logger.info("Completed starting partition pumps for new partitions owned")); - } - - /* - * Get the candidate partitions for claiming ownerships - */ - private Publisher getCandidatePartitions(Flux ownershipFlux, - String id) { - return ownershipFlux - // Ownership has never been claimed, so it won't exist in the list, so we provide a default. - .filter(ownership -> id.equals(ownership.partitionId())) - .single(new PartitionOwnership() - .partitionId(id) - .eventHubName(this.eventHubName) - .ownerId(this.identifier) - .consumerGroupName(this.consumerGroupName) - .ownerLevel(0L)); - } - - - /* - * Claim ownership of the given partition if it's available - */ - private Publisher claimOwnership(PartitionOwnership ownershipInfo) { - // Claim ownership if: - // it's not previously owned by any other instance, - // or if the last modified time is greater than ownership expiration time - // and previous owner is not this instance - if (ownershipInfo.lastModifiedTime() == null - || (System.currentTimeMillis() - ownershipInfo.lastModifiedTime() > OWNERSHIP_EXPIRATION_TIME_IN_MILLIS - && !ownershipInfo.ownerId().equals(this.identifier))) { - ownershipInfo.ownerId(this.identifier); // update instance id before claiming ownership - return partitionManager.claimOwnership(ownershipInfo).doOnComplete(() -> { - logger.info("Claimed ownership of partition {}", ownershipInfo.partitionId()); - }).doOnError(error -> { - logger.error("Unable to claim ownership of partition {}", ownershipInfo.partitionId(), error); - }); - } else { - return Flux.empty(); - } - } - - /* - * Creates a new consumer for given partition and starts receiving events for that partition. - */ - private void receiveEvents(PartitionOwnership partitionOwnership) { - EventHubConsumerOptions consumerOptions = new EventHubConsumerOptions(); - consumerOptions.ownerLevel(0L); - - EventPosition startFromEventPosition = partitionOwnership.sequenceNumber() == null ? this.initialEventPosition - : EventPosition.fromSequenceNumber(partitionOwnership.sequenceNumber(), false); - - EventHubAsyncConsumer consumer = this.eventHubAsyncClient - .createConsumer(this.consumerGroupName, partitionOwnership.partitionId(), startFromEventPosition, - consumerOptions); - this.partitionConsumers.put(partitionOwnership.partitionId(), consumer); - - PartitionContext partitionContext = new PartitionContext(partitionOwnership.partitionId(), this.eventHubName, - this.consumerGroupName); - CheckpointManager checkpointManager = new CheckpointManager(this.identifier, partitionContext, - this.partitionManager, null); - logger.info("Subscribing to receive events from partition {}", partitionOwnership.partitionId()); - PartitionProcessor partitionProcessor = this.partitionProcessorFactory - .createPartitionProcessor(partitionContext, checkpointManager); - partitionProcessor.initialize().subscribe(); - - consumer.receive().subscribeOn(Schedulers.newElastic("PartitionPump")) - .subscribe(eventData -> partitionProcessor.processEvent(eventData).subscribe(unused -> { - }, partitionProcessor::processError), - partitionProcessor::processError, - // Currently, there is no way to distinguish if the receiver was closed because - // another receiver with higher/same owner level(epoch) connected or because - // this event processor explicitly called close on this consumer. - () -> partitionProcessor.close(CloseReason.LOST_PARTITION_OWNERSHIP)); + this.partitionPumpManager.stopAllPartitionPumps(); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventProcessorBuilder.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventProcessorBuilder.java new file mode 100644 index 000000000000..0964d7e39441 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventProcessorBuilder.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import com.azure.core.amqp.implementation.TracerProvider; +import com.azure.core.implementation.tracing.Tracer; +import com.azure.core.util.logging.ClientLogger; +import com.azure.messaging.eventhubs.models.EventPosition; +import com.azure.messaging.eventhubs.models.PartitionContext; +import java.util.ServiceLoader; +import java.util.function.Function; +import java.util.function.Supplier; + +/** + * This class provides a fluent builder API to help aid the configuration and instantiation of the {@link + * EventProcessor}. Calling {@link #buildEventProcessor()} constructs a new instance of {@link EventProcessor}. + * + *

+ * To create an instance of {@link EventProcessor} that processes events with user-provided callback, configure the + * following fields: + * + *

    + *
  • {@link #consumerGroup(String) Consumer group name}.
  • + *
  • {@link EventHubAsyncClient} - An asynchronous Event Hub client the {@link EventProcessor} will use for + * consuming events.
  • + *
  • {@link PartitionManager} - An instance of PartitionManager. To get started, you can pass an instance of + * {@link InMemoryPartitionManager}. For production, choose an implementation that will store checkpoints and partition + * ownership details to a durable store.
  • + *
  • {@link #partitionProcessorFactory(Supplier) partitionProcessorFactory} - A user-defined {@link Function} that + * creates + * new instances of {@link PartitionProcessor} for processing events. Users should extend from + * {@link PartitionProcessor} abstract class to implement + * {@link PartitionProcessor#processEvent(PartitionContext, EventData)}.
  • + *
+ * + *

Creating an {@link EventProcessor}

+ * {@codesnippet com.azure.messaging.eventhubs.eventprocessorbuilder.instantiation} + * + * @see EventProcessor + * @see EventHubConsumer + */ +public class EventProcessorBuilder { + + private final ClientLogger logger = new ClientLogger(EventProcessorBuilder.class); + + private Supplier partitionProcessorFactory; + private String consumerGroup; + private PartitionManager partitionManager; + private EventHubAsyncClient eventHubAsyncClient; + + /** + * Sets the Event Hub client the {@link EventProcessor} will use to connect to the Event Hub for consuming events. + * + * @param eventHubAsyncClient The Event Hub asynchronous client for consuming events. + * @return The updated {@link EventProcessorBuilder} instance. + */ + public EventProcessorBuilder eventHubClient(EventHubAsyncClient eventHubAsyncClient) { + this.eventHubAsyncClient = eventHubAsyncClient; + return this; + } + + /** + * Sets the consumer group name from which the {@link EventProcessor} should consume events. + * + * @param consumerGroup The consumer group name this {@link EventProcessor} should consume events. + * @return The updated {@link EventProcessorBuilder} instance. + */ + public EventProcessorBuilder consumerGroup(String consumerGroup) { + this.consumerGroup = consumerGroup; + return this; + } + + /** + * Sets the {@link PartitionManager} the {@link EventProcessor} will use for storing partition ownership and + * checkpoint information. + * + *

+ * Users can, optionally, provide their own implementation of {@link PartitionManager} which will store ownership + * and checkpoint information. If not provided, the {@link EventProcessor} will first check for any available + * implementation of {@link PartitionManager} in the classpath and fallback to {@link InMemoryPartitionManager} if + * none found. + *

+ * + * @param partitionManager Implementation of {@link PartitionManager}. + * @return The updated {@link EventProcessorBuilder} instance. + */ + public EventProcessorBuilder partitionManager(PartitionManager partitionManager) { + this.partitionManager = partitionManager; + return this; + } + + /** + * Sets the partition processor factory for creating new instance(s) of {@link PartitionProcessor}. + *

+ * Use this to have finer control over processing events from partitions. This will also allow you to control the + * frequency of checkpointing. + *

+ * + * @param partitionProcessorFactory The factory that creates new {@link PartitionProcessor} for each partition. + * @return The updated {@link EventProcessorBuilder} instance. + */ + public EventProcessorBuilder partitionProcessorFactory(Supplier partitionProcessorFactory) { + this.partitionProcessorFactory = partitionProcessorFactory; + return this; + } + + /** + * This will create a new {@link EventProcessor} configured with the options set in this builder. Each call to this + * method will return a new instance of {@link EventProcessor}. + * + *

+ * All partitions processed by this {@link EventProcessor} will start processing from {@link + * EventPosition#earliest() earliest} available event in the respective partitions. + *

+ * + * @return A new instance of {@link EventProcessor}. + */ + public EventProcessor buildEventProcessor() { + final TracerProvider tracerProvider = new TracerProvider(ServiceLoader.load(Tracer.class)); + return new EventProcessor(eventHubAsyncClient, this.consumerGroup, + this.partitionProcessorFactory, EventPosition.earliest(), partitionManager, tracerProvider); + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/InMemoryPartitionManager.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/InMemoryPartitionManager.java index 041c116e93cb..cb4607cf853a 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/InMemoryPartitionManager.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/InMemoryPartitionManager.java @@ -6,14 +6,17 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.models.Checkpoint; import com.azure.messaging.eventhubs.models.PartitionOwnership; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + import java.util.Map; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; /** - * A simple in-memory implementation of a {@link PartitionManager}. + * A simple in-memory implementation of a {@link PartitionManager}. This implementation keeps track of partition + * ownership details including checkpointing information in-memory. Using this implementation will only facilitate + * checkpointing and load balancing of Event Processors running within this process. */ public class InMemoryPartitionManager implements PartitionManager { @@ -45,17 +48,17 @@ public Flux listOwnership(String eventHubName, String consum public Flux claimOwnership(PartitionOwnership... requestedPartitionOwnerships) { return Flux.fromArray(requestedPartitionOwnerships) .filter(partitionOwnership -> { - return !partitionOwnershipMap.containsKey(partitionOwnership.partitionId()) - || partitionOwnershipMap.get(partitionOwnership.partitionId()).eTag() - .equals(partitionOwnership.eTag()); + return !partitionOwnershipMap.containsKey(partitionOwnership.getPartitionId()) + || partitionOwnershipMap.get(partitionOwnership.getPartitionId()).getETag() + .equals(partitionOwnership.getETag()); }) .doOnNext(partitionOwnership -> logger - .info("Ownership of partition {} claimed by {}", partitionOwnership.partitionId(), - partitionOwnership.ownerId())) + .info("Ownership of partition {} claimed by {}", partitionOwnership.getPartitionId(), + partitionOwnership.getOwnerId())) .map(partitionOwnership -> { - partitionOwnership.eTag(UUID.randomUUID().toString()) - .lastModifiedTime(System.currentTimeMillis()); - partitionOwnershipMap.put(partitionOwnership.partitionId(), partitionOwnership); + partitionOwnership.setETag(UUID.randomUUID().toString()) + .setLastModifiedTime(System.currentTimeMillis()); + partitionOwnershipMap.put(partitionOwnership.getPartitionId(), partitionOwnership); return partitionOwnership; }); } @@ -69,12 +72,12 @@ public Flux claimOwnership(PartitionOwnership... requestedPa @Override public Mono updateCheckpoint(final Checkpoint checkpoint) { String updatedETag = UUID.randomUUID().toString(); - partitionOwnershipMap.get(checkpoint.partitionId()) - .sequenceNumber(checkpoint.sequenceNumber()) - .offset(checkpoint.offset()) - .eTag(updatedETag); - logger.info("Updated checkpoint for partition {} with sequence number {}", checkpoint.partitionId(), - checkpoint.sequenceNumber()); + partitionOwnershipMap.get(checkpoint.getPartitionId()) + .setSequenceNumber(checkpoint.getSequenceNumber()) + .setOffset(checkpoint.getOffset()) + .setETag(updatedETag); + logger.info("Updated checkpoint for partition {} with sequence number {}", checkpoint.getPartitionId(), + checkpoint.getSequenceNumber()); return Mono.just(updatedETag); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionManager.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionManager.java index d7fb6945df95..da3f4fdb00f5 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionManager.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionManager.java @@ -5,12 +5,11 @@ import com.azure.messaging.eventhubs.models.Checkpoint; import com.azure.messaging.eventhubs.models.PartitionOwnership; - import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; /** - * Partition manager stores and retrieves partition ownership information and checkpoint details for each partition. + * A partition manager stores and retrieves partition ownership information and checkpoint details for each partition. */ public interface PartitionManager { diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionProcessor.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionProcessor.java index a73e0e0190d1..217716395076 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionProcessor.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionProcessor.java @@ -3,58 +3,82 @@ package com.azure.messaging.eventhubs; +import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.models.PartitionContext; import reactor.core.publisher.Mono; /** - * The interface defining all the operations that must be supported by a single partition processor. + * An abstract class defining all the operations that a partition processor can perform. Users of {@link EventProcessor} + * should extend from this class and implement {@link #processEvent(PartitionContext, EventData)} for processing events. + * Additionally, users can override: + *
    + *
  • {@link #initialize(PartitionContext)} - This method is called before at the beginning of processing a + * partition.
  • + *
  • {@link #processError(PartitionContext, Throwable)} - This method is called if there is an error while + * processing events
  • + *
  • {@link #close(PartitionContext, CloseReason)} - This method is called at the end of processing a partition. + * The {@link CloseReason} specifies why the processing of a partition stopped.
  • + *
*

- * An instance of partition processor will process events only from a single partition. New instances of partition - * processors will be created through {@link PartitionProcessorFactory#createPartitionProcessor(PartitionContext, - * CheckpointManager) PartitionProcessorFactory}. - *

- *

- * Implementations of this interface also have the responsibility of updating checkpoints when appropriate. + * An instance of partition processor will process events from a single partition only. *

+ *

Implementations of this abstract class also have the responsibility of updating checkpoints when appropriate.

*/ -public interface PartitionProcessor { +public abstract class PartitionProcessor { + + private final ClientLogger logger = new ClientLogger(PartitionProcessor.class); /** - * This method is called when this {@link EventProcessor} takes ownership of a new partition and before any - * events from this partition are received. + * This method is called when this {@link EventProcessor} takes ownership of a new partition and before any events + * from this partition are received. * + * @param partitionContext The partition information for initialization before events from the partition are + * processed. * @return a representation of the deferred computation of this call. */ - Mono initialize(); + public Mono initialize(PartitionContext partitionContext) { + logger.info("Initializing partition processor for partition {}", partitionContext.getPartitionId()); + return Mono.empty(); + } /** * This method is called when a new event is received for this partition. Processing of this event can happen * asynchronously. * *

- * This is also a good place to update checkpoints as appropriate. + * This is also a good place to update checkpoints using the {@code partitionContext} as appropriate. * + * @param partitionContext The partition information the event data belongs to. * @param eventData {@link EventData} received from this partition. * @return a representation of the deferred computation of this call. */ - Mono processEvent(EventData eventData); + public abstract Mono processEvent(PartitionContext partitionContext, EventData eventData); /** * This method is called when an error occurs while receiving events from Event Hub. An error also marks the end of * event data stream. * + * @param partitionContext The partition information where the error occurred. * @param throwable The {@link Throwable} that caused this method to be called. */ - void processError(Throwable throwable); + public void processError(PartitionContext partitionContext, Throwable throwable) { + logger.warning("Error occurred in partition processor for partition {}", partitionContext.getPartitionId(), + throwable); + } /** * This method is called before the partition processor is closed. A partition processor could be closed for various * reasons and the reasons and implementations of this interface can take appropriate actions to cleanup before the * partition processor is shutdown. * + * @param partitionContext The partition information for which the processing of events is closed. * @param closeReason The reason for closing this partition processor. * @return a representation of the deferred computation of this call. */ - Mono close(CloseReason closeReason); + public Mono close(PartitionContext partitionContext, CloseReason closeReason) { + logger.info("Closing partition processor for partition {} with close reason {}", + partitionContext.getPartitionId(), closeReason); + return Mono.empty(); + } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionProcessorFactory.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionProcessorFactory.java deleted file mode 100644 index 5f55d74e5b4a..000000000000 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionProcessorFactory.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.messaging.eventhubs; - -import com.azure.messaging.eventhubs.models.PartitionContext; - -/** - * A functional interface to create new instance(s) of {@link PartitionProcessor} when provided with a {@link - * PartitionContext} and {@link CheckpointManager}. - */ -@FunctionalInterface -public interface PartitionProcessorFactory { - - /** - * Factory method to create a new instance(s) of {@link PartitionProcessor} for a partition. - * - * @param partitionContext The partition context containing partition and Event Hub information. The new instance of - * {@link PartitionProcessor} created by this method will be responsible for processing events only for this - * partition. - * @param checkpointManager The checkpoint manager for updating checkpoints when events are processed by {@link - * PartitionProcessor}. - * @return A new instance of {@link PartitionProcessor} responsible for processing events from a single partition. - */ - PartitionProcessor createPartitionProcessor(PartitionContext partitionContext, - CheckpointManager checkpointManager); -} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionProperties.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionProperties.java index 0b7cc10c0572..2eb911b6f64c 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionProperties.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionProperties.java @@ -42,7 +42,7 @@ public final class PartitionProperties { * * @return The name of the Event Hub that contains the partition. */ - public String eventHubName() { + public String getEventHubName() { return this.eventHubName; } @@ -51,7 +51,7 @@ public String eventHubName() { * * @return The identifier of the partition within the Event Hub. */ - public String id() { + public String getId() { return this.id; } @@ -60,7 +60,7 @@ public String id() { * * @return The starting sequence number of the partition's message stream. */ - public long beginningSequenceNumber() { + public long getBeginningSequenceNumber() { return this.beginningSequenceNumber; } @@ -69,7 +69,7 @@ public long beginningSequenceNumber() { * * @return the last sequence number of the partition's message stream. */ - public long lastEnqueuedSequenceNumber() { + public long getLastEnqueuedSequenceNumber() { return this.lastEnqueuedSequenceNumber; } @@ -84,7 +84,7 @@ public long lastEnqueuedSequenceNumber() { * * @return the offset of the last enqueued message in the partition's stream. */ - public String lastEnqueuedOffset() { + public String getLastEnqueuedOffset() { return this.lastEnqueuedOffset; } @@ -93,7 +93,7 @@ public String lastEnqueuedOffset() { * * @return the instant, in UTC, of the last enqueued message in the partition's stream. */ - public Instant lastEnqueuedTime() { + public Instant getLastEnqueuedTime() { return this.lastEnqueuedTime; } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ActiveClientTokenManager.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ActiveClientTokenManager.java index a05f96148ba2..3967ac57f60c 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ActiveClientTokenManager.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ActiveClientTokenManager.java @@ -69,7 +69,8 @@ Flux getAuthorizationResults() { */ Mono authorize() { if (hasDisposed.get()) { - return Mono.error(new AzureException("Cannot authorize with CBS node when this token manager has been disposed of.")); + return Mono.error(new AzureException( + "Cannot authorize with CBS node when this token manager has been disposed of.")); } return cbsNode.flatMap(cbsNode -> cbsNode.authorize(tokenAudience)) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpErrorCode.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpErrorCode.java index 7f53459decff..209160188ae5 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpErrorCode.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpErrorCode.java @@ -11,8 +11,10 @@ */ public final class AmqpErrorCode { public static final Symbol NOT_FOUND = Symbol.getSymbol(ErrorCondition.NOT_FOUND.getErrorCondition()); - public static final Symbol UNAUTHORIZED_ACCESS = Symbol.getSymbol(ErrorCondition.UNAUTHORIZED_ACCESS.getErrorCondition()); - public static final Symbol RESOURCE_LIMIT_EXCEEDED = Symbol.getSymbol(ErrorCondition.RESOURCE_LIMIT_EXCEEDED.getErrorCondition()); + public static final Symbol UNAUTHORIZED_ACCESS = + Symbol.getSymbol(ErrorCondition.UNAUTHORIZED_ACCESS.getErrorCondition()); + public static final Symbol RESOURCE_LIMIT_EXCEEDED = + Symbol.getSymbol(ErrorCondition.RESOURCE_LIMIT_EXCEEDED.getErrorCondition()); public static final Symbol NOT_ALLOWED = Symbol.getSymbol(ErrorCondition.NOT_ALLOWED.getErrorCondition()); public static final Symbol INTERNAL_ERROR = Symbol.getSymbol(ErrorCondition.INTERNAL_ERROR.getErrorCondition()); public static final Symbol ILLEGAL_STATE = Symbol.getSymbol(ErrorCondition.ILLEGAL_STATE.getErrorCondition()); @@ -20,23 +22,33 @@ public final class AmqpErrorCode { // link errors public static final Symbol LINK_STOLEN = Symbol.getSymbol(ErrorCondition.LINK_STOLEN.getErrorCondition()); - public static final Symbol LINK_PAYLOAD_SIZE_EXCEEDED = Symbol.getSymbol(ErrorCondition.LINK_PAYLOAD_SIZE_EXCEEDED.getErrorCondition()); - public static final Symbol LINK_DETACH_FORCED = Symbol.getSymbol(ErrorCondition.LINK_DETACH_FORCED.getErrorCondition()); + public static final Symbol LINK_PAYLOAD_SIZE_EXCEEDED = + Symbol.getSymbol(ErrorCondition.LINK_PAYLOAD_SIZE_EXCEEDED.getErrorCondition()); + public static final Symbol LINK_DETACH_FORCED = + Symbol.getSymbol(ErrorCondition.LINK_DETACH_FORCED.getErrorCondition()); // connection errors - public static final Symbol CONNECTION_FORCED = Symbol.getSymbol(ErrorCondition.CONNECTION_FORCED.getErrorCondition()); + public static final Symbol CONNECTION_FORCED = + Symbol.getSymbol(ErrorCondition.CONNECTION_FORCED.getErrorCondition()); // proton library introduced this AMQP symbol in their code-base to communicate IOExceptions // while performing operations on SocketChannel (in IOHandler.java) public static final Symbol PROTON_IO_ERROR = Symbol.getSymbol("proton:io"); - public static final Symbol SERVER_BUSY_ERROR = Symbol.getSymbol(ErrorCondition.SERVER_BUSY_ERROR.getErrorCondition()); + public static final Symbol SERVER_BUSY_ERROR = + Symbol.getSymbol(ErrorCondition.SERVER_BUSY_ERROR.getErrorCondition()); public static final Symbol ARGUMENT_ERROR = Symbol.getSymbol(ErrorCondition.ARGUMENT_ERROR.getErrorCondition()); - public static final Symbol ARGUMENT_OUT_OF_RANGE_ERROR = Symbol.getSymbol(ErrorCondition.ARGUMENT_OUT_OF_RANGE_ERROR.getErrorCondition()); - public static final Symbol ENTITY_DISABLED_ERROR = Symbol.getSymbol(ErrorCondition.ENTITY_DISABLED_ERROR.getErrorCondition()); - public static final Symbol PARTITION_NOT_OWNED_ERROR = Symbol.getSymbol(ErrorCondition.PARTITION_NOT_OWNED_ERROR.getErrorCondition()); - public static final Symbol STORE_LOCK_LOST_ERROR = Symbol.getSymbol(ErrorCondition.STORE_LOCK_LOST_ERROR.getErrorCondition()); - public static final Symbol PUBLISHER_REVOKED_ERROR = Symbol.getSymbol(ErrorCondition.PUBLISHER_REVOKED_ERROR.getErrorCondition()); + public static final Symbol ARGUMENT_OUT_OF_RANGE_ERROR = + Symbol.getSymbol(ErrorCondition.ARGUMENT_OUT_OF_RANGE_ERROR.getErrorCondition()); + public static final Symbol ENTITY_DISABLED_ERROR = + Symbol.getSymbol(ErrorCondition.ENTITY_DISABLED_ERROR.getErrorCondition()); + public static final Symbol PARTITION_NOT_OWNED_ERROR = + Symbol.getSymbol(ErrorCondition.PARTITION_NOT_OWNED_ERROR.getErrorCondition()); + public static final Symbol STORE_LOCK_LOST_ERROR = + Symbol.getSymbol(ErrorCondition.STORE_LOCK_LOST_ERROR.getErrorCondition()); + public static final Symbol PUBLISHER_REVOKED_ERROR = + Symbol.getSymbol(ErrorCondition.PUBLISHER_REVOKED_ERROR.getErrorCondition()); public static final Symbol TIMEOUT_ERROR = Symbol.getSymbol(ErrorCondition.TIMEOUT_ERROR.getErrorCondition()); - public static final Symbol TRACKING_ID_PROPERTY = Symbol.getSymbol(ErrorCondition.TRACKING_ID_PROPERTY.getErrorCondition()); + public static final Symbol TRACKING_ID_PROPERTY = + Symbol.getSymbol(ErrorCondition.TRACKING_ID_PROPERTY.getErrorCondition()); } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/CBSChannel.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/CBSChannel.java index 6f1059879317..4e41805019c2 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/CBSChannel.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/CBSChannel.java @@ -66,22 +66,23 @@ public Mono authorize(final String tokenAudience) { final Message request = Proton.message(); final Map properties = new HashMap<>(); properties.put(PUT_TOKEN_OPERATION, PUT_TOKEN_OPERATION_VALUE); - properties.put(PUT_TOKEN_TYPE, String.format(Locale.ROOT, PUT_TOKEN_TYPE_VALUE_FORMAT, authorizationType.getTokenType())); + properties.put(PUT_TOKEN_TYPE, String.format(Locale.ROOT, PUT_TOKEN_TYPE_VALUE_FORMAT, + authorizationType.getTokenType())); properties.put(PUT_TOKEN_AUDIENCE, tokenAudience); final ApplicationProperties applicationProperties = new ApplicationProperties(properties); request.setApplicationProperties(applicationProperties); return credential.getToken(tokenAudience).flatMap(accessToken -> { - request.setBody(new AmqpValue(accessToken.token())); + request.setBody(new AmqpValue(accessToken.getToken())); return cbsChannelMono.flatMap(x -> x.sendWithAck(request, provider.getReactorDispatcher())) - .then(Mono.fromCallable(() -> accessToken.expiresOn())); + .then(Mono.fromCallable(() -> accessToken.getExpiresOn())); }); } @Override public void close() { - final RequestResponseChannel channel = cbsChannelMono.block(retryOptions.tryTimeout()); + final RequestResponseChannel channel = cbsChannelMono.block(retryOptions.getTryTimeout()); if (channel != null) { channel.close(); } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ClientConstants.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ClientConstants.java index 910e330259d1..9a3920fa746d 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ClientConstants.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ClientConstants.java @@ -13,7 +13,7 @@ public final class ClientConstants { public static final int SERVER_BUSY_BASE_SLEEP_TIME_IN_SECS = 4; public static final String PRODUCT_NAME = "azsdk-java-eventhubs"; - public static final String CURRENT_JAVA_CLIENT_VERSION = "1.0.0-preview.2"; + public static final String CURRENT_JAVA_CLIENT_VERSION = "5.0.0-preview.4"; public static final String PLATFORM_INFO = getOSInformation(); public static final String FRAMEWORK_INFO = getFrameworkInfo(); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ConnectionOptions.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ConnectionOptions.java index 194ff8154d49..f4fc839f858c 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ConnectionOptions.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ConnectionOptions.java @@ -45,35 +45,35 @@ public ConnectionOptions(String host, String eventHubName, TokenCredential token this.scheduler = scheduler; } - public String host() { + public String getHost() { return host; } - public String eventHubName() { + public String getEventHubName() { return eventHubName; } - public TokenCredential tokenCredential() { + public TokenCredential getTokenCredential() { return tokenCredential; } - public CBSAuthorizationType authorizationType() { + public CBSAuthorizationType getAuthorizationType() { return authorizationType; } - public TransportType transportType() { + public TransportType getTransportType() { return transport; } - public RetryOptions retry() { + public RetryOptions getRetry() { return retryOptions; } - public ProxyConfiguration proxyConfiguration() { + public ProxyConfiguration getProxyConfiguration() { return proxyConfiguration; } - public Scheduler scheduler() { + public Scheduler getScheduler() { return scheduler; } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ConnectionStringProperties.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ConnectionStringProperties.java index 5681a7e5d8d4..e1ca0d59e9a0 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ConnectionStringProperties.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ConnectionStringProperties.java @@ -3,14 +3,13 @@ package com.azure.messaging.eventhubs.implementation; -import com.azure.core.implementation.util.ImplUtils; - import java.net.URI; import java.net.URISyntaxException; import java.util.Locale; +import java.util.Objects; /** - * The set of properties that comprise a connection string from the Azure portal. + * The set of properties that comprise a connection string from the Azure portal. */ public class ConnectionStringProperties { private static final String TOKEN_VALUE_SEPARATOR = "="; @@ -33,12 +32,14 @@ public class ConnectionStringProperties { * Creates a new instance by parsing the {@code connectionString} into its components. * * @param connectionString The connection string to the Event Hub instance. - * @throws IllegalArgumentException if {@code connectionString} is {@code null} or empty, the connection string has - * an invalid format. + * @throws NullPointerException if {@code connectionString} is null. + * @throws IllegalArgumentException if {@code connectionString} is an empty string or the connection string has + * an invalid format. */ public ConnectionStringProperties(String connectionString) { - if (ImplUtils.isNullOrEmpty(connectionString)) { - throw new IllegalArgumentException("'connectionString' cannot be null or empty"); + Objects.requireNonNull(connectionString, "'connectionString' cannot be null."); + if (connectionString.isEmpty()) { + throw new IllegalArgumentException("'connectionString' cannot be an empty string."); } final String[] tokenValuePairs = connectionString.split(TOKEN_VALUE_PAIR_DELIMITER); @@ -50,7 +51,10 @@ public ConnectionStringProperties(String connectionString) { for (String tokenValuePair : tokenValuePairs) { final String[] pair = tokenValuePair.split(TOKEN_VALUE_SEPARATOR, 2); if (pair.length != 2) { - throw new IllegalArgumentException(String.format(Locale.US, "Connection string has invalid key value pair: %s", tokenValuePair)); + throw new IllegalArgumentException(String.format( + Locale.US, + "Connection string has invalid key value pair: %s", + tokenValuePair)); } final String key = pair[0].trim(); @@ -60,12 +64,17 @@ public ConnectionStringProperties(String connectionString) { try { endpoint = new URI(value); } catch (URISyntaxException e) { - throw new IllegalArgumentException(String.format(Locale.US, "Invalid endpoint: %s", tokenValuePair), e); + throw new IllegalArgumentException( + String.format(Locale.US, "Invalid endpoint: %s", tokenValuePair), e); } if (!SCHEME.equalsIgnoreCase(endpoint.getScheme())) { - throw new IllegalArgumentException(String.format(Locale.US, - "Endpoint is not the correct scheme. Expected: %s. Actual Endpoint: %s", SCHEME, endpoint.toString())); + throw new IllegalArgumentException( + String.format( + Locale.US, + "Endpoint is not the correct scheme. Expected: %s. Actual Endpoint: %s", + SCHEME, + endpoint.toString())); } } else if (key.equalsIgnoreCase(SHARED_ACCESS_KEY_NAME)) { sharedAccessKeyName = value; @@ -94,7 +103,7 @@ public ConnectionStringProperties(String connectionString) { * * @return The endpoint address, including protocol, from the connection string. */ - public URI endpoint() { + public URI getEndpoint() { return endpoint; } @@ -103,7 +112,7 @@ public URI endpoint() { * * @return The name of the specific Event Hub under the namespace. */ - public String eventHubName() { + public String getEventHubName() { return eventHubName; } @@ -112,7 +121,7 @@ public String eventHubName() { * * @return The name of the shared access key. */ - public String sharedAccessKeyName() { + public String getSharedAccessKeyName() { return sharedAccessKeyName; } @@ -121,7 +130,7 @@ public String sharedAccessKeyName() { * * @return The value of the shared access key. */ - public String sharedAccessKey() { + public String getSharedAccessKey() { return sharedAccessKey; } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EndpointStateNotifierBase.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EndpointStateNotifierBase.java index 728ebce871eb..d48a5c125aeb 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EndpointStateNotifierBase.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EndpointStateNotifierBase.java @@ -17,7 +17,8 @@ import java.util.Objects; abstract class EndpointStateNotifierBase implements EndpointStateNotifier, Closeable { - private final ReplayProcessor connectionStateProcessor = ReplayProcessor.cacheLastOrDefault(AmqpEndpointState.UNINITIALIZED); + private final ReplayProcessor connectionStateProcessor = + ReplayProcessor.cacheLastOrDefault(AmqpEndpointState.UNINITIALIZED); private final DirectProcessor errorContextProcessor = DirectProcessor.create(); private final DirectProcessor shutdownSignalProcessor = DirectProcessor.create(); private final Disposable subscription; diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EventDataUtil.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EventDataUtil.java index 68d224b907e0..2de7bb72cd39 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EventDataUtil.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EventDataUtil.java @@ -79,8 +79,8 @@ static int getDataSerializedSize(Message amqpMessage) { private static Message toAmqpMessage(String partitionKey, EventData eventData) { final Message message = Proton.message(); - if (eventData.properties() != null && !eventData.properties().isEmpty()) { - message.setApplicationProperties(new ApplicationProperties(eventData.properties())); + if (eventData.getProperties() != null && !eventData.getProperties().isEmpty()) { + message.setApplicationProperties(new ApplicationProperties(eventData.getProperties())); } if (!ImplUtils.isNullOrEmpty(partitionKey)) { @@ -93,8 +93,8 @@ private static Message toAmqpMessage(String partitionKey, EventData eventData) { setSystemProperties(eventData, message); - if (eventData.body() != null) { - message.setBody(new Data(Binary.create(eventData.body()))); + if (eventData.getBody() != null) { + message.setBody(new Data(Binary.create(eventData.getBody()))); } return message; @@ -104,11 +104,11 @@ private static Message toAmqpMessage(String partitionKey, EventData eventData) { * Sets AMQP protocol header values on the AMQP message. */ private static void setSystemProperties(EventData eventData, Message message) { - if (eventData.systemProperties() == null || eventData.systemProperties().isEmpty()) { + if (eventData.getSystemProperties() == null || eventData.getSystemProperties().isEmpty()) { return; } - eventData.systemProperties().forEach((key, value) -> { + eventData.getSystemProperties().forEach((key, value) -> { if (EventData.RESERVED_SYSTEM_PROPERTIES.contains(key)) { return; } @@ -157,7 +157,11 @@ private static void setSystemProperties(EventData eventData, Message message) { message.setReplyToGroupId((String) value); break; default: - throw new IllegalArgumentException(String.format(Locale.US, "Property is not a recognized reserved property name: %s", key)); + throw new IllegalArgumentException( + String.format( + Locale.US, + "Property is not a recognized reserved property name: %s", + key)); } } else { final MessageAnnotations messageAnnotations = (message.getMessageAnnotations() == null) @@ -234,7 +238,8 @@ private static int sizeof(Object obj) { return Double.BYTES; } - throw new IllegalArgumentException(String.format(Locale.US, "Encoding Type: %s is not supported", obj.getClass())); + throw new IllegalArgumentException(String.format(Locale.US, "Encoding Type: %s is not supported", + obj.getClass())); } private EventDataUtil() { diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ManagementChannel.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ManagementChannel.java index 44e3fc8a87de..b2d4e25c5153 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ManagementChannel.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ManagementChannel.java @@ -124,7 +124,7 @@ private Mono getProperties(Map properties, Function { - properties.put(MANAGEMENT_SECURITY_TOKEN_KEY, accessToken.token()); + properties.put(MANAGEMENT_SECURITY_TOKEN_KEY, accessToken.getToken()); final Message request = Proton.message(); final ApplicationProperties applicationProperties = new ApplicationProperties(properties); @@ -132,12 +132,14 @@ private Mono getProperties(Map properties, Function x.sendWithAck(request, provider.getReactorDispatcher())).map(message -> { if (!(message.getBody() instanceof AmqpValue)) { - throw new IllegalArgumentException("Expected message.getBody() to be AmqpValue, but is: " + message.getBody()); + throw logger.logExceptionAsError(new IllegalArgumentException( + "Expected message.getBody() to be AmqpValue, but is: " + message.getBody())); } AmqpValue body = (AmqpValue) message.getBody(); if (!(body.getValue() instanceof Map)) { - throw new IllegalArgumentException("Expected message.getBody().getValue() to be of type Map"); + throw logger.logExceptionAsError(new IllegalArgumentException( + "Expected message.getBody().getValue() to be of type Map")); } Map map = (Map) body.getValue(); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/PartitionBasedLoadBalancer.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/PartitionBasedLoadBalancer.java new file mode 100644 index 000000000000..9700a29ca10e --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/PartitionBasedLoadBalancer.java @@ -0,0 +1,358 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs.implementation; + +import com.azure.core.implementation.util.ImplUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.messaging.eventhubs.EventHubAsyncClient; +import com.azure.messaging.eventhubs.EventHubAsyncConsumer; +import com.azure.messaging.eventhubs.EventProcessor; +import com.azure.messaging.eventhubs.PartitionManager; +import com.azure.messaging.eventhubs.models.PartitionOwnership; +import reactor.core.Exceptions; +import reactor.core.publisher.Mono; +import reactor.util.function.Tuple2; + +import java.time.Duration; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Random; +import java.util.concurrent.TimeUnit; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static java.util.stream.Collectors.mapping; +import static java.util.stream.Collectors.toList; + +/** + * This class is responsible for balancing the load of processing events from all partitions of an Event Hub by + * distributing the number of partitions uniformly among all the active {@link EventProcessor EventProcessors}. + *

+ * This load balancer will retrieve partition ownership details from the {@link PartitionManager} to find the number of + * active {@link EventProcessor EventProcessors}. It uses the last modified time to decide if an EventProcessor is + * active. If a partition ownership entry has not be updated for a specified duration of time, the owner of that + * partition is considered inactive and the partition is available for other EventProcessors to own. + *

+ */ +public final class PartitionBasedLoadBalancer { + + private static final Random RANDOM = new Random(); + private final ClientLogger logger = new ClientLogger(PartitionBasedLoadBalancer.class); + + private final String eventHubName; + private final String consumerGroupName; + private final PartitionManager partitionManager; + private final EventHubAsyncClient eventHubAsyncClient; + private final String ownerId; + private final long inactiveTimeLimitInSeconds; + private final PartitionPumpManager partitionPumpManager; + + /** + * Creates an instance of PartitionBasedLoadBalancer for the given Event Hub name and consumer group. + * + * @param partitionManager The partition manager that this load balancer will use to read/update ownership details. + * @param eventHubAsyncClient The asynchronous Event Hub client used to consume events. + * @param eventHubName The Event Hub name the {@link EventProcessor} is associated with. + * @param consumerGroupName The consumer group name the {@link EventProcessor} is associated with. + * @param ownerId The identifier of the {@link EventProcessor} that owns this load balancer. + * @param inactiveTimeLimitInSeconds The time in seconds to wait for an update on an ownership record before + * assuming the owner of the partition is inactive. + * @param partitionPumpManager The partition pump manager that keeps track of all EventHubConsumers and partitions + * that this {@link EventProcessor} is processing. + */ + public PartitionBasedLoadBalancer(final PartitionManager partitionManager, + final EventHubAsyncClient eventHubAsyncClient, + final String eventHubName, final String consumerGroupName, final String ownerId, + final long inactiveTimeLimitInSeconds, final PartitionPumpManager partitionPumpManager) { + this.partitionManager = partitionManager; + this.eventHubAsyncClient = eventHubAsyncClient; + this.eventHubName = eventHubName; + this.consumerGroupName = consumerGroupName; + this.ownerId = ownerId; + this.inactiveTimeLimitInSeconds = inactiveTimeLimitInSeconds; + this.partitionPumpManager = partitionPumpManager; + } + + /** + * This is the main method responsible for load balancing. This method is expected to be invoked by the {@link + * EventProcessor} periodically. Every call to this method will result in this {@link EventProcessor} owning at + * most one new partition. + *

+ * The load is considered balanced when no active EventProcessor owns 2 partitions more than any other active + * EventProcessor. Given that each invocation to this method results in ownership claim of at most one partition, + * this algorithm converges gradually towards a steady state. + *

+ * When a new partition is claimed, this method is also responsible for starting a partition pump that creates an + * {@link EventHubAsyncConsumer} for processing events from that partition. + */ + public void loadBalance() { + /* + * Retrieve current partition ownership details from the datastore. + */ + final Mono> partitionOwnershipMono = partitionManager + .listOwnership(eventHubName, consumerGroupName) + .timeout(Duration.ofSeconds(1)) // TODO: configurable by the user + .collectMap(PartitionOwnership::getPartitionId, Function.identity()); + + /* + * Retrieve the list of partition ids from the Event Hub. + */ + final Mono> partitionsMono = eventHubAsyncClient + .getPartitionIds() + .timeout(Duration.ofSeconds(1)) // TODO: configurable + .collectList(); + + Mono.zip(partitionOwnershipMono, partitionsMono) + .flatMap(this::loadBalance) + // if there was an error, log warning and TODO: call user provided error handler + .doOnError(ex -> logger.warning("Load balancing for event processor failed - {}", ex.getMessage())) + .subscribe(); + } + + /* + * This method works with the given partition ownership details and Event Hub partitions to evaluate whether the + * current Event Processor should take on the responsibility of processing more partitions. + */ + private Mono loadBalance(final Tuple2, List> tuple) { + return Mono.fromRunnable(() -> { + logger.info("Starting load balancer"); + Map partitionOwnershipMap = tuple.getT1(); + + List partitionIds = tuple.getT2(); + + if (ImplUtils.isNullOrEmpty(partitionIds)) { + // This may be due to an error when getting Event Hub metadata. + throw logger.logExceptionAsError(Exceptions.propagate( + new IllegalStateException("There are no partitions in Event Hub " + eventHubName))); + } + + int numberOfPartitions = partitionIds.size(); + logger.info("Partition manager returned {} ownership records", partitionOwnershipMap.size()); + logger.info("EventHubAsyncClient returned {} partitions", numberOfPartitions); + if (!isValid(partitionOwnershipMap)) { + // User data is corrupt. + throw logger.logExceptionAsError(Exceptions.propagate( + new IllegalStateException("Invalid partitionOwnership data from PartitionManager"))); + } + + /* + * Remove all partitions' ownership that have not been modified for a configuration period of time. This + * means that the previous EventProcessor that owned the partition is probably down and the partition is now + * eligible to be claimed by other EventProcessors. + */ + Map activePartitionOwnershipMap = removeInactivePartitionOwnerships( + partitionOwnershipMap); + logger.info("Number of active ownership records {}", activePartitionOwnershipMap.size()); + + if (ImplUtils.isNullOrEmpty(activePartitionOwnershipMap)) { + /* + * If the active partition ownership map is empty, this is the first time an event processor is + * running or all Event Processors are down for this Event Hub, consumer group combination. All + * partitions in this Event Hub are available to claim. Choose a random partition to claim ownership. + */ + claimOwnership(partitionOwnershipMap, partitionIds.get(RANDOM.nextInt(numberOfPartitions))); + return; + } + + /* + * Create a map of owner id and a list of partitions it owns + */ + Map> ownerPartitionMap = activePartitionOwnershipMap.values() + .stream() + .collect( + Collectors.groupingBy(PartitionOwnership::getOwnerId, mapping(Function.identity(), toList()))); + + // add the current event processor to the map if it doesn't exist + ownerPartitionMap.putIfAbsent(this.ownerId, new ArrayList<>()); + + /* + * Find the minimum number of partitions every event processor should own when the load is + * evenly distributed. + */ + int numberOfActiveEventProcessors = ownerPartitionMap.size(); + logger.info("Number of active event processors {}", ownerPartitionMap.size()); + + int minPartitionsPerEventProcessor = numberOfPartitions / numberOfActiveEventProcessors; + + /* + * If the number of partitions in Event Hub is not evenly divisible by number of active event processors, + * a few Event Processors may own 1 additional partition than the minimum when the load is balanced. + * Calculate the number of event processors that can own additional partition. + */ + int numberOfEventProcessorsWithAdditionalPartition = numberOfPartitions % numberOfActiveEventProcessors; + + logger.info("Expected min partitions per event processor = {}, expected number of event " + + "processors with additional partition = {}", minPartitionsPerEventProcessor, + numberOfEventProcessorsWithAdditionalPartition); + + if (isLoadBalanced(minPartitionsPerEventProcessor, numberOfEventProcessorsWithAdditionalPartition, + ownerPartitionMap)) { + // If the partitions are evenly distributed among all active event processors, no change required. + logger.info("Load is balanced"); + return; + } + + if (!shouldOwnMorePartitions(minPartitionsPerEventProcessor, ownerPartitionMap)) { + // This event processor already has enough partitions and shouldn't own more. + logger.info("This event processor owns {} partitions and shouldn't own more", + ownerPartitionMap.get(ownerId).size()); + return; + } + + // If we have reached this stage, this event processor has to claim/steal ownership of at least 1 + // more partition + logger.info( + "Load is unbalanced and this event processor should own more partitions"); + /* + * If some partitions are unclaimed, this could be because an event processor is down and + * it's partitions are now available for others to own or because event processors are just + * starting up and gradually claiming partitions to own or new partitions were added to Event Hub. + * Find any partition that is not actively owned and claim it. + * + * OR + * + * Find a partition to steal from another event processor. Pick the event processor that has owns the + * highest number of partitions. + */ + String partitionToClaim = partitionIds.parallelStream() + .filter(partitionId -> !activePartitionOwnershipMap.containsKey(partitionId)) + .findAny() + .orElseGet(() -> { + logger.info("No unclaimed partitions, stealing from another event processor"); + return findPartitionToSteal(ownerPartitionMap); + }); + + claimOwnership(partitionOwnershipMap, partitionToClaim); + }); + } + + /* + * Check if partition ownership data is valid before proceeding with load balancing. + */ + private boolean isValid(final Map partitionOwnershipMap) { + return partitionOwnershipMap.values() + .stream() + .noneMatch(partitionOwnership -> { + return partitionOwnership.getEventHubName() == null + || !partitionOwnership.getEventHubName().equals(this.eventHubName) + || partitionOwnership.getConsumerGroupName() == null + || !partitionOwnership.getConsumerGroupName().equals(this.consumerGroupName) + || partitionOwnership.getPartitionId() == null + || partitionOwnership.getLastModifiedTime() == null + || partitionOwnership.getETag() == null; + }); + } + + /* + * Find the event processor that owns the maximum number of partitions and steal a random partition + * from it. + */ + private String findPartitionToSteal(final Map> ownerPartitionMap) { + Map.Entry> ownerWithMaxPartitions = ownerPartitionMap.entrySet() + .stream() + .max(Comparator.comparingInt(entry -> entry.getValue().size())) + .get(); + int numberOfPartitions = ownerWithMaxPartitions.getValue().size(); + logger.info("Owner id {} owns {} partitions, stealing a partition from it", ownerWithMaxPartitions.getKey(), + numberOfPartitions); + return ownerWithMaxPartitions.getValue().get(RANDOM.nextInt(numberOfPartitions)).getPartitionId(); + } + + /* + * When the load is balanced, all active event processors own at least {@code minPartitionsPerEventProcessor} + * and only {@code numberOfEventProcessorsWithAdditionalPartition} event processors will own 1 additional + * partition. + */ + private boolean isLoadBalanced(final int minPartitionsPerEventProcessor, + final int numberOfEventProcessorsWithAdditionalPartition, + final Map> ownerPartitionMap) { + + int count = 0; + for (List partitionOwnership : ownerPartitionMap.values()) { + int numberOfPartitions = partitionOwnership.size(); + if (numberOfPartitions < minPartitionsPerEventProcessor + || numberOfPartitions > minPartitionsPerEventProcessor + 1) { + return false; + } + + if (numberOfPartitions == minPartitionsPerEventProcessor + 1) { + count++; + } + } + return count == numberOfEventProcessorsWithAdditionalPartition; + } + + /* + * This method is called after determining that the load is not balanced. This method will evaluate + * if the current event processor should own more partitions. Specifically, this method returns true if the + * current event processor owns less than the minimum number of partitions or if it owns the minimum number + * and no other event processor owns lesser number of partitions than this event processor. + */ + private boolean shouldOwnMorePartitions(final int minPartitionsPerEventProcessor, + final Map> ownerPartitionMap) { + + int numberOfPartitionsOwned = ownerPartitionMap.get(this.ownerId).size(); + + int leastPartitionsOwnedByAnyEventProcessor = + ownerPartitionMap.values().stream().min(Comparator.comparingInt(List::size)).get().size(); + + return numberOfPartitionsOwned < minPartitionsPerEventProcessor + || numberOfPartitionsOwned == leastPartitionsOwnedByAnyEventProcessor; + } + + /* + * This method will create a new map of partition id and PartitionOwnership containing only those partitions + * that are actively owned. All entries in the original map returned by PartitionManager that haven't been + * modified for a duration of time greater than the allowed inactivity time limit are assumed to be owned by + * dead event processors. These will not be included in the map returned by this method. + */ + private Map removeInactivePartitionOwnerships( + final Map partitionOwnershipMap) { + return partitionOwnershipMap + .entrySet() + .stream() + .filter(entry -> { + return (System.currentTimeMillis() - entry.getValue().getLastModifiedTime() < TimeUnit.SECONDS + .toMillis(inactiveTimeLimitInSeconds)) && !ImplUtils.isNullOrEmpty(entry.getValue().getOwnerId()); + }).collect(Collectors.toMap(Entry::getKey, Entry::getValue)); + } + + private void claimOwnership(final Map partitionOwnershipMap, + final String partitionIdToClaim) { + logger.info("Attempting to claim ownership of partition {}", partitionIdToClaim); + PartitionOwnership ownershipRequest = createPartitionOwnershipRequest(partitionOwnershipMap, + partitionIdToClaim); + + partitionManager + .claimOwnership(ownershipRequest) + .timeout(Duration.ofSeconds(1)) // TODO: configurable + .doOnNext(partitionOwnership -> logger.info("Successfully claimed ownership of partition {}", + partitionOwnership.getPartitionId())) + .doOnError(ex -> logger + .warning("Failed to claim ownership of partition {} - {}", ownershipRequest.getPartitionId(), + ex.getMessage(), ex)) + .subscribe(partitionPumpManager::startPartitionPump); + } + + private PartitionOwnership createPartitionOwnershipRequest( + final Map partitionOwnershipMap, + final String partitionIdToClaim) { + PartitionOwnership previousPartitionOwnership = partitionOwnershipMap.get(partitionIdToClaim); + PartitionOwnership partitionOwnershipRequest = new PartitionOwnership() + .setOwnerId(this.ownerId) + .setPartitionId(partitionIdToClaim) + .setConsumerGroupName(this.consumerGroupName) + .setEventHubName(this.eventHubName) + .setSequenceNumber(previousPartitionOwnership == null + ? null + : previousPartitionOwnership.getSequenceNumber()) + .setOffset(previousPartitionOwnership == null ? null : previousPartitionOwnership.getOffset()) + .setETag(previousPartitionOwnership == null ? null : previousPartitionOwnership.getETag()) + .setOwnerLevel(0L); + return partitionOwnershipRequest; + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/PartitionPumpManager.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/PartitionPumpManager.java new file mode 100644 index 000000000000..965805db8d57 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/PartitionPumpManager.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs.implementation; + +import com.azure.core.amqp.exception.AmqpException; +import com.azure.core.amqp.implementation.TracerProvider; +import com.azure.core.implementation.tracing.ProcessKind; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.messaging.eventhubs.CloseReason; +import com.azure.messaging.eventhubs.EventData; +import com.azure.messaging.eventhubs.EventHubAsyncClient; +import com.azure.messaging.eventhubs.EventHubAsyncConsumer; +import com.azure.messaging.eventhubs.EventHubConsumer; +import com.azure.messaging.eventhubs.EventProcessor; +import com.azure.messaging.eventhubs.PartitionManager; +import com.azure.messaging.eventhubs.PartitionProcessor; +import com.azure.messaging.eventhubs.models.EventHubConsumerOptions; +import com.azure.messaging.eventhubs.models.EventPosition; +import com.azure.messaging.eventhubs.models.PartitionContext; +import com.azure.messaging.eventhubs.models.PartitionOwnership; +import reactor.core.publisher.Signal; + +import java.io.Closeable; +import java.io.IOException; +import java.util.Locale; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Supplier; + +import static com.azure.core.implementation.tracing.Tracer.DIAGNOSTIC_ID_KEY; +import static com.azure.core.implementation.tracing.Tracer.SPAN_CONTEXT; + +/** + * The partition pump manager that keeps track of all the partition pumps started by this {@link EventProcessor}. Each + * partition pump is an {@link EventHubConsumer} that is receiving events from partitions this {@link EventProcessor} + * has claimed ownership of. + * + *

+ * New partition pumps are created when this {@link EventProcessor} claims ownership of a new partition. When the {@link + * EventProcessor} is requested to stop, this class is responsible for stopping all event processing tasks and closing + * all connections to the Event Hub. + *

+ */ +public class PartitionPumpManager { + + private final ClientLogger logger = new ClientLogger(PartitionPumpManager.class); + private final Map partitionPumps = new ConcurrentHashMap<>(); + private final PartitionManager partitionManager; + private final Supplier partitionProcessorFactory; + private final EventPosition initialEventPosition; + private final EventHubAsyncClient eventHubAsyncClient; + private final TracerProvider tracerProvider; + + /** + * Creates an instance of partition pump manager. + * + * @param partitionManager The partition manager that is used to store and update checkpoints. + * @param partitionProcessorFactory The partition processor factory that is used to create new instances of {@link + * PartitionProcessor} when new partition pumps are started. + * @param initialEventPosition The initial event position to use when a new partition pump is created and no + * checkpoint for the partition is available. + * @param eventHubAsyncClient The client used to receive events from the Event Hub. + */ + public PartitionPumpManager(PartitionManager partitionManager, + Supplier partitionProcessorFactory, + EventPosition initialEventPosition, EventHubAsyncClient eventHubAsyncClient, TracerProvider tracerProvider) { + this.partitionManager = partitionManager; + this.partitionProcessorFactory = partitionProcessorFactory; + this.initialEventPosition = initialEventPosition; + this.eventHubAsyncClient = eventHubAsyncClient; + this.tracerProvider = tracerProvider; + } + + /** + * Stops all partition pumps that are actively consuming events. This method is invoked when the {@link + * EventProcessor} is requested to stop. + */ + public void stopAllPartitionPumps() { + this.partitionPumps.forEach((partitionId, eventHubConsumer) -> { + try { + eventHubConsumer.close(); + } catch (Exception ex) { + logger.warning("Failed to close consumer for partition {}", partitionId, ex); + } finally { + partitionPumps.remove(partitionId); + } + }); + } + + /** + * Starts a new partition pump for the newly claimed partition. If the partition already has an active partition + * pump, this will not create a new consumer. + * + * @param claimedOwnership The details of partition ownership for which new partition pump is requested to start. + */ + public void startPartitionPump(PartitionOwnership claimedOwnership) { + if (partitionPumps.containsKey(claimedOwnership.getPartitionId())) { + logger.info("Consumer is already running for this partition {}", claimedOwnership.getPartitionId()); + return; + } + + PartitionContext partitionContext = new PartitionContext(claimedOwnership.getPartitionId(), + claimedOwnership.getEventHubName(), claimedOwnership.getConsumerGroupName(), + claimedOwnership.getOwnerId(), claimedOwnership.getETag(), partitionManager); + PartitionProcessor partitionProcessor = this.partitionProcessorFactory.get(); + partitionProcessor.initialize(partitionContext); + + EventPosition startFromEventPosition; + if (claimedOwnership.getOffset() != null) { + startFromEventPosition = EventPosition.fromOffset(claimedOwnership.getOffset()); + } else if (claimedOwnership.getSequenceNumber() != null) { + startFromEventPosition = EventPosition.fromSequenceNumber(claimedOwnership.getSequenceNumber()); + } else { + startFromEventPosition = initialEventPosition; + } + + EventHubConsumerOptions eventHubConsumerOptions = new EventHubConsumerOptions().setOwnerLevel(0L); + EventHubAsyncConsumer eventHubConsumer = eventHubAsyncClient + .createConsumer(claimedOwnership.getConsumerGroupName(), claimedOwnership.getPartitionId(), + startFromEventPosition, + eventHubConsumerOptions); + + partitionPumps.put(claimedOwnership.getPartitionId(), eventHubConsumer); + eventHubConsumer.receive().subscribe(eventData -> { + try { + Context processSpanContext = startProcessTracingSpan(eventData); + if (processSpanContext.getData(SPAN_CONTEXT).isPresent()) { + eventData.addContext(SPAN_CONTEXT, processSpanContext); + } + partitionProcessor.processEvent(partitionContext, eventData).doOnEach(signal -> + endProcessTracingSpan(processSpanContext, signal)).subscribe(unused -> { + }, /* event processing returned error */ ex -> handleProcessingError(claimedOwnership, + eventHubConsumer, partitionProcessor, ex, partitionContext)); + } catch (Exception ex) { + /* event processing threw an exception */ + handleProcessingError(claimedOwnership, eventHubConsumer, partitionProcessor, ex, partitionContext); + } + }, /* EventHubConsumer receive() returned an error */ + ex -> handleReceiveError(claimedOwnership, eventHubConsumer, partitionProcessor, ex, partitionContext), + () -> partitionProcessor.close(partitionContext, CloseReason.EVENT_PROCESSOR_SHUTDOWN)); + } + + private void handleProcessingError(PartitionOwnership claimedOwnership, EventHubAsyncConsumer eventHubConsumer, + PartitionProcessor partitionProcessor, Throwable error, PartitionContext partitionContext) { + try { + // There was an error in process event (user provided code), call process error and if that + // also fails just log and continue + partitionProcessor.processError(partitionContext, error); + } catch (Exception ex) { + logger.warning("Failed while processing error {}", claimedOwnership.getPartitionId(), ex); + } + } + + private void handleReceiveError(PartitionOwnership claimedOwnership, EventHubAsyncConsumer eventHubConsumer, + PartitionProcessor partitionProcessor, Throwable error, PartitionContext partitionContext) { + try { + // if there was an error on receive, it also marks the end of the event data stream + partitionProcessor.processError(partitionContext, error); + CloseReason closeReason = CloseReason.EVENT_HUB_EXCEPTION; + // If the exception indicates that the partition was stolen (i.e some other consumer with same ownerlevel + // started consuming the partition), update the closeReason + // TODO: Find right exception type to determine stolen partition + if (error instanceof AmqpException) { + closeReason = CloseReason.LOST_PARTITION_OWNERSHIP; + } + partitionProcessor.close(partitionContext, closeReason); + } catch (Exception ex) { + logger.warning("Failed while processing error on receive {}", claimedOwnership.getPartitionId(), ex); + } finally { + try { + // close the consumer + eventHubConsumer.close(); + } catch (IOException ex) { + logger.warning("Failed to close EventHubConsumer for partition {}", claimedOwnership.getPartitionId(), + ex); + } finally { + // finally, remove the partition from partitionPumps map + partitionPumps.remove(claimedOwnership.getPartitionId()); + } + } + } + + /* + * Starts a new process tracing span and attached context the EventData object for users. + */ + private Context startProcessTracingSpan(EventData eventData) { + Object diagnosticId = eventData.getProperties().get(DIAGNOSTIC_ID_KEY); + if (diagnosticId == null || !tracerProvider.isEnabled()) { + return Context.NONE; + } + Context spanContext = tracerProvider.extractContext(diagnosticId.toString(), Context.NONE); + return tracerProvider.startSpan(spanContext, ProcessKind.PROCESS); + } + + /* + * Ends the process tracing span and the scope of that span. + */ + private void endProcessTracingSpan(Context processSpanContext, Signal signal) { + Optional spanScope = processSpanContext.getData("scope"); + // Disposes of the scope when the trace span closes. + if (!spanScope.isPresent() || !tracerProvider.isEnabled()) { + return; + } + if (spanScope.get() instanceof Closeable) { + Closeable close = (Closeable) processSpanContext.getData("scope").get(); + try { + close.close(); + tracerProvider.endSpan(processSpanContext, signal); + } catch (IOException ioException) { + logger.error("EventProcessor.run() endTracingSpan().close() failed with an error %s", ioException); + } + + } else { + logger.warning(String.format(Locale.US, + "Process span scope type is not of type Closeable, but type: %s. Not closing the scope and span", + spanScope.get() != null ? spanScope.getClass() : "null")); + } + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorConnection.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorConnection.java index 5b947d577af6..18c44b1e6929 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorConnection.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorConnection.java @@ -65,9 +65,9 @@ public ReactorConnection(String connectionId, ConnectionOptions connectionOption this.reactorProvider = reactorProvider; this.connectionId = connectionId; this.handlerProvider = handlerProvider; - this.handler = handlerProvider.createConnectionHandler(connectionId, connectionOptions.host(), - connectionOptions.transportType()); - this.retryPolicy = RetryUtil.getRetryPolicy(connectionOptions.retry()); + this.handler = handlerProvider.createConnectionHandler(connectionId, connectionOptions.getHost(), + connectionOptions.getTransportType()); + this.retryPolicy = RetryUtil.getRetryPolicy(connectionOptions.getRetry()); this.connectionMono = Mono.fromCallable(() -> getOrCreateConnection()) .doOnSubscribe(c -> hasConnection.set(true)); @@ -82,12 +82,13 @@ public ReactorConnection(String connectionId, ConnectionOptions connectionOption this::notifyError, () -> notifyEndpointState(EndpointState.CLOSED))); - tokenResourceProvider = new TokenResourceProvider(connectionOptions.authorizationType(), connectionOptions.host()); + tokenResourceProvider = + new TokenResourceProvider(connectionOptions.getAuthorizationType(), connectionOptions.getHost()); this.managementChannelMono = connectionMono.then( Mono.fromCallable(() -> (EventHubManagementNode) new ManagementChannel(this, - connectionOptions.eventHubName(), connectionOptions.tokenCredential(), tokenResourceProvider, - reactorProvider, connectionOptions.retry(), handlerProvider, mapper))).cache(); + connectionOptions.getEventHubName(), connectionOptions.getTokenCredential(), tokenResourceProvider, + reactorProvider, connectionOptions.getRetry(), handlerProvider, mapper))).cache(); } /** @@ -97,7 +98,7 @@ public ReactorConnection(String connectionId, ConnectionOptions connectionOption public Mono getCBSNode() { final Mono cbsNodeMono = RetryUtil.withRetry( getConnectionStates().takeUntil(x -> x == AmqpEndpointState.ACTIVE), - connectionOptions.retry().tryTimeout(), retryPolicy) + connectionOptions.getRetry().getTryTimeout(), retryPolicy) .then(Mono.fromCallable(() -> getOrCreateCBSNode())); return hasConnection.get() @@ -151,12 +152,12 @@ public Mono createSession(String sessionName) { return connectionMono.map(connection -> sessionMap.computeIfAbsent(sessionName, key -> { final SessionHandler handler = handlerProvider.createSessionHandler(connectionId, getHost(), sessionName, - connectionOptions.retry().tryTimeout()); + connectionOptions.getRetry().getTryTimeout()); final Session session = connection.session(); BaseHandler.setHandler(session, handler); return new ReactorSession(session, handler, sessionName, reactorProvider, handlerProvider, getCBSNode(), - tokenResourceProvider, connectionOptions.retry().tryTimeout()); + tokenResourceProvider, connectionOptions.getRetry().getTryTimeout()); })); } @@ -192,8 +193,9 @@ private synchronized CBSNode getOrCreateCBSNode() { if (cbsChannel == null) { logger.info("Setting CBS channel."); - cbsChannel = new CBSChannel(this, connectionOptions.tokenCredential(), - connectionOptions.authorizationType(), reactorProvider, handlerProvider, connectionOptions.retry()); + cbsChannel = new CBSChannel(this, connectionOptions.getTokenCredential(), + connectionOptions.getAuthorizationType(), reactorProvider, handlerProvider, + connectionOptions.getRetry()); } return cbsChannel; @@ -207,8 +209,8 @@ private synchronized Connection getOrCreateConnection() throws IOException { connection = reactor.connectionToHost(handler.getHostname(), handler.getProtocolPort(), handler); reactorExceptionHandler = new ReactorExceptionHandler(); - executor = new ReactorExecutor(reactor, connectionOptions.scheduler(), connectionId, - reactorExceptionHandler, connectionOptions.retry().tryTimeout(), connectionOptions.host()); + executor = new ReactorExecutor(reactor, connectionOptions.getScheduler(), connectionId, + reactorExceptionHandler, connectionOptions.getRetry().getTryTimeout(), connectionOptions.getHost()); executor.start(); } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorDispatcher.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorDispatcher.java index b11077be4410..8ea3d18609b0 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorDispatcher.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorDispatcher.java @@ -83,13 +83,14 @@ private void throwIfSchedulerError() { final RejectedExecutionException rejectedException = this.reactor.attachments() .get(RejectedExecutionException.class, RejectedExecutionException.class); if (rejectedException != null) { - throw new RejectedExecutionException(rejectedException.getMessage(), rejectedException); + throw logger.logExceptionAsError(new RejectedExecutionException(rejectedException.getMessage(), + rejectedException)); } // throw when the pipe is in closed state - in which case, // signalling the new event-dispatch will fail if (!this.ioSignal.sink().isOpen()) { - throw new RejectedExecutionException("ReactorDispatcher instance is closed."); + throw logger.logExceptionAsError(new RejectedExecutionException("ReactorDispatcher instance is closed.")); } } @@ -118,7 +119,7 @@ public void run(Selectable selectable) { logger.info("WorkScheduler.run() failed with an error: %s", ignorePipeClosedDuringReactorShutdown); } catch (IOException ioException) { logger.error("WorkScheduler.run() failed with an error: %s", ioException); - throw new RuntimeException(ioException); + throw logger.logExceptionAsError(new RuntimeException(ioException)); } Work topWork; diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorExecutor.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorExecutor.java index 23da0dbfb2aa..f5b93aa6a1ac 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorExecutor.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorExecutor.java @@ -98,9 +98,11 @@ private void run() { rescheduledReactor = true; } catch (RejectedExecutionException exception) { logger.warning(LOG_MESSAGE, connectionId, - StringUtil.toStackTraceString(exception, "Scheduling reactor failed because the executor has been shut down")); + StringUtil.toStackTraceString(exception, + "Scheduling reactor failed because the executor has been shut down")); - this.reactor.attachments().set(RejectedExecutionException.class, RejectedExecutionException.class, exception); + this.reactor.attachments() + .set(RejectedExecutionException.class, RejectedExecutionException.class, exception); } } } catch (HandlerException handlerException) { @@ -122,7 +124,8 @@ private void run() { if (cause instanceof UnresolvedAddressException) { exception = new AmqpException(true, - String.format(Locale.US, "%s. This is usually caused by incorrect hostname or network configuration. Check correctness of namespace information. %s", + String.format(Locale.US, "%s. This is usually caused by incorrect hostname or network " + + "configuration. Check correctness of namespace information. %s", message, StringUtil.getTrackingIDAndTimeToLog()), cause, errorContext); } else { @@ -137,7 +140,9 @@ private void run() { if (hasStarted.get()) { scheduleCompletePendingTasks(); } else { - final String reason = "Stopping the reactor because thread was interrupted or the reactor has no more events to process."; + final String reason = + "Stopping the reactor because thread was interrupted or the reactor has no more events to " + + "process."; logger.info(LOG_MESSAGE, connectionId, reason); close(false, reason); @@ -156,7 +161,8 @@ private void scheduleCompletePendingTasks() { reactor.process(); } catch (HandlerException e) { logger.warning(LOG_MESSAGE, connectionId, - StringUtil.toStackTraceString(e, "scheduleCompletePendingTasks - exception occurred while processing events.")); + StringUtil.toStackTraceString(e, "scheduleCompletePendingTasks - exception occurred while " + + "processing events.")); } finally { reactor.free(); } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorHandlerProvider.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorHandlerProvider.java index 1f0253d413ea..62fc4d133f4f 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorHandlerProvider.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorHandlerProvider.java @@ -47,7 +47,8 @@ ConnectionHandler createConnectionHandler(String connectionId, String hostname, case AMQP_WEB_SOCKETS: return new WebSocketsConnectionHandler(connectionId, hostname); default: - throw logger.logExceptionAsWarning(new IllegalArgumentException(String.format(Locale.US, "This transport type '%s' is not supported.", transportType))); + throw logger.logExceptionAsWarning(new IllegalArgumentException(String.format(Locale.US, + "This transport type '%s' is not supported.", transportType))); } } @@ -84,7 +85,8 @@ SendLinkHandler createSendLinkHandler(String connectionId, String host, String s * @param receiverName Name of the send link. * @return A new {@link ReceiveLinkHandler}. */ - ReceiveLinkHandler createReceiveLinkHandler(String connectionId, String host, String receiverName, String entityPath) { + ReceiveLinkHandler createReceiveLinkHandler(String connectionId, String host, String receiverName, + String entityPath) { return new ReceiveLinkHandler(connectionId, host, receiverName, entityPath); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorProvider.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorProvider.java index 82657ca04de0..0f5c2becb605 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorProvider.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorProvider.java @@ -3,6 +3,7 @@ package com.azure.messaging.eventhubs.implementation; +import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.implementation.handler.CustomIOHandler; import com.azure.messaging.eventhubs.implementation.handler.ReactorHandler; import org.apache.qpid.proton.Proton; @@ -15,6 +16,7 @@ import java.util.Objects; public class ReactorProvider { + private final ClientLogger logger = new ClientLogger(ReactorProvider.class); private final Object lock = new Object(); private Reactor reactor; private ReactorDispatcher reactorDispatcher; @@ -52,12 +54,13 @@ Reactor createReactor(String connectionId, int maxFrameSize) throws IOException * @param baseHandlers Handler for reactor instance. Usually: {@link ReactorHandler} * @return A new reactor instance. */ - private Reactor createReactor(final int maxFrameSize, final Handler globalHandler, final BaseHandler... baseHandlers) throws IOException { + private Reactor createReactor(final int maxFrameSize, final Handler globalHandler, + final BaseHandler... baseHandlers) throws IOException { Objects.requireNonNull(baseHandlers); Objects.requireNonNull(globalHandler); if (maxFrameSize <= 0) { - throw new IllegalArgumentException("'maxFrameSize' must be a positive number."); + throw logger.logExceptionAsError(new IllegalArgumentException("'maxFrameSize' must be a positive number.")); } final ReactorOptions reactorOptions = new ReactorOptions(); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorReceiver.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorReceiver.java index 4a4bfaced172..c09330c4d0ad 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorReceiver.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorReceiver.java @@ -26,7 +26,8 @@ * Handles receiving events from Event Hubs service and translating them to proton-j messages. */ public class ReactorReceiver extends EndpointStateNotifierBase implements AmqpReceiveLink { - // Initial value is true because we could not have created this receiver without authorising against the CBS node first. + // Initial value is true because we could not have created this receiver without authorising against the CBS node + // first. private final AtomicBoolean hasAuthorized = new AtomicBoolean(true); private final String entityPath; @@ -40,7 +41,8 @@ public class ReactorReceiver extends EndpointStateNotifierBase implements AmqpRe private volatile Supplier creditSupplier; - ReactorReceiver(String entityPath, Receiver receiver, ReceiveLinkHandler handler, ActiveClientTokenManager tokenManager) { + ReactorReceiver(String entityPath, Receiver receiver, ReceiveLinkHandler handler, + ActiveClientTokenManager tokenManager) { super(new ClientLogger(ReactorReceiver.class)); this.isDisposed = new AtomicBoolean(); this.entityPath = entityPath; @@ -120,6 +122,11 @@ public String getEntityPath() { return entityPath; } + @Override + public String getHostname() { + return handler.getHostname(); + } + @Override public void close() { if (isDisposed.getAndSet(true)) { diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorSender.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorSender.java index 77c40942eb88..c1c455ce480f 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorSender.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorSender.java @@ -66,7 +66,8 @@ class ReactorSender extends EndpointStateNotifierBase implements AmqpSendLink { private final Object pendingSendLock = new Object(); private final ConcurrentHashMap pendingSendsMap = new ConcurrentHashMap<>(); - private final PriorityQueue pendingSendsQueue = new PriorityQueue<>(1000, new DeliveryTagComparator()); + private final PriorityQueue pendingSendsQueue = + new PriorityQueue<>(1000, new DeliveryTagComparator()); private final ActiveClientTokenManager tokenManager; private final RetryPolicy retry; @@ -131,14 +132,18 @@ class ReactorSender extends EndpointStateNotifierBase implements AmqpSendLink { @Override public Mono send(Message message) { final int payloadSize = getDataSerializedSize(message); - final int allocationSize = Math.min(payloadSize + ClientConstants.MAX_EVENTHUB_AMQP_HEADER_SIZE_BYTES, maxMessageSize); + final int allocationSize = + Math.min(payloadSize + ClientConstants.MAX_EVENTHUB_AMQP_HEADER_SIZE_BYTES, maxMessageSize); final byte[] bytes = new byte[allocationSize]; int encodedSize; try { encodedSize = message.encode(bytes, 0, allocationSize); } catch (BufferOverflowException exception) { - final String errorMessage = String.format(Locale.US, "Error sending. Size of the payload exceeded maximum message size: %s kb", maxMessageSize / 1024); + final String errorMessage = + String.format(Locale.US, + "Error sending. Size of the payload exceeded maximum message size: %s kb", + maxMessageSize / 1024); final Throwable error = new AmqpException(false, ErrorCondition.LINK_PAYLOAD_SIZE_EXCEEDED, errorMessage, exception, handler.getErrorContext(sender)); @@ -171,16 +176,21 @@ public Mono send(List messageBatch) { final Message messageWrappedByData = Proton.message(); int payloadSize = getDataSerializedSize(amqpMessage); - int allocationSize = Math.min(payloadSize + ClientConstants.MAX_EVENTHUB_AMQP_HEADER_SIZE_BYTES, maxMessageSizeTemp); + int allocationSize = + Math.min(payloadSize + ClientConstants.MAX_EVENTHUB_AMQP_HEADER_SIZE_BYTES, maxMessageSizeTemp); byte[] messageBytes = new byte[allocationSize]; int messageSizeBytes = amqpMessage.encode(messageBytes, 0, allocationSize); messageWrappedByData.setBody(new Data(new Binary(messageBytes, 0, messageSizeBytes))); try { - encodedSize = messageWrappedByData.encode(bytes, byteArrayOffset, maxMessageSizeTemp - byteArrayOffset - 1); + encodedSize = + messageWrappedByData.encode(bytes, byteArrayOffset, maxMessageSizeTemp - byteArrayOffset - 1); } catch (BufferOverflowException exception) { - final String message = String.format(Locale.US, "Size of the payload exceeded maximum message size: %s kb", maxMessageSizeTemp / 1024); + final String message = + String.format(Locale.US, + "Size of the payload exceeded maximum message size: %s kb", + maxMessageSizeTemp / 1024); final AmqpException error = new AmqpException(false, ErrorCondition.LINK_PAYLOAD_SIZE_EXCEEDED, message, exception, handler.getErrorContext(sender)); @@ -208,6 +218,11 @@ public String getEntityPath() { return entityPath; } + @Override + public String getHostname() { + return handler.getHostname(); + } + @Override public Mono getLinkSize() { if (this.hasConnected.get() && this.maxMessageSize > 0) { @@ -287,7 +302,8 @@ private void processSendWork() { if (workItem == null) { if (deliveryTag != null) { - logger.verbose("clientId[{}]. path[{}], linkName[{}], deliveryTag[{}]: sendData not found for this delivery.", + logger.verbose( + "clientId[{}]. path[{}], linkName[{}], deliveryTag[{}]: sendData not found for this delivery.", handler.getConnectionId(), entityPath, getLinkName(), deliveryTag); } @@ -302,10 +318,11 @@ private void processSendWork() { try { delivery = sender.delivery(deliveryTag.getBytes(UTF_8)); - delivery.setMessageFormat(workItem.messageFormat()); + delivery.setMessageFormat(workItem.getMessageFormat()); - sentMsgSize = sender.send(workItem.message(), 0, workItem.encodedMessageSize()); - assert sentMsgSize == workItem.encodedMessageSize() : "Contract of the ProtonJ library for Sender.Send API changed"; + sentMsgSize = sender.send(workItem.getMessage(), 0, workItem.getEncodedMessageSize()); + assert sentMsgSize == workItem.getEncodedMessageSize() + : "Contract of the ProtonJ library for Sender. Send API changed"; linkAdvance = sender.advance(); } catch (Exception exception) { @@ -313,14 +330,17 @@ private void processSendWork() { } if (linkAdvance) { - logger.verbose("entityPath[{}], linkName[{}], deliveryTag[{}]: Sent message", entityPath, getLinkName(), deliveryTag); + logger.verbose("entityPath[{}], linkName[{}], deliveryTag[{}]: Sent message", entityPath, + getLinkName(), deliveryTag); - workItem.setIsWaitingForAck(); + workItem.setWaitingForAck(); sendTimeoutTimer.schedule(new SendTimeout(deliveryTag), timeout.toMillis()); } else { logger.verbose( - "clientId[{}]. path[{}], linkName[{}], deliveryTag[{}], sentMessageSize[{}], payloadActualSize[{}]: sendlink advance failed", - handler.getConnectionId(), entityPath, getLinkName(), deliveryTag, sentMsgSize, workItem.encodedMessageSize()); + "clientId[{}]. path[{}], linkName[{}], deliveryTag[{}], sentMessageSize[{}], " + + "payloadActualSize[{}]: sendlink advance failed", + handler.getConnectionId(), entityPath, getLinkName(), deliveryTag, sentMsgSize, + workItem.getEncodedMessageSize()); if (delivery != null) { delivery.free(); @@ -328,10 +348,14 @@ private void processSendWork() { final ErrorContext context = handler.getErrorContext(sender); final Throwable exception = sendException != null - ? new OperationCancelledException(String.format(Locale.US, "Entity(%s): send operation failed. Please see cause for more details", entityPath), sendException, context) - : new OperationCancelledException(String.format(Locale.US, "Entity(%s): send operation failed while advancing delivery(tag: %s).", entityPath, deliveryTag), context); - - workItem.sink().error(exception); + ? new OperationCancelledException(String.format(Locale.US, + "Entity(%s): send operation failed. Please see cause for more details", entityPath), + sendException, context) + : new OperationCancelledException(String.format(Locale.US, + "Entity(%s): send operation failed while advancing delivery(tag: %s).", + entityPath, deliveryTag), context); + + workItem.getSink().error(exception); } } } @@ -357,7 +381,7 @@ private void processDeliveredMessage(Delivery delivery) { retryAttempts.set(0); } - workItem.sink().success(); + workItem.getSink().success(); } else if (outcome instanceof Rejected) { final Rejected rejected = (Rejected) outcome; final org.apache.qpid.proton.amqp.transport.ErrorCondition error = rejected.getError(); @@ -376,10 +400,10 @@ private void processDeliveredMessage(Delivery delivery) { final Duration retryInterval = retry.calculateRetryDelay(exception, retryAttempt); - if (retryInterval.compareTo(workItem.timeoutTracker().remaining()) > 0) { + if (retryInterval.compareTo(workItem.getTimeoutTracker().remaining()) > 0) { cleanupFailedSend(workItem, exception); } else { - workItem.lastKnownException(exception); + workItem.setLastKnownException(exception); try { reactorProvider.getReactorDispatcher().invoke(() -> send(workItem), retryInterval); } catch (IOException | RejectedExecutionException schedulerException) { @@ -412,7 +436,7 @@ private void scheduleWorkOnDispatcher() { private void cleanupFailedSend(final RetriableWorkItem workItem, final Exception exception) { //TODO (conniey): is there some timeout task I should handle? - workItem.sink().error(exception); + workItem.getSink().error(exception); } private static boolean isGeneralSendError(Symbol amqpError) { @@ -495,7 +519,7 @@ public void run() { handler.getErrorContext(sender)); } - workItem.sink().error(exception); + workItem.getSink().error(exception); } } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorSession.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorSession.java index 99cacffa6027..c0f958772473 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorSession.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorSession.java @@ -147,7 +147,9 @@ public Mono createProducer(String linkName, String entityPath, Duratio try { provider.getReactorDispatcher().invoke(() -> { sender.open(); - final ReactorSender reactorSender = new ReactorSender(entityPath, sender, sendLinkHandler, provider, tokenManager, timeout, retry, EventHubAsyncProducer.MAX_MESSAGE_LENGTH_BYTES); + final ReactorSender reactorSender = + new ReactorSender(entityPath, sender, sendLinkHandler, provider, tokenManager, timeout, + retry, EventHubAsyncProducer.MAX_MESSAGE_LENGTH_BYTES); openSendLinks.put(linkName, reactorSender); sink.success(reactorSender); }); @@ -164,7 +166,8 @@ public Mono createConsumer(String linkName, String entityPath, Duratio @Override public Mono createConsumer(String linkName, String entityPath, String eventPositionExpression, - Duration timeout, RetryPolicy retry, Long ownerLevel, String consumerIdentifier) { + Duration timeout, RetryPolicy retry, Long ownerLevel, + String consumerIdentifier) { final ActiveClientTokenManager tokenManager = createTokenManager(entityPath); return RetryUtil.withRetry( @@ -183,13 +186,15 @@ public Mono createConsumer(String linkName, String entityPath, String if (!ImplUtils.isNullOrEmpty(eventPositionExpression)) { final Map filter = new HashMap<>(); - filter.put(AmqpConstants.STRING_FILTER, new UnknownDescribedType(AmqpConstants.STRING_FILTER, eventPositionExpression)); + filter.put(AmqpConstants.STRING_FILTER, new UnknownDescribedType(AmqpConstants.STRING_FILTER, + eventPositionExpression)); source.setFilter(filter); } //TODO (conniey): support creating a filter when we've already received some events. I believe this in // the cause of recreating a failing link. - // final Map filterMap = MessageReceiver.this.settingsProvider.getFilter(MessageReceiver.this.lastReceivedMessage); + // final Map filterMap = MessageReceiver.this.settingsProvider + // .getFilter(MessageReceiver.this.lastReceivedMessage); // if (filterMap != null) { // source.setFilter(filterMap); // } @@ -215,7 +220,8 @@ public Mono createConsumer(String linkName, String entityPath, String } // TODO (conniey): After preview 1 feature to enable keeping partition information updated. - // static final Symbol ENABLE_RECEIVER_RUNTIME_METRIC_NAME = Symbol.valueOf(VENDOR + ":enable-receiver-runtime-metric"); + // static final Symbol ENABLE_RECEIVER_RUNTIME_METRIC_NAME = Symbol.valueOf(VENDOR + + // ":enable-receiver-runtime-metric"); // if (keepPartitionInformationUpdated) { // receiver.setDesiredCapabilities(new Symbol[]{ENABLE_RECEIVER_RUNTIME_METRIC_NAME}); // } @@ -228,7 +234,8 @@ public Mono createConsumer(String linkName, String entityPath, String provider.getReactorDispatcher().invoke(() -> { receiver.open(); - final ReactorReceiver reactorReceiver = new ReactorReceiver(entityPath, receiver, receiveLinkHandler, tokenManager); + final ReactorReceiver reactorReceiver = + new ReactorReceiver(entityPath, receiver, receiveLinkHandler, tokenManager); openReceiveLinks.put(linkName, reactorReceiver); sink.success(reactorReceiver); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/RequestResponseChannel.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/RequestResponseChannel.java index 4f3c5e0f70f5..0f8e84c1ef56 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/RequestResponseChannel.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/RequestResponseChannel.java @@ -43,7 +43,8 @@ class RequestResponseChannel implements Closeable { private static final String STATUS_CODE = "status-code"; private static final String STATUS_DESCRIPTION = "status-description"; - private final ConcurrentSkipListMap> unconfirmedSends = new ConcurrentSkipListMap<>(); + private final ConcurrentSkipListMap> unconfirmedSends = + new ConcurrentSkipListMap<>(); private final ClientLogger logger = new ClientLogger(RequestResponseChannel.class); private final Sender sendLink; @@ -59,7 +60,7 @@ class RequestResponseChannel implements Closeable { RequestResponseChannel(String connectionId, String host, String linkName, String path, Session session, RetryOptions retryOptions, ReactorHandlerProvider handlerProvider) { - this.operationTimeout = retryOptions.tryTimeout(); + this.operationTimeout = retryOptions.getTryTimeout(); this.retryPolicy = RetryUtil.getRetryPolicy(retryOptions); this.replyTo = path.replace("$", "") + "-client-reply-to"; @@ -104,13 +105,13 @@ Mono sendWithAck(final Message message, final ReactorDispatcher dispatc start(); if (message == null) { - throw new IllegalArgumentException("message cannot be null"); + throw logger.logExceptionAsError(new IllegalArgumentException("message cannot be null")); } if (message.getMessageId() != null) { - throw new IllegalArgumentException("message.getMessageId() should be null"); + throw logger.logExceptionAsError(new IllegalArgumentException("message.getMessageId() should be null")); } if (message.getReplyTo() != null) { - throw new IllegalArgumentException("message.getReplyTo() should be null"); + throw logger.logExceptionAsError(new IllegalArgumentException("message.getReplyTo() should be null")); } final UnsignedLong messageId = UnsignedLong.valueOf(requestId.incrementAndGet()); @@ -148,7 +149,8 @@ private void start() { private void send(final Message message) { sendLink.delivery(UUID.randomUUID().toString().replace("-", "").getBytes(UTF_8)); - final int payloadSize = EventDataUtil.getDataSerializedSize(message) + ClientConstants.MAX_EVENTHUB_AMQP_HEADER_SIZE_BYTES; + final int payloadSize = EventDataUtil.getDataSerializedSize(message) + + ClientConstants.MAX_EVENTHUB_AMQP_HEADER_SIZE_BYTES; final byte[] bytes = new byte[payloadSize]; final int encodedSize = message.encode(bytes, 0, payloadSize); @@ -184,7 +186,8 @@ private void settleMessage(Message message) { final int statusCode = (int) message.getApplicationProperties().getValue().get(STATUS_CODE); if (statusCode != AmqpResponseCode.ACCEPTED.getValue() && statusCode != AmqpResponseCode.OK.getValue()) { - final String statusDescription = (String) message.getApplicationProperties().getValue().get(STATUS_DESCRIPTION); + final String statusDescription = + (String) message.getApplicationProperties().getValue().get(STATUS_DESCRIPTION); sink.error(ExceptionUtil.amqpResponseCodeToException(statusCode, statusDescription, receiveLinkHandler.getErrorContext(receiveLink))); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/RetriableWorkItem.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/RetriableWorkItem.java index 4d0cc52b61d5..6acaeed91989 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/RetriableWorkItem.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/RetriableWorkItem.java @@ -22,11 +22,13 @@ class RetriableWorkItem { private boolean waitingForAck; private Exception lastKnownException; - RetriableWorkItem(byte[] amqpMessage, int encodedMessageSize, int messageFormat, MonoSink monoSink, Duration timeout) { + RetriableWorkItem(byte[] amqpMessage, int encodedMessageSize, int messageFormat, MonoSink monoSink, + Duration timeout) { this(amqpMessage, encodedMessageSize, messageFormat, monoSink, new TimeoutTracker(timeout, false)); } - private RetriableWorkItem(byte[] amqpMessage, int encodedMessageSize, int messageFormat, MonoSink monoSink, TimeoutTracker timeout) { + private RetriableWorkItem(byte[] amqpMessage, int encodedMessageSize, int messageFormat, MonoSink monoSink, + TimeoutTracker timeout) { this.amqpMessage = amqpMessage; this.encodedMessageSize = encodedMessageSize; this.messageFormat = messageFormat; @@ -34,15 +36,15 @@ private RetriableWorkItem(byte[] amqpMessage, int encodedMessageSize, int messag this.timeoutTracker = timeout; } - byte[] message() { + byte[] getMessage() { return amqpMessage; } - TimeoutTracker timeoutTracker() { + TimeoutTracker getTimeoutTracker() { return timeoutTracker; } - MonoSink sink() { + MonoSink getSink() { return monoSink; } @@ -54,23 +56,23 @@ boolean hasBeenRetried() { return retryAttempts.get() == 0; } - int encodedMessageSize() { + int getEncodedMessageSize() { return encodedMessageSize; } - int messageFormat() { + int getMessageFormat() { return messageFormat; } - Exception lastKnownException() { + Exception getLastKnownException() { return this.lastKnownException; } - void lastKnownException(Exception exception) { + void setLastKnownException(Exception exception) { this.lastKnownException = exception; } - void setIsWaitingForAck() { + void setWaitingForAck() { this.waitingForAck = true; } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/StringUtil.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/StringUtil.java index fef19437d7b2..72e745f879fb 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/StringUtil.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/StringUtil.java @@ -12,7 +12,8 @@ public final class StringUtil { public static String getRandomString(String prefix) { - return String.format(Locale.US, "%s_%s_%s", prefix, UUID.randomUUID().toString().substring(0, 6), Instant.now().toEpochMilli()); + return String.format(Locale.US, "%s_%s_%s", prefix, UUID.randomUUID().toString().substring(0, 6), + Instant.now().toEpochMilli()); } public static String toStackTraceString(final Throwable exception, final String customErrorMessage) { diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/SynchronousEventSubscriber.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/SynchronousEventSubscriber.java new file mode 100644 index 000000000000..f0ef70583fd2 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/SynchronousEventSubscriber.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs.implementation; + +import com.azure.core.util.logging.ClientLogger; +import com.azure.messaging.eventhubs.EventData; +import org.reactivestreams.Subscription; +import reactor.core.publisher.BaseSubscriber; + +import java.util.Objects; +import java.util.Queue; +import java.util.Timer; +import java.util.TimerTask; +import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * Subscriber that takes {@link SynchronousReceiveWork} and publishes events to them in the order received. + */ +public class SynchronousEventSubscriber extends BaseSubscriber { + private final Timer timer = new Timer("SynchronousEventSubscriber"); + private final AtomicInteger pendingReceives = new AtomicInteger(); + private final ClientLogger logger = new ClientLogger(SynchronousEventSubscriber.class); + private final Queue pendingWork = new ConcurrentLinkedQueue<>(); + private volatile Subscription subscription; + + /** + * Creates an instance with an initial receive work item. + * + * @param work Initial work item to start publishing to. + */ + public SynchronousEventSubscriber(SynchronousReceiveWork work) { + Objects.requireNonNull(work, "'receiveItem' cannot be null."); + pendingWork.add(work); + } + + /** + * Adds a new receive work item to the queue. + * + * @param work Synchronous receive work to add to the queue. + */ + public void queueReceiveWork(SynchronousReceiveWork work) { + Objects.requireNonNull(work, "'work' cannot be null."); + + final boolean isEmpty = pendingWork.isEmpty(); + pendingWork.add(work); + + if (isEmpty) { + logger.info("There is no existing work in queue. Scheduling: {}", work.getId()); + scheduleWork(work); + } else { + logger.info("Verifying if there are any new work items. {}", work.getId()); + getOrUpdateNextWork(); + } + } + + /** + * On an initial subscription, will take the first work item, and request that amount of work for it. + * + * @param subscription Subscription for upstream. + */ + @Override + protected void hookOnSubscribe(Subscription subscription) { + if (this.subscription == null) { + this.subscription = subscription; + } + + final SynchronousReceiveWork work = pendingWork.peek(); + if (work == null) { + logger.warning("There is no work to request EventData for. Listener should have been created with work."); + } else { + logger.info("Scheduling first work item: {}", work.getId()); + scheduleWork(work); + } + } + + /** + * Publishes the event to the current {@link SynchronousReceiveWork}. If that work item is complete, will pop off + * that work item, and queue the next one. + * + * @param value Event to publish. + */ + @Override + protected void hookOnNext(EventData value) { + SynchronousReceiveWork currentItem = getOrUpdateNextWork(); + if (currentItem == null) { + logger.warning("EventData received when there is no pending work. Skipping."); + return; + } + + pendingReceives.decrementAndGet(); + currentItem.next(value); + + if (currentItem.isTerminal()) { + logger.info("Work: {}, Is completed. Closing flux.", currentItem.getId()); + currentItem.complete(); + getOrUpdateNextWork(); + } + } + + /** + * {@inheritDoc} + */ + @Override + protected void hookOnError(Throwable throwable) { + logger.error("Error occurred in subscriber.", throwable); + final SynchronousReceiveWork[] remainingWork = pendingWork.toArray(new SynchronousReceiveWork[0]); + pendingWork.clear(); + + for (SynchronousReceiveWork work : remainingWork) { + work.error(throwable); + } + } + + /** + * {@inheritDoc} + */ + @Override + public void dispose() { + final SynchronousReceiveWork[] remainingWork = pendingWork.toArray(new SynchronousReceiveWork[0]); + pendingWork.clear(); + + for (SynchronousReceiveWork work : remainingWork) { + work.complete(); + } + + super.dispose(); + } + + private synchronized SynchronousReceiveWork getOrUpdateNextWork() { + SynchronousReceiveWork work = pendingWork.peek(); + if (work == null) { + subscription.request(0); + } + + if (work == null || !work.isTerminal()) { + return work; + } + + pendingWork.remove(work); + work = pendingWork.peek(); + + if (work == null) { + subscription.request(0); + return null; + } + + scheduleWork(work); + return work; + } + + private synchronized void scheduleWork(SynchronousReceiveWork work) { + if (subscription == null) { + throw logger.logExceptionAsError(new IllegalStateException( + "This has not been subscribed to. Cannot start receiving work.")); + } + + final int pending = work.getNumberOfEvents() - pendingReceives.get(); + logger.info("Work: {}, Pending: {}, Scheduling receive timeout task.", work.getId(), pending); + if (pending > 0) { + pendingReceives.addAndGet(pending); + subscription.request(pending); + } + + timer.schedule(new ReceiveTimeoutTask(work), work.getTimeout().toMillis()); + } + + private class ReceiveTimeoutTask extends TimerTask { + private final ClientLogger logger = new ClientLogger(ReceiveTimeoutTask.class); + private final SynchronousReceiveWork work; + + ReceiveTimeoutTask(SynchronousReceiveWork work) { + this.work = Objects.requireNonNull(work, "'work' cannot be null."); + } + + @Override + public void run() { + logger.info("Timeout task encountered, disposing of task. Work: {}", work.getId()); + work.complete(); + SynchronousEventSubscriber.this.getOrUpdateNextWork(); + } + } +} + diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/SynchronousReceiveWork.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/SynchronousReceiveWork.java new file mode 100644 index 000000000000..ad60155e652f --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/SynchronousReceiveWork.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs.implementation; + +import com.azure.core.util.logging.ClientLogger; +import com.azure.messaging.eventhubs.EventData; +import reactor.core.publisher.FluxSink; + +import java.time.Duration; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * Represents a synchronous receive request. + * + * @see SynchronousEventSubscriber + */ +public class SynchronousReceiveWork { + private final ClientLogger logger = new ClientLogger(SynchronousReceiveWork.class); + private final long id; + private final AtomicInteger remaining; + private final int numberToReceive; + private final Duration timeout; + private final FluxSink emitter; + + private volatile boolean isTerminal = false; + + /** + * Creates a new synchronous receive work. + * + * @param id Identifier for the work. + * @param numberToReceive Maximum number of events to receive. + * @param timeout Maximum duration to wait for {@code numberOfReceive} events. + * @param emitter Sink to publish received events to. + */ + public SynchronousReceiveWork(long id, int numberToReceive, Duration timeout, FluxSink emitter) { + this.id = id; + this.remaining = new AtomicInteger(numberToReceive); + this.numberToReceive = numberToReceive; + this.timeout = timeout; + this.emitter = emitter; + } + + /** + * Gets the unique identifier for this work. + * + * @return The unique identifier for this work. + */ + public long getId() { + return id; + } + + /** + * Gets the maximum duration to wait for the work to complete. + * + * @return The duration to wait for the work to complete. + */ + public Duration getTimeout() { + return timeout; + } + + /** + * Gets the number of events to receive. + * + * @return The number of events to receive. + */ + int getNumberOfEvents() { + return numberToReceive; + } + + /** + * Gets whether or not the work item has reached a terminal state. + * + * @return {@code true} if all the events have been fetched, it has been cancelled, or an error occurred. {@code + * false} otherwise. + */ + boolean isTerminal() { + return emitter.isCancelled() || remaining.get() == 0 || isTerminal; + } + + /** + * Publishes the next event data to a downstream subscriber. + * + * @param event Event to publish downstream. + */ + public void next(EventData event) { + try { + emitter.next(event); + remaining.decrementAndGet(); + } catch (Exception e) { + logger.warning("Exception occurred while emitting next received event.", e); + isTerminal = true; + emitter.error(e); + } + } + + /** + * Completes the publisher. If the publisher has encountered an error, or an error has occurred, it does nothing. + */ + public synchronized void complete() { + if (!isTerminal || emitter.isCancelled()) { + logger.info("Id: {}. Completing task.", id); + isTerminal = true; + emitter.complete(); + } + } + + /** + * Publishes an error downstream. This is a terminal step. + * + * @param error Error to publish downstream. + */ + public void error(Throwable error) { + isTerminal = true; + emitter.error(error); + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/TokenResourceProvider.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/TokenResourceProvider.java index 47a03bd1d7ff..33519b5e2962 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/TokenResourceProvider.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/TokenResourceProvider.java @@ -3,6 +3,8 @@ package com.azure.messaging.eventhubs.implementation; +import com.azure.core.util.logging.ClientLogger; + import java.util.Locale; import java.util.Objects; @@ -13,6 +15,7 @@ class TokenResourceProvider { private static final String TOKEN_AUDIENCE_FORMAT = "amqp://%s/%s"; private static final String AZURE_ACTIVE_DIRECTORY_SCOPE = "https://eventhubs.azure.net//.default"; + private final ClientLogger logger = new ClientLogger(TokenResourceProvider.class); private final CBSAuthorizationType authorizationType; private final String host; @@ -31,8 +34,8 @@ String getResourceString(String resource) { case SHARED_ACCESS_SIGNATURE: return String.format(Locale.US, TOKEN_AUDIENCE_FORMAT, host, resource); default: - throw new IllegalArgumentException(String.format(Locale.US, - "'%s' is not supported authorization type for token audience.", authorizationType)); + throw logger.logExceptionAsError(new IllegalArgumentException(String.format(Locale.US, + "'%s' is not supported authorization type for token audience.", authorizationType))); } } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/ConnectionHandler.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/ConnectionHandler.java index db80eb963fab..f10a579f262f 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/ConnectionHandler.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/ConnectionHandler.java @@ -42,8 +42,8 @@ public class ConnectionHandler extends Handler { * Creates a handler that handles proton-j's connection events. * * @param connectionId Identifier for this connection. - * @param hostname Hostname to use for socket creation. If there is a proxy configured, this could be a proxy's IP - * address. + * @param hostname Hostname to use for socket creation. If there is a proxy configured, this could be a proxy's + * IP address. */ public ConnectionHandler(final String connectionId, final String hostname) { this(connectionId, hostname, new ClientLogger(ConnectionHandler.class)); @@ -53,8 +53,8 @@ public ConnectionHandler(final String connectionId, final String hostname) { * Creates a handler that handles proton-j's connection events. * * @param connectionId Identifier for this connection. - * @param hostname Hostname to use for socket creation. If there is a proxy configured, this could be a proxy's IP - * address. + * @param hostname Hostname to use for socket creation. If there is a proxy configured, this could be a proxy's + * IP address. * @param logger The service logger to use. */ protected ConnectionHandler(final String connectionId, final String hostname, final ClientLogger logger) { @@ -263,7 +263,8 @@ private void notifyErrorContext(Connection connection, ErrorCondition condition) } if (condition == null) { - throw new IllegalStateException("notifyErrorContext does not have an ErrorCondition."); + throw logger.logExceptionAsError(new IllegalStateException( + "notifyErrorContext does not have an ErrorCondition.")); } // if the remote-peer abruptly closes the connection without issuing close frame issue one diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/Handler.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/Handler.java index 0a1688f0d052..0f35c4f0340a 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/Handler.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/Handler.java @@ -13,7 +13,8 @@ import java.io.Closeable; public abstract class Handler extends BaseHandler implements Closeable { - private final ReplayProcessor endpointStateProcessor = ReplayProcessor.cacheLastOrDefault(EndpointState.UNINITIALIZED); + private final ReplayProcessor endpointStateProcessor = + ReplayProcessor.cacheLastOrDefault(EndpointState.UNINITIALIZED); private final UnicastProcessor errorContextProcessor = UnicastProcessor.create(); private final FluxSink endpointSink = endpointStateProcessor.sink(); private final FluxSink errorSink = errorContextProcessor.sink(); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/ReceiveLinkHandler.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/ReceiveLinkHandler.java index 0a14387f5447..7c9b07d0afd5 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/ReceiveLinkHandler.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/ReceiveLinkHandler.java @@ -78,14 +78,16 @@ public void onDelivery(Event event) { // all until "last-1" deliveries will be partial // reactor will raise onDelivery event for all of these - we only need the last one if (!delivery.isPartial()) { - // One of our customers hit an issue - where duplicate 'Delivery' events are raised to Reactor in proton-j layer + // One of our customers hit an issue - where duplicate 'Delivery' events are raised to Reactor in + // proton-j layer // While processing the duplicate event - reactor hits an IllegalStateException in proton-j layer // before we fix proton-j - this work around ensures that we ignore the duplicate Delivery event if (delivery.isSettled()) { if (link != null) { logger.info("onDelivery receiverName[{}], linkName[{}], updatedLinkCredit[{}], remoteCredit[{}], " + "remoteCondition[{}], delivery.isSettled[{}]", - receiverName, link.getName(), link.getCredit(), link.getRemoteCredit(), link.getRemoteCondition(), delivery.isSettled()); + receiverName, link.getName(), link.getCredit(), link.getRemoteCredit(), + link.getRemoteCondition(), delivery.isSettled()); } else { logger.warning("delivery.isSettled[{}]", delivery.isSettled()); } @@ -97,7 +99,8 @@ public void onDelivery(Event event) { if (link != null) { logger.verbose("onDelivery receiverName[{}], linkName[{}], updatedLinkCredit[{}], remoteCredit[{}], " + "remoteCondition[{}], delivery.isPartial[{}]", - receiverName, link.getName(), link.getCredit(), link.getRemoteCredit(), link.getRemoteCondition(), delivery.isPartial()); + receiverName, link.getName(), link.getCredit(), link.getRemoteCredit(), link.getRemoteCondition(), + delivery.isPartial()); } } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/SendLinkHandler.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/SendLinkHandler.java index cf04b211f5c4..1f3b6db6e63c 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/SendLinkHandler.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/SendLinkHandler.java @@ -66,7 +66,8 @@ public void onLinkRemoteOpen(Event event) { onNext(EndpointState.ACTIVE); } } else { - logger.info("onLinkRemoteOpen senderName[{}], linkName[{}], remoteTarget[null], remoteSource[null], action[waitingForError]", + logger.info("onLinkRemoteOpen senderName[{}], linkName[{}], remoteTarget[null], remoteSource[null], " + + "action[waitingForError]", senderName, link.getName()); } } @@ -92,9 +93,11 @@ public void onDelivery(Event event) { while (delivery != null) { Sender sender = (Sender) delivery.getLink(); - logger.info("onDelivery senderName[{}], linkName[{}], unsettled[{}], credit[{}], deliveryState[{}], delivery.isBuffered[{}], delivery.id[{}]", + logger.info("onDelivery senderName[{}], linkName[{}], unsettled[{}], credit[{}], deliveryState[{}], " + + "delivery.isBuffered[{}], delivery.id[{}]", senderName, sender.getName(), sender.getUnsettled(), sender.getRemoteCredit(), - delivery.getRemoteState(), delivery.isBuffered(), new String(delivery.getTag(), StandardCharsets.UTF_8)); + delivery.getRemoteState(), delivery.isBuffered(), new String(delivery.getTag(), + StandardCharsets.UTF_8)); deliverySink.next(delivery); delivery.settle(); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/SessionHandler.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/SessionHandler.java index 80b7bfccbde7..bc17468c3ef3 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/SessionHandler.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/SessionHandler.java @@ -42,7 +42,9 @@ public ErrorContext getErrorContext() { public void onSessionLocalOpen(Event e) { logger.verbose("onSessionLocalOpen connectionId[{}], entityName[{}], condition[{}]", getConnectionId(), this.entityName, - e.getSession().getCondition() == null ? ClientConstants.NOT_APPLICABLE : e.getSession().getCondition().toString()); + e.getSession().getCondition() == null + ? ClientConstants.NOT_APPLICABLE + : e.getSession().getCondition().toString()); final Session session = e.getSession(); @@ -55,8 +57,10 @@ public void onSessionLocalOpen(Event e) { session.close(); - final String message = String.format(Locale.US, "onSessionLocalOpen connectionId[%s], entityName[%s], underlying IO of reactorDispatcher faulted with error: %s", - getConnectionId(), this.entityName, ioException.getMessage()); + final String message = + String.format(Locale.US, "onSessionLocalOpen connectionId[%s], entityName[%s], underlying IO of" + + " reactorDispatcher faulted with error: %s", + getConnectionId(), this.entityName, ioException.getMessage()); final Throwable exception = new AmqpException(false, message, ioException, getErrorContext()); onNext(exception); @@ -92,14 +96,17 @@ public void onSessionRemoteClose(Event e) { final Session session = e.getSession(); logger.info("onSessionRemoteClose connectionId[{}], entityName[{}], condition[{}]", - entityName, getConnectionId(), - session == null || session.getRemoteCondition() == null ? ClientConstants.NOT_APPLICABLE : session.getRemoteCondition().toString()); + entityName, + getConnectionId(), + session == null || session.getRemoteCondition() == null + ? ClientConstants.NOT_APPLICABLE + : session.getRemoteCondition().toString()); ErrorCondition condition = session != null ? session.getRemoteCondition() : null; if (session != null && session.getLocalState() != EndpointState.CLOSED) { - logger.info( - "onSessionRemoteClose closing a local session for connectionId[{}], entityName[{}], condition[{}], description[{}]", + logger.info("onSessionRemoteClose closing a local session for connectionId[{}], entityName[{}], " + + "condition[{}], description[{}]", getConnectionId(), entityName, condition != null ? condition.getCondition() : ClientConstants.NOT_APPLICABLE, condition != null ? condition.getDescription() : ClientConstants.NOT_APPLICABLE); @@ -112,7 +119,8 @@ entityName, getConnectionId(), if (condition != null) { final Exception exception = ExceptionUtil.toException(condition.getCondition().toString(), - String.format(Locale.US, "onSessionRemoteClose connectionId[%s], entityName[%s]", getConnectionId(), entityName), + String.format(Locale.US, "onSessionRemoteClose connectionId[%s], entityName[%s]", + getConnectionId(), entityName), getErrorContext()); onNext(exception); @@ -134,7 +142,8 @@ public void onSessionFinal(Event e) { private void onSessionTimeout() { // It is supposed to close a local session to handle timeout exception. - // However, closing the session can result in NPE because of proton-j bug (https://issues.apache.org/jira/browse/PROTON-1939). + // However, closing the session can result in NPE because of proton-j bug (https://issues.apache + // .org/jira/browse/PROTON-1939). // And the bug will cause the reactor thread to stop processing pending tasks scheduled on the reactor and // as a result task won't be completed at all. diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/BatchOptions.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/BatchOptions.java index f9ab89c2164b..3155a91ed483 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/BatchOptions.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/BatchOptions.java @@ -5,11 +5,12 @@ import com.azure.messaging.eventhubs.EventDataBatch; import com.azure.messaging.eventhubs.EventHubAsyncProducer; +import com.azure.messaging.eventhubs.EventHubProducer; /** * The set of options that can be specified when creating an {@link EventDataBatch}. * - * @see EventHubAsyncProducer#createBatch() + * @see EventHubProducer#createBatch(BatchOptions) * @see EventHubAsyncProducer#createBatch(BatchOptions) */ public class BatchOptions implements Cloneable { @@ -22,7 +23,7 @@ public class BatchOptions implements Cloneable { * @param maximumSizeInBytes The maximum size to allow for the {@link EventDataBatch batch of events}. * @return The updated {@link BatchOptions} object. */ - public BatchOptions maximumSizeInBytes(int maximumSizeInBytes) { + public BatchOptions setMaximumSizeInBytes(int maximumSizeInBytes) { this.maximumSizeInBytes = maximumSizeInBytes; return this; } @@ -32,7 +33,7 @@ public BatchOptions maximumSizeInBytes(int maximumSizeInBytes) { * * @return The maximum size to allow for a single batch of events, in bytes. */ - public int maximumSizeInBytes() { + public int getMaximumSizeInBytes() { return maximumSizeInBytes; } @@ -43,7 +44,7 @@ public int maximumSizeInBytes() { * @param partitionKey The partition hashing key to associate with the event or batch of events. * @return The updated {@link BatchOptions} object. */ - public BatchOptions partitionKey(String partitionKey) { + public BatchOptions setPartitionKey(String partitionKey) { this.partitionKey = partitionKey; return this; } @@ -54,7 +55,7 @@ public BatchOptions partitionKey(String partitionKey) { * * @return The partition hashing key to associate with the event or batch of events. */ - public String partitionKey() { + public String getPartitionKey() { return partitionKey; } @@ -72,7 +73,7 @@ public BatchOptions clone() { clone = new BatchOptions(); } - return clone.partitionKey(partitionKey) - .maximumSizeInBytes(maximumSizeInBytes); + return clone.setPartitionKey(partitionKey) + .setMaximumSizeInBytes(maximumSizeInBytes); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/Checkpoint.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/Checkpoint.java index 02e2b11f99ec..040bae2c8be3 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/Checkpoint.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/Checkpoint.java @@ -17,8 +17,8 @@ public class Checkpoint { private String consumerGroupName; private String ownerId; private String partitionId; - private String offset; - private long sequenceNumber; + private Long offset; + private Long sequenceNumber; private String eTag; /** @@ -26,7 +26,7 @@ public class Checkpoint { * * @return The Event Hub name associated with this checkpoint. */ - public String eventHubName() { + public String getEventHubName() { return eventHubName; } @@ -36,7 +36,7 @@ public String eventHubName() { * @param eventHubName The Event Hub name associated with this checkpoint. * @return The updated {@link Checkpoint} instance. */ - public Checkpoint eventHubName(String eventHubName) { + public Checkpoint setEventHubName(String eventHubName) { this.eventHubName = eventHubName; return this; } @@ -46,7 +46,7 @@ public Checkpoint eventHubName(String eventHubName) { * * @return The consumer group name associated with this checkpoint. */ - public String consumerGroupName() { + public String getConsumerGroupName() { return consumerGroupName; } @@ -56,7 +56,7 @@ public String consumerGroupName() { * @param consumerGroupName The consumer group name associated with this checkpoint. * @return The updated {@link Checkpoint} instance. */ - public Checkpoint consumerGroupName(String consumerGroupName) { + public Checkpoint setConsumerGroupName(String consumerGroupName) { this.consumerGroupName = consumerGroupName; return this; } @@ -66,7 +66,7 @@ public Checkpoint consumerGroupName(String consumerGroupName) { * * @return The partition id associated with this checkpoint. */ - public String partitionId() { + public String getPartitionId() { return partitionId; } @@ -76,7 +76,7 @@ public String partitionId() { * @param partitionId The partition id associated with this checkpoint. * @return The updated {@link Checkpoint} instance. */ - public Checkpoint partitionId(String partitionId) { + public Checkpoint setPartitionId(String partitionId) { this.partitionId = partitionId; return this; } @@ -86,7 +86,7 @@ public Checkpoint partitionId(String partitionId) { * * @return The unique event processor identifier that created this checkpoint. */ - public String ownerId() { + public String getOwnerId() { return ownerId; } @@ -96,7 +96,7 @@ public String ownerId() { * @param ownerId The unique event processor identifier that created this checkpoint. * @return The updated {@link Checkpoint} instance. */ - public Checkpoint ownerId(String ownerId) { + public Checkpoint setOwnerId(String ownerId) { this.ownerId = ownerId; return this; } @@ -106,7 +106,7 @@ public Checkpoint ownerId(String ownerId) { * * @return The offset of the last successfully processed event to store as checkpoint. */ - public String offset() { + public Long getOffset() { return offset; } @@ -116,7 +116,7 @@ public String offset() { * @param offset The offset of the last successfully processed event to store as checkpoint. * @return The updated {@link Checkpoint} instance. */ - public Checkpoint offset(String offset) { + public Checkpoint setOffset(Long offset) { this.offset = offset; return this; } @@ -126,7 +126,7 @@ public Checkpoint offset(String offset) { * * @return The sequence number of the last successfully processed event to store as checkpoint. */ - public Long sequenceNumber() { + public Long getSequenceNumber() { return sequenceNumber; } @@ -136,7 +136,7 @@ public Long sequenceNumber() { * @param sequenceNumber The sequence number of the last successfully processed event to store as checkpoint. * @return The updated {@link Checkpoint} instance. */ - public Checkpoint sequenceNumber(Long sequenceNumber) { + public Checkpoint setSequenceNumber(Long sequenceNumber) { this.sequenceNumber = sequenceNumber; return this; } @@ -146,7 +146,7 @@ public Checkpoint sequenceNumber(Long sequenceNumber) { * * @return The unique identifier that was generated by last known successful update. */ - public String eTag() { + public String getETag() { return eTag; } @@ -157,7 +157,7 @@ public String eTag() { * @param eTag The unique identifier that was generated by last known successful update. * @return The updated {@link Checkpoint} instance. */ - public Checkpoint eTag(String eTag) { + public Checkpoint setETag(String eTag) { this.eTag = eTag; return this; } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventHubConsumerOptions.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventHubConsumerOptions.java index 3db1c4c07d0c..f1fee5fb4f0a 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventHubConsumerOptions.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventHubConsumerOptions.java @@ -6,22 +6,27 @@ import com.azure.core.amqp.RetryOptions; import com.azure.core.implementation.annotation.Fluent; import com.azure.core.implementation.util.ImplUtils; +import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.EventHubAsyncClient; import com.azure.messaging.eventhubs.EventHubAsyncConsumer; +import com.azure.messaging.eventhubs.EventHubClient; +import com.azure.messaging.eventhubs.EventHubConsumer; import reactor.core.scheduler.Scheduler; import java.util.Locale; import java.util.Optional; /** - * The baseline set of options that can be specified when creating a {@link EventHubAsyncConsumer} to configure its - * behavior. + * The baseline set of options that can be specified when creating an {@link EventHubConsumer} or an + * {@link EventHubAsyncConsumer} to configure its behavior. * - * @see EventHubAsyncConsumer + * @see EventHubClient#createConsumer(String, String, EventPosition, EventHubConsumerOptions) * @see EventHubAsyncClient#createConsumer(String, String, EventPosition, EventHubConsumerOptions) */ @Fluent public class EventHubConsumerOptions implements Cloneable { + private final ClientLogger logger = new ClientLogger(EventHubConsumerOptions.class); + /** * The maximum length, in characters, for the identifier assigned to an {@link EventHubAsyncConsumer}. */ @@ -57,12 +62,12 @@ public EventHubConsumerOptions() { * @param identifier The receiver name. * @return The updated {@link EventHubConsumerOptions} object. * @throws IllegalArgumentException if {@code identifier} is greater than {@link - * #MAXIMUM_IDENTIFIER_LENGTH}. + * #MAXIMUM_IDENTIFIER_LENGTH}. */ - public EventHubConsumerOptions identifier(String identifier) { + public EventHubConsumerOptions setIdentifier(String identifier) { if (!ImplUtils.isNullOrEmpty(identifier) && identifier.length() > MAXIMUM_IDENTIFIER_LENGTH) { - throw new IllegalArgumentException(String.format(Locale.US, - "identifier length cannot exceed %s", MAXIMUM_IDENTIFIER_LENGTH)); + throw logger.logExceptionAsError(new IllegalArgumentException(String.format(Locale.US, + "identifier length cannot exceed %s", MAXIMUM_IDENTIFIER_LENGTH))); } this.identifier = identifier; @@ -74,7 +79,7 @@ public EventHubConsumerOptions identifier(String identifier) { * intended to be the only reader of events for the requested partition and an associated consumer group. To do so, * this consumer will attempt to assert ownership over the partition; in the case where more than one exclusive * consumer attempts to assert ownership for the same partition/consumer group pair, the one having a larger {@link - * EventHubConsumerOptions#ownerLevel()} value will "win". + * EventHubConsumerOptions#getOwnerLevel()} value will "win". * *

* When an exclusive consumer is used, those consumers which are not exclusive or which have a lower priority will @@ -83,13 +88,14 @@ public EventHubConsumerOptions identifier(String identifier) { *

* * @param priority The priority associated with an exclusive consumer; for a non-exclusive consumer, this - * value should be {@code null}. + * value should be {@code null}. * @return The updated {@link EventHubConsumerOptions} object. * @throws IllegalArgumentException if {@code priority} is not {@code null} and is less than 0. */ - public EventHubConsumerOptions ownerLevel(Long priority) { + public EventHubConsumerOptions setOwnerLevel(Long priority) { if (priority != null && priority < 0) { - throw new IllegalArgumentException("'priority' cannot be a negative value. Please specify a zero or positive long value."); + throw logger.logExceptionAsError(new IllegalArgumentException( + "'priority' cannot be a negative value. Please specify a zero or positive long value.")); } this.ownerLevel = priority; @@ -103,7 +109,7 @@ public EventHubConsumerOptions ownerLevel(Long priority) { * @param retry The retry policy to use when receiving events. * @return The updated {@link EventHubConsumerOptions} object. */ - public EventHubConsumerOptions retry(RetryOptions retry) { + public EventHubConsumerOptions setRetry(RetryOptions retry) { this.retry = retry; return this; } @@ -115,17 +121,17 @@ public EventHubConsumerOptions retry(RetryOptions retry) { * @param prefetchCount The amount of events to queue locally. * @return The updated {@link EventHubConsumerOptions} object. * @throws IllegalArgumentException if {@code prefetchCount} is less than the {@link - * #MINIMUM_PREFETCH_COUNT} or greater than {@link #MAXIMUM_PREFETCH_COUNT}. + * #MINIMUM_PREFETCH_COUNT} or greater than {@link #MAXIMUM_PREFETCH_COUNT}. */ - public EventHubConsumerOptions prefetchCount(int prefetchCount) { + public EventHubConsumerOptions setPrefetchCount(int prefetchCount) { if (prefetchCount < MINIMUM_PREFETCH_COUNT) { - throw new IllegalArgumentException(String.format(Locale.US, - "PrefetchCount, '%s' has to be above %s", prefetchCount, MINIMUM_PREFETCH_COUNT)); + throw logger.logExceptionAsError(new IllegalArgumentException(String.format(Locale.US, + "PrefetchCount, '%s' has to be above %s", prefetchCount, MINIMUM_PREFETCH_COUNT))); } if (prefetchCount > MAXIMUM_PREFETCH_COUNT) { - throw new IllegalArgumentException(String.format(Locale.US, - "PrefetchCount, '%s', has to be below %s", prefetchCount, MAXIMUM_PREFETCH_COUNT)); + throw logger.logExceptionAsError(new IllegalArgumentException(String.format(Locale.US, + "PrefetchCount, '%s', has to be below %s", prefetchCount, MAXIMUM_PREFETCH_COUNT))); } this.prefetchCount = prefetchCount; @@ -139,7 +145,7 @@ public EventHubConsumerOptions prefetchCount(int prefetchCount) { * @param scheduler The scheduler for receiving events. * @return The updated EventHubClientBuilder object. */ - public EventHubConsumerOptions scheduler(Scheduler scheduler) { + public EventHubConsumerOptions setScheduler(Scheduler scheduler) { this.scheduler = scheduler; return this; } @@ -150,7 +156,7 @@ public EventHubConsumerOptions scheduler(Scheduler scheduler) { * * @return The identifier of the receiver. */ - public String identifier() { + public String getIdentifier() { return identifier; } @@ -160,7 +166,7 @@ public String identifier() { * * @return The retry options when receiving events. */ - public RetryOptions retry() { + public RetryOptions getRetry() { return retry; } @@ -171,7 +177,7 @@ public RetryOptions retry() { * * @return An optional owner level for this consumer. */ - public Long ownerLevel() { + public Long getOwnerLevel() { return ownerLevel; } @@ -181,7 +187,7 @@ public Long ownerLevel() { * * @return The scheduler for reading events. */ - public Scheduler scheduler() { + public Scheduler getScheduler() { return scheduler; } @@ -190,9 +196,9 @@ public Scheduler scheduler() { * locally without regard to whether a receive operation is currently active. * * @return The prefetch count receiver will receive and queue locally regardless of whether or not a receive - * operation is active. + * operation is active. */ - public int prefetchCount() { + public int getPrefetchCount() { return prefetchCount; } @@ -210,13 +216,13 @@ public EventHubConsumerOptions clone() { clone = new EventHubConsumerOptions(); } - clone.scheduler(this.scheduler()) - .identifier(this.identifier()) - .prefetchCount(this.prefetchCount()) - .ownerLevel(this.ownerLevel()); + clone.setScheduler(this.getScheduler()) + .setIdentifier(this.getIdentifier()) + .setPrefetchCount(this.getPrefetchCount()) + .setOwnerLevel(this.getOwnerLevel()); if (retry != null) { - clone.retry(retry.clone()); + clone.setRetry(retry.clone()); } return clone; diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventHubProducerOptions.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventHubProducerOptions.java index 83be11882728..4d7881ef1e75 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventHubProducerOptions.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventHubProducerOptions.java @@ -20,8 +20,8 @@ public class EventHubProducerOptions implements Cloneable { private RetryOptions retryOptions; /** - * Sets the identifier of the Event Hub partition that the {@link EventHubAsyncProducer} will be bound to, limiting it to - * sending events to only that partition. + * Sets the identifier of the Event Hub partition that the {@link EventHubAsyncProducer} will be bound to, + * limiting it to sending events to only that partition. * * If the identifier is not specified, the Event Hubs service will be responsible for routing events that are sent * to an available partition. @@ -31,7 +31,7 @@ public class EventHubProducerOptions implements Cloneable { * the identifier of the desired partition. * @return The updated {@link EventHubProducerOptions} object. */ - public EventHubProducerOptions partitionId(String partitionId) { + public EventHubProducerOptions setPartitionId(String partitionId) { this.partitionId = partitionId; return this; } @@ -42,7 +42,7 @@ public EventHubProducerOptions partitionId(String partitionId) { * @param retry The retry options used to govern retry attempts when an issue is encountered while sending. * @return The updated SenderOptions object. */ - public EventHubProducerOptions retry(RetryOptions retry) { + public EventHubProducerOptions setRetry(RetryOptions retry) { this.retryOptions = retry; return this; } @@ -50,23 +50,23 @@ public EventHubProducerOptions retry(RetryOptions retry) { /** * Gets the retry options used to govern retry attempts when an issue is encountered while sending. * - * @return the retry options used to govern retry attempts when an issue is encountered while sending. If {@code - * null}, then the retry options configured on the associated {@link EventHubAsyncClient} is used. + * @return the retry options used to govern retry attempts when an issue is encountered while sending. If + * {@code null}, then the retry options configured on the associated {@link EventHubAsyncClient} is used. */ - public RetryOptions retry() { + public RetryOptions getRetry() { return retryOptions; } /** - * Gets the identifier of the Event Hub partition that the {@link EventHubAsyncProducer} will be bound to, limiting it to - * sending events to only that partition. + * Gets the identifier of the Event Hub partition that the {@link EventHubAsyncProducer} will be bound to, limiting + * it to sending events to only that partition. * * If the identifier is not specified, the Event Hubs service will be responsible for routing events that are sent * to an available partition. * * @return the identifier of the Event Hub partition that the {@link EventHubAsyncProducer} will be bound to. */ - public String partitionId() { + public String getPartitionId() { return partitionId; } @@ -84,10 +84,10 @@ public EventHubProducerOptions clone() { clone = new EventHubProducerOptions(); } - clone.partitionId(partitionId); + clone.setPartitionId(partitionId); if (retryOptions != null) { - clone.retry(retryOptions.clone()); + clone.setRetry(retryOptions.clone()); } return clone; diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventPosition.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventPosition.java index e9fb3f0c9e37..ff3238fee468 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventPosition.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventPosition.java @@ -4,9 +4,10 @@ package com.azure.messaging.eventhubs.models; import com.azure.core.implementation.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.EventData; +import com.azure.messaging.eventhubs.EventHubAsyncClient; import com.azure.messaging.eventhubs.EventHubAsyncConsumer; +import com.azure.messaging.eventhubs.EventHubClient; import java.time.Instant; import java.util.Locale; @@ -16,14 +17,15 @@ * Defines a position of an {@link EventData} in the Event Hub partition. The position can be an offset, sequence * number, or enqueued time. * - * @see EventHubAsyncConsumer + * @see EventHubClient#createConsumer(String, String, EventPosition) + * @see EventHubAsyncClient#createConsumer(String, String, EventPosition) */ @Immutable public final class EventPosition { /** * This is a constant defined to represent the start of a partition stream in EventHub. */ - private static final String START_OF_STREAM = "-1"; + private static final Long START_OF_STREAM = -1L; /** * This is a constant defined to represent the current end of a partition stream in EventHub. This can be used as an @@ -33,14 +35,18 @@ public final class EventPosition { private static final String END_OF_STREAM = "@latest"; private static final EventPosition EARLIEST = fromOffset(START_OF_STREAM, false); - private static final EventPosition LATEST = fromOffset(END_OF_STREAM, false); + private static final EventPosition LATEST = new EventPosition(false, END_OF_STREAM, null, null); - private final ClientLogger logger = new ClientLogger(EventPosition.class); private final boolean isInclusive; private final String offset; private final Long sequenceNumber; private final Instant enqueuedDateTime; + private EventPosition(final boolean isInclusive, final Long offset, final Long sequenceNumber, + final Instant enqueuedDateTime) { + this(isInclusive, String.valueOf(offset), sequenceNumber, enqueuedDateTime); + } + private EventPosition(final boolean isInclusive, final String offset, final Long sequenceNumber, final Instant enqueuedDateTime) { this.offset = offset; @@ -79,7 +85,7 @@ public static EventPosition latest() { * @return An {@link EventPosition} object. */ public static EventPosition fromEnqueuedTime(Instant enqueuedDateTime) { - return new EventPosition(false, null, null, enqueuedDateTime); + return new EventPosition(false, (String) null, null, enqueuedDateTime); } /** @@ -94,7 +100,7 @@ public static EventPosition fromEnqueuedTime(Instant enqueuedDateTime) { * @param offset The offset of the event within that partition. * @return An {@link EventPosition} object. */ - public static EventPosition fromOffset(String offset) { + public static EventPosition fromOffset(long offset) { return fromOffset(offset, true); } @@ -103,13 +109,11 @@ public static EventPosition fromOffset(String offset) { * with the same offset is returned. Otherwise, the next event is received. * * @param offset The offset of an event with respect to its relative position in the - * @param isInclusive If true, the event with the {@code offset} is included; otherwise, the next event will - * be received. + * @param isInclusive If true, the event with the {@code offset} is included; otherwise, the next event will be + * received. * @return An {@link EventPosition} object. */ - public static EventPosition fromOffset(String offset, boolean isInclusive) { - Objects.requireNonNull(offset); - + public static EventPosition fromOffset(long offset, boolean isInclusive) { return new EventPosition(isInclusive, offset, null, null); } @@ -129,12 +133,12 @@ public static EventPosition fromSequenceNumber(long sequenceNumber) { * number is returned. Otherwise, the next event in the sequence is received. * * @param sequenceNumber is the sequence number of the event. - * @param isInclusive If true, the event with the {@code sequenceNumber} is included; otherwise, the next - * event will be received. + * @param isInclusive If true, the event with the {@code sequenceNumber} is included; otherwise, the next event + * will be received. * @return An {@link EventPosition} object. */ public static EventPosition fromSequenceNumber(long sequenceNumber, boolean isInclusive) { - return new EventPosition(isInclusive, null, sequenceNumber, null); + return new EventPosition(isInclusive, (String) null, sequenceNumber, null); } /** @@ -154,7 +158,7 @@ public boolean isInclusive() { * * @return The offset of the event within that partition. */ - public String offset() { + public String getOffset() { return offset; } @@ -163,16 +167,16 @@ public String offset() { * * @return The sequence number of the event. */ - public Long sequenceNumber() { + public Long getSequenceNumber() { return sequenceNumber; } /** - * Gets the instant, in UTC, from which the next available event should be chosen.. + * Gets the instant, in UTC, from which the next available event should be chosen. * - * @return The instant, in UTC, from which the next available event should be chosen.. + * @return The instant, in UTC, from which the next available event should be chosen. */ - public Instant enqueuedDateTime() { + public Instant getEnqueuedDateTime() { return this.enqueuedDateTime; } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/PartitionContext.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/PartitionContext.java index 8051f438ec76..f889ea598933 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/PartitionContext.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/PartitionContext.java @@ -4,8 +4,13 @@ package com.azure.messaging.eventhubs.models; import com.azure.core.implementation.annotation.Immutable; +import com.azure.messaging.eventhubs.EventData; +import com.azure.messaging.eventhubs.EventProcessor; +import com.azure.messaging.eventhubs.PartitionManager; import com.azure.messaging.eventhubs.PartitionProcessor; import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; +import reactor.core.publisher.Mono; /** * A model class to contain partition information that will be provided to each instance of {@link PartitionProcessor}. @@ -15,19 +20,31 @@ public class PartitionContext { private final String partitionId; private final String eventHubName; - private final String consumerGroupName; + private final String consumerGroup; + private final String ownerId; + private final AtomicReference eTag; + private final PartitionManager partitionManager; /** - * Creates an immutable instance containing the information for processing a partition. + * Creates an instance of PartitionContext that contains partition information available to each + * {@link PartitionProcessor}. * - * @param partitionId The partition id. - * @param eventHubName The Event Hub name. - * @param consumerGroupName The consumer group name. + * @param partitionId The partition id of the partition processed by the {@link PartitionProcessor}. + * @param eventHubName The Event Hub name associated with the {@link EventProcessor}. + * @param consumerGroup The consumer group name associated with the {@link EventProcessor}. + * @param ownerId The unique identifier of the {@link EventProcessor} instance. + * @param eTag The last known ETag stored in {@link PartitionManager} for this partition. + * @param partitionManager A {@link PartitionManager} implementation to read and update partition ownership and + * checkpoint information. */ - public PartitionContext(String partitionId, String eventHubName, String consumerGroupName) { + public PartitionContext(String partitionId, String eventHubName, String consumerGroup, + String ownerId, String eTag, PartitionManager partitionManager) { this.partitionId = Objects.requireNonNull(partitionId, "partitionId cannot be null"); this.eventHubName = Objects.requireNonNull(eventHubName, "eventHubName cannot be null"); - this.consumerGroupName = Objects.requireNonNull(consumerGroupName, "consumerGroupName cannot be null"); + this.consumerGroup = Objects.requireNonNull(consumerGroup, "consumerGroup cannot be null"); + this.ownerId = Objects.requireNonNull(ownerId, "ownerId cannot be null"); + this.eTag = new AtomicReference<>(eTag); + this.partitionManager = Objects.requireNonNull(partitionManager, "partitionManager cannot be null"); } /** @@ -35,7 +52,7 @@ public PartitionContext(String partitionId, String eventHubName, String consumer * * @return The partition id associated to an instance of {@link PartitionProcessor}. */ - public String partitionId() { + public String getPartitionId() { return partitionId; } @@ -44,7 +61,7 @@ public String partitionId() { * * @return The Event Hub name associated to an instance of {@link PartitionProcessor}. */ - public String eventHubName() { + public String getEventHubName() { return eventHubName; } @@ -53,7 +70,53 @@ public String eventHubName() { * * @return The consumer group name associated to an instance of {@link PartitionProcessor}. */ - public String consumerGroupName() { - return consumerGroupName; + public String getConsumerGroup() { + return consumerGroup; + } + + /** + * Updates the checkpoint for this partition using the event data. This will serve as the last known successfully + * processed event in this partition if the update is successful. + * + * @param eventData The event data to use for updating the checkpoint. + * @return a representation of deferred execution of this call. + */ + public Mono updateCheckpoint(EventData eventData) { + String previousETag = this.eTag.get(); + Checkpoint checkpoint = new Checkpoint() + .setConsumerGroupName(consumerGroup) + .setEventHubName(eventHubName) + .setOwnerId(ownerId) + .setPartitionId(partitionId) + .setSequenceNumber(eventData.getSequenceNumber()) + .setOffset(eventData.getOffset()) + .setETag(previousETag); + return this.partitionManager.updateCheckpoint(checkpoint) + .map(eTag -> this.eTag.compareAndSet(previousETag, eTag)) + .then(); + } + + /** + * Updates a checkpoint using the given offset and sequence number. This will serve as the last known successfully + * processed event in this partition if the update is successful. + * + * @param sequenceNumber The sequence number to update the checkpoint. + * @param offset The offset to update the checkpoint. + * @return a representation of deferred execution of this call. + */ + public Mono updateCheckpoint(long sequenceNumber, Long offset) { + String previousETag = this.eTag.get(); + Checkpoint checkpoint = new Checkpoint() + .setConsumerGroupName(consumerGroup) + .setEventHubName(eventHubName) + .setOwnerId(ownerId) + .setPartitionId(partitionId) + .setSequenceNumber(sequenceNumber) + .setOffset(offset) + .setETag(previousETag); + + return this.partitionManager.updateCheckpoint(checkpoint) + .map(eTag -> this.eTag.compareAndSet(previousETag, eTag)) + .then(); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/PartitionOwnership.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/PartitionOwnership.java index d2f54b75f375..3f991f633570 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/PartitionOwnership.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/PartitionOwnership.java @@ -4,6 +4,7 @@ package com.azure.messaging.eventhubs.models; import com.azure.core.implementation.annotation.Fluent; + import java.util.Objects; /** @@ -17,7 +18,7 @@ public class PartitionOwnership { private String partitionId; private String ownerId; private long ownerLevel; - private String offset; + private Long offset; private Long sequenceNumber; private Long lastModifiedTime; private String eTag; @@ -27,7 +28,7 @@ public class PartitionOwnership { * * @return The Event Hub name associated with this ownership record. */ - public String eventHubName() { + public String getEventHubName() { return eventHubName; } @@ -37,7 +38,7 @@ public String eventHubName() { * @param eventHubName The Event Hub name associated with this ownership record. * @return The updated {@link PartitionOwnership} instance. */ - public PartitionOwnership eventHubName(String eventHubName) { + public PartitionOwnership setEventHubName(String eventHubName) { this.eventHubName = Objects.requireNonNull(eventHubName, "eventHubName cannot be null"); return this; } @@ -47,7 +48,7 @@ public PartitionOwnership eventHubName(String eventHubName) { * * @return The consumer group name associated with this ownership record. */ - public String consumerGroupName() { + public String getConsumerGroupName() { return consumerGroupName; } @@ -57,7 +58,7 @@ public String consumerGroupName() { * @param consumerGroupName The consumer group name associated with this ownership record. * @return The updated {@link PartitionOwnership} instance. */ - public PartitionOwnership consumerGroupName(String consumerGroupName) { + public PartitionOwnership setConsumerGroupName(String consumerGroupName) { this.consumerGroupName = Objects.requireNonNull(consumerGroupName, "consumerGroupName cannot be null"); return this; } @@ -67,7 +68,7 @@ public PartitionOwnership consumerGroupName(String consumerGroupName) { * * @return The partition id associated with this ownership record. */ - public String partitionId() { + public String getPartitionId() { return partitionId; } @@ -77,7 +78,7 @@ public String partitionId() { * @param partitionId The partition id associated with this ownership record. * @return The updated {@link PartitionOwnership} instance. */ - public PartitionOwnership partitionId(String partitionId) { + public PartitionOwnership setPartitionId(String partitionId) { this.partitionId = Objects.requireNonNull(partitionId, "partitionId cannot be null"); return this; } @@ -87,7 +88,7 @@ public PartitionOwnership partitionId(String partitionId) { * * @return The unique event processor identifier as the owner of the partition id in this ownership record. */ - public String ownerId() { + public String getOwnerId() { return ownerId; } @@ -97,28 +98,31 @@ public String ownerId() { * @param ownerId The unique event processor identifier that owns the partition id in this ownership record. * @return The updated {@link PartitionOwnership} instance. */ - public PartitionOwnership ownerId(String ownerId) { + public PartitionOwnership setOwnerId(String ownerId) { this.ownerId = Objects.requireNonNull(ownerId, "ownerId cannot be null"); return this; } /** - * Gets the owner level (aka epoch number) for the event processor identified by {@link #ownerId() this instance}. + * Gets the owner level (aka epoch number) for the event processor identified by + * {@link #getOwnerId() this instance}. * - * @return The owner level (aka epoch number) for the event processor identified by {@link #ownerId() this instance}. + * @return The owner level (aka epoch number) for the event processor identified by {@link #getOwnerId() this + * instance}. */ - public long ownerLevel() { + public long getOwnerLevel() { return ownerLevel; } /** - * Sets the owner level (aka epoch number) for the event processor identified by {@link #ownerId() this instance}. + * Sets the owner level (aka epoch number) for the event processor identified by + * {@link #getOwnerId() this instance}. * - * @param ownerLevel The owner level (aka epoch number) for the event processor identified by {@link #ownerId() this - * instance}. + * @param ownerLevel The owner level (aka epoch number) for the event processor identified by {@link #getOwnerId() + * this instance}. * @return The updated {@link PartitionOwnership} instance. */ - public PartitionOwnership ownerLevel(long ownerLevel) { + public PartitionOwnership setOwnerLevel(long ownerLevel) { this.ownerLevel = ownerLevel; return this; } @@ -128,7 +132,7 @@ public PartitionOwnership ownerLevel(long ownerLevel) { * * @return The offset that serves as checkpoint for the partition id in this ownership record. */ - public String offset() { + public Long getOffset() { return offset; } @@ -138,7 +142,7 @@ public String offset() { * @param offset The offset that serves as checkpoint for the partition id in this ownership record. * @return The updated {@link PartitionOwnership} instance. */ - public PartitionOwnership offset(String offset) { + public PartitionOwnership setOffset(Long offset) { this.offset = offset; return this; } @@ -148,17 +152,18 @@ public PartitionOwnership offset(String offset) { * * @return The sequence number that serves as checkpoint for the partition id in this ownership record. */ - public Long sequenceNumber() { + public Long getSequenceNumber() { return sequenceNumber; } /** * Sets the sequence number that serves as checkpoint for the partition id in this ownership record. * - * @param sequenceNumber The sequence number that serves as checkpoint for the partition id in this ownership record. + * @param sequenceNumber The sequence number that serves as checkpoint for the partition id in this ownership + * record. * @return The updated {@link PartitionOwnership} instance. */ - public PartitionOwnership sequenceNumber(Long sequenceNumber) { + public PartitionOwnership setSequenceNumber(Long sequenceNumber) { this.sequenceNumber = sequenceNumber; return this; } @@ -168,7 +173,7 @@ public PartitionOwnership sequenceNumber(Long sequenceNumber) { * * @return The last modified time of this ownership record as epoch millis. */ - public Long lastModifiedTime() { + public Long getLastModifiedTime() { return lastModifiedTime; } @@ -178,23 +183,23 @@ public Long lastModifiedTime() { * @param lastModifiedTime The last modified time of this ownership record as epoch millis. * @return The updated {@link PartitionOwnership} instance. */ - public PartitionOwnership lastModifiedTime(Long lastModifiedTime) { + public PartitionOwnership setLastModifiedTime(Long lastModifiedTime) { this.lastModifiedTime = lastModifiedTime; return this; } /** - * Gets the ETag that was generated by the last known successful update to the partition ownership record. An ETag is - * a unique identifier * that is generated when a data record is successfully created/updated. The ETag is used to - * achieve optimistic concurrency in a distributed event processor setup. When multiple instances of event processor - * try to update the same partition ownership record, ETag is used to verify that the last values read by the instance - * requesting the update is still the latest ETag for this record. If the ETag in the store does not match the ETag in - * the update request, then the update is expected to fail as there was an update since the last time an event - * processor read this record. + * Gets the ETag that was generated by the last known successful update to the partition ownership record. An ETag + * is a unique identifier * that is generated when a data record is successfully created/updated. The ETag is used + * to achieve optimistic concurrency in a distributed event processor setup. When multiple instances of event + * processor try to update the same partition ownership record, ETag is used to verify that the last values read by + * the instance requesting the update is still the latest ETag for this record. If the ETag in the store does not + * match the ETag in the update request, then the update is expected to fail as there was an update since the last + * time an event processor read this record. * * @return The eTag for this ownership record. */ - public String eTag() { + public String getETag() { return eTag; } @@ -210,7 +215,7 @@ public String eTag() { * @param eTag The eTag for this ownership record. * @return The updated {@link PartitionOwnership} instance. */ - public PartitionOwnership eTag(String eTag) { + public PartitionOwnership setETag(String eTag) { this.eTag = eTag; return this; } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/ProxyConfiguration.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/ProxyConfiguration.java index 3dce44b44b49..add82cb60c7e 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/ProxyConfiguration.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/ProxyConfiguration.java @@ -3,8 +3,9 @@ package com.azure.messaging.eventhubs.models; -import com.azure.core.util.logging.ClientLogger; import com.azure.core.implementation.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.messaging.eventhubs.EventHubClientBuilder; import java.net.PasswordAuthentication; import java.net.Proxy; @@ -13,6 +14,8 @@ /** * Properties for configuring proxies with Event Hubs. + * + * @see EventHubClientBuilder#proxyConfiguration(ProxyConfiguration) */ @Immutable public class ProxyConfiguration implements AutoCloseable { @@ -47,18 +50,17 @@ private ProxyConfiguration() { * * @param authentication Authentication method to preemptively use with proxy. * @param proxyAddress Proxy to use. If {@code null} is passed in, then the system configured {@link java.net.Proxy} - * is used. + * is used. * @param username Optional. Username used to authenticate with proxy. If not specified, the system-wide - * {@link java.net.Authenticator} is used to fetch credentials. + * {@link java.net.Authenticator} is used to fetch credentials. * @param password Optional. Password used to authenticate with proxy. - * * @throws NullPointerException if {@code authentication} is {@code null}. * @throws IllegalArgumentException if {@code authentication} is {@link ProxyAuthenticationType#BASIC} or - * {@link ProxyAuthenticationType#DIGEST} and {@code username} or {@code password} are {@code null}. + * {@link ProxyAuthenticationType#DIGEST} and {@code username} or {@code password} are {@code null}. */ - public ProxyConfiguration(ProxyAuthenticationType authentication, Proxy proxyAddress, String username, String password) { - Objects.requireNonNull(authentication); - this.authentication = authentication; + public ProxyConfiguration(ProxyAuthenticationType authentication, Proxy proxyAddress, String username, + String password) { + this.authentication = Objects.requireNonNull(authentication, "'authentication' cannot be null."); this.proxyAddress = proxyAddress; if (username != null && password != null) { @@ -72,30 +74,30 @@ public ProxyConfiguration(ProxyAuthenticationType authentication, Proxy proxyAdd /** * Gets the proxy authentication type. * - * @return the proxy authentication type to use. Returns {@code null} if no authentication type was set. - * This occurs when user uses {@link ProxyConfiguration#SYSTEM_DEFAULTS}. + * @return the proxy authentication type to use. Returns {@code null} if no authentication type was set. This occurs + * when user uses {@link ProxyConfiguration#SYSTEM_DEFAULTS}. */ - public ProxyAuthenticationType authentication() { + public ProxyAuthenticationType getAuthentication() { return this.authentication; } /** * Gets the proxy address. * - * @return the proxy address. Return {@code null} if no proxy address was set - * This occurs when user uses {@link ProxyConfiguration#SYSTEM_DEFAULTS}. + * @return the proxy address. Return {@code null} if no proxy address was set This occurs when user uses + * {@link ProxyConfiguration#SYSTEM_DEFAULTS}. */ - public Proxy proxyAddress() { + public Proxy getProxyAddress() { return this.proxyAddress; } /** * Gets the credentials user provided for authentication of proxy server. * - * @return the username and password to use. Return {@code null} if no credential was set. - * This occurs when user uses {@link ProxyConfiguration#SYSTEM_DEFAULTS}. + * @return the username and password to use. Return {@code null} if no credential was set. This occurs when user + * uses {@link ProxyConfiguration#SYSTEM_DEFAULTS}. */ - public PasswordAuthentication credential() { + public PasswordAuthentication getCredential() { return this.credentials; } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/SendOptions.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/SendOptions.java index a78a8951c379..0ad8f7a0c163 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/SendOptions.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/SendOptions.java @@ -6,12 +6,15 @@ import com.azure.core.implementation.annotation.Fluent; import com.azure.messaging.eventhubs.EventData; import com.azure.messaging.eventhubs.EventHubAsyncProducer; +import com.azure.messaging.eventhubs.EventHubProducer; import reactor.core.publisher.Flux; /** * The set of options that can be specified when sending a set of events to influence the way in which events are sent * to the Event Hubs service. * + * @see EventHubProducer#send(EventData, SendOptions) + * @see EventHubProducer#send(Iterable, SendOptions) * @see EventHubAsyncProducer#send(EventData, SendOptions) * @see EventHubAsyncProducer#send(Iterable, SendOptions) * @see EventHubAsyncProducer#send(Flux, SendOptions) @@ -36,7 +39,7 @@ public class SendOptions implements Cloneable { * @param partitionKey The partition hashing key to associate with the event or batch of events. * @return The updated {@link SendOptions} object. */ - public SendOptions partitionKey(String partitionKey) { + public SendOptions setPartitionKey(String partitionKey) { this.partitionKey = partitionKey; return this; } @@ -47,7 +50,7 @@ public SendOptions partitionKey(String partitionKey) { * * @return The partition hashing key to associate with the event or batch of events. */ - public String partitionKey() { + public String getPartitionKey() { return partitionKey; } @@ -65,6 +68,6 @@ public SendOptions clone() { clone = new SendOptions(); } - return clone.partitionKey(partitionKey); + return clone.setPartitionKey(partitionKey); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/package-info.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/package-info.java index 3ef8e300da4e..7810797995e5 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/package-info.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/package-info.java @@ -2,7 +2,7 @@ // Licensed under the MIT License. /** - * Package containing classes for creating a {@link com.azure.messaging.eventhubs.EventHubAsyncClient} to - * perform operations on Azure Event Hubs. + * Package containing classes for creating an {@link com.azure.messaging.eventhubs.EventHubClient} or an + * {@link com.azure.messaging.eventhubs.EventHubAsyncClient} to perform operations on Azure Event Hubs. */ package com.azure.messaging.eventhubs; diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEvent.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEvent.java index 89f7b0f63257..3dc7fb5b43ec 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEvent.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEvent.java @@ -51,6 +51,11 @@ public static void main(String[] args) throws InterruptedException, IOException // TimeoutException is thrown. String firstPartition = client.getPartitionIds().blockFirst(OPERATION_TIMEOUT); + // This shouldn't happen, but if we are unable to get the partitions within the timeout period. + if (firstPartition == null) { + firstPartition = "0"; + } + // Create a consumer. // The "$Default" consumer group is created by default. This value can be found by going to the Event Hub // instance you are connecting to, and selecting the "Consumer groups" page. EventPosition.latest() tells the @@ -61,16 +66,16 @@ public static void main(String[] args) throws InterruptedException, IOException // We start receiving any events that come from `firstPartition`, print out the contents, and decrement the // countDownLatch. Disposable subscription = consumer.receive().subscribe(event -> { - String contents = UTF_8.decode(event.body()).toString(); + String contents = UTF_8.decode(event.getBody()).toString(); System.out.println(String.format("[%s] Sequence Number: %s. Contents: %s", countDownLatch.getCount(), - event.sequenceNumber(), contents)); + event.getSequenceNumber(), contents)); countDownLatch.countDown(); }); // Because the consumer is only listening to new events, we need to send some events to `firstPartition`. // This creates a producer that only sends events to `firstPartition`. - EventHubProducerOptions producerOptions = new EventHubProducerOptions().partitionId(firstPartition); + EventHubProducerOptions producerOptions = new EventHubProducerOptions().setPartitionId(firstPartition); EventHubAsyncProducer producer = client.createProducer(producerOptions); // We create 10 events to send to the service and block until the send has completed. diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEventsFromKnownSequenceNumberPosition.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEventsFromKnownSequenceNumberPosition.java index 468551968dea..01684affbfc3 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEventsFromKnownSequenceNumberPosition.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEventsFromKnownSequenceNumberPosition.java @@ -48,8 +48,8 @@ public static void main(String[] args) throws InterruptedException, IOException .subscribe( properties -> { if (!properties.isEmpty()) { - lastEnqueuedSequenceNumber = properties.lastEnqueuedSequenceNumber(); - lastEnqueuedSequencePartitionID = properties.id(); + lastEnqueuedSequenceNumber = properties.getLastEnqueuedSequenceNumber(); + lastEnqueuedSequencePartitionID = properties.getId(); } }, error -> System.err.println("Error occurred while fetching partition properties: " + error.toString()), @@ -80,19 +80,19 @@ public static void main(String[] args) throws InterruptedException, IOException // We start receiving any events that come from `firstPartition`, print out the contents, and decrement the // countDownLatch. Disposable subscription = consumer.receive().subscribe(event -> { - String contents = UTF_8.decode(event.body()).toString(); + String contents = UTF_8.decode(event.getBody()).toString(); // ex. The last enqueued sequence number is 99. If isInclusive is true, the received event starting from the same // event with sequence number of '99'. Otherwise, the event with sequence number of '100' will be the first // event received. System.out.println(String.format("Receiving an event starting from the sequence number: %s. Contents: %s", - event.sequenceNumber(), contents)); + event.getSequenceNumber(), contents)); semaphore.release(); }); // Because the consumer is only listening to new events, we need to send some events to `firstPartition`. // This creates a producer that only sends events to `lastEnqueuedSequencePartitionID`. - EventHubProducerOptions producerOptions = new EventHubProducerOptions().partitionId(lastEnqueuedSequencePartitionID); + EventHubProducerOptions producerOptions = new EventHubProducerOptions().setPartitionId(lastEnqueuedSequencePartitionID); EventHubAsyncProducer producer = client.createProducer(producerOptions); producer.send(new EventData("Hello world!".getBytes(UTF_8))).block(OPERATION_TIMEOUT); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubAsyncClientJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubAsyncClientJavaDocCodeSamples.java index 99b1b75dfa20..796a0738b6c7 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubAsyncClientJavaDocCodeSamples.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubAsyncClientJavaDocCodeSamples.java @@ -3,11 +3,6 @@ package com.azure.messaging.eventhubs; -import com.azure.core.amqp.RetryOptions; -import reactor.core.scheduler.Schedulers; - -import java.time.Duration; - /** * Contains code snippets when generating javadocs through doclets for {@link EventHubAsyncClient}. */ @@ -17,15 +12,15 @@ public class EventHubAsyncClientJavaDocCodeSamples { * Creating an {@link EventHubAsyncClient} using an Event Hubs namespace connection string with an Event Hub name. */ public void instantiation() { - // BEGIN: com.azure.messaging.eventhubs.eventhubasyncclient.connectionString#string-string + // BEGIN: com.azure.messaging.eventhubs.eventhubasyncclient.instantiation#string-string String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" - + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; + + "SharedAccessKey={sharedAccessKey}"; String eventHubName = "my-event-hub"; EventHubAsyncClient client = new EventHubClientBuilder() .connectionString(connectionString, eventHubName) .buildAsyncClient(); - // END: com.azure.messaging.eventhubs.eventhubasyncclient.connectionString#string-string + // END: com.azure.messaging.eventhubs.eventhubasyncclient.instantiation#string-string client.close(); } @@ -34,34 +29,14 @@ public void instantiation() { * Creating an {@link EventHubAsyncClient} using a connection string specific to an Event Hub instance. */ public void instantiationInstance() { - // BEGIN: com.azure.messaging.eventhubs.eventhubasyncclient.connectionstring#string - String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" - + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; - - EventHubAsyncClient client = new EventHubClientBuilder() - .connectionString(connectionString) - .buildAsyncClient(); - // END: com.azure.messaging.eventhubs.eventhubasyncclient.connectionstring#string - - client.close(); - } - - /** - * Demonstrates an {@link EventHubClientBuilder} using retry, timeout and a different scheduler. - */ - public void instantiationRetry() { - // BEGIN: com.azure.messaging.eventhubs.eventhubasyncclient.retry-timeout-scheduler + // BEGIN: com.azure.messaging.eventhubs.eventhubasyncclient.instantiation#string String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; - RetryOptions retryOptions = new RetryOptions() - .tryTimeout(Duration.ofSeconds(30)); EventHubAsyncClient client = new EventHubClientBuilder() .connectionString(connectionString) - .retry(retryOptions) - .scheduler(Schedulers.newElastic("dedicated-event-hub-scheduler")) .buildAsyncClient(); - // END: com.azure.messaging.eventhubs.eventhubasyncclient.retry-timeout-scheduler + // END: com.azure.messaging.eventhubs.eventhubasyncclient.instantiation#string client.close(); } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubAsyncProducerJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubAsyncProducerJavaDocCodeSamples.java index 1c00ee7e23e5..66b8583a9be9 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubAsyncProducerJavaDocCodeSamples.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubAsyncProducerJavaDocCodeSamples.java @@ -22,7 +22,8 @@ public class EventHubAsyncProducerJavaDocCodeSamples { private final EventHubAsyncClient client = new EventHubClientBuilder().connectionString("fake-string").buildAsyncClient(); /** - * Code snippet demonstrating how to create an EventHubProducer that automatically routes events to any partition. + * Code snippet demonstrating how to create an {@link EventHubAsyncProducer} that automatically routes events to any + * partition. * * @throws IOException if the producer cannot be disposed. */ @@ -39,17 +40,18 @@ public void instantiate() throws IOException { } /** - * Code snippet demonstrating how to create an EventHubProducer that routes events to a single partition. + * Code snippet demonstrating how to create an {@link EventHubAsyncProducer} that routes events to a single + * partition. * * @throws IOException if the producer cannot be disposed. */ public void instantiatePartitionProducer() throws IOException { // BEGIN: com.azure.messaging.eventhubs.eventhubasyncproducer.instantiation#partitionId RetryOptions retryOptions = new RetryOptions() - .tryTimeout(Duration.ofSeconds(45)); + .setTryTimeout(Duration.ofSeconds(45)); EventHubProducerOptions options = new EventHubProducerOptions() - .partitionId("foo") - .retry(retryOptions); + .setPartitionId("foo") + .setRetry(retryOptions); EventHubAsyncProducer producer = client.createProducer(options); // END: com.azure.messaging.eventhubs.eventhubasyncproducer.instantiation#partitionId @@ -70,7 +72,7 @@ public void sendEventsFluxSendOptions() { EventHubAsyncProducer producer = client.createProducer(); SendOptions options = new SendOptions() - .partitionKey("bread"); + .setPartitionKey("bread"); producer.send(events, options).subscribe(ignored -> System.out.println("sent"), error -> System.err.println("Error received:" + error), @@ -92,8 +94,8 @@ public void sendEventDataBatch() { ); final BatchOptions options = new BatchOptions() - .partitionKey("telemetry") - .maximumSizeInBytes(256); + .setPartitionKey("telemetry") + .setMaximumSizeInBytes(256); final AtomicReference currentBatch = new AtomicReference<>( producer.createBatch(options).block()); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubClientJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubClientJavaDocCodeSamples.java new file mode 100644 index 000000000000..c4f947fd78c4 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubClientJavaDocCodeSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +/** + * Contains code snippets when generating javadocs through doclets for {@link EventHubClient}. + */ +public class EventHubClientJavaDocCodeSamples { + /** + * Creating an {@link EventHubClient} using a connection string specific to an Event Hub instance with different + * retry options. + */ + public void instantiation() { + // BEGIN: com.azure.messaging.eventhubs.eventhubclient.instantiation + String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" + + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; + + EventHubClient client = new EventHubClientBuilder() + .connectionString(connectionString) + .buildClient(); + // END: com.azure.messaging.eventhubs.eventhubclient.instantiation + + client.close(); + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubConsumerJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubConsumerJavaDocCodeSamples.java new file mode 100644 index 000000000000..a399b5bd57cd --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubConsumerJavaDocCodeSamples.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import com.azure.core.util.IterableStream; +import com.azure.messaging.eventhubs.models.EventPosition; + +import java.io.IOException; +import java.time.Duration; +import java.time.Instant; + +/** + * Code snippets demonstrating various {@link EventHubConsumer} scenarios. + */ +public class EventHubConsumerJavaDocCodeSamples { + private final EventHubClient client = new EventHubClientBuilder().connectionString("fake-string").buildClient(); + + /** + * Code snippet for creating an EventHubConsumer + * + * @throws IOException IO exception when the consumer cannot be disposed of. + */ + public void instantiate() throws IOException { + // BEGIN: com.azure.messaging.eventhubs.eventhubconsumer.instantiation + EventHubClient client = new EventHubClientBuilder() + .connectionString("event-hub-instance-connection-string") + .buildClient(); + + String partitionId = "0"; + String consumerGroup = "$DEFAULT"; + EventHubConsumer consumer = client.createConsumer(consumerGroup, partitionId, EventPosition.latest()); + // END: com.azure.messaging.eventhubs.eventhubconsumer.instantiation + + consumer.close(); + } + + /** + * Receives event data + */ + public void receive() { + // BEGIN: com.azure.messaging.eventhubs.eventhubconsumer.receive#int-duration + // Obtain partitionId from EventHubClient.getPartitionIds(). + String partitionId = "0"; + Instant twelveHoursAgo = Instant.now().minus(Duration.ofHours(12)); + EventHubConsumer consumer = client.createConsumer(EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME, partitionId, + EventPosition.fromEnqueuedTime(twelveHoursAgo)); + + IterableStream events = consumer.receive(100, Duration.ofSeconds(30)); + + for (EventData event : events) { + // For each event, perform some sort of processing. + System.out.print("Event received: " + event.getSequenceNumber()); + } + + // Gets the next set of events to consume and process. + IterableStream nextEvents = consumer.receive(100, Duration.ofSeconds(30)); + // END: com.azure.messaging.eventhubs.eventhubconsumer.receive#int-duration + + for (EventData event : nextEvents) { + // For each event, perform some sort of processing. + System.out.print("Event received: " + event.getSequenceNumber()); + } + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubProducerJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubProducerJavaDocCodeSamples.java new file mode 100644 index 000000000000..10532485bb1b --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubProducerJavaDocCodeSamples.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import com.azure.core.amqp.RetryOptions; +import com.azure.messaging.eventhubs.models.BatchOptions; +import com.azure.messaging.eventhubs.models.EventHubProducerOptions; +import com.azure.messaging.eventhubs.models.SendOptions; + +import java.io.IOException; +import java.time.Duration; +import java.util.Arrays; +import java.util.List; + +import static java.nio.charset.StandardCharsets.UTF_8; + +/** + * Contains code snippets when generating javadocs through doclets for {@link EventHubProducer}. + */ +public class EventHubProducerJavaDocCodeSamples { + private final EventHubClient client = new EventHubClientBuilder() + .connectionString("fake-string") + .buildClient(); + + /** + * Code snippet demonstrating how to create an {@link EventHubProducer} that automatically routes events to any + * partition. + * + * @throws IOException if the producer cannot be disposed. + */ + public void instantiate() throws IOException { + // BEGIN: com.azure.messaging.eventhubs.eventhubproducer.instantiation + EventHubClient client = new EventHubClientBuilder() + .connectionString("event-hubs-namespace-connection-string", "event-hub-name") + .buildClient(); + + EventHubProducer producer = client.createProducer(); + // END: com.azure.messaging.eventhubs.eventhubproducer.instantiation + + producer.close(); + } + + /** + * Code snippet demonstrating how to create an {@link EventHubProducer} that routes events to a single partition. + * + * @throws IOException if the producer cannot be disposed. + */ + public void instantiatePartitionProducer() throws IOException { + // BEGIN: com.azure.messaging.eventhubs.eventhubproducer.instantiation#partitionId + RetryOptions retryOptions = new RetryOptions() + .setTryTimeout(Duration.ofSeconds(45)); + EventHubProducerOptions options = new EventHubProducerOptions() + .setPartitionId("foo") + .setRetry(retryOptions); + + EventHubProducer producer = client.createProducer(options); + // END: com.azure.messaging.eventhubs.eventhubproducer.instantiation#partitionId + + producer.close(); + } + + /** + * Code snippet demonstrating how to send events with a partition key. + */ + public void sendEventsSendOptions() { + // BEGIN: com.azure.messaging.eventhubs.eventhubproducer.send#publisher-sendOptions + final List events = Arrays.asList( + new EventData("sourdough".getBytes(UTF_8)), + new EventData("rye".getBytes(UTF_8)), + new EventData("wheat".getBytes(UTF_8)) + ); + + final EventHubProducer producer = client.createProducer(); + final SendOptions options = new SendOptions() + .setPartitionKey("bread"); + + producer.send(events, options); + // END: com.azure.messaging.eventhubs.eventhubproducer.send#publisher-sendOptions + } + + /** + * Code snippet demonstrating how to create an {@link EventDataBatch} and send it. + */ + public void sendEventDataBatch() { + final EventHubProducer producer = client.createProducer(); + + // BEGIN: com.azure.messaging.eventhubs.eventhubproducer.send#eventDataBatch + final List telemetryEvents = Arrays.asList( + new EventData("92".getBytes(UTF_8)).addProperty("telemetry", "latency"), + new EventData("98".getBytes(UTF_8)).addProperty("telemetry", "cpu-temperature"), + new EventData("120".getBytes(UTF_8)).addProperty("telemetry", "fps") + ); + + final BatchOptions options = new BatchOptions() + .setPartitionKey("telemetry") + .setMaximumSizeInBytes(256); + + EventDataBatch currentBatch = producer.createBatch(options); + + // For each telemetry event, we try to add it to the current batch. + // When the batch is full, send it then create another batch to add more events to. + for (EventData event : telemetryEvents) { + if (!currentBatch.tryAdd(event)) { + producer.send(currentBatch); + currentBatch = producer.createBatch(options); + } + } + // END: com.azure.messaging.eventhubs.eventhubproducer.send#eventDataBatch + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorBuilderJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorBuilderJavaDocCodeSamples.java new file mode 100644 index 000000000000..f6369759a6b0 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorBuilderJavaDocCodeSamples.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import com.azure.messaging.eventhubs.models.PartitionContext; +import reactor.core.publisher.Mono; + +/** + * Code snippets for {@link EventProcessorBuilder}. + */ +public class EventProcessorBuilderJavaDocCodeSamples { + + /** + * Code snippet for showing how to create a new instance of {@link EventProcessor}. + * + * @return A new instance of {@link EventProcessor} + */ + // BEGIN: com.azure.messaging.eventhubs.eventprocessorbuilder.instantiation + public EventProcessor createEventProcessor() { + String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" + + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; + EventHubAsyncClient eventHubAsyncClient = new EventHubClientBuilder() + .connectionString(connectionString) + .buildAsyncClient(); + + EventProcessor eventProcessor = new EventProcessorBuilder() + .consumerGroup("consumer-group") + .eventHubClient(eventHubAsyncClient) + .partitionProcessorFactory((PartitionProcessorImpl::new)) + .partitionManager(new InMemoryPartitionManager()) + .buildEventProcessor(); + return eventProcessor; + } + + /** + * A partition processor to demo creating an instance of {@link EventProcessor}. + */ + public static final class PartitionProcessorImpl extends PartitionProcessor { + + /** + * Processes the event data. + * + * @return a representation of deferred processing of events. + */ + @Override + public Mono processEvent(PartitionContext partitionContext, EventData eventData) { + System.out.println("Processing event with sequence number " + eventData.getSequenceNumber()); + return partitionContext.updateCheckpoint(eventData); + } + } + // END: com.azure.messaging.eventhubs.eventprocessorbuilder.instantiation + +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorJavaDocCodeSamples.java index b2923eae52e3..77b6a2c2dedc 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorJavaDocCodeSamples.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorJavaDocCodeSamples.java @@ -3,9 +3,7 @@ package com.azure.messaging.eventhubs; -import com.azure.core.util.logging.ClientLogger; -import com.azure.messaging.eventhubs.models.PartitionContext; -import reactor.core.publisher.Mono; +import com.azure.messaging.eventhubs.EventProcessorBuilderJavaDocCodeSamples.PartitionProcessorImpl; /** * Code snippets for {@link EventProcessor}. @@ -13,98 +11,25 @@ public final class EventProcessorJavaDocCodeSamples { /** - * Code snippet for showing how to create a new instance of {@link EventProcessor}. - * - * @return An instance of {@link EventProcessor}. + * Code snippet for showing how to start and stop an {@link EventProcessor}. */ - public EventProcessor createInstance() { - // BEGIN: com.azure.messaging.eventhubs.eventprocessor.instantiation + public void startStopSample() { String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; - EventProcessor eventProcessor = new EventHubClientBuilder() + EventHubAsyncClient eventHubAsyncClient = new EventHubClientBuilder() .connectionString(connectionString) + .buildAsyncClient(); + + EventProcessor eventProcessor = new EventProcessorBuilder() + .eventHubClient(eventHubAsyncClient) .partitionProcessorFactory((PartitionProcessorImpl::new)) - .consumerGroupName("consumer-group") + .consumerGroup("consumer-group") .buildEventProcessor(); - // END: com.azure.messaging.eventhubs.eventprocessor.instantiation - return eventProcessor; - } - /** - * Code snippet for showing how to start and stop an {@link EventProcessor}. - */ - public void startStopSample() { - EventProcessor eventProcessor = createInstance(); // BEGIN: com.azure.messaging.eventhubs.eventprocessor.startstop eventProcessor.start(); // do other stuff while the event processor is running eventProcessor.stop(); // END: com.azure.messaging.eventhubs.eventprocessor.startstop } - - /** - * No-op partition processor used in code snippet to demo creating an instance of {@link EventProcessor}. - * This class will not be visible in the code snippet. - */ - private static final class PartitionProcessorImpl implements PartitionProcessor { - - private final ClientLogger logger = new ClientLogger(PartitionProcessorImpl.class); - private final PartitionContext partitionContext; - private final CheckpointManager checkpointManager; - - /** - * Creates new instance. - * - * @param partitionContext The partition context for this partition processor. - * @param checkpointManager The checkpoint manager for this partition processor. - */ - private PartitionProcessorImpl(PartitionContext partitionContext, CheckpointManager checkpointManager) { - this.partitionContext = partitionContext; - this.checkpointManager = checkpointManager; - } - - /** - * {@inheritDoc} - * - * @return a representation of deferred initialization. - */ - @Override - public Mono initialize() { - logger.info("Initializing partition processor for {}", this.partitionContext.partitionId()); - return Mono.empty(); - } - - /** - * {@inheritDoc} - * - * @return a representation of deferred processing of events. - */ - @Override - public Mono processEvent(EventData eventData) { - this.checkpointManager.updateCheckpoint(eventData); - return Mono.empty(); - } - - /** - * {@inheritDoc} - * - * @param throwable The {@link Throwable} that caused this method to be called. - */ - @Override - public void processError(Throwable throwable) { - logger.warning("Error while processing events"); - } - - /** - * {@inheritDoc} - * - * @param closeReason {@link CloseReason} for closing this partition processor. - * @return a representation of deferred closing of partition processor. - */ - @Override - public Mono close(CloseReason closeReason) { - return Mono.empty(); - } - } - } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorSample.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorSample.java index 6cce5f64b134..d8c8df493b4f 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorSample.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorSample.java @@ -19,13 +19,17 @@ public class EventProcessorSample { * @throws Exception If there are any errors while running the {@link EventProcessor}. */ public static void main(String[] args) throws Exception { - EventHubClientBuilder eventHubClientBuilder = new EventHubClientBuilder() + EventHubAsyncClient eventHubAsyncClient = new EventHubClientBuilder() .connectionString(EH_CONNECTION_STRING) - .consumerGroupName(EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME) + .buildAsyncClient(); + + EventProcessorBuilder eventProcessorBuilder = new EventProcessorBuilder() + .consumerGroup(EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME) + .eventHubClient(eventHubAsyncClient) .partitionProcessorFactory(LogPartitionProcessor::new) .partitionManager(new InMemoryPartitionManager()); - EventProcessor eventProcessor = eventHubClientBuilder.buildEventProcessor(); + EventProcessor eventProcessor = eventProcessorBuilder.buildEventProcessor(); System.out.println("Starting event processor"); eventProcessor.start(); eventProcessor.start(); // should be a no-op @@ -38,7 +42,7 @@ public static void main(String[] args) throws Exception { Thread.sleep(TimeUnit.SECONDS.toMillis(40)); System.out.println("Starting a new instance of event processor"); - eventProcessor = eventHubClientBuilder.buildEventProcessor(); + eventProcessor = eventProcessorBuilder.buildEventProcessor(); eventProcessor.start(); // do other stuff Thread.sleep(TimeUnit.MINUTES.toMillis(1)); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/GetEventHubMetadata.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/GetEventHubMetadata.java index 35a3a72cb673..26b70f6bf50c 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/GetEventHubMetadata.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/GetEventHubMetadata.java @@ -40,11 +40,11 @@ public static void main(String[] args) throws InterruptedException { System.out.printf( "Event Hub Name: %s; Partition Id: %s; Is partition empty? %s; First Sequence Number: %s; " + "Last Enqueued Time: %s; Last Enqueued Sequence Number: %s; Last Enqueued Offset: %s", - properties.eventHubName(), properties.id(), properties.isEmpty(), - properties.beginningSequenceNumber(), - properties.lastEnqueuedTime(), - properties.lastEnqueuedSequenceNumber(), - properties.lastEnqueuedOffset()); + properties.getEventHubName(), properties.getId(), properties.isEmpty(), + properties.getBeginningSequenceNumber(), + properties.getLastEnqueuedTime(), + properties.getLastEnqueuedSequenceNumber(), + properties.getLastEnqueuedOffset()); }, error -> { System.err.println("Error occurred while fetching partition properties: " + error.toString()); }, () -> { diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/LogPartitionProcessor.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/LogPartitionProcessor.java index e5747d55d577..946afb0cc6a9 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/LogPartitionProcessor.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/LogPartitionProcessor.java @@ -9,42 +9,12 @@ import reactor.core.publisher.Mono; /** - * A sample implementation of {@link PartitionProcessor}. This implementation logs the APIs that were called by {@link + * A sample implementation of {@link PartitionProcessor}. This implementation logs the APIs that are called by {@link * EventProcessor} while processing a partition. */ -public class LogPartitionProcessor implements PartitionProcessor { +public class LogPartitionProcessor extends PartitionProcessor { private final Logger logger = LoggerFactory.getLogger(LogPartitionProcessor.class); - private final PartitionContext partitionContext; - private final CheckpointManager checkpointManager; - - /** - * Creates a new {@link PartitionProcessor} instance that logs every interaction with {@link - * EventProcessor}. - * - * @param partitionContext The partition context to know which partition this processor is receiving events from. - * @param checkpointManager The checkpoint manager for updating checkpoints. - */ - public LogPartitionProcessor(PartitionContext partitionContext, - CheckpointManager checkpointManager) { - this.partitionContext = partitionContext; - this.checkpointManager = checkpointManager; - logger.info("Creating partition processor: Event Hub name = {}; consumer group name = {}; partition id = {}", - partitionContext.eventHubName(), partitionContext.consumerGroupName(), partitionContext.partitionId()); - } - - /** - * {@inheritDoc} - * - * @return a representation of the deferred computation of this call. - */ - @Override - public Mono initialize() { - logger - .info("Initializing partition processor: Event Hub name = {}; consumer group name = {}; partition id = {}", - partitionContext.eventHubName(), partitionContext.consumerGroupName(), partitionContext.partitionId()); - return Mono.empty(); - } /** * {@inheritDoc} @@ -53,39 +23,11 @@ public Mono initialize() { * @return a representation of the deferred computation of this call. */ @Override - public Mono processEvent(EventData eventData) { + public Mono processEvent(PartitionContext partitionContext, EventData eventData) { logger.info( "Processing event: Event Hub name = {}; consumer group name = {}; partition id = {}; sequence number = {}", - partitionContext.eventHubName(), partitionContext.consumerGroupName(), partitionContext.partitionId(), - eventData.sequenceNumber()); - return this.checkpointManager.updateCheckpoint(eventData); - } - - /** - * {@inheritDoc} - * - * @param throwable The {@link Throwable} that caused this method to be called. - */ - @Override - public void processError(Throwable throwable) { - logger - .warn("Processing error: Event Hub name = {}; consumer group name = {}; partition id = {}; throwable = {}", - partitionContext.eventHubName(), partitionContext.consumerGroupName(), partitionContext.partitionId(), - throwable.getMessage()); - } - - /** - * {@inheritDoc} - * - * @param closeReason The reason for closing this partition processor. - * @return a representation of the deferred computation of this call. - */ - @Override - public Mono close(CloseReason closeReason) { - logger.info( - "Closing partition processor: Event Hub name = {}; consumer group name = {}; partition id = {}; closeReason = {}", - partitionContext.eventHubName(), partitionContext.consumerGroupName(), partitionContext.partitionId(), - closeReason); - return Mono.empty(); + partitionContext.getEventHubName(), partitionContext.getConsumerGroup(), partitionContext.getPartitionId(), + eventData.getSequenceNumber()); + return partitionContext.updateCheckpoint(eventData); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventDataBatch.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventDataBatch.java index 2bef54ddefa2..019c3d42d51e 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventDataBatch.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventDataBatch.java @@ -45,8 +45,8 @@ public static void main(String[] args) { // Creating a batch where we want the events ending up in the same partition by setting the partition key. final BatchOptions options = new BatchOptions() - .partitionKey("sandwiches") - .maximumSizeInBytes(256); + .setPartitionKey("sandwiches") + .setMaximumSizeInBytes(256); final AtomicReference currentBatch = new AtomicReference<>( producer.createBatch(options).block()); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsToSpecificPartition.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsToSpecificPartition.java index ae83aacf2ca5..ca8aee583087 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsToSpecificPartition.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsToSpecificPartition.java @@ -47,7 +47,7 @@ public static void main(String[] args) { // // If you attempt to use a partition key with an Event Hub producer that is associated with a partition, an exception // will occur. Otherwise, publishing to a specific partition is exactly the same as other publishing scenarios. - EventHubProducerOptions producerOptions = new EventHubProducerOptions().partitionId(firstPartition); + EventHubProducerOptions producerOptions = new EventHubProducerOptions().setPartitionId(firstPartition); // Create a producer. Consequently, events sent from this producer will deliver to the specific partition ID Event Hub instance. EventHubAsyncProducer producer = client.createProducer(producerOptions); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithCustomMetadata.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithCustomMetadata.java index 0908204afd76..68a9ff8e579f 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithCustomMetadata.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithCustomMetadata.java @@ -51,14 +51,14 @@ public static void main(String[] args) { // pretend type names and other hints. Note that the set of metadata is unique to an event; there is no need for every // event in a batch to have the same metadata properties available nor the same data type for those properties. EventData firstEvent = new EventData("EventData Sample 1".getBytes(UTF_8)); - firstEvent.properties().put("EventType", "com.microsoft.samples.hello-event"); - firstEvent.properties().put("priority", 1); - firstEvent.properties().put("score", 9.0); + firstEvent.getProperties().put("EventType", "com.microsoft.samples.hello-event"); + firstEvent.getProperties().put("priority", 1); + firstEvent.getProperties().put("score", 9.0); EventData secEvent = new EventData("EventData Sample 2".getBytes(UTF_8)); - secEvent.properties().put("EventType", "com.microsoft.samples.goodbye-event"); - secEvent.properties().put("priority", "17"); - secEvent.properties().put("blob", 10); + secEvent.getProperties().put("EventType", "com.microsoft.samples.goodbye-event"); + secEvent.getProperties().put("priority", "17"); + secEvent.getProperties().put("blob", 10); final Flux data = Flux.just(firstEvent, secEvent); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithPartitionKey.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithPartitionKey.java index b395071df2ef..f3dd43556f01 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithPartitionKey.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithPartitionKey.java @@ -56,7 +56,7 @@ public static void main(String[] args) { // Note that there is no means of accurately predicting which partition will be associated with a given partition key; // we can only be assured that it will be a consistent choice of partition. If you have a need to understand which // exact partition an event is published to, you will need to use an Event Hub producer associated with that partition. - SendOptions sendOptions = new SendOptions().partitionKey("basketball"); + SendOptions sendOptions = new SendOptions().setPartitionKey("basketball"); // Send that event. This call returns a Mono, which we subscribe to. It completes successfully when the // event has been delivered to the Event Hub. It completes with an error if an exception occurred while sending diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/BackCompatTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/BackCompatTest.java index 4492d782b61f..69e9e127b2ef 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/BackCompatTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/BackCompatTest.java @@ -3,13 +3,15 @@ package com.azure.messaging.eventhubs; +import com.azure.core.amqp.implementation.TracerProvider; import com.azure.core.util.logging.ClientLogger; -import com.azure.messaging.eventhubs.implementation.ApiTestBase; +import com.azure.messaging.eventhubs.implementation.IntegrationTestBase; import com.azure.messaging.eventhubs.implementation.ReactorHandlerProvider; import com.azure.messaging.eventhubs.models.EventHubProducerOptions; import com.azure.messaging.eventhubs.models.EventPosition; import org.apache.qpid.proton.Proton; import org.apache.qpid.proton.amqp.Binary; +import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.messaging.ApplicationProperties; import org.apache.qpid.proton.amqp.messaging.Data; import org.apache.qpid.proton.amqp.messaging.MessageAnnotations; @@ -21,18 +23,25 @@ import reactor.test.StepVerifier; import java.nio.ByteBuffer; +import java.time.Instant; +import java.util.Collections; +import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.UUID; +import static com.azure.core.amqp.MessageConstant.ENQUEUED_TIME_UTC_ANNOTATION_NAME; +import static com.azure.core.amqp.MessageConstant.OFFSET_ANNOTATION_NAME; +import static com.azure.core.amqp.MessageConstant.SEQUENCE_NUMBER_ANNOTATION_NAME; import static com.azure.messaging.eventhubs.TestUtils.MESSAGE_TRACKING_ID; +import static com.azure.messaging.eventhubs.TestUtils.getSymbol; import static com.azure.messaging.eventhubs.TestUtils.isMatchingEvent; import static java.nio.charset.StandardCharsets.UTF_8; /** * Integration test that verifies backwards compatibility with a previous version of the SDK. */ -public class BackCompatTest extends ApiTestBase { +public class BackCompatTest extends IntegrationTestBase { private static final String PARTITION_ID = "0"; private static final String PAYLOAD = "test-message"; @@ -48,19 +57,20 @@ public BackCompatTest() { public TestName testName = new TestName(); @Override - protected String testName() { + protected String getTestName() { return testName.getMethodName(); } @Override protected void beforeTest() { final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(getReactorProvider()); + final TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); - client = new EventHubAsyncClient(getConnectionOptions(), getReactorProvider(), handlerProvider); + client = new EventHubAsyncClient(getConnectionOptions(), getReactorProvider(), handlerProvider, tracerProvider); consumer = client.createConsumer(EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, EventPosition.latest()); final EventHubProducerOptions producerOptions = new EventHubProducerOptions() - .partitionId(PARTITION_ID); + .setPartitionId(PARTITION_ID); producer = client.createProducer(producerOptions); } @@ -74,8 +84,6 @@ protected void afterTest() { */ @Test public void backCompatWithJavaSDKOlderThan0110() { - skipIfNotRecordMode(); - // Arrange final String messageTrackingValue = UUID.randomUUID().toString(); @@ -88,10 +96,15 @@ public void backCompatWithJavaSDKOlderThan0110() { // We want to ensure that we fetch the event data corresponding to this test and not some other test case. applicationProperties.put(MESSAGE_TRACKING_ID, messageTrackingValue); + final Map systemProperties = new HashMap<>(); + systemProperties.put(getSymbol(OFFSET_ANNOTATION_NAME), "100"); + systemProperties.put(getSymbol(ENQUEUED_TIME_UTC_ANNOTATION_NAME), Date.from(Instant.now())); + systemProperties.put(getSymbol(SEQUENCE_NUMBER_ANNOTATION_NAME), 15L); + final Message message = Proton.message(); message.setApplicationProperties(new ApplicationProperties(applicationProperties)); message.setBody(new Data(Binary.create(ByteBuffer.wrap(PAYLOAD.getBytes(UTF_8))))); - message.setMessageAnnotations(new MessageAnnotations(new HashMap<>())); + message.setMessageAnnotations(new MessageAnnotations(systemProperties)); final EventData eventData = new EventData(message); @@ -103,12 +116,12 @@ public void backCompatWithJavaSDKOlderThan0110() { } private void validateAmqpProperties(Map expected, EventData event) { - Assert.assertEquals(expected.size(), event.properties().size()); - Assert.assertEquals(PAYLOAD, UTF_8.decode(event.body()).toString()); + Assert.assertEquals(expected.size(), event.getProperties().size()); + Assert.assertEquals(PAYLOAD, UTF_8.decode(event.getBody()).toString()); expected.forEach((key, value) -> { - Assert.assertTrue(event.properties().containsKey(key)); - Assert.assertEquals(value, event.properties().get(key)); + Assert.assertTrue(event.getProperties().containsKey(key)); + Assert.assertEquals(value, event.getProperties().get(key)); }); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventDataBatchIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventDataBatchIntegrationTest.java index 2d2cea78fbe6..54fdadd3c45d 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventDataBatchIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventDataBatchIntegrationTest.java @@ -3,9 +3,10 @@ package com.azure.messaging.eventhubs; +import com.azure.core.amqp.implementation.TracerProvider; import com.azure.core.util.logging.ClientLogger; -import com.azure.messaging.eventhubs.implementation.ApiTestBase; import com.azure.messaging.eventhubs.implementation.ErrorContextProvider; +import com.azure.messaging.eventhubs.implementation.IntegrationTestBase; import com.azure.messaging.eventhubs.implementation.ReactorHandlerProvider; import com.azure.messaging.eventhubs.models.EventPosition; import com.azure.messaging.eventhubs.models.SendOptions; @@ -21,6 +22,7 @@ import reactor.test.StepVerifier; import java.nio.charset.StandardCharsets; +import java.util.Collections; import java.util.List; import java.util.Random; import java.util.UUID; @@ -30,7 +32,7 @@ import static com.azure.messaging.eventhubs.TestUtils.MESSAGE_TRACKING_ID; import static com.azure.messaging.eventhubs.TestUtils.isMatchingEvent; -public class EventDataBatchIntegrationTest extends ApiTestBase { +public class EventDataBatchIntegrationTest extends IntegrationTestBase { private static final String PARTITION_KEY = "PartitionIDCopyFromProducerOption"; private EventHubAsyncClient client; @@ -47,7 +49,7 @@ public EventDataBatchIntegrationTest() { } @Override - protected String testName() { + protected String getTestName() { return testName.getMethodName(); } @@ -56,8 +58,9 @@ protected void beforeTest() { MockitoAnnotations.initMocks(this); final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(getReactorProvider()); + final TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); - client = new EventHubAsyncClient(getConnectionOptions(), getReactorProvider(), handlerProvider); + client = new EventHubAsyncClient(getConnectionOptions(), getReactorProvider(), handlerProvider, tracerProvider); producer = client.createProducer(); } @@ -71,8 +74,6 @@ protected void afterTest() { */ @Test public void sendSmallEventsFullBatch() { - skipIfNotRecordMode(); - // Arrange final EventDataBatch batch = new EventDataBatch(EventHubAsyncProducer.MAX_MESSAGE_LENGTH_BYTES, null, contextProvider); int count = 0; @@ -95,8 +96,6 @@ public void sendSmallEventsFullBatch() { */ @Test public void sendSmallEventsFullBatchPartitionKey() { - skipIfNotRecordMode(); - // Arrange final EventDataBatch batch = new EventDataBatch(EventHubAsyncProducer.MAX_MESSAGE_LENGTH_BYTES, PARTITION_KEY, contextProvider); int count = 0; @@ -115,21 +114,19 @@ public void sendSmallEventsFullBatchPartitionKey() { /** * Verifies that when we send 10 messages with the same partition key and some application properties, the received - * EventData also contains the {@link EventData#partitionKey()} property set. + * EventData also contains the {@link EventData#getPartitionKey()} property set. */ @Test public void sendBatchPartitionKeyValidate() throws InterruptedException { - skipIfNotRecordMode(); - // Arrange final String messageValue = UUID.randomUUID().toString(); - final SendOptions sendOptions = new SendOptions().partitionKey(PARTITION_KEY); + final SendOptions sendOptions = new SendOptions().setPartitionKey(PARTITION_KEY); final EventDataBatch batch = new EventDataBatch(EventHubAsyncProducer.MAX_MESSAGE_LENGTH_BYTES, PARTITION_KEY, contextProvider); int count = 0; while (count < 10) { final EventData data = createData(); - data.properties().put(MESSAGE_TRACKING_ID, messageValue); + data.getProperties().put(MESSAGE_TRACKING_ID, messageValue); if (!batch.tryAdd(data)) { break; @@ -149,16 +146,16 @@ public void sendBatchPartitionKeyValidate() throws InterruptedException { final List consumerSubscriptions = consumers.map(consumer -> { return consumer.receive().subscribe(event -> { - if (event.partitionKey() == null || !PARTITION_KEY.equals(event.partitionKey())) { + if (event.getPartitionKey() == null || !PARTITION_KEY.equals(event.getPartitionKey())) { return; } if (isMatchingEvent(event, messageValue)) { - logger.info("Event[{}] matched. Countdown: {}", event.sequenceNumber(), countDownLatch.getCount()); + logger.info("Event[{}] matched. Countdown: {}", event.getSequenceNumber(), countDownLatch.getCount()); countDownLatch.countDown(); } else { logger.warning(String.format("Event[%s] matched partition key, but not GUID. Expected: %s. Actual: %s", - event.sequenceNumber(), messageValue, event.properties().get(MESSAGE_TRACKING_ID))); + event.getSequenceNumber(), messageValue, event.getProperties().get(MESSAGE_TRACKING_ID))); } }, error -> { Assert.fail("An error should not have occurred:" + error.toString()); @@ -192,8 +189,6 @@ public void sendBatchPartitionKeyValidate() throws InterruptedException { */ @Test public void sendEventsFullBatchWithPartitionKey() { - skipIfNotRecordMode(); - // Arrange final int maxMessageSize = 1024; final EventDataBatch batch = new EventDataBatch(maxMessageSize, PARTITION_KEY, contextProvider); @@ -204,7 +199,7 @@ public void sendEventsFullBatchWithPartitionKey() { while (true) { final EventData eventData = new EventData("a".getBytes()); for (int i = 0; i < random.nextInt(20); i++) { - eventData.properties().put("key" + i, "value"); + eventData.getProperties().put("key" + i, "value"); } if (batch.tryAdd(eventData)) { diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventDataTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventDataTest.java index ef5138f34a89..efeb5cc5f68f 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventDataTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventDataTest.java @@ -13,9 +13,13 @@ import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Collections; +import java.util.Date; import java.util.HashMap; import java.util.List; +import static com.azure.core.amqp.MessageConstant.ENQUEUED_TIME_UTC_ANNOTATION_NAME; +import static com.azure.core.amqp.MessageConstant.OFFSET_ANNOTATION_NAME; +import static com.azure.core.amqp.MessageConstant.PARTITION_KEY_ANNOTATION_NAME; import static com.azure.core.amqp.MessageConstant.SEQUENCE_NUMBER_ANNOTATION_NAME; import static com.azure.messaging.eventhubs.TestUtils.APPLICATION_PROPERTIES; import static com.azure.messaging.eventhubs.TestUtils.ENQUEUED_TIME; @@ -25,6 +29,7 @@ import static com.azure.messaging.eventhubs.TestUtils.SEQUENCE_NUMBER; import static com.azure.messaging.eventhubs.TestUtils.getMessage; import static java.nio.charset.StandardCharsets.UTF_8; +import static org.apache.qpid.proton.amqp.Symbol.getSymbol; public class EventDataTest { // Create a giant payload with 10000 characters that are "a". @@ -41,7 +46,7 @@ public void byteBufferNotNull() { new EventData((ByteBuffer) null); } - @Test(expected = IllegalArgumentException.class) + @Test(expected = NullPointerException.class) public void messageNotNull() { new EventData((Message) null); } @@ -52,9 +57,9 @@ public void eventPropertiesShouldNotBeNull() { final EventData eventData = new EventData("Test".getBytes()); // Assert - Assert.assertNotNull(eventData.systemProperties()); - Assert.assertNotNull(eventData.body()); - Assert.assertNotNull(eventData.properties()); + Assert.assertNotNull(eventData.getSystemProperties()); + Assert.assertNotNull(eventData.getBody()); + Assert.assertNotNull(eventData.getProperties()); } /** @@ -69,7 +74,7 @@ public void canCreateWithEmptyArray() { final EventData eventData = new EventData(byteArray); // Assert - final byte[] actual = eventData.body().array(); + final byte[] actual = eventData.getBody().array(); Assert.assertNotNull(actual); Assert.assertEquals(0, actual.length); } @@ -83,8 +88,8 @@ public void canCreateWithPayload() { final EventData eventData = new EventData(PAYLOAD_BYTES); // Assert - Assert.assertNotNull(eventData.body()); - Assert.assertEquals(PAYLOAD, UTF_8.decode(eventData.body()).toString()); + Assert.assertNotNull(eventData.getBody()); + Assert.assertEquals(PAYLOAD, UTF_8.decode(eventData.getBody()).toString()); } /** @@ -122,6 +127,12 @@ public void comparableEventDataSequenceNumbers() { @Test public void deserializeProtonJMessage() { // Arrange + final String[] systemPropertyNames = new String[] { + PARTITION_KEY_ANNOTATION_NAME.getValue(), + OFFSET_ANNOTATION_NAME.getValue(), + ENQUEUED_TIME_UTC_ANNOTATION_NAME.getValue(), + SEQUENCE_NUMBER_ANNOTATION_NAME.getValue(), + }; final Message message = getMessage(PAYLOAD_BYTES); // Act @@ -129,23 +140,30 @@ public void deserializeProtonJMessage() { // Assert // Verifying all our system properties were properly deserialized. - Assert.assertEquals(ENQUEUED_TIME, eventData.enqueuedTime()); - Assert.assertEquals(OFFSET, eventData.offset()); - Assert.assertEquals(PARTITION_KEY, eventData.partitionKey()); - Assert.assertEquals(SEQUENCE_NUMBER, eventData.sequenceNumber()); + Assert.assertEquals(ENQUEUED_TIME, eventData.getEnqueuedTime()); + Assert.assertEquals(OFFSET, eventData.getOffset()); + Assert.assertEquals(PARTITION_KEY, eventData.getPartitionKey()); + Assert.assertEquals(SEQUENCE_NUMBER, eventData.getSequenceNumber()); - Assert.assertTrue(eventData.systemProperties().containsKey(OTHER_SYSTEM_PROPERTY)); - final Object otherPropertyValue = eventData.systemProperties().get(OTHER_SYSTEM_PROPERTY); + Assert.assertTrue(eventData.getSystemProperties().containsKey(OTHER_SYSTEM_PROPERTY)); + final Object otherPropertyValue = eventData.getSystemProperties().get(OTHER_SYSTEM_PROPERTY); Assert.assertTrue(otherPropertyValue instanceof Boolean); Assert.assertTrue((Boolean) otherPropertyValue); // Verifying our application properties are the same. - Assert.assertEquals(APPLICATION_PROPERTIES.size(), eventData.properties().size()); + Assert.assertEquals(APPLICATION_PROPERTIES.size(), eventData.getProperties().size()); APPLICATION_PROPERTIES.forEach((key, value) -> { - Assert.assertTrue(eventData.properties().containsKey(key)); - Assert.assertEquals(value, eventData.properties().get(key)); + Assert.assertTrue(eventData.getProperties().containsKey(key)); + Assert.assertEquals(value, eventData.getProperties().get(key)); }); + // Verify that the partitionKey, offset, enqueued time, sequenceNumber properties are no longer in the system + // properties map. + for (String property : systemPropertyNames) { + Assert.assertFalse(property + " should not be in system properties map.", + eventData.getSystemProperties().containsKey(property)); + } + // Verifying the contents of our message is the same. } @@ -154,7 +172,10 @@ public void deserializeProtonJMessage() { */ private static EventData constructMessage(long sequenceNumber) { final HashMap properties = new HashMap<>(); - properties.put(Symbol.getSymbol(SEQUENCE_NUMBER_ANNOTATION_NAME.getValue()), sequenceNumber); + properties.put(getSymbol(SEQUENCE_NUMBER_ANNOTATION_NAME.getValue()), sequenceNumber); + properties.put(getSymbol(OFFSET_ANNOTATION_NAME.getValue()), String.valueOf(OFFSET)); + properties.put(getSymbol(PARTITION_KEY_ANNOTATION_NAME.getValue()), PARTITION_KEY); + properties.put(getSymbol(ENQUEUED_TIME_UTC_ANNOTATION_NAME.getValue()), Date.from(ENQUEUED_TIME)); final Message message = Proton.message(); message.setMessageAnnotations(new MessageAnnotations(properties)); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncClientIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncClientIntegrationTest.java new file mode 100644 index 000000000000..79c2f97932aa --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncClientIntegrationTest.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import com.azure.core.amqp.TransportType; +import com.azure.core.amqp.implementation.TracerProvider; +import com.azure.core.util.logging.ClientLogger; +import com.azure.messaging.eventhubs.implementation.ConnectionOptions; +import com.azure.messaging.eventhubs.implementation.IntegrationTestBase; +import com.azure.messaging.eventhubs.implementation.ReactorHandlerProvider; +import com.azure.messaging.eventhubs.models.EventHubConsumerOptions; +import com.azure.messaging.eventhubs.models.EventHubProducerOptions; +import com.azure.messaging.eventhubs.models.EventPosition; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import reactor.core.Disposable; +import reactor.core.Disposables; +import reactor.core.publisher.Flux; +import reactor.test.StepVerifier; + +import java.time.Instant; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; + +import static com.azure.messaging.eventhubs.EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME; +import static com.azure.messaging.eventhubs.TestUtils.isMatchingEvent; +import static java.nio.charset.StandardCharsets.UTF_8; + +/** + * Tests scenarios on {@link EventHubAsyncClient}. + */ +@RunWith(Parameterized.class) +public class EventHubAsyncClientIntegrationTest extends IntegrationTestBase { + private static final int NUMBER_OF_EVENTS = 5; + + @Parameterized.Parameters(name = "{index}: transportType={0}") + public static Iterable getTransportTypes() { + return Arrays.asList(TransportType.AMQP, TransportType.AMQP_WEB_SOCKETS); + } + + private static final String PARTITION_ID = "1"; + private static final AtomicBoolean HAS_PUSHED_EVENTS = new AtomicBoolean(); + private static final AtomicReference MESSAGES_PUSHED_INSTANT = new AtomicReference<>(); + private static final String MESSAGE_TRACKING_VALUE = UUID.randomUUID().toString(); + + private EventHubAsyncClient client; + + @Rule + public TestName testName = new TestName(); + + public EventHubAsyncClientIntegrationTest(TransportType transportType) { + super(new ClientLogger(EventHubAsyncClientIntegrationTest.class)); + + setTransportType(transportType); + } + + @Override + protected String getTestName() { + return testName.getMethodName(); + } + + @Override + protected void beforeTest() { + final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(getReactorProvider()); + final ConnectionOptions connectionOptions = getConnectionOptions(); + final TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + + client = new EventHubAsyncClient(connectionOptions, getReactorProvider(), handlerProvider, tracerProvider); + + setupEventTestData(client); + } + + @Override + protected void afterTest() { + dispose(client); + } + + @Test(expected = NullPointerException.class) + public void nullConstructor() throws NullPointerException { + new EventHubAsyncClient(null, null, null, null); + } + + /** + * Verifies that we can receive messages, and that the receiver continues to fetch messages when the prefetch queue + * is exhausted. + */ + @Test + public void receiveMessage() { + // Arrange + final EventHubConsumerOptions options = new EventHubConsumerOptions() + .setPrefetchCount(2); + final EventHubAsyncConsumer consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, + EventPosition.fromEnqueuedTime(MESSAGES_PUSHED_INSTANT.get()), options); + + // Act & Assert + StepVerifier.create(consumer.receive().filter(x -> isMatchingEvent(x, MESSAGE_TRACKING_VALUE)).take(NUMBER_OF_EVENTS)) + .expectNextCount(NUMBER_OF_EVENTS) + .verifyComplete(); + } + + /** + * Verifies that we can have multiple consumers listening to the same partition + consumer group at the same time. + */ + @Ignore("Investigate. Only 2 of the 4 consumers get the events. The other two consumers do not.") + @Test + public void parallelEventHubClients() throws InterruptedException { + // Arrange + final int numberOfClients = 4; + final int numberOfEvents = 10; + final String messageTrackingId = "message-tracking-id"; + final String messageTrackingValue = UUID.randomUUID().toString(); + final Flux events = Flux.range(0, numberOfEvents).map(number -> { + final EventData eventData = new EventData("testString".getBytes(UTF_8)); + eventData.addProperty(messageTrackingId, messageTrackingValue); + return eventData; + }); + + final CountDownLatch countDownLatch = new CountDownLatch(numberOfClients); + final EventHubAsyncClient[] clients = new EventHubAsyncClient[numberOfClients]; + for (int i = 0; i < numberOfClients; i++) { + clients[i] = new EventHubAsyncClient(getConnectionOptions(), getReactorProvider(), new ReactorHandlerProvider(getReactorProvider()), null); + } + + final EventHubAsyncProducer producer = clients[0].createProducer(new EventHubProducerOptions().setPartitionId(PARTITION_ID)); + final List consumers = new ArrayList<>(); + final Disposable.Composite subscriptions = Disposables.composite(); + + try { + for (final EventHubAsyncClient hubClient : clients) { + final EventHubAsyncConsumer consumer = hubClient.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, EventPosition.latest()); + consumers.add(consumer); + + final Disposable subscription = consumer.receive().filter(event -> { + return event.getProperties() != null + && event.getProperties().containsKey(messageTrackingId) + && messageTrackingValue.equals(event.getProperties().get(messageTrackingId)); + }).take(numberOfEvents).subscribe(event -> { + logger.info("Event[{}] matched.", event.getSequenceNumber()); + }, error -> Assert.fail("An error should not have occurred:" + error.toString()), () -> { + long count = countDownLatch.getCount(); + logger.info("Finished consuming events. Counting down: {}", count); + countDownLatch.countDown(); + }); + + subscriptions.add(subscription); + } + + // Act + producer.send(events).block(TIMEOUT); + + // Assert + // Wait for all the events we sent to be received by each of the consumers. + countDownLatch.await(TIMEOUT.getSeconds(), TimeUnit.SECONDS); + Assert.assertEquals(0, countDownLatch.getCount()); + + logger.info("Completed successfully."); + } finally { + logger.info("Disposing of subscriptions, consumers and clients."); + subscriptions.dispose(); + + dispose(producer); + dispose(consumers.toArray(new EventHubAsyncConsumer[0])); + dispose(clients); + } + } + + /** + * When we run this test, we check if there have been events already pushed to the partition, if not, we push some + * events there. + */ + private void setupEventTestData(EventHubAsyncClient client) { + if (HAS_PUSHED_EVENTS.getAndSet(true)) { + logger.info("Already pushed events to partition. Skipping."); + return; + } + + logger.info("Pushing events to partition. Message tracking value: {}", MESSAGE_TRACKING_VALUE); + + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().setPartitionId(PARTITION_ID); + final EventHubAsyncProducer producer = client.createProducer(producerOptions); + final Flux events = TestUtils.getEvents(NUMBER_OF_EVENTS, MESSAGE_TRACKING_VALUE); + + try { + MESSAGES_PUSHED_INSTANT.set(Instant.now()); + producer.send(events).block(TIMEOUT); + } finally { + dispose(producer); + } + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncConsumerIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncConsumerIntegrationTest.java index b7e679bc94aa..53a1ca50d275 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncConsumerIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncConsumerIntegrationTest.java @@ -5,10 +5,11 @@ import com.azure.core.amqp.TransportType; import com.azure.core.amqp.exception.AmqpException; +import com.azure.core.amqp.implementation.TracerProvider; import com.azure.core.util.logging.ClientLogger; -import com.azure.messaging.eventhubs.implementation.ApiTestBase; import com.azure.messaging.eventhubs.implementation.ConnectionOptions; import com.azure.messaging.eventhubs.implementation.ConnectionStringProperties; +import com.azure.messaging.eventhubs.implementation.IntegrationTestBase; import com.azure.messaging.eventhubs.implementation.ReactorHandlerProvider; import com.azure.messaging.eventhubs.models.EventHubConsumerOptions; import com.azure.messaging.eventhubs.models.EventHubProducerOptions; @@ -28,6 +29,7 @@ import java.time.Duration; import java.time.Instant; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.UUID; import java.util.concurrent.CountDownLatch; @@ -46,7 +48,7 @@ * @see SetPrefetchCountTest * @see EventPositionIntegrationTest */ -public class EventHubAsyncConsumerIntegrationTest extends ApiTestBase { +public class EventHubAsyncConsumerIntegrationTest extends IntegrationTestBase { private static final String PARTITION_ID = "0"; // The maximum number of receivers on a partition + consumer group is 5. private static final int MAX_NUMBER_OF_CONSUMERS = 5; @@ -62,21 +64,20 @@ public EventHubAsyncConsumerIntegrationTest() { public TestName testName = new TestName(); @Override - protected String testName() { + protected String getTestName() { return testName.getMethodName(); } @Override protected void beforeTest() { - skipIfNotRecordMode(); - final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(getReactorProvider()); final ConnectionStringProperties properties = new ConnectionStringProperties(getConnectionString()); - final ConnectionOptions connectionOptions = new ConnectionOptions(properties.endpoint().getHost(), - properties.eventHubName(), getTokenCredential(), getAuthorizationType(), TransportType.AMQP, + final ConnectionOptions connectionOptions = new ConnectionOptions(properties.getEndpoint().getHost(), + properties.getEventHubName(), getTokenCredential(), getAuthorizationType(), TransportType.AMQP, RETRY_OPTIONS, ProxyConfiguration.SYSTEM_DEFAULTS, Schedulers.parallel()); + final TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); - client = new EventHubAsyncClient(connectionOptions, getReactorProvider(), handlerProvider); + client = new EventHubAsyncClient(connectionOptions, getReactorProvider(), handlerProvider, tracerProvider); } @Override @@ -89,8 +90,6 @@ protected void afterTest() { */ @Test public void parallelCreationOfReceivers() { - skipIfNotRecordMode(); - // Arrange final int numberOfEvents = 10; final List partitionIds = client.getPartitionIds().collectList().block(TIMEOUT); @@ -110,7 +109,7 @@ public void parallelCreationOfReceivers() { consumers[i] = consumer; final Disposable subscription = consumer.receive().take(numberOfEvents).subscribe(event -> { - logger.info("Event[{}] received. partition: {}", event.sequenceNumber(), partitionId); + logger.info("Event[{}] received. partition: {}", event.getSequenceNumber(), partitionId); }, error -> { Assert.fail("An error should not have occurred:" + error.toString()); }, () -> { @@ -120,7 +119,7 @@ public void parallelCreationOfReceivers() { subscriptions.add(subscription); - producers[i] = client.createProducer(new EventHubProducerOptions().partitionId(partitionId)); + producers[i] = client.createProducer(new EventHubProducerOptions().setPartitionId(partitionId)); } // Act @@ -164,7 +163,7 @@ public void consumerIdentifierShowsUpInQuotaErrors() { EventHubAsyncConsumer exceededConsumer = null; try { for (int i = 0; i < MAX_NUMBER_OF_CONSUMERS; i++) { - final EventHubConsumerOptions options = new EventHubConsumerOptions().identifier(prefix + ":" + i); + final EventHubConsumerOptions options = new EventHubConsumerOptions().setIdentifier(prefix + ":" + i); final EventHubAsyncConsumer consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, EventPosition.earliest(), options); consumers.add(consumer); subscriptions.add(consumer.receive().take(TIMEOUT).subscribe(eventData -> { @@ -200,7 +199,7 @@ public void sameOwnerLevelClosesFirstConsumer() throws InterruptedException { final String secondPartitionId = "1"; final EventPosition position = EventPosition.fromEnqueuedTime(Instant.now()); final EventHubConsumerOptions options = new EventHubConsumerOptions() - .ownerLevel(1L); + .setOwnerLevel(1L); final EventHubAsyncConsumer consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, secondPartitionId, position, options); final EventHubAsyncConsumer consumer2 = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, secondPartitionId, @@ -220,7 +219,7 @@ public void sameOwnerLevelClosesFirstConsumer() throws InterruptedException { subscriptions.add(consumer.receive() .filter(event -> TestUtils.isMatchingEvent(event, MESSAGE_TRACKING_ID)) .subscribe( - event -> logger.info("C1:\tReceived event sequence: {}", event.sequenceNumber()), + event -> logger.info("C1:\tReceived event sequence: {}", event.getSequenceNumber()), ex -> logger.error("C1:\tERROR", ex), () -> { logger.info("C1:\tCompleted."); @@ -233,14 +232,14 @@ public void sameOwnerLevelClosesFirstConsumer() throws InterruptedException { subscriptions.add(consumer2.receive() .filter(event -> TestUtils.isMatchingEvent(event, MESSAGE_TRACKING_ID)) .subscribe( - event -> logger.info("C3:\tReceived event sequence: {}", event.sequenceNumber()), + event -> logger.info("C3:\tReceived event sequence: {}", event.getSequenceNumber()), ex -> logger.error("C3:\tERROR", ex), () -> logger.info("C3:\tCompleted."))); // Assert try { - boolean success = semaphore.tryAcquire(15, TimeUnit.SECONDS); - Assert.assertTrue(success); + Assert.assertTrue("The EventHubConsumer was not closed after one with a higher epoch number started.", + semaphore.tryAcquire(60, TimeUnit.SECONDS)); } finally { subscriptions.dispose(); isActive.set(false); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncConsumerTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncConsumerTest.java index 27c3bbcc3d2a..86845617c70c 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncConsumerTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncConsumerTest.java @@ -85,10 +85,10 @@ public void setup() { when(amqpReceiveLink.getShutdownSignals()).thenReturn(shutdownProcessor); options = new EventHubConsumerOptions() - .identifier("an-identifier") - .prefetchCount(PREFETCH) - .retry(new RetryOptions()) - .scheduler(Schedulers.elastic()); + .setIdentifier("an-identifier") + .setPrefetchCount(PREFETCH) + .setRetry(new RetryOptions()) + .setScheduler(Schedulers.elastic()); consumer = new EventHubAsyncConsumer(receiveLinkMono, options); } @@ -343,7 +343,7 @@ public void listensToShutdownSignals() throws InterruptedException, IOException final Disposable.Composite subscriptions = Disposables.composite( consumer.receive().filter(e -> isMatchingEvent(e, messageTrackingUUID)) .subscribe( - event -> logger.verbose("1. Received: {}", event.sequenceNumber()), + event -> logger.verbose("1. Received: {}", event.getSequenceNumber()), error -> Assert.fail(error.toString()), () -> { logger.info("1. Shutdown received"); @@ -351,7 +351,7 @@ public void listensToShutdownSignals() throws InterruptedException, IOException }), consumer.receive().filter(e -> isMatchingEvent(e, messageTrackingUUID)) .subscribe( - event -> logger.verbose("2. Received: {}", event.sequenceNumber()), + event -> logger.verbose("2. Received: {}", event.getSequenceNumber()), error -> Assert.fail(error.toString()), () -> { logger.info("2. Shutdown received"); @@ -359,7 +359,7 @@ public void listensToShutdownSignals() throws InterruptedException, IOException }), consumer.receive().filter(e -> isMatchingEvent(e, messageTrackingUUID)) .subscribe( - event -> logger.verbose("3. Received: {}", event.sequenceNumber()), + event -> logger.verbose("3. Received: {}", event.getSequenceNumber()), error -> Assert.fail(error.toString()), () -> { logger.info("3. Shutdown received"); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncProducerIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncProducerIntegrationTest.java index 11b676fdffa5..6cfab85e9639 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncProducerIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncProducerIntegrationTest.java @@ -3,15 +3,10 @@ package com.azure.messaging.eventhubs; -import com.azure.core.amqp.TransportType; import com.azure.core.util.logging.ClientLogger; -import com.azure.messaging.eventhubs.implementation.ApiTestBase; -import com.azure.messaging.eventhubs.implementation.ConnectionOptions; -import com.azure.messaging.eventhubs.implementation.ConnectionStringProperties; -import com.azure.messaging.eventhubs.implementation.ReactorHandlerProvider; +import com.azure.messaging.eventhubs.implementation.IntegrationTestBase; import com.azure.messaging.eventhubs.models.BatchOptions; import com.azure.messaging.eventhubs.models.EventHubProducerOptions; -import com.azure.messaging.eventhubs.models.ProxyConfiguration; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; @@ -26,7 +21,7 @@ import static java.nio.charset.StandardCharsets.UTF_8; -public class EventHubAsyncProducerIntegrationTest extends ApiTestBase { +public class EventHubAsyncProducerIntegrationTest extends IntegrationTestBase { private static final String PARTITION_ID = "1"; private EventHubAsyncClient client; @@ -39,19 +34,17 @@ public EventHubAsyncProducerIntegrationTest() { public TestName testName = new TestName(); @Override - protected String testName() { + protected String getTestName() { return testName.getMethodName(); } @Override protected void beforeTest() { - final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(getReactorProvider()); - final ConnectionStringProperties properties = new ConnectionStringProperties(getConnectionString()); - final ConnectionOptions connectionOptions = new ConnectionOptions(properties.endpoint().getHost(), - properties.eventHubName(), getTokenCredential(), getAuthorizationType(), TransportType.AMQP, RETRY_OPTIONS, - ProxyConfiguration.SYSTEM_DEFAULTS, Schedulers.parallel()); - - client = new EventHubAsyncClient(connectionOptions, getReactorProvider(), handlerProvider); + client = new EventHubClientBuilder() + .connectionString(getConnectionString()) + .retry(RETRY_OPTIONS) + .scheduler(Schedulers.parallel()) + .buildAsyncClient(); } @Override @@ -64,10 +57,8 @@ protected void afterTest() { */ @Test public void sendMessageToPartition() throws IOException { - skipIfNotRecordMode(); - // Arrange - final EventHubProducerOptions producerOptions = new EventHubProducerOptions().partitionId(PARTITION_ID); + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().setPartitionId(PARTITION_ID); final List events = Arrays.asList( new EventData("Event 1".getBytes(UTF_8)), new EventData("Event 2".getBytes(UTF_8)), @@ -86,8 +77,6 @@ public void sendMessageToPartition() throws IOException { */ @Test public void sendMessage() throws IOException { - skipIfNotRecordMode(); - // Arrange final List events = Arrays.asList( new EventData("Event 1".getBytes(UTF_8)), @@ -106,8 +95,6 @@ public void sendMessage() throws IOException { */ @Test public void sendBatch() throws IOException { - skipIfNotRecordMode(); - // Arrange final List events = Arrays.asList( new EventData("Event 1".getBytes(UTF_8)), @@ -134,8 +121,6 @@ public void sendBatch() throws IOException { */ @Test public void sendBatchWithPartitionKey() throws IOException { - skipIfNotRecordMode(); - // Arrange final List events = Arrays.asList( new EventData("Event 1".getBytes(UTF_8)), @@ -143,10 +128,10 @@ public void sendBatchWithPartitionKey() throws IOException { new EventData("Event 3".getBytes(UTF_8))); try (EventHubAsyncProducer producer = client.createProducer()) { - final BatchOptions options = new BatchOptions().partitionKey("my-partition-key"); + final BatchOptions options = new BatchOptions().setPartitionKey("my-partition-key"); final Mono createBatch = producer.createBatch(options) .map(batch -> { - Assert.assertEquals(options.partitionKey(), batch.getPartitionKey()); + Assert.assertEquals(options.getPartitionKey(), batch.getPartitionKey()); events.forEach(event -> { Assert.assertTrue(batch.tryAdd(event)); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncProducerTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncProducerTest.java index eaf3bc89e17a..d59543bfb295 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncProducerTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubAsyncProducerTest.java @@ -6,6 +6,10 @@ import com.azure.core.amqp.RetryOptions; import com.azure.core.amqp.exception.AmqpException; import com.azure.core.amqp.exception.ErrorCondition; +import com.azure.core.amqp.implementation.TracerProvider; +import com.azure.core.implementation.tracing.ProcessKind; +import com.azure.core.implementation.tracing.Tracer; +import com.azure.core.util.Context; import com.azure.messaging.eventhubs.implementation.AmqpSendLink; import com.azure.messaging.eventhubs.models.BatchOptions; import com.azure.messaging.eventhubs.models.EventHubProducerOptions; @@ -26,12 +30,19 @@ import reactor.test.StepVerifier; import java.time.Duration; +import java.util.Collections; import java.util.List; +import static com.azure.core.implementation.tracing.Tracer.DIAGNOSTIC_ID_KEY; +import static com.azure.core.implementation.tracing.Tracer.OPENTELEMETRY_SPAN_KEY; +import static com.azure.core.implementation.tracing.Tracer.SPAN_CONTEXT; import static java.nio.charset.StandardCharsets.UTF_8; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyList; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; @@ -47,6 +58,8 @@ public class EventHubAsyncProducerTest { @Captor ArgumentCaptor> messagesCaptor; + private RetryOptions retryOptions = new RetryOptions().setTryTimeout(Duration.ofSeconds(30)); + @Before public void setup() { MockitoAnnotations.initMocks(this); @@ -62,13 +75,13 @@ public void teardown() { } /** - * Verifies that sending multiple events will result in calling producer.send(List). + * Verifies that sending multiple events will result in calling producer.send(List<Message>). */ @Test public void sendMultipleMessages() { // Arrange final int count = 4; - final byte[] contents = CONTENTS.getBytes(UTF_8); + final byte[] contents = TEST_CONTENTS.getBytes(UTF_8); final Flux testData = Flux.range(0, count).flatMap(number -> { final EventData data = new EventData(contents); return Flux.just(data); @@ -78,8 +91,9 @@ public void sendMultipleMessages() { final SendOptions options = new SendOptions(); final EventHubProducerOptions producerOptions = new EventHubProducerOptions() - .retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))); - final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(sendLink), producerOptions); + .setRetry(new RetryOptions().setTryTimeout(Duration.ofSeconds(30))); + final TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(sendLink), producerOptions, tracerProvider); // Act StepVerifier.create(producer.send(testData, options)) @@ -100,14 +114,15 @@ public void sendMultipleMessages() { @Test public void sendSingleMessage() { // Arrange - final EventData testData = new EventData(CONTENTS.getBytes(UTF_8)); + final EventData testData = new EventData(TEST_CONTENTS.getBytes(UTF_8)); when(sendLink.send(any(Message.class))).thenReturn(Mono.empty()); final SendOptions options = new SendOptions(); final EventHubProducerOptions producerOptions = new EventHubProducerOptions() - .retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))); - final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(sendLink), producerOptions); + .setRetry(new RetryOptions().setTryTimeout(Duration.ofSeconds(30))); + final TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(sendLink), producerOptions, tracerProvider); // Act StepVerifier.create(producer.send(testData, options)) @@ -128,17 +143,18 @@ public void sendSingleMessage() { public void partitionProducerCannotSendWithPartitionKey() { // Arrange final Flux testData = Flux.just( - new EventData(CONTENTS.getBytes(UTF_8)), - new EventData(CONTENTS.getBytes(UTF_8))); + new EventData(TEST_CONTENTS.getBytes(UTF_8)), + new EventData(TEST_CONTENTS.getBytes(UTF_8))); when(sendLink.send(anyList())).thenReturn(Mono.empty()); - final SendOptions options = new SendOptions().partitionKey("Some partition key"); + final SendOptions options = new SendOptions().setPartitionKey("Some partition key"); final EventHubProducerOptions producerOptions = new EventHubProducerOptions() - .retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))) - .partitionId("my-partition-id"); + .setRetry(new RetryOptions().setTryTimeout(Duration.ofSeconds(30))) + .setPartitionId("my-partition-id"); + final TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); - final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(sendLink), producerOptions); + final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(sendLink), producerOptions, tracerProvider); // Act & Assert try { @@ -151,6 +167,88 @@ public void partitionProducerCannotSendWithPartitionKey() { verifyZeroInteractions(sendLink); } + /** + *Verifies start and end span invoked when sending a single message. + */ + @Test + public void sendStartSpanSingleMessage() { + //Arrange + final Tracer tracer1 = mock(Tracer.class); + final List tracers = Collections.singletonList(tracer1); + TracerProvider tracerProvider = new TracerProvider(tracers); + final Flux testData = Flux.just( + new EventData(TEST_CONTENTS.getBytes(UTF_8)), + new EventData(TEST_CONTENTS.getBytes(UTF_8))); + + when(sendLink.send(anyList())).thenReturn(Mono.empty()); + + final EventHubProducerOptions producerOptions = new EventHubProducerOptions() + .setRetry(new RetryOptions().setTryTimeout(Duration.ofSeconds(30))) + .setPartitionId("my-partition-id"); + + final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(sendLink), producerOptions, tracerProvider); + + when(tracer1.start(eq("Azure.eventhubs.send"), any(), eq(ProcessKind.SEND))).thenAnswer( + invocation -> { + Context passed = invocation.getArgument(1, Context.class); + return passed.addData(OPENTELEMETRY_SPAN_KEY, "value"); + } + ); + + when(tracer1.start(eq("Azure.eventhubs.message"), any(), eq(ProcessKind.RECEIVE))).thenAnswer( + invocation -> { + Context passed = invocation.getArgument(1, Context.class); + return passed.addData(OPENTELEMETRY_SPAN_KEY, "value").addData(DIAGNOSTIC_ID_KEY, "value2"); + } + ); + + //Act + StepVerifier.create(producer.send(testData)).verifyComplete(); + + //Assert + verify(tracer1, times(2)).start(eq("Azure.eventhubs.send"), any(), eq(ProcessKind.SEND)); + verify(tracer1, times(2)).start(eq("Azure.eventhubs.message"), any(), eq(ProcessKind.RECEIVE)); + verify(tracer1, times(3)).end(eq("success"), isNull(), any()); + } + + /** + *Verifies addLink method invoked when sending a single message on retry (span context already present on event). + */ + @Test + public void sendMessageAddlink() { + //Arrange + final Tracer tracer1 = mock(Tracer.class); + final List tracers = Collections.singletonList(tracer1); + TracerProvider tracerProvider = new TracerProvider(tracers); + final Flux testData = Flux.just( + new EventData(TEST_CONTENTS.getBytes(UTF_8), new Context(SPAN_CONTEXT, Context.NONE)), + new EventData(TEST_CONTENTS.getBytes(UTF_8), new Context(SPAN_CONTEXT, Context.NONE))); + + when(sendLink.send(anyList())).thenReturn(Mono.empty()); + + final EventHubProducerOptions producerOptions = new EventHubProducerOptions() + .setRetry(new RetryOptions().setTryTimeout(Duration.ofSeconds(30))) + .setPartitionId("my-partition-id"); + + final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(sendLink), producerOptions, tracerProvider); + + when(tracer1.start(eq("Azure.eventhubs.send"), any(), eq(ProcessKind.SEND))).thenAnswer( + invocation -> { + Context passed = invocation.getArgument(1, Context.class); + return passed.addData(OPENTELEMETRY_SPAN_KEY, "value"); + } + ); + + //Act + StepVerifier.create(producer.send(testData)).verifyComplete(); + + //Assert + verify(tracer1, times(2)).start(eq("Azure.eventhubs.send"), any(), eq(ProcessKind.SEND)); + verify(tracer1, never()).start(eq("Azure.eventhubs.message"), any(), eq(ProcessKind.RECEIVE)); + verify(tracer1, times(2)).addLink(any()); + verify(tracer1, times(1)).end(eq("success"), isNull(), any()); + } + /** * Verifies that it fails if we try to send multiple messages that cannot fit in a single message batch. */ @@ -163,13 +261,14 @@ public void sendTooManyMessages() { // We believe 20 events is enough for that EventDataBatch to be greater than max size. final Flux testData = Flux.range(0, 20).flatMap(number -> { - final EventData data = new EventData(CONTENTS.getBytes(UTF_8)); + final EventData data = new EventData(TEST_CONTENTS.getBytes(UTF_8)); return Flux.just(data); }); final SendOptions options = new SendOptions(); - final EventHubProducerOptions producerOptions = new EventHubProducerOptions().retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))); - final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(link), producerOptions); + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().setRetry(new RetryOptions().setTryTimeout(Duration.ofSeconds(30))); + final TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(link), producerOptions, tracerProvider); // Act & Assert StepVerifier.create(producer.send(testData, options)) @@ -201,8 +300,9 @@ public void createsEventDataBatch() { // This event will be 1025 bytes when serialized. final EventData tooLargeEvent = new EventData(new byte[maxEventPayload + 1]); - final EventHubProducerOptions producerOptions = new EventHubProducerOptions().retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))); - final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(link), producerOptions); + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().setRetry(new RetryOptions().setTryTimeout(Duration.ofSeconds(30))); + final TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(link), producerOptions, tracerProvider); // Act & Assert StepVerifier.create(producer.createBatch()) @@ -238,14 +338,15 @@ public void createsEventDataBatchWithPartitionKey() { // This event is 1024 bytes when serialized. final EventData event = new EventData(new byte[eventPayload]); - final BatchOptions options = new BatchOptions().partitionKey("some-key"); - final EventHubProducerOptions producerOptions = new EventHubProducerOptions().retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))); - final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(link), producerOptions); + final BatchOptions options = new BatchOptions().setPartitionKey("some-key"); + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().setRetry(new RetryOptions().setTryTimeout(Duration.ofSeconds(30))); + final TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(link), producerOptions, tracerProvider); // Act & Assert StepVerifier.create(producer.createBatch(options)) .assertNext(batch -> { - Assert.assertEquals(options.partitionKey(), batch.getPartitionKey()); + Assert.assertEquals(options.getPartitionKey(), batch.getPartitionKey()); Assert.assertTrue(batch.tryAdd(event)); }) .verifyComplete(); @@ -264,9 +365,10 @@ public void createEventDataBatchWhenMaxSizeIsTooBig() { when(link.getLinkSize()).thenReturn(Mono.just(maxLinkSize)); // This event is 1024 bytes when serialized. - final BatchOptions options = new BatchOptions().maximumSizeInBytes(batchSize); - final EventHubProducerOptions producerOptions = new EventHubProducerOptions().retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))); - final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(link), producerOptions); + final BatchOptions options = new BatchOptions().setMaximumSizeInBytes(batchSize); + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().setRetry(new RetryOptions().setTryTimeout(Duration.ofSeconds(30))); + final TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(link), producerOptions, tracerProvider); // Act & Assert StepVerifier.create(producer.createBatch(options)) @@ -276,7 +378,7 @@ public void createEventDataBatchWhenMaxSizeIsTooBig() { /** * Verifies that the producer can create an {@link EventDataBatch} with a given {@link - * BatchOptions#maximumSizeInBytes()}. + * BatchOptions#getMaximumSizeInBytes()}. */ @Test public void createsEventDataBatchWithSize() { @@ -297,9 +399,10 @@ public void createsEventDataBatchWithSize() { // This event will be 1025 bytes when serialized. final EventData tooLargeEvent = new EventData(new byte[maxEventPayload + 1]); - final BatchOptions options = new BatchOptions().maximumSizeInBytes(batchSize); - final EventHubProducerOptions producerOptions = new EventHubProducerOptions().retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))); - final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(link), producerOptions); + final BatchOptions options = new BatchOptions().setMaximumSizeInBytes(batchSize); + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().setRetry(new RetryOptions().setTryTimeout(Duration.ofSeconds(30))); + final TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(link), producerOptions, tracerProvider); // Act & Assert StepVerifier.create(producer.createBatch(options)) @@ -326,14 +429,15 @@ public void batchOptionsIsCloned() { when(link.getLinkSize()).thenReturn(Mono.just(maxLinkSize)); final String originalKey = "some-key"; - final BatchOptions options = new BatchOptions().partitionKey(originalKey); - final EventHubProducerOptions producerOptions = new EventHubProducerOptions().retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))); - final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(link), producerOptions); + final BatchOptions options = new BatchOptions().setPartitionKey(originalKey); + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().setRetry(new RetryOptions().setTryTimeout(Duration.ofSeconds(30))); + final TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(link), producerOptions, tracerProvider); // Act & Assert StepVerifier.create(producer.createBatch(options)) .assertNext(batch -> { - options.partitionKey("something-else"); + options.setPartitionKey("something-else"); Assert.assertEquals(originalKey, batch.getPartitionKey()); }) .verifyComplete(); @@ -357,8 +461,10 @@ public void sendsAnEventDataBatch() { // This event will be 1025 bytes when serialized. final EventData tooLargeEvent = new EventData(new byte[maxEventPayload + 1]); - final EventHubProducerOptions producerOptions = new EventHubProducerOptions().retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))); - final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(link), producerOptions); + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().setRetry(new RetryOptions().setTryTimeout( + Duration.ofSeconds(30))); + final TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + final EventHubAsyncProducer producer = new EventHubAsyncProducer(Mono.just(link), producerOptions, tracerProvider); // Act & Assert StepVerifier.create(producer.createBatch()) @@ -378,7 +484,7 @@ public void sendsAnEventDataBatch() { verify(link, times(2)).getLinkSize(); } - private static final String CONTENTS = "SSLorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vehicula posuere lobortis. Aliquam finibus volutpat dolor, faucibus pellentesque ipsum bibendum vitae. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Ut sit amet urna hendrerit, dapibus justo a, sodales justo. Mauris finibus augue id pulvinar congue. Nam maximus luctus ipsum, at commodo ligula euismod ac. Phasellus vitae lacus sit amet diam porta placerat. \n" + static final String TEST_CONTENTS = "SSLorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vehicula posuere lobortis. Aliquam finibus volutpat dolor, faucibus pellentesque ipsum bibendum vitae. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Ut sit amet urna hendrerit, dapibus justo a, sodales justo. Mauris finibus augue id pulvinar congue. Nam maximus luctus ipsum, at commodo ligula euismod ac. Phasellus vitae lacus sit amet diam porta placerat. \n" + "Ut sodales efficitur sapien ut posuere. Morbi sed tellus est. Proin eu erat purus. Proin massa nunc, condimentum id iaculis dignissim, consectetur et odio. Cras suscipit sem eu libero aliquam tincidunt. Nullam ut arcu suscipit, eleifend velit in, cursus libero. Ut eleifend facilisis odio sit amet feugiat. Phasellus at nunc sit amet elit sagittis commodo ac in nisi. Fusce vitae aliquam quam. Integer vel nibh euismod, tempus elit vitae, pharetra est. Duis vulputate enim a elementum dignissim. Morbi dictum enim id elit scelerisque, in elementum nulla pharetra. \n" + "Aenean aliquet aliquet condimentum. Proin dapibus dui id libero tempus feugiat. Sed commodo ligula a lectus mattis, vitae tincidunt velit auctor. Fusce quis semper dui. Phasellus eu efficitur sem. Ut non sem sit amet enim condimentum venenatis id dictum massa. Nullam sagittis lacus a neque sodales, et ultrices arcu mattis. Aliquam erat volutpat. \n" + "Aenean fringilla quam elit, id mattis purus vestibulum nec. Praesent porta eros in dapibus molestie. Vestibulum orci libero, tincidunt et turpis eget, condimentum lobortis enim. Fusce suscipit ante et mauris consequat cursus nec laoreet lorem. Maecenas in sollicitudin diam, non tincidunt purus. Nunc mauris purus, laoreet eget interdum vitae, placerat a sapien. In mi risus, blandit eu facilisis nec, molestie suscipit leo. Pellentesque molestie urna vitae dui faucibus bibendum. \n" diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientBuilderTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientBuilderTest.java index 29b45f66fe9b..dcc864fe3702 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientBuilderTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientBuilderTest.java @@ -3,21 +3,18 @@ package com.azure.messaging.eventhubs; +import static org.junit.Assert.assertNotNull; + import com.azure.core.amqp.TransportType; import com.azure.messaging.eventhubs.implementation.ClientConstants; -import com.azure.messaging.eventhubs.models.EventPosition; import com.azure.messaging.eventhubs.models.ProxyAuthenticationType; import com.azure.messaging.eventhubs.models.ProxyConfiguration; -import org.junit.Test; -import reactor.core.publisher.Mono; - import java.net.InetSocketAddress; import java.net.Proxy; import java.net.URI; import java.net.URISyntaxException; import java.util.Locale; - -import static org.junit.Assert.assertNotNull; +import org.junit.Test; public class EventHubClientBuilderTest { private static final String NAMESPACE_NAME = "dummyNamespaceName"; @@ -89,47 +86,5 @@ private static URI getURI(String endpointFormat, String namespace, String domain } } - @Test(expected = NullPointerException.class) - public void testEventProcessorBuilderMissingProperties() { - final EventHubClientBuilder builder = new EventHubClientBuilder().connectionString(CORRECT_CONNECTION_STRING); - builder.buildEventProcessor(); // should throw NPE - } - - @Test - public void testEventProcessorBuilder() { - final EventHubClientBuilder builder = new EventHubClientBuilder() - .connectionString(CORRECT_CONNECTION_STRING) - .partitionProcessorFactory((partitionContext, checkpointManager) -> { - // A no-op partition processor for to test builder - return new PartitionProcessor() { - @Override - public Mono initialize() { - System.out.println("Called initialize"); - return Mono.empty(); - } - - @Override - public Mono processEvent(EventData eventData) { - System.out.println("Called process event"); - return Mono.empty(); - } - - @Override - public void processError(Throwable throwable) { - // do nothing - } - - @Override - public Mono close(CloseReason closeReason) { - return Mono.empty(); - } - }; - }) - .consumerGroupName("test-consumer") - .initialEventPosition(EventPosition.latest()) - .partitionManager(new InMemoryPartitionManager()); - assertNotNull(builder.buildEventProcessor()); - } - // TODO: add test for retry(), scheduler(), timeout(), transportType() } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientIntegrationTest.java index 83eb91c70326..148c009ab127 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientIntegrationTest.java @@ -3,83 +3,40 @@ package com.azure.messaging.eventhubs; -import com.azure.core.amqp.TransportType; +import com.azure.core.util.IterableStream; import com.azure.core.util.logging.ClientLogger; -import com.azure.messaging.eventhubs.implementation.ApiTestBase; -import com.azure.messaging.eventhubs.implementation.ConnectionOptions; -import com.azure.messaging.eventhubs.implementation.ReactorHandlerProvider; -import com.azure.messaging.eventhubs.models.EventHubConsumerOptions; -import com.azure.messaging.eventhubs.models.EventHubProducerOptions; -import com.azure.messaging.eventhubs.models.EventPosition; +import com.azure.messaging.eventhubs.implementation.ConnectionStringProperties; +import com.azure.messaging.eventhubs.implementation.IntegrationTestBase; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import reactor.core.Disposable; -import reactor.core.Disposables; -import reactor.core.publisher.Flux; -import reactor.test.StepVerifier; import java.time.Instant; -import java.util.ArrayList; -import java.util.Arrays; import java.util.List; -import java.util.UUID; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicReference; - -import static com.azure.messaging.eventhubs.EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME; -import static com.azure.messaging.eventhubs.TestUtils.isMatchingEvent; -import static java.nio.charset.StandardCharsets.UTF_8; - -/** - * Tests scenarios on {@link EventHubAsyncClient}. - */ -@RunWith(Parameterized.class) -public class EventHubClientIntegrationTest extends ApiTestBase { - private static final int NUMBER_OF_EVENTS = 5; - - @Parameterized.Parameters(name = "{index}: transportType={0}") - public static Iterable getTransportTypes() { - return Arrays.asList(TransportType.AMQP, TransportType.AMQP_WEB_SOCKETS); - } - - private static final String PARTITION_ID = "1"; - private static final AtomicBoolean HAS_PUSHED_EVENTS = new AtomicBoolean(); - private static final AtomicReference MESSAGES_PUSHED_INSTANT = new AtomicReference<>(); - private static final String MESSAGE_TRACKING_VALUE = UUID.randomUUID().toString(); +import java.util.stream.Collectors; - private EventHubAsyncClient client; +public class EventHubClientIntegrationTest extends IntegrationTestBase { + private EventHubClient client; @Rule public TestName testName = new TestName(); - public EventHubClientIntegrationTest(TransportType transportType) { + public EventHubClientIntegrationTest() { super(new ClientLogger(EventHubClientIntegrationTest.class)); - - setTransportType(transportType); } @Override - protected String testName() { + protected String getTestName() { return testName.getMethodName(); } @Override protected void beforeTest() { - skipIfNotRecordMode(); - - final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(getReactorProvider()); - final ConnectionOptions connectionOptions = getConnectionOptions(); - - client = new EventHubAsyncClient(connectionOptions, getReactorProvider(), handlerProvider); - - setupEventTestData(client); + client = new EventHubClientBuilder() + .connectionString(getConnectionString()) + .retry(RETRY_OPTIONS) + .buildClient(); } @Override @@ -87,118 +44,58 @@ protected void afterTest() { dispose(client); } - @Test(expected = NullPointerException.class) - public void nullConstructor() throws NullPointerException { - new EventHubAsyncClient(null, null, null); - } - /** - * Verifies that we can receive messages, and that the receiver continues to fetch messages when the prefetch queue - * is exhausted. + * Verifies we can get partition ids of an Event Hub. */ @Test - public void receiveMessage() { - // Arrange - final EventHubConsumerOptions options = new EventHubConsumerOptions() - .prefetchCount(2); - final EventHubAsyncConsumer consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, - EventPosition.fromEnqueuedTime(MESSAGES_PUSHED_INSTANT.get()), options); - - // Act & Assert - StepVerifier.create(consumer.receive().filter(x -> isMatchingEvent(x, MESSAGE_TRACKING_VALUE)).take(NUMBER_OF_EVENTS)) - .expectNextCount(NUMBER_OF_EVENTS) - .verifyComplete(); + public void getPartitionIds() { + // Act + final IterableStream response = client.getPartitionIds(); + + // Assert + Assert.assertNotNull(response); + + final List partitionIds = response.stream().collect(Collectors.toList()); + Assert.assertTrue(partitionIds.size() > 1); } /** - * Verifies that we can have multiple consumers listening to the same partition + consumer group at the same time. + * Verifies we can get partition ids of an Event Hub. */ - @Ignore("Investigate. Only 2 of the 4 consumers get the events. The other two consumers do not.") @Test - public void parallelEventHubClients() throws InterruptedException { - skipIfNotRecordMode(); - + public void getMetadata() { // Arrange - final int numberOfClients = 4; - final int numberOfEvents = 10; - final String messageTrackingId = "message-tracking-id"; - final String messageTrackingValue = UUID.randomUUID().toString(); - final Flux events = Flux.range(0, numberOfEvents).map(number -> { - final EventData eventData = new EventData("testString".getBytes(UTF_8)); - eventData.addProperty(messageTrackingId, messageTrackingValue); - return eventData; - }); - - final CountDownLatch countDownLatch = new CountDownLatch(numberOfClients); - final EventHubAsyncClient[] clients = new EventHubAsyncClient[numberOfClients]; - for (int i = 0; i < numberOfClients; i++) { - clients[i] = new EventHubAsyncClient(getConnectionOptions(), getReactorProvider(), new ReactorHandlerProvider(getReactorProvider())); - } - - final EventHubAsyncProducer producer = clients[0].createProducer(new EventHubProducerOptions().partitionId(PARTITION_ID)); - final List consumers = new ArrayList<>(); - final Disposable.Composite subscriptions = Disposables.composite(); - - try { - for (final EventHubAsyncClient hubClient : clients) { - final EventHubAsyncConsumer consumer = hubClient.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, EventPosition.latest()); - consumers.add(consumer); - - final Disposable subscription = consumer.receive().filter(event -> { - return event.properties() != null - && event.properties().containsKey(messageTrackingId) - && messageTrackingValue.equals(event.properties().get(messageTrackingId)); - }).take(numberOfEvents).subscribe(event -> { - logger.info("Event[{}] matched.", event.sequenceNumber()); - }, error -> Assert.fail("An error should not have occurred:" + error.toString()), () -> { - long count = countDownLatch.getCount(); - logger.info("Finished consuming events. Counting down: {}", count); - countDownLatch.countDown(); - }); - - subscriptions.add(subscription); - } - - // Act - producer.send(events).block(TIMEOUT); - - // Assert - // Wait for all the events we sent to be received by each of the consumers. - countDownLatch.await(TIMEOUT.getSeconds(), TimeUnit.SECONDS); - Assert.assertEquals(0, countDownLatch.getCount()); - - logger.info("Completed successfully."); - } finally { - logger.info("Disposing of subscriptions, consumers and clients."); - subscriptions.dispose(); - - dispose(producer); - dispose(consumers.toArray(new EventHubAsyncConsumer[0])); - dispose(clients); - } + final ConnectionStringProperties connectionProperties = getConnectionStringProperties(); + + // Act + final EventHubProperties properties = client.getProperties(); + + // Assert + Assert.assertNotNull(properties); + Assert.assertEquals(connectionProperties.getEventHubName(), properties.getName()); + Assert.assertTrue(properties.getCreatedAt().isBefore(Instant.now())); + + Assert.assertNotNull(properties.getPartitionIds()); + Assert.assertTrue(properties.getPartitionIds().length > 1); } /** - * When we run this test, we check if there have been events already pushed to the partition, if not, we push some - * events there. + * Verifies we can get partition ids of an Event Hub. */ - private void setupEventTestData(EventHubAsyncClient client) { - if (HAS_PUSHED_EVENTS.getAndSet(true)) { - logger.info("Already pushed events to partition. Skipping."); - return; - } - - logger.info("Pushing events to partition. Message tracking value: {}", MESSAGE_TRACKING_VALUE); - - final EventHubProducerOptions producerOptions = new EventHubProducerOptions().partitionId(PARTITION_ID); - final EventHubAsyncProducer producer = client.createProducer(producerOptions); - final Flux events = TestUtils.getEvents(NUMBER_OF_EVENTS, MESSAGE_TRACKING_VALUE); - - try { - MESSAGES_PUSHED_INSTANT.set(Instant.now()); - producer.send(events).block(TIMEOUT); - } finally { - dispose(producer); - } + @Test + public void getPartitionProperties() { + // Arrange + final ConnectionStringProperties connectionProperties = getConnectionStringProperties(); + final EventHubProperties properties = client.getProperties(); + final String partitionId = properties.getPartitionIds()[0]; + + // Act + final PartitionProperties partitionProperties = client.getPartitionProperties(partitionId); + + // Assert + Assert.assertNotNull(partitionProperties); + + Assert.assertEquals(connectionProperties.getEventHubName(), partitionProperties.getEventHubName()); + Assert.assertEquals(partitionId, partitionProperties.getId()); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientMetadataIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientMetadataIntegrationTest.java index 4c5e6b98c065..501fa6a8ff54 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientMetadataIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientMetadataIntegrationTest.java @@ -6,12 +6,13 @@ import com.azure.core.amqp.TransportType; import com.azure.core.amqp.exception.AmqpException; import com.azure.core.amqp.exception.ErrorCondition; +import com.azure.core.amqp.implementation.TracerProvider; import com.azure.core.credentials.TokenCredential; import com.azure.core.implementation.util.ImplUtils; import com.azure.core.util.logging.ClientLogger; -import com.azure.messaging.eventhubs.implementation.ApiTestBase; import com.azure.messaging.eventhubs.implementation.ConnectionOptions; import com.azure.messaging.eventhubs.implementation.ConnectionStringProperties; +import com.azure.messaging.eventhubs.implementation.IntegrationTestBase; import com.azure.messaging.eventhubs.implementation.ReactorHandlerProvider; import com.azure.messaging.eventhubs.models.ProxyConfiguration; import org.junit.Assert; @@ -24,12 +25,13 @@ import java.net.URI; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; +import java.util.Collections; import java.util.Locale; /** * Tests the metadata operations such as fetching partition properties and event hub properties. */ -public class EventHubClientMetadataIntegrationTest extends ApiTestBase { +public class EventHubClientMetadataIntegrationTest extends IntegrationTestBase { private final String[] expectedPartitionIds = new String[]{"0", "1"}; private EventHubAsyncClient client; private ReactorHandlerProvider handlerProvider; @@ -43,17 +45,17 @@ public EventHubClientMetadataIntegrationTest() { public TestName testName = new TestName(); @Override - protected String testName() { + protected String getTestName() { return testName.getMethodName(); } @Override protected void beforeTest() { - skipIfNotRecordMode(); - - eventHubName = getConnectionOptions().eventHubName(); + eventHubName = getConnectionOptions().getEventHubName(); handlerProvider = new ReactorHandlerProvider(getReactorProvider()); - client = new EventHubAsyncClient(getConnectionOptions(), getReactorProvider(), handlerProvider); + final TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + + client = new EventHubAsyncClient(getConnectionOptions(), getReactorProvider(), handlerProvider, tracerProvider); } @Override @@ -70,8 +72,8 @@ public void getEventHubProperties() { StepVerifier.create(client.getProperties()) .assertNext(properties -> { Assert.assertNotNull(properties); - Assert.assertEquals(eventHubName, properties.name()); - Assert.assertEquals(expectedPartitionIds.length, properties.partitionIds().length); + Assert.assertEquals(eventHubName, properties.getName()); + Assert.assertEquals(expectedPartitionIds.length, properties.getPartitionIds().length); }).verifyComplete(); } @@ -95,8 +97,8 @@ public void getPartitionProperties() { for (String partitionId : expectedPartitionIds) { StepVerifier.create(client.getPartitionProperties(partitionId)) .assertNext(properties -> { - Assert.assertEquals(eventHubName, properties.eventHubName()); - Assert.assertEquals(partitionId, properties.id()); + Assert.assertEquals(eventHubName, properties.getEventHubName()); + Assert.assertEquals(partitionId, properties.getId()); }) .verifyComplete(); } @@ -115,8 +117,8 @@ public void getPartitionPropertiesMultipleCalls() { // Assert StepVerifier.create(partitionProperties) - .assertNext(properties -> Assert.assertEquals(eventHubName, properties.eventHubName())) - .assertNext(properties -> Assert.assertEquals(eventHubName, properties.eventHubName())) + .assertNext(properties -> Assert.assertEquals(eventHubName, properties.getEventHubName())) + .assertNext(properties -> Assert.assertEquals(eventHubName, properties.getEventHubName())) .verifyComplete(); } @@ -127,14 +129,16 @@ public void getPartitionPropertiesMultipleCalls() { public void getPartitionPropertiesInvalidToken() throws InvalidKeyException, NoSuchAlgorithmException { // Arrange final ConnectionStringProperties original = getConnectionStringProperties(); - final ConnectionStringProperties invalidCredentials = getCredentials(original.endpoint(), original.eventHubName(), - original.sharedAccessKeyName(), "invalid-sas-key-value"); + final ConnectionStringProperties invalidCredentials = getCredentials(original.getEndpoint(), original.getEventHubName(), + original.getSharedAccessKeyName(), "invalid-sas-key-value"); final TokenCredential badTokenProvider = new EventHubSharedAccessKeyCredential( - invalidCredentials.sharedAccessKeyName(), invalidCredentials.sharedAccessKey(), TIMEOUT); - final ConnectionOptions connectionOptions = new ConnectionOptions(original.endpoint().getHost(), - original.eventHubName(), badTokenProvider, getAuthorizationType(), TransportType.AMQP, RETRY_OPTIONS, - ProxyConfiguration.SYSTEM_DEFAULTS, getConnectionOptions().scheduler()); - final EventHubAsyncClient client = new EventHubAsyncClient(connectionOptions, getReactorProvider(), handlerProvider); + invalidCredentials.getSharedAccessKeyName(), invalidCredentials.getSharedAccessKey(), TIMEOUT); + final ConnectionOptions connectionOptions = new ConnectionOptions(original.getEndpoint().getHost(), + original.getEventHubName(), badTokenProvider, getAuthorizationType(), TransportType.AMQP, RETRY_OPTIONS, + ProxyConfiguration.SYSTEM_DEFAULTS, getConnectionOptions().getScheduler()); + final TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + + final EventHubAsyncClient client = new EventHubAsyncClient(connectionOptions, getReactorProvider(), handlerProvider, tracerProvider); // Act & Assert StepVerifier.create(client.getProperties()) @@ -156,10 +160,12 @@ public void getPartitionPropertiesInvalidToken() throws InvalidKeyException, NoS public void getPartitionPropertiesNonExistentHub() { // Arrange final ConnectionStringProperties original = getConnectionStringProperties(); - final ConnectionOptions connectionOptions = new ConnectionOptions(original.endpoint().getHost(), + final ConnectionOptions connectionOptions = new ConnectionOptions(original.getEndpoint().getHost(), "invalid-event-hub", getTokenCredential(), getAuthorizationType(), TransportType.AMQP, - RETRY_OPTIONS, ProxyConfiguration.SYSTEM_DEFAULTS, getConnectionOptions().scheduler()); - final EventHubAsyncClient client = new EventHubAsyncClient(connectionOptions, getReactorProvider(), handlerProvider); + RETRY_OPTIONS, ProxyConfiguration.SYSTEM_DEFAULTS, getConnectionOptions().getScheduler()); + final TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + + final EventHubAsyncClient client = new EventHubAsyncClient(connectionOptions, getReactorProvider(), handlerProvider, tracerProvider); // Act & Assert StepVerifier.create(client.getPartitionIds()) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerIntegrationTest.java new file mode 100644 index 000000000000..9cf5b244353f --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerIntegrationTest.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import com.azure.core.util.IterableStream; +import com.azure.core.util.logging.ClientLogger; +import com.azure.messaging.eventhubs.implementation.IntegrationTestBase; +import com.azure.messaging.eventhubs.models.EventHubProducerOptions; +import com.azure.messaging.eventhubs.models.EventPosition; +import org.junit.Assert; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; +import reactor.core.publisher.Flux; + +import java.time.Duration; +import java.time.Instant; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static com.azure.messaging.eventhubs.EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME; + +public class EventHubConsumerIntegrationTest extends IntegrationTestBase { + private static final String PARTITION_ID = "0"; + private static final int NUMBER_OF_EVENTS = 10; + + private EventHubClient client; + private EventHubConsumer consumer; + + // We use these values to keep track of the events we've pushed to the service and ensure the events we receive are + // our own. + private static final AtomicBoolean HAS_PUSHED_EVENTS = new AtomicBoolean(); + private static final String MESSAGE_TRACKING_VALUE = UUID.randomUUID().toString(); + private static final AtomicReference MESSAGES_PUSHED_INSTANT = new AtomicReference<>(); + + public EventHubConsumerIntegrationTest() { + super(new ClientLogger(EventHubConsumerIntegrationTest.class)); + } + + @Rule + public TestName testName = new TestName(); + + @Override + protected String getTestName() { + return testName.getMethodName(); + } + + @Override + protected void beforeTest() { + super.beforeTest(); + client = new EventHubClientBuilder() + .connectionString(getConnectionString()) + .retry(RETRY_OPTIONS) + .buildClient(); + + setupEventTestData(client); + + consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, + EventPosition.fromEnqueuedTime(MESSAGES_PUSHED_INSTANT.get())); + } + + @Override + protected void afterTest() { + dispose(consumer, client); + } + + /** + * Verifies that we can receive events a single time that is up to the batch size. + */ + @Test + public void receiveEvents() { + // Arrange + final int numberOfEvents = 5; + + // Act + final IterableStream actual = consumer.receive(numberOfEvents, Duration.ofSeconds(10)); + + // Assert + final List asList = actual.stream().collect(Collectors.toList()); + Assert.assertEquals(numberOfEvents, asList.size()); + } + + /** + * Verifies that we can receive multiple times. + */ + @Test + public void receiveEventsMultipleTimes() { + // Arrange + final int numberOfEvents = 5; + final int secondNumberOfEvents = 2; + final Duration waitTime = Duration.ofSeconds(10); + + // Act + final IterableStream actual = consumer.receive(numberOfEvents, waitTime); + final IterableStream actual2 = consumer.receive(secondNumberOfEvents, waitTime); + + // Assert + final Map asList = actual.stream() + .collect(Collectors.toMap(EventData::getSequenceNumber, Function.identity())); + Assert.assertEquals(numberOfEvents, asList.size()); + + final Map asList2 = actual2.stream() + .collect(Collectors.toMap(EventData::getSequenceNumber, Function.identity())); + Assert.assertEquals(secondNumberOfEvents, asList2.size()); + + final Long maximumSequence = Collections.max(asList.keySet()); + final Long minimumSequence = Collections.min(asList2.keySet()); + + Assert.assertTrue("The minimum in second receive should be less than first receive.", + maximumSequence < minimumSequence); + } + + /** + * Verify that we can receive until the timeout. + */ + @Test + public void receiveUntilTimeout() { + // Arrange + final int numberOfEvents = 15; + final String partitionId = "1"; + final List events = TestUtils.getEventsAsList(numberOfEvents, TestUtils.MESSAGE_TRACKING_ID); + + final EventPosition position = EventPosition.fromEnqueuedTime(Instant.now()); + final EventHubConsumer consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, partitionId, position); + + final EventHubProducer producer = client.createProducer(new EventHubProducerOptions().setPartitionId(partitionId)); + + try { + producer.send(events); + + // Act + final IterableStream receive = consumer.receive(100, Duration.ofSeconds(5)); + + // Assert + final List asList = receive.stream().collect(Collectors.toList()); + Assert.assertEquals(numberOfEvents, asList.size()); + } finally { + dispose(producer, consumer); + } + } + + /** + * Verify that we don't continue to fetch more events when there are no listeners. + */ + @Test + public void doesNotContinueToReceiveEvents() { + // Arrange + final int numberOfEvents = 15; + final int secondSetOfEvents = 25; + final int receiveNumber = 10; + final String partitionId = "1"; + + final List events = TestUtils.getEventsAsList(numberOfEvents, TestUtils.MESSAGE_TRACKING_ID); + final List events2 = TestUtils.getEventsAsList(secondSetOfEvents, TestUtils.MESSAGE_TRACKING_ID); + + final EventHubConsumer consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, partitionId, + EventPosition.fromEnqueuedTime(Instant.now())); + + final EventHubProducer producer = client.createProducer(new EventHubProducerOptions().setPartitionId(partitionId)); + + try { + producer.send(events); + + // Act + final IterableStream receive = consumer.receive(receiveNumber, Duration.ofSeconds(5)); + + // Assert + final List asList = receive.stream().collect(Collectors.toList()); + Assert.assertEquals(receiveNumber, asList.size()); + + producer.send(events2); + } finally { + dispose(consumer, producer); + } + } + + /** + * Verify that we don't continue to fetch more events when there are no listeners. + */ + @Test + public void multipleConsumers() { + final int numberOfEvents = 15; + final int receiveNumber = 10; + final String partitionId = "1"; + + final List events = TestUtils.getEventsAsList(numberOfEvents, TestUtils.MESSAGE_TRACKING_ID); + + final EventPosition position = EventPosition.fromEnqueuedTime(Instant.now()); + final EventHubConsumer consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, partitionId, position); + final EventHubConsumer consumer2 = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, partitionId, position); + final EventHubProducer producer = client.createProducer(new EventHubProducerOptions().setPartitionId(partitionId)); + + try { + producer.send(events); + + // Act + final IterableStream receive = consumer.receive(receiveNumber, Duration.ofSeconds(5)); + final IterableStream receive2 = consumer2.receive(receiveNumber, Duration.ofSeconds(5)); + + // Assert + final List asList = receive.stream().map(EventData::getSequenceNumber).collect(Collectors.toList()); + final List asList2 = receive2.stream().map(EventData::getSequenceNumber).collect(Collectors.toList()); + + Assert.assertEquals(receiveNumber, asList.size()); + Assert.assertEquals(receiveNumber, asList2.size()); + + Collections.sort(asList); + Collections.sort(asList2); + + final Long[] first = asList.toArray(new Long[0]); + final Long[] second = asList2.toArray(new Long[0]); + + Assert.assertArrayEquals(first, second); + } finally { + dispose(consumer, producer); + } + } + + /** + * Verify that we can receive until the timeout multiple times. + */ + @Test + public void receiveUntilTimeoutMultipleTimes() { + // Arrange + final int numberOfEvents = 15; + final int numberOfEvents2 = 3; + final String partitionId = "1"; + final List events = TestUtils.getEventsAsList(numberOfEvents, TestUtils.MESSAGE_TRACKING_ID); + final List events2 = TestUtils.getEventsAsList(numberOfEvents2, TestUtils.MESSAGE_TRACKING_ID); + + final EventHubConsumer consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, partitionId, + EventPosition.fromEnqueuedTime(Instant.now())); + final EventHubProducer producer = client.createProducer(new EventHubProducerOptions().setPartitionId(partitionId)); + + try { + producer.send(events); + + // Act + final IterableStream receive = consumer.receive(100, Duration.ofSeconds(3)); + + producer.send(events2); + + final IterableStream receive2 = consumer.receive(100, Duration.ofSeconds(3)); + + // Assert + final List asList = receive.stream().collect(Collectors.toList()); + Assert.assertEquals(numberOfEvents, asList.size()); + + final List asList2 = receive2.stream().collect(Collectors.toList()); + Assert.assertEquals(numberOfEvents2, asList2.size()); + } finally { + dispose(consumer, producer); + } + } + + /** + * When we run this test, we check if there have been events already pushed to the partition, if not, we push some + * events there. + */ + private void setupEventTestData(EventHubClient client) { + if (HAS_PUSHED_EVENTS.getAndSet(true)) { + logger.info("Already pushed events to partition. Skipping."); + return; + } + + logger.info("Pushing events to partition. Message tracking value: {}", MESSAGE_TRACKING_VALUE); + + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().setPartitionId(PARTITION_ID); + final EventHubProducer producer = client.createProducer(producerOptions); + final Flux events = TestUtils.getEvents(NUMBER_OF_EVENTS, MESSAGE_TRACKING_VALUE); + + try { + // So we know what instant those messages were pushed to the service and can fetch them. + MESSAGES_PUSHED_INSTANT.set(Instant.now()); + producer.send(events.collectList().block()); + } finally { + dispose(producer); + } + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerTest.java new file mode 100644 index 000000000000..49f2a777685f --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerTest.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import com.azure.core.amqp.AmqpEndpointState; +import com.azure.core.amqp.AmqpShutdownSignal; +import com.azure.core.amqp.RetryOptions; +import com.azure.core.util.IterableStream; +import com.azure.messaging.eventhubs.implementation.AmqpReceiveLink; +import com.azure.messaging.eventhubs.models.EventHubConsumerOptions; +import org.apache.qpid.proton.message.Message; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import reactor.core.publisher.DirectProcessor; +import reactor.core.publisher.EmitterProcessor; +import reactor.core.publisher.FluxSink; +import reactor.core.publisher.Mono; +import reactor.core.scheduler.Schedulers; + +import java.io.IOException; +import java.time.Duration; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +import static com.azure.messaging.eventhubs.TestUtils.MESSAGE_POSITION_ID; +import static com.azure.messaging.eventhubs.TestUtils.getMessage; +import static java.nio.charset.StandardCharsets.UTF_8; +import static org.mockito.Mockito.when; + +public class EventHubConsumerTest { + private static final String PAYLOAD = "hello"; + private static final byte[] PAYLOAD_BYTES = PAYLOAD.getBytes(UTF_8); + private static final int PREFETCH = 5; + + private final String messageTrackingUUID = UUID.randomUUID().toString(); + private final EmitterProcessor messageProcessor = EmitterProcessor.create(100, false); + private final FluxSink sink = messageProcessor.sink(FluxSink.OverflowStrategy.BUFFER); + private final DirectProcessor errorProcessor = DirectProcessor.create(); + private final DirectProcessor endpointProcessor = DirectProcessor.create(); + private final DirectProcessor shutdownProcessor = DirectProcessor.create(); + + @Mock + private AmqpReceiveLink amqpReceiveLink; + + private EventHubConsumer consumer; + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + Mono receiveLinkMono = Mono.fromCallable(() -> amqpReceiveLink); + + when(amqpReceiveLink.receive()).thenReturn(messageProcessor); + when(amqpReceiveLink.getErrors()).thenReturn(errorProcessor); + when(amqpReceiveLink.getConnectionStates()).thenReturn(endpointProcessor); + when(amqpReceiveLink.getShutdownSignals()).thenReturn(shutdownProcessor); + + EventHubConsumerOptions options = new EventHubConsumerOptions() + .setIdentifier("an-identifier") + .setPrefetchCount(PREFETCH) + .setRetry(new RetryOptions()) + .setScheduler(Schedulers.elastic()); + EventHubAsyncConsumer asyncConsumer = new EventHubAsyncConsumer(receiveLinkMono, options); + consumer = new EventHubConsumer(asyncConsumer, options.getRetry().getTryTimeout()); + } + + @After + public void teardown() throws IOException { + Mockito.framework().clearInlineMocks(); + consumer.close(); + } + + /** + * Verifies that this receives a number of events. + */ + @Test + public void receivesNumberOfEvents() { + // Arrange + final int numberOfEvents = 10; + sendMessages(numberOfEvents); + final int numberToReceive = 3; + + // Act + final IterableStream receive = consumer.receive(numberToReceive); + + // Assert + final Map actual = receive.stream() + .collect(Collectors.toMap(e -> { + final String value = String.valueOf(e.getProperties().get(MESSAGE_POSITION_ID)); + return Integer.valueOf(value); + }, Function.identity())); + + Assert.assertEquals(numberToReceive, actual.size()); + + IntStream.range(0, numberToReceive).forEachOrdered(number -> { + Assert.assertTrue(actual.containsKey(number)); + }); + } + + /** + * Verifies that this receives a number of events. + */ + @Test + public void receivesMultipleTimes() { + // Arrange + final int numberOfEvents = 15; + final int firstReceive = 8; + final int secondReceive = 4; + + sendMessages(numberOfEvents); + + // Act + final IterableStream receive = consumer.receive(firstReceive); + final IterableStream receive2 = consumer.receive(secondReceive); + + // Assert + final Map firstActual = receive.stream() + .collect(Collectors.toMap(EventHubConsumerTest::getPositionId, Function.identity())); + final Map secondActual = receive2.stream() + .collect(Collectors.toMap(EventHubConsumerTest::getPositionId, Function.identity())); + + Assert.assertEquals(firstReceive, firstActual.size()); + Assert.assertEquals(secondReceive, secondActual.size()); + + int startingIndex = 0; + int endIndex = firstReceive; + IntStream.range(startingIndex, endIndex).forEachOrdered(number -> Assert.assertTrue(firstActual.containsKey(number))); + + startingIndex += firstReceive; + endIndex += secondReceive; + IntStream.range(startingIndex, endIndex).forEachOrdered(number -> Assert.assertTrue(secondActual.containsKey(number))); + } + + /** + * Verifies that this completes after 1 second and receives as many events as possible in that time. + */ + @Test + public void receivesReachesTimeout() { + // Arrange + final int numberOfEvents = 3; + final int firstReceive = 8; + final Duration timeout = Duration.ofSeconds(1); + + sendMessages(numberOfEvents); + + // Act + final IterableStream receive = consumer.receive(firstReceive, timeout); + + // Assert + final Map firstActual = receive.stream() + .collect(Collectors.toMap(EventHubConsumerTest::getPositionId, Function.identity())); + + Assert.assertEquals(numberOfEvents, firstActual.size()); + IntStream.range(0, numberOfEvents) + .forEachOrdered(number -> Assert.assertTrue(firstActual.containsKey(number))); + } + + private static Integer getPositionId(EventData event) { + final String value = String.valueOf(event.getProperties().get(MESSAGE_POSITION_ID)); + return Integer.valueOf(value); + } + + private void sendMessages(int numberOfEvents) { + for (int i = 0; i < numberOfEvents; i++) { + Map set = new HashMap<>(); + set.put(MESSAGE_POSITION_ID, Integer.valueOf(i).toString()); + sink.next(getMessage(PAYLOAD_BYTES, messageTrackingUUID, set)); + } + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerIntegrationTest.java new file mode 100644 index 000000000000..d0c3e5fc9772 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerIntegrationTest.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import com.azure.core.util.logging.ClientLogger; +import com.azure.messaging.eventhubs.implementation.IntegrationTestBase; +import com.azure.messaging.eventhubs.models.BatchOptions; +import com.azure.messaging.eventhubs.models.EventHubProducerOptions; +import org.junit.Assert; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; +import reactor.core.scheduler.Schedulers; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; + +import static java.nio.charset.StandardCharsets.UTF_8; + +public class EventHubProducerIntegrationTest extends IntegrationTestBase { + private static final String PARTITION_ID = "1"; + private EventHubClient client; + + public EventHubProducerIntegrationTest() { + super(new ClientLogger(EventHubProducerIntegrationTest.class)); + } + + @Rule + public TestName testName = new TestName(); + + @Override + protected String getTestName() { + return testName.getMethodName(); + } + + @Override + protected void beforeTest() { + client = new EventHubClientBuilder() + .connectionString(getConnectionString()) + .retry(RETRY_OPTIONS) + .scheduler(Schedulers.parallel()) + .buildClient(); + } + + @Override + protected void afterTest() { + dispose(client); + } + + /** + * Verifies that we can create and send a message to an Event Hub partition. + */ + @Test + public void sendMessageToPartition() throws IOException { + // Arrange + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().setPartitionId(PARTITION_ID); + final List events = Arrays.asList( + new EventData("Event 1".getBytes(UTF_8)), + new EventData("Event 2".getBytes(UTF_8)), + new EventData("Event 3".getBytes(UTF_8))); + + // Act & Assert + try (EventHubProducer producer = client.createProducer(producerOptions)) { + producer.send(events); + } + } + + /** + * Verifies that we can create an {@link EventHubProducer} that does not care about partitions and lets the service + * distribute the events. + */ + @Test + public void sendMessage() throws IOException { + // Arrange + final List events = Arrays.asList( + new EventData("Event 1".getBytes(UTF_8)), + new EventData("Event 2".getBytes(UTF_8)), + new EventData("Event 3".getBytes(UTF_8))); + + // Act & Assert + try (EventHubProducer producer = client.createProducer()) { + producer.send(events); + } + } + + /** + * Verifies we can create an {@link EventDataBatch} and send it using our EventHubProducer. + */ + @Test + public void sendBatch() throws IOException { + // Arrange + final List events = Arrays.asList( + new EventData("Event 1".getBytes(UTF_8)), + new EventData("Event 2".getBytes(UTF_8)), + new EventData("Event 3".getBytes(UTF_8))); + + // Act & Assert + try (EventHubProducer producer = client.createProducer()) { + EventDataBatch batch = producer.createBatch(); + events.forEach(event -> { + Assert.assertTrue(batch.tryAdd(event)); + }); + + producer.send(batch); + } + } + + /** + * Verifies we can create an {@link EventDataBatch} with a partition key and send it using our EventHubProducer. + */ + @Test + public void sendBatchWithPartitionKey() throws IOException { + // Arrange + final List events = Arrays.asList( + new EventData("Event 1".getBytes(UTF_8)), + new EventData("Event 2".getBytes(UTF_8)), + new EventData("Event 3".getBytes(UTF_8))); + + // Act & Assert + try (EventHubProducer producer = client.createProducer()) { + final BatchOptions options = new BatchOptions().setPartitionKey("my-partition-key"); + final EventDataBatch batch = producer.createBatch(options); + + events.forEach(event -> { + Assert.assertTrue(batch.tryAdd(event)); + }); + + producer.send(batch); + } + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerTest.java new file mode 100644 index 000000000000..16fa18a7ec27 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerTest.java @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import com.azure.core.amqp.RetryOptions; +import com.azure.core.amqp.exception.AmqpException; +import com.azure.core.amqp.exception.ErrorCondition; +import com.azure.core.amqp.exception.ErrorContext; +import com.azure.core.amqp.implementation.TracerProvider; +import com.azure.core.implementation.tracing.ProcessKind; +import com.azure.core.implementation.tracing.Tracer; +import com.azure.core.util.Context; +import com.azure.messaging.eventhubs.implementation.AmqpSendLink; +import com.azure.messaging.eventhubs.models.BatchOptions; +import com.azure.messaging.eventhubs.models.EventHubProducerOptions; +import com.azure.messaging.eventhubs.models.SendOptions; +import org.apache.qpid.proton.amqp.messaging.Section; +import org.apache.qpid.proton.message.Message; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.time.Duration; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import static com.azure.core.implementation.tracing.Tracer.DIAGNOSTIC_ID_KEY; +import static com.azure.core.implementation.tracing.Tracer.OPENTELEMETRY_SPAN_KEY; +import static com.azure.core.implementation.tracing.Tracer.SPAN_CONTEXT; +import static java.nio.charset.StandardCharsets.UTF_8; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyList; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static org.mockito.Mockito.never; + +/** + * Unit tests to verify functionality of {@link EventHubProducer}. + */ +public class EventHubProducerTest { + @Mock + private AmqpSendLink sendLink; + @Captor + private ArgumentCaptor singleMessageCaptor; + @Captor + private ArgumentCaptor> messagesCaptor; + + private EventHubAsyncProducer asyncProducer; + private RetryOptions retryOptions = new RetryOptions().setTryTimeout(Duration.ofSeconds(30)); + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + when(sendLink.getLinkSize()).thenReturn(Mono.just(EventHubAsyncProducer.MAX_MESSAGE_LENGTH_BYTES)); + when(sendLink.getErrorContext()).thenReturn(new ErrorContext("test-namespace")); + when(sendLink.send(anyList())).thenReturn(Mono.empty()); + when(sendLink.send(any(Message.class))).thenReturn(Mono.empty()); + final TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + + asyncProducer = new EventHubAsyncProducer( + Mono.fromCallable(() -> sendLink), + new EventHubProducerOptions().setRetry(retryOptions), tracerProvider); + } + + @After + public void teardown() { + Mockito.framework().clearInlineMocks(); + sendLink = null; + singleMessageCaptor = null; + messagesCaptor = null; + } + + /** + * Verifies can send a single message. + */ + @Test + public void sendSingleMessage() { + // Arrange + final EventHubProducer producer = new EventHubProducer(asyncProducer, retryOptions.getTryTimeout()); + final EventData eventData = new EventData("hello-world".getBytes(UTF_8)); + + // Act + producer.send(eventData); + + // Assert + verify(sendLink, times(1)).send(any(Message.class)); + verify(sendLink).send(singleMessageCaptor.capture()); + + final Message message = singleMessageCaptor.getValue(); + Assert.assertEquals(Section.SectionType.Data, message.getBody().getType()); + } + + /** + *Verifies start and end span invoked when sending a single message. + */ + @Test + public void sendStartSpanSingleMessage() { + //Arrange + final Tracer tracer1 = mock(Tracer.class); + final List tracers = Arrays.asList(tracer1); + TracerProvider tracerProvider = new TracerProvider(tracers); + + EventHubAsyncProducer asyncProducer = new EventHubAsyncProducer( + Mono.fromCallable(() -> sendLink), + new EventHubProducerOptions().setRetry(retryOptions), tracerProvider); + final EventHubProducer producer = new EventHubProducer(asyncProducer, retryOptions.getTryTimeout()); + final EventData eventData = new EventData("hello-world".getBytes(UTF_8)); + + when(tracer1.start(eq("Azure.eventhubs.send"), any(), eq(ProcessKind.SEND))).thenAnswer( + invocation -> { + Context passed = invocation.getArgument(1, Context.class); + return passed.addData(OPENTELEMETRY_SPAN_KEY, "value"); + } + ); + + when(tracer1.start(eq("Azure.eventhubs.message"), any(), eq(ProcessKind.RECEIVE))).thenAnswer( + invocation -> { + Context passed = invocation.getArgument(1, Context.class); + return passed.addData(OPENTELEMETRY_SPAN_KEY, "value").addData(DIAGNOSTIC_ID_KEY, "value2"); + } + ); + //Act + producer.send(eventData); + + //Assert + verify(tracer1, times(1)).start(eq("Azure.eventhubs.send"), any(), eq(ProcessKind.SEND)); + verify(tracer1, times(1)).start(eq("Azure.eventhubs.message"), any(), eq(ProcessKind.RECEIVE)); + verify(tracer1, times(2)).end(eq("success"), isNull(), any()); + } + + /** + *Verifies start and end span invoked when linking a single message on retry. + */ + @Test + public void sendMessageAddlink() { + //Arrange + final Tracer tracer1 = mock(Tracer.class); + final List tracers = Arrays.asList(tracer1); + TracerProvider tracerProvider = new TracerProvider(tracers); + + EventHubAsyncProducer asyncProducer = new EventHubAsyncProducer( + Mono.fromCallable(() -> sendLink), + new EventHubProducerOptions().setRetry(retryOptions), tracerProvider); + final EventHubProducer producer = new EventHubProducer(asyncProducer, retryOptions.getTryTimeout()); + final EventData eventData = new EventData("hello-world".getBytes(UTF_8), new Context(SPAN_CONTEXT, Context.NONE)); + + when(tracer1.start(eq("Azure.eventhubs.send"), any(), eq(ProcessKind.SEND))).thenAnswer( + invocation -> { + Context passed = invocation.getArgument(1, Context.class); + return passed.addData(OPENTELEMETRY_SPAN_KEY, "value"); + } + ); + + //Act + producer.send(eventData); + + //Assert + verify(tracer1, times(1)).start(eq("Azure.eventhubs.send"), any(), eq(ProcessKind.SEND)); + verify(tracer1, never()).start(eq("Azure.eventhubs.message"), any(), eq(ProcessKind.RECEIVE)); + verify(tracer1, times(1)).addLink(any()); + verify(tracer1, times(1)).end(eq("success"), isNull(), any()); + } + + /** + * Verifies we can send multiple messages. + */ + @Test + public void sendMultipleMessages() { + // Arrange + final int count = 4; + final Iterable events = Flux.range(0, count).map(number -> { + final String contents = "event-data-" + number; + return new EventData(contents.getBytes(UTF_8)); + }).toIterable(); + + final SendOptions options = new SendOptions(); + + final EventHubProducer producer = new EventHubProducer(asyncProducer, retryOptions.getTryTimeout()); + + // Act + producer.send(events, options); + + // Assert + verify(sendLink).send(messagesCaptor.capture()); + + final List messagesSent = messagesCaptor.getValue(); + Assert.assertEquals(count, messagesSent.size()); + + messagesSent.forEach(message -> Assert.assertEquals(Section.SectionType.Data, message.getBody().getType())); + } + + /** + * Verifies that the producer can create an {@link EventDataBatch} with the size given by the underlying AMQP send + * link. + */ + @Test + public void createsEventDataBatch() { + // Arrange + int maxLinkSize = 1024; + + // Overhead when serializing an event, to figure out what the maximum size we can use for an event payload. + int eventOverhead = 24; + int maxEventPayload = maxLinkSize - eventOverhead; + + final AmqpSendLink link = mock(AmqpSendLink.class); + when(link.getLinkSize()).thenReturn(Mono.just(maxLinkSize)); + + // This event is 1024 bytes when serialized. + final EventData event = new EventData(new byte[maxEventPayload]); + + // This event will be 1025 bytes when serialized. + final EventData tooLargeEvent = new EventData(new byte[maxEventPayload + 1]); + + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().setRetry(retryOptions); + final TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + + final EventHubAsyncProducer hubAsyncProducer = new EventHubAsyncProducer(Mono.fromCallable(() -> link), producerOptions, tracerProvider); + final EventHubProducer hubProducer = new EventHubProducer(hubAsyncProducer, retryOptions.getTryTimeout()); + + // Act + final EventDataBatch batch = hubProducer.createBatch(); + + // Assert + Assert.assertNull(batch.getPartitionKey()); + Assert.assertFalse(batch.tryAdd(tooLargeEvent)); + Assert.assertTrue(batch.tryAdd(event)); + + verify(link, times(1)).getLinkSize(); + } + + /** + * Verifies we can create an EventDataBatch with partition key and link size. + */ + @Test + public void createsEventDataBatchWithPartitionKey() { + // Arrange + int maxBatchSize = 1024; + + // Overhead when serializing an event, to figure out what the maximum size we can use for an event payload. + int eventOverhead = 98; + int maxEventPayload = maxBatchSize - eventOverhead; + + // This event is 1024 bytes when serialized. + final EventData event = new EventData(new byte[maxEventPayload]); + + // No idea what the overhead for adding partition key is. But we know this will be smaller than the max size. + final BatchOptions options = new BatchOptions() + .setPartitionKey("some-key") + .setMaximumSizeInBytes(maxBatchSize); + final EventHubProducer producer = new EventHubProducer(asyncProducer, retryOptions.getTryTimeout()); + + // Act + final EventDataBatch batch = producer.createBatch(options); + + // Arrange + Assert.assertEquals(options.getPartitionKey(), batch.getPartitionKey()); + Assert.assertTrue(batch.tryAdd(event)); + } + + /** + * Verifies we can create an EventDataBatch with partition key and link size. + */ + @Test + public void payloadTooLarge() { + // Arrange + int maxBatchSize = 1024; + + // Overhead when serializing an event, to figure out what the maximum size we can use for an event payload. + int eventOverhead = 24; + int maxEventPayload = maxBatchSize - eventOverhead; + + // This event is 1025 bytes when serialized. + final EventData event = new EventData(new byte[maxEventPayload + 1]); + + // No idea what the overhead for adding partition key is. But we know this will be smaller than the max size. + final BatchOptions options = new BatchOptions() + .setMaximumSizeInBytes(maxBatchSize); + final EventHubProducer producer = new EventHubProducer(asyncProducer, retryOptions.getTryTimeout()); + final EventDataBatch batch = producer.createBatch(options); + + // Act & Assert + try { + batch.tryAdd(event); + } catch (AmqpException e) { + Assert.assertEquals(ErrorCondition.LINK_PAYLOAD_SIZE_EXCEEDED, e.getErrorCondition()); + } + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubPropertiesTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubPropertiesTest.java index 05e2412bf137..2d51c0be2614 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubPropertiesTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubPropertiesTest.java @@ -26,18 +26,18 @@ public void setsProperties() { final EventHubProperties eventHubProperties = new EventHubProperties(name, instant, partitionIds); // Assert - Assert.assertEquals(name, eventHubProperties.name()); - Assert.assertEquals(instant, eventHubProperties.createdAt()); - Assert.assertEquals(partitionIds.length, eventHubProperties.partitionIds().length); + Assert.assertEquals(name, eventHubProperties.getName()); + Assert.assertEquals(instant, eventHubProperties.getCreatedAt()); + Assert.assertEquals(partitionIds.length, eventHubProperties.getPartitionIds().length); - final Set actual = new HashSet<>(Arrays.asList(eventHubProperties.partitionIds())); + final Set actual = new HashSet<>(Arrays.asList(eventHubProperties.getPartitionIds())); for (String id : partitionIds) { Assert.assertTrue(actual.contains(id)); } } /** - * Verifies that the {@link EventHubProperties#partitionIds()} array is not {@code null} when we pass {@code null} + * Verifies that the {@link EventHubProperties#getPartitionIds()} array is not {@code null} when we pass {@code null} * to the constructor. */ @Test @@ -50,9 +50,9 @@ public void setsPropertiesNoPartitions() { final EventHubProperties eventHubProperties = new EventHubProperties(name, instant, null); // Assert - Assert.assertEquals(name, eventHubProperties.name()); - Assert.assertEquals(instant, eventHubProperties.createdAt()); - Assert.assertNotNull(eventHubProperties.partitionIds()); - Assert.assertEquals(0, eventHubProperties.partitionIds().length); + Assert.assertEquals(name, eventHubProperties.getName()); + Assert.assertEquals(instant, eventHubProperties.getCreatedAt()); + Assert.assertNotNull(eventHubProperties.getPartitionIds()); + Assert.assertEquals(0, eventHubProperties.getPartitionIds().length); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubSharedAccessKeyCredentialTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubSharedAccessKeyCredentialTest.java index 095b3a4cb034..d97b2a783c6f 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubSharedAccessKeyCredentialTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubSharedAccessKeyCredentialTest.java @@ -29,16 +29,26 @@ public void constructorNullDuration() throws InvalidKeyException, NoSuchAlgorith new EventHubSharedAccessKeyCredential(KEY_NAME, KEY_VALUE, null); } - @Test(expected = IllegalArgumentException.class) + @Test(expected = NullPointerException.class) public void constructorNullKey() throws InvalidKeyException, NoSuchAlgorithmException { new EventHubSharedAccessKeyCredential(null, KEY_VALUE, TOKEN_DURATION); } @Test(expected = IllegalArgumentException.class) + public void constructorEmptyKey() throws InvalidKeyException, NoSuchAlgorithmException { + new EventHubSharedAccessKeyCredential("", KEY_VALUE, TOKEN_DURATION); + } + + @Test(expected = NullPointerException.class) public void constructorNullValue() throws InvalidKeyException, NoSuchAlgorithmException { new EventHubSharedAccessKeyCredential(KEY_NAME, null, TOKEN_DURATION); } + @Test(expected = IllegalArgumentException.class) + public void constructorEmptyValue() throws InvalidKeyException, NoSuchAlgorithmException { + new EventHubSharedAccessKeyCredential(KEY_NAME, "", TOKEN_DURATION); + } + @Test public void constructsToken() throws InvalidKeyException, NoSuchAlgorithmException, UnsupportedEncodingException { // Arrange @@ -59,9 +69,9 @@ public void constructsToken() throws InvalidKeyException, NoSuchAlgorithmExcepti Assert.assertNotNull(accessToken); Assert.assertFalse(accessToken.isExpired()); - Assert.assertTrue(accessToken.expiresOn().isAfter(OffsetDateTime.now(ZoneOffset.UTC))); + Assert.assertTrue(accessToken.getExpiresOn().isAfter(OffsetDateTime.now(ZoneOffset.UTC))); - final String[] split = accessToken.token().split(" "); + final String[] split = accessToken.getToken().split(" "); Assert.assertEquals(2, split.length); Assert.assertEquals("SharedAccessSignature", split[0].trim()); @@ -76,7 +86,7 @@ public void constructsToken() throws InvalidKeyException, NoSuchAlgorithmExcepti // These are the values that are random, but we expect the expiration to be after this date. if (signatureExpires.equals(key)) { - final Instant instant = Instant.ofEpochSecond(Long.valueOf(value)); + final Instant instant = Instant.ofEpochSecond(Long.parseLong(value)); Assert.assertTrue(instant.isAfter(Instant.now())); } else if (expectedValue == null) { Assert.assertNotNull(value); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventPositionIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventPositionIntegrationTest.java index 1fb0d8135639..e2fb94ed1368 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventPositionIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventPositionIntegrationTest.java @@ -3,8 +3,9 @@ package com.azure.messaging.eventhubs; +import com.azure.core.amqp.implementation.TracerProvider; import com.azure.core.util.logging.ClientLogger; -import com.azure.messaging.eventhubs.implementation.ApiTestBase; +import com.azure.messaging.eventhubs.implementation.IntegrationTestBase; import com.azure.messaging.eventhubs.implementation.ReactorHandlerProvider; import com.azure.messaging.eventhubs.models.EventHubProducerOptions; import com.azure.messaging.eventhubs.models.EventPosition; @@ -35,7 +36,7 @@ /** * Tests that {@link EventHubAsyncConsumer} can be created with various {@link EventPosition EventPositions}. */ -public class EventPositionIntegrationTest extends ApiTestBase { +public class EventPositionIntegrationTest extends IntegrationTestBase { private static final String PARTITION_ID = "0"; private static final int NUMBER_OF_EVENTS = 10; @@ -56,16 +57,16 @@ public EventPositionIntegrationTest() { public TestName testName = new TestName(); @Override - protected String testName() { + protected String getTestName() { return testName.getMethodName(); } @Override protected void beforeTest() { - skipIfNotRecordMode(); - final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(getReactorProvider()); - client = new EventHubAsyncClient(getConnectionOptions(), getReactorProvider(), handlerProvider); + final TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + + client = new EventHubAsyncClient(getConnectionOptions(), getReactorProvider(), handlerProvider, tracerProvider); setupEventTestData(client); } @@ -109,11 +110,11 @@ public void receiveEarliestMessages() { for (int i = 0; i < NUMBER_OF_EVENTS; i++) { final EventData event = earliestEvents.get(i); final EventData event2 = enqueuedEvents.get(i); - final String eventBody = UTF_8.decode(event.body()).toString(); - final String event2Body = UTF_8.decode(event2.body()).toString(); + final String eventBody = UTF_8.decode(event.getBody()).toString(); + final String event2Body = UTF_8.decode(event2.getBody()).toString(); - Assert.assertEquals(event.sequenceNumber(), event2.sequenceNumber()); - Assert.assertEquals(event.offset(), event2.offset()); + Assert.assertEquals(event.getSequenceNumber(), event2.getSequenceNumber()); + Assert.assertEquals(event.getOffset(), event2.getOffset()); Assert.assertEquals(eventBody, event2Body); } } @@ -145,7 +146,7 @@ public void receiveLatestMessages() throws InterruptedException { // Arrange final String messageValue = UUID.randomUUID().toString(); final EventHubAsyncConsumer consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, EventPosition.latest()); - final EventHubProducerOptions options = new EventHubProducerOptions().partitionId(PARTITION_ID); + final EventHubProducerOptions options = new EventHubProducerOptions().setPartitionId(PARTITION_ID); final EventHubAsyncProducer producer = client.createProducer(options); final Flux events = Flux.range(0, NUMBER_OF_EVENTS).map(number -> { final EventData eventData = new EventData(("Event " + number).getBytes(UTF_8)); @@ -186,9 +187,9 @@ public void receiveMessageFromEnqueuedTime() { StepVerifier.create(consumer.receive() .take(1)) .assertNext(event -> { - Assert.assertEquals(expectedEvent.enqueuedTime(), event.enqueuedTime()); - Assert.assertEquals(expectedEvent.sequenceNumber(), event.sequenceNumber()); - Assert.assertEquals(expectedEvent.offset(), event.offset()); + Assert.assertEquals(expectedEvent.getEnqueuedTime(), event.getEnqueuedTime()); + Assert.assertEquals(expectedEvent.getSequenceNumber(), event.getSequenceNumber()); + Assert.assertEquals(expectedEvent.getOffset(), event.getOffset()); }).verifyComplete(); } finally { dispose(consumer); @@ -204,7 +205,7 @@ public void receiveMessageFromEnqueuedTimeReceivedMessage() { // Arrange final EventData[] events = EVENTS_PUSHED.get(); final EventData secondEvent = events[1]; - final EventPosition position = EventPosition.fromEnqueuedTime(secondEvent.enqueuedTime()); + final EventPosition position = EventPosition.fromEnqueuedTime(secondEvent.getEnqueuedTime()); final EventData expectedEvent = events[2]; final EventHubAsyncConsumer consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, position); @@ -213,9 +214,9 @@ public void receiveMessageFromEnqueuedTimeReceivedMessage() { StepVerifier.create(consumer.receive() .take(1)) .assertNext(event -> { - Assert.assertEquals(expectedEvent.enqueuedTime(), event.enqueuedTime()); - Assert.assertEquals(expectedEvent.sequenceNumber(), event.sequenceNumber()); - Assert.assertEquals(expectedEvent.offset(), event.offset()); + Assert.assertEquals(expectedEvent.getEnqueuedTime(), event.getEnqueuedTime()); + Assert.assertEquals(expectedEvent.getSequenceNumber(), event.getSequenceNumber()); + Assert.assertEquals(expectedEvent.getOffset(), event.getOffset()); }).verifyComplete(); } finally { dispose(consumer); @@ -231,7 +232,7 @@ public void receiveMessageFromOffsetInclusive() { // Arrange final EventData[] events = EVENTS_PUSHED.get(); final EventData expectedEvent = events[4]; - final EventPosition position = EventPosition.fromOffset(expectedEvent.offset()); + final EventPosition position = EventPosition.fromOffset(expectedEvent.getOffset()); final EventHubAsyncConsumer consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, position); // Act & Assert @@ -240,9 +241,9 @@ public void receiveMessageFromOffsetInclusive() { .filter(event -> isMatchingEvent(event, MESSAGE_TRACKING_VALUE)) .take(1)) .assertNext(event -> { - Assert.assertEquals(expectedEvent.enqueuedTime(), event.enqueuedTime()); - Assert.assertEquals(expectedEvent.sequenceNumber(), event.sequenceNumber()); - Assert.assertEquals(expectedEvent.offset(), event.offset()); + Assert.assertEquals(expectedEvent.getEnqueuedTime(), event.getEnqueuedTime()); + Assert.assertEquals(expectedEvent.getSequenceNumber(), event.getSequenceNumber()); + Assert.assertEquals(expectedEvent.getOffset(), event.getOffset()); }).verifyComplete(); } finally { dispose(consumer); @@ -257,7 +258,7 @@ public void receiveMessageFromOffsetNonInclusive() { // Arrange final EventData[] events = EVENTS_PUSHED.get(); final EventData expectedEvent = events[4]; - final EventPosition position = EventPosition.fromOffset(events[3].offset(), false); + final EventPosition position = EventPosition.fromOffset(events[3].getOffset(), false); final EventHubAsyncConsumer consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, position); // Act & Assert @@ -266,9 +267,9 @@ public void receiveMessageFromOffsetNonInclusive() { .filter(event -> isMatchingEvent(event, MESSAGE_TRACKING_VALUE)) .take(1)) .assertNext(event -> { - Assert.assertEquals(expectedEvent.enqueuedTime(), event.enqueuedTime()); - Assert.assertEquals(expectedEvent.sequenceNumber(), event.sequenceNumber()); - Assert.assertEquals(expectedEvent.offset(), event.offset()); + Assert.assertEquals(expectedEvent.getEnqueuedTime(), event.getEnqueuedTime()); + Assert.assertEquals(expectedEvent.getSequenceNumber(), event.getSequenceNumber()); + Assert.assertEquals(expectedEvent.getOffset(), event.getOffset()); }).verifyComplete(); } finally { dispose(consumer); @@ -283,7 +284,7 @@ public void receiveMessageFromSequenceNumberInclusive() { // Arrange final EventData[] events = EVENTS_PUSHED.get(); final EventData expectedEvent = events[3]; - final EventPosition position = EventPosition.fromSequenceNumber(expectedEvent.sequenceNumber(), true); + final EventPosition position = EventPosition.fromSequenceNumber(expectedEvent.getSequenceNumber(), true); final EventHubAsyncConsumer consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, position); // Act & Assert @@ -292,9 +293,9 @@ public void receiveMessageFromSequenceNumberInclusive() { .filter(event -> isMatchingEvent(event, MESSAGE_TRACKING_VALUE)) .take(1)) .assertNext(event -> { - Assert.assertEquals(expectedEvent.enqueuedTime(), event.enqueuedTime()); - Assert.assertEquals(expectedEvent.sequenceNumber(), event.sequenceNumber()); - Assert.assertEquals(expectedEvent.offset(), event.offset()); + Assert.assertEquals(expectedEvent.getEnqueuedTime(), event.getEnqueuedTime()); + Assert.assertEquals(expectedEvent.getSequenceNumber(), event.getSequenceNumber()); + Assert.assertEquals(expectedEvent.getOffset(), event.getOffset()); }).verifyComplete(); } finally { dispose(consumer); @@ -309,7 +310,7 @@ public void receiveMessageFromSequenceNumberNonInclusive() { // Arrange final EventData[] events = EVENTS_PUSHED.get(); final EventData expectedEvent = events[4]; - final EventPosition position = EventPosition.fromSequenceNumber(events[3].sequenceNumber()); + final EventPosition position = EventPosition.fromSequenceNumber(events[3].getSequenceNumber()); final EventHubAsyncConsumer consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, position); // Act & Assert @@ -318,9 +319,9 @@ public void receiveMessageFromSequenceNumberNonInclusive() { .filter(event -> isMatchingEvent(event, MESSAGE_TRACKING_VALUE)) .take(1)) .assertNext(event -> { - Assert.assertEquals(expectedEvent.enqueuedTime(), event.enqueuedTime()); - Assert.assertEquals(expectedEvent.sequenceNumber(), event.sequenceNumber()); - Assert.assertEquals(expectedEvent.offset(), event.offset()); + Assert.assertEquals(expectedEvent.getEnqueuedTime(), event.getEnqueuedTime()); + Assert.assertEquals(expectedEvent.getSequenceNumber(), event.getSequenceNumber()); + Assert.assertEquals(expectedEvent.getOffset(), event.getOffset()); }).verifyComplete(); } finally { dispose(consumer); @@ -339,7 +340,7 @@ private void setupEventTestData(EventHubAsyncClient client) { logger.info("Pushing events to partition. Message tracking value: {}", MESSAGE_TRACKING_VALUE); - final EventHubProducerOptions producerOptions = new EventHubProducerOptions().partitionId(PARTITION_ID); + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().setPartitionId(PARTITION_ID); final EventHubAsyncProducer producer = client.createProducer(producerOptions); final Flux events = TestUtils.getEvents(NUMBER_OF_EVENTS, MESSAGE_TRACKING_VALUE); diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventProcessorBuilderTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventProcessorBuilderTest.java new file mode 100644 index 000000000000..ce72fb83fd75 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventProcessorBuilderTest.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import static org.junit.Assert.assertNotNull; + +import com.azure.messaging.eventhubs.implementation.ClientConstants; +import com.azure.messaging.eventhubs.models.PartitionContext; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Locale; +import org.junit.Test; +import reactor.core.publisher.Mono; + +/** + * Unit tests for {@link EventProcessorBuilder}. + */ +public class EventProcessorBuilderTest { + + private static final String NAMESPACE_NAME = "dummyNamespaceName"; + private static final String DEFAULT_DOMAIN_NAME = "servicebus.windows.net/"; + + private static final String EVENT_HUB_NAME = "eventHubName"; + private static final String SHARED_ACCESS_KEY_NAME = "dummySasKeyName"; + private static final String SHARED_ACCESS_KEY = "dummySasKey"; + private static final String ENDPOINT = getURI(ClientConstants.ENDPOINT_FORMAT, NAMESPACE_NAME, DEFAULT_DOMAIN_NAME) + .toString(); + + private static final String CORRECT_CONNECTION_STRING = String + .format("Endpoint=%s;SharedAccessKeyName=%s;SharedAccessKey=%s;EntityPath=%s", + ENDPOINT, SHARED_ACCESS_KEY_NAME, SHARED_ACCESS_KEY, EVENT_HUB_NAME); + + private static URI getURI(String endpointFormat, String namespace, String domainName) { + try { + return new URI(String.format(Locale.US, endpointFormat, namespace, domainName)); + } catch (URISyntaxException exception) { + throw new IllegalArgumentException(String.format(Locale.US, + "Invalid namespace name: %s", namespace), exception); + } + } + + @Test(expected = NullPointerException.class) + public void testEventProcessorBuilderMissingProperties() { + EventProcessor eventProcessor = new EventProcessorBuilder() + .partitionProcessorFactory((() -> new PartitionProcessor() { + @Override + public Mono processEvent(PartitionContext partitionContext, EventData eventData) { + return Mono.fromRunnable(() -> System.out.println(eventData.getSequenceNumber())); + } + })) + .buildEventProcessor(); + } + + @Test + public void testEventProcessorBuilderWithFactory() { + EventHubAsyncClient eventHubAsyncClient = new EventHubClientBuilder() + .connectionString(CORRECT_CONNECTION_STRING) + .buildAsyncClient(); + + EventProcessor eventProcessor = new EventProcessorBuilder() + .consumerGroup("consumer-group") + .eventHubClient(eventHubAsyncClient) + .partitionProcessorFactory((() -> new PartitionProcessor() { + @Override + public Mono processEvent(PartitionContext partitionContext, EventData eventData) { + return Mono.fromRunnable(() -> System.out.println(eventData.getSequenceNumber())); + } + })) + .partitionManager(new InMemoryPartitionManager()) + .buildEventProcessor(); + assertNotNull(eventProcessor); + } + +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventProcessorTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventProcessorTest.java index da84e5c80464..599ce00d0571 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventProcessorTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventProcessorTest.java @@ -3,25 +3,45 @@ package com.azure.messaging.eventhubs; +import static com.azure.core.implementation.tracing.Tracer.DIAGNOSTIC_ID_KEY; +import static com.azure.core.implementation.tracing.Tracer.OPENTELEMETRY_SPAN_KEY; +import static com.azure.core.implementation.tracing.Tracer.SPAN_CONTEXT; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.atLeast; import static org.mockito.Mockito.atLeastOnce; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import com.azure.core.amqp.implementation.TracerProvider; +import com.azure.core.implementation.tracing.ProcessKind; +import com.azure.core.implementation.tracing.Tracer; +import com.azure.core.util.Context; import com.azure.messaging.eventhubs.models.EventHubConsumerOptions; import com.azure.messaging.eventhubs.models.EventPosition; import com.azure.messaging.eventhubs.models.PartitionContext; +import java.io.Closeable; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import org.junit.After; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; +import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -46,6 +66,22 @@ public void setup() { MockitoAnnotations.initMocks(this); } + @After + public void teardown() { + consumer1 = null; + consumer2 = null; + consumer3 = null; + eventData1 = null; + eventData2 = null; + eventData3 = null; + eventData4 = null; + eventHubAsyncClient = null; + + // Tear down any inline mocks to avoid memory leaks. + // https://github.com/mockito/mockito/wiki/What's-new-in-Mockito-2#mockito-2250 + Mockito.framework().clearInlineMocks(); + } + /** * Tests all the happy cases for {@link EventProcessor}. * @@ -54,57 +90,51 @@ public void setup() { @Test public void testWithSimplePartitionProcessor() throws Exception { // Arrange + when(eventHubAsyncClient.getEventHubName()).thenReturn("test-eh"); when(eventHubAsyncClient.getPartitionIds()).thenReturn(Flux.just("1")); when(eventHubAsyncClient .createConsumer(anyString(), anyString(), any(EventPosition.class), any(EventHubConsumerOptions.class))) .thenReturn(consumer1); when(consumer1.receive()).thenReturn(Flux.just(eventData1, eventData2)); - when(eventData1.sequenceNumber()).thenReturn(1L); - when(eventData2.sequenceNumber()).thenReturn(2L); - when(eventData1.offset()).thenReturn("1"); - when(eventData2.offset()).thenReturn("100"); + when(eventData1.getSequenceNumber()).thenReturn(1L); + when(eventData2.getSequenceNumber()).thenReturn(2L); + when(eventData1.getOffset()).thenReturn(1L); + when(eventData2.getOffset()).thenReturn(100L); - final TestPartitionProcessor testPartitionProcessor = new TestPartitionProcessor(); final InMemoryPartitionManager partitionManager = new InMemoryPartitionManager(); + final TestPartitionProcessor testPartitionProcessor = new TestPartitionProcessor(); final long beforeTest = System.currentTimeMillis(); // Act - final EventProcessor eventProcessor = new EventProcessor(eventHubAsyncClient, - "test-consumer", - (partitionContext, checkpointManager) -> { - testPartitionProcessor.checkpointManager = checkpointManager; - testPartitionProcessor.partitionContext = partitionContext; - return testPartitionProcessor; - }, EventPosition.latest(), partitionManager, "test-eh"); + final EventProcessor eventProcessor = new EventProcessorBuilder() + .eventHubClient(eventHubAsyncClient) + .consumerGroup("test-consumer") + .partitionProcessorFactory(() -> testPartitionProcessor) + .partitionManager(partitionManager) + .buildEventProcessor(); + eventProcessor.start(); - Thread.sleep(TimeUnit.SECONDS.toMillis(2)); + TimeUnit.SECONDS.sleep(10); eventProcessor.stop(); // Assert - assertNotNull(eventProcessor.identifier()); - - assertNotNull(testPartitionProcessor.partitionContext); - assertNotNull(testPartitionProcessor.checkpointManager); - - assertEquals("1", testPartitionProcessor.partitionContext.partitionId()); - assertEquals("test-eh", testPartitionProcessor.partitionContext.eventHubName()); - assertEquals("test-consumer", testPartitionProcessor.partitionContext.consumerGroupName()); + assertNotNull(eventProcessor.getIdentifier()); StepVerifier.create(partitionManager.listOwnership("test-eh", "test-consumer")) .expectNextCount(1).verifyComplete(); StepVerifier.create(partitionManager.listOwnership("test-eh", "test-consumer")) .assertNext(partitionOwnership -> { - assertEquals("Partition", "1", partitionOwnership.partitionId()); - assertEquals("Consumer", "test-consumer", partitionOwnership.consumerGroupName()); - assertEquals("EventHub name", "test-eh", partitionOwnership.eventHubName()); - assertEquals("Sequence number", 2, (long) partitionOwnership.sequenceNumber()); - assertEquals("Offset", "100", partitionOwnership.offset()); - assertEquals("OwnerId", eventProcessor.identifier(), partitionOwnership.ownerId()); - assertTrue("LastModifiedTime", partitionOwnership.lastModifiedTime() >= beforeTest); - assertTrue("LastModifiedTime", partitionOwnership.lastModifiedTime() <= System.currentTimeMillis()); - assertNotNull(partitionOwnership.eTag()); + assertEquals("Partition", "1", partitionOwnership.getPartitionId()); + assertEquals("Consumer", "test-consumer", partitionOwnership.getConsumerGroupName()); + assertEquals("EventHub name", "test-eh", partitionOwnership.getEventHubName()); + assertEquals("Sequence number", 2, (long) partitionOwnership.getSequenceNumber()); + assertEquals("Offset", Long.valueOf(100), partitionOwnership.getOffset()); + assertEquals("OwnerId", eventProcessor.getIdentifier(), partitionOwnership.getOwnerId()); + assertTrue("LastModifiedTime", partitionOwnership.getLastModifiedTime() >= beforeTest); + assertTrue("LastModifiedTime", partitionOwnership.getLastModifiedTime() <= System.currentTimeMillis()); + assertNotNull(partitionOwnership.getETag()); }).verifyComplete(); verify(eventHubAsyncClient, atLeastOnce()).getPartitionIds(); @@ -115,36 +145,155 @@ public void testWithSimplePartitionProcessor() throws Exception { } /** - * Tests {@link EventProcessor} with a partition processor that throws an exception when processing an - * event. + * Tests {@link EventProcessor} with a partition processor that throws an exception when processing an event. * * @throws Exception if an error occurs while running the test. */ @Test public void testWithFaultyPartitionProcessor() throws Exception { // Arrange + when(eventHubAsyncClient.getEventHubName()).thenReturn("test-eh"); when(eventHubAsyncClient.getPartitionIds()).thenReturn(Flux.just("1")); when(eventHubAsyncClient .createConsumer(anyString(), anyString(), any(EventPosition.class), any(EventHubConsumerOptions.class))) .thenReturn(consumer1); when(consumer1.receive()).thenReturn(Flux.just(eventData1)); - final FaultyPartitionProcessor faultyPartitionProcessor = new FaultyPartitionProcessor(); final InMemoryPartitionManager partitionManager = new InMemoryPartitionManager(); + final FaultyPartitionProcessor faultyPartitionProcessor = new FaultyPartitionProcessor(); // Act - final EventProcessor eventProcessor = new EventProcessor(eventHubAsyncClient, - "test-consumer", - (partitionContext, checkpointManager) -> faultyPartitionProcessor, - EventPosition.latest(), partitionManager, "test-eh"); + final EventProcessor eventProcessor = new EventProcessorBuilder() + .eventHubClient(eventHubAsyncClient) + .consumerGroup("test-consumer") + .partitionProcessorFactory(() -> faultyPartitionProcessor) + .partitionManager(partitionManager) + .buildEventProcessor(); + eventProcessor.start(); - Thread.sleep(TimeUnit.SECONDS.toMillis(2)); + TimeUnit.SECONDS.sleep(10); eventProcessor.stop(); // Assert assertTrue(faultyPartitionProcessor.error); } + /** + * Tests process start spans error messages invoked for {@link EventProcessor}. + * + * @throws Exception if an error occurs while running the test. + */ + @Test + public void testErrorProcessSpans() throws Exception { + //Arrange + final Tracer tracer1 = mock(Tracer.class); + final List tracers = Collections.singletonList(tracer1); + TracerProvider tracerProvider = new TracerProvider(tracers); + when(eventHubAsyncClient.getEventHubName()).thenReturn("test-eh"); + when(eventHubAsyncClient.getPartitionIds()).thenReturn(Flux.just("1")); + when(eventHubAsyncClient + .createConsumer(anyString(), anyString(), any(EventPosition.class), any(EventHubConsumerOptions.class))) + .thenReturn(consumer1); + when(eventData1.getSequenceNumber()).thenReturn(1L); + when(eventData2.getSequenceNumber()).thenReturn(2L); + when(eventData1.getOffset()).thenReturn(1L); + when(eventData2.getOffset()).thenReturn(100L); + + String diagnosticId = "00-08ee063508037b1719dddcbf248e30e2-1365c684eb25daed-01"; + Map properties = new HashMap<>(); + properties.put(DIAGNOSTIC_ID_KEY, diagnosticId); + + when(eventData1.getProperties()).thenReturn(properties); + when(consumer1.receive()).thenReturn(Flux.just(eventData1)); + when(tracer1.extractContext(eq(diagnosticId), any())).thenAnswer( + invocation -> { + Context passed = invocation.getArgument(1, Context.class); + return passed.addData(SPAN_CONTEXT, "value"); + } + ); + when(tracer1.start(eq("Azure.eventhubs.process"), any(), eq(ProcessKind.PROCESS))).thenAnswer( + invocation -> { + Context passed = invocation.getArgument(1, Context.class); + return passed.addData(SPAN_CONTEXT, "value1") + .addData("scope", (Closeable) () -> { + }) + .addData(OPENTELEMETRY_SPAN_KEY, "value2"); + } + ); + + final InMemoryPartitionManager partitionManager = new InMemoryPartitionManager(); + + //Act + final EventProcessor eventProcessor = new EventProcessor(eventHubAsyncClient, "test-consumer", + FaultyPartitionProcessor::new, EventPosition.earliest(), partitionManager, tracerProvider); + eventProcessor.start(); + TimeUnit.SECONDS.sleep(10); + eventProcessor.stop(); + + //Assert + verify(tracer1, times(1)).extractContext(eq(diagnosticId), any()); + verify(tracer1, times(1)).start(eq("Azure.eventhubs.process"), any(), eq(ProcessKind.PROCESS)); + verify(tracer1, times(1)).end(eq(""), any(IllegalStateException.class), any()); + } + + /** + * Tests process start spans invoked for {@link EventProcessor}. + * + * @throws Exception if an error occurs while running the test. + */ + @Test + public void testProcessSpans() throws Exception { + //Arrange + final Tracer tracer1 = mock(Tracer.class); + final List tracers = Collections.singletonList(tracer1); + TracerProvider tracerProvider = new TracerProvider(tracers); + when(eventHubAsyncClient.getEventHubName()).thenReturn("test-eh"); + when(eventHubAsyncClient.getPartitionIds()).thenReturn(Flux.just("1")); + when(eventHubAsyncClient + .createConsumer(anyString(), anyString(), any(EventPosition.class), any(EventHubConsumerOptions.class))) + .thenReturn(consumer1); + when(eventData1.getSequenceNumber()).thenReturn(1L); + when(eventData2.getSequenceNumber()).thenReturn(2L); + when(eventData1.getOffset()).thenReturn(1L); + when(eventData2.getOffset()).thenReturn(100L); + + String diagnosticId = "00-08ee063508037b1719dddcbf248e30e2-1365c684eb25daed-01"; + Map properties = new HashMap<>(); + properties.put(DIAGNOSTIC_ID_KEY, diagnosticId); + + when(eventData1.getProperties()).thenReturn(properties); + when(consumer1.receive()).thenReturn(Flux.just(eventData1)); + when(tracer1.extractContext(eq(diagnosticId), any())).thenAnswer( + invocation -> { + Context passed = invocation.getArgument(1, Context.class); + return passed.addData(SPAN_CONTEXT, "value"); + } + ); + when(tracer1.start(eq("Azure.eventhubs.process"), any(), eq(ProcessKind.PROCESS))).thenAnswer( + invocation -> { + Context passed = invocation.getArgument(1, Context.class); + return passed.addData(SPAN_CONTEXT, "value1").addData("scope", (Closeable) () -> { + return; + }).addData(OPENTELEMETRY_SPAN_KEY, "value2"); + } + ); + + final InMemoryPartitionManager partitionManager = new InMemoryPartitionManager(); + + //Act + final EventProcessor eventProcessor = new EventProcessor(eventHubAsyncClient, "test-consumer", + TestPartitionProcessor::new, EventPosition.earliest(), partitionManager, tracerProvider); + + eventProcessor.start(); + TimeUnit.SECONDS.sleep(10); + eventProcessor.stop(); + + //Assert + verify(tracer1, times(1)).extractContext(eq(diagnosticId), any()); + verify(tracer1, times(1)).start(eq("Azure.eventhubs.process"), any(), eq(ProcessKind.PROCESS)); + verify(tracer1, times(1)).end(eq("success"), isNull(), any()); + } + /** * Tests {@link EventProcessor} that processes events from an Event Hub configured with multiple * partitions. @@ -154,117 +303,93 @@ public void testWithFaultyPartitionProcessor() throws Exception { @Test public void testWithMultiplePartitions() throws Exception { // Arrange + final CountDownLatch count = new CountDownLatch(1); + when(eventHubAsyncClient.getPartitionIds()).thenReturn(Flux.just("1", "2", "3")); + when(eventHubAsyncClient.getEventHubName()).thenReturn("test-eh"); when(eventHubAsyncClient .createConsumer(anyString(), eq("1"), any(EventPosition.class), any(EventHubConsumerOptions.class))) .thenReturn(consumer1); - when(consumer1.receive()).thenReturn(Flux.just(eventData1, eventData2)); - when(eventData1.sequenceNumber()).thenReturn(1L); - when(eventData2.sequenceNumber()).thenReturn(2L); - when(eventData1.offset()).thenReturn("1"); - when(eventData2.offset()).thenReturn("100"); + when(consumer1.receive()).thenReturn( + Mono.fromRunnable(() -> count.countDown()).thenMany(Flux.just(eventData1, eventData2))); + when(eventData1.getSequenceNumber()).thenReturn(1L); + when(eventData2.getSequenceNumber()).thenReturn(2L); + when(eventData1.getOffset()).thenReturn(1L); + when(eventData2.getOffset()).thenReturn(100L); when(eventHubAsyncClient .createConsumer(anyString(), eq("2"), any(EventPosition.class), any(EventHubConsumerOptions.class))) .thenReturn(consumer2); - when(consumer2.receive()).thenReturn(Flux.just(eventData3)); - when(eventData3.sequenceNumber()).thenReturn(1L); - when(eventData3.offset()).thenReturn("1"); + when(consumer2.receive()).thenReturn(Mono.fromRunnable(() -> count.countDown()).thenMany(Flux.just(eventData3))); + when(eventData3.getSequenceNumber()).thenReturn(1L); + when(eventData3.getOffset()).thenReturn(1L); when(eventHubAsyncClient .createConsumer(anyString(), eq("3"), any(EventPosition.class), any(EventHubConsumerOptions.class))) .thenReturn(consumer3); - when(consumer3.receive()).thenReturn(Flux.just(eventData4)); - when(eventData4.sequenceNumber()).thenReturn(1L); - when(eventData4.offset()).thenReturn("1"); + when(consumer3.receive()).thenReturn(Mono.fromRunnable(() -> count.countDown()).thenMany(Flux.just(eventData4))); + when(eventData4.getSequenceNumber()).thenReturn(1L); + when(eventData4.getOffset()).thenReturn(1L); final InMemoryPartitionManager partitionManager = new InMemoryPartitionManager(); + final TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + // Act final EventProcessor eventProcessor = new EventProcessor(eventHubAsyncClient, "test-consumer", - TestPartitionProcessor::new, EventPosition.latest(), partitionManager, "test-eh"); + TestPartitionProcessor::new, EventPosition.latest(), partitionManager, tracerProvider); eventProcessor.start(); - Thread.sleep(TimeUnit.SECONDS.toMillis(2)); + final boolean completed = count.await(10, TimeUnit.SECONDS); eventProcessor.stop(); // Assert + Assert.assertTrue(completed); StepVerifier.create(partitionManager.listOwnership("test-eh", "test-consumer")) - .expectNextCount(3).verifyComplete(); + .expectNextCount(1).verifyComplete(); verify(eventHubAsyncClient, atLeast(1)).getPartitionIds(); verify(eventHubAsyncClient, times(1)) - .createConsumer(anyString(), eq("1"), any(EventPosition.class), any(EventHubConsumerOptions.class)); - verify(eventHubAsyncClient, times(1)) - .createConsumer(anyString(), eq("2"), any(EventPosition.class), any(EventHubConsumerOptions.class)); - verify(eventHubAsyncClient, times(1)) - .createConsumer(anyString(), eq("3"), any(EventPosition.class), any(EventHubConsumerOptions.class)); - - verify(consumer1, atLeastOnce()).receive(); - verify(consumer1, atLeastOnce()).close(); - - verify(consumer2, atLeastOnce()).receive(); - verify(consumer2, atLeastOnce()).close(); + .createConsumer(anyString(), anyString(), any(EventPosition.class), any(EventHubConsumerOptions.class)); - verify(consumer3, atLeastOnce()).receive(); - verify(consumer3, atLeastOnce()).close(); + StepVerifier.create(partitionManager.listOwnership("test-eh", "test-consumer")) + .assertNext(po -> { + try { + if (po.getPartitionId().equals("1")) { + verify(consumer1, atLeastOnce()).receive(); + verify(consumer1, atLeastOnce()).close(); + } else if (po.getPartitionId().equals("2")) { + verify(consumer2, atLeastOnce()).receive(); + verify(consumer2, atLeastOnce()).close(); + } else { + verify(consumer3, atLeastOnce()).receive(); + verify(consumer3, atLeastOnce()).close(); + } + } catch (IOException ex) { + fail("Failed to assert consumer close method invocation"); + } + }).verifyComplete(); } - private static final class FaultyPartitionProcessor implements PartitionProcessor { + private static final class FaultyPartitionProcessor extends PartitionProcessor { boolean error; @Override - public Mono initialize() { - return Mono.empty(); - } - - @Override - public Mono processEvent(EventData eventData) { + public Mono processEvent(PartitionContext partitionContext, EventData eventData) { return Mono.error(new IllegalStateException()); } @Override - public void processError(Throwable throwable) { + public void processError(PartitionContext partitionContext, Throwable throwable) { error = true; } - - @Override - public Mono close(CloseReason closeReason) { - return Mono.empty(); - } } - private static final class TestPartitionProcessor implements PartitionProcessor { - - PartitionContext partitionContext; - CheckpointManager checkpointManager; - - private TestPartitionProcessor() { - // default ctr - } - - private TestPartitionProcessor(PartitionContext partitionContext, CheckpointManager checkpointManager) { - this.partitionContext = partitionContext; - this.checkpointManager = checkpointManager; - } - - @Override - public Mono initialize() { - return Mono.empty(); - } - - @Override - public Mono processEvent(EventData eventData) { - return this.checkpointManager.updateCheckpoint(eventData); - } - - @Override - public void processError(Throwable throwable) { - } + private static final class TestPartitionProcessor extends PartitionProcessor { @Override - public Mono close(CloseReason closeReason) { - return Mono.empty(); + public Mono processEvent(PartitionContext partitionContext, EventData eventData) { + return partitionContext.updateCheckpoint(eventData); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/InteropAmqpPropertiesTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/InteropAmqpPropertiesTest.java index 03d111a28e17..9f55fd587a13 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/InteropAmqpPropertiesTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/InteropAmqpPropertiesTest.java @@ -5,8 +5,9 @@ import com.azure.core.amqp.MessageConstant; import com.azure.core.amqp.RetryOptions; +import com.azure.core.amqp.implementation.TracerProvider; import com.azure.core.util.logging.ClientLogger; -import com.azure.messaging.eventhubs.implementation.ApiTestBase; +import com.azure.messaging.eventhubs.implementation.IntegrationTestBase; import com.azure.messaging.eventhubs.implementation.ReactorHandlerProvider; import com.azure.messaging.eventhubs.models.EventHubProducerOptions; import com.azure.messaging.eventhubs.models.EventPosition; @@ -25,16 +26,23 @@ import java.nio.ByteBuffer; import java.time.Duration; +import java.time.Instant; +import java.util.Collections; +import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.UUID; import java.util.concurrent.atomic.AtomicReference; +import static com.azure.core.amqp.MessageConstant.ENQUEUED_TIME_UTC_ANNOTATION_NAME; +import static com.azure.core.amqp.MessageConstant.OFFSET_ANNOTATION_NAME; +import static com.azure.core.amqp.MessageConstant.SEQUENCE_NUMBER_ANNOTATION_NAME; import static com.azure.messaging.eventhubs.TestUtils.MESSAGE_TRACKING_ID; +import static com.azure.messaging.eventhubs.TestUtils.getSymbol; import static com.azure.messaging.eventhubs.TestUtils.isMatchingEvent; import static java.nio.charset.StandardCharsets.UTF_8; -public class InteropAmqpPropertiesTest extends ApiTestBase { +public class InteropAmqpPropertiesTest extends IntegrationTestBase { private static final String PARTITION_ID = "0"; private static final String PAYLOAD = "test-message"; @@ -50,17 +58,18 @@ public InteropAmqpPropertiesTest() { } @Override - protected String testName() { + protected String getTestName() { return testName.getMethodName(); } @Override protected void beforeTest() { final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(getReactorProvider()); - client = new EventHubAsyncClient(getConnectionOptions(), getReactorProvider(), handlerProvider); + final TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + client = new EventHubAsyncClient(getConnectionOptions(), getReactorProvider(), handlerProvider, tracerProvider); - final EventHubProducerOptions producerOptions = new EventHubProducerOptions().partitionId(PARTITION_ID) - .retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))); + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().setPartitionId(PARTITION_ID) + .setRetry(new RetryOptions().setTryTimeout(Duration.ofSeconds(30))); producer = client.createProducer(producerOptions); consumer = client.createConsumer(EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, EventPosition.latest()); } @@ -75,8 +84,6 @@ protected void afterTest() { */ @Test public void interoperableWithDirectProtonAmqpMessage() { - skipIfNotRecordMode(); - // Arrange final AtomicReference receivedEventData = new AtomicReference<>(); final String messageTrackingValue = UUID.randomUUID().toString(); @@ -102,8 +109,14 @@ public void interoperableWithDirectProtonAmqpMessage() { message.setGroupId("group-id"); message.setReplyToGroupId("replyToGroupId"); - final Map messageAnnotations = new HashMap<>(); - messageAnnotations.put(Symbol.getSymbol("message-annotation-1"), "messageAnnotationValue"); + final Map expectedAnnotations = new HashMap<>(); + expectedAnnotations.put(Symbol.getSymbol("message-annotation-1"), "messageAnnotationValue"); + + final Map messageAnnotations = new HashMap<>(expectedAnnotations); + messageAnnotations.put(getSymbol(OFFSET_ANNOTATION_NAME), "100"); + messageAnnotations.put(getSymbol(ENQUEUED_TIME_UTC_ANNOTATION_NAME), Date.from(Instant.now())); + messageAnnotations.put(getSymbol(SEQUENCE_NUMBER_ANNOTATION_NAME), 15L); + message.setMessageAnnotations(new MessageAnnotations(messageAnnotations)); message.setBody(new Data(Binary.create(ByteBuffer.wrap(PAYLOAD.getBytes())))); @@ -115,7 +128,7 @@ public void interoperableWithDirectProtonAmqpMessage() { StepVerifier.create(consumer.receive().filter(event -> isMatchingEvent(event, messageTrackingValue)).take(1)) .then(() -> producer.send(msgEvent).block(TIMEOUT)) .assertNext(event -> { - validateAmqpProperties(message, messageAnnotations, applicationProperties, event); + validateAmqpProperties(message, expectedAnnotations, applicationProperties, event); receivedEventData.set(event); }) .verifyComplete(); @@ -124,59 +137,59 @@ public void interoperableWithDirectProtonAmqpMessage() { StepVerifier.create(consumer.receive().filter(event -> isMatchingEvent(event, messageTrackingValue)).take(1)) .then(() -> producer.send(receivedEventData.get()).block(TIMEOUT)) - .assertNext(event -> validateAmqpProperties(message, messageAnnotations, applicationProperties, event)) + .assertNext(event -> validateAmqpProperties(message, expectedAnnotations, applicationProperties, event)) .verifyComplete(); } private void validateAmqpProperties(Message message, Map messageAnnotations, Map applicationProperties, EventData actual) { - Assert.assertTrue(actual.systemProperties().containsKey(MessageConstant.MESSAGE_ID.getValue())); - Assert.assertEquals(message.getMessageId(), actual.systemProperties().get(MessageConstant.MESSAGE_ID.getValue())); + Assert.assertTrue(actual.getSystemProperties().containsKey(MessageConstant.MESSAGE_ID.getValue())); + Assert.assertEquals(message.getMessageId(), actual.getSystemProperties().get(MessageConstant.MESSAGE_ID.getValue())); - Assert.assertTrue(actual.systemProperties().containsKey(MessageConstant.USER_ID.getValue())); - Assert.assertEquals(new String(message.getUserId()), new String((byte[]) actual.systemProperties().get(MessageConstant.USER_ID.getValue()))); + Assert.assertTrue(actual.getSystemProperties().containsKey(MessageConstant.USER_ID.getValue())); + Assert.assertEquals(new String(message.getUserId()), new String((byte[]) actual.getSystemProperties().get(MessageConstant.USER_ID.getValue()))); - Assert.assertTrue(actual.systemProperties().containsKey(MessageConstant.TO.getValue())); - Assert.assertEquals(message.getAddress(), actual.systemProperties().get(MessageConstant.TO.getValue())); + Assert.assertTrue(actual.getSystemProperties().containsKey(MessageConstant.TO.getValue())); + Assert.assertEquals(message.getAddress(), actual.getSystemProperties().get(MessageConstant.TO.getValue())); - Assert.assertTrue(actual.systemProperties().containsKey(MessageConstant.CONTENT_TYPE.getValue())); - Assert.assertEquals(message.getContentType(), actual.systemProperties().get(MessageConstant.CONTENT_TYPE.getValue())); + Assert.assertTrue(actual.getSystemProperties().containsKey(MessageConstant.CONTENT_TYPE.getValue())); + Assert.assertEquals(message.getContentType(), actual.getSystemProperties().get(MessageConstant.CONTENT_TYPE.getValue())); - Assert.assertTrue(actual.systemProperties().containsKey(MessageConstant.CONTENT_ENCODING.getValue())); - Assert.assertEquals(message.getContentEncoding(), actual.systemProperties().get(MessageConstant.CONTENT_ENCODING.getValue())); + Assert.assertTrue(actual.getSystemProperties().containsKey(MessageConstant.CONTENT_ENCODING.getValue())); + Assert.assertEquals(message.getContentEncoding(), actual.getSystemProperties().get(MessageConstant.CONTENT_ENCODING.getValue())); - Assert.assertTrue(actual.systemProperties().containsKey(MessageConstant.CORRELATION_ID.getValue())); - Assert.assertEquals(message.getCorrelationId(), actual.systemProperties().get(MessageConstant.CORRELATION_ID.getValue())); + Assert.assertTrue(actual.getSystemProperties().containsKey(MessageConstant.CORRELATION_ID.getValue())); + Assert.assertEquals(message.getCorrelationId(), actual.getSystemProperties().get(MessageConstant.CORRELATION_ID.getValue())); - Assert.assertTrue(actual.systemProperties().containsKey(MessageConstant.CREATION_TIME.getValue())); - Assert.assertEquals(message.getCreationTime(), actual.systemProperties().get(MessageConstant.CREATION_TIME.getValue())); + Assert.assertTrue(actual.getSystemProperties().containsKey(MessageConstant.CREATION_TIME.getValue())); + Assert.assertEquals(message.getCreationTime(), actual.getSystemProperties().get(MessageConstant.CREATION_TIME.getValue())); - Assert.assertTrue(actual.systemProperties().containsKey(MessageConstant.SUBJECT.getValue())); - Assert.assertEquals(message.getSubject(), actual.systemProperties().get(MessageConstant.SUBJECT.getValue())); + Assert.assertTrue(actual.getSystemProperties().containsKey(MessageConstant.SUBJECT.getValue())); + Assert.assertEquals(message.getSubject(), actual.getSystemProperties().get(MessageConstant.SUBJECT.getValue())); - Assert.assertTrue(actual.systemProperties().containsKey(MessageConstant.GROUP_ID.getValue())); - Assert.assertEquals(message.getGroupId(), actual.systemProperties().get(MessageConstant.GROUP_ID.getValue())); + Assert.assertTrue(actual.getSystemProperties().containsKey(MessageConstant.GROUP_ID.getValue())); + Assert.assertEquals(message.getGroupId(), actual.getSystemProperties().get(MessageConstant.GROUP_ID.getValue())); - Assert.assertTrue(actual.systemProperties().containsKey(MessageConstant.REPLY_TO_GROUP_ID.getValue())); - Assert.assertEquals(message.getReplyToGroupId(), actual.systemProperties().get(MessageConstant.REPLY_TO_GROUP_ID.getValue())); + Assert.assertTrue(actual.getSystemProperties().containsKey(MessageConstant.REPLY_TO_GROUP_ID.getValue())); + Assert.assertEquals(message.getReplyToGroupId(), actual.getSystemProperties().get(MessageConstant.REPLY_TO_GROUP_ID.getValue())); - Assert.assertTrue(actual.systemProperties().containsKey(MessageConstant.REPLY_TO.getValue())); - Assert.assertEquals(message.getReplyTo(), actual.systemProperties().get(MessageConstant.REPLY_TO.getValue())); + Assert.assertTrue(actual.getSystemProperties().containsKey(MessageConstant.REPLY_TO.getValue())); + Assert.assertEquals(message.getReplyTo(), actual.getSystemProperties().get(MessageConstant.REPLY_TO.getValue())); - Assert.assertTrue(actual.systemProperties().containsKey(MessageConstant.ABSOLUTE_EXPIRY_TIME.getValue())); - Assert.assertEquals(message.getExpiryTime(), actual.systemProperties().get(MessageConstant.ABSOLUTE_EXPIRY_TIME.getValue())); + Assert.assertTrue(actual.getSystemProperties().containsKey(MessageConstant.ABSOLUTE_EXPIRY_TIME.getValue())); + Assert.assertEquals(message.getExpiryTime(), actual.getSystemProperties().get(MessageConstant.ABSOLUTE_EXPIRY_TIME.getValue())); - Assert.assertEquals(PAYLOAD, UTF_8.decode(actual.body()).toString()); + Assert.assertEquals(PAYLOAD, UTF_8.decode(actual.getBody()).toString()); messageAnnotations.forEach((key, value) -> { - Assert.assertTrue(actual.systemProperties().containsKey(key.toString())); - Assert.assertEquals(value, actual.systemProperties().get(key.toString())); + Assert.assertTrue(actual.getSystemProperties().containsKey(key.toString())); + Assert.assertEquals(value, actual.getSystemProperties().get(key.toString())); }); - Assert.assertEquals(applicationProperties.size(), actual.properties().size()); + Assert.assertEquals(applicationProperties.size(), actual.getProperties().size()); applicationProperties.forEach((key, value) -> { - Assert.assertTrue(actual.properties().containsKey(key)); - Assert.assertEquals(value, actual.properties().get(key)); + Assert.assertTrue(actual.getProperties().containsKey(key)); + Assert.assertEquals(value, actual.getProperties().get(key)); }); } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/PartitionPropertiesTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/PartitionPropertiesTest.java index bee7d63252fe..fc46f7c0c938 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/PartitionPropertiesTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/PartitionPropertiesTest.java @@ -28,12 +28,12 @@ public void setsProperties() { lastEnqueuedOffset, lastEnqueuedTime, isEmpty); // Assert - Assert.assertEquals(eventHub, properties.eventHubName()); - Assert.assertEquals(id, properties.id()); - Assert.assertEquals(beginningSequence, properties.beginningSequenceNumber()); - Assert.assertEquals(endSequence, properties.lastEnqueuedSequenceNumber()); - Assert.assertEquals(lastEnqueuedOffset, properties.lastEnqueuedOffset()); - Assert.assertEquals(lastEnqueuedTime, properties.lastEnqueuedTime()); + Assert.assertEquals(eventHub, properties.getEventHubName()); + Assert.assertEquals(id, properties.getId()); + Assert.assertEquals(beginningSequence, properties.getBeginningSequenceNumber()); + Assert.assertEquals(endSequence, properties.getLastEnqueuedSequenceNumber()); + Assert.assertEquals(lastEnqueuedOffset, properties.getLastEnqueuedOffset()); + Assert.assertEquals(lastEnqueuedTime, properties.getLastEnqueuedTime()); Assert.assertEquals(isEmpty, properties.isEmpty()); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/SetPrefetchCountTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/SetPrefetchCountTest.java index a86107926bb7..2b8d3028bd7d 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/SetPrefetchCountTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/SetPrefetchCountTest.java @@ -3,8 +3,9 @@ package com.azure.messaging.eventhubs; +import com.azure.core.amqp.implementation.TracerProvider; import com.azure.core.util.logging.ClientLogger; -import com.azure.messaging.eventhubs.implementation.ApiTestBase; +import com.azure.messaging.eventhubs.implementation.IntegrationTestBase; import com.azure.messaging.eventhubs.implementation.ReactorHandlerProvider; import com.azure.messaging.eventhubs.models.EventHubConsumerOptions; import com.azure.messaging.eventhubs.models.EventHubProducerOptions; @@ -18,6 +19,7 @@ import reactor.core.publisher.Flux; import java.time.Instant; +import java.util.Collections; import java.util.UUID; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -30,7 +32,7 @@ * Verifies we can use various prefetch options with {@link EventHubAsyncConsumer}. */ @Ignore("Set prefetch tests do not work because they try to send very large number of events at once.") -public class SetPrefetchCountTest extends ApiTestBase { +public class SetPrefetchCountTest extends IntegrationTestBase { private static final String PARTITION_ID = "1"; // Default number of events to fetch when creating the consumer. private static final int DEFAULT_PREFETCH_COUNT = 500; @@ -55,16 +57,15 @@ public SetPrefetchCountTest() { } @Override - protected String testName() { + protected String getTestName() { return testName.getMethodName(); } @Override protected void beforeTest() { - skipIfNotRecordMode(); - final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(getReactorProvider()); - client = new EventHubAsyncClient(getConnectionOptions(), getReactorProvider(), handlerProvider); + final TracerProvider tracerProvider = new TracerProvider(Collections.emptyList()); + client = new EventHubAsyncClient(getConnectionOptions(), getReactorProvider(), handlerProvider, tracerProvider); setupEventTestData(client); } @@ -85,8 +86,8 @@ public void setLargePrefetchCount() throws InterruptedException { final int eventCount = NUMBER_OF_EVENTS; final CountDownLatch countDownLatch = new CountDownLatch(eventCount); final EventHubConsumerOptions options = new EventHubConsumerOptions() - .retry(RETRY_OPTIONS) - .prefetchCount(2000); + .setRetry(RETRY_OPTIONS) + .setPrefetchCount(2000); consumer = client.createConsumer(EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, EventPosition.fromEnqueuedTime(MESSAGES_PUSHED_INSTANT.get()), options); @@ -114,7 +115,7 @@ public void setSmallPrefetchCount() throws InterruptedException { // Arrange final int eventCount = 30; final CountDownLatch countDownLatch = new CountDownLatch(eventCount); - final EventHubConsumerOptions options = new EventHubConsumerOptions().prefetchCount(11); + final EventHubConsumerOptions options = new EventHubConsumerOptions().setPrefetchCount(11); consumer = client.createConsumer(EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, EventPosition.fromEnqueuedTime(MESSAGES_PUSHED_INSTANT.get()), options); @@ -146,13 +147,13 @@ private void setupEventTestData(EventHubAsyncClient client) { logger.info("Pushing events to partition. Message tracking value: {}", MESSAGE_TRACKING_VALUE); final EventHubProducerOptions producerOptions = new EventHubProducerOptions() - .partitionId(PARTITION_ID); + .setPartitionId(PARTITION_ID); final EventHubAsyncProducer producer = client.createProducer(producerOptions); final Flux events = TestUtils.getEvents(NUMBER_OF_EVENTS, MESSAGE_TRACKING_VALUE); try { MESSAGES_PUSHED_INSTANT.set(Instant.now()); - producer.send(events).block(RETRY_OPTIONS.tryTimeout()); + producer.send(events).block(RETRY_OPTIONS.getTryTimeout()); } finally { dispose(producer); } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/TestUtils.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/TestUtils.java index a8ff3375a704..1f96d9fbde75 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/TestUtils.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/TestUtils.java @@ -15,8 +15,10 @@ import reactor.core.publisher.Flux; import java.time.Instant; +import java.util.Collections; import java.util.Date; import java.util.HashMap; +import java.util.List; import java.util.Map; import static com.azure.core.amqp.MessageConstant.ENQUEUED_TIME_UTC_ANNOTATION_NAME; @@ -28,12 +30,14 @@ /** * Contains helper methods for working with AMQP messages */ -final class TestUtils { +public final class TestUtils { + static final String TEST_CONNECTION_STRING = "Endpoint=sb://test-event-hub.servicebus.windows.net/;SharedAccessKeyName=dummyaccount;SharedAccessKey=ctzMq410TV3wS7upTBcunJTDLEJwMAZuFPfr0mrrA08=;EntityPath=non-existent-hub;"; + // System and application properties from the generated test message. static final Instant ENQUEUED_TIME = Instant.ofEpochSecond(1561344661); - static final String OFFSET = "an-offset-of-sorts"; + static final Long OFFSET = 1534L; static final String PARTITION_KEY = "a-partition-key"; - static final long SEQUENCE_NUMBER = 1025L; + static final Long SEQUENCE_NUMBER = 1025L; static final String OTHER_SYSTEM_PROPERTY = "Some-other-system-property"; static final Boolean OTHER_SYSTEM_PROPERTY_VALUE = Boolean.TRUE; static final Map APPLICATION_PROPERTIES = new HashMap<>(); @@ -63,15 +67,18 @@ static Message getMessage(byte[] contents) { * Creates a mock message with the contents provided. */ static Message getMessage(byte[] contents, String messageTrackingValue) { - final Map systemProperties = new HashMap<>(); - systemProperties.put(getSymbol(OFFSET_ANNOTATION_NAME), OFFSET); - systemProperties.put(getSymbol(PARTITION_KEY_ANNOTATION_NAME), PARTITION_KEY); - systemProperties.put(getSymbol(ENQUEUED_TIME_UTC_ANNOTATION_NAME), Date.from(ENQUEUED_TIME)); - systemProperties.put(getSymbol(SEQUENCE_NUMBER_ANNOTATION_NAME), SEQUENCE_NUMBER); - systemProperties.put(Symbol.getSymbol(OTHER_SYSTEM_PROPERTY), OTHER_SYSTEM_PROPERTY_VALUE); + return getMessage(contents, messageTrackingValue, Collections.emptyMap()); + } - final Message message = Proton.message(); - message.setMessageAnnotations(new MessageAnnotations(systemProperties)); + /** + * Creates a message with the given contents, default system properties, and adds a {@code messageTrackingValue} in + * the application properties. Useful for helping filter messages. + */ + static Message getMessage(byte[] contents, String messageTrackingValue, Map additionalProperties) { + final Message message = getMessage(contents, SEQUENCE_NUMBER, OFFSET, Date.from(ENQUEUED_TIME)); + + message.getMessageAnnotations().getValue() + .put(Symbol.getSymbol(OTHER_SYSTEM_PROPERTY), OTHER_SYSTEM_PROPERTY_VALUE); Map applicationProperties = new HashMap<>(); APPLICATION_PROPERTIES.forEach(applicationProperties::put); @@ -80,17 +87,49 @@ static Message getMessage(byte[] contents, String messageTrackingValue) { applicationProperties.put(MESSAGE_TRACKING_ID, messageTrackingValue); } + if (additionalProperties != null) { + additionalProperties.forEach(applicationProperties::put); + } + message.setApplicationProperties(new ApplicationProperties(applicationProperties)); + + return message; + } + + /** + * Creates a message with the required system properties set. + */ + static Message getMessage(byte[] contents, Long sequenceNumber, Long offsetNumber, Date enqueuedTime) { + final Map systemProperties = new HashMap<>(); + systemProperties.put(getSymbol(OFFSET_ANNOTATION_NAME), String.valueOf(offsetNumber)); + systemProperties.put(getSymbol(ENQUEUED_TIME_UTC_ANNOTATION_NAME), enqueuedTime); + systemProperties.put(getSymbol(SEQUENCE_NUMBER_ANNOTATION_NAME), sequenceNumber); + systemProperties.put(getSymbol(PARTITION_KEY_ANNOTATION_NAME), PARTITION_KEY); + + final Message message = Proton.message(); + message.setMessageAnnotations(new MessageAnnotations(systemProperties)); message.setBody(new Data(new Binary(contents))); return message; } + /** + * Creates an EventData with the received properties set. + */ + public static EventData getEventData(byte[] contents, Long sequenceNumber, Long offsetNumber, Date enqueuedTime) { + final Message message = getMessage(contents, sequenceNumber, offsetNumber, enqueuedTime); + return new EventData(message); + } + static Flux getEvents(int numberOfEvents, String messageTrackingValue) { return Flux.range(0, numberOfEvents) .map(number -> getEvent("Event " + number, messageTrackingValue, number)); } + static List getEventsAsList(int numberOfEvents, String messageTrackingValue) { + return getEvents(numberOfEvents, messageTrackingValue).collectList().block(); + } + static EventData getEvent(String body, String messageTrackingValue, int position) { final EventData eventData = new EventData(body.getBytes(UTF_8)); eventData.addProperty(MESSAGE_TRACKING_ID, messageTrackingValue); @@ -102,8 +141,8 @@ static EventData getEvent(String body, String messageTrackingValue, int position * Checks the {@link #MESSAGE_TRACKING_ID} to see if it matches the {@code expectedValue}. */ static boolean isMatchingEvent(EventData event, String expectedValue) { - return event.properties() != null && event.properties().containsKey(MESSAGE_TRACKING_ID) - && expectedValue.equals(event.properties().get(MESSAGE_TRACKING_ID)); + return event.getProperties() != null && event.getProperties().containsKey(MESSAGE_TRACKING_ID) + && expectedValue.equals(event.getProperties().get(MESSAGE_TRACKING_ID)); } private TestUtils() { diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ApiTestBase.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ApiTestBase.java deleted file mode 100644 index f032f5db21a6..000000000000 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ApiTestBase.java +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.messaging.eventhubs.implementation; - -import com.azure.core.amqp.RetryOptions; -import com.azure.core.amqp.TransportType; -import com.azure.core.credentials.TokenCredential; -import com.azure.core.implementation.util.ImplUtils; -import com.azure.core.test.TestBase; -import com.azure.core.test.TestMode; -import com.azure.core.util.logging.ClientLogger; -import com.azure.messaging.eventhubs.EventHubSharedAccessKeyCredential; -import com.azure.messaging.eventhubs.models.ProxyConfiguration; -import org.apache.qpid.proton.reactor.Reactor; -import org.apache.qpid.proton.reactor.Selectable; -import org.junit.After; -import org.junit.Assert; -import org.junit.Assume; -import org.junit.Before; -import org.mockito.Mockito; -import reactor.core.scheduler.Scheduler; -import reactor.core.scheduler.Schedulers; - -import java.io.Closeable; -import java.io.IOException; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; -import java.time.Duration; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -/** - * Test base for running live and offline tests. - */ -public abstract class ApiTestBase extends TestBase { - protected static final Duration TIMEOUT = Duration.ofSeconds(30); - protected static final RetryOptions RETRY_OPTIONS = new RetryOptions().tryTimeout(TIMEOUT); - protected final ClientLogger logger; - - private static final String EVENT_HUB_CONNECTION_STRING_ENV_NAME = "AZURE_EVENTHUBS_CONNECTION_STRING"; - private static final String CONNECTION_STRING = System.getenv(EVENT_HUB_CONNECTION_STRING_ENV_NAME); - private static final String TEST_CONNECTION_STRING = "Endpoint=sb://test-event-hub.servicebus.windows.net/;SharedAccessKeyName=dummyaccount;SharedAccessKey=ctzMq410TV3wS7upTBcunJTDLEJwMAZuFPfr0mrrA08=;EntityPath=non-existent-hub;"; - - private ConnectionStringProperties properties; - private Reactor reactor = mock(Reactor.class); - private TokenCredential tokenCredential; - private ReactorProvider reactorProvider; - private ConnectionOptions connectionOptions; - private TransportType transportType; - - protected ApiTestBase(ClientLogger logger) { - this.transportType = TransportType.AMQP; - this.logger = logger; - } - - // These are overridden because we don't use the Interceptor Manager. - @Override - @Before - public void setupTest() { - logger.info("[{}]: Performing test set-up.", testName()); - - final Scheduler scheduler = Schedulers.newParallel("AMQPConnection"); - final String connectionString = getTestMode() == TestMode.RECORD - ? CONNECTION_STRING - : TEST_CONNECTION_STRING; - - properties = new ConnectionStringProperties(connectionString); - reactorProvider = new ReactorProvider(); - - try { - tokenCredential = new EventHubSharedAccessKeyCredential(properties.sharedAccessKeyName(), - properties.sharedAccessKey(), ClientConstants.TOKEN_VALIDITY); - } catch (NoSuchAlgorithmException | InvalidKeyException e) { - Assert.fail("Could not create tokenProvider :" + e); - } - - if (getTestMode() != TestMode.RECORD) { - when(reactor.selectable()).thenReturn(mock(Selectable.class)); - ReactorDispatcher reactorDispatcher = null; - try { - reactorDispatcher = new ReactorDispatcher(reactor); - } catch (IOException e) { - Assert.fail("Could not create dispatcher: " + e); - } - reactorProvider = new MockReactorProvider(reactor, reactorDispatcher); - } - - connectionOptions = new ConnectionOptions(properties.endpoint().getHost(), properties.eventHubName(), - tokenCredential, getAuthorizationType(), transportType, RETRY_OPTIONS, ProxyConfiguration.SYSTEM_DEFAULTS, - scheduler); - - beforeTest(); - } - - // These are overridden because we don't use the Interceptor Manager. - @Override - @After - public void teardownTest() { - logger.info("[{}]: Performing test clean-up.", testName()); - - afterTest(); - - // Tear down any inline mocks to avoid memory leaks. - // https://github.com/mockito/mockito/wiki/What's-new-in-Mockito-2#mockito-2250 - Mockito.framework().clearInlineMocks(); - } - - /** - * Gets the test mode for this API test. If AZURE_TEST_MODE equals {@link TestMode#RECORD} and Event Hubs connection - * string is set, then we return {@link TestMode#RECORD}. Otherwise, {@link TestMode#PLAYBACK} is returned. - */ - @Override - public TestMode getTestMode() { - if (super.getTestMode() == TestMode.PLAYBACK) { - return TestMode.PLAYBACK; - } - - return ImplUtils.isNullOrEmpty(CONNECTION_STRING) ? TestMode.PLAYBACK : TestMode.RECORD; - } - - protected String getConnectionString() { - return getTestMode() == TestMode.RECORD ? CONNECTION_STRING : TEST_CONNECTION_STRING; - } - - protected void skipIfNotRecordMode() { - Assume.assumeTrue(getTestMode() == TestMode.RECORD); - } - - protected void setTransportType(TransportType transportType) { - this.transportType = transportType; - } - - protected ConnectionOptions getConnectionOptions() { - return connectionOptions; - } - - protected ConnectionStringProperties getConnectionStringProperties() { - return properties; - } - - protected TokenCredential getTokenCredential() { - return tokenCredential; - } - - protected Reactor getReactor() { - return reactor; - } - - protected ReactorProvider getReactorProvider() { - return reactorProvider; - } - - protected CBSAuthorizationType getAuthorizationType() { - return CBSAuthorizationType.SHARED_ACCESS_SIGNATURE; - } - - /** - * Disposes of any {@link Closeable} resources. - * - * @param closeables The closeables to dispose of. If a closeable is {@code null}, it is skipped. - */ - protected void dispose(Closeable... closeables) { - if (closeables == null || closeables.length == 0) { - return; - } - - for (int i = 0; i < closeables.length; i++) { - final Closeable closeable = closeables[i]; - - if (closeable == null) { - continue; - } - - try { - closeable.close(); - } catch (IOException error) { - logger.error(String.format("[%s]: %s didn't close properly.", - testName(), closeable.getClass().getSimpleName()), error); - } - } - } -} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/CBSChannelTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/CBSChannelTest.java index ec4fbd9acbef..2586ab0db1c6 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/CBSChannelTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/CBSChannelTest.java @@ -24,7 +24,7 @@ import java.time.Duration; import java.time.OffsetDateTime; -public class CBSChannelTest extends ApiTestBase { +public class CBSChannelTest extends IntegrationTestBase { private static final String CONNECTION_ID = "CbsChannelTest-Connection"; @Mock @@ -44,7 +44,7 @@ public CBSChannelTest() { } @Override - protected String testName() { + protected String getTestName() { return testName.getMethodName(); } @@ -53,14 +53,14 @@ protected void beforeTest() { MockitoAnnotations.initMocks(this); credentials = getConnectionStringProperties(); - tokenResourceProvider = new TokenResourceProvider(CBSAuthorizationType.SHARED_ACCESS_SIGNATURE, credentials.endpoint().getHost()); + tokenResourceProvider = new TokenResourceProvider(CBSAuthorizationType.SHARED_ACCESS_SIGNATURE, credentials.getEndpoint().getHost()); handlerProvider = new ReactorHandlerProvider(getReactorProvider()); connection = new ReactorConnection(CONNECTION_ID, getConnectionOptions(), getReactorProvider(), handlerProvider, mapper); cbsChannel = new CBSChannel(connection, getTokenCredential(), getAuthorizationType(), getReactorProvider(), - handlerProvider, new RetryOptions().tryTimeout(Duration.ofMinutes(5))); + handlerProvider, new RetryOptions().setTryTimeout(Duration.ofMinutes(5))); } @Override @@ -83,7 +83,7 @@ protected void afterTest() { @Test public void successfullyAuthorizes() { // Arrange - final String tokenAudience = tokenResourceProvider.getResourceString(credentials.eventHubName()); + final String tokenAudience = tokenResourceProvider.getResourceString(credentials.getEventHubName()); // Act & Assert StepVerifier.create(cbsChannel.authorize(tokenAudience)) @@ -93,21 +93,19 @@ public void successfullyAuthorizes() { @Test public void unsuccessfulAuthorize() { - skipIfNotRecordMode(); - // Arrange - final String tokenAudience = tokenResourceProvider.getResourceString(credentials.eventHubName()); + final String tokenAudience = tokenResourceProvider.getResourceString(credentials.getEventHubName()); final Duration duration = Duration.ofMinutes(10); TokenCredential tokenProvider = null; try { - tokenProvider = new EventHubSharedAccessKeyCredential(credentials.sharedAccessKeyName(), "Invalid shared access key.", duration); + tokenProvider = new EventHubSharedAccessKeyCredential(credentials.getSharedAccessKeyName(), "Invalid shared access key.", duration); } catch (Exception e) { Assert.fail("Could not create token provider: " + e.toString()); } final CBSNode node = new CBSChannel(connection, tokenProvider, getAuthorizationType(), getReactorProvider(), - handlerProvider, new RetryOptions().tryTimeout(Duration.ofMinutes(5))); + handlerProvider, new RetryOptions().setTryTimeout(Duration.ofMinutes(5))); // Act & Assert StepVerifier.create(node.authorize(tokenAudience)) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ConnectionStringPropertiesTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ConnectionStringPropertiesTest.java index ad08302d18f5..944f439bfc94 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ConnectionStringPropertiesTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ConnectionStringPropertiesTest.java @@ -5,14 +5,9 @@ import org.junit.Assert; import org.junit.Test; -import org.junit.experimental.theories.DataPoints; -import org.junit.experimental.theories.Theories; -import org.junit.experimental.theories.Theory; -import org.junit.runner.RunWith; import java.util.Locale; -@RunWith(Theories.class) public class ConnectionStringPropertiesTest { private static final String HOST = "foo.bar.windows.net"; private static final String HOSTNAME_URI = "sb://" + HOST; @@ -20,19 +15,14 @@ public class ConnectionStringPropertiesTest { private static final String SAS_KEY = "test-sas-key"; private static final String SAS_VALUE = "some-secret-value"; - @DataPoints - public static String[] getInvalidArguments() { - return new String[]{"", null}; + @Test(expected = NullPointerException.class) + public void nullConnectionString() { + new ConnectionStringProperties(null); } - @Theory - public void nullConnectionString(String argument) { - try { - new ConnectionStringProperties(argument); - Assert.fail("Expected an exception."); - } catch (IllegalArgumentException e) { - // This is what we expect. - } + @Test(expected = IllegalArgumentException.class) + public void emptyConnectionString() { + new ConnectionStringProperties(""); } @Test(expected = IllegalArgumentException.class) @@ -96,10 +86,10 @@ public void namespaceConnectionString() { final ConnectionStringProperties properties = new ConnectionStringProperties(connectionString); // Assert - Assert.assertEquals(HOST, properties.endpoint().getHost()); - Assert.assertEquals(SAS_KEY, properties.sharedAccessKeyName()); - Assert.assertEquals(SAS_VALUE, properties.sharedAccessKey()); - Assert.assertNull(properties.eventHubName()); + Assert.assertEquals(HOST, properties.getEndpoint().getHost()); + Assert.assertEquals(SAS_KEY, properties.getSharedAccessKeyName()); + Assert.assertEquals(SAS_VALUE, properties.getSharedAccessKey()); + Assert.assertNull(properties.getEventHubName()); } /** @@ -114,10 +104,10 @@ public void parseConnectionString() { final ConnectionStringProperties properties = new ConnectionStringProperties(connectionString); // Assert - Assert.assertEquals(HOST, properties.endpoint().getHost()); - Assert.assertEquals(SAS_KEY, properties.sharedAccessKeyName()); - Assert.assertEquals(SAS_VALUE, properties.sharedAccessKey()); - Assert.assertEquals(EVENT_HUB, properties.eventHubName()); + Assert.assertEquals(HOST, properties.getEndpoint().getHost()); + Assert.assertEquals(SAS_KEY, properties.getSharedAccessKeyName()); + Assert.assertEquals(SAS_VALUE, properties.getSharedAccessKey()); + Assert.assertEquals(EVENT_HUB, properties.getEventHubName()); } private static String getConnectionString(String hostname, String eventHubName, String sasKeyName, String sasKeyValue) { diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/IntegrationTestBase.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/IntegrationTestBase.java new file mode 100644 index 000000000000..58e2cf6c931a --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/IntegrationTestBase.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs.implementation; + +import com.azure.core.amqp.RetryOptions; +import com.azure.core.amqp.TransportType; +import com.azure.core.credentials.TokenCredential; +import com.azure.core.implementation.util.ImplUtils; +import com.azure.core.test.TestBase; +import com.azure.core.test.TestMode; +import com.azure.core.util.logging.ClientLogger; +import com.azure.messaging.eventhubs.EventHubSharedAccessKeyCredential; +import com.azure.messaging.eventhubs.models.ProxyConfiguration; +import org.junit.After; +import org.junit.Assert; +import org.junit.Assume; +import org.junit.Before; +import org.mockito.Mockito; +import reactor.core.scheduler.Scheduler; +import reactor.core.scheduler.Schedulers; + +import java.io.Closeable; +import java.io.IOException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.time.Duration; + +/** + * Test base for running integration tests. + */ +public abstract class IntegrationTestBase extends TestBase { + protected static final Duration TIMEOUT = Duration.ofSeconds(30); + protected static final RetryOptions RETRY_OPTIONS = new RetryOptions().setTryTimeout(TIMEOUT); + protected final ClientLogger logger; + + private static final String EVENT_HUB_CONNECTION_STRING_ENV_NAME = "AZURE_EVENTHUBS_CONNECTION_STRING"; + private static final String CONNECTION_STRING = System.getenv(EVENT_HUB_CONNECTION_STRING_ENV_NAME); + + private ConnectionStringProperties properties; + private TokenCredential tokenCredential; + private ReactorProvider reactorProvider; + private ConnectionOptions connectionOptions; + private TransportType transportType; + private Scheduler scheduler; + + protected IntegrationTestBase(ClientLogger logger) { + this.transportType = TransportType.AMQP; + this.logger = logger; + } + + // These are overridden because we don't use the Interceptor Manager. + @Override + @Before + public void setupTest() { + logger.info("[{}]: Performing integration test set-up.", getTestName()); + + skipIfNotRecordMode(); + + scheduler = Schedulers.newParallel("AMQPConnection"); + properties = new ConnectionStringProperties(getConnectionString()); + reactorProvider = new ReactorProvider(); + + try { + tokenCredential = new EventHubSharedAccessKeyCredential(properties.getSharedAccessKeyName(), + properties.getSharedAccessKey(), ClientConstants.TOKEN_VALIDITY); + } catch (NoSuchAlgorithmException | InvalidKeyException e) { + Assert.fail("Could not create tokenProvider :" + e); + } + + connectionOptions = new ConnectionOptions(properties.getEndpoint().getHost(), properties.getEventHubName(), + tokenCredential, getAuthorizationType(), transportType, RETRY_OPTIONS, ProxyConfiguration.SYSTEM_DEFAULTS, + scheduler); + + beforeTest(); + } + + // These are overridden because we don't use the Interceptor Manager. + @Override + @After + public void teardownTest() { + logger.info("[{}]: Performing test clean-up.", getTestName()); + afterTest(); + + if (scheduler != null) { + scheduler.dispose(); + } + + // Tear down any inline mocks to avoid memory leaks. + // https://github.com/mockito/mockito/wiki/What's-new-in-Mockito-2#mockito-2250 + Mockito.framework().clearInlineMocks(); + } + + /** + * Gets the test mode for this API test. If AZURE_TEST_MODE equals {@link TestMode#RECORD} and Event Hubs connection + * string is set, then we return {@link TestMode#RECORD}. Otherwise, {@link TestMode#PLAYBACK} is returned. + */ + @Override + public TestMode getTestMode() { + if (super.getTestMode() == TestMode.PLAYBACK) { + return TestMode.PLAYBACK; + } + + return ImplUtils.isNullOrEmpty(CONNECTION_STRING) ? TestMode.PLAYBACK : TestMode.RECORD; + } + + protected String getConnectionString() { + return CONNECTION_STRING; + } + + protected void skipIfNotRecordMode() { + Assume.assumeTrue(getTestMode() == TestMode.RECORD); + } + + protected void setTransportType(TransportType transportType) { + this.transportType = transportType; + } + + protected ConnectionOptions getConnectionOptions() { + return connectionOptions; + } + + protected ConnectionStringProperties getConnectionStringProperties() { + return properties; + } + + protected TokenCredential getTokenCredential() { + return tokenCredential; + } + + protected ReactorProvider getReactorProvider() { + return reactorProvider; + } + + protected CBSAuthorizationType getAuthorizationType() { + return CBSAuthorizationType.SHARED_ACCESS_SIGNATURE; + } + + /** + * Disposes of any {@link Closeable} resources. + * + * @param closeables The closeables to dispose of. If a closeable is {@code null}, it is skipped. + */ + protected void dispose(Closeable... closeables) { + if (closeables == null || closeables.length == 0) { + return; + } + + for (final Closeable closeable : closeables) { + if (closeable == null) { + continue; + } + + try { + closeable.close(); + } catch (IOException error) { + logger.error(String.format("[%s]: %s didn't close properly.", + getTestName(), closeable.getClass().getSimpleName()), error); + } + } + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/PartitionBasedLoadBalancerTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/PartitionBasedLoadBalancerTest.java new file mode 100644 index 000000000000..21f428c4c720 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/PartitionBasedLoadBalancerTest.java @@ -0,0 +1,417 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs.implementation; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.atLeast; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import com.azure.core.amqp.implementation.TracerProvider; +import com.azure.core.implementation.tracing.Tracer; +import com.azure.core.util.logging.ClientLogger; +import com.azure.messaging.eventhubs.EventData; +import com.azure.messaging.eventhubs.EventHubAsyncClient; +import com.azure.messaging.eventhubs.EventHubAsyncConsumer; +import com.azure.messaging.eventhubs.InMemoryPartitionManager; +import com.azure.messaging.eventhubs.PartitionManager; +import com.azure.messaging.eventhubs.PartitionProcessor; +import com.azure.messaging.eventhubs.TestUtils; +import com.azure.messaging.eventhubs.models.EventHubConsumerOptions; +import com.azure.messaging.eventhubs.models.EventPosition; +import com.azure.messaging.eventhubs.models.PartitionContext; +import com.azure.messaging.eventhubs.models.PartitionOwnership; + +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.time.Instant; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.TimeUnit; +import java.util.stream.IntStream; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Unit tests for {@link PartitionBasedLoadBalancer}. + */ +public class PartitionBasedLoadBalancerTest { + + private final String eventHubName = "test-event-hub"; + private final String consumerGroupName = "test-consumer-group"; + private final ClientLogger logger = new ClientLogger(PartitionBasedLoadBalancerTest.class); + + private List eventDataList; + private PartitionManager partitionManager; + + @Mock + private EventHubAsyncClient eventHubAsyncClient; + + @Mock + private EventHubAsyncConsumer eventHubConsumer; + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + + final Date enqueuedTime = Date.from(Instant.now()); + final byte[] contents = "Hello, world".getBytes(StandardCharsets.UTF_8); + eventDataList = new ArrayList<>(); + IntStream.range(0, 25) + .forEach(index -> { + final EventData eventData = TestUtils.getEventData(contents, (long) index, (long) index, enqueuedTime); + eventDataList.add(eventData); + }); + this.partitionManager = new InMemoryPartitionManager(); + } + + @After + public void teardown() { + // Tear down any inline mocks to avoid memory leaks. + // https://github.com/mockito/mockito/wiki/What's-new-in-Mockito-2#mockito-2250 + Mockito.framework().clearInlineMocks(); + } + + @Test + public void testSingleEventProcessor() { + List partitionIds = Arrays.asList("1", "2", "3"); + when(eventHubAsyncClient.getPartitionIds()).thenReturn(Flux.fromIterable(partitionIds)); + when(eventHubAsyncClient.createConsumer(anyString(), anyString(), any(EventPosition.class), any( + EventHubConsumerOptions.class))).thenReturn(eventHubConsumer); + + when(eventHubConsumer.receive()) + .thenReturn(Flux.interval(Duration.ofSeconds(1)).map(index -> eventDataList.get(index.intValue()))); + + PartitionBasedLoadBalancer partitionBasedLoadBalancer = createPartitionLoadBalancer("owner1"); + + IntStream.range(0, partitionIds.size()).forEach(index -> { + partitionBasedLoadBalancer.loadBalance(); + List partitionOwnership = partitionManager.listOwnership(eventHubName, + consumerGroupName).collectList().block(); + + assertNotNull(partitionOwnership); + assertEquals(index + 1, partitionOwnership.size()); + partitionOwnership.forEach(po -> assertEquals("owner1", partitionOwnership.get(0).getOwnerId())); + assertEquals(index + 1, partitionOwnership.stream().map(po -> po.getPartitionId()).distinct().count()); + }); + } + + private void sleep(int secondsToSleep) { + try { + TimeUnit.SECONDS.sleep(secondsToSleep); + } catch (InterruptedException ex) { + + } + } + + @Test + public void testTwoEventProcessors() { + List partitionIds = Arrays.asList("1", "2", "3"); + when(eventHubAsyncClient.getPartitionIds()).thenReturn(Flux.fromIterable(partitionIds)); + when(eventHubAsyncClient.createConsumer(anyString(), anyString(), any(EventPosition.class), any( + EventHubConsumerOptions.class))).thenReturn(eventHubConsumer); + when(eventHubConsumer.receive()) + .thenReturn(Flux.interval(Duration.ofSeconds(1)).map(index -> eventDataList.get(index.intValue()))); + + PartitionBasedLoadBalancer partitionBasedLoadBalancer1 = createPartitionLoadBalancer("owner1"); + PartitionBasedLoadBalancer partitionBasedLoadBalancer2 = createPartitionLoadBalancer("owner2"); + + IntStream.range(0, partitionIds.size()).forEach(index -> { + partitionBasedLoadBalancer1.loadBalance(); + partitionBasedLoadBalancer2.loadBalance(); + List partitionOwnership = partitionManager.listOwnership(eventHubName, + consumerGroupName).collectList().block(); + assertTrue(partitionOwnership.size() <= 3); + assertEquals(2, partitionOwnership.stream().map(po -> po.getOwnerId()).distinct().count()); + }); + + List partitionOwnership = partitionManager.listOwnership(eventHubName, + consumerGroupName).collectList().block(); + // because owner1 runs first, it will have the chance to claim one additional partition + assertEquals(2, partitionOwnership.stream().filter(po -> "owner1".equals(po.getOwnerId())).count()); + // after owner1 has 2 partitions and owner2 has 1 partition, owner2 runs again but this time the load + // is balanced and owner2 should not claim any additional partition + assertEquals(1, partitionOwnership.stream().filter(po -> "owner2".equals(po.getOwnerId())).count()); + } + + @Test + public void testPartitionStealing() { + List partitionIds = Arrays.asList("1", "2", "3"); + when(eventHubAsyncClient.getPartitionIds()).thenReturn(Flux.fromIterable(partitionIds)); + when(eventHubAsyncClient.createConsumer(anyString(), anyString(), any(EventPosition.class), any( + EventHubConsumerOptions.class))).thenReturn(eventHubConsumer); + + when(eventHubConsumer.receive()) + .thenReturn(Flux.interval(Duration.ofSeconds(1)).map(index -> eventDataList.get(index.intValue()))); + + PartitionBasedLoadBalancer partitionBasedLoadBalancer1 = createPartitionLoadBalancer("owner1"); + + // First event processor claims all partitions + IntStream.range(0, partitionIds.size()).forEach(index -> { + partitionBasedLoadBalancer1.loadBalance(); + List partitionOwnership = partitionManager.listOwnership(eventHubName, + consumerGroupName).collectList().block(); + assertEquals(index + 1, partitionOwnership.size()); + partitionOwnership.forEach(po -> assertEquals("owner1", partitionOwnership.get(0).getOwnerId())); + assertEquals(index + 1, + partitionOwnership.stream().map(PartitionOwnership::getPartitionId).distinct().count()); + }); + + // Now, second event processor comes online and steals a partition as the number of partitions + // are not evenly distributed + PartitionBasedLoadBalancer partitionBasedLoadBalancer2 = createPartitionLoadBalancer("owner2"); + partitionBasedLoadBalancer2.loadBalance(); + List partitionOwnership = partitionManager.listOwnership(eventHubName, + consumerGroupName).collectList().block(); + assertEquals(3, partitionOwnership.size()); + assertEquals(2, partitionOwnership.stream().map(PartitionOwnership::getOwnerId).distinct().count()); + assertEquals(2, partitionOwnership.stream().filter(po -> po.getOwnerId().equals("owner1")).count()); + assertEquals(1, partitionOwnership.stream().filter(po -> po.getOwnerId().equals("owner2")).count()); + } + + @Test + public void testMoreEventProcessorsThanPartitions() { + List partitionIds = Arrays.asList("1", "2", "3"); + when(eventHubAsyncClient.getPartitionIds()).thenReturn(Flux.fromIterable(partitionIds)); + when(eventHubAsyncClient.createConsumer(anyString(), anyString(), any(EventPosition.class), any( + EventHubConsumerOptions.class))).thenReturn(eventHubConsumer); + + when(eventHubConsumer.receive()) + .thenReturn(Flux.interval(Duration.ofSeconds(1)).map(index -> eventDataList.get(index.intValue()))); + + List loadBalancers = new ArrayList<>(); + IntStream.range(0, 4).forEach(index -> loadBalancers.add(createPartitionLoadBalancer("owner" + index))); + + IntStream.range(0, partitionIds.size()).forEach(index -> { + loadBalancers.forEach(lb -> lb.loadBalance()); + List partitionOwnership = partitionManager.listOwnership(eventHubName, + consumerGroupName).collectList().block(); + assertTrue(partitionOwnership.size() <= 3); + assertEquals(3, partitionOwnership.stream().map(po -> po.getOwnerId()).distinct().count()); + }); + + List partitionOwnership = partitionManager.listOwnership(eventHubName, + consumerGroupName).collectList().block(); + + assertEquals(3, partitionOwnership.stream().map(po -> po.getOwnerId()).distinct().count()); + + // each should have 1 partition + assertEquals(1, partitionOwnership.stream().filter(po -> "owner0".equals(po.getOwnerId())).count()); + assertEquals(1, partitionOwnership.stream().filter(po -> "owner1".equals(po.getOwnerId())).count()); + assertEquals(1, partitionOwnership.stream().filter(po -> "owner2".equals(po.getOwnerId())).count()); + // owner4 should not be in the list + assertTrue(partitionOwnership.stream().noneMatch(po -> po.getOwnerId().equals("owner4"))); + } + + @Test + public void testEventProcessorInactive() throws Exception { + + List partitionIds = Arrays.asList("1", "2", "3"); + when(eventHubAsyncClient.getPartitionIds()).thenReturn(Flux.fromIterable(partitionIds)); + when(eventHubAsyncClient.createConsumer(anyString(), anyString(), any(EventPosition.class), any( + EventHubConsumerOptions.class))).thenReturn(eventHubConsumer); + when(eventHubConsumer.receive()) + .thenReturn(Flux.interval(Duration.ofSeconds(1)).map(index -> eventDataList.get(index.intValue()))); + List loadBalancers = new ArrayList<>(); + IntStream.range(0, 4).forEach(index -> loadBalancers.add(createPartitionLoadBalancer("owner" + index))); + + IntStream.range(0, partitionIds.size()).forEach(index -> { + loadBalancers.forEach(lb -> lb.loadBalance()); + + List partitionOwnership = partitionManager.listOwnership(eventHubName, + consumerGroupName).collectList().block(); + assertTrue(partitionOwnership.size() <= 3); + assertEquals(3, partitionOwnership.stream().map(po -> po.getOwnerId()).distinct().count()); + }); + + List partitionOwnership = partitionManager.listOwnership(eventHubName, + consumerGroupName).collectList().block(); + + assertEquals(3, partitionOwnership.stream().map(po -> po.getOwnerId()).distinct().count()); + + // each should have 1 partition + assertEquals(1, partitionOwnership.stream().filter(po -> "owner0".equals(po.getOwnerId())).count()); + assertEquals(1, partitionOwnership.stream().filter(po -> "owner1".equals(po.getOwnerId())).count()); + assertEquals(1, partitionOwnership.stream().filter(po -> "owner2".equals(po.getOwnerId())).count()); + // owner4 should not be in the list + assertTrue(partitionOwnership.stream().noneMatch(po -> po.getOwnerId().equals("owner4"))); + + sleep(6); + IntStream.range(0, loadBalancers.size()).forEach(index -> { + if (index != 1) { + // run all but 2nd load balancer + loadBalancers.get(index).loadBalance(); + } + }); + + sleep(6); + partitionOwnership = partitionManager.listOwnership(eventHubName, + consumerGroupName).collectList().block(); + + assertEquals(3, partitionOwnership.stream().map(PartitionOwnership::getOwnerId).distinct().count()); + + // each should have 1 partition + assertEquals(1, partitionOwnership.stream().filter(po -> "owner0".equals(po.getOwnerId())).count()); + assertEquals(1, partitionOwnership.stream().filter(po -> "owner2".equals(po.getOwnerId())).count()); + assertEquals(1, partitionOwnership.stream().filter(po -> "owner3".equals(po.getOwnerId())).count()); + // owner2 should not be in the list as it was stopped + assertTrue(partitionOwnership.stream().noneMatch(po -> "owner1".equals(po.getOwnerId()))); + } + + @Test + public void testReceiveFailure() throws Exception { + final Tracer tracer1 = mock(Tracer.class); + final List tracers = Arrays.asList(tracer1); + TracerProvider tracerProvider = new TracerProvider(tracers); + PartitionProcessor partitionProcessor = mock(PartitionProcessor.class); + + when(partitionProcessor.processEvent(any(PartitionContext.class), any(EventData.class))).thenReturn(Mono.error(new IllegalStateException())); + List partitionIds = Arrays.asList("1", "2", "3"); + when(eventHubAsyncClient.getPartitionIds()).thenReturn(Flux.fromIterable(partitionIds)); + when(eventHubAsyncClient.createConsumer(anyString(), anyString(), any(EventPosition.class), any( + EventHubConsumerOptions.class))).thenReturn(eventHubConsumer); + when(eventHubConsumer.receive()).thenReturn(Flux.error(new IllegalStateException())); + + PartitionPumpManager partitionPumpManager = new PartitionPumpManager(partitionManager, + () -> partitionProcessor, EventPosition.earliest(), + eventHubAsyncClient, tracerProvider); + PartitionBasedLoadBalancer loadBalancer = new PartitionBasedLoadBalancer(partitionManager, + eventHubAsyncClient, eventHubName, consumerGroupName, "owner", TimeUnit.SECONDS.toSeconds(5), + partitionPumpManager); + loadBalancer.loadBalance(); + sleep(2); + verify(partitionProcessor, never()).processEvent(any(PartitionContext.class), any(EventData.class)); + verify(partitionProcessor, times(1)).processError(any(PartitionContext.class), any(IllegalStateException.class)); + verify(eventHubConsumer, times(1)).close(); + } + + @Test + public void testPartitionManagerFailure() throws Exception { + final Tracer tracer1 = mock(Tracer.class); + final List tracers = Arrays.asList(tracer1); + TracerProvider tracerProvider = new TracerProvider(tracers); + PartitionManager partitionManager = mock(PartitionManager.class); + when(partitionManager.listOwnership(any(), any())).thenReturn(Flux.error(new Exception("Listing failed"))); + PartitionProcessor partitionProcessor = mock(PartitionProcessor.class); + when(partitionProcessor.processEvent(any(PartitionContext.class), any(EventData.class))).thenReturn(Mono.error(new IllegalStateException())); + List partitionIds = Arrays.asList("1", "2", "3"); + when(eventHubAsyncClient.getPartitionIds()).thenReturn(Flux.fromIterable(partitionIds)); + PartitionPumpManager partitionPumpManager = new PartitionPumpManager(partitionManager, + () -> partitionProcessor, EventPosition.earliest(), + eventHubAsyncClient, tracerProvider); + PartitionBasedLoadBalancer loadBalancer = new PartitionBasedLoadBalancer(partitionManager, + eventHubAsyncClient, eventHubName, consumerGroupName, "owner", TimeUnit.SECONDS.toSeconds(5), + partitionPumpManager); + loadBalancer.loadBalance(); + sleep(5); + verify(eventHubAsyncClient, atLeast(1)).getPartitionIds(); + verify(eventHubAsyncClient, never()).createConsumer(any(), any(), any()); + verify(eventHubConsumer, never()).receive(); + verify(partitionProcessor, never()).processEvent(any(PartitionContext.class), any(EventData.class)); + verify(partitionProcessor, never()).processError(any(PartitionContext.class), any(IllegalStateException.class)); + verify(eventHubConsumer, never()).close(); + } + + @Test + public void testEventHubClientFailure() throws Exception { + final Tracer tracer1 = mock(Tracer.class); + final List tracers = Arrays.asList(tracer1); + TracerProvider tracerProvider = new TracerProvider(tracers); + PartitionProcessor partitionProcessor = mock(PartitionProcessor.class); + when(partitionProcessor.processEvent(any(PartitionContext.class), any(EventData.class))).thenReturn(Mono.error(new IllegalStateException())); + List partitionIds = new ArrayList<>(); + when(eventHubAsyncClient.getPartitionIds()).thenReturn(Flux.fromIterable(partitionIds)); + PartitionPumpManager partitionPumpManager = new PartitionPumpManager(partitionManager, + () -> partitionProcessor, EventPosition.earliest(), + eventHubAsyncClient, tracerProvider); + PartitionBasedLoadBalancer loadBalancer = new PartitionBasedLoadBalancer(partitionManager, + eventHubAsyncClient, eventHubName, consumerGroupName, "owner", TimeUnit.SECONDS.toSeconds(5), + partitionPumpManager); + loadBalancer.loadBalance(); + sleep(2); + verify(eventHubAsyncClient, atLeast(1)).getPartitionIds(); + verify(eventHubAsyncClient, never()).createConsumer(any(), any(), any()); + verify(eventHubConsumer, never()).receive(); + verify(partitionProcessor, never()).processEvent(any(PartitionContext.class), any(EventData.class)); + verify(partitionProcessor, never()).processError(any(PartitionContext.class), any(IllegalStateException.class)); + verify(eventHubConsumer, never()).close(); + } + + @Test + public void testEmptyOwnerId() { + // null owner id + PartitionOwnership claim1 = new PartitionOwnership() + .setEventHubName(eventHubName) + .setConsumerGroupName(consumerGroupName) + .setPartitionId("1") + .setETag(UUID.randomUUID().toString()) + .setOwnerLevel(0) + .setLastModifiedTime(System.currentTimeMillis()); + // owner id is an empty string + PartitionOwnership claim2 = new PartitionOwnership() + .setEventHubName(eventHubName) + .setConsumerGroupName(consumerGroupName) + .setPartitionId("2") + .setETag(UUID.randomUUID().toString()) + .setOwnerLevel(0) + .setLastModifiedTime(System.currentTimeMillis()) + .setOwnerId(""); + partitionManager.claimOwnership(claim1, claim2).subscribe(); + + List partitionIds = Arrays.asList("1", "2", "3"); + when(eventHubAsyncClient.getPartitionIds()).thenReturn(Flux.fromIterable(partitionIds)); + when(eventHubAsyncClient.createConsumer(anyString(), anyString(), any(EventPosition.class), any( + EventHubConsumerOptions.class))).thenReturn(eventHubConsumer); + + when(eventHubConsumer.receive()) + .thenReturn(Flux.interval(Duration.ofSeconds(1)).map(index -> eventDataList.get(index.intValue()))); + + PartitionBasedLoadBalancer partitionBasedLoadBalancer = createPartitionLoadBalancer("owner1"); + + IntStream.range(0, partitionIds.size()).forEach(index -> { + partitionBasedLoadBalancer.loadBalance(); + }); + List partitionOwnership = partitionManager.listOwnership(eventHubName, + consumerGroupName).collectList().block(); + assertEquals(3, partitionOwnership.size()); + partitionOwnership.forEach(po -> assertEquals("owner1", partitionOwnership.get(0).getOwnerId())); + assertEquals(3, partitionOwnership.stream().map(po -> po.getPartitionId()).distinct().count()); + } + + private PartitionBasedLoadBalancer createPartitionLoadBalancer(String owner) { + final Tracer tracer1 = mock(Tracer.class); + final List tracers = Arrays.asList(tracer1); + TracerProvider tracerProvider = new TracerProvider(tracers); + PartitionPumpManager partitionPumpManager = new PartitionPumpManager(partitionManager, + () -> new PartitionProcessor() { + @Override + public Mono processEvent(PartitionContext partitionContext, EventData eventData) { + logger.info( + "Processing event: Event Hub name = {}; consumer group name = {}; partition id = {}; sequence number = {}", + partitionContext.getEventHubName(), partitionContext.getConsumerGroup(), partitionContext.getPartitionId(), + eventData.getSequenceNumber()); + return partitionContext.updateCheckpoint(eventData); + } + }, EventPosition.earliest(), eventHubAsyncClient, tracerProvider); + return new PartitionBasedLoadBalancer(partitionManager, eventHubAsyncClient, + eventHubName, consumerGroupName, owner, TimeUnit.SECONDS.toSeconds(5), partitionPumpManager); + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java index e51dafd349de..b1a0e3e3dbae 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java @@ -15,9 +15,7 @@ import java.time.OffsetDateTime; import java.time.ZoneOffset; -public class ReactorConnectionIntegrationTest extends ApiTestBase { - private ReactorHandlerProvider handlerProvider; - +public class ReactorConnectionIntegrationTest extends IntegrationTestBase { @Mock private AmqpResponseMapper responseMapper; @@ -30,17 +28,15 @@ public ReactorConnectionIntegrationTest() { } @Override - protected String testName() { + protected String getTestName() { return testName.getMethodName(); } @Override protected void beforeTest() { - skipIfNotRecordMode(); - MockitoAnnotations.initMocks(this); - handlerProvider = new ReactorHandlerProvider(getReactorProvider()); + ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(getReactorProvider()); connection = new ReactorConnection("test-connection-id", getConnectionOptions(), getReactorProvider(), handlerProvider, responseMapper); } @@ -64,9 +60,9 @@ public void getCbsNode() { public void getCbsNodeAuthorize() { // Arrange final TokenResourceProvider provider = new TokenResourceProvider(CBSAuthorizationType.SHARED_ACCESS_SIGNATURE, - getConnectionStringProperties().endpoint().getHost()); + getConnectionStringProperties().getEndpoint().getHost()); - final String tokenAudience = provider.getResourceString(getConnectionStringProperties().eventHubName()); + final String tokenAudience = provider.getResourceString(getConnectionStringProperties().getEventHubName()); // Act & Assert StepVerifier.create(connection.getCBSNode().flatMap(node -> node.authorize(tokenAudience))) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionTest.java index b31dcb1a474a..f65e450fe961 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionTest.java @@ -50,7 +50,7 @@ public class ReactorConnectionTest { private static final String SESSION_NAME = "test-session-name"; private static final Duration TEST_DURATION = Duration.ofSeconds(30); private static final ConnectionStringProperties CREDENTIAL_INFO = new ConnectionStringProperties("Endpoint=sb://test-event-hub.servicebus.windows.net/;SharedAccessKeyName=dummySharedKeyName;SharedAccessKey=dummySharedKeyValue;EntityPath=eventhub1;"); - private static final String HOSTNAME = CREDENTIAL_INFO.endpoint().getHost(); + private static final String HOSTNAME = CREDENTIAL_INFO.getEndpoint().getHost(); private static final Scheduler SCHEDULER = Schedulers.elastic(); private AmqpConnection connection; @@ -88,9 +88,9 @@ public void setup() throws IOException { sessionHandler = new SessionHandler(CONNECTION_ID, HOSTNAME, SESSION_NAME, reactorDispatcher, TEST_DURATION); reactorHandlerProvider = new MockReactorHandlerProvider(reactorProvider, connectionHandler, sessionHandler, null, null); - final RetryOptions retryOptions = new RetryOptions().tryTimeout(TEST_DURATION); - final ConnectionOptions connectionOptions = new ConnectionOptions(CREDENTIAL_INFO.endpoint().getHost(), - CREDENTIAL_INFO.eventHubName(), tokenProvider, CBSAuthorizationType.SHARED_ACCESS_SIGNATURE, + final RetryOptions retryOptions = new RetryOptions().setTryTimeout(TEST_DURATION); + final ConnectionOptions connectionOptions = new ConnectionOptions(CREDENTIAL_INFO.getEndpoint().getHost(), + CREDENTIAL_INFO.getEventHubName(), tokenProvider, CBSAuthorizationType.SHARED_ACCESS_SIGNATURE, TransportType.AMQP, retryOptions, ProxyConfiguration.SYSTEM_DEFAULTS, SCHEDULER); connection = new ReactorConnection(CONNECTION_ID, connectionOptions, reactorProvider, reactorHandlerProvider, responseMapper); } @@ -285,12 +285,12 @@ public void createCBSNodeTimeoutException() { // Arrange Duration timeout = Duration.ofSeconds(2); RetryOptions retryOptions = new RetryOptions() - .maxRetries(2) - .delay(Duration.ofMillis(200)) - .retryMode(RetryMode.FIXED) - .tryTimeout(timeout); - ConnectionOptions parameters = new ConnectionOptions(CREDENTIAL_INFO.endpoint().getHost(), - CREDENTIAL_INFO.eventHubName(), tokenProvider, CBSAuthorizationType.SHARED_ACCESS_SIGNATURE, + .setMaxRetries(2) + .setDelay(Duration.ofMillis(200)) + .setRetryMode(RetryMode.FIXED) + .setTryTimeout(timeout); + ConnectionOptions parameters = new ConnectionOptions(CREDENTIAL_INFO.getEndpoint().getHost(), + CREDENTIAL_INFO.getEventHubName(), tokenProvider, CBSAuthorizationType.SHARED_ACCESS_SIGNATURE, TransportType.AMQP, retryOptions, ProxyConfiguration.SYSTEM_DEFAULTS, Schedulers.parallel()); // Act and Assert diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/BatchOptionsTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/BatchOptionsTest.java index 43b3f7fb25b2..b4764963383c 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/BatchOptionsTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/BatchOptionsTest.java @@ -13,7 +13,7 @@ public class BatchOptionsTest { @Test public void createDefault() { BatchOptions options = new BatchOptions(); - Assert.assertNull(options.partitionKey()); + Assert.assertNull(options.getPartitionKey()); } /** @@ -24,10 +24,10 @@ public void setMaximumSize() { int size = 1024; BatchOptions options = new BatchOptions(); - options.maximumSizeInBytes(size); + options.setMaximumSizeInBytes(size); - Assert.assertEquals(size, options.maximumSizeInBytes()); - Assert.assertNull(options.partitionKey()); + Assert.assertEquals(size, options.getMaximumSizeInBytes()); + Assert.assertNull(options.getPartitionKey()); } /** @@ -38,18 +38,18 @@ public void cloneIdentical() { // Arrange String partitionKey = "My partition key"; int size = 800; - BatchOptions options = new BatchOptions().partitionKey(partitionKey).maximumSizeInBytes(size); + BatchOptions options = new BatchOptions().setPartitionKey(partitionKey).setMaximumSizeInBytes(size); // Act BatchOptions clone = options.clone(); // Assert Assert.assertNotSame(clone, options); - Assert.assertEquals(size, options.maximumSizeInBytes()); - Assert.assertEquals(partitionKey, options.partitionKey()); + Assert.assertEquals(size, options.getMaximumSizeInBytes()); + Assert.assertEquals(partitionKey, options.getPartitionKey()); - Assert.assertEquals(partitionKey, clone.partitionKey()); - Assert.assertEquals(size, clone.maximumSizeInBytes()); + Assert.assertEquals(partitionKey, clone.getPartitionKey()); + Assert.assertEquals(size, clone.getMaximumSizeInBytes()); } @@ -65,18 +65,18 @@ public void cloneModifyContents() { String partitionKey = "A new partition key"; int size = 24; - BatchOptions options = new BatchOptions().partitionKey(originalPartitionKey).maximumSizeInBytes(originalSize); + BatchOptions options = new BatchOptions().setPartitionKey(originalPartitionKey).setMaximumSizeInBytes(originalSize); BatchOptions clone = options.clone(); // Act - clone.partitionKey(partitionKey) - .maximumSizeInBytes(size); + clone.setPartitionKey(partitionKey) + .setMaximumSizeInBytes(size); // Assert - Assert.assertEquals(partitionKey, clone.partitionKey()); - Assert.assertEquals(size, clone.maximumSizeInBytes()); + Assert.assertEquals(partitionKey, clone.getPartitionKey()); + Assert.assertEquals(size, clone.getMaximumSizeInBytes()); - Assert.assertEquals(originalSize, options.maximumSizeInBytes()); - Assert.assertEquals(originalPartitionKey, options.partitionKey()); + Assert.assertEquals(originalSize, options.getMaximumSizeInBytes()); + Assert.assertEquals(originalPartitionKey, options.getPartitionKey()); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/EventHubConsumerOptionsTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/EventHubConsumerOptionsTest.java index c9b240487f2f..4214ab3559fe 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/EventHubConsumerOptionsTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/EventHubConsumerOptionsTest.java @@ -16,7 +16,7 @@ public void defaults() { final EventHubConsumerOptions options = new EventHubConsumerOptions(); // Assert - Assert.assertEquals(EventHubConsumerOptions.DEFAULT_PREFETCH_COUNT, options.prefetchCount()); + Assert.assertEquals(EventHubConsumerOptions.DEFAULT_PREFETCH_COUNT, options.getPrefetchCount()); } @Test @@ -26,18 +26,18 @@ public void invalidIdentifier() { final String longIdentifier = new String(new char[length]).replace("\0", "f"); final String identifier = "An Identifier"; final EventHubConsumerOptions options = new EventHubConsumerOptions() - .identifier(identifier); + .setIdentifier(identifier); // Act try { - options.identifier(longIdentifier); + options.setIdentifier(longIdentifier); Assert.fail("Setting this should have failed."); } catch (IllegalArgumentException e) { // This is what we expect. } // Assert - Assert.assertEquals(identifier, options.identifier()); + Assert.assertEquals(identifier, options.getIdentifier()); } @Test @@ -46,18 +46,18 @@ public void invalidPrefetchMinimum() { final int prefetch = 235; final int invalid = EventHubConsumerOptions.MINIMUM_PREFETCH_COUNT - 1; final EventHubConsumerOptions options = new EventHubConsumerOptions() - .prefetchCount(prefetch); + .setPrefetchCount(prefetch); // Act try { - options.prefetchCount(invalid); + options.setPrefetchCount(invalid); Assert.fail("Setting this should have failed."); } catch (IllegalArgumentException e) { // This is what we expect. } // Assert - Assert.assertEquals(prefetch, options.prefetchCount()); + Assert.assertEquals(prefetch, options.getPrefetchCount()); } @Test @@ -66,18 +66,18 @@ public void invalidPrefetchMaximum() { final int prefetch = 235; final int invalid = EventHubConsumerOptions.MAXIMUM_PREFETCH_COUNT + 1; final EventHubConsumerOptions options = new EventHubConsumerOptions() - .prefetchCount(prefetch); + .setPrefetchCount(prefetch); // Act try { - options.prefetchCount(invalid); + options.setPrefetchCount(invalid); Assert.fail("Setting this should have failed."); } catch (IllegalArgumentException e) { // This is what we expect. } // Assert - Assert.assertEquals(prefetch, options.prefetchCount()); + Assert.assertEquals(prefetch, options.getPrefetchCount()); } @Test @@ -86,17 +86,17 @@ public void invalidOwnerLevel() { final long ownerLevel = 14; final long invalidOwnerLevel = -1; final EventHubConsumerOptions options = new EventHubConsumerOptions() - .ownerLevel(ownerLevel); + .setOwnerLevel(ownerLevel); // Act try { - options.ownerLevel(invalidOwnerLevel); + options.setOwnerLevel(invalidOwnerLevel); Assert.fail("Setting this should have failed."); } catch (IllegalArgumentException e) { // This is what we expect. } // Assert - Assert.assertEquals(Long.valueOf(ownerLevel), options.ownerLevel()); + Assert.assertEquals(Long.valueOf(ownerLevel), options.getOwnerLevel()); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/EventHubProducerOptionsTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/EventHubProducerOptionsTest.java index d91bd7bbc938..ee6fae6a2140 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/EventHubProducerOptionsTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/EventHubProducerOptionsTest.java @@ -16,24 +16,24 @@ public void cloneProperties() { String partitionId = "my-partition-id"; Duration timeout = Duration.ofMinutes(10); RetryOptions retryOptions = new RetryOptions() - .tryTimeout(timeout) - .delay(Duration.ofSeconds(20)) - .maxDelay(Duration.ofSeconds(30)) - .maxRetries(3); + .setTryTimeout(timeout) + .setDelay(Duration.ofSeconds(20)) + .setMaxDelay(Duration.ofSeconds(30)) + .setMaxRetries(3); EventHubProducerOptions options = new EventHubProducerOptions(); - options.partitionId(partitionId) - .retry(retryOptions) - .partitionId(partitionId); + options.setPartitionId(partitionId) + .setRetry(retryOptions) + .setPartitionId(partitionId); // Act EventHubProducerOptions clone = options.clone(); // Assert - Assert.assertEquals(partitionId, clone.partitionId()); - Assert.assertEquals(timeout, clone.retry().tryTimeout()); - Assert.assertEquals(retryOptions, clone.retry()); + Assert.assertEquals(partitionId, clone.getPartitionId()); + Assert.assertEquals(timeout, clone.getRetry().getTryTimeout()); + Assert.assertEquals(retryOptions, clone.getRetry()); - Assert.assertNotSame(retryOptions, clone.retry()); + Assert.assertNotSame(retryOptions, clone.getRetry()); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/ProxyConfigurationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/ProxyConfigurationTest.java index f34722f9127b..7e54f0fb00a1 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/ProxyConfigurationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/ProxyConfigurationTest.java @@ -36,9 +36,9 @@ public static ProxyAuthenticationType[] proxyAuthenticationTypes() { @Test public void nullProxyConfiguration() { - Assert.assertNull(SYSTEM_DEFAULTS.authentication()); - Assert.assertNull(SYSTEM_DEFAULTS.credential()); - Assert.assertNull(SYSTEM_DEFAULTS.proxyAddress()); + Assert.assertNull(SYSTEM_DEFAULTS.getAuthentication()); + Assert.assertNull(SYSTEM_DEFAULTS.getCredential()); + Assert.assertNull(SYSTEM_DEFAULTS.getProxyAddress()); } @Theory @@ -102,11 +102,11 @@ public void testHasUserDefinedCredentials(@FromDataPoints("Proxy Configuration T } private static void validateProxyConfiguration(ProxyConfiguration proxyConfiguration, ProxyAuthenticationType proxyAuthenticationType) { - String proxyAddressStr = proxyConfiguration.proxyAddress().address().toString(); - ProxyAuthenticationType authentication = proxyConfiguration.authentication(); + String proxyAddressStr = proxyConfiguration.getProxyAddress().address().toString(); + ProxyAuthenticationType authentication = proxyConfiguration.getAuthentication(); Assert.assertEquals(HTTP_PROXY, proxyAddressStr); - Assert.assertEquals(PROXY_USERNAME, proxyConfiguration.credential().getUserName()); - Assert.assertEquals(PROXY_PASSWORD, new String(proxyConfiguration.credential().getPassword())); + Assert.assertEquals(PROXY_USERNAME, proxyConfiguration.getCredential().getUserName()); + Assert.assertEquals(PROXY_PASSWORD, new String(proxyConfiguration.getCredential().getPassword())); Assert.assertTrue(proxyAuthenticationType.equals(authentication)); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/SendOptionsTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/SendOptionsTest.java index 807969dc58a4..2bec210ce225 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/SendOptionsTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/SendOptionsTest.java @@ -17,7 +17,7 @@ public void createDefault() { SendOptions options = new SendOptions(); // Act & Assert - Assert.assertNull(options.partitionKey()); + Assert.assertNull(options.getPartitionKey()); } /** @@ -30,10 +30,10 @@ public void setPartitionKey() { SendOptions options = new SendOptions(); // Act - options.partitionKey(partitionKey); + options.setPartitionKey(partitionKey); // Assert - Assert.assertEquals(partitionKey, options.partitionKey()); + Assert.assertEquals(partitionKey, options.getPartitionKey()); } /** @@ -43,7 +43,7 @@ public void setPartitionKey() { public void cloneIdentical() { // Arrange String partitionKey = "My partition key"; - SendOptions options = new SendOptions().partitionKey(partitionKey); + SendOptions options = new SendOptions().setPartitionKey(partitionKey); // Act SendOptions clone = options.clone(); @@ -51,8 +51,8 @@ public void cloneIdentical() { // Assert Assert.assertNotSame(clone, options); - Assert.assertEquals(partitionKey, options.partitionKey()); - Assert.assertEquals(partitionKey, clone.partitionKey()); + Assert.assertEquals(partitionKey, options.getPartitionKey()); + Assert.assertEquals(partitionKey, clone.getPartitionKey()); } @@ -65,14 +65,14 @@ public void cloneModifyContents() { String originalPartitionKey = "Some partition key"; String partitionKey = "A new partition key"; - SendOptions options = new SendOptions().partitionKey(originalPartitionKey); + SendOptions options = new SendOptions().setPartitionKey(originalPartitionKey); SendOptions clone = options.clone(); // Act - clone.partitionKey(partitionKey); + clone.setPartitionKey(partitionKey); // Assert - Assert.assertEquals(partitionKey, clone.partitionKey()); - Assert.assertEquals(originalPartitionKey, options.partitionKey()); + Assert.assertEquals(partitionKey, clone.getPartitionKey()); + Assert.assertEquals(originalPartitionKey, options.getPartitionKey()); } } diff --git a/sdk/eventhubs/ci.data.yml b/sdk/eventhubs/ci.data.yml new file mode 100644 index 000000000000..efaf87c89109 --- /dev/null +++ b/sdk/eventhubs/ci.data.yml @@ -0,0 +1,49 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +resources: + repositories: + - repository: azure-sdk-build-tools + type: git + name: internal/azure-sdk-build-tools + +trigger: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/eventhubs/ + exclude: + - sdk/eventhubs/azure + +pr: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/eventhubs/ + exclude: + - sdk/eventhubs/azure + +stages: + - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: eventhubs + Artifacts: + - name: azure-eventhubs + safeName: azureeventhubs + stagingProfileId: 534d15ee3800f4 + - name: azure-eventhubs-eph + safeName: azureeventhubseph + stagingProfileId: 534d15ee3800f4 + - name: azure-eventhubs-extensions + safeName: azureeventhubsextensions + stagingProfileId: 534d15ee3800f4 diff --git a/sdk/eventhubs/ci.yml b/sdk/eventhubs/ci.yml index 9ecb29dd5ea3..6320718f126a 100644 --- a/sdk/eventhubs/ci.yml +++ b/sdk/eventhubs/ci.yml @@ -17,6 +17,8 @@ trigger: paths: include: - sdk/eventhubs/ + exclude: + - sdk/eventhubs/microsoft-azure pr: branches: @@ -28,6 +30,8 @@ pr: paths: include: - sdk/eventhubs/ + exclude: + - sdk/eventhubs/microsoft-azure stages: - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -35,4 +39,8 @@ stages: ServiceDirectory: eventhubs Artifacts: - name: azure-messaging-eventhubs - safeName: azuremessagingeventhubs \ No newline at end of file + safeName: azuremessagingeventhubs + stagingProfileId: 88192f04117501 + - name: azure-messaging-eventhubs-checkpointstore-blob + safeName: azuremessagingeventhubscheckpointstoreblob + stagingProfileId: 88192f04117501 diff --git a/sdk/eventhubs/microsoft-azure-eventhubs-eph/pom.xml b/sdk/eventhubs/microsoft-azure-eventhubs-eph/pom.xml index 61dd300dd013..d6c4cf676b40 100644 --- a/sdk/eventhubs/microsoft-azure-eventhubs-eph/pom.xml +++ b/sdk/eventhubs/microsoft-azure-eventhubs-eph/pom.xml @@ -5,16 +5,16 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - com.microsoft.azure - azure-eventhubs-clients - 3.0.0 - ../pom.data.xml + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml 4.0.0 com.microsoft.azure azure-eventhubs-eph - 3.0.0 + 3.1.0 Microsoft Azure SDK for Event Hubs Event Processor Host(EPH) EPH is built on top of the Azure Event Hubs Client and provides a number of features not present in that lower layer @@ -35,7 +35,7 @@ com.microsoft.azure azure-eventhubs - ${project.parent.version} + 3.1.0 com.microsoft.azure @@ -45,12 +45,42 @@ com.google.code.gson gson + + + junit + junit + test + + + org.slf4j + slf4j-simple + test + - com.microsoft.azure - msal4j - 0.4.0-preview - test + com.microsoft.azure + msal4j + 0.4.0-preview + test + + + com.microsoft.azure + adal4j + test + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + true + true + + + + diff --git a/sdk/eventhubs/microsoft-azure-eventhubs-extensions/pom.xml b/sdk/eventhubs/microsoft-azure-eventhubs-extensions/pom.xml index 9dcf397d18dd..0b34d51522a2 100644 --- a/sdk/eventhubs/microsoft-azure-eventhubs-extensions/pom.xml +++ b/sdk/eventhubs/microsoft-azure-eventhubs-extensions/pom.xml @@ -5,15 +5,16 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - com.microsoft.azure - azure-eventhubs-clients - 3.0.0 - ../pom.data.xml + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml 4.0.0 com.microsoft.azure azure-eventhubs-extensions + 3.1.0 Microsoft Azure SDK for Event Hubs Extensions Extensions built on Microsoft Azure Event Hubs @@ -34,8 +35,7 @@ com.microsoft.azure azure-eventhubs - ${project.parent.version} - compile + 3.1.0 org.apache.logging.log4j @@ -45,7 +45,43 @@ org.apache.logging.log4j log4j-core + + + junit + junit + test + + + org.slf4j + slf4j-simple + test + + + com.microsoft.azure + msal4j + 0.4.0-preview + test + + + com.microsoft.azure + adal4j + test + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + true + true + + + + diff --git a/sdk/eventhubs/microsoft-azure-eventhubs/pom.xml b/sdk/eventhubs/microsoft-azure-eventhubs/pom.xml index 0be6b248879b..7a3688b861d8 100644 --- a/sdk/eventhubs/microsoft-azure-eventhubs/pom.xml +++ b/sdk/eventhubs/microsoft-azure-eventhubs/pom.xml @@ -5,15 +5,16 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - com.microsoft.azure - azure-eventhubs-clients - 3.0.0 - ../pom.data.xml + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml 4.0.0 com.microsoft.azure azure-eventhubs + 3.1.0 Microsoft Azure SDK for Event Hubs Libraries built on Microsoft Azure Event Hubs @@ -31,6 +32,20 @@ + + org.apache.qpid + proton-j + + + com.microsoft.azure + qpid-proton-j-extensions + + + org.slf4j + slf4j-api + + + com.microsoft.azure azure-client-authentication @@ -38,22 +53,50 @@ compile - com.microsoft.azure - msal4j - 0.4.0-preview - test + com.nimbusds + nimbus-jose-jwt + 6.0.1 + - com.microsoft.azure - adal4j - ${adal4j.version} - test + junit + junit + test + + + org.slf4j + slf4j-simple + test + + + com.microsoft.azure + msal4j + test + + + com.microsoft.azure + adal4j + test - com.nimbusds - nimbus-jose-jwt - 6.0.1 + org.mockito + mockito-core + test + + + + + + + + + + + + + + diff --git a/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/EventHubClient.java b/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/EventHubClient.java index d21eb20f7d4a..8818a1b71193 100644 --- a/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/EventHubClient.java +++ b/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/EventHubClient.java @@ -50,6 +50,26 @@ static EventHubClient createFromConnectionStringSync(final String connectionStri return ExceptionUtil.syncWithIOException(() -> createFromConnectionString(connectionString, retryPolicy, executor).get()); } + /** + * Synchronous version of {@link #createFromConnectionString(String, RetryPolicy, ScheduledExecutorService, ProxyConfiguration)}. + * + * @param connectionString The connection string to be used. See {@link ConnectionStringBuilder} to construct a connectionString. + * @param retryPolicy A custom {@link RetryPolicy} to be used when communicating with EventHub. + * @param executor An {@link ScheduledExecutorService} to run all tasks performed by {@link EventHubClient}. + * @param configuration The proxy configuration for this EventHubClient connection; {@code null} or + * {@link ProxyConfiguration#SYSTEM_DEFAULTS} if the system configured proxy settings should be used. + * @return EventHubClient which can be used to create Senders and Receivers to EventHub + * @throws EventHubException If Service Bus service encountered problems during connection creation. + * @throws IOException If the underlying Proton-J layer encounter network errors. + */ + static EventHubClient createFromConnectionStringSync(final String connectionString, final RetryPolicy retryPolicy, + final ScheduledExecutorService executor, + final ProxyConfiguration configuration) + throws EventHubException, IOException { + return ExceptionUtil.syncWithIOException(() -> createFromConnectionString(connectionString, retryPolicy, executor, configuration).get()); + } + + /** * Factory method to create an instance of {@link EventHubClient} using the supplied connectionString. * In a normal scenario (when re-direct is not enabled) - one EventHubClient instance maps to one Connection to the Azure ServiceBus EventHubs service. @@ -81,7 +101,29 @@ static CompletableFuture createFromConnectionString(final String static CompletableFuture createFromConnectionString( final String connectionString, final RetryPolicy retryPolicy, final ScheduledExecutorService executor) throws EventHubException, IOException { - return EventHubClientImpl.create(connectionString, retryPolicy, executor); + return EventHubClientImpl.create(connectionString, retryPolicy, executor, null); + } + + /** + * Factory method to create an instance of {@link EventHubClient} using the supplied {@code connectionString}. One + * EventHubClient instance maps to one connection to the Event Hubs service. + * + *

+ * The {@link EventHubClient} created from this method creates a Sender instance internally, which is used by + * the {@link #send(EventData)} methods. + *

+ * @param connectionString The connection string to be used. See {@link ConnectionStringBuilder} to construct a connectionString. + * @param retryPolicy A custom {@link RetryPolicy} to be used when communicating with EventHub. + * @param executor An {@link ScheduledExecutorService} to run all tasks performed by {@link EventHubClient}. + * @param proxyConfiguration The proxy configuration for this EventHubClient connection; {@code null} or + * {@link ProxyConfiguration#SYSTEM_DEFAULTS} if the system configured proxy settings should be used. + * @return CompletableFuture{@literal } which can be used to create Senders and Receivers to EventHub. + * @throws IOException If the underlying Proton-J layer encounter network errors. + */ + static CompletableFuture createFromConnectionString( + final String connectionString, final RetryPolicy retryPolicy, final ScheduledExecutorService executor, + final ProxyConfiguration proxyConfiguration) throws IOException { + return EventHubClientImpl.create(connectionString, retryPolicy, executor, proxyConfiguration); } /** @@ -94,7 +136,7 @@ static CompletableFuture createFromConnectionString( * @param authCallback A callback which returns a JSON Web Token obtained from AAD. * @param authority Address of the AAD authority to issue the token. * @param executor An {@link ScheduledExecutorService} to run all tasks performed by {@link EventHubClient}. - * @param options Options {@link EventHubClientOptions} for creating the client. Uses all defaults if null. + * @param options Options {@link EventHubClientOptions} for creating the client. Uses all defaults if null. * @return EventHubClient which can be used to create Senders and Receivers to EventHub * @throws EventHubException If the EventHubs service encountered problems during connection creation. * @throws IOException If the underlying Proton-J layer encounter network errors. @@ -109,7 +151,7 @@ static CompletableFuture createWithAzureActiveDirectory( ITokenProvider tokenProvider = new AzureActiveDirectoryTokenProvider(authCallback, authority, null); return createWithTokenProvider(endpointAddress, eventHubName, tokenProvider, executor, options); } - + /** * Factory method to create an instance of {@link EventHubClient} using the supplied namespace endpoint address, eventhub name and authentication mechanism. * In a normal scenario (when re-direct is not enabled) - one EventHubClient instance maps to one Connection to the Azure ServiceBus EventHubs service. @@ -119,7 +161,7 @@ static CompletableFuture createWithAzureActiveDirectory( * @param eventHubName EventHub name * @param tokenProvider The {@link ITokenProvider} implementation to be used to authenticate * @param executor An {@link ScheduledExecutorService} to run all tasks performed by {@link EventHubClient}. - * @param options Options {@link EventHubClientOptions} for creating the client. Uses all defaults if null. + * @param options Options {@link EventHubClientOptions} for creating the client. Uses all defaults if null. * @return EventHubClient which can be used to create Senders and Receivers to EventHub * @throws EventHubException If the EventHubs service encountered problems during connection creation. * @throws IOException If the underlying Proton-J layer encounter network errors. diff --git a/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/EventHubClientOptions.java b/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/EventHubClientOptions.java index 4651f7415b6d..1bade3a979c5 100644 --- a/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/EventHubClientOptions.java +++ b/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/EventHubClientOptions.java @@ -13,13 +13,14 @@ public class EventHubClientOptions { private Duration operationTimeout = null; private TransportType transportType = null; private RetryPolicy retryPolicy = null; + private ProxyConfiguration proxyConfiguration = null; /** * Create with all defaults */ public EventHubClientOptions() { } - + /** * Set the operation timeout. * @param operationTimeout new operation timeout, null to unset any previous value @@ -29,7 +30,7 @@ public EventHubClientOptions setOperationTimeout(Duration operationTimeout) { this.operationTimeout = operationTimeout; return this; } - + /** * Get the operation timeout. * @return operation timeout or null if not set @@ -37,7 +38,7 @@ public EventHubClientOptions setOperationTimeout(Duration operationTimeout) { public Duration getOperationTimeout() { return this.operationTimeout; } - + /** * Set the {@link TransportType} for the connection to the Event Hubs service * @param transportType new transport type, null to unset any previous value @@ -47,7 +48,7 @@ public EventHubClientOptions setTransportType(TransportType transportType) { this.transportType = transportType; return this; } - + /** * Get the transport type * @return {@link TransportType} or null if not set @@ -55,7 +56,7 @@ public EventHubClientOptions setTransportType(TransportType transportType) { public TransportType getTransportType() { return this.transportType; } - + /** * Set the {@link RetryPolicy} for operations * @param retryPolicy new retry policy, null to unset any previous value @@ -65,7 +66,7 @@ public EventHubClientOptions setRetryPolicy(RetryPolicy retryPolicy) { this.retryPolicy = retryPolicy; return this; } - + /** * Get the retry policy * @return {@link RetryPolicy} or null if not set @@ -73,4 +74,24 @@ public EventHubClientOptions setRetryPolicy(RetryPolicy retryPolicy) { public RetryPolicy getRetryPolicy() { return this.retryPolicy; } + + /** + * Sets the proxy configuration for the client options. + * + * @param proxyConfiguration The proxy configuration to set on the options. + * @return The updated options object. + */ + public EventHubClientOptions setProxyConfiguration(ProxyConfiguration proxyConfiguration) { + this.proxyConfiguration = proxyConfiguration; + return this; + } + + /** + * Gets the proxy configuration for this set of options. + * + * @return Gets the proxy configuration. + */ + public ProxyConfiguration getProxyConfiguration() { + return proxyConfiguration; + } } diff --git a/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/ProxyConfiguration.java b/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/ProxyConfiguration.java new file mode 100644 index 000000000000..bcdb992f7ec6 --- /dev/null +++ b/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/ProxyConfiguration.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.eventhubs; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.net.PasswordAuthentication; +import java.util.Arrays; +import java.util.Objects; + +public class ProxyConfiguration implements AutoCloseable { + private static final Logger LOGGER = LoggerFactory.getLogger(ProxyConfiguration.class); + + private final java.net.Proxy proxyAddress; + private final ProxyAuthenticationType authentication; + private final PasswordAuthentication credentials; + + /** + * Gets the system defaults for proxy configuration and authentication. + */ + public static final ProxyConfiguration SYSTEM_DEFAULTS = new ProxyConfiguration(); + + /** + * Creates a proxy configuration that uses the system-wide proxy configuration and authenticator. + */ + private ProxyConfiguration() { + this.authentication = null; + this.credentials = null; + this.proxyAddress = null; + } + + /** + * Creates a proxy configuration that uses the {@code proxyAddress} and authenticates with provided + * {@code username}, {@code password} and {@code authentication}. + * + * @param authentication Authentication method to preemptively use with proxy. + * @param proxyAddress Proxy to use. If {@code null} is passed in, then the system configured {@link java.net.Proxy} + * is used. + * @param username Optional. Username used to authenticate with proxy. If not specified, the system-wide + * {@link java.net.Authenticator} is used to fetch credentials. + * @param password Optional. Password used to authenticate with proxy. + * + * @throws NullPointerException if {@code authentication} is {@code null}. + * @throws IllegalArgumentException if {@code authentication} is {@link ProxyAuthenticationType#BASIC} or + * {@link ProxyAuthenticationType#DIGEST} and {@code username} or {@code password} are {@code null}. + */ + public ProxyConfiguration(ProxyAuthenticationType authentication, java.net.Proxy proxyAddress, String username, String password) { + Objects.requireNonNull(authentication); + + this.proxyAddress = proxyAddress; + this.authentication = authentication; + + if (username != null && password != null) { + this.credentials = new PasswordAuthentication(username, password.toCharArray()); + } else { + if (LOGGER.isInfoEnabled()) { + LOGGER.info("username or password is null. Using system-wide authentication."); + } + + this.credentials = null; + } + } + + /** + * Gets the proxy address. + * + * @return The proxy address. Returns {@code null} if user creates proxy credentials with + * {@link ProxyConfiguration#SYSTEM_DEFAULTS}. + */ + public java.net.Proxy proxyAddress() { + return proxyAddress; + } + + /** + * Gets credentials to authenticate against proxy with. + * + * @return The credentials to authenticate against proxy with. Returns {@code null} if no credentials were set. This + * occurs when user uses {@link ProxyConfiguration#SYSTEM_DEFAULTS}. + */ + public PasswordAuthentication credentials() { + return credentials; + } + + /** + * Gets the proxy authentication type to use. + * + * @return The proxy authentication type to use. returns {@code null} if no authentication type was set. This occurs + * when user uses {@link ProxyConfiguration#SYSTEM_DEFAULTS}. + */ + public ProxyAuthenticationType authentication() { + return authentication; + } + + /** + * Gets whether the user has defined credentials. + * + * @return true if the user has defined the credentials to use, false otherwise. + */ + public boolean hasUserDefinedCredentials() { + return credentials != null; + } + + /** + * Gets whether the proxy address has been configured. Used to determine whether to use system-defined or + * user-defined proxy. + * + * @return true if the proxy url has been set, and false otherwise. + */ + public boolean isProxyAddressConfigured() { + return proxyAddress != null && proxyAddress.address() != null; + } + + @Override + public void close() { + // It is up to us to clear the password field when we are done using it. + if (credentials != null) { + Arrays.fill(credentials.getPassword(), '\0'); + } + } + + /** + * Supported methods of proxy authentication. + */ + public enum ProxyAuthenticationType { + /** + * Proxy requires no authentication. Service calls will fail if proxy demands authentication. + */ + NONE, + /** + * Authenticates against proxy with basic authentication scheme. + */ + BASIC, + /** + * Authenticates against proxy with digest access authentication. + */ + DIGEST, + } +} diff --git a/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/ConnectionHandler.java b/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/ConnectionHandler.java index 1e8bf4c60685..d9446a47ca5b 100644 --- a/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/ConnectionHandler.java +++ b/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/ConnectionHandler.java @@ -3,6 +3,7 @@ package com.microsoft.azure.eventhubs.impl; +import com.microsoft.azure.eventhubs.ProxyConfiguration; import com.microsoft.azure.eventhubs.TransportType; import org.apache.qpid.proton.Proton; import org.apache.qpid.proton.amqp.Symbol; @@ -36,11 +37,13 @@ protected ConnectionHandler(final AmqpConnection amqpConnection, final String co this.connectionId = connectionId; } - static ConnectionHandler create(TransportType transportType, AmqpConnection amqpConnection, String connectionId) { + static ConnectionHandler create(TransportType transportType, AmqpConnection amqpConnection, String connectionId, + ProxyConfiguration proxyConfiguration) { switch (transportType) { case AMQP_WEB_SOCKETS: - if (WebSocketProxyConnectionHandler.shouldUseProxy(amqpConnection.getHostName())) { - return new WebSocketProxyConnectionHandler(amqpConnection); + if (proxyConfiguration != null && proxyConfiguration.isProxyAddressConfigured() + || WebSocketProxyConnectionHandler.shouldUseProxy(amqpConnection.getHostName())) { + return new WebSocketProxyConnectionHandler(amqpConnection, proxyConfiguration); } else { return new WebSocketConnectionHandler(amqpConnection); } diff --git a/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/EventHubClientImpl.java b/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/EventHubClientImpl.java index bbc0885d331c..7e1f0a4d2a85 100644 --- a/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/EventHubClientImpl.java +++ b/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/EventHubClientImpl.java @@ -17,6 +17,7 @@ import com.microsoft.azure.eventhubs.PartitionReceiver; import com.microsoft.azure.eventhubs.PartitionRuntimeInformation; import com.microsoft.azure.eventhubs.PartitionSender; +import com.microsoft.azure.eventhubs.ProxyConfiguration; import com.microsoft.azure.eventhubs.ReceiverOptions; import com.microsoft.azure.eventhubs.RetryPolicy; import com.microsoft.azure.eventhubs.impl.MessagingFactory.MessagingFactoryBuilder; @@ -60,17 +61,18 @@ private EventHubClientImpl(final String eventHubName, final ScheduledExecutorSer } public static CompletableFuture create( - final String connectionString, final RetryPolicy retryPolicy, final ScheduledExecutorService executor) + final String connectionString, final RetryPolicy retryPolicy, final ScheduledExecutorService executor, + final ProxyConfiguration proxyConfiguration) throws IOException { if (StringUtil.isNullOrWhiteSpace(connectionString)) { throw new IllegalArgumentException("Connection string cannot be null or empty"); } Objects.requireNonNull(executor, "Executor cannot be null"); - + final ConnectionStringBuilder connStr = new ConnectionStringBuilder(connectionString); final EventHubClientImpl eventHubClient = new EventHubClientImpl(connStr.getEventHubName(), executor); - return MessagingFactory.createFromConnectionString(connectionString, retryPolicy, executor) + return MessagingFactory.createFromConnectionString(connectionString, retryPolicy, executor, proxyConfiguration) .thenApplyAsync(new Function() { @Override public EventHubClient apply(MessagingFactory factory) { @@ -94,12 +96,14 @@ public static CompletableFuture create( throw new IllegalArgumentException("Event hub name cannot be null or empty"); } Objects.requireNonNull(tokenProvider, "Token provider cannot be null"); - + final EventHubClientImpl eventHubClient = new EventHubClientImpl(eventHubName, executor); final MessagingFactoryBuilder builder = new MessagingFactoryBuilder(endpoint.getHost(), tokenProvider, executor); if (options != null) { - builder.setOperationTimeout(options.getOperationTimeout()).setTransportType(options.getTransportType()). - setRetryPolicy(options.getRetryPolicy()); + builder.setOperationTimeout(options.getOperationTimeout()) + .setTransportType(options.getTransportType()) + .setRetryPolicy(options.getRetryPolicy()) + .setProxyConfiguration(options.getProxyConfiguration()); } return builder.build() @@ -325,7 +329,7 @@ public CompletableFuture getPartitionRuntimeInforma (String) rawdata.get(ClientConstants.MANAGEMENT_RESULT_LAST_ENQUEUED_OFFSET), ((Date) rawdata.get(ClientConstants.MANAGEMENT_RESULT_LAST_ENQUEUED_TIME_UTC)).toInstant(), (boolean) rawdata.get(ClientConstants.MANAGEMENT_RESULT_PARTITION_IS_EMPTY)); - }, this.executor); + }, this.executor); } private CompletableFuture> addManagementToken(Map request) { diff --git a/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/MessagingFactory.java b/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/MessagingFactory.java index 20819d274133..981d686d1a94 100644 --- a/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/MessagingFactory.java +++ b/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/MessagingFactory.java @@ -10,6 +10,7 @@ import com.microsoft.azure.eventhubs.ITokenProvider; import com.microsoft.azure.eventhubs.ManagedIdentityTokenProvider; import com.microsoft.azure.eventhubs.OperationCancelledException; +import com.microsoft.azure.eventhubs.ProxyConfiguration; import com.microsoft.azure.eventhubs.RetryPolicy; import com.microsoft.azure.eventhubs.TimeoutException; import com.microsoft.azure.eventhubs.TransportType; @@ -80,7 +81,8 @@ public final class MessagingFactory extends ClientEntity implements AmqpConnecti final ITokenProvider tokenProvider, final RetryPolicy retryPolicy, final ScheduledExecutorService executor, - final ReactorFactory reactorFactory) { + final ReactorFactory reactorFactory, + final ProxyConfiguration proxyConfiguration) { super(StringUtil.getRandomString("MF"), null, executor); if (StringUtil.isNullOrWhiteSpace(hostname)) { @@ -92,14 +94,14 @@ public final class MessagingFactory extends ClientEntity implements AmqpConnecti Objects.requireNonNull(retryPolicy, "Retry policy cannot be null"); Objects.requireNonNull(executor, "Executor cannot be null"); Objects.requireNonNull(reactorFactory, "Reactor factory cannot be null"); - + this.hostName = hostname; this.reactorFactory = reactorFactory; this.operationTimeout = operationTimeout; this.retryPolicy = retryPolicy; - this.connectionHandler = ConnectionHandler.create(transportType, this, this.getClientId()); + this.connectionHandler = ConnectionHandler.create(transportType, this, this.getClientId(), proxyConfiguration); this.tokenProvider = tokenProvider; - + this.registeredLinks = new LinkedList<>(); this.reactorLock = new Object(); this.cbsChannelCreateLock = new Object(); @@ -109,21 +111,23 @@ public final class MessagingFactory extends ClientEntity implements AmqpConnecti } public static CompletableFuture createFromConnectionString(final String connectionString, final ScheduledExecutorService executor) throws IOException { - return createFromConnectionString(connectionString, null, executor); + return createFromConnectionString(connectionString, null, executor, null); } public static CompletableFuture createFromConnectionString( final String connectionString, final RetryPolicy retryPolicy, - final ScheduledExecutorService executor) throws IOException { - return createFromConnectionString(connectionString, retryPolicy, executor, null); + final ScheduledExecutorService executor, + final ProxyConfiguration proxyConfiguration) throws IOException { + return createFromConnectionString(connectionString, retryPolicy, executor, null, proxyConfiguration); } public static CompletableFuture createFromConnectionString( final String connectionString, final RetryPolicy retryPolicy, final ScheduledExecutorService executor, - final ReactorFactory reactorFactory) throws IOException { + final ReactorFactory reactorFactory, + final ProxyConfiguration proxyConfiguration) throws IOException { final ConnectionStringBuilder csb = new ConnectionStringBuilder(connectionString); ITokenProvider tokenProvider = null; if (!StringUtil.isNullOrWhiteSpace(csb.getSharedAccessSignature())) { @@ -136,11 +140,13 @@ public static CompletableFuture createFromConnectionString( throw new IllegalArgumentException("Connection string must specify a Shared Access Signature, Shared Access Key, or Managed Identity"); } - final MessagingFactoryBuilder builder = new MessagingFactoryBuilder(csb.getEndpoint().getHost(), tokenProvider, executor). - setOperationTimeout(csb.getOperationTimeout()). - setTransportType(csb.getTransportType()). - setRetryPolicy(retryPolicy). - setReactorFactory(reactorFactory); + final MessagingFactoryBuilder builder = new MessagingFactoryBuilder(csb.getEndpoint().getHost(), tokenProvider, executor) + .setOperationTimeout(csb.getOperationTimeout()) + .setTransportType(csb.getTransportType()) + .setRetryPolicy(retryPolicy) + .setReactorFactory(reactorFactory) + .setProxyConfiguration(proxyConfiguration); + return builder.build(); } @@ -149,51 +155,57 @@ public static class MessagingFactoryBuilder { private final String hostname; private final ITokenProvider tokenProvider; private final ScheduledExecutorService executor; - + // Optional parameters with defaults private Duration operationTimeout = DefaultOperationTimeout; private TransportType transportType = TransportType.AMQP; private RetryPolicy retryPolicy = RetryPolicy.getDefault(); private ReactorFactory reactorFactory = new ReactorFactory(); - + private ProxyConfiguration proxyConfiguration; + public MessagingFactoryBuilder(final String hostname, final ITokenProvider tokenProvider, final ScheduledExecutorService executor) { if (StringUtil.isNullOrWhiteSpace(hostname)) { throw new IllegalArgumentException("Endpoint hostname cannot be null or empty"); } this.hostname = hostname; - + this.tokenProvider = Objects.requireNonNull(tokenProvider); this.executor = Objects.requireNonNull(executor); } - + public MessagingFactoryBuilder setOperationTimeout(Duration operationTimeout) { if (operationTimeout != null) { this.operationTimeout = operationTimeout; } return this; } - + public MessagingFactoryBuilder setTransportType(TransportType transportType) { if (transportType != null) { this.transportType = transportType; } return this; } - + public MessagingFactoryBuilder setRetryPolicy(RetryPolicy retryPolicy) { if (retryPolicy != null) { this.retryPolicy = retryPolicy; } return this; } - + public MessagingFactoryBuilder setReactorFactory(ReactorFactory reactorFactory) { if (reactorFactory != null) { this.reactorFactory = reactorFactory; } return this; } - + + public MessagingFactoryBuilder setProxyConfiguration(ProxyConfiguration proxyConfiguration) { + this.proxyConfiguration = proxyConfiguration; + return this; + } + public CompletableFuture build() throws IOException { final MessagingFactory messagingFactory = new MessagingFactory(this.hostname, this.operationTimeout, @@ -201,7 +213,8 @@ public CompletableFuture build() throws IOException { this.tokenProvider, this.retryPolicy, this.executor, - this.reactorFactory); + this.reactorFactory, + this.proxyConfiguration); return MessagingFactory.factoryStartup(messagingFactory); } } @@ -234,7 +247,7 @@ public void run() { return messagingFactory.open; } - + @Override public String getHostName() { return this.hostName; diff --git a/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/WebSocketProxyConnectionHandler.java b/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/WebSocketProxyConnectionHandler.java index e7d512bcd3a3..e3a8853b3322 100644 --- a/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/WebSocketProxyConnectionHandler.java +++ b/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/WebSocketProxyConnectionHandler.java @@ -3,6 +3,8 @@ package com.microsoft.azure.eventhubs.impl; +import com.microsoft.azure.eventhubs.ProxyConfiguration; +import com.microsoft.azure.proton.transport.proxy.ProxyAuthenticationType; import com.microsoft.azure.proton.transport.proxy.ProxyHandler; import com.microsoft.azure.proton.transport.proxy.impl.ProxyHandlerImpl; import com.microsoft.azure.proton.transport.proxy.impl.ProxyImpl; @@ -21,13 +23,18 @@ import java.net.ProxySelector; import java.net.URI; import java.util.List; +import java.util.Objects; public class WebSocketProxyConnectionHandler extends WebSocketConnectionHandler { private static final Logger TRACE_LOGGER = LoggerFactory.getLogger(WebSocketProxyConnectionHandler.class); - private final String proxySelectorModifiedError = "ProxySelector has been modified."; + private static final String PROXY_SELECTOR_HAS_BEEN_MODIFIED = "ProxySelector has been modified."; + private final ProxyConfiguration proxyConfiguration; public static Boolean shouldUseProxy(final String hostName) { + Objects.requireNonNull(hostName); + final URI uri = createURIFromHostNamePort(hostName, ClientConstants.HTTPS_PORT); + final ProxySelector proxySelector = ProxySelector.getDefault(); if (proxySelector == null) { return false; @@ -37,15 +44,26 @@ public static Boolean shouldUseProxy(final String hostName) { return isProxyAddressLegal(proxies); } - public WebSocketProxyConnectionHandler(AmqpConnection amqpConnection) { + /** + * Creates a WebSocket proxy connection handler for the {@code amqpConnection} and {@code proxyConfiguration}. + * + * @param amqpConnection AMQP connection to the service. + * @param proxyConfiguration Required. Proxy configuration to use. + * @throws NullPointerException if {@code proxyConfiguration} is {@code null}. + */ + public WebSocketProxyConnectionHandler(AmqpConnection amqpConnection, ProxyConfiguration proxyConfiguration) { super(amqpConnection); + + this.proxyConfiguration = proxyConfiguration; } @Override protected void addTransportLayers(final Event event, final TransportInternal transport) { super.addTransportLayers(event, transport); - final ProxyImpl proxy = new ProxyImpl(); + final ProxyImpl proxy = proxyConfiguration != null + ? new ProxyImpl(getProtonConfiguration(proxyConfiguration)) + : new ProxyImpl(); // host name used to create proxy connect request // after creating the socket to proxy @@ -71,11 +89,13 @@ protected void notifyTransportErrors(final Event event) { final ErrorCondition errorCondition = transport.getCondition(); final String hostName = event.getReactor().getConnectionAddress(connection); final ProxySelector proxySelector = ProxySelector.getDefault(); + final boolean isProxyConfigured = proxySelector != null + || (proxyConfiguration != null && proxyConfiguration.isProxyAddressConfigured()); if (errorCondition == null || !(errorCondition.getCondition().equals(ConnectionError.FRAMING_ERROR) || errorCondition.getCondition().equals(AmqpErrorCode.PROTON_IO_ERROR)) - || proxySelector == null + || !isProxyConfigured || StringUtil.isNullOrEmpty(hostName)) { return; } @@ -93,10 +113,16 @@ protected void notifyTransportErrors(final Event event) { } final IOException ioException = reconstructIOException(errorCondition); - proxySelector.connectFailed( - createURIFromHostNamePort(this.getAmqpConnection().getHostName(), this.getProtocolPort()), - new InetSocketAddress(hostNameParts[0], port), - ioException); + final URI url = createURIFromHostNamePort(this.getAmqpConnection().getHostName(), this.getProtocolPort()); + final InetSocketAddress address = new InetSocketAddress(hostNameParts[0], port); + + if (TRACE_LOGGER.isErrorEnabled()) { + TRACE_LOGGER.error(String.format("Failed to connect to url: '%s', proxy host: '%s'", url.toString(), address.getHostString()), ioException); + } + + if (proxySelector != null) { + proxySelector.connectFailed(url, address, ioException); + } } @Override @@ -112,17 +138,21 @@ public int getRemotePort() { } private InetSocketAddress getProxyAddress() { + if (proxyConfiguration != null && proxyConfiguration.isProxyAddressConfigured()) { + return (InetSocketAddress) proxyConfiguration.proxyAddress().address(); + } + final URI serviceUri = createURIFromHostNamePort( this.getAmqpConnection().getHostName(), this.getProtocolPort()); final ProxySelector proxySelector = ProxySelector.getDefault(); if (proxySelector == null) { - throw new IllegalStateException(proxySelectorModifiedError); + throw new IllegalStateException(PROXY_SELECTOR_HAS_BEEN_MODIFIED); } final List proxies = proxySelector.select(serviceUri); if (!isProxyAddressLegal(proxies)) { - throw new IllegalStateException(proxySelectorModifiedError); + throw new IllegalStateException(PROXY_SELECTOR_HAS_BEEN_MODIFIED); } final Proxy proxy = proxies.get(0); @@ -151,4 +181,29 @@ private static IOException reconstructIOException(ErrorCondition errorCondition) // we reconstruct the IOException in this case - but, callstack is lost return new IOException(errorCondition.getDescription()); } + + private static com.microsoft.azure.proton.transport.proxy.ProxyConfiguration getProtonConfiguration(ProxyConfiguration configuration) { + final ProxyAuthenticationType type = getProtonAuthenticationType(configuration.authentication()); + final String username = configuration.hasUserDefinedCredentials() + ? configuration.credentials().getUserName() + : null; + final String password = configuration.hasUserDefinedCredentials() + ? new String(configuration.credentials().getPassword()) + : null; + + return new com.microsoft.azure.proton.transport.proxy.ProxyConfiguration(type, configuration.proxyAddress(), username, password); + } + + private static ProxyAuthenticationType getProtonAuthenticationType(ProxyConfiguration.ProxyAuthenticationType type) { + switch (type) { + case DIGEST: + return ProxyAuthenticationType.DIGEST; + case BASIC: + return ProxyAuthenticationType.BASIC; + case NONE: + return ProxyAuthenticationType.NONE; + default: + throw new IllegalArgumentException("This authentication type is unknown:" + type.name()); + } + } } diff --git a/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/exceptioncontracts/MsgFactoryOpenCloseTest.java b/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/exceptioncontracts/MsgFactoryOpenCloseTest.java index a5d32ace9776..216aa77e3674 100644 --- a/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/exceptioncontracts/MsgFactoryOpenCloseTest.java +++ b/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/exceptioncontracts/MsgFactoryOpenCloseTest.java @@ -127,7 +127,8 @@ public void verifyThreadReleaseOnMsgFactoryOpenError() throws Exception { final CompletableFuture openFuture = MessagingFactory.createFromConnectionString( connStr.toString(), null, executor, - networkOutageSimulator); + networkOutageSimulator, + null); try { openFuture.get(); Assert.fail(); diff --git a/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/impl/WebSocketProxyConnectionHandlerTest.java b/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/impl/WebSocketProxyConnectionHandlerTest.java new file mode 100644 index 000000000000..c362e774d48c --- /dev/null +++ b/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/impl/WebSocketProxyConnectionHandlerTest.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.eventhubs.impl; + +import com.microsoft.azure.eventhubs.ProxyConfiguration; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; + +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.net.ProxySelector; +import java.util.Collections; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.argThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + +public class WebSocketProxyConnectionHandlerTest { + private static final InetSocketAddress PROXY_ADDRESS = InetSocketAddress.createUnresolved("foo.proxy.com", 3138); + private static final Proxy PROXY = new Proxy(Proxy.Type.HTTP, PROXY_ADDRESS); + private static final String USERNAME = "test-user"; + private static final String PASSWORD = "test-password"; + + private ProxySelector originalProxySelector; + private ProxySelector proxySelector; + + /** + * Creates mocks of the proxy selector and authenticator and sets them as defaults. + */ + @Before + public void setup() { + originalProxySelector = ProxySelector.getDefault(); + + proxySelector = mock(ProxySelector.class, Mockito.CALLS_REAL_METHODS); + ProxySelector.setDefault(proxySelector); + } + + @After + public void teardown() { + ProxySelector.setDefault(originalProxySelector); + } + + /** + * Verifies that if no proxy configuration is set, then it will use the system configured proxy. + */ + @Test + public void noProxySelected() { + // Arrange + final String host = "foo.eventhubs.azure.com"; + final AmqpConnection connection = mock(AmqpConnection.class); + + when(connection.getHostName()).thenReturn(host); + when(proxySelector.select(argThat(u -> u.getHost().equals(host)))) + .thenReturn(Collections.singletonList(PROXY)); + + final WebSocketProxyConnectionHandler handler = new WebSocketProxyConnectionHandler(connection, null); + + // Act and Assert + Assert.assertEquals(PROXY_ADDRESS.getHostName(), handler.getRemoteHostName()); + Assert.assertEquals(PROXY_ADDRESS.getPort(), handler.getRemotePort()); + } + + /** + * Verifies that if we use the system proxy configuration, then it will use the system configured proxy. + */ + @Test + public void systemProxyConfigurationSelected() { + // Arrange + final String host = "foo.eventhubs.azure.com"; + final AmqpConnection connection = mock(AmqpConnection.class); + + when(connection.getHostName()).thenReturn(host); + when(proxySelector.select(argThat(u -> u.getHost().equals(host)))) + .thenReturn(Collections.singletonList(PROXY)); + + final WebSocketProxyConnectionHandler handler = new WebSocketProxyConnectionHandler(connection, ProxyConfiguration.SYSTEM_DEFAULTS); + + // Act and Assert + Assert.assertEquals(PROXY_ADDRESS.getHostName(), handler.getRemoteHostName()); + Assert.assertEquals(PROXY_ADDRESS.getPort(), handler.getRemotePort()); + + verify(proxySelector, times(2)) + .select(argThat(u -> u.getHost().equals(host))); + } + + /** + * Verifies that if we use the proxy configuration. + */ + @Test + public void proxyConfigurationSelected() { + // Arrange + final InetSocketAddress address = InetSocketAddress.createUnresolved("my-new.proxy.com", 8888); + final Proxy newProxy = new Proxy(Proxy.Type.HTTP, address); + final ProxyConfiguration configuration = new ProxyConfiguration(ProxyConfiguration.ProxyAuthenticationType.BASIC, newProxy, USERNAME, PASSWORD); + final String host = "foo.eventhubs.azure.com"; + final AmqpConnection connection = mock(AmqpConnection.class); + + when(connection.getHostName()).thenReturn(host); + when(proxySelector.select(any())).thenReturn(Collections.singletonList(PROXY)); + + final WebSocketProxyConnectionHandler handler = new WebSocketProxyConnectionHandler(connection, configuration); + + // Act and Assert + Assert.assertEquals(address.getHostName(), handler.getRemoteHostName()); + Assert.assertEquals(address.getPort(), handler.getRemotePort()); + + verifyZeroInteractions(proxySelector); + } + + @Test + public void shouldUseProxyNoLegalProxyAddress() { + // Arrange + final String host = "foo.eventhubs.azure.com"; + + when(proxySelector.select(argThat(u -> u.getHost().equals(host)))) + .thenReturn(Collections.emptyList()); + + // Act and Assert + Assert.assertFalse(WebSocketProxyConnectionHandler.shouldUseProxy(host)); + } + + @Test(expected = NullPointerException.class) + public void shouldUseProxyHostNull() { + WebSocketProxyConnectionHandler.shouldUseProxy(null); + } + + @Test + public void shouldUseProxyNullProxySelector() { + // Arrange + final String host = "foo.eventhubs.azure.com"; + ProxySelector.setDefault(null); + + // Act and Assert + Assert.assertFalse(WebSocketProxyConnectionHandler.shouldUseProxy(host)); + } +} diff --git a/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/lib/ApiTestBase.java b/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/lib/ApiTestBase.java index 52ff58cc6a39..a19723f70cc1 100644 --- a/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/lib/ApiTestBase.java +++ b/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/lib/ApiTestBase.java @@ -3,14 +3,56 @@ package com.microsoft.azure.eventhubs.lib; +import com.microsoft.azure.eventhubs.ProxyConfiguration; import org.junit.Assume; import org.junit.BeforeClass; +import java.net.InetSocketAddress; +import java.net.Proxy; + public class ApiTestBase extends TestBase { + // These environment variables are to test proxy support. + // Environment name is from BaseConfiguration.java + private static final String PROXY_ADDRESS_ENV_NAME = "AZURE_HTTP_PROXY"; + private static final String PROXY_AUTH_TYPE_ENV_NAME = "AZURE_PROXY_AUTH"; + private static final String PROXY_USERNAME = "AZURE_PROXY_USERNAME"; + private static final String PROXY_PASSWORD = "AZURE_PROXY_PASSWORD"; @BeforeClass public static void skipIfNotConfigured() { - Assume.assumeTrue(TestContext.isTestConfigurationSet()); } + + /** + * Gets the configured ProxyConfiguration. + */ + public ProxyConfiguration getProxyConfiguration() { + final String address = System.getenv(PROXY_ADDRESS_ENV_NAME); + + if (address == null) { + return null; + } + + final String[] hostPort = address.split(":"); + if (hostPort.length < 2) { + this.logger.info(PROXY_ADDRESS_ENV_NAME + " cannot be parsed into a proxy"); + return null; + } + + final String host = hostPort[0]; + final int port = Integer.parseInt(hostPort[1]); + final Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(host, port)); + + final String username = System.getenv(PROXY_USERNAME); + + if (username == null) { + return new ProxyConfiguration(ProxyConfiguration.ProxyAuthenticationType.NONE, proxy, null, null); + } + + final ProxyConfiguration.ProxyAuthenticationType authenticationType = + ProxyConfiguration.ProxyAuthenticationType.valueOf(System.getenv(PROXY_AUTH_TYPE_ENV_NAME)); + final String password = System.getenv(PROXY_PASSWORD); + + return new ProxyConfiguration(authenticationType, proxy, username, password); + } } diff --git a/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/lib/TestBase.java b/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/lib/TestBase.java index 22a44c019665..ffe198658ae7 100644 --- a/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/lib/TestBase.java +++ b/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/lib/TestBase.java @@ -14,8 +14,8 @@ import java.util.function.Function; /** - * all tests derive from this base - provides common functionality - * - provides a way to checkout EventHub for each test to exclusively run with + * all tests derive from this base - provides common functionality - provides a way to checkout EventHub for each test + * to exclusively run with */ public abstract class TestBase { protected final Logger logger; @@ -29,20 +29,19 @@ protected TestBase(Logger logger) { } public static CompletableFuture pushEventsToPartition(final EventHubClient ehClient, final String partitionId, final int noOfEvents) - throws EventHubException { + throws EventHubException { return ehClient.createPartitionSender(partitionId) - .thenComposeAsync(new Function>() { - @Override - public CompletableFuture apply(PartitionSender pSender) { - @SuppressWarnings("unchecked") - final CompletableFuture[] sends = new CompletableFuture[noOfEvents]; - for (int count = 0; count < noOfEvents; count++) { - final EventData sendEvent = EventData.create("test string".getBytes()); - sends[count] = pSender.send(sendEvent); - } - - return CompletableFuture.allOf(sends); + .thenComposeAsync(new Function>() { + @Override + public CompletableFuture apply(PartitionSender pSender) { + @SuppressWarnings("unchecked") final CompletableFuture[] sends = new CompletableFuture[noOfEvents]; + for (int count = 0; count < noOfEvents; count++) { + final EventData sendEvent = EventData.create("test string".getBytes()); + sends[count] = pSender.send(sendEvent); } - }); + + return CompletableFuture.allOf(sends); + } + }); } } diff --git a/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/proxy/ProxyConfigurationTest.java b/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/proxy/ProxyConfigurationTest.java new file mode 100644 index 000000000000..6f3d85bfa39b --- /dev/null +++ b/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/proxy/ProxyConfigurationTest.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.eventhubs.proxy; + +import com.microsoft.azure.proton.transport.proxy.ProxyAuthenticationType; +import com.microsoft.azure.proton.transport.proxy.ProxyConfiguration; +import org.junit.Assert; +import org.junit.Test; +import org.junit.experimental.theories.DataPoints; +import org.junit.experimental.theories.FromDataPoints; +import org.junit.experimental.theories.Theories; +import org.junit.experimental.theories.Theory; +import org.junit.runner.RunWith; + +import java.net.InetSocketAddress; +import java.net.Proxy; + +@RunWith(value = Theories.class) +public class ProxyConfigurationTest { + private static final String USERNAME = "test-user"; + private static final String PASSWORD = "test-password!"; + private static final char[] PASSWORD_CHARS = PASSWORD.toCharArray(); + private static final InetSocketAddress PROXY_ADDRESS = InetSocketAddress.createUnresolved("foo.proxy.com", 3138); + private static final Proxy PROXY = new Proxy(Proxy.Type.HTTP, PROXY_ADDRESS); + private static final ProxyAuthenticationType AUTHENTICATION_TYPE = ProxyAuthenticationType.BASIC; + + @DataPoints("userConfigurations") + public static ProxyConfiguration[] userConfigurations() { + return new ProxyConfiguration[]{ + new ProxyConfiguration(AUTHENTICATION_TYPE, PROXY, null, PASSWORD), + new ProxyConfiguration(AUTHENTICATION_TYPE, PROXY, USERNAME, null), + new ProxyConfiguration(AUTHENTICATION_TYPE, PROXY, null, null), + }; + } + + @Test + public void systemConfiguredConfiguration() { + ProxyConfiguration configuration = ProxyConfiguration.SYSTEM_DEFAULTS; + + Assert.assertFalse(configuration.isProxyAddressConfigured()); + Assert.assertFalse(configuration.hasUserDefinedCredentials()); + + Assert.assertNull(configuration.proxyAddress()); + Assert.assertNull(configuration.credentials()); + Assert.assertNull(configuration.authentication()); + } + + @Test + public void userDefinedConfiguration() { + ProxyConfiguration configuration = new ProxyConfiguration(AUTHENTICATION_TYPE, PROXY, USERNAME, PASSWORD); + + Assert.assertTrue(configuration.isProxyAddressConfigured()); + Assert.assertTrue(configuration.hasUserDefinedCredentials()); + + Assert.assertEquals(AUTHENTICATION_TYPE, configuration.authentication()); + Assert.assertEquals(PROXY, configuration.proxyAddress()); + Assert.assertEquals(USERNAME, configuration.credentials().getUserName()); + Assert.assertArrayEquals(PASSWORD_CHARS, configuration.credentials().getPassword()); + } + + /** + * Verify that if the user has not provided a username or password, we cannot construct valid credentials from that. + */ + @Theory + public void userDefinedConfigurationMissingData(@FromDataPoints("userConfigurations") ProxyConfiguration configuration) { + Assert.assertTrue(configuration.isProxyAddressConfigured()); + Assert.assertFalse(configuration.hasUserDefinedCredentials()); + + Assert.assertNull(configuration.credentials()); + + Assert.assertEquals(AUTHENTICATION_TYPE, configuration.authentication()); + Assert.assertEquals(PROXY, configuration.proxyAddress()); + } + + /** + * Verify that if the user has not provided a proxy address, we will use the system-wide configured proxy. + */ + @Test + public void userDefinedConfigurationNoProxyAddress() { + ProxyAuthenticationType type = ProxyAuthenticationType.DIGEST; + ProxyConfiguration configuration = new ProxyConfiguration(type, null, USERNAME, PASSWORD); + + Assert.assertFalse(configuration.isProxyAddressConfigured()); + Assert.assertTrue(configuration.hasUserDefinedCredentials()); + + Assert.assertEquals(type, configuration.authentication()); + Assert.assertNotNull(configuration.credentials()); + + Assert.assertEquals(USERNAME, configuration.credentials().getUserName()); + Assert.assertArrayEquals(PASSWORD_CHARS, configuration.credentials().getPassword()); + } +} diff --git a/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/proxy/ProxyIntegrationTest.java b/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/proxy/ProxyIntegrationTest.java new file mode 100644 index 000000000000..eb9d1090d8e4 --- /dev/null +++ b/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/proxy/ProxyIntegrationTest.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.microsoft.azure.eventhubs.proxy; + +import com.microsoft.azure.eventhubs.ConnectionStringBuilder; +import com.microsoft.azure.eventhubs.EventData; +import com.microsoft.azure.eventhubs.EventHubClient; +import com.microsoft.azure.eventhubs.EventHubException; +import com.microsoft.azure.eventhubs.EventPosition; +import com.microsoft.azure.eventhubs.PartitionReceiver; +import com.microsoft.azure.eventhubs.PartitionSender; +import com.microsoft.azure.eventhubs.ProxyConfiguration; +import com.microsoft.azure.eventhubs.RetryPolicy; +import com.microsoft.azure.eventhubs.TransportType; +import com.microsoft.azure.eventhubs.lib.ApiTestBase; +import com.microsoft.azure.eventhubs.lib.TestContext; +import org.junit.After; +import org.junit.Assert; +import org.junit.Assume; +import org.junit.Before; +import org.junit.Test; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; + +import static java.nio.charset.StandardCharsets.UTF_8; + +public class ProxyIntegrationTest extends ApiTestBase { + private static final String PARTITION_ID = "0"; + + private EventHubClient client; + private PartitionSender sender; + + @Before + public void setup() throws IOException, EventHubException { + final ProxyConfiguration proxyConfiguration = getProxyConfiguration(); + + Assume.assumeTrue("Cannot run proxy integration tests without setting proxy configuration.", + proxyConfiguration != null); + + final ConnectionStringBuilder connectionString = TestContext.getConnectionString() + .setTransportType(TransportType.AMQP_WEB_SOCKETS); + + client = EventHubClient.createFromConnectionStringSync(connectionString.toString(), RetryPolicy.getNoRetry(), + TestContext.EXECUTOR_SERVICE, proxyConfiguration); + + sender = client.createPartitionSenderSync(PARTITION_ID); + } + + @After + public void teardown() throws ExecutionException, InterruptedException { + CompletableFuture.allOf(sender.close(), client.close()).get(); + } + + /** + * Verifies we can send events through the proxy. + */ + @Test + public void send() throws EventHubException { + sender.sendSync(EventData.create("Hello".getBytes(UTF_8))); + } + + /** + * Verifies we can receive events through the proxy. + */ + @Test + public void receive() throws EventHubException, ExecutionException, InterruptedException { + // Arrange + final int numberOfEvents = 15; + final PartitionReceiver receiver = client.createReceiverSync(EventHubClient.DEFAULT_CONSUMER_GROUP_NAME, + PARTITION_ID, EventPosition.fromStartOfStream()); + pushEventsToPartition(client, PARTITION_ID, numberOfEvents).get(); + + // Act + final Iterable received = receiver.receiveSync(15); + + // Assert + Assert.assertNotNull(received); + + final ArrayList list = new ArrayList<>(); + received.forEach(list::add); + + Assert.assertEquals(numberOfEvents, list.size()); + } +} diff --git a/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/sendrecv/AadBase.java b/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/sendrecv/AadBase.java index 83870bcf4f11..f19d8bfaf98e 100644 --- a/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/sendrecv/AadBase.java +++ b/sdk/eventhubs/microsoft-azure-eventhubs/src/test/java/com/microsoft/azure/eventhubs/sendrecv/AadBase.java @@ -67,10 +67,15 @@ protected void innerTest(final EventHubClient ehc) throws EventHubException, Int // Open a receiver final PartitionReceiver pReceiver = ehc.createReceiverSync("$Default", "0", EventPositionImpl.fromEndOfStream()); - // Open a sender and do a send. + // Do some sends via the EventHubClient + for (int i = 0; i < 50; i++) { + ehc.send(EventData.create(("blah" + i).getBytes())).get(); + } + + // Do a send via a sender final PartitionSender pSender = ehc.createPartitionSenderSync("0"); - final String testMessage = "somedata test"; - pSender.send(EventData.create(testMessage.getBytes())); + final String finalMessage = "final message"; + pSender.send(EventData.create(finalMessage.getBytes())); // Do some receives. int scanned = 0; @@ -80,7 +85,7 @@ protected void innerTest(final EventHubClient ehc) throws EventHubException, Int final Iterable events = pReceiver.receiveSync(100); for (EventData ed : events) { scanned++; - if ((new String(ed.getBytes())).equals(testMessage)) { + if ((new String(ed.getBytes())).equals(finalMessage)) { found = true; break; } diff --git a/sdk/eventhubs/pom.data.xml b/sdk/eventhubs/pom.data.xml deleted file mode 100644 index 29dd16eab970..000000000000 --- a/sdk/eventhubs/pom.data.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - com.azure - azure-data-sdk-parent - 1.1.0 - ../../pom.data.xml - - - 4.0.0 - com.microsoft.azure - azure-eventhubs-clients - pom - 3.0.0 - - Microsoft Azure Event Hubs SDK Parent - Java libraries for talking to Windows Azure Event Hubs - https://github.com/Azure/azure-sdk-for-java - - - - azure-java-build-docs - ${site.url}/site/${project.artifactId} - - - - - scm:git:https://github.com/Azure/azure-sdk-for-java - - - - - org.apache.qpid - proton-j - - - com.microsoft.azure - qpid-proton-j-extensions - - - org.slf4j - slf4j-api - - - - junit - junit - test - - - org.slf4j - slf4j-simple - test - - - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - true - true - - - - - - - microsoft-azure-eventhubs - microsoft-azure-eventhubs-eph - microsoft-azure-eventhubs-extensions - - - diff --git a/sdk/eventhubs/pom.service.xml b/sdk/eventhubs/pom.service.xml index f99125abb872..f3fed19ff2ad 100644 --- a/sdk/eventhubs/pom.service.xml +++ b/sdk/eventhubs/pom.service.xml @@ -1,20 +1,46 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.azure azure-eventhubs-service pom - 1.0.0 - - microsoft-azure-eventhubs - microsoft-azure-eventhubs-eph - microsoft-azure-eventhubs-extensions - ../core/azure-core - ../core/azure-core-test - ../core/azure-core-amqp - azure-messaging-eventhubs - + 1.0.0 + + + data + + + env.SDKTYPE + data + + + + microsoft-azure-eventhubs + microsoft-azure-eventhubs-eph + microsoft-azure-eventhubs-extensions + + + + client + + + env.SDKTYPE + !data + + + + ../core/azure-core + ../core/azure-core-test + ../core/azure-core-amqp + ../core/azure-core-http-netty + ../identity/azure-identity + ../storage/azure-storage-common + ../storage/azure-storage-blob + azure-messaging-eventhubs + azure-messaging-eventhubs-checkpointstore-blob + + + diff --git a/sdk/eventhubs/tests.yml b/sdk/eventhubs/tests.yml index e6aa03d5f6a6..50435afaddc7 100644 --- a/sdk/eventhubs/tests.yml +++ b/sdk/eventhubs/tests.yml @@ -8,3 +8,15 @@ jobs: AZURE_EVENTHUBS_CONNECTION_STRING: $(java-event-hubs-test-connection-string) AZURE_TEST_MODE: RECORD AZURE_LOG_LEVEL: 4 + AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id) + AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id) + AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret) + PRIMARY_STORAGE_ACCOUNT_NAME: $(java-storage-test-primary-account-name) + PRIMARY_STORAGE_ACCOUNT_KEY: $(java-storage-test-primary-account-key) + SECONDARY_STORAGE_ACCOUNT_NAME: $(java-storage-test-secondary-account-name) + SECONDARY_STORAGE_ACCOUNT_KEY: $(java-storage-test-secondary-account-key) + BLOB_STORAGE_ACCOUNT_NAME: $(java-storage-test-blob-account-name) + BLOB_STORAGE_ACCOUNT_KEY: $(java-storage-test-blob-account-key) + PREMIUM_STORAGE_ACCOUNT_NAME: $(java-storage-test-premium-account-name) + PREMIUM_STORAGE_ACCOUNT_KEY: $(java-storage-test-premium-account-key) + AZURE_STORAGE_ACCESS_KEY: $(java-storage-test-access-key) diff --git a/sdk/identity/azure-identity/CHANGELOG.md b/sdk/identity/azure-identity/CHANGELOG.md index 6d34d9d480db..3d8a4fb1c51b 100644 --- a/sdk/identity/azure-identity/CHANGELOG.md +++ b/sdk/identity/azure-identity/CHANGELOG.md @@ -1,5 +1,40 @@ # Release History +## 1.0.0-preview.3 (2019-09-09) +**New features** + +A new credential `SharedTokenCacheCredential` is added. It's currently only supported on Windows. This credential is capable of authenticating to Azure Active Directory if you are logged in in Visual Studio 2019. + +## 1.0.0-preview.2 (2019-08-05) +**Breaking changes** + +Credentials are now created through builders instead of setters. For example, in preview 1, a `ClientSecretCredential` can be created by +```java +ClientSecretCredential cred = new ClientSecretCredential() + .tenantId(tenant) + .clientId(clientId) + .clientSecret(secret); +``` + +In preview 2, it needs to be created through its builder: +```java +ClientSecretCredential clientSecretCredential = new ClientSecretCredentialBuilder() + .tenantId(tenant) + .clientId(clientId) + .clientSecret(secret); + .build(); +``` + +**New features** + +3 new credentials are added in preview 2, including `DeviceCodeCredential`, `InteractiveBrowserCredential` and `UsernamePasswordCredential`. + +`DeviceCodeCredential` is useful for IoT devices. `InteractiveBrowserCredential` and `UsernamePasswordCredential` are mainly used in developer scenarios, to login on a developer's computer. + +**Deprecated or removed features** + +No feature was deprecated or removed. + ## 1.0.0-preview.1 (2019-06-28) Version 1.0.0-preview.1 is a preview of our efforts in creating an authentication API for Azure SDK client libraries that is developer-friendly, idiomatic to the Java ecosystem, and as consistent across different languages and platforms as possible. The principles that guide diff --git a/sdk/identity/azure-identity/README.md b/sdk/identity/azure-identity/README.md index ee4d6ec67669..ceee34c1836a 100644 --- a/sdk/identity/azure-identity/README.md +++ b/sdk/identity/azure-identity/README.md @@ -6,8 +6,9 @@ The Azure Identity library provides Azure Active Directory token authentication - [Managed identity authentication](https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/overview) - [Device code authentication](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-device-code) - Interactive browser authentication, based on [OAuth2 authentication code](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow) + - Shared Token Cache credential, which shares login information with Visual Studio, Azure CLI, and more - [Source code][source] | API reference documentation (Coming Soon) | [Azure Active Directory documentation][aad_doc] + [Source code][source] | [API reference documentation][javadoc] | [Azure Active Directory documentation][aad_doc] ## Table of contents - [Getting started](#getting-started) @@ -16,6 +17,7 @@ The Azure Identity library provides Azure Active Directory token authentication - [Creating a Service Principal with the Azure CLI](#creating-a-service-principal-with-the-azure-cli) - [Enable applications for device code flow](#enable-applications-for-device-code-flow) - [Enable applications for interactive browser oauth 2 flow](#enable-applications-for-interactive-browser-oauth-2-flow) + - [Enable applications for shared token cache credential](#enable-applications-for-shared-token-cache-credential) - [Key concepts](#key-concepts) - [Credentials](#credentials) - [DefaultAzureCredential](#defaultazurecredential) @@ -37,7 +39,7 @@ Maven dependency for Azure Secret Client library. Add it to your project's pom f com.azure azure-identity - 1.0.0-preview.2 + 1.0.0-preview.3 ``` @@ -84,6 +86,11 @@ You may notice in `InteractiveBrowserCredentialBuilder`, a port number is requir In this case, the port number is 8765. +#### Enable applications for shared token cache credential +You will need to have Visual Studio 2019 installed. Login to Visual Studio with your org ID or live ID and you are ready to use shared token cache credential. + +If you see an error "MSAL V3 Deserialization failed", try clearing the cache in `C:\Users\{username}\AppData\.IdentityService`. + ## Key concepts ### Credentials @@ -128,7 +135,7 @@ principal authentication with these environment variables: ## Examples ### Authenticating with `DefaultAzureCredential` -This example demonstrates authenticating the `SecretClient` from the [azure-keyvault-secrets][secrets_client_library] client library using the `DefaultAzureCredential`. +This example demonstrates authenticating the `SecretClient` from the [azure-keyvault-secrets][secrets_client_library] client library using the `DefaultAzureCredential`. There's also [a compilable sample](../../keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/IdentitySamples.java) to create a Key Vault secret client you can copy-paste. ```java // The default credential first checks environment variables for configuration as described above. // If environment configuration is incomplete, it will try managed identity. @@ -140,15 +147,15 @@ DefaultAzureCredential defaultCredential = new DefaultAzureCredentialBuilder().b // Azure SDK client builders accept the credential as a parameter -SecretClient client = SecretClient.builder() +SecretClient client = new SecretClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") .credential(credential) - .build(); + .buildClient(); ``` When executing this in a development machine you need to first [configure the environment](#environment-variables) setting the variables `AZURE_CLIENT_ID`, `AZURE_TENANT_ID` and `AZURE_CLIENT_SECRET` to the appropriate values for your service principal. ### Authenticating a service principal with a client secret -This example demonstrates authenticating the `KeyClient` from the [azure-keyvault-keys][keys_client_library] client library using the `ClientSecretCredential`. +This example demonstrates authenticating the `KeyClient` from the [azure-keyvault-keys][keys_client_library] client library using the `ClientSecretCredential`. There's also [a compilable sample](../../keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/IdentitySamples.java) to create a Key Vault secret client you can copy-paste. ```java // using a client secret import com.azure.identity.credential.ClientSecretCredential; @@ -162,14 +169,14 @@ ClientSecretCredential clientSecretCredential = new ClientSecretCredentialBuilde .tenantId("") .build(); -KeyClient client = KeyClient.builder() +KeyClient client = new KeyClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") .credential(clientSecretCredential) - .build(); + .buildClient(); ``` ### Authenticating a user account with device code flow -This example demonstrates authenticating the `KeyClient` from the [azure-keyvault-keys][keys_client_library] client library using the `DeviceCodeCredential` on an IoT device. +This example demonstrates authenticating the `KeyClient` from the [azure-keyvault-keys][keys_client_library] client library using the `DeviceCodeCredential` on an IoT device. There's also [a compilable sample](../../keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/IdentitySamples.java) to create a Key Vault secret client you can copy-paste. ```java // using a client secret import com.azure.identity.credential.DeviceCodeCredential; @@ -184,23 +191,23 @@ DeviceCodeCredential deviceCodeCredential = new DeviceCodeCredentialBuilder() }) .build(); -KeyClient client = KeyClient.builder() +KeyClient client = new KeyClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") .credential(deviceCodeCredential) - .build(); + .buildClient(); ``` When the challenge is displayed on the IoT device, it will contain the message "Please open the browser to {url} and type in code XXXXXXXX". When the user follows the directions and logs in on another computer, the credential will return the token to the `KeyClient`. ### Chaining credentials -The `ChainedTokenCredential` class provides the ability to link together multiple credential instances to be tried sequentially when authenticating. The following example demonstrates creating a credential which will attempt to authenticate using managed identity, and fall back to certificate authentication if a managed identity is unavailable in the current environment. This example authenticates an `EventHubClient` from the [azure-eventhubs][eventhubs_client_library] client library using the `ChainedTokenCredential`. +The `ChainedTokenCredential` class provides the ability to link together multiple credential instances to be tried sequentially when authenticating. The following example demonstrates creating a credential which will attempt to authenticate using managed identity, and fall back to certificate authentication if a managed identity is unavailable in the current environment. This example authenticates an `EventHubClient` from the [azure-eventhubs][eventhubs_client_library] client library using the `ChainedTokenCredential`. There's also [a compilable sample](../../keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/IdentitySamples.java) to create a Key Vault secret client you can copy-paste. ```java ManagedIdentityCredential managedIdentityCredential = new ManagedIdentityCredentialBuilder() .clientId("") .build(); -ClientSecretcredential secondServicePrincipal = new ClientSecretCredentialBuilder() +ClientSecretCredential secondServicePrincipal = new ClientSecretCredentialBuilder() .clientId("") .clientSecret("") .tenantId("") @@ -253,3 +260,6 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con [secrets_client_library]: ../../keyvault/azure-keyvault-secrets [eventhubs_client_library]: ../../eventhubs/azure-messaging-eventhubs [azure_core_library]: ../../core +[javadoc]: http://azure.github.io/azure-sdk-for-java/track2reports/index.html + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/identity/azure-identity/README.png) diff --git a/sdk/identity/azure-identity/pom.xml b/sdk/identity/azure-identity/pom.xml index e2be2e9b861f..3e30061e867f 100644 --- a/sdk/identity/azure-identity/pom.xml +++ b/sdk/identity/azure-identity/pom.xml @@ -6,20 +6,28 @@ com.azure azure-identity - 1.0.0-preview.3 + 1.0.0-preview.4 + + Microsoft Azure client library for Identity + This module contains client library for Microsoft Azure Identity. + https://github.com/Azure/azure-sdk-for-java com.azure azure-client-sdk-parent - 1.3.0 + 1.4.0 ../../../pom.client.xml + + com.azure.identity + + com.azure azure-core - 1.0.0-preview.4 + 1.0.0-preview.5 com.microsoft.azure @@ -29,6 +37,10 @@ com.nimbusds oauth2-oidc-sdk + + org.nanohttpd + nanohttpd + junit @@ -50,5 +62,10 @@ powermock-api-mockito2 test + + net.java.dev.jna + jna-platform + 4.1.0 + diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/DeviceCodeChallenge.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/DeviceCodeChallenge.java index 1477db05264c..f97d8c41ccdd 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/DeviceCodeChallenge.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/DeviceCodeChallenge.java @@ -23,7 +23,8 @@ public class DeviceCodeChallenge { * @param interval interval at which the STS should be polled at * @param message message which should be displayed to the user */ - public DeviceCodeChallenge(String userCode, String deviceCode, String verificationUri, long expiresIn, long interval, String message) { + public DeviceCodeChallenge(String userCode, String deviceCode, String verificationUri, long expiresIn, + long interval, String message) { this.userCode = userCode; this.deviceCode = deviceCode; this.verificationUri = verificationUri; @@ -48,42 +49,42 @@ public DeviceCodeChallenge(String userCode, String deviceCode, String verificati /** * @return code which user needs to provide when authenticating at the verification URI. */ - public String userCode() { + public String getUserCode() { return userCode; } /** * @return code which should be included in the request for the access token. */ - public String deviceCode() { + public String getDeviceCode() { return deviceCode; } /** * @return URI where user can authenticate. */ - public String verificationUri() { + public String getVerificationUri() { return verificationUri; } /** * @return expiration time of device code. */ - public Duration expiresIn() { + public Duration getExpiresIn() { return expiresIn; } /** * @return interval at which the STS should be polled at. */ - public Duration interval() { + public Duration getInterval() { return interval; } /** * @return message which should be displayed to the user. */ - public String message() { + public String getMessage() { return message; } } diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/AadCredentialBuilderBase.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/AadCredentialBuilderBase.java index da06b7a55d55..6ab36d911e80 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/AadCredentialBuilderBase.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/AadCredentialBuilderBase.java @@ -13,18 +13,18 @@ public abstract class AadCredentialBuilderBase} itself + * @return itself */ @SuppressWarnings("unchecked") public T authorityHost(String authorityHost) { - this.identityClientOptions.authorityHost(authorityHost); + this.identityClientOptions.setAuthorityHost(authorityHost); return (T) this; } /** * Sets the client ID of the application. * @param clientId the client ID of the application. - * @return {@link } itself + * @return itself */ @SuppressWarnings("unchecked") public T clientId(String clientId) { diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/AppServiceMSICredential.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/AppServiceMSICredential.java index 892b1f0ad868..2ba4ed294b2e 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/AppServiceMSICredential.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/AppServiceMSICredential.java @@ -45,20 +45,20 @@ class AppServiceMSICredential { /** * @return the endpoint from which token needs to be retrieved. */ - public String msiEndpoint() { + public String getMsiEndpoint() { return this.msiEndpoint; } /** * @return the secret to use to retrieve the token. */ - public String msiSecret() { + public String getMsiSecret() { return this.msiSecret; } /** * @return the client id of user assigned or system assigned identity. */ - public String clientId() { + public String getClientId() { return this.clientId; } diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ChainedTokenCredential.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ChainedTokenCredential.java index 211d61a99e11..3fe4f2a95ca4 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ChainedTokenCredential.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ChainedTokenCredential.java @@ -15,7 +15,8 @@ /** * A token credential provider that can provide a credential from a list of providers. * - *

Sample: Construct a ChainedTokenCredential with silent username+password login tried first, then interactive browser login as needed (e.g. when 2FA is turned on in the directory).

+ *

Sample: Construct a ChainedTokenCredential with silent username+password login tried first, then + * interactive browser login as needed (e.g. when 2FA is turned on in the directory).

* {@codesnippet com.azure.identity.credential.chainedtokencredential.construct} */ @Immutable @@ -35,6 +36,7 @@ public Mono getToken(String... scopes) { return Flux.fromIterable(credentials) .flatMap(p -> p.getToken(scopes).onErrorResume(t -> Mono.empty())) .next() - .switchIfEmpty(Mono.error(new ClientAuthenticationException("No credential can provide a token in the chain", null))); + .switchIfEmpty(Mono.error(new ClientAuthenticationException( + "No credential can provide a token in the chain", null))); } } diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ClientCertificateCredential.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ClientCertificateCredential.java index 1d6208d4ac3e..d4e58f1b5f7d 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ClientCertificateCredential.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ClientCertificateCredential.java @@ -36,11 +36,17 @@ public class ClientCertificateCredential implements TokenCredential { * @param certificatePassword the password protecting the PFX file * @param identityClientOptions the options to configure the identity client */ - ClientCertificateCredential(String tenantId, String clientId, String certificatePath, String certificatePassword, IdentityClientOptions identityClientOptions) { + ClientCertificateCredential(String tenantId, String clientId, String certificatePath, String certificatePassword, + IdentityClientOptions identityClientOptions) { Objects.requireNonNull(certificatePath); this.clientCertificate = certificatePath; this.clientCertificatePassword = certificatePassword; - identityClient = new IdentityClientBuilder().tenantId(tenantId).clientId(clientId).identityClientOptions(identityClientOptions).build(); + identityClient = + new IdentityClientBuilder() + .tenantId(tenantId) + .clientId(clientId) + .identityClientOptions(identityClientOptions) + .build(); } @Override diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ClientCertificateCredentialBuilder.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ClientCertificateCredentialBuilder.java index 3e366ac9661d..27c44f2db71a 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ClientCertificateCredentialBuilder.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ClientCertificateCredentialBuilder.java @@ -60,6 +60,7 @@ public ClientCertificateCredential build() { put("tenantId", tenantId); put("clientCertificate", clientCertificate); }}); - return new ClientCertificateCredential(tenantId, clientId, clientCertificate, clientCertificatePassword, identityClientOptions); + return new ClientCertificateCredential(tenantId, clientId, clientCertificate, clientCertificatePassword, + identityClientOptions); } } diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ClientSecretCredential.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ClientSecretCredential.java index adaad6cc3386..b2132e82f697 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ClientSecretCredential.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ClientSecretCredential.java @@ -36,10 +36,15 @@ public class ClientSecretCredential implements TokenCredential { * @param clientSecret the secret value of the AAD application. * @param identityClientOptions the options for configuring the identity client */ - ClientSecretCredential(String tenantId, String clientId, String clientSecret, IdentityClientOptions identityClientOptions) { + ClientSecretCredential(String tenantId, String clientId, String clientSecret, + IdentityClientOptions identityClientOptions) { Objects.requireNonNull(clientSecret); Objects.requireNonNull(identityClientOptions); - identityClient = new IdentityClientBuilder().tenantId(tenantId).clientId(clientId).identityClientOptions(identityClientOptions).build(); + identityClient = new IdentityClientBuilder() + .tenantId(tenantId) + .clientId(clientId) + .identityClientOptions(identityClientOptions) + .build(); this.clientSecret = clientSecret; } diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/CredentialBuilderBase.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/CredentialBuilderBase.java index 18c8f29e3773..65f24c8efdd1 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/CredentialBuilderBase.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/CredentialBuilderBase.java @@ -22,33 +22,33 @@ public abstract class CredentialBuilderBase> /** * Specifies the max number of retries when an authentication request fails. * @param maxRetry the number of retries - * @return {@link } itself + * @return itself */ @SuppressWarnings("unchecked") public T maxRetry(int maxRetry) { - this.identityClientOptions.maxRetry(maxRetry); + this.identityClientOptions.setMaxRetry(maxRetry); return (T) this; } /** * Specifies a Function to calculate seconds of timeout on every retried request. * @param retryTimeout the Function that returns a timeout in seconds given the number of retry - * @return {@link } itself + * @return itself */ @SuppressWarnings("unchecked") public T retryTimeout(Function retryTimeout) { - this.identityClientOptions.retryTimeout(retryTimeout); + this.identityClientOptions.setRetryTimeout(retryTimeout); return (T) this; } /** * Specifies he options for proxy configuration. * @param proxyOptions the options for proxy configuration - * @return {@link } itself + * @return itself */ @SuppressWarnings("unchecked") public T proxyOptions(ProxyOptions proxyOptions) { - this.identityClientOptions.proxyOptions(proxyOptions); + this.identityClientOptions.setProxyOptions(proxyOptions); return (T) this; } } diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/DefaultAzureCredential.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/DefaultAzureCredential.java index 6f4e9e9e0c4c..1e3a81e60385 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/DefaultAzureCredential.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/DefaultAzureCredential.java @@ -20,9 +20,14 @@ public final class DefaultAzureCredential extends ChainedTokenCredential { * AZURE_CLIENT_SECRET, and AZURE_TENANT_ID environment variables to create a * ClientSecretCredential. * + * If these environment variables are not available, then this will use the Shared MSAL + * token cache. + * * @param identityClientOptions the options to configure the IdentityClient */ DefaultAzureCredential(IdentityClientOptions identityClientOptions) { - super(new ArrayDeque<>(Arrays.asList(new EnvironmentCredential(identityClientOptions), new ManagedIdentityCredential(null, identityClientOptions)))); + super(new ArrayDeque<>(Arrays.asList(new EnvironmentCredential(identityClientOptions), + new ManagedIdentityCredential(null, identityClientOptions), + new SharedTokenCacheCredential(null, "04b07795-8ddb-461a-bbee-02f9e1bf7b46", identityClientOptions)))); } } diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/DeviceCodeCredential.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/DeviceCodeCredential.java index 5afd02040291..9b537191508e 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/DeviceCodeCredential.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/DeviceCodeCredential.java @@ -32,9 +32,14 @@ public class DeviceCodeCredential implements TokenCredential { * @param deviceCodeChallengeConsumer a method allowing the user to meet the device code challenge * @param identityClientOptions the options for configuring the identity client */ - DeviceCodeCredential(String clientId, Consumer deviceCodeChallengeConsumer, IdentityClientOptions identityClientOptions) { + DeviceCodeCredential(String clientId, Consumer deviceCodeChallengeConsumer, + IdentityClientOptions identityClientOptions) { this.deviceCodeChallengeConsumer = deviceCodeChallengeConsumer; - identityClient = new IdentityClientBuilder().tenantId("common").clientId(clientId).identityClientOptions(identityClientOptions).build(); + identityClient = new IdentityClientBuilder() + .tenantId("common") + .clientId(clientId) + .identityClientOptions(identityClientOptions) + .build(); this.cachedToken = new AtomicReference<>(); } @@ -42,11 +47,13 @@ public class DeviceCodeCredential implements TokenCredential { public Mono getToken(String... scopes) { return Mono.defer(() -> { if (cachedToken.get() != null) { - return identityClient.authenticateWithUserRefreshToken(scopes, cachedToken.get()).onErrorResume(t -> Mono.empty()); + return identityClient.authenticateWithUserRefreshToken(scopes, cachedToken.get()) + .onErrorResume(t -> Mono.empty()); } else { return Mono.empty(); } - }).switchIfEmpty(Mono.defer(() -> identityClient.authenticateWithDeviceCode(scopes, deviceCodeChallengeConsumer))) + }).switchIfEmpty( + Mono.defer(() -> identityClient.authenticateWithDeviceCode(scopes, deviceCodeChallengeConsumer))) .map(msalToken -> { cachedToken.set(msalToken); return msalToken; diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/DeviceCodeCredentialBuilder.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/DeviceCodeCredentialBuilder.java index 9c8938c77c45..979ff8737339 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/DeviceCodeCredentialBuilder.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/DeviceCodeCredentialBuilder.java @@ -24,7 +24,8 @@ public class DeviceCodeCredentialBuilder extends AadCredentialBuilderBase deviceCodeChallengeConsumer) { + public DeviceCodeCredentialBuilder deviceCodeChallengeConsumer( + Consumer deviceCodeChallengeConsumer) { this.deviceCodeChallengeConsumer = deviceCodeChallengeConsumer; return this; } diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/EnvironmentCredential.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/EnvironmentCredential.java index f7c9659f30b6..6218998ce6b7 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/EnvironmentCredential.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/EnvironmentCredential.java @@ -47,7 +47,9 @@ public Mono getToken(String... scopes) { } // Other environment variables - throw logger.logExceptionAsError(new ClientAuthenticationException("Cannot create any credentials with the current environment variables", null)); + throw logger.logExceptionAsError(new ClientAuthenticationException( + "Cannot create any credentials with the current environment variables", + null)); }).flatMap(cred -> cred.getToken(scopes)); } } diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/InteractiveBrowserCredential.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/InteractiveBrowserCredential.java index 822b8fbe0135..bedf9ee22adc 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/InteractiveBrowserCredential.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/InteractiveBrowserCredential.java @@ -19,7 +19,8 @@ * authenticated, the oauth2 flow will notify the credential of the authentication code through the reply URL. * *

- * The application to authenticate to must have delegated user login permissions and have {@code http://localhost:{port}} + * The application to authenticate to must have delegated user login permissions and have {@code + * http://localhost:{port}} * listed as a valid reply URL. */ @Immutable @@ -38,7 +39,11 @@ public class InteractiveBrowserCredential implements TokenCredential { */ InteractiveBrowserCredential(String clientId, int port, IdentityClientOptions identityClientOptions) { this.port = port; - identityClient = new IdentityClientBuilder().tenantId("common").clientId(clientId).identityClientOptions(identityClientOptions).build(); + identityClient = new IdentityClientBuilder() + .tenantId("common") + .clientId(clientId) + .identityClientOptions(identityClientOptions) + .build(); cachedToken = new AtomicReference<>(); } @@ -46,7 +51,8 @@ public class InteractiveBrowserCredential implements TokenCredential { public Mono getToken(String... scopes) { return Mono.defer(() -> { if (cachedToken.get() != null) { - return identityClient.authenticateWithUserRefreshToken(scopes, cachedToken.get()).onErrorResume(t -> Mono.empty()); + return identityClient.authenticateWithUserRefreshToken(scopes, cachedToken.get()) + .onErrorResume(t -> Mono.empty()); } else { return Mono.empty(); } diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ManagedIdentityCredential.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ManagedIdentityCredential.java index 15b0e0ccf177..39675d4501f1 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ManagedIdentityCredential.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ManagedIdentityCredential.java @@ -28,7 +28,10 @@ public final class ManagedIdentityCredential implements TokenCredential { * @param identityClientOptions the options for configuring the identity client. */ ManagedIdentityCredential(String clientId, IdentityClientOptions identityClientOptions) { - IdentityClient identityClient = new IdentityClientBuilder().clientId(clientId).identityClientOptions(identityClientOptions).build(); + IdentityClient identityClient = new IdentityClientBuilder() + .clientId(clientId) + .identityClientOptions(identityClientOptions) + .build(); Configuration configuration = ConfigurationManager.getConfiguration(); if (configuration.contains(BaseConfigurations.MSI_ENDPOINT)) { appServiceMSICredential = new AppServiceMSICredential(clientId, identityClient); @@ -42,21 +45,23 @@ public final class ManagedIdentityCredential implements TokenCredential { /** * @return the client id of user assigned or system assigned identity. */ - public String clientId() { - return this.appServiceMSICredential != null ? this.appServiceMSICredential.clientId() : this.virtualMachineMSICredential.clientId(); + public String getClientId() { + return this.appServiceMSICredential != null + ? this.appServiceMSICredential.getClientId() + : this.virtualMachineMSICredential.getClientId(); } /** * @return the endpoint from which token needs to be retrieved. */ - public String msiEndpoint() { - return this.appServiceMSICredential == null ? null : this.appServiceMSICredential.msiEndpoint(); + public String getMsiEndpoint() { + return this.appServiceMSICredential == null ? null : this.appServiceMSICredential.getMsiEndpoint(); } /** * @return the secret to use to retrieve the token. */ - public String msiSecret() { - return this.appServiceMSICredential == null ? null : this.appServiceMSICredential.msiSecret(); + public String getMsiSecret() { + return this.appServiceMSICredential == null ? null : this.appServiceMSICredential.getMsiSecret(); } @Override diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/SharedTokenCacheCredential.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/SharedTokenCacheCredential.java new file mode 100644 index 000000000000..2a4751c93a9b --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/SharedTokenCacheCredential.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.credential; + +import com.azure.core.credentials.AccessToken; +import com.azure.core.credentials.TokenCredential; +import com.azure.core.util.configuration.BaseConfigurations; +import com.azure.core.util.configuration.Configuration; +import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.identity.implementation.IdentityClientOptions; +import com.azure.identity.implementation.msalextensions.PersistentTokenCacheAccessAspect; +import com.microsoft.aad.msal4j.IAccount; +import com.microsoft.aad.msal4j.IAuthenticationResult; +import com.microsoft.aad.msal4j.PublicClientApplication; +import com.microsoft.aad.msal4j.SilentParameters; +import reactor.core.publisher.Mono; + +import java.net.MalformedURLException; +import java.time.ZoneOffset; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.concurrent.CompletableFuture; + +/** + * A credential provider that provides token credentials from the MSAL shared token cache. + * Requires a username and client ID. If a username is not provided, then the AZURE_USERNAME + * environment variable will be used + */ +public class SharedTokenCacheCredential implements TokenCredential { + private final String username; + private final String clientID; + private final Configuration configuration; + + private PublicClientApplication pubClient; + + /** + * Creates an instance of the Shared Token Cache Credential Provider. + * + * @param username the username of the account for the application + * @param clientID the client ID of the application + * @param identityClientOptions the options for configuring the identity client + */ + SharedTokenCacheCredential(String username, String clientID, IdentityClientOptions identityClientOptions) { + this.configuration = ConfigurationManager.getConfiguration().clone(); + + if (username == null) { + if (configuration.contains(BaseConfigurations.AZURE_USERNAME)) { + this.username = configuration.get(BaseConfigurations.AZURE_USERNAME); + } else { + this.username = null; + } + } else { + this.username = username; + } + + this.clientID = clientID; + } + + /** + * Gets token from shared token cache + * */ + @Override + public Mono getToken(String... scopes) { + // Initialize here so that the constructor doesn't throw + if (pubClient == null) { + PersistentTokenCacheAccessAspect accessAspect = new PersistentTokenCacheAccessAspect(); + pubClient = PublicClientApplication.builder(this.clientID).setTokenCacheAccessAspect(accessAspect).build(); + } + + IAccount requestedAccount = null; + + // find if the Public Client app with the requested username exists + Collection accounts = pubClient.getAccounts().join(); + Iterator iter = accounts.iterator(); + + + if (username == null && iter.hasNext()) { + requestedAccount = iter.next(); + } else { + while (iter.hasNext()) { + IAccount account = iter.next(); + if (account.username().equals(username)) { + requestedAccount = account; + break; + } + } + } + + if (requestedAccount == null) { + return Mono.error(new RuntimeException("Requested account was not found")); + } + + // if it does, then request the token + SilentParameters params = SilentParameters.builder( + new HashSet<>(Arrays.asList(scopes)), requestedAccount).build(); + + CompletableFuture future; + try { + future = pubClient.acquireTokenSilently(params); + return Mono.fromFuture(() -> future).map(result -> + new AccessToken(result.accessToken(), result.expiresOnDate().toInstant().atOffset(ZoneOffset.UTC))); + + } catch (MalformedURLException e) { + e.printStackTrace(); + return Mono.error(new RuntimeException("Token was not found")); + } + } +} diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/SharedTokenCacheCredentialBuilder.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/SharedTokenCacheCredentialBuilder.java new file mode 100644 index 000000000000..f99a1075e71d --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/SharedTokenCacheCredentialBuilder.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.credential; + +/** + * Fluent credential builder for instantiating a {@link SharedTokenCacheCredential}. + * + * @see SharedTokenCacheCredential + */ +public class SharedTokenCacheCredentialBuilder extends CredentialBuilderBase { + private String clientId; + private String username; + + + /** + * Sets clientId + * + * @param clientId client id for application + * + * @return SharedTokenCacheCredentialBuilder + * */ + public SharedTokenCacheCredentialBuilder clientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Sets username + * + * @param username username for user account + * + * @return SharedTokenCacheCredentialBuilder + * */ + public SharedTokenCacheCredentialBuilder username(String username) { + this.username = username; + return this; + } + + /** + * @return a {@link SharedTokenCacheCredentialBuilder} with the current configurations. + */ + public SharedTokenCacheCredential build() { + return new SharedTokenCacheCredential(username, clientId, identityClientOptions); + + } + +} diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/UsernamePasswordCredential.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/UsernamePasswordCredential.java index 18a676209f30..7305edab2deb 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/UsernamePasswordCredential.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/UsernamePasswordCredential.java @@ -17,8 +17,8 @@ /** * An AAD credential that acquires a token with a username and a password. Users with 2FA/MFA (Multi-factored auth) - * turned on will not be able to use this credential. Please use {@link DeviceCodeCredential} or {@link InteractiveBrowserCredential} - * instead, or create a service principal if you want to authenticate silently. + * turned on will not be able to use this credential. Please use {@link DeviceCodeCredential} or {@link + * InteractiveBrowserCredential} instead, or create a service principal if you want to authenticate silently. */ @Immutable public class UsernamePasswordCredential implements TokenCredential { @@ -35,12 +35,18 @@ public class UsernamePasswordCredential implements TokenCredential { * @param password the password of the user * @param identityClientOptions the options for configuring the identity client */ - UsernamePasswordCredential(String clientId, String username, String password, IdentityClientOptions identityClientOptions) { + UsernamePasswordCredential(String clientId, String username, String password, + IdentityClientOptions identityClientOptions) { Objects.requireNonNull(username); Objects.requireNonNull(password); this.username = username; this.password = password; - identityClient = new IdentityClientBuilder().tenantId("common").clientId(clientId).identityClientOptions(identityClientOptions).build(); + identityClient = + new IdentityClientBuilder() + .tenantId("common") + .clientId(clientId) + .identityClientOptions(identityClientOptions) + .build(); cachedToken = new AtomicReference<>(); } @@ -48,7 +54,8 @@ public class UsernamePasswordCredential implements TokenCredential { public Mono getToken(String... scopes) { return Mono.defer(() -> { if (cachedToken.get() != null) { - return identityClient.authenticateWithUserRefreshToken(scopes, cachedToken.get()).onErrorResume(t -> Mono.empty()); + return identityClient.authenticateWithUserRefreshToken(scopes, cachedToken.get()) + .onErrorResume(t -> Mono.empty()); } else { return Mono.empty(); } diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/VirtualMachineMSICredential.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/VirtualMachineMSICredential.java index a5d508340ab5..bf09e052f21d 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/VirtualMachineMSICredential.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/VirtualMachineMSICredential.java @@ -30,7 +30,7 @@ class VirtualMachineMSICredential { /** * @return the client id of user assigned or system assigned identity. */ - public String clientId() { + public String getClientId() { return this.clientId; } diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/AuthorizationCodeListener.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/AuthorizationCodeListener.java index 453f94697411..1fe68e84db00 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/AuthorizationCodeListener.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/AuthorizationCodeListener.java @@ -4,21 +4,32 @@ package com.azure.identity.implementation; import com.azure.core.implementation.http.UrlBuilder; +import com.azure.core.util.logging.ClientLogger; +import fi.iki.elonen.NanoHTTPD; import reactor.core.publisher.Mono; import reactor.core.publisher.MonoProcessor; -import reactor.netty.DisposableServer; -import reactor.netty.http.server.HttpServer; + +import java.io.IOException; /** * A local HTTP server that listens to the authorization code response from Azure Active Directory. */ public final class AuthorizationCodeListener { - private DisposableServer server; + private final ClientLogger logger = new ClientLogger(AuthorizationCodeListener.class); + + private NanoHTTPD httpServer; private MonoProcessor authorizationCodeEmitter; - private AuthorizationCodeListener(DisposableServer server, MonoProcessor authorizationCodeEmitter) { - this.server = server; + private AuthorizationCodeListener(NanoHTTPD httpServer, MonoProcessor authorizationCodeEmitter) { + this.httpServer = httpServer; this.authorizationCodeEmitter = authorizationCodeEmitter; + + try { + this.httpServer.start(); + } catch (IOException e) { + logger.error( + "Unable to start identity authorization code listener on port " + httpServer.getListeningPort(), e); + } } /** @@ -28,14 +39,15 @@ private AuthorizationCodeListener(DisposableServer server, MonoProcessor */ public static Mono create(int port) { MonoProcessor monoProcessor = MonoProcessor.create(); - return HttpServer.create() - .port(port) - .handle((inbound, outbound) -> { - monoProcessor.onNext(getCodeFromUri(inbound.uri())); - return inbound.receive().then(); - }) - .bind() - .map(server -> new AuthorizationCodeListener(server, monoProcessor)); + + return Mono.just(new NanoHTTPD(port) { + @Override + public Response serve(final IHTTPSession session) { + String uriWithQueryParams = session.getUri() + "?" + session.getQueryParameterString(); + monoProcessor.onNext(getCodeFromUri(uriWithQueryParams)); + return newFixedLengthResponse(""); + } + }).map(server -> new AuthorizationCodeListener(server, monoProcessor)); } /** @@ -43,7 +55,10 @@ public static Mono create(int port) { * @return a Publisher signaling the completion */ public Mono dispose() { - return Mono.fromRunnable(() -> server.disposeNow()); + return Mono.fromRunnable(() -> { + httpServer.closeAllConnections(); + httpServer.stop(); + }); } /** @@ -56,9 +71,9 @@ public Mono listen() { private static String getCodeFromUri(String uri) { UrlBuilder urlBuilder = UrlBuilder.parse(uri); - for (String query : urlBuilder.query().keySet()) { + for (String query : urlBuilder.getQuery().keySet()) { if ("code".equalsIgnoreCase(query)) { - return urlBuilder.query().get(query); + return urlBuilder.getQuery().get(query); } } return null; diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClient.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClient.java index c9576aa8738d..9493f538b83c 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClient.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClient.java @@ -85,15 +85,15 @@ public class IdentityClient { if (clientId == null) { this.publicClientApplication = null; } else { - String authorityUrl = options.authorityHost().replaceAll("/+$", "") + "/organizations/" + tenantId; + String authorityUrl = options.getAuthorityHost().replaceAll("/+$", "") + "/organizations/" + tenantId; PublicClientApplication.Builder publicClientApplicationBuilder = PublicClientApplication.builder(clientId); try { publicClientApplicationBuilder = publicClientApplicationBuilder.authority(authorityUrl); } catch (MalformedURLException e) { throw logger.logExceptionAsWarning(new IllegalStateException(e)); } - if (options.proxyOptions() != null) { - publicClientApplicationBuilder.proxy(proxyOptionsToJavaNetProxy(options.proxyOptions())); + if (options.getProxyOptions() != null) { + publicClientApplicationBuilder.proxy(proxyOptionsToJavaNetProxy(options.getProxyOptions())); } this.publicClientApplication = publicClientApplicationBuilder.build(); } @@ -107,15 +107,20 @@ public class IdentityClient { * @return a Publisher that emits an AccessToken */ public Mono authenticateWithClientSecret(String clientSecret, String[] scopes) { - String authorityUrl = options.authorityHost().replaceAll("/+$", "") + "/" + tenantId; + String authorityUrl = options.getAuthorityHost().replaceAll("/+$", "") + "/" + tenantId; try { - ConfidentialClientApplication.Builder applicationBuilder = ConfidentialClientApplication.builder(clientId, ClientCredentialFactory.create(clientSecret)).authority(authorityUrl); - if (options.proxyOptions() != null) { - applicationBuilder.proxy(proxyOptionsToJavaNetProxy(options.proxyOptions())); + ConfidentialClientApplication.Builder applicationBuilder = + ConfidentialClientApplication.builder(clientId, ClientCredentialFactory.create(clientSecret)) + .authority(authorityUrl); + if (options.getProxyOptions() != null) { + applicationBuilder.proxy(proxyOptionsToJavaNetProxy(options.getProxyOptions())); } ConfidentialClientApplication application = applicationBuilder.build(); - return Mono.fromFuture(application.acquireToken(ClientCredentialParameters.builder(new HashSet<>(Arrays.asList(scopes))).build())) - .map(ar -> new AccessToken(ar.accessToken(), OffsetDateTime.ofInstant(ar.expiresOnDate().toInstant(), ZoneOffset.UTC))); + return Mono.fromFuture(application.acquireToken( + ClientCredentialParameters.builder(new HashSet<>(Arrays.asList(scopes))) + .build())) + .map(ar -> new AccessToken(ar.accessToken(), OffsetDateTime.ofInstant(ar.expiresOnDate().toInstant(), + ZoneOffset.UTC))); } catch (MalformedURLException e) { return Mono.error(e); } @@ -129,17 +134,29 @@ public Mono authenticateWithClientSecret(String clientSecret, Strin * @param scopes the scopes to authenticate to * @return a Publisher that emits an AccessToken */ - public Mono authenticateWithPfxCertificate(String pfxCertificatePath, String pfxCertificatePassword, String[] scopes) { - String authorityUrl = options.authorityHost().replaceAll("/+$", "") + "/" + tenantId; + public Mono authenticateWithPfxCertificate(String pfxCertificatePath, String pfxCertificatePassword, + String[] scopes) { + String authorityUrl = options.getAuthorityHost().replaceAll("/+$", "") + "/" + tenantId; try { - ConfidentialClientApplication.Builder applicationBuilder = ConfidentialClientApplication.builder(clientId, ClientCredentialFactory.create(new FileInputStream(pfxCertificatePath), pfxCertificatePassword)).authority(authorityUrl); - if (options.proxyOptions() != null) { - applicationBuilder.proxy(proxyOptionsToJavaNetProxy(options.proxyOptions())); + ConfidentialClientApplication.Builder applicationBuilder = + ConfidentialClientApplication.builder(clientId, + ClientCredentialFactory.create(new FileInputStream(pfxCertificatePath), pfxCertificatePassword)) + .authority(authorityUrl); + if (options.getProxyOptions() != null) { + applicationBuilder.proxy(proxyOptionsToJavaNetProxy(options.getProxyOptions())); } ConfidentialClientApplication application = applicationBuilder.build(); - return Mono.fromFuture(application.acquireToken(ClientCredentialParameters.builder(new HashSet<>(Arrays.asList(scopes))).build())) - .map(ar -> new AccessToken(ar.accessToken(), OffsetDateTime.ofInstant(ar.expiresOnDate().toInstant(), ZoneOffset.UTC))); - } catch (CertificateException | UnrecoverableKeyException | NoSuchAlgorithmException | KeyStoreException | NoSuchProviderException | IOException e) { + return Mono.fromFuture(application.acquireToken( + ClientCredentialParameters.builder(new HashSet<>(Arrays.asList(scopes))) + .build())) + .map(ar -> new AccessToken(ar.accessToken(), OffsetDateTime.ofInstant(ar.expiresOnDate().toInstant(), + ZoneOffset.UTC))); + } catch (CertificateException + | UnrecoverableKeyException + | NoSuchAlgorithmException + | KeyStoreException + | NoSuchProviderException + | IOException e) { return Mono.error(e); } } @@ -152,16 +169,22 @@ public Mono authenticateWithPfxCertificate(String pfxCertificatePat * @return a Publisher that emits an AccessToken */ public Mono authenticateWithPemCertificate(String pemCertificatePath, String[] scopes) { - String authorityUrl = options.authorityHost().replaceAll("/+$", "") + "/" + tenantId; + String authorityUrl = options.getAuthorityHost().replaceAll("/+$", "") + "/" + tenantId; try { byte[] pemCertificateBytes = Files.readAllBytes(Paths.get(pemCertificatePath)); - ConfidentialClientApplication.Builder applicationBuilder = ConfidentialClientApplication.builder(clientId, ClientCredentialFactory.create(CertificateUtil.privateKeyFromPem(pemCertificateBytes), CertificateUtil.publicKeyFromPem(pemCertificateBytes))).authority(authorityUrl); - if (options.proxyOptions() != null) { - applicationBuilder.proxy(proxyOptionsToJavaNetProxy(options.proxyOptions())); + ConfidentialClientApplication.Builder applicationBuilder = + ConfidentialClientApplication.builder(clientId, + ClientCredentialFactory.create(CertificateUtil.privateKeyFromPem(pemCertificateBytes), + CertificateUtil.publicKeyFromPem(pemCertificateBytes))).authority(authorityUrl); + if (options.getProxyOptions() != null) { + applicationBuilder.proxy(proxyOptionsToJavaNetProxy(options.getProxyOptions())); } ConfidentialClientApplication application = applicationBuilder.build(); - return Mono.fromFuture(application.acquireToken(ClientCredentialParameters.builder(new HashSet<>(Arrays.asList(scopes))).build())) - .map(ar -> new AccessToken(ar.accessToken(), OffsetDateTime.ofInstant(ar.expiresOnDate().toInstant(), ZoneOffset.UTC))); + return Mono.fromFuture(application.acquireToken( + ClientCredentialParameters.builder(new HashSet<>(Arrays.asList(scopes))) + .build())) + .map(ar -> new AccessToken(ar.accessToken(), OffsetDateTime.ofInstant(ar.expiresOnDate().toInstant(), + ZoneOffset.UTC))); } catch (IOException e) { return Mono.error(e); } @@ -176,19 +199,22 @@ public Mono authenticateWithPemCertificate(String pemCertificatePat * @return a Publisher that emits an AccessToken */ public Mono authenticateWithUsernamePassword(String[] scopes, String username, String password) { - return Mono.fromFuture(publicClientApplication.acquireToken(UserNamePasswordParameters.builder(new HashSet<>(Arrays.asList(scopes)), username, password.toCharArray()).build())) + return Mono.fromFuture(publicClientApplication.acquireToken( + UserNamePasswordParameters.builder(new HashSet<>(Arrays.asList(scopes)), username, password.toCharArray()) + .build())) .map(MsalToken::new); } /** * Asynchronously acquire a token from the currently logged in client. + * * @param scopes the scopes to authenticate to * @return a Publisher that emits an AccessToken */ public Mono authenticateWithUserRefreshToken(String[] scopes, MsalToken msalToken) { SilentParameters parameters; - if (msalToken.account() != null) { - parameters = SilentParameters.builder(new HashSet<>(Arrays.asList(scopes)), msalToken.account()).build(); + if (msalToken.getAccount() != null) { + parameters = SilentParameters.builder(new HashSet<>(Arrays.asList(scopes)), msalToken.getAccount()).build(); } else { parameters = SilentParameters.builder(new HashSet<>(Arrays.asList(scopes))).build(); } @@ -208,12 +234,15 @@ public Mono authenticateWithUserRefreshToken(String[] scopes, MsalTok * * @param scopes the scopes to authenticate to * @param deviceCodeConsumer the user provided closure that will consume the device code challenge - * @return a Publisher that emits an AccessToken when the device challenge is met, or an exception if the device code expires + * @return a Publisher that emits an AccessToken when the device challenge is met, or an exception if the device + * code expires */ - public Mono authenticateWithDeviceCode(String[] scopes, Consumer deviceCodeConsumer) { + public Mono authenticateWithDeviceCode(String[] scopes, + Consumer deviceCodeConsumer) { return Mono.fromFuture(() -> { DeviceCodeFlowParameters parameters = DeviceCodeFlowParameters.builder(new HashSet<>(Arrays.asList(scopes)), - dc -> deviceCodeConsumer.accept(new DeviceCodeChallenge(dc.userCode(), dc.deviceCode(), dc.verificationUri(), dc.expiresIn(), dc.interval(), dc.message()))).build(); + dc -> deviceCodeConsumer.accept(new DeviceCodeChallenge(dc.userCode(), dc.deviceCode(), + dc.verificationUri(), dc.expiresIn(), dc.interval(), dc.message()))).build(); return publicClientApplication.acquireToken(parameters); }).map(MsalToken::new); } @@ -226,8 +255,13 @@ public Mono authenticateWithDeviceCode(String[] scopes, Consumer authenticateWithAuthorizationCode(String[] scopes, String authorizationCode, URI redirectUri) { - return Mono.fromFuture(() -> publicClientApplication.acquireToken(AuthorizationCodeParameters.builder(authorizationCode, redirectUri).scopes(new HashSet<>(Arrays.asList(scopes))).build())).map(MsalToken::new); + public Mono authenticateWithAuthorizationCode(String[] scopes, String authorizationCode, + URI redirectUri) { + return Mono.fromFuture(() -> publicClientApplication.acquireToken( + AuthorizationCodeParameters.builder(authorizationCode, redirectUri) + .scopes(new HashSet<>(Arrays.asList(scopes))) + .build())) + .map(MsalToken::new); } /** @@ -240,15 +274,18 @@ public Mono authenticateWithAuthorizationCode(String[] scopes, String * @return a Publisher that emits an AccessToken */ public Mono authenticateWithBrowserInteraction(String[] scopes, int port) { - String authorityUrl = options.authorityHost().replaceAll("/+$", "") + "/" + "common"; + String authorityUrl = options.getAuthorityHost().replaceAll("/+$", "") + "/" + "common"; return AuthorizationCodeListener.create(port) .flatMap(server -> { URI redirectUri; URI browserUri; try { redirectUri = new URI(String.format("http://localhost:%s", port)); - browserUri = new URI(String.format("%s/oauth2/v2.0/authorize?response_type=code&response_mode=query&prompt=select_account&client_id=%s&redirect_uri=%s&state=%s&scope=%s", - authorityUrl, clientId, redirectUri.toString(), UUID.randomUUID(), String.join(" ", scopes))); + browserUri = + new URI(String.format("%s/oauth2/v2.0/authorize?response_type=code&response_mode=query&prompt" + + "=select_account&client_id=%s&redirect_uri=%s&state=%s&scope=%s", + authorityUrl, clientId, redirectUri.toString(), UUID.randomUUID(), String.join(" ", + scopes))); } catch (URISyntaxException e) { return server.dispose().then(Mono.error(e)); } @@ -276,7 +313,8 @@ public Mono authenticateWithBrowserInteraction(String[] scopes, int p * @param scopes the scopes to authenticate to * @return a Publisher that emits an AccessToken */ - public Mono authenticateToManagedIdentityEndpoint(String msiEndpoint, String msiSecret, String[] scopes) { + public Mono authenticateToManagedIdentityEndpoint(String msiEndpoint, String msiSecret, + String[] scopes) { String resource = ScopeUtil.scopesToResource(scopes); HttpURLConnection connection = null; StringBuilder payload = new StringBuilder(); @@ -343,11 +381,13 @@ public Mono authenticateToIMDSEndpoint(String[] scopes) { } int retry = 1; - while (retry <= options.maxRetry()) { + while (retry <= options.getMaxRetry()) { URL url = null; HttpURLConnection connection = null; try { - url = new URL(String.format("http://169.254.169.254/metadata/identity/oauth2/token?%s", payload.toString())); + url = + new URL(String.format("http://169.254.169.254/metadata/identity/oauth2/token?%s", + payload.toString())); connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); @@ -360,7 +400,8 @@ public Mono authenticateToIMDSEndpoint(String[] scopes) { return Mono.just(SERIALIZER_ADAPTER.deserialize(result, MSIToken.class, SerializerEncoding.JSON)); } catch (IOException exception) { if (connection == null) { - return Mono.error(new RuntimeException(String.format("Could not connect to the url: %s.", url), exception)); + return Mono.error(new RuntimeException(String.format("Could not connect to the url: %s.", url), + exception)); } int responseCode = 0; try { @@ -368,19 +409,26 @@ public Mono authenticateToIMDSEndpoint(String[] scopes) { } catch (IOException e) { return Mono.error(e); } - if (responseCode == 410 || responseCode == 429 || responseCode == 404 || (responseCode >= 500 && responseCode <= 599)) { - int retryTimeoutInMs = options.retryTimeout().apply(RANDOM.nextInt(retry)); + if (responseCode == 410 + || responseCode == 429 + || responseCode == 404 + || (responseCode >= 500 && responseCode <= 599)) { + int retryTimeoutInMs = options.getRetryTimeout().apply(RANDOM.nextInt(retry)); // Error code 410 indicates IMDS upgrade is in progress, which can take up to 70s // - retryTimeoutInMs = (responseCode == 410 && retryTimeoutInMs < imdsUpgradeTimeInMs) ? imdsUpgradeTimeInMs : retryTimeoutInMs; + retryTimeoutInMs = + (responseCode == 410 && retryTimeoutInMs < imdsUpgradeTimeInMs) ? imdsUpgradeTimeInMs + : retryTimeoutInMs; retry++; - if (retry > options.maxRetry()) { + if (retry > options.getMaxRetry()) { break; } else { sleep(retryTimeoutInMs); } } else { - return Mono.error(new RuntimeException("Couldn't acquire access token from IMDS, verify your objectId, clientId or msiResourceId", exception)); + return Mono.error(new RuntimeException( + "Couldn't acquire access token from IMDS, verify your objectId, clientId or msiResourceId", + exception)); } } finally { if (connection != null) { @@ -388,7 +436,8 @@ public Mono authenticateToIMDSEndpoint(String[] scopes) { } } } - return Mono.error(new RuntimeException(String.format("MSI: Failed to acquire tokens after retrying %s times", options.maxRetry()))); + return Mono.error(new RuntimeException(String.format("MSI: Failed to acquire tokens after retrying %s times", + options.getMaxRetry()))); } private static void sleep(int millis) { @@ -400,13 +449,13 @@ private static void sleep(int millis) { } private static Proxy proxyOptionsToJavaNetProxy(ProxyOptions options) { - switch (options.type()) { + switch (options.getType()) { case SOCKS4: case SOCKS5: - return new Proxy(Type.SOCKS, options.address()); + return new Proxy(Type.SOCKS, options.getAddress()); case HTTP: default: - return new Proxy(Type.HTTP, options.address()); + return new Proxy(Type.HTTP, options.getAddress()); } } } diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClientOptions.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClientOptions.java index d5f740d6079b..804bc85ee2d8 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClientOptions.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClientOptions.java @@ -31,7 +31,7 @@ public IdentityClientOptions() { /** * @return the Azure Active Directory endpoint to acquire tokens. */ - public String authorityHost() { + public String getAuthorityHost() { return authorityHost; } @@ -40,7 +40,7 @@ public String authorityHost() { * @param authorityHost the Azure Active Directory endpoint * @return IdentityClientOptions */ - public IdentityClientOptions authorityHost(String authorityHost) { + public IdentityClientOptions setAuthorityHost(String authorityHost) { this.authorityHost = authorityHost; return this; } @@ -48,7 +48,7 @@ public IdentityClientOptions authorityHost(String authorityHost) { /** * @return the max number of retries when an authentication request fails. */ - public int maxRetry() { + public int getMaxRetry() { return maxRetry; } @@ -57,7 +57,7 @@ public int maxRetry() { * @param maxRetry the number of retries * @return IdentityClientOptions */ - public IdentityClientOptions maxRetry(int maxRetry) { + public IdentityClientOptions setMaxRetry(int maxRetry) { this.maxRetry = maxRetry; return this; } @@ -65,7 +65,7 @@ public IdentityClientOptions maxRetry(int maxRetry) { /** * @return a Function to calculate seconds of timeout on every retried request. */ - public Function retryTimeout() { + public Function getRetryTimeout() { return retryTimeout; } @@ -74,7 +74,7 @@ public Function retryTimeout() { * @param retryTimeout the Function that returns a timeout in seconds given the number of retry * @return IdentityClientOptions */ - public IdentityClientOptions retryTimeout(Function retryTimeout) { + public IdentityClientOptions setRetryTimeout(Function retryTimeout) { this.retryTimeout = retryTimeout; return this; } @@ -82,7 +82,7 @@ public IdentityClientOptions retryTimeout(Function retryTimeou /** * @return the options for proxy configuration. */ - public ProxyOptions proxyOptions() { + public ProxyOptions getProxyOptions() { return proxyOptions; } @@ -91,7 +91,7 @@ public ProxyOptions proxyOptions() { * @param proxyOptions the options for proxy configuration * @return IdentityClientOptions */ - public IdentityClientOptions proxyOptions(ProxyOptions proxyOptions) { + public IdentityClientOptions setProxyOptions(ProxyOptions proxyOptions) { this.proxyOptions = proxyOptions; return this; } diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/MSIToken.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/MSIToken.java index 238b0596f389..1effcb8bf989 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/MSIToken.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/MSIToken.java @@ -32,7 +32,7 @@ public final class MSIToken extends AccessToken { /** * Creates an access token instance. * - * @param token the token string. + * @param token the token string. * @param expiresOn the expiration time. */ public MSIToken(String token, OffsetDateTime expiresOn) { @@ -40,19 +40,21 @@ public MSIToken(String token, OffsetDateTime expiresOn) { } @JsonCreator - private MSIToken(@JsonProperty(value = "access_token") String token, @JsonProperty(value = "expires_on") String expiresOn) { + private MSIToken( + @JsonProperty(value = "access_token") String token, + @JsonProperty(value = "expires_on") String expiresOn) { this(token, EPOCH.plusSeconds(parseDateToEpochSeconds(expiresOn))); this.accessToken = token; this.expiresOn = expiresOn; } @Override - public String token() { + public String getToken() { return accessToken; } @Override - public OffsetDateTime expiresOn() { + public OffsetDateTime getExpiresOn() { return EPOCH.plusSeconds(parseDateToEpochSeconds(this.expiresOn)); } @@ -69,13 +71,13 @@ private static Long parseDateToEpochSeconds(String dateTime) { try { return Long.parseLong(dateTime); } catch (NumberFormatException e) { - System.err.println(e.getMessage()); + logger.error(e.getMessage()); } try { return Instant.from(dtf.parse(dateTime)).toEpochMilli() / 1000L; } catch (DateTimeParseException e) { - System.err.println(e.getMessage()); + logger.error(e.getMessage()); } throw logger.logExceptionAsError(new IllegalArgumentException("Unable to parse date time " + dateTime)); diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/MsalToken.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/MsalToken.java index 13f154d1b37b..427d30372041 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/MsalToken.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/MsalToken.java @@ -23,14 +23,15 @@ public final class MsalToken extends AccessToken { * @param msalResult the raw authentication result returned by MSAL */ public MsalToken(IAuthenticationResult msalResult) { - super(msalResult.accessToken(), OffsetDateTime.ofInstant(msalResult.expiresOnDate().toInstant(), ZoneOffset.UTC)); + super(msalResult.accessToken(), OffsetDateTime.ofInstant(msalResult.expiresOnDate().toInstant(), + ZoneOffset.UTC)); this.account = msalResult.account(); } /** * @return the signed in account */ - public IAccount account() { + public IAccount getAccount() { return account; } } diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/msalextensions/CacheLock.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/msalextensions/CacheLock.java new file mode 100644 index 000000000000..9d29e2666e0e --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/msalextensions/CacheLock.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.implementation.msalextensions; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.RandomAccessFile; +import java.nio.channels.FileChannel; +import java.nio.channels.FileLock; +import java.nio.channels.OverlappingFileLockException; +import java.nio.file.Files; +import java.util.Random; + +/** + * Cache lock for the persistent shared MSAL token cache + * + * Needed to maintain the integrity of the cache if multiple processes are trying to access it at the same time. + * */ +public class CacheLock { + + private int lockfileRetryWait = 100; + private int lockfileRetryCount = 60000 / lockfileRetryWait; + + private File lockFile; + + private FileOutputStream fos; + private FileChannel channel; + private FileLock lock = null; + + private File debugFile; + private String debugFilename = java.nio.file.Paths.get( + System.getProperty("user.dir"), "target", "debug").toString(); + private final boolean debugFlag; + + /** + * Default constructor to be used to initialize CacheLock + * + * @param lockfileName path of the lock file to be used + * */ + public CacheLock(String lockfileName) { + lockFile = new File(lockfileName); + debugFlag = false; + } + + /** + * Constructor to be used for debugging purposes + * Enables printing the actions for each process while using the cache lock + * + * @param lockfileName path of the lock file to be used + * @param id name of the current process so + * */ + public CacheLock(String lockfileName, String id) { + lockFile = new File(lockfileName); + debugFile = new File(debugFilename + id + ".txt"); + debugFlag = true; + } + + /** + * Tries to obtain the lock by creating a file lock on the provided lockFile + * If it cannot be obtained right away, it retries lockfileRetryCount = 60000 / lockfileRetryWait times + * + * @throws CacheLockNotObtainedException if the lock cannot be obtained after all these tries. + * */ + public void lock() throws CacheLockNotObtainedException { + try { + for (int tryCount = 0; tryCount < lockfileRetryCount; tryCount++) { + + if (debugFlag) { + try { + fos = new FileOutputStream(debugFile, true); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + } + + if (!lockFile.exists()) { // file doesn't already exist so now you have to make a new one + if (lockFile.createNewFile()) { + lockFile.deleteOnExit(); + + try { + channel = new RandomAccessFile(lockFile, "rw").getChannel(); + lock = channel.lock(); + + printToFileIfDebug("Locked!\n"); + return; //success + + } catch (OverlappingFileLockException e) { + printToFileIfDebug("overlap error\n"); + } catch (Exception e) { + printToFileIfDebug("something else went wrong.. general exception\n"); + } + + } else { + printToFileIfDebug("lockfile already exists\n"); + } + } else { + printToFileIfDebug("create new file failed"); + } + + printToFileIfDebug("retry\n"); + + try { + Random rand = new Random(System.currentTimeMillis()); + int offset = rand.nextInt(10); + // slight offset in case multiple threads/processes have the same wait time + Thread.sleep(lockfileRetryWait + offset); + } catch (InterruptedException ex) { + printToFileIfDebug("thread sleep issue"); + } + } + + } catch (IOException e) { + printToFileIfDebug("general exception, not sure what happened here...no retries\n"); + } + + throw new CacheLockNotObtainedException("Maximum retries used; could not obtain CacheLock"); + } + + /** + * Tries to unlock the file lock + * + * @return true if the file was unlocked, false otherwise + * */ + public boolean unlock() { + try { + lock.release(); + channel.close(); + Files.delete(java.nio.file.Paths.get(lockFile.getPath())); + + printToFileIfDebug("unlocked\n"); + + return true; + } catch (IOException e) { + printToFileIfDebug("not unlocked... IOException: " + e.getMessage()); + return false; + } + } + + /** + * If debugFlag is true, then this will print logs to the file, otherwise it will do nothing + */ + private void printToFileIfDebug(String message) { + if (debugFlag && fos != null) { + try { + fos.write(message.getBytes("UTF-8")); + } catch (IOException e) { + e.printStackTrace(); + } + } + } +} diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/msalextensions/CacheLockNotObtainedException.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/msalextensions/CacheLockNotObtainedException.java new file mode 100644 index 000000000000..de36ebf7be38 --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/msalextensions/CacheLockNotObtainedException.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.implementation.msalextensions; + +/** + * Exception for when the {@link CacheLock} cannot be obtained when trying cacheLock.lock() + * */ +public class CacheLockNotObtainedException extends RuntimeException { + + /** + * Initializes CacheLockNotObtainedException + * + * @param message Error message + * */ + public CacheLockNotObtainedException(String message) { + super(message); + } +} diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/msalextensions/PersistentTokenCacheAccessAspect.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/msalextensions/PersistentTokenCacheAccessAspect.java new file mode 100644 index 000000000000..74d5377d19c7 --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/msalextensions/PersistentTokenCacheAccessAspect.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.implementation.msalextensions; + +import com.azure.core.util.logging.ClientLogger; +import com.azure.identity.implementation.msalextensions.cachepersister.CachePersister; +import com.azure.identity.implementation.msalextensions.cachepersister.PlatformNotSupportedException; +import com.microsoft.aad.msal4j.ITokenCacheAccessAspect; +import com.microsoft.aad.msal4j.ITokenCacheAccessContext; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; + +/** + * Access Aspect for accessing the token cache + * Allows for notifications for the cache before/after access so the lock can be used + * */ +public class PersistentTokenCacheAccessAspect implements ITokenCacheAccessAspect { + + private CachePersister cachePersister; + private ClientLogger logger; + + /** + * Default constructor, creates a CachePersister object + * + * @throws IOException from errors in creating the CachePersister + * @throws PlatformNotSupportedException from errors in creating the CachePersister + * */ + public PersistentTokenCacheAccessAspect() throws RuntimeException, PlatformNotSupportedException { + logger = new ClientLogger(PersistentTokenCacheAccessAspect.class); + + cachePersister = new CachePersister.Builder().build(); + } + + /** + * Constructor with a custom CachePersister object + * + * @param customCachePersister + * */ + public PersistentTokenCacheAccessAspect(CachePersister customCachePersister) { + cachePersister = customCachePersister; + } + + /** + * Loads token cache to memory using CachePersister - deserialize data in file to Token Cache class + * + * @param iTokenCacheAccessContext + * */ + public void beforeCacheAccess(ITokenCacheAccessContext iTokenCacheAccessContext) { + + byte[] bytes = cachePersister.readCache(); + String data; + try { + data = new String(bytes, "UTF-8"); + } catch (UnsupportedEncodingException e) { + data = ""; + } + + iTokenCacheAccessContext.tokenCache().deserialize(data); + } + + /** + * Reads memory and writes to token cache file using CachePersister + * + * @param iTokenCacheAccessContext + * */ + public void afterCacheAccess(ITokenCacheAccessContext iTokenCacheAccessContext) { + + if (iTokenCacheAccessContext.hasCacheChanged()) { + String newData = iTokenCacheAccessContext.tokenCache().serialize(); + try { + cachePersister.writeCache(newData.getBytes("UTF-8")); + } catch (UnsupportedEncodingException e) { + // don't update cache + logger.error("was not able to write to cache"); + } + } + } + + /** + * Wrapper method to delete cache + * */ + public void deleteCache() { + cachePersister.deleteCache(); + } +} diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/msalextensions/cachepersister/CachePersister.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/msalextensions/cachepersister/CachePersister.java new file mode 100644 index 000000000000..42d4ff0e5cb4 --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/msalextensions/cachepersister/CachePersister.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.implementation.msalextensions.cachepersister; + +import com.azure.identity.implementation.msalextensions.cachepersister.windows.WindowsDPAPICacheProtector; +import com.sun.jna.Platform; + +import java.io.IOException; + +/** + * Wrapper class for CacheProtector + * Determines the type of CacheProtector to use (if possible) and instantiates it + * Also contains wrapper methods for read, write, and delete cache + * */ +public final class CachePersister { + + private CacheProtectorBase cacheProtector; + + /** + * Default constructor + * */ + private CachePersister(CacheProtectorBase cacheProtector) { + this.cacheProtector = cacheProtector; + } + + /** + * Wrapper method for reading cache + * + * @return byte[] of cache contents + * */ + public byte[] readCache() { + return cacheProtector.readCache(); + } + + /** + * Wrapper method for writing to the cache + * + * @param data Cache contents + * */ + public void writeCache(byte[] data) { + cacheProtector.writeCache(data); + } + + public boolean deleteCache() { + return cacheProtector.deleteCache(); + } + + /** + * Builder for CachePersister class + * Creates appropriate file paths and account and service names, and calls createCacheProtector + * */ + public static class Builder { + + private String cacheLocation; + private String lockfileLocation; + + /** + * Default builder based on platform for cache file, and default service and account names + */ + public Builder() { + + // determine platform and create cache file location + if (Platform.isWindows()) { + cacheLocation = java.nio.file.Paths.get(System.getProperty("user.home"), + "AppData", "Local", ".IdentityService", "msal.cache").toString(); + } else { + cacheLocation = java.nio.file.Paths.get(System.getProperty("user.home"), + "msal.cache").toString(); + } + lockfileLocation = cacheLocation + ".lockfile"; +// +// serviceName = "Microsoft.Developer.IdentityService"; +// accountName = "MSALCache"; + } + + /** + * @return Builder with updated cacheLocation and lockfileLocation + * */ + public Builder cacheLocation(String cacheLocation) { + this.cacheLocation = cacheLocation; + this.lockfileLocation = cacheLocation + ".lockfile"; + return this; + } + + /** + * @return Builder with updated lockfileLocation + * */ + public Builder lockfileLocation(String lockfileLocation) { + this.lockfileLocation = lockfileLocation; + return this; + } + + /** + * Builds CachePersister with all the information passed into the Builder + * + * @return newly instantiated CachePersister + * */ + public CachePersister build() throws RuntimeException { + if (Platform.isWindows()) { + try { + return new CachePersister(new WindowsDPAPICacheProtector(cacheLocation, lockfileLocation)); + } catch (IOException e) { + throw new RuntimeException("IO Exception in creating the WindowsDPAPICacheProtector"); + } + } else { + throw new PlatformNotSupportedException("Platform is not supported"); + } + } + } +} diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/msalextensions/cachepersister/CacheProtectorBase.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/msalextensions/cachepersister/CacheProtectorBase.java new file mode 100644 index 000000000000..453043940e0f --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/msalextensions/cachepersister/CacheProtectorBase.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.implementation.msalextensions.cachepersister; + +import com.azure.core.util.logging.ClientLogger; +import com.azure.identity.implementation.msalextensions.CacheLock; +import com.azure.identity.implementation.msalextensions.CacheLockNotObtainedException; + +import java.io.IOException; + +/** + * Abstract class for Cache Protectors + * Provides methods to read and write cache while using a CacheLock + * */ +public abstract class CacheProtectorBase { + + private String lockfileLocation; + private CacheLock lock; + + private ClientLogger logger; + + /** + * Constructor + * initializes cacheLock + * */ + public CacheProtectorBase(String lockfileLocation) { + logger = new ClientLogger(CacheProtectorBase.class); + + this.lockfileLocation = lockfileLocation; + lock = new CacheLock(this.lockfileLocation); + } + + /** + * Obtains lock and uses unprotect() to read and decrypt contents of the cache + * + * @return byte[] contents of cache + * */ + public byte[] readCache() { + byte[] contents = null; + + try { + lock.lock(); + } catch (CacheLockNotObtainedException ex) { + logger.error("readCache() - Issue in locking"); + return contents; + } + + try { + contents = unprotect(); + } catch (IOException ex) { + logger.error("readCache() - Issue in reading"); + } + + lock.unlock(); + return contents; + } + + /** + * Obtains lock and uses protect() to read and encrypt contents of the cache + * + * @param data data to write to cache + * */ + public void writeCache(byte[] data) { + + try { + lock.lock(); + } catch (CacheLockNotObtainedException e) { + logger.error("writeCache() - Issue in locking"); + return; + } + + try { + protect(data); + } catch (IOException e) { + logger.error("writeCache() - Issue in writing"); + } + + lock.unlock(); + } + + /** + * Decrypts data from cache + * + * @return byte[] of cache contents + * + * Overwritten by subclasses; each OS handles differently + * */ + protected byte[] unprotect() throws IOException { + byte[] empty = {}; + return empty; + } + + /** + * Encrypts data and writes to cache + * + * @param data + * + * Overwritten by subclasses; each OS handles differently + * */ + protected void protect(byte[] data) throws IOException { + } + + /** + * Obtains lock and deletes cache using deleteCacheHelper() + * + * @return true if cache is deleted, false otherwise + * */ + public boolean deleteCache() { + try { + lock.lock(); + } catch (CacheLockNotObtainedException e) { + logger.error("deleteCache() - issue in locking"); + return false; + } + + deleteCacheHelper(); + lock.unlock(); + + return true; + } + + /** + * Overwritten by subclasses; each OS handles differently + * */ + protected void deleteCacheHelper() { + } +} diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/msalextensions/cachepersister/PlatformNotSupportedException.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/msalextensions/cachepersister/PlatformNotSupportedException.java new file mode 100644 index 000000000000..61bab965a1d5 --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/msalextensions/cachepersister/PlatformNotSupportedException.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.implementation.msalextensions.cachepersister; + +/** + * Exception for when the current OS is not supported by {@link CachePersister} + * so the OS specific DPAPI cannot be used to encrypt the token cache. + * */ +public class PlatformNotSupportedException extends RuntimeException { + + /** + * Initializes PlatformNotSupportedException + * + * @param message Error message + * */ + public PlatformNotSupportedException(String message) { + super(message); + } + +} diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/msalextensions/cachepersister/windows/WindowsDPAPICacheProtector.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/msalextensions/cachepersister/windows/WindowsDPAPICacheProtector.java new file mode 100644 index 000000000000..97f3091ad8f3 --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/msalextensions/cachepersister/windows/WindowsDPAPICacheProtector.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.implementation.msalextensions.cachepersister.windows; + +import com.azure.identity.implementation.msalextensions.cachepersister.CacheProtectorBase; +import com.sun.jna.platform.win32.Crypt32Util; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; + +/** + * Cache Protector for Windows which uses Windows DPAPI to encrypt the cache + * */ +public class WindowsDPAPICacheProtector extends CacheProtectorBase { + + private final String cacheFilename; + private File cacheFile; + + /** + * Constructor to initialize WindowsDPAPICacheProtector + * Calls super constructor to initialize lock + * + * @param cacheLocation + * @param lockfileLocation + * + * @throws IOException if cacheFile File isn't created + * */ + public WindowsDPAPICacheProtector(String cacheLocation, String lockfileLocation) throws IOException { + super(lockfileLocation); + cacheFilename = cacheLocation; + cacheFile = new File(cacheFilename); + + makeSureFileExists(); + } + + /** + * Uses DPAPI to read and decrypt cache contents + * + * @return byte[] cache contents + * */ + protected byte[] unprotect() throws IOException { + makeSureFileExists(); + + byte[] encryptedBytes = new byte[(int) cacheFile.length()]; + + try (FileInputStream stream = new FileInputStream(cacheFile)) { + int read = 0; + while (read != encryptedBytes.length) { + read += stream.read(encryptedBytes); + } + } + + byte[] decryptedBytes = Crypt32Util.cryptUnprotectData(encryptedBytes); + return decryptedBytes; + } + + /** + * Uses DPAPI to write and protect cache contents + * + * @param data contents to write to cache + * */ + protected void protect(byte[] data) throws IOException { + makeSureFileExists(); + + byte[] encryptedBytes = Crypt32Util.cryptProtectData(data); + + try (FileOutputStream stream = new FileOutputStream(cacheFile)) { + stream.write(encryptedBytes); + } + } + + /** + * Make sure file exists - and write " " if it was just created + * Just a backup in case the cache was deleted + * */ + private void makeSureFileExists() throws IOException { + if (!cacheFile.exists()) { + cacheFile.createNewFile(); + protect(" ".getBytes("UTF-8")); + } + } + + /** + * Deletes the cache file if it exists + * */ + public void deleteCacheHelper() { + if (cacheFile.exists()) { + cacheFile.delete(); + } + } + +} diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/util/CertificateUtil.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/util/CertificateUtil.java index d3ab577ea4ba..6ce09cc00219 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/util/CertificateUtil.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/util/CertificateUtil.java @@ -35,13 +35,14 @@ public static PrivateKey privateKeyFromPem(byte[] pem) { Pattern pattern = Pattern.compile("(?s)-----BEGIN PRIVATE KEY-----.*-----END PRIVATE KEY-----"); Matcher matcher = pattern.matcher(new String(pem, StandardCharsets.UTF_8)); if (!matcher.find()) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException("Certificate file provided is not a valid PEM file.")); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "Certificate file provided is not a valid PEM file.")); } String base64 = matcher.group() - .replace("-----BEGIN PRIVATE KEY-----", "") - .replace("-----END PRIVATE KEY-----", "") - .replace("\n", "") - .replace("\r", ""); + .replace("-----BEGIN PRIVATE KEY-----", "") + .replace("-----END PRIVATE KEY-----", "") + .replace("\n", "") + .replace("\r", ""); byte[] key = Base64Util.decode(base64.getBytes(StandardCharsets.UTF_8)); PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(key); try { @@ -61,7 +62,8 @@ public static X509Certificate publicKeyFromPem(byte[] pem) { Pattern pattern = Pattern.compile("(?s)-----BEGIN CERTIFICATE-----.*-----END CERTIFICATE-----"); Matcher matcher = pattern.matcher(new String(pem, StandardCharsets.UTF_8)); if (!matcher.find()) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException("PEM certificate provided does not contain -----BEGIN CERTIFICATE-----END CERTIFICATE----- block")); + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + "PEM certificate provided does not contain -----BEGIN CERTIFICATE-----END CERTIFICATE----- block")); } try { CertificateFactory factory = CertificateFactory.getInstance("X.509"); diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/ClientCertificateCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/ClientCertificateCredentialTest.java index b8ff9e60b4c7..24a2b0af18ff 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/ClientCertificateCredentialTest.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/ClientCertificateCredentialTest.java @@ -49,14 +49,16 @@ public void testValidCertificates() throws Exception { PowerMockito.whenNew(IdentityClient.class).withAnyArguments().thenReturn(identityClient); // test - ClientCertificateCredential credential = new ClientCertificateCredentialBuilder().tenantId(tenantId).clientId(clientId).pemCertificate(pemPath).build(); + ClientCertificateCredential credential = + new ClientCertificateCredentialBuilder().tenantId(tenantId).clientId(clientId).pemCertificate(pemPath).build(); AccessToken token = credential.getToken(scopes1).block(); - Assert.assertEquals(token1, token.token()); - Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); - credential = new ClientCertificateCredentialBuilder().tenantId(tenantId).clientId(clientId).pfxCertificate(pfxPath, pfxPassword).build(); + Assert.assertEquals(token1, token.getToken()); + Assert.assertEquals(expiresOn.getSecond(), token.getExpiresOn().getSecond()); + credential = + new ClientCertificateCredentialBuilder().tenantId(tenantId).clientId(clientId).pfxCertificate(pfxPath, pfxPassword).build(); token = credential.getToken(scopes2).block(); - Assert.assertEquals(token2, token.token()); - Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + Assert.assertEquals(token2, token.getToken()); + Assert.assertEquals(expiresOn.getSecond(), token.getExpiresOn().getSecond()); } @Test @@ -77,13 +79,15 @@ public void testInvalidCertificates() throws Exception { // test try { - ClientCertificateCredential credential = new ClientCertificateCredentialBuilder().tenantId(tenantId).clientId(clientId).pemCertificate(pemPath).build(); + ClientCertificateCredential credential = + new ClientCertificateCredentialBuilder().tenantId(tenantId).clientId(clientId).pemCertificate(pemPath).build(); credential.getToken(scopes1).block(); } catch (MsalServiceException e) { Assert.assertEquals("bad pem", e.getMessage()); } try { - ClientCertificateCredential credential = new ClientCertificateCredentialBuilder().tenantId(tenantId).clientId(clientId).pfxCertificate(pfxPath, pfxPassword).build(); + ClientCertificateCredential credential = + new ClientCertificateCredentialBuilder().tenantId(tenantId).clientId(clientId).pfxCertificate(pfxPath, pfxPassword).build(); credential.getToken(scopes2).block(); fail(); } catch (MsalServiceException e) { @@ -106,7 +110,8 @@ public void testInvalidParameters() throws Exception { // test try { - ClientCertificateCredential credential = new ClientCertificateCredentialBuilder().clientId(clientId).pemCertificate(pemPath).build(); + ClientCertificateCredential credential = + new ClientCertificateCredentialBuilder().clientId(clientId).pemCertificate(pemPath).build(); credential.getToken(scopes).block(); fail(); } catch (IllegalArgumentException e) { @@ -120,7 +125,8 @@ public void testInvalidParameters() throws Exception { Assert.assertTrue(e.getMessage().contains("clientId")); } try { - ClientCertificateCredential credential = new ClientCertificateCredentialBuilder().tenantId(tenantId).clientId(clientId).build(); + ClientCertificateCredential credential = + new ClientCertificateCredentialBuilder().tenantId(tenantId).clientId(clientId).build(); credential.getToken(scopes).block(); fail(); } catch (IllegalArgumentException e) { diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/ClientSecretCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/ClientSecretCredentialTest.java index 9ef7f6a253e0..1a8c92a11af9 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/ClientSecretCredentialTest.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/ClientSecretCredentialTest.java @@ -47,13 +47,14 @@ public void testValidSecrets() throws Exception { PowerMockito.whenNew(IdentityClient.class).withAnyArguments().thenReturn(identityClient); // test - ClientSecretCredential credential = new ClientSecretCredentialBuilder().tenantId(tenantId).clientId(clientId).clientSecret(secret).build(); + ClientSecretCredential credential = + new ClientSecretCredentialBuilder().tenantId(tenantId).clientId(clientId).clientSecret(secret).build(); AccessToken token = credential.getToken(scopes1).block(); - Assert.assertEquals(token1, token.token()); - Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + Assert.assertEquals(token1, token.getToken()); + Assert.assertEquals(expiresOn.getSecond(), token.getExpiresOn().getSecond()); token = credential.getToken(scopes2).block(); - Assert.assertEquals(token2, token.token()); - Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + Assert.assertEquals(token2, token.getToken()); + Assert.assertEquals(expiresOn.getSecond(), token.getExpiresOn().getSecond()); } @Test @@ -72,12 +73,14 @@ public void testInvalidSecrets() throws Exception { PowerMockito.whenNew(IdentityClient.class).withAnyArguments().thenReturn(identityClient); // test - ClientSecretCredential credential = new ClientSecretCredentialBuilder().tenantId(tenantId).clientId(clientId).clientSecret(secret).build(); + ClientSecretCredential credential = + new ClientSecretCredentialBuilder().tenantId(tenantId).clientId(clientId).clientSecret(secret).build(); AccessToken token = credential.getToken(scopes).block(); - Assert.assertEquals(token1, token.token()); - Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + Assert.assertEquals(token1, token.getToken()); + Assert.assertEquals(expiresOn.getSecond(), token.getExpiresOn().getSecond()); try { - credential = new ClientSecretCredentialBuilder().tenantId(tenantId).clientId(clientId).clientSecret(badSecret).build(); + credential = + new ClientSecretCredentialBuilder().tenantId(tenantId).clientId(clientId).clientSecret(badSecret).build(); credential.getToken(scopes).block(); fail(); } catch (MsalServiceException e) { @@ -100,7 +103,8 @@ public void testInvalidParameters() throws Exception { // test try { - ClientSecretCredential credential = new ClientSecretCredentialBuilder().clientId(clientId).clientSecret(secret).build(); + ClientSecretCredential credential = + new ClientSecretCredentialBuilder().clientId(clientId).clientSecret(secret).build(); credential.getToken(scopes).block(); fail(); } catch (IllegalArgumentException e) { @@ -114,7 +118,8 @@ public void testInvalidParameters() throws Exception { Assert.assertTrue(e.getMessage().contains("clientId")); } try { - ClientSecretCredential credential = new ClientSecretCredentialBuilder().tenantId(tenantId).clientId(clientId).build(); + ClientSecretCredential credential = + new ClientSecretCredentialBuilder().tenantId(tenantId).clientId(clientId).build(); credential.getToken(scopes).block(); fail(); } catch (IllegalArgumentException e) { diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/DefaultAzureCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/DefaultAzureCredentialTest.java index 9c25f03cdca8..72a1a1921ddd 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/DefaultAzureCredentialTest.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/DefaultAzureCredentialTest.java @@ -10,6 +10,7 @@ import com.azure.identity.implementation.IdentityClient; import com.azure.identity.util.TestUtils; import org.junit.Assert; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.powermock.api.mockito.PowerMockito; @@ -55,8 +56,8 @@ public void testUseEnvironmentCredential() throws Exception { // test DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); AccessToken token = credential.getToken(scopes1).block(); - Assert.assertEquals(token1, token.token()); - Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + Assert.assertEquals(token1, token.getToken()); + Assert.assertEquals(expiresOn.getSecond(), token.getExpiresOn().getSecond()); } finally { // clean up configuration.remove("AZURE_CLIENT_ID"); @@ -80,11 +81,11 @@ public void testUseManagedIdentityCredential() throws Exception { // test DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); AccessToken token = credential.getToken(scopes).block(); - Assert.assertEquals(token1, token.token()); - Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + Assert.assertEquals(token1, token.getToken()); + Assert.assertEquals(expiresOn.getSecond(), token.getExpiresOn().getSecond()); } - @Test + @Ignore("Wont work if cache contains user") public void testNoCredentialWorks() throws Exception { // setup String[] scopes = new String[] { "https://management.azure.com" }; diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/DeviceCodeCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/DeviceCodeCredentialTest.java index 7fd33b6b8e4a..1d4da9788e35 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/DeviceCodeCredentialTest.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/DeviceCodeCredentialTest.java @@ -61,12 +61,13 @@ public void testValidDeviceCode() throws Exception { PowerMockito.whenNew(IdentityClient.class).withAnyArguments().thenReturn(identityClient); // test - DeviceCodeCredential credential = new DeviceCodeCredentialBuilder().deviceCodeChallengeConsumer(consumer).clientId(clientId).build(); + DeviceCodeCredential credential = + new DeviceCodeCredentialBuilder().deviceCodeChallengeConsumer(consumer).clientId(clientId).build(); AccessToken token = credential.getToken(scopes1).block(); - Assert.assertEquals(token1, token.token()); - Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + Assert.assertEquals(token1, token.getToken()); + Assert.assertEquals(expiresOn.getSecond(), token.getExpiresOn().getSecond()); token = credential.getToken(scopes2).block(); - Assert.assertEquals(token2, token.token()); - Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + Assert.assertEquals(token2, token.getToken()); + Assert.assertEquals(expiresOn.getSecond(), token.getExpiresOn().getSecond()); } } diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/EnvironmentCredentialTests.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/EnvironmentCredentialTests.java index b9d62395654d..151012b6e1a7 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/EnvironmentCredentialTests.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/EnvironmentCredentialTests.java @@ -33,6 +33,6 @@ public void testCreateEnvironmentCredential() { Assert.assertFalse(message != null && message.contains("Cannot create any credentials with the current environment variables")); return Mono.just(new AccessToken("token", OffsetDateTime.MAX)); }).block(); - Assert.assertEquals("token", token.token()); + Assert.assertEquals("token", token.getToken()); } } diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/InteractiveBrowserCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/InteractiveBrowserCredentialTest.java index a8a5e2b17c85..c1d425f349ec 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/InteractiveBrowserCredentialTest.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/InteractiveBrowserCredentialTest.java @@ -62,12 +62,13 @@ public void testValidInteractive() throws Exception { PowerMockito.whenNew(IdentityClient.class).withAnyArguments().thenReturn(identityClient); // test - InteractiveBrowserCredential credential = new InteractiveBrowserCredentialBuilder().port(port).clientId(clientId).build(); + InteractiveBrowserCredential credential = + new InteractiveBrowserCredentialBuilder().port(port).clientId(clientId).build(); AccessToken token = credential.getToken(scopes1).block(); - Assert.assertEquals(token1, token.token()); - Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + Assert.assertEquals(token1, token.getToken()); + Assert.assertEquals(expiresOn.getSecond(), token.getExpiresOn().getSecond()); token = credential.getToken(scopes2).block(); - Assert.assertEquals(token2, token.token()); - Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + Assert.assertEquals(token2, token.getToken()); + Assert.assertEquals(expiresOn.getSecond(), token.getExpiresOn().getSecond()); } } diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/ManagedIdentityCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/ManagedIdentityCredentialTest.java index 4273c0efb929..dd5a4acd97b5 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/ManagedIdentityCredentialTest.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/ManagedIdentityCredentialTest.java @@ -40,8 +40,8 @@ public void testAppServiceMSICredentialConfigurations() { .put(BaseConfigurations.MSI_ENDPOINT, "http://foo") .put(BaseConfigurations.MSI_SECRET, "bar"); ManagedIdentityCredential credential = new ManagedIdentityCredentialBuilder().build(); - Assert.assertEquals("http://foo", credential.msiEndpoint()); - Assert.assertEquals("bar", credential.msiSecret()); + Assert.assertEquals("http://foo", credential.getMsiEndpoint()); + Assert.assertEquals("bar", credential.getMsiSecret()); } finally { configuration.remove(BaseConfigurations.MSI_ENDPOINT); configuration.remove(BaseConfigurations.MSI_SECRET); @@ -51,7 +51,7 @@ public void testAppServiceMSICredentialConfigurations() { @Test public void testVirtualMachineMSICredentialConfigurations() { ManagedIdentityCredential credential = new ManagedIdentityCredentialBuilder().clientId("foo").build(); - Assert.assertEquals("foo", credential.clientId()); + Assert.assertEquals("foo", credential.getClientId()); } @Test @@ -76,8 +76,8 @@ public void testMSIEndpoint() throws Exception { // test ManagedIdentityCredential credential = new ManagedIdentityCredentialBuilder().clientId(clientId).build(); AccessToken token = credential.getToken(scopes1).block(); - Assert.assertEquals(token1, token.token()); - Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + Assert.assertEquals(token1, token.getToken()); + Assert.assertEquals(expiresOn.getSecond(), token.getExpiresOn().getSecond()); } finally { // clean up configuration.remove("MSI_ENDPOINT"); @@ -100,7 +100,7 @@ public void testIMDS() throws Exception { // test ManagedIdentityCredential credential = new ManagedIdentityCredentialBuilder().clientId(clientId).build(); AccessToken token = credential.getToken(scopes).block(); - Assert.assertEquals(token1, token.token()); - Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + Assert.assertEquals(token1, token.getToken()); + Assert.assertEquals(expiresOn.getSecond(), token.getExpiresOn().getSecond()); } } diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/UsernamePasswordCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/UsernamePasswordCredentialTest.java index 5072acdfcdec..6925c3782f93 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/UsernamePasswordCredentialTest.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/UsernamePasswordCredentialTest.java @@ -60,13 +60,14 @@ public void testValidUserCredential() throws Exception { PowerMockito.whenNew(IdentityClient.class).withAnyArguments().thenReturn(identityClient); // test - UsernamePasswordCredential credential = new UsernamePasswordCredentialBuilder().clientId(clientId).username(username).password(password).build(); + UsernamePasswordCredential credential = + new UsernamePasswordCredentialBuilder().clientId(clientId).username(username).password(password).build(); AccessToken token = credential.getToken(scopes1).block(); - Assert.assertEquals(token1, token.token()); - Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + Assert.assertEquals(token1, token.getToken()); + Assert.assertEquals(expiresOn.getSecond(), token.getExpiresOn().getSecond()); token = credential.getToken(scopes2).block(); - Assert.assertEquals(token2, token.token()); - Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + Assert.assertEquals(token2, token.getToken()); + Assert.assertEquals(expiresOn.getSecond(), token.getExpiresOn().getSecond()); } @Test @@ -85,7 +86,8 @@ public void testInvalidUserCredential() throws Exception { // test try { - UsernamePasswordCredential credential = new UsernamePasswordCredentialBuilder().clientId(clientId).username(username).password(badPassword).build(); + UsernamePasswordCredential credential = + new UsernamePasswordCredentialBuilder().clientId(clientId).username(username).password(badPassword).build(); credential.getToken(scopes).block(); fail(); } catch (MsalServiceException e) { @@ -118,14 +120,16 @@ public void testInvalidParameters() throws Exception { Assert.assertTrue(e.getMessage().contains("clientId")); } try { - UsernamePasswordCredential credential = new UsernamePasswordCredentialBuilder().clientId(clientId).username(username).build(); + UsernamePasswordCredential credential = + new UsernamePasswordCredentialBuilder().clientId(clientId).username(username).build(); credential.getToken(scopes).block(); fail(); } catch (IllegalArgumentException e) { Assert.assertTrue(e.getMessage().contains("password")); } try { - UsernamePasswordCredential credential = new UsernamePasswordCredentialBuilder().clientId(clientId).password(password).build(); + UsernamePasswordCredential credential = + new UsernamePasswordCredentialBuilder().clientId(clientId).password(password).build(); credential.getToken(scopes).block(); fail(); } catch (IllegalArgumentException e) { diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientIntegrationTests.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientIntegrationTests.java index 3dbf250db57f..11fdb4213d72 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientIntegrationTests.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientIntegrationTests.java @@ -21,24 +21,24 @@ public class IdentityClientIntegrationTests { @Ignore("Integration test") public void clientSecretCanGetToken() { - IdentityClient client = new IdentityClient(System.getenv(AZURE_TENANT_ID), System.getenv(AZURE_CLIENT_ID), new IdentityClientOptions().proxyOptions(new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888)))); + IdentityClient client = new IdentityClient(System.getenv(AZURE_TENANT_ID), System.getenv(AZURE_CLIENT_ID), new IdentityClientOptions().setProxyOptions(new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888)))); AccessToken token = client.authenticateWithClientSecret(System.getenv(AZURE_CLIENT_SECRET), scopes).block(); Assert.assertNotNull(token); - Assert.assertNotNull(token.token()); - Assert.assertNotNull(token.expiresOn()); + Assert.assertNotNull(token.getToken()); + Assert.assertNotNull(token.getExpiresOn()); Assert.assertFalse(token.isExpired()); token = client.authenticateWithClientSecret(System.getenv(AZURE_CLIENT_SECRET), new String[] { "https://vault.azure.net/.default" }).block(); Assert.assertNotNull(token); - Assert.assertNotNull(token.token()); - Assert.assertNotNull(token.expiresOn()); + Assert.assertNotNull(token.getToken()); + Assert.assertNotNull(token.getExpiresOn()); Assert.assertFalse(token.isExpired()); } @Ignore("Integration tests") public void deviceCodeCanGetToken() { - IdentityClient client = new IdentityClient("common", System.getenv(AZURE_CLIENT_ID), new IdentityClientOptions().proxyOptions(new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888)))); + IdentityClient client = new IdentityClient("common", System.getenv(AZURE_CLIENT_ID), new IdentityClientOptions().setProxyOptions(new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888)))); MsalToken token = client.authenticateWithDeviceCode(scopes, deviceCode -> { - System.out.println(deviceCode.message()); + System.out.println(deviceCode.getMessage()); try { Thread.sleep(60000); } catch (InterruptedException e) { @@ -46,43 +46,43 @@ public void deviceCodeCanGetToken() { } }).block(); Assert.assertNotNull(token); - Assert.assertNotNull(token.token()); - Assert.assertNotNull(token.expiresOn()); + Assert.assertNotNull(token.getToken()); + Assert.assertNotNull(token.getExpiresOn()); Assert.assertFalse(token.isExpired()); token = client.authenticateWithUserRefreshToken(new String[] { "https://vault.azure.net/.default" }, token).block(); Assert.assertNotNull(token); - Assert.assertNotNull(token.token()); - Assert.assertNotNull(token.expiresOn()); + Assert.assertNotNull(token.getToken()); + Assert.assertNotNull(token.getExpiresOn()); Assert.assertFalse(token.isExpired()); } @Ignore("Integration tests") public void browserCanGetToken() { - IdentityClient client = new IdentityClient("common", System.getenv(AZURE_CLIENT_ID), new IdentityClientOptions().proxyOptions(new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888)))); + IdentityClient client = new IdentityClient("common", System.getenv(AZURE_CLIENT_ID), new IdentityClientOptions().setProxyOptions(new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888)))); MsalToken token = client.authenticateWithBrowserInteraction(scopes, 8765).block(); Assert.assertNotNull(token); - Assert.assertNotNull(token.token()); - Assert.assertNotNull(token.expiresOn()); + Assert.assertNotNull(token.getToken()); + Assert.assertNotNull(token.getExpiresOn()); Assert.assertFalse(token.isExpired()); token = client.authenticateWithUserRefreshToken(new String[] { "https://vault.azure.net/.default" }, token).block(); Assert.assertNotNull(token); - Assert.assertNotNull(token.token()); - Assert.assertNotNull(token.expiresOn()); + Assert.assertNotNull(token.getToken()); + Assert.assertNotNull(token.getExpiresOn()); Assert.assertFalse(token.isExpired()); } @Ignore("Integration tests") public void usernamePasswordCanGetToken() { - IdentityClient client = new IdentityClient("common", System.getenv(AZURE_CLIENT_ID), new IdentityClientOptions().proxyOptions(new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888)))); + IdentityClient client = new IdentityClient("common", System.getenv(AZURE_CLIENT_ID), new IdentityClientOptions().setProxyOptions(new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888)))); MsalToken token = client.authenticateWithUsernamePassword(scopes, System.getenv("username"), System.getenv("password")).block(); Assert.assertNotNull(token); - Assert.assertNotNull(token.token()); - Assert.assertNotNull(token.expiresOn()); + Assert.assertNotNull(token.getToken()); + Assert.assertNotNull(token.getExpiresOn()); Assert.assertFalse(token.isExpired()); token = client.authenticateWithUserRefreshToken(new String[] { "https://vault.azure.net/.default" }, token).block(); Assert.assertNotNull(token); - Assert.assertNotNull(token.token()); - Assert.assertNotNull(token.expiresOn()); + Assert.assertNotNull(token.getToken()); + Assert.assertNotNull(token.getExpiresOn()); Assert.assertFalse(token.isExpired()); } } diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientTests.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientTests.java index 3988dc803351..f4855054a388 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientTests.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientTests.java @@ -55,8 +55,8 @@ public void testValidSecret() throws Exception { // test IdentityClient client = new IdentityClientBuilder().tenantId(tenantId).clientId(clientId).build(); AccessToken token = client.authenticateWithClientSecret(secret, scopes).block(); - Assert.assertEquals(accessToken, token.token()); - Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + Assert.assertEquals(accessToken, token.getToken()); + Assert.assertEquals(expiresOn.getSecond(), token.getExpiresOn().getSecond()); } @Test @@ -94,8 +94,8 @@ public void testValidCertificate() throws Exception { // test IdentityClient client = new IdentityClientBuilder().tenantId(tenantId).clientId(clientId).build(); AccessToken token = client.authenticateWithPfxCertificate(pfxPath, "StrongPass!123", scopes).block(); - Assert.assertEquals(accessToken, token.token()); - Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + Assert.assertEquals(accessToken, token.getToken()); + Assert.assertEquals(expiresOn.getSecond(), token.getExpiresOn().getSecond()); } @Test @@ -132,8 +132,8 @@ public void testValidDeviceCodeFlow() throws Exception { // test IdentityClient client = new IdentityClientBuilder().tenantId(tenantId).clientId(clientId).build(); AccessToken token = client.authenticateWithDeviceCode(scopes, deviceCodeChallenge -> { /* do nothing */ }).block(); - Assert.assertEquals(accessToken, token.token()); - Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + Assert.assertEquals(accessToken, token.getToken()); + Assert.assertEquals(expiresOn.getSecond(), token.getExpiresOn().getSecond()); } /****** mocks ******/ diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/msalextensions/CacheLockTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/msalextensions/CacheLockTest.java new file mode 100644 index 000000000000..f28d76a8aef3 --- /dev/null +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/msalextensions/CacheLockTest.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.implementation.msalextensions; + +import com.sun.jna.Platform; +import org.junit.*; + +import java.io.*; +import java.util.Stack; +import java.util.stream.Collectors; + +public class CacheLockTest { + + private static String folder; + private static String testerFilename; + private static String lockfile; + + @BeforeClass + public static void setup() { + // get proper file paths + String currDir = System.getProperty("user.dir"); + String home = System.getProperty("user.home"); + + java.nio.file.Path classes = java.nio.file.Paths.get(currDir, "target", "classes"); + java.nio.file.Path tests = java.nio.file.Paths.get(currDir, "target", "test-classes"); + + testerFilename = java.nio.file.Paths.get(home, "tester.txt").toString(); + lockfile = java.nio.file.Paths.get(home, "testlock.lockfile").toString(); + + String delimiter = ":"; + if (Platform.isWindows()) { + delimiter = ";"; + } + folder = classes.toString() + delimiter + tests; + } + + @Test + public void tenThreadsWritingToFile() throws IOException { + + // make sure tester.json file doesn't already exist + File tester = new File(testerFilename); + tester.delete(); + + // delete the lock file just in case before starting + File lock = new File(lockfile); + lock.delete(); + + FileWriter a = new FileWriter("a", lockfile, testerFilename); + FileWriter b = new FileWriter("b", lockfile, testerFilename); + FileWriter c = new FileWriter("c", lockfile, testerFilename); + FileWriter d = new FileWriter("d", lockfile, testerFilename); + FileWriter e = new FileWriter("e", lockfile, testerFilename); + FileWriter f = new FileWriter("f", lockfile, testerFilename); + FileWriter g = new FileWriter("g", lockfile, testerFilename); + FileWriter h = new FileWriter("h", lockfile, testerFilename); + FileWriter i = new FileWriter("i", lockfile, testerFilename); + FileWriter j = new FileWriter("j", lockfile, testerFilename); + + try { + a.t.join(); + b.t.join(); + c.t.join(); + d.t.join(); + e.t.join(); + f.t.join(); + g.t.join(); + h.t.join(); + i.t.join(); + j.t.join(); + } catch (Exception ex) { + System.out.printf("Error with threads"); + } + + Stack stack = new Stack<>(); + int popped = 0; + + File file = new File(testerFilename); + + if (file.exists()) { + FileReader reader = new FileReader(file); + BufferedReader bufferedReader = new BufferedReader(reader); + StringBuffer stringBuffer = new StringBuffer(); + String line; + while ((line = bufferedReader.readLine()) != null) { + String[] tokens = line.split(" "); + if (tokens[0].equals("<")) { // enter + stack.push(tokens[1]); + } else if (tokens[0].equals(">")) { // exit + if (stack.peek().equals(tokens[1])) { + stack.pop(); + popped++; + } else { + System.out.println("messed up: " + tokens[1]); + } + } + } + reader.close(); + + if (!stack.empty()) { + Assert.fail(); + } + } else { + Assert.fail("File does not exist"); + } + + Assert.assertEquals("10 processes didn't write", popped, 10); + + } + + @Ignore("Run local only - CI does not support classpath well") + public void tenProcessesWritingToFile() throws IOException, InterruptedException { + // make sure tester.json file doesn't already exist + File tester = new File(testerFilename); + tester.delete(); + + // delete the lock file just in case before starting + File lock = new File(lockfile); + lock.delete(); + + String mainClass = com.azure.identity.implementation.msalextensions.FileWriter.class.getName(); + Process process1 = new ProcessBuilder(new String[]{"java", "-cp", folder, mainClass, Integer.toString(1), lockfile, testerFilename}).start(); + Process process2 = new ProcessBuilder(new String[]{"java", "-cp", folder, mainClass, Integer.toString(2), lockfile, testerFilename}).start(); + Process process3 = new ProcessBuilder(new String[]{"java", "-cp", folder, mainClass, Integer.toString(3), lockfile, testerFilename}).start(); + Process process4 = new ProcessBuilder(new String[]{"java", "-cp", folder, mainClass, Integer.toString(4), lockfile, testerFilename}).start(); + Process process5 = new ProcessBuilder(new String[]{"java", "-cp", folder, mainClass, Integer.toString(5), lockfile, testerFilename}).start(); + Process process6 = new ProcessBuilder(new String[]{"java", "-cp", folder, mainClass, Integer.toString(6), lockfile, testerFilename}).start(); + Process process7 = new ProcessBuilder(new String[]{"java", "-cp", folder, mainClass, Integer.toString(7), lockfile, testerFilename}).start(); + Process process8 = new ProcessBuilder(new String[]{"java", "-cp", folder, mainClass, Integer.toString(8), lockfile, testerFilename}).start(); + Process process9 = new ProcessBuilder(new String[]{"java", "-cp", folder, mainClass, Integer.toString(9), lockfile, testerFilename}).start(); + Process process10 = new ProcessBuilder(new String[]{"java", "-cp", folder, mainClass, Integer.toString(10), lockfile, testerFilename}).start(); + + waitForProcess(process1); + waitForProcess(process2); + waitForProcess(process3); + waitForProcess(process4); + waitForProcess(process5); + waitForProcess(process6); + waitForProcess(process7); + waitForProcess(process8); + waitForProcess(process9); + waitForProcess(process10); + + Stack stack = new Stack<>(); + int popped = 0; + + File file = new File(testerFilename); + if (file.exists()) { + FileReader reader = new FileReader(file); + BufferedReader bufferedReader = new BufferedReader(reader); + StringBuffer stringBuffer = new StringBuffer(); + String line; + while ((line = bufferedReader.readLine()) != null) { + String[] tokens = line.split(" "); + if (tokens[0].equals("<")) { // enter + stack.push(tokens[1]); + } else if (tokens[0].equals(">")) { // exit + if (stack.peek().equals(tokens[1])) { + stack.pop(); + popped++; + } else { + System.out.println("messed up: " + tokens[1]); + } + } + } + reader.close(); + + if (!stack.empty()) { + Assert.fail(); + } + } else { + Assert.fail("File does not exist"); + } + + Assert.assertEquals("10 processes didn't write", popped, 10); + } + + private void waitForProcess(Process process) throws InterruptedException { + if (process.waitFor() != 0) { + throw new RuntimeException(new BufferedReader(new InputStreamReader(process.getErrorStream())) + .lines().collect(Collectors.joining("\n"))); + } + } + + /* + * Class to be used for testing threads + * */ + class FileWriter implements Runnable { + + String threadName; + File file; + String lockfile; + Thread t; + + FileWriter(String threadName, String lockfile, String filename) { + this.threadName = threadName; + this.lockfile = lockfile; + this.file = new File(filename); + + t = new Thread(this, threadName); + t.start(); + } + + public void run() { + CacheLock lock = new CacheLock(lockfile); + try { + lock.lock(); + try { + if (!file.exists()) { + file.createNewFile(); + } + FileOutputStream os = new FileOutputStream(file, true); + + os.write(("< " + threadName + "\n").getBytes()); + Thread.sleep(1000); + os.write(("> " + threadName + "\n").getBytes()); + + os.close(); + } catch (Exception ex) { + + } + } catch (Exception ex) { + System.out.println("Couldn't obtain lock"); + } finally { + try { + lock.unlock(); + } catch (Exception ex) { + System.out.println("aljsdladsk"); + } + } + + + } + } +} diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/msalextensions/CrossProgramVSTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/msalextensions/CrossProgramVSTest.java new file mode 100644 index 000000000000..2af976acc872 --- /dev/null +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/msalextensions/CrossProgramVSTest.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.implementation.msalextensions; + +import com.azure.identity.implementation.msalextensions.cachepersister.CachePersister; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import com.microsoft.aad.msal4j.ClientCredentialFactory; +import com.microsoft.aad.msal4j.ClientCredentialParameters; +import com.microsoft.aad.msal4j.ConfidentialClientApplication; +import com.microsoft.aad.msal4j.IAuthenticationResult; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import java.util.Collections; +import java.util.concurrent.CompletableFuture; + +/* + * Before running these tests, log into Azure with the new Visual Studio 16.3.0 Preview 1 + * This should create a msal.cache file in the the user directory, and these tests should be able to read and + * write from the same file. + * Note that deleting this cache file will cause the user to have to re-log in with Visual Studio as this will delete + * the tokens in the cache + * + * NOTE: These tests are written assuming that nothing else has written to the MSAL cache besides visual studio + * */ +public class CrossProgramVSTest { + + CachePersister cachePersister; + PersistentTokenCacheAccessAspect accessAspect; + + private ConfidentialClientApplication confApp; + private ClientCredentialParameters confParameters; + + private int count = 0; + + @Before + public void setup() throws Exception { + org.junit.Assume.assumeTrue("Skipping these tests until we mock or record it", false); + //using the default cachepersister and accessAspect objects + cachePersister = new CachePersister.Builder().build(); + accessAspect = new PersistentTokenCacheAccessAspect(); + + confApp = ConfidentialClientApplication.builder(TestConfiguration.CONFIDENTIAL_CLIENT_ID, + ClientCredentialFactory.create(TestConfiguration.CONFIDENTIAL_CLIENT_SECRET)) + .authority(TestConfiguration.TENANT_SPECIFIC_AUTHORITY) + .setTokenCacheAccessAspect(accessAspect) + .build(); + + confParameters = ClientCredentialParameters.builder( + Collections.singleton(TestConfiguration.GRAPH_DEFAULT_SCOPE)) + .build(); + } + + @Test + public void readCacheAfterVSAzureLogin() { + byte[] currJsonBytes = cachePersister.readCache(); + String currJson = new String(currJsonBytes); + + JsonObject jsonObj = new JsonParser().parse(currJson).getAsJsonObject(); + + Assert.assertTrue(jsonObj.has("AccessToken")); + Assert.assertTrue(jsonObj.has("RefreshToken")); + Assert.assertTrue(jsonObj.has("IdToken")); + Assert.assertTrue(jsonObj.has("Account")); + Assert.assertTrue(jsonObj.has("AppMetadata")); + + System.out.println(currJson); + + count = jsonObj.get("AccessToken").getAsJsonObject().keySet().size(); + } + + @Test + public void writeToSameCacheFileAfterVSAzureLogin() { + String currJson = new String(cachePersister.readCache()); + JsonObject jsonObj = new JsonParser().parse(currJson).getAsJsonObject(); + + int set = jsonObj.get("AccessToken").getAsJsonObject().keySet().size(); + + CompletableFuture result = confApp.acquireToken(confParameters); + result.handle((res, ex) -> { + if (ex != null) { + System.out.println("Oops! We have an exception - " + ex.getMessage()); + return "Unknown!"; + } + return res; + + }).join(); + + currJson = new String(cachePersister.readCache()); + jsonObj = new JsonParser().parse(currJson).getAsJsonObject(); + + int newSet = jsonObj.get("AccessToken").getAsJsonObject().keySet().size(); + + Assert.assertEquals(newSet, set + 1); + count++; + + System.out.println(currJson); + } + + @Test + public void countCache() { + byte[] currJsonBytes = cachePersister.readCache(); + String currJson = new String(currJsonBytes); + + JsonObject jsonObj = new JsonParser().parse(currJson).getAsJsonObject(); + int newSet = jsonObj.get("AccessToken").getAsJsonObject().keySet().size(); + System.out.println(newSet); + } + + @Test + public void readCacheAfterPowershellAzureLogin() { + byte[] currJsonBytes = cachePersister.readCache(); + String currJson = new String(currJsonBytes); + + JsonObject jsonObj = new JsonParser().parse(currJson).getAsJsonObject(); + System.out.println(currJson); + + int newSet = jsonObj.get("AccessToken").getAsJsonObject().keySet().size(); + + Assert.assertEquals(newSet, 6); + count++; + } + +} diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/msalextensions/FileWriter.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/msalextensions/FileWriter.java new file mode 100644 index 000000000000..17dd249c7493 --- /dev/null +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/msalextensions/FileWriter.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.implementation.msalextensions; + +import java.io.File; +import java.io.FileOutputStream; + +public class FileWriter { + + public static void main(String[] args) throws Exception { + File file; + String lockfile; + + if (args.length == 3) { + lockfile = args[1]; + file = new File(args[2]); + } else { + System.out.println("wrong number of args lol????"); + return; + } + CacheLock lock = new CacheLock(lockfile); + + int retries = 3; + boolean succeeded = false; + while (retries-- > 0 && !succeeded) { + try { + lock.lock(); + + if (!file.exists()) { + file.createNewFile(); + } + FileOutputStream os = new FileOutputStream(file, true); + + os.write(("< " + args[0] + "\n").getBytes()); + Thread.sleep(1000); + os.write(("> " + args[0] + "\n").getBytes()); + + os.close(); + succeeded = true; + } finally { + lock.unlock(); + } + } + + } +} diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/msalextensions/MsalCacheStorageTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/msalextensions/MsalCacheStorageTest.java new file mode 100644 index 000000000000..90193076612e --- /dev/null +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/msalextensions/MsalCacheStorageTest.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.implementation.msalextensions; + +import com.azure.identity.implementation.msalextensions.cachepersister.CachePersister; +import com.sun.jna.Platform; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import java.io.File; + +public class MsalCacheStorageTest { + + private CachePersister cachePersister; + private String cacheLocation; + + @Before + public void setup() throws Exception { + org.junit.Assume.assumeTrue(Platform.isWindows()); + cacheLocation = java.nio.file.Paths.get(System.getProperty("user.home"), "test.cache").toString(); + cachePersister = new CachePersister.Builder() + .cacheLocation(cacheLocation) + .lockfileLocation(cacheLocation + ".lockfile") + .build(); + } + + @Test + public void writesReadsCacheData() { + try { + File f = new File(cacheLocation); + + String testString = "hello world"; + + cachePersister.writeCache(testString.getBytes()); + String receivedString = new String(cachePersister.readCache()); + + Assert.assertEquals(receivedString, testString); + + cachePersister.deleteCache(); + } finally { + cachePersister.deleteCache(); + } + } + +} diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/msalextensions/MultithreadedTokenCacheTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/msalextensions/MultithreadedTokenCacheTest.java new file mode 100644 index 000000000000..9d347ae8edaf --- /dev/null +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/msalextensions/MultithreadedTokenCacheTest.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.implementation.msalextensions; + +import com.azure.identity.implementation.msalextensions.cachepersister.CachePersister; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import com.microsoft.aad.msal4j.*; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import java.util.Collections; +import java.util.concurrent.CompletableFuture; +import java.util.function.Consumer; + +public class MultithreadedTokenCacheTest { + + private PersistentTokenCacheAccessAspect accessAspect; + private CachePersister cachePersister; + + private ConfidentialClientApplication confApp; + private ConfidentialClientApplication confApp2; + private PublicClientApplication pubApp; + private ClientCredentialParameters confParameters; + private DeviceCodeFlowParameters pubParameters; + + @Before + public void setup() throws Exception { + org.junit.Assume.assumeTrue("Skipping these tests until we mock or record it", false); + // custom MsalCacheStorage for testing purposes so we don't overwrite the real one + cachePersister = new CachePersister.Builder() + .cacheLocation(java.nio.file.Paths.get(System.getProperty("user.home"), "test.cache").toString()) + .build(); + + accessAspect = new PersistentTokenCacheAccessAspect(cachePersister); + + confApp = ConfidentialClientApplication.builder(TestConfiguration.CONFIDENTIAL_CLIENT_ID, + ClientCredentialFactory.create(TestConfiguration.CONFIDENTIAL_CLIENT_SECRET)) + .authority(TestConfiguration.TENANT_SPECIFIC_AUTHORITY) + .setTokenCacheAccessAspect(accessAspect) + .build(); + + confApp2 = ConfidentialClientApplication.builder(TestConfiguration.CONFIDENTIAL_CLIENT_ID_2, + ClientCredentialFactory.create(TestConfiguration.CONFIDENTIAL_CLIENT_SECRET_2)) + .authority(TestConfiguration.TENANT_SPECIFIC_AUTHORITY) + .setTokenCacheAccessAspect(accessAspect) + .build(); + + confParameters = ClientCredentialParameters.builder( + Collections.singleton(TestConfiguration.GRAPH_DEFAULT_SCOPE)) + .build(); + + + pubApp = PublicClientApplication.builder(TestConfiguration.PUBLIC_CLIENT_ID) + .authority(TestConfiguration.TENANT_SPECIFIC_AUTHORITY) + .setTokenCacheAccessAspect(accessAspect) + .build(); + + Consumer deviceCodeConsumer = (DeviceCode deviceCode) -> System.out.println(deviceCode.message()); + + pubParameters = DeviceCodeFlowParameters.builder( + Collections.singleton(TestConfiguration.GRAPH_DEFAULT_SCOPE), + deviceCodeConsumer) + .build(); + } + + @After + public void cleanup() { + if (accessAspect != null) { + accessAspect.deleteCache(); + } + } + + @Test + public void twoThreadsWritingTokens() { + + ConcurrentClient a = new ConcurrentClient("conf"); + ConcurrentClient b = new ConcurrentClient("pub"); + + try { + a.t.join(); + b.t.join(); + } catch (Exception e) { + System.out.printf("Error with threads"); + } + + byte[] currJsonBytes = cachePersister.readCache(); + String currJson = new String(currJsonBytes); + + JsonObject jsonObj = new JsonParser().parse(currJson).getAsJsonObject(); + + Assert.assertTrue(jsonObj.get("AccessToken").getAsJsonObject().keySet().size() == 2); + Assert.assertTrue(jsonObj.get("RefreshToken").getAsJsonObject().keySet().size() == 1); + Assert.assertTrue(jsonObj.get("IdToken").getAsJsonObject().keySet().size() == 1); + Assert.assertTrue(jsonObj.get("Account").getAsJsonObject().keySet().size() == 1); + Assert.assertTrue(jsonObj.get("AppMetadata").getAsJsonObject().keySet().size() == 1); + + accessAspect.deleteCache(); + } + + @Test + public void tenThreadsWritingSameConfTokens() { + + ConcurrentClient a = new ConcurrentClient("conf"); + ConcurrentClient b = new ConcurrentClient("conf"); + ConcurrentClient c = new ConcurrentClient("conf"); + ConcurrentClient d = new ConcurrentClient("conf"); + ConcurrentClient e = new ConcurrentClient("conf"); + ConcurrentClient f = new ConcurrentClient("conf"); + ConcurrentClient g = new ConcurrentClient("conf"); + ConcurrentClient h = new ConcurrentClient("conf"); + ConcurrentClient i = new ConcurrentClient("conf"); + ConcurrentClient j = new ConcurrentClient("conf"); + + try { + a.t.join(); + b.t.join(); + c.t.join(); + d.t.join(); + e.t.join(); + f.t.join(); + g.t.join(); + h.t.join(); + i.t.join(); + j.t.join(); + } catch (Exception ex) { + System.out.printf("Error with threads"); + } + + + byte[] currJsonBytes = cachePersister.readCache(); + String currJson = new String(currJsonBytes); + + JsonObject jsonObj = new JsonParser().parse(currJson).getAsJsonObject(); + + + System.out.println("keys: " + jsonObj.get("AccessToken").getAsJsonObject().keySet().size()); + + Assert.assertTrue(jsonObj.get("AccessToken").getAsJsonObject().keySet().size() == 1); + Assert.assertTrue(jsonObj.get("RefreshToken").getAsJsonObject().keySet().size() == 0); + Assert.assertTrue(jsonObj.get("IdToken").getAsJsonObject().keySet().size() == 0); + Assert.assertTrue(jsonObj.get("Account").getAsJsonObject().keySet().size() == 0); + Assert.assertTrue(jsonObj.get("AppMetadata").getAsJsonObject().keySet().size() == 0); + + accessAspect.deleteCache(); + } + + class ConcurrentClient implements Runnable { + + String threadName; + Thread t; + + ConcurrentClient(String threadName) { + this.threadName = threadName; + t = new Thread(this, threadName); + t.start(); + } + + public void run() { + + if (threadName.equals("conf")) { + CompletableFuture result = confApp.acquireToken(confParameters); + + result.handle((res, ex) -> { + if (ex != null) { + System.out.println("Oops! We have an exception 1 - " + ex.getMessage()); + return "Unknown!"; + } + return res; + + }).join(); + } else if (threadName.equals("pub")) { + + CompletableFuture result = pubApp.acquireToken( + pubParameters); + + result.handle((res, ex) -> { + if (ex != null) { + System.out.println("Oops! We have an exception 2 - " + ex.getMessage()); + return "Unknown!"; + } + + return res; + + }).join(); + } + } + + } +} diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/msalextensions/PersistentTokenCacheAccessAspectTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/msalextensions/PersistentTokenCacheAccessAspectTest.java new file mode 100644 index 000000000000..2b78b6daae7b --- /dev/null +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/msalextensions/PersistentTokenCacheAccessAspectTest.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.implementation.msalextensions; + +import com.azure.identity.implementation.msalextensions.cachepersister.CachePersister; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import com.microsoft.aad.msal4j.*; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import java.util.Collections; +import java.util.concurrent.CompletableFuture; +import java.util.function.Consumer; + +public class PersistentTokenCacheAccessAspectTest { + + private PersistentTokenCacheAccessAspect accessAspect; + private CachePersister cachePersister; + + private ConfidentialClientApplication confApp; + private ConfidentialClientApplication confApp2; + private PublicClientApplication pubApp; + private ClientCredentialParameters confParameters; + private DeviceCodeFlowParameters pubParameters; + + @Before + public void setup() throws Exception { + org.junit.Assume.assumeTrue("Skipping these tests until we mock or record it", false); + // custom MsalCacheStorage for testing purposes so we don't overwrite the real one + cachePersister = new CachePersister.Builder() + .cacheLocation(java.nio.file.Paths.get(System.getProperty("user.home"), "test.cache").toString()) + .build(); + + accessAspect = new PersistentTokenCacheAccessAspect(cachePersister); + + Consumer deviceCodeConsumer = (DeviceCode deviceCode) -> { + System.out.println(deviceCode.message()); + }; + + confApp = ConfidentialClientApplication.builder(TestConfiguration.CONFIDENTIAL_CLIENT_ID, + ClientCredentialFactory.create(TestConfiguration.CONFIDENTIAL_CLIENT_SECRET)) + .authority(TestConfiguration.TENANT_SPECIFIC_AUTHORITY) + .setTokenCacheAccessAspect(accessAspect) + .build(); + + confApp2 = ConfidentialClientApplication.builder(TestConfiguration.CONFIDENTIAL_CLIENT_ID_2, + ClientCredentialFactory.create(TestConfiguration.CONFIDENTIAL_CLIENT_SECRET_2)) + .authority(TestConfiguration.TENANT_SPECIFIC_AUTHORITY) + .setTokenCacheAccessAspect(accessAspect) + .build(); + + pubApp = PublicClientApplication.builder(TestConfiguration.PUBLIC_CLIENT_ID) + .authority(TestConfiguration.TENANT_SPECIFIC_AUTHORITY) + .setTokenCacheAccessAspect(accessAspect) + .build(); + + confParameters = ClientCredentialParameters.builder( + Collections.singleton(TestConfiguration.GRAPH_DEFAULT_SCOPE)) + .build(); + + pubParameters = DeviceCodeFlowParameters.builder( + Collections.singleton(TestConfiguration.GRAPH_DEFAULT_SCOPE), + deviceCodeConsumer) + .build(); + } + + @After + public void cleanup() { + if (accessAspect != null) { + accessAspect.deleteCache(); + } + } + + @Test + public void checkIfWritesToFileFirstTimeConfidentialClient() { + + CompletableFuture result = confApp.acquireToken(confParameters); + + result.handle((res, ex) -> { + if (ex != null) { + System.out.println("Oops! We have an exception - " + ex.getMessage()); + return "Unknown!"; + } + return res; + + }).join(); + + byte[] currJsonBytes = cachePersister.readCache(); + String currJson = new String(currJsonBytes); + + JsonObject jsonObj = new JsonParser().parse(currJson).getAsJsonObject(); + + Assert.assertTrue(jsonObj.has("AccessToken")); + Assert.assertTrue(jsonObj.has("RefreshToken")); + Assert.assertTrue(jsonObj.has("IdToken")); + Assert.assertTrue(jsonObj.has("Account")); + Assert.assertTrue(jsonObj.has("AppMetadata")); + + int set = jsonObj.get("AccessToken").getAsJsonObject().keySet().size(); + + Assert.assertEquals(set, 1); + + accessAspect.deleteCache(); + } + + @Test + public void checkIfWritesToFileFirstTimePublicClient() { + + CompletableFuture result = pubApp.acquireToken( + pubParameters); + + result.handle((res, ex) -> { + if (ex != null) { + System.out.println("Oops! We have an exception - " + ex.getMessage()); + return "Unknown!"; + } + return res; + + }).join(); + + byte[] currJsonBytes = cachePersister.readCache(); + String currJson = new String(currJsonBytes); + + JsonObject jsonObj = new JsonParser().parse(currJson).getAsJsonObject(); + + Assert.assertTrue(jsonObj.has("AccessToken")); + Assert.assertTrue(jsonObj.has("RefreshToken")); + Assert.assertTrue(jsonObj.has("IdToken")); + Assert.assertTrue(jsonObj.has("Account")); + Assert.assertTrue(jsonObj.has("AppMetadata")); + + Assert.assertTrue(jsonObj.get("AccessToken").getAsJsonObject().keySet().size() == 1); + + accessAspect.deleteCache(); + } + + @Test + public void addsAccountToListPubClient() { + + CompletableFuture result = pubApp.acquireToken( + pubParameters); + + result.handle((res, ex) -> { + if (ex != null) { + System.out.println("Oops! We have an exception - " + ex.getMessage()); + return "Unknown!"; + } + + return res; + + }).join(); + + Assert.assertEquals(pubApp.getAccounts().join().size(), 1); + + accessAspect.deleteCache(); + } + + @Test + public void writesTwoTokensToCache() { + CompletableFuture result = pubApp.acquireToken( + pubParameters); + + result.handle((res, ex) -> { + if (ex != null) { + System.out.println("Oops! We have an exception 1 - " + ex.getMessage()); + return "Unknown!"; + } + + return res; + + }).join(); + + CompletableFuture result2 = confApp.acquireToken(confParameters); + + result2.handle((res, ex) -> { + if (ex != null) { + System.out.println("Oops! We have an exception 2 - " + ex.getMessage()); + return "Unknown!"; + } + return res; + + }).join(); + + byte[] currJsonBytes = cachePersister.readCache(); + String currJson = new String(currJsonBytes); + + JsonObject jsonObj = new JsonParser().parse(currJson).getAsJsonObject(); + + Assert.assertTrue(jsonObj.get("AccessToken").getAsJsonObject().keySet().size() == 2); + Assert.assertTrue(jsonObj.get("RefreshToken").getAsJsonObject().keySet().size() == 1); + Assert.assertTrue(jsonObj.get("IdToken").getAsJsonObject().keySet().size() == 1); + Assert.assertTrue(jsonObj.get("Account").getAsJsonObject().keySet().size() == 1); + Assert.assertTrue(jsonObj.get("AppMetadata").getAsJsonObject().keySet().size() == 1); + + accessAspect.deleteCache(); + } + + @Test + public void writesReadsMultipleTokensToCache() { + CompletableFuture result = pubApp.acquireToken( + pubParameters); + + result.handle((res, ex) -> { + if (ex != null) { + System.out.println("Oops! We have an exception 1 - " + ex.getMessage()); + return "Unknown!"; + } + return res; + + }).join(); + + CompletableFuture result2 = confApp.acquireToken(confParameters); + + result2.handle((res, ex) -> { + if (ex != null) { + System.out.println("Oops! We have an exception 2 - " + ex.getMessage()); + return "Unknown!"; + } + return res; + + }).join(); + + CompletableFuture result3 = confApp2.acquireToken(confParameters); + + result3.handle((res, ex) -> { + if (ex != null) { + System.out.println("Oops! We have an exception 3 - " + ex.getMessage()); + return "Unknown!"; + } + return res; + + }).join(); + + byte[] currJsonBytes = cachePersister.readCache(); + String currJson = new String(currJsonBytes); + + JsonObject jsonObj = new JsonParser().parse(currJson).getAsJsonObject(); + + Assert.assertTrue(jsonObj.get("AccessToken").getAsJsonObject().keySet().size() == 3); + Assert.assertTrue(jsonObj.get("RefreshToken").getAsJsonObject().keySet().size() == 1); + Assert.assertTrue(jsonObj.get("IdToken").getAsJsonObject().keySet().size() == 1); + Assert.assertTrue(jsonObj.get("Account").getAsJsonObject().keySet().size() == 1); + Assert.assertTrue(jsonObj.get("AppMetadata").getAsJsonObject().keySet().size() == 1); + + accessAspect.deleteCache(); + } + + @Test + public void syncsCacheWithExpiredTokens() { + CompletableFuture result3 = confApp2.acquireToken(confParameters); + + result3.handle((res, ex) -> { + if (ex != null) { + System.out.println("Oops! We have an exception 3 - " + ex.getMessage()); + return "Unknown!"; + } + return res; + + }).join(); + + accessAspect.deleteCache(); + } +} diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/msalextensions/TestConfiguration.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/msalextensions/TestConfiguration.java new file mode 100644 index 000000000000..8841df4f0557 --- /dev/null +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/msalextensions/TestConfiguration.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.implementation.msalextensions; + +public class TestConfiguration { + + static final String TENANT_SPECIFIC_AUTHORITY = "https://login.microsoftonline.com/[insert here]/"; + + static final String PUBLIC_CLIENT_ID = ""; + + static final String GRAPH_DEFAULT_SCOPE = "https://graph.windows.net/.default"; + + static final String CONFIDENTIAL_CLIENT_ID = ""; + static final String CONFIDENTIAL_CLIENT_ID_2 = ""; + + static final String CONFIDENTIAL_CLIENT_SECRET = ""; + static final String CONFIDENTIAL_CLIENT_SECRET_2 = ""; +} diff --git a/sdk/identity/ci.yml b/sdk/identity/ci.yml index afc37e6ac1b1..f2e9e254f211 100644 --- a/sdk/identity/ci.yml +++ b/sdk/identity/ci.yml @@ -35,4 +35,5 @@ stages: ServiceDirectory: identity Artifacts: - name: azure-identity - safeName: azureidentity \ No newline at end of file + safeName: azureidentity + stagingProfileId: 88192f04117501 diff --git a/sdk/keyvault/azure-keyvault-certificates/CHANGELOG.md b/sdk/keyvault/azure-keyvault-certificates/CHANGELOG.md new file mode 100644 index 000000000000..c0ee25ac64ee --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/CHANGELOG.md @@ -0,0 +1,28 @@ +# Release History + +## 4.0.0-preview.3 (2019-09-10) +For details on the Azure SDK for Java (August 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview3-java). + +This library is not a direct replacement for certificates management operations from [microsoft-azure-keyvault](https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/microsoft-azure-keyvault). Applications using that library would require code changes to use `azure-keyvault-certificates`. +This package's +[documentation](https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/azure-keyvault-certificates/README.md) +and +[samples](https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/azure-keyvault-certificates/src/samples/java) +demonstrate the new API. + + +### Features Added +- Packages scoped by functionality + - `azure-keyvault-keys` contains a `KeyClient` and `KeyAsyncClient` for key operations, + `azure-keyvault-secrets` contains a `SecretClient` and `SecretAsyncClient` for secret operations, + `azure-keyvault-certificates` contains a `CertificateClient` and `CertificateAsyncClient` for certificate operations +- Client instances are scoped to vaults (an instance interacts with one vault +only) +- Reactive streams support using [Project Reactor](https://projectreactor.io/). +- Authentication using `azure-identity` credentials + - see this package's + [documentation](https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/azure-keyvault-certificates/README.md) + , and the + [Azure Identity documentation](https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/identity/azure-identity/README.md) + for more information +- Added support for HTTP challenge based authentication, allowing clients to interact with vaults in sovereign clouds. diff --git a/sdk/keyvault/azure-keyvault-certificates/README.md b/sdk/keyvault/azure-keyvault-certificates/README.md new file mode 100644 index 000000000000..76061a15ee30 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/README.md @@ -0,0 +1,374 @@ +# Azure Key Vault Certificate client library for Java +Azure Key Vault allows you to create and store certificates in the Key Vault. Azure Key Vault client supports certificates backed by Rsa keys and Ec keys. It allows you to securely manage, tightly control your certificates. + + Multiple certificates, and multiple versions of the same certificate, can be kept in the Key Vault. Cryptographic keys in Key Vault backing the certificates are represented as [JSON Web Key [JWK]](https://tools.ietf.org/html/rfc7517) objects. This library offers operations to create, retrieve, update, delete, purge, backup, restore and list the certificates and its versions. + +[Source code][source_code] | [API reference documentation][api_documentation] | [Product documentation][azkeyvault_docs] | [Samples][certificates_samples] + +## Getting started +### Adding the package to your project + +Maven dependency for Azure Key Client library. Add it to your project's pom file. +```xml + + com.azure + azure-keyvault-certificates + 4.0.0-preview.3 + +``` + +### 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-certificate-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(); +``` + +### Prerequisites + +- Java Development Kit (JDK) with version 8 or above +- [Azure Subscription][azure_subscription] +- An existing [Azure Key Vault][azure_keyvault]. If you need to create a Key Vault, you can use the [Azure Cloud Shell](https://shell.azure.com/bash) to create one with this Azure CLI command. Replace `` and `` with your own, unique names: + + ```Bash + az keyvault create --resource-group --name + ``` + +### Authenticate the client +In order to interact with the Key Vault service, you'll need to create an instance of the [CertificateClient](#create-certificate-client) class. You would need a **vault url** and **client secret credentials (client id, client key, tenant id)** to instantiate a client object using the default `AzureCredential` examples shown in this document. + +The `DefaultAzureCredential` way of authentication by providing client secret credentials is being used in this getting started section but you can find more ways to authenticate with [azure-identity][azure_identity]. + + #### Create/Get credentials +To create/get client key credentials you can use the [Azure Portal][azure_create_application_in_portal], [Azure CLI][azure_keyvault_cli_full] or [Azure Cloud Shell](https://shell.azure.com/bash) + +Here is [Azure Cloud Shell](https://shell.azure.com/bash) snippet below to + + * Create a service principal and configure its access to Azure resources: + ```Bash + az ad sp create-for-rbac -n --skip-assignment + ``` + Output: + ```json + { + "appId": "generated-app-ID", + "displayName": "dummy-app-name", + "name": "http://dummy-app-name", + "password": "random-password", + "tenant": "tenant-ID" + } + ``` +* Use the above returned credentials information to set **AZURE_CLIENT_ID**(appId), **AZURE_CLIENT_SECRET**(password) and **AZURE_TENANT_ID**(tenant) environment variables. The following example shows a way to do this in Bash: + ```Bash + export AZURE_CLIENT_ID="generated-app-ID" + export AZURE_CLIENT_SECRET="random-password" + export AZURE_TENANT_ID="tenant-ID" + ``` + +* Grant the above mentioned application authorization to perform key operations on the keyvault: + ```Bash + az keyvault set-policy --name --spn $AZURE_CLIENT_ID --certificate-permissions backup delete get list set + ``` + > --certificate-permissions: + > Accepted values: backup, create, delete, deleteissuers, get, getissuers, import, list, listissuers, managecontacts, manageissuers, purge, recover, restore, setissuers, update + +* Use the above mentioned Key Vault name to retreive details of your Vault which also contains your Key Vault URL: + ```Bash + az keyvault show --name + ``` + +#### Create Certificate client +Once you've populated the **AZURE_CLIENT_ID**, **AZURE_CLIENT_SECRET** and **AZURE_TENANT_ID** environment variables and replaced **your-vault-url** with the above returned URI, you can create the CertificateClient: + +```Java +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.certificates.CertificateClient; + +CertificateClient client = new CertificateClientBuilder() + .endpoint() + .credential(new DefaultAzureCredentialBuilder().build()) + .buildClient(); +``` +> NOTE: For using Asynchronous client use CertificateAsyncClient instead of CertificateClient and call buildAsyncClient() + +## Key concepts +### Certificate + Azure Key Vault supports certificates with secret content types(`PKCS12` & `PEM`). The certificate can be backed by keys in key vault of types(`EC` & `RSA`). In addition to the certificate policy, the following attributes may be specified: +* enabled: Specifies whether the certificate is enabled and useable. +* created: Indicates when this version of the certificate was created. +* updated: Indicates when this version of the certificate was updated. + +### Certificate Client: +The Certificate client performs the interactions with the Azure Key Vault service for getting, setting, updating, deleting, and listing certificates and its versions. The client also supports CRUD operations for certificate issuers and contacts in the key vault. An asynchronous and synchronous, CertificateClient, client exists in the SDK allowing for selection of a client based on an application's use case. Once you've initialized a Certificate, you can interact with the primary resource types in Key Vault. + +## Examples +### Sync API +The following sections provide several code snippets covering some of the most common Azure Key Vault Key Service tasks, including: +- [Create a Certificate](#create-a-certificate) +- [Retrieve a Certificate](#retrieve-a-certificate) +- [Update an existing Certificate](#update-an-existing-certificate) +- [Delete a Certificate](#delete-a-certificate) +- [List Certificates](#list-certificates) + +### Create a Certificate + +Create a Certificate to be stored in the Azure Key Vault. +- `createCertificate` creates a new certificate in the key vault. if the certificate with name already exists then a new version of the certificate is created. +```Java +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.certificates.models.Certificate; +import com.azure.security.keyvault.certificates.models.CertificatePolicy; +import com.azure.security.keyvault.certificates.models.CertificateOperation; +import com.azure.security.keyvault.certificates.CertificateClient; + +CertificateClient certificateClient = new CertificateClientBuilder() + .endpoint() + .credential(new DefaultAzureCredentialBuilder().build()) + .buildClient(); + +CertificatePolicy certPolicy = new CertificatePolicy("Self", "CN=SelfSignedJavaPkcs12"); +Map metadataTags = new HashMap<>(); +metadataTags.put("foo", "bar"); + +//By default blocks until certificate is created, unless a timeout is specified as an optional parameter. +try { + CertificateOperation certificateOperation = certificateClient.createCertificate("certificateName", + policy, Duration.ofSeconds(60)); + System.out.printf("Certificate operation status %s \n", certificateOperation.status()); +} catch (IllegalStateException e) { + // Certificate wasn't created in the specified duration. + // Log / Handle here +} +``` + +### Retrieve a Certificate + +Retrieve a previously stored Certificate by calling `getCertificate` or `getCertificateWithPolicy`. +```Java +Certificate certificate = certificateClient.getCertificateWithPolicy("certificateName"); +System.out.printf("Recevied certificate with name %s and version %s and secret id", certificate.name(), + certificate.version(), certificate.secretId()); +``` + +### Update an existing Certificate + +Update an existing Certificate by calling `updateCertificate`. +```Java +// Get the certificate to update. +Certificate certificate = certificateClient.getCertificateWithPolicy("certificateName"); +Map tags = new HashMap<>(); +tags.put("foo", "bar"); +// Update certificate enabled status +certificate.enabled(false); +Certificate updatedCertificate = certificateClient.updateCertificate(certificate); +System.out.printf("Updated Certificate with name %s and enabled status %s", updatedCertificate.name(), + updatedCertificate.enabled()); +``` + +### Delete a Certificate + +Delete an existing Certificate by calling `deleteCertificate`. +```Java +DeletedCertificate deletedCertificate = certificateClient.deleteCertificate("certificateName"); +System.out.printf("Deleted certitifcate with name %s and recovery id %s", deletedCertificate.name(), + deletedCertificate.recoveryId()); +``` + +### List Certificates + +List the certificates in the key vault by calling `listCertificates`. +```java +// List operations don't return the certificates with their full information. So, for each returned certificate we call getCertificate to get the certificate with all its properties excluding the policy. +for (CertificateBase certificate : certificateClient.listCertificates()) { + Certificate certificateWithAllProperties = certificateClient.getCertificate(certificate); + System.out.printf("Received certificate with name %s and secret id %s", certificateWithAllProperties.name(), + certificateWithAllProperties.secretId()); +} +``` + +### Async API +The following sections provide several code snippets covering some of the most common asynchronous Azure Key Vault Key Service tasks, including: +- [Create a Certificate Asynchronously](#create-a-certificate-asynchronously) +- [Retrieve a Certificate Asynchronously](#retrieve-a-certificate-asynchronously) +- [Update an existing Certificate Asynchronously](#update-an-existing-certificate-asynchronously) +- [Delete a Certficate Asynchronously](#delete-a-certificate-asynchronously) +- [List Certificates Asynchronously](#list-certificates-asynchronously) + +### Create a Certificate Asynchronously + +Create a Certificate to be stored in the Azure Key Vault. +- `createCertificate` creates a new key in the key vault. if the certificate with name already exists then a new version of the certificate is created. +```Java +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.certificates.models.Certificate; +import com.azure.security.keyvault.certificates.models.CertificatePolicy; +import com.azure.security.keyvault.certificates.models.CertificateOperation; +import com.azure.security.keyvault.certificates.CertificateAsyncClient; + +CertificatePolicy policy = new CertificatePolicy("Self", "CN=SelfSignedJavaPkcs12"); +Map tags = new HashMap<>(); +tags.put("foo", "bar"); +//Creates a certificate and polls on its progress. +certificateAsyncClient.createCertificate("certificateName", policy, tags) + .getObserver() + .subscribe(pollResponse -> { + System.out.println("---------------------------------------------------------------------------------"); + System.out.println(pollResponse.getStatus()); + System.out.println(pollResponse.getValue().status()); + System.out.println(pollResponse.getValue().statusDetails()); + }); +``` + +### Retrieve a Certificate Asynchronously + +Retrieve a previously stored Certificate by calling `getCertificateWithPolicy` or `getCertificate`. +```Java +certificateAsyncClient.getCertificateWithPolicy("certificateName") + .subscribe(certificateResponse -> + System.out.printf("Certificate is returned with name %s and secretId %s %n", certificateResponse.name(), + certificateResponse.secretId())); +``` + +### Update an existing Certificate Asynchronously + +Update an existing Certificate by calling `updateCertificate`. +```Java +certificateAsyncClient.getCertificateWithPolicy("certificateName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(certificateResponseValue -> { + Certificate certificate = certificateResponseValue; + //Update enabled status of the certificate + certificate.enabled(false); + certificateAsyncClient.updateCertificate(certificate) + .subscribe(certificateResponse -> + System.out.printf("Certificate's enabled status %s \n", + certificateResponse.enabled().toString())); + }); +``` + +### Delete a Certificate Asynchronously + +Delete an existing Certificate by calling `deleteCertificate`. +```java +certificateAsyncClient.deleteCertificate("certificateName") + .subscribe(deletedSecretResponse -> + System.out.printf("Deleted Certificate's Recovery Id %s \n", deletedSecretResponse.recoveryId())); +``` + +### List Certificates Asynchronously + +List the certificates in the key vault by calling `listCertificates`. +```Java +// The List Certificates operation returns certificates without their full properties, so for each certificate returned we call `getCertificate` to get all its attributes excluding the policy. +certificateAsyncClient.listCertificates() + .subscribe(certificateBase -> certificateAsyncClient.getCertificate(certificateBase) + .subscribe(certificateResponse -> System.out.printf("Received certificate with name %s and key id %s", + certificateResponse.name(), certificateResponse.keyId()))); +``` + +## Troubleshooting +### General +Certificate Vault clients raise exceptions. For example, if you try to retrieve a certificate after it is deleted a `404` error is returned, indicating resource not found. In the following snippet, the error is handled gracefully by catching the exception and displaying additional information about the error. +```java +try { + certificateClient.getCertificate("certificateName") +} catch (ResourceNotFoundException e) { + System.out.println(e.getMessage()); +} +``` + +## Next steps +Several KeyVault Java SDK samples are available to you in the SDK's GitHub repository. These samples provide example code for additional scenarios commonly encountered while working with Key Vault: + +### Hello World Samples +* [HelloWorld.java][sample_helloWorld] - and [HelloWorldAsync.java][sample_helloWorldAsync] - Contains samples for following scenarios: + * Create a Certificate & Certificate Issuer + * Retrieve a Certificate & Certificate Issuer + * Update a Certificate + * Delete a Certificate + +### List Operations Samples +* [ListOperations.java][sample_list] and [ListOperationsAsync.java][sample_listAsync] - Contains samples for following scenarios: + * Create a Certificate, Certificate Issuer & Certificate Contact + * List Certificates, Certificate Issuers & Certificate Contacts + * Create new version of existing certificate. + * List versions of an existing certificate. + +### Backup And Restore Operations Samples +* [BackupAndRestoreOperations.java][sample_BackupRestore] and [BackupAndRestoreOperationsAsync.java][sample_BackupRestoreAsync] - Contains samples for following scenarios: + * Create a Certificate + * Backup a Certificate -- Write it to a file. + * Delete a certificate + * Restore a certificate + +### Managing Deleted Certificates Samples: +* [ManagingDeletedCertificates.java][sample_ManageDeleted] and [ManagingDeletedCertificatesAsync.java][sample_ManageDeletedAsync] - Contains samples for following scenarios: + * Create a Certificate + * Delete a certificate + * List deleted certificates + * Recover a deleted certificate + * Purge Deleted certificate + +### Additional Documentation +For more extensive documentation on Azure Key Vault, see the [API reference documentation][azkeyvault_rest]. + +## Contributing +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com. + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments. + + +[source_code]: src +[api_documentation]: https://azure.github.io/azure-sdk-for-java/track2reports/index.html +[azkeyvault_docs]: https://docs.microsoft.com/azure/key-vault/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/tree/master/identity/client +[maven]: https://maven.apache.org/ +[azure_subscription]: https://azure.microsoft.com/ +[azure_keyvault]: https://docs.microsoft.com/azure/key-vault/quick-create-portal +[azure_cli]: https://docs.microsoft.com/cli/azure +[rest_api]: https://docs.microsoft.com/rest/api/keyvault/ +[azkeyvault_rest]: https://docs.microsoft.com/rest/api/keyvault/ +[azure_create_application_in_portal]:https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +[azure_keyvault_cli]:https://docs.microsoft.com/azure/key-vault/quick-create-cli +[azure_keyvault_cli_full]:https://docs.microsoft.com/cli/azure/keyvault?view=azure-cli-latest +[certificates_samples]: src/samples/java/com/azure/security/keyvault/certificates +[sample_helloWorld]: src/samples/java/com/azure/security/keyvault/certificates/HelloWorld.java +[sample_helloWorldAsync]: src/samples/java/com/azure/security/keyvault/certificates/HelloWorldAsync.java +[sample_list]: src/samples/java/com/azure/security/keyvault/certificates/ListOperations.java +[sample_listAsync]: src/samples/java/com/azure/security/keyvault/certificates/ListOperationsAsync.java +[sample_BackupRestore]: src/samples/java/com/azure/security/keyvault/certificates/BackupAndRestoreOperations.java +[sample_BackupRestoreAsync]: src/samples/java/com/azure/security/keyvault/certificates/BackupAndRestoreOperationsAsync.java +[sample_ManageDeleted]: src/samples/java/com/azure/security/keyvault/certificates/ManagingDeletedCertificates.java +[sample_ManageDeletedAsync]: src/samples/java/com/azure/security/keyvault/certificates/ManagingDeletedCertificatesAsync.java + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/keyvault/azure-keyvault-certificates/README.png) diff --git a/sdk/keyvault/azure-keyvault-certificates/pom.xml b/sdk/keyvault/azure-keyvault-certificates/pom.xml new file mode 100644 index 000000000000..80f8b1abc8db --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/pom.xml @@ -0,0 +1,81 @@ + + + 4.0.0 + + azure-client-sdk-parent + com.azure + 1.4.0 + ../../../pom.client.xml + + + com.azure + azure-keyvault-certificates + 4.0.0-preview.4 + + Microsoft Azure client library for KeyVault Certificates + This module contains client library for Microsoft Azure KeyVault Certificates. + https://github.com/Azure/azure-sdk-for-java + + + + azure-java-build-docs + ${site.url}/site/${project.artifactId} + + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + + + com.azure + azure-core + 1.0.0-preview.5 + + + + commons-codec + commons-codec + + + + junit + junit + test + + + + io.projectreactor + reactor-test + test + + + + com.azure + azure-core-test + 1.0.0-preview.5 + test + + + + com.azure + azure-identity + 1.0.0-preview.4 + test + + + + com.azure + azure-core-http-netty + 1.0.0-preview.5 + test + + + + diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/Action.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/Action.java new file mode 100644 index 000000000000..9e474308fad0 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/Action.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.security.keyvault.certificates.models.LifetimeActionType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The action configured in certificate policy that will be executed at a specific trigger scenario. + */ +class Action { + /** + * The type of the action. Possible values include: 'EmailContacts', + * 'AutoRenew'. + */ + @JsonProperty(value = "action_type") + private LifetimeActionType lifetimeActionType; + + /** + * Get the lifetimeActionType value. + * + * @return the lifetimeActionType value + */ + LifetimeActionType actionType() { + return this.lifetimeActionType; + } + + /** + * Set the lifetimeActionType value. + * + * @param lifetimeActionType the lifetimeActionType value to set + * @return the Action object itself. + */ + Action actionType(LifetimeActionType lifetimeActionType) { + this.lifetimeActionType = lifetimeActionType; + return this; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/AzureKeyVaultConfiguration.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/AzureKeyVaultConfiguration.java new file mode 100644 index 000000000000..62c81a38ee21 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/AzureKeyVaultConfiguration.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +class AzureKeyVaultConfiguration { + //TODO: Eventually remove these hardcoded strings with https://github.com/Azure/azure-sdk-for-java/issues/3141 + static final String SDK_NAME = "Azure-Keyvault"; + static final String SDK_VERSION = "4.0.0-preview.4"; +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateAsyncClient.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateAsyncClient.java new file mode 100644 index 000000000000..46fc4c837d33 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateAsyncClient.java @@ -0,0 +1,1485 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.core.exception.HttpRequestException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.VoidResponse; +import com.azure.core.implementation.RestProxy; +import com.azure.core.implementation.annotation.ReturnType; +import com.azure.core.implementation.annotation.ServiceClient; +import com.azure.core.implementation.annotation.ServiceMethod; +import com.azure.core.implementation.util.FluxUtil; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollResponse; +import com.azure.security.keyvault.certificates.models.Certificate; +import com.azure.security.keyvault.certificates.models.CertificateOperation; +import com.azure.security.keyvault.certificates.models.CertificatePolicy; +import com.azure.security.keyvault.certificates.models.DeletedCertificate; +import com.azure.security.keyvault.certificates.models.Contact; +import com.azure.security.keyvault.certificates.models.Issuer; +import com.azure.security.keyvault.certificates.models.CertificateBase; +import com.azure.security.keyvault.certificates.models.IssuerBase; +import com.azure.security.keyvault.certificates.models.MergeCertificateOptions; +import com.azure.security.keyvault.certificates.models.LifetimeAction; +import com.azure.security.keyvault.certificates.models.LifetimeActionType; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.net.URL; +import java.time.Duration; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.function.Supplier; + +import static com.azure.core.implementation.util.FluxUtil.withContext; + +/** + * The CertificateAsyncClient provides asynchronous methods to manage {@link Certificate certifcates} in the Azure Key Vault. The client + * supports creating, retrieving, updating, merging, deleting, purging, backing up, restoring and listing the + * {@link Certificate certificates}. The client also supports listing {@link DeletedCertificate deleted certificates} for + * a soft-delete enabled Azure Key Vault. + * + *

The client further allows creating, retrieving, updating, deleting and listing the {@link Issuer certificate issuers}. The client also supports + * creating, listing and deleting {@link Contact certificate contacts}

+ * + *

Samples to construct the async client

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.instantiation} + * + * @see CertificateClientBuilder + * @see PagedFlux + */ +@ServiceClient(builder = CertificateClientBuilder.class, isAsync = true, serviceInterfaces = CertificateService.class) +public class CertificateAsyncClient { + static final String API_VERSION = "7.0"; + static final String ACCEPT_LANGUAGE = "en-US"; + static final int DEFAULT_MAX_PAGE_RESULTS = 25; + static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; + private final String endpoint; + private final CertificateService service; + private final ClientLogger logger = new ClientLogger(CertificateAsyncClient.class); + + /** + * Creates a CertificateAsyncClient that uses {@code pipeline} to service requests + * + * @param endpoint URL for the Azure KeyVault service. + * @param pipeline HttpPipeline that the HTTP requests and responses flow through. + */ + CertificateAsyncClient(URL endpoint, HttpPipeline pipeline) { + Objects.requireNonNull(endpoint, KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.VAULT_END_POINT_REQUIRED)); + this.endpoint = endpoint.toString(); + this.service = RestProxy.create(CertificateService.class, pipeline); + } + + /** + * Creates a new certificate. If this is the first version, the certificate resource is created. This operation requires + * the certificates/create permission. + * + *

Code Samples

+ *

Create certificate is a long running operation. The {@link Poller poller} allows users to automatically poll on the create certificate + * operation status. It is possible to monitor each intermediate poll response during the poll operation.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.createCertificate#String-CertificatePolicy-Map} + * + * @param name The name of the certificate to be created. + * @param policy The policy of the certificate to be created. + * @param tags The application specific metadata to set. + * @throws ResourceModifiedException when invalid certificate policy configuration is provided. + * @return A {@link Poller} polling on the create certificate operation status. + */ + public Poller createCertificate(String name, CertificatePolicy policy, Map tags) { + return new Poller(Duration.ofSeconds(1), createPollOperation(name), activationOperation(name, policy, tags), cancelOperation(name)); + } + + private Consumer> cancelOperation(String name) { + return poller -> withContext(context -> cancelCertificateOperationWithResponse(name, context)); + } + + private Supplier> activationOperation(String name, CertificatePolicy policy, Map tags) { + return () -> withContext(context -> createCertificateWithResponse(name, policy, tags, context) + .flatMap(certificateOperationResponse -> Mono.just(certificateOperationResponse.getValue()))); + } + + /** + * Creates a new certificate. If this is the first version, the certificate resource is created. This operation requires + * the certificates/create permission. + * + *

Code Samples

+ *

Create certificate is a long running operation. The {@link Poller poller} allows users to automatically poll on the create certificate + * operation status. It is possible to monitor each intermediate poll response during the poll operation.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.createCertificate#String-CertificatePolicy} + * + * @param name The name of the certificate to be created. + * @param policy The policy of the certificate to be created. + * @throws ResourceModifiedException when invalid certificate policy configuration is provided. + * @return A {@link Poller} polling on the create certificate operation status. + */ + public Poller createCertificate(String name, CertificatePolicy policy) { + return createCertificate(name, policy, null); + } + + /* + Polling operation to poll on create certificate operation status. + */ + private Function, Mono>> createPollOperation(String certificateName) { + return prePollResponse -> { + try { + return withContext(context -> service.getCertificateOperation(endpoint, certificateName, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + .flatMap(this::processCertificateOperationResponse)); + } catch (HttpRequestException e) { + logger.logExceptionAsError(e); + return Mono.just(new PollResponse<>(PollResponse.OperationStatus.FAILED, null)); + } + }; + } + + private Mono> processCertificateOperationResponse(Response certificateOperationResponse) { + PollResponse.OperationStatus status = null; + switch (certificateOperationResponse.getValue().status()) { + case "inProgress": + status = PollResponse.OperationStatus.IN_PROGRESS; + break; + case "completed": + status = PollResponse.OperationStatus.SUCCESSFULLY_COMPLETED; + break; + case "failed": + status = PollResponse.OperationStatus.FAILED; + break; + default: + //should not reach here + break; + } + return Mono.just(new PollResponse<>(status, certificateOperationResponse.getValue())); + } + + Mono> createCertificateWithResponse(String name, CertificatePolicy certificatePolicy, Map tags, Context context) { + CertificateRequestParameters certificateRequestParameters = new CertificateRequestParameters() + .certificatePolicy(new CertificatePolicyRequest(certificatePolicy)) + .tags(tags); + return service.createCertificate(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, certificateRequestParameters, CONTENT_TYPE_HEADER_VALUE, context); + } + + /** + * Gets information about the latest version of the specified certificate. This operation requires the certificates/get permission. + * + *

Code Samples

+ *

Gets a specific version of the key in the key vault. Prints out the + * returned certificate details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificateWithPolicy#String} + * + * @param name The name of the certificate to retrieve, cannot be null + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException if {@code name} is empty string. + * @return A {@link Mono} containing the requested {@link Certificate certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getCertificateWithPolicy(String name) { + return withContext(context -> getCertificateWithResponse(name, "", context)).flatMap(FluxUtil::toMono); + } + + Mono> getCertificateWithResponse(String name, String version, Context context) { + return service.getCertificate(endpoint, name, version, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Retrieving certificate - {}", name)) + .doOnSuccess(response -> logger.info("Retrieved the certificate - {}", response.getValue().name())) + .doOnError(error -> logger.warning("Failed to Retrieve the certificate - {}", name, error)); + } + + /** + * Gets information about the latest version of the specified certificate. This operation requires the certificates/get permission. + * + *

Code Samples

+ *

Gets a specific version of the key in the key vault. Prints out the + * returned certificate details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificateWithResponse#string-string} + * + * @param name The name of the certificate to retrieve, cannot be null + * @param version The version of the certificate to retrieve. If this is an empty String or null, this call is equivalent to calling {@link CertificateAsyncClient#getCertificateWithPolicy(String)}, with the latest version being retrieved. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException if {@code name} is empty string. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the requested {@link Certificate certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getCertificateWithResponse(String name, String version) { + return withContext(context -> getCertificateWithResponse(name, version == null ? "" : version, context)); + } + + /** + * Gets information about the specified version of the specified certificate. This operation requires the certificates/get permission. + * + *

Code Samples

+ *

Gets a specific version of the key in the key vault. Prints out the + * returned certificate details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificate#String-String} + * + * @param name The name of the certificate to retrieve, cannot be null + * @param version The version of the certificate to retrieve. If this is an empty String or null, this call is equivalent to calling {@link CertificateAsyncClient#getCertificateWithPolicy(String)}, with the latest version being retrieved. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException if {@code name} is empty string. + * @return A {@link Mono} containing the requested {@link Certificate certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getCertificate(String name, String version) { + return withContext(context -> getCertificateWithResponse(name, version == null ? "" : version, context)).flatMap(FluxUtil::toMono); + } + + /** + * Updates the specified attributes associated with the specified certificate. The update operation changes specified attributes of an existing + * stored certificate and attributes that are not specified in the request are left unchanged. This operation requires the certificates/update permission. + * + *

Code Samples

+ *

Gets latest version of the certificate, changes its tags and enabled status and then updates it in the Azure Key Vault. Prints out the + * returned certificate details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.updateCertificate#CertificateBase} + * + * @param certificate The {@link CertificateBase} object with updated properties. + * @throws NullPointerException if {@code certificate} is {@code null}. + * @throws ResourceNotFoundException when a certificate with {@link CertificateBase#name() name} and {@link CertificateBase#version() version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link CertificateBase#name() name} or {@link CertificateBase#version() version} is empty string. + * @return A {@link Mono} containing the {@link CertificateBase updated certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateCertificate(CertificateBase certificate) { + return withContext(context -> updateCertificateWithResponse(certificate, context)).flatMap(FluxUtil::toMono); + } + + /** + * Updates the specified attributes associated with the specified certificate. The update operation changes specified attributes of an existing + * stored certificate and attributes that are not specified in the request are left unchanged. This operation requires the certificates/update permission. + * + *

Code Samples

+ *

Gets latest version of the certificate, changes its enabled status and then updates it in the Azure Key Vault. Prints out the + * returned certificate details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.updateCertificateWithResponse#CertificateBase} + * + * @param certificate The {@link CertificateBase} object with updated properties. + * @throws NullPointerException if {@code certificate} is {@code null}. + * @throws ResourceNotFoundException when a certificate with {@link CertificateBase#name() name} and {@link CertificateBase#version() version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link CertificateBase#name() name} or {@link CertificateBase#version() version} is empty string. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link CertificateBase updated certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateCertificateWithResponse(CertificateBase certificate) { + return withContext(context -> updateCertificateWithResponse(certificate, context)); + } + + Mono> updateCertificateWithResponse(CertificateBase certificateBase, Context context) { + Objects.requireNonNull(certificateBase, "The certificate input parameter cannot be null"); + CertificateUpdateParameters parameters = new CertificateUpdateParameters() + .tags(certificateBase.tags()) + .certificateAttributes(new CertificateRequestAttributes(certificateBase)); + return service.updateCertificate(endpoint, certificateBase.name(), API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Updating certificate - {}", certificateBase.name())) + .doOnSuccess(response -> logger.info("Updated the certificate - {}", certificateBase.name())) + .doOnError(error -> logger.warning("Failed to update the certificate - {}", certificateBase.name(), error)); + } + + /** + * Gets information about the certificate which represents the {@link CertificateBase} from the key vault. This + * operation requires the certificates/get permission. + * + *

The list operations {@link CertificateAsyncClient#listCertificates()} and {@link CertificateAsyncClient#listCertificateVersions(String)} return + * the {@link Flux} containing {@link CertificateBase} as output excluding the properties like secretId and keyId of the certificate. + * This operation can then be used to get the full certificate with its properties excluding the policy from {@code certificateBase}.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificate#CertificateBase} + * + * @param certificateBase The {@link CertificateBase} holding attributes of the certificate being requested. + * @throws ResourceNotFoundException when a certificate with {@link CertificateBase#name() name} and {@link CertificateBase#version() version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link CertificateBase#name()} name} or {@link CertificateBase#version() version} is empty string. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the requested {@link Certificate certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getCertificate(CertificateBase certificateBase) { + return withContext(context -> getCertificateWithResponse(certificateBase.name(), certificateBase.version(), context)).flatMap(FluxUtil::toMono); + } + + /** + * Deletes a certificate from a specified key vault. All the versions of the certificate along with its associated policy + * get deleted. If soft-delete is enabled on the key vault then the certificate is placed in the deleted state and requires to be + * purged for permanent deletion else the certificate is permanently deleted. The delete operation applies to any certificate stored in + * Azure Key Vault but it cannot be applied to an individual version of a certificate. This operation requires the certificates/delete permission. + * + *

Code Samples

+ *

Deletes the certificate in the Azure Key Vault. Prints out the deleted certificate details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.deleteCertificate#string} + * + * @param name The name of the certificate to be deleted. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a certificate with {@code name} is empty string. + * @return A {@link Mono} containing the {@link DeletedCertificate deleted certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteCertificate(String name) { + return withContext(context -> deleteCertificateWithResponse(name, context)).flatMap(FluxUtil::toMono); + } + + /** + * Deletes a certificate from a specified key vault. All the versions of the certificate along with its associated policy + * get deleted. If soft-delete is enabled on the key vault then the certificate is placed in the deleted state and requires to be + * purged for permanent deletion else the certificate is permanently deleted. The delete operation applies to any certificate stored in + * Azure Key Vault but it cannot be applied to an individual version of a certificate. This operation requires the certificates/delete permission. + * + *

Code Samples

+ *

Deletes the certificate in the Azure Key Vault. Prints out the deleted certificate details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.deleteCertificateWithResponse#string} + * + * @param name The name of the certificate to be deleted. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a certificate with {@code name} is empty string. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link DeletedCertificate deleted certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteCertificateWithResponse(String name) { + return withContext(context -> deleteCertificateWithResponse(name, context)); + } + + Mono> deleteCertificateWithResponse(String name, Context context) { + return service.deleteCertificate(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Deleting certificate - {}", name)) + .doOnSuccess(response -> logger.info("Deleted the certificate - {}", response.getValue().name())) + .doOnError(error -> logger.warning("Failed to delete the certificate - {}", name, error)); + } + + /** + * Retrieves information about the specified deleted certificate. The GetDeletedCertificate operation is applicable for soft-delete + * enabled vaults and additionally retrieves deleted certificate's attributes, such as retention interval, scheduled permanent deletion and the current deletion recovery level. This operation + * requires the certificates/get permission. + * + *

Code Samples

+ *

Gets the deleted certificate from the key vault enabled for soft-delete. Prints out the + * deleted certificate details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.getDeletedCertificate#string} + * + * @param name The name of the deleted certificate. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a certificate with {@code name} is empty string. + * @return A {@link Mono} containing the {@link DeletedCertificate deleted certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDeletedCertificate(String name) { + return withContext(context -> getDeletedCertificateWithResponse(name, context)).flatMap(FluxUtil::toMono); + } + + /** + * Retrieves information about the specified deleted certificate. The GetDeletedCertificate operation is applicable for soft-delete + * enabled vaults and additionally retrieves deleted certificate's attributes, such as retention interval, scheduled permanent deletion and the current deletion recovery level. This operation + * requires the certificates/get permission. + * + *

Code Samples

+ *

Gets the deleted certificate from the key vault enabled for soft-delete. Prints out the + * deleted certificate details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.getDeletedCertificateWithResponse#string} + * + * @param name The name of the deleted certificate. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a certificate with {@code name} is empty string. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link DeletedCertificate deleted certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getDeletedCertificateWithResponse(String name) { + return withContext(context -> getDeletedCertificateWithResponse(name, context)); + } + + Mono> getDeletedCertificateWithResponse(String name, Context context) { + return service.getDeletedCertificate(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Retrieving deleted certificate - {}", name)) + .doOnSuccess(response -> logger.info("Retrieved the deleted certificate - {}", response.getValue().name())) + .doOnError(error -> logger.warning("Failed to Retrieve the deleted certificate - {}", name, error)); + } + + /** + * Permanently deletes the specified deleted certificate without possibility for recovery. The Purge Deleted Certificate operation is applicable for + * soft-delete enabled vaults and is not available if the recovery level does not specify 'Purgeable'. This operation requires the certificate/purge permission. + * + *

Code Samples

+ *

Purges the deleted certificate from the key vault enabled for soft-delete. Prints out the + * status code from the server response when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.purgeDeletedCertificateWithResponse#string} + * + * @param name The name of the deleted certificate. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a certificate with {@code name} is empty string. + * @return A {@link Mono} containing a {@link VoidResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono purgeDeletedCertificate(String name) { + return withContext(context -> purgeDeletedCertificate(name, context)); + } + + Mono purgeDeletedCertificate(String name, Context context) { + return service.purgeDeletedcertificate(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Purging certificate - {}", name)) + .doOnSuccess(response -> logger.info("Purged the certificate - {}", response.getStatusCode())) + .doOnError(error -> logger.warning("Failed to purge the certificate - {}", name, error)); + } + + /** + * Recovers the deleted certificate back to its current version under /certificates and can only be performed on a soft-delete enabled vault. + * The RecoverDeletedCertificate operation performs the reversal of the Delete operation and must be issued during the retention interval + * (available in the deleted certificate's attributes). This operation requires the certificates/recover permission. + * + *

Code Samples

+ *

Recovers the deleted certificate from the key vault enabled for soft-delete. Prints out the + * recovered certificate details when a response has been received.

+ + * {@codesnippet com.azure.security.certificatevault.certificates.CertificateAsyncClient.recoverDeletedCertificate#string} + * + * @param name The name of the deleted certificate to be recovered. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the certificate vault. + * @throws HttpRequestException when a certificate with {@code name} is empty string. + * @return A {@link Mono} containing the {@link Certificate recovered certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono recoverDeletedCertificate(String name) { + return withContext(context -> recoverDeletedCertificateWithResponse(name, context)).flatMap(FluxUtil::toMono); + } + + /** + * Recovers the deleted certificate back to its current version under /certificates and can only be performed on a soft-delete enabled vault. + * The RecoverDeletedCertificate operation performs the reversal of the Delete operation and must be issued during the retention interval + * (available in the deleted certificate's attributes). This operation requires the certificates/recover permission. + * + *

Code Samples

+ *

Recovers the deleted certificate from the key vault enabled for soft-delete. Prints out the + * recovered certificate details when a response has been received.

+ + * {@codesnippet com.azure.security.certificatevault.certificates.CertificateAsyncClient.recoverDeletedCertificateWithResponse#string} + * + * @param name The name of the deleted certificate to be recovered. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the certificate vault. + * @throws HttpRequestException when a certificate with {@code name} is empty string. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link Certificate recovered certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> recoverDeletedCertificateWithResponse(String name) { + return withContext(context -> recoverDeletedCertificateWithResponse(name, context)); + } + + Mono> recoverDeletedCertificateWithResponse(String name, Context context) { + return service.recoverDeletedCertificate(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Recovering deleted certificate - {}", name)) + .doOnSuccess(response -> logger.info("Recovered the deleted certificate - {}", response.getValue().name())) + .doOnError(error -> logger.warning("Failed to recover the deleted certificate - {}", name, error)); + } + + /** + * Requests that a backup of the specified certificate be downloaded to the client. All versions of the certificate will + * be downloaded. This operation requires the certificates/backup permission. + * + *

Code Samples

+ *

Backs up the certificate from the key vault. Prints out the + * length of the certificate's backup byte array returned in the response.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.backupCertificate#string} + * + * @param name The name of the certificate. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a certificate with {@code name} is empty string. + * @return A {@link Mono} containing the backed up certificate blob. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono backupCertificate(String name) { + return withContext(context -> backupCertificateWithResponse(name, context)).flatMap(FluxUtil::toMono); + } + + /** + * Requests that a backup of the specified certificate be downloaded to the client. All versions of the certificate will + * be downloaded. This operation requires the certificates/backup permission. + * + *

Code Samples

+ *

Backs up the certificate from the key vault. Prints out the + * length of the certificate's backup byte array returned in the response.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.backupCertificateWithResponse#string} + * + * @param name The name of the certificate. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a certificate with {@code name} is empty string. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the backed up certificate blob. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> backupCertificateWithResponse(String name) { + return withContext(context -> backupCertificateWithResponse(name, context)); + } + + Mono> backupCertificateWithResponse(String name, Context context) { + return service.backupCertificate(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Backing up certificate - {}", name)) + .doOnSuccess(response -> logger.info("Backed up the certificate - {}", response.getStatusCode())) + .doOnError(error -> logger.warning("Failed to back up the certificate - {}", name, error)) + .flatMap(certificateBackupResponse -> Mono.just(new SimpleResponse<>(certificateBackupResponse.getRequest(), + certificateBackupResponse.getStatusCode(), certificateBackupResponse.getHeaders(), certificateBackupResponse.getValue().value()))); + } + + /** + * Restores a backed up certificate to the vault. All the versions of the certificate are restored to the vault. This operation + * requires the certificates/restore permission. + * + *

Code Samples

+ *

Restores the certificate in the key vault from its backup. Prints out the restored certificate + * details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.restoreCertificate#byte} + * + * @param backup The backup blob associated with the certificate. + * @throws ResourceModifiedException when {@code backup} blob is malformed. + * @return A {@link Mono} containing the {@link Certificate restored certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono restoreCertificate(byte[] backup) { + return withContext(context -> restoreCertificateWithResponse(backup, context)).flatMap(FluxUtil::toMono); + } + + /** + * Restores a backed up certificate to the vault. All the versions of the certificate are restored to the vault. This operation + * requires the certificates/restore permission. + * + *

Code Samples

+ *

Restores the certificate in the key vault from its backup. Prints out the restored certificate + * details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.restoreCertificateWithResponse#byte} + * + * @param backup The backup blob associated with the certificate. + * @throws ResourceModifiedException when {@code backup} blob is malformed. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link Certificate restored certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> restoreCertificateWithResponse(byte[] backup) { + return withContext(context -> restoreCertificateWithResponse(backup, context)); + } + + Mono> restoreCertificateWithResponse(byte[] backup, Context context) { + CertificateRestoreParameters parameters = new CertificateRestoreParameters().certificateBundleBackup(backup); + return service.restoreCertificate(endpoint, API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Restoring the certificate")) + .doOnSuccess(response -> logger.info("Restored the certificate - {}", response.getValue().name())) + .doOnError(error -> logger.warning("Failed to restore the certificate - {}", error)); + } + + /** + * List certificates in a the key vault. Retrieves the set of certificates resources in the key vault and the individual + * certificate response in the flux is represented by {@link CertificateBase} as only the certificate identifier, thumbprint, + * attributes and tags are provided in the response. The policy and individual certificate versions are not listed in + * the response. This operation requires the certificates/list permission. + * + *

It is possible to get certificates with all the properties excluding the policy from this information. Convert the {@link Flux} containing {@link CertificateBase} to + * {@link Flux} containing {@link Certificate certificate} using {@link CertificateAsyncClient#getCertificate(CertificateBase baseCertificate)} within {@link Flux#flatMap(Function)}.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.listCertificates} + * + * @param includePending indicate if pending certificates should be included in the results. + * @return A {@link PagedFlux} containing {@link CertificateBase certificate} for all the certificates in the vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listCertificates(Boolean includePending) { + return new PagedFlux<>(() -> withContext(context -> listCertificatesFirstPage(includePending, context)), + continuationToken -> withContext(context -> listCertificatesNextPage(continuationToken, context))); + } + + /** + * List certificates in a the key vault. Retrieves the set of certificates resources in the key vault and the individual + * certificate response in the flux is represented by {@link CertificateBase} as only the certificate identifier, thumbprint, + * attributes and tags are provided in the response. The policy and individual certificate versions are not listed in + * the response. This operation requires the certificates/list permission. + * + *

It is possible to get certificates with all the properties excluding the policy from this information. Convert the {@link Flux} containing {@link CertificateBase} to + * {@link Flux} containing {@link Certificate certificate} using {@link CertificateAsyncClient#getCertificate(CertificateBase baseCertificate)} within {@link Flux#flatMap(Function)}.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.listCertificates} + * + * @return A {@link PagedFlux} containing {@link CertificateBase certificate} for all the certificates in the vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listCertificates() { + return new PagedFlux<>(() -> withContext(context -> listCertificatesFirstPage(false, context)), + continuationToken -> withContext(context -> listCertificatesNextPage(continuationToken, context))); + } + + PagedFlux listCertificates(Boolean includePending, Context context) { + return new PagedFlux<>( + () -> listCertificatesFirstPage(includePending, context), + continuationToken -> listCertificatesNextPage(continuationToken, context)); + } + + /* + * Gets attributes of all the certificates given by the {@code nextPageLink} that was retrieved from a call to + * {@link CertificateAsyncClient#listCertificates()}. + * + * @param continuationToken The {@link PagedResponse#nextLink()} from a previous, successful call to one of the listCertificates operations. + * @return A {@link Mono} of {@link PagedResponse} from the next page of results. + */ + private Mono> listCertificatesNextPage(String continuationToken, Context context) { + return service.getCertificates(endpoint, continuationToken, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Listing next certificates page - Page {} ", continuationToken)) + .doOnSuccess(response -> logger.info("Listed next certificates page - Page {} ", continuationToken)) + .doOnError(error -> logger.warning("Failed to list next certificates page - Page {} ", continuationToken, error)); + } + + /* + * Calls the service and retrieve first page result. It makes one call and retrieve {@code DEFAULT_MAX_PAGE_RESULTS} values. + */ + private Mono> listCertificatesFirstPage(Boolean includePending, Context context) { + return service.getCertificates(endpoint, DEFAULT_MAX_PAGE_RESULTS, includePending, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Listing certificates")) + .doOnSuccess(response -> logger.info("Listed certificates")) + .doOnError(error -> logger.warning("Failed to list certificates", error)); + } + + + /** + * Lists the {@link DeletedCertificate deleted certificates} in the key vault currently available for recovery. This operation includes + * deletion-specific information and is applicable for vaults enabled for soft-delete. This operation requires the + * {@code certificates/get/list} permission. + * + *

Code Samples

+ *

Lists the deleted certificates in the key vault. Prints out the + * recovery id of each deleted certificate when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.listDeletedCertificates} + * + * @return A {@link PagedFlux} containing all of the {@link DeletedCertificate deleted certificates} in the vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listDeletedCertificates() { + return new PagedFlux<>( + () -> withContext(context -> listDeletedCertificatesFirstPage(context)), + continuationToken -> withContext(context -> listDeletedCertificatesNextPage(continuationToken, context))); + } + + PagedFlux listDeletedCertificates(Context context) { + return new PagedFlux<>( + () -> listDeletedCertificatesFirstPage(context), + continuationToken -> listDeletedCertificatesNextPage(continuationToken, context)); + } + + /* + * Gets attributes of all the certificates given by the {@code nextPageLink} + * + * @param continuationToken The {@link PagedResponse#nextLink()} from a previous, successful call to one of the list operations. + * @return A {@link Mono} of {@link PagedResponse} from the next page of results. + */ + private Mono> listDeletedCertificatesNextPage(String continuationToken, Context context) { + return service.getDeletedCertificates(endpoint, continuationToken, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Listing next deleted certificates page - Page {} ", continuationToken)) + .doOnSuccess(response -> logger.info("Listed next deleted certificates page - Page {} ", continuationToken)) + .doOnError(error -> logger.warning("Failed to list next deleted certificates page - Page {} ", continuationToken, error)); + } + + /* + * Calls the service and retrieve first page result. It makes one call and retrieve {@code DEFAULT_MAX_PAGE_RESULTS} values. + */ + private Mono> listDeletedCertificatesFirstPage(Context context) { + return service.getDeletedCertificates(endpoint, DEFAULT_MAX_PAGE_RESULTS, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Listing deleted certificates")) + .doOnSuccess(response -> logger.info("Listed deleted certificates")) + .doOnError(error -> logger.warning("Failed to list deleted certificates", error)); + } + + /** + * List all versions of the specified certificate. The individual certificate response in the flux is represented by {@link CertificateBase} + * as only the certificate identifier, thumbprint, attributes and tags are provided in the response. The policy is not listed in + * the response. This operation requires the certificates/list permission. + * + *

It is possible to get the certificates with properties excluding the policy for all the versions from this information. Convert the {@link PagedFlux} + * containing {@link CertificateBase} to {@link PagedFlux} containing {@link Certificate certificate} using + * {@link CertificateAsyncClient#getCertificate(CertificateBase baseCertificate)} within {@link Flux#flatMap(Function)}.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.listCertificateVersions} + * + * @param name The name of the certificate. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a certificate with {@code name} is empty string. + * @return A {@link PagedFlux} containing {@link CertificateBase certificate} of all the versions of the specified certificate in the vault. Flux is empty if certificate with {@code name} does not exist in key vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listCertificateVersions(String name) { + return new PagedFlux<>( + () -> withContext(context -> listCertificateVersionsFirstPage(name, context)), + continuationToken -> withContext(context -> listCertificateVersionsNextPage(continuationToken, context))); + } + + PagedFlux listCertificateVersions(String name, Context context) { + return new PagedFlux<>( + () -> listCertificateVersionsFirstPage(name, context), + continuationToken -> listCertificateVersionsNextPage(continuationToken, context)); + } + + private Mono> listCertificateVersionsFirstPage(String name, Context context) { + return service.getCertificateVersions(endpoint, name, DEFAULT_MAX_PAGE_RESULTS, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Listing certificate versions - {}", name)) + .doOnSuccess(response -> logger.info("Listed certificate versions - {}", name)) + .doOnError(error -> logger.warning(String.format("Failed to list certificate versions - {}", name), error)); + } + + /* + * Gets attributes of all the certificates given by the {@code nextPageLink} + */ + private Mono> listCertificateVersionsNextPage(String continuationToken, Context context) { + return service.getCertificates(endpoint, continuationToken, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Listing next certificate versions page - Page {} ", continuationToken)) + .doOnSuccess(response -> logger.info("Listed next certificate versions page - Page {} ", continuationToken)) + .doOnError(error -> logger.warning("Failed to list next certificate versions page - Page {} ", continuationToken, error)); + } + + /** + * Gets the pending certificate signing request for the specified certificate under pending status. + * + *

Code Samples

+ *

Gets the pending signing request of a certificate created with third party issuer. Prints out the + * returned certificate signing request details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.getPendingCertificateSigningRequest#string} + * + * @param certificateName the certificate for whom certifcate signing request is needed + * @return A {@link Mono} containing the cerficate signing request blob. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getPendingCertificateSigningRequest(String certificateName) { + return withContext(context -> getPendingCertificateSigningRequestWithResponse(certificateName, context)).flatMap(FluxUtil::toMono); + } + + /** + * Gets the pending certificate signing request for the specified certificate under pending status. + * + *

Code Samples

+ *

Gets the pending signing request of a certificate created with third party issuer. Prints out the + * returned certificate signing request details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.getPendingCertificateSigningRequestWithResponse#string} + * + * @param certificateName the certificate for whom certifcate signing request is needed + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the certificate signing request blob. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPendingCertificateSigningRequestWithResponse(String certificateName) { + return withContext(context -> getPendingCertificateSigningRequestWithResponse(certificateName, context)); + } + + + Mono> getPendingCertificateSigningRequestWithResponse(String certificateName, Context context) { + return service.getPendingCertificateSigningRequest(endpoint, API_VERSION, ACCEPT_LANGUAGE, certificateName, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Retrieving CSR for certificate - {} ", certificateName)) + .doOnSuccess(response -> logger.info("Failed to retrieve CSR for certificate - {} ", certificateName)) + .doOnError(error -> logger.warning("Retrieved CSR for certificate - {} - {} ", certificateName, error)) + .flatMap(certificateOperationResponse -> Mono.just(new SimpleResponse<>(certificateOperationResponse.getRequest(), + certificateOperationResponse.getStatusCode(), certificateOperationResponse.getHeaders(), certificateOperationResponse.getValue().csr()))); + } + + /** + * Merges a certificate or a certificate chain with a key pair currently available in the service. This operation requires + * the {@code certificates/create} permission. + * + *

Code Samples

+ *

Merges a certificate with a kay pair available in the service.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.mergeCertificate#String-List} + * + * @param name the name of the certificate. + * @param x509Certificates the certificate or certificate chain to merge. + * + * @throws HttpRequestException if {@code x509Certificates} is invalid/corrupt or {@code name} is empty. + * @return A {@link Mono} containing the merged certificate. + */ + public Mono mergeCertificate(String name, List x509Certificates) { + return withContext(context -> mergeCertificateWithResponse(name, x509Certificates, context)).flatMap(FluxUtil::toMono); + } + + /** + * Merges a certificate or a certificate chain with a key pair currently available in the service. This operation requires + * the {@code certificates/create} permission. + * + *

Code Samples

+ *

Merges a certificate with a kay pair available in the service.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.mergeCertificateWithResponse#String-List} + * + * @param name the name of the certificate. + * @param x509Certificates the certificate or certificate chain to merge. + * + * @throws HttpRequestException if {@code x509Certificates} is invalid/corrupt or {@code name} is empty. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the merged certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> mergeCertificateWithResponse(String name, List x509Certificates) { + return withContext(context -> mergeCertificateWithResponse(name, x509Certificates, context)); + } + + Mono> mergeCertificateWithResponse(String name, List x509Certificates, Context context) { + CertificateMergeParameters mergeParameters = new CertificateMergeParameters().x509Certificates(x509Certificates); + return service.mergeCertificate(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, mergeParameters, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Merging certificate - {}", name)) + .doOnSuccess(response -> logger.info("Merged certificate - {}", response.getValue().name())) + .doOnError(error -> logger.warning("Failed to merge certificate - {}", name, error)); + } + + /** + * Merges a certificate or a certificate chain with a key pair currently available in the service. This operation requires + * the {@code certificates/create} permission. + * + *

Code Samples

+ *

Merges a certificate with a kay pair available in the service.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.mergeCertificate#config} + * + * @param mergeCertificateConfig the merge certificate configuration holding the x509 certificates. + * + * @throws NullPointerException when {@code mergeCertificateConfig} is null. + * @throws HttpRequestException if {@code mergeCertificateConfig} is invalid/corrupt. + * @return A {@link Mono} containing the merged certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono mergeCertificate(MergeCertificateOptions mergeCertificateConfig) { + return withContext(context -> mergeCertificateWithResponse(mergeCertificateConfig, context)).flatMap(FluxUtil::toMono); + } + + /** + * Merges a certificate or a certificate chain with a key pair currently available in the service. This operation requires + * the {@code certificates/create} permission. + * + *

Code Samples

+ *

Merges a certificate with a kay pair available in the service.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.mergeCertificateWithResponse#config} + * + * @param mergeCertificateConfig the merge certificate configuration holding the x509 certificates. + * + * @throws NullPointerException when {@code mergeCertificateConfig} is null. + * @throws HttpRequestException if {@code mergeCertificateConfig} is invalid/corrupt. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the merged certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> mergeCertificateWithResponse(MergeCertificateOptions mergeCertificateConfig) { + Objects.requireNonNull(mergeCertificateConfig, "The merge certificate configuration cannot be null"); + return withContext(context -> mergeCertificateWithResponse(mergeCertificateConfig, context)); + } + + Mono> mergeCertificateWithResponse(MergeCertificateOptions mergeCertificateConfig, Context context) { + CertificateMergeParameters mergeParameters = new CertificateMergeParameters().x509Certificates(mergeCertificateConfig.x509Certificates()) + .tags(mergeCertificateConfig.tags()) + .certificateAttributes(new CertificateRequestAttributes().enabled(mergeCertificateConfig.enabled())); + return service.mergeCertificate(endpoint, mergeCertificateConfig.name(), API_VERSION, ACCEPT_LANGUAGE, mergeParameters, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Merging certificate - {}", mergeCertificateConfig.name())) + .doOnSuccess(response -> logger.info("Merged certificate - {}", response.getValue().name())) + .doOnError(error -> logger.warning("Failed to merge certificate - {}", mergeCertificateConfig.name(), error)); + } + + /** + * Retrieves the policy of the specified certificate in the key vault. This operation requires the {@code certificates/get} permission. + * + *

Code Samples

+ *

Gets the policy of a certirifcate in the key vault. Prints out the + * returned certificate policy details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificatePolicy#string} + * + * @param name The name of the certificate whose policy is to be retrieved, cannot be null + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException if {@code name} is empty string. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the requested {@link CertificatePolicy certificate policy}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getCertificatePolicy(String name) { + return withContext(context -> getCertificatePolicyWithResponse(name, context)).flatMap(FluxUtil::toMono); + } + + /** + * Retrieves the policy of the specified certificate in the key vault. This operation requires the {@code certificates/get} permission. + * + *

Code Samples

+ *

Gets the policy of a certirifcate in the key vault. Prints out the + * returned certificate policy details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificatePolicyWithResponse#string} + * + * @param name The name of the certificate whose policy is to be retrieved, cannot be null + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException if {@code name} is empty string. + * @return A {@link Mono} containing the requested {@link CertificatePolicy certificate policy}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getCertificatePolicyWithResponse(String name) { + return withContext(context -> getCertificatePolicyWithResponse(name, context)); + } + + Mono> getCertificatePolicyWithResponse(String name, Context context) { + return service.getCertificatePolicy(endpoint, API_VERSION, ACCEPT_LANGUAGE, name, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Retrieving certificate policy - {}", name)) + .doOnSuccess(response -> logger.info("Retrieved certificate policy - {}", name)) + .doOnError(error -> logger.warning("Failed to retrieve certificate policy - {}", name, error)); + } + + /** + * Updates the policy for a certificate. The update operation changes specified attributes of the certificate policy and attributes + * that are not specified in the request are left unchanged. This operation requires the {@code certificates/update} permission. + * + *

Code Samples

+ *

Gets the certificate policy, changes its properties and then updates it in the Azure Key Vault. Prints out the + * returned policy details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.updateCertificatePolicy#string} + * + * @param certificateName The name of the certificate whose policy is to be updated. + * @param policy The certificate policy to be updated. + * @throws NullPointerException if {@code policy} is {@code null}. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException if {@code name} is empty string or if {@code policy} is invalid. + * @return A {@link Mono} containing the updated {@link CertificatePolicy certificate policy}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateCertificatePolicy(String certificateName, CertificatePolicy policy) { + return withContext(context -> updateCertificatePolicyWithResponse(certificateName, policy, context)).flatMap(FluxUtil::toMono); + } + + /** + * Updates the policy for a certificate. The update operation changes specified attributes of the certificate policy and attributes + * that are not specified in the request are left unchanged. This operation requires the {@code certificates/update} permission. + * + *

Code Samples

+ *

Gets the certificate policy, changes its properties and then updates it in the Azure Key Vault. Prints out the + * returned policy details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.updateCertificatePolicyWithResponse#string} + * + * @param certificateName The name of the certificate whose policy is to be updated. + * @param policy The certificate policy is to be updated. + * @throws NullPointerException if {@code policy} is {@code null}. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException if {@code name} is empty string or if {@code policy} is invalid. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the updated {@link CertificatePolicy certificate policy}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> updateCertificatePolicyWithResponse(String certificateName, CertificatePolicy policy) { + return withContext(context -> updateCertificatePolicyWithResponse(certificateName, policy, context)); + } + + Mono> updateCertificatePolicyWithResponse(String certificateName, CertificatePolicy policy, Context context) { + CertificatePolicyRequest policyRequest = new CertificatePolicyRequest(policy); + return service.updateCertificatePolicy(endpoint, API_VERSION, ACCEPT_LANGUAGE, certificateName, policyRequest, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Updating certificate policy - {}", certificateName)) + .doOnSuccess(response -> logger.info("Updated the certificate policy - {}", response.getValue().updated())) + .doOnError(error -> logger.warning("Failed to update the certificate policy - {}", certificateName, error)); + } + + /** + * Creates the specified certificate issuer. The SetCertificateIssuer operation updates the specified certificate issuer if it + * already exists or adds it if doesn't exist. This operation requires the certificates/setissuers permission. + * + *

Code Samples

+ *

Creates a new certificate issuer in the key vault. Prints out the created certificate + * issuer details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.createCertificateIssuer#String-String} + * + * @param name The name of the certificate issuer to be created. + * @param provider The provider of the certificate issuer to be created. + * @throws ResourceModifiedException when invalid certificate issuer {@code name} or {@code provider} configuration is provided. + * @throws HttpRequestException when a certificate issuer with {@code name} is empty string. + * @return A {@link Mono} containing the created {@link Issuer certificate issuer}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createCertificateIssuer(String name, String provider) { + return withContext(context -> createCertificateIssuerWithResponse(name, provider, context)).flatMap(FluxUtil::toMono); + } + + Mono> createCertificateIssuerWithResponse(String name, String provider, Context context) { + CertificateIssuerSetParameters parameters = new CertificateIssuerSetParameters() + .provider(provider); + return service.setCertificateIssuer(endpoint, API_VERSION, ACCEPT_LANGUAGE, name, parameters, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Creating certificate issuer - {}", name)) + .doOnSuccess(response -> logger.info("Created the certificate issuer - {}", response.getValue().name())) + .doOnError(error -> logger.warning("Failed to create the certificate issuer - {}", name, error)); + } + + /** + * Creates the specified certificate issuer. The SetCertificateIssuer operation updates the specified certificate issuer if it + * already exists or adds it if doesn't exist. This operation requires the certificates/setissuers permission. + * + *

Code Samples

+ *

Creates a new certificate issuer in the key vault. Prints out the created certificate + * issuer details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.createCertificateIssuer#issuer} + * + * @param issuer The configuration of the certificate issuer to be created. + * @throws ResourceModifiedException when invalid certificate issuer {@code issuer} configuration is provided. + * @throws HttpRequestException when a certificate issuer with {@code name} is empty string. + * @return A {@link Mono} containing the created {@link Issuer certificate issuer}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createCertificateIssuer(Issuer issuer) { + return withContext(context -> createCertificateIssuerWithResponse(issuer, context)).flatMap(FluxUtil::toMono); + } + + /** + * Creates the specified certificate issuer. The SetCertificateIssuer operation updates the specified certificate issuer if it + * already exists or adds it if doesn't exist. This operation requires the certificates/setissuers permission. + * + *

Code Samples

+ *

Creates a new certificate issuer in the key vault. Prints out the created certificate + * issuer details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.createCertificateIssuerWithResponse#issuer} + * + * @param issuer The configuration of the certificate issuer to be created. + * @throws ResourceModifiedException when invalid certificate issuer {@code issuer} configuration is provided. + * @throws HttpRequestException when a certificate issuer with {@code name} is empty string. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the created {@link Issuer certificate issuer}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createCertificateIssuerWithResponse(Issuer issuer) { + return withContext(context -> createCertificateIssuerWithResponse(issuer, context)); + } + + Mono> createCertificateIssuerWithResponse(Issuer issuer, Context context) { + CertificateIssuerSetParameters parameters = new CertificateIssuerSetParameters() + .provider(issuer.provider()) + .credentials(new IssuerCredentials().accountId(issuer.accountId()).password(issuer.password())) + .organizationDetails(new OrganizationDetails().adminDetails(issuer.administrators())) + .credentials(new IssuerCredentials().password(issuer.password()).accountId(issuer.accountId())); + return service.setCertificateIssuer(endpoint, API_VERSION, ACCEPT_LANGUAGE, issuer.name(), parameters, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Creating certificate issuer - {}", issuer.name())) + .doOnSuccess(response -> logger.info("Created the certificate issuer - {}", response.getValue().name())) + .doOnError(error -> logger.warning("Failed to create the certificate issuer - {}", issuer.name(), error)); + } + + + /** + * Retrieves the specified certificate issuer from the key vault. This operation requires the certificates/manageissuers/getissuers permission. + * + *

Code Samples

+ *

Gets the specificed certifcate issuer in the key vault. Prints out the + * returned certificate issuer details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificateIssuerWithResponse#string} + * + * @param name The name of the certificate to retrieve, cannot be null + * @throws ResourceNotFoundException when a certificate issuer with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException if {@code name} is empty string. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the requested {@link Issuer certificate issuer}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getCertificateIssuerWithResponse(String name) { + return withContext(context -> getCertificateIssuerWithResponse(name, context)); + } + + /** + * Retrieves the specified certificate issuer from the key vault. This operation requires the certificates/manageissuers/getissuers permission. + * + *

Code Samples

+ *

Gets the specified certificate issuer in the key vault. Prints out the + * returned certificate issuer details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificateIssuer#string} + * + * @param name The name of the certificate to retrieve, cannot be null + * @throws ResourceNotFoundException when a certificate issuer with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException if {@code name} is empty string. + * @return A {@link Mono} containing the requested {@link Issuer certificate issuer}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getCertificateIssuer(String name) { + return withContext(context -> getCertificateIssuerWithResponse(name, context)).flatMap(FluxUtil::toMono); + } + + Mono> getCertificateIssuerWithResponse(String name, Context context) { + return service.getCertificateIssuer(endpoint, API_VERSION, ACCEPT_LANGUAGE, name, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Retrieving certificate issuer - {}", name)) + .doOnSuccess(response -> logger.info("Retrieved the certificate issuer - {}", response.getValue().name())) + .doOnError(error -> logger.warning("Failed to retreive the certificate issuer - {}", name, error)); + } + + /** + * Gets information about the certificate issuer which represents the {@link IssuerBase} from the key vault. This operation + * requires the certificates/manageissuers/getissuers permission. + * + *

The list operations {@link CertificateAsyncClient#listCertificateIssuers()} return the {@link PagedFlux} containing + * {@link IssuerBase base issuer} as output excluding the properties like accountId and organization details of the certificate issuer. + * This operation can then be used to get the full certificate issuer with its properties from {@code issuerBase}.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificateIssuer#issuerBase} + * + * @param issuerBase The {@link IssuerBase base issuer} holding attributes of the certificate issuer being requested. + * @throws ResourceNotFoundException when a certificate with {@link IssuerBase#name() name} doesn't exist in the key vault. + * @throws HttpRequestException if {@link IssuerBase#name() name} is empty string. + * @return A {@link Mono} containing the requested {@link Issuer certificate issuer}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getCertificateIssuer(IssuerBase issuerBase) { + return withContext(context -> getCertificateIssuerWithResponse(issuerBase.name(), context)).flatMap(FluxUtil::toMono); + } + + /** + * Gets information about the certificate issuer which represents the {@link IssuerBase} from the key vault. This operation + * requires the certificates/manageissuers/getissuers permission. + * + *

The list operations {@link CertificateAsyncClient#listCertificateIssuers()} return the {@link PagedFlux} containing + * {@link IssuerBase base issuer} as output excluding the properties like accountId and organization details of the certificate issuer. + * This operation can then be used to get the full certificate issuer with its properties from {@code issuerBase}.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificateIssuerWithResponse#issuerBase} + * + * @param issuerBase The {@link IssuerBase base issuer} holding attributes of the certificate issuer being requested. + * @throws ResourceNotFoundException when a certificate with {@link IssuerBase#name() name} doesn't exist in the key vault. + * @throws HttpRequestException if {@link IssuerBase#name() name} is empty string. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the requested {@link Issuer certificate issuer}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getCertificateIssuerWithResponse(IssuerBase issuerBase) { + return withContext(context -> getCertificateIssuerWithResponse(issuerBase.name(), context)); + } + + /** + * Deletes the specified certificate issuer. The DeleteCertificateIssuer operation permanently removes the specified certificate + * issuer from the key vault. This operation requires the {@code certificates/manageissuers/deleteissuers permission}. + * + *

Code Samples

+ *

Deletes the certificate issuer in the Azure Key Vault. Prints out the + * deleted certificate details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.deleteCertificateIssuerWithResponse#string} + * + * @param name The name of the certificate issuer to be deleted. + * @throws ResourceNotFoundException when a certificate issuer with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a certificate issuer with {@code name} is empty string. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link Issuer deleted issuer}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteCertificateIssuerWithResponse(String name) { + return withContext(context -> deleteCertificateIssuerWithResponse(name, context)); + } + + /** + * Deletes the specified certificate issuer. The DeleteCertificateIssuer operation permanently removes the specified certificate + * issuer from the key vault. This operation requires the {@code certificates/manageissuers/deleteissuers permission}. + * + *

Code Samples

+ *

Deletes the certificate issuer in the Azure Key Vault. Prints out the + * deleted certificate details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.deleteCertificateIssuer#string} + * + * @param name The name of the certificate issuer to be deleted. + * @throws ResourceNotFoundException when a certificate issuer with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a certificate issuer with {@code name} is empty string. + * @return A {@link Mono} containing the {@link Issuer deleted issuer}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteCertificateIssuer(String name) { + return withContext(context -> deleteCertificateIssuerWithResponse(name, context)).flatMap(FluxUtil::toMono); + } + + Mono> deleteCertificateIssuerWithResponse(String name, Context context) { + return service.deleteCertificateIssuer(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Deleting certificate issuer - {}", name)) + .doOnSuccess(response -> logger.info("Deleted the certificate issuer - {}", response.getValue().name())) + .doOnError(error -> logger.warning("Failed to delete the certificate issuer - {}", name, error)); + } + + + /** + * List all the certificate issuers resources in the key vault. The individual certificate issuer response in the flux is represented by {@link IssuerBase} + * as only the certificate issuer identifier and provider are provided in the response. This operation requires the + * {@code certificates/manageissuers/getissuers} permission. + * + *

It is possible to get the certificate issuer with all of its properties from this information. Convert the {@link PagedFlux} + * containing {@link IssuerBase base issuer} to {@link PagedFlux} containing {@link Issuer issuer} using + * {@link CertificateAsyncClient#getCertificateIssuer(IssuerBase baseIssuer)} within {@link PagedFlux#flatMap(Function)}.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.listCertificateIssuers} + * + * @return A {@link PagedFlux} containing all of the {@link IssuerBase certificate issuers} in the vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listCertificateIssuers() { + return new PagedFlux<>( + () -> withContext(context -> listCertificateIssuersFirstPage(context)), + continuationToken -> withContext(context -> listCertificateIssuersNextPage(continuationToken, context))); + } + + PagedFlux listCertificateIssuers(Context context) { + return new PagedFlux<>( + () -> listCertificateIssuersFirstPage(context), + continuationToken -> listCertificateIssuersNextPage(continuationToken, context)); + } + + private Mono> listCertificateIssuersFirstPage(Context context) { + return service.getCertificateIssuers(endpoint, DEFAULT_MAX_PAGE_RESULTS, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Listing certificate issuers - {}")) + .doOnSuccess(response -> logger.info("Listed certificate issuers - {}")) + .doOnError(error -> logger.warning(String.format("Failed to list certificate issuers - {}"), error)); + } + + /* + * Gets attributes of all the certificates given by the {@code nextPageLink} that was retrieved from a call to + * {@link KeyAsyncClient#listKeyVersions()}. + * + * @param continuationToken The {@link PagedResponse#nextLink()} from a previous, successful call to one of the listKeys operations. + * @return A {@link Mono} of {@link PagedResponse} from the next page of results. + */ + private Mono> listCertificateIssuersNextPage(String continuationToken, Context context) { + return service.getCertificateIssuers(endpoint, continuationToken, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Listing next certificate issuers page - Page {} ", continuationToken)) + .doOnSuccess(response -> logger.info("Listed next certificate issuers page - Page {} ", continuationToken)) + .doOnError(error -> logger.warning("Failed to list next certificate issuers page - Page {} ", continuationToken, error)); + } + + /** + * Updates the specified certificate issuer. The UpdateCertificateIssuer operation updates the specified attributes of + * the certificate issuer entity. This operation requires the certificates/setissuers permission. + * + *

Code Samples

+ *

Gets the certificate issuer, changes its attributes/properties then updates it in the Azure Key Vault. Prints out the + * returned certificate issuer details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.updateCertificateIssuer#IssuerBase} + * + * @param issuer The {@link Issuer issuer} with updated properties. + * @throws NullPointerException if {@code issuer} is {@code null}. + * @throws ResourceNotFoundException when a certificate issuer with {@link Issuer#name() name} doesn't exist in the key vault. + * @throws HttpRequestException if {@link Issuer#name() name} is empty string. + * @return A {@link Mono} containing the {@link Issuer updated issuer}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateCertificateIssuer(Issuer issuer) { + return withContext(context -> updateCertificateIssuerWithResponse(issuer, context).flatMap(FluxUtil::toMono)); + } + + /** + * Updates the specified certificate issuer. The UpdateCertificateIssuer operation updates the specified attributes of + * the certificate issuer entity. This operation requires the certificates/setissuers permission. + * + *

Code Samples

+ *

Gets the certificate issuer, changes its attributes/properties then updates it in the Azure Key Vault. Prints out the + * returned certificate issuer details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.updateCertificateIssuer#IssuerBase} + * + * @param issuer The {@link Issuer issuer} with updated properties. + * @throws NullPointerException if {@code issuer} is {@code null}. + * @throws ResourceNotFoundException when a certificate issuer with {@link Issuer#name() name} doesn't exist in the key vault. + * @throws HttpRequestException if {@link Issuer#name() name} is empty string. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link Issuer updated issuer}. + */ + public Mono> updateCertificateIssuerWithResponse(Issuer issuer) { + return withContext(context -> updateCertificateIssuerWithResponse(issuer, context)); + } + + Mono> updateCertificateIssuerWithResponse(Issuer issuer, Context context) { + CertificateIssuerUpdateParameters updateParameters = new CertificateIssuerUpdateParameters() + .provider(issuer.provider()) + .organizationDetails(new OrganizationDetails().adminDetails(issuer.administrators())) + .credentials(new IssuerCredentials().password(issuer.password()).accountId(issuer.accountId())); + return service.updateCertificateIssuer(endpoint, issuer.name(), API_VERSION, ACCEPT_LANGUAGE, updateParameters, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Updating certificate issuer - {}", issuer.name())) + .doOnSuccess(response -> logger.info("Updated up the certificate issuer - {}", response.getValue().name())) + .doOnError(error -> logger.warning("Failed to updated the certificate issuer - {}", issuer.name(), error)); + } + + /** + * Sets the certificate contacts on the key vault. This operation requires the {@code certificates/managecontacts} permission. + * + *

The {@link LifetimeAction} of type {@link LifetimeActionType#EMAIL_CONTACTS} set on a {@link CertificatePolicy} emails the contacts set on the vault when triggered.

+ * + *

Code Samples

+ *

Sets the certificate contacts in the Azure Key Vault. Prints out the + * returned contacts details.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.setCertificateContacts#contacts} + * + * @param contacts The list of contacts to set on the vault. + * @throws HttpRequestException when a contact information provided is invalid/incomplete. + * @return A {@link PagedFlux} containing all of the {@link Contact certificate contacts} in the vault. + */ + public PagedFlux setCertificateContacts(List contacts) { + return new PagedFlux<>( + () -> withContext(context -> setCertificateContactsWithResponse(contacts, context))); + } + + PagedFlux setCertificateContacts(List contacts, Context context) { + return new PagedFlux<>( + () -> setCertificateContactsWithResponse(contacts, context)); + } + + private Mono> setCertificateContactsWithResponse(List contacts, Context context) { + Contacts contactsParams = new Contacts().contactList(contacts); + return service.setCertificateContacts(endpoint, API_VERSION, ACCEPT_LANGUAGE, contactsParams, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Listing certificate contacts - {}")) + .doOnSuccess(response -> logger.info("Listed certificate contacts - {}")) + .doOnError(error -> logger.warning(String.format("Failed to list certificate contacts - {}"), error)); + } + + /** + * Lists the certificate contacts in the key vault. This operation requires the certificates/managecontacts permission. + * + *

Code Samples

+ *

Lists the certificate contacts in the Azure Key Vault. Prints out the + * returned contacts details.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.listCertificateContacts} + * + * @return A {@link PagedFlux} containing all of the {@link Contact certificate contacts} in the vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listCertificateContacts() { + return new PagedFlux<>( + () -> withContext(context -> listCertificateContactsFirstPage(context))); + } + + PagedFlux listCertificateContacts(Context context) { + return new PagedFlux<>( + () -> listCertificateContactsFirstPage(context)); + } + + private Mono> listCertificateContactsFirstPage(Context context) { + return service.getCertificateContacts(endpoint, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Listing certificate contacts - {}")) + .doOnSuccess(response -> logger.info("Listed certificate contacts - {}")) + .doOnError(error -> logger.warning(String.format("Failed to list certificate contacts - {}"), error)); + } + + /** + * Deletes the certificate contacts in the key vault. This operation requires the {@code certificates/managecontacts} permission. + * + *

Code Samples

+ *

Deletes the certificate contacts in the Azure Key Vault. Prints out the + * deleted contacts details.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.deleteCertificateContacts} + * + * @return A {@link PagedFlux} containing all of the {@link Contact deleted certificate contacts} in the vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux deleteCertificateContacts() { + return new PagedFlux<>( + () -> withContext(context -> deleteCertificateContactsWithResponse(context))); + } + + PagedFlux deleteCertificateContacts(Context context) { + return new PagedFlux<>( + () -> deleteCertificateContactsWithResponse(context)); + } + + private Mono> deleteCertificateContactsWithResponse(Context context) { + return service.deleteCertificateContacts(endpoint, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Deleting certificate contacts - {}")) + .doOnSuccess(response -> logger.info("Deleted certificate contacts - {}")) + .doOnError(error -> logger.warning(String.format("Failed to delete certificate contacts - {}"), error)); + } + + /** + * Deletes the creation operation for the specified certificate that is in the process of being created. The certificate is + * no longer created. This operation requires the {@code certificates/update permission}. + * + *

Code Samples

+ *

Triggers certificate creation and then deletes the certificate creation operation in the Azure Key Vault. Prints out the + * deleted certificate operation details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.deleteCertificateOperation#string} + * + * @param certificateName The name of the certificate which is in the process of being created. + * @throws ResourceNotFoundException when a certificate operation for a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when the {@code name} is empty string. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link CertificateOperation deleted certificate operation}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteCertificateOperation(String certificateName) { + return withContext(context -> deleteCertificateOperationWithResponse(certificateName, context)).flatMap(FluxUtil::toMono); + } + + /** + * Deletes the creation operation for the specified certificate that is in the process of being created. The certificate is + * no longer created. This operation requires the {@code certificates/update permission}. + * + *

Code Samples

+ *

Triggers certificate creation and then deletes the certificate creation operation in the Azure Key Vault. Prints out the + * deleted certificate operation details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.deleteCertificateOperationWithResponse#string} + * + * @param certificateName The name of the certificate which is in the process of being created. + * @throws ResourceNotFoundException when a certificate operation for a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when the {@code name} is empty string. + * @return A {@link Mono} containing the {@link CertificateOperation deleted certificate operation}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> deleteCertificateOperationWithResponse(String certificateName) { + return withContext(context -> deleteCertificateOperationWithResponse(certificateName, context)); + } + + Mono> deleteCertificateOperationWithResponse(String certificateName, Context context) { + return service.deletetCertificateOperation(endpoint, certificateName, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Deleting certificate operation - {}", certificateName)) + .doOnSuccess(response -> logger.info("Deleted the certificate operation - {}", response.getStatusCode())) + .doOnError(error -> logger.warning("Failed to delete the certificate operation - {}", certificateName, error)); + } + + /** + * Cancels a certificate creation operation that is already in progress. This operation requires the {@code certificates/update} permission. + * + *

Code Samples

+ *

Triggers certificate creation and then cancels the certificate creation operation in the Azure Key Vault. Prints out the + * updated certificate operation details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.cancelCertificateOperation#string} + * + * @param certificateName The name of the certificate which is in the process of being created. + * @throws ResourceNotFoundException when a certificate operation for a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when the {@code name} is empty string. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link CertificateOperation cancelled certificate operation}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono cancelCertificateOperation(String certificateName) { + return withContext(context -> cancelCertificateOperationWithResponse(certificateName, context)).flatMap(FluxUtil::toMono); + } + + /** + * Cancels a certificate creation operation that is already in progress. This operation requires the {@code certificates/update} permission. + * + *

Code Samples

+ *

Triggers certificate creation and then cancels the certificate creation operation in the Azure Key Vault. Prints out the + * updated certificate operation details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.cancelCertificateOperationWithResponse#string} + * + * @param certificateName The name of the certificate which is in the process of being created. + * @throws ResourceNotFoundException when a certificate operation for a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when the {@code name} is empty string. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link CertificateOperation cancelled certificate operation}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> cancelCertificateOperationWithResponse(String certificateName) { + return withContext(context -> cancelCertificateOperationWithResponse(certificateName, context)); + } + + Mono> cancelCertificateOperationWithResponse(String certificateName, Context context) { + CertificateOperationUpdateParameter parameter = new CertificateOperationUpdateParameter().cancellationRequested(true); + return service.updateCertificateOperation(endpoint, certificateName, API_VERSION, ACCEPT_LANGUAGE, parameter, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Cancelling certificate operation - {}", certificateName)) + .doOnSuccess(response -> logger.info("Cancelled the certificate operation - {}", response.getValue().status())) + .doOnError(error -> logger.warning("Failed to cancel the certificate operation - {}", certificateName, error)); + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateBackup.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateBackup.java new file mode 100644 index 000000000000..adf59f3a6aac --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateBackup.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.core.implementation.Base64Url; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The backup key result, containing the backup blob. + */ +class CertificateBackup { + /** + * The backup blob containing the backed up key. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private Base64Url value; + + /** + * Get the backup blob. + * + * @return the backup blob + */ + byte[] value() { + if (this.value == null) { + return new byte[0]; + } + return this.value.decodedBytes(); + } +} 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 new file mode 100644 index 000000000000..032faedb03c3 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClient.java @@ -0,0 +1,1291 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.core.exception.HttpRequestException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.VoidResponse; +import com.azure.core.implementation.annotation.ReturnType; +import com.azure.core.implementation.annotation.ServiceClient; +import com.azure.core.implementation.annotation.ServiceMethod; +import com.azure.core.util.Context; +import com.azure.security.keyvault.certificates.models.Certificate; +import com.azure.security.keyvault.certificates.models.CertificateOperation; +import com.azure.security.keyvault.certificates.models.CertificatePolicy; +import com.azure.security.keyvault.certificates.models.DeletedCertificate; +import com.azure.security.keyvault.certificates.models.Contact; +import com.azure.security.keyvault.certificates.models.Issuer; +import com.azure.security.keyvault.certificates.models.CertificateBase; +import com.azure.security.keyvault.certificates.models.IssuerBase; +import com.azure.security.keyvault.certificates.models.MergeCertificateOptions; +import com.azure.security.keyvault.certificates.models.LifetimeAction; +import com.azure.security.keyvault.certificates.models.LifetimeActionType; + +import java.time.Duration; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * The CertificateClient provides synchronous methods to manage {@link Certificate certifcates} in the Azure Key Vault. The client + * supports creating, retrieving, updating, merging, deleting, purging, backing up, restoring and listing the + * {@link Certificate certificates}. The client also supports listing {@link DeletedCertificate deleted certificates} for + * a soft-delete enabled Azure Key Vault. + * + *

The client further allows creating, retrieving, updating, deleting and listing the {@link Issuer certificate issuers}. The client also supports + * creating, listing and deleting {@link Contact certificate contacts}

+ * + *

Samples to construct the sync client

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.instantiation} + * + * @see CertificateClientBuilder + * @see PagedIterable + */ +@ServiceClient(builder = CertificateClientBuilder.class, serviceInterfaces = CertificateService.class) +public class CertificateClient { + private final CertificateAsyncClient client; + + /** + * Creates a CertificateClient that uses {@code pipeline} to service requests + * + * @param client The {@link CertificateAsyncClient} that the client routes its request through. + */ + CertificateClient(CertificateAsyncClient client) { + this.client = client; + } + + /** + * Creates a new certificate. If this is the first version, the certificate resource is created. This operation requires + * the certificates/create permission. + * + *

Create certificate is a long running operation. It waits for the specified {@code timeout} duration for the + * create certificate operation to complete on service side.

+ * + *

Code Samples

+ *

Create certificate is a long running operation. The createCertificate waits for the {@code timeout} duration operation to complete and + * returns its last status. The details of the last certificate operation status are printed when a response is received

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.createCertificate#String-CertificatePolicy-Map-Duration} + * + * @param name The name of the certificate to be created. + * @param policy The policy of the certificate to be created. + * @param tags The application specific metadata to set. + * @param timeout The duration for which execution should be blocked and wait for certificate operation to finish. + * @throws ResourceModifiedException when invalid certificate policy configuration is provided. + * @throws IllegalStateException when the operation does not finish in specified {@code timeout}. + * @return The last {@link CertificateOperation create certificate operation} status received after operation was completed. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateOperation createCertificate(String name, CertificatePolicy policy, Map tags, Duration timeout) { + return client.createCertificate(name, policy, tags).block(timeout).getValue(); + } + + /** + * Creates a new certificate. If this is the first version, the certificate resource is created. This operation requires + * the certificates/create permission. + * + *

Create certificate is a long running operation. It indefinitely waits for the create certificate operation to complete on service side.

+ * + *

Code Samples

+ *

Create certificate is a long running operation. The createCertificate indefinitely waits for the operation to complete and + * returns its last status. The details of the last certificate operation status are printed when a response is received

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.createCertificate#String-CertificatePolicy-Map} + * + * @param name The name of the certificate to be created. + * @param policy The policy of the certificate to be created. + * @param tags The application specific metadata to set. + * @throws ResourceModifiedException when invalid certificate policy configuration is provided. + * @return The last {@link CertificateOperation create certificate operation} status received after operation was completed. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateOperation createCertificate(String name, CertificatePolicy policy, Map tags) { + return client.createCertificate(name, policy, tags).block().getValue(); + } + + /** + * Creates a new certificate. If this is the first version, the certificate resource is created. This operation requires + * the certificates/create permission. + * + *

Code Samples

+ *

Create certificate is a long running operation. The createCertificate waits for the {@code timeout} duration operation to complete and + * returns its last status. The details of the last certificate operation status are printed when a response is received

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.createCertificate#String-CertificatePolicy-Duration} + * + * @param name The name of the certificate to be created. + * @param policy The policy of the certificate to be created. + * @param timeout The duration for which execution should be blocked and wait for certificate operation to finish. + * @throws ResourceModifiedException when invalid certificate policy configuration is provided. + * @throws IllegalStateException when the operation does not finish in specified {@code timeout}. + * @return The last {@link CertificateOperation create certificate operation} status received after operation was completed. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateOperation createCertificate(String name, CertificatePolicy policy, Duration timeout) { + return client.createCertificate(name, policy).block(timeout).getValue(); + } + + /** + * Creates a new certificate. If this is the first version, the certificate resource is created. This operation requires + * the certificates/create permission. + * + *

Code Samples

+ *

Create certificate is a long running operation. The createCertificate indefinitely waits for the operation to complete and + * returns its last status. The details of the last certificate operation status are printed when a response is received

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.createCertificate#String-CertificatePolicy} + * + * @param name The name of the certificate to be created. + * @param policy The policy of the certificate to be created. + * @throws ResourceModifiedException when invalid certificate policy configuration is provided. + * @return A {@link Poller} polling on the create certificate operation status. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateOperation createCertificate(String name, CertificatePolicy policy) { + return client.createCertificate(name, policy).block().getValue(); + } + + /** + * Gets information about the latest version of the specified certificate. This operation requires the certificates/get permission. + * + *

Code Samples

+ *

Gets a specific version of the key in the key vault. Prints out the returned certificate details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.getCertificateWithPolicy#String} + * + * @param name The name of the certificate to retrieve, cannot be null + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException if {@code name} is empty string. + * @return The requested {@link Certificate certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Certificate getCertificateWithPolicy(String name) { + return client.getCertificateWithPolicy(name).block(); + } + + /** + * Gets information about the certificate which represents the {@link CertificateBase} from the key vault. This + * operation requires the certificates/get permission. + * + *

The list operations {@link CertificateClient#listCertificates()} and {@link CertificateClient#listCertificateVersions(String)} return + * the {@link PagedIterable} containing {@link CertificateBase} as output excluding the properties like secretId and keyId of the certificate. + * This operation can then be used to get the full certificate with its properties excluding the policy from {@code certificateBase}.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.getCertificate#CertificateBase} + * + * @param certificateBase The {@link CertificateBase} holding attributes of the certificate being requested. + * @throws ResourceNotFoundException when a certificate with {@link CertificateBase#name() name} and {@link CertificateBase#version() version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link CertificateBase#name()} name} or {@link CertificateBase#version() version} is empty string. + * @return The requested {@link Certificate certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Certificate getCertificate(CertificateBase certificateBase) { + return client.getCertificateWithResponse(certificateBase.name(), certificateBase.version(), Context.NONE).block().getValue(); + } + + /** + * Gets information about the latest version of the specified certificate. This operation requires the certificates/get permission. + * + *

Code Samples

+ *

Gets a specific version of the key in the key vault. Prints out the returned certificate details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.getCertificateWithResponse#String-String-Context} + * + * @param name The name of the certificate to retrieve, cannot be null + * @param version The version of the certificate to retrieve. If this is an empty String or null, this call is equivalent to calling {@link CertificateClient#getCertificateWithPolicy(String)}, with the latest version being retrieved. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException if {@code name} is empty string. + * @return A {@link Response} whose {@link Response#getValue() value} contains the requested {@link Certificate certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getCertificateWithResponse(String name, String version, Context context) { + return client.getCertificateWithResponse(name, version, context).block(); + } + + /** + * Gets information about the specified version of the specified certificate. This operation requires the certificates/get permission. + * + *

Code Samples

+ *

Gets a specific version of the key in the key vault. Prints out the returned certificate details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.getCertificate#String-String} + * + * @param name The name of the certificate to retrieve, cannot be null + * @param version The version of the certificate to retrieve. If this is an empty String or null, this call is equivalent to calling {@link CertificateClient#getCertificateWithPolicy(String)}, with the latest version being retrieved. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException if {@code name} is empty string. + * @return The requested {@link Certificate certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Certificate getCertificate(String name, String version) { + return client.getCertificateWithResponse(name, version, Context.NONE).block().getValue(); + } + + /** + * Updates the specified attributes associated with the specified certificate. The update operation changes specified attributes of an existing + * stored certificate and attributes that are not specified in the request are left unchanged. This operation requires the certificates/update permission. + * + *

Code Samples

+ *

Gets latest version of the certificate, changes its tags and enabled status and then updates it in the Azure Key Vault. Prints out the + * returned certificate details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.updateCertificate#CertificateBase} + * + * @param certificate The {@link CertificateBase} object with updated properties. + * @throws NullPointerException if {@code certificate} is {@code null}. + * @throws ResourceNotFoundException when a certificate with {@link CertificateBase#name() name} and {@link CertificateBase#version() version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link CertificateBase#name() name} or {@link CertificateBase#version() version} is empty string. + * @return The {@link CertificateBase updated certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Certificate updateCertificate(CertificateBase certificate) { + return client.updateCertificateWithResponse(certificate, Context.NONE).block().getValue(); + } + + /** + * Updates the specified attributes associated with the specified certificate. The update operation changes specified attributes of an existing + * stored certificate and attributes that are not specified in the request are left unchanged. This operation requires the certificates/update permission. + * + *

Code Samples

+ *

Gets latest version of the certificate, changes its tags and enabled status and then updates it in the Azure Key Vault. Prints out the + * returned certificate details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.updateCertificateWithResponse#CertificateBase-Context} + * + * @param certificate The {@link CertificateBase} object with updated properties. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws NullPointerException if {@code certificate} is {@code null}. + * @throws ResourceNotFoundException when a certificate with {@link CertificateBase#name() name} and {@link CertificateBase#version() version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link CertificateBase#name() name} or {@link CertificateBase#version() version} is empty string. + * @return A {@link Response} whose {@link Response#getValue() value} contains the {@link CertificateBase updated certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateCertificateWithResponse(CertificateBase certificate, Context context) { + return client.updateCertificateWithResponse(certificate, context).block(); + } + + + /** + * Deletes a certificate from a specified key vault. All the versions of the certificate along with its associated policy + * get deleted. If soft-delete is enabled on the key vault then the certificate is placed in the deleted state and requires to be + * purged for permanent deletion else the certificate is permanently deleted. The delete operation applies to any certificate stored in + * Azure Key Vault but it cannot be applied to an individual version of a certificate. This operation requires the certificates/delete permission. + * + *

Code Samples

+ *

Deletes the certificate in the Azure Key Vault. Prints out the + * deleted certificate details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.deleteCertificate#string} + * + * @param name The name of the certificate to be deleted. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a certificate with {@code name} is empty string. + * @return The {@link DeletedCertificate deleted certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeletedCertificate deleteCertificate(String name) { + return deleteCertificateWithResponse(name, Context.NONE).getValue(); + } + + /** + * Deletes a certificate from a specified key vault. All the versions of the certificate along with its associated policy + * get deleted. If soft-delete is enabled on the key vault then the certificate is placed in the deleted state and requires to be + * purged for permanent deletion else the certificate is permanently deleted. The delete operation applies to any certificate stored in + * Azure Key Vault but it cannot be applied to an individual version of a certificate. This operation requires the certificates/delete permission. + * + *

Code Samples

+ *

Deletes the certificate in the Azure Key Vault. Prints out the + * deleted certificate details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.deleteCertificateWithResponse#String-Context} + * + * @param name The name of the certificate to be deleted. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a certificate with {@code name} is empty string. + * @return A {@link Response} whose {@link Response#getValue() value} contains the {@link DeletedCertificate deleted certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteCertificateWithResponse(String name, Context context) { + return client.deleteCertificateWithResponse(name, context).block(); + } + + /** + * Retrieves information about the specified deleted certificate. The GetDeletedCertificate operation is applicable for soft-delete + * enabled vaults and additionally retrieves deleted certificate's attributes, such as retention interval, scheduled permanent deletion and the current deletion recovery level. This operation + * requires the certificates/get permission. + * + *

Code Samples

+ *

Gets the deleted certificate from the key vault enabled for soft-delete. Prints out the + * deleted certificate details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.getDeletedCertificate#string} + * + * @param name The name of the deleted certificate. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a certificate with {@code name} is empty string. + * @return The {@link DeletedCertificate deleted certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeletedCertificate getDeletedCertificate(String name) { + return getDeletedCertificateWithResponse(name, Context.NONE).getValue(); + } + + /** + * Retrieves information about the specified deleted certificate. The GetDeletedCertificate operation is applicable for soft-delete + * enabled vaults and additionally retrieves deleted certificate's attributes, such as retention interval, scheduled permanent deletion and the current deletion recovery level. This operation + * requires the certificates/get permission. + * + *

Code Samples

+ *

Gets the deleted certificate from the key vault enabled for soft-delete. Prints out the + * deleted certificate details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.getDeletedCertificateWithResponse#String-Context} + * + * @param name The name of the deleted certificate. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a certificate with {@code name} is empty string. + * @return A {@link Response} whose {@link Response#getValue() value} contains the {@link DeletedCertificate deleted certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDeletedCertificateWithResponse(String name, Context context) { + return client.getDeletedCertificateWithResponse(name, context).block(); + } + + /** + * Permanently deletes the specified deleted certificate without possibility for recovery. The Purge Deleted Certificate operation is applicable for + * soft-delete enabled vaults and is not available if the recovery level does not specify 'Purgeable'. This operation requires the certificate/purge permission. + * + *

Code Samples

+ *

Purges the deleted certificate from the key vault enabled for soft-delete. Prints out the + * status code from the server response when a response has been received.

+ + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.purgeDeletedCertificateWithResponse#string} + * + * @param name The name of the deleted certificate. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a certificate with {@code name} is empty string. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void purgeDeletedCertificateWithResponse(String name) { + purgeDeletedCertificateWithResponse(name, Context.NONE); + } + + /** + * Permanently deletes the specified deleted certificate without possibility for recovery. The Purge Deleted Certificate operation is applicable for + * soft-delete enabled vaults and is not available if the recovery level does not specify 'Purgeable'. This operation requires the certificate/purge permission. + * + *

Code Samples

+ *

Purges the deleted certificate from the key vault enabled for soft-delete. Prints out the + * status code from the server response when a response has been received.

+ + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.purgeDeletedCertificateWithResponse#string-Context} + * + * @param name The name of the deleted certificate. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a certificate with {@code name} is empty string. + * @return A {@link VoidResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VoidResponse purgeDeletedCertificateWithResponse(String name, Context context) { + return client.purgeDeletedCertificate(name, context).block(); + } + + /** + * Recovers the deleted certificate back to its current version under /certificates and can only be performed on a soft-delete enabled vault. + * The RecoverDeletedCertificate operation performs the reversal of the Delete operation and must be issued during the retention interval + * (available in the deleted certificate's attributes). This operation requires the certificates/recover permission. + * + *

Code Samples

+ *

Recovers the deleted certificate from the key vault enabled for soft-delete. Prints out the + * recovered certificate details when a response has been received.

+ + * {@codesnippet com.azure.security.certificatevault.certificates.CertificateClient.recoverDeletedCertificate#string} + * + * @param name The name of the deleted certificate to be recovered. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the certificate vault. + * @throws HttpRequestException when a certificate with {@code name} is empty string. + * @return The {@link Certificate recovered certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Certificate recoverDeletedCertificate(String name) { + return recoverDeletedCertificateWithResponse(name, Context.NONE).getValue(); + } + + /** + * Recovers the deleted certificate back to its current version under /certificates and can only be performed on a soft-delete enabled vault. + * The RecoverDeletedCertificate operation performs the reversal of the Delete operation and must be issued during the retention interval + * (available in the deleted certificate's attributes). This operation requires the certificates/recover permission. + * + *

Code Samples

+ *

Recovers the deleted certificate from the key vault enabled for soft-delete. Prints out the + * recovered certificate details when a response has been received.

+ + * {@codesnippet com.azure.security.certificatevault.certificates.CertificateClient.recoverDeletedCertificateWithResponse#String-Context} + * + * @param name The name of the deleted certificate to be recovered. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the certificate vault. + * @throws HttpRequestException when a certificate with {@code name} is empty string. + * @return A {@link Response} whose {@link Response#getValue() value} contains the {@link Certificate recovered certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response recoverDeletedCertificateWithResponse(String name, Context context) { + return client.recoverDeletedCertificateWithResponse(name, context).block(); + } + + /** + * Requests that a backup of the specified certificate be downloaded to the client. All versions of the certificate will + * be downloaded. This operation requires the certificates/backup permission. + * + *

Code Samples

+ *

Backs up the certificate from the key vault. Prints out the + * length of the certificate's backup byte array returned in the response.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.backupCertificate#string} + * + * @param name The name of the certificate. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a certificate with {@code name} is empty string. + * @return The backed up certificate blob. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public byte[] backupCertificate(String name) { + return backupCertificateWithResponse(name, Context.NONE).getValue(); + } + + /** + * Requests that a backup of the specified certificate be downloaded to the client. All versions of the certificate will + * be downloaded. This operation requires the certificates/backup permission. + * + *

Code Samples

+ *

Backs up the certificate from the key vault. Prints out the + * length of the certificate's backup byte array returned in the response.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.backupCertificateWithResponse#String-Context} + * + * @param name The name of the certificate. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a certificate with {@code name} is empty string. + * @return A {@link Response} whose {@link Response#getValue() value} contains the backed up certificate blob. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response backupCertificateWithResponse(String name, Context context) { + return client.backupCertificateWithResponse(name, context).block(); + } + + /** + * Restores a backed up certificate to the vault. All the versions of the certificate are restored to the vault. This operation + * requires the certificates/restore permission. + * + *

Code Samples

+ *

Restores the certificate in the key vault from its backup. Prints out the restored certificate + * details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.restoreCertificate#byte} + * + * @param backup The backup blob associated with the certificate. + * @throws ResourceModifiedException when {@code backup} blob is malformed. + * @return The {@link Certificate restored certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Certificate restoreCertificate(byte[] backup) { + return restoreCertificateWithResponse(backup, Context.NONE).getValue(); + } + + /** + * Restores a backed up certificate to the vault. All the versions of the certificate are restored to the vault. This operation + * requires the certificates/restore permission. + * + *

Code Samples

+ *

Restores the certificate in the key vault from its backup. Prints out the restored certificate + * details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.restoreCertificateWithResponse#byte-Context} + * + * @param backup The backup blob associated with the certificate. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws ResourceModifiedException when {@code backup} blob is malformed. + * @return A {@link Response} whose {@link Response#getValue() value} contains the {@link Certificate restored certificate}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response restoreCertificateWithResponse(byte[] backup, Context context) { + return client.restoreCertificateWithResponse(backup, context).block(); + } + + /** + * List certificates in a the key vault. Retrieves the set of certificates resources in the key vault and the individual + * certificate response in the iterable is represented by {@link CertificateBase} as only the certificate identifier, thumbprint, + * attributes and tags are provided in the response. The policy and individual certificate versions are not listed in + * the response. This operation requires the certificates/list permission. + * + *

It is possible to get certificates with all the properties excluding the policy from this information. Loop over the {@link CertificateBase} and + * call {@link CertificateClient#getCertificate(CertificateBase)} . This will return the {@link Certificate certificate} + * with all its properties excluding the policy.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.listCertificates} + * + * @return A {@link PagedIterable} containing {@link CertificateBase certificate} for all the certificates in the vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCertificates() { + return new PagedIterable<>(client.listCertificates(false, Context.NONE)); + } + + /** + * List certificates in a the key vault. Retrieves the set of certificates resources in the key vault and the individual + * certificate response in the iterable is represented by {@link CertificateBase} as only the certificate identifier, thumbprint, + * attributes and tags are provided in the response. The policy and individual certificate versions are not listed in + * the response. This operation requires the certificates/list permission. + * + *

It is possible to get certificates with all the properties excluding the policy from this information. Loop over the {@link CertificateBase} and + * call {@link CertificateClient#getCertificate(CertificateBase)} . This will return the {@link Certificate certificate} + * with all its properties excluding the policy.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.listCertificates#context} + * + * @param includePending indicate if pending certificates should be included in the results. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A {@link PagedIterable} containing {@link CertificateBase certificate} for all the certificates in the vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCertificates(boolean includePending, Context context) { + return new PagedIterable<>(client.listCertificates(includePending, context)); + } + + /** + * Lists the {@link DeletedCertificate deleted certificates} in the key vault currently available for recovery. This operation includes + * deletion-specific information and is applicable for vaults enabled for soft-delete. This operation requires the + * {@code certificates/get/list} permission. + * + *

Code Samples

+ *

Lists the deleted certificates in the key vault. Prints out the + * recovery id of each deleted certificate when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.listDeletedCertificates} + * + * @return A {@link PagedIterable} containing all of the {@link DeletedCertificate deleted certificates} in the vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listDeletedCertificates() { + return listDeletedCertificates(Context.NONE); + } + + + /** + * Lists the {@link DeletedCertificate deleted certificates} in the key vault currently available for recovery. This operation includes + * deletion-specific information and is applicable for vaults enabled for soft-delete. This operation requires the + * {@code certificates/get/list} permission. + * + *

Code Samples

+ *

Lists the deleted certificates in the key vault. Prints out the + * recovery id of each deleted certificate when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.listDeletedCertificates#context} + * + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A {@link PagedIterable} containing all of the {@link DeletedCertificate deleted certificates} in the vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listDeletedCertificates(Context context) { + return new PagedIterable<>(client.listDeletedCertificates(context)); + } + + /** + * List all versions of the specified certificate. The individual certificate response in the iterable is represented by {@link CertificateBase} + * as only the certificate identifier, thumbprint, attributes and tags are provided in the response. The policy is not listed in + * the response. This operation requires the certificates/list permission. + * + *

It is possible to get the certificates with properties excluding the policy for all the versions from this information. Loop over the {@link CertificateBase} and + * call {@link CertificateClient#getCertificate(CertificateBase)}. This will return the {@link Certificate certificate} + * with all its properties excluding the policy.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.listCertificateVersions} + * + * @param name The name of the certificate. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a certificate with {@code name} is empty string. + * @return A {@link PagedIterable} containing {@link CertificateBase certificate} of all the versions of the specified certificate in the vault. Paged Iterable is empty if certificate with {@code name} does not exist in key vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCertificateVersions(String name) { + return listCertificateVersions(name, Context.NONE); + } + + /** + * List all versions of the specified certificate. The individual certificate response in the iterable is represented by {@link CertificateBase} + * as only the certificate identifier, thumbprint, attributes and tags are provided in the response. The policy is not listed in + * the response. This operation requires the certificates/list permission. + * + *

It is possible to get the certificates with properties excluding the policy for all the versions from this information. Loop over the {@link CertificateBase} and + * call {@link CertificateClient#getCertificate(CertificateBase)}. This will return the {@link Certificate certificate} + * with all its properties excluding the policy.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.listCertificateVersions#context} + * + * @param name The name of the certificate. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a certificate with {@code name} is empty string. + * @return A {@link PagedIterable} containing {@link CertificateBase certificate} of all the versions of the specified certificate in the vault. Iterable is empty if certificate with {@code name} does not exist in key vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCertificateVersions(String name, Context context) { + return new PagedIterable<>(client.listCertificateVersions(name, context)); + } + + /** + * Retrieves the policy of the specified certificate in the key vault. This operation requires the {@code certificates/get} permission. + * + *

Code Samples

+ *

Gets the policy of a certirifcate in the key vault. Prints out the + * returned certificate policy details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.getCertificatePolicy#string} + * + * @param name The name of the certificate whose policy is to be retrieved, cannot be null + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException if {@code name} is empty string. + * @return The requested {@link CertificatePolicy certificate policy}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificatePolicy getCertificatePolicy(String name) { + return getCertificatePolicyWithResponse(name, Context.NONE).getValue(); + } + + /** + * Retrieves the policy of the specified certificate in the key vault. This operation requires the {@code certificates/get} permission. + * + *

Code Samples

+ *

Gets the policy of a certirifcate in the key vault. Prints out the + * returned certificate policy details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.getCertificatePolicyWithResponse#string} + * + * @param name The name of the certificate whose policy is to be retrieved, cannot be null + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException if {@code name} is empty string. + * @return A {@link Response} whose {@link Response#getValue() value} contains the requested {@link CertificatePolicy certificate policy}. + */ + public Response getCertificatePolicyWithResponse(String name, Context context) { + return client.getCertificatePolicyWithResponse(name, context).block(); + } + + /** + * Updates the policy for a certificate. The update operation changes specified attributes of the certificate policy and attributes + * that are not specified in the request are left unchanged. This operation requires the {@code certificates/update} permission. + * + *

Code Samples

+ *

Gets the certificate policy, changes its properties and then updates it in the Azure Key Vault. Prints out the + * returned policy details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.updateCertificatePolicy#string} + * + * @param certificateName The name of the certificate whose policy is to be updated. + * @param policy The certificate policy to be updated. + * @throws NullPointerException if {@code policy} is {@code null}. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException if {@code name} is empty string or if {@code policy} is invalid. + * @return The updated {@link CertificatePolicy certificate policy}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificatePolicy updateCertificatePolicy(String certificateName, CertificatePolicy policy) { + return updateCertificatePolicyWithResponse(certificateName, policy, Context.NONE).getValue(); + } + + /** + * Updates the policy for a certificate. The update operation changes specified attributes of the certificate policy and attributes + * that are not specified in the request are left unchanged. This operation requires the {@code certificates/update} permission. + * + *

Code Samples

+ *

Gets the certificate policy, changes its properties and then updates it in the Azure Key Vault. Prints out the + * returned policy details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.updateCertificatePolicyWithResponse#string} + * + * @param certificateName The name of the certificate whose policy is to be updated. + * @param policy The certificate policy to be updated. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws NullPointerException if {@code policy} is {@code null}. + * @throws ResourceNotFoundException when a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException if {@code name} is empty string or if {@code policy} is invalid. + * @return A {@link Response} whose {@link Response#getValue() value} contains the updated {@link CertificatePolicy certificate policy}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateCertificatePolicyWithResponse(String certificateName, CertificatePolicy policy, Context context) { + return client.updateCertificatePolicyWithResponse(certificateName, policy, context).block(); + } + + /** + * Creates the specified certificate issuer. The SetCertificateIssuer operation updates the specified certificate issuer if it + * already exists or adds it if doesn't exist. This operation requires the certificates/setissuers permission. + * + *

Code Samples

+ *

Creates a new certificate issuer in the key vault. Prints out the created certificate + * issuer details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.createCertificateIssuer#String-String} + * + * @param name The name of the certificate issuer to be created. + * @param provider The provider of the certificate issuer to be created. + * @throws ResourceModifiedException when invalid certificate issuer {@code name} or {@code provider} configuration is provided. + * @throws HttpRequestException when a certificate issuer with {@code name} is empty string. + * @return The created {@link Issuer certificate issuer}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Issuer createCertificateIssuer(String name, String provider) { + return client.createCertificateIssuerWithResponse(name, provider, Context.NONE).block().getValue(); + } + + /** + * Creates the specified certificate issuer. The SetCertificateIssuer operation updates the specified certificate issuer if it + * already exists or adds it if doesn't exist. This operation requires the certificates/setissuers permission. + * + *

Code Samples

+ *

Creates a new certificate issuer in the key vault. Prints out the created certificate issuer details when a + * response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.createCertificateIssuer#issuer} + * + * @param issuer The configuration of the certificate issuer to be created. + * @throws ResourceModifiedException when invalid certificate issuer {@code issuer} configuration is provided. + * @throws HttpRequestException when a certificate issuer with {@code name} is empty string. + * @return The created {@link Issuer certificate issuer}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Issuer createCertificateIssuer(Issuer issuer) { + return createCertificateIssuerWithResponse(issuer, Context.NONE).getValue(); + } + + /** + * Creates the specified certificate issuer. The SetCertificateIssuer operation updates the specified certificate issuer if it + * already exists or adds it if doesn't exist. This operation requires the certificates/setissuers permission. + + *

Code Samples

+ *

Creates a new certificate issuer in the key vault. Prints out the created certificate + * issuer details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.createCertificateIssuerWithResponse#Issuer-Context} + * + * @param issuer The configuration of the certificate issuer to be created. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws ResourceModifiedException when invalid certificate issuer {@code issuer} configuration is provided. + * @throws HttpRequestException when a certificate issuer with {@code name} is empty string. + * @return A {@link Response} whose {@link Response#getValue() value} contains the created {@link Issuer certificate issuer}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createCertificateIssuerWithResponse(Issuer issuer, Context context) { + return client.createCertificateIssuerWithResponse(issuer, context).block(); + } + + /** + * Retrieves the specified certificate issuer from the key vault. This operation requires the certificates/manageissuers/getissuers permission. + * + *

Code Samples

+ *

Gets the specificed certifcate issuer in the key vault. Prints out the returned certificate issuer details when + * a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.getCertificateIssuerWithResponse#string-context} + * + * @param name The name of the certificate to retrieve, cannot be null + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws ResourceNotFoundException when a certificate issuer with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException if {@code name} is empty string. + * @return A {@link Response} whose {@link Response#getValue() value} contains the requested {@link Issuer certificate issuer}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getCertificateIssuerWithResponse(String name, Context context) { + return client.getCertificateIssuerWithResponse(name, context).block(); + } + + /** + * Retrieves the specified certificate issuer from the key vault. This operation requires the certificates/manageissuers/getissuers permission. + * + *

Code Samples

+ *

Gets the specified certificate issuer in the key vault. Prints out the returned certificate issuer details + * when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.getCertificateIssuer#string} + * + * @param name The name of the certificate to retrieve, cannot be null + * @throws ResourceNotFoundException when a certificate issuer with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException if {@code name} is empty string. + * @return The requested {@link Issuer certificate issuer}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Issuer getCertificateIssuer(String name) { + return getCertificateIssuerWithResponse(name, Context.NONE).getValue(); + } + + /** + * Gets information about the certificate issuer which represents the {@link IssuerBase} from the key vault. This operation + * requires the certificates/manageissuers/getissuers permission. + * + *

The list operations {@link CertificateClient#listCertificateIssuers()} return the {@link PagedIterable} containing + * {@link IssuerBase base issuer} as output excluding the properties like accountId and organization details of the certificate issuer. + * This operation can then be used to get the full certificate issuer with its properties from {@code issuerBase}.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.getCertificateIssuer#issuerBase} + * + * @param issuerBase The {@link IssuerBase base issuer} holding attributes of the certificate issuer being requested. + * @throws ResourceNotFoundException when a certificate with {@link IssuerBase#name() name} doesn't exist in the key vault. + * @throws HttpRequestException if {@link IssuerBase#name() name} is empty string. + * @return The requested {@link Issuer certificate issuer}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Issuer getCertificateIssuer(IssuerBase issuerBase) { + return getCertificateIssuerWithResponse(issuerBase, Context.NONE).getValue(); + } + + /** + * Gets information about the certificate issuer which represents the {@link IssuerBase} from the key vault. This operation + * requires the certificates/manageissuers/getissuers permission. + * + *

The list operations {@link CertificateClient#listCertificateIssuers()} return the {@link PagedIterable} containing + * {@link IssuerBase base issuer} as output excluding the properties like accountId and organization details of the certificate issuer. + * This operation can then be used to get the full certificate issuer with its properties from {@code issuerBase}.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.getCertificateIssuerWithResponse#issuerBase-context} + * + * @param issuerBase The {@link IssuerBase base issuer} holding attributes of the certificate issuer being requested. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws ResourceNotFoundException when a certificate with {@link IssuerBase#name() name} doesn't exist in the key vault. + * @throws HttpRequestException if {@link IssuerBase#name() name} is empty string. + * @return A {@link Response} whose {@link Response#getValue() value} contains the requested {@link Issuer certificate issuer}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getCertificateIssuerWithResponse(IssuerBase issuerBase, Context context) { + return client.getCertificateIssuerWithResponse(issuerBase.name(), context).block(); + } + + /** + * Deletes the specified certificate issuer. The DeleteCertificateIssuer operation permanently removes the specified certificate + * issuer from the key vault. This operation requires the {@code certificates/manageissuers/deleteissuers permission}. + * + *

Code Samples

+ *

Deletes the certificate issuer in the Azure Key Vault. Prints out the + * deleted certificate details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.deleteCertificateIssuerWithResponse#string-context} + * + * @param name The name of the certificate issuer to be deleted. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws ResourceNotFoundException when a certificate issuer with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a certificate issuer with {@code name} is empty string. + * @return A {@link Response} whose {@link Response#getValue() value} contains the {@link Issuer deleted issuer}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteCertificateIssuerWithResponse(String name, Context context) { + return client.deleteCertificateIssuerWithResponse(name, context).block(); + } + + /** + * Deletes the specified certificate issuer. The DeleteCertificateIssuer operation permanently removes the specified certificate + * issuer from the key vault. This operation requires the {@code certificates/manageissuers/deleteissuers permission}. + * + *

Code Samples

+ *

Deletes the certificate issuer in the Azure Key Vault. Prints out the deleted certificate details when a + * response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.deleteCertificateIssuer#string} + * + * @param name The name of the certificate issuer to be deleted. + * @throws ResourceNotFoundException when a certificate issuer with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a certificate issuer with {@code name} is empty string. + * @return The {@link Issuer deleted issuer}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Issuer deleteCertificateIssuer(String name) { + return deleteCertificateIssuerWithResponse(name, Context.NONE).getValue(); + } + + /** + * List all the certificate issuers resources in the key vault. The individual certificate issuer response in the iterable is represented by {@link IssuerBase} + * as only the certificate issuer identifier and provider are provided in the response. This operation requires the + * {@code certificates/manageissuers/getissuers} permission. + * + *

It is possible to get the certificate issuer with all of its properties from this information. Loop over the {@link IssuerBase issuerBase} and + * call {@link CertificateClient#getCertificateIssuer(IssuerBase base issuer)} . This will return the {@link Issuer issuer} + * with all its properties.

. + * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.listCertificateIssuers} + * + * @return A {@link PagedIterable} containing all of the {@link IssuerBase certificate issuers} in the vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCertificateIssuers() { + return listCertificateIssuers(Context.NONE); + } + + /** + * List all the certificate issuers resources in the key vault. The individual certificate issuer response in the iterable is represented by {@link IssuerBase} + * as only the certificate issuer identifier and provider are provided in the response. This operation requires the + * {@code certificates/manageissuers/getissuers} permission. + * + *

It is possible to get the certificate issuer with all of its properties from this information. Loop over the {@link IssuerBase issuerBase} and + * call {@link CertificateClient#getCertificateIssuer(IssuerBase base issuer)} . This will return the {@link Issuer issuer} + * with all its properties.

. + * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.listCertificateIssuers#context} + * + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A {@link PagedIterable} containing all of the {@link IssuerBase certificate issuers} in the vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCertificateIssuers(Context context) { + return new PagedIterable<>(client.listCertificateIssuers(context)); + } + + /** + * Updates the specified certificate issuer. The UpdateCertificateIssuer operation updates the specified attributes of + * the certificate issuer entity. This operation requires the certificates/setissuers permission. + * + *

Code Samples

+ *

Gets the certificate issuer, changes its attributes/properties then updates it in the Azure Key Vault. Prints out the + * returned certificate issuer details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.updateCertificateIssuer#issuer} + * + * @param issuer The {@link Issuer issuer} with updated properties. + * @throws NullPointerException if {@code issuer} is {@code null}. + * @throws ResourceNotFoundException when a certificate issuer with {@link Issuer#name() name} doesn't exist in the key vault. + * @throws HttpRequestException if {@link Issuer#name() name} is empty string. + * @return The {@link Issuer updated issuer}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Issuer updateCertificateIssuer(Issuer issuer) { + return updateCertificateIssuerWithResponse(issuer, Context.NONE).getValue(); + } + + /** + * Updates the specified certificate issuer. The UpdateCertificateIssuer operation updates the specified attributes of + * the certificate issuer entity. This operation requires the certificates/setissuers permission. + * + *

Code Samples

+ *

Gets the certificate issuer, changes its attributes/properties then updates it in the Azure Key Vault. Prints out the + * returned certificate issuer details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.updateCertificateIssuerWithResponse#Issuer-Context} + * + * @param issuer The {@link Issuer issuer} with updated properties. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws NullPointerException if {@code issuer} is {@code null}. + * @throws ResourceNotFoundException when a certificate issuer with {@link Issuer#name() name} doesn't exist in the key vault. + * @throws HttpRequestException if {@link Issuer#name() name} is empty string. + * @return A {@link Response} whose {@link Response#getValue() value} contains the {@link Issuer updated issuer}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateCertificateIssuerWithResponse(Issuer issuer, Context context) { + return client.updateCertificateIssuerWithResponse(issuer, context).block(); + } + + + /** + * Sets the certificate contacts on the key vault. This operation requires the {@code certificates/managecontacts} permission. + * + *

The {@link LifetimeAction} of type {@link LifetimeActionType#EMAIL_CONTACTS} set on a {@link CertificatePolicy} emails the contacts set on the vault when triggered.

+ * + *

Code Samples

+ *

Sets the certificate contacts in the Azure Key Vault. Prints out the returned contacts details.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.setCertificateContacts#contacts} + * + * @param contacts The list of contacts to set on the vault. + * @throws HttpRequestException when a contact information provided is invalid/incomplete. + * @return A {@link PagedIterable} containing all of the {@link Contact certificate contacts} in the vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable setCertificateContacts(List contacts) { + return setCertificateContacts(contacts, Context.NONE); + } + + /** + * Sets the certificate contacts on the key vault. This operation requires the {@code certificates/managecontacts} permission. + * + *

The {@link LifetimeAction} of type {@link LifetimeActionType#EMAIL_CONTACTS} set on a {@link CertificatePolicy} emails the contacts set on the vault when triggered.

+ * + *

Code Samples

+ *

Sets the certificate contacts in the Azure Key Vault. Prints out the returned contacts details.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.setCertificateContacts#contacts-context} + * + * @param contacts The list of contacts to set on the vault. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws HttpRequestException when a contact information provided is invalid/incomplete. + * @return A {@link PagedIterable} containing all of the {@link Contact certificate contacts} in the vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable setCertificateContacts(List contacts, Context context) { + return new PagedIterable<>(client.setCertificateContacts(contacts, context)); + } + + /** + * Lists the certificate contacts in the key vault. This operation requires the certificates/managecontacts permission. + * + *

Code Samples

+ *

Lists the certificate contacts in the Azure Key Vault. Prints out the returned contacts details in the response.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.listCertificateContacts} + * + * @return A {@link PagedIterable} containing all of the {@link Contact certificate contacts} in the vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCertificateContacts() { + return listCertificateContacts(Context.NONE); + } + + + /** + * Lists the certificate contacts in the key vault. This operation requires the certificates/managecontacts permission. + * + *

Code Samples

+ *

Lists the certificate contacts in the Azure Key Vault. Prints out the returned contacts details in the response.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.listCertificateContacts#context} + * + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A {@link PagedIterable} containing all of the {@link Contact certificate contacts} in the vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCertificateContacts(Context context) { + return new PagedIterable<>(client.listCertificateContacts(context)); + } + + /** + * Deletes the certificate contacts in the key vault. This operation requires the {@code certificates/managecontacts} permission. + * + *

Code Samples

+ *

Deletes the certificate contacts in the Azure Key Vault. Subscribes to the call and prints out the + * deleted contacts details.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.deleteCertificateContacts} + * + * @return A {@link PagedIterable} containing all of the deleted {@link Contact certificate contacts} in the vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable deleteCertificateContacts() { + return deleteCertificateContacts(Context.NONE); + } + + /** + * Deletes the certificate contacts in the key vault. This operation requires the {@code certificates/managecontacts} permission. + * + *

Code Samples

+ *

Deletes the certificate contacts in the Azure Key Vault. Prints out the deleted contacts details in the response.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.deleteCertificateContacts#context} + * + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A {@link PagedIterable} containing all of the deleted {@link Contact certificate contacts} in the vault. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable deleteCertificateContacts(Context context) { + return new PagedIterable<>(client.deleteCertificateContacts(context)); + } + + /** + * Deletes the creation operation for the specified certificate that is in the process of being created. The certificate is + * no longer created. This operation requires the {@code certificates/update permission}. + * + *

Code Samples

+ *

Triggers certificate creation and then deletes the certificate creation operation in the Azure Key Vault. Subscribes to the call and prints out the + * deleted certificate operation details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.deleteCertificateOperation#string} + * + * @param certificateName The name of the certificate which is in the process of being created. + * @throws ResourceNotFoundException when a certificate operation for a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when the {@code name} is empty string. + * @return The deleted {@link CertificateOperation certificate operation}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateOperation deleteCertificateOperation(String certificateName) { + return deleteCertificateOperationWithResponse(certificateName, Context.NONE).getValue(); + } + + /** + * Deletes the creation operation for the specified certificate that is in the process of being created. The certificate is + * no longer created. This operation requires the {@code certificates/update permission}. + * + *

Code Samples

+ *

Triggers certificate creation and then deletes the certificate creation operation in the Azure Key Vault. Subscribes to the call and prints out the + * deleted certificate operation details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.deleteCertificateOperationWithResponse#string} + * + * @param certificateName The name of the certificate which is in the process of being created. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws ResourceNotFoundException when a certificate operation for a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when the {@code name} is empty string. + * @return A {@link Response} whose {@link Response#getValue() value} contains the {@link CertificateOperation deleted certificate operation}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteCertificateOperationWithResponse(String certificateName, Context context) { + return client.deleteCertificateOperationWithResponse(certificateName, context).block(); + } + + /** + * Cancels a certificate creation operation that is already in progress. This operation requires the {@code certificates/update} permission. + * + *

Code Samples

+ *

Triggers certificate creation and then cancels the certificate creation operation in the Azure Key Vault. Subscribes to the call and prints out the + * updated certificate operation details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.cancelCertificateOperation#string} + * + * @param certificateName The name of the certificate which is in the process of being created. + * @throws ResourceNotFoundException when a certificate operation for a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when the {@code name} is empty string. + * @return A {@link Response} whose {@link Response#getValue() value} contains the {@link CertificateOperation cancelled certificate operation}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateOperation cancelCertificateOperation(String certificateName) { + return client.cancelCertificateOperationWithResponse(certificateName, Context.NONE).block().getValue(); + } + + + /** + * Cancels a certificate creation operation that is already in progress. This operation requires the {@code certificates/update} permission. + * + *

Code Samples

+ *

Triggers certificate creation and then cancels the certificate creation operation in the Azure Key Vault. Subscribes to the call and prints out the + * updated certificate operation details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.cancelCertificateOperationWithResponse#string} + * + * @param certificateName The name of the certificate which is in the process of being created. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws ResourceNotFoundException when a certificate operation for a certificate with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when the {@code name} is empty string. + * @return A {@link Response} whose {@link Response#getValue() value} contains the {@link CertificateOperation cancelled certificate operation}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelCertificateOperationWithResponse(String certificateName, Context context) { + return client.cancelCertificateOperationWithResponse(certificateName, context).block(); + } + + /** + * Gets the pending certificate signing request for the specified certificate under pending status. + * + *

Code Samples

+ *

Gets the pending signing request of a certificate created with third party issuer. Prints out the + * returned certificate signing request details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.getPendingCertificateSigningRequest#String} + * + * @param certificateName the certificate for whom certifcate signing request is needed + * @return The cerficate signing request blob. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public byte[] getPendingCertificateSigningRequest(String certificateName) { + return getPendingCertificateSigningRequestWithResponse(certificateName, Context.NONE).getValue(); + } + + /** + * Gets the pending certificate signing request for the specified certificate under pending status. + * + *

Code Samples

+ *

Gets the pending signing request of a certificate created with third party issuer. Prints out the + * returned certificate signing request details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.getPendingCertificateSigningRequestWithResponse#String-Context} + * + * @param certificateName the certificate for whom certifcate signing request is needed + * @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 certificate signing request blob. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getPendingCertificateSigningRequestWithResponse(String certificateName, Context context) { + return client.getPendingCertificateSigningRequestWithResponse(certificateName, context).block(); + } + + + /** + * Merges a certificate or a certificate chain with a key pair currently available in the service. This operation requires + * the {@code certificates/create} permission. + * + *

Code Samples

+ *

Merges a certificate with a kay pair available in the service.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.mergeCertificate#String-List} + * + * @param name the name of the certificate. + * @param x509Certificates the certificate or certificate chain to merge. + * @throws HttpRequestException if {@code x509Certificates} is invalid/corrupt or {@code name} is empty. + * @return The merged certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Certificate mergeCertificate(String name, List x509Certificates) { + return client.mergeCertificateWithResponse(name, x509Certificates, Context.NONE).block().getValue(); + } + + /** + * Merges a certificate or a certificate chain with a key pair currently available in the service. This operation requires + * the {@code certificates/create} permission. + * + *

Code Samples

+ *

Merges a certificate with a kay pair available in the service.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.mergeCertificateWithResponse#String-List-Context} + * + * @param name the name of the certificate. + * @param x509Certificates the certificate or certificate chain to merge. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws HttpRequestException if {@code x509Certificates} is invalid/corrupt or {@code name} is empty. + * @return The merged certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response mergeCertificateWithResponse(String name, List x509Certificates, Context context) { + return client.mergeCertificateWithResponse(name, x509Certificates, context).block(); + } + + /** + * Merges a certificate or a certificate chain with a key pair currently available in the service. This operation requires + * the {@code certificates/create} permission. + * + *

Code Samples

+ *

Merges a certificate with a kay pair available in the service.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.mergeCertificate#config} + * + * @param mergeCertificateConfig the merge certificate configuration holding the x509 certificates. + * @throws NullPointerException when {@code mergeCertificateConfig} is null. + * @throws HttpRequestException if {@code mergeCertificateConfig} is invalid/corrupt. + * @return The merged certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Certificate mergeCertificate(MergeCertificateOptions mergeCertificateConfig) { + return mergeCertificateWithResponse(mergeCertificateConfig, Context.NONE).getValue(); + } + + /** + * Merges a certificate or a certificate chain with a key pair currently available in the service. This operation requires + * the {@code certificates/create} permission. + * + *

Code Samples

+ *

Merges a certificate with a kay pair available in the service.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.mergeCertificateWithResponse#config} + * + * @param mergeCertificateConfig the merge certificate configuration holding the x509 certificates. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws NullPointerException when {@code mergeCertificateConfig} is null. + * @throws HttpRequestException if {@code mergeCertificateConfig} is invalid/corrupt. + * @return A {@link Response} whose {@link Response#getValue() value} contains the merged certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response mergeCertificateWithResponse(MergeCertificateOptions mergeCertificateConfig, Context context) { + Objects.requireNonNull(mergeCertificateConfig, "The merge certificate configuration cannot be null"); + return client.mergeCertificateWithResponse(mergeCertificateConfig, context).block(); + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClientBuilder.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClientBuilder.java new file mode 100644 index 000000000000..651fe1f85cce --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClientBuilder.java @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.core.credentials.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.implementation.annotation.ServiceClientBuilder; +import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; +import com.azure.core.implementation.util.ImplUtils; +import com.azure.core.util.configuration.Configuration; +import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.core.util.logging.ClientLogger; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * This class provides a fluent builder API to help aid the configuration and instantiation of the {@link CertificateAsyncClient certificate async client} and {@link CertificateClient certificate sync client}, + * by calling {@link CertificateClientBuilder#buildAsyncClient() buildAsyncClient} and {@link CertificateClientBuilder#buildClient() buildClient} respectively + * It constructs an instance of the desired client. + * + *

The minimal configuration options required by {@link CertificateClientBuilder} to build {@link CertificateAsyncClient} + * are {@link String endpoint} and {@link TokenCredential credential}.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.instantiation} + * + *

The {@link HttpLogDetailLevel log detail level}, multiple custom {@link HttpLoggingPolicy policies} and custom + * {@link HttpClient http client} can be optionally configured in the {@link CertificateClientBuilder}.

+ + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.withhttpclient.instantiation} + * + *

Alternatively, custom {@link HttpPipeline http pipeline} with custom {@link HttpPipelinePolicy} policies and {@link String endpoint} + * can be specified. It provides finer control over the construction of {@link CertificateAsyncClient} and {@link CertificateClient}

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateAsyncClient.pipeline.instantiation} + * + *

The minimal configuration options required by {@link CertificateClientBuilder certificateClientBuilder} to build {@link CertificateClient} + * are {@link String endpoint} and {@link TokenCredential credential}.

+ * + * {@codesnippet com.azure.security.keyvault.certificates.CertificateClient.instantiation} + * + * @see CertificateAsyncClient + * @see CertificateClient + */ +@ServiceClientBuilder(serviceClients = {CertificateClient.class, CertificateAsyncClient.class}) +public final class CertificateClientBuilder { + private final ClientLogger logger = new ClientLogger(CertificateClientBuilder.class); + + private final List policies; + private TokenCredential credential; + private HttpPipeline pipeline; + private URL endpoint; + private HttpClient httpClient; + private HttpLogDetailLevel httpLogDetailLevel; + private final RetryPolicy retryPolicy; + private Configuration configuration; + + /** + * The constructor with defaults. + */ + public CertificateClientBuilder() { + retryPolicy = new RetryPolicy(); + httpLogDetailLevel = HttpLogDetailLevel.NONE; + policies = new ArrayList<>(); + } + + /** + * Creates a {@link CertificateClient} based on options set in the builder. + * Every time {@code buildClient()} is called, a new instance of {@link CertificateClient} is created. + * + *

If {@link CertificateClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and + * {@link CertificateClientBuilder#endpoint(String) serviceEndpoint} are used to create the + * {@link CertificateClientBuilder client}. All other builder settings are ignored. If {@code pipeline} is not set, + * then {@link CertificateClientBuilder#credential(TokenCredential) key vault credential} and + * {@link CertificateClientBuilder#endpoint(String) key vault endpoint} are required to build the {@link CertificateClient client}.

+ * + * @return A {@link CertificateClient} with the options set from the builder. + * @throws IllegalStateException If {@link CertificateClientBuilder#credential(TokenCredential)} or + * {@link CertificateClientBuilder#endpoint(String)} have not been set. + */ + public CertificateClient buildClient() { + return new CertificateClient(buildAsyncClient()); + } + + /** + * Creates a {@link CertificateAsyncClient} based on options set in the builder. + * Every time {@code buildAsyncClient()} is called, a new instance of {@link CertificateAsyncClient} is created. + * + *

If {@link CertificateClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and + * {@link CertificateClientBuilder#endpoint(String) serviceEndpoint} are used to create the + * {@link CertificateClientBuilder client}. All other builder settings are ignored. If {@code pipeline} is not set, + * then {@link CertificateClientBuilder#credential(TokenCredential) key vault credential and + * {@link CertificateClientBuilder#endpoint(String)} key vault endpoint are required to build the {@link CertificateAsyncClient client}.}

+ * + * @return A {@link CertificateAsyncClient} with the options set from the builder. + * @throws IllegalStateException If {@link CertificateClientBuilder#credential(TokenCredential)} or + * {@link CertificateClientBuilder#endpoint(String)} have not been set. + */ + public CertificateAsyncClient buildAsyncClient() { + Configuration buildConfiguration = (configuration == null) ? ConfigurationManager.getConfiguration().clone() : configuration; + URL buildEndpoint = getBuildEndpoint(buildConfiguration); + + if (buildEndpoint == null) { + throw logger.logExceptionAsError(new IllegalStateException(KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.VAULT_END_POINT_REQUIRED))); + } + + if (pipeline != null) { + return new CertificateAsyncClient(endpoint, pipeline); + } + + if (credential == null) { + throw logger.logExceptionAsError(new IllegalStateException(KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.CREDENTIALS_REQUIRED))); + } + + // Closest to API goes first, closest to wire goes last. + final List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(AzureKeyVaultConfiguration.SDK_NAME, AzureKeyVaultConfiguration.SDK_VERSION, buildConfiguration)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new KeyVaultCredentialPolicy(credential)); + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogDetailLevel)); + + HttpPipeline pipeline = new HttpPipelineBuilder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .build(); + + return new CertificateAsyncClient(endpoint, pipeline); + } + + /** + * Sets the vault endpoint url to send HTTP requests to. + * + * @param endpoint The vault endpoint url is used as destination on Azure to send requests to. + * @return the updated ServiceClientBuilder object. + * @throws IllegalArgumentException if {@code endpoint} is null or it cannot be parsed into a valid URL. + */ + public CertificateClientBuilder endpoint(String endpoint) { + try { + this.endpoint = new URL(endpoint); + } catch (MalformedURLException e) { + throw logger.logExceptionAsError(new IllegalArgumentException("The Azure Key Vault endpoint url is malformed.")); + } + return this; + } + + /** + * Sets the credential to use when authenticating HTTP requests. + * + * @param credential The credential to use for authenticating HTTP requests. + * @return the updated {@link CertificateClientBuilder} object. + * @throws NullPointerException if {@code credential} is {@code null}. + */ + public CertificateClientBuilder credential(TokenCredential credential) { + Objects.requireNonNull(credential, "Token credential cannot be null"); + this.credential = credential; + return this; + } + + /** + * Sets the logging level for HTTP requests and responses. + * + *

logLevel is optional. If not provided, default value of {@link HttpLogDetailLevel#NONE} is set.

+ * + * @param logLevel The amount of logging output when sending and receiving HTTP requests/responses. + * @return the updated {@link CertificateClientBuilder} object. + * @throws NullPointerException if {@code logLevel} is {@code null}. + */ + public CertificateClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { + Objects.requireNonNull(logLevel, "Http log detail level cannot be null."); + httpLogDetailLevel = logLevel; + return this; + } + + /** + * Adds a policy to the set of existing policies that are executed after {@link CertificateAsyncClient} and {@link CertificateClient} required policies. + * + * @param policy The {@link HttpPipelinePolicy policy} to be added. + * @return the updated {@link CertificateClientBuilder} object. + * @throws NullPointerException if {@code policy} is {@code null}. + */ + public CertificateClientBuilder addPolicy(HttpPipelinePolicy policy) { + Objects.requireNonNull(policy, "Http pipeline policy cannot be null"); + policies.add(policy); + return this; + } + + /** + * Sets the HTTP client to use for sending and receiving requests to and from the service. + * + * @param client The HTTP client to use for requests. + * @return the updated {@link CertificateClientBuilder} object. + * @throws NullPointerException If {@code client} is {@code null}. + */ + public CertificateClientBuilder httpClient(HttpClient client) { + Objects.requireNonNull(client, "Http client cannot be null."); + this.httpClient = client; + return this; + } + + /** + * Sets the HTTP pipeline to use for the service client. + * + * If {@code pipeline} is set, all other settings are ignored, aside from + * {@link CertificateClientBuilder#endpoint(String) endpoint} to build {@link CertificateClient} or {@link CertificateAsyncClient}. + * + * @param pipeline The HTTP pipeline to use for sending service requests and receiving responses. + * @return the updated {@link CertificateClientBuilder} object. + */ + public CertificateClientBuilder pipeline(HttpPipeline pipeline) { + Objects.requireNonNull(pipeline, "Http Pipeline cannot be null."); + this.pipeline = pipeline; + return this; + } + + /** + * Sets the configuration store that is used during construction of the service client. + * + * The default configuration store is a clone of the {@link ConfigurationManager#getConfiguration() global + * configuration store}, use {@link Configuration#NONE} to bypass using configuration settings during construction. + * + * @param configuration The configuration store used to + * @return The updated CertificateClientBuilder object. + */ + public CertificateClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + private URL getBuildEndpoint(Configuration configuration) { + if (endpoint != null) { + return endpoint; + } + + String configEndpoint = configuration.get("AZURE_KEYVAULT_ENDPOINT"); + if (ImplUtils.isNullOrEmpty(configEndpoint)) { + return null; + } + + try { + return new URL(configEndpoint); + } catch (MalformedURLException ex) { + return null; + } + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateImportParameters.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateImportParameters.java new file mode 100644 index 000000000000..c74f15133d36 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateImportParameters.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.security.keyvault.certificates.models.CertificatePolicy; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Map; + +/** + * The certificate import parameters. + */ +class CertificateImportParameters { + /** + * Base64 encoded representation of the certificate object to import. This + * certificate needs to contain the private key. + */ + @JsonProperty(value = "value", required = true) + private String base64EncodedCertificate; + + /** + * If the private key in base64EncodedCertificate is encrypted, the + * password used for encryption. + */ + @JsonProperty(value = "pwd") + private String password; + + /** + * The management policy for the certificate. + */ + @JsonProperty(value = "policy") + private CertificatePolicy certificatePolicy; + + /** + * The attributes of the certificate (optional). + */ + @JsonProperty(value = "attributes") + private CertificateRequestAttributes certificateAttributes; + + /** + * Application specific metadata in the form of key-value pairs. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the base64EncodedCertificate value. + * + * @return the base64EncodedCertificate value + */ + String base64EncodedCertificate() { + return this.base64EncodedCertificate; + } + + /** + * Set the base64EncodedCertificate value. + * + * @param base64EncodedCertificate the base64EncodedCertificate value to set + * @return the CertificateImportParameters object itself. + */ + CertificateImportParameters base64EncodedCertificate(String base64EncodedCertificate) { + this.base64EncodedCertificate = base64EncodedCertificate; + return this; + } + + /** + * Get the password value. + * + * @return the password value + */ + String password() { + return this.password; + } + + /** + * Set the password value. + * + * @param password the password value to set + * @return the CertificateImportParameters object itself. + */ + CertificateImportParameters password(String password) { + this.password = password; + return this; + } + + /** + * Get the certificatePolicy value. + * + * @return the certificatePolicy value + */ + CertificatePolicy certificatePolicy() { + return this.certificatePolicy; + } + + /** + * Set the certificatePolicy value. + * + * @param certificatePolicy the certificatePolicy value to set + * @return the CertificateImportParameters object itself. + */ + CertificateImportParameters certificatePolicy(CertificatePolicy certificatePolicy) { + this.certificatePolicy = certificatePolicy; + return this; + } + + /** + * Get the certificateAttributes value. + * + * @return the certificateAttributes value + */ + CertificateRequestAttributes certificateAttributes() { + return this.certificateAttributes; + } + + /** + * Set the certificateAttributes value. + * + * @param certificateAttributes the certificateAttributes value to set + * @return the CertificateImportParameters object itself. + */ + CertificateImportParameters certificateAttributes(CertificateRequestAttributes certificateAttributes) { + this.certificateAttributes = certificateAttributes; + return this; + } + + /** + * Get the tags value. + * + * @return the tags value + */ + Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the CertificateImportParameters object itself. + */ + CertificateImportParameters tags(Map tags) { + this.tags = tags; + return this; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateIssuerSetParameters.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateIssuerSetParameters.java new file mode 100644 index 000000000000..9ff6d192bb03 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateIssuerSetParameters.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The certificate issuer set parameters. + */ +class CertificateIssuerSetParameters { + /** + * The issuer provider. + */ + @JsonProperty(value = "provider", required = true) + private String provider; + + /** + * The credentials to be used for the issuer. + */ + @JsonProperty(value = "credentials") + private IssuerCredentials credentials; + + /** + * Details of the organization as provided to the issuer. + */ + @JsonProperty(value = "org_details") + private OrganizationDetails organizationDetails; + + /** + * Attributes of the issuer object. + */ + @JsonProperty(value = "attributes") + private IssuerAttributes attributes; + + /** + * Get the provider value. + * + * @return the provider value + */ + String provider() { + return this.provider; + } + + /** + * Set the provider value. + * + * @param provider the provider value to set + * @return the CertificateIssuerSetParameters object itself. + */ + CertificateIssuerSetParameters provider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the credentials value. + * + * @return the credentials value + */ + IssuerCredentials credentials() { + return this.credentials; + } + + /** + * Set the credentials value. + * + * @param credentials the credentials value to set + * @return the CertificateIssuerSetParameters object itself. + */ + CertificateIssuerSetParameters credentials(IssuerCredentials credentials) { + this.credentials = credentials; + return this; + } + + /** + * Get the organizationDetails value. + * + * @return the organizationDetails value + */ + OrganizationDetails organizationDetails() { + return this.organizationDetails; + } + + /** + * Set the organizationDetails value. + * + * @param organizationDetails the organizationDetails value to set + * @return the CertificateIssuerSetParameters object itself. + */ + CertificateIssuerSetParameters organizationDetails(OrganizationDetails organizationDetails) { + this.organizationDetails = organizationDetails; + return this; + } + + /** + * Get the attributes value. + * + * @return the attributes value + */ + IssuerAttributes attributes() { + return this.attributes; + } + + /** + * Set the attributes value. + * + * @param attributes the attributes value to set + * @return the CertificateIssuerSetParameters object itself. + */ + CertificateIssuerSetParameters attributes(IssuerAttributes attributes) { + this.attributes = attributes; + return this; + } + +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateIssuerUpdateParameters.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateIssuerUpdateParameters.java new file mode 100644 index 000000000000..7af1fa514d78 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateIssuerUpdateParameters.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The certificate issuer update parameters. + */ +class CertificateIssuerUpdateParameters { + /** + * The issuer provider. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * The credentials to be used for the issuer. + */ + @JsonProperty(value = "credentials") + private IssuerCredentials credentials; + + /** + * Details of the organization as provided to the issuer. + */ + @JsonProperty(value = "org_details") + private OrganizationDetails organizationDetails; + + /** + * Attributes of the issuer object. + */ + @JsonProperty(value = "attributes") + private IssuerAttributes attributes; + + /** + * Get the provider value. + * + * @return the provider value + */ + String provider() { + return this.provider; + } + + /** + * Set the provider value. + * + * @param provider the provider value to set + * @return the CertificateIssuerUpdateParameters object itself. + */ + CertificateIssuerUpdateParameters provider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the credentials value. + * + * @return the credentials value + */ + IssuerCredentials credentials() { + return this.credentials; + } + + /** + * Set the credentials value. + * + * @param credentials the credentials value to set + * @return the CertificateIssuerUpdateParameters object itself. + */ + CertificateIssuerUpdateParameters credentials(IssuerCredentials credentials) { + this.credentials = credentials; + return this; + } + + /** + * Get the organizationDetails value. + * + * @return the organizationDetails value + */ + OrganizationDetails organizationDetails() { + return this.organizationDetails; + } + + /** + * Set the organizationDetails value. + * + * @param organizationDetails the organizationDetails value to set + * @return the CertificateIssuerUpdateParameters object itself. + */ + CertificateIssuerUpdateParameters organizationDetails(OrganizationDetails organizationDetails) { + this.organizationDetails = organizationDetails; + return this; + } + + /** + * Get the attributes value. + * + * @return the attributes value + */ + IssuerAttributes attributes() { + return this.attributes; + } + + /** + * Set the attributes value. + * + * @param attributes the attributes value to set + * @return the CertificateIssuerUpdateParameters object itself. + */ + CertificateIssuerUpdateParameters attributes(IssuerAttributes attributes) { + this.attributes = attributes; + return this; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateMergeParameters.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateMergeParameters.java new file mode 100644 index 000000000000..e852289bed9a --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateMergeParameters.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; +import java.util.Map; + +/** + * The certificate merge parameters. + */ +class CertificateMergeParameters { + /** + * The certificate or the certificate chain to merge. + */ + @JsonProperty(value = "x5c", required = true) + private List x509Certificates; + + /** + * The attributes of the certificate (optional). + */ + @JsonProperty(value = "attributes") + private CertificateRequestAttributes certificateAttributes; + + /** + * Application specific metadata in the form of key-value pairs. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the x509Certificates value. + * + * @return the x509Certificates value + */ + List x509Certificates() { + return this.x509Certificates; + } + + /** + * Set the x509Certificates value. + * + * @param x509Certificates the x509Certificates value to set + * @return the CertificateMergeParameters object itself. + */ + CertificateMergeParameters x509Certificates(List x509Certificates) { + this.x509Certificates = x509Certificates; + return this; + } + + /** + * Get the certificateAttributes value. + * + * @return the certificateAttributes value + */ + CertificateRequestAttributes certificateAttributes() { + return this.certificateAttributes; + } + + /** + * Set the certificateAttributes value. + * + * @param certificateAttributes the certificateAttributes value to set + * @return the CertificateMergeParameters object itself. + */ + CertificateMergeParameters certificateAttributes(CertificateRequestAttributes certificateAttributes) { + this.certificateAttributes = certificateAttributes; + return this; + } + + /** + * Get the tags value. + * + * @return the tags value + */ + Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the CertificateMergeParameters object itself. + */ + CertificateMergeParameters tags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateOperationUpdateParameter.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateOperationUpdateParameter.java new file mode 100644 index 000000000000..e9cadc02780e --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateOperationUpdateParameter.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The certificate operation update parameters. + */ +class CertificateOperationUpdateParameter { + /** + * Indicates if cancellation was requested on the certificate operation. + */ + @JsonProperty(value = "cancellation_requested", required = true) + private boolean cancellationRequested; + + /** + * Get the cancellationRequested value. + * + * @return the cancellationRequested value + */ + boolean cancellationRequested() { + return this.cancellationRequested; + } + + /** + * Set the cancellationRequested value. + * + * @param cancellationRequested the cancellationRequested value to set + * @return the CertificateOperationUpdateParameter object itself. + */ + CertificateOperationUpdateParameter cancellationRequested(boolean cancellationRequested) { + this.cancellationRequested = cancellationRequested; + return this; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificatePolicyRequest.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificatePolicyRequest.java new file mode 100644 index 000000000000..295f42fca5c2 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificatePolicyRequest.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.security.keyvault.certificates.models.CertificatePolicy; +import com.azure.security.keyvault.certificates.models.LifetimeAction; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.ArrayList; +import java.util.List; + +/** + * Management policy for a certificate. + */ +class CertificatePolicyRequest { + + CertificatePolicyRequest(CertificatePolicy certificatePolicy) { + this.keyProperties = new KeyProperties(certificatePolicy); + this.x509CertificateProperties = new X509CertificateProperties(certificatePolicy); + this.secretProperties = certificatePolicy.secretContentType() != null ? new SecretProperties(certificatePolicy.secretContentType().toString()) : null; + this.issuerParameters = new IssuerParameters(certificatePolicy); + this.lifetimeActionRequests = certificatePolicy.lifetimeActions() != null ? parseLifeTimeActions(certificatePolicy.lifetimeActions()) : null; + this.attributes = new CertificateRequestAttributes().enabled(certificatePolicy.enabled()); + } + + private List parseLifeTimeActions(List input) { + List output = new ArrayList<>(); + for (LifetimeAction action : input) { + output.add(new LifetimeActionRequest(action)); + } + return output; + } + + /** + * The certificate id. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Properties of the key backing a certificate. + */ + @JsonProperty(value = "key_props") + private KeyProperties keyProperties; + + /** + * Properties of the secret backing a certificate. + */ + @JsonProperty(value = "secret_props") + private SecretProperties secretProperties; + + /** + * Properties of the X509 component of a certificate. + */ + @JsonProperty(value = "x509_props") + private X509CertificateProperties x509CertificateProperties; + + /** + * Actions that will be performed by Key Vault over the lifetime of a + * certificate. + */ + @JsonProperty(value = "lifetime_actions") + private List lifetimeActionRequests; + + /** + * Parameters for the issuer of the X509 component of a certificate. + */ + @JsonProperty(value = "issuer") + private IssuerParameters issuerParameters; + + /** + * The certificate attributes. + */ + @JsonProperty(value = "attributes") + private CertificateRequestAttributes attributes; + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the keyProperties value. + * + * @return the keyProperties value + */ + KeyProperties keyProperties() { + return this.keyProperties; + } + + /** + * Set the keyProperties value. + * + * @param keyProperties the keyProperties value to set + * @return the CertificatePolicyRequest object itself. + */ + CertificatePolicyRequest keyProperties(KeyProperties keyProperties) { + this.keyProperties = keyProperties; + return this; + } + + /** + * Get the secretProperties value. + * + * @return the secretProperties value + */ + SecretProperties secretProperties() { + return this.secretProperties; + } + + /** + * Set the secretProperties value. + * + * @param secretProperties the secretProperties value to set + * @return the CertificatePolicyRequest object itself. + */ + CertificatePolicyRequest secretProperties(SecretProperties secretProperties) { + this.secretProperties = secretProperties; + return this; + } + + /** + * Get the x509CertificateProperties value. + * + * @return the x509CertificateProperties value + */ + X509CertificateProperties x509CertificateProperties() { + return this.x509CertificateProperties; + } + + /** + * Set the x509CertificateProperties value. + * + * @param x509CertificateProperties the x509CertificateProperties value to set + * @return the CertificatePolicyRequest object itself. + */ + CertificatePolicyRequest x509CertificateProperties(X509CertificateProperties x509CertificateProperties) { + this.x509CertificateProperties = x509CertificateProperties; + return this; + } + + /** + * Get the lifetimeActionRequests value. + * + * @return the lifetimeActionRequests value + */ + List lifetimeActions() { + return this.lifetimeActionRequests; + } + + /** + * Set the lifetimeActionRequests value. + * + * @param lifetimeActionRequests the lifetimeActionRequests value to set + * @return the CertificatePolicyRequest object itself. + */ + CertificatePolicyRequest lifetimeActions(List lifetimeActionRequests) { + this.lifetimeActionRequests = lifetimeActionRequests; + return this; + } + + /** + * Get the issuerParameters value. + * + * @return the issuerParameters value + */ + IssuerParameters issuerParameters() { + return this.issuerParameters; + } + + /** + * Set the issuerParameters value. + * + * @param issuerParameters the issuerParameters value to set + * @return the CertificatePolicyRequest object itself. + */ + CertificatePolicyRequest issuerParameters(IssuerParameters issuerParameters) { + this.issuerParameters = issuerParameters; + return this; + } + + /** + * Get the attributes value. + * + * @return the attributes value + */ + CertificateRequestAttributes attributes() { + return this.attributes; + } + + /** + * Set the attributes value. + * + * @param attributes the attributes value to set + * @return the CertificatePolicyRequest object itself. + */ + CertificatePolicyRequest attributes(CertificateRequestAttributes attributes) { + this.attributes = attributes; + return this; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateRequestAttributes.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateRequestAttributes.java new file mode 100644 index 000000000000..b6a30f70eb03 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateRequestAttributes.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.security.keyvault.certificates.models.CertificateBase; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; + +/** + * The object attributes managed by the Secret service. + */ +class CertificateRequestAttributes { + + /** + * Creates an instance of SecretRequestAttributes. Reads secretBase.notBefore, secretBase.expires and secretBase.enabled fields + * from {@code secretBase} + * @param certificateBase the {@link CertificateBase} object with populated attributes + */ + CertificateRequestAttributes(CertificateBase certificateBase) { + if (certificateBase.notBefore() != null) { + this.notBefore = certificateBase.notBefore().toEpochSecond(); + } + if (certificateBase.expires() != null) { + this.expires = certificateBase.expires().toEpochSecond(); + } + this.enabled = certificateBase.enabled(); + } + + CertificateRequestAttributes() { + + } + + /** + * The secret value. + */ + @JsonProperty(value = "value") + private String value; + + /** + * The secret id. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Determines whether the object is enabled. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /** + * Not before date in UTC. + */ + @JsonProperty(value = "nbf") + private Long notBefore; + + /** + * Expiry date in UTC. + */ + @JsonProperty(value = "exp") + private Long expires; + + /** + * Creation time in UTC. + */ + @JsonProperty(value = "created", access = JsonProperty.Access.WRITE_ONLY) + private Long created; + + /** + * Last updated time in UTC. + */ + @JsonProperty(value = "updated", access = JsonProperty.Access.WRITE_ONLY) + private Long updated; + + /** + * Get the enabled value. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled value. + * + * @param enabled the enabled value to set + * @return the Attributes object itself. + */ + CertificateRequestAttributes enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the notBefore value. + * + * @return the notBefore value + */ + OffsetDateTime notBefore() { + if (this.notBefore == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochMilli(this.notBefore * 1000L), ZoneOffset.UTC); + } + + /** + * Set the notBefore value. + * + * @param notBefore the notBefore value to set + * @return the Attributes object itself. + */ + CertificateRequestAttributes notBefore(OffsetDateTime notBefore) { + if (notBefore == null) { + this.notBefore = null; + } else { + this.notBefore = OffsetDateTime.ofInstant(notBefore.toInstant(), ZoneOffset.UTC).toEpochSecond(); + } + return this; + } + + /** + * Get the expires value. + * + * @return the expires value + */ + OffsetDateTime expires() { + if (this.expires == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochMilli(this.expires * 1000L), ZoneOffset.UTC); + } + + /** + * Set the expires value. + * + * @param expires the expires value to set + * @return the Attributes object itself. + */ + CertificateRequestAttributes expires(OffsetDateTime expires) { + if (expires == null) { + this.expires = null; + } else { + this.expires = OffsetDateTime.ofInstant(expires.toInstant(), ZoneOffset.UTC).toEpochSecond(); + } + return this; + } + + /** + * Get the created value. + * + * @return the created value + */ + OffsetDateTime created() { + if (this.created == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochMilli(this.created * 1000L), ZoneOffset.UTC); + } + + /** + * Get the updated value. + * + * @return the updated value + */ + OffsetDateTime updated() { + if (this.updated == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochMilli(this.updated * 1000L), ZoneOffset.UTC); + } + +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateRequestParameters.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateRequestParameters.java new file mode 100644 index 000000000000..d77e01086721 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateRequestParameters.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Map; + +/** + * The certificate create parameters. + */ +class CertificateRequestParameters { + /** + * The management policy for the certificate. + */ + @JsonProperty(value = "policy") + private CertificatePolicyRequest certificatePolicyRequest; + + /** + * The attributes of the certificate (optional). + */ + @JsonProperty(value = "attributes") + private CertificateRequestAttributes certificateAttributes; + + /** + * Application specific metadata in the form of key-value pairs. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the certificatePolicyRequest value. + * + * @return the certificatePolicyRequest value + */ + CertificatePolicyRequest certificatePolicy() { + return this.certificatePolicyRequest; + } + + /** + * Set the certificatePolicyRequest value. + * + * @param certificatePolicyRequest the certificatePolicyRequest value to set + * @return the CertificateCreateParameters object itself. + */ + CertificateRequestParameters certificatePolicy(CertificatePolicyRequest certificatePolicyRequest) { + this.certificatePolicyRequest = certificatePolicyRequest; + return this; + } + + /** + * Get the certificateAttributes value. + * + * @return the certificateAttributes value + */ + CertificateRequestAttributes certificateAttributes() { + return this.certificateAttributes; + } + + /** + * Set the certificateAttributes value. + * + * @param certificateAttributes the certificateAttributes value to set + * @return the CertificateCreateParameters object itself. + */ + CertificateRequestParameters certificateAttributes(CertificateRequestAttributes certificateAttributes) { + this.certificateAttributes = certificateAttributes; + return this; + } + + /** + * Get the tags value. + * + * @return the tags value + */ + Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the CertificateCreateParameters object itself. + */ + CertificateRequestParameters tags(Map tags) { + this.tags = tags; + return this; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateRestoreParameters.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateRestoreParameters.java new file mode 100644 index 000000000000..5335a023e677 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateRestoreParameters.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.core.implementation.Base64Url; + +/** + * The certificate restore parameters. + */ +class CertificateRestoreParameters { + /** + * The backup blob associated with a certificate bundle. + */ + @JsonProperty(value = "value", required = true) + private Base64Url certificateBundleBackup; + + /** + * Get the certificateBundleBackup value. + * + * @return the certificateBundleBackup value + */ + public byte[] certificateBundleBackup() { + if (this.certificateBundleBackup == null) { + return new byte[0]; + } + return this.certificateBundleBackup.decodedBytes(); + } + + /** + * Set the certificateBundleBackup value. + * + * @param certificateBundleBackup the certificateBundleBackup value to set + * @return the CertificateRestoreParameters object itself. + */ + CertificateRestoreParameters certificateBundleBackup(byte[] certificateBundleBackup) { + if (certificateBundleBackup == null) { + this.certificateBundleBackup = null; + } else { + this.certificateBundleBackup = Base64Url.encode(certificateBundleBackup); + } + return this; + } + +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateService.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateService.java new file mode 100644 index 000000000000..a071f995fde8 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateService.java @@ -0,0 +1,403 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.VoidResponse; +import com.azure.core.implementation.annotation.BodyParam; +import com.azure.core.implementation.annotation.Delete; +import com.azure.core.implementation.annotation.ExpectedResponses; +import com.azure.core.implementation.annotation.Get; +import com.azure.core.implementation.annotation.HeaderParam; +import com.azure.core.implementation.annotation.Host; +import com.azure.core.implementation.annotation.HostParam; +import com.azure.core.implementation.annotation.Patch; +import com.azure.core.implementation.annotation.Post; +import com.azure.core.implementation.annotation.Put; +import com.azure.core.implementation.annotation.PathParam; +import com.azure.core.implementation.annotation.QueryParam; +import com.azure.core.implementation.annotation.ReturnValueWireType; +import com.azure.core.implementation.annotation.ServiceInterface; +import com.azure.core.implementation.annotation.UnexpectedResponseExceptionType; +import com.azure.core.util.Context; +import com.azure.security.keyvault.certificates.implementation.CertificateBasePage; +import com.azure.security.keyvault.certificates.implementation.ContactPage; +import com.azure.security.keyvault.certificates.implementation.DeletedCertificatePage; +import com.azure.security.keyvault.certificates.implementation.IssuerBasePage; +import com.azure.security.keyvault.certificates.models.Certificate; +import com.azure.security.keyvault.certificates.models.CertificateBase; +import com.azure.security.keyvault.certificates.models.CertificateOperation; +import com.azure.security.keyvault.certificates.models.DeletedCertificate; +import com.azure.security.keyvault.certificates.models.Contact; +import com.azure.security.keyvault.certificates.models.Issuer; +import com.azure.security.keyvault.certificates.models.IssuerBase; +import com.azure.security.keyvault.certificates.models.CertificatePolicy; +import reactor.core.publisher.Mono; + +/** + * The interface defining all the services for {@link CertificateAsyncClient} to be used + * by the proxy service to perform REST calls. + * + * This is package-private so that these REST calls are transparent to the user. + */ +@Host("{url}") +@ServiceInterface(name = "KeyVault") +interface CertificateService { + + @Post("certificates/{certificate-name}/create") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(code = {400}, value = ResourceModifiedException.class) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createCertificate(@HostParam("url") String url, + @PathParam("certificate-name") String certificateName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @BodyParam("body") CertificateRequestParameters parameters, + @HeaderParam("Content-Type") String type, + Context context); + + @Get("certificates/{certificate-name}/pending") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(code = {400}, value = ResourceModifiedException.class) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getCertificateOperation(@HostParam("url") String url, + @PathParam("certificate-name") String certificateName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Content-Type") String type, + Context context); + + @Patch("certificates/{certificate-name}/pending") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(code = {400}, value = ResourceModifiedException.class) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> updateCertificateOperation(@HostParam("url") String url, + @PathParam("certificate-name") String certificateName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @BodyParam("application/json") CertificateOperationUpdateParameter properties, + @HeaderParam("Content-Type") String type, + Context context); + @Delete("certificates/{certificate-name}/pending") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(code = {400}, value = ResourceModifiedException.class) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono>deletetCertificateOperation(@HostParam("url") String url, + @PathParam("certificate-name") String certificateName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Content-Type") String type, + Context context); + + @Get("certificates/{certificate-name}/{certificate-version}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(code = {404}, value = ResourceNotFoundException.class) + @UnexpectedResponseExceptionType(code = {403}, value = ResourceModifiedException.class) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getCertificate(@HostParam("url") String url, + @PathParam("certificate-name") String certificateName, + @PathParam("certificate-version") String certificateVersion, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Content-Type") String type, + Context context); + + + + @Get("certificates") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + @ReturnValueWireType(CertificateBasePage.class) + Mono> getCertificates(@HostParam("url") String url, + @QueryParam("maxresults") Integer maxresults, + @QueryParam("includePending") Boolean includePending, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Content-Type") String type, + Context context); + + + + @Get("{nextUrl}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + @ReturnValueWireType(CertificateBasePage.class) + Mono> getCertificates(@HostParam("url") String url, + @PathParam(value = "nextUrl", encoded = true) String nextUrl, + @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Content-Type") String type, + Context context); + + @Delete("certificates/{certificate-name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(code = {404}, value = ResourceNotFoundException.class) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteCertificate(@HostParam("url") String url, + @PathParam("certificate-name") String certificateName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Content-Type") String type, + Context context); + + @Patch("certificates/{certificate-name}/{certificate-version}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(code = {500}, value = HttpResponseException.class) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> updateCertificate(@HostParam("url") String url, + @PathParam("certificate-name") String certificateName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @BodyParam("body") CertificateUpdateParameters properties, + @HeaderParam("Content-Type") String type, + Context context); + + + @Get("deletedcertificates/{certificate-name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(code = {404}, value = ResourceNotFoundException.class) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDeletedCertificate(@HostParam("url") String url, + @PathParam("certificate-name") String certificateName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Content-Type") String type, + Context context); + + @Delete("deletedcertificates/{certificate-name}") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(code = {404}, value = ResourceNotFoundException.class) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono purgeDeletedcertificate(@HostParam("url") String url, + @PathParam("certificate-name") String certificateName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Content-Type") String type, + Context context); + + @Post("deletedcertificates/{certificate-name}/recover") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(code = {404}, value = ResourceNotFoundException.class) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> recoverDeletedCertificate(@HostParam("url") String url, + @PathParam("certificate-name") String certificateName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Content-Type") String type, + Context context); + + + @Post("certificates/{certificate-name}/backup") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(code = {404}, value = ResourceNotFoundException.class) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> backupCertificate(@HostParam("url") String url, + @PathParam("certificate-name") String certificateName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Content-Type") String type, + Context context); + + + @Post("certificates/restore") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(code = {400}, value = ResourceModifiedException.class) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> restoreCertificate(@HostParam("url") String url, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @BodyParam("application/json") CertificateRestoreParameters parameters, + @HeaderParam("Content-Type") String type, + Context context); + + @Get("deletedsecrets") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + @ReturnValueWireType(DeletedCertificatePage.class) + Mono> getDeletedCertificates(@HostParam("url") String url, + @QueryParam("maxresults") Integer maxresults, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Content-Type") String type, + Context context); + + @Get("{nextUrl}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + @ReturnValueWireType(DeletedCertificatePage.class) + Mono> getDeletedCertificates(@HostParam("url") String url, + @PathParam(value = "nextUrl", encoded = true) String nextUrl, + @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Content-Type") String type, + Context context); + + @Put("certificates/contacts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + @ReturnValueWireType(ContactPage.class) + Mono> setCertificateContacts(@HostParam("url") String url, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @BodyParam("application/json") Contacts contacts, + @HeaderParam("Content-Type") String type, + Context context); + + @Get("certificates/contacts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + @ReturnValueWireType(ContactPage.class) + Mono> getCertificateContacts(@HostParam("url") String url, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Content-Type") String type, + Context context); + + @Delete("certificates/contacts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + @ReturnValueWireType(ContactPage.class) + Mono> deleteCertificateContacts(@HostParam("url") String url, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Content-Type") String type, + Context context); + + @Put("certificates/issuers/{issuer-name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> setCertificateIssuer(@HostParam("url") String url, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @PathParam("issuer-name") String issuerName, + @BodyParam("application/json") CertificateIssuerSetParameters parameter, + @HeaderParam("Content-Type") String type, + Context context); + + + @Get("certificates/issuers/{issuer-name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getCertificateIssuer(@HostParam("url") String url, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @PathParam("issuer-name") String issuerName, + @HeaderParam("Content-Type") String type, + Context context); + + + @Delete("certificates/issuers/{issuer-name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(code = {404}, value = ResourceNotFoundException.class) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteCertificateIssuer(@HostParam("url") String url, + @PathParam("issuer-name") String issuerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Content-Type") String type, + Context context); + + @Patch("certificates/issuers/{issuer-name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(code = {500}, value = HttpResponseException.class) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> updateCertificateIssuer(@HostParam("url") String url, + @PathParam("issuer-name") String issuerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @BodyParam("body") CertificateIssuerUpdateParameters properties, + @HeaderParam("Content-Type") String type, + Context context); + + @Get("certificates/Issuers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + @ReturnValueWireType(IssuerBasePage.class) + Mono> getCertificateIssuers(@HostParam("url") String url, + @QueryParam("maxresults") Integer maxresults, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Content-Type") String type, + Context context); + + + @Get("{nextUrl}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + @ReturnValueWireType(IssuerBasePage.class) + Mono> getCertificateIssuers(@HostParam("url") String url, + @PathParam(value = "nextUrl", encoded = true) String nextUrl, + @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Content-Type") String type, + Context context); + + + @Get("certificates/{certificate-name}/versions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + @ReturnValueWireType(CertificateBasePage.class) + Mono> getCertificateVersions(@HostParam("url") String url, + @PathParam("certificate-name") String certificateName, + @QueryParam("maxresults") Integer maxresults, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Content-Type") String type, + Context context); + + + @Post("certificates/{certificate-name}/import") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> importCertificate(@HostParam("url") String url, + @PathParam("certificate-name") String certificateName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @BodyParam("application/json") CertificateImportParameters parameters, + @HeaderParam("Content-Type") String type, + Context context); + + @Post("certificates/{certificate-name}/pending/merge") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> mergeCertificate(@HostParam("url") String url, + @PathParam("certificate-name") String certificateName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @BodyParam("application/json") CertificateMergeParameters parameters, + @HeaderParam("Content-Type") String type, + Context context); + + @Get("certificates/{certificate-name}/policy") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getCertificatePolicy(@HostParam("url") String url, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @PathParam("certificate-name") String certificateName, + @HeaderParam("Content-Type") String type, + Context context); + + @Patch("certificates/{certificate-name}/policy") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> updateCertificatePolicy(@HostParam("url") String url, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @PathParam("certificate-name") String certificateName, + @BodyParam("application/json") CertificatePolicyRequest certificatePolicyRequest, + @HeaderParam("Content-Type") String type, + Context context); + + @Get("certificates/{certificate-name}/pending") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getPendingCertificateSigningRequest(@HostParam("url") String url, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @PathParam("certificate-name") String certificateName, + @HeaderParam("Content-Type") String type, + Context context); +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateUpdateParameters.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateUpdateParameters.java new file mode 100644 index 000000000000..528422fd79d4 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateUpdateParameters.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Map; + +/** + * The certificate update parameters. + */ +class CertificateUpdateParameters { + + /** + * The attributes of the certificate (optional). + */ + @JsonProperty(value = "attributes") + private CertificateRequestAttributes certificateAttributes; + + /** + * Application specific metadata in the form of key-value pairs. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the certificateAttributes value. + * + * @return the certificateAttributes value + */ + CertificateRequestAttributes certificateAttributes() { + return this.certificateAttributes; + } + + /** + * Set the certificateAttributes value. + * + * @param certificateAttributes the certificateAttributes value to set + * @return the CertificateUpdateParameters object itself. + */ + CertificateUpdateParameters certificateAttributes(CertificateRequestAttributes certificateAttributes) { + this.certificateAttributes = certificateAttributes; + return this; + } + + /** + * Get the tags value. + * + * @return the tags value + */ + Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the CertificateUpdateParameters object itself. + */ + CertificateUpdateParameters tags(Map tags) { + this.tags = tags; + return this; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/Contacts.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/Contacts.java new file mode 100644 index 000000000000..6182cf75f272 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/Contacts.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.security.keyvault.certificates.models.Contact; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +/** + * The contacts for the vault certificates. + */ +class Contacts { + /** + * Identifier for the contacts collection. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The contact list for the vault certificates. + */ + @JsonProperty(value = "contacts") + private List contactList; + + /** + * Get the id value. + * + * @return the id value + */ + String id() { + return this.id; + } + + /** + * Get the contactList value. + * + * @return the contactList value + */ + List contactList() { + return this.contactList; + } + + /** + * Set the contactList value. + * + * @param contactList the contactList value to set + * @return the Contacts object itself. + */ + Contacts contactList(List contactList) { + this.contactList = contactList; + return this; + } + +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/IssuerAttributes.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/IssuerAttributes.java new file mode 100644 index 000000000000..9eabf4c68fae --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/IssuerAttributes.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.time.OffsetDateTime; + +/** + * The attributes of an issuer managed by the Key Vault service. + */ +class IssuerAttributes { + /** + * Determines whether the issuer is enabled. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /** + * Creation time in UTC. + */ + @JsonProperty("created") + private OffsetDateTime created; + + /** + * Last updated time in UTC. + */ + @JsonProperty("updated") + private OffsetDateTime updated; + + /** + * Get the enabled value. + * + * @return the enabled value + */ + Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled value. + * + * @param enabled the enabled value to set + * @return the IssuerAttributes object itself. + */ + IssuerAttributes enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the created UTC time. + * + * @return the created value + */ + OffsetDateTime created() { + return created; + } + + /** + * Get the updated UTC time. + * + * @return the updated UTC time. + */ + OffsetDateTime updated() { + return updated; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/IssuerCredentials.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/IssuerCredentials.java new file mode 100644 index 000000000000..ff583bb38cc6 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/IssuerCredentials.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The credentials to be used for the certificate issuer. + */ +class IssuerCredentials { + /** + * The user name/account name/account id. + */ + @JsonProperty(value = "account_id") + private String accountId; + + /** + * The password/secret/account key. + */ + @JsonProperty(value = "pwd") + private String password; + + /** + * Get the accountId value. + * + * @return the accountId value + */ + String accountId() { + return this.accountId; + } + + /** + * Set the accountId value. + * + * @param accountId the accountId value to set + * @return the IssuerCredentials object itself. + */ + IssuerCredentials accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Get the password value. + * + * @return the password value + */ + String password() { + return this.password; + } + + /** + * Set the password value. + * + * @param password the password value to set + * @return the IssuerCredentials object itself. + */ + IssuerCredentials password(String password) { + this.password = password; + return this; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/IssuerParameters.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/IssuerParameters.java new file mode 100644 index 000000000000..6c120744e391 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/IssuerParameters.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.security.keyvault.certificates.models.CertificatePolicy; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters for the issuer of the X509 component of a certificate. + */ +class IssuerParameters { + + IssuerParameters() { + + } + + IssuerParameters(CertificatePolicy certificateBase) { + this.name = certificateBase.issuerName(); + this.certificateType = certificateBase.issuerCertificateTypeRequest(); + this.certificateTransparency = certificateBase.certificateTransparency(); + } + /** + * Name of the referenced issuer object or reserved names; for example, + * 'Self' or 'Unknown'. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Type of certificate to be requested from the issuer provider. + */ + @JsonProperty(value = "cty") + private String certificateType; + + /** + * Indicates if the certificates generated under this policy should be + * published to certificate transparency logs. + */ + @JsonProperty(value = "cert_transparency") + private Boolean certificateTransparency; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the IssuerParameters object itself. + */ + public IssuerParameters name(String name) { + this.name = name; + return this; + } + + /** + * Get the certificateType value. + * + * @return the certificateType value + */ + public String certificateType() { + return this.certificateType; + } + + /** + * Set the certificateType value. + * + * @param certificateType the certificateType value to set + * @return the IssuerParameters object itself. + */ + public IssuerParameters certificateType(String certificateType) { + this.certificateType = certificateType; + return this; + } + + /** + * Get the certificateTransparency value. + * + * @return the certificateTransparency value + */ + public Boolean certificateTransparency() { + return this.certificateTransparency; + } + + /** + * Set the certificateTransparency value. + * + * @param certificateTransparency the certificateTransparency value to set + * @return the IssuerParameters object itself. + */ + public IssuerParameters certificateTransparency(Boolean certificateTransparency) { + this.certificateTransparency = certificateTransparency; + return this; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/KeyProperties.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/KeyProperties.java new file mode 100644 index 000000000000..9b0b9241427d --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/KeyProperties.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.security.keyvault.certificates.models.CertificatePolicy; +import com.azure.security.keyvault.certificates.models.KeyOptions; +import com.azure.security.keyvault.certificates.models.webkey.KeyCurveName; +import com.azure.security.keyvault.certificates.models.webkey.KeyType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the key pair backing a certificate. + */ +class KeyProperties { + + KeyProperties(CertificatePolicy certificatePolicy) { + KeyOptions keyOptions = certificatePolicy.keyOptions(); + if (keyOptions == null) { + return; + } + this.curve = keyOptions.curve(); + this.exportable = keyOptions.exportable(); + this.keySize = keyOptions.keySize(); + this.keyType = keyOptions.keyType(); + this.reuseKey = keyOptions.reuseKey(); + } + + + /** + * Indicates if the private key can be exported. + */ + @JsonProperty(value = "exportable") + private Boolean exportable; + + /** + * The type of key pair to be used for the certificate. Possible values + * include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct'. + */ + @JsonProperty(value = "kty") + private KeyType keyType; + + /** + * The key size in bits. For example: 2048, 3072, or 4096 for RSA. + */ + @JsonProperty(value = "key_size") + private Integer keySize; + + /** + * Indicates if the same key pair will be used on certificate renewal. + */ + @JsonProperty(value = "reuse_key") + private Boolean reuseKey; + + /** + * Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible + * values include: 'P-256', 'P-384', 'P-521', 'P-256K'. + */ + @JsonProperty(value = "crv") + private KeyCurveName curve; + + /** + * Get the exportable value. + * + * @return the exportable value + */ + Boolean exportable() { + return this.exportable; + } + + /** + * Set the exportable value. + * + * @param exportable the exportable value to set + * @return the KeyProperties object itself. + */ + KeyProperties exportable(Boolean exportable) { + this.exportable = exportable; + return this; + } + + /** + * Get the keyType value. + * + * @return the keyType value + */ + KeyType keyType() { + return this.keyType; + } + + /** + * Set the keyType value. + * + * @param keyType the keyType value to set + * @return the KeyProperties object itself. + */ + KeyProperties keyType(KeyType keyType) { + this.keyType = keyType; + return this; + } + + /** + * Get the keySize value. + * + * @return the keySize value + */ + Integer keySize() { + return this.keySize; + } + + /** + * Set the keySize value. + * + * @param keySize the keySize value to set + * @return the KeyProperties object itself. + */ + KeyProperties keySize(Integer keySize) { + this.keySize = keySize; + return this; + } + + /** + * Get the reuseKey value. + * + * @return the reuseKey value + */ + Boolean reuseKey() { + return this.reuseKey; + } + + /** + * Set the reuseKey value. + * + * @param reuseKey the reuseKey value to set + * @return the KeyProperties object itself. + */ + KeyProperties reuseKey(Boolean reuseKey) { + this.reuseKey = reuseKey; + return this; + } + + /** + * Get the curve value. + * + * @return the curve value + */ + KeyCurveName curve() { + return this.curve; + } + + /** + * Set the curve value. + * + * @param curve the curve value to set + * @return the KeyProperties object itself. + */ + KeyProperties curve(KeyCurveName curve) { + this.curve = curve; + return this; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/KeyVaultCredentialPolicy.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/KeyVaultCredentialPolicy.java new file mode 100644 index 000000000000..ad625bdca6ee --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/KeyVaultCredentialPolicy.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.core.credentials.TokenCredential; +import com.azure.core.http.HttpPipelineCallContext; +import com.azure.core.http.HttpPipelineNextPolicy; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.implementation.util.ImplUtils; +import reactor.core.publisher.Mono; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; + +/** + * A policy that authenticates requests with Azure Key Vault service. The content added by this policy + * is leveraged in {@link TokenCredential} to get and set the correct "Authorization" header value. + * + * @see TokenCredential + */ +public final class KeyVaultCredentialPolicy implements HttpPipelinePolicy { + private static final String WWW_AUTHENTICATE = "WWW-Authenticate"; + private static final String BEARER_TOKEN_PREFIX = "Bearer "; + private static final String AUTHORIZATION = "Authorization"; + private final ScopeTokenCache cache; + + /** + * Creates KeyVaultCredentialPolicy. + * + * @param credential the token credential to authenticate the request + */ + public KeyVaultCredentialPolicy(TokenCredential credential) { + Objects.requireNonNull(credential); + this.cache = new ScopeTokenCache((scopes) -> credential.getToken(scopes)); + } + + /** + * Adds the required header to authenticate a request to Azure Key Vault service. + * + * @param context The request context + * @param next The next HTTP pipeline policy to process the {@code context's} request after this policy completes. + * @return A {@link Mono} representing the HTTP response that will arrive asynchronously. + */ + @Override + public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { + return next.clone().process() + // Ignore body + .doOnNext(HttpResponse::close) + .map(res -> res.getHeaderValue(WWW_AUTHENTICATE)) + .map(header -> extractChallenge(header, BEARER_TOKEN_PREFIX)) + .flatMap(map -> { + cache.scopes(map.get("resource") + "/.default"); + return cache.getToken(); + }) + .flatMap(token -> { + context.getHttpRequest().setHeader(AUTHORIZATION, BEARER_TOKEN_PREFIX + token.getToken()); + return next.process(); + }); + } + + /** + * Extracts the challenge off the authentication header. + * + * @param authenticateHeader The authentication header containing all the challenges. + * @param authChallengePrefix The authentication challenge name. + * @return a challenge map. + */ + private static Map extractChallenge(String authenticateHeader, String authChallengePrefix) { + if (!isValidChallenge(authenticateHeader, authChallengePrefix)) { + return null; + } + authenticateHeader = authenticateHeader.toLowerCase(Locale.ROOT).replace(authChallengePrefix.toLowerCase(Locale.ROOT), ""); + + String[] challenges = authenticateHeader.split(", "); + Map challengeMap = new HashMap<>(); + for (String pair : challenges) { + String[] keyValue = pair.split("="); + challengeMap.put(keyValue[0].replaceAll("\"", ""), keyValue[1].replaceAll("\"", "")); + } + return challengeMap; + } + + /** + * Verifies whether a challenge is bearer or not. + * + * @param authenticateHeader The authentication header containing all the challenges. + * @param authChallengePrefix The authentication challenge name. + * @return A boolean indicating tha challenge is valid or not. + */ + private static boolean isValidChallenge(String authenticateHeader, String authChallengePrefix) { + return (!ImplUtils.isNullOrEmpty(authenticateHeader) + && authenticateHeader.toLowerCase(Locale.ROOT).startsWith(authChallengePrefix.toLowerCase(Locale.ROOT))); + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/KeyVaultErrorCodeStrings.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/KeyVaultErrorCodeStrings.java new file mode 100644 index 000000000000..2c6bd3bd937f --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/KeyVaultErrorCodeStrings.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + + +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + + +class KeyVaultErrorCodeStrings { + static final String ERROR_STRINGS_FILE_NAME = "kvErrorStrings.properties"; + private static Properties errorStrings; + + /** + * The property name of Azure Key Vault Credentials required error string. + */ + static final String CREDENTIALS_REQUIRED = "credentials_required"; + + /** + * The property name of Azure Key Vault Endpoint required error string. + */ + static final String VAULT_END_POINT_REQUIRED = "vault_endpoint_required"; + + /** + * Gets the error String for the specified property. + * + * @param propertyName the property name for which error string is required. + * @return The {@link String value} containing the error message. + */ + static String getErrorString(String propertyName) { + loadProperties(); + return errorStrings.getProperty(propertyName); + } + + private static synchronized void loadProperties() { + if (errorStrings == null) { + try (InputStream fileInputStream = KeyVaultErrorCodeStrings.class.getClassLoader().getResource((ERROR_STRINGS_FILE_NAME)).openStream()) { + errorStrings = new Properties(); + errorStrings.load(fileInputStream); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + } +} + + + diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/LifetimeActionRequest.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/LifetimeActionRequest.java new file mode 100644 index 000000000000..95ae51a964bd --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/LifetimeActionRequest.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.security.keyvault.certificates.models.LifetimeAction; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Action and its trigger that will be performed by Key Vault over the lifetime + * of a certificate. + */ +class LifetimeActionRequest { + /** + * The condition that will execute the action. + */ + @JsonProperty(value = "trigger") + private Trigger trigger; + + /** + * The action that will be executed. + */ + @JsonProperty(value = "action") + private Action action; + + LifetimeActionRequest(LifetimeAction lifetimeAction) { + action = new Action() + .actionType(lifetimeAction.actionType()); + trigger = new Trigger() + .daysBeforeExpiry(lifetimeAction.daysBeforeExpiry()) + .lifetimePercentage(lifetimeAction.lifetimePercentage()); + } + + /** + * Get the trigger value. + * + * @return the trigger value + */ + Trigger trigger() { + return this.trigger; + } + + /** + * Set the trigger value. + * + * @param trigger the trigger value to set + * @return the LifetimeActionRequest object itself. + */ + LifetimeActionRequest withTrigger(Trigger trigger) { + this.trigger = trigger; + return this; + } + + /** + * Get the action value. + * + * @return the action value + */ + Action action() { + return this.action; + } + + /** + * Set the action value. + * + * @param action the action value to set + * @return the LifetimeActionRequest object itself. + */ + LifetimeActionRequest action(Action action) { + this.action = action; + return this; + } + +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/OrganizationDetails.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/OrganizationDetails.java new file mode 100644 index 000000000000..1233408f1380 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/OrganizationDetails.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.azure.security.keyvault.certificates; + +import com.azure.security.keyvault.certificates.models.Administrator; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +/** + * Details of the organization of the certificate issuer. + */ +class OrganizationDetails { + /** + * Id of the organization. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Details of the organization administrator. + */ + @JsonProperty(value = "admin_details") + private List adminDetails; + + /** + * Get the id value. + * + * @return the id value + */ + String id() { + return this.id; + } + + /** + * Set the id value. + * + * @param id the id value to set + * @return the OrganizationDetails object itself. + */ + OrganizationDetails id(String id) { + this.id = id; + return this; + } + + /** + * Get the adminDetails value. + * + * @return the adminDetails value + */ + List adminDetails() { + return this.adminDetails; + } + + /** + * Set the adminDetails value. + * + * @param adminDetails the adminDetails value to set + * @return the OrganizationDetails object itself. + */ + OrganizationDetails adminDetails(List adminDetails) { + this.adminDetails = adminDetails; + return this; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/Poller.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/Poller.java new file mode 100644 index 000000000000..040e5c30fdc1 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/Poller.java @@ -0,0 +1,407 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollResponse; +import reactor.core.Disposable; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.time.Duration; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.function.Supplier; + +/** + * 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. + *

+ * It provides the following functionality: + * + *

    + *
  • Querying the current state of long-running operations.
  • + *
  • Requesting an asynchronous notification for long-running operation's state.
  • + *
  • Cancelling the long-running operation if cancellation is supported by the service.
  • + *
  • Triggering a poll operation manually.
  • + *
  • 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. + * + *

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. + *

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. + * + *

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 PollResponse}. + * + * @param Type of poll response value + * @see PollResponse + */ +public class Poller { + + private final ClientLogger logger = new ClientLogger(Poller.class); + /* + * poll operation is a function that takes the previous PollResponse, and + * returns a new Mono of PollResponse to represent the current state + */ + private final Function, Mono>> pollOperation; + + /* + * poll interval before next auto poll. This value will be used if the PollResponse does not include retryAfter from the service. + */ + private final Duration pollInterval; + + /* + * This will save last poll response. + */ + private PollResponse pollResponse; + + /* + * This will be called when cancel operation is triggered. + */ + private final Consumer> cancelOperation; + + /* + * Indicate to poll automatically or not when poller is created. + * default value is false; + */ + private boolean autoPollingEnabled; + + /* + * This handle to Flux allow us to perform polling operation in asynchronous manner. + * This could be shared among many subscriber. One of the subscriber will be this poller itself. + * Once subscribed, this Flux will continue to poll for status until poll operation is done/complete. + */ + private final Flux> fluxHandle; + + /* + * Since constructor create a subscriber and start auto polling. + * This handle will be used to dispose the subscriber when + * client disable auto polling. + */ + private Disposable fluxDisposable; + + /** + * Create 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}. + * + * @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 status. + * {@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. + * @throws IllegalArgumentException if {@code pollInterval} is less than or equal to zero and if {@code pollInterval} or {@code pollOperation} are {@code null} + */ + public Poller(Duration pollInterval, Function, Mono>> pollOperation) { + this(pollInterval, pollOperation, null, null); + } + + /** + * Create 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}. + * + * @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 status. + * {@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 activationOperation the operation to be called before polling begins. It can be {@code null} which will indicate to the {@link Poller} + * that polling can begin straight away. + * @param cancelOperation cancel operation if cancellation is supported by the service. It can be {@code null} which will indicate to the {@link Poller} + * that cancel operation is not supported by Azure service. + * @throws IllegalArgumentException if {@code pollInterval} is less than or equal to zero and if {@code pollInterval} or {@code pollOperation} are {@code null} + */ + public Poller(Duration pollInterval, Function, Mono>> pollOperation, Supplier> activationOperation, Consumer> cancelOperation) { + if (pollInterval == null || pollInterval.toNanos() <= 0) { + logger.logExceptionAsError(new IllegalArgumentException("Null, negative or zero value for poll interval is not allowed.")); + } + if (pollOperation == null) { + logger.logExceptionAsError(new IllegalArgumentException("Null value for poll operation is not allowed.")); + } + + this.pollInterval = pollInterval; + this.pollOperation = pollOperation; + this.pollResponse = new PollResponse<>(PollResponse.OperationStatus.NOT_STARTED, null); + + this.fluxHandle = asyncPollRequestWithDelay() + .flux() + .repeat() + .takeUntil(pollResponse -> hasCompleted()) + .share() + .delaySubscription(activationOperation != null ? activationOperation.get() : Mono.empty()); + + // auto polling start here + this.fluxDisposable = fluxHandle.subscribe(); + this.autoPollingEnabled = true; + this.cancelOperation = cancelOperation; + } + + /** + * Create a {@link Poller} instance with poll interval, poll operation and cancel operation. The polling starts immediately by invoking {@code pollOperation}. + * The next poll cycle will be defined by retryAfter value in {@link PollResponse}. + * In absence of {@link PollResponse#getRetryAfter()}, the {@link Poller} will use {@code pollInterval}. + * + * @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 status. + *{@link Mono} returned from poll operation should never return {@link Mono#error(Throwable)}.If any unexpected scenario happens in poll operation, + * it should handle it 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 cancelOperation cancel operation if cancellation is supported by the service. It can be {@code null} which will indicate to the {@link Poller} + * that cancel operation is not supported by Azure service. + * @throws IllegalArgumentException if {@code pollInterval} is less than or equal to zero and if {@code pollInterval} or {@code pollOperation} are {@code null} + */ + public Poller(Duration pollInterval, Function, Mono>> pollOperation, Consumer> cancelOperation) { + this(pollInterval, pollOperation, null, cancelOperation); + } + + /** + * Create a {@link Poller} instance with poll interval, poll operation and cancel operation. The polling starts immediately by invoking {@code pollOperation}. + * The next poll cycle will be defined by retryAfter value in {@link PollResponse}. + * In absence of {@link PollResponse#getRetryAfter()}, the {@link Poller} will use {@code pollInterval}. + * + * @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 status. + * {@link Mono} returned from poll operation should never return {@link Mono#error(Throwable)}.If any unexpected scenario happens in poll operation, + * it should handle it 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 activationOperation the operation to be called before polling begins. It can be {@code null} which will indicate to the {@link Poller} + * that polling can begin straight away. + * @throws IllegalArgumentException if {@code pollInterval} is less than or equal to zero and if {@code pollInterval} or {@code pollOperation} are {@code null} + */ + public Poller(Duration pollInterval, Function, Mono>> pollOperation, Supplier> activationOperation) { + this(pollInterval, pollOperation, activationOperation, null); + } + + /** + * Attempts to cancel the long-running operation that this {@link Poller} represents. This is possible only if the service supports it, + * otherwise an {@code UnsupportedOperationException} will be thrown. + *

+ * It will call cancelOperation if status is 'In Progress' otherwise it does nothing. + * + * @throws UnsupportedOperationException when cancel operation is not provided. + */ + public void cancelOperation() throws UnsupportedOperationException { + if (this.cancelOperation == null) { + logger.logExceptionAsError(new UnsupportedOperationException("Cancel operation is not supported on this service/resource.")); + } + + // We can not cancel an operation if it was never started + // It only make sense to call cancel operation if current status IN_PROGRESS. + if (this.pollResponse != null && this.pollResponse.getStatus() != PollResponse.OperationStatus.IN_PROGRESS) { + return; + } + + //Time to call cancel + this.cancelOperation.accept(this); + } + + /** + * This method returns a {@link Flux} that can be subscribed to, enabling a subscriber to receive notification of + * every {@link PollResponse}, as it is received. + * + * @return A {@link Flux} that can be subscribed to receive poll responses as the long-running operation executes. + */ + public Flux> getObserver() { + return this.fluxHandle; + } + + /** + * Enable user to take control of polling and trigger manual poll operation. It will call poll operation once. + * This will not turn off auto polling. + * + * @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. + */ + public Mono> poll() { + return this.pollOperation.apply(this.pollResponse) + .doOnEach(pollResponseSignal -> { + if (pollResponseSignal.get() != null) { + this.pollResponse = pollResponseSignal.get(); + } + }); + } + + /** + * Blocks execution and wait for polling to complete. The polling is considered complete based on status defined in {@link PollResponse}. + *

It will enable auto-polling if it was disable by user. + * + * @return returns final {@link PollResponse} when polling is complete. + */ + public PollResponse block() { + if (!isAutoPollingEnabled()) { + setAutoPollingEnabled(true); + } + return this.fluxHandle.blockLast(); + } + + /** + * Blocks execution and wait for polling to complete. The polling is considered complete based on status defined in {@link PollResponse}. + *

It will enable auto-polling if it was disable by user. + * + * @param timeout the duration for which the excecution is blocked and waits for polling to complete. + * @return returns final {@link PollResponse} when polling is complete. + */ + public PollResponse block(Duration timeout) { + if (!isAutoPollingEnabled()) { + setAutoPollingEnabled(true); + } + return this.fluxHandle.blockLast(timeout); + } + + /** + * Blocks indefinitely until given {@code statusToBlockFor} is received. + * @param statusToBlockFor The desired status to block for. + * @return {@link PollResponse} for matching desired status. + * @throws IllegalArgumentException If {@code statusToBlockFor} is {@code null}. + */ + public PollResponse blockUntil(PollResponse.OperationStatus statusToBlockFor) { + return blockUntil(statusToBlockFor, null); + } + + /** + * Blocks until given {@code statusToBlockFor} is received or a timeout expires if provided. A {@code null} {@code timeout} will cause to block indefinitely for desired status. + * @param statusToBlockFor The desired status to block for. + * @param timeout The time after which it will stop blocking. A {@code null} value will cause to block indefinitely. Zero or negative are not valid values. + * @return {@link PollResponse} for matching desired status to block for. + * @throws IllegalArgumentException if {@code timeout} is zero or negative and if {@code statusToBlockFor} is {@code null}. + */ + public PollResponse blockUntil(PollResponse.OperationStatus statusToBlockFor, Duration timeout) { + if (statusToBlockFor == null) { + logger.logExceptionAsError(new IllegalArgumentException("Null value for status is not allowed.")); + } + if (timeout != null && timeout.toNanos() <= 0) { + logger.logExceptionAsError(new IllegalArgumentException("Negative or zero value for timeout is not allowed.")); + } + if (!isAutoPollingEnabled()) { + setAutoPollingEnabled(true); + } + if (timeout != null) { + return this.fluxHandle.filter(tPollResponse -> matchStatus(tPollResponse, statusToBlockFor)).blockFirst(timeout); + } else { + return this.fluxHandle.filter(tPollResponse -> matchStatus(tPollResponse, statusToBlockFor)).blockFirst(); + } + } + + /* + * Indicate that the @{link PollResponse} matches with the status to block for. + * @param currentPollResponse The poll response which we have received from the flux. + * @param statusToBlockFor The {@link OperationStatus} to block and it can be any valid {@link OperationStatus} value. + * @return True if the {@link PollResponse} return status matches the status to block for. + */ + private boolean matchStatus(PollResponse currentPollResponse, PollResponse.OperationStatus statusToBlockFor) { + // perform validation + if (currentPollResponse == null || statusToBlockFor == null) { + return false; + } + if (statusToBlockFor == currentPollResponse.getStatus()) { + return true; + } + return false; + } + + /* + * This function will apply delay and call poll operation function async. + * We expect Mono from pollOperation should never return Mono.error() . If any unexpected + * scenario happens in pollOperation, it should catch it and return a valid PollResponse. + * This is because poller does not know what to do in case on Mono.error. + * This function will return empty mono in case of Mono.error() returned by poll operation. + * + * @return mono of poll response + */ + private Mono> asyncPollRequestWithDelay() { + return Mono.defer(() -> this.pollOperation.apply(this.pollResponse) + .delaySubscription(getCurrentDelay()) + .onErrorResume(throwable -> { + // We should never get here and since we want to continue polling + //Log the error + return Mono.empty(); + }) + .doOnEach(pollResponseSignal -> { + if (pollResponseSignal.get() != null) { + this.pollResponse = pollResponseSignal.get(); + } + })); + } + + /* + * We will use {@link PollResponse#getRetryAfter} if it is greater than zero otherwise use poll interval. + */ + private Duration getCurrentDelay() { + return (this.pollResponse != null + && this.pollResponse.getRetryAfter() != null + && this.pollResponse.getRetryAfter().toNanos() > 0) ? this.pollResponse.getRetryAfter() : this.pollInterval; + } + + /** + * Controls whether auto-polling is enabled or disabled. Refer to the {@link Poller} class-level JavaDoc for more details on auto-polling. + * + * @param autoPollingEnabled If true, auto-polling will occur transparently in the background, otherwise it requires + * manual polling by the user to get the latest state. + */ + public final void setAutoPollingEnabled(boolean autoPollingEnabled) { + this.autoPollingEnabled = autoPollingEnabled; + if (this.autoPollingEnabled) { + if (!activeSubscriber()) { + this.fluxDisposable = this.fluxHandle.subscribe(pr -> this.pollResponse = pr); + } + } else { + if (activeSubscriber()) { + this.fluxDisposable.dispose(); + } + } + } + + + /* + * An operation will be considered complete if it is in one of the following state: + *

    + *
  • SUCCESSFULLY_COMPLETED
  • + *
  • USER_CANCELLED
  • + *
  • FAILED
  • + *
+ * Also see {@link OperationStatus} + * @return true if operation is done/complete. + */ + private boolean hasCompleted() { + return pollResponse != null && (pollResponse.getStatus() == PollResponse.OperationStatus.SUCCESSFULLY_COMPLETED + || pollResponse.getStatus() == PollResponse.OperationStatus.FAILED + || pollResponse.getStatus() == PollResponse.OperationStatus.USER_CANCELLED); + } + + /* + * Determine if this poller's internal subscriber exists and active. + */ + private boolean activeSubscriber() { + return (this.fluxDisposable != null && !this.fluxDisposable.isDisposed()); + } + + /** + * 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.. + */ + public boolean isAutoPollingEnabled() { + return this.autoPollingEnabled; + } + + /** + * 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. + */ + public PollResponse.OperationStatus getStatus() { + return this.pollResponse != null ? this.pollResponse.getStatus() : null; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/ScopeTokenCache.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/ScopeTokenCache.java new file mode 100644 index 000000000000..b6a91b8fd9ae --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/ScopeTokenCache.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.core.credentials.AccessToken; +import reactor.core.publisher.FluxSink; +import reactor.core.publisher.Mono; +import reactor.core.publisher.ReplayProcessor; + +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.Function; + +/** + * A token cache that supports caching a token and refreshing it. + */ +class ScopeTokenCache { + private static final int REFRESH_TIMEOUT_SECONDS = 30; + + private final AtomicBoolean wip; + private AccessToken cache; + private final ReplayProcessor emitterProcessor = ReplayProcessor.create(1); + private final FluxSink sink = emitterProcessor.sink(FluxSink.OverflowStrategy.BUFFER); + private final Function> getNew; + private String[] scopes; + + /** + * Creates an instance of RefreshableTokenCredential with default scheme "Bearer". + * + * @param getNew a method to get a new token + */ + ScopeTokenCache(Function> getNew) { + this.wip = new AtomicBoolean(false); + this.getNew = getNew; + } + + void scopes(String... scopes) { + this.scopes = scopes; + } + + /** + * Asynchronously get a token from either the cache or replenish the cache with a new token. + * @return a Publisher that emits an AccessToken + */ + Mono getToken() { + if (cache != null && !cache.isExpired()) { + return Mono.just(cache); + } + return Mono.defer(() -> { + if (!wip.getAndSet(true)) { + return getNew.apply(scopes).doOnNext(ac -> cache = ac) + .doOnNext(sink::next) + .doOnError(sink::error) + .doOnTerminate(() -> wip.set(false)); + } else { + return emitterProcessor.next(); + } + }); + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/SecretProperties.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/SecretProperties.java new file mode 100644 index 000000000000..af65a309db0d --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/SecretProperties.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the key backing a certificate. + */ +class SecretProperties { + + SecretProperties(String contentType) { + this.contentType = contentType; + } + + /** + * The media type (MIME type). + */ + @JsonProperty(value = "contentType") + private String contentType; + + /** + * Get the contentType value. + * + * @return the contentType value + */ + String contentType() { + return this.contentType; + } + + /** + * Set the contentType value. + * + * @param contentType the contentType value to set + * @return the SecretProperties object itself. + */ + SecretProperties contentType(String contentType) { + this.contentType = contentType; + return this; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/SubjectAlternativeNamesRequest.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/SubjectAlternativeNamesRequest.java new file mode 100644 index 000000000000..c39e7b9ba436 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/SubjectAlternativeNamesRequest.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.security.keyvault.certificates.models.SubjectAlternativeNames; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +/** + * The subject alternate names of a X509 object. + */ +class SubjectAlternativeNamesRequest { + /** + * Email addresses. + */ + @JsonProperty(value = "emails") + private List emails; + + /** + * Domain names. + */ + @JsonProperty(value = "dns_names") + private List dnsNames; + + /** + * User principal names. + */ + @JsonProperty(value = "upns") + private List upns; + + /** + * Get the emails value. + * + * @return the emails value + */ + public List emails() { + return this.emails; + } + + SubjectAlternativeNamesRequest(SubjectAlternativeNames subjectAlternativeNames) { + if (subjectAlternativeNames != null) { + this.dnsNames = subjectAlternativeNames.dnsNames(); + this.emails = subjectAlternativeNames.emails(); + this.upns = subjectAlternativeNames.upns(); + } + } + + /** + * Set the emails value. + * + * @param emails the emails value to set + * @return the SubjectAlternativeNamesRequest object itself. + */ + SubjectAlternativeNamesRequest emails(List emails) { + this.emails = emails; + return this; + } + + /** + * Get the dnsNames value. + * + * @return the dnsNames value + */ + List dnsNames() { + return this.dnsNames; + } + + /** + * Set the dnsNames value. + * + * @param dnsNames the dnsNames value to set + * @return the SubjectAlternativeNamesRequest object itself. + */ + SubjectAlternativeNamesRequest dnsNames(List dnsNames) { + this.dnsNames = dnsNames; + return this; + } + + /** + * Get the upns value. + * + * @return the upns value + */ + List upns() { + return this.upns; + } + + /** + * Set the upns value. + * + * @param upns the upns value to set + * @return the SubjectAlternativeNamesRequest object itself. + */ + SubjectAlternativeNamesRequest upns(List upns) { + this.upns = upns; + return this; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/Trigger.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/Trigger.java new file mode 100644 index 000000000000..de10c0b39378 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/Trigger.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A condition to be satisfied for an action to be executed. + */ +class Trigger { + /** + * Percentage of lifetime at which to trigger. Value should be between 1 + * and 99. + */ + @JsonProperty(value = "lifetime_percentage") + private Integer lifetimePercentage; + + /** + * Days before expiry to attempt renewal. Value should be between 1 and + * validity_in_months multiplied by 27. If validity_in_months is 36, then + * value should be between 1 and 972 (36 * 27). + */ + @JsonProperty(value = "days_before_expiry") + private Integer daysBeforeExpiry; + + /** + * Get the lifetimePercentage value. + * + * @return the lifetimePercentage value + */ + Integer lifetimePercentage() { + return this.lifetimePercentage; + } + + /** + * Set the lifetimePercentage value. + * + * @param lifetimePercentage the lifetimePercentage value to set + * @return the Trigger object itself. + */ + Trigger lifetimePercentage(Integer lifetimePercentage) { + this.lifetimePercentage = lifetimePercentage; + return this; + } + + /** + * Get the daysBeforeExpiry value. + * + * @return the daysBeforeExpiry value + */ + Integer daysBeforeExpiry() { + return this.daysBeforeExpiry; + } + + /** + * Set the daysBeforeExpiry value. + * + * @param daysBeforeExpiry the daysBeforeExpiry value to set + * @return the Trigger object itself. + */ + Trigger daysBeforeExpiry(Integer daysBeforeExpiry) { + this.daysBeforeExpiry = daysBeforeExpiry; + return this; + } + +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/X509CertificateProperties.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/X509CertificateProperties.java new file mode 100644 index 000000000000..ffe1b30c2bd7 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/X509CertificateProperties.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.security.keyvault.certificates; + +import com.azure.security.keyvault.certificates.models.CertificatePolicy; +import com.azure.security.keyvault.certificates.models.KeyUsageType; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +/** + * Properties of the X509 component of a certificate. + */ +class X509CertificateProperties { + + X509CertificateProperties(CertificatePolicy certificatePolicy) { + this.subject = certificatePolicy.subjectName(); + this.ekus = certificatePolicy.keyOptions() != null ? certificatePolicy.keyOptions().ekus() : null; + this.keyUsage = certificatePolicy.keyOptions() != null ? certificatePolicy.keyOptions().keyUsage() : null; + this.subjectAlternativeNamesRequest = new SubjectAlternativeNamesRequest(certificatePolicy.subjectAlternativeNames()); + this.validityInMonths = certificatePolicy.validityInMonths(); + } + + /** + * The subject name. Should be a valid X509 distinguished Name. + */ + @JsonProperty(value = "subject") + private String subject; + + /** + * The enhanced key usage. + */ + @JsonProperty(value = "ekus") + private List ekus; + + /** + * The subject alternative names. + */ + @JsonProperty(value = "sans") + private SubjectAlternativeNamesRequest subjectAlternativeNamesRequest; + + /** + * List of key usages. + */ + @JsonProperty(value = "key_usage") + private List keyUsage; + + /** + * The duration that the ceritifcate is valid in months. + */ + @JsonProperty(value = "validity_months") + private Integer validityInMonths; + + /** + * Get the subject value. + * + * @return the subject value + */ + String subject() { + return this.subject; + } + + /** + * Set the subject value. + * + * @param subject the subject value to set + * @return the X509CertificateProperties object itself. + */ + X509CertificateProperties subject(String subject) { + this.subject = subject; + return this; + } + + /** + * Get the ekus value. + * + * @return the ekus value + */ + List ekus() { + return this.ekus; + } + + /** + * Set the ekus value. + * + * @param ekus the ekus value to set + * @return the X509CertificateProperties object itself. + */ + X509CertificateProperties ekus(List ekus) { + this.ekus = ekus; + return this; + } + + /** + * Get the subjectAlternativeNamesRequest value. + * + * @return the subjectAlternativeNamesRequest value + */ + SubjectAlternativeNamesRequest subjectAlternativeNames() { + return this.subjectAlternativeNamesRequest; + } + + /** + * Set the subjectAlternativeNamesRequest value. + * + * @param subjectAlternativeNamesRequest the subjectAlternativeNamesRequest value to set + * @return the X509CertificateProperties object itself. + */ + X509CertificateProperties subjectAlternativeNames(SubjectAlternativeNamesRequest subjectAlternativeNamesRequest) { + this.subjectAlternativeNamesRequest = subjectAlternativeNamesRequest; + return this; + } + + /** + * Get the keyUsage value. + * + * @return the keyUsage value + */ + List keyUsage() { + return this.keyUsage; + } + + /** + * Set the keyUsage value. + * + * @param keyUsage the keyUsage value to set + * @return the X509CertificateProperties object itself. + */ + X509CertificateProperties keyUsage(List keyUsage) { + this.keyUsage = keyUsage; + return this; + } + + /** + * Get the validityInMonths value. + * + * @return the validityInMonths value + */ + Integer validityInMonths() { + return this.validityInMonths; + } + + /** + * Set the validityInMonths value. + * + * @param validityInMonths the validityInMonths value to set + * @return the X509CertificateProperties object itself. + */ + X509CertificateProperties validityInMonths(Integer validityInMonths) { + this.validityInMonths = validityInMonths; + return this; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificateBasePage.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificateBasePage.java new file mode 100644 index 000000000000..d46a659d8e55 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificateBasePage.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.implementation; + +import com.azure.core.http.rest.Page; +import com.azure.security.keyvault.certificates.models.CertificateBase; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +/** + * A page of Azure App Configuration {@link CertificateBase} resources and a link to get the next page of + * resources, if any. + */ +public final class CertificateBasePage implements Page { + + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. Or {@code null} if there are no more resources to fetch. + * + * @return The link to the next page. + */ + @Override + public String getNextLink() { + return this.nextLink; + } + + /** + * Gets the list of {@link CertificateBase CertificateBase} on this page. + * + * @return The list of items in {@link List}. + */ + @Override + public List getItems() { + return items; + } +} + diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/ContactPage.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/ContactPage.java new file mode 100644 index 000000000000..07c1b8f84d28 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/ContactPage.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.implementation; + +import com.azure.core.http.rest.Page; +import com.azure.security.keyvault.certificates.models.Contact; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +/** + * A page of Contact {@link Contact} resources and a link to get the next page of + * resources, if any. + */ +public final class ContactPage implements Page { + + /** + * The list of items. + */ + @JsonProperty("contacts") + private List items; + + /** + * Gets the list of {@link Contact contacts} on this page. + * + * @return The list of items in {@link List}. + */ + @Override + public List getItems() { + return items; + } + + @Override + public String getNextLink() { + return null; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/DeletedCertificatePage.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/DeletedCertificatePage.java new file mode 100644 index 000000000000..bd8468cbe663 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/DeletedCertificatePage.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.implementation; + +import com.azure.core.http.rest.Page; +import com.azure.security.keyvault.certificates.models.DeletedCertificate; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +/** + * A page of Deleted Certificate {@link DeletedCertificate} resources and a link to get the next page of + * resources, if any. + */ +public final class DeletedCertificatePage implements Page { + + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. Or {@code null} if there are no more resources to fetch. + * + * @return The link to the next page. + */ + @Override + public String getNextLink() { + return this.nextLink; + } + + /** + * Gets the list of {@link DeletedCertificate deletedSecrets} on this page. + * + * @return The list of items in {@link List}. + */ + @Override + public List getItems() { + return items; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/IssuerBasePage.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/IssuerBasePage.java new file mode 100644 index 000000000000..c23b3038c762 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/IssuerBasePage.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.implementation; + +import com.azure.core.http.rest.Page; +import com.azure.security.keyvault.certificates.models.IssuerBase; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +/** + * A page of Issuer {@link IssuerBase} resources and a link to get the next page of + * resources, if any. + */ +public final class IssuerBasePage implements Page { + + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. Or {@code null} if there are no more resources to fetch. + * + * @return The link to the next page. + */ + @Override + public String getNextLink() { + return this.nextLink; + } + + /** + * Gets the list of {@link IssuerBase issuers} on this page. + * + * @return The list of items in {@link List}. + */ + @Override + public List getItems() { + return items; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/Administrator.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/Administrator.java new file mode 100644 index 000000000000..40922ae4f1dc --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/Administrator.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents an administrator in {@link Issuer} + */ +public final class Administrator { + /** + * First name. + */ + @JsonProperty(value = "first_name") + private String firstName; + + /** + * Last name. + */ + @JsonProperty(value = "last_name") + private String lastName; + + /** + * Email addresss. + */ + @JsonProperty(value = "email") + private String email; + + /** + * Phone number. + */ + @JsonProperty(value = "phone") + private String contact; + + /** + * Creates an administrator of the issuer. + * @param firstName the firstName of the issuer. + * @param lastName the last name of the issuer. + * @param email the email of the issuer. + */ + public Administrator(String firstName, String lastName, String email) { + this.firstName = firstName; + this.lastName = lastName; + this.email = email; + } + + /** + * Creates an administrator of the issuer. + * @param firstName the firstName of the admin. + * @param lastName the last name of the admin. + * @param email the email of the admin. + * @param contact tne contact info of the admin. + */ + public Administrator(String firstName, String lastName, String email, String contact) { + this.firstName = firstName; + this.lastName = lastName; + this.email = email; + this.contact = contact; + } + + /** + * Get the first name of the admin. + * @return the first name of admin. + */ + public String firstName() { + return firstName; + } + + /** + * Get the last name of the admin. + * @return the last name of admin. + */ + public String lastName() { + return lastName; + } + + /** + * Get the email of the admin. + * @return the email of admin. + */ + public String email() { + return email; + } + + /** + * Get the contact of the admin. + * @return the contact of admin. + */ + public String contact() { + return contact; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/Certificate.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/Certificate.java new file mode 100644 index 000000000000..e3501fce33d9 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/Certificate.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.models; + +import com.azure.core.implementation.util.ImplUtils; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents a certificate with all of its properties. + */ +public class Certificate extends CertificateBase { + + /** + * CER contents of x509 certificate. + */ + @JsonProperty(value = "cer") + private byte[] cer; + + /** + * The key id. + */ + @JsonProperty(value = "kid", access = JsonProperty.Access.WRITE_ONLY) + private String keyId; + + /** + * The secret id. + */ + @JsonProperty(value = "sid", access = JsonProperty.Access.WRITE_ONLY) + private String secretId; + + /** + * The Certificate policy. + */ + @JsonProperty("policy") + private CertificatePolicy certificatePolicy; + + /** + * Create the certificate + * @param name the name of the certificate. + */ + public Certificate(String name) { + super.name = name; + } + + Certificate() { + + } + + /** + * Get the key id of the certificate + * @return the key Id. + */ + public String keyId() { + return this.keyId; + } + + /** + * Get the secret id of the certificate + * @return the key Id. + */ + public String secretId() { + return this.secretId; + } + + /** + * Get the cer content of the certificate + * @return the cer content. + */ + public byte[] cer() { + return ImplUtils.clone(cer); + } + + /** + * Get the certificate policy of the certificate + * @return the cer content. + */ + public CertificatePolicy certificatePolicy() { + return this.certificatePolicy; + } + + /** + * Set the certificate policy of the certificate + * + * @param certificatePolicy the policy to set. + * @return the certificate object itself. + */ + public Certificate certificatePolicy(CertificatePolicy certificatePolicy) { + this.certificatePolicy = certificatePolicy; + return this; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateBase.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateBase.java new file mode 100644 index 000000000000..77d5f3408276 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateBase.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.models; + +import com.azure.core.implementation.Base64Url; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.net.MalformedURLException; +import java.net.URL; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.Map; + +/** + * Represents base properties of a certificate. + */ +public class CertificateBase { + + /** + * Determines whether the object is enabled. + */ + private Boolean enabled; + + /** + * Not before date in UTC. + */ + private OffsetDateTime notBefore; + + /** + * The certificate version. + */ + String version; + + /** + * Expiry date in UTC. + */ + private OffsetDateTime expires; + + /** + * Creation time in UTC. + */ + private OffsetDateTime created; + + /** + * Last updated time in UTC. + */ + private OffsetDateTime updated; + + /** + * Reflects the deletion recovery level currently in effect for certificates in + * the current vault. If it contains 'Purgeable', the certificate can be + * permanently deleted by a privileged user; otherwise, only the system can + * purge the certificate, at the end of the retention interval. Possible values + * include: 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + * 'Recoverable+ProtectedSubscription'. + */ + private String recoveryLevel; + + /** + * The Certificate name. + */ + String name; + + /** + * The certificate id. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Application specific metadata in the form of key-value pairs. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Thumbprint of the certificate. Read Only + */ + @JsonProperty(value = "x5t", access = JsonProperty.Access.WRITE_ONLY) + private Base64Url x509Thumbprint; + + /** + * Get the id value. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the notBefore UTC time. + * + * @return the notBefore UTC time. + */ + public OffsetDateTime notBefore() { + return notBefore; + } + + /** + * Get the Certificate Expiry time in UTC. + * + * @return the expires UTC time. + */ + public OffsetDateTime expires() { + return this.expires; + } + + /** + * Get the the UTC time at which certificate was created. + * + * @return the created UTC time. + */ + public OffsetDateTime created() { + return created; + } + + /** + * Get the UTC time at which certificate was last updated. + * + * @return the last updated UTC time. + */ + public OffsetDateTime updated() { + return updated; + } + + + /** + * Get the tags associated with the certificate. + * + * @return the value of the tags. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags to be associated with the certificate. + * + * @param tags The tags to set + * @return the CertificateBase object itself. + */ + public CertificateBase tags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the version of the certificate. + * + * @return the version of the certificate. + */ + public String version() { + return this.version; + } + + /** + * Get the certificate name. + * + * @return the name of the certificate. + */ + public String name() { + return this.name; + } + + /** + * Get the recovery level of the certificate. + + * @return the recoveryLevel of the certificate. + */ + public String recoveryLevel() { + return recoveryLevel; + } + + /** + * Get the enabled status. + * + * @return the enabled status + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled status. + * @param enabled The enabled status to set. + * @return the CertificateBase object itself. + */ + public CertificateBase enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the X509 Thumbprint of the certificate. + * @return the x509Thumbprint. + */ + public byte[] x509Thumbprint() { + return this.x509Thumbprint.decodedBytes(); + } + + @JsonProperty("attributes") + @SuppressWarnings("unchecked") + private void unpackBaseAttributes(Map attributes) { + this.enabled = (Boolean) attributes.get("enabled"); + this.notBefore = epochToOffsetDateTime(attributes.get("nbf")); + this.expires = epochToOffsetDateTime(attributes.get("exp")); + this.created = epochToOffsetDateTime(attributes.get("created")); + this.updated = epochToOffsetDateTime(attributes.get("updated")); + this.recoveryLevel = (String) attributes.get("recoveryLevel"); + this.tags = (Map) lazyValueSelection(attributes.get("tags"), this.tags); + unpackId((String) attributes.get("id")); + } + + private OffsetDateTime epochToOffsetDateTime(Object epochValue) { + if (epochValue != null) { + Instant instant = Instant.ofEpochMilli(((Number) epochValue).longValue() * 1000L); + return OffsetDateTime.ofInstant(instant, ZoneOffset.UTC); + } + return null; + } + + @JsonProperty(value = "id") + private void unpackId(String id) { + if (id != null && id.length() > 0) { + this.id = id; + try { + URL url = new URL(id); + String[] tokens = url.getPath().split("/"); + this.name = (tokens.length >= 3 ? tokens[2] : null); + this.version = (tokens.length >= 4 ? tokens[3] : null); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + } + } + + private Object lazyValueSelection(Object input1, Object input2) { + if (input1 == null) { + return input2; + } + return input1; + } +} + diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateImportOptions.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateImportOptions.java new file mode 100644 index 000000000000..209eb8240e71 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateImportOptions.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.models; + +import java.time.OffsetDateTime; +import java.util.Map; + +/** + * Represents the configuration used to import a certificate in the key vault. + */ +public final class CertificateImportOptions { + + /** + * The file location of the certificate. + */ + private final String filePath; + + /** + * The name of the certificate. + */ + private final String name; + + /** + * If the private key in base64EncodedCertificate is encrypted, the + * password used for encryption. + */ + private String password; + + /** + * Determines whether the object is enabled. + */ + private Boolean enabled; + + /** + * Not before date in UTC. + */ + private OffsetDateTime notBefore; + + /** + * Expiry date in UTC. + */ + private OffsetDateTime expires; + + /** + * The management policy for the certificate. + */ + private CertificatePolicy certificatePolicy; + + /** + * Application specific metadata in the form of key-value pairs. + */ + private Map tags; + + /** + * Creates instance of CertificateImportOptions. + * @param name The name of the key. + * @param filePath The file location of the certificate. + */ + public CertificateImportOptions(String name, String filePath) { + this.name = name; + this.filePath = filePath; + } + + /** + * Set the enabled status. + * @param enabled The enabled status to set. + * @return the CertificateImportOptions itself + */ + public CertificateImportOptions enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the enabled status. + * + * @return the enabled status + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Get the management policy for the certificate. + * @return the management policy + */ + public CertificatePolicy certificatePolicy() { + return this.certificatePolicy; + } + + /** + * Set the management policy for the certificate. + * @param certificatePolicy the management policy for the certificate + * @return the CertificateImportOptions itself + */ + public CertificateImportOptions certificatePolicy(CertificatePolicy certificatePolicy) { + this.certificatePolicy = certificatePolicy; + return this; + } + + /** + * Set the application specific maetadata. + * @param tags The metadata to set. + * @return the CertificateImportOptions itself + */ + public CertificateImportOptions tags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the tags associated with the secret. + * + * @return the value of the tags. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the password for encrypting the certificate, if its encrypted. + * @param password The password used to encrypt the certificate. + * @return the CertificateImportOptions itself + */ + public CertificateImportOptions password(String password) { + this.password = password; + return this; + } + + /** + * Get the password for encrypting the certificate, if its encrypted. + * @return the password + */ + public String password() { + return this.password; + } + + /** + * Get the name of the certificate. + * @return the name of the certificate. + */ + public String name() { + return this.name; + } + + /** + * Get the file path of the certificate. + * @return the file path of the certificate. + */ + public String filePath() { + return this.filePath; + } + + /** + * Get the notBefore UTC time. + * + * @return the notBefore UTC time. + */ + public OffsetDateTime notBefore() { + return notBefore; + } + + /** + * Get the Certificate Expiry time in UTC. + * + * @return the expires UTC time. + */ + public OffsetDateTime expires() { + return this.expires; + } + + /** + * Set the notBefore UTC time. + * + * @param notBefore THe notBefore UTC time. + * @return the notBefore UTC time. + */ + public CertificateImportOptions notBefore(OffsetDateTime notBefore) { + this.notBefore = notBefore; + return this; + } + + /** + * Set the Certificate Expiry time in UTC. + * + * @param expires The expires UTC time. + * @return the expires UTC time. + */ + public CertificateImportOptions expires(OffsetDateTime expires) { + this.expires = expires; + return this; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateOperation.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateOperation.java new file mode 100644 index 000000000000..cd1ff63bedb8 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateOperation.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.models; + +import com.azure.core.implementation.util.ImplUtils; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Map; + +/** + * A certificate operation is returned in case of long running service requests. + */ +public final class CertificateOperation { + /** + * The certificate id. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Name of the referenced issuer object or reserved names; for example, + * 'Self' or 'Unknown'. + */ + private String issuerName; + + /** + * Type of certificate to be requested from the issuer provider. + */ + private String certificateType; + + /** + * Indicates if the certificates generated under this policy should be + * published to certificate transparency logs. + */ + private Boolean certificateTransparency; + + /** + * The certificate signing request (CSR) that is being used in the + * certificate operation. + */ + @JsonProperty(value = "csr") + private byte[] csr; + + /** + * Indicates if cancellation was requested on the certificate operation. + */ + @JsonProperty(value = "cancellation_requested") + private Boolean cancellationRequested; + + /** + * Status of the certificate operation. + */ + @JsonProperty(value = "status") + private String status; + + /** + * The status details of the certificate operation. + */ + @JsonProperty(value = "status_details") + private String statusDetails; + + /** + * Error encountered, if any, during the certificate operation. + */ + @JsonProperty(value = "error") + private Error error; + + /** + * Location which contains the result of the certificate operation. + */ + @JsonProperty(value = "target") + private String target; + + /** + * Identifier for the certificate operation. + */ + @JsonProperty(value = "request_id") + private String requestId; + + /** + * Get the identifier. + * + * @return the identifier. + */ + public String id() { + return this.id; + } + + /** + * Get the issuer name. + * + * @return the issuer name + */ + public String issuerName() { + return this.issuerName; + } + + /** + * Get the certificate type. + * + * @return the certificateType + */ + public String certificateType() { + return this.certificateType; + } + + /** + * Get the certificate transparency status. + * + * @return the certificateTransparency status. + */ + public Boolean certificateTransparency() { + return this.certificateTransparency; + } + + /** + * Get the csr. + * + * @return the csr. + */ + public byte[] csr() { + return ImplUtils.clone(this.csr); + } + + /** + * Get the cancellation requested status. + * + * @return the cancellationRequested status. + */ + public Boolean cancellationRequested() { + return this.cancellationRequested; + } + + /** + * Get the status. + * + * @return the status + */ + public String status() { + return this.status; + } + + /** + * Get the status details. + * + * @return the status details + */ + public String statusDetails() { + return this.statusDetails; + } + + /** + * Get the error. + * + * @return the error + */ + public Error error() { + return this.error; + } + + /** + * Get the target. + * + * @return the target + */ + public String target() { + return this.target; + } + + /** + * Get the requestId. + * + * @return the requestId + */ + public String requestId() { + return this.requestId; + } + + @JsonProperty("issuer") + private void unpackIssuerParameters(Map issuerParameters) { + issuerName = (String) issuerParameters.get("name"); + certificateType = (String) issuerParameters.get("cty"); + certificateTransparency = (Boolean) issuerParameters.get("cert_transparency"); + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificatePolicy.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificatePolicy.java new file mode 100644 index 000000000000..f69c6a00fa2a --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificatePolicy.java @@ -0,0 +1,472 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.models; + +import com.azure.security.keyvault.certificates.models.webkey.KeyCurveName; +import com.azure.security.keyvault.certificates.models.webkey.KeyType; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * The Certificate Management policy for the {@link Certificate certificate}. + */ +public final class CertificatePolicy { + + /** + * The subject name. Should be a valid X509 distinguished Name. + */ + @JsonProperty(value = "subject") + private String subjectName; + + /** + * The subject alternative names. + */ + @JsonProperty(value = "sans") + private SubjectAlternativeNames subjectAlternativeNames; + + /** + * The duration that the ceritifcate is valid in months. + */ + @JsonProperty(value = "validity_months") + private Integer validityInMonths; + + /** + * Actions that will be performed by Key Vault over the lifetime of a + * certificate. + */ + private List lifetimeActions; + + /** + * Name of the referenced issuer object or reserved names; for example, + * 'Self' or 'Unknown'. + */ + @JsonProperty(value = "name") + private String issuerName; + + /** + * Type of certificate to be requested from the issuer provider. + */ + @JsonProperty(value = "cty") + private String issuerCertificateTypeRequest; + + /** + * Indicates if the certificates generated under this policy should be + * published to certificate transparency logs. + */ + @JsonProperty(value = "cert_transparency") + private Boolean certificateTransparency; + + /** + * The content type of the secret. + */ + private SecretContentType secretContentType; + + /** + * Creation time in UTC. + */ + private OffsetDateTime created; + + /** + * Last updated time in UTC. + */ + private OffsetDateTime updated; + + /** + * Determines whether the object is enabled. + */ + private Boolean enabled; + + /** + * The key configuration of the key backing the certificate. + */ + private KeyOptions keyOptions; + + /** + * Creates certificate policy. + * @param issuerName The issuer name to set. + * @param subjectName The subject name to set. + */ + public CertificatePolicy(String issuerName, String subjectName) { + this.issuerName = issuerName; + this.subjectName = subjectName; + } + + CertificatePolicy() { + + } + + /** + * Get the the UTC time at which certificate policy was created. + * + * @return the created UTC time. + */ + public OffsetDateTime created() { + return created; + } + + /** + * Get the UTC time at which certificate policy was last updated. + * + * @return the last updated UTC time. + */ + public OffsetDateTime updated() { + return updated; + } + + + /** + * Get the enabled status. + * + * @return the enabled status + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled status. + * @param enabled The enabled status to set. + * @return The enabled status + */ + public CertificatePolicy enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the contentType value. + * + * @return the contentType value + */ + public SecretContentType secretContentType() { + return this.secretContentType; + } + + + /** + * Set the content type. + * + * @param secretContentType the content type value to set + * @return the CertificatePolicy object itself. + */ + public CertificatePolicy secretContentType(SecretContentType secretContentType) { + this.secretContentType = secretContentType; + return this; + } + + /** + * Set the subject value. + * + * @param subjectName the subject value to set + * @return the CertificatePolicy object itself. + */ + public CertificatePolicy subjectName(String subjectName) { + this.subjectName = subjectName; + return this; + } + + /** + * Get the subjectAlternativeNames. + * + * @return the subjectAlternativeNames. + */ + public SubjectAlternativeNames subjectAlternativeNames() { + return subjectAlternativeNames; + } + + /** + * Set the subjectAlternativeNames. + * + * @param subjectAlternativeNames the subjectAlternativeNames to set + * @return the CertificatePolicy object itself. + */ + public CertificatePolicy subjectAlternativeNames(SubjectAlternativeNames subjectAlternativeNames) { + this.subjectAlternativeNames = subjectAlternativeNames; + return this; + } + + /** + * Set the validityInMonths value. + * + * @param validityInMonths the validityInMonths value to set + * @return the CertificatePolicy object itself. + */ + public CertificatePolicy validityInMonths(Integer validityInMonths) { + this.validityInMonths = validityInMonths; + return this; + } + + /** + * Get the Key Configuration. + * @return the Key Configuration + */ + public KeyOptions keyOptions() { + return keyOptions; + } + + /** + * Set the Ec Key Configuration. + * + * @param ecKeyOptions the ec key options to set + * @return the CertificatePolicy object itself. + */ + public CertificatePolicy keyOptions(EcKeyOptions ecKeyOptions) { + this.keyOptions = ecKeyOptions; + return this; + } + + /** + * Set the Rsa Key Configuration. + * + * @param rsaKeyOptions the rsa key options to set. + * @return the CertificatePolicy object itself. + */ + public CertificatePolicy keyOptions(RsaKeyOptions rsaKeyOptions) { + this.keyOptions = rsaKeyOptions; + return this; + } + + /** + * Set the name value. + * + * @param issuerName the name value to set + * @return the CertificatePolicy object itself. + */ + public CertificatePolicy issuerName(String issuerName) { + this.issuerName = issuerName; + return this; + } + + /** + * Set the certificateType to request from the issuer. + * + * @param issuerCertificateTypeRequest the certificateType to request from issuer. + * @return the CertificatePolicy object itself. + */ + public CertificatePolicy issuerCertificateTypeRequest(String issuerCertificateTypeRequest) { + this.issuerCertificateTypeRequest = issuerCertificateTypeRequest; + return this; + } + + /** + * Set the certificateTransparency value. + * + * @param certificateTransparency the certificateTransparency value to set + * @return the CertificatePolicy object itself. + */ + public CertificatePolicy certificateTransparency(Boolean certificateTransparency) { + this.certificateTransparency = certificateTransparency; + return this; + } + + /** + * Get the subject value. + * + * @return the subject value + */ + public String subjectName() { + return this.subjectName; + } + + /** + * Get the validityInMonths value. + * + * @return the validityInMonths value + */ + public Integer validityInMonths() { + return this.validityInMonths; + } + + /** + * Get the issuer name. + * + * @return the Issuer name. + */ + public String issuerName() { + return issuerName; + } + + /** + * Get the certificateType value. + * + * @return the certificateType value + */ + public String issuerCertificateTypeRequest() { + return this.issuerCertificateTypeRequest; + } + + /** + * Get the certificateTransparency value. + * + * @return the certificateTransparency value + */ + public Boolean certificateTransparency() { + return this.certificateTransparency; + } + + /** + * Set the lifetime actions + * @param actions the lifetime actions to set. + * @return the certificate policy object itself. + */ + public CertificatePolicy lifetimeActions(LifetimeAction... actions) { + this.lifetimeActions = Arrays.asList(actions); + return this; + } + + /** + * Get the lifetime actions + * @return the lifetime actions + */ + public List lifetimeActions() { + return this.lifetimeActions; + } + + + @JsonProperty("key_props") + private void unpackKeyProperties(Map keyProps) { + + String keyType = (String) keyProps.get("kty"); + Integer keySize = (Integer) keyProps.get("key_size"); + Boolean exportable = (Boolean) keyProps.get("exportable"); + Boolean reuseKey = (Boolean) keyProps.get("reuseKey"); + KeyCurveName curve = keyProps.containsKey("crv") ? KeyCurveName.fromString((String) keyProps.get("crv")) : null; + + if (keyOptions == null) { + keyOptions = new KeyOptions(); + } + + keyOptions + .exportable(exportable) + .reuseKey(reuseKey); + + switch (keyType) { + case "RSA": + keyOptions + .keySize(keySize) + .keyType(KeyType.RSA); + break; + + case "RSA-HSM" : + keyOptions + .keySize(keySize) + .keyType(KeyType.RSA_HSM); + break; + + case "EC" : + keyOptions + .curve(curve) + .keyType(KeyType.EC) + .curve(curve); + break; + + case "EC-HSM" : + keyOptions + .curve(curve) + .keyType(KeyType.EC_HSM); + break; + default: + // should not reach here + break; + } + } + + + @JsonProperty("x509_props") + @SuppressWarnings("unchecked") + private void unpackX509Properties(Map x509Props) { + validityInMonths = (Integer) x509Props.get("validity_months"); + subjectName = (String) x509Props.get("subject"); + + if (keyOptions == null) { + keyOptions = new KeyOptions(); + } + + keyOptions + .enhancedKeyUsage(x509Props.containsKey("ekus") ? parseEnhancedKeyUsage((List) x509Props.get("ekus")) : null) + .keyUsage(x509Props.containsKey("key_usage") ? parseKeyUsage((List) x509Props.get("key_usage")) : null); + } + + @SuppressWarnings("unchecked") + private List parseKeyUsage(List keyUsages) { + List output = new ArrayList<>(); + + for (Object keyUsage : keyUsages) { + KeyUsageType type = KeyUsageType.fromString((String) keyUsage); + output.add(type); + } + return output; + } + + @SuppressWarnings("unchecked") + private List parseEnhancedKeyUsage(List keyUsages) { + List output = new ArrayList<>(); + + for (Object keyUsage : keyUsages) { + output.add((String) keyUsage); + } + return output; + } + + @JsonProperty("secret_props") + private void unpackSecretProperties(Map secretProps) { + this.secretContentType = secretProps.containsKey("contentType") ? SecretContentType.fromString((String) secretProps.get("contentType")) : null; + } + + @JsonProperty("issuer") + private void unpackIssuerProperties(Map issuerProps) { + this.issuerName = (String) issuerProps.get("name"); + this.issuerCertificateTypeRequest = (String) issuerProps.get("cty"); + this.certificateTransparency = (Boolean) issuerProps.get("cert_transparency"); + } + + @JsonProperty("lifetime_actions") + @SuppressWarnings("unchecked") + private void unpackLifeTimeActions(List lifetimeActions) { + List actions = new ArrayList<>(); + + for (Object action: lifetimeActions) { + Map map = (Map) action; + Integer lifetimePercentageTrigger = null; + Integer daysBeforeExpiryTrigger = null; + LifetimeActionType actionType = null; + if (map.containsKey("trigger")) { + Map trigger = (Map) map.get("trigger"); + lifetimePercentageTrigger = trigger.containsKey("lifetime_percentage") ? (Integer) trigger.get("lifetime_percentage") : null; + daysBeforeExpiryTrigger = trigger.containsKey("days_before_expiry") ? (Integer) trigger.get("days_before_expiry") : null; + } + + if (map.containsKey("action")) { + Map lifetimeAction = (Map) map.get("action"); + actionType = lifetimeAction.containsKey("action_type") ? LifetimeActionType.fromString((String) lifetimeAction.get("action_type")) : null; + } + actions.add(new LifetimeAction(actionType).lifetimePercentage(lifetimePercentageTrigger).daysBeforeExpiry(daysBeforeExpiryTrigger)); + } + + this.lifetimeActions = actions; + } + + + @JsonProperty("attributes") + private void unpackAttributes(Map attributes) { + this.enabled = (Boolean) attributes.get("enabled"); + this.created = epochToOffsetDateTime(attributes.get("created")); + this.updated = epochToOffsetDateTime(attributes.get("updated")); + } + + private OffsetDateTime epochToOffsetDateTime(Object epochValue) { + if (epochValue != null) { + Instant instant = Instant.ofEpochMilli(((Number) epochValue).longValue() * 1000L); + return OffsetDateTime.ofInstant(instant, ZoneOffset.UTC); + } + return null; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/Contact.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/Contact.java new file mode 100644 index 000000000000..0052356f33af --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/Contact.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.azure.security.keyvault.certificates.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The contact information for the vault certificates. + */ +public final class Contact { + /** + * Email addresss. + */ + @JsonProperty(value = "email") + private String emailAddress; + + /** + * Name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Phone number. + */ + @JsonProperty(value = "phone") + private String phone; + + /** + * Creates a new contact instance. + * + * @param name The name of the contact + * @param emailAddress The email address of the contact + * @param phone The phone number of the contact. + */ + public Contact(String name, String emailAddress, String phone) { + this.name = name; + this.emailAddress = emailAddress; + this.phone = phone; + } + + /** + * Creates a new contact instance. + * + * @param name The name of the contact + * @param emailAddress The email address of the contact + */ + public Contact(String name, String emailAddress) { + this.name = name; + this.emailAddress = emailAddress; + } + + Contact() { } + + /** + * Get the emailAddress. + * + * @return the emailAddress + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the phone info. + * + * @return the phone info + */ + public String phone() { + return this.phone; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/DeletedCertificate.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/DeletedCertificate.java new file mode 100644 index 000000000000..3d49ff4e0c6e --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/DeletedCertificate.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.models; + + +import com.azure.security.keyvault.certificates.CertificateAsyncClient; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; + +/** + * Deleted Certificate is the resource consisting of name, recovery id, deleted date, scheduled purge date and its attributes inherited from {@link CertificateBase}. + * It is managed by Secret Service. + * + * @see CertificateAsyncClient + */ +public final class DeletedCertificate extends CertificateBase { + + /** + * The url of the recovery object, used to identify and recover the deleted + * certificate. + */ + @JsonProperty(value = "recoveryId") + private String recoveryId; + + /** + * The time when the certificate is scheduled to be purged, in UTC. + */ + private OffsetDateTime scheduledPurgeDate; + + /** + * The time when the certificate was deleted, in UTC. + */ + private OffsetDateTime deletedDate; + + /** + * The Certificate policy. + */ + @JsonProperty("policy") + private CertificatePolicy certificatePolicy; + + /** + * Get the recoveryId identifier. + * + * @return the recoveryId identifier. + */ + public String recoveryId() { + return this.recoveryId; + } + + /** + * Set the recoveryId identifier. + * + * @param recoveryId The recoveryId identifier to set + * @return the DeletedSecret object itself. + */ + public DeletedCertificate recoveryId(String recoveryId) { + this.recoveryId = recoveryId; + return this; + } + + /** + * Get the scheduled purge UTC time. + * + * @return the scheduledPurgeDate UTC time. + */ + public OffsetDateTime scheduledPurgeDate() { + return scheduledPurgeDate; + } + + /** + * Get the deleted UTC time. + * + * @return the deletedDate UTC time. + */ + public OffsetDateTime deletedDate() { + return this.deletedDate; + } + + /** + * Get the certificate policy. + * + * @return the certificate policy. + */ + public CertificatePolicy certificatePolicy() { + return this.certificatePolicy; + } + + /** + * Unpacks the scheduledPurageDate json response. Converts the {@link Long scheduledPurgeDate} epoch second value to OffsetDateTime and updates the + * value of class variable scheduledPurgeDate. + */ + @JsonProperty("scheduledPurgeDate") + private void unpackScheduledPurgeDate(Long scheduledPurgeDate) { + this.scheduledPurgeDate = OffsetDateTime.ofInstant(Instant.ofEpochMilli(scheduledPurgeDate * 1000L), ZoneOffset.UTC); + } + + /** + * Unpacks the deletedDate json response. Converts the {@link Long deletedDate} epoch second value to OffsetDateTime and updates the + * value of class variable deletedDate. + */ + @JsonProperty("deletedDate") + private void deletedDate(Long deletedDate) { + this.deletedDate = OffsetDateTime.ofInstant(Instant.ofEpochMilli(deletedDate * 1000L), ZoneOffset.UTC); + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/EcKeyOptions.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/EcKeyOptions.java new file mode 100644 index 000000000000..bf695a1083e1 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/EcKeyOptions.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.models; + +import com.azure.security.keyvault.certificates.models.webkey.KeyCurveName; +import com.azure.security.keyvault.certificates.models.webkey.KeyType; + +import java.util.List; + +/** + * Represents EcKeyOptions configuration for Certificate policy. + */ +public final class EcKeyOptions extends KeyOptions { + + private boolean hsm; + + public EcKeyOptions() { + this.keyType = KeyType.EC; + } + + /** + * Set the curve value. + * + * @param curve the curve value to set + * @return the EcKeyOptions object itself. + */ + public EcKeyOptions curve(KeyCurveName curve) { + super.curve = curve; + return this; + } + + /** + * Set the key usage. + * + * @param keyUsage the key usage value to set + * @return the EcKeyOptions object itself. + */ + public EcKeyOptions keyUsage(KeyUsageType... keyUsage) { + super.keyUsage(keyUsage); + return this; + } + + /** + * Set the enhanced key usage. + * + * @param ekus the ekus value to set + * @return the EcKeyOptions object itself. + */ + public EcKeyOptions enhancedKeyUsage(List ekus) { + super.enhancedKeyUsage(ekus); + return this; + } + + /** + * Set the exportable value. + * + * @param exportable the exportable value to set + * @return the EcKeyOptions object itself. + */ + public EcKeyOptions exportable(Boolean exportable) { + super.exportable(exportable); + return this; + } + + /** + * Indicate whether the key should e reused or not. + * + * @param reuseKey the reuse key value to set. + * @return the EcKeyOptions object itself. + */ + public EcKeyOptions reuseKey(Boolean reuseKey) { + super.reuseKey(reuseKey); + return this; + } + + /** + * Get the hsm indicator of the key. + * @return the hsm indicator. + */ + public boolean hsm() { + return this.hsm; + } + + /** + * Indicate if the Rsa key is of hsm type or not. + * @param hsm The hsm indicator value to set. + * @return the EcKeyOptions object itself. + */ + public EcKeyOptions hsm(boolean hsm) { + this.hsm = hsm; + this.keyType = hsm ? KeyType.EC_HSM : KeyType.EC; + return this; + } + + /* + * Set the key usage. + */ + EcKeyOptions keyUsage(List keyUsage) { + this.keyUsage = keyUsage; + return this; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/Issuer.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/Issuer.java new file mode 100644 index 000000000000..742e65ffc188 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/Issuer.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * Represents certificate Issuer with all of its properties. + */ +public final class Issuer extends IssuerBase { + + /** + * The user name/account name/account id. + */ + private String accountId; + + /** + * The password/secret/account key. + */ + private String password; + + /** + * The organization Id. + */ + private String organizationId; + + /** + * The administrators. + */ + private List administrators; + + /** + * Creates an instance of the issuer. + * + * @param name The name of the issuer. + * @param provider The provider of the issuer. + */ + public Issuer(String name, String provider) { + super(name, provider); + } + + Issuer() { } + + /** + * Get the account id of the isssuer. + * @return the account id + */ + public String accountId() { + return accountId; + } + + /** + * Set the account id of the isssuer. + * @param accountId the account id to set. + * @return the Issuer object itself. + */ + public Issuer accountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Get the password of the isssuer. + * @return the password + */ + public String password() { + return password; + } + + /** + * Set the password id of the isssuer. + * @param password the password set. + * @return the Issuer object itself. + */ + public Issuer password(String password) { + this.password = password; + return this; + } + + /** + * Get the organization id of the isssuer. + * @return the organization id + */ + public String organizationId() { + return organizationId; + } + + /** + * Set the organization id of the issuer. + * @param organizationId the org id to set. + * @return the Issuer object itself. + */ + public Issuer organizationId(String organizationId) { + this.organizationId = organizationId; + return this; + } + + /** + * Get the administrators of the isssuer. + * @return the administrators + */ + public List administrators() { + return administrators; + } + + /** + * Set the administrators of the isssuer. + * @param administrators the administrators to set. + * @return the Issuer object itself. + */ + public Issuer administrators(List administrators) { + this.administrators = administrators; + return this; + } + + @JsonProperty(value = "credentials") + private void unpackCredentials(Map credentials) { + this.accountId = (String) credentials.get("account_id"); + this.password = (String) credentials.get("pwd"); + } + + @JsonProperty(value = "org_details") + @SuppressWarnings("unchecked") + private void unpacOrganizationalDetails(Map orgDetails) { + this.administrators = orgDetails.containsKey("admin_details") ? parseAdministrators((List) orgDetails.get("admin_details")) : null; + this.organizationId = (String) orgDetails.get("id"); + } + + @SuppressWarnings("unchecked") + private List parseAdministrators(List admins) { + List output = new ArrayList<>(); + + for (Object admin : admins) { + LinkedHashMap map = (LinkedHashMap) admin; + String firstName = map.containsKey("first_name") ? map.get("first_name") : ""; + String lastName = map.containsKey("last_name") ? map.get("last_name") : ""; + String email = map.containsKey("email") ? map.get("email") : ""; + String phone = map.containsKey("phone") ? map.get("phone") : ""; + output.add(new Administrator(firstName, lastName, email, phone)); + } + return output; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/IssuerBase.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/IssuerBase.java new file mode 100644 index 000000000000..0eec0860a9a8 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/IssuerBase.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.net.MalformedURLException; +import java.net.URL; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.Map; + +/** + * Represents base properties of an {@link Issuer}. + */ +public class IssuerBase { + /** + * The issuer id. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The issuer provider. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Name of the referenced issuer object or reserved names; for example, + * 'Self' or 'Unknown'. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Determines whether the issuer is enabled. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /** + * The created UTC time. + */ + private OffsetDateTime created; + + /** + * The updated UTC time. + */ + private OffsetDateTime updated; + + public IssuerBase(String name, String provider) { + this.name = name; + this.provider = provider; + } + + IssuerBase() { + + } + + /** + * Get the id of the issuer. + * @return the identifier. + */ + public String id() { + return id; + } + + /** + * Set the issuer identifier + * @param id The issuer identifier + */ + public void id(String id) { + this.id = id; + } + + /** + * Get the issuer provider + * @return the issuer provider + */ + public String provider() { + return provider; + } + + /** + * Get the issuer name + * @return the issuer name + */ + public String name() { + return name; + } + + /** + * Get the enabled status + * @return the enabled status + */ + public Boolean enabled() { + return enabled; + } + + /** + * Set the enabled status + * @param enabled the enabled status to set + */ + public void enabled(Boolean enabled) { + this.enabled = enabled; + } + + /** + * Get tje created UTC time. + * @return the created UTC time. + */ + public OffsetDateTime created() { + return created; + } + + /** + * Get the updated UTC time. + * @return the updated UTC time. + */ + public OffsetDateTime updated() { + return updated; + } + + @JsonProperty("attributes") + private void unpackBaseAttributes(Map attributes) { + this.enabled = (Boolean) attributes.get("enabled"); + this.created = epochToOffsetDateTime(attributes.get("created")); + this.updated = epochToOffsetDateTime(attributes.get("updated")); + } + + private OffsetDateTime epochToOffsetDateTime(Object epochValue) { + if (epochValue != null) { + Instant instant = Instant.ofEpochMilli(((Number) epochValue).longValue() * 1000L); + return OffsetDateTime.ofInstant(instant, ZoneOffset.UTC); + } + return null; + } + + @JsonProperty(value = "id") + private void unpackId(String id) { + if (id != null && id.length() > 0) { + this.id = id; + try { + URL url = new URL(id); + String[] tokens = url.getPath().split("/"); + this.name = (tokens.length >= 4 ? tokens[3] : null); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + } + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/KeyOptions.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/KeyOptions.java new file mode 100644 index 000000000000..771cf8676197 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/KeyOptions.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.models; + +import com.azure.security.keyvault.certificates.models.webkey.KeyCurveName; +import com.azure.security.keyvault.certificates.models.webkey.KeyType; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Arrays; +import java.util.List; + +/** + * Represents the key options configuration in certificate policy. + */ +public class KeyOptions { + + /** + * Indicates if the private key can be exported. + */ + @JsonProperty(value = "exportable") + Boolean exportable; + + /** + * The type of key pair to be used for the certificate. Possible values + * include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct'. + */ + @JsonProperty(value = "kty") + KeyType keyType; + + /** + * The key size in bits. For example: 2048, 3072, or 4096 for RSA. + */ + @JsonProperty(value = "key_size") + Integer keySize; + + /** + * Indicates if the same key pair will be used on certificate renewal. + */ + @JsonProperty(value = "reuse_key") + Boolean reuseKey; + + /** + * Elliptic curve name. For valid values, see KeyCurveName. Possible + * values include: 'P-256', 'P-384', 'P-521', 'P-256K'. + */ + @JsonProperty(value = "crv") + KeyCurveName curve; + + /** + * List of key usages. + */ + @JsonProperty(value = "key_usage") + List keyUsage; + + /** + * The enhanced key usage. + */ + @JsonProperty(value = "ekus") + List enhancedKeyUsage; + + public KeyOptions(KeyType keyType) { + this.keyType = keyType; + } + + KeyOptions() { } + + /** + * Get the keyUsage value. + * + * @return the keyUsage value + */ + public List keyUsage() { + return this.keyUsage; + } + + /** + * Set the key usage. + * + * @param keyUsage the keyUsage value to set + * @return the X509CertificateProperties object itself. + */ + public KeyOptions keyUsage(KeyUsageType... keyUsage) { + this.keyUsage = Arrays.asList(keyUsage); + return this; + } + + /** + * Get the enhanced key usage value. + * + * @return the enhanced key usage value + */ + public List ekus() { + return this.enhancedKeyUsage; + } + + /** + * Set the enhanced key usage value. + * + * @param ekus the ekus value to set + * @return the X509CertificateProperties object itself. + */ + public KeyOptions enhancedKeyUsage(List ekus) { + this.enhancedKeyUsage = ekus; + return this; + } + + /** + * Get the exportable value. + * + * @return the exportable value + */ + public Boolean exportable() { + return this.exportable; + } + + /** + * Set the exportable value. + * + * @param exportable the exportable value to set + * @return the KeyProperties object itself. + */ + public KeyOptions exportable(Boolean exportable) { + this.exportable = exportable; + return this; + } + + /** + * Get the keyType value. + * + * @return the keyType value + */ + public KeyType keyType() { + return this.keyType; + } + + /** + * Get the keySize value. + * + * @return the keySize value + */ + public Integer keySize() { + return this.keySize; + } + + /** + * Get the reuseKey value. + * + * @return the reuseKey value + */ + public Boolean reuseKey() { + return this.reuseKey; + } + + /** + * Set the reuseKey value. + * + * @param reuseKey the reuseKey value to set + * @return the KeyProperties object itself. + */ + public KeyOptions reuseKey(Boolean reuseKey) { + this.reuseKey = reuseKey; + return this; + } + + /** + * Get the curve value. + * + * @return the curve value + */ + public KeyCurveName curve() { + return this.curve; + } + + /* + * Set the key usage. + */ + KeyOptions keyUsage(List keyUsage) { + this.keyUsage = keyUsage; + return this; + } + + /* + * Set the key size. + */ + KeyOptions keySize(Integer keySize) { + this.keySize = keySize; + return this; + } + + /* + * Set the key curve. + */ + KeyOptions curve(KeyCurveName curve) { + this.curve = curve; + return this; + } + + /* + * Set the key type. + */ + KeyOptions keyType(KeyType keyType) { + this.keyType = keyType; + return this; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/KeyUsageType.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/KeyUsageType.java new file mode 100644 index 000000000000..96c9d2211005 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/KeyUsageType.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.models; + +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for KeyUsageType. + */ +public enum KeyUsageType { + DIGITAL_SIGNATURE("digitalSignature"), + + NON_REPUDIATION("nonRepudiation"), + + KEY_ENCIPHERMENT("keyEncipherment"), + + DATA_ENCIPHERMENT("dataEncipherment"), + + KEY_AGREEMENT("keyAgreement"), + + KEY_CERT_SIGN("keyCertSign"), + + CRL_SIGN("cRLSign"), + + ENCIPHER_ONLY("encipherOnly"), + + DECIPHER_ONLY("decipherOnly"); + + private String value; + + /** + * Creates a custom value for KeyUsageType. + * @param value the custom value + */ + KeyUsageType(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return value; + } + + /** + * Return the KeyUsageType which maps to {@code value}. + * @param value The value whose equivalent KeyUsageType is needed. + * @return the KeyUsageType + */ + public static KeyUsageType fromString(String value) { + for (KeyUsageType keyUsageType : values()) { + if (keyUsageType.value.equalsIgnoreCase(value)) { + return keyUsageType; + } + } + return null; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/LifetimeAction.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/LifetimeAction.java new file mode 100644 index 000000000000..141a8e3a184e --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/LifetimeAction.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Map; + +/** + * Represents a LifeTimeAction in {@link CertificatePolicy} + */ +public final class LifetimeAction { + + /** + * The type of the action. Possible values include: 'EmailContacts', + * 'AutoRenew'. + */ + private LifetimeActionType lifetimeActionType; + + /** + * Percentage of lifetime at which to trigger. Value should be between 1 + * and 99. + */ + private Integer lifetimePercentage; + + /** + * Days before expiry to attempt renewal. Value should be between 1 and + * validity_in_months multiplied by 27. If validity_in_months is 36, then + * value should be between 1 and 972 (36 * 27). + */ + private Integer daysBeforeExpiry; + + LifetimeAction() { } + + + public LifetimeAction(LifetimeActionType lifetimeActionType) { + this.lifetimeActionType = lifetimeActionType; + } + + /** + * Get the lifetimePercentage value. + * + * @return the lifetimePercentage value + */ + public Integer lifetimePercentage() { + return this.lifetimePercentage; + } + + /** + * Set the lifetimePercentage value. + * + * @param lifetimePercentage The lifetimePercentage value to set + * @return the Trigger object itself. + */ + public LifetimeAction lifetimePercentage(Integer lifetimePercentage) { + this.lifetimePercentage = lifetimePercentage; + return this; + } + + /** + * Get the daysBeforeExpiry value. + * + * @return the daysBeforeExpiry value + */ + public Integer daysBeforeExpiry() { + return this.daysBeforeExpiry; + } + + /** + * Set the daysBeforeExpiry value. + * + * @param daysBeforeExpiry The daysBeforeExpiry value to set + * @return the Trigger object itself. + */ + public LifetimeAction daysBeforeExpiry(Integer daysBeforeExpiry) { + this.daysBeforeExpiry = daysBeforeExpiry; + return this; + } + + /** + * Get the lifetimeActionType value. + * + * @return the lifetimeActionType value + */ + public LifetimeActionType actionType() { + return this.lifetimeActionType; + } + + /** + * Set the lifetimeActionType value. + * + * @param lifetimeActionType The lifetimeActionType value to set + * @return the Action object itself. + */ + public LifetimeAction actionType(LifetimeActionType lifetimeActionType) { + this.lifetimeActionType = lifetimeActionType; + return this; + } + + @JsonProperty(value = "action") + private void unpackAction(Map action) { + lifetimeActionType = LifetimeActionType.fromString((String) action.get("action_type")); + } + + @JsonProperty(value = "trigger") + private void unpackTrigger(Map triggerProps) { + lifetimePercentage = (Integer) triggerProps.get("lifetime_percentage"); + daysBeforeExpiry = (Integer) triggerProps.get("days_before_expiry"); + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/LifetimeActionType.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/LifetimeActionType.java new file mode 100644 index 000000000000..c6843425957e --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/LifetimeActionType.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines action values for type of {@link LifetimeAction} in {@link CertificatePolicy}. + */ +public enum LifetimeActionType { + + /** Enum value EmailContacts. */ + EMAIL_CONTACTS("EmailContacts"), + + /** Enum value AutoRenew. */ + AUTO_RENEW("AutoRenew"); + + /** The actual serialized value for a LifetimeActionType instance. */ + private String value; + + LifetimeActionType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a LifetimeActionType instance. + * + * @param value the serialized value to parse. + * @return the parsed LifetimeActionType object, or null if unable to parse. + */ + @JsonCreator + public static LifetimeActionType fromString(String value) { + LifetimeActionType[] items = LifetimeActionType.values(); + for (LifetimeActionType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * Get the string value of the enum. + * @return the string value of enum. + */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/MergeCertificateOptions.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/MergeCertificateOptions.java new file mode 100644 index 000000000000..2130821dae2b --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/MergeCertificateOptions.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.models; + +import java.util.List; +import java.util.Map; + +/** + * Represents Merge Certificate Configuration to merge certificates in key vault. + */ +public class MergeCertificateOptions { + + /** + * The name of the certificate. + */ + private final String certificateName; + + /** + * The certificate or the certificate chain to merge. + */ + private final List x509Certificates; + + /** + * Determines whether the object is enabled. + */ + private boolean enabled; + + /** + * Application specific metadata in the form of key-value pairs. + */ + private Map tags; + + public MergeCertificateOptions(String certificateName, List x509Certificates) { + this.certificateName = certificateName; + this.x509Certificates = x509Certificates; + } + + /** + * Set the tags to be associated with the secret. + * + * @param tags The tags to set + * @return the MergeCertificateOptions object itself. + */ + public MergeCertificateOptions tags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the enabled status. + * @param enabled The enabled status to set. + * @return the MergeCertificateOptions object itself. + */ + public MergeCertificateOptions enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the enabled status. + * + * @return the enabled status + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Get the certificate name. + * + * @return the certificate name. + */ + public String name() { + return this.certificateName; + } + + /** + * Get the certificate or certificate chain to merge. + * + * @return the x509 certficiates. + */ + public List x509Certificates() { + return this.x509Certificates; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/RsaKeyOptions.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/RsaKeyOptions.java new file mode 100644 index 000000000000..7f16f5072963 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/RsaKeyOptions.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.models; + +import com.azure.security.keyvault.certificates.models.webkey.KeyType; + +import java.util.List; + +/** + * Represents RsaKeyOptions configuration for Certificate policy. + */ +public final class RsaKeyOptions extends KeyOptions { + + private boolean hsm; + + public RsaKeyOptions() { + this.keyType = KeyType.RSA; + } + + /** + * Set the key usage. + * + * @param keyUsage the key usage value to set + * @return the RsaKeyOptions object itself. + */ + public RsaKeyOptions keyUsage(KeyUsageType... keyUsage) { + super.keyUsage(keyUsage); + return this; + } + + /** + * Set the enhanced key usage. + * + * @param ekus the ekus value to set + * @return the RsaKeyOptions object itself. + */ + public RsaKeyOptions enhancedKeyUsage(List ekus) { + super.enhancedKeyUsage(ekus); + return this; + } + + /** + * Set the exportable value. + * + * @param exportable the exportable value to set + * @return the RsaKeyOptions object itself. + */ + public RsaKeyOptions exportable(Boolean exportable) { + super.exportable(exportable); + return this; + } + + /** + * Set the keySize value. + * + * @param keySize the keySize value to set + * @return the RsaKeyOptions object itself. + */ + public RsaKeyOptions keySize(Integer keySize) { + super.keySize = keySize; + return this; + } + + /** + * Indicate whether the key should e reused or not. + * + * @param reuseKey the reuse key value to set. + * @return the RsaKeyOptions object itself. + */ + public RsaKeyOptions reuseKey(Boolean reuseKey) { + super.reuseKey(reuseKey); + return this; + } + + /** + * Get the hsm indicator of the key. + * @return the hsm indicator. + */ + public boolean hsm() { + return this.hsm; + } + + /** + * Indicate if the Rsa key is of hsm type or not. + * @param hsm The hsm indicator value to set. + * @return the RsaKeyOptions object itself. + */ + public RsaKeyOptions hsm(boolean hsm) { + this.hsm = hsm; + this.keyType = hsm ? KeyType.RSA_HSM : KeyType.RSA; + return this; + } + + /* + * Set the key usage. + */ + RsaKeyOptions keyUsage(List keyUsage) { + this.keyUsage = keyUsage; + return this; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/SecretContentType.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/SecretContentType.java new file mode 100644 index 000000000000..23f8ea765434 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/SecretContentType.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.models; + +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SecretContentType. + */ +public enum SecretContentType { + PKCS12("application/x-pkcs12"), + + PEM("application/x-pem-file"); + + private String value; + + /** + * Creates a custom value for KeyUsageType. + * @param value the custom value + */ + SecretContentType(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return value; + } + + /** + * Parse content type from string. + * @param contentType The string value to parse content type from. + * @return the SecretContentType + */ + public static SecretContentType fromString(String contentType) { + for (SecretContentType secretContentType : values()) { + if (secretContentType.value.equals(contentType)) { + return secretContentType; + } + } + return null; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/SubjectAlternativeNames.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/SubjectAlternativeNames.java new file mode 100644 index 000000000000..5b746199fbde --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/SubjectAlternativeNames.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.models; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +/** + * The subject alternate names of Certificate Policy. + */ +public final class SubjectAlternativeNames { + /** + * Email addresses. + */ + @JsonProperty(value = "emails") + private List emails; + + /** + * Domain names. + */ + @JsonProperty(value = "dns_names") + private List dnsNames; + + /** + * User principal names. + */ + @JsonProperty(value = "upns") + private List upns; + + /** + * Get the emails. + * + * @return the emails + */ + public List emails() { + return this.emails; + } + + /* + * Constructor to setup the SubjectAlternativeNames + * @param sans the subject alternative names content + * @param sansType the type of the content. + */ + SubjectAlternativeNames(List sans, SubjectAlternativeNamesType sansType) { + switch (sansType) { + case EMAILS: + this.emails = sans; + break; + case DNS_NAMES: + this.dnsNames = sans; + break; + case UPNS: + this.upns = sans; + break; + default: + //should never reach here + return; + } + } + + /** + * Create Subject Alternative names with emails. + * + * @param emails the emails to set + * @return the SubjectAlternativeNames. + */ + public static SubjectAlternativeNames fromEmails(List emails) { + return new SubjectAlternativeNames(emails, SubjectAlternativeNamesType.EMAILS); + } + + /** + * Get the dnsNames. + * + * @return the dnsNames + */ + public List dnsNames() { + return this.dnsNames; + } + + /** + * Create Subject Alternative names with dns names. + * + * @param dnsNames the dns names to set + * @return the SubjectAlternativeNames. + */ + public static SubjectAlternativeNames fromDnsNames(List dnsNames) { + return new SubjectAlternativeNames(dnsNames, SubjectAlternativeNamesType.DNS_NAMES); + } + + /** + * Get the upns value. + * + * @return the upns value + */ + public List upns() { + return this.upns; + } + + /** + * Create Subject Alternative names with User Principal names. + * + * @param upns the user principal names value to set + * @return the SubjectAlternativeNames. + */ + public static SubjectAlternativeNames fromUpns(List upns) { + return new SubjectAlternativeNames(upns, SubjectAlternativeNamesType.UPNS); + } + + private enum SubjectAlternativeNamesType { + EMAILS, + DNS_NAMES, + UPNS; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/package-info.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/package-info.java new file mode 100644 index 000000000000..7ce7a346ff69 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/package-info.java @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +/** + * This package contains model classes for Azure Key Vault Certificates + */ +package com.azure.security.keyvault.certificates.models; diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/webkey/Base64UrlJsonDeserializer.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/webkey/Base64UrlJsonDeserializer.java new file mode 100644 index 000000000000..395a7fb7c259 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/webkey/Base64UrlJsonDeserializer.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.models.webkey; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import org.apache.commons.codec.binary.Base64; + +import java.io.IOException; + +/** + * The base64 URL JSON deserializer. + */ +class Base64UrlJsonDeserializer extends JsonDeserializer { + + static final Base64 BASE64 = new Base64(-1, null, true); + + @Override + public byte[] deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + String text = jp.getText(); + if (text != null) { + return BASE64.decode(text); + } + return null; + } + +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/webkey/Base64UrlJsonSerializer.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/webkey/Base64UrlJsonSerializer.java new file mode 100644 index 000000000000..6547e82c074e --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/webkey/Base64UrlJsonSerializer.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.models.webkey; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import org.apache.commons.codec.binary.Base64; + +import java.io.IOException; + +/** + * The base64 URL JSON serializer. + */ +class Base64UrlJsonSerializer extends JsonSerializer { + + static final Base64 BASE64 = new Base64(-1, null, true); + + @Override + public void serialize(byte[] value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + String text; + if (value == null) { + text = null; + } else if (value.length == 0) { + text = ""; + } else { + text = BASE64.encodeAsString(value); + } + jgen.writeString(text); + } + +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/webkey/ByteExtensions.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/webkey/ByteExtensions.java new file mode 100644 index 000000000000..37f0a74d6049 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/webkey/ByteExtensions.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.models.webkey; + +class ByteExtensions { + /** + * Creates a copy of the source array. + * @param source The Array to make copy of + * @return A copy of the array, or null if source was null. + */ + static byte[] clone(byte[] source) { + if (source == null) { + return null; + } + + byte[] copy = new byte[source.length]; + System.arraycopy(source, 0, copy, 0, source.length); + + return copy; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/webkey/JsonWebKey.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/webkey/JsonWebKey.java new file mode 100644 index 000000000000..e274605b2571 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/webkey/JsonWebKey.java @@ -0,0 +1,1168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.models.webkey; + +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.JsonGenerationException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.io.IOException; +import java.math.BigInteger; +import java.security.GeneralSecurityException; +import java.security.KeyFactory; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.Provider; +import java.security.PublicKey; +import java.security.Security; +import java.security.interfaces.ECPrivateKey; +import java.security.interfaces.ECPublicKey; +import java.security.interfaces.RSAPrivateCrtKey; +import java.security.interfaces.RSAPublicKey; +import java.security.spec.ECGenParameterSpec; +import java.security.spec.ECParameterSpec; +import java.security.spec.ECPoint; +import java.security.spec.ECPrivateKeySpec; +import java.security.spec.ECPublicKeySpec; +import java.security.spec.EllipticCurve; +import java.security.spec.RSAPrivateCrtKeySpec; +import java.security.spec.RSAPrivateKeySpec; +import java.security.spec.RSAPublicKeySpec; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; + + +/** + * As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. + */ +@JsonAutoDetect(getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY, setterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY) +public class JsonWebKey { + private final ClientLogger logger = new ClientLogger(JsonWebKey.class); + + /** + * Key Identifier. + */ + @JsonProperty(value = "kid") + private String kid; + + /** + * JsonWebKey key type (kty). Possible values include: 'EC', 'EC-HSM', 'RSA', + * 'RSA-HSM', 'oct'. + */ + @JsonProperty(value = "kty") + private KeyType kty; + + /** + * The keyOps property. + */ + @JsonProperty(value = "key_ops") + private List keyOps; + + /** + * RSA modulus. + */ + @JsonProperty(value = "n") + private byte[] n; + + /** + * RSA public exponent. + */ + @JsonProperty(value = "e") + private byte[] e; + + /** + * RSA private exponent, or the D component of an EC private key. + */ + @JsonProperty(value = "d") + private byte[] d; + + /** + * RSA Private Key Parameter. + */ + @JsonProperty(value = "dp") + private byte[] dp; + + /** + * RSA Private Key Parameter. + */ + @JsonProperty(value = "dq") + private byte[] dq; + + /** + * RSA Private Key Parameter. + */ + @JsonProperty(value = "qi") + private byte[] qi; + + /** + * RSA secret prime. + */ + @JsonProperty(value = "p") + private byte[] p; + + /** + * RSA secret prime, with p & q. + */ + @JsonProperty(value = "q") + private byte[] q; + + /** + * Symmetric key. + */ + @JsonProperty(value = "k") + private byte[] k; + + /** + * HSM Token, used with Bring Your Own Key. + */ + @JsonProperty(value = "key_hsm") + private byte[] t; + + /** + * Elliptic curve name. For valid values, see KeyCurveName. Possible + * values include: 'P-256', 'P-384', 'P-521', 'SECP256K1'. + */ + @JsonProperty(value = "crv") + private KeyCurveName crv; + + /** + * X component of an EC public key. + */ + @JsonProperty(value = "x") + private byte[] x; + + /** + * Y component of an EC public key. + */ + @JsonProperty(value = "y") + private byte[] y; + + /** + * Get the kid value. + * + * @return the kid value + */ + @JsonProperty("kid") + public String kid() { + return this.kid; + } + + /** + * Set the key identifier value. + * + * @param kid The kid value to set + * @return the JsonWebKey object itself. + */ + public JsonWebKey kid(String kid) { + this.kid = kid; + return this; + } + + /** + * Get the kty value. + * + * @return the kty value + */ + @JsonProperty("kty") + public KeyType kty() { + return this.kty; + } + + /** + * Set the key type value. + * + * @param kty The key type + * @return the JsonWebKey object itself. + */ + public JsonWebKey kty(KeyType kty) { + this.kty = kty; + return this; + } + + /** + * Get the keyOps value. + * + * @return the keyOps value + */ + @JsonProperty("key_ops") + public List keyOps() { + return this.keyOps; + } + + /** + * Set the keyOps value. + * + * @param keyOps The keyOps value to set + * @return the JsonWebKey object itself. + */ + public JsonWebKey keyOps(List keyOps) { + this.keyOps = keyOps; + return this; + } + + /** + * Get the n value. + * + * @return the n value + */ + @JsonProperty("n") + @JsonSerialize(using = Base64UrlJsonSerializer.class) + @JsonDeserialize(using = Base64UrlJsonDeserializer.class) + public byte[] n() { + return ByteExtensions.clone(this.n); + } + + /** + * Set the n value. + * + * @param n The n value to set + * @return the JsonWebKey object itself. + */ + public JsonWebKey n(byte[] n) { + this.n = ByteExtensions.clone(n); + return this; + } + + /** + * Get the e value. + * + * @return the e value + */ + @JsonProperty("e") + @JsonSerialize(using = Base64UrlJsonSerializer.class) + @JsonDeserialize(using = Base64UrlJsonDeserializer.class) + public byte[] e() { + return ByteExtensions.clone(this.e); + } + + /** + * Set the e value. + * + * @param e The e value to set + * @return the JsonWebKey object itself. + */ + public JsonWebKey e(byte[] e) { + this.e = ByteExtensions.clone(e); + return this; + } + + /** + * Get the d value. + * + * @return the d value + */ + @JsonProperty("d") + @JsonSerialize(using = Base64UrlJsonSerializer.class) + @JsonDeserialize(using = Base64UrlJsonDeserializer.class) + public byte[] d() { + return ByteExtensions.clone(this.d); + } + + /** + * Set the d value. + * + * @param d The d value to set + * @return the JsonWebKey object itself. + */ + public JsonWebKey d(byte[] d) { + this.d = ByteExtensions.clone(d); + return this; + } + + /** + * Get the RSA Private Key Parameter value. + * + * @return the RSA Private Key Parameter value. + */ + @JsonProperty("dp") + @JsonSerialize(using = Base64UrlJsonSerializer.class) + @JsonDeserialize(using = Base64UrlJsonDeserializer.class) + public byte[] dp() { + return ByteExtensions.clone(this.dp); + } + + /** + * Set RSA Private Key Parameter value. + * + * @param dp The RSA Private Key Parameter value to set. + * @return the JsonWebKey object itself. + */ + public JsonWebKey dp(byte[] dp) { + this.dp = ByteExtensions.clone(dp); + return this; + } + + /** + * Get the RSA Private Key Parameter value. + * + * @return the RSA Private Key Parameter value. + */ + @JsonProperty("dq") + @JsonSerialize(using = Base64UrlJsonSerializer.class) + @JsonDeserialize(using = Base64UrlJsonDeserializer.class) + public byte[] dq() { + return ByteExtensions.clone(this.dq); + } + + /** + * Set RSA Private Key Parameter value . + * + * @param dq The RSA Private Key Parameter value to set. + * @return the JsonWebKey object itself. + */ + public JsonWebKey dq(byte[] dq) { + this.dq = ByteExtensions.clone(dq); + return this; + } + + /** + * Get the RSA Private Key Parameter value. + * + * @return the RSA Private Key Parameter value. + */ + @JsonProperty("qi") + @JsonSerialize(using = Base64UrlJsonSerializer.class) + @JsonDeserialize(using = Base64UrlJsonDeserializer.class) + public byte[] qi() { + return ByteExtensions.clone(this.qi); + } + + /** + * Set RSA Private Key Parameter value. + * + * @param qi The RSA Private Key Parameter value to set. + * @return the JsonWebKey object itself. + */ + public JsonWebKey qi(byte[] qi) { + this.qi = ByteExtensions.clone(qi); + return this; + } + + /** + * Get the RSA secret prime value. + * + * @return the RSA secret prime value. + */ + @JsonProperty("p") + @JsonSerialize(using = Base64UrlJsonSerializer.class) + @JsonDeserialize(using = Base64UrlJsonDeserializer.class) + public byte[] p() { + return ByteExtensions.clone(this.p); + } + + /** + * Set the RSA secret prime value. + * + * @param p The RSA secret prime value. + * @return the JsonWebKey object itself. + */ + public JsonWebKey p(byte[] p) { + this.p = ByteExtensions.clone(p); + return this; + } + + /** + * Get RSA secret prime, with p < q value. + * + * @return the RSA secret prime, with p < q value. + */ + @JsonProperty("q") + @JsonSerialize(using = Base64UrlJsonSerializer.class) + @JsonDeserialize(using = Base64UrlJsonDeserializer.class) + public byte[] q() { + return ByteExtensions.clone(this.q); + } + + /** + * Set the RSA secret prime, with p < q value. + * + * @param q The the RSA secret prime, with p < q value to be set. + * @return the JsonWebKey object itself. + */ + public JsonWebKey q(byte[] q) { + this.q = ByteExtensions.clone(q); + return this; + } + + /** + * Get Symmetric key value. + * + * @return the symmetric key value. + */ + @JsonProperty("k") + @JsonSerialize(using = Base64UrlJsonSerializer.class) + @JsonDeserialize(using = Base64UrlJsonDeserializer.class) + public byte[] k() { + return ByteExtensions.clone(this.k); + } + + /** + * Set the Symmetric key value. + * + * @param k The symmetric key value to set. + * @return the JsonWebKey object itself. + */ + public JsonWebKey k(byte[] k) { + this.k = ByteExtensions.clone(k); + return this; + } + + /** + * Get HSM Token value, used with Bring Your Own Key. + * + * @return HSM Token, used with Bring Your Own Key. + */ + @JsonProperty("key_hsm") + @JsonSerialize(using = Base64UrlJsonSerializer.class) + @JsonDeserialize(using = Base64UrlJsonDeserializer.class) + public byte[] t() { + return ByteExtensions.clone(this.t); + } + + /** + * Set HSM Token value, used with Bring Your Own Key. + * + * @param t The HSM Token value to set, used with Bring Your Own Key + * @return the JsonWebKey object itself. + */ + public JsonWebKey t(byte[] t) { + this.t = ByteExtensions.clone(t); + return this; + } + + @Override + public String toString() { + ObjectMapper mapper = new ObjectMapper(); + try { + return mapper.writeValueAsString(this); + } catch (JsonGenerationException e) { + throw logger.logExceptionAsError(new IllegalStateException(e)); + } catch (JsonMappingException e) { + throw logger.logExceptionAsError(new IllegalStateException(e)); + } catch (IOException e) { + throw logger.logExceptionAsError(new IllegalStateException(e)); + } + } + + /** + * Get the crv value. + * + * @return the crv value + */ + @JsonProperty("crv") + public KeyCurveName crv() { + return this.crv; + } + + /** + * Set the crv value. + * + * @param crv The crv value to set + * @return the JsonWebKey object itself. + */ + public JsonWebKey crv(KeyCurveName crv) { + this.crv = crv; + return this; + } + + /** + * Get the x value. + * + * @return the x value + */ + @JsonProperty("x") + @JsonSerialize(using = Base64UrlJsonSerializer.class) + @JsonDeserialize(using = Base64UrlJsonDeserializer.class) + public byte[] x() { + return ByteExtensions.clone(this.x); + } + + /** + * Set the x value. + * + * @param x The x value to set + * @return the JsonWebKey object itself. + */ + public JsonWebKey x(byte[] x) { + this.x = ByteExtensions.clone(x); + return this; + } + + /** + * Get the y value. + * + * @return the y value + */ + @JsonProperty("y") + @JsonSerialize(using = Base64UrlJsonSerializer.class) + @JsonDeserialize(using = Base64UrlJsonDeserializer.class) + public byte[] y() { + return ByteExtensions.clone(this.y); + } + + /** + * Set the y value. + * + * @param y The y value to set + * @return the JsonWebKey object itself. + */ + public JsonWebKey y(byte[] y) { + this.y = ByteExtensions.clone(y); + return this; + } + + /** + * Get the RSA public key spec value. + * + * @return the RSA public key spec value + */ + private RSAPublicKeySpec getRSAPublicKeySpec() { + + return new RSAPublicKeySpec(toBigInteger(n), toBigInteger(e)); + } + + /** + * Get the RSA private key spec value. + * + * @return the RSA private key spec value + */ + private RSAPrivateKeySpec getRSAPrivateKeySpec() { + + return new RSAPrivateCrtKeySpec(toBigInteger(n), toBigInteger(e), toBigInteger(d), toBigInteger(p), + toBigInteger(q), toBigInteger(dp), toBigInteger(dq), toBigInteger(qi)); + } + + /** + * Get the RSA public key value. + * + * @param provider The Java security provider. + * @return the RSA public key value + */ + private PublicKey getRSAPublicKey(Provider provider) { + + try { + RSAPublicKeySpec publicKeySpec = getRSAPublicKeySpec(); + KeyFactory factory = provider != null ? KeyFactory.getInstance("RSA", provider) + : KeyFactory.getInstance("RSA"); + + return factory.generatePublic(publicKeySpec); + } catch (GeneralSecurityException e) { + throw logger.logExceptionAsError(new IllegalStateException(e)); + } + } + + /** + * Get the RSA private key value. + * + * @param provider The Java security provider. + * @return the RSA private key value + */ + private PrivateKey getRSAPrivateKey(Provider provider) { + + try { + RSAPrivateKeySpec privateKeySpec = getRSAPrivateKeySpec(); + KeyFactory factory = provider != null ? KeyFactory.getInstance("RSA", provider) + : KeyFactory.getInstance("RSA"); + + return factory.generatePrivate(privateKeySpec); + } catch (GeneralSecurityException e) { + throw logger.logExceptionAsError(new IllegalStateException(e)); + } + } + + private static PublicKey getECPublicKey(ECPoint ecPoint, ECParameterSpec curveSpec, Provider provider) { + // Create public key spec with given point + try { + ECPublicKeySpec pubSpec = new ECPublicKeySpec(ecPoint, curveSpec); + KeyFactory kf = provider != null ? KeyFactory.getInstance("EC", provider) + : KeyFactory.getInstance("EC", "SunEC"); + return (ECPublicKey) kf.generatePublic(pubSpec); + } catch (GeneralSecurityException e) { + throw new IllegalStateException(e); + } + } + + private static PrivateKey getECPrivateKey(byte[] d, ECParameterSpec curveSpec, Provider provider) { + try { + ECPrivateKeySpec priSpec = new ECPrivateKeySpec(new BigInteger(1, d), curveSpec); + KeyFactory kf = provider != null ? KeyFactory.getInstance("EC", provider) + : KeyFactory.getInstance("EC", "SunEC"); + return (ECPrivateKey) kf.generatePrivate(priSpec); + } catch (GeneralSecurityException e) { + throw new IllegalStateException(e); + } + } + + /** + * Verifies if the key is an RSA key. + */ + private void checkRSACompatible() { + if (!KeyType.RSA.equals(kty) && !KeyType.RSA_HSM.equals(kty)) { + throw logger.logExceptionAsError(new UnsupportedOperationException("Not an RSA key")); + } + } + + private static byte[] toByteArray(BigInteger n) { + byte[] result = n.toByteArray(); + if (result[0] == 0) { + // The leading zero is used to let the number positive. Since RSA + // parameters are always positive, we remove it. + return Arrays.copyOfRange(result, 1, result.length); + } + return result; + } + + private static BigInteger toBigInteger(byte[] b) { + if (b[0] < 0) { + // RSA parameters are always positive numbers, so if the first byte + // is negative, we need to add a leading zero + // to make the entire BigInteger positive. + byte[] temp = new byte[1 + b.length]; + System.arraycopy(b, 0, temp, 1, b.length); + b = temp; + } + return new BigInteger(b); + } + + /** + * Converts RSA key pair to JSON web key. + * + * @param keyPair Tbe RSA key pair + * @return the JSON web key, converted from RSA key pair. + */ + public static JsonWebKey fromRSA(KeyPair keyPair) { + + RSAPrivateCrtKey privateKey = (RSAPrivateCrtKey) keyPair.getPrivate(); + JsonWebKey key = null; + + if (privateKey != null) { + + key = new JsonWebKey().kty(KeyType.RSA).n(toByteArray(privateKey.getModulus())) + .e(toByteArray(privateKey.getPublicExponent())) + .d(toByteArray(privateKey.getPrivateExponent())).p(toByteArray(privateKey.getPrimeP())) + .q(toByteArray(privateKey.getPrimeQ())).dp(toByteArray(privateKey.getPrimeExponentP())) + .dq(toByteArray(privateKey.getPrimeExponentQ())) + .qi(toByteArray(privateKey.getCrtCoefficient())); + } else { + + RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); + + key = new JsonWebKey().kty(KeyType.RSA).n(toByteArray(publicKey.getModulus())) + .e(toByteArray(publicKey.getPublicExponent())).d(null).p(null).q(null).dp(null) + .dq(null).qi(null); + } + + return key; + } + + /** + * Converts JSON web key to RSA key pair. + * + * @return RSA key pair + */ + public KeyPair toRSA() { + return this.toRSA(false); + } + + /** + * Converts JSON web key to RSA key pair and include the private key if set to + * true. + * + * @param includePrivateParameters true if the RSA key pair should include the private key. False otherwise. + * @return RSA key pair + */ + public KeyPair toRSA(boolean includePrivateParameters) { + return toRSA(includePrivateParameters, null); + } + + /** + * Converts JSON web key to RSA key pair and include the private key if set to + * true. + * + * @param provider The Java security provider. + * @param includePrivateParameters true if the RSA key pair should include the private key. False otherwise. + * @return RSA key pair + */ + public KeyPair toRSA(boolean includePrivateParameters, Provider provider) { + + // Must be RSA + checkRSACompatible(); + + if (includePrivateParameters) { + return new KeyPair(getRSAPublicKey(provider), getRSAPrivateKey(provider)); + } else { + return new KeyPair(getRSAPublicKey(provider), null); + } + } + + /** + * Converts JSON web key to EC key pair and include the private key if set to + * true. + * + * @return EC key pair + */ + public KeyPair toEC() { + return toEC(false, null); + } + + /** + * Converts JSON web key to EC key pair and include the private key if set to + * true. + * + * @param includePrivateParameters true if the EC key pair should include the private key. False otherwise. + * @return EC key pair + */ + public KeyPair toEC(boolean includePrivateParameters) { + return toEC(includePrivateParameters, null); + } + + /** + * Converts JSON web key to EC key pair and include the private key if set to + * true. + * + * @param includePrivateParameters true if the EC key pair should include the private key. False otherwise. + * @param provider The Java security provider + * @return EC key pair + * @throws IllegalArgumentException if the key type is not EC or EC HSM + * @throws IllegalStateException if an instance of EC key pair cannot be generated + */ + public KeyPair toEC(boolean includePrivateParameters, Provider provider) { + + if (provider == null) { + // Our default provider for this class + provider = Security.getProvider("SunEC"); + } + + if (!KeyType.EC.equals(kty) && !KeyType.EC_HSM.equals(kty)) { + throw logger.logExceptionAsError(new IllegalArgumentException("Not an EC key.")); + } + + try { + KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC", provider); + + ECGenParameterSpec gps = new ECGenParameterSpec(CURVE_TO_SPEC_NAME.get(crv)); + kpg.initialize(gps); + + // Generate dummy keypair to get parameter spec. + KeyPair apair = kpg.generateKeyPair(); + ECPublicKey apub = (ECPublicKey) apair.getPublic(); + ECParameterSpec aspec = apub.getParams(); + + ECPoint ecPoint = new ECPoint(new BigInteger(1, x), new BigInteger(1, y)); + + KeyPair realKeyPair; + + if (includePrivateParameters) { + realKeyPair = new KeyPair(getECPublicKey(ecPoint, aspec, provider), + getECPrivateKey(d, aspec, provider)); + } else { + realKeyPair = new KeyPair(getECPublicKey(ecPoint, aspec, provider), null); + } + + return realKeyPair; + } catch (GeneralSecurityException e) { + throw logger.logExceptionAsError(new IllegalStateException(e)); + } + } + + /** + * Converts EC key pair to JSON web key. + * + * @param keyPair The EC key pair + * @param provider The Java security provider + * @return the JSON web key, converted from EC key pair. + */ + public static JsonWebKey fromEC(KeyPair keyPair, Provider provider) { + + ECPublicKey apub = (ECPublicKey) keyPair.getPublic(); + ECPoint point = apub.getW(); + ECPrivateKey apriv = (ECPrivateKey) keyPair.getPrivate(); + + if (apriv != null) { + return new JsonWebKey().kty(KeyType.EC).crv(getCurveFromKeyPair(keyPair, provider)) + .x(point.getAffineX().toByteArray()).y(point.getAffineY().toByteArray()) + .d(apriv.getS().toByteArray()).kty(KeyType.EC); + } else { + return new JsonWebKey().kty(KeyType.EC).crv(getCurveFromKeyPair(keyPair, provider)) + .x(point.getAffineX().toByteArray()).y(point.getAffineY().toByteArray()) + .kty(KeyType.EC); + } + } + + // Matches the curve of the keyPair to supported curves. + private static KeyCurveName getCurveFromKeyPair(KeyPair keyPair, Provider provider) { + + try { + ECPublicKey key = (ECPublicKey) keyPair.getPublic(); + ECParameterSpec spec = key.getParams(); + EllipticCurve crv = spec.getCurve(); + + List curveList = Arrays.asList(KeyCurveName.P_256, KeyCurveName.P_384, + KeyCurveName.P_521, KeyCurveName.P_256K); + + for (KeyCurveName curve : curveList) { + ECGenParameterSpec gps = new ECGenParameterSpec(CURVE_TO_SPEC_NAME.get(curve)); + KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC", provider); + kpg.initialize(gps); + + // Generate dummy keypair to get parameter spec. + KeyPair apair = kpg.generateKeyPair(); + ECPublicKey apub = (ECPublicKey) apair.getPublic(); + ECParameterSpec aspec = apub.getParams(); + EllipticCurve acurve = aspec.getCurve(); + + // Matches the parameter spec + if (acurve.equals(crv)) { + return curve; + } + } + + // Did not find a supported curve. + throw new NoSuchAlgorithmException("Curve not supported."); + } catch (GeneralSecurityException e) { + throw new IllegalStateException(e); + } + } + + /** + * Converts AES key to JSON web key. + * + * @param secretKey The AES key + * @return the JSON web key, converted from AES key. + */ + public static JsonWebKey fromAes(SecretKey secretKey) { + if (secretKey == null) { + return null; + } + + return new JsonWebKey().k(secretKey.getEncoded()).kty(KeyType.OCT); + } + + /** + * Converts JSON web key to AES key. + * + * @return AES key + */ + public SecretKey toAes() { + if (k == null) { + return null; + } + + SecretKey secretKey = new SecretKeySpec(k, "AES"); + return secretKey; + } + + @Override + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + if (obj instanceof JsonWebKey) { + return this.equals((JsonWebKey) obj); + } + return super.equals(obj); + } + + /** + * Indicates whether some other {@link JsonWebKey} is "equal to" this one. + * + * @param jwk The other {@link JsonWebKey} to compare with. + * @return true if this {@link JsonWebKey} is the same as the jwk argument; + * false otherwise. + */ + public boolean equals(JsonWebKey jwk) { + if (jwk == null) { + return false; + } + + if (!objectEquals(kid, jwk.kid)) { + return false; + } + + if (!objectEquals(kty, jwk.kty)) { + return false; + } + + if (!objectEquals(keyOps, jwk.keyOps)) { + return false; + } + + if (!objectEquals(crv, jwk.crv)) { + return false; + } + + if (!Arrays.equals(k, jwk.k)) { + return false; + } + + // Public parameters + if (!Arrays.equals(n, jwk.n)) { + return false; + } + if (!Arrays.equals(e, jwk.e)) { + return false; + } + + // Private parameters + if (!Arrays.equals(d, jwk.d)) { + return false; + } + if (!Arrays.equals(dp, jwk.dp)) { + return false; + } + if (!Arrays.equals(dq, jwk.dq)) { + return false; + } + if (!Arrays.equals(qi, jwk.qi)) { + return false; + } + if (!Arrays.equals(p, jwk.p)) { + return false; + } + if (!Arrays.equals(q, jwk.q)) { + return false; + } + if (!Arrays.equals(x, jwk.x)) { + return false; + } + if (!Arrays.equals(y, jwk.y)) { + return false; + } + + // HSM token + if (!Arrays.equals(t, jwk.t)) { + return false; + } + + return true; + } + + /** + * Verifies whether the {@link JsonWebKey} has private key. + * + * @return true if the {@link JsonWebKey} has private key; false otherwise. + */ + public boolean hasPrivateKey() { + + if (KeyType.OCT.equals(kty)) { + return k != null; + } else if (KeyType.RSA.equals(kty) || KeyType.RSA_HSM.equals(kty)) { + return (d != null && dp != null && dq != null && qi != null && p != null && q != null); + } else if (KeyType.EC.equals(kty) || KeyType.EC_HSM.equals(kty)) { + return (d != null); + } + + return false; + } + + /** + * Verifies whether the {@link JsonWebKey} is valid. + * + * @return true if the {@link JsonWebKey} is valid; false otherwise. + */ + @JsonIgnore + public boolean isValid() { + if (kty == null) { + return false; + } + + if (keyOps != null) { + final Set set = new HashSet(Collections.unmodifiableList(Arrays.asList(KeyOperation.values()))); + for (int i = 0; i < keyOps.size(); i++) { + if (!set.contains(keyOps.get(i))) { + return false; + } + } + } + + if (KeyType.OCT.equals(kty)) { + return isValidOctet(); + } else if (KeyType.RSA.equals(kty)) { + return isValidRsa(); + } else if (KeyType.RSA_HSM.equals(kty)) { + return isValidRsaHsm(); + } else if (KeyType.EC.equals(kty)) { + return isValidEc(); + } else if (KeyType.EC_HSM.equals(kty)) { + return isValidEcHsm(); + } + + return false; + } + + private boolean isValidOctet() { + if (k != null) { + return true; + } + return false; + } + + private boolean isValidRsa() { + if (n == null || e == null) { + return false; + } + + return hasPrivateKey() || (d == null && dp == null && dq == null && qi == null && p == null && q == null); + } + + private boolean isValidRsaHsm() { + // MAY have public key parameters + if ((n == null && e != null) || (n != null && e == null)) { + return false; + } + + // no private key + if (hasPrivateKey()) { + return false; + } + + // MUST have ( T || ( n && E ) ) + boolean tokenParameters = t != null; + boolean publicParameters = (n != null && e != null); + + if (tokenParameters && publicParameters) { + return false; + } + + return (tokenParameters || publicParameters); + } + + private boolean isValidEc() { + boolean ecPointParameters = (x != null && y != null); + if (!ecPointParameters || crv == null) { + return false; + } + + return hasPrivateKey() || (d == null); + } + + private boolean isValidEcHsm() { + // MAY have public key parameters + boolean ecPointParameters = (x != null && y != null); + if ((ecPointParameters && crv == null) || (!ecPointParameters && crv != null)) { + return false; + } + + // no private key + if (hasPrivateKey()) { + return false; + } + + // MUST have (T || (ecPointParameters && crv)) + boolean publicParameters = (ecPointParameters && crv != null); + boolean tokenParameters = t != null; + + if (tokenParameters && publicParameters) { + return false; + } + + return (tokenParameters || publicParameters); + } + + /** + * Clear key materials. + */ + public void clearMemory() { + zeroArray(k); + k = null; + zeroArray(n); + n = null; + zeroArray(e); + e = null; + zeroArray(d); + d = null; + zeroArray(dp); + dp = null; + zeroArray(dq); + dq = null; + zeroArray(qi); + qi = null; + zeroArray(p); + p = null; + zeroArray(q); + q = null; + zeroArray(t); + t = null; + zeroArray(x); + x = null; + zeroArray(y); + y = null; + } + + private static void zeroArray(byte[] bytes) { + if (bytes != null) { + Arrays.fill(bytes, (byte) 0); + } + } + + @Override + public int hashCode() { + int hashCode = 48313; // setting it to a random prime number + if (kid != null) { + hashCode += kid.hashCode(); + } + + if (KeyType.OCT.equals(kty)) { + hashCode += hashCode(k); + } else if (KeyType.RSA.equals(kty)) { + hashCode += hashCode(n); + } else if (KeyType.EC.equals(kty)) { + hashCode += hashCode(x); + hashCode += hashCode(y); + hashCode += crv.hashCode(); + } else if (KeyType.RSA_HSM.equals(kty) || KeyType.EC_HSM.equals(kty)) { + hashCode += hashCode(t); + } + + return hashCode; + } + + private static int hashCode(byte[] obj) { + int hashCode = 0; + + if (obj == null || obj.length == 0) { + return 0; + } + + for (int i = 0; i < obj.length; i++) { + hashCode = (hashCode << 3) | (hashCode >> 29) ^ obj[i]; + } + return hashCode; + } + + private static final Map CURVE_TO_SPEC_NAME = setupCurveToSpecMap(); + + private static Map setupCurveToSpecMap() { + Map curveToSpecMap = new HashMap<>(); + curveToSpecMap.put(KeyCurveName.P_256, "secp256r1"); + curveToSpecMap.put(KeyCurveName.P_384, "secp384r1"); + curveToSpecMap.put(KeyCurveName.P_521, "secp521r1"); + curveToSpecMap.put(KeyCurveName.P_256K, "secp256k1"); + return curveToSpecMap; + } + + private boolean objectEquals(Object a, Object b) { + if (a == null && b == null) { + return true; + } else if (a != null && b != null) { + return a.equals(b); + } else { + return false; + } + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/webkey/KeyCurveName.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/webkey/KeyCurveName.java new file mode 100644 index 000000000000..8cc6e584af3f --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/webkey/KeyCurveName.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator + +package com.azure.security.keyvault.certificates.models.webkey; + +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for KeyCurveName. + */ +public enum KeyCurveName { + P_256("P-256"), + + P_384("P-384"), + + P_521("P-521"), + + P_256K("P-256K"); + + private String value; + + /** + * Creates a custom value for KeyCurveName. + * @param value The custom value + */ + KeyCurveName(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return value; + } + + /** + * Calculates the hashcode of the custom value + * @return the hashcode of custom value for {@link KeyCurveName} + */ + public int hashValue() { + return value.hashCode(); + } + + /** + * Return the KeyCurveName which maps to {@code value}. + * @param value The value whose equivalent KeyCurveName is needed. + * @return the KeyCurveName + */ + public static KeyCurveName fromString(String value) { + for (KeyCurveName keyCurve : values()) { + if (keyCurve.value.equalsIgnoreCase(value)) { + return keyCurve; + } + } + return null; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/webkey/KeyOperation.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/webkey/KeyOperation.java new file mode 100644 index 000000000000..ef9b7c8c0ba0 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/webkey/KeyOperation.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.models.webkey; + +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for KeyOperation. + */ +public enum KeyOperation { + + ENCRYPT("encrypt"), + + DECRYPT("decrypt"), + + SIGN("sign"), + + VERIFY("verify"), + + WRAP_KEY("wrapKey"), + + UNWRAP_KEY("unwrapKey"), + + OTHER("other"); + + private String value; + + /** + * Creates a custom value for KeyOperation. + * @param value The custom value + */ + KeyOperation(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return value; + } + + /** + * Calculates the hashcode of the custom value + * @return the hashcode of custom value for {@link KeyOperation} + */ + public int hashValue() { + return value.hashCode(); + } + + /** + * Return the KeyOperation which maps to {@code value} + * @param value The value whose equivalent KeyOperation is needed. + * @return the KeyOperation + */ + public static KeyOperation fromString(String value) { + for (KeyOperation keyOp : values()) { + if (keyOp.value.equalsIgnoreCase(value)) { + return keyOp; + } + } + return null; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/webkey/KeyType.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/webkey/KeyType.java new file mode 100644 index 000000000000..8c40d0120c28 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/webkey/KeyType.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates.models.webkey; + +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for KeyType. + */ +public enum KeyType { + EC("EC"), + + EC_HSM("EC-HSM"), + + RSA("RSA"), + + RSA_HSM("RSA-HSM"), + + OCT("oct"); + + private String value; + + /** + * Creates a custom value for KeyType. + * @param value The custom value + */ + KeyType(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return value; + } + + /** + * Calculates the hashcode of this {@link KeyType} value + * @return the hashcode for {@link KeyType} value + */ + public int hashValue() { + return value.hashCode(); + } + + /** + * Return the KeyType which maps to {@code value} + * @param value The value whose equivalent KeyType is needed. + * @return the KeyType. + */ + public static KeyType fromString(String value) { + for (KeyType keyType : values()) { + if (keyType.value.equalsIgnoreCase(value)) { + return keyType; + } + } + return null; + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/webkey/package-info.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/webkey/package-info.java new file mode 100644 index 000000000000..a8f00c8e8db2 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/webkey/package-info.java @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +/** + * This package contains the classes for key vault JSON web key. + */ +package com.azure.security.keyvault.certificates.models.webkey; diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/package-info.java b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/package-info.java new file mode 100644 index 000000000000..de9df1e7c600 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +/** + * Package containing classes for creating {@link com.azure.security.keyvault.certificates.CertificateAsyncClient} and + * {@link com.azure.security.keyvault.certificates.CertificateClient} to perform operations on Azure Key Vault. + */ +package com.azure.security.keyvault.certificates; diff --git a/sdk/keyvault/azure-keyvault-certificates/src/main/resources/kvErrorStrings.properties b/sdk/keyvault/azure-keyvault-certificates/src/main/resources/kvErrorStrings.properties new file mode 100644 index 000000000000..ffced4746fc3 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/main/resources/kvErrorStrings.properties @@ -0,0 +1,2 @@ +credentials_required=Azure Key Vault credentials are required. +vault_endpoint_required=Azure Key Vault endpoint url is required. diff --git a/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/BackupAndRestoreOperations.java b/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/BackupAndRestoreOperations.java new file mode 100644 index 000000000000..45948a3b3877 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/BackupAndRestoreOperations.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.core.http.rest.VoidResponse; +import com.azure.core.util.Context; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.certificates.models.CertificatePolicy; +import com.azure.security.keyvault.certificates.models.EcKeyOptions; +import com.azure.security.keyvault.certificates.models.SubjectAlternativeNames; +import com.azure.security.keyvault.certificates.models.webkey.KeyCurveName; +import com.azure.security.keyvault.certificates.models.CertificateOperation; +import com.azure.security.keyvault.certificates.models.Certificate; +import com.azure.security.keyvault.certificates.models.DeletedCertificate; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.nio.file.Files; +import java.time.Duration; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Sample demonstrates how to backup and restore certificates in the key vault. + */ +public class BackupAndRestoreOperations { + /** + * Authenticates with the key vault and shows how to backup and restore certificates in the key vault. + * + * @param args Unused. Arguments to the program. + * @throws IllegalArgumentException when invalid key vault endpoint is passed. + * @throws InterruptedException when the thread is interrupted in sleep mode. + * @throws IOException when writing backup to file is unsuccessful. + */ + public static void main(String[] args) throws IOException, InterruptedException, IllegalArgumentException { + + // Instantiate a certificate client that will be used to call the service. Notice that the client is using default Azure + // credentials. To make default credentials work, ensure that environment variables 'AZURE_CLIENT_ID', + // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. + CertificateClient certificateClient = new CertificateClientBuilder() + .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") + .credential(new DefaultAzureCredentialBuilder().build()) + .buildClient(); + + // Let's create a self signed certificate valid for 1 year. if the certificate + // already exists in the key vault, then a new version of the certificate is created. + CertificatePolicy policy = new CertificatePolicy("Self", "CN=SelfSignedJavaPkcs12") + .subjectAlternativeNames(SubjectAlternativeNames.fromEmails(Arrays.asList("wow@gmail.com"))) + .keyOptions(new EcKeyOptions() + .reuseKey(true) + .curve(KeyCurveName.P_256)); + Map tags = new HashMap<>(); + tags.put("foo", "bar"); + + try { + CertificateOperation certificateOperation = certificateClient.createCertificate("certificateName", + policy, tags, Duration.ofMillis(60000)); + System.out.printf("Certificate operation status %s \n", certificateOperation.status()); + } catch (IllegalStateException e) { + // Certificate wasn't created in the specified duration. + // Log / Handle here + } + + // Backups are good to have, if in case certificates get accidentally deleted by you. + // For long term storage, it is ideal to write the backup to a file. + String backupFilePath = "YOUR_BACKUP_FILE_PATH"; + byte[] certificateBackup = certificateClient.backupCertificate("certificateName"); + System.out.printf("Backed up certificate with back up blob length %d", certificateBackup.length); + writeBackupToFile(certificateBackup, backupFilePath); + + // The certificate is no longer in use, so you delete it. + DeletedCertificate deletedCertificate = certificateClient.deleteCertificate("certificateName"); + System.out.printf("Deleted certitifcate with name %s and recovery id %s", deletedCertificate.name(), + deletedCertificate.recoveryId()); + + //To ensure certificate is deleted on server side. + Thread.sleep(30000); + + // If the vault is soft-delete enabled, then you need to purge the certificate as well for permanent deletion. + VoidResponse response = certificateClient.purgeDeletedCertificateWithResponse("certificateName", new Context("key1", "value1")); + System.out.printf("Purged Deleted certificate with status %s", response.getStatusCode()); + + //To ensure certificate is purged on server side. + Thread.sleep(15000); + + // After sometime, the certificate is required again. We can use the backup value to restore it in the key vault. + byte[] backupFromFile = Files.readAllBytes(new File(backupFilePath).toPath()); + Certificate restoredCertificate = certificateClient.restoreCertificate(backupFromFile); + System.out.printf(" Restored certificate with name %s and id %s", restoredCertificate.name(), restoredCertificate.id()); + + } + + private static void writeBackupToFile(byte[] bytes, String filePath) { + try { + File file = new File(filePath); + if (file.exists()) { + file.delete(); + } + file.createNewFile(); + OutputStream os = new FileOutputStream(file); + os.write(bytes); + System.out.println("Successfully wrote backup to file."); + // Close the file + os.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/BackupAndRestoreOperationsAsync.java b/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/BackupAndRestoreOperationsAsync.java new file mode 100644 index 000000000000..bd438daaeb5a --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/BackupAndRestoreOperationsAsync.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.certificates.models.CertificatePolicy; +import com.azure.security.keyvault.certificates.models.EcKeyOptions; +import com.azure.security.keyvault.certificates.models.SubjectAlternativeNames; +import com.azure.security.keyvault.certificates.models.webkey.KeyCurveName; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.nio.file.Files; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Sample demonstrates how to asynchronously backup and restore certificates in the key vault. + */ +public class BackupAndRestoreOperationsAsync { + /** + * Authenticates with the key vault and shows how to asynchronously backup and restore certificates in the key vault. + * + * @param args Unused. Arguments to the program. + * @throws IllegalArgumentException when invalid key vault endpoint is passed. + * @throws InterruptedException when the thread is interrupted in sleep mode. + * @throws IOException when writing backup to file is unsuccessful. + */ + public static void main(String[] args) throws IOException, InterruptedException, IllegalArgumentException { + + + // Instantiate an async key client that will be used to call the service. Notice that the client is using default Azure + // credentials. To make default credentials work, ensure that environment variables 'AZURE_CLIENT_ID', + // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. + CertificateAsyncClient certificateAsyncClient = new CertificateClientBuilder() + .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAsyncClient(); + + // Let's create a self signed certificate valid for 1 year. if the certificate + // already exists in the key vault, then a new version of the certificate is created. + CertificatePolicy policy = new CertificatePolicy("Self", "CN=SelfSignedJavaPkcs12") + .subjectAlternativeNames(SubjectAlternativeNames.fromEmails(Arrays.asList("wow@gmail.com"))) + .keyOptions(new EcKeyOptions() + .reuseKey(true) + .curve(KeyCurveName.P_256)); + Map tags = new HashMap<>(); + tags.put("foo", "bar"); + + certificateAsyncClient.createCertificate("certificateName", policy, tags) + .getObserver().subscribe(pollResponse -> { + System.out.println("---------------------------------------------------------------------------------"); + System.out.println(pollResponse.getStatus()); + System.out.println(pollResponse.getValue().status()); + System.out.println(pollResponse.getValue().statusDetails()); + }); + + Thread.sleep(22000); + + // Backups are good to have, if in case certificates get accidentally deleted by you. + // For long term storage, it is ideal to write the backup to a file. + String backupFilePath = "YOUR_BACKUP_FILE_PATH"; + certificateAsyncClient.backupCertificate("certificateName") + .subscribe(certificateBackupResponse -> { + writeBackupToFile(certificateBackupResponse, backupFilePath); + System.out.printf("Certificate's Backup Byte array's length %s \n", certificateBackupResponse.length); + }); + + Thread.sleep(7000); + + // The certificate is no longer in use, so you delete it. + certificateAsyncClient.deleteCertificate("certificateName") + .subscribe(deletedSecretResponse -> + System.out.printf("Deleted Certificate's Recovery Id %s \n", deletedSecretResponse.recoveryId())); + + //To ensure certificate is deleted on server side. + Thread.sleep(30000); + + // If the vault is soft-delete enabled, then you need to purge the certificate as well for permanent deletion. + certificateAsyncClient.purgeDeletedCertificate("certificateName") + .subscribe(purgeResponse -> + System.out.printf("Purge Status response %d \n", purgeResponse.getStatusCode())); + + //To ensure certificate is purged on server side. + Thread.sleep(15000); + + // After sometime, the certificate is required again. We can use the backup value to restore it in the key vault. + byte[] backupFromFile = Files.readAllBytes(new File(backupFilePath).toPath()); + certificateAsyncClient.restoreCertificate(backupFromFile) + .subscribe(certificateResponse -> System.out.printf("Restored Certificate with name %s and key id %s \n", + certificateResponse.name(), certificateResponse.keyId())); + + //To ensure certificate is restored on server side. + Thread.sleep(15000); + } + + private static void writeBackupToFile(byte[] bytes, String filePath) { + try { + File file = new File(filePath); + if (file.exists()) { + file.delete(); + } + file.createNewFile(); + OutputStream os = new FileOutputStream(file); + os.write(bytes); + System.out.println("Successfully wrote backup to file."); + // Close the file + os.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/CertificateAsyncClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/CertificateAsyncClientJavaDocCodeSnippets.java new file mode 100644 index 000000000000..1e57ed845ec6 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/CertificateAsyncClientJavaDocCodeSnippets.java @@ -0,0 +1,681 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + + +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.test.models.RecordedData; +import com.azure.core.test.policy.RecordNetworkCallPolicy; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.certificates.models.Certificate; +import com.azure.security.keyvault.certificates.models.CertificatePolicy; +import com.azure.security.keyvault.certificates.models.Contact; +import com.azure.security.keyvault.certificates.models.Issuer; +import com.azure.security.keyvault.certificates.models.CertificateBase; +import com.azure.security.keyvault.certificates.models.MergeCertificateOptions; +import reactor.util.context.Context; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.List; + + +/** + * This class contains code samples for generating javadocs through doclets for {@link CertificateAsyncClient} + */ +public final class CertificateAsyncClientJavaDocCodeSnippets { + + private String key1 = "key1"; + private String key2 = "key2"; + private String value1 = "val1"; + private String value2 = "val2"; + + /** + * Generates code sample for creating a {@link CertificateAsyncClient} + * @return An instance of {@link CertificateAsyncClient} + */ + public CertificateAsyncClient createAsyncClientWithHttpclient() { + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.withhttpclient.instantiation + RecordedData networkData = new RecordedData(); + HttpPipeline pipeline = new HttpPipelineBuilder().policies(new RetryPolicy()).build(); + CertificateAsyncClient keyClient = new CertificateClientBuilder() + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .endpoint("https://myvault.azure.net/") + .credential(new DefaultAzureCredentialBuilder().build()) + .addPolicy(new RecordNetworkCallPolicy(networkData)) + .httpClient(HttpClient.createDefault()) + .buildAsyncClient(); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.withhttpclient.instantiation + return keyClient; + } + + /** + * Implementation for async CertificateAsyncClient + * @return sync CertificateAsyncClient + */ + private CertificateAsyncClient getCertificateAsyncClient() { + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.instantiation + CertificateAsyncClient secretAsyncClient = new CertificateClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myvault.vault.azure.net/") + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .buildAsyncClient(); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.instantiation + return secretAsyncClient; + } + + /** + * Generates code sample for creating a {@link CertificateAsyncClient} + * @return An instance of {@link CertificateAsyncClient} + */ + public CertificateAsyncClient createAsyncClientWithPipeline() { + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.pipeline.instantiation + RecordedData networkData = new RecordedData(); + HttpPipeline pipeline = new HttpPipelineBuilder().policies(new RecordNetworkCallPolicy(networkData)).build(); + CertificateAsyncClient secretAsyncClient = new CertificateClientBuilder() + .pipeline(pipeline) + .endpoint("https://myvault.azure.net/") + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAsyncClient(); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.pipeline.instantiation + return secretAsyncClient; + } + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#getCertificatePolicy(String)} + */ + public void getCertiificatePolicyCodeSnippets() { + CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificatePolicy#string + certificateAsyncClient.getCertificatePolicy("certificateName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(policy -> + System.out.printf("Certificate policy is returned with issuer name %s and subject name %s %n", + policy.issuerName(), policy.subjectName())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificatePolicy#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificatePolicyWithResponse#string + certificateAsyncClient.getCertificatePolicyWithResponse("certificateName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(policyResponse -> + System.out.printf("Certificate policy is returned with issuer name %s and subject name %s %n", + policyResponse.getValue().issuerName(), policyResponse.getValue().subjectName())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificatePolicyWithResponse#string + } + + + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#getCertificateWithPolicy(String)} + */ + public void getCertificateWithResponseCodeSnippets() { + CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificateWithPolicy#String + certificateAsyncClient.getCertificateWithPolicy("certificateName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(certificateResponse -> + System.out.printf("Certificate is returned with name %s and secretId %s %n", certificateResponse.name(), + certificateResponse.secretId())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificateWithPolicy#String + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificateWithResponse#string-string + String certificateVersion = "6A385B124DEF4096AF1361A85B16C204"; + certificateAsyncClient.getCertificateWithResponse("certificateName", certificateVersion) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(certificateWithVersion -> + System.out.printf("Certificate is returned with name %s and secretId %s \n", + certificateWithVersion.getValue().name(), certificateWithVersion.getValue().secretId())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificateWithResponse#string-string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificate#String-String + certificateAsyncClient.getCertificate("certificateName", certificateVersion) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(certificateWithVersion -> + System.out.printf("Certificate is returned with name %s and secretId %s \n", + certificateWithVersion.name(), certificateWithVersion.secretId())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificate#String-String + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificate#CertificateBase + certificateAsyncClient.getCertificateWithPolicy("certificateName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(certificateBase -> certificateAsyncClient.getCertificate(certificateBase) + .subscribe(certificateResponse -> + System.out.printf("Certificate is returned with name %s and secretId %s %n", certificateResponse.name(), + certificateResponse.secretId()))); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificate#CertificateBase + } + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#createCertificate(String, CertificatePolicy)} + */ + public void createCertificateCodeSnippets() { + CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.createCertificate#String-CertificatePolicy-Map + CertificatePolicy policy = new CertificatePolicy("Self", "CN=SelfSignedJavaPkcs12"); + Map tags = new HashMap<>(); + tags.put("foo", "bar"); + certificateAsyncClient.createCertificate("certificateName", policy, tags) + .getObserver().subscribe(pollResponse -> { + System.out.println("---------------------------------------------------------------------------------"); + System.out.println(pollResponse.getStatus()); + System.out.println(pollResponse.getValue().status()); + System.out.println(pollResponse.getValue().statusDetails()); + }); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.createCertificate#String-CertificatePolicy-Map + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.createCertificate#String-CertificatePolicy + CertificatePolicy certPolicy = new CertificatePolicy("Self", "CN=SelfSignedJavaPkcs12"); + certificateAsyncClient.createCertificate("certificateName", certPolicy) + .getObserver().subscribe(pollResponse -> { + System.out.println("---------------------------------------------------------------------------------"); + System.out.println(pollResponse.getStatus()); + System.out.println(pollResponse.getValue().status()); + System.out.println(pollResponse.getValue().statusDetails()); + }); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.createCertificate#String-CertificatePolicy + } + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#createCertificateIssuer(String, String)} + */ + public void createCertificateIssuerCodeSnippets() { + CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.createCertificateIssuer#String-String + certificateAsyncClient.createCertificateIssuer("issuerName", "providerName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(issuer -> { + System.out.printf("Issuer created with %s and %s", issuer.name(), issuer.provider()); + }); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.createCertificateIssuer#String-String + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.createCertificateIssuer#issuer + Issuer issuer = new Issuer("issuerName", "providerName") + .accountId("keyvaultuser") + .password("temp2"); + certificateAsyncClient.createCertificateIssuer(issuer) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(issuerResponse -> { + System.out.printf("Issuer created with %s and %s", issuerResponse.name(), issuerResponse.provider()); + }); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.createCertificateIssuer#issuer + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.createCertificateIssuerWithResponse#issuer + Issuer newIssuer = new Issuer("issuerName", "providerName") + .accountId("keyvaultuser") + .password("temp2"); + certificateAsyncClient.createCertificateIssuerWithResponse(newIssuer) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(issuerResponse -> { + System.out.printf("Issuer created with %s and %s", issuerResponse.getValue().name(), + issuerResponse.getValue().provider()); + }); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.createCertificateIssuerWithResponse#issuer + } + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#getCertificateIssuer(String)} + */ + public void getCertificateIssuerCodeSnippets() { + CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificateIssuer#string + certificateAsyncClient.getCertificateIssuer("issuerName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(issuer -> { + System.out.printf("Issuer returned with %s and %s", issuer.name(), issuer.provider()); + }); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificateIssuer#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificateIssuerWithResponse#string + certificateAsyncClient.getCertificateIssuerWithResponse("issuerName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(issuerResponse -> { + System.out.printf("Issuer returned with %s and %s", issuerResponse.getValue().name(), + issuerResponse.getValue().provider()); + }); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificateIssuerWithResponse#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificateIssuer#issuerBase + certificateAsyncClient.getCertificateIssuer("issuerName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(issuerBase -> certificateAsyncClient.getCertificateIssuer(issuerBase) + .subscribe(issuerResponse -> { + System.out.printf("Issuer returned with %s and %s", issuerResponse.name(), issuerResponse.provider()); + })); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificateIssuer#issuerBase + + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificateIssuerWithResponse#issuerBase + certificateAsyncClient.getCertificateIssuerWithResponse("issuerName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(issuerBase -> certificateAsyncClient.getCertificateIssuerWithResponse(issuerBase.getValue()) + .subscribe(issuerResponse -> { + System.out.printf("Issuer returned with %s and %s", issuerResponse.getValue().name(), + issuerResponse.getValue().provider()); + })); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.getCertificateIssuerWithResponse#issuerBase + } + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#updateCertificate(CertificateBase)} + */ + public void updateCertificateCodeSnippets() { + CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.updateCertificate#CertificateBase + certificateAsyncClient.getCertificateWithPolicy("certificateName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(certificateResponseValue -> { + Certificate certificate = certificateResponseValue; + //Update enabled status of the certificate + certificate.enabled(false); + certificateAsyncClient.updateCertificate(certificate) + .subscribe(certificateResponse -> + System.out.printf("Certificate's enabled status %s \n", + certificateResponse.enabled().toString())); + }); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.updateCertificate#CertificateBase + } + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#updateCertificateIssuer(Issuer)} + */ + public void updateCertificateIssuerCodeSnippets() { + CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.updateCertificateIssuer#IssuerBase + certificateAsyncClient.getCertificateIssuer("issuerName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(issuerResponseValue -> { + Issuer issuer = issuerResponseValue; + //Update the enabled status of the issuer. + issuer.enabled(false); + certificateAsyncClient.updateCertificateIssuer(issuer) + .subscribe(issuerResponse -> + System.out.printf("Issuer's enabled status %s \n", + issuerResponse.enabled().toString())); + }); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.updateCertificateIssuer#IssuerBase + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.updateCertificateIssuerWithResponse#IssuerBase + certificateAsyncClient.getCertificateIssuer("issuerName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(issuerResponseValue -> { + Issuer issuer = issuerResponseValue; + //Update the enabled status of the issuer. + issuer.enabled(false); + certificateAsyncClient.updateCertificateIssuerWithResponse(issuer) + .subscribe(issuerResponse -> + System.out.printf("Issuer's enabled status %s \n", + issuerResponse.getValue().enabled().toString())); + }); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.updateCertificateIssuerWithResponse#IssuerBase + } + + /** + * Method to insert code snippets for + * {@link CertificateAsyncClient#updateCertificatePolicy(String, CertificatePolicy)} + */ + public void updateCertificatePolicyCodeSnippets() { + CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.updateCertificatePolicy#string + certificateAsyncClient.getCertificatePolicy("certificateName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(certificatePolicyResponseValue -> { + CertificatePolicy certificatePolicy = certificatePolicyResponseValue; + // Update transparency + certificatePolicy.certificateTransparency(true); + certificateAsyncClient.updateCertificatePolicy("certificateName", certificatePolicy) + .subscribe(updatedPolicy -> + System.out.printf("Certificate policy's updated transparency status %s \n", + updatedPolicy.certificateTransparency().toString())); + }); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.updateCertificatePolicy#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.updateCertificatePolicyWithResponse#string + certificateAsyncClient.getCertificatePolicy("certificateName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(certificatePolicyResponseValue -> { + CertificatePolicy certificatePolicy = certificatePolicyResponseValue; + // Update transparency + certificatePolicy.certificateTransparency(true); + certificateAsyncClient.updateCertificatePolicyWithResponse("certificateName", + certificatePolicy) + .subscribe(updatedPolicyResponse -> + System.out.printf("Certificate policy's updated transparency status %s \n", + updatedPolicyResponse.getValue().certificateTransparency().toString())); + }); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.updateCertificatePolicyWithResponse#string + } + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#updateCertificate(CertificateBase)} + */ + public void updateCertificateWithResponseCodeSnippets() { + CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.updateCertificateWithResponse#CertificateBase + certificateAsyncClient.getCertificateWithPolicy("certificateName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(certificateResponseValue -> { + Certificate certificate = certificateResponseValue; + //Update the enabled status of the certificate. + certificate.enabled(false); + certificateAsyncClient.updateCertificateWithResponse(certificate) + .subscribe(certificateResponse -> + System.out.printf("Certificate's enabled status %s \n", + certificateResponse.getValue().enabled().toString())); + }); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.updateCertificateWithResponse#CertificateBase + } + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#deleteCertificate(String)} + */ + public void deleteCertificateCodeSnippets() { + CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.deleteCertificate#string + certificateAsyncClient.deleteCertificate("certificateName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(deletedSecretResponse -> + System.out.printf("Deleted Certificate's Recovery Id %s \n", deletedSecretResponse.recoveryId())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.deleteCertificate#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.deleteCertificateWithResponse#string + certificateAsyncClient.deleteCertificateWithResponse("certificateName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(deletedSecretResponse -> + System.out.printf("Deleted Certificate's Recovery Id %s \n", + deletedSecretResponse.getValue().recoveryId())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.deleteCertificateWithResponse#string + } + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#deleteCertificateIssuer(String)} + */ + public void deleteCertificateIssuerCodeSnippets() { + CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.deleteCertificateIssuerWithResponse#string + certificateAsyncClient.deleteCertificateIssuerWithResponse("issuerName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(deletedIssuerResponse -> + System.out.printf("Deleted issuer with name %s \n", deletedIssuerResponse.getValue().name())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.deleteCertificateIssuerWithResponse#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.deleteCertificateIssuer#string + certificateAsyncClient.deleteCertificateIssuer("issuerName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(deletedIssuerResponse -> + System.out.printf("Deleted issuer with name %s \n", deletedIssuerResponse.name())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.deleteCertificateIssuer#string + } + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#getDeletedCertificate(String)} + */ + public void getDeletedCertificateCodeSnippets() { + CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.getDeletedCertificate#string + certificateAsyncClient.getDeletedCertificate("certificateName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(deletedSecretResponse -> + System.out.printf("Deleted Certificate's Recovery Id %s \n", deletedSecretResponse.recoveryId())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.getDeletedCertificate#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.getDeletedCertificateWithResponse#string + certificateAsyncClient.getDeletedCertificateWithResponse("certificateName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(deletedSecretResponse -> + System.out.printf("Deleted Certificate's Recovery Id %s \n", + deletedSecretResponse.getValue().recoveryId())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.getDeletedCertificateWithResponse#string + } + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#purgeDeletedCertificate(String)} + */ + public void purgeDeletedCertificateCodeSnippets() { + CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.purgeDeletedCertificateWithResponse#string + certificateAsyncClient.purgeDeletedCertificate("deletedCertificateName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(purgeResponse -> + System.out.printf("Purge Status response %d \n", purgeResponse.getStatusCode())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.purgeDeletedCertificateWithResponse#string + } + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#recoverDeletedCertificate(String)} + */ + public void recoverDeletedCertificateCodeSnippets() { + CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); + // BEGIN: com.azure.security.certificatevault.certificates.CertificateAsyncClient.recoverDeletedCertificate#string + certificateAsyncClient.recoverDeletedCertificate("deletedCertificateName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(recoveredSecretResponse -> + System.out.printf("Recovered Certificate with name %s \n", recoveredSecretResponse.name())); + // END: com.azure.security.certificatevault.certificates.CertificateAsyncClient.recoverDeletedCertificate#string + + // BEGIN: com.azure.security.certificatevault.certificates.CertificateAsyncClient.recoverDeletedCertificateWithResponse#string + certificateAsyncClient.recoverDeletedCertificateWithResponse("deletedCertificateName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(recoveredSecretResponse -> + System.out.printf("Recovered Certificate with name %s \n", recoveredSecretResponse.getValue().name())); + // END: com.azure.security.certificatevault.certificates.CertificateAsyncClient.recoverDeletedCertificateWithResponse#string + } + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#backupCertificate(String)} + */ + public void backupCertificateCodeSnippets() { + CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.backupCertificate#string + certificateAsyncClient.backupCertificate("certificateName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(certificateBackupResponse -> + System.out.printf("Certificate's Backup Byte array's length %s \n", certificateBackupResponse.length)); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.backupCertificate#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.backupCertificateWithResponse#string + certificateAsyncClient.backupCertificateWithResponse("certificateName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(certificateBackupResponse -> + System.out.printf("Certificate's Backup Byte array's length %s \n", + certificateBackupResponse.getValue().length)); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.backupCertificateWithResponse#string + } + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#restoreCertificate(byte[])} + */ + public void restoreCertificateCodeSnippets() { + CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.restoreCertificate#byte + byte[] certificateBackupByteArray = {}; + certificateAsyncClient.restoreCertificate(certificateBackupByteArray) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(certificateResponse -> System.out.printf("Restored Certificate with name %s and key id %s \n", + certificateResponse.name(), certificateResponse.keyId())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.restoreCertificate#byte + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.restoreCertificateWithResponse#byte + byte[] certificateBackup = {}; + certificateAsyncClient.restoreCertificate(certificateBackup) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(certificateResponse -> System.out.printf("Restored Certificate with name %s and key id %s \n", + certificateResponse.name(), certificateResponse.keyId())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.restoreCertificateWithResponse#byte + } + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#listCertificates()} + */ + public void listCertificatesCodeSnippets() { + CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.listCertificates + certificateAsyncClient.listCertificates() + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(certificateBase -> certificateAsyncClient.getCertificate(certificateBase) + .subscribe(certificateResponse -> System.out.printf("Received certificate with name %s and key id %s", + certificateResponse.name(), certificateResponse.keyId()))); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.listCertificates + } + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#listCertificateIssuers()} + */ + public void listCertificateIssuersCodeSnippets() { + CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.listCertificateIssuers + certificateAsyncClient.listCertificateIssuers() + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(issuerBase -> certificateAsyncClient.getCertificateIssuer(issuerBase) + .subscribe(issuerResponse -> System.out.printf("Received issuer with name %s and provider %s", + issuerResponse.name(), issuerResponse.provider()))); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.listCertificateIssuers + } + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#listDeletedCertificates()} + */ + public void listDeletedCertificatesCodeSnippets() { + CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.listDeletedCertificates + certificateAsyncClient.listDeletedCertificates() + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(deletedCertificateResponse -> System.out.printf("Deleted Certificate's Recovery Id %s \n", + deletedCertificateResponse.recoveryId())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.listDeletedCertificates + } + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#listCertificateVersions(String)} + */ + public void listCertificateVersionsCodeSnippets() { + CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.listCertificateVersions + certificateAsyncClient.listCertificateVersions("certificateName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(certificateBase -> certificateAsyncClient.getCertificate(certificateBase) + .subscribe(certificateResponse -> System.out.printf("Received certificate with name %s and key id %s", + certificateResponse.name(), certificateResponse.keyId()))); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.listCertificateVersions + } + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#setCertificateContacts(List)} + */ + public void contactsOperationsCodeSnippets() { + CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.setCertificateContacts#contacts + Contact oontactToAdd = new Contact("user", "useremail@exmaple.com"); + certificateAsyncClient.setCertificateContacts(Arrays.asList(oontactToAdd)).subscribe(contact -> + System.out.printf("Contact name %s and email %s", contact.name(), contact.emailAddress()) + ); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.setCertificateContacts#contacts + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.listCertificateContacts + certificateAsyncClient.listCertificateContacts().subscribe(contact -> + System.out.printf("Contact name %s and email %s", contact.name(), contact.emailAddress()) + ); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.listCertificateContacts + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.deleteCertificateContacts + certificateAsyncClient.listCertificateContacts().subscribe(contact -> + System.out.printf("Deleted Contact name %s and email %s", contact.name(), contact.emailAddress()) + ); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.deleteCertificateContacts + } + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#cancelCertificateOperation(String)} and + * {@link CertificateAsyncClient#cancelCertificateOperationWithResponse(String)} + */ + public void certificateOperationCodeSnippets() { + CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.cancelCertificateOperation#string + certificateAsyncClient.cancelCertificateOperation("certificateName") + .subscribe(certificateOperation -> System.out.printf("Certificate operation status %s", + certificateOperation.status())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.cancelCertificateOperation#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.cancelCertificateOperationWithResponse#string + certificateAsyncClient.cancelCertificateOperationWithResponse("certificateName") + .subscribe(certificateOperationResponse -> System.out.printf("Certificate operation status %s", + certificateOperationResponse.getValue().status())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.cancelCertificateOperationWithResponse#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.deleteCertificateOperationWithResponse#string + certificateAsyncClient.deleteCertificateOperationWithResponse("certificateName") + .subscribe(certificateOperationResponse -> System.out.printf("Deleted Certificate operation's last" + + " status %s", certificateOperationResponse.getValue().status())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.deleteCertificateOperationWithResponse#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.deleteCertificateOperation#string + certificateAsyncClient.deleteCertificateOperation("certificateName") + .subscribe(certificateOperation -> System.out.printf("Deleted Certificate operation last status %s", + certificateOperation.status())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.deleteCertificateOperation#string + } + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#getPendingCertificateSigningRequest(String)} + * and {@link CertificateAsyncClient#getPendingCertificateSigningRequestWithResponse(String)} + */ + public void getPendingCertificateSigningRequestCodeSnippets() { + CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.getPendingCertificateSigningRequest#string + certificateAsyncClient.getPendingCertificateSigningRequest("certificateName") + .subscribe(signingRequest -> System.out.printf("Received Signing request blob of length %s", + signingRequest.length)); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.getPendingCertificateSigningRequest#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.getPendingCertificateSigningRequestWithResponse#string + certificateAsyncClient.getPendingCertificateSigningRequestWithResponse("certificateName") + .subscribe(signingRequestResponse -> System.out.printf("Received Signing request blob of length %s", + signingRequestResponse.getValue().length)); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.getPendingCertificateSigningRequestWithResponse#string + } + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#mergeCertificate(MergeCertificateOptions)} + * and {@link CertificateAsyncClient#mergeCertificate(String, List)} + */ + public void mergeCertificateCodeSnippets() { + CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.mergeCertificate#String-List + List x509Certs = new ArrayList<>(); + certificateAsyncClient.mergeCertificate("certificateName", x509Certs) + .subscribe(certificate -> System.out.printf("Received Certificate with name %s and key id %s", + certificate.name(), certificate.keyId())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.mergeCertificate#String-List + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.mergeCertificateWithResponse#String-List + List x509Certificates = new ArrayList<>(); + certificateAsyncClient.mergeCertificateWithResponse("certificateName", x509Certificates) + .subscribe(certificateResponse -> System.out.printf("Received Certificate with name %s and key id %s", + certificateResponse.getValue().name(), certificateResponse.getValue().keyId())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.mergeCertificateWithResponse#String-List + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.mergeCertificate#config + List x509CertificatesToMerge = new ArrayList<>(); + MergeCertificateOptions config = new MergeCertificateOptions("certificateName", x509CertificatesToMerge) + .enabled(false); + certificateAsyncClient.mergeCertificate(config) + .subscribe(certificate -> System.out.printf("Received Certificate with name %s and key id %s", + certificate.name(), certificate.keyId())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.mergeCertificate#config + + // BEGIN: com.azure.security.keyvault.certificates.CertificateAsyncClient.mergeCertificateWithResponse#config + List x509CertsToMerge = new ArrayList<>(); + MergeCertificateOptions mergeConfig = new MergeCertificateOptions("certificateName", x509CertsToMerge) + .enabled(false); + certificateAsyncClient.mergeCertificateWithResponse(mergeConfig) + .subscribe(certificateResponse -> System.out.printf("Received Certificate with name %s and key id %s", + certificateResponse.getValue().name(), certificateResponse.getValue().keyId())); + // END: com.azure.security.keyvault.certificates.CertificateAsyncClient.mergeCertificateWithResponse#config + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/CertificateClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/CertificateClientJavaDocCodeSnippets.java new file mode 100644 index 000000000000..2f80176643f5 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/CertificateClientJavaDocCodeSnippets.java @@ -0,0 +1,667 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.VoidResponse; +import com.azure.core.util.Context; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.certificates.models.Certificate; +import com.azure.security.keyvault.certificates.models.CertificateOperation; +import com.azure.security.keyvault.certificates.models.CertificatePolicy; +import com.azure.security.keyvault.certificates.models.DeletedCertificate; +import com.azure.security.keyvault.certificates.models.Contact; +import com.azure.security.keyvault.certificates.models.Issuer; +import com.azure.security.keyvault.certificates.models.CertificateBase; +import com.azure.security.keyvault.certificates.models.IssuerBase; +import com.azure.security.keyvault.certificates.models.MergeCertificateOptions; +import com.azure.security.keyvault.certificates.models.Administrator; + +import java.time.Duration; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.List; + +/** + * This class contains code samples for generating javadocs through doclets for {@link CertificateClient} + */ +public final class CertificateClientJavaDocCodeSnippets { + + private String key1 = "key1"; + private String key2 = "key2"; + private String value1 = "val1"; + private String value2 = "val2"; + + /** + * Implementation for.CertificateClient + * @return sync CertificateClient + */ + private CertificateClient getCertificateClient() { + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.instantiation + CertificateClient certificateClient = new CertificateClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myvault.vault.azure.net/") + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .buildClient(); + // END: com.azure.security.keyvault.certificates.CertificateClient.instantiation + return certificateClient; + } + + + /** + * Method to insert code snippets for {@link CertificateClient#getCertificatePolicy(String)} + */ + public void getCertiificatePolicyCodeSnippets() { + CertificateClient certificateClient = getCertificateClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.getCertificatePolicy#string + CertificatePolicy policy = certificateClient.getCertificatePolicy("certificateName"); + System.out.printf("Received policy with subject name %s", policy.subjectName()); + // END: com.azure.security.keyvault.certificates.CertificateClient.getCertificatePolicy#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.getCertificatePolicyWithResponse#string + Response returnedPolicyWithResponse = certificateClient.getCertificatePolicyWithResponse( + "certificateName", new Context(key1, value1)); + System.out.printf("Received policy with subject name %s", returnedPolicyWithResponse.getValue().subjectName()); + // END: com.azure.security.keyvault.certificates.CertificateClient.getCertificatePolicyWithResponse#string + } + + + + /** + * Method to insert code snippets for {@link CertificateClient#getCertificateWithPolicy(String)} + */ + public void getCertificateWithResponseCodeSnippets() { + CertificateClient certificateClient = getCertificateClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.getCertificateWithPolicy#String + Certificate certificate = certificateClient.getCertificateWithPolicy("certificateName"); + System.out.printf("Recevied certificate with name %s and version %s and secret id", certificate.name(), + certificate.version(), certificate.secretId()); + // END: com.azure.security.keyvault.certificates.CertificateClient.getCertificateWithPolicy#String + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.getCertificateWithResponse#String-String-Context + Response returnedCertificateWithResponse = certificateClient.getCertificateWithResponse( + "certificateName", "certificateVersion", new Context(key1, value1)); + System.out.printf("Recevied certificate with name %s and version %s and secret id", + returnedCertificateWithResponse.getValue().name(), returnedCertificateWithResponse.getValue().version(), + returnedCertificateWithResponse.getValue().secretId()); + // END: com.azure.security.keyvault.certificates.CertificateClient.getCertificateWithResponse#String-String-Context + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.getCertificate#String-String + Certificate returnedCertificate = certificateClient.getCertificate("certificateName", + "certificateVersion"); + System.out.printf("Recevied certificate with name %s and version %s and secret id", returnedCertificate.name(), + returnedCertificate.version(), returnedCertificate.secretId()); + // END: com.azure.security.keyvault.certificates.CertificateClient.getCertificate#String-String + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.getCertificate#CertificateBase + for (CertificateBase cert : certificateClient.listCertificates()) { + Certificate certificateWithAllProperties = certificateClient.getCertificate(cert); + System.out.printf("Received certificate with name %s and secret id %s", certificateWithAllProperties.name(), + certificateWithAllProperties.secretId()); + } + // END: com.azure.security.keyvault.certificates.CertificateClient.getCertificate#CertificateBase + } + + /** + * Method to insert code snippets for {@link CertificateClient#createCertificate(String, CertificatePolicy)} + */ + public void createCertificateCodeSnippets() { + CertificateClient certificateClient = getCertificateClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.createCertificate#String-CertificatePolicy-Map-Duration + CertificatePolicy policy = new CertificatePolicy("Self", "CN=SelfSignedJavaPkcs12"); + Map tags = new HashMap<>(); + tags.put("foo", "bar"); + try { + CertificateOperation certificateOperation = certificateClient.createCertificate("certificateName", + policy, tags, Duration.ofMillis(60000)); + System.out.printf("Certificate operation status %s", certificateOperation.status()); + } catch (IllegalStateException e) { + // Certificate wasn't created in the specified duration. + // Log / Handle here + } + // END: com.azure.security.keyvault.certificates.CertificateClient.createCertificate#String-CertificatePolicy-Map-Duration + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.createCertificate#String-CertificatePolicy-Map + CertificatePolicy certPolicy = new CertificatePolicy("Self", "CN=SelfSignedJavaPkcs12"); + Map metadataTags = new HashMap<>(); + metadataTags.put("foo", "bar"); + CertificateOperation certificateOperation = certificateClient.createCertificate("certificateName", + certPolicy, metadataTags); + System.out.printf("Certificate operation status %s", certificateOperation.status()); + // END: com.azure.security.keyvault.certificates.CertificateClient.createCertificate#String-CertificatePolicy-Map + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.createCertificate#String-CertificatePolicy-Duration + try { + CertificatePolicy certificatePolicy = new CertificatePolicy("Self", + "CN=SelfSignedJavaPkcs12"); + CertificateOperation certificateOp = certificateClient.createCertificate("certificateName", + certificatePolicy, Duration.ofMillis(60000)); + System.out.printf("Certificate operation status %s", certificateOp.status()); + } catch (IllegalStateException e) { + // Certificate wasn't created in the specified duration. + // Log / Handle here + } + // END: com.azure.security.keyvault.certificates.CertificateClient.createCertificate#String-CertificatePolicy-Duration + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.createCertificate#String-CertificatePolicy + CertificatePolicy certificatePolicy = new CertificatePolicy("Self", + "CN=SelfSignedJavaPkcs12"); + CertificateOperation certificateOp = certificateClient.createCertificate("certificateName", + certificatePolicy); + System.out.printf("Certificate operation status %s", certificateOp.status()); + // END: com.azure.security.keyvault.certificates.CertificateClient.createCertificate#String-CertificatePolicy + } + + /** + * Method to insert code snippets for {@link CertificateClient#createCertificateIssuer(String, String)} + */ + public void createCertificateIssuerCodeSnippets() { + CertificateClient certificateClient = getCertificateClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.createCertificateIssuer#String-String + Issuer createdIssuer = certificateClient.createCertificateIssuer("myIssuer", "myProvider"); + System.out.printf("Created Issuer with name %s provider %s", createdIssuer.name(), createdIssuer.provider()); + // END: com.azure.security.keyvault.certificates.CertificateClient.createCertificateIssuer#String-String + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.createCertificateIssuer#issuer + Issuer issuerToCreate = new Issuer("myissuer", "myProvider") + .accountId("testAccount") + .administrators(Arrays.asList(new Administrator("test", "name", + "test@example.com"))); + Issuer returnedIssuer = certificateClient.createCertificateIssuer(issuerToCreate); + System.out.printf("Created Issuer with name %s provider %s", returnedIssuer.name(), returnedIssuer.provider()); + // END: com.azure.security.keyvault.certificates.CertificateClient.createCertificateIssuer#issuer + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.createCertificateIssuerWithResponse#Issuer-Context + Issuer issuer = new Issuer("issuerName", "myProvider") + .accountId("testAccount") + .administrators(Arrays.asList(new Administrator("test", "name", + "test@example.com"))); + Response issuerResponse = certificateClient.createCertificateIssuerWithResponse(issuer, + new Context(key1, value1)); + System.out.printf("Created Issuer with name %s provider %s", issuerResponse.getValue().name(), + issuerResponse.getValue().provider()); + // END: com.azure.security.keyvault.certificates.CertificateClient.createCertificateIssuerWithResponse#Issuer-Context + } + + /** + * Method to insert code snippets for {@link CertificateClient#getCertificateIssuer(String)} + */ + public void getCertificateIssuerCodeSnippets() { + CertificateClient certificateClient = getCertificateClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.getCertificateIssuer#string + Issuer returnedIssuer = certificateClient.getCertificateIssuer("issuerName"); + System.out.printf("Retrieved issuer with name %s and prodier %s", returnedIssuer.name(), + returnedIssuer.provider()); + // END: com.azure.security.keyvault.certificates.CertificateClient.getCertificateIssuer#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.getCertificateIssuerWithResponse#string-context + Response issuerResponse = certificateClient.getCertificateIssuerWithResponse("issuerName", + new Context(key1, value1)); + System.out.printf("Retrieved issuer with name %s and prodier %s", issuerResponse.getValue().name(), + issuerResponse.getValue().provider()); + // END: com.azure.security.keyvault.certificates.CertificateClient.getCertificateIssuerWithResponse#string-context + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.getCertificateIssuer#issuerBase + for (IssuerBase issuer : certificateClient.listCertificateIssuers()) { + Issuer retrievedIssuer = certificateClient.getCertificateIssuer(issuer); + System.out.printf("Received issuer with name %s and provider %s", retrievedIssuer.name(), + retrievedIssuer.provider()); + } + // END: com.azure.security.keyvault.certificates.CertificateClient.getCertificateIssuer#issuerBase + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.getCertificateIssuerWithResponse#issuerBase-context + for (IssuerBase issuer : certificateClient.listCertificateIssuers()) { + Response retrievedIssuerResponse = certificateClient.getCertificateIssuerWithResponse(issuer, + new Context(key1, value1)); + System.out.printf("Received issuer with name %s and provider %s", retrievedIssuerResponse.getValue().name(), + retrievedIssuerResponse.getValue().provider()); + } + // END: com.azure.security.keyvault.certificates.CertificateClient.getCertificateIssuerWithResponse#issuerBase-context + } + + /** + * Method to insert code snippets for {@link CertificateClient#updateCertificate(CertificateBase)} + */ + public void updateCertificateCodeSnippets() { + CertificateClient certificateClient = getCertificateClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.updateCertificate#CertificateBase + Certificate certificate = certificateClient.getCertificateWithPolicy("certificateName"); + Map tags = new HashMap<>(); + tags.put("foo", "bar"); + // Update certificate enabled status + certificate.enabled(false); + Certificate updatedCertificate = certificateClient.updateCertificate(certificate); + System.out.printf("Updated Certificate with name %s and enabled status %s", updatedCertificate.name(), + updatedCertificate.enabled()); + // END: com.azure.security.keyvault.certificates.CertificateClient.updateCertificate#CertificateBase + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.updateCertificateWithResponse#CertificateBase-Context + Certificate certificateToUpdate = certificateClient.getCertificateWithPolicy("certificateName"); + // Update certificate enabled status + certificateToUpdate.enabled(false); + Response updatedCertificateResponse = certificateClient. + updateCertificateWithResponse(certificateToUpdate, new Context(key1, value1)); + System.out.printf("Updated Certificate with name %s and enabled status %s", + updatedCertificateResponse.getValue().name(), updatedCertificateResponse.getValue().enabled()); + // END: com.azure.security.keyvault.certificates.CertificateClient.updateCertificateWithResponse#CertificateBase-Context + } + + /** + * Method to insert code snippets for {@link CertificateClient#updateCertificateIssuer(Issuer)} + */ + public void updateCertificateIssuerCodeSnippets() { + CertificateClient certificateClient = getCertificateClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.updateCertificateIssuer#issuer + Issuer returnedIssuer = certificateClient.getCertificateIssuer("issuerName"); + returnedIssuer.accountId("newAccountId"); + Issuer updatedIssuer = certificateClient.updateCertificateIssuer(returnedIssuer); + System.out.printf("Updated issuer with name %s, provider %s and account Id %s", updatedIssuer.name(), + updatedIssuer.provider(), updatedIssuer.accountId()); + // END: com.azure.security.keyvault.certificates.CertificateClient.updateCertificateIssuer#issuer + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.updateCertificateIssuerWithResponse#Issuer-Context + Issuer issuer = certificateClient.getCertificateIssuer("issuerName"); + returnedIssuer.accountId("newAccountId"); + Response updatedIssuerWithResponse = certificateClient.updateCertificateIssuerWithResponse(issuer, + new Context(key1, value1)); + System.out.printf("Updated issuer with name %s, provider %s and account Id %s", + updatedIssuerWithResponse.getValue().name(), updatedIssuerWithResponse.getValue().provider(), + updatedIssuerWithResponse.getValue().accountId()); + // END: com.azure.security.keyvault.certificates.CertificateClient.updateCertificateIssuerWithResponse#Issuer-Context + } + + /** + * Method to insert code snippets for {@link CertificateClient#updateCertificatePolicy(String, CertificatePolicy)} + */ + public void updateCertificatePolicyCodeSnippets() { + CertificateClient certificateClient = getCertificateClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.updateCertificatePolicy#string + CertificatePolicy certificatePolicy = certificateClient.getCertificatePolicy("certificateName"); + //Update the certificate policy cert transparency property. + certificatePolicy.certificateTransparency(true); + CertificatePolicy updatedCertPolicy = certificateClient.updateCertificatePolicy("certificateName", + certificatePolicy); + System.out.printf("Updated Certificate Policy transparency status %s", + updatedCertPolicy.certificateTransparency()); + // END: com.azure.security.keyvault.certificates.CertificateClient.updateCertificatePolicy#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.updateCertificatePolicyWithResponse#string + CertificatePolicy certificatePolicyToUpdate = certificateClient.getCertificatePolicy("certificateName"); + //Update the certificate policy cert transparency property. + certificatePolicyToUpdate.certificateTransparency(true); + Response updatedCertPolicyWithResponse = certificateClient + .updateCertificatePolicyWithResponse("certificateName", certificatePolicyToUpdate, + new Context(key1, value1)); + System.out.printf("Updated Certificate Policy transparency status %s", updatedCertPolicyWithResponse + .getValue().certificateTransparency()); + // END: com.azure.security.keyvault.certificates.CertificateClient.updateCertificatePolicyWithResponse#string + } + + /** + * Method to insert code snippets for {@link CertificateClient#deleteCertificate(String)} + */ + public void deleteCertificateCodeSnippets() { + CertificateClient certificateClient = getCertificateClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.deleteCertificate#string + DeletedCertificate deletedCertificate = certificateClient.deleteCertificate("certificateName"); + System.out.printf("Deleted certitifcate with name %s and recovery id %s", deletedCertificate.name(), + deletedCertificate.recoveryId()); + // END: com.azure.security.keyvault.certificates.CertificateClient.deleteCertificate#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.deleteCertificateWithResponse#String-Context + Response deletedCertificateResponse = certificateClient + .deleteCertificateWithResponse("certificateName", new Context(key1, value1)); + System.out.printf("Deleted certitifcate with name %s and recovery id %s", + deletedCertificateResponse.getValue().name(), deletedCertificateResponse.getValue().recoveryId()); + // END: com.azure.security.keyvault.certificates.CertificateClient.deleteCertificateWithResponse#String-Context + } + + /** + * Method to insert code snippets for {@link CertificateClient#deleteCertificateIssuer(String)} + */ + public void deleteCertificateIssuerCodeSnippets() { + CertificateClient certificateClient = getCertificateClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.deleteCertificateIssuerWithResponse#string-context + Issuer deletedIssuer = certificateClient.deleteCertificateIssuer("certificateName"); + System.out.printf("Deleted certificate issuer with name %s and provider id %s", deletedIssuer.name(), + deletedIssuer.provider()); + // END: com.azure.security.keyvault.certificates.CertificateClient.deleteCertificateIssuerWithResponse#string-context + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.deleteCertificateIssuer#string + Response deletedIssuerWithResponse = certificateClient. + deleteCertificateIssuerWithResponse("certificateName", new Context(key1, value1)); + System.out.printf("Deleted certificate issuer with name %s and provider id %s", + deletedIssuerWithResponse.getValue().name(), deletedIssuerWithResponse.getValue().provider()); + // END: com.azure.security.keyvault.certificates.CertificateClient.deleteCertificateIssuer#string + } + + /** + * Method to insert code snippets for {@link CertificateClient#getDeletedCertificate(String)} + */ + public void getDeletedCertificateCodeSnippets() { + CertificateClient certificateClient = getCertificateClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.getDeletedCertificate#string + DeletedCertificate deletedCertificate = certificateClient.getDeletedCertificate("certificateName"); + System.out.printf("Deleted certificate with name %s and recovery id %s", deletedCertificate.name(), + deletedCertificate.recoveryId()); + // END: com.azure.security.keyvault.certificates.CertificateClient.getDeletedCertificate#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.getDeletedCertificateWithResponse#String-Context + Response deletedCertificateWithResponse = certificateClient + .getDeletedCertificateWithResponse("certificateName", new Context(key1, value1)); + System.out.printf("Deleted certificate with name %s and recovery id %s", + deletedCertificateWithResponse.getValue().name(), deletedCertificateWithResponse.getValue().recoveryId()); + // END: com.azure.security.keyvault.certificates.CertificateClient.getDeletedCertificateWithResponse#String-Context + } + + /** + * Method to insert code snippets for {@link CertificateClient#purgeDeletedCertificateWithResponse(String, Context)} + */ + public void purgeDeletedCertificateCodeSnippets() { + CertificateClient certificateClient = getCertificateClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.purgeDeletedCertificateWithResponse#string + certificateClient.purgeDeletedCertificateWithResponse("certificateName"); + // END: com.azure.security.keyvault.certificates.CertificateClient.purgeDeletedCertificateWithResponse#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.purgeDeletedCertificateWithResponse#string-Context + VoidResponse purgeResponse = certificateClient.purgeDeletedCertificateWithResponse("certificateName", + new Context(key1, value1)); + System.out.printf("Purged Deleted certificate with status %s", purgeResponse.getStatusCode()); + // END: com.azure.security.keyvault.certificates.CertificateClient.purgeDeletedCertificateWithResponse#string-Context + } + + /** + * Method to insert code snippets for {@link CertificateClient#recoverDeletedCertificate(String)} (String)} + */ + public void recoverDeletedCertificateCodeSnippets() { + CertificateClient certificateClient = getCertificateClient(); + // BEGIN: com.azure.security.certificatevault.certificates.CertificateClient.recoverDeletedCertificate#string + Certificate certificate = certificateClient.recoverDeletedCertificate("deletedCertificateName"); + System.out.printf(" Recovered Deleted certificate with name %s and id %s", certificate.name(), + certificate.id()); + // END: com.azure.security.certificatevault.certificates.CertificateClient.recoverDeletedCertificate#string + + // BEGIN: com.azure.security.certificatevault.certificates.CertificateClient.recoverDeletedCertificateWithResponse#String-Context + Response recoveredCertificate = certificateClient + .recoverDeletedCertificateWithResponse("deletedCertificateName", new Context(key1, value1)); + System.out.printf(" Recovered Deleted certificate with name %s and id %s", + recoveredCertificate.getValue().name(), recoveredCertificate.getValue().id()); + // END: com.azure.security.certificatevault.certificates.CertificateClient.recoverDeletedCertificateWithResponse#String-Context + } + + /** + * Method to insert code snippets for {@link CertificateClient#backupCertificate(String)} + */ + public void backupCertificateCodeSnippets() { + CertificateClient certificateClient = getCertificateClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.backupCertificate#string + byte[] certificateBackup = certificateClient.backupCertificate("certificateName"); + System.out.printf("Backed up certificate with back up blob length %d", certificateBackup.length); + // END: com.azure.security.keyvault.certificates.CertificateClient.backupCertificate#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.backupCertificateWithResponse#String-Context + Response certificateBackupWithResponse = certificateClient + .backupCertificateWithResponse("certificateName", new Context(key1, value1)); + System.out.printf("Backed up certificate with back up blob length %d", + certificateBackupWithResponse.getValue().length); + // END: com.azure.security.keyvault.certificates.CertificateClient.backupCertificateWithResponse#String-Context + } + + /** + * Method to insert code snippets for {@link CertificateClient#restoreCertificate(byte[])} + */ + public void restoreCertificateCodeSnippets() { + CertificateClient certificateClient = getCertificateClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.restoreCertificate#byte + byte[] certificateBackupBlob = {}; + Certificate certificate = certificateClient.restoreCertificate(certificateBackupBlob); + System.out.printf(" Restored certificate with name %s and id %s", certificate.name(), certificate.id()); + // END: com.azure.security.keyvault.certificates.CertificateClient.restoreCertificate#byte + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.restoreCertificateWithResponse#byte-Context + byte[] certificateBackupBlobArray = {}; + Response certificateResponse = certificateClient + .restoreCertificateWithResponse(certificateBackupBlobArray, new Context(key1, value1)); + System.out.printf(" Restored certificate with name %s and id %s", certificateResponse.getValue().name(), + certificateResponse.getValue().id()); + // END: com.azure.security.keyvault.certificates.CertificateClient.restoreCertificateWithResponse#byte-Context + } + + /** + * Method to insert code snippets for {@link CertificateClient#listCertificates()} + */ + public void listCertificatesCodeSnippets() { + CertificateClient certificateClient = getCertificateClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.listCertificates + for (CertificateBase certificate : certificateClient.listCertificates()) { + Certificate certificateWithAllProperties = certificateClient.getCertificate(certificate); + System.out.printf("Received certificate with name %s and secret id %s", certificateWithAllProperties.name(), + certificateWithAllProperties.secretId()); + } + // END: com.azure.security.keyvault.certificates.CertificateClient.listCertificates + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.listCertificates#context + for (CertificateBase certificate : certificateClient.listCertificates(true, + new Context(key1, value1))) { + Certificate certificateWithAllProperties = certificateClient.getCertificate(certificate); + System.out.printf("Received certificate with name %s and secret id %s", certificateWithAllProperties.name(), + certificateWithAllProperties.secretId()); + } + // END: com.azure.security.keyvault.certificates.CertificateClient.listCertificates#context + } + + /** + * Method to insert code snippets for {@link CertificateClient#listCertificateIssuers()} + */ + public void listCertificateIssuersCodeSnippets() { + CertificateClient certificateClient = getCertificateClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.listCertificateIssuers + for (IssuerBase issuer : certificateClient.listCertificateIssuers()) { + Issuer retrievedIssuer = certificateClient.getCertificateIssuer(issuer); + System.out.printf("Received issuer with name %s and provider %s", retrievedIssuer.name(), + retrievedIssuer.provider()); + } + // END: com.azure.security.keyvault.certificates.CertificateClient.listCertificateIssuers + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.listCertificateIssuers#context + for (IssuerBase issuer : certificateClient.listCertificateIssuers(new Context(key1, value1))) { + Issuer retrievedIssuer = certificateClient.getCertificateIssuer(issuer); + System.out.printf("Received issuer with name %s and provider %s", retrievedIssuer.name(), + retrievedIssuer.provider()); + } + // END: com.azure.security.keyvault.certificates.CertificateClient.listCertificateIssuers#context + } + + /** + * Method to insert code snippets for {@link CertificateClient#listDeletedCertificates()} + */ + public void listDeletedCertificatesCodeSnippets() { + CertificateClient certificateClient = getCertificateClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.listDeletedCertificates + for (DeletedCertificate deletedCertificate : certificateClient.listDeletedCertificates()) { + System.out.printf("Deleted certificate's recovery Id %s", deletedCertificate.recoveryId()); + } + // END: com.azure.security.keyvault.certificates.CertificateClient.listDeletedCertificates + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.listDeletedCertificates#context + for (DeletedCertificate deletedCertificate : certificateClient + .listDeletedCertificates(new Context(key1, value1))) { + System.out.printf("Deleted certificate's recovery Id %s", deletedCertificate.recoveryId()); + } + // END: com.azure.security.keyvault.certificates.CertificateClient.listDeletedCertificates#context + } + + /** + * Method to insert code snippets for {@link CertificateClient#listCertificateVersions(String)} + */ + public void listCertificateVersionsCodeSnippets() { + CertificateClient certificateClient = getCertificateClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.listCertificateVersions + for (CertificateBase certificate : certificateClient.listCertificateVersions("certificateName")) { + Certificate certificateWithAllProperites = certificateClient.getCertificate(certificate); + System.out.printf("Received certificate's version with name %s, version %s and secret id %s", + certificateWithAllProperites.name(), + certificateWithAllProperites.version(), certificateWithAllProperites.secretId()); + } + // END: com.azure.security.keyvault.certificates.CertificateClient.listCertificateVersions + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.listCertificateVersions#context + for (CertificateBase certificate : certificateClient.listCertificateVersions("certificateName")) { + Certificate certificateWithAllProperites = certificateClient.getCertificate(certificate); + System.out.printf("Received certificate's version with name %s, version %s and secret id %s", + certificateWithAllProperites.name(), + certificateWithAllProperites.version(), certificateWithAllProperites.secretId()); + } + // END: com.azure.security.keyvault.certificates.CertificateClient.listCertificateVersions#context + } + + /** + * Method to insert code snippets for {@link CertificateClient#setCertificateContacts(List)} + */ + public void contactsOperationsCodeSnippets() { + CertificateClient certificateClient = getCertificateClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.setCertificateContacts#contacts + Contact contactToAdd = new Contact("user", "useremail@exmaple.com"); + for (Contact contact : certificateClient.setCertificateContacts(Arrays.asList(contactToAdd))) { + System.out.printf("Added contact with name %s and email %s to key vault", contact.name(), + contact.emailAddress()); + } + // END: com.azure.security.keyvault.certificates.CertificateClient.setCertificateContacts#contacts + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.setCertificateContacts#contacts-context + Contact sampleContact = new Contact("user", "useremail@exmaple.com"); + for (Contact contact : certificateClient.setCertificateContacts(Arrays.asList(sampleContact), + new Context(key1, value1))) { + System.out.printf("Added contact with name %s and email %s to key vault", contact.name(), + contact.emailAddress()); + } + // END: com.azure.security.keyvault.certificates.CertificateClient.setCertificateContacts#contacts-context + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.listCertificateContacts + for (Contact contact : certificateClient.listCertificateContacts()) { + System.out.printf("Added contact with name %s and email %s to key vault", contact.name(), + contact.emailAddress()); + } + // END: com.azure.security.keyvault.certificates.CertificateClient.listCertificateContacts + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.listCertificateContacts#context + for (Contact contact : certificateClient.listCertificateContacts(new Context(key1, value1))) { + System.out.printf("Added contact with name %s and email %s to key vault", contact.name(), + contact.emailAddress()); + } + // END: com.azure.security.keyvault.certificates.CertificateClient.listCertificateContacts#context + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.deleteCertificateContacts + for (Contact contact : certificateClient.deleteCertificateContacts()) { + System.out.printf("Deleted contact with name %s and email %s from key vault", contact.name(), + contact.emailAddress()); + } + // END: com.azure.security.keyvault.certificates.CertificateClient.deleteCertificateContacts + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.deleteCertificateContacts#context + for (Contact contact : certificateClient.deleteCertificateContacts(new Context(key1, value1))) { + System.out.printf("Deleted contact with name %s and email %s from key vault", contact.name(), + contact.emailAddress()); + } + // END: com.azure.security.keyvault.certificates.CertificateClient.deleteCertificateContacts#context + } + + /** + * Method to insert code snippets for {@link CertificateClient#cancelCertificateOperation(String)} and + * {@link CertificateClient#cancelCertificateOperationWithResponse(String, Context)} (String)} + */ + public void certificateOperationCodeSnippets() { + CertificateClient certificateClient = getCertificateClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.cancelCertificateOperation#string + CertificateOperation certificateOperation = certificateClient + .cancelCertificateOperation("certificateName"); + System.out.printf("Certificate Operation status %s", certificateOperation.status()); + // END: com.azure.security.keyvault.certificates.CertificateClient.cancelCertificateOperation#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.cancelCertificateOperationWithResponse#string + Response certificateOperationWithResponse = certificateClient + .cancelCertificateOperationWithResponse("certificateName", new Context(key1, value1)); + System.out.printf("Certificate Operation status %s", certificateOperationWithResponse.getValue().status()); + // END: com.azure.security.keyvault.certificates.CertificateClient.cancelCertificateOperationWithResponse#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.deleteCertificateOperationWithResponse#string + CertificateOperation deletedCertificateOperation = certificateClient + .deleteCertificateOperation("certificateName"); + System.out.printf("Deleted Certificate Operation's last status %s", deletedCertificateOperation.status()); + // END: com.azure.security.keyvault.certificates.CertificateClient.deleteCertificateOperationWithResponse#string + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.deleteCertificateOperation#string + Response deletedCertificateOperationWithResponse = certificateClient + .deleteCertificateOperationWithResponse("certificateName", new Context(key1, value1)); + System.out.printf("Deleted Certificate Operation's last status %s", + deletedCertificateOperationWithResponse.getValue().status()); + // END: com.azure.security.keyvault.certificates.CertificateClient.deleteCertificateOperation#string + } + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#getPendingCertificateSigningRequest(String)} + * and {@link CertificateAsyncClient#getPendingCertificateSigningRequestWithResponse(String)} + */ + public void getPendingCertificateSigningRequestCodeSnippets() { + CertificateClient certificateClient = getCertificateClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.getPendingCertificateSigningRequest#String + byte[] signingRequest = certificateClient.getPendingCertificateSigningRequest("certificateName"); + System.out.printf("Received Signing request blob of length %s", signingRequest.length); + // END: com.azure.security.keyvault.certificates.CertificateClient.getPendingCertificateSigningRequest#String + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.getPendingCertificateSigningRequestWithResponse#String-Context + Response signingRequestResponse = + certificateClient.getPendingCertificateSigningRequestWithResponse("certificateName", + new Context(key2, value2)); + System.out.printf("Received Signing request blob of length %s", signingRequestResponse.getValue().length); + // END: com.azure.security.keyvault.certificates.CertificateClient.getPendingCertificateSigningRequestWithResponse#String-Context + } + + /** + * Method to insert code snippets for {@link CertificateAsyncClient#mergeCertificate(MergeCertificateOptions)} + * and {@link CertificateAsyncClient#mergeCertificate(String, List)} + */ + public void mergeCertificateCodeSnippets() { + CertificateClient certificateClient = getCertificateClient(); + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.mergeCertificate#String-List + List x509Certs = new ArrayList<>(); + Certificate certificate = certificateClient.mergeCertificate("certificateName", x509Certs); + System.out.printf("Received Certificate with name %s and key id %s", certificate.name(), certificate.keyId()); + // END: com.azure.security.keyvault.certificates.CertificateClient.mergeCertificate#String-List + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.mergeCertificateWithResponse#String-List-Context + List x509Certificates = new ArrayList<>(); + Response certificateResponse = + certificateClient.mergeCertificateWithResponse("certificateName", x509Certs, + new Context(key1, value1)); + System.out.printf("Received Certificate with name %s and key id %s", certificateResponse.getValue().name(), + certificateResponse.getValue().keyId()); + // END: com.azure.security.keyvault.certificates.CertificateClient.mergeCertificateWithResponse#String-List-Context + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.mergeCertificate#config + List x509CertificatesToMerge = new ArrayList<>(); + MergeCertificateOptions config = + new MergeCertificateOptions("certificateName", x509CertificatesToMerge) + .enabled(false); + Certificate mergedCertificate = certificateClient.mergeCertificate(config); + System.out.printf("Received Certificate with name %s and key id %s", mergedCertificate.name(), + mergedCertificate.keyId()); + // END: com.azure.security.keyvault.certificates.CertificateClient.mergeCertificate#config + + // BEGIN: com.azure.security.keyvault.certificates.CertificateClient.mergeCertificateWithResponse#config + List x509CertsToMerge = new ArrayList<>(); + MergeCertificateOptions mergeConfig = + new MergeCertificateOptions("certificateName", x509CertsToMerge) + .enabled(false); + Response mergedCertificateWithResponse = + certificateClient.mergeCertificateWithResponse(mergeConfig, new Context(key2, value2)); + System.out.printf("Received Certificate with name %s and key id %s", + mergedCertificateWithResponse.getValue().name(), mergedCertificateWithResponse.getValue().keyId()); + // END: com.azure.security.keyvault.certificates.CertificateClient.mergeCertificateWithResponse#config + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/HelloWorld.java b/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/HelloWorld.java new file mode 100644 index 000000000000..cee853aaa0fa --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/HelloWorld.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.certificates.models.CertificatePolicy; +import com.azure.security.keyvault.certificates.models.EcKeyOptions; +import com.azure.security.keyvault.certificates.models.SubjectAlternativeNames; +import com.azure.security.keyvault.certificates.models.Certificate; +import com.azure.security.keyvault.certificates.models.webkey.KeyCurveName; +import com.azure.security.keyvault.certificates.models.CertificateOperation; +import com.azure.security.keyvault.certificates.models.Issuer; +import com.azure.security.keyvault.certificates.models.DeletedCertificate; + +import java.time.Duration; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Sample demonstrates how to set, get, update and delete a certificate. + */ +public class HelloWorld { + + /** + * Authenticates with the key vault and shows how to set, get, update and delete a certificate in the key vault. + * + * @param args Unused. Arguments to the program. + * @throws IllegalArgumentException when invalid key vault endpoint is passed. + * @throws InterruptedException when the thread is interrupted in sleep mode. + */ + public static void main(String[] args) throws InterruptedException, IllegalArgumentException { + + // Instantiate a certificate client that will be used to call the service. Notice that the client is using default Azure + // credentials. To make default credentials work, ensure that environment variables 'AZURE_CLIENT_ID', + // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. + CertificateClient certificateClient = new CertificateClientBuilder() + .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") + .credential(new DefaultAzureCredentialBuilder().build()) + .buildClient(); + + // Let's create a self signed certificate valid for 1 year. if the certificate + // already exists in the key vault, then a new version of the certificate is created. + CertificatePolicy policy = new CertificatePolicy("Self", "CN=SelfSignedJavaPkcs12") + .subjectAlternativeNames(SubjectAlternativeNames.fromEmails(Arrays.asList("wow@gmail.com"))) + .keyOptions(new EcKeyOptions() + .reuseKey(true) + .curve(KeyCurveName.P_256)) + .validityInMonths(12); + Map tags = new HashMap<>(); + tags.put("foo", "bar"); + + try { + CertificateOperation certificateOperation = certificateClient.createCertificate("certificateName", + policy, tags, Duration.ofMillis(60000)); + System.out.printf("Certificate operation status %s \n", certificateOperation.status()); + } catch (IllegalStateException e) { + // Certificate wasn't created in the specified duration. + // Log / Handle here + } + + // Let's Get the latest version of the certificate from the key vault. + Certificate certificate = certificateClient.getCertificateWithPolicy("certificateName"); + System.out.printf("Certificate is returned with name %s and secret id %s \n", certificate.name(), + certificate.secretId()); + + // After some time, we need to disable the certificate temporarily, so we update the enabled status of the certificate. + // The update method can be used to update the enabled status of the certificate. + certificate.enabled(false); + Certificate updatedCertificate = certificateClient.updateCertificate(certificate); + System.out.printf("Certificate's updated enabled status is %s \n", updatedCertificate.enabled()); + + + //Let's create a certificate issuer. + Issuer issuer = new Issuer("myIssuer", "Test"); + Issuer myIssuer = certificateClient.createCertificateIssuer(issuer); + System.out.printf("Issuer created with name %s and provider %s", myIssuer.name(), myIssuer.provider()); + + // Let's fetch the issuer we just created from the key vault. + myIssuer = certificateClient.getCertificateIssuer("myIssuer"); + System.out.printf("Issuer retrieved with name %s and provider %s", myIssuer.name(), myIssuer.provider()); + + + //Let's create a certificate signed by our issuer. + try { + CertificateOperation certificateOperation = certificateClient.createCertificate("myCertificate", + new CertificatePolicy("myIssuer", "CN=SelfSignedJavaPkcs12"), Duration.ofMillis(60000)); + System.out.printf("Certificate operation status %s \n", certificateOperation.status()); + } catch (IllegalStateException e) { + // Certificate wasn't created in the specified duration. + // Log / Handle here + } + + // Let's Get the latest version of our certificate from the key vault. + Certificate myCert = certificateClient.getCertificateWithPolicy("myCertificate"); + System.out.printf("Certificate is returned with name %s and secret id %s \n", myCert.name(), + myCert.secretId()); + + // The certificates and issuers are no longer needed, need to delete it from the key vault. + DeletedCertificate deletedCertificate = certificateClient.deleteCertificate("certificateName"); + System.out.printf("Certificate is deleted with name %s and its recovery id is %s \n", deletedCertificate.name(), deletedCertificate.recoveryId()); + + deletedCertificate = certificateClient.deleteCertificate("myCertificate"); + System.out.printf("Certificate is deleted with name %s and its recovery id is %s \n", deletedCertificate.name(), deletedCertificate.recoveryId()); + + Issuer deleteCertificateIssuer = certificateClient.deleteCertificateIssuer("myIssuer"); + System.out.printf("Certificate issuer is permanently deleted with name %s and provider is %s \n", deleteCertificateIssuer.name(), deleteCertificateIssuer.provider()); + + // To ensure certificate is deleted on server side. + Thread.sleep(30000); + + // If the keyvault is soft-delete enabled, then for permanent deletion deleted certificates need to be purged. + certificateClient.purgeDeletedCertificateWithResponse("certificateName"); + certificateClient.purgeDeletedCertificateWithResponse("myCertificate"); + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/HelloWorldAsync.java b/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/HelloWorldAsync.java new file mode 100644 index 000000000000..6f8511d0bbde --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/HelloWorldAsync.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.certificates.models.CertificatePolicy; +import com.azure.security.keyvault.certificates.models.EcKeyOptions; +import com.azure.security.keyvault.certificates.models.SubjectAlternativeNames; +import com.azure.security.keyvault.certificates.models.Certificate; +import com.azure.security.keyvault.certificates.models.webkey.KeyCurveName; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Sample demonstrates how to asynchronously set, get, update and delete a key. + */ +public class HelloWorldAsync { + /** + * Authenticates with the key vault and shows how to asynchronously set, get, update and delete a key in the key vault. + * + * @param args Unused. Arguments to the program. + * @throws IllegalArgumentException when invalid key vault endpoint is passed. + * @throws InterruptedException when the thread is interrupted in sleep mode. + */ + public static void main(String[] args) throws InterruptedException { + + // Instantiate an async key client that will be used to call the service. Notice that the client is using default Azure + // credentials. To make default credentials work, ensure that environment variables 'AZURE_CLIENT_ID', + // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. + CertificateAsyncClient certificateAsyncClient = new CertificateClientBuilder() + .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAsyncClient(); + + // Let's create a self signed certificate valid for 1 year. if the certificate + // already exists in the key vault, then a new version of the certificate is created. + CertificatePolicy policy = new CertificatePolicy("Self", "CN=SelfSignedJavaPkcs12") + .subjectAlternativeNames(SubjectAlternativeNames.fromEmails(Arrays.asList("wow@gmail.com"))) + .keyOptions(new EcKeyOptions() + .reuseKey(true) + .curve(KeyCurveName.P_256)); + Map tags = new HashMap<>(); + tags.put("foo", "bar"); + + certificateAsyncClient.createCertificate("certificateName", policy, tags) + .getObserver().subscribe(pollResponse -> { + System.out.println("---------------------------------------------------------------------------------"); + System.out.println(pollResponse.getStatus()); + System.out.println(pollResponse.getValue().status()); + System.out.println(pollResponse.getValue().statusDetails()); + }); + + Thread.sleep(22000); + + // Let's Get the latest version of the certificate from the key vault. + certificateAsyncClient.getCertificateWithPolicy("certificateName") + .subscribe(certificateResponse -> + System.out.printf("Certificate is returned with name %s and secretId %s %n", certificateResponse.name(), + certificateResponse.secretId())); + + // After some time, we need to disable the certificate temporarily, so we update the enabled status of the certificate. + // The update method can be used to update the enabled status of the certificate. + certificateAsyncClient.getCertificateWithPolicy("certificateName") + .subscribe(certificateResponseValue -> { + Certificate certificate = certificateResponseValue; + //Update enabled status of the certificate + certificate.enabled(false); + certificateAsyncClient.updateCertificate(certificate) + .subscribe(certificateResponse -> + System.out.printf("Certificate's enabled status %s \n", + certificateResponse.enabled().toString())); + }); + + Thread.sleep(3000); + + + //Let's create a certificate issuer. + certificateAsyncClient.createCertificateIssuer("myIssuer", "Test") + .subscribe(issuer -> { + System.out.printf("Issuer created with %s and %s", issuer.name(), issuer.provider()); + }); + + Thread.sleep(2000); + + + // Let's fetch the issuer we just created from the key vault. + certificateAsyncClient.getCertificateIssuer("myIssuer") + .subscribe(issuer -> { + System.out.printf("Issuer returned with %s and %s", issuer.name(), issuer.provider()); + }); + + Thread.sleep(2000); + + //Let's create a certificate signed by our issuer. + certificateAsyncClient.createCertificate("myCertificate", new CertificatePolicy("myIssuer", "CN=IssuerSignedJavaPkcs12"), tags) + .getObserver().subscribe(pollResponse -> { + System.out.println("---------------------------------------------------------------------------------"); + System.out.println(pollResponse.getStatus()); + System.out.println(pollResponse.getValue().status()); + System.out.println(pollResponse.getValue().statusDetails()); + }); + + Thread.sleep(22000); + + // Let's Get the latest version of our certificate from the key vault. + certificateAsyncClient.getCertificateWithPolicy("myCertificate") + .subscribe(certificateResponse -> + System.out.printf("Certificate is returned with name %s and secretId %s %n", certificateResponse.name(), + certificateResponse.secretId())); + + Thread.sleep(2000); + + // The certificates and issuers are no longer needed, need to delete it from the key vault. + certificateAsyncClient.deleteCertificate("certificateName") + .subscribe(deletedSecretResponse -> + System.out.printf("Deleted Certificate's Recovery Id %s \n", deletedSecretResponse.recoveryId())); + + certificateAsyncClient.deleteCertificate("myCertificate") + .subscribe(deletedSecretResponse -> + System.out.printf("Deleted Certificate's Recovery Id %s \n", deletedSecretResponse.recoveryId())); + + + certificateAsyncClient.deleteCertificateIssuerWithResponse("myIssuer") + .subscribe(deletedIssuerResponse -> + System.out.printf("Deleted issuer with name %s \n", deletedIssuerResponse.getValue().name())); + + // To ensure certificate is deleted on server side. + Thread.sleep(50000); + + // If the keyvault is soft-delete enabled, then for permanent deletion deleted certificates need to be purged. + certificateAsyncClient.purgeDeletedCertificate("certificateName") + .subscribe(purgeResponse -> + System.out.printf("Purge Status response %d \n", purgeResponse.getStatusCode())); + + certificateAsyncClient.purgeDeletedCertificate("myCertificate") + .subscribe(purgeResponse -> + System.out.printf("Purge Status response %d \n", purgeResponse.getStatusCode())); + + Thread.sleep(4000); + + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/ListOperations.java b/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/ListOperations.java new file mode 100644 index 000000000000..8074e4627d11 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/ListOperations.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.certificates.models.CertificatePolicy; +import com.azure.security.keyvault.certificates.models.CertificateOperation; +import com.azure.security.keyvault.certificates.models.Issuer; +import com.azure.security.keyvault.certificates.models.Contact; +import com.azure.security.keyvault.certificates.models.Certificate; +import com.azure.security.keyvault.certificates.models.CertificateBase; +import com.azure.security.keyvault.certificates.models.IssuerBase; + +import java.time.Duration; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Sample demonstrates how to perform list operation on certificates, certificate issuers and certificate contacts in the key vault. + */ +public class ListOperations { + /** + * Authenticates with the key vault and shows how to list certificates, certificate issuers and contacts in the key vault. + * + * @param args Unused. Arguments to the program. + * @throws IllegalArgumentException when invalid key vault endpoint is passed. + */ + public static void main(String[] args) throws IllegalArgumentException { + + // Instantiate a certificate client that will be used to call the service. Notice that the client is using default Azure + // credentials. To make default credentials work, ensure that environment variables 'AZURE_CLIENT_ID', + // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. + CertificateClient certificateClient = new CertificateClientBuilder() + .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") + .credential(new DefaultAzureCredentialBuilder().build()) + .buildClient(); + + // Let's create a self signed certificate valid for 1 year. if the certificate + // already exists in the key vault, then a new version of the certificate is created. + CertificatePolicy policy = new CertificatePolicy("Self", "CN=SelfSignedJavaPkcs12"); + Map tags = new HashMap<>(); + tags.put("foo", "bar"); + + try { + CertificateOperation certificateOperation = certificateClient.createCertificate("certName", + policy, tags, Duration.ofMillis(60000)); + System.out.printf("Certificate operation status %s \n", certificateOperation.status()); + } catch (IllegalStateException e) { + // Certificate wasn't created in the specified duration. + // Log / Handle here + } + + + //Let's create a certificate issuer. + Issuer issuer = new Issuer("myIssuer", "Test"); + Issuer myIssuer = certificateClient.createCertificateIssuer(issuer); + System.out.printf("Issuer created with name %s and provider %s", myIssuer.name(), myIssuer.provider()); + + //Let's create a certificate signed by our issuer. + try { + CertificateOperation certificateOperation = certificateClient.createCertificate("myCertificate", + new CertificatePolicy("myIssuer", "CN=SignedJavaPkcs12"), Duration.ofMillis(60000)); + System.out.printf("Certificate operation status %s \n", certificateOperation.status()); + } catch (IllegalStateException e) { + // Certificate wasn't created in the specified duration. + // Log / Handle here + } + + // Let's list all the certificates in the key vault. + for (CertificateBase certificate : certificateClient.listCertificates()) { + Certificate certificateWithAllProperties = certificateClient.getCertificate(certificate); + System.out.printf("Received certificate with name %s and secret id %s", certificateWithAllProperties.name(), + certificateWithAllProperties.secretId()); + } + + // Let's list all certificate versions of the certificate. + for (CertificateBase certificate : certificateClient.listCertificateVersions("myCertificate")) { + Certificate certificateWithAllProperties = certificateClient.getCertificate(certificate); + System.out.printf("Received certificate with name %s and version %s", certificateWithAllProperties.name(), + certificateWithAllProperties.version()); + } + + //Let's list all certificate issuers in the key vault. + for (IssuerBase certIssuer : certificateClient.listCertificateIssuers()) { + Issuer retrievedIssuer = certificateClient.getCertificateIssuer(certIssuer); + System.out.printf("Received issuer with name %s and provider %s", retrievedIssuer.name(), + retrievedIssuer.provider()); + } + + // Let's set certificate contacts on the Key vault. + Contact contactToAdd = new Contact("user", "useremail@exmaple.com"); + for (Contact contact : certificateClient.setCertificateContacts(Arrays.asList(contactToAdd))) { + System.out.printf("Added contact with name %s and email %s to key vault", contact.name(), + contact.emailAddress()); + } + + // Let's list all certificate contacts in the key vault. + for (Contact contact : certificateClient.listCertificateContacts()) { + System.out.printf("Retrieved contact with name %s and email %s from the key vault", contact.name(), + contact.emailAddress()); + } + + // Let's delete all certificate contacts in the key vault. + for (Contact contact : certificateClient.deleteCertificateContacts()) { + System.out.printf("Deleted contact with name %s and email %s from key vault", contact.name(), + contact.emailAddress()); + } + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/ListOperationsAsync.java b/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/ListOperationsAsync.java new file mode 100644 index 000000000000..78c7d1bee52e --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/ListOperationsAsync.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.certificates.models.CertificatePolicy; +import com.azure.security.keyvault.certificates.models.EcKeyOptions; +import com.azure.security.keyvault.certificates.models.SubjectAlternativeNames; +import com.azure.security.keyvault.certificates.models.webkey.KeyCurveName; +import com.azure.security.keyvault.certificates.models.Contact; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Sample demonstrates how to asynchronously list keys and versions of a given key in the key vault. + */ +public class ListOperationsAsync { + /** + * Authenticates with the key vault and shows how to asynchronously list keys and list versions of a specific key in the key vault. + * + * @param args Unused. Arguments to the program. + * @throws IllegalArgumentException when invalid key vault endpoint is passed. + * @throws InterruptedException when the thread is interrupted in sleep mode. + */ + public static void main(String[] args) throws InterruptedException { + + // Instantiate an async key client that will be used to call the service. Notice that the client is using default Azure + // credentials. To make default credentials work, ensure that environment variables 'AZURE_CLIENT_ID', + // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. + CertificateAsyncClient certificateAsyncClient = new CertificateClientBuilder() + .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAsyncClient(); + + // Let's create a self signed certificate valid for 1 year. if the certificate + // already exists in the key vault, then a new version of the certificate is created. + CertificatePolicy policy = new CertificatePolicy("Self", "CN=SelfSignedJavaPkcs12") + .subjectAlternativeNames(SubjectAlternativeNames.fromEmails(Arrays.asList("wow@gmail.com"))) + .keyOptions(new EcKeyOptions() + .reuseKey(true) + .curve(KeyCurveName.P_256)); + Map tags = new HashMap<>(); + tags.put("foo", "bar"); + + certificateAsyncClient.createCertificate("certificatName", policy, tags) + .getObserver().subscribe(pollResponse -> { + System.out.println("---------------------------------------------------------------------------------"); + System.out.println(pollResponse.getStatus()); + System.out.println(pollResponse.getValue().status()); + System.out.println(pollResponse.getValue().statusDetails()); + }); + + Thread.sleep(22000); + + //Let's create a certificate issuer. + certificateAsyncClient.createCertificateIssuer("myIssuer", "Test") + .subscribe(issuer -> { + System.out.printf("Issuer created with %s and %s\n", issuer.name(), issuer.provider()); + }); + + Thread.sleep(2000); + + //Let's create a certificate signed by our issuer. + certificateAsyncClient.createCertificate("myCert", new CertificatePolicy("myIssuer", "CN=IssuerSignedJavaPkcs12"), tags) + .getObserver().subscribe(pollResponse -> { + System.out.println("---------------------------------------------------------------------------------"); + System.out.println(pollResponse.getStatus()); + System.out.println(pollResponse.getValue().status()); + System.out.println(pollResponse.getValue().statusDetails()); + }); + + Thread.sleep(22000); + + // Let's list all the certificates in the key vault. + certificateAsyncClient.listCertificates() + .subscribe(certificateBase -> certificateAsyncClient.getCertificate(certificateBase) + .subscribe(certificateResponse -> System.out.printf("Received certificate with name %s and key id %s \n", + certificateResponse.name(), certificateResponse.keyId()))); + + Thread.sleep(5000); + + // Let's list all certificate versions of the certificate. + certificateAsyncClient.listCertificateVersions("myCertificate") + .subscribe(certificateBase -> certificateAsyncClient.getCertificate(certificateBase) + .subscribe(certificateResponse -> System.out.printf("Received certificate with name %s and key id %s\n", + certificateResponse.name(), certificateResponse.keyId()))); + + Thread.sleep(5000); + + //Let's list all certificate issuers in the key vault. + certificateAsyncClient.listCertificateIssuers() + .subscribe(issuerBase -> certificateAsyncClient.getCertificateIssuer(issuerBase) + .subscribe(issuerResponse -> System.out.printf("Received issuer with name %s and provider %s\n", + issuerResponse.name(), issuerResponse.provider()))); + + Thread.sleep(5000); + + // Let's set certificate contacts on the Key vault. + Contact oontactToAdd = new Contact("user", "useremail@exmaple.com"); + certificateAsyncClient.setCertificateContacts(Arrays.asList(oontactToAdd)).subscribe(contact -> + System.out.printf("Contact name %s and email %s\n", contact.name(), contact.emailAddress()) + ); + + Thread.sleep(3000); + + // Let's list all certificate contacts in the key vault. + certificateAsyncClient.listCertificateContacts().subscribe(contact -> + System.out.printf("Contact name %s and email %s\n", contact.name(), contact.emailAddress()) + ); + + Thread.sleep(3000); + + // Let's delete all certificate contacts in the key vault. + certificateAsyncClient.listCertificateContacts().subscribe(contact -> + System.out.printf("Deleted Contact name %s and email %s\n", contact.name(), contact.emailAddress()) + ); + + Thread.sleep(2000); + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/ManagingDeletedCertificates.java b/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/ManagingDeletedCertificates.java new file mode 100644 index 000000000000..4317466b2290 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/ManagingDeletedCertificates.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.certificates.models.CertificatePolicy; +import com.azure.security.keyvault.certificates.models.EcKeyOptions; +import com.azure.security.keyvault.certificates.models.SubjectAlternativeNames; +import com.azure.security.keyvault.certificates.models.CertificateOperation; +import com.azure.security.keyvault.certificates.models.Certificate; +import com.azure.security.keyvault.certificates.models.DeletedCertificate; +import com.azure.security.keyvault.certificates.models.webkey.KeyCurveName; + +import java.time.Duration; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Sample demonstrates how to list, recover and purge deleted certificates in a soft-delete enabled key vault. + */ +public class ManagingDeletedCertificates { + /** + * Authenticates with the key vault and shows how to list, recover and purge deleted certificates in a soft-delete enabled key vault. + * + * @param args Unused. Arguments to the program. + * @throws IllegalArgumentException when invalid key vault endpoint is passed. + * @throws InterruptedException when the thread is interrupted in sleep mode. + */ + public static void main(String[] args) throws IllegalArgumentException, InterruptedException { + + // NOTE: To manage deleted certificates, your key vault needs to have soft-delete enabled. Soft-delete allows deleted keys + // to be retained for a given retention period (90 days). During this period deleted keys can be recovered and if + // a key needs to be permanently deleted then it needs to be purged. + + // Instantiate a certificate client that will be used to call the service. Notice that the client is using default Azure + // credentials. To make default credentials work, ensure that environment variables 'AZURE_CLIENT_ID', + // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. + CertificateClient certificateClient = new CertificateClientBuilder() + .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") + .credential(new DefaultAzureCredentialBuilder().build()) + .buildClient(); + + // Let's create a self signed certificate valid for 1 year. if the certificate + // already exists in the key vault, then a new version of the certificate is created. + CertificatePolicy policy = new CertificatePolicy("Self", "CN=SelfSignedJavaPkcs12") + .subjectAlternativeNames(SubjectAlternativeNames.fromEmails(Arrays.asList("wow@gmail.com"))) + .keyOptions(new EcKeyOptions() + .reuseKey(true) + .curve(KeyCurveName.P_256)); + Map tags = new HashMap<>(); + tags.put("foo", "bar"); + + try { + CertificateOperation certificateOperation = certificateClient.createCertificate("certificateName", + policy, tags, Duration.ofMillis(60000)); + System.out.printf("Certificate operation status %s \n", certificateOperation.status()); + } catch (IllegalStateException e) { + // Certificate wasn't created in the specified duration. + // Log / Handle here + } + + // The certificate is no longer needed, need to delete it from the key vault. + DeletedCertificate deletedCertificate = certificateClient.deleteCertificate("certificateName"); + System.out.printf("Certificate is deleted with name %s and its recovery id is %s \n", deletedCertificate.name(), deletedCertificate.recoveryId()); + + //To ensure certificate is deleted on server side. + Thread.sleep(30000); + + // We accidentally deleted the certificate. Let's recover it. + // A deleted certificate can only be recovered if the key vault is soft-delete enabled. + Certificate certificate = certificateClient.recoverDeletedCertificate("certificateName"); + System.out.printf(" Recovered Deleted certificate with name %s and id %s", certificate.name(), + certificate.id()); + + //To ensure certificate is recovered on server side. + Thread.sleep(30000); + + // The certificates are no longer needed, need to delete them from the key vault. + deletedCertificate = certificateClient.deleteCertificate("certificateName"); + System.out.printf("Certificate is deleted with name %s and its recovery id is %s \n", deletedCertificate.name(), deletedCertificate.recoveryId()); + + //To ensure certificate is deleted on server side. + Thread.sleep(30000); + + // You can list all the deleted and non-purged certificates, assuming key vault is soft-delete enabled. + for (DeletedCertificate deletedCert : certificateClient.listDeletedCertificates()) { + System.out.printf("Deleted certificate's recovery Id %s", deletedCert.recoveryId()); + } + + // If the key vault is soft-delete enabled, then for permanent deletion deleted certificate need to be purged. + certificateClient.purgeDeletedCertificateWithResponse("certificateName"); + + //To ensure certificate is purged on server side. + Thread.sleep(15000); + } +} diff --git a/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/ManagingDeletedCertificatesAsync.java b/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/ManagingDeletedCertificatesAsync.java new file mode 100644 index 000000000000..5ec804c832a7 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/src/samples/java/com/azure/security/keyvault/certificates/ManagingDeletedCertificatesAsync.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.certificates; + +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.certificates.models.CertificatePolicy; +import com.azure.security.keyvault.certificates.models.EcKeyOptions; +import com.azure.security.keyvault.certificates.models.SubjectAlternativeNames; +import com.azure.security.keyvault.certificates.models.webkey.KeyCurveName; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Sample demonstrates how to asynchronously list, recover and purge deleted certificates in a soft-delete enabled key vault. + */ +public class ManagingDeletedCertificatesAsync { + /** + * Authenticates with the key vault and shows how to asynchronously list, recover and purge deleted certificates in a soft-delete enabled key vault. + * + * @param args Unused. Arguments to the program. + * @throws IllegalArgumentException when invalid key vault endpoint is passed. + * @throws InterruptedException when the thread is interrupted in sleep mode. + */ + public static void main(String[] args) throws InterruptedException { + + // NOTE: To manage deleted certificates, your key vault needs to have soft-delete enabled. Soft-delete allows deleted keys + // to be retained for a given retention period (90 days). During this period deleted keys can be recovered and if + // a key needs to be permanently deleted then it needs to be purged. + + // Instantiate an async key client that will be used to call the service. Notice that the client is using default Azure + // credentials. To make default credentials work, ensure that environment variables 'AZURE_CLIENT_ID', + // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. + CertificateAsyncClient certificateAsyncClient = new CertificateClientBuilder() + .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAsyncClient(); + + // Let's create a self signed certificate valid for 1 year. if the certificate + // already exists in the key vault, then a new version of the certificate is created. + CertificatePolicy policy = new CertificatePolicy("Self", "CN=SelfSignedJavaPkcs12") + .subjectAlternativeNames(SubjectAlternativeNames.fromEmails(Arrays.asList("wow@gmail.com"))) + .keyOptions(new EcKeyOptions() + .reuseKey(true) + .curve(KeyCurveName.P_256)); + Map tags = new HashMap<>(); + tags.put("foo", "bar"); + + certificateAsyncClient.createCertificate("certificateName", policy, tags) + .getObserver().subscribe(pollResponse -> { + System.out.println("---------------------------------------------------------------------------------"); + System.out.println(pollResponse.getStatus()); + System.out.println(pollResponse.getValue().status()); + System.out.println(pollResponse.getValue().statusDetails()); + }); + + Thread.sleep(22000); + + // The certificate is no longer needed, need to delete it from the key vault. + certificateAsyncClient.deleteCertificate("certificateName") + .subscribe(deletedSecretResponse -> + System.out.printf("Deleted Certificate's Recovery Id %s \n", deletedSecretResponse.recoveryId())); + + //To ensure certificates is deleted on server side. + Thread.sleep(30000); + + // We accidentally deleted the certificate. Let's recover it. + // A deleted certificate can only be recovered if the key vault is soft-delete enabled. + certificateAsyncClient.recoverDeletedCertificate("certificateName") + .subscribe(recoveredSecretResponse -> + System.out.printf("Recovered Certificate with name %s \n", recoveredSecretResponse.name())); + + //To ensure certificates is recovered on server side. + Thread.sleep(10000); + + // The certificate is longer needed, need to delete them from the key vault. + certificateAsyncClient.deleteCertificate("certificateName") + .subscribe(deletedSecretResponse -> + System.out.printf("Deleted Certificate's Recovery Id %s \n", deletedSecretResponse.recoveryId())); + + // To ensure certificate is deleted on server side. + Thread.sleep(30000); + + // You can list all the deleted and non-purged certificates, assuming key vault is soft-delete enabled. + certificateAsyncClient.listDeletedCertificates() + .subscribe(deletedCertificateResponse -> System.out.printf("Deleted Certificate's Recovery Id %s \n", + deletedCertificateResponse.recoveryId())); + + Thread.sleep(15000); + + // If the keyvault is soft-delete enabled, then for permanent deletion deleted certificates need to be purged. + certificateAsyncClient.purgeDeletedCertificate("certificateName") + .subscribe(purgeResponse -> + System.out.printf("Purge Status response %d \n", purgeResponse.getStatusCode())); + + // To ensure certificates is purged on server side. + Thread.sleep(15000); + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/CHANGELOG.md b/sdk/keyvault/azure-keyvault-keys/CHANGELOG.md index 0e4d0192748a..bd1b2ff6644c 100644 --- a/sdk/keyvault/azure-keyvault-keys/CHANGELOG.md +++ b/sdk/keyvault/azure-keyvault-keys/CHANGELOG.md @@ -1,5 +1,8 @@ # Release History +## 4.0.0-preview.3 (2019-09-10) +For details on the Azure SDK for Java (August 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview3-java). + ## 4.0.0-preview.2 (2019-08-06) For details on the Azure SDK for Java (August 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview2-java). diff --git a/sdk/keyvault/azure-keyvault-keys/README.md b/sdk/keyvault/azure-keyvault-keys/README.md index 25205aa60b89..f96461d20c51 100644 --- a/sdk/keyvault/azure-keyvault-keys/README.md +++ b/sdk/keyvault/azure-keyvault-keys/README.md @@ -14,10 +14,45 @@ Maven dependency for Azure Key Client library. Add it to your project's pom file com.azure azure-keyvault-keys - 4.0.0-preview.2 + 4.0.0-preview.3 ``` +### 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-key-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(); +``` + ### Prerequisites - Java Development Kit (JDK) with version 8 or above @@ -446,3 +481,5 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope [sample_signVerifyAsync]: src/samples/java/com/azure/security/keyvault/keys/cryptography/SignVerifyOperationsAsync.java [sample_wrapUnwrap]: src/samples/java/com/azure/security/keyvault/keys/cryptography/KeyWrapUnwrapOperations.java [sample_wrapUnwrapAsync]: src/samples/java/com/azure/security/keyvault/keys/cryptography/KeyWrapUnwrapOperationsAsync.java + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/keyvault/azure-keyvault-keys/README.png) diff --git a/sdk/keyvault/azure-keyvault-keys/pom.xml b/sdk/keyvault/azure-keyvault-keys/pom.xml index c1819383b7dc..e090da033885 100644 --- a/sdk/keyvault/azure-keyvault-keys/pom.xml +++ b/sdk/keyvault/azure-keyvault-keys/pom.xml @@ -3,9 +3,9 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - azure-client-sdk-parent com.azure - 1.3.0 + azure-client-sdk-parent + 1.4.0 ../../../pom.client.xml @@ -13,9 +13,10 @@ com.azure azure-keyvault-keys - 4.0.0-preview.3 + 4.0.0-preview.4 - azure-keyvault-keys + Microsoft Azure client library for KeyVault Keys + This module contains client library for Microsoft Azure KeyVault Keys. https://github.com/Azure/azure-sdk-for-java @@ -31,12 +32,16 @@ HEAD + + com.azure.security.keyvault.keys + + com.azure azure-core - 1.0.0-preview.4 + 1.0.0-preview.5 @@ -59,14 +64,20 @@ com.azure azure-core-test - 1.0.0-preview.4 + 1.0.0-preview.5 + test + + + com.azure + azure-core-http-netty + 1.0.0-preview.5 test com.azure azure-identity - 1.0.0-preview.3 + 1.0.0-preview.4 test diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyAsyncClient.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyAsyncClient.java index 4f3ccce61ea4..467a571f6f7d 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyAsyncClient.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyAsyncClient.java @@ -42,8 +42,8 @@ /** * The KeyAsyncClient provides asynchronous methods to manage {@link Key keys} in the Azure Key Vault. The client - * supports creating, retrieving, updating, deleting, purging, backing up, restoring and listing the {@link Key keys}. The client - * also supports listing {@link DeletedKey deleted keys} for a soft-delete enabled Azure Key Vault. + * supports creating, retrieving, updating, deleting, purging, backing up, restoring and listing the {@link Key keys}. + * The client also supports listing {@link DeletedKey deleted keys} for a soft-delete enabled Azure Key Vault. * *

Samples to construct the async client

* @@ -72,28 +72,32 @@ public final class KeyAsyncClient { * @param pipeline HttpPipeline that the HTTP requests and responses flow through. */ KeyAsyncClient(URL endpoint, HttpPipeline pipeline) { - Objects.requireNonNull(endpoint, KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.VAULT_END_POINT_REQUIRED)); + Objects.requireNonNull(endpoint, + KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.VAULT_END_POINT_REQUIRED)); this.endpoint = endpoint.toString(); this.service = RestProxy.create(KeyService.class, pipeline); } /** * Creates a new key and stores it in the key vault. The create key operation can be used to create any key type in - * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the {@code keys/create} permission. + * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the + * {@code keys/create} permission. * - *

The {@link KeyType keyType} indicates the type of key to create. Possible values include: {@link KeyType#EC EC}, - * {@link KeyType#EC_HSM EC-HSM}, {@link KeyType#RSA RSA}, {@link KeyType#RSA_HSM RSA-HSM} and {@link KeyType#OCT OCT}.

+ *

The {@link KeyType keyType} indicates the type of key to create. Possible values include: {@link KeyType#EC + * EC}, {@link KeyType#EC_HSM EC-HSM}, {@link KeyType#RSA RSA}, {@link KeyType#RSA_HSM RSA-HSM} and + * {@link KeyType#OCT OCT}.

* *

Code Samples

- *

Creates a new EC key. Subscribes to the call asynchronously and prints out the newly created key details when a response has been received.

+ *

Creates a new EC key. Subscribes to the call asynchronously and prints out the newly created key details when + * a response has been received.

* * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.createKey#string-keyType} * * @param name The name of the key being created. * @param keyType The type of key to create. For valid values, see {@link KeyType KeyType}. + * @return A {@link Mono} containing the {@link Key created key}. * @throws ResourceModifiedException if {@code name} or {@code keyType} is null. * @throws HttpRequestException if {@code name} is empty string. - * @return A {@link Mono} containing the {@link Key created key}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono createKey(String name, KeyType keyType) { @@ -102,20 +106,24 @@ public Mono createKey(String name, KeyType keyType) { /** * Creates a new key and stores it in the key vault. The create key operation can be used to create any key type in - * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the {@code keys/create} permission. + * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the + * {@code keys/create} permission. * - *

The {@link KeyType keyType} indicates the type of key to create. Possible values include: {@link KeyType#EC EC}, - * {@link KeyType#EC_HSM EC-HSM}, {@link KeyType#RSA RSA}, {@link KeyType#RSA_HSM RSA-HSM} and {@link KeyType#OCT OCT}.

+ *

The {@link KeyType keyType} indicates the type of key to create. Possible values include: {@link KeyType#EC + * EC}, {@link KeyType#EC_HSM EC-HSM}, {@link KeyType#RSA RSA}, {@link KeyType#RSA_HSM RSA-HSM} and + * {@link KeyType#OCT OCT}.

* *

Code Samples

- *

Creates a new EC key. Subscribes to the call asynchronously and prints out the newly created key details when a response has been received.

+ *

Creates a new EC key. Subscribes to the call asynchronously and prints out the newly created key details when + * a response has been received.

* * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.createKeyWithResponse#keyCreateOptions} * * @param keyCreateOptions The key configuration object containing information about the key being created. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link Key + * created key}. * @throws ResourceModifiedException if {@code name} or {@code keyType} is null. * @throws HttpRequestException if {@code name} is empty string. - * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link Key created key}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> createKeyWithResponse(KeyCreateOptions keyCreateOptions) { @@ -123,34 +131,38 @@ public Mono> createKeyWithResponse(KeyCreateOptions keyCreateOptio } Mono> createKeyWithResponse(String name, KeyType keyType, Context context) { - KeyRequestParameters parameters = new KeyRequestParameters().kty(keyType); - return service.createKey(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Creating key - {}", name)) - .doOnSuccess(response -> logger.info("Created key - {}", response.value().name())) - .doOnError(error -> logger.warning("Failed to create key - {}", name, error)); + KeyRequestParameters parameters = new KeyRequestParameters().setKty(keyType); + return service.createKey(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, + context) + .doOnRequest(ignored -> logger.info("Creating key - {}", name)) + .doOnSuccess(response -> logger.info("Created key - {}", response.getValue().name())) + .doOnError(error -> logger.warning("Failed to create key - {}", name, error)); } /** * Creates a new key and stores it in the key vault. The create key operation can be used to create any key type in - * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the {@code keys/create} permission. + * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the + * {@code keys/create} permission. * - *

The {@link KeyCreateOptions} is required. The {@link KeyCreateOptions#expires() expires} and {@link KeyCreateOptions#notBefore() notBefore} values - * are optional. The {@link KeyCreateOptions#enabled() enabled} field is set to true by Azure Key Vault, if not specified.

+ *

The {@link KeyCreateOptions} is required. The {@link KeyCreateOptions#expires() expires} and {@link + * KeyCreateOptions#notBefore() notBefore} values are optional. The {@link KeyCreateOptions#enabled() enabled} + * field is set to true by Azure Key Vault, if not specified.

* - *

The {@link KeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values include: {@link KeyType#EC EC}, - * {@link KeyType#EC_HSM EC-HSM}, {@link KeyType#RSA RSA}, {@link KeyType#RSA_HSM RSA-HSM} and {@link KeyType#OCT OCT}.

+ *

The {@link KeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values include: + * {@link KeyType#EC EC}, {@link KeyType#EC_HSM EC-HSM}, {@link KeyType#RSA RSA}, {@link KeyType#RSA_HSM RSA-HSM} + * and {@link KeyType#OCT OCT}.

* *

Code Samples

- *

Creates a new Rsa key which activates in one day and expires in one year. Subscribes to the call asynchronously - * and prints out the newly created key details when a response has been received.

+ *

Creates a new Rsa key which activates in one day and expires in one year. Subscribes to the call + * asynchronously and prints out the newly created key details when a response has been received.

* * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.createKey#keyCreateOptions} * * @param keyCreateOptions The key configuration object containing information about the key being created. + * @return A {@link Mono} containing the {@link Key created key}. * @throws NullPointerException if {@code keyCreateOptions} is {@code null}. * @throws ResourceModifiedException if {@code keyCreateOptions} is malformed. * @throws HttpRequestException if {@code name} is empty string. - * @return A {@link Mono} containing the {@link Key created key}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono createKey(KeyCreateOptions keyCreateOptions) { @@ -160,37 +172,41 @@ public Mono createKey(KeyCreateOptions keyCreateOptions) { Mono> createKeyWithResponse(KeyCreateOptions keyCreateOptions, Context context) { Objects.requireNonNull(keyCreateOptions, "The key create options parameter cannot be null."); KeyRequestParameters parameters = new KeyRequestParameters() - .kty(keyCreateOptions.keyType()) - .keyOps(keyCreateOptions.keyOperations()) - .keyAttributes(new KeyRequestAttributes(keyCreateOptions)); - return service.createKey(endpoint, keyCreateOptions.name(), API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Creating key - {}", keyCreateOptions.name())) - .doOnSuccess(response -> logger.info("Created key - {}", response.value().name())) + .setKty(keyCreateOptions.keyType()) + .setKeyOps(keyCreateOptions.keyOperations()) + .setKeyAttributes(new KeyRequestAttributes(keyCreateOptions)); + return service.createKey(endpoint, keyCreateOptions.name(), API_VERSION, ACCEPT_LANGUAGE, parameters, + CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Creating key - {}", keyCreateOptions.name())) + .doOnSuccess(response -> logger.info("Created key - {}", response.getValue().name())) .doOnError(error -> logger.warning("Failed to create key - {}", keyCreateOptions.name(), error)); } /** - * Creates a new Rsa key and stores it in the key vault. The create Rsa key operation can be used to create any Rsa key type in - * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the {@code keys/create} permission. + * Creates a new Rsa key and stores it in the key vault. The create Rsa key operation can be used to create any Rsa + * key type in key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It + * requires the {@code keys/create} permission. * - *

The {@link RsaKeyCreateOptions} is required. The {@link RsaKeyCreateOptions#keySize() keySize} can be optionally specified. The {@link RsaKeyCreateOptions#expires() expires} - * and {@link RsaKeyCreateOptions#notBefore() notBefore} values are optional. The {@link RsaKeyCreateOptions#enabled() enabled} field - * is set to true by Azure Key Vault, if not specified.

+ *

The {@link RsaKeyCreateOptions} is required. The {@link RsaKeyCreateOptions#getKeySize() keySize} can be + * optionally specified. The {@link RsaKeyCreateOptions#expires() expires} and + * {@link RsaKeyCreateOptions#notBefore() notBefore} values are optional. The + * {@link RsaKeyCreateOptions#enabled() enabled} field is set to true by Azure Key Vault, if not specified.

* - *

The {@link RsaKeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values include: {@link KeyType#RSA RSA} and - * {@link KeyType#RSA_HSM RSA-HSM}.

+ *

The {@link RsaKeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values + * include: {@link KeyType#RSA RSA} and {@link KeyType#RSA_HSM RSA-HSM}.

* *

Code Samples

- *

Creates a new RSA key with size 2048 which activates in one day and expires in one year. Subscribes to the call asynchronously - * and prints out the newly created key details when a response has been received.

+ *

Creates a new RSA key with size 2048 which activates in one day and expires in one year. Subscribes to the + * call asynchronously and prints out the newly created key details when a response has been received.

* * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.createRsaKey#RsaKeyCreateOptions} * - * @param rsaKeyCreateOptions The key configuration object containing information about the rsa key being created. + * @param rsaKeyCreateOptions The key configuration object containing information about the rsa key being + * created. + * @return A {@link Mono} containing the {@link Key created key}. * @throws NullPointerException if {@code rsaKeyCreateOptions} is {@code null}. * @throws ResourceModifiedException if {@code rsaKeyCreateOptions} is malformed. * @throws HttpRequestException if {@code name} is empty string. - * @return A {@link Mono} containing the {@link Key created key}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono createRsaKey(RsaKeyCreateOptions rsaKeyCreateOptions) { @@ -198,23 +214,27 @@ public Mono createRsaKey(RsaKeyCreateOptions rsaKeyCreateOptions) { } /** - * Creates a new Rsa key and stores it in the key vault. The create Rsa key operation can be used to create any Rsa key type in - * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the {@code keys/create} permission. + * Creates a new Rsa key and stores it in the key vault. The create Rsa key operation can be used to create any Rsa + * key type in key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It + * requires the {@code keys/create} permission. * - *

The {@link RsaKeyCreateOptions} is required. The {@link RsaKeyCreateOptions#keySize() keySize} can be optionally specified. The {@link RsaKeyCreateOptions#expires() expires} - * and {@link RsaKeyCreateOptions#notBefore() notBefore} values are optional. The {@link RsaKeyCreateOptions#enabled() enabled} field - * is set to true by Azure Key Vault, if not specified.

+ *

The {@link RsaKeyCreateOptions} is required. The {@link RsaKeyCreateOptions#getKeySize() keySize} can be + * optionally specified. The {@link RsaKeyCreateOptions#expires() expires} and + * {@link RsaKeyCreateOptions#notBefore() notBefore} values are optional. The {@link + * RsaKeyCreateOptions#enabled() enabled} field is set to true by Azure Key Vault, if not specified.

* - *

The {@link RsaKeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values include: {@link KeyType#RSA RSA} and - * {@link KeyType#RSA_HSM RSA-HSM}.

+ *

The {@link RsaKeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values + * include: {@link KeyType#RSA RSA} and {@link KeyType#RSA_HSM RSA-HSM}.

* * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.createRsaKeyWithResponse#RsaKeyCreateOptions} * - * @param rsaKeyCreateOptions The key configuration object containing information about the rsa key being created. + * @param rsaKeyCreateOptions The key configuration object containing information about the rsa key being + * created. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link Key + * created key}. * @throws NullPointerException if {@code rsaKeyCreateOptions} is {@code null}. * @throws ResourceModifiedException if {@code rsaKeyCreateOptions} is malformed. * @throws HttpRequestException if {@code name} is empty string. - * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link Key created key}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> createRsaKeyWithResponse(RsaKeyCreateOptions rsaKeyCreateOptions) { @@ -224,38 +244,43 @@ public Mono> createRsaKeyWithResponse(RsaKeyCreateOptions rsaKeyCr Mono> createRsaKeyWithResponse(RsaKeyCreateOptions rsaKeyCreateOptions, Context context) { Objects.requireNonNull(rsaKeyCreateOptions, "The Rsa key options parameter cannot be null."); KeyRequestParameters parameters = new KeyRequestParameters() - .kty(rsaKeyCreateOptions.keyType()) - .keySize(rsaKeyCreateOptions.keySize()) - .keyOps(rsaKeyCreateOptions.keyOperations()) - .keyAttributes(new KeyRequestAttributes(rsaKeyCreateOptions)); - return service.createKey(endpoint, rsaKeyCreateOptions.name(), API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Creating Rsa key - {}", rsaKeyCreateOptions.name())) - .doOnSuccess(response -> logger.info("Created Rsa key - {}", response.value().name())) - .doOnError(error -> logger.warning("Failed to create Rsa key - {}", rsaKeyCreateOptions.name(), error)); + .setKty(rsaKeyCreateOptions.keyType()) + .setKeySize(rsaKeyCreateOptions.getKeySize()) + .setKeyOps(rsaKeyCreateOptions.keyOperations()) + .setKeyAttributes(new KeyRequestAttributes(rsaKeyCreateOptions)); + return service.createKey(endpoint, rsaKeyCreateOptions.name(), API_VERSION, ACCEPT_LANGUAGE, parameters, + CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Creating Rsa key - {}", rsaKeyCreateOptions.name())) + .doOnSuccess(response -> logger.info("Created Rsa key - {}", response.getValue().name())) + .doOnError(error -> logger.warning("Failed to create Rsa key - {}", rsaKeyCreateOptions.name(), error)); } /** - * Creates a new Ec key and stores it in the key vault. The create Ec key operation can be used to create any Ec key type in - * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the {@code keys/create} permission. + * Creates a new Ec key and stores it in the key vault. The create Ec key operation can be used to create any Ec key + * type in key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires + * the {@code keys/create} permission. * - *

The {@link EcKeyCreateOptions} parameter is required. The {@link EcKeyCreateOptions#curve() key curve} can be optionally specified. If not specified, - * default value of {@link KeyCurveName#P_256 P-256} is used by Azure Key Vault. The {@link EcKeyCreateOptions#expires() expires} and {@link EcKeyCreateOptions#notBefore() notBefore} values - * are optional. The {@link EcKeyCreateOptions#enabled() enabled} field is set to true by Azure Key Vault, if not specified.

+ *

The {@link EcKeyCreateOptions} parameter is required. The {@link EcKeyCreateOptions#getCurve() key curve} can be + * optionally specified. If not specified, default value of {@link KeyCurveName#P_256 P-256} is used by Azure Key + * Vault. The {@link EcKeyCreateOptions#expires() expires} and {@link EcKeyCreateOptions#notBefore() notBefore} + * values are optional. The {@link EcKeyCreateOptions#enabled() enabled} field is set to true by Azure Key Vault, + * if not specified.

* - *

The {@link EcKeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values include: {@link KeyType#EC EC} and - * {@link KeyType#EC_HSM EC-HSM}.

+ *

The {@link EcKeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values include: + * {@link KeyType#EC EC} and {@link KeyType#EC_HSM EC-HSM}.

* *

Code Samples

- *

Creates a new EC key with P-384 web key curve. The key activates in one day and expires in one year. Subscribes to the call asynchronously - * and prints out the newly created ec key details when a response has been received.

+ *

Creates a new EC key with P-384 web key curve. The key activates in one day and expires in one year. + * Subscribes to the call asynchronously and prints out the newly created ec key details when a response has been + * received.

* * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.createEcKey#EcKeyCreateOptions} * * @param ecKeyCreateOptions The key options object containing information about the ec key being created. + * @return A {@link Mono} containing the {@link Key created key}. * @throws NullPointerException if {@code ecKeyCreateOptions} is {@code null}. * @throws ResourceModifiedException if {@code ecKeyCreateOptions} is malformed. * @throws HttpRequestException if {@code name} is empty string. - * @return A {@link Mono} containing the {@link Key created key}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono createEcKey(EcKeyCreateOptions ecKeyCreateOptions) { @@ -263,27 +288,32 @@ public Mono createEcKey(EcKeyCreateOptions ecKeyCreateOptions) { } /** - * Creates a new Ec key and stores it in the key vault. The create Ec key operation can be used to create any Ec key type in - * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the {@code keys/create} permission. + * Creates a new Ec key and stores it in the key vault. The create Ec key operation can be used to create any Ec key + * type in key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires + * the {@code keys/create} permission. * - *

The {@link EcKeyCreateOptions} parameter is required. The {@link EcKeyCreateOptions#curve() key curve} can be optionally specified. If not specified, - * default value of {@link KeyCurveName#P_256 P-256} is used by Azure Key Vault. The {@link EcKeyCreateOptions#expires() expires} and {@link EcKeyCreateOptions#notBefore() notBefore} values - * are optional. The {@link EcKeyCreateOptions#enabled() enabled} field is set to true by Azure Key Vault, if not specified.

+ *

The {@link EcKeyCreateOptions} parameter is required. The {@link EcKeyCreateOptions#getCurve() key curve} can be + * optionally specified. If not specified, default value of {@link KeyCurveName#P_256 P-256} is used by Azure Key + * Vault. The {@link EcKeyCreateOptions#expires() expires} and {@link EcKeyCreateOptions#notBefore() notBefore} + * values are optional. The {@link EcKeyCreateOptions#enabled() enabled} field is set to true by Azure Key Vault, if + * not specified.

* - *

The {@link EcKeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values include: {@link KeyType#EC EC} and - * {@link KeyType#EC_HSM EC-HSM}.

+ *

The {@link EcKeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values include: + * {@link KeyType#EC EC} and {@link KeyType#EC_HSM EC-HSM}.

* *

Code Samples

- *

Creates a new EC key with P-384 web key curve. The key activates in one day and expires in one year. Subscribes to the call asynchronously - * and prints out the newly created ec key details when a response has been received.

+ *

Creates a new EC key with P-384 web key curve. The key activates in one day and expires in one year. + * Subscribes to the call asynchronously and prints out the newly created ec key details when a response has been + * received.

* * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.createEcKeyWithResponse#EcKeyCreateOptions} * * @param ecKeyCreateOptions The key options object containing information about the ec key being created. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link Key + * created key}. * @throws NullPointerException if {@code ecKeyCreateOptions} is {@code null}. * @throws ResourceModifiedException if {@code ecKeyCreateOptions} is malformed. * @throws HttpRequestException if {@code name} is empty string. - * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link Key created key}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> createEcKeyWithResponse(EcKeyCreateOptions ecKeyCreateOptions) { @@ -293,32 +323,37 @@ public Mono> createEcKeyWithResponse(EcKeyCreateOptions ecKeyCreat Mono> createEcKeyWithResponse(EcKeyCreateOptions ecKeyCreateOptions, Context context) { Objects.requireNonNull(ecKeyCreateOptions, "The Ec key options options cannot be null."); KeyRequestParameters parameters = new KeyRequestParameters() - .kty(ecKeyCreateOptions.keyType()) - .curve(ecKeyCreateOptions.curve()) - .keyOps(ecKeyCreateOptions.keyOperations()) - .keyAttributes(new KeyRequestAttributes(ecKeyCreateOptions)); - return service.createKey(endpoint, ecKeyCreateOptions.name(), API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Creating Ec key - {}", ecKeyCreateOptions.name())) - .doOnSuccess(response -> logger.info("Created Ec key - {}", response.value().name())) - .doOnError(error -> logger.warning("Failed to create Ec key - {}", ecKeyCreateOptions.name(), error)); + .setKty(ecKeyCreateOptions.keyType()) + .setCurve(ecKeyCreateOptions.getCurve()) + .setKeyOps(ecKeyCreateOptions.keyOperations()) + .setKeyAttributes(new KeyRequestAttributes(ecKeyCreateOptions)); + return service.createKey(endpoint, ecKeyCreateOptions.name(), API_VERSION, ACCEPT_LANGUAGE, parameters, + CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Creating Ec key - {}", ecKeyCreateOptions.name())) + .doOnSuccess(response -> logger.info("Created Ec key - {}", response.getValue().name())) + .doOnError(error -> logger.warning("Failed to create Ec key - {}", ecKeyCreateOptions.name(), error)); } /** - * Imports an externally created key and stores it in key vault. The import key operation may be used to import any key type - * into the Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. This operation requires the {@code keys/import} permission. + * Imports an externally created key and stores it in key vault. The import key operation may be used to import any + * key type into the Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the + * key. This operation requires the {@code keys/import} permission. * *

Code Samples

- *

Imports a new key into key vault. Subscribes to the call asynchronously and prints out the newly imported key details - * when a response has been received.

+ *

Imports a new key into key vault. Subscribes to the call asynchronously and prints out the newly imported key + * details when a response has been received.

+ * *
      * keyAsyncClient.importKey("keyName", jsonWebKeyToImport).subscribe(keyResponse ->
-     *   System.out.printf("Key is imported with name %s and id %s \n", keyResponse.value().name(), keyResponse.value().id()));
+     *   System.out.printf("Key is imported with name %s and id %s \n", keyResponse.value().name(), keyResponse.value
+     *   ().id()));
      * 
* * @param name The name for the imported key. * @param keyMaterial The Json web key being imported. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link Key + * imported key}. * @throws HttpRequestException if {@code name} is empty string. - * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link Key imported key}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono importKey(String name, JsonWebKey keyMaterial) { @@ -326,38 +361,43 @@ public Mono importKey(String name, JsonWebKey keyMaterial) { } Mono> importKeyWithResponse(String name, JsonWebKey keyMaterial, Context context) { - KeyImportRequestParameters parameters = new KeyImportRequestParameters().key(keyMaterial); - return service.importKey(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Importing key - {}", name)) - .doOnSuccess(response -> logger.info("Imported key - {}", response.value().name())) + KeyImportRequestParameters parameters = new KeyImportRequestParameters().setKey(keyMaterial); + return service.importKey(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, + context) + .doOnRequest(ignored -> logger.info("Importing key - {}", name)) + .doOnSuccess(response -> logger.info("Imported key - {}", response.getValue().name())) .doOnError(error -> logger.warning("Failed to import key - {}", name, error)); } /** - * Imports an externally created key and stores it in key vault. The import key operation may be used to import any key type - * into the Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. This operation requires the {@code keys/import} permission. + * Imports an externally created key and stores it in key vault. The import key operation may be used to import any + * key type into the Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the + * key. This operation requires the {@code keys/import} permission. * - *

The {@code keyImportOptions} is required and its fields {@link KeyImportOptions#name() name} and {@link KeyImportOptions#keyMaterial() key material} cannot - * be null. The {@link KeyImportOptions#expires() expires} and {@link KeyImportOptions#notBefore() notBefore} values in {@code keyImportOptions} - * are optional. If not specified, no values are set for the fields. The {@link KeyImportOptions#enabled() enabled} field is set to true and - * the {@link KeyImportOptions#hsm() hsm} field is set to false by Azure Key Vault, if they are not specified.

+ *

The {@code keyImportOptions} is required and its fields {@link KeyImportOptions#name() name} and {@link + * KeyImportOptions#getKeyMaterial() key material} cannot be null. The {@link KeyImportOptions#expires() expires} and + * {@link KeyImportOptions#notBefore() notBefore} values in {@code keyImportOptions} are optional. If not specified, + * no values are set for the fields. The {@link KeyImportOptions#enabled() enabled} field is set to true and the + * {@link KeyImportOptions#isHsm() hsm} field is set to false by Azure Key Vault, if they are not specified.

* *

Code Samples

- *

Imports a new key into key vault. Subscribes to the call asynchronously and prints out the newly imported key details - * when a response has been received.

+ *

Imports a new key into key vault. Subscribes to the call asynchronously and prints out the newly imported key + * details when a response has been received.

*
      * KeyImportOptions keyImportOptions = new KeyImportOptions("keyName", jsonWebKeyToImport)
      *   .hsm(true)
      *   .expires(OffsetDateTime.now().plusDays(60));
      *
      * keyAsyncClient.importKey(keyImportOptions).subscribe(keyResponse ->
-     *   System.out.printf("Key is imported with name %s and id %s \n", keyResponse.value().name(), keyResponse.value().id()));
+     *   System.out.printf("Key is imported with name %s and id %s \n", keyResponse.value().name(),
+     *   keyResponse.value().id()));
      * 
* - * @param keyImportOptions The key import configuration object containing information about the json web key being imported. + * @param keyImportOptions The key import configuration object containing information about the json web key + * being imported. + * @return A {@link Mono} containing the {@link Key imported key}. * @throws NullPointerException if {@code keyImportOptions} is {@code null}. * @throws HttpRequestException if {@code name} is empty string. - * @return A {@link Mono} containing the {@link Key imported key}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono importKey(KeyImportOptions keyImportOptions) { @@ -365,30 +405,37 @@ public Mono importKey(KeyImportOptions keyImportOptions) { } /** - * Imports an externally created key and stores it in key vault. The import key operation may be used to import any key type - * into the Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. This operation requires the {@code keys/import} permission. + * Imports an externally created key and stores it in key vault. The import key operation may be used to import any + * key type into the Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the + * key. This operation requires the {@code keys/import} permission. * - *

The {@code keyImportOptions} is required and its fields {@link KeyImportOptions#name() name} and {@link KeyImportOptions#keyMaterial() key material} cannot - * be null. The {@link KeyImportOptions#expires() expires} and {@link KeyImportOptions#notBefore() notBefore} values in {@code keyImportOptions} - * are optional. If not specified, no values are set for the fields. The {@link KeyImportOptions#enabled() enabled} field is set to true and - * the {@link KeyImportOptions#hsm() hsm} field is set to false by Azure Key Vault, if they are not specified.

+ *

The {@code keyImportOptions} is required and its fields {@link KeyImportOptions#name() name} and {@link + * KeyImportOptions#getKeyMaterial() key material} cannot be null. The {@link KeyImportOptions#expires() expires} and + * {@link KeyImportOptions#notBefore() notBefore} values in {@code keyImportOptions} are optional. If not specified, + * no values are set for the fields. The {@link KeyImportOptions#enabled() enabled} + * field is set to true and the {@link KeyImportOptions#isHsm() hsm} field is set to false by Azure Key Vault, if they + * are not specified.

* *

Code Samples

- *

Imports a new key into key vault. Subscribes to the call asynchronously and prints out the newly imported key details - * when a response has been received.

+ *

Imports a new key into key vault. Subscribes to the call asynchronously and prints out the newly imported key + * details when a response has been received.

+ * *
      * KeyImportOptions keyImportOptions = new KeyImportOptions("keyName", jsonWebKeyToImport)
      *   .hsm(true)
      *   .expires(OffsetDateTime.now().plusDays(60));
      *
      * keyAsyncClient.importKey(keyImportOptions).subscribe(keyResponse ->
-     *   System.out.printf("Key is imported with name %s and id %s \n", keyResponse.value().name(), keyResponse.value().id()));
+     *   System.out.printf("Key is imported with name %s and id %s \n", keyResponse.value().name(),
+     *   keyResponse.value().id()));
      * 
* - * @param keyImportOptions The key import configuration object containing information about the json web key being imported. + * @param keyImportOptions The key import configuration object containing information about the json web key + * being imported. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link Key + * imported key}. * @throws NullPointerException if {@code keyImportOptions} is {@code null}. * @throws HttpRequestException if {@code name} is empty string. - * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link Key imported key}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> importKeyWithResponse(KeyImportOptions keyImportOptions) { @@ -398,17 +445,19 @@ public Mono> importKeyWithResponse(KeyImportOptions keyImportOptio Mono> importKeyWithResponse(KeyImportOptions keyImportOptions, Context context) { Objects.requireNonNull(keyImportOptions, "The key import configuration parameter cannot be null."); KeyImportRequestParameters parameters = new KeyImportRequestParameters() - .key(keyImportOptions.keyMaterial()) - .hsm(keyImportOptions.hsm()) - .keyAttributes(new KeyRequestAttributes(keyImportOptions)); - return service.importKey(endpoint, keyImportOptions.name(), API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Importing key - {}", keyImportOptions.name())) - .doOnSuccess(response -> logger.info("Imported key - {}", response.value().name())) + .setKey(keyImportOptions.getKeyMaterial()) + .setHsm(keyImportOptions.isHsm()) + .setKeyAttributes(new KeyRequestAttributes(keyImportOptions)); + return service.importKey(endpoint, keyImportOptions.name(), API_VERSION, ACCEPT_LANGUAGE, parameters, + CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Importing key - {}", keyImportOptions.name())) + .doOnSuccess(response -> logger.info("Imported key - {}", response.getValue().name())) .doOnError(error -> logger.warning("Failed to import key - {}", keyImportOptions.name(), error)); } /** - * Gets the public part of the specified key and key version. The get key operation is applicable to all key types and it requires the {@code keys/get} permission. + * Gets the public part of the specified key and key version. The get key operation is applicable to all key types + * and it requires the {@code keys/get} permission. * *

Code Samples

*

Gets a specific version of the key in the key vault. Subscribes to the call asynchronously and prints out the @@ -417,10 +466,12 @@ Mono> importKeyWithResponse(KeyImportOptions keyImportOptions, Con * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.getKey#string-string} * * @param name The name of the key, cannot be null - * @param version The version of the key to retrieve. If this is an empty String or null, this call is equivalent to calling {@link KeyAsyncClient#getKey(String)}, with the latest version being retrieved. - * @throws ResourceNotFoundException when a key with {@code name} and {@code version} doesn't exist in the key vault. - * @throws HttpRequestException if {@code name} or {@code version} is empty string. + * @param version The version of the key to retrieve. If this is an empty String or null, this call is + * equivalent to calling {@link KeyAsyncClient#getKey(String)}, with the latest version being retrieved. * @return A {@link Mono} containing the requested {@link Key key}. + * @throws ResourceNotFoundException when a key with {@code name} and {@code version} doesn't exist in the key + * vault. + * @throws HttpRequestException if {@code name} or {@code version} is empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getKey(String name, String version) { @@ -428,7 +479,8 @@ public Mono getKey(String name, String version) { } /** - * Gets the public part of the specified key and key version. The get key operation is applicable to all key types and it requires the {@code keys/get} permission. + * Gets the public part of the specified key and key version. The get key operation is applicable to all key types + * and it requires the {@code keys/get} permission. * *

Code Samples

*

Gets a specific version of the key in the key vault. Subscribes to the call asynchronously and prints out the @@ -437,10 +489,13 @@ public Mono getKey(String name, String version) { * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.getKeyWithResponse#string-string} * * @param name The name of the key, cannot be null - * @param version The version of the key to retrieve. If this is an empty String or null, this call is equivalent to calling {@link KeyAsyncClient#getKey(String)}, with the latest version being retrieved. - * @throws ResourceNotFoundException when a key with {@code name} and {@code version} doesn't exist in the key vault. + * @param version The version of the key to retrieve. If this is an empty String or null, this call is + * equivalent to calling {@link KeyAsyncClient#getKey(String)}, with the latest version being retrieved. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the requested + * {@link Key key}. + * @throws ResourceNotFoundException when a key with {@code name} and {@code version} doesn't exist in the key + * vault. * @throws HttpRequestException if {@code name} or {@code version} is empty string. - * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the requested {@link Key key}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getKeyWithResponse(String name, String version) { @@ -449,14 +504,14 @@ public Mono> getKeyWithResponse(String name, String version) { Mono> getKeyWithResponse(String name, String version, Context context) { return service.getKey(endpoint, name, version, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Retrieving key - {}", name)) - .doOnSuccess(response -> logger.info("Retrieved key - {}", response.value().name())) - .doOnError(error -> logger.warning("Failed to get key - {}", name, error)); + .doOnRequest(ignored -> logger.info("Retrieving key - {}", name)) + .doOnSuccess(response -> logger.info("Retrieved key - {}", response.getValue().name())) + .doOnError(error -> logger.warning("Failed to get key - {}", name, error)); } /** - * Get the public part of the latest version of the specified key from the key vault. The get key operation is applicable to - * all key types and it requires the {@code keys/get} permission. + * Get the public part of the latest version of the specified key from the key vault. The get key operation is + * applicable to all key types and it requires the {@code keys/get} permission. * *

Code Samples

*

Gets latest version of the key in the key vault. Subscribes to the call asynchronously and prints out the @@ -465,9 +520,9 @@ Mono> getKeyWithResponse(String name, String version, Context cont * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.getKey#string} * * @param name The name of the key. + * @return A {@link Mono} containing the requested {@link Key key}. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException if {@code name} is empty string. - * @return A {@link Mono} containing the requested {@link Key key}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getKey(String name) { @@ -475,19 +530,21 @@ public Mono getKey(String name) { } /** - * Get public part of the key which represents {@link KeyBase keyBase} from the key vault. The get key operation is applicable - * to all key types and it requires the {@code keys/get} permission. + * Get public part of the key which represents {@link KeyBase keyBase} from the key vault. The get key operation is + * applicable to all key types and it requires the {@code keys/get} permission. * - *

The list operations {@link KeyAsyncClient#listKeys()} and {@link KeyAsyncClient#listKeyVersions(String)} return - * the {@link Flux} containing {@link KeyBase base key} as output excluding the key material of the key. + *

The list operations {@link KeyAsyncClient#listKeys()} and {@link KeyAsyncClient#listKeyVersions(String)} + * return the {@link Flux} containing {@link KeyBase base key} as output excluding the key material of the key. * This operation can then be used to get the full key with its key material from {@code keyBase}.

* * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.getKey#KeyBase} * * @param keyBase The {@link KeyBase base key} holding attributes of the key being requested. - * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() version} doesn't exist in the key vault. - * @throws HttpRequestException if {@link KeyBase#name()} name} or {@link KeyBase#version() version} is empty string. * @return A {@link Mono} containing the requested {@link Key key}. + * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() + * version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link KeyBase#name()} name} or {@link KeyBase#version() version} is empty + * string. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getKey(KeyBase keyBase) { @@ -495,42 +552,50 @@ public Mono getKey(KeyBase keyBase) { } /** - * Get public part of the key which represents {@link KeyBase keyBase} from the key vault. The get key operation is applicable - * to all key types and it requires the {@code keys/get} permission. + * Get public part of the key which represents {@link KeyBase keyBase} from the key vault. The get key operation is + * applicable to all key types and it requires the {@code keys/get} permission. * - *

The list operations {@link KeyAsyncClient#listKeys()} and {@link KeyAsyncClient#listKeyVersions(String)} return - * the {@link Flux} containing {@link KeyBase base key} as output excluding the key material of the key. + *

The list operations {@link KeyAsyncClient#listKeys()} and {@link KeyAsyncClient#listKeyVersions(String)} + * return the {@link Flux} containing {@link KeyBase base key} as output excluding the key material of the key. * This operation can then be used to get the full key with its key material from {@code keyBase}.

* * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.getKeyWithResponse#KeyBase} * * @param keyBase The {@link KeyBase base key} holding attributes of the key being requested. - * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() version} doesn't exist in the key vault. - * @throws HttpRequestException if {@link KeyBase#name()} name} or {@link KeyBase#version() version} is empty string. - * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the requested {@link Key key}. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the requested + * {@link Key key}. + * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() + * version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link KeyBase#name()} name} or {@link KeyBase#version() version} is empty + * string. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getKeyWithResponse(KeyBase keyBase) { Objects.requireNonNull(keyBase, "The Key Base parameter cannot be null."); - return withContext(context -> getKeyWithResponse(keyBase.name(), keyBase.version() == null ? "" : keyBase.version(), context)); + return withContext(context -> getKeyWithResponse(keyBase.name(), keyBase.version() == null ? "" + : keyBase.version(), context)); } /** - * Updates the attributes associated with the specified key, but not the cryptographic key material of the specified key in the key vault. The update - * operation changes specified attributes of an existing stored key and attributes that are not specified in the request are left unchanged. - * The cryptographic key material of a key itself cannot be changed. This operation requires the {@code keys/set} permission. + * Updates the attributes associated with the specified key, but not the cryptographic key material of the specified + * key in the key vault. The update operation changes specified attributes of an existing stored key and attributes + * that are not specified in the request are left unchanged. The cryptographic key material of a key itself cannot + * be changed. This operation requires the {@code keys/set} permission. * *

Code Samples

- *

Gets latest version of the key, changes its notBefore time and then updates it in the Azure Key Vault. Subscribes to the call asynchronously and prints out the + *

Gets latest version of the key, changes its notBefore time and then updates it in the Azure Key Vault. + * Subscribes to the call asynchronously and prints out the * returned key details when a response has been received.

* * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.updateKey#KeyBase} * * @param key The {@link KeyBase base key} object with updated properties. - * @throws NullPointerException if {@code key} is {@code null}. - * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() version} doesn't exist in the key vault. - * @throws HttpRequestException if {@link KeyBase#name() name} or {@link KeyBase#version() version} is empty string. * @return A {@link Mono} containing the {@link KeyBase updated key}. + * @throws NullPointerException if {@code key} is {@code null}. + * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() + * version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link KeyBase#name() name} or {@link KeyBase#version() version} is empty + * string. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono updateKey(KeyBase key) { @@ -540,31 +605,37 @@ public Mono updateKey(KeyBase key) { Mono> updateKeyWithResponse(KeyBase key, Context context) { Objects.requireNonNull(key, "The key input parameter cannot be null."); KeyRequestParameters parameters = new KeyRequestParameters() - .tags(key.tags()) - .keyAttributes(new KeyRequestAttributes(key)); - return service.updateKey(endpoint, key.name(), key.version(), API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Updating key - {}", key.name())) - .doOnSuccess(response -> logger.info("Updated key - {}", response.value().name())) + .setTags(key.tags()) + .setKeyAttributes(new KeyRequestAttributes(key)); + return service.updateKey(endpoint, key.name(), key.version(), API_VERSION, ACCEPT_LANGUAGE, parameters, + CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Updating key - {}", key.name())) + .doOnSuccess(response -> logger.info("Updated key - {}", response.getValue().name())) .doOnError(error -> logger.warning("Failed to update key - {}", key.name(), error)); } /** - * Updates the attributes and key operations associated with the specified key, but not the cryptographic key material of the specified key in the key vault. The update - * operation changes specified attributes of an existing stored key and attributes that are not specified in the request are left unchanged. - * The cryptographic key material of a key itself cannot be changed. This operation requires the {@code keys/set} permission. + * Updates the attributes and key operations associated with the specified key, but not the cryptographic key + * material of the specified key in the key vault. The update operation changes specified attributes of an existing + * stored key and attributes that are not specified in the request are left unchanged. The cryptographic key + * material of a key itself cannot be changed. This operation requires the {@code keys/set} permission. * *

Code Samples

- *

Gets latest version of the key, changes its notBefore time and then updates it in the Azure Key Vault. Subscribes to the call asynchronously and prints out the - * returned key details when a response has been received.

+ *

Gets latest version of the key, changes its notBefore time and then updates it in the Azure Key Vault. + * Subscribes to the call asynchronously and prints out the returned key details when a response has been received. + *

* * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.updateKeyWithResponse#KeyBase-keyOperations} * * @param key The {@link KeyBase base key} object with updated properties. * @param keyOperations The updated key operations to associate with the key. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link + * KeyBase updated key}. * @throws NullPointerException if {@code key} is {@code null}. - * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() version} doesn't exist in the key vault. - * @throws HttpRequestException if {@link KeyBase#name() name} or {@link KeyBase#version() version} is empty string. - * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link KeyBase updated key}. + * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() + * version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link KeyBase#name() name} or {@link KeyBase#version() version} is empty + * string. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> updateKeyWithResponse(KeyBase key, KeyOperation... keyOperations) { @@ -572,22 +643,26 @@ public Mono> updateKeyWithResponse(KeyBase key, KeyOperation... ke } /** - * Updates the attributes and key operations associated with the specified key, but not the cryptographic key material of the specified key in the key vault. The update - * operation changes specified attributes of an existing stored key and attributes that are not specified in the request are left unchanged. - * The cryptographic key material of a key itself cannot be changed. This operation requires the {@code keys/set} permission. + * Updates the attributes and key operations associated with the specified key, but not the cryptographic key + * material of the specified key in the key vault. The update operation changes specified attributes of an existing + * stored key and attributes that are not specified in the request are left unchanged. The cryptographic key + * material of a key itself cannot be changed. This operation requires the {@code keys/set} permission. * *

Code Samples

- *

Gets latest version of the key, changes its notBefore time and then updates it in the Azure Key Vault. Subscribes to the call asynchronously and prints out the - * returned key details when a response has been received.

+ *

Gets latest version of the key, changes its notBefore time and then updates it in the Azure Key Vault. + * Subscribes to the call asynchronously and prints out the returned key details when a response has been received. + *

* * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.updateKey#KeyBase-keyOperations} * * @param key The {@link KeyBase base key} object with updated properties. * @param keyOperations The updated key operations to associate with the key. - * @throws NullPointerException if {@code key} is {@code null}. - * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() version} doesn't exist in the key vault. - * @throws HttpRequestException if {@link KeyBase#name() name} or {@link KeyBase#version() version} is empty string. * @return A {@link Mono} containing the {@link KeyBase updated key}. + * @throws NullPointerException if {@code key} is {@code null}. + * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() + * version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link KeyBase#name() name} or {@link KeyBase#version() version} is empty + * string. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono updateKey(KeyBase key, KeyOperation... keyOperations) { @@ -597,32 +672,34 @@ public Mono updateKey(KeyBase key, KeyOperation... keyOperations) { Mono> updateKeyWithResponse(KeyBase key, Context context, KeyOperation... keyOperations) { Objects.requireNonNull(key, "The key input parameter cannot be null."); KeyRequestParameters parameters = new KeyRequestParameters() - .tags(key.tags()) - .keyOps(Arrays.asList(keyOperations)) - .keyAttributes(new KeyRequestAttributes(key)); - return service.updateKey(endpoint, key.name(), key.version(), API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Updating key - {}", key.name())) - .doOnSuccess(response -> logger.info("Updated key - {}", response.value().name())) + .setTags(key.tags()) + .setKeyOps(Arrays.asList(keyOperations)) + .setKeyAttributes(new KeyRequestAttributes(key)); + return service.updateKey(endpoint, key.name(), key.version(), API_VERSION, ACCEPT_LANGUAGE, parameters, + CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Updating key - {}", key.name())) + .doOnSuccess(response -> logger.info("Updated key - {}", response.getValue().name())) .doOnError(error -> logger.warning("Failed to update key - {}", key.name(), error)); } /** - * Deletes a key of any type from the key vault. If soft-delete is enabled on the key vault then the key is placed in the deleted state - * and requires to be purged for permanent deletion else the key is permanently deleted. The delete operation applies to any key stored - * in Azure Key Vault but it cannot be applied to an individual version of a key. This operation removes the cryptographic material - * associated with the key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. This operation - * requires the {@code keys/delete} permission. + * Deletes a key of any type from the key vault. If soft-delete is enabled on the key vault then the key is placed + * in the deleted state and requires to be purged for permanent deletion else the key is permanently deleted. The + * delete operation applies to any key stored in Azure Key Vault but it cannot be applied to an individual version + * of a key. This operation removes the cryptographic material associated with the key, which means the key is not + * usable for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. This operation requires the + * {@code keys/delete} permission. * *

Code Samples

- *

Deletes the key in the Azure Key Vault. Subscribes to the call asynchronously and prints out the - * deleted key details when a response has been received.

+ *

Deletes the key in the Azure Key Vault. Subscribes to the call asynchronously and prints out the deleted key + * details when a response has been received.

* * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.deleteKey#string} * * @param name The name of the key to be deleted. + * @return A {@link Mono} containing the {@link DeletedKey deleted key}. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. - * @return A {@link Mono} containing the {@link DeletedKey deleted key}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono deleteKey(String name) { @@ -630,22 +707,24 @@ public Mono deleteKey(String name) { } /** - * Deletes a key of any type from the key vault. If soft-delete is enabled on the key vault then the key is placed in the deleted state - * and requires to be purged for permanent deletion else the key is permanently deleted. The delete operation applies to any key stored - * in Azure Key Vault but it cannot be applied to an individual version of a key. This operation removes the cryptographic material - * associated with the key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. This operation - * requires the {@code keys/delete} permission. + * Deletes a key of any type from the key vault. If soft-delete is enabled on the key vault then the key is placed + * in the deleted state and requires to be purged for permanent deletion else the key is permanently deleted. The + * delete operation applies to any key stored in Azure Key Vault but it cannot be applied to an individual version + * of a key. This operation removes the cryptographic material associated with the key, which means the key is not + * usable for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. This operation requires the + * {@code keys/delete} permission. * *

Code Samples

- *

Deletes the key in the Azure Key Vault. Subscribes to the call asynchronously and prints out the - * deleted key details when a response has been received.

+ *

Deletes the key in the Azure Key Vault. Subscribes to the call asynchronously and prints out the deleted key + * details when a response has been received.

* * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.deleteKeyWithResponse#string} * * @param name The name of the key to be deleted. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link + * DeletedKey deleted key}. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. - * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link DeletedKey deleted key}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> deleteKeyWithResponse(String name) { @@ -654,26 +733,26 @@ public Mono> deleteKeyWithResponse(String name) { Mono> deleteKeyWithResponse(String name, Context context) { return service.deleteKey(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Deleting key - {}", name)) - .doOnSuccess(response -> logger.info("Deleted key - {}", response.value().name())) - .doOnError(error -> logger.warning("Failed to delete key - {}", name, error)); + .doOnRequest(ignored -> logger.info("Deleting key - {}", name)) + .doOnSuccess(response -> logger.info("Deleted key - {}", response.getValue().name())) + .doOnError(error -> logger.warning("Failed to delete key - {}", name, error)); } /** - * Gets the public part of a deleted key. The Get Deleted Key operation is applicable for soft-delete enabled vaults. This operation - * requires the {@code keys/get} permission. + * Gets the public part of a deleted key. The Get Deleted Key operation is applicable for soft-delete enabled + * vaults. This operation requires the {@code keys/get} permission. * *

Code Samples

- *

Gets the deleted key from the key vault enabled for soft-delete. Subscribes to the call asynchronously and prints out the - * deleted key details when a response has been received.

+ *

Gets the deleted key from the key vault enabled for soft-delete. Subscribes to the call asynchronously and + * prints out the deleted key details when a response has been received.

* //Assuming key is deleted on a soft-delete enabled vault. * * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.getDeletedKey#string} * * @param name The name of the deleted key. + * @return A {@link Mono} containing the {@link DeletedKey deleted key}. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. - * @return A {@link Mono} containing the {@link DeletedKey deleted key}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getDeletedKey(String name) { @@ -681,19 +760,21 @@ public Mono getDeletedKey(String name) { } /** - * Gets the public part of a deleted key. The Get Deleted Key operation is applicable for soft-delete enabled vaults. This operation - * requires the {@code keys/get} permission. + * Gets the public part of a deleted key. The Get Deleted Key operation is applicable for soft-delete enabled + * vaults. This operation requires the {@code keys/get} permission. * *

Code Samples

- *

Gets the deleted key from the key vault enabled for soft-delete. Subscribes to the call asynchronously and prints out the - * deleted key details when a response has been received.

+ *

Gets the deleted key from the key vault enabled for soft-delete. Subscribes to the call asynchronously and + * prints out the deleted key details when a response has been received.

+ * * //Assuming key is deleted on a soft-delete enabled vault. * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.getDeletedKeyWithResponse#string} * * @param name The name of the deleted key. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link + * DeletedKey deleted key}. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. - * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link DeletedKey deleted key}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getDeletedKeyWithResponse(String name) { @@ -702,25 +783,26 @@ public Mono> getDeletedKeyWithResponse(String name) { Mono> getDeletedKeyWithResponse(String name, Context context) { return service.getDeletedKey(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Retrieving deleted key - {}", name)) - .doOnSuccess(response -> logger.info("Retrieved deleted key - {}", response.value().name())) - .doOnError(error -> logger.warning("Failed to get key - {}", name, error)); + .doOnRequest(ignored -> logger.info("Retrieving deleted key - {}", name)) + .doOnSuccess(response -> logger.info("Retrieved deleted key - {}", response.getValue().name())) + .doOnError(error -> logger.warning("Failed to get key - {}", name, error)); } /** - * Permanently deletes the specified key without the possibility of recovery. The Purge Deleted Key operation is applicable for - * soft-delete enabled vaults. This operation requires the {@code keys/purge} permission. + * Permanently deletes the specified key without the possibility of recovery. The Purge Deleted Key operation is + * applicable for soft-delete enabled vaults. This operation requires the {@code keys/purge} permission. * *

Code Samples

- *

Purges the deleted key from the key vault enabled for soft-delete. Subscribes to the call asynchronously and prints out the - * status code from the server response when a response has been received.

+ *

Purges the deleted key from the key vault enabled for soft-delete. Subscribes to the call asynchronously and + * prints out the status code from the server response when a response has been received.

+ * * //Assuming key is deleted on a soft-delete enabled vault. * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.purgeDeletedKey#string} * * @param name The name of the deleted key. + * @return A {@link Mono} containing a {@link VoidResponse}. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. - * @return A {@link Mono} containing a {@link VoidResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono purgeDeletedKey(String name) { @@ -729,26 +811,26 @@ public Mono purgeDeletedKey(String name) { Mono purgeDeletedKey(String name, Context context) { return service.purgeDeletedKey(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Purging deleted key - {}", name)) - .doOnSuccess(response -> logger.info("Purged deleted key - {}", name)) - .doOnError(error -> logger.warning("Failed to purge deleted key - {}", name, error)); + .doOnRequest(ignored -> logger.info("Purging deleted key - {}", name)) + .doOnSuccess(response -> logger.info("Purged deleted key - {}", name)) + .doOnError(error -> logger.warning("Failed to purge deleted key - {}", name, error)); } /** - * Recovers the deleted key in the key vault to its latest version and can only be performed on a soft-delete enabled vault. An attempt - * to recover an non-deleted key will return an error. Consider this the inverse of the delete operation on soft-delete enabled vaults. - * This operation requires the {@code keys/recover} permission. + * Recovers the deleted key in the key vault to its latest version and can only be performed on a soft-delete + * enabled vault. An attempt to recover an non-deleted key will return an error. Consider this the inverse of the + * delete operation on soft-delete enabled vaults. This operation requires the {@code keys/recover} permission. * *

Code Samples

- *

Recovers the deleted key from the key vault enabled for soft-delete. Subscribes to the call asynchronously and prints out the - * recovered key details when a response has been received.

+ *

Recovers the deleted key from the key vault enabled for soft-delete. Subscribes to the call asynchronously and + * prints out the recovered key details when a response has been received.

* //Assuming key is deleted on a soft-delete enabled vault. * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.recoverDeletedKey#string} * * @param name The name of the deleted key to be recovered. + * @return A {@link Mono} containing the {@link Key recovered key}. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. - * @return A {@link Mono} containing the {@link Key recovered key}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono recoverDeletedKey(String name) { @@ -756,20 +838,21 @@ public Mono recoverDeletedKey(String name) { } /** - * Recovers the deleted key in the key vault to its latest version and can only be performed on a soft-delete enabled vault. An attempt - * to recover an non-deleted key will return an error. Consider this the inverse of the delete operation on soft-delete enabled vaults. - * This operation requires the {@code keys/recover} permission. + * Recovers the deleted key in the key vault to its latest version and can only be performed on a soft-delete + * enabled vault. An attempt to recover an non-deleted key will return an error. Consider this the inverse of the + * delete operation on soft-delete enabled vaults. This operation requires the {@code keys/recover} permission. * *

Code Samples

- *

Recovers the deleted key from the key vault enabled for soft-delete. Subscribes to the call asynchronously and prints out the - * recovered key details when a response has been received.

+ *

Recovers the deleted key from the key vault enabled for soft-delete. Subscribes to the call asynchronously and + * prints out the recovered key details when a response has been received.

* //Assuming key is deleted on a soft-delete enabled vault. * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.recoverDeletedKeyWithResponse#string} * * @param name The name of the deleted key to be recovered. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link Key + * recovered key}. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. - * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link Key recovered key}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> recoverDeletedKeyWithResponse(String name) { @@ -777,32 +860,35 @@ public Mono> recoverDeletedKeyWithResponse(String name) { } Mono> recoverDeletedKeyWithResponse(String name, Context context) { - return service.recoverDeletedKey(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Recovering deleted key - {}", name)) - .doOnSuccess(response -> logger.info("Recovered deleted key - {}", response.value().name())) - .doOnError(error -> logger.warning("Failed to recover deleted key - {}", name, error)); + return service.recoverDeletedKey(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, + context) + .doOnRequest(ignored -> logger.info("Recovering deleted key - {}", name)) + .doOnSuccess(response -> logger.info("Recovered deleted key - {}", response.getValue().name())) + .doOnError(error -> logger.warning("Failed to recover deleted key - {}", name, error)); } /** - * Requests a backup of the specified key be downloaded to the client. The Key Backup operation exports a key from Azure Key - * Vault in a protected form. Note that this operation does not return key material in a form that can be used outside the Azure Key - * Vault system, the returned key material is either protected to a Azure Key Vault HSM or to Azure Key Vault itself. The intent - * of this operation is to allow a client to generate a key in one Azure Key Vault instance, backup the key, and then restore it - * into another Azure Key Vault instance. The backup operation may be used to export, in protected form, any key type from Azure - * Key Vault. Individual versions of a key cannot be backed up. Backup / Restore can be performed within geographical boundaries only; - * meaning that a backup from one geographical area cannot be restored to another geographical area. For example, a backup - * from the US geographical area cannot be restored in an EU geographical area. This operation requires the {@code key/backup} permission. + * Requests a backup of the specified key be downloaded to the client. The Key Backup operation exports a key from + * Azure Key Vault in a protected form. Note that this operation does not return key material in a form that can be + * used outside the Azure Key Vault system, the returned key material is either protected to a Azure Key Vault HSM + * or to Azure Key Vault itself. The intent of this operation is to allow a client to generate a key in one Azure + * Key Vault instance, backup the key, and then restore it into another Azure Key Vault instance. The backup + * operation may be used to export, in protected form, any key type from Azure Key Vault. Individual versions of a + * key cannot be backed up. Backup / Restore can be performed within geographical boundaries only; meaning that a + * backup from one geographical area cannot be restored to another geographical area. For example, a backup from the + * US geographical area cannot be restored in an EU geographical area. This operation requires the {@code + * key/backup} permission. * *

Code Samples

- *

Backs up the key from the key vault. Subscribes to the call asynchronously and prints out the - * length of the key's backup byte array returned in the response.

+ *

Backs up the key from the key vault. Subscribes to the call asynchronously and prints out the length of the + * key's backup byte array returned in the response.

* * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.backupKey#string} * * @param name The name of the key. + * @return A {@link Mono} containing the backed up key blob. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. - * @return A {@link Mono} containing the backed up key blob. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono backupKey(String name) { @@ -810,25 +896,28 @@ public Mono backupKey(String name) { } /** - * Requests a backup of the specified key be downloaded to the client. The Key Backup operation exports a key from Azure Key - * Vault in a protected form. Note that this operation does not return key material in a form that can be used outside the Azure Key - * Vault system, the returned key material is either protected to a Azure Key Vault HSM or to Azure Key Vault itself. The intent - * of this operation is to allow a client to generate a key in one Azure Key Vault instance, backup the key, and then restore it - * into another Azure Key Vault instance. The backup operation may be used to export, in protected form, any key type from Azure - * Key Vault. Individual versions of a key cannot be backed up. Backup / Restore can be performed within geographical boundaries only; - * meaning that a backup from one geographical area cannot be restored to another geographical area. For example, a backup - * from the US geographical area cannot be restored in an EU geographical area. This operation requires the {@code key/backup} permission. + * Requests a backup of the specified key be downloaded to the client. The Key Backup operation exports a key from + * Azure Key Vault in a protected form. Note that this operation does not return key material in a form that can be + * used outside the Azure Key Vault system, the returned key material is either protected to a Azure Key Vault HSM + * or to Azure Key Vault itself. The intent of this operation is to allow a client to generate a key in one Azure + * Key Vault instance, backup the key, and then restore it into another Azure Key Vault instance. The backup + * operation may be used to export, in protected form, any key type from Azure Key Vault. Individual versions of a + * key cannot be backed up. Backup / Restore can be performed within geographical boundaries only; meaning that a + * backup from one geographical area cannot be restored to another geographical area. For example, a backup from the + * US geographical area cannot be restored in an EU geographical area. This operation requires the {@code + * key/backup} permission. * *

Code Samples

- *

Backs up the key from the key vault. Subscribes to the call asynchronously and prints out the - * length of the key's backup byte array returned in the response.

+ *

Backs up the key from the key vault. Subscribes to the call asynchronously and prints out the length of the + * key's backup byte array returned in the response.

* * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.backupKeyWithResponse#string} * * @param name The name of the key. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the backed up + * key blob. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. - * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the backed up key blob. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> backupKeyWithResponse(String name) { @@ -837,32 +926,34 @@ public Mono> backupKeyWithResponse(String name) { Mono> backupKeyWithResponse(String name, Context context) { return service.backupKey(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Backing up key - {}", name)) - .doOnSuccess(response -> logger.info("Backed up key - {}", name)) - .doOnError(error -> logger.warning("Failed to backup key - {}", name, error)) - .flatMap(base64URLResponse -> Mono.just(new SimpleResponse(base64URLResponse.request(), - base64URLResponse.statusCode(), base64URLResponse.headers(), base64URLResponse.value().value()))); + .doOnRequest(ignored -> logger.info("Backing up key - {}", name)) + .doOnSuccess(response -> logger.info("Backed up key - {}", name)) + .doOnError(error -> logger.warning("Failed to backup key - {}", name, error)) + .flatMap(base64URLResponse -> Mono.just(new SimpleResponse(base64URLResponse.getRequest(), + base64URLResponse.getStatusCode(), base64URLResponse.getHeaders(), base64URLResponse.getValue().getValue()))); } /** - * Restores a backed up key to a vault. Imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, - * attributes and access control policies. The restore operation may be used to import a previously backed up key. The individual versions of a - * key cannot be restored. The key is restored in its entirety with the same key name as it had when it was backed up. If the key name is not - * available in the target Key Vault, the restore operation will be rejected. While the key name is retained during restore, the final key identifier - * will change if the key is restored to a different vault. Restore will restore all versions and preserve version identifiers. The restore operation is subject - * to security constraints: The target Key Vault must be owned by the same Microsoft Azure Subscription as the source Key Vault The user must have restore permission in - * the target Key Vault. This operation requires the {@code keys/restore} permission. + * Restores a backed up key to a vault. Imports a previously backed up key into Azure Key Vault, restoring the key, + * its key identifier, attributes and access control policies. The restore operation may be used to import a + * previously backed up key. The individual versions of a key cannot be restored. The key is restored in its + * entirety with the same key name as it had when it was backed up. If the key name is not available in the target + * Key Vault, the restore operation will be rejected. While the key name is retained during restore, the final key + * identifier will change if the key is restored to a different vault. Restore will restore all versions and + * preserve version identifiers. The restore operation is subject to security constraints: The target Key Vault must + * be owned by the same Microsoft Azure Subscription as the source Key Vault The user must have restore permission + * in the target Key Vault. This operation requires the {@code keys/restore} permission. * *

Code Samples

- *

Restores the key in the key vault from its backup. Subscribes to the call asynchronously and prints out the restored key - * details when a response has been received.

+ *

Restores the key in the key vault from its backup. Subscribes to the call asynchronously and prints out the + * restored key details when a response has been received.

* //Pass the Key Backup Byte array to the restore operation. * * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.restoreKey#byte} * * @param backup The backup blob associated with the key. - * @throws ResourceModifiedException when {@code backup} blob is malformed. * @return A {@link Mono} containing the {@link Key restored key}. + * @throws ResourceModifiedException when {@code backup} blob is malformed. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono restoreKey(byte[] backup) { @@ -870,24 +961,27 @@ public Mono restoreKey(byte[] backup) { } /** - * Restores a backed up key to a vault. Imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, - * attributes and access control policies. The restore operation may be used to import a previously backed up key. The individual versions of a - * key cannot be restored. The key is restored in its entirety with the same key name as it had when it was backed up. If the key name is not - * available in the target Key Vault, the restore operation will be rejected. While the key name is retained during restore, the final key identifier - * will change if the key is restored to a different vault. Restore will restore all versions and preserve version identifiers. The restore operation is subject - * to security constraints: The target Key Vault must be owned by the same Microsoft Azure Subscription as the source Key Vault The user must have restore permission in - * the target Key Vault. This operation requires the {@code keys/restore} permission. + * Restores a backed up key to a vault. Imports a previously backed up key into Azure Key Vault, restoring the key, + * its key identifier, attributes and access control policies. The restore operation may be used to import a + * previously backed up key. The individual versions of a key cannot be restored. The key is restored in its + * entirety with the same key name as it had when it was backed up. If the key name is not available in the target + * Key Vault, the restore operation will be rejected. While the key name is retained during restore, the final key + * identifier will change if the key is restored to a different vault. Restore will restore all versions and + * preserve version identifiers. The restore operation is subject to security constraints: The target Key Vault must + * be owned by the same Microsoft Azure Subscription as the source Key Vault The user must have restore permission + * in the target Key Vault. This operation requires the {@code keys/restore} permission. * *

Code Samples

- *

Restores the key in the key vault from its backup. Subscribes to the call asynchronously and prints out the restored key - * details when a response has been received.

+ *

Restores the key in the key vault from its backup. Subscribes to the call asynchronously and prints out the + * restored key details when a response has been received.

* //Pass the Key Backup Byte array to the restore operation. * * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.restoreKeyWithResponse#byte} * * @param backup The backup blob associated with the key. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link Key + * restored key}. * @throws ResourceModifiedException when {@code backup} blob is malformed. - * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link Key restored key}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> restoreKeyWithResponse(byte[] backup) { @@ -895,20 +989,24 @@ public Mono> restoreKeyWithResponse(byte[] backup) { } Mono> restoreKeyWithResponse(byte[] backup, Context context) { - KeyRestoreRequestParameters parameters = new KeyRestoreRequestParameters().keyBackup(backup); - return service.restoreKey(endpoint, API_VERSION, parameters, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Attempting to restore key")) - .doOnSuccess(response -> logger.info("Restored Key - {}", response.value().name())) - .doOnError(error -> logger.warning("Failed to restore key - {}", error)); + KeyRestoreRequestParameters parameters = new KeyRestoreRequestParameters().setKeyBackup(backup); + return service.restoreKey(endpoint, API_VERSION, parameters, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, + context) + .doOnRequest(ignored -> logger.info("Attempting to restore key")) + .doOnSuccess(response -> logger.info("Restored Key - {}", response.getValue().name())) + .doOnError(error -> logger.warning("Failed to restore key - {}", error)); } /** - * List keys in the key vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public - * part of a stored key. The List operation is applicable to all key types and the individual key response in the flux is represented by {@link KeyBase} as only the base key identifier, - * attributes and tags are provided in the response. The key material and individual key versions are not listed in the response. This operation requires the {@code keys/list} permission. - * - *

It is possible to get full keys with key material from this information. Convert the {@link Flux} containing {@link KeyBase base key} to - * {@link Flux} containing {@link Key key} using {@link KeyAsyncClient#getKey(KeyBase baseKey)} within {@link Flux#flatMap(Function)}.

+ * List keys in the key vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain + * the public part of a stored key. The List operation is applicable to all key types and the individual key + * response in the flux is represented by {@link KeyBase} as only the base key identifier, attributes and tags are + * provided in the response. The key material and individual key versions are not listed in the response. This + * operation requires the {@code keys/list} permission. + * + *

It is possible to get full keys with key material from this information. Convert the {@link Flux} containing + * {@link KeyBase base key} to {@link Flux} containing {@link Key key} using + * {@link KeyAsyncClient#getKey(KeyBase baseKey)} within {@link Flux#flatMap(Function)}.

* * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.listKeys} * @@ -931,7 +1029,8 @@ PagedFlux listKeys(Context context) { * Gets attributes of all the keys given by the {@code nextPageLink} that was retrieved from a call to * {@link KeyAsyncClient#listKeys()}. * - * @param continuationToken The {@link PagedResponse#nextLink()} from a previous, successful call to one of the listKeys operations. + * @param continuationToken The {@link PagedResponse#nextLink()} from a previous, successful call to one of the + * listKeys operations. * @return A {@link Mono} of {@link PagedResponse} from the next page of results. */ private Mono> listKeysNextPage(String continuationToken, Context context) { @@ -942,10 +1041,12 @@ private Mono> listKeysNextPage(String continuationToken, } /* - * Calls the service and retrieve first page result. It makes one call and retrieve {@code DEFAULT_MAX_PAGE_RESULTS} values. + * Calls the service and retrieve first page result. It makes one call and retrieve {@code + * DEFAULT_MAX_PAGE_RESULTS} values. */ private Mono> listKeysFirstPage(Context context) { - return service.getKeys(endpoint, DEFAULT_MAX_PAGE_RESULTS, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + return service.getKeys(endpoint, DEFAULT_MAX_PAGE_RESULTS, API_VERSION, ACCEPT_LANGUAGE, + CONTENT_TYPE_HEADER_VALUE, context) .doOnRequest(ignored -> logger.info("Listing keys")) .doOnSuccess(response -> logger.info("Listed keys")) .doOnError(error -> logger.warning("Failed to list keys", error)); @@ -957,8 +1058,8 @@ private Mono> listKeysFirstPage(Context context) { * for soft-delete. This operation requires the {@code keys/list} permission. * *

Code Samples

- *

Lists the deleted keys in the key vault. Subscribes to the call asynchronously and prints out the - * recovery id of each deleted key when a response has been received.

+ *

Lists the deleted keys in the key vault. Subscribes to the call asynchronously and prints out the recovery id + * of each deleted key when a response has been received.

* * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.listDeletedKeys} * @@ -981,21 +1082,25 @@ PagedFlux listDeletedKeys(Context context) { * Gets attributes of all the keys given by the {@code nextPageLink} that was retrieved from a call to * {@link KeyAsyncClient#listDeletedKeys()}. * - * @param continuationToken The {@link PagedResponse#nextLink()} from a previous, successful call to one of the list operations. + * @param continuationToken The {@link PagedResponse#nextLink()} from a previous, successful call to one of the + * list operations. * @return A {@link Mono} of {@link PagedResponse} from the next page of results. */ private Mono> listDeletedKeysNextPage(String continuationToken, Context context) { return service.getDeletedKeys(endpoint, continuationToken, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) .doOnRequest(ignored -> logger.info("Listing next deleted keys page - Page {} ", continuationToken)) .doOnSuccess(response -> logger.info("Listed next deleted keys page - Page {} ", continuationToken)) - .doOnError(error -> logger.warning("Failed to list next deleted keys page - Page {} ", continuationToken, error)); + .doOnError(error -> logger.warning("Failed to list next deleted keys page - Page {} ", continuationToken, + error)); } /* - * Calls the service and retrieve first page result. It makes one call and retrieve {@code DEFAULT_MAX_PAGE_RESULTS} values. + * Calls the service and retrieve first page result. It makes one call and retrieve {@code + * DEFAULT_MAX_PAGE_RESULTS} values. */ private Mono> listDeletedKeysFirstPage(Context context) { - return service.getDeletedKeys(endpoint, DEFAULT_MAX_PAGE_RESULTS, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + return service.getDeletedKeys(endpoint, DEFAULT_MAX_PAGE_RESULTS, API_VERSION, ACCEPT_LANGUAGE, + CONTENT_TYPE_HEADER_VALUE, context) .doOnRequest(ignored -> logger.info("Listing deleted keys")) .doOnSuccess(response -> logger.info("Listed deleted keys")) .doOnError(error -> logger.warning("Failed to list deleted keys", error)); @@ -1006,16 +1111,17 @@ private Mono> listDeletedKeysFirstPage(Context context * as only the base key identifier, attributes and tags are provided in the response. The key material values are * not provided in the response. This operation requires the {@code keys/list} permission. * - *

It is possible to get the keys with key material of all the versions from this information. Convert the {@link Flux} - * containing {@link KeyBase base key} to {@link Flux} containing {@link Key key} using + *

It is possible to get the keys with key material of all the versions from this information. Convert the {@link + * Flux} containing {@link KeyBase base key} to {@link Flux} containing {@link Key key} using * {@link KeyAsyncClient#getKey(KeyBase baseKey)} within {@link Flux#flatMap(Function)}.

* * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.listKeyVersions} * * @param name The name of the key. + * @return A {@link PagedFlux} containing {@link KeyBase key} of all the versions of the specified key in the vault. + * Flux is empty if key with {@code name} does not exist in key vault. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. - * @return A {@link PagedFlux} containing {@link KeyBase key} of all the versions of the specified key in the vault. Flux is empty if key with {@code name} does not exist in key vault. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listKeyVersions(String name) { @@ -1031,7 +1137,8 @@ PagedFlux listKeyVersions(String name, Context context) { } private Mono> listKeyVersionsFirstPage(String name, Context context) { - return service.getKeyVersions(endpoint, name, DEFAULT_MAX_PAGE_RESULTS, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + return service.getKeyVersions(endpoint, name, DEFAULT_MAX_PAGE_RESULTS, API_VERSION, ACCEPT_LANGUAGE, + CONTENT_TYPE_HEADER_VALUE, context) .doOnRequest(ignored -> logger.info("Listing key versions - {}", name)) .doOnSuccess(response -> logger.info("Listed key versions - {}", name)) .doOnError(error -> logger.warning(String.format("Failed to list key versions - {}", name), error)); @@ -1041,14 +1148,16 @@ private Mono> listKeyVersionsFirstPage(String name, Conte * Gets attributes of all the keys given by the {@code nextPageLink} that was retrieved from a call to * {@link KeyAsyncClient#listKeyVersions()}. * - * @param continuationToken The {@link PagedResponse#nextLink()} from a previous, successful call to one of the listKeys operations. + * @param continuationToken The {@link PagedResponse#nextLink()} from a previous, successful call to one of the + * listKeys operations. * @return A {@link Mono} of {@link PagedResponse} from the next page of results. */ private Mono> listKeyVersionsNextPage(String continuationToken, Context context) { return service.getKeys(endpoint, continuationToken, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) .doOnRequest(ignored -> logger.info("Listing next key versions page - Page {} ", continuationToken)) .doOnSuccess(response -> logger.info("Listed next key versions page - Page {} ", continuationToken)) - .doOnError(error -> logger.warning("Failed to list next key versions page - Page {} ", continuationToken, error)); + .doOnError(error -> logger.warning("Failed to list next key versions page - Page {} ", continuationToken, + error)); } } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyBackup.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyBackup.java index cee5c762d9f5..8e3b48ec0ecc 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyBackup.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyBackup.java @@ -21,7 +21,7 @@ class KeyBackup { * * @return the value value */ - public byte[] value() { + public byte[] getValue() { if (this.value == null) { return new byte[0]; } 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 3144c1feeb0d..3bc7800783f5 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 @@ -11,11 +11,11 @@ import com.azure.core.http.rest.VoidResponse; import com.azure.core.implementation.annotation.ServiceClient; import com.azure.core.util.Context; -import com.azure.security.keyvault.keys.models.Key; -import com.azure.security.keyvault.keys.models.KeyCreateOptions; import com.azure.security.keyvault.keys.models.DeletedKey; import com.azure.security.keyvault.keys.models.EcKeyCreateOptions; +import com.azure.security.keyvault.keys.models.Key; import com.azure.security.keyvault.keys.models.KeyBase; +import com.azure.security.keyvault.keys.models.KeyCreateOptions; import com.azure.security.keyvault.keys.models.KeyImportOptions; import com.azure.security.keyvault.keys.models.RsaKeyCreateOptions; import com.azure.security.keyvault.keys.models.webkey.JsonWebKey; @@ -27,8 +27,8 @@ import java.util.Objects; /** - * The KeyClient provides synchronous methods to manage {@link Key keys} in the Azure Key Vault. The client - * supports creating, retrieving, updating, deleting, purging, backing up, restoring and listing the {@link Key keys}. The client + * The KeyClient provides synchronous methods to manage {@link Key keys} in the Azure Key Vault. The client supports + * creating, retrieving, updating, deleting, purging, backing up, restoring and listing the {@link Key keys}. The client * also supports listing {@link DeletedKey deleted keys} for a soft-delete enabled Azure Key Vault. * *

Samples to construct the sync client

@@ -52,10 +52,12 @@ public final class KeyClient { /** * Creates a new key and stores it in the key vault. The create key operation can be used to create any key type in - * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the {@code keys/create} permission. + * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the + * {@code keys/create} permission. * - *

The {@link KeyType keyType} indicates the type of key to create. Possible values include: {@link KeyType#EC EC}, - * {@link KeyType#EC_HSM EC-HSM}, {@link KeyType#RSA RSA}, {@link KeyType#RSA_HSM RSA-HSM} and {@link KeyType#OCT OCT}.

+ *

The {@link KeyType keyType} indicates the type of key to create. Possible values include: {@link KeyType#EC + * EC}, {@link KeyType#EC_HSM EC-HSM}, {@link KeyType#RSA RSA}, {@link KeyType#RSA_HSM RSA-HSM} and {@link + * KeyType#OCT OCT}.

* *

Code Samples

*

Creates a new EC key. Prints out the details of the created key.

@@ -63,170 +65,190 @@ public final class KeyClient { * * @param name The name of the key being created. * @param keyType The type of key to create. For valid values, see {@link KeyType KeyType}. + * @return The {@link Key created key}. * @throws ResourceModifiedException if {@code name} or {@code keyType} is null. * @throws HttpRequestException if {@code name} is empty string. - * @return The {@link Key created key}. */ public Key createKey(String name, KeyType keyType) { - return client.createKeyWithResponse(name, keyType, Context.NONE).block().value(); + return client.createKeyWithResponse(name, keyType, Context.NONE).block().getValue(); } /** * Creates a new key and stores it in the key vault. The create key operation can be used to create any key type in - * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the {@code keys/create} permission. + * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the + * {@code keys/create} permission. * - *

The {@link KeyCreateOptions} is required. The {@link KeyCreateOptions#expires() expires} and {@link KeyCreateOptions#notBefore() notBefore} values - * are optional. The {@link KeyCreateOptions#enabled() enabled} field is set to true by Azure Key Vault, if not specified.

+ *

The {@link KeyCreateOptions} is required. The {@link KeyCreateOptions#expires() expires} and {@link + * KeyCreateOptions#notBefore() notBefore} values are optional. The {@link KeyCreateOptions#enabled() enabled} field + * is set to true by Azure Key Vault, if not specified.

* - *

The {@link KeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values include: {@link KeyType#EC EC}, - * {@link KeyType#EC_HSM EC-HSM}, {@link KeyType#RSA RSA}, {@link KeyType#RSA_HSM RSA-HSM} and {@link KeyType#OCT OCT}.

+ *

The {@link KeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values include: + * {@link KeyType#EC EC}, {@link KeyType#EC_HSM EC-HSM}, {@link KeyType#RSA RSA}, {@link KeyType#RSA_HSM RSA-HSM} + * and {@link KeyType#OCT OCT}.

* *

Code Samples

- *

Creates a new RSA key which activates in one day and expires in one year. Prints out the details of the created key.

- * {@codesnippet com.azure.keyvault.keys.keyclient.createKey#keyOptions} + *

Creates a new RSA key which activates in one day and expires in one year. Prints out the details of the + * created key.

{@codesnippet com.azure.keyvault.keys.keyclient.createKey#keyOptions} * * @param keyCreateOptions The key options object containing information about the key being created. + * @return The {@link Key created key}. * @throws NullPointerException if {@code keyCreateOptions} is {@code null}. * @throws ResourceModifiedException if {@code keyCreateOptions} is malformed. * @throws HttpRequestException if {@code name} is empty string. - * @return The {@link Key created key}. */ public Key createKey(KeyCreateOptions keyCreateOptions) { - return createKeyWithResponse(keyCreateOptions, Context.NONE).value(); + return createKeyWithResponse(keyCreateOptions, Context.NONE).getValue(); } /** * Creates a new key and stores it in the key vault. The create key operation can be used to create any key type in - * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the {@code keys/create} permission. + * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the + * {@code keys/create} permission. * - *

The {@link KeyCreateOptions} is required. The {@link KeyCreateOptions#expires() expires} and {@link KeyCreateOptions#notBefore() notBefore} values - * are optional. The {@link KeyCreateOptions#enabled() enabled} field is set to true by Azure Key Vault, if not specified.

+ *

The {@link KeyCreateOptions} is required. The {@link KeyCreateOptions#expires() expires} and {@link + * KeyCreateOptions#notBefore() notBefore} values are optional. The {@link KeyCreateOptions#enabled() enabled} field + * is set to true by Azure Key Vault, if not specified.

* - *

The {@link KeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values include: {@link KeyType#EC EC}, - * {@link KeyType#EC_HSM EC-HSM}, {@link KeyType#RSA RSA}, {@link KeyType#RSA_HSM RSA-HSM} and {@link KeyType#OCT OCT}.

+ *

The {@link KeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values include: + * {@link KeyType#EC EC}, {@link KeyType#EC_HSM EC-HSM}, {@link KeyType#RSA RSA}, {@link KeyType#RSA_HSM RSA-HSM} + * and {@link KeyType#OCT OCT}.

* *

Code Samples

- *

Creates a new RSA key which activates in one day and expires in one year. Prints out the details of the created key.

- * {@codesnippet com.azure.keyvault.keys.keyclient.createKeyWithResponse#keyCreateOptions-Context} + *

Creates a new RSA key which activates in one day and expires in one year. Prints out the details of the + * created key.

{@codesnippet com.azure.keyvault.keys.keyclient.createKeyWithResponse#keyCreateOptions-Context} * * @param keyCreateOptions The key options object containing information about the key being created. * @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 {@link Key created key}. * @throws NullPointerException if {@code keyCreateOptions} is {@code null}. * @throws ResourceModifiedException if {@code keyCreateOptions} is malformed. * @throws HttpRequestException if {@code name} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the {@link Key created key}. */ public Response createKeyWithResponse(KeyCreateOptions keyCreateOptions, Context context) { return client.createKeyWithResponse(keyCreateOptions, context).block(); } /** - * Creates a new Rsa key and stores it in the key vault. The create Rsa key operation can be used to create any Rsa key type in - * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the {@code keys/create} permission. + * Creates a new Rsa key and stores it in the key vault. The create Rsa key operation can be used to create any Rsa + * key type in key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It + * requires the {@code keys/create} permission. * - *

The {@link RsaKeyCreateOptions} is required. The {@link RsaKeyCreateOptions#keySize() keySize} can be optionally specified. The {@link RsaKeyCreateOptions#expires() expires} - * and {@link RsaKeyCreateOptions#notBefore() notBefore} values are optional. The {@link RsaKeyCreateOptions#enabled() enabled} field - * is set to true by Azure Key Vault, if not specified.

+ *

The {@link RsaKeyCreateOptions} is required. The {@link RsaKeyCreateOptions#getKeySize() keySize} can be + * optionally specified. The {@link RsaKeyCreateOptions#expires() expires} and {@link + * RsaKeyCreateOptions#notBefore() notBefore} values are optional. The {@link RsaKeyCreateOptions#enabled() enabled} + * field is set to true by Azure Key Vault, if not specified.

* - *

The {@link RsaKeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values include: {@link KeyType#RSA RSA} and - * {@link KeyType#RSA_HSM RSA-HSM}.

+ *

The {@link RsaKeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values + * include: {@link KeyType#RSA RSA} and {@link KeyType#RSA_HSM RSA-HSM}.

* *

Code Samples

- *

Creates a new RSA key with size 2048 which activates in one day and expires in one year. Prints out the details of the created key.

+ *

Creates a new RSA key with size 2048 which activates in one day and expires in one year. Prints out the + * details of the created key.

* {@codesnippet com.azure.keyvault.keys.keyclient.createRsaKey#keyOptions} * * @param rsaKeyCreateOptions The key options object containing information about the rsa key being created. + * @return The {@link Key created key}. * @throws NullPointerException if {@code rsaKeyCreateOptions} is {@code null}. * @throws ResourceModifiedException if {@code rsaKeyCreateOptions} is malformed. * @throws HttpRequestException if {@code name} is empty string. - * @return The {@link Key created key}. */ public Key createRsaKey(RsaKeyCreateOptions rsaKeyCreateOptions) { - return createRsaKeyWithResponse(rsaKeyCreateOptions, Context.NONE).value(); + return createRsaKeyWithResponse(rsaKeyCreateOptions, Context.NONE).getValue(); } /** - * Creates a new Rsa key and stores it in the key vault. The create Rsa key operation can be used to create any Rsa key type in - * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the {@code keys/create} permission. + * Creates a new Rsa key and stores it in the key vault. The create Rsa key operation can be used to create any Rsa + * key type in key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It + * requires the {@code keys/create} permission. * - *

The {@link RsaKeyCreateOptions} is required. The {@link RsaKeyCreateOptions#keySize() keySize} can be optionally specified. The {@link RsaKeyCreateOptions#expires() expires} - * and {@link RsaKeyCreateOptions#notBefore() notBefore} values are optional. The {@link RsaKeyCreateOptions#enabled() enabled} field - * is set to true by Azure Key Vault, if not specified.

+ *

The {@link RsaKeyCreateOptions} is required. The {@link RsaKeyCreateOptions#getKeySize() keySize} can be + * optionally specified. The {@link RsaKeyCreateOptions#expires() expires} and {@link + * RsaKeyCreateOptions#notBefore() notBefore} values are optional. The {@link RsaKeyCreateOptions#enabled() enabled} + * field is set to true by Azure Key Vault, if not specified.

* - *

The {@link RsaKeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values include: {@link KeyType#RSA RSA} and - * {@link KeyType#RSA_HSM RSA-HSM}.

+ *

The {@link RsaKeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values + * include: {@link KeyType#RSA RSA} and {@link KeyType#RSA_HSM RSA-HSM}.

* *

Code Samples

- *

Creates a new RSA key with size 2048 which activates in one day and expires in one year. Prints out the details of the created key.

+ *

Creates a new RSA key with size 2048 which activates in one day and expires in one year. Prints out the + * details of the created key.

* {@codesnippet com.azure.keyvault.keys.keyclient.createRsaKeyWithResponse#keyOptions-Context} * * @param rsaKeyCreateOptions The key options object containing information about the rsa key being created. * @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 {@link Key created key}. * @throws NullPointerException if {@code rsaKeyCreateOptions} is {@code null}. * @throws ResourceModifiedException if {@code rsaKeyCreateOptions} is malformed. * @throws HttpRequestException if {@code name} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the {@link Key created key}. */ public Response createRsaKeyWithResponse(RsaKeyCreateOptions rsaKeyCreateOptions, Context context) { return client.createRsaKeyWithResponse(rsaKeyCreateOptions, context).block(); } /** - * Creates a new Ec key and stores it in the key vault. The create Ec key operation can be used to create any Ec key type in - * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the {@code keys/create} permission. + * Creates a new Ec key and stores it in the key vault. The create Ec key operation can be used to create any Ec + * key type in key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It + * requires the {@code keys/create} permission. * - *

The {@link EcKeyCreateOptions} parameter is required. The {@link EcKeyCreateOptions#curve() key curve} can be optionally specified. If not specified, - * default value of {@link KeyCurveName#P_256 P-256} is used by Azure Key Vault. The {@link EcKeyCreateOptions#expires() expires} and {@link EcKeyCreateOptions#notBefore() notBefore} values - * are optional. The {@link EcKeyCreateOptions#enabled() enabled} field is set to true by Azure Key Vault, if not specified.

+ *

The {@link EcKeyCreateOptions} parameter is required. The {@link EcKeyCreateOptions#getCurve() key curve} can be + * optionally specified. If not specified, default value of {@link KeyCurveName#P_256 P-256} is used by Azure Key + * Vault. The {@link EcKeyCreateOptions#expires() expires} and {@link EcKeyCreateOptions#notBefore() notBefore} + * values are optional. The {@link EcKeyCreateOptions#enabled() enabled} field is set to true by Azure Key Vault, if + * not specified.

* - *

The {@link EcKeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values include: {@link KeyType#EC EC} and - * {@link KeyType#EC_HSM EC-HSM}.

+ *

The {@link EcKeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values + * include: {@link KeyType#EC EC} and {@link KeyType#EC_HSM EC-HSM}.

* *

Code Samples

- *

Creates a new EC key with P-384 web key curve. The key activates in one day and expires in one year. Prints out - * the details of the created key.

+ *

Creates a new EC key with P-384 web key curve. The key activates in one day and expires in one year. Prints + * out the details of the created key.

* {@codesnippet com.azure.keyvault.keys.keyclient.createEcKey#keyOptions} * * @param ecKeyCreateOptions The key options object containing information about the ec key being created. + * @return The {@link Key created key}. * @throws NullPointerException if {@code ecKeyCreateOptions} is {@code null}. * @throws ResourceModifiedException if {@code ecKeyCreateOptions} is malformed. * @throws HttpRequestException if {@code name} is empty string. - * @return The {@link Key created key}. */ public Key createEcKey(EcKeyCreateOptions ecKeyCreateOptions) { - return createEcKeyWithResponse(ecKeyCreateOptions, Context.NONE).value(); + return createEcKeyWithResponse(ecKeyCreateOptions, Context.NONE).getValue(); } /** - * Creates a new Ec key and stores it in the key vault. The create Ec key operation can be used to create any Ec key type in - * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the {@code keys/create} permission. + * Creates a new Ec key and stores it in the key vault. The create Ec key operation can be used to create any Ec + * key type in key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It + * requires the {@code keys/create} permission. * - *

The {@link EcKeyCreateOptions} parameter is required. The {@link EcKeyCreateOptions#curve() key curve} can be optionally specified. If not specified, - * default value of {@link KeyCurveName#P_256 P-256} is used by Azure Key Vault. The {@link EcKeyCreateOptions#expires() expires} and {@link EcKeyCreateOptions#notBefore() notBefore} values - * are optional. The {@link EcKeyCreateOptions#enabled() enabled} field is set to true by Azure Key Vault, if not specified.

+ *

The {@link EcKeyCreateOptions} parameter is required. The {@link EcKeyCreateOptions#getCurve() key curve} can be + * optionally specified. If not specified, default value of {@link KeyCurveName#P_256 P-256} is used by Azure Key + * Vault. The {@link EcKeyCreateOptions#expires() expires} and {@link EcKeyCreateOptions#notBefore() notBefore} + * values are optional. The {@link EcKeyCreateOptions#enabled() enabled} field is set to true by Azure Key Vault, if + * not specified.

* - *

The {@link EcKeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values include: {@link KeyType#EC EC} and - * {@link KeyType#EC_HSM EC-HSM}.

+ *

The {@link EcKeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values + * include: + * {@link KeyType#EC EC} and {@link KeyType#EC_HSM EC-HSM}.

* *

Code Samples

- *

Creates a new EC key with P-384 web key curve. The key activates in one day and expires in one year. Prints out - * the details of the created key.

+ *

Creates a new EC key with P-384 web key curve. The key activates in one day and expires in one year. Prints + * out the details of the created key.

* {@codesnippet com.azure.keyvault.keys.keyclient.createEcKeyWithResponse#keyOptions-Context} * * @param ecKeyCreateOptions The key options object containing information about the ec key being created. * @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 {@link Key created key}. * @throws NullPointerException if {@code ecKeyCreateOptions} is {@code null}. * @throws ResourceModifiedException if {@code ecKeyCreateOptions} is malformed. * @throws HttpRequestException if {@code name} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the {@link Key created key}. */ public Response createEcKeyWithResponse(EcKeyCreateOptions ecKeyCreateOptions, Context context) { return client.createEcKeyWithResponse(ecKeyCreateOptions, context).block(); } /** - * Imports an externally created key and stores it in key vault. The import key operation may be used to import any key type - * into the Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. This operation requires the {@code keys/import} permission. + * Imports an externally created key and stores it in key vault. The import key operation may be used to import any + * key type into the Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the + * key. This operation requires the {@code keys/import} permission. * *

Code Samples

*

Imports a new key into key vault. Prints out the details of the imported key.

@@ -237,21 +259,23 @@ public Response createEcKeyWithResponse(EcKeyCreateOptions ecKeyCreateOptio * * @param name The name for the imported key. * @param keyMaterial The Json web key being imported. - * @throws HttpRequestException if {@code name} is empty string. * @return The {@link Key imported key}. + * @throws HttpRequestException if {@code name} is empty string. */ public Key importKey(String name, JsonWebKey keyMaterial) { - return client.importKeyWithResponse(name, keyMaterial, Context.NONE).block().value(); + return client.importKeyWithResponse(name, keyMaterial, Context.NONE).block().getValue(); } /** - * Imports an externally created key and stores it in key vault. The import key operation may be used to import any key type - * into the Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. This operation requires the {@code keys/import} permission. + * Imports an externally created key and stores it in key vault. The import key operation may be used to import any + * key type into the Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the + * key. This operation requires the {@code keys/import} permission. * - *

The {@code keyImportOptions} is required and its fields {@link KeyImportOptions#name() name} and {@link KeyImportOptions#keyMaterial() key material} cannot - * be null. The {@link KeyImportOptions#expires() expires} and {@link KeyImportOptions#notBefore() notBefore} values in {@code keyImportOptions} are optional. If not - * specified, no values are set for the fields. The {@link KeyImportOptions#enabled() enabled} field is set to true and the {@link KeyImportOptions#hsm() hsm} field is - * set to false by Azure Key Vault, if they are not specified.

+ *

The {@code keyImportOptions} is required and its fields {@link KeyImportOptions#name() name} and {@link + * KeyImportOptions#getKeyMaterial() key material} cannot be null. The {@link KeyImportOptions#expires() expires} and + * {@link KeyImportOptions#notBefore() notBefore} values in {@code keyImportOptions} are optional. If not specified, + * no values are set for the fields. The {@link KeyImportOptions#enabled() enabled} field is set to true and the + * {@link KeyImportOptions#isHsm() hsm} field is set to false by Azure Key Vault, if they are not specified.

* *

Code Samples

*

Imports a new key into key vault. Prints out the details of the imported key.

@@ -264,23 +288,26 @@ public Key importKey(String name, JsonWebKey keyMaterial) { * System.out.printf("Key is imported with name %s and id %s \n", importedKey.name(), importedKey.id()); * * - * @param keyImportOptions The key import configuration object containing information about the json web key being imported. + * @param keyImportOptions The key import configuration object containing information about the json web key + * being imported. + * @return The {@link Key imported key}. * @throws NullPointerException if {@code keyImportOptions} is {@code null}. * @throws HttpRequestException if {@code name} is empty string. - * @return The {@link Key imported key}. */ public Key importKey(KeyImportOptions keyImportOptions) { - return importKeyWithResponse(keyImportOptions, Context.NONE).value(); + return importKeyWithResponse(keyImportOptions, Context.NONE).getValue(); } /** - * Imports an externally created key and stores it in key vault. The import key operation may be used to import any key type - * into the Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. This operation requires the {@code keys/import} permission. + * Imports an externally created key and stores it in key vault. The import key operation may be used to import any + * key type into the Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the + * key. This operation requires the {@code keys/import} permission. * - *

The {@code keyImportOptions} is required and its fields {@link KeyImportOptions#name() name} and {@link KeyImportOptions#keyMaterial() key material} cannot - * be null. The {@link KeyImportOptions#expires() expires} and {@link KeyImportOptions#notBefore() notBefore} values in {@code keyImportOptions} are optional. If not - * specified, no values are set for the fields. The {@link KeyImportOptions#enabled() enabled} field is set to true and the {@link KeyImportOptions#hsm() hsm} field is - * set to false by Azure Key Vault, if they are not specified.

+ *

The {@code keyImportOptions} is required and its fields {@link KeyImportOptions#name() name} and {@link + * KeyImportOptions#getKeyMaterial() key material} cannot be null. The {@link KeyImportOptions#expires() expires} and + * {@link KeyImportOptions#notBefore() notBefore} values in {@code keyImportOptions} are optional. If not specified, + * no values are set for the fields. The {@link KeyImportOptions#enabled() enabled} field is set to true and the + * {@link KeyImportOptions#isHsm() hsm} field is set to false by Azure Key Vault, if they are not specified.

* *

Code Samples

*

Imports a new key into key vault. Prints out the details of the imported key.

@@ -293,35 +320,40 @@ public Key importKey(KeyImportOptions keyImportOptions) { * System.out.printf("Key is imported with name %s and id %s \n", importedKey.name(), importedKey.id()); * * - * @param keyImportOptions The key import configuration object containing information about the json web key being imported. + * @param keyImportOptions The key import configuration object containing information about the json web key + * being imported. * @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 {@link Key imported key}. * @throws NullPointerException if {@code keyImportOptions} is {@code null}. * @throws HttpRequestException if {@code name} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the {@link Key imported key}. */ public Response importKeyWithResponse(KeyImportOptions keyImportOptions, Context context) { return client.importKeyWithResponse(keyImportOptions, context).block(); } /** - * Gets the public part of the specified key and key version. The get key operation is applicable to all key types and it requires the {@code keys/get} permission. + * Gets the public part of the specified key and key version. The get key operation is applicable to all key types + * and it requires the {@code keys/get} permission. * *

Code Samples

*

Gets a specific version of the key in the key vault. Prints out the details of the returned key.

* {@codesnippet com.azure.keyvault.keys.keyclient.getKey#string-string} * * @param name The name of the key, cannot be null - * @param version The version of the key to retrieve. If this is an empty String or null, this call is equivalent to calling {@link KeyClient#getKey(String)}, with the latest version being retrieved. - * @throws ResourceNotFoundException when a key with {@code name} and {@code version} doesn't exist in the key vault. - * @throws HttpRequestException if {@code name} or {@code version} is empty string. + * @param version The version of the key to retrieve. If this is an empty String or null, this call is + * equivalent to calling {@link KeyClient#getKey(String)}, with the latest version being retrieved. * @return The requested {@link Key key}. + * @throws ResourceNotFoundException when a key with {@code name} and {@code version} doesn't exist in the key + * vault. + * @throws HttpRequestException if {@code name} or {@code version} is empty string. */ public Key getKey(String name, String version) { - return getKeyWithResponse(name, version, Context.NONE).value(); + return getKeyWithResponse(name, version, Context.NONE).getValue(); } /** - * Gets the public part of the specified key and key version. The get key operation is applicable to all key types and it requires the {@code keys/get} permission. + * Gets the public part of the specified key and key version. The get key operation is applicable to all key types + * and it requires the {@code keys/get} permission. * *

Code Samples

*

Gets a specific version of the key in the key vault. Prints out the details of the returned key.

@@ -329,194 +361,215 @@ public Key getKey(String name, String version) { * * @param name The name of the key, cannot be null * @param context Additional context that is passed through the Http pipeline during the service call. - * @param version The version of the key to retrieve. If this is an empty String or null, this call is equivalent to calling {@link KeyClient#getKey(String)}, with the latest version being retrieved. - * @throws ResourceNotFoundException when a key with {@code name} and {@code version} doesn't exist in the key vault. + * @param version The version of the key to retrieve. If this is an empty String or null, this call is + * equivalent to calling {@link KeyClient#getKey(String)}, with the latest version being retrieved. + * @return A {@link Response} whose {@link Response#getValue() value} contains the requested {@link Key key}. + * @throws ResourceNotFoundException when a key with {@code name} and {@code version} doesn't exist in the key + * vault. * @throws HttpRequestException if {@code name} or {@code version} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the requested {@link Key key}. */ public Response getKeyWithResponse(String name, String version, Context context) { return client.getKeyWithResponse(name, version, context).block(); } /** - * Get the public part of the latest version of the specified key from the key vault. The get key operation is applicable - * to all key types and it requires the {@code keys/get} permission. + * Get the public part of the latest version of the specified key from the key vault. The get key operation is + * applicable to all key types and it requires the {@code keys/get} permission. * *

Code Samples

*

Gets the latest version of the key in the key vault. Prints out the details of the returned key.

* {@codesnippet com.azure.keyvault.keys.keyclient.getKey#string} * * @param name The name of the key. + * @return The requested {@link Key key}. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException if {@code name} is empty string. - * @return The requested {@link Key key}. */ public Key getKey(String name) { - return getKeyWithResponse(name, "", Context.NONE).value(); + return getKeyWithResponse(name, "", Context.NONE).getValue(); } /** - * Get public part of the key which represents {@link KeyBase keyBase} from the key vault. The get key operation is applicable - * to all key types and it requires the {@code keys/get} permission. + * Get public part of the key which represents {@link KeyBase keyBase} from the key vault. The get key operation is + * applicable to all key types and it requires the {@code keys/get} permission. * *

The list operations {@link KeyClient#listKeys()} and {@link KeyClient#listKeyVersions(String)} return - * the {@link List} containing {@link KeyBase base key} as output excluding the key material of the key. - * This operation can then be used to get the full key with its key material from {@code keyBase}.

+ * the {@link List} containing {@link KeyBase base key} as output excluding the key material of the key. This + * operation can then be used to get the full key with its key material from {@code keyBase}.

* {@codesnippet com.azure.keyvault.keys.keyclient.getKey#KeyBase} * * @param keyBase The {@link KeyBase base key} holding attributes of the key being requested. - * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() version} doesn't exist in the key vault. - * @throws HttpRequestException if {@link KeyBase#name()} name} or {@link KeyBase#version() version} is empty string. * @return The requested {@link Key key}. + * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() + * version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link KeyBase#name()} name} or {@link KeyBase#version() version} is empty + * string. */ public Key getKey(KeyBase keyBase) { - return getKeyWithResponse(keyBase, Context.NONE).value(); + return getKeyWithResponse(keyBase, Context.NONE).getValue(); } /** - * Get public part of the key which represents {@link KeyBase keyBase} from the key vault. The get key operation is applicable - * to all key types and it requires the {@code keys/get} permission. + * Get public part of the key which represents {@link KeyBase keyBase} from the key vault. The get key operation is + * applicable to all key types and it requires the {@code keys/get} permission. * *

The list operations {@link KeyClient#listKeys()} and {@link KeyClient#listKeyVersions(String)} return - * the {@link List} containing {@link KeyBase base key} as output excluding the key material of the key. - * This operation can then be used to get the full key with its key material from {@code keyBase}.

+ * the {@link List} containing {@link KeyBase base key} as output excluding the key material of the key. This + * operation can then be used to get the full key with its key material from {@code keyBase}.

* {@codesnippet com.azure.keyvault.keys.keyclient.getKeyWithResponse#KeyBase-Context} * * @param keyBase The {@link KeyBase base key} holding attributes of the key being requested. * @param context Additional context that is passed through the Http pipeline during the service call. - * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() version} doesn't exist in the key vault. - * @throws HttpRequestException if {@link KeyBase#name()} name} or {@link KeyBase#version() version} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the requested {@link Key key}. + * @return A {@link Response} whose {@link Response#getValue() value} contains the requested {@link Key key}. + * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() + * version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link KeyBase#name()} name} or {@link KeyBase#version() version} is empty + * string. */ public Response getKeyWithResponse(KeyBase keyBase, Context context) { Objects.requireNonNull(keyBase, "The Key Base parameter cannot be null."); - return client.getKeyWithResponse(keyBase.name(), keyBase.version() == null ? "" : keyBase.version(), context).block(); + return client + .getKeyWithResponse(keyBase.name(), keyBase.version() == null ? "" : keyBase.version(), context).block(); } /** - * Updates the attributes associated with the specified key, but not the cryptographic key material of the specified key in the key vault. The update - * operation changes specified attributes of an existing stored key and attributes that are not specified in the request are left unchanged. - * The cryptographic key material of a key itself cannot be changed. This operation requires the {@code keys/set} permission. + * Updates the attributes associated with the specified key, but not the cryptographic key material of the specified + * key in the key vault. The update operation changes specified attributes of an existing stored key and attributes + * that are not specified in the request are left unchanged. The cryptographic key material of a key itself cannot + * be changed. This operation requires the {@code keys/set} permission. * *

Code Samples

*

Gets the latest version of the key, changes its expiry time and the updates the key in the key vault.

* {@codesnippet com.azure.keyvault.keys.keyclient.updateKey#KeyBase} * * @param key The {@link KeyBase base key} object with updated properties. - * @throws NullPointerException if {@code key} is {@code null}. - * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() version} doesn't exist in the key vault. - * @throws HttpRequestException if {@link KeyBase#name() name} or {@link KeyBase#version() version} is empty string. * @return The {@link KeyBase updated key}. + * @throws NullPointerException if {@code key} is {@code null}. + * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() + * version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link KeyBase#name() name} or {@link KeyBase#version() version} is empty + * string. */ public Key updateKey(KeyBase key) { - return client.updateKeyWithResponse(key, Context.NONE).block().value(); + return client.updateKeyWithResponse(key, Context.NONE).block().getValue(); } /** - * Updates the attributes and key operations associated with the specified key, but not the cryptographic key material of the specified key in the key vault. The update - * operation changes specified attributes of an existing stored key and attributes that are not specified in the request are left unchanged. - * The cryptographic key material of a key itself cannot be changed. This operation requires the {@code keys/set} permission. + * Updates the attributes and key operations associated with the specified key, but not the cryptographic key + * material of the specified key in the key vault. The update operation changes specified attributes of an existing + * stored key and attributes that are not specified in the request are left unchanged. The cryptographic key + * material of a key itself cannot be changed. This operation requires the {@code keys/set} permission. * *

Code Samples

- *

Gets the latest version of the key, changes its expiry time and key operations and the updates the key in the key vault.

+ *

Gets the latest version of the key, changes its expiry time and key operations and the updates the key in the + * key vault.

* {@codesnippet com.azure.keyvault.keys.keyclient.updateKey#KeyBase-keyOperations} * * @param key The {@link KeyBase base key} object with updated properties. * @param keyOperations The updated key operations to associate with the key. + * @return A {@link Response} whose {@link Response#getValue() value} contains the {@link KeyBase updated key}. * @throws NullPointerException if {@code key} is {@code null}. - * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() version} doesn't exist in the key vault. - * @throws HttpRequestException if {@link KeyBase#name() name} or {@link KeyBase#version() version} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the {@link KeyBase updated key}. + * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() + * version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link KeyBase#name() name} or {@link KeyBase#version() version} is empty + * string. */ public Key updateKey(KeyBase key, KeyOperation... keyOperations) { - return updateKeyWithResponse(key, Context.NONE, keyOperations).value(); + return updateKeyWithResponse(key, Context.NONE, keyOperations).getValue(); } /** - * Updates the attributes and key operations associated with the specified key, but not the cryptographic key material of the specified key in the key vault. The update - * operation changes specified attributes of an existing stored key and attributes that are not specified in the request are left unchanged. - * The cryptographic key material of a key itself cannot be changed. This operation requires the {@code keys/set} permission. + * Updates the attributes and key operations associated with the specified key, but not the cryptographic key + * material of the specified key in the key vault. The update operation changes specified attributes of an existing + * stored key and attributes that are not specified in the request are left unchanged. The cryptographic key + * material of a key itself cannot be changed. This operation requires the {@code keys/set} permission. * *

Code Samples

- *

Gets the latest version of the key, changes its expiry time and key operations and the updates the key in the key vault.

+ *

Gets the latest version of the key, changes its expiry time and key operations and the updates the key in the + * key vault.

* {@codesnippet com.azure.keyvault.keys.keyclient.updateKeyWithResponse#KeyBase-keyOperations-Context} * * @param key The {@link KeyBase base key} object with updated properties. * @param context Additional context that is passed through the Http pipeline during the service call. * @param keyOperations The updated key operations to associate with the key. + * @return A {@link Response} whose {@link Response#getValue() value} contains the {@link KeyBase updated key}. * @throws NullPointerException if {@code key} is {@code null}. - * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() version} doesn't exist in the key vault. - * @throws HttpRequestException if {@link KeyBase#name() name} or {@link KeyBase#version() version} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the {@link KeyBase updated key}. + * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() + * version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link KeyBase#name() name} or {@link KeyBase#version() version} is empty + * string. */ - public Response updateKeyWithResponse(KeyBase key, Context context, KeyOperation... keyOperations) { + public Response updateKeyWithResponse(KeyBase key, Context context, KeyOperation... keyOperations) { return client.updateKeyWithResponse(key, context, keyOperations).block(); } /** - * Deletes a key of any type from the key vault. If soft-delete is enabled on the key vault then the key is placed in the deleted state - * and requires to be purged for permanent deletion else the key is permanently deleted. The delete operation applies to any key stored - * in Azure Key Vault but it cannot be applied to an individual version of a key. This operation removes the cryptographic material - * associated with the key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. This operation - * requires the {@code keys/delete} permission. + * Deletes a key of any type from the key vault. If soft-delete is enabled on the key vault then the key is placed + * in the deleted state and requires to be purged for permanent deletion else the key is permanently deleted. The + * delete operation applies to any key stored in Azure Key Vault but it cannot be applied to an individual version + * of a key. This operation removes the cryptographic material associated with the key, which means the key is not + * usable for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. This operation requires the {@code + * keys/delete} permission. * *

Code Samples

- *

Deletes the key from the keyvault. Prints out the recovery id of the deleted key returned in the response.

+ *

Deletes the key from the keyvault. Prints out the recovery id of the deleted key returned in the + * response.

* {@codesnippet com.azure.keyvault.keys.keyclient.deleteKey#string} * * @param name The name of the key to be deleted. + * @return The {@link DeletedKey deleted key}. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. - * @return The {@link DeletedKey deleted key}. */ public DeletedKey deleteKey(String name) { - return deleteKeyWithResponse(name, Context.NONE).value(); + return deleteKeyWithResponse(name, Context.NONE).getValue(); } /** - * Deletes a key of any type from the key vault. If soft-delete is enabled on the key vault then the key is placed in the deleted state - * and requires to be purged for permanent deletion else the key is permanently deleted. The delete operation applies to any key stored - * in Azure Key Vault but it cannot be applied to an individual version of a key. This operation removes the cryptographic material - * associated with the key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. This operation - * requires the {@code keys/delete} permission. + * Deletes a key of any type from the key vault. If soft-delete is enabled on the key vault then the key is placed + * in the deleted state and requires to be purged for permanent deletion else the key is permanently deleted. The + * delete operation applies to any key stored in Azure Key Vault but it cannot be applied to an individual version + * of a key. This operation removes the cryptographic material associated with the key, which means the key is not + * usable for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. This operation requires the {@code + * keys/delete} permission. * *

Code Samples

- *

Deletes the key from the keyvault. Prints out the recovery id of the deleted key returned in the response.

+ *

Deletes the key from the keyvault. Prints out the recovery id of the deleted key returned in the + * response.

* {@codesnippet com.azure.keyvault.keys.keyclient.deleteKeyWithResponse#string-Context} * * @param name The name of the key to be deleted. * @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 {@link DeletedKey deleted key}. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the {@link DeletedKey deleted key}. */ public Response deleteKeyWithResponse(String name, Context context) { return client.deleteKeyWithResponse(name, context).block(); } /** - * Gets the public part of a deleted key. The Get Deleted Key operation is applicable for soft-delete enabled vaults. This operation - * requires the {@code keys/get} permission. + * Gets the public part of a deleted key. The Get Deleted Key operation is applicable for soft-delete enabled + * vaults. This operation requires the {@code keys/get} permission. * *

Code Samples

*

Gets the deleted key from the key vault enabled for soft-delete. Prints out the details of the deleted key * returned in the response.

* //Assuming key is deleted on a soft-delete enabled key vault. * {@codesnippet com.azure.keyvault.keys.keyclient.getDeletedKey#string} - * * * @param name The name of the deleted key. + * @return The {@link DeletedKey deleted key}. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. - * @return The {@link DeletedKey deleted key}. */ public DeletedKey getDeletedKey(String name) { - return getDeletedKeyWithResponse(name, Context.NONE).value(); + return getDeletedKeyWithResponse(name, Context.NONE).getValue(); } /** - * Gets the public part of a deleted key. The Get Deleted Key operation is applicable for soft-delete enabled vaults. This operation - * requires the {@code keys/get} permission. + * Gets the public part of a deleted key. The Get Deleted Key operation is applicable for soft-delete enabled + * vaults. This operation requires the {@code keys/get} permission. * *

Code Samples

*

Gets the deleted key from the key vault enabled for soft-delete. Prints out the details of the deleted key @@ -526,55 +579,57 @@ public DeletedKey getDeletedKey(String name) { * * @param name The name of the deleted key. * @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 {@link DeletedKey deleted key}. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the {@link DeletedKey deleted key}. */ public Response getDeletedKeyWithResponse(String name, Context context) { return client.getDeletedKeyWithResponse(name, context).block(); } /** - * Permanently deletes the specified key without the possibility of recovery. The Purge Deleted Key operation is applicable for - * soft-delete enabled vaults. This operation requires the {@code keys/purge} permission. + * Permanently deletes the specified key without the possibility of recovery. The Purge Deleted Key operation is + * applicable for soft-delete enabled vaults. This operation requires the {@code keys/purge} permission. * *

Code Samples

- *

Purges the deleted key from the key vault enabled for soft-delete. Prints out the status code from the server response.

+ *

Purges the deleted key from the key vault enabled for soft-delete. Prints out the status code from the server + * response.

* //Assuming key is deleted on a soft-delete enabled key vault. * {@codesnippet com.azure.keyvault.keys.keyclient.purgeDeletedKey#string} * * @param name The name of the deleted key. + * @return A {@link VoidResponse}. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. - * @return A {@link VoidResponse}. */ public VoidResponse purgeDeletedKey(String name) { return purgeDeletedKey(name, Context.NONE); } /** - * Permanently deletes the specified key without the possibility of recovery. The Purge Deleted Key operation is applicable for - * soft-delete enabled vaults. This operation requires the {@code keys/purge} permission. + * Permanently deletes the specified key without the possibility of recovery. The Purge Deleted Key operation is + * applicable for soft-delete enabled vaults. This operation requires the {@code keys/purge} permission. * *

Code Samples

- *

Purges the deleted key from the key vault enabled for soft-delete. Prints out the status code from the server response.

+ *

Purges the deleted key from the key vault enabled for soft-delete. Prints out the status code from the server + * response.

* //Assuming key is deleted on a soft-delete enabled key vault. * {@codesnippet com.azure.keyvault.keys.keyclient.purgeDeletedKey#string-Context} * * @param name The name of the deleted key. * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A {@link VoidResponse}. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. - * @return A {@link VoidResponse}. */ public VoidResponse purgeDeletedKey(String name, Context context) { return client.purgeDeletedKey(name, context).block(); } /** - * Recovers the deleted key in the key vault to its latest version and can only be performed on a soft-delete enabled vault. An attempt - * to recover an non-deleted key will return an error. Consider this the inverse of the delete operation on soft-delete enabled vaults. - * This operation requires the {@code keys/recover} permission. + * Recovers the deleted key in the key vault to its latest version and can only be performed on a soft-delete + * enabled vault. An attempt to recover an non-deleted key will return an error. Consider this the inverse of the + * delete operation on soft-delete enabled vaults. This operation requires the {@code keys/recover} permission. * *

Code Samples

*

Recovers the deleted key from the key vault enabled for soft-delete.

@@ -582,18 +637,18 @@ public VoidResponse purgeDeletedKey(String name, Context context) { * {@codesnippet com.azure.keyvault.keys.keyclient.recoverDeletedKey#string} * * @param name The name of the deleted key to be recovered. + * @return The {@link Key recovered key}. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. - * @return The {@link Key recovered key}. */ public Key recoverDeletedKey(String name) { - return recoverDeletedKeyWithResponse(name, Context.NONE).value(); + return recoverDeletedKeyWithResponse(name, Context.NONE).getValue(); } /** - * Recovers the deleted key in the key vault to its latest version and can only be performed on a soft-delete enabled vault. An attempt - * to recover an non-deleted key will return an error. Consider this the inverse of the delete operation on soft-delete enabled vaults. - * This operation requires the {@code keys/recover} permission. + * Recovers the deleted key in the key vault to its latest version and can only be performed on a soft-delete + * enabled vault. An attempt to recover an non-deleted key will return an error. Consider this the inverse of the + * delete operation on soft-delete enabled vaults. This operation requires the {@code keys/recover} permission. * *

Code Samples

*

Recovers the deleted key from the key vault enabled for soft-delete.

@@ -602,118 +657,134 @@ public Key recoverDeletedKey(String name) { * * @param name The name of the deleted key to be recovered. * @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 {@link Key recovered key}. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the {@link Key recovered key}. */ public Response recoverDeletedKeyWithResponse(String name, Context context) { return client.recoverDeletedKeyWithResponse(name, context).block(); } /** - * Requests a backup of the specified key be downloaded to the client. The Key Backup operation exports a key from Azure Key - * Vault in a protected form. Note that this operation does not return key material in a form that can be used outside the Azure Key - * Vault system, the returned key material is either protected to a Azure Key Vault HSM or to Azure Key Vault itself. The intent - * of this operation is to allow a client to generate a key in one Azure Key Vault instance, backup the key, and then restore it - * into another Azure Key Vault instance. The backup operation may be used to export, in protected form, any key type from Azure - * Key Vault. Individual versions of a key cannot be backed up. Backup / Restore can be performed within geographical boundaries only; - * meaning that a backup from one geographical area cannot be restored to another geographical area. For example, a backup - * from the US geographical area cannot be restored in an EU geographical area. This operation requires the {@code key/backup} permission. + * Requests a backup of the specified key be downloaded to the client. The Key Backup operation exports a key from + * Azure Key Vault in a protected form. Note that this operation does not return key material in a form that can be + * used outside the Azure Key Vault system, the returned key material is either protected to a Azure Key Vault HSM + * or to Azure Key Vault itself. The intent of this operation is to allow a client to generate a key in one Azure + * Key Vault instance, backup the key, and then restore it into another Azure Key Vault instance. The backup + * operation may be used to export, in protected form, any key type from Azure Key Vault. Individual versions of a + * key cannot be backed up. Backup / Restore can be performed within geographical boundaries only; meaning that a + * backup from one geographical area cannot be restored to another geographical area. For example, a backup from the + * US geographical area cannot be restored in an EU geographical area. This operation requires the {@code + * key/backup} permission. * *

Code Samples

- *

Backs up the key from the key vault and prints out the length of the key's backup byte array returned in the response

+ *

Backs up the key from the key vault and prints out the length of the key's backup byte array returned in the + * response

* {@codesnippet com.azure.keyvault.keys.keyclient.backupKey#string} * * @param name The name of the key. + * @return The backed up key blob. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. - * @return The backed up key blob. */ public byte[] backupKey(String name) { - return backupKeyWithResponse(name, Context.NONE).value(); + return backupKeyWithResponse(name, Context.NONE).getValue(); } /** - * Requests a backup of the specified key be downloaded to the client. The Key Backup operation exports a key from Azure Key - * Vault in a protected form. Note that this operation does not return key material in a form that can be used outside the Azure Key - * Vault system, the returned key material is either protected to a Azure Key Vault HSM or to Azure Key Vault itself. The intent - * of this operation is to allow a client to generate a key in one Azure Key Vault instance, backup the key, and then restore it - * into another Azure Key Vault instance. The backup operation may be used to export, in protected form, any key type from Azure - * Key Vault. Individual versions of a key cannot be backed up. Backup / Restore can be performed within geographical boundaries only; - * meaning that a backup from one geographical area cannot be restored to another geographical area. For example, a backup - * from the US geographical area cannot be restored in an EU geographical area. This operation requires the {@code key/backup} permission. + * Requests a backup of the specified key be downloaded to the client. The Key Backup operation exports a key from + * Azure Key Vault in a protected form. Note that this operation does not return key material in a form that can be + * used outside the Azure Key Vault system, the returned key material is either protected to a Azure Key Vault HSM + * or to Azure Key Vault itself. The intent of this operation is to allow a client to generate a key in one Azure + * Key Vault instance, backup the key, and then restore it into another Azure Key Vault instance. The backup + * operation may be used to export, in protected form, any key type from Azure Key Vault. Individual versions of a + * key cannot be backed up. Backup / Restore can be performed within geographical boundaries only; meaning that a + * backup from one geographical area cannot be restored to another geographical area. For example, a backup from the + * US geographical area cannot be restored in an EU geographical area. This operation requires the {@code + * key/backup} permission. * *

Code Samples

- *

Backs up the key from the key vault and prints out the length of the key's backup byte array returned in the response

+ *

Backs up the key from the key vault and prints out the length of the key's backup byte array returned in the + * response

* {@codesnippet com.azure.keyvault.keys.keyclient.backupKeyWithResponse#string-Context} * * @param name The name of the key. * @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 backed up key blob. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the backed up key blob. */ public Response backupKeyWithResponse(String name, Context context) { return client.backupKeyWithResponse(name, context).block(); } /** - * Restores a backed up key to a vault. Imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, - * attributes and access control policies. The restore operation may be used to import a previously backed up key. Individual versions of a - * key cannot be restored. The key is restored in its entirety with the same key name as it had when it was backed up. If the key name is not - * available in the target Key Vault, the restore operation will be rejected. While the key name is retained during restore, the final key identifier - * will change if the key is restored to a different vault. Restore will restore all versions and preserve version identifiers. The restore operation is subject - * to security constraints: The target Key Vault must be owned by the same Microsoft Azure Subscription as the source Key Vault The user must have restore permission in - * the target Key Vault. This operation requires the {@code keys/restore} permission. + * Restores a backed up key to a vault. Imports a previously backed up key into Azure Key Vault, restoring the key, + * its key identifier, attributes and access control policies. The restore operation may be used to import a + * previously backed up key. Individual versions of a key cannot be restored. The key is restored in its entirety + * with the same key name as it had when it was backed up. If the key name is not available in the target Key Vault, + * the restore operation will be rejected. While the key name is retained during restore, the final key identifier + * will change if the key is restored to a different vault. Restore will restore all versions and preserve version + * identifiers. The restore operation is subject to security constraints: The target Key Vault must be owned by the + * same Microsoft Azure Subscription as the source Key Vault The user must have restore permission in the target Key + * Vault. This operation requires the {@code keys/restore} permission. * *

Code Samples

- *

Restores the key in the key vault from its backup. Prints out the details of the restored key returned in the response.

+ *

Restores the key in the key vault from its backup. Prints out the details of the restored key returned in the + * response.

* //Pass the Key Backup Byte array to the restore operation. * {@codesnippet com.azure.keyvault.keys.keyclient.restoreKey#byte} * * @param backup The backup blob associated with the key. - * @throws ResourceModifiedException when {@code backup} blob is malformed. * @return The {@link Key restored key}. + * @throws ResourceModifiedException when {@code backup} blob is malformed. */ public Key restoreKey(byte[] backup) { - return restoreKeyWithResponse(backup, Context.NONE).value(); + return restoreKeyWithResponse(backup, Context.NONE).getValue(); } /** - * Restores a backed up key to a vault. Imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, - * attributes and access control policies. The restore operation may be used to import a previously backed up key. Individual versions of a - * key cannot be restored. The key is restored in its entirety with the same key name as it had when it was backed up. If the key name is not - * available in the target Key Vault, the restore operation will be rejected. While the key name is retained during restore, the final key identifier - * will change if the key is restored to a different vault. Restore will restore all versions and preserve version identifiers. The restore operation is subject - * to security constraints: The target Key Vault must be owned by the same Microsoft Azure Subscription as the source Key Vault The user must have restore permission in - * the target Key Vault. This operation requires the {@code keys/restore} permission. + * Restores a backed up key to a vault. Imports a previously backed up key into Azure Key Vault, restoring the key, + * its key identifier, attributes and access control policies. The restore operation may be used to import a + * previously backed up key. Individual versions of a key cannot be restored. The key is restored in its entirety + * with the same key name as it had when it was backed up. If the key name is not available in the target Key Vault, + * the restore operation will be rejected. While the key name is retained during restore, the final key identifier + * will change if the key is restored to a different vault. Restore will restore all versions and preserve version + * identifiers. The restore operation is subject to security constraints: The target Key Vault must be owned by the + * same Microsoft Azure Subscription as the source Key Vault The user must have restore permission in the target Key + * Vault. This operation requires the {@code keys/restore} permission. * *

Code Samples

- *

Restores the key in the key vault from its backup. Prints out the details of the restored key returned in the response.

+ *

Restores the key in the key vault from its backup. Prints out the details of the restored key returned in the + * response.

* //Pass the Key Backup Byte array to the restore operation. * {@codesnippet com.azure.keyvault.keys.keyclient.restoreKeyWithResponse#byte-Context} * * @param backup The backup blob associated with the key. * @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 {@link Key restored key}. * @throws ResourceModifiedException when {@code backup} blob is malformed. - * @return A {@link Response} whose {@link Response#value() value} contains the {@link Key restored key}. */ public Response restoreKeyWithResponse(byte[] backup, Context context) { return client.restoreKeyWithResponse(backup, context).block(); } /** - * List keys in the key vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public - * part of a stored key. The List operation is applicable to all key types and the individual key response in the list is represented by {@link KeyBase} as only the base key identifier, - * attributes and tags are provided in the response. The key material and individual key versions are not listed in the response. This operation requires the {@code keys/list} permission. + * List keys in the key vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain + * the public part of a stored key. The List operation is applicable to all key types and the individual key + * response in the list is represented by {@link KeyBase} as only the base key identifier, attributes and tags are + * provided in the response. The key material and individual key versions are not listed in the response. This + * operation requires the {@code keys/list} permission. * - *

It is possible to get full keys with key material from this information. Loop over the {@link KeyBase key} and - * call {@link KeyClient#getKey(KeyBase baseKey)} . This will return the {@link Key key} with key material included of its latest version.

+ *

It is possible to get full keys with key material from this information. Loop over the {@link KeyBase key} + * and call {@link KeyClient#getKey(KeyBase baseKey)}. This will return the {@link Key key} with key material + * included of its latest version.

* {@codesnippet com.azure.keyvault.keys.keyclient.listKeys} * *

Code Samples to iterate keys by page

- *

It is possible to get full keys with key material from this information. Iterate over all the {@link KeyBase key} by page and - * call {@link KeyClient#getKey(KeyBase baseKey)} . This will return the {@link Key key} with key material included of its latest version.

+ *

It is possible to get full keys with key material from this information. Iterate over all the {@link KeyBase + * key} by page and call {@link KeyClient#getKey(KeyBase baseKey)}. This will return the {@link Key key} with key + * material included of its latest version.

* {@codesnippet com.azure.keyvault.keys.keyclient.listKeys.iterableByPage} * * @return {@link PagedIterable} of {@link KeyBase key} of all the keys in the vault. @@ -723,24 +794,28 @@ public PagedIterable listKeys() { } /** - * List keys in the key vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public - * part of a stored key. The List operation is applicable to all key types and the individual key response in the list is represented by {@link KeyBase} as only the base key identifier, - * attributes and tags are provided in the response. The key material and individual key versions are not listed in the response. This operation requires the {@code keys/list} permission. + * List keys in the key vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain + * the public part of a stored key. The List operation is applicable to all key types and the individual key + * response in the list is represented by {@link KeyBase} as only the base key identifier, attributes and tags are + * provided in the response. The key material and individual key versions are not listed in the response. This + * operation requires the {@code keys/list} permission. * - *

It is possible to get full keys with key material from this information. Loop over the {@link KeyBase key} and - * call {@link KeyClient#getKey(KeyBase baseKey)} . This will return the {@link Key key} with key material included of its latest version.

+ *

It is possible to get full keys with key material from this information. Loop over the {@link KeyBase key} + * and call {@link KeyClient#getKey(KeyBase baseKey)}. This will return the {@link Key key} with key material + * included of its latest version.

* {@codesnippet com.azure.keyvault.keys.keyclient.listKeys#Context} * *

Code Samples to iterate keys by page

- *

It is possible to get full keys with key material from this information. Iterate over all the {@link KeyBase key} by page and - * call {@link KeyClient#getKey(KeyBase baseKey)} . This will return the {@link Key key} with key material included of its latest version.

+ *

It is possible to get full keys with key material from this information. Iterate over all the {@link KeyBase + * key} by page and call {@link KeyClient#getKey(KeyBase baseKey)}. This will return the {@link Key key} with key + * material included of its latest version.

* {@codesnippet com.azure.keyvault.keys.keyclient.listKeys.iterableByPage} * * @param context Additional context that is passed through the Http pipeline during the service call. * @return {@link PagedIterable} of {@link KeyBase key} of all the keys in the vault. */ public PagedIterable listKeys(Context context) { - return new PagedIterable<>(client.listKeys(context)); + return new PagedIterable<>(client.listKeys(context)); } /** @@ -753,7 +828,8 @@ public PagedIterable listKeys(Context context) { * {@codesnippet com.azure.keyvault.keys.keyclient.listDeletedKeys} * *

Code Samples to iterate over deleted keys by page

- *

Iterate over the lists the deleted keys by each page in the key vault and for each deleted key prints out its recovery id.

+ *

Iterate over the lists the deleted keys by each page in the key vault and for each deleted key prints out its + * recovery id.

* {@codesnippet com.azure.keyvault.keys.keyclient.listDeletedKeys.iterableByPage} * * @return {@link PagedIterable} of all of the {@link DeletedKey deleted keys} in the vault. @@ -772,7 +848,8 @@ public PagedIterable listDeletedKeys() { * {@codesnippet com.azure.keyvault.keys.keyclient.listDeletedKeys#Context} * *

Code Samples to iterate over deleted keys by page

- *

Iterate over the lists the deleted keys by each page in the key vault and for each deleted key prints out its recovery id.

+ *

Iterate over the lists the deleted keys by each page in the key vault and for each deleted key prints out its + * recovery id.

* {@codesnippet com.azure.keyvault.keys.keyclient.listDeletedKeys.iterableByPage} * * @param context Additional context that is passed through the Http pipeline during the service call. @@ -787,19 +864,22 @@ public PagedIterable listDeletedKeys(Context context) { * as only the base key identifier, attributes and tags are provided in the response. The key material values are * not provided in the response. This operation requires the {@code keys/list} permission. * - *

It is possible to get full keys with key material for each version from this information. Loop over the {@link KeyBase key} and - * call {@link KeyClient#getKey(KeyBase baseKey)} . This will return the {@link Key keys} with key material included of the specified versions.

+ *

It is possible to get full keys with key material for each version from this information. Loop over the + * {@link KeyBase key} and call {@link KeyClient#getKey(KeyBase baseKey)}. This will return the {@link Key keys} + * with key material included of the specified versions.

* {@codesnippet com.azure.keyvault.keys.keyclient.listKeyVersions} * *

Code Samples to iterate over key versions by page

- *

It is possible to get full keys with key material for each version from this information. Iterate over all the {@link KeyBase key} by page and - * call {@link KeyClient#getKey(KeyBase baseKey)} . This will return the {@link Key keys} with key material included of the specified versions.

+ *

It is possible to get full keys with key material for each version from this information. Iterate over all + * the {@link KeyBase key} by page and call {@link KeyClient#getKey(KeyBase baseKey)}. This will return the {@link + * Key keys} with key material included of the specified versions.

* {@codesnippet com.azure.keyvault.keys.keyclient.listKeyVersions.iterableByPage} * * @param name The name of the key. + * @return {@link PagedIterable} of {@link KeyBase key} of all the versions of the specified key in the vault. List + * is empty if key with {@code name} does not exist in key vault. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. - * @return {@link PagedIterable} of {@link KeyBase key} of all the versions of the specified key in the vault. List is empty if key with {@code name} does not exist in key vault. */ public PagedIterable listKeyVersions(String name) { return listKeyVersions(name, Context.NONE); @@ -810,20 +890,24 @@ public PagedIterable listKeyVersions(String name) { * as only the base key identifier, attributes and tags are provided in the response. The key material values are * not provided in the response. This operation requires the {@code keys/list} permission. * - *

It is possible to get full keys with key material for each version from this information. Loop over the {@link KeyBase key} and - * call {@link KeyClient#getKey(KeyBase baseKey)} . This will return the {@link Key keys} with key material included of the specified versions.

+ *

It is possible to get full keys with key material for each version from this information. Loop over the + * {@link KeyBase key} and call {@link KeyClient#getKey(KeyBase baseKey)}. This will return the {@link Key keys} + * with key material included of the specified versions.

* {@codesnippet com.azure.keyvault.keys.keyclient.listKeyVersions} * *

Code Samples to iterate over key versions by page

- *

It is possible to get full keys with key material for each version from this information. Iterate over all the {@link KeyBase key} by page and - * call {@link KeyClient#getKey(KeyBase baseKey)} . This will return the {@link Key keys} with key material included of the specified versions.

+ *

It is possible to get full keys with key material for each version from this information. Iterate over all + * the {@link KeyBase key} by page and call {@link KeyClient#getKey(KeyBase baseKey)}. This will return the + * {@link Key keys} with key material included of the specified versions.

+ * * {@codesnippet com.azure.keyvault.keys.keyclient.listKeyVersions.iterableByPage} * * @param name The name of the key. * @param context Additional context that is passed through the Http pipeline during the service call. + * @return {@link PagedIterable} of {@link KeyBase key} of all the versions of the specified key in the vault. List + * is empty if key with {@code name} does not exist in key vault. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. - * @return {@link PagedIterable} of {@link KeyBase key} of all the versions of the specified key in the vault. List is empty if key with {@code name} does not exist in key vault. */ public PagedIterable listKeyVersions(String name, Context context) { return new PagedIterable<>(client.listKeyVersions(name, context)); diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClientBuilder.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClientBuilder.java index ad0ff55cc413..ad0821fdcf3c 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClientBuilder.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClientBuilder.java @@ -17,6 +17,7 @@ import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.util.configuration.ConfigurationManager; import com.azure.core.implementation.annotation.ServiceClientBuilder; +import com.azure.core.util.logging.ClientLogger; import com.azure.security.keyvault.keys.implementation.AzureKeyVaultConfiguration; import java.net.MalformedURLException; @@ -26,27 +27,29 @@ import java.util.Objects; /** - * This class provides a fluent builder API to help aid the configuration and instantiation of the {@link KeyAsyncClient secret async client} and {@link KeyClient secret sync client}, - * by calling {@link KeyClientBuilder#buildAsyncClient() buildAsyncClient} and {@link KeyClientBuilder#buildClient() buildClient} respectively - * It constructs an instance of the desired client. + * This class provides a fluent builder API to help aid the configuration and instantiation of the {@link KeyAsyncClient + * secret async client} and {@link KeyClient secret sync client}, by calling + * {@link KeyClientBuilder#buildAsyncClient() buildAsyncClient} and {@link KeyClientBuilder#buildClient() buildClient} + * respectively. It constructs an instance of the desired client. * - *

The minimal configuration options required by {@link KeyClientBuilder} to build {@link KeyAsyncClient} - * are {@link String endpoint} and {@link TokenCredential credential}.

+ *

The minimal configuration options required by {@link KeyClientBuilder} to build {@link KeyAsyncClient} are + * {@link String endpoint} and {@link TokenCredential credential}.

* * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.instantiation} * *

The {@link HttpLogDetailLevel log detail level}, multiple custom {@link HttpLoggingPolicy policies} and custom * {@link HttpClient http client} can be optionally configured in the {@link KeyClientBuilder}.

- + * * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.withhttpclient.instantiation} * - *

Alternatively, custom {@link HttpPipeline http pipeline} with custom {@link HttpPipelinePolicy} policies and {@link String endpoint} - * can be specified. It provides finer control over the construction of {@link KeyAsyncClient} and {@link KeyClient}

+ *

Alternatively, custom {@link HttpPipeline http pipeline} with custom {@link HttpPipelinePolicy} policies and + * {@link String endpoint} can be specified. It provides finer control over the construction of {@link KeyAsyncClient} + * and {@link KeyClient}

* * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.pipeline.instantiation} * - *

The minimal configuration options required by {@link KeyClientBuilder secretClientBuilder} to build {@link KeyClient} - * are {@link String endpoint} and {@link TokenCredential credential}.

+ *

The minimal configuration options required by {@link KeyClientBuilder secretClientBuilder} to build {@link + * KeyClient} are {@link String endpoint} and {@link TokenCredential credential}.

* * {@codesnippet com.azure.security.keyvault.keys.keyclient.instantiation} * @@ -55,13 +58,15 @@ */ @ServiceClientBuilder(serviceClients = KeyClient.class) public final class KeyClientBuilder { + private final ClientLogger logger = new ClientLogger(KeyClientBuilder.class); + private final List policies; private TokenCredential credential; private HttpPipeline pipeline; private URL endpoint; private HttpClient httpClient; private HttpLogDetailLevel httpLogDetailLevel; - private RetryPolicy retryPolicy; + private final RetryPolicy retryPolicy; private Configuration configuration; /** @@ -78,39 +83,42 @@ public KeyClientBuilder() { * Every time {@code buildClient()} is called, a new instance of {@link KeyClient} is created. * *

If {@link KeyClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and - * {@link KeyClientBuilder#endpoint(String) serviceEndpoint} are used to create the - * {@link KeyClientBuilder client}. All other builder settings are ignored. If {@code pipeline} is not set, - * then {@link KeyClientBuilder#credential(TokenCredential) key vault credential} and - * {@link KeyClientBuilder#endpoint(String) key vault endpoint} are required to build the {@link KeyClient client}.

+ * {@link KeyClientBuilder#endpoint(String) serviceEndpoint} are used to create the {@link KeyClientBuilder client}. + * All other builder settings are ignored. If {@code pipeline} is not set, then {@link + * KeyClientBuilder#credential(TokenCredential) key vault credential} and {@link + * KeyClientBuilder#endpoint(String) key vault endpoint} are required to build the {@link KeyClient client}.

* * @return A {@link KeyClient} with the options set from the builder. * @throws IllegalStateException If {@link KeyClientBuilder#credential(TokenCredential)} or - * {@link KeyClientBuilder#endpoint(String)} have not been set. + * {@link KeyClientBuilder#endpoint(String)} have not been set. */ public KeyClient buildClient() { return new KeyClient(buildAsyncClient()); } - + /** * Creates a {@link KeyAsyncClient} based on options set in the builder. * Every time {@code buildAsyncClient()} is called, a new instance of {@link KeyAsyncClient} is created. * *

If {@link KeyClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and - * {@link KeyClientBuilder#endpoint(String) serviceEndpoint} are used to create the - * {@link KeyClientBuilder client}. All other builder settings are ignored. If {@code pipeline} is not set, - * then {@link KeyClientBuilder#credential(TokenCredential) key vault credential and - * {@link KeyClientBuilder#endpoint(String)} key vault endpoint are required to build the {@link KeyAsyncClient client}.}

+ * {@link KeyClientBuilder#endpoint(String) serviceEndpoint} are used to create the {@link KeyClientBuilder client}. + * All other builder settings are ignored. If {@code pipeline} is not set, then {@link + * KeyClientBuilder#credential(TokenCredential) key vault credential and {@link KeyClientBuilder#endpoint(String)} + * key vault endpoint are required to build the {@link KeyAsyncClient client}.}

* * @return A {@link KeyAsyncClient} with the options set from the builder. * @throws IllegalStateException If {@link KeyClientBuilder#credential(TokenCredential)} or - * {@link KeyClientBuilder#endpoint(String)} have not been set. + * {@link KeyClientBuilder#endpoint(String)} have not been set. */ public KeyAsyncClient buildAsyncClient() { - Configuration buildConfiguration = (configuration == null) ? ConfigurationManager.getConfiguration().clone() : configuration; + Configuration buildConfiguration = + (configuration == null) ? ConfigurationManager.getConfiguration().clone() : configuration; URL buildEndpoint = getBuildEndpoint(buildConfiguration); if (buildEndpoint == null) { - throw new IllegalStateException(KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.VAULT_END_POINT_REQUIRED)); + throw logger + .logExceptionAsError(new IllegalStateException(KeyVaultErrorCodeStrings + .getErrorString(KeyVaultErrorCodeStrings.VAULT_END_POINT_REQUIRED))); } if (pipeline != null) { @@ -118,12 +126,15 @@ public KeyAsyncClient buildAsyncClient() { } if (credential == null) { - throw new IllegalStateException(KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.CREDENTIAL_REQUIRED)); + throw logger.logExceptionAsError( + new IllegalStateException(KeyVaultErrorCodeStrings + .getErrorString(KeyVaultErrorCodeStrings.CREDENTIAL_REQUIRED))); } // Closest to API goes first, closest to wire goes last. final List policies = new ArrayList<>(); - policies.add(new UserAgentPolicy(AzureKeyVaultConfiguration.SDK_NAME, AzureKeyVaultConfiguration.SDK_VERSION, buildConfiguration)); + policies.add(new UserAgentPolicy(AzureKeyVaultConfiguration.SDK_NAME, AzureKeyVaultConfiguration.SDK_VERSION, + buildConfiguration)); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new KeyVaultCredentialPolicy(credential)); @@ -132,9 +143,9 @@ public KeyAsyncClient buildAsyncClient() { policies.add(new HttpLoggingPolicy(httpLogDetailLevel)); HttpPipeline pipeline = new HttpPipelineBuilder() - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .build(); + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .build(); return new KeyAsyncClient(endpoint, pipeline); } @@ -150,7 +161,8 @@ public KeyClientBuilder endpoint(String endpoint) { try { this.endpoint = new URL(endpoint); } catch (MalformedURLException e) { - throw new IllegalArgumentException("The Azure Key Vault endpoint url is malformed."); + throw logger.logExceptionAsError(new IllegalArgumentException( + "The Azure Key Vault endpoint url is malformed.")); } return this; } @@ -184,7 +196,8 @@ public KeyClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { } /** - * Adds a policy to the set of existing policies that are executed after {@link KeyAsyncClient} and {@link KeyClient} required policies. + * Adds a policy to the set of existing policies that are executed after {@link KeyAsyncClient} and {@link + * KeyClient} required policies. * * @param policy The {@link HttpPipelinePolicy policy} to be added. * @return the updated {@link KeyClientBuilder} object. diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyImportRequestParameters.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyImportRequestParameters.java index 54fc0fb6df28..8374a52dec92 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyImportRequestParameters.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyImportRequestParameters.java @@ -41,7 +41,7 @@ class KeyImportRequestParameters { * * @return the keyAttributes value */ - public KeyRequestAttributes keyAttributes() { + public KeyRequestAttributes getKeyAttributes() { return this.keyAttributes; } @@ -51,7 +51,7 @@ public KeyRequestAttributes keyAttributes() { * @param keyAttributes the keyAttributes value to set * @return the KeyRequestParameters object itself. */ - public KeyImportRequestParameters keyAttributes(KeyRequestAttributes keyAttributes) { + public KeyImportRequestParameters setKeyAttributes(KeyRequestAttributes keyAttributes) { this.keyAttributes = keyAttributes; return this; } @@ -61,7 +61,7 @@ public KeyImportRequestParameters keyAttributes(KeyRequestAttributes keyAttribut * * @return the tags value */ - public Map tags() { + public Map getTags() { return this.tags; } @@ -71,7 +71,7 @@ public Map tags() { * @param tags the tags value to set * @return the KeyRequestParameters object itself. */ - public KeyImportRequestParameters tags(Map tags) { + public KeyImportRequestParameters setTags(Map tags) { this.tags = tags; return this; } @@ -82,7 +82,7 @@ public KeyImportRequestParameters tags(Map tags) { * @param hsm the hsm value to set * @return the KeyImportParameters object itself. */ - public KeyImportRequestParameters hsm(Boolean hsm) { + public KeyImportRequestParameters setHsm(Boolean hsm) { this.hsm = hsm; return this; } @@ -92,7 +92,7 @@ public KeyImportRequestParameters hsm(Boolean hsm) { * * @return the hsm value */ - public Boolean hsm() { + public Boolean getHsm() { return this.hsm; } @@ -101,7 +101,7 @@ public Boolean hsm() { * * @return the key value */ - public JsonWebKey key() { + public JsonWebKey getKey() { return this.key; } @@ -111,7 +111,7 @@ public JsonWebKey key() { * @param key the key value to set * @return the KeyImportParameters object itself. */ - public KeyImportRequestParameters key(JsonWebKey key) { + public KeyImportRequestParameters setKey(JsonWebKey key) { this.key = key; return this; } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyRequestAttributes.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyRequestAttributes.java index 608c5c273100..9e95e0bc609c 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyRequestAttributes.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyRequestAttributes.java @@ -29,7 +29,8 @@ class KeyRequestAttributes { } /** - * Creates an instance of KeyRequestAttributes. Reads KeyCreateOptions.notBefore, KeyCreateOptions.expires and KeyCreateOptions.enabled fields + * Creates an instance of KeyRequestAttributes. Reads KeyCreateOptions.notBefore, KeyCreateOptions.expires and + * KeyCreateOptions.enabled fields * from {@code keyOptions} * @param keyOptions the {@link KeyCreateOptions} object with populated attributes */ @@ -78,7 +79,7 @@ class KeyRequestAttributes { * * @return the enabled value */ - public Boolean enabled() { + public Boolean isEnabled() { return this.enabled; } @@ -88,7 +89,7 @@ public Boolean enabled() { * @param enabled the enabled value to set * @return the Attributes object itself. */ - public KeyRequestAttributes enabled(Boolean enabled) { + public KeyRequestAttributes setEnabled(Boolean enabled) { this.enabled = enabled; return this; } @@ -98,7 +99,7 @@ public KeyRequestAttributes enabled(Boolean enabled) { * * @return the notBefore value */ - public OffsetDateTime notBefore() { + public OffsetDateTime getNotBefore() { if (this.notBefore == null) { return null; } @@ -111,7 +112,7 @@ public OffsetDateTime notBefore() { * @param notBefore the notBefore value to set * @return the Attributes object itself. */ - public KeyRequestAttributes notBefore(OffsetDateTime notBefore) { + public KeyRequestAttributes setNotBefore(OffsetDateTime notBefore) { if (notBefore == null) { this.notBefore = null; } else { @@ -125,7 +126,7 @@ public KeyRequestAttributes notBefore(OffsetDateTime notBefore) { * * @return the expires value */ - public OffsetDateTime expires() { + public OffsetDateTime getExpires() { if (this.expires == null) { return null; } @@ -138,7 +139,7 @@ public OffsetDateTime expires() { * @param expires the expires value to set * @return the Attributes object itself. */ - public KeyRequestAttributes expires(OffsetDateTime expires) { + public KeyRequestAttributes setExpires(OffsetDateTime expires) { if (expires == null) { this.expires = null; } else { @@ -152,7 +153,7 @@ public KeyRequestAttributes expires(OffsetDateTime expires) { * * @return the created value */ - public OffsetDateTime created() { + public OffsetDateTime getCreated() { if (this.created == null) { return null; } @@ -164,7 +165,7 @@ public OffsetDateTime created() { * * @return the updated value */ - public OffsetDateTime updated() { + public OffsetDateTime getUpdated() { if (this.updated == null) { return null; } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyRequestParameters.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyRequestParameters.java index d5dc965ef80c..6f4ad652ec4a 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyRequestParameters.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyRequestParameters.java @@ -57,7 +57,7 @@ class KeyRequestParameters { * * @return the keyType value */ - public KeyType kty() { + public KeyType getKty() { return this.kty; } @@ -67,7 +67,7 @@ public KeyType kty() { * @param kty the keyType value to set * @return the KeyRequestParameters object itself. */ - public KeyRequestParameters kty(KeyType kty) { + public KeyRequestParameters setKty(KeyType kty) { this.kty = kty; return this; } @@ -77,7 +77,7 @@ public KeyRequestParameters kty(KeyType kty) { * * @return the keySize value */ - public Integer keySize() { + public Integer getKeySize() { return this.keySize; } @@ -87,7 +87,7 @@ public Integer keySize() { * @param keySize the keySize value to set * @return the KeyRequestParameters object itself. */ - public KeyRequestParameters keySize(Integer keySize) { + public KeyRequestParameters setKeySize(Integer keySize) { this.keySize = keySize; return this; } @@ -97,7 +97,7 @@ public KeyRequestParameters keySize(Integer keySize) { * * @return the keyOps value */ - public List keyOps() { + public List getKeyOps() { return this.keyOps; } @@ -107,7 +107,7 @@ public List keyOps() { * @param keyOps the keyOps value to set * @return the KeyRequestParameters object itself. */ - public KeyRequestParameters keyOps(List keyOps) { + public KeyRequestParameters setKeyOps(List keyOps) { this.keyOps = keyOps; return this; } @@ -117,7 +117,7 @@ public KeyRequestParameters keyOps(List keyOps) { * * @return the keyAttributes value */ - public KeyRequestAttributes keyAttributes() { + public KeyRequestAttributes getKeyAttributes() { return this.keyAttributes; } @@ -127,7 +127,7 @@ public KeyRequestAttributes keyAttributes() { * @param keyAttributes the keyAttributes value to set * @return the KeyRequestParameters object itself. */ - public KeyRequestParameters keyAttributes(KeyRequestAttributes keyAttributes) { + public KeyRequestParameters setKeyAttributes(KeyRequestAttributes keyAttributes) { this.keyAttributes = keyAttributes; return this; } @@ -137,7 +137,7 @@ public KeyRequestParameters keyAttributes(KeyRequestAttributes keyAttributes) { * * @return the tags value */ - public Map tags() { + public Map getTags() { return this.tags; } @@ -147,7 +147,7 @@ public Map tags() { * @param tags the tags value to set * @return the KeyRequestParameters object itself. */ - public KeyRequestParameters tags(Map tags) { + public KeyRequestParameters setTags(Map tags) { this.tags = tags; return this; } @@ -157,7 +157,7 @@ public KeyRequestParameters tags(Map tags) { * * @return the curve value */ - public KeyCurveName curve() { + public KeyCurveName getCurve() { return this.curve; } @@ -167,7 +167,7 @@ public KeyCurveName curve() { * @param curve the curve value to set * @return the KeyRequestParameters object itself. */ - public KeyRequestParameters curve(KeyCurveName curve) { + public KeyRequestParameters setCurve(KeyCurveName curve) { this.curve = curve; return this; } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyRestoreRequestParameters.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyRestoreRequestParameters.java index b4bf22e11480..7550d4094321 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyRestoreRequestParameters.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyRestoreRequestParameters.java @@ -21,7 +21,7 @@ class KeyRestoreRequestParameters { * * @return the keyBundleBackup value */ - public byte[] keyBackup() { + public byte[] getKeyBackup() { if (this.keyBackup == null) { return new byte[0]; } @@ -34,7 +34,7 @@ public byte[] keyBackup() { * @param keyBackup The keyBundleBackup value to set * @return the KeyRestoreParameters object itself. */ - public KeyRestoreRequestParameters keyBackup(byte[] keyBackup) { + public KeyRestoreRequestParameters setKeyBackup(byte[] keyBackup) { if (keyBackup == null) { this.keyBackup = null; } else { diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyVaultCredentialPolicy.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyVaultCredentialPolicy.java index 4c81737628a1..9d609b1db9f3 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyVaultCredentialPolicy.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyVaultCredentialPolicy.java @@ -42,7 +42,8 @@ public KeyVaultCredentialPolicy(TokenCredential credential) { * Adds the required header to authenticate a request to Azure Key Vault service. * * @param context The request context - * @param next The next HTTP pipeline policy to process the {@code context's} request after this policy completes. + * @param next The next HTTP pipeline policy to process the {@code context's} request after this policy + * completes. * @return A {@link Mono} representing the HTTP response that will arrive asynchronously. */ @Override @@ -50,14 +51,14 @@ public Mono process(HttpPipelineCallContext context, HttpPipelineN return next.clone().process() // Ignore body .doOnNext(HttpResponse::close) - .map(res -> res.headerValue(WWW_AUTHENTICATE)) + .map(res -> res.getHeaderValue(WWW_AUTHENTICATE)) .map(header -> extractChallenge(header, BEARER_TOKEN_PREFIX)) .flatMap(map -> { - cache.scopes(map.get("resource") + "/.default"); + cache.setScopes(map.get("resource") + "/.default"); return cache.getToken(); }) .flatMap(token -> { - context.httpRequest().header(AUTHORIZATION, BEARER_TOKEN_PREFIX + token.token()); + context.getHttpRequest().setHeader(AUTHORIZATION, BEARER_TOKEN_PREFIX + token.getToken()); return next.process(); }); } @@ -73,7 +74,8 @@ private static Map extractChallenge(String authenticateHeader, S if (!isValidChallenge(authenticateHeader, authChallengePrefix)) { return null; } - authenticateHeader = authenticateHeader.toLowerCase(Locale.ROOT).replace(authChallengePrefix.toLowerCase(Locale.ROOT), ""); + authenticateHeader = + authenticateHeader.toLowerCase(Locale.ROOT).replace(authChallengePrefix.toLowerCase(Locale.ROOT), ""); String[] challenges = authenticateHeader.split(", "); Map challengeMap = new HashMap<>(); diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyVaultErrorCodeStrings.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyVaultErrorCodeStrings.java index 68597a730d46..08c3e6d0e5f3 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyVaultErrorCodeStrings.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyVaultErrorCodeStrings.java @@ -22,7 +22,7 @@ class KeyVaultErrorCodeStrings { static final String VAULT_END_POINT_REQUIRED = "vault_endpoint_required"; /** - * Gets the error String for the specified property. + * Gets the error String for the specified property. * * @param propertyName the property name for which error string is required. * @return The {@link String value} containing the error message. @@ -34,7 +34,8 @@ static String getErrorString(String propertyName) { private static synchronized void loadProperties() { if (errorStrings == null) { - try (InputStream fileInputStream = KeyVaultErrorCodeStrings.class.getClassLoader().getResource((ERROR_STRINGS_FILE_NAME)).openStream()) { + try (InputStream fileInputStream = + KeyVaultErrorCodeStrings.class.getClassLoader().getResource((ERROR_STRINGS_FILE_NAME)).openStream()) { errorStrings = new Properties(); errorStrings.load(fileInputStream); } catch (IOException ex) { diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/ScopeTokenCache.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/ScopeTokenCache.java index 90082140d362..8bc88cbdfc52 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/ScopeTokenCache.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/ScopeTokenCache.java @@ -34,7 +34,7 @@ class ScopeTokenCache { this.getNew = getNew; } - public void scopes(String... scopes) { + public void setScopes(String... scopes) { this.scopes = scopes; } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesCbc.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesCbc.java index 9b05ac28a861..dc3816dbe4df 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesCbc.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesCbc.java @@ -23,7 +23,9 @@ static class AesCbcDecryptor implements ICryptoTransform { private final Cipher cipher; - AesCbcDecryptor(byte[] key, byte[] iv, Provider provider) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException { + AesCbcDecryptor(byte[] key, byte[] iv, Provider provider) + throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, + InvalidAlgorithmParameterException { // Create the cipher using the Provider if specified if (provider == null) { @@ -45,7 +47,9 @@ static class AesCbcEncryptor implements ICryptoTransform { private final Cipher cipher; - AesCbcEncryptor(byte[] key, byte[] iv, Provider provider) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException { + AesCbcEncryptor(byte[] key, byte[] iv, Provider provider) + throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, + InvalidAlgorithmParameterException { // Create the cipher using the Provider if specified if (provider == null) { @@ -70,42 +74,51 @@ protected AesCbc(String name, int size) { } @Override - public ICryptoTransform createEncryptor(byte[] key, byte[] iv, byte[] authenticationData) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException { - + public ICryptoTransform createEncryptor(byte[] key, byte[] iv, byte[] authenticationData) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, + InvalidAlgorithmParameterException { + if (key == null || key.length < keySizeInBytes) { throw new InvalidKeyException("key must be at least " + keySize + " bits in length"); } - + return new AesCbcEncryptor(Arrays.copyOfRange(key, 0, keySizeInBytes), iv, null); } @Override - public ICryptoTransform createEncryptor(byte[] key, byte[] iv, byte[] authenticationData, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException { + public ICryptoTransform createEncryptor(byte[] key, byte[] iv, byte[] authenticationData, Provider provider) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, + InvalidAlgorithmParameterException { if (key == null || key.length < keySizeInBytes) { throw new InvalidKeyException("key must be at least " + keySize + " bits in length"); } - + return new AesCbcEncryptor(Arrays.copyOfRange(key, 0, keySizeInBytes), iv, provider); } @Override - public ICryptoTransform createDecryptor(byte[] key, byte[] iv, byte[] authenticationData, byte[] authenticationTag) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException { + public ICryptoTransform createDecryptor(byte[] key, byte[] iv, byte[] authenticationData, byte[] authenticationTag) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, + InvalidAlgorithmParameterException { if (key == null || key.length < keySizeInBytes) { throw new InvalidKeyException("key must be at least " + keySize + " bits in length"); } - + return new AesCbcDecryptor(Arrays.copyOfRange(key, 0, keySizeInBytes), iv, null); } @Override - public ICryptoTransform createDecryptor(byte[] key, byte[] iv, byte[] authenticationData, byte[] authenticationTag, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException { + public ICryptoTransform createDecryptor(byte[] key, byte[] iv, byte[] authenticationData, byte[] authenticationTag, + Provider provider) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, + InvalidAlgorithmParameterException { if (key == null || key.length < keySizeInBytes) { throw new InvalidKeyException("key must be at least " + keySize + " bits in length"); } - + return new AesCbcDecryptor(Arrays.copyOfRange(key, 0, keySizeInBytes), iv, provider); } } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesCbcHmacSha2.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesCbcHmacSha2.java index 8ab83238f913..aa3ece7bf3a0 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesCbcHmacSha2.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesCbcHmacSha2.java @@ -30,7 +30,10 @@ static class AesCbcHmacSha2Decryptor implements IAuthenticatedCryptoTransform { byte[] tag; - AesCbcHmacSha2Decryptor(String name, byte[] key, byte[] iv, byte[] authenticationData, byte[] authenticationTag, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException { + AesCbcHmacSha2Decryptor(String name, byte[] key, byte[] iv, byte[] authenticationData, byte[] authenticationTag, + Provider provider) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, + InvalidAlgorithmParameterException { // Split the key to get the AES key, the HMAC key and the HMAC // object @@ -59,7 +62,8 @@ public byte[] getTag() { } @Override - public byte[] doFinal(byte[] input) throws IllegalBlockSizeException, BadPaddingException, InvalidKeyException, NoSuchAlgorithmException { + public byte[] doFinal(byte[] input) + throws IllegalBlockSizeException, BadPaddingException, InvalidKeyException, NoSuchAlgorithmException { // Add the cipher text to the running hash hmac.update(input); @@ -82,14 +86,16 @@ public byte[] doFinal(byte[] input) throws IllegalBlockSizeException, BadPadding private static byte[] toBigEndian(long i) { byte[] shortRepresentation = BigInteger.valueOf(i).toByteArray(); - byte[] longRepresentation = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 }; + byte[] longRepresentation = new byte[]{0, 0, 0, 0, 0, 0, 0, 0}; - System.arraycopy(shortRepresentation, 0, longRepresentation, longRepresentation.length - shortRepresentation.length, shortRepresentation.length); + System.arraycopy(shortRepresentation, 0, longRepresentation, + longRepresentation.length - shortRepresentation.length, shortRepresentation.length); return longRepresentation; } - private static Triplet getAlgorithmParameters(String algorithm, byte[] key) throws InvalidKeyException, NoSuchAlgorithmException { + private static Triplet getAlgorithmParameters(String algorithm, byte[] key) + throws InvalidKeyException, NoSuchAlgorithmException { byte[] aesKey; byte[] hmacKey; @@ -97,7 +103,8 @@ private static Triplet getAlgorithmParameters(String algori if (algorithm.equalsIgnoreCase(Aes128CbcHmacSha256.ALGORITHM_NAME)) { if ((key.length << 3) < 256) { - throw new IllegalArgumentException(String.format("%s key length in bits %d < 256", algorithm, key.length << 3)); + throw new IllegalArgumentException(String.format("%s key length in bits %d < 256", algorithm, + key.length << 3)); } hmacKey = new byte[128 >> 3]; @@ -113,7 +120,8 @@ private static Triplet getAlgorithmParameters(String algori } else if (algorithm.equalsIgnoreCase(Aes192CbcHmacSha384.ALGORITHM_NAME)) { if ((key.length << 3) < 384) { - throw new IllegalArgumentException(String.format("%s key length in bits %d < 384", algorithm, key.length << 3)); + throw new IllegalArgumentException(String.format("%s key length in bits %d < 384", algorithm, + key.length << 3)); } hmacKey = new byte[192 >> 3]; @@ -128,7 +136,8 @@ private static Triplet getAlgorithmParameters(String algori } else if (algorithm.equalsIgnoreCase(Aes256CbcHmacSha512.ALGORITHM_NAME)) { if ((key.length << 3) < 512) { - throw new IllegalArgumentException(String.format("%s key length in bits %d < 512", algorithm, key.length << 3)); + throw new IllegalArgumentException(String.format("%s key length in bits %d < 512", algorithm, + key.length << 3)); } hmacKey = new byte[256 >> 3]; @@ -157,7 +166,9 @@ static class AesCbcHmacSha2Encryptor implements IAuthenticatedCryptoTransform { byte[] tag; - AesCbcHmacSha2Encryptor(String name, byte[] key, byte[] iv, byte[] authenticationData, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException { + AesCbcHmacSha2Encryptor(String name, byte[] key, byte[] iv, byte[] authenticationData, Provider provider) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, + InvalidAlgorithmParameterException { // Split the key to get the AES key, the HMAC key and the HMAC // object Triplet parameters = getAlgorithmParameters(name, key); @@ -179,14 +190,16 @@ static class AesCbcHmacSha2Encryptor implements IAuthenticatedCryptoTransform { private static byte[] toBigEndian(long i) { byte[] shortRepresentation = BigInteger.valueOf(i).toByteArray(); - byte[] longRepresentation = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 }; + byte[] longRepresentation = new byte[]{0, 0, 0, 0, 0, 0, 0, 0}; - System.arraycopy(shortRepresentation, 0, longRepresentation, longRepresentation.length - shortRepresentation.length, shortRepresentation.length); + System.arraycopy(shortRepresentation, 0, longRepresentation, + longRepresentation.length - shortRepresentation.length, shortRepresentation.length); return longRepresentation; } - private static Triplet getAlgorithmParameters(String algorithm, byte[] key) throws InvalidKeyException, NoSuchAlgorithmException { + private static Triplet getAlgorithmParameters(String algorithm, byte[] key) + throws InvalidKeyException, NoSuchAlgorithmException { byte[] aesKey; byte[] hmacKey; @@ -194,7 +207,8 @@ private static Triplet getAlgorithmParameters(String algori if (algorithm.equalsIgnoreCase(Aes128CbcHmacSha256.ALGORITHM_NAME)) { if ((key.length << 3) < 256) { - throw new IllegalArgumentException(String.format("%s key length in bits %d < 256", algorithm, key.length << 3)); + throw new IllegalArgumentException(String.format("%s key length in bits %d < 256", algorithm, + key.length << 3)); } hmacKey = new byte[128 >> 3]; @@ -210,7 +224,8 @@ private static Triplet getAlgorithmParameters(String algori } else if (algorithm.equalsIgnoreCase(Aes192CbcHmacSha384.ALGORITHM_NAME)) { if ((key.length << 3) < 384) { - throw new IllegalArgumentException(String.format("%s key length in bits %d < 384", algorithm, key.length << 3)); + throw new IllegalArgumentException(String.format("%s key length in bits %d < 384", algorithm, + key.length << 3)); } hmacKey = new byte[192 >> 3]; @@ -225,7 +240,8 @@ private static Triplet getAlgorithmParameters(String algori } else if (algorithm.equalsIgnoreCase(Aes256CbcHmacSha512.ALGORITHM_NAME)) { if ((key.length << 3) < 512) { - throw new IllegalArgumentException(String.format("%s key length in bits %d < 512", algorithm, key.length << 3)); + throw new IllegalArgumentException(String.format("%s key length in bits %d < 512", algorithm, + key.length << 3)); } hmacKey = new byte[256 >> 3]; @@ -250,7 +266,8 @@ public byte[] getTag() { } @Override - public byte[] doFinal(byte[] input) throws IllegalBlockSizeException, BadPaddingException, InvalidKeyException, NoSuchAlgorithmException { + public byte[] doFinal(byte[] input) + throws IllegalBlockSizeException, BadPaddingException, InvalidKeyException, NoSuchAlgorithmException { // Encrypt the block byte[] output = inner.doFinal(input); @@ -274,12 +291,17 @@ protected AesCbcHmacSha2(String name) { } @Override - public ICryptoTransform createDecryptor(byte[] key, byte[] iv, byte[] authenticationData, byte[] authenticationTag) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException { + public ICryptoTransform createDecryptor(byte[] key, byte[] iv, byte[] authenticationData, byte[] authenticationTag) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, + InvalidAlgorithmParameterException { return createDecryptor(key, iv, authenticationData, authenticationTag, null); } @Override - public ICryptoTransform createDecryptor(byte[] key, byte[] iv, byte[] authenticationData, byte[] authenticationTag, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException { + public ICryptoTransform createDecryptor(byte[] key, byte[] iv, byte[] authenticationData, byte[] authenticationTag, + Provider provider) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, + InvalidAlgorithmParameterException { if (key == null) { throw logger.logExceptionAsWarning(new IllegalArgumentException("No key material")); } @@ -301,23 +323,27 @@ public ICryptoTransform createDecryptor(byte[] key, byte[] iv, byte[] authentica } @Override - public ICryptoTransform createEncryptor(byte[] key, byte[] iv, byte[] authenticationData) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException { + public ICryptoTransform createEncryptor(byte[] key, byte[] iv, byte[] authenticationData) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, + InvalidAlgorithmParameterException { return createEncryptor(key, iv, authenticationData, null); } @Override - public ICryptoTransform createEncryptor(byte[] key, byte[] iv, byte[] authenticationData, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException { + public ICryptoTransform createEncryptor(byte[] key, byte[] iv, byte[] authenticationData, Provider provider) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, + InvalidAlgorithmParameterException { if (key == null) { - throw new IllegalArgumentException("No key material"); + throw logger.logExceptionAsError(new IllegalArgumentException("No key material")); } if (iv == null) { - throw new IllegalArgumentException("No initialization vector"); + throw logger.logExceptionAsError(new IllegalArgumentException("No initialization vector")); } if (authenticationData == null) { - throw new IllegalArgumentException("No authentication data"); + throw logger.logExceptionAsError(new IllegalArgumentException("No authentication data")); } // Create the Encryptor diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesKw.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesKw.java index 80f95041ee02..66f6ccc0a90c 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesKw.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesKw.java @@ -3,6 +3,8 @@ package com.azure.security.keyvault.keys.cryptography; +import com.azure.core.util.logging.ClientLogger; + import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; @@ -15,15 +17,18 @@ import java.security.Provider; abstract class AesKw extends LocalKeyWrapAlgorithm { - - static final byte[] DEFAULT_IV = new byte[] { (byte) 0xA6, (byte) 0xA6, (byte) 0xA6, (byte) 0xA6, (byte) 0xA6, (byte) 0xA6, (byte) 0xA6, (byte) 0xA6 }; + static final byte[] DEFAULT_IV = + new byte[]{(byte) 0xA6, (byte) 0xA6, (byte) 0xA6, (byte) 0xA6, (byte) 0xA6, (byte) 0xA6, (byte) 0xA6, + (byte) 0xA6}; static final String CIPHER_NAME = "AESWrap"; static class AesKwDecryptor implements ICryptoTransform { final Cipher cipher; - AesKwDecryptor(byte[] key, byte[] iv, Provider provider) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException { + AesKwDecryptor(byte[] key, byte[] iv, Provider provider) + throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, + InvalidAlgorithmParameterException { if (provider == null) { cipher = Cipher.getInstance(CIPHER_NAME); @@ -33,7 +38,7 @@ static class AesKwDecryptor implements ICryptoTransform { // The default provider does not support the specification of IV. This // is guarded by the CreateEncrypter wrapper method and the iv parameter - // can be ignored when using the default provider + // can be ignored when using the default provider if (provider == null) { cipher.init(Cipher.UNWRAP_MODE, new SecretKeySpec(key, "AES")); } else { @@ -42,7 +47,8 @@ static class AesKwDecryptor implements ICryptoTransform { } @Override - public byte[] doFinal(byte[] plaintext) throws IllegalBlockSizeException, BadPaddingException, InvalidKeyException, NoSuchAlgorithmException { + public byte[] doFinal(byte[] plaintext) + throws IllegalBlockSizeException, BadPaddingException, InvalidKeyException, NoSuchAlgorithmException { return cipher.unwrap(plaintext, "AESWrap", Cipher.SECRET_KEY).getEncoded(); } @@ -53,7 +59,9 @@ static class AesKwEncryptor implements ICryptoTransform { final Cipher cipher; - AesKwEncryptor(byte[] key, byte[] iv, Provider provider) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException { + AesKwEncryptor(byte[] key, byte[] iv, Provider provider) + throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, + InvalidAlgorithmParameterException { if (provider == null) { cipher = Cipher.getInstance(CIPHER_NAME); @@ -63,7 +71,7 @@ static class AesKwEncryptor implements ICryptoTransform { // The default provider does not support the specification of IV. This // is guarded by the CreateEncrypter wrapper method and the iv parameter - // can be ignored when using the default provider + // can be ignored when using the default provider if (provider == null) { cipher.init(Cipher.WRAP_MODE, new SecretKeySpec(key, "AES")); } else { @@ -72,54 +80,66 @@ static class AesKwEncryptor implements ICryptoTransform { } @Override - public byte[] doFinal(byte[] plaintext) throws IllegalBlockSizeException, BadPaddingException, InvalidKeyException { + public byte[] doFinal(byte[] plaintext) + throws IllegalBlockSizeException, BadPaddingException, InvalidKeyException { return cipher.wrap(new SecretKeySpec(plaintext, "AES")); } } + private final ClientLogger logger = new ClientLogger(AesKw.class); + protected AesKw(String name) { super(name); } @Override - public ICryptoTransform createEncryptor(byte[] key) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException { + public ICryptoTransform createEncryptor(byte[] key) + throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, + InvalidAlgorithmParameterException { return createEncryptor(key, null, null); } @Override - public ICryptoTransform createEncryptor(byte[] key, Provider provider) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException { + public ICryptoTransform createEncryptor(byte[] key, Provider provider) + throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, + InvalidAlgorithmParameterException { return createEncryptor(key, null, provider); } @Override - public ICryptoTransform createEncryptor(byte[] key, byte[] iv) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException { + public ICryptoTransform createEncryptor(byte[] key, byte[] iv) + throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, + InvalidAlgorithmParameterException { return createEncryptor(key, iv, null); } @Override - public ICryptoTransform createEncryptor(byte[] key, byte[] iv, Provider provider) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException { + public ICryptoTransform createEncryptor(byte[] key, byte[] iv, Provider provider) + throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, + InvalidAlgorithmParameterException { if (key == null) { - throw new IllegalArgumentException("key"); + throw logger.logExceptionAsError(new IllegalArgumentException("key")); } if (key.length != 128 >> 3 && key.length != 192 >> 3 && key.length != 256 >> 3) { - throw new IllegalArgumentException("key length must be 128, 192 or 256 bits"); + throw logger.logExceptionAsError(new IllegalArgumentException("key length must be 128, 192 or 256 bits")); } if (iv != null) { // iv length must be 64 bits if (iv.length != 8) { - throw new IllegalArgumentException("iv length must be 64 bits"); + throw logger.logExceptionAsError(new IllegalArgumentException("iv length must be 64 bits")); } // iv cannot be specified with the default provider if (provider == null) { - throw new IllegalArgumentException("user specified iv is not supported with the default provider"); + throw logger.logExceptionAsError(new IllegalArgumentException( + "user specified iv is not supported with the default provider")); } } @@ -128,42 +148,51 @@ public ICryptoTransform createEncryptor(byte[] key, byte[] iv, Provider provider } @Override - public ICryptoTransform createDecryptor(byte[] key) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException { + public ICryptoTransform createDecryptor(byte[] key) + throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, + InvalidAlgorithmParameterException { return createDecryptor(key, null, null); } @Override - public ICryptoTransform createDecryptor(byte[] key, Provider provider) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException { + public ICryptoTransform createDecryptor(byte[] key, Provider provider) + throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, + InvalidAlgorithmParameterException { return createDecryptor(key, null, provider); } @Override - public ICryptoTransform createDecryptor(byte[] key, byte[] iv) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException { + public ICryptoTransform createDecryptor(byte[] key, byte[] iv) + throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, + InvalidAlgorithmParameterException { return createDecryptor(key, iv, null); } @Override - public ICryptoTransform createDecryptor(byte[] key, byte[] iv, Provider provider) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException { + public ICryptoTransform createDecryptor(byte[] key, byte[] iv, Provider provider) + throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, + InvalidAlgorithmParameterException { if (key == null) { - throw new IllegalArgumentException("key"); + throw logger.logExceptionAsError(new IllegalArgumentException("key")); } if (key.length != 128 >> 3 && key.length != 192 >> 3 && key.length != 256 >> 3) { - throw new IllegalArgumentException("key length must be 128, 192 or 256 bits"); + throw logger.logExceptionAsError(new IllegalArgumentException("key length must be 128, 192 or 256 bits")); } if (iv != null) { // iv length must be 64 bits if (iv.length != 8) { - throw new IllegalArgumentException("iv length must be 64 bits"); + throw logger.logExceptionAsError(new IllegalArgumentException("iv length must be 64 bits")); } // iv cannot be specified with the default provider if (provider == null) { - throw new IllegalArgumentException("user specified iv is not supported with the default provider"); + throw logger.logExceptionAsError(new IllegalArgumentException( + "user specified iv is not supported with the default provider")); } } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesKw128.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesKw128.java index f710f03eee0c..62043a73194c 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesKw128.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesKw128.java @@ -21,7 +21,9 @@ class AesKw128 extends AesKw { } @Override - public ICryptoTransform createEncryptor(byte[] key, byte[] iv, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException { + public ICryptoTransform createEncryptor(byte[] key, byte[] iv, Provider provider) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, + InvalidAlgorithmParameterException { CryptoUtil.validate(key, KEY_SIZE_IN_BYTES); @@ -29,7 +31,9 @@ public ICryptoTransform createEncryptor(byte[] key, byte[] iv, Provider provider } @Override - public ICryptoTransform createDecryptor(byte[] key, byte[] iv, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException { + public ICryptoTransform createDecryptor(byte[] key, byte[] iv, Provider provider) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, + InvalidAlgorithmParameterException { CryptoUtil.validate(key, KEY_SIZE_IN_BYTES); diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesKw192.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesKw192.java index a6f758e86212..0af9bd7207dd 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesKw192.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesKw192.java @@ -21,7 +21,9 @@ class AesKw192 extends AesKw { } @Override - public ICryptoTransform createEncryptor(byte[] key, byte[] iv, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException { + public ICryptoTransform createEncryptor(byte[] key, byte[] iv, Provider provider) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, + InvalidAlgorithmParameterException { CryptoUtil.validate(key, KEY_SIZE_IN_BYTES); @@ -29,7 +31,9 @@ public ICryptoTransform createEncryptor(byte[] key, byte[] iv, Provider provider } @Override - public ICryptoTransform createDecryptor(byte[] key, byte[] iv, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException { + public ICryptoTransform createDecryptor(byte[] key, byte[] iv, Provider provider) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, + InvalidAlgorithmParameterException { CryptoUtil.validate(key, KEY_SIZE_IN_BYTES); diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesKw256.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesKw256.java index d3243c41c6a4..3448b82490f4 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesKw256.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesKw256.java @@ -21,14 +21,18 @@ class AesKw256 extends AesKw { } @Override - public ICryptoTransform createEncryptor(byte[] key, byte[] iv, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException { + public ICryptoTransform createEncryptor(byte[] key, byte[] iv, Provider provider) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, + InvalidAlgorithmParameterException { CryptoUtil.validate(key, KEY_SIZE_IN_BYTES); return super.createEncryptor(Arrays.copyOfRange(key, 0, KEY_SIZE_IN_BYTES), iv, provider); } @Override - public ICryptoTransform createDecryptor(byte[] key, byte[] iv, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException { + public ICryptoTransform createDecryptor(byte[] key, byte[] iv, Provider provider) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, + InvalidAlgorithmParameterException { CryptoUtil.validate(key, KEY_SIZE_IN_BYTES); return super.createDecryptor(Arrays.copyOfRange(key, 0, KEY_SIZE_IN_BYTES), iv, provider); diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AsymmetricEncryptionAlgorithm.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AsymmetricEncryptionAlgorithm.java index 53b576760d98..ad326ada26da 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AsymmetricEncryptionAlgorithm.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AsymmetricEncryptionAlgorithm.java @@ -17,7 +17,7 @@ abstract class AsymmetricEncryptionAlgorithm extends LocalEncryptionAlgorithm { /** * Constructor. - * + * * @param name The name of the algorithm. */ protected AsymmetricEncryptionAlgorithm(String name) { @@ -29,12 +29,13 @@ protected AsymmetricEncryptionAlgorithm(String name) { * uses the specified {@link KeyPair} and the default {@link Provider} provider. * * @param keyPair The key pair to use. - * @return - * @throws InvalidKeyException - * @throws NoSuchAlgorithmException - * @throws NoSuchPaddingException + * @return abstract {@link ICryptoTransform} + * @throws InvalidKeyException when key is not valid + * @throws NoSuchAlgorithmException if algorithm is not found + * @throws NoSuchPaddingException if padding is set wrong */ - public abstract ICryptoTransform createEncryptor(KeyPair keyPair) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException; + public abstract ICryptoTransform createEncryptor(KeyPair keyPair) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException; /** * Creates a {@link ICryptoTransform} implementation for encryption that @@ -42,24 +43,26 @@ protected AsymmetricEncryptionAlgorithm(String name) { * * @param keyPair The key pair to use. * @param provider The provider to use. - * @return - * @throws InvalidKeyException - * @throws NoSuchAlgorithmException - * @throws NoSuchPaddingException + * @return abstract {@link ICryptoTransform} + * @throws InvalidKeyException when key is not valid + * @throws NoSuchAlgorithmException if algorithm is not found + * @throws NoSuchPaddingException if padding is set wrong */ - public abstract ICryptoTransform createEncryptor(KeyPair keyPair, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException; + public abstract ICryptoTransform createEncryptor(KeyPair keyPair, Provider provider) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException; /** * Creates a {@link ICryptoTransform} implementation for decryption that * uses the specified {@link KeyPair} and the default {@link Provider} provider. * * @param keyPair The key pair to use. - * @return - * @throws InvalidKeyException - * @throws NoSuchAlgorithmException - * @throws NoSuchPaddingException + * @return abstract {@link ICryptoTransform} + * @throws InvalidKeyException when key is not valid + * @throws NoSuchAlgorithmException if algorithm is not found + * @throws NoSuchPaddingException if padding is set wrong */ - public abstract ICryptoTransform createDecryptor(KeyPair keyPair) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException; + public abstract ICryptoTransform createDecryptor(KeyPair keyPair) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException; /** * Creates a {@link ICryptoTransform} implementation for decryption that @@ -67,10 +70,11 @@ protected AsymmetricEncryptionAlgorithm(String name) { * * @param keyPair The key pair to use. * @param provider The provider to use. - * @return - * @throws InvalidKeyException - * @throws NoSuchAlgorithmException - * @throws NoSuchPaddingException + * @return abstract {@link ICryptoTransform} + * @throws InvalidKeyException when key is not valid + * @throws NoSuchAlgorithmException if algorithm is not found + * @throws NoSuchPaddingException if padding is set wrong */ - public abstract ICryptoTransform createDecryptor(KeyPair keyPair, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException; + public abstract ICryptoTransform createDecryptor(KeyPair keyPair, Provider provider) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException; } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClient.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClient.java index 053fb631ade8..7b49cc97f907 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClient.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClient.java @@ -38,7 +38,8 @@ /** * The CryptographyAsyncClient provides asynchronous methods to perform cryptographic operations using asymmetric and - * symmetric keys. The client supports encrypt, decrypt, wrap key, unwrap key, sign and verify operations using the configured key. + * symmetric keys. The client supports encrypt, decrypt, wrap key, unwrap key, sign and verify operations using the + * configured key. * *

Samples to construct the sync client

* {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.instantiation} @@ -65,18 +66,18 @@ public final class CryptographyAsyncClient { if (!key.isValid()) { throw new IllegalArgumentException("Json Web Key is not valid"); } - if (key.keyOps() == null) { + if (key.getKeyOps() == null) { throw new IllegalArgumentException("Json Web Key's key operations property is not configured"); } - if (key.kty() == null) { + if (key.getKty() == null) { throw new IllegalArgumentException("Json Web Key's key type property is not configured"); } this.key = key; service = RestProxy.create(CryptographyService.class, pipeline); - if (!Strings.isNullOrEmpty(key.kid())) { - unpackAndValidateId(key.kid()); - cryptographyServiceClient = new CryptographyServiceClient(key.kid(), service); + if (!Strings.isNullOrEmpty(key.getKid())) { + unpackAndValidateId(key.getKid()); + cryptographyServiceClient = new CryptographyServiceClient(key.getKid(), service); } else { cryptographyServiceClient = null; } @@ -100,7 +101,7 @@ private void initializeCryptoClients() { if (localKeyCryptographyClient != null) { return; } - switch (key.kty()) { + switch (key.getKty()) { case RSA: case RSA_HSM: localKeyCryptographyClient = new RsaKeyCryptographyClient(key, cryptographyServiceClient); @@ -113,19 +114,23 @@ private void initializeCryptoClients() { localKeyCryptographyClient = new SymmetricKeyCryptographyClient(key, cryptographyServiceClient); break; default: - throw new IllegalArgumentException(String.format("The Json Web Key Type: %s is not supported.", key.kty().toString())); + throw logger.logExceptionAsError(new IllegalArgumentException(String.format( + "The Json Web Key Type: %s is not supported.", key.getKty().toString()))); } } /** - * Gets the public part of the configured key. The get key operation is applicable to all key types and it requires the {@code keys/get} permission. + * Gets the public part of the configured key. The get key operation is applicable to all key types and it requires + * the {@code keys/get} permission. * *

Code Samples

- *

Gets the configured key in the client. Subscribes to the call asynchronously and prints out the returned key details when a response has been received.

+ *

Gets the configured key in the client. Subscribes to the call asynchronously and prints out the returned key + * details when a response has been received.

* {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.getKeyWithResponse} * + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the requested + * {@link Key key}. * @throws ResourceNotFoundException when the configured key doesn't exist in the key vault. - * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the requested {@link Key key}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getKeyWithResponse() { @@ -133,14 +138,16 @@ public Mono> getKeyWithResponse() { } /** - * Gets the public part of the configured key. The get key operation is applicable to all key types and it requires the {@code keys/get} permission. + * Gets the public part of the configured key. The get key operation is applicable to all key types and it requires + * the {@code keys/get} permission. * *

Code Samples

- *

Gets the configured key in the client. Subscribes to the call asynchronously and prints out the returned key details when a response has been received.

+ *

Gets the configured key in the client. Subscribes to the call asynchronously and prints out the returned key + * details when a response has been received.

* {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.getKey} * - * @throws ResourceNotFoundException when the configured key doesn't exist in the key vault. * @return A {@link Mono} containing the requested {@link Key key}. + * @throws ResourceNotFoundException when the configured key doesn't exist in the key vault. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getKey() { @@ -153,24 +160,31 @@ Mono> getKeyWithResponse(Context context) { /** * Encrypts an arbitrary sequence of bytes using the configured key. Note that the encrypt operation only supports a - * single block of data, the size of which is dependent on the target key and the encryption algorithm to be used. The encrypt - * operation is supported for both symmetric keys and asymmetric keys. In case of asymmetric keys public portion of the key is used - * for encryption. This operation requires the keys/encrypt permission. + * single block of data, the size of which is dependent on the target key and the encryption algorithm to be used. + * The encrypt operation is supported for both symmetric keys and asymmetric keys. In case of asymmetric keys public + * portion of the key is used for encryption. This operation requires the keys/encrypt permission. + * + *

The {@link EncryptionAlgorithm encryption algorithm} indicates the type of algorithm to use for encrypting the + * specified {@code plaintext}. Possible values for assymetric keys include: + * {@link EncryptionAlgorithm#RSA1_5 RSA1_5}, {@link EncryptionAlgorithm#RSA_OAEP RSA_OAEP} and + * {@link EncryptionAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. * - *

The {@link EncryptionAlgorithm encryption algorithm} indicates the type of algorithm to use for encrypting the specified {@code plaintext}. Possible values - * for assymetric keys include: {@link EncryptionAlgorithm#RSA1_5 RSA1_5}, {@link EncryptionAlgorithm#RSA_OAEP RSA_OAEP} and {@link EncryptionAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. - * Possible values for symmetric keys include: {@link EncryptionAlgorithm#A128CBC A128CBC}, {@link EncryptionAlgorithm#A128CBC_HS256 A128CBC-HS256}, - * {@link EncryptionAlgorithm#A192CBC A192CBC}, {@link EncryptionAlgorithm#A192CBC_HS384 A192CBC-HS384}, {@link EncryptionAlgorithm#A256CBC A256CBC} and {@link EncryptionAlgorithm#A256CBC_HS512 A256CBC-HS512}

+ * Possible values for symmetric keys include: {@link EncryptionAlgorithm#A128CBC A128CBC}, + * {@link EncryptionAlgorithm#A128CBC_HS256 A128CBC-HS256}, {@link EncryptionAlgorithm#A192CBC A192CBC}, + * {@link EncryptionAlgorithm#A192CBC_HS384 A192CBC-HS384}, {@link EncryptionAlgorithm#A256CBC A256CBC} and + * {@link EncryptionAlgorithm#A256CBC_HS512 A256CBC-HS512}

* *

Code Samples

- *

Encrypts the content. Subscribes to the call asynchronously and prints out the encrypted content details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.encrypt#asymmetric-encrypt} + *

Encrypts the content. Subscribes to the call asynchronously and prints out the encrypted content details when + * a response has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.encrypt#EncryptionAlgorithm-byte} * * @param algorithm The algorithm to be used for encryption. * @param plaintext The content to be encrypted. + * @return A {@link Mono} containing a {@link EncryptResult} whose {@link EncryptResult#getCipherText() cipher text} + * contains the encrypted content. * @throws ResourceNotFoundException if the key cannot be found for encryption. * @throws NullPointerException if {@code algorithm} or {@code plainText} is null. - * @return A {@link Mono} containing a {@link EncryptResult} whose {@link EncryptResult#cipherText() cipher text} contains the encrypted content. */ public Mono encrypt(EncryptionAlgorithm algorithm, byte[] plaintext) { return withContext(context -> encrypt(algorithm, plaintext, context, null, null)); @@ -178,32 +192,41 @@ public Mono encrypt(EncryptionAlgorithm algorithm, byte[] plainte /** * Encrypts an arbitrary sequence of bytes using the configured key. Note that the encrypt operation only supports a - * single block of data, the size of which is dependent on the target key and the encryption algorithm to be used. The encrypt - * operation is supported for both symmetric keys and asymmetric keys. In case of asymmetric keys public portion of the key is used - * for encryption. This operation requires the keys/encrypt permission. + * single block of data, the size of which is dependent on the target key and the encryption algorithm to be used. + * The encrypt operation is supported for both symmetric keys and asymmetric keys. In case of asymmetric keys public + * portion of the key is used for encryption. This operation requires the keys/encrypt permission. * - *

The {@link EncryptionAlgorithm encryption algorithm} indicates the type of algorithm to use for encrypting the specified {@code plaintext}. Possible values - * for assymetric keys include: {@link EncryptionAlgorithm#RSA1_5 RSA1_5}, {@link EncryptionAlgorithm#RSA_OAEP RSA_OAEP} and {@link EncryptionAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. - * Possible values for symmetric keys include: {@link EncryptionAlgorithm#A128CBC A128CBC}, {@link EncryptionAlgorithm#A128CBC_HS256 A128CBC-HS256}, - * {@link EncryptionAlgorithm#A192CBC A192CBC}, {@link EncryptionAlgorithm#A192CBC_HS384 A192CBC-HS384}, {@link EncryptionAlgorithm#A256CBC A256CBC} and {@link EncryptionAlgorithm#A256CBC_HS512 A256CBC-HS512}

+ *

The {@link EncryptionAlgorithm encryption algorithm} indicates the type of algorithm to use for encrypting the + * specified {@code plaintext}. Possible values for assymetric keys include: + * {@link EncryptionAlgorithm#RSA1_5 RSA1_5}, {@link EncryptionAlgorithm#RSA_OAEP RSA_OAEP} and + * {@link EncryptionAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. + * + * Possible values for symmetric keys include: {@link EncryptionAlgorithm#A128CBC A128CBC}, {@link + * EncryptionAlgorithm#A128CBC_HS256 A128CBC-HS256}, {@link EncryptionAlgorithm#A192CBC A192CBC}, {@link + * EncryptionAlgorithm#A192CBC_HS384 A192CBC-HS384}, {@link EncryptionAlgorithm#A256CBC A256CBC} and + * {@link EncryptionAlgorithm#A256CBC_HS512 A256CBC-HS512}

* *

Code Samples

- *

Encrypts the content. Subscribes to the call asynchronously and prints out the encrypted content details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.encrypt#symmetric-encrypt} + *

Encrypts the content. Subscribes to the call asynchronously and prints out the encrypted content details when + * a response has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.encrypt#EncryptionAlgorithm-byte-byte-byte} * * @param algorithm The algorithm to be used for encryption. * @param plaintext The content to be encrypted. * @param iv The initialization vector * @param authenticationData The authentication data + * @return A {@link Mono} containing a {@link EncryptResult} whose {@link EncryptResult#getCipherText() cipher text} + * contains the encrypted content. * @throws ResourceNotFoundException if the key cannot be found for encryption. * @throws NullPointerException if {@code algorithm} or {@code plainText} is null. - * @return A {@link Mono} containing a {@link EncryptResult} whose {@link EncryptResult#cipherText() cipher text} contains the encrypted content. */ - public Mono encrypt(EncryptionAlgorithm algorithm, byte[] plaintext, byte[] iv, byte[] authenticationData) { + public Mono encrypt(EncryptionAlgorithm algorithm, byte[] plaintext, byte[] iv, + byte[] authenticationData) { return withContext(context -> encrypt(algorithm, plaintext, context, iv, authenticationData)); } - Mono encrypt(EncryptionAlgorithm algorithm, byte[] plaintext, Context context, byte[] iv, byte[] authenticationData) { + Mono encrypt(EncryptionAlgorithm algorithm, byte[] plaintext, Context context, byte[] iv, + byte[] authenticationData) { Objects.requireNonNull(algorithm, "Encryption algorithm cannot be null."); Objects.requireNonNull(plaintext, "Plain text content to be encrypted cannot be null."); @@ -213,64 +236,81 @@ Mono encrypt(EncryptionAlgorithm algorithm, byte[] plaintext, Con return cryptographyServiceClient.encrypt(algorithm, plaintext, context); } - if (!checkKeyPermissions(this.key.keyOps(), KeyOperation.ENCRYPT)) { - return Mono.error(new UnsupportedOperationException(String.format("Encrypt Operation is missing permission/not supported for key with id %s", key.kid()))); + if (!checkKeyPermissions(this.key.getKeyOps(), KeyOperation.ENCRYPT)) { + return Mono.error(new UnsupportedOperationException(String.format("Encrypt Operation is missing " + + "permission/not supported for key with id %s", key.getKid()))); } return localKeyCryptographyClient.encryptAsync(algorithm, plaintext, iv, authenticationData, context, key); } /** - * Decrypts a single block of encrypted data using the configured key and specified algorithm. Note that only a single block of data may be - * decrypted, the size of this block is dependent on the target key and the algorithm to be used. The decrypt operation - * is supported for both asymmetric and symmetric keys. This operation requires the keys/decrypt permission. + * Decrypts a single block of encrypted data using the configured key and specified algorithm. Note that only a + * single block of data may be decrypted, the size of this block is dependent on the target key and the algorithm to + * be used. The decrypt operation is supported for both asymmetric and symmetric keys. This operation requires the + * keys/decrypt permission. + * + *

The {@link EncryptionAlgorithm encryption algorithm} indicates the type of algorithm to use for decrypting the + * specified encrypted content. Possible values for assymetric keys include: + * {@link EncryptionAlgorithm#RSA1_5 RSA1_5}, {@link EncryptionAlgorithm#RSA_OAEP RSA_OAEP} and {@link + * EncryptionAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. * - *

The {@link EncryptionAlgorithm encryption algorithm} indicates the type of algorithm to use for decrypting the specified encrypted content. Possible values - * for assymetric keys include: {@link EncryptionAlgorithm#RSA1_5 RSA1_5}, {@link EncryptionAlgorithm#RSA_OAEP RSA_OAEP} and {@link EncryptionAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. - * Possible values for symmetric keys include: {@link EncryptionAlgorithm#A128CBC A128CBC}, {@link EncryptionAlgorithm#A128CBC_HS256 A128CBC-HS256}, - * {@link EncryptionAlgorithm#A192CBC A192CBC}, {@link EncryptionAlgorithm#A192CBC_HS384 A192CBC-HS384}, {@link EncryptionAlgorithm#A256CBC A256CBC} and {@link EncryptionAlgorithm#A256CBC_HS512 A256CBC-HS512}

+ * Possible values for symmetric keys include: {@link EncryptionAlgorithm#A128CBC A128CBC}, + * {@link EncryptionAlgorithm#A128CBC_HS256 A128CBC-HS256}, {@link EncryptionAlgorithm#A192CBC A192CBC}, + * {@link EncryptionAlgorithm#A192CBC_HS384 A192CBC-HS384}, {@link + * EncryptionAlgorithm#A256CBC A256CBC} and {@link EncryptionAlgorithm#A256CBC_HS512 A256CBC-HS512}

* *

Code Samples

- *

Decrypts the encrypted content. Subscribes to the call asynchronously and prints out the decrypted content details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.decrypt#asymmetric-decrypt} + *

Decrypts the encrypted content. Subscribes to the call asynchronously and prints out the decrypted content + * details when a response has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.decrypt#EncryptionAlgorithm-byte} * * @param algorithm The algorithm to be used for decryption. * @param cipherText The content to be decrypted. + * @return A {@link Mono} containing the decrypted blob. * @throws ResourceNotFoundException if the key cannot be found for decryption. * @throws NullPointerException if {@code algorithm} or {@code cipherText} is null. - * @return A {@link Mono} containing the decrypted blob. */ public Mono decrypt(EncryptionAlgorithm algorithm, byte[] cipherText) { return withContext(context -> decrypt(algorithm, cipherText, null, null, null, context)); } /** - * Decrypts a single block of encrypted data using the configured key and specified algorithm. Note that only a single block of data may be - * decrypted, the size of this block is dependent on the target key and the algorithm to be used. The decrypt operation - * is supported for both asymmetric and symmetric keys. This operation requires the keys/decrypt permission. - * - *

The {@link EncryptionAlgorithm encryption algorithm} indicates the type of algorithm to use for decrypting the specified encrypted content. Possible values - * for assymetric keys include: {@link EncryptionAlgorithm#RSA1_5 RSA1_5}, {@link EncryptionAlgorithm#RSA_OAEP RSA_OAEP} and {@link EncryptionAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. - * Possible values for symmetric keys include: {@link EncryptionAlgorithm#A128CBC A128CBC}, {@link EncryptionAlgorithm#A128CBC_HS256 A128CBC-HS256}, - * {@link EncryptionAlgorithm#A192CBC A192CBC}, {@link EncryptionAlgorithm#A192CBC_HS384 A192CBC-HS384}, {@link EncryptionAlgorithm#A256CBC A256CBC} and {@link EncryptionAlgorithm#A256CBC_HS512 A256CBC-HS512}

+ * Decrypts a single block of encrypted data using the configured key and specified algorithm. Note that only a + * single block of data may be decrypted, the size of this block is dependent on the target key and the algorithm to + * be used. The decrypt operation is supported for both asymmetric and symmetric keys. This operation requires the + * keys/decrypt permission. + * + *

The {@link EncryptionAlgorithm encryption algorithm} indicates the type of algorithm to use for decrypting the + * specified encrypted content. Possible values + * for assymetric keys include: {@link EncryptionAlgorithm#RSA1_5 RSA1_5}, {@link EncryptionAlgorithm#RSA_OAEP + * RSA_OAEP} and {@link EncryptionAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. + * Possible values for symmetric keys include: {@link EncryptionAlgorithm#A128CBC A128CBC}, {@link + * EncryptionAlgorithm#A128CBC_HS256 A128CBC-HS256}, + * {@link EncryptionAlgorithm#A192CBC A192CBC}, {@link EncryptionAlgorithm#A192CBC_HS384 A192CBC-HS384}, {@link + * EncryptionAlgorithm#A256CBC A256CBC} and {@link EncryptionAlgorithm#A256CBC_HS512 A256CBC-HS512}

* *

Code Samples

- *

Decrypts the encrypted content. Subscribes to the call asynchronously and prints out the decrypted content details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.decrypt#symmetric-decrypt} + *

Decrypts the encrypted content. Subscribes to the call asynchronously and prints out the decrypted content + * details when a response has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.decrypt#EncryptionAlgorithm-byte-byte-byte-byte} * * @param algorithm The algorithm to be used for decryption. * @param cipherText The content to be decrypted. * @param iv The initialization vector. * @param authenticationData The authentication data. * @param authenticationTag The authentication tag. + * @return A {@link Mono} containing the decrypted blob. * @throws ResourceNotFoundException if the key cannot be found for decryption. * @throws NullPointerException if {@code algorithm} or {@code cipherText} is null. - * @return A {@link Mono} containing the decrypted blob. */ - public Mono decrypt(EncryptionAlgorithm algorithm, byte[] cipherText, byte[] iv, byte[] authenticationData, byte[] authenticationTag) { - return withContext(context -> decrypt(algorithm, cipherText, iv, authenticationData, authenticationTag, context)); + public Mono decrypt(EncryptionAlgorithm algorithm, byte[] cipherText, byte[] iv, + byte[] authenticationData, byte[] authenticationTag) { + return withContext(context -> decrypt(algorithm, cipherText, iv, authenticationData, authenticationTag, + context)); } - Mono decrypt(EncryptionAlgorithm algorithm, byte[] cipherText, byte[] iv, byte[] authenticationData, byte[] authenticationTag, Context context) { + Mono decrypt(EncryptionAlgorithm algorithm, byte[] cipherText, byte[] iv, byte[] authenticationData, + byte[] authenticationTag, Context context) { Objects.requireNonNull(algorithm, "Encryption algorithm cannot be null."); Objects.requireNonNull(cipherText, "Cipher text content to be decrypted cannot be null."); boolean keyAvailableLocally = ensureValidKeyAvailable(); @@ -279,31 +319,37 @@ Mono decrypt(EncryptionAlgorithm algorithm, byte[] cipherText, by return cryptographyServiceClient.decrypt(algorithm, cipherText, context); } - if (!checkKeyPermissions(this.key.keyOps(), KeyOperation.DECRYPT)) { - return Mono.error(new UnsupportedOperationException(String.format("Decrypt Operation is not allowed for key with id %s", key.kid()))); + if (!checkKeyPermissions(this.key.getKeyOps(), KeyOperation.DECRYPT)) { + return Mono.error(new UnsupportedOperationException(String.format("Decrypt Operation is not allowed for " + + "key with id %s", key.getKid()))); } - return localKeyCryptographyClient.decryptAsync(algorithm, cipherText, iv, authenticationData, authenticationTag, context, key); + return localKeyCryptographyClient.decryptAsync(algorithm, cipherText, iv, authenticationData, + authenticationTag, context, key); } /** * Creates a signature from a digest using the configured key. The sign operation supports both asymmetric and * symmetric keys. This operation requires the keys/sign permission. * - *

The {@link SignatureAlgorithm signature algorithm} indicates the type of algorithm to use to create the signature from the digest. Possible values include: - * {@link SignatureAlgorithm#ES256 ES256}, {@link SignatureAlgorithm#ES384 E384}, {@link SignatureAlgorithm#ES512 ES512}, - * {@link SignatureAlgorithm#ES256K ES246K}, {@link SignatureAlgorithm#PS256 PS256}, {@link SignatureAlgorithm#RS384 RS384}, - * {@link SignatureAlgorithm#RS512 RS512}, {@link SignatureAlgorithm#RS256 RS256}, {@link SignatureAlgorithm#RS384 RS384} and - * {@link SignatureAlgorithm#RS512 RS512}

+ *

The {@link SignatureAlgorithm signature algorithm} indicates the type of algorithm to use to create the + * signature from the digest. Possible values include: + * {@link SignatureAlgorithm#ES256 ES256}, {@link SignatureAlgorithm#ES384 E384}, + * {@link SignatureAlgorithm#ES512 ES512}, {@link SignatureAlgorithm#ES256K ES246K}, + * {@link SignatureAlgorithm#PS256 PS256}, {@link SignatureAlgorithm#RS384 RS384}, + * {@link SignatureAlgorithm#RS512 RS512}, {@link SignatureAlgorithm#RS256 RS256}, + * {@link SignatureAlgorithm#RS384 RS384} and {@link SignatureAlgorithm#RS512 RS512}

* *

Code Samples

- *

Sings the digest. Subscribes to the call asynchronously and prints out the signature details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.sign} + *

Sings the digest. Subscribes to the call asynchronously and prints out the signature details when a response + * has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.sign#SignatureAlgorithm-byte} * * @param algorithm The algorithm to use for signing. * @param digest The content from which signature is to be created. + * @return A {@link Mono} containing a {@link SignResult} whose {@link SignResult#getSignature() signature} contains + * the created signature. * @throws ResourceNotFoundException if the key cannot be found for signing. * @throws NullPointerException if {@code algorithm} or {@code digest} is null. - * @return A {@link Mono} containing a {@link SignResult} whose {@link SignResult#signature() signature} contains the created signature. */ public Mono sign(SignatureAlgorithm algorithm, byte[] digest) { return withContext(context -> sign(algorithm, digest, context)); @@ -318,33 +364,37 @@ Mono sign(SignatureAlgorithm algorithm, byte[] digest, Context conte return cryptographyServiceClient.sign(algorithm, digest, context); } - if (!checkKeyPermissions(this.key.keyOps(), KeyOperation.SIGN)) { - return Mono.error(new UnsupportedOperationException(String.format("Sign Operation is not allowed for key with id %s", key.kid()))); + if (!checkKeyPermissions(this.key.getKeyOps(), KeyOperation.SIGN)) { + return Mono.error(new UnsupportedOperationException(String.format("Sign Operation is not allowed for key " + + "with id %s", key.getKid()))); } return localKeyCryptographyClient.signAsync(algorithm, digest, context, key); } /** - * Verifies a signature using the configured key. The verify operation supports both symmetric keys and asymmetric keys. - * In case of asymmetric keys public portion of the key is used to verify the signature . This operation requires the keys/verify permission. + * Verifies a signature using the configured key. The verify operation supports both symmetric keys and asymmetric + * keys. In case of asymmetric keys public portion of the key is used to verify the signature . This operation + * requires the keys/verify permission. * - *

The {@link SignatureAlgorithm signature algorithm} indicates the type of algorithm to use to verify the signature. Possible values include: - * {@link SignatureAlgorithm#ES256 ES256}, {@link SignatureAlgorithm#ES384 E384}, {@link SignatureAlgorithm#ES512 ES512}, - * {@link SignatureAlgorithm#ES256K ES246K}, {@link SignatureAlgorithm#PS256 PS256}, {@link SignatureAlgorithm#RS384 RS384}, - * {@link SignatureAlgorithm#RS512 RS512}, {@link SignatureAlgorithm#RS256 RS256}, {@link SignatureAlgorithm#RS384 RS384} and - * {@link SignatureAlgorithm#RS512 RS512}

+ *

The {@link SignatureAlgorithm signature algorithm} indicates the type of algorithm to use to verify the + * signature. Possible values include: + * {@link SignatureAlgorithm#ES256 ES256}, {@link SignatureAlgorithm#ES384 E384}, {@link SignatureAlgorithm#ES512 + * ES512}, {@link SignatureAlgorithm#ES256K ES246K}, {@link SignatureAlgorithm#PS256 PS256}, {@link + * SignatureAlgorithm#RS384 RS384}, {@link SignatureAlgorithm#RS512 RS512}, {@link SignatureAlgorithm#RS256 RS256}, + * {@link SignatureAlgorithm#RS384 RS384} and {@link SignatureAlgorithm#RS512 RS512}

* *

Code Samples

- *

Verifies the signature against the specified digest. Subscribes to the call asynchronously and prints out the verification details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.verify} + *

Verifies the signature against the specified digest. Subscribes to the call asynchronously and prints out the + * verification details when a response has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.verify#SignatureAlgorithm-byte-byte} * * @param algorithm The algorithm to use for signing. * @param digest The content from which signature is to be created. * @param signature The signature to be verified. + * @return A {@link Mono} containing a {@link Boolean} indicating the signature verification result. * @throws ResourceNotFoundException if the key cannot be found for verifying. * @throws NullPointerException if {@code algorithm}, {@code digest} or {@code signature} is null. - * @return A {@link Mono} containing a {@link Boolean} indicating the signature verification result. */ public Mono verify(SignatureAlgorithm algorithm, byte[] digest, byte[] signature) { return withContext(context -> verify(algorithm, digest, signature, context)); @@ -360,8 +410,9 @@ Mono verify(SignatureAlgorithm algorithm, byte[] digest, byte[] si return cryptographyServiceClient.verify(algorithm, digest, signature, context); } - if (!checkKeyPermissions(this.key.keyOps(), KeyOperation.VERIFY)) { - return Mono.error(new UnsupportedOperationException(String.format("Verify Operation is not allowed for key with id %s", key.kid()))); + if (!checkKeyPermissions(this.key.getKeyOps(), KeyOperation.VERIFY)) { + return Mono.error(new UnsupportedOperationException(String.format("Verify Operation is not allowed for " + + "key with id %s", key.getKid()))); } return localKeyCryptographyClient.verifyAsync(algorithm, digest, signature, context, key); } @@ -370,18 +421,22 @@ Mono verify(SignatureAlgorithm algorithm, byte[] digest, byte[] si * Wraps a symmetric key using the configured key. The wrap operation supports wrapping a symmetric key with both * symmetric and asymmetric keys. This operation requires the keys/wrapKey permission. * - *

The {@link KeyWrapAlgorithm wrap algorithm} indicates the type of algorithm to use for wrapping the specified key content. Possible values include: - * {@link KeyWrapAlgorithm#RSA1_5 RSA1_5}, {@link KeyWrapAlgorithm#RSA_OAEP RSA_OAEP} and {@link KeyWrapAlgorithm#RSA_OAEP_256 RSA_OAEP_256}

+ *

The {@link KeyWrapAlgorithm wrap algorithm} indicates the type of algorithm to use for wrapping the specified + * key content. Possible values include: + * {@link KeyWrapAlgorithm#RSA1_5 RSA1_5}, {@link KeyWrapAlgorithm#RSA_OAEP RSA_OAEP} and {@link + * KeyWrapAlgorithm#RSA_OAEP_256 RSA_OAEP_256}

* *

Code Samples

- *

Wraps the key content. Subscribes to the call asynchronously and prints out the wrapped key details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.wrap-key} + *

Wraps the key content. Subscribes to the call asynchronously and prints out the wrapped key details when a + * response has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.wrapKey#KeyWrapAlgorithm-byte} * * @param algorithm The encryption algorithm to use for wrapping the key. * @param key The key content to be wrapped + * @return A {@link Mono} containing a {@link KeyWrapResult} whose {@link KeyWrapResult#getEncryptedKey() encrypted + * key} contains the wrapped key result. * @throws ResourceNotFoundException if the key cannot be found for wrap operation. * @throws NullPointerException if {@code algorithm} or {@code key} is null. - * @return A {@link Mono} containing a {@link KeyWrapResult} whose {@link KeyWrapResult#encryptedKey() encrypted key} contains the wrapped key result. */ public Mono wrapKey(KeyWrapAlgorithm algorithm, byte[] key) { return withContext(context -> wrapKey(algorithm, key, context)); @@ -396,30 +451,37 @@ Mono wrapKey(KeyWrapAlgorithm algorithm, byte[] key, Context cont return cryptographyServiceClient.wrapKey(algorithm, key, context); } - if (!checkKeyPermissions(this.key.keyOps(), KeyOperation.WRAP_KEY)) { - return Mono.error(new UnsupportedOperationException(String.format("Wrap Key Operation is not allowed for key with id %s", this.key.kid()))); + if (!checkKeyPermissions(this.key.getKeyOps(), KeyOperation.WRAP_KEY)) { + return Mono.error(new UnsupportedOperationException(String.format("Wrap Key Operation is not allowed for " + + "key with id %s", this.key.getKid()))); } return localKeyCryptographyClient.wrapKeyAsync(algorithm, key, context, this.key); } /** - * Unwraps a symmetric key using the configured key that was initially used for wrapping that key. This operation is the reverse of the wrap operation. - * The unwrap operation supports asymmetric and symmetric keys to unwrap. This operation requires the keys/unwrapKey permission. - * - *

The {@link KeyWrapAlgorithm wrap algorithm} indicates the type of algorithm to use for unwrapping the specified encrypted key content. Possible values for asymmetric keys include: - * {@link KeyWrapAlgorithm#RSA1_5 RSA1_5}, {@link KeyWrapAlgorithm#RSA_OAEP RSA_OAEP} and {@link KeyWrapAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. - * Possible values for symmetric keys include: {@link KeyWrapAlgorithm#A128KW A128KW}, {@link KeyWrapAlgorithm#A192KW A192KW} and {@link KeyWrapAlgorithm#A256KW A256KW}

+ * Unwraps a symmetric key using the configured key that was initially used for wrapping that key. This operation is + * the reverse of the wrap operation. + * The unwrap operation supports asymmetric and symmetric keys to unwrap. This operation requires the keys/unwrapKey + * permission. + * + *

The {@link KeyWrapAlgorithm wrap algorithm} indicates the type of algorithm to use for unwrapping the + * specified encrypted key content. Possible values for asymmetric keys include: + * {@link KeyWrapAlgorithm#RSA1_5 RSA1_5}, {@link KeyWrapAlgorithm#RSA_OAEP RSA_OAEP} and {@link + * KeyWrapAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. + * Possible values for symmetric keys include: {@link KeyWrapAlgorithm#A128KW A128KW}, {@link + * KeyWrapAlgorithm#A192KW A192KW} and {@link KeyWrapAlgorithm#A256KW A256KW}

* *

Code Samples

- *

Unwraps the key content. Subscribes to the call asynchronously and prints out the unwrapped key details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.unwrap-key} + *

Unwraps the key content. Subscribes to the call asynchronously and prints out the unwrapped key details when a + * response has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.unwrapKey#KeyWrapAlgorithm-byte} * * @param algorithm The encryption algorithm to use for wrapping the key. * @param encryptedKey The encrypted key content to unwrap. + * @return A {@link Mono} containing a the unwrapped key content. * @throws ResourceNotFoundException if the key cannot be found for wrap operation. * @throws NullPointerException if {@code algorithm} or {@code encryptedKey} is null. - * @return A {@link Mono} containing a the unwrapped key content. */ public Mono unwrapKey(KeyWrapAlgorithm algorithm, byte[] encryptedKey) { return withContext(context -> unwrapKey(algorithm, encryptedKey, context)); @@ -435,31 +497,36 @@ Mono unwrapKey(KeyWrapAlgorithm algorithm, byte[] encryptedKey, return cryptographyServiceClient.unwrapKey(algorithm, encryptedKey, context); } - if (!checkKeyPermissions(this.key.keyOps(), KeyOperation.WRAP_KEY)) { - return Mono.error(new UnsupportedOperationException(String.format("Unwrap Key Operation is not allowed for key with id %s", this.key.kid()))); + if (!checkKeyPermissions(this.key.getKeyOps(), KeyOperation.WRAP_KEY)) { + return Mono.error(new UnsupportedOperationException(String.format("Unwrap Key Operation is not allowed " + + "for key with id %s", this.key.getKid()))); } return localKeyCryptographyClient.unwrapKeyAsync(algorithm, encryptedKey, context, key); } /** - * Creates a signature from the raw data using the configured key. The sign data operation supports both asymmetric and - * symmetric keys. This operation requires the keys/sign permission. - * - *

The {@link SignatureAlgorithm signature algorithm} indicates the type of algorithm to use to sign the digest. Possible values include: - * {@link SignatureAlgorithm#ES256 ES256}, {@link SignatureAlgorithm#ES384 E384}, {@link SignatureAlgorithm#ES512 ES512}, - * {@link SignatureAlgorithm#ES256K ES246K}, {@link SignatureAlgorithm#PS256 PS256}, {@link SignatureAlgorithm#RS384 RS384}, - * {@link SignatureAlgorithm#RS512 RS512}, {@link SignatureAlgorithm#RS256 RS256}, {@link SignatureAlgorithm#RS384 RS384} and + * Creates a signature from the raw data using the configured key. The sign data operation supports both asymmetric + * and symmetric keys. This operation requires the keys/sign permission. + * + *

The {@link SignatureAlgorithm signature algorithm} indicates the type of algorithm to use to sign the digest. + * Possible values include: + * {@link SignatureAlgorithm#ES256 ES256}, {@link SignatureAlgorithm#ES384 E384}, {@link SignatureAlgorithm#ES512 + * ES512}, {@link SignatureAlgorithm#ES256K ES246K}, {@link SignatureAlgorithm#PS256 PS256}, + * {@link SignatureAlgorithm#RS384 RS384}, {@link SignatureAlgorithm#RS512 RS512}, {@link + * SignatureAlgorithm#RS256 RS256}, {@link SignatureAlgorithm#RS384 RS384} and * {@link SignatureAlgorithm#RS512 RS512}

* *

Code Samples

- *

Signs the raw data. Subscribes to the call asynchronously and prints out the signature details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.sign-data} + *

Signs the raw data. Subscribes to the call asynchronously and prints out the signature details when a response + * has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.signData#SignatureAlgorithm-byte} * * @param algorithm The algorithm to use for signing. * @param data The content from which signature is to be created. + * @return A {@link Mono} containing a {@link SignResult} whose {@link SignResult#getSignature() signature} contains + * the created signature. * @throws ResourceNotFoundException if the key cannot be found for signing. * @throws NullPointerException if {@code algorithm} or {@code data} is null. - * @return A {@link Mono} containing a {@link SignResult} whose {@link SignResult#signature() signature} contains the created signature. */ public Mono signData(SignatureAlgorithm algorithm, byte[] data) { return withContext(context -> signData(algorithm, data, context)); @@ -475,32 +542,37 @@ Mono signData(SignatureAlgorithm algorithm, byte[] data, Context con return cryptographyServiceClient.signData(algorithm, data, context); } - if (!checkKeyPermissions(this.key.keyOps(), KeyOperation.SIGN)) { - return Mono.error(new UnsupportedOperationException(String.format("Sign Operation is not allowed for key with id %s", this.key.kid()))); + if (!checkKeyPermissions(this.key.getKeyOps(), KeyOperation.SIGN)) { + return Mono.error(new UnsupportedOperationException(String.format("Sign Operation is not allowed for key " + + "with id %s", this.key.getKid()))); } return localKeyCryptographyClient.signDataAsync(algorithm, data, context, key); } /** - * Verifies a signature against the raw data using the configured key. The verify operation supports both symmetric keys and asymmetric keys. - * In case of asymmetric keys public portion of the key is used to verify the signature . This operation requires the keys/verify permission. - * - *

The {@link SignatureAlgorithm signature algorithm} indicates the type of algorithm to use to verify the signature. Possible values include: - * {@link SignatureAlgorithm#ES256 ES256}, {@link SignatureAlgorithm#ES384 E384}, {@link SignatureAlgorithm#ES512 ES512}, - * {@link SignatureAlgorithm#ES256K ES246K}, {@link SignatureAlgorithm#PS256 PS256}, {@link SignatureAlgorithm#RS384 RS384}, - * {@link SignatureAlgorithm#RS512 RS512}, {@link SignatureAlgorithm#RS256 RS256}, {@link SignatureAlgorithm#RS384 RS384} and - * {@link SignatureAlgorithm#RS512 RS512}

+ * Verifies a signature against the raw data using the configured key. The verify operation supports both symmetric + * keys and asymmetric keys. + * In case of asymmetric keys public portion of the key is used to verify the signature . This operation requires + * the keys/verify permission. + * + *

The {@link SignatureAlgorithm signature algorithm} indicates the type of algorithm to use to verify the + * signature. Possible values include: + * {@link SignatureAlgorithm#ES256 ES256}, {@link SignatureAlgorithm#ES384 E384}, {@link SignatureAlgorithm#ES512 + * ES512}, {@link SignatureAlgorithm#ES256K ES246K}, {@link SignatureAlgorithm#PS256 PS256}, {@link + * SignatureAlgorithm#RS384 RS384}, {@link SignatureAlgorithm#RS512 RS512}, {@link SignatureAlgorithm#RS256 RS256}, + * {@link SignatureAlgorithm#RS384 RS384} and {@link SignatureAlgorithm#RS512 RS512}

* *

Code Samples

- *

Verifies the signature against the raw data. Subscribes to the call asynchronously and prints out the verification details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.verify-data} + *

Verifies the signature against the raw data. Subscribes to the call asynchronously and prints out the + * verification details when a response has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.verifyData#SignatureAlgorithm-byte-byte} * * @param algorithm The algorithm to use for signing. * @param data The raw content against which signature is to be verified. * @param signature The signature to be verified. + * @return The {@link Boolean} indicating the signature verification result. * @throws ResourceNotFoundException if the key cannot be found for verifying. * @throws NullPointerException if {@code algorithm}, {@code data} or {@code signature} is null. - * @return The {@link Boolean} indicating the signature verification result. */ public Mono verifyData(SignatureAlgorithm algorithm, byte[] data, byte[] signature) { return withContext(context -> verifyData(algorithm, data, signature, context)); @@ -516,15 +588,16 @@ Mono verifyData(SignatureAlgorithm algorithm, byte[] data, byte[] return cryptographyServiceClient.verifyData(algorithm, data, signature, context); } - if (!checkKeyPermissions(this.key.keyOps(), KeyOperation.VERIFY)) { - return Mono.error(new UnsupportedOperationException(String.format("Verify Operation is not allowed for key with id %s", this.key.kid()))); + if (!checkKeyPermissions(this.key.getKeyOps(), KeyOperation.VERIFY)) { + return Mono.error(new UnsupportedOperationException(String.format( + "Verify Operation is not allowed for key with id %s", this.key.getKid()))); } return localKeyCryptographyClient.verifyDataAsync(algorithm, data, signature, context, key); } private void unpackAndValidateId(String keyId) { if (ImplUtils.isNullOrEmpty(keyId)) { - throw new IllegalArgumentException("Key Id is invalid"); + throw logger.logExceptionAsError(new IllegalArgumentException("Key Id is invalid")); } try { URL url = new URL(keyId); @@ -533,14 +606,14 @@ private void unpackAndValidateId(String keyId) { String keyName = (tokens.length >= 3 ? tokens[2] : null); String version = (tokens.length >= 4 ? tokens[3] : null); if (Strings.isNullOrEmpty(endpoint)) { - throw new IllegalArgumentException("Key endpoint in key id is invalid"); + throw logger.logExceptionAsError(new IllegalArgumentException("Key endpoint in key id is invalid")); } else if (Strings.isNullOrEmpty(keyName)) { - throw new IllegalArgumentException("Key name in key id is invalid"); + throw logger.logExceptionAsError(new IllegalArgumentException("Key name in key id is invalid")); } else if (Strings.isNullOrEmpty(version)) { - throw new IllegalArgumentException("Key version in key id is invalid"); + throw logger.logExceptionAsError(new IllegalArgumentException("Key version in key id is invalid")); } } catch (MalformedURLException e) { - throw new IllegalArgumentException("The key identifier is malformed", e); + throw logger.logExceptionAsError(new IllegalArgumentException("The key identifier is malformed", e)); } } @@ -552,7 +625,7 @@ private boolean ensureValidKeyAvailable() { boolean keyAvailableLocally = true; if (this.key == null) { try { - this.key = getKey().block().keyMaterial(); + this.key = getKey().block().getKeyMaterial(); keyAvailableLocally = this.key.isValid(); initializeCryptoClients(); } catch (HttpResponseException | NullPointerException e) { diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClient.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClient.java index a81b0222a896..7ca3e64a7938 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClient.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClient.java @@ -22,7 +22,8 @@ /** * The CryptographyClient provides synchronous methods to perform cryptographic operations using asymmetric and - * symmetric keys. The client supports encrypt, decrypt, wrap key, unwrap key, sign and verify operations using the configured key. + * symmetric keys. The client supports encrypt, decrypt, wrap key, unwrap key, sign and verify operations using the + * configured key. * *

Samples to construct the sync client

* {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.instantiation} @@ -43,30 +44,32 @@ public final class CryptographyClient { } /** - * Gets the public part of the configured key. The get key operation is applicable to all key types and it requires the {@code keys/get} permission. + * Gets the public part of the configured key. The get key operation is applicable to all key types and it requires + * the {@code keys/get} permission. * *

Code Samples

*

Gets the key configured in the client. Prints out the returned key details.

* {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.getKey} * - * @throws ResourceNotFoundException when the configured key doesn't exist in the key vault. * @return The requested {@link Key key}. + * @throws ResourceNotFoundException when the configured key doesn't exist in the key vault. */ @ServiceMethod(returns = ReturnType.SINGLE) public Key getKey() { - return getKeyWithResponse(Context.NONE).value(); + return getKeyWithResponse(Context.NONE).getValue(); } /** - * Gets the public part of the configured key. The get key operation is applicable to all key types and it requires the {@code keys/get} permission. + * Gets the public part of the configured key. The get key operation is applicable to all key types and it requires + * the {@code keys/get} permission. * *

Code Samples

*

Gets the key configured in the client. Prints out the returned key details.

* {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.getKeyWithResponse#Context} * * @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 requested {@link Key key}. * @throws ResourceNotFoundException when the configured key doesn't exist in the key vault. - * @return A {@link Response} whose {@link Response#value() value} contains the requested {@link Key key}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getKeyWithResponse(Context context) { @@ -75,124 +78,159 @@ public Response getKeyWithResponse(Context context) { /** * Encrypts an arbitrary sequence of bytes using the configured key. Note that the encrypt operation only supports a - * single block of data, the size of which is dependent on the target key and the encryption algorithm to be used. The encrypt - * operation is supported for both symmetric keys and asymmetric keys. In case of asymmetric keys public portion of the key is used - * for encryption. This operation requires the keys/encrypt permission. + * single block of data, the size of which is dependent on the target key and the encryption algorithm to be used. + * The encrypt operation is supported for both symmetric keys and asymmetric keys. In case of asymmetric keys public + * portion of the key is used for encryption. This operation requires the keys/encrypt permission. * - *

The {@link EncryptionAlgorithm encryption algorithm} indicates the type of algorithm to use for decrypting the specified encrypted content. Possible values - * for assymetric keys include: {@link EncryptionAlgorithm#RSA1_5 RSA1_5}, {@link EncryptionAlgorithm#RSA_OAEP RSA_OAEP} and {@link EncryptionAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. - * Possible values for symmetric keys include: {@link EncryptionAlgorithm#A128CBC A128CBC}, {@link EncryptionAlgorithm#A128CBC_HS256 A128CBC-HS256}, - * {@link EncryptionAlgorithm#A192CBC A192CBC}, {@link EncryptionAlgorithm#A192CBC_HS384 A192CBC-HS384}, {@link EncryptionAlgorithm#A256CBC A256CBC} and {@link EncryptionAlgorithm#A256CBC_HS512 A256CBC-HS512}

+ *

The {@link EncryptionAlgorithm encryption algorithm} indicates the type of algorithm to use for decrypting the + * specified encrypted content. Possible values for assymetric keys include: + * {@link EncryptionAlgorithm#RSA1_5 RSA1_5}, {@link EncryptionAlgorithm#RSA_OAEP RSA_OAEP} and + * {@link EncryptionAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. + * + * Possible values for symmetric keys include: {@link EncryptionAlgorithm#A128CBC A128CBC}, {@link + * EncryptionAlgorithm#A128CBC_HS256 A128CBC-HS256}, + * {@link EncryptionAlgorithm#A192CBC A192CBC}, {@link EncryptionAlgorithm#A192CBC_HS384 A192CBC-HS384}, {@link + * EncryptionAlgorithm#A256CBC A256CBC} and {@link EncryptionAlgorithm#A256CBC_HS512 A256CBC-HS512}

* *

Code Samples

*

Encrypts the content. Prints out the encrypted content details.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.encrypt#symmetric-encrypt} + * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.encrypt#EncryptionAlgorithm-byte-byte-byte} * * @param algorithm The algorithm to be used for encryption. * @param plaintext The content to be encrypted. * @param iv The initialization vector * @param authenticationData The authentication data + * @return A {@link EncryptResult} whose {@link EncryptResult#getCipherText() cipher text} contains the encrypted + * content. * @throws ResourceNotFoundException if the key cannot be found for encryption. * @throws NullPointerException if {@code algorithm} or {@code plainText} is null. - * @return A {@link EncryptResult} whose {@link EncryptResult#cipherText() cipher text} contains the encrypted content. */ - public EncryptResult encrypt(EncryptionAlgorithm algorithm, byte[] plaintext, byte[] iv, byte[] authenticationData) { + public EncryptResult encrypt(EncryptionAlgorithm algorithm, byte[] plaintext, byte[] iv, + byte[] authenticationData) { return encrypt(algorithm, plaintext, iv, authenticationData, Context.NONE); } /** * Encrypts an arbitrary sequence of bytes using the configured key. Note that the encrypt operation only supports a - * single block of data, the size of which is dependent on the target key and the encryption algorithm to be used. The encrypt - * operation is supported for both symmetric keys and asymmetric keys. In case of asymmetric keys public portion of the key is used + * single block of data, the size of which is dependent on the target key and the encryption algorithm to be used. + * The encrypt operation is supported for both symmetric keys and asymmetric keys. In case of asymmetric keys public + * portion of the key is used * for encryption. This operation requires the keys/encrypt permission. * - *

The {@link EncryptionAlgorithm encryption algorithm} indicates the type of algorithm to use for decrypting the specified encrypted content. Possible values - * for assymetric keys include: {@link EncryptionAlgorithm#RSA1_5 RSA1_5}, {@link EncryptionAlgorithm#RSA_OAEP RSA_OAEP} and {@link EncryptionAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. - * Possible values for symmetric keys include: {@link EncryptionAlgorithm#A128CBC A128CBC}, {@link EncryptionAlgorithm#A128CBC_HS256 A128CBC-HS256}, - * {@link EncryptionAlgorithm#A192CBC A192CBC}, {@link EncryptionAlgorithm#A192CBC_HS384 A192CBC-HS384}, {@link EncryptionAlgorithm#A256CBC A256CBC} and {@link EncryptionAlgorithm#A256CBC_HS512 A256CBC-HS512}

+ *

The {@link EncryptionAlgorithm encryption algorithm} indicates the type of algorithm to use for decrypting the + * specified encrypted content. Possible values for assymetric keys include: + * {@link EncryptionAlgorithm#RSA1_5 RSA1_5}, {@link EncryptionAlgorithm#RSA_OAEP RSA_OAEP} and + * {@link EncryptionAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. + * + * Possible values for symmetric keys include: {@link EncryptionAlgorithm#A128CBC A128CBC}, {@link + * EncryptionAlgorithm#A128CBC_HS256 A128CBC-HS256}, {@link EncryptionAlgorithm#A192CBC A192CBC}, + * {@link EncryptionAlgorithm#A192CBC_HS384 A192CBC-HS384}, {@link EncryptionAlgorithm#A256CBC A256CBC} and + * {@link EncryptionAlgorithm#A256CBC_HS512 A256CBC-HS512}

* *

Code Samples

- *

Encrypts the content. Subscribes to the call asynchronously and prints out the encrypted content details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.encrypt#symmetric-encrypt-Context} + *

Encrypts the content. Subscribes to the call asynchronously and prints out the encrypted content details when + * a response has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.encrypt#EncryptionAlgorithm-byte-byte-byte-Context} * * @param algorithm The algorithm to be used for encryption. * @param plaintext The content to be encrypted. * @param iv The initialization vector * @param authenticationData The authentication data * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A {@link EncryptResult} whose {@link EncryptResult#getCipherText() cipher text} contains the encrypted + * content. * @throws ResourceNotFoundException if the key cannot be found for encryption. * @throws NullPointerException if {@code algorithm} or {@code plainText} is null. - * @return A {@link EncryptResult} whose {@link EncryptResult#cipherText() cipher text} contains the encrypted content. */ - public EncryptResult encrypt(EncryptionAlgorithm algorithm, byte[] plaintext, byte[] iv, byte[] authenticationData, Context context) { + public EncryptResult encrypt(EncryptionAlgorithm algorithm, byte[] plaintext, byte[] iv, byte[] authenticationData, + Context context) { return client.encrypt(algorithm, plaintext, context, iv, authenticationData).block(); } /** * Encrypts an arbitrary sequence of bytes using the configured key. Note that the encrypt operation only supports a - * single block of data, the size of which is dependent on the target key and the encryption algorithm to be used. The encrypt - * operation is supported for both symmetric keys and asymmetric keys. In case of asymmetric keys public portion of the key is used - * for encryption. This operation requires the keys/encrypt permission. - * - *

The {@link EncryptionAlgorithm encryption algorithm} indicates the type of algorithm to use for decrypting the specified encrypted content. Possible values - * for assymetric keys include: {@link EncryptionAlgorithm#RSA1_5 RSA1_5}, {@link EncryptionAlgorithm#RSA_OAEP RSA_OAEP} and {@link EncryptionAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. - * Possible values for symmetric keys include: {@link EncryptionAlgorithm#A128CBC A128CBC}, {@link EncryptionAlgorithm#A128CBC_HS256 A128CBC-HS256}, - * {@link EncryptionAlgorithm#A192CBC A192CBC}, {@link EncryptionAlgorithm#A192CBC_HS384 A192CBC-HS384}, {@link EncryptionAlgorithm#A256CBC A256CBC} and {@link EncryptionAlgorithm#A256CBC_HS512 A256CBC-HS512}

+ * single block of data, the size of which is dependent on the target key and the encryption algorithm to be used. + * The encrypt operation is supported for both symmetric keys and asymmetric keys. In case of asymmetric keys public + * portion of the key is used for encryption. This operation requires the keys/encrypt permission. + * + *

The {@link EncryptionAlgorithm encryption algorithm} indicates the type of algorithm to use for decrypting the + * specified encrypted content. Possible values + * for assymetric keys include: {@link EncryptionAlgorithm#RSA1_5 RSA1_5}, {@link EncryptionAlgorithm#RSA_OAEP + * RSA_OAEP} and {@link EncryptionAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. + * Possible values for symmetric keys include: {@link EncryptionAlgorithm#A128CBC A128CBC}, {@link + * EncryptionAlgorithm#A128CBC_HS256 A128CBC-HS256}, + * {@link EncryptionAlgorithm#A192CBC A192CBC}, {@link EncryptionAlgorithm#A192CBC_HS384 A192CBC-HS384}, {@link + * EncryptionAlgorithm#A256CBC A256CBC} and {@link EncryptionAlgorithm#A256CBC_HS512 A256CBC-HS512}

* *

Code Samples

- *

Encrypts the content. Subscribes to the call asynchronously and prints out the encrypted content details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.encrypt#asymmetric-encrypt} + *

Encrypts the content. Subscribes to the call asynchronously and prints out the encrypted content details when + * a response has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.encrypt#EncryptionAlgorithm-byte} * * @param algorithm The algorithm to be used for encryption. * @param plaintext The content to be encrypted. + * @return The {@link EncryptResult} whose {@link EncryptResult#getCipherText() cipher text} contains the encrypted + * content. * @throws ResourceNotFoundException if the key cannot be found for encryption. * @throws NullPointerException if {@code algorithm} or {@code plainText} is null. - * @return The {@link EncryptResult} whose {@link EncryptResult#cipherText() cipher text} contains the encrypted content. */ public EncryptResult encrypt(EncryptionAlgorithm algorithm, byte[] plaintext) { return encrypt(algorithm, plaintext, null, null, Context.NONE); } /** - * Decrypts a single block of encrypted data using the configured key and specified algorithm. Note that only a single block of data may be - * decrypted, the size of this block is dependent on the target key and the algorithm to be used. The decrypt operation - * is supported for both asymmetric and symmetric keys. This operation requires the keys/decrypt permission. - * - *

The {@link EncryptionAlgorithm encryption algorithm} indicates the type of algorithm to use for decrypting the specified encrypted content. Possible values - * for assymetric keys include: {@link EncryptionAlgorithm#RSA1_5 RSA1_5}, {@link EncryptionAlgorithm#RSA_OAEP RSA_OAEP} and {@link EncryptionAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. - * Possible values for symmetric keys include: {@link EncryptionAlgorithm#A128CBC A128CBC}, {@link EncryptionAlgorithm#A128CBC_HS256 A128CBC-HS256}, - * {@link EncryptionAlgorithm#A192CBC A192CBC}, {@link EncryptionAlgorithm#A192CBC_HS384 A192CBC-HS384}, {@link EncryptionAlgorithm#A256CBC A256CBC} and {@link EncryptionAlgorithm#A256CBC_HS512 A256CBC-HS512}

+ * Decrypts a single block of encrypted data using the configured key and specified algorithm. Note that only a + * single block of data may be decrypted, the size of this block is dependent on the target key and the algorithm to + * be used. The decrypt operation is supported for both asymmetric and symmetric keys. This operation requires the + * keys/decrypt permission. + * + *

The {@link EncryptionAlgorithm encryption algorithm} indicates the type of algorithm to use for decrypting the + * specified encrypted content. Possible values + * for assymetric keys include: {@link EncryptionAlgorithm#RSA1_5 RSA1_5}, {@link EncryptionAlgorithm#RSA_OAEP + * RSA_OAEP} and {@link EncryptionAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. + * Possible values for symmetric keys include: {@link EncryptionAlgorithm#A128CBC A128CBC}, {@link + * EncryptionAlgorithm#A128CBC_HS256 A128CBC-HS256}, + * {@link EncryptionAlgorithm#A192CBC A192CBC}, {@link EncryptionAlgorithm#A192CBC_HS384 A192CBC-HS384}, {@link + * EncryptionAlgorithm#A256CBC A256CBC} and {@link EncryptionAlgorithm#A256CBC_HS512 A256CBC-HS512}

* *

Code Samples

- *

Decrypts the encrypted content. Subscribes to the call asynchronously and prints out the decrypted content details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.decrypt#symmetric-decrypt} + *

Decrypts the encrypted content. Subscribes to the call asynchronously and prints out the decrypted content + * details when a response has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.decrypt#EncryptionAlgorithm-byte-byte-byte-byte} * * @param algorithm The algorithm to be used for decryption. * @param cipherText The content to be decrypted. * @param iv The initialization vector. * @param authenticationData The authentication data. * @param authenticationTag The authentication tag. + * @return The decrypted blob. * @throws ResourceNotFoundException if the key cannot be found for decryption. * @throws NullPointerException if {@code algorithm} or {@code cipherText} is null. - * @return The decrypted blob. */ - public DecryptResult decrypt(EncryptionAlgorithm algorithm, byte[] cipherText, byte[] iv, byte[] authenticationData, byte[] authenticationTag) { + public DecryptResult decrypt(EncryptionAlgorithm algorithm, byte[] cipherText, byte[] iv, byte[] authenticationData, + byte[] authenticationTag) { return decrypt(algorithm, cipherText, iv, authenticationData, authenticationTag, Context.NONE); } /** - * Decrypts a single block of encrypted data using the configured key and specified algorithm. Note that only a single block of data may be - * decrypted, the size of this block is dependent on the target key and the algorithm to be used. The decrypt operation - * is supported for both asymmetric and symmetric keys. This operation requires the keys/decrypt permission. - * - *

The {@link EncryptionAlgorithm encryption algorithm} indicates the type of algorithm to use for decrypting the specified encrypted content. Possible values - * for assymetric keys include: {@link EncryptionAlgorithm#RSA1_5 RSA1_5}, {@link EncryptionAlgorithm#RSA_OAEP RSA_OAEP} and {@link EncryptionAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. - * Possible values for symmetric keys include: {@link EncryptionAlgorithm#A128CBC A128CBC}, {@link EncryptionAlgorithm#A128CBC_HS256 A128CBC-HS256}, - * {@link EncryptionAlgorithm#A192CBC A192CBC}, {@link EncryptionAlgorithm#A192CBC_HS384 A192CBC-HS384}, {@link EncryptionAlgorithm#A256CBC A256CBC} and {@link EncryptionAlgorithm#A256CBC_HS512 A256CBC-HS512}

+ * Decrypts a single block of encrypted data using the configured key and specified algorithm. Note that only a + * single block of data may be decrypted, the size of this block is dependent on the target key and the algorithm to + * be used. The decrypt operation is supported for both asymmetric and symmetric keys. This operation requires the + * keys/decrypt permission. + * + *

The {@link EncryptionAlgorithm encryption algorithm} indicates the type of algorithm to use for decrypting the + * specified encrypted content. Possible values + * for assymetric keys include: {@link EncryptionAlgorithm#RSA1_5 RSA1_5}, {@link EncryptionAlgorithm#RSA_OAEP + * RSA_OAEP} and {@link EncryptionAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. + * Possible values for symmetric keys include: {@link EncryptionAlgorithm#A128CBC A128CBC}, {@link + * EncryptionAlgorithm#A128CBC_HS256 A128CBC-HS256}, + * {@link EncryptionAlgorithm#A192CBC A192CBC}, {@link EncryptionAlgorithm#A192CBC_HS384 A192CBC-HS384}, {@link + * EncryptionAlgorithm#A256CBC A256CBC} and {@link EncryptionAlgorithm#A256CBC_HS512 A256CBC-HS512}

* *

Code Samples

- *

Decrypts the encrypted content. Subscribes to the call asynchronously and prints out the decrypted content details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.decrypt#symmetric-decrypt-Context} + *

Decrypts the encrypted content. Subscribes to the call asynchronously and prints out the decrypted content + * details when a response has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.decrypt#EncryptionAlgorithm-byte-byte-byte-byte-Context} * * @param algorithm The algorithm to be used for decryption. * @param cipherText The content to be decrypted. @@ -200,33 +238,40 @@ public DecryptResult decrypt(EncryptionAlgorithm algorithm, byte[] cipherText, b * @param authenticationData The authentication data. * @param authenticationTag The authentication tag. * @param context Additional context that is passed through the Http pipeline during the service call. + * @return The decrypted blob. * @throws ResourceNotFoundException if the key cannot be found for decryption. * @throws NullPointerException if {@code algorithm} or {@code cipherText} is null. - * @return The decrypted blob. */ - public DecryptResult decrypt(EncryptionAlgorithm algorithm, byte[] cipherText, byte[] iv, byte[] authenticationData, byte[] authenticationTag, Context context) { + public DecryptResult decrypt(EncryptionAlgorithm algorithm, byte[] cipherText, byte[] iv, byte[] authenticationData, + byte[] authenticationTag, Context context) { return client.decrypt(algorithm, cipherText, iv, authenticationData, authenticationTag, context).block(); } /** - * Decrypts a single block of encrypted data using the configured key and specified algorithm. Note that only a single block of data may be - * decrypted, the size of this block is dependent on the target key and the algorithm to be used. The decrypt operation - * is supported for both asymmetric and symmetric keys. This operation requires the keys/decrypt permission. - * - *

The {@link EncryptionAlgorithm encryption algorithm} indicates the type of algorithm to use for decrypting the specified encrypted content. Possible values - * for assymetric keys include: {@link EncryptionAlgorithm#RSA1_5 RSA1_5}, {@link EncryptionAlgorithm#RSA_OAEP RSA_OAEP} and {@link EncryptionAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. - * Possible values for symmetric keys include: {@link EncryptionAlgorithm#A128CBC A128CBC}, {@link EncryptionAlgorithm#A128CBC_HS256 A128CBC-HS256}, - * {@link EncryptionAlgorithm#A192CBC A192CBC}, {@link EncryptionAlgorithm#A192CBC_HS384 A192CBC-HS384}, {@link EncryptionAlgorithm#A256CBC A256CBC} and {@link EncryptionAlgorithm#A256CBC_HS512 A256CBC-HS512}

+ * Decrypts a single block of encrypted data using the configured key and specified algorithm. Note that only a + * single block of data may be decrypted, the size of this block is dependent on the target key and the algorithm to + * be used. The decrypt operation is supported for both asymmetric and symmetric keys. This operation requires the + * keys/decrypt permission. + * + *

The {@link EncryptionAlgorithm encryption algorithm} indicates the type of algorithm to use for decrypting the + * specified encrypted content. Possible values + * for assymetric keys include: {@link EncryptionAlgorithm#RSA1_5 RSA1_5}, {@link EncryptionAlgorithm#RSA_OAEP + * RSA_OAEP} and {@link EncryptionAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. + * Possible values for symmetric keys include: {@link EncryptionAlgorithm#A128CBC A128CBC}, {@link + * EncryptionAlgorithm#A128CBC_HS256 A128CBC-HS256}, + * {@link EncryptionAlgorithm#A192CBC A192CBC}, {@link EncryptionAlgorithm#A192CBC_HS384 A192CBC-HS384}, {@link + * EncryptionAlgorithm#A256CBC A256CBC} and {@link EncryptionAlgorithm#A256CBC_HS512 A256CBC-HS512}

* *

Code Samples

- *

Decrypts the encrypted content. Subscribes to the call asynchronously and prints out the decrypted content details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.decrypt#asymmetric-decrypt} + *

Decrypts the encrypted content. Subscribes to the call asynchronously and prints out the decrypted content + * details when a response has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.decrypt#EncryptionAlgorithm-byte} * * @param algorithm The algorithm to be used for decryption. * @param cipherText The content to be decrypted. + * @return The decrypted blob. * @throws ResourceNotFoundException if the key cannot be found for decryption. * @throws NullPointerException if {@code algorithm} or {@code cipherText} is null. - * @return The decrypted blob. */ public DecryptResult decrypt(EncryptionAlgorithm algorithm, byte[] cipherText) { return decrypt(algorithm, cipherText, null, null, null, Context.NONE); @@ -236,22 +281,25 @@ public DecryptResult decrypt(EncryptionAlgorithm algorithm, byte[] cipherText) { * Creates a signature from a digest using the configured key. The sign operation supports both asymmetric and * symmetric keys. This operation requires the keys/sign permission. * - *

The {@link SignatureAlgorithm signature algorithm} indicates the type of algorithm to use to create the signature from the digest. Possible values include: - * {@link SignatureAlgorithm#ES256 ES256}, {@link SignatureAlgorithm#ES384 E384}, {@link SignatureAlgorithm#ES512 ES512}, - * {@link SignatureAlgorithm#ES256K ES246K}, {@link SignatureAlgorithm#PS256 PS256}, {@link SignatureAlgorithm#RS384 RS384}, - * {@link SignatureAlgorithm#RS512 RS512}, {@link SignatureAlgorithm#RS256 RS256}, {@link SignatureAlgorithm#RS384 RS384} and - * {@link SignatureAlgorithm#RS512 RS512}

+ *

The {@link SignatureAlgorithm signature algorithm} indicates the type of algorithm to use to create the + * signature from the digest. Possible values include: + * {@link SignatureAlgorithm#ES256 ES256}, {@link SignatureAlgorithm#ES384 E384}, + * {@link SignatureAlgorithm#ES512 ES512}, {@link SignatureAlgorithm#ES256K ES246K}, + * {@link SignatureAlgorithm#PS256 PS256}, {@link SignatureAlgorithm#RS384 RS384}, + * {@link SignatureAlgorithm#RS512 RS512}, {@link SignatureAlgorithm#RS256 RS256}, + * {@link SignatureAlgorithm#RS384 RS384} and {@link SignatureAlgorithm#RS512 RS512}

* *

Code Samples

- *

Sings the digest. Subscribes to the call asynchronously and prints out the signature details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign-Context} + *

Sings the digest. Subscribes to the call asynchronously and prints out the signature details when a response + * has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.sign#SignatureAlgorithm-byte-Context} * * @param algorithm The algorithm to use for signing. * @param digest The content from which signature is to be created. * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A {@link SignResult} whose {@link SignResult#getSignature() signature} contains the created signature. * @throws ResourceNotFoundException if the key cannot be found for signing. * @throws NullPointerException if {@code algorithm} or {@code digest} is null. - * @return A {@link SignResult} whose {@link SignResult#signature() signature} contains the created signature. */ public SignResult sign(SignatureAlgorithm algorithm, byte[] digest, Context context) { return client.sign(algorithm, digest, context).block(); @@ -261,72 +309,85 @@ public SignResult sign(SignatureAlgorithm algorithm, byte[] digest, Context cont * Creates a signature from a digest using the configured key. The sign operation supports both asymmetric and * symmetric keys. This operation requires the keys/sign permission. * - *

The {@link SignatureAlgorithm signature algorithm} indicates the type of algorithm to use to create the signature from the digest. Possible values include: - * {@link SignatureAlgorithm#ES256 ES256}, {@link SignatureAlgorithm#ES384 E384}, {@link SignatureAlgorithm#ES512 ES512}, - * {@link SignatureAlgorithm#ES256K ES246K}, {@link SignatureAlgorithm#PS256 PS256}, {@link SignatureAlgorithm#RS384 RS384}, - * {@link SignatureAlgorithm#RS512 RS512}, {@link SignatureAlgorithm#RS256 RS256}, {@link SignatureAlgorithm#RS384 RS384} and - * {@link SignatureAlgorithm#RS512 RS512}

+ *

The {@link SignatureAlgorithm signature algorithm} indicates the type of algorithm to use to create the + * signature from the digest. Possible values include: + * {@link SignatureAlgorithm#ES256 ES256}, {@link SignatureAlgorithm#ES384 E384}, + * {@link SignatureAlgorithm#ES512 ES512}, {@link SignatureAlgorithm#ES256K ES246K}, + * {@link SignatureAlgorithm#PS256 PS256}, {@link SignatureAlgorithm#RS384 RS384}, + * {@link SignatureAlgorithm#RS512 RS512}, {@link SignatureAlgorithm#RS256 RS256}, + * {@link SignatureAlgorithm#RS384 RS384} and {@link SignatureAlgorithm#RS512 RS512}

* *

Code Samples

- *

Sings the digest. Subscribes to the call asynchronously and prints out the signature details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign} + *

Sings the digest. Subscribes to the call asynchronously and prints out the signature details when a response + * has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.sign#SignatureAlgorithm-byte} * * @param algorithm The algorithm to use for signing. * @param digest The content from which signature is to be created. + * @return A {@link SignResult} whose {@link SignResult#getSignature() signature} contains the created signature. * @throws ResourceNotFoundException if the key cannot be found for signing. * @throws NullPointerException if {@code algorithm} or {@code digest} is null. - * @return A {@link SignResult} whose {@link SignResult#signature() signature} contains the created signature. */ public SignResult sign(SignatureAlgorithm algorithm, byte[] digest) { return client.sign(algorithm, digest, Context.NONE).block(); } /** - * Verifies a signature using the configured key. The verify operation supports both symmetric keys and asymmetric keys. - * In case of asymmetric keys public portion of the key is used to verify the signature . This operation requires the keys/verify permission. - * - *

The {@link SignatureAlgorithm signature algorithm} indicates the type of algorithm to use to verify the signature. Possible values include: - * {@link SignatureAlgorithm#ES256 ES256}, {@link SignatureAlgorithm#ES384 E384}, {@link SignatureAlgorithm#ES512 ES512}, - * {@link SignatureAlgorithm#ES256K ES246K}, {@link SignatureAlgorithm#PS256 PS256}, {@link SignatureAlgorithm#RS384 RS384}, - * {@link SignatureAlgorithm#RS512 RS512}, {@link SignatureAlgorithm#RS256 RS256}, {@link SignatureAlgorithm#RS384 RS384} and - * {@link SignatureAlgorithm#RS512 RS512}

+ * Verifies a signature using the configured key. The verify operation supports both symmetric keys and asymmetric + * keys. + * In case of asymmetric keys public portion of the key is used to verify the signature . This operation requires + * the keys/verify permission. + * + *

The {@link SignatureAlgorithm signature algorithm} indicates the type of algorithm to use to create the + * signature from the digest. Possible values include: + * {@link SignatureAlgorithm#ES256 ES256}, {@link SignatureAlgorithm#ES384 E384}, + * {@link SignatureAlgorithm#ES512 ES512}, {@link SignatureAlgorithm#ES256K ES246K}, + * {@link SignatureAlgorithm#PS256 PS256}, {@link SignatureAlgorithm#RS384 RS384}, + * {@link SignatureAlgorithm#RS512 RS512}, {@link SignatureAlgorithm#RS256 RS256}, + * {@link SignatureAlgorithm#RS384 RS384} and {@link SignatureAlgorithm#RS512 RS512}

* *

Code Samples

- *

Verifies the signature against the specified digest. Subscribes to the call asynchronously and prints out the verification details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify} + *

Verifies the signature against the specified digest. Subscribes to the call asynchronously and prints out the + * verification details when a response has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.verify#SignatureAlgorithm-byte-byte} * * @param algorithm The algorithm to use for signing. * @param digest The content from which signature was created. * @param signature The signature to be verified. + * @return The {@link Boolean} indicating the signature verification result. * @throws ResourceNotFoundException if the key cannot be found for verifying. * @throws NullPointerException if {@code algorithm}, {@code digest} or {@code signature} is null. - * @return The {@link Boolean} indicating the signature verification result. */ public VerifyResult verify(SignatureAlgorithm algorithm, byte[] digest, byte[] signature) { return verify(algorithm, digest, signature, Context.NONE); } /** - * Verifies a signature using the configured key. The verify operation supports both symmetric keys and asymmetric keys. - * In case of asymmetric keys public portion of the key is used to verify the signature . This operation requires the keys/verify permission. - * - *

The {@link SignatureAlgorithm signature algorithm} indicates the type of algorithm to use to verify the signature. Possible values include: - * {@link SignatureAlgorithm#ES256 ES256}, {@link SignatureAlgorithm#ES384 E384}, {@link SignatureAlgorithm#ES512 ES512}, - * {@link SignatureAlgorithm#ES256K ES246K}, {@link SignatureAlgorithm#PS256 PS256}, {@link SignatureAlgorithm#RS384 RS384}, - * {@link SignatureAlgorithm#RS512 RS512}, {@link SignatureAlgorithm#RS256 RS256}, {@link SignatureAlgorithm#RS384 RS384} and - * {@link SignatureAlgorithm#RS512 RS512}

+ * Verifies a signature using the configured key. The verify operation supports both symmetric keys and asymmetric + * keys. + * In case of asymmetric keys public portion of the key is used to verify the signature . This operation requires + * the keys/verify permission. + * + *

The {@link SignatureAlgorithm signature algorithm} indicates the type of algorithm to use to create the + * signature from the digest. Possible values include: + * {@link SignatureAlgorithm#ES256 ES256}, {@link SignatureAlgorithm#ES384 E384}, + * {@link SignatureAlgorithm#ES512 ES512}, {@link SignatureAlgorithm#ES256K ES246K}, + * {@link SignatureAlgorithm#PS256 PS256}, {@link SignatureAlgorithm#RS384 RS384}, + * {@link SignatureAlgorithm#RS512 RS512}, {@link SignatureAlgorithm#RS256 RS256}, + * {@link SignatureAlgorithm#RS384 RS384} and {@link SignatureAlgorithm#RS512 RS512}

* *

Code Samples

- *

Verifies the signature against the specified digest. Subscribes to the call asynchronously and prints out the verification details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify-Context} + *

Verifies the signature against the specified digest. Subscribes to the call asynchronously and prints out the + * verification details when a response has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.verify#SignatureAlgorithm-byte-byte-Context} * * @param algorithm The algorithm to use for signing. * @param digest The content from which signature is to be created. * @param signature The signature to be verified. * @param context Additional context that is passed through the Http pipeline during the service call. + * @return The {@link Boolean} indicating the signature verification result. * @throws ResourceNotFoundException if the key cannot be found for verifying. * @throws NullPointerException if {@code algorithm}, {@code digest} or {@code signature} is null. - * @return The {@link Boolean} indicating the signature verification result. */ public VerifyResult verify(SignatureAlgorithm algorithm, byte[] digest, byte[] signature, Context context) { return client.verify(algorithm, digest, signature, context).block(); @@ -336,18 +397,22 @@ public VerifyResult verify(SignatureAlgorithm algorithm, byte[] digest, byte[] s * Wraps a symmetric key using the configured key. The wrap operation supports wrapping a symmetric key with both * symmetric and asymmetric keys. This operation requires the keys/wrapKey permission. * - *

The {@link KeyWrapAlgorithm wrap algorithm} indicates the type of algorithm to use for wrapping the specified key content. Possible values include: - * {@link KeyWrapAlgorithm#RSA1_5 RSA1_5}, {@link KeyWrapAlgorithm#RSA_OAEP RSA_OAEP} and {@link KeyWrapAlgorithm#RSA_OAEP_256 RSA_OAEP_256}

+ *

The {@link KeyWrapAlgorithm wrap algorithm} indicates the type of algorithm to use for wrapping the specified + * key content. Possible values include: + * {@link KeyWrapAlgorithm#RSA1_5 RSA1_5}, {@link KeyWrapAlgorithm#RSA_OAEP RSA_OAEP} and {@link + * KeyWrapAlgorithm#RSA_OAEP_256 RSA_OAEP_256}

* *

Code Samples

- *

Wraps the key content. Subscribes to the call asynchronously and prints out the wrapped key details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.wrap-key} + *

Wraps the key content. Subscribes to the call asynchronously and prints out the wrapped key details when a + * response has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.wrapKey#KeyWrapAlgorithm-byte} * * @param algorithm The encryption algorithm to use for wrapping the key. * @param key The key content to be wrapped + * @return The {@link KeyWrapResult} whose {@link KeyWrapResult#getEncryptedKey() encrypted key} contains the wrapped + * key result. * @throws ResourceNotFoundException if the key cannot be found for wrap operation. * @throws NullPointerException if {@code algorithm} or {@code key} is null. - * @return The {@link KeyWrapResult} whose {@link KeyWrapResult#encryptedKey() encrypted key} contains the wrapped key result. */ public KeyWrapResult wrapKey(KeyWrapAlgorithm algorithm, byte[] key) { return wrapKey(algorithm, key, Context.NONE); @@ -357,164 +422,196 @@ public KeyWrapResult wrapKey(KeyWrapAlgorithm algorithm, byte[] key) { * Wraps a symmetric key using the configured key. The wrap operation supports wrapping a symmetric key with both * symmetric and asymmetric keys. This operation requires the keys/wrapKey permission. * - *

The {@link KeyWrapAlgorithm wrap algorithm} indicates the type of algorithm to use for wrapping the specified key content. Possible values include: - * {@link KeyWrapAlgorithm#RSA1_5 RSA1_5}, {@link KeyWrapAlgorithm#RSA_OAEP RSA_OAEP} and {@link KeyWrapAlgorithm#RSA_OAEP_256 RSA_OAEP_256}

+ *

The {@link KeyWrapAlgorithm wrap algorithm} indicates the type of algorithm to use for wrapping the specified + * key content. Possible values include: + * {@link KeyWrapAlgorithm#RSA1_5 RSA1_5}, {@link KeyWrapAlgorithm#RSA_OAEP RSA_OAEP} and {@link + * KeyWrapAlgorithm#RSA_OAEP_256 RSA_OAEP_256}

* *

Code Samples

- *

Wraps the key content. Subscribes to the call asynchronously and prints out the wrapped key details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.wrap-key-Context} + *

Wraps the key content. Subscribes to the call asynchronously and prints out the wrapped key details when a + * response has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.wrapKey#KeyWrapAlgorithm-byte-Context} * * @param algorithm The encryption algorithm to use for wrapping the key. * @param key The key content to be wrapped * @param context Additional context that is passed through the Http pipeline during the service call. + * @return The {@link KeyWrapResult} whose {@link KeyWrapResult#getEncryptedKey() encrypted key} contains the wrapped + * key result. * @throws ResourceNotFoundException if the key cannot be found for wrap operation. * @throws NullPointerException if {@code algorithm} or {@code key} is null. - * @return The {@link KeyWrapResult} whose {@link KeyWrapResult#encryptedKey() encrypted key} contains the wrapped key result. */ public KeyWrapResult wrapKey(KeyWrapAlgorithm algorithm, byte[] key, Context context) { return client.wrapKey(algorithm, key, context).block(); } /** - * Unwraps a symmetric key using the configured key that was initially used for wrapping that key. This operation is the reverse of the wrap operation. - * The unwrap operation supports asymmetric and symmetric keys to unwrap. This operation requires the keys/unwrapKey permission. + * Unwraps a symmetric key using the configured key that was initially used for wrapping that key. This operation is + * the reverse of the wrap operation. The unwrap operation supports asymmetric and symmetric keys to unwrap. This + * operation requires the keys/unwrapKey permission. * - *

The {@link KeyWrapAlgorithm wrap algorithm} indicates the type of algorithm to use for wrapping the specified key content. Possible values for asymmetric keys include: - * {@link KeyWrapAlgorithm#RSA1_5 RSA1_5}, {@link KeyWrapAlgorithm#RSA_OAEP RSA_OAEP} and {@link KeyWrapAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. - * Possible values for symmetric keys include: {@link KeyWrapAlgorithm#A128KW A128KW}, {@link KeyWrapAlgorithm#A192KW A192KW} and {@link KeyWrapAlgorithm#A256KW A256KW}

+ *

The {@link KeyWrapAlgorithm wrap algorithm} indicates the type of algorithm to use for wrapping the specified + * key content. Possible values for asymmetric keys include: + * {@link KeyWrapAlgorithm#RSA1_5 RSA1_5}, {@link KeyWrapAlgorithm#RSA_OAEP RSA_OAEP} and {@link + * KeyWrapAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. + * Possible values for symmetric keys include: {@link KeyWrapAlgorithm#A128KW A128KW}, {@link + * KeyWrapAlgorithm#A192KW A192KW} and {@link KeyWrapAlgorithm#A256KW A256KW}

* *

Code Samples

- *

Unwraps the key content. Subscribes to the call asynchronously and prints out the unwrapped key details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.unwrap-key} + *

Unwraps the key content. Subscribes to the call asynchronously and prints out the unwrapped key details when a + * response has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.unwrapKey#KeyWrapAlgorithm-byte} * * @param algorithm The encryption algorithm to use for wrapping the key. * @param encryptedKey The encrypted key content to unwrap. + * @return The unwrapped key content. * @throws ResourceNotFoundException if the key cannot be found for wrap operation. * @throws NullPointerException if {@code algorithm} or {@code encryptedKey} is null. - * @return The unwrapped key content. */ public KeyUnwrapResult unwrapKey(KeyWrapAlgorithm algorithm, byte[] encryptedKey) { return unwrapKey(algorithm, encryptedKey, Context.NONE); } /** - * Unwraps a symmetric key using the configured key that was initially used for wrapping that key. This operation is the reverse of the wrap operation. - * The unwrap operation supports asymmetric and symmetric keys to unwrap. This operation requires the keys/unwrapKey permission. - * - *

The {@link KeyWrapAlgorithm wrap algorithm} indicates the type of algorithm to use for wrapping the specified key content. Possible values for asymmetric keys include: - * {@link KeyWrapAlgorithm#RSA1_5 RSA1_5}, {@link KeyWrapAlgorithm#RSA_OAEP RSA_OAEP} and {@link KeyWrapAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. - * Possible values for symmetric keys include: {@link KeyWrapAlgorithm#A128KW A128KW}, {@link KeyWrapAlgorithm#A192KW A192KW} and {@link KeyWrapAlgorithm#A256KW A256KW}

+ * Unwraps a symmetric key using the configured key that was initially used for wrapping that key. This operation is + * the reverse of the wrap operation. + * The unwrap operation supports asymmetric and symmetric keys to unwrap. This operation requires the keys/unwrapKey + * permission. + * + *

The {@link KeyWrapAlgorithm wrap algorithm} indicates the type of algorithm to use for wrapping the specified + * key content. Possible values for asymmetric keys include: + * {@link KeyWrapAlgorithm#RSA1_5 RSA1_5}, {@link KeyWrapAlgorithm#RSA_OAEP RSA_OAEP} and {@link + * KeyWrapAlgorithm#RSA_OAEP_256 RSA_OAEP_256}. + * Possible values for symmetric keys include: {@link KeyWrapAlgorithm#A128KW A128KW}, {@link + * KeyWrapAlgorithm#A192KW A192KW} and {@link KeyWrapAlgorithm#A256KW A256KW}

* *

Code Samples

- *

Unwraps the key content. Subscribes to the call asynchronously and prints out the unwrapped key details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.unwrap-key-Context} + *

Unwraps the key content. Subscribes to the call asynchronously and prints out the unwrapped key details when a + * response has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.unwrapKey#KeyWrapAlgorithm-byte-Context} * * @param algorithm The encryption algorithm to use for wrapping the key. * @param encryptedKey The encrypted key content to unwrap. * @param context Additional context that is passed through the Http pipeline during the service call. + * @return The unwrapped key content. * @throws ResourceNotFoundException if the key cannot be found for wrap operation. * @throws NullPointerException if {@code algorithm} or {@code encryptedKey} is null. - * @return The unwrapped key content. */ public KeyUnwrapResult unwrapKey(KeyWrapAlgorithm algorithm, byte[] encryptedKey, Context context) { return client.unwrapKey(algorithm, encryptedKey, context).block(); } /** - * Creates a signature from the raw data using the configured key. The sign data operation supports both asymmetric and - * symmetric keys. This operation requires the keys/sign permission. + * Creates a signature from the raw data using the configured key. The sign data operation supports both asymmetric + * and symmetric keys. This operation requires the keys/sign permission. * - *

The {@link SignatureAlgorithm signature algorithm} indicates the type of algorithm to use to create the signature from the digest. Possible values include: - * {@link SignatureAlgorithm#ES256 ES256}, {@link SignatureAlgorithm#ES384 E384}, {@link SignatureAlgorithm#ES512 ES512}, - * {@link SignatureAlgorithm#ES256K ES246K}, {@link SignatureAlgorithm#PS256 PS256}, {@link SignatureAlgorithm#RS384 RS384}, - * {@link SignatureAlgorithm#RS512 RS512}, {@link SignatureAlgorithm#RS256 RS256}, {@link SignatureAlgorithm#RS384 RS384} and - * {@link SignatureAlgorithm#RS512 RS512}

+ *

The {@link SignatureAlgorithm signature algorithm} indicates the type of algorithm to use to create the + * signature from the digest. Possible values include: + * {@link SignatureAlgorithm#ES256 ES256}, {@link SignatureAlgorithm#ES384 E384}, + * {@link SignatureAlgorithm#ES512 ES512}, {@link SignatureAlgorithm#ES256K ES246K}, + * {@link SignatureAlgorithm#PS256 PS256}, {@link SignatureAlgorithm#RS384 RS384}, + * {@link SignatureAlgorithm#RS512 RS512}, {@link SignatureAlgorithm#RS256 RS256}, + * {@link SignatureAlgorithm#RS384 RS384} and {@link SignatureAlgorithm#RS512 RS512}

* *

Code Samples

- *

Signs the raw data. Subscribes to the call asynchronously and prints out the signature details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign-data} + *

Signs the raw data. Subscribes to the call asynchronously and prints out the signature details when a response + * has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.signData#SignatureAlgorithm-byte} * * @param algorithm The algorithm to use for signing. * @param data The content from which signature is to be created. + * @return A {@link SignResult} whose {@link SignResult#getSignature() signature} contains the created signature. * @throws ResourceNotFoundException if the key cannot be found for signing. * @throws NullPointerException if {@code algorithm} or {@code data} is null. - * @return A {@link SignResult} whose {@link SignResult#signature() signature} contains the created signature. */ public SignResult signData(SignatureAlgorithm algorithm, byte[] data) { return signData(algorithm, data, Context.NONE); } /** - * Creates a signature from the raw data using the configured key. The sign data operation supports both asymmetric and + * Creates a signature from the raw data using the configured key. The sign data operation supports both asymmetric + * and * symmetric keys. This operation requires the keys/sign permission. * - *

The {@link SignatureAlgorithm signature algorithm} indicates the type of algorithm to use to create the signature from the digest. Possible values include: - * {@link SignatureAlgorithm#ES256 ES256}, {@link SignatureAlgorithm#ES384 E384}, {@link SignatureAlgorithm#ES512 ES512}, - * {@link SignatureAlgorithm#ES256K ES246K}, {@link SignatureAlgorithm#PS256 PS256}, {@link SignatureAlgorithm#RS384 RS384}, - * {@link SignatureAlgorithm#RS512 RS512}, {@link SignatureAlgorithm#RS256 RS256}, {@link SignatureAlgorithm#RS384 RS384} and - * {@link SignatureAlgorithm#RS512 RS512}

+ *

The {@link SignatureAlgorithm signature algorithm} indicates the type of algorithm to use to create the + * signature from the digest. Possible values include: + * {@link SignatureAlgorithm#ES256 ES256}, {@link SignatureAlgorithm#ES384 E384}, + * {@link SignatureAlgorithm#ES512 ES512}, {@link SignatureAlgorithm#ES256K ES246K}, + * {@link SignatureAlgorithm#PS256 PS256}, {@link SignatureAlgorithm#RS384 RS384}, + * {@link SignatureAlgorithm#RS512 RS512}, {@link SignatureAlgorithm#RS256 RS256}, + * {@link SignatureAlgorithm#RS384 RS384} and {@link SignatureAlgorithm#RS512 RS512}

* *

Code Samples

- *

Signs the raw data. Subscribes to the call asynchronously and prints out the signature details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign-data-Context} + *

Signs the raw data. Subscribes to the call asynchronously and prints out the signature details when a response + * has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.signData#SignatureAlgorithm-byte-Context} * * @param algorithm The algorithm to use for signing. * @param data The content from which signature is to be created. * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A {@link SignResult} whose {@link SignResult#getSignature() signature} contains the created signature. * @throws ResourceNotFoundException if the key cannot be found for signing. * @throws NullPointerException if {@code algorithm} or {@code data} is null. - * @return A {@link SignResult} whose {@link SignResult#signature() signature} contains the created signature. */ public SignResult signData(SignatureAlgorithm algorithm, byte[] data, Context context) { return client.signData(algorithm, data, context).block(); } /** - * Verifies a signature against the raw data using the configured key. The verify operation supports both symmetric keys and asymmetric keys. - * In case of asymmetric keys public portion of the key is used to verify the signature . This operation requires the keys/verify permission. - * - *

The {@link SignatureAlgorithm signature algorithm} indicates the type of algorithm to use to verify the signature. Possible values include: - * {@link SignatureAlgorithm#ES256 ES256}, {@link SignatureAlgorithm#ES384 E384}, {@link SignatureAlgorithm#ES512 ES512}, - * {@link SignatureAlgorithm#ES256K ES246K}, {@link SignatureAlgorithm#PS256 PS256}, {@link SignatureAlgorithm#RS384 RS384}, - * {@link SignatureAlgorithm#RS512 RS512}, {@link SignatureAlgorithm#RS256 RS256}, {@link SignatureAlgorithm#RS384 RS384} and - * {@link SignatureAlgorithm#RS512 RS512}

+ * Verifies a signature against the raw data using the configured key. The verify operation supports both symmetric + * keys and asymmetric keys. + * In case of asymmetric keys public portion of the key is used to verify the signature . This operation requires + * the keys/verify permission. + * + *

The {@link SignatureAlgorithm signature algorithm} indicates the type of algorithm to use to create the + * signature from the digest. Possible values include: + * {@link SignatureAlgorithm#ES256 ES256}, {@link SignatureAlgorithm#ES384 E384}, + * {@link SignatureAlgorithm#ES512 ES512}, {@link SignatureAlgorithm#ES256K ES246K}, + * {@link SignatureAlgorithm#PS256 PS256}, {@link SignatureAlgorithm#RS384 RS384}, + * {@link SignatureAlgorithm#RS512 RS512}, {@link SignatureAlgorithm#RS256 RS256}, + * {@link SignatureAlgorithm#RS384 RS384} and {@link SignatureAlgorithm#RS512 RS512}

* *

Code Samples

- *

Verifies the signature against the raw data. Subscribes to the call asynchronously and prints out the verification details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify-data} + *

Verifies the signature against the raw data. Subscribes to the call asynchronously and prints out the + * verification details when a response has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.verifyData#SignatureAlgorithm-byte-byte} * * @param algorithm The algorithm to use for signing. * @param data The raw content against which signature is to be verified. * @param signature The signature to be verified. + * @return The {@link Boolean} indicating the signature verification result. * @throws ResourceNotFoundException if the key cannot be found for verifying. * @throws NullPointerException if {@code algorithm}, {@code data} or {@code signature} is null. - * @return The {@link Boolean} indicating the signature verification result. */ public VerifyResult verifyData(SignatureAlgorithm algorithm, byte[] data, byte[] signature) { return verifyData(algorithm, data, signature, Context.NONE); } /** - * Verifies a signature against the raw data using the configured key. The verify operation supports both symmetric keys and asymmetric keys. - * In case of asymmetric keys public portion of the key is used to verify the signature . This operation requires the keys/verify permission. - * - *

The {@link SignatureAlgorithm signature algorithm} indicates the type of algorithm to use to verify the signature. Possible values include: - * {@link SignatureAlgorithm#ES256 ES256}, {@link SignatureAlgorithm#ES384 E384}, {@link SignatureAlgorithm#ES512 ES512}, - * {@link SignatureAlgorithm#ES256K ES246K}, {@link SignatureAlgorithm#PS256 PS256}, {@link SignatureAlgorithm#RS384 RS384}, - * {@link SignatureAlgorithm#RS512 RS512}, {@link SignatureAlgorithm#RS256 RS256}, {@link SignatureAlgorithm#RS384 RS384} and - * {@link SignatureAlgorithm#RS512 RS512}

+ * Verifies a signature against the raw data using the configured key. The verify operation supports both symmetric + * keys and asymmetric keys. + * In case of asymmetric keys public portion of the key is used to verify the signature . This operation requires + * the keys/verify permission. + * + *

The {@link SignatureAlgorithm signature algorithm} indicates the type of algorithm to use to create the + * signature from the digest. Possible values include: + * {@link SignatureAlgorithm#ES256 ES256}, {@link SignatureAlgorithm#ES384 E384}, + * {@link SignatureAlgorithm#ES512 ES512}, {@link SignatureAlgorithm#ES256K ES246K}, + * {@link SignatureAlgorithm#PS256 PS256}, {@link SignatureAlgorithm#RS384 RS384}, + * {@link SignatureAlgorithm#RS512 RS512}, {@link SignatureAlgorithm#RS256 RS256}, + * {@link SignatureAlgorithm#RS384 RS384} and {@link SignatureAlgorithm#RS512 RS512}

* *

Code Samples

- *

Verifies the signature against the raw data. Subscribes to the call asynchronously and prints out the verification details when a response has been received.

- * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify-data-Context} + *

Verifies the signature against the raw data. Subscribes to the call asynchronously and prints out the + * verification details when a response has been received.

+ * {@codesnippet com.azure.security.keyvault.keys.cryptography.CryptographyClient.verifyData#SignatureAlgorithm-byte-byte-Context} * * @param algorithm The algorithm to use for signing. * @param data The raw content against which signature is to be verified. * @param signature The signature to be verified. * @param context Additional context that is passed through the Http pipeline during the service call. + * @return The {@link Boolean} indicating the signature verification result. * @throws ResourceNotFoundException if the key cannot be found for verifying. * @throws NullPointerException if {@code algorithm}, {@code data} or {@code signature} is null. - * @return The {@link Boolean} indicating the signature verification result. */ public VerifyResult verifyData(SignatureAlgorithm algorithm, byte[] data, byte[] signature, Context context) { return client.verifyData(algorithm, data, signature, context).block(); diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientBuilder.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientBuilder.java index a73e91537de5..47f2bd5804ad 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientBuilder.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientBuilder.java @@ -16,6 +16,7 @@ import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; import com.azure.core.util.configuration.Configuration; import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.core.util.logging.ClientLogger; import com.azure.security.keyvault.keys.KeyVaultCredentialPolicy; import com.azure.security.keyvault.keys.implementation.AzureKeyVaultConfiguration; import com.azure.security.keyvault.keys.models.webkey.JsonWebKey; @@ -25,27 +26,34 @@ import java.util.Objects; /** - * This class provides a fluent builder API to help aid the configuration and instantiation of the {@link CryptographyAsyncClient cryptography async client} and {@link CryptographyClient cryptography sync client}, - * by calling {@link CryptographyClientBuilder#buildAsyncClient() buildAsyncClient} and {@link CryptographyClientBuilder#buildClient() buildClient} respectively + * This class provides a fluent builder API to help aid the configuration and instantiation of the {@link + * CryptographyAsyncClient cryptography async client} and {@link CryptographyClient cryptography sync client}, + * by calling {@link CryptographyClientBuilder#buildAsyncClient() buildAsyncClient} and {@link + * CryptographyClientBuilder#buildClient() buildClient} respectively * It constructs an instance of the desired client. * - *

The minimal configuration options required by {@link CryptographyClientBuilder cryptographyClientBuilder} to build {@link CryptographyAsyncClient} - * are ({@link JsonWebKey jsonWebKey} or {@link String jsonWebKey identifier}) and {@link TokenCredential credential}).

+ *

The minimal configuration options required by {@link CryptographyClientBuilder cryptographyClientBuilder} to + * build {@link CryptographyAsyncClient} are ({@link JsonWebKey jsonWebKey} or {@link String jsonWebKey identifier}) and + * {@link TokenCredential credential}). + *

* * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.instantiation} * *

The {@link HttpLogDetailLevel log detail level}, multiple custom {@link HttpLoggingPolicy policies} and custom * {@link HttpClient http client} can be optionally configured in the {@link CryptographyClientBuilder}.

- + * * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.withhttpclient.instantiation} * *

Alternatively, custom {@link HttpPipeline http pipeline} with custom {@link HttpPipelinePolicy} policies - * can be specified. It provides finer control over the construction of {@link CryptographyAsyncClient} and {@link CryptographyClient}

+ * can be specified. It provides finer control over the construction of {@link CryptographyAsyncClient} and {@link + * CryptographyClient}

* * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.pipeline.instantiation} * - *

The minimal configuration options required by {@link CryptographyClientBuilder cryptographyClientBuilder} to build {@link CryptographyClient} - * are {@link JsonWebKey jsonWebKey} ot {@link String jsonWebKey identifier}) and {@link TokenCredential credential}).

+ *

The minimal configuration options required by {@link CryptographyClientBuilder cryptographyClientBuilder} to + * build {@link CryptographyClient} are {@link JsonWebKey jsonWebKey} ot {@link String jsonWebKey identifier}) and + * {@link TokenCredential credential}). + *

* * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.instantiation} * @@ -55,13 +63,15 @@ @ServiceClientBuilder(serviceClients = CryptographyClient.class) public final class CryptographyClientBuilder { private final List policies; + private final ClientLogger logger = new ClientLogger(CryptographyClientBuilder.class); + private TokenCredential credential; private HttpPipeline pipeline; private JsonWebKey jsonWebKey; private String keyId; private HttpClient httpClient; private HttpLogDetailLevel httpLogDetailLevel; - private RetryPolicy retryPolicy; + private final RetryPolicy retryPolicy; private Configuration configuration; /** @@ -78,15 +88,19 @@ public CryptographyClientBuilder() { * Every time {@code buildClient()} is called, a new instance of {@link CryptographyClient} is created. * *

If {@link CryptographyClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and - * ({@link CryptographyClientBuilder#keyIdentifier(String) jsonWebKey identifier} or {@link CryptographyClientBuilder#jsonWebKey(JsonWebKey) json web jsonWebKey}) - * are used to create the {@link CryptographyClient client}. All other builder settings are ignored. If {@code pipeline} is not set, - * then ({@link CryptographyClientBuilder#credential(TokenCredential) jsonWebKey vault credential} and - * ({@link CryptographyClientBuilder#keyIdentifier(String) jsonWebKey identifier} or {@link CryptographyClientBuilder#jsonWebKey(JsonWebKey) json web jsonWebKey}) - * are required to build the {@link CryptographyClient client}.

+ * ({@link CryptographyClientBuilder#keyIdentifier(String) jsonWebKey identifier} or {@link + * CryptographyClientBuilder#jsonWebKey(JsonWebKey) json web jsonWebKey}) + * are used to create the {@link CryptographyClient client}. All other builder settings are ignored. If + * {@code pipeline} is not set, then + * ({@link CryptographyClientBuilder#credential(TokenCredential) jsonWebKey vault credential} and + * ({@link CryptographyClientBuilder#keyIdentifier(String) jsonWebKey identifier} or {@link + * CryptographyClientBuilder#jsonWebKey(JsonWebKey) json web jsonWebKey}) are required to build the + * {@link CryptographyClient client}.

* * @return A {@link CryptographyClient} with the options set from the builder. * @throws IllegalStateException If {@link CryptographyClientBuilder#credential(TokenCredential)} or - * either of ({@link CryptographyClientBuilder#keyIdentifier(String)} or {@link CryptographyClientBuilder#jsonWebKey(JsonWebKey)} have not been set. + * either of ({@link CryptographyClientBuilder#keyIdentifier(String)} or {@link + * CryptographyClientBuilder#jsonWebKey(JsonWebKey)} have not been set. */ public CryptographyClient buildClient() { return new CryptographyClient(buildAsyncClient()); @@ -96,21 +110,27 @@ public CryptographyClient buildClient() { * Every time {@code buildAsyncClient()} is called, a new instance of {@link CryptographyAsyncClient} is created. * *

If {@link CryptographyClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and - * ({@link CryptographyClientBuilder#keyIdentifier(String) jsonWebKey identifier} or {@link CryptographyClientBuilder#jsonWebKey(JsonWebKey) json web jsonWebKey}) - * are used to create the {@link CryptographyAsyncClient async client}. All other builder settings are ignored. If {@code pipeline} is not set, - * then ({@link CryptographyClientBuilder#credential(TokenCredential) jsonWebKey vault credential} and - * ({@link CryptographyClientBuilder#keyIdentifier(String) jsonWebKey identifier} or {@link CryptographyClientBuilder#jsonWebKey(JsonWebKey) json web jsonWebKey}) - * are required to build the {@link CryptographyAsyncClient async client}.

+ * ({@link CryptographyClientBuilder#keyIdentifier(String) jsonWebKey identifier} or {@link + * CryptographyClientBuilder#jsonWebKey(JsonWebKey) json web jsonWebKey}) + * are used to create the {@link CryptographyAsyncClient async client}. All other builder settings are ignored. If + * {@code pipeline} is not set, then + * ({@link CryptographyClientBuilder#credential(TokenCredential) jsonWebKey vault credential} and + * ({@link CryptographyClientBuilder#keyIdentifier(String) jsonWebKey identifier} or {@link + * CryptographyClientBuilder#jsonWebKey(JsonWebKey) json web jsonWebKey}) are required to build the + * {@link CryptographyAsyncClient async client}.

* * @return A {@link CryptographyAsyncClient} with the options set from the builder. * @throws IllegalStateException If {@link CryptographyClientBuilder#credential(TokenCredential)} or - * either of ({@link CryptographyClientBuilder#keyIdentifier(String)} or {@link CryptographyClientBuilder#jsonWebKey(JsonWebKey)} have not been set. + * either of ({@link CryptographyClientBuilder#keyIdentifier(String)} or {@link + * CryptographyClientBuilder#jsonWebKey(JsonWebKey)} have not been set. */ public CryptographyAsyncClient buildAsyncClient() { - Configuration buildConfiguration = (configuration == null) ? ConfigurationManager.getConfiguration().clone() : configuration; + Configuration buildConfiguration = + (configuration == null) ? ConfigurationManager.getConfiguration().clone() : configuration; if (jsonWebKey == null && Strings.isNullOrEmpty(keyId)) { - throw new IllegalStateException("Json Web Key or jsonWebKey identifier are required to create cryptography client"); + throw logger.logExceptionAsError(new IllegalStateException( + "Json Web Key or jsonWebKey identifier are required to create cryptography client")); } if (pipeline != null) { @@ -122,12 +142,14 @@ public CryptographyAsyncClient buildAsyncClient() { } if (credential == null) { - throw new IllegalStateException("Key Vault credentials " + "are required to build the Cryptography async client"); + throw logger.logExceptionAsError(new IllegalStateException( + "Key Vault credentials are required to build the Cryptography async client")); } // Closest to API goes first, closest to wire goes last. final List policies = new ArrayList<>(); - policies.add(new UserAgentPolicy(AzureKeyVaultConfiguration.SDK_NAME, AzureKeyVaultConfiguration.SDK_VERSION, buildConfiguration)); + policies.add(new UserAgentPolicy(AzureKeyVaultConfiguration.SDK_NAME, AzureKeyVaultConfiguration.SDK_VERSION, + buildConfiguration)); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new KeyVaultCredentialPolicy(credential)); @@ -136,9 +158,9 @@ public CryptographyAsyncClient buildAsyncClient() { policies.add(new HttpLoggingPolicy(httpLogDetailLevel)); HttpPipeline pipeline = new HttpPipelineBuilder() - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .build(); + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .build(); if (jsonWebKey != null) { return new CryptographyAsyncClient(jsonWebKey, pipeline); @@ -150,8 +172,9 @@ public CryptographyAsyncClient buildAsyncClient() { /** * Sets the identifier of the jsonWebKey from Azure Key Vault to be used for cryptography operations. * - *

If {@code jsonWebKey} is provided then that takes precedence over key identifier and gets used for cryptography operations.

- + *

If {@code jsonWebKey} is provided then that takes precedence over key identifier and gets used for + * cryptography operations.

+ * * @param keyId The jsonWebKey identifier representing the jsonWebKey stored in jsonWebKey vault. * @return the updated {@link CryptographyClientBuilder} object. */ @@ -163,7 +186,8 @@ public CryptographyClientBuilder keyIdentifier(String keyId) { /** * Sets the jsonWebKey to be used for cryptography operations. * - *

If {@code jsonWebKey} is provided then it takes precedence over key identifier and gets used for cryptography operations.

+ *

If {@code jsonWebKey} is provided then it takes precedence over key identifier and gets used for cryptography + * operations.

* * @param jsonWebKey The Json web jsonWebKey to be used for cryptography operations. * @return the updated {@link CryptographyClientBuilder} object. @@ -202,7 +226,8 @@ public CryptographyClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) } /** - * Adds a policy to the set of existing policies that are executed after {@link CryptographyAsyncClient} and {@link CryptographyClient} required policies. + * Adds a policy to the set of existing policies that are executed after {@link CryptographyAsyncClient} and {@link + * CryptographyClient} required policies. * * @param policy The {@link HttpPipelinePolicy policy} to be added. * @return the updated {@link CryptographyClientBuilder} object. @@ -231,8 +256,9 @@ public CryptographyClientBuilder httpClient(HttpClient client) { * Sets the HTTP pipeline to use for the service client. * * If {@code pipeline} is set, all other settings are ignored, aside from - * ({@link CryptographyClientBuilder#keyIdentifier(String) jsonWebKey identifier} or {@link CryptographyClientBuilder#jsonWebKey(JsonWebKey) json web jsonWebKey} - * to build {@link CryptographyClient} or {@link CryptographyAsyncClient}. + * ({@link CryptographyClientBuilder#keyIdentifier(String) jsonWebKey identifier} or {@link + * CryptographyClientBuilder#jsonWebKey(JsonWebKey) json web jsonWebKey} to build {@link CryptographyClient} or + * {@link CryptographyAsyncClient}. * * @param pipeline The HTTP pipeline to use for sending service requests and receiving responses. * @return the updated {@link CryptographyClientBuilder} object. diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyServiceClient.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyServiceClient.java index 57da3971289a..dc5a0c2d70c6 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyServiceClient.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyServiceClient.java @@ -59,72 +59,89 @@ Mono> getKey(Context context) { private Mono> getKey(String name, String version, Context context) { return service.getKey(endpoint, name, version, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Retrieving key - {}", name)) - .doOnSuccess(response -> logger.info("Retrieved key - {}", response.value().name())) - .doOnError(error -> logger.warning("Failed to get key - {}", name, error)); + .doOnRequest(ignored -> logger.info("Retrieving key - {}", name)) + .doOnSuccess(response -> logger.info("Retrieved key - {}", response.getValue().name())) + .doOnError(error -> logger.warning("Failed to get key - {}", name, error)); } Mono encrypt(EncryptionAlgorithm algorithm, byte[] plaintext, Context context) { - KeyOperationParameters parameters = new KeyOperationParameters().algorithm(algorithm).value(plaintext); - return service.encrypt(endpoint, keyName, version, API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Encrypting content with algorithm - {}", algorithm.toString())) - .doOnSuccess(response -> logger.info("Retrieved encrypted content with algorithm- {}", algorithm.toString())) - .doOnError(error -> logger.warning("Failed to encrypt content with algorithm - {}", algorithm.toString(), error)) - .flatMap(keyOperationResultResponse -> - Mono.just(new EncryptResult(keyOperationResultResponse.value().result(), null, algorithm))); + KeyOperationParameters parameters = new KeyOperationParameters().setAlgorithm(algorithm).setValue(plaintext); + return service.encrypt(endpoint, keyName, version, API_VERSION, ACCEPT_LANGUAGE, parameters, + CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Encrypting content with algorithm - {}", algorithm.toString())) + .doOnSuccess(response -> logger.info("Retrieved encrypted content with algorithm- {}", + algorithm.toString())) + .doOnError(error -> logger.warning("Failed to encrypt content with algorithm - {}", algorithm.toString(), + error)) + .flatMap(keyOperationResultResponse -> + Mono.just(new EncryptResult(keyOperationResultResponse.getValue().getResult(), null, algorithm))); } Mono decrypt(EncryptionAlgorithm algorithm, byte[] cipherText, Context context) { - KeyOperationParameters parameters = new KeyOperationParameters().algorithm(algorithm).value(cipherText); - return service.decrypt(endpoint, keyName, version, API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Decrypting content with algorithm - {}", algorithm.toString())) - .doOnSuccess(response -> logger.info("Retrieved decrypted content with algorithm- {}", algorithm.toString())) - .doOnError(error -> logger.warning("Failed to decrypt content with algorithm - {}", algorithm.toString(), error)) - .flatMap(keyOperationResultResponse -> Mono.just(new DecryptResult(keyOperationResultResponse.value().result()))); + KeyOperationParameters parameters = new KeyOperationParameters().setAlgorithm(algorithm).setValue(cipherText); + return service.decrypt(endpoint, keyName, version, API_VERSION, ACCEPT_LANGUAGE, parameters, + CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Decrypting content with algorithm - {}", algorithm.toString())) + .doOnSuccess(response -> logger.info("Retrieved decrypted content with algorithm- {}", + algorithm.toString())) + .doOnError(error -> logger.warning("Failed to decrypt content with algorithm - {}", algorithm.toString(), + error)) + .flatMap(keyOperationResultResponse -> Mono.just( + new DecryptResult(keyOperationResultResponse.getValue().getResult()))); } Mono sign(SignatureAlgorithm algorithm, byte[] digest, Context context) { - KeySignRequest parameters = new KeySignRequest().algorithm(algorithm).value(digest); - return service.sign(endpoint, keyName, version, API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Signing content with algorithm - {}", algorithm.toString())) - .doOnSuccess(response -> logger.info("Retrieved signed content with algorithm- {}", algorithm.toString())) - .doOnError(error -> logger.warning("Failed to sign content with algorithm - {}", algorithm.toString(), error)) - .flatMap(keyOperationResultResponse -> - Mono.just(new SignResult(keyOperationResultResponse.value().result(), algorithm))); + KeySignRequest parameters = new KeySignRequest().setAlgorithm(algorithm).setValue(digest); + return service.sign(endpoint, keyName, version, API_VERSION, ACCEPT_LANGUAGE, parameters, + CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Signing content with algorithm - {}", algorithm.toString())) + .doOnSuccess(response -> logger.info("Retrieved signed content with algorithm- {}", algorithm.toString())) + .doOnError(error -> logger.warning("Failed to sign content with algorithm - {}", algorithm.toString(), + error)) + .flatMap(keyOperationResultResponse -> + Mono.just(new SignResult(keyOperationResultResponse.getValue().getResult(), algorithm))); } Mono verify(SignatureAlgorithm algorithm, byte[] digest, byte[] signature, Context context) { - KeyVerifyRequest parameters = new KeyVerifyRequest().algorithm(algorithm).digest(digest).signature(signature); - return service.verify(endpoint, keyName, version, API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Verifying content with algorithm - {}", algorithm.toString())) - .doOnSuccess(response -> logger.info("Retrieved verified content with algorithm- {}", algorithm.toString())) - .doOnError(error -> logger.warning("Failed to verify content with algorithm - {}", algorithm.toString(), error)) - .flatMap(response -> - Mono.just(new VerifyResult(response.value().value()))); + KeyVerifyRequest parameters = new KeyVerifyRequest().setAlgorithm(algorithm).setDigest(digest).setSignature(signature); + return service.verify(endpoint, keyName, version, API_VERSION, ACCEPT_LANGUAGE, parameters, + CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Verifying content with algorithm - {}", algorithm.toString())) + .doOnSuccess(response -> logger.info("Retrieved verified content with algorithm- {}", algorithm.toString())) + .doOnError(error -> logger.warning("Failed to verify content with algorithm - {}", algorithm.toString(), + error)) + .flatMap(response -> + Mono.just(new VerifyResult(response.getValue().getValue()))); } Mono wrapKey(KeyWrapAlgorithm algorithm, byte[] key, Context context) { - KeyWrapUnwrapRequest parameters = new KeyWrapUnwrapRequest().algorithm(algorithm).value(key); - return service.wrapKey(endpoint, keyName, version, API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Wrapping key content with algorithm - {}", algorithm.toString())) - .doOnSuccess(response -> logger.info("Retrieved wrapped key content with algorithm- {}", algorithm.toString())) - .doOnError(error -> logger.warning("Failed to verify content with algorithm - {}", algorithm.toString(), error)) - .flatMap(keyOperationResultResponse -> - Mono.just(new KeyWrapResult(keyOperationResultResponse.value().result(), algorithm))); + KeyWrapUnwrapRequest parameters = new KeyWrapUnwrapRequest().setAlgorithm(algorithm).setValue(key); + return service.wrapKey(endpoint, keyName, version, API_VERSION, ACCEPT_LANGUAGE, parameters, + CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Wrapping key content with algorithm - {}", algorithm.toString())) + .doOnSuccess(response -> logger.info("Retrieved wrapped key content with algorithm- {}", + algorithm.toString())) + .doOnError(error -> logger.warning("Failed to verify content with algorithm - {}", algorithm.toString(), + error)) + .flatMap(keyOperationResultResponse -> + Mono.just(new KeyWrapResult(keyOperationResultResponse.getValue().getResult(), algorithm))); } Mono unwrapKey(KeyWrapAlgorithm algorithm, byte[] encryptedKey, Context context) { - KeyWrapUnwrapRequest parameters = new KeyWrapUnwrapRequest().algorithm(algorithm).value(encryptedKey); - return service.unwrapKey(endpoint, keyName, version, API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Unwrapping key content with algorithm - {}", algorithm.toString())) - .doOnSuccess(response -> logger.info("Retrieved unwrapped key content with algorithm- {}", algorithm.toString())) - .doOnError(error -> logger.warning("Failed to unwrap key content with algorithm - {}", algorithm.toString(), error)) - .flatMap(response -> - Mono.just(new KeyUnwrapResult(response.value().result()))); + KeyWrapUnwrapRequest parameters = new KeyWrapUnwrapRequest().setAlgorithm(algorithm).setValue(encryptedKey); + return service.unwrapKey(endpoint, keyName, version, API_VERSION, ACCEPT_LANGUAGE, parameters, + CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Unwrapping key content with algorithm - {}", algorithm.toString())) + .doOnSuccess(response -> logger.info("Retrieved unwrapped key content with algorithm- {}", + algorithm.toString())) + .doOnError(error -> logger.warning("Failed to unwrap key content with algorithm - {}", + algorithm.toString(), error)) + .flatMap(response -> + Mono.just(new KeyUnwrapResult(response.getValue().getResult()))); } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/EcKeyCryptographyClient.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/EcKeyCryptographyClient.java index 6ed03573e553..087f090ea44d 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/EcKeyCryptographyClient.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/EcKeyCryptographyClient.java @@ -4,6 +4,7 @@ package com.azure.security.keyvault.keys.cryptography; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import com.azure.security.keyvault.keys.cryptography.models.DecryptResult; import com.azure.security.keyvault.keys.cryptography.models.EncryptionAlgorithm; import com.azure.security.keyvault.keys.cryptography.models.EncryptResult; @@ -23,9 +24,11 @@ import java.security.MessageDigest; class EcKeyCryptographyClient extends LocalKeyCryptographyClient { + private final ClientLogger logger = new ClientLogger(EcKeyCryptographyClient.class); + private KeyPair keyPair; - private CryptographyServiceClient serviceClient; - private Provider provider; + private final CryptographyServiceClient serviceClient; + private final Provider provider; /** * Creates a EcKeyCryptographyClient that uses {@code service} to service requests @@ -35,6 +38,7 @@ class EcKeyCryptographyClient extends LocalKeyCryptographyClient { EcKeyCryptographyClient(CryptographyServiceClient serviceClient) { super(serviceClient); this.serviceClient = serviceClient; + this.provider = null; } EcKeyCryptographyClient(JsonWebKey key, CryptographyServiceClient serviceClient) { @@ -52,14 +56,18 @@ private KeyPair getKeyPair(JsonWebKey key) { } @Override - Mono encryptAsync(EncryptionAlgorithm algorithm, byte[] plaintext, byte[] iv, byte[] authenticationData, Context context, JsonWebKey key) { - throw new UnsupportedOperationException("Encrypt operation is not supported for EC key"); + Mono encryptAsync(EncryptionAlgorithm algorithm, byte[] plaintext, byte[] iv, + byte[] authenticationData, Context context, JsonWebKey key) { + throw logger.logExceptionAsError(new UnsupportedOperationException( + "Encrypt operation is not supported for EC key")); } @Override - Mono decryptAsync(EncryptionAlgorithm algorithm, byte[] cipherText, byte[] iv, byte[] authenticationData, byte[] authenticationTag, Context context, JsonWebKey key) { - - throw new UnsupportedOperationException("Decrypt operation is not supported for EC key"); + Mono decryptAsync(EncryptionAlgorithm algorithm, byte[] cipherText, byte[] iv, + byte[] authenticationData, byte[] authenticationTag, Context context, + JsonWebKey key) { + throw logger.logExceptionAsError(new UnsupportedOperationException( + "Decrypt operation is not supported for EC key")); } @Override @@ -82,7 +90,8 @@ Mono signAsync(SignatureAlgorithm algorithm, byte[] digest, Context if (serviceCryptoAvailable()) { return serviceClient.sign(algorithm, digest, context); } - return Mono.error(new IllegalArgumentException("Private portion of the key not available to perform sign operation")); + return Mono.error(new IllegalArgumentException( + "Private portion of the key not available to perform sign operation")); } Ecdsa algo; @@ -102,7 +111,8 @@ Mono signAsync(SignatureAlgorithm algorithm, byte[] digest, Context } @Override - Mono verifyAsync(SignatureAlgorithm algorithm, byte[] digest, byte[] signature, Context context, JsonWebKey key) { + Mono verifyAsync(SignatureAlgorithm algorithm, byte[] digest, byte[] signature, Context context, + JsonWebKey key) { keyPair = getKeyPair(key); @@ -122,7 +132,8 @@ Mono verifyAsync(SignatureAlgorithm algorithm, byte[] digest, byte if (serviceCryptoAvailable()) { return serviceClient.verify(algorithm, digest, signature, context); } - return Mono.error(new IllegalArgumentException("Public portion of the key not available to perform verify operation")); + return Mono.error(new IllegalArgumentException( + "Public portion of the key not available to perform verify operation")); } Ecdsa algo; @@ -143,14 +154,14 @@ Mono verifyAsync(SignatureAlgorithm algorithm, byte[] digest, byte @Override Mono wrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] key, Context context, JsonWebKey webKey) { - return Mono.error(new UnsupportedOperationException("Wrap key operation is not supported for EC key")); } @Override - Mono unwrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] encryptedKey, Context context, JsonWebKey key) { - - throw new UnsupportedOperationException("Unwrap key operation is not supported for Ec key"); + Mono unwrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] encryptedKey, Context context, + JsonWebKey key) { + throw logger.logExceptionAsError(new UnsupportedOperationException( + "Unwrap key operation is not supported for Ec key")); } @Override @@ -167,7 +178,8 @@ Mono signDataAsync(SignatureAlgorithm algorithm, byte[] data, Contex } @Override - Mono verifyDataAsync(SignatureAlgorithm algorithm, byte[] data, byte[] signature, Context context, JsonWebKey key) { + Mono verifyDataAsync(SignatureAlgorithm algorithm, byte[] data, byte[] signature, Context context, + JsonWebKey key) { try { HashAlgorithm hashAlgorithm = SignatureHashResolver.DEFAULT.get(algorithm); MessageDigest md = MessageDigest.getInstance(hashAlgorithm.toString()); diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Ecdsa.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Ecdsa.java index bd4ed3c0029c..6d091d1b4ad0 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Ecdsa.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Ecdsa.java @@ -3,12 +3,15 @@ package com.azure.security.keyvault.keys.cryptography; +import com.azure.core.util.logging.ClientLogger; + import java.security.GeneralSecurityException; import java.security.KeyPair; import java.security.Provider; import java.security.Signature; abstract class Ecdsa extends AsymmetricSignatureAlgorithm { + private final ClientLogger logger = new ClientLogger(Ecdsa.class); protected Ecdsa() { super("NONEwithECDSA"); @@ -54,7 +57,7 @@ public boolean verify(byte[] digest, byte[] signature) throws GeneralSecurityExc private void checkDigestLength(byte[] digest) { if (digest.length != getDigestLength()) { - throw new IllegalArgumentException("Invalid digest length."); + throw logger.logExceptionAsError(new IllegalArgumentException("Invalid digest length.")); } } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/ICryptoTransform.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/ICryptoTransform.java index ae37b8924669..a4cd5371f7e3 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/ICryptoTransform.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/ICryptoTransform.java @@ -16,9 +16,10 @@ interface ICryptoTransform { /** * Transforms the specified region of the specified byte array as a single operation. - * + * * @param input The byte array to be transformed * @return The transformed result. */ - byte[] doFinal(byte[] input) throws IllegalBlockSizeException, BadPaddingException, InvalidKeyException, NoSuchAlgorithmException; + byte[] doFinal(byte[] input) + throws IllegalBlockSizeException, BadPaddingException, InvalidKeyException, NoSuchAlgorithmException; } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyOperationParameters.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyOperationParameters.java index c63b136214e5..8fcba994e923 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyOperationParameters.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyOperationParameters.java @@ -29,7 +29,7 @@ class KeyOperationParameters { * * @return the algorithm value */ - public EncryptionAlgorithm algorithm() { + public EncryptionAlgorithm getAlgorithm() { return this.algorithm; } @@ -39,7 +39,7 @@ public EncryptionAlgorithm algorithm() { * @param algorithm the algorithm value to set * @return the KeyOperationsParameters object itself. */ - public KeyOperationParameters algorithm(EncryptionAlgorithm algorithm) { + public KeyOperationParameters setAlgorithm(EncryptionAlgorithm algorithm) { this.algorithm = algorithm; return this; } @@ -49,7 +49,7 @@ public KeyOperationParameters algorithm(EncryptionAlgorithm algorithm) { * * @return the value value */ - public byte[] value() { + public byte[] getValue() { if (this.value == null) { return new byte[0]; } @@ -62,7 +62,7 @@ public byte[] value() { * @param value the value value to set * @return the KeyOperationsParameters object itself. */ - public KeyOperationParameters value(byte[] value) { + public KeyOperationParameters setValue(byte[] value) { if (value == null) { this.value = null; } else { diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyOperationResult.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyOperationResult.java index 0a9d4081ee0e..6922aef0c041 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyOperationResult.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyOperationResult.java @@ -27,7 +27,7 @@ class KeyOperationResult { * * @return the kid value */ - public String kid() { + public String getKid() { return this.kid; } @@ -36,7 +36,7 @@ public String kid() { * * @return the result value */ - public byte[] result() { + public byte[] getResult() { if (this.result == null) { return new byte[0]; } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeySignRequest.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeySignRequest.java index 6eddd008e9dd..3d5edd344e4b 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeySignRequest.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeySignRequest.java @@ -32,7 +32,7 @@ class KeySignRequest { * * @return the algorithm value */ - public SignatureAlgorithm algorithm() { + public SignatureAlgorithm getAlgorithm() { return this.algorithm; } @@ -42,7 +42,7 @@ public SignatureAlgorithm algorithm() { * @param algorithm the algorithm value to set * @return the KeyVerifyParameters object itself. */ - public KeySignRequest algorithm(SignatureAlgorithm algorithm) { + public KeySignRequest setAlgorithm(SignatureAlgorithm algorithm) { this.algorithm = algorithm; return this; } @@ -52,7 +52,7 @@ public KeySignRequest algorithm(SignatureAlgorithm algorithm) { * * @return the value value */ - public byte[] value() { + public byte[] getValue() { if (this.value == null) { return new byte[0]; } @@ -65,7 +65,7 @@ public byte[] value() { * @param value the value value to set * @return the KeySignParameters object itself. */ - public KeySignRequest value(byte[] value) { + public KeySignRequest setValue(byte[] value) { if (value == null) { this.value = null; } else { diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyVerifyRequest.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyVerifyRequest.java index d095a0cad18d..3e73f5a58467 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyVerifyRequest.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyVerifyRequest.java @@ -37,7 +37,7 @@ class KeyVerifyRequest { * * @return the algorithm value */ - public SignatureAlgorithm algorithm() { + public SignatureAlgorithm getAlgorithm() { return this.algorithm; } @@ -47,7 +47,7 @@ public SignatureAlgorithm algorithm() { * @param algorithm the algorithm value to set * @return the KeyVerifyParameters object itself. */ - public KeyVerifyRequest algorithm(SignatureAlgorithm algorithm) { + public KeyVerifyRequest setAlgorithm(SignatureAlgorithm algorithm) { this.algorithm = algorithm; return this; } @@ -57,7 +57,7 @@ public KeyVerifyRequest algorithm(SignatureAlgorithm algorithm) { * * @return the digest value */ - public byte[] digest() { + public byte[] getDigest() { if (this.digest == null) { return new byte[0]; } @@ -70,7 +70,7 @@ public byte[] digest() { * @param digest the digest value to set * @return the KeyVerifyParameters object itself. */ - public KeyVerifyRequest digest(byte[] digest) { + public KeyVerifyRequest setDigest(byte[] digest) { if (digest == null) { this.digest = null; } else { @@ -84,7 +84,7 @@ public KeyVerifyRequest digest(byte[] digest) { * * @return the signature value */ - public byte[] signature() { + public byte[] getSignature() { if (this.signature == null) { return new byte[0]; } @@ -97,7 +97,7 @@ public byte[] signature() { * @param signature the signature value to set * @return the KeyVerifyParameters object itself. */ - public KeyVerifyRequest signature(byte[] signature) { + public KeyVerifyRequest setSignature(byte[] signature) { if (signature == null) { this.signature = null; } else { diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyVerifyResponse.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyVerifyResponse.java index 551d6e691a45..b45887baa9f8 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyVerifyResponse.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyVerifyResponse.java @@ -18,7 +18,7 @@ class KeyVerifyResponse { * * @return the value value */ - public Boolean value() { + public Boolean getValue() { return this.value; } } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyWrapUnwrapRequest.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyWrapUnwrapRequest.java index 317a61962edd..2f7c7e93fb3a 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyWrapUnwrapRequest.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyWrapUnwrapRequest.java @@ -29,7 +29,7 @@ class KeyWrapUnwrapRequest { * * @return the algorithm value */ - public KeyWrapAlgorithm algorithm() { + public KeyWrapAlgorithm getAlgorithm() { return this.algorithm; } @@ -39,7 +39,7 @@ public KeyWrapAlgorithm algorithm() { * @param algorithm the algorithm value to set * @return the KeyOperationsParameters object itself. */ - public KeyWrapUnwrapRequest algorithm(KeyWrapAlgorithm algorithm) { + public KeyWrapUnwrapRequest setAlgorithm(KeyWrapAlgorithm algorithm) { this.algorithm = algorithm; return this; } @@ -49,7 +49,7 @@ public KeyWrapUnwrapRequest algorithm(KeyWrapAlgorithm algorithm) { * * @return the value value */ - public byte[] value() { + public byte[] getValue() { if (this.value == null) { return new byte[0]; } @@ -62,7 +62,7 @@ public byte[] value() { * @param value the value value to set * @return the KeyOperationsParameters object itself. */ - public KeyWrapUnwrapRequest value(byte[] value) { + public KeyWrapUnwrapRequest setValue(byte[] value) { if (value == null) { this.value = null; } else { diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/LocalKeyCryptographyClient.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/LocalKeyCryptographyClient.java index 84fb76d2f65d..adc2255f8e51 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/LocalKeyCryptographyClient.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/LocalKeyCryptographyClient.java @@ -27,20 +27,27 @@ abstract class LocalKeyCryptographyClient { this.serviceClient = serviceClient; } - abstract Mono encryptAsync(EncryptionAlgorithm algorithm, byte[] plaintext, byte[] iv, byte[] authenticationData, Context context, JsonWebKey jsonWebKey); + abstract Mono encryptAsync(EncryptionAlgorithm algorithm, byte[] plaintext, byte[] iv, + byte[] authenticationData, Context context, JsonWebKey jsonWebKey); - abstract Mono decryptAsync(EncryptionAlgorithm algorithm, byte[] cipherText, byte[] iv, byte[] authenticationData, byte[] authenticationTag, Context context, JsonWebKey jsonWebKey); + abstract Mono decryptAsync(EncryptionAlgorithm algorithm, byte[] cipherText, byte[] iv, + byte[] authenticationData, byte[] authenticationTag, Context context, + JsonWebKey jsonWebKey); abstract Mono signAsync(SignatureAlgorithm algorithm, byte[] digest, Context context, JsonWebKey key); - abstract Mono verifyAsync(SignatureAlgorithm algorithm, byte[] digest, byte[] signature, Context context, JsonWebKey key); + abstract Mono verifyAsync(SignatureAlgorithm algorithm, byte[] digest, byte[] signature, + Context context, JsonWebKey key); - abstract Mono wrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] key, Context context, JsonWebKey jsonWebKey); + abstract Mono wrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] key, Context context, + JsonWebKey jsonWebKey); - abstract Mono unwrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] encryptedKey, Context context, JsonWebKey jsonWebKey); + abstract Mono unwrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] encryptedKey, Context context, + JsonWebKey jsonWebKey); abstract Mono signDataAsync(SignatureAlgorithm algorithm, byte[] data, Context context, JsonWebKey key); - abstract Mono verifyDataAsync(SignatureAlgorithm algorithm, byte[] data, byte[] signature, Context context, JsonWebKey key); + abstract Mono verifyDataAsync(SignatureAlgorithm algorithm, byte[] data, byte[] signature, + Context context, JsonWebKey key); } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/LocalKeyWrapAlgorithm.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/LocalKeyWrapAlgorithm.java index fa7aa7826fd9..f7b09bad7cbc 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/LocalKeyWrapAlgorithm.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/LocalKeyWrapAlgorithm.java @@ -31,7 +31,9 @@ abstract class LocalKeyWrapAlgorithm extends Algorithm { * The AES key material to be used. * @return A {@link ICryptoTransform} implementation */ - abstract ICryptoTransform createEncryptor(byte[] key) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException; + abstract ICryptoTransform createEncryptor(byte[] key) + throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, + InvalidAlgorithmParameterException; /* * Creates a {@link ICryptoTransform} implementation for encryption that @@ -43,7 +45,9 @@ abstract class LocalKeyWrapAlgorithm extends Algorithm { * The provider to use. * @return A {@link ICryptoTransform} implementation */ - abstract ICryptoTransform createEncryptor(byte[] key, Provider provider) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException; + abstract ICryptoTransform createEncryptor(byte[] key, Provider provider) + throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, + InvalidAlgorithmParameterException; /* * Creates a {@link ICryptoTransform} implementation for encryption @@ -54,7 +58,9 @@ abstract class LocalKeyWrapAlgorithm extends Algorithm { * The initialization vector to be used. * @return A {@link ICryptoTransform} implementation */ - abstract ICryptoTransform createEncryptor(byte[] key, byte[] iv) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException; + abstract ICryptoTransform createEncryptor(byte[] key, byte[] iv) + throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, + InvalidAlgorithmParameterException; /* * Creates a {@link ICryptoTransform} implementation for encryption @@ -67,7 +73,9 @@ abstract class LocalKeyWrapAlgorithm extends Algorithm { * The provider to use. * @return A {@link ICryptoTransform} implementation */ - abstract ICryptoTransform createEncryptor(byte[] key, byte[] iv, Provider provider) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException; + abstract ICryptoTransform createEncryptor(byte[] key, byte[] iv, Provider provider) + throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, + InvalidAlgorithmParameterException; /* * Creates a {@link ICryptoTransform} implementation for decryption. @@ -76,7 +84,9 @@ abstract class LocalKeyWrapAlgorithm extends Algorithm { * The AES key material to be used. * @return A {@link ICryptoTransform} implementation */ - abstract ICryptoTransform createDecryptor(byte[] key) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException; + abstract ICryptoTransform createDecryptor(byte[] key) + throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, + InvalidAlgorithmParameterException; /* * Creates a {@link ICryptoTransform} implementation for decryption that @@ -88,7 +98,9 @@ abstract class LocalKeyWrapAlgorithm extends Algorithm { * The provider to use. * @return A {@link ICryptoTransform} implementation */ - abstract ICryptoTransform createDecryptor(byte[] key, Provider provider) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException; + abstract ICryptoTransform createDecryptor(byte[] key, Provider provider) + throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, + InvalidAlgorithmParameterException; /* * Creates a {@link ICryptoTransform} implementation for decryption @@ -99,7 +111,9 @@ abstract class LocalKeyWrapAlgorithm extends Algorithm { * The initialization vector to be used. * @return A {@link ICryptoTransform} implementation */ - abstract ICryptoTransform createDecryptor(byte[] key, byte[] iv) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException; + abstract ICryptoTransform createDecryptor(byte[] key, byte[] iv) + throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, + InvalidAlgorithmParameterException; /* * Creates a {@link ICryptoTransform} implementation for decryption @@ -112,5 +126,7 @@ abstract class LocalKeyWrapAlgorithm extends Algorithm { * The provider to use. * @return A {@link ICryptoTransform} implementation */ - abstract ICryptoTransform createDecryptor(byte[] key, byte[] iv, Provider provider) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException; + abstract ICryptoTransform createDecryptor(byte[] key, byte[] iv, Provider provider) + throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, + InvalidAlgorithmParameterException; } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Rsa15.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Rsa15.java index 318265ab4aef..5245441cd880 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Rsa15.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Rsa15.java @@ -18,7 +18,8 @@ static class Rsa15Decryptor implements ICryptoTransform { private final Cipher cipher; - Rsa15Decryptor(KeyPair keyPair, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { + Rsa15Decryptor(KeyPair keyPair, Provider provider) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { // Create a cipher object using the provider, if specified if (provider == null) { @@ -43,7 +44,8 @@ static class Rsa15Encryptor implements ICryptoTransform { private final Cipher cipher; - Rsa15Encryptor(KeyPair keyPair, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { + Rsa15Encryptor(KeyPair keyPair, Provider provider) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { // Create a cipher object using the provider, if specified if (provider == null) { @@ -73,22 +75,26 @@ public byte[] doFinal(byte[] plaintext) throws IllegalBlockSizeException, BadPad } @Override - public ICryptoTransform createEncryptor(KeyPair keyPair) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { + public ICryptoTransform createEncryptor(KeyPair keyPair) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { return createEncryptor(keyPair, null); } @Override - public ICryptoTransform createEncryptor(KeyPair keyPair, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { + public ICryptoTransform createEncryptor(KeyPair keyPair, Provider provider) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { return new Rsa15Encryptor(keyPair, provider); } @Override - public ICryptoTransform createDecryptor(KeyPair keyPair) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { + public ICryptoTransform createDecryptor(KeyPair keyPair) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { return createDecryptor(keyPair, null); } @Override - public ICryptoTransform createDecryptor(KeyPair keyPair, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { + public ICryptoTransform createDecryptor(KeyPair keyPair, Provider provider) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { return new Rsa15Decryptor(keyPair, provider); } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/RsaKeyCryptographyClient.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/RsaKeyCryptographyClient.java index d93614614772..5671b1094053 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/RsaKeyCryptographyClient.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/RsaKeyCryptographyClient.java @@ -49,11 +49,13 @@ private KeyPair getKeyPair(JsonWebKey key) { } @Override - Mono encryptAsync(EncryptionAlgorithm algorithm, byte[] plaintext, byte[] iv, byte[] authenticationData, Context context, JsonWebKey jsonWebKey) { + Mono encryptAsync(EncryptionAlgorithm algorithm, byte[] plaintext, byte[] iv, + byte[] authenticationData, Context context, JsonWebKey jsonWebKey) { keyPair = getKeyPair(jsonWebKey); if (iv != null || authenticationData != null) { - Mono.error(new IllegalArgumentException("iv and authenticationData parameters are not allowed for Rsa encrypt operation")); + Mono.error(new IllegalArgumentException( + "iv and authenticationData parameters are not allowed for Rsa encrypt operation")); } // Interpret the requested algorithm @@ -72,7 +74,8 @@ Mono encryptAsync(EncryptionAlgorithm algorithm, byte[] plaintext if (serviceCryptoAvailable()) { return serviceClient.encrypt(algorithm, plaintext, context); } - return Mono.error(new IllegalArgumentException("Public portion of the key not available to perform encrypt operation")); + return Mono.error(new IllegalArgumentException( + "Public portion of the key not available to perform encrypt operation")); } AsymmetricEncryptionAlgorithm algo = (AsymmetricEncryptionAlgorithm) baseAlgorithm; @@ -82,16 +85,23 @@ Mono encryptAsync(EncryptionAlgorithm algorithm, byte[] plaintext try { transform = algo.createEncryptor(keyPair); return Mono.just(new EncryptResult(transform.doFinal(plaintext), (byte[]) null, algorithm)); - } catch (InvalidKeyException | NoSuchAlgorithmException | NoSuchPaddingException | IllegalBlockSizeException | BadPaddingException e) { + } catch (InvalidKeyException + | NoSuchAlgorithmException + | NoSuchPaddingException + | IllegalBlockSizeException + | BadPaddingException e) { return Mono.error(e); } } @Override - Mono decryptAsync(EncryptionAlgorithm algorithm, byte[] cipherText, byte[] iv, byte[] authenticationData, byte[] authenticationTag, Context context, JsonWebKey jsonWebKey) { + Mono decryptAsync(EncryptionAlgorithm algorithm, byte[] cipherText, byte[] iv, + byte[] authenticationData, byte[] authenticationTag, Context context, + JsonWebKey jsonWebKey) { if (iv != null || authenticationData != null || authenticationTag != null) { - return Mono.error(new IllegalArgumentException("iv, authenticationData and authenticationTag parameters are not supported for Rsa decrypt operation")); + return Mono.error(new IllegalArgumentException( + "iv, authenticationData and authenticationTag parameters are not supported for Rsa decrypt operation")); } keyPair = getKeyPair(jsonWebKey); @@ -111,7 +121,8 @@ Mono decryptAsync(EncryptionAlgorithm algorithm, byte[] cipherTex if (serviceCryptoAvailable()) { return serviceClient.decrypt(algorithm, cipherText, context); } - return Mono.error(new IllegalArgumentException("Private portion of the key not available to perform decrypt operation")); + return Mono.error(new IllegalArgumentException( + "Private portion of the key not available to perform decrypt operation")); } AsymmetricEncryptionAlgorithm algo = (AsymmetricEncryptionAlgorithm) baseAlgorithm; @@ -121,7 +132,11 @@ Mono decryptAsync(EncryptionAlgorithm algorithm, byte[] cipherTex try { transform = algo.createDecryptor(keyPair); return Mono.just(new DecryptResult(transform.doFinal(cipherText))); - } catch (InvalidKeyException | NoSuchAlgorithmException | NoSuchPaddingException | IllegalBlockSizeException | BadPaddingException e) { + } catch (InvalidKeyException + | NoSuchAlgorithmException + | NoSuchPaddingException + | IllegalBlockSizeException + | BadPaddingException e) { return Mono.error(e); } } @@ -133,7 +148,8 @@ Mono signAsync(SignatureAlgorithm algorithm, byte[] digest, Context } @Override - Mono verifyAsync(SignatureAlgorithm algorithm, byte[] digest, byte[] signature, Context context, JsonWebKey key) { + Mono verifyAsync(SignatureAlgorithm algorithm, byte[] digest, byte[] signature, Context context, + JsonWebKey key) { return serviceClient.verify(algorithm, digest, signature, context); // do a service call for now. @@ -159,7 +175,8 @@ Mono wrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] key, Context if (serviceCryptoAvailable()) { return serviceClient.wrapKey(algorithm, key, context); } - return Mono.error(new IllegalArgumentException("Public portion of the key not available to perform wrap key operation")); + return Mono.error(new IllegalArgumentException( + "Public portion of the key not available to perform wrap key operation")); } AsymmetricEncryptionAlgorithm algo = (AsymmetricEncryptionAlgorithm) baseAlgorithm; @@ -169,13 +186,18 @@ Mono wrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] key, Context try { transform = algo.createEncryptor(keyPair); return Mono.just(new KeyWrapResult(transform.doFinal(key), algorithm)); - } catch (InvalidKeyException | NoSuchAlgorithmException | NoSuchPaddingException | IllegalBlockSizeException | BadPaddingException e) { + } catch (InvalidKeyException + | NoSuchAlgorithmException + | NoSuchPaddingException + | IllegalBlockSizeException + | BadPaddingException e) { return Mono.error(e); } } @Override - Mono unwrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] encryptedKey, Context context, JsonWebKey jsonWebKey) { + Mono unwrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] encryptedKey, Context context, + JsonWebKey jsonWebKey) { keyPair = getKeyPair(jsonWebKey); @@ -195,7 +217,8 @@ Mono unwrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] encrypte if (serviceCryptoAvailable()) { return serviceClient.unwrapKey(algorithm, encryptedKey, context); } - return Mono.error(new IllegalArgumentException("Private portion of the key not available to perform unwrap operation")); + return Mono.error(new IllegalArgumentException( + "Private portion of the key not available to perform unwrap operation")); } AsymmetricEncryptionAlgorithm algo = (AsymmetricEncryptionAlgorithm) baseAlgorithm; @@ -205,7 +228,11 @@ Mono unwrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] encrypte try { transform = algo.createDecryptor(keyPair); return Mono.just(new KeyUnwrapResult(transform.doFinal(encryptedKey))); - } catch (InvalidKeyException | NoSuchAlgorithmException | NoSuchPaddingException | IllegalBlockSizeException | BadPaddingException e) { + } catch (InvalidKeyException + | NoSuchAlgorithmException + | NoSuchPaddingException + | IllegalBlockSizeException + | BadPaddingException e) { return Mono.error(e); } } @@ -224,7 +251,8 @@ Mono signDataAsync(SignatureAlgorithm algorithm, byte[] data, Contex } @Override - Mono verifyDataAsync(SignatureAlgorithm algorithm, byte[] data, byte[] signature, Context context, JsonWebKey key) { + Mono verifyDataAsync(SignatureAlgorithm algorithm, byte[] data, byte[] signature, Context context, + JsonWebKey key) { HashAlgorithm hashAlgorithm = SignatureHashResolver.DEFAULT.get(algorithm); try { MessageDigest md = MessageDigest.getInstance(hashAlgorithm.toString()); diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/RsaOaep.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/RsaOaep.java index 396d63b49c02..a43a023fffd7 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/RsaOaep.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/RsaOaep.java @@ -18,7 +18,8 @@ static class RsaOaepDecryptor implements ICryptoTransform { private final Cipher cipher; - RsaOaepDecryptor(KeyPair keyPair, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { + RsaOaepDecryptor(KeyPair keyPair, Provider provider) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { // Create a cipher object using the provider, if specified if (provider == null) { @@ -43,7 +44,8 @@ static class RsaOaepEncryptor implements ICryptoTransform { private final Cipher cipher; - RsaOaepEncryptor(KeyPair keyPair, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { + RsaOaepEncryptor(KeyPair keyPair, Provider provider) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { // Create a cipher object using the provider, if specified if (provider == null) { @@ -73,23 +75,27 @@ public byte[] doFinal(byte[] plaintext) throws IllegalBlockSizeException, BadPad } @Override - public ICryptoTransform createEncryptor(KeyPair keyPair) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { + public ICryptoTransform createEncryptor(KeyPair keyPair) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { return createEncryptor(keyPair, null); } @Override - public ICryptoTransform createEncryptor(KeyPair keyPair, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { + public ICryptoTransform createEncryptor(KeyPair keyPair, Provider provider) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { return new RsaOaepEncryptor(keyPair, provider); } @Override - public ICryptoTransform createDecryptor(KeyPair keyPair) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { + public ICryptoTransform createDecryptor(KeyPair keyPair) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { return createDecryptor(keyPair, null); } @Override - public ICryptoTransform createDecryptor(KeyPair keyPair, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { + public ICryptoTransform createDecryptor(KeyPair keyPair, Provider provider) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { return new RsaOaepDecryptor(keyPair, provider); } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/SignatureEncoding.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/SignatureEncoding.java index 732e19f0f925..7492da6330ff 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/SignatureEncoding.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/SignatureEncoding.java @@ -49,16 +49,16 @@ static byte[] fromAsn1Der(byte[] asn1DerSignature, Ecdsa algorithm) { return Asn1DerSignatureEncoding.decode(asn1DerSignature, algorithm); } catch (IllegalArgumentException ex) { throw (IllegalArgumentException) new IllegalArgumentException( - ex.getMessage() + " " + Hex.encodeHexString(asn1DerSignature)).initCause(ex); + ex.getMessage() + " " + Hex.encodeHexString(asn1DerSignature)).initCause(ex); } } /* - * Converts a raw ECDSA signature in the form R|S to an ASN.1 DER encoded signature. - * @param signature A raw ECDSA signature in the form R|S. - * @param algorithm The algorithm used to produce the given signature. - * @return The ASN.1 DER encoded signature of the given signature. - */ + * Converts a raw ECDSA signature in the form R|S to an ASN.1 DER encoded signature. + * @param signature A raw ECDSA signature in the form R|S. + * @param algorithm The algorithm used to produce the given signature. + * @return The ASN.1 DER encoded signature of the given signature. + */ static byte[] toAsn1Der(byte[] signature, String algorithm) throws NoSuchAlgorithmException { Algorithm baseAlgorithm = AlgorithmResolver.Default.get(algorithm); @@ -76,17 +76,17 @@ static byte[] toAsn1Der(byte[] signature, String algorithm) throws NoSuchAlgorit } /* - * Converts a raw ECDSA signature in the form R|S to an ASN.1 DER encoded signature. - * @param signature A raw ECDSA signature in the form R|S. - * @param algorithm The algorithm used to produce the given signature. - * @return The ASN.1 DER encoded signature of the given signature. - */ + * Converts a raw ECDSA signature in the form R|S to an ASN.1 DER encoded signature. + * @param signature A raw ECDSA signature in the form R|S. + * @param algorithm The algorithm used to produce the given signature. + * @return The ASN.1 DER encoded signature of the given signature. + */ static byte[] toAsn1Der(byte[] signature, Ecdsa algorithm) { try { return Asn1DerSignatureEncoding.encode(signature, algorithm); } catch (IllegalArgumentException ex) { throw (IllegalArgumentException) new IllegalArgumentException( - ex.getMessage() + " " + Hex.encodeHexString(signature)).initCause(ex); + ex.getMessage() + " " + Hex.encodeHexString(signature)).initCause(ex); } } } @@ -96,14 +96,17 @@ final class Asn1DerSignatureEncoding { // the EDCSA ASN.1 DER signature is in the format: // 0x30 b1 0x02 b2 (vr) 0x02 b3 (vs) // where: - // * b1 one or more bytes equal to the length, in bytes, of the remaining list of bytes (from the first 0x02 to the end of the encoding) + // * b1 one or more bytes equal to the length, in bytes, of the remaining list of bytes (from the first 0x02 + // to the end of the encoding) // * b2 one or more bytes equal to the length, in bytes, of (vr) // * b3 one or more bytes equal to the length, in bytes, of (vs) // (vr) is the signed big-endian encoding of the value "r", of minimal length // (vs) is the signed big-endian encoding of the value "s", of minimal length // - // * lengths which are less than 0x80 can be expressed in one byte. For lengths greater then 0x80 the first byte denotes the - // length in bytes of the length with the most significant bit masked off, i.e. 0x81 denotes the length is one byte long. + // * lengths which are less than 0x80 can be expressed in one byte. For lengths greater then 0x80 the first + // byte denotes the + // length in bytes of the length with the most significant bit masked off, i.e. 0x81 denotes the length is + // one byte long. private Asn1DerSignatureEncoding() { diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/SymmetricEncryptionAlgorithm.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/SymmetricEncryptionAlgorithm.java index 8ba05b92e23e..4bb18a0afc31 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/SymmetricEncryptionAlgorithm.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/SymmetricEncryptionAlgorithm.java @@ -17,7 +17,7 @@ abstract class SymmetricEncryptionAlgorithm extends LocalEncryptionAlgorithm { /* * Constructor. - * + * * @param name The name of the algorithm. */ SymmetricEncryptionAlgorithm(String name) { @@ -32,10 +32,13 @@ abstract class SymmetricEncryptionAlgorithm extends LocalEncryptionAlgorithm { * @param iv * The initialization vector to be used. * @param authenticationData - * The authentication data to be used with authenticating encryption implementation (ignored for non-authenticating implementation) + * The authentication data to be used with authenticating encryption implementation (ignored for + * non-authenticating implementation) * @return A {@link ICryptoTransform} implementation */ - abstract ICryptoTransform createEncryptor(byte[] key, byte[] iv, byte[] authenticationData) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException; + abstract ICryptoTransform createEncryptor(byte[] key, byte[] iv, byte[] authenticationData) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, + InvalidAlgorithmParameterException; /* * Creates a {@link ICryptoTransform} implementation for encryption @@ -45,12 +48,15 @@ abstract class SymmetricEncryptionAlgorithm extends LocalEncryptionAlgorithm { * @param iv * The initialization vector to be used. * @param authenticationData - * The authentication data to be used with authenticating encryption implementation (ignored for non-authenticating implementation) + * The authentication data to be used with authenticating encryption implementation (ignored for + * non-authenticating implementation) * @param provider * The provider to use. * @return A {@link ICryptoTransform} implementation */ - abstract ICryptoTransform createEncryptor(byte[] key, byte[] iv, byte[] authenticationData, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException; + abstract ICryptoTransform createEncryptor(byte[] key, byte[] iv, byte[] authenticationData, Provider provider) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, + InvalidAlgorithmParameterException; /* * Creates a {@link ICryptoTransform} implementation for decryption @@ -60,12 +66,17 @@ abstract class SymmetricEncryptionAlgorithm extends LocalEncryptionAlgorithm { * @param iv * The initialization vector to be used. * @param authenticationData - * The authentication data to be used with authenticating encryption implementation (ignored for non-authenticating implementation) + * The authentication data to be used with authenticating encryption implementation (ignored for + * non-authenticating implementation) * @param authenticationTag - * The authentication tag to verify when using authenticating encryption implementation (ignored for non-authenticating implementation) + * The authentication tag to verify when using authenticating encryption implementation (ignored for + * non-authenticating implementation) * @return A {@link ICryptoTransform} implementation */ - abstract ICryptoTransform createDecryptor(byte[] key, byte[] iv, byte[] authenticationData, byte[] authenticationTag) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException; + abstract ICryptoTransform createDecryptor(byte[] key, byte[] iv, byte[] authenticationData, + byte[] authenticationTag) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, + InvalidAlgorithmParameterException; /* * Creates a {@link ICryptoTransform} implementation for decryption @@ -75,13 +86,18 @@ abstract class SymmetricEncryptionAlgorithm extends LocalEncryptionAlgorithm { * @param iv * The initialization vector to be used. * @param authenticationData - * The authentication data to be used with authenticating encryption implementation (ignored for non-authenticating implementation) + * The authentication data to be used with authenticating encryption implementation (ignored for + * non-authenticating implementation) * @param authenticationTag - * The authentication tag to verify when using authenticating encryption implementation (ignored for non-authenticating implementation) + * The authentication tag to verify when using authenticating encryption implementation (ignored for + * non-authenticating implementation) * @param provider * The provider to use. * @return A {@link ICryptoTransform} implementation */ - abstract ICryptoTransform createDecryptor(byte[] key, byte[] iv, byte[] authenticationData, byte[] authenticationTag, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException; + abstract ICryptoTransform createDecryptor(byte[] key, byte[] iv, byte[] authenticationData, + byte[] authenticationTag, Provider provider) + throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, + InvalidAlgorithmParameterException; } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/SymmetricKeyCryptographyClient.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/SymmetricKeyCryptographyClient.java index 1597cced6e73..f45c964ca4c4 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/SymmetricKeyCryptographyClient.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/SymmetricKeyCryptographyClient.java @@ -4,6 +4,7 @@ package com.azure.security.keyvault.keys.cryptography; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import com.azure.security.keyvault.keys.cryptography.models.DecryptResult; import com.azure.security.keyvault.keys.cryptography.models.EncryptionAlgorithm; import com.azure.security.keyvault.keys.cryptography.models.EncryptResult; @@ -19,6 +20,8 @@ import java.security.NoSuchAlgorithmException; class SymmetricKeyCryptographyClient extends LocalKeyCryptographyClient { + private final ClientLogger logger = new ClientLogger(SymmetricKeyCryptographyClient.class); + private byte[] key; /* @@ -43,7 +46,8 @@ private byte[] getKey(JsonWebKey key) { } @Override - Mono encryptAsync(EncryptionAlgorithm algorithm, byte[] plaintext, byte[] iv, byte[] authenticationData, Context context, JsonWebKey jsonWebKey) { + Mono encryptAsync(EncryptionAlgorithm algorithm, byte[] plaintext, byte[] iv, + byte[] authenticationData, Context context, JsonWebKey jsonWebKey) { key = getKey(jsonWebKey); Algorithm baseAlgorithm = AlgorithmResolver.Default.get(algorithm.toString()); @@ -83,7 +87,9 @@ Mono encryptAsync(EncryptionAlgorithm algorithm, byte[] plaintext } @Override - Mono decryptAsync(EncryptionAlgorithm algorithm, byte[] cipherText, byte[] iv, byte[] authenticationData, byte[] authenticationTag, Context context, JsonWebKey jsonWebKey) { + Mono decryptAsync(EncryptionAlgorithm algorithm, byte[] cipherText, byte[] iv, + byte[] authenticationData, byte[] authenticationTag, Context context, + JsonWebKey jsonWebKey) { key = getKey(jsonWebKey); @@ -117,7 +123,8 @@ Mono signAsync(SignatureAlgorithm algorithm, byte[] digest, Context } @Override - Mono verifyAsync(SignatureAlgorithm algorithm, byte[] digest, byte[] signature, Context context, JsonWebKey key) { + Mono verifyAsync(SignatureAlgorithm algorithm, byte[] digest, byte[] signature, Context context, + JsonWebKey key) { return Mono.error(new UnsupportedOperationException("Verify operation not supported for OCT/Symmetric key")); } @@ -127,7 +134,7 @@ Mono wrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] key, Context this.key = getKey(jsonWebKey); if (key == null || key.length == 0) { - throw new IllegalArgumentException("key"); + throw logger.logExceptionAsError(new IllegalArgumentException("key")); } // Interpret the algorithm @@ -159,7 +166,8 @@ Mono wrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] key, Context } @Override - Mono unwrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] encryptedKey, Context context, JsonWebKey jsonWebKey) { + Mono unwrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] encryptedKey, Context context, + JsonWebKey jsonWebKey) { key = getKey(jsonWebKey); Algorithm baseAlgorithm = AlgorithmResolver.Default.get(algorithm.toString()); @@ -195,7 +203,8 @@ Mono signDataAsync(SignatureAlgorithm algorithm, byte[] data, Contex } @Override - Mono verifyDataAsync(SignatureAlgorithm algorithm, byte[] data, byte[] signature, Context context, JsonWebKey key) { + Mono verifyDataAsync(SignatureAlgorithm algorithm, byte[] data, byte[] signature, Context context, + JsonWebKey key) { return verifyAsync(algorithm, data, signature, context, key); } } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/DecryptResult.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/DecryptResult.java index d6eb0f8f75f3..38002881692e 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/DecryptResult.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/DecryptResult.java @@ -12,7 +12,7 @@ public final class DecryptResult { /** * The decrypted content. */ - private byte[] plainText; + private final byte[] plainText; /** * Creates the instance of Decrypt Result holding decrypted content. @@ -26,7 +26,7 @@ public DecryptResult(byte[] plainText) { * Get the encrypted content. * @return The decrypted content. */ - public byte[] plainText() { + public byte[] getPlainText() { return ImplUtils.clone(plainText); } } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/EncryptResult.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/EncryptResult.java index 318004f05bb9..6a007da6cd17 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/EncryptResult.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/EncryptResult.java @@ -25,23 +25,23 @@ public EncryptResult(byte[] cipherText, byte[] authenticationTag, EncryptionAlgo /** * THe encrypted content. */ - private byte[] cipherText; + private final byte[] cipherText; /** * The authentication tag. */ - private byte[] authenticationTag; + private final byte[] authenticationTag; /** * The encrypyion algorithm used for the encryption operation. */ - private EncryptionAlgorithm algorithm; + private final EncryptionAlgorithm algorithm; /** * Get the encrypted content. * @return The encrypted content. */ - public byte[] cipherText() { + public byte[] getCipherText() { return ImplUtils.clone(cipherText); } @@ -49,7 +49,7 @@ public byte[] cipherText() { * Get the authentication tag. * @return The authentication tag. */ - public byte[] authenticationTag() { + public byte[] getAuthenticationTag() { return ImplUtils.clone(authenticationTag); } @@ -57,7 +57,7 @@ public byte[] authenticationTag() { * Get the encryption algorithm used for encryption. * @return The encryption algorithm used. */ - public EncryptionAlgorithm algorithm() { + public EncryptionAlgorithm getAlgorithm() { return algorithm; } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/EncryptionAlgorithm.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/EncryptionAlgorithm.java index da87988a302b..9c87d90f576c 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/EncryptionAlgorithm.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/EncryptionAlgorithm.java @@ -45,5 +45,6 @@ public String toString() { * All the JWK encryption implementation. */ public static final List ALL_ALGORITHMS = Collections - .unmodifiableList(Arrays.asList(RSA_OAEP, RSA1_5, RSA_OAEP_256, A256CBC_HS512, A128CBC_HS256, A192CBC_HS384, A256CBC, A192CBC, A128CBC)); + .unmodifiableList(Arrays.asList(RSA_OAEP, RSA1_5, RSA_OAEP_256, A256CBC_HS512, A128CBC_HS256, A192CBC_HS384, + A256CBC, A192CBC, A128CBC)); } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/KeyUnwrapResult.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/KeyUnwrapResult.java index d839f72abf03..024b16a82891 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/KeyUnwrapResult.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/KeyUnwrapResult.java @@ -12,7 +12,7 @@ public final class KeyUnwrapResult { /** * The unwrapped key content. */ - private byte[] key; + private final byte[] key; /** * Creates the instance of KeyUnwrap Result holding the unwrapped key content. @@ -26,7 +26,7 @@ public KeyUnwrapResult(byte[] key) { * Get the unwrapped key content. * @return The unwrapped key content. */ - public byte[] key() { + public byte[] getKey() { return ImplUtils.clone(key); } } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/KeyWrapResult.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/KeyWrapResult.java index 23f660b13457..8ffa05f855e4 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/KeyWrapResult.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/KeyWrapResult.java @@ -23,18 +23,18 @@ public KeyWrapResult(byte[] encryptedKey, KeyWrapAlgorithm algorithm) { /** * The encrypted key content */ - private byte[] encryptedKey; + private final byte[] encryptedKey; /** * The key wrap algorithm used to wrap the key content. */ - private KeyWrapAlgorithm algorithm; + private final KeyWrapAlgorithm algorithm; /** * Get the encrypted key content. * @return The encrypted key. */ - public byte[] encryptedKey() { + public byte[] getEncryptedKey() { return ImplUtils.clone(encryptedKey); } @@ -42,7 +42,7 @@ public byte[] encryptedKey() { * Get the key wrap algorithm used to wrap the key content. * @return The key wrap algorithm. */ - public KeyWrapAlgorithm algorithm() { + public KeyWrapAlgorithm getAlgorithm() { return algorithm; } } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/SignResult.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/SignResult.java index 34ea80ef373a..274db5fb8422 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/SignResult.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/SignResult.java @@ -23,18 +23,18 @@ public SignResult(byte[] signature, SignatureAlgorithm algorithm) { /** * The signature created from the digest. */ - private byte[] signature; + private final byte[] signature; /** * The algorithm used to create the signature. */ - private SignatureAlgorithm algorithm; + private final SignatureAlgorithm algorithm; /** * Get the signature created from the digest. * @return The signature. */ - public byte[] signature() { + public byte[] getSignature() { return ImplUtils.clone(signature); } @@ -42,7 +42,7 @@ public byte[] signature() { * Get the signature algorithm used to create the signature. * @return The signature algorithm. */ - public SignatureAlgorithm algorithm() { + public SignatureAlgorithm getAlgorithm() { return algorithm; } } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/SignatureAlgorithm.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/SignatureAlgorithm.java index e0c15a1ef131..9434a55a2e12 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/SignatureAlgorithm.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/SignatureAlgorithm.java @@ -30,8 +30,7 @@ public enum SignatureAlgorithm { /** * Creates a custom value for SignatureAlgorithm. * - * @param value - * the custom value + * @param value the custom value */ SignatureAlgorithm(String value) { this.value = value; diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/VerifyResult.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/VerifyResult.java index aa92321c876d..cc600e5ff0df 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/VerifyResult.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/VerifyResult.java @@ -10,7 +10,7 @@ public final class VerifyResult { /** * THe verify operation result. */ - private Boolean isValid; + private final Boolean isValid; /** * Creates the instance of Verify Result holding the verification response information. diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/package-info.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/package-info.java index 985135aee564..8b08cc969462 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/package-info.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/package-info.java @@ -2,7 +2,7 @@ // Licensed under the MIT License. /** - * Package containing classes for creating {@link com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient} and - * {@link com.azure.security.keyvault.keys.cryptography.CryptographyClient} to perform cryptography operations. + * Package containing classes for creating {@link com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient} + * and {@link com.azure.security.keyvault.keys.cryptography.CryptographyClient} to perform cryptography operations. */ package com.azure.security.keyvault.keys.cryptography; diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/AzureKeyVaultConfiguration.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/AzureKeyVaultConfiguration.java index 42bd727996cd..6a2d7846c7f8 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/AzureKeyVaultConfiguration.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/AzureKeyVaultConfiguration.java @@ -6,5 +6,5 @@ public final class AzureKeyVaultConfiguration { //TODO: Eventually remove these hardcoded strings with https://github.com/Azure/azure-sdk-for-java/issues/3141 public static final String SDK_NAME = "Azure-Keyvault"; - public static final String SDK_VERSION = "4.0.0-preview.3"; + public static final String SDK_VERSION = "4.0.0-preview.4"; } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/DeletedKeyPage.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/DeletedKeyPage.java index 8f96c41142f7..c6aec48b35c0 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/DeletedKeyPage.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/DeletedKeyPage.java @@ -33,7 +33,7 @@ public final class DeletedKeyPage implements Page { * @return The link to the next page. */ @Override - public String nextLink() { + public String getNextLink() { return this.nextLink; } @@ -43,7 +43,7 @@ public String nextLink() { * @return The list of items in {@link List}. */ @Override - public List items() { + public List getItems() { return items; } } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/KeyBasePage.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/KeyBasePage.java index 2a46e69356e3..e24d789ca230 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/KeyBasePage.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/KeyBasePage.java @@ -33,7 +33,7 @@ public final class KeyBasePage implements Page { * @return The link to the next page. */ @Override - public String nextLink() { + public String getNextLink() { return this.nextLink; } @@ -43,7 +43,7 @@ public String nextLink() { * @return The list of items in {@link List}. */ @Override - public List items() { + public List getItems() { return items; } } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/DeletedKey.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/DeletedKey.java index bd320ec67a1a..428d558a2ff9 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/DeletedKey.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/DeletedKey.java @@ -38,7 +38,7 @@ public final class DeletedKey extends KeyBase { * * @return the recoveryId identifier. */ - public String recoveryId() { + public String getRecoveryId() { return this.recoveryId; } @@ -47,7 +47,7 @@ public String recoveryId() { * * @return the scheduledPurgeDate UTC time. */ - public OffsetDateTime scheduledPurgeDate() { + public OffsetDateTime getScheduledPurgeDate() { return scheduledPurgeDate; } @@ -56,22 +56,23 @@ public OffsetDateTime scheduledPurgeDate() { * * @return the deletedDate UTC time. */ - public OffsetDateTime deletedDate() { + public OffsetDateTime getDeletedDate() { return this.deletedDate; } /** - * Unpacks the scheduledPurageDate json response. Converts the {@link Long scheduledPurgeDate} epoch second value to OffsetDateTime and updates the - * value of class variable scheduledPurgeDate. + * Unpacks the scheduledPurageDate json response. Converts the {@link Long scheduledPurgeDate} epoch second value to + * OffsetDateTime and updates the value of class variable scheduledPurgeDate. */ @JsonProperty("scheduledPurgeDate") private void unpackScheduledPurgeDate(Long scheduledPurgeDate) { - this.scheduledPurgeDate = OffsetDateTime.ofInstant(Instant.ofEpochMilli(scheduledPurgeDate * 1000L), ZoneOffset.UTC); + this.scheduledPurgeDate = + OffsetDateTime.ofInstant(Instant.ofEpochMilli(scheduledPurgeDate * 1000L), ZoneOffset.UTC); } /** - * Unpacks the deletedDate json response. Converts the {@link Long deletedDate} epoch second value to OffsetDateTime and updates the - * value of class variable deletedDate. + * Unpacks the deletedDate json response. Converts the {@link Long deletedDate} epoch second value to OffsetDateTime + * and updates the value of class variable deletedDate. */ @JsonProperty("deletedDate") private void unpackDeletedDate(Long deletedDate) { @@ -92,7 +93,7 @@ private void unpackKeyMaterial(Map key) { * * @return the key value */ - public JsonWebKey keyMaterial() { + public JsonWebKey getKeyMaterial() { return this.keyMaterial; } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/EcKeyCreateOptions.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/EcKeyCreateOptions.java index 4adf44999c75..f2095262bde8 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/EcKeyCreateOptions.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/EcKeyCreateOptions.java @@ -37,7 +37,7 @@ public EcKeyCreateOptions(String name) { * * @return the curve. */ - public KeyCurveName curve() { + public KeyCurveName getCurve() { return this.curve; } @@ -47,7 +47,7 @@ public KeyCurveName curve() { * @param curve The curve to set * @return the EcKeyCreateOptions object itself. */ - public EcKeyCreateOptions curve(KeyCurveName curve) { + public EcKeyCreateOptions setCurve(KeyCurveName curve) { this.curve = curve; return this; } @@ -59,7 +59,7 @@ public EcKeyCreateOptions curve(KeyCurveName curve) { * @return the EcKeyCreateOptions object itself. */ @Override - public EcKeyCreateOptions keyOperations(KeyOperation... keyOperations) { + public EcKeyCreateOptions setKeyOperations(KeyOperation... keyOperations) { this.keyOperations = Arrays.asList(keyOperations); return this; } @@ -71,8 +71,8 @@ public EcKeyCreateOptions keyOperations(KeyOperation... keyOperations) { * @return the EcKeyCreateOptions object itself. */ @Override - public EcKeyCreateOptions notBefore(OffsetDateTime notBefore) { - super.notBefore(notBefore); + public EcKeyCreateOptions setNotBefore(OffsetDateTime notBefore) { + super.setNotBefore(notBefore); return this; } @@ -83,8 +83,8 @@ public EcKeyCreateOptions notBefore(OffsetDateTime notBefore) { * @return the EcKeyCreateOptions object itself. */ @Override - public EcKeyCreateOptions expires(OffsetDateTime expires) { - super.expires(expires); + public EcKeyCreateOptions setExpires(OffsetDateTime expires) { + super.setExpires(expires); return this; } @@ -95,8 +95,8 @@ public EcKeyCreateOptions expires(OffsetDateTime expires) { * @return the EcKeyCreateOptions object itself. */ @Override - public EcKeyCreateOptions tags(Map tags) { - super.tags(tags); + public EcKeyCreateOptions setTags(Map tags) { + super.setTags(tags); return this; } @@ -106,8 +106,8 @@ public EcKeyCreateOptions tags(Map tags) { * @param enabled The enabled value to set * @return the EcKeyCreateOptions object itself. */ - public KeyCreateOptions enabled(Boolean enabled) { - super.enabled(enabled); + public KeyCreateOptions setEnabled(Boolean enabled) { + super.setEnabled(enabled); return this; } @@ -116,7 +116,7 @@ public KeyCreateOptions enabled(Boolean enabled) { * @param hsm The hsm value to set. * @return the EcKeyCreateOptions object itself. */ - public EcKeyCreateOptions hsm(Boolean hsm) { + public EcKeyCreateOptions setHsm(Boolean hsm) { this.hsm = hsm; this.keyType = hsm ? KeyType.EC_HSM : KeyType.EC; return this; @@ -126,7 +126,7 @@ public EcKeyCreateOptions hsm(Boolean hsm) { * Get the hsm value of the key being created. * @return the hsm value. */ - public Boolean hsm() { + public Boolean isHsm() { return this.hsm; } } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/Key.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/Key.java index 98552a057e00..f1763ac9941e 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/Key.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/Key.java @@ -18,7 +18,7 @@ public class Key extends KeyBase { * * @return the key value */ - public JsonWebKey keyMaterial() { + public JsonWebKey getKeyMaterial() { return this.keyMaterial; } @@ -29,8 +29,8 @@ public JsonWebKey keyMaterial() { * @return the Key object itself. */ @Override - public Key notBefore(OffsetDateTime notBefore) { - super.notBefore(notBefore); + public Key setNotBefore(OffsetDateTime notBefore) { + super.setNotBefore(notBefore); return this; } @@ -41,8 +41,8 @@ public Key notBefore(OffsetDateTime notBefore) { * @return the Key object itself. */ @Override - public Key expires(OffsetDateTime expires) { - super.expires(expires); + public Key setExpires(OffsetDateTime expires) { + super.setExpires(expires); return this; } @@ -52,8 +52,8 @@ public Key expires(OffsetDateTime expires) { * @param tags The tags to set * @return the Key object itself. */ - public Key tags(Map tags) { - super.tags(tags); + public Key setTags(Map tags) { + super.setTags(tags); return this; } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/KeyBase.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/KeyBase.java index 562527c0bbf6..5418954efce6 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/KeyBase.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/KeyBase.java @@ -139,7 +139,7 @@ public OffsetDateTime notBefore() { * @param notBefore The notBefore UTC time to set * @return the KeyBase object itself. */ - public KeyBase notBefore(OffsetDateTime notBefore) { + public KeyBase setNotBefore(OffsetDateTime notBefore) { this.notBefore = notBefore; return this; } @@ -162,7 +162,7 @@ public OffsetDateTime expires() { * @param expires The expiry time to set for the key. * @return the KeyBase object itself. */ - public KeyBase expires(OffsetDateTime expires) { + public KeyBase setExpires(OffsetDateTime expires) { this.expires = expires; return this; } @@ -210,7 +210,7 @@ public Map tags() { * @param tags The tags to set * @return the KeyBase object itself. */ - public KeyBase tags(Map tags) { + public KeyBase setTags(Map tags) { this.tags = tags; return this; } @@ -295,22 +295,22 @@ List getKeyOperations(List jsonWebKeyOps) { JsonWebKey createKeyMaterialFromJson(Map key) { final Base64 base64 = new Base64(-1, null, true); JsonWebKey outputKey = new JsonWebKey() - .y(base64.decode((String) key.get("y"))) - .x(base64.decode((String) key.get("x"))) - .crv(KeyCurveName.fromString((String) key.get("crv"))) - .keyOps(getKeyOperations((List) key.get("key_ops"))) - .t(base64.decode((String) key.get("key_hsm"))) - .k(base64.decode((String) key.get("k"))) - .q(base64.decode((String) key.get("q"))) - .p(base64.decode((String) key.get("p"))) - .qi(base64.decode((String) key.get("qi"))) - .dq(base64.decode((String) key.get("dq"))) - .dp(base64.decode((String) key.get("dp"))) - .d(base64.decode((String) key.get("d"))) - .e(base64.decode((String) key.get("e"))) - .n(base64.decode((String) key.get("n"))) - .kty(KeyType.fromString((String) key.get("kty"))) - .kid((String) key.get("kid")); + .setY(base64.decode((String) key.get("y"))) + .setX(base64.decode((String) key.get("x"))) + .setCrv(KeyCurveName.fromString((String) key.get("crv"))) + .setKeyOps(getKeyOperations((List) key.get("key_ops"))) + .setT(base64.decode((String) key.get("key_hsm"))) + .setK(base64.decode((String) key.get("k"))) + .setQ(base64.decode((String) key.get("q"))) + .setP(base64.decode((String) key.get("p"))) + .setQi(base64.decode((String) key.get("qi"))) + .setDq(base64.decode((String) key.get("dq"))) + .setDp(base64.decode((String) key.get("dp"))) + .setD(base64.decode((String) key.get("d"))) + .setE(base64.decode((String) key.get("e"))) + .setN(base64.decode((String) key.get("n"))) + .setKty(KeyType.fromString((String) key.get("kty"))) + .setKid((String) key.get("kid")); unpackId((String) key.get("kid")); return outputKey; } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/KeyCreateOptions.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/KeyCreateOptions.java index 7dcadeeae57f..5c5090a4d453 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/KeyCreateOptions.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/KeyCreateOptions.java @@ -77,7 +77,7 @@ public List keyOperations() { * @param keyOperations The key operations value to set * @return the KeyCreateOptions object itself. */ - public KeyCreateOptions keyOperations(KeyOperation... keyOperations) { + public KeyCreateOptions setKeyOperations(KeyOperation... keyOperations) { this.keyOperations = Arrays.asList(keyOperations); return this; } @@ -97,7 +97,7 @@ public KeyType keyType() { * @param notBefore The notBefore UTC time to set * @return the KeyCreateOptions object itself. */ - public KeyCreateOptions notBefore(OffsetDateTime notBefore) { + public KeyCreateOptions setNotBefore(OffsetDateTime notBefore) { this.notBefore = notBefore; return this; } @@ -117,7 +117,7 @@ public OffsetDateTime notBefore() { * @param expires The expiry time to set for the key. * @return the KeyCreateOptions object itself. */ - public KeyCreateOptions expires(OffsetDateTime expires) { + public KeyCreateOptions setExpires(OffsetDateTime expires) { this.expires = expires; return this; } @@ -137,7 +137,7 @@ public OffsetDateTime expires() { * @param tags The tags to set * @return the KeyCreateOptions object itself. */ - public KeyCreateOptions tags(Map tags) { + public KeyCreateOptions setTags(Map tags) { this.tags = tags; return this; } @@ -157,7 +157,7 @@ public Map tags() { * @param enabled The enabled value to set * @return the KeyCreateOptions object itself. */ - public KeyCreateOptions enabled(Boolean enabled) { + public KeyCreateOptions setEnabled(Boolean enabled) { this.enabled = enabled; return this; } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/KeyImportOptions.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/KeyImportOptions.java index fe715b88dbf4..0225e96f508a 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/KeyImportOptions.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/KeyImportOptions.java @@ -10,7 +10,7 @@ public class KeyImportOptions extends KeyBase { /** * The Key Material. */ - private JsonWebKey keyMaterial; + private final JsonWebKey keyMaterial; /** * The hsm indicator for the key. @@ -32,7 +32,7 @@ public KeyImportOptions(String name, JsonWebKey keyMaterial) { * @param hsm The hsm value to set. * @return the KeyImportOptions object itself. */ - public KeyImportOptions hsm(Boolean hsm) { + public KeyImportOptions setHsm(Boolean hsm) { this.hsm = hsm; return this; } @@ -41,7 +41,7 @@ public KeyImportOptions hsm(Boolean hsm) { * Get the hsm value of the key being imported. * @return the hsm value. */ - public Boolean hsm() { + public Boolean isHsm() { return this.hsm; } @@ -49,7 +49,7 @@ public Boolean hsm() { * Get the key material of the key being imported. * @return the key material. */ - public JsonWebKey keyMaterial() { + public JsonWebKey getKeyMaterial() { return keyMaterial; } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/RsaKeyCreateOptions.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/RsaKeyCreateOptions.java index 831ce2cd18b2..4f52e946502d 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/RsaKeyCreateOptions.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/RsaKeyCreateOptions.java @@ -36,7 +36,7 @@ public RsaKeyCreateOptions(String name) { * * @return the keySize value */ - public Integer keySize() { + public Integer getKeySize() { return this.keySize; } @@ -46,7 +46,7 @@ public Integer keySize() { * @param keySize The keySize value to set * @return the RsaKeyCreateOptions object itself. */ - public RsaKeyCreateOptions keySize(Integer keySize) { + public RsaKeyCreateOptions setKeySize(Integer keySize) { this.keySize = keySize; return this; } @@ -58,7 +58,7 @@ public RsaKeyCreateOptions keySize(Integer keySize) { * @return the RsaKeyCreateOptions object itself. */ @Override - public RsaKeyCreateOptions keyOperations(KeyOperation... keyOperations) { + public RsaKeyCreateOptions setKeyOperations(KeyOperation... keyOperations) { this.keyOperations = Arrays.asList(keyOperations); return this; } @@ -70,8 +70,8 @@ public RsaKeyCreateOptions keyOperations(KeyOperation... keyOperations) { * @return the RsaKeyCreateOptions object itself. */ @Override - public RsaKeyCreateOptions notBefore(OffsetDateTime notBefore) { - super.notBefore(notBefore); + public RsaKeyCreateOptions setNotBefore(OffsetDateTime notBefore) { + super.setNotBefore(notBefore); return this; } @@ -82,8 +82,8 @@ public RsaKeyCreateOptions notBefore(OffsetDateTime notBefore) { * @return the RsaKeyCreateOptions object itself. */ @Override - public RsaKeyCreateOptions expires(OffsetDateTime expires) { - super.expires(expires); + public RsaKeyCreateOptions setExpires(OffsetDateTime expires) { + super.setExpires(expires); return this; } @@ -94,8 +94,8 @@ public RsaKeyCreateOptions expires(OffsetDateTime expires) { * @return the RsaKeyCreateOptions object itself. */ @Override - public RsaKeyCreateOptions tags(Map tags) { - super.tags(tags); + public RsaKeyCreateOptions setTags(Map tags) { + super.setTags(tags); return this; } @@ -105,8 +105,8 @@ public RsaKeyCreateOptions tags(Map tags) { * @param enabled The enabled value to set * @return the RsaKeyCreateOptions object itself. */ - public RsaKeyCreateOptions enabled(Boolean enabled) { - super.enabled(enabled); + public RsaKeyCreateOptions setEnabled(Boolean enabled) { + super.setEnabled(enabled); return this; } @@ -115,7 +115,7 @@ public RsaKeyCreateOptions enabled(Boolean enabled) { * @param hsm The hsm value to set. * @return the RsaKeyCreateOptions object itself. */ - public RsaKeyCreateOptions hsm(Boolean hsm) { + public RsaKeyCreateOptions setHsm(Boolean hsm) { this.hsm = hsm; this.keyType = hsm ? KeyType.RSA_HSM : KeyType.RSA; return this; @@ -125,7 +125,7 @@ public RsaKeyCreateOptions hsm(Boolean hsm) { * Get the hsm value of the key being created. * @return the hsm value. */ - public Boolean hsm() { + public Boolean isHsm() { return this.hsm; } } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/webkey/Base64UrlJsonSerializer.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/webkey/Base64UrlJsonSerializer.java index 61d0eb16f5bd..8dd663a03c97 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/webkey/Base64UrlJsonSerializer.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/webkey/Base64UrlJsonSerializer.java @@ -19,7 +19,8 @@ class Base64UrlJsonSerializer extends JsonSerializer { static final Base64 BASE64 = new Base64(-1, null, true); @Override - public void serialize(byte[] value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + public void serialize(byte[] value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { String text; if (value == null) { text = null; diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/webkey/JsonWebKey.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/webkey/JsonWebKey.java index d287d522a03e..3ac1690f06a5 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/webkey/JsonWebKey.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/models/webkey/JsonWebKey.java @@ -3,6 +3,7 @@ package com.azure.security.keyvault.keys.models.webkey; +import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @@ -48,8 +49,10 @@ /** * As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. */ -@JsonAutoDetect(getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY, setterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY) +@JsonAutoDetect(getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY, setterVisibility = + JsonAutoDetect.Visibility.PUBLIC_ONLY) public class JsonWebKey { + private final ClientLogger logger = new ClientLogger(JsonWebKey.class); /** * Key Identifier. @@ -155,7 +158,7 @@ public class JsonWebKey { * @return the kid value */ @JsonProperty("kid") - public String kid() { + public String getKid() { return this.kid; } @@ -165,7 +168,7 @@ public String kid() { * @param kid The kid value to set * @return the JsonWebKey object itself. */ - public JsonWebKey kid(String kid) { + public JsonWebKey setKid(String kid) { this.kid = kid; return this; } @@ -176,7 +179,7 @@ public JsonWebKey kid(String kid) { * @return the kty value */ @JsonProperty("kty") - public KeyType kty() { + public KeyType getKty() { return this.kty; } @@ -186,7 +189,7 @@ public KeyType kty() { * @param kty The key type * @return the JsonWebKey object itself. */ - public JsonWebKey kty(KeyType kty) { + public JsonWebKey setKty(KeyType kty) { this.kty = kty; return this; } @@ -197,7 +200,7 @@ public JsonWebKey kty(KeyType kty) { * @return the keyOps value */ @JsonProperty("key_ops") - public List keyOps() { + public List getKeyOps() { return this.keyOps; } @@ -207,7 +210,7 @@ public List keyOps() { * @param keyOps The keyOps value to set * @return the JsonWebKey object itself. */ - public JsonWebKey keyOps(List keyOps) { + public JsonWebKey setKeyOps(List keyOps) { this.keyOps = keyOps; return this; } @@ -220,7 +223,7 @@ public JsonWebKey keyOps(List keyOps) { @JsonProperty("n") @JsonSerialize(using = Base64UrlJsonSerializer.class) @JsonDeserialize(using = Base64UrlJsonDeserializer.class) - public byte[] n() { + public byte[] getN() { return ByteExtensions.clone(this.n); } @@ -230,7 +233,7 @@ public byte[] n() { * @param n The n value to set * @return the JsonWebKey object itself. */ - public JsonWebKey n(byte[] n) { + public JsonWebKey setN(byte[] n) { this.n = ByteExtensions.clone(n); return this; } @@ -243,7 +246,7 @@ public JsonWebKey n(byte[] n) { @JsonProperty("e") @JsonSerialize(using = Base64UrlJsonSerializer.class) @JsonDeserialize(using = Base64UrlJsonDeserializer.class) - public byte[] e() { + public byte[] getE() { return ByteExtensions.clone(this.e); } @@ -253,7 +256,7 @@ public byte[] e() { * @param e The e value to set * @return the JsonWebKey object itself. */ - public JsonWebKey e(byte[] e) { + public JsonWebKey setE(byte[] e) { this.e = ByteExtensions.clone(e); return this; } @@ -266,7 +269,7 @@ public JsonWebKey e(byte[] e) { @JsonProperty("d") @JsonSerialize(using = Base64UrlJsonSerializer.class) @JsonDeserialize(using = Base64UrlJsonDeserializer.class) - public byte[] d() { + public byte[] getD() { return ByteExtensions.clone(this.d); } @@ -276,7 +279,7 @@ public byte[] d() { * @param d The d value to set * @return the JsonWebKey object itself. */ - public JsonWebKey d(byte[] d) { + public JsonWebKey setD(byte[] d) { this.d = ByteExtensions.clone(d); return this; } @@ -289,7 +292,7 @@ public JsonWebKey d(byte[] d) { @JsonProperty("dp") @JsonSerialize(using = Base64UrlJsonSerializer.class) @JsonDeserialize(using = Base64UrlJsonDeserializer.class) - public byte[] dp() { + public byte[] getDp() { return ByteExtensions.clone(this.dp); } @@ -299,7 +302,7 @@ public byte[] dp() { * @param dp The RSA Private Key Parameter value to set. * @return the JsonWebKey object itself. */ - public JsonWebKey dp(byte[] dp) { + public JsonWebKey setDp(byte[] dp) { this.dp = ByteExtensions.clone(dp); return this; } @@ -312,7 +315,7 @@ public JsonWebKey dp(byte[] dp) { @JsonProperty("dq") @JsonSerialize(using = Base64UrlJsonSerializer.class) @JsonDeserialize(using = Base64UrlJsonDeserializer.class) - public byte[] dq() { + public byte[] getDq() { return ByteExtensions.clone(this.dq); } @@ -322,7 +325,7 @@ public byte[] dq() { * @param dq The RSA Private Key Parameter value to set. * @return the JsonWebKey object itself. */ - public JsonWebKey dq(byte[] dq) { + public JsonWebKey setDq(byte[] dq) { this.dq = ByteExtensions.clone(dq); return this; } @@ -335,7 +338,7 @@ public JsonWebKey dq(byte[] dq) { @JsonProperty("qi") @JsonSerialize(using = Base64UrlJsonSerializer.class) @JsonDeserialize(using = Base64UrlJsonDeserializer.class) - public byte[] qi() { + public byte[] getQi() { return ByteExtensions.clone(this.qi); } @@ -345,7 +348,7 @@ public byte[] qi() { * @param qi The RSA Private Key Parameter value to set. * @return the JsonWebKey object itself. */ - public JsonWebKey qi(byte[] qi) { + public JsonWebKey setQi(byte[] qi) { this.qi = ByteExtensions.clone(qi); return this; } @@ -358,7 +361,7 @@ public JsonWebKey qi(byte[] qi) { @JsonProperty("p") @JsonSerialize(using = Base64UrlJsonSerializer.class) @JsonDeserialize(using = Base64UrlJsonDeserializer.class) - public byte[] p() { + public byte[] getP() { return ByteExtensions.clone(this.p); } @@ -368,7 +371,7 @@ public byte[] p() { * @param p The RSA secret prime value. * @return the JsonWebKey object itself. */ - public JsonWebKey p(byte[] p) { + public JsonWebKey setP(byte[] p) { this.p = ByteExtensions.clone(p); return this; } @@ -381,7 +384,7 @@ public JsonWebKey p(byte[] p) { @JsonProperty("q") @JsonSerialize(using = Base64UrlJsonSerializer.class) @JsonDeserialize(using = Base64UrlJsonDeserializer.class) - public byte[] q() { + public byte[] getQ() { return ByteExtensions.clone(this.q); } @@ -391,7 +394,7 @@ public byte[] q() { * @param q The the RSA secret prime, with p < q value to be set. * @return the JsonWebKey object itself. */ - public JsonWebKey q(byte[] q) { + public JsonWebKey setQ(byte[] q) { this.q = ByteExtensions.clone(q); return this; } @@ -404,7 +407,7 @@ public JsonWebKey q(byte[] q) { @JsonProperty("k") @JsonSerialize(using = Base64UrlJsonSerializer.class) @JsonDeserialize(using = Base64UrlJsonDeserializer.class) - public byte[] k() { + public byte[] getK() { return ByteExtensions.clone(this.k); } @@ -414,7 +417,7 @@ public byte[] k() { * @param k The symmetric key value to set. * @return the JsonWebKey object itself. */ - public JsonWebKey k(byte[] k) { + public JsonWebKey setK(byte[] k) { this.k = ByteExtensions.clone(k); return this; } @@ -427,7 +430,7 @@ public JsonWebKey k(byte[] k) { @JsonProperty("key_hsm") @JsonSerialize(using = Base64UrlJsonSerializer.class) @JsonDeserialize(using = Base64UrlJsonDeserializer.class) - public byte[] t() { + public byte[] getT() { return ByteExtensions.clone(this.t); } @@ -437,7 +440,7 @@ public byte[] t() { * @param t The HSM Token value to set, used with Bring Your Own Key * @return the JsonWebKey object itself. */ - public JsonWebKey t(byte[] t) { + public JsonWebKey setT(byte[] t) { this.t = ByteExtensions.clone(t); return this; } @@ -448,11 +451,11 @@ public String toString() { try { return mapper.writeValueAsString(this); } catch (JsonGenerationException e) { - throw new IllegalStateException(e); + throw logger.logExceptionAsError(new IllegalStateException(e)); } catch (JsonMappingException e) { - throw new IllegalStateException(e); + throw logger.logExceptionAsError(new IllegalStateException(e)); } catch (IOException e) { - throw new IllegalStateException(e); + throw logger.logExceptionAsError(new IllegalStateException(e)); } } @@ -462,7 +465,7 @@ public String toString() { * @return the crv value */ @JsonProperty("crv") - public KeyCurveName crv() { + public KeyCurveName getCrv() { return this.crv; } @@ -472,7 +475,7 @@ public KeyCurveName crv() { * @param crv The crv value to set * @return the JsonWebKey object itself. */ - public JsonWebKey crv(KeyCurveName crv) { + public JsonWebKey setCrv(KeyCurveName crv) { this.crv = crv; return this; } @@ -485,7 +488,7 @@ public JsonWebKey crv(KeyCurveName crv) { @JsonProperty("x") @JsonSerialize(using = Base64UrlJsonSerializer.class) @JsonDeserialize(using = Base64UrlJsonDeserializer.class) - public byte[] x() { + public byte[] getX() { return ByteExtensions.clone(this.x); } @@ -495,7 +498,7 @@ public byte[] x() { * @param x The x value to set * @return the JsonWebKey object itself. */ - public JsonWebKey x(byte[] x) { + public JsonWebKey setX(byte[] x) { this.x = ByteExtensions.clone(x); return this; } @@ -508,7 +511,7 @@ public JsonWebKey x(byte[] x) { @JsonProperty("y") @JsonSerialize(using = Base64UrlJsonSerializer.class) @JsonDeserialize(using = Base64UrlJsonDeserializer.class) - public byte[] y() { + public byte[] getY() { return ByteExtensions.clone(this.y); } @@ -518,7 +521,7 @@ public byte[] y() { * @param y The y value to set * @return the JsonWebKey object itself. */ - public JsonWebKey y(byte[] y) { + public JsonWebKey setY(byte[] y) { this.y = ByteExtensions.clone(y); return this; } @@ -541,7 +544,7 @@ private RSAPublicKeySpec getRSAPublicKeySpec() { private RSAPrivateKeySpec getRSAPrivateKeySpec() { return new RSAPrivateCrtKeySpec(toBigInteger(n), toBigInteger(e), toBigInteger(d), toBigInteger(p), - toBigInteger(q), toBigInteger(dp), toBigInteger(dq), toBigInteger(qi)); + toBigInteger(q), toBigInteger(dp), toBigInteger(dq), toBigInteger(qi)); } /** @@ -555,11 +558,11 @@ private PublicKey getRSAPublicKey(Provider provider) { try { RSAPublicKeySpec publicKeySpec = getRSAPublicKeySpec(); KeyFactory factory = provider != null ? KeyFactory.getInstance("RSA", provider) - : KeyFactory.getInstance("RSA"); + : KeyFactory.getInstance("RSA"); return factory.generatePublic(publicKeySpec); } catch (GeneralSecurityException e) { - throw new IllegalStateException(e); + throw logger.logExceptionAsError(new IllegalStateException(e)); } } @@ -574,11 +577,11 @@ private PrivateKey getRSAPrivateKey(Provider provider) { try { RSAPrivateKeySpec privateKeySpec = getRSAPrivateKeySpec(); KeyFactory factory = provider != null ? KeyFactory.getInstance("RSA", provider) - : KeyFactory.getInstance("RSA"); + : KeyFactory.getInstance("RSA"); return factory.generatePrivate(privateKeySpec); } catch (GeneralSecurityException e) { - throw new IllegalStateException(e); + throw logger.logExceptionAsError(new IllegalStateException(e)); } } @@ -587,7 +590,7 @@ private static PublicKey getECPublicKey(ECPoint ecPoint, ECParameterSpec curveSp try { ECPublicKeySpec pubSpec = new ECPublicKeySpec(ecPoint, curveSpec); KeyFactory kf = provider != null ? KeyFactory.getInstance("EC", provider) - : KeyFactory.getInstance("EC", "SunEC"); + : KeyFactory.getInstance("EC", "SunEC"); return (ECPublicKey) kf.generatePublic(pubSpec); } catch (GeneralSecurityException e) { throw new IllegalStateException(e); @@ -598,7 +601,7 @@ private static PrivateKey getECPrivateKey(byte[] d, ECParameterSpec curveSpec, P try { ECPrivateKeySpec priSpec = new ECPrivateKeySpec(new BigInteger(1, d), curveSpec); KeyFactory kf = provider != null ? KeyFactory.getInstance("EC", provider) - : KeyFactory.getInstance("EC", "SunEC"); + : KeyFactory.getInstance("EC", "SunEC"); return (ECPrivateKey) kf.generatePrivate(priSpec); } catch (GeneralSecurityException e) { throw new IllegalStateException(e); @@ -610,7 +613,7 @@ private static PrivateKey getECPrivateKey(byte[] d, ECParameterSpec curveSpec, P */ private void checkRSACompatible() { if (!KeyType.RSA.equals(kty) && !KeyType.RSA_HSM.equals(kty)) { - throw new UnsupportedOperationException("Not an RSA key"); + throw logger.logExceptionAsError(new UnsupportedOperationException("Not an RSA key")); } } @@ -649,19 +652,19 @@ public static JsonWebKey fromRSA(KeyPair keyPair) { if (privateKey != null) { - key = new JsonWebKey().kty(KeyType.RSA).n(toByteArray(privateKey.getModulus())) - .e(toByteArray(privateKey.getPublicExponent())) - .d(toByteArray(privateKey.getPrivateExponent())).p(toByteArray(privateKey.getPrimeP())) - .q(toByteArray(privateKey.getPrimeQ())).dp(toByteArray(privateKey.getPrimeExponentP())) - .dq(toByteArray(privateKey.getPrimeExponentQ())) - .qi(toByteArray(privateKey.getCrtCoefficient())); + key = new JsonWebKey().setKty(KeyType.RSA).setN(toByteArray(privateKey.getModulus())) + .setE(toByteArray(privateKey.getPublicExponent())) + .setD(toByteArray(privateKey.getPrivateExponent())).setP(toByteArray(privateKey.getPrimeP())) + .setQ(toByteArray(privateKey.getPrimeQ())).setDp(toByteArray(privateKey.getPrimeExponentP())) + .setDq(toByteArray(privateKey.getPrimeExponentQ())) + .setQi(toByteArray(privateKey.getCrtCoefficient())); } else { RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); - key = new JsonWebKey().kty(KeyType.RSA).n(toByteArray(publicKey.getModulus())) - .e(toByteArray(publicKey.getPublicExponent())).d(null).p(null).q(null).dp(null) - .dq(null).qi(null); + key = new JsonWebKey().setKty(KeyType.RSA).setN(toByteArray(publicKey.getModulus())) + .setE(toByteArray(publicKey.getPublicExponent())).setD(null).setP(null).setQ(null).setDp(null) + .setDq(null).setQi(null); } return key; @@ -746,7 +749,7 @@ public KeyPair toEC(boolean includePrivateParameters, Provider provider) { } if (!KeyType.EC.equals(kty) && !KeyType.EC_HSM.equals(kty)) { - throw new IllegalArgumentException("Not an EC key."); + throw logger.logExceptionAsError(new IllegalArgumentException("Not an EC key.")); } try { @@ -766,14 +769,14 @@ public KeyPair toEC(boolean includePrivateParameters, Provider provider) { if (includePrivateParameters) { realKeyPair = new KeyPair(getECPublicKey(ecPoint, aspec, provider), - getECPrivateKey(d, aspec, provider)); + getECPrivateKey(d, aspec, provider)); } else { realKeyPair = new KeyPair(getECPublicKey(ecPoint, aspec, provider), null); } return realKeyPair; } catch (GeneralSecurityException e) { - throw new IllegalStateException(e); + throw logger.logExceptionAsError(new IllegalStateException(e)); } } @@ -791,13 +794,13 @@ public static JsonWebKey fromEC(KeyPair keyPair, Provider provider) { ECPrivateKey apriv = (ECPrivateKey) keyPair.getPrivate(); if (apriv != null) { - return new JsonWebKey().kty(KeyType.EC).crv(getCurveFromKeyPair(keyPair, provider)) - .x(point.getAffineX().toByteArray()).y(point.getAffineY().toByteArray()) - .d(apriv.getS().toByteArray()).kty(KeyType.EC); + return new JsonWebKey().setKty(KeyType.EC).setCrv(getCurveFromKeyPair(keyPair, provider)) + .setX(point.getAffineX().toByteArray()).setY(point.getAffineY().toByteArray()) + .setD(apriv.getS().toByteArray()).setKty(KeyType.EC); } else { - return new JsonWebKey().kty(KeyType.EC).crv(getCurveFromKeyPair(keyPair, provider)) - .x(point.getAffineX().toByteArray()).y(point.getAffineY().toByteArray()) - .kty(KeyType.EC); + return new JsonWebKey().setKty(KeyType.EC).setCrv(getCurveFromKeyPair(keyPair, provider)) + .setX(point.getAffineX().toByteArray()).setY(point.getAffineY().toByteArray()) + .setKty(KeyType.EC); } } @@ -810,7 +813,7 @@ private static KeyCurveName getCurveFromKeyPair(KeyPair keyPair, Provider provid EllipticCurve crv = spec.getCurve(); List curveList = Arrays.asList(KeyCurveName.P_256, KeyCurveName.P_384, - KeyCurveName.P_521, KeyCurveName.P_256K); + KeyCurveName.P_521, KeyCurveName.P_256K); for (KeyCurveName curve : curveList) { ECGenParameterSpec gps = new ECGenParameterSpec(CURVE_TO_SPEC_NAME.get(curve)); @@ -847,7 +850,7 @@ public static JsonWebKey fromAes(SecretKey secretKey) { return null; } - return new JsonWebKey().k(secretKey.getEncoded()).kty(KeyType.OCT); + return new JsonWebKey().setK(secretKey.getEncoded()).setKty(KeyType.OCT); } /** @@ -880,7 +883,7 @@ public boolean equals(Object obj) { * * @param jwk The other {@link JsonWebKey} to compare with. * @return true if this {@link JsonWebKey} is the same as the jwk argument; - * false otherwise. + * false otherwise. */ public boolean equals(JsonWebKey jwk) { if (jwk == null) { @@ -979,7 +982,8 @@ public boolean isValid() { } if (keyOps != null) { - final Set set = new HashSet(Collections.unmodifiableList(Arrays.asList(KeyOperation.values()))); + final Set set = + new HashSet(Collections.unmodifiableList(Arrays.asList(KeyOperation.values()))); for (int i = 0; i < keyOps.size(); i++) { if (!set.contains(keyOps.get(i))) { return false; diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperations.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperations.java index c15b94a41cea..c47029a8a7df 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperations.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperations.java @@ -39,8 +39,8 @@ public static void main(String[] args) throws IOException, InterruptedException, // Let's create a Rsa key valid for 1 year. if the key // already exists in the key vault, then a new version of the key is created. keyClient.createRsaKey(new RsaKeyCreateOptions("CloudRsaKey") - .expires(OffsetDateTime.now().plusYears(1)) - .keySize(2048)); + .setExpires(OffsetDateTime.now().plusYears(1)) + .setKeySize(2048)); // Backups are good to have, if in case keys get accidentally deleted by you. // For long term storage, it is ideal to write the backup to a file. diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperationsAsync.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperationsAsync.java index 0a748467c3bb..63161ab869bc 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperationsAsync.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperationsAsync.java @@ -38,10 +38,10 @@ public static void main(String[] args) throws IOException, InterruptedException, // Let's create Cloud Rsa key valid for 1 year. if the key // already exists in the key vault, then a new version of the key is created. keyAsyncClient.createRsaKey(new RsaKeyCreateOptions("CloudRsaKey") - .expires(OffsetDateTime.now().plusYears(1)) - .keySize(2048)) + .setExpires(OffsetDateTime.now().plusYears(1)) + .setKeySize(2048)) .subscribe(keyResponse -> - System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty())); + System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.getKeyMaterial().getKty())); Thread.sleep(2000); @@ -57,14 +57,14 @@ public static void main(String[] args) throws IOException, InterruptedException, // The Cloud Rsa key is no longer in use, so you delete it. keyAsyncClient.deleteKey("CloudRsaKey").subscribe(deletedKeyResponse -> - System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.recoveryId())); + System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.getRecoveryId())); //To ensure file is deleted on server side. Thread.sleep(30000); // If the vault is soft-delete enabled, then you need to purge the key as well for permanent deletion. keyAsyncClient.purgeDeletedKey("CloudRsaKey").subscribe(purgeResponse -> - System.out.printf("Purge Status response %d \n", purgeResponse.statusCode())); + System.out.printf("Purge Status response %d \n", purgeResponse.getStatusCode())); //To ensure file is purged on server side. Thread.sleep(15000); diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorld.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorld.java index e4a68fc53350..5ea2b44a02be 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorld.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorld.java @@ -36,28 +36,28 @@ public static void main(String[] args) throws InterruptedException, IllegalArgum // Let's create a Rsa key valid for 1 year. if the key // already exists in the key vault, then a new version of the key is created. Response createKeyResponse = keyClient.createRsaKeyWithResponse(new RsaKeyCreateOptions("CloudRsaKey") - .expires(OffsetDateTime.now().plusYears(1)) - .keySize(2048), new Context("key1", "value1")); + .setExpires(OffsetDateTime.now().plusYears(1)) + .setKeySize(2048), new Context("key1", "value1")); // Let's validate create key operation succeeded using the status code information in the response. - System.out.printf("Create Key operation succeeded with status code %s \n", createKeyResponse.statusCode()); + System.out.printf("Create Key operation succeeded with status code %s \n", createKeyResponse.getStatusCode()); // Let's Get the Cloud Rsa Key from the key vault. Key cloudRsaKey = keyClient.getKey("CloudRsaKey"); System.out.printf("Key is returned with name %s and type %s \n", cloudRsaKey.name(), - cloudRsaKey.keyMaterial().kty()); + cloudRsaKey.getKeyMaterial().getKty()); // After one year, the Cloud Rsa Key is still required, we need to update the expiry time of the key. // The update method can be used to update the expiry attribute of the key. - cloudRsaKey.expires(cloudRsaKey.expires().plusYears(1)); + cloudRsaKey.setExpires(cloudRsaKey.expires().plusYears(1)); Key updatedKey = keyClient.updateKey(cloudRsaKey); System.out.printf("Key's updated expiry time %s \n", updatedKey.expires()); // We need the Cloud Rsa key with bigger key size, so you want to update the key in key vault to ensure it has the required size. // Calling createRsaKey on an existing key creates a new version of the key in the key vault with the new specified size. keyClient.createRsaKey(new RsaKeyCreateOptions("CloudRsaKey") - .expires(OffsetDateTime.now().plusYears(1)) - .keySize(4096)); + .setExpires(OffsetDateTime.now().plusYears(1)) + .setKeySize(4096)); // The Cloud Rsa Key is no longer needed, need to delete it from the key vault. keyClient.deleteKey("CloudRsaKey"); diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorldAsync.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorldAsync.java index e14021075190..a68ff55757dc 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorldAsync.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorldAsync.java @@ -34,18 +34,18 @@ public static void main(String[] args) throws InterruptedException { // Let's create Cloud Rsa key valid for 1 year. if the key // already exists in the key vault, then a new version of the key is created. Response createKeyResponse = keyAsyncClient.createRsaKeyWithResponse(new RsaKeyCreateOptions("CloudRsaKey") - .expires(OffsetDateTime.now().plusYears(1)) - .keySize(2048)).block(); + .setExpires(OffsetDateTime.now().plusYears(1)) + .setKeySize(2048)).block(); // Let's validate create key operation succeeded using the status code information in the response. - System.out.printf("Create Key operation succeeded with status code %s \n", createKeyResponse.statusCode()); - System.out.printf("Key is created with name %s and type %s \n", createKeyResponse.value().name(), createKeyResponse.value().keyMaterial().kty()); + System.out.printf("Create Key operation succeeded with status code %s \n", createKeyResponse.getStatusCode()); + System.out.printf("Key is created with name %s and type %s \n", createKeyResponse.getValue().name(), createKeyResponse.getValue().getKeyMaterial().getKty()); Thread.sleep(2000); // Let's Get the Cloud Rsa Key from the key vault. keyAsyncClient.getKey("CloudRsaKey").subscribe(keyResponse -> - System.out.printf("Key returned with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty())); + System.out.printf("Key returned with name %s and type %s \n", keyResponse.name(), keyResponse.getKeyMaterial().getKty())); Thread.sleep(2000); @@ -55,7 +55,7 @@ public static void main(String[] args) throws InterruptedException { keyAsyncClient.getKey("CloudRsaKey").subscribe(keyResponse -> { Key key = keyResponse; //Update the expiry time of the key. - key.expires(key.expires().plusYears(1)); + key.setExpires(key.expires().plusYears(1)); keyAsyncClient.updateKey(key).subscribe(updatedKeyResponse -> System.out.printf("Key's updated expiry time %s \n", updatedKeyResponse.expires().toString())); }); @@ -65,23 +65,23 @@ public static void main(String[] args) throws InterruptedException { // We need the Cloud Rsa key with bigger key size, so you want to update the key in key vault to ensure it has the required size. // Calling createRsaKey on an existing key creates a new version of the key in the key vault with the new specified size. keyAsyncClient.createRsaKey(new RsaKeyCreateOptions("CloudRsaKey") - .expires(OffsetDateTime.now().plusYears(1)) - .keySize(4096)) + .setExpires(OffsetDateTime.now().plusYears(1)) + .setKeySize(4096)) .subscribe(keyResponse -> - System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty())); + System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.getKeyMaterial().getKty())); Thread.sleep(2000); // The Cloud Rsa Key is no longer needed, need to delete it from the key vault. keyAsyncClient.deleteKey("CloudRsaKey").subscribe(deletedKeyResponse -> - System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.recoveryId())); + System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.getRecoveryId())); //To ensure key is deleted on server side. Thread.sleep(30000); // If the keyvault is soft-delete enabled, then for permanent deletion deleted keys need to be purged. keyAsyncClient.purgeDeletedKey("CloudRsaKey").subscribe(purgeResponse -> - System.out.printf("Cloud Rsa key purge status response %d \n", purgeResponse.statusCode())); + System.out.printf("Cloud Rsa key purge status response %d \n", purgeResponse.getStatusCode())); //To ensure key is purged on server side. Thread.sleep(15000); diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyAsyncClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyAsyncClientJavaDocCodeSnippets.java index 3b6bccdcbaa2..71befb6efe9e 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyAsyncClientJavaDocCodeSnippets.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyAsyncClientJavaDocCodeSnippets.java @@ -96,8 +96,8 @@ public void createKey() { // BEGIN: com.azure.security.keyvault.keys.async.keyclient.createKey#keyCreateOptions KeyCreateOptions keyCreateOptions = new KeyCreateOptions("keyName", KeyType.RSA) - .notBefore(OffsetDateTime.now().plusDays(1)) - .expires(OffsetDateTime.now().plusYears(1)); + .setNotBefore(OffsetDateTime.now().plusDays(1)) + .setExpires(OffsetDateTime.now().plusYears(1)); keyAsyncClient.createKey(keyCreateOptions) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(keyResponse -> @@ -106,9 +106,9 @@ public void createKey() { // BEGIN: com.azure.security.keyvault.keys.async.keyclient.createRsaKey#RsaKeyCreateOptions RsaKeyCreateOptions rsaKeyCreateOptions = new RsaKeyCreateOptions("keyName") - .keySize(2048) - .notBefore(OffsetDateTime.now().plusDays(1)) - .expires(OffsetDateTime.now().plusYears(1)); + .setKeySize(2048) + .setNotBefore(OffsetDateTime.now().plusDays(1)) + .setExpires(OffsetDateTime.now().plusYears(1)); keyAsyncClient.createRsaKey(rsaKeyCreateOptions) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(keyResponse -> @@ -117,9 +117,9 @@ public void createKey() { // BEGIN: com.azure.security.keyvault.keys.async.keyclient.createEcKey#EcKeyCreateOptions EcKeyCreateOptions ecKeyCreateOptions = new EcKeyCreateOptions("keyName") - .curve(KeyCurveName.P_384) - .notBefore(OffsetDateTime.now().plusDays(1)) - .expires(OffsetDateTime.now().plusYears(1)); + .setCurve(KeyCurveName.P_384) + .setNotBefore(OffsetDateTime.now().plusDays(1)) + .setExpires(OffsetDateTime.now().plusYears(1)); keyAsyncClient.createEcKey(ecKeyCreateOptions) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(keyResponse -> @@ -136,7 +136,7 @@ public void deleteKeySnippets() { keyAsyncClient.deleteKey("keyName") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(keyResponse -> - System.out.printf("Deleted Key's Recovery Id %s", keyResponse.recoveryId())); + System.out.printf("Deleted Key's Recovery Id %s", keyResponse.getRecoveryId())); // END: com.azure.security.keyvault.keys.async.keyclient.deleteKey#string } @@ -149,7 +149,7 @@ public void getDeletedKeySnippets() { keyAsyncClient.getDeletedKey("keyName") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(keyResponse -> - System.out.printf("Deleted Key's Recovery Id %s", keyResponse.recoveryId())); + System.out.printf("Deleted Key's Recovery Id %s", keyResponse.getRecoveryId())); // END: com.azure.security.keyvault.keys.async.keyclient.getDeletedKey#string } @@ -160,37 +160,37 @@ public void createKeyWithResponses() { KeyAsyncClient keyAsyncClient = createAsyncClient(); // BEGIN: com.azure.security.keyvault.keys.async.keyclient.createKeyWithResponse#keyCreateOptions KeyCreateOptions keyCreateOptions = new KeyCreateOptions("keyName", KeyType.RSA) - .notBefore(OffsetDateTime.now().plusDays(1)) - .expires(OffsetDateTime.now().plusYears(1)); + .setNotBefore(OffsetDateTime.now().plusDays(1)) + .setExpires(OffsetDateTime.now().plusYears(1)); keyAsyncClient.createKeyWithResponse(keyCreateOptions) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(keyResponse -> - System.out.printf("Key is created with name %s and id %s \n", keyResponse.value().name(), - keyResponse.value().id())); + System.out.printf("Key is created with name %s and id %s \n", keyResponse.getValue().name(), + keyResponse.getValue().id())); // END: com.azure.security.keyvault.keys.async.keyclient.createKeyWithResponse#keyCreateOptions // BEGIN: com.azure.security.keyvault.keys.async.keyclient.createRsaKeyWithResponse#RsaKeyCreateOptions RsaKeyCreateOptions rsaKeyCreateOptions = new RsaKeyCreateOptions("keyName") - .keySize(2048) - .notBefore(OffsetDateTime.now().plusDays(1)) - .expires(OffsetDateTime.now().plusYears(1)); + .setKeySize(2048) + .setNotBefore(OffsetDateTime.now().plusDays(1)) + .setExpires(OffsetDateTime.now().plusYears(1)); keyAsyncClient.createRsaKeyWithResponse(rsaKeyCreateOptions) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(keyResponse -> - System.out.printf("Key is created with name %s and id %s \n", keyResponse.value().name(), - keyResponse.value().id())); + System.out.printf("Key is created with name %s and id %s \n", keyResponse.getValue().name(), + keyResponse.getValue().id())); // END: com.azure.security.keyvault.keys.async.keyclient.createRsaKeyWithResponse#RsaKeyCreateOptions // BEGIN: com.azure.security.keyvault.keys.async.keyclient.createEcKeyWithResponse#EcKeyCreateOptions EcKeyCreateOptions ecKeyCreateOptions = new EcKeyCreateOptions("keyName") - .curve(KeyCurveName.P_384) - .notBefore(OffsetDateTime.now().plusDays(1)) - .expires(OffsetDateTime.now().plusYears(1)); + .setCurve(KeyCurveName.P_384) + .setNotBefore(OffsetDateTime.now().plusDays(1)) + .setExpires(OffsetDateTime.now().plusYears(1)); keyAsyncClient.createEcKeyWithResponse(ecKeyCreateOptions) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(keyResponse -> - System.out.printf("Key is created with name %s and id %s \n", keyResponse.value().name(), - keyResponse.value().id())); + System.out.printf("Key is created with name %s and id %s \n", keyResponse.getValue().name(), + keyResponse.getValue().id())); // END: com.azure.security.keyvault.keys.async.keyclient.createEcKeyWithResponse#EcKeyCreateOptions } @@ -205,7 +205,7 @@ public void getKeyWithResponseSnippets() { .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(keyResponse -> System.out.printf("Key is created with name %s and id %s \n", - keyResponse.value().name(), keyResponse.value().id())); + keyResponse.getValue().name(), keyResponse.getValue().id())); // END: com.azure.security.keyvault.keys.async.keyclient.getKeyWithResponse#string-string // BEGIN: com.azure.security.keyvault.keys.async.keyclient.getKeyWithResponse#KeyBase @@ -213,8 +213,8 @@ public void getKeyWithResponseSnippets() { keyAsyncClient.getKeyWithResponse(keyBase) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(keyResponse -> - System.out.printf("Key with name %s and value %s \n", keyResponse.value().name(), - keyResponse.value().id()))); + System.out.printf("Key with name %s and value %s \n", keyResponse.getValue().name(), + keyResponse.getValue().id()))); // END: com.azure.security.keyvault.keys.async.keyclient.getKeyWithResponse#KeyBase } @@ -257,12 +257,12 @@ public void updateKeyWithResponseSnippets() { keyAsyncClient.getKey("keyName") .subscribe(keyResponse -> { //Update the not before time of the key. - keyResponse.notBefore(OffsetDateTime.now().plusDays(50)); + keyResponse.setNotBefore(OffsetDateTime.now().plusDays(50)); keyAsyncClient.updateKeyWithResponse(keyResponse, KeyOperation.ENCRYPT, KeyOperation.DECRYPT) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(updatedKeyResponse -> System.out.printf("Key's updated not before time %s \n", - updatedKeyResponse.value().notBefore().toString())); + updatedKeyResponse.getValue().notBefore().toString())); }); // END: com.azure.security.keyvault.keys.async.keyclient.updateKeyWithResponse#KeyBase-keyOperations @@ -270,12 +270,12 @@ public void updateKeyWithResponseSnippets() { keyAsyncClient.getKey("keyName") .subscribe(keyResponse -> { //Update the not before time of the key. - keyResponse.notBefore(OffsetDateTime.now().plusDays(50)); + keyResponse.setNotBefore(OffsetDateTime.now().plusDays(50)); keyAsyncClient.updateKeyWithResponse(keyResponse) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(updatedKeyResponse -> System.out.printf("Key's updated not before time %s \n", - updatedKeyResponse.value().notBefore().toString())); + updatedKeyResponse.getValue().notBefore().toString())); }); // END: com.azure.security.keyvault.keys.async.keyclient.updateKeyWithResponse#KeyBase } @@ -290,7 +290,7 @@ public void updateKeySnippets() { keyAsyncClient.getKey("keyName") .subscribe(keyResponse -> { //Update the not before time of the key. - keyResponse.notBefore(OffsetDateTime.now().plusDays(50)); + keyResponse.setNotBefore(OffsetDateTime.now().plusDays(50)); keyAsyncClient.updateKey(keyResponse, KeyOperation.ENCRYPT, KeyOperation.DECRYPT) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(updatedKeyResponse -> @@ -303,7 +303,7 @@ public void updateKeySnippets() { keyAsyncClient.getKey("keyName") .subscribe(keyResponse -> { //Update the not before time of the key. - keyResponse.notBefore(OffsetDateTime.now().plusDays(50)); + keyResponse.setNotBefore(OffsetDateTime.now().plusDays(50)); keyAsyncClient.updateKey(keyResponse) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(updatedKeyResponse -> @@ -322,7 +322,7 @@ public void deleteKeyWithResponseSnippets() { keyAsyncClient.deleteKeyWithResponse("keyName") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(deletedKeyResponse -> - System.out.printf("Deleted Key's Recovery Id %s", deletedKeyResponse.value().recoveryId())); + System.out.printf("Deleted Key's Recovery Id %s", deletedKeyResponse.getValue().getRecoveryId())); // END: com.azure.security.keyvault.keys.async.keyclient.deleteKeyWithResponse#string } @@ -335,7 +335,7 @@ public void getDeleteKeyWithResponseSnippets() { keyAsyncClient.getDeletedKeyWithResponse("keyName") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(deletedKeyResponse -> - System.out.printf("Deleted Key's Recovery Id %s", deletedKeyResponse.value().recoveryId())); + System.out.printf("Deleted Key's Recovery Id %s", deletedKeyResponse.getValue().getRecoveryId())); // END: com.azure.security.keyvault.keys.async.keyclient.getDeletedKeyWithResponse#string } @@ -348,7 +348,7 @@ public void purgeDeletedKeySnippets() { keyAsyncClient.purgeDeletedKey("deletedKeyName") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(purgeResponse -> - System.out.printf("Purge Status response %rsaPrivateExponent \n", purgeResponse.statusCode())); + System.out.printf("Purge Status response %rsaPrivateExponent \n", purgeResponse.getStatusCode())); // END: com.azure.security.keyvault.keys.async.keyclient.purgeDeletedKey#string } @@ -361,7 +361,7 @@ public void recoverDeletedKeyWithResponseSnippets() { keyAsyncClient.recoverDeletedKeyWithResponse("deletedKeyName") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(recoveredKeyResponse -> - System.out.printf("Recovered Key with name %s \n", recoveredKeyResponse.value().name())); + System.out.printf("Recovered Key with name %s \n", recoveredKeyResponse.getValue().name())); // END: com.azure.security.keyvault.keys.async.keyclient.recoverDeletedKeyWithResponse#string } @@ -400,7 +400,7 @@ public void backupKeyWithResponseSnippets() { keyAsyncClient.backupKeyWithResponse("keyName") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(keyBackupResponse -> - System.out.printf("Key's Backup Byte array's length %s \n", keyBackupResponse.value().length)); + System.out.printf("Key's Backup Byte array's length %s \n", keyBackupResponse.getValue().length)); // END: com.azure.security.keyvault.keys.async.keyclient.backupKeyWithResponse#string } @@ -428,8 +428,8 @@ public void restoreKeyWithResponseSnippets() { keyAsyncClient.restoreKeyWithResponse(keyBackupByteArray) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(keyResponse -> - System.out.printf("Restored Key with name %s and id %s \n", keyResponse.value().name(), - keyResponse.value().id())); + System.out.printf("Restored Key with name %s and id %s \n", keyResponse.getValue().name(), + keyResponse.getValue().id())); // END: com.azure.security.keyvault.keys.async.keyclient.restoreKeyWithResponse#byte } @@ -443,7 +443,7 @@ public void listKeySnippets() { .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(keyBase -> keyAsyncClient.getKey(keyBase) .subscribe(keyResponse -> System.out.printf("Received key with name %s and type %s", keyResponse.name(), - keyResponse.keyMaterial().kty()))); + keyResponse.getKeyMaterial().getKty()))); // END: com.azure.security.keyvault.keys.async.keyclient.listKeys } @@ -456,7 +456,7 @@ public void listDeletedKeysSnippets() { // BEGIN: com.azure.security.keyvault.keys.async.keyclient.listDeletedKeys keyAsyncClient.listDeletedKeys() .subscriberContext(Context.of(key1, value1, key2, value2)) - .subscribe(deletedKey -> System.out.printf("Deleted key's recovery Id %s", deletedKey.recoveryId())); + .subscribe(deletedKey -> System.out.printf("Deleted key's recovery Id %s", deletedKey.getRecoveryId())); // END: com.azure.security.keyvault.keys.async.keyclient.listDeletedKeys } @@ -471,7 +471,7 @@ public void listKeyVersions() { .subscribe(keyBase -> keyAsyncClient.getKey(keyBase) .subscribe(keyResponse -> System.out.printf("Received key's version with name %s, type %s and version %s", keyResponse.name(), - keyResponse.keyMaterial().kty(), keyResponse.version()))); + keyResponse.getKeyMaterial().getKty(), keyResponse.version()))); // END: com.azure.security.keyvault.keys.async.keyclient.listKeyVersions } diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyClientJavaDocCodeSnippets.java index e0bc0cca3c49..1d51d303075f 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyClientJavaDocCodeSnippets.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyClientJavaDocCodeSnippets.java @@ -56,26 +56,26 @@ public void createKey() { // BEGIN: com.azure.keyvault.keys.keyclient.createKey#keyOptions KeyCreateOptions keyCreateOptions = new KeyCreateOptions("keyName", KeyType.RSA) - .notBefore(OffsetDateTime.now().plusDays(1)) - .expires(OffsetDateTime.now().plusYears(1)); + .setNotBefore(OffsetDateTime.now().plusDays(1)) + .setExpires(OffsetDateTime.now().plusYears(1)); Key optionsKey = keyClient.createKey(keyCreateOptions); System.out.printf("Key is created with name %s and id %s \n", optionsKey.name(), optionsKey.id()); // END: com.azure.keyvault.keys.keyclient.createKey#keyOptions // BEGIN: com.azure.keyvault.keys.keyclient.createRsaKey#keyOptions RsaKeyCreateOptions rsaKeyCreateOptions = new RsaKeyCreateOptions("keyName") - .keySize(2048) - .notBefore(OffsetDateTime.now().plusDays(1)) - .expires(OffsetDateTime.now().plusYears(1)); + .setKeySize(2048) + .setNotBefore(OffsetDateTime.now().plusDays(1)) + .setExpires(OffsetDateTime.now().plusYears(1)); Key rsaKey = keyClient.createRsaKey(rsaKeyCreateOptions); System.out.printf("Key is created with name %s and id %s \n", rsaKey.name(), rsaKey.id()); // END: com.azure.keyvault.keys.keyclient.createRsaKey#keyOptions // BEGIN: com.azure.keyvault.keys.keyclient.createEcKey#keyOptions EcKeyCreateOptions ecKeyCreateOptions = new EcKeyCreateOptions("keyName") - .curve(KeyCurveName.P_384) - .notBefore(OffsetDateTime.now().plusDays(1)) - .expires(OffsetDateTime.now().plusYears(1)); + .setCurve(KeyCurveName.P_384) + .setNotBefore(OffsetDateTime.now().plusDays(1)) + .setExpires(OffsetDateTime.now().plusYears(1)); Key ecKey = keyClient.createEcKey(ecKeyCreateOptions); System.out.printf("Key is created with name %s and id %s \n", ecKey.name(), ecKey.id()); // END: com.azure.keyvault.keys.keyclient.createEcKey#keyOptions @@ -91,7 +91,7 @@ public void deleteKeySnippets() { // BEGIN: com.azure.keyvault.keys.keyclient.deleteKey#string Key key = keyClient.getKey("keyName"); DeletedKey deletedKey = keyClient.deleteKey("keyName"); - System.out.printf("Deleted Key's Recovery Id %s", deletedKey.recoveryId()); + System.out.printf("Deleted Key's Recovery Id %s", deletedKey.getRecoveryId()); // END: com.azure.keyvault.keys.keyclient.deleteKey#string } @@ -102,7 +102,7 @@ public void getDeletedKeySnippets() { KeyClient keyClient = createClient(); // BEGIN: com.azure.keyvault.keys.keyclient.getDeletedKey#string DeletedKey deletedKey = keyClient.getDeletedKey("keyName"); - System.out.printf("Deleted Key's Recovery Id %s", deletedKey.recoveryId()); + System.out.printf("Deleted Key's Recovery Id %s", deletedKey.getRecoveryId()); // END: com.azure.keyvault.keys.keyclient.getDeletedKey#string } @@ -113,27 +113,27 @@ public void createKeyWithResponses() { KeyClient keyClient = createClient(); // BEGIN: com.azure.keyvault.keys.keyclient.createKeyWithResponse#keyCreateOptions-Context KeyCreateOptions keyCreateOptions = new KeyCreateOptions("keyName", KeyType.RSA) - .notBefore(OffsetDateTime.now().plusDays(1)) - .expires(OffsetDateTime.now().plusYears(1)); - Key optionsKey = keyClient.createKeyWithResponse(keyCreateOptions, new Context(key1, value1)).value(); + .setNotBefore(OffsetDateTime.now().plusDays(1)) + .setExpires(OffsetDateTime.now().plusYears(1)); + Key optionsKey = keyClient.createKeyWithResponse(keyCreateOptions, new Context(key1, value1)).getValue(); System.out.printf("Key is created with name %s and id %s \n", optionsKey.name(), optionsKey.id()); // END: com.azure.keyvault.keys.keyclient.createKeyWithResponse#keyCreateOptions-Context // BEGIN: com.azure.keyvault.keys.keyclient.createRsaKeyWithResponse#keyOptions-Context RsaKeyCreateOptions rsaKeyCreateOptions = new RsaKeyCreateOptions("keyName") - .keySize(2048) - .notBefore(OffsetDateTime.now().plusDays(1)) - .expires(OffsetDateTime.now().plusYears(1)); - Key rsaKey = keyClient.createRsaKeyWithResponse(rsaKeyCreateOptions, new Context(key1, value1)).value(); + .setKeySize(2048) + .setNotBefore(OffsetDateTime.now().plusDays(1)) + .setExpires(OffsetDateTime.now().plusYears(1)); + Key rsaKey = keyClient.createRsaKeyWithResponse(rsaKeyCreateOptions, new Context(key1, value1)).getValue(); System.out.printf("Key is created with name %s and id %s \n", rsaKey.name(), rsaKey.id()); // END: com.azure.keyvault.keys.keyclient.createRsaKeyWithResponse#keyOptions-Context // BEGIN: com.azure.keyvault.keys.keyclient.createEcKeyWithResponse#keyOptions-Context EcKeyCreateOptions ecKeyCreateOptions = new EcKeyCreateOptions("keyName") - .curve(KeyCurveName.P_384) - .notBefore(OffsetDateTime.now().plusDays(1)) - .expires(OffsetDateTime.now().plusYears(1)); - Key ecKey = keyClient.createEcKeyWithResponse(ecKeyCreateOptions, new Context(key1, value1)).value(); + .setCurve(KeyCurveName.P_384) + .setNotBefore(OffsetDateTime.now().plusDays(1)) + .setExpires(OffsetDateTime.now().plusYears(1)); + Key ecKey = keyClient.createEcKeyWithResponse(ecKeyCreateOptions, new Context(key1, value1)).getValue(); System.out.printf("Key is created with name %s and id %s \n", ecKey.name(), ecKey.id()); // END: com.azure.keyvault.keys.keyclient.createEcKeyWithResponse#keyOptions-Context } @@ -146,15 +146,15 @@ public void getKeyWithResponseSnippets() { // BEGIN: com.azure.keyvault.keys.keyclient.getKeyWithResponse#string-string-Context String keyVersion = "6A385B124DEF4096AF1361A85B16C204"; Key keyWithVersion = keyClient.getKeyWithResponse("keyName", keyVersion, - new Context(key1, value1)).value(); + new Context(key1, value1)).getValue(); System.out.printf("Key is returned with name %s and id %s \n", keyWithVersion.name(), keyWithVersion.id()); // END: com.azure.keyvault.keys.keyclient.getKeyWithResponse#string-string-Context // BEGIN: com.azure.keyvault.keys.keyclient.getKeyWithResponse#KeyBase-Context for (KeyBase key : keyClient.listKeys()) { - Key keyResponse = keyClient.getKeyWithResponse(key, new Context(key1, value1)).value(); + Key keyResponse = keyClient.getKeyWithResponse(key, new Context(key1, value1)).getValue(); System.out.printf("Received key with name %s and type %s", keyResponse.name(), - keyResponse.keyMaterial().kty()); + keyResponse.getKeyMaterial().getKty()); } // END: com.azure.keyvault.keys.keyclient.getKeyWithResponse#KeyBase-Context } @@ -179,7 +179,7 @@ public void getKeySnippets() { for (KeyBase key : keyClient.listKeys()) { Key keyResponse = keyClient.getKey(key); System.out.printf("Received key with name %s and type %s", keyResponse.name(), - keyResponse.keyMaterial().kty()); + keyResponse.getKeyMaterial().getKty()); } // END: com.azure.keyvault.keys.keyclient.getKey#KeyBase } @@ -192,9 +192,9 @@ public void updateKeyWithResponseSnippets() { // BEGIN: com.azure.keyvault.keys.keyclient.updateKeyWithResponse#KeyBase-keyOperations-Context Key key = keyClient.getKey("keyName"); - key.expires(OffsetDateTime.now().plusDays(60)); + key.setExpires(OffsetDateTime.now().plusDays(60)); KeyBase updatedKeyBase = keyClient.updateKeyWithResponse(key, - new Context(key1, value1), KeyOperation.ENCRYPT, KeyOperation.DECRYPT).value(); + new Context(key1, value1), KeyOperation.ENCRYPT, KeyOperation.DECRYPT).getValue(); Key updatedKey = keyClient.getKey(updatedKeyBase.name()); System.out.printf("Key is updated with name %s and id %s \n", updatedKey.name(), updatedKey.id()); // END: com.azure.keyvault.keys.keyclient.updateKeyWithResponse#KeyBase-keyOperations-Context @@ -208,7 +208,7 @@ public void updateKeySnippets() { // BEGIN: com.azure.keyvault.keys.keyclient.updateKey#KeyBase-keyOperations Key key = keyClient.getKey("keyName"); - key.expires(OffsetDateTime.now().plusDays(60)); + key.setExpires(OffsetDateTime.now().plusDays(60)); KeyBase updatedKeyBase = keyClient.updateKey(key, KeyOperation.ENCRYPT, KeyOperation.DECRYPT); Key updatedKey = keyClient.getKey(updatedKeyBase.name()); System.out.printf("Key is updated with name %s and id %s \n", updatedKey.name(), updatedKey.id()); @@ -216,7 +216,7 @@ public void updateKeySnippets() { // BEGIN: com.azure.keyvault.keys.keyclient.updateKey#KeyBase Key updateKey = keyClient.getKey("keyName"); - key.expires(OffsetDateTime.now().plusDays(60)); + key.setExpires(OffsetDateTime.now().plusDays(60)); KeyBase updatedKeyBaseValue = keyClient.updateKey(updateKey); Key updatedKeyValue = keyClient.getKey(updatedKeyBaseValue.name()); System.out.printf("Key is updated with name %s and id %s \n", updatedKeyValue.name(), updatedKeyValue.id()); @@ -230,8 +230,8 @@ public void deleteKeyWithResponseSnippets() { KeyClient keyClient = createClient(); // BEGIN: com.azure.keyvault.keys.keyclient.deleteKeyWithResponse#string-Context Key key = keyClient.getKey("keyName"); - DeletedKey deletedKey = keyClient.deleteKeyWithResponse("keyName", new Context(key1, value1)).value(); - System.out.printf("Deleted Key's Recovery Id %s", deletedKey.recoveryId()); + DeletedKey deletedKey = keyClient.deleteKeyWithResponse("keyName", new Context(key1, value1)).getValue(); + System.out.printf("Deleted Key's Recovery Id %s", deletedKey.getRecoveryId()); // END: com.azure.keyvault.keys.keyclient.deleteKeyWithResponse#string-Context } @@ -241,8 +241,8 @@ public void deleteKeyWithResponseSnippets() { public void getDeleteKeyWithResponseSnippets() { KeyClient keyClient = createClient(); // BEGIN: com.azure.keyvault.keys.keyclient.getDeletedKeyWithResponse#string-Context - DeletedKey deletedKey = keyClient.getDeletedKeyWithResponse("keyName", new Context(key1, value1)).value(); - System.out.printf("Deleted Key with recovery Id %s \n", deletedKey.recoveryId()); + DeletedKey deletedKey = keyClient.getDeletedKeyWithResponse("keyName", new Context(key1, value1)).getValue(); + System.out.printf("Deleted Key with recovery Id %s \n", deletedKey.getRecoveryId()); // END: com.azure.keyvault.keys.keyclient.getDeletedKeyWithResponse#string-Context } @@ -253,12 +253,12 @@ public void purgeDeletedKeySnippets() { KeyClient keyClient = createClient(); // BEGIN: com.azure.keyvault.keys.keyclient.purgeDeletedKey#string VoidResponse purgeResponse = keyClient.purgeDeletedKey("deletedKeyName"); - System.out.printf("Purge Status Code: %rsaPrivateExponent", purgeResponse.statusCode()); + System.out.printf("Purge Status Code: %rsaPrivateExponent", purgeResponse.getStatusCode()); // END: com.azure.keyvault.keys.keyclient.purgeDeletedKey#string // BEGIN: com.azure.keyvault.keys.keyclient.purgeDeletedKey#string-Context VoidResponse purgedResponse = keyClient.purgeDeletedKey("deletedKeyName", new Context(key2, value2)); - System.out.printf("Purge Status Code: %rsaPrivateExponent", purgedResponse.statusCode()); + System.out.printf("Purge Status Code: %rsaPrivateExponent", purgedResponse.getStatusCode()); // END: com.azure.keyvault.keys.keyclient.purgeDeletedKey#string-Context } @@ -269,7 +269,7 @@ public void recoverDeletedKeyWithResponseSnippets() { KeyClient keyClient = createClient(); // BEGIN: com.azure.keyvault.keys.keyclient.recoverDeletedKeyWithResponse#string-Context Key recoveredKey = keyClient.recoverDeletedKeyWithResponse("deletedKeyName", - new Context(key2, value2)).value(); + new Context(key2, value2)).getValue(); System.out.printf("Recovered key with name %s", recoveredKey.name()); // END: com.azure.keyvault.keys.keyclient.recoverDeletedKeyWithResponse#string-Context } @@ -302,7 +302,7 @@ public void backupKeySnippets() { public void backupKeyWithResponseSnippets() { KeyClient keyClient = createClient(); // BEGIN: com.azure.keyvault.keys.keyclient.backupKeyWithResponse#string-Context - byte[] keyBackup = keyClient.backupKeyWithResponse("keyName", new Context(key2, value2)).value(); + byte[] keyBackup = keyClient.backupKeyWithResponse("keyName", new Context(key2, value2)).getValue(); System.out.printf("Key's Backup Byte array's length %s", keyBackup.length); // END: com.azure.keyvault.keys.keyclient.backupKeyWithResponse#string-Context } @@ -328,7 +328,7 @@ public void restoreKeyWithResponseSnippets() { byte[] keyBackupByteArray = {}; Response keyResponse = keyClient.restoreKeyWithResponse(keyBackupByteArray, new Context(key1, value1)); System.out.printf("Restored Key with name %s and id %s \n", - keyResponse.value().name(), keyResponse.value().id()); + keyResponse.getValue().name(), keyResponse.getValue().id()); // END: com.azure.keyvault.keys.keyclient.restoreKeyWithResponse#byte-Context } @@ -341,7 +341,7 @@ public void listKeySnippets() { for (KeyBase key : keyClient.listKeys()) { Key keyWithMaterial = keyClient.getKey(key); System.out.printf("Received key with name %s and type %s", keyWithMaterial.name(), - keyWithMaterial.keyMaterial().kty()); + keyWithMaterial.getKeyMaterial().getKty()); } // END: com.azure.keyvault.keys.keyclient.listKeys @@ -349,18 +349,18 @@ public void listKeySnippets() { for (KeyBase key : keyClient.listKeys(new Context(key2, value2))) { Key keyWithMaterial = keyClient.getKey(key); System.out.printf("Received key with name %s and type %s", keyWithMaterial.name(), - keyWithMaterial.keyMaterial().kty()); + keyWithMaterial.getKeyMaterial().getKty()); } // END: com.azure.keyvault.keys.keyclient.listKeys#Context // BEGIN: com.azure.keyvault.keys.keyclient.listKeys.iterableByPage keyClient.listKeys().iterableByPage().forEach(resp -> { System.out.printf("Got response headers . Url: %s, Status code: %d %n", - resp.request().url(), resp.statusCode()); - resp.items().forEach(value -> { + resp.getRequest().getUrl(), resp.getStatusCode()); + resp.getItems().forEach(value -> { Key keyWithMaterial = keyClient.getKey(value); System.out.printf("Received key with name %s and type %s %n", keyWithMaterial.name(), - keyWithMaterial.keyMaterial().kty()); + keyWithMaterial.getKeyMaterial().getKty()); }); }); // END: com.azure.keyvault.keys.keyclient.listKeys.iterableByPage @@ -373,22 +373,22 @@ public void listDeletedKeysSnippets() { KeyClient keyClient = createClient(); // BEGIN: com.azure.keyvault.keys.keyclient.listDeletedKeys for (DeletedKey deletedKey : keyClient.listDeletedKeys()) { - System.out.printf("Deleted key's recovery Id %s", deletedKey.recoveryId()); + System.out.printf("Deleted key's recovery Id %s", deletedKey.getRecoveryId()); } // END: com.azure.keyvault.keys.keyclient.listDeletedKeys // BEGIN: com.azure.keyvault.keys.keyclient.listDeletedKeys#Context for (DeletedKey deletedKey : keyClient.listDeletedKeys(new Context(key2, value2))) { - System.out.printf("Deleted key's recovery Id %s", deletedKey.recoveryId()); + System.out.printf("Deleted key's recovery Id %s", deletedKey.getRecoveryId()); } // END: com.azure.keyvault.keys.keyclient.listDeletedKeys#Context // BEGIN: com.azure.keyvault.keys.keyclient.listDeletedKeys.iterableByPage keyClient.listDeletedKeys().iterableByPage().forEach(resp -> { System.out.printf("Got response headers . Url: %s, Status code: %d %n", - resp.request().url(), resp.statusCode()); - resp.items().forEach(value -> { - System.out.printf("Deleted key's recovery Id %s %n", value.recoveryId()); + resp.getRequest().getUrl(), resp.getStatusCode()); + resp.getItems().forEach(value -> { + System.out.printf("Deleted key's recovery Id %s %n", value.getRecoveryId()); }); }); // END: com.azure.keyvault.keys.keyclient.listDeletedKeys.iterableByPage @@ -403,7 +403,7 @@ public void listKeyVersions() { for (KeyBase key : keyClient.listKeyVersions("keyName")) { Key keyWithMaterial = keyClient.getKey(key); System.out.printf("Received key's version with name %s, type %s and version %s", keyWithMaterial.name(), - keyWithMaterial.keyMaterial().kty(), keyWithMaterial.version()); + keyWithMaterial.getKeyMaterial().getKty(), keyWithMaterial.version()); } // END: com.azure.keyvault.keys.keyclient.listKeyVersions @@ -411,15 +411,15 @@ public void listKeyVersions() { for (KeyBase key : keyClient.listKeyVersions("keyName", new Context(key2, value2))) { Key keyWithMaterial = keyClient.getKey(key); System.out.printf("Received key's version with name %s, type %s and version %s", keyWithMaterial.name(), - keyWithMaterial.keyMaterial().kty(), keyWithMaterial.version()); + keyWithMaterial.getKeyMaterial().getKty(), keyWithMaterial.version()); } // END: com.azure.keyvault.keys.keyclient.listKeyVersions#Context // BEGIN: com.azure.keyvault.keys.keyclient.listKeyVersions.iterableByPage keyClient.listKeyVersions("keyName").iterableByPage().forEach(resp -> { System.out.printf("Got response headers . Url: %s, Status code: %d %n", - resp.request().url(), resp.statusCode()); - resp.items().forEach(value -> { + resp.getRequest().getUrl(), resp.getStatusCode()); + resp.getItems().forEach(value -> { System.out.printf("Key name: %s, Key version: %s %n", value.name(), value.version()); }); }); diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperations.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperations.java index 292675dda9f8..490a681d889c 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperations.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperations.java @@ -34,29 +34,29 @@ public static void main(String[] args) throws IllegalArgumentException { // Let's create Ec and Rsa keys valid for 1 year. if the key // already exists in the key vault, then a new version of the key is created. keyClient.createRsaKey(new RsaKeyCreateOptions("CloudRsaKey") - .expires(OffsetDateTime.now().plusYears(1)) - .keySize(2048)); + .setExpires(OffsetDateTime.now().plusYears(1)) + .setKeySize(2048)); keyClient.createEcKey(new EcKeyCreateOptions("CloudEcKey") - .expires(OffsetDateTime.now().plusYears(1))); + .setExpires(OffsetDateTime.now().plusYears(1))); // You need to check te type of keys already exist in your key vault. Let's list the keys and print their types. // List operations don't return the keys with key material information. So, for each returned key we call getKey to get the key with its key material information. for (KeyBase key : keyClient.listKeys()) { Key keyWithMaterial = keyClient.getKey(key); - System.out.printf("Received key with name %s and type %s", keyWithMaterial.name(), keyWithMaterial.keyMaterial().kty()); + System.out.printf("Received key with name %s and type %s", keyWithMaterial.name(), keyWithMaterial.getKeyMaterial().getKty()); } // We need the Cloud Rsa key with bigger key size, so you want to update the key in key vault to ensure it has the required size. // Calling createRsaKey on an existing key creates a new version of the key in the key vault with the new specified size. keyClient.createRsaKey(new RsaKeyCreateOptions("CloudRsaKey") - .expires(OffsetDateTime.now().plusYears(1)) - .keySize(4096)); + .setExpires(OffsetDateTime.now().plusYears(1)) + .setKeySize(4096)); // You need to check all the different versions Cloud Rsa key had previously. Lets print all the versions of this key. for (KeyBase key : keyClient.listKeyVersions("CloudRsaKey")) { Key keyWithMaterial = keyClient.getKey(key); - System.out.printf("Received key's version with name %s, type %s and version %s", keyWithMaterial.name(), keyWithMaterial.keyMaterial().kty(), keyWithMaterial.version()); + System.out.printf("Received key's version with name %s, type %s and version %s", keyWithMaterial.name(), keyWithMaterial.getKeyMaterial().getKty(), keyWithMaterial.version()); } } } diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperationsAsync.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperationsAsync.java index 5af46e8cbdd0..87a789a50f9e 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperationsAsync.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperationsAsync.java @@ -33,16 +33,16 @@ public static void main(String[] args) throws InterruptedException { // Let's create Ec and Rsa keys valid for 1 year. if the key // already exists in the key vault, then a new version of the key is created. keyAsyncClient.createEcKey(new EcKeyCreateOptions("CloudEcKey") - .expires(OffsetDateTime.now().plusYears(1))) + .setExpires(OffsetDateTime.now().plusYears(1))) .subscribe(keyResponse -> - System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty())); + System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.getKeyMaterial().getKty())); Thread.sleep(2000); keyAsyncClient.createRsaKey(new RsaKeyCreateOptions("CloudRsaKey") - .expires(OffsetDateTime.now().plusYears(1))) + .setExpires(OffsetDateTime.now().plusYears(1))) .subscribe(keyResponse -> - System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty())); + System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.getKeyMaterial().getKty())); Thread.sleep(2000); @@ -51,16 +51,16 @@ public static void main(String[] args) throws InterruptedException { keyAsyncClient.listKeys() .subscribe(keyBase -> keyAsyncClient.getKey(keyBase).subscribe(keyResponse -> - System.out.printf("Received key with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty()))); + System.out.printf("Received key with name %s and type %s \n", keyResponse.name(), keyResponse.getKeyMaterial().getKty()))); Thread.sleep(15000); // We need the Cloud Rsa key with bigger key size, so you want to update the key in key vault to ensure it has the required size. // Calling createRsaKey on an existing key creates a new version of the key in the key vault with the new specified size. keyAsyncClient.createRsaKey(new RsaKeyCreateOptions("CloudRsaKey") - .keySize(4096) - .expires(OffsetDateTime.now().plusYears(1))).subscribe(keyResponse -> - System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty())); + .setKeySize(4096) + .setExpires(OffsetDateTime.now().plusYears(1))).subscribe(keyResponse -> + System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.getKeyMaterial().getKty())); Thread.sleep(2000); @@ -68,7 +68,7 @@ public static void main(String[] args) throws InterruptedException { keyAsyncClient.listKeyVersions("CloudRsaKey").subscribe(keyBase -> keyAsyncClient.getKey(keyBase).subscribe(keyResponse -> System.out.printf("Received key's version with name %s, type %s and version %s \n", keyResponse.name(), - keyResponse.keyMaterial().kty(), keyResponse.version()))); + keyResponse.getKeyMaterial().getKty(), keyResponse.version()))); Thread.sleep(15000); } diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeys.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeys.java index 74909d00260d..069f532a5128 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeys.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeys.java @@ -38,11 +38,11 @@ public static void main(String[] args) throws IllegalArgumentException, Interrup // Let's create Ec and Rsa keys valid for 1 year. if the key // already exists in the key vault, then a new version of the key is created. keyClient.createRsaKey(new RsaKeyCreateOptions("CloudRsaKey") - .expires(OffsetDateTime.now().plusYears(1)) - .keySize(2048)); + .setExpires(OffsetDateTime.now().plusYears(1)) + .setKeySize(2048)); keyClient.createEcKey(new EcKeyCreateOptions("CloudEcKey") - .expires(OffsetDateTime.now().plusYears(1))); + .setExpires(OffsetDateTime.now().plusYears(1))); // The Cloud Rsa Key is no longer needed, need to delete it from the key vault. keyClient.deleteKey("CloudEcKey"); @@ -66,7 +66,7 @@ public static void main(String[] args) throws IllegalArgumentException, Interrup // You can list all the deleted and non-purged keys, assuming key vault is soft-delete enabled. for (DeletedKey deletedKey : keyClient.listDeletedKeys()) { - System.out.printf("Deleted key's recovery Id %s", deletedKey.recoveryId()); + System.out.printf("Deleted key's recovery Id %s", deletedKey.getRecoveryId()); } // If the keyvault is soft-delete enabled, then for permanent deletion deleted keys need to be purged. diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeysAsync.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeysAsync.java index 96cd120eeebc..77ef541e7a86 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeysAsync.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeysAsync.java @@ -37,22 +37,22 @@ public static void main(String[] args) throws InterruptedException { // Let's create Ec and Rsa keys valid for 1 year. if the key // already exists in the key vault, then a new version of the key is created. keyAsyncClient.createEcKey(new EcKeyCreateOptions("CloudEcKey") - .expires(OffsetDateTime.now().plusYears(1))) + .setExpires(OffsetDateTime.now().plusYears(1))) .subscribe(keyResponse -> - System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty())); + System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.getKeyMaterial().getKty())); Thread.sleep(2000); keyAsyncClient.createRsaKey(new RsaKeyCreateOptions("CloudRsaKey") - .expires(OffsetDateTime.now().plusYears(1))) + .setExpires(OffsetDateTime.now().plusYears(1))) .subscribe(keyResponse -> - System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty())); + System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.getKeyMaterial().getKty())); Thread.sleep(2000); // The Cloud Rsa Key is no longer needed, need to delete it from the key vault. keyAsyncClient.deleteKey("CloudEcKey").subscribe(deletedKeyResponse -> - System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.recoveryId())); + System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.getRecoveryId())); //To ensure key is deleted on server side. Thread.sleep(30000); @@ -67,26 +67,26 @@ public static void main(String[] args) throws InterruptedException { // The Cloud Ec and Rsa keys are no longer needed, need to delete them from the key vault. keyAsyncClient.deleteKey("CloudEcKey").subscribe(deletedKeyResponse -> - System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.recoveryId())); + System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.getRecoveryId())); keyAsyncClient.deleteKey("CloudRsaKey").subscribe(deletedKeyResponse -> - System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.recoveryId())); + System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.getRecoveryId())); // To ensure key is deleted on server side. Thread.sleep(30000); // You can list all the deleted and non-purged keys, assuming key vault is soft-delete enabled. keyAsyncClient.listDeletedKeys().subscribe(deletedKey -> - System.out.printf("Deleted key's recovery Id %s \n", deletedKey.recoveryId())); + System.out.printf("Deleted key's recovery Id %s \n", deletedKey.getRecoveryId())); Thread.sleep(15000); // If the keyvault is soft-delete enabled, then for permanent deletion deleted keys need to be purged. keyAsyncClient.purgeDeletedKey("CloudRsaKey").subscribe(purgeResponse -> - System.out.printf("Storage account key purge status response %d \n", purgeResponse.statusCode())); + System.out.printf("Storage account key purge status response %d \n", purgeResponse.getStatusCode())); keyAsyncClient.purgeDeletedKey("CloudEcKey").subscribe(purgeResponse -> - System.out.printf("Bank account key purge status response %d \n", purgeResponse.statusCode())); + System.out.printf("Bank account key purge status response %d \n", purgeResponse.getStatusCode())); // To ensure key is purged on server side. Thread.sleep(15000); diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClientJavaDocCodeSnippets.java index 1d7141b1b621..4f25deb91c13 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClientJavaDocCodeSnippets.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClientJavaDocCodeSnippets.java @@ -89,7 +89,7 @@ public void getKeyWithResponseSnippets() { cryptographyAsyncClient.getKeyWithResponse() .subscriberContext(reactor.util.context.Context.of(key1, value1, key2, value2)) .subscribe(keyResponse -> System.out.printf("Key is returned with name %s and id %s \n", - keyResponse.value().name(), keyResponse.value().id())); + keyResponse.getValue().name(), keyResponse.getValue().id())); // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.getKeyWithResponse } @@ -118,24 +118,24 @@ public void encrypt() { (byte) 0x69, (byte) 0x70, (byte) 0x6c, (byte) 0x65, (byte) 0x20, (byte) 0x6f, (byte) 0x66, (byte) 0x20, (byte) 0x41, (byte) 0x75, (byte) 0x67, (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x65, (byte) 0x20, (byte) 0x4b, (byte) 0x65, (byte) 0x72, (byte) 0x63, (byte) 0x6b, (byte) 0x68, (byte) 0x6f, (byte) 0x66, (byte) 0x66, (byte) 0x73 }; - // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.encrypt#asymmetric-encrypt + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.encrypt#EncryptionAlgorithm-byte byte[] plainText = new byte[100]; new Random(0x1234567L).nextBytes(plainText); cryptographyAsyncClient.encrypt(EncryptionAlgorithm.RSA_OAEP, plainText) .subscriberContext(reactor.util.context.Context.of(key1, value1, key2, value2)) .subscribe(encryptResult -> System.out.printf("Received encrypted content of length %d with algorithm %s \n", - encryptResult.cipherText().length, encryptResult.algorithm().toString())); - // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.encrypt#asymmetric-encrypt + encryptResult.getCipherText().length, encryptResult.getAlgorithm().toString())); + // END: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.encrypt#EncryptionAlgorithm-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.encrypt#symmetric-encrypt + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.encrypt#EncryptionAlgorithm-byte-byte-byte cryptographyAsyncClient.encrypt(EncryptionAlgorithm.A192CBC_HS384, plainText, iv, authData) .subscriberContext(reactor.util.context.Context.of(key1, value1, key2, value2)) .subscribe(encryptResult -> System.out.printf("Received encrypted content of length %d with algorithm %s \n", - encryptResult.cipherText().length, encryptResult.algorithm().toString())); + encryptResult.getCipherText().length, encryptResult.getAlgorithm().toString())); - // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.encrypt#symmetric-encrypt + // END: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.encrypt#EncryptionAlgorithm-byte-byte-byte } /** @@ -151,23 +151,23 @@ public void decrypt() { (byte) 0x4b, (byte) 0x65, (byte) 0x72, (byte) 0x63, (byte) 0x6b, (byte) 0x68, (byte) 0x6f, (byte) 0x66, (byte) 0x66, (byte) 0x73 }; byte[] authTag = {(byte) 0x65, (byte) 0x2c, (byte) 0x3f, (byte) 0xa3, (byte) 0x6b, (byte) 0x0a, (byte) 0x7c, (byte) 0x5b, (byte) 0x32, (byte) 0x19, (byte) 0xfa, (byte) 0xb3, (byte) 0xa3, (byte) 0x0b, (byte) 0xc1, (byte) 0xc4}; - // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.decrypt#asymmetric-decrypt + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.decrypt#EncryptionAlgorithm-byte byte[] plainText = new byte[100]; new Random(0x1234567L).nextBytes(plainText); cryptographyAsyncClient.decrypt(EncryptionAlgorithm.RSA_OAEP, plainText) .subscriberContext(reactor.util.context.Context.of(key1, value1, key2, value2)) .subscribe(decryptResult -> - System.out.printf("Received decrypted content of length %d\n", decryptResult.plainText().length)); - // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.decrypt#asymmetric-decrypt + System.out.printf("Received decrypted content of length %d\n", decryptResult.getPlainText().length)); + // END: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.decrypt#EncryptionAlgorithm-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.decrypt#symmetric-decrypt + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.decrypt#EncryptionAlgorithm-byte-byte-byte-byte cryptographyAsyncClient.decrypt(EncryptionAlgorithm.A192CBC_HS384, plainText, iv, authData, authTag) .subscriberContext(reactor.util.context.Context.of(key1, value1, key2, value2)) .subscribe(encryptResult -> System.out.printf("Received decrypted content of length %d with algorithm %s \n", - encryptResult.plainText().length)); + encryptResult.getPlainText().length)); - // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.decrypt#symmetric-decrypt + // END: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.decrypt#EncryptionAlgorithm-byte-byte-byte-byte } /** @@ -179,7 +179,7 @@ public void decrypt() { public void signVerify() throws NoSuchAlgorithmException { CryptographyAsyncClient cryptographyAsyncClient = createAsyncClient(); byte[] signature = new byte[100]; - // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.sign + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.sign#SignatureAlgorithm-byte byte[] data = new byte[100]; new Random(0x1234567L).nextBytes(data); MessageDigest md = MessageDigest.getInstance("SHA-256"); @@ -188,15 +188,15 @@ public void signVerify() throws NoSuchAlgorithmException { cryptographyAsyncClient.sign(SignatureAlgorithm.ES256, digest) .subscriberContext(reactor.util.context.Context.of(key1, value1, key2, value2)) .subscribe(signResult -> - System.out.printf("Received signature of length %d with algorithm %s", signResult.signature().length)); - // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.sign + System.out.printf("Received signature of length %d with algorithm %s", signResult.getSignature().length)); + // END: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.sign#SignatureAlgorithm-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.verify + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.verify#SignatureAlgorithm-byte-byte cryptographyAsyncClient.verify(SignatureAlgorithm.ES256, digest, signature) .subscriberContext(reactor.util.context.Context.of(key1, value1, key2, value2)) .subscribe(verifyResult -> System.out.printf("Verification status %s", verifyResult.isValid())); - // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.verify + // END: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.verify#SignatureAlgorithm-byte-byte } @@ -209,46 +209,46 @@ public void signVerify() throws NoSuchAlgorithmException { public void signDataVerifyData() throws NoSuchAlgorithmException { CryptographyAsyncClient cryptographyAsyncClient = createAsyncClient(); byte[] signature = new byte[100]; - // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.sign-data + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.signData#SignatureAlgorithm-byte byte[] data = new byte[100]; new Random(0x1234567L).nextBytes(data); cryptographyAsyncClient.sign(SignatureAlgorithm.ES256, data) .subscriberContext(reactor.util.context.Context.of(key1, value1, key2, value2)) .subscribe(signResult -> - System.out.printf("Received signature of length %d with algorithm %s", signResult.signature().length)); - // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.sign-data + System.out.printf("Received signature of length %d with algorithm %s", signResult.getSignature().length)); + // END: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.signData#SignatureAlgorithm-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.verify-data + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.verifyData#SignatureAlgorithm-byte-byte cryptographyAsyncClient.verify(SignatureAlgorithm.ES256, data, signature) .subscriberContext(reactor.util.context.Context.of(key1, value1, key2, value2)) .subscribe(verifyResult -> System.out.printf("Verification status %s", verifyResult.isValid())); - // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.verify-data + // END: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.verifyData#SignatureAlgorithm-byte-byte } /** * Generates a code sample for using {@link CryptographyAsyncClient#wrapKey(KeyWrapAlgorithm, byte[])} and - * {@link CryptographyAsyncClient#unwrapKey(KeyWrapAlgorithm, byte[]) + * {@link CryptographyAsyncClient#unwrapKey(KeyWrapAlgorithm, byte[])} */ public void wrapKeyUnwrapKey() { CryptographyAsyncClient cryptographyAsyncClient = createAsyncClient(); byte[] encryptedKey = new byte[100]; - // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.wrap-key + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.wrapKey#KeyWrapAlgorithm-byte byte[] key = new byte[100]; new Random(0x1234567L).nextBytes(key); cryptographyAsyncClient.wrapKey(KeyWrapAlgorithm.RSA_OAEP, key) .subscriberContext(reactor.util.context.Context.of(key1, value1, key2, value2)) .subscribe(keyWrapResult -> System.out.printf("Received encypted key of length %d with algorithm %s", - keyWrapResult.encryptedKey().length, keyWrapResult.algorithm().toString())); - // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.wrap-key + keyWrapResult.getEncryptedKey().length, keyWrapResult.getAlgorithm().toString())); + // END: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.wrapKey#KeyWrapAlgorithm-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.unwrap-key + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.unwrapKey#KeyWrapAlgorithm-byte cryptographyAsyncClient.unwrapKey(KeyWrapAlgorithm.RSA_OAEP, encryptedKey) .subscriberContext(reactor.util.context.Context.of(key1, value1, key2, value2)) .subscribe(keyUnwrapResult -> - System.out.printf("Received key of length %d", keyUnwrapResult.key().length)); - // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.unwrap-key + System.out.printf("Received key of length %d", keyUnwrapResult.getKey().length)); + // END: com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient.unwrapKey#KeyWrapAlgorithm-byte } /** diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientJavaDocCodeSnippets.java index 086eee5c36f3..ca2327dea581 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientJavaDocCodeSnippets.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientJavaDocCodeSnippets.java @@ -52,7 +52,7 @@ public CryptographyClient createClient() { public void getKeyWithResponseSnippets() { CryptographyClient cryptographyClient = createClient(); // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.getKeyWithResponse#Context - Key keyWithVersion = cryptographyClient.getKeyWithResponse(new Context(key1, value1)).value(); + Key keyWithVersion = cryptographyClient.getKeyWithResponse(new Context(key1, value1)).getValue(); System.out.printf("Key is returned with name %s and id %s \n", keyWithVersion.name(), keyWithVersion.id()); // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.getKeyWithResponse#Context } @@ -80,29 +80,29 @@ public void encrypt() { (byte) 0x69, (byte) 0x70, (byte) 0x6c, (byte) 0x65, (byte) 0x20, (byte) 0x6f, (byte) 0x66, (byte) 0x20, (byte) 0x41, (byte) 0x75, (byte) 0x67, (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x65, (byte) 0x20, (byte) 0x4b, (byte) 0x65, (byte) 0x72, (byte) 0x63, (byte) 0x6b, (byte) 0x68, (byte) 0x6f, (byte) 0x66, (byte) 0x66, (byte) 0x73 }; - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.encrypt#asymmetric-encrypt + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.encrypt#EncryptionAlgorithm-byte byte[] plainText = new byte[100]; new Random(0x1234567L).nextBytes(plainText); EncryptResult encryptResult = cryptographyClient.encrypt(EncryptionAlgorithm.RSA_OAEP, plainText); System.out.printf("Received encrypted content of length %d with algorithm %s \n", - encryptResult.cipherText().length, encryptResult.algorithm().toString()); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.encrypt#asymmetric-encrypt + encryptResult.getCipherText().length, encryptResult.getAlgorithm().toString()); + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.encrypt#EncryptionAlgorithm-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.encrypt#symmetric-encrypt + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.encrypt#EncryptionAlgorithm-byte-byte-byte EncryptResult encryptionResult = cryptographyClient.encrypt(EncryptionAlgorithm.A192CBC_HS384, plainText, iv, authData); System.out.printf("Received encrypted content of length %d with algorithm %s \n", - encryptionResult.cipherText().length, encryptResult.algorithm().toString()); + encryptionResult.getCipherText().length, encryptResult.getAlgorithm().toString()); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.encrypt#symmetric-encrypt + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.encrypt#EncryptionAlgorithm-byte-byte-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.encrypt#symmetric-encrypt-Context + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.encrypt#EncryptionAlgorithm-byte-byte-byte-Context EncryptResult encryptionResponse = cryptographyClient.encrypt(EncryptionAlgorithm.A192CBC_HS384, plainText, iv, authData, new Context(key1, value1)); System.out.printf("Received encrypted content of length %d with algorithm %s \n", - encryptionResponse.cipherText().length, encryptResult.algorithm().toString()); + encryptionResponse.getCipherText().length, encryptResult.getAlgorithm().toString()); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.encrypt#symmetric-encrypt-Context + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.encrypt#EncryptionAlgorithm-byte-byte-byte-Context } /** @@ -118,26 +118,26 @@ public void decrypt() { (byte) 0x4b, (byte) 0x65, (byte) 0x72, (byte) 0x63, (byte) 0x6b, (byte) 0x68, (byte) 0x6f, (byte) 0x66, (byte) 0x66, (byte) 0x73 }; byte[] authTag = {(byte) 0x65, (byte) 0x2c, (byte) 0x3f, (byte) 0xa3, (byte) 0x6b, (byte) 0x0a, (byte) 0x7c, (byte) 0x5b, (byte) 0x32, (byte) 0x19, (byte) 0xfa, (byte) 0xb3, (byte) 0xa3, (byte) 0x0b, (byte) 0xc1, (byte) 0xc4}; - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.decrypt#asymmetric-decrypt + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.decrypt#EncryptionAlgorithm-byte byte[] plainText = new byte[100]; new Random(0x1234567L).nextBytes(plainText); DecryptResult decryptResult = cryptographyClient.decrypt(EncryptionAlgorithm.RSA_OAEP, plainText); - System.out.printf("Received decrypted content of length %d\n", decryptResult.plainText().length); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.decrypt#asymmetric-decrypt + System.out.printf("Received decrypted content of length %d\n", decryptResult.getPlainText().length); + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.decrypt#EncryptionAlgorithm-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.decrypt#symmetric-decrypt + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.decrypt#EncryptionAlgorithm-byte-byte-byte-byte DecryptResult decryptionResult = cryptographyClient.decrypt(EncryptionAlgorithm.A192CBC_HS384, plainText, iv, authData, authTag); System.out.printf("Received decrypted content of length %d with algorithm %s \n", - decryptionResult.plainText().length); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.decrypt#symmetric-decrypt + decryptionResult.getPlainText().length); + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.decrypt#EncryptionAlgorithm-byte-byte-byte-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.decrypt#symmetric-decrypt-Context + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.decrypt#EncryptionAlgorithm-byte-byte-byte-byte-Context DecryptResult decryptionResponse = cryptographyClient.decrypt(EncryptionAlgorithm.A192CBC_HS384, plainText, iv, authData, authTag, new Context(key2, value2)); System.out.printf("Received decrypted content of length %d with algorithm %s \n", - decryptionResponse.plainText().length); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.decrypt#symmetric-decrypt-Context + decryptionResponse.getPlainText().length); + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.decrypt#EncryptionAlgorithm-byte-byte-byte-byte-Context } /** @@ -149,37 +149,37 @@ public void decrypt() { public void signVerify() throws NoSuchAlgorithmException { CryptographyClient cryptographyClient = createClient(); byte[] signature = new byte[100]; - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.sign#SignatureAlgorithm-byte byte[] data = new byte[100]; new Random(0x1234567L).nextBytes(data); MessageDigest md = MessageDigest.getInstance("SHA-256"); md.update(data); byte[] digest = md.digest(); SignResult signResult = cryptographyClient.sign(SignatureAlgorithm.ES256, digest); - System.out.printf("Received signature of length %d with algorithm %s", signResult.signature().length, - signResult.algorithm().toString()); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign + System.out.printf("Received signature of length %d with algorithm %s", signResult.getSignature().length, + signResult.getAlgorithm().toString()); + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.sign#SignatureAlgorithm-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign-Context + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.sign#SignatureAlgorithm-byte-Context byte[] plainTextData = new byte[100]; new Random(0x1234567L).nextBytes(plainTextData); MessageDigest messageDigest = MessageDigest.getInstance("SHA-256"); messageDigest.update(data); byte[] digetContent = messageDigest.digest(); SignResult signResponse = cryptographyClient.sign(SignatureAlgorithm.ES256, digetContent); - System.out.printf("Received signature of length %d with algorithm %s", signResponse.signature().length, - signResponse.algorithm().toString(), new Context(key1, value1)); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign-Context + System.out.printf("Received signature of length %d with algorithm %s", signResponse.getSignature().length, + signResponse.getAlgorithm().toString(), new Context(key1, value1)); + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.sign#SignatureAlgorithm-byte-Context - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.verify#SignatureAlgorithm-byte-byte VerifyResult verifyResult = cryptographyClient.verify(SignatureAlgorithm.ES256, digest, signature); System.out.printf("Verification status %s", verifyResult.isValid()); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.verify#SignatureAlgorithm-byte-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify-Context + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.verify#SignatureAlgorithm-byte-byte-Context VerifyResult verifyResponse = cryptographyClient.verify(SignatureAlgorithm.ES256, digest, signature); System.out.printf("Verification status %s", verifyResponse.isValid(), new Context(key2, value2)); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify-Context + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.verify#SignatureAlgorithm-byte-byte-Context } @@ -192,65 +192,65 @@ public void signVerify() throws NoSuchAlgorithmException { public void signDataVerifyData() throws NoSuchAlgorithmException { CryptographyClient cryptographyClient = createClient(); byte[] signature = new byte[100]; - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign-data + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.signData#SignatureAlgorithm-byte byte[] data = new byte[100]; new Random(0x1234567L).nextBytes(data); SignResult signResult = cryptographyClient.sign(SignatureAlgorithm.ES256, data); - System.out.printf("Received signature of length %d with algorithm %s", signResult.signature().length); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign-data + System.out.printf("Received signature of length %d with algorithm %s", signResult.getSignature().length); + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.signData#SignatureAlgorithm-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign-data-Context + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.signData#SignatureAlgorithm-byte-Context byte[] plainTextData = new byte[100]; new Random(0x1234567L).nextBytes(plainTextData); SignResult signReponse = cryptographyClient.sign(SignatureAlgorithm.ES256, plainTextData); - System.out.printf("Received signature of length %d with algorithm %s", signReponse.signature().length, + System.out.printf("Received signature of length %d with algorithm %s", signReponse.getSignature().length, new Context(key1, value1)); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign-data-Context + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.signData#SignatureAlgorithm-byte-Context - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify-data + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.verifyData#SignatureAlgorithm-byte-byte VerifyResult verifyResult = cryptographyClient.verify(SignatureAlgorithm.ES256, data, signature); System.out.printf("Verification status %s", verifyResult.isValid()); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify-data + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.verifyData#SignatureAlgorithm-byte-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify-data-Context + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.verifyData#SignatureAlgorithm-byte-byte-Context VerifyResult verifyResponse = cryptographyClient.verify(SignatureAlgorithm.ES256, data, signature); System.out.printf("Verification status %s", verifyResponse.isValid(), new Context(key2, value2)); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify-data-Context + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.verifyData#SignatureAlgorithm-byte-byte-Context } /** * Generates a code sample for using {@link CryptographyClient#wrapKey(KeyWrapAlgorithm, byte[])} and - * {@link CryptographyClient#unwrapKey(KeyWrapAlgorithm, byte[]) + * {@link CryptographyClient#unwrapKey(KeyWrapAlgorithm, byte[])} */ public void wrapKeyUnwrapKey() { CryptographyClient cryptographyClient = createClient(); byte[] encryptedKey = new byte[100]; - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.wrap-key + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.wrapKey#KeyWrapAlgorithm-byte byte[] key = new byte[100]; new Random(0x1234567L).nextBytes(key); KeyWrapResult keyWrapResult = cryptographyClient.wrapKey(KeyWrapAlgorithm.RSA_OAEP, key); - System.out.printf("Received encypted key of length %d with algorithm %s", keyWrapResult.encryptedKey().length, - keyWrapResult.algorithm().toString()); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.wrap-key + System.out.printf("Received encypted key of length %d with algorithm %s", keyWrapResult.getEncryptedKey().length, + keyWrapResult.getAlgorithm().toString()); + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.wrapKey#KeyWrapAlgorithm-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.wrap-key-Context + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.wrapKey#KeyWrapAlgorithm-byte-Context byte[] keyContent = new byte[100]; new Random(0x1234567L).nextBytes(keyContent); KeyWrapResult keyWrapResponse = cryptographyClient.wrapKey(KeyWrapAlgorithm.RSA_OAEP, keyContent); - System.out.printf("Received encypted key of length %d with algorithm %s", keyWrapResponse.encryptedKey().length, - keyWrapResponse.algorithm().toString(), new Context(key1, value1)); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.wrap-key-Context + System.out.printf("Received encypted key of length %d with algorithm %s", keyWrapResponse.getEncryptedKey().length, + keyWrapResponse.getAlgorithm().toString(), new Context(key1, value1)); + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.wrapKey#KeyWrapAlgorithm-byte-Context - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.unwrap-key + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.unwrapKey#KeyWrapAlgorithm-byte KeyUnwrapResult keyUnwrapResult = cryptographyClient.unwrapKey(KeyWrapAlgorithm.RSA_OAEP, encryptedKey); - System.out.printf("Received key of length %d", keyUnwrapResult.key().length); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.unwrap-key + System.out.printf("Received key of length %d", keyUnwrapResult.getKey().length); + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.unwrapKey#KeyWrapAlgorithm-byte - // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.unwrap-key-Context + // BEGIN: com.azure.security.keyvault.keys.cryptography.CryptographyClient.unwrapKey#KeyWrapAlgorithm-byte-Context KeyUnwrapResult keyUnwrapResponse = cryptographyClient.unwrapKey(KeyWrapAlgorithm.RSA_OAEP, encryptedKey, new Context(key2, value2)); - System.out.printf("Received key of length %d", keyUnwrapResponse.key().length); - // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.unwrap-key-Context + System.out.printf("Received key of length %d", keyUnwrapResponse.getKey().length); + // END: com.azure.security.keyvault.keys.cryptography.CryptographyClient.unwrapKey#KeyWrapAlgorithm-byte-Context } /** diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/EncryptDecryptOperations.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/EncryptDecryptOperations.java index b8a1b98d9fb3..02c376a4fc4c 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/EncryptDecryptOperations.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/EncryptDecryptOperations.java @@ -42,11 +42,11 @@ public static void main(String[] args) throws InterruptedException, IllegalArgum // Let's encrypt a simple plain text of size 100 bytes. EncryptResult encryptResult = cryptoClient.encrypt(EncryptionAlgorithm.RSA_OAEP, plainText); - System.out.printf("Returned cipherText size is %d bytes with algorithm %s \n", encryptResult.cipherText().length, encryptResult.algorithm().toString()); + System.out.printf("Returned cipherText size is %d bytes with algorithm %s \n", encryptResult.getCipherText().length, encryptResult.getAlgorithm().toString()); //Let's decrypt the encrypted response. - DecryptResult decryptResult = cryptoClient.decrypt(EncryptionAlgorithm.RSA_OAEP, encryptResult.cipherText()); - System.out.printf("Returned plainText size is %d bytes \n", decryptResult.plainText().length); + DecryptResult decryptResult = cryptoClient.decrypt(EncryptionAlgorithm.RSA_OAEP, encryptResult.getCipherText()); + System.out.printf("Returned plainText size is %d bytes \n", decryptResult.getPlainText().length); // Let's do Encrypt and Decrypt operations with a symmetric key. byte[] keyContent = { 0x06, (byte) 0xa9, 0x21, 0x40, 0x36, (byte) 0xb8, (byte) 0xa1, 0x5b, 0x51, 0x2e, 0x03, (byte) 0xd5, 0x34, 0x12, 0x00, 0x06 }; @@ -55,8 +55,8 @@ public static void main(String[] args) throws InterruptedException, IllegalArgum // Convert the symmetric key encoded content to Json Web key. JsonWebKey symmetricKey = JsonWebKey.fromAes(new SecretKeySpec(keyContent, "AES")) - .kty(KeyType.OCT) - .keyOps(Arrays.asList(KeyOperation.ENCRYPT, KeyOperation.DECRYPT)); + .setKty(KeyType.OCT) + .setKeyOps(Arrays.asList(KeyOperation.ENCRYPT, KeyOperation.DECRYPT)); // Configure the symmetric key in a new crypto client. CryptographyClient symmetricKeyCryptoClient = new CryptographyClientBuilder() @@ -66,10 +66,10 @@ public static void main(String[] args) throws InterruptedException, IllegalArgum // Note the implementation of A128CBC in this library uses PKCS7 padding. EncryptResult encryptionResult = symmetricKeyCryptoClient.encrypt(EncryptionAlgorithm.A128CBC, plaintext, initializationVector, null); - System.out.printf("Returned cipherText size is %d bytes with algorithm %s\n", encryptionResult.cipherText().length, encryptionResult.algorithm().toString()); + System.out.printf("Returned cipherText size is %d bytes with algorithm %s\n", encryptionResult.getCipherText().length, encryptionResult.getAlgorithm().toString()); - DecryptResult decryptionResult = symmetricKeyCryptoClient.decrypt(EncryptionAlgorithm.A128CBC, encryptionResult.cipherText(), initializationVector, null, null); - System.out.printf("Returned unwrapped key size is %d bytes\n", decryptionResult.plainText().length); + DecryptResult decryptionResult = symmetricKeyCryptoClient.decrypt(EncryptionAlgorithm.A128CBC, encryptionResult.getCipherText(), initializationVector, null, null); + System.out.printf("Returned unwrapped key size is %d bytes\n", decryptionResult.getPlainText().length); } } diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/EncryptDecryptOperationsAsync.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/EncryptDecryptOperationsAsync.java index dee2acfea526..767931f68456 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/EncryptDecryptOperationsAsync.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/EncryptDecryptOperationsAsync.java @@ -41,10 +41,10 @@ public static void main(String[] args) throws InterruptedException, IllegalArgum // Let's encrypt a simple plain text of size 100 bytes. cryptoAsyncClient.encrypt(EncryptionAlgorithm.RSA_OAEP, plainText) .subscribe(encryptResult -> { - System.out.printf("Returned cipherText size is %d bytes with algorithm %s\n", encryptResult.cipherText().length, encryptResult.algorithm().toString()); + System.out.printf("Returned cipherText size is %d bytes with algorithm %s\n", encryptResult.getCipherText().length, encryptResult.getAlgorithm().toString()); //Let's decrypt the encrypted response. - cryptoAsyncClient.decrypt(EncryptionAlgorithm.RSA_OAEP, encryptResult.cipherText()) - .subscribe(decryptResult -> System.out.printf("Returned plainText size is %d bytes\n", decryptResult.plainText().length)); + cryptoAsyncClient.decrypt(EncryptionAlgorithm.RSA_OAEP, encryptResult.getCipherText()) + .subscribe(decryptResult -> System.out.printf("Returned plainText size is %d bytes\n", decryptResult.getPlainText().length)); }); Thread.sleep(5000); @@ -56,8 +56,8 @@ public static void main(String[] args) throws InterruptedException, IllegalArgum // Convert the symmetric key encoded content to Json Web key. JsonWebKey symmetricKey = JsonWebKey.fromAes(new SecretKeySpec(keyContent, "AES")) - .kty(KeyType.OCT) - .keyOps(Arrays.asList(KeyOperation.ENCRYPT, KeyOperation.DECRYPT)); + .setKty(KeyType.OCT) + .setKeyOps(Arrays.asList(KeyOperation.ENCRYPT, KeyOperation.DECRYPT)); // Configure the symmetric key in a new crypto client. CryptographyAsyncClient symmetricKeyCryptoAsyncClient = new CryptographyClientBuilder() @@ -68,10 +68,10 @@ public static void main(String[] args) throws InterruptedException, IllegalArgum // Note the implementation of A128CBC in this library uses PKCS7 padding. symmetricKeyCryptoAsyncClient.encrypt(EncryptionAlgorithm.A128CBC, plaintext, initializationVector, null) .subscribe(encryptResult -> { - System.out.printf("Returned cipherText size is %d bytes with algorithm %s\n", encryptResult.cipherText().length, encryptResult.algorithm().toString()); + System.out.printf("Returned cipherText size is %d bytes with algorithm %s\n", encryptResult.getCipherText().length, encryptResult.getAlgorithm().toString()); //Let's decrypt the encrypted response. - symmetricKeyCryptoAsyncClient.decrypt(EncryptionAlgorithm.A128CBC, encryptResult.cipherText(), initializationVector, null, null) - .subscribe(decryptResult -> System.out.printf("Returned plainText size is %d bytes\n", decryptResult.plainText().length)); + symmetricKeyCryptoAsyncClient.decrypt(EncryptionAlgorithm.A128CBC, encryptResult.getCipherText(), initializationVector, null, null) + .subscribe(decryptResult -> System.out.printf("Returned plainText size is %d bytes\n", decryptResult.getPlainText().length)); }); //Block main thread to let async operations finish diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/KeyWrapUnwrapOperations.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/KeyWrapUnwrapOperations.java index 7658c7b65a9f..3c9740ac1d34 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/KeyWrapUnwrapOperations.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/KeyWrapUnwrapOperations.java @@ -43,11 +43,11 @@ public static void main(String[] args) throws InterruptedException, IllegalArgum // Let's wrap a simple dummy key content. KeyWrapResult keyWrapResult = cryptoClient.wrapKey(KeyWrapAlgorithm.RSA_OAEP, plainText); - System.out.printf("Returned encrypted key size is %d bytes with algorithm %s\n", keyWrapResult.encryptedKey().length, keyWrapResult.algorithm().toString()); + System.out.printf("Returned encrypted key size is %d bytes with algorithm %s\n", keyWrapResult.getEncryptedKey().length, keyWrapResult.getAlgorithm().toString()); //Let's unwrap the encrypted key response. - KeyUnwrapResult keyUnwrapResult = cryptoClient.unwrapKey(KeyWrapAlgorithm.RSA_OAEP, keyWrapResult.encryptedKey()); - System.out.printf("Returned unwrapped key size is %d bytes\n", keyUnwrapResult.key().length); + KeyUnwrapResult keyUnwrapResult = cryptoClient.unwrapKey(KeyWrapAlgorithm.RSA_OAEP, keyWrapResult.getEncryptedKey()); + System.out.printf("Returned unwrapped key size is %d bytes\n", keyUnwrapResult.getKey().length); // Let's do Key Wrap and Unwrap operations with a symmetric key. byte[] symmetrickeyContent = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }; @@ -55,8 +55,8 @@ public static void main(String[] args) throws InterruptedException, IllegalArgum // Convert the symmetric key encoded content to Json Web key. JsonWebKey symmetricKey = JsonWebKey.fromAes(new SecretKeySpec(symmetrickeyContent, "AES")) - .kty(KeyType.OCT) - .keyOps(Arrays.asList(KeyOperation.WRAP_KEY, KeyOperation.UNWRAP_KEY)); + .setKty(KeyType.OCT) + .setKeyOps(Arrays.asList(KeyOperation.WRAP_KEY, KeyOperation.UNWRAP_KEY)); // Configure the symmetric key in a new crypto client. CryptographyClient symmetricKeyCryptoClient = new CryptographyClientBuilder() @@ -65,10 +65,10 @@ public static void main(String[] args) throws InterruptedException, IllegalArgum .buildClient(); KeyWrapResult symKeyWrapResult = symmetricKeyCryptoClient.wrapKey(KeyWrapAlgorithm.A128KW, keyContentToWrap); - System.out.printf("Returned encrypted key size is %d bytes with algorithm %s\n", keyWrapResult.encryptedKey().length, keyWrapResult.algorithm().toString()); + System.out.printf("Returned encrypted key size is %d bytes with algorithm %s\n", keyWrapResult.getEncryptedKey().length, keyWrapResult.getAlgorithm().toString()); - KeyUnwrapResult symKeyUnwrapResult = symmetricKeyCryptoClient.unwrapKey(KeyWrapAlgorithm.A128KW, symKeyWrapResult.encryptedKey()); - System.out.printf("Returned unwrapped key size is %d bytes\n", symKeyUnwrapResult.key().length); + KeyUnwrapResult symKeyUnwrapResult = symmetricKeyCryptoClient.unwrapKey(KeyWrapAlgorithm.A128KW, symKeyWrapResult.getEncryptedKey()); + System.out.printf("Returned unwrapped key size is %d bytes\n", symKeyUnwrapResult.getKey().length); } } diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/KeyWrapUnwrapOperationsAsync.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/KeyWrapUnwrapOperationsAsync.java index cb1c29d412bd..277d2b5c3ca1 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/KeyWrapUnwrapOperationsAsync.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/KeyWrapUnwrapOperationsAsync.java @@ -41,10 +41,10 @@ public static void main(String[] args) throws InterruptedException, IllegalArgum // Let's wrap a simple dummy key content. cryptoAsyncClient.wrapKey(KeyWrapAlgorithm.RSA_OAEP, plainText) .subscribe(keyWrapResult -> { - System.out.printf("Returned encrypted key size is %d bytes with algorithm %s\n", keyWrapResult.encryptedKey().length, keyWrapResult.algorithm().toString()); + System.out.printf("Returned encrypted key size is %d bytes with algorithm %s\n", keyWrapResult.getEncryptedKey().length, keyWrapResult.getAlgorithm().toString()); //Let's decrypt the encrypted response. - cryptoAsyncClient.unwrapKey(KeyWrapAlgorithm.RSA_OAEP, keyWrapResult.encryptedKey()) - .subscribe(keyUnwrapResult -> System.out.printf("Returned unwrapped key size is %d bytes\n", keyUnwrapResult.key().length)); + cryptoAsyncClient.unwrapKey(KeyWrapAlgorithm.RSA_OAEP, keyWrapResult.getEncryptedKey()) + .subscribe(keyUnwrapResult -> System.out.printf("Returned unwrapped key size is %d bytes\n", keyUnwrapResult.getKey().length)); }); Thread.sleep(5000); @@ -55,8 +55,8 @@ public static void main(String[] args) throws InterruptedException, IllegalArgum // Convert the symmetric key encoded content to Json Web key. JsonWebKey symmetricKey = JsonWebKey.fromAes(new SecretKeySpec(symmetrickeyContent, "AES")) - .kty(KeyType.OCT) - .keyOps(Arrays.asList(KeyOperation.WRAP_KEY, KeyOperation.UNWRAP_KEY)); + .setKty(KeyType.OCT) + .setKeyOps(Arrays.asList(KeyOperation.WRAP_KEY, KeyOperation.UNWRAP_KEY)); // Configure the symmetric key in a new crypto client. CryptographyAsyncClient symmetricKeyCryptoAsyncClient = new CryptographyClientBuilder() @@ -67,10 +67,10 @@ public static void main(String[] args) throws InterruptedException, IllegalArgum // Note the implementation of A128CBC in this library uses PKCS7 padding. symmetricKeyCryptoAsyncClient.wrapKey(KeyWrapAlgorithm.A128KW, keyContentToWrap) .subscribe(symKeyWrapResult -> { - System.out.printf("Returned encrypted key size is %d bytes with algorithm %s\n", symKeyWrapResult.encryptedKey().length, symKeyWrapResult.algorithm().toString()); + System.out.printf("Returned encrypted key size is %d bytes with algorithm %s\n", symKeyWrapResult.getEncryptedKey().length, symKeyWrapResult.getAlgorithm().toString()); //Let's decrypt the encrypted response. - symmetricKeyCryptoAsyncClient.unwrapKey(KeyWrapAlgorithm.A128KW, symKeyWrapResult.encryptedKey()) - .subscribe(symKeyUnwrapResult -> System.out.printf("Returned unwrapped key size is %d bytes\n", symKeyUnwrapResult.key().length)); + symmetricKeyCryptoAsyncClient.unwrapKey(KeyWrapAlgorithm.A128KW, symKeyWrapResult.getEncryptedKey()) + .subscribe(symKeyUnwrapResult -> System.out.printf("Returned unwrapped key size is %d bytes\n", symKeyUnwrapResult.getKey().length)); }); //Block main thread to let async operations finish diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/SignVerifyOperations.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/SignVerifyOperations.java index 51a8b1e3b286..6e59f8504e91 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/SignVerifyOperations.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/SignVerifyOperations.java @@ -43,19 +43,19 @@ public static void main(String[] args) throws InterruptedException, IllegalArgum // Let's create a signature from a simple digest. SignResult signResult = cryptoClient.sign(SignatureAlgorithm.RS256, digest); - System.out.printf("Returned signature size is %d bytes with algorithm %s\n", signResult.signature().length, signResult.algorithm().toString()); + System.out.printf("Returned signature size is %d bytes with algorithm %s\n", signResult.getSignature().length, signResult.getAlgorithm().toString()); // Let's verify the signature against the digest. - VerifyResult verifyResult = cryptoClient.verify(SignatureAlgorithm.RS256, digest, signResult.signature()); + VerifyResult verifyResult = cryptoClient.verify(SignatureAlgorithm.RS256, digest, signResult.getSignature()); System.out.printf("Signature verified : %s \n", verifyResult.isValid()); // We can sign the raw plain text data without having to create a digest SignResult signingDataResult = cryptoClient.signData(SignatureAlgorithm.RS256, plainText); - System.out.printf("Returned signature size is %d bytes with algorithm %s\n", signingDataResult.signature().length, signingDataResult.algorithm().toString()); + System.out.printf("Returned signature size is %d bytes with algorithm %s\n", signingDataResult.getSignature().length, signingDataResult.getAlgorithm().toString()); // Let's verify the signature against the raw plain text data. - VerifyResult verifyDataResult = cryptoClient.verifyData(SignatureAlgorithm.RS256, plainText, signResult.signature()); + VerifyResult verifyDataResult = cryptoClient.verifyData(SignatureAlgorithm.RS256, plainText, signResult.getSignature()); System.out.printf("Signature verified : %s \n", verifyDataResult.isValid()); } diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/SignVerifyOperationsAsync.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/SignVerifyOperationsAsync.java index ef5f1bd87f66..222a6e5dcb1a 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/SignVerifyOperationsAsync.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/SignVerifyOperationsAsync.java @@ -42,9 +42,9 @@ public static void main(String[] args) throws InterruptedException, IllegalArgum // Let's create a signature from a simple digest. cryptoAsyncClient.sign(SignatureAlgorithm.RS256, digest) .subscribe(signResult -> { - System.out.printf("Returned signature size is %d bytes with algorithm %s\n", signResult.signature().length, signResult.algorithm().toString()); + System.out.printf("Returned signature size is %d bytes with algorithm %s\n", signResult.getSignature().length, signResult.getAlgorithm().toString()); // Let's verify the signature against the digest. - cryptoAsyncClient.verify(SignatureAlgorithm.RS256, digest, signResult.signature()) + cryptoAsyncClient.verify(SignatureAlgorithm.RS256, digest, signResult.getSignature()) .subscribe(verifyResult -> System.out.printf("Signature verified : %s\n", verifyResult.isValid())); }); @@ -53,9 +53,9 @@ public static void main(String[] args) throws InterruptedException, IllegalArgum // We can sign the raw plain text data without having to create a digest cryptoAsyncClient.sign(SignatureAlgorithm.RS256, digest) .subscribe(signResult -> { - System.out.printf("Returned signature size is %d bytes with algorithm %s\n", signResult.signature().length, signResult.algorithm().toString()); + System.out.printf("Returned signature size is %d bytes with algorithm %s\n", signResult.getSignature().length, signResult.getAlgorithm().toString()); // Let's verify the signature against the raw plain text data. - cryptoAsyncClient.verify(SignatureAlgorithm.RS256, digest, signResult.signature()) + cryptoAsyncClient.verify(SignatureAlgorithm.RS256, digest, signResult.getSignature()) .subscribe(verifyDataResult -> System.out.printf("Signature verified : %s\n", verifyDataResult.isValid())); }); diff --git a/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyAsyncClientTest.java b/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyAsyncClientTest.java index 639fb86f26f5..0135c539cd52 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyAsyncClientTest.java +++ b/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyAsyncClientTest.java @@ -10,10 +10,10 @@ import com.azure.security.keyvault.keys.models.KeyBase; import com.azure.security.keyvault.keys.models.KeyCreateOptions; import com.azure.security.keyvault.keys.models.webkey.KeyType; -import io.netty.handler.codec.http.HttpResponseStatus; import org.junit.Assert; import reactor.test.StepVerifier; +import java.net.HttpURLConnection; import java.util.ArrayList; import java.util.List; @@ -56,17 +56,19 @@ public void setKey() { */ public void setKeyEmptyName() { StepVerifier.create(client.createKey("", KeyType.RSA)) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, - HttpResponseStatus.BAD_REQUEST.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpURLConnection.HTTP_BAD_REQUEST)); } /** * Tests that we can create keys when value is not null or an empty string. */ public void setKeyNullType() { - setKeyEmptyValueRunner((key) -> StepVerifier.create(client.createKey(key)) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, - HttpResponseStatus.BAD_REQUEST.code()))); + setKeyEmptyValueRunner((key) -> { + + StepVerifier.create(client.createKey(key)) + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpURLConnection.HTTP_BAD_REQUEST)); + + }); } /** @@ -86,7 +88,7 @@ public void updateKey() { .verifyComplete(); Key keyToUpdate = client.getKey(original.name()).block(); - StepVerifier.create(client.updateKey(keyToUpdate.expires(updated.expires()))) + StepVerifier.create(client.updateKey(keyToUpdate.setExpires(updated.expires()))) .assertNext(response -> { assertNotNull(response); assertEquals(original.name(), response.name()); @@ -108,7 +110,7 @@ public void updateDisabledKey() { .verifyComplete(); Key keyToUpdate = client.getKey(original.name()).block(); - StepVerifier.create(client.updateKey(keyToUpdate.expires(updated.expires()))) + StepVerifier.create(client.updateKey(keyToUpdate.setExpires(updated.expires()))) .assertNext(response -> { assertNotNull(response); assertEquals(original.name(), response.name()); @@ -156,7 +158,7 @@ public void getKeySpecificVersion() { */ public void getKeyNotFound() { StepVerifier.create(client.getKey("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); } @@ -170,23 +172,24 @@ public void deleteKey() { StepVerifier.create(client.deleteKey(keyToDelete.name())) .assertNext(deletedKeyResponse -> { - assertNotNull(deletedKeyResponse.deletedDate()); - assertNotNull(deletedKeyResponse.recoveryId()); - assertNotNull(deletedKeyResponse.scheduledPurgeDate()); + assertNotNull(deletedKeyResponse.getDeletedDate()); + assertNotNull(deletedKeyResponse.getRecoveryId()); + assertNotNull(deletedKeyResponse.getScheduledPurgeDate()); assertEquals(keyToDelete.name(), deletedKeyResponse.name()); }).verifyComplete(); sleepInRecordMode(30000); StepVerifier.create(client.purgeDeletedKey(keyToDelete.name())) - .assertNext(voidResponse -> assertEquals(HttpResponseStatus.NO_CONTENT.code(), - voidResponse.statusCode())).verifyComplete(); + .assertNext(voidResponse -> { + assertEquals(HttpURLConnection.HTTP_NO_CONTENT, voidResponse.getStatusCode()); + }).verifyComplete(); sleepInRecordMode(15000); }); } public void deleteKeyNotFound() { StepVerifier.create(client.deleteKey("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); } /** @@ -194,7 +197,7 @@ public void deleteKeyNotFound() { */ public void getDeletedKeyNotFound() { StepVerifier.create(client.getDeletedKey("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); } /** @@ -223,7 +226,7 @@ public void recoverDeletedKey() { */ public void recoverDeletedKeyNotFound() { StepVerifier.create(client.recoverDeletedKey("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); } /** @@ -247,7 +250,7 @@ public void backupKey() { */ public void backupKeyNotFound() { StepVerifier.create(client.backupKey("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); } /** @@ -264,8 +267,9 @@ public void restoreKey() { pollOnKeyDeletion(keyToBackupAndRestore.name()); StepVerifier.create(client.purgeDeletedKey(keyToBackupAndRestore.name())) - .assertNext(voidResponse -> assertEquals(HttpResponseStatus.NO_CONTENT.code(), - voidResponse.statusCode())).verifyComplete(); + .assertNext(voidResponse -> { + assertEquals(HttpURLConnection.HTTP_NO_CONTENT, voidResponse.getStatusCode()); + }).verifyComplete(); pollOnKeyPurge(keyToBackupAndRestore.name()); sleepInRecordMode(60000); @@ -285,7 +289,7 @@ public void restoreKey() { public void restoreKeyFromMalformedBackup() { byte[] keyBackupBytes = "non-existing".getBytes(); StepVerifier.create(client.restoreKey(keyBackupBytes)) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpResponseStatus.BAD_REQUEST.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpURLConnection.HTTP_BAD_REQUEST)); } /** @@ -304,15 +308,16 @@ public void getDeletedKey() { StepVerifier.create(client.getDeletedKey(keyToDeleteAndGet.name())) .assertNext(deletedKeyResponse -> { - assertNotNull(deletedKeyResponse.deletedDate()); - assertNotNull(deletedKeyResponse.recoveryId()); - assertNotNull(deletedKeyResponse.scheduledPurgeDate()); + assertNotNull(deletedKeyResponse.getDeletedDate()); + assertNotNull(deletedKeyResponse.getRecoveryId()); + assertNotNull(deletedKeyResponse.getScheduledPurgeDate()); assertEquals(keyToDeleteAndGet.name(), deletedKeyResponse.name()); }).verifyComplete(); StepVerifier.create(client.purgeDeletedKey(keyToDeleteAndGet.name())) - .assertNext(voidResponse -> assertEquals(HttpResponseStatus.NO_CONTENT.code(), - voidResponse.statusCode())).verifyComplete(); + .assertNext(voidResponse -> { + assertEquals(HttpURLConnection.HTTP_NO_CONTENT, voidResponse.getStatusCode()); + }).verifyComplete(); pollOnKeyPurge(keyToDeleteAndGet.name()); sleepInRecordMode(15000); }); @@ -344,8 +349,8 @@ public void listDeletedKeys() { for (DeletedKey actualKey : deletedKeys) { if (keys.containsKey(actualKey.name())) { - assertNotNull(actualKey.deletedDate()); - assertNotNull(actualKey.recoveryId()); + assertNotNull(actualKey.getDeletedDate()); + assertNotNull(actualKey.getRecoveryId()); keys.remove(actualKey.name()); } } @@ -354,8 +359,9 @@ public void listDeletedKeys() { for (DeletedKey deletedKey : deletedKeys) { StepVerifier.create(client.purgeDeletedKey(deletedKey.name())) - .assertNext(voidResponse -> assertEquals(HttpResponseStatus.NO_CONTENT.code(), - voidResponse.statusCode())).verifyComplete(); + .assertNext(voidResponse -> { + assertEquals(HttpURLConnection.HTTP_NO_CONTENT, voidResponse.getStatusCode()); + }).verifyComplete(); pollOnKeyPurge(deletedKey.name()); } }); @@ -386,8 +392,9 @@ public void listKeyVersions() { StepVerifier.create(client.purgeDeletedKey(keyName)) - .assertNext(voidResponse -> assertEquals(HttpResponseStatus.NO_CONTENT.code(), - voidResponse.statusCode())).verifyComplete(); + .assertNext(voidResponse -> { + assertEquals(HttpURLConnection.HTTP_NO_CONTENT, voidResponse.getStatusCode()); + }).verifyComplete(); pollOnKeyPurge(keyName); }); @@ -424,7 +431,7 @@ private void pollOnKeyDeletion(String keyName) { while (pendingPollCount < 30) { DeletedKey deletedKey = null; try { - deletedKey = client.getDeletedKeyWithResponse(keyName).block().value(); + deletedKey = client.getDeletedKeyWithResponse(keyName).block().getValue(); } catch (ResourceNotFoundException e) { } if (deletedKey == null) { @@ -442,7 +449,7 @@ private void pollOnKeyPurge(String keyName) { while (pendingPollCount < 10) { DeletedKey deletedKey = null; try { - deletedKey = client.getDeletedKeyWithResponse(keyName).block().value(); + deletedKey = client.getDeletedKeyWithResponse(keyName).block().getValue(); } catch (ResourceNotFoundException e) { } if (deletedKey != null) { diff --git a/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTest.java b/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTest.java index fb52b12a36ea..df25222ecf18 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTest.java +++ b/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTest.java @@ -10,8 +10,8 @@ import com.azure.security.keyvault.keys.models.KeyBase; import com.azure.security.keyvault.keys.models.KeyCreateOptions; import com.azure.security.keyvault.keys.models.webkey.KeyType; -import io.netty.handler.codec.http.HttpResponseStatus; +import java.net.HttpURLConnection; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -52,7 +52,7 @@ public void setKey() { * Tests that an attempt to create a key with empty string name throws an error. */ public void setKeyEmptyName() { - assertRestException(() -> client.createKey("", KeyType.RSA), ResourceModifiedException.class, HttpResponseStatus.BAD_REQUEST.code()); + assertRestException(() -> client.createKey("", KeyType.RSA), ResourceModifiedException.class, HttpURLConnection.HTTP_BAD_REQUEST); } /** @@ -60,7 +60,7 @@ public void setKeyEmptyName() { */ public void setKeyNullType() { setKeyEmptyValueRunner((key) -> { - assertRestException(() -> client.createKey(key.name(), key.keyType()), ResourceModifiedException.class, HttpResponseStatus.BAD_REQUEST.code()); + assertRestException(() -> client.createKey(key.name(), key.keyType()), ResourceModifiedException.class, HttpURLConnection.HTTP_BAD_REQUEST); }); } @@ -78,7 +78,7 @@ public void updateKey() { updateKeyRunner((original, updated) -> { assertKeyEquals(original, client.createKey(original)); Key keyToUpdate = client.getKey(original.name()); - client.updateKey(keyToUpdate.expires(updated.expires())); + client.updateKey(keyToUpdate.setExpires(updated.expires())); assertKeyEquals(updated, client.getKey(original.name())); }); } @@ -90,7 +90,7 @@ public void updateDisabledKey() { updateDisabledKeyRunner((original, updated) -> { assertKeyEquals(original, client.createKey(original)); Key keyToUpdate = client.getKey(original.name()); - client.updateKey(keyToUpdate.expires(updated.expires())); + client.updateKey(keyToUpdate.setExpires(updated.expires())); assertKeyEquals(updated, client.getKey(original.name())); }); } @@ -121,7 +121,7 @@ public void getKeySpecificVersion() { * Tests that an attempt to get a non-existing key throws an error. */ public void getKeyNotFound() { - assertRestException(() -> client.getKey("non-existing"), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.getKey("non-existing"), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); } /** @@ -132,9 +132,9 @@ public void deleteKey() { assertKeyEquals(keyToDelete, client.createKey(keyToDelete)); DeletedKey deletedKey = client.deleteKey(keyToDelete.name()); pollOnKeyDeletion(keyToDelete.name()); - assertNotNull(deletedKey.deletedDate()); - assertNotNull(deletedKey.recoveryId()); - assertNotNull(deletedKey.scheduledPurgeDate()); + assertNotNull(deletedKey.getDeletedDate()); + assertNotNull(deletedKey.getRecoveryId()); + assertNotNull(deletedKey.getScheduledPurgeDate()); assertEquals(keyToDelete.name(), deletedKey.name()); client.purgeDeletedKey(keyToDelete.name()); pollOnKeyPurge(keyToDelete.name()); @@ -142,7 +142,7 @@ public void deleteKey() { } public void deleteKeyNotFound() { - assertRestException(() -> client.deleteKey("non-existing"), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.deleteKey("non-existing"), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); } @@ -150,7 +150,7 @@ public void deleteKeyNotFound() { * Tests that an attempt to retrieve a non existing deleted key throws an error on a soft-delete enabled vault. */ public void getDeletedKeyNotFound() { - assertRestException(() -> client.getDeletedKey("non-existing"), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.getDeletedKey("non-existing"), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); } @@ -173,7 +173,7 @@ public void recoverDeletedKey() { * Tests that an attempt to recover a non existing deleted key throws an error on a soft-delete enabled vault. */ public void recoverDeletedKeyNotFound() { - assertRestException(() -> client.recoverDeletedKey("non-existing"), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.recoverDeletedKey("non-existing"), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); } /** @@ -192,7 +192,7 @@ public void backupKey() { * Tests that an attempt to backup a non existing key throws an error. */ public void backupKeyNotFound() { - assertRestException(() -> client.backupKey("non-existing"), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.backupKey("non-existing"), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); } /** @@ -220,7 +220,7 @@ public void restoreKey() { */ public void restoreKeyFromMalformedBackup() { byte[] keyBackupBytes = "non-existing".getBytes(); - assertRestException(() -> client.restoreKey(keyBackupBytes), ResourceModifiedException.class, HttpResponseStatus.BAD_REQUEST.code()); + assertRestException(() -> client.restoreKey(keyBackupBytes), ResourceModifiedException.class, HttpURLConnection.HTTP_BAD_REQUEST); } /** @@ -256,9 +256,9 @@ public void getDeletedKey() { pollOnKeyDeletion(keyToDeleteAndGet.name()); sleepInRecordMode(30000); DeletedKey deletedKey = client.getDeletedKey(keyToDeleteAndGet.name()); - assertNotNull(deletedKey.deletedDate()); - assertNotNull(deletedKey.recoveryId()); - assertNotNull(deletedKey.scheduledPurgeDate()); + assertNotNull(deletedKey.getDeletedDate()); + assertNotNull(deletedKey.getRecoveryId()); + assertNotNull(deletedKey.getScheduledPurgeDate()); assertEquals(keyToDeleteAndGet.name(), deletedKey.name()); client.purgeDeletedKey(keyToDeleteAndGet.name()); pollOnKeyPurge(keyToDeleteAndGet.name()); @@ -286,8 +286,8 @@ public void listDeletedKeys() { Iterable deletedKeys = client.listDeletedKeys(); for (DeletedKey actualKey : deletedKeys) { if (keysToDelete.containsKey(actualKey.name())) { - assertNotNull(actualKey.deletedDate()); - assertNotNull(actualKey.recoveryId()); + assertNotNull(actualKey.getDeletedDate()); + assertNotNull(actualKey.getRecoveryId()); keysToDelete.remove(actualKey.name()); } } diff --git a/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTestBase.java b/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTestBase.java index 8f0e05d388ad..8350e6ac94c4 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTestBase.java +++ b/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTestBase.java @@ -9,6 +9,7 @@ import com.azure.core.http.HttpClient; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.netty.NettyAsyncHttpClientBuilder; import com.azure.core.http.policy.*; import com.azure.core.http.rest.Response; import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; @@ -48,7 +49,7 @@ public abstract class KeyClientTestBase extends TestBase { public TestName testName = new TestName(); @Override - protected String testName() { + protected String getTestName() { return testName.getMethodName(); } @@ -83,7 +84,7 @@ T clientSetup(Function clientBuilder) { httpClient = interceptorManager.getPlaybackClient(); policies.add(interceptorManager.getRecordPolicy()); } else { - httpClient = HttpClient.createDefault().wiretap(true); + httpClient = new NettyAsyncHttpClientBuilder().wiretap(true).build(); policies.add(interceptorManager.getRecordPolicy()); } @@ -107,9 +108,9 @@ void setKeyRunner(Consumer testRunner) { tags.put("foo", "baz"); final KeyCreateOptions keyOptions = new KeyCreateOptions(KEY_NAME, RSA_KEY_TYPE) - .expires(OffsetDateTime.of(2050, 1, 30, 0, 0, 0, 0, ZoneOffset.UTC)) - .notBefore(OffsetDateTime.of(2000, 1, 30, 12, 59, 59, 0, ZoneOffset.UTC)) - .tags(tags); + .setExpires(OffsetDateTime.of(2050, 1, 30, 0, 0, 0, 0, ZoneOffset.UTC)) + .setNotBefore(OffsetDateTime.of(2000, 1, 30, 12, 59, 59, 0, ZoneOffset.UTC)) + .setTags(tags); testRunner.accept(keyOptions); } @@ -137,12 +138,12 @@ void updateKeyRunner(BiConsumer testRunner) tags.put("first tag", "first value"); tags.put("second tag", "second value"); final KeyCreateOptions originalKey = new KeyCreateOptions("testKey1", RSA_KEY_TYPE) - .expires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)) - .tags(tags); + .setExpires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)) + .setTags(tags); final KeyCreateOptions updatedKey = new KeyCreateOptions("testKey1", RSA_KEY_TYPE) - .expires(OffsetDateTime.of(2060, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)) - .tags(tags); + .setExpires(OffsetDateTime.of(2060, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)) + .setTags(tags); testRunner.accept(originalKey, updatedKey); } @@ -156,11 +157,11 @@ void updateDisabledKeyRunner(BiConsumer test final Map tags = new HashMap<>(); final KeyCreateOptions originalKey = new KeyCreateOptions("testKey2", EC_KEY_TYPE) - .expires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)) - .enabled(false); + .setExpires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)) + .setEnabled(false); final KeyCreateOptions updatedKey = new KeyCreateOptions("testKey2", EC_KEY_TYPE) - .expires(OffsetDateTime.of(2060, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); + .setExpires(OffsetDateTime.of(2060, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); testRunner.accept(originalKey, updatedKey); } @@ -170,7 +171,7 @@ void updateDisabledKeyRunner(BiConsumer test void getKeyRunner(Consumer testRunner) { final KeyCreateOptions originalKey = new KeyCreateOptions("testKey4", RSA_KEY_TYPE) - .expires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); + .setExpires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); testRunner.accept(originalKey); } @@ -180,10 +181,10 @@ void getKeyRunner(Consumer testRunner) { void getKeySpecificVersionRunner(BiConsumer testRunner) { final KeyCreateOptions key = new KeyCreateOptions("testKey3", RSA_KEY_TYPE) - .expires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); + .setExpires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); final KeyCreateOptions keyWithNewVal = new KeyCreateOptions("testKey3", RSA_KEY_TYPE) - .expires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); + .setExpires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); testRunner.accept(key, keyWithNewVal); } @@ -196,7 +197,7 @@ void getKeySpecificVersionRunner(BiConsumer void deleteKeyRunner(Consumer testRunner) { final KeyCreateOptions keyToDelete = new KeyCreateOptions("testKey5", RSA_KEY_TYPE) - .expires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); + .setExpires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); testRunner.accept(keyToDelete); } @@ -209,7 +210,7 @@ void deleteKeyRunner(Consumer testRunner) { void getDeletedKeyRunner(Consumer testRunner) { final KeyCreateOptions keyToDeleteAndGet = new KeyCreateOptions("testKey6", RSA_KEY_TYPE) - .expires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); + .setExpires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); testRunner.accept(keyToDeleteAndGet); } @@ -221,7 +222,7 @@ void getDeletedKeyRunner(Consumer testRunner) { void recoverDeletedKeyRunner(Consumer testRunner) { final KeyCreateOptions keyToDeleteAndRecover = new KeyCreateOptions("testKey7", RSA_KEY_TYPE) - .expires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); + .setExpires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); testRunner.accept(keyToDeleteAndRecover); } @@ -233,7 +234,7 @@ void recoverDeletedKeyRunner(Consumer testRunner) { void backupKeyRunner(Consumer testRunner) { final KeyCreateOptions keyToBackup = new KeyCreateOptions("testKey8", RSA_KEY_TYPE) - .expires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); + .setExpires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); testRunner.accept(keyToBackup); } @@ -245,7 +246,7 @@ void backupKeyRunner(Consumer testRunner) { void restoreKeyRunner(Consumer testRunner) { final KeyCreateOptions keyToBackupAndRestore = new KeyCreateOptions("testKey9", RSA_KEY_TYPE) - .expires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); + .setExpires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); testRunner.accept(keyToBackupAndRestore); } @@ -261,7 +262,7 @@ void listKeysRunner(Consumer> testRunner) { for (int i = 0; i < 30; i++) { keyName = "listKey" + i; KeyCreateOptions key = new KeyCreateOptions(keyName, RSA_KEY_TYPE) - .expires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); + .setExpires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); keys.put(keyName, key); } testRunner.accept(keys); @@ -276,7 +277,7 @@ void listKeyVersionsRunner(Consumer> testRunner) { for (int i = 1; i < 5; i++) { keyName = "listKeyVersion"; keys.add(new KeyCreateOptions(keyName, RSA_KEY_TYPE) - .expires(OffsetDateTime.of(2090, 5, i, 0, 0, 0, 0, ZoneOffset.UTC))); + .setExpires(OffsetDateTime.of(2090, 5, i, 0, 0, 0, 0, ZoneOffset.UTC))); } testRunner.accept(keys); @@ -291,7 +292,7 @@ void listDeletedKeysRunner(Consumer> testRunne for (int i = 0; i < 3; i++) { keyName = "listDeletedKeysTest" + i; keys.put(keyName, new KeyCreateOptions(keyName, RSA_KEY_TYPE) - .expires(OffsetDateTime.of(2090, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC))); + .setExpires(OffsetDateTime.of(2090, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC))); } testRunner.accept(keys); @@ -316,9 +317,9 @@ static void assertKeyEquals(KeyCreateOptions expected, Response response) { */ static void assertKeyEquals(KeyCreateOptions expected, Response response, final int expectedStatusCode) { assertNotNull(response); - assertEquals(expectedStatusCode, response.statusCode()); + assertEquals(expectedStatusCode, response.getStatusCode()); - assertKeyEquals(expected, response.value()); + assertKeyEquals(expected, response.getValue()); } /** @@ -329,7 +330,7 @@ static void assertKeyEquals(KeyCreateOptions expected, Response response, f */ static void assertKeyEquals(KeyCreateOptions expected, Key actual) { assertEquals(expected.name(), actual.name()); - assertEquals(expected.keyType(), actual.keyMaterial().kty()); + assertEquals(expected.keyType(), actual.getKeyMaterial().getKty()); assertEquals(expected.expires(), actual.expires()); assertEquals(expected.notBefore(), actual.notBefore()); } @@ -367,7 +368,7 @@ static void assertRestException(Throwable exception, int expectedStatusCode) { static void assertRestException(Throwable exception, Class expectedExceptionType, int expectedStatusCode) { assertEquals(expectedExceptionType, exception.getClass()); - assertEquals(expectedStatusCode, ((HttpResponseException) exception).response().statusCode()); + assertEquals(expectedStatusCode, ((HttpResponseException) exception).getResponse().getStatusCode()); } /** diff --git a/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTest.java b/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTest.java index 4a8215394e18..7b67da34b98f 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTest.java +++ b/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTest.java @@ -58,8 +58,8 @@ public void encryptDecryptRsa() throws Exception { JsonWebKey key = JsonWebKey.fromRSA(keyPair); String keyName = "testRsaKey"; Key importedKey = client.importKey(keyName, key); - key.kid(importedKey.id()); - key.keyOps(importedKey.keyMaterial().keyOps()); + key.setKid(importedKey.id()); + key.setKeyOps(importedKey.getKeyMaterial().getKeyOps()); CryptographyClient cryptoClient = new CryptographyClientBuilder() .pipeline(pipeline) .jsonWebKey(key) @@ -72,13 +72,13 @@ public void encryptDecryptRsa() throws Exception { // Test variables byte[] plainText = new byte[100]; new Random(0x1234567L).nextBytes(plainText); - byte[] cipherText = cryptoClient.encrypt(algorithm, plainText).cipherText(); - byte[] decryptedText = serviceClient.decrypt(algorithm, cipherText, Context.NONE).block().plainText(); + byte[] cipherText = cryptoClient.encrypt(algorithm, plainText).getCipherText(); + byte[] decryptedText = serviceClient.decrypt(algorithm, cipherText, Context.NONE).block().getPlainText(); assertArrayEquals(decryptedText, plainText); - cipherText = serviceClient.encrypt(algorithm, plainText, Context.NONE).block().cipherText(); - decryptedText = cryptoClient.decrypt(algorithm, cipherText).plainText(); + cipherText = serviceClient.encrypt(algorithm, plainText, Context.NONE).block().getCipherText(); + decryptedText = cryptoClient.decrypt(algorithm, cipherText).getPlainText(); assertArrayEquals(decryptedText, plainText); } @@ -96,8 +96,8 @@ public void wrapUnwraptRsa() throws Exception { JsonWebKey key = JsonWebKey.fromRSA(keyPair); String keyName = "testRsaKeyWrapUnwrap"; Key importedKey = client.importKey(keyName, key); - key.kid(importedKey.id()); - key.keyOps(importedKey.keyMaterial().keyOps()); + key.setKid(importedKey.id()); + key.setKeyOps(importedKey.getKeyMaterial().getKeyOps()); CryptographyClient cryptoClient = new CryptographyClientBuilder() .pipeline(pipeline) .jsonWebKey(key) @@ -110,13 +110,13 @@ public void wrapUnwraptRsa() throws Exception { // Test variables byte[] plainText = new byte[100]; new Random(0x1234567L).nextBytes(plainText); - byte[] encryptedKey = cryptoClient.wrapKey(algorithm, plainText).encryptedKey(); - byte[] decryptedKey = serviceClient.unwrapKey(algorithm, encryptedKey, Context.NONE).block().key(); + byte[] encryptedKey = cryptoClient.wrapKey(algorithm, plainText).getEncryptedKey(); + byte[] decryptedKey = serviceClient.unwrapKey(algorithm, encryptedKey, Context.NONE).block().getKey(); assertArrayEquals(decryptedKey, plainText); - encryptedKey = serviceClient.wrapKey(algorithm, plainText, Context.NONE).block().encryptedKey(); - decryptedKey = cryptoClient.unwrapKey(algorithm, encryptedKey).key(); + encryptedKey = serviceClient.wrapKey(algorithm, plainText, Context.NONE).block().getEncryptedKey(); + decryptedKey = cryptoClient.unwrapKey(algorithm, encryptedKey).getKey(); assertArrayEquals(decryptedKey, plainText); } @@ -135,8 +135,8 @@ public void signVerifyRsa() throws Exception { JsonWebKey key = JsonWebKey.fromRSA(keyPair); String keyName = "testRsaKeySignVerify"; Key importedKey = client.importKey(keyName, key); - key.kid(importedKey.id()); - key.keyOps(importedKey.keyMaterial().keyOps()); + key.setKid(importedKey.id()); + key.setKeyOps(importedKey.getKeyMaterial().getKeyOps()); CryptographyClient cryptoClient = new CryptographyClientBuilder() .pipeline(pipeline) .jsonWebKey(key) @@ -149,12 +149,12 @@ public void signVerifyRsa() throws Exception { // Test variables byte[] plainText = new byte[100]; new Random(0x1234567L).nextBytes(plainText); - byte[] signature = cryptoClient.signData(algorithm, plainText).signature(); + byte[] signature = cryptoClient.signData(algorithm, plainText).getSignature(); Boolean verifyStatus = serviceClient.verifyData(algorithm, plainText, signature, Context.NONE).block().isValid(); assertTrue(verifyStatus); - signature = serviceClient.signData(algorithm, plainText, Context.NONE).block().signature(); + signature = serviceClient.signData(algorithm, plainText, Context.NONE).block().getSignature(); verifyStatus = cryptoClient.verifyData(algorithm, plainText, signature).isValid(); assertTrue(verifyStatus); @@ -193,8 +193,8 @@ public void signVerifyEc() throws NoSuchAlgorithmException, InvalidAlgorithmPara JsonWebKey key = JsonWebKey.fromEC(keyPair, provider); String keyName = "testEcKey" + crv.toString(); Key imported = client.importKey(keyName, key); - key.kid(imported.id()); - key.keyOps(imported.keyMaterial().keyOps()); + key.setKid(imported.id()); + key.setKeyOps(imported.getKeyMaterial().getKeyOps()); CryptographyClient cryptoClient = new CryptographyClientBuilder() .pipeline(pipeline) .jsonWebKey(key) @@ -204,12 +204,12 @@ public void signVerifyEc() throws NoSuchAlgorithmException, InvalidAlgorithmPara byte[] plainText = new byte[100]; new Random(0x1234567L).nextBytes(plainText); - byte[] signature = cryptoClient.signData(curveToSignature.get(crv), plainText).signature(); + byte[] signature = cryptoClient.signData(curveToSignature.get(crv), plainText).getSignature(); Boolean verifyStatus = serviceClient.verifyData(curveToSignature.get(crv), plainText, signature, Context.NONE).block().isValid(); assertTrue(verifyStatus); - signature = serviceClient.signData(curveToSignature.get(crv), plainText, Context.NONE).block().signature(); + signature = serviceClient.signData(curveToSignature.get(crv), plainText, Context.NONE).block().getSignature(); verifyStatus = cryptoClient.verifyData(curveToSignature.get(crv), plainText, signature).isValid(); if (!interceptorManager.isPlaybackMode()) { assertTrue(verifyStatus); @@ -233,15 +233,15 @@ public void wrapUnwrapSymmetricKeyAES128Kw() { CryptographyClient cryptoClient = new CryptographyClientBuilder() .pipeline(pipeline) .jsonWebKey(JsonWebKey.fromAes(new SecretKeySpec(kek, "AES")) - .kty(KeyType.OCT) - .keyOps(Arrays.asList(KeyOperation.WRAP_KEY, KeyOperation.UNWRAP_KEY))) + .setKty(KeyType.OCT) + .setKeyOps(Arrays.asList(KeyOperation.WRAP_KEY, KeyOperation.UNWRAP_KEY))) .buildClient(); - byte[] encrypted = cryptoClient.wrapKey(KeyWrapAlgorithm.A128KW, cek).encryptedKey(); + byte[] encrypted = cryptoClient.wrapKey(KeyWrapAlgorithm.A128KW, cek).getEncryptedKey(); assertArrayEquals(ek, encrypted); - byte[] decrypted = cryptoClient.unwrapKey(KeyWrapAlgorithm.A128KW, encrypted).key(); + byte[] decrypted = cryptoClient.unwrapKey(KeyWrapAlgorithm.A128KW, encrypted).getKey(); assertArrayEquals(cek, decrypted); } @@ -256,15 +256,15 @@ public void wrapUnwrapSymmetricKeyAES192Kw() { CryptographyClient cryptoClient = new CryptographyClientBuilder() .pipeline(pipeline) .jsonWebKey(JsonWebKey.fromAes(new SecretKeySpec(kek, "AES")) - .kty(KeyType.OCT) - .keyOps(Arrays.asList(KeyOperation.WRAP_KEY, KeyOperation.UNWRAP_KEY))) + .setKty(KeyType.OCT) + .setKeyOps(Arrays.asList(KeyOperation.WRAP_KEY, KeyOperation.UNWRAP_KEY))) .buildClient(); - byte[] encrypted = cryptoClient.wrapKey(KeyWrapAlgorithm.A192KW, cek).encryptedKey(); + byte[] encrypted = cryptoClient.wrapKey(KeyWrapAlgorithm.A192KW, cek).getEncryptedKey(); assertArrayEquals(ek, encrypted); - byte[] decrypted = cryptoClient.unwrapKey(KeyWrapAlgorithm.A192KW, encrypted).key(); + byte[] decrypted = cryptoClient.unwrapKey(KeyWrapAlgorithm.A192KW, encrypted).getKey(); assertArrayEquals(cek, decrypted); } @@ -279,15 +279,15 @@ public void wrapUnwrapSymmetricKeyAES256Kw() { CryptographyClient cryptoClient = new CryptographyClientBuilder() .pipeline(pipeline) .jsonWebKey(JsonWebKey.fromAes(new SecretKeySpec(kek, "AES")) - .kty(KeyType.OCT) - .keyOps(Arrays.asList(KeyOperation.WRAP_KEY, KeyOperation.UNWRAP_KEY))) + .setKty(KeyType.OCT) + .setKeyOps(Arrays.asList(KeyOperation.WRAP_KEY, KeyOperation.UNWRAP_KEY))) .buildClient(); - byte[] encrypted = cryptoClient.wrapKey(KeyWrapAlgorithm.A256KW, cek).encryptedKey(); + byte[] encrypted = cryptoClient.wrapKey(KeyWrapAlgorithm.A256KW, cek).getEncryptedKey(); assertArrayEquals(ek, encrypted); - byte[] decrypted = cryptoClient.unwrapKey(KeyWrapAlgorithm.A256KW, encrypted).key(); + byte[] decrypted = cryptoClient.unwrapKey(KeyWrapAlgorithm.A256KW, encrypted).getKey(); assertArrayEquals(cek, decrypted); } @@ -329,15 +329,15 @@ public void encryptDecryptSymmetricKeyAes128CbcHmacSha256() { CryptographyClient cryptoClient = new CryptographyClientBuilder() .pipeline(pipeline) .jsonWebKey(JsonWebKey.fromAes(new SecretKeySpec(key, "AES")) - .kty(KeyType.OCT) - .keyOps(Arrays.asList(KeyOperation.ENCRYPT, KeyOperation.DECRYPT))) + .setKty(KeyType.OCT) + .setKeyOps(Arrays.asList(KeyOperation.ENCRYPT, KeyOperation.DECRYPT))) .buildClient(); - byte[] encrypted = cryptoClient.encrypt(EncryptionAlgorithm.A128CBC_HS256, plaintext, iv, authData).cipherText(); + byte[] encrypted = cryptoClient.encrypt(EncryptionAlgorithm.A128CBC_HS256, plaintext, iv, authData).getCipherText(); assertArrayEquals(expected, encrypted); - byte[] decrypted = cryptoClient.decrypt(EncryptionAlgorithm.A128CBC_HS256, encrypted, iv, authData, authTag).plainText(); + byte[] decrypted = cryptoClient.decrypt(EncryptionAlgorithm.A128CBC_HS256, encrypted, iv, authData, authTag).getPlainText(); assertArrayEquals(plaintext, decrypted); } @@ -376,15 +376,15 @@ public void encryptDecryptSymmetricKeyAes128CbcHmacSha384() { CryptographyClient cryptoClient = new CryptographyClientBuilder() .pipeline(pipeline) .jsonWebKey(JsonWebKey.fromAes(new SecretKeySpec(key, "AES")) - .kty(KeyType.OCT) - .keyOps(Arrays.asList(KeyOperation.ENCRYPT, KeyOperation.DECRYPT))) + .setKty(KeyType.OCT) + .setKeyOps(Arrays.asList(KeyOperation.ENCRYPT, KeyOperation.DECRYPT))) .buildClient(); - byte[] encrypted = cryptoClient.encrypt(EncryptionAlgorithm.A192CBC_HS384, plaintext, iv, authData).cipherText(); + byte[] encrypted = cryptoClient.encrypt(EncryptionAlgorithm.A192CBC_HS384, plaintext, iv, authData).getCipherText(); assertArrayEquals(expected, encrypted); - byte[] decrypted = cryptoClient.decrypt(EncryptionAlgorithm.A192CBC_HS384, encrypted, iv, authData, authTags).plainText(); + byte[] decrypted = cryptoClient.decrypt(EncryptionAlgorithm.A192CBC_HS384, encrypted, iv, authData, authTags).getPlainText(); assertArrayEquals(plaintext, decrypted); } @@ -424,15 +424,15 @@ public void encryptDecryptSymmetricKeyAes128CbcHmacSha512() { CryptographyClient cryptoClient = new CryptographyClientBuilder() .pipeline(pipeline) .jsonWebKey(JsonWebKey.fromAes(new SecretKeySpec(key, "AES")) - .kty(KeyType.OCT) - .keyOps(Arrays.asList(KeyOperation.ENCRYPT, KeyOperation.DECRYPT))) + .setKty(KeyType.OCT) + .setKeyOps(Arrays.asList(KeyOperation.ENCRYPT, KeyOperation.DECRYPT))) .buildClient(); - byte[] encrypted = cryptoClient.encrypt(EncryptionAlgorithm.A256CBC_HS512, plaintext, iv, authData).cipherText(); + byte[] encrypted = cryptoClient.encrypt(EncryptionAlgorithm.A256CBC_HS512, plaintext, iv, authData).getCipherText(); assertArrayEquals(expected, encrypted); - byte[] decrypted = cryptoClient.decrypt(EncryptionAlgorithm.A256CBC_HS512, encrypted, iv, authData, authTags).plainText(); + byte[] decrypted = cryptoClient.decrypt(EncryptionAlgorithm.A256CBC_HS512, encrypted, iv, authData, authTags).getPlainText(); assertArrayEquals(plaintext, decrypted); } @@ -449,15 +449,15 @@ public void encryptDecryptSymmetricKeyaes128CbcOneBlock() { CryptographyClient cryptoClient = new CryptographyClientBuilder() .pipeline(pipeline) .jsonWebKey(JsonWebKey.fromAes(new SecretKeySpec(keyContent, "AES")) - .kty(KeyType.OCT) - .keyOps(Arrays.asList(KeyOperation.ENCRYPT, KeyOperation.DECRYPT))) + .setKty(KeyType.OCT) + .setKeyOps(Arrays.asList(KeyOperation.ENCRYPT, KeyOperation.DECRYPT))) .buildClient(); - byte[] encrypted = cryptoClient.encrypt(EncryptionAlgorithm.A128CBC, plaintext, initializationVector, null).cipherText(); + byte[] encrypted = cryptoClient.encrypt(EncryptionAlgorithm.A128CBC, plaintext, initializationVector, null).getCipherText(); assertArrayEquals(Arrays.copyOfRange(encrypted, 0, 16), expected); - byte[] decrypted = cryptoClient.decrypt(EncryptionAlgorithm.A128CBC, encrypted, initializationVector, null, null).plainText(); + byte[] decrypted = cryptoClient.decrypt(EncryptionAlgorithm.A128CBC, encrypted, initializationVector, null, null).getPlainText(); assertArrayEquals(Arrays.copyOfRange(decrypted, 0, 16), plaintext); } @@ -474,15 +474,15 @@ public void encryptDecryptSymmetricKeyaes128CbcTwoBlock() { CryptographyClient cryptoClient = new CryptographyClientBuilder() .pipeline(pipeline) .jsonWebKey(JsonWebKey.fromAes(new SecretKeySpec(keyContent, "AES")) - .kty(KeyType.OCT) - .keyOps(Arrays.asList(KeyOperation.ENCRYPT, KeyOperation.DECRYPT))) + .setKty(KeyType.OCT) + .setKeyOps(Arrays.asList(KeyOperation.ENCRYPT, KeyOperation.DECRYPT))) .buildClient(); - byte[] encrypted = cryptoClient.encrypt(EncryptionAlgorithm.A128CBC, plaintext, initializationVector, null).cipherText(); + byte[] encrypted = cryptoClient.encrypt(EncryptionAlgorithm.A128CBC, plaintext, initializationVector, null).getCipherText(); assertArrayEquals(Arrays.copyOfRange(encrypted, 0, 32), expected); - byte[] decrypted = cryptoClient.decrypt(EncryptionAlgorithm.A128CBC, encrypted, initializationVector, null, null).plainText(); + byte[] decrypted = cryptoClient.decrypt(EncryptionAlgorithm.A128CBC, encrypted, initializationVector, null, null).getPlainText(); assertArrayEquals(Arrays.copyOfRange(decrypted, 0, 32), plaintext); } diff --git a/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTestBase.java b/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTestBase.java index 12791804f406..0c22f586558a 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTestBase.java +++ b/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTestBase.java @@ -9,6 +9,7 @@ import com.azure.core.http.HttpClient; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.netty.NettyAsyncHttpClientBuilder; import com.azure.core.http.policy.*; import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; import com.azure.core.test.TestBase; @@ -42,7 +43,7 @@ public abstract class CryptographyClientTestBase extends TestBase { public TestName testName = new TestName(); @Override - protected String testName() { + protected String getTestName() { return testName.getMethodName(); } @@ -86,7 +87,7 @@ T clientSetup(Function clientBuilder) { httpClient = interceptorManager.getPlaybackClient(); policies.add(interceptorManager.getRecordPolicy()); } else { - httpClient = HttpClient.createDefault().wiretap(true); + httpClient = new NettyAsyncHttpClientBuilder().wiretap(true).build(); policies.add(interceptorManager.getRecordPolicy()); } @@ -195,7 +196,7 @@ static void assertRestException(Throwable exception, int expectedStatusCode) { static void assertRestException(Throwable exception, Class expectedExceptionType, int expectedStatusCode) { assertEquals(expectedExceptionType, exception.getClass()); - assertEquals(expectedStatusCode, ((HttpResponseException) exception).response().statusCode()); + assertEquals(expectedStatusCode, ((HttpResponseException) exception).getResponse().getStatusCode()); } /** diff --git a/sdk/keyvault/azure-keyvault-secrets/CHANGELOG.md b/sdk/keyvault/azure-keyvault-secrets/CHANGELOG.md index 21b18ac246d8..3876aba34f18 100644 --- a/sdk/keyvault/azure-keyvault-secrets/CHANGELOG.md +++ b/sdk/keyvault/azure-keyvault-secrets/CHANGELOG.md @@ -1,5 +1,8 @@ # Release History +## 4.0.0-preview.3 (2019-09-10) +For details on the Azure SDK for Java (August 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview3-java). + ## 4.0.0-preview.2 (2019-08-06) For details on the Azure SDK for Java (August 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview2-java). diff --git a/sdk/keyvault/azure-keyvault-secrets/README.md b/sdk/keyvault/azure-keyvault-secrets/README.md index 2268426828d9..1a160b871da1 100644 --- a/sdk/keyvault/azure-keyvault-secrets/README.md +++ b/sdk/keyvault/azure-keyvault-secrets/README.md @@ -15,9 +15,43 @@ Maven dependency for Azure Secret Client library. Add it to your project's pom f com.azure azure-keyvault-secrets - 4.0.0-preview.2 + 4.0.0-preview.3 ``` +### 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-secret-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(); +``` ### Prerequisites @@ -306,3 +340,5 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope [sample_BackupRestoreAsync]: src/samples/java/com/azure/security/keyvault/secrets/BackupAndRestoreOperationsAsync.java [sample_ManageDeleted]: src/samples/java/com/azure/security/keyvault/secrets/ManagingDeletedSecrets.java [sample_ManageDeletedAsync]: src/samples/java/com/azure/security/keyvault/secrets/ManagingDeletedSecretsAsync.java + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/keyvault/azure-keyvault-secrets/README.png) diff --git a/sdk/keyvault/azure-keyvault-secrets/pom.xml b/sdk/keyvault/azure-keyvault-secrets/pom.xml index 0c3cf6d4f518..2b4dd386e854 100644 --- a/sdk/keyvault/azure-keyvault-secrets/pom.xml +++ b/sdk/keyvault/azure-keyvault-secrets/pom.xml @@ -3,17 +3,18 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - azure-client-sdk-parent com.azure - 1.3.0 + azure-client-sdk-parent + 1.4.0 ../../../pom.client.xml com.azure azure-keyvault-secrets - 4.0.0-preview.3 + 4.0.0-preview.4 - azure-keyvault-secrets + Microsoft Azure client library for KeyVault Secrets + This module contains client library for Microsoft Azure KeyVault Secrets. https://github.com/Azure/azure-sdk-for-java @@ -29,12 +30,16 @@ HEAD + + com.azure.security.keyvault.secrets + + com.azure azure-core - 1.0.0-preview.4 + 1.0.0-preview.5 @@ -57,14 +62,20 @@ com.azure azure-core-test - 1.0.0-preview.4 + 1.0.0-preview.5 + test + + + com.azure + azure-core-http-netty + 1.0.0-preview.5 test com.azure azure-identity - 1.0.0-preview.3 + 1.0.0-preview.4 test diff --git a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/AzureKeyVaultConfiguration.java b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/AzureKeyVaultConfiguration.java index b0d4e639d13f..24eb618b465a 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/AzureKeyVaultConfiguration.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/AzureKeyVaultConfiguration.java @@ -6,5 +6,5 @@ class AzureKeyVaultConfiguration { //TODO: Eventually remove these hardcoded strings with https://github.com/Azure/azure-sdk-for-java/issues/3141 static final String SDK_NAME = "Azure-Keyvault"; - static final String SDK_VERSION = "4.0.0-preview.3"; + static final String SDK_VERSION = "4.0.0-preview.4"; } diff --git a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/KeyVaultCredentialPolicy.java b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/KeyVaultCredentialPolicy.java index 0ef9d4544c03..91d9cf8f7615 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/KeyVaultCredentialPolicy.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/KeyVaultCredentialPolicy.java @@ -50,14 +50,14 @@ public Mono process(HttpPipelineCallContext context, HttpPipelineN return next.clone().process() // Ignore body .doOnNext(HttpResponse::close) - .map(res -> res.headerValue(WWW_AUTHENTICATE)) + .map(res -> res.getHeaderValue(WWW_AUTHENTICATE)) .map(header -> extractChallenge(header, BEARER_TOKEN_PREFIX)) .flatMap(map -> { - cache.scopes(map.get("resource") + "/.default"); + cache.setScopes(map.get("resource") + "/.default"); return cache.getToken(); }) .flatMap(token -> { - context.httpRequest().header(AUTHORIZATION, BEARER_TOKEN_PREFIX + token.token()); + context.getHttpRequest().setHeader(AUTHORIZATION, BEARER_TOKEN_PREFIX + token.getToken()); return next.process(); }); } @@ -73,7 +73,8 @@ private static Map extractChallenge(String authenticateHeader, S if (!isValidChallenge(authenticateHeader, authChallengePrefix)) { return null; } - authenticateHeader = authenticateHeader.toLowerCase(Locale.ROOT).replace(authChallengePrefix.toLowerCase(Locale.ROOT), ""); + authenticateHeader = + authenticateHeader.toLowerCase(Locale.ROOT).replace(authChallengePrefix.toLowerCase(Locale.ROOT), ""); String[] challenges = authenticateHeader.split(", "); Map challengeMap = new HashMap<>(); diff --git a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/KeyVaultErrorCodeStrings.java b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/KeyVaultErrorCodeStrings.java index c8932bd0e26b..61245b796680 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/KeyVaultErrorCodeStrings.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/KeyVaultErrorCodeStrings.java @@ -34,7 +34,8 @@ static String getErrorString(String propertyName) { private static synchronized void loadProperties() { if (errorStrings == null) { - try (InputStream fileInputStream = KeyVaultErrorCodeStrings.class.getClassLoader().getResource((ERROR_STRINGS_FILE_NAME)).openStream()) { + try (InputStream fileInputStream = + KeyVaultErrorCodeStrings.class.getClassLoader().getResource((ERROR_STRINGS_FILE_NAME)).openStream()) { errorStrings = new Properties(); errorStrings.load(fileInputStream); } catch (IOException ex) { diff --git a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/ScopeTokenCache.java b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/ScopeTokenCache.java index 96ac53d7c7a9..4b179a0a1d5e 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/ScopeTokenCache.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/ScopeTokenCache.java @@ -33,7 +33,7 @@ class ScopeTokenCache { this.getNew = getNew; } - public void scopes(String... scopes) { + public void setScopes(String... scopes) { this.scopes = scopes; } diff --git a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretAsyncClient.java b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretAsyncClient.java index af394d45d880..a1201fac62c6 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretAsyncClient.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretAsyncClient.java @@ -4,6 +4,7 @@ package com.azure.security.keyvault.secrets; import com.azure.core.http.HttpPipeline; +import com.azure.core.http.rest.Page; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.VoidResponse; import com.azure.core.http.rest.PagedResponse; @@ -32,9 +33,10 @@ import static com.azure.core.implementation.util.FluxUtil.withContext; /** - * The SecretAsyncClient provides asynchronous methods to manage {@link Secret secrets} in the Azure Key Vault. The client - * supports creating, retrieving, updating, deleting, purging, backing up, restoring and listing the {@link Secret secrets}. The client - * also supports listing {@link DeletedSecret deleted secrets} for a soft-delete enabled Azure Key Vault. + * The SecretAsyncClient provides asynchronous methods to manage {@link Secret secrets} in the Azure Key Vault. The + * client supports creating, retrieving, updating, deleting, purging, backing up, restoring and listing the {@link + * Secret secrets}. The client also supports listing {@link DeletedSecret deleted secrets} for a soft-delete enabled + * Azure Key Vault. * *

Samples to construct the async client

* {@codesnippet com.azure.security.keyvault.secrets.async.secretclient.construct} @@ -61,7 +63,8 @@ public final class SecretAsyncClient { * @param pipeline HttpPipeline that the HTTP requests and responses flow through. */ SecretAsyncClient(URL endpoint, HttpPipeline pipeline) { - Objects.requireNonNull(endpoint, KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.VAULT_END_POINT_REQUIRED)); + Objects.requireNonNull(endpoint, + KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.VAULT_END_POINT_REQUIRED)); this.endpoint = endpoint.toString(); this.service = RestProxy.create(SecretService.class, pipeline); } @@ -70,20 +73,21 @@ public final class SecretAsyncClient { * The set operation adds a secret to the key vault. If the named secret already exists, Azure Key Vault creates * a new version of that secret. This operation requires the {@code secrets/set} permission. * - *

The {@link Secret} is required. The {@link Secret#expires() expires}, {@link Secret#contentType() contentType} and - * {@link Secret#notBefore() notBefore} values in {@code secret} are optional. The {@link Secret#enabled() enabled} field is - * set to true by key vault, if not specified.

+ *

The {@link Secret} is required. The {@link Secret#getExpires() expires}, {@link Secret#getContentType() contentType} + * and {@link Secret#getNotBefore() notBefore} values in {@code secret} are optional. The + * {@link Secret#isEnabled() enabled} field is set to true by key vault, if not specified.

* *

Code Samples

- *

Creates a new secret which activates in 1 day and expires in 1 year in the Azure Key Vault. Subscribes to the call asynchronously and - * prints out the newly created secret details when a response is received.

+ *

Creates a new secret which activates in 1 day and expires in 1 year in the Azure Key Vault. Subscribes to the + * call asynchronously and prints out the newly created secret details when a response is received.

* {@codesnippet com.azure.keyvault.secrets.secretclient.setSecret#secret} * - * @param secret The Secret object containing information about the secret and its properties. The properties secret.name and secret.value must be non null. + * @param secret The Secret object containing information about the secret and its properties. The properties + * secret.name and secret.value must be non null. + * @return A {@link Mono} containing the {@link Secret created secret}. * @throws NullPointerException if {@code secret} is {@code null}. * @throws ResourceModifiedException if {@code secret} is malformed. - * @throws HttpRequestException if {@link Secret#name() name} or {@link Secret#value() value} is empty string. - * @return A {@link Mono} containing the {@link Secret created secret}. + * @throws HttpRequestException if {@link Secret#getName() name} or {@link Secret#getValue() value} is empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono setSecret(Secret secret) { @@ -94,20 +98,22 @@ public Mono setSecret(Secret secret) { * The set operation adds a secret to the key vault. If the named secret already exists, Azure Key Vault creates * a new version of that secret. This operation requires the {@code secrets/set} permission. * - *

The {@link Secret} is required. The {@link Secret#expires() expires}, {@link Secret#contentType() contentType} and - * {@link Secret#notBefore() notBefore} values in {@code secret} are optional. The {@link Secret#enabled() enabled} field is - * set to true by key vault, if not specified.

+ *

The {@link Secret} is required. The {@link Secret#getExpires() expires}, {@link Secret#getContentType() contentType} + * and {@link Secret#getNotBefore() notBefore} values in {@code secret} are optional. The + * {@link Secret#isEnabled() enabled} field is set to true by key vault, if not specified.

* *

Code Samples

- *

Creates a new secret which activates in 1 day and expires in 1 year in the Azure Key Vault. Subscribes to the call asynchronously and - * prints out the newly created secret details when a response is received.

+ *

Creates a new secret which activates in 1 day and expires in 1 year in the Azure Key Vault. Subscribes to the + * call asynchronously and prints out the newly created secret details when a response is received.

* {@codesnippet com.azure.keyvault.secrets.secretclient.setSecretWithResponse#secret} * - * @param secret The Secret object containing information about the secret and its properties. The properties secret.name and secret.value must be non null. + * @param secret The Secret object containing information about the secret and its properties. The properties + * secret.name and secret.value must be non null. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link + * Secret created secret}. * @throws NullPointerException if {@code secret} is {@code null}. * @throws ResourceModifiedException if {@code secret} is malformed. - * @throws HttpRequestException if {@link Secret#name() name} or {@link Secret#value() value} is empty string. - * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link Secret created secret}. + * @throws HttpRequestException if {@link Secret#getName() name} or {@link Secret#getValue() value} is empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> setSecretWithResponse(Secret secret) { @@ -117,15 +123,16 @@ public Mono> setSecretWithResponse(Secret secret) { Mono> setSecretWithResponse(Secret secret, Context context) { Objects.requireNonNull(secret, "The Secret input parameter cannot be null."); SecretRequestParameters parameters = new SecretRequestParameters() - .value(secret.value()) - .tags(secret.tags()) - .contentType(secret.contentType()) - .secretAttributes(new SecretRequestAttributes(secret)); + .setValue(secret.getValue()) + .setTags(secret.getTags()) + .setContentType(secret.getContentType()) + .setSecretAttributes(new SecretRequestAttributes(secret)); - return service.setSecret(endpoint, secret.name(), API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Setting secret - {}", secret.name())) - .doOnSuccess(response -> logger.info("Set secret - {}", response.value().name())) - .doOnError(error -> logger.warning("Failed to set secret - {}", secret.name(), error)); + return service.setSecret(endpoint, secret.getName(), API_VERSION, ACCEPT_LANGUAGE, parameters, + CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Setting secret - {}", secret.getName())) + .doOnSuccess(response -> logger.info("Set secret - {}", response.getValue().getName())) + .doOnError(error -> logger.warning("Failed to set secret - {}", secret.getName(), error)); } /** @@ -150,32 +157,31 @@ public Mono setSecret(String name, String value) { } Mono> setSecretWithResponse(String name, String value, Context context) { - SecretRequestParameters parameters = new SecretRequestParameters().value(value); - return service.setSecret(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context) + SecretRequestParameters parameters = new SecretRequestParameters().setValue(value); + return service.setSecret(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, + context) .doOnRequest(ignored -> logger.info("Setting secret - {}", name)) - .doOnSuccess(response -> logger.info("Set secret - {}", response.value().name())) + .doOnSuccess(response -> logger.info("Set secret - {}", response.getValue().getName())) .doOnError(error -> logger.warning("Failed to set secret - {}", name, error)); } /** - * Get the specified secret with specified version from the key vault. The get operation is - * applicable to any secret stored in Azure Key Vault. This operation requires the {@code - * secrets/get} permission. + * Get the specified secret with specified version from the key vault. The get operation is applicable to any secret + * stored in Azure Key Vault. This operation requires the {@code secrets/get} permission. * *

Code Samples

*

Gets a specific version of the secret in the key vault. Subscribes to the call - * asynchronously and prints out the - * returned secret details when a response is received.

+ * asynchronously and prints out the returned secret details when a response is received.

* {@codesnippet com.azure.keyvault.secrets.secretclient.getSecret#string-string} * * @param name The name of the secret, cannot be null * @param version The version of the secret to retrieve. If this is an empty String or null, this - * call is equivalent to calling {@link #getSecret(String)}, with the latest version being - * retrieved. - * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} - * contains the requested {@link Secret secret}. + * call is equivalent to calling {@link #getSecret(String)}, with the latest version being + * retrieved. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} + * contains the requested {@link Secret secret}. * @throws ResourceNotFoundException when a secret with {@code name} and {@code version} doesn't - * exist in the key vault. + * exist in the key vault. * @throws HttpRequestException if {@code name} name} or {@code version} is empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -185,23 +191,20 @@ public Mono getSecret(String name, String version) { /** * Get the specified secret with specified version from the key vault. The get operation is - * applicable to any secret stored in Azure Key Vault. This operation requires the {@code - * secrets/get} permission. + * applicable to any secret stored in Azure Key Vault. This operation requires the {@code secrets/get} permission. * *

Code Samples

- *

Gets a specific version of the secret in the key vault. Subscribes to the call - * asynchronously and prints out the - * returned secret details when a response is received.

+ *

Gets a specific version of the secret in the key vault. Subscribes to the call asynchronously and prints out + * the returned secret details when a response is received.

* {@codesnippet com.azure.keyvault.secrets.secretclient.getSecretWithResponse#string-string} * * @param name The name of the secret, cannot be null - * @param version The version of the secret to retrieve. If this is an empty String or null, this - * call is equivalent to calling {@link #getSecret(String)}, with the latest version being - * retrieved. - * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} - * contains the requested {@link Secret secret}. - * @throws ResourceNotFoundException when a secret with {@code name} and {@code version} doesn't - * exist in the key vault. + * @param version The version of the secret to retrieve. If this is an empty String or null, this call is equivalent + * to calling {@link #getSecret(String)}, with the latest version being retrieved. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the requested + * {@link Secret secret}. + * @throws ResourceNotFoundException when a secret with {@code name} and {@code version} doesn't exist in the key + * vault. * @throws HttpRequestException if {@code name} name} or {@code version} is empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -210,9 +213,10 @@ public Mono> getSecretWithResponse(String name, String version) } Mono> getSecretWithResponse(String name, String version, Context context) { - return service.getSecret(endpoint, name, version == null ? "" : version, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + return service.getSecret(endpoint, name, version == null ? "" : version, API_VERSION, ACCEPT_LANGUAGE, + CONTENT_TYPE_HEADER_VALUE, context) .doOnRequest(ignoredValue -> logger.info("Retrieving secret - {}", name)) - .doOnSuccess(response -> logger.info("Retrieved secret - {}", response.value().name())) + .doOnSuccess(response -> logger.info("Retrieved secret - {}", response.getValue().getName())) .doOnError(error -> logger.warning("Failed to get secret - {}", name, error)); } @@ -222,19 +226,19 @@ Mono> getSecretWithResponse(String name, String version, Contex * {@code secrets/get} permission. * *

The list operations {@link SecretAsyncClient#listSecrets()} and {@link - * SecretAsyncClient#listSecretVersions(String)} return - * the {@link Flux} containing {@link SecretBase base secret} as output. This operation can then be used to get - * the full secret with its value from {@code secretBase}.

+ * SecretAsyncClient#listSecretVersions(String)} return the {@link Flux} containing {@link SecretBase base secret} + * as output. This operation can then be used to get the full secret with its value from {@code secretBase}.

+ * *

Code Samples

* {@codesnippet com.azure.keyvault.secrets.secretclient.getSecret#secretBase} * - * @param secretBase The {@link SecretBase base secret} secret base holding attributes of the - * secret being requested. + * @param secretBase The {@link SecretBase base secret} secret base holding attributes of the secret being + * requested. * @return A {@link Mono} containing the requested {@link Secret secret}. - * @throws ResourceNotFoundException when a secret with {@link SecretBase#name() name} and {@link - * SecretBase#version() version} doesn't exist in the key vault. - * @throws HttpRequestException if {@link SecretBase#name()} name} or {@link SecretBase#version() - * version} is empty string. + * @throws ResourceNotFoundException when a secret with {@link SecretBase#getName() name} and {@link + * SecretBase#getVersion() version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link SecretBase#getName()} name} or {@link SecretBase#getVersion() version} is empty + * string. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getSecret(SecretBase secretBase) { @@ -247,33 +251,34 @@ public Mono getSecret(SecretBase secretBase) { * {@code secrets/get} permission. * *

The list operations {@link SecretAsyncClient#listSecrets()} and {@link - * SecretAsyncClient#listSecretVersions(String)} return - * the {@link Flux} containing {@link SecretBase base secret} as output. This operation can then be used to get - * the full secret with its value from {@code secretBase}.

+ * SecretAsyncClient#listSecretVersions(String)} return the {@link Flux} containing {@link SecretBase base secret} + * as output. This operation can then be used to get the full secret with its value from {@code secretBase}.

+ * *

Code Samples

* {@codesnippet com.azure.keyvault.secrets.secretclient.getSecretWithResponse#secretBase} * - * @param secretBase The {@link SecretBase base secret} secret base holding attributes of the - * secret being requested. - * @return A {@link Response} whose {@link Response#value() value} contains the requested {@link - * Secret secret}. - * @throws ResourceNotFoundException when a secret with {@link SecretBase#name() name} and {@link - * SecretBase#version() version} doesn't exist in the key vault. - * @throws HttpRequestException if {@link SecretBase#name()} name} or {@link SecretBase#version() - * version} is empty string. + * @param secretBase The {@link SecretBase base secret} secret base holding attributes of the secret being + * requested. + * @return A {@link Response} whose {@link Response#getValue() value} contains the requested {@link Secret secret}. + * @throws ResourceNotFoundException when a secret with {@link SecretBase#getName() name} and {@link + * SecretBase#getVersion() version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link SecretBase#getName()} name} or {@link SecretBase#getVersion() version} is empty + * string. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getSecretWithResponse(SecretBase secretBase) { - return withContext(context -> getSecretWithResponse(secretBase, context)); + return withContext(context -> getSecretWithResponse(secretBase, context)); } Mono> getSecretWithResponse(SecretBase secretBase, Context context) { Objects.requireNonNull(secretBase, "The Secret Base parameter cannot be null."); - return getSecretWithResponse(secretBase.name(), secretBase.version() == null ? "" : secretBase.version(), context); + return getSecretWithResponse(secretBase.getName(), secretBase.getVersion() == null ? "" : secretBase.getVersion(), + context); } /** - * Get the latest version of the specified secret from the key vault. The get operation is applicable to any secret stored in Azure Key Vault. + * Get the latest version of the specified secret from the key vault. The get operation is applicable to any secret + * stored in Azure Key Vault. * This operation requires the {@code secrets/get} permission. * *

Code Samples

@@ -282,9 +287,9 @@ Mono> getSecretWithResponse(SecretBase secretBase, Context cont * {@codesnippet com.azure.keyvault.secrets.secretclient.getSecret#string} * * @param name The name of the secret. + * @return A {@link Mono} containing the requested {@link Secret secret}. * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. * @throws HttpRequestException if {@code name} is empty string. - * @return A {@link Mono} containing the requested {@link Secret secret}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getSecret(String name) { @@ -292,22 +297,26 @@ public Mono getSecret(String name) { } /** - * Updates the attributes associated with the specified secret, but not the value of the specified secret in the key vault. The update - * operation changes specified attributes of an existing stored secret and attributes that are not specified in the request are left unchanged. - * The value of a secret itself cannot be changed. This operation requires the {@code secrets/set} permission. + * Updates the attributes associated with the specified secret, but not the value of the specified secret in the key + * vault. The update operation changes specified attributes of an existing stored secret and attributes that are not + * specified in the request are left unchanged. The value of a secret itself cannot be changed. This operation + * requires the {@code secrets/set} permission. * *

Code Samples

- *

Gets latest version of the secret, changes its notBefore time and then updates it in the Azure Key Vault. Subscribes to the call asynchronously and prints out the - * returned secret details when a response is received.

+ *

Gets latest version of the secret, changes its notBefore time and then updates it in the Azure Key Vault. + * Subscribes to the call asynchronously and prints out the returned secret details when a response is received.

* {@codesnippet com.azure.keyvault.secrets.secretclient.updateSecret#secretBase} * - *

The {@code secret} is required and its fields {@link SecretBase#name() name} and {@link SecretBase#version() version} cannot be null.

+ *

The {@code secret} is required and its fields {@link SecretBase#getName() name} and {@link SecretBase#getVersion() + * version} cannot be null.

* * @param secret The {@link SecretBase base secret} object with updated properties. - * @throws NullPointerException if {@code secret} is {@code null}. - * @throws ResourceNotFoundException when a secret with {@link SecretBase#name() name} and {@link SecretBase#version() version} doesn't exist in the key vault. - * @throws HttpRequestException if {@link SecretBase#name()} name} or {@link SecretBase#version() version} is empty string. * @return A {@link Mono} containing the {@link SecretBase updated secret}. + * @throws NullPointerException if {@code secret} is {@code null}. + * @throws ResourceNotFoundException when a secret with {@link SecretBase#getName() name} and {@link + * SecretBase#getVersion() version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link SecretBase#getName()} name} or {@link SecretBase#getVersion() version} is + * empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono updateSecret(SecretBase secret) { @@ -315,22 +324,27 @@ public Mono updateSecret(SecretBase secret) { } /** - * Updates the attributes associated with the specified secret, but not the value of the specified secret in the key vault. The update - * operation changes specified attributes of an existing stored secret and attributes that are not specified in the request are left unchanged. - * The value of a secret itself cannot be changed. This operation requires the {@code secrets/set} permission. + * Updates the attributes associated with the specified secret, but not the value of the specified secret in the key + * vault. The update operation changes specified attributes of an existing stored secret and attributes that are not + * specified in the request are left unchanged. The value of a secret itself cannot be changed. This operation + * requires the {@code secrets/set} permission. * *

Code Samples

- *

Gets latest version of the secret, changes its notBefore time and then updates it in the Azure Key Vault. Subscribes to the call asynchronously and prints out the - * returned secret details when a response is received.

+ *

Gets latest version of the secret, changes its notBefore time and then updates it in the Azure Key Vault. + * Subscribes to the call asynchronously and prints out the returned secret details when a response is received.

* {@codesnippet com.azure.keyvault.secrets.secretclient.updateSecretWithResponse#secretBase} * - *

The {@code secret} is required and its fields {@link SecretBase#name() name} and {@link SecretBase#version() version} cannot be null.

+ *

The {@code secret} is required and its fields {@link SecretBase#getName() name} and {@link SecretBase#getVersion() + * version} cannot be null.

* * @param secret The {@link SecretBase base secret} object with updated properties. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link + * SecretBase updated secret}. * @throws NullPointerException if {@code secret} is {@code null}. - * @throws ResourceNotFoundException when a secret with {@link SecretBase#name() name} and {@link SecretBase#version() version} doesn't exist in the key vault. - * @throws HttpRequestException if {@link SecretBase#name()} name} or {@link SecretBase#version() version} is empty string. - * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link SecretBase updated secret}. + * @throws ResourceNotFoundException when a secret with {@link SecretBase#getName() name} and {@link + * SecretBase#getVersion() version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link SecretBase#getName()} name} or {@link SecretBase#getVersion() version} is + * empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> updateSecretWithResponse(SecretBase secret) { @@ -340,30 +354,32 @@ public Mono> updateSecretWithResponse(SecretBase secret) { Mono> updateSecretWithResponse(SecretBase secret, Context context) { Objects.requireNonNull(secret, "The secret input parameter cannot be null."); SecretRequestParameters parameters = new SecretRequestParameters() - .tags(secret.tags()) - .contentType(secret.contentType()) - .secretAttributes(new SecretRequestAttributes(secret)); + .setTags(secret.getTags()) + .setContentType(secret.getContentType()) + .setSecretAttributes(new SecretRequestAttributes(secret)); - return service.updateSecret(endpoint, secret.name(), secret.version(), API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Updating secret - {}", secret.name())) - .doOnSuccess(response -> logger.info("Updated secret - {}", response.value().name())) - .doOnError(error -> logger.warning("Failed to update secret - {}", secret.name(), error)); + return service.updateSecret(endpoint, secret.getName(), secret.getVersion(), API_VERSION, ACCEPT_LANGUAGE, + parameters, CONTENT_TYPE_HEADER_VALUE, context) + .doOnRequest(ignored -> logger.info("Updating secret - {}", secret.getName())) + .doOnSuccess(response -> logger.info("Updated secret - {}", response.getValue().getName())) + .doOnError(error -> logger.warning("Failed to update secret - {}", secret.getName(), error)); } /** - * Deletes a secret from the key vault. If soft-delete is enabled on the key vault then the secret is placed in the deleted state - * and requires to be purged for permanent deletion else the secret is permanently deleted. The delete operation applies to any secret stored in Azure Key Vault but - * it cannot be applied to an individual version of a secret. This operation requires the {@code secrets/delete} permission. + * Deletes a secret from the key vault. If soft-delete is enabled on the key vault then the secret is placed in the + * deleted state and requires to be purged for permanent deletion else the secret is permanently deleted. The delete + * operation applies to any secret stored in Azure Key Vault but it cannot be applied to an individual version of a + * secret. This operation requires the {@code secrets/delete} permission. * *

Code Samples

- *

Deletes the secret in the Azure Key Vault. Subscribes to the call asynchronously and prints out the - * deleted secret details when a response is received.

+ *

Deletes the secret in the Azure Key Vault. Subscribes to the call asynchronously and prints out the deleted + * secret details when a response is received.

* {@codesnippet com.azure.keyvault.secrets.secretclient.deleteSecret#string} * * @param name The name of the secret to be deleted. + * @return A {@link Mono} containing the {@link DeletedSecret deleted secret}. * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a secret with {@code name} is empty string. - * @return A {@link Mono} containing the {@link DeletedSecret deleted secret}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono deleteSecret(String name) { @@ -371,9 +387,10 @@ public Mono deleteSecret(String name) { } /** - * Deletes a secret from the key vault. If soft-delete is enabled on the key vault then the secret is placed in the deleted state - * and requires to be purged for permanent deletion else the secret is permanently deleted. The delete operation applies to any secret stored in Azure Key Vault but - * it cannot be applied to an individual version of a secret. This operation requires the {@code secrets/delete} permission. + * Deletes a secret from the key vault. If soft-delete is enabled on the key vault then the secret is placed in the + * deleted state and requires to be purged for permanent deletion else the secret is permanently deleted. The delete + * operation applies to any secret stored in Azure Key Vault but it cannot be applied to an individual version of a + * secret. This operation requires the {@code secrets/delete} permission. * *

Code Samples

*

Deletes the secret in the Azure Key Vault. Subscribes to the call asynchronously and prints out the @@ -381,9 +398,10 @@ public Mono deleteSecret(String name) { * {@codesnippet com.azure.keyvault.secrets.secretclient.deleteSecretWithResponse#string} * * @param name The name of the secret to be deleted. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link + * DeletedSecret deleted secret}. * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a secret with {@code name} is empty string. - * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link DeletedSecret deleted secret}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> deleteSecretWithResponse(String name) { @@ -392,9 +410,9 @@ public Mono> deleteSecretWithResponse(String name) { Mono> deleteSecretWithResponse(String name, Context context) { return service.deleteSecret(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Deleting secret - {}", name)) - .doOnSuccess(response -> logger.info("Deleted secret - {}", response.value().name())) - .doOnError(error -> logger.warning("Failed to delete secret - {}", name, error)); + .doOnRequest(ignored -> logger.info("Deleting secret - {}", name)) + .doOnSuccess(response -> logger.info("Deleted secret - {}", response.getValue().getName())) + .doOnError(error -> logger.warning("Failed to delete secret - {}", name, error)); } /** @@ -403,16 +421,14 @@ Mono> deleteSecretWithResponse(String name, Context cont * *

Code Samples

*

Gets the deleted secret from the key vault enabled for soft-delete. Subscribes to the call - * asynchronously and prints out the - * deleted secret details when a response is received.

- *
+     * asynchronously and prints out the deleted secret details when a response is received.

+ * * //Assuming secret is deleted on a soft-delete enabled vault. * {@codesnippet com.azure.keyvault.secrets.secretclient.getDeletedSecret#string} * * @param name The name of the deleted secret. * @return A {@link Mono} containing the {@link DeletedSecret deleted secret}. - * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key - * vault. + * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a secret with {@code name} is empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -426,17 +442,15 @@ public Mono getDeletedSecret(String name) { * *

Code Samples

*

Gets the deleted secret from the key vault enabled for soft-delete. Subscribes to the call - * asynchronously and prints out the - * deleted secret details when a response is received.

- *
+     * asynchronously and prints out the deleted secret details when a response is received.

+ * * //Assuming secret is deleted on a soft-delete enabled vault. * {@codesnippet com.azure.keyvault.secrets.secretclient.getDeletedSecretWithResponse#string} * * @param name The name of the deleted secret. - * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} - * contains the {@link DeletedSecret deleted secret}. - * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key - * vault. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the + * {@link DeletedSecret deleted secret}. + * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a secret with {@code name} is empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -445,10 +459,11 @@ public Mono> getDeletedSecretWithResponse(String name) { } Mono> getDeletedSecretWithResponse(String name, Context context) { - return service.getDeletedSecret(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Retrieving deleted secret - {}", name)) - .doOnSuccess(response -> logger.info("Retrieved deleted secret - {}", response.value().name())) - .doOnError(error -> logger.warning("Failed to retrieve deleted secret - {}", name, error)); + return service.getDeletedSecret(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, + context) + .doOnRequest(ignored -> logger.info("Retrieving deleted secret - {}", name)) + .doOnSuccess(response -> logger.info("Retrieved deleted secret - {}", response.getValue().getName())) + .doOnError(error -> logger.warning("Failed to retrieve deleted secret - {}", name, error)); } /** @@ -458,16 +473,14 @@ Mono> getDeletedSecretWithResponse(String name, Context * *

Code Samples

*

Purges the deleted secret from the key vault enabled for soft-delete. Subscribes to the call - * asynchronously and prints out the - * status code from the server response when a response is received.

- *
+     * asynchronously and prints out the status code from the server response when a response is received.

+ * * //Assuming secret is deleted on a soft-delete enabled vault. * {@codesnippet com.azure.keyvault.secrets.secretclient.purgeDeletedSecret#string} * * @param name The name of the secret. * @return A {@link Mono} containing a {@link VoidResponse}. - * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key - * vault. + * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a secret with {@code name} is empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -476,27 +489,29 @@ public Mono purgeDeletedSecret(String name) { } Mono purgeDeletedSecret(String name, Context context) { - return service.purgeDeletedSecret(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Purging deleted secret - {}", name)) - .doOnSuccess(response -> logger.info("Purged deleted secret - {}", name)) - .doOnError(error -> logger.warning("Failed to purge deleted secret - {}", name, error)); + return service.purgeDeletedSecret(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, + context) + .doOnRequest(ignored -> logger.info("Purging deleted secret - {}", name)) + .doOnSuccess(response -> logger.info("Purged deleted secret - {}", name)) + .doOnError(error -> logger.warning("Failed to purge deleted secret - {}", name, error)); } /** - * Recovers the deleted secret in the key vault to its latest version and can only be performed on a soft-delete enabled vault. + * Recovers the deleted secret in the key vault to its latest version and can only be performed on a soft-delete + * enabled vault. * This operation requires the {@code secrets/recover} permission. * *

Code Samples

- *

Recovers the deleted secret from the key vault enabled for soft-delete. Subscribes to the call asynchronously and prints out the - * recovered secret details when a response is received.

- *
+     * 

Recovers the deleted secret from the key vault enabled for soft-delete. Subscribes to the call asynchronously + * and prints out the recovered secret details when a response is received.

+ * * //Assuming secret is deleted on a soft-delete enabled vault. * {@codesnippet com.azure.keyvault.secrets.secretclient.recoverDeletedSecret#string} * * @param name The name of the deleted secret to be recovered. + * @return A {@link Mono} containing the {@link Secret recovered secret}. * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a secret with {@code name} is empty string. - * @return A {@link Mono} containing the {@link Secret recovered secret}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono recoverDeletedSecret(String name) { @@ -504,20 +519,22 @@ public Mono recoverDeletedSecret(String name) { } /** - * Recovers the deleted secret in the key vault to its latest version and can only be performed on a soft-delete enabled vault. + * Recovers the deleted secret in the key vault to its latest version and can only be performed on a soft-delete + * enabled vault. * This operation requires the {@code secrets/recover} permission. * *

Code Samples

- *

Recovers the deleted secret from the key vault enabled for soft-delete. Subscribes to the call asynchronously and prints out the - * recovered secret details when a response is received.

- *
+     * 

Recovers the deleted secret from the key vault enabled for soft-delete. Subscribes to the call asynchronously + * and prints out the recovered secret details when a response is received.

+ * * //Assuming secret is deleted on a soft-delete enabled vault. * {@codesnippet com.azure.keyvault.secrets.secretclient.recoverDeletedSecretWithResponse#string} * * @param name The name of the deleted secret to be recovered. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the {@link + * Secret recovered secret}. * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a secret with {@code name} is empty string. - * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link Secret recovered secret}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> recoverDeletedSecretWithResponse(String name) { @@ -525,10 +542,11 @@ public Mono> recoverDeletedSecretWithResponse(String name) { } Mono> recoverDeletedSecretWithResponse(String name, Context context) { - return service.recoverDeletedSecret(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Recovering deleted secret - {}", name)) - .doOnSuccess(response -> logger.info("Recovered deleted secret - {}", response.value().name())) - .doOnError(error -> logger.warning("Failed to recover deleted secret - {}", name, error)); + return service.recoverDeletedSecret(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, + context) + .doOnRequest(ignored -> logger.info("Recovering deleted secret - {}", name)) + .doOnSuccess(response -> logger.info("Recovered deleted secret - {}", response.getValue().getName())) + .doOnError(error -> logger.warning("Failed to recover deleted secret - {}", name, error)); } /** @@ -537,15 +555,13 @@ Mono> recoverDeletedSecretWithResponse(String name, Context con * *

Code Samples

*

Backs up the secret from the key vault. Subscribes to the call asynchronously and prints out - * the - * length of the secret's backup byte array returned in the response.

- *
+     * the length of the secret's backup byte array returned in the response.

+ * * {@codesnippet com.azure.keyvault.secrets.secretclient.backupSecret#string} * * @param name The name of the secret. * @return A {@link Mono} containing the backed up secret blob. - * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key - * vault. + * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a secret with {@code name} is empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -559,15 +575,14 @@ public Mono backupSecret(String name) { * *

Code Samples

*

Backs up the secret from the key vault. Subscribes to the call asynchronously and prints out - * the - * length of the secret's backup byte array returned in the response.

+ * the length of the secret's backup byte array returned in the response.

* {@codesnippet com.azure.keyvault.secrets.secretclient.backupSecretWithResponse#string} * * @param name The name of the secret. - * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} - * contains the backed up secret blob. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} + * contains the backed up secret blob. * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key - * vault. + * vault. * @throws HttpRequestException when a secret with {@code name} is empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -577,11 +592,11 @@ public Mono> backupSecretWithResponse(String name) { Mono> backupSecretWithResponse(String name, Context context) { return service.backupSecret(endpoint, name, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Backing up secret - {}", name)) - .doOnSuccess(response -> logger.info("Backed up secret - {}", name)) - .doOnError(error -> logger.warning("Failed to back up secret - {}", name, error)) - .flatMap(base64URLResponse -> Mono.just(new SimpleResponse(base64URLResponse.request(), - base64URLResponse.statusCode(), base64URLResponse.headers(), base64URLResponse.value().value()))); + .doOnRequest(ignored -> logger.info("Backing up secret - {}", name)) + .doOnSuccess(response -> logger.info("Backed up secret - {}", name)) + .doOnError(error -> logger.warning("Failed to back up secret - {}", name, error)) + .flatMap(base64URLResponse -> Mono.just(new SimpleResponse(base64URLResponse.getRequest(), + base64URLResponse.getStatusCode(), base64URLResponse.getHeaders(), base64URLResponse.getValue().getValue()))); } /** @@ -590,9 +605,8 @@ Mono> backupSecretWithResponse(String name, Context context) { * *

Code Samples

*

Restores the secret in the key vault from its backup. Subscribes to the call asynchronously - * and prints out the - * restored secret details when a response is received.

- *
+     * and prints out the restored secret details when a response is received.

+ * * //Pass the Secret Backup Byte array to the restore operation. * {@codesnippet com.azure.keyvault.secrets.secretclient.restoreSecret#byte} * @@ -611,15 +625,14 @@ public Mono restoreSecret(byte[] backup) { * *

Code Samples

*

Restores the secret in the key vault from its backup. Subscribes to the call asynchronously - * and prints out the - * restored secret details when a response is received.

- *
+     * and prints out the restored secret details when a response is received.

+ * * //Pass the Secret Backup Byte array to the restore operation. * {@codesnippet com.azure.keyvault.secrets.secretclient.restoreSecretWithResponse#byte} * * @param backup The backup blob associated with the secret. - * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} - * contains the {@link Secret restored secret}. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} + * contains the {@link Secret restored secret}. * @throws ResourceModifiedException when {@code backup} blob is malformed. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -628,21 +641,25 @@ public Mono> restoreSecretWithResponse(byte[] backup) { } Mono> restoreSecretWithResponse(byte[] backup, Context context) { - SecretRestoreRequestParameters parameters = new SecretRestoreRequestParameters().secretBackup(backup); - return service.restoreSecret(endpoint, API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignored -> logger.info("Attempting to restore secret")) - .doOnSuccess(response -> logger.info("Restored secret - {}", response.value().name())) - .doOnError(error -> logger.warning("Failed to restore secret", error)); + SecretRestoreRequestParameters parameters = new SecretRestoreRequestParameters().setSecretBackup(backup); + return service.restoreSecret(endpoint, API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, + context) + .doOnRequest(ignored -> logger.info("Attempting to restore secret")) + .doOnSuccess(response -> logger.info("Restored secret - {}", response.getValue().getName())) + .doOnError(error -> logger.warning("Failed to restore secret", error)); } /** - * List secrets in the key vault. The list Secrets operation is applicable to the entire vault. The individual secret response - * in the flux is represented by {@link SecretBase} as only the base secret identifier and its attributes are - * provided in the response. The secret values and individual secret versions are not listed in the response. This operation requires the {@code secrets/list} permission. + * List secrets in the key vault. The list Secrets operation is applicable to the entire vault. The individual + * secret response in the flux is represented by {@link SecretBase} as only the base secret identifier and its + * attributes are provided in the response. The secret values and individual secret versions are not listed in the + * response. This operation requires the {@code secrets/list} permission. * *

Code Samples

- *

It is possible to get full Secrets with values from this information. Convert the {@link Flux} containing {@link SecretBase base secret} to - * {@link Flux} containing {@link Secret secret} using {@link SecretAsyncClient#getSecret(SecretBase baseSecret)} within {@link Flux#flatMap(Function)}.

+ *

It is possible to get full Secrets with values from this information. Convert the {@link Flux} containing + * {@link SecretBase base secret} to + * {@link Flux} containing {@link Secret secret} using {@link SecretAsyncClient#getSecret(SecretBase baseSecret)} + * within {@link Flux#flatMap(Function)}.

* {@codesnippet com.azure.keyvault.secrets.secretclient.listSecrets} * * @return A {@link PagedFlux} containing {@link SecretBase secret} of all the secrets in the vault. @@ -664,29 +681,34 @@ PagedFlux listSecrets(Context context) { * Gets attributes of all the secrets given by the {@code nextPageLink} that was retrieved from a call to * {@link SecretAsyncClient#listSecrets()}. * - * @param continuationToken The {@link PagedResponse#nextLink()} from a previous, successful call to one of the list operations. + * @param continuationToken The {@link PagedResponse#nextLink()} from a previous, successful call to one of the + * list operations. * @return A {@link Mono} of {@link PagedResponse} from the next page of results. */ private Mono> listSecretsNextPage(String continuationToken, Context context) { return service.getSecrets(endpoint, continuationToken, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) .doOnRequest(ignoredValue -> logger.info("Retrieving the next secrets page - Page {}", continuationToken)) .doOnSuccess(response -> logger.info("Retrieved the next secrets page - Page {}", continuationToken)) - .doOnError(error -> logger.warning("Failed to retrieve the next secrets page - Page {}", continuationToken, error)); + .doOnError(error -> logger.warning("Failed to retrieve the next secrets page - Page {}", + continuationToken, error)); } /* - * Calls the service and retrieve first page result. It makes one call and retrieve {@code DEFAULT_MAX_PAGE_RESULTS} values. + * Calls the service and retrieve first page result. It makes one call and retrieve {@code + * DEFAULT_MAX_PAGE_RESULTS} values. */ private Mono> listSecretsFirstPage(Context context) { - return service.getSecrets(endpoint, DEFAULT_MAX_PAGE_RESULTS, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + return service.getSecrets(endpoint, DEFAULT_MAX_PAGE_RESULTS, API_VERSION, ACCEPT_LANGUAGE, + CONTENT_TYPE_HEADER_VALUE, context) .doOnRequest(ignored -> logger.info("Listing secrets")) .doOnSuccess(response -> logger.info("Listed secrets")) .doOnError(error -> logger.warning("Failed to list secrets", error)); } /** - * Lists {@link DeletedSecret deleted secrets} of the key vault. The get deleted secrets operation returns the secrets that - * have been deleted for a vault enabled for soft-delete. This operation requires the {@code secrets/list} permission. + * Lists {@link DeletedSecret deleted secrets} of the key vault. The get deleted secrets operation returns the + * secrets that have been deleted for a vault enabled for soft-delete. This operation requires the + * {@code secrets/list} permission. * *

Code Samples

*

Lists the deleted secrets in the key vault. Subscribes to the call asynchronously and prints out the @@ -713,40 +735,50 @@ PagedFlux listDeletedSecrets(Context context) { * Gets attributes of all the secrets given by the {@code nextPageLink} that was retrieved from a call to * {@link SecretAsyncClient#listDeletedSecrets()}. * - * @param continuationToken The {@link PagedResponse#nextLink()} from a previous, successful call to one of the list operations. - * @return A {@link Mono} of {@link PagedResponse} from the next page of results. + * @param continuationToken The {@link Page#getNextLink()} from a previous, successful call to one of the + * list operations. + * @return A {@link Mono} of {@link PagedResponse} that contains {@link DeletedSecret} from the next page of + * results. */ private Mono> listDeletedSecretsNextPage(String continuationToken, Context context) { - return service.getDeletedSecrets(endpoint, continuationToken, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignoredValue -> logger.info("Retrieving the next deleted secrets page - Page {}", continuationToken)) - .doOnSuccess(response -> logger.info("Retrieved the next deleted secrets page - Page {}", continuationToken)) - .doOnError(error -> logger.warning("Failed to retrieve the next deleted secrets page - Page {}", continuationToken, error)); + return service.getDeletedSecrets(endpoint, continuationToken, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, + context) + .doOnRequest(ignoredValue -> logger.info("Retrieving the next deleted secrets page - Page {}", + continuationToken)) + .doOnSuccess(response -> logger.info("Retrieved the next deleted secrets page - Page {}", + continuationToken)) + .doOnError(error -> logger.warning("Failed to retrieve the next deleted secrets page - Page {}", + continuationToken, error)); } /* - * Calls the service and retrieve first page result. It makes one call and retrieve {@code DEFAULT_MAX_PAGE_RESULTS} values. + * Calls the service and retrieve first page result. It makes one call and retrieve {@code + * DEFAULT_MAX_PAGE_RESULTS} values. */ private Mono> listDeletedSecretsFirstPage(Context context) { - return service.getDeletedSecrets(endpoint, DEFAULT_MAX_PAGE_RESULTS, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + return service.getDeletedSecrets(endpoint, DEFAULT_MAX_PAGE_RESULTS, API_VERSION, ACCEPT_LANGUAGE, + CONTENT_TYPE_HEADER_VALUE, context) .doOnRequest(ignored -> logger.info("Listing deleted secrets")) .doOnSuccess(response -> logger.info("Listed deleted secrets")) .doOnError(error -> logger.warning("Failed to list deleted secrets", error)); } /** - * List all versions of the specified secret. The individual secret response in the flux is represented by {@link SecretBase} - * as only the base secret identifier and its attributes are provided in the response. The secret values are - * not provided in the response. This operation requires the {@code secrets/list} permission. + * List all versions of the specified secret. The individual secret response in the flux is represented by {@link + * SecretBase} as only the base secret identifier and its attributes are provided in the response. The secret values + * are not provided in the response. This operation requires the {@code secrets/list} permission. * - *

It is possible to get the Secret with value of all the versions from this information. Convert the {@link Flux} - * containing {@link SecretBase base secret} to {@link Flux} containing {@link Secret secret} using + *

It is possible to get the Secret with value of all the versions from this information. Convert the {@link + * Flux} containing {@link SecretBase base secret} to {@link Flux} containing {@link Secret secret} using * {@link SecretAsyncClient#getSecret(SecretBase baseSecret)} within {@link Flux#flatMap(Function)}.

+ * * {@codesnippet com.azure.keyvault.secrets.secretclient.listSecretVersions#string} * * @param name The name of the secret. + * @return A {@link PagedFlux} containing {@link SecretBase secret} of all the versions of the specified secret in + * the vault. Flux is empty if secret with {@code name} does not exist in key vault * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a secret with {@code name} is empty string. - * @return A {@link PagedFlux} containing {@link SecretBase secret} of all the versions of the specified secret in the vault. Flux is empty if secret with {@code name} does not exist in key vault */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listSecretVersions(String name) { @@ -765,22 +797,28 @@ PagedFlux listSecretVersions(String name, Context context) { * Gets attributes of all the secrets versions given by the {@code nextPageLink} that was retrieved from a call to * {@link SecretAsyncClient#listSecretVersions()}. * - * @param continuationToken The {@link PagedResponse#nextLink()} from a previous, successful call to one of the list operations. + * @param continuationToken The {@link PagedResponse#nextLink()} from a previous, successful call to one of the + * list operations. * * @return A {@link Mono} of {@link PagedResponse} from the next page of results. */ private Mono> listSecretVersionsNextPage(String continuationToken, Context context) { return service.getSecrets(endpoint, continuationToken, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) - .doOnRequest(ignoredValue -> logger.info("Retrieving the next secrets versions page - Page {}", continuationToken)) - .doOnSuccess(response -> logger.info("Retrieved the next secrets versions page - Page {}", continuationToken)) - .doOnError(error -> logger.warning("Failed to retrieve the next secrets versions page - Page {}", continuationToken, error)); + .doOnRequest(ignoredValue -> logger.info("Retrieving the next secrets versions page - Page {}", + continuationToken)) + .doOnSuccess(response -> logger.info("Retrieved the next secrets versions page - Page {}", + continuationToken)) + .doOnError(error -> logger.warning("Failed to retrieve the next secrets versions page - Page {}", + continuationToken, error)); } /* - * Calls the service and retrieve first page result. It makes one call and retrieve {@code DEFAULT_MAX_PAGE_RESULTS} values. + * Calls the service and retrieve first page result. It makes one call and retrieve {@code + * DEFAULT_MAX_PAGE_RESULTS} values. */ private Mono> listSecretVersionsFirstPage(String name, Context context) { - return service.getSecretVersions(endpoint, name, DEFAULT_MAX_PAGE_RESULTS, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) + return service.getSecretVersions(endpoint, name, DEFAULT_MAX_PAGE_RESULTS, API_VERSION, ACCEPT_LANGUAGE, + CONTENT_TYPE_HEADER_VALUE, context) .doOnRequest(ignored -> logger.info("Listing secret versions - {}", name)) .doOnSuccess(response -> logger.info("Listed secret versions - {}", name)) .doOnError(error -> logger.warning(String.format("Failed to list secret versions - {}", name), error)); diff --git a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretBackup.java b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretBackup.java index 6216832d1c8f..2edbcf88b1d5 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretBackup.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretBackup.java @@ -18,7 +18,7 @@ class SecretBackup { * * @return the secret backup value */ - public byte[] value() { + public byte[] getValue() { if (this.value == null) { return new byte[0]; } 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 86c25a17ba65..8a5600e3d5f2 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 @@ -19,8 +19,9 @@ /** * The SecretClient provides synchronous methods to manage {@link Secret secrets} in the Azure Key Vault. The client - * supports creating, retrieving, updating, deleting, purging, backing up, restoring and listing the {@link Secret secrets}. The client - * also supports listing {@link DeletedSecret deleted secrets} for a soft-delete enabled Azure Key Vault. + * supports creating, retrieving, updating, deleting, purging, backing up, restoring and listing the {@link Secret + * secrets}. The client also supports listing {@link DeletedSecret deleted secrets} for a soft-delete enabled Azure Key + * Vault. * *

Samples to construct the sync client

* {@codesnippet com.azure.security.keyvault.secretclient.sync.construct} @@ -43,64 +44,72 @@ public final class SecretClient { } /** - * The set operation adds a secret to the Azure Key Vault. If the named secret already exists, a new version of the secret - * is created in the key vault. This operation requires the {@code secrets/set} permission. + * The set operation adds a secret to the Azure Key Vault. If the named secret already exists, a new version of the + * secret is created in the key vault. This operation requires the {@code secrets/set} permission. * - *

The {@link Secret} is required. The {@link Secret#expires() expires}, {@link Secret#contentType() contentType} and - * {@link Secret#notBefore() notBefore} values in {@code secret} are optional. The {@link Secret#enabled() enabled} field is - * set to true by key vault, if not specified.

+ *

The {@link Secret} is required. The {@link Secret#getExpires() expires}, {@link Secret#getContentType() contentType} + * and + * {@link Secret#getNotBefore() notBefore} values in {@code secret} are optional. The {@link Secret#isEnabled() enabled} + * field is set to true by key vault, if not specified.

* *

Code Samples

* {@codesnippet com.azure.security.keyvault.secretclient.setSecret#secret} * - * @param secret The Secret object containing information about the secret and its properties. The properties secret.name and secret.value must be non null. + * @param secret The Secret object containing information about the secret and its properties. The properties + * secret.name and secret.value must be non null. + * @return The {@link Secret created secret}. * @throws NullPointerException if {@code secret} is {@code null}. * @throws ResourceModifiedException if {@code secret} is malformed. - * @throws HttpRequestException if {@link Secret#name() name} or {@link Secret#value() value} is empty string. - * @return The {@link Secret created secret}. + * @throws HttpRequestException if {@link Secret#getName() name} or {@link Secret#getValue() value} is empty string. */ public Secret setSecret(Secret secret) { - return setSecretWithResponse(secret, Context.NONE).value(); + return setSecretWithResponse(secret, Context.NONE).getValue(); } /** - * The set operation adds a secret to the Azure Key Vault. If the named secret already exists, Azure Key Vault creates a new version of that secret. + * The set operation adds a secret to the Azure Key Vault. If the named secret already exists, Azure Key Vault + * creates a new version of that secret. * This operation requires the {@code secrets/set} permission. * *

Code Samples

- *

Creates a new secret in the key vault. Prints out the details of the newly created secret returned in the response.

+ *

Creates a new secret in the key vault. Prints out the details of the newly created secret returned in the + * response.

* {@codesnippet com.azure.security.keyvault.secretclient.setSecret#string-string} * * @param name The name of the secret. It is required and cannot be null. * @param value The value of the secret. It is required and cannot be null. + * @return The {@link Secret created secret}. * @throws ResourceModifiedException if invalid {@code name} or {@code value} is specified. * @throws HttpRequestException if {@code name} or {@code value} is empty string. - * @return The {@link Secret created secret}. */ public Secret setSecret(String name, String value) { - return client.setSecretWithResponse(name, value, Context.NONE).block().value(); + return client.setSecretWithResponse(name, value, Context.NONE).block().getValue(); } /** - * The set operation adds a secret to the Azure Key Vault. If the named secret already exists, Azure Key Vault creates a new version of that secret. + * The set operation adds a secret to the Azure Key Vault. If the named secret already exists, Azure Key Vault + * creates a new version of that secret. * This operation requires the {@code secrets/set} permission. * *

Code Samples

- *

Creates a new secret in the key vault. Prints out the details of the newly created secret returned in the response.

+ *

Creates a new secret in the key vault. Prints out the details of the newly created secret returned in the + * response.

* {@codesnippet com.azure.security.keyvault.secretclient.setSecretWithResponse#secret-Context} * - * @param secret The Secret object containing information about the secret and its properties. The properties secret.name and secret.value must be non null. + * @param secret The Secret object containing information about the secret and its properties. The properties + * secret.name and secret.value must be non null. * @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 {@link Secret created secret}. * @throws ResourceModifiedException if invalid {@code name} or {@code value} is specified. * @throws HttpRequestException if {@code name} or {@code value} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the {@link Secret created secret}. */ public Response setSecretWithResponse(Secret secret, Context context) { return client.setSecretWithResponse(secret, context).block(); } /** - * Get the latest version of the specified secret from the key vault. The get operation is applicable to any secret stored in Azure Key Vault. + * Get the latest version of the specified secret from the key vault. The get operation is applicable to any secret + * stored in Azure Key Vault. * This operation requires the {@code secrets/get} permission. * *

Code Samples

@@ -108,56 +117,65 @@ public Response setSecretWithResponse(Secret secret, Context context) { * {@codesnippet com.azure.security.keyvault.secretclient.getSecret#string-string} * * @param name The name of the secret, cannot be null. - * @param version The version of the secret to retrieve. If this is an empty String or null, this call is equivalent to calling {@link #getSecret(String)}, with the latest version being retrieved. - * @throws ResourceNotFoundException when a secret with {@code name} and {@code version} doesn't exist in the key vault. - * @throws HttpRequestException if {@code name} or {@code version} is empty string. + * @param version The version of the secret to retrieve. If this is an empty String or null, this call is + * equivalent to calling {@link #getSecret(String)}, with the latest version being retrieved. * @return The requested {@link Secret secret}. + * @throws ResourceNotFoundException when a secret with {@code name} and {@code version} doesn't exist in the + * key vault. + * @throws HttpRequestException if {@code name} or {@code version} is empty string. */ public Secret getSecret(String name, String version) { - return getSecretWithResponse(name, version, Context.NONE).value(); + return getSecretWithResponse(name, version, Context.NONE).getValue(); } /** - * Get the secret which represents {@link SecretBase secretBase} from the key vault. The get operation is applicable to any - * secret stored in Azure Key Vault. This operation requires the {@code secrets/get} permission. + * Get the secret which represents {@link SecretBase secretBase} from the key vault. The get operation is applicable + * to any secret stored in Azure Key Vault. This operation requires the {@code secrets/get} permission. * - *

The list operations {@link SecretClient#listSecrets()} and {@link SecretClient#listSecretVersions(String)} return - * the {@link List} containing {@link SecretBase base secret} as output excluding the include the value of the secret. + *

The list operations {@link SecretClient#listSecrets()} and {@link SecretClient#listSecretVersions(String)} + * return the {@link List} containing {@link SecretBase base secret} as output excluding the include the value of + * the secret. * This operation can then be used to get the full secret with its value from {@code secretBase}.

*

Code Samples

* {@codesnippet com.azure.security.keyvault.secretclient.getSecretWithResponse#secretBase} * * @param secretBase The {@link SecretBase base secret} holding attributes of the secret being requested. * @param context Additional context that is passed through the Http pipeline during the service call. - * @throws ResourceNotFoundException when a secret with {@link SecretBase#name() name} and {@link SecretBase#version() version} doesn't exist in the key vault. - * @throws HttpRequestException if {@link SecretBase#name() name} or {@link SecretBase#version() version} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the requested {@link Secret secret}. + * @return A {@link Response} whose {@link Response#getValue() value} contains the requested {@link Secret secret}. + * @throws ResourceNotFoundException when a secret with {@link SecretBase#getName() name} and {@link + * SecretBase#getVersion() version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link SecretBase#getName() name} or {@link SecretBase#getVersion() version} is empty + * string. */ public Response getSecretWithResponse(SecretBase secretBase, Context context) { return client.getSecretWithResponse(secretBase, context).block(); } /** - * Get the secret which represents {@link SecretBase secretBase} from the key vault. The get operation is applicable to any - * secret stored in Azure Key Vault. This operation requires the {@code secrets/get} permission. + * Get the secret which represents {@link SecretBase secretBase} from the key vault. The get operation is applicable + * to any secret stored in Azure Key Vault. This operation requires the {@code secrets/get} permission. * - *

The list operations {@link SecretClient#listSecrets()} and {@link SecretClient#listSecretVersions(String)} return - * the {@link List} containing {@link SecretBase base secret} as output excluding the include the value of the secret. + *

The list operations {@link SecretClient#listSecrets()} and {@link SecretClient#listSecretVersions(String)} + * return the {@link List} containing {@link SecretBase base secret} as output excluding the include the value of + * the secret. * This operation can then be used to get the full secret with its value from {@code secretBase}.

*

Code Samples

* {@codesnippet com.azure.security.keyvault.secretclient.getSecret#secretBase} * * @param secretBase The {@link SecretBase base secret} holding attributes of the secret being requested. - * @throws ResourceNotFoundException when a secret with {@link SecretBase#name() name} and {@link SecretBase#version() version} doesn't exist in the key vault. - * @throws HttpRequestException if {@link SecretBase#name() name} or {@link SecretBase#version() version} is empty string. * @return The requested {@link Secret secret}. + * @throws ResourceNotFoundException when a secret with {@link SecretBase#getName() name} and {@link + * SecretBase#getVersion() version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link SecretBase#getName() name} or {@link SecretBase#getVersion() version} is + * empty string. */ public Secret getSecret(SecretBase secretBase) { - return getSecretWithResponse(secretBase, Context.NONE).value(); + return getSecretWithResponse(secretBase, Context.NONE).getValue(); } /** - * Get the latest version of the specified secret from the key vault. The get operation is applicable to any secret stored in Azure Key Vault. + * Get the latest version of the specified secret from the key vault. The get operation is applicable to any secret + * stored in Azure Key Vault. * This operation requires the {@code secrets/get} permission. * *

Code Samples

@@ -165,34 +183,30 @@ public Secret getSecret(SecretBase secretBase) { * {@codesnippet com.azure.security.keyvault.secretclient.getSecret#string} * * @param name The name of the secret. + * @return The requested {@link Secret}. * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. * @throws HttpRequestException if {@code name} is empty string. - * @return The requested {@link Secret}. */ public Secret getSecret(String name) { - return getSecretWithResponse(name, "", Context.NONE).value(); + return getSecretWithResponse(name, "", Context.NONE).getValue(); } /** * Get the specified secret with specified version from the key vault. The get operation is - * applicable to any secret stored in Azure Key Vault. This operation requires the {@code - * secrets/get} permission. + * applicable to any secret stored in Azure Key Vault. This operation requires the {@code secrets/get} permission. * *

Code Samples

- *

Gets a specific version of the secret in the key vault. Subscribes to the call - * asynchronously and prints out the - * returned secret details when a response is received.

+ *

Gets a specific version of the secret in the key vault. Subscribes to the call asynchronously and prints out + * the returned secret details when a response is received.

* {@codesnippet com.azure.security.keyvault.secretclient.getSecretWithResponse#string-string-Context} * * @param name The name of the secret, cannot be null - * @param version The version of the secret to retrieve. If this is an empty String or null, this - * call is equivalent to calling {@link #getSecret(String)}, with the latest version being - * retrieved. + * @param version The version of the secret to retrieve. If this is an empty String or null, this call is equivalent + * to calling {@link #getSecret(String)}, with the latest version being retrieved. * @param context Additional context that is passed through the Http pipeline during the service call. - * - * @return A {@link Response} whose {@link Response#value() value} contains the requested {@link Secret}. - * @throws ResourceNotFoundException when a secret with {@code name} and {@code version} doesn't - * exist in the key vault. + * @return A {@link Response} whose {@link Response#getValue() value} contains the requested {@link Secret}. + * @throws ResourceNotFoundException when a secret with {@code name} and {@code version} doesn't exist in the key + * vault. * @throws HttpRequestException if {@code name} name} or {@code version} is empty string. */ public Response getSecretWithResponse(String name, String version, Context context) { @@ -200,80 +214,96 @@ public Response getSecretWithResponse(String name, String version, Conte } /** - * Updates the attributes associated with the specified secret, but not the value of the specified secret in the key vault. The update - * operation changes specified attributes of an existing stored secret and attributes that are not specified in the request are left unchanged. - * The value of a secret itself cannot be changed. This operation requires the {@code secrets/set} permission. + * Updates the attributes associated with the specified secret, but not the value of the specified secret in the key + * vault. The update operation changes specified attributes of an existing stored secret and attributes that are not + * specified in the request are left unchanged. The value of a secret itself cannot be changed. This operation + * requires the {@code secrets/set} permission. * - *

The {@code secret} is required and its fields {@link SecretBase#name() name} and {@link SecretBase#version() version} cannot be null.

+ *

The {@code secret} is required and its fields {@link SecretBase#getName() name} and {@link SecretBase#getVersion() + * version} cannot be null.

* *

Code Samples

- *

Gets the latest version of the secret, changes its expiry time and the updates the secret in the key vault.

+ *

Gets the latest version of the secret, changes its expiry time and the updates the secret in the key vault. + *

* {@codesnippet com.azure.security.keyvault.secretclient.updateSecretWithResponse#secretBase-Context} * * @param secret The {@link SecretBase base secret} object with updated properties. * @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 {@link SecretBase updated secret}. * @throws NullPointerException if {@code secret} is {@code null}. - * @throws ResourceNotFoundException when a secret with {@link SecretBase#name() name} and {@link SecretBase#version() version} doesn't exist in the key vault. - * @throws HttpRequestException if {@link SecretBase#name() name} or {@link SecretBase#version() version} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the {@link SecretBase updated secret}. + * @throws ResourceNotFoundException when a secret with {@link SecretBase#getName() name} and {@link + * SecretBase#getVersion() version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link SecretBase#getName() name} or {@link SecretBase#getVersion() version} is + * empty string. */ public Response updateSecretWithResponse(SecretBase secret, Context context) { return client.updateSecretWithResponse(secret, context).block(); } /** - * Updates the attributes associated with the specified secret, but not the value of the specified secret in the key vault. The update - * operation changes specified attributes of an existing stored secret and attributes that are not specified in the request are left unchanged. - * The value of a secret itself cannot be changed. This operation requires the {@code secrets/set} permission. + * Updates the attributes associated with the specified secret, but not the value of the specified secret in the key + * vault. The update operation changes specified attributes of an existing stored secret and attributes that are not + * specified in the request are left unchanged. The value of a secret itself cannot be changed. This operation + * requires the {@code secrets/set} permission. * - *

The {@code secret} is required and its fields {@link SecretBase#name() name} and {@link SecretBase#version() version} cannot be null.

+ *

The {@code secret} is required and its fields {@link SecretBase#getName() name} and {@link SecretBase#getVersion() + * version} cannot be null.

* *

Code Samples

- *

Gets the latest version of the secret, changes its expiry time and the updates the secret in the key vault.

+ *

Gets the latest version of the secret, changes its expiry time and the updates the secret in the key + * vault.

* {@codesnippet com.azure.security.keyvault.secretclient.updateSecret#secretBase} * * @param secret The {@link SecretBase base secret} object with updated properties. - * @throws NullPointerException if {@code secret} is {@code null}. - * @throws ResourceNotFoundException when a secret with {@link SecretBase#name() name} and {@link SecretBase#version() version} doesn't exist in the key vault. - * @throws HttpRequestException if {@link SecretBase#name() name} or {@link SecretBase#version() version} is empty string. * @return The {@link SecretBase updated secret}. + * @throws NullPointerException if {@code secret} is {@code null}. + * @throws ResourceNotFoundException when a secret with {@link SecretBase#getName() name} and {@link + * SecretBase#getVersion() version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link SecretBase#getName() name} or {@link SecretBase#getVersion() version} is + * empty string. */ public SecretBase updateSecret(SecretBase secret) { - return updateSecretWithResponse(secret, Context.NONE).value(); + return updateSecretWithResponse(secret, Context.NONE).getValue(); } /** - * Deletes a secret from the key vault. If soft-delete is enabled on the key vault then the secret is placed in the deleted state - * and requires to be purged for permanent deletion else the secret is permanently deleted. The delete operation applies to any secret stored in Azure Key Vault but - * it cannot be applied to an individual version of a secret. This operation requires the {@code secrets/delete} permission. + * Deletes a secret from the key vault. If soft-delete is enabled on the key vault then the secret is placed in the + * deleted state and requires to be purged for permanent deletion else the secret is permanently deleted. The delete + * operation applies to any secret stored in Azure Key Vault but it cannot be applied to an individual version of a + * secret. This operation requires the {@code secrets/delete} permission. * *

Code Samples

- *

Deletes the secret from the keyvault. Prints out the recovery id of the deleted secret returned in the response.

+ *

Deletes the secret from the keyvault. Prints out the recovery id of the deleted secret returned in the + * response.

* {@codesnippet com.azure.security.keyvault.secretclient.deleteSecret#string} * * @param name The name of the secret to be deleted. + * @return A {@link Response} whose {@link Response#getValue() value} contains the {@link DeletedSecret deleted + * secret}. * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a secret with {@code name} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the {@link DeletedSecret deleted secret}. */ public DeletedSecret deleteSecret(String name) { - return deleteSecretWithResponse(name, Context.NONE).value(); + return deleteSecretWithResponse(name, Context.NONE).getValue(); } /** - * Deletes a secret from the key vault. If soft-delete is enabled on the key vault then the secret is placed in the deleted state - * and requires to be purged for permanent deletion else the secret is permanently deleted. The delete operation applies to any secret stored in Azure Key Vault but - * it cannot be applied to an individual version of a secret. This operation requires the {@code secrets/delete} permission. + * Deletes a secret from the key vault. If soft-delete is enabled on the key vault then the secret is placed in the + * deleted state and requires to be purged for permanent deletion else the secret is permanently deleted. The delete + * operation applies to any secret stored in Azure Key Vault but it cannot be applied to an individual version of a + * secret. This operation requires the {@code secrets/delete} permission. * *

Code Samples

- *

Deletes the secret from the keyvault. Prints out the recovery id of the deleted secret returned in the response.

+ *

Deletes the secret from the keyvault. Prints out the recovery id of the deleted secret returned in the + * response.

* {@codesnippet com.azure.security.keyvault.secretclient.deleteSecretWithResponse#string-Context} * * @param name The name of the secret to be deleted. * @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 {@link DeletedSecret deleted + * secret}. * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a secret with {@code name} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the {@link DeletedSecret deleted secret}. */ public Response deleteSecretWithResponse(String name, Context context) { return client.deleteSecretWithResponse(name, context).block(); @@ -284,18 +314,18 @@ public Response deleteSecretWithResponse(String name, Context con * This operation requires the {@code secrets/list} permission. * *

Code Samples

- *

Gets the deleted secret from the key vault enabled for soft-delete. Prints out the details of the deleted secret - * returned in the response.

+ *

Gets the deleted secret from the key vault enabled for soft-delete. Prints out the details of the deleted + * secret returned in the response.

* //Assuming secret is deleted on a soft-delete enabled key vault. * {@codesnippet com.azure.security.keyvault.secretclient.getDeletedSecret#string} * * @param name The name of the deleted secret. + * @return The {@link DeletedSecret deleted secret}. * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a secret with {@code name} is empty string. - * @return The {@link DeletedSecret deleted secret}. */ public DeletedSecret getDeletedSecret(String name) { - return getDeletedSecretWithResponse(name, Context.NONE).value(); + return getDeletedSecretWithResponse(name, Context.NONE).getValue(); } /** @@ -303,16 +333,17 @@ public DeletedSecret getDeletedSecret(String name) { * This operation requires the {@code secrets/list} permission. * *

Code Samples

- *

Gets the deleted secret from the key vault enabled for soft-delete. Prints out the details of the deleted secret - * returned in the response.

+ *

Gets the deleted secret from the key vault enabled for soft-delete. Prints out the details of the deleted + * secret returned in the response.

* //Assuming secret is deleted on a soft-delete enabled key vault. * {@codesnippet com.azure.security.keyvault.secretclient.getDeletedSecretWithResponse#string-Context} * * @param name The name of the deleted secret. * @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 {@link DeletedSecret deleted + * secret}. * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a secret with {@code name} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the {@link DeletedSecret deleted secret}. */ public Response getDeletedSecretWithResponse(String name, Context context) { return client.getDeletedSecretWithResponse(name, context).block(); @@ -320,17 +351,19 @@ public Response getDeletedSecretWithResponse(String name, Context /** * The purge deleted secret operation removes the secret permanently, without the possibility of recovery. - * This operation can only be enabled on a soft-delete enabled vault. This operation requires the {@code secrets/purge} permission. + * This operation can only be enabled on a soft-delete enabled vault. This operation requires the + * {@code secrets/purge} permission. * *

Code Samples

- *

Purges the deleted secret from the key vault enabled for soft-delete. Prints out the status code from the server response.

+ *

Purges the deleted secret from the key vault enabled for soft-delete. Prints out the status code from the + * server response.

* //Assuming secret is deleted on a soft-delete enabled key vault. * {@codesnippet com.azure.security.keyvault.secretclient.purgeDeletedSecret#string} * * @param name The name of the secret. + * @return A {@link VoidResponse}. * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a secret with {@code name} is empty string. - * @return A {@link VoidResponse}. */ public VoidResponse purgeDeletedSecret(String name) { return purgeDeletedSecret(name, Context.NONE); @@ -338,92 +371,100 @@ public VoidResponse purgeDeletedSecret(String name) { /** * The purge deleted secret operation removes the secret permanently, without the possibility of recovery. - * This operation can only be enabled on a soft-delete enabled vault. This operation requires the {@code secrets/purge} permission. + * This operation can only be enabled on a soft-delete enabled vault. This operation requires the + * {@code secrets/purge} permission. * *

Code Samples

- *

Purges the deleted secret from the key vault enabled for soft-delete. Prints out the status code from the server response.

+ *

Purges the deleted secret from the key vault enabled for soft-delete. Prints out the status code from the + * server response.

* //Assuming secret is deleted on a soft-delete enabled key vault. * {@codesnippet com.azure.security.keyvault.secretclient.purgeDeletedSecret#string-Context} * * @param name The name of the secret. * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A {@link VoidResponse}. * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a secret with {@code name} is empty string. - * @return A {@link VoidResponse}. */ public VoidResponse purgeDeletedSecret(String name, Context context) { return client.purgeDeletedSecret(name, context).block(); } /** - * Recovers the deleted secret in the key vault to its latest version and can only be performed on a soft-delete enabled vault. + * Recovers the deleted secret in the key vault to its latest version and can only be performed on a soft-delete + * enabled vault. * This operation requires the {@code secrets/recover} permission. * *

Code Samples

- *

Recovers the deleted secret from the key vault enabled for soft-delete. Prints out the details of the recovered secret - * returned in the response.

+ *

Recovers the deleted secret from the key vault enabled for soft-delete. Prints out the details of the + * recovered secret returned in the response.

* //Assuming secret is deleted on a soft-delete enabled key vault. * {@codesnippet com.azure.security.keyvault.secretclient.recoverDeletedSecret#string} * * @param name The name of the deleted secret to be recovered. + * @return The {@link Secret recovered secret}. * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a secret with {@code name} is empty string. - * @return The {@link Secret recovered secret}. */ public Secret recoverDeletedSecret(String name) { - return recoverDeletedSecretWithResponse(name, Context.NONE).value(); + return recoverDeletedSecretWithResponse(name, Context.NONE).getValue(); } /** - * Recovers the deleted secret in the key vault to its latest version and can only be performed on a soft-delete enabled vault. + * Recovers the deleted secret in the key vault to its latest version and can only be performed on a soft-delete + * enabled vault. * This operation requires the {@code secrets/recover} permission. * *

Code Samples

- *

Recovers the deleted secret from the key vault enabled for soft-delete. Prints out the details of the recovered secret - * returned in the response.

+ *

Recovers the deleted secret from the key vault enabled for soft-delete. Prints out the details of the + * recovered secret returned in the response.

* //Assuming secret is deleted on a soft-delete enabled key vault. * {@codesnippet com.azure.security.keyvault.secretclient.recoverDeletedSecretWithResponse#string-Context} * * @param name The name of the deleted secret to be recovered. * @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 {@link Secret recovered secret}. * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a secret with {@code name} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the {@link Secret recovered secret}. */ public Response recoverDeletedSecretWithResponse(String name, Context context) { return client.recoverDeletedSecretWithResponse(name, context).block(); } /** - * Requests a backup of the specified secret be downloaded to the client. All versions of the secret will be downloaded. + * Requests a backup of the specified secret be downloaded to the client. All versions of the secret will be + * downloaded. * This operation requires the {@code secrets/backup} permission. * *

Code Samples

- *

Backs up the secret from the key vault and prints out the length of the secret's backup byte array returned in the response

+ *

Backs up the secret from the key vault and prints out the length of the secret's backup byte array returned in + * the response

* {@codesnippet com.azure.security.keyvault.secretclient.backupSecret#string} * * @param name The name of the secret. + * @return A {@link Response} whose {@link Response#getValue() value} contains the backed up secret blob. * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a secret with {@code name} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the backed up secret blob. */ public byte[] backupSecret(String name) { - return backupSecretWithResponse(name, Context.NONE).value(); + return backupSecretWithResponse(name, Context.NONE).getValue(); } /** - * Requests a backup of the specified secret be downloaded to the client. All versions of the secret will be downloaded. + * Requests a backup of the specified secret be downloaded to the client. All versions of the secret will be + * downloaded. * This operation requires the {@code secrets/backup} permission. * *

Code Samples

- *

Backs up the secret from the key vault and prints out the length of the secret's backup byte array returned in the response

+ *

Backs up the secret from the key vault and prints out the length of the secret's backup byte array returned in + * the response

* {@codesnippet com.azure.security.keyvault.secretclient.backupSecretWithResponse#string-Context} * * @param name The name of the secret. * @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 backed up secret blob. * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a secret with {@code name} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the backed up secret blob. */ public Response backupSecretWithResponse(String name, Context context) { return client.backupSecretWithResponse(name, context).block(); @@ -434,17 +475,17 @@ public Response backupSecretWithResponse(String name, Context context) { * This operation requires the {@code secrets/restore} permission. * *

Code Samples

- *

Restores the secret in the key vault from its backup byte array. Prints out the details of the restored secret returned - * in the response.

+ *

Restores the secret in the key vault from its backup byte array. Prints out the details of the restored secret + * returned in the response.

* //Pass the secret backup byte array of the secret to be restored. * {@codesnippet com.azure.security.keyvault.secretclient.restoreSecret#byte} * * @param backup The backup blob associated with the secret. + * @return A {@link Response} whose {@link Response#getValue() value} contains the {@link Secret restored secret}. * @throws ResourceModifiedException when {@code backup} blob is malformed. - * @return A {@link Response} whose {@link Response#value() value} contains the {@link Secret restored secret}. */ public Secret restoreSecret(byte[] backup) { - return restoreSecretWithResponse(backup, Context.NONE).value(); + return restoreSecretWithResponse(backup, Context.NONE).getValue(); } /** @@ -452,60 +493,68 @@ public Secret restoreSecret(byte[] backup) { * This operation requires the {@code secrets/restore} permission. * *

Code Samples

- *

Restores the secret in the key vault from its backup byte array. Prints out the details of the restored secret returned - * in the response.

+ *

Restores the secret in the key vault from its backup byte array. Prints out the details of the restored secret + * returned in the response.

* //Pass the secret backup byte array of the secret to be restored. * {@codesnippet com.azure.security.keyvault.secretclient.restoreSecretWithResponse#byte-Context} * * @param backup The backup blob associated with the secret. * @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 {@link Secret restored secret}. * @throws ResourceModifiedException when {@code backup} blob is malformed. - * @return A {@link Response} whose {@link Response#value() value} contains the {@link Secret restored secret}. */ public Response restoreSecretWithResponse(byte[] backup, Context context) { return client.restoreSecretWithResponse(backup, context).block(); } /** - * List the secrets in the key vault. The list Secrets operation is applicable to the entire vault. The individual secret response - * in the list is represented by {@link SecretBase} as only the base secret identifier and its attributes are - * provided in the response. The secret values and individual secret versions are not listed in the response. This operation requires the {@code secrets/list} permission. - * - *

It is possible to get full secrets with values from this information. Loop over the {@link SecretBase secret} and - * call {@link SecretClient#getSecret(SecretBase baseSecret)} . This will return the {@link Secret secret} with value included of its latest version.

+ * List the secrets in the key vault. The list Secrets operation is applicable to the entire vault. The individual + * secret response in the list is represented by {@link SecretBase} as only the base secret identifier and its + * attributes are provided in the response. The secret values and individual secret versions are not listed in the + * response. This operation requires the {@code secrets/list} permission. + * + *

It is possible to get full secrets with values from this information. Loop over the {@link SecretBase secret} + * and call {@link SecretClient#getSecret(SecretBase baseSecret)} . This will return the {@link Secret secret} with + * value included of its latest version.

* {@codesnippet com.azure.security.keyvault.secretclient.listSecrets} * *

Code Samples to iterate over secrets by page

- *

It is possible to get full secrets with values from this information. Iterate over all the {@link SecretBase secret} by page and - * call {@link SecretClient#getSecret(SecretBase baseSecret)} . This will return the {@link Secret secret} with value included of its latest version.

+ *

It is possible to get full secrets with values from this information. Iterate over all the {@link SecretBase + * secret} by page and call {@link SecretClient#getSecret(SecretBase baseSecret)} . This will return the + * {@link Secret secret} with value included of its latest version.

* {@codesnippet com.azure.security.keyvault.secretclient.listSecrets.iterableByPage} * - * @return {@link PagedIterable} of {@link SecretBase} of all the secrets in the vault. The {@link SecretBase} contains all the information about the secret, except its value. + * @return {@link PagedIterable} of {@link SecretBase} of all the secrets in the vault. The {@link SecretBase} + * contains all the information about the secret, except its value. */ public PagedIterable listSecrets() { return listSecrets(Context.NONE); } /** - * List the secrets in the key vault. The list Secrets operation is applicable to the entire vault. The individual secret response - * in the list is represented by {@link SecretBase} as only the base secret identifier and its attributes are - * provided in the response. The secret values and individual secret versions are not listed in the response. This operation requires the {@code secrets/list} permission. + * List the secrets in the key vault. The list Secrets operation is applicable to the entire vault. The individual + * secret response in the list is represented by {@link SecretBase} as only the base secret identifier and its + * attributes are provided in the response. The secret values and individual secret versions are not listed in the + * response. This operation requires the {@code secrets/list} permission. * *

Code Samples to iterate over secrets by page

- *

It is possible to get full secrets with values from this information. Loop over the {@link SecretBase secret} and - * call {@link SecretClient#getSecret(SecretBase baseSecret)} . This will return the {@link Secret secret} with value included of its latest version.

+ *

It is possible to get full secrets with values from this information. Loop over the {@link SecretBase secret} + * and call {@link SecretClient#getSecret(SecretBase baseSecret)} . This will return the {@link Secret secret} with + * value included of its latest version.

* {@codesnippet com.azure.security.keyvault.secretclient.listSecrets#Context} * * @param context Additional context that is passed through the Http pipeline during the service call.* - * @return {@link PagedIterable} of {@link SecretBase} of all the secrets in the vault. The {@link SecretBase} contains all the information about the secret, except its value. + * @return {@link PagedIterable} of {@link SecretBase} of all the secrets in the vault. The {@link SecretBase} + * contains all the information about the secret, except its value. */ public PagedIterable listSecrets(Context context) { return new PagedIterable<>(client.listSecrets(context)); } /** - * Lists {@link DeletedSecret deleted secrets} of the key vault. The get deleted secrets operation returns the secrets that - * have been deleted for a vault enabled for soft-delete. This operation requires the {@code secrets/list} permission. + * Lists {@link DeletedSecret deleted secrets} of the key vault. The get deleted secrets operation returns the + * secrets that have been deleted for a vault enabled for soft-delete. This operation requires the + * {@code secrets/list} permission. * *

Code Samples

*

Lists the deleted secrets in the key vault and for each deleted secret prints out its recovery id.

@@ -519,15 +568,17 @@ public PagedIterable listDeletedSecrets(Context context) { } /** - * Lists {@link DeletedSecret deleted secrets} of the key vault. The get deleted secrets operation returns the secrets that - * have been deleted for a vault enabled for soft-delete. This operation requires the {@code secrets/list} permission. + * Lists {@link DeletedSecret deleted secrets} of the key vault. The get deleted secrets operation returns the + * secrets that have been deleted for a vault enabled for soft-delete. This operation requires the + * {@code secrets/list} permission. * *

Code Samples

*

Lists the deleted secrets in the key vault and for each deleted secret prints out its recovery id.

* {@codesnippet com.azure.security.keyvault.secretclient.listDeletedSecrets} * *

Code Samples to iterate over secrets by page

- *

Iterate over Lists the deleted secrets by page in the key vault and for each deleted secret prints out its recovery id.

+ *

Iterate over Lists the deleted secrets by page in the key vault and for each deleted secret prints out its + * recovery id.

* {@codesnippet com.azure.security.keyvault.secretclient.listDeletedSecrets.iterableByPage} * * @return {@link PagedIterable} of all of the {@link DeletedSecret deleted secrets} in the vault. @@ -537,43 +588,48 @@ public PagedIterable listDeletedSecrets() { } /** - * List all versions of the specified secret. The individual secret response in the list is represented by {@link SecretBase} - * as only the base secret identifier and its attributes are provided in the response. The secret values are - * not provided in the response. This operation requires the {@code secrets/list} permission. + * List all versions of the specified secret. The individual secret response in the list is represented by {@link + * SecretBase} as only the base secret identifier and its attributes are provided in the response. The secret values + * are not provided in the response. This operation requires the {@code secrets/list} permission. * - *

It is possible to get full Secrets with values for each version from this information. Loop over the {@link SecretBase secret} and - * call {@link SecretClient#getSecret(SecretBase)} . This will return the {@link Secret} secrets with values included of the specified versions.

+ *

It is possible to get full Secrets with values for each version from this information. Loop over the {@link + * SecretBase secret} and call {@link SecretClient#getSecret(SecretBase)}. This will return the + * {@link Secret secrets} with values included of the specified versions.

* {@codesnippet com.azure.security.keyvault.secretclient.listSecretVersions#string} * * @param name The name of the secret. + * @return {@link PagedIterable} of {@link SecretBase} of all the versions of the specified secret in the vault. + * List is empty if secret with {@code name} does not exist in key vault * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a secret with {@code name} is empty string. - * @return {@link PagedIterable} of {@link SecretBase} of all the versions of the specified secret in the vault. List is empty if secret with {@code name} does not exist in key vault */ public PagedIterable listSecretVersions(String name) { return listSecretVersions(name, Context.NONE); } /** - * List all versions of the specified secret. The individual secret response in the list is represented by {@link SecretBase} - * as only the base secret identifier and its attributes are provided in the response. The secret values are - * not provided in the response. This operation requires the {@code secrets/list} permission. + * List all versions of the specified secret. The individual secret response in the list is represented by {@link + * SecretBase} as only the base secret identifier and its attributes are provided in the response. The secret values + * are not provided in the response. This operation requires the {@code secrets/list} permission. * - *

It is possible to get full Secrets with values for each version from this information. Loop over the {@link SecretBase secret} and - * call {@link SecretClient#getSecret(SecretBase)} . This will return the {@link Secret} secrets with values included of the specified versions.

+ *

It is possible to get full Secrets with values for each version from this information. Loop over the {@link + * SecretBase secret} and call {@link SecretClient#getSecret(SecretBase)} . This will return the + * {@link Secret secrets} with values included of the specified versions.

* {@codesnippet com.azure.security.keyvault.secretclient.listSecretVersions#string-Context} * * *

Code Samples to iterate over secret versions by page

- *

It is possible to get full Secrets with values for each version from this information. Iterate over all the {@link SecretBase secret} by each page and - * call {@link SecretClient#getSecret(SecretBase)} . This will return the {@link Secret} secrets with values included of the specified versions.

+ *

It is possible to get full Secrets with values for each version from this information. Iterate over all the + * {@link SecretBase secret} by each page and call {@link SecretClient#getSecret(SecretBase)} . This will return the + * {@link Secret secrets} with values included of the specified versions.

* {@codesnippet com.azure.security.keyvault.secretclient.listSecretVersions#string-Context-iterableByPage} * * @param name The name of the secret. * @param context Additional context that is passed through the Http pipeline during the service call. + * @return {@link PagedIterable} of {@link SecretBase} of all the versions of the specified secret in the vault. + * List is empty if secret with {@code name} does not exist in key vault * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a secret with {@code name} is empty string. - * @return {@link PagedIterable} of {@link SecretBase} of all the versions of the specified secret in the vault. List is empty if secret with {@code name} does not exist in key vault */ public PagedIterable listSecretVersions(String name, Context context) { return new PagedIterable<>(client.listSecretVersions(name, context)); diff --git a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClientBuilder.java b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClientBuilder.java index ee0049745967..9821c4d94ba6 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClientBuilder.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClientBuilder.java @@ -17,6 +17,7 @@ import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.implementation.util.ImplUtils; +import com.azure.core.util.logging.ClientLogger; import java.net.MalformedURLException; import java.net.URL; @@ -25,8 +26,10 @@ import java.util.Objects; /** - * This class provides a fluent builder API to help aid the configuration and instantiation of the {@link SecretAsyncClient secret async client} and {@link SecretClient secret client}, - * by calling {@link SecretClientBuilder#buildAsyncClient() buildAsyncClient} and {@link SecretClientBuilder#buildClient() buildClient} respectively. + * This class provides a fluent builder API to help aid the configuration and instantiation of the {@link + * SecretAsyncClient secret async client} and {@link SecretClient secret client}, + * by calling {@link SecretClientBuilder#buildAsyncClient() buildAsyncClient} and {@link + * SecretClientBuilder#buildClient() buildClient} respectively. * It constructs an instance of the desired client. * *

The minimal configuration options required by {@link SecretClientBuilder secretClientBuilder} to build @@ -42,9 +45,10 @@ * * {@codesnippet com.azure.security.keyvault.secrets.async.secretclient.withhttpclient.instantiation} * - *

Alternatively, custom {@link HttpPipeline http pipeline} with custom {@link HttpPipelinePolicy} policies and {@link String endpoint} + *

Alternatively, custom {@link HttpPipeline http pipeline} with custom {@link HttpPipelinePolicy} policies and + * {@link String endpoint} * can be specified. It provides finer control over the construction of {@link SecretAsyncClient client}

- + * * {@codesnippet com.azure.security.keyvault.secrets.async.secretclient.pipeline.instantiation} * * @see SecretClient @@ -52,13 +56,15 @@ */ @ServiceClientBuilder(serviceClients = SecretClient.class) public final class SecretClientBuilder { + private final ClientLogger logger = new ClientLogger(SecretClientBuilder.class); + private final List policies; private TokenCredential credential; private HttpPipeline pipeline; private URL endpoint; private HttpClient httpClient; private HttpLogDetailLevel httpLogDetailLevel; - private RetryPolicy retryPolicy; + private final RetryPolicy retryPolicy; private Configuration configuration; /** @@ -78,11 +84,12 @@ public SecretClientBuilder() { * {@link SecretClientBuilder#endpoint(String) serviceEndpoint} are used to create the * {@link SecretClientBuilder client}. All other builder settings are ignored. If {@code pipeline} is not set, * then {@link SecretClientBuilder#credential(TokenCredential) key vault credential and - * {@link SecretClientBuilder#endpoint(String)} key vault endpoint are required to build the {@link SecretClient client}.}

+ * {@link SecretClientBuilder#endpoint(String)} key vault endpoint are required to build the {@link SecretClient + * client}.}

* * @return A SecretClient with the options set from the builder. * @throws IllegalStateException If {@link SecretClientBuilder#credential(TokenCredential)} or - * {@link SecretClientBuilder#endpoint(String)} have not been set. + * {@link SecretClientBuilder#endpoint(String)} have not been set. */ public SecretClient buildClient() { return new SecretClient(buildAsyncClient()); @@ -96,19 +103,23 @@ public SecretClient buildClient() { * {@link SecretClientBuilder#endpoint(String) serviceEndpoint} are used to create the * {@link SecretClientBuilder client}. All other builder settings are ignored. If {@code pipeline} is not set, * then {@link SecretClientBuilder#credential(TokenCredential) key vault credential and - * {@link SecretClientBuilder#endpoint(String)} key vault endpoint are required to build the {@link SecretAsyncClient client}.}

+ * {@link SecretClientBuilder#endpoint(String)} key vault endpoint are required to build the {@link + * SecretAsyncClient client}.}

* * @return A SecretAsyncClient with the options set from the builder. * @throws IllegalStateException If {@link SecretClientBuilder#credential(TokenCredential)} or - * {@link SecretClientBuilder#endpoint(String)} have not been set. + * {@link SecretClientBuilder#endpoint(String)} have not been set. */ public SecretAsyncClient buildAsyncClient() { - Configuration buildConfiguration = (configuration == null) ? ConfigurationManager.getConfiguration().clone() : configuration; + Configuration buildConfiguration = + (configuration == null) ? ConfigurationManager.getConfiguration().clone() : configuration; URL buildEndpoint = getBuildEndpoint(buildConfiguration); if (buildEndpoint == null) { - throw new IllegalStateException(KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.VAULT_END_POINT_REQUIRED)); + throw logger.logExceptionAsError( + new IllegalStateException( + KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.VAULT_END_POINT_REQUIRED))); } if (pipeline != null) { @@ -116,12 +127,15 @@ public SecretAsyncClient buildAsyncClient() { } if (credential == null) { - throw new IllegalStateException(KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.CREDENTIAL_REQUIRED)); + throw logger.logExceptionAsError( + new IllegalStateException( + KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.CREDENTIAL_REQUIRED))); } // Closest to API goes first, closest to wire goes last. final List policies = new ArrayList<>(); - policies.add(new UserAgentPolicy(AzureKeyVaultConfiguration.SDK_NAME, AzureKeyVaultConfiguration.SDK_VERSION, buildConfiguration)); + policies.add(new UserAgentPolicy(AzureKeyVaultConfiguration.SDK_NAME, AzureKeyVaultConfiguration.SDK_VERSION, + buildConfiguration)); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new KeyVaultCredentialPolicy(credential)); @@ -130,9 +144,9 @@ public SecretAsyncClient buildAsyncClient() { policies.add(new HttpLoggingPolicy(httpLogDetailLevel)); HttpPipeline pipeline = new HttpPipelineBuilder() - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .build(); + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .build(); return new SecretAsyncClient(endpoint, pipeline); } @@ -148,7 +162,8 @@ public SecretClientBuilder endpoint(String endpoint) { try { this.endpoint = new URL(endpoint); } catch (MalformedURLException e) { - throw new IllegalArgumentException("The Azure Key Vault endpoint url is malformed."); + throw logger.logExceptionAsError(new IllegalArgumentException( + "The Azure Key Vault endpoint url is malformed.")); } return this; } diff --git a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretRequestAttributes.java b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretRequestAttributes.java index 073a0e1ad57d..c0a41a39adf9 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretRequestAttributes.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretRequestAttributes.java @@ -16,18 +16,18 @@ class SecretRequestAttributes { /** - * Creates an instance of SecretRequestAttributes. Reads secretBase.notBefore, secretBase.expires and secretBase.enabled fields - * from {@code secretBase} + * Creates an instance of SecretRequestAttributes. Reads secretBase.notBefore, secretBase.expires and + * secretBase.enabled fields from {@code secretBase} * @param secretBase the {@link SecretBase} object with populated attributes */ SecretRequestAttributes(SecretBase secretBase) { - if (secretBase.notBefore() != null) { - this.notBefore = secretBase.notBefore().toEpochSecond(); + if (secretBase.getNotBefore() != null) { + this.notBefore = secretBase.getNotBefore().toEpochSecond(); } - if (secretBase.expires() != null) { - this.expires = secretBase.expires().toEpochSecond(); + if (secretBase.getExpires() != null) { + this.expires = secretBase.getExpires().toEpochSecond(); } - this.enabled = secretBase.enabled(); + this.enabled = secretBase.isEnabled(); } /** @@ -77,7 +77,7 @@ class SecretRequestAttributes { * * @return the enabled value */ - public Boolean enabled() { + public Boolean isEnabled() { return this.enabled; } @@ -87,7 +87,7 @@ public Boolean enabled() { * @param enabled the enabled value to set * @return the Attributes object itself. */ - public SecretRequestAttributes enabled(Boolean enabled) { + public SecretRequestAttributes getEnabled(Boolean enabled) { this.enabled = enabled; return this; } @@ -97,7 +97,7 @@ public SecretRequestAttributes enabled(Boolean enabled) { * * @return the notBefore value */ - public OffsetDateTime notBefore() { + public OffsetDateTime getNotBefore() { if (this.notBefore == null) { return null; } @@ -110,7 +110,7 @@ public OffsetDateTime notBefore() { * @param notBefore the notBefore value to set * @return the Attributes object itself. */ - public SecretRequestAttributes notBefore(OffsetDateTime notBefore) { + public SecretRequestAttributes setNotBefore(OffsetDateTime notBefore) { if (notBefore == null) { this.notBefore = null; } else { @@ -124,7 +124,7 @@ public SecretRequestAttributes notBefore(OffsetDateTime notBefore) { * * @return the expires value */ - public OffsetDateTime expires() { + public OffsetDateTime getExpires() { if (this.expires == null) { return null; } @@ -137,7 +137,7 @@ public OffsetDateTime expires() { * @param expires the expires value to set * @return the Attributes object itself. */ - public SecretRequestAttributes expires(OffsetDateTime expires) { + public SecretRequestAttributes setExpires(OffsetDateTime expires) { if (expires == null) { this.expires = null; } else { @@ -151,7 +151,7 @@ public SecretRequestAttributes expires(OffsetDateTime expires) { * * @return the created value */ - public OffsetDateTime created() { + public OffsetDateTime getCreated() { if (this.created == null) { return null; } @@ -163,7 +163,7 @@ public OffsetDateTime created() { * * @return the updated value */ - public OffsetDateTime updated() { + public OffsetDateTime getUpdated() { if (this.updated == null) { return null; } diff --git a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretRequestParameters.java b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretRequestParameters.java index 0c272464f02b..8412e4c58934 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretRequestParameters.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretRequestParameters.java @@ -41,7 +41,7 @@ class SecretRequestParameters { * * @return the value value */ - public String value() { + public String getValue() { return this.value; } @@ -51,7 +51,7 @@ public String value() { * @param value the value value to set * @return the SecretRequestParameters object itself. */ - public SecretRequestParameters value(String value) { + public SecretRequestParameters setValue(String value) { this.value = value; return this; } @@ -61,7 +61,7 @@ public SecretRequestParameters value(String value) { * * @return the tags value */ - public Map tags() { + public Map getTags() { return this.tags; } @@ -71,7 +71,7 @@ public Map tags() { * @param tags the tags value to set * @return the SecretRequestParameters object itself. */ - public SecretRequestParameters tags(Map tags) { + public SecretRequestParameters setTags(Map tags) { this.tags = tags; return this; } @@ -81,7 +81,7 @@ public SecretRequestParameters tags(Map tags) { * * @return the contentType value */ - public String contentType() { + public String getContentType() { return this.contentType; } @@ -91,7 +91,7 @@ public String contentType() { * @param contentType the contentType value to set * @return the SecretRequestParameters object itself. */ - public SecretRequestParameters contentType(String contentType) { + public SecretRequestParameters setContentType(String contentType) { this.contentType = contentType; return this; } @@ -101,7 +101,7 @@ public SecretRequestParameters contentType(String contentType) { * * @return the SecretRequestAttributes value */ - public SecretRequestAttributes secretAttributes() { + public SecretRequestAttributes getSecretAttributes() { return this.secretRequestAttributes; } @@ -111,7 +111,7 @@ public SecretRequestAttributes secretAttributes() { * @param secretRequestAttributes the secretRequestAttributes to set * @return the SecretRequestParameters object itself. */ - public SecretRequestParameters secretAttributes(SecretRequestAttributes secretRequestAttributes) { + public SecretRequestParameters setSecretAttributes(SecretRequestAttributes secretRequestAttributes) { this.secretRequestAttributes = secretRequestAttributes; return this; } diff --git a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretRestoreRequestParameters.java b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretRestoreRequestParameters.java index 7fc8beacb099..1d39b9872d82 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretRestoreRequestParameters.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretRestoreRequestParameters.java @@ -18,7 +18,7 @@ class SecretRestoreRequestParameters { * * @return the secretBackup value */ - public byte[] secretBackup() { + public byte[] getSecretBackup() { if (this.secretBackup == null) { return new byte[0]; } @@ -31,7 +31,7 @@ public byte[] secretBackup() { * @param secretBackup the secretBackup value to set * @return the SecretRestoreRequestParameters object itself. */ - public SecretRestoreRequestParameters secretBackup(byte[] secretBackup) { + public SecretRestoreRequestParameters setSecretBackup(byte[] secretBackup) { this.secretBackup = secretBackup == null ? null : Base64Url.encode(secretBackup); return this; } diff --git a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/DeletedSecretPage.java b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/DeletedSecretPage.java index e68437c2f40f..127f59877e8f 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/DeletedSecretPage.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/DeletedSecretPage.java @@ -33,7 +33,7 @@ public final class DeletedSecretPage implements Page { * @return The link to the next page. */ @Override - public String nextLink() { + public String getNextLink() { return this.nextLink; } @@ -43,7 +43,7 @@ public String nextLink() { * @return The list of items in {@link List}. */ @Override - public List items() { + public List getItems() { return items; } } diff --git a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/SecretBasePage.java b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/SecretBasePage.java index bb3a041a6663..a31751c590c2 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/SecretBasePage.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/implementation/SecretBasePage.java @@ -33,7 +33,7 @@ public final class SecretBasePage implements Page { * @return The link to the next page. */ @Override - public String nextLink() { + public String getNextLink() { return this.nextLink; } @@ -43,7 +43,7 @@ public String nextLink() { * @return The list of items in {@link List}. */ @Override - public List items() { + public List getItems() { return items; } } diff --git a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/models/DeletedSecret.java b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/models/DeletedSecret.java index aaaf2fcd883e..9bc6bb999588 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/models/DeletedSecret.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/models/DeletedSecret.java @@ -11,17 +11,17 @@ import java.time.ZoneOffset; /** - * Deleted Secret is the resource consisting of name, recovery id, deleted date, scheduled purge date and its attributes inherited from {@link SecretBase}. + * Deleted Secret is the resource consisting of name, recovery id, deleted date, scheduled purge date and its attributes + * inherited from {@link SecretBase}. * It is managed by Secret Service. * - * @see SecretClient - * @see SecretAsyncClient + * @see SecretClient + * @see SecretAsyncClient */ public final class DeletedSecret extends SecretBase { /** - * The url of the recovery object, used to identify and recover the deleted - * secret. + * The url of the recovery object, used to identify and recover the deleted secret. */ @JsonProperty(value = "recoveryId") private String recoveryId; @@ -41,7 +41,7 @@ public final class DeletedSecret extends SecretBase { * * @return the recoveryId identifier. */ - public String recoveryId() { + public String getRecoveryId() { return this.recoveryId; } @@ -51,7 +51,7 @@ public String recoveryId() { * @param recoveryId The recoveryId identifier to set * @return the DeletedSecret object itself. */ - public DeletedSecret recoveryId(String recoveryId) { + public DeletedSecret setRecoveryId(String recoveryId) { this.recoveryId = recoveryId; return this; } @@ -61,7 +61,7 @@ public DeletedSecret recoveryId(String recoveryId) { * * @return the scheduledPurgeDate UTC time. */ - public OffsetDateTime scheduledPurgeDate() { + public OffsetDateTime getScheduledPurgeDate() { return scheduledPurgeDate; } @@ -70,25 +70,26 @@ public OffsetDateTime scheduledPurgeDate() { * * @return the deletedDate UTC time. */ - public OffsetDateTime deletedDate() { + public OffsetDateTime getDeletedDate() { return this.deletedDate; } /** - * Unpacks the scheduledPurageDate json response. Converts the {@link Long scheduledPurgeDate} epoch second value to OffsetDateTime and updates the - * value of class variable scheduledPurgeDate. + * Unpacks the scheduledPurageDate json response. Converts the {@link Long scheduledPurgeDate} epoch second value to + * OffsetDateTime and updates the value of class variable scheduledPurgeDate. */ @JsonProperty("scheduledPurgeDate") private void unpackScheduledPurgeDate(Long scheduledPurgeDate) { - this.scheduledPurgeDate = OffsetDateTime.ofInstant(Instant.ofEpochMilli(scheduledPurgeDate * 1000L), ZoneOffset.UTC); + this.scheduledPurgeDate = + OffsetDateTime.ofInstant(Instant.ofEpochMilli(scheduledPurgeDate * 1000L), ZoneOffset.UTC); } /** - * Unpacks the deletedDate json response. Converts the {@link Long deletedDate} epoch second value to OffsetDateTime and updates the - * value of class variable deletedDate. + * Unpacks the deletedDate json response. Converts the {@link Long deletedDate} epoch second value to OffsetDateTime + * and updates the value of class variable deletedDate. */ @JsonProperty("deletedDate") - private void deletedDate(Long deletedDate) { + private void setDeletedDate(Long deletedDate) { this.deletedDate = OffsetDateTime.ofInstant(Instant.ofEpochMilli(deletedDate * 1000L), ZoneOffset.UTC); } diff --git a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/models/Secret.java b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/models/Secret.java index 082a9b24cfb9..749933bb9468 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/models/Secret.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/models/Secret.java @@ -47,7 +47,7 @@ public Secret(String name, String value) { * * @return the secret value */ - public String value() { + public String getValue() { return this.value; } @@ -58,8 +58,8 @@ public String value() { * @return the Secret object itself. */ @Override - public Secret enabled(Boolean enabled) { - super.enabled(enabled); + public Secret setEnabled(Boolean enabled) { + super.setEnabled(enabled); return this; } @@ -70,8 +70,8 @@ public Secret enabled(Boolean enabled) { * @return the Secret object itself. */ @Override - public Secret notBefore(OffsetDateTime notBefore) { - super.notBefore(notBefore); + public Secret setNotBefore(OffsetDateTime notBefore) { + super.setNotBefore(notBefore); return this; } @@ -82,8 +82,8 @@ public Secret notBefore(OffsetDateTime notBefore) { * @return the Secret object itself. */ @Override - public Secret expires(OffsetDateTime expires) { - super.expires(expires); + public Secret setExpires(OffsetDateTime expires) { + super.setExpires(expires); return this; } @@ -94,8 +94,8 @@ public Secret expires(OffsetDateTime expires) { * @return the Secret object itself. */ @Override - public Secret id(String id) { - super.id(id); + public Secret setId(String id) { + super.setId(id); return this; } @@ -106,8 +106,8 @@ public Secret id(String id) { * @return the Secret object itself. */ @Override - public Secret contentType(String contentType) { - super.contentType(contentType); + public Secret setContentType(String contentType) { + super.setContentType(contentType); return this; } @@ -118,8 +118,8 @@ public Secret contentType(String contentType) { * @return the Secret object itself. */ @Override - public Secret tags(Map tags) { - super.tags(tags); + public Secret setTags(Map tags) { + super.setTags(tags); return this; } diff --git a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/models/SecretBase.java b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/models/SecretBase.java index 2f64ee5fbc24..d8f9a053ff4d 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/models/SecretBase.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/models/SecretBase.java @@ -104,7 +104,7 @@ public class SecretBase { * * @return the name of the secret. */ - public String name() { + public String getName() { return this.name; } @@ -113,7 +113,7 @@ public String name() { * @return the recoveryLevel of the secret. */ - public String recoveryLevel() { + public String getRecoveryLevel() { return recoveryLevel; } @@ -122,7 +122,7 @@ public String recoveryLevel() { * * @return the enabled value */ - public Boolean enabled() { + public Boolean isEnabled() { return this.enabled; } @@ -132,7 +132,7 @@ public Boolean enabled() { * @param enabled The enabled value to set * @return the SecretBase object itself. */ - public SecretBase enabled(Boolean enabled) { + public SecretBase setEnabled(Boolean enabled) { this.enabled = enabled; return this; } @@ -142,7 +142,7 @@ public SecretBase enabled(Boolean enabled) { * * @return the notBefore UTC time. */ - public OffsetDateTime notBefore() { + public OffsetDateTime getNotBefore() { return notBefore; } @@ -152,7 +152,7 @@ public OffsetDateTime notBefore() { * @param notBefore The notBefore UTC time to set * @return the SecretBase object itself. */ - public SecretBase notBefore(OffsetDateTime notBefore) { + public SecretBase setNotBefore(OffsetDateTime notBefore) { this.notBefore = notBefore; return this; } @@ -162,7 +162,7 @@ public SecretBase notBefore(OffsetDateTime notBefore) { * * @return the expires UTC time. */ - public OffsetDateTime expires() { + public OffsetDateTime getExpires() { if (this.expires == null) { return null; } @@ -175,7 +175,7 @@ public OffsetDateTime expires() { * @param expires The expiry time to set for the secret. * @return the SecretBase object itself. */ - public SecretBase expires(OffsetDateTime expires) { + public SecretBase setExpires(OffsetDateTime expires) { this.expires = expires; return this; } @@ -185,7 +185,7 @@ public SecretBase expires(OffsetDateTime expires) { * * @return the created UTC time. */ - public OffsetDateTime created() { + public OffsetDateTime getCreated() { return created; } @@ -194,7 +194,7 @@ public OffsetDateTime created() { * * @return the last updated UTC time. */ - public OffsetDateTime updated() { + public OffsetDateTime getUpdated() { return updated; } @@ -203,7 +203,7 @@ public OffsetDateTime updated() { * * @return the secret identifier. */ - public String id() { + public String getId() { return this.id; } @@ -213,7 +213,7 @@ public String id() { * @param id The secret identifier to set * @return the SecretBase object itself. */ - public SecretBase id(String id) { + public SecretBase setId(String id) { unpackId(id); return this; } @@ -223,7 +223,7 @@ public SecretBase id(String id) { * * @return the content type. */ - public String contentType() { + public String getContentType() { return this.contentType; } @@ -233,7 +233,7 @@ public String contentType() { * @param contentType The contentType to set * @return the SecretBase object itself. */ - public SecretBase contentType(String contentType) { + public SecretBase setContentType(String contentType) { this.contentType = contentType; return this; } @@ -243,7 +243,7 @@ public SecretBase contentType(String contentType) { * * @return the value of the tags. */ - public Map tags() { + public Map getTags() { return this.tags; } @@ -253,7 +253,7 @@ public Map tags() { * @param tags The tags to set * @return the SecretBase object itself. */ - public SecretBase tags(Map tags) { + public SecretBase setTags(Map tags) { this.tags = tags; return this; } @@ -263,7 +263,7 @@ public SecretBase tags(Map tags) { * * @return the keyId identifier. */ - public String keyId() { + public String getKeyId() { return this.keyId; } @@ -272,7 +272,7 @@ public String keyId() { * * @return the managed value */ - public Boolean managed() { + public Boolean isManaged() { return this.managed; } @@ -281,7 +281,7 @@ public Boolean managed() { * * @return the version of the secret. */ - public String version() { + public String getVersion() { return this.version; } diff --git a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/BackupAndRestoreOperations.java b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/BackupAndRestoreOperations.java index 918ca4fafa4c..9db46ac7ec85 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/BackupAndRestoreOperations.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/BackupAndRestoreOperations.java @@ -38,7 +38,7 @@ public static void main(String[] args) throws IOException, InterruptedException, // Let's create secrets holding storage account credentials valid for 1 year. if the secret // already exists in the key vault, then a new version of the secret is created. client.setSecret(new Secret("StorageAccountPassword", "f4G34fMh8v-fdsgjsk2323=-asdsdfsdf") - .expires(OffsetDateTime.now().plusYears(1))); + .setExpires(OffsetDateTime.now().plusYears(1))); // Backups are good to have, if in case secrets get accidentally deleted by you. // For long term storage, it is ideal to write the backup to a file. diff --git a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/BackupAndRestoreOperationsAsync.java b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/BackupAndRestoreOperationsAsync.java index 8ed5fcf4e9ac..b5baaa40a15d 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/BackupAndRestoreOperationsAsync.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/BackupAndRestoreOperationsAsync.java @@ -38,9 +38,9 @@ public static void main(String[] args) throws IOException, InterruptedException, // Let's create secrets holding storage account credentials valid for 1 year. if the secret // already exists in the key vault, then a new version of the secret is created. secretAsyncClient.setSecret(new Secret("StorageAccountPassword", "f4G34fMh8v-fdsgjsk2323=-asdsdfsdf") - .expires(OffsetDateTime.now().plusYears(1))) + .setExpires(OffsetDateTime.now().plusYears(1))) .subscribe(secretResponse -> - System.out.printf("Secret is created with name %s and value %s \n", secretResponse.name(), secretResponse.value())); + System.out.printf("Secret is created with name %s and value %s \n", secretResponse.getName(), secretResponse.getValue())); Thread.sleep(2000); @@ -56,14 +56,14 @@ public static void main(String[] args) throws IOException, InterruptedException, // The storage account secret is no longer in use, so you delete it. secretAsyncClient.deleteSecret("StorageAccountPassword").subscribe(deletedSecretResponse -> - System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.recoveryId())); + System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.getRecoveryId())); //To ensure file is deleted on server side. Thread.sleep(30000); // If the vault is soft-delete enabled, then you need to purge the secret as well for permanent deletion. secretAsyncClient.purgeDeletedSecret("StorageAccountPassword").subscribe(purgeResponse -> - System.out.printf("Purge Status response %d \n", purgeResponse.statusCode())); + System.out.printf("Purge Status response %d \n", purgeResponse.getStatusCode())); //To ensure file is purged on server side. Thread.sleep(15000); @@ -71,7 +71,7 @@ public static void main(String[] args) throws IOException, InterruptedException, // After sometime, the secret is required again. We can use the backup value to restore it in the key vault. byte[] backupFromFile = Files.readAllBytes(new File(backupFilePath).toPath()); secretAsyncClient.restoreSecret(backupFromFile).subscribe(secretResponse -> - System.out.printf("Restored Secret with name %s \n", secretResponse.name())); + System.out.printf("Restored Secret with name %s \n", secretResponse.getName())); //To ensure secret is restored on server side. Thread.sleep(15000); diff --git a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/HelloWorld.java b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/HelloWorld.java index 0efd27004e96..3224de637323 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/HelloWorld.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/HelloWorld.java @@ -34,24 +34,24 @@ public static void main(String[] args) throws InterruptedException, IllegalArgum // Let's create a secret holding bank account credentials valid for 1 year. if the secret // already exists in the key vault, then a new version of the secret is created. secretClient.setSecret(new Secret("BankAccountPassword", "f4G34fMh8v") - .expires(OffsetDateTime.now().plusYears(1))); + .setExpires(OffsetDateTime.now().plusYears(1))); // Let's Get the bank secret from the key vault. Secret bankSecret = secretClient.getSecret("BankAccountPassword"); - System.out.printf("Secret is returned with name %s and value %s \n", bankSecret.name(), bankSecret.value()); + System.out.printf("Secret is returned with name %s and value %s \n", bankSecret.getName(), bankSecret.getValue()); // After one year, the bank account is still active, we need to update the expiry time of the secret. // The update method can be used to update the expiry attribute of the secret. It cannot be used to update // the value of the secret. - bankSecret.expires(bankSecret.expires().plusYears(1)); + bankSecret.setExpires(bankSecret.getExpires().plusYears(1)); SecretBase updatedSecret = secretClient.updateSecret(bankSecret); - System.out.printf("Secret's updated expiry time %s \n", updatedSecret.expires()); + System.out.printf("Secret's updated expiry time %s \n", updatedSecret.getExpires()); // Bank forced a password update for security purposes. Let's change the value of the secret in the key vault. // To achieve this, we need to create a new version of the secret in the key vault. The update operation cannot // change the value of the secret. secretClient.setSecret(new Secret("BankAccountPassword", "bhjd4DDgsa") - .expires(OffsetDateTime.now().plusYears(1))); + .setExpires(OffsetDateTime.now().plusYears(1))); // The bank account was closed, need to delete its credentials from the key vault. secretClient.deleteSecret("BankAccountPassword"); diff --git a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/HelloWorldAsync.java b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/HelloWorldAsync.java index 9c96a45d46ca..bdc50d38b9f3 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/HelloWorldAsync.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/HelloWorldAsync.java @@ -32,14 +32,14 @@ public static void main(String[] args) throws InterruptedException { // Let's create a secret holding bank account credentials valid for 1 year. if the secret // already exists in the key vault, then a new version of the secret is created. secretAsyncClient.setSecret(new Secret("BankAccountPassword", "f4G34fMh8v") - .expires(OffsetDateTime.now().plusYears(1))).subscribe(secretResponse -> - System.out.printf("Secret is created with name %s and value %s \n", secretResponse.name(), secretResponse.value())); + .setExpires(OffsetDateTime.now().plusYears(1))).subscribe(secretResponse -> + System.out.printf("Secret is created with name %s and value %s \n", secretResponse.getName(), secretResponse.getValue())); Thread.sleep(2000); // Let's Get the bank secret from the key vault. secretAsyncClient.getSecret("BankAccountPassword").subscribe(secretResponse -> - System.out.printf("Secret returned with name %s , value %s \n", secretResponse.name(), secretResponse.value())); + System.out.printf("Secret returned with name %s , value %s \n", secretResponse.getName(), secretResponse.getValue())); Thread.sleep(2000); @@ -49,9 +49,9 @@ public static void main(String[] args) throws InterruptedException { secretAsyncClient.getSecret("BankAccountPassword").subscribe(secretResponse -> { Secret secret = secretResponse; //Update the expiry time of the secret. - secret.expires(secret.expires().plusYears(1)); + secret.setExpires(secret.getExpires().plusYears(1)); secretAsyncClient.updateSecret(secret).subscribe(updatedSecretResponse -> - System.out.printf("Secret's updated expiry time %s \n", updatedSecretResponse.expires().toString())); + System.out.printf("Secret's updated expiry time %s \n", updatedSecretResponse.getExpires().toString())); }); Thread.sleep(2000); @@ -60,20 +60,20 @@ public static void main(String[] args) throws InterruptedException { // To achieve this, we need to create a new version of the secret in the key vault. The update operation cannot // change the value of the secret. secretAsyncClient.setSecret("BankAccountPassword", "bhjd4DDgsa").subscribe(secretResponse -> - System.out.printf("Secret is created with name %s and value %s \n", secretResponse.name(), secretResponse.value())); + System.out.printf("Secret is created with name %s and value %s \n", secretResponse.getName(), secretResponse.getValue())); Thread.sleep(2000); // The bank account was closed, need to delete its credentials from the key vault. secretAsyncClient.deleteSecret("BankAccountPassword").subscribe(deletedSecretResponse -> - System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.recoveryId())); + System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.getRecoveryId())); //To ensure secret is deleted on server side. Thread.sleep(30000); // If the key vault is soft-delete enabled, then for permanent deletion deleted secrets need to be purged. secretAsyncClient.purgeDeletedSecret("BankAccountPassword").subscribe(purgeResponse -> - System.out.printf("Bank account secret purge status response %d \n", purgeResponse.statusCode())); + System.out.printf("Bank account secret purge status response %d \n", purgeResponse.getStatusCode())); //To ensure secret is purged on server side. Thread.sleep(15000); diff --git a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/IdentitySamples.java b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/IdentitySamples.java new file mode 100644 index 000000000000..20c191cf6697 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/IdentitySamples.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.secrets; + +import com.azure.identity.credential.ChainedTokenCredential; +import com.azure.identity.credential.ChainedTokenCredentialBuilder; +import com.azure.identity.credential.ClientSecretCredential; +import com.azure.identity.credential.ClientSecretCredentialBuilder; +import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.identity.credential.DeviceCodeCredential; +import com.azure.identity.credential.DeviceCodeCredentialBuilder; +import com.azure.identity.credential.ManagedIdentityCredential; +import com.azure.identity.credential.ManagedIdentityCredentialBuilder; +import com.azure.security.keyvault.secrets.models.Secret; + +/** + * Samples for azure-identity readme. + */ +public class IdentitySamples { + /** + * A sample for authenticating a key vault secret client with a default credential. + */ + public void authenticateWithDefaultAzureCredential() { + DefaultAzureCredential defaultCredential = new DefaultAzureCredentialBuilder().build(); + + // Azure SDK client builders accept the credential as a parameter + + SecretClient client = new SecretClientBuilder() + .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") + .credential(defaultCredential) + .buildClient(); + + Secret secret = client.getSecret("{SECRET_NAME}"); + System.out.println(secret.getValue()); + } + + /** + * A sample for authenticating a key vault secret client with a client secret credential. + */ + public void authenticateWithClientSecretCredential() { + // authenticate with client secret, + ClientSecretCredential clientSecretCredential = new ClientSecretCredentialBuilder() + .clientId("") + .clientSecret("") + .tenantId("") + .build(); + + SecretClient client = new SecretClientBuilder() + .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") + .credential(clientSecretCredential) + .buildClient(); + + Secret secret = client.getSecret("{SECRET_NAME}"); + System.out.println(secret.getValue()); + } + + /** + * A sample for authenticating a key vault secret client with a device code credential. + */ + public void authenticateWithDeviceCodeCredential() { + // authenticate with client secret, + DeviceCodeCredential deviceCodeCredential = new DeviceCodeCredentialBuilder() + .deviceCodeChallengeConsumer(challenge -> { + // lets user know of the challenge, e.g., display the message on an IoT device + displayMessage(challenge.getMessage()); + }) + .build(); + + SecretClient client = new SecretClientBuilder() + .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") + .credential(deviceCodeCredential) + .buildClient(); + + Secret secret = client.getSecret("{SECRET_NAME}"); + System.out.println(secret.getValue()); + } + + /** + * A sample for authenticating a key vault secret client with a chained credential. + */ + public void authenticateWithChainedCredential() { + ManagedIdentityCredential managedIdentityCredential = new ManagedIdentityCredentialBuilder() + .clientId("") + .build(); + + ClientSecretCredential secondServicePrincipal = new ClientSecretCredentialBuilder() + .clientId("") + .clientSecret("") + .tenantId("") + .build(); + + // when an access token is requested, the chain will try each + // credential in order, stopping when one provides a token + + ChainedTokenCredential credentialChain = new ChainedTokenCredentialBuilder() + .addLast(managedIdentityCredential) + .addLast(secondServicePrincipal) + .build(); + + // the chain can be used anywhere a credential is required + SecretClient client = new SecretClientBuilder() + .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") + .credential(credentialChain) + .buildClient(); + + Secret secret = client.getSecret("{SECRET_NAME}"); + System.out.println(secret.getValue()); + } + + private void displayMessage(String message) { + System.out.println(message); + } +} diff --git a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ListOperations.java b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ListOperations.java index be76ea7b2de8..50210dc88f30 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ListOperations.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ListOperations.java @@ -32,16 +32,16 @@ public static void main(String[] args) throws IllegalArgumentException { // Let's create secrets holding storage and bank accounts credentials valid for 1 year. if the secret // already exists in the key vault, then a new version of the secret is created. client.setSecret(new Secret("StorageAccountPassword", "f4G34fMh8v-fdsgjsk2323=-asdsdfsdf") - .expires(OffsetDateTime.now().plusYears(1))); + .setExpires(OffsetDateTime.now().plusYears(1))); client.setSecret(new Secret("BankAccountPassword", "f4G34fMh8v") - .expires(OffsetDateTime.now().plusYears(1))); + .setExpires(OffsetDateTime.now().plusYears(1))); // You need to check if any of the secrets are sharing same values. Let's list the secrets and print their values. // List operations don't return the secrets with value information. So, for each returned secret we call getSecret to get the secret with its value information. for (SecretBase secret : client.listSecrets()) { Secret secretWithValue = client.getSecret(secret); - System.out.printf("Received secret with name %s and value %s \n", secretWithValue.name(), secretWithValue.value()); + System.out.printf("Received secret with name %s and value %s \n", secretWithValue.getName(), secretWithValue.getValue()); } // The bank account password got updated, so you want to update the secret in key vault to ensure it reflects the new password. @@ -51,7 +51,7 @@ public static void main(String[] args) throws IllegalArgumentException { // You need to check all the different values your bank account password secret had previously. Lets print all the versions of this secret. for (SecretBase secret : client.listSecretVersions("BankAccountPassword")) { Secret secretWithValue = client.getSecret(secret); - System.out.printf("Received secret's version with name %s and value %s", secretWithValue.name(), secretWithValue.value()); + System.out.printf("Received secret's version with name %s and value %s", secretWithValue.getName(), secretWithValue.getValue()); } } } diff --git a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ListOperationsAsync.java b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ListOperationsAsync.java index 771a63554950..1f6f932f5144 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ListOperationsAsync.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ListOperationsAsync.java @@ -32,16 +32,16 @@ public static void main(String[] args) throws InterruptedException { // Let's create secrets holding storage and bank accounts credentials valid for 1 year. if the secret // already exists in the key vault, then a new version of the secret is created. secretAsyncClient.setSecret(new Secret("BankAccountPassword", "f4G34fMh8v") - .expires(OffsetDateTime.now().plusYears(1))) + .setExpires(OffsetDateTime.now().plusYears(1))) .subscribe(secretResponse -> - System.out.printf("Secret is created with name %s and value %s \n", secretResponse.name(), secretResponse.value())); + System.out.printf("Secret is created with name %s and value %s \n", secretResponse.getName(), secretResponse.getValue())); Thread.sleep(2000); secretAsyncClient.setSecret(new Secret("StorageAccountPassword", "f4G34fMh8v-fdsgjsk2323=-asdsdfsdf") - .expires(OffsetDateTime.now().plusYears(1))) + .setExpires(OffsetDateTime.now().plusYears(1))) .subscribe(secretResponse -> - System.out.printf("Secret is created with name %s and value %s \n", secretResponse.name(), secretResponse.value())); + System.out.printf("Secret is created with name %s and value %s \n", secretResponse.getName(), secretResponse.getValue())); Thread.sleep(2000); @@ -50,22 +50,22 @@ public static void main(String[] args) throws InterruptedException { secretAsyncClient.listSecrets() .subscribe(secretBase -> secretAsyncClient.getSecret(secretBase).subscribe(secretResponse -> - System.out.printf("Received secret with name %s and value %s \n", secretResponse.name(), secretResponse.value()))); + System.out.printf("Received secret with name %s and value %s \n", secretResponse.getName(), secretResponse.getValue()))); Thread.sleep(15000); // The bank account password got updated, so you want to update the secret in key vault to ensure it reflects the new password. // Calling setSecret on an existing secret creates a new version of the secret in the key vault with the new value. secretAsyncClient.setSecret(new Secret("BankAccountPassword", "sskdjfsdasdjsd") - .expires(OffsetDateTime.now().plusYears(1))).subscribe(secretResponse -> - System.out.printf("Secret is created with name %s and value %s \n", secretResponse.name(), secretResponse.value())); + .setExpires(OffsetDateTime.now().plusYears(1))).subscribe(secretResponse -> + System.out.printf("Secret is created with name %s and value %s \n", secretResponse.getName(), secretResponse.getValue())); Thread.sleep(2000); // You need to check all the different values your bank account password secret had previously. Lets print all the versions of this secret. secretAsyncClient.listSecretVersions("BankAccountPassword").subscribe(secretBase -> secretAsyncClient.getSecret(secretBase).subscribe(secretResponse -> - System.out.printf("Received secret's version with name %s and value %s \n", secretResponse.name(), secretResponse.value()))); + System.out.printf("Received secret's version with name %s and value %s \n", secretResponse.getName(), secretResponse.getValue()))); Thread.sleep(15000); } diff --git a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ManagingDeletedSecrets.java b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ManagingDeletedSecrets.java index d58434af745e..7e1f7ad15acc 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ManagingDeletedSecrets.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ManagingDeletedSecrets.java @@ -37,10 +37,10 @@ public static void main(String[] args) throws IllegalArgumentException, Interrup // Let's create secrets holding storage and bank accounts credentials valid for 1 year. if the secret // already exists in the key vault, then a new version of the secret is created. client.setSecret(new Secret("StorageAccountPassword", "f4G34fMh8v-fdsgjsk2323=-asdsdfsdf") - .expires(OffsetDateTime.now().plusYears(1))); + .setExpires(OffsetDateTime.now().plusYears(1))); client.setSecret(new Secret("BankAccountPassword", "f4G34fMh8v") - .expires(OffsetDateTime.now().plusYears(1))); + .setExpires(OffsetDateTime.now().plusYears(1))); // The storage account was closed, need to delete its credentials from the key vault. client.deleteSecret("BankAccountPassword"); @@ -65,7 +65,7 @@ public static void main(String[] args) throws IllegalArgumentException, Interrup // You can list all the deleted and non-purged secrets, assuming key vault is soft-delete enabled. for (DeletedSecret deletedSecret : client.listDeletedSecrets()) { - System.out.printf("Deleted secret's recovery Id %s", deletedSecret.recoveryId()); + System.out.printf("Deleted secret's recovery Id %s", deletedSecret.getRecoveryId()); } // If the key vault is soft-delete enabled, then for permanent deletion deleted secrets need to be purged. diff --git a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ManagingDeletedSecretsAsync.java b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ManagingDeletedSecretsAsync.java index 72f32d5ab548..10d60ec5a17c 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ManagingDeletedSecretsAsync.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ManagingDeletedSecretsAsync.java @@ -36,20 +36,20 @@ public static void main(String[] args) throws InterruptedException { // Let's create secrets holding storage and bank accounts credentials valid for 1 year. if the secret // already exists in the key vault, then a new version of the secret is created. secretAsyncClient.setSecret(new Secret("BankAccountPassword", "f4G34fMh8v") - .expires(OffsetDateTime.now().plusYears(1))).subscribe(secretResponse -> - System.out.printf("Secret is created with name %s and value %s \n", secretResponse.name(), secretResponse.value())); + .setExpires(OffsetDateTime.now().plusYears(1))).subscribe(secretResponse -> + System.out.printf("Secret is created with name %s and value %s \n", secretResponse.getName(), secretResponse.getValue())); Thread.sleep(2000); secretAsyncClient.setSecret(new Secret("StorageAccountPassword", "f4G34fMh8v-fdsgjsk2323=-asdsdfsdf") - .expires(OffsetDateTime.now().plusYears(1))).subscribe(secretResponse -> - System.out.printf("Secret is created with name %s and value %s \n", secretResponse.name(), secretResponse.value())); + .setExpires(OffsetDateTime.now().plusYears(1))).subscribe(secretResponse -> + System.out.printf("Secret is created with name %s and value %s \n", secretResponse.getName(), secretResponse.getValue())); Thread.sleep(2000); // The storage account was closed, need to delete its credentials from the key vault. secretAsyncClient.deleteSecret("BankAccountPassword").subscribe(deletedSecretResponse -> - System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.recoveryId())); + System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.getRecoveryId())); //To ensure secret is deleted on server side. Thread.sleep(30000); @@ -57,7 +57,7 @@ public static void main(String[] args) throws InterruptedException { // We accidentally deleted bank account secret. Let's recover it. // A deleted secret can only be recovered if the key vault is soft-delete enabled. secretAsyncClient.recoverDeletedSecret("BankAccountPassword").subscribe(recoveredSecretResponse -> - System.out.printf("Recovered Secret with name %s \n", recoveredSecretResponse.name())); + System.out.printf("Recovered Secret with name %s \n", recoveredSecretResponse.getName())); //To ensure secret is recovered on server side. Thread.sleep(10000); @@ -65,26 +65,26 @@ public static void main(String[] args) throws InterruptedException { // The bank acoount and storage accounts got closed. // Let's delete bank and storage accounts secrets. secretAsyncClient.deleteSecret("BankAccountPassword").subscribe(deletedSecretResponse -> - System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.recoveryId())); + System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.getRecoveryId())); secretAsyncClient.deleteSecret("StorageAccountPassword").subscribe(deletedSecretResponse -> - System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.recoveryId())); + System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.getRecoveryId())); // To ensure secret is deleted on server side. Thread.sleep(30000); // You can list all the deleted and non-purged secrets, assuming key vault is soft-delete enabled. secretAsyncClient.listDeletedSecrets().subscribe(deletedSecret -> - System.out.printf("Deleted secret's recovery Id %s \n", deletedSecret.recoveryId())); + System.out.printf("Deleted secret's recovery Id %s \n", deletedSecret.getRecoveryId())); Thread.sleep(15000); // If the key vault is soft-delete enabled, then for permanent deletion deleted secrets need to be purged. secretAsyncClient.purgeDeletedSecret("StorageAccountPassword").subscribe(purgeResponse -> - System.out.printf("Storage account secret purge status response %d \n", purgeResponse.statusCode())); + System.out.printf("Storage account secret purge status response %d \n", purgeResponse.getStatusCode())); secretAsyncClient.purgeDeletedSecret("BankAccountPassword").subscribe(purgeResponse -> - System.out.printf("Bank account secret purge status response %d \n", purgeResponse.statusCode())); + System.out.printf("Bank account secret purge status response %d \n", purgeResponse.getStatusCode())); // To ensure secret is purged on server side. Thread.sleep(15000); diff --git a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/PersistentTokenCacheDemo.java b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/PersistentTokenCacheDemo.java new file mode 100644 index 000000000000..d8a2725a7cc1 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/PersistentTokenCacheDemo.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.secrets; + +import com.azure.identity.credential.SharedTokenCacheCredential; +import com.azure.identity.credential.SharedTokenCacheCredentialBuilder; +import com.azure.security.keyvault.secrets.models.Secret; + +/** + * Sample showing how to authenticate to key vault with a shared token cache credential. + */ +public class PersistentTokenCacheDemo { + + /** + * Authenticates from shared token cache and gets a secret. + * @param args Unused. Arguments to the program. + */ + public static void main(String[] args) { + + // Wrote to AZURE_USERNAME env variable + SharedTokenCacheCredential defaultCredential = new SharedTokenCacheCredentialBuilder() + .clientId("04b07795-8ddb-461a-bbee-02f9e1bf7b46") + .build(); + + SecretClient client = new SecretClientBuilder() + .endpoint("https://persistentcachedemo.vault.azure.net") + .credential(defaultCredential) + .buildClient(); + + // Try to get a secret! Only works if you are logged in + System.out.println("\nWhat is the super secret secret?\n\n"); + Secret secret = client.getSecret("the-secret"); + System.out.println("Secret was found: " + secret.getValue()); + } +} diff --git a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretAsyncClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretAsyncClientJavaDocCodeSnippets.java index 66fe46998ead..3bdf453074bb 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretAsyncClientJavaDocCodeSnippets.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretAsyncClientJavaDocCodeSnippets.java @@ -88,8 +88,8 @@ public void getSecretCodeSnippets() { .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(secretBase -> secretAsyncClient.getSecret(secretBase) .subscribe(secretResponse -> - System.out.printf("Secret is returned with name %s and value %s %n", secretResponse.name(), - secretResponse.value()))); + System.out.printf("Secret is returned with name %s and value %s %n", secretResponse.getName(), + secretResponse.getValue()))); // END: com.azure.keyvault.secrets.secretclient.getSecret#secretBase // BEGIN: com.azure.keyvault.secrets.secretclient.getSecret#string-string @@ -98,7 +98,7 @@ public void getSecretCodeSnippets() { .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(secretWithVersion -> System.out.printf("Secret is returned with name %s and value %s \n", - secretWithVersion.name(), secretWithVersion.value())); + secretWithVersion.getName(), secretWithVersion.getValue())); // END: com.azure.keyvault.secrets.secretclient.getSecret#string-string // BEGIN: com.azure.keyvault.secrets.secretclient.getSecret#string @@ -106,7 +106,7 @@ public void getSecretCodeSnippets() { .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(secretWithVersion -> System.out.printf("Secret is returned with name %s and value %s \n", - secretWithVersion.name(), secretWithVersion.value())); + secretWithVersion.getName(), secretWithVersion.getValue())); // END: com.azure.keyvault.secrets.secretclient.getSecret#string } @@ -120,8 +120,8 @@ public void getSecretWithResponseCodeSnippets() { .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(secretBase -> secretAsyncClient.getSecretWithResponse(secretBase) .subscribe(secretResponse -> - System.out.printf("Secret is returned with name %s and value %s %n", secretResponse.value().name(), - secretResponse.value().value()))); + System.out.printf("Secret is returned with name %s and value %s %n", secretResponse.getValue().getName(), + secretResponse.getValue().getValue()))); // END: com.azure.keyvault.secrets.secretclient.getSecretWithResponse#secretBase // BEGIN: com.azure.keyvault.secrets.secretclient.getSecretWithResponse#string-string @@ -130,7 +130,7 @@ public void getSecretWithResponseCodeSnippets() { .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(secretWithVersion -> System.out.printf("Secret is returned with name %s and value %s \n", - secretWithVersion.value().name(), secretWithVersion.value().value())); + secretWithVersion.getValue().getName(), secretWithVersion.getValue().getValue())); // END: com.azure.keyvault.secrets.secretclient.getSecretWithResponse#string-string } @@ -141,12 +141,12 @@ public void setSecretCodeSnippets() { SecretAsyncClient secretAsyncClient = getAsyncSecretClient(); // BEGIN: com.azure.keyvault.secrets.secretclient.setSecret#secret Secret newSecret = new Secret("secretName", "secretValue"). - expires(OffsetDateTime.now().plusDays(60)); + setExpires(OffsetDateTime.now().plusDays(60)); secretAsyncClient.setSecret(newSecret) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(secretResponse -> System.out.printf("Secret is created with name %s and value %s \n", - secretResponse.name(), secretResponse.value())); + secretResponse.getName(), secretResponse.getValue())); // END: com.azure.keyvault.secrets.secretclient.setSecret#secret // BEGIN: com.azure.keyvault.secrets.secretclient.setSecret#string-string @@ -154,7 +154,7 @@ public void setSecretCodeSnippets() { .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(secretResponse -> System.out.printf("Secret is created with name %s and value %s \n", - secretResponse.name(), secretResponse.value())); + secretResponse.getName(), secretResponse.getValue())); // END: com.azure.keyvault.secrets.secretclient.setSecret#string-string } @@ -165,12 +165,12 @@ public void setSecretWithResponseCodeSnippets() { SecretAsyncClient secretAsyncClient = getAsyncSecretClient(); // BEGIN: com.azure.keyvault.secrets.secretclient.setSecretWithResponse#secret Secret newSecret = new Secret("secretName", "secretValue"). - expires(OffsetDateTime.now().plusDays(60)); + setExpires(OffsetDateTime.now().plusDays(60)); secretAsyncClient.setSecretWithResponse(newSecret) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(secretResponse -> System.out.printf("Secret is created with name %s and value %s \n", - secretResponse.value().name(), secretResponse.value().value())); + secretResponse.getValue().getName(), secretResponse.getValue().getValue())); // END: com.azure.keyvault.secrets.secretclient.setSecretWithResponse#secret } @@ -185,11 +185,11 @@ public void updateSecretCodeSnippets() { .subscribe(secretResponseValue -> { Secret secret = secretResponseValue; //Update the not before time of the secret. - secret.notBefore(OffsetDateTime.now().plusDays(50)); + secret.setNotBefore(OffsetDateTime.now().plusDays(50)); secretAsyncClient.updateSecret(secret) .subscribe(secretResponse -> System.out.printf("Secret's updated not before time %s \n", - secretResponse.notBefore().toString())); + secretResponse.getNotBefore().toString())); }); // END: com.azure.keyvault.secrets.secretclient.updateSecret#secretBase } @@ -205,11 +205,11 @@ public void updateSecretWithResponseCodeSnippets() { .subscribe(secretResponseValue -> { Secret secret = secretResponseValue; //Update the not before time of the secret. - secret.notBefore(OffsetDateTime.now().plusDays(50)); + secret.setNotBefore(OffsetDateTime.now().plusDays(50)); secretAsyncClient.updateSecretWithResponse(secret) .subscribe(secretResponse -> System.out.printf("Secret's updated not before time %s \n", - secretResponse.value().notBefore().toString())); + secretResponse.getValue().getNotBefore().toString())); }); // END: com.azure.keyvault.secrets.secretclient.updateSecretWithResponse#secretBase } @@ -223,7 +223,7 @@ public void deleteSecretCodeSnippets() { secretAsyncClient.deleteSecret("secretName") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(deletedSecretResponse -> - System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.recoveryId())); + System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.getRecoveryId())); // END: com.azure.keyvault.secrets.secretclient.deleteSecret#string } @@ -236,7 +236,7 @@ public void deleteSecretWithResponseCodeSnippets() { secretAsyncClient.deleteSecretWithResponse("secretName") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(deletedSecretResponse -> - System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.value().recoveryId())); + System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.getValue().getRecoveryId())); // END: com.azure.keyvault.secrets.secretclient.deleteSecretWithResponse#string } @@ -249,7 +249,7 @@ public void getDeletedSecretCodeSnippets() { secretAsyncClient.getDeletedSecret("secretName") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(deletedSecretResponse -> - System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.recoveryId())); + System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.getRecoveryId())); // END: com.azure.keyvault.secrets.secretclient.getDeletedSecret#string } @@ -262,7 +262,7 @@ public void getDeletedSecretWithResponseCodeSnippets() { secretAsyncClient.getDeletedSecretWithResponse("secretName") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(deletedSecretResponse -> - System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.value().recoveryId())); + System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.getValue().getRecoveryId())); // END: com.azure.keyvault.secrets.secretclient.getDeletedSecretWithResponse#string } @@ -275,7 +275,7 @@ public void purgeDeletedSecretCodeSnippets() { secretAsyncClient.purgeDeletedSecret("deletedSecretName") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(purgeResponse -> - System.out.printf("Purge Status response %d \n", purgeResponse.statusCode())); + System.out.printf("Purge Status response %d \n", purgeResponse.getStatusCode())); // END: com.azure.keyvault.secrets.secretclient.purgeDeletedSecret#string } @@ -288,7 +288,7 @@ public void recoverDeletedSecretCodeSnippets() { secretAsyncClient.recoverDeletedSecret("deletedSecretName") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(recoveredSecretResponse -> - System.out.printf("Recovered Secret with name %s \n", recoveredSecretResponse.name())); + System.out.printf("Recovered Secret with name %s \n", recoveredSecretResponse.getName())); // END: com.azure.keyvault.secrets.secretclient.recoverDeletedSecret#string } @@ -301,7 +301,7 @@ public void recoverDeletedSecretWithResponseCodeSnippets() { secretAsyncClient.recoverDeletedSecretWithResponse("deletedSecretName") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(recoveredSecretResponse -> - System.out.printf("Recovered Secret with name %s \n", recoveredSecretResponse.value().name())); + System.out.printf("Recovered Secret with name %s \n", recoveredSecretResponse.getValue().getName())); // END: com.azure.keyvault.secrets.secretclient.recoverDeletedSecretWithResponse#string } @@ -327,7 +327,7 @@ public void backupSecretWithResponseCodeSnippets() { secretAsyncClient.backupSecretWithResponse("secretName") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(secretBackupResponse -> - System.out.printf("Secret's Backup Byte array's length %s \n", secretBackupResponse.value().length)); + System.out.printf("Secret's Backup Byte array's length %s \n", secretBackupResponse.getValue().length)); // END: com.azure.keyvault.secrets.secretclient.backupSecretWithResponse#string } @@ -341,7 +341,7 @@ public void restoreSecretCodeSnippets() { secretAsyncClient.restoreSecret(secretBackupByteArray) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(secretResponse -> System.out.printf("Restored Secret with name %s and value %s \n", - secretResponse.name(), secretResponse.value())); + secretResponse.getName(), secretResponse.getValue())); // END: com.azure.keyvault.secrets.secretclient.restoreSecret#byte } @@ -355,7 +355,7 @@ public void restoreSecretWithResponseCodeSnippets() { secretAsyncClient.restoreSecretWithResponse(secretBackupByteArray) .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(secretResponse -> System.out.printf("Restored Secret with name %s and value %s \n", - secretResponse.value().name(), secretResponse.value().value())); + secretResponse.getValue().getName(), secretResponse.getValue().getValue())); // END: com.azure.keyvault.secrets.secretclient.restoreSecretWithResponse#byte } @@ -369,7 +369,7 @@ public void listSecretsCodeSnippets() { .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(secretBase -> secretAsyncClient.getSecret(secretBase) .subscribe(secretResponse -> System.out.printf("Received secret with name %s and type %s", - secretResponse.name(), secretResponse.value()))); + secretResponse.getName(), secretResponse.getValue()))); // END: com.azure.keyvault.secrets.secretclient.listSecrets } @@ -382,7 +382,7 @@ public void listDeletedSecretsCodeSnippets() { secretAsyncClient.listDeletedSecrets() .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(deletedSecretResponse -> System.out.printf("Deleted Secret's Recovery Id %s \n", - deletedSecretResponse.recoveryId())); + deletedSecretResponse.getRecoveryId())); // END: com.azure.keyvault.secrets.secretclient.listDeletedSecrets } @@ -396,7 +396,7 @@ public void listSecretVersionsCodeSnippets() { .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(secretBase -> secretAsyncClient.getSecret(secretBase) .subscribe(secretResponse -> System.out.printf("Received secret with name %s and type %s", - secretResponse.name(), secretResponse.value()))); + secretResponse.getName(), secretResponse.getValue()))); // END: com.azure.keyvault.secrets.secretclient.listSecretVersions#string } } diff --git a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretClientJavaDocCodeSnippets.java index 584c69e8b590..93d72f0dad90 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretClientJavaDocCodeSnippets.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretClientJavaDocCodeSnippets.java @@ -30,9 +30,9 @@ public void getSecretCodeSnippets() { SecretClient secretClient = getSecretClient(); // BEGIN: com.azure.security.keyvault.secretclient.getSecret#secretBase for (SecretBase secret : secretClient.listSecrets()) { - Secret secretWithValue = secretClient.getSecret(secret); - System.out.printf("Secret is returned with name %s and value %s %n", secretWithValue.name(), - secretWithValue.value()); + Secret secretWithValue = secretClient.getSecret(secret); + System.out.printf("Secret is returned with name %s and value %s %n", secretWithValue.getName(), + secretWithValue.getValue()); } // END: com.azure.security.keyvault.secretclient.getSecret#secretBase @@ -40,13 +40,13 @@ public void getSecretCodeSnippets() { String secretVersion = "6A385B124DEF4096AF1361A85B16C204"; Secret secretWithVersion = secretClient.getSecret("secretName", secretVersion); System.out.printf("Secret is returned with name %s and value %s \n", - secretWithVersion.name(), secretWithVersion.value()); + secretWithVersion.getName(), secretWithVersion.getValue()); // END: com.azure.security.keyvault.secretclient.getSecret#string-string // BEGIN: com.azure.security.keyvault.secretclient.getSecret#string Secret secretWithoutVersion = secretClient.getSecret("secretName", secretVersion); System.out.printf("Secret is returned with name %s and value %s \n", - secretWithoutVersion.name(), secretWithoutVersion.value()); + secretWithoutVersion.getName(), secretWithoutVersion.getValue()); // END: com.azure.security.keyvault.secretclient.getSecret#string } @@ -57,18 +57,18 @@ public void getSecretWithResponseCodeSnippets() { SecretClient secretClient = getSecretClient(); // BEGIN: com.azure.security.keyvault.secretclient.getSecretWithResponse#secretBase for (SecretBase secret : secretClient.listSecrets()) { - Secret secretWithValue = secretClient.getSecretWithResponse(secret, new Context(key2, value2)).value(); - System.out.printf("Secret is returned with name %s and value %s %n", secretWithValue.name(), - secretWithValue.value()); + Secret secretWithValue = secretClient.getSecretWithResponse(secret, new Context(key2, value2)).getValue(); + System.out.printf("Secret is returned with name %s and value %s %n", secretWithValue.getName(), + secretWithValue.getValue()); } // END: com.azure.security.keyvault.secretclient.getSecretWithResponse#secretBase // BEGIN: com.azure.security.keyvault.secretclient.getSecretWithResponse#string-string-Context String secretVersion = "6A385B124DEF4096AF1361A85B16C204"; Secret secretWithVersion = secretClient.getSecretWithResponse("secretName", secretVersion, - new Context(key2, value2)).value(); + new Context(key2, value2)).getValue(); System.out.printf("Secret is returned with name %s and value %s \n", - secretWithVersion.name(), secretWithVersion.value()); + secretWithVersion.getName(), secretWithVersion.getValue()); // END: com.azure.security.keyvault.secretclient.getSecretWithResponse#string-string-Context } @@ -78,14 +78,15 @@ public void getSecretWithResponseCodeSnippets() { public void setSecretCodeSnippets() { SecretClient secretClient = getSecretClient(); // BEGIN: com.azure.security.keyvault.secretclient.setSecret#secret - Secret newSecret = new Secret("secretName", "secretValue").expires(OffsetDateTime.now().plusDays(60)); + Secret newSecret = new Secret("secretName", "secretValue").setExpires(OffsetDateTime.now().plusDays(60)); Secret returnedSecret = secretClient.setSecret(newSecret); - System.out.printf("Secret is created with name %s and value %s \n", returnedSecret.name(), returnedSecret.value()); + System.out.printf("Secret is created with name %s and value %s \n", returnedSecret.getName(), + returnedSecret.getValue()); // END: com.azure.security.keyvault.secretclient.setSecret#secret // BEGIN: com.azure.security.keyvault.secretclient.setSecret#string-string Secret secret = secretClient.setSecret("secretName", "secretValue"); - System.out.printf("Secret is created with name %s and value %s \n", secret.name(), secret.value()); + System.out.printf("Secret is created with name %s and value %s \n", secret.getName(), secret.getValue()); // END: com.azure.security.keyvault.secretclient.setSecret#string-string } @@ -95,9 +96,9 @@ public void setSecretCodeSnippets() { public void setSecretWithResponseCodeSnippets() { SecretClient secretClient = getSecretClient(); // BEGIN: com.azure.security.keyvault.secretclient.setSecretWithResponse#secret-Context - Secret newSecret = new Secret("secretName", "secretValue").expires(OffsetDateTime.now().plusDays(60)); - Secret secret = secretClient.setSecretWithResponse(newSecret, new Context(key1, value1)).value(); - System.out.printf("Secret is created with name %s and value %s \n", secret.name(), secret.value()); + Secret newSecret = new Secret("secretName", "secretValue").setExpires(OffsetDateTime.now().plusDays(60)); + Secret secret = secretClient.setSecretWithResponse(newSecret, new Context(key1, value1)).getValue(); + System.out.printf("Secret is created with name %s and value %s \n", secret.getName(), secret.getValue()); // END: com.azure.security.keyvault.secretclient.setSecretWithResponse#secret-Context } @@ -108,11 +109,11 @@ public void updateSecretCodeSnippets() { SecretClient secretClient = getSecretClient(); // BEGIN: com.azure.security.keyvault.secretclient.updateSecret#secretBase Secret secret = secretClient.getSecret("secretName"); - secret.expires(OffsetDateTime.now().plusDays(60)); + secret.setExpires(OffsetDateTime.now().plusDays(60)); SecretBase updatedSecretBase = secretClient.updateSecret(secret); - Secret updatedSecret = secretClient.getSecret(updatedSecretBase.name()); + Secret updatedSecret = secretClient.getSecret(updatedSecretBase.getName()); System.out.printf("Updated Secret is returned with name %s, value %s and expires %s \n", - updatedSecret.name(), updatedSecret.value(), updatedSecret.expires()); + updatedSecret.getName(), updatedSecret.getValue(), updatedSecret.getExpires()); // END: com.azure.security.keyvault.secretclient.updateSecret#secretBase } @@ -123,11 +124,12 @@ public void updateSecretWithResponseCodeSnippets() { SecretClient secretClient = getSecretClient(); // BEGIN: com.azure.security.keyvault.secretclient.updateSecretWithResponse#secretBase-Context Secret secret = secretClient.getSecret("secretName"); - secret.expires(OffsetDateTime.now().plusDays(60)); - SecretBase updatedSecretBase = secretClient.updateSecretWithResponse(secret, new Context(key2, value2)).value(); - Secret updatedSecret = secretClient.getSecret(updatedSecretBase.name()); + secret.setExpires(OffsetDateTime.now().plusDays(60)); + SecretBase updatedSecretBase = secretClient.updateSecretWithResponse(secret, new Context(key2, value2)) + .getValue(); + Secret updatedSecret = secretClient.getSecret(updatedSecretBase.getName()); System.out.printf("Updated Secret is returned with name %s, value %s and expires %s \n", - updatedSecret.name(), updatedSecret.value(), updatedSecret.expires()); + updatedSecret.getName(), updatedSecret.getValue(), updatedSecret.getExpires()); // END: com.azure.security.keyvault.secretclient.updateSecretWithResponse#secretBase-Context } @@ -138,7 +140,7 @@ public void deleteSecretCodeSnippets() { SecretClient secretClient = getSecretClient(); // BEGIN: com.azure.security.keyvault.secretclient.deleteSecret#string DeletedSecret deletedSecret = secretClient.deleteSecret("secretName"); - System.out.printf("Deleted Secret's Recovery Id %s", deletedSecret.recoveryId()); + System.out.printf("Deleted Secret's Recovery Id %s", deletedSecret.getRecoveryId()); // END: com.azure.security.keyvault.secretclient.deleteSecret#string } @@ -149,8 +151,8 @@ public void deleteSecretWithResponseCodeSnippets() { SecretClient secretClient = getSecretClient(); // BEGIN: com.azure.security.keyvault.secretclient.deleteSecretWithResponse#string-Context DeletedSecret deletedSecret = secretClient.deleteSecretWithResponse("secretName", - new Context(key2, value2)).value(); - System.out.printf("Deleted Secret's Recovery Id %s", deletedSecret.recoveryId()); + new Context(key2, value2)).getValue(); + System.out.printf("Deleted Secret's Recovery Id %s", deletedSecret.getRecoveryId()); // END: com.azure.security.keyvault.secretclient.deleteSecretWithResponse#string-Context } @@ -161,7 +163,7 @@ public void getDeletedSecretCodeSnippets() { SecretClient secretClient = getSecretClient(); // BEGIN: com.azure.security.keyvault.secretclient.getDeletedSecret#string DeletedSecret deletedSecret = secretClient.getDeletedSecret("secretName"); - System.out.printf("Deleted Secret's Recovery Id %s", deletedSecret.recoveryId()); + System.out.printf("Deleted Secret's Recovery Id %s", deletedSecret.getRecoveryId()); // END: com.azure.security.keyvault.secretclient.getDeletedSecret#string } @@ -172,8 +174,8 @@ public void getDeletedSecretWithResponseCodeSnippets() { SecretClient secretClient = getSecretClient(); // BEGIN: com.azure.security.keyvault.secretclient.getDeletedSecretWithResponse#string-Context DeletedSecret deletedSecret = secretClient.getDeletedSecretWithResponse("secretName", - new Context(key2, value2)).value(); - System.out.printf("Deleted Secret's Recovery Id %s", deletedSecret.recoveryId()); + new Context(key2, value2)).getValue(); + System.out.printf("Deleted Secret's Recovery Id %s", deletedSecret.getRecoveryId()); // END: com.azure.security.keyvault.secretclient.getDeletedSecretWithResponse#string-Context } @@ -184,12 +186,12 @@ public void purgeDeletedSecretCodeSnippets() { SecretClient secretClient = getSecretClient(); // BEGIN: com.azure.security.keyvault.secretclient.purgeDeletedSecret#string VoidResponse purgeResponse = secretClient.purgeDeletedSecret("secretName"); - System.out.printf("Purge Status Code: %d", purgeResponse.statusCode()); + System.out.printf("Purge Status Code: %d", purgeResponse.getStatusCode()); // END: com.azure.security.keyvault.secretclient.purgeDeletedSecret#string // BEGIN: com.azure.security.keyvault.secretclient.purgeDeletedSecret#string-Context VoidResponse purgedResponse = secretClient.purgeDeletedSecret("secretName", new Context(key2, value2)); - System.out.printf("Purge Status Code: %d", purgedResponse.statusCode()); + System.out.printf("Purge Status Code: %d", purgedResponse.getStatusCode()); // END: com.azure.security.keyvault.secretclient.purgeDeletedSecret#string-Context } @@ -200,7 +202,7 @@ public void recoverDeletedSecretCodeSnippets() { SecretClient secretClient = getSecretClient(); // BEGIN: com.azure.security.keyvault.secretclient.recoverDeletedSecret#string Secret recoveredSecret = secretClient.recoverDeletedSecret("secretName"); - System.out.printf("Recovered Secret with name %s", recoveredSecret.name()); + System.out.printf("Recovered Secret with name %s", recoveredSecret.getName()); // END: com.azure.security.keyvault.secretclient.recoverDeletedSecret#string } @@ -211,8 +213,8 @@ public void recoverDeletedSecretWithResponseCodeSnippets() { SecretClient secretClient = getSecretClient(); // BEGIN: com.azure.security.keyvault.secretclient.recoverDeletedSecretWithResponse#string-Context Secret recoveredSecret = secretClient.recoverDeletedSecretWithResponse("secretName", - new Context(key1, value1)).value(); - System.out.printf("Recovered Secret with name %s", recoveredSecret.name()); + new Context(key1, value1)).getValue(); + System.out.printf("Recovered Secret with name %s", recoveredSecret.getName()); // END: com.azure.security.keyvault.secretclient.recoverDeletedSecretWithResponse#string-Context } @@ -234,7 +236,7 @@ public void backupSecretWithResponseCodeSnippets() { SecretClient secretClient = getSecretClient(); // BEGIN: com.azure.security.keyvault.secretclient.backupSecretWithResponse#string-Context byte[] secretBackup = secretClient.backupSecretWithResponse("secretName", - new Context(key1, value1)).value(); + new Context(key1, value1)).getValue(); System.out.printf("Secret's Backup Byte array's length %s", secretBackup.length); // END: com.azure.security.keyvault.secretclient.backupSecretWithResponse#string-Context } @@ -247,7 +249,8 @@ public void restoreSecretCodeSnippets() { // BEGIN: com.azure.security.keyvault.secretclient.restoreSecret#byte byte[] secretBackupByteArray = {}; Secret restoredSecret = secretClient.restoreSecret(secretBackupByteArray); - System.out.printf("Restored Secret with name %s and value %s", restoredSecret.name(), restoredSecret.value()); + System.out + .printf("Restored Secret with name %s and value %s", restoredSecret.getName(), restoredSecret.getValue()); // END: com.azure.security.keyvault.secretclient.restoreSecret#byte } @@ -259,8 +262,9 @@ public void restoreSecretWithResponseCodeSnippets() { // BEGIN: com.azure.security.keyvault.secretclient.restoreSecretWithResponse#byte-Context byte[] secretBackupByteArray = {}; Secret restoredSecret = secretClient.restoreSecretWithResponse(secretBackupByteArray, - new Context(key2, value2)).value(); - System.out.printf("Restored Secret with name %s and value %s", restoredSecret.name(), restoredSecret.value()); + new Context(key2, value2)).getValue(); + System.out + .printf("Restored Secret with name %s and value %s", restoredSecret.getName(), restoredSecret.getValue()); // END: com.azure.security.keyvault.secretclient.restoreSecretWithResponse#byte-Context } @@ -271,28 +275,28 @@ public void listSecretsCodeSnippets() { SecretClient secretClient = getSecretClient(); // BEGIN: com.azure.security.keyvault.secretclient.listSecrets for (SecretBase secret : secretClient.listSecrets()) { - Secret secretWithValue = secretClient.getSecret(secret); + Secret secretWithValue = secretClient.getSecret(secret); System.out.printf("Received secret with name %s and value %s", - secretWithValue.name(), secretWithValue.value()); + secretWithValue.getName(), secretWithValue.getValue()); } // END: com.azure.security.keyvault.secretclient.listSecrets // BEGIN: com.azure.security.keyvault.secretclient.listSecrets#Context for (SecretBase secret : secretClient.listSecrets(new Context(key1, value2))) { - Secret secretWithValue = secretClient.getSecret(secret); + Secret secretWithValue = secretClient.getSecret(secret); System.out.printf("Received secret with name %s and value %s", - secretWithValue.name(), secretWithValue.value()); + secretWithValue.getName(), secretWithValue.getValue()); } // END: com.azure.security.keyvault.secretclient.listSecrets#Context // BEGIN: com.azure.security.keyvault.secretclient.listSecrets.iterableByPage secretClient.listSecrets().iterableByPage().forEach(resp -> { - System.out.printf("Response headers are %s. Url %s and status code %d %n", resp.headers(), - resp.request().url(), resp.statusCode()); - resp.items().forEach(value -> { - Secret secretWithValue = secretClient.getSecret(value); + System.out.printf("Response headers are %s. Url %s and status code %d %n", resp.getHeaders(), + resp.getRequest().getUrl(), resp.getStatusCode()); + resp.getItems().forEach(value -> { + Secret secretWithValue = secretClient.getSecret(value); System.out.printf("Received secret with name %s and value %s", - secretWithValue.name(), secretWithValue.value()); + secretWithValue.getName(), secretWithValue.getValue()); }); }); // END: com.azure.security.keyvault.secretclient.listSecrets.iterableByPage @@ -305,22 +309,22 @@ public void listDeletedSecretsCodeSnippets() { SecretClient secretClient = getSecretClient(); // BEGIN: com.azure.security.keyvault.secretclient.listDeletedSecrets for (DeletedSecret deletedSecret : secretClient.listDeletedSecrets()) { - System.out.printf("Deleted secret's recovery Id %s", deletedSecret.recoveryId()); + System.out.printf("Deleted secret's recovery Id %s", deletedSecret.getRecoveryId()); } // END: com.azure.security.keyvault.secretclient.listDeletedSecrets // BEGIN: com.azure.security.keyvault.secretclient.listDeletedSecrets#Context for (DeletedSecret deletedSecret : secretClient.listDeletedSecrets(new Context(key1, value2))) { - System.out.printf("Deleted secret's recovery Id %s", deletedSecret.recoveryId()); + System.out.printf("Deleted secret's recovery Id %s", deletedSecret.getRecoveryId()); } // END: com.azure.security.keyvault.secretclient.listDeletedSecrets#Context // BEGIN: com.azure.security.keyvault.secretclient.listDeletedSecrets.iterableByPage secretClient.listDeletedSecrets().iterableByPage().forEach(resp -> { System.out.printf("Got response headers . Url: %s, Status code: %d %n", - resp.request().url(), resp.statusCode()); - resp.items().forEach(value -> { - System.out.printf("Deleted secret's recovery Id %s", value.recoveryId()); + resp.getRequest().getUrl(), resp.getStatusCode()); + resp.getItems().forEach(value -> { + System.out.printf("Deleted secret's recovery Id %s", value.getRecoveryId()); }); }); // END: com.azure.security.keyvault.secretclient.listDeletedSecrets.iterableByPage @@ -333,28 +337,28 @@ public void listSecretVersionsCodeSnippets() { SecretClient secretClient = getSecretClient(); // BEGIN: com.azure.security.keyvault.secretclient.listSecretVersions#string for (SecretBase secret : secretClient.listSecretVersions("secretName")) { - Secret secretWithValue = secretClient.getSecret(secret); + Secret secretWithValue = secretClient.getSecret(secret); System.out.printf("Received secret's version with name %s and value %s", - secretWithValue.name(), secretWithValue.value()); + secretWithValue.getName(), secretWithValue.getValue()); } // END: com.azure.security.keyvault.secretclient.listSecretVersions#string // BEGIN: com.azure.security.keyvault.secretclient.listSecretVersions#string-Context for (SecretBase secret : secretClient.listSecretVersions("secretName", new Context(key1, value2))) { - Secret secretWithValue = secretClient.getSecret(secret); + Secret secretWithValue = secretClient.getSecret(secret); System.out.printf("Received secret's version with name %s and value %s", - secretWithValue.name(), secretWithValue.value()); + secretWithValue.getName(), secretWithValue.getValue()); } // END: com.azure.security.keyvault.secretclient.listSecretVersions#string-Context // BEGIN: com.azure.security.keyvault.secretclient.listSecretVersions#string-Context-iterableByPage secretClient.listSecretVersions("secretName", new Context(key1, value2)).iterableByPage().forEach(resp -> { System.out.printf("Got response headers . Url: %s, Status code: %d %n", - resp.request().url(), resp.statusCode()); - resp.items().forEach(value -> { - Secret secretWithValue = secretClient.getSecret(value); + resp.getRequest().getUrl(), resp.getStatusCode()); + resp.getItems().forEach(value -> { + Secret secretWithValue = secretClient.getSecret(value); System.out.printf("Received secret's version with name %s and value %s", - secretWithValue.name(), secretWithValue.value()); + secretWithValue.getName(), secretWithValue.getValue()); }); }); // END: com.azure.security.keyvault.secretclient.listSecretVersions#string-Context-iterableByPage @@ -362,6 +366,7 @@ public void listSecretVersionsCodeSnippets() { /** * Implementation for sync SecretClient + * * @return sync SecretClient */ private SecretClient getSyncSecretClientCodeSnippets() { @@ -378,6 +383,7 @@ private SecretClient getSyncSecretClientCodeSnippets() { /** * Implementation not provided for this method + * * @return {@code null} */ private SecretClient getSecretClient() { diff --git a/sdk/keyvault/azure-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretAsyncClientTest.java b/sdk/keyvault/azure-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretAsyncClientTest.java index e06023231cb8..35ed9f40f673 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretAsyncClientTest.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretAsyncClientTest.java @@ -9,10 +9,10 @@ import com.azure.security.keyvault.secrets.models.DeletedSecret; import com.azure.security.keyvault.secrets.models.Secret; import com.azure.security.keyvault.secrets.models.SecretBase; -import io.netty.handler.codec.http.HttpResponseStatus; import org.junit.Assert; import reactor.test.StepVerifier; +import java.net.HttpURLConnection; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -57,7 +57,7 @@ public void setSecret() { */ public void setSecretEmptyName() { StepVerifier.create(client.setSecret("", "A value")) - .verifyErrorSatisfies(ex -> assertRestException(ex, HttpResponseException.class, HttpResponseStatus.METHOD_NOT_ALLOWED.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, HttpResponseException.class, HttpURLConnection.HTTP_BAD_METHOD)); } /** @@ -66,11 +66,11 @@ public void setSecretEmptyName() { public void setSecretEmptyValue() { setSecretEmptyValueRunner((secret) -> { - StepVerifier.create(client.setSecret(secret.name(), secret.value())) + StepVerifier.create(client.setSecret(secret.getName(), secret.getValue())) .assertNext(response -> assertSecretEquals(secret, response)) .verifyComplete(); - StepVerifier.create(client.getSecret(secret.name())) + StepVerifier.create(client.getSecret(secret.getName())) .assertNext(response -> assertSecretEquals(secret, response)) .verifyComplete(); }); @@ -91,15 +91,15 @@ public void updateSecret() { StepVerifier.create(client.setSecret(original)) .assertNext(response -> assertSecretEquals(original, response)) .verifyComplete(); - Secret secretToUpdate = client.getSecret(original.name()).block(); + Secret secretToUpdate = client.getSecret(original.getName()).block(); - StepVerifier.create(client.updateSecret(secretToUpdate.expires(updated.expires()))) + StepVerifier.create(client.updateSecret(secretToUpdate.setExpires(updated.getExpires()))) .assertNext(response -> { assertNotNull(response); - Assert.assertEquals(original.name(), response.name()); + Assert.assertEquals(original.getName(), response.getName()); }).verifyComplete(); - StepVerifier.create(client.getSecret(original.name())) + StepVerifier.create(client.getSecret(original.getName())) .assertNext(updatedSecretResponse -> assertSecretEquals(updated, updatedSecretResponse)) .verifyComplete(); }); @@ -114,8 +114,8 @@ public void updateDisabledSecret() { .assertNext(response -> assertSecretEquals(original, response)) .verifyComplete(); - StepVerifier.create(client.getSecret(original.name())) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpResponseStatus.FORBIDDEN.code())); + StepVerifier.create(client.getSecret(original.getName())) + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpURLConnection.HTTP_FORBIDDEN)); }); } @@ -126,7 +126,7 @@ public void updateDisabledSecret() { public void getSecret() { getSecretRunner((original) -> { client.setSecret(original); - StepVerifier.create(client.getSecret(original.name())) + StepVerifier.create(client.getSecret(original.getName())) .assertNext(response -> assertSecretEquals(original, response)) .verifyComplete(); }); @@ -140,11 +140,11 @@ public void getSecretSpecificVersion() { final Secret secretVersionOne = client.setSecret(secret).block(); final Secret secretVersionTwo = client.setSecret(secretWithNewVal).block(); - StepVerifier.create(client.getSecret(secret.name(), secretVersionOne.version())) + StepVerifier.create(client.getSecret(secret.getName(), secretVersionOne.getVersion())) .assertNext(response -> assertSecretEquals(secret, response)) .verifyComplete(); - StepVerifier.create(client.getSecret(secretWithNewVal.name(), secretVersionTwo.version())) + StepVerifier.create(client.getSecret(secretWithNewVal.getName(), secretVersionTwo.getVersion())) .assertNext(response -> assertSecretEquals(secretWithNewVal, response)) .verifyComplete(); }); @@ -155,7 +155,7 @@ public void getSecretSpecificVersion() { */ public void getSecretNotFound() { StepVerifier.create(client.getSecret("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); } @@ -169,18 +169,18 @@ public void deleteSecret() { assertSecretEquals(secretToDelete, secretResponse); }).verifyComplete(); - StepVerifier.create(client.deleteSecret(secretToDelete.name())) + StepVerifier.create(client.deleteSecret(secretToDelete.getName())) .assertNext(deletedSecretResponse -> { - assertNotNull(deletedSecretResponse.deletedDate()); - assertNotNull(deletedSecretResponse.recoveryId()); - assertNotNull(deletedSecretResponse.scheduledPurgeDate()); - Assert.assertEquals(secretToDelete.name(), deletedSecretResponse.name()); + assertNotNull(deletedSecretResponse.getDeletedDate()); + assertNotNull(deletedSecretResponse.getRecoveryId()); + assertNotNull(deletedSecretResponse.getScheduledPurgeDate()); + Assert.assertEquals(secretToDelete.getName(), deletedSecretResponse.getName()); }).verifyComplete(); sleepInRecordMode(30000); - StepVerifier.create(client.purgeDeletedSecret(secretToDelete.name())) + StepVerifier.create(client.purgeDeletedSecret(secretToDelete.getName())) .assertNext(voidResponse -> { - assertEquals(HttpResponseStatus.NO_CONTENT.code(), voidResponse.statusCode()); + assertEquals(HttpURLConnection.HTTP_NO_CONTENT, voidResponse.getStatusCode()); }).verifyComplete(); sleepInRecordMode(15000); }); @@ -188,7 +188,7 @@ public void deleteSecret() { public void deleteSecretNotFound() { StepVerifier.create(client.deleteSecret("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); } /** @@ -201,26 +201,26 @@ public void getDeletedSecret() { assertSecretEquals(secretToDeleteAndGet, secretResponse); }).verifyComplete(); - StepVerifier.create(client.deleteSecret(secretToDeleteAndGet.name())) + StepVerifier.create(client.deleteSecret(secretToDeleteAndGet.getName())) .assertNext(deletedSecretResponse -> { assertNotNull(deletedSecretResponse); }).verifyComplete(); - pollOnSecretDeletion(secretToDeleteAndGet.name()); + pollOnSecretDeletion(secretToDeleteAndGet.getName()); sleepInRecordMode(30000); - StepVerifier.create(client.getDeletedSecret(secretToDeleteAndGet.name())) + StepVerifier.create(client.getDeletedSecret(secretToDeleteAndGet.getName())) .assertNext(deletedSecretResponse -> { - assertNotNull(deletedSecretResponse.deletedDate()); - assertNotNull(deletedSecretResponse.recoveryId()); - assertNotNull(deletedSecretResponse.scheduledPurgeDate()); - Assert.assertEquals(secretToDeleteAndGet.name(), deletedSecretResponse.name()); + assertNotNull(deletedSecretResponse.getDeletedDate()); + assertNotNull(deletedSecretResponse.getRecoveryId()); + assertNotNull(deletedSecretResponse.getScheduledPurgeDate()); + Assert.assertEquals(secretToDeleteAndGet.getName(), deletedSecretResponse.getName()); }).verifyComplete(); - StepVerifier.create(client.purgeDeletedSecret(secretToDeleteAndGet.name())) + StepVerifier.create(client.purgeDeletedSecret(secretToDeleteAndGet.getName())) .assertNext(voidResponse -> { - assertEquals(HttpResponseStatus.NO_CONTENT.code(), voidResponse.statusCode()); + assertEquals(HttpURLConnection.HTTP_NO_CONTENT, voidResponse.getStatusCode()); }).verifyComplete(); - pollOnSecretPurge(secretToDeleteAndGet.name()); + pollOnSecretPurge(secretToDeleteAndGet.getName()); sleepInRecordMode(10000); }); } @@ -230,7 +230,7 @@ public void getDeletedSecret() { */ public void getDeletedSecretNotFound() { StepVerifier.create(client.getDeletedSecret("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); } /** @@ -243,15 +243,15 @@ public void recoverDeletedSecret() { assertSecretEquals(secretToDeleteAndRecover, secretResponse); }).verifyComplete(); - StepVerifier.create(client.deleteSecret(secretToDeleteAndRecover.name())) + StepVerifier.create(client.deleteSecret(secretToDeleteAndRecover.getName())) .assertNext(Assert::assertNotNull).verifyComplete(); sleepInRecordMode(30000); - StepVerifier.create(client.recoverDeletedSecret(secretToDeleteAndRecover.name())) + StepVerifier.create(client.recoverDeletedSecret(secretToDeleteAndRecover.getName())) .assertNext(secretResponse -> { - Assert.assertEquals(secretToDeleteAndRecover.name(), secretResponse.name()); - Assert.assertEquals(secretToDeleteAndRecover.notBefore(), secretResponse.notBefore()); - Assert.assertEquals(secretToDeleteAndRecover.expires(), secretResponse.expires()); + Assert.assertEquals(secretToDeleteAndRecover.getName(), secretResponse.getName()); + Assert.assertEquals(secretToDeleteAndRecover.getNotBefore(), secretResponse.getNotBefore()); + Assert.assertEquals(secretToDeleteAndRecover.getExpires(), secretResponse.getExpires()); }).verifyComplete(); }); } @@ -261,7 +261,7 @@ public void recoverDeletedSecret() { */ public void recoverDeletedSecretNotFound() { StepVerifier.create(client.recoverDeletedSecret("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); } /** @@ -274,7 +274,7 @@ public void backupSecret() { assertSecretEquals(secretToBackup, secretResponse); }).verifyComplete(); - StepVerifier.create(client.backupSecret(secretToBackup.name())) + StepVerifier.create(client.backupSecret(secretToBackup.getName())) .assertNext(response -> { byte[] backupBytes = response; assertNotNull(backupBytes); @@ -288,7 +288,7 @@ public void backupSecret() { */ public void backupSecretNotFound() { StepVerifier.create(client.backupSecret("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); } /** @@ -300,25 +300,25 @@ public void restoreSecret() { .assertNext(secretResponse -> { assertSecretEquals(secretToBackupAndRestore, secretResponse); }).verifyComplete(); - byte[] backup = client.backupSecret(secretToBackupAndRestore.name()).block(); + byte[] backup = client.backupSecret(secretToBackupAndRestore.getName()).block(); - StepVerifier.create(client.deleteSecret(secretToBackupAndRestore.name())) + StepVerifier.create(client.deleteSecret(secretToBackupAndRestore.getName())) .assertNext(Assert::assertNotNull).verifyComplete(); - pollOnSecretDeletion(secretToBackupAndRestore.name()); + pollOnSecretDeletion(secretToBackupAndRestore.getName()); - StepVerifier.create(client.purgeDeletedSecret(secretToBackupAndRestore.name())) + StepVerifier.create(client.purgeDeletedSecret(secretToBackupAndRestore.getName())) .assertNext(voidResponse -> { - assertEquals(HttpResponseStatus.NO_CONTENT.code(), voidResponse.statusCode()); + assertEquals(HttpURLConnection.HTTP_NO_CONTENT, voidResponse.getStatusCode()); }).verifyComplete(); - pollOnSecretPurge(secretToBackupAndRestore.name()); + pollOnSecretPurge(secretToBackupAndRestore.getName()); sleepInRecordMode(60000); StepVerifier.create(client.restoreSecret(backup)) .assertNext(response -> { - Assert.assertEquals(secretToBackupAndRestore.name(), response.name()); - Assert.assertEquals(secretToBackupAndRestore.notBefore(), response.notBefore()); - Assert.assertEquals(secretToBackupAndRestore.expires(), response.expires()); + Assert.assertEquals(secretToBackupAndRestore.getName(), response.getName()); + Assert.assertEquals(secretToBackupAndRestore.getNotBefore(), response.getNotBefore()); + Assert.assertEquals(secretToBackupAndRestore.getExpires(), response.getExpires()); }).verifyComplete(); }); } @@ -329,7 +329,7 @@ public void restoreSecret() { public void restoreSecretFromMalformedBackup() { byte[] secretBackupBytes = "non-existing".getBytes(); StepVerifier.create(client.restoreSecret(secretBackupBytes)) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpResponseStatus.BAD_REQUEST.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpURLConnection.HTTP_BAD_REQUEST)); } /** @@ -349,9 +349,9 @@ public void listDeletedSecrets() { sleepInRecordMode(10000); for (Secret secret : secrets.values()) { - StepVerifier.create(client.deleteSecret(secret.name())) + StepVerifier.create(client.deleteSecret(secret.getName())) .assertNext(Assert::assertNotNull).verifyComplete(); - pollOnSecretDeletion(secret.name()); + pollOnSecretDeletion(secret.getName()); } sleepInRecordMode(35000); @@ -359,21 +359,21 @@ public void listDeletedSecrets() { sleepInRecordMode(30000); for (DeletedSecret actualSecret : deletedSecrets) { - if (secrets.containsKey(actualSecret.name())) { - assertNotNull(actualSecret.deletedDate()); - assertNotNull(actualSecret.recoveryId()); - secrets.remove(actualSecret.name()); + if (secrets.containsKey(actualSecret.getName())) { + assertNotNull(actualSecret.getDeletedDate()); + assertNotNull(actualSecret.getRecoveryId()); + secrets.remove(actualSecret.getName()); } } assertEquals(0, secrets.size()); for (DeletedSecret deletedSecret : deletedSecrets) { - StepVerifier.create(client.purgeDeletedSecret(deletedSecret.name())) + StepVerifier.create(client.purgeDeletedSecret(deletedSecret.getName())) .assertNext(voidResponse -> { - assertEquals(HttpResponseStatus.NO_CONTENT.code(), voidResponse.statusCode()); + assertEquals(HttpURLConnection.HTTP_NO_CONTENT, voidResponse.getStatusCode()); }).verifyComplete(); - pollOnSecretPurge(deletedSecret.name()); + pollOnSecretPurge(deletedSecret.getName()); } }); } @@ -387,7 +387,7 @@ public void listSecretVersions() { List output = new ArrayList<>(); String secretName = null; for (Secret secret : secrets) { - secretName = secret.name(); + secretName = secret.getName(); client.setSecret(secret).subscribe(secretResponse -> assertSecretEquals(secret, secretResponse)); sleepInRecordMode(1000); } @@ -404,7 +404,7 @@ public void listSecretVersions() { StepVerifier.create(client.purgeDeletedSecret(secretName)) .assertNext(voidResponse -> { - assertEquals(HttpResponseStatus.NO_CONTENT.code(), voidResponse.statusCode()); + assertEquals(HttpURLConnection.HTTP_NO_CONTENT, voidResponse.getStatusCode()); }).verifyComplete(); pollOnSecretPurge(secretName); }); @@ -427,11 +427,11 @@ public void listSecrets() { sleepInRecordMode(30000); for (SecretBase actualSecret : output) { - if (secretsToList.containsKey(actualSecret.name())) { - Secret expectedSecret = secrets.get(actualSecret.name()); - assertEquals(expectedSecret.expires(), actualSecret.expires()); - assertEquals(expectedSecret.notBefore(), actualSecret.notBefore()); - secrets.remove(actualSecret.name()); + if (secretsToList.containsKey(actualSecret.getName())) { + Secret expectedSecret = secrets.get(actualSecret.getName()); + assertEquals(expectedSecret.getExpires(), actualSecret.getExpires()); + assertEquals(expectedSecret.getNotBefore(), actualSecret.getNotBefore()); + secrets.remove(actualSecret.getName()); } } assertEquals(0, secrets.size()); diff --git a/sdk/keyvault/azure-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretClientTest.java b/sdk/keyvault/azure-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretClientTest.java index 44aae7498858..3fbb471c4824 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretClientTest.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretClientTest.java @@ -8,8 +8,8 @@ import com.azure.security.keyvault.secrets.models.DeletedSecret; import com.azure.security.keyvault.secrets.models.Secret; import com.azure.security.keyvault.secrets.models.SecretBase; -import io.netty.handler.codec.http.HttpResponseStatus; +import java.net.HttpURLConnection; import java.util.ArrayList; import java.util.List; @@ -49,7 +49,7 @@ public void setSecret() { * Tests that we cannot create a secret when the secret is an empty string. */ public void setSecretEmptyName() { - assertRestException(() -> client.setSecret("", "A value"), HttpResponseStatus.METHOD_NOT_ALLOWED.code()); + assertRestException(() -> client.setSecret("", "A value"), HttpURLConnection.HTTP_BAD_METHOD); } /** @@ -57,8 +57,8 @@ public void setSecretEmptyName() { */ public void setSecretEmptyValue() { setSecretEmptyValueRunner((secret) -> { - assertSecretEquals(secret, client.setSecret(secret.name(), secret.value())); - assertSecretEquals(secret, client.getSecret(secret.name())); + assertSecretEquals(secret, client.setSecret(secret.getName(), secret.getValue())); + assertSecretEquals(secret, client.getSecret(secret.getName())); }); } @@ -75,9 +75,9 @@ public void setSecretNull() { public void updateSecret() { updateSecretRunner((original, updated) -> { assertSecretEquals(original, client.setSecret(original)); - Secret secretToUpdate = client.getSecret(original.name()); - client.updateSecret(secretToUpdate.expires(updated.expires())); - assertSecretEquals(updated, client.getSecret(original.name())); + Secret secretToUpdate = client.getSecret(original.getName()); + client.updateSecret(secretToUpdate.setExpires(updated.getExpires())); + assertSecretEquals(updated, client.getSecret(original.getName())); }); } @@ -87,7 +87,7 @@ public void updateSecret() { public void updateDisabledSecret() { updateDisabledSecretRunner((original, updated) -> { assertSecretEquals(original, client.setSecret(original)); - assertRestException(() -> client.getSecret(original.name()), ResourceModifiedException.class, HttpResponseStatus.FORBIDDEN.code()); + assertRestException(() -> client.getSecret(original.getName()), ResourceModifiedException.class, HttpURLConnection.HTTP_FORBIDDEN); }); } @@ -97,7 +97,7 @@ public void updateDisabledSecret() { public void getSecret() { getSecretRunner((original) -> { client.setSecret(original); - assertSecretEquals(original, client.getSecret(original.name())); + assertSecretEquals(original, client.getSecret(original.getName())); }); } @@ -108,8 +108,8 @@ public void getSecretSpecificVersion() { getSecretSpecificVersionRunner((secret, secretWithNewVal) -> { Secret secretVersionOne = client.setSecret(secret); Secret secretVersionTwo = client.setSecret(secretWithNewVal); - assertSecretEquals(secret, client.getSecret(secretVersionOne.name(), secretVersionOne.version())); - assertSecretEquals(secretWithNewVal, client.getSecret(secretVersionTwo.name(), secretVersionTwo.version())); + assertSecretEquals(secret, client.getSecret(secretVersionOne.getName(), secretVersionOne.getVersion())); + assertSecretEquals(secretWithNewVal, client.getSecret(secretVersionTwo.getName(), secretVersionTwo.getVersion())); }); } @@ -117,7 +117,7 @@ public void getSecretSpecificVersion() { * Tests that an attempt to get a non-existing secret throws an error. */ public void getSecretNotFound() { - assertRestException(() -> client.getSecret("non-existing"), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.getSecret("non-existing"), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); } /** @@ -126,19 +126,19 @@ public void getSecretNotFound() { public void deleteSecret() { deleteSecretRunner((secretToDelete) -> { assertSecretEquals(secretToDelete, client.setSecret(secretToDelete)); - DeletedSecret deletedSecret = client.deleteSecret(secretToDelete.name()); - pollOnSecretDeletion(secretToDelete.name()); - assertNotNull(deletedSecret.deletedDate()); - assertNotNull(deletedSecret.recoveryId()); - assertNotNull(deletedSecret.scheduledPurgeDate()); - assertEquals(secretToDelete.name(), deletedSecret.name()); - client.purgeDeletedSecret(secretToDelete.name()); - pollOnSecretPurge(secretToDelete.name()); + DeletedSecret deletedSecret = client.deleteSecret(secretToDelete.getName()); + pollOnSecretDeletion(secretToDelete.getName()); + assertNotNull(deletedSecret.getDeletedDate()); + assertNotNull(deletedSecret.getRecoveryId()); + assertNotNull(deletedSecret.getScheduledPurgeDate()); + assertEquals(secretToDelete.getName(), deletedSecret.getName()); + client.purgeDeletedSecret(secretToDelete.getName()); + pollOnSecretPurge(secretToDelete.getName()); }); } public void deleteSecretNotFound() { - assertRestException(() -> client.deleteSecret("non-existing"), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.deleteSecret("non-existing"), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); } /** @@ -147,16 +147,16 @@ public void deleteSecretNotFound() { public void getDeletedSecret() { getDeletedSecretRunner((secretToDeleteAndGet) -> { assertSecretEquals(secretToDeleteAndGet, client.setSecret(secretToDeleteAndGet)); - assertNotNull(client.deleteSecret(secretToDeleteAndGet.name())); - pollOnSecretDeletion(secretToDeleteAndGet.name()); + assertNotNull(client.deleteSecret(secretToDeleteAndGet.getName())); + pollOnSecretDeletion(secretToDeleteAndGet.getName()); sleepInRecordMode(30000); - DeletedSecret deletedSecret = client.getDeletedSecret(secretToDeleteAndGet.name()); - assertNotNull(deletedSecret.deletedDate()); - assertNotNull(deletedSecret.recoveryId()); - assertNotNull(deletedSecret.scheduledPurgeDate()); - assertEquals(secretToDeleteAndGet.name(), deletedSecret.name()); - client.purgeDeletedSecret(secretToDeleteAndGet.name()); - pollOnSecretPurge(secretToDeleteAndGet.name()); + DeletedSecret deletedSecret = client.getDeletedSecret(secretToDeleteAndGet.getName()); + assertNotNull(deletedSecret.getDeletedDate()); + assertNotNull(deletedSecret.getRecoveryId()); + assertNotNull(deletedSecret.getScheduledPurgeDate()); + assertEquals(secretToDeleteAndGet.getName(), deletedSecret.getName()); + client.purgeDeletedSecret(secretToDeleteAndGet.getName()); + pollOnSecretPurge(secretToDeleteAndGet.getName()); sleepInRecordMode(10000); }); } @@ -165,7 +165,7 @@ public void getDeletedSecret() { * Tests that an attempt to retrieve a non existing deleted secret throws an error on a soft-delete enabled vault. */ public void getDeletedSecretNotFound() { - assertRestException(() -> client.getDeletedSecret("non-existing"), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.getDeletedSecret("non-existing"), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); } @@ -175,12 +175,12 @@ public void getDeletedSecretNotFound() { public void recoverDeletedSecret() { recoverDeletedSecretRunner((secretToDeleteAndRecover) -> { assertSecretEquals(secretToDeleteAndRecover, client.setSecret(secretToDeleteAndRecover)); - assertNotNull(client.deleteSecret(secretToDeleteAndRecover.name())); - pollOnSecretDeletion(secretToDeleteAndRecover.name()); - Secret recoveredSecret = client.recoverDeletedSecret(secretToDeleteAndRecover.name()); - assertEquals(secretToDeleteAndRecover.name(), recoveredSecret.name()); - assertEquals(secretToDeleteAndRecover.notBefore(), recoveredSecret.notBefore()); - assertEquals(secretToDeleteAndRecover.expires(), recoveredSecret.expires()); + assertNotNull(client.deleteSecret(secretToDeleteAndRecover.getName())); + pollOnSecretDeletion(secretToDeleteAndRecover.getName()); + Secret recoveredSecret = client.recoverDeletedSecret(secretToDeleteAndRecover.getName()); + assertEquals(secretToDeleteAndRecover.getName(), recoveredSecret.getName()); + assertEquals(secretToDeleteAndRecover.getNotBefore(), recoveredSecret.getNotBefore()); + assertEquals(secretToDeleteAndRecover.getExpires(), recoveredSecret.getExpires()); }); } @@ -188,7 +188,7 @@ public void recoverDeletedSecret() { * Tests that an attempt to recover a non existing deleted secret throws an error on a soft-delete enabled vault. */ public void recoverDeletedSecretNotFound() { - assertRestException(() -> client.recoverDeletedSecret("non-existing"), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.recoverDeletedSecret("non-existing"), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); } /** @@ -197,7 +197,7 @@ public void recoverDeletedSecretNotFound() { public void backupSecret() { backupSecretRunner((secretToBackup) -> { assertSecretEquals(secretToBackup, client.setSecret(secretToBackup)); - byte[] backupBytes = (client.backupSecret(secretToBackup.name())); + byte[] backupBytes = (client.backupSecret(secretToBackup.getName())); assertNotNull(backupBytes); assertTrue(backupBytes.length > 0); }); @@ -207,7 +207,7 @@ public void backupSecret() { * Tests that an attempt to backup a non existing secret throws an error. */ public void backupSecretNotFound() { - assertRestException(() -> client.backupSecret("non-existing"), ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code()); + assertRestException(() -> client.backupSecret("non-existing"), ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); } /** @@ -216,17 +216,17 @@ public void backupSecretNotFound() { public synchronized void restoreSecret() { restoreSecretRunner((secretToBackupAndRestore) -> { assertSecretEquals(secretToBackupAndRestore, client.setSecret(secretToBackupAndRestore)); - byte[] backupBytes = (client.backupSecret(secretToBackupAndRestore.name())); + byte[] backupBytes = (client.backupSecret(secretToBackupAndRestore.getName())); assertNotNull(backupBytes); assertTrue(backupBytes.length > 0); - client.deleteSecret(secretToBackupAndRestore.name()); - pollOnSecretDeletion(secretToBackupAndRestore.name()); - client.purgeDeletedSecret(secretToBackupAndRestore.name()); - pollOnSecretPurge(secretToBackupAndRestore.name()); + client.deleteSecret(secretToBackupAndRestore.getName()); + pollOnSecretDeletion(secretToBackupAndRestore.getName()); + client.purgeDeletedSecret(secretToBackupAndRestore.getName()); + pollOnSecretPurge(secretToBackupAndRestore.getName()); sleepInRecordMode(60000); Secret restoredSecret = client.restoreSecret(backupBytes); - assertEquals(secretToBackupAndRestore.name(), restoredSecret.name()); - assertEquals(secretToBackupAndRestore.expires(), restoredSecret.expires()); + assertEquals(secretToBackupAndRestore.getName(), restoredSecret.getName()); + assertEquals(secretToBackupAndRestore.getExpires(), restoredSecret.getExpires()); }); } @@ -235,7 +235,7 @@ public synchronized void restoreSecret() { */ public void restoreSecretFromMalformedBackup() { byte[] secretBackupBytes = "non-existing".getBytes(); - assertRestException(() -> client.restoreSecret(secretBackupBytes), ResourceModifiedException.class, HttpResponseStatus.BAD_REQUEST.code()); + assertRestException(() -> client.restoreSecret(secretBackupBytes), ResourceModifiedException.class, HttpURLConnection.HTTP_BAD_REQUEST); } /** @@ -248,11 +248,11 @@ public void listSecrets() { } for (SecretBase actualSecret : client.listSecrets()) { - if (secrets.containsKey(actualSecret.name())) { - Secret expectedSecret = secrets.get(actualSecret.name()); - assertEquals(expectedSecret.expires(), actualSecret.expires()); - assertEquals(expectedSecret.notBefore(), actualSecret.notBefore()); - secrets.remove(actualSecret.name()); + if (secrets.containsKey(actualSecret.getName())) { + Secret expectedSecret = secrets.get(actualSecret.getName()); + assertEquals(expectedSecret.getExpires(), actualSecret.getExpires()); + assertEquals(expectedSecret.getNotBefore(), actualSecret.getNotBefore()); + secrets.remove(actualSecret.getName()); } } assertEquals(0, secrets.size()); @@ -271,25 +271,25 @@ public void listDeletedSecrets() { } for (Secret secret : secrets.values()) { - client.deleteSecret(secret.name()); - pollOnSecretDeletion(secret.name()); + client.deleteSecret(secret.getName()); + pollOnSecretDeletion(secret.getName()); } sleepInRecordMode(60000); Iterable deletedSecrets = client.listDeletedSecrets(); for (DeletedSecret actualSecret : deletedSecrets) { - if (secrets.containsKey(actualSecret.name())) { - assertNotNull(actualSecret.deletedDate()); - assertNotNull(actualSecret.recoveryId()); - secrets.remove(actualSecret.name()); + if (secrets.containsKey(actualSecret.getName())) { + assertNotNull(actualSecret.getDeletedDate()); + assertNotNull(actualSecret.getRecoveryId()); + secrets.remove(actualSecret.getName()); } } assertEquals(0, secrets.size()); for (DeletedSecret deletedSecret : deletedSecrets) { - client.purgeDeletedSecret(deletedSecret.name()); - pollOnSecretPurge(deletedSecret.name()); + client.purgeDeletedSecret(deletedSecret.getName()); + pollOnSecretPurge(deletedSecret.getName()); } sleepInRecordMode(10000); }); @@ -304,7 +304,7 @@ public void listSecretVersions() { List secretVersions = secrets; String secretName = null; for (Secret secret : secretVersions) { - secretName = secret.name(); + secretName = secret.getName(); assertSecretEquals(secret, client.setSecret(secret)); } diff --git a/sdk/keyvault/azure-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretClientTestBase.java b/sdk/keyvault/azure-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretClientTestBase.java index 9c1095bb5426..c4e1bbcdbd6e 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretClientTestBase.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/test/java/com/azure/security/keyvault/secrets/SecretClientTestBase.java @@ -9,6 +9,7 @@ import com.azure.core.http.HttpClient; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.netty.NettyAsyncHttpClientBuilder; import com.azure.core.http.policy.*; import com.azure.core.http.rest.Response; import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; @@ -44,7 +45,7 @@ public abstract class SecretClientTestBase extends TestBase { public TestName testName = new TestName(); @Override - protected String testName() { + protected String getTestName() { return testName.getMethodName(); } @@ -75,7 +76,7 @@ T clientSetup(Function clientBuilder) { httpClient = interceptorManager.getPlaybackClient(); policies.add(interceptorManager.getRecordPolicy()); } else { - httpClient = HttpClient.createDefault().wiretap(true); + httpClient = new NettyAsyncHttpClientBuilder().wiretap(true).build(); policies.add(interceptorManager.getRecordPolicy()); } @@ -99,10 +100,10 @@ void setSecretRunner(Consumer testRunner) { tags.put("foo", "baz"); final Secret secret = new Secret(SECRET_NAME, SECRET_VALUE) - .expires(OffsetDateTime.of(2050, 1, 30, 0, 0, 0, 0, ZoneOffset.UTC)) - .notBefore(OffsetDateTime.of(2000, 1, 30, 12, 59, 59, 0, ZoneOffset.UTC)) - .tags(tags) - .contentType("text"); + .setExpires(OffsetDateTime.of(2050, 1, 30, 0, 0, 0, 0, ZoneOffset.UTC)) + .setNotBefore(OffsetDateTime.of(2000, 1, 30, 12, 59, 59, 0, ZoneOffset.UTC)) + .setTags(tags) + .setContentType("text"); testRunner.accept(secret); } @@ -130,12 +131,12 @@ void updateSecretRunner(BiConsumer testRunner) { tags.put("first tag", "first value"); tags.put("second tag", "second value"); final Secret originalSecret = new Secret("testSecretUpdate", "testSecretVal") - .expires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)) - .tags(tags); + .setExpires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)) + .setTags(tags); final Secret updatedSecret = new Secret("testSecretUpdate", "testSecretVal") - .expires(OffsetDateTime.of(2060, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)) - .tags(tags); + .setExpires(OffsetDateTime.of(2060, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)) + .setTags(tags); testRunner.accept(originalSecret, updatedSecret); } @@ -149,11 +150,11 @@ void updateDisabledSecretRunner(BiConsumer testRunner) { final Map tags = new HashMap<>(); final Secret originalSecret = new Secret("testUpdateOfDisabledSecret", "testSecretUpdateDisabledVal") - .expires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)) - .enabled(false); + .setExpires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)) + .setEnabled(false); final Secret updatedSecret = new Secret("testUpdateOfDisabledSecret", "testSecretUpdateDisabledVal") - .expires(OffsetDateTime.of(2060, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); + .setExpires(OffsetDateTime.of(2060, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); testRunner.accept(originalSecret, updatedSecret); } @@ -163,7 +164,7 @@ void updateDisabledSecretRunner(BiConsumer testRunner) { void getSecretRunner(Consumer testRunner) { final Secret originalSecret = new Secret("testSecretGet", "testSecretGetVal") - .expires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); + .setExpires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); testRunner.accept(originalSecret); } @@ -173,10 +174,10 @@ void getSecretRunner(Consumer testRunner) { void getSecretSpecificVersionRunner(BiConsumer testRunner) { final Secret secret = new Secret("testSecretGetVersion", "testSecretGetVersionVal") - .expires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); + .setExpires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); final Secret secretWithNewVal = new Secret("testSecretGetVersion", "newVal") - .expires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); + .setExpires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); testRunner.accept(secret, secretWithNewVal); } @@ -189,7 +190,7 @@ void getSecretSpecificVersionRunner(BiConsumer testRunner) { void deleteSecretRunner(Consumer testRunner) { final Secret secretToDelete = new Secret("testSecretDelete", "testSecretDeleteVal") - .expires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); + .setExpires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); testRunner.accept(secretToDelete); } @@ -203,7 +204,7 @@ void deleteSecretRunner(Consumer testRunner) { void getDeletedSecretRunner(Consumer testRunner) { final Secret secretToDeleteAndGet = new Secret("testSecretGetDeleted", "testSecretGetDeleteVal") - .expires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); + .setExpires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); testRunner.accept(secretToDeleteAndGet); } @@ -215,7 +216,7 @@ void getDeletedSecretRunner(Consumer testRunner) { void recoverDeletedSecretRunner(Consumer testRunner) { final Secret secretToDeleteAndRecover = new Secret("testSecretRecover", "testSecretRecoverVal") - .expires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); + .setExpires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); testRunner.accept(secretToDeleteAndRecover); } @@ -227,7 +228,7 @@ void recoverDeletedSecretRunner(Consumer testRunner) { void backupSecretRunner(Consumer testRunner) { final Secret secretToBackup = new Secret("testSecretBackup", "testSecretBackupVal") - .expires(OffsetDateTime.of(2060, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); + .setExpires(OffsetDateTime.of(2060, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); testRunner.accept(secretToBackup); } @@ -239,7 +240,7 @@ void backupSecretRunner(Consumer testRunner) { void restoreSecretRunner(Consumer testRunner) { final Secret secretToBackupAndRestore = new Secret("testSecretRestore", "testSecretRestoreVal") - .expires(OffsetDateTime.of(2080, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); + .setExpires(OffsetDateTime.of(2080, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); testRunner.accept(secretToBackupAndRestore); } @@ -257,7 +258,7 @@ void listSecretsRunner(Consumer> testRunner) { secretName = "listSecret" + i; secretVal = "listSecretVal" + i; Secret secret = new Secret(secretName, secretVal) - .expires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); + .setExpires(OffsetDateTime.of(2050, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC)); secrets.put(secretName, secret); } testRunner.accept(secrets); @@ -274,7 +275,7 @@ void listDeletedSecretsRunner(Consumer> testRunner) { secretName = "listDeletedSecretsTest" + i; secretVal = "listDeletedSecretVal" + i; secrets.put(secretName, new Secret(secretName, secretVal) - .expires(OffsetDateTime.of(2090, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC))); + .setExpires(OffsetDateTime.of(2090, 5, 25, 0, 0, 0, 0, ZoneOffset.UTC))); } testRunner.accept(secrets); @@ -292,7 +293,7 @@ void listSecretVersionsRunner(Consumer> testRunner) { secretName = "listSecretVersion"; secretVal = "listSecretVersionVal" + i; secrets.add(new Secret(secretName, secretVal) - .expires(OffsetDateTime.of(2090, 5, i, 0, 0, 0, 0, ZoneOffset.UTC))); + .setExpires(OffsetDateTime.of(2090, 5, i, 0, 0, 0, 0, ZoneOffset.UTC))); } testRunner.accept(secrets); } @@ -316,9 +317,9 @@ static void assertSecretEquals(Secret expected, Response response) { */ static void assertSecretEquals(Secret expected, Response response, final int expectedStatusCode) { assertNotNull(response); - assertEquals(expectedStatusCode, response.statusCode()); + assertEquals(expectedStatusCode, response.getStatusCode()); - assertSecretEquals(expected, response.value()); + assertSecretEquals(expected, response.getValue()); } /** @@ -328,10 +329,10 @@ static void assertSecretEquals(Secret expected, Response response, final * @param actual ConfigurationSetting contained in the RestResponse body */ static void assertSecretEquals(Secret expected, Secret actual) { - assertEquals(expected.name(), actual.name()); - assertEquals(expected.value(), actual.value()); - assertEquals(expected.expires(), actual.expires()); - assertEquals(expected.notBefore(), actual.notBefore()); + assertEquals(expected.getName(), actual.getName()); + assertEquals(expected.getValue(), actual.getValue()); + assertEquals(expected.getExpires(), actual.getExpires()); + assertEquals(expected.getNotBefore(), actual.getNotBefore()); } public String getEndpoint() { @@ -367,7 +368,7 @@ static void assertRestException(Throwable exception, int expectedStatusCode) { static void assertRestException(Throwable exception, Class expectedExceptionType, int expectedStatusCode) { assertEquals(expectedExceptionType, exception.getClass()); - assertEquals(expectedStatusCode, ((HttpResponseException) exception).response().statusCode()); + assertEquals(expectedStatusCode, ((HttpResponseException) exception).getResponse().getStatusCode()); } /** diff --git a/sdk/keyvault/ci.data.yml b/sdk/keyvault/ci.data.yml index 9e4f39d24ea6..07c0110593dc 100644 --- a/sdk/keyvault/ci.data.yml +++ b/sdk/keyvault/ci.data.yml @@ -39,17 +39,18 @@ stages: parameters: ServiceDirectory: keyvault Artifacts: - - name: microsoft-azure-keyvault - safeName: microsoftazurekeyvault - - name: microsoft-azure-keyvault-complete - safeName: microsoftazurekeyvaultcomplete - - name: microsoft-azure-keyvault-core - safeName: microsoftazurekeyvaultcore - - name: microsoft-azure-keyvault-cryptography - safeName: microsoftazurekeyvaultcryptography - - name: microsoft-azure-keyvault-extensions - safeName: microsoftazurekeyvaultextensions - - name: microsoft-azure-keyvault-test - safeName: microsoftazurekeyvaulttest - - name: microsoft-azure-keyvault-webkey - safeName: microsoftazurekeyvaultwebkey \ No newline at end of file + - name: azure-keyvault + safeName: azurekeyvault + stagingProfileId: 534d15ee3800f4 + - name: azure-keyvault-core + safeName: azurekeyvaultcore + stagingProfileId: 534d15ee3800f4 + - name: azure-keyvault-cryptography + safeName: azurekeyvaultcryptography + stagingProfileId: 534d15ee3800f4 + - name: azure-keyvault-extensions + safeName: azurekeyvaultextensions + stagingProfileId: 534d15ee3800f4 + - name: azure-keyvault-webkey + safeName: azurekeyvaultwebkey + stagingProfileId: 534d15ee3800f4 \ No newline at end of file diff --git a/sdk/keyvault/ci.yml b/sdk/keyvault/ci.yml index e7f355a992a5..fb85a28bad84 100644 --- a/sdk/keyvault/ci.yml +++ b/sdk/keyvault/ci.yml @@ -38,7 +38,12 @@ stages: parameters: ServiceDirectory: keyvault Artifacts: + - name: azure-keyvault-certificates + safeName: azurekeyvaultcertificates + stagingProfileId: 88192f04117501 - name: azure-keyvault-keys safeName: azurekeyvaultkeys + stagingProfileId: 88192f04117501 - name: azure-keyvault-secrets - safeName: azurekeyvaultsecrets \ No newline at end of file + safeName: azurekeyvaultsecrets + stagingProfileId: 88192f04117501 diff --git a/sdk/keyvault/microsoft-azure-keyvault-complete/pom.xml b/sdk/keyvault/microsoft-azure-keyvault-complete/pom.xml index 52b486d560c3..f4c58e781c6e 100644 --- a/sdk/keyvault/microsoft-azure-keyvault-complete/pom.xml +++ b/sdk/keyvault/microsoft-azure-keyvault-complete/pom.xml @@ -5,15 +5,15 @@ the MIT License. See License.txt in the project root for license information. -- 4.0.0 - com.microsoft.azure - azure-keyvault-parent - 1.2.1 - ../pom.data.xml + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml com.microsoft.azure azure-keyvault-complete - 1.2.1 + 1.2.2 pom Microsoft Azure Key Vault SDK Complete @@ -41,22 +41,27 @@ the MIT License. See License.txt in the project root for license information. -- com.microsoft.azure azure-keyvault + 1.2.2 com.microsoft.azure azure-keyvault-core + 1.2.2 com.microsoft.azure azure-keyvault-webkey + 1.2.2 com.microsoft.azure azure-keyvault-extensions + 1.2.2 com.microsoft.azure azure-keyvault-cryptography + 1.2.2 diff --git a/sdk/keyvault/microsoft-azure-keyvault-core/pom.xml b/sdk/keyvault/microsoft-azure-keyvault-core/pom.xml index ac37e02c8f65..6b42cf97bcda 100644 --- a/sdk/keyvault/microsoft-azure-keyvault-core/pom.xml +++ b/sdk/keyvault/microsoft-azure-keyvault-core/pom.xml @@ -6,15 +6,15 @@ 4.0.0 - com.microsoft.azure - azure-keyvault-parent - 1.2.1 - ../pom.data.xml + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml com.microsoft.azure azure-keyvault-core - 1.2.1 + 1.2.2 jar Microsoft Azure SDK for Key Vault Core diff --git a/sdk/keyvault/microsoft-azure-keyvault-cryptography/pom.xml b/sdk/keyvault/microsoft-azure-keyvault-cryptography/pom.xml index b89291571a57..c5b00bb8f3f1 100644 --- a/sdk/keyvault/microsoft-azure-keyvault-cryptography/pom.xml +++ b/sdk/keyvault/microsoft-azure-keyvault-cryptography/pom.xml @@ -4,16 +4,16 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - - com.microsoft.azure - azure-keyvault-parent - 1.2.1 - ../pom.data.xml - + + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml + com.microsoft.azure azure-keyvault-cryptography - 1.2.1 + 1.2.2 jar Microsoft Azure SDK for Key Vault Cryptography @@ -41,10 +41,12 @@ com.microsoft.azure azure-keyvault-webkey + 1.2.2 com.microsoft.azure azure-keyvault-core + 1.2.2 diff --git a/sdk/keyvault/microsoft-azure-keyvault-cryptography/src/main/java/com/microsoft/azure/keyvault/cryptography/RsaKey.java b/sdk/keyvault/microsoft-azure-keyvault-cryptography/src/main/java/com/microsoft/azure/keyvault/cryptography/RsaKey.java index b90257e04b85..d8226d502485 100644 --- a/sdk/keyvault/microsoft-azure-keyvault-cryptography/src/main/java/com/microsoft/azure/keyvault/cryptography/RsaKey.java +++ b/sdk/keyvault/microsoft-azure-keyvault-cryptography/src/main/java/com/microsoft/azure/keyvault/cryptography/RsaKey.java @@ -88,7 +88,9 @@ public RsaKey(String kid, int keySize, Provider provider) throws NoSuchAlgorithm throw new IllegalArgumentException("kid"); } - final KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA", provider); + final KeyPairGenerator generator; + + generator = provider == null ? KeyPairGenerator.getInstance("RSA") : KeyPairGenerator.getInstance("RSA", provider); generator.initialize(keySize); diff --git a/sdk/keyvault/microsoft-azure-keyvault-cryptography/src/test/java/com/microsoft/azure/keyvault/cryptography/test/RsaKeyTest.java b/sdk/keyvault/microsoft-azure-keyvault-cryptography/src/test/java/com/microsoft/azure/keyvault/cryptography/test/RsaKeyTest.java index 17d6c39a5f0c..5c46bf9c3a64 100644 --- a/sdk/keyvault/microsoft-azure-keyvault-cryptography/src/test/java/com/microsoft/azure/keyvault/cryptography/test/RsaKeyTest.java +++ b/sdk/keyvault/microsoft-azure-keyvault-cryptography/src/test/java/com/microsoft/azure/keyvault/cryptography/test/RsaKeyTest.java @@ -19,6 +19,7 @@ import org.junit.Test; import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; import java.security.Provider; import static org.junit.Assert.assertArrayEquals; @@ -56,6 +57,13 @@ protected void setProvider(Provider provider) { this.provider = provider; } + @Test + public void testRsaKeyEmptyConstructor() throws NoSuchAlgorithmException { + RsaKey key = new RsaKey(); + + assertNotNull(key); + } + @Test public void testRsa15() throws Exception { diff --git a/sdk/keyvault/microsoft-azure-keyvault-extensions/pom.xml b/sdk/keyvault/microsoft-azure-keyvault-extensions/pom.xml index 40eb0fbb486a..a2cf47a2717a 100644 --- a/sdk/keyvault/microsoft-azure-keyvault-extensions/pom.xml +++ b/sdk/keyvault/microsoft-azure-keyvault-extensions/pom.xml @@ -6,14 +6,15 @@ 4.0.0 - com.microsoft.azure - azure-keyvault-parent - 1.2.1 - ../pom.data.xml + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml + com.microsoft.azure azure-keyvault-extensions - 1.2.1 + 1.2.2 jar Microsoft Azure SDK for Key Vault Extensions @@ -40,18 +41,22 @@ com.microsoft.azure azure-keyvault-webkey + 1.2.2 com.microsoft.azure azure-keyvault-core + 1.2.2 com.microsoft.azure azure-keyvault-cryptography + 1.2.2 com.microsoft.azure azure-keyvault + 1.2.2 diff --git a/sdk/keyvault/microsoft-azure-keyvault-test/pom.xml b/sdk/keyvault/microsoft-azure-keyvault-test/pom.xml index f8dd24695ff9..0cbf78784f50 100644 --- a/sdk/keyvault/microsoft-azure-keyvault-test/pom.xml +++ b/sdk/keyvault/microsoft-azure-keyvault-test/pom.xml @@ -4,11 +4,13 @@ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 4.0.0 - com.microsoft.azure - azure-keyvault-parent - 1.2.1 - ../pom.data.xml + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml + + com.microsoft.azure azure-keyvault-test azure-keyvault-test https://github.com/Azure/azure-sdk-for-java @@ -36,16 +38,19 @@ com.microsoft.azure azure-keyvault-webkey + 1.2.2 test com.microsoft.azure azure-keyvault + 1.2.2 test com.microsoft.azure azure-keyvault-cryptography + 1.2.2 test diff --git a/sdk/keyvault/microsoft-azure-keyvault-test/src/test/java/com/microsoft/azure/keyvault/test/EcKeyIntegrationTests.java b/sdk/keyvault/microsoft-azure-keyvault-test/src/test/java/com/microsoft/azure/keyvault/test/EcKeyIntegrationTests.java index f508cfa07f74..b96b62d4a7ec 100644 --- a/sdk/keyvault/microsoft-azure-keyvault-test/src/test/java/com/microsoft/azure/keyvault/test/EcKeyIntegrationTests.java +++ b/sdk/keyvault/microsoft-azure-keyvault-test/src/test/java/com/microsoft/azure/keyvault/test/EcKeyIntegrationTests.java @@ -23,6 +23,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; @@ -110,21 +111,25 @@ public void beforeMethod() throws Exception { } @Test + @Ignore("https://github.com/Azure/azure-sdk-for-java/issues/4993") public void testSignVerifyIntegrationES256() throws Exception { validateSignVerifyInterop(importTestKey("itwkk-p256", P256TestKey()), JsonWebKeySignatureAlgorithm.ES256, "SHA-256"); } @Test + @Ignore("https://github.com/Azure/azure-sdk-for-java/issues/4993") public void testSignVerifyIntegrationES256K() throws Exception { validateSignVerifyInterop(importTestKey("itwkk-p256k", P256KTestKey()), JsonWebKeySignatureAlgorithm.ES256K, "SHA-256"); } @Test + @Ignore("https://github.com/Azure/azure-sdk-for-java/issues/4993") public void testSignVerifyIntegrationES384() throws Exception { validateSignVerifyInterop(importTestKey("itwkk-p384", P384TestKey()), JsonWebKeySignatureAlgorithm.ES384, "SHA-384"); } @Test + @Ignore("https://github.com/Azure/azure-sdk-for-java/issues/4993") public void testSignVerifyIntegrationES521() throws Exception { validateSignVerifyInterop(importTestKey("itwkk-p521", P521TestKey()), JsonWebKeySignatureAlgorithm.ES512, "SHA-512"); } diff --git a/sdk/keyvault/microsoft-azure-keyvault-webkey/pom.xml b/sdk/keyvault/microsoft-azure-keyvault-webkey/pom.xml index f79a9cda82ce..c2e545d19bf7 100644 --- a/sdk/keyvault/microsoft-azure-keyvault-webkey/pom.xml +++ b/sdk/keyvault/microsoft-azure-keyvault-webkey/pom.xml @@ -4,14 +4,15 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.microsoft.azure - azure-keyvault-parent - 1.2.1 - ../pom.data.xml + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml + com.microsoft.azure azure-keyvault-webkey - 1.2.1 + 1.2.2 jar Microsoft Azure SDK for Key Vault WebKey diff --git a/sdk/keyvault/microsoft-azure-keyvault/pom.xml b/sdk/keyvault/microsoft-azure-keyvault/pom.xml index 482acf233fe3..c20849b42da0 100644 --- a/sdk/keyvault/microsoft-azure-keyvault/pom.xml +++ b/sdk/keyvault/microsoft-azure-keyvault/pom.xml @@ -4,15 +4,15 @@ the MIT License. See License.txt in the project root for license information. -- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.microsoft.azure - azure-keyvault-parent - 1.2.1 - ../pom.data.xml + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml com.microsoft.azure azure-keyvault - 1.2.1 + 1.2.2 jar Microsoft Azure SDK for Key Vault @@ -43,11 +43,13 @@ the MIT License. See License.txt in the project root for license information. -- com.microsoft.azure azure-keyvault-cryptography + 1.2.2 com.microsoft.azure azure-keyvault-webkey + 1.2.2 diff --git a/sdk/keyvault/microsoft-azure-keyvault/src/main/java/com/microsoft/azure/keyvault/authentication/KeyVaultCredentials.java b/sdk/keyvault/microsoft-azure-keyvault/src/main/java/com/microsoft/azure/keyvault/authentication/KeyVaultCredentials.java index 116a5f9741b4..c16cdd53beaa 100644 --- a/sdk/keyvault/microsoft-azure-keyvault/src/main/java/com/microsoft/azure/keyvault/authentication/KeyVaultCredentials.java +++ b/sdk/keyvault/microsoft-azure-keyvault/src/main/java/com/microsoft/azure/keyvault/authentication/KeyVaultCredentials.java @@ -68,12 +68,15 @@ public Response intercept(Chain chain) throws IOException { // response response = chain.proceed(buildEmptyRequest(originalRequest)); - if (response.code() == 200) { + if (response.code() != 401) { return response; - } else if (response.code() != 401) { - throw new IOException("Unexpected unauthorized response."); } - authenticatedRequestPair = buildAuthenticatedRequest(originalRequest, response); + + try { + authenticatedRequestPair = buildAuthenticatedRequest(originalRequest, response); + } finally { + response.close(); + } } response = chain.proceed(authenticatedRequestPair.getLeft()); diff --git a/sdk/keyvault/pom.data.xml b/sdk/keyvault/pom.data.xml deleted file mode 100644 index 9c56b7e65079..000000000000 --- a/sdk/keyvault/pom.data.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - 4.0.0 - - com.azure - azure-data-sdk-parent - 1.1.0 - ../../pom.data.xml - - - 1.2.1 - com.microsoft.azure - azure-keyvault-parent - pom - - Microsoft Azure Key Vault SDK Parent - This package contains the parent module of Microsoft Azure Key Vault SDK. - https://github.com/Azure/azure-sdk-for-java - - - - azure-java-build-docs - ${site.url}/site/${project.artifactId} - - - - - https://github.com/Azure/azure-sdk-for-java - - - - 1.2.1 - - - - - - - com.microsoft.azure - azure-keyvault-webkey - ${azure-keyvault.version} - - - - com.microsoft.azure - azure-keyvault-cryptography - ${azure-keyvault.version} - - - - com.microsoft.azure - azure-keyvault-core - ${azure-keyvault.version} - - - - com.microsoft.azure - azure-keyvault - ${azure-keyvault.version} - - - - com.microsoft.azure - azure-keyvault-extensions - ${azure-keyvault.version} - - - - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.7 - 1.7 - true - true - -Xlint:unchecked - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - true - true - - - - - - - - microsoft - Microsoft Corporation - - - - - microsoft-azure-keyvault - microsoft-azure-keyvault-core - microsoft-azure-keyvault-webkey - microsoft-azure-keyvault-cryptography - microsoft-azure-keyvault-extensions - microsoft-azure-keyvault-complete - - diff --git a/sdk/keyvault/pom.service.xml b/sdk/keyvault/pom.service.xml index 956a21dfe3d7..58e211725a0d 100644 --- a/sdk/keyvault/pom.service.xml +++ b/sdk/keyvault/pom.service.xml @@ -1,30 +1,49 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.azure azure-keyvault-service pom - 1.0.0 - - - - microsoft-azure-keyvault - microsoft-azure-keyvault-core - microsoft-azure-keyvault-webkey - microsoft-azure-keyvault-cryptography - microsoft-azure-keyvault-extensions - microsoft-azure-keyvault-complete - - - ../core/azure-core - ../core/azure-core-test - ../identity/azure-identity - azure-keyvault-keys - azure-keyvault-secrets - - + 1.0.0 + + + data + + + env.SDKTYPE + data + + + + microsoft-azure-keyvault + microsoft-azure-keyvault-complete + microsoft-azure-keyvault-core + microsoft-azure-keyvault-cryptography + microsoft-azure-keyvault-extensions + microsoft-azure-keyvault-test + microsoft-azure-keyvault-webkey + + + + client + + + env.SDKTYPE + !data + + + + ../core/azure-core + ../core/azure-core-test + ../core/azure-core-http-netty + ../identity/azure-identity + azure-keyvault-certificates + azure-keyvault-keys + azure-keyvault-secrets + + + diff --git a/sdk/keyvault/tests.yml b/sdk/keyvault/tests.yml index 4a7716cf8392..6cf58b46d480 100644 --- a/sdk/keyvault/tests.yml +++ b/sdk/keyvault/tests.yml @@ -7,4 +7,5 @@ jobs: EnvVars: AZURE_TEST_MODE: RECORD ARM_CLIENTID: $(java-keyvault-test-arm-client-id) - ARM_CLIENTKEY: $(java-keyvault-test-arm-client-key) \ No newline at end of file + ARM_CLIENTKEY: $(java-keyvault-test-arm-client-key) + AZURE_KEYVAULT_ENDPOINT: $(java-azure-keyvault-sdk-endpoint) diff --git a/sdk/loganalytics/ci.yml b/sdk/loganalytics/ci.yml index a115776c40a5..dee0eac01eca 100644 --- a/sdk/loganalytics/ci.yml +++ b/sdk/loganalytics/ci.yml @@ -1,10 +1,19 @@ # DO NOT EDIT THIS FILE # This file is generated automatically and any changes will be lost. +resources: + repositories: + - repository: azure-sdk-build-tools + type: git + name: internal/azure-sdk-build-tools + trigger: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/loganalytics/ @@ -13,11 +22,18 @@ pr: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/loganalytics/ -jobs: - - template: ../../eng/pipelines/templates/jobs/archetype-sdk-client.yml +stages: + - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: - ServiceDirectory: loganalytics \ No newline at end of file + ServiceDirectory: loganalytics + Artifacts: + - name: azure-loganalytics + safeName: azureloganalytics + stagingProfileId: 534d15ee3800f4 \ No newline at end of file diff --git a/sdk/loganalytics/microsoft-azure-loganalytics/pom.xml b/sdk/loganalytics/microsoft-azure-loganalytics/pom.xml index 1ccc97e1d303..ec00022f6a50 100644 --- a/sdk/loganalytics/microsoft-azure-loganalytics/pom.xml +++ b/sdk/loganalytics/microsoft-azure-loganalytics/pom.xml @@ -5,14 +5,21 @@ * * Code generated by Microsoft (R) AutoRest Code Generator. --> - + 4.0.0 com.microsoft.azure azure-loganalytics - 1.0.0-Preview-1 + 1.0.0-preview.2 jar Microsoft Azure SDK for Log Analytics This package contains Microsoft Log Analytics SDK. + + com.azure + azure-data-sdk-parent + 1.2.0 + ../../../pom.data.xml + https://github.com/Azure/azure-sdk-for-java @@ -63,7 +70,7 @@ test-jar test - + com.microsoft.azure azure-arm-client-runtime ${runtime.version} @@ -76,17 +83,17 @@ properties-maven-plugin 1.0.0 - - generate-resources - - write-project-properties - - - + + generate-resources + + write-project-properties + + + ${project.build.outputDirectory}/maven.properties - - - + + + @@ -147,19 +154,19 @@ maven-surefire-plugin 2.20 - false - - **/Test*.java - **/*Test.java - **/*Tests.java - **/*TestCase.java - - - **/LogAnalyticsDataClientTests.java - - - ${testMode} - + false + + **/Test*.java + **/*Test.java + **/*Tests.java + **/*TestCase.java + + + **/LogAnalyticsDataClientTests.java + + + ${testMode} + diff --git a/sdk/mediaservices/ci.yml b/sdk/mediaservices/ci.yml index 92324f882498..56f0e05424b5 100644 --- a/sdk/mediaservices/ci.yml +++ b/sdk/mediaservices/ci.yml @@ -1,10 +1,19 @@ # DO NOT EDIT THIS FILE # This file is generated automatically and any changes will be lost. +resources: + repositories: + - repository: azure-sdk-build-tools + type: git + name: internal/azure-sdk-build-tools + trigger: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/mediaservices/ @@ -13,11 +22,18 @@ pr: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/mediaservices/ -jobs: - - template: ../../eng/pipelines/templates/jobs/archetype-sdk-client.yml +stages: + - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: - ServiceDirectory: mediaservices \ No newline at end of file + ServiceDirectory: mediaservices + Artifacts: + - name: azure-media + safeName: azuremedia + stagingProfileId: 534d15ee3800f4 \ No newline at end of file diff --git a/sdk/mediaservices/microsoft-azure-media/pom.xml b/sdk/mediaservices/microsoft-azure-media/pom.xml index 128f58207f27..637c39a7a1df 100644 --- a/sdk/mediaservices/microsoft-azure-media/pom.xml +++ b/sdk/mediaservices/microsoft-azure-media/pom.xml @@ -16,7 +16,7 @@ 4.0.0 com.microsoft.azure azure-media - 0.9.8-SNAPSHOT + 1.0.0-preview.1 jar Microsoft Azure SDK for Media Services This package contains Microsoft Azure SDK for Media Services. @@ -25,7 +25,7 @@ com.azure azure-data-sdk-parent - 1.0.0 + 1.2.0 ../../../pom.data.xml @@ -180,7 +180,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.8 + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.storage /** diff --git a/sdk/servicebus/README.md b/sdk/servicebus/README.md index c580edc8dd09..5b8c0a7720f2 100644 --- a/sdk/servicebus/README.md +++ b/sdk/servicebus/README.md @@ -92,3 +92,5 @@ To use a proxy for unit tests, set an environment variable `RUN_WITH_PROXY` to ` 8. Go to environment and add above mentioned environment variable and the regarding connection string. 9. Click "Apply" and then "Run" 10. You should have a new view next to the package explorer called JUnit showing the running tests and see Console outputs depending on which test currently runs. If you do not see the JUnit tab go to Window > Show view > Other... > Java > JUnit + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/servicebus/README.png) \ No newline at end of file diff --git a/sdk/servicebus/ci.yml b/sdk/servicebus/ci.yml index 9b84c113c711..4e1fcf71ab73 100644 --- a/sdk/servicebus/ci.yml +++ b/sdk/servicebus/ci.yml @@ -35,4 +35,5 @@ stages: ServiceDirectory: servicebus Artifacts: - name: azure-servicebus - safeName: azureservicebus \ No newline at end of file + safeName: azureservicebus + stagingProfileId: 534d15ee3800f4 \ No newline at end of file diff --git a/sdk/servicebus/microsoft-azure-servicebus/pom.xml b/sdk/servicebus/microsoft-azure-servicebus/pom.xml index cc730397c06e..a93611f25273 100644 --- a/sdk/servicebus/microsoft-azure-servicebus/pom.xml +++ b/sdk/servicebus/microsoft-azure-servicebus/pom.xml @@ -6,7 +6,7 @@ 4.0.0 com.microsoft.azure azure-servicebus - 2.0.0 + 3.1.0 Microsoft Azure SDK for Service Bus Java library for Azure Service Bus @@ -15,7 +15,7 @@ com.azure azure-data-sdk-parent - 1.1.0 + 1.2.0 ../../../pom.data.xml diff --git a/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/AzureActiveDirectoryTokenProvider.java b/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/AzureActiveDirectoryTokenProvider.java index 5224bf034e99..eb65977e7431 100644 --- a/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/AzureActiveDirectoryTokenProvider.java +++ b/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/AzureActiveDirectoryTokenProvider.java @@ -3,6 +3,9 @@ package com.microsoft.azure.servicebus.security; +import java.text.ParseException; +import java.time.Instant; +import java.util.Date; import java.util.concurrent.CompletableFuture; /** @@ -24,7 +27,17 @@ public class AzureActiveDirectoryTokenProvider extends TokenProvider { @Override public CompletableFuture getSecurityTokenAsync(String audience) { - return this.authCallback.acquireTokenAsync(audience, this.authority, this.authCallbackState); + CompletableFuture tokenStringFuture = this.authCallback.acquireTokenAsync( + SecurityConstants.SERVICEBUS_AAD_AUDIENCE_RESOURCE_URL, this.authority, this.authCallbackState); + return tokenStringFuture.thenApply(tokenString -> { + Date expire; + try { + expire = SecurityToken.getExpirationDateTimeUtcFromToken(tokenString); + return new SecurityToken(SecurityTokenType.JWT, audience, tokenString, Instant.now(), expire == null ? null : expire.toInstant()); + } catch (ParseException e) { + throw new RuntimeException(e); + } + }); } @FunctionalInterface @@ -36,6 +49,6 @@ public interface AuthenticationCallback { * @param state Parameter that may be used as part of the custom acquireToken process. * @return A CompletableFuture which returns a valid security token. */ - CompletableFuture acquireTokenAsync(String audience, String authority, Object state); + CompletableFuture acquireTokenAsync(String audience, String authority, Object state); } } diff --git a/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/ManagedIdentityTokenProvider.java b/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/ManagedIdentityTokenProvider.java index 28040a714d68..c1fd698084af 100644 --- a/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/ManagedIdentityTokenProvider.java +++ b/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/ManagedIdentityTokenProvider.java @@ -14,9 +14,6 @@ import com.microsoft.azure.credentials.MSICredentials; import com.microsoft.azure.servicebus.primitives.MessagingFactory; -import com.nimbusds.jwt.JWT; -import com.nimbusds.jwt.JWTClaimsSet; -import com.nimbusds.jwt.JWTParser; /** * This is a token provider that obtains token using Managed Identity(MI). This token provider automatically detects MI settings. @@ -33,7 +30,7 @@ public CompletableFuture getSecurityTokenAsync(String audience) { try { MSICredentials credentials = new MSICredentials(); String rawToken = credentials.getToken(SecurityConstants.SERVICEBUS_AAD_AUDIENCE_RESOURCE_URL); - Date expiry = getExpirationDateTimeUtcFromToken(rawToken); + Date expiry = SecurityToken.getExpirationDateTimeUtcFromToken(rawToken); tokenGeneratingFuture.complete(new SecurityToken(SecurityTokenType.JWT, audience, rawToken, Instant.now(), expiry.toInstant())); } catch (IOException e) { TRACE_LOGGER.error("ManagedIdentity token generation failed.", e); @@ -46,10 +43,4 @@ public CompletableFuture getSecurityTokenAsync(String audience) { return tokenGeneratingFuture; } - - private static Date getExpirationDateTimeUtcFromToken(String token) throws ParseException { - JWT jwt = JWTParser.parse(token); - JWTClaimsSet claims = jwt.getJWTClaimsSet(); - return claims.getExpirationTime(); - } } diff --git a/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/SecurityToken.java b/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/SecurityToken.java index 094a0e071101..abedf0f3046b 100644 --- a/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/SecurityToken.java +++ b/sdk/servicebus/microsoft-azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/SecurityToken.java @@ -3,7 +3,13 @@ package com.microsoft.azure.servicebus.security; +import java.text.ParseException; import java.time.Instant; +import java.util.Date; + +import com.nimbusds.jwt.JWT; +import com.nimbusds.jwt.JWTClaimsSet; +import com.nimbusds.jwt.JWTParser; /** * This class encapsulates the details of a security token. @@ -73,4 +79,10 @@ public Instant getValidFrom() { public Instant getValidUntil() { return this.validUntil; } + + static Date getExpirationDateTimeUtcFromToken(String token) throws ParseException { + JWT jwt = JWTParser.parse(token); + JWTClaimsSet claims = jwt.getJWTClaimsSet(); + return claims.getExpirationTime(); + } } diff --git a/sdk/servicebus/microsoft-azure-servicebus/src/test/java/com/microsoft/azure/servicebus/security/AadTokenProviderTests.java b/sdk/servicebus/microsoft-azure-servicebus/src/test/java/com/microsoft/azure/servicebus/security/AadTokenProviderTests.java index b4045686546b..713e930b3c22 100644 --- a/sdk/servicebus/microsoft-azure-servicebus/src/test/java/com/microsoft/azure/servicebus/security/AadTokenProviderTests.java +++ b/sdk/servicebus/microsoft-azure-servicebus/src/test/java/com/microsoft/azure/servicebus/security/AadTokenProviderTests.java @@ -14,17 +14,26 @@ import com.microsoft.azure.servicebus.security.AzureActiveDirectoryTokenProvider.AuthenticationCallback; public class AadTokenProviderTests { - private static final SecurityToken TEST_TOKEN = new SecurityToken(SecurityTokenType.JWT, "testAudience", "tokenString", Instant.now(), Instant.MAX); - + @Test public void aadCallbackTokenProviderTest() { - AuthenticationCallback callback = (String audience, String authority, Object state) -> CompletableFuture.completedFuture(TEST_TOKEN); - TokenProvider tokenProvider = TokenProvider.createAzureActiveDirectoryTokenProvider(callback, "https://login.microsoftonline.com/common", null); - assertEquals(TEST_TOKEN, tokenProvider.getSecurityTokenAsync("testAudience").join()); + String TEST_TOKEN = "eyJhbGciOiJIUzI1NiJ9.e30.ZRrHA1JJJW8opsbCGfG_HACGpVUMN_a9IV7pAx_Zmeo"; + String TEST_AUDIENCE = "testAudience"; + String TEST_AUTHORITY = "https://login.microsoftonline.com/common"; + + AuthenticationCallback callback = (String audience, String authority, Object state) -> { + assertEquals(SecurityConstants.SERVICEBUS_AAD_AUDIENCE_RESOURCE_URL, audience); + assertEquals(TEST_AUTHORITY, authority); + return CompletableFuture.completedFuture(TEST_TOKEN); + }; + TokenProvider tokenProvider = TokenProvider.createAzureActiveDirectoryTokenProvider(callback, TEST_AUTHORITY, null); + SecurityToken token = tokenProvider.getSecurityTokenAsync(TEST_AUDIENCE).join(); + assertEquals(TEST_TOKEN, token.getTokenValue()); + assertEquals(TEST_AUDIENCE, token.getTokenAudience()); // Should throw when null callback is provided TestUtils.assertThrows(IllegalArgumentException.class, () -> { - TokenProvider.createAzureActiveDirectoryTokenProvider(null, "https://login.microsoftonline.com/common", null); + TokenProvider.createAzureActiveDirectoryTokenProvider(null, TEST_AUTHORITY, null); }); // Should throw when null authority is provided diff --git a/sdk/storage/azure-storage-blob-cryptography/pom.xml b/sdk/storage/azure-storage-blob-cryptography/pom.xml new file mode 100644 index 000000000000..4d4b4f1d0cf8 --- /dev/null +++ b/sdk/storage/azure-storage-blob-cryptography/pom.xml @@ -0,0 +1,103 @@ + + + + com.azure + azure-client-sdk-parent + 1.4.0 + ../../../pom.client.xml + + + 4.0.0 + + com.azure + azure-storage-blob-cryptography + 12.0.0-preview.4 + + Microsoft Azure client library for Blob Storage cryptography + This module contains client library for Microsoft Azure Blob Storage cryptography. + https://github.com/Azure/azure-sdk-for-java + + + + azure-java-build-docs + ${site.url}/site/${project.artifactId} + + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + com.azure.storage.blob.cryptography + + + + + com.azure + azure-storage-blob + 12.0.0-preview.4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + groovy-eclipse-compiler + -Xlint:unchecked + 1.8 + 1.8 + true + + + + org.codehaus.groovy + groovy-eclipse-compiler + ${groovy-eclipse-compiler.version} + + + org.codehaus.groovy + groovy-eclipse-batch + ${groovy-eclipse-batch.version} + + + + + + diff --git a/sdk/storage/azure-storage-blob/CHANGELOG.md b/sdk/storage/azure-storage-blob/CHANGELOG.md index 0ab8c37f2a12..c31ecebc86e6 100644 --- a/sdk/storage/azure-storage-blob/CHANGELOG.md +++ b/sdk/storage/azure-storage-blob/CHANGELOG.md @@ -1,7 +1,30 @@ # Change Log azure-storage-blob -## Version 12.0.0-preview.2: +## 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). + +- Added tracing telemetry on maximum overload API. +- Throw `UnexpectedLengthException` when the upload body doesn't match the expected input length. +- Added validation policy to check the equality of request client ID between request and response. +- Updated to use service version 2019-02-02. +- Added dependency to azure-storage-common. +- Replaced `ByteBuf` with `ByteBuffer` and removed dependency on `Netty`. +- Added convenience upload method to `BlockBlobClient` and `BlockBlobAsyncClient`. +- Added rehydrate priority support. +- Added capability to set tier on additional APIs. +- Added customer provided key support. +**Breaking changes: New API design** +- Changed list responses to `PagedFlux` on async APIs and `PagedIterable` on sync APIs. +- Simplified API to return model types directly on non-maximal overloads. Maximal overloads return `Response` and suffixed with WithResponse. + +This package's +[documentation](https://github.com/Azure/azure-sdk-for-java/blob/085c8570b411defff26860ef56ea189af07d3d6a/sdk/storage/azure-storage-blob/README.md) +and +[samples](https://github.com/Azure/azure-sdk-for-java/blob/085c8570b411defff26860ef56ea189af07d3d6a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob) +demonstrate the new API. + +## Version 12.0.0-preview.2 (2019-08-08) For details on the Azure SDK for Java (August 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview2-java). - Renamed `StorageClient`, `StorageAsyncClient`, and `StorageClientBuilder` to `BlobServiceClient`, `BlobServiceAsyncClient`, and `BlobServiceClientBuilder`. @@ -15,10 +38,16 @@ For details on the Azure SDK for Java (August 2019 Preview) release refer to the - Removed `AnonymousClientCredential` class. - Changed parameter ordering of `BlobClient` and `BlobAsyncClient` `download` and `downloadToFile`. -## Version 12.0.0-preview.1: +This package's +[documentation](https://github.com/Azure/azure-sdk-for-java/blob/azure-storage-blob_12.0.0-preview.2/sdk/storage/azure-storage-blob/README.md) +and +[samples](https://github.com/Azure/azure-sdk-for-java/blob/azure-storage-blob_12.0.0-preview.2/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob) +demonstrate the new API. + +## Version 12.0.0-preview.1 (2019-06-28) +Version 12.0.0-preview.1 is a preview of our efforts in creating a client library that is developer-friendly, idiomatic to the Java ecosystem, and as consistent across different languages and platforms as possible. The principles that guide our efforts can be found in the [Azure SDK Design Guidelines for Java](https://azure.github.io/azure-sdk/java_introduction.html). -Version 12.0.0-preview.1 is the first preview of our efforts to create a user-friendly and Java client library for Azure Storage Blobs. For more information about this, and preview releases of other Azure SDK libraries, please visit -https://aka.ms/azure-sdk-preview1-java. +For details on the Azure SDK for Java (July 2019 Preview) release, you can refer to the [release announcement](https://aka.ms/azure-sdk-preview1-java). **Breaking changes: New API design** - Operations are now scoped to a particular client: diff --git a/sdk/storage/azure-storage-blob/README.md b/sdk/storage/azure-storage-blob/README.md index d744b797d538..6e97f6d6130d 100644 --- a/sdk/storage/azure-storage-blob/README.md +++ b/sdk/storage/azure-storage-blob/README.md @@ -1,7 +1,5 @@ # Azure Storage Blobs client library for Java -> Server Version: 2018-11-09 - Azure Blob storage is Microsoft's object storage solution for the cloud. Blob storage is optimized for storing massive amounts of unstructured data. Unstructured data is data that does not adhere to a particular data model or @@ -23,10 +21,45 @@ definition, such as text or binary data. com.azure azure-storage-blob - 12.0.0-preview.2 + 12.0.0-preview.3 + +``` + +### 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-blobserviceclient), 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(); +``` + ### Create a Storage Account To create a Storage Account you can use the Azure Portal or [Azure CLI][storage_account_create_cli]. @@ -166,7 +199,7 @@ or Create a container using ContainerClient. ```java -containerClient.create(); +containerClient.setCreate(); ``` ### Uploading a blob from a stream @@ -213,7 +246,7 @@ Enumerating all blobs using ContainerClient ```java containerClient.listBlobsFlat() .forEach( - blobItem -> System.out.println("This is the blob name: " + blobItem.name()) + blobItem -> System.out.println("This is the blob name: " + blobItem.getName()) ); ``` @@ -283,3 +316,5 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ [coc_contact]: mailto:opencode@microsoft.com + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/storage/azure-storage-blob/README.png) diff --git a/sdk/storage/azure-storage-blob/downloadtofiledoesnotexist.txt b/sdk/storage/azure-storage-blob/downloadtofiledoesnotexist.txt new file mode 100644 index 000000000000..331d858ce9b1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/downloadtofiledoesnotexist.txt @@ -0,0 +1 @@ +default \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/pom.xml b/sdk/storage/azure-storage-blob/pom.xml index 59e986439e6d..2e2245151832 100644 --- a/sdk/storage/azure-storage-blob/pom.xml +++ b/sdk/storage/azure-storage-blob/pom.xml @@ -5,7 +5,7 @@ com.azure azure-client-sdk-parent - 1.3.0 + 1.4.0 ../../../pom.client.xml @@ -13,9 +13,10 @@ com.azure azure-storage-blob - 12.0.0-preview.3 + 12.0.0-preview.4 - azure-storage-blob + Microsoft Azure client library for Blob Storage + This module contains client library for Microsoft Azure Blob Storage. https://github.com/Azure/azure-sdk-for-java @@ -31,6 +32,10 @@ HEAD + + com.azure.storage.blob + + bintray @@ -49,12 +54,12 @@ com.azure azure-core - 1.0.0-preview.4 + 1.0.0-preview.5 com.azure azure-storage-common - 12.0.0-preview.3 + 12.0.0-preview.4 org.slf4j @@ -74,18 +79,18 @@ com.azure azure-core-test - 1.0.0-preview.4 + 1.0.0-preview.5 test com.azure - azure-identity - 1.0.0-preview.3 - test + azure-core-http-netty + 1.0.0-preview.5 - junit - junit + com.azure + azure-identity + 1.0.0-preview.4 test @@ -113,11 +118,6 @@ cglib-nodep test - - uk.org.lidalia - slf4j-test - test - diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASSignatureValues.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASSignatureValues.java deleted file mode 100644 index 50e00f0bfafc..000000000000 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASSignatureValues.java +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -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 java.time.OffsetDateTime; - -/** - * 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 SASQueryParameters} exist because - * the former is mutable and a logical representation while the latter is immutable and used to generate actual REST - * requests. - *

- * Please see - * here - * for more conceptual information on SAS: - *

- *

- * Please see - * here for further - * descriptions of the parameters, including which are required: - * - *

Please see - * here - * for additional samples.

- */ -final class AccountSASSignatureValues { - - private String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION; - - private SASProtocol protocol; - - private OffsetDateTime startTime; - - private OffsetDateTime expiryTime; - - private String permissions; - - private IPRange ipRange; - - private String services; - - private String resourceTypes; - - /** - * Initializes an {@code AccountSASSignatureValues} object with the version number set to the default and all - * other values empty. - */ - AccountSASSignatureValues() { - } - - /** - * @return the service version that is targeted, if {@code null} or empty the service version targeted by the - * library will be used. - */ - public String version() { - return version; - } - - /** - * Sets the service version that is targeted. Leave this {@code null} or empty to target the version used by the - * library. - * - * @param version Target version to set - * @return the updated AccountSASSignatureValues object. - */ - public AccountSASSignatureValues version(String version) { - this.version = version; - return this; - } - - /** - * @return the {@link SASProtocol} which determines the HTTP protocol that will be used. - */ - public SASProtocol protocol() { - return protocol; - } - - /** - * Sets the {@link SASProtocol} which determines the HTTP protocol that will be used. - * - * @param protocol Protocol to set - * @return the updated AccountSASSignatureValues object. - */ - public AccountSASSignatureValues protocol(SASProtocol protocol) { - this.protocol = protocol; - return this; - } - - /** - * @return when the SAS will take effect. - */ - public OffsetDateTime startTime() { - return startTime; - } - - /** - * Sets when the SAS will take effect. - * - * @param startTime Start time to set - * @return the updated AccountSASSignatureValues object. - */ - public AccountSASSignatureValues startTime(OffsetDateTime startTime) { - this.startTime = startTime; - return this; - } - - /** - * @return the time after which the SAS will no longer work. - */ - public OffsetDateTime expiryTime() { - return expiryTime; - } - - /** - * Sets the time after which the SAS will no longer work. - * - * @param expiryTime Expiry time to set - * @return the updated AccountSASSignatureValues object. - */ - public AccountSASSignatureValues expiryTime(OffsetDateTime expiryTime) { - this.expiryTime = expiryTime; - return this; - } - - /** - * @return the operations the SAS user may perform. Please refer to {@link AccountSASPermission} to help determine - * which permissions are allowed. - */ - public String permissions() { - return permissions; - } - - /** - * 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. - */ - public AccountSASSignatureValues permissions(String permissions) { - this.permissions = permissions; - return this; - } - - /** - * @return the {@link IPRange} which determines the IP ranges that are allowed to use the SAS. - */ - public IPRange ipRange() { - return ipRange; - } - - /** - * 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. - */ - public AccountSASSignatureValues ipRange(IPRange ipRange) { - this.ipRange = ipRange; - return this; - } - - /** - * @return the services accessible with this SAS. Please refer to {@link AccountSASService} to help determine which - * services are accessible. - */ - public String services() { - return services; - } - - /** - * 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. - */ - public AccountSASSignatureValues services(String services) { - this.services = services; - return this; - } - - /** - * @return the resource types accessible with this SAS. Please refer to {@link AccountSASResourceType} to help - * determine the resource types that are accessible. - */ - public String resourceTypes() { - return resourceTypes; - } - - /** - * 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. - */ - public AccountSASSignatureValues resourceTypes(String resourceTypes) { - this.resourceTypes = resourceTypes; - return this; - } - - /** - * Generates a {@link SASQueryParameters} object which contains all SAS query parameters needed to make an actual - * REST request. - * - * @param sharedKeyCredentials - * Credentials for the storage account and corresponding primary or secondary key. - * - * @return {@link SASQueryParameters} - * @throws RuntimeException If the HMAC-SHA256 signature for {@code sharedKeyCredentials} fails to generate. - */ - public SASQueryParameters generateSASQueryParameters(SharedKeyCredential sharedKeyCredentials) { - Utility.assertNotNull("SharedKeyCredential", sharedKeyCredentials); - Utility.assertNotNull("services", this.services); - Utility.assertNotNull("resourceTypes", this.resourceTypes); - Utility.assertNotNull("expiryTime", this.expiryTime); - Utility.assertNotNull("permissions", this.permissions); - Utility.assertNotNull("version", this.version); - - // Signature is generated on the un-url-encoded values. - String signature = sharedKeyCredentials.computeHmac256(stringToSign(sharedKeyCredentials)); - - return new SASQueryParameters(this.version, this.services, resourceTypes, - this.protocol, this.startTime, this.expiryTime, this.ipRange, null, - null, this.permissions, signature, null, null, null, null, null, null); - } - - private String stringToSign(final SharedKeyCredential sharedKeyCredentials) { - return String.join("\n", - sharedKeyCredentials.accountName(), - AccountSASPermission.parse(this.permissions).toString(), // guarantees ordering - this.services, - resourceTypes, - this.startTime == null ? Constants.EMPTY_STRING : Utility.ISO_8601_UTC_DATE_FORMATTER.format(this.startTime), - Utility.ISO_8601_UTC_DATE_FORMATTER.format(this.expiryTime), - this.ipRange == null ? Constants.EMPTY_STRING : this.ipRange.toString(), - this.protocol == null ? Constants.EMPTY_STRING : this.protocol.toString(), - this.version, - Constants.EMPTY_STRING // Account SAS requires an additional newline character - ); - } -} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java index 9cf6c224c0d3..41cbc240368c 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java @@ -5,6 +5,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.implementation.util.FluxUtil; import com.azure.core.util.Context; import com.azure.storage.blob.implementation.AzureBlobStorageImpl; import com.azure.storage.blob.models.AppendBlobAccessConditions; @@ -12,40 +13,40 @@ import com.azure.storage.blob.models.BlobAccessConditions; 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.Metadata; import com.azure.storage.blob.models.SourceModifiedAccessConditions; import com.azure.storage.common.Constants; -import io.netty.buffer.ByteBuf; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.net.URL; +import java.nio.ByteBuffer; +import static com.azure.core.implementation.util.FluxUtil.withContext; import static com.azure.storage.blob.PostProcessor.postProcessResponse; /** - * Client to an append blob. It may only be instantiated through a {@link BlobClientBuilder#buildAppendBlobAsyncClient()}, - * via the method {@link BlobAsyncClient#asAppendBlobAsyncClient()}, or via the method - * {@link ContainerAsyncClient#getAppendBlobAsyncClient(String)}. This class does not hold - * any state about a particular blob, but is instead a convenient way of sending appropriate - * requests to the resource on the service. + * Client to an append blob. It may only be instantiated through a + * {@link BlobClientBuilder#buildAppendBlobAsyncClient()}, via the method + * {@link BlobAsyncClient#asAppendBlobAsyncClient()}, or via the method + * {@link ContainerAsyncClient#getAppendBlobAsyncClient(String)}. This class does not hold any state about a particular + * blob, but is instead a convenient way of sending appropriate requests to the resource on the service. * *

* This client contains operations on a blob. Operations on a container are available on {@link ContainerAsyncClient}, * and operations on the service are available on {@link BlobServiceAsyncClient}. * *

- * Please refer - * to the Azure Docs - * for more information. + * Please refer to the Azure + * Docs for more information. * *

- * Note this client is an async client that returns reactive responses from Spring Reactor Core - * project (https://projectreactor.io/). Calling the methods in this client will NOT - * start the actual network operation, until {@code .subscribe()} is called on the reactive response. - * You can simply convert one of these responses to a {@link java.util.concurrent.CompletableFuture} - * object through {@link Mono#toFuture()}. + * Note this client is an async client that returns reactive responses from Spring Reactor Core project + * (https://projectreactor.io/). Calling the methods in this client will NOT start the actual network + * operation, until {@code .subscribe()} is called on the reactive response. You can simply convert one of these + * responses to a {@link java.util.concurrent.CompletableFuture} object through {@link Mono#toFuture()}. */ public final class AppendBlobAsyncClient extends BlobAsyncClient { /** @@ -60,44 +61,53 @@ public final class AppendBlobAsyncClient extends BlobAsyncClient { /** * Package-private constructor for use by {@link BlobClientBuilder}. + * * @param azureBlobStorage the API client for blob storage */ - AppendBlobAsyncClient(AzureBlobStorageImpl azureBlobStorage, String snapshot) { - super(azureBlobStorage, snapshot); + AppendBlobAsyncClient(AzureBlobStorageImpl azureBlobStorage, String snapshot, CpkInfo cpk) { + super(azureBlobStorage, snapshot, cpk); } /** * Creates a 0-length append blob. Call appendBlock to append data to an append blob. * - * @return - * A reactive response containing the information of the created appended blob. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobAsyncClient.create} + * + * @return A {@link Mono} containing the information of the created appended blob. */ - public Mono> create() { - return this.create(null, null, null); + public Mono create() { + return createWithResponse(null, null, null).flatMap(FluxUtil::toMono); } /** * Creates a 0-length append blob. Call appendBlock to append data to an append blob. * - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobAsyncClient.createWithResponse#BlobHTTPHeaders-Metadata-BlobAccessConditions} * - * @return - * A reactive response containing the information of the created appended blob. + * @param headers {@link BlobHTTPHeaders} + * @param metadata {@link Metadata} + * @param accessConditions {@link BlobAccessConditions} + * @return A {@link Mono} containing {@link Response} whose {@link Response#getValue() value} contains the created + * appended blob. */ - public Mono> create(BlobHTTPHeaders headers, Metadata metadata, BlobAccessConditions accessConditions) { + public Mono> createWithResponse(BlobHTTPHeaders headers, Metadata metadata, + BlobAccessConditions accessConditions) { + return withContext(context -> createWithResponse(headers, metadata, accessConditions, context)); + } + + Mono> createWithResponse(BlobHTTPHeaders headers, Metadata metadata, + BlobAccessConditions accessConditions, Context context) { metadata = (metadata == null) ? new Metadata() : metadata; accessConditions = (accessConditions == null) ? new BlobAccessConditions() : accessConditions; return postProcessResponse(this.azureBlobStorage.appendBlobs().createWithRestResponseAsync(null, - null, 0, null, metadata, null, null, - null, null, headers, accessConditions.leaseAccessConditions(), - accessConditions.modifiedAccessConditions(), Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, new AppendBlobItem(rb.deserializedHeaders()))); + null, 0, null, metadata, null, headers, accessConditions.getLeaseAccessConditions(), cpk, + accessConditions.getModifiedAccessConditions(), context)) + .map(rb -> new SimpleResponse<>(rb, new AppendBlobItem(rb.getDeserializedHeaders()))); } /** @@ -106,18 +116,18 @@ public Mono> create(BlobHTTPHeaders headers, Metadata m * Note that the data passed must be replayable if retries are enabled (the default). In other words, the * {@code Flux} must produce the same data each time it is subscribed to. * - * @param data - * The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled - * (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}. + *

Code Samples

* - * @return - * A reactive response containing the information of the append blob operation. + * {@codesnippet com.azure.storage.blob.AppendBlobAsyncClient.appendBlock#Flux-long} + * + * @param data The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled + * (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}. + * @return {@link Mono} containing the information of the append blob operation. */ - public Mono> appendBlock(Flux data, long length) { - return this.appendBlock(data, length, null); + public Mono appendBlock(Flux data, long length) { + return appendBlockWithResponse(data, length, null).flatMap(FluxUtil::toMono); } /** @@ -126,85 +136,94 @@ public Mono> appendBlock(Flux data, long lengt * Note that the data passed must be replayable if retries are enabled (the default). In other words, the * {@code Flux} must produce the same data each time it is subscribed to. * - * @param data - * The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled - * (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 appendBlobAccessConditions - * {@link AppendBlobAccessConditions} - * - * @return - * A reactive response containing the information of the append blob operation. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobAsyncClient.appendBlockWithResponse#Flux-long-AppendBlobAccessConditions} + * + * @param data The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled + * (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 appendBlobAccessConditions {@link AppendBlobAccessConditions} + * @return A {@link Mono} containing {@link Response} whose {@link Response#getValue() value} contains the append + * blob operation. */ - public Mono> appendBlock(Flux data, long length, - AppendBlobAccessConditions appendBlobAccessConditions) { + public Mono> appendBlockWithResponse(Flux data, long length, + AppendBlobAccessConditions appendBlobAccessConditions) { + return withContext(context -> appendBlockWithResponse(data, length, appendBlobAccessConditions, context)); + } + + Mono> appendBlockWithResponse(Flux data, long length, + AppendBlobAccessConditions appendBlobAccessConditions, Context context) { appendBlobAccessConditions = appendBlobAccessConditions == null ? new AppendBlobAccessConditions() : appendBlobAccessConditions; return postProcessResponse(this.azureBlobStorage.appendBlobs().appendBlockWithRestResponseAsync( - null, null, data, length, null, null, - null, null, null, null, - appendBlobAccessConditions.leaseAccessConditions(), - appendBlobAccessConditions.appendPositionAccessConditions(), - appendBlobAccessConditions.modifiedAccessConditions(), Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, new AppendBlobItem(rb.deserializedHeaders()))); + null, null, data, length, null, null, null, null, + appendBlobAccessConditions.getLeaseAccessConditions(), + appendBlobAccessConditions.getAppendPositionAccessConditions(), cpk, + appendBlobAccessConditions.getModifiedAccessConditions(), context)) + .map(rb -> new SimpleResponse<>(rb, new AppendBlobItem(rb.getDeserializedHeaders()))); } /** * Commits a new block of data from another blob to the end of this append blob. * - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can - * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob - * must either be public or must be authenticated via a shared access signature. If the source blob is - * public, no authentication is required to perform the operation. - * @param sourceRange - * The source {@link BlobRange} to copy. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobAsyncClient.appendBlockFromUrl#URL-BlobRange} * - * @return - * A reactive response containing the information of the append blob operation. + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage + * account can be authenticated via Shared Key. However, if the source is a blob in another account, the source blob + * must either be public or must be authenticated via a shared access signature. If the source blob is public, no + * authentication is required to perform the operation. + * @param sourceRange The source {@link BlobRange} to copy. + * @return {@link Mono} containing the information of the append blob operation. */ - public Mono> appendBlockFromUrl(URL sourceURL, BlobRange sourceRange) { - return this.appendBlockFromUrl(sourceURL, sourceRange, null, null, - null); + public Mono appendBlockFromUrl(URL sourceURL, BlobRange sourceRange) { + return appendBlockFromUrlWithResponse(sourceURL, sourceRange, null, null, null).flatMap(FluxUtil::toMono); } /** * Commits a new block of data from another blob to the end of this append blob. * - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can - * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob - * must either be public or must be authenticated via a shared access signature. If the source blob is - * public, no authentication is required to perform the operation. - * @param sourceRange - * {@link BlobRange} - * @param sourceContentMD5 - * An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 - * of the received data and fail the request if it does not match the provided MD5. - * @param destAccessConditions - * {@link AppendBlobAccessConditions} - * @param sourceAccessConditions - * {@link SourceModifiedAccessConditions} - * - * @return - * A reactive response containing the information of the append blob operation. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobAsyncClient.appendBlockFromUrlWithResponse#URL-BlobRange-byte-AppendBlobAccessConditions-SourceModifiedAccessConditions} + * + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage + * account can be authenticated via Shared Key. However, if the source is a blob in another account, the source blob + * must either be public or must be authenticated via a shared access signature. If the source blob is public, no + * authentication is required to perform the operation. + * @param sourceRange {@link BlobRange} + * @param sourceContentMD5 An MD5 hash of the block content from the source blob. If specified, the service will + * calculate the MD5 of the received data and fail the request if it does not match the provided MD5. + * @param destAccessConditions {@link AppendBlobAccessConditions} + * @param sourceAccessConditions {@link SourceModifiedAccessConditions} + * @return A {@link Mono} containing {@link Response} whose {@link Response#getValue() value} contains the append + * blob operation. */ - public Mono> appendBlockFromUrl(URL sourceURL, BlobRange sourceRange, - byte[] sourceContentMD5, AppendBlobAccessConditions destAccessConditions, - SourceModifiedAccessConditions sourceAccessConditions) { + public Mono> appendBlockFromUrlWithResponse(URL sourceURL, BlobRange sourceRange, + byte[] sourceContentMD5, AppendBlobAccessConditions destAccessConditions, + SourceModifiedAccessConditions sourceAccessConditions) { + return withContext(context -> appendBlockFromUrlWithResponse(sourceURL, sourceRange, sourceContentMD5, + destAccessConditions, sourceAccessConditions, context)); + } + + Mono> appendBlockFromUrlWithResponse(URL sourceURL, BlobRange sourceRange, + byte[] sourceContentMD5, AppendBlobAccessConditions destAccessConditions, + SourceModifiedAccessConditions sourceAccessConditions, Context context) { sourceRange = sourceRange == null ? new BlobRange(0) : sourceRange; destAccessConditions = destAccessConditions == null ? new AppendBlobAccessConditions() : destAccessConditions; return postProcessResponse( this.azureBlobStorage.appendBlobs().appendBlockFromUrlWithRestResponseAsync(null, null, - sourceURL, 0, sourceRange.toString(), sourceContentMD5, null, null, - destAccessConditions.leaseAccessConditions(), - destAccessConditions.appendPositionAccessConditions(), - destAccessConditions.modifiedAccessConditions(), sourceAccessConditions, Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, new AppendBlobItem(rb.deserializedHeaders()))); + sourceURL, 0, sourceRange.toString(), sourceContentMD5, null, null, null, null, cpk, + destAccessConditions.getLeaseAccessConditions(), + destAccessConditions.getAppendPositionAccessConditions(), + destAccessConditions.getModifiedAccessConditions(), sourceAccessConditions, context)) + .map(rb -> new SimpleResponse<>(rb, new AppendBlobItem(rb.getDeserializedHeaders(), + rb.getHeaders().value("x-ms-request-server-encrypted")))); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobClient.java index cacb5e0c30ed..637be1d0d667 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobClient.java @@ -3,7 +3,9 @@ package com.azure.storage.blob; +import com.azure.core.exception.UnexpectedLengthException; import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; import com.azure.storage.blob.models.AppendBlobAccessConditions; import com.azure.storage.blob.models.AppendBlobItem; import com.azure.storage.blob.models.BlobAccessConditions; @@ -11,35 +13,34 @@ import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.Metadata; import com.azure.storage.blob.models.SourceModifiedAccessConditions; +import com.azure.storage.blob.models.StorageException; import com.azure.storage.common.Utility; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; import java.io.InputStream; import java.net.URL; +import java.nio.ByteBuffer; import java.time.Duration; - +import java.util.Objects; /** - * Client to an append blob. It may only be instantiated through a {@link BlobClientBuilder}, via - * the method {@link BlobClient#asAppendBlobClient()}, or via the method - * {@link ContainerClient#getAppendBlobClient(String)}. This class does not hold - * any state about a particular blob, but is instead a convenient way of sending appropriate - * requests to the resource on the service. + * Client to an append blob. It may only be instantiated through a {@link BlobClientBuilder}, via the method {@link + * BlobClient#asAppendBlobClient()}, or via the method {@link ContainerClient#getAppendBlobClient(String)}. This class + * does not hold any state about a particular blob, but is instead a convenient way of sending appropriate requests to + * the resource on the service. * *

- * This client contains operations on a blob. Operations on a container are available on {@link ContainerClient}, - * and operations on the service are available on {@link BlobServiceClient}. + * This client contains operations on a blob. Operations on a container are available on {@link ContainerClient}, and + * operations on the service are available on {@link BlobServiceClient}. * *

- * Please refer to the Azure Docs - * for more information. + * Please refer to the Azure + * Docs for more information. */ public final class AppendBlobClient extends BlobClient { - private AppendBlobAsyncClient appendBlobAsyncClient; + private final AppendBlobAsyncClient appendBlobAsyncClient; /** * Indicates the maximum number of bytes that can be sent in a call to appendBlock. @@ -53,6 +54,7 @@ public final class AppendBlobClient extends BlobClient { /** * Package-private constructor for use by {@link BlobClientBuilder}. + * * @param appendBlobAsyncClient the async append blob client */ AppendBlobClient(AppendBlobAsyncClient appendBlobAsyncClient) { @@ -65,9 +67,7 @@ public final class AppendBlobClient extends BlobClient { * it will be overwritten. * * @return A {@link BlobOutputStream} object used to write data to the blob. - * - * @throws StorageException - * If a storage service error occurred. + * @throws StorageException If a storage service error occurred. */ public BlobOutputStream getBlobOutputStream() { return getBlobOutputStream(null); @@ -77,47 +77,64 @@ public BlobOutputStream getBlobOutputStream() { * Creates and opens an output stream to write data to the append blob. If the blob already exists on the service, * it will be overwritten. * - * @param accessConditions - * A {@link BlobAccessConditions} object that represents the access conditions for the blob. - * + * @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. + * @throws StorageException If a storage service error occurred. */ public BlobOutputStream getBlobOutputStream(AppendBlobAccessConditions accessConditions) { - return new BlobOutputStream(appendBlobAsyncClient, accessConditions); + return BlobOutputStream.appendBlobOutputStream(appendBlobAsyncClient, accessConditions); } /** * Creates a 0-length append blob. Call appendBlock to append data to an append blob. * - * @return - * The information of the created appended blob. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobClient.create} + * + * @return The information of the created appended blob. */ - public Response create() { - return this.create(null, null, null, null); + public AppendBlobItem create() { + return create(null, null, null, null); } /** * Creates a 0-length append blob. Call appendBlock to append data to an append blob. * - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The information of the created appended blob. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobClient.create#BlobHTTPHeaders-Metadata-BlobAccessConditions-Duration} + * + * @param headers {@link BlobHTTPHeaders} + * @param metadata {@link Metadata} + * @param accessConditions {@link BlobAccessConditions} + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @return The information of the created appended blob. */ - public Response create(BlobHTTPHeaders headers, Metadata metadata, - BlobAccessConditions accessConditions, Duration timeout) { - Mono> response = appendBlobAsyncClient.create(headers, metadata, accessConditions); - return Utility.blockWithOptionalTimeout(response, timeout); + public AppendBlobItem create(BlobHTTPHeaders headers, Metadata metadata, + BlobAccessConditions accessConditions, Duration timeout) { + return createWithResponse(headers, metadata, accessConditions, timeout, Context.NONE).getValue(); + } + + /** + * Creates a 0-length append blob. Call appendBlock to append data to an append blob. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobClient.createWithResponse#BlobHTTPHeaders-Metadata-BlobAccessConditions-Duration-Context} + * + * @param headers {@link BlobHTTPHeaders} + * @param metadata {@link Metadata} + * @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, Metadata metadata, + BlobAccessConditions accessConditions, Duration timeout, Context context) { + return Utility.blockWithOptionalTimeout(appendBlobAsyncClient. + createWithResponse(headers, metadata, accessConditions, context), timeout); } /** @@ -126,17 +143,17 @@ public Response create(BlobHTTPHeaders headers, Metadata metadat * Note that the data passed must be replayable if retries are enabled (the default). In other words, the * {@code Flux} must produce the same data each time it is subscribed to. * - * @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 - * emitted by the {@code Flux}. + *

Code Samples

* - * @return - * The information of the append blob operation. + * {@codesnippet com.azure.storage.blob.AppendBlobClient.appendBlock#InputStream-long} + * + * @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 emitted by the {@code Flux}. + * @return The information of the append blob operation. */ - public Response appendBlock(InputStream data, long length) { - return this.appendBlock(data, length, null, null); + public AppendBlobItem appendBlock(InputStream data, long length) { + return appendBlockWithResponse(data, length, null, null, Context.NONE).getValue(); } /** @@ -145,85 +162,99 @@ public Response appendBlock(InputStream data, long length) { * Note that the data passed must be replayable if retries are enabled (the default). In other words, the * {@code Flux} must produce the same data each time it is subscribed to. * - * @param data - * The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled - * (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 appendBlobAccessConditions - * {@link AppendBlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The information of the append blob operation. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobClient.appendBlockWithResponse#InputStream-long-AppendBlobAccessConditions-Duration-Context} + * + * @param data The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled + * (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 appendBlobAccessConditions {@link AppendBlobAccessConditions} + * @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 append blob operation. + * @throws UnexpectedLengthException when the length of data does not match the input {@code length}. + * @throws NullPointerException if the input data is null. */ - public Response appendBlock(InputStream data, long length, - AppendBlobAccessConditions appendBlobAccessConditions, Duration timeout) { - Flux fbb = Flux.range(0, (int) Math.ceil((double) length / (double) MAX_APPEND_BLOCK_BYTES)) - .map(i -> i * MAX_APPEND_BLOCK_BYTES) - .concatMap(pos -> Mono.fromCallable(() -> { - long count = pos + MAX_APPEND_BLOCK_BYTES > length ? length - pos : MAX_APPEND_BLOCK_BYTES; - byte[] cache = new byte[(int) count]; - int read = 0; - while (read < count) { - read += data.read(cache, read, (int) count - read); - } - - return ByteBufAllocator.DEFAULT.buffer((int) count).writeBytes(cache); - })); - - Mono> response = appendBlobAsyncClient.appendBlock(fbb.subscribeOn(Schedulers.elastic()), length, appendBlobAccessConditions); + public Response appendBlockWithResponse(InputStream data, long length, + AppendBlobAccessConditions appendBlobAccessConditions, Duration timeout, Context context) { + Objects.requireNonNull(data); + Flux fbb = Utility.convertStreamToByteBuffer(data, length, MAX_APPEND_BLOCK_BYTES); + Mono> response = appendBlobAsyncClient.appendBlockWithResponse( + fbb.subscribeOn(Schedulers.elastic()), length, appendBlobAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } /** * Commits a new block of data from another blob to the end of this append blob. * - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can - * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob - * must either be public or must be authenticated via a shared access signature. If the source blob is - * public, no authentication is required to perform the operation. - * @param sourceRange - * The source {@link BlobRange} to copy. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobClient.appendBlockFromUrl#URL-BlobRange} + * + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage + * account can be authenticated via Shared Key. However, if the source is a blob in another account, the source blob + * must either be public or must be authenticated via a shared access signature. If the source blob is public, no + * authentication is required to perform the operation. + * @param sourceRange The source {@link BlobRange} to copy. + * @return The information of the append blob operation. + */ + public AppendBlobItem appendBlockFromUrl(URL sourceURL, BlobRange sourceRange) { + return appendBlockFromUrl(sourceURL, sourceRange, null, null, null, null); + } + + /** + * Commits a new block of data from another blob to the end of this append blob. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobClient.appendBlockFromUrl#URL-BlobRange-byte-AppendBlobAccessConditions-SourceModifiedAccessConditions-Duration} * - * @return - * The information of the append blob operation. + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage + * account can be authenticated via Shared Key. However, if the source is a blob in another account, the source blob + * must either be public or must be authenticated via a shared access signature. If the source blob is public, no + * authentication is required to perform the operation. + * @param sourceRange {@link BlobRange} + * @param sourceContentMD5 An MD5 hash of the block content from the source blob. If specified, the service will + * calculate the MD5 of the received data and fail the request if it does not match the provided MD5. + * @param destAccessConditions {@link AppendBlobAccessConditions} + * @param sourceAccessConditions {@link SourceModifiedAccessConditions} + * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @return The information of the append blob operation. */ - public Response appendBlockFromUrl(URL sourceURL, BlobRange sourceRange) { - return this.appendBlockFromUrl(sourceURL, sourceRange, null, null, - null, null); + public AppendBlobItem appendBlockFromUrl(URL sourceURL, BlobRange sourceRange, + byte[] sourceContentMD5, AppendBlobAccessConditions destAccessConditions, + SourceModifiedAccessConditions sourceAccessConditions, Duration timeout) { + return this.appendBlockFromUrlWithResponse(sourceURL, sourceRange, sourceContentMD5, destAccessConditions, + sourceAccessConditions, timeout, Context.NONE).getValue(); } /** * Commits a new block of data from another blob to the end of this append blob. * - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can - * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob - * must either be public or must be authenticated via a shared access signature. If the source blob is - * public, no authentication is required to perform the operation. - * @param sourceRange - * {@link BlobRange} - * @param sourceContentMD5 - * An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 - * of the received data and fail the request if it does not match the provided MD5. - * @param destAccessConditions - * {@link AppendBlobAccessConditions} - * @param sourceAccessConditions - * {@link SourceModifiedAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The information of the append blob operation. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.AppendBlobClient.appendBlockFromUrlWithResponse#URL-BlobRange-byte-AppendBlobAccessConditions-SourceModifiedAccessConditions-Duration-Context} + * + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage + * account can be authenticated via Shared Key. However, if the source is a blob in another account, the source blob + * must either be public or must be authenticated via a shared access signature. If the source blob is public, no + * authentication is required to perform the operation. + * @param sourceRange {@link BlobRange} + * @param sourceContentMD5 An MD5 hash of the block content from the source blob. If specified, the service will + * calculate the MD5 of the received data and fail the request if it does not match the provided MD5. + * @param destAccessConditions {@link AppendBlobAccessConditions} + * @param sourceAccessConditions {@link SourceModifiedAccessConditions} + * @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 append blob operation. */ - public Response appendBlockFromUrl(URL sourceURL, BlobRange sourceRange, - byte[] sourceContentMD5, AppendBlobAccessConditions destAccessConditions, - SourceModifiedAccessConditions sourceAccessConditions, Duration timeout) { - Mono> response = appendBlobAsyncClient.appendBlockFromUrl(sourceURL, sourceRange, sourceContentMD5, destAccessConditions, sourceAccessConditions); + public Response appendBlockFromUrlWithResponse(URL sourceURL, BlobRange sourceRange, + byte[] sourceContentMD5, AppendBlobAccessConditions destAccessConditions, + SourceModifiedAccessConditions sourceAccessConditions, Duration timeout, Context context) { + Mono> response = appendBlobAsyncClient.appendBlockFromUrlWithResponse(sourceURL, + sourceRange, sourceContentMD5, destAccessConditions, sourceAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BaseBlobClientBuilder.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BaseBlobClientBuilder.java new file mode 100644 index 000000000000..1a90f9c5b76b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BaseBlobClientBuilder.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.storage.blob.models.CpkInfo; +import com.azure.storage.blob.models.CustomerProvidedKey; +import com.azure.storage.common.BaseClientBuilder; +import com.azure.storage.common.Constants; +import com.azure.storage.common.policy.ResponseValidationPolicyBuilder; + +abstract class BaseBlobClientBuilder> extends BaseClientBuilder { + + private static final String BLOB_ENDPOINT_MIDFIX = "blob"; + + protected CpkInfo cpk; + + @SuppressWarnings("unchecked") + public T customerProvidedKey(CustomerProvidedKey key) { + cpk = new CpkInfo() + .setEncryptionKey(key.getKey()) + .setEncryptionKeySha256(key.getKeySHA256()) + .setEncryptionAlgorithm(key.getEncryptionAlgorithm()); + + return (T) this; + } + + @Override + protected final UserAgentPolicy getUserAgentPolicy() { + return new UserAgentPolicy(BlobConfiguration.NAME, BlobConfiguration.VERSION, super.getConfiguration()); + } + + @Override + protected final String getServiceUrlMidfix() { + return BLOB_ENDPOINT_MIDFIX; + } + + @Override + protected final void applyServiceSpecificValidations(ResponseValidationPolicyBuilder builder) { + // CPK + builder.addOptionalEcho(Constants.HeaderConstants.ENCRYPTION_KEY_SHA256); + } +} 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 b4a5e38668c6..54b2b198cd07 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 @@ -3,6 +3,7 @@ package com.azure.storage.blob; +import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpResponse; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; @@ -10,27 +11,32 @@ import com.azure.core.implementation.http.UrlBuilder; import com.azure.core.implementation.util.FluxUtil; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; import com.azure.storage.blob.implementation.AzureBlobStorageImpl; import com.azure.storage.blob.models.AccessTier; +import com.azure.storage.blob.models.AccessTierOptional; +import com.azure.storage.blob.models.AccessTierRequired; import com.azure.storage.blob.models.BlobAccessConditions; import com.azure.storage.blob.models.BlobHTTPHeaders; import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.BlobStartCopyFromURLHeaders; +import com.azure.storage.blob.models.CpkInfo; import com.azure.storage.blob.models.DeleteSnapshotsOptionType; import com.azure.storage.blob.models.LeaseAccessConditions; import com.azure.storage.blob.models.Metadata; import com.azure.storage.blob.models.ModifiedAccessConditions; +import com.azure.storage.blob.models.RehydratePriority; import com.azure.storage.blob.models.ReliableDownloadOptions; 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 io.netty.buffer.ByteBuf; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; @@ -42,12 +48,14 @@ import java.net.URL; import java.nio.ByteBuffer; import java.nio.channels.AsynchronousFileChannel; +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 static com.azure.core.implementation.util.FluxUtil.withContext; import static com.azure.storage.blob.PostProcessor.postProcessResponse; /** @@ -79,17 +87,21 @@ public class BlobAsyncClient { private static final int BLOB_DEFAULT_DOWNLOAD_BLOCK_SIZE = 4 * Constants.MB; private static final int BLOB_MAX_DOWNLOAD_BLOCK_SIZE = 100 * Constants.MB; + private final ClientLogger logger = new ClientLogger(BlobAsyncClient.class); + final AzureBlobStorageImpl azureBlobStorage; protected final String snapshot; + protected final CpkInfo cpk; /** * Package-private constructor for use by {@link BlobClientBuilder}. * * @param azureBlobStorage the API client for blob storage */ - BlobAsyncClient(AzureBlobStorageImpl azureBlobStorage, String snapshot) { + BlobAsyncClient(AzureBlobStorageImpl azureBlobStorage, String snapshot, CpkInfo cpk) { this.azureBlobStorage = azureBlobStorage; this.snapshot = snapshot; + this.cpk = cpk; } /** @@ -102,7 +114,7 @@ public BlockBlobAsyncClient asBlockBlobAsyncClient() { return new BlockBlobAsyncClient(new AzureBlobStorageBuilder() .url(getBlobUrl().toString()) .pipeline(azureBlobStorage.getHttpPipeline()) - .build(), snapshot); + .build(), snapshot, cpk); } /** @@ -115,7 +127,7 @@ public AppendBlobAsyncClient asAppendBlobAsyncClient() { return new AppendBlobAsyncClient(new AzureBlobStorageBuilder() .url(getBlobUrl().toString()) .pipeline(azureBlobStorage.getHttpPipeline()) - .build(), snapshot); + .build(), snapshot, cpk); } /** @@ -128,7 +140,7 @@ public PageBlobAsyncClient asPageBlobAsyncClient() { return new PageBlobAsyncClient(new AzureBlobStorageBuilder() .url(getBlobUrl().toString()) .pipeline(azureBlobStorage.getHttpPipeline()) - .build(), snapshot); + .build(), snapshot, cpk); } /** @@ -141,7 +153,7 @@ public BlobAsyncClient getSnapshotClient(String snapshot) { return new BlobAsyncClient(new AzureBlobStorageBuilder() .url(getBlobUrl().toString()) .pipeline(azureBlobStorage.getHttpPipeline()) - .build(), snapshot); + .build(), snapshot, cpk); } /** @@ -154,9 +166,9 @@ public BlobAsyncClient getSnapshotClient(String snapshot) { public ContainerAsyncClient getContainerAsyncClient() { BlobURLParts parts = URLParser.parse(getBlobUrl()); return new ContainerAsyncClient(new AzureBlobStorageBuilder() - .url(String.format("%s://%s/%s", parts.scheme(), parts.host(), parts.containerName())) + .url(String.format("%s://%s/%s", parts.getScheme(), parts.getHost(), parts.getContainerName())) .pipeline(azureBlobStorage.getHttpPipeline()) - .build()); + .build(), cpk); } /** @@ -169,14 +181,24 @@ public URL getBlobUrl() { try { UrlBuilder urlBuilder = UrlBuilder.parse(azureBlobStorage.getUrl()); if (snapshot != null) { - urlBuilder.query("snapshot=" + snapshot); + urlBuilder.setQuery("snapshot=" + snapshot); } return urlBuilder.toURL(); } catch (MalformedURLException e) { - throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.getUrl()), e); + throw logger.logExceptionAsError(new RuntimeException( + String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.getUrl()), e)); } } + /** + * Gets the {@link HttpPipeline} powering this client. + * + * @return The pipeline. + */ + public HttpPipeline getHttpPipeline() { + return azureBlobStorage.getHttpPipeline(); + } + /** * Determines if the blob this client represents exists in the cloud. * @@ -186,12 +208,30 @@ public URL getBlobUrl() { * * @return true if the blob exists, false if it doesn't */ - public Mono> exists() { - return this.getProperties() + public Mono exists() { + return existsWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Determines if the blob this client represents exists in the cloud. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.existsWithResponse} + * + * @return true if the blob exists, false if it doesn't + */ + public Mono> existsWithResponse() { + return withContext(this::existsWithResponse); + } + + Mono> existsWithResponse(Context context) { + return this.getPropertiesWithResponse(null, context) .map(cp -> (Response) new SimpleResponse<>(cp, true)) - .onErrorResume(t -> t instanceof StorageException && ((StorageException) t).statusCode() == 404, t -> { - HttpResponse response = ((StorageException) t).response(); - return Mono.just(new SimpleResponse<>(response.request(), response.statusCode(), response.headers(), false)); + .onErrorResume(t -> t instanceof StorageException && ((StorageException) t).getStatusCode() == 404, t -> { + HttpResponse response = ((StorageException) t).getResponse(); + return Mono.just(new SimpleResponse<>(response.getRequest(), response.getStatusCode(), + response.getHeaders(), false)); }); } @@ -208,8 +248,8 @@ public Mono> exists() { * @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 this.startCopyFromURL(sourceURL, null, null, null); + public Mono startCopyFromURL(URL sourceURL) { + return startCopyFromURLWithResponse(sourceURL, null, null, null, null, null).flatMap(FluxUtil::toMono); } /** @@ -217,13 +257,15 @@ public Mono> startCopyFromURL(URL sourceURL) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.startCopyFromURLWithResponse#URL-Metadata-AccessTier-RehydratePriority-ModifiedAccessConditions-BlobAccessConditions} * *

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 metadata {@link Metadata} + * @param tier {@link AccessTier} for the destination blob. + * @param priority {@link RehydratePriority} for rehydrating the blob. * @param sourceModifiedAccessConditions {@link ModifiedAccessConditions} against the source. Standard HTTP Access * conditions related to the modification of data. ETag and LastModifiedTime are used to construct conditions * related to when the blob was changed relative to the given request. The request will fail if the specified @@ -231,23 +273,34 @@ 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> startCopyFromURL(URL sourceURL, Metadata metadata, ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions) { + public Mono> startCopyFromURLWithResponse(URL sourceURL, Metadata metadata, AccessTier tier, + RehydratePriority priority, ModifiedAccessConditions sourceModifiedAccessConditions, + BlobAccessConditions destAccessConditions) { + return withContext(context -> startCopyFromURLWithResponse(sourceURL, metadata, tier, priority, + sourceModifiedAccessConditions, destAccessConditions, context)); + } + + Mono> startCopyFromURLWithResponse(URL sourceURL, Metadata metadata, AccessTier tier, + RehydratePriority priority, ModifiedAccessConditions sourceModifiedAccessConditions, + BlobAccessConditions destAccessConditions, Context context) { metadata = metadata == null ? new Metadata() : metadata; sourceModifiedAccessConditions = sourceModifiedAccessConditions == null ? new ModifiedAccessConditions() : sourceModifiedAccessConditions; destAccessConditions = destAccessConditions == null ? new BlobAccessConditions() : destAccessConditions; + AccessTierOptional tierOp = tier == null ? null : AccessTierOptional.fromString(tier.toString()); // We want to hide the SourceAccessConditions type from the user for consistency's sake, so we convert here. SourceModifiedAccessConditions sourceConditions = new SourceModifiedAccessConditions() - .sourceIfModifiedSince(sourceModifiedAccessConditions.ifModifiedSince()) - .sourceIfUnmodifiedSince(sourceModifiedAccessConditions.ifUnmodifiedSince()) - .sourceIfMatch(sourceModifiedAccessConditions.ifMatch()) - .sourceIfNoneMatch(sourceModifiedAccessConditions.ifNoneMatch()); + .setSourceIfModifiedSince(sourceModifiedAccessConditions.getIfModifiedSince()) + .setSourceIfUnmodifiedSince(sourceModifiedAccessConditions.getIfUnmodifiedSince()) + .setSourceIfMatch(sourceModifiedAccessConditions.getIfMatch()) + .setSourceIfNoneMatch(sourceModifiedAccessConditions.getIfNoneMatch()); return postProcessResponse(this.azureBlobStorage.blobs().startCopyFromURLWithRestResponseAsync( - null, null, sourceURL, null, metadata, null, sourceConditions, - destAccessConditions.modifiedAccessConditions(), destAccessConditions.leaseAccessConditions(), Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().copyId())); + null, null, sourceURL, null, metadata, tierOp, priority, null, sourceConditions, + destAccessConditions.getModifiedAccessConditions(), destAccessConditions.getLeaseAccessConditions(), + context)) + .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getCopyId())); } /** @@ -264,8 +317,8 @@ public Mono> startCopyFromURL(URL sourceURL, Metadata metadata, * BlobStartCopyFromURLHeaders} object. * @return A reactive response signalling completion. */ - public Mono abortCopyFromURL(String copyId) { - return this.abortCopyFromURL(copyId, null); + public Mono abortCopyFromURL(String copyId) { + return abortCopyFromURLWithResponse(copyId, null).flatMap(FluxUtil::toMono); } /** @@ -273,7 +326,7 @@ public Mono abortCopyFromURL(String copyId) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.abortCopyFromURL#String-LeaseAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.abortCopyFromURLWithResponse#String-LeaseAccessConditions} * *

For more information, see the * Azure Docs

@@ -284,9 +337,14 @@ public Mono abortCopyFromURL(String copyId) { * not match the active lease on the blob. * @return A reactive response signalling completion. */ - public Mono abortCopyFromURL(String copyId, LeaseAccessConditions leaseAccessConditions) { + 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( - null, null, copyId, null, null, leaseAccessConditions, Context.NONE)) + null, null, copyId, null, null, leaseAccessConditions, context)) .map(VoidResponse::new); } @@ -303,8 +361,8 @@ public Mono abortCopyFromURL(String copyId, LeaseAccessConditions * @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 this.copyFromURL(copySource, null, null, null); + public Mono copyFromURL(URL copySource) { + return copyFromURLWithResponse(copySource, null, null, null, null).flatMap(FluxUtil::toMono); } /** @@ -312,13 +370,14 @@ public Mono> copyFromURL(URL copySource) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.copyFromURLWithResponse#URL-Metadata-AccessTier-ModifiedAccessConditions-BlobAccessConditions} * *

For more information, see the * Azure Docs

* * @param copySource The source URL to copy from. URLs outside of Azure may only be copied to block blobs. * @param metadata {@link Metadata} + * @param tier {@link AccessTier} for the destination blob. * @param sourceModifiedAccessConditions {@link ModifiedAccessConditions} against the source. Standard HTTP Access * conditions related to the modification of data. ETag and LastModifiedTime are used to construct conditions * related to when the blob was changed relative to the given request. The request will fail if the specified @@ -326,23 +385,33 @@ 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> copyFromURL(URL copySource, Metadata metadata, ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions) { + public Mono> copyFromURLWithResponse(URL copySource, Metadata metadata, AccessTier tier, + ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions) { + return withContext(context -> copyFromURLWithResponse(copySource, metadata, tier, + sourceModifiedAccessConditions, destAccessConditions, context)); + } + + Mono> copyFromURLWithResponse(URL copySource, Metadata metadata, AccessTier tier, + ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions, + Context context) { metadata = metadata == null ? new Metadata() : metadata; sourceModifiedAccessConditions = sourceModifiedAccessConditions == null ? new ModifiedAccessConditions() : sourceModifiedAccessConditions; destAccessConditions = destAccessConditions == null ? new BlobAccessConditions() : destAccessConditions; + AccessTierOptional tierOp = tier == null ? null : AccessTierOptional.fromString(tier.toString()); // We want to hide the SourceAccessConditions type from the user for consistency's sake, so we convert here. SourceModifiedAccessConditions sourceConditions = new SourceModifiedAccessConditions() - .sourceIfModifiedSince(sourceModifiedAccessConditions.ifModifiedSince()) - .sourceIfUnmodifiedSince(sourceModifiedAccessConditions.ifUnmodifiedSince()) - .sourceIfMatch(sourceModifiedAccessConditions.ifMatch()) - .sourceIfNoneMatch(sourceModifiedAccessConditions.ifNoneMatch()); + .setSourceIfModifiedSince(sourceModifiedAccessConditions.getIfModifiedSince()) + .setSourceIfUnmodifiedSince(sourceModifiedAccessConditions.getIfUnmodifiedSince()) + .setSourceIfMatch(sourceModifiedAccessConditions.getIfMatch()) + .setSourceIfNoneMatch(sourceModifiedAccessConditions.getIfNoneMatch()); return postProcessResponse(this.azureBlobStorage.blobs().copyFromURLWithRestResponseAsync( - null, null, copySource, null, metadata, null, sourceConditions, - destAccessConditions.modifiedAccessConditions(), destAccessConditions.leaseAccessConditions(), Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().copyId())); + null, null, copySource, null, metadata, tierOp, null, sourceConditions, + destAccessConditions.getModifiedAccessConditions(), destAccessConditions.getLeaseAccessConditions(), + context)) + .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getCopyId())); } /** @@ -358,8 +427,8 @@ public Mono> copyFromURL(URL copySource, Metadata metadata, Mod * * @return A reactive response containing the blob data. */ - public Mono>> download() { - return this.download(null, null, null, false); + public Mono> download() { + return downloadWithResponse(null, null, null, false).flatMap(FluxUtil::toMono); } /** @@ -368,7 +437,7 @@ public Mono>> download() { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.download#BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.downloadWithResponse#BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean} * *

For more information, see the * Azure Docs

@@ -379,11 +448,18 @@ public Mono>> download() { * @param rangeGetContentMD5 Whether the contentMD5 for the specified blob range should be returned. * @return A reactive response containing the blob data. */ - public Mono>> download(BlobRange range, ReliableDownloadOptions options, BlobAccessConditions accessConditions, boolean rangeGetContentMD5) { - return this.download(range, accessConditions, rangeGetContentMD5) + public Mono>> downloadWithResponse(BlobRange range, ReliableDownloadOptions options, + BlobAccessConditions accessConditions, boolean rangeGetContentMD5) { + return withContext(context -> downloadWithResponse(range, options, accessConditions, rangeGetContentMD5, + context)); + } + + Mono>> downloadWithResponse(BlobRange range, ReliableDownloadOptions options, + BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Context context) { + return download(range, accessConditions, rangeGetContentMD5, context) .map(response -> new SimpleResponse<>( - response.rawResponse(), - response.body(options).map(ByteBuf::nioBuffer).switchIfEmpty(Flux.just(ByteBuffer.allocate(0))))); + response.getRawResponse(), + response.body(options).switchIfEmpty(Flux.just(ByteBuffer.wrap(new byte[0]))))); } /** @@ -397,45 +473,49 @@ public Mono>> download(BlobRange range, ReliableDownlo * @param accessConditions {@link BlobAccessConditions} * @param rangeGetContentMD5 Whether the contentMD5 for the specified blob range should be returned. * @return Emits the successful response. - * @apiNote ## Sample Code \n [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=upload_download - * "Sample code for BlobAsyncClient.download")] \n For more samples, please see the [Samples - * file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) */ - Mono download(BlobRange range, BlobAccessConditions accessConditions, boolean rangeGetContentMD5) { + Mono download(BlobRange range, BlobAccessConditions accessConditions, + boolean rangeGetContentMD5) { + return withContext(context -> download(range, accessConditions, rangeGetContentMD5, context)); + } + + Mono download(BlobRange range, BlobAccessConditions accessConditions, + boolean rangeGetContentMD5, Context context) { range = range == null ? new BlobRange(0) : range; Boolean getMD5 = rangeGetContentMD5 ? rangeGetContentMD5 : null; accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; HTTPGetterInfo info = new HTTPGetterInfo() - .offset(range.offset()) - .count(range.count()) - .eTag(accessConditions.modifiedAccessConditions().ifMatch()); + .setOffset(range.getOffset()) + .setCount(range.getCount()) + .setETag(accessConditions.getModifiedAccessConditions().getIfMatch()); // TODO: range is BlobRange but expected as String // TODO: figure out correct response return postProcessResponse(this.azureBlobStorage.blobs().downloadWithRestResponseAsync( - null, null, snapshot, null, null, range.toHeaderValue(), getMD5, - null, null, null, null, - accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), Context.NONE)) + null, null, snapshot, null, range.toHeaderValue(), getMD5, null, null, + accessConditions.getLeaseAccessConditions(), cpk, accessConditions.getModifiedAccessConditions(), context)) // Convert the autorest response to a DownloadAsyncResponse, which enable reliable download. .map(response -> { // If there wasn't an etag originally specified, lock on the one returned. - info.eTag(response.deserializedHeaders().eTag()); + info.setETag(response.getDeserializedHeaders().getETag()); return new DownloadAsyncResponse(response, info, // In the event of a stream failure, make a new request to pick up where we left off. newInfo -> - this.download(new BlobRange(newInfo.offset(), newInfo.count()), - new BlobAccessConditions().modifiedAccessConditions( - new ModifiedAccessConditions().ifMatch(info.eTag())), false)); + this.download(new BlobRange(newInfo.getOffset(), newInfo.getCount()), + new BlobAccessConditions().setModifiedAccessConditions( + new ModifiedAccessConditions().setIfMatch(info.getETag())), false, context)); }); } + /** - * Downloads the entire blob into a file specified by the path. The file will be created if it doesn't exist. - * Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link - * AppendBlobClient}. - *

- * This method makes an extra HTTP call to get the length of the blob in the beginning. To avoid this extra call, - * use the other overload providing the {@link BlobRange} parameter. + * Downloads the entire blob into a file specified by the path. + * + *

The file will be created and must not exist, if the file already exists a {@link FileAlreadyExistsException} + * will be thrown.

+ * + *

Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link + * AppendBlobClient}.

* *

Code Samples

* @@ -448,16 +528,21 @@ Mono download(BlobRange range, BlobAccessConditions acces * @return An empty response */ public Mono downloadToFile(String filePath) { - return this.downloadToFile(filePath, null, BLOB_DEFAULT_DOWNLOAD_BLOCK_SIZE, null, null, false); + return downloadToFile(filePath, null, BLOB_DEFAULT_DOWNLOAD_BLOCK_SIZE, null, null, false); } /** - * Downloads a range of bytes blob into a file specified by the path. The file will be created if it doesn't exist. - * Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link - * AppendBlobClient}. - *

- * This method makes an extra HTTP call to get the length of the blob in the beginning. To avoid this extra call, - * provide the {@link BlobRange} parameter. + * Downloads the entire blob into a file specified by the path. + * + *

The file will be created and must not exist, if the file already exists a {@link FileAlreadyExistsException} + * will be thrown.

+ * + *

Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link + * AppendBlobClient}.

+ * + *

This method makes an extra HTTP call to get the length of the blob in the beginning. To avoid this extra + * call, + * provide the {@link BlobRange} parameter.

* *

Code Samples

* @@ -476,27 +561,35 @@ public Mono downloadToFile(String filePath) { * @throws IllegalArgumentException If {@code blockSize} is less than 0 or greater than 100MB. * @throws UncheckedIOException If an I/O error occurs. */ - public Mono downloadToFile(String filePath, BlobRange range, Integer blockSize, ReliableDownloadOptions options, - BlobAccessConditions accessConditions, boolean rangeGetContentMD5) { - if (blockSize < 0 || blockSize > BLOB_MAX_DOWNLOAD_BLOCK_SIZE) { - throw new IllegalArgumentException("Block size should not exceed 100MB"); + public Mono downloadToFile(String filePath, BlobRange range, Integer blockSize, + ReliableDownloadOptions options, BlobAccessConditions accessConditions, boolean rangeGetContentMD5) { + return withContext(context -> downloadToFile(filePath, range, blockSize, options, accessConditions, + rangeGetContentMD5, context)); + } + + Mono downloadToFile(String filePath, BlobRange range, Integer blockSize, ReliableDownloadOptions options, + BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Context context) { + if (blockSize != null) { + Utility.assertInBounds("blockSize", blockSize, 0, BLOB_MAX_DOWNLOAD_BLOCK_SIZE); } return Mono.using(() -> downloadToFileResourceSupplier(filePath), channel -> Mono.justOrEmpty(range) .switchIfEmpty(getFullBlobRange(accessConditions)) .flatMapMany(rg -> Flux.fromIterable(sliceBlobRange(rg, blockSize))) - .flatMap(chunk -> this.download(chunk, accessConditions, rangeGetContentMD5) + .flatMap(chunk -> this.download(chunk, accessConditions, rangeGetContentMD5, context) .subscribeOn(Schedulers.elastic()) - .flatMap(dar -> FluxUtil.bytebufStreamToFile(dar.body(options), channel, chunk.offset() - (range == null ? 0 : range.offset())))) + .flatMap(dar -> FluxUtil.writeFile(dar.body(options), channel, + chunk.getOffset() - (range == null ? 0 : range.getOffset())))) .then(), this::downloadToFileCleanup); } private AsynchronousFileChannel downloadToFileResourceSupplier(String filePath) { try { - return AsynchronousFileChannel.open(Paths.get(filePath), StandardOpenOption.READ, StandardOpenOption.WRITE); + return AsynchronousFileChannel.open(Paths.get(filePath), StandardOpenOption.READ, StandardOpenOption.WRITE, + StandardOpenOption.CREATE_NEW); } catch (IOException e) { - throw new UncheckedIOException(e); + throw logger.logExceptionAsError(new UncheckedIOException(e)); } } @@ -504,20 +597,20 @@ private void downloadToFileCleanup(AsynchronousFileChannel channel) { try { channel.close(); } catch (IOException e) { - throw new UncheckedIOException(e); + throw logger.logExceptionAsError(new UncheckedIOException(e)); } } private Mono getFullBlobRange(BlobAccessConditions accessConditions) { - return getProperties(accessConditions).map(rb -> new BlobRange(0, rb.value().blobSize())); + return getPropertiesWithResponse(accessConditions).map(rb -> new BlobRange(0, rb.getValue().getBlobSize())); } private List sliceBlobRange(BlobRange blobRange, Integer blockSize) { if (blockSize == null) { blockSize = BLOB_DEFAULT_DOWNLOAD_BLOCK_SIZE; } - long offset = blobRange.offset(); - long length = blobRange.count(); + long offset = blobRange.getOffset(); + long length = blobRange.getCount(); List chunks = new ArrayList<>(); for (long pos = offset; pos < offset + length; pos += blockSize) { long count = blockSize; @@ -541,8 +634,8 @@ private List sliceBlobRange(BlobRange blobRange, Integer blockSize) { * * @return A reactive response signalling completion. */ - public Mono delete() { - return this.delete(null, null); + public Mono delete() { + return deleteWithResponse(null, null).flatMap(FluxUtil::toMono); } /** @@ -550,7 +643,7 @@ public Mono delete() { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.delete#DeleteSnapshotsOptionType-BlobAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.deleteWithResponse#DeleteSnapshotsOptionType-BlobAccessConditions} * *

For more information, see the * Azure Docs

@@ -561,13 +654,19 @@ public Mono delete() { * @param accessConditions {@link BlobAccessConditions} * @return A reactive response signalling completion. */ - public Mono delete(DeleteSnapshotsOptionType deleteBlobSnapshotOptions, BlobAccessConditions accessConditions) { + public Mono deleteWithResponse(DeleteSnapshotsOptionType deleteBlobSnapshotOptions, + BlobAccessConditions accessConditions) { + return withContext(context -> deleteWithResponse(deleteBlobSnapshotOptions, accessConditions, context)); + } + + Mono deleteWithResponse(DeleteSnapshotsOptionType deleteBlobSnapshotOptions, + BlobAccessConditions accessConditions, Context context) { accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; return postProcessResponse(this.azureBlobStorage.blobs().deleteWithRestResponseAsync( - null, null, snapshot, null, null, deleteBlobSnapshotOptions, - null, accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), - Context.NONE)) + null, null, snapshot, null, deleteBlobSnapshotOptions, + null, accessConditions.getLeaseAccessConditions(), accessConditions.getModifiedAccessConditions(), + context)) .map(VoidResponse::new); } @@ -583,8 +682,8 @@ public Mono delete(DeleteSnapshotsOptionType deleteBlobSnapshotOpt * * @return A reactive response containing the blob properties and metadata. */ - public Mono> getProperties() { - return this.getProperties(null); + public Mono getProperties() { + return getPropertiesWithResponse(null).flatMap(FluxUtil::toMono); } /** @@ -592,7 +691,7 @@ public Mono> getProperties() { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.getProperties#BlobAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.getPropertiesWithResponse#BlobAccessConditions} * *

For more information, see the * Azure Docs

@@ -600,14 +699,17 @@ public Mono> getProperties() { * @param accessConditions {@link BlobAccessConditions} * @return A reactive response containing the blob properties and metadata. */ - public Mono> getProperties(BlobAccessConditions accessConditions) { + public Mono> getPropertiesWithResponse(BlobAccessConditions accessConditions) { + return withContext(context -> getPropertiesWithResponse(accessConditions, context)); + } + + Mono> getPropertiesWithResponse(BlobAccessConditions accessConditions, Context context) { accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; return postProcessResponse(this.azureBlobStorage.blobs().getPropertiesWithRestResponseAsync( - null, null, snapshot, null, null, null, - null, null, null, accessConditions.leaseAccessConditions(), - accessConditions.modifiedAccessConditions(), Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, new BlobProperties(rb.deserializedHeaders()))); + null, null, snapshot, null, null, accessConditions.getLeaseAccessConditions(), cpk, + accessConditions.getModifiedAccessConditions(), context)) + .map(rb -> new SimpleResponse<>(rb, new BlobProperties(rb.getDeserializedHeaders()))); } /** @@ -624,8 +726,8 @@ public Mono> getProperties(BlobAccessConditions accessC * @param headers {@link BlobHTTPHeaders} * @return A reactive response signalling completion. */ - public Mono setHTTPHeaders(BlobHTTPHeaders headers) { - return this.setHTTPHeaders(headers, null); + public Mono setHTTPHeaders(BlobHTTPHeaders headers) { + return setHTTPHeadersWithResponse(headers, null).flatMap(FluxUtil::toMono); } /** @@ -634,7 +736,7 @@ public Mono setHTTPHeaders(BlobHTTPHeaders headers) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.setHTTPHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions} * *

For more information, see the * Azure Docs

@@ -643,12 +745,18 @@ public Mono setHTTPHeaders(BlobHTTPHeaders headers) { * @param accessConditions {@link BlobAccessConditions} * @return A reactive response signalling completion. */ - public Mono setHTTPHeaders(BlobHTTPHeaders headers, BlobAccessConditions accessConditions) { + public Mono setHTTPHeadersWithResponse(BlobHTTPHeaders headers, + BlobAccessConditions accessConditions) { + return withContext(context -> setHTTPHeadersWithResponse(headers, accessConditions, context)); + } + + Mono setHTTPHeadersWithResponse(BlobHTTPHeaders headers, BlobAccessConditions accessConditions, + Context context) { accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; return postProcessResponse(this.azureBlobStorage.blobs().setHTTPHeadersWithRestResponseAsync( null, null, null, null, headers, - accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), Context.NONE)) + accessConditions.getLeaseAccessConditions(), accessConditions.getModifiedAccessConditions(), context)) .map(VoidResponse::new); } @@ -666,8 +774,8 @@ public Mono setHTTPHeaders(BlobHTTPHeaders headers, BlobAccessCond * @param metadata {@link Metadata} * @return A reactive response signalling completion. */ - public Mono setMetadata(Metadata metadata) { - return this.setMetadata(metadata, null); + public Mono setMetadata(Metadata metadata) { + return setMetadataWithResponse(metadata, null).flatMap(FluxUtil::toMono); } /** @@ -676,7 +784,7 @@ public Mono setMetadata(Metadata metadata) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.setMetadata#Metadata-BlobAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.setMetadataWithResponse#Metadata-BlobAccessConditions} * *

For more information, see the * Azure Docs

@@ -685,14 +793,18 @@ public Mono setMetadata(Metadata metadata) { * @param accessConditions {@link BlobAccessConditions} * @return A reactive response signalling completion. */ - public Mono setMetadata(Metadata metadata, BlobAccessConditions accessConditions) { + public Mono setMetadataWithResponse(Metadata metadata, BlobAccessConditions accessConditions) { + return withContext(context -> setMetadataWithResponse(metadata, accessConditions, context)); + } + + Mono setMetadataWithResponse(Metadata metadata, BlobAccessConditions accessConditions, + Context context) { metadata = metadata == null ? new Metadata() : metadata; accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; return postProcessResponse(this.azureBlobStorage.blobs().setMetadataWithRestResponseAsync( - null, null, null, metadata, null, null, - null, null, accessConditions.leaseAccessConditions(), - accessConditions.modifiedAccessConditions(), Context.NONE)) + null, null, null, metadata, null, accessConditions.getLeaseAccessConditions(), cpk, + accessConditions.getModifiedAccessConditions(), context)) .map(VoidResponse::new); } @@ -709,8 +821,8 @@ public Mono setMetadata(Metadata metadata, BlobAccessConditions ac * @return A response containing a {@link BlobAsyncClient} which is used to interact with the created snapshot, use * {@link BlobAsyncClient#getSnapshotId()} to get the identifier for the snapshot. */ - public Mono> createSnapshot() { - return this.createSnapshot(null, null); + public Mono createSnapshot() { + return createSnapshotWithResponse(null, null).flatMap(FluxUtil::toMono); } /** @@ -718,7 +830,7 @@ public Mono> createSnapshot() { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.createSnapshot#Metadata-BlobAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.createSnapshotWithResponse#Metadata-BlobAccessConditions} * *

For more information, see the * Azure Docs

@@ -728,15 +840,20 @@ public Mono> createSnapshot() { * @return A response containing a {@link BlobAsyncClient} which is used to interact with the created snapshot, use * {@link BlobAsyncClient#getSnapshotId()} to get the identifier for the snapshot. */ - public Mono> createSnapshot(Metadata metadata, BlobAccessConditions accessConditions) { + public Mono> createSnapshotWithResponse(Metadata metadata, + BlobAccessConditions accessConditions) { + return withContext(context -> createSnapshotWithResponse(metadata, accessConditions, context)); + } + + Mono> createSnapshotWithResponse(Metadata metadata, BlobAccessConditions accessConditions, + Context context) { metadata = metadata == null ? new Metadata() : metadata; accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; return postProcessResponse(this.azureBlobStorage.blobs().createSnapshotWithRestResponseAsync( - null, null, null, metadata, null, null, - null, null, accessConditions.modifiedAccessConditions(), - accessConditions.leaseAccessConditions(), Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, this.getSnapshotClient(rb.deserializedHeaders().snapshot()))); + null, null, null, metadata, null, cpk, accessConditions.getModifiedAccessConditions(), + accessConditions.getLeaseAccessConditions(), context)) + .map(rb -> new SimpleResponse<>(rb, this.getSnapshotClient(rb.getDeserializedHeaders().getSnapshot()))); } /** @@ -755,8 +872,8 @@ public Mono> createSnapshot(Metadata metadata, BlobAcc * @param tier The new tier for the blob. * @return A reactive response signalling completion. */ - public Mono setTier(AccessTier tier) { - return this.setTier(tier, null); + public Mono setTier(AccessTier tier) { + return setTierWithResponse(tier, null, null).flatMap(FluxUtil::toMono); } /** @@ -767,21 +884,29 @@ public Mono setTier(AccessTier tier) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.setTier#AccessTier-LeaseAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.setTierWithResponse#AccessTier-RehydratePriority-LeaseAccessConditions} * *

For more information, see the * Azure Docs

* * @param tier The new tier for the blob. + * @param priority Optional priority to set for re-hydrating blobs. * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does * not match the active lease on the blob. * @return A reactive response signalling completion. */ - public Mono setTier(AccessTier tier, LeaseAccessConditions leaseAccessConditions) { + public Mono setTierWithResponse(AccessTier tier, RehydratePriority priority, + LeaseAccessConditions leaseAccessConditions) { + return withContext(context -> setTierWithResponse(tier, priority, leaseAccessConditions, context)); + } + + Mono setTierWithResponse(AccessTier tier, RehydratePriority priority, + LeaseAccessConditions leaseAccessConditions, Context context) { Utility.assertNotNull("tier", tier); + AccessTierRequired accessTierRequired = AccessTierRequired.fromString(tier.toString()); return postProcessResponse(this.azureBlobStorage.blobs().setTierWithRestResponseAsync( - null, null, tier, null, null, leaseAccessConditions, Context.NONE)) + null, null, accessTierRequired, null, priority, null, leaseAccessConditions, context)) .map(VoidResponse::new); } @@ -797,9 +922,29 @@ public Mono setTier(AccessTier tier, LeaseAccessConditions leaseAc * * @return A reactive response signalling completion. */ - public Mono undelete() { + public Mono undelete() { + return undeleteWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Undelete restores the content and metadata of a soft-deleted blob and/or any associated soft-deleted snapshots. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.undeleteWithResponse} + * + *

For more information, see the + * Azure Docs

+ * + * @return A reactive response signalling completion. + */ + public Mono undeleteWithResponse() { + return withContext(this::undeleteWithResponse); + } + + Mono undeleteWithResponse(Context context) { return postProcessResponse(this.azureBlobStorage.blobs().undeleteWithRestResponseAsync(null, - null, Context.NONE)) + null, context)) .map(VoidResponse::new); } @@ -819,8 +964,8 @@ public Mono undelete() { * non-infinite lease can be between 15 and 60 seconds. * @return A reactive response containing the lease ID. */ - public Mono> acquireLease(String proposedId, int duration) { - return this.acquireLease(proposedId, duration, null); + public Mono acquireLease(String proposedId, int duration) { + return acquireLeaseWithResponse(proposedId, duration, null).flatMap(FluxUtil::toMono); } /** @@ -829,7 +974,7 @@ public Mono> acquireLease(String proposedId, int duration) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int-ModifiedAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.acquireLeaseWithResponse#String-int-ModifiedAccessConditions} * *

For more information, see the * Azure Docs

@@ -843,17 +988,24 @@ public Mono> acquireLease(String proposedId, int duration) { * @return A reactive response containing the lease ID. * @throws IllegalArgumentException If {@code duration} is outside the bounds of 15 to 60 or isn't -1. */ - public Mono> acquireLease(String proposedId, int duration, ModifiedAccessConditions modifiedAccessConditions) { + public Mono> acquireLeaseWithResponse(String proposedId, int duration, + ModifiedAccessConditions modifiedAccessConditions) { + return withContext(context -> + acquireLeaseWithResponse(proposedId, duration, modifiedAccessConditions, context)); + } + + Mono> acquireLeaseWithResponse(String proposedId, int duration, + ModifiedAccessConditions modifiedAccessConditions, Context context) { if (!(duration == -1 || (duration >= 15 && duration <= 60))) { // Throwing is preferred to Mono.error because this will error out immediately instead of waiting until // subscription. - throw new IllegalArgumentException("Duration must be -1 or between 15 and 60."); + throw logger.logExceptionAsError(new IllegalArgumentException("Duration must be -1 or between 15 and 60.")); } return postProcessResponse(this.azureBlobStorage.blobs().acquireLeaseWithRestResponseAsync( null, null, null, duration, proposedId, null, - modifiedAccessConditions, Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseId())); + modifiedAccessConditions, context)) + .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getLeaseId())); } /** @@ -869,8 +1021,8 @@ public Mono> acquireLease(String proposedId, int duration, Modi * @param leaseId The leaseId of the active lease on the blob. * @return A reactive response containing the renewed lease ID. */ - public Mono> renewLease(String leaseId) { - return this.renewLease(leaseId, null); + public Mono renewLease(String leaseId) { + return renewLeaseWithResponse(leaseId, null).flatMap(FluxUtil::toMono); } /** @@ -878,7 +1030,7 @@ public Mono> renewLease(String leaseId) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.renewLease#String-ModifiedAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.renewLeaseWithResponse#String-ModifiedAccessConditions} * *

For more information, see the * Azure Docs

@@ -889,10 +1041,16 @@ public Mono> renewLease(String leaseId) { * request. The request will fail if the specified condition is not satisfied. * @return A reactive response containing the renewed lease ID. */ - public Mono> renewLease(String leaseId, ModifiedAccessConditions modifiedAccessConditions) { + public Mono> renewLeaseWithResponse(String leaseId, + ModifiedAccessConditions modifiedAccessConditions) { + return withContext(context -> renewLeaseWithResponse(leaseId, modifiedAccessConditions, context)); + } + + Mono> renewLeaseWithResponse(String leaseId, ModifiedAccessConditions modifiedAccessConditions, + Context context) { return postProcessResponse(this.azureBlobStorage.blobs().renewLeaseWithRestResponseAsync(null, - null, leaseId, null, null, modifiedAccessConditions, Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseId())); + null, leaseId, null, null, modifiedAccessConditions, context)) + .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getLeaseId())); } /** @@ -908,8 +1066,8 @@ public Mono> renewLease(String leaseId, ModifiedAccessCondition * @param leaseId The leaseId of the active lease on the blob. * @return A reactive response signalling completion. */ - public Mono releaseLease(String leaseId) { - return this.releaseLease(leaseId, null); + public Mono releaseLease(String leaseId) { + return releaseLeaseWithResponse(leaseId, null).flatMap(FluxUtil::toMono); } /** @@ -917,7 +1075,7 @@ public Mono releaseLease(String leaseId) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.releaseLease#String-ModifiedAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.releaseLeaseWithResponse#String-ModifiedAccessConditions} * *

For more information, see the * Azure Docs

@@ -928,9 +1086,15 @@ public Mono releaseLease(String leaseId) { * request. The request will fail if the specified condition is not satisfied. * @return A reactive response signalling completion. */ - public Mono releaseLease(String leaseId, ModifiedAccessConditions modifiedAccessConditions) { + public Mono releaseLeaseWithResponse(String leaseId, + ModifiedAccessConditions modifiedAccessConditions) { + return withContext(context -> releaseLeaseWithResponse(leaseId, modifiedAccessConditions, context)); + } + + Mono releaseLeaseWithResponse(String leaseId, ModifiedAccessConditions modifiedAccessConditions, + Context context) { return postProcessResponse(this.azureBlobStorage.blobs().releaseLeaseWithRestResponseAsync(null, - null, leaseId, null, null, modifiedAccessConditions, Context.NONE)) + null, leaseId, null, null, modifiedAccessConditions, context)) .map(VoidResponse::new); } @@ -947,8 +1111,8 @@ public Mono releaseLease(String leaseId, ModifiedAccessConditions * * @return A reactive response containing the remaining time in the broken lease in seconds. */ - public Mono> breakLease() { - return this.breakLease(null, null); + public Mono breakLease() { + return breakLeaseWithResponse(null, null).flatMap(FluxUtil::toMono); } /** @@ -957,7 +1121,7 @@ public Mono> breakLease() { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.breakLease#Integer-ModifiedAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.breakLeaseWithResponse#Integer-ModifiedAccessConditions} * *

For more information, see the * Azure Docs

@@ -972,10 +1136,16 @@ public Mono> breakLease() { * request. The request will fail if the specified condition is not satisfied. * @return A reactive response containing the remaining time in the broken lease in seconds. */ - public Mono> breakLease(Integer breakPeriodInSeconds, ModifiedAccessConditions modifiedAccessConditions) { + public Mono> breakLeaseWithResponse(Integer breakPeriodInSeconds, + ModifiedAccessConditions modifiedAccessConditions) { + return withContext(context -> breakLeaseWithResponse(breakPeriodInSeconds, modifiedAccessConditions, context)); + } + + Mono> breakLeaseWithResponse(Integer breakPeriodInSeconds, + ModifiedAccessConditions modifiedAccessConditions, Context context) { return postProcessResponse(this.azureBlobStorage.blobs().breakLeaseWithRestResponseAsync(null, - null, null, breakPeriodInSeconds, null, modifiedAccessConditions, Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseTime())); + null, null, breakPeriodInSeconds, null, modifiedAccessConditions, context)) + .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getLeaseTime())); } /** @@ -992,8 +1162,8 @@ public Mono> breakLease(Integer breakPeriodInSeconds, Modified * @param proposedId A {@code String} in any valid GUID format. * @return A reactive response containing the new lease ID. */ - public Mono> changeLease(String leaseId, String proposedId) { - return this.changeLease(leaseId, proposedId, null); + public Mono changeLease(String leaseId, String proposedId) { + return changeLeaseWithResponse(leaseId, proposedId, null).flatMap(FluxUtil::toMono); } /** @@ -1001,7 +1171,7 @@ public Mono> changeLease(String leaseId, String proposedId) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobAsyncClient.changeLease#String-String-ModifiedAccessConditions} + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.changeLeaseWithResponse#String-String-ModifiedAccessConditions} * *

For more information, see the * Azure Docs

@@ -1013,10 +1183,16 @@ public Mono> changeLease(String leaseId, String proposedId) { * request. The request will fail if the specified condition is not satisfied. * @return A reactive response containing the new lease ID. */ - public Mono> changeLease(String leaseId, String proposedId, ModifiedAccessConditions modifiedAccessConditions) { + public Mono> changeLeaseWithResponse(String leaseId, String proposedId, + ModifiedAccessConditions modifiedAccessConditions) { + return withContext(context -> changeLeaseWithResponse(leaseId, proposedId, modifiedAccessConditions, context)); + } + + Mono> changeLeaseWithResponse(String leaseId, String proposedId, + ModifiedAccessConditions modifiedAccessConditions, Context context) { return postProcessResponse(this.azureBlobStorage.blobs().changeLeaseWithRestResponseAsync(null, - null, leaseId, proposedId, null, null, modifiedAccessConditions, Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseId())); + null, leaseId, proposedId, null, null, modifiedAccessConditions, context)) + .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getLeaseId())); } /** @@ -1031,10 +1207,30 @@ public Mono> changeLease(String leaseId, String proposedId, Mod * * @return a reactor response containing the sku name and account kind. */ - public Mono> getAccountInfo() { + public Mono getAccountInfo() { + return getAccountInfoWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Returns the sku name and account kind for the account. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.getAccountInfoWithResponse} + * + *

For more information, see the + * Azure Docs

+ * + * @return a reactor response containing the sku name and account kind. + */ + public Mono> getAccountInfoWithResponse() { + return withContext(this::getAccountInfoWithResponse); + } + + Mono> getAccountInfoWithResponse(Context context) { return postProcessResponse( - this.azureBlobStorage.blobs().getAccountInfoWithRestResponseAsync(null, null, Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, new StorageAccountInfo(rb.deserializedHeaders()))); + this.azureBlobStorage.blobs().getAccountInfoWithRestResponseAsync(null, null, context)) + .map(rb -> new SimpleResponse<>(rb, new StorageAccountInfo(rb.getDeserializedHeaders()))); } /** @@ -1047,7 +1243,7 @@ public Mono> getAccountInfo() { * @return A string that represents the SAS token */ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName, - BlobSASPermission permissions, OffsetDateTime expiryTime) { + 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 */); @@ -1067,8 +1263,8 @@ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, Str * @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) { + 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 */); @@ -1077,9 +1273,17 @@ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, Str /** * Generates a user delegation SAS token with the specified parameters * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.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 ContainerSASPermissions} permission 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 @@ -1093,25 +1297,27 @@ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, Str * @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) { + BlobSASPermission permissions, OffsetDateTime expiryTime, OffsetDateTime startTime, String version, + SASProtocol sasProtocol, IPRange ipRange, String cacheControl, String contentDisposition, + String contentEncoding, String contentLanguage, String contentType) { - ServiceSASSignatureValues serviceSASSignatureValues = new ServiceSASSignatureValues(version, sasProtocol, - startTime, expiryTime, permissions == null ? null : permissions.toString(), ipRange, null /* identifier*/, - cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType); + BlobServiceSASSignatureValues blobServiceSASSignatureValues = new BlobServiceSASSignatureValues(version, + sasProtocol, startTime, expiryTime, permissions == null ? null : permissions.toString(), ipRange, + null /* identifier*/, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType); - ServiceSASSignatureValues values = configureServiceSASSignatureValues(serviceSASSignatureValues, accountName); + BlobServiceSASSignatureValues values = configureServiceSASSignatureValues(blobServiceSASSignatureValues, + accountName); - SASQueryParameters sasQueryParameters = values.generateSASQueryParameters(userDelegationKey); + BlobServiceSASQueryParameters blobServiceSasQueryParameters = + values.generateSASQueryParameters(userDelegationKey); - return sasQueryParameters.encode(); + return blobServiceSasQueryParameters.encode(); } /** * Generates a SAS token with the specified parameters * - * @param permissions The {@code ContainerSASPermissions} permission 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 */ @@ -1137,7 +1343,7 @@ public String generateSAS(String 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 ContainerSASPermissions} permission 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 @@ -1146,7 +1352,7 @@ public String generateSAS(String identifier) { * @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) { + 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 */); @@ -1155,8 +1361,15 @@ public String generateSAS(String identifier, BlobSASPermission permissions, Offs /** * Generates a SAS token with the specified parameters * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.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 ContainerSASPermissions} permission 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 @@ -1170,46 +1383,47 @@ public String generateSAS(String identifier, BlobSASPermission permissions, Offs * @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) { + OffsetDateTime startTime, String version, SASProtocol sasProtocol, IPRange ipRange, String cacheControl, + String contentDisposition, String contentEncoding, String contentLanguage, String contentType) { - ServiceSASSignatureValues serviceSASSignatureValues = new ServiceSASSignatureValues(version, sasProtocol, - startTime, expiryTime, permissions == null ? null : permissions.toString(), ipRange, identifier, - cacheControl, contentDisposition, contentEncoding, contentLanguage, 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); - ServiceSASSignatureValues values = configureServiceSASSignatureValues(serviceSASSignatureValues, - sharedKeyCredential.accountName()); + BlobServiceSASSignatureValues values = configureServiceSASSignatureValues(blobServiceSASSignatureValues, + sharedKeyCredential.getAccountName()); - SASQueryParameters sasQueryParameters = values.generateSASQueryParameters(sharedKeyCredential); + BlobServiceSASQueryParameters blobServiceSasQueryParameters = + values.generateSASQueryParameters(sharedKeyCredential); - return sasQueryParameters.encode(); + return blobServiceSasQueryParameters.encode(); } /** - * Sets serviceSASSignatureValues parameters dependent on the current blob type + * Sets blobServiceSASSignatureValues parameters dependent on the current blob type */ - ServiceSASSignatureValues configureServiceSASSignatureValues(ServiceSASSignatureValues serviceSASSignatureValues, - String accountName) { + BlobServiceSASSignatureValues configureServiceSASSignatureValues( + BlobServiceSASSignatureValues blobServiceSASSignatureValues, String accountName) { // Set canonical name - serviceSASSignatureValues.canonicalName(this.azureBlobStorage.getUrl(), accountName); + blobServiceSASSignatureValues.setCanonicalName(this.azureBlobStorage.getUrl(), accountName); // Set snapshotId - serviceSASSignatureValues.snapshotId(getSnapshotId()); + blobServiceSASSignatureValues.setSnapshotId(getSnapshotId()); // Set resource if (isSnapshot()) { - serviceSASSignatureValues.resource(Constants.UrlConstants.SAS_BLOB_SNAPSHOT_CONSTANT); + blobServiceSASSignatureValues.setResource(Constants.UrlConstants.SAS_BLOB_SNAPSHOT_CONSTANT); } else { - serviceSASSignatureValues.resource(Constants.UrlConstants.SAS_BLOB_CONSTANT); + blobServiceSASSignatureValues.setResource(Constants.UrlConstants.SAS_BLOB_CONSTANT); } - return serviceSASSignatureValues; + return blobServiceSASSignatureValues; } /** 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 91ff5eb97dbc..f510cd399ade 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 @@ -3,9 +3,12 @@ package com.azure.storage.blob; +import com.azure.core.http.HttpPipeline; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.util.Context; +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; @@ -15,8 +18,10 @@ import com.azure.storage.blob.models.LeaseAccessConditions; import com.azure.storage.blob.models.Metadata; import com.azure.storage.blob.models.ModifiedAccessConditions; +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.StorageException; import com.azure.storage.blob.models.UserDelegationKey; import com.azure.storage.common.IPRange; import com.azure.storage.common.SASProtocol; @@ -27,6 +32,7 @@ import java.io.OutputStream; import java.io.UncheckedIOException; import java.net.URL; +import java.nio.file.FileAlreadyExistsException; import java.time.Duration; import java.time.OffsetDateTime; @@ -50,6 +56,8 @@ * Docs for more information. */ public class BlobClient { + private final ClientLogger logger = new ClientLogger(BlobClient.class); + private final BlobAsyncClient blobAsyncClient; /** @@ -121,6 +129,15 @@ public URL getBlobUrl() { return blobAsyncClient.getBlobUrl(); } + /** + * Gets the {@link HttpPipeline} powering this client. + * + * @return The pipeline. + */ + public HttpPipeline getHttpPipeline() { + return blobAsyncClient.getHttpPipeline(); + } + /** * Opens a blob input stream to download the blob. *

@@ -143,7 +160,7 @@ public final BlobInputStream openInputStream() { * @throws StorageException If a storage service error occurred. */ public final BlobInputStream openInputStream(BlobRange range, BlobAccessConditions accessConditions) { - return new BlobInputStream(blobAsyncClient, range.offset(), range.count(), accessConditions); + return new BlobInputStream(blobAsyncClient, range.getOffset(), range.getCount(), accessConditions); } /** @@ -155,8 +172,8 @@ public final BlobInputStream openInputStream(BlobRange range, BlobAccessConditio * * @return true if the container exists, false if it doesn't */ - public Response exists() { - return this.exists(null); + public Boolean exists() { + return existsWithResponse(null, Context.NONE).getValue(); } /** @@ -164,13 +181,14 @@ public Response exists() { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.exists#Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.existsWithResponse#Duration-Context} * * @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 true if the container exists, false if it doesn't */ - public Response exists(Duration timeout) { - Mono> response = blobAsyncClient.exists(); + public Response existsWithResponse(Duration timeout, Context context) { + Mono> response = blobAsyncClient.existsWithResponse(context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -188,8 +206,8 @@ public Response exists(Duration timeout) { * @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 Response startCopyFromURL(URL sourceURL) { - return this.startCopyFromURL(sourceURL, null, null, null, null); + public String startCopyFromURL(URL sourceURL) { + return startCopyFromURLWithResponse(sourceURL, null, null, null, null, null, null, Context.NONE).getValue(); } /** @@ -197,25 +215,30 @@ public Response startCopyFromURL(URL sourceURL) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.startCopyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.startCopyFromURLWithResponse#URL-Metadata-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 metadata {@link Metadata} + * @param tier {@link AccessTier} for the destination blob. + * @param priority {@link RehydratePriority} for rehydrating the blob. * @param sourceModifiedAccessConditions {@link ModifiedAccessConditions} against the source. Standard HTTP Access * conditions related to the modification of data. ETag and LastModifiedTime are used to construct conditions * related to when the blob was changed relative to the given request. The request will fail if the specified * condition is not satisfied. * @param destAccessConditions {@link BlobAccessConditions} against the destination. * @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 copy ID for the long running operation. */ - public Response startCopyFromURL(URL sourceURL, Metadata metadata, ModifiedAccessConditions sourceModifiedAccessConditions, - BlobAccessConditions destAccessConditions, Duration timeout) { + public Response startCopyFromURLWithResponse(URL sourceURL, Metadata metadata, AccessTier tier, + RehydratePriority priority, ModifiedAccessConditions sourceModifiedAccessConditions, + BlobAccessConditions destAccessConditions, Duration timeout, Context context) { Mono> response = blobAsyncClient - .startCopyFromURL(sourceURL, metadata, sourceModifiedAccessConditions, destAccessConditions); + .startCopyFromURLWithResponse(sourceURL, metadata, tier, priority, sourceModifiedAccessConditions, + destAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -232,10 +255,9 @@ public Response startCopyFromURL(URL sourceURL, Metadata metadata, Modif * * @param copyId The id of the copy operation to abort. Returned as the {@code copyId} field on the {@link * BlobStartCopyFromURLHeaders} object. - * @return A response containing status code and HTTP headers. */ - public VoidResponse abortCopyFromURL(String copyId) { - return this.abortCopyFromURL(copyId, null, null); + public void abortCopyFromURL(String copyId) { + abortCopyFromURLWithResponse(copyId, null, null, Context.NONE); } /** @@ -243,7 +265,7 @@ public VoidResponse abortCopyFromURL(String copyId) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.abortCopyFromURL#String-LeaseAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.abortCopyFromURLWithResponse#String-LeaseAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -253,11 +275,13 @@ public VoidResponse abortCopyFromURL(String copyId) { * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does * not match the active lease on the blob. * @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 VoidResponse abortCopyFromURL(String copyId, LeaseAccessConditions leaseAccessConditions, Duration timeout) { - Mono response = blobAsyncClient - .abortCopyFromURL(copyId, leaseAccessConditions); + public VoidResponse abortCopyFromURLWithResponse(String copyId, LeaseAccessConditions leaseAccessConditions, + Duration timeout, Context context) { + Mono response = blobAsyncClient.abortCopyFromURLWithResponse(copyId, leaseAccessConditions, + context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -275,8 +299,8 @@ public VoidResponse abortCopyFromURL(String copyId, LeaseAccessConditions leaseA * @param copySource The source URL to copy from. * @return The copy ID for the long running operation. */ - public Response copyFromURL(URL copySource) { - return this.copyFromURL(copySource, null, null, null, null); + public String copyFromURL(URL copySource) { + return copyFromURLWithResponse(copySource, null, null, null, null, null, Context.NONE).getValue(); } /** @@ -284,25 +308,29 @@ public Response copyFromURL(URL copySource) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.copyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.copyFromURLWithResponse#URL-Metadata-AccessTier-ModifiedAccessConditions-BlobAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

* * @param copySource The source URL to copy from. URLs outside of Azure may only be copied to block blobs. * @param metadata {@link Metadata} + * @param tier {@link AccessTier} for the destination blob. * @param sourceModifiedAccessConditions {@link ModifiedAccessConditions} against the source. Standard HTTP Access * conditions related to the modification of data. ETag and LastModifiedTime are used to construct conditions * related to when the blob was changed relative to the given request. The request will fail if the specified * condition is not satisfied. * @param destAccessConditions {@link BlobAccessConditions} against the destination. * @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 copy ID for the long running operation. */ - public Response copyFromURL(URL copySource, Metadata metadata, ModifiedAccessConditions sourceModifiedAccessConditions, - BlobAccessConditions destAccessConditions, Duration timeout) { + public Response copyFromURLWithResponse(URL copySource, Metadata metadata, AccessTier tier, + ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions, + Duration timeout, Context context) { Mono> response = blobAsyncClient - .copyFromURL(copySource, metadata, sourceModifiedAccessConditions, destAccessConditions); + .copyFromURLWithResponse(copySource, metadata, tier, sourceModifiedAccessConditions, destAccessConditions, + context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -319,11 +347,10 @@ public Response copyFromURL(URL copySource, Metadata metadata, ModifiedA * Azure Docs

* * @param stream A non-null {@link OutputStream} instance where the downloaded data will be written. - * @return A response containing status code and HTTP headers. * @throws UncheckedIOException If an I/O error occurs. */ - public VoidResponse download(OutputStream stream) { - return this.download(stream, null, null, null, false, null); + public void download(OutputStream stream) { + downloadWithResponse(stream, null, null, null, false, null, Context.NONE); } /** @@ -332,7 +359,7 @@ public VoidResponse download(OutputStream stream) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.download#OutputStream-BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.downloadWithResponse#OutputStream-BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration-Context} * *

For more information, see the * Azure Docs

@@ -343,19 +370,20 @@ public VoidResponse download(OutputStream stream) { * @param accessConditions {@link BlobAccessConditions} * @param rangeGetContentMD5 Whether the contentMD5 for the specified blob range should be returned. * @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. * @throws UncheckedIOException If an I/O error occurs. */ - public VoidResponse download(OutputStream stream, BlobRange range, ReliableDownloadOptions options, - BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Duration timeout) { + public VoidResponse downloadWithResponse(OutputStream stream, BlobRange range, ReliableDownloadOptions options, + BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Duration timeout, Context context) { Mono download = blobAsyncClient - .download(range, options, accessConditions, rangeGetContentMD5) - .flatMapMany(res -> res.value() + .downloadWithResponse(range, options, accessConditions, rangeGetContentMD5, context) + .flatMapMany(res -> res.getValue() .doOnNext(bf -> { try { stream.write(bf.array()); } catch (IOException e) { - throw new UncheckedIOException(e); + throw logger.logExceptionAsError(new UncheckedIOException(e)); } }).map(bf -> res)) .last() @@ -365,9 +393,13 @@ public VoidResponse download(OutputStream stream, BlobRange range, ReliableDownl } /** - * Downloads the entire blob into a file specified by the path. The file will be created if it doesn't exist. - * Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link - * AppendBlobClient}. + * Downloads the entire blob into a file specified by the path. + * + *

The file will be created and must not exist, if the file already exists a {@link FileAlreadyExistsException} + * will be thrown.

+ * + *

Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link + * AppendBlobClient}.

* *

Code Samples

* @@ -380,17 +412,24 @@ public VoidResponse download(OutputStream stream, BlobRange range, ReliableDownl * @throws UncheckedIOException If an I/O error occurs */ public void downloadToFile(String filePath) { - blobAsyncClient.downloadToFile(filePath); + downloadToFile(filePath, null, null, null, null, false, null, Context.NONE); } /** - * Downloads a range of bytes blob into a file specified by the path. The file will be created if it doesn't exist. - * Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link - * AppendBlobClient}. + * Downloads the entire blob into a file specified by the path. + * + *

The file will be created and must not exist, if the file already exists a {@link FileAlreadyExistsException} + * will be thrown.

+ * + *

Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link + * AppendBlobClient}.

+ * + *

This method makes an extra HTTP call to get the length of the blob in the beginning. To avoid this extra + * call, provide the {@link BlobRange} parameter.

* *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration-Context} * *

For more information, see the * Azure Docs

@@ -402,11 +441,13 @@ public void downloadToFile(String filePath) { * @param accessConditions {@link BlobAccessConditions} * @param rangeGetContentMD5 Whether the contentMD5 for the specified blob range should be returned. * @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. * @throws UncheckedIOException If an I/O error occurs */ public void downloadToFile(String filePath, BlobRange range, Integer blockSize, ReliableDownloadOptions options, - BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Duration timeout) { - Mono download = blobAsyncClient.downloadToFile(filePath, range, blockSize, options, accessConditions, rangeGetContentMD5); + BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Duration timeout, Context context) { + Mono download = blobAsyncClient.downloadToFile(filePath, range, blockSize, options, accessConditions, + rangeGetContentMD5, context); Utility.blockWithOptionalTimeout(download, timeout); } @@ -420,11 +461,9 @@ public void downloadToFile(String filePath, BlobRange range, Integer blockSize, * *

For more information, see the * Azure Docs

- * - * @return A response containing status code and HTTP headers. */ - public VoidResponse delete() { - return this.delete(null, null, null); + public void delete() { + deleteWithResponse(null, null, null, Context.NONE); } /** @@ -432,7 +471,7 @@ public VoidResponse delete() { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.delete#DeleteSnapshotsOptionType-BlobAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.deleteWithResponse#DeleteSnapshotsOptionType-BlobAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -442,12 +481,13 @@ public VoidResponse delete() { * deleted, you must pass null. * @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 VoidResponse delete(DeleteSnapshotsOptionType deleteBlobSnapshotOptions, - BlobAccessConditions accessConditions, Duration timeout) { + public VoidResponse deleteWithResponse(DeleteSnapshotsOptionType deleteBlobSnapshotOptions, + BlobAccessConditions accessConditions, Duration timeout, Context context) { Mono response = blobAsyncClient - .delete(deleteBlobSnapshotOptions, accessConditions); + .deleteWithResponse(deleteBlobSnapshotOptions, accessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -464,8 +504,8 @@ public VoidResponse delete(DeleteSnapshotsOptionType deleteBlobSnapshotOptions, * * @return The blob properties and metadata. */ - public Response getProperties() { - return this.getProperties(null, null); + public BlobProperties getProperties() { + return getPropertiesWithResponse(null, null, Context.NONE).getValue(); } /** @@ -473,18 +513,19 @@ public Response getProperties() { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.getProperties#BlobAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.getPropertiesWithResponse#BlobAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

* * @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 blob properties and metadata. */ - public Response getProperties(BlobAccessConditions accessConditions, Duration timeout) { - Mono> response = blobAsyncClient - .getProperties(accessConditions); + public Response getPropertiesWithResponse(BlobAccessConditions accessConditions, Duration timeout, + Context context) { + Mono> response = blobAsyncClient.getPropertiesWithResponse(accessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -501,10 +542,9 @@ public Response getProperties(BlobAccessConditions accessConditi * Azure Docs

* * @param headers {@link BlobHTTPHeaders} - * @return A response containing status code and HTTP headers. */ - public VoidResponse setHTTPHeaders(BlobHTTPHeaders headers) { - return this.setHTTPHeaders(headers, null, null); + public void setHTTPHeaders(BlobHTTPHeaders headers) { + setHTTPHeadersWithResponse(headers, null, null, Context.NONE); } /** @@ -513,7 +553,7 @@ public VoidResponse setHTTPHeaders(BlobHTTPHeaders headers) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.setHTTPHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -521,12 +561,13 @@ public VoidResponse setHTTPHeaders(BlobHTTPHeaders headers) { * @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 VoidResponse setHTTPHeaders(BlobHTTPHeaders headers, BlobAccessConditions accessConditions, - Duration timeout) { + public VoidResponse setHTTPHeadersWithResponse(BlobHTTPHeaders headers, BlobAccessConditions accessConditions, + Duration timeout, Context context) { Mono response = blobAsyncClient - .setHTTPHeaders(headers, accessConditions); + .setHTTPHeadersWithResponse(headers, accessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -543,10 +584,9 @@ public VoidResponse setHTTPHeaders(BlobHTTPHeaders headers, BlobAccessConditions * Azure Docs

* * @param metadata {@link Metadata} - * @return A response containing status code and HTTP headers. */ - public VoidResponse setMetadata(Metadata metadata) { - return this.setMetadata(metadata, null, null); + public void setMetadata(Metadata metadata) { + setMetadataWithResponse(metadata, null, null, Context.NONE); } /** @@ -555,7 +595,7 @@ public VoidResponse setMetadata(Metadata metadata) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.setMetadata#Metadata-BlobAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.setMetadataWithResponse#Metadata-BlobAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -563,11 +603,12 @@ public VoidResponse setMetadata(Metadata metadata) { * @param metadata {@link Metadata} * @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 VoidResponse setMetadata(Metadata metadata, BlobAccessConditions accessConditions, Duration timeout) { - Mono response = blobAsyncClient - .setMetadata(metadata, accessConditions); + public VoidResponse setMetadataWithResponse(Metadata metadata, BlobAccessConditions accessConditions, + Duration timeout, Context context) { + Mono response = blobAsyncClient.setMetadataWithResponse(metadata, accessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -585,16 +626,17 @@ public VoidResponse setMetadata(Metadata metadata, BlobAccessConditions accessCo * @return A response containing a {@link BlobClient} which is used to interact with the created snapshot, use * {@link BlobClient#getSnapshotId()} to get the identifier for the snapshot. */ - public Response createSnapshot() { - return this.createSnapshot(null, null, null); + public BlobClient createSnapshot() { + return createSnapshotWithResponse(null, null, null, Context.NONE).getValue(); } + /** * Creates a read-only snapshot of the blob. * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.createSnapshot#Metadata-BlobAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.createSnapshotWithResponse#Metadata-BlobAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -602,13 +644,15 @@ public Response createSnapshot() { * @param metadata {@link Metadata} * @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 a {@link BlobClient} which is used to interact with the created snapshot, use * {@link BlobClient#getSnapshotId()} to get the identifier for the snapshot. */ - public Response createSnapshot(Metadata metadata, BlobAccessConditions accessConditions, Duration timeout) { + public Response createSnapshotWithResponse(Metadata metadata, BlobAccessConditions accessConditions, + Duration timeout, Context context) { Mono> response = blobAsyncClient - .createSnapshot(metadata, accessConditions) - .map(rb -> new SimpleResponse<>(rb, new BlobClient(rb.value()))); + .createSnapshotWithResponse(metadata, accessConditions, context) + .map(rb -> new SimpleResponse<>(rb, new BlobClient(rb.getValue()))); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -627,10 +671,9 @@ public Response createSnapshot(Metadata metadata, BlobAccessConditio * Azure Docs

* * @param tier The new tier for the blob. - * @return A response containing status code and HTTP headers. */ - public VoidResponse setTier(AccessTier tier) { - return this.setTier(tier, null, null); + public void setTier(AccessTier tier) { + setTierWithResponse(tier, null, null, null, Context.NONE); } /** @@ -641,20 +684,23 @@ public VoidResponse setTier(AccessTier tier) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.setTier#AccessTier-LeaseAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.setTierWithResponse#AccessTier-RehydratePriority-LeaseAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

* * @param tier The new tier for the blob. + * @param priority Optional priority to set for re-hydrating blobs. * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does * not match the active lease on the blob. * @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 VoidResponse setTier(AccessTier tier, LeaseAccessConditions leaseAccessConditions, Duration timeout) { - Mono response = blobAsyncClient - .setTier(tier, leaseAccessConditions); + public VoidResponse setTierWithResponse(AccessTier tier, RehydratePriority priority, + LeaseAccessConditions leaseAccessConditions, Duration timeout, Context context) { + Mono response = blobAsyncClient.setTierWithResponse(tier, priority, leaseAccessConditions, + context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -668,11 +714,9 @@ public VoidResponse setTier(AccessTier tier, LeaseAccessConditions leaseAccessCo * *

For more information, see the * Azure Docs

- * - * @return A response containing status code and HTTP headers. */ - public VoidResponse undelete() { - return this.undelete(null); + public void undelete() { + undeleteWithResponse(null, Context.NONE); } /** @@ -680,17 +724,17 @@ public VoidResponse undelete() { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.undelete#Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.undeleteWithResponse#Duration-Context} * *

For more information, see the * Azure Docs

* * @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 VoidResponse undelete(Duration timeout) { - Mono response = blobAsyncClient - .undelete(); + public VoidResponse undeleteWithResponse(Duration timeout, Context context) { + Mono response = blobAsyncClient.undeleteWithResponse(context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -711,8 +755,8 @@ public VoidResponse undelete(Duration timeout) { * non-infinite lease can be between 15 and 60 seconds. * @return The lease ID. */ - public Response acquireLease(String proposedId, int duration) { - return this.acquireLease(proposedId, duration, null, null); + public String acquireLease(String proposedId, int duration) { + return acquireLeaseWithResponse(proposedId, duration, null, null, Context.NONE).getValue(); } /** @@ -721,7 +765,7 @@ public Response acquireLease(String proposedId, int duration) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.acquireLease#String-int-ModifiedAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.acquireLeaseWithResponse#String-int-ModifiedAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -733,12 +777,13 @@ public Response acquireLease(String proposedId, int duration) { * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @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 lease ID. */ - public Response acquireLease(String proposedId, int duration, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { - Mono> response = blobAsyncClient - .acquireLease(proposedId, duration, modifiedAccessConditions); + public Response acquireLeaseWithResponse(String proposedId, int duration, + ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { + Mono> response = blobAsyncClient.acquireLeaseWithResponse(proposedId, duration, + modifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -756,8 +801,8 @@ public Response acquireLease(String proposedId, int duration, * @param leaseId The leaseId of the active lease on the blob. * @return The renewed lease ID. */ - public Response renewLease(String leaseId) { - return this.renewLease(leaseId, null, null); + public String renewLease(String leaseId) { + return renewLeaseWithResponse(leaseId, null, null, Context.NONE).getValue(); } /** @@ -765,7 +810,7 @@ public Response renewLease(String leaseId) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.renewLease#String-ModifiedAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.renewLeaseWithResponse#String-ModifiedAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -775,11 +820,13 @@ public Response renewLease(String leaseId) { * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @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 renewed lease ID. */ - public Response renewLease(String leaseId, ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { + public Response renewLeaseWithResponse(String leaseId, ModifiedAccessConditions modifiedAccessConditions, + Duration timeout, Context context) { Mono> response = blobAsyncClient - .renewLease(leaseId, modifiedAccessConditions); + .renewLeaseWithResponse(leaseId, modifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -795,10 +842,9 @@ public Response renewLease(String leaseId, ModifiedAccessConditions modi * Azure Docs

* * @param leaseId The leaseId of the active lease on the blob. - * @return A response containing status code and HTTP headers. */ - public VoidResponse releaseLease(String leaseId) { - return this.releaseLease(leaseId, null, null); + public void releaseLease(String leaseId) { + releaseLeaseWithResponse(leaseId, null, null, Context.NONE); } /** @@ -806,7 +852,7 @@ public VoidResponse releaseLease(String leaseId) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.releaseLease#String-ModifiedAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.releaseLeaseWithResponse#String-ModifiedAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -816,10 +862,13 @@ public VoidResponse releaseLease(String leaseId) { * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @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 VoidResponse releaseLease(String leaseId, ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { - Mono response = blobAsyncClient.releaseLease(leaseId, modifiedAccessConditions); + public VoidResponse releaseLeaseWithResponse(String leaseId, ModifiedAccessConditions modifiedAccessConditions, + Duration timeout, Context context) { + Mono response = blobAsyncClient.releaseLeaseWithResponse(leaseId, modifiedAccessConditions, + context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -837,8 +886,8 @@ public VoidResponse releaseLease(String leaseId, ModifiedAccessConditions modifi * * @return The remaining time in the broken lease in seconds. */ - public Response breakLease() { - return this.breakLease(null, null, null); + public Integer breakLease() { + return breakLeaseWithResponse(null, null, null, Context.NONE).getValue(); } /** @@ -847,7 +896,7 @@ public Response breakLease() { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.breakLease#Integer-ModifiedAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.breakLeaseWithResponse#Integer-ModifiedAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -861,11 +910,13 @@ public Response breakLease() { * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @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 remaining time in the broken lease in seconds. */ - public Response breakLease(Integer breakPeriodInSeconds, ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { + public Response breakLeaseWithResponse(Integer breakPeriodInSeconds, + ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { Mono> response = blobAsyncClient - .breakLease(breakPeriodInSeconds, modifiedAccessConditions); + .breakLeaseWithResponse(breakPeriodInSeconds, modifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -884,8 +935,8 @@ public Response breakLease(Integer breakPeriodInSeconds, ModifiedAccess * @param proposedId A {@code String} in any valid GUID format. * @return The new lease ID. */ - public Response changeLease(String leaseId, String proposedId) { - return this.changeLease(leaseId, proposedId, null, null); + public String changeLease(String leaseId, String proposedId) { + return changeLeaseWithResponse(leaseId, proposedId, null, null, Context.NONE).getValue(); } /** @@ -893,7 +944,7 @@ public Response changeLease(String leaseId, String proposedId) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.changeLease#String-String-ModifiedAccessConditions-Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.changeLeaseWithResponse#String-String-ModifiedAccessConditions-Duration-Context} * *

For more information, see the * Azure Docs

@@ -904,10 +955,13 @@ public Response changeLease(String leaseId, String proposedId) { * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @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 new lease ID. */ - public Response changeLease(String leaseId, String proposedId, ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { - Mono> response = blobAsyncClient.changeLease(leaseId, proposedId, modifiedAccessConditions); + public Response changeLeaseWithResponse(String leaseId, String proposedId, + ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { + Mono> response = blobAsyncClient.changeLeaseWithResponse(leaseId, proposedId, + modifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -924,8 +978,8 @@ public Response changeLease(String leaseId, String proposedId, ModifiedA * * @return The sku name and account kind. */ - public Response getAccountInfo() { - return this.getAccountInfo(null); + public StorageAccountInfo getAccountInfo() { + return getAccountInfoWithResponse(null, Context.NONE).getValue(); } /** @@ -933,17 +987,17 @@ public Response getAccountInfo() { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobClient.getAccountInfo#Duration} + * {@codesnippet com.azure.storage.blob.BlobClient.getAccountInfoWithResponse#Duration-Context} * *

For more information, see the * Azure Docs

* * @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 sku name and account kind. */ - public Response getAccountInfo(Duration timeout) { - Mono> response = blobAsyncClient - .getAccountInfo(); + public Response getAccountInfoWithResponse(Duration timeout, Context context) { + Mono> response = blobAsyncClient.getAccountInfoWithResponse(context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -953,12 +1007,12 @@ public Response getAccountInfo(Duration timeout) { * * @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 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) { + BlobSASPermission permissions, OffsetDateTime expiryTime) { return this.blobAsyncClient.generateUserDelegationSAS(userDelegationKey, accountName, permissions, expiryTime); } @@ -967,7 +1021,7 @@ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, Str * * @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 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 @@ -976,8 +1030,8 @@ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, Str * @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) { + BlobSASPermission permissions, OffsetDateTime expiryTime, OffsetDateTime startTime, String version, + SASProtocol sasProtocol, IPRange ipRange) { return this.blobAsyncClient.generateUserDelegationSAS(userDelegationKey, accountName, permissions, expiryTime, startTime, version, sasProtocol, ipRange); } @@ -985,9 +1039,17 @@ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, Str /** * Generates a user delegation SAS token with the specified parameters * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.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 ContainerSASPermissions} permission 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 @@ -1001,9 +1063,9 @@ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, Str * @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) { + BlobSASPermission permissions, OffsetDateTime expiryTime, OffsetDateTime startTime, String version, + SASProtocol sasProtocol, IPRange ipRange, String cacheControl, String contentDisposition, + String contentEncoding, String contentLanguage, String contentType) { return this.blobAsyncClient.generateUserDelegationSAS(userDelegationKey, accountName, permissions, expiryTime, startTime, version, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType); @@ -1013,7 +1075,7 @@ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, Str * Generates a SAS token with the specified parameters * * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS - * @param permissions The {@code ContainerSASPermissions} permission 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) { @@ -1034,7 +1096,7 @@ public String generateSAS(String 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 ContainerSASPermissions} permission 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 @@ -1043,7 +1105,7 @@ public String generateSAS(String identifier) { * @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) { + OffsetDateTime startTime, String version, SASProtocol sasProtocol, IPRange ipRange) { return this.blobAsyncClient.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, ipRange); } @@ -1051,8 +1113,15 @@ public String generateSAS(String identifier, BlobSASPermission permissions, Offs /** * Generates a SAS token with the specified parameters * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClient.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 ContainerSASPermissions} permission 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 @@ -1066,8 +1135,8 @@ public String generateSAS(String identifier, BlobSASPermission permissions, Offs * @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) { + OffsetDateTime startTime, String version, SASProtocol sasProtocol, IPRange ipRange, String cacheControl, + String contentDisposition, String contentEncoding, String contentLanguage, String contentType) { return this.blobAsyncClient.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/BlobClientBuilder.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClientBuilder.java index 3b3d24ba6078..541553a6d61d 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 @@ -3,39 +3,21 @@ package com.azure.storage.blob; -import com.azure.core.credentials.TokenCredential; -import com.azure.core.http.HttpClient; import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLoggingPolicy; -import com.azure.core.http.policy.HttpPipelinePolicy; -import com.azure.core.http.policy.RequestIdPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.implementation.util.ImplUtils; -import com.azure.core.util.configuration.Configuration; -import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.core.implementation.annotation.ServiceClientBuilder; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; import com.azure.storage.blob.implementation.AzureBlobStorageImpl; +import com.azure.storage.blob.models.LeaseAccessConditions; +import com.azure.storage.blob.models.PageRange; import com.azure.storage.common.credentials.SASTokenCredential; -import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.common.policy.RequestRetryOptions; -import com.azure.storage.common.policy.RequestRetryPolicy; -import com.azure.storage.common.policy.SASTokenCredentialPolicy; -import com.azure.storage.common.policy.SharedKeyCredentialPolicy; import reactor.core.publisher.Flux; import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Locale; -import java.util.Map; import java.util.Objects; /** @@ -45,85 +27,51 @@ * The following information must be provided on this builder: * *
    - *
  • the endpoint through {@code .endpoint()}, including the container name and blob name, in the format of {@code https://{accountName}.blob.core.windows.net/{containerName}/{blobName}}. - *
  • the credential through {@code .credential()} or {@code .connectionString()} if the container is not publicly accessible. + *
  • the endpoint through {@code .endpoint()}, including the container name and blob name, in the format of + * {@code https://{accountName}.blob.core.windows.net/{containerName}/{blobName}}. + *
  • the credential through {@code .credential()} or {@code .connectionString()} if the container is not publicly + * accessible. *
* *

* Once all the configurations are set on this builder use the following mapping to construct the given client: *

    - *
  • {@link BlobClientBuilder#buildBlobClient()} - {@link BlobClient}
  • - *
  • {@link BlobClientBuilder#buildBlobAsyncClient()} - {@link BlobAsyncClient}
  • - *
  • {@link BlobClientBuilder#buildAppendBlobClient()} - {@link AppendBlobClient}
  • - *
  • {@link BlobClientBuilder#buildAppendBlobAsyncClient()} - {@link AppendBlobAsyncClient}
  • - *
  • {@link BlobClientBuilder#buildBlockBlobClient()} - {@link BlockBlobClient}
  • - *
  • {@link BlobClientBuilder#buildBlockBlobAsyncClient()} - {@link BlockBlobAsyncClient}
  • - *
  • {@link BlobClientBuilder#buildPageBlobClient()} - {@link PageBlobClient}
  • - *
  • {@link BlobClientBuilder#buildPageBlobAsyncClient()} - {@link PageBlobAsyncClient}
  • + *
  • {@link BlobClientBuilder#buildBlobClient()} - {@link BlobClient}
  • + *
  • {@link BlobClientBuilder#buildBlobAsyncClient()} - {@link BlobAsyncClient}
  • + *
  • {@link BlobClientBuilder#buildAppendBlobClient()} - {@link AppendBlobClient}
  • + *
  • {@link BlobClientBuilder#buildAppendBlobAsyncClient()} - {@link AppendBlobAsyncClient}
  • + *
  • {@link BlobClientBuilder#buildBlockBlobClient()} - {@link BlockBlobClient}
  • + *
  • {@link BlobClientBuilder#buildBlockBlobAsyncClient()} - {@link BlockBlobAsyncClient}
  • + *
  • {@link BlobClientBuilder#buildPageBlobClient()} - {@link PageBlobClient}
  • + *
  • {@link BlobClientBuilder#buildPageBlobAsyncClient()} - {@link PageBlobAsyncClient}
  • *
*/ -public final class BlobClientBuilder { - private static final String ACCOUNT_NAME = "accountname"; - private static final String ACCOUNT_KEY = "accountkey"; - private static final String ENDPOINT_PROTOCOL = "defaultendpointsprotocol"; - private static final String ENDPOINT_SUFFIX = "endpointsuffix"; +@ServiceClientBuilder(serviceClients = {BlobClient.class, BlobAsyncClient.class, AppendBlobClient.class, + AppendBlobAsyncClient.class, BlockBlobClient.class, BlockBlobAsyncClient.class, PageBlobClient.class, + PageBlobAsyncClient.class}) +public final class BlobClientBuilder extends BaseBlobClientBuilder { - private final List policies; + private final ClientLogger logger = new ClientLogger(BlobClientBuilder.class); - private String endpoint; private String containerName; private String blobName; private String snapshot; - private SharedKeyCredential sharedKeyCredential; - private TokenCredential tokenCredential; - private SASTokenCredential sasTokenCredential; - private HttpClient httpClient; - private HttpLogDetailLevel logLevel; - private RequestRetryOptions retryOptions; - private Configuration configuration; /** * Creates a builder instance that is able to configure and construct Storage Blob clients. */ public BlobClientBuilder() { - retryOptions = new RequestRetryOptions(); - logLevel = HttpLogDetailLevel.NONE; - policies = new ArrayList<>(); } - private AzureBlobStorageImpl buildImpl() { - Objects.requireNonNull(endpoint); + private AzureBlobStorageImpl constructImpl() { Objects.requireNonNull(containerName); Objects.requireNonNull(blobName); - // Closest to API goes first, closest to wire goes last. - final List policies = new ArrayList<>(); - - if (configuration == null) { - configuration = ConfigurationManager.getConfiguration(); - } - policies.add(new UserAgentPolicy(BlobConfiguration.NAME, BlobConfiguration.VERSION, configuration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddDatePolicy()); - - if (sharedKeyCredential != null) { - policies.add(new SharedKeyCredentialPolicy(sharedKeyCredential)); - } else if (tokenCredential != null) { - policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, String.format("%s/.default", endpoint))); - } else if (sasTokenCredential != null) { - policies.add(new SASTokenCredentialPolicy(sasTokenCredential)); + HttpPipeline pipeline = super.getPipeline(); + if (pipeline == null) { + pipeline = super.buildPipeline(); } - policies.add(new RequestRetryPolicy(retryOptions)); - - policies.addAll(this.policies); - policies.add(new HttpLoggingPolicy(logLevel)); - - HttpPipeline pipeline = new HttpPipelineBuilder() - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .build(); - return new AzureBlobStorageBuilder() .url(String.format("%s/%s/%s", endpoint, containerName, blobName)) .pipeline(pipeline) @@ -132,8 +80,12 @@ private AzureBlobStorageImpl buildImpl() { /** * Creates a {@link BlobClient} based on options set in the Builder. BlobClients are used to perform generic blob - * methods such as {@link BlobClient#download(OutputStream) download} and - * {@link BlobClient#getProperties() get properties}, use this when the blob type is unknown. + * methods such as {@link BlobClient#download(OutputStream) download} and {@link BlobClient#getProperties() get + * properties}, use this when the blob type is unknown. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClientBuilder.buildBlobClient} * * @return a {@link BlobClient} created from the configurations in this builder. * @throws NullPointerException If {@code endpoint}, {@code containerName}, or {@code blobName} is {@code null}. @@ -144,14 +96,18 @@ public BlobClient buildBlobClient() { /** * Creates a {@link BlobAsyncClient} based on options set in the Builder. BlobAsyncClients are used to perform - * generic blob methods such as {@link BlobAsyncClient#download() download} and - * {@link BlobAsyncClient#getProperties()}, use this when the blob type is unknown. + * generic blob methods such as {@link BlobAsyncClient#download() download} and {@link + * BlobAsyncClient#getProperties()}, use this when the blob type is unknown. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClientBuilder.buildBlobAsyncClient} * * @return a {@link BlobAsyncClient} created from the configurations in this builder. * @throws NullPointerException If {@code endpoint}, {@code containerName}, or {@code blobName} is {@code null}. */ public BlobAsyncClient buildBlobAsyncClient() { - return new BlobAsyncClient(buildImpl(), snapshot); + return new BlobAsyncClient(constructImpl(), snapshot, cpk); } /** @@ -168,21 +124,21 @@ public AppendBlobClient buildAppendBlobClient() { /** * Creates a {@link AppendBlobAsyncClient} based on options set in the Builder. AppendBlobAsyncClients are used to - * perform append blob specific operations such as {@link AppendBlobAsyncClient#appendBlock(Flux, long) append blob}, - * only use this when the blob is known to be an append blob. + * perform append blob specific operations such as {@link AppendBlobAsyncClient#appendBlock(Flux, long) append + * blob}, only use this when the blob is known to be an append blob. * * @return a {@link AppendBlobAsyncClient} created from the configurations in this builder. * @throws NullPointerException If {@code endpoint}, {@code containerName}, or {@code blobName} is {@code null}. */ public AppendBlobAsyncClient buildAppendBlobAsyncClient() { - return new AppendBlobAsyncClient(buildImpl(), snapshot); + return new AppendBlobAsyncClient(constructImpl(), snapshot, cpk); } /** * Creates a {@link BlockBlobClient} based on options set in the Builder. BlockBlobClients are used to perform - * generic upload operations such as {@link BlockBlobClient#uploadFromFile(String) upload from file} and block - * blob specific operations such as {@link BlockBlobClient#stageBlock(String, InputStream, long) stage block} and - * {@link BlockBlobClient#commitBlockList(List)}, only use this when the blob is known to be a block blob. + * generic upload operations such as {@link BlockBlobClient#uploadFromFile(String) upload from file} and block blob + * specific operations such as {@link BlockBlobClient#stageBlock(String, InputStream, long) stage block} and {@link + * BlockBlobClient#commitBlockList(List)}, only use this when the blob is known to be a block blob. * * @return a {@link BlockBlobClient} created from the configurations in this builder. * @throws NullPointerException If {@code endpoint}, {@code containerName}, or {@code blobName} is {@code null}. @@ -194,21 +150,22 @@ public BlockBlobClient buildBlockBlobClient() { /** * Creates a {@link BlockBlobAsyncClient} based on options set in the Builder. BlockBlobAsyncClients are used to * perform generic upload operations such as {@link BlockBlobAsyncClient#uploadFromFile(String) upload from file} - * and block blob specific operations such as {@link BlockBlobAsyncClient#stageBlock(String, Flux, long) stage block} - * and {@link BlockBlobAsyncClient#commitBlockList(List) commit block list}, only use this when the blob is known to - * be a block blob. + * and block blob specific operations such as {@link BlockBlobAsyncClient#stageBlockWithResponse(String, Flux, long, + * LeaseAccessConditions) stage block} and {@link BlockBlobAsyncClient#commitBlockList(List) commit block list}, + * only use this when the blob is known to be a block blob. * * @return a {@link BlockBlobAsyncClient} created from the configurations in this builder. * @throws NullPointerException If {@code endpoint}, {@code containerName}, or {@code blobName} is {@code null}. */ public BlockBlobAsyncClient buildBlockBlobAsyncClient() { - return new BlockBlobAsyncClient(buildImpl(), snapshot); + return new BlockBlobAsyncClient(constructImpl(), snapshot, cpk); } /** * Creates a {@link PageBlobClient} based on options set in the Builder. PageBlobClients are used to perform page * blob specific operations such as {@link PageBlobClient#uploadPages(PageRange, InputStream) upload pages} and - * {@link PageBlobClient#clearPages(PageRange) clear pages}, only use this when the blob is known to be a page blob. + * {@link PageBlobClient#clearPages(PageRange) clear pages}, only use this when the blob is known to be a page + * blob. * * @return a {@link PageBlobClient} created from the configurations in this builder. * @throws NullPointerException If {@code endpoint}, {@code containerName}, or {@code blobName} is {@code null}. @@ -219,47 +176,58 @@ public PageBlobClient buildPageBlobClient() { /** * Creates a {@link PageBlobAsyncClient} based on options set in the Builder. PageBlobAsyncClients are used to - * perform page blob specific operations such as {@link PageBlobAsyncClient#uploadPages(PageRange, Flux) upload pages} - * and {@link PageBlobAsyncClient#clearPages(PageRange) clear pages}, only use this when the blob is known to be a - * page blob. + * perform page blob specific operations such as {@link PageBlobAsyncClient#uploadPages(PageRange, Flux) upload + * pages} and {@link PageBlobAsyncClient#clearPages(PageRange) clear pages}, only use this when the blob is known to + * be a page blob. * * @return a {@link PageBlobAsyncClient} created from the configurations in this builder. * @throws NullPointerException If {@code endpoint}, {@code containerName}, or {@code blobName} is {@code null}. */ public PageBlobAsyncClient buildPageBlobAsyncClient() { - return new PageBlobAsyncClient(buildImpl(), snapshot); + return new PageBlobAsyncClient(constructImpl(), snapshot, cpk); } /** * Sets the service endpoint, additionally parses it for information (SAS token, container name, blob name) + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClientBuilder.endpoint#String} + * * @param endpoint URL of the service * @return the updated BlobClientBuilder object * @throws IllegalArgumentException If {@code endpoint} is {@code null} or is a malformed URL. */ + @Override public BlobClientBuilder endpoint(String endpoint) { try { URL url = new URL(endpoint); BlobURLParts parts = URLParser.parse(url); - this.endpoint = parts.scheme() + "://" + parts.host(); - this.containerName = parts.containerName(); - this.blobName = parts.blobName(); - this.snapshot = parts.snapshot(); + this.endpoint = parts.getScheme() + "://" + parts.getHost(); + this.containerName = parts.getContainerName(); + this.blobName = parts.getBlobName(); + this.snapshot = parts.getSnapshot(); - this.sasTokenCredential = SASTokenCredential.fromSASTokenString(parts.sasQueryParameters().encode()); - if (this.sasTokenCredential != null) { - this.tokenCredential = null; - this.sharedKeyCredential = null; + SASTokenCredential sasTokenCredential = + SASTokenCredential.fromSASTokenString(parts.getSasQueryParameters().encode()); + if (sasTokenCredential != null) { + super.credential(sasTokenCredential); } } catch (MalformedURLException ex) { - throw new IllegalArgumentException("The Azure Storage Blob endpoint url is malformed."); + throw logger.logExceptionAsError( + new IllegalArgumentException("The Azure Storage Blob endpoint url is malformed.")); } - return this; } /** * Sets the name of the container this client is connecting to. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobClientBuilder.containerName#String} + * * @param containerName the name of the container * @return the updated BlobClientBuilder object * @throws NullPointerException If {@code containerName} is {@code null} @@ -271,6 +239,7 @@ public BlobClientBuilder containerName(String containerName) { /** * Sets the name of the blob this client is connecting to. + * * @param blobName the name of the blob * @return the updated BlobClientBuilder object * @throws NullPointerException If {@code blobName} is {@code null} @@ -282,6 +251,7 @@ public BlobClientBuilder blobName(String blobName) { /** * Sets the snapshot of the blob this client is connecting to. + * * @param snapshot the snapshot identifier for the blob * @return the updated BlobClientBuilder object */ @@ -289,142 +259,4 @@ public BlobClientBuilder snapshot(String snapshot) { this.snapshot = snapshot; return this; } - - /** - * Sets the credential used to authorize requests sent to the service - * @param credential authorization credential - * @return the updated BlobClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null} - */ - public BlobClientBuilder credential(SharedKeyCredential credential) { - this.sharedKeyCredential = Objects.requireNonNull(credential); - this.tokenCredential = null; - this.sasTokenCredential = null; - return this; - } - - /** - * Sets the credential used to authorize requests sent to the service - * @param credential authorization credential - * @return the updated BlobClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null} - */ - public BlobClientBuilder credential(TokenCredential credential) { - this.tokenCredential = Objects.requireNonNull(credential); - this.sharedKeyCredential = null; - this.sasTokenCredential = null; - return this; - } - - /** - * Sets the credential used to authorize requests sent to the service - * @param credential authorization credential - * @return the updated BlobClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null} - */ - public BlobClientBuilder credential(SASTokenCredential credential) { - this.sasTokenCredential = Objects.requireNonNull(credential); - this.sharedKeyCredential = null; - this.tokenCredential = null; - return this; - } - - /** - * Clears the credential used to authorize requests sent to the service - * @return the updated BlobClientBuilder object - */ - public BlobClientBuilder anonymousCredential() { - this.sharedKeyCredential = null; - this.tokenCredential = null; - this.sasTokenCredential = null; - return this; - } - - /** - * Sets the connection string for the service, parses it for authentication information (account name, account key) - * @param connectionString connection string from access keys section - * @return the updated BlobClientBuilder object - * @throws NullPointerException If {@code connectionString} is {@code null} - * @throws IllegalArgumentException If {@code connectionString} doesn't contain AccountName or AccountKey. - */ - public BlobClientBuilder connectionString(String connectionString) { - Objects.requireNonNull(connectionString); - - Map connectionKVPs = new HashMap<>(); - for (String s : connectionString.split(";")) { - String[] kvp = s.split("=", 2); - connectionKVPs.put(kvp[0].toLowerCase(Locale.ROOT), kvp[1]); - } - - String accountName = connectionKVPs.get(ACCOUNT_NAME); - String accountKey = connectionKVPs.get(ACCOUNT_KEY); - String endpointProtocol = connectionKVPs.get(ENDPOINT_PROTOCOL); - String endpointSuffix = connectionKVPs.get(ENDPOINT_SUFFIX); - - if (ImplUtils.isNullOrEmpty(accountName) || ImplUtils.isNullOrEmpty(accountKey)) { - throw new IllegalArgumentException("Connection string must contain 'AccountName' and 'AccountKey'."); - } - - if (!ImplUtils.isNullOrEmpty(endpointProtocol) && !ImplUtils.isNullOrEmpty(endpointSuffix)) { - String endpoint = String.format("%s://%s.blob.%s", endpointProtocol, accountName, endpointSuffix.replaceFirst("^\\.", "")); - endpoint(endpoint); - } - - // Use accountName and accountKey to get the SAS token using the credential class. - return credential(new SharedKeyCredential(accountName, accountKey)); - } - - /** - * Sets the http client used to send service requests - * @param httpClient http client to send requests - * @return the updated BlobClientBuilder object - * @throws NullPointerException If {@code httpClient} is {@code null} - */ - public BlobClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = Objects.requireNonNull(httpClient); - return this; - } - - /** - * Adds a pipeline policy to apply on each request sent - * @param pipelinePolicy a pipeline policy - * @return the updated BlobClientBuilder object - * @throws NullPointerException If {@code pipelinePolicy} is {@code null} - */ - public BlobClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { - this.policies.add(Objects.requireNonNull(pipelinePolicy)); - return this; - } - - /** - * Sets the logging level for service requests - * @param logLevel logging level - * @return the updated BlobClientBuilder object - */ - public BlobClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { - this.logLevel = logLevel; - return this; - } - - /** - * Sets the configuration object used to retrieve environment configuration values used to buildClient the client with - * when they are not set in the appendBlobClientBuilder, defaults to Configuration.NONE - * @param configuration configuration store - * @return the updated BlobClientBuilder object - */ - public BlobClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /** - * Sets the request retry options for all the requests made through the client. - * @param retryOptions the options to configure retry behaviors - * @return the updated BlobClientBuilder object - * @throws NullPointerException If {@code retryOptions} is {@code null} - */ - public BlobClientBuilder retryOptions(RequestRetryOptions retryOptions) { - this.retryOptions = Objects.requireNonNull(retryOptions); - return this; - } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobConfiguration.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobConfiguration.java index 66619bdd73fd..f2e2e389854c 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobConfiguration.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobConfiguration.java @@ -4,5 +4,5 @@ class BlobConfiguration { static final String NAME = "azure-storage-blob"; - static final String VERSION = "12.0.0-preview.3"; + static final String VERSION = "12.0.0-preview.4"; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobInputStream.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobInputStream.java index 18ef656c3550..17407285b957 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobInputStream.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobInputStream.java @@ -2,10 +2,13 @@ // Licensed under the MIT License. package com.azure.storage.blob; +import com.azure.core.implementation.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; 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 reactor.netty.ByteBufFlux; +import com.azure.storage.common.SR; import java.io.IOException; import java.io.InputStream; @@ -15,6 +18,8 @@ * Provides an input stream to read a given blob resource. */ public final class BlobInputStream extends InputStream { + private final ClientLogger logger = new ClientLogger(BlobInputStream.class); + /** * Holds the reference to the blob this stream is associated with. */ @@ -33,7 +38,7 @@ public final class BlobInputStream extends InputStream { /** * Holds the stream length. */ - private long streamLength; + private final long streamLength; /** * Holds the stream read size for both block and page blobs. @@ -73,7 +78,7 @@ public final class BlobInputStream extends InputStream { /** * Holds the {@link BlobAccessConditions} object that represents the access conditions for the blob. */ - private BlobAccessConditions accessCondition; + private final BlobAccessConditions accessCondition; /** * Offset of the source blob this class is configured to stream from. @@ -83,37 +88,29 @@ public final class BlobInputStream extends InputStream { /** * Initializes a new instance of the BlobInputStream class. * - * @param blobClient - * A {@link BlobClient} 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. + * @param blobClient A {@link BlobClient} 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 BlobAsyncClient blobClient, final BlobAccessConditions accessCondition) throws StorageException { + BlobInputStream(final BlobAsyncClient blobClient, final BlobAccessConditions accessCondition) + throws StorageException { this(blobClient, 0, null, accessCondition); } /** - * Initializes a new instance of the BlobInputStream class. - * Note that if {@code blobRangeOffset} is not {@code 0} or {@code blobRangeLength} is not {@code null}, there will - * be no content MD5 verification. - * - * @param blobClient - * A {@link BlobClient} object which represents the blob that this stream is associated with. - * @param blobRangeOffset - * The offset of blob data to begin stream. - * @param blobRangeLength - * How much data the stream should return after blobRangeOffset. - * @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. + * Initializes a new instance of the BlobInputStream class. Note that if {@code blobRangeOffset} is not {@code 0} or + * {@code blobRangeLength} is not {@code null}, there will be no content MD5 verification. + * + * @param blobClient A {@link BlobClient} object which represents the blob that this stream is associated with. + * @param blobRangeOffset The offset of blob data to begin stream. + * @param blobRangeLength How much data the stream should return after blobRangeOffset. + * @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 BlobAsyncClient blobClient, long blobRangeOffset, Long blobRangeLength, - final BlobAccessConditions accessCondition) + final BlobAccessConditions accessCondition) throws StorageException { this.blobRangeOffset = blobRangeOffset; @@ -127,10 +124,10 @@ public final class BlobInputStream extends InputStream { throw new IndexOutOfBoundsException(); } - BlobProperties properties = blobClient.getProperties().block().value(); + BlobProperties properties = blobClient.getProperties().block(); this.streamLength = blobRangeLength == null - ? properties.blobSize() - this.blobRangeOffset - : Math.min(properties.blobSize() - this.blobRangeOffset, blobRangeLength); + ? properties.getBlobSize() - this.blobRangeOffset + : Math.min(properties.getBlobSize() - this.blobRangeOffset, blobRangeLength); this.reposition(blobRangeOffset); } @@ -141,11 +138,8 @@ public final class BlobInputStream extends InputStream { * 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. - * - * @throws IOException - * If an I/O error occurs. + * over) from this input stream without blocking, or 0 when it reaches the end of the input stream. + * @throws IOException If an I/O error occurs. */ @Override public synchronized int available() throws IOException { @@ -155,9 +149,8 @@ public synchronized int available() throws IOException { /** * 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. + * @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) { @@ -168,8 +161,7 @@ private synchronized void checkStreamState() throws IOException { /** * Closes this input stream and releases any system resources associated with the stream. * - * @throws IOException - * If an I/O error occurs. + * @throws IOException If an I/O error occurs. */ @Override public synchronized void close() throws IOException { @@ -182,16 +174,14 @@ public synchronized void close() throws IOException { * Dispatches a read operation of N bytes. When using sparse page blobs, the page ranges are evaluated and zero * bytes may be generated on the client side for some ranges that do not exist. * - * @param readLength - * An int which represents the number of bytes to read. - * - * @throws IOException - * If an I/O error occurs. + * @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 { try { - this.currentBuffer = this.blobClient.download(new BlobRange(this.currentAbsoluteReadPosition, (long) readLength), this.accessCondition, false) - .flatMap(res -> ByteBufFlux.fromInbound(res.body(null)).aggregate().asByteBuffer()) + this.currentBuffer = this.blobClient.download(new BlobRange(this.currentAbsoluteReadPosition, + (long) readLength), this.accessCondition, false) + .flatMap(response -> FluxUtil.collectBytesInByteBufferStream(response.body(null)).map(ByteBuffer::wrap)) .block(); this.bufferSize = readLength; @@ -207,9 +197,8 @@ 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. + * @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) { @@ -223,7 +212,7 @@ public synchronized void mark(final int readlimit) { * false. * * @return True if this stream instance supports the mark and reset methods; False - * otherwise. + * otherwise. */ @Override public boolean markSupported() { @@ -235,11 +224,9 @@ public boolean markSupported() { * 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. + * @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 { @@ -257,32 +244,26 @@ public int read() throws IOException { /** * 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. + * 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 + * 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. + * @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 { @@ -292,19 +273,17 @@ public int read(final byte[] b) throws IOException { /** * 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. + * 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. + * 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 + * 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] @@ -315,38 +294,29 @@ public int read(final byte[] b) throws IOException { * 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 + * 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. + * 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 new IndexOutOfBoundsException(); + throw logger.logExceptionAsError(new IndexOutOfBoundsException()); } return this.readInternal(b, off, len); @@ -355,20 +325,14 @@ public int read(final byte[] b, final int off, final int len) throws IOException /** * 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. + * @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(); @@ -376,7 +340,8 @@ private synchronized int readInternal(final byte[] b, final int off, int len) th // 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)); + this.dispatchRead((int) Math.min(this.readSize, + this.streamLength + this.blobRangeOffset - this.currentAbsoluteReadPosition)); } len = Math.min(len, this.readSize); @@ -406,8 +371,8 @@ private synchronized int readInternal(final byte[] b, final int off, int len) th /** * Repositions the stream to the given absolute byte offset. * - * @param absolutePosition - * A long which represents the absolute byte offset withitn the stream reposition. + * @param absolutePosition A long which represents the absolute byte offset withitn the stream + * reposition. */ private synchronized void reposition(final long absolutePosition) { this.currentAbsoluteReadPosition = absolutePosition; @@ -419,8 +384,7 @@ private synchronized void reposition(final long 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. + * @throws IOException If this stream has not been marked or if the mark has been invalidated. */ @Override public synchronized void reset() throws IOException { @@ -438,8 +402,7 @@ public synchronized void reset() throws IOException { * * Note repositioning the blob read stream will disable blob MD5 checking. * - * @param n - * A long which represents the number of bytes to skip. + * @param n A long which represents the number of bytes to skip. */ @Override public synchronized long skip(final long n) throws IOException { @@ -448,7 +411,7 @@ public synchronized long skip(final long n) throws IOException { } if (n < 0 || this.currentAbsoluteReadPosition + n > this.streamLength + this.blobRangeOffset) { - throw new IndexOutOfBoundsException(); + throw logger.logExceptionAsError(new IndexOutOfBoundsException()); } this.reposition(this.currentAbsoluteReadPosition + n); diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobOutputStream.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobOutputStream.java index f002ee4d1bf9..aa65162d6fbc 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobOutputStream.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobOutputStream.java @@ -5,200 +5,167 @@ 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.BlobType; import com.azure.storage.blob.models.LeaseAccessConditions; import com.azure.storage.blob.models.PageBlobAccessConditions; import com.azure.storage.blob.models.PageRange; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; -import org.reactivestreams.Subscriber; -import org.reactivestreams.Subscription; -import reactor.core.CoreSubscriber; +import com.azure.storage.blob.models.StorageException; +import com.azure.storage.common.SR; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import reactor.core.publisher.Operators; +import reactor.core.scheduler.Schedulers; +import reactor.util.annotation.NonNull; import java.io.IOException; import java.io.OutputStream; -import java.nio.channels.CompletionHandler; +import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Base64; -import java.util.TreeMap; +import java.util.List; import java.util.UUID; -import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; -import java.util.concurrent.atomic.AtomicLongFieldUpdater; - -public final class BlobOutputStream extends OutputStream { - /** - * Holds the {@link BlobAccessConditions} object that represents the access conditions for the blob. - */ - private BlobAccessConditions accessCondition; - - private AppendPositionAccessConditions appendPositionAccessConditions; - - /** - * Used for block blobs, holds the block id prefix. - */ - private String blockIdPrefix; - - /** - * Used for block blobs, holds the block list. - */ - private TreeMap blockList; - - /** +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. */ - private int internalWriteThreshold = -1; + int writeThreshold; - /** + /* * Holds the last exception this stream encountered. */ - private volatile IOException lastError = null; + volatile IOException lastError; + static BlobOutputStream appendBlobOutputStream(final AppendBlobAsyncClient client, + final AppendBlobAccessConditions appendBlobAccessConditions) { + return new AppendBlobOutputStream(client, appendBlobAccessConditions); + } - private long initialBlobOffset; + static BlobOutputStream blockBlobOutputStream(final BlockBlobAsyncClient client, + final BlobAccessConditions accessConditions) { + return new BlockBlobOutputStream(client, accessConditions); + } - /** - * Holds the reference to the blob this stream is associated with. - */ - private final BlobAsyncClient blobClient; + static BlobOutputStream pageBlobOutputStream(final PageBlobAsyncClient client, final long length, + final BlobAccessConditions accessConditions) { + return new PageBlobOutputStream(client, length, accessConditions); + } + + abstract Mono dispatchWrite(byte[] data, int writeLength, long offset); + + abstract void commit(); /** - * Determines if this stream is used against a page blob or block blob. + * 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 BlobType streamType = BlobType.BLOCK_BLOB; + 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); + } + }); + } /** - * Initializes a new instance of the BlobOutputStream class. - * - * @param parentBlob - * A {@link BlobAsyncClient} object which represents the blob that this stream is associated with. + * Helper function to check if the stream is faulted, if it is it surfaces the exception. * - * @throws StorageException - * An exception representing any error which occurred during the operation. + * @throws IOException If an I/O error occurs. In particular, an IOException may be thrown if the output stream has + * been closed. */ - private BlobOutputStream(final BlobAsyncClient parentBlob) throws StorageException { - this.blobClient = parentBlob; -// completion = Flux.defer(() -> { -// if (this.streamType == BlobType.APPEND_BLOB) { -// return writeProcessor.concatMap(b -> { -// long offset = currentOffset.getAndAdd(b.length); -// return dispatchWrite(b, offset); -// }); -// } else { -// return writeProcessor.map(b -> Tuples.of(b, currentOffset.getAndAdd(b.length))) -// .flatMap(chunk -> dispatchWrite(chunk.getT1(), chunk.getT2())); -// } -// }) -// .doOnError(t -> { -// if (t instanceof IOException) { -// lastError = (IOException) t; -// } else { -// lastError = new IOException(t); -// } -// completionSink.error(t); -// }) -// .doOnNext(length -> completionSink.next(length)) -// .doOnComplete(() -> completionSink.complete()); + private void checkStreamState() throws IOException { + if (this.lastError != null) { + throw this.lastError; + } } /** - * Initializes a new instance of the BlobOutputStream class for a CloudBlockBlob - * - * @param parentBlob - * 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. + * 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 StorageException - * An exception representing any error which occurred during the operation. + * @throws IOException If an I/O error occurs. */ - BlobOutputStream(final BlockBlobAsyncClient parentBlob, final BlobAccessConditions accessCondition) throws StorageException { - this((BlobAsyncClient) parentBlob); - - this.accessCondition = accessCondition; - this.blockList = new TreeMap<>(); - this.blockIdPrefix = UUID.randomUUID().toString() + "-"; - - this.streamType = BlobType.BLOCK_BLOB; - this.internalWriteThreshold = (int) BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE; + @Override + public void flush() throws IOException { + this.checkStreamState(); } /** - * Initializes a new instance of the BlobOutputStream class for a CloudPageBlob - * - * @param parentBlob - * A {@link PageBlobClient} object which represents the blob that this stream is associated with. - * @param length - * A long which represents the length of the page blob in bytes, which must be a multiple of - * 512. - * @param accessCondition - * An {@link BlobAccessConditions} object which represents the access conditions for the blob. + * Writes b.length bytes from the specified byte array to this output stream. + *

* - * @throws StorageException - * An exception representing any error which occurred during the operation. + * @param data A byte array which represents the data to write. + * @throws IOException If an I/O error occurs. In particular, an IOException may be thrown if the output stream has + * been closed. */ - BlobOutputStream(final PageBlobAsyncClient parentBlob, final long length, final BlobAccessConditions accessCondition) - throws StorageException { - this((BlobAsyncClient) parentBlob); - this.streamType = BlobType.PAGE_BLOB; - this.accessCondition = accessCondition; - this.internalWriteThreshold = (int) Math.min(BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE, length); + @Override + public void write(@NonNull final byte[] data) throws IOException { + this.write(data, 0, data.length); } /** - * Initializes a new instance of the BlobOutputStream class for a CloudAppendBlob - * - * @param parentBlob - * A {@link AppendBlobAsyncClient} 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. + * Writes length bytes from the specified byte array starting at offset to this output stream. + *

* - * @throws StorageException - * An exception representing any error which occurred during the operation. + * @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. */ - BlobOutputStream(final AppendBlobAsyncClient parentBlob, final AppendBlobAccessConditions accessCondition) - throws StorageException { - this((BlobAsyncClient) parentBlob); - this.streamType = BlobType.APPEND_BLOB; - - this.accessCondition = new BlobAccessConditions(); - if (accessCondition != null) { - this.appendPositionAccessConditions = accessCondition.appendPositionAccessConditions(); - this.accessCondition = new BlobAccessConditions().modifiedAccessConditions(accessCondition.modifiedAccessConditions()).leaseAccessConditions(accessCondition.leaseAccessConditions()); - if (accessCondition.appendPositionAccessConditions().appendPosition() != null) { - this.initialBlobOffset = accessCondition.appendPositionAccessConditions().appendPosition(); - } else { - this.initialBlobOffset = parentBlob.getProperties().block().value().blobSize(); - } + @Override + public void write(@NonNull final byte[] data, final int offset, final int length) throws IOException { + if (offset < 0 || length < 0 || length > data.length - offset) { + throw new IndexOutOfBoundsException(); } - this.internalWriteThreshold = (int) BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE; + this.writeInternal(data, offset, length); } /** - * Helper function to check if the stream is faulted, if it is it surfaces the exception. + * 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. * - * @throws IOException - * If an I/O error occurs. In particular, an IOException may be thrown if the output stream has been - * closed. + * @param byteVal An int which represents the bye value 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 checkStreamState() throws IOException { - if (this.lastError != null) { - throw this.lastError; - } + @Override + public void write(final int byteVal) throws IOException { + 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. + * @throws IOException If an I/O error occurs. */ @Override public synchronized void close() throws IOException { @@ -222,450 +189,182 @@ public synchronized void close() throws IOException { } } - /** - * Commits the blob, for block blob this uploads the block list. - * - * @throws StorageException - * An exception representing any error which occurred during the operation. - */ - private synchronized void commit() throws StorageException { - if (this.streamType == BlobType.BLOCK_BLOB) { - // wait for all blocks to finish - assert this.blobClient instanceof BlockBlobAsyncClient; - final BlockBlobAsyncClient blobRef = (BlockBlobAsyncClient) this.blobClient; - blobRef.commitBlockList(new ArrayList<>(this.blockList.values()), null, null, this.accessCondition).block(); + private static final class AppendBlobOutputStream extends BlobOutputStream { + private final AppendBlobAccessConditions appendBlobAccessConditions; + private final AppendPositionAccessConditions appendPositionAccessConditions; + private final long initialBlobOffset; + private final AppendBlobAsyncClient client; + + private AppendBlobOutputStream(final AppendBlobAsyncClient client, + final AppendBlobAccessConditions appendBlobAccessConditions) { + this.client = client; + this.writeThreshold = BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE; + this.appendBlobAccessConditions = appendBlobAccessConditions; + + if (appendBlobAccessConditions != null) { + this.appendPositionAccessConditions = appendBlobAccessConditions.getAppendPositionAccessConditions(); + + if (appendBlobAccessConditions.getAppendPositionAccessConditions().getAppendPosition() != null) { + this.initialBlobOffset = appendBlobAccessConditions + .getAppendPositionAccessConditions() + .getAppendPosition(); + } else { + this.initialBlobOffset = client.getProperties().block().getBlobSize(); + } + } else { + this.initialBlobOffset = client.getProperties().block().getBlobSize(); + this.appendPositionAccessConditions = new AppendPositionAccessConditions(); + } } - } - /** - * Dispatches a write operation for a given length. - * - * @throws IOException - * If an I/O error occurs. In particular, an IOException may be thrown if the output stream has been - * closed. - */ - private Mono dispatchWrite(Flux bufferRef, int writeLength, long offset) { - if (writeLength == 0) { - return Mono.empty(); - } + private Mono appendBlock(Flux blockData, long offset, long writeLength) { + this.appendPositionAccessConditions.setAppendPosition(offset); - if (this.streamType == BlobType.PAGE_BLOB && (writeLength % PageBlobAsyncClient.PAGE_BYTES != 0)) { - return Mono.error(new IOException(String.format(SR.INVALID_NUMBER_OF_BYTES_IN_THE_BUFFER, writeLength))); + return client.appendBlockWithResponse(blockData, writeLength, appendBlobAccessConditions) + .then() + .onErrorResume(t -> t instanceof IOException || t instanceof StorageException, e -> { + this.lastError = new IOException(e); + return null; + }); } - if (this.streamType == BlobType.BLOCK_BLOB) { - final String blockID = this.getCurrentBlockId(); - this.blockList.put(offset, blockID); - return BlobOutputStream.this.writeBlock(bufferRef, blockID, writeLength).then(Mono.just(writeLength)); - } else if (this.streamType == BlobType.PAGE_BLOB) { - return BlobOutputStream.this.writePages(bufferRef, offset, writeLength).then(Mono.just(writeLength)); - } else if (this.streamType == BlobType.APPEND_BLOB) { + @Override + Mono dispatchWrite(byte[] data, int writeLength, long offset) { + if (writeLength == 0) { + return Mono.empty(); + } + // We cannot differentiate between max size condition failing only in the retry versus failing in the // first attempt and retry even for a single writer scenario. So we will eliminate the latter and handle // the former in the append block method. - if (this.appendPositionAccessConditions != null && this.appendPositionAccessConditions.maxSize() != null - && this.initialBlobOffset > this.appendPositionAccessConditions.maxSize()) { + if (this.appendPositionAccessConditions != null + && this.appendPositionAccessConditions.getMaxSize() != null + && this.initialBlobOffset > this.appendPositionAccessConditions.getMaxSize()) { this.lastError = new IOException(SR.INVALID_BLOCK_SIZE); return Mono.error(this.lastError); } - return BlobOutputStream.this.appendBlock(bufferRef, offset, writeLength).then(Mono.justOrEmpty(writeLength)); - } else { - return Mono.error(new RuntimeException("Unknown blob type " + this.streamType)); - } - } - - private Mono writeBlock(Flux blockData, String blockId, long writeLength) { - assert this.blobClient instanceof BlockBlobAsyncClient; - final BlockBlobAsyncClient blobRef = (BlockBlobAsyncClient) this.blobClient; - - LeaseAccessConditions leaseAccessConditions = accessCondition == null ? null : accessCondition.leaseAccessConditions(); - - return blobRef.stageBlock(blockId, blockData, writeLength, leaseAccessConditions) - .then() - .onErrorResume(t -> t instanceof StorageException, e -> { - this.lastError = new IOException(e); - return null; - }); - } - - private Mono writePages(Flux pageData, long offset, long writeLength) { - assert this.blobClient instanceof PageBlobAsyncClient; - final PageBlobAsyncClient blobRef = (PageBlobAsyncClient) this.blobClient; + Flux fbb = Flux.range(0, 1) + .concatMap(pos -> Mono.fromCallable(() -> ByteBuffer.wrap(data, (int) offset, writeLength))); - PageBlobAccessConditions pageBlobAccessConditions = accessCondition == null ? null : new PageBlobAccessConditions().leaseAccessConditions(accessCondition.leaseAccessConditions()).modifiedAccessConditions(accessCondition.modifiedAccessConditions()); - - return blobRef.uploadPages(new PageRange().start(offset).end(offset + writeLength - 1), pageData, pageBlobAccessConditions) - .then() - .onErrorResume(t -> t instanceof StorageException, e -> { - this.lastError = new IOException(e); - return null; - }); - } - - private Mono appendBlock(Flux blockData, long offset, long writeLength) { - assert this.blobClient instanceof AppendBlobAsyncClient; - final AppendBlobAsyncClient blobRef = (AppendBlobAsyncClient) this.blobClient; - if (this.appendPositionAccessConditions == null) { - appendPositionAccessConditions = new AppendPositionAccessConditions(); + return this.appendBlock(fbb.subscribeOn(Schedulers.elastic()), offset, writeLength); } - this.appendPositionAccessConditions.appendPosition(offset); - - AppendBlobAccessConditions appendBlobAccessConditions = accessCondition == null ? null : new AppendBlobAccessConditions().leaseAccessConditions(accessCondition.leaseAccessConditions()).modifiedAccessConditions(accessCondition.modifiedAccessConditions()); - return blobRef.appendBlock(blockData, writeLength, appendBlobAccessConditions) - .then() - .onErrorResume(t -> t instanceof IOException || t instanceof StorageException, e -> { - this.lastError = new IOException(e); - return null; - }); - } - - /** - * 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(); - } - - /** - * Generates a new block ID to be used for PutBlock. - * - * @return Base64 encoded block ID - */ - private String getCurrentBlockId() { - String blockIdSuffix = String.format("%06d", this.blockList.size()); - - byte[] blockIdInBytes; - blockIdInBytes = (this.blockIdPrefix + blockIdSuffix).getBytes(StandardCharsets.UTF_8); - - return Base64.getEncoder().encodeToString(blockIdInBytes); - } - /** - * Writes b.length bytes from the specified byte array to this output stream. - *

- * - * @param data - * A byte array which represents the data to write. - * - * @throws IOException - * If an I/O error occurs. In particular, an IOException may be thrown if the output stream has been - * closed. - */ - @Override - public void write(final byte[] data) throws IOException { - this.write(data, 0, data.length); + @Override + void commit() { + // AppendBlob doesn't need to commit anything. + } } - /** - * 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 IOException - * If an I/O error occurs. In particular, an IOException may be thrown if the output stream has been - * closed. - */ - @Override - public void write(final byte[] data, final int offset, final int length) throws IOException { - if (offset < 0 || length < 0 || length > data.length - offset) { - throw new IndexOutOfBoundsException(); + private static final class BlockBlobOutputStream extends BlobOutputStream { + private final BlobAccessConditions accessConditions; + private final String blockIdPrefix; + private final List blockList; + private final BlockBlobAsyncClient client; + + private BlockBlobOutputStream(final BlockBlobAsyncClient client, final BlobAccessConditions accessConditions) { + this.client = client; + this.accessConditions = accessConditions; + this.blockIdPrefix = UUID.randomUUID().toString() + '-'; + this.blockList = new ArrayList<>(); + this.writeThreshold = BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE; } - this.writeInternal(data, offset, length); - } + /** + * Generates a new block ID to be used for PutBlock. + * + * @return Base64 encoded block ID + */ + private String getCurrentBlockId() { + String blockIdSuffix = String.format("%06d", this.blockList.size()); + return Base64.getEncoder().encodeToString((this.blockIdPrefix + blockIdSuffix) + .getBytes(StandardCharsets.UTF_8)); + } - /** - * 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. - * - * @throws IOException - * If an I/O error occurs. In particular, an IOException may be thrown if the output stream has been - * closed. - */ - @Override - public void write(final int byteVal) throws IOException { - this.write(new byte[] { (byte) (byteVal & 0xFF) }); - } + private Mono writeBlock(Flux blockData, String blockId, long writeLength) { + LeaseAccessConditions leaseAccessConditions = (accessConditions == null) + ? null : accessConditions.getLeaseAccessConditions(); - /** - * 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.internalWriteThreshold)); - Flux chunkPositions = Flux.range(0, chunks).map(c -> offset + c * this.internalWriteThreshold); - if (this.streamType == BlobType.APPEND_BLOB) { - chunkPositions.concatMap(pos -> processChunk(data, pos, offset, length)).then().block(); - } else { - chunkPositions.concatMap(pos -> processChunk(data, pos, offset, length)).then().block(); + return client.stageBlockWithResponse(blockId, blockData, writeLength, leaseAccessConditions) + .then() + .onErrorResume(t -> t instanceof StorageException, e -> { + this.lastError = new IOException(e); + return null; + }); } -// synchronized (outBufferLock) { -// while (length > 0) { -// this.checkStreamState(); -// -// final int availableBufferBytes = this.internalWriteThreshold - this.outBuffer.size(); -// final int nextWrite = Math.min(availableBufferBytes, length); -// -// this.outBuffer.write(data, offset, nextWrite); -// offset += nextWrite; -// length -= nextWrite; -// -// if (this.outBuffer.size() == this.internalWriteThreshold) { -// this.writeSink.next(outBuffer.toByteArray()); -// outBuffer.reset(); -// numInFlight.incrementAndGet(); -// } -// } -// } - } + @Override + Mono dispatchWrite(byte[] data, int writeLength, long offset) { + if (writeLength == 0) { + return Mono.empty(); + } - private Mono processChunk(byte[] data, int position, int offset, int length) { - int chunkLength = this.internalWriteThreshold; - if (position + chunkLength > offset + length) { - chunkLength = offset + length - position; - } - Flux chunkData = new ByteBufStreamFromByteArray(data, 64 * 1024, position, chunkLength); - return dispatchWrite(chunkData, chunkLength, position - offset) - .doOnError(t -> { - if (t instanceof IOException) { - lastError = (IOException) t; - } else { - lastError = new IOException(t); - } - }); - } + final String blockID = this.getCurrentBlockId(); + this.blockList.add(blockID); + + Flux fbb = Flux.range(0, 1) + .concatMap(pos -> Mono.fromCallable(() -> ByteBuffer.wrap(data, (int) offset, writeLength))); - private static final class ByteBufStreamFromByteArray extends Flux { - private final ByteBufAllocator alloc; - private final byte[] bigByteArray; - private final int chunkSize; - private final int offset; - private final int length; - - ByteBufStreamFromByteArray(byte[] bigByteArray, int chunkSize, int offset, int length) { - this.alloc = ByteBufAllocator.DEFAULT; - this.bigByteArray = bigByteArray; - this.chunkSize = chunkSize; - this.offset = offset; - this.length = length; + return this.writeBlock(fbb.subscribeOn(Schedulers.elastic()), blockID, writeLength); } + /** + * Commits the blob, for block blob this uploads the block list. + */ @Override - public void subscribe(CoreSubscriber actual) { - ByteBufStreamFromByteArray.FileReadSubscription subscription = new ByteBufStreamFromByteArray.FileReadSubscription(actual, bigByteArray, alloc, chunkSize, offset, length); - actual.onSubscribe(subscription); + synchronized void commit() { + client.commitBlockListWithResponse(this.blockList, null, null, null, this.accessConditions).block(); } + } - static final class FileReadSubscription implements Subscription, CompletionHandler { - private static final int NOT_SET = -1; - private static final long serialVersionUID = -6831808726875304256L; - // - private final Subscriber subscriber; - private volatile int position; - // - private final byte[] bigByteArray; - private final ByteBufAllocator alloc; - private final int chunkSize; - private final int offset; - private final int length; - // - private volatile boolean done; - private Throwable error; - private volatile ByteBuf next; - private volatile boolean cancelled; - // - volatile int wip; - @SuppressWarnings("rawtypes") - static final AtomicIntegerFieldUpdater WIP = AtomicIntegerFieldUpdater.newUpdater(ByteBufStreamFromByteArray.FileReadSubscription.class, "wip"); - volatile long requested; - @SuppressWarnings("rawtypes") - static final AtomicLongFieldUpdater REQUESTED = AtomicLongFieldUpdater.newUpdater(ByteBufStreamFromByteArray.FileReadSubscription.class, "requested"); - // - - FileReadSubscription(Subscriber subscriber, byte[] bigByteArray, ByteBufAllocator alloc, int chunkSize, int offset, int length) { - this.subscriber = subscriber; - // - this.bigByteArray = bigByteArray; - this.alloc = alloc; - this.chunkSize = chunkSize; - this.offset = offset; - this.length = length; - // - this.position = NOT_SET; - } + private static final class PageBlobOutputStream extends BlobOutputStream { + private final PageBlobAsyncClient client; + private final PageBlobAccessConditions pageBlobAccessConditions; - //region Subscription implementation + private PageBlobOutputStream(final PageBlobAsyncClient client, final long length, + final BlobAccessConditions blobAccessConditions) { + this.client = client; + this.writeThreshold = (int) Math.min(BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE, length); - @Override - public void request(long n) { - if (Operators.validate(n)) { - Operators.addCap(REQUESTED, this, n); - drain(); - } + if (blobAccessConditions != null) { + this.pageBlobAccessConditions = new PageBlobAccessConditions() + .setModifiedAccessConditions(blobAccessConditions.getModifiedAccessConditions()) + .setLeaseAccessConditions(blobAccessConditions.getLeaseAccessConditions()); + } else { + this.pageBlobAccessConditions = null; } + } - @Override - public void cancel() { - this.cancelled = true; - } + private Mono writePages(Flux pageData, long offset, long writeLength) { + return client.uploadPagesWithResponse(new PageRange().setStart(offset).setEnd(offset + writeLength - 1), + pageData, pageBlobAccessConditions) + .then() + .onErrorResume(t -> t instanceof StorageException, e -> { + this.lastError = new IOException(e); + return null; + }); + } - //endregion - - //region CompletionHandler implementation - - @Override - public void completed(Integer bytesRead, ByteBuf buffer) { - if (!cancelled) { - if (bytesRead == -1) { - done = true; - } else { - // use local variable to perform fewer volatile reads - int pos = position; - // - int bytesWanted = (int) Math.min(bytesRead, maxRequired(pos)); - buffer.writerIndex(bytesWanted); - int position2 = pos + bytesWanted; - //noinspection NonAtomicOperationOnVolatileField - position = position2; - next = buffer; - if (position2 >= offset + length) { - done = true; - } - } - drain(); - } + @Override + Mono dispatchWrite(byte[] data, int writeLength, long offset) { + if (writeLength == 0) { + return Mono.empty(); } - @Override - public void failed(Throwable exc, ByteBuf attachment) { - if (!cancelled) { - // must set error before setting done to true - // so that is visible in drain loop - error = exc; - done = true; - drain(); - } + if (writeLength % PageBlobAsyncClient.PAGE_BYTES != 0) { + return Mono.error(new IOException(String.format(SR.INVALID_NUMBER_OF_BYTES_IN_THE_BUFFER, + writeLength))); } - //endregion + Flux fbb = Flux.range(0, 1) + .concatMap(pos -> Mono.fromCallable(() -> ByteBuffer.wrap(data, (int) offset, writeLength))); - private void drain() { - if (WIP.getAndIncrement(this) != 0) { - return; - } - // on first drain (first request) we initiate the first read - if (position == NOT_SET) { - position = offset; - doRead(); - } - int missed = 1; - for (;;) { - if (cancelled) { - return; - } - if (REQUESTED.get(this) > 0) { - boolean emitted = false; - // read d before next to avoid race - boolean d = done; - ByteBuf bb = next; - if (bb != null) { - next = null; - // - // try { - subscriber.onNext(bb); - // } finally { - // Note: Don't release here, we follow netty disposal pattern - // it's consumers responsiblity to release chunks after consumption. - // - // ReferenceCountUtil.release(bb); - // } - // - emitted = true; - } else { - emitted = false; - } - if (d) { - if (error != null) { - subscriber.onError(error); - // exit without reducing wip so that further drains will be NOOP - return; - } else { - subscriber.onComplete(); - // exit without reducing wip so that further drains will be NOOP - return; - } - } - if (emitted) { - // do this after checking d to avoid calling read - // when done - Operators.produced(REQUESTED, this, 1); - // - doRead(); - } - } - missed = WIP.addAndGet(this, -missed); - if (missed == 0) { - return; - } - } - } - - private void doRead() { - // use local variable to limit volatile reads - int pos = position; - int readSize = Math.min(chunkSize, maxRequired(pos)); - ByteBuf innerBuf = alloc.buffer(readSize, readSize); - try { - innerBuf.writeBytes(bigByteArray, pos, readSize); - completed(readSize, innerBuf); - } catch (Exception e) { - failed(e, innerBuf); - } - } + return this.writePages(fbb.subscribeOn(Schedulers.elastic()), offset, writeLength); + } - private int maxRequired(long pos) { - long maxRequired = offset + length - pos; - if (maxRequired <= 0) { - return 0; - } else { - int m = (int) (maxRequired); - // support really large files by checking for overflow - if (m < 0) { - return Integer.MAX_VALUE; - } else { - return m; - } - } - } + @Override + void commit() { + // PageBlob doesn't need to commit anything. } } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobProperties.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobProperties.java index 307ebbc140e4..a44177df0efa 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobProperties.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobProperties.java @@ -4,106 +4,310 @@ package com.azure.storage.blob; 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.BlobGetPropertiesHeaders; import com.azure.storage.blob.models.BlobType; +import com.azure.storage.blob.models.CopyStatusType; +import com.azure.storage.blob.models.LeaseDurationType; +import com.azure.storage.blob.models.LeaseStateType; +import com.azure.storage.blob.models.LeaseStatusType; import com.azure.storage.blob.models.Metadata; import java.time.OffsetDateTime; public final class BlobProperties { - - private final BlobType blobType; - - private final Metadata metadata; - + private final OffsetDateTime creationTime; + private final OffsetDateTime lastModified; + private final String eTag; private final long blobSize; - + private final String contentType; private final byte[] contentMD5; - private final String contentEncoding; - private final String contentDisposition; - private final String contentLanguage; - private final String cacheControl; - - private final OffsetDateTime lastModified; - + private final Long blobSequenceNumber; + private final BlobType blobType; + private final LeaseStatusType leaseStatus; + private final LeaseStateType leaseState; + private final LeaseDurationType leaseDuration; + private final String copyId; + private final CopyStatusType copyStatus; + private final String copySource; + private final String copyProgress; + private final OffsetDateTime copyCompletionTime; + private final String copyStatusDescription; + private final Boolean isServerEncrypted; + private final Boolean isIncrementalCopy; + private final String copyDestinationSnapshot; + private final AccessTier accessTier; + private final Boolean isAccessTierInferred; + private final ArchiveStatus archiveStatus; + private final String encryptionKeySha256; + private final OffsetDateTime accessTierChangeTime; + private final Metadata metadata; + private final Integer committedBlockCount; BlobProperties(BlobGetPropertiesHeaders generatedHeaders) { - this.blobType = generatedHeaders.blobType(); - this.metadata = new Metadata(generatedHeaders.metadata()); - this.blobSize = generatedHeaders.contentLength() == null ? 0 : generatedHeaders.contentLength(); - this.contentMD5 = generatedHeaders.contentMD5(); - this.contentEncoding = generatedHeaders.contentEncoding(); - this.contentDisposition = generatedHeaders.contentDisposition(); - this.contentLanguage = generatedHeaders.contentLanguage(); - this.cacheControl = generatedHeaders.cacheControl(); - this.lastModified = generatedHeaders.lastModified(); + this.creationTime = generatedHeaders.getCreationTime(); + this.lastModified = generatedHeaders.getLastModified(); + this.eTag = generatedHeaders.getETag(); + this.blobSize = generatedHeaders.getContentLength() == null ? 0 : generatedHeaders.getContentLength(); + this.contentType = generatedHeaders.getContentType(); + this.contentMD5 = generatedHeaders.getContentMD5(); + this.contentEncoding = generatedHeaders.getContentEncoding(); + this.contentDisposition = generatedHeaders.getContentDisposition(); + this.contentLanguage = generatedHeaders.getContentLanguage(); + this.cacheControl = generatedHeaders.getCacheControl(); + this.blobSequenceNumber = generatedHeaders.getBlobSequenceNumber(); + this.blobType = generatedHeaders.getBlobType(); + this.leaseStatus = generatedHeaders.getLeaseStatus(); + this.leaseState = generatedHeaders.getLeaseState(); + this.leaseDuration = generatedHeaders.getLeaseDuration(); + this.copyId = generatedHeaders.getCopyId(); + this.copyStatus = generatedHeaders.getCopyStatus(); + this.copySource = generatedHeaders.getCopySource(); + this.copyProgress = generatedHeaders.getCopyProgress(); + this.copyCompletionTime = generatedHeaders.getCopyCompletionTime(); + this.copyStatusDescription = generatedHeaders.getCopyStatusDescription(); + this.isServerEncrypted = generatedHeaders.isServerEncrypted(); + this.isIncrementalCopy = generatedHeaders.isIncrementalCopy(); + this.copyDestinationSnapshot = generatedHeaders.getDestinationSnapshot(); + this.accessTier = AccessTier.fromString(generatedHeaders.getAccessTier()); + this.isAccessTierInferred = generatedHeaders.isAccessTierInferred(); + this.archiveStatus = ArchiveStatus.fromString(generatedHeaders.getArchiveStatus()); + this.encryptionKeySha256 = generatedHeaders.getEncryptionKeySha256(); + this.accessTierChangeTime = generatedHeaders.getAccessTierChangeTime(); + this.metadata = new Metadata(generatedHeaders.getMetadata()); + this.committedBlockCount = generatedHeaders.getBlobCommittedBlockCount(); } + /** + * @return the time when the blob was created + */ + public OffsetDateTime getCreationTime() { + return creationTime; + } /** - * @return the blob type + * @return the time when the blob was last modified */ - public BlobType blobType() { - return blobType; + public OffsetDateTime getLastModified() { + return lastModified; } /** - * @return the metadata associated with this blob + * @return the eTag of the blob */ - public Metadata metadata() { - return metadata; + public String getETag() { + return eTag; } /** * @return the size of the blob in bytes */ - public long blobSize() { + public long getBlobSize() { return blobSize; } + /** + * @return the content type of the blob + */ + public String getContentType() { + return contentType; + } + /** * @return the MD5 of the blob's content */ - public byte[] contentMD5() { + public byte[] getContentMD5() { return ImplUtils.clone(contentMD5); } /** - * @return the encoding of the blob's content + * @return the content encoding of the blob */ - public String contentEncoding() { + public String getContentEncoding() { return contentEncoding; } /** - * @return the disposition of the blob's content + * @return the content disposition of the blob */ - public String contentDisposition() { + public String getContentDisposition() { return contentDisposition; } /** - * @return the language of the blob's content + * @return the content language of the blob */ - public String contentLanguage() { + public String getContentLanguage() { return contentLanguage; } /** - * @return the caching control for the blob + * @return the cache control of the blob */ - public String cacheControl() { + public String getCacheControl() { return cacheControl; } /** - * @return the time this blob was last modified + * @return the current sequence number of the page blob. This is only returned for page blobs. */ - public OffsetDateTime lastModified() { - return lastModified; + public Long getBlobSequenceNumber() { + return blobSequenceNumber; + } + + /** + * @return the type of the blob + */ + public BlobType getBlobType() { + return blobType; + } + + /** + * @return the lease status of the blob + */ + public LeaseStatusType getLeaseStatus() { + return leaseStatus; + } + + /** + * @return the lease state of the blob + */ + public LeaseStateType getLeaseState() { + return leaseState; + } + + /** + * @return the lease duration if the blob is leased + */ + public LeaseDurationType getLeaseDuration() { + return leaseDuration; + } + + /** + * @return the identifier of the last copy operation. If this blob hasn't been the target of a copy operation or has + * been modified since this won't be set. + */ + public String getCopyId() { + return copyId; + } + + /** + * @return the status of the last copy operation. If this blob hasn't been the target of a copy operation or has + * been modified since this won't be set. + */ + public CopyStatusType getCopyStatus() { + return copyStatus; + } + + /** + * @return the source blob URL from the last copy operation. If this blob hasn't been the target of a copy operation + * or has been modified since this won't be set. + */ + public String getCopySource() { + return copySource; + } + + /** + * @return the number of bytes copied and total bytes in the source from the last copy operation (bytes copied/total + * bytes). If this blob hasn't been the target of a copy operation or has been modified since this won't be set. + */ + public String getCopyProgress() { + return copyProgress; + } + + /** + * @return the completion time of the last copy operation. If this blob hasn't been the target of a copy operation + * or has been modified since this won't be set. + */ + public OffsetDateTime getCopyCompletionTime() { + return copyCompletionTime; + } + + /** + * @return the description of the last copy failure, this is set when the {@link #getCopyStatus() getCopyStatus} is + * {@link CopyStatusType#FAILED failed} or {@link CopyStatusType#ABORTED aborted}. If this blob hasn't been the + * target of a copy operation or has been modified since this won't be set. + */ + public String getCopyStatusDescription() { + return copyStatusDescription; + } + + /** + * @return the status of the blob being encrypted on the server + */ + public Boolean isServerEncrypted() { + return isServerEncrypted; + } + + /** + * @return the status of the blob being an incremental copy blob + */ + public Boolean isIncrementalCopy() { + return isIncrementalCopy; + } + + /** + * @return the snapshot time of the last successful incremental copy snapshot for this blob. If this blob isn't an + * incremental copy blob or incremental copy snapshot or {@link #getCopyStatus() getCopyStatus} isn't {@link + * CopyStatusType#SUCCESS success} this won't be set. + */ + public String getCopyDestinationSnapshot() { + return copyDestinationSnapshot; + } + + /** + * @return the tier of the blob. This is only set for Page blobs on a premium storage account or for Block blobs on + * blob storage or general purpose V2 account. + */ + public AccessTier getAccessTier() { + return accessTier; + } + + /** + * @return the status of the tier being inferred for the blob. This is only set for Page blobs on a premium storage + * account or for Block blobs on blob storage or general purpose V2 account. + */ + public Boolean isAccessTierInferred() { + return isAccessTierInferred; + } + + /** + * @return the archive status of the blob. This is only for blobs on a blob storage and general purpose v2 account. + */ + public ArchiveStatus getArchiveStatus() { + return archiveStatus; + } + + /** + * @return the key used to encrypt the blob + */ + public String getEncryptionKeySha256() { + return encryptionKeySha256; + } + + /** + * @return the time when the access tier for the blob was last changed + */ + public OffsetDateTime getAccessTierChangeTime() { + return accessTierChangeTime; + } + + /** + * @return the metadata associated to this blob + */ + public Metadata getMetadata() { + return metadata; + } + + /** + * @return the number of committed blocks in the blob. This is only returned for Append blobs. + */ + public Integer getCommittedBlockCount() { + return committedBlockCount; } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobSASPermission.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobSASPermission.java index 24f4b0d0a96c..841b5edd24dc 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobSASPermission.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobSASPermission.java @@ -3,14 +3,16 @@ package com.azure.storage.blob; +import com.azure.storage.common.SR; + import java.util.Locale; /** * This is a helper class to construct a string representing the permissions granted by a ServiceSAS to a blob. 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 a - * {@link ServiceSASSignatureValues} 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. + * the values are set, this should be serialized with toString and set as the permissions field on a {@link + * BlobServiceSASSignatureValues} 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 BlobSASPermission { @@ -34,9 +36,7 @@ public BlobSASPermission() { * Creates a {@code BlobSASPermission} 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 BlobSASPermission}. - * + * @param permString A {@code String} which represents the {@code BlobSASPermission}. * @return A {@code BlobSASPermission} generated from the given {@code String}. * @throws IllegalArgumentException If {@code permString} contains a character other than r, a, c, w, or d. */ @@ -63,7 +63,8 @@ public static BlobSASPermission parse(String permString) { break; default: throw new IllegalArgumentException( - String.format(Locale.ROOT, SR.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, "Permissions", permString, c)); + String.format(Locale.ROOT, SR.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, + "Permissions", permString, c)); } } return permissions; @@ -72,7 +73,7 @@ public static BlobSASPermission parse(String permString) { /** * @return the read permission status. */ - public boolean read() { + public boolean getRead() { return read; } @@ -82,7 +83,7 @@ public boolean read() { * @param read Permission status to set * @return the updated BlobSASPermission object. */ - public BlobSASPermission read(boolean read) { + public BlobSASPermission setRead(boolean read) { this.read = read; return this; } @@ -90,7 +91,7 @@ public BlobSASPermission read(boolean read) { /** * @return the add permission status. */ - public boolean add() { + public boolean getAdd() { return add; } @@ -100,7 +101,7 @@ public boolean add() { * @param add Permission status to set * @return the updated BlobSASPermission object. */ - public BlobSASPermission add(boolean add) { + public BlobSASPermission setAdd(boolean add) { this.add = add; return this; } @@ -108,7 +109,7 @@ public BlobSASPermission add(boolean add) { /** * @return the create permission status. */ - public boolean create() { + public boolean getCreate() { return create; } @@ -118,7 +119,7 @@ public boolean create() { * @param create Permission status to set * @return the updated BlobSASPermission object. */ - public BlobSASPermission create(boolean create) { + public BlobSASPermission setCreate(boolean create) { this.create = create; return this; } @@ -126,7 +127,7 @@ public BlobSASPermission create(boolean create) { /** * @return the write permission status. */ - public boolean write() { + public boolean getWrite() { return write; } @@ -136,7 +137,7 @@ public boolean write() { * @param write Permission status to set * @return the updated BlobSASPermission object. */ - public BlobSASPermission write(boolean write) { + public BlobSASPermission setWrite(boolean write) { this.write = write; return this; } @@ -144,7 +145,7 @@ public BlobSASPermission write(boolean write) { /** * @return the delete permission status. */ - public boolean delete() { + public boolean getDelete() { return delete; } @@ -154,7 +155,7 @@ public boolean delete() { * @param delete Permission status to set * @return the updated BlobSASPermission object. */ - public BlobSASPermission delete(boolean delete) { + public BlobSASPermission setDelete(boolean delete) { this.delete = delete; return this; } 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 e009c5631b77..755e98749820 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 @@ -5,13 +5,19 @@ import com.azure.core.credentials.TokenCredential; import com.azure.core.http.HttpPipeline; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.implementation.http.PagedResponseBase; +import com.azure.core.implementation.util.FluxUtil; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; import com.azure.storage.blob.implementation.AzureBlobStorageImpl; import com.azure.storage.blob.models.ContainerItem; +import com.azure.storage.blob.models.CpkInfo; import com.azure.storage.blob.models.KeyInfo; import com.azure.storage.blob.models.ListContainersOptions; import com.azure.storage.blob.models.Metadata; @@ -21,23 +27,29 @@ 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.Flux; import reactor.core.publisher.Mono; import java.net.MalformedURLException; import java.net.URL; +import java.time.Duration; import java.time.OffsetDateTime; +import java.util.function.Function; +import static com.azure.core.implementation.util.FluxUtil.withContext; import static com.azure.storage.blob.PostProcessor.postProcessResponse; /** - * Client to a storage account. It may only be instantiated through a {@link BlobServiceClientBuilder}. This class does not - * hold any state about a particular storage account but is instead a convenient way of sending off appropriate requests - * to the resource on the service. It may also be used to construct URLs to blobs and containers. + * Client to a storage account. It may only be instantiated through a {@link BlobServiceClientBuilder}. This class does + * not hold any state about a particular storage account but is instead a convenient way of sending off appropriate + * requests to the resource on the service. It may also be used to construct URLs to blobs and containers. * *

* This client contains operations on a blob. Operations on a container are available on {@link ContainerAsyncClient} @@ -54,15 +66,19 @@ * responses to a {@link java.util.concurrent.CompletableFuture} object through {@link Mono#toFuture()}. */ public final class BlobServiceAsyncClient { + private final ClientLogger logger = new ClientLogger(BlobServiceAsyncClient.class); + private final AzureBlobStorageImpl azureBlobStorage; + private final CpkInfo cpk; /** * Package-private constructor for use by {@link BlobServiceClientBuilder}. * * @param azureBlobStorage the API client for blob storage */ - BlobServiceAsyncClient(AzureBlobStorageImpl azureBlobStorage) { + BlobServiceAsyncClient(AzureBlobStorageImpl azureBlobStorage, CpkInfo cpk) { this.azureBlobStorage = azureBlobStorage; + this.cpk = cpk; } /** @@ -70,6 +86,10 @@ public final class BlobServiceAsyncClient { * create a container. It simply constructs the URL to the container and offers access to methods relevant to * containers. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.getContainerAsyncClient#String} + * * @param containerName The name of the container to point to. * @return A {@link ContainerAsyncClient} object pointing to the specified container */ @@ -77,7 +97,16 @@ public ContainerAsyncClient getContainerAsyncClient(String containerName) { return new ContainerAsyncClient(new AzureBlobStorageBuilder() .url(Utility.appendToURLPath(getAccountUrl(), containerName).toString()) .pipeline(azureBlobStorage.getHttpPipeline()) - .build()); + .build(), cpk); + } + + /** + * Gets the {@link HttpPipeline} powering this client. + * + * @return The pipeline. + */ + public HttpPipeline getHttpPipeline() { + return azureBlobStorage.getHttpPipeline(); } /** @@ -85,11 +114,15 @@ public ContainerAsyncClient getContainerAsyncClient(String containerName) { * fails. For more information, see the * Azure Docs. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.createContainer#String} + * * @param containerName Name of the container to create - * @return A response containing a {@link ContainerAsyncClient} used to interact with the container created. + * @return A {@link Mono} containing a {@link ContainerAsyncClient} used to interact with the container created. */ - public Mono> createContainer(String containerName) { - return createContainer(containerName, null, null); + public Mono createContainer(String containerName) { + return createContainerWithResponse(containerName, null, null).flatMap(FluxUtil::toMono); } /** @@ -97,28 +130,63 @@ public Mono> createContainer(String containerName * fails. For more information, see the * Azure Docs. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.createContainerWithResponse#String-Metadata-PublicAccessType} + * * @param containerName Name of the container to create * @param metadata {@link Metadata} * @param accessType Specifies how the data in this container is available to the public. See the * x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access. - * @return A response containing a {@link ContainerAsyncClient} used to interact with the container created. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains a {@link + * ContainerAsyncClient} used to interact with the container created. */ - public Mono> createContainer(String containerName, Metadata metadata, PublicAccessType accessType) { + public Mono> createContainerWithResponse(String containerName, Metadata metadata, + PublicAccessType accessType) { + return withContext(context -> createContainerWithResponse(containerName, metadata, accessType, context)); + } + + Mono> createContainerWithResponse(String containerName, Metadata metadata, + PublicAccessType accessType, Context context) { ContainerAsyncClient containerAsyncClient = getContainerAsyncClient(containerName); - return containerAsyncClient.create(metadata, accessType) + return containerAsyncClient.createWithResponse(metadata, accessType, context) .map(response -> new SimpleResponse<>(response, containerAsyncClient)); } /** * Deletes the specified container in the storage account. If the container doesn't exist the operation fails. For - * more information see the Azure Docs. + * more information see the Azure + * Docs. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.deleteContainer#String} * * @param containerName Name of the container to delete - * @return A response containing status code and HTTP headers + * @return A {@link Mono} containing containing status code and HTTP headers */ - public Mono deleteContainer(String containerName) { - return getContainerAsyncClient(containerName).delete(); + public Mono deleteContainer(String containerName) { + return deleteContainerWithResponse(containerName).flatMap(FluxUtil::toMono); + } + + /** + * Deletes the specified container in the storage account. If the container doesn't exist the operation fails. For + * more information see the Azure + * Docs. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.deleteContainerWithResponse#String-Context} + * + * @param containerName Name of the container to delete + * @return A {@link Mono} containing containing status code and HTTP headers + */ + public Mono deleteContainerWithResponse(String containerName) { + return withContext(context -> deleteContainerWithResponse(containerName, context)); + } + + Mono deleteContainerWithResponse(String containerName, Context context) { + return getContainerAsyncClient(containerName).deleteWithResponse(null, context); } /** @@ -131,7 +199,8 @@ public URL getAccountUrl() { try { return new URL(azureBlobStorage.getUrl()); } catch (MalformedURLException e) { - throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.getUrl()), e); + throw logger.logExceptionAsError(new RuntimeException( + String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.getUrl()), e)); } } @@ -139,9 +208,13 @@ public URL getAccountUrl() { * Returns a reactive Publisher emitting all the containers in this account lazily as needed. For more information, * see the Azure Docs. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.listContainers} + * * @return A reactive response emitting the list of containers. */ - public Flux listContainers() { + public PagedFlux listContainers() { return this.listContainers(new ListContainersOptions()); } @@ -149,67 +222,74 @@ public Flux listContainers() { * Returns a reactive Publisher emitting all the containers in this account lazily as needed. For more information, * see the Azure Docs. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.listContainers#ListContainersOptions} + * * @param options A {@link ListContainersOptions} which specifies what data should be returned by the service. * @return A reactive response emitting the list of containers. */ - public Flux listContainers(ListContainersOptions options) { - return listContainersSegment(null, options) - .flatMapMany(response -> listContainersHelper(response.value().marker(), options, response)); + public PagedFlux listContainers(ListContainersOptions options) { + return listContainersWithOptionalTimeout(options, null); } - /* - * Returns a Mono segment of containers starting from the specified Marker. - * Use an empty marker to start enumeration from the beginning. Container names are returned in lexicographic order. - * After getting a segment, process it, and then call ListContainers again (passing the the previously-returned - * Marker) to get the next segment. For more information, see - * the Azure Docs. - * - * @param marker - * Identifies the portion of the list to be returned with the next list operation. - * This value is returned in the response of a previous list operation as the - * ListContainersSegmentResponse.body().nextMarker(). Set to null to list the first segment. - * @param options - * A {@link ListContainersOptions} which specifies what data should be returned by the service. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_list "Sample code for ServiceURL.listContainersSegment")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_list_helper "Helper code for ServiceURL.listContainersSegment")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - private Mono listContainersSegment(String marker, ListContainersOptions options) { + PagedFlux listContainersWithOptionalTimeout(ListContainersOptions options, Duration timeout) { + Function>> func = + marker -> listContainersSegment(marker, options, timeout) + .map(response -> new PagedResponseBase<>( + response.getRequest(), + response.getStatusCode(), + response.getHeaders(), + response.getValue().getContainerItems(), + response.getValue().getNextMarker(), + response.getDeserializedHeaders())); + + return new PagedFlux<>(() -> func.apply(null), func); + } + + private Mono listContainersSegment(String marker, + ListContainersOptions options, Duration timeout) { options = options == null ? new ListContainersOptions() : options; - return postProcessResponse( + return postProcessResponse(Utility.applyOptionalTimeout( this.azureBlobStorage.services().listContainersSegmentWithRestResponseAsync( - options.prefix(), marker, options.maxResults(), options.details().toIncludeType(), null, - null, Context.NONE)); + options.getPrefix(), marker, options.getMaxResults(), options.getDetails().toIncludeType(), null, + null, Context.NONE), timeout)); } - private Flux listContainersHelper(String marker, ListContainersOptions options, - ServicesListContainersSegmentResponse response) { - Flux result = Flux.fromIterable(response.value().containerItems()); - if (response.value().nextMarker() != null) { - // Recursively add the continuation items to the observable. - result = result.concatWith(listContainersSegment(marker, options) - .flatMapMany((r) -> - listContainersHelper(response.value().nextMarker(), options, r))); - } - - return result; + /** + * Gets the properties of a storage account’s Blob service. For more information, see the + * Azure Docs. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.getProperties} + * + * @return A reactive response containing the storage account properties. + */ + public Mono getProperties() { + return getPropertiesWithResponse().flatMap(FluxUtil::toMono); } /** * Gets the properties of a storage account’s Blob service. For more information, see the * Azure Docs. * - * @return A reactive response containing the storage account properties. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.getPropertiesWithResponse} + * + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the storage + * account properties. */ - public Mono> getProperties() { + public Mono> getPropertiesWithResponse() { + return withContext(this::getPropertiesWithResponse); + } + + Mono> getPropertiesWithResponse(Context context) { return postProcessResponse( - this.azureBlobStorage.services().getPropertiesWithRestResponseAsync(null, null, Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, rb.value())); + this.azureBlobStorage.services().getPropertiesWithRestResponseAsync(null, null, context)) + .map(rb -> new SimpleResponse<>(rb, rb.getValue())); } /** @@ -218,12 +298,36 @@ public Mono> getProperties() { * Note that setting the default service version has no effect when using this client because this client explicitly * sets the version header on each request, overriding the default. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.setProperties#StorageServiceProperties} + * * @param properties Configures the service. - * @return A reactive response containing the storage account properties. + * @return A {@link Mono} containing the storage account properties. + */ + public Mono setProperties(StorageServiceProperties properties) { + return setPropertiesWithResponse(properties).flatMap(FluxUtil::toMono); + } + + /** + * Sets properties for a storage account's Blob service endpoint. For more information, see the + * Azure Docs. + * Note that setting the default service version has no effect when using this client because this client explicitly + * sets the version header on each request, overriding the default. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.setPropertiesWithResponse#StorageServiceProperties} + * + * @param properties Configures the service. + * @return A {@link Mono} containing the storage account properties. */ - public Mono setProperties(StorageServiceProperties properties) { + public Mono setPropertiesWithResponse(StorageServiceProperties properties) { + return withContext(context -> setPropertiesWithResponse(properties, context)); + } + + Mono setPropertiesWithResponse(StorageServiceProperties properties, Context context) { return postProcessResponse( - this.azureBlobStorage.services().setPropertiesWithRestResponseAsync(properties, null, null, Context.NONE)) + this.azureBlobStorage.services().setPropertiesWithRestResponseAsync(properties, null, null, context)) .map(VoidResponse::new); } @@ -231,24 +335,54 @@ public Mono setProperties(StorageServiceProperties properties) { * Gets a user delegation key for use with this account's blob storage. Note: This method call is only valid when * using {@link TokenCredential} in this object's {@link HttpPipeline}. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.getUserDelegationKey#OffsetDateTime-OffsetDateTime} + * * @param start Start time for the key's validity. Null indicates immediate start. * @param expiry Expiration of the key's validity. - * @return A reactive response containing the user delegation key. + * @return A {@link Mono} containing the user delegation key. * @throws IllegalArgumentException If {@code start} isn't null and is after {@code expiry}. */ - public Mono> getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry) { + public Mono getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry) { + return withContext(context -> getUserDelegationKeyWithResponse(start, expiry, context)) + .flatMap(FluxUtil::toMono); + } + + /** + * Gets a user delegation key for use with this account's blob storage. Note: This method call is only valid when + * using {@link TokenCredential} in this object's {@link HttpPipeline}. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.getUserDelegationKeyWithResponse#OffsetDateTime-OffsetDateTime} + * + * @param start Start time for the key's validity. Null indicates immediate start. + * @param expiry Expiration of the key's validity. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} containing the user + * delegation key. + * @throws IllegalArgumentException If {@code start} isn't null and is after {@code expiry}. + */ + public Mono> getUserDelegationKeyWithResponse(OffsetDateTime start, + OffsetDateTime expiry) { + return withContext(context -> getUserDelegationKeyWithResponse(start, expiry, context)); + } + + Mono> getUserDelegationKeyWithResponse(OffsetDateTime start, OffsetDateTime expiry, + Context context) { Utility.assertNotNull("expiry", expiry); if (start != null && !start.isBefore(expiry)) { - throw new IllegalArgumentException("`start` must be null or a datetime before `expiry`."); + throw logger.logExceptionAsError( + new IllegalArgumentException("`start` must be null or a datetime before `expiry`.")); } return postProcessResponse( this.azureBlobStorage.services().getUserDelegationKeyWithRestResponseAsync( new KeyInfo() - .start(start == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(start)) - .expiry(Utility.ISO_8601_UTC_DATE_FORMATTER.format(expiry)), - null, null, Context.NONE) - ).map(rb -> new SimpleResponse<>(rb, rb.value())); + .setStart(start == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(start)) + .setExpiry(Utility.ISO_8601_UTC_DATE_FORMATTER.format(expiry)), + null, null, context) + ).map(rb -> new SimpleResponse<>(rb, rb.getValue())); } /** @@ -257,23 +391,70 @@ public Mono> getUserDelegationKey(OffsetDateTime sta * the * Azure Docs. * - * @return A reactive response containing the storage account statistics. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.getStatistics} + * + * @return A {@link Mono} containing the storage account statistics. */ - public Mono> getStatistics() { + public Mono getStatistics() { + return getStatisticsWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Retrieves statistics related to replication for the Blob service. It is only available on the secondary location + * endpoint when read-access geo-redundant replication is enabled for the storage account. For more information, see + * the + * Azure Docs. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.getStatisticsWithResponse} + * + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} containing the + * storage account statistics. + */ + public Mono> getStatisticsWithResponse() { + return withContext(this::getStatisticsWithResponse); + } + + Mono> getStatisticsWithResponse(Context context) { return postProcessResponse( - this.azureBlobStorage.services().getStatisticsWithRestResponseAsync(null, null, Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, rb.value())); + this.azureBlobStorage.services().getStatisticsWithRestResponseAsync(null, null, context)) + .map(rb -> new SimpleResponse<>(rb, rb.getValue())); + } + + /** + * Returns the sku name and account kind for the account. For more information, please see the + * Azure Docs. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.getAccountInfo} + * + * @return A {@link Mono} containing containing the storage account info. + */ + public Mono getAccountInfo() { + return getAccountInfoWithResponse().flatMap(FluxUtil::toMono); } /** * Returns the sku name and account kind for the account. For more information, please see the * Azure Docs. * - * @return A reactive response containing the storage account info. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.getAccountInfoWithResponse} + * + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} the storage account + * info. */ - public Mono> getAccountInfo() { - return postProcessResponse(this.azureBlobStorage.services().getAccountInfoWithRestResponseAsync(Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, new StorageAccountInfo(rb.deserializedHeaders()))); + public Mono> getAccountInfoWithResponse() { + return withContext(this::getAccountInfoWithResponse); + } + + Mono> getAccountInfoWithResponse(Context context) { + return postProcessResponse(this.azureBlobStorage.services().getAccountInfoWithRestResponseAsync(context)) + .map(rb -> new SimpleResponse<>(rb, new StorageAccountInfo(rb.getDeserializedHeaders()))); } /** @@ -286,7 +467,7 @@ public Mono> getAccountInfo() { * @return A string that represents the SAS token */ public String generateAccountSAS(AccountSASService accountSASService, AccountSASResourceType accountSASResourceType, - AccountSASPermission accountSASPermission, OffsetDateTime expiryTime) { + AccountSASPermission accountSASPermission, OffsetDateTime expiryTime) { return this.generateAccountSAS(accountSASService, accountSASResourceType, accountSASPermission, expiryTime, null /* startTime */, null /* version */, null /* ipRange */, null /* sasProtocol */); } @@ -294,6 +475,13 @@ public String generateAccountSAS(AccountSASService accountSASService, AccountSAS /** * 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 @@ -305,27 +493,14 @@ public String generateAccountSAS(AccountSASService accountSASService, AccountSAS * @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) { - - AccountSASSignatureValues accountSASSignatureValues = new AccountSASSignatureValues(); - accountSASSignatureValues.services(accountSASService == null ? null : accountSASService.toString()); - accountSASSignatureValues.resourceTypes(accountSASResourceType == null ? null : accountSASResourceType.toString()); - accountSASSignatureValues.permissions(accountSASPermission == null ? null : accountSASPermission.toString()); - accountSASSignatureValues.expiryTime(expiryTime); - accountSASSignatureValues.startTime(startTime); - - if (version != null) { - accountSASSignatureValues.version(version); - } - - accountSASSignatureValues.ipRange(ipRange); - accountSASSignatureValues.protocol(sasProtocol); - - SharedKeyCredential sharedKeyCredential = Utility.getSharedKeyCredential(this.azureBlobStorage.getHttpPipeline()); + AccountSASPermission accountSASPermission, OffsetDateTime expiryTime, OffsetDateTime startTime, String version, + IPRange ipRange, SASProtocol sasProtocol) { - SASQueryParameters sasQueryParameters = accountSASSignatureValues.generateSASQueryParameters(sharedKeyCredential); + SharedKeyCredential sharedKeyCredential = + Utility.getSharedKeyCredential(this.azureBlobStorage.getHttpPipeline()); + Utility.assertNotNull("sharedKeyCredential", sharedKeyCredential); - return sasQueryParameters.encode(); + 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 07fc7dc0c6bd..1c87b7ab819c 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 @@ -5,9 +5,11 @@ import com.azure.core.credentials.TokenCredential; import com.azure.core.http.HttpPipeline; +import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.util.Context; import com.azure.storage.blob.models.ContainerItem; import com.azure.storage.blob.models.ListContainersOptions; import com.azure.storage.blob.models.Metadata; @@ -16,10 +18,12 @@ 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.Flux; import reactor.core.publisher.Mono; import java.net.URL; @@ -27,9 +31,9 @@ import java.time.OffsetDateTime; /** - * Client to a storage account. It may only be instantiated through a {@link BlobServiceClientBuilder}. This class does not - * hold any state about a particular storage account but is instead a convenient way of sending off appropriate requests - * to the resource on the service. It may also be used to construct URLs to blobs and containers. + * Client to a storage account. It may only be instantiated through a {@link BlobServiceClientBuilder}. This class does + * not hold any state about a particular storage account but is instead a convenient way of sending off appropriate + * requests to the resource on the service. It may also be used to construct URLs to blobs and containers. * *

* This client contains operations on a blob. Operations on a container are available on {@link ContainerClient} through @@ -55,6 +59,10 @@ public final class BlobServiceClient { * Initializes a {@link ContainerClient} object pointing to the specified container. This method does not create a * container. It simply constructs the URL to the container and offers access to methods relevant to containers. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceClient.getContainerClient#String} + * * @param containerName The name of the container to point to. * @return A {@link ContainerClient} object pointing to the specified container */ @@ -62,16 +70,29 @@ public ContainerClient getContainerClient(String containerName) { return new ContainerClient(blobServiceAsyncClient.getContainerAsyncClient(containerName)); } + /** + * Gets the {@link HttpPipeline} powering this client. + * + * @return The pipeline. + */ + public HttpPipeline getHttpPipeline() { + return blobServiceAsyncClient.getHttpPipeline(); + } + /** * Creates a new container within a storage account. If a container with the same name already exists, the operation * fails. For more information, see the * Azure Docs. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceClient.createContainer#String} + * * @param containerName Name of the container to create - * @return A response containing a {@link ContainerClient} used to interact with the container created. + * @return The {@link ContainerClient} used to interact with the container created. */ - public Response createContainer(String containerName) { - return createContainer(containerName, null, null); + public ContainerClient createContainer(String containerName) { + return createContainerWithResponse(containerName, null, null, Context.NONE).getValue(); } /** @@ -79,27 +100,51 @@ public Response createContainer(String containerName) { * fails. For more information, see the * Azure Docs. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceClient.createContainerWithResponse#String-Metadata-PublicAccessType-Context} + * * @param containerName Name of the container to create * @param metadata {@link Metadata} * @param accessType Specifies how the data in this container is available to the public. See the * x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access. - * @return A response containing a {@link ContainerClient} used to interact with the container created. + * @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 {@link ContainerClient} used to + * interact with the container created. */ - public Response createContainer(String containerName, Metadata metadata, PublicAccessType accessType) { + public Response createContainerWithResponse(String containerName, Metadata metadata, + PublicAccessType accessType, Context context) { ContainerClient client = getContainerClient(containerName); - return new SimpleResponse<>(client.create(metadata, accessType, null), client); + return new SimpleResponse<>(client.createWithResponse(metadata, accessType, null, context), client); + } + + /** + * Deletes the specified container in the storage account. If the container doesn't exist the operation fails. For + * more information see the Azure + * Docs. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceClient.deleteContainer#String} + * + * @param containerName Name of the container to delete + */ + public void deleteContainer(String containerName) { + deleteContainerWithResponse(containerName, Context.NONE); } /** * Deletes the specified container in the storage account. If the container doesn't exist the operation fails. For - * more information see the Azure Docs. + * more information see the Azure + * Docs. * * @param containerName Name of the container to delete + * @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 VoidResponse deleteContainer(String containerName) { - return blobServiceAsyncClient.deleteContainer(containerName).block(); + public VoidResponse deleteContainerWithResponse(String containerName, Context context) { + return blobServiceAsyncClient.deleteContainerWithResponse(containerName).block(); } /** @@ -112,51 +157,66 @@ public URL getAccountUrl() { } /** - * Returns a lazy loaded list of containers in this account. The returned {@link Iterable} can be iterated through + * Returns a lazy loaded list of containers in this account. The returned {@link PagedIterable} can be consumed * while new items are automatically retrieved as needed. For more information, see the Azure Docs. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceClient.listContainers} + * * @return The list of containers. */ - public Iterable listContainers() { + public PagedIterable listContainers() { return this.listContainers(new ListContainersOptions(), null); } /** - * Returns a lazy loaded list of containers in this account. The returned {@link Iterable} can be iterated through + * Returns a lazy loaded list of containers in this account. The returned {@link PagedIterable} can be consumed * while new items are automatically retrieved as needed. For more information, see the Azure Docs. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceClient.listContainers#ListContainersOptions-Duration} + * * @param options A {@link ListContainersOptions} which specifies what data should be returned by the service. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return The list of containers. */ - public Iterable listContainers(ListContainersOptions options, Duration timeout) { - Flux response = blobServiceAsyncClient.listContainers(options); - - return timeout == null ? response.toIterable() : response.timeout(timeout).toIterable(); + public PagedIterable listContainers(ListContainersOptions options, Duration timeout) { + return new PagedIterable<>(blobServiceAsyncClient.listContainersWithOptionalTimeout(options, timeout)); } /** * Gets the properties of a storage account’s Blob service. For more information, see the * Azure Docs. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceClient.getProperties} + * * @return The storage account properties. */ - public Response getProperties() { - return this.getProperties(null); + public StorageServiceProperties getProperties() { + return getPropertiesWithResponse(null, Context.NONE).getValue(); } /** * Gets the properties of a storage account’s Blob service. For more information, see the * Azure Docs. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceClient.getPropertiesWithResponse#Duration-Context} + * * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @return The storage account properties. + * @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 storage account properties. */ - public Response getProperties(Duration timeout) { + public Response getPropertiesWithResponse(Duration timeout, Context context) { - Mono> response = blobServiceAsyncClient.getProperties(); + Mono> response = blobServiceAsyncClient.getPropertiesWithResponse(context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -167,11 +227,14 @@ public Response getProperties(Duration timeout) { * Note that setting the default service version has no effect when using this client because this client explicitly * sets the version header on each request, overriding the default. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceClient.setProperties#StorageServiceProperties} + * * @param properties Configures the service. - * @return The storage account properties. */ - public VoidResponse setProperties(StorageServiceProperties properties) { - return this.setProperties(properties, null); + public void setProperties(StorageServiceProperties properties) { + setPropertiesWithResponse(properties, null, Context.NONE); } /** @@ -180,12 +243,18 @@ public VoidResponse setProperties(StorageServiceProperties properties) { * Note that setting the default service version has no effect when using this client because this client explicitly * sets the version header on each request, overriding the default. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceClient.setPropertiesWithResponse#StorageServiceProperties-Duration-Context} + * * @param properties Configures the service. * @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 storage account properties. */ - public VoidResponse setProperties(StorageServiceProperties properties, Duration timeout) { - Mono response = blobServiceAsyncClient.setProperties(properties); + public VoidResponse setPropertiesWithResponse(StorageServiceProperties properties, Duration timeout, + Context context) { + Mono response = blobServiceAsyncClient.setPropertiesWithResponse(properties, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -194,26 +263,36 @@ public VoidResponse setProperties(StorageServiceProperties properties, Duration * Gets a user delegation key for use with this account's blob storage. Note: This method call is only valid when * using {@link TokenCredential} in this object's {@link HttpPipeline}. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceClient.getUserDelegationKey#OffsetDateTime-OffsetDateTime} + * * @param start Start time for the key's validity. Null indicates immediate start. * @param expiry Expiration of the key's validity. * @return The user delegation key. */ - public Response getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry) { - return this.getUserDelegationKey(start, expiry, null); + public UserDelegationKey getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry) { + return getUserDelegationKeyWithResponse(start, expiry, null, Context.NONE).getValue(); } /** * Gets a user delegation key for use with this account's blob storage. Note: This method call is only valid when * using {@link TokenCredential} in this object's {@link HttpPipeline}. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceClient.getUserDelegationKeyWithResponse#OffsetDateTime-OffsetDateTime-Duration-Context} + * * @param start Start time for the key's validity. Null indicates immediate start. * @param expiry Expiration of the key's validity. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @return The user delegation key. + * @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 user delegation key. */ - public Response getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry, - Duration timeout) { - Mono> response = blobServiceAsyncClient.getUserDelegationKey(start, expiry); + public Response getUserDelegationKeyWithResponse(OffsetDateTime start, OffsetDateTime expiry, + Duration timeout, Context context) { + Mono> response = blobServiceAsyncClient.getUserDelegationKeyWithResponse(start, + expiry, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -224,10 +303,14 @@ public Response getUserDelegationKey(OffsetDateTime start, Of * the * Azure Docs. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceClient.getStatistics} + * * @return The storage account statistics. */ - public Response getStatistics() { - return this.getStatistics(null); + public StorageServiceStats getStatistics() { + return getStatisticsWithResponse(null, Context.NONE).getValue(); } /** @@ -236,11 +319,16 @@ public Response getStatistics() { * the * Azure Docs. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceClient.getStatisticsWithResponse#Duration-Context} + * * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @return The storage account statistics. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A {@link Response} whose {@link Response#getValue() value} the storage account statistics. */ - public Response getStatistics(Duration timeout) { - Mono> response = blobServiceAsyncClient.getStatistics(); + public Response getStatisticsWithResponse(Duration timeout, Context context) { + Mono> response = blobServiceAsyncClient.getStatisticsWithResponse(context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -249,10 +337,14 @@ public Response getStatistics(Duration timeout) { * Returns the sku name and account kind for the account. For more information, please see the * Azure Docs. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlobServiceClient.getAccountInfo} + * * @return The storage account info. */ - public Response getAccountInfo() { - return this.getAccountInfo(null); + public StorageAccountInfo getAccountInfo() { + return getAccountInfoWithResponse(null, Context.NONE).getValue(); } /** @@ -260,10 +352,11 @@ public Response getAccountInfo() { * Azure Docs. * * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @return The storage account info. + * @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 storage account info. */ - public Response getAccountInfo(Duration timeout) { - Mono> response = blobServiceAsyncClient.getAccountInfo(); + public Response getAccountInfoWithResponse(Duration timeout, Context context) { + Mono> response = blobServiceAsyncClient.getAccountInfoWithResponse(context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -278,13 +371,21 @@ public Response getAccountInfo(Duration timeout) { * @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); + 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 @@ -296,8 +397,9 @@ public String generateAccountSAS(AccountSASService accountSASService, AccountSAS * @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); + 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/BlobServiceClientBuilder.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClientBuilder.java index 49aeb7536468..01a8149d6a81 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 @@ -3,78 +3,43 @@ package com.azure.storage.blob; -import com.azure.core.credentials.TokenCredential; -import com.azure.core.http.HttpClient; import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLoggingPolicy; -import com.azure.core.http.policy.HttpPipelinePolicy; -import com.azure.core.http.policy.RequestIdPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.implementation.util.ImplUtils; -import com.azure.core.util.configuration.Configuration; -import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.core.implementation.annotation.ServiceClientBuilder; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; import com.azure.storage.common.credentials.SASTokenCredential; -import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.common.policy.RequestRetryOptions; -import com.azure.storage.common.policy.RequestRetryPolicy; -import com.azure.storage.common.policy.SASTokenCredentialPolicy; -import com.azure.storage.common.policy.SharedKeyCredentialPolicy; import java.net.MalformedURLException; import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Objects; /** - * Fluent BlobServiceClientBuilder for instantiating a {@link BlobServiceClient} or {@link BlobServiceAsyncClient} - * using {@link BlobServiceClientBuilder#buildClient()} or {@link BlobServiceClientBuilder#buildAsyncClient()} respectively. + * Fluent BlobServiceClientBuilder for instantiating a {@link BlobServiceClient} or {@link BlobServiceAsyncClient} using + * {@link BlobServiceClientBuilder#buildClient()} or {@link BlobServiceClientBuilder#buildAsyncClient()} respectively. * *

* The following information must be provided on this builder: * *

    - *
  • the endpoint through {@code .endpoint()}, in the format of {@code https://{accountName}.blob.core.windows.net}. - *
  • the credential through {@code .credential()} or {@code .connectionString()} if the container is not publicly accessible. + *
  • the endpoint through {@code .endpoint()}, in the format of {@code https://{accountName}.blob.core.windows.net}. + *
  • the credential through {@code .credential()} or {@code .connectionString()} if the container is not publicly + * accessible. *
* *

- * Once all the configurations are set on this builder, call {@code .buildClient()} to create a - * {@link BlobServiceClient} or {@code .buildAsyncClient()} to create a {@link BlobServiceAsyncClient}. + * Once all the configurations are set on this builder, call {@code .buildClient()} to create a {@link + * BlobServiceClient} or {@code .buildAsyncClient()} to create a {@link BlobServiceAsyncClient}. */ -public final class BlobServiceClientBuilder { - private static final String ACCOUNT_NAME = "accountname"; - private static final String ACCOUNT_KEY = "accountkey"; - private static final String ENDPOINT_PROTOCOL = "defaultendpointsprotocol"; - private static final String ENDPOINT_SUFFIX = "endpointsuffix"; +@ServiceClientBuilder(serviceClients = {BlobServiceClient.class, BlobServiceAsyncClient.class}) +public final class BlobServiceClientBuilder extends BaseBlobClientBuilder { - private final List policies; + private final ClientLogger logger = new ClientLogger(BlobServiceClientBuilder.class); - private String endpoint; - private SharedKeyCredential sharedKeyCredential; - private TokenCredential tokenCredential; - private SASTokenCredential sasTokenCredential; - private HttpClient httpClient; - private HttpLogDetailLevel logLevel; - private RequestRetryOptions retryOptions; - private Configuration configuration; /** * Creates a builder instance that is able to configure and construct {@link BlobServiceClient BlobServiceClients} * and {@link BlobServiceAsyncClient BlobServiceAsyncClients}. */ public BlobServiceClientBuilder() { - retryOptions = new RequestRetryOptions(); - logLevel = HttpLogDetailLevel.NONE; - policies = new ArrayList<>(); } /** @@ -88,44 +53,20 @@ public BlobServiceClient buildClient() { * @return a {@link BlobServiceAsyncClient} created from the configurations in this builder. */ public BlobServiceAsyncClient buildAsyncClient() { - Objects.requireNonNull(endpoint); - - // Closest to API goes first, closest to wire goes last. - final List policies = new ArrayList<>(); - - if (configuration == null) { - configuration = ConfigurationManager.getConfiguration(); + HttpPipeline pipeline = super.getPipeline(); + if (pipeline == null) { + pipeline = super.buildPipeline(); } - policies.add(new UserAgentPolicy(BlobConfiguration.NAME, BlobConfiguration.VERSION, configuration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddDatePolicy()); - - if (sharedKeyCredential != null) { - policies.add(new SharedKeyCredentialPolicy(sharedKeyCredential)); - } else if (tokenCredential != null) { - policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, String.format("%s/.default", endpoint))); - } else if (sasTokenCredential != null) { - policies.add(new SASTokenCredentialPolicy(sasTokenCredential)); - } - - policies.add(new RequestRetryPolicy(retryOptions)); - - policies.addAll(this.policies); - policies.add(new HttpLoggingPolicy(logLevel)); - - HttpPipeline pipeline = new HttpPipelineBuilder() - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .build(); return new BlobServiceAsyncClient(new AzureBlobStorageBuilder() - .url(endpoint) + .url(super.endpoint) .pipeline(pipeline) - .build()); + .build(), cpk); } /** - * Sets the blob service endpoint, additionally parses it for information (SAS token, queue name) + * Sets the blob service endpoint, additionally parses it for information (SAS token) + * * @param endpoint URL of the service * @return the updated BlobServiceClientBuilder object * @throws IllegalArgumentException If {@code endpoint} is {@code null} or is a malformed URL. @@ -133,158 +74,22 @@ public BlobServiceAsyncClient buildAsyncClient() { public BlobServiceClientBuilder endpoint(String endpoint) { try { URL url = new URL(endpoint); - this.endpoint = url.getProtocol() + "://" + url.getAuthority(); + super.endpoint = url.getProtocol() + "://" + url.getAuthority(); - this.sasTokenCredential = SASTokenCredential.fromSASTokenString(URLParser.parse(url).sasQueryParameters().encode()); - if (this.sasTokenCredential != null) { - this.tokenCredential = null; - this.sharedKeyCredential = null; + SASTokenCredential sasTokenCredential = SASTokenCredential + .fromSASTokenString(URLParser.parse(url).getSasQueryParameters().encode()); + if (sasTokenCredential != null) { + super.credential(sasTokenCredential); } } catch (MalformedURLException ex) { - throw new IllegalArgumentException("The Azure Storage endpoint url is malformed."); + throw logger.logExceptionAsError( + new IllegalArgumentException("The Azure Storage endpoint url is malformed.")); } return this; } String endpoint() { - return this.endpoint; - } - - /** - * Sets the credential used to authorize requests sent to the service - * @param credential authorization credential - * @return the updated ContainerClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null}. - */ - public BlobServiceClientBuilder credential(SharedKeyCredential credential) { - this.sharedKeyCredential = Objects.requireNonNull(credential); - this.tokenCredential = null; - this.sasTokenCredential = null; - return this; - } - - /** - * Sets the credential used to authorize requests sent to the service - * @param credential authorization credential - * @return the updated BlobServiceClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null}. - */ - public BlobServiceClientBuilder credential(TokenCredential credential) { - this.tokenCredential = Objects.requireNonNull(credential); - this.sharedKeyCredential = null; - this.sasTokenCredential = null; - return this; - } - - /** - * Sets the credential used to authorize requests sent to the service - * @param credential authorization credential - * @return the updated BlobServiceClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null}. - */ - public BlobServiceClientBuilder credential(SASTokenCredential credential) { - this.sasTokenCredential = Objects.requireNonNull(credential); - this.sharedKeyCredential = null; - this.tokenCredential = null; - return this; - } - - /** - * Clears the credential used to authorize requests sent to the service - * @return the updated BlobServiceClientBuilder object - */ - public BlobServiceClientBuilder anonymousCredential() { - this.sharedKeyCredential = null; - this.tokenCredential = null; - this.sasTokenCredential = null; - return this; - } - - /** - * Sets the connection string for the service, parses it for authentication information (account name, account key) - * @param connectionString connection string from access keys section - * @return the updated BlobServiceClientBuilder object - * @throws IllegalArgumentException If {@code connectionString} doesn't contain AccountName or AccountKey. - */ - public BlobServiceClientBuilder connectionString(String connectionString) { - Objects.requireNonNull(connectionString); - - Map connectionKVPs = new HashMap<>(); - for (String s : connectionString.split(";")) { - String[] kvp = s.split("=", 2); - connectionKVPs.put(kvp[0].toLowerCase(Locale.ROOT), kvp[1]); - } - - String accountName = connectionKVPs.get(ACCOUNT_NAME); - String accountKey = connectionKVPs.get(ACCOUNT_KEY); - String endpointProtocol = connectionKVPs.get(ENDPOINT_PROTOCOL); - String endpointSuffix = connectionKVPs.get(ENDPOINT_SUFFIX); - - if (ImplUtils.isNullOrEmpty(accountName) || ImplUtils.isNullOrEmpty(accountKey)) { - throw new IllegalArgumentException("Connection string must contain 'AccountName' and 'AccountKey'."); - } - - if (!ImplUtils.isNullOrEmpty(endpointProtocol) && !ImplUtils.isNullOrEmpty(endpointSuffix)) { - String endpoint = String.format("%s://%s.blob.%s", endpointProtocol, accountName, endpointSuffix.replaceFirst("^\\.", "")); - endpoint(endpoint); - } - - // Use accountName and accountKey to get the SAS token using the credential class. - return credential(new SharedKeyCredential(accountName, accountKey)); - } - - /** - * Sets the http client used to send service requests - * @param httpClient http client to send requests - * @return the updated BlobServiceClientBuilder object - * @throws NullPointerException If {@code httpClient} is {@code null}. - */ - public BlobServiceClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = Objects.requireNonNull(httpClient); - return this; - } - - /** - * Adds a pipeline policy to apply on each request sent - * @param pipelinePolicy a pipeline policy - * @return the updated BlobServiceClientBuilder object - * @throws NullPointerException If {@code pipelinePolicy} is {@code null}. - */ - public BlobServiceClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { - this.policies.add(Objects.requireNonNull(pipelinePolicy)); - return this; - } - - /** - * Sets the logging level for service requests - * @param logLevel logging level - * @return the updated BlobServiceClientBuilder object - */ - public BlobServiceClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { - this.logLevel = logLevel; - return this; - } - - /** - * Sets the configuration object used to retrieve environment configuration values used to buildClient the client with - * when they are not set in the appendBlobClientBuilder, defaults to Configuration.NONE - * @param configuration configuration store - * @return the updated BlobServiceClientBuilder object - */ - public BlobServiceClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /** - * Sets the request retry options for all the requests made through the client. - * @param retryOptions the options to configure retry behaviors - * @return the updated BlobServiceClientBuilder object - * @throws NullPointerException If {@code retryOptions} is {@code null}. - */ - public BlobServiceClientBuilder retryOptions(RequestRetryOptions retryOptions) { - this.retryOptions = Objects.requireNonNull(retryOptions); - return this; + return super.endpoint; } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceSASQueryParameters.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceSASQueryParameters.java new file mode 100644 index 000000000000..9443376cf6f6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceSASQueryParameters.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +import com.azure.storage.blob.models.UserDelegationKey; +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.Utility; + +import java.time.OffsetDateTime; +import java.util.Map; + +/** + * 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 BlobServiceSASSignatureValues} type. Once generated, it can be set on + * a {@link BlobClientBuilder} object to be constructed as part of a URL or it can be encoded into a {@code String} and + * appended to a URL directly (though caution should be taken here in case there are existing query parameters, which + * might affect the appropriate means of appending these query parameters). NOTE: Instances of this class are immutable + * to ensure thread safety. + */ +public final class BlobServiceSASQueryParameters extends BaseSASQueryParameters { + + private final String identifier; + + private final String keyOid; + + private final String keyTid; + + private final OffsetDateTime keyStart; + + private final OffsetDateTime keyExpiry; + + private final String keyService; + + private final String keyVersion; + + private final String resource; + + private final String cacheControl; + + private final String contentDisposition; + + private final String contentEncoding; + + private final String contentLanguage; + + private final String contentType; + + /** + * Creates a new {@link BlobServiceSASQueryParameters} object. + * + * @param queryParamsMap All query parameters for the request as key-value pairs + * @param removeSASParametersFromMap When {@code true}, the SAS query parameters will be removed from + * queryParamsMap + */ + public BlobServiceSASQueryParameters(Map queryParamsMap, boolean removeSASParametersFromMap) { + super(queryParamsMap, removeSASParametersFromMap); + this.identifier = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_IDENTIFIER, + removeSASParametersFromMap); + this.keyOid = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_OBJECT_ID, + removeSASParametersFromMap); + this.keyTid = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_TENANT_ID, + removeSASParametersFromMap); + this.keyStart = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_KEY_START, + removeSASParametersFromMap, Utility::parseDate); + this.keyExpiry = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_KEY_EXPIRY, + removeSASParametersFromMap, Utility::parseDate); + this.keyService = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_KEY_SERVICE, + removeSASParametersFromMap); + this.keyVersion = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_KEY_VERSION, + removeSASParametersFromMap); + this.resource = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_RESOURCE, + removeSASParametersFromMap); + this.cacheControl = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_CACHE_CONTROL, + removeSASParametersFromMap); + this.contentDisposition = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_CONTENT_DISPOSITION, + removeSASParametersFromMap); + this.contentEncoding = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_CONTENT_ENCODING, + removeSASParametersFromMap); + this.contentLanguage = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_CONTENT_LANGUAGE, + removeSASParametersFromMap); + this.contentType = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_CONTENT_TYPE, + removeSASParametersFromMap); + } + + /** + * Creates a new {@link BlobServiceSASQueryParameters} object. These objects are only created internally by + * SASSignatureValues classes. + * + * @param version A {@code String} representing the storage version. + * @param protocol A {@code String} representing the allowed HTTP protocol(s) or {@code null}. + * @param startTime A {@code java.util.Date} representing the start time for this SAS token or {@code null}. + * @param expiryTime A {@code java.util.Date} representing the expiry time for this SAS token. + * @param ipRange A {@link IPRange} representing the range of valid IP addresses for this SAS token or + * {@code null}. + * @param identifier A {@code String} representing the signed identifier (only for Service SAS) or {@code null}. + * @param resource A {@code String} representing the storage container or blob (only for Service SAS). + * @param permissions A {@code String} representing the storage permissions or {@code null}. + * @param signature A {@code String} representing the signature for the SAS token. + */ + 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) { + super(version, protocol, startTime, expiryTime, ipRange, permissions, signature); + + this.identifier = identifier; + this.resource = resource; + this.cacheControl = cacheControl; + this.contentDisposition = contentDisposition; + this.contentEncoding = contentEncoding; + this.contentLanguage = contentLanguage; + this.contentType = contentType; + + if (key != null) { + this.keyOid = key.getSignedOid(); + this.keyTid = 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.keyStart = null; + this.keyExpiry = null; + this.keyService = null; + this.keyVersion = null; + } + } + + /** + * @return The signed identifier (only for {@link BlobServiceSASSignatureValues}) or {@code null}. Please see + * here + * for more information. + */ + public String getIdentifier() { + return identifier; + } + + /** + * @return The storage container or blob (only for {@link BlobServiceSASSignatureValues}). + */ + public String getResource() { + return resource; + } + + /** + * @return The Cache-Control header value when a client accesses the resource with this sas token. + */ + public String getCacheControl() { + return cacheControl; + } + + /** + * @return The Content-Disposition header value when a client accesses the resource with this sas token. + */ + public String getContentDisposition() { + return contentDisposition; + } + + /** + * @return The Content-Encoding header value when a client accesses the resource with this sas token. + */ + public String getContentEncoding() { + return contentEncoding; + } + + /** + * @return The Content-Language header value when a client accesses the resource with this sas token. + */ + public String getContentLanguage() { + return contentLanguage; + } + + /** + * @return The Content-Type header value when a client accesses the resource with this sas token. + */ + public String getContentType() { + return contentType; + } + + /** + * @return the object ID of the key. + */ + public String getKeyOid() { + return keyOid; + } + + /** + * @return the tenant ID of the key. + */ + public String getKeyTid() { + return keyTid; + } + + /** + * @return the datetime when the key becomes active. + */ + public OffsetDateTime getKeyStart() { + return keyStart; + } + + /** + * @return the datetime when the key expires. + */ + public OffsetDateTime getKeyExpiry() { + return keyExpiry; + } + + /** + * @return the services that are permitted by the key. + */ + public String getKeyService() { + return keyService; + } + + /** + * @return the service version that created the key. + */ + public String getKeyVersion() { + return keyVersion; + } + + UserDelegationKey userDelegationKey() { + return new UserDelegationKey() + .setSignedExpiry(this.keyExpiry) + .setSignedOid(this.keyOid) + .setSignedService(this.keyService) + .setSignedStart(this.keyStart) + .setSignedTid(this.keyTid) + .setSignedVersion(this.keyVersion); + } + + /** + * Encodes all SAS query parameters into a string that can be appended to a URL. + * + * @return A {@code String} representing all SAS query parameters. + */ + public String encode() { + /* + We should be url-encoding each key and each value, but because we know all the keys and values will encode to + themselves, we cheat except for the signature value. + */ + StringBuilder sb = new StringBuilder(); + + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SERVICE_VERSION, this.version); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_PROTOCOL, this.protocol); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_START_TIME, formatQueryParameterDate(this.startTime)); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_EXPIRY_TIME, formatQueryParameterDate(this.expiryTime)); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_IP_RANGE, this.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_KEY_START, + formatQueryParameterDate(this.keyStart)); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_KEY_EXPIRY, + formatQueryParameterDate(this.keyExpiry)); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_KEY_SERVICE, this.keyService); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_KEY_VERSION, this.keyVersion); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_RESOURCE, this.resource); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_PERMISSIONS, this.permissions); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNATURE, this.signature); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CACHE_CONTROL, this.cacheControl); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CONTENT_DISPOSITION, this.contentDisposition); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CONTENT_ENCODING, this.contentEncoding); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CONTENT_LANGUAGE, this.contentLanguage); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CONTENT_TYPE, this.contentType); + + return sb.toString(); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceSASSignatureValues.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceSASSignatureValues.java new file mode 100644 index 000000000000..9d7eee455780 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceSASSignatureValues.java @@ -0,0 +1,521 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +import com.azure.core.util.logging.ClientLogger; +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 java.net.MalformedURLException; +import java.net.URL; +import java.time.OffsetDateTime; + +/** + * BlobServiceSASSignatureValues 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 + * which can actually be applied to blob urls. Note: that both this class and {@link BlobServiceSASQueryParameters} + * exist because the former is mutable and a logical representation while the latter is immutable and used to generate + * actual REST requests. + *

+ * Please see here + * for more conceptual information on SAS. + *

+ * Please see here for + * more details on each value, including which are required. + * + *

Please see + * here + * for additional samples.

+ */ + +final class BlobServiceSASSignatureValues { + private final ClientLogger logger = new ClientLogger(BlobServiceSASSignatureValues.class); + + private String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION; + + private SASProtocol protocol; + + private OffsetDateTime startTime; + + private OffsetDateTime expiryTime; + + private String permissions; + + private IPRange ipRange; + + private String canonicalName; + + private String resource; + + private String snapshotId; + + private String identifier; + + private String cacheControl; + + private String contentDisposition; + + private String contentEncoding; + + private String contentLanguage; + + private String contentType; + + /** + * Creates an object with empty values for all fields. + */ + BlobServiceSASSignatureValues() { + } + + /** + * Creates an object with the specified expiry time and permissions + * + * @param expiryTime Time the SAS becomes valid + * @param permissions Permissions granted by the SAS + */ + BlobServiceSASSignatureValues(OffsetDateTime expiryTime, String permissions) { + this.expiryTime = expiryTime; + this.permissions = permissions; + } + + /** + * Creates an object with the specified identifier + * + * @param identifier Identifier for the SAS + */ + BlobServiceSASSignatureValues(String identifier) { + this.identifier = identifier; + } + + 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) { + this.version = version; + } + this.protocol = sasProtocol; + this.startTime = startTime; + this.expiryTime = expiryTime; + this.permissions = permission; + this.ipRange = ipRange; + this.identifier = identifier; + this.cacheControl = cacheControl; + this.contentDisposition = contentDisposition; + this.contentEncoding = contentEncoding; + this.contentLanguage = contentLanguage; + this.contentType = contentType; + } + + /** + * @return the version of the service this SAS will target. If not specified, it will default to the version + * targeted by the library. + */ + public String getVersion() { + return version; + } + + /** + * Sets the version of the service this SAS will target. If not specified, it will default to the version targeted + * by the library. + * + * @param version Version to target + * @return the updated BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues setVersion(String version) { + this.version = version; + return this; + } + + /** + * @return the {@link SASProtocol} which determines the protocols allowed by the SAS. + */ + public SASProtocol getProtocol() { + return protocol; + } + + /** + * 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) { + this.protocol = protocol; + return this; + } + + /** + * @return when the SAS will take effect. + */ + public OffsetDateTime getStartTime() { + return startTime; + } + + /** + * Sets when the SAS will take effect. + * + * @param startTime When the SAS takes effect + * @return the updated BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * @return the time after which the SAS will no longer work. + */ + public OffsetDateTime getExpiryTime() { + return expiryTime; + } + + /** + * Sets the time after which the SAS will no longer work. + * + * @param expiryTime When the SAS will no longer work + * @return the updated BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues setExpiryTime(OffsetDateTime expiryTime) { + this.expiryTime = expiryTime; + return this; + } + + /** + * @return the permissions string allowed by the SAS. Please refer to either {@link ContainerSASPermission} or + * {@link BlobSASPermission} depending on the resource being accessed for help determining the permissions allowed. + */ + public String getPermissions() { + return permissions; + } + + /** + * Sets the permissions string allowed by the SAS. Please refer to either {@link ContainerSASPermission} or {@link + * BlobSASPermission} depending on the resource being accessed for help constructing the permissions string. + * + * @param permissions Permissions string for the SAS + * @return the updated BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues setPermissions(String permissions) { + this.permissions = permissions; + return this; + } + + /** + * @return the {@link IPRange} which determines the IP ranges that are allowed to use the SAS. + */ + public IPRange getIpRange() { + return ipRange; + } + + /** + * 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 BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues setIpRange(IPRange ipRange) { + this.ipRange = ipRange; + return this; + } + + /** + * @return the resource the SAS user may access. + */ + public String getResource() { + return resource; + } + + /** + * Sets the resource the SAS user may access. + * + * @param resource Allowed resources string to set + * @return the updated BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues setResource(String resource) { + this.resource = resource; + return this; + } + + /** + * @return the canonical name of the object the SAS user may access. + */ + public String getCanonicalName() { + return canonicalName; + } + + /** + * Sets the canonical name of the object the SAS user may access. + * + * @param canonicalName Canonical name of the object the SAS grants access + * @return the updated BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues setCanonicalName(String canonicalName) { + this.canonicalName = canonicalName; + return this; + } + + /** + * Sets the canonical name of the object the SAS user may access. Constructs a canonical name of + * "/blob/{accountName}{Path of urlString}". + * + * @param urlString URL string that contains the path to the object + * @param accountName Name of the account that contains the object + * @return the updated BlobServiceSASSignatureValues object + * @throws RuntimeException If {@code urlString} is a malformed URL. + */ + public BlobServiceSASSignatureValues setCanonicalName(String urlString, String accountName) { + URL url; + try { + url = new URL(urlString); + } catch (MalformedURLException e) { + throw logger.logExceptionAsError(new RuntimeException(e)); + } + + this.canonicalName = String.format("/blob/%s%s", accountName, url.getPath()); + return this; + } + + /** + * @return the specific snapshot the SAS user may access. + */ + public String getSnapshotId() { + return this.snapshotId; + } + + /** + * Sets the specific snapshot the SAS user may access. + * + * @param snapshotId Identifier of the snapshot + * @return the updated BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues setSnapshotId(String snapshotId) { + this.snapshotId = snapshotId; + return this; + } + + /** + * @return the name of the access policy on the container this SAS references if any. Please see + * here + * for more information. + */ + public String getIdentifier() { + return identifier; + } + + /** + * Sets the name of the access policy on the container this SAS references if any. Please see + * here + * for more information. + * + * @param identifier Name of the access policy + * @return the updated BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues setIdentifier(String identifier) { + this.identifier = identifier; + return this; + } + + /** + * @return the cache-control header for the SAS. + */ + public String getCacheControl() { + return cacheControl; + } + + /** + * Sets the cache-control header for the SAS. + * + * @param cacheControl Cache-Control header value + * @return the updated BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues setCacheControl(String cacheControl) { + this.cacheControl = cacheControl; + return this; + } + + /** + * @return the content-disposition header for the SAS. + */ + public String getContentDisposition() { + return contentDisposition; + } + + /** + * Sets the content-disposition header for the SAS. + * + * @param contentDisposition Content-Disposition header value + * @return the updated BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues setContentDisposition(String contentDisposition) { + this.contentDisposition = contentDisposition; + return this; + } + + /** + * @return the content-encoding header for the SAS. + */ + public String getContentEncoding() { + return contentEncoding; + } + + /** + * Sets the content-encoding header for the SAS. + * + * @param contentEncoding Content-Encoding header value + * @return the updated BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues setContentEncoding(String contentEncoding) { + this.contentEncoding = contentEncoding; + return this; + } + + /** + * @return the content-language header for the SAS. + */ + public String getContentLanguage() { + return contentLanguage; + } + + /** + * Sets the content-language header for the SAS. + * + * @param contentLanguage Content-Language header value + * @return the updated BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues setContentLanguage(String contentLanguage) { + this.contentLanguage = contentLanguage; + return this; + } + + /** + * @return the content-type header for the SAS. + */ + public String getContentType() { + return contentType; + } + + /** + * Sets the content-type header for the SAS. + * + * @param contentType Content-Type header value + * @return the updated BlobServiceSASSignatureValues object + */ + public BlobServiceSASSignatureValues setContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Uses an account's shared key credential to sign these signature values to produce the proper SAS query + * parameters. + * + * @param sharedKeyCredentials A {@link SharedKeyCredential} object used to sign the SAS values. + * @return {@link BlobServiceSASQueryParameters} + * @throws IllegalStateException If the HMAC-SHA256 algorithm isn't supported, if the key isn't a valid Base64 + * encoded string, or the UTF-8 charset isn't supported. + */ + public BlobServiceSASQueryParameters generateSASQueryParameters(SharedKeyCredential sharedKeyCredentials) { + Utility.assertNotNull("sharedKeyCredentials", sharedKeyCredentials); + assertGenerateOK(false); + + // Signature is generated on the un-url-encoded values. + String signature = sharedKeyCredentials.computeHmac256(stringToSign()); + + return new BlobServiceSASQueryParameters(this.version, this.protocol, this.startTime, this.expiryTime, + this.ipRange, this.identifier, this.resource, this.permissions, signature, this.cacheControl, + this.contentDisposition, this.contentEncoding, this.contentLanguage, this.contentType, null /* delegate */); + } + + /** + * Uses a user delegation key to sign these signature values to produce the proper SAS query parameters. + * + * @param delegationKey A {@link UserDelegationKey} object used to sign the SAS values. + * @return {@link BlobServiceSASQueryParameters} + * @throws IllegalStateException If the HMAC-SHA256 algorithm isn't supported, if the key isn't a valid Base64 + * encoded string, or the UTF-8 charset isn't supported. + */ + public BlobServiceSASQueryParameters generateSASQueryParameters(UserDelegationKey delegationKey) { + Utility.assertNotNull("delegationKey", delegationKey); + assertGenerateOK(true); + + // Signature is generated on the un-url-encoded values. + String signature = Utility.computeHMac256(delegationKey.getValue(), stringToSign(delegationKey)); + + return new BlobServiceSASQueryParameters(this.version, this.protocol, this.startTime, this.expiryTime, + this.ipRange, null /* identifier */, this.resource, this.permissions, signature, this.cacheControl, + this.contentDisposition, this.contentEncoding, this.contentLanguage, this.contentType, delegationKey); + } + + /** + * Common assertions for generateSASQueryParameters overloads. + */ + private void assertGenerateOK(boolean usingUserDelegation) { + Utility.assertNotNull("version", this.version); + Utility.assertNotNull("canonicalName", this.canonicalName); + Utility.assertNotNull("resource", this.resource); + + // If a UserDelegation key or a SignedIdentifier is not being used both expiryDate and permissions must be set. + if (usingUserDelegation || identifier == null) { + Utility.assertNotNull("expiryTime", this.expiryTime); + Utility.assertNotNull("permissions", this.permissions); + } else if (!usingUserDelegation) { + // Otherwise a SignedIdentifier must be used. + Utility.assertNotNull("identifier", this.identifier); + } + + if (Constants.UrlConstants.SAS_CONTAINER_CONSTANT.equals(this.resource) && this.snapshotId != null) { + throw logger.logExceptionAsError( + new IllegalArgumentException("Cannot set a snapshotId without resource being a blob.")); + } + } + + private String stringToSign() { + return String.join("\n", + this.permissions == null ? "" : this.permissions, + this.startTime == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(this.startTime), + this.expiryTime == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(this.expiryTime), + this.canonicalName == null ? "" : this.canonicalName, + this.identifier == null ? "" : this.identifier, + this.ipRange == null ? "" : this.ipRange.toString(), + this.protocol == null ? "" : protocol.toString(), + this.version == null ? "" : this.version, + this.resource == null ? "" : this.resource, + this.snapshotId == null ? "" : this.snapshotId, + this.cacheControl == null ? "" : this.cacheControl, + this.contentDisposition == null ? "" : this.contentDisposition, + this.contentEncoding == null ? "" : this.contentEncoding, + this.contentLanguage == null ? "" : this.contentLanguage, + this.contentType == null ? "" : this.contentType + ); + } + + private String stringToSign(final UserDelegationKey key) { + return String.join("\n", + this.permissions == null ? "" : this.permissions, + this.startTime == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(this.startTime), + this.expiryTime == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(this.expiryTime), + this.canonicalName == null ? "" : this.canonicalName, + key.getSignedOid() == null ? "" : key.getSignedOid(), + key.getSignedTid() == null ? "" : key.getSignedTid(), + key.getSignedStart() == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(key.getSignedStart()), + key.getSignedExpiry() == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(key.getSignedExpiry()), + key.getSignedService() == null ? "" : key.getSignedService(), + key.getSignedVersion() == null ? "" : key.getSignedVersion(), + this.ipRange == null ? "" : this.ipRange.toString(), + this.protocol == null ? "" : this.protocol.toString(), + this.version == null ? "" : this.version, + this.resource == null ? "" : this.resource, + this.snapshotId == null ? "" : this.snapshotId, + this.cacheControl == null ? "" : this.cacheControl, + this.contentDisposition == null ? "" : this.contentDisposition, + this.contentEncoding == null ? "" : this.contentEncoding, + this.contentLanguage == null ? "" : this.contentLanguage, + this.contentType == null ? "" : this.contentType + ); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobURLParts.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobURLParts.java index 90a9c4892caa..f43a8ca393ea 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 @@ -14,13 +14,10 @@ /** * A BlobURLParts object represents the components that make up an Azure Storage Container/Blob URL. You may parse an - * existing URL into its parts with the {@link URLParser} class. You may construct a URL from parts by calling toURL(). - * It is also possible to use the empty constructor to buildClient a blobURL from scratch. - * NOTE: Changing any SAS-related field requires computing a new SAS signature. + * existing URL into its parts with the {@link URLParser} class. You may construct a URL from parts by calling + * {@link #toURL()}. It is also possible to use the empty constructor to buildClient a blobURL from scratch. * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=url_parts "Sample code for BlobURLParts")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) + *

NOTE: Changing any SAS-related field requires computing a new SAS signature.

*/ final class BlobURLParts { @@ -34,7 +31,7 @@ final class BlobURLParts { private String snapshot; - private SASQueryParameters sasQueryParameters; + private BlobServiceSASQueryParameters blobServiceSasQueryParameters; private Map unparsedParameters; @@ -50,14 +47,14 @@ final class BlobURLParts { /** * The scheme. Ex: "https://". */ - public String scheme() { + public String getScheme() { return scheme; } /** * The scheme. Ex: "https://". */ - public BlobURLParts scheme(String scheme) { + public BlobURLParts setScheme(String scheme) { this.scheme = scheme; return this; } @@ -65,14 +62,14 @@ public BlobURLParts scheme(String scheme) { /** * The host. Ex: "account.blob.core.windows.net". */ - public String host() { + public String getHost() { return host; } /** * The host. Ex: "account.blob.core.windows.net". */ - public BlobURLParts host(String host) { + public BlobURLParts setHost(String host) { this.host = host; return this; } @@ -80,14 +77,14 @@ public BlobURLParts host(String host) { /** * The container name or {@code null} if a {@link BlobServiceAsyncClient} was parsed. */ - public String containerName() { + public String getContainerName() { return containerName; } /** * The container name or {@code null} if a {@link BlobServiceAsyncClient} was parsed. */ - public BlobURLParts containerName(String containerName) { + public BlobURLParts setContainerName(String containerName) { this.containerName = containerName; return this; } @@ -95,14 +92,14 @@ public BlobURLParts containerName(String containerName) { /** * The blob name or {@code null} if a {@link BlobServiceAsyncClient} or {@link ContainerAsyncClient} was parsed. */ - public String blobName() { + public String getBlobName() { return blobName; } /** * The blob name or {@code null} if a {@link BlobServiceAsyncClient} or {@link ContainerAsyncClient} was parsed. */ - public BlobURLParts blobName(String blobName) { + public BlobURLParts setBlobName(String blobName) { this.blobName = blobName; return this; } @@ -110,48 +107,48 @@ public BlobURLParts blobName(String blobName) { /** * The snapshot time or {@code null} if anything except a URL to a snapshot was parsed. */ - public String snapshot() { + public String getSnapshot() { return snapshot; } /** * The snapshot time or {@code null} if anything except a URL to a snapshot was parsed. */ - public BlobURLParts snapshot(String snapshot) { + public BlobURLParts setSnapshot(String snapshot) { this.snapshot = snapshot; return this; } /** - * A {@link SASQueryParameters} representing the SAS query parameters or {@code null} if there were no such - * parameters. + * A {@link BlobServiceSASQueryParameters} representing the SAS query parameters or {@code null} if there were no + * such parameters. */ - public SASQueryParameters sasQueryParameters() { - return sasQueryParameters; + public BlobServiceSASQueryParameters getSasQueryParameters() { + return blobServiceSasQueryParameters; } /** - * A {@link SASQueryParameters} representing the SAS query parameters or {@code null} if there were no such - * parameters. + * A {@link BlobServiceSASQueryParameters} representing the SAS query parameters or {@code null} if there were no + * such parameters. */ - public BlobURLParts sasQueryParameters(SASQueryParameters sasQueryParameters) { - this.sasQueryParameters = sasQueryParameters; + public BlobURLParts setSasQueryParameters(BlobServiceSASQueryParameters blobServiceSasQueryParameters) { + this.blobServiceSasQueryParameters = blobServiceSasQueryParameters; return this; } /** - * The query parameter key value pairs aside from SAS parameters and snapshot time or {@code null} if there were - * no such parameters. + * The query parameter key value pairs aside from SAS parameters and snapshot time or {@code null} if there were no + * such parameters. */ - public Map unparsedParameters() { + public Map getUnparsedParameters() { return unparsedParameters; } /** - * The query parameter key value pairs aside from SAS parameters and snapshot time or {@code null} if there were - * no such parameters. + * The query parameter key value pairs aside from SAS parameters and snapshot time or {@code null} if there were no + * such parameters. */ - public BlobURLParts unparsedParameters(Map unparsedParameters) { + public BlobURLParts setUnparsedParameters(Map unparsedParameters) { this.unparsedParameters = unparsedParameters; return this; } @@ -160,13 +157,11 @@ public BlobURLParts unparsedParameters(Map unparsedParameters) * Converts the blob URL parts to a {@link URL}. * * @return A {@code java.net.URL} to the blob resource composed of all the elements in the object. - * - * @throws MalformedURLException - * The fields present on the BlobURLParts object were insufficient to construct a valid URL or were - * ill-formatted. + * @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 { - UrlBuilder url = new UrlBuilder().scheme(this.scheme).host(this.host); + UrlBuilder url = new UrlBuilder().setScheme(this.scheme).setHost(this.host); StringBuilder path = new StringBuilder(); if (this.containerName != null) { @@ -176,22 +171,22 @@ public URL toURL() throws MalformedURLException { path.append(this.blobName); } } - url.path(path.toString()); + url.setPath(path.toString()); if (this.snapshot != null) { url.setQueryParameter(Constants.SNAPSHOT_QUERY_PARAMETER, this.snapshot); } - if (this.sasQueryParameters != null) { - String encodedSAS = this.sasQueryParameters.encode(); + if (this.blobServiceSasQueryParameters != null) { + String encodedSAS = this.blobServiceSasQueryParameters.encode(); if (encodedSAS.length() != 0) { - url.query(encodedSAS); + url.setQuery(encodedSAS); } } for (Map.Entry entry : this.unparsedParameters.entrySet()) { // The commas are intentionally encoded. url.setQueryParameter(entry.getKey(), - Utility.urlEncode(String.join(",", entry.getValue()))); + Utility.urlEncode(String.join(",", entry.getValue()))); } return url.toURL(); diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java index 162bb1917b61..2ae0d717c500 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java @@ -4,24 +4,26 @@ package com.azure.storage.blob; import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.ResponseBase; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; import com.azure.core.implementation.util.FluxUtil; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.implementation.AzureBlobStorageImpl; +import com.azure.storage.blob.models.AccessTier; +import com.azure.storage.blob.models.AccessTierOptional; import com.azure.storage.blob.models.BlobAccessConditions; 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.BlockItem; +import com.azure.storage.blob.models.BlockList; import com.azure.storage.blob.models.BlockListType; import com.azure.storage.blob.models.BlockLookupList; +import com.azure.storage.blob.models.CpkInfo; import com.azure.storage.blob.models.LeaseAccessConditions; import com.azure.storage.blob.models.Metadata; import com.azure.storage.blob.models.SourceModifiedAccessConditions; import com.azure.storage.common.Constants; -import io.netty.buffer.ByteBuf; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -29,6 +31,7 @@ import java.io.IOException; import java.io.UncheckedIOException; import java.net.URL; +import java.nio.ByteBuffer; import java.nio.channels.AsynchronousFileChannel; import java.nio.charset.StandardCharsets; import java.nio.file.Paths; @@ -36,36 +39,39 @@ import java.util.ArrayList; import java.util.Base64; import java.util.List; +import java.util.Objects; import java.util.SortedMap; import java.util.TreeMap; import java.util.UUID; +import java.util.stream.Collectors; +import static com.azure.core.implementation.util.FluxUtil.withContext; import static com.azure.storage.blob.PostProcessor.postProcessResponse; +import static java.nio.charset.StandardCharsets.UTF_8; /** - * Client to a block blob. It may only be instantiated through a {@link BlobClientBuilder}, via - * the method {@link BlobAsyncClient#asBlockBlobAsyncClient()}, or via the method - * {@link ContainerAsyncClient#getBlockBlobAsyncClient(String)}. This class does not hold - * any state about a particular blob, but is instead a convenient way of sending appropriate - * requests to the resource on the service. + * Client to a block blob. It may only be instantiated through a {@link BlobClientBuilder}, via the method {@link + * BlobAsyncClient#asBlockBlobAsyncClient()}, or via the method + * {@link ContainerAsyncClient#getBlockBlobAsyncClient(String)}. This class does not hold any state about a particular + * blob, but is instead a convenient way of sending appropriate requests to the resource on the service. * *

* This client contains operations on a blob. Operations on a container are available on {@link ContainerAsyncClient}, * and operations on the service are available on {@link BlobServiceAsyncClient}. * *

- * Please refer - * to the Azure Docs - * for more information. + * Please refer to the Azure + * Docs for more information. * *

- * Note this client is an async client that returns reactive responses from Spring Reactor Core - * project (https://projectreactor.io/). Calling the methods in this client will NOT - * start the actual network operation, until {@code .subscribe()} is called on the reactive response. - * You can simply convert one of these responses to a {@link java.util.concurrent.CompletableFuture} - * object through {@link Mono#toFuture()}. + * Note this client is an async client that returns reactive responses from Spring Reactor Core project + * (https://projectreactor.io/). Calling the methods in this client will NOT start the actual network + * operation, until {@code .subscribe()} is called on the reactive response. You can simply convert one of these + * responses to a {@link java.util.concurrent.CompletableFuture} object through {@link Mono#toFuture()}. */ public final class BlockBlobAsyncClient extends BlobAsyncClient { + private final ClientLogger logger = new ClientLogger(BlockBlobAsyncClient.class); + static final int BLOB_DEFAULT_UPLOAD_BLOCK_SIZE = 4 * Constants.MB; static final int BLOB_MAX_UPLOAD_BLOCK_SIZE = 100 * Constants.MB; @@ -86,132 +92,297 @@ public final class BlockBlobAsyncClient extends BlobAsyncClient { /** * Package-private constructor for use by {@link BlobClientBuilder}. + * * @param azureBlobStorage the API client for blob storage */ - BlockBlobAsyncClient(AzureBlobStorageImpl azureBlobStorage, String snapshot) { - super(azureBlobStorage, snapshot); + BlockBlobAsyncClient(AzureBlobStorageImpl azureBlobStorage, String snapshot, CpkInfo cpk) { + super(azureBlobStorage, snapshot, cpk); } /** - * Creates a new block blob, or updates the content of an existing block blob. - * Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not - * supported with PutBlob; the content of the existing blob is overwritten with the new content. To - * perform a partial update of a block blob's, use PutBlock and PutBlockList. - * For more information, see the + * Creates a new block blob, or updates the content of an existing block blob. Updating an existing block blob + * overwrites any existing metadata on the blob. Partial updates are not supported with PutBlob; the content of the + * existing blob is overwritten with the new content. To perform a partial update of a block blob's, use PutBlock + * and PutBlockList. For more information, see the * Azure Docs. *

* Note that the data passed must be replayable if retries are enabled (the default). In other words, the * {@code Flux} must produce the same data each time it is subscribed to. *

* - * @param data - * The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled - * (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}. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlockBlobAsyncClient.upload#Flux-long} * - * @return - * A reactive response containing the information of the uploaded block blob. + * @param data The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled + * (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}. + * @return A reactive response containing the information of the uploaded block blob. */ - public Mono> upload(Flux data, long length) { - return this.upload(data, length, null, null, null); + public Mono upload(Flux data, long length) { + return uploadWithResponse(data, length, null, null, null, null).flatMap(FluxUtil::toMono); } /** * Creates a new block blob, or updates the content of an existing block blob. - * Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not - * supported with PutBlob; the content of the existing blob is overwritten with the new content. To - * perform a partial update of a block blob's, use PutBlock and PutBlockList. - * For more information, see the + *

+ * Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not supported + * with PutBlob; the content of the existing blob is overwritten with the new content. To perform a partial update + * of a block blob's, use PutBlock and PutBlockList. For more information, see the * Azure Docs. *

* Note that the data passed must be replayable if retries are enabled (the default). In other words, the * {@code Flux} must produce the same data each time it is subscribed to. *

* - * @param data - * The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled - * (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 metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * - * @return - * A reactive response containing the information of the uploaded block blob. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlockBlobAsyncClient.uploadWithResponse#Flux-long-BlobHTTPHeaders-Metadata-AccessTier-BlobAccessConditions} + * + * @param data The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled + * (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 metadata {@link Metadata} + * @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> upload(Flux data, long length, BlobHTTPHeaders headers, - Metadata metadata, BlobAccessConditions accessConditions) { + public Mono> uploadWithResponse(Flux data, long length, BlobHTTPHeaders headers, + Metadata metadata, AccessTier tier, BlobAccessConditions accessConditions) { + return withContext(context -> uploadWithResponse(data, length, headers, metadata, tier, accessConditions, + context)); + } + + Mono> uploadWithResponse(Flux data, long length, BlobHTTPHeaders headers, + Metadata metadata, AccessTier tier, BlobAccessConditions accessConditions, Context context) { metadata = metadata == null ? new Metadata() : metadata; accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; + AccessTierOptional opTier = tier == null ? null : AccessTierOptional.fromString(tier.toString()); return postProcessResponse(this.azureBlobStorage.blockBlobs().uploadWithRestResponseAsync(null, - null, data, length, null, metadata, null, null, - null, null, headers, accessConditions.leaseAccessConditions(), - accessConditions.modifiedAccessConditions(), Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, new BlockBlobItem(rb.deserializedHeaders()))); + null, data, length, null, metadata, opTier, null, headers, accessConditions.getLeaseAccessConditions(), cpk, + accessConditions.getModifiedAccessConditions(), context)) + .map(rb -> new SimpleResponse<>(rb, new BlockBlobItem(rb.getDeserializedHeaders()))); + } + + /** + * Creates a new block blob, or updates the content of an existing block blob. + *

+ * Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not supported + * with this method; the content of the existing blob is overwritten with the new content. To perform a partial + * update of a block blob's, use {@link BlockBlobAsyncClient#stageBlock(String, Flux, long) stageBlock} and {@link + * BlockBlobAsyncClient#commitBlockList(List)}. For more information, see the + * Azure Docs for Put Block and the + * Azure Docs for Put Block List. + *

+ * The data passed need not support multiple subscriptions/be replayable as is required in other upload methods when + * retries are enabled, and the length of the data need not be known in advance. Therefore, this method should + * support uploading any arbitrary data source, including network streams. This behavior is possible because this + * method will perform some internal buffering as configured by the blockSize and numBuffers parameters, so while + * this method may offer additional convenience, it will not be as performant as other options, which should be + * preferred when possible. + *

+ * Typically, the greater the number of buffers used, the greater the possible parallelism when transferring the + * data. Larger buffers means we will have to stage fewer blocks and therefore require fewer IO operations. The + * trade-offs between these values are context-dependent, so some experimentation may be required to optimize inputs + * for a given scenario. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlockBlobAsyncClient.upload#Flux-int-int} + * + * @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 blockSize The size of each block that will be staged. This value also determines the size that each buffer + * used by this method will be and determines the number of requests that need to be made. The amount of memory + * consumed by this method may be up to blockSize * numBuffers. If block size is large, this method will make fewer + * network calls, but each individual call will send more data and will therefore take longer. + * @param numBuffers The maximum number of buffers this method should allocate. Must be at least two. Typically, the + * larger the number of buffers, the more parallel, and thus faster, the upload portion of this operation will be. + * The amount of memory consumed by this method may be up to blockSize * numBuffers. + * @return A reactive response containing the information of the uploaded block blob. + */ + public Mono upload(Flux data, int blockSize, int numBuffers) { + return this.uploadWithResponse(data, blockSize, numBuffers, null, null, null, null).flatMap(FluxUtil::toMono); } /** - * Creates a new block blob, or updates the content of an existing block blob, with the content of the specified file. + * Creates a new block blob, or updates the content of an existing block blob. Updating an existing block blob + * overwrites any existing metadata on the blob. Partial updates are not supported with this method; the content of + * the existing blob is overwritten with the new content. To perform a partial update of a block blob's, use {@link + * BlockBlobAsyncClient#stageBlock(String, Flux, long) stageBlock} and + * {@link BlockBlobAsyncClient#commitBlockList(List)}, which this method uses internally. For more information, + * see the Azure Docs for Put Block and + * the Azure Docs for Put Block List. + *

+ * The data passed need not support multiple subscriptions/be replayable as is required in other upload methods when + * retries are enabled, and the length of the data need not be known in advance. Therefore, this method should + * support uploading any arbitrary data source, including network streams. This behavior is possible because this + * method will perform some internal buffering as configured by the blockSize and numBuffers parameters, so while + * this method may offer additional convenience, it will not be as performant as other options, which should be + * preferred when possible. + *

+ * Typically, the greater the number of buffers used, the greater the possible parallelism when transferring the + * data. Larger buffers means we will have to stage fewer blocks and therefore require fewer IO operations. The + * trade-offs between these values are context-dependent, so some experimentation may be required to optimize inputs + * for a given scenario. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlockBlobAsyncClient.uploadWithResponse#Flux-int-int-BlobHTTPHeaders-Metadata-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 blockSize The size of each block that will be staged. This value also determines the size that each buffer + * used by this method will be and determines the number of requests that need to be made. The amount of memory + * consumed by this method may be up to blockSize * numBuffers. If block size is large, this method will make fewer + * network calls, but each individual call will send more data and will therefore take longer. + * @param numBuffers The maximum number of buffers this method should allocate. Must be at least two. Typically, the + * larger the number of buffers, the more parallel, and thus faster, the upload portion of this operation will be. + * The amount of memory consumed by this method may be up to blockSize * numBuffers. + * @param headers {@link BlobHTTPHeaders} + * @param metadata {@link Metadata} + * @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, int blockSize, int numBuffers, + BlobHTTPHeaders headers, Metadata metadata, AccessTier tier, BlobAccessConditions accessConditions) { + // TODO: Parallelism parameter? Or let Reactor handle it? + // TODO: Sample/api reference + Objects.requireNonNull(data, "data must not be null"); + BlobAccessConditions accessConditionsFinal = accessConditions == null + ? new BlobAccessConditions() : accessConditions; + + // TODO: Progress reporting. + // See ProgressReporter for an explanation on why this lock is necessary and why we use AtomicLong. + /*AtomicLong totalProgress = new AtomicLong(0); + Lock progressLock = new ReentrantLock();*/ + + // Validation done in the constructor. + UploadBufferPool pool = new UploadBufferPool(numBuffers, blockSize); + + /* + Break the source Flux into chunks that are <= chunk size. This makes filling the pooled buffers much easier + as we can guarantee we only need at most two buffers for any call to write (two in the case of one pool buffer + filling up with more data to write). We use flatMapSequential because we need to guarantee we preserve the + ordering of the buffers, but we don't really care if one is split before another. + */ + Flux chunkedSource = data.flatMapSequential(buffer -> { + if (buffer.remaining() <= blockSize) { + return Flux.just(buffer); + } + int numSplits = (int) Math.ceil(buffer.remaining() / (double) blockSize); + return Flux.range(0, numSplits) + .map(i -> { + ByteBuffer duplicate = buffer.duplicate().asReadOnlyBuffer(); + duplicate.position(i * blockSize); + duplicate.limit(Math.min(duplicate.limit(), (i + 1) * blockSize)); + return duplicate; + }); + }); + + /* + Write to the pool and upload the output. + */ + return chunkedSource.concatMap(pool::write) + .concatWith(Flux.defer(pool::flush)) + .flatMapSequential(buffer -> { + // Report progress as necessary. + /*Flux progressData = ProgressReporter.addParallelProgressReporting(Flux.just(buffer), + optionsReal.progressReceiver(), progressLock, totalProgress);*/ + + final String blockId = Base64.getEncoder().encodeToString( + UUID.randomUUID().toString().getBytes(UTF_8)); + + return this.stageBlockWithResponse(blockId, Flux.just(buffer), buffer.remaining(), + accessConditionsFinal.getLeaseAccessConditions()) + // We only care about the stageBlock insofar as it was successful, but we need to collect the ids. + .map(x -> { + pool.returnBuffer(buffer); + return blockId; + }).flux(); + + }) // TODO: parallelism? + .collect(Collectors.toList()) + .flatMap(ids -> + this.commitBlockListWithResponse(ids, headers, metadata, tier, accessConditions)); + + } + + /** + * Creates a new block blob, or updates the content of an existing block blob, with the content of the specified + * file. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlockBlobAsyncClient.uploadFromFile#String} * * @param filePath Path to the upload file * @return An empty response */ public Mono uploadFromFile(String filePath) { - return this.uploadFromFile(filePath, BLOB_DEFAULT_UPLOAD_BLOCK_SIZE, null, null, null); + return uploadFromFile(filePath, BLOB_DEFAULT_UPLOAD_BLOCK_SIZE, null, null, null, null); } /** - * Creates a new block blob, or updates the content of an existing block blob, with the content of the specified file. + * Creates a new block blob, or updates the content of an existing block blob, with the content of the specified + * file. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlockBlobAsyncClient.uploadFromFile#String-Integer-BlobHTTPHeaders-Metadata-AccessTier-BlobAccessConditions} * * @param filePath Path to the upload file * @param blockSize Size of the blocks to upload * @param headers {@link BlobHTTPHeaders} * @param metadata {@link Metadata} + * @param tier {@link AccessTier} for the destination blob. * @param accessConditions {@link BlobAccessConditions} * @return An empty response * @throws IllegalArgumentException If {@code blockSize} is less than 0 or greater than 100MB * @throws UncheckedIOException If an I/O error occurs */ public Mono uploadFromFile(String filePath, Integer blockSize, BlobHTTPHeaders headers, Metadata metadata, - BlobAccessConditions accessConditions) { + AccessTier tier, BlobAccessConditions accessConditions) { if (blockSize < 0 || blockSize > BLOB_MAX_UPLOAD_BLOCK_SIZE) { - throw new IllegalArgumentException("Block size should not exceed 100MB"); + throw logger.logExceptionAsError(new IllegalArgumentException("Block size should not exceed 100MB")); } return Mono.using(() -> uploadFileResourceSupplier(filePath), channel -> { final SortedMap blockIds = new TreeMap<>(); return Flux.fromIterable(sliceFile(filePath, blockSize)) - .doOnNext(chunk -> blockIds.put(chunk.offset(), getBlockID())) + .doOnNext(chunk -> blockIds.put(chunk.getOffset(), getBlockID())) .flatMap(chunk -> { - String blockId = blockIds.get(chunk.offset()); - return stageBlock(blockId, FluxUtil.byteBufStreamFromFile(channel, chunk.offset(), chunk.count()), chunk.count(), null); + String blockId = blockIds.get(chunk.getOffset()); + return stageBlockWithResponse(blockId, FluxUtil.readFile(channel, chunk.getOffset(), + chunk.getCount()), chunk.getCount(), null); }) - .then(Mono.defer(() -> commitBlockList(new ArrayList<>(blockIds.values()), headers, metadata, accessConditions))) + .then(Mono.defer(() -> commitBlockListWithResponse( + new ArrayList<>(blockIds.values()), headers, metadata, tier, accessConditions))) .then() .doOnTerminate(() -> { try { channel.close(); } catch (IOException e) { - throw new UncheckedIOException(e); + throw logger.logExceptionAsError(new UncheckedIOException(e)); } }); }, this::uploadFileCleanup); } + private AsynchronousFileChannel uploadFileResourceSupplier(String filePath) { try { return AsynchronousFileChannel.open(Paths.get(filePath), StandardOpenOption.READ); } catch (IOException e) { - throw new UncheckedIOException(e); + throw logger.logExceptionAsError(new UncheckedIOException(e)); } } @@ -219,7 +390,7 @@ private void uploadFileCleanup(AsynchronousFileChannel channel) { try { channel.close(); } catch (IOException e) { - throw new UncheckedIOException(e); + throw logger.logExceptionAsError(new UncheckedIOException(e)); } } @@ -250,24 +421,22 @@ private List sliceFile(String path, Integer blockSize) { * Azure Docs. *

* Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. + * @code Flux} must produce the same data each time it is subscribed to. + * + *

Code Samples

* - * @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. - * @param data - * The data to write to the block. Note that this {@code Flux} must be replayable if retries are enabled - * (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}. - * - * @return - * A reactive response signalling completion. + * {@codesnippet com.azure.storage.blob.BlockBlobAsyncClient.stageBlock#String-Flux-long} + * + * @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. + * @param data The data to write to the block. Note that this {@code Flux} must be replayable if retries are enabled + * (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}. + * @return A reactive response signalling completion. */ - public Mono stageBlock(String base64BlockID, Flux data, - long length) { - return this.stageBlock(base64BlockID, data, length, null); + public Mono stageBlock(String base64BlockID, Flux data, long length) { + return stageBlockWithResponse(base64BlockID, data, length, null).flatMap(FluxUtil::toMono); } /** @@ -278,90 +447,95 @@ public Mono stageBlock(String base64BlockID, Flux data, * Note that the data passed must be replayable if retries are enabled (the default). In other words, the * {@code Flux} must produce the same data each time it is subscribed to. * - * @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. - * @param data - * The data to write to the block. Note that this {@code Flux} must be replayable if retries are enabled - * (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 leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * - * @return - * A reactive response signalling completion. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlockBlobAsyncClient.stageBlockWithResponse#String-Flux-long-LeaseAccessConditions} + * + * @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. + * @param data The data to write to the block. Note that this {@code Flux} must be replayable if retries are enabled + * (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 leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does + * not match the active lease on the blob. + * @return A reactive response signalling completion. */ - public Mono stageBlock(String base64BlockID, Flux data, long length, - LeaseAccessConditions leaseAccessConditions) { + public Mono stageBlockWithResponse(String base64BlockID, Flux data, long length, + LeaseAccessConditions leaseAccessConditions) { + return withContext(context -> stageBlockWithResponse(base64BlockID, data, length, leaseAccessConditions, + context)); + } + + Mono stageBlockWithResponse(String base64BlockID, Flux data, long length, + LeaseAccessConditions leaseAccessConditions, Context context) { return postProcessResponse(this.azureBlobStorage.blockBlobs().stageBlockWithRestResponseAsync(null, - null, base64BlockID, length, data, null, null, null, - null, null, null, leaseAccessConditions, Context.NONE)) + null, base64BlockID, length, data, null, null, null, null, leaseAccessConditions, cpk, context)) .map(VoidResponse::new); } /** * Creates a new block to be committed as part of a blob where the contents are read from a URL. For more - * information, see the Azure Docs. - * - * @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. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can be - * authenticated via Shared Key. However, if the source is a blob in another account, the source blob must - * either be public or must be authenticated via a shared access signature. If the source blob is public, no - * authentication is required to perform the operation. - * @param sourceRange - * {@link BlobRange} - * - * @return - * A reactive response signalling completion. + * information, see the Azure + * Docs. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.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. + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage + * account can be authenticated via Shared Key. However, if the source is a blob in another account, the source blob + * must either be public or must be authenticated via a shared access signature. If the source blob is public, no + * authentication is required to perform the operation. + * @param sourceRange {@link BlobRange} + * @return A reactive response signalling completion. */ - public Mono stageBlockFromURL(String base64BlockID, URL sourceURL, - BlobRange sourceRange) { - return this.stageBlockFromURL(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); } /** * Creates a new block to be committed as part of a blob where the contents are read from a URL. For more - * information, see the Azure Docs. - * - * @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. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can - * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob - * must either be public or must be authenticated via a shared access signature. If the source blob is - * public, no authentication is required to perform the operation. - * @param sourceRange - * {@link BlobRange} - * @param sourceContentMD5 - * An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 - * of the received data and fail the request if it does not match the provided MD5. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param sourceModifiedAccessConditions - * {@link SourceModifiedAccessConditions} - * - * @return - * A reactive response signalling completion. + * information, see the Azure + * Docs. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.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. + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage + * account can be authenticated via Shared Key. However, if the source is a blob in another account, the source blob + * must either be public or must be authenticated via a shared access signature. If the source blob is public, no + * authentication is required to perform the operation. + * @param sourceRange {@link BlobRange} + * @param sourceContentMD5 An MD5 hash of the block content from the source blob. If specified, the service will + * calculate the MD5 of the received data and fail the request if it does not match the provided MD5. + * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does + * not match the active lease on the blob. + * @param sourceModifiedAccessConditions {@link SourceModifiedAccessConditions} + * @return A reactive response signalling completion. */ - public Mono stageBlockFromURL(String base64BlockID, URL sourceURL, - BlobRange sourceRange, byte[] sourceContentMD5, LeaseAccessConditions leaseAccessConditions, - SourceModifiedAccessConditions sourceModifiedAccessConditions) { + public Mono stageBlockFromURLWithResponse(String base64BlockID, URL sourceURL, + BlobRange sourceRange, byte[] sourceContentMD5, LeaseAccessConditions leaseAccessConditions, + SourceModifiedAccessConditions sourceModifiedAccessConditions) { + return withContext(context -> stageBlockFromURLWithResponse(base64BlockID, sourceURL, sourceRange, + sourceContentMD5, leaseAccessConditions, sourceModifiedAccessConditions)); + } + + 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, - base64BlockID, 0, sourceURL, sourceRange.toHeaderValue(), sourceContentMD5, null, - null, null, null, null, - leaseAccessConditions, sourceModifiedAccessConditions, Context.NONE)) + base64BlockID, 0, sourceURL, sourceRange.toHeaderValue(), sourceContentMD5, null, null, + null, cpk, leaseAccessConditions, sourceModifiedAccessConditions, context)) .map(VoidResponse::new); } @@ -370,95 +544,100 @@ public Mono stageBlockFromURL(String base64BlockID, URL sourceURL, * For more information, see the * Azure Docs. * - * @param listType - * Specifies which type of blocks to return. + *

Code Samples

* - * @return - * A reactive response containing the list of blocks. + * {@codesnippet com.azure.storage.blob.BlockBlobAsyncClient.listBlocks#BlockListType} + * + * @param listType Specifies which type of blocks to return. + * @return A reactive response containing the list of blocks. */ - public Flux listBlocks(BlockListType listType) { - return this.listBlocks(listType, null); + public Mono listBlocks(BlockListType listType) { + return this.listBlocksWithResponse(listType, null).map(Response::getValue); } /** - * * Returns the list of blocks that have been uploaded as part of a block blob using the specified block list filter. * For more information, see the * Azure Docs. * - * @param listType - * Specifies which type of blocks to return. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. + *

Code Samples

* - * @return - * A reactive response containing the list of blocks. + * {@codesnippet com.azure.storage.blob.BlockBlobAsyncClient.listBlocksWithResponse#BlockListType-LeaseAccessConditions} + * + * @param listType Specifies which type of blocks to return. + * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does + * not match the active lease on the blob. + * @return A reactive response containing the list of blocks. */ - public Flux listBlocks(BlockListType listType, - LeaseAccessConditions leaseAccessConditions) { - return postProcessResponse(this.azureBlobStorage.blockBlobs().getBlockListWithRestResponseAsync( - null, null, listType, snapshot, null, null, null, - leaseAccessConditions, Context.NONE)) - .map(ResponseBase::value) - .flatMapMany(bl -> { - Flux committed = Flux.fromIterable(bl.committedBlocks()) - .map(block -> new BlockItem(block, true)); - Flux uncommitted = Flux.fromIterable(bl.uncommittedBlocks()) - .map(block -> new BlockItem(block, false)); - return Flux.concat(committed, uncommitted); - }); + public Mono> listBlocksWithResponse(BlockListType listType, + LeaseAccessConditions leaseAccessConditions) { + + return withContext(context -> listBlocksWithResponse(listType, leaseAccessConditions, context)); + } + + Mono> listBlocksWithResponse(BlockListType listType, + LeaseAccessConditions leaseAccessConditions, Context context) { + + return postProcessResponse(this.azureBlobStorage.blockBlobs().getBlockListWithRestResponseAsync(null, + null, listType, snapshot, null, null, leaseAccessConditions, context)) + .map(response -> new SimpleResponse<>(response, response.getValue())); } /** - * Writes a blob by specifying the list of block IDs that are to make up the blob. - * In order to be written as part of a blob, a block must have been successfully written - * to the server in a prior stageBlock operation. You can call commitBlockList to update a blob - * by uploading only those blocks that have changed, then committing the new and existing - * blocks together. Any blocks not specified in the block list and permanently deleted. - * For more information, see the + * Writes a blob by specifying the list of block IDs that are to make up the blob. In order to be written as part of + * a blob, a block must have been successfully written to the server in a prior stageBlock operation. You can call + * commitBlockList to update a blob by uploading only those blocks that have changed, then committing the new and + * existing blocks together. Any blocks not specified in the block list and permanently deleted. For more + * information, see the * Azure Docs. * - * @param base64BlockIDs - * A list of base64 encode {@code String}s that specifies the block IDs to be committed. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlockBlobAsyncClient.commitBlockList#List} * - * @return - * A reactive response containing the information of the block blob. + * @param base64BlockIDs A list of base64 encode {@code String}s that specifies the block IDs to be committed. + * @return A reactive response containing the information of the block blob. */ - public Mono> commitBlockList(List base64BlockIDs) { - return this.commitBlockList(base64BlockIDs, null, null, null); + public Mono commitBlockList(List base64BlockIDs) { + return commitBlockListWithResponse(base64BlockIDs, null, null, null, null).flatMap(FluxUtil::toMono); } /** - * Writes a blob by specifying the list of block IDs that are to make up the blob. - * In order to be written as part of a blob, a block must have been successfully written - * to the server in a prior stageBlock operation. You can call commitBlockList to update a blob - * by uploading only those blocks that have changed, then committing the new and existing - * blocks together. Any blocks not specified in the block list and permanently deleted. - * For more information, see the + * Writes a blob by specifying the list of block IDs that are to make up the blob. In order to be written as part of + * a blob, a block must have been successfully written to the server in a prior stageBlock operation. You can call + * commitBlockList to update a blob by uploading only those blocks that have changed, then committing the new and + * existing blocks together. Any blocks not specified in the block list and permanently deleted. For more + * information, see the * Azure Docs. * - * @param base64BlockIDs - * A list of base64 encode {@code String}s that specifies the block IDs to be committed. - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * - * @return - * A reactive response containing the information of the block blob. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlockBlobAsyncClient.commitBlockListWithResponse#List-BlobHTTPHeaders-Metadata-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 metadata {@link Metadata} + * @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> commitBlockList(List base64BlockIDs, - BlobHTTPHeaders headers, Metadata metadata, BlobAccessConditions accessConditions) { + public Mono> commitBlockListWithResponse(List base64BlockIDs, + BlobHTTPHeaders headers, Metadata metadata, AccessTier tier, BlobAccessConditions accessConditions) { + return withContext(context -> commitBlockListWithResponse(base64BlockIDs, headers, metadata, tier, + accessConditions, context)); + } + + Mono> commitBlockListWithResponse(List base64BlockIDs, + BlobHTTPHeaders headers, Metadata metadata, AccessTier tier, BlobAccessConditions accessConditions, + Context context) { metadata = metadata == null ? new Metadata() : metadata; accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; + AccessTierOptional tierOp = tier == null ? null : AccessTierOptional.fromString(tier.toString()); return postProcessResponse(this.azureBlobStorage.blockBlobs().commitBlockListWithRestResponseAsync( - null, null, new BlockLookupList().latest(base64BlockIDs), null, metadata, - null, null, null, null, headers, - accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, new BlockBlobItem(rb.deserializedHeaders()))); + null, null, new BlockLookupList().setLatest(base64BlockIDs), null, null, null, metadata, tierOp, null, + headers, accessConditions.getLeaseAccessConditions(), cpk, accessConditions.getModifiedAccessConditions(), + context)) + .map(rb -> new SimpleResponse<>(rb, new BlockBlobItem(rb.getDeserializedHeaders()))); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlockBlobClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlockBlobClient.java index 5e2f7dbd346c..9b9b73c55090 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlockBlobClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlockBlobClient.java @@ -3,20 +3,22 @@ package com.azure.storage.blob; +import com.azure.core.exception.UnexpectedLengthException; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.VoidResponse; +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.BlobRange; import com.azure.storage.blob.models.BlockBlobItem; -import com.azure.storage.blob.models.BlockItem; +import com.azure.storage.blob.models.BlockList; import com.azure.storage.blob.models.BlockListType; import com.azure.storage.blob.models.LeaseAccessConditions; import com.azure.storage.blob.models.Metadata; import com.azure.storage.blob.models.SourceModifiedAccessConditions; +import com.azure.storage.blob.models.StorageException; import com.azure.storage.common.Utility; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; @@ -25,23 +27,24 @@ import java.io.InputStream; import java.io.UncheckedIOException; import java.net.URL; +import java.nio.ByteBuffer; import java.time.Duration; import java.util.List; +import java.util.Objects; /** - * Client to a block blob. It may only be instantiated through a {@link BlobClientBuilder}, via - * the method {@link BlobClient#asBlockBlobClient()}, or via the method - * {@link ContainerClient#getBlockBlobClient(String)}. This class does not hold - * any state about a particular blob, but is instead a convenient way of sending appropriate - * requests to the resource on the service. + * Client to a block blob. It may only be instantiated through a {@link BlobClientBuilder}, via the method {@link + * BlobClient#asBlockBlobClient()}, or via the method {@link ContainerClient#getBlockBlobClient(String)}. This class + * does not hold any state about a particular blob, but is instead a convenient way of sending appropriate requests to + * the resource on the service. * *

- * This client contains operations on a blob. Operations on a container are available on {@link ContainerClient}, - * and operations on the service are available on {@link BlobServiceClient}. + * This client contains operations on a blob. Operations on a container are available on {@link ContainerClient}, and + * operations on the service are available on {@link BlobServiceClient}. * *

- * Please refer to the Azure Docs - * for more information. + * Please refer to the Azure + * Docs for more information. */ public final class BlockBlobClient extends BlobClient { private final BlockBlobAsyncClient blockBlobAsyncClient; @@ -63,6 +66,7 @@ public final class BlockBlobClient extends BlobClient { /** * Package-private constructor for use by {@link BlobClientBuilder}. + * * @param blockBlobAsyncClient the async block blob client */ BlockBlobClient(BlockBlobAsyncClient blockBlobAsyncClient) { @@ -71,98 +75,84 @@ public final class BlockBlobClient extends BlobClient { } /** - * Creates and opens an output stream to write data to the block blob. If the blob already exists on the service, - * it will be overwritten. + * Creates and opens an output stream to write data to the block blob. If the blob already exists on the service, it + * will be overwritten. * * @return A {@link BlobOutputStream} object used to write data to the blob. - * - * @throws StorageException - * If a storage service error occurred. + * @throws StorageException If a storage service error occurred. */ public BlobOutputStream getBlobOutputStream() { return getBlobOutputStream(null); } /** - * Creates and opens an output stream to write data to the block blob. If the blob already exists on the service, - * it will be overwritten. - * - * @param accessConditions - * A {@link BlobAccessConditions} object that represents the access conditions for the blob. + * Creates and opens an output stream to write data to the block blob. If the blob already exists on the service, it + * will be overwritten. * + * @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. + * @throws StorageException If a storage service error occurred. */ public BlobOutputStream getBlobOutputStream(BlobAccessConditions accessConditions) { - return new BlobOutputStream(blockBlobAsyncClient, accessConditions); + return BlobOutputStream.blockBlobOutputStream(blockBlobAsyncClient, accessConditions); } /** - * Creates a new block blob, or updates the content of an existing block blob. - * Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not - * supported with PutBlob; the content of the existing blob is overwritten with the new content. To - * perform a partial update of a block blob's, use PutBlock and PutBlockList. - * For more information, see the + * Creates a new block blob, or updates the content of an existing block blob. Updating an existing block blob + * overwrites any existing metadata on the blob. Partial updates are not supported with PutBlob; the content of the + * existing blob is overwritten with the new content. To perform a partial update of a block blob's, use PutBlock + * and PutBlockList. For more information, see the * Azure Docs. * - * @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}. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlockBlobClient.upload#InputStream-long} * - * @return - * The information of the uploaded block blob. + * @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}. + * @return The information of the uploaded block blob. * @throws IOException If an I/O error occurs */ - public Response upload(InputStream data, long length) throws IOException { - return this.upload(data, length, null, null, null, null); + public BlockBlobItem upload(InputStream data, long length) throws IOException { + return uploadWithResponse(data, length, null, null, null, null, null, Context.NONE).getValue(); } /** - * Creates a new block blob, or updates the content of an existing block blob. - * Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not - * supported with PutBlob; the content of the existing blob is overwritten with the new content. To - * perform a partial update of a block blob's, use PutBlock and PutBlockList. - * For more information, see the + * Creates a new block blob, or updates the content of an existing block blob. Updating an existing block blob + * overwrites any existing metadata on the blob. Partial updates are not supported with PutBlob; the content of the + * existing blob is overwritten with the new content. To perform a partial update of a block blob's, use PutBlock + * and PutBlockList. For more information, see the * Azure Docs. * - * @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 metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The information of the uploaded block blob. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlockBlobClient.uploadWithResponse#InputStream-long-BlobHTTPHeaders-Metadata-AccessTier-BlobAccessConditions-Duration-Context} + * + * @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 metadata {@link Metadata} + * @param tier {@link AccessTier} for the destination 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 uploaded block blob. + * @throws UnexpectedLengthException when the length of data does not match the input {@code length}. + * @throws NullPointerException if the input data is null. * @throws IOException If an I/O error occurs */ - public Response upload(InputStream data, long length, BlobHTTPHeaders headers, - Metadata metadata, BlobAccessConditions accessConditions, Duration timeout) throws IOException { - Flux fbb = Flux.range(0, (int) Math.ceil((double) length / (double) BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE)) - .map(i -> i * BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE) - .concatMap(pos -> Mono.fromCallable(() -> { - long count = pos + BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE > length ? length - pos : BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE; - byte[] cache = new byte[(int) count]; - int read = 0; - while (read < count) { - read += data.read(cache, read, (int) count - read); - } - return ByteBufAllocator.DEFAULT.buffer((int) count).writeBytes(cache); - })); - + public Response uploadWithResponse(InputStream data, long length, BlobHTTPHeaders headers, + Metadata metadata, AccessTier tier, BlobAccessConditions accessConditions, Duration timeout, + Context context) throws IOException { + Objects.requireNonNull(data); + Flux fbb = Utility.convertStreamToByteBuffer(data, length, + BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE); Mono> upload = blockBlobAsyncClient - .upload(fbb.subscribeOn(Schedulers.elastic()), length, headers, metadata, accessConditions); + .uploadWithResponse(fbb.subscribeOn(Schedulers.elastic()), length, headers, metadata, tier, + accessConditions, context); try { return Utility.blockWithOptionalTimeout(upload, timeout); @@ -174,26 +164,36 @@ public Response upload(InputStream data, long length, BlobHTTPHea /** * Creates a new block blob, or updates the content of an existing block blob. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlockBlobClient.uploadFromFile#String} + * * @param filePath Path of the file to upload * @throws IOException If an I/O error occurs */ public void uploadFromFile(String filePath) throws IOException { - this.uploadFromFile(filePath, null, null, null, null); + uploadFromFile(filePath, null, null, null, null, null); } /** * Creates a new block blob, or updates the content of an existing block blob. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlockBlobClient.uploadFromFile#String-BlobHTTPHeaders-Metadata-AccessTier-BlobAccessConditions-Duration} + * * @param filePath Path of the file to upload * @param headers {@link BlobHTTPHeaders} * @param metadata {@link Metadata} + * @param tier {@link AccessTier} for the uploaded blob * @param accessConditions {@link BlobAccessConditions} * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @throws IOException If an I/O error occurs */ - public void uploadFromFile(String filePath, BlobHTTPHeaders headers, Metadata metadata, - BlobAccessConditions accessConditions, Duration timeout) throws IOException { - Mono upload = this.blockBlobAsyncClient.uploadFromFile(filePath, BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE, headers, metadata, accessConditions); + public void uploadFromFile(String filePath, BlobHTTPHeaders headers, Metadata metadata, AccessTier tier, + BlobAccessConditions accessConditions, Duration timeout) throws IOException { + Mono upload = this.blockBlobAsyncClient.uploadFromFile( + filePath, BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE, headers, metadata, tier, accessConditions); try { Utility.blockWithOptionalTimeout(upload, timeout); @@ -207,18 +207,18 @@ public void uploadFromFile(String filePath, BlobHTTPHeaders headers, Metadata me * commitBlockList. For more information, see the * Azure Docs. * - * @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. - * @param data - * The data to write to the block. - * @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}. - * @return A response containing status code and HTTP headers + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlockBlobClient.stageBlock#String-InputStream-long} + * + * @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. + * @param data The data to write to the block. + * @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}. */ - public VoidResponse stageBlock(String base64BlockID, InputStream data, long length) { - return this.stageBlock(base64BlockID, data, length, null, null); + public void stageBlock(String base64BlockID, InputStream data, long length) { + stageBlockWithResponse(base64BlockID, data, length, null, null, Context.NONE); } /** @@ -226,93 +226,85 @@ public VoidResponse stageBlock(String base64BlockID, InputStream data, long leng * commitBlockList. For more information, see the * Azure Docs. * - * @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. - * @param data - * The data to write to the block. - * @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 leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlockBlobClient.stageBlockWithResponse#String-InputStream-long-LeaseAccessConditions-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. + * @param data The data to write to the block. + * @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 leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does + * not match the active lease on the blob. + * @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 + * @throws UnexpectedLengthException when the length of data does not match the input {@code length}. + * @throws NullPointerException if the input data is null. */ - public VoidResponse stageBlock(String base64BlockID, InputStream data, long length, - LeaseAccessConditions leaseAccessConditions, Duration timeout) { - - Flux fbb = Flux.range(0, (int) Math.ceil((double) length / (double) BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE)) - .map(i -> i * BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE) - .concatMap(pos -> Mono.fromCallable(() -> { - long count = pos + BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE > length ? length - pos : BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE; - byte[] cache = new byte[(int) count]; - int read = 0; - while (read < count) { - read += data.read(cache, read, (int) count - read); - } - return ByteBufAllocator.DEFAULT.buffer((int) count).writeBytes(cache); - })); + public VoidResponse stageBlockWithResponse(String base64BlockID, InputStream data, long length, + LeaseAccessConditions leaseAccessConditions, Duration timeout, Context context) { + Objects.requireNonNull(data); + Flux fbb = Utility.convertStreamToByteBuffer(data, length, + BlockBlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE); - Mono response = blockBlobAsyncClient.stageBlock(base64BlockID, - fbb.subscribeOn(Schedulers.elastic()), length, leaseAccessConditions); + Mono response = blockBlobAsyncClient.stageBlockWithResponse(base64BlockID, + fbb.subscribeOn(Schedulers.elastic()), length, leaseAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } /** * Creates a new block to be committed as part of a blob where the contents are read from a URL. For more - * information, see the Azure Docs. - * - * @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. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can be - * authenticated via Shared Key. However, if the source is a blob in another account, the source blob must - * either be public or must be authenticated via a shared access signature. If the source blob is public, no - * authentication is required to perform the operation. - * @param sourceRange - * {@link BlobRange} - * @return A response containing status code and HTTP headers + * information, see the Azure + * Docs. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.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. + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage + * account can be authenticated via Shared Key. However, if the source is a blob in another account, the source blob + * must either be public or must be authenticated via a shared access signature. If the source blob is public, no + * authentication is required to perform the operation. + * @param sourceRange {@link BlobRange} */ - public VoidResponse stageBlockFromURL(String base64BlockID, URL sourceURL, - BlobRange sourceRange) { - return this.stageBlockFromURL(base64BlockID, sourceURL, sourceRange, null, - null, null, null); + public void stageBlockFromURL(String base64BlockID, URL sourceURL, BlobRange sourceRange) { + stageBlockFromURLWithResponse(base64BlockID, sourceURL, sourceRange, null, null, null, null, Context.NONE); } /** * Creates a new block to be committed as part of a blob where the contents are read from a URL. For more - * information, see the Azure Docs. - * - * @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. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can - * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob - * must either be public or must be authenticated via a shared access signature. If the source blob is - * public, no authentication is required to perform the operation. - * @param sourceRange - * {@link BlobRange} - * @param sourceContentMD5 - * An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 - * of the received data and fail the request if it does not match the provided MD5. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param sourceModifiedAccessConditions - * {@link SourceModifiedAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. + * information, see the Azure + * Docs. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.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. + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage + * account can be authenticated via Shared Key. However, if the source is a blob in another account, the source blob + * must either be public or must be authenticated via a shared access signature. If the source blob is public, no + * authentication is required to perform the operation. + * @param sourceRange {@link BlobRange} + * @param sourceContentMD5 An MD5 hash of the block content from the source blob. If specified, the service will + * calculate the MD5 of the received data and fail the request if it does not match the provided MD5. + * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does + * not match the active lease on the blob. + * @param sourceModifiedAccessConditions {@link SourceModifiedAccessConditions} + * @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 VoidResponse stageBlockFromURL(String base64BlockID, URL sourceURL, - BlobRange sourceRange, byte[] sourceContentMD5, LeaseAccessConditions leaseAccessConditions, - SourceModifiedAccessConditions sourceModifiedAccessConditions, Duration timeout) { - Mono response = blockBlobAsyncClient.stageBlockFromURL(base64BlockID, sourceURL, sourceRange, sourceContentMD5, leaseAccessConditions, sourceModifiedAccessConditions); + public VoidResponse stageBlockFromURLWithResponse(String base64BlockID, URL sourceURL, BlobRange sourceRange, + byte[] sourceContentMD5, LeaseAccessConditions leaseAccessConditions, + SourceModifiedAccessConditions sourceModifiedAccessConditions, Duration timeout, Context context) { + Mono response = blockBlobAsyncClient.stageBlockFromURLWithResponse(base64BlockID, sourceURL, + sourceRange, sourceContentMD5, leaseAccessConditions, sourceModifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -321,85 +313,86 @@ public VoidResponse stageBlockFromURL(String base64BlockID, URL sourceURL, * For more information, see the * Azure Docs. * - * @param listType - * Specifies which type of blocks to return. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlockBlobClient.listBlocks#BlockListType} * - * @return - * The list of blocks. + * @param listType Specifies which type of blocks to return. + * @return The list of blocks. */ - public Iterable listBlocks(BlockListType listType) { - return this.listBlocks(listType, null, null); + public BlockList listBlocks(BlockListType listType) { + return this.listBlocksWithResponse(listType, null, null, Context.NONE).getValue(); } /** - * * Returns the list of blocks that have been uploaded as part of a block blob using the specified block list filter. * For more information, see the * Azure Docs. * - * @param listType - * Specifies which type of blocks to return. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. + *

Code Samples

* - * @return - * The list of blocks. + * {@codesnippet com.azure.storage.blob.BlockBlobClient.listBlocksWithResponse#BlockListType-LeaseAccessConditions-Duration-Context} + * + * @param listType Specifies which type of blocks to return. + * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does + * not match the active lease on the blob. + * @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 list of blocks. */ - public Iterable listBlocks(BlockListType listType, - LeaseAccessConditions leaseAccessConditions, Duration timeout) { - Flux response = blockBlobAsyncClient.listBlocks(listType, leaseAccessConditions); + public Response listBlocksWithResponse(BlockListType listType, + LeaseAccessConditions leaseAccessConditions, Duration timeout, Context context) { + Mono> response = blockBlobAsyncClient.listBlocksWithResponse(listType, + leaseAccessConditions, context); - return timeout == null ? response.toIterable() : response.timeout(timeout).toIterable(); + return Utility.blockWithOptionalTimeout(response, timeout); } /** - * Writes a blob by specifying the list of block IDs that are to make up the blob. - * In order to be written as part of a blob, a block must have been successfully written - * to the server in a prior stageBlock operation. You can call commitBlockList to update a blob - * by uploading only those blocks that have changed, then committing the new and existing - * blocks together. Any blocks not specified in the block list and permanently deleted. - * For more information, see the + * Writes a blob by specifying the list of block IDs that are to make up the blob. In order to be written as part of + * a blob, a block must have been successfully written to the server in a prior stageBlock operation. You can call + * commitBlockList to update a blob by uploading only those blocks that have changed, then committing the new and + * existing blocks together. Any blocks not specified in the block list and permanently deleted. For more + * information, see the * Azure Docs. * - * @param base64BlockIDs - * A list of base64 encode {@code String}s that specifies the block IDs to be committed. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlockBlobClient.commitBlockList#List} * - * @return - * The information of the block blob. + * @param base64BlockIDs A list of base64 encode {@code String}s that specifies the block IDs to be committed. + * @return The information of the block blob. */ - public Response commitBlockList(List base64BlockIDs) { - return this.commitBlockList(base64BlockIDs, null, null, null, null); + public BlockBlobItem commitBlockList(List base64BlockIDs) { + return commitBlockListWithResponse(base64BlockIDs, null, null, null, null, null, Context.NONE).getValue(); } /** - * Writes a blob by specifying the list of block IDs that are to make up the blob. - * In order to be written as part of a blob, a block must have been successfully written - * to the server in a prior stageBlock operation. You can call commitBlockList to update a blob - * by uploading only those blocks that have changed, then committing the new and existing - * blocks together. Any blocks not specified in the block list and permanently deleted. - * For more information, see the + * Writes a blob by specifying the list of block IDs that are to make up the blob. In order to be written as part of + * a blob, a block must have been successfully written to the server in a prior stageBlock operation. You can call + * commitBlockList to update a blob by uploading only those blocks that have changed, then committing the new and + * existing blocks together. Any blocks not specified in the block list and permanently deleted. For more + * information, see the * Azure Docs. * - * @param base64BlockIDs - * A list of base64 encode {@code String}s that specifies the block IDs to be committed. - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The information of the block blob. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.BlockBlobClient.commitBlockListWithResponse#List-BlobHTTPHeaders-Metadata-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 metadata {@link Metadata} + * @param tier {@link AccessTier} for the destination 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 block blob. */ - public Response commitBlockList(List base64BlockIDs, - BlobHTTPHeaders headers, Metadata metadata, BlobAccessConditions accessConditions, Duration timeout) { - Mono> response = blockBlobAsyncClient.commitBlockList(base64BlockIDs, headers, metadata, accessConditions); + public Response commitBlockListWithResponse(List base64BlockIDs, + BlobHTTPHeaders headers, Metadata metadata, AccessTier tier, BlobAccessConditions accessConditions, + Duration timeout, Context context) { + Mono> response = blockBlobAsyncClient.commitBlockListWithResponse( + base64BlockIDs, headers, metadata, tier, accessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java index 99b1524507bf..dbdd63287ba2 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java @@ -3,21 +3,25 @@ package com.azure.storage.blob; +import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.implementation.http.PagedResponseBase; +import com.azure.core.implementation.util.FluxUtil; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.BlobFlatListSegment; -import com.azure.storage.blob.models.BlobHierarchyListSegment; import com.azure.storage.blob.models.BlobItem; -import com.azure.storage.blob.models.BlobPrefix; import com.azure.storage.blob.models.ContainerAccessConditions; import com.azure.storage.blob.models.ContainerAccessPolicies; import com.azure.storage.blob.models.ContainersListBlobFlatSegmentResponse; import com.azure.storage.blob.models.ContainersListBlobHierarchySegmentResponse; +import com.azure.storage.blob.models.CpkInfo; import com.azure.storage.blob.models.LeaseAccessConditions; import com.azure.storage.blob.models.ListBlobsOptions; import com.azure.storage.blob.models.Metadata; @@ -25,13 +29,13 @@ 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.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 java.net.MalformedURLException; @@ -39,15 +43,20 @@ import java.time.Duration; import java.time.OffsetDateTime; import java.time.temporal.ChronoUnit; +import java.util.ArrayList; import java.util.List; +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.PostProcessor.postProcessResponse; /** * Client to a container. It may only be instantiated through a {@link ContainerClientBuilder} or via the method {@link - * BlobServiceAsyncClient#getContainerAsyncClient(String)}. This class does not hold any state about a particular blob but - * is instead a convenient way of sending off appropriate requests to the resource on the service. It may also be used - * to construct URLs to blobs. + * BlobServiceAsyncClient#getContainerAsyncClient(String)}. This class does not hold any state about a particular blob + * but is instead a convenient way of sending off appropriate requests to the resource on the service. It may also be + * used to construct URLs to blobs. * *

* This client contains operations on a container. Operations on a blob are available on {@link BlobAsyncClient} through @@ -70,15 +79,18 @@ public final class ContainerAsyncClient { public static final String LOG_CONTAINER_NAME = "$logs"; + private final ClientLogger logger = new ClientLogger(ContainerAsyncClient.class); private final AzureBlobStorageImpl azureBlobStorage; + private final CpkInfo cpk; // only used to pass down to blob clients /** * Package-private constructor for use by {@link ContainerClientBuilder}. * * @param azureBlobStorage the API client for blob storage */ - ContainerAsyncClient(AzureBlobStorageImpl azureBlobStorage) { + ContainerAsyncClient(AzureBlobStorageImpl azureBlobStorage, CpkInfo cpk) { this.azureBlobStorage = azureBlobStorage; + this.cpk = cpk; } /** @@ -88,6 +100,10 @@ public final class ContainerAsyncClient { * method passing in the desired pipeline object. Or, call this package's NewBlockBlobAsyncClient instead of calling * this object's NewBlockBlobAsyncClient method. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.getBlobAsyncClient#String} + * * @param blobName A {@code String} representing the name of the blob. * @return A new {@link BlockBlobAsyncClient} object which references the blob with the specified name in this * container. @@ -103,6 +119,10 @@ public BlockBlobAsyncClient getBlockBlobAsyncClient(String blobName) { * method passing in the desired pipeline object. Or, call this package's NewBlockBlobAsyncClient instead of calling * this object's NewBlockBlobAsyncClient method. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.getBlobAsyncClient#String-String} + * * @param blobName A {@code String} representing the name of the blob. * @param snapshot the snapshot identifier for the blob. * @return A new {@link BlockBlobAsyncClient} object which references the blob with the specified name in this @@ -112,7 +132,7 @@ public BlockBlobAsyncClient getBlockBlobAsyncClient(String blobName, String snap return new BlockBlobAsyncClient(new AzureBlobStorageBuilder() .url(Utility.appendToURLPath(getContainerUrl(), blobName).toString()) .pipeline(azureBlobStorage.getHttpPipeline()) - .build(), snapshot); + .build(), snapshot, cpk); } /** @@ -122,6 +142,10 @@ public BlockBlobAsyncClient getBlockBlobAsyncClient(String blobName, String snap * object. Or, call this package's NewPageBlobAsyncClient instead of calling this object's NewPageBlobAsyncClient * method. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.getPageBlobAsyncClient#String} + * * @param blobName A {@code String} representing the name of the blob. * @return A new {@link PageBlobAsyncClient} object which references the blob with the specified name in this * container. @@ -137,6 +161,10 @@ public PageBlobAsyncClient getPageBlobAsyncClient(String blobName) { * object. Or, call this package's NewPageBlobAsyncClient instead of calling this object's NewPageBlobAsyncClient * method. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.getPageBlobAsyncClient#String-String} + * * @param blobName A {@code String} representing the name of the blob. * @param snapshot the snapshot identifier for the blob. * @return A new {@link PageBlobAsyncClient} object which references the blob with the specified name in this @@ -146,7 +174,7 @@ public PageBlobAsyncClient getPageBlobAsyncClient(String blobName, String snapsh return new PageBlobAsyncClient(new AzureBlobStorageBuilder() .url(Utility.appendToURLPath(getContainerUrl(), blobName).toString()) .pipeline(azureBlobStorage.getHttpPipeline()) - .build(), snapshot); + .build(), snapshot, cpk); } /** @@ -156,6 +184,10 @@ public PageBlobAsyncClient getPageBlobAsyncClient(String blobName, String snapsh * pipeline object. Or, call this package's NewAppendBlobAsyncClient instead of calling this object's * NewAppendBlobAsyncClient method. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.getAppendBlobAsyncClient#String} + * * @param blobName A {@code String} representing the name of the blob. * @return A new {@link AppendBlobAsyncClient} object which references the blob with the specified name in this * container. @@ -171,6 +203,10 @@ public AppendBlobAsyncClient getAppendBlobAsyncClient(String blobName) { * pipeline object. Or, call this package's NewAppendBlobAsyncClient instead of calling this object's * NewAppendBlobAsyncClient method. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.getAppendBlobAsyncClient#String-String} + * * @param blobName A {@code String} representing the name of the blob. * @param snapshot the snapshot identifier for the blob. * @return A new {@link AppendBlobAsyncClient} object which references the blob with the specified name in this @@ -180,7 +216,7 @@ public AppendBlobAsyncClient getAppendBlobAsyncClient(String blobName, String sn return new AppendBlobAsyncClient(new AzureBlobStorageBuilder() .url(Utility.appendToURLPath(getContainerUrl(), blobName).toString()) .pipeline(azureBlobStorage.getHttpPipeline()) - .build(), snapshot); + .build(), snapshot, cpk); } /** @@ -189,6 +225,10 @@ public AppendBlobAsyncClient getAppendBlobAsyncClient(String blobName, String sn * the BlobAsyncClient and then call its WithPipeline method passing in the desired pipeline object. Or, call this * package's getBlobAsyncClient instead of calling this object's getBlobAsyncClient method. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.getBlobAsyncClient#String} + * * @param blobName A {@code String} representing the name of the blob. * @return A new {@link BlobAsyncClient} object which references the blob with the specified name in this container. */ @@ -202,6 +242,10 @@ public BlobAsyncClient getBlobAsyncClient(String blobName) { * the BlobAsyncClient and then call its WithPipeline method passing in the desired pipeline object. Or, call this * package's getBlobAsyncClient instead of calling this object's getBlobAsyncClient method. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.getBlobAsyncClient#String-String} + * * @param blobName A {@code String} representing the name of the blob. * @param snapshot the snapshot identifier for the blob. * @return A new {@link BlobAsyncClient} object which references the blob with the specified name in this container. @@ -210,7 +254,7 @@ public BlobAsyncClient getBlobAsyncClient(String blobName, String snapshot) { return new BlobAsyncClient(new AzureBlobStorageBuilder() .url(Utility.appendToURLPath(getContainerUrl(), blobName).toString()) .pipeline(azureBlobStorage.getHttpPipeline()) - .build(), snapshot); + .build(), snapshot, cpk); } /** @@ -222,7 +266,7 @@ public BlobServiceAsyncClient getBlobServiceAsyncClient() { return new BlobServiceAsyncClient(new AzureBlobStorageBuilder() .url(Utility.stripLastPathSegment(getContainerUrl()).toString()) .pipeline(azureBlobStorage.getHttpPipeline()) - .build()); + .build(), cpk); } /** @@ -235,21 +279,58 @@ public URL getContainerUrl() { try { return new URL(azureBlobStorage.getUrl()); } catch (MalformedURLException e) { - throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.getUrl()), e); + throw logger.logExceptionAsError(new RuntimeException( + String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.getUrl()), e)); } } + /** + * Gets the {@link HttpPipeline} powering this client. + * + * @return The pipeline. + */ + public HttpPipeline getHttpPipeline() { + return azureBlobStorage.getHttpPipeline(); + } + /** * Gets if the container this client represents exists in the cloud. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.exists} + * * @return true if the container exists, false if it doesn't */ - public Mono> exists() { - return this.getProperties(null) + public Mono exists() { + return existsWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Gets if the container this client represents exists in the cloud. + * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.existsWithResponse} + * + * @return true if the container exists, false if it doesn't + */ + public Mono> existsWithResponse() { + return withContext(this::existsWithResponse); + } + + /** + * Gets if the container this client represents exists in the cloud. + * + * @return true if the container exists, false if it doesn't + */ + Mono> existsWithResponse(Context context) { + return this.getPropertiesWithResponse(null, context) .map(cp -> (Response) new SimpleResponse<>(cp, true)) - .onErrorResume(t -> t instanceof StorageException && ((StorageException) t).statusCode() == 404, t -> { - HttpResponse response = ((StorageException) t).response(); - return Mono.just(new SimpleResponse<>(response.request(), response.statusCode(), response.headers(), false)); + .onErrorResume(t -> t instanceof StorageException && ((StorageException) t).getStatusCode() == 404, t -> { + HttpResponse response = ((StorageException) t).getResponse(); + return Mono.just(new SimpleResponse<>(response.getRequest(), response.getStatusCode(), + response.getHeaders(), false)); }); } @@ -258,10 +339,14 @@ public Mono> exists() { * fails. For more information, see the * Azure Docs. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.create} + * * @return A reactive response signalling completion. */ - public Mono create() { - return this.create(null, null); + public Mono create() { + return createWithResponse(null, null).flatMap(FluxUtil::toMono); } /** @@ -269,17 +354,24 @@ public Mono create() { * fails. For more information, see the * Azure Docs. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.createWithResponse#Metadata-PublicAccessType} + * * @param metadata {@link Metadata} * @param accessType Specifies how the data in this container is available to the public. See the * x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access. * @return A reactive response signalling completion. */ - public Mono create(Metadata metadata, PublicAccessType accessType) { + public Mono createWithResponse(Metadata metadata, PublicAccessType accessType) { + return withContext(context -> createWithResponse(metadata, accessType, context)); + } + + Mono createWithResponse(Metadata metadata, PublicAccessType accessType, Context context) { metadata = metadata == null ? new Metadata() : metadata; return postProcessResponse(this.azureBlobStorage.containers().createWithRestResponseAsync( - null, null, metadata, accessType, null, Context.NONE)) - .map(VoidResponse::new); + null, null, metadata, accessType, null, context)).map(VoidResponse::new); } /** @@ -287,10 +379,14 @@ public Mono create(Metadata metadata, PublicAccessType accessType) * during garbage collection. For more information, see the * Azure Docs. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.delete} + * * @return A reactive response signalling completion. */ - public Mono delete() { - return this.delete(null); + public Mono delete() { + return deleteWithResponse(null).flatMap(FluxUtil::toMono); } /** @@ -298,23 +394,31 @@ public Mono delete() { * during garbage collection. For more information, see the * Azure Docs. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.deleteWithResponse#ContainerAccessConditions} + * * @param accessConditions {@link ContainerAccessConditions} * @return A reactive response signalling completion. - * @throws UnsupportedOperationException If {@link ContainerAccessConditions#modifiedAccessConditions()} has either - * {@link ModifiedAccessConditions#ifMatch()} or {@link ModifiedAccessConditions#ifNoneMatch()} set. + * @throws UnsupportedOperationException If {@link ContainerAccessConditions#getModifiedAccessConditions()} has + * either {@link ModifiedAccessConditions#getIfMatch()} or {@link ModifiedAccessConditions#getIfNoneMatch()} set. */ - public Mono delete(ContainerAccessConditions accessConditions) { + public Mono deleteWithResponse(ContainerAccessConditions accessConditions) { + return withContext(context -> deleteWithResponse(accessConditions, context)); + } + + Mono deleteWithResponse(ContainerAccessConditions accessConditions, Context context) { accessConditions = accessConditions == null ? new ContainerAccessConditions() : accessConditions; - if (!validateNoEtag(accessConditions.modifiedAccessConditions())) { + if (!validateNoEtag(accessConditions.getModifiedAccessConditions())) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new UnsupportedOperationException("ETag access conditions are not supported for this API."); + throw logger.logExceptionAsError( + new UnsupportedOperationException("ETag access conditions are not supported for this API.")); } - return postProcessResponse(this.azureBlobStorage.containers() - .deleteWithRestResponseAsync(null, null, null, - accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), Context.NONE)) + return postProcessResponse(this.azureBlobStorage.containers().deleteWithRestResponseAsync(null, null, null, + accessConditions.getLeaseAccessConditions(), accessConditions.getModifiedAccessConditions(), context)) .map(VoidResponse::new); } @@ -322,63 +426,89 @@ public Mono delete(ContainerAccessConditions accessConditions) { * Returns the container's metadata and system properties. For more information, see the * Azure Docs. * - * @return A reactive response containing the container properties. + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.getProperties} + * + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} containing the + * container properties. */ - public Mono> getProperties() { - return this.getProperties(null); + public Mono getProperties() { + return getPropertiesWithResponse(null).flatMap(FluxUtil::toMono); } /** * Returns the container's metadata and system properties. For more information, see the * Azure Docs. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.getPropertiesWithResponse#LeaseAccessConditions} + * * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does * not match the active lease on the blob. * @return A reactive response containing the container properties. */ - public Mono> getProperties(LeaseAccessConditions leaseAccessConditions) { + public Mono> getPropertiesWithResponse(LeaseAccessConditions leaseAccessConditions) { + return withContext(context -> getPropertiesWithResponse(leaseAccessConditions, context)); + } + + Mono> getPropertiesWithResponse(LeaseAccessConditions leaseAccessConditions, + Context context) { return postProcessResponse(this.azureBlobStorage.containers() - .getPropertiesWithRestResponseAsync(null, null, null, - leaseAccessConditions, Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, new ContainerProperties(rb.deserializedHeaders()))); + .getPropertiesWithRestResponseAsync(null, null, null, leaseAccessConditions, context)) + .map(rb -> new SimpleResponse<>(rb, new ContainerProperties(rb.getDeserializedHeaders()))); } /** * Sets the container's metadata. For more information, see the * Azure Docs. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.setMetadata#Metadata} + * * @param metadata {@link Metadata} - * @return A reactive response signalling completion. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains signalling + * completion. */ - public Mono setMetadata(Metadata metadata) { - return this.setMetadata(metadata, null); + public Mono setMetadata(Metadata metadata) { + return setMetadataWithResponse(metadata, null).flatMap(FluxUtil::toMono); } /** * Sets the container's metadata. For more information, see the * Azure Docs. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.setMetadataWithResponse#Metadata-ContainerAccessConditions} + * * @param metadata {@link Metadata} * @param accessConditions {@link ContainerAccessConditions} * @return A reactive response signalling completion. - * @throws UnsupportedOperationException If {@link ContainerAccessConditions#modifiedAccessConditions()} has - * anything set other than {@link ModifiedAccessConditions#ifModifiedSince()}. + * @throws UnsupportedOperationException If {@link ContainerAccessConditions#getModifiedAccessConditions()} has + * anything set other than {@link ModifiedAccessConditions#getIfModifiedSince()}. */ - public Mono setMetadata(Metadata metadata, ContainerAccessConditions accessConditions) { + public Mono setMetadataWithResponse(Metadata metadata, ContainerAccessConditions accessConditions) { + return withContext(context -> setMetadataWithResponse(metadata, accessConditions, context)); + } + + Mono setMetadataWithResponse(Metadata metadata, ContainerAccessConditions accessConditions, + Context context) { metadata = metadata == null ? new Metadata() : metadata; accessConditions = accessConditions == null ? new ContainerAccessConditions() : accessConditions; - if (!validateNoEtag(accessConditions.modifiedAccessConditions()) - || accessConditions.modifiedAccessConditions().ifUnmodifiedSince() != null) { + 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. - throw new UnsupportedOperationException( - "If-Modified-Since is the only HTTP access condition supported for this API"); + throw logger.logExceptionAsError(new UnsupportedOperationException( + "If-Modified-Since is the only HTTP access condition supported for this API")); } - return postProcessResponse(this.azureBlobStorage.containers() - .setMetadataWithRestResponseAsync(null, null, metadata, null, - accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), Context.NONE)) - .map(VoidResponse::new); + return postProcessResponse(this.azureBlobStorage.containers().setMetadataWithRestResponseAsync(null, null, + metadata, null, accessConditions.getLeaseAccessConditions(), accessConditions.getModifiedAccessConditions(), + context)).map(VoidResponse::new); } /** @@ -386,10 +516,14 @@ public Mono setMetadata(Metadata metadata, ContainerAccessConditio * For more information, see the * Azure Docs. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.getAccessPolicy} + * * @return A reactive response containing the container access policy. */ - public Mono> getAccessPolicy() { - return this.getAccessPolicy(null); + public Mono getAccessPolicy() { + return getAccessPolicyWithResponse(null).flatMap(FluxUtil::toMono); } /** @@ -397,13 +531,25 @@ public Mono> getAccessPolicy() { * For more information, see the * Azure Docs. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.getAccessPolicyWithResponse#LeaseAccessConditions} + * * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does * not match the active lease on the blob. * @return A reactive response containing the container access policy. */ - public Mono> getAccessPolicy(LeaseAccessConditions leaseAccessConditions) { - return postProcessResponse(this.azureBlobStorage.containers().getAccessPolicyWithRestResponseAsync(null, null, null, leaseAccessConditions, Context.NONE) - .map(response -> new SimpleResponse<>(response, new ContainerAccessPolicies(response.deserializedHeaders().blobPublicAccess(), response.value())))); + public Mono> getAccessPolicyWithResponse( + LeaseAccessConditions leaseAccessConditions) { + return withContext(context -> getAccessPolicyWithResponse(leaseAccessConditions, context)); + } + + Mono> getAccessPolicyWithResponse(LeaseAccessConditions leaseAccessConditions, + Context context) { + return postProcessResponse(this.azureBlobStorage.containers().getAccessPolicyWithRestResponseAsync(null, null, + null, leaseAccessConditions, context).map(response -> new SimpleResponse<>(response, + new ContainerAccessPolicies(response.getDeserializedHeaders().getBlobPublicAccess(), + response.getValue())))); } /** @@ -412,6 +558,10 @@ public Mono> getAccessPolicy(LeaseAccessCondit * ensure the time formatting is compatible with the service. For more information, see the * Azure Docs. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.setAccessPolicy#PublicAccessType-List} + * * @param accessType Specifies how the data in this container is available to the public. See the * x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access. * @param identifiers A list of {@link SignedIdentifier} objects that specify the permissions for the container. @@ -420,9 +570,9 @@ public Mono> getAccessPolicy(LeaseAccessCondit * for more information. Passing null will clear all access policies. * @return A reactive response signalling completion. */ - public Mono setAccessPolicy(PublicAccessType accessType, - List identifiers) { - return this.setAccessPolicy(accessType, identifiers, null); + public Mono setAccessPolicy(PublicAccessType accessType, + List identifiers) { + return setAccessPolicyWithResponse(accessType, identifiers, null).flatMap(FluxUtil::toMono); } /** @@ -431,6 +581,10 @@ public Mono setAccessPolicy(PublicAccessType accessType, * ensure the time formatting is compatible with the service. For more information, see the * Azure Docs. * + *

Code Samples

+ * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.setAccessPolicyWithResponse#PublicAccessType-List-ContainerAccessConditions} + * * @param accessType Specifies how the data in this container is available to the public. See the * x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access. * @param identifiers A list of {@link SignedIdentifier} objects that specify the permissions for the container. @@ -439,16 +593,23 @@ public Mono setAccessPolicy(PublicAccessType accessType, * for more information. Passing null will clear all access policies. * @param accessConditions {@link ContainerAccessConditions} * @return A reactive response signalling completion. - * @throws UnsupportedOperationException If {@link ContainerAccessConditions#modifiedAccessConditions()} has either - * {@link ModifiedAccessConditions#ifMatch()} or {@link ModifiedAccessConditions#ifNoneMatch()} set. + * @throws UnsupportedOperationException If {@link ContainerAccessConditions#getModifiedAccessConditions()} has + * either {@link ModifiedAccessConditions#getIfMatch()} or {@link ModifiedAccessConditions#getIfNoneMatch()} set. */ - public Mono setAccessPolicy(PublicAccessType accessType, List identifiers, ContainerAccessConditions accessConditions) { + public Mono setAccessPolicyWithResponse(PublicAccessType accessType, + List identifiers, ContainerAccessConditions accessConditions) { + return withContext(context -> setAccessPolicyWithResponse(accessType, identifiers, accessConditions, context)); + } + + Mono setAccessPolicyWithResponse(PublicAccessType accessType, List identifiers, + ContainerAccessConditions accessConditions, Context context) { accessConditions = accessConditions == null ? new ContainerAccessConditions() : accessConditions; - if (!validateNoEtag(accessConditions.modifiedAccessConditions())) { + if (!validateNoEtag(accessConditions.getModifiedAccessConditions())) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new UnsupportedOperationException("ETag access conditions are not supported for this API."); + throw logger.logExceptionAsError( + new UnsupportedOperationException("ETag access conditions are not supported for this API.")); } /* @@ -459,21 +620,20 @@ OffsetDateTime.now will only give back milliseconds (more precise fields are zer */ if (identifiers != null) { for (SignedIdentifier identifier : identifiers) { - if (identifier.accessPolicy() != null && identifier.accessPolicy().start() != null) { - identifier.accessPolicy().start( - identifier.accessPolicy().start().truncatedTo(ChronoUnit.SECONDS)); + if (identifier.getAccessPolicy() != null && identifier.getAccessPolicy().getStart() != null) { + identifier.getAccessPolicy().setStart( + identifier.getAccessPolicy().getStart().truncatedTo(ChronoUnit.SECONDS)); } - if (identifier.accessPolicy() != null && identifier.accessPolicy().expiry() != null) { - identifier.accessPolicy().expiry( - identifier.accessPolicy().expiry().truncatedTo(ChronoUnit.SECONDS)); + if (identifier.getAccessPolicy() != null && identifier.getAccessPolicy().getExpiry() != null) { + identifier.getAccessPolicy().setExpiry( + identifier.getAccessPolicy().getExpiry().truncatedTo(ChronoUnit.SECONDS)); } } } - return postProcessResponse(this.azureBlobStorage.containers() - .setAccessPolicyWithRestResponseAsync(null, identifiers, null, accessType, - null, accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), - Context.NONE)) + return postProcessResponse(this.azureBlobStorage.containers().setAccessPolicyWithRestResponseAsync(null, + identifiers, null, accessType, null, accessConditions.getLeaseAccessConditions(), + accessConditions.getModifiedAccessConditions(), context)) .map(VoidResponse::new); } @@ -495,9 +655,13 @@ OffsetDateTime.now will only give back milliseconds (more precise fields are zer *
  • bar * * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.listBlobsFlat} + * * @return A reactive response emitting the flattened blobs. */ - public Flux listBlobsFlat() { + public PagedFlux listBlobsFlat() { return this.listBlobsFlat(new ListBlobsOptions()); } @@ -519,11 +683,44 @@ public Flux listBlobsFlat() { *
  • bar * * + * + * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.listBlobsFlat#ListBlobsOptions} + * * @param options {@link ListBlobsOptions} * @return A reactive response emitting the listed blobs, flattened. */ - public Flux listBlobsFlat(ListBlobsOptions options) { - return listBlobsFlatSegment(null, options).flatMapMany(response -> listBlobsFlatHelper(options, response)); + public PagedFlux listBlobsFlat(ListBlobsOptions options) { + return listBlobsFlatWithOptionalTimeout(options, null); + } + + /* + * Implementation for this paged listing operation, supporting an optional timeout provided by the synchronous + * ContainerClient. Applies the given timeout to each Mono backing the + * PagedFlux. + * + * @param options {@link ListBlobsOptions}. + * @param timeout An optional timeout to be applied to the network asynchronous operations. + * @return A reactive response emitting the listed blobs, flattened. + */ + PagedFlux listBlobsFlatWithOptionalTimeout(ListBlobsOptions options, Duration timeout) { + Function>> func = + marker -> listBlobsFlatSegment(marker, options, timeout) + .map(response -> { + List value = response.getValue().getSegment() == null + ? new ArrayList<>(0) + : response.getValue().getSegment().getBlobItems(); + + return new PagedResponseBase<>( + response.getRequest(), + response.getStatusCode(), + response.getHeaders(), + value, + response.getValue().getNextMarker(), + response.getDeserializedHeaders()); + }); + + return new PagedFlux<>(() -> func.apply(null), func); } /* @@ -536,41 +733,19 @@ public Flux listBlobsFlat(ListBlobsOptions options) { * @param marker * Identifies the portion of the list to be returned with the next list operation. * This value is returned in the response of a previous list operation as the - * ListBlobsFlatSegmentResponse.body().nextMarker(). Set to null to list the first segment. + * ListBlobsFlatSegmentResponse.body().getNextMarker(). Set to null to list the first segment. * @param options * {@link ListBlobsOptions} * * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_flat "Sample code for ContainerAsyncClient.listBlobsFlatSegment")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_flat_helper "helper code for ContainerAsyncClient.listBlobsFlatSegment")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) */ - private Mono listBlobsFlatSegment(String marker, ListBlobsOptions options) { + private Mono listBlobsFlatSegment(String marker, ListBlobsOptions options, + Duration timeout) { options = options == null ? new ListBlobsOptions() : options; - return postProcessResponse(this.azureBlobStorage.containers() - .listBlobFlatSegmentWithRestResponseAsync(null, options.prefix(), marker, - options.maxResults(), options.details().toList(), null, null, Context.NONE)); - } - - private Flux listBlobsFlatHelper(ListBlobsOptions options, ContainersListBlobFlatSegmentResponse response) { - Flux result; - BlobFlatListSegment segment = response.value().segment(); - if (segment != null && segment.blobItems() != null) { - result = Flux.fromIterable(segment.blobItems()); - } else { - result = Flux.empty(); - } - - if (response.value().nextMarker() != null) { - // Recursively add the continuation items to the observable. - result = result.concatWith(listBlobsFlatSegment(response.value().nextMarker(), options) - .flatMapMany(r -> listBlobsFlatHelper(options, r))); - } - - return result; + return postProcessResponse(Utility.applyOptionalTimeout( + this.azureBlobStorage.containers().listBlobFlatSegmentWithRestResponseAsync(null, options.getPrefix(), + marker, options.getMaxResults(), options.getDetails().toList(), null, null, Context.NONE), timeout)); } /** @@ -597,11 +772,15 @@ private Flux listBlobsFlatHelper(ListBlobsOptions options, ContainersL *
  • foo/foo2 (isPrefix = false) * * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.listBlobsHierarchy#String} + * * @param directory The directory to list blobs underneath * @return A reactive response emitting the prefixes and blobs. */ - public Flux listBlobsHierarchy(String directory) { - return this.listBlobsHierarchy("/", new ListBlobsOptions().prefix(directory)); + public PagedFlux listBlobsHierarchy(String directory) { + return this.listBlobsHierarchy("/", new ListBlobsOptions().setPrefix(directory)); } /** @@ -628,165 +807,93 @@ public Flux listBlobsHierarchy(String directory) { *
  • foo/foo2 (isPrefix = false) * * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.listBlobsHierarchy#String-ListBlobsOptions} + * * @param delimiter The delimiter for blob hierarchy, "/" for hierarchy based on directories * @param options {@link ListBlobsOptions} * @return A reactive response emitting the prefixes and blobs. */ - public Flux listBlobsHierarchy(String delimiter, ListBlobsOptions options) { - return listBlobsHierarchySegment(null, delimiter, options) - .flatMapMany(response -> listBlobsHierarchyHelper(delimiter, options, Context.NONE, response)); + public PagedFlux listBlobsHierarchy(String delimiter, ListBlobsOptions options) { + return listBlobsHierarchyWithOptionalTimeout(delimiter, options, null); } /* - * Returns a single segment of blobs and blob prefixes starting from the specified Marker. Use an empty - * marker to start enumeration from the beginning. Blob names are returned in lexicographic order. - * After getting a segment, process it, and then call ListBlobs again (passing the the previously-returned - * Marker) to get the next segment. For more information, see the - * Azure Docs. - * - * @param marker - * Identifies the portion of the list to be returned with the next list operation. - * This value is returned in the response of a previous list operation as the - * ListBlobsHierarchySegmentResponse.body().nextMarker(). Set to null to list the first segment. - * @param delimiter - * The operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs - * whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may - * be a single character or a string. - * @param options - * {@link ListBlobsOptions} - * - * @return Emits the successful response. - * @throws UnsupportedOperationException If {@link ListBlobsOptions#details()} has {@link BlobListDetails#snapshots()} - * set. + * Implementation for this paged listing operation, supporting an optional timeout provided by the synchronous + * ContainerClient. Applies the given timeout to each Mono backing the + * PagedFlux. * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy "Sample code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy_helper "helper code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) + * @param delimiter The delimiter for blob hierarchy, "/" for hierarchy based on directories + * @param options {@link ListBlobsOptions} + * @param timeout An optional timeout to be applied to the network asynchronous operations. + * @return A reactive response emitting the listed blobs, flattened. */ - private Mono listBlobsHierarchySegment(String marker, String delimiter, ListBlobsOptions options) { - options = options == null ? new ListBlobsOptions() : options; - if (options.details().snapshots()) { - throw new UnsupportedOperationException("Including snapshots in a hierarchical listing is not supported."); - } - - return postProcessResponse(this.azureBlobStorage.containers() - .listBlobHierarchySegmentWithRestResponseAsync(null, delimiter, options.prefix(), marker, - options.maxResults(), options.details().toList(), null, null, Context.NONE)); - } - - private Flux listBlobsHierarchyHelper(String delimiter, ListBlobsOptions options, - Context context, ContainersListBlobHierarchySegmentResponse response) { - Flux blobs; - Flux prefixes; - BlobHierarchyListSegment segment = response.value().segment(); - if (segment != null && segment.blobItems() != null) { - blobs = Flux.fromIterable(segment.blobItems()); - } else { - blobs = Flux.empty(); - } - if (segment != null && segment.blobPrefixes() != null) { - prefixes = Flux.fromIterable(segment.blobPrefixes()); - } else { - prefixes = Flux.empty(); - } - Flux result = blobs.map(item -> item.isPrefix(false)) - .concatWith(prefixes.map(prefix -> new BlobItem().name(prefix.name()).isPrefix(true))); + PagedFlux listBlobsHierarchyWithOptionalTimeout(String delimiter, ListBlobsOptions options, + Duration timeout) { + Function>> func = + marker -> listBlobsHierarchySegment(marker, delimiter, options, timeout) + .map(response -> { + List value = response.getValue().getSegment() == null + ? new ArrayList<>(0) + : Stream.concat( + response.getValue().getSegment().getBlobItems().stream(), + response.getValue().getSegment().getBlobPrefixes().stream() + .map(blobPrefix -> new BlobItem().setName(blobPrefix.getName()).setIsPrefix(true)) + ).collect(Collectors.toList()); + + return new PagedResponseBase<>( + response.getRequest(), + response.getStatusCode(), + response.getHeaders(), + value, + response.getValue().getNextMarker(), + response.getDeserializedHeaders()); + }); + + return new PagedFlux<>(() -> func.apply(null), func); + } - if (response.value().nextMarker() != null) { - // Recursively add the continuation items to the observable. - result = result.concatWith(listBlobsHierarchySegment(response.value().nextMarker(), delimiter, options) - .flatMapMany(r -> listBlobsHierarchyHelper(delimiter, options, context, r))); + private Mono listBlobsHierarchySegment(String marker, String delimiter, + ListBlobsOptions options, Duration timeout) { + options = options == null ? new ListBlobsOptions() : options; + if (options.getDetails().getSnapshots()) { + throw logger.logExceptionAsError( + new UnsupportedOperationException("Including snapshots in a hierarchical listing is not supported.")); } - return result; + return postProcessResponse(Utility.applyOptionalTimeout( + this.azureBlobStorage.containers().listBlobHierarchySegmentWithRestResponseAsync(null, delimiter, + options.getPrefix(), marker, options.getMaxResults(), options.getDetails().toList(), null, null, + Context.NONE), + timeout)); } - /** - * Returns a single segment of blobs and blob prefixes starting from the specified Marker. Use an empty - * marker to start enumeration from the beginning. Blob names are returned in lexicographic order. - * After getting a segment, process it, and then call ListBlobs again (passing the the previously-returned - * Marker) to get the next segment. For more information, see the - * Azure Docs. - * - * @param marker - * Identifies the portion of the list to be returned with the next list operation. - * This value is returned in the response of a previous list operation as the - * ListBlobsHierarchySegmentResponse.body().nextMarker(). Set to null to list the first segment. - * @param delimiter - * The operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs - * whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may - * be a single character or a string. - * @param options - * {@link ListBlobsOptions} - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy "Sample code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy_helper "helper code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ -// public Flux listBlobsHierarchySegment(String marker, String delimiter, -// ListBlobsOptions options) { -// return this.listBlobsHierarchySegment(marker, delimiter, options, null); -// } - - /** - * Returns a single segment of blobs and blob prefixes starting from the specified Marker. Use an empty - * marker to start enumeration from the beginning. Blob names are returned in lexicographic order. - * After getting a segment, process it, and then call ListBlobs again (passing the the previously-returned - * Marker) to get the next segment. For more information, see the - * Azure Docs. - * - * @param marker - * Identifies the portion of the list to be returned with the next list operation. - * This value is returned in the response of a previous list operation as the - * ListBlobsHierarchySegmentResponse.body().nextMarker(). Set to null to list the first segment. - * @param delimiter - * The operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs - * whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may - * be a single character or a string. - * @param options - * {@link ListBlobsOptions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy "Sample code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy_helper "helper code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ -// public Flux listBlobsHierarchySegment(String marker, String delimiter, -// ListBlobsOptions options) { -// return containerAsyncRawClient -// .listBlobsHierarchySegment(null, delimiter, options) -// .flatMapMany(); -// } - /** * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 * seconds, or infinite (-1). * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.acquireLease#String-int} + * * @param proposedId A {@code String} in any valid GUID format. May be null. * @param duration The duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A * non-infinite lease can be between 15 and 60 seconds. * @return A reactive response containing the lease ID. */ - public Mono> acquireLease(String proposedId, int duration) { - return this.acquireLease(proposedId, duration, null); + public Mono acquireLease(String proposedId, int duration) { + return acquireLeaseWithResponse(proposedId, duration, null).flatMap(FluxUtil::toMono); } /** * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 * seconds, or infinite (-1). * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.acquireLeaseWithResponse#String-int-ModifiedAccessConditions} + * * @param proposedID A {@code String} in any valid GUID format. May be null. * @param duration The duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A * non-infinite lease can be between 15 and 60 seconds. @@ -794,87 +901,122 @@ public Mono> acquireLease(String proposedId, int duration) { * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @return A reactive response containing the lease ID. - * @throws UnsupportedOperationException If either {@link ModifiedAccessConditions#ifMatch()} or {@link - * ModifiedAccessConditions#ifNoneMatch()} is set. + * @throws UnsupportedOperationException If either {@link ModifiedAccessConditions#getIfMatch()} or {@link + * ModifiedAccessConditions#getIfNoneMatch()} is set. */ - public Mono> acquireLease(String proposedID, int duration, ModifiedAccessConditions modifiedAccessConditions) { + public Mono> acquireLeaseWithResponse(String proposedID, int duration, + ModifiedAccessConditions modifiedAccessConditions) { + return withContext(context -> + acquireLeaseWithResponse(proposedID, duration, modifiedAccessConditions, context)); + } + + Mono> acquireLeaseWithResponse(String proposedID, int duration, + ModifiedAccessConditions modifiedAccessConditions, Context context) { if (!this.validateNoEtag(modifiedAccessConditions)) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new UnsupportedOperationException( - "ETag access conditions are not supported for this API."); + throw logger.logExceptionAsError(new UnsupportedOperationException( + "ETag access conditions are not supported for this API.")); } - return postProcessResponse(this.azureBlobStorage.containers().acquireLeaseWithRestResponseAsync( - null, null, duration, proposedID, null, modifiedAccessConditions, Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseId())); + return postProcessResponse(this.azureBlobStorage.containers().acquireLeaseWithRestResponseAsync(null, null, + duration, proposedID, null, modifiedAccessConditions, context)) + .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getLeaseId())); } /** * Renews the blob's previously-acquired lease. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.renewLease#String} + * * @param leaseID The leaseId of the active lease on the blob. * @return A reactive response containing the renewed lease ID. */ - public Mono> renewLease(String leaseID) { - return this.renewLease(leaseID, null); + public Mono renewLease(String leaseID) { + return renewLeaseWithResponse(leaseID, null).flatMap(FluxUtil::toMono); } /** * Renews the blob's previously-acquired lease. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.renewLeaseWithResponse#String-ModifiedAccessConditions} + * * @param leaseID The leaseId of the active lease on the blob. * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @return A reactive response containing the renewed lease ID. - * @throws UnsupportedOperationException If either {@link ModifiedAccessConditions#ifMatch()} or {@link - * ModifiedAccessConditions#ifNoneMatch()} is set. + * @throws UnsupportedOperationException If either {@link ModifiedAccessConditions#getIfMatch()} or {@link + * ModifiedAccessConditions#getIfNoneMatch()} is set. */ - public Mono> renewLease(String leaseID, ModifiedAccessConditions modifiedAccessConditions) { + public Mono> renewLeaseWithResponse(String leaseID, + ModifiedAccessConditions modifiedAccessConditions) { + return withContext(context -> renewLeaseWithResponse(leaseID, modifiedAccessConditions, context)); + } + + Mono> renewLeaseWithResponse(String leaseID, ModifiedAccessConditions modifiedAccessConditions, + Context context) { if (!this.validateNoEtag(modifiedAccessConditions)) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new UnsupportedOperationException( - "ETag access conditions are not supported for this API."); + throw logger.logExceptionAsError(new UnsupportedOperationException( + "ETag access conditions are not supported for this API.")); } - return postProcessResponse(this.azureBlobStorage.containers().renewLeaseWithRestResponseAsync(null, - leaseID, null, null, modifiedAccessConditions, Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseId())); + return postProcessResponse(this.azureBlobStorage.containers().renewLeaseWithRestResponseAsync(null, leaseID, + null, null, modifiedAccessConditions, context)) + .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getLeaseId())); } /** * Releases the blob's previously-acquired lease. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.releaseLease#String} + * * @param leaseID The leaseId of the active lease on the blob. * @return A reactive response signalling completion. */ - public Mono releaseLease(String leaseID) { - return this.releaseLease(leaseID, null); + public Mono releaseLease(String leaseID) { + return releaseLeaseWithResponse(leaseID, null).flatMap(FluxUtil::toMono); } /** * Releases the blob's previously-acquired lease. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.releaseLeaseWithResponse#String-ModifiedAccessConditions} + * * @param leaseID The leaseId of the active lease on the blob. * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @return A reactive response signalling completion. - * @throws UnsupportedOperationException If either {@link ModifiedAccessConditions#ifMatch()} or {@link - * ModifiedAccessConditions#ifNoneMatch()} is set. + * @throws UnsupportedOperationException If either {@link ModifiedAccessConditions#getIfMatch()} or {@link + * ModifiedAccessConditions#getIfNoneMatch()} is set. */ - public Mono releaseLease(String leaseID, ModifiedAccessConditions modifiedAccessConditions) { + public Mono releaseLeaseWithResponse(String leaseID, + ModifiedAccessConditions modifiedAccessConditions) { + return withContext(context -> releaseLeaseWithResponse(leaseID, modifiedAccessConditions, context)); + } + + Mono releaseLeaseWithResponse(String leaseID, ModifiedAccessConditions modifiedAccessConditions, + Context context) { if (!this.validateNoEtag(modifiedAccessConditions)) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new UnsupportedOperationException( - "ETag access conditions are not supported for this API."); + throw logger.logExceptionAsError(new UnsupportedOperationException( + "ETag access conditions are not supported for this API.")); } return postProcessResponse(this.azureBlobStorage.containers().releaseLeaseWithRestResponseAsync( - null, leaseID, null, null, modifiedAccessConditions, Context.NONE)) + null, leaseID, null, null, modifiedAccessConditions, context)) .map(VoidResponse::new); } @@ -882,16 +1024,24 @@ public Mono releaseLease(String leaseID, ModifiedAccessConditions * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant * to break a fixed-duration lease when it expires or an infinite lease immediately. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.breakLease} + * * @return A reactive response containing the remaining time in the broken lease. */ - public Mono> breakLease() { - return this.breakLease(null, null); + public Mono breakLease() { + return breakLeaseWithResponse(null, null).flatMap(FluxUtil::toMono); } /** * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant * to break a fixed-duration lease when it expires or an infinite lease immediately. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.breakLeaseWithResponse#Integer-ModifiedAccessConditions} + * * @param breakPeriodInSeconds An optional {@code Integer} representing the proposed duration of seconds that the * lease should continue before it is broken, between 0 and 60 seconds. This break period is only used if it is * shorter than the time remaining on the lease. If longer, the time remaining on the lease is used. A new lease @@ -901,76 +1051,119 @@ public Mono> breakLease() { * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @return A reactive response containing the remaining time in the broken lease. - * @throws UnsupportedOperationException If either {@link ModifiedAccessConditions#ifMatch()} or {@link - * ModifiedAccessConditions#ifNoneMatch()} is set. + * @throws UnsupportedOperationException If either {@link ModifiedAccessConditions#getIfMatch()} or {@link + * ModifiedAccessConditions#getIfNoneMatch()} is set. */ - public Mono> breakLease(Integer breakPeriodInSeconds, ModifiedAccessConditions modifiedAccessConditions) { + public Mono> breakLeaseWithResponse(Integer breakPeriodInSeconds, + ModifiedAccessConditions modifiedAccessConditions) { + return withContext(context -> breakLeaseWithResponse(breakPeriodInSeconds, modifiedAccessConditions, context)); + } + + Mono> breakLeaseWithResponse(Integer breakPeriodInSeconds, + ModifiedAccessConditions modifiedAccessConditions, Context context) { if (!this.validateNoEtag(modifiedAccessConditions)) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new UnsupportedOperationException( - "ETag access conditions are not supported for this API."); + throw logger.logExceptionAsError(new UnsupportedOperationException( + "ETag access conditions are not supported for this API.")); } return postProcessResponse(this.azureBlobStorage.containers().breakLeaseWithRestResponseAsync(null, - null, breakPeriodInSeconds, null, modifiedAccessConditions, Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, Duration.ofSeconds(rb.deserializedHeaders().leaseTime()))); + null, breakPeriodInSeconds, null, modifiedAccessConditions, context) + .map(rb -> new SimpleResponse<>(rb, Duration.ofSeconds(rb.getDeserializedHeaders().getLeaseTime())))); } /** * ChangeLease changes the blob's lease ID. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.changeLease#String-String} + * * @param leaseId The leaseId of the active lease on the blob. * @param proposedID A {@code String} in any valid GUID format. * @return A reactive response containing the new lease ID. */ - public Mono> changeLease(String leaseId, String proposedID) { - return this.changeLease(leaseId, proposedID, null); + public Mono changeLease(String leaseId, String proposedID) { + return changeLeaseWithResponse(leaseId, proposedID, null).flatMap(FluxUtil::toMono); } /** * ChangeLease changes the blob's lease ID. For more information, see the Azure * Docs. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.changeLeaseWithResponse#String-String-ModifiedAccessConditions} + * * @param leaseId The leaseId of the active lease on the blob. * @param proposedID A {@code String} in any valid GUID format. * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @return A reactive response containing the new lease ID. - * @throws UnsupportedOperationException If either {@link ModifiedAccessConditions#ifMatch()} or {@link - * ModifiedAccessConditions#ifNoneMatch()} is set. + * @throws UnsupportedOperationException If either {@link ModifiedAccessConditions#getIfMatch()} or {@link + * ModifiedAccessConditions#getIfNoneMatch()} is set. */ - public Mono> changeLease(String leaseId, String proposedID, ModifiedAccessConditions modifiedAccessConditions) { + public Mono> changeLeaseWithResponse(String leaseId, String proposedID, + ModifiedAccessConditions modifiedAccessConditions) { + return withContext(context -> changeLeaseWithResponse(leaseId, proposedID, modifiedAccessConditions, context)); + } + + Mono> changeLeaseWithResponse(String leaseId, String proposedID, + ModifiedAccessConditions modifiedAccessConditions, Context context) { if (!this.validateNoEtag(modifiedAccessConditions)) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new UnsupportedOperationException( - "ETag access conditions are not supported for this API."); + throw logger.logExceptionAsError(new UnsupportedOperationException( + "ETag access conditions are not supported for this API.")); } return postProcessResponse(this.azureBlobStorage.containers().changeLeaseWithRestResponseAsync(null, - leaseId, proposedID, null, null, modifiedAccessConditions, Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseId())); + leaseId, proposedID, null, null, modifiedAccessConditions, context)) + .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getLeaseId())); + } + + /** + * Returns the sku name and account kind for the account. For more information, please see the + * Azure Docs. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.getAccountInfo} + * + * @return A reactive response containing the account info. + */ + public Mono getAccountInfo() { + return getAccountInfoWithResponse().flatMap(FluxUtil::toMono); } /** * Returns the sku name and account kind for the account. For more information, please see the * Azure Docs. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.getAccountInfoWithResponse} + * * @return A reactive response containing the account info. */ - public Mono> getAccountInfo() { + public Mono> getAccountInfoWithResponse() { + return withContext(this::getAccountInfoWithResponse); + } + + Mono> getAccountInfoWithResponse(Context context) { return postProcessResponse( - this.azureBlobStorage.containers().getAccountInfoWithRestResponseAsync(null, Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, new StorageAccountInfo(rb.deserializedHeaders()))); + this.azureBlobStorage.containers().getAccountInfoWithRestResponseAsync(null, context)) + .map(rb -> new SimpleResponse<>(rb, new StorageAccountInfo(rb.getDeserializedHeaders()))); } + private boolean validateNoEtag(ModifiedAccessConditions modifiedAccessConditions) { if (modifiedAccessConditions == null) { return true; } - return modifiedAccessConditions.ifMatch() == null && modifiedAccessConditions.ifNoneMatch() == null; + return modifiedAccessConditions.getIfMatch() == null && modifiedAccessConditions.getIfNoneMatch() == null; } /** @@ -983,7 +1176,7 @@ private boolean validateNoEtag(ModifiedAccessConditions modifiedAccessConditions * @return A string that represents the SAS token */ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName, - ContainerSASPermission permissions, OffsetDateTime expiryTime) { + ContainerSASPermission permissions, OffsetDateTime expiryTime) { return this.generateUserDelegationSAS(userDelegationKey, accountName, permissions, expiryTime, null, null, null, null, null, null, null, null, null); } @@ -1002,8 +1195,8 @@ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, Str * @return A string that represents the SAS token */ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName, - ContainerSASPermission permissions, OffsetDateTime expiryTime, OffsetDateTime startTime, String version, - SASProtocol sasProtocol, IPRange ipRange) { + ContainerSASPermission 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 */); @@ -1012,6 +1205,14 @@ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, Str /** * Generates a user delegation SAS token with the specified parameters * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.generateUserDelegationSAS#UserDelegationKey-String-ContainerSASPermission-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 ContainerSASPermissions} permission for the SAS @@ -1028,18 +1229,20 @@ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, Str * @return A string that represents the SAS token */ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName, - ContainerSASPermission permissions, OffsetDateTime expiryTime, OffsetDateTime startTime, String version, - SASProtocol sasProtocol, IPRange ipRange, String cacheControl, String contentDisposition, - String contentEncoding, String contentLanguage, String contentType) { - ServiceSASSignatureValues serviceSASSignatureValues = new ServiceSASSignatureValues(version, sasProtocol, - startTime, expiryTime, permissions == null ? null : permissions.toString(), ipRange, null /* identifier*/, - cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType); + ContainerSASPermission 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); - ServiceSASSignatureValues values = configureServiceSASSignatureValues(serviceSASSignatureValues, accountName); + BlobServiceSASSignatureValues values = + configureServiceSASSignatureValues(blobServiceSASSignatureValues, accountName); - SASQueryParameters sasQueryParameters = values.generateSASQueryParameters(userDelegationKey); + BlobServiceSASQueryParameters blobServiceSasQueryParameters = + values.generateSASQueryParameters(userDelegationKey); - return sasQueryParameters.encode(); + return blobServiceSasQueryParameters.encode(); } /** @@ -1080,8 +1283,7 @@ public String generateSAS(String identifier) { * @return A string that represents the SAS token */ public String generateSAS(String identifier, ContainerSASPermission permissions, OffsetDateTime expiryTime, - OffsetDateTime startTime, - String version, SASProtocol sasProtocol, IPRange ipRange) { + 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*/); @@ -1090,6 +1292,13 @@ public String generateSAS(String identifier, ContainerSASPermission permissions, /** * Generates a SAS token with the specified parameters * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerAsyncClient.generateSAS#String-ContainerSASPermission-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 ContainerSASPermissions} permission for the SAS * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS @@ -1105,37 +1314,39 @@ public String generateSAS(String identifier, ContainerSASPermission permissions, * @return A string that represents the SAS token */ public String generateSAS(String identifier, ContainerSASPermission permissions, OffsetDateTime expiryTime, - OffsetDateTime startTime, String version, SASProtocol sasProtocol, IPRange ipRange, String cacheControl, - String contentDisposition, String contentEncoding, String contentLanguage, String contentType) { - ServiceSASSignatureValues serviceSASSignatureValues = new ServiceSASSignatureValues(version, sasProtocol, - startTime, expiryTime, permissions == null ? null : permissions.toString(), ipRange, identifier, - cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType); + 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); - ServiceSASSignatureValues values = configureServiceSASSignatureValues(serviceSASSignatureValues, - sharedKeyCredential.accountName()); + BlobServiceSASSignatureValues values = configureServiceSASSignatureValues(blobServiceSASSignatureValues, + sharedKeyCredential.getAccountName()); - SASQueryParameters sasQueryParameters = values.generateSASQueryParameters(sharedKeyCredential); + BlobServiceSASQueryParameters blobServiceSasQueryParameters = + values.generateSASQueryParameters(sharedKeyCredential); - return sasQueryParameters.encode(); + return blobServiceSasQueryParameters.encode(); } /** - * Sets serviceSASSignatureValues parameters dependent on the current blob type + * Sets blobServiceSASSignatureValues parameters dependent on the current blob type */ - private ServiceSASSignatureValues configureServiceSASSignatureValues(ServiceSASSignatureValues serviceSASSignatureValues, String accountName) { + private BlobServiceSASSignatureValues configureServiceSASSignatureValues( + BlobServiceSASSignatureValues blobServiceSASSignatureValues, String accountName) { // Set canonical name - serviceSASSignatureValues.canonicalName(this.azureBlobStorage.getUrl(), accountName); + blobServiceSASSignatureValues.setCanonicalName(this.azureBlobStorage.getUrl(), accountName); // Set snapshotId to null - serviceSASSignatureValues.snapshotId(null); + blobServiceSASSignatureValues.setSnapshotId(null); // Set resource - serviceSASSignatureValues.resource(Constants.UrlConstants.SAS_CONTAINER_CONSTANT); - return serviceSASSignatureValues; + blobServiceSASSignatureValues.setResource(Constants.UrlConstants.SAS_CONTAINER_CONSTANT); + return blobServiceSASSignatureValues; } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerClient.java index 566efd526a69..103b097c76bd 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerClient.java @@ -3,8 +3,11 @@ package com.azure.storage.blob; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobItem; import com.azure.storage.blob.models.ContainerAccessConditions; import com.azure.storage.blob.models.ContainerAccessPolicies; @@ -19,7 +22,6 @@ import com.azure.storage.common.IPRange; import com.azure.storage.common.SASProtocol; import com.azure.storage.common.Utility; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.net.URL; @@ -42,7 +44,7 @@ * Docs for more information on containers. */ public final class ContainerClient { - private ContainerAsyncClient containerAsyncClient; + private final ContainerAsyncClient containerAsyncClient; public static final String ROOT_CONTAINER_NAME = ContainerAsyncClient.ROOT_CONTAINER_NAME; @@ -66,6 +68,10 @@ public final class ContainerClient { * object. Or, call this package's NewBlockBlobAsyncClient instead of calling this object's NewBlockBlobAsyncClient * method. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.getBlockBlobClient#String} + * * @param blobName A {@code String} representing the name of the blob. * @return A new {@link BlockBlobClient} object which references the blob with the specified name in this container. */ @@ -80,6 +86,10 @@ public BlockBlobClient getBlockBlobClient(String blobName) { * object. Or, call this package's NewBlockBlobAsyncClient instead of calling this object's NewBlockBlobAsyncClient * method. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.getBlockBlobClient#String-String} + * * @param blobName A {@code String} representing the name of the blob. * @param snapshot the snapshot identifier for the blob. * @return A new {@link BlockBlobClient} object which references the blob with the specified name in this container. @@ -94,6 +104,10 @@ public BlockBlobClient getBlockBlobClient(String blobName, String snapshot) { * create the PageBlobClient and then call its WithPipeline method passing in the desired pipeline object. Or, call * this package's NewPageBlobAsyncClient instead of calling this object's NewPageBlobAsyncClient method. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.getPageBlobClient#String} + * * @param blobName A {@code String} representing the name of the blob. * @return A new {@link PageBlobClient} object which references the blob with the specified name in this container. */ @@ -107,6 +121,10 @@ public PageBlobClient getPageBlobClient(String blobName) { * create the PageBlobClient and then call its WithPipeline method passing in the desired pipeline object. Or, call * this package's NewPageBlobAsyncClient instead of calling this object's NewPageBlobAsyncClient method. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.getPageBlobClient#String-String} + * * @param blobName A {@code String} representing the name of the blob. * @param snapshot the snapshot identifier for the blob. * @return A new {@link PageBlobClient} object which references the blob with the specified name in this container. @@ -122,6 +140,10 @@ public PageBlobClient getPageBlobClient(String blobName, String snapshot) { * object. Or, call this package's NewAppendBlobAsyncClient instead of calling this object's * NewAppendBlobAsyncClient method. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.getAppendBlobClient#String} + * * @param blobName A {@code String} representing the name of the blob. * @return A new {@link AppendBlobClient} object which references the blob with the specified name in this * container. @@ -137,6 +159,10 @@ public AppendBlobClient getAppendBlobClient(String blobName) { * object. Or, call this package's NewAppendBlobAsyncClient instead of calling this object's * NewAppendBlobAsyncClient method. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.getAppendBlobClient#String-String} + * * @param blobName A {@code String} representing the name of the blob. * @param snapshot the snapshot identifier for the blob. * @return A new {@link AppendBlobClient} object which references the blob with the specified name in this @@ -153,6 +179,10 @@ public AppendBlobClient getAppendBlobClient(String blobName, String snapshot) { * getBlobAsyncClient instead of calling this object's getBlobAsyncClient method. * * @param blobName A {@code String} representing the name of the blob. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.getBlobClient#String} * @return A new {@link BlobClient} object which references the blob with the specified name in this container. */ public BlobClient getBlobClient(String blobName) { @@ -165,6 +195,10 @@ public BlobClient getBlobClient(String blobName) { * BlobClient and then call its WithPipeline method passing in the desired pipeline object. Or, call this package's * getBlobAsyncClient instead of calling this object's getBlobAsyncClient method. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.getBlobClient#String-String} + * * @param blobName A {@code String} representing the name of the blob. * @param snapshot the snapshot identifier for the blob. * @return A new {@link BlobClient} object which references the blob with the specified name in this container. @@ -191,23 +225,40 @@ public URL getContainerUrl() { return containerAsyncClient.getContainerUrl(); } + /** + * Gets the {@link HttpPipeline} powering this client. + * + * @return The pipeline. + */ + public HttpPipeline getHttpPipeline() { + return containerAsyncClient.getHttpPipeline(); + } + /** * Gets if the container this client represents exists in the cloud. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.exists} + * * @return true if the container exists, false if it doesn't */ - public Response exists() { - return this.exists(null); + public Boolean exists() { + return existsWithResponse(null, Context.NONE).getValue(); } /** * Gets if the container this client represents exists in the cloud. + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.existsWithResponse#Duration-Context} * * @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 true if the container exists, false if it doesn't */ - public Response exists(Duration timeout) { - Mono> response = containerAsyncClient.exists(); + public Response existsWithResponse(Duration timeout, Context context) { + Mono> response = containerAsyncClient.existsWithResponse(context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -217,10 +268,12 @@ public Response exists(Duration timeout) { * fails. For more information, see the * Azure Docs. * - * @return A response containing status code and HTTP headers + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.create} */ - public VoidResponse create() { - return this.create(null, null, null); + public void create() { + createWithResponse(null, null, null, Context.NONE); } /** @@ -228,14 +281,20 @@ public VoidResponse create() { * fails. For more information, see the * Azure Docs. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.createWithResponse#Metadata-PublicAccessType-Duration-Context} + * * @param metadata {@link Metadata} * @param accessType Specifies how the data in this container is available to the public. See the * x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access. * @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 VoidResponse create(Metadata metadata, PublicAccessType accessType, Duration timeout) { - Mono response = containerAsyncClient.create(metadata, accessType); + public VoidResponse createWithResponse(Metadata metadata, PublicAccessType accessType, Duration timeout, + Context context) { + Mono response = containerAsyncClient.createWithResponse(metadata, accessType, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -245,10 +304,12 @@ public VoidResponse create(Metadata metadata, PublicAccessType accessType, Durat * during garbage collection. For more information, see the * Azure Docs. * - * @return A response containing status code and HTTP headers + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.delete} */ - public VoidResponse delete() { - return this.delete(null, null); + public void delete() { + deleteWithResponse(null, null, Context.NONE); } /** @@ -256,12 +317,18 @@ public VoidResponse delete() { * during garbage collection. For more information, see the * Azure Docs. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.deleteWithResponse#ContainerAccessConditions-Duration-Context} + * * @param accessConditions {@link ContainerAccessConditions} * @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 VoidResponse delete(ContainerAccessConditions accessConditions, Duration timeout) { - Mono response = containerAsyncClient.delete(accessConditions); + public VoidResponse deleteWithResponse(ContainerAccessConditions accessConditions, Duration timeout, + Context context) { + Mono response = containerAsyncClient.deleteWithResponse(accessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -270,24 +337,34 @@ public VoidResponse delete(ContainerAccessConditions accessConditions, Duration * Returns the container's metadata and system properties. For more information, see the * Azure Docs. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.getProperties} + * * @return The container properties. */ - public Response getProperties() { - return this.getProperties(null, null); + public ContainerProperties getProperties() { + return getPropertiesWithResponse(null, null, Context.NONE).getValue(); } /** * Returns the container's metadata and system properties. For more information, see the * Azure Docs. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.getPropertiesWithResponse#LeaseAccessConditions-Duration-Context} + * * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does * not match the active lease on the blob. * @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 container properties. */ - public Response getProperties(LeaseAccessConditions leaseAccessConditions, - Duration timeout) { - Mono> response = containerAsyncClient.getProperties(leaseAccessConditions); + public Response getPropertiesWithResponse(LeaseAccessConditions leaseAccessConditions, + Duration timeout, Context context) { + Mono> response = containerAsyncClient + .getPropertiesWithResponse(leaseAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -296,25 +373,33 @@ public Response getProperties(LeaseAccessConditions leaseAc * Sets the container's metadata. For more information, see the * Azure Docs. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.setMetadata#Metadata} + * * @param metadata {@link Metadata} - * @return A response containing status code and HTTP headers */ - public VoidResponse setMetadata(Metadata metadata) { - return this.setMetadata(metadata, null, null); + public void setMetadata(Metadata metadata) { + setMetadataWithResponse(metadata, null, null, Context.NONE); } /** * Sets the container's metadata. For more information, see the * Azure Docs. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.setMetadataWithResponse#Metadata-ContainerAccessConditions-Duration-Context} + * * @param metadata {@link Metadata} * @param accessConditions {@link ContainerAccessConditions} * @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 VoidResponse setMetadata(Metadata metadata, - ContainerAccessConditions accessConditions, Duration timeout) { - Mono response = containerAsyncClient.setMetadata(metadata, accessConditions); + public VoidResponse setMetadataWithResponse(Metadata metadata, + ContainerAccessConditions accessConditions, Duration timeout, Context context) { + Mono response = containerAsyncClient.setMetadataWithResponse(metadata, accessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -324,10 +409,14 @@ public VoidResponse setMetadata(Metadata metadata, * For more information, see the * Azure Docs. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.getAccessPolicy} + * * @return The container access policy. */ - public Response getAccessPolicy() { - return this.getAccessPolicy(null, null); + public ContainerAccessPolicies getAccessPolicy() { + return getAccessPolicyWithResponse(null, null, Context.NONE).getValue(); } /** @@ -335,14 +424,20 @@ public Response getAccessPolicy() { * For more information, see the * Azure Docs. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.getAccessPolicyWithResponse#LeaseAccessConditions-Duration-Context} + * * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does * not match the active lease on the blob. * @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 container access policy. */ - public Response getAccessPolicy(LeaseAccessConditions leaseAccessConditions, - Duration timeout) { - Mono> response = containerAsyncClient.getAccessPolicy(leaseAccessConditions); + public Response getAccessPolicyWithResponse(LeaseAccessConditions leaseAccessConditions, + Duration timeout, Context context) { + Mono> response = containerAsyncClient + .getAccessPolicyWithResponse(leaseAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -353,17 +448,20 @@ public Response getAccessPolicy(LeaseAccessConditions l * ensure the time formatting is compatible with the service. For more information, see the * Azure Docs. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.setAccessPolicy#PublicAccessType-List} + * * @param accessType Specifies how the data in this container is available to the public. See the * x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access. * @param identifiers A list of {@link SignedIdentifier} objects that specify the permissions for the container. * Please see * here * for more information. Passing null will clear all access policies. - * @return A response containing status code and HTTP headers */ - public VoidResponse setAccessPolicy(PublicAccessType accessType, - List identifiers) { - return this.setAccessPolicy(accessType, identifiers, null, null); + public void setAccessPolicy(PublicAccessType accessType, + List identifiers) { + setAccessPolicyWithResponse(accessType, identifiers, null, null, Context.NONE); } /** @@ -372,6 +470,10 @@ public VoidResponse setAccessPolicy(PublicAccessType accessType, * ensure the time formatting is compatible with the service. For more information, see the * Azure Docs. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.setAccessPolicyWithResponse#PublicAccessType-List-ContainerAccessConditions-Duration-Context} + * * @param accessType Specifies how the data in this container is available to the public. See the * x-ms-blob-public-access header in the Azure Docs for more information. Pass null for no public access. * @param identifiers A list of {@link SignedIdentifier} objects that specify the permissions for the container. @@ -380,19 +482,21 @@ public VoidResponse setAccessPolicy(PublicAccessType accessType, * for more information. Passing null will clear all access policies. * @param accessConditions {@link ContainerAccessConditions} * @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 VoidResponse setAccessPolicy(PublicAccessType accessType, - List identifiers, ContainerAccessConditions accessConditions, - Duration timeout) { - Mono response = containerAsyncClient.setAccessPolicy(accessType, identifiers, accessConditions); + public VoidResponse setAccessPolicyWithResponse(PublicAccessType accessType, + List identifiers, ContainerAccessConditions accessConditions, + Duration timeout, Context context) { + Mono response = containerAsyncClient + .setAccessPolicyWithResponse(accessType, identifiers, accessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } /** * Returns a lazy loaded list of blobs in this container, with folder structures flattened. The returned {@link - * Iterable} can be iterated through while new items are automatically retrieved as needed. + * PagedIterable} can be consumed through while new items are automatically retrieved as needed. * *

    * Blob names are returned in lexicographic order. @@ -401,15 +505,19 @@ public VoidResponse setAccessPolicy(PublicAccessType accessType, * For more information, see the * Azure Docs. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.listBlobsFlat} + * * @return The listed blobs, flattened. */ - public Iterable listBlobsFlat() { + public PagedIterable listBlobsFlat() { return this.listBlobsFlat(new ListBlobsOptions(), null); } /** * Returns a lazy loaded list of blobs in this container, with folder structures flattened. The returned {@link - * Iterable} can be iterated through while new items are automatically retrieved as needed. + * PagedIterable} can be consumed through while new items are automatically retrieved as needed. * *

    * Blob names are returned in lexicographic order. @@ -418,14 +526,16 @@ public Iterable listBlobsFlat() { * For more information, see the * Azure Docs. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.listBlobsFlat#ListBlobsOptions-Duration} + * * @param options {@link ListBlobsOptions} * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return The listed blobs, flattened. */ - public Iterable listBlobsFlat(ListBlobsOptions options, Duration timeout) { - Flux response = containerAsyncClient.listBlobsFlat(options); - - return timeout == null ? response.toIterable() : response.timeout(timeout).toIterable(); + public PagedIterable listBlobsFlat(ListBlobsOptions options, Duration timeout) { + return new PagedIterable<>(containerAsyncClient.listBlobsFlatWithOptionalTimeout(options, timeout)); } /** @@ -452,11 +562,15 @@ public Iterable listBlobsFlat(ListBlobsOptions options, Duration timeo *
  • foo/foo2 (isPrefix = false) * * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.listBlobsHierarchy#String} + * * @param directory The directory to list blobs underneath * @return A reactive response emitting the prefixes and blobs. */ - public Iterable listBlobsHierarchy(String directory) { - return this.listBlobsHierarchy("/", new ListBlobsOptions().prefix(directory), null); + public PagedIterable listBlobsHierarchy(String directory) { + return this.listBlobsHierarchy("/", new ListBlobsOptions().setPrefix(directory), null); } /** @@ -483,34 +597,45 @@ public Iterable listBlobsHierarchy(String directory) { *
  • foo/foo2 (isPrefix = false) * * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.listBlobsHierarchy#String-ListBlobsOptions-Duration} + * * @param delimiter The delimiter for blob hierarchy, "/" for hierarchy based on directories * @param options {@link ListBlobsOptions} * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return A reactive response emitting the prefixes and blobs. */ - public Iterable listBlobsHierarchy(String delimiter, ListBlobsOptions options, Duration timeout) { - Flux response = containerAsyncClient.listBlobsHierarchy(delimiter, options); - - return timeout == null ? response.toIterable() : response.timeout(timeout).toIterable(); + public PagedIterable listBlobsHierarchy(String delimiter, ListBlobsOptions options, Duration timeout) { + return new PagedIterable<>(containerAsyncClient + .listBlobsHierarchyWithOptionalTimeout(delimiter, options, timeout)); } /** * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 * seconds, or infinite (-1). * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.acquireLease#String-int} + * * @param proposedId A {@code String} in any valid GUID format. May be null. * @param duration The duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A * non-infinite lease can be between 15 and 60 seconds. * @return The lease ID. */ - public Response acquireLease(String proposedId, int duration) { - return this.acquireLease(proposedId, duration, null, null); + public String acquireLease(String proposedId, int duration) { + return acquireLeaseWithResponse(proposedId, duration, null, null, Context.NONE).getValue(); } /** * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 * seconds, or infinite (-1). * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.acquireLeaseWithResponse#String-int-ModifiedAccessConditions-Duration-Context} + * * @param proposedID A {@code String} in any valid GUID format. May be null. * @param duration The duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A * non-infinite lease can be between 15 and 60 seconds. @@ -518,12 +643,13 @@ public Response acquireLease(String proposedId, int duration) { * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @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 lease ID. */ - public Response acquireLease(String proposedID, int duration, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { + public Response acquireLeaseWithResponse(String proposedID, int duration, + ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { Mono> response = containerAsyncClient - .acquireLease(proposedID, duration, modifiedAccessConditions); + .acquireLeaseWithResponse(proposedID, duration, modifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -531,16 +657,24 @@ public Response acquireLease(String proposedID, int duration, /** * Renews the blob's previously-acquired lease. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.renewLease#String} + * * @param leaseID The leaseId of the active lease on the blob. * @return The renewed lease ID. */ - public Response renewLease(String leaseID) { - return this.renewLease(leaseID, null, null); + public String renewLease(String leaseID) { + return renewLease(leaseID, null, null); } /** * Renews the blob's previously-acquired lease. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.renewLease#String-ModifiedAccessConditions-Duration} + * * @param leaseID The leaseId of the active lease on the blob. * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given @@ -548,10 +682,29 @@ public Response renewLease(String leaseID) { * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return The renewed lease ID. */ - public Response renewLease(String leaseID, ModifiedAccessConditions modifiedAccessConditions, - Duration timeout) { + public String renewLease(String leaseID, ModifiedAccessConditions modifiedAccessConditions, + Duration timeout) { + return renewLeaseWithResponse(leaseID, modifiedAccessConditions, timeout, Context.NONE).getValue(); + } + + /** + * Renews the blob's previously-acquired lease. + * + *

    Code Samples

    + * {@codesnippet com.azure.storage.blob.ContainerClient.renewLeaseWithResponse#String-ModifiedAccessConditions-Duration-Context} + * + * @param leaseID The leaseId of the active lease on the blob. + * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and + * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given + * request. The request will fail if the specified condition is not satisfied. + * @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 renewed lease ID. + */ + public Response renewLeaseWithResponse(String leaseID, ModifiedAccessConditions modifiedAccessConditions, + Duration timeout, Context context) { Mono> response = containerAsyncClient - .renewLease(leaseID, modifiedAccessConditions); + .renewLeaseWithResponse(leaseID, modifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -559,27 +712,35 @@ public Response renewLease(String leaseID, ModifiedAccessConditions modi /** * Releases the blob's previously-acquired lease. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.releaseLease#String} + * * @param leaseID The leaseId of the active lease on the blob. - * @return A response containing status code and HTTP headers */ - public VoidResponse releaseLease(String leaseID) { - return this.releaseLease(leaseID, null, null); + public void releaseLease(String leaseID) { + releaseLeaseWithResponse(leaseID, null, null, Context.NONE); } /** * Releases the blob's previously-acquired lease. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.releaseLeaseWithResponse#String-ModifiedAccessConditions-Duration-Context} + * * @param leaseID The leaseId of the active lease on the blob. * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @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 VoidResponse releaseLease(String leaseID, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { + public VoidResponse releaseLeaseWithResponse(String leaseID, + ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { Mono response = containerAsyncClient - .releaseLease(leaseID, modifiedAccessConditions); + .releaseLeaseWithResponse(leaseID, modifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -588,16 +749,24 @@ public VoidResponse releaseLease(String leaseID, * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant * to break a fixed-duration lease when it expires or an infinite lease immediately. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.breakLease} + * * @return The remaining time in the broken lease. */ - public Response breakLease() { - return this.breakLease(null, null, null); + public Duration breakLease() { + return breakLeaseWithResponse(null, null, null, Context.NONE).getValue(); } /** * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant * to break a fixed-duration lease when it expires or an infinite lease immediately. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.breakLeaseWithResponse#Integer-ModifiedAccessConditions-Duration-Context} + * * @param breakPeriodInSeconds An optional {@code Integer} representing the proposed duration of seconds that the * lease should continue before it is broken, between 0 and 60 seconds. This break period is only used if it is * shorter than the time remaining on the lease. If longer, the time remaining on the lease is used. A new lease @@ -607,12 +776,13 @@ public Response breakLease() { * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @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 remaining time in the broken lease. */ - public Response breakLease(Integer breakPeriodInSeconds, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { + public Response breakLeaseWithResponse(Integer breakPeriodInSeconds, + ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { Mono> response = containerAsyncClient - .breakLease(breakPeriodInSeconds, modifiedAccessConditions); + .breakLeaseWithResponse(breakPeriodInSeconds, modifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -620,17 +790,25 @@ public Response breakLease(Integer breakPeriodInSeconds, /** * ChangeLease changes the blob's lease ID. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.changeLease#String-String} + * * @param leaseId The leaseId of the active lease on the blob. * @param proposedID A {@code String} in any valid GUID format. * @return The new lease ID. */ - public Response changeLease(String leaseId, String proposedID) { - return this.changeLease(leaseId, proposedID, null, null); + public String changeLease(String leaseId, String proposedID) { + return changeLeaseWithResponse(leaseId, proposedID, null, null, Context.NONE).getValue(); } /** - * ChangeLease changes the blob's lease ID. For more information, see the Azure - * Docs. + * ChangeLease changes the blob's lease ID. For more information, see the + * Azure Docs. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.changeLeaseWithResponse#String-String-ModifiedAccessConditions-Duration-Context} * * @param leaseId The leaseId of the active lease on the blob. * @param proposedID A {@code String} in any valid GUID format. @@ -638,12 +816,13 @@ public Response changeLease(String leaseId, String proposedID) { * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @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 new lease ID. */ - public Response changeLease(String leaseId, String proposedID, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { + public Response changeLeaseWithResponse(String leaseId, String proposedID, + ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { Mono> response = containerAsyncClient - .changeLease(leaseId, proposedID, modifiedAccessConditions); + .changeLeaseWithResponse(leaseId, proposedID, modifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -653,10 +832,30 @@ public Response changeLease(String leaseId, String proposedID, * Azure Docs. * * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.getAccountInfo#Duration} + * @return The account info. + */ + public StorageAccountInfo getAccountInfo(Duration timeout) { + return getAccountInfoWithResponse(timeout, Context.NONE).getValue(); + } + + /** + * Returns the sku name and account kind for the account. For more information, please see the + * Azure Docs. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.getAccountInfoWithResponse#Duration-Context} + * + * @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 account info. */ - public Response getAccountInfo(Duration timeout) { - Mono> response = containerAsyncClient.getAccountInfo(); + public Response getAccountInfoWithResponse(Duration timeout, Context context) { + Mono> response = containerAsyncClient.getAccountInfoWithResponse(context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -671,7 +870,7 @@ public Response getAccountInfo(Duration timeout) { * @return A string that represents the SAS token */ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName, - ContainerSASPermission permissions, OffsetDateTime expiryTime) { + ContainerSASPermission permissions, OffsetDateTime expiryTime) { return this.containerAsyncClient.generateUserDelegationSAS(userDelegationKey, accountName, permissions, expiryTime); } @@ -690,8 +889,8 @@ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, Str * @return A string that represents the SAS token */ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName, - ContainerSASPermission permissions, OffsetDateTime expiryTime, OffsetDateTime startTime, String version, - SASProtocol sasProtocol, IPRange ipRange) { + ContainerSASPermission permissions, OffsetDateTime expiryTime, OffsetDateTime startTime, String version, + SASProtocol sasProtocol, IPRange ipRange) { return this.containerAsyncClient.generateUserDelegationSAS(userDelegationKey, accountName, permissions, expiryTime, startTime, version, sasProtocol, ipRange); } @@ -699,6 +898,14 @@ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, Str /** * Generates a user delegation SAS token with the specified parameters * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.generateUserDelegationSAS#UserDelegationKey-String-ContainerSASPermission-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 ContainerSASPermissions} permission for the SAS @@ -715,9 +922,9 @@ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, Str * @return A string that represents the SAS token */ public String generateUserDelegationSAS(UserDelegationKey userDelegationKey, String accountName, - ContainerSASPermission permissions, OffsetDateTime expiryTime, OffsetDateTime startTime, String version, - SASProtocol sasProtocol, IPRange ipRange, String cacheControl, String contentDisposition, - String contentEncoding, String contentLanguage, String contentType) { + ContainerSASPermission permissions, OffsetDateTime expiryTime, OffsetDateTime startTime, String version, + SASProtocol sasProtocol, IPRange ipRange, String cacheControl, String contentDisposition, + String contentEncoding, String contentLanguage, String contentType) { return this.containerAsyncClient.generateUserDelegationSAS(userDelegationKey, accountName, permissions, expiryTime, startTime, version, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType); @@ -757,7 +964,7 @@ public String generateSAS(String identifier) { * @return A string that represents the SAS token */ public String generateSAS(String identifier, ContainerSASPermission permissions, OffsetDateTime expiryTime, - OffsetDateTime startTime, String version, SASProtocol sasProtocol, IPRange ipRange) { + OffsetDateTime startTime, String version, SASProtocol sasProtocol, IPRange ipRange) { return this.containerAsyncClient.generateSAS(identifier, permissions, expiryTime, startTime, version, sasProtocol, ipRange); } @@ -765,6 +972,13 @@ public String generateSAS(String identifier, ContainerSASPermission permissions, /** * Generates a SAS token with the specified parameters * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClient.generateSAS#String-ContainerSASPermission-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 ContainerSASPermissions} permission for the SAS * @param expiryTime The {@code OffsetDateTime} expiry time for the SAS @@ -780,8 +994,8 @@ public String generateSAS(String identifier, ContainerSASPermission permissions, * @return A string that represents the SAS token */ public String generateSAS(String identifier, ContainerSASPermission permissions, OffsetDateTime expiryTime, - OffsetDateTime startTime, String version, SASProtocol sasProtocol, IPRange ipRange, String cacheControl, - String contentDisposition, String contentEncoding, String contentLanguage, String contentType) { + OffsetDateTime startTime, String version, SASProtocol sasProtocol, IPRange ipRange, String cacheControl, + String contentDisposition, String contentEncoding, String contentLanguage, String contentType) { return this.containerAsyncClient.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/ContainerClientBuilder.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerClientBuilder.java index 1c61dd618a46..ec4d7eb9551b 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerClientBuilder.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerClientBuilder.java @@ -3,82 +3,53 @@ package com.azure.storage.blob; -import com.azure.core.credentials.TokenCredential; -import com.azure.core.http.HttpClient; import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLoggingPolicy; -import com.azure.core.http.policy.HttpPipelinePolicy; -import com.azure.core.http.policy.RequestIdPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.implementation.util.ImplUtils; -import com.azure.core.util.configuration.Configuration; -import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.core.implementation.annotation.ServiceClientBuilder; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; import com.azure.storage.common.credentials.SASTokenCredential; -import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.common.policy.RequestRetryOptions; -import com.azure.storage.common.policy.RequestRetryPolicy; -import com.azure.storage.common.policy.SASTokenCredentialPolicy; -import com.azure.storage.common.policy.SharedKeyCredentialPolicy; import java.net.MalformedURLException; import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; import java.util.Objects; /** - * Fluent ContainerClientBuilder for instantiating a {@link ContainerClient} or {@link ContainerAsyncClient} - * using {@link ContainerClientBuilder#buildClient()} or {@link ContainerClientBuilder#buildAsyncClient()} respectively. + * Fluent ContainerClientBuilder for instantiating a {@link ContainerClient} or {@link ContainerAsyncClient} using + * {@link ContainerClientBuilder#buildClient()} or {@link ContainerClientBuilder#buildAsyncClient()} respectively. * *

    * The following information must be provided on this builder: * *

      - *
    • the endpoint through {@code .endpoint()}, including the container name, in the format of {@code https://{accountName}.blob.core.windows.net/{containerName}}. - *
    • the credential through {@code .credential()} or {@code .connectionString()} if the container is not publicly accessible. + *
    • the endpoint through {@code .endpoint()}, including the container name, in the format of {@code + * https://{accountName}.blob.core.windows.net/{containerName}}. + *
    • the credential through {@code .credential()} or {@code .connectionString()} if the container is not publicly + * accessible. *
    * *

    - * Once all the configurations are set on this builder, call {@code .buildClient()} to create a - * {@link ContainerClient} or {@code .buildAsyncClient()} to create a {@link ContainerAsyncClient}. + * Once all the configurations are set on this builder, call {@code .buildClient()} to create a {@link ContainerClient} + * or {@code .buildAsyncClient()} to create a {@link ContainerAsyncClient}. */ -public final class ContainerClientBuilder { - private static final String ACCOUNT_NAME = "accountname"; - private static final String ACCOUNT_KEY = "accountkey"; - private static final String ENDPOINT_PROTOCOL = "defaultendpointsprotocol"; - private static final String ENDPOINT_SUFFIX = "endpointsuffix"; +@ServiceClientBuilder(serviceClients = {ContainerClient.class, ContainerAsyncClient.class}) +public final class ContainerClientBuilder extends BaseBlobClientBuilder { - private final List policies; + private final ClientLogger logger = new ClientLogger(ContainerClientBuilder.class); - private String endpoint; private String containerName; - private SharedKeyCredential sharedKeyCredential; - private TokenCredential tokenCredential; - private SASTokenCredential sasTokenCredential; - private HttpClient httpClient; - private HttpLogDetailLevel logLevel; - private RequestRetryOptions retryOptions; - private Configuration configuration; /** - * Creates a builder instance that is able to configure and construct {@link ContainerClient ContainerClients} - * and {@link ContainerAsyncClient ContainerAsyncClients}. + * Creates a builder instance that is able to configure and construct {@link ContainerClient ContainerClients} and + * {@link ContainerAsyncClient ContainerAsyncClients}. */ public ContainerClientBuilder() { - retryOptions = new RequestRetryOptions(); - logLevel = HttpLogDetailLevel.NONE; - policies = new ArrayList<>(); } /** + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClientBuilder.buildClient} + * * @return a {@link ContainerClient} created from the configurations in this builder. */ public ContainerClient buildClient() { @@ -86,67 +57,54 @@ public ContainerClient buildClient() { } /** + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClientBuilder.buildAsyncClient} + * * @return a {@link ContainerAsyncClient} created from the configurations in this builder. */ public ContainerAsyncClient buildAsyncClient() { - Objects.requireNonNull(endpoint); Objects.requireNonNull(containerName); - // Closest to API goes first, closest to wire goes last. - final List policies = new ArrayList<>(); - - if (configuration == null) { - configuration = ConfigurationManager.getConfiguration(); - } - policies.add(new UserAgentPolicy(BlobConfiguration.NAME, BlobConfiguration.VERSION, configuration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddDatePolicy()); - - if (sharedKeyCredential != null) { - policies.add(new SharedKeyCredentialPolicy(sharedKeyCredential)); - } else if (tokenCredential != null) { - policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, String.format("%s/.default", endpoint))); - } else if (sasTokenCredential != null) { - policies.add(new SASTokenCredentialPolicy(sasTokenCredential)); + HttpPipeline pipeline = super.getPipeline(); + if (pipeline == null) { + pipeline = super.buildPipeline(); } - policies.add(new RequestRetryPolicy(retryOptions)); - - policies.addAll(this.policies); - policies.add(new HttpLoggingPolicy(logLevel)); - - HttpPipeline pipeline = new HttpPipelineBuilder() - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .build(); - return new ContainerAsyncClient(new AzureBlobStorageBuilder() .url(String.format("%s/%s", endpoint, containerName)) .pipeline(pipeline) - .build()); + .build(), cpk); } /** * Sets the service endpoint, additionally parses it for information (SAS token, container name) + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClientBuilder.endpoint#String} + * * @param endpoint URL of the service * @return the updated ContainerClientBuilder object * @throws IllegalArgumentException If {@code endpoint} is {@code null} or is a malformed URL. */ + @Override public ContainerClientBuilder endpoint(String endpoint) { try { URL url = new URL(endpoint); BlobURLParts parts = URLParser.parse(url); - this.endpoint = parts.scheme() + "://" + parts.host(); - this.containerName = parts.containerName(); + this.endpoint = parts.getScheme() + "://" + parts.getHost(); + this.containerName = parts.getContainerName(); - this.sasTokenCredential = SASTokenCredential.fromSASTokenString(parts.sasQueryParameters().encode()); - if (this.sasTokenCredential != null) { - this.tokenCredential = null; - this.sharedKeyCredential = null; + SASTokenCredential sasTokenCredential = SASTokenCredential + .fromSASTokenString(parts.getSasQueryParameters().encode()); + if (sasTokenCredential != null) { + super.credential(sasTokenCredential); } } catch (MalformedURLException ex) { - throw new IllegalArgumentException("The Azure Storage Blob endpoint url is malformed."); + throw logger.logExceptionAsError( + new IllegalArgumentException("The Azure Storage Blob endpoint url is malformed.")); } return this; @@ -154,6 +112,11 @@ public ContainerClientBuilder endpoint(String endpoint) { /** * Sets the name of the container this client is connecting to. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.ContainerClientBuilder.containerName#String} + * * @param containerName the name of the container * @return the updated ContainerClientBuilder object */ @@ -165,141 +128,4 @@ public ContainerClientBuilder containerName(String containerName) { String endpoint() { return this.endpoint; } - - /** - * Sets the credential used to authorize requests sent to the service - * @param credential authorization credential - * @return the updated ContainerClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null}. - */ - public ContainerClientBuilder credential(SharedKeyCredential credential) { - this.sharedKeyCredential = Objects.requireNonNull(credential); - this.tokenCredential = null; - this.sasTokenCredential = null; - return this; - } - - /** - * Sets the credential used to authorize requests sent to the service - * @param credential authorization credential - * @return the updated ContainerClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null}. - */ - public ContainerClientBuilder credential(TokenCredential credential) { - this.tokenCredential = Objects.requireNonNull(credential); - this.sharedKeyCredential = null; - this.sasTokenCredential = null; - return this; - } - - /** - * Sets the credential used to authorize requests sent to the service - * @param credential authorization credential - * @return the updated ContainerClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null}. - */ - public ContainerClientBuilder credential(SASTokenCredential credential) { - this.sasTokenCredential = Objects.requireNonNull(credential); - this.sharedKeyCredential = null; - this.tokenCredential = null; - return this; - } - - /** - * Clears the credential used to authorize requests sent to the service - * @return the updated ContainerClientBuilder object - */ - public ContainerClientBuilder anonymousCredential() { - this.sharedKeyCredential = null; - this.tokenCredential = null; - this.sasTokenCredential = null; - return this; - } - - /** - * Sets the connection string for the service, parses it for authentication information (account name, account key) - * @param connectionString connection string from access keys section - * @return the updated ContainerClientBuilder object - * @throws IllegalArgumentException If {@code connectionString} doesn't contain AccountName or AccountKey - */ - public ContainerClientBuilder connectionString(String connectionString) { - Objects.requireNonNull(connectionString); - - Map connectionKVPs = new HashMap<>(); - for (String s : connectionString.split(";")) { - String[] kvp = s.split("=", 2); - connectionKVPs.put(kvp[0].toLowerCase(Locale.ROOT), kvp[1]); - } - - String accountName = connectionKVPs.get(ACCOUNT_NAME); - String accountKey = connectionKVPs.get(ACCOUNT_KEY); - String endpointProtocol = connectionKVPs.get(ENDPOINT_PROTOCOL); - String endpointSuffix = connectionKVPs.get(ENDPOINT_SUFFIX); - - if (ImplUtils.isNullOrEmpty(accountName) || ImplUtils.isNullOrEmpty(accountKey)) { - throw new IllegalArgumentException("Connection string must contain 'AccountName' and 'AccountKey'."); - } - - if (!ImplUtils.isNullOrEmpty(endpointProtocol) && !ImplUtils.isNullOrEmpty(endpointSuffix)) { - String endpoint = String.format("%s://%s.blob.%s", endpointProtocol, accountName, endpointSuffix.replaceFirst("^\\.", "")); - endpoint(endpoint); - } - - // Use accountName and accountKey to get the SAS token using the credential class. - return credential(new SharedKeyCredential(accountName, accountKey)); - } - - /** - * Sets the http client used to send service requests - * @param httpClient http client to send requests - * @return the updated ContainerClientBuilder object - * @throws NullPointerException If {@code httpClient} is {@code null}. - */ - public ContainerClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = Objects.requireNonNull(httpClient); - return this; - } - - /** - * Adds a pipeline policy to apply on each request sent - * @param pipelinePolicy a pipeline policy - * @return the updated ContainerClientBuilder object - * @throws NullPointerException If {@code pipelinePolicy} is {@code null}. - */ - public ContainerClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { - this.policies.add(Objects.requireNonNull(pipelinePolicy)); - return this; - } - - /** - * Sets the logging level for service requests - * @param logLevel logging level - * @return the updated ContainerClientBuilder object - */ - public ContainerClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { - this.logLevel = logLevel; - return this; - } - - /** - * Sets the configuration object used to retrieve environment configuration values used to buildClient the client with - * when they are not set in the appendBlobClientBuilder, defaults to Configuration.NONE - * @param configuration configuration store - * @return the updated ContainerClientBuilder object - */ - public ContainerClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /** - * Sets the request retry options for all the requests made through the client. - * @param retryOptions the options to configure retry behaviors - * @return the updated ContainerClientBuilder object - * @throws NullPointerException If {@code retryOptions} is {@code null}. - */ - public ContainerClientBuilder retryOptions(RequestRetryOptions retryOptions) { - this.retryOptions = Objects.requireNonNull(retryOptions); - return this; - } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerProperties.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerProperties.java index 9aae7ae17a8c..eeb59f84187c 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerProperties.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerProperties.java @@ -4,31 +4,84 @@ package com.azure.storage.blob; import com.azure.storage.blob.models.ContainerGetPropertiesHeaders; +import com.azure.storage.blob.models.LeaseDurationType; +import com.azure.storage.blob.models.LeaseStateType; +import com.azure.storage.blob.models.LeaseStatusType; +import com.azure.storage.blob.models.Metadata; import com.azure.storage.blob.models.PublicAccessType; import java.time.OffsetDateTime; public final class ContainerProperties { + private final Metadata metadata; + private final String eTag; + private final OffsetDateTime lastModified; + private final LeaseDurationType leaseDuration; + private final LeaseStateType leaseState; + private final LeaseStatusType leaseStatus; private final PublicAccessType blobPublicAccess; - private final boolean hasImmutabilityPolicy; - private final boolean hasLegalHold; - private final OffsetDateTime lastModified; - ContainerProperties(ContainerGetPropertiesHeaders generatedResponseHeaders) { - this.blobPublicAccess = generatedResponseHeaders.blobPublicAccess(); - this.hasImmutabilityPolicy = generatedResponseHeaders.hasImmutabilityPolicy(); - this.hasLegalHold = generatedResponseHeaders.hasLegalHold(); - this.lastModified = generatedResponseHeaders.lastModified(); + this.metadata = new Metadata(generatedResponseHeaders.getMetadata()); + this.eTag = generatedResponseHeaders.getETag(); + this.lastModified = generatedResponseHeaders.getLastModified(); + this.leaseDuration = generatedResponseHeaders.getLeaseDuration(); + this.leaseState = generatedResponseHeaders.getLeaseState(); + this.leaseStatus = generatedResponseHeaders.getLeaseStatus(); + this.blobPublicAccess = generatedResponseHeaders.getBlobPublicAccess(); + this.hasImmutabilityPolicy = generatedResponseHeaders.isHasImmutabilityPolicy(); + this.hasLegalHold = generatedResponseHeaders.isHasLegalHold(); + } + + /** + * @return the metadata associated with the container + */ + public Metadata getMetadata() { + return metadata; + } + + /** + * @return the eTag of the container + */ + public String getETag() { + return eTag; + } + + /** + * @return the time the container was last modified + */ + public OffsetDateTime getLastModified() { + return lastModified; + } + + /** + * @return the type of lease on the container + */ + public LeaseDurationType getLeaseDuration() { + return leaseDuration; + } + + /** + * @return the lease state of the container + */ + public LeaseStateType getLeaseState() { + return leaseState; + } + + /** + * @return the lease status of the container + */ + public LeaseStatusType getLeaseStatus() { + return leaseStatus; } /** * @return the access type for the container */ - public PublicAccessType blobPublicAccess() { + public PublicAccessType getBlobPublicAccess() { return blobPublicAccess; } @@ -46,10 +99,7 @@ public boolean hasLegalHold() { return hasLegalHold; } - /** - * @return the time the container was last modified - */ - public OffsetDateTime lastModified() { - return lastModified; - } + + + } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerSASPermission.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerSASPermission.java index c6031c9edd37..83d90b1408e2 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerSASPermission.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerSASPermission.java @@ -4,14 +4,16 @@ package com.azure.storage.blob; +import com.azure.storage.common.SR; + import java.util.Locale; /** * This is a helper class to construct a string representing the permissions granted by a ServiceSAS to a container. * 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 a - * {@link ServiceSASSignatureValues} 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. + * Once all the values are set, this should be serialized with toString and set as the permissions field on a {@link + * BlobServiceSASSignatureValues} 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 ContainerSASPermission { private boolean read; @@ -36,9 +38,7 @@ public ContainerSASPermission() { * Creates an {@code ContainerSASPermission} 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 ContainerSASPermission}. - * + * @param permString A {@code String} which represents the {@code ContainerSASPermission}. * @return A {@code ContainerSASPermission} generated from the given {@code String}. * @throws IllegalArgumentException If {@code permString} contains a character other than r, a, c, w, d, or l. */ @@ -68,7 +68,8 @@ public static ContainerSASPermission parse(String permString) { break; default: throw new IllegalArgumentException( - String.format(Locale.ROOT, SR.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, "Permissions", permString, c)); + String.format(Locale.ROOT, SR.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, + "Permissions", permString, c)); } } return permissions; @@ -77,7 +78,7 @@ public static ContainerSASPermission parse(String permString) { /** * @return the read permission status */ - public boolean read() { + public boolean getRead() { return read; } @@ -87,7 +88,7 @@ public boolean read() { * @param read Permission status to set * @return the updated ContainerSASPermission object */ - public ContainerSASPermission read(boolean read) { + public ContainerSASPermission setRead(boolean read) { this.read = read; return this; } @@ -95,7 +96,7 @@ public ContainerSASPermission read(boolean read) { /** * @return the add permission status */ - public boolean add() { + public boolean getAdd() { return add; } @@ -105,7 +106,7 @@ public boolean add() { * @param add Permission status to set * @return the updated ContainerSASPermission object */ - public ContainerSASPermission add(boolean add) { + public ContainerSASPermission setAdd(boolean add) { this.add = add; return this; } @@ -113,7 +114,7 @@ public ContainerSASPermission add(boolean add) { /** * @return the create permission status */ - public boolean create() { + public boolean getCreate() { return create; } @@ -123,7 +124,7 @@ public boolean create() { * @param create Permission status to set * @return the updated ContainerSASPermission object */ - public ContainerSASPermission create(boolean create) { + public ContainerSASPermission setCreate(boolean create) { this.create = create; return this; } @@ -131,7 +132,7 @@ public ContainerSASPermission create(boolean create) { /** * @return the write permission status */ - public boolean write() { + public boolean getWrite() { return write; } @@ -141,7 +142,7 @@ public boolean write() { * @param write Permission status to set * @return the updated ContainerSASPermission object */ - public ContainerSASPermission write(boolean write) { + public ContainerSASPermission setWrite(boolean write) { this.write = write; return this; } @@ -149,7 +150,7 @@ public ContainerSASPermission write(boolean write) { /** * @return the delete permission status */ - public boolean delete() { + public boolean getDelete() { return delete; } @@ -159,7 +160,7 @@ public boolean delete() { * @param delete Permission status to set * @return the updated ContainerSASPermission object */ - public ContainerSASPermission delete(boolean delete) { + public ContainerSASPermission setDelete(boolean delete) { this.delete = delete; return this; } @@ -167,7 +168,7 @@ public ContainerSASPermission delete(boolean delete) { /** * @return the list permission status */ - public boolean list() { + public boolean getList() { return list; } @@ -177,7 +178,7 @@ public boolean list() { * @param list Permission status to set * @return the updated ContainerSASPermission object */ - public ContainerSASPermission list(boolean list) { + public ContainerSASPermission setList(boolean list) { this.list = list; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/DownloadAsyncResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/DownloadAsyncResponse.java index 1daacb95051d..472ae3124b42 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/DownloadAsyncResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/DownloadAsyncResponse.java @@ -9,42 +9,43 @@ import com.azure.storage.blob.models.BlobRange; import com.azure.storage.blob.models.ReliableDownloadOptions; import com.azure.storage.common.Utility; -import io.netty.buffer.ByteBuf; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.io.IOException; +import java.nio.ByteBuffer; import java.util.Map; import java.util.function.Function; /** * {@code DownloadAsyncResponse} wraps the protocol-layer response from {@link BlobAsyncClient#download(BlobRange, - * ReliableDownloadOptions, BlobAccessConditions, boolean)} to automatically retry failed reads from the body as - * appropriate. If the download is interrupted, the {@code DownloadAsyncResponse} will make a request to resume the download - * from where it left off, allowing the user to consume the data as one continuous stream, for any interruptions are - * hidden. The retry behavior is defined by the options passed to the {@link #body(ReliableDownloadOptions)}. The - * download will also lock on the blob's etag to ensure consistency. + * BlobAccessConditions, boolean)} to automatically retry failed reads from the body as appropriate. If the download is + * interrupted, the {@code DownloadAsyncResponse} will make a request to resume the download from where it left off, + * allowing the user to consume the data as one continuous stream, for any interruptions are hidden. The retry behavior + * is defined by the options passed to the {@link #body(ReliableDownloadOptions)}. The download will also lock on the + * blob's etag to ensure consistency. *

    * Note that the retries performed as a part of this reader are composed with those of any retries in an {@link - * com.azure.core.http.HttpPipeline} used in conjunction with this reader. That is, if this object issues a request to resume a download, - * an underlying pipeline may issue several retries as a part of that request. Furthermore, this reader only retries on - * network errors; timeouts and unexpected status codes are not retried. Therefore, the behavior of this reader is - * entirely independent of and in no way coupled to an {@link com.azure.core.http.HttpPipeline}'s retry mechanism. + * com.azure.core.http.HttpPipeline} used in conjunction with this reader. That is, if this object issues a request to + * resume a download, an underlying pipeline may issue several retries as a part of that request. Furthermore, this + * reader only retries on network errors; timeouts and unexpected status codes are not retried. Therefore, the behavior + * of this reader is entirely independent of and in no way coupled to an {@link com.azure.core.http.HttpPipeline}'s + * retry mechanism. */ public final class DownloadAsyncResponse { private final HTTPGetterInfo info; - private final ResponseBase> rawResponse; + private final ResponseBase> rawResponse; 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) { + DownloadAsyncResponse(ResponseBase> response, + HTTPGetterInfo info, Function> getter) { Utility.assertNotNull("getter", getter); Utility.assertNotNull("info", info); - Utility.assertNotNull("info.eTag", info.eTag()); + Utility.assertNotNull("info.eTag", info.getETag()); this.rawResponse = response; this.info = info; this.getter = getter; @@ -56,12 +57,12 @@ public final class DownloadAsyncResponse { * will make additional requests to reestablish a connection and continue reading. * * @param options {@link ReliableDownloadOptions} - * @return A {@link Flux} which emits the data as {@link ByteBuf ByteBufs} + * @return A {@link Flux} which emits the data as {@link ByteBuffer ByteBuffers} */ - public Flux body(ReliableDownloadOptions options) { + public Flux body(ReliableDownloadOptions options) { ReliableDownloadOptions optionsReal = options == null ? new ReliableDownloadOptions() : options; if (optionsReal.maxRetryRequests() == 0) { - return this.rawResponse.value(); + return this.rawResponse.getValue(); } /* @@ -69,10 +70,10 @@ public Flux body(ReliableDownloadOptions options) { retries as we have not actually retried yet, only made the initial try. Because applyReliableDownload() will add 1 before calling into tryContinueFlux, we set the initial value to -1. */ - return this.applyReliableDownload(this.rawResponse.value(), -1, optionsReal); + return this.applyReliableDownload(this.rawResponse.getValue(), -1, optionsReal); } - private Flux tryContinueFlux(Throwable t, int retryCount, ReliableDownloadOptions options) { + private Flux tryContinueFlux(Throwable t, int retryCount, ReliableDownloadOptions options) { // If all the errors are exhausted, return this error to the user. if (retryCount > options.maxRetryRequests() || !(t instanceof IOException)) { return Flux.error(t); @@ -88,7 +89,8 @@ possible the method call that returns a Single is what throws (like how our apis Do not compound the number of retries by passing in another set of downloadOptions; just get the raw body. */ - return getter.apply(this.info).flatMapMany(response -> this.applyReliableDownload(this.rawResponse.value(), retryCount, options)); + return getter.apply(this.info).flatMapMany(response -> this + .applyReliableDownload(this.rawResponse.getValue(), retryCount, options)); } catch (Exception e) { // If the getter fails, return the getter failure to the user. return Flux.error(e); @@ -96,15 +98,16 @@ possible the method call that returns a Single is what throws (like how our apis } } - private Flux applyReliableDownload(Flux data, int currentRetryCount, ReliableDownloadOptions options) { + private Flux applyReliableDownload(Flux data, int currentRetryCount, + ReliableDownloadOptions options) { return data.doOnNext(buffer -> { /* Update how much data we have received in case we need to retry and propagate to the user the data we have received. */ - this.info.offset(this.info.offset() + buffer.readableBytes()); // was `remaining()` in Rx world - if (this.info.count() != null) { - this.info.count(this.info.count() - buffer.readableBytes()); // was `remaining()` in Rx world + this.info.setOffset(this.info.getOffset() + buffer.remaining()); + if (this.info.getCount() != null) { + this.info.setCount(this.info.getCount() - buffer.remaining()); } }).onErrorResume(t2 -> { // Increment the retry count and try again with the new exception. @@ -115,28 +118,28 @@ private Flux applyReliableDownload(Flux data, int currentRetry /** * @return HTTP status of the download */ - public int statusCode() { - return this.rawResponse.statusCode(); + public int getStatusCode() { + return this.rawResponse.getStatusCode(); } /** * @return HTTP headers associated to the download */ - public BlobDownloadHeaders headers() { - return this.rawResponse.deserializedHeaders(); + public BlobDownloadHeaders getHeaders() { + return this.rawResponse.getDeserializedHeaders(); } /** * @return all HTTP headers from the response */ - public Map rawHeaders() { - return this.rawResponse.headers().toMap(); + public Map getRawHeaders() { + return this.rawResponse.getHeaders().toMap(); } /** * @return the raw response */ - public ResponseBase> rawResponse() { + public ResponseBase> getRawResponse() { return this.rawResponse; } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/DownloadResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/DownloadResponse.java deleted file mode 100644 index 11e90ba09daf..000000000000 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/DownloadResponse.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.storage.blob.models.ReliableDownloadOptions; -import io.netty.buffer.ByteBuf; - -import java.io.IOException; -import java.io.OutputStream; - -public class DownloadResponse { - private final DownloadAsyncResponse asyncResponse; - - DownloadResponse(DownloadAsyncResponse asyncResponse) { - this.asyncResponse = asyncResponse; - } - - /** - * Gets the body of the download response. - * - * @param outputStream Stream that has the response body read into it - * @param options Options for the download - * @throws IOException If an I/O error occurs - */ - public void body(OutputStream outputStream, ReliableDownloadOptions options) throws IOException { - for (ByteBuf buffer : this.asyncResponse.body(options).toIterable()) { - buffer.readBytes(outputStream, buffer.readableBytes()); - buffer.release(); - } - } - - //TODO (unknown): determine signature(s) to use - /*public InputStream body(ReliableDownloadOptions options) { - return new InputStream() { - DownloadAsyncResponse response = asyncResponse; - @Override - public int read() throws IOException { - return 0; - } - }; - }*/ -} 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 index 64dd6b5d997d..b13fa48a2acb 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 @@ -3,6 +3,7 @@ package com.azure.storage.blob; +import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobAccessConditions; import com.azure.storage.common.Utility; @@ -22,7 +23,7 @@ public final class HTTPGetterInfo { /** * @return the start offset used when creating the Range header. Defaults to 0. */ - public long offset() { + public long getOffset() { return offset; } @@ -32,7 +33,7 @@ public long offset() { * @param offset Start offset * @return the updated HTTPGetterInfo object */ - public HTTPGetterInfo offset(long offset) { + public HTTPGetterInfo setOffset(long offset) { this.offset = offset; return this; } @@ -41,7 +42,7 @@ public HTTPGetterInfo offset(long offset) { * @return the count of bytes used to calculate the end offset when creating the Range header. {@code} null is the * default and indicates that the entire rest of the blob should be retrieved. */ - public Long count() { + public Long getCount() { return count; } @@ -52,7 +53,7 @@ public Long count() { * @param count Count of bytes * @return the updated HTTPGetterInfo object */ - public HTTPGetterInfo count(Long count) { + public HTTPGetterInfo setCount(Long count) { if (count != null) { Utility.assertInBounds("count", count, 0, Long.MAX_VALUE); } @@ -62,22 +63,22 @@ public HTTPGetterInfo count(Long count) { /** * @return the eTag used when creating If-Match header. eTag is returned with any operation that modifies the - * resource and when retrieving {@link BlobClient#getProperties(BlobAccessConditions, Duration) properties}. - * Defaults to null. + * resource and when retrieving {@link BlobClient#getPropertiesWithResponse(BlobAccessConditions, Duration, Context) + * properties}. Defaults to null. */ - public String eTag() { + public String getETag() { return eTag; } /** - * Sets the eTag used when creating If-Match header. eTag is returned with any operation that modifies the - * resource and when retrieving {@link BlobClient#getProperties(BlobAccessConditions, Duration) properties}. - * Defaults to null. + * Sets the eTag used when creating If-Match header. eTag is returned with any operation that modifies the resource + * and when retrieving {@link BlobClient#getPropertiesWithResponse(BlobAccessConditions, Duration, Context) + * properties}. Defaults to null. * * @param eTag Resource's eTag * @return the updated HTTPGetterInfo object */ - public HTTPGetterInfo eTag(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/PageBlobAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java index 944bb4ef8ff6..a68dcf59b30b 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java @@ -6,12 +6,15 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.implementation.http.UrlBuilder; +import com.azure.core.implementation.util.FluxUtil; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; 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.BlobRange; import com.azure.storage.blob.models.CopyStatusType; +import com.azure.storage.blob.models.CpkInfo; import com.azure.storage.blob.models.Metadata; import com.azure.storage.blob.models.ModifiedAccessConditions; import com.azure.storage.blob.models.PageBlobAccessConditions; @@ -21,37 +24,35 @@ import com.azure.storage.blob.models.SequenceNumberActionType; import com.azure.storage.blob.models.SourceModifiedAccessConditions; import com.azure.storage.common.Constants; -import io.netty.buffer.ByteBuf; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.net.MalformedURLException; import java.net.URL; +import java.nio.ByteBuffer; +import static com.azure.core.implementation.util.FluxUtil.withContext; import static com.azure.storage.blob.PostProcessor.postProcessResponse; /** - * Client to a page blob. It may only be instantiated through a {@link BlobClientBuilder}, via - * the method {@link BlobAsyncClient#asPageBlobAsyncClient()}, or via the method - * {@link ContainerAsyncClient#getPageBlobAsyncClient(String)}. This class does not hold - * any state about a particular blob, but is instead a convenient way of sending appropriate - * requests to the resource on the service. + * Client to a page blob. It may only be instantiated through a {@link BlobClientBuilder}, via the method {@link + * BlobAsyncClient#asPageBlobAsyncClient()}, or via the method + * {@link ContainerAsyncClient#getPageBlobAsyncClient(String)}. This class does not hold any state about a particular + * blob, but is instead a convenient way of sending appropriate requests to the resource on the service. * *

    * This client contains operations on a blob. Operations on a container are available on {@link ContainerAsyncClient}, * and operations on the service are available on {@link BlobServiceAsyncClient}. * *

    - * Please refer - * to the Azure Docs - * for more information. + * Please refer to the Azure + * Docs for more information. * *

    - * Note this client is an async client that returns reactive responses from Spring Reactor Core - * project (https://projectreactor.io/). Calling the methods in this client will NOT - * start the actual network operation, until {@code .subscribe()} is called on the reactive response. - * You can simply convert one of these responses to a {@link java.util.concurrent.CompletableFuture} - * object through {@link Mono#toFuture()}. + * Note this client is an async client that returns reactive responses from Spring Reactor Core project + * (https://projectreactor.io/). Calling the methods in this client will NOT start the actual network + * operation, until {@code .subscribe()} is called on the reactive response. You can simply convert one of these + * responses to a {@link java.util.concurrent.CompletableFuture} object through {@link Mono#toFuture()}. */ public final class PageBlobAsyncClient extends BlobAsyncClient { /** @@ -64,201 +65,195 @@ public final class PageBlobAsyncClient extends BlobAsyncClient { */ public static final int MAX_PUT_PAGES_BYTES = 4 * Constants.MB; + private final ClientLogger logger = new ClientLogger(PageBlobAsyncClient.class); + /** * Package-private constructor for use by {@link BlobClientBuilder}. + * * @param azureBlobStorage the API client for blob storage */ - PageBlobAsyncClient(AzureBlobStorageImpl azureBlobStorage, String snapshot) { - super(azureBlobStorage, snapshot); + PageBlobAsyncClient(AzureBlobStorageImpl azureBlobStorage, String snapshot, CpkInfo cpk) { + super(azureBlobStorage, snapshot, cpk); } /** - * Creates a page blob of the specified length. Call PutPage to upload data data to a page blob. - * For more information, see the + * Creates a page blob of the specified length. Call PutPage to upload data data to a page blob. For more + * information, see the * Azure Docs. * - * @param size - * Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a - * 512-byte boundary. - * - * @return - * A reactive response containing the information of the created page blob. + * @param size Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a + * 512-byte boundary. + * @return A reactive response containing the information of the created page blob. */ - public Mono> create(long size) { - return this.create(size, null, null, null, null); + public Mono setCreate(long size) { + return createWithResponse(size, null, null, null, null).flatMap(FluxUtil::toMono); } /** - * Creates a page blob of the specified length. Call PutPage to upload data data to a page blob. - * For more information, see the + * Creates a page blob of the specified length. Call PutPage to upload data data to a page blob. For more + * information, see the * Azure Docs. * - * @param size - * Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a - * 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 metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * + * @param size Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a + * 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 metadata {@link Metadata} + * @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. + * @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> create(long size, Long sequenceNumber, BlobHTTPHeaders headers, - Metadata metadata, BlobAccessConditions accessConditions) { + public Mono> createWithResponse(long size, Long sequenceNumber, BlobHTTPHeaders headers, + Metadata metadata, BlobAccessConditions accessConditions) { + return withContext(context -> + createWithResponse(size, sequenceNumber, headers, metadata, accessConditions, context)); + } + + Mono> createWithResponse(long size, Long sequenceNumber, BlobHTTPHeaders headers, + Metadata metadata, BlobAccessConditions accessConditions, Context context) { accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; if (size % PAGE_BYTES != 0) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new IllegalArgumentException("size must be a multiple of PageBlobAsyncClient.PAGE_BYTES."); + throw logger.logExceptionAsError( + new IllegalArgumentException("size must be a multiple of PageBlobAsyncClient.PAGE_BYTES.")); } if (sequenceNumber != null && sequenceNumber < 0) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new IllegalArgumentException("SequenceNumber must be greater than or equal to 0."); + throw logger.logExceptionAsError( + new IllegalArgumentException("SequenceNumber must be greater than or equal to 0.")); } metadata = metadata == null ? new Metadata() : metadata; return postProcessResponse(this.azureBlobStorage.pageBlobs().createWithRestResponseAsync(null, - null, 0, size, null, metadata, null, null, - null, sequenceNumber, null, headers, accessConditions.leaseAccessConditions(), - accessConditions.modifiedAccessConditions(), Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders()))); + null, 0, size, null, metadata, sequenceNumber, null, headers, accessConditions.getLeaseAccessConditions(), + cpk, accessConditions.getModifiedAccessConditions(), context)) + .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.getDeserializedHeaders()))); } /** - * Writes 1 or more pages to the page blob. The start and end offsets must be a multiple of 512. - * For more information, see the + * Writes 1 or more pages to the page blob. The start and end offsets must be a multiple of 512. For more + * information, see the * Azure Docs. *

    * Note that the data passed must be replayable if retries are enabled (the default). In other words, the * {@code Flux} must produce the same data each time it is subscribed to. * - * @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 body - * The data to upload. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flowable must produce the same data each time it is subscribed to. - * - * @return - * A reactive response containing the information of the uploaded pages. + * @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 body The data to upload. Note that this {@code Flux} must be replayable if retries are enabled (the + * default). In other words, the Flowable must produce the same data each time it is subscribed to. + * @return A reactive response containing the information of the uploaded pages. */ - public Mono> uploadPages(PageRange pageRange, Flux body) { - return this.uploadPages(pageRange, body, null); + public Mono uploadPages(PageRange pageRange, Flux body) { + return uploadPagesWithResponse(pageRange, body, null).flatMap(FluxUtil::toMono); } /** - * Writes 1 or more pages to the page blob. The start and end offsets must be a multiple of 512. - * For more information, see the + * Writes 1 or more pages to the page blob. The start and end offsets must be a multiple of 512. For more + * information, see the * Azure Docs. *

    * Note that the data passed must be replayable if retries are enabled (the default). In other words, the * {@code Flux} must produce the same data each time it is subscribed to. * - * @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 body - * The data to upload. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flowable must produce the same data each time it is subscribed to. - * @param pageBlobAccessConditions - * {@link PageBlobAccessConditions} - * + * @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 body The data to upload. Note that this {@code Flux} must be replayable if retries are enabled (the + * default). In other words, the Flowable must produce the same data each time it is subscribed to. + * @param pageBlobAccessConditions {@link PageBlobAccessConditions} * @return A reactive response containing the information of the uploaded pages. * @throws IllegalArgumentException If {@code pageRange} is {@code null} */ - public Mono> uploadPages(PageRange pageRange, Flux body, - PageBlobAccessConditions pageBlobAccessConditions) { - pageBlobAccessConditions = pageBlobAccessConditions == null ? new PageBlobAccessConditions() : pageBlobAccessConditions; + public Mono> uploadPagesWithResponse(PageRange pageRange, Flux body, + PageBlobAccessConditions pageBlobAccessConditions) { + return withContext(context -> uploadPagesWithResponse(pageRange, body, pageBlobAccessConditions, context)); + } + + Mono> uploadPagesWithResponse(PageRange pageRange, Flux body, + PageBlobAccessConditions pageBlobAccessConditions, Context context) { + pageBlobAccessConditions = pageBlobAccessConditions == null + ? new PageBlobAccessConditions() + : pageBlobAccessConditions; if (pageRange == null) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new IllegalArgumentException("pageRange cannot be null."); + throw logger.logExceptionAsError(new IllegalArgumentException("pageRange cannot be null.")); } String pageRangeStr = pageRangeToString(pageRange); return postProcessResponse(this.azureBlobStorage.pageBlobs().uploadPagesWithRestResponseAsync(null, - null, body, pageRange.end() - pageRange.start() + 1, null, - null, pageRangeStr, null, null, null, null, - pageBlobAccessConditions.leaseAccessConditions(), pageBlobAccessConditions.sequenceNumberAccessConditions(), - pageBlobAccessConditions.modifiedAccessConditions(), Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders()))); + null, body, pageRange.getEnd() - pageRange.getStart() + 1, null, null, null, pageRangeStr, null, + pageBlobAccessConditions.getLeaseAccessConditions(), cpk, + pageBlobAccessConditions.getSequenceNumberAccessConditions(), + pageBlobAccessConditions.getModifiedAccessConditions(), context)) + .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.getDeserializedHeaders()))); } /** * Writes 1 or more pages from the source page blob to this page blob. The start and end offsets must be a multiple - * of 512. - * For more information, see the + * of 512. For more information, see the * Azure Docs. *

    * - * @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 - * are 0-511, 512-1023, etc. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can be - * authenticated via Shared Key. However, if the source is a blob in another account, the source blob must - * either be public or must be authenticated via a shared access signature. If the source blob is public, no - * authentication is required to perform the operation. - * @param sourceOffset - * The source offset to copy from. Pass null or 0 to copy from the beginning of source page blob. - * - * @return - * A reactive response containing the information of the uploaded pages. + * @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 + * are 0-511, 512-1023, etc. + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage + * account can be authenticated via Shared Key. However, if the source is a blob in another account, the source blob + * must either be public or must be authenticated via a shared access signature. If the source blob is public, no + * authentication is required to perform the operation. + * @param sourceOffset The source offset to copy from. Pass null or 0 to copy from the beginning of source page + * blob. + * @return A reactive response containing the information of the uploaded pages. */ - public Mono> uploadPagesFromURL(PageRange range, URL sourceURL, Long sourceOffset) { - return this.uploadPagesFromURL(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); } /** * Writes 1 or more pages from the source page blob to this page blob. The start and end offsets must be a multiple - * of 512. - * For more information, see the + * of 512. For more information, see the * Azure Docs. *

    * - * @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 ranges - * are 0-511, 512-1023, etc. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can be - * authenticated via Shared Key. However, if the source is a blob in another account, the source blob must - * either be public or must be authenticated via a shared access signature. If the source blob is public, no - * authentication is required to perform the operation. - * @param sourceOffset - * The source offset to copy from. Pass null or 0 to copy from the beginning of source blob. - * @param sourceContentMD5 - * An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 - * of the received data and fail the request if it does not match the provided MD5. - * @param destAccessConditions - * {@link PageBlobAccessConditions} - * @param sourceAccessConditions - * {@link 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 + * ranges are 0-511, 512-1023, etc. + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage + * account can be authenticated via Shared Key. However, if the source is a blob in another account, the source blob + * must either be public or must be authenticated via a shared access signature. If the source blob is public, no + * authentication is required to perform the operation. + * @param sourceOffset The source offset to copy from. Pass null or 0 to copy from the beginning of source blob. + * @param sourceContentMD5 An MD5 hash of the block content from the source blob. If specified, the service will + * calculate the MD5 of the received data and fail the request if it does not match the provided MD5. + * @param destAccessConditions {@link PageBlobAccessConditions} + * @param sourceAccessConditions {@link SourceModifiedAccessConditions} * @return A reactive response containing the information of the uploaded pages. * @throws IllegalArgumentException If {@code range} is {@code null} */ - public Mono> uploadPagesFromURL(PageRange range, URL sourceURL, Long sourceOffset, - byte[] sourceContentMD5, PageBlobAccessConditions destAccessConditions, - SourceModifiedAccessConditions sourceAccessConditions) { + public Mono> uploadPagesFromURLWithResponse(PageRange range, URL sourceURL, + Long sourceOffset, byte[] sourceContentMD5, PageBlobAccessConditions destAccessConditions, + SourceModifiedAccessConditions sourceAccessConditions) { + return withContext(context -> uploadPagesFromURLWithResponse(range, sourceURL, sourceOffset, sourceContentMD5, + destAccessConditions, sourceAccessConditions, context)); + } + + Mono> uploadPagesFromURLWithResponse(PageRange range, URL sourceURL, Long sourceOffset, + byte[] sourceContentMD5, PageBlobAccessConditions destAccessConditions, + SourceModifiedAccessConditions sourceAccessConditions, Context context) { if (range == null) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new IllegalArgumentException("range cannot be null."); + throw logger.logExceptionAsError(new IllegalArgumentException("range cannot be null.")); } String rangeString = pageRangeToString(range); @@ -267,233 +262,234 @@ public Mono> uploadPagesFromURL(PageRange range, URL sour sourceOffset = 0L; } - String sourceRangeString = pageRangeToString(new PageRange().start(sourceOffset).end(sourceOffset + (range.end() - range.start()))); + String sourceRangeString = pageRangeToString(new PageRange() + .setStart(sourceOffset) + .setEnd(sourceOffset + (range.getEnd() - range.getStart()))); destAccessConditions = destAccessConditions == null ? new PageBlobAccessConditions() : destAccessConditions; return postProcessResponse(this.azureBlobStorage.pageBlobs().uploadPagesFromURLWithRestResponseAsync( - null, null, sourceURL, sourceRangeString, 0, rangeString, sourceContentMD5, - null, null, destAccessConditions.leaseAccessConditions(), - destAccessConditions.sequenceNumberAccessConditions(), destAccessConditions.modifiedAccessConditions(), - sourceAccessConditions, Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders()))); + null, null, sourceURL, sourceRangeString, 0, rangeString, sourceContentMD5, null, null, null, cpk, + destAccessConditions.getLeaseAccessConditions(), destAccessConditions.getSequenceNumberAccessConditions(), + destAccessConditions.getModifiedAccessConditions(), sourceAccessConditions, context)) + .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.getDeserializedHeaders(), + rb.getHeaders().value("x-ms-encryption-key-sha256")))); } /** - * Frees the specified pages from the page blob. - * For more information, see the + * Frees the specified pages from the page blob. For more information, see the * Azure Docs. * - * @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 reactive response containing the information of the cleared pages. + * @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 reactive response containing the information of the cleared pages. */ - public Mono> clearPages(PageRange pageRange) { - return this.clearPages(pageRange, null); + public Mono clearPages(PageRange pageRange) { + return clearPagesWithResponse(pageRange, null).flatMap(FluxUtil::toMono); } /** - * Frees the specified pages from the page blob. - * For more information, see the + * Frees the specified pages from the page blob. For more information, see the * Azure Docs. * - * @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 pageBlobAccessConditions - * {@link PageBlobAccessConditions} - * + * @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 pageBlobAccessConditions {@link PageBlobAccessConditions} * @return A reactive response containing the information of the cleared pages. * @throws IllegalArgumentException If {@code pageRange} is {@code null} */ - public Mono> clearPages(PageRange pageRange, - PageBlobAccessConditions pageBlobAccessConditions) { - pageBlobAccessConditions = pageBlobAccessConditions == null ? new PageBlobAccessConditions() : pageBlobAccessConditions; + public Mono> clearPagesWithResponse(PageRange pageRange, + PageBlobAccessConditions pageBlobAccessConditions) { + return withContext(context -> clearPagesWithResponse(pageRange, pageBlobAccessConditions, context)); + } + + Mono> clearPagesWithResponse(PageRange pageRange, + PageBlobAccessConditions pageBlobAccessConditions, Context context) { + pageBlobAccessConditions = pageBlobAccessConditions == null + ? new PageBlobAccessConditions() + : pageBlobAccessConditions; if (pageRange == null) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new IllegalArgumentException("pageRange cannot be null."); + throw logger.logExceptionAsError(new IllegalArgumentException("pageRange cannot be null.")); } String pageRangeStr = pageRangeToString(pageRange); return postProcessResponse(this.azureBlobStorage.pageBlobs().clearPagesWithRestResponseAsync(null, null, 0, null, pageRangeStr, null, - pageBlobAccessConditions.leaseAccessConditions(), pageBlobAccessConditions.sequenceNumberAccessConditions(), - pageBlobAccessConditions.modifiedAccessConditions(), Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders()))); + pageBlobAccessConditions.getLeaseAccessConditions(), cpk, + pageBlobAccessConditions.getSequenceNumberAccessConditions(), + pageBlobAccessConditions.getModifiedAccessConditions(), context)) + .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.getDeserializedHeaders(), + rb.getHeaders().value("x-ms-request-server-encrypted"), + rb.getHeaders().value("x-ms-encryption-key-sha256")))); } /** - * Returns the list of valid page ranges for a page blob or snapshot of a page blob. - * For more information, see the Azure Docs. - * - * @param blobRange - * {@link BlobRange} + * Returns the list of valid page ranges for a page blob or snapshot of a page blob. For more information, see the + * Azure Docs. * - * @return - * A reactive response containing the information of the cleared pages. + * @param blobRange {@link BlobRange} + * @return A reactive response containing the information of the cleared pages. */ - public Mono> getPageRanges(BlobRange blobRange) { - return this.getPageRanges(blobRange, null); + public Mono getPageRanges(BlobRange blobRange) { + return getPageRangesWithResponse(blobRange, null).flatMap(FluxUtil::toMono); } /** - * Returns the list of valid page ranges for a page blob or snapshot of a page blob. - * For more information, see the Azure Docs. + * Returns the list of valid page ranges for a page blob or snapshot of a page blob. For more information, see the + * Azure Docs. * - * @param blobRange - * {@link BlobRange} - * @param accessConditions - * {@link BlobAccessConditions} - * - * @return - * A reactive response emitting all the page ranges. + * @param blobRange {@link BlobRange} + * @param accessConditions {@link BlobAccessConditions} + * @return A reactive response emitting all the page ranges. */ - public Mono> getPageRanges(BlobRange blobRange, BlobAccessConditions accessConditions) { + public Mono> getPageRangesWithResponse(BlobRange blobRange, + BlobAccessConditions accessConditions) { + return withContext(context -> getPageRangesWithResponse(blobRange, accessConditions, context)); + } + + Mono> getPageRangesWithResponse(BlobRange blobRange, BlobAccessConditions accessConditions, + Context context) { blobRange = blobRange == null ? new BlobRange(0) : blobRange; accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; return postProcessResponse(this.azureBlobStorage.pageBlobs().getPageRangesWithRestResponseAsync( - null, null, snapshot, null, null, blobRange.toHeaderValue(), - null, accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), - Context.NONE)) - .map(response -> new SimpleResponse<>(response, response.value())); + null, null, snapshot, null, blobRange.toHeaderValue(), + null, accessConditions.getLeaseAccessConditions(), accessConditions.getModifiedAccessConditions(), + context)).map(response -> new SimpleResponse<>(response, response.getValue())); } /** - * Gets the collection of page ranges that differ between a specified snapshot and this page blob. - * For more information, see the Azure Docs. - * - * @param blobRange - * {@link BlobRange} - * @param prevSnapshot - * Specifies that the response will contain only pages that were changed between target blob and previous - * snapshot. Changed pages include both updated and cleared pages. The target - * blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. - * - * @return - * A reactive response emitting all the different page ranges. + * Gets the collection of page ranges that differ between a specified snapshot and this page blob. For more + * information, see the Azure + * Docs. + * + * @param blobRange {@link BlobRange} + * @param prevSnapshot Specifies that the response will contain only pages that were changed between target blob and + * previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as + * long as the snapshot specified by prevsnapshot is the older of the two. + * @return A reactive response emitting all the different page ranges. */ - public Mono> getPageRangesDiff(BlobRange blobRange, String prevSnapshot) { - return this.getPageRangesDiff(blobRange, prevSnapshot, null); + public Mono getPageRangesDiff(BlobRange blobRange, String prevSnapshot) { + return getPageRangesDiffWithResponse(blobRange, prevSnapshot, null).flatMap(FluxUtil::toMono); } /** - * Gets the collection of page ranges that differ between a specified snapshot and this page blob. - * For more information, see the Azure Docs. - * - * @param blobRange - * {@link BlobRange} - * @param prevSnapshot - * Specifies that the response will contain only pages that were changed between target blob and previous - * snapshot. Changed pages include both updated and cleared pages. The target - * blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. - * @param accessConditions - * {@link BlobAccessConditions} - * + * Gets the collection of page ranges that differ between a specified snapshot and this page blob. For more + * information, see the Azure + * Docs. + * + * @param blobRange {@link BlobRange} + * @param prevSnapshot Specifies that the response will contain only pages that were changed between target blob and + * previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as + * long as the snapshot specified by prevsnapshot is the older of the two. + * @param accessConditions {@link BlobAccessConditions} * @return A reactive response emitting all the different page ranges. * @throws IllegalArgumentException If {@code prevSnapshot} is {@code null} */ - public Mono> getPageRangesDiff(BlobRange blobRange, String prevSnapshot, BlobAccessConditions accessConditions) { + public Mono> getPageRangesDiffWithResponse(BlobRange blobRange, String prevSnapshot, + BlobAccessConditions accessConditions) { + return withContext(context -> + getPageRangesDiffWithResponse(blobRange, prevSnapshot, accessConditions, context)); + } + + Mono> getPageRangesDiffWithResponse(BlobRange blobRange, String prevSnapshot, + BlobAccessConditions accessConditions, Context context) { blobRange = blobRange == null ? new BlobRange(0) : blobRange; accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; if (prevSnapshot == null) { - throw new IllegalArgumentException("prevSnapshot cannot be null"); + throw logger.logExceptionAsError(new IllegalArgumentException("prevSnapshot cannot be null")); } return postProcessResponse(this.azureBlobStorage.pageBlobs().getPageRangesDiffWithRestResponseAsync( - null, null, snapshot, null, null, prevSnapshot, - blobRange.toHeaderValue(), null, accessConditions.leaseAccessConditions(), - accessConditions.modifiedAccessConditions(), Context.NONE)) - .map(response -> new SimpleResponse<>(response, response.value())); + null, null, snapshot, null, prevSnapshot, + blobRange.toHeaderValue(), null, accessConditions.getLeaseAccessConditions(), + accessConditions.getModifiedAccessConditions(), context)) + .map(response -> new SimpleResponse<>(response, response.getValue())); } /** - * Resizes the page blob to the specified size (which must be a multiple of 512). - * For more information, see the Azure Docs. + * Resizes the page blob to the specified size (which must be a multiple of 512). For more information, see the Azure Docs. * - * @param size - * Resizes a page blob to the specified size. If the specified value is less than the current size of the - * blob, then all pages above the specified value are cleared. - * - * @return - * A reactive response emitting the resized page blob. + * @param size Resizes a page blob to the specified size. If the specified value is less than the current size of + * the blob, then all pages above the specified value are cleared. + * @return A reactive response emitting the resized page blob. */ - public Mono> resize(long size) { - return this.resize(size, null); + public Mono resize(long size) { + return resizeWithResponse(size, null).flatMap(FluxUtil::toMono); } /** - * Resizes the page blob to the specified size (which must be a multiple of 512). - * For more information, see the Azure Docs. - * - * @param size - * Resizes a page blob to the specified size. If the specified value is less than the current size of the - * blob, then all pages above the specified value are cleared. - * @param accessConditions - * {@link BlobAccessConditions} + * Resizes the page blob to the specified size (which must be a multiple of 512). For more information, see the Azure Docs. * + * @param size Resizes a page blob to the specified size. If the specified value is less than the current size of + * the blob, then all pages above the specified value are cleared. + * @param accessConditions {@link BlobAccessConditions} * @return A reactive response emitting the resized page blob. * @throws IllegalArgumentException If {@code size} isn't a multiple of {@link PageBlobAsyncClient#PAGE_BYTES} */ - public Mono> resize(long size, BlobAccessConditions accessConditions) { + public Mono> resizeWithResponse(long size, BlobAccessConditions accessConditions) { + return withContext(context -> resizeWithResponse(size, accessConditions, context)); + } + + Mono> resizeWithResponse(long size, BlobAccessConditions accessConditions, Context context) { if (size % PAGE_BYTES != 0) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new IllegalArgumentException("size must be a multiple of PageBlobAsyncClient.PAGE_BYTES."); + throw logger.logExceptionAsError( + new IllegalArgumentException("size must be a multiple of PageBlobAsyncClient.PAGE_BYTES.")); } accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; return postProcessResponse(this.azureBlobStorage.pageBlobs().resizeWithRestResponseAsync(null, - null, size, null, null, accessConditions.leaseAccessConditions(), - accessConditions.modifiedAccessConditions(), Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders()))); + null, size, null, null, accessConditions.getLeaseAccessConditions(), cpk, + accessConditions.getModifiedAccessConditions(), context)) + .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.getDeserializedHeaders()))); } /** - * Sets the page blob's sequence number. - * For more information, see the Azure Docs. - * - * @param action - * Indicates how the service should modify the blob's sequence number. - * @param sequenceNumber - * The blob's sequence number. The sequence number is a user-controlled property that you can use to track - * requests and manage concurrency issues. + * Sets the page blob's sequence number. For more information, see the Azure + * Docs. * - * @return - * A reactive response emitting the updated page blob. + * @param action Indicates how the service should modify the blob's sequence number. + * @param sequenceNumber The blob's sequence number. The sequence number is a user-controlled property that you can + * use to track requests and manage concurrency issues. + * @return A reactive response emitting the updated page blob. */ - public Mono> updateSequenceNumber(SequenceNumberActionType action, - Long sequenceNumber) { - return this.updateSequenceNumber(action, sequenceNumber, null); + public Mono updateSequenceNumber(SequenceNumberActionType action, Long sequenceNumber) { + return updateSequenceNumberWithResponse(action, sequenceNumber, null).flatMap(FluxUtil::toMono); } /** - * Sets the page blob's sequence number. - * For more information, see the Azure Docs. - * - * @param action - * Indicates how the service should modify the blob's sequence number. - * @param sequenceNumber - * The blob's sequence number. The sequence number is a user-controlled property that you can use to track - * requests and manage concurrency issues. - * @param accessConditions - * {@link BlobAccessConditions} + * Sets the page blob's sequence number. For more information, see the Azure + * Docs. * + * @param action Indicates how the service should modify the blob's sequence number. + * @param sequenceNumber The blob's sequence number. The sequence number is a user-controlled property that you can + * use to track requests and manage concurrency issues. + * @param accessConditions {@link BlobAccessConditions} * @return A reactive response emitting the updated page blob. * @throws IllegalArgumentException If {@code sequenceNumber} isn't null and is less than 0 */ - public Mono> updateSequenceNumber(SequenceNumberActionType action, Long sequenceNumber, BlobAccessConditions accessConditions) { + public Mono> updateSequenceNumberWithResponse(SequenceNumberActionType action, + Long sequenceNumber, BlobAccessConditions accessConditions) { + return withContext(context -> + updateSequenceNumberWithResponse(action, sequenceNumber, accessConditions, context)); + } + + Mono> updateSequenceNumberWithResponse(SequenceNumberActionType action, Long sequenceNumber, + BlobAccessConditions accessConditions, Context context) { if (sequenceNumber != null && sequenceNumber < 0) { // Throwing is preferred to Single.error because this will error out immediately instead of waiting until // subscription. - throw new IllegalArgumentException("SequenceNumber must be greater than or equal to 0."); + throw logger.logExceptionAsError( + new IllegalArgumentException("SequenceNumber must be greater than or equal to 0.")); } accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; sequenceNumber = action == SequenceNumberActionType.INCREMENT ? null : sequenceNumber; @@ -501,51 +497,49 @@ public Mono> updateSequenceNumber(SequenceNumberActionTyp return postProcessResponse( this.azureBlobStorage.pageBlobs().updateSequenceNumberWithRestResponseAsync(null, null, action, null, sequenceNumber, null, - accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.deserializedHeaders()))); + accessConditions.getLeaseAccessConditions(), accessConditions.getModifiedAccessConditions(), context)) + .map(rb -> new SimpleResponse<>(rb, new PageBlobItem(rb.getDeserializedHeaders()))); } /** - * Begins an operation to start an incremental copy from one page blob's snapshot to this page - * blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are - * transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read - * or copied from as usual. For more information, see - * the Azure Docs here and + * Begins an operation to start an incremental copy from one page blob's snapshot to this page blob. The snapshot is + * copied such that only the differential changes between the previously copied snapshot are transferred to the + * destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as + * usual. For more information, see the Azure Docs here + * and * here. * - * @param source - * The source page blob. - * @param snapshot - * The snapshot on the copy source. - * - * @return - * A reactive response emitting the copy status. + * @param source The source page blob. + * @param snapshot The snapshot on the copy source. + * @return A reactive response emitting the copy status. */ - public Mono> copyIncremental(URL source, String snapshot) { - return this.copyIncremental(source, snapshot, null); + public Mono copyIncremental(URL source, String snapshot) { + return copyIncrementalWithResponse(source, snapshot, null).flatMap(FluxUtil::toMono); } /** - * Begins an operation to start an incremental copy from one page blob's snapshot to this page - * blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are - * transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read - * or copied from as usual. For more information, see - * the Azure Docs here and + * Begins an operation to start an incremental copy from one page blob's snapshot to this page blob. The snapshot is + * copied such that only the differential changes between the previously copied snapshot are transferred to the + * destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as + * usual. For more information, see the Azure Docs here + * and * here. * - * @param source - * The source page blob. - * @param snapshot - * The snapshot on the copy source. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * + * @param source The source page blob. + * @param snapshot The snapshot on the copy source. + * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and + * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given + * request. The request will fail if the specified condition is not satisfied. * @return A reactive response emitting the copy status. * @throws Error If {@code source} and {@code snapshot} form a malformed URL. */ - public Mono> copyIncremental(URL source, String snapshot, ModifiedAccessConditions modifiedAccessConditions) { + public Mono> copyIncrementalWithResponse(URL source, String snapshot, + ModifiedAccessConditions modifiedAccessConditions) { + return withContext(context -> copyIncrementalWithResponse(source, snapshot, modifiedAccessConditions, context)); + } + + Mono> copyIncrementalWithResponse(URL source, String snapshot, + ModifiedAccessConditions modifiedAccessConditions, Context context) { UrlBuilder builder = UrlBuilder.parse(source); builder.setQueryParameter(Constants.SNAPSHOT_QUERY_PARAMETER, snapshot); try { @@ -555,24 +549,24 @@ public Mono> copyIncremental(URL source, String snapsho throw new Error(e); } return postProcessResponse(this.azureBlobStorage.pageBlobs().copyIncrementalWithRestResponseAsync( - null, null, source, null, null, modifiedAccessConditions, Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().copyStatus())); + null, null, source, null, null, modifiedAccessConditions, context)) + .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getCopyStatus())); } private static String pageRangeToString(PageRange pageRange) { - if (pageRange.start() < 0 || pageRange.end() <= 0) { + if (pageRange.getStart() < 0 || pageRange.getEnd() <= 0) { throw new IllegalArgumentException("PageRange's start and end values must be greater than or equal to " + "0 if specified."); } - if (pageRange.start() % PAGE_BYTES != 0) { + if (pageRange.getStart() % PAGE_BYTES != 0) { throw new IllegalArgumentException("PageRange's start value must be a multiple of 512."); } - if (pageRange.end() % PAGE_BYTES != PAGE_BYTES - 1) { + if (pageRange.getEnd() % PAGE_BYTES != PAGE_BYTES - 1) { throw new IllegalArgumentException("PageRange's end value must be 1 less than a multiple of 512."); } - if (pageRange.end() <= pageRange.start()) { + if (pageRange.getEnd() <= pageRange.getStart()) { throw new IllegalArgumentException("PageRange's End value must be after the start."); } - return "bytes=" + pageRange.start() + '-' + pageRange.end(); + return "bytes=" + pageRange.getStart() + '-' + pageRange.getEnd(); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PageBlobClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PageBlobClient.java index 9e683c7a8b8d..e255d110766a 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PageBlobClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PageBlobClient.java @@ -3,7 +3,9 @@ package com.azure.storage.blob; +import com.azure.core.exception.UnexpectedLengthException; import com.azure.core.http.rest.Response; +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.BlobRange; @@ -16,31 +18,31 @@ import com.azure.storage.blob.models.PageRange; import com.azure.storage.blob.models.SequenceNumberActionType; import com.azure.storage.blob.models.SourceModifiedAccessConditions; +import com.azure.storage.blob.models.StorageException; import com.azure.storage.common.Utility; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; import java.io.InputStream; import java.net.URL; +import java.nio.ByteBuffer; import java.time.Duration; +import java.util.Objects; /** - * Client to a page blob. It may only be instantiated through a {@link BlobClientBuilder}, via - * the method {@link BlobClient#asPageBlobClient()}, or via the method - * {@link ContainerClient#getPageBlobClient(String)}. This class does not hold - * any state about a particular blob, but is instead a convenient way of sending appropriate - * requests to the resource on the service. + * Client to a page blob. It may only be instantiated through a {@link BlobClientBuilder}, via the method {@link + * BlobClient#asPageBlobClient()}, or via the method {@link ContainerClient#getPageBlobClient(String)}. This class does + * not hold any state about a particular blob, but is instead a convenient way of sending appropriate requests to the + * resource on the service. * *

    - * This client contains operations on a blob. Operations on a container are available on {@link ContainerClient}, - * and operations on the service are available on {@link BlobServiceClient}. + * This client contains operations on a blob. Operations on a container are available on {@link ContainerClient}, and + * operations on the service are available on {@link BlobServiceClient}. * *

    - * Please refer to the Azure Docs - * for more information. + * Please refer to the Azure + * Docs for more information. */ public final class PageBlobClient extends BlobClient { private final PageBlobAsyncClient pageBlobAsyncClient; @@ -57,6 +59,7 @@ public final class PageBlobClient extends BlobClient { /** * Package-private constructor for use by {@link BlobClientBuilder}. + * * @param pageBlobAsyncClient the async page blob client */ PageBlobClient(PageBlobAsyncClient pageBlobAsyncClient) { @@ -65,451 +68,366 @@ public final class PageBlobClient extends BlobClient { } /** - * 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. + * 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. * @return A {@link BlobOutputStream} object used to write data to the blob. - * - * @throws StorageException - * If a storage service error occurred. + * @throws StorageException If a storage service error occurred. */ public BlobOutputStream getBlobOutputStream(long length) { return getBlobOutputStream(length, 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 accessConditions - * A {@link BlobAccessConditions} object that represents the access conditions for the blob. + * 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 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. + * @throws StorageException If a storage service error occurred. */ public BlobOutputStream getBlobOutputStream(long length, BlobAccessConditions accessConditions) { - return new BlobOutputStream(pageBlobAsyncClient, length, accessConditions); + return BlobOutputStream.pageBlobOutputStream(pageBlobAsyncClient, length, accessConditions); } /** - * Creates a page blob of the specified length. Call PutPage to upload data data to a page blob. - * For more information, see the + * Creates a page blob of the specified length. Call PutPage to upload data data to a page blob. For more + * information, see the * Azure Docs. * - * @param size - * Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a - * 512-byte boundary. - * - * @return - * The information of the created page blob. + * @param size Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a + * 512-byte boundary. + * @return The information of the created page blob. */ - public Response create(long size) { - return this.create(size, null, null, null, null, null); + public PageBlobItem setCreate(long size) { + return createWithResponse(size, null, null, null, null, null, Context.NONE).getValue(); } + /** - * Creates a page blob of the specified length. Call PutPage to upload data data to a page blob. - * For more information, see the + * Creates a page blob of the specified length. Call PutPage to upload data data to a page blob. For more + * information, see the * Azure Docs. * - * @param size - * Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a - * 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 metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The information of the created page blob. + * @param size Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a + * 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 metadata {@link Metadata} + * @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 create(long size, Long sequenceNumber, BlobHTTPHeaders headers, - Metadata metadata, BlobAccessConditions accessConditions, Duration timeout) { - Mono> response = pageBlobAsyncClient.create(size, sequenceNumber, headers, metadata, accessConditions); + public Response createWithResponse(long size, Long sequenceNumber, BlobHTTPHeaders headers, + Metadata metadata, BlobAccessConditions accessConditions, Duration timeout, Context context) { + Mono> response = pageBlobAsyncClient.createWithResponse(size, sequenceNumber, headers, + metadata, accessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } /** - * Writes 1 or more pages to the page blob. The start and end offsets must be a multiple of 512. - * For more information, see the + * Writes 1 or more pages to the page blob. The start and end offsets must be a multiple of 512. For more + * information, see the * Azure Docs. *

    * Note that the data passed must be replayable if retries are enabled (the default). In other words, the * {@code Flux} must produce the same data each time it is subscribed to. * - * @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 body - * The data to upload. - * - * @return - * The information of the uploaded pages. + * @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 body The data to upload. + * @return The information of the uploaded pages. */ - public Response uploadPages(PageRange pageRange, InputStream body) { - return this.uploadPages(pageRange, body, null, null); + public PageBlobItem uploadPages(PageRange pageRange, InputStream body) { + return uploadPagesWithResponse(pageRange, body, null, null, Context.NONE).getValue(); } /** - * Writes 1 or more pages to the page blob. The start and end offsets must be a multiple of 512. - * For more information, see the + * Writes 1 or more pages to the page blob. The start and end offsets must be a multiple of 512. For more + * information, see the * Azure Docs. *

    * Note that the data passed must be replayable if retries are enabled (the default). In other words, the * {@code Flux} must produce the same data each time it is subscribed to. * - * @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 body - * The data to upload. - * @param pageBlobAccessConditions - * {@link PageBlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The information of the uploaded pages. + * @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 body The data to upload. + * @param pageBlobAccessConditions {@link PageBlobAccessConditions} + * @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 uploaded pages. + * @throws UnexpectedLengthException when the length of data does not match the input {@code length}. + * @throws NullPointerException if the input data is null. */ - public Response uploadPages(PageRange pageRange, InputStream body, - PageBlobAccessConditions pageBlobAccessConditions, Duration timeout) { - long length = pageRange.end() - pageRange.start(); - Flux fbb = Flux.range(0, (int) Math.ceil((double) length / (double) PAGE_BYTES)) - .map(i -> i * PAGE_BYTES) - .concatMap(pos -> Mono.fromCallable(() -> { - byte[] cache = new byte[PAGE_BYTES]; - int read = 0; - while (read < PAGE_BYTES) { - read += body.read(cache, read, PAGE_BYTES - read); - } + public Response uploadPagesWithResponse(PageRange pageRange, InputStream body, + PageBlobAccessConditions pageBlobAccessConditions, Duration timeout, Context context) { + Objects.requireNonNull(body); + final long length = pageRange.getEnd() - pageRange.getStart() + 1; + Flux fbb = Utility.convertStreamToByteBuffer(body, length, PAGE_BYTES); - return ByteBufAllocator.DEFAULT.buffer(read).writeBytes(cache); - })); - - Mono> response = pageBlobAsyncClient.uploadPages(pageRange, + Mono> response = pageBlobAsyncClient.uploadPagesWithResponse(pageRange, fbb.subscribeOn(Schedulers.elastic()), - pageBlobAccessConditions); + pageBlobAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } /** * Writes 1 or more pages from the source page blob to this page blob. The start and end offsets must be a multiple - * of 512. - * For more information, see the + * of 512. For more information, see the * Azure Docs. *

    * - * @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 - * are 0-511, 512-1023, etc. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can be - * authenticated via Shared Key. However, if the source is a blob in another account, the source blob must - * either be public or must be authenticated via a shared access signature. If the source blob is public, no - * authentication is required to perform the operation. - * @param sourceOffset - * The source offset to copy from. Pass null or 0 to copy from the beginning of source page blob. - * - * @return - * The information of the uploaded pages. + * @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 + * are 0-511, 512-1023, etc. + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage + * account can be authenticated via Shared Key. However, if the source is a blob in another account, the source blob + * must either be public or must be authenticated via a shared access signature. If the source blob is public, no + * authentication is required to perform the operation. + * @param sourceOffset The source offset to copy from. Pass null or 0 to copy from the beginning of source page + * blob. + * @return The information of the uploaded pages. */ - public Response uploadPagesFromURL(PageRange range, URL sourceURL, Long sourceOffset) { - return this.uploadPagesFromURL(range, sourceURL, sourceOffset, null, null, - null, null); + public PageBlobItem uploadPagesFromURL(PageRange range, URL sourceURL, Long sourceOffset) { + return uploadPagesFromURLWithResponse(range, sourceURL, sourceOffset, null, null, null, null, Context.NONE) + .getValue(); } /** * Writes 1 or more pages from the source page blob to this page blob. The start and end offsets must be a multiple - * of 512. - * For more information, see the + * of 512. For more information, see the * Azure Docs. *

    * - * @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 ranges - * are 0-511, 512-1023, etc. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can be - * authenticated via Shared Key. However, if the source is a blob in another account, the source blob must - * either be public or must be authenticated via a shared access signature. If the source blob is public, no - * authentication is required to perform the operation. - * @param sourceOffset - * The source offset to copy from. Pass null or 0 to copy from the beginning of source blob. - * @param sourceContentMD5 - * An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 - * of the received data and fail the request if it does not match the provided MD5. - * @param destAccessConditions - * {@link PageBlobAccessConditions} - * @param sourceAccessConditions - * {@link SourceModifiedAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The information of the uploaded pages. + * @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 + * ranges are 0-511, 512-1023, etc. + * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage + * account can be authenticated via Shared Key. However, if the source is a blob in another account, the source blob + * must either be public or must be authenticated via a shared access signature. If the source blob is public, no + * authentication is required to perform the operation. + * @param sourceOffset The source offset to copy from. Pass null or 0 to copy from the beginning of source blob. + * @param sourceContentMD5 An MD5 hash of the block content from the source blob. If specified, the service will + * calculate the MD5 of the received data and fail the request if it does not match the provided MD5. + * @param destAccessConditions {@link PageBlobAccessConditions} + * @param sourceAccessConditions {@link SourceModifiedAccessConditions} + * @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 uploaded pages. */ - public Response uploadPagesFromURL(PageRange range, URL sourceURL, Long sourceOffset, - byte[] sourceContentMD5, PageBlobAccessConditions destAccessConditions, - SourceModifiedAccessConditions sourceAccessConditions, Duration timeout) { + public Response uploadPagesFromURLWithResponse(PageRange range, URL sourceURL, Long sourceOffset, + byte[] sourceContentMD5, PageBlobAccessConditions destAccessConditions, + SourceModifiedAccessConditions sourceAccessConditions, Duration timeout, Context context) { - Mono> response = pageBlobAsyncClient.uploadPagesFromURL(range, sourceURL, sourceOffset, sourceContentMD5, destAccessConditions, sourceAccessConditions); + Mono> response = pageBlobAsyncClient.uploadPagesFromURLWithResponse(range, sourceURL, + sourceOffset, sourceContentMD5, destAccessConditions, sourceAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } /** - * Frees the specified pages from the page blob. - * For more information, see the + * Frees the specified pages from the page blob. For more information, see the * Azure Docs. * - * @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 - * The information of the cleared pages. + * @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 The information of the cleared pages. */ - public Response clearPages(PageRange pageRange) { - return this.clearPages(pageRange, null, null); + public PageBlobItem clearPages(PageRange pageRange) { + return clearPagesWithResponse(pageRange, null, null, Context.NONE).getValue(); } /** - * Frees the specified pages from the page blob. - * For more information, see the + * Frees the specified pages from the page blob. For more information, see the * Azure Docs. * - * @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 timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param pageBlobAccessConditions - * {@link PageBlobAccessConditions} - * - * @return - * The information of the cleared pages. + * @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 timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. + * @param pageBlobAccessConditions {@link PageBlobAccessConditions} + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return The information of the cleared pages. */ - public Response clearPages(PageRange pageRange, - PageBlobAccessConditions pageBlobAccessConditions, Duration timeout) { - Mono> response = pageBlobAsyncClient.clearPages(pageRange, pageBlobAccessConditions); + public Response clearPagesWithResponse(PageRange pageRange, + PageBlobAccessConditions pageBlobAccessConditions, Duration timeout, Context context) { + Mono> response = pageBlobAsyncClient.clearPagesWithResponse(pageRange, + pageBlobAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } /** - * Returns the list of valid page ranges for a page blob or snapshot of a page blob. - * For more information, see the Azure Docs. + * Returns the list of valid page ranges for a page blob or snapshot of a page blob. For more information, see the + * Azure Docs. * - * @param blobRange - * {@link BlobRange} - * - * @return - * The information of the cleared pages. + * @param blobRange {@link BlobRange} + * @return The information of the cleared pages. */ - public Response getPageRanges(BlobRange blobRange) { - return this.getPageRanges(blobRange, null, null); + public PageList getPageRanges(BlobRange blobRange) { + return getPageRangesWithResponse(blobRange, null, null, Context.NONE).getValue(); } /** - * Returns the list of valid page ranges for a page blob or snapshot of a page blob. - * For more information, see the Azure Docs. - * - * @param blobRange - * {@link BlobRange} - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * All the page ranges. + * Returns the list of valid page ranges for a page blob or snapshot of a page blob. For more information, see the + * Azure Docs. + * + * @param blobRange {@link BlobRange} + * @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 All the page ranges. */ - public Response getPageRanges(BlobRange blobRange, BlobAccessConditions accessConditions, Duration timeout) { - return Utility.blockWithOptionalTimeout(pageBlobAsyncClient.getPageRanges(blobRange, accessConditions), timeout); + public Response getPageRangesWithResponse(BlobRange blobRange, BlobAccessConditions accessConditions, + Duration timeout, Context context) { + return Utility.blockWithOptionalTimeout(pageBlobAsyncClient + .getPageRangesWithResponse(blobRange, accessConditions, context), timeout); } /** - * Gets the collection of page ranges that differ between a specified snapshot and this page blob. - * For more information, see the Azure Docs. - * - * @param blobRange - * {@link BlobRange} - * @param prevSnapshot - * Specifies that the response will contain only pages that were changed between target blob and previous - * snapshot. Changed pages include both updated and cleared pages. The target - * blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. - * - * @return - * All the different page ranges. + * Gets the collection of page ranges that differ between a specified snapshot and this page blob. For more + * information, see the Azure + * Docs. + * + * @param blobRange {@link BlobRange} + * @param prevSnapshot Specifies that the response will contain only pages that were changed between target blob and + * previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as + * long as the snapshot specified by prevsnapshot is the older of the two. + * @return All the different page ranges. */ - public Response getPageRangesDiff(BlobRange blobRange, String prevSnapshot) { - return this.getPageRangesDiff(blobRange, prevSnapshot, null, null); + public PageList getPageRangesDiff(BlobRange blobRange, String prevSnapshot) { + return getPageRangesDiffWithResponse(blobRange, prevSnapshot, null, null, Context.NONE).getValue(); } /** - * Gets the collection of page ranges that differ between a specified snapshot and this page blob. - * For more information, see the Azure Docs. - * - * @param blobRange - * {@link BlobRange} - * @param prevSnapshot - * Specifies that the response will contain only pages that were changed between target blob and previous - * snapshot. Changed pages include both updated and cleared pages. The target - * blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * All the different page ranges. + * Gets the collection of page ranges that differ between a specified snapshot and this page blob. For more + * information, see the Azure + * Docs. + * + * @param blobRange {@link BlobRange} + * @param prevSnapshot Specifies that the response will contain only pages that were changed between target blob and + * previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as + * long as the snapshot specified by prevsnapshot is the older of the two. + * @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 All the different page ranges. */ - public Response getPageRangesDiff(BlobRange blobRange, String prevSnapshot, BlobAccessConditions accessConditions, Duration timeout) { - return Utility.blockWithOptionalTimeout(pageBlobAsyncClient.getPageRangesDiff(blobRange, prevSnapshot, accessConditions), timeout); + public Response getPageRangesDiffWithResponse(BlobRange blobRange, String prevSnapshot, + BlobAccessConditions accessConditions, Duration timeout, Context context) { + return Utility.blockWithOptionalTimeout(pageBlobAsyncClient + .getPageRangesDiffWithResponse(blobRange, prevSnapshot, accessConditions, context), timeout); } /** - * Resizes the page blob to the specified size (which must be a multiple of 512). - * For more information, see the Azure Docs. - * - * @param size - * Resizes a page blob to the specified size. If the specified value is less than the current size of the - * blob, then all pages above the specified value are cleared. + * Resizes the page blob to the specified size (which must be a multiple of 512). For more information, see the Azure Docs. * - * @return - * The resized page blob. + * @param size Resizes a page blob to the specified size. If the specified value is less than the current size of + * the blob, then all pages above the specified value are cleared. + * @return The resized page blob. */ - public Response resize(long size) { - return this.resize(size, null, null); + public PageBlobItem resize(long size) { + return resizeWithResponse(size, null, null, Context.NONE).getValue(); } /** - * Resizes the page blob to the specified size (which must be a multiple of 512). - * For more information, see the Azure Docs. - * - * @param size - * Resizes a page blob to the specified size. If the specified value is less than the current size of the - * blob, then all pages above the specified value are cleared. - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The resized page blob. + * Resizes the page blob to the specified size (which must be a multiple of 512). For more information, see the Azure Docs. + * + * @param size Resizes a page blob to the specified size. If the specified value is less than the current size of + * the blob, then all pages above the specified value are cleared. + * @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 resized page blob. */ - public Response resize(long size, BlobAccessConditions accessConditions, Duration timeout) { - Mono> response = pageBlobAsyncClient.resize(size, accessConditions); + public Response resizeWithResponse(long size, BlobAccessConditions accessConditions, Duration timeout, + Context context) { + Mono> response = pageBlobAsyncClient.resizeWithResponse(size, accessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } /** - * Sets the page blob's sequence number. - * For more information, see the Azure Docs. + * Sets the page blob's sequence number. For more information, see the Azure + * Docs. * - * @param action - * Indicates how the service should modify the blob's sequence number. - * @param sequenceNumber - * The blob's sequence number. The sequence number is a user-controlled property that you can use to track - * requests and manage concurrency issues. - * - * @return - * The updated page blob. + * @param action Indicates how the service should modify the blob's sequence number. + * @param sequenceNumber The blob's sequence number. The sequence number is a user-controlled property that you can + * use to track requests and manage concurrency issues. + * @return The updated page blob. */ - public Response updateSequenceNumber(SequenceNumberActionType action, - Long sequenceNumber) { - return this.updateSequenceNumber(action, sequenceNumber, null, null); + public PageBlobItem updateSequenceNumber(SequenceNumberActionType action, + Long sequenceNumber) { + return updateSequenceNumberWithResponse(action, sequenceNumber, null, null, Context.NONE).getValue(); } /** - * Sets the page blob's sequence number. - * For more information, see the Azure Docs. - * - * @param action - * Indicates how the service should modify the blob's sequence number. - * @param sequenceNumber - * The blob's sequence number. The sequence number is a user-controlled property that you can use to track - * requests and manage concurrency issues. - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The updated page blob. + * Sets the page blob's sequence number. For more information, see the Azure + * Docs. + * + * @param action Indicates how the service should modify the blob's sequence number. + * @param sequenceNumber The blob's sequence number. The sequence number is a user-controlled property that you can + * use to track requests and manage concurrency issues. + * @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 updated page blob. */ - public Response updateSequenceNumber(SequenceNumberActionType action, - Long sequenceNumber, BlobAccessConditions accessConditions, Duration timeout) { - Mono> response = pageBlobAsyncClient.updateSequenceNumber(action, sequenceNumber, accessConditions); + public Response updateSequenceNumberWithResponse(SequenceNumberActionType action, + Long sequenceNumber, BlobAccessConditions accessConditions, Duration timeout, Context context) { + Mono> response = pageBlobAsyncClient + .updateSequenceNumberWithResponse(action, sequenceNumber, accessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } /** - * Begins an operation to start an incremental copy from one page blob's snapshot to this page - * blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are - * transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read - * or copied from as usual. For more information, see - * the Azure Docs here and + * Begins an operation to start an incremental copy from one page blob's snapshot to this page blob. The snapshot is + * copied such that only the differential changes between the previously copied snapshot are transferred to the + * destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as + * usual. For more information, see the Azure Docs here + * and * here. * - * @param source - * The source page blob. - * @param snapshot - * The snapshot on the copy source. - * - * @return - * The copy status. + * @param source The source page blob. + * @param snapshot The snapshot on the copy source. + * @return The copy status. */ - public Response copyIncremental(URL source, String snapshot) { - return this.copyIncremental(source, snapshot, null, null); + public CopyStatusType copyIncremental(URL source, String snapshot) { + return copyIncrementalWithResponse(source, snapshot, null, null, Context.NONE).getValue(); } /** - * Begins an operation to start an incremental copy from one page blob's snapshot to this page - * blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are - * transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read - * or copied from as usual. For more information, see - * the Azure Docs here and + * Begins an operation to start an incremental copy from one page blob's snapshot to this page blob. The snapshot is + * copied such that only the differential changes between the previously copied snapshot are transferred to the + * destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as + * usual. For more information, see the Azure Docs here + * and * here. * - * @param source - * The source page blob. - * @param snapshot - * The snapshot on the copy source. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The copy status. + * @param source The source page blob. + * @param snapshot The snapshot on the copy source. + * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and + * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given + * request. The request will fail if the specified condition is not satisfied. + * @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 copy status. */ - public Response copyIncremental(URL source, String snapshot, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { - Mono> response = pageBlobAsyncClient.copyIncremental(source, snapshot, modifiedAccessConditions); + public Response copyIncrementalWithResponse(URL source, String snapshot, + ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { + Mono> response = pageBlobAsyncClient + .copyIncrementalWithResponse(source, snapshot, modifiedAccessConditions, context); return Utility.blockWithOptionalTimeout(response, timeout); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PostProcessor.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PostProcessor.java index 28e6e541cd79..b573adcdf6b6 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PostProcessor.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PostProcessor.java @@ -4,6 +4,7 @@ package com.azure.storage.blob; import com.azure.storage.blob.models.StorageErrorException; +import com.azure.storage.blob.models.StorageException; import com.azure.storage.common.Utility; import reactor.core.publisher.Mono; @@ -11,8 +12,8 @@ final class PostProcessor { static Mono postProcessResponse(Mono response) { return Utility.postProcessResponse(response, (errorResponse) -> errorResponse.onErrorResume(StorageErrorException.class, resume -> - resume.response() - .bodyAsString() + resume.getResponse() + .getBodyAsString() .switchIfEmpty(Mono.just("")) .flatMap(body -> Mono.error(new StorageException(resume, body))) )); diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ProgressReporter.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ProgressReporter.java index 4ac0ce9cda2f..c926bb931785 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ProgressReporter.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ProgressReporter.java @@ -86,7 +86,7 @@ private static class ParallelProgressReporter extends ProgressReporterImpl { We need an AtomicLong to be able to update the value referenced. Because we are already synchronizing with the lock, we don't incur any additional performance hit here by the synchronization. */ - private AtomicLong totalProgress; + private final AtomicLong totalProgress; ParallelProgressReporter(IProgressReceiver progressReceiver, Lock lock, AtomicLong totalProgress) { super(progressReceiver); @@ -136,9 +136,6 @@ public void rewindProgress() { * @param progressReceiver {@link IProgressReceiver} * @return A {@code Flux} that emits the same data as the source but calls a callback to report the total amount of * data emitted so far. - * @apiNote ## Sample Code \n [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=progress - * "Sample code for ProgressReporterFactor.addProgressReporting")] \n For more samples, please see the [Samples - * file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) */ public static Flux addProgressReporting(Flux data, IProgressReceiver progressReceiver) { if (progressReceiver == null) { @@ -149,7 +146,8 @@ public static Flux addProgressReporting(Flux data, IProg } } - static Flux addParallelProgressReporting(Flux data, IProgressReceiver progressReceiver, Lock lock, AtomicLong totalProgress) { + static Flux addParallelProgressReporting(Flux data, IProgressReceiver progressReceiver, + Lock lock, AtomicLong totalProgress) { if (progressReceiver == null) { return data; } else { diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/SASQueryParameters.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/SASQueryParameters.java deleted file mode 100644 index 139fd8179f93..000000000000 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/SASQueryParameters.java +++ /dev/null @@ -1,400 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -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 java.time.OffsetDateTime; -import java.util.Map; -import java.util.function.Function; - -/** - * Represents the components that make up an Azure Storage SAS' query parameters. This type is not constructed directly - * by the user; it is only generated by the {@link AccountSASSignatureValues} and {@link ServiceSASSignatureValues} - * types. Once generated, it can be set on a {@link BlobURLParts} object to be constructed as part of a URL or it can be - * encoded into a {@code String} and appended to a URL directly (though caution should be taken here in case there are - * existing query parameters, which might affect the appropriate means of appending these query parameters). NOTE: - * Instances of this class are immutable to ensure thread safety. - */ -public final class SASQueryParameters { - - private final String version; - - private final String services; - - private final String resourceTypes; - - private final SASProtocol protocol; - - private final OffsetDateTime startTime; - - private final OffsetDateTime expiryTime; - - private final IPRange ipRange; - - private final String identifier; - - private final String keyOid; - - private final String keyTid; - - private final OffsetDateTime keyStart; - - private final OffsetDateTime keyExpiry; - - private final String keyService; - - private final String keyVersion; - - private final String resource; - - private final String permissions; - - private final String signature; - - private final String cacheControl; - - private final String contentDisposition; - - private final String contentEncoding; - - private final String contentLanguage; - - private final String contentType; - - /** - * Creates a new {@link SASQueryParameters} object. - * - * @param queryParamsMap All query parameters for the request as key-value pairs - * @param removeSASParametersFromMap When {@code true}, the SAS query parameters will be removed from - * queryParamsMap - */ - public SASQueryParameters(Map queryParamsMap, boolean removeSASParametersFromMap) { - this.version = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SERVICE_VERSION, removeSASParametersFromMap); - this.services = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SERVICES, removeSASParametersFromMap); - this.resourceTypes = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_RESOURCES_TYPES, removeSASParametersFromMap); - this.protocol = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_PROTOCOL, removeSASParametersFromMap, SASProtocol::parse); - this.startTime = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_START_TIME, removeSASParametersFromMap, Utility::parseDate); - this.expiryTime = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_EXPIRY_TIME, removeSASParametersFromMap, Utility::parseDate); - this.ipRange = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_IP_RANGE, removeSASParametersFromMap, IPRange::parse); - this.identifier = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_IDENTIFIER, removeSASParametersFromMap); - this.keyOid = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_OBJECT_ID, removeSASParametersFromMap); - this.keyTid = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_TENANT_ID, removeSASParametersFromMap); - this.keyStart = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_KEY_START, removeSASParametersFromMap, Utility::parseDate); - this.keyExpiry = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_KEY_EXPIRY, removeSASParametersFromMap, Utility::parseDate); - this.keyService = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_KEY_SERVICE, removeSASParametersFromMap); - this.keyVersion = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_KEY_VERSION, removeSASParametersFromMap); - this.resource = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_RESOURCE, removeSASParametersFromMap); - this.permissions = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_PERMISSIONS, removeSASParametersFromMap); - this.signature = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNATURE, removeSASParametersFromMap); - this.cacheControl = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_CACHE_CONTROL, removeSASParametersFromMap); - this.contentDisposition = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_CONTENT_DISPOSITION, removeSASParametersFromMap); - this.contentEncoding = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_CONTENT_ENCODING, removeSASParametersFromMap); - this.contentLanguage = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_CONTENT_LANGUAGE, removeSASParametersFromMap); - this.contentType = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_CONTENT_TYPE, removeSASParametersFromMap); - } - - private String getQueryParameter(Map parameters, String name, boolean remove) { - return getQueryParameter(parameters, name, remove, value -> value); - } - - private T getQueryParameter(Map parameters, String name, Boolean remove, Function converter) { - String[] parameterValue = parameters.get(name); - if (parameterValue == null) { - return null; - } - - if (remove) { - parameters.remove(name); - } - - return converter.apply(parameterValue[0]); - } - - - /** - * Creates a new {@link SASQueryParameters} object. These objects are only created internally by SASSignatureValues - * classes. - * - * @param version A {@code String} representing the storage version. - * @param services A {@code String} representing the storage services being accessed (only for Account SAS). - * @param resourceTypes A {@code String} representing the storage resource types being accessed (only for Account - * SAS). - * @param protocol A {@code String} representing the allowed HTTP protocol(s) or {@code null}. - * @param startTime A {@code java.util.Date} representing the start time for this SAS token or {@code null}. - * @param expiryTime A {@code java.util.Date} representing the expiry time for this SAS token. - * @param ipRange A {@link IPRange} representing the range of valid IP addresses for this SAS token or {@code - * null}. - * @param identifier A {@code String} representing the signed identifier (only for Service SAS) or {@code null}. - * @param resource A {@code String} representing the storage container or blob (only for Service SAS). - * @param permissions A {@code String} representing the storage permissions or {@code null}. - * @param signature A {@code String} representing the signature for the SAS token. - */ - SASQueryParameters(String version, String services, String resourceTypes, 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) { - - this.version = version; - this.services = services; - this.resourceTypes = resourceTypes; - this.protocol = protocol; - this.startTime = startTime; - this.expiryTime = expiryTime; - this.ipRange = ipRange; - this.identifier = identifier; - this.resource = resource; - this.permissions = permissions; - this.signature = signature; - this.cacheControl = cacheControl; - this.contentDisposition = contentDisposition; - this.contentEncoding = contentEncoding; - this.contentLanguage = contentLanguage; - this.contentType = contentType; - - if (key != null) { - this.keyOid = key.signedOid(); - this.keyTid = key.signedTid(); - this.keyStart = key.signedStart(); - this.keyExpiry = key.signedExpiry(); - this.keyService = key.signedService(); - this.keyVersion = key.signedVersion(); - } else { - this.keyOid = null; - this.keyTid = null; - this.keyStart = null; - this.keyExpiry = null; - this.keyService = null; - this.keyVersion = null; - } - } - - /** - * @return The storage version - */ - public String version() { - return version; - } - - /** - * @return The storage services being accessed (only for Account SAS). Please refer to {@link AccountSASService} for - * more details. - */ - public String services() { - return services; - } - - /** - * @return The storage resource types being accessed (only for Account SAS). Please refer to {@link - * AccountSASResourceType} for more details. - */ - public String resourceTypes() { - return resourceTypes; - } - - /** - * @return The allowed HTTP protocol(s) or {@code null}. Please refer to {@link SASProtocol} for more details. - */ - public SASProtocol protocol() { - return protocol; - } - - /** - * @return The start time for this SAS token or {@code null}. - */ - public OffsetDateTime startTime() { - return startTime; - } - - /** - * @return The expiry time for this SAS token. - */ - public OffsetDateTime expiryTime() { - return expiryTime; - } - - /** - * @return {@link IPRange} - */ - public IPRange ipRange() { - return ipRange; - } - - /** - * @return The signed identifier (only for {@link ServiceSASSignatureValues}) or {@code null}. Please see - * here - * for more information. - */ - public String identifier() { - return identifier; - } - - /** - * @return The storage container or blob (only for {@link ServiceSASSignatureValues}). - */ - public String resource() { - return resource; - } - - /** - * @return Please refer to {@link AccountSASPermission}, {@link BlobSASPermission}, or {@link - * ContainerSASPermission} for more details. - */ - public String permissions() { - return permissions; - } - - /** - * @return The signature for the SAS token. - */ - public String signature() { - return signature; - } - - /** - * @return The Cache-Control header value when a client accesses the resource with this sas token. - */ - public String cacheControl() { - return cacheControl; - } - - /** - * @return The Content-Disposition header value when a client accesses the resource with this sas token. - */ - public String contentDisposition() { - return contentDisposition; - } - - /** - * @return The Content-Encoding header value when a client accesses the resource with this sas token. - */ - public String contentEncoding() { - return contentEncoding; - } - - /** - * @return The Content-Language header value when a client accesses the resource with this sas token. - */ - public String contentLanguage() { - return contentLanguage; - } - - /** - * @return The Content-Type header value when a client accesses the resource with this sas token. - */ - public String contentType() { - return contentType; - } - - /** - * @return the object ID of the key. - */ - public String keyOid() { - return keyOid; - } - - /** - * @return the tenant ID of the key. - */ - public String keyTid() { - return keyTid; - } - - /** - * @return the datetime when the key becomes active. - */ - public OffsetDateTime keyStart() { - return keyStart; - } - - /** - * @return the datetime when the key expires. - */ - public OffsetDateTime keyExpiry() { - return keyExpiry; - } - - /** - * @return the services that are permitted by the key. - */ - public String keyService() { - return keyService; - } - - /** - * @return the service version that created the key. - */ - public String keyVersion() { - return keyVersion; - } - - UserDelegationKey userDelegationKey() { - return new UserDelegationKey() - .signedExpiry(this.keyExpiry) - .signedOid(this.keyOid) - .signedService(this.keyService) - .signedStart(this.keyStart) - .signedTid(this.keyTid) - .signedVersion(this.keyVersion); - } - - private void tryAppendQueryParameter(StringBuilder sb, String param, Object value) { - if (value != null) { - if (sb.length() != 0) { - sb.append('&'); - } - sb.append(Utility.urlEncode(param)).append('=').append(Utility.urlEncode(value.toString())); - } - } - - private String formatQueryParameterDate(OffsetDateTime dateTime) { - if (dateTime == null) { - return null; - } else { - return Utility.ISO_8601_UTC_DATE_FORMATTER.format(dateTime); - } - } - - /** - * Encodes all SAS query parameters into a string that can be appended to a URL. - * - * @return A {@code String} representing all SAS query parameters. - */ - public String encode() { - /* - We should be url-encoding each key and each value, but because we know all the keys and values will encode to - themselves, we cheat except for the signature value. - */ - StringBuilder sb = new StringBuilder(); - - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SERVICE_VERSION, this.version); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SERVICES, this.services); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_RESOURCES_TYPES, this.resourceTypes); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_PROTOCOL, this.protocol); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_START_TIME, formatQueryParameterDate(this.startTime)); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_EXPIRY_TIME, formatQueryParameterDate(this.expiryTime)); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_IP_RANGE, this.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_KEY_START, formatQueryParameterDate(this.keyStart)); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_KEY_EXPIRY, formatQueryParameterDate(this.keyExpiry)); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_KEY_SERVICE, this.keyService); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_KEY_VERSION, this.keyVersion); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_RESOURCE, this.resource); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_PERMISSIONS, this.permissions); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNATURE, this.signature); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CACHE_CONTROL, this.cacheControl); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CONTENT_DISPOSITION, this.contentDisposition); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CONTENT_ENCODING, this.contentEncoding); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CONTENT_LANGUAGE, this.contentLanguage); - tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_CONTENT_TYPE, this.contentType); - - return sb.toString(); - } -} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ServiceSASSignatureValues.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ServiceSASSignatureValues.java deleted file mode 100644 index a62f85d78643..000000000000 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ServiceSASSignatureValues.java +++ /dev/null @@ -1,518 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -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 java.net.MalformedURLException; -import java.net.URL; -import java.time.OffsetDateTime; - -/** - * ServiceSASSignatureValues 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 which - * can actually be applied to blob urls. Note: that both this class and {@link SASQueryParameters} exist because the - * former is mutable and a logical representation while the latter is immutable and used to generate actual REST - * requests. - *

    - * Please see here - * for more conceptual information on SAS. - *

    - * Please see here for - * more details on each value, including which are required. - * - *

    Please see - * here - * for additional samples.

    - */ -final class ServiceSASSignatureValues { - - private String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION; - - private SASProtocol protocol; - - private OffsetDateTime startTime; - - private OffsetDateTime expiryTime; - - private String permissions; - - private IPRange ipRange; - - private String canonicalName; - - private String resource; - - private String snapshotId; - - private String identifier; - - private String cacheControl; - - private String contentDisposition; - - private String contentEncoding; - - private String contentLanguage; - - private String contentType; - - /** - * Creates an object with empty values for all fields. - */ - ServiceSASSignatureValues() { - } - - /** - * Creates an object with the specified expiry time and permissions - * - * @param expiryTime Time the SAS becomes valid - * @param permissions Permissions granted by the SAS - */ - ServiceSASSignatureValues(OffsetDateTime expiryTime, String permissions) { - this.expiryTime = expiryTime; - this.permissions = permissions; - } - - /** - * Creates an object with the specified identifier - * - * @param identifier Identifier for the SAS - */ - ServiceSASSignatureValues(String identifier) { - this.identifier = identifier; - } - - ServiceSASSignatureValues(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) { - this.version = version; - } - this.protocol = sasProtocol; - this.startTime = startTime; - this.expiryTime = expiryTime; - this.permissions = permission; - this.ipRange = ipRange; - this.identifier = identifier; - this.cacheControl = cacheControl; - this.contentDisposition = contentDisposition; - this.contentEncoding = contentEncoding; - this.contentLanguage = contentLanguage; - this.contentType = contentType; - } - - /** - * @return the version of the service this SAS will target. If not specified, it will default to the version targeted - * by the library. - */ - public String version() { - return version; - } - - /** - * Sets the version of the service this SAS will target. If not specified, it will default to the version targeted - * by the library. - * - * @param version Version to target - * @return the updated ServiceSASSignatureValues object - */ - public ServiceSASSignatureValues version(String version) { - this.version = version; - return this; - } - - /** - * @return the {@link SASProtocol} which determines the protocols allowed by the SAS. - */ - public SASProtocol protocol() { - return protocol; - } - - /** - * Sets the {@link SASProtocol} which determines the protocols allowed by the SAS. - * - * @param protocol Protocol for the SAS - * @return the updated ServiceSASSignatureValues object - */ - public ServiceSASSignatureValues protocol(SASProtocol protocol) { - this.protocol = protocol; - return this; - } - - /** - * @return when the SAS will take effect. - */ - public OffsetDateTime startTime() { - return startTime; - } - - /** - * Sets when the SAS will take effect. - * - * @param startTime When the SAS takes effect - * @return the updated ServiceSASSignatureValues object - */ - public ServiceSASSignatureValues startTime(OffsetDateTime startTime) { - this.startTime = startTime; - return this; - } - - /** - * @return the time after which the SAS will no longer work. - */ - public OffsetDateTime expiryTime() { - return expiryTime; - } - - /** - * Sets the time after which the SAS will no longer work. - * - * @param expiryTime When the SAS will no longer work - * @return the updated ServiceSASSignatureValues object - */ - public ServiceSASSignatureValues expiryTime(OffsetDateTime expiryTime) { - this.expiryTime = expiryTime; - return this; - } - - /** - * @return the permissions string allowed by the SAS. Please refer to either {@link ContainerSASPermission} or - * {@link BlobSASPermission} depending on the resource being accessed for help determining the pernissions allowed. - */ - public String permissions() { - return permissions; - } - - /** - * Sets the permissions string allowed by the SAS. Please refer to either {@link ContainerSASPermission} or - * {@link BlobSASPermission} depending on the resource being accessed for help constructing the permissions string. - * - * @param permissions Permissions string for the SAS - * @return the updated ServiceSASSignatureValues object - */ - public ServiceSASSignatureValues permissions(String permissions) { - this.permissions = permissions; - return this; - } - - /** - * @return the {@link IPRange} which determines the IP ranges that are allowed to use the SAS. - */ - public IPRange ipRange() { - return ipRange; - } - - /** - * 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 ServiceSASSignatureValues object - */ - public ServiceSASSignatureValues ipRange(IPRange ipRange) { - this.ipRange = ipRange; - return this; - } - - /** - * @return the resource the SAS user may access. - */ - public String resource() { - return resource; - } - - /** - * Sets the resource the SAS user may access. - * - * @param resource Allowed resources string to set - * @return the updated ServiceSASSignatureValues object - */ - public ServiceSASSignatureValues resource(String resource) { - this.resource = resource; - return this; - } - - /** - * @return the canonical name of the object the SAS user may access. - */ - public String canonicalName() { - return canonicalName; - } - - /** - * Sets the canonical name of the object the SAS user may access. - * - * @param canonicalName Canonical name of the object the SAS grants access - * @return the updated ServiceSASSignatureValues object - */ - public ServiceSASSignatureValues canonicalName(String canonicalName) { - this.canonicalName = canonicalName; - return this; - } - - /** - * Sets the canonical name of the object the SAS user may access. Constructs a canonical name of - * "/blob/{accountName}{Path of urlString}". - * - * @param urlString URL string that contains the path to the object - * @param accountName Name of the account that contains the object - * @return the updated ServiceSASSignatureValues object - * @throws RuntimeException If {@code urlString} is a malformed URL. - */ - public ServiceSASSignatureValues canonicalName(String urlString, String accountName) { - URL url; - try { - url = new URL(urlString); - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - - this.canonicalName = String.format("/blob/%s%s", accountName, url.getPath()); - return this; - } - - /** - * @return the specific snapshot the SAS user may access. - */ - public String snapshotId() { - return this.snapshotId; - } - - /** - * Sets the specific snapshot the SAS user may access. - * - * @param snapshotId Identifier of the snapshot - * @return the updated ServiceSASSignatureValues object - */ - public ServiceSASSignatureValues snapshotId(String snapshotId) { - this.snapshotId = snapshotId; - return this; - } - - /** - * @return the name of the access policy on the container this SAS references if any. Please see - * here - * for more information. - */ - public String identifier() { - return identifier; - } - - /** - * Sets the name of the access policy on the container this SAS references if any. Please see - * here - * for more information. - * - * @param identifier Name of the access policy - * @return the updated ServiceSASSignatureValues object - */ - public ServiceSASSignatureValues identifier(String identifier) { - this.identifier = identifier; - return this; - } - - /** - * @return the cache-control header for the SAS. - */ - public String cacheControl() { - return cacheControl; - } - - /** - * Sets the cache-control header for the SAS. - * - * @param cacheControl Cache-Control header value - * @return the updated ServiceSASSignatureValues object - */ - public ServiceSASSignatureValues cacheControl(String cacheControl) { - this.cacheControl = cacheControl; - return this; - } - - /** - * @return the content-disposition header for the SAS. - */ - public String contentDisposition() { - return contentDisposition; - } - - /** - * Sets the content-disposition header for the SAS. - * - * @param contentDisposition Content-Disposition header value - * @return the updated ServiceSASSignatureValues object - */ - public ServiceSASSignatureValues contentDisposition(String contentDisposition) { - this.contentDisposition = contentDisposition; - return this; - } - - /** - * @return the content-encoding header for the SAS. - */ - public String contentEncoding() { - return contentEncoding; - } - - /** - * Sets the content-encoding header for the SAS. - * - * @param contentEncoding Content-Encoding header value - * @return the updated ServiceSASSignatureValues object - */ - public ServiceSASSignatureValues contentEncoding(String contentEncoding) { - this.contentEncoding = contentEncoding; - return this; - } - - /** - * @return the content-language header for the SAS. - */ - public String contentLanguage() { - return contentLanguage; - } - - /** - * Sets the content-language header for the SAS. - * - * @param contentLanguage Content-Language header value - * @return the updated ServiceSASSignatureValues object - */ - public ServiceSASSignatureValues contentLanguage(String contentLanguage) { - this.contentLanguage = contentLanguage; - return this; - } - - /** - * @return the content-type header for the SAS. - */ - public String contentType() { - return contentType; - } - - /** - * Sets the content-type header for the SAS. - * - * @param contentType Content-Type header value - * @return the updated ServiceSASSignatureValues object - */ - public ServiceSASSignatureValues contentType(String contentType) { - this.contentType = contentType; - return this; - } - - /** - * Uses an account's shared key credential to sign these signature values to produce the proper SAS query - * parameters. - * - * @param sharedKeyCredentials A {@link SharedKeyCredential} object used to sign the SAS values. - * @return {@link SASQueryParameters} - * @throws IllegalStateException If the HMAC-SHA256 algorithm isn't supported, if the key isn't a valid Base64 - * encoded string, or the UTF-8 charset isn't supported. - */ - public SASQueryParameters generateSASQueryParameters(SharedKeyCredential sharedKeyCredentials) { - Utility.assertNotNull("sharedKeyCredentials", sharedKeyCredentials); - assertGenerateOK(false); - - // Signature is generated on the un-url-encoded values. - String signature = sharedKeyCredentials.computeHmac256(stringToSign()); - - return new SASQueryParameters(this.version, null, null, - this.protocol, this.startTime, this.expiryTime, this.ipRange, this.identifier, resource, - this.permissions, signature, this.cacheControl, this.contentDisposition, this.contentEncoding, - this.contentLanguage, this.contentType, null /* delegate */); - } - - /** - * Uses a user delegation key to sign these signature values to produce the proper SAS query parameters. - * - * @param delegationKey A {@link UserDelegationKey} object used to sign the SAS values. - * @return {@link SASQueryParameters} - * @throws IllegalStateException If the HMAC-SHA256 algorithm isn't supported, if the key isn't a valid Base64 - * encoded string, or the UTF-8 charset isn't supported. - */ - public SASQueryParameters generateSASQueryParameters(UserDelegationKey delegationKey) { - Utility.assertNotNull("delegationKey", delegationKey); - assertGenerateOK(true); - - // Signature is generated on the un-url-encoded values. - String signature = Utility.computeHMac256(delegationKey.value(), stringToSign(delegationKey)); - - return new SASQueryParameters(this.version, null, null, - this.protocol, this.startTime, this.expiryTime, this.ipRange, null /* identifier */, resource, - this.permissions, signature, this.cacheControl, this.contentDisposition, this.contentEncoding, - this.contentLanguage, this.contentType, delegationKey); - } - - /** - * Common assertions for generateSASQueryParameters overloads. - */ - private void assertGenerateOK(boolean usingUserDelegation) { - Utility.assertNotNull("version", this.version); - Utility.assertNotNull("canonicalName", this.canonicalName); - - // If a UserDelegation key or a SignedIdentifier is not being used both expiryDate and permissions must be set. - if (usingUserDelegation || identifier == null) { - Utility.assertNotNull("expiryTime", this.expiryTime); - Utility.assertNotNull("permissions", this.permissions); - } else if (!usingUserDelegation) { - // Otherwise a SignedIdentifier must be used. - Utility.assertNotNull("identifier", this.identifier); - } - - if (Constants.UrlConstants.SAS_CONTAINER_CONSTANT.equals(this.resource) && this.snapshotId != null) { - throw new IllegalArgumentException("Cannot set a snapshotId without resource being a blob."); - } - } - - private String stringToSign() { - return String.join("\n", - this.permissions == null ? "" : this.permissions, - this.startTime == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(this.startTime), - this.expiryTime == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(this.expiryTime), - this.canonicalName == null ? "" : this.canonicalName, - this.identifier == null ? "" : this.identifier, - this.ipRange == null ? "" : this.ipRange.toString(), - this.protocol == null ? "" : protocol.toString(), - this.version == null ? "" : this.version, - this.resource == null ? "" : this.resource, - this.snapshotId == null ? "" : this.snapshotId, - this.cacheControl == null ? "" : this.cacheControl, - this.contentDisposition == null ? "" : this.contentDisposition, - this.contentEncoding == null ? "" : this.contentEncoding, - this.contentLanguage == null ? "" : this.contentLanguage, - this.contentType == null ? "" : this.contentType - ); - } - - private String stringToSign(final UserDelegationKey key) { - return String.join("\n", - this.permissions == null ? "" : this.permissions, - this.startTime == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(this.startTime), - this.expiryTime == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(this.expiryTime), - this.canonicalName == null ? "" : this.canonicalName, - key.signedOid() == null ? "" : key.signedOid(), - key.signedTid() == null ? "" : key.signedTid(), - key.signedStart() == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(key.signedStart()), - key.signedExpiry() == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(key.signedExpiry()), - key.signedService() == null ? "" : key.signedService(), - key.signedVersion() == null ? "" : key.signedVersion(), - this.ipRange == null ? "" : this.ipRange.toString(), - this.protocol == null ? "" : this.protocol.toString(), - this.version == null ? "" : this.version, - this.resource == null ? "" : this.resource, - this.snapshotId == null ? "" : this.snapshotId, - this.cacheControl == null ? "" : this.cacheControl, - this.contentDisposition == null ? "" : this.contentDisposition, - this.contentEncoding == null ? "" : this.contentEncoding, - this.contentLanguage == null ? "" : this.contentLanguage, - this.contentType == null ? "" : this.contentType - ); - } -} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/StorageException.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/StorageException.java deleted file mode 100644 index cff087ff1b52..000000000000 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/StorageException.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.exception.HttpResponseException; -import com.azure.storage.blob.models.StorageErrorCode; -import com.azure.storage.blob.models.StorageErrorException; -import com.azure.storage.common.Constants; - -/** - * A {@code StorageException} is thrown whenever Azure Storage successfully returns an error code that is not 200-level. - * Users can inspect the status code and error code to determine the cause of the error response. The exception message - * may also contain more detailed information depending on the type of error. The user may also inspect the raw HTTP - * response or call toString to get the full payload of the error response if present. - * Note that even some expected "errors" will be thrown as a {@code StorageException}. For example, some users may - * perform a getProperties request on an entity to determine whether it exists or not. If it does not exists, an - * exception will be thrown even though this may be considered an expected indication of absence in this case. - * - *

    Sample Code

    - *

    For more samples, please see the sample file

    - */ -public final class StorageException extends HttpResponseException { - - private final String message; - - StorageException(StorageErrorException e, String responseBody) { - super(e.getMessage(), e.response(), e); - this.message = responseBody; - } - - /** - * @return The error code returned by the service. - */ - public StorageErrorCode errorCode() { - return StorageErrorCode.fromString(super.response().headers().value(Constants.HeaderConstants.ERROR_CODE)); - } - - /** - * @return The message returned by the service. - */ - public String message() { - return this.message; - } - - /** - * @return The status code on the response. - */ - public int statusCode() { - return super.response().statusCode(); - } -} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/URLParser.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/URLParser.java index 4ec53cd475c4..141a50119f93 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/URLParser.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/URLParser.java @@ -22,9 +22,7 @@ final class URLParser { * Any other query parameters remain in the UnparsedParams field. This method overwrites all fields in the * BlobURLParts object. * - * @param url - * The {@code URL} to be parsed. - * + * @param url The {@code URL} to be parsed. * @return A {@link BlobURLParts} object containing all the components of a BlobURL. */ public static BlobURLParts parse(URL url) { @@ -62,34 +60,28 @@ public static BlobURLParts parse(URL url) { queryParamsMap.remove("snapshot"); } - SASQueryParameters sasQueryParameters = new SASQueryParameters(queryParamsMap, true); + BlobServiceSASQueryParameters blobServiceSasQueryParameters = + new BlobServiceSASQueryParameters(queryParamsMap, true); return new BlobURLParts() - .scheme(scheme) - .host(host) - .containerName(containerName) - .blobName(blobName) - .snapshot(snapshot) - .sasQueryParameters(sasQueryParameters) - .unparsedParameters(queryParamsMap); + .setScheme(scheme) + .setHost(host) + .setContainerName(containerName) + .setBlobName(blobName) + .setSnapshot(snapshot) + .setSasQueryParameters(blobServiceSasQueryParameters) + .setUnparsedParameters(queryParamsMap); } /** * Parses a query string into a one to many hashmap. * - * @param queryParams - * The string of query params to parse. - * + * @param queryParams The string of query params to parse. * @return A {@code HashMap} of the key values. */ private static TreeMap parseQueryString(String queryParams) { - final TreeMap retVals = new TreeMap(new Comparator() { - @Override - public int compare(String s1, String s2) { - return s1.compareTo(s2); - } - }); + final TreeMap retVals = new TreeMap<>(Comparator.naturalOrder()); if (ImplUtils.isNullOrEmpty(queryParams)) { return retVals; @@ -99,11 +91,11 @@ public int compare(String s1, String s2) { final String[] valuePairs = queryParams.split("&"); // for each field value pair parse into appropriate map entries - for (int m = 0; m < valuePairs.length; m++) { + for (String valuePair : valuePairs) { // Getting key and value for a single query parameter - final int equalDex = valuePairs[m].indexOf("="); - String key = Utility.urlDecode(valuePairs[m].substring(0, equalDex)).toLowerCase(Locale.ROOT); - String value = Utility.urlDecode(valuePairs[m].substring(equalDex + 1)); + final int equalDex = valuePair.indexOf("="); + String key = Utility.urlDecode(valuePair.substring(0, equalDex)).toLowerCase(Locale.ROOT); + String value = Utility.urlDecode(valuePair.substring(equalDex + 1)); // add to map String[] keyValues = retVals.get(key); @@ -115,9 +107,7 @@ public int compare(String s1, String s2) { } else { // map contains this key already so append final String[] newValues = new String[keyValues.length + 1]; - for (int j = 0; j < keyValues.length; j++) { - newValues[j] = keyValues[j]; - } + System.arraycopy(keyValues, 0, newValues, 0, keyValues.length); newValues[newValues.length - 1] = value; keyValues = newValues; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/UnexpectedLengthException.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/UnexpectedLengthException.java deleted file mode 100644 index 3fa8b292768d..000000000000 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/UnexpectedLengthException.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -/** - * This exception class represents an error when the specified input length doesn't match the data length. - */ -public final class UnexpectedLengthException extends IllegalStateException { - private final long bytesRead; - private final long bytesExpected; - - UnexpectedLengthException(String message, long bytesRead, long bytesExpected) { - super(message); - this.bytesRead = bytesRead; - this.bytesExpected = bytesExpected; - } - - /** - * @return the number of bytes read from the input - */ - public long bytesRead() { - return this.bytesRead; - } - - /** - * @return the number of bytes that were expected to be read from the input - */ - public long bytesExpected() { - return this.bytesExpected; - } -} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/UploadBufferPool.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/UploadBufferPool.java new file mode 100644 index 000000000000..b6278f480c2c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/UploadBufferPool.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +import com.azure.core.util.logging.ClientLogger; +import com.azure.storage.common.Utility; +import reactor.core.publisher.Flux; + +import java.nio.ByteBuffer; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.LinkedBlockingQueue; + +/** + * This type is to support the implementation of buffered upload only. It is mandatory that the caller has broken the + * source into ByteBuffers that are no greater than the size of a chunk and therefore a buffer in the pool. This is + * necessary because it upper bounds the number of buffers we need for a given call to write() to 2. If the size of + * ByteBuffer passed into write() were unbounded, the pool could stall as it would run out of buffers before it is able + * to return a result, and if it is unable to return, no data can be uploaded and therefore no pools returned. + * + * It is incumbent upon the caller to return the buffers after an upload is completed. It is also the caller's + * responsibility to signal to the pool when the stream is empty and call flush to return any data still sitting in the + * pool. + * + * Broadly, the workflow of this operation is to chunk the source into reasonable sized pieces. On each piece, one + * thread will call write on the pool. The pool will grab a buffer from the queue to write to, possibly waiting for one + * to be available, and either store the incomplete buffer to be filled on the next write or return the filled buffer to + * be sent. Filled buffers can be uploaded in parallel and should return buffers to the pool after the upload completes. + * Once the source terminates, it should call flush. + */ +final class UploadBufferPool { + private final ClientLogger logger = new ClientLogger(UploadBufferPool.class); + + /* + Note that a blocking on a synchronized object is not the same as blocking on a reactive operation; blocking on this + queue will not compromise the async nature of this workflow. Fluxes themselves are internally synchronized to ensure + only one call to onNext happens at a time. + */ + private final BlockingQueue buffers; + + private final int maxBuffs; + + // The number of buffs we have allocated. We can query the queue for how many are available. + private int numBuffs = 0; + + private final int buffSize; + + private ByteBuffer currentBuf; + + UploadBufferPool(final int numBuffs, final int buffSize) { + /* + We require at least two buffers because it is possible that a given write will spill over into a second buffer. + We only need one overflow buffer because the max size of a ByteBuffer is assumed to be the size as a buffer in + the pool. + */ + Utility.assertInBounds("numBuffs", numBuffs, 2, Integer.MAX_VALUE); + this.maxBuffs = numBuffs; + buffers = new LinkedBlockingQueue<>(numBuffs); + + + // These buffers will be used in calls to stageBlock, so they must be no greater than block size. + Utility.assertInBounds("buffSize", buffSize, 1, BlockBlobClient.MAX_STAGE_BLOCK_BYTES); + this.buffSize = buffSize; + + // We prep the queue with two buffers in case there is overflow. + buffers.add(ByteBuffer.allocate(this.buffSize)); + buffers.add(ByteBuffer.allocate(this.buffSize)); + this.numBuffs = 2; + } + + /* + Note that the upload method will be calling write sequentially as there is only one worker reading from the source + and calling write. This means operations like currentBuf.remaining() will not result in race conditions. + */ + Flux write(ByteBuffer buf) { + // Check if there's a buffer holding any data from a previous call to write. If not, get a new one. + if (this.currentBuf == null) { + this.currentBuf = this.getBuffer(); + } + + Flux result; + // We can fit this whole write in the buffer we currently have. + if (this.currentBuf.remaining() >= buf.remaining()) { + this.currentBuf.put(buf); + if (this.currentBuf.remaining() == 0) { + // Reset the position so that we can read the whole thing then return this buffer. + this.currentBuf.position(0); + result = Flux.just(this.currentBuf); + // This will force us to get a new buffer next time we try to write. + this.currentBuf = null; + } else { + /* + We are still filling the current buffer, so we have no data to return. We will return the buffer once it + is filled + */ + result = Flux.empty(); + } + } else { + // We will overflow the current buffer and require another one. + // Adjust the window of buf so that we fill up currentBuf without going out of bounds. + int oldLimit = buf.limit(); + buf.limit(buf.position() + this.currentBuf.remaining()); + this.currentBuf.put(buf); + // Set the old limit so we can read to the end in the next buffer. + buf.limit(oldLimit); + + // Reset the position so we can read the buffer. + this.currentBuf.position(0); + result = Flux.just(this.currentBuf); + + /* + Get a new buffer and fill it with whatever is left from buf. Note that this relies on the assumption that + the source Flux has been split up into buffers that are no bigger than chunk size. This assumption + means we'll only have to over flow once, and the buffer we overflow into will not be filled. This is the + buffer we will write to on the next call to write(). + */ + this.currentBuf = this.getBuffer(); + this.currentBuf.put(buf); + } + return result; + } + + /* + Note that the upload method will be calling write sequentially as there is only one worker reading from the source + and calling write. Hence there is only one worker calling getBuffer at any time. + */ + private ByteBuffer getBuffer() { + ByteBuffer result; + /* + There are no buffers in the queue and we have space to allocate one. We do not add the new buffer to the queue + because we want to make immediate use of it. This is effectively equivalent to a buffers.add(newBuffer) and + then result = buffers.pop()--because we only get here when the queue is empty, the buffer returned is the one + we just created. The new buffer will be added to buffers when it is returned to the pool. + */ + if (this.buffers.isEmpty() && this.numBuffs < this.maxBuffs) { + result = ByteBuffer.allocate(this.buffSize); + this.numBuffs++; + } else { + try { + // If empty, this will wait for an upload to finish and return a buffer. + result = this.buffers.take(); + + } catch (InterruptedException e) { + throw logger.logExceptionAsError(new IllegalStateException("BufferedUpload thread interrupted. Thread:" + + Thread.currentThread().getId())); + } + } + return result; + } + + Flux flush() { + /* + Prep and return any data left in the pool. It is important to set the limit so that we don't read beyond the + actual data as this buffer may have been used before and therefore may have some garbage at the end. + */ + if (this.currentBuf != null) { + this.currentBuf.flip(); + ByteBuffer last = this.currentBuf; + // If there is an accidental duplicate call to flush, this prevents sending the last buffer twice + this.currentBuf = null; + return Flux.just(last); + } + return Flux.empty(); + } + + void returnBuffer(ByteBuffer b) { + // Reset the buffer. + b.position(0); + b.limit(b.capacity()); + + try { + this.buffers.put(b); + } catch (InterruptedException e) { + throw logger.logExceptionAsError(new IllegalStateException("UploadFromStream thread interrupted.")); + } + } +} 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 3439bb917017..d27a29191674 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 @@ -25,13 +25,14 @@ import com.azure.storage.blob.models.AppendBlobsCreateResponse; import com.azure.storage.blob.models.AppendPositionAccessConditions; 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; import com.azure.storage.blob.models.ModifiedAccessConditions; import com.azure.storage.blob.models.SourceModifiedAccessConditions; import com.azure.storage.blob.models.StorageErrorException; -import io.netty.buffer.ByteBuf; import java.net.URL; +import java.nio.ByteBuffer; import java.time.OffsetDateTime; import java.util.Map; import reactor.core.publisher.Flux; @@ -72,17 +73,17 @@ private interface AppendBlobsService { @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono create(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-meta-") Map metadata, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-blob-type") String blobType, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @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 create(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-blob-type") String blobType, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @HeaderParam("x-ms-blob-content-disposition") String blobContentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-encryption-key") String encryptionKey, @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @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({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono appendBlock(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @BodyParam("application/octet-stream") Flux body, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String transactionalContentMD5, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-blob-condition-maxsize") Long maxSize, @HeaderParam("x-ms-blob-condition-appendpos") Long appendPosition, @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 appendBlock(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @BodyParam("application/octet-stream") Flux body, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String transactionalContentMD5, @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-blob-condition-maxsize") Long maxSize, @HeaderParam("x-ms-blob-condition-appendpos") Long appendPosition, @HeaderParam("x-ms-encryption-key") String encryptionKey, @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @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({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono appendBlockFromUrl(@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, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-blob-condition-maxsize") Long maxSize, @HeaderParam("x-ms-blob-condition-appendpos") Long appendPosition, @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 appendBlockFromUrl(@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, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String transactionalContentMD5, @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-blob-condition-maxsize") Long maxSize, @HeaderParam("x-ms-blob-condition-appendpos") Long appendPosition, @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); } /** @@ -99,9 +100,6 @@ private interface AppendBlobsService { public Mono createWithRestResponseAsync(String containerName, String blob, long contentLength, Context context) { final Integer timeout = null; final Map metadata = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; final String requestId = null; final String blobType = "AppendBlob"; final String blobContentType = null; @@ -110,12 +108,15 @@ public Mono createWithRestResponseAsync(String contai final String blobCacheControl = null; final String blobContentDisposition = null; final String leaseId = null; + final String encryptionKey = null; + final String encryptionKeySha256 = null; + final EncryptionAlgorithmType encryptionAlgorithm = null; final String ifMatch = null; final String ifNoneMatch = null; String blobContentMD5Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.create(containerName, blob, this.client.getUrl(), timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.create(containerName, blob, this.client.getUrl(), timeout, contentLength, metadata, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -126,68 +127,78 @@ public Mono createWithRestResponseAsync(String contai * @param contentLength The length of the request. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param blobHTTPHeaders Additional parameters for the operation. * @param leaseAccessConditions Additional parameters for the operation. + * @param cpkInfo Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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 encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, 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) { - blobContentType = blobHTTPHeaders.blobContentType(); + blobContentType = blobHTTPHeaders.getBlobContentType(); } String blobContentEncoding = null; if (blobHTTPHeaders != null) { - blobContentEncoding = blobHTTPHeaders.blobContentEncoding(); + blobContentEncoding = blobHTTPHeaders.getBlobContentEncoding(); } String blobContentLanguage = null; if (blobHTTPHeaders != null) { - blobContentLanguage = blobHTTPHeaders.blobContentLanguage(); + blobContentLanguage = blobHTTPHeaders.getBlobContentLanguage(); } byte[] blobContentMD5 = null; if (blobHTTPHeaders != null) { - blobContentMD5 = blobHTTPHeaders.blobContentMD5(); + blobContentMD5 = blobHTTPHeaders.getBlobContentMD5(); } String blobCacheControl = null; if (blobHTTPHeaders != null) { - blobCacheControl = blobHTTPHeaders.blobCacheControl(); + blobCacheControl = blobHTTPHeaders.getBlobCacheControl(); } String blobContentDisposition = null; if (blobHTTPHeaders != null) { - blobContentDisposition = blobHTTPHeaders.blobContentDisposition(); + blobContentDisposition = blobHTTPHeaders.getBlobContentDisposition(); } String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); + } + String encryptionKey = null; + if (cpkInfo != null) { + encryptionKey = cpkInfo.getEncryptionKey(); + } + String encryptionKeySha256 = null; + if (cpkInfo != null) { + encryptionKeySha256 = cpkInfo.getEncryptionKeySha256(); + } + EncryptionAlgorithmType encryptionAlgorithm = null; + if (cpkInfo != null) { + encryptionAlgorithm = cpkInfo.getEncryptionAlgorithm(); } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } String blobContentMD5Converted = Base64Util.encodeToString(blobContentMD5); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.create(containerName, blob, this.client.getUrl(), timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.create(containerName, blob, this.client.getUrl(), timeout, contentLength, metadata, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -202,22 +213,23 @@ public Mono createWithRestResponseAsync(String contai * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono appendBlockWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Context context) { + public Mono appendBlockWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Context context) { final Integer timeout = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; final String requestId = null; final String comp = "appendblock"; final String leaseId = null; final Long maxSize = null; final Long appendPosition = null; + final String encryptionKey = null; + final String encryptionKeySha256 = null; + final EncryptionAlgorithmType encryptionAlgorithm = null; final String ifMatch = null; final String ifNoneMatch = null; String transactionalContentMD5Converted = null; + String transactionalContentCrc64Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.appendBlock(containerName, blob, this.client.getUrl(), body, timeout, contentLength, transactionalContentMD5Converted, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.appendBlock(containerName, blob, this.client.getUrl(), body, timeout, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, this.client.getVersion(), requestId, comp, leaseId, maxSize, appendPosition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -229,52 +241,64 @@ public Mono appendBlockWithRestResponseAsync(Str * @param contentLength The length of the request. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param leaseAccessConditions Additional parameters for the operation. * @param appendPositionAccessConditions Additional parameters for the operation. + * @param cpkInfo Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono appendBlockWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Integer timeout, byte[] transactionalContentMD5, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, AppendPositionAccessConditions appendPositionAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono appendBlockWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Integer timeout, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, String requestId, LeaseAccessConditions leaseAccessConditions, AppendPositionAccessConditions appendPositionAccessConditions, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "appendblock"; String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); } Long maxSize = null; if (appendPositionAccessConditions != null) { - maxSize = appendPositionAccessConditions.maxSize(); + maxSize = appendPositionAccessConditions.getMaxSize(); } Long appendPosition = null; if (appendPositionAccessConditions != null) { - appendPosition = appendPositionAccessConditions.appendPosition(); + appendPosition = appendPositionAccessConditions.getAppendPosition(); + } + String encryptionKey = null; + if (cpkInfo != null) { + encryptionKey = cpkInfo.getEncryptionKey(); + } + String encryptionKeySha256 = null; + if (cpkInfo != null) { + encryptionKeySha256 = cpkInfo.getEncryptionKeySha256(); + } + EncryptionAlgorithmType encryptionAlgorithm = null; + if (cpkInfo != null) { + encryptionAlgorithm = cpkInfo.getEncryptionAlgorithm(); } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.appendBlock(containerName, blob, this.client.getUrl(), body, timeout, contentLength, transactionalContentMD5Converted, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.appendBlock(containerName, blob, this.client.getUrl(), body, timeout, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, this.client.getVersion(), requestId, comp, leaseId, maxSize, appendPosition, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -294,6 +318,9 @@ public Mono appendBlockFromUrlWithRestRes final Integer timeout = null; final String requestId = null; final String comp = "appendblock"; + final String encryptionKey = null; + final String encryptionKeySha256 = null; + final EncryptionAlgorithmType encryptionAlgorithm = null; final String leaseId = null; final Long maxSize = null; final Long appendPosition = null; @@ -302,11 +329,13 @@ public Mono appendBlockFromUrlWithRestRes final String sourceIfMatch = null; final String sourceIfNoneMatch = null; String sourceContentMD5Converted = null; + String sourceContentcrc64Converted = null; + String transactionalContentMD5Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; DateTimeRfc1123 sourceIfModifiedSinceConverted = null; DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null; - return service.appendBlockFromUrl(containerName, blob, this.client.getUrl(), sourceUrl, sourceRange, sourceContentMD5Converted, timeout, contentLength, this.client.getVersion(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); + return service.appendBlockFromUrl(containerName, blob, this.client.getUrl(), sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, timeout, contentLength, transactionalContentMD5Converted, this.client.getVersion(), requestId, comp, encryptionKey, encryptionKeySha256, encryptionAlgorithm, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); } /** @@ -318,8 +347,11 @@ public Mono appendBlockFromUrlWithRestRes * @param contentLength The length of the request. * @param sourceRange Bytes of source data in the specified range. * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy source. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param cpkInfo Additional parameters for the operation. * @param leaseAccessConditions Additional parameters for the operation. * @param appendPositionAccessConditions Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. @@ -329,57 +361,71 @@ public Mono appendBlockFromUrlWithRestRes * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono appendBlockFromUrlWithRestResponseAsync(String containerName, String blob, URL sourceUrl, long contentLength, String sourceRange, byte[] sourceContentMD5, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, AppendPositionAccessConditions appendPositionAccessConditions, ModifiedAccessConditions modifiedAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { + public Mono appendBlockFromUrlWithRestResponseAsync(String containerName, String blob, URL sourceUrl, long contentLength, String sourceRange, byte[] sourceContentMD5, byte[] sourceContentcrc64, Integer timeout, byte[] transactionalContentMD5, String requestId, CpkInfo cpkInfo, LeaseAccessConditions leaseAccessConditions, AppendPositionAccessConditions appendPositionAccessConditions, ModifiedAccessConditions modifiedAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { final String comp = "appendblock"; + String encryptionKey = null; + if (cpkInfo != null) { + encryptionKey = cpkInfo.getEncryptionKey(); + } + String encryptionKeySha256 = null; + if (cpkInfo != null) { + encryptionKeySha256 = cpkInfo.getEncryptionKeySha256(); + } + EncryptionAlgorithmType encryptionAlgorithm = null; + if (cpkInfo != null) { + encryptionAlgorithm = cpkInfo.getEncryptionAlgorithm(); + } String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); } Long maxSize = null; if (appendPositionAccessConditions != null) { - maxSize = appendPositionAccessConditions.maxSize(); + maxSize = appendPositionAccessConditions.getMaxSize(); } Long appendPosition = null; if (appendPositionAccessConditions != null) { - appendPosition = appendPositionAccessConditions.appendPosition(); + appendPosition = appendPositionAccessConditions.getAppendPosition(); } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } OffsetDateTime sourceIfModifiedSince = null; if (sourceModifiedAccessConditions != null) { - sourceIfModifiedSince = sourceModifiedAccessConditions.sourceIfModifiedSince(); + sourceIfModifiedSince = sourceModifiedAccessConditions.getSourceIfModifiedSince(); } OffsetDateTime sourceIfUnmodifiedSince = null; if (sourceModifiedAccessConditions != null) { - sourceIfUnmodifiedSince = sourceModifiedAccessConditions.sourceIfUnmodifiedSince(); + sourceIfUnmodifiedSince = sourceModifiedAccessConditions.getSourceIfUnmodifiedSince(); } String sourceIfMatch = null; if (sourceModifiedAccessConditions != null) { - sourceIfMatch = sourceModifiedAccessConditions.sourceIfMatch(); + sourceIfMatch = sourceModifiedAccessConditions.getSourceIfMatch(); } String sourceIfNoneMatch = null; if (sourceModifiedAccessConditions != null) { - sourceIfNoneMatch = sourceModifiedAccessConditions.sourceIfNoneMatch(); + sourceIfNoneMatch = sourceModifiedAccessConditions.getSourceIfNoneMatch(); } String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); + String sourceContentcrc64Converted = Base64Util.encodeToString(sourceContentcrc64); + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); DateTimeRfc1123 sourceIfModifiedSinceConverted = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - return service.appendBlockFromUrl(containerName, blob, this.client.getUrl(), sourceUrl, sourceRange, sourceContentMD5Converted, timeout, contentLength, this.client.getVersion(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); + return service.appendBlockFromUrl(containerName, blob, this.client.getUrl(), sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, timeout, contentLength, transactionalContentMD5Converted, this.client.getVersion(), requestId, comp, encryptionKey, encryptionKeySha256, encryptionAlgorithm, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageBuilder.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageBuilder.java index fa28f6e26d0e..43cefc32c81b 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageBuilder.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageBuilder.java @@ -7,6 +7,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.implementation.RestProxy; import com.azure.core.implementation.annotation.ServiceClientBuilder; +import com.azure.storage.blob.models.PathRenameMode; /** * A builder for creating a new instance of the AzureBlobStorage type. @@ -45,6 +46,22 @@ public AzureBlobStorageBuilder version(String version) { return this; } + /* + * Determines the behavior of the rename operation. Possible values include: 'legacy', 'posix' + */ + private PathRenameMode pathRenameMode; + + /** + * Sets Determines the behavior of the rename operation. Possible values include: 'legacy', 'posix'. + * + * @param pathRenameMode the pathRenameMode value. + * @return the AzureBlobStorageBuilder. + */ + public AzureBlobStorageBuilder pathRenameMode(PathRenameMode pathRenameMode) { + this.pathRenameMode = pathRenameMode; + return this; + } + /* * The HTTP pipeline to send requests through */ @@ -77,7 +94,10 @@ public AzureBlobStorageImpl build() { if (this.version != null) { client.setVersion(this.version); } else { - client.setVersion("2018-11-09"); + client.setVersion("2019-02-02"); + } + if (this.pathRenameMode != null) { + client.setPathRenameMode(this.pathRenameMode); } return client; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImpl.java index 5fc9bc8ae273..4b0bfb23057f 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImpl.java @@ -6,6 +6,7 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.implementation.RestProxy; +import com.azure.storage.blob.models.PathRenameMode; /** * Initializes a new instance of the AzureBlobStorage type. @@ -30,8 +31,9 @@ public String getUrl() { * * @param url the url value. */ - void setUrl(String url) { + AzureBlobStorageImpl setUrl(String url) { this.url = url; + return this; } /** @@ -53,8 +55,33 @@ public String getVersion() { * * @param version the version value. */ - void setVersion(String version) { + AzureBlobStorageImpl setVersion(String version) { this.version = version; + return this; + } + + /** + * Determines the behavior of the rename operation. Possible values include: 'legacy', 'posix'. + */ + private PathRenameMode pathRenameMode; + + /** + * Gets Determines the behavior of the rename operation. Possible values include: 'legacy', 'posix'. + * + * @return the pathRenameMode value. + */ + public PathRenameMode getPathRenameMode() { + return this.pathRenameMode; + } + + /** + * Sets Determines the behavior of the rename operation. Possible values include: 'legacy', 'posix'. + * + * @param pathRenameMode the pathRenameMode value. + */ + AzureBlobStorageImpl setPathRenameMode(PathRenameMode pathRenameMode) { + this.pathRenameMode = pathRenameMode; + return this; } /** @@ -99,6 +126,20 @@ public ContainersImpl containers() { return this.containers; } + /** + * The DirectorysImpl object to access its operations. + */ + private DirectorysImpl directorys; + + /** + * Gets the DirectorysImpl object to access its operations. + * + * @return the DirectorysImpl object. + */ + public DirectorysImpl directorys() { + return this.directorys; + } + /** * The BlobsImpl object to access its operations. */ @@ -171,6 +212,7 @@ public AzureBlobStorageImpl(HttpPipeline httpPipeline) { this.httpPipeline = httpPipeline; this.services = new ServicesImpl(this); this.containers = new ContainersImpl(this); + this.directorys = new DirectorysImpl(this); this.blobs = new BlobsImpl(this); this.pageBlobs = new PageBlobsImpl(this); this.appendBlobs = new AppendBlobsImpl(this); 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 eba1efa297e4..b5e5c7b8bd7d 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 @@ -13,6 +13,7 @@ import com.azure.core.implementation.annotation.HeaderParam; import com.azure.core.implementation.annotation.Host; import com.azure.core.implementation.annotation.HostParam; +import com.azure.core.implementation.annotation.Patch; import com.azure.core.implementation.annotation.PathParam; import com.azure.core.implementation.annotation.Put; import com.azure.core.implementation.annotation.QueryParam; @@ -22,7 +23,8 @@ import com.azure.core.implementation.annotation.UnexpectedResponseExceptionType; import com.azure.core.implementation.util.Base64Util; import com.azure.core.util.Context; -import com.azure.storage.blob.models.AccessTier; +import com.azure.storage.blob.models.AccessTierOptional; +import com.azure.storage.blob.models.AccessTierRequired; import com.azure.storage.blob.models.BlobHTTPHeaders; import com.azure.storage.blob.models.BlobsAbortCopyFromURLResponse; import com.azure.storage.blob.models.BlobsAcquireLeaseResponse; @@ -32,19 +34,27 @@ import com.azure.storage.blob.models.BlobsCreateSnapshotResponse; import com.azure.storage.blob.models.BlobsDeleteResponse; import com.azure.storage.blob.models.BlobsDownloadResponse; +import com.azure.storage.blob.models.BlobsGetAccessControlResponse; import com.azure.storage.blob.models.BlobsGetAccountInfoResponse; import com.azure.storage.blob.models.BlobsGetPropertiesResponse; import com.azure.storage.blob.models.BlobsReleaseLeaseResponse; +import com.azure.storage.blob.models.BlobsRenameResponse; import com.azure.storage.blob.models.BlobsRenewLeaseResponse; +import com.azure.storage.blob.models.BlobsSetAccessControlResponse; import com.azure.storage.blob.models.BlobsSetHTTPHeadersResponse; import com.azure.storage.blob.models.BlobsSetMetadataResponse; import com.azure.storage.blob.models.BlobsSetTierResponse; import com.azure.storage.blob.models.BlobsStartCopyFromURLResponse; import com.azure.storage.blob.models.BlobsUndeleteResponse; +import com.azure.storage.blob.models.CpkInfo; +import com.azure.storage.blob.models.DataLakeStorageErrorException; import com.azure.storage.blob.models.DeleteSnapshotsOptionType; +import com.azure.storage.blob.models.DirectoryHttpHeaders; import com.azure.storage.blob.models.EncryptionAlgorithmType; import com.azure.storage.blob.models.LeaseAccessConditions; import com.azure.storage.blob.models.ModifiedAccessConditions; +import com.azure.storage.blob.models.PathRenameMode; +import com.azure.storage.blob.models.RehydratePriority; import com.azure.storage.blob.models.SourceModifiedAccessConditions; import com.azure.storage.blob.models.StorageErrorException; import java.net.URL; @@ -87,17 +97,32 @@ private interface BlobsService { @Get("{containerName}/{blob}") @ExpectedResponses({200, 206}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono download(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-range-get-content-md5") Boolean rangeGetContentMD5, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @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 download(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-range-get-content-md5") Boolean rangeGetContentMD5, @HeaderParam("x-ms-range-get-content-crc64") Boolean rangeGetContentCRC64, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-encryption-key") String encryptionKey, @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @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); @Head("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono getProperties(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, @QueryParam("timeout") Integer timeout, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @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 getProperties(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-encryption-key") String encryptionKey, @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @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); @Delete("{containerName}/{blob}") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono delete(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-delete-snapshots") DeleteSnapshotsOptionType deleteSnapshots, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @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 delete(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-delete-snapshots") DeleteSnapshotsOptionType deleteSnapshots, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @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); + + @Patch("{filesystem}/{path}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(DataLakeStorageErrorException.class) + Mono setAccessControl(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-owner") String owner, @HeaderParam("x-ms-group") String group, @HeaderParam("x-ms-permissions") String posixPermissions, @HeaderParam("x-ms-acl") String posixAcl, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-version") String version, @QueryParam("action") String action, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); + + @Head("{filesystem}/{path}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(DataLakeStorageErrorException.class) + Mono getAccessControl(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @QueryParam("upn") Boolean upn, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-version") String version, @QueryParam("action") String action, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); + + @Put("{filesystem}/{path}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(DataLakeStorageErrorException.class) + Mono rename(@PathParam("filesystem") String filesystem, @PathParam("path") String path, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @QueryParam("mode") PathRenameMode pathRenameMode, @HeaderParam("x-ms-rename-source") String renameSource, @HeaderParam("x-ms-properties") String directoryProperties, @HeaderParam("x-ms-permissions") String posixPermissions, @HeaderParam("x-ms-umask") String posixUmask, @HeaderParam("x-ms-source-lease-id") String sourceLeaseId, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-cache-control") String cacheControl, @HeaderParam("x-ms-content-type") String contentType, @HeaderParam("x-ms-content-encoding") String contentEncoding, @HeaderParam("x-ms-content-language") String contentLanguage, @HeaderParam("x-ms-content-disposition") String contentDisposition, @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, @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({200}) @@ -112,7 +137,7 @@ private interface BlobsService { @Put("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setMetadata(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @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 setMetadata(@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-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-encryption-key") String encryptionKey, @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @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({201}) @@ -142,17 +167,17 @@ private interface BlobsService { @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono createSnapshot(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @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 createSnapshot(@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-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("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 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-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") AccessTierOptional 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-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") AccessTierOptional 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}) @@ -162,7 +187,7 @@ private interface BlobsService { @Put("{containerName}/{blob}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setTier(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-access-tier") AccessTier tier, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, Context context); + Mono setTier(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-access-tier") AccessTierRequired tier, @HeaderParam("x-ms-rehydrate-priority") RehydratePriority rehydratePriority, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, Context context); @Get("{containerName}/{blob}") @ExpectedResponses({200}) @@ -171,7 +196,7 @@ private interface BlobsService { } /** - * The Download operation reads or downloads a blob from the system, including its metadata and properties. You can also call Download to read a snapshot or verison. + * The Download operation reads or downloads a blob from the system, including its metadata and properties. You can also call Download to read a snapshot or version. * * @param containerName The container name. * @param blob The blob name. @@ -182,67 +207,77 @@ private interface BlobsService { @ServiceMethod(returns = ReturnType.SINGLE) public Mono downloadWithRestResponseAsync(String containerName, String blob, Context context) { final String snapshot = null; - final String versionId = null; final Integer timeout = null; final String range = null; final Boolean rangeGetContentMD5 = null; + final Boolean rangeGetContentCRC64 = null; + final String requestId = null; + final String leaseId = null; final String encryptionKey = null; final String encryptionKeySha256 = null; final EncryptionAlgorithmType encryptionAlgorithm = null; - final String requestId = null; - final String leaseId = null; final String ifMatch = null; final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.download(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, range, rangeGetContentMD5, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.download(containerName, blob, this.client.getUrl(), snapshot, timeout, range, rangeGetContentMD5, rangeGetContentCRC64, this.client.getVersion(), requestId, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** - * The Download operation reads or downloads a blob from the system, including its metadata and properties. You can also call Download to read a snapshot or verison. + * The Download operation reads or downloads a blob from the system, including its metadata and properties. You can also call Download to read a snapshot or version. * * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot of a Blob.</a>. - * @param versionId The version ID parameter is an opaque DateTime value that, when present, specifies the blob version to retrieve. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param range Return only the bytes of the blob in the specified range. * @param rangeGetContentMD5 When set to true and specified together with the Range, the service returns the MD5 hash for the range, as long as the range is less than or equal to 4 MB in size. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. + * @param rangeGetContentCRC64 When set to true and specified together with the Range, the service returns the CRC64 hash for the range, as long as the range is less than or equal to 4 MB in size. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param leaseAccessConditions Additional parameters for the operation. + * @param cpkInfo Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono downloadWithRestResponseAsync(String containerName, String blob, String snapshot, String versionId, Integer timeout, String range, Boolean rangeGetContentMD5, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono downloadWithRestResponseAsync(String containerName, String blob, String snapshot, Integer timeout, String range, Boolean rangeGetContentMD5, Boolean rangeGetContentCRC64, String requestId, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) { String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); + } + String encryptionKey = null; + if (cpkInfo != null) { + encryptionKey = cpkInfo.getEncryptionKey(); + } + String encryptionKeySha256 = null; + if (cpkInfo != null) { + encryptionKeySha256 = cpkInfo.getEncryptionKeySha256(); + } + EncryptionAlgorithmType encryptionAlgorithm = null; + if (cpkInfo != null) { + encryptionAlgorithm = cpkInfo.getEncryptionAlgorithm(); } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.download(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, range, rangeGetContentMD5, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.download(containerName, blob, this.client.getUrl(), snapshot, timeout, range, rangeGetContentMD5, rangeGetContentCRC64, this.client.getVersion(), requestId, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -257,18 +292,17 @@ public Mono downloadWithRestResponseAsync(String containe @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPropertiesWithRestResponseAsync(String containerName, String blob, Context context) { final String snapshot = null; - final String versionId = null; final Integer timeout = null; + final String requestId = null; + final String leaseId = null; final String encryptionKey = null; final String encryptionKeySha256 = null; final EncryptionAlgorithmType encryptionAlgorithm = null; - final String requestId = null; - final String leaseId = null; final String ifMatch = null; final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.getProperties(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.getProperties(containerName, blob, this.client.getUrl(), snapshot, timeout, this.client.getVersion(), requestId, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -277,43 +311,52 @@ public Mono getPropertiesWithRestResponseAsync(Strin * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot of a Blob.</a>. - * @param versionId The version ID parameter is an opaque DateTime value that, when present, specifies the blob version to retrieve. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param leaseAccessConditions Additional parameters for the operation. + * @param cpkInfo Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getPropertiesWithRestResponseAsync(String containerName, String blob, String snapshot, String versionId, Integer timeout, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono getPropertiesWithRestResponseAsync(String containerName, String blob, String snapshot, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) { String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); + } + String encryptionKey = null; + if (cpkInfo != null) { + encryptionKey = cpkInfo.getEncryptionKey(); + } + String encryptionKeySha256 = null; + if (cpkInfo != null) { + encryptionKeySha256 = cpkInfo.getEncryptionKeySha256(); + } + EncryptionAlgorithmType encryptionAlgorithm = null; + if (cpkInfo != null) { + encryptionAlgorithm = cpkInfo.getEncryptionAlgorithm(); } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.getProperties(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.getProperties(containerName, blob, this.client.getUrl(), snapshot, timeout, this.client.getVersion(), requestId, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -328,7 +371,6 @@ public Mono getPropertiesWithRestResponseAsync(Strin @ServiceMethod(returns = ReturnType.SINGLE) public Mono deleteWithRestResponseAsync(String containerName, String blob, Context context) { final String snapshot = null; - final String versionId = null; final Integer timeout = null; final DeleteSnapshotsOptionType deleteSnapshots = null; final String requestId = null; @@ -337,7 +379,7 @@ public Mono deleteWithRestResponseAsync(String containerNam final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.delete(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, deleteSnapshots, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.delete(containerName, blob, this.client.getUrl(), snapshot, timeout, deleteSnapshots, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -346,7 +388,6 @@ public Mono deleteWithRestResponseAsync(String containerNam * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot of a Blob.</a>. - * @param versionId The version ID parameter is an opaque DateTime value that, when present, specifies the blob version to retrieve. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param deleteSnapshots Required if the blob has associated snapshots. Specify one of the following two options: include: Delete the base blob and all of its snapshots. only: Delete only the blob's snapshots and not the blob itself. Possible values include: 'include', 'only'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. @@ -357,30 +398,278 @@ public Mono deleteWithRestResponseAsync(String containerNam * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteWithRestResponseAsync(String containerName, String blob, String snapshot, String versionId, Integer timeout, DeleteSnapshotsOptionType deleteSnapshots, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono deleteWithRestResponseAsync(String containerName, String blob, String snapshot, Integer timeout, DeleteSnapshotsOptionType deleteSnapshots, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + String leaseId = null; + if (leaseAccessConditions != null) { + leaseId = leaseAccessConditions.getLeaseId(); + } + OffsetDateTime ifModifiedSince = null; + if (modifiedAccessConditions != null) { + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = null; + if (modifiedAccessConditions != null) { + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); + } + String ifMatch = null; + if (modifiedAccessConditions != null) { + ifMatch = modifiedAccessConditions.getIfMatch(); + } + String ifNoneMatch = null; + if (modifiedAccessConditions != null) { + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); + } + DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.delete(containerName, blob, this.client.getUrl(), snapshot, timeout, deleteSnapshots, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + } + + /** + * Set the owner, group, permissions, or access control list for a blob. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setAccessControlWithRestResponseAsync(Context context) { + final Integer timeout = null; + final String owner = null; + final String group = null; + final String posixPermissions = null; + final String posixAcl = null; + final String requestId = null; + final String action = "setAccessControl"; + final String leaseId = null; + final String ifMatch = null; + final String ifNoneMatch = null; + DateTimeRfc1123 ifModifiedSinceConverted = null; + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + return service.setAccessControl(this.client.getUrl(), timeout, owner, group, posixPermissions, posixAcl, requestId, this.client.getVersion(), action, leaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + } + + /** + * Set the owner, group, permissions, or access control list for a blob. + * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. + * @param owner Optional. The owner of the blob or directory. + * @param group Optional. The owning group of the blob or directory. + * @param posixPermissions Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file owner, the file owning group, and others. Each class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. 0766) are supported. + * @param posixAcl Sets POSIX access control rights on files and directories. The value is a comma-separated list of access control entries. Each access control entry (ACE) consists of a scope, a type, a user or group identifier, and permissions in the format "[scope:][type]:[id]:[permissions]". + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param leaseAccessConditions Additional parameters for the operation. + * @param modifiedAccessConditions Additional parameters for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setAccessControlWithRestResponseAsync(Integer timeout, String owner, String group, String posixPermissions, String posixAcl, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + final String action = "setAccessControl"; + String leaseId = null; + if (leaseAccessConditions != null) { + leaseId = leaseAccessConditions.getLeaseId(); + } + String ifMatch = null; + if (modifiedAccessConditions != null) { + ifMatch = modifiedAccessConditions.getIfMatch(); + } + String ifNoneMatch = null; + if (modifiedAccessConditions != null) { + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); + } + OffsetDateTime ifModifiedSince = null; + if (modifiedAccessConditions != null) { + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = null; + if (modifiedAccessConditions != null) { + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); + } + DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.setAccessControl(this.client.getUrl(), timeout, owner, group, posixPermissions, posixAcl, requestId, this.client.getVersion(), action, leaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + } + + /** + * Get the owner, group, permissions, or access control list for a blob. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAccessControlWithRestResponseAsync(Context context) { + final Integer timeout = null; + final Boolean upn = null; + final String requestId = null; + final String action = "getAccessControl"; + final String leaseId = null; + final String ifMatch = null; + final String ifNoneMatch = null; + DateTimeRfc1123 ifModifiedSinceConverted = null; + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + return service.getAccessControl(this.client.getUrl(), timeout, upn, requestId, this.client.getVersion(), action, leaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + } + + /** + * Get the owner, group, permissions, or access control list for a blob. + * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. + * @param upn Optional. Valid only when Hierarchical Namespace is enabled for the account. If "true", the identity values returned in the x-ms-owner, x-ms-group, and x-ms-acl response headers will be transformed from Azure Active Directory Object IDs to User Principal Names. If "false", the values will be returned as Azure Active Directory Object IDs. The default value is false. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param leaseAccessConditions Additional parameters for the operation. + * @param modifiedAccessConditions Additional parameters for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAccessControlWithRestResponseAsync(Integer timeout, Boolean upn, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + final String action = "getAccessControl"; String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); + } + String ifMatch = null; + if (modifiedAccessConditions != null) { + ifMatch = modifiedAccessConditions.getIfMatch(); + } + String ifNoneMatch = null; + if (modifiedAccessConditions != null) { + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); + } + DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.getAccessControl(this.client.getUrl(), timeout, upn, requestId, this.client.getVersion(), action, leaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + } + + /** + * Rename a blob/file. By default, the destination is overwritten and if the destination already exists and has a lease the lease is broken. This operation supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). To fail if the destination already exists, use a conditional request with If-None-Match: "*". + * + * @param filesystem The filesystem name. + * @param path The namespace path to a file or directory. + * @param renameSource The file or directory to be renamed. The value must have the following format: "/{filesysystem}/{path}". If "x-ms-properties" is specified, the properties will overwrite the existing properties; otherwise, the existing properties will be preserved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono renameWithRestResponseAsync(String filesystem, String path, String renameSource, Context context) { + final Integer timeout = null; + final String directoryProperties = null; + final String posixPermissions = null; + final String posixUmask = null; + final String sourceLeaseId = null; + final String requestId = null; + final String cacheControl = null; + final String contentType = null; + final String contentEncoding = null; + final String contentLanguage = null; + final String contentDisposition = null; + final String leaseId = null; + final String ifMatch = null; + final String ifNoneMatch = null; + final String sourceIfMatch = null; + final String sourceIfNoneMatch = null; + DateTimeRfc1123 ifModifiedSinceConverted = null; + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + DateTimeRfc1123 sourceIfModifiedSinceConverted = null; + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null; + return service.rename(filesystem, path, this.client.getUrl(), timeout, this.client.getPathRenameMode(), renameSource, directoryProperties, posixPermissions, posixUmask, sourceLeaseId, this.client.getVersion(), requestId, cacheControl, contentType, contentEncoding, contentLanguage, contentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); + } + + /** + * Rename a blob/file. By default, the destination is overwritten and if the destination already exists and has a lease the lease is broken. This operation supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). To fail if the destination already exists, use a conditional request with If-None-Match: "*". + * + * @param filesystem The filesystem name. + * @param path The namespace path to a file or directory. + * @param renameSource The file or directory to be renamed. The value must have the following format: "/{filesysystem}/{path}". If "x-ms-properties" is specified, the properties will overwrite the existing properties; otherwise, the existing properties will be preserved. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. + * @param directoryProperties Optional. User-defined properties to be stored with the file or directory, in the format of a comma-separated list of name and value pairs "n1=v1, n2=v2, ...", where each value is base64 encoded. + * @param posixPermissions Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file owner, the file owning group, and others. Each class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. 0766) are supported. + * @param posixUmask Only valid if Hierarchical Namespace is enabled for the account. This umask restricts permission settings for file and directory, and will only be applied when default Acl does not exist in parent directory. If the umask bit has set, it means that the corresponding permission will be disabled. Otherwise the corresponding permission will be determined by the permission. A 4-digit octal notation (e.g. 0022) is supported here. If no umask was specified, a default umask - 0027 will be used. + * @param sourceLeaseId A lease ID for the source path. If specified, the source path must have an active lease and the leaase ID must match. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param directoryHttpHeaders Additional parameters for the operation. + * @param leaseAccessConditions Additional parameters for the operation. + * @param modifiedAccessConditions Additional parameters for the operation. + * @param sourceModifiedAccessConditions Additional parameters for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono renameWithRestResponseAsync(String filesystem, String path, String renameSource, Integer timeout, String directoryProperties, String posixPermissions, String posixUmask, String sourceLeaseId, String requestId, DirectoryHttpHeaders directoryHttpHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { + String cacheControl = null; + if (directoryHttpHeaders != null) { + cacheControl = directoryHttpHeaders.getCacheControl(); + } + String contentType = null; + if (directoryHttpHeaders != null) { + contentType = directoryHttpHeaders.getContentType(); + } + String contentEncoding = null; + if (directoryHttpHeaders != null) { + contentEncoding = directoryHttpHeaders.getContentEncoding(); + } + String contentLanguage = null; + if (directoryHttpHeaders != null) { + contentLanguage = directoryHttpHeaders.getContentLanguage(); + } + String contentDisposition = null; + if (directoryHttpHeaders != null) { + contentDisposition = directoryHttpHeaders.getContentDisposition(); + } + String leaseId = null; + if (leaseAccessConditions != null) { + leaseId = leaseAccessConditions.getLeaseId(); + } + OffsetDateTime ifModifiedSince = null; + if (modifiedAccessConditions != null) { + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = null; + if (modifiedAccessConditions != null) { + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); + } + OffsetDateTime sourceIfModifiedSince = null; + if (sourceModifiedAccessConditions != null) { + sourceIfModifiedSince = sourceModifiedAccessConditions.getSourceIfModifiedSince(); + } + OffsetDateTime sourceIfUnmodifiedSince = null; + if (sourceModifiedAccessConditions != null) { + sourceIfUnmodifiedSince = sourceModifiedAccessConditions.getSourceIfUnmodifiedSince(); + } + String sourceIfMatch = null; + if (sourceModifiedAccessConditions != null) { + sourceIfMatch = sourceModifiedAccessConditions.getSourceIfMatch(); + } + String sourceIfNoneMatch = null; + if (sourceModifiedAccessConditions != null) { + sourceIfNoneMatch = sourceModifiedAccessConditions.getSourceIfNoneMatch(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.delete(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, deleteSnapshots, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + DateTimeRfc1123 sourceIfModifiedSinceConverted = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); + return service.rename(filesystem, path, this.client.getUrl(), timeout, this.client.getPathRenameMode(), renameSource, directoryProperties, posixPermissions, posixUmask, sourceLeaseId, this.client.getVersion(), requestId, cacheControl, contentType, contentEncoding, contentLanguage, contentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); } /** @@ -464,47 +753,47 @@ public Mono setHTTPHeadersWithRestResponseAsync(Str final String comp = "properties"; String blobCacheControl = null; if (blobHTTPHeaders != null) { - blobCacheControl = blobHTTPHeaders.blobCacheControl(); + blobCacheControl = blobHTTPHeaders.getBlobCacheControl(); } String blobContentType = null; if (blobHTTPHeaders != null) { - blobContentType = blobHTTPHeaders.blobContentType(); + blobContentType = blobHTTPHeaders.getBlobContentType(); } byte[] blobContentMD5 = null; if (blobHTTPHeaders != null) { - blobContentMD5 = blobHTTPHeaders.blobContentMD5(); + blobContentMD5 = blobHTTPHeaders.getBlobContentMD5(); } String blobContentEncoding = null; if (blobHTTPHeaders != null) { - blobContentEncoding = blobHTTPHeaders.blobContentEncoding(); + blobContentEncoding = blobHTTPHeaders.getBlobContentEncoding(); } String blobContentLanguage = null; if (blobHTTPHeaders != null) { - blobContentLanguage = blobHTTPHeaders.blobContentLanguage(); + blobContentLanguage = blobHTTPHeaders.getBlobContentLanguage(); } String blobContentDisposition = null; if (blobHTTPHeaders != null) { - blobContentDisposition = blobHTTPHeaders.blobContentDisposition(); + blobContentDisposition = blobHTTPHeaders.getBlobContentDisposition(); } String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } String blobContentMD5Converted = Base64Util.encodeToString(blobContentMD5); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); @@ -525,17 +814,17 @@ public Mono setHTTPHeadersWithRestResponseAsync(Str public Mono setMetadataWithRestResponseAsync(String containerName, String blob, Context context) { final Integer timeout = null; final Map metadata = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; final String requestId = null; final String comp = "metadata"; final String leaseId = null; + final String encryptionKey = null; + final String encryptionKeySha256 = null; + final EncryptionAlgorithmType encryptionAlgorithm = null; final String ifMatch = null; final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.setMetadata(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.setMetadata(containerName, blob, this.client.getUrl(), timeout, metadata, this.client.getVersion(), requestId, comp, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -545,42 +834,52 @@ public Mono setMetadataWithRestResponseAsync(String co * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param leaseAccessConditions Additional parameters for the operation. + * @param cpkInfo Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setMetadataWithRestResponseAsync(String containerName, String blob, Integer timeout, Map metadata, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono setMetadataWithRestResponseAsync(String containerName, String blob, Integer timeout, Map metadata, String requestId, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "metadata"; String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); + } + String encryptionKey = null; + if (cpkInfo != null) { + encryptionKey = cpkInfo.getEncryptionKey(); + } + String encryptionKeySha256 = null; + if (cpkInfo != null) { + encryptionKeySha256 = cpkInfo.getEncryptionKeySha256(); + } + EncryptionAlgorithmType encryptionAlgorithm = null; + if (cpkInfo != null) { + encryptionAlgorithm = cpkInfo.getEncryptionAlgorithm(); } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.setMetadata(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.setMetadata(containerName, blob, this.client.getUrl(), timeout, metadata, this.client.getVersion(), requestId, comp, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -627,19 +926,19 @@ public Mono acquireLeaseWithRestResponseAsync(String final String action = "acquire"; OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); @@ -688,19 +987,19 @@ public Mono releaseLeaseWithRestResponseAsync(String final String action = "release"; OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); @@ -749,19 +1048,19 @@ public Mono renewLeaseWithRestResponseAsync(String cont final String action = "renew"; OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); @@ -812,19 +1111,19 @@ public Mono changeLeaseWithRestResponseAsync(String co final String action = "change"; OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); @@ -873,19 +1172,19 @@ public Mono breakLeaseWithRestResponseAsync(String cont final String action = "break"; OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); @@ -905,17 +1204,17 @@ public Mono breakLeaseWithRestResponseAsync(String cont public Mono createSnapshotWithRestResponseAsync(String containerName, String blob, Context context) { final Integer timeout = null; final Map metadata = null; + final String requestId = null; + final String comp = "snapshot"; final String encryptionKey = null; final String encryptionKeySha256 = null; final EncryptionAlgorithmType encryptionAlgorithm = null; - final String requestId = null; - final String comp = "snapshot"; final String ifMatch = null; final String ifNoneMatch = null; final String leaseId = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.createSnapshot(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); + return service.createSnapshot(containerName, blob, this.client.getUrl(), timeout, metadata, this.client.getVersion(), requestId, comp, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); } /** @@ -925,10 +1224,8 @@ public Mono createSnapshotWithRestResponseAsync(Str * @param blob The blob name. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param cpkInfo Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. * @param leaseAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. @@ -936,31 +1233,43 @@ public Mono createSnapshotWithRestResponseAsync(Str * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createSnapshotWithRestResponseAsync(String containerName, String blob, Integer timeout, Map metadata, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, ModifiedAccessConditions modifiedAccessConditions, LeaseAccessConditions leaseAccessConditions, Context context) { + public Mono createSnapshotWithRestResponseAsync(String containerName, String blob, Integer timeout, Map metadata, String requestId, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, LeaseAccessConditions leaseAccessConditions, Context context) { final String comp = "snapshot"; + String encryptionKey = null; + if (cpkInfo != null) { + encryptionKey = cpkInfo.getEncryptionKey(); + } + String encryptionKeySha256 = null; + if (cpkInfo != null) { + encryptionKeySha256 = cpkInfo.getEncryptionKeySha256(); + } + EncryptionAlgorithmType encryptionAlgorithm = null; + if (cpkInfo != null) { + encryptionAlgorithm = cpkInfo.getEncryptionAlgorithm(); + } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.createSnapshot(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); + return service.createSnapshot(containerName, blob, this.client.getUrl(), timeout, metadata, this.client.getVersion(), requestId, comp, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); } /** @@ -977,6 +1286,8 @@ public Mono createSnapshotWithRestResponseAsync(Str public Mono startCopyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Context context) { final Integer timeout = null; final Map metadata = null; + final AccessTierOptional tier = null; + final RehydratePriority rehydratePriority = null; final String requestId = null; final String sourceIfMatch = null; final String sourceIfNoneMatch = null; @@ -987,7 +1298,7 @@ public Mono startCopyFromURLWithRestResponseAsync DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.startCopyFromURL(containerName, blob, this.client.getUrl(), timeout, metadata, copySource, this.client.getVersion(), requestId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); + return service.startCopyFromURL(containerName, blob, this.client.getUrl(), timeout, metadata, tier, rehydratePriority, copySource, this.client.getVersion(), requestId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); } /** @@ -998,6 +1309,8 @@ public Mono startCopyFromURLWithRestResponseAsync * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or must be authenticated via a shared access signature. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. + * @param tier Optional. Indicates the tier to be set on the blob. Possible values include: 'P4', 'P6', 'P10', 'P15', 'P20', 'P30', 'P40', 'P50', 'P60', 'P70', 'P80', 'Hot', 'Cool', 'Archive'. + * @param rehydratePriority Optional: Indicates the priority with which to rehydrate an archived blob. Possible values include: 'High', 'Standard'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param sourceModifiedAccessConditions Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. @@ -1007,48 +1320,48 @@ 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, String requestId, SourceModifiedAccessConditions sourceModifiedAccessConditions, ModifiedAccessConditions modifiedAccessConditions, LeaseAccessConditions leaseAccessConditions, Context context) { + public Mono startCopyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Integer timeout, Map metadata, AccessTierOptional tier, RehydratePriority rehydratePriority, String requestId, SourceModifiedAccessConditions sourceModifiedAccessConditions, ModifiedAccessConditions modifiedAccessConditions, LeaseAccessConditions leaseAccessConditions, Context context) { OffsetDateTime sourceIfModifiedSince = null; if (sourceModifiedAccessConditions != null) { - sourceIfModifiedSince = sourceModifiedAccessConditions.sourceIfModifiedSince(); + sourceIfModifiedSince = sourceModifiedAccessConditions.getSourceIfModifiedSince(); } OffsetDateTime sourceIfUnmodifiedSince = null; if (sourceModifiedAccessConditions != null) { - sourceIfUnmodifiedSince = sourceModifiedAccessConditions.sourceIfUnmodifiedSince(); + sourceIfUnmodifiedSince = sourceModifiedAccessConditions.getSourceIfUnmodifiedSince(); } String sourceIfMatch = null; if (sourceModifiedAccessConditions != null) { - sourceIfMatch = sourceModifiedAccessConditions.sourceIfMatch(); + sourceIfMatch = sourceModifiedAccessConditions.getSourceIfMatch(); } String sourceIfNoneMatch = null; if (sourceModifiedAccessConditions != null) { - sourceIfNoneMatch = sourceModifiedAccessConditions.sourceIfNoneMatch(); + sourceIfNoneMatch = sourceModifiedAccessConditions.getSourceIfNoneMatch(); } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); } DateTimeRfc1123 sourceIfModifiedSinceConverted = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.startCopyFromURL(containerName, blob, this.client.getUrl(), timeout, metadata, copySource, this.client.getVersion(), requestId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); + return service.startCopyFromURL(containerName, blob, this.client.getUrl(), timeout, metadata, tier, rehydratePriority, copySource, this.client.getVersion(), requestId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); } /** @@ -1065,6 +1378,7 @@ public Mono startCopyFromURLWithRestResponseAsync public Mono copyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Context context) { final Integer timeout = null; final Map metadata = null; + final AccessTierOptional tier = null; final String requestId = null; final String xMsRequiresSync = "true"; final String sourceIfMatch = null; @@ -1076,7 +1390,7 @@ public Mono copyFromURLWithRestResponseAsync(String co DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.copyFromURL(containerName, blob, this.client.getUrl(), timeout, metadata, copySource, this.client.getVersion(), requestId, xMsRequiresSync, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); + return service.copyFromURL(containerName, blob, this.client.getUrl(), timeout, metadata, tier, copySource, this.client.getVersion(), requestId, xMsRequiresSync, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); } /** @@ -1087,6 +1401,7 @@ public Mono copyFromURLWithRestResponseAsync(String co * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or must be authenticated via a shared access signature. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. + * @param tier Optional. Indicates the tier to be set on the blob. Possible values include: 'P4', 'P6', 'P10', 'P15', 'P20', 'P30', 'P40', 'P50', 'P60', 'P70', 'P80', 'Hot', 'Cool', 'Archive'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param sourceModifiedAccessConditions Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. @@ -1096,49 +1411,49 @@ 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, String requestId, SourceModifiedAccessConditions sourceModifiedAccessConditions, ModifiedAccessConditions modifiedAccessConditions, LeaseAccessConditions leaseAccessConditions, Context context) { + public Mono copyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Integer timeout, Map metadata, AccessTierOptional tier, String requestId, SourceModifiedAccessConditions sourceModifiedAccessConditions, ModifiedAccessConditions modifiedAccessConditions, LeaseAccessConditions leaseAccessConditions, Context context) { final String xMsRequiresSync = "true"; OffsetDateTime sourceIfModifiedSince = null; if (sourceModifiedAccessConditions != null) { - sourceIfModifiedSince = sourceModifiedAccessConditions.sourceIfModifiedSince(); + sourceIfModifiedSince = sourceModifiedAccessConditions.getSourceIfModifiedSince(); } OffsetDateTime sourceIfUnmodifiedSince = null; if (sourceModifiedAccessConditions != null) { - sourceIfUnmodifiedSince = sourceModifiedAccessConditions.sourceIfUnmodifiedSince(); + sourceIfUnmodifiedSince = sourceModifiedAccessConditions.getSourceIfUnmodifiedSince(); } String sourceIfMatch = null; if (sourceModifiedAccessConditions != null) { - sourceIfMatch = sourceModifiedAccessConditions.sourceIfMatch(); + sourceIfMatch = sourceModifiedAccessConditions.getSourceIfMatch(); } String sourceIfNoneMatch = null; if (sourceModifiedAccessConditions != null) { - sourceIfNoneMatch = sourceModifiedAccessConditions.sourceIfNoneMatch(); + sourceIfNoneMatch = sourceModifiedAccessConditions.getSourceIfNoneMatch(); } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); } DateTimeRfc1123 sourceIfModifiedSinceConverted = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.copyFromURL(containerName, blob, this.client.getUrl(), timeout, metadata, copySource, this.client.getVersion(), requestId, xMsRequiresSync, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); + return service.copyFromURL(containerName, blob, this.client.getUrl(), timeout, metadata, tier, copySource, this.client.getVersion(), requestId, xMsRequiresSync, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); } /** @@ -1180,7 +1495,7 @@ public Mono abortCopyFromURLWithRestResponseAsync final String copyActionAbortConstant = "abort"; String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); } return service.abortCopyFromURL(containerName, blob, this.client.getUrl(), copyId, timeout, this.client.getVersion(), requestId, comp, copyActionAbortConstant, leaseId, context); } @@ -1190,18 +1505,19 @@ public Mono abortCopyFromURLWithRestResponseAsync * * @param containerName The container name. * @param blob The blob name. - * @param tier Indicates the tier to be set on the blob. Possible values include: 'P4', 'P6', 'P10', 'P20', 'P30', 'P40', 'P50', 'Hot', 'Cool', 'Archive'. + * @param tier Indicates the tier to be set on the blob. Possible values include: 'P4', 'P6', 'P10', 'P15', 'P20', 'P30', 'P40', 'P50', 'P60', 'P70', 'P80', 'Hot', 'Cool', 'Archive'. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setTierWithRestResponseAsync(String containerName, String blob, AccessTier tier, Context context) { + public Mono setTierWithRestResponseAsync(String containerName, String blob, AccessTierRequired tier, Context context) { final Integer timeout = null; + final RehydratePriority rehydratePriority = null; final String requestId = null; final String comp = "tier"; final String leaseId = null; - return service.setTier(containerName, blob, this.client.getUrl(), timeout, tier, this.client.getVersion(), requestId, comp, leaseId, context); + return service.setTier(containerName, blob, this.client.getUrl(), timeout, tier, rehydratePriority, this.client.getVersion(), requestId, comp, leaseId, context); } /** @@ -1209,8 +1525,9 @@ public Mono setTierWithRestResponseAsync(String containerN * * @param containerName The container name. * @param blob The blob name. - * @param tier Indicates the tier to be set on the blob. Possible values include: 'P4', 'P6', 'P10', 'P20', 'P30', 'P40', 'P50', 'Hot', 'Cool', 'Archive'. + * @param tier Indicates the tier to be set on the blob. Possible values include: 'P4', 'P6', 'P10', 'P15', 'P20', 'P30', 'P40', 'P50', 'P60', 'P70', 'P80', 'Hot', 'Cool', 'Archive'. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. + * @param rehydratePriority Optional: Indicates the priority with which to rehydrate an archived blob. Possible values include: 'High', 'Standard'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param leaseAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. @@ -1218,13 +1535,13 @@ public Mono setTierWithRestResponseAsync(String containerN * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setTierWithRestResponseAsync(String containerName, String blob, AccessTier tier, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, Context context) { + public Mono setTierWithRestResponseAsync(String containerName, String blob, AccessTierRequired tier, Integer timeout, RehydratePriority rehydratePriority, String requestId, LeaseAccessConditions leaseAccessConditions, Context context) { final String comp = "tier"; String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); } - return service.setTier(containerName, blob, this.client.getUrl(), timeout, tier, this.client.getVersion(), requestId, comp, leaseId, context); + return service.setTier(containerName, blob, this.client.getUrl(), timeout, tier, rehydratePriority, this.client.getVersion(), requestId, comp, leaseId, context); } /** 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 390c2436de9a..813a9c5be162 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 @@ -21,6 +21,7 @@ import com.azure.core.implementation.annotation.UnexpectedResponseExceptionType; import com.azure.core.implementation.util.Base64Util; import com.azure.core.util.Context; +import com.azure.storage.blob.models.AccessTierOptional; import com.azure.storage.blob.models.BlobHTTPHeaders; import com.azure.storage.blob.models.BlockBlobsCommitBlockListResponse; import com.azure.storage.blob.models.BlockBlobsGetBlockListResponse; @@ -29,13 +30,14 @@ import com.azure.storage.blob.models.BlockBlobsUploadResponse; import com.azure.storage.blob.models.BlockListType; import com.azure.storage.blob.models.BlockLookupList; +import com.azure.storage.blob.models.CpkInfo; import com.azure.storage.blob.models.EncryptionAlgorithmType; import com.azure.storage.blob.models.LeaseAccessConditions; import com.azure.storage.blob.models.ModifiedAccessConditions; import com.azure.storage.blob.models.SourceModifiedAccessConditions; import com.azure.storage.blob.models.StorageErrorException; -import io.netty.buffer.ByteBuf; import java.net.URL; +import java.nio.ByteBuffer; import java.time.OffsetDateTime; import java.util.Map; import reactor.core.publisher.Flux; @@ -76,27 +78,27 @@ private interface BlockBlobsService { @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono upload(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @BodyParam("application/octet-stream") Flux body, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-meta-") Map metadata, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-blob-type") String blobType, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @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 upload(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @BodyParam("application/octet-stream") Flux body, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-access-tier") AccessTierOptional tier, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-blob-type") String blobType, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @HeaderParam("x-ms-blob-content-disposition") String blobContentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-encryption-key") String encryptionKey, @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @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({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono stageBlock(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("blockid") String blockId, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String transactionalContentMD5, @BodyParam("application/octet-stream") Flux body, @QueryParam("timeout") Integer timeout, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, Context context); + Mono stageBlock(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("blockid") String blockId, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String transactionalContentMD5, @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, @BodyParam("application/octet-stream") Flux body, @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-lease-id") String leaseId, @HeaderParam("x-ms-encryption-key") String encryptionKey, @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, Context context); @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, @QueryParam("timeout") Integer timeout, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @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}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono commitBlockList(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @BodyParam("application/xml; charset=utf-8") BlockLookupList blocks, @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-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @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 commitBlockList(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-MD5") String transactionalContentMD5, @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-access-tier") AccessTierOptional tier, @BodyParam("application/xml; charset=utf-8") BlockLookupList blocks, @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-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-content-disposition") String blobContentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-encryption-key") String encryptionKey, @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @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); @Get("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono getBlockList(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, @QueryParam("blocklisttype") BlockListType listType, @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-lease-id") String leaseId, Context context); + Mono getBlockList(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("blocklisttype") BlockListType listType, @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-lease-id") String leaseId, Context context); } /** @@ -111,12 +113,10 @@ private interface BlockBlobsService { * @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, Context context) { + public Mono uploadWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Context context) { final Integer timeout = null; final Map metadata = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; + final AccessTierOptional tier = null; final String requestId = null; final String blobType = "BlockBlob"; final String blobContentType = null; @@ -125,12 +125,15 @@ public Mono uploadWithRestResponseAsync(String contain final String blobCacheControl = null; final String blobContentDisposition = null; final String leaseId = null; + final String encryptionKey = null; + final String encryptionKeySha256 = null; + final EncryptionAlgorithmType encryptionAlgorithm = null; final String ifMatch = null; final String ifNoneMatch = null; String blobContentMD5Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.upload(containerName, blob, this.client.getUrl(), body, timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.upload(containerName, blob, this.client.getUrl(), body, timeout, contentLength, metadata, tier, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -142,68 +145,79 @@ public Mono uploadWithRestResponseAsync(String contain * @param contentLength The length of the request. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. + * @param tier Optional. Indicates the tier to be set on the blob. Possible values include: 'P4', 'P6', 'P10', 'P15', 'P20', 'P30', 'P40', 'P50', 'P60', 'P70', 'P80', 'Hot', 'Cool', 'Archive'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param blobHTTPHeaders Additional parameters for the operation. * @param leaseAccessConditions Additional parameters for the operation. + * @param cpkInfo Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono uploadWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Integer timeout, Map metadata, AccessTierOptional tier, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String blobType = "BlockBlob"; String blobContentType = null; if (blobHTTPHeaders != null) { - blobContentType = blobHTTPHeaders.blobContentType(); + blobContentType = blobHTTPHeaders.getBlobContentType(); } String blobContentEncoding = null; if (blobHTTPHeaders != null) { - blobContentEncoding = blobHTTPHeaders.blobContentEncoding(); + blobContentEncoding = blobHTTPHeaders.getBlobContentEncoding(); } String blobContentLanguage = null; if (blobHTTPHeaders != null) { - blobContentLanguage = blobHTTPHeaders.blobContentLanguage(); + blobContentLanguage = blobHTTPHeaders.getBlobContentLanguage(); } byte[] blobContentMD5 = null; if (blobHTTPHeaders != null) { - blobContentMD5 = blobHTTPHeaders.blobContentMD5(); + blobContentMD5 = blobHTTPHeaders.getBlobContentMD5(); } String blobCacheControl = null; if (blobHTTPHeaders != null) { - blobCacheControl = blobHTTPHeaders.blobCacheControl(); + blobCacheControl = blobHTTPHeaders.getBlobCacheControl(); } String blobContentDisposition = null; if (blobHTTPHeaders != null) { - blobContentDisposition = blobHTTPHeaders.blobContentDisposition(); + blobContentDisposition = blobHTTPHeaders.getBlobContentDisposition(); } String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); + } + String encryptionKey = null; + if (cpkInfo != null) { + encryptionKey = cpkInfo.getEncryptionKey(); + } + String encryptionKeySha256 = null; + if (cpkInfo != null) { + encryptionKeySha256 = cpkInfo.getEncryptionKeySha256(); + } + EncryptionAlgorithmType encryptionAlgorithm = null; + if (cpkInfo != null) { + encryptionAlgorithm = cpkInfo.getEncryptionAlgorithm(); } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } String blobContentMD5Converted = Base64Util.encodeToString(blobContentMD5); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.upload(containerName, blob, this.client.getUrl(), body, timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.upload(containerName, blob, this.client.getUrl(), body, timeout, contentLength, metadata, tier, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -219,16 +233,17 @@ public Mono uploadWithRestResponseAsync(String contain * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono stageBlockWithRestResponseAsync(String containerName, String blob, String blockId, long contentLength, Flux body, Context context) { + public Mono stageBlockWithRestResponseAsync(String containerName, String blob, String blockId, long contentLength, Flux body, Context context) { final Integer timeout = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; final String requestId = null; final String comp = "block"; final String leaseId = null; + final String encryptionKey = null; + final String encryptionKeySha256 = null; + final EncryptionAlgorithmType encryptionAlgorithm = null; String transactionalContentMD5Converted = null; - return service.stageBlock(containerName, blob, this.client.getUrl(), blockId, contentLength, transactionalContentMD5Converted, body, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, context); + String transactionalContentCrc64Converted = null; + return service.stageBlock(containerName, blob, this.client.getUrl(), blockId, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, body, timeout, this.client.getVersion(), requestId, comp, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, context); } /** @@ -240,25 +255,37 @@ public Mono stageBlockWithRestResponseAsync(String * @param contentLength The length of the request. * @param body Initial data. * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param leaseAccessConditions Additional parameters for the operation. + * @param cpkInfo Additional parameters for the operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono stageBlockWithRestResponseAsync(String containerName, String blob, String blockId, long contentLength, Flux body, byte[] transactionalContentMD5, Integer timeout, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, Context context) { + public Mono stageBlockWithRestResponseAsync(String containerName, String blob, String blockId, long contentLength, Flux body, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, Context context) { final String comp = "block"; String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); + } + String encryptionKey = null; + if (cpkInfo != null) { + encryptionKey = cpkInfo.getEncryptionKey(); + } + String encryptionKeySha256 = null; + if (cpkInfo != null) { + encryptionKeySha256 = cpkInfo.getEncryptionKeySha256(); + } + EncryptionAlgorithmType encryptionAlgorithm = null; + if (cpkInfo != null) { + encryptionAlgorithm = cpkInfo.getEncryptionAlgorithm(); } String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); - return service.stageBlock(containerName, blob, this.client.getUrl(), blockId, contentLength, transactionalContentMD5Converted, body, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, context); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); + return service.stageBlock(containerName, blob, this.client.getUrl(), blockId, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, body, timeout, this.client.getVersion(), requestId, comp, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, context); } /** @@ -277,18 +304,19 @@ public Mono stageBlockWithRestResponseAsync(String 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; + final String comp = "block"; final String encryptionKey = null; final String encryptionKeySha256 = null; final EncryptionAlgorithmType encryptionAlgorithm = null; - final String requestId = null; - final String comp = "block"; final String leaseId = null; final String sourceIfMatch = null; final String sourceIfNoneMatch = null; String sourceContentMD5Converted = null; + String sourceContentcrc64Converted = null; DateTimeRfc1123 sourceIfModifiedSinceConverted = null; DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null; - return service.stageBlockFromURL(containerName, blob, this.client.getUrl(), blockId, contentLength, sourceUrl, sourceRange, sourceContentMD5Converted, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); + return service.stageBlockFromURL(containerName, blob, this.client.getUrl(), blockId, contentLength, sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, timeout, this.client.getVersion(), requestId, comp, encryptionKey, encryptionKeySha256, encryptionAlgorithm, leaseId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); } /** @@ -301,11 +329,10 @@ public Mono stageBlockFromURLWithRestRespon * @param sourceUrl Specify a URL to the copy source. * @param sourceRange Bytes of source data in the specified range. * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy source. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param cpkInfo Additional parameters for the operation. * @param leaseAccessConditions Additional parameters for the operation. * @param sourceModifiedAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. @@ -313,32 +340,45 @@ 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, Integer timeout, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, 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) { + encryptionKey = cpkInfo.getEncryptionKey(); + } + String encryptionKeySha256 = null; + if (cpkInfo != null) { + encryptionKeySha256 = cpkInfo.getEncryptionKeySha256(); + } + EncryptionAlgorithmType encryptionAlgorithm = null; + if (cpkInfo != null) { + encryptionAlgorithm = cpkInfo.getEncryptionAlgorithm(); + } String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); } OffsetDateTime sourceIfModifiedSince = null; if (sourceModifiedAccessConditions != null) { - sourceIfModifiedSince = sourceModifiedAccessConditions.sourceIfModifiedSince(); + sourceIfModifiedSince = sourceModifiedAccessConditions.getSourceIfModifiedSince(); } OffsetDateTime sourceIfUnmodifiedSince = null; if (sourceModifiedAccessConditions != null) { - sourceIfUnmodifiedSince = sourceModifiedAccessConditions.sourceIfUnmodifiedSince(); + sourceIfUnmodifiedSince = sourceModifiedAccessConditions.getSourceIfUnmodifiedSince(); } String sourceIfMatch = null; if (sourceModifiedAccessConditions != null) { - sourceIfMatch = sourceModifiedAccessConditions.sourceIfMatch(); + sourceIfMatch = sourceModifiedAccessConditions.getSourceIfMatch(); } String sourceIfNoneMatch = null; if (sourceModifiedAccessConditions != null) { - sourceIfNoneMatch = sourceModifiedAccessConditions.sourceIfNoneMatch(); + sourceIfNoneMatch = sourceModifiedAccessConditions.getSourceIfNoneMatch(); } String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); + String sourceContentcrc64Converted = Base64Util.encodeToString(sourceContentcrc64); DateTimeRfc1123 sourceIfModifiedSinceConverted = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - return service.stageBlockFromURL(containerName, blob, this.client.getUrl(), blockId, contentLength, sourceUrl, sourceRange, sourceContentMD5Converted, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); + return service.stageBlockFromURL(containerName, blob, this.client.getUrl(), blockId, contentLength, sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, timeout, this.client.getVersion(), requestId, comp, encryptionKey, encryptionKeySha256, encryptionAlgorithm, leaseId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); } /** @@ -355,9 +395,7 @@ public Mono stageBlockFromURLWithRestRespon public Mono commitBlockListWithRestResponseAsync(String containerName, String blob, BlockLookupList blocks, Context context) { final Integer timeout = null; final Map metadata = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; + final AccessTierOptional tier = null; final String requestId = null; final String comp = "blocklist"; final String blobCacheControl = null; @@ -366,12 +404,17 @@ public Mono commitBlockListWithRestResponseAs final String blobContentLanguage = null; final String blobContentDisposition = null; final String leaseId = null; + final String encryptionKey = null; + final String encryptionKeySha256 = null; + final EncryptionAlgorithmType encryptionAlgorithm = null; final String ifMatch = null; final String ifNoneMatch = null; + String transactionalContentMD5Converted = null; + String transactionalContentCrc64Converted = null; String blobContentMD5Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.commitBlockList(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, blocks, this.client.getVersion(), requestId, comp, blobCacheControl, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.commitBlockList(containerName, blob, this.client.getUrl(), timeout, transactionalContentMD5Converted, transactionalContentCrc64Converted, metadata, tier, blocks, this.client.getVersion(), requestId, comp, blobCacheControl, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobContentDisposition, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -381,69 +424,84 @@ public Mono commitBlockListWithRestResponseAs * @param blob The blob name. * @param blocks the BlockLookupList value. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. + * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. + * @param tier Optional. Indicates the tier to be set on the blob. Possible values include: 'P4', 'P6', 'P10', 'P15', 'P20', 'P30', 'P40', 'P50', 'P60', 'P70', 'P80', 'Hot', 'Cool', 'Archive'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param blobHTTPHeaders Additional parameters for the operation. * @param leaseAccessConditions Additional parameters for the operation. + * @param cpkInfo Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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, Map metadata, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono commitBlockListWithRestResponseAsync(String containerName, String blob, BlockLookupList blocks, Integer timeout, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Map metadata, AccessTierOptional tier, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "blocklist"; String blobCacheControl = null; if (blobHTTPHeaders != null) { - blobCacheControl = blobHTTPHeaders.blobCacheControl(); + blobCacheControl = blobHTTPHeaders.getBlobCacheControl(); } String blobContentType = null; if (blobHTTPHeaders != null) { - blobContentType = blobHTTPHeaders.blobContentType(); + blobContentType = blobHTTPHeaders.getBlobContentType(); } String blobContentEncoding = null; if (blobHTTPHeaders != null) { - blobContentEncoding = blobHTTPHeaders.blobContentEncoding(); + blobContentEncoding = blobHTTPHeaders.getBlobContentEncoding(); } String blobContentLanguage = null; if (blobHTTPHeaders != null) { - blobContentLanguage = blobHTTPHeaders.blobContentLanguage(); + blobContentLanguage = blobHTTPHeaders.getBlobContentLanguage(); } byte[] blobContentMD5 = null; if (blobHTTPHeaders != null) { - blobContentMD5 = blobHTTPHeaders.blobContentMD5(); + blobContentMD5 = blobHTTPHeaders.getBlobContentMD5(); } String blobContentDisposition = null; if (blobHTTPHeaders != null) { - blobContentDisposition = blobHTTPHeaders.blobContentDisposition(); + blobContentDisposition = blobHTTPHeaders.getBlobContentDisposition(); } String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); + } + String encryptionKey = null; + if (cpkInfo != null) { + encryptionKey = cpkInfo.getEncryptionKey(); + } + String encryptionKeySha256 = null; + if (cpkInfo != null) { + encryptionKeySha256 = cpkInfo.getEncryptionKeySha256(); + } + EncryptionAlgorithmType encryptionAlgorithm = null; + if (cpkInfo != null) { + encryptionAlgorithm = cpkInfo.getEncryptionAlgorithm(); } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } + String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); String blobContentMD5Converted = Base64Util.encodeToString(blobContentMD5); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.commitBlockList(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, blocks, this.client.getVersion(), requestId, comp, blobCacheControl, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.commitBlockList(containerName, blob, this.client.getUrl(), timeout, transactionalContentMD5Converted, transactionalContentCrc64Converted, metadata, tier, blocks, this.client.getVersion(), requestId, comp, blobCacheControl, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobContentDisposition, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -459,12 +517,11 @@ public Mono commitBlockListWithRestResponseAs @ServiceMethod(returns = ReturnType.SINGLE) public Mono getBlockListWithRestResponseAsync(String containerName, String blob, BlockListType listType, Context context) { final String snapshot = null; - final String versionId = null; final Integer timeout = null; final String requestId = null; final String comp = "blocklist"; final String leaseId = null; - return service.getBlockList(containerName, blob, this.client.getUrl(), snapshot, versionId, listType, timeout, this.client.getVersion(), requestId, comp, leaseId, context); + return service.getBlockList(containerName, blob, this.client.getUrl(), snapshot, listType, timeout, this.client.getVersion(), requestId, comp, leaseId, context); } /** @@ -474,7 +531,6 @@ public Mono getBlockListWithRestResponseAsync(St * @param blob The blob name. * @param listType Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both lists together. Possible values include: 'committed', 'uncommitted', 'all'. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot of a Blob.</a>. - * @param versionId The version ID parameter is an opaque DateTime value that, when present, specifies the blob version to retrieve. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param leaseAccessConditions Additional parameters for the operation. @@ -483,12 +539,12 @@ public Mono getBlockListWithRestResponseAsync(St * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getBlockListWithRestResponseAsync(String containerName, String blob, BlockListType listType, String snapshot, String versionId, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, Context context) { + public Mono getBlockListWithRestResponseAsync(String containerName, String blob, BlockListType listType, String snapshot, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, Context context) { final String comp = "blocklist"; String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); } - return service.getBlockList(containerName, blob, this.client.getUrl(), snapshot, versionId, listType, timeout, this.client.getVersion(), requestId, comp, leaseId, context); + return service.getBlockList(containerName, blob, this.client.getUrl(), snapshot, listType, timeout, this.client.getVersion(), requestId, comp, leaseId, context); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java index efb3b64cdf8b..0b41ac8a6258 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java @@ -138,12 +138,12 @@ private interface ContainersService { @Get("{containerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono listBlobFlatSegment(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + Mono listBlobFlatSegment(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker1, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); @Get("{containerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono listBlobHierarchySegment(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("delimiter") String delimiter, @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + Mono listBlobHierarchySegment(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("delimiter") String delimiter, @QueryParam("marker") String marker1, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); @Get("{containerName}") @ExpectedResponses({200}) @@ -220,7 +220,7 @@ public Mono getPropertiesWithRestResponseAsync( final String restype = "container"; String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); } return service.getProperties(containerName, this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, leaseId, context); } @@ -261,15 +261,15 @@ public Mono deleteWithRestResponseAsync(String contain final String restype = "container"; String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); @@ -315,11 +315,11 @@ public Mono setMetadataWithRestResponseAsync(Stri final String comp = "metadata"; String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); return service.setMetadata(containerName, this.client.getUrl(), timeout, metadata, this.client.getVersion(), requestId, restype, comp, leaseId, ifModifiedSinceConverted, context); @@ -360,7 +360,7 @@ public Mono getAccessPolicyWithRestResponseAs final String comp = "acl"; String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); } return service.getAccessPolicy(containerName, this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, comp, leaseId, context); } @@ -407,15 +407,15 @@ public Mono setAccessPolicyWithRestResponseAs final String comp = "acl"; String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } SignedIdentifiersWrapper containerAclConverted = new SignedIdentifiersWrapper(containerAcl); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); @@ -465,11 +465,11 @@ public Mono acquireLeaseWithRestResponseAsync(St final String action = "acquire"; OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); @@ -516,11 +516,11 @@ public Mono releaseLeaseWithRestResponseAsync(St final String action = "release"; OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); @@ -567,11 +567,11 @@ public Mono renewLeaseWithRestResponseAsync(String final String action = "renew"; OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); @@ -618,11 +618,11 @@ public Mono breakLeaseWithRestResponseAsync(String final String action = "break"; OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); @@ -671,11 +671,11 @@ public Mono changeLeaseWithRestResponseAsync(Stri final String action = "change"; OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); 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 new file mode 100644 index 000000000000..b539ab216866 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/DirectorysImpl.java @@ -0,0 +1,505 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.implementation; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.RestProxy; +import com.azure.core.implementation.annotation.Delete; +import com.azure.core.implementation.annotation.ExpectedResponses; +import com.azure.core.implementation.annotation.Head; +import com.azure.core.implementation.annotation.HeaderParam; +import com.azure.core.implementation.annotation.Host; +import com.azure.core.implementation.annotation.HostParam; +import com.azure.core.implementation.annotation.Patch; +import com.azure.core.implementation.annotation.PathParam; +import com.azure.core.implementation.annotation.Put; +import com.azure.core.implementation.annotation.QueryParam; +import com.azure.core.implementation.annotation.ReturnType; +import com.azure.core.implementation.annotation.ServiceInterface; +import com.azure.core.implementation.annotation.ServiceMethod; +import com.azure.core.implementation.annotation.UnexpectedResponseExceptionType; +import com.azure.core.util.Context; +import com.azure.storage.blob.models.DataLakeStorageErrorException; +import com.azure.storage.blob.models.DirectoryHttpHeaders; +import com.azure.storage.blob.models.DirectorysCreateResponse; +import com.azure.storage.blob.models.DirectorysDeleteResponse; +import com.azure.storage.blob.models.DirectorysGetAccessControlResponse; +import com.azure.storage.blob.models.DirectorysRenameResponse; +import com.azure.storage.blob.models.DirectorysSetAccessControlResponse; +import com.azure.storage.blob.models.LeaseAccessConditions; +import com.azure.storage.blob.models.ModifiedAccessConditions; +import com.azure.storage.blob.models.PathRenameMode; +import com.azure.storage.blob.models.SourceModifiedAccessConditions; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * Directorys. + */ +public final class DirectorysImpl { + /** + * The proxy service used to perform REST calls. + */ + private DirectorysService service; + + /** + * The service client containing this operation class. + */ + private AzureBlobStorageImpl client; + + /** + * Initializes an instance of DirectorysImpl. + * + * @param client the instance of the service client containing this operation class. + */ + public DirectorysImpl(AzureBlobStorageImpl client) { + this.service = RestProxy.create(DirectorysService.class, client.getHttpPipeline()); + this.client = client; + } + + /** + * The interface defining all the services for AzureBlobStorageDirectorys + * to be used by the proxy service to perform REST calls. + */ + @Host("{url}") + @ServiceInterface(name = "AzureBlobStorageDirectorys") + private interface DirectorysService { + @Put("{filesystem}/{path}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(DataLakeStorageErrorException.class) + Mono create(@PathParam("filesystem") String filesystem, @PathParam("path") String path, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-properties") String directoryProperties, @HeaderParam("x-ms-permissions") String posixPermissions, @HeaderParam("x-ms-umask") String posixUmask, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("resource") String resource, @HeaderParam("x-ms-cache-control") String cacheControl, @HeaderParam("x-ms-content-type") String contentType, @HeaderParam("x-ms-content-encoding") String contentEncoding, @HeaderParam("x-ms-content-language") String contentLanguage, @HeaderParam("x-ms-content-disposition") String contentDisposition, @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("{filesystem}/{path}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(DataLakeStorageErrorException.class) + Mono rename(@PathParam("filesystem") String filesystem, @PathParam("path") String path, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @QueryParam("continuation") String marker, @QueryParam("mode") PathRenameMode pathRenameMode, @HeaderParam("x-ms-rename-source") String renameSource, @HeaderParam("x-ms-properties") String directoryProperties, @HeaderParam("x-ms-permissions") String posixPermissions, @HeaderParam("x-ms-umask") String posixUmask, @HeaderParam("x-ms-source-lease-id") String sourceLeaseId, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-cache-control") String cacheControl, @HeaderParam("x-ms-content-type") String contentType, @HeaderParam("x-ms-content-encoding") String contentEncoding, @HeaderParam("x-ms-content-language") String contentLanguage, @HeaderParam("x-ms-content-disposition") String contentDisposition, @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, @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); + + @Delete("{filesystem}/{path}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(DataLakeStorageErrorException.class) + Mono delete(@PathParam("filesystem") String filesystem, @PathParam("path") String path, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @QueryParam("recursive") boolean recursiveDirectoryDelete, @QueryParam("continuation") String marker, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @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); + + @Patch("{filesystem}/{path}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(DataLakeStorageErrorException.class) + Mono setAccessControl(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-owner") String owner, @HeaderParam("x-ms-group") String group, @HeaderParam("x-ms-permissions") String posixPermissions, @HeaderParam("x-ms-acl") String posixAcl, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-version") String version, @QueryParam("action") String action, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); + + @Head("{filesystem}/{path}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(DataLakeStorageErrorException.class) + Mono getAccessControl(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @QueryParam("upn") Boolean upn, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-version") String version, @QueryParam("action") String action, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); + } + + /** + * Create a directory. By default, the destination is overwritten and if the destination already exists and has a lease the lease is broken. This operation supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). To fail if the destination already exists, use a conditional request with If-None-Match: "*". + * + * @param filesystem The filesystem name. + * @param path The namespace path to a file or directory. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createWithRestResponseAsync(String filesystem, String path, Context context) { + final Integer timeout = null; + final String directoryProperties = null; + final String posixPermissions = null; + final String posixUmask = null; + final String requestId = null; + final String resource = "directory"; + final String cacheControl = null; + final String contentType = null; + final String contentEncoding = null; + final String contentLanguage = null; + final String contentDisposition = null; + final String leaseId = null; + final String ifMatch = null; + final String ifNoneMatch = null; + DateTimeRfc1123 ifModifiedSinceConverted = null; + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + return service.create(filesystem, path, this.client.getUrl(), timeout, directoryProperties, posixPermissions, posixUmask, this.client.getVersion(), requestId, resource, cacheControl, contentType, contentEncoding, contentLanguage, contentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + } + + /** + * Create a directory. By default, the destination is overwritten and if the destination already exists and has a lease the lease is broken. This operation supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). To fail if the destination already exists, use a conditional request with If-None-Match: "*". + * + * @param filesystem The filesystem name. + * @param path The namespace path to a file or directory. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. + * @param directoryProperties Optional. User-defined properties to be stored with the file or directory, in the format of a comma-separated list of name and value pairs "n1=v1, n2=v2, ...", where each value is base64 encoded. + * @param posixPermissions Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file owner, the file owning group, and others. Each class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. 0766) are supported. + * @param posixUmask Only valid if Hierarchical Namespace is enabled for the account. This umask restricts permission settings for file and directory, and will only be applied when default Acl does not exist in parent directory. If the umask bit has set, it means that the corresponding permission will be disabled. Otherwise the corresponding permission will be determined by the permission. A 4-digit octal notation (e.g. 0022) is supported here. If no umask was specified, a default umask - 0027 will be used. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param directoryHttpHeaders Additional parameters for the operation. + * @param leaseAccessConditions Additional parameters for the operation. + * @param modifiedAccessConditions Additional parameters for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createWithRestResponseAsync(String filesystem, String path, Integer timeout, String directoryProperties, String posixPermissions, String posixUmask, String requestId, DirectoryHttpHeaders directoryHttpHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + final String resource = "directory"; + String cacheControl = null; + if (directoryHttpHeaders != null) { + cacheControl = directoryHttpHeaders.getCacheControl(); + } + String contentType = null; + if (directoryHttpHeaders != null) { + contentType = directoryHttpHeaders.getContentType(); + } + String contentEncoding = null; + if (directoryHttpHeaders != null) { + contentEncoding = directoryHttpHeaders.getContentEncoding(); + } + String contentLanguage = null; + if (directoryHttpHeaders != null) { + contentLanguage = directoryHttpHeaders.getContentLanguage(); + } + String contentDisposition = null; + if (directoryHttpHeaders != null) { + contentDisposition = directoryHttpHeaders.getContentDisposition(); + } + String leaseId = null; + if (leaseAccessConditions != null) { + leaseId = leaseAccessConditions.getLeaseId(); + } + OffsetDateTime ifModifiedSince = null; + if (modifiedAccessConditions != null) { + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = null; + if (modifiedAccessConditions != null) { + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); + } + String ifMatch = null; + if (modifiedAccessConditions != null) { + ifMatch = modifiedAccessConditions.getIfMatch(); + } + String ifNoneMatch = null; + if (modifiedAccessConditions != null) { + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); + } + DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.create(filesystem, path, this.client.getUrl(), timeout, directoryProperties, posixPermissions, posixUmask, this.client.getVersion(), requestId, resource, cacheControl, contentType, contentEncoding, contentLanguage, contentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + } + + /** + * Rename a directory. By default, the destination is overwritten and if the destination already exists and has a lease the lease is broken. This operation supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). To fail if the destination already exists, use a conditional request with If-None-Match: "*". + * + * @param filesystem The filesystem name. + * @param path The namespace path to a file or directory. + * @param renameSource The file or directory to be renamed. The value must have the following format: "/{filesysystem}/{path}". If "x-ms-properties" is specified, the properties will overwrite the existing properties; otherwise, the existing properties will be preserved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono renameWithRestResponseAsync(String filesystem, String path, String renameSource, Context context) { + final Integer timeout = null; + final String marker = null; + final String directoryProperties = null; + final String posixPermissions = null; + final String posixUmask = null; + final String sourceLeaseId = null; + final String requestId = null; + final String cacheControl = null; + final String contentType = null; + final String contentEncoding = null; + final String contentLanguage = null; + final String contentDisposition = null; + final String leaseId = null; + final String ifMatch = null; + final String ifNoneMatch = null; + final String sourceIfMatch = null; + final String sourceIfNoneMatch = null; + DateTimeRfc1123 ifModifiedSinceConverted = null; + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + DateTimeRfc1123 sourceIfModifiedSinceConverted = null; + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null; + return service.rename(filesystem, path, this.client.getUrl(), timeout, marker, this.client.getPathRenameMode(), renameSource, directoryProperties, posixPermissions, posixUmask, sourceLeaseId, this.client.getVersion(), requestId, cacheControl, contentType, contentEncoding, contentLanguage, contentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); + } + + /** + * Rename a directory. By default, the destination is overwritten and if the destination already exists and has a lease the lease is broken. This operation supports conditional HTTP requests. For more information, see [Specifying Conditional Headers for Blob Service Operations](https://docs.microsoft.com/en-us/rest/api/storageservices/specifying-conditional-headers-for-blob-service-operations). To fail if the destination already exists, use a conditional request with If-None-Match: "*". + * + * @param filesystem The filesystem name. + * @param path The namespace path to a file or directory. + * @param renameSource The file or directory to be renamed. The value must have the following format: "/{filesysystem}/{path}". If "x-ms-properties" is specified, the properties will overwrite the existing properties; otherwise, the existing properties will be preserved. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. + * @param marker When renaming a directory, the number of paths that are renamed with each invocation is limited. If the number of paths to be renamed exceeds this limit, a continuation token is returned in this response header. When a continuation token is returned in the response, it must be specified in a subsequent invocation of the rename operation to continue renaming the directory. + * @param directoryProperties Optional. User-defined properties to be stored with the file or directory, in the format of a comma-separated list of name and value pairs "n1=v1, n2=v2, ...", where each value is base64 encoded. + * @param posixPermissions Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file owner, the file owning group, and others. Each class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. 0766) are supported. + * @param posixUmask Only valid if Hierarchical Namespace is enabled for the account. This umask restricts permission settings for file and directory, and will only be applied when default Acl does not exist in parent directory. If the umask bit has set, it means that the corresponding permission will be disabled. Otherwise the corresponding permission will be determined by the permission. A 4-digit octal notation (e.g. 0022) is supported here. If no umask was specified, a default umask - 0027 will be used. + * @param sourceLeaseId A lease ID for the source path. If specified, the source path must have an active lease and the leaase ID must match. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param directoryHttpHeaders Additional parameters for the operation. + * @param leaseAccessConditions Additional parameters for the operation. + * @param modifiedAccessConditions Additional parameters for the operation. + * @param sourceModifiedAccessConditions Additional parameters for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono renameWithRestResponseAsync(String filesystem, String path, String renameSource, Integer timeout, String marker, String directoryProperties, String posixPermissions, String posixUmask, String sourceLeaseId, String requestId, DirectoryHttpHeaders directoryHttpHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { + String cacheControl = null; + if (directoryHttpHeaders != null) { + cacheControl = directoryHttpHeaders.getCacheControl(); + } + String contentType = null; + if (directoryHttpHeaders != null) { + contentType = directoryHttpHeaders.getContentType(); + } + String contentEncoding = null; + if (directoryHttpHeaders != null) { + contentEncoding = directoryHttpHeaders.getContentEncoding(); + } + String contentLanguage = null; + if (directoryHttpHeaders != null) { + contentLanguage = directoryHttpHeaders.getContentLanguage(); + } + String contentDisposition = null; + if (directoryHttpHeaders != null) { + contentDisposition = directoryHttpHeaders.getContentDisposition(); + } + String leaseId = null; + if (leaseAccessConditions != null) { + leaseId = leaseAccessConditions.getLeaseId(); + } + OffsetDateTime ifModifiedSince = null; + if (modifiedAccessConditions != null) { + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = null; + if (modifiedAccessConditions != null) { + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); + } + String ifMatch = null; + if (modifiedAccessConditions != null) { + ifMatch = modifiedAccessConditions.getIfMatch(); + } + String ifNoneMatch = null; + if (modifiedAccessConditions != null) { + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); + } + OffsetDateTime sourceIfModifiedSince = null; + if (sourceModifiedAccessConditions != null) { + sourceIfModifiedSince = sourceModifiedAccessConditions.getSourceIfModifiedSince(); + } + OffsetDateTime sourceIfUnmodifiedSince = null; + if (sourceModifiedAccessConditions != null) { + sourceIfUnmodifiedSince = sourceModifiedAccessConditions.getSourceIfUnmodifiedSince(); + } + String sourceIfMatch = null; + if (sourceModifiedAccessConditions != null) { + sourceIfMatch = sourceModifiedAccessConditions.getSourceIfMatch(); + } + String sourceIfNoneMatch = null; + if (sourceModifiedAccessConditions != null) { + sourceIfNoneMatch = sourceModifiedAccessConditions.getSourceIfNoneMatch(); + } + DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + DateTimeRfc1123 sourceIfModifiedSinceConverted = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); + DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); + return service.rename(filesystem, path, this.client.getUrl(), timeout, marker, this.client.getPathRenameMode(), renameSource, directoryProperties, posixPermissions, posixUmask, sourceLeaseId, this.client.getVersion(), requestId, cacheControl, contentType, contentEncoding, contentLanguage, contentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); + } + + /** + * Deletes the directory. + * + * @param filesystem The filesystem name. + * @param path The namespace path to a file or directory. + * @param recursiveDirectoryDelete If "true", all paths beneath the directory will be deleted. If "false" and the directory is non-empty, an error occurs. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteWithRestResponseAsync(String filesystem, String path, boolean recursiveDirectoryDelete, Context context) { + final Integer timeout = null; + final String marker = null; + final String requestId = null; + final String leaseId = null; + final String ifMatch = null; + final String ifNoneMatch = null; + DateTimeRfc1123 ifModifiedSinceConverted = null; + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + return service.delete(filesystem, path, this.client.getUrl(), timeout, recursiveDirectoryDelete, marker, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + } + + /** + * Deletes the directory. + * + * @param filesystem The filesystem name. + * @param path The namespace path to a file or directory. + * @param recursiveDirectoryDelete If "true", all paths beneath the directory will be deleted. If "false" and the directory is non-empty, an error occurs. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. + * @param marker When renaming a directory, the number of paths that are renamed with each invocation is limited. If the number of paths to be renamed exceeds this limit, a continuation token is returned in this response header. When a continuation token is returned in the response, it must be specified in a subsequent invocation of the rename operation to continue renaming the directory. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param leaseAccessConditions Additional parameters for the operation. + * @param modifiedAccessConditions Additional parameters for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteWithRestResponseAsync(String filesystem, String path, boolean recursiveDirectoryDelete, Integer timeout, String marker, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + String leaseId = null; + if (leaseAccessConditions != null) { + leaseId = leaseAccessConditions.getLeaseId(); + } + OffsetDateTime ifModifiedSince = null; + if (modifiedAccessConditions != null) { + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = null; + if (modifiedAccessConditions != null) { + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); + } + String ifMatch = null; + if (modifiedAccessConditions != null) { + ifMatch = modifiedAccessConditions.getIfMatch(); + } + String ifNoneMatch = null; + if (modifiedAccessConditions != null) { + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); + } + DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.delete(filesystem, path, this.client.getUrl(), timeout, recursiveDirectoryDelete, marker, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + } + + /** + * Set the owner, group, permissions, or access control list for a directory. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setAccessControlWithRestResponseAsync(Context context) { + final Integer timeout = null; + final String owner = null; + final String group = null; + final String posixPermissions = null; + final String posixAcl = null; + final String requestId = null; + final String action = "setAccessControl"; + final String leaseId = null; + final String ifMatch = null; + final String ifNoneMatch = null; + DateTimeRfc1123 ifModifiedSinceConverted = null; + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + return service.setAccessControl(this.client.getUrl(), timeout, owner, group, posixPermissions, posixAcl, requestId, this.client.getVersion(), action, leaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + } + + /** + * Set the owner, group, permissions, or access control list for a directory. + * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. + * @param owner Optional. The owner of the blob or directory. + * @param group Optional. The owning group of the blob or directory. + * @param posixPermissions Optional and only valid if Hierarchical Namespace is enabled for the account. Sets POSIX access permissions for the file owner, the file owning group, and others. Each class may be granted read, write, or execute permission. The sticky bit is also supported. Both symbolic (rwxrw-rw-) and 4-digit octal notation (e.g. 0766) are supported. + * @param posixAcl Sets POSIX access control rights on files and directories. The value is a comma-separated list of access control entries. Each access control entry (ACE) consists of a scope, a type, a user or group identifier, and permissions in the format "[scope:][type]:[id]:[permissions]". + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param leaseAccessConditions Additional parameters for the operation. + * @param modifiedAccessConditions Additional parameters for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono setAccessControlWithRestResponseAsync(Integer timeout, String owner, String group, String posixPermissions, String posixAcl, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + final String action = "setAccessControl"; + String leaseId = null; + if (leaseAccessConditions != null) { + leaseId = leaseAccessConditions.getLeaseId(); + } + String ifMatch = null; + if (modifiedAccessConditions != null) { + ifMatch = modifiedAccessConditions.getIfMatch(); + } + String ifNoneMatch = null; + if (modifiedAccessConditions != null) { + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); + } + OffsetDateTime ifModifiedSince = null; + if (modifiedAccessConditions != null) { + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = null; + if (modifiedAccessConditions != null) { + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); + } + DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.setAccessControl(this.client.getUrl(), timeout, owner, group, posixPermissions, posixAcl, requestId, this.client.getVersion(), action, leaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + } + + /** + * Get the owner, group, permissions, or access control list for a directory. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAccessControlWithRestResponseAsync(Context context) { + final Integer timeout = null; + final Boolean upn = null; + final String requestId = null; + final String action = "getAccessControl"; + final String leaseId = null; + final String ifMatch = null; + final String ifNoneMatch = null; + DateTimeRfc1123 ifModifiedSinceConverted = null; + DateTimeRfc1123 ifUnmodifiedSinceConverted = null; + return service.getAccessControl(this.client.getUrl(), timeout, upn, requestId, this.client.getVersion(), action, leaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + } + + /** + * Get the owner, group, permissions, or access control list for a directory. + * + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. + * @param upn Optional. Valid only when Hierarchical Namespace is enabled for the account. If "true", the identity values returned in the x-ms-owner, x-ms-group, and x-ms-acl response headers will be transformed from Azure Active Directory Object IDs to User Principal Names. If "false", the values will be returned as Azure Active Directory Object IDs. The default value is false. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param leaseAccessConditions Additional parameters for the operation. + * @param modifiedAccessConditions Additional parameters for the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAccessControlWithRestResponseAsync(Integer timeout, Boolean upn, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + final String action = "getAccessControl"; + String leaseId = null; + if (leaseAccessConditions != null) { + leaseId = leaseAccessConditions.getLeaseId(); + } + String ifMatch = null; + if (modifiedAccessConditions != null) { + ifMatch = modifiedAccessConditions.getIfMatch(); + } + String ifNoneMatch = null; + if (modifiedAccessConditions != null) { + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); + } + OffsetDateTime ifModifiedSince = null; + if (modifiedAccessConditions != null) { + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); + } + OffsetDateTime ifUnmodifiedSince = null; + if (modifiedAccessConditions != null) { + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); + } + DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); + DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); + return service.getAccessControl(this.client.getUrl(), timeout, upn, requestId, this.client.getVersion(), action, leaseId, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + } +} 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 97dd44b22bc5..d66654faf35f 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 @@ -22,6 +22,7 @@ import com.azure.core.implementation.util.Base64Util; import com.azure.core.util.Context; 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; import com.azure.storage.blob.models.ModifiedAccessConditions; @@ -38,8 +39,8 @@ import com.azure.storage.blob.models.SequenceNumberActionType; import com.azure.storage.blob.models.SourceModifiedAccessConditions; import com.azure.storage.blob.models.StorageErrorException; -import io.netty.buffer.ByteBuf; import java.net.URL; +import java.nio.ByteBuffer; import java.time.OffsetDateTime; import java.util.Map; import reactor.core.publisher.Flux; @@ -80,37 +81,37 @@ private interface PageBlobsService { @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono create(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-meta-") Map metadata, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-blob-content-length") long blobContentLength, @HeaderParam("x-ms-blob-sequence-number") Long blobSequenceNumber, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-blob-type") String blobType, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @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 create(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-blob-content-length") long blobContentLength, @HeaderParam("x-ms-blob-sequence-number") Long blobSequenceNumber, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-blob-type") String blobType, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @HeaderParam("x-ms-blob-content-disposition") String blobContentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-encryption-key") String encryptionKey, @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @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({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono uploadPages(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @BodyParam("application/octet-stream") Flux body, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String transactionalContentMD5, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @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-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, Context context); + Mono uploadPages(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @BodyParam("application/octet-stream") Flux body, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String transactionalContentMD5, @HeaderParam("x-ms-content-crc64") String transactionalContentCrc64, @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-lease-id") String leaseId, @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-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, Context context); @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono clearPages(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @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-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, Context context); + Mono clearPages(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @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-lease-id") String leaseId, @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-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, Context context); @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("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-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}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono getPageRanges(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, @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-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 getPageRanges(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @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-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); @Get("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono getPageRangesDiff(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, @QueryParam("timeout") Integer timeout, @QueryParam("prevsnapshot") String prevsnapshot, @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-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 getPageRangesDiff(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("timeout") Integer timeout, @QueryParam("prevsnapshot") String prevsnapshot, @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-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}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono resize(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-blob-content-length") long blobContentLength, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @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 resize(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-blob-content-length") long blobContentLength, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-encryption-key") String encryptionKey, @HeaderParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @HeaderParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @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}) @@ -138,9 +139,6 @@ private interface PageBlobsService { public Mono createWithRestResponseAsync(String containerName, String blob, long contentLength, long blobContentLength, Context context) { final Integer timeout = null; final Map metadata = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; final Long blobSequenceNumber = 0L; final String requestId = null; final String blobType = "PageBlob"; @@ -150,12 +148,15 @@ public Mono createWithRestResponseAsync(String containe final String blobCacheControl = null; final String blobContentDisposition = null; final String leaseId = null; + final String encryptionKey = null; + final String encryptionKeySha256 = null; + final EncryptionAlgorithmType encryptionAlgorithm = null; final String ifMatch = null; final String ifNoneMatch = null; String blobContentMD5Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.create(containerName, blob, this.client.getUrl(), timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, blobContentLength, blobSequenceNumber, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.create(containerName, blob, this.client.getUrl(), timeout, contentLength, metadata, blobContentLength, blobSequenceNumber, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -167,69 +168,79 @@ public Mono createWithRestResponseAsync(String containe * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The page blob size must be aligned to a 512-byte boundary. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. * @param blobSequenceNumber Set for page blobs only. The sequence number is 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. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param blobHTTPHeaders Additional parameters for the operation. * @param leaseAccessConditions Additional parameters for the operation. + * @param cpkInfo Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @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, Map metadata, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, Long blobSequenceNumber, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono createWithRestResponseAsync(String containerName, String blob, long contentLength, long blobContentLength, Integer timeout, 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) { - blobContentType = blobHTTPHeaders.blobContentType(); + blobContentType = blobHTTPHeaders.getBlobContentType(); } String blobContentEncoding = null; if (blobHTTPHeaders != null) { - blobContentEncoding = blobHTTPHeaders.blobContentEncoding(); + blobContentEncoding = blobHTTPHeaders.getBlobContentEncoding(); } String blobContentLanguage = null; if (blobHTTPHeaders != null) { - blobContentLanguage = blobHTTPHeaders.blobContentLanguage(); + blobContentLanguage = blobHTTPHeaders.getBlobContentLanguage(); } byte[] blobContentMD5 = null; if (blobHTTPHeaders != null) { - blobContentMD5 = blobHTTPHeaders.blobContentMD5(); + blobContentMD5 = blobHTTPHeaders.getBlobContentMD5(); } String blobCacheControl = null; if (blobHTTPHeaders != null) { - blobCacheControl = blobHTTPHeaders.blobCacheControl(); + blobCacheControl = blobHTTPHeaders.getBlobCacheControl(); } String blobContentDisposition = null; if (blobHTTPHeaders != null) { - blobContentDisposition = blobHTTPHeaders.blobContentDisposition(); + blobContentDisposition = blobHTTPHeaders.getBlobContentDisposition(); } String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); + } + String encryptionKey = null; + if (cpkInfo != null) { + encryptionKey = cpkInfo.getEncryptionKey(); + } + String encryptionKeySha256 = null; + if (cpkInfo != null) { + encryptionKeySha256 = cpkInfo.getEncryptionKeySha256(); + } + EncryptionAlgorithmType encryptionAlgorithm = null; + if (cpkInfo != null) { + encryptionAlgorithm = cpkInfo.getEncryptionAlgorithm(); } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } String blobContentMD5Converted = Base64Util.encodeToString(blobContentMD5); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.create(containerName, blob, this.client.getUrl(), timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, blobContentLength, blobSequenceNumber, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.create(containerName, blob, this.client.getUrl(), timeout, contentLength, metadata, blobContentLength, blobSequenceNumber, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -244,25 +255,26 @@ public Mono createWithRestResponseAsync(String containe * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono uploadPagesWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Context context) { + public Mono uploadPagesWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Context context) { final Integer timeout = null; final String range = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; final String requestId = null; final String comp = "page"; final String pageWrite = "update"; final String leaseId = null; + final String encryptionKey = null; + final String encryptionKeySha256 = null; + final EncryptionAlgorithmType encryptionAlgorithm = null; final Long ifSequenceNumberLessThanOrEqualTo = null; final Long ifSequenceNumberLessThan = null; final Long ifSequenceNumberEqualTo = null; final String ifMatch = null; final String ifNoneMatch = null; String transactionalContentMD5Converted = null; + String transactionalContentCrc64Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.uploadPages(containerName, blob, this.client.getUrl(), body, contentLength, transactionalContentMD5Converted, timeout, range, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.uploadPages(containerName, blob, this.client.getUrl(), body, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, range, this.client.getVersion(), requestId, comp, pageWrite, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -273,13 +285,12 @@ public Mono uploadPagesWithRestResponseAsync(Strin * @param body Initial data. * @param contentLength The length of the request. * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. + * @param transactionalContentCrc64 Specify the transactional crc64 for the body, to be validated by the service. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param range Return only the bytes of the blob in the specified range. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param leaseAccessConditions Additional parameters for the operation. + * @param cpkInfo Additional parameters for the operation. * @param sequenceNumberAccessConditions Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. @@ -287,45 +298,58 @@ public Mono uploadPagesWithRestResponseAsync(Strin * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono uploadPagesWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, byte[] transactionalContentMD5, Integer timeout, String range, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, SequenceNumberAccessConditions sequenceNumberAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono uploadPagesWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, byte[] transactionalContentMD5, byte[] transactionalContentCrc64, Integer timeout, String range, String requestId, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, SequenceNumberAccessConditions sequenceNumberAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "page"; final String pageWrite = "update"; String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); + } + String encryptionKey = null; + if (cpkInfo != null) { + encryptionKey = cpkInfo.getEncryptionKey(); + } + String encryptionKeySha256 = null; + if (cpkInfo != null) { + encryptionKeySha256 = cpkInfo.getEncryptionKeySha256(); + } + EncryptionAlgorithmType encryptionAlgorithm = null; + if (cpkInfo != null) { + encryptionAlgorithm = cpkInfo.getEncryptionAlgorithm(); } Long ifSequenceNumberLessThanOrEqualTo = null; if (sequenceNumberAccessConditions != null) { - ifSequenceNumberLessThanOrEqualTo = sequenceNumberAccessConditions.ifSequenceNumberLessThanOrEqualTo(); + ifSequenceNumberLessThanOrEqualTo = sequenceNumberAccessConditions.getIfSequenceNumberLessThanOrEqualTo(); } Long ifSequenceNumberLessThan = null; if (sequenceNumberAccessConditions != null) { - ifSequenceNumberLessThan = sequenceNumberAccessConditions.ifSequenceNumberLessThan(); + ifSequenceNumberLessThan = sequenceNumberAccessConditions.getIfSequenceNumberLessThan(); } Long ifSequenceNumberEqualTo = null; if (sequenceNumberAccessConditions != null) { - ifSequenceNumberEqualTo = sequenceNumberAccessConditions.ifSequenceNumberEqualTo(); + ifSequenceNumberEqualTo = sequenceNumberAccessConditions.getIfSequenceNumberEqualTo(); } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); + String transactionalContentCrc64Converted = Base64Util.encodeToString(transactionalContentCrc64); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.uploadPages(containerName, blob, this.client.getUrl(), body, contentLength, transactionalContentMD5Converted, timeout, range, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.uploadPages(containerName, blob, this.client.getUrl(), body, contentLength, transactionalContentMD5Converted, transactionalContentCrc64Converted, timeout, range, this.client.getVersion(), requestId, comp, pageWrite, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -346,6 +370,9 @@ public Mono clearPagesWithRestResponseAsync(String final String comp = "page"; final String pageWrite = "clear"; final String leaseId = null; + final String encryptionKey = null; + final String encryptionKeySha256 = null; + final EncryptionAlgorithmType encryptionAlgorithm = null; final Long ifSequenceNumberLessThanOrEqualTo = null; final Long ifSequenceNumberLessThan = null; final Long ifSequenceNumberEqualTo = null; @@ -353,7 +380,7 @@ public Mono clearPagesWithRestResponseAsync(String final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.clearPages(containerName, blob, this.client.getUrl(), contentLength, timeout, range, this.client.getVersion(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.clearPages(containerName, blob, this.client.getUrl(), contentLength, timeout, range, this.client.getVersion(), requestId, comp, pageWrite, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -366,6 +393,7 @@ public Mono clearPagesWithRestResponseAsync(String * @param range Return only the bytes of the blob in the specified range. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param leaseAccessConditions Additional parameters for the operation. + * @param cpkInfo Additional parameters for the operation. * @param sequenceNumberAccessConditions Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. @@ -373,44 +401,56 @@ public Mono clearPagesWithRestResponseAsync(String * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono clearPagesWithRestResponseAsync(String containerName, String blob, long contentLength, Integer timeout, String range, String requestId, LeaseAccessConditions leaseAccessConditions, SequenceNumberAccessConditions sequenceNumberAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono clearPagesWithRestResponseAsync(String containerName, String blob, long contentLength, Integer timeout, String range, String requestId, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, SequenceNumberAccessConditions sequenceNumberAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "page"; final String pageWrite = "clear"; String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); + } + String encryptionKey = null; + if (cpkInfo != null) { + encryptionKey = cpkInfo.getEncryptionKey(); + } + String encryptionKeySha256 = null; + if (cpkInfo != null) { + encryptionKeySha256 = cpkInfo.getEncryptionKeySha256(); + } + EncryptionAlgorithmType encryptionAlgorithm = null; + if (cpkInfo != null) { + encryptionAlgorithm = cpkInfo.getEncryptionAlgorithm(); } Long ifSequenceNumberLessThanOrEqualTo = null; if (sequenceNumberAccessConditions != null) { - ifSequenceNumberLessThanOrEqualTo = sequenceNumberAccessConditions.ifSequenceNumberLessThanOrEqualTo(); + ifSequenceNumberLessThanOrEqualTo = sequenceNumberAccessConditions.getIfSequenceNumberLessThanOrEqualTo(); } Long ifSequenceNumberLessThan = null; if (sequenceNumberAccessConditions != null) { - ifSequenceNumberLessThan = sequenceNumberAccessConditions.ifSequenceNumberLessThan(); + ifSequenceNumberLessThan = sequenceNumberAccessConditions.getIfSequenceNumberLessThan(); } Long ifSequenceNumberEqualTo = null; if (sequenceNumberAccessConditions != null) { - ifSequenceNumberEqualTo = sequenceNumberAccessConditions.ifSequenceNumberEqualTo(); + ifSequenceNumberEqualTo = sequenceNumberAccessConditions.getIfSequenceNumberEqualTo(); } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.clearPages(containerName, blob, this.client.getUrl(), contentLength, timeout, range, this.client.getVersion(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.clearPages(containerName, blob, this.client.getUrl(), contentLength, timeout, range, this.client.getVersion(), requestId, comp, pageWrite, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -432,6 +472,9 @@ public Mono uploadPagesFromURLWithRestRespo final String requestId = null; final String comp = "page"; final String pageWrite = "update"; + final String encryptionKey = null; + final String encryptionKeySha256 = null; + final EncryptionAlgorithmType encryptionAlgorithm = null; final String leaseId = null; final Long ifSequenceNumberLessThanOrEqualTo = null; final Long ifSequenceNumberLessThan = null; @@ -441,11 +484,12 @@ public Mono uploadPagesFromURLWithRestRespo final String sourceIfMatch = null; final String sourceIfNoneMatch = null; String sourceContentMD5Converted = null; + String sourceContentcrc64Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; DateTimeRfc1123 sourceIfModifiedSinceConverted = null; DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null; - return service.uploadPagesFromURL(containerName, blob, this.client.getUrl(), sourceUrl, sourceRange, sourceContentMD5Converted, contentLength, timeout, range, this.client.getVersion(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); + return service.uploadPagesFromURL(containerName, blob, this.client.getUrl(), sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, contentLength, timeout, range, this.client.getVersion(), requestId, comp, pageWrite, encryptionKey, encryptionKeySha256, encryptionAlgorithm, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); } /** @@ -458,8 +502,10 @@ public Mono uploadPagesFromURLWithRestRespo * @param contentLength The length of the request. * @param range The range of bytes to which the source range would be written. The range should be 512 aligned and range-end is required. * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. + * @param sourceContentcrc64 Specify the crc64 calculated for the range of bytes that must be read from the copy source. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param cpkInfo Additional parameters for the operation. * @param leaseAccessConditions Additional parameters for the operation. * @param sequenceNumberAccessConditions Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. @@ -469,63 +515,76 @@ 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, Integer timeout, String requestId, 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; + if (cpkInfo != null) { + encryptionKey = cpkInfo.getEncryptionKey(); + } + String encryptionKeySha256 = null; + if (cpkInfo != null) { + encryptionKeySha256 = cpkInfo.getEncryptionKeySha256(); + } + EncryptionAlgorithmType encryptionAlgorithm = null; + if (cpkInfo != null) { + encryptionAlgorithm = cpkInfo.getEncryptionAlgorithm(); + } String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); } Long ifSequenceNumberLessThanOrEqualTo = null; if (sequenceNumberAccessConditions != null) { - ifSequenceNumberLessThanOrEqualTo = sequenceNumberAccessConditions.ifSequenceNumberLessThanOrEqualTo(); + ifSequenceNumberLessThanOrEqualTo = sequenceNumberAccessConditions.getIfSequenceNumberLessThanOrEqualTo(); } Long ifSequenceNumberLessThan = null; if (sequenceNumberAccessConditions != null) { - ifSequenceNumberLessThan = sequenceNumberAccessConditions.ifSequenceNumberLessThan(); + ifSequenceNumberLessThan = sequenceNumberAccessConditions.getIfSequenceNumberLessThan(); } Long ifSequenceNumberEqualTo = null; if (sequenceNumberAccessConditions != null) { - ifSequenceNumberEqualTo = sequenceNumberAccessConditions.ifSequenceNumberEqualTo(); + ifSequenceNumberEqualTo = sequenceNumberAccessConditions.getIfSequenceNumberEqualTo(); } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } OffsetDateTime sourceIfModifiedSince = null; if (sourceModifiedAccessConditions != null) { - sourceIfModifiedSince = sourceModifiedAccessConditions.sourceIfModifiedSince(); + sourceIfModifiedSince = sourceModifiedAccessConditions.getSourceIfModifiedSince(); } OffsetDateTime sourceIfUnmodifiedSince = null; if (sourceModifiedAccessConditions != null) { - sourceIfUnmodifiedSince = sourceModifiedAccessConditions.sourceIfUnmodifiedSince(); + sourceIfUnmodifiedSince = sourceModifiedAccessConditions.getSourceIfUnmodifiedSince(); } String sourceIfMatch = null; if (sourceModifiedAccessConditions != null) { - sourceIfMatch = sourceModifiedAccessConditions.sourceIfMatch(); + sourceIfMatch = sourceModifiedAccessConditions.getSourceIfMatch(); } String sourceIfNoneMatch = null; if (sourceModifiedAccessConditions != null) { - sourceIfNoneMatch = sourceModifiedAccessConditions.sourceIfNoneMatch(); + sourceIfNoneMatch = sourceModifiedAccessConditions.getSourceIfNoneMatch(); } String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); + String sourceContentcrc64Converted = Base64Util.encodeToString(sourceContentcrc64); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); DateTimeRfc1123 sourceIfModifiedSinceConverted = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - return service.uploadPagesFromURL(containerName, blob, this.client.getUrl(), sourceUrl, sourceRange, sourceContentMD5Converted, contentLength, timeout, range, this.client.getVersion(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); + return service.uploadPagesFromURL(containerName, blob, this.client.getUrl(), sourceUrl, sourceRange, sourceContentMD5Converted, sourceContentcrc64Converted, contentLength, timeout, range, this.client.getVersion(), requestId, comp, pageWrite, encryptionKey, encryptionKeySha256, encryptionAlgorithm, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); } /** @@ -540,7 +599,6 @@ public Mono uploadPagesFromURLWithRestRespo @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPageRangesWithRestResponseAsync(String containerName, String blob, Context context) { final String snapshot = null; - final String versionId = null; final Integer timeout = null; final String range = null; final String requestId = null; @@ -550,7 +608,7 @@ public Mono getPageRangesWithRestResponseAsync(S final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.getPageRanges(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, range, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.getPageRanges(containerName, blob, this.client.getUrl(), snapshot, timeout, range, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -559,7 +617,6 @@ public Mono getPageRangesWithRestResponseAsync(S * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot of a Blob.</a>. - * @param versionId The version ID parameter is an opaque DateTime value that, when present, specifies the blob version to retrieve. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param range Return only the bytes of the blob in the specified range. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. @@ -570,31 +627,31 @@ public Mono getPageRangesWithRestResponseAsync(S * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getPageRangesWithRestResponseAsync(String containerName, String blob, String snapshot, String versionId, Integer timeout, String range, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono getPageRangesWithRestResponseAsync(String containerName, String blob, String snapshot, Integer timeout, String range, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "pagelist"; String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.getPageRanges(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, range, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.getPageRanges(containerName, blob, this.client.getUrl(), snapshot, timeout, range, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -609,7 +666,6 @@ public Mono getPageRangesWithRestResponseAsync(S @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPageRangesDiffWithRestResponseAsync(String containerName, String blob, Context context) { final String snapshot = null; - final String versionId = null; final Integer timeout = null; final String prevsnapshot = null; final String range = null; @@ -620,7 +676,7 @@ public Mono getPageRangesDiffWithRestRespons final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.getPageRangesDiff(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, prevsnapshot, range, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.getPageRangesDiff(containerName, blob, this.client.getUrl(), snapshot, timeout, prevsnapshot, range, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -629,7 +685,6 @@ public Mono getPageRangesDiffWithRestRespons * @param containerName The container name. * @param blob The blob name. * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot of a Blob.</a>. - * @param versionId The version ID parameter is an opaque DateTime value that, when present, specifies the blob version to retrieve. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param prevsnapshot Optional in version 2015-07-08 and newer. The prevsnapshot parameter is a DateTime value that specifies that the response will contain only pages that were changed between target blob and previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. Note that incremental snapshots are currently supported only for blobs created on or after January 1, 2016. * @param range Return only the bytes of the blob in the specified range. @@ -641,31 +696,31 @@ public Mono getPageRangesDiffWithRestRespons * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getPageRangesDiffWithRestResponseAsync(String containerName, String blob, String snapshot, String versionId, Integer timeout, String prevsnapshot, String range, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono getPageRangesDiffWithRestResponseAsync(String containerName, String blob, String snapshot, Integer timeout, String prevsnapshot, String range, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "pagelist"; String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.getPageRangesDiff(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, prevsnapshot, range, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.getPageRangesDiff(containerName, blob, this.client.getUrl(), snapshot, timeout, prevsnapshot, range, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -684,11 +739,14 @@ public Mono resizeWithRestResponseAsync(String containe final String requestId = null; final String comp = "properties"; final String leaseId = null; + final String encryptionKey = null; + final String encryptionKeySha256 = null; + final EncryptionAlgorithmType encryptionAlgorithm = null; final String ifMatch = null; final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.resize(containerName, blob, this.client.getUrl(), timeout, blobContentLength, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.resize(containerName, blob, this.client.getUrl(), timeout, blobContentLength, this.client.getVersion(), requestId, comp, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -700,37 +758,50 @@ public Mono resizeWithRestResponseAsync(String containe * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param leaseAccessConditions Additional parameters for the operation. + * @param cpkInfo Additional parameters for the operation. * @param modifiedAccessConditions Additional parameters for the operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono resizeWithRestResponseAsync(String containerName, String blob, long blobContentLength, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { + public Mono resizeWithRestResponseAsync(String containerName, String blob, long blobContentLength, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, CpkInfo cpkInfo, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "properties"; String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); + } + String encryptionKey = null; + if (cpkInfo != null) { + encryptionKey = cpkInfo.getEncryptionKey(); + } + String encryptionKeySha256 = null; + if (cpkInfo != null) { + encryptionKeySha256 = cpkInfo.getEncryptionKeySha256(); + } + EncryptionAlgorithmType encryptionAlgorithm = null; + if (cpkInfo != null) { + encryptionAlgorithm = cpkInfo.getEncryptionAlgorithm(); } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.resize(containerName, blob, this.client.getUrl(), timeout, blobContentLength, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.resize(containerName, blob, this.client.getUrl(), timeout, blobContentLength, this.client.getVersion(), requestId, comp, leaseId, encryptionKey, encryptionKeySha256, encryptionAlgorithm, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -777,23 +848,23 @@ public Mono updateSequenceNumberWithRestR final String comp = "properties"; String leaseId = null; if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); + leaseId = leaseAccessConditions.getLeaseId(); } OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); @@ -840,19 +911,19 @@ public Mono copyIncrementalWithRestResponseAsy final String comp = "incrementalcopy"; OffsetDateTime ifModifiedSince = null; if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); + ifModifiedSince = modifiedAccessConditions.getIfModifiedSince(); } OffsetDateTime ifUnmodifiedSince = null; if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); + ifUnmodifiedSince = modifiedAccessConditions.getIfUnmodifiedSince(); } String ifMatch = null; if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); + ifMatch = modifiedAccessConditions.getIfMatch(); } String ifNoneMatch = null; if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); + ifNoneMatch = modifiedAccessConditions.getIfNoneMatch(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java index 5d77ec9bcee0..03d78aef8ff4 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java @@ -27,8 +27,11 @@ import com.azure.storage.blob.models.ServicesGetUserDelegationKeyResponse; import com.azure.storage.blob.models.ServicesListContainersSegmentResponse; import com.azure.storage.blob.models.ServicesSetPropertiesResponse; +import com.azure.storage.blob.models.ServicesSubmitBatchResponse; import com.azure.storage.blob.models.StorageErrorException; import com.azure.storage.blob.models.StorageServiceProperties; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; /** @@ -81,7 +84,7 @@ private interface ServicesService { @Get("") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono listContainersSegment(@HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") ListContainersIncludeType include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context); + Mono listContainersSegment(@HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker1, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") ListContainersIncludeType include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context); @Post("") @ExpectedResponses({200}) @@ -92,6 +95,11 @@ private interface ServicesService { @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono getAccountInfo(@HostParam("url") String url, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + + @Post("") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(StorageErrorException.class) + Mono submitBatch(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") Flux body, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-Type") String multipartContentType, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context); } /** @@ -231,7 +239,7 @@ public Mono listContainersSegmentWithRest } /** - * Retrieves a user delgation key for the Blob service. This is only a valid operation when using bearer token authentication. + * Retrieves a user delegation key for the Blob service. This is only a valid operation when using bearer token authentication. * * @param keyInfo the KeyInfo value. * @param context The context to associate with this operation. @@ -248,7 +256,7 @@ public Mono getUserDelegationKeyWithRestRe } /** - * Retrieves a user delgation key for the Blob service. This is only a valid operation when using bearer token authentication. + * Retrieves a user delegation key for the Blob service. This is only a valid operation when using bearer token authentication. * * @param keyInfo the KeyInfo value. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. @@ -277,4 +285,40 @@ public Mono getAccountInfoWithRestResponseAsync( final String comp = "properties"; return service.getAccountInfo(this.client.getUrl(), this.client.getVersion(), restype, comp, context); } + + /** + * The Batch operation allows multiple API calls to be embedded into a single HTTP request. + * + * @param body Initial data. + * @param contentLength The length of the request. + * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. Example header value: multipart/mixed; boundary=batch_<GUID>. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono submitBatchWithRestResponseAsync(Flux body, long contentLength, String multipartContentType, Context context) { + final Integer timeout = null; + final String requestId = null; + final String comp = "batch"; + return service.submitBatch(this.client.getUrl(), body, contentLength, multipartContentType, timeout, this.client.getVersion(), requestId, comp, context); + } + + /** + * The Batch operation allows multiple API calls to be embedded into a single HTTP request. + * + * @param body Initial data. + * @param contentLength The length of the request. + * @param multipartContentType Required. The value of this header must be multipart/mixed with a batch boundary. Example header value: multipart/mixed; boundary=batch_<GUID>. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. + * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @return a Mono which performs the network request upon subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono submitBatchWithRestResponseAsync(Flux body, long contentLength, String multipartContentType, Integer timeout, String requestId, Context context) { + final String comp = "batch"; + return service.submitBatch(this.client.getUrl(), body, contentLength, multipartContentType, timeout, this.client.getVersion(), requestId, comp, context); + } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessPolicy.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessPolicy.java index 04ded069ff53..787264d34ad0 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessPolicy.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessPolicy.java @@ -38,7 +38,7 @@ public final class AccessPolicy { * * @return the start value. */ - public OffsetDateTime start() { + public OffsetDateTime getStart() { return this.start; } @@ -48,7 +48,7 @@ public OffsetDateTime start() { * @param start the start value to set. * @return the AccessPolicy object itself. */ - public AccessPolicy start(OffsetDateTime start) { + public AccessPolicy setStart(OffsetDateTime start) { this.start = start; return this; } @@ -58,7 +58,7 @@ public AccessPolicy start(OffsetDateTime start) { * * @return the expiry value. */ - public OffsetDateTime expiry() { + public OffsetDateTime getExpiry() { return this.expiry; } @@ -68,7 +68,7 @@ public OffsetDateTime expiry() { * @param expiry the expiry value to set. * @return the AccessPolicy object itself. */ - public AccessPolicy expiry(OffsetDateTime expiry) { + public AccessPolicy setExpiry(OffsetDateTime expiry) { this.expiry = expiry; return this; } @@ -78,7 +78,7 @@ public AccessPolicy expiry(OffsetDateTime expiry) { * * @return the permission value. */ - public String permission() { + public String getPermission() { return this.permission; } @@ -88,7 +88,7 @@ public String permission() { * @param permission the permission value to set. * @return the AccessPolicy object itself. */ - public AccessPolicy permission(String permission) { + public AccessPolicy setPermission(String permission) { this.permission = permission; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessTier.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessTier.java index d916bd851ce4..fafe6d2eb7ef 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessTier.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessTier.java @@ -27,6 +27,11 @@ public final class AccessTier extends ExpandableStringEnum { */ public static final AccessTier P10 = fromString("P10"); + /** + * Static value P15 for AccessTier. + */ + public static final AccessTier P15 = fromString("P15"); + /** * Static value P20 for AccessTier. */ @@ -47,6 +52,21 @@ public final class AccessTier extends ExpandableStringEnum { */ public static final AccessTier P50 = fromString("P50"); + /** + * Static value P60 for AccessTier. + */ + public static final AccessTier P60 = fromString("P60"); + + /** + * Static value P70 for AccessTier. + */ + public static final AccessTier P70 = fromString("P70"); + + /** + * Static value P80 for AccessTier. + */ + public static final AccessTier P80 = fromString("P80"); + /** * Static value Hot for AccessTier. */ diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessTierOptional.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessTierOptional.java new file mode 100644 index 000000000000..ce8e818b1d48 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessTierOptional.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Defines values for AccessTierOptional. + */ +public final class AccessTierOptional extends ExpandableStringEnum { + /** + * Static value P4 for AccessTierOptional. + */ + public static final AccessTierOptional P4 = fromString("P4"); + + /** + * Static value P6 for AccessTierOptional. + */ + public static final AccessTierOptional P6 = fromString("P6"); + + /** + * Static value P10 for AccessTierOptional. + */ + public static final AccessTierOptional P10 = fromString("P10"); + + /** + * Static value P15 for AccessTierOptional. + */ + public static final AccessTierOptional P15 = fromString("P15"); + + /** + * Static value P20 for AccessTierOptional. + */ + public static final AccessTierOptional P20 = fromString("P20"); + + /** + * Static value P30 for AccessTierOptional. + */ + public static final AccessTierOptional P30 = fromString("P30"); + + /** + * Static value P40 for AccessTierOptional. + */ + public static final AccessTierOptional P40 = fromString("P40"); + + /** + * Static value P50 for AccessTierOptional. + */ + public static final AccessTierOptional P50 = fromString("P50"); + + /** + * Static value P60 for AccessTierOptional. + */ + public static final AccessTierOptional P60 = fromString("P60"); + + /** + * Static value P70 for AccessTierOptional. + */ + public static final AccessTierOptional P70 = fromString("P70"); + + /** + * Static value P80 for AccessTierOptional. + */ + public static final AccessTierOptional P80 = fromString("P80"); + + /** + * Static value Hot for AccessTierOptional. + */ + public static final AccessTierOptional HOT = fromString("Hot"); + + /** + * Static value Cool for AccessTierOptional. + */ + public static final AccessTierOptional COOL = fromString("Cool"); + + /** + * Static value Archive for AccessTierOptional. + */ + public static final AccessTierOptional ARCHIVE = fromString("Archive"); + + /** + * Creates or finds a AccessTierOptional from its string representation. + * + * @param name a name to look for. + * @return the corresponding AccessTierOptional. + */ + @JsonCreator + public static AccessTierOptional fromString(String name) { + return fromString(name, AccessTierOptional.class); + } + + /** + * @return known AccessTierOptional values. + */ + public static Collection values() { + return values(AccessTierOptional.class); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessTierRequired.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessTierRequired.java new file mode 100644 index 000000000000..82401f54ff9e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessTierRequired.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Defines values for AccessTierRequired. + */ +public final class AccessTierRequired extends ExpandableStringEnum { + /** + * Static value P4 for AccessTierRequired. + */ + public static final AccessTierRequired P4 = fromString("P4"); + + /** + * Static value P6 for AccessTierRequired. + */ + public static final AccessTierRequired P6 = fromString("P6"); + + /** + * Static value P10 for AccessTierRequired. + */ + public static final AccessTierRequired P10 = fromString("P10"); + + /** + * Static value P15 for AccessTierRequired. + */ + public static final AccessTierRequired P15 = fromString("P15"); + + /** + * Static value P20 for AccessTierRequired. + */ + public static final AccessTierRequired P20 = fromString("P20"); + + /** + * Static value P30 for AccessTierRequired. + */ + public static final AccessTierRequired P30 = fromString("P30"); + + /** + * Static value P40 for AccessTierRequired. + */ + public static final AccessTierRequired P40 = fromString("P40"); + + /** + * Static value P50 for AccessTierRequired. + */ + public static final AccessTierRequired P50 = fromString("P50"); + + /** + * Static value P60 for AccessTierRequired. + */ + public static final AccessTierRequired P60 = fromString("P60"); + + /** + * Static value P70 for AccessTierRequired. + */ + public static final AccessTierRequired P70 = fromString("P70"); + + /** + * Static value P80 for AccessTierRequired. + */ + public static final AccessTierRequired P80 = fromString("P80"); + + /** + * Static value Hot for AccessTierRequired. + */ + public static final AccessTierRequired HOT = fromString("Hot"); + + /** + * Static value Cool for AccessTierRequired. + */ + public static final AccessTierRequired COOL = fromString("Cool"); + + /** + * Static value Archive for AccessTierRequired. + */ + public static final AccessTierRequired ARCHIVE = fromString("Archive"); + + /** + * Creates or finds a AccessTierRequired from its string representation. + * + * @param name a name to look for. + * @return the corresponding AccessTierRequired. + */ + @JsonCreator + public static AccessTierRequired fromString(String name) { + return fromString(name, AccessTierRequired.class); + } + + /** + * @return known AccessTierRequired values. + */ + public static Collection values() { + return values(AccessTierRequired.class); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAccessConditions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAccessConditions.java index 6bba05f391dc..292d6ffb9dbc 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAccessConditions.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAccessConditions.java @@ -34,7 +34,7 @@ public AppendBlobAccessConditions() { * * @return the append position access conditions */ - public AppendPositionAccessConditions appendPositionAccessConditions() { + public AppendPositionAccessConditions getAppendPositionAccessConditions() { return appendPositionAccessConditions; } @@ -45,7 +45,7 @@ public AppendPositionAccessConditions appendPositionAccessConditions() { * @param appendPositionAccessConditions the append position access conditions to set * @return the updated AppendBlobAccessConditions object */ - public AppendBlobAccessConditions appendPositionAccessConditions(AppendPositionAccessConditions appendPositionAccessConditions) { + public AppendBlobAccessConditions setAppendPositionAccessConditions(AppendPositionAccessConditions appendPositionAccessConditions) { this.appendPositionAccessConditions = appendPositionAccessConditions; return this; } @@ -57,7 +57,7 @@ public AppendBlobAccessConditions appendPositionAccessConditions(AppendPositionA * * @return the modified access conditions */ - public ModifiedAccessConditions modifiedAccessConditions() { + public ModifiedAccessConditions getModifiedAccessConditions() { return modifiedAccessConditions; } @@ -69,7 +69,7 @@ public ModifiedAccessConditions modifiedAccessConditions() { * @param modifiedAccessConditions the modified access conditions to set * @return the updated AppendBlobAccessConditions object */ - public AppendBlobAccessConditions modifiedAccessConditions(ModifiedAccessConditions modifiedAccessConditions) { + public AppendBlobAccessConditions setModifiedAccessConditions(ModifiedAccessConditions modifiedAccessConditions) { this.modifiedAccessConditions = modifiedAccessConditions; return this; } @@ -80,7 +80,7 @@ public AppendBlobAccessConditions modifiedAccessConditions(ModifiedAccessConditi * * @return the lease access conditions */ - public LeaseAccessConditions leaseAccessConditions() { + public LeaseAccessConditions getLeaseAccessConditions() { return leaseAccessConditions; } @@ -91,7 +91,7 @@ public LeaseAccessConditions leaseAccessConditions() { * @param leaseAccessConditions the lease access conditions to set * @return the updated AppendBlobAccessConditions object */ - public AppendBlobAccessConditions leaseAccessConditions(LeaseAccessConditions leaseAccessConditions) { + public AppendBlobAccessConditions setLeaseAccessConditions(LeaseAccessConditions leaseAccessConditions) { this.leaseAccessConditions = leaseAccessConditions; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockFromUrlHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockFromUrlHeaders.java index 8dcea49cd76c..78e08cf7c4ba 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockFromUrlHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockFromUrlHeaders.java @@ -41,6 +41,14 @@ public final class AppendBlobAppendBlockFromUrlHeaders { @JsonProperty(value = "Content-MD5") private byte[] contentMD5; + /* + * This header is returned so that the client can check for message content + * integrity. The value of this header is computed by the Blob service; it + * is not necessarily the same value specified in the request headers. + */ + @JsonProperty(value = "x-ms-content-crc64") + private byte[] xMsContentCrc64; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -77,6 +85,14 @@ public final class AppendBlobAppendBlockFromUrlHeaders { @JsonProperty(value = "x-ms-blob-committed-block-count") private Integer blobCommittedBlockCount; + /* + * The SHA-256 hash of the encryption key used to encrypt the block. This + * header is only returned when the block was encrypted with a + * customer-provided key. + */ + @JsonProperty(value = "x-ms-encryption-key-sha256") + private String encryptionKeySha256; + /* * The errorCode property. */ @@ -90,7 +106,7 @@ public final class AppendBlobAppendBlockFromUrlHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -102,7 +118,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the AppendBlobAppendBlockFromUrlHeaders object itself. */ - public AppendBlobAppendBlockFromUrlHeaders eTag(String eTag) { + public AppendBlobAppendBlockFromUrlHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -115,11 +131,11 @@ public AppendBlobAppendBlockFromUrlHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -131,7 +147,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the AppendBlobAppendBlockFromUrlHeaders object itself. */ - public AppendBlobAppendBlockFromUrlHeaders lastModified(OffsetDateTime lastModified) { + public AppendBlobAppendBlockFromUrlHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -147,7 +163,7 @@ public AppendBlobAppendBlockFromUrlHeaders lastModified(OffsetDateTime lastModif * * @return the contentMD5 value. */ - public byte[] contentMD5() { + public byte[] getContentMD5() { return ImplUtils.clone(this.contentMD5); } @@ -159,18 +175,44 @@ public byte[] contentMD5() { * @param contentMD5 the contentMD5 value to set. * @return the AppendBlobAppendBlockFromUrlHeaders object itself. */ - public AppendBlobAppendBlockFromUrlHeaders contentMD5(byte[] contentMD5) { + public AppendBlobAppendBlockFromUrlHeaders setContentMD5(byte[] contentMD5) { this.contentMD5 = ImplUtils.clone(contentMD5); return this; } + /** + * Get the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @return the xMsContentCrc64 value. + */ + public byte[] getXMsContentCrc64() { + return ImplUtils.clone(this.xMsContentCrc64); + } + + /** + * Set the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the AppendBlobAppendBlockFromUrlHeaders object itself. + */ + public AppendBlobAppendBlockFromUrlHeaders setXMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = ImplUtils.clone(xMsContentCrc64); + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -181,7 +223,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the AppendBlobAppendBlockFromUrlHeaders object itself. */ - public AppendBlobAppendBlockFromUrlHeaders requestId(String requestId) { + public AppendBlobAppendBlockFromUrlHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -193,7 +235,7 @@ public AppendBlobAppendBlockFromUrlHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -205,7 +247,7 @@ public String version() { * @param version the version value to set. * @return the AppendBlobAppendBlockFromUrlHeaders object itself. */ - public AppendBlobAppendBlockFromUrlHeaders version(String version) { + public AppendBlobAppendBlockFromUrlHeaders setVersion(String version) { this.version = version; return this; } @@ -216,11 +258,11 @@ public AppendBlobAppendBlockFromUrlHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -230,7 +272,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the AppendBlobAppendBlockFromUrlHeaders object itself. */ - public AppendBlobAppendBlockFromUrlHeaders dateProperty(OffsetDateTime dateProperty) { + public AppendBlobAppendBlockFromUrlHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -246,7 +288,7 @@ public AppendBlobAppendBlockFromUrlHeaders dateProperty(OffsetDateTime datePrope * * @return the blobAppendOffset value. */ - public String blobAppendOffset() { + public String getBlobAppendOffset() { return this.blobAppendOffset; } @@ -258,7 +300,7 @@ public String blobAppendOffset() { * @param blobAppendOffset the blobAppendOffset value to set. * @return the AppendBlobAppendBlockFromUrlHeaders object itself. */ - public AppendBlobAppendBlockFromUrlHeaders blobAppendOffset(String blobAppendOffset) { + public AppendBlobAppendBlockFromUrlHeaders setBlobAppendOffset(String blobAppendOffset) { this.blobAppendOffset = blobAppendOffset; return this; } @@ -269,7 +311,7 @@ public AppendBlobAppendBlockFromUrlHeaders blobAppendOffset(String blobAppendOff * * @return the blobCommittedBlockCount value. */ - public Integer blobCommittedBlockCount() { + public Integer getBlobCommittedBlockCount() { return this.blobCommittedBlockCount; } @@ -280,17 +322,41 @@ public Integer blobCommittedBlockCount() { * @param blobCommittedBlockCount the blobCommittedBlockCount value to set. * @return the AppendBlobAppendBlockFromUrlHeaders object itself. */ - public AppendBlobAppendBlockFromUrlHeaders blobCommittedBlockCount(Integer blobCommittedBlockCount) { + public AppendBlobAppendBlockFromUrlHeaders setBlobCommittedBlockCount(Integer blobCommittedBlockCount) { this.blobCommittedBlockCount = blobCommittedBlockCount; return this; } + /** + * Get the encryptionKeySha256 property: The SHA-256 hash of the encryption + * key used to encrypt the block. This header is only returned when the + * block was encrypted with a customer-provided key. + * + * @return the encryptionKeySha256 value. + */ + public String getEncryptionKeySha256() { + return this.encryptionKeySha256; + } + + /** + * Set the encryptionKeySha256 property: The SHA-256 hash of the encryption + * key used to encrypt the block. This header is only returned when the + * block was encrypted with a customer-provided key. + * + * @param encryptionKeySha256 the encryptionKeySha256 value to set. + * @return the AppendBlobAppendBlockFromUrlHeaders object itself. + */ + public AppendBlobAppendBlockFromUrlHeaders setEncryptionKeySha256(String encryptionKeySha256) { + this.encryptionKeySha256 = encryptionKeySha256; + return this; + } + /** * Get the errorCode property: The errorCode property. * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -300,7 +366,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the AppendBlobAppendBlockFromUrlHeaders object itself. */ - public AppendBlobAppendBlockFromUrlHeaders errorCode(String errorCode) { + public AppendBlobAppendBlockFromUrlHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockHeaders.java index a12cefa924e6..c2ca7320cb13 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockHeaders.java @@ -41,6 +41,21 @@ public final class AppendBlobAppendBlockHeaders { @JsonProperty(value = "Content-MD5") private byte[] contentMD5; + /* + * This header is returned so that the client can check for message content + * integrity. The value of this header is computed by the Blob service; it + * is not necessarily the same value specified in the request headers. + */ + @JsonProperty(value = "x-ms-content-crc64") + private byte[] xMsContentCrc64; + + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -106,7 +121,7 @@ public final class AppendBlobAppendBlockHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -118,7 +133,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the AppendBlobAppendBlockHeaders object itself. */ - public AppendBlobAppendBlockHeaders eTag(String eTag) { + public AppendBlobAppendBlockHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -131,11 +146,11 @@ public AppendBlobAppendBlockHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -147,7 +162,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the AppendBlobAppendBlockHeaders object itself. */ - public AppendBlobAppendBlockHeaders lastModified(OffsetDateTime lastModified) { + public AppendBlobAppendBlockHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -163,7 +178,7 @@ public AppendBlobAppendBlockHeaders lastModified(OffsetDateTime lastModified) { * * @return the contentMD5 value. */ - public byte[] contentMD5() { + public byte[] getContentMD5() { return ImplUtils.clone(this.contentMD5); } @@ -175,18 +190,68 @@ public byte[] contentMD5() { * @param contentMD5 the contentMD5 value to set. * @return the AppendBlobAppendBlockHeaders object itself. */ - public AppendBlobAppendBlockHeaders contentMD5(byte[] contentMD5) { + public AppendBlobAppendBlockHeaders setContentMD5(byte[] contentMD5) { this.contentMD5 = ImplUtils.clone(contentMD5); return this; } + /** + * Get the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @return the xMsContentCrc64 value. + */ + public byte[] getXMsContentCrc64() { + return ImplUtils.clone(this.xMsContentCrc64); + } + + /** + * Set the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the AppendBlobAppendBlockHeaders object itself. + */ + public AppendBlobAppendBlockHeaders setXMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = ImplUtils.clone(xMsContentCrc64); + return this; + } + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the AppendBlobAppendBlockHeaders object itself. + */ + public AppendBlobAppendBlockHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -197,7 +262,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the AppendBlobAppendBlockHeaders object itself. */ - public AppendBlobAppendBlockHeaders requestId(String requestId) { + public AppendBlobAppendBlockHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -209,7 +274,7 @@ public AppendBlobAppendBlockHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -221,7 +286,7 @@ public String version() { * @param version the version value to set. * @return the AppendBlobAppendBlockHeaders object itself. */ - public AppendBlobAppendBlockHeaders version(String version) { + public AppendBlobAppendBlockHeaders setVersion(String version) { this.version = version; return this; } @@ -232,11 +297,11 @@ public AppendBlobAppendBlockHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -246,7 +311,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the AppendBlobAppendBlockHeaders object itself. */ - public AppendBlobAppendBlockHeaders dateProperty(OffsetDateTime dateProperty) { + public AppendBlobAppendBlockHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -262,7 +327,7 @@ public AppendBlobAppendBlockHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the blobAppendOffset value. */ - public String blobAppendOffset() { + public String getBlobAppendOffset() { return this.blobAppendOffset; } @@ -274,7 +339,7 @@ public String blobAppendOffset() { * @param blobAppendOffset the blobAppendOffset value to set. * @return the AppendBlobAppendBlockHeaders object itself. */ - public AppendBlobAppendBlockHeaders blobAppendOffset(String blobAppendOffset) { + public AppendBlobAppendBlockHeaders setBlobAppendOffset(String blobAppendOffset) { this.blobAppendOffset = blobAppendOffset; return this; } @@ -285,7 +350,7 @@ public AppendBlobAppendBlockHeaders blobAppendOffset(String blobAppendOffset) { * * @return the blobCommittedBlockCount value. */ - public Integer blobCommittedBlockCount() { + public Integer getBlobCommittedBlockCount() { return this.blobCommittedBlockCount; } @@ -296,7 +361,7 @@ public Integer blobCommittedBlockCount() { * @param blobCommittedBlockCount the blobCommittedBlockCount value to set. * @return the AppendBlobAppendBlockHeaders object itself. */ - public AppendBlobAppendBlockHeaders blobCommittedBlockCount(Integer blobCommittedBlockCount) { + public AppendBlobAppendBlockHeaders setBlobCommittedBlockCount(Integer blobCommittedBlockCount) { this.blobCommittedBlockCount = blobCommittedBlockCount; return this; } @@ -320,7 +385,7 @@ public Boolean isServerEncrypted() { * @param isServerEncrypted the isServerEncrypted value to set. * @return the AppendBlobAppendBlockHeaders object itself. */ - public AppendBlobAppendBlockHeaders isServerEncrypted(Boolean isServerEncrypted) { + public AppendBlobAppendBlockHeaders setIsServerEncrypted(Boolean isServerEncrypted) { this.isServerEncrypted = isServerEncrypted; return this; } @@ -332,7 +397,7 @@ public AppendBlobAppendBlockHeaders isServerEncrypted(Boolean isServerEncrypted) * * @return the encryptionKeySha256 value. */ - public String encryptionKeySha256() { + public String getEncryptionKeySha256() { return this.encryptionKeySha256; } @@ -344,7 +409,7 @@ public String encryptionKeySha256() { * @param encryptionKeySha256 the encryptionKeySha256 value to set. * @return the AppendBlobAppendBlockHeaders object itself. */ - public AppendBlobAppendBlockHeaders encryptionKeySha256(String encryptionKeySha256) { + public AppendBlobAppendBlockHeaders setEncryptionKeySha256(String encryptionKeySha256) { this.encryptionKeySha256 = encryptionKeySha256; return this; } @@ -354,7 +419,7 @@ public AppendBlobAppendBlockHeaders encryptionKeySha256(String encryptionKeySha2 * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -364,7 +429,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the AppendBlobAppendBlockHeaders object itself. */ - public AppendBlobAppendBlockHeaders errorCode(String errorCode) { + public AppendBlobAppendBlockHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobCreateHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobCreateHeaders.java index c2e5a3e0929e..49042d9f0be9 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobCreateHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobCreateHeaders.java @@ -41,6 +41,13 @@ public final class AppendBlobCreateHeaders { @JsonProperty(value = "Content-MD5") private byte[] contentMD5; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -56,14 +63,6 @@ public final class AppendBlobCreateHeaders { @JsonProperty(value = "x-ms-version") private String version; - /* - * UTC date/time value generated by the service that identifies a version - * of the blob. This header is returned for requests made against version - * 2018-11-09 and above. - */ - @JsonProperty(value = "x-ms-version-id") - private String versionId; - /* * UTC date/time value generated by the service that indicates the time at * which the response was initiated @@ -100,7 +99,7 @@ public final class AppendBlobCreateHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -112,7 +111,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the AppendBlobCreateHeaders object itself. */ - public AppendBlobCreateHeaders eTag(String eTag) { + public AppendBlobCreateHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -125,11 +124,11 @@ public AppendBlobCreateHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -141,7 +140,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the AppendBlobCreateHeaders object itself. */ - public AppendBlobCreateHeaders lastModified(OffsetDateTime lastModified) { + public AppendBlobCreateHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -157,7 +156,7 @@ public AppendBlobCreateHeaders lastModified(OffsetDateTime lastModified) { * * @return the contentMD5 value. */ - public byte[] contentMD5() { + public byte[] getContentMD5() { return ImplUtils.clone(this.contentMD5); } @@ -169,18 +168,42 @@ public byte[] contentMD5() { * @param contentMD5 the contentMD5 value to set. * @return the AppendBlobCreateHeaders object itself. */ - public AppendBlobCreateHeaders contentMD5(byte[] contentMD5) { + public AppendBlobCreateHeaders setContentMD5(byte[] contentMD5) { this.contentMD5 = ImplUtils.clone(contentMD5); return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the AppendBlobCreateHeaders object itself. + */ + public AppendBlobCreateHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -191,7 +214,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the AppendBlobCreateHeaders object itself. */ - public AppendBlobCreateHeaders requestId(String requestId) { + public AppendBlobCreateHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -203,7 +226,7 @@ public AppendBlobCreateHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -215,46 +238,22 @@ public String version() { * @param version the version value to set. * @return the AppendBlobCreateHeaders object itself. */ - public AppendBlobCreateHeaders version(String version) { + public AppendBlobCreateHeaders setVersion(String version) { this.version = version; return this; } - /** - * Get the versionId property: UTC date/time value generated by the service - * that identifies a version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @return the versionId value. - */ - public String versionId() { - return this.versionId; - } - - /** - * Set the versionId property: UTC date/time value generated by the service - * that identifies a version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @param versionId the versionId value to set. - * @return the AppendBlobCreateHeaders object itself. - */ - public AppendBlobCreateHeaders versionId(String versionId) { - this.versionId = versionId; - return this; - } - /** * Get the dateProperty property: UTC date/time value generated by the * service that indicates the time at which the response was initiated. * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -264,7 +263,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the AppendBlobCreateHeaders object itself. */ - public AppendBlobCreateHeaders dateProperty(OffsetDateTime dateProperty) { + public AppendBlobCreateHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -292,7 +291,7 @@ public Boolean isServerEncrypted() { * @param isServerEncrypted the isServerEncrypted value to set. * @return the AppendBlobCreateHeaders object itself. */ - public AppendBlobCreateHeaders isServerEncrypted(Boolean isServerEncrypted) { + public AppendBlobCreateHeaders setIsServerEncrypted(Boolean isServerEncrypted) { this.isServerEncrypted = isServerEncrypted; return this; } @@ -304,7 +303,7 @@ public AppendBlobCreateHeaders isServerEncrypted(Boolean isServerEncrypted) { * * @return the encryptionKeySha256 value. */ - public String encryptionKeySha256() { + public String getEncryptionKeySha256() { return this.encryptionKeySha256; } @@ -316,7 +315,7 @@ public String encryptionKeySha256() { * @param encryptionKeySha256 the encryptionKeySha256 value to set. * @return the AppendBlobCreateHeaders object itself. */ - public AppendBlobCreateHeaders encryptionKeySha256(String encryptionKeySha256) { + public AppendBlobCreateHeaders setEncryptionKeySha256(String encryptionKeySha256) { this.encryptionKeySha256 = encryptionKeySha256; return this; } @@ -326,7 +325,7 @@ public AppendBlobCreateHeaders encryptionKeySha256(String encryptionKeySha256) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -336,7 +335,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the AppendBlobCreateHeaders object itself. */ - public AppendBlobCreateHeaders errorCode(String errorCode) { + public AppendBlobCreateHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobItem.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobItem.java index ef1774048e7f..084813348c2e 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobItem.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobItem.java @@ -1,67 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + package com.azure.storage.blob.models; import com.azure.core.implementation.util.ImplUtils; import java.time.OffsetDateTime; +/** + * This class contains the properties about an append blob. + */ public class AppendBlobItem { - - private OffsetDateTime lastModified; - + private final String eTag; + private final OffsetDateTime lastModified; private final byte[] contentMD5; - - private Boolean isServerEncrypted; - - private String encryptionKeySha256; - - private String blobAppendOffset; - - private Integer blobCommittedBlockCount; + private final boolean isServerEncrypted; + private final String encryptionKeySha256; + private final String blobAppendOffset; + private final Integer blobCommittedBlockCount; public AppendBlobItem(AppendBlobCreateHeaders generatedHeaders) { - this.lastModified = generatedHeaders.lastModified(); - this.contentMD5 = generatedHeaders.contentMD5(); + this.eTag = generatedHeaders.getETag(); + this.lastModified = generatedHeaders.getLastModified(); + this.contentMD5 = generatedHeaders.getContentMD5(); this.isServerEncrypted = generatedHeaders.isServerEncrypted(); - this.encryptionKeySha256 = generatedHeaders.encryptionKeySha256(); + this.encryptionKeySha256 = generatedHeaders.getEncryptionKeySha256(); + this.blobAppendOffset = null; + this.blobCommittedBlockCount = null; } public AppendBlobItem(AppendBlobAppendBlockHeaders generatedHeaders) { - this.lastModified = generatedHeaders.lastModified(); - this.contentMD5 = generatedHeaders.contentMD5(); + this.eTag = generatedHeaders.getETag(); + this.lastModified = generatedHeaders.getLastModified(); + this.contentMD5 = generatedHeaders.getContentMD5(); this.isServerEncrypted = generatedHeaders.isServerEncrypted(); - this.encryptionKeySha256 = generatedHeaders.encryptionKeySha256(); - this.blobAppendOffset = generatedHeaders.blobAppendOffset(); - this.blobCommittedBlockCount = generatedHeaders.blobCommittedBlockCount(); + this.encryptionKeySha256 = generatedHeaders.getEncryptionKeySha256(); + this.blobAppendOffset = generatedHeaders.getBlobAppendOffset(); + this.blobCommittedBlockCount = generatedHeaders.getBlobCommittedBlockCount(); } - public AppendBlobItem(AppendBlobAppendBlockFromUrlHeaders generatedHeaders) { - this.lastModified = generatedHeaders.lastModified(); - this.contentMD5 = generatedHeaders.contentMD5(); - this.blobAppendOffset = generatedHeaders.blobAppendOffset(); - this.blobCommittedBlockCount = generatedHeaders.blobCommittedBlockCount(); + public AppendBlobItem(AppendBlobAppendBlockFromUrlHeaders generatedHeaders, String isServerEncryptedHeader) { + this.eTag = generatedHeaders.getETag(); + this.lastModified = generatedHeaders.getLastModified(); + this.contentMD5 = generatedHeaders.getContentMD5(); + this.isServerEncrypted = Boolean.parseBoolean(isServerEncryptedHeader); + this.encryptionKeySha256 = generatedHeaders.getEncryptionKeySha256(); + this.blobAppendOffset = generatedHeaders.getBlobAppendOffset(); + this.blobCommittedBlockCount = generatedHeaders.getBlobCommittedBlockCount(); } - public OffsetDateTime lastModified() { + /** + * @return the eTag of the append blob + */ + public String getETag() { + return eTag; + } + + /** + * @return the time this append blob was last modified + */ + public OffsetDateTime getLastModified() { return lastModified; }; - public Boolean isServerEncrypted() { + /** + * @return the encryption status of the append blob on the server + */ + public boolean isServerEncrypted() { return isServerEncrypted; } - public String encryptionKeySha256() { + /** + * @return the key that was used to encrypt the append blob + */ + public String getEncryptionKeySha256() { return encryptionKeySha256; } - public byte[] contentMD5() { + /** + * @return the calculated MD5 of the append blob + */ + public byte[] getContentMD5() { return ImplUtils.clone(contentMD5); } - public String blobAppendOffset() { + /** + * @return the offset of the append blob + */ + public String getBlobAppendOffset() { return blobAppendOffset; - }; + } - public Integer blobCommittedBlockCount() { + /** + * @return the number of committed blocks in the append blob + */ + public Integer getBlobCommittedBlockCount() { return blobCommittedBlockCount; - }; + } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendPositionAccessConditions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendPositionAccessConditions.java index e63fabf516af..8ba5bf3994ca 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendPositionAccessConditions.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendPositionAccessConditions.java @@ -46,7 +46,7 @@ public final class AppendPositionAccessConditions { * * @return the maxSize value. */ - public Long maxSize() { + public Long getMaxSize() { return this.maxSize; } @@ -61,7 +61,7 @@ public Long maxSize() { * @param maxSize the maxSize value to set. * @return the AppendPositionAccessConditions object itself. */ - public AppendPositionAccessConditions maxSize(Long maxSize) { + public AppendPositionAccessConditions setMaxSize(Long maxSize) { this.maxSize = maxSize; return this; } @@ -76,7 +76,7 @@ public AppendPositionAccessConditions maxSize(Long maxSize) { * * @return the appendPosition value. */ - public Long appendPosition() { + public Long getAppendPosition() { return this.appendPosition; } @@ -91,7 +91,7 @@ public Long appendPosition() { * @param appendPosition the appendPosition value to set. * @return the AppendPositionAccessConditions object itself. */ - public AppendPositionAccessConditions appendPosition(Long appendPosition) { + public AppendPositionAccessConditions setAppendPosition(Long appendPosition) { this.appendPosition = appendPosition; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobAbortCopyFromURLHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobAbortCopyFromURLHeaders.java index c27f9fcac790..ea81dfb2c2ee 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobAbortCopyFromURLHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobAbortCopyFromURLHeaders.java @@ -16,6 +16,13 @@ @JacksonXmlRootElement(localName = "Blob-AbortCopyFromURL-Headers") @Fluent 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. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -44,13 +51,37 @@ public final class BlobAbortCopyFromURLHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobAbortCopyFromURLHeaders object itself. + */ + public BlobAbortCopyFromURLHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -61,7 +92,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the BlobAbortCopyFromURLHeaders object itself. */ - public BlobAbortCopyFromURLHeaders requestId(String requestId) { + public BlobAbortCopyFromURLHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -73,7 +104,7 @@ public BlobAbortCopyFromURLHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -85,7 +116,7 @@ public String version() { * @param version the version value to set. * @return the BlobAbortCopyFromURLHeaders object itself. */ - public BlobAbortCopyFromURLHeaders version(String version) { + public BlobAbortCopyFromURLHeaders setVersion(String version) { this.version = version; return this; } @@ -96,11 +127,11 @@ public BlobAbortCopyFromURLHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -110,7 +141,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlobAbortCopyFromURLHeaders object itself. */ - public BlobAbortCopyFromURLHeaders dateProperty(OffsetDateTime dateProperty) { + public BlobAbortCopyFromURLHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -124,7 +155,7 @@ public BlobAbortCopyFromURLHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -134,7 +165,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the BlobAbortCopyFromURLHeaders object itself. */ - public BlobAbortCopyFromURLHeaders errorCode(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/models/BlobAccessConditions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobAccessConditions.java index 5ef80e82ca4d..ef002660ee0a 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobAccessConditions.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobAccessConditions.java @@ -30,7 +30,7 @@ public BlobAccessConditions() { * * @return the modified access conditions */ - public ModifiedAccessConditions modifiedAccessConditions() { + public ModifiedAccessConditions getModifiedAccessConditions() { return modifiedAccessConditions; } @@ -42,7 +42,7 @@ public ModifiedAccessConditions modifiedAccessConditions() { * @param modifiedAccessConditions the modified access conditions to set * @return the updated BlobAccessConditions object */ - public BlobAccessConditions modifiedAccessConditions(ModifiedAccessConditions modifiedAccessConditions) { + public BlobAccessConditions setModifiedAccessConditions(ModifiedAccessConditions modifiedAccessConditions) { this.modifiedAccessConditions = modifiedAccessConditions; return this; } @@ -53,7 +53,7 @@ public BlobAccessConditions modifiedAccessConditions(ModifiedAccessConditions mo * * @return the lease access conditions */ - public LeaseAccessConditions leaseAccessConditions() { + public LeaseAccessConditions getLeaseAccessConditions() { return leaseAccessConditions; } @@ -64,7 +64,7 @@ public LeaseAccessConditions leaseAccessConditions() { * @param leaseAccessConditions the lease access conditions to set * @return the updated BlobAccessConditions object */ - public BlobAccessConditions leaseAccessConditions(LeaseAccessConditions leaseAccessConditions) { + public BlobAccessConditions setLeaseAccessConditions(LeaseAccessConditions leaseAccessConditions) { this.leaseAccessConditions = leaseAccessConditions; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobAcquireLeaseHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobAcquireLeaseHeaders.java index d4649062bc60..3d930adc5f34 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobAcquireLeaseHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobAcquireLeaseHeaders.java @@ -38,6 +38,13 @@ public final class BlobAcquireLeaseHeaders { @JsonProperty(value = "x-ms-lease-id") private String leaseId; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -73,7 +80,7 @@ public final class BlobAcquireLeaseHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -85,7 +92,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the BlobAcquireLeaseHeaders object itself. */ - public BlobAcquireLeaseHeaders eTag(String eTag) { + public BlobAcquireLeaseHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -98,11 +105,11 @@ public BlobAcquireLeaseHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -114,7 +121,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the BlobAcquireLeaseHeaders object itself. */ - public BlobAcquireLeaseHeaders lastModified(OffsetDateTime lastModified) { + public BlobAcquireLeaseHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -128,7 +135,7 @@ public BlobAcquireLeaseHeaders lastModified(OffsetDateTime lastModified) { * * @return the leaseId value. */ - public String leaseId() { + public String getLeaseId() { return this.leaseId; } @@ -138,18 +145,42 @@ public String leaseId() { * @param leaseId the leaseId value to set. * @return the BlobAcquireLeaseHeaders object itself. */ - public BlobAcquireLeaseHeaders leaseId(String leaseId) { + public BlobAcquireLeaseHeaders setLeaseId(String leaseId) { this.leaseId = leaseId; return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobAcquireLeaseHeaders object itself. + */ + public BlobAcquireLeaseHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -160,7 +191,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the BlobAcquireLeaseHeaders object itself. */ - public BlobAcquireLeaseHeaders requestId(String requestId) { + public BlobAcquireLeaseHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -172,7 +203,7 @@ public BlobAcquireLeaseHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -184,7 +215,7 @@ public String version() { * @param version the version value to set. * @return the BlobAcquireLeaseHeaders object itself. */ - public BlobAcquireLeaseHeaders version(String version) { + public BlobAcquireLeaseHeaders setVersion(String version) { this.version = version; return this; } @@ -195,11 +226,11 @@ public BlobAcquireLeaseHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -209,7 +240,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlobAcquireLeaseHeaders object itself. */ - public BlobAcquireLeaseHeaders dateProperty(OffsetDateTime dateProperty) { + public BlobAcquireLeaseHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -223,7 +254,7 @@ public BlobAcquireLeaseHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -233,7 +264,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the BlobAcquireLeaseHeaders object itself. */ - public BlobAcquireLeaseHeaders errorCode(String errorCode) { + public BlobAcquireLeaseHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobBreakLeaseHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobBreakLeaseHeaders.java index 504b7201befe..4b766fdcb894 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobBreakLeaseHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobBreakLeaseHeaders.java @@ -38,6 +38,13 @@ public final class BlobBreakLeaseHeaders { @JsonProperty(value = "x-ms-lease-time") private Integer leaseTime; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -73,7 +80,7 @@ public final class BlobBreakLeaseHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -85,7 +92,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the BlobBreakLeaseHeaders object itself. */ - public BlobBreakLeaseHeaders eTag(String eTag) { + public BlobBreakLeaseHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -98,11 +105,11 @@ public BlobBreakLeaseHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -114,7 +121,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the BlobBreakLeaseHeaders object itself. */ - public BlobBreakLeaseHeaders lastModified(OffsetDateTime lastModified) { + public BlobBreakLeaseHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -129,7 +136,7 @@ public BlobBreakLeaseHeaders lastModified(OffsetDateTime lastModified) { * * @return the leaseTime value. */ - public Integer leaseTime() { + public Integer getLeaseTime() { return this.leaseTime; } @@ -140,18 +147,42 @@ public Integer leaseTime() { * @param leaseTime the leaseTime value to set. * @return the BlobBreakLeaseHeaders object itself. */ - public BlobBreakLeaseHeaders leaseTime(Integer leaseTime) { + public BlobBreakLeaseHeaders setLeaseTime(Integer leaseTime) { this.leaseTime = leaseTime; return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobBreakLeaseHeaders object itself. + */ + public BlobBreakLeaseHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -162,7 +193,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the BlobBreakLeaseHeaders object itself. */ - public BlobBreakLeaseHeaders requestId(String requestId) { + public BlobBreakLeaseHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -174,7 +205,7 @@ public BlobBreakLeaseHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -186,7 +217,7 @@ public String version() { * @param version the version value to set. * @return the BlobBreakLeaseHeaders object itself. */ - public BlobBreakLeaseHeaders version(String version) { + public BlobBreakLeaseHeaders setVersion(String version) { this.version = version; return this; } @@ -197,11 +228,11 @@ public BlobBreakLeaseHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -211,7 +242,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlobBreakLeaseHeaders object itself. */ - public BlobBreakLeaseHeaders dateProperty(OffsetDateTime dateProperty) { + public BlobBreakLeaseHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -225,7 +256,7 @@ public BlobBreakLeaseHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -235,7 +266,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the BlobBreakLeaseHeaders object itself. */ - public BlobBreakLeaseHeaders errorCode(String errorCode) { + public BlobBreakLeaseHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobChangeLeaseHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobChangeLeaseHeaders.java index 67d6971d9ff3..e51c1f4e46a1 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobChangeLeaseHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobChangeLeaseHeaders.java @@ -32,6 +32,13 @@ public final class BlobChangeLeaseHeaders { @JsonProperty(value = "Last-Modified") private DateTimeRfc1123 lastModified; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -73,7 +80,7 @@ public final class BlobChangeLeaseHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -85,7 +92,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the BlobChangeLeaseHeaders object itself. */ - public BlobChangeLeaseHeaders eTag(String eTag) { + public BlobChangeLeaseHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -98,11 +105,11 @@ public BlobChangeLeaseHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -114,7 +121,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the BlobChangeLeaseHeaders object itself. */ - public BlobChangeLeaseHeaders lastModified(OffsetDateTime lastModified) { + public BlobChangeLeaseHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -123,13 +130,37 @@ public BlobChangeLeaseHeaders lastModified(OffsetDateTime lastModified) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobChangeLeaseHeaders object itself. + */ + public BlobChangeLeaseHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -140,7 +171,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the BlobChangeLeaseHeaders object itself. */ - public BlobChangeLeaseHeaders requestId(String requestId) { + public BlobChangeLeaseHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -150,7 +181,7 @@ public BlobChangeLeaseHeaders requestId(String requestId) { * * @return the leaseId value. */ - public String leaseId() { + public String getLeaseId() { return this.leaseId; } @@ -160,7 +191,7 @@ public String leaseId() { * @param leaseId the leaseId value to set. * @return the BlobChangeLeaseHeaders object itself. */ - public BlobChangeLeaseHeaders leaseId(String leaseId) { + public BlobChangeLeaseHeaders setLeaseId(String leaseId) { this.leaseId = leaseId; return this; } @@ -172,7 +203,7 @@ public BlobChangeLeaseHeaders leaseId(String leaseId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -184,7 +215,7 @@ public String version() { * @param version the version value to set. * @return the BlobChangeLeaseHeaders object itself. */ - public BlobChangeLeaseHeaders version(String version) { + public BlobChangeLeaseHeaders setVersion(String version) { this.version = version; return this; } @@ -195,11 +226,11 @@ public BlobChangeLeaseHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -209,7 +240,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlobChangeLeaseHeaders object itself. */ - public BlobChangeLeaseHeaders dateProperty(OffsetDateTime dateProperty) { + public BlobChangeLeaseHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -223,7 +254,7 @@ public BlobChangeLeaseHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -233,7 +264,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the BlobChangeLeaseHeaders object itself. */ - public BlobChangeLeaseHeaders errorCode(String errorCode) { + public BlobChangeLeaseHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobCopyFromURLHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobCopyFromURLHeaders.java index 140b771f8cd6..7fd3a0b6c5b9 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobCopyFromURLHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobCopyFromURLHeaders.java @@ -32,6 +32,13 @@ public final class BlobCopyFromURLHeaders { @JsonProperty(value = "Last-Modified") private DateTimeRfc1123 lastModified; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -47,14 +54,6 @@ public final class BlobCopyFromURLHeaders { @JsonProperty(value = "x-ms-version") private String version; - /* - * UTC date/time value generated by the service that identifies the version - * of the blob. This header is returned for requests made against version - * 2018-11-09 and above. - */ - @JsonProperty(value = "x-ms-version-id") - private String versionId; - /* * UTC date/time value generated by the service that indicates the time at * which the response was initiated @@ -75,6 +74,14 @@ public final class BlobCopyFromURLHeaders { @JsonProperty(value = "x-ms-copy-status") private SyncCopyStatusType copyStatus; + /* + * UTC date/time value generated by the service that identifies the version + * of the blob. This header is returned for requests made against version + * 2018-11-09 and above. + */ + @JsonProperty(value = "x-ms-version-id") + private String versionId; + /* * The errorCode property. */ @@ -88,7 +95,7 @@ public final class BlobCopyFromURLHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -100,7 +107,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the BlobCopyFromURLHeaders object itself. */ - public BlobCopyFromURLHeaders eTag(String eTag) { + public BlobCopyFromURLHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -113,11 +120,11 @@ public BlobCopyFromURLHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -129,7 +136,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the BlobCopyFromURLHeaders object itself. */ - public BlobCopyFromURLHeaders lastModified(OffsetDateTime lastModified) { + public BlobCopyFromURLHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -138,13 +145,37 @@ public BlobCopyFromURLHeaders lastModified(OffsetDateTime lastModified) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobCopyFromURLHeaders object itself. + */ + public BlobCopyFromURLHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -155,7 +186,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the BlobCopyFromURLHeaders object itself. */ - public BlobCopyFromURLHeaders requestId(String requestId) { + public BlobCopyFromURLHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -167,7 +198,7 @@ public BlobCopyFromURLHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -179,46 +210,22 @@ public String version() { * @param version the version value to set. * @return the BlobCopyFromURLHeaders object itself. */ - public BlobCopyFromURLHeaders version(String version) { + public BlobCopyFromURLHeaders setVersion(String version) { this.version = version; return this; } - /** - * Get the versionId property: UTC date/time value generated by the service - * that identifies the version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @return the versionId value. - */ - public String versionId() { - return this.versionId; - } - - /** - * Set the versionId property: UTC date/time value generated by the service - * that identifies the version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @param versionId the versionId value to set. - * @return the BlobCopyFromURLHeaders object itself. - */ - public BlobCopyFromURLHeaders versionId(String versionId) { - this.versionId = versionId; - return this; - } - /** * Get the dateProperty property: UTC date/time value generated by the * service that indicates the time at which the response was initiated. * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -228,7 +235,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlobCopyFromURLHeaders object itself. */ - public BlobCopyFromURLHeaders dateProperty(OffsetDateTime dateProperty) { + public BlobCopyFromURLHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -242,7 +249,7 @@ public BlobCopyFromURLHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the copyId value. */ - public String copyId() { + public String getCopyId() { return this.copyId; } @@ -252,7 +259,7 @@ public String copyId() { * @param copyId the copyId value to set. * @return the BlobCopyFromURLHeaders object itself. */ - public BlobCopyFromURLHeaders copyId(String copyId) { + public BlobCopyFromURLHeaders setCopyId(String copyId) { this.copyId = copyId; return this; } @@ -263,7 +270,7 @@ public BlobCopyFromURLHeaders copyId(String copyId) { * * @return the copyStatus value. */ - public SyncCopyStatusType copyStatus() { + public SyncCopyStatusType getCopyStatus() { return this.copyStatus; } @@ -274,17 +281,41 @@ public SyncCopyStatusType copyStatus() { * @param copyStatus the copyStatus value to set. * @return the BlobCopyFromURLHeaders object itself. */ - public BlobCopyFromURLHeaders copyStatus(SyncCopyStatusType copyStatus) { + public BlobCopyFromURLHeaders setCopyStatus(SyncCopyStatusType copyStatus) { this.copyStatus = copyStatus; return this; } + /** + * Get the versionId property: UTC date/time value generated by the service + * that identifies the version of the blob. This header is returned for + * requests made against version 2018-11-09 and above. + * + * @return the versionId value. + */ + public String getVersionId() { + return this.versionId; + } + + /** + * Set the versionId property: UTC date/time value generated by the service + * that identifies the version of the blob. This header is returned for + * requests made against version 2018-11-09 and above. + * + * @param versionId the versionId value to set. + * @return the BlobCopyFromURLHeaders object itself. + */ + public BlobCopyFromURLHeaders setVersionId(String versionId) { + this.versionId = versionId; + return this; + } + /** * Get the errorCode property: The errorCode property. * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -294,7 +325,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the BlobCopyFromURLHeaders object itself. */ - public BlobCopyFromURLHeaders errorCode(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/models/BlobCreateSnapshotHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobCreateSnapshotHeaders.java index e27c4fde4964..ffc5efff97d1 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobCreateSnapshotHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobCreateSnapshotHeaders.java @@ -39,6 +39,13 @@ public final class BlobCreateSnapshotHeaders { @JsonProperty(value = "Last-Modified") private DateTimeRfc1123 lastModified; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -54,14 +61,6 @@ public final class BlobCreateSnapshotHeaders { @JsonProperty(value = "x-ms-version") private String version; - /* - * UTC date/time value generated by the service that identifies the version - * of the blob. This header is returned for requests made against version - * 2018-11-09 and above. - */ - @JsonProperty(value = "x-ms-version-id") - private String versionId; - /* * UTC date/time value generated by the service that indicates the time at * which the response was initiated @@ -78,14 +77,6 @@ public final class BlobCreateSnapshotHeaders { @JsonProperty(value = "x-ms-request-server-encrypted") private Boolean isServerEncrypted; - /* - * The SHA-256 hash of the encryption key used to encrypt the source blob. - * This header is only returned when the blob was encrypted with a - * customer-provided key. - */ - @JsonProperty(value = "x-ms-encryption-key-sha256") - private String encryptionKeySha256; - /* * The errorCode property. */ @@ -99,7 +90,7 @@ public final class BlobCreateSnapshotHeaders { * * @return the snapshot value. */ - public String snapshot() { + public String getSnapshot() { return this.snapshot; } @@ -111,7 +102,7 @@ public String snapshot() { * @param snapshot the snapshot value to set. * @return the BlobCreateSnapshotHeaders object itself. */ - public BlobCreateSnapshotHeaders snapshot(String snapshot) { + public BlobCreateSnapshotHeaders setSnapshot(String snapshot) { this.snapshot = snapshot; return this; } @@ -123,7 +114,7 @@ public BlobCreateSnapshotHeaders snapshot(String snapshot) { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -135,7 +126,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the BlobCreateSnapshotHeaders object itself. */ - public BlobCreateSnapshotHeaders eTag(String eTag) { + public BlobCreateSnapshotHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -148,11 +139,11 @@ public BlobCreateSnapshotHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -164,7 +155,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the BlobCreateSnapshotHeaders object itself. */ - public BlobCreateSnapshotHeaders lastModified(OffsetDateTime lastModified) { + public BlobCreateSnapshotHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -173,13 +164,37 @@ public BlobCreateSnapshotHeaders lastModified(OffsetDateTime lastModified) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobCreateSnapshotHeaders object itself. + */ + public BlobCreateSnapshotHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -190,7 +205,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the BlobCreateSnapshotHeaders object itself. */ - public BlobCreateSnapshotHeaders requestId(String requestId) { + public BlobCreateSnapshotHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -202,7 +217,7 @@ public BlobCreateSnapshotHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -214,46 +229,22 @@ public String version() { * @param version the version value to set. * @return the BlobCreateSnapshotHeaders object itself. */ - public BlobCreateSnapshotHeaders version(String version) { + public BlobCreateSnapshotHeaders setVersion(String version) { this.version = version; return this; } - /** - * Get the versionId property: UTC date/time value generated by the service - * that identifies the version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @return the versionId value. - */ - public String versionId() { - return this.versionId; - } - - /** - * Set the versionId property: UTC date/time value generated by the service - * that identifies the version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @param versionId the versionId value to set. - * @return the BlobCreateSnapshotHeaders object itself. - */ - public BlobCreateSnapshotHeaders versionId(String versionId) { - this.versionId = versionId; - return this; - } - /** * Get the dateProperty property: UTC date/time value generated by the * service that indicates the time at which the response was initiated. * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -263,7 +254,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlobCreateSnapshotHeaders object itself. */ - public BlobCreateSnapshotHeaders dateProperty(OffsetDateTime dateProperty) { + public BlobCreateSnapshotHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -295,41 +286,17 @@ public Boolean isServerEncrypted() { * @param isServerEncrypted the isServerEncrypted value to set. * @return the BlobCreateSnapshotHeaders object itself. */ - public BlobCreateSnapshotHeaders isServerEncrypted(Boolean isServerEncrypted) { + public BlobCreateSnapshotHeaders setIsServerEncrypted(Boolean isServerEncrypted) { this.isServerEncrypted = isServerEncrypted; return this; } - /** - * Get the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the source blob. This header is only returned when - * the blob was encrypted with a customer-provided key. - * - * @return the encryptionKeySha256 value. - */ - public String encryptionKeySha256() { - return this.encryptionKeySha256; - } - - /** - * Set the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the source blob. This header is only returned when - * the blob was encrypted with a customer-provided key. - * - * @param encryptionKeySha256 the encryptionKeySha256 value to set. - * @return the BlobCreateSnapshotHeaders object itself. - */ - public BlobCreateSnapshotHeaders encryptionKeySha256(String encryptionKeySha256) { - this.encryptionKeySha256 = encryptionKeySha256; - return this; - } - /** * Get the errorCode property: The errorCode property. * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -339,7 +306,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the BlobCreateSnapshotHeaders object itself. */ - public BlobCreateSnapshotHeaders errorCode(String errorCode) { + public BlobCreateSnapshotHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobDeleteHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobDeleteHeaders.java index 95e6289c3e40..902679104855 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobDeleteHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobDeleteHeaders.java @@ -16,6 +16,13 @@ @JacksonXmlRootElement(localName = "Blob-Delete-Headers") @Fluent public final class BlobDeleteHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -44,13 +51,37 @@ public final class BlobDeleteHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobDeleteHeaders object itself. + */ + public BlobDeleteHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -61,7 +92,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the BlobDeleteHeaders object itself. */ - public BlobDeleteHeaders requestId(String requestId) { + public BlobDeleteHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -73,7 +104,7 @@ public BlobDeleteHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -85,7 +116,7 @@ public String version() { * @param version the version value to set. * @return the BlobDeleteHeaders object itself. */ - public BlobDeleteHeaders version(String version) { + public BlobDeleteHeaders setVersion(String version) { this.version = version; return this; } @@ -96,11 +127,11 @@ public BlobDeleteHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -110,7 +141,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlobDeleteHeaders object itself. */ - public BlobDeleteHeaders dateProperty(OffsetDateTime dateProperty) { + public BlobDeleteHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -124,7 +155,7 @@ public BlobDeleteHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -134,7 +165,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the BlobDeleteHeaders object itself. */ - public BlobDeleteHeaders errorCode(String errorCode) { + public BlobDeleteHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobDownloadHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobDownloadHeaders.java index 4e9e2997ebab..fb608717cf01 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobDownloadHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobDownloadHeaders.java @@ -196,6 +196,13 @@ public final class BlobDownloadHeaders { @JsonProperty(value = "x-ms-lease-status") private LeaseStatusType leaseStatus; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -258,6 +265,16 @@ public final class BlobDownloadHeaders { @JsonProperty(value = "x-ms-blob-content-md5") private byte[] blobContentMD5; + /* + * If the request is to read a specified range and the + * x-ms-range-get-content-crc64 is set to true, then the request returns a + * crc64 for the range, as long as the range size is less than or equal to + * 4 MB. If both x-ms-range-get-content-crc64 & x-ms-range-get-content-md5 + * is specified in the same request, it will fail with 400(Bad Request) + */ + @JsonProperty(value = "x-ms-content-crc64") + private byte[] contentCrc64; + /* * The errorCode property. */ @@ -272,11 +289,11 @@ public final class BlobDownloadHeaders { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -288,7 +305,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders lastModified(OffsetDateTime lastModified) { + public BlobDownloadHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -302,7 +319,7 @@ public BlobDownloadHeaders lastModified(OffsetDateTime lastModified) { * * @return the metadata value. */ - public Map metadata() { + public Map getMetadata() { return this.metadata; } @@ -312,7 +329,7 @@ public Map metadata() { * @param metadata the metadata value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders metadata(Map metadata) { + public BlobDownloadHeaders setMetadata(Map metadata) { this.metadata = metadata; return this; } @@ -323,7 +340,7 @@ public BlobDownloadHeaders metadata(Map metadata) { * * @return the contentLength value. */ - public Long contentLength() { + public Long getContentLength() { return this.contentLength; } @@ -334,7 +351,7 @@ public Long contentLength() { * @param contentLength the contentLength value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders contentLength(Long contentLength) { + public BlobDownloadHeaders setContentLength(Long contentLength) { this.contentLength = contentLength; return this; } @@ -345,7 +362,7 @@ public BlobDownloadHeaders contentLength(Long contentLength) { * * @return the contentType value. */ - public String contentType() { + public String getContentType() { return this.contentType; } @@ -356,7 +373,7 @@ public String contentType() { * @param contentType the contentType value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders contentType(String contentType) { + public BlobDownloadHeaders setContentType(String contentType) { this.contentType = contentType; return this; } @@ -368,7 +385,7 @@ public BlobDownloadHeaders contentType(String contentType) { * * @return the contentRange value. */ - public String contentRange() { + public String getContentRange() { return this.contentRange; } @@ -380,7 +397,7 @@ public String contentRange() { * @param contentRange the contentRange value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders contentRange(String contentRange) { + public BlobDownloadHeaders setContentRange(String contentRange) { this.contentRange = contentRange; return this; } @@ -392,7 +409,7 @@ public BlobDownloadHeaders contentRange(String contentRange) { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -404,7 +421,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders eTag(String eTag) { + public BlobDownloadHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -416,7 +433,7 @@ public BlobDownloadHeaders eTag(String eTag) { * * @return the contentMD5 value. */ - public byte[] contentMD5() { + public byte[] getContentMD5() { return ImplUtils.clone(this.contentMD5); } @@ -428,7 +445,7 @@ public byte[] contentMD5() { * @param contentMD5 the contentMD5 value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders contentMD5(byte[] contentMD5) { + public BlobDownloadHeaders setContentMD5(byte[] contentMD5) { this.contentMD5 = ImplUtils.clone(contentMD5); return this; } @@ -439,7 +456,7 @@ public BlobDownloadHeaders contentMD5(byte[] contentMD5) { * * @return the contentEncoding value. */ - public String contentEncoding() { + public String getContentEncoding() { return this.contentEncoding; } @@ -450,7 +467,7 @@ public String contentEncoding() { * @param contentEncoding the contentEncoding value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders contentEncoding(String contentEncoding) { + public BlobDownloadHeaders setContentEncoding(String contentEncoding) { this.contentEncoding = contentEncoding; return this; } @@ -461,7 +478,7 @@ public BlobDownloadHeaders contentEncoding(String contentEncoding) { * * @return the cacheControl value. */ - public String cacheControl() { + public String getCacheControl() { return this.cacheControl; } @@ -472,7 +489,7 @@ public String cacheControl() { * @param cacheControl the cacheControl value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders cacheControl(String cacheControl) { + public BlobDownloadHeaders setCacheControl(String cacheControl) { this.cacheControl = cacheControl; return this; } @@ -489,7 +506,7 @@ public BlobDownloadHeaders cacheControl(String cacheControl) { * * @return the contentDisposition value. */ - public String contentDisposition() { + public String getContentDisposition() { return this.contentDisposition; } @@ -506,7 +523,7 @@ public String contentDisposition() { * @param contentDisposition the contentDisposition value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders contentDisposition(String contentDisposition) { + public BlobDownloadHeaders setContentDisposition(String contentDisposition) { this.contentDisposition = contentDisposition; return this; } @@ -517,7 +534,7 @@ public BlobDownloadHeaders contentDisposition(String contentDisposition) { * * @return the contentLanguage value. */ - public String contentLanguage() { + public String getContentLanguage() { return this.contentLanguage; } @@ -528,7 +545,7 @@ public String contentLanguage() { * @param contentLanguage the contentLanguage value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders contentLanguage(String contentLanguage) { + public BlobDownloadHeaders setContentLanguage(String contentLanguage) { this.contentLanguage = contentLanguage; return this; } @@ -539,7 +556,7 @@ public BlobDownloadHeaders contentLanguage(String contentLanguage) { * * @return the blobSequenceNumber value. */ - public Long blobSequenceNumber() { + public Long getBlobSequenceNumber() { return this.blobSequenceNumber; } @@ -550,7 +567,7 @@ public Long blobSequenceNumber() { * @param blobSequenceNumber the blobSequenceNumber value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders blobSequenceNumber(Long blobSequenceNumber) { + public BlobDownloadHeaders setBlobSequenceNumber(Long blobSequenceNumber) { this.blobSequenceNumber = blobSequenceNumber; return this; } @@ -561,7 +578,7 @@ public BlobDownloadHeaders blobSequenceNumber(Long blobSequenceNumber) { * * @return the blobType value. */ - public BlobType blobType() { + public BlobType getBlobType() { return this.blobType; } @@ -572,7 +589,7 @@ public BlobType blobType() { * @param blobType the blobType value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders blobType(BlobType blobType) { + public BlobDownloadHeaders setBlobType(BlobType blobType) { this.blobType = blobType; return this; } @@ -588,11 +605,11 @@ public BlobDownloadHeaders blobType(BlobType blobType) { * * @return the copyCompletionTime value. */ - public OffsetDateTime copyCompletionTime() { + public OffsetDateTime getCopyCompletionTime() { if (this.copyCompletionTime == null) { return null; } - return this.copyCompletionTime.dateTime(); + return this.copyCompletionTime.getDateTime(); } /** @@ -607,7 +624,7 @@ public OffsetDateTime copyCompletionTime() { * @param copyCompletionTime the copyCompletionTime value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders copyCompletionTime(OffsetDateTime copyCompletionTime) { + public BlobDownloadHeaders setCopyCompletionTime(OffsetDateTime copyCompletionTime) { if (copyCompletionTime == null) { this.copyCompletionTime = null; } else { @@ -626,7 +643,7 @@ public BlobDownloadHeaders copyCompletionTime(OffsetDateTime copyCompletionTime) * * @return the copyStatusDescription value. */ - public String copyStatusDescription() { + public String getCopyStatusDescription() { return this.copyStatusDescription; } @@ -641,7 +658,7 @@ public String copyStatusDescription() { * @param copyStatusDescription the copyStatusDescription value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders copyStatusDescription(String copyStatusDescription) { + public BlobDownloadHeaders setCopyStatusDescription(String copyStatusDescription) { this.copyStatusDescription = copyStatusDescription; return this; } @@ -653,7 +670,7 @@ public BlobDownloadHeaders copyStatusDescription(String copyStatusDescription) { * * @return the copyId value. */ - public String copyId() { + public String getCopyId() { return this.copyId; } @@ -665,7 +682,7 @@ public String copyId() { * @param copyId the copyId value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders copyId(String copyId) { + public BlobDownloadHeaders setCopyId(String copyId) { this.copyId = copyId; return this; } @@ -681,7 +698,7 @@ public BlobDownloadHeaders copyId(String copyId) { * * @return the copyProgress value. */ - public String copyProgress() { + public String getCopyProgress() { return this.copyProgress; } @@ -697,7 +714,7 @@ public String copyProgress() { * @param copyProgress the copyProgress value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders copyProgress(String copyProgress) { + public BlobDownloadHeaders setCopyProgress(String copyProgress) { this.copyProgress = copyProgress; return this; } @@ -712,7 +729,7 @@ public BlobDownloadHeaders copyProgress(String copyProgress) { * * @return the copySource value. */ - public String copySource() { + public String getCopySource() { return this.copySource; } @@ -727,7 +744,7 @@ public String copySource() { * @param copySource the copySource value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders copySource(String copySource) { + public BlobDownloadHeaders setCopySource(String copySource) { this.copySource = copySource; return this; } @@ -739,7 +756,7 @@ public BlobDownloadHeaders copySource(String copySource) { * * @return the copyStatus value. */ - public CopyStatusType copyStatus() { + public CopyStatusType getCopyStatus() { return this.copyStatus; } @@ -751,7 +768,7 @@ public CopyStatusType copyStatus() { * @param copyStatus the copyStatus value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders copyStatus(CopyStatusType copyStatus) { + public BlobDownloadHeaders setCopyStatus(CopyStatusType copyStatus) { this.copyStatus = copyStatus; return this; } @@ -763,7 +780,7 @@ public BlobDownloadHeaders copyStatus(CopyStatusType copyStatus) { * * @return the leaseDuration value. */ - public LeaseDurationType leaseDuration() { + public LeaseDurationType getLeaseDuration() { return this.leaseDuration; } @@ -775,7 +792,7 @@ public LeaseDurationType leaseDuration() { * @param leaseDuration the leaseDuration value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders leaseDuration(LeaseDurationType leaseDuration) { + public BlobDownloadHeaders setLeaseDuration(LeaseDurationType leaseDuration) { this.leaseDuration = leaseDuration; return this; } @@ -786,7 +803,7 @@ public BlobDownloadHeaders leaseDuration(LeaseDurationType leaseDuration) { * * @return the leaseState value. */ - public LeaseStateType leaseState() { + public LeaseStateType getLeaseState() { return this.leaseState; } @@ -797,7 +814,7 @@ public LeaseStateType leaseState() { * @param leaseState the leaseState value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders leaseState(LeaseStateType leaseState) { + public BlobDownloadHeaders setLeaseState(LeaseStateType leaseState) { this.leaseState = leaseState; return this; } @@ -808,7 +825,7 @@ public BlobDownloadHeaders leaseState(LeaseStateType leaseState) { * * @return the leaseStatus value. */ - public LeaseStatusType leaseStatus() { + public LeaseStatusType getLeaseStatus() { return this.leaseStatus; } @@ -819,18 +836,42 @@ public LeaseStatusType leaseStatus() { * @param leaseStatus the leaseStatus value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders leaseStatus(LeaseStatusType leaseStatus) { + public BlobDownloadHeaders setLeaseStatus(LeaseStatusType leaseStatus) { this.leaseStatus = leaseStatus; return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobDownloadHeaders object itself. + */ + public BlobDownloadHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -841,7 +882,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders requestId(String requestId) { + public BlobDownloadHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -853,7 +894,7 @@ public BlobDownloadHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -865,7 +906,7 @@ public String version() { * @param version the version value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders version(String version) { + public BlobDownloadHeaders setVersion(String version) { this.version = version; return this; } @@ -876,7 +917,7 @@ public BlobDownloadHeaders version(String version) { * * @return the acceptRanges value. */ - public String acceptRanges() { + public String getAcceptRanges() { return this.acceptRanges; } @@ -887,7 +928,7 @@ public String acceptRanges() { * @param acceptRanges the acceptRanges value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders acceptRanges(String acceptRanges) { + public BlobDownloadHeaders setAcceptRanges(String acceptRanges) { this.acceptRanges = acceptRanges; return this; } @@ -898,11 +939,11 @@ public BlobDownloadHeaders acceptRanges(String acceptRanges) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -912,7 +953,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders dateProperty(OffsetDateTime dateProperty) { + public BlobDownloadHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -927,7 +968,7 @@ public BlobDownloadHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the blobCommittedBlockCount value. */ - public Integer blobCommittedBlockCount() { + public Integer getBlobCommittedBlockCount() { return this.blobCommittedBlockCount; } @@ -938,7 +979,7 @@ public Integer blobCommittedBlockCount() { * @param blobCommittedBlockCount the blobCommittedBlockCount value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders blobCommittedBlockCount(Integer blobCommittedBlockCount) { + public BlobDownloadHeaders setBlobCommittedBlockCount(Integer blobCommittedBlockCount) { this.blobCommittedBlockCount = blobCommittedBlockCount; return this; } @@ -966,7 +1007,7 @@ public Boolean isServerEncrypted() { * @param isServerEncrypted the isServerEncrypted value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders isServerEncrypted(Boolean isServerEncrypted) { + public BlobDownloadHeaders setIsServerEncrypted(Boolean isServerEncrypted) { this.isServerEncrypted = isServerEncrypted; return this; } @@ -978,7 +1019,7 @@ public BlobDownloadHeaders isServerEncrypted(Boolean isServerEncrypted) { * * @return the encryptionKeySha256 value. */ - public String encryptionKeySha256() { + public String getEncryptionKeySha256() { return this.encryptionKeySha256; } @@ -990,7 +1031,7 @@ public String encryptionKeySha256() { * @param encryptionKeySha256 the encryptionKeySha256 value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders encryptionKeySha256(String encryptionKeySha256) { + public BlobDownloadHeaders setEncryptionKeySha256(String encryptionKeySha256) { this.encryptionKeySha256 = encryptionKeySha256; return this; } @@ -1004,7 +1045,7 @@ public BlobDownloadHeaders encryptionKeySha256(String encryptionKeySha256) { * * @return the blobContentMD5 value. */ - public byte[] blobContentMD5() { + public byte[] getBlobContentMD5() { return ImplUtils.clone(this.blobContentMD5); } @@ -1018,17 +1059,47 @@ public byte[] blobContentMD5() { * @param blobContentMD5 the blobContentMD5 value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders blobContentMD5(byte[] blobContentMD5) { + public BlobDownloadHeaders setBlobContentMD5(byte[] blobContentMD5) { this.blobContentMD5 = ImplUtils.clone(blobContentMD5); return this; } + /** + * Get the contentCrc64 property: If the request is to read a specified + * range and the x-ms-range-get-content-crc64 is set to true, then the + * request returns a crc64 for the range, as long as the range size is less + * than or equal to 4 MB. If both x-ms-range-get-content-crc64 & + * x-ms-range-get-content-md5 is specified in the same request, it will + * fail with 400(Bad Request). + * + * @return the contentCrc64 value. + */ + public byte[] getContentCrc64() { + return ImplUtils.clone(this.contentCrc64); + } + + /** + * Set the contentCrc64 property: If the request is to read a specified + * range and the x-ms-range-get-content-crc64 is set to true, then the + * request returns a crc64 for the range, as long as the range size is less + * than or equal to 4 MB. If both x-ms-range-get-content-crc64 & + * x-ms-range-get-content-md5 is specified in the same request, it will + * fail with 400(Bad Request). + * + * @param contentCrc64 the contentCrc64 value to set. + * @return the BlobDownloadHeaders object itself. + */ + public BlobDownloadHeaders setContentCrc64(byte[] contentCrc64) { + this.contentCrc64 = ImplUtils.clone(contentCrc64); + return this; + } + /** * Get the errorCode property: The errorCode property. * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -1038,7 +1109,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the BlobDownloadHeaders object itself. */ - public BlobDownloadHeaders errorCode(String errorCode) { + public BlobDownloadHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobFlatListSegment.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobFlatListSegment.java index ac1f703d1cd7..627ce4fbd6b1 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobFlatListSegment.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobFlatListSegment.java @@ -27,7 +27,7 @@ public final class BlobFlatListSegment { * * @return the blobItems value. */ - public List blobItems() { + public List getBlobItems() { return this.blobItems; } @@ -37,7 +37,7 @@ public List blobItems() { * @param blobItems the blobItems value to set. * @return the BlobFlatListSegment object itself. */ - public BlobFlatListSegment blobItems(List blobItems) { + public BlobFlatListSegment setBlobItems(List blobItems) { this.blobItems = blobItems; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetAccessControlHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetAccessControlHeaders.java new file mode 100644 index 000000000000..6cdcdade7239 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetAccessControlHeaders.java @@ -0,0 +1,334 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for GetAccessControl operation. + */ +@JacksonXmlRootElement(localName = "Blob-GetAccessControl-Headers") +@Fluent +public final class BlobGetAccessControlHeaders { + /* + * A UTC date/time value generated by the service that indicates the time + * at which the response was initiated. + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /* + * An HTTP entity tag associated with the file or directory. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /* + * The data and time the file or directory was last modified. Write + * operations on the file or directory update the last modified time. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /* + * The owner of the file or directory. Included in the response if + * Hierarchical Namespace is enabled for the account. + */ + @JsonProperty(value = "x-ms-owner") + private String xMsOwner; + + /* + * The owning group of the file or directory. Included in the response if + * Hierarchical Namespace is enabled for the account. + */ + @JsonProperty(value = "x-ms-group") + private String xMsGroup; + + /* + * The POSIX access permissions for the file owner, the file owning group, + * and others. Included in the response if Hierarchical Namespace is + * enabled for the account. + */ + @JsonProperty(value = "x-ms-permissions") + private String xMsPermissions; + + /* + * The POSIX access control list for the file or directory. Included in + * the response only if the action is "getAccessControl" and Hierarchical + * Namespace is enabled for the account. + */ + @JsonProperty(value = "x-ms-acl") + private String xMsAcl; + + /* + * A server-generated UUID recorded in the analytics logs for + * troubleshooting and correlation. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * The version of the REST protocol used to process the request. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + + /** + * Get the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime getDateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.getDateTime(); + } + + /** + * Set the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the BlobGetAccessControlHeaders object itself. + */ + public BlobGetAccessControlHeaders setDateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } + + /** + * Get the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @param eTag the eTag value to set. + * @return the BlobGetAccessControlHeaders object itself. + */ + public BlobGetAccessControlHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @param lastModified the lastModified value to set. + * @return the BlobGetAccessControlHeaders object itself. + */ + public BlobGetAccessControlHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsOwner property: The owner of the file or directory. Included + * in the response if Hierarchical Namespace is enabled for the account. + * + * @return the xMsOwner value. + */ + public String getXMsOwner() { + return this.xMsOwner; + } + + /** + * Set the xMsOwner property: The owner of the file or directory. Included + * in the response if Hierarchical Namespace is enabled for the account. + * + * @param xMsOwner the xMsOwner value to set. + * @return the BlobGetAccessControlHeaders object itself. + */ + public BlobGetAccessControlHeaders setXMsOwner(String xMsOwner) { + this.xMsOwner = xMsOwner; + return this; + } + + /** + * Get the xMsGroup property: The owning group of the file or directory. + * Included in the response if Hierarchical Namespace is enabled for the + * account. + * + * @return the xMsGroup value. + */ + public String getXMsGroup() { + return this.xMsGroup; + } + + /** + * Set the xMsGroup property: The owning group of the file or directory. + * Included in the response if Hierarchical Namespace is enabled for the + * account. + * + * @param xMsGroup the xMsGroup value to set. + * @return the BlobGetAccessControlHeaders object itself. + */ + public BlobGetAccessControlHeaders setXMsGroup(String xMsGroup) { + this.xMsGroup = xMsGroup; + return this; + } + + /** + * Get the xMsPermissions property: The POSIX access permissions for the + * file owner, the file owning group, and others. Included in the response + * if Hierarchical Namespace is enabled for the account. + * + * @return the xMsPermissions value. + */ + public String getXMsPermissions() { + return this.xMsPermissions; + } + + /** + * Set the xMsPermissions property: The POSIX access permissions for the + * file owner, the file owning group, and others. Included in the response + * if Hierarchical Namespace is enabled for the account. + * + * @param xMsPermissions the xMsPermissions value to set. + * @return the BlobGetAccessControlHeaders object itself. + */ + public BlobGetAccessControlHeaders setXMsPermissions(String xMsPermissions) { + this.xMsPermissions = xMsPermissions; + return this; + } + + /** + * Get the xMsAcl property: The POSIX access control list for the file or + * directory. Included in the response only if the action is + * "getAccessControl" and Hierarchical Namespace is enabled for the + * account. + * + * @return the xMsAcl value. + */ + public String getXMsAcl() { + return this.xMsAcl; + } + + /** + * Set the xMsAcl property: The POSIX access control list for the file or + * directory. Included in the response only if the action is + * "getAccessControl" and Hierarchical Namespace is enabled for the + * account. + * + * @param xMsAcl the xMsAcl value to set. + * @return the BlobGetAccessControlHeaders object itself. + */ + public BlobGetAccessControlHeaders setXMsAcl(String xMsAcl) { + this.xMsAcl = xMsAcl; + return this; + } + + /** + * Get the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @return the requestId value. + */ + public String getRequestId() { + return this.requestId; + } + + /** + * Set the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @param requestId the requestId value to set. + * @return the BlobGetAccessControlHeaders object itself. + */ + public BlobGetAccessControlHeaders setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: The version of the REST protocol used to + * process the request. + * + * @return the version value. + */ + public String getVersion() { + return this.version; + } + + /** + * Set the version property: The version of the REST protocol used to + * process the request. + * + * @param version the version value to set. + * @return the BlobGetAccessControlHeaders object itself. + */ + public BlobGetAccessControlHeaders setVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobGetAccessControlHeaders object itself. + */ + public BlobGetAccessControlHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetAccountInfoHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetAccountInfoHeaders.java index 21243aaac732..df627ba38eac 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetAccountInfoHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetAccountInfoHeaders.java @@ -16,6 +16,13 @@ @JacksonXmlRootElement(localName = "Blob-GetAccountInfo-Headers") @Fluent public final class BlobGetAccountInfoHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -59,13 +66,37 @@ public final class BlobGetAccountInfoHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobGetAccountInfoHeaders object itself. + */ + public BlobGetAccountInfoHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -76,7 +107,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the BlobGetAccountInfoHeaders object itself. */ - public BlobGetAccountInfoHeaders requestId(String requestId) { + public BlobGetAccountInfoHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -88,7 +119,7 @@ public BlobGetAccountInfoHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -100,7 +131,7 @@ public String version() { * @param version the version value to set. * @return the BlobGetAccountInfoHeaders object itself. */ - public BlobGetAccountInfoHeaders version(String version) { + public BlobGetAccountInfoHeaders setVersion(String version) { this.version = version; return this; } @@ -111,11 +142,11 @@ public BlobGetAccountInfoHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -125,7 +156,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlobGetAccountInfoHeaders object itself. */ - public BlobGetAccountInfoHeaders dateProperty(OffsetDateTime dateProperty) { + public BlobGetAccountInfoHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -141,7 +172,7 @@ public BlobGetAccountInfoHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the skuName value. */ - public SkuName skuName() { + public SkuName getSkuName() { return this.skuName; } @@ -153,7 +184,7 @@ public SkuName skuName() { * @param skuName the skuName value to set. * @return the BlobGetAccountInfoHeaders object itself. */ - public BlobGetAccountInfoHeaders skuName(SkuName skuName) { + public BlobGetAccountInfoHeaders setSkuName(SkuName skuName) { this.skuName = skuName; return this; } @@ -164,7 +195,7 @@ public BlobGetAccountInfoHeaders skuName(SkuName skuName) { * * @return the accountKind value. */ - public AccountKind accountKind() { + public AccountKind getAccountKind() { return this.accountKind; } @@ -175,7 +206,7 @@ public AccountKind accountKind() { * @param accountKind the accountKind value to set. * @return the BlobGetAccountInfoHeaders object itself. */ - public BlobGetAccountInfoHeaders accountKind(AccountKind accountKind) { + public BlobGetAccountInfoHeaders setAccountKind(AccountKind accountKind) { this.accountKind = accountKind; return this; } @@ -185,7 +216,7 @@ public BlobGetAccountInfoHeaders accountKind(AccountKind accountKind) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -195,7 +226,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the BlobGetAccountInfoHeaders object itself. */ - public BlobGetAccountInfoHeaders errorCode(String errorCode) { + public BlobGetAccountInfoHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetPropertiesHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetPropertiesHeaders.java index 728ae5fd9e1e..953039964baa 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetPropertiesHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetPropertiesHeaders.java @@ -209,6 +209,13 @@ public final class BlobGetPropertiesHeaders { @JsonProperty(value = "x-ms-blob-sequence-number") private Long blobSequenceNumber; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -309,11 +316,11 @@ public final class BlobGetPropertiesHeaders { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -325,7 +332,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders lastModified(OffsetDateTime lastModified) { + public BlobGetPropertiesHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -340,11 +347,11 @@ public BlobGetPropertiesHeaders lastModified(OffsetDateTime lastModified) { * * @return the creationTime value. */ - public OffsetDateTime creationTime() { + public OffsetDateTime getCreationTime() { if (this.creationTime == null) { return null; } - return this.creationTime.dateTime(); + return this.creationTime.getDateTime(); } /** @@ -354,7 +361,7 @@ public OffsetDateTime creationTime() { * @param creationTime the creationTime value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders creationTime(OffsetDateTime creationTime) { + public BlobGetPropertiesHeaders setCreationTime(OffsetDateTime creationTime) { if (creationTime == null) { this.creationTime = null; } else { @@ -368,7 +375,7 @@ public BlobGetPropertiesHeaders creationTime(OffsetDateTime creationTime) { * * @return the metadata value. */ - public Map metadata() { + public Map getMetadata() { return this.metadata; } @@ -378,7 +385,7 @@ public Map metadata() { * @param metadata the metadata value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders metadata(Map metadata) { + public BlobGetPropertiesHeaders setMetadata(Map metadata) { this.metadata = metadata; return this; } @@ -389,7 +396,7 @@ public BlobGetPropertiesHeaders metadata(Map metadata) { * * @return the blobType value. */ - public BlobType blobType() { + public BlobType getBlobType() { return this.blobType; } @@ -400,7 +407,7 @@ public BlobType blobType() { * @param blobType the blobType value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders blobType(BlobType blobType) { + public BlobGetPropertiesHeaders setBlobType(BlobType blobType) { this.blobType = blobType; return this; } @@ -416,11 +423,11 @@ public BlobGetPropertiesHeaders blobType(BlobType blobType) { * * @return the copyCompletionTime value. */ - public OffsetDateTime copyCompletionTime() { + public OffsetDateTime getCopyCompletionTime() { if (this.copyCompletionTime == null) { return null; } - return this.copyCompletionTime.dateTime(); + return this.copyCompletionTime.getDateTime(); } /** @@ -435,7 +442,7 @@ public OffsetDateTime copyCompletionTime() { * @param copyCompletionTime the copyCompletionTime value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders copyCompletionTime(OffsetDateTime copyCompletionTime) { + public BlobGetPropertiesHeaders setCopyCompletionTime(OffsetDateTime copyCompletionTime) { if (copyCompletionTime == null) { this.copyCompletionTime = null; } else { @@ -454,7 +461,7 @@ public BlobGetPropertiesHeaders copyCompletionTime(OffsetDateTime copyCompletion * * @return the copyStatusDescription value. */ - public String copyStatusDescription() { + public String getCopyStatusDescription() { return this.copyStatusDescription; } @@ -469,7 +476,7 @@ public String copyStatusDescription() { * @param copyStatusDescription the copyStatusDescription value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders copyStatusDescription(String copyStatusDescription) { + public BlobGetPropertiesHeaders setCopyStatusDescription(String copyStatusDescription) { this.copyStatusDescription = copyStatusDescription; return this; } @@ -481,7 +488,7 @@ public BlobGetPropertiesHeaders copyStatusDescription(String copyStatusDescripti * * @return the copyId value. */ - public String copyId() { + public String getCopyId() { return this.copyId; } @@ -493,7 +500,7 @@ public String copyId() { * @param copyId the copyId value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders copyId(String copyId) { + public BlobGetPropertiesHeaders setCopyId(String copyId) { this.copyId = copyId; return this; } @@ -509,7 +516,7 @@ public BlobGetPropertiesHeaders copyId(String copyId) { * * @return the copyProgress value. */ - public String copyProgress() { + public String getCopyProgress() { return this.copyProgress; } @@ -525,7 +532,7 @@ public String copyProgress() { * @param copyProgress the copyProgress value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders copyProgress(String copyProgress) { + public BlobGetPropertiesHeaders setCopyProgress(String copyProgress) { this.copyProgress = copyProgress; return this; } @@ -540,7 +547,7 @@ public BlobGetPropertiesHeaders copyProgress(String copyProgress) { * * @return the copySource value. */ - public String copySource() { + public String getCopySource() { return this.copySource; } @@ -555,7 +562,7 @@ public String copySource() { * @param copySource the copySource value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders copySource(String copySource) { + public BlobGetPropertiesHeaders setCopySource(String copySource) { this.copySource = copySource; return this; } @@ -567,7 +574,7 @@ public BlobGetPropertiesHeaders copySource(String copySource) { * * @return the copyStatus value. */ - public CopyStatusType copyStatus() { + public CopyStatusType getCopyStatus() { return this.copyStatus; } @@ -579,7 +586,7 @@ public CopyStatusType copyStatus() { * @param copyStatus the copyStatus value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders copyStatus(CopyStatusType copyStatus) { + public BlobGetPropertiesHeaders setCopyStatus(CopyStatusType copyStatus) { this.copyStatus = copyStatus; return this; } @@ -601,7 +608,7 @@ public Boolean isIncrementalCopy() { * @param isIncrementalCopy the isIncrementalCopy value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders isIncrementalCopy(Boolean isIncrementalCopy) { + public BlobGetPropertiesHeaders setIsIncrementalCopy(Boolean isIncrementalCopy) { this.isIncrementalCopy = isIncrementalCopy; return this; } @@ -614,7 +621,7 @@ public BlobGetPropertiesHeaders isIncrementalCopy(Boolean isIncrementalCopy) { * * @return the destinationSnapshot value. */ - public String destinationSnapshot() { + public String getDestinationSnapshot() { return this.destinationSnapshot; } @@ -627,7 +634,7 @@ public String destinationSnapshot() { * @param destinationSnapshot the destinationSnapshot value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders destinationSnapshot(String destinationSnapshot) { + public BlobGetPropertiesHeaders setDestinationSnapshot(String destinationSnapshot) { this.destinationSnapshot = destinationSnapshot; return this; } @@ -639,7 +646,7 @@ public BlobGetPropertiesHeaders destinationSnapshot(String destinationSnapshot) * * @return the leaseDuration value. */ - public LeaseDurationType leaseDuration() { + public LeaseDurationType getLeaseDuration() { return this.leaseDuration; } @@ -651,7 +658,7 @@ public LeaseDurationType leaseDuration() { * @param leaseDuration the leaseDuration value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders leaseDuration(LeaseDurationType leaseDuration) { + public BlobGetPropertiesHeaders setLeaseDuration(LeaseDurationType leaseDuration) { this.leaseDuration = leaseDuration; return this; } @@ -662,7 +669,7 @@ public BlobGetPropertiesHeaders leaseDuration(LeaseDurationType leaseDuration) { * * @return the leaseState value. */ - public LeaseStateType leaseState() { + public LeaseStateType getLeaseState() { return this.leaseState; } @@ -673,7 +680,7 @@ public LeaseStateType leaseState() { * @param leaseState the leaseState value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders leaseState(LeaseStateType leaseState) { + public BlobGetPropertiesHeaders setLeaseState(LeaseStateType leaseState) { this.leaseState = leaseState; return this; } @@ -684,7 +691,7 @@ public BlobGetPropertiesHeaders leaseState(LeaseStateType leaseState) { * * @return the leaseStatus value. */ - public LeaseStatusType leaseStatus() { + public LeaseStatusType getLeaseStatus() { return this.leaseStatus; } @@ -695,7 +702,7 @@ public LeaseStatusType leaseStatus() { * @param leaseStatus the leaseStatus value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders leaseStatus(LeaseStatusType leaseStatus) { + public BlobGetPropertiesHeaders setLeaseStatus(LeaseStatusType leaseStatus) { this.leaseStatus = leaseStatus; return this; } @@ -706,7 +713,7 @@ public BlobGetPropertiesHeaders leaseStatus(LeaseStatusType leaseStatus) { * * @return the contentLength value. */ - public Long contentLength() { + public Long getContentLength() { return this.contentLength; } @@ -717,7 +724,7 @@ public Long contentLength() { * @param contentLength the contentLength value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders contentLength(Long contentLength) { + public BlobGetPropertiesHeaders setContentLength(Long contentLength) { this.contentLength = contentLength; return this; } @@ -728,7 +735,7 @@ public BlobGetPropertiesHeaders contentLength(Long contentLength) { * * @return the contentType value. */ - public String contentType() { + public String getContentType() { return this.contentType; } @@ -739,7 +746,7 @@ public String contentType() { * @param contentType the contentType value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders contentType(String contentType) { + public BlobGetPropertiesHeaders setContentType(String contentType) { this.contentType = contentType; return this; } @@ -751,7 +758,7 @@ public BlobGetPropertiesHeaders contentType(String contentType) { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -763,7 +770,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders eTag(String eTag) { + public BlobGetPropertiesHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -775,7 +782,7 @@ public BlobGetPropertiesHeaders eTag(String eTag) { * * @return the contentMD5 value. */ - public byte[] contentMD5() { + public byte[] getContentMD5() { return ImplUtils.clone(this.contentMD5); } @@ -787,7 +794,7 @@ public byte[] contentMD5() { * @param contentMD5 the contentMD5 value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders contentMD5(byte[] contentMD5) { + public BlobGetPropertiesHeaders setContentMD5(byte[] contentMD5) { this.contentMD5 = ImplUtils.clone(contentMD5); return this; } @@ -798,7 +805,7 @@ public BlobGetPropertiesHeaders contentMD5(byte[] contentMD5) { * * @return the contentEncoding value. */ - public String contentEncoding() { + public String getContentEncoding() { return this.contentEncoding; } @@ -809,7 +816,7 @@ public String contentEncoding() { * @param contentEncoding the contentEncoding value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders contentEncoding(String contentEncoding) { + public BlobGetPropertiesHeaders setContentEncoding(String contentEncoding) { this.contentEncoding = contentEncoding; return this; } @@ -826,7 +833,7 @@ public BlobGetPropertiesHeaders contentEncoding(String contentEncoding) { * * @return the contentDisposition value. */ - public String contentDisposition() { + public String getContentDisposition() { return this.contentDisposition; } @@ -843,7 +850,7 @@ public String contentDisposition() { * @param contentDisposition the contentDisposition value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders contentDisposition(String contentDisposition) { + public BlobGetPropertiesHeaders setContentDisposition(String contentDisposition) { this.contentDisposition = contentDisposition; return this; } @@ -854,7 +861,7 @@ public BlobGetPropertiesHeaders contentDisposition(String contentDisposition) { * * @return the contentLanguage value. */ - public String contentLanguage() { + public String getContentLanguage() { return this.contentLanguage; } @@ -865,7 +872,7 @@ public String contentLanguage() { * @param contentLanguage the contentLanguage value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders contentLanguage(String contentLanguage) { + public BlobGetPropertiesHeaders setContentLanguage(String contentLanguage) { this.contentLanguage = contentLanguage; return this; } @@ -876,7 +883,7 @@ public BlobGetPropertiesHeaders contentLanguage(String contentLanguage) { * * @return the cacheControl value. */ - public String cacheControl() { + public String getCacheControl() { return this.cacheControl; } @@ -887,7 +894,7 @@ public String cacheControl() { * @param cacheControl the cacheControl value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders cacheControl(String cacheControl) { + public BlobGetPropertiesHeaders setCacheControl(String cacheControl) { this.cacheControl = cacheControl; return this; } @@ -898,7 +905,7 @@ public BlobGetPropertiesHeaders cacheControl(String cacheControl) { * * @return the blobSequenceNumber value. */ - public Long blobSequenceNumber() { + public Long getBlobSequenceNumber() { return this.blobSequenceNumber; } @@ -909,18 +916,42 @@ public Long blobSequenceNumber() { * @param blobSequenceNumber the blobSequenceNumber value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders blobSequenceNumber(Long blobSequenceNumber) { + public BlobGetPropertiesHeaders setBlobSequenceNumber(Long blobSequenceNumber) { this.blobSequenceNumber = blobSequenceNumber; return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobGetPropertiesHeaders object itself. + */ + public BlobGetPropertiesHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -931,7 +962,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders requestId(String requestId) { + public BlobGetPropertiesHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -943,7 +974,7 @@ public BlobGetPropertiesHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -955,7 +986,7 @@ public String version() { * @param version the version value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders version(String version) { + public BlobGetPropertiesHeaders setVersion(String version) { this.version = version; return this; } @@ -966,11 +997,11 @@ public BlobGetPropertiesHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -980,7 +1011,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders dateProperty(OffsetDateTime dateProperty) { + public BlobGetPropertiesHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -995,7 +1026,7 @@ public BlobGetPropertiesHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the acceptRanges value. */ - public String acceptRanges() { + public String getAcceptRanges() { return this.acceptRanges; } @@ -1006,7 +1037,7 @@ public String acceptRanges() { * @param acceptRanges the acceptRanges value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders acceptRanges(String acceptRanges) { + public BlobGetPropertiesHeaders setAcceptRanges(String acceptRanges) { this.acceptRanges = acceptRanges; return this; } @@ -1017,7 +1048,7 @@ public BlobGetPropertiesHeaders acceptRanges(String acceptRanges) { * * @return the blobCommittedBlockCount value. */ - public Integer blobCommittedBlockCount() { + public Integer getBlobCommittedBlockCount() { return this.blobCommittedBlockCount; } @@ -1028,7 +1059,7 @@ public Integer blobCommittedBlockCount() { * @param blobCommittedBlockCount the blobCommittedBlockCount value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders blobCommittedBlockCount(Integer blobCommittedBlockCount) { + public BlobGetPropertiesHeaders setBlobCommittedBlockCount(Integer blobCommittedBlockCount) { this.blobCommittedBlockCount = blobCommittedBlockCount; return this; } @@ -1056,7 +1087,7 @@ public Boolean isServerEncrypted() { * @param isServerEncrypted the isServerEncrypted value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders isServerEncrypted(Boolean isServerEncrypted) { + public BlobGetPropertiesHeaders setIsServerEncrypted(Boolean isServerEncrypted) { this.isServerEncrypted = isServerEncrypted; return this; } @@ -1068,7 +1099,7 @@ public BlobGetPropertiesHeaders isServerEncrypted(Boolean isServerEncrypted) { * * @return the encryptionKeySha256 value. */ - public String encryptionKeySha256() { + public String getEncryptionKeySha256() { return this.encryptionKeySha256; } @@ -1080,7 +1111,7 @@ public String encryptionKeySha256() { * @param encryptionKeySha256 the encryptionKeySha256 value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders encryptionKeySha256(String encryptionKeySha256) { + public BlobGetPropertiesHeaders setEncryptionKeySha256(String encryptionKeySha256) { this.encryptionKeySha256 = encryptionKeySha256; return this; } @@ -1094,7 +1125,7 @@ public BlobGetPropertiesHeaders encryptionKeySha256(String encryptionKeySha256) * * @return the accessTier value. */ - public String accessTier() { + public String getAccessTier() { return this.accessTier; } @@ -1108,7 +1139,7 @@ public String accessTier() { * @param accessTier the accessTier value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders accessTier(String accessTier) { + public BlobGetPropertiesHeaders setAccessTier(String accessTier) { this.accessTier = accessTier; return this; } @@ -1121,7 +1152,7 @@ public BlobGetPropertiesHeaders accessTier(String accessTier) { * * @return the accessTierInferred value. */ - public Boolean accessTierInferred() { + public Boolean isAccessTierInferred() { return this.accessTierInferred; } @@ -1134,7 +1165,7 @@ public Boolean accessTierInferred() { * @param accessTierInferred the accessTierInferred value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders accessTierInferred(Boolean accessTierInferred) { + public BlobGetPropertiesHeaders setAccessTierInferred(Boolean accessTierInferred) { this.accessTierInferred = accessTierInferred; return this; } @@ -1148,7 +1179,7 @@ public BlobGetPropertiesHeaders accessTierInferred(Boolean accessTierInferred) { * * @return the archiveStatus value. */ - public String archiveStatus() { + public String getArchiveStatus() { return this.archiveStatus; } @@ -1162,7 +1193,7 @@ public String archiveStatus() { * @param archiveStatus the archiveStatus value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders archiveStatus(String archiveStatus) { + public BlobGetPropertiesHeaders setArchiveStatus(String archiveStatus) { this.archiveStatus = archiveStatus; return this; } @@ -1174,11 +1205,11 @@ public BlobGetPropertiesHeaders archiveStatus(String archiveStatus) { * * @return the accessTierChangeTime value. */ - public OffsetDateTime accessTierChangeTime() { + public OffsetDateTime getAccessTierChangeTime() { if (this.accessTierChangeTime == null) { return null; } - return this.accessTierChangeTime.dateTime(); + return this.accessTierChangeTime.getDateTime(); } /** @@ -1189,7 +1220,7 @@ public OffsetDateTime accessTierChangeTime() { * @param accessTierChangeTime the accessTierChangeTime value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders accessTierChangeTime(OffsetDateTime accessTierChangeTime) { + public BlobGetPropertiesHeaders setAccessTierChangeTime(OffsetDateTime accessTierChangeTime) { if (accessTierChangeTime == null) { this.accessTierChangeTime = null; } else { @@ -1203,7 +1234,7 @@ public BlobGetPropertiesHeaders accessTierChangeTime(OffsetDateTime accessTierCh * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -1213,7 +1244,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the BlobGetPropertiesHeaders object itself. */ - public BlobGetPropertiesHeaders errorCode(String errorCode) { + public BlobGetPropertiesHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetTagsHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetTagsHeaders.java new file mode 100644 index 000000000000..5dca7814cbdc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetTagsHeaders.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for GetTags operation. + */ +@JacksonXmlRootElement(localName = "Blob-GetTags-Headers") +@Fluent +public final class BlobGetTagsHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + + /* + * This header uniquely identifies the request that was made and can be + * used for troubleshooting the request. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * Indicates the version of the Blob service used to execute the request. + * This header is returned for requests made against version 2009-09-19 and + * above. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * UTC date/time value generated by the service that indicates the time at + * which the response was initiated + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /* + * The errorCode property. + */ + @JsonProperty(value = "x-ms-error-code") + private String errorCode; + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobGetTagsHeaders object itself. + */ + public BlobGetTagsHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get the requestId property: This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @return the requestId value. + */ + public String requestId() { + return this.requestId; + } + + /** + * Set the requestId property: This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @param requestId the requestId value to set. + * @return the BlobGetTagsHeaders object itself. + */ + public BlobGetTagsHeaders requestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: Indicates the version of the Blob service used + * to execute the request. This header is returned for requests made + * against version 2009-09-19 and above. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Indicates the version of the Blob service used + * to execute the request. This header is returned for requests made + * against version 2009-09-19 and above. + * + * @param version the version value to set. + * @return the BlobGetTagsHeaders object itself. + */ + public BlobGetTagsHeaders version(String version) { + this.version = version; + return this; + } + + /** + * Get the dateProperty property: UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.getDateTime(); + } + + /** + * Set the dateProperty property: UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the BlobGetTagsHeaders object itself. + */ + public BlobGetTagsHeaders dateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } + + /** + * Get the errorCode property: The errorCode property. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Set the errorCode property: The errorCode property. + * + * @param errorCode the errorCode value to set. + * @return the BlobGetTagsHeaders object itself. + */ + public BlobGetTagsHeaders errorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobHTTPHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobHTTPHeaders.java index f25f4e566e6b..14e6cdfb8cd7 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobHTTPHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobHTTPHeaders.java @@ -64,7 +64,7 @@ public final class BlobHTTPHeaders { * * @return the blobCacheControl value. */ - public String blobCacheControl() { + public String getBlobCacheControl() { return this.blobCacheControl; } @@ -76,7 +76,7 @@ public String blobCacheControl() { * @param blobCacheControl the blobCacheControl value to set. * @return the BlobHTTPHeaders object itself. */ - public BlobHTTPHeaders blobCacheControl(String blobCacheControl) { + public BlobHTTPHeaders setBlobCacheControl(String blobCacheControl) { this.blobCacheControl = blobCacheControl; return this; } @@ -88,7 +88,7 @@ public BlobHTTPHeaders blobCacheControl(String blobCacheControl) { * * @return the blobContentType value. */ - public String blobContentType() { + public String getBlobContentType() { return this.blobContentType; } @@ -100,7 +100,7 @@ public String blobContentType() { * @param blobContentType the blobContentType value to set. * @return the BlobHTTPHeaders object itself. */ - public BlobHTTPHeaders blobContentType(String blobContentType) { + public BlobHTTPHeaders setBlobContentType(String blobContentType) { this.blobContentType = blobContentType; return this; } @@ -112,7 +112,7 @@ public BlobHTTPHeaders blobContentType(String blobContentType) { * * @return the blobContentMD5 value. */ - public byte[] blobContentMD5() { + public byte[] getBlobContentMD5() { return ImplUtils.clone(this.blobContentMD5); } @@ -124,7 +124,7 @@ public byte[] blobContentMD5() { * @param blobContentMD5 the blobContentMD5 value to set. * @return the BlobHTTPHeaders object itself. */ - public BlobHTTPHeaders blobContentMD5(byte[] blobContentMD5) { + public BlobHTTPHeaders setBlobContentMD5(byte[] blobContentMD5) { this.blobContentMD5 = ImplUtils.clone(blobContentMD5); return this; } @@ -136,7 +136,7 @@ public BlobHTTPHeaders blobContentMD5(byte[] blobContentMD5) { * * @return the blobContentEncoding value. */ - public String blobContentEncoding() { + public String getBlobContentEncoding() { return this.blobContentEncoding; } @@ -148,7 +148,7 @@ public String blobContentEncoding() { * @param blobContentEncoding the blobContentEncoding value to set. * @return the BlobHTTPHeaders object itself. */ - public BlobHTTPHeaders blobContentEncoding(String blobContentEncoding) { + public BlobHTTPHeaders setBlobContentEncoding(String blobContentEncoding) { this.blobContentEncoding = blobContentEncoding; return this; } @@ -160,7 +160,7 @@ public BlobHTTPHeaders blobContentEncoding(String blobContentEncoding) { * * @return the blobContentLanguage value. */ - public String blobContentLanguage() { + public String getBlobContentLanguage() { return this.blobContentLanguage; } @@ -172,7 +172,7 @@ public String blobContentLanguage() { * @param blobContentLanguage the blobContentLanguage value to set. * @return the BlobHTTPHeaders object itself. */ - public BlobHTTPHeaders blobContentLanguage(String blobContentLanguage) { + public BlobHTTPHeaders setBlobContentLanguage(String blobContentLanguage) { this.blobContentLanguage = blobContentLanguage; return this; } @@ -183,7 +183,7 @@ public BlobHTTPHeaders blobContentLanguage(String blobContentLanguage) { * * @return the blobContentDisposition value. */ - public String blobContentDisposition() { + public String getBlobContentDisposition() { return this.blobContentDisposition; } @@ -194,7 +194,7 @@ public String blobContentDisposition() { * @param blobContentDisposition the blobContentDisposition value to set. * @return the BlobHTTPHeaders object itself. */ - public BlobHTTPHeaders blobContentDisposition(String blobContentDisposition) { + public BlobHTTPHeaders setBlobContentDisposition(String blobContentDisposition) { this.blobContentDisposition = blobContentDisposition; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobHierarchyListSegment.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobHierarchyListSegment.java index c1885f617481..7beb7eeeea42 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobHierarchyListSegment.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobHierarchyListSegment.java @@ -8,7 +8,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - import java.util.ArrayList; import java.util.List; @@ -16,8 +15,8 @@ * The BlobHierarchyListSegment model. */ @JacksonXmlRootElement(localName = "Blobs") -@JsonDeserialize(using = CustomHierarchicalListingDeserializer.class) @Fluent +@JsonDeserialize(using = CustomHierarchicalListingDeserializer.class) public final class BlobHierarchyListSegment { /* * The blobPrefixes property. @@ -36,7 +35,7 @@ public final class BlobHierarchyListSegment { * * @return the blobPrefixes value. */ - public List blobPrefixes() { + public List getBlobPrefixes() { return this.blobPrefixes; } @@ -46,7 +45,7 @@ public List blobPrefixes() { * @param blobPrefixes the blobPrefixes value to set. * @return the BlobHierarchyListSegment object itself. */ - public BlobHierarchyListSegment blobPrefixes(List blobPrefixes) { + public BlobHierarchyListSegment setBlobPrefixes(List blobPrefixes) { this.blobPrefixes = blobPrefixes; return this; } @@ -56,7 +55,7 @@ public BlobHierarchyListSegment blobPrefixes(List blobPrefixes) { * * @return the blobItems value. */ - public List blobItems() { + public List getBlobItems() { return this.blobItems; } @@ -66,7 +65,7 @@ public List blobItems() { * @param blobItems the blobItems value to set. * @return the BlobHierarchyListSegment object itself. */ - public BlobHierarchyListSegment blobItems(List blobItems) { + public BlobHierarchyListSegment setBlobItems(List blobItems) { this.blobItems = blobItems; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobItem.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobItem.java index 3d777a4b2e38..90ea941211e1 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobItem.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobItem.java @@ -33,12 +33,6 @@ public final class BlobItem { @JsonProperty(value = "Snapshot", required = true) private String snapshot; - /* - * The versionId property. - */ - @JsonProperty(value = "VersionId", required = true) - private String versionId; - /* * The properties property. */ @@ -51,6 +45,12 @@ public final class BlobItem { @JsonProperty(value = "Metadata") private Map metadata; + /* + * The versionId property. + */ + @JsonProperty(value = "VersionId", required = true) + private String versionId; + /* * The isPrefix property. */ @@ -62,7 +62,7 @@ public final class BlobItem { * * @return the name value. */ - public String name() { + public String getName() { return this.name; } @@ -72,7 +72,7 @@ public String name() { * @param name the name value to set. * @return the BlobItem object itself. */ - public BlobItem name(String name) { + public BlobItem setName(String name) { this.name = name; return this; } @@ -82,7 +82,7 @@ public BlobItem name(String name) { * * @return the deleted value. */ - public boolean deleted() { + public boolean isDeleted() { return this.deleted; } @@ -92,7 +92,7 @@ public boolean deleted() { * @param deleted the deleted value to set. * @return the BlobItem object itself. */ - public BlobItem deleted(boolean deleted) { + public BlobItem setDeleted(boolean deleted) { this.deleted = deleted; return this; } @@ -102,7 +102,7 @@ public BlobItem deleted(boolean deleted) { * * @return the snapshot value. */ - public String snapshot() { + public String getSnapshot() { return this.snapshot; } @@ -112,37 +112,17 @@ public String snapshot() { * @param snapshot the snapshot value to set. * @return the BlobItem object itself. */ - public BlobItem snapshot(String snapshot) { + public BlobItem setSnapshot(String snapshot) { this.snapshot = snapshot; return this; } - /** - * Get the versionId property: The versionId property. - * - * @return the versionId value. - */ - public String versionId() { - return this.versionId; - } - - /** - * Set the versionId property: The versionId property. - * - * @param versionId the versionId value to set. - * @return the BlobItem object itself. - */ - public BlobItem versionId(String versionId) { - this.versionId = versionId; - return this; - } - /** * Get the properties property: The properties property. * * @return the properties value. */ - public BlobProperties properties() { + public BlobProperties getProperties() { return this.properties; } @@ -152,7 +132,7 @@ public BlobProperties properties() { * @param properties the properties value to set. * @return the BlobItem object itself. */ - public BlobItem properties(BlobProperties properties) { + public BlobItem setProperties(BlobProperties properties) { this.properties = properties; return this; } @@ -162,7 +142,7 @@ public BlobItem properties(BlobProperties properties) { * * @return the metadata value. */ - public Map metadata() { + public Map getMetadata() { return this.metadata; } @@ -172,11 +152,31 @@ public Map metadata() { * @param metadata the metadata value to set. * @return the BlobItem object itself. */ - public BlobItem metadata(Map metadata) { + public BlobItem setMetadata(Map metadata) { this.metadata = metadata; return this; } + /** + * Get the versionId property: The versionId property. + * + * @return the versionId value. + */ + public String getVersionId() { + return this.versionId; + } + + /** + * Set the versionId property: The versionId property. + * + * @param versionId the versionId value to set. + * @return the BlobItem object itself. + */ + public BlobItem setVersionId(String versionId) { + this.versionId = versionId; + return this; + } + /** * Get the isPrefix property: The isPrefix property. * @@ -192,7 +192,7 @@ public Boolean isPrefix() { * @param isPrefix the isPrefix value to set. * @return the BlobItem object itself. */ - public BlobItem isPrefix(Boolean isPrefix) { + public BlobItem setIsPrefix(Boolean isPrefix) { this.isPrefix = isPrefix; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobListDetails.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobListDetails.java index e69618951e88..c725855e5d9d 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobListDetails.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobListDetails.java @@ -34,7 +34,7 @@ public BlobListDetails() { * * @return a flag indicating if copy information will be returned in the listing */ - public boolean copy() { + public boolean getCopy() { return copy; } @@ -45,7 +45,7 @@ public boolean copy() { * @param copy Flag indicating whether copy information should be returned * @return the updated BlobListDetails object */ - public BlobListDetails copy(boolean copy) { + public BlobListDetails setCopy(boolean copy) { this.copy = copy; return this; } @@ -55,7 +55,7 @@ public BlobListDetails copy(boolean copy) { * * @return a flag indicating if metadata will be returned in the listing */ - public boolean metadata() { + public boolean getMetadata() { return metadata; } @@ -65,7 +65,7 @@ public boolean metadata() { * @param metadata Flag indicating whether metadata should be returned * @return the updated BlobListDetails object */ - public BlobListDetails metadata(boolean metadata) { + public BlobListDetails setMetadata(boolean metadata) { this.metadata = metadata; return this; } @@ -75,7 +75,7 @@ public BlobListDetails metadata(boolean metadata) { * * @return a flag indicating if snapshots will be returned in the listing */ - public boolean snapshots() { + public boolean getSnapshots() { return snapshots; } @@ -85,7 +85,7 @@ public boolean snapshots() { * @param snapshots Flag indicating whether snapshots should be returned * @return the updated BlobListDetails object */ - public BlobListDetails snapshots(boolean snapshots) { + public BlobListDetails setSnapshots(boolean snapshots) { this.snapshots = snapshots; return this; } @@ -96,7 +96,7 @@ public BlobListDetails snapshots(boolean snapshots) { * * @return a flag indicating if uncommitted blobs will be returned in the listing */ - public boolean uncommittedBlobs() { + public boolean getUncommittedBlobs() { return uncommittedBlobs; } @@ -107,7 +107,7 @@ public boolean uncommittedBlobs() { * @param uncommittedBlobs Flag indicating whether uncommitted blobs should be returned * @return the updated BlobListDetails object */ - public BlobListDetails uncommittedBlobs(boolean uncommittedBlobs) { + public BlobListDetails setUncommittedBlobs(boolean uncommittedBlobs) { this.uncommittedBlobs = uncommittedBlobs; return this; } @@ -117,7 +117,7 @@ public BlobListDetails uncommittedBlobs(boolean uncommittedBlobs) { * * @return a flag indicating if deleted blobs will be returned in the listing */ - public boolean deletedBlobs() { + public boolean getDeletedBlobs() { return deletedBlobs; } @@ -127,7 +127,7 @@ public boolean deletedBlobs() { * @param deletedBlobs Flag indicating whether deleted blobs should be returned * @return the updated BlobListDetails object */ - public BlobListDetails deletedBlobs(boolean deletedBlobs) { + public BlobListDetails setDeletedBlobs(boolean deletedBlobs) { this.deletedBlobs = deletedBlobs; return this; } @@ -136,7 +136,7 @@ public BlobListDetails deletedBlobs(boolean deletedBlobs) { * @return a list of the flag set to true */ public ArrayList toList() { - ArrayList details = new ArrayList(); + ArrayList details = new ArrayList<>(); if (this.copy) { details.add(ListBlobsIncludeItem.COPY); } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobPrefix.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobPrefix.java index 55afd0bc2549..deb1c6bba736 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobPrefix.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobPrefix.java @@ -25,7 +25,7 @@ public final class BlobPrefix { * * @return the name value. */ - public String name() { + public String getName() { return this.name; } @@ -35,7 +35,7 @@ public String name() { * @param name the name value to set. * @return the BlobPrefix object itself. */ - public BlobPrefix name(String name) { + public BlobPrefix setName(String name) { this.name = name; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobProperties.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobProperties.java index d5bad7b9996e..d344fb27b3d7 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobProperties.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobProperties.java @@ -175,8 +175,8 @@ public final class BlobProperties { private Integer remainingRetentionDays; /* - * Possible values include: 'P4', 'P6', 'P10', 'P20', 'P30', 'P40', 'P50', - * 'Hot', 'Cool', 'Archive' + * Possible values include: 'P4', 'P6', 'P10', 'P15', 'P20', 'P30', 'P40', + * 'P50', 'P60', 'P70', 'P80', 'Hot', 'Cool', 'Archive' */ @JsonProperty(value = "AccessTier") private AccessTier accessTier; @@ -211,11 +211,11 @@ public final class BlobProperties { * * @return the creationTime value. */ - public OffsetDateTime creationTime() { + public OffsetDateTime getCreationTime() { if (this.creationTime == null) { return null; } - return this.creationTime.dateTime(); + return this.creationTime.getDateTime(); } /** @@ -224,7 +224,7 @@ public OffsetDateTime creationTime() { * @param creationTime the creationTime value to set. * @return the BlobProperties object itself. */ - public BlobProperties creationTime(OffsetDateTime creationTime) { + public BlobProperties setCreationTime(OffsetDateTime creationTime) { if (creationTime == null) { this.creationTime = null; } else { @@ -238,11 +238,11 @@ public BlobProperties creationTime(OffsetDateTime creationTime) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -251,7 +251,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the BlobProperties object itself. */ - public BlobProperties lastModified(OffsetDateTime lastModified) { + public BlobProperties setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -265,7 +265,7 @@ public BlobProperties lastModified(OffsetDateTime lastModified) { * * @return the etag value. */ - public String etag() { + public String getEtag() { return this.etag; } @@ -275,7 +275,7 @@ public String etag() { * @param etag the etag value to set. * @return the BlobProperties object itself. */ - public BlobProperties etag(String etag) { + public BlobProperties setEtag(String etag) { this.etag = etag; return this; } @@ -285,7 +285,7 @@ public BlobProperties etag(String etag) { * * @return the contentLength value. */ - public Long contentLength() { + public Long getContentLength() { return this.contentLength; } @@ -295,7 +295,7 @@ public Long contentLength() { * @param contentLength the contentLength value to set. * @return the BlobProperties object itself. */ - public BlobProperties contentLength(Long contentLength) { + public BlobProperties setContentLength(Long contentLength) { this.contentLength = contentLength; return this; } @@ -305,7 +305,7 @@ public BlobProperties contentLength(Long contentLength) { * * @return the contentType value. */ - public String contentType() { + public String getContentType() { return this.contentType; } @@ -315,7 +315,7 @@ public String contentType() { * @param contentType the contentType value to set. * @return the BlobProperties object itself. */ - public BlobProperties contentType(String contentType) { + public BlobProperties setContentType(String contentType) { this.contentType = contentType; return this; } @@ -325,7 +325,7 @@ public BlobProperties contentType(String contentType) { * * @return the contentEncoding value. */ - public String contentEncoding() { + public String getContentEncoding() { return this.contentEncoding; } @@ -335,7 +335,7 @@ public String contentEncoding() { * @param contentEncoding the contentEncoding value to set. * @return the BlobProperties object itself. */ - public BlobProperties contentEncoding(String contentEncoding) { + public BlobProperties setContentEncoding(String contentEncoding) { this.contentEncoding = contentEncoding; return this; } @@ -345,7 +345,7 @@ public BlobProperties contentEncoding(String contentEncoding) { * * @return the contentLanguage value. */ - public String contentLanguage() { + public String getContentLanguage() { return this.contentLanguage; } @@ -355,7 +355,7 @@ public String contentLanguage() { * @param contentLanguage the contentLanguage value to set. * @return the BlobProperties object itself. */ - public BlobProperties contentLanguage(String contentLanguage) { + public BlobProperties setContentLanguage(String contentLanguage) { this.contentLanguage = contentLanguage; return this; } @@ -365,7 +365,7 @@ public BlobProperties contentLanguage(String contentLanguage) { * * @return the contentMD5 value. */ - public byte[] contentMD5() { + public byte[] getContentMD5() { return ImplUtils.clone(this.contentMD5); } @@ -375,7 +375,7 @@ public byte[] contentMD5() { * @param contentMD5 the contentMD5 value to set. * @return the BlobProperties object itself. */ - public BlobProperties contentMD5(byte[] contentMD5) { + public BlobProperties setContentMD5(byte[] contentMD5) { this.contentMD5 = ImplUtils.clone(contentMD5); return this; } @@ -385,7 +385,7 @@ public BlobProperties contentMD5(byte[] contentMD5) { * * @return the contentDisposition value. */ - public String contentDisposition() { + public String getContentDisposition() { return this.contentDisposition; } @@ -395,7 +395,7 @@ public String contentDisposition() { * @param contentDisposition the contentDisposition value to set. * @return the BlobProperties object itself. */ - public BlobProperties contentDisposition(String contentDisposition) { + public BlobProperties setContentDisposition(String contentDisposition) { this.contentDisposition = contentDisposition; return this; } @@ -405,7 +405,7 @@ public BlobProperties contentDisposition(String contentDisposition) { * * @return the cacheControl value. */ - public String cacheControl() { + public String getCacheControl() { return this.cacheControl; } @@ -415,7 +415,7 @@ public String cacheControl() { * @param cacheControl the cacheControl value to set. * @return the BlobProperties object itself. */ - public BlobProperties cacheControl(String cacheControl) { + public BlobProperties setCacheControl(String cacheControl) { this.cacheControl = cacheControl; return this; } @@ -425,7 +425,7 @@ public BlobProperties cacheControl(String cacheControl) { * * @return the blobSequenceNumber value. */ - public Long blobSequenceNumber() { + public Long getBlobSequenceNumber() { return this.blobSequenceNumber; } @@ -435,7 +435,7 @@ public Long blobSequenceNumber() { * @param blobSequenceNumber the blobSequenceNumber value to set. * @return the BlobProperties object itself. */ - public BlobProperties blobSequenceNumber(Long blobSequenceNumber) { + public BlobProperties setBlobSequenceNumber(Long blobSequenceNumber) { this.blobSequenceNumber = blobSequenceNumber; return this; } @@ -446,7 +446,7 @@ public BlobProperties blobSequenceNumber(Long blobSequenceNumber) { * * @return the blobType value. */ - public BlobType blobType() { + public BlobType getBlobType() { return this.blobType; } @@ -457,7 +457,7 @@ public BlobType blobType() { * @param blobType the blobType value to set. * @return the BlobProperties object itself. */ - public BlobProperties blobType(BlobType blobType) { + public BlobProperties setBlobType(BlobType blobType) { this.blobType = blobType; return this; } @@ -468,7 +468,7 @@ public BlobProperties blobType(BlobType blobType) { * * @return the leaseStatus value. */ - public LeaseStatusType leaseStatus() { + public LeaseStatusType getLeaseStatus() { return this.leaseStatus; } @@ -479,7 +479,7 @@ public LeaseStatusType leaseStatus() { * @param leaseStatus the leaseStatus value to set. * @return the BlobProperties object itself. */ - public BlobProperties leaseStatus(LeaseStatusType leaseStatus) { + public BlobProperties setLeaseStatus(LeaseStatusType leaseStatus) { this.leaseStatus = leaseStatus; return this; } @@ -490,7 +490,7 @@ public BlobProperties leaseStatus(LeaseStatusType leaseStatus) { * * @return the leaseState value. */ - public LeaseStateType leaseState() { + public LeaseStateType getLeaseState() { return this.leaseState; } @@ -501,7 +501,7 @@ public LeaseStateType leaseState() { * @param leaseState the leaseState value to set. * @return the BlobProperties object itself. */ - public BlobProperties leaseState(LeaseStateType leaseState) { + public BlobProperties setLeaseState(LeaseStateType leaseState) { this.leaseState = leaseState; return this; } @@ -512,7 +512,7 @@ public BlobProperties leaseState(LeaseStateType leaseState) { * * @return the leaseDuration value. */ - public LeaseDurationType leaseDuration() { + public LeaseDurationType getLeaseDuration() { return this.leaseDuration; } @@ -523,7 +523,7 @@ public LeaseDurationType leaseDuration() { * @param leaseDuration the leaseDuration value to set. * @return the BlobProperties object itself. */ - public BlobProperties leaseDuration(LeaseDurationType leaseDuration) { + public BlobProperties setLeaseDuration(LeaseDurationType leaseDuration) { this.leaseDuration = leaseDuration; return this; } @@ -533,7 +533,7 @@ public BlobProperties leaseDuration(LeaseDurationType leaseDuration) { * * @return the copyId value. */ - public String copyId() { + public String getCopyId() { return this.copyId; } @@ -543,7 +543,7 @@ public String copyId() { * @param copyId the copyId value to set. * @return the BlobProperties object itself. */ - public BlobProperties copyId(String copyId) { + public BlobProperties setCopyId(String copyId) { this.copyId = copyId; return this; } @@ -554,7 +554,7 @@ public BlobProperties copyId(String copyId) { * * @return the copyStatus value. */ - public CopyStatusType copyStatus() { + public CopyStatusType getCopyStatus() { return this.copyStatus; } @@ -565,7 +565,7 @@ public CopyStatusType copyStatus() { * @param copyStatus the copyStatus value to set. * @return the BlobProperties object itself. */ - public BlobProperties copyStatus(CopyStatusType copyStatus) { + public BlobProperties setCopyStatus(CopyStatusType copyStatus) { this.copyStatus = copyStatus; return this; } @@ -575,7 +575,7 @@ public BlobProperties copyStatus(CopyStatusType copyStatus) { * * @return the copySource value. */ - public String copySource() { + public String getCopySource() { return this.copySource; } @@ -585,7 +585,7 @@ public String copySource() { * @param copySource the copySource value to set. * @return the BlobProperties object itself. */ - public BlobProperties copySource(String copySource) { + public BlobProperties setCopySource(String copySource) { this.copySource = copySource; return this; } @@ -595,7 +595,7 @@ public BlobProperties copySource(String copySource) { * * @return the copyProgress value. */ - public String copyProgress() { + public String getCopyProgress() { return this.copyProgress; } @@ -605,7 +605,7 @@ public String copyProgress() { * @param copyProgress the copyProgress value to set. * @return the BlobProperties object itself. */ - public BlobProperties copyProgress(String copyProgress) { + public BlobProperties setCopyProgress(String copyProgress) { this.copyProgress = copyProgress; return this; } @@ -615,11 +615,11 @@ public BlobProperties copyProgress(String copyProgress) { * * @return the copyCompletionTime value. */ - public OffsetDateTime copyCompletionTime() { + public OffsetDateTime getCopyCompletionTime() { if (this.copyCompletionTime == null) { return null; } - return this.copyCompletionTime.dateTime(); + return this.copyCompletionTime.getDateTime(); } /** @@ -628,7 +628,7 @@ public OffsetDateTime copyCompletionTime() { * @param copyCompletionTime the copyCompletionTime value to set. * @return the BlobProperties object itself. */ - public BlobProperties copyCompletionTime(OffsetDateTime copyCompletionTime) { + public BlobProperties setCopyCompletionTime(OffsetDateTime copyCompletionTime) { if (copyCompletionTime == null) { this.copyCompletionTime = null; } else { @@ -643,7 +643,7 @@ public BlobProperties copyCompletionTime(OffsetDateTime copyCompletionTime) { * * @return the copyStatusDescription value. */ - public String copyStatusDescription() { + public String getCopyStatusDescription() { return this.copyStatusDescription; } @@ -654,7 +654,7 @@ public String copyStatusDescription() { * @param copyStatusDescription the copyStatusDescription value to set. * @return the BlobProperties object itself. */ - public BlobProperties copyStatusDescription(String copyStatusDescription) { + public BlobProperties setCopyStatusDescription(String copyStatusDescription) { this.copyStatusDescription = copyStatusDescription; return this; } @@ -664,7 +664,7 @@ public BlobProperties copyStatusDescription(String copyStatusDescription) { * * @return the serverEncrypted value. */ - public Boolean serverEncrypted() { + public Boolean isServerEncrypted() { return this.serverEncrypted; } @@ -674,7 +674,7 @@ public Boolean serverEncrypted() { * @param serverEncrypted the serverEncrypted value to set. * @return the BlobProperties object itself. */ - public BlobProperties serverEncrypted(Boolean serverEncrypted) { + public BlobProperties setServerEncrypted(Boolean serverEncrypted) { this.serverEncrypted = serverEncrypted; return this; } @@ -684,7 +684,7 @@ public BlobProperties serverEncrypted(Boolean serverEncrypted) { * * @return the incrementalCopy value. */ - public Boolean incrementalCopy() { + public Boolean isIncrementalCopy() { return this.incrementalCopy; } @@ -694,7 +694,7 @@ public Boolean incrementalCopy() { * @param incrementalCopy the incrementalCopy value to set. * @return the BlobProperties object itself. */ - public BlobProperties incrementalCopy(Boolean incrementalCopy) { + public BlobProperties setIncrementalCopy(Boolean incrementalCopy) { this.incrementalCopy = incrementalCopy; return this; } @@ -704,7 +704,7 @@ public BlobProperties incrementalCopy(Boolean incrementalCopy) { * * @return the destinationSnapshot value. */ - public String destinationSnapshot() { + public String getDestinationSnapshot() { return this.destinationSnapshot; } @@ -714,7 +714,7 @@ public String destinationSnapshot() { * @param destinationSnapshot the destinationSnapshot value to set. * @return the BlobProperties object itself. */ - public BlobProperties destinationSnapshot(String destinationSnapshot) { + public BlobProperties setDestinationSnapshot(String destinationSnapshot) { this.destinationSnapshot = destinationSnapshot; return this; } @@ -724,11 +724,11 @@ public BlobProperties destinationSnapshot(String destinationSnapshot) { * * @return the deletedTime value. */ - public OffsetDateTime deletedTime() { + public OffsetDateTime getDeletedTime() { if (this.deletedTime == null) { return null; } - return this.deletedTime.dateTime(); + return this.deletedTime.getDateTime(); } /** @@ -737,7 +737,7 @@ public OffsetDateTime deletedTime() { * @param deletedTime the deletedTime value to set. * @return the BlobProperties object itself. */ - public BlobProperties deletedTime(OffsetDateTime deletedTime) { + public BlobProperties setDeletedTime(OffsetDateTime deletedTime) { if (deletedTime == null) { this.deletedTime = null; } else { @@ -752,7 +752,7 @@ public BlobProperties deletedTime(OffsetDateTime deletedTime) { * * @return the remainingRetentionDays value. */ - public Integer remainingRetentionDays() { + public Integer getRemainingRetentionDays() { return this.remainingRetentionDays; } @@ -763,29 +763,31 @@ public Integer remainingRetentionDays() { * @param remainingRetentionDays the remainingRetentionDays value to set. * @return the BlobProperties object itself. */ - public BlobProperties remainingRetentionDays(Integer remainingRetentionDays) { + public BlobProperties setRemainingRetentionDays(Integer remainingRetentionDays) { this.remainingRetentionDays = remainingRetentionDays; return this; } /** * Get the accessTier property: Possible values include: 'P4', 'P6', 'P10', - * 'P20', 'P30', 'P40', 'P50', 'Hot', 'Cool', 'Archive'. + * 'P15', 'P20', 'P30', 'P40', 'P50', 'P60', 'P70', 'P80', 'Hot', 'Cool', + * 'Archive'. * * @return the accessTier value. */ - public AccessTier accessTier() { + public AccessTier getAccessTier() { return this.accessTier; } /** * Set the accessTier property: Possible values include: 'P4', 'P6', 'P10', - * 'P20', 'P30', 'P40', 'P50', 'Hot', 'Cool', 'Archive'. + * 'P15', 'P20', 'P30', 'P40', 'P50', 'P60', 'P70', 'P80', 'Hot', 'Cool', + * 'Archive'. * * @param accessTier the accessTier value to set. * @return the BlobProperties object itself. */ - public BlobProperties accessTier(AccessTier accessTier) { + public BlobProperties setAccessTier(AccessTier accessTier) { this.accessTier = accessTier; return this; } @@ -795,7 +797,7 @@ public BlobProperties accessTier(AccessTier accessTier) { * * @return the accessTierInferred value. */ - public Boolean accessTierInferred() { + public Boolean isAccessTierInferred() { return this.accessTierInferred; } @@ -805,7 +807,7 @@ public Boolean accessTierInferred() { * @param accessTierInferred the accessTierInferred value to set. * @return the BlobProperties object itself. */ - public BlobProperties accessTierInferred(Boolean accessTierInferred) { + public BlobProperties setAccessTierInferred(Boolean accessTierInferred) { this.accessTierInferred = accessTierInferred; return this; } @@ -816,7 +818,7 @@ public BlobProperties accessTierInferred(Boolean accessTierInferred) { * * @return the archiveStatus value. */ - public ArchiveStatus archiveStatus() { + public ArchiveStatus getArchiveStatus() { return this.archiveStatus; } @@ -827,7 +829,7 @@ public ArchiveStatus archiveStatus() { * @param archiveStatus the archiveStatus value to set. * @return the BlobProperties object itself. */ - public BlobProperties archiveStatus(ArchiveStatus archiveStatus) { + public BlobProperties setArchiveStatus(ArchiveStatus archiveStatus) { this.archiveStatus = archiveStatus; return this; } @@ -838,7 +840,7 @@ public BlobProperties archiveStatus(ArchiveStatus archiveStatus) { * * @return the customerProvidedKeySha256 value. */ - public String customerProvidedKeySha256() { + public String getCustomerProvidedKeySha256() { return this.customerProvidedKeySha256; } @@ -850,7 +852,7 @@ public String customerProvidedKeySha256() { * set. * @return the BlobProperties object itself. */ - public BlobProperties customerProvidedKeySha256(String customerProvidedKeySha256) { + public BlobProperties setCustomerProvidedKeySha256(String customerProvidedKeySha256) { this.customerProvidedKeySha256 = customerProvidedKeySha256; return this; } @@ -861,11 +863,11 @@ public BlobProperties customerProvidedKeySha256(String customerProvidedKeySha256 * * @return the accessTierChangeTime value. */ - public OffsetDateTime accessTierChangeTime() { + public OffsetDateTime getAccessTierChangeTime() { if (this.accessTierChangeTime == null) { return null; } - return this.accessTierChangeTime.dateTime(); + return this.accessTierChangeTime.getDateTime(); } /** @@ -875,7 +877,7 @@ public OffsetDateTime accessTierChangeTime() { * @param accessTierChangeTime the accessTierChangeTime value to set. * @return the BlobProperties object itself. */ - public BlobProperties accessTierChangeTime(OffsetDateTime accessTierChangeTime) { + public BlobProperties setAccessTierChangeTime(OffsetDateTime accessTierChangeTime) { if (accessTierChangeTime == null) { this.accessTierChangeTime = null; } else { diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobRange.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobRange.java index f39278c25512..70ff8001ee67 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobRange.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobRange.java @@ -14,34 +14,34 @@ public final class BlobRange { private static final String RANGE_HEADER_FORMAT = "bytes=%d-%d"; private static final String BEGIN_RANGE_HEADER_FORMAT = "bytes=%d-"; - private long offset; - private Long count; + private final long offset; + private final Long count; /** - * Specifies the download operation to start from the offset position (zero-based) and download the - * rest of the entire blob to the end. + * Specifies the download operation to start from the offset position (zero-based) and download the rest of the + * entire blob to the end. * - * @param offset - * the zero-based position to start downloading + * @param offset the zero-based position to start downloading + * @throws IllegalArgumentException If {@code offset} is less than {@code 0}. */ public BlobRange(long offset) { - if (offset < 0) { - throw new IllegalArgumentException("BlobRange offset must be greater than or equal to 0."); - } - this.offset = offset; + this(offset, null); } /** - * Specifies the download operation to start from the offset position (zero-based) and download the - * count number of bytes. + * Specifies the download operation to start from the offset position (zero-based) and download the count number of + * bytes. * - * @param offset - * the zero-based position to start downloading - * @param count - * the number of bytes to download + * @param offset the zero-based position to start downloading + * @param count the number of bytes to download + * @throws IllegalArgumentException If {@code offset} or {@code count} is less than {@code 0}. */ public BlobRange(long offset, Long count) { - this(offset); + if (offset < 0) { + throw new IllegalArgumentException("BlobRange offset must be greater than or equal to 0."); + } + this.offset = offset; + if (count != null && count < 0) { throw new IllegalArgumentException("BlobRange count must be greater than or equal to 0 if specified."); } @@ -53,7 +53,7 @@ public BlobRange(long offset, Long count) { * * @return the offset for the range */ - public long offset() { + public long getOffset() { return offset; } @@ -62,7 +62,7 @@ public long offset() { * * @return the number bytes to include in the range */ - public Long count() { + public Long getCount() { return count; } @@ -80,7 +80,8 @@ public String toString() { } /** - * @return {@link BlobRange#toString()} if {@code count} isn't {@code null} or {@code offset} isn't 0, otherwise null. + * @return {@link BlobRange#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 diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobReleaseLeaseHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobReleaseLeaseHeaders.java index f503b9ab6d30..809a95b5d2b3 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobReleaseLeaseHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobReleaseLeaseHeaders.java @@ -32,6 +32,13 @@ public final class BlobReleaseLeaseHeaders { @JsonProperty(value = "Last-Modified") private DateTimeRfc1123 lastModified; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -67,7 +74,7 @@ public final class BlobReleaseLeaseHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -79,7 +86,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the BlobReleaseLeaseHeaders object itself. */ - public BlobReleaseLeaseHeaders eTag(String eTag) { + public BlobReleaseLeaseHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -92,11 +99,11 @@ public BlobReleaseLeaseHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -108,7 +115,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the BlobReleaseLeaseHeaders object itself. */ - public BlobReleaseLeaseHeaders lastModified(OffsetDateTime lastModified) { + public BlobReleaseLeaseHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -117,13 +124,37 @@ public BlobReleaseLeaseHeaders lastModified(OffsetDateTime lastModified) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobReleaseLeaseHeaders object itself. + */ + public BlobReleaseLeaseHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -134,7 +165,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the BlobReleaseLeaseHeaders object itself. */ - public BlobReleaseLeaseHeaders requestId(String requestId) { + public BlobReleaseLeaseHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -146,7 +177,7 @@ public BlobReleaseLeaseHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -158,7 +189,7 @@ public String version() { * @param version the version value to set. * @return the BlobReleaseLeaseHeaders object itself. */ - public BlobReleaseLeaseHeaders version(String version) { + public BlobReleaseLeaseHeaders setVersion(String version) { this.version = version; return this; } @@ -169,11 +200,11 @@ public BlobReleaseLeaseHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -183,7 +214,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlobReleaseLeaseHeaders object itself. */ - public BlobReleaseLeaseHeaders dateProperty(OffsetDateTime dateProperty) { + public BlobReleaseLeaseHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -197,7 +228,7 @@ public BlobReleaseLeaseHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -207,7 +238,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the BlobReleaseLeaseHeaders object itself. */ - public BlobReleaseLeaseHeaders errorCode(String errorCode) { + public BlobReleaseLeaseHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobRenameHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobRenameHeaders.java new file mode 100644 index 000000000000..c547dc748c6f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobRenameHeaders.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for Rename operation. + */ +@JacksonXmlRootElement(localName = "Blob-Rename-Headers") +@Fluent +public final class BlobRenameHeaders { + /* + * An HTTP entity tag associated with the file or directory. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /* + * The data and time the file or directory was last modified. Write + * operations on the file or directory update the last modified time. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + + /* + * A server-generated UUID recorded in the analytics logs for + * troubleshooting and correlation. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * The version of the REST protocol used to process the request. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * The size of the resource in bytes. + */ + @JsonProperty(value = "Content-Length") + private Long contentLength; + + /* + * A UTC date/time value generated by the service that indicates the time + * at which the response was initiated. + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /** + * Get the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @param eTag the eTag value to set. + * @return the BlobRenameHeaders object itself. + */ + public BlobRenameHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @param lastModified the lastModified value to set. + * @return the BlobRenameHeaders object itself. + */ + public BlobRenameHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobRenameHeaders object itself. + */ + public BlobRenameHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @return the requestId value. + */ + public String getRequestId() { + return this.requestId; + } + + /** + * Set the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @param requestId the requestId value to set. + * @return the BlobRenameHeaders object itself. + */ + public BlobRenameHeaders setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: The version of the REST protocol used to + * process the request. + * + * @return the version value. + */ + public String getVersion() { + return this.version; + } + + /** + * Set the version property: The version of the REST protocol used to + * process the request. + * + * @param version the version value to set. + * @return the BlobRenameHeaders object itself. + */ + public BlobRenameHeaders setVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the contentLength property: The size of the resource in bytes. + * + * @return the contentLength value. + */ + public Long getContentLength() { + return this.contentLength; + } + + /** + * Set the contentLength property: The size of the resource in bytes. + * + * @param contentLength the contentLength value to set. + * @return the BlobRenameHeaders object itself. + */ + public BlobRenameHeaders setContentLength(Long contentLength) { + this.contentLength = contentLength; + return this; + } + + /** + * Get the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime getDateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.getDateTime(); + } + + /** + * Set the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the BlobRenameHeaders object itself. + */ + public BlobRenameHeaders setDateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobRenewLeaseHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobRenewLeaseHeaders.java index 863157cf8a42..e850669c660d 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobRenewLeaseHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobRenewLeaseHeaders.java @@ -38,6 +38,13 @@ public final class BlobRenewLeaseHeaders { @JsonProperty(value = "x-ms-lease-id") private String leaseId; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -73,7 +80,7 @@ public final class BlobRenewLeaseHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -85,7 +92,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the BlobRenewLeaseHeaders object itself. */ - public BlobRenewLeaseHeaders eTag(String eTag) { + public BlobRenewLeaseHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -98,11 +105,11 @@ public BlobRenewLeaseHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -114,7 +121,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the BlobRenewLeaseHeaders object itself. */ - public BlobRenewLeaseHeaders lastModified(OffsetDateTime lastModified) { + public BlobRenewLeaseHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -128,7 +135,7 @@ public BlobRenewLeaseHeaders lastModified(OffsetDateTime lastModified) { * * @return the leaseId value. */ - public String leaseId() { + public String getLeaseId() { return this.leaseId; } @@ -138,18 +145,42 @@ public String leaseId() { * @param leaseId the leaseId value to set. * @return the BlobRenewLeaseHeaders object itself. */ - public BlobRenewLeaseHeaders leaseId(String leaseId) { + public BlobRenewLeaseHeaders setLeaseId(String leaseId) { this.leaseId = leaseId; return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobRenewLeaseHeaders object itself. + */ + public BlobRenewLeaseHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -160,7 +191,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the BlobRenewLeaseHeaders object itself. */ - public BlobRenewLeaseHeaders requestId(String requestId) { + public BlobRenewLeaseHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -172,7 +203,7 @@ public BlobRenewLeaseHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -184,7 +215,7 @@ public String version() { * @param version the version value to set. * @return the BlobRenewLeaseHeaders object itself. */ - public BlobRenewLeaseHeaders version(String version) { + public BlobRenewLeaseHeaders setVersion(String version) { this.version = version; return this; } @@ -195,11 +226,11 @@ public BlobRenewLeaseHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -209,7 +240,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlobRenewLeaseHeaders object itself. */ - public BlobRenewLeaseHeaders dateProperty(OffsetDateTime dateProperty) { + public BlobRenewLeaseHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -223,7 +254,7 @@ public BlobRenewLeaseHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -233,7 +264,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the BlobRenewLeaseHeaders object itself. */ - public BlobRenewLeaseHeaders errorCode(String errorCode) { + public BlobRenewLeaseHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetAccessControlHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetAccessControlHeaders.java new file mode 100644 index 000000000000..de7582f47748 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetAccessControlHeaders.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for SetAccessControl operation. + */ +@JacksonXmlRootElement(localName = "Blob-SetAccessControl-Headers") +@Fluent +public final class BlobSetAccessControlHeaders { + /* + * A UTC date/time value generated by the service that indicates the time + * at which the response was initiated. + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /* + * An HTTP entity tag associated with the file or directory. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /* + * The data and time the file or directory was last modified. Write + * operations on the file or directory update the last modified time. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /* + * A server-generated UUID recorded in the analytics logs for + * troubleshooting and correlation. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * The version of the REST protocol used to process the request. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + + /** + * Get the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime getDateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.getDateTime(); + } + + /** + * Set the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the BlobSetAccessControlHeaders object itself. + */ + public BlobSetAccessControlHeaders setDateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } + + /** + * Get the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @param eTag the eTag value to set. + * @return the BlobSetAccessControlHeaders object itself. + */ + public BlobSetAccessControlHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @param lastModified the lastModified value to set. + * @return the BlobSetAccessControlHeaders object itself. + */ + public BlobSetAccessControlHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @return the requestId value. + */ + public String getRequestId() { + return this.requestId; + } + + /** + * Set the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @param requestId the requestId value to set. + * @return the BlobSetAccessControlHeaders object itself. + */ + public BlobSetAccessControlHeaders setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: The version of the REST protocol used to + * process the request. + * + * @return the version value. + */ + public String getVersion() { + return this.version; + } + + /** + * Set the version property: The version of the REST protocol used to + * process the request. + * + * @param version the version value to set. + * @return the BlobSetAccessControlHeaders object itself. + */ + public BlobSetAccessControlHeaders setVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobSetAccessControlHeaders object itself. + */ + public BlobSetAccessControlHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetHTTPHeadersHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetHTTPHeadersHeaders.java index ed539d644bc1..4f4011cef055 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetHTTPHeadersHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetHTTPHeadersHeaders.java @@ -39,6 +39,13 @@ public final class BlobSetHTTPHeadersHeaders { @JsonProperty(value = "x-ms-blob-sequence-number") private Long blobSequenceNumber; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -74,7 +81,7 @@ public final class BlobSetHTTPHeadersHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -86,7 +93,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the BlobSetHTTPHeadersHeaders object itself. */ - public BlobSetHTTPHeadersHeaders eTag(String eTag) { + public BlobSetHTTPHeadersHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -99,11 +106,11 @@ public BlobSetHTTPHeadersHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -115,7 +122,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the BlobSetHTTPHeadersHeaders object itself. */ - public BlobSetHTTPHeadersHeaders lastModified(OffsetDateTime lastModified) { + public BlobSetHTTPHeadersHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -130,7 +137,7 @@ public BlobSetHTTPHeadersHeaders lastModified(OffsetDateTime lastModified) { * * @return the blobSequenceNumber value. */ - public Long blobSequenceNumber() { + public Long getBlobSequenceNumber() { return this.blobSequenceNumber; } @@ -141,18 +148,42 @@ public Long blobSequenceNumber() { * @param blobSequenceNumber the blobSequenceNumber value to set. * @return the BlobSetHTTPHeadersHeaders object itself. */ - public BlobSetHTTPHeadersHeaders blobSequenceNumber(Long blobSequenceNumber) { + public BlobSetHTTPHeadersHeaders setBlobSequenceNumber(Long blobSequenceNumber) { this.blobSequenceNumber = blobSequenceNumber; return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobSetHTTPHeadersHeaders object itself. + */ + public BlobSetHTTPHeadersHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -163,7 +194,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the BlobSetHTTPHeadersHeaders object itself. */ - public BlobSetHTTPHeadersHeaders requestId(String requestId) { + public BlobSetHTTPHeadersHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -175,7 +206,7 @@ public BlobSetHTTPHeadersHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -187,7 +218,7 @@ public String version() { * @param version the version value to set. * @return the BlobSetHTTPHeadersHeaders object itself. */ - public BlobSetHTTPHeadersHeaders version(String version) { + public BlobSetHTTPHeadersHeaders setVersion(String version) { this.version = version; return this; } @@ -198,11 +229,11 @@ public BlobSetHTTPHeadersHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -212,7 +243,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlobSetHTTPHeadersHeaders object itself. */ - public BlobSetHTTPHeadersHeaders dateProperty(OffsetDateTime dateProperty) { + public BlobSetHTTPHeadersHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -226,7 +257,7 @@ public BlobSetHTTPHeadersHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -236,7 +267,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the BlobSetHTTPHeadersHeaders object itself. */ - public BlobSetHTTPHeadersHeaders errorCode(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/models/BlobSetMetadataHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetMetadataHeaders.java index 5b3898194287..4a13e8c34cf9 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetMetadataHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetMetadataHeaders.java @@ -32,6 +32,13 @@ public final class BlobSetMetadataHeaders { @JsonProperty(value = "Last-Modified") private DateTimeRfc1123 lastModified; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -83,7 +90,7 @@ public final class BlobSetMetadataHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -95,7 +102,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the BlobSetMetadataHeaders object itself. */ - public BlobSetMetadataHeaders eTag(String eTag) { + public BlobSetMetadataHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -108,11 +115,11 @@ public BlobSetMetadataHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -124,7 +131,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the BlobSetMetadataHeaders object itself. */ - public BlobSetMetadataHeaders lastModified(OffsetDateTime lastModified) { + public BlobSetMetadataHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -133,13 +140,37 @@ public BlobSetMetadataHeaders lastModified(OffsetDateTime lastModified) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobSetMetadataHeaders object itself. + */ + public BlobSetMetadataHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -150,7 +181,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the BlobSetMetadataHeaders object itself. */ - public BlobSetMetadataHeaders requestId(String requestId) { + public BlobSetMetadataHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -162,7 +193,7 @@ public BlobSetMetadataHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -174,7 +205,7 @@ public String version() { * @param version the version value to set. * @return the BlobSetMetadataHeaders object itself. */ - public BlobSetMetadataHeaders version(String version) { + public BlobSetMetadataHeaders setVersion(String version) { this.version = version; return this; } @@ -185,11 +216,11 @@ public BlobSetMetadataHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -199,7 +230,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlobSetMetadataHeaders object itself. */ - public BlobSetMetadataHeaders dateProperty(OffsetDateTime dateProperty) { + public BlobSetMetadataHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -227,7 +258,7 @@ public Boolean isServerEncrypted() { * @param isServerEncrypted the isServerEncrypted value to set. * @return the BlobSetMetadataHeaders object itself. */ - public BlobSetMetadataHeaders isServerEncrypted(Boolean isServerEncrypted) { + public BlobSetMetadataHeaders setIsServerEncrypted(Boolean isServerEncrypted) { this.isServerEncrypted = isServerEncrypted; return this; } @@ -239,7 +270,7 @@ public BlobSetMetadataHeaders isServerEncrypted(Boolean isServerEncrypted) { * * @return the encryptionKeySha256 value. */ - public String encryptionKeySha256() { + public String getEncryptionKeySha256() { return this.encryptionKeySha256; } @@ -251,7 +282,7 @@ public String encryptionKeySha256() { * @param encryptionKeySha256 the encryptionKeySha256 value to set. * @return the BlobSetMetadataHeaders object itself. */ - public BlobSetMetadataHeaders encryptionKeySha256(String encryptionKeySha256) { + public BlobSetMetadataHeaders setEncryptionKeySha256(String encryptionKeySha256) { this.encryptionKeySha256 = encryptionKeySha256; return this; } @@ -261,7 +292,7 @@ public BlobSetMetadataHeaders encryptionKeySha256(String encryptionKeySha256) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -271,7 +302,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the BlobSetMetadataHeaders object itself. */ - public BlobSetMetadataHeaders errorCode(String errorCode) { + public BlobSetMetadataHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetTagsHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetTagsHeaders.java new file mode 100644 index 000000000000..0fc25e220314 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetTagsHeaders.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for SetTags operation. + */ +@JacksonXmlRootElement(localName = "Blob-SetTags-Headers") +@Fluent +public final class BlobSetTagsHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + + /* + * This header uniquely identifies the request that was made and can be + * used for troubleshooting the request. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * Indicates the version of the Blob service used to execute the request. + * This header is returned for requests made against version 2009-09-19 and + * above. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * UTC date/time value generated by the service that indicates the time at + * which the response was initiated + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /* + * The errorCode property. + */ + @JsonProperty(value = "x-ms-error-code") + private String errorCode; + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobSetTagsHeaders object itself. + */ + public BlobSetTagsHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get the requestId property: This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @return the requestId value. + */ + public String requestId() { + return this.requestId; + } + + /** + * Set the requestId property: This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @param requestId the requestId value to set. + * @return the BlobSetTagsHeaders object itself. + */ + public BlobSetTagsHeaders requestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: Indicates the version of the Blob service used + * to execute the request. This header is returned for requests made + * against version 2009-09-19 and above. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Indicates the version of the Blob service used + * to execute the request. This header is returned for requests made + * against version 2009-09-19 and above. + * + * @param version the version value to set. + * @return the BlobSetTagsHeaders object itself. + */ + public BlobSetTagsHeaders version(String version) { + this.version = version; + return this; + } + + /** + * Get the dateProperty property: UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.getDateTime(); + } + + /** + * Set the dateProperty property: UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the BlobSetTagsHeaders object itself. + */ + public BlobSetTagsHeaders dateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } + + /** + * Get the errorCode property: The errorCode property. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Set the errorCode property: The errorCode property. + * + * @param errorCode the errorCode value to set. + * @return the BlobSetTagsHeaders object itself. + */ + public BlobSetTagsHeaders errorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetTierHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetTierHeaders.java index 372b1a09ebc0..ed3596942344 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetTierHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetTierHeaders.java @@ -14,6 +14,13 @@ @JacksonXmlRootElement(localName = "Blob-SetTier-Headers") @Fluent public final class BlobSetTierHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -35,13 +42,37 @@ public final class BlobSetTierHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobSetTierHeaders object itself. + */ + public BlobSetTierHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -52,7 +83,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the BlobSetTierHeaders object itself. */ - public BlobSetTierHeaders requestId(String requestId) { + public BlobSetTierHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -64,7 +95,7 @@ public BlobSetTierHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -76,7 +107,7 @@ public String version() { * @param version the version value to set. * @return the BlobSetTierHeaders object itself. */ - public BlobSetTierHeaders version(String version) { + public BlobSetTierHeaders setVersion(String version) { this.version = version; return this; } @@ -86,7 +117,7 @@ public BlobSetTierHeaders version(String version) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -96,7 +127,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the BlobSetTierHeaders object itself. */ - public BlobSetTierHeaders errorCode(String errorCode) { + public BlobSetTierHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobStartCopyFromURLHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobStartCopyFromURLHeaders.java index a6b195a6e6dc..821ae5d91189 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobStartCopyFromURLHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobStartCopyFromURLHeaders.java @@ -32,6 +32,13 @@ public final class BlobStartCopyFromURLHeaders { @JsonProperty(value = "Last-Modified") private DateTimeRfc1123 lastModified; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -47,14 +54,6 @@ public final class BlobStartCopyFromURLHeaders { @JsonProperty(value = "x-ms-version") private String version; - /* - * UTC date/time value generated by the service that identifies the version - * of the blob. This header is returned for requests made against version - * 2018-11-09 and above. - */ - @JsonProperty(value = "x-ms-version-id") - private String versionId; - /* * UTC date/time value generated by the service that indicates the time at * which the response was initiated @@ -77,6 +76,14 @@ public final class BlobStartCopyFromURLHeaders { @JsonProperty(value = "x-ms-copy-status") private CopyStatusType copyStatus; + /* + * UTC date/time value generated by the service that identifies the version + * of the blob. This header is returned for requests made against version + * 2018-11-09 and above. + */ + @JsonProperty(value = "x-ms-version-id") + private String versionId; + /* * The errorCode property. */ @@ -90,7 +97,7 @@ public final class BlobStartCopyFromURLHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -102,7 +109,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the BlobStartCopyFromURLHeaders object itself. */ - public BlobStartCopyFromURLHeaders eTag(String eTag) { + public BlobStartCopyFromURLHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -115,11 +122,11 @@ public BlobStartCopyFromURLHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -131,7 +138,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the BlobStartCopyFromURLHeaders object itself. */ - public BlobStartCopyFromURLHeaders lastModified(OffsetDateTime lastModified) { + public BlobStartCopyFromURLHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -140,13 +147,37 @@ public BlobStartCopyFromURLHeaders lastModified(OffsetDateTime lastModified) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobStartCopyFromURLHeaders object itself. + */ + public BlobStartCopyFromURLHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -157,7 +188,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the BlobStartCopyFromURLHeaders object itself. */ - public BlobStartCopyFromURLHeaders requestId(String requestId) { + public BlobStartCopyFromURLHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -169,7 +200,7 @@ public BlobStartCopyFromURLHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -181,46 +212,22 @@ public String version() { * @param version the version value to set. * @return the BlobStartCopyFromURLHeaders object itself. */ - public BlobStartCopyFromURLHeaders version(String version) { + public BlobStartCopyFromURLHeaders setVersion(String version) { this.version = version; return this; } - /** - * Get the versionId property: UTC date/time value generated by the service - * that identifies the version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @return the versionId value. - */ - public String versionId() { - return this.versionId; - } - - /** - * Set the versionId property: UTC date/time value generated by the service - * that identifies the version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @param versionId the versionId value to set. - * @return the BlobStartCopyFromURLHeaders object itself. - */ - public BlobStartCopyFromURLHeaders versionId(String versionId) { - this.versionId = versionId; - return this; - } - /** * Get the dateProperty property: UTC date/time value generated by the * service that indicates the time at which the response was initiated. * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -230,7 +237,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlobStartCopyFromURLHeaders object itself. */ - public BlobStartCopyFromURLHeaders dateProperty(OffsetDateTime dateProperty) { + public BlobStartCopyFromURLHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -246,7 +253,7 @@ public BlobStartCopyFromURLHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the copyId value. */ - public String copyId() { + public String getCopyId() { return this.copyId; } @@ -258,7 +265,7 @@ public String copyId() { * @param copyId the copyId value to set. * @return the BlobStartCopyFromURLHeaders object itself. */ - public BlobStartCopyFromURLHeaders copyId(String copyId) { + public BlobStartCopyFromURLHeaders setCopyId(String copyId) { this.copyId = copyId; return this; } @@ -270,7 +277,7 @@ public BlobStartCopyFromURLHeaders copyId(String copyId) { * * @return the copyStatus value. */ - public CopyStatusType copyStatus() { + public CopyStatusType getCopyStatus() { return this.copyStatus; } @@ -282,17 +289,41 @@ public CopyStatusType copyStatus() { * @param copyStatus the copyStatus value to set. * @return the BlobStartCopyFromURLHeaders object itself. */ - public BlobStartCopyFromURLHeaders copyStatus(CopyStatusType copyStatus) { + public BlobStartCopyFromURLHeaders setCopyStatus(CopyStatusType copyStatus) { this.copyStatus = copyStatus; return this; } + /** + * Get the versionId property: UTC date/time value generated by the service + * that identifies the version of the blob. This header is returned for + * requests made against version 2018-11-09 and above. + * + * @return the versionId value. + */ + public String getVersionId() { + return this.versionId; + } + + /** + * Set the versionId property: UTC date/time value generated by the service + * that identifies the version of the blob. This header is returned for + * requests made against version 2018-11-09 and above. + * + * @param versionId the versionId value to set. + * @return the BlobStartCopyFromURLHeaders object itself. + */ + public BlobStartCopyFromURLHeaders setVersionId(String versionId) { + this.versionId = versionId; + return this; + } + /** * Get the errorCode property: The errorCode property. * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -302,7 +333,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the BlobStartCopyFromURLHeaders object itself. */ - public BlobStartCopyFromURLHeaders errorCode(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/models/BlobTags.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobTags.java new file mode 100644 index 000000000000..511b4202d2b6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobTags.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.util.ArrayList; +import java.util.List; + +/** + * XML containing key/value pairs representing the tags for the blob. + */ +@JacksonXmlRootElement(localName = "Tags") +@Fluent +public final class BlobTags { + private static final class TagSetWrapper { + @JacksonXmlProperty(localName = "Tag") + private final List items; + + @JsonCreator + private TagSetWrapper(@JacksonXmlProperty(localName = "Tag") List items) { + this.items = items; + } + } + + /* + * The tagSet property. + */ + @JsonProperty(value = "TagSet") + private TagSetWrapper tagSet; + + /** + * Get the tagSet property: The tagSet property. + * + * @return the tagSet value. + */ + public List tagSet() { + if (this.tagSet == null) { + this.tagSet = new TagSetWrapper(new ArrayList()); + } + return this.tagSet.items; + } + + /** + * Set the tagSet property: The tagSet property. + * + * @param tagSet the tagSet value to set. + * @return the BlobTags object itself. + */ + public BlobTags tagSet(List tagSet) { + this.tagSet = new TagSetWrapper(tagSet); + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobUndeleteHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobUndeleteHeaders.java index cd1ea6a55d13..39ed21aa2390 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobUndeleteHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobUndeleteHeaders.java @@ -16,6 +16,13 @@ @JacksonXmlRootElement(localName = "Blob-Undelete-Headers") @Fluent public final class BlobUndeleteHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -44,13 +51,37 @@ public final class BlobUndeleteHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlobUndeleteHeaders object itself. + */ + public BlobUndeleteHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -61,7 +92,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the BlobUndeleteHeaders object itself. */ - public BlobUndeleteHeaders requestId(String requestId) { + public BlobUndeleteHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -73,7 +104,7 @@ public BlobUndeleteHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -85,7 +116,7 @@ public String version() { * @param version the version value to set. * @return the BlobUndeleteHeaders object itself. */ - public BlobUndeleteHeaders version(String version) { + public BlobUndeleteHeaders setVersion(String version) { this.version = version; return this; } @@ -96,11 +127,11 @@ public BlobUndeleteHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -110,7 +141,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlobUndeleteHeaders object itself. */ - public BlobUndeleteHeaders dateProperty(OffsetDateTime dateProperty) { + public BlobUndeleteHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -124,7 +155,7 @@ public BlobUndeleteHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -134,7 +165,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the BlobUndeleteHeaders object itself. */ - public BlobUndeleteHeaders errorCode(String errorCode) { + public BlobUndeleteHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsDownloadResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsDownloadResponse.java index 1101ca18c80e..a08e1b290986 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsDownloadResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsDownloadResponse.java @@ -7,14 +7,14 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; -import io.netty.buffer.ByteBuf; import java.io.Closeable; +import java.nio.ByteBuffer; import reactor.core.publisher.Flux; /** * Contains all response data for the download operation. */ -public final class BlobsDownloadResponse extends ResponseBase> implements Closeable { +public final class BlobsDownloadResponse extends ResponseBase> implements Closeable { /** * Creates an instance of BlobsDownloadResponse. * @@ -24,7 +24,7 @@ public final class BlobsDownloadResponse extends ResponseBase value, BlobDownloadHeaders headers) { + public BlobsDownloadResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Flux value, BlobDownloadHeaders headers) { super(request, statusCode, rawHeaders, value, headers); } @@ -32,8 +32,8 @@ public BlobsDownloadResponse(HttpRequest request, int statusCode, HttpHeaders ra * @return the response content stream. */ @Override - public Flux value() { - return super.value(); + public Flux getValue() { + return super.getValue(); } /** @@ -41,6 +41,6 @@ public Flux value() { */ @Override public void close() { - value().subscribe(bb -> { }, t -> { }).dispose(); + getValue().subscribe(bb -> { }, t -> { }).dispose(); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsGetAccessControlResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsGetAccessControlResponse.java new file mode 100644 index 000000000000..22d187baf2be --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsGetAccessControlResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the getAccessControl operation. + */ +public final class BlobsGetAccessControlResponse extends ResponseBase { + /** + * Creates an instance of BlobsGetAccessControlResponse. + * + * @param request the request which resulted in this BlobsGetAccessControlResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public BlobsGetAccessControlResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlobGetAccessControlHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsGetTagsResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsGetTagsResponse.java new file mode 100644 index 000000000000..d605b18e0d24 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsGetTagsResponse.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the getTags operation. + */ +public final class BlobsGetTagsResponse extends ResponseBase { + /** + * Creates an instance of BlobsGetTagsResponse. + * + * @param request the request which resulted in this BlobsGetTagsResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public BlobsGetTagsResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, BlobTags value, BlobGetTagsHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * @return the deserialized response body. + */ + @Override + public BlobTags getValue() { + return super.getValue(); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsRenameResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsRenameResponse.java new file mode 100644 index 000000000000..1be4db789caa --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsRenameResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the rename operation. + */ +public final class BlobsRenameResponse extends ResponseBase { + /** + * Creates an instance of BlobsRenameResponse. + * + * @param request the request which resulted in this BlobsRenameResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public BlobsRenameResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlobRenameHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsSetAccessControlResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsSetAccessControlResponse.java new file mode 100644 index 000000000000..0f59a40bdfda --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsSetAccessControlResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the setAccessControl operation. + */ +public final class BlobsSetAccessControlResponse extends ResponseBase { + /** + * Creates an instance of BlobsSetAccessControlResponse. + * + * @param request the request which resulted in this BlobsSetAccessControlResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public BlobsSetAccessControlResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlobSetAccessControlHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsSetTagsResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsSetTagsResponse.java new file mode 100644 index 000000000000..58946c96cbb3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsSetTagsResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the setTags operation. + */ +public final class BlobsSetTagsResponse extends ResponseBase { + /** + * Creates an instance of BlobsSetTagsResponse. + * + * @param request the request which resulted in this BlobsSetTagsResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public BlobsSetTagsResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlobSetTagsHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Block.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Block.java index 5cfa164c8c85..91941c6b3eed 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Block.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Block.java @@ -32,7 +32,7 @@ public final class Block { * * @return the name value. */ - public String name() { + public String getName() { return this.name; } @@ -42,7 +42,7 @@ public String name() { * @param name the name value to set. * @return the Block object itself. */ - public Block name(String name) { + public Block setName(String name) { this.name = name; return this; } @@ -52,7 +52,7 @@ public Block name(String name) { * * @return the size value. */ - public int size() { + public int getSize() { return this.size; } @@ -62,7 +62,7 @@ public int size() { * @param size the size value to set. * @return the Block object itself. */ - public Block size(int size) { + public Block setSize(int size) { this.size = size; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobCommitBlockListHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobCommitBlockListHeaders.java index 6bec949d7180..e3b75a5568a6 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobCommitBlockListHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobCommitBlockListHeaders.java @@ -34,13 +34,28 @@ public final class BlockBlobCommitBlockListHeaders { private DateTimeRfc1123 lastModified; /* - * If the blob has an MD5 hash and this operation is to read the full blob, - * this response header is returned so that the client can check for - * message content integrity. + * This header is returned so that the client can check for message content + * integrity. This header refers to the content of the request, meaning, in + * this case, the list of blocks, and not the content of the blob itself. */ @JsonProperty(value = "Content-MD5") private byte[] contentMD5; + /* + * This header is returned so that the client can check for message content + * integrity. This header refers to the content of the request, meaning, in + * this case, the list of blocks, and not the content of the blob itself. + */ + @JsonProperty(value = "x-ms-content-crc64") + private byte[] xMsContentCrc64; + + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -56,14 +71,6 @@ public final class BlockBlobCommitBlockListHeaders { @JsonProperty(value = "x-ms-version") private String version; - /* - * UTC date/time value generated by the service that identifies a version - * of the blob. This header is returned for requests made against version - * 2018-11-09 and above. - */ - @JsonProperty(value = "x-ms-version-id") - private String versionId; - /* * UTC date/time value generated by the service that indicates the time at * which the response was initiated @@ -100,7 +107,7 @@ public final class BlockBlobCommitBlockListHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -112,7 +119,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the BlockBlobCommitBlockListHeaders object itself. */ - public BlockBlobCommitBlockListHeaders eTag(String eTag) { + public BlockBlobCommitBlockListHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -125,11 +132,11 @@ public BlockBlobCommitBlockListHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -141,7 +148,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the BlockBlobCommitBlockListHeaders object itself. */ - public BlockBlobCommitBlockListHeaders lastModified(OffsetDateTime lastModified) { + public BlockBlobCommitBlockListHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -151,36 +158,88 @@ public BlockBlobCommitBlockListHeaders lastModified(OffsetDateTime lastModified) } /** - * Get the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. + * Get the contentMD5 property: This header is returned so that the client + * can check for message content integrity. This header refers to the + * content of the request, meaning, in this case, the list of blocks, and + * not the content of the blob itself. * * @return the contentMD5 value. */ - public byte[] contentMD5() { + public byte[] getContentMD5() { return ImplUtils.clone(this.contentMD5); } /** - * Set the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. + * Set the contentMD5 property: This header is returned so that the client + * can check for message content integrity. This header refers to the + * content of the request, meaning, in this case, the list of blocks, and + * not the content of the blob itself. * * @param contentMD5 the contentMD5 value to set. * @return the BlockBlobCommitBlockListHeaders object itself. */ - public BlockBlobCommitBlockListHeaders contentMD5(byte[] contentMD5) { + public BlockBlobCommitBlockListHeaders setContentMD5(byte[] contentMD5) { this.contentMD5 = ImplUtils.clone(contentMD5); return this; } + /** + * Get the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. This header refers to + * the content of the request, meaning, in this case, the list of blocks, + * and not the content of the blob itself. + * + * @return the xMsContentCrc64 value. + */ + public byte[] getXMsContentCrc64() { + return ImplUtils.clone(this.xMsContentCrc64); + } + + /** + * Set the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. This header refers to + * the content of the request, meaning, in this case, the list of blocks, + * and not the content of the blob itself. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the BlockBlobCommitBlockListHeaders object itself. + */ + public BlockBlobCommitBlockListHeaders setXMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = ImplUtils.clone(xMsContentCrc64); + return this; + } + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlockBlobCommitBlockListHeaders object itself. + */ + public BlockBlobCommitBlockListHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -191,7 +250,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the BlockBlobCommitBlockListHeaders object itself. */ - public BlockBlobCommitBlockListHeaders requestId(String requestId) { + public BlockBlobCommitBlockListHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -203,7 +262,7 @@ public BlockBlobCommitBlockListHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -215,46 +274,22 @@ public String version() { * @param version the version value to set. * @return the BlockBlobCommitBlockListHeaders object itself. */ - public BlockBlobCommitBlockListHeaders version(String version) { + public BlockBlobCommitBlockListHeaders setVersion(String version) { this.version = version; return this; } - /** - * Get the versionId property: UTC date/time value generated by the service - * that identifies a version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @return the versionId value. - */ - public String versionId() { - return this.versionId; - } - - /** - * Set the versionId property: UTC date/time value generated by the service - * that identifies a version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @param versionId the versionId value to set. - * @return the BlockBlobCommitBlockListHeaders object itself. - */ - public BlockBlobCommitBlockListHeaders versionId(String versionId) { - this.versionId = versionId; - return this; - } - /** * Get the dateProperty property: UTC date/time value generated by the * service that indicates the time at which the response was initiated. * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -264,7 +299,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlockBlobCommitBlockListHeaders object itself. */ - public BlockBlobCommitBlockListHeaders dateProperty(OffsetDateTime dateProperty) { + public BlockBlobCommitBlockListHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -292,7 +327,7 @@ public Boolean isServerEncrypted() { * @param isServerEncrypted the isServerEncrypted value to set. * @return the BlockBlobCommitBlockListHeaders object itself. */ - public BlockBlobCommitBlockListHeaders isServerEncrypted(Boolean isServerEncrypted) { + public BlockBlobCommitBlockListHeaders setIsServerEncrypted(Boolean isServerEncrypted) { this.isServerEncrypted = isServerEncrypted; return this; } @@ -304,7 +339,7 @@ public BlockBlobCommitBlockListHeaders isServerEncrypted(Boolean isServerEncrypt * * @return the encryptionKeySha256 value. */ - public String encryptionKeySha256() { + public String getEncryptionKeySha256() { return this.encryptionKeySha256; } @@ -316,7 +351,7 @@ public String encryptionKeySha256() { * @param encryptionKeySha256 the encryptionKeySha256 value to set. * @return the BlockBlobCommitBlockListHeaders object itself. */ - public BlockBlobCommitBlockListHeaders encryptionKeySha256(String encryptionKeySha256) { + public BlockBlobCommitBlockListHeaders setEncryptionKeySha256(String encryptionKeySha256) { this.encryptionKeySha256 = encryptionKeySha256; return this; } @@ -326,7 +361,7 @@ public BlockBlobCommitBlockListHeaders encryptionKeySha256(String encryptionKeyS * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -336,7 +371,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the BlockBlobCommitBlockListHeaders object itself. */ - public BlockBlobCommitBlockListHeaders errorCode(String errorCode) { + public BlockBlobCommitBlockListHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobGetBlockListHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobGetBlockListHeaders.java index fa50d846ebef..49314e70ac7e 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobGetBlockListHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobGetBlockListHeaders.java @@ -45,6 +45,13 @@ public final class BlockBlobGetBlockListHeaders { @JsonProperty(value = "x-ms-blob-content-length") private Long blobContentLength; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -81,11 +88,11 @@ public final class BlockBlobGetBlockListHeaders { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -97,7 +104,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the BlockBlobGetBlockListHeaders object itself. */ - public BlockBlobGetBlockListHeaders lastModified(OffsetDateTime lastModified) { + public BlockBlobGetBlockListHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -113,7 +120,7 @@ public BlockBlobGetBlockListHeaders lastModified(OffsetDateTime lastModified) { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -125,7 +132,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the BlockBlobGetBlockListHeaders object itself. */ - public BlockBlobGetBlockListHeaders eTag(String eTag) { + public BlockBlobGetBlockListHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -136,7 +143,7 @@ public BlockBlobGetBlockListHeaders eTag(String eTag) { * * @return the contentType value. */ - public String contentType() { + public String getContentType() { return this.contentType; } @@ -147,7 +154,7 @@ public String contentType() { * @param contentType the contentType value to set. * @return the BlockBlobGetBlockListHeaders object itself. */ - public BlockBlobGetBlockListHeaders contentType(String contentType) { + public BlockBlobGetBlockListHeaders setContentType(String contentType) { this.contentType = contentType; return this; } @@ -157,7 +164,7 @@ public BlockBlobGetBlockListHeaders contentType(String contentType) { * * @return the blobContentLength value. */ - public Long blobContentLength() { + public Long getBlobContentLength() { return this.blobContentLength; } @@ -167,18 +174,42 @@ public Long blobContentLength() { * @param blobContentLength the blobContentLength value to set. * @return the BlockBlobGetBlockListHeaders object itself. */ - public BlockBlobGetBlockListHeaders blobContentLength(Long blobContentLength) { + public BlockBlobGetBlockListHeaders setBlobContentLength(Long blobContentLength) { this.blobContentLength = blobContentLength; return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlockBlobGetBlockListHeaders object itself. + */ + public BlockBlobGetBlockListHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -189,7 +220,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the BlockBlobGetBlockListHeaders object itself. */ - public BlockBlobGetBlockListHeaders requestId(String requestId) { + public BlockBlobGetBlockListHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -201,7 +232,7 @@ public BlockBlobGetBlockListHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -213,7 +244,7 @@ public String version() { * @param version the version value to set. * @return the BlockBlobGetBlockListHeaders object itself. */ - public BlockBlobGetBlockListHeaders version(String version) { + public BlockBlobGetBlockListHeaders setVersion(String version) { this.version = version; return this; } @@ -224,11 +255,11 @@ public BlockBlobGetBlockListHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -238,7 +269,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlockBlobGetBlockListHeaders object itself. */ - public BlockBlobGetBlockListHeaders dateProperty(OffsetDateTime dateProperty) { + public BlockBlobGetBlockListHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -252,7 +283,7 @@ public BlockBlobGetBlockListHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -262,7 +293,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the BlockBlobGetBlockListHeaders object itself. */ - public BlockBlobGetBlockListHeaders errorCode(String errorCode) { + public BlockBlobGetBlockListHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobItem.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobItem.java index 3d73a020dd93..1f5565477f9b 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobItem.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobItem.java @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + package com.azure.storage.blob.models; import com.azure.core.implementation.util.ImplUtils; @@ -5,42 +8,60 @@ import java.time.OffsetDateTime; public class BlockBlobItem { - - private OffsetDateTime lastModified; - + private final String eTag; + private final OffsetDateTime lastModified; private final byte[] contentMD5; - - private Boolean isServerEncrypted; - - private String encryptionKeySha256; + private final Boolean isServerEncrypted; + private final String encryptionKeySha256; public BlockBlobItem(BlockBlobUploadHeaders generatedHeaders) { - this.lastModified = generatedHeaders.lastModified(); - this.contentMD5 = generatedHeaders.contentMD5(); + this.eTag = generatedHeaders.getETag(); + this.lastModified = generatedHeaders.getLastModified(); + this.contentMD5 = generatedHeaders.getContentMD5(); this.isServerEncrypted = generatedHeaders.isServerEncrypted(); - this.encryptionKeySha256 = generatedHeaders.encryptionKeySha256(); + this.encryptionKeySha256 = generatedHeaders.getEncryptionKeySha256(); } public BlockBlobItem(BlockBlobCommitBlockListHeaders generatedHeaders) { - this.lastModified = generatedHeaders.lastModified(); - this.contentMD5 = generatedHeaders.contentMD5(); + this.eTag = generatedHeaders.getETag(); + this.lastModified = generatedHeaders.getLastModified(); + this.contentMD5 = generatedHeaders.getContentMD5(); this.isServerEncrypted = generatedHeaders.isServerEncrypted(); - this.encryptionKeySha256 = generatedHeaders.encryptionKeySha256(); + this.encryptionKeySha256 = generatedHeaders.getEncryptionKeySha256(); + } + + /** + * @return the eTag of the block blob + */ + public String getETag() { + return eTag; } - public OffsetDateTime lastModified() { + /** + * @return the last time the block blob was modified + */ + public OffsetDateTime getLastModified() { return lastModified; - }; + } + /** + * @return the encryption status of the block blob on the server + */ public Boolean isServerEncrypted() { return isServerEncrypted; } - public String encryptionKeySha256() { + /** + * @return the key used to encrypt the block blob + */ + public String getEncryptionKeySha256() { return encryptionKeySha256; } - public byte[] contentMD5() { + /** + * @return the MD5 of the block blob's comment + */ + public byte[] getContentMD5() { return ImplUtils.clone(contentMD5); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockFromURLHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockFromURLHeaders.java index 88dd3c6346ed..507f5aa2705e 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockFromURLHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockFromURLHeaders.java @@ -18,13 +18,28 @@ @Fluent public final class BlockBlobStageBlockFromURLHeaders { /* - * If the blob has an MD5 hash and this operation is to read the full blob, - * this response header is returned so that the client can check for - * message content integrity. + * This header is returned so that the client can check for message content + * integrity. The value of this header is computed by the Blob service; it + * is not necessarily the same value specified in the request headers. */ @JsonProperty(value = "Content-MD5") private byte[] contentMD5; + /* + * This header is returned so that the client can check for message content + * integrity. The value of this header is computed by the Blob service; it + * is not necessarily the same value specified in the request headers. + */ + @JsonProperty(value = "x-ms-content-crc64") + private byte[] xMsContentCrc64; + + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -70,36 +85,88 @@ public final class BlockBlobStageBlockFromURLHeaders { private String errorCode; /** - * Get the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. + * Get the contentMD5 property: This header is returned so that the client + * can check for message content integrity. The value of this header is + * computed by the Blob service; it is not necessarily the same value + * specified in the request headers. * * @return the contentMD5 value. */ - public byte[] contentMD5() { + public byte[] getContentMD5() { return ImplUtils.clone(this.contentMD5); } /** - * Set the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. + * Set the contentMD5 property: This header is returned so that the client + * can check for message content integrity. The value of this header is + * computed by the Blob service; it is not necessarily the same value + * specified in the request headers. * * @param contentMD5 the contentMD5 value to set. * @return the BlockBlobStageBlockFromURLHeaders object itself. */ - public BlockBlobStageBlockFromURLHeaders contentMD5(byte[] contentMD5) { + public BlockBlobStageBlockFromURLHeaders setContentMD5(byte[] contentMD5) { this.contentMD5 = ImplUtils.clone(contentMD5); return this; } + /** + * Get the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @return the xMsContentCrc64 value. + */ + public byte[] getXMsContentCrc64() { + return ImplUtils.clone(this.xMsContentCrc64); + } + + /** + * Set the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the BlockBlobStageBlockFromURLHeaders object itself. + */ + public BlockBlobStageBlockFromURLHeaders setXMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = ImplUtils.clone(xMsContentCrc64); + return this; + } + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlockBlobStageBlockFromURLHeaders object itself. + */ + public BlockBlobStageBlockFromURLHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -110,7 +177,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the BlockBlobStageBlockFromURLHeaders object itself. */ - public BlockBlobStageBlockFromURLHeaders requestId(String requestId) { + public BlockBlobStageBlockFromURLHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -122,7 +189,7 @@ public BlockBlobStageBlockFromURLHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -134,7 +201,7 @@ public String version() { * @param version the version value to set. * @return the BlockBlobStageBlockFromURLHeaders object itself. */ - public BlockBlobStageBlockFromURLHeaders version(String version) { + public BlockBlobStageBlockFromURLHeaders setVersion(String version) { this.version = version; return this; } @@ -145,11 +212,11 @@ public BlockBlobStageBlockFromURLHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -159,7 +226,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlockBlobStageBlockFromURLHeaders object itself. */ - public BlockBlobStageBlockFromURLHeaders dateProperty(OffsetDateTime dateProperty) { + public BlockBlobStageBlockFromURLHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -187,7 +254,7 @@ public Boolean isServerEncrypted() { * @param isServerEncrypted the isServerEncrypted value to set. * @return the BlockBlobStageBlockFromURLHeaders object itself. */ - public BlockBlobStageBlockFromURLHeaders isServerEncrypted(Boolean isServerEncrypted) { + public BlockBlobStageBlockFromURLHeaders setIsServerEncrypted(Boolean isServerEncrypted) { this.isServerEncrypted = isServerEncrypted; return this; } @@ -199,7 +266,7 @@ public BlockBlobStageBlockFromURLHeaders isServerEncrypted(Boolean isServerEncry * * @return the encryptionKeySha256 value. */ - public String encryptionKeySha256() { + public String getEncryptionKeySha256() { return this.encryptionKeySha256; } @@ -211,7 +278,7 @@ public String encryptionKeySha256() { * @param encryptionKeySha256 the encryptionKeySha256 value to set. * @return the BlockBlobStageBlockFromURLHeaders object itself. */ - public BlockBlobStageBlockFromURLHeaders encryptionKeySha256(String encryptionKeySha256) { + public BlockBlobStageBlockFromURLHeaders setEncryptionKeySha256(String encryptionKeySha256) { this.encryptionKeySha256 = encryptionKeySha256; return this; } @@ -221,7 +288,7 @@ public BlockBlobStageBlockFromURLHeaders encryptionKeySha256(String encryptionKe * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -231,7 +298,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the BlockBlobStageBlockFromURLHeaders object itself. */ - public BlockBlobStageBlockFromURLHeaders errorCode(String errorCode) { + public BlockBlobStageBlockFromURLHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockHeaders.java index 56ffdfe93700..dbee32dae604 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockHeaders.java @@ -18,13 +18,20 @@ @Fluent public final class BlockBlobStageBlockHeaders { /* - * If the blob has an MD5 hash and this operation is to read the full blob, - * this response header is returned so that the client can check for - * message content integrity. + * This header is returned so that the client can check for message content + * integrity. The value of this header is computed by the Blob service; it + * is not necessarily the same value specified in the request headers. */ @JsonProperty(value = "Content-MD5") private byte[] contentMD5; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -47,6 +54,14 @@ public final class BlockBlobStageBlockHeaders { @JsonProperty(value = "Date") private DateTimeRfc1123 dateProperty; + /* + * This header is returned so that the client can check for message content + * integrity. The value of this header is computed by the Blob service; it + * is not necessarily the same value specified in the request headers. + */ + @JsonProperty(value = "x-ms-content-crc64") + private byte[] xMsContentCrc64; + /* * The value of this header is set to true if the contents of the request * are successfully encrypted using the specified algorithm, and false @@ -70,36 +85,62 @@ public final class BlockBlobStageBlockHeaders { private String errorCode; /** - * Get the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. + * Get the contentMD5 property: This header is returned so that the client + * can check for message content integrity. The value of this header is + * computed by the Blob service; it is not necessarily the same value + * specified in the request headers. * * @return the contentMD5 value. */ - public byte[] contentMD5() { + public byte[] getContentMD5() { return ImplUtils.clone(this.contentMD5); } /** - * Set the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. + * Set the contentMD5 property: This header is returned so that the client + * can check for message content integrity. The value of this header is + * computed by the Blob service; it is not necessarily the same value + * specified in the request headers. * * @param contentMD5 the contentMD5 value to set. * @return the BlockBlobStageBlockHeaders object itself. */ - public BlockBlobStageBlockHeaders contentMD5(byte[] contentMD5) { + public BlockBlobStageBlockHeaders setContentMD5(byte[] contentMD5) { this.contentMD5 = ImplUtils.clone(contentMD5); return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlockBlobStageBlockHeaders object itself. + */ + public BlockBlobStageBlockHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -110,7 +151,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the BlockBlobStageBlockHeaders object itself. */ - public BlockBlobStageBlockHeaders requestId(String requestId) { + public BlockBlobStageBlockHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -122,7 +163,7 @@ public BlockBlobStageBlockHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -134,7 +175,7 @@ public String version() { * @param version the version value to set. * @return the BlockBlobStageBlockHeaders object itself. */ - public BlockBlobStageBlockHeaders version(String version) { + public BlockBlobStageBlockHeaders setVersion(String version) { this.version = version; return this; } @@ -145,11 +186,11 @@ public BlockBlobStageBlockHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -159,7 +200,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlockBlobStageBlockHeaders object itself. */ - public BlockBlobStageBlockHeaders dateProperty(OffsetDateTime dateProperty) { + public BlockBlobStageBlockHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -168,6 +209,32 @@ public BlockBlobStageBlockHeaders dateProperty(OffsetDateTime dateProperty) { return this; } + /** + * Get the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @return the xMsContentCrc64 value. + */ + public byte[] getXMsContentCrc64() { + return ImplUtils.clone(this.xMsContentCrc64); + } + + /** + * Set the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the BlockBlobStageBlockHeaders object itself. + */ + public BlockBlobStageBlockHeaders setXMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = ImplUtils.clone(xMsContentCrc64); + return this; + } + /** * Get the isServerEncrypted property: The value of this header is set to * true if the contents of the request are successfully encrypted using the @@ -187,7 +254,7 @@ public Boolean isServerEncrypted() { * @param isServerEncrypted the isServerEncrypted value to set. * @return the BlockBlobStageBlockHeaders object itself. */ - public BlockBlobStageBlockHeaders isServerEncrypted(Boolean isServerEncrypted) { + public BlockBlobStageBlockHeaders setIsServerEncrypted(Boolean isServerEncrypted) { this.isServerEncrypted = isServerEncrypted; return this; } @@ -199,7 +266,7 @@ public BlockBlobStageBlockHeaders isServerEncrypted(Boolean isServerEncrypted) { * * @return the encryptionKeySha256 value. */ - public String encryptionKeySha256() { + public String getEncryptionKeySha256() { return this.encryptionKeySha256; } @@ -211,7 +278,7 @@ public String encryptionKeySha256() { * @param encryptionKeySha256 the encryptionKeySha256 value to set. * @return the BlockBlobStageBlockHeaders object itself. */ - public BlockBlobStageBlockHeaders encryptionKeySha256(String encryptionKeySha256) { + public BlockBlobStageBlockHeaders setEncryptionKeySha256(String encryptionKeySha256) { this.encryptionKeySha256 = encryptionKeySha256; return this; } @@ -221,7 +288,7 @@ public BlockBlobStageBlockHeaders encryptionKeySha256(String encryptionKeySha256 * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -231,7 +298,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the BlockBlobStageBlockHeaders object itself. */ - public BlockBlobStageBlockHeaders errorCode(String errorCode) { + public BlockBlobStageBlockHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobUploadHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobUploadHeaders.java index 76c59b2f74d9..4a5934cabe89 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobUploadHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobUploadHeaders.java @@ -41,6 +41,13 @@ public final class BlockBlobUploadHeaders { @JsonProperty(value = "Content-MD5") private byte[] contentMD5; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -56,14 +63,6 @@ public final class BlockBlobUploadHeaders { @JsonProperty(value = "x-ms-version") private String version; - /* - * UTC date/time value generated by the service that identifies a version - * of the blob. This header is returned for requests made against version - * 2018-11-09 and above. - */ - @JsonProperty(value = "x-ms-version-id") - private String versionId; - /* * UTC date/time value generated by the service that indicates the time at * which the response was initiated @@ -100,7 +99,7 @@ public final class BlockBlobUploadHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -112,7 +111,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the BlockBlobUploadHeaders object itself. */ - public BlockBlobUploadHeaders eTag(String eTag) { + public BlockBlobUploadHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -125,11 +124,11 @@ public BlockBlobUploadHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -141,7 +140,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the BlockBlobUploadHeaders object itself. */ - public BlockBlobUploadHeaders lastModified(OffsetDateTime lastModified) { + public BlockBlobUploadHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -157,7 +156,7 @@ public BlockBlobUploadHeaders lastModified(OffsetDateTime lastModified) { * * @return the contentMD5 value. */ - public byte[] contentMD5() { + public byte[] getContentMD5() { return ImplUtils.clone(this.contentMD5); } @@ -169,18 +168,42 @@ public byte[] contentMD5() { * @param contentMD5 the contentMD5 value to set. * @return the BlockBlobUploadHeaders object itself. */ - public BlockBlobUploadHeaders contentMD5(byte[] contentMD5) { + public BlockBlobUploadHeaders setContentMD5(byte[] contentMD5) { this.contentMD5 = ImplUtils.clone(contentMD5); return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the BlockBlobUploadHeaders object itself. + */ + public BlockBlobUploadHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -191,7 +214,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the BlockBlobUploadHeaders object itself. */ - public BlockBlobUploadHeaders requestId(String requestId) { + public BlockBlobUploadHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -203,7 +226,7 @@ public BlockBlobUploadHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -215,46 +238,22 @@ public String version() { * @param version the version value to set. * @return the BlockBlobUploadHeaders object itself. */ - public BlockBlobUploadHeaders version(String version) { + public BlockBlobUploadHeaders setVersion(String version) { this.version = version; return this; } - /** - * Get the versionId property: UTC date/time value generated by the service - * that identifies a version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @return the versionId value. - */ - public String versionId() { - return this.versionId; - } - - /** - * Set the versionId property: UTC date/time value generated by the service - * that identifies a version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @param versionId the versionId value to set. - * @return the BlockBlobUploadHeaders object itself. - */ - public BlockBlobUploadHeaders versionId(String versionId) { - this.versionId = versionId; - return this; - } - /** * Get the dateProperty property: UTC date/time value generated by the * service that indicates the time at which the response was initiated. * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -264,7 +263,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the BlockBlobUploadHeaders object itself. */ - public BlockBlobUploadHeaders dateProperty(OffsetDateTime dateProperty) { + public BlockBlobUploadHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -292,7 +291,7 @@ public Boolean isServerEncrypted() { * @param isServerEncrypted the isServerEncrypted value to set. * @return the BlockBlobUploadHeaders object itself. */ - public BlockBlobUploadHeaders isServerEncrypted(Boolean isServerEncrypted) { + public BlockBlobUploadHeaders setIsServerEncrypted(Boolean isServerEncrypted) { this.isServerEncrypted = isServerEncrypted; return this; } @@ -304,7 +303,7 @@ public BlockBlobUploadHeaders isServerEncrypted(Boolean isServerEncrypted) { * * @return the encryptionKeySha256 value. */ - public String encryptionKeySha256() { + public String getEncryptionKeySha256() { return this.encryptionKeySha256; } @@ -316,7 +315,7 @@ public String encryptionKeySha256() { * @param encryptionKeySha256 the encryptionKeySha256 value to set. * @return the BlockBlobUploadHeaders object itself. */ - public BlockBlobUploadHeaders encryptionKeySha256(String encryptionKeySha256) { + public BlockBlobUploadHeaders setEncryptionKeySha256(String encryptionKeySha256) { this.encryptionKeySha256 = encryptionKeySha256; return this; } @@ -326,7 +325,7 @@ public BlockBlobUploadHeaders encryptionKeySha256(String encryptionKeySha256) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -336,7 +335,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the BlockBlobUploadHeaders object itself. */ - public BlockBlobUploadHeaders errorCode(String errorCode) { + public BlockBlobUploadHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobsGetBlockListResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobsGetBlockListResponse.java index beddda624e0d..75826083b88c 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobsGetBlockListResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobsGetBlockListResponse.java @@ -29,7 +29,7 @@ public BlockBlobsGetBlockListResponse(HttpRequest request, int statusCode, HttpH * @return the deserialized response body. */ @Override - public BlockList value() { - return super.value(); + public BlockList getValue() { + return super.getValue(); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockItem.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockItem.java index 4920fd7334a1..08b0145d45ed 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockItem.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockItem.java @@ -9,9 +9,8 @@ */ public final class BlockItem { /* Internal block object. */ - private Block block; - - private boolean isCommitted; + private final Block block; + private final boolean isCommitted; /** * Creates an instance of a BlobItem. @@ -27,14 +26,14 @@ public BlockItem(Block block, boolean isCommitted) { * @return the base64 encoded block ID. */ public String name() { - return this.block.name(); + return this.block.getName(); } /** * @return the block size in bytes. */ public int size() { - return this.block.size(); + return this.block.getSize(); } /** diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockList.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockList.java index dfa4deadeb89..145645eb301d 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockList.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockList.java @@ -55,7 +55,7 @@ private UncommittedBlocksWrapper(@JacksonXmlProperty(localName = "Block") List committedBlocks() { + public List getCommittedBlocks() { if (this.committedBlocks == null) { this.committedBlocks = new CommittedBlocksWrapper(new ArrayList()); } @@ -68,7 +68,7 @@ public List committedBlocks() { * @param committedBlocks the committedBlocks value to set. * @return the BlockList object itself. */ - public BlockList committedBlocks(List committedBlocks) { + public BlockList setCommittedBlocks(List committedBlocks) { this.committedBlocks = new CommittedBlocksWrapper(committedBlocks); return this; } @@ -78,7 +78,7 @@ public BlockList committedBlocks(List committedBlocks) { * * @return the uncommittedBlocks value. */ - public List uncommittedBlocks() { + public List getUncommittedBlocks() { if (this.uncommittedBlocks == null) { this.uncommittedBlocks = new UncommittedBlocksWrapper(new ArrayList()); } @@ -91,7 +91,7 @@ public List uncommittedBlocks() { * @param uncommittedBlocks the uncommittedBlocks value to set. * @return the BlockList object itself. */ - public BlockList uncommittedBlocks(List uncommittedBlocks) { + public BlockList setUncommittedBlocks(List uncommittedBlocks) { this.uncommittedBlocks = new UncommittedBlocksWrapper(uncommittedBlocks); return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockLookupList.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockLookupList.java index 40bb5d346e00..6e06ffe586ba 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockLookupList.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockLookupList.java @@ -39,7 +39,7 @@ public final class BlockLookupList { * * @return the committed value. */ - public List committed() { + public List getCommitted() { return this.committed; } @@ -49,7 +49,7 @@ public List committed() { * @param committed the committed value to set. * @return the BlockLookupList object itself. */ - public BlockLookupList committed(List committed) { + public BlockLookupList setCommitted(List committed) { this.committed = committed; return this; } @@ -59,7 +59,7 @@ public BlockLookupList committed(List committed) { * * @return the uncommitted value. */ - public List uncommitted() { + public List getUncommitted() { return this.uncommitted; } @@ -69,7 +69,7 @@ public List uncommitted() { * @param uncommitted the uncommitted value to set. * @return the BlockLookupList object itself. */ - public BlockLookupList uncommitted(List uncommitted) { + public BlockLookupList setUncommitted(List uncommitted) { this.uncommitted = uncommitted; return this; } @@ -79,7 +79,7 @@ public BlockLookupList uncommitted(List uncommitted) { * * @return the latest value. */ - public List latest() { + public List getLatest() { return this.latest; } @@ -89,7 +89,7 @@ public List latest() { * @param latest the latest value to set. * @return the BlockLookupList object itself. */ - public BlockLookupList latest(List latest) { + public BlockLookupList setLatest(List latest) { this.latest = latest; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ClearRange.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ClearRange.java index e607faf87b05..3301de73f6cb 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ClearRange.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ClearRange.java @@ -31,7 +31,7 @@ public final class ClearRange { * * @return the start value. */ - public long start() { + public long getStart() { return this.start; } @@ -41,7 +41,7 @@ public long start() { * @param start the start value to set. * @return the ClearRange object itself. */ - public ClearRange start(long start) { + public ClearRange setStart(long start) { this.start = start; return this; } @@ -51,7 +51,7 @@ public ClearRange start(long start) { * * @return the end value. */ - public long end() { + public long getEnd() { return this.end; } @@ -61,7 +61,7 @@ public long end() { * @param end the end value to set. * @return the ClearRange object itself. */ - public ClearRange end(long end) { + public ClearRange setEnd(long end) { this.end = end; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerAccessConditions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerAccessConditions.java index 49346dc686fb..b07ca4bbd5cf 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerAccessConditions.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerAccessConditions.java @@ -30,7 +30,7 @@ public ContainerAccessConditions() { * * @return the modified access conditions */ - public ModifiedAccessConditions modifiedAccessConditions() { + public ModifiedAccessConditions getModifiedAccessConditions() { return modifiedAccessConditions; } @@ -42,7 +42,7 @@ public ModifiedAccessConditions modifiedAccessConditions() { * @param modifiedAccessConditions the modified access conditions to set * @return the updated ContainerAccessConditions object */ - public ContainerAccessConditions modifiedAccessConditions(ModifiedAccessConditions modifiedAccessConditions) { + public ContainerAccessConditions setModifiedAccessConditions(ModifiedAccessConditions modifiedAccessConditions) { this.modifiedAccessConditions = modifiedAccessConditions; return this; } @@ -53,7 +53,7 @@ public ContainerAccessConditions modifiedAccessConditions(ModifiedAccessConditio * * @return the lease access conditions */ - public LeaseAccessConditions leaseAccessConditions() { + public LeaseAccessConditions getLeaseAccessConditions() { return leaseAccessConditions; } @@ -64,7 +64,7 @@ public LeaseAccessConditions leaseAccessConditions() { * @param leaseID the lease access conditions to set * @return the updated ContainerAccessConditions object */ - public ContainerAccessConditions leaseAccessConditions(LeaseAccessConditions leaseID) { + public ContainerAccessConditions setLeaseAccessConditions(LeaseAccessConditions leaseID) { this.leaseAccessConditions = leaseID; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerAccessPolicies.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerAccessPolicies.java index b9c396c7169c..48eaa05a91ea 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerAccessPolicies.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerAccessPolicies.java @@ -1,7 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + package com.azure.storage.blob.models; import java.util.List; +/** + * This class contains values which correlate to the access polices set on a specific container. + */ public class ContainerAccessPolicies { private final PublicAccessType blobAccessType; private final List identifiers; @@ -11,10 +17,16 @@ public ContainerAccessPolicies(PublicAccessType blobAccessType, List getIdentifiers() { return this.identifiers; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerAcquireLeaseHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerAcquireLeaseHeaders.java index bd6d0580bdcf..110c973c9aba 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerAcquireLeaseHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerAcquireLeaseHeaders.java @@ -38,6 +38,13 @@ public final class ContainerAcquireLeaseHeaders { @JsonProperty(value = "x-ms-lease-id") private String leaseId; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -73,7 +80,7 @@ public final class ContainerAcquireLeaseHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -85,7 +92,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the ContainerAcquireLeaseHeaders object itself. */ - public ContainerAcquireLeaseHeaders eTag(String eTag) { + public ContainerAcquireLeaseHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -98,11 +105,11 @@ public ContainerAcquireLeaseHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -114,7 +121,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the ContainerAcquireLeaseHeaders object itself. */ - public ContainerAcquireLeaseHeaders lastModified(OffsetDateTime lastModified) { + public ContainerAcquireLeaseHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -128,7 +135,7 @@ public ContainerAcquireLeaseHeaders lastModified(OffsetDateTime lastModified) { * * @return the leaseId value. */ - public String leaseId() { + public String getLeaseId() { return this.leaseId; } @@ -138,18 +145,42 @@ public String leaseId() { * @param leaseId the leaseId value to set. * @return the ContainerAcquireLeaseHeaders object itself. */ - public ContainerAcquireLeaseHeaders leaseId(String leaseId) { + public ContainerAcquireLeaseHeaders setLeaseId(String leaseId) { this.leaseId = leaseId; return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerAcquireLeaseHeaders object itself. + */ + public ContainerAcquireLeaseHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -160,7 +191,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the ContainerAcquireLeaseHeaders object itself. */ - public ContainerAcquireLeaseHeaders requestId(String requestId) { + public ContainerAcquireLeaseHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -172,7 +203,7 @@ public ContainerAcquireLeaseHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -184,7 +215,7 @@ public String version() { * @param version the version value to set. * @return the ContainerAcquireLeaseHeaders object itself. */ - public ContainerAcquireLeaseHeaders version(String version) { + public ContainerAcquireLeaseHeaders setVersion(String version) { this.version = version; return this; } @@ -195,11 +226,11 @@ public ContainerAcquireLeaseHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -209,7 +240,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the ContainerAcquireLeaseHeaders object itself. */ - public ContainerAcquireLeaseHeaders dateProperty(OffsetDateTime dateProperty) { + public ContainerAcquireLeaseHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -223,7 +254,7 @@ public ContainerAcquireLeaseHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -233,7 +264,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the ContainerAcquireLeaseHeaders object itself. */ - public ContainerAcquireLeaseHeaders errorCode(String errorCode) { + public ContainerAcquireLeaseHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerBreakLeaseHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerBreakLeaseHeaders.java index 4df2a5f3ddef..8d8641bbe81f 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerBreakLeaseHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerBreakLeaseHeaders.java @@ -38,6 +38,13 @@ public final class ContainerBreakLeaseHeaders { @JsonProperty(value = "x-ms-lease-time") private Integer leaseTime; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -73,7 +80,7 @@ public final class ContainerBreakLeaseHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -85,7 +92,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the ContainerBreakLeaseHeaders object itself. */ - public ContainerBreakLeaseHeaders eTag(String eTag) { + public ContainerBreakLeaseHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -98,11 +105,11 @@ public ContainerBreakLeaseHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -114,7 +121,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the ContainerBreakLeaseHeaders object itself. */ - public ContainerBreakLeaseHeaders lastModified(OffsetDateTime lastModified) { + public ContainerBreakLeaseHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -129,7 +136,7 @@ public ContainerBreakLeaseHeaders lastModified(OffsetDateTime lastModified) { * * @return the leaseTime value. */ - public Integer leaseTime() { + public Integer getLeaseTime() { return this.leaseTime; } @@ -140,18 +147,42 @@ public Integer leaseTime() { * @param leaseTime the leaseTime value to set. * @return the ContainerBreakLeaseHeaders object itself. */ - public ContainerBreakLeaseHeaders leaseTime(Integer leaseTime) { + public ContainerBreakLeaseHeaders setLeaseTime(Integer leaseTime) { this.leaseTime = leaseTime; return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerBreakLeaseHeaders object itself. + */ + public ContainerBreakLeaseHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -162,7 +193,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the ContainerBreakLeaseHeaders object itself. */ - public ContainerBreakLeaseHeaders requestId(String requestId) { + public ContainerBreakLeaseHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -174,7 +205,7 @@ public ContainerBreakLeaseHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -186,7 +217,7 @@ public String version() { * @param version the version value to set. * @return the ContainerBreakLeaseHeaders object itself. */ - public ContainerBreakLeaseHeaders version(String version) { + public ContainerBreakLeaseHeaders setVersion(String version) { this.version = version; return this; } @@ -197,11 +228,11 @@ public ContainerBreakLeaseHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -211,7 +242,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the ContainerBreakLeaseHeaders object itself. */ - public ContainerBreakLeaseHeaders dateProperty(OffsetDateTime dateProperty) { + public ContainerBreakLeaseHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -225,7 +256,7 @@ public ContainerBreakLeaseHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -235,7 +266,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the ContainerBreakLeaseHeaders object itself. */ - public ContainerBreakLeaseHeaders errorCode(String errorCode) { + public ContainerBreakLeaseHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerChangeLeaseHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerChangeLeaseHeaders.java index 8c5371a5121f..3643e5a43640 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerChangeLeaseHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerChangeLeaseHeaders.java @@ -38,6 +38,13 @@ public final class ContainerChangeLeaseHeaders { @JsonProperty(value = "x-ms-lease-id") private String leaseId; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -73,7 +80,7 @@ public final class ContainerChangeLeaseHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -85,7 +92,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the ContainerChangeLeaseHeaders object itself. */ - public ContainerChangeLeaseHeaders eTag(String eTag) { + public ContainerChangeLeaseHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -98,11 +105,11 @@ public ContainerChangeLeaseHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -114,7 +121,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the ContainerChangeLeaseHeaders object itself. */ - public ContainerChangeLeaseHeaders lastModified(OffsetDateTime lastModified) { + public ContainerChangeLeaseHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -128,7 +135,7 @@ public ContainerChangeLeaseHeaders lastModified(OffsetDateTime lastModified) { * * @return the leaseId value. */ - public String leaseId() { + public String getLeaseId() { return this.leaseId; } @@ -138,18 +145,42 @@ public String leaseId() { * @param leaseId the leaseId value to set. * @return the ContainerChangeLeaseHeaders object itself. */ - public ContainerChangeLeaseHeaders leaseId(String leaseId) { + public ContainerChangeLeaseHeaders setLeaseId(String leaseId) { this.leaseId = leaseId; return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerChangeLeaseHeaders object itself. + */ + public ContainerChangeLeaseHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -160,7 +191,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the ContainerChangeLeaseHeaders object itself. */ - public ContainerChangeLeaseHeaders requestId(String requestId) { + public ContainerChangeLeaseHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -172,7 +203,7 @@ public ContainerChangeLeaseHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -184,7 +215,7 @@ public String version() { * @param version the version value to set. * @return the ContainerChangeLeaseHeaders object itself. */ - public ContainerChangeLeaseHeaders version(String version) { + public ContainerChangeLeaseHeaders setVersion(String version) { this.version = version; return this; } @@ -195,11 +226,11 @@ public ContainerChangeLeaseHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -209,7 +240,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the ContainerChangeLeaseHeaders object itself. */ - public ContainerChangeLeaseHeaders dateProperty(OffsetDateTime dateProperty) { + public ContainerChangeLeaseHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -223,7 +254,7 @@ public ContainerChangeLeaseHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -233,7 +264,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the ContainerChangeLeaseHeaders object itself. */ - public ContainerChangeLeaseHeaders errorCode(String errorCode) { + public ContainerChangeLeaseHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerCreateHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerCreateHeaders.java index 9a22e560ca72..aae199beb0f7 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerCreateHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerCreateHeaders.java @@ -32,6 +32,13 @@ public final class ContainerCreateHeaders { @JsonProperty(value = "Last-Modified") private DateTimeRfc1123 lastModified; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -67,7 +74,7 @@ public final class ContainerCreateHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -79,7 +86,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the ContainerCreateHeaders object itself. */ - public ContainerCreateHeaders eTag(String eTag) { + public ContainerCreateHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -92,11 +99,11 @@ public ContainerCreateHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -108,7 +115,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the ContainerCreateHeaders object itself. */ - public ContainerCreateHeaders lastModified(OffsetDateTime lastModified) { + public ContainerCreateHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -117,13 +124,37 @@ public ContainerCreateHeaders lastModified(OffsetDateTime lastModified) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerCreateHeaders object itself. + */ + public ContainerCreateHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -134,7 +165,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the ContainerCreateHeaders object itself. */ - public ContainerCreateHeaders requestId(String requestId) { + public ContainerCreateHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -146,7 +177,7 @@ public ContainerCreateHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -158,7 +189,7 @@ public String version() { * @param version the version value to set. * @return the ContainerCreateHeaders object itself. */ - public ContainerCreateHeaders version(String version) { + public ContainerCreateHeaders setVersion(String version) { this.version = version; return this; } @@ -169,11 +200,11 @@ public ContainerCreateHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -183,7 +214,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the ContainerCreateHeaders object itself. */ - public ContainerCreateHeaders dateProperty(OffsetDateTime dateProperty) { + public ContainerCreateHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -197,7 +228,7 @@ public ContainerCreateHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -207,7 +238,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the ContainerCreateHeaders object itself. */ - public ContainerCreateHeaders errorCode(String errorCode) { + public ContainerCreateHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerDeleteHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerDeleteHeaders.java index 64af976e0367..334d0d71c0c2 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerDeleteHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerDeleteHeaders.java @@ -16,6 +16,13 @@ @JacksonXmlRootElement(localName = "Container-Delete-Headers") @Fluent public final class ContainerDeleteHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -44,13 +51,37 @@ public final class ContainerDeleteHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerDeleteHeaders object itself. + */ + public ContainerDeleteHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -61,7 +92,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the ContainerDeleteHeaders object itself. */ - public ContainerDeleteHeaders requestId(String requestId) { + public ContainerDeleteHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -73,7 +104,7 @@ public ContainerDeleteHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -85,7 +116,7 @@ public String version() { * @param version the version value to set. * @return the ContainerDeleteHeaders object itself. */ - public ContainerDeleteHeaders version(String version) { + public ContainerDeleteHeaders setVersion(String version) { this.version = version; return this; } @@ -96,11 +127,11 @@ public ContainerDeleteHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -110,7 +141,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the ContainerDeleteHeaders object itself. */ - public ContainerDeleteHeaders dateProperty(OffsetDateTime dateProperty) { + public ContainerDeleteHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -124,7 +155,7 @@ public ContainerDeleteHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -134,7 +165,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the ContainerDeleteHeaders object itself. */ - public ContainerDeleteHeaders errorCode(String errorCode) { + public ContainerDeleteHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccessPolicyHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccessPolicyHeaders.java index a1a76b2f57ba..ad51a9efda86 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccessPolicyHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccessPolicyHeaders.java @@ -39,6 +39,13 @@ public final class ContainerGetAccessPolicyHeaders { @JsonProperty(value = "Last-Modified") private DateTimeRfc1123 lastModified; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -74,7 +81,7 @@ public final class ContainerGetAccessPolicyHeaders { * * @return the blobPublicAccess value. */ - public PublicAccessType blobPublicAccess() { + public PublicAccessType getBlobPublicAccess() { return this.blobPublicAccess; } @@ -86,7 +93,7 @@ public PublicAccessType blobPublicAccess() { * @param blobPublicAccess the blobPublicAccess value to set. * @return the ContainerGetAccessPolicyHeaders object itself. */ - public ContainerGetAccessPolicyHeaders blobPublicAccess(PublicAccessType blobPublicAccess) { + public ContainerGetAccessPolicyHeaders setBlobPublicAccess(PublicAccessType blobPublicAccess) { this.blobPublicAccess = blobPublicAccess; return this; } @@ -98,7 +105,7 @@ public ContainerGetAccessPolicyHeaders blobPublicAccess(PublicAccessType blobPub * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -110,7 +117,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the ContainerGetAccessPolicyHeaders object itself. */ - public ContainerGetAccessPolicyHeaders eTag(String eTag) { + public ContainerGetAccessPolicyHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -123,11 +130,11 @@ public ContainerGetAccessPolicyHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -139,7 +146,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the ContainerGetAccessPolicyHeaders object itself. */ - public ContainerGetAccessPolicyHeaders lastModified(OffsetDateTime lastModified) { + public ContainerGetAccessPolicyHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -148,13 +155,37 @@ public ContainerGetAccessPolicyHeaders lastModified(OffsetDateTime lastModified) return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerGetAccessPolicyHeaders object itself. + */ + public ContainerGetAccessPolicyHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -165,7 +196,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the ContainerGetAccessPolicyHeaders object itself. */ - public ContainerGetAccessPolicyHeaders requestId(String requestId) { + public ContainerGetAccessPolicyHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -177,7 +208,7 @@ public ContainerGetAccessPolicyHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -189,7 +220,7 @@ public String version() { * @param version the version value to set. * @return the ContainerGetAccessPolicyHeaders object itself. */ - public ContainerGetAccessPolicyHeaders version(String version) { + public ContainerGetAccessPolicyHeaders setVersion(String version) { this.version = version; return this; } @@ -200,11 +231,11 @@ public ContainerGetAccessPolicyHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -214,7 +245,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the ContainerGetAccessPolicyHeaders object itself. */ - public ContainerGetAccessPolicyHeaders dateProperty(OffsetDateTime dateProperty) { + public ContainerGetAccessPolicyHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -228,7 +259,7 @@ public ContainerGetAccessPolicyHeaders dateProperty(OffsetDateTime dateProperty) * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -238,7 +269,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the ContainerGetAccessPolicyHeaders object itself. */ - public ContainerGetAccessPolicyHeaders errorCode(String errorCode) { + public ContainerGetAccessPolicyHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccountInfoHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccountInfoHeaders.java index 692c4a71fc52..00be261afaae 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccountInfoHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccountInfoHeaders.java @@ -16,6 +16,13 @@ @JacksonXmlRootElement(localName = "Container-GetAccountInfo-Headers") @Fluent public final class ContainerGetAccountInfoHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -59,13 +66,37 @@ public final class ContainerGetAccountInfoHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerGetAccountInfoHeaders object itself. + */ + public ContainerGetAccountInfoHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -76,7 +107,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the ContainerGetAccountInfoHeaders object itself. */ - public ContainerGetAccountInfoHeaders requestId(String requestId) { + public ContainerGetAccountInfoHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -88,7 +119,7 @@ public ContainerGetAccountInfoHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -100,7 +131,7 @@ public String version() { * @param version the version value to set. * @return the ContainerGetAccountInfoHeaders object itself. */ - public ContainerGetAccountInfoHeaders version(String version) { + public ContainerGetAccountInfoHeaders setVersion(String version) { this.version = version; return this; } @@ -111,11 +142,11 @@ public ContainerGetAccountInfoHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -125,7 +156,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the ContainerGetAccountInfoHeaders object itself. */ - public ContainerGetAccountInfoHeaders dateProperty(OffsetDateTime dateProperty) { + public ContainerGetAccountInfoHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -141,7 +172,7 @@ public ContainerGetAccountInfoHeaders dateProperty(OffsetDateTime dateProperty) * * @return the skuName value. */ - public SkuName skuName() { + public SkuName getSkuName() { return this.skuName; } @@ -153,7 +184,7 @@ public SkuName skuName() { * @param skuName the skuName value to set. * @return the ContainerGetAccountInfoHeaders object itself. */ - public ContainerGetAccountInfoHeaders skuName(SkuName skuName) { + public ContainerGetAccountInfoHeaders setSkuName(SkuName skuName) { this.skuName = skuName; return this; } @@ -164,7 +195,7 @@ public ContainerGetAccountInfoHeaders skuName(SkuName skuName) { * * @return the accountKind value. */ - public AccountKind accountKind() { + public AccountKind getAccountKind() { return this.accountKind; } @@ -175,7 +206,7 @@ public AccountKind accountKind() { * @param accountKind the accountKind value to set. * @return the ContainerGetAccountInfoHeaders object itself. */ - public ContainerGetAccountInfoHeaders accountKind(AccountKind accountKind) { + public ContainerGetAccountInfoHeaders setAccountKind(AccountKind accountKind) { this.accountKind = accountKind; return this; } @@ -185,7 +216,7 @@ public ContainerGetAccountInfoHeaders accountKind(AccountKind accountKind) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -195,7 +226,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the ContainerGetAccountInfoHeaders object itself. */ - public ContainerGetAccountInfoHeaders errorCode(String errorCode) { + public ContainerGetAccountInfoHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetPropertiesHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetPropertiesHeaders.java index df2d12bbcdb6..bb6b9cb74548 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetPropertiesHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetPropertiesHeaders.java @@ -61,6 +61,13 @@ public final class ContainerGetPropertiesHeaders { @JsonProperty(value = "x-ms-lease-status") private LeaseStatusType leaseStatus; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -113,7 +120,7 @@ public final class ContainerGetPropertiesHeaders { * * @return the metadata value. */ - public Map metadata() { + public Map getMetadata() { return this.metadata; } @@ -123,7 +130,7 @@ public Map metadata() { * @param metadata the metadata value to set. * @return the ContainerGetPropertiesHeaders object itself. */ - public ContainerGetPropertiesHeaders metadata(Map metadata) { + public ContainerGetPropertiesHeaders setMetadata(Map metadata) { this.metadata = metadata; return this; } @@ -135,7 +142,7 @@ public ContainerGetPropertiesHeaders metadata(Map metadata) { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -147,7 +154,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the ContainerGetPropertiesHeaders object itself. */ - public ContainerGetPropertiesHeaders eTag(String eTag) { + public ContainerGetPropertiesHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -160,11 +167,11 @@ public ContainerGetPropertiesHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -176,7 +183,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the ContainerGetPropertiesHeaders object itself. */ - public ContainerGetPropertiesHeaders lastModified(OffsetDateTime lastModified) { + public ContainerGetPropertiesHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -192,7 +199,7 @@ public ContainerGetPropertiesHeaders lastModified(OffsetDateTime lastModified) { * * @return the leaseDuration value. */ - public LeaseDurationType leaseDuration() { + public LeaseDurationType getLeaseDuration() { return this.leaseDuration; } @@ -204,7 +211,7 @@ public LeaseDurationType leaseDuration() { * @param leaseDuration the leaseDuration value to set. * @return the ContainerGetPropertiesHeaders object itself. */ - public ContainerGetPropertiesHeaders leaseDuration(LeaseDurationType leaseDuration) { + public ContainerGetPropertiesHeaders setLeaseDuration(LeaseDurationType leaseDuration) { this.leaseDuration = leaseDuration; return this; } @@ -215,7 +222,7 @@ public ContainerGetPropertiesHeaders leaseDuration(LeaseDurationType leaseDurati * * @return the leaseState value. */ - public LeaseStateType leaseState() { + public LeaseStateType getLeaseState() { return this.leaseState; } @@ -226,7 +233,7 @@ public LeaseStateType leaseState() { * @param leaseState the leaseState value to set. * @return the ContainerGetPropertiesHeaders object itself. */ - public ContainerGetPropertiesHeaders leaseState(LeaseStateType leaseState) { + public ContainerGetPropertiesHeaders setLeaseState(LeaseStateType leaseState) { this.leaseState = leaseState; return this; } @@ -237,7 +244,7 @@ public ContainerGetPropertiesHeaders leaseState(LeaseStateType leaseState) { * * @return the leaseStatus value. */ - public LeaseStatusType leaseStatus() { + public LeaseStatusType getLeaseStatus() { return this.leaseStatus; } @@ -248,18 +255,42 @@ public LeaseStatusType leaseStatus() { * @param leaseStatus the leaseStatus value to set. * @return the ContainerGetPropertiesHeaders object itself. */ - public ContainerGetPropertiesHeaders leaseStatus(LeaseStatusType leaseStatus) { + public ContainerGetPropertiesHeaders setLeaseStatus(LeaseStatusType leaseStatus) { this.leaseStatus = leaseStatus; return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerGetPropertiesHeaders object itself. + */ + public ContainerGetPropertiesHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -270,7 +301,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the ContainerGetPropertiesHeaders object itself. */ - public ContainerGetPropertiesHeaders requestId(String requestId) { + public ContainerGetPropertiesHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -282,7 +313,7 @@ public ContainerGetPropertiesHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -294,7 +325,7 @@ public String version() { * @param version the version value to set. * @return the ContainerGetPropertiesHeaders object itself. */ - public ContainerGetPropertiesHeaders version(String version) { + public ContainerGetPropertiesHeaders setVersion(String version) { this.version = version; return this; } @@ -305,11 +336,11 @@ public ContainerGetPropertiesHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -319,7 +350,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the ContainerGetPropertiesHeaders object itself. */ - public ContainerGetPropertiesHeaders dateProperty(OffsetDateTime dateProperty) { + public ContainerGetPropertiesHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -335,7 +366,7 @@ public ContainerGetPropertiesHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the blobPublicAccess value. */ - public PublicAccessType blobPublicAccess() { + public PublicAccessType getBlobPublicAccess() { return this.blobPublicAccess; } @@ -347,7 +378,7 @@ public PublicAccessType blobPublicAccess() { * @param blobPublicAccess the blobPublicAccess value to set. * @return the ContainerGetPropertiesHeaders object itself. */ - public ContainerGetPropertiesHeaders blobPublicAccess(PublicAccessType blobPublicAccess) { + public ContainerGetPropertiesHeaders setBlobPublicAccess(PublicAccessType blobPublicAccess) { this.blobPublicAccess = blobPublicAccess; return this; } @@ -358,7 +389,7 @@ public ContainerGetPropertiesHeaders blobPublicAccess(PublicAccessType blobPubli * * @return the hasImmutabilityPolicy value. */ - public Boolean hasImmutabilityPolicy() { + public Boolean isHasImmutabilityPolicy() { return this.hasImmutabilityPolicy; } @@ -369,7 +400,7 @@ public Boolean hasImmutabilityPolicy() { * @param hasImmutabilityPolicy the hasImmutabilityPolicy value to set. * @return the ContainerGetPropertiesHeaders object itself. */ - public ContainerGetPropertiesHeaders hasImmutabilityPolicy(Boolean hasImmutabilityPolicy) { + public ContainerGetPropertiesHeaders setHasImmutabilityPolicy(Boolean hasImmutabilityPolicy) { this.hasImmutabilityPolicy = hasImmutabilityPolicy; return this; } @@ -380,7 +411,7 @@ public ContainerGetPropertiesHeaders hasImmutabilityPolicy(Boolean hasImmutabili * * @return the hasLegalHold value. */ - public Boolean hasLegalHold() { + public Boolean isHasLegalHold() { return this.hasLegalHold; } @@ -391,7 +422,7 @@ public Boolean hasLegalHold() { * @param hasLegalHold the hasLegalHold value to set. * @return the ContainerGetPropertiesHeaders object itself. */ - public ContainerGetPropertiesHeaders hasLegalHold(Boolean hasLegalHold) { + public ContainerGetPropertiesHeaders setHasLegalHold(Boolean hasLegalHold) { this.hasLegalHold = hasLegalHold; return this; } @@ -401,7 +432,7 @@ public ContainerGetPropertiesHeaders hasLegalHold(Boolean hasLegalHold) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -411,7 +442,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the ContainerGetPropertiesHeaders object itself. */ - public ContainerGetPropertiesHeaders errorCode(String errorCode) { + public ContainerGetPropertiesHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerItem.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerItem.java index 543085f349c8..adcbb9637a2a 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerItem.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerItem.java @@ -38,7 +38,7 @@ public final class ContainerItem { * * @return the name value. */ - public String name() { + public String getName() { return this.name; } @@ -48,7 +48,7 @@ public String name() { * @param name the name value to set. * @return the ContainerItem object itself. */ - public ContainerItem name(String name) { + public ContainerItem setName(String name) { this.name = name; return this; } @@ -58,7 +58,7 @@ public ContainerItem name(String name) { * * @return the properties value. */ - public ContainerProperties properties() { + public ContainerProperties getProperties() { return this.properties; } @@ -68,7 +68,7 @@ public ContainerProperties properties() { * @param properties the properties value to set. * @return the ContainerItem object itself. */ - public ContainerItem properties(ContainerProperties properties) { + public ContainerItem setProperties(ContainerProperties properties) { this.properties = properties; return this; } @@ -78,7 +78,7 @@ public ContainerItem properties(ContainerProperties properties) { * * @return the metadata value. */ - public Map metadata() { + public Map getMetadata() { return this.metadata; } @@ -88,7 +88,7 @@ public Map metadata() { * @param metadata the metadata value to set. * @return the ContainerItem object itself. */ - public ContainerItem metadata(Map metadata) { + public ContainerItem setMetadata(Map metadata) { this.metadata = metadata; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobFlatSegmentHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobFlatSegmentHeaders.java index ef1252a5a8d4..6e7940f81fb9 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobFlatSegmentHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobFlatSegmentHeaders.java @@ -23,6 +23,13 @@ public final class ContainerListBlobFlatSegmentHeaders { @JsonProperty(value = "Content-Type") private String contentType; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -57,7 +64,7 @@ public final class ContainerListBlobFlatSegmentHeaders { * * @return the contentType value. */ - public String contentType() { + public String getContentType() { return this.contentType; } @@ -68,18 +75,42 @@ public String contentType() { * @param contentType the contentType value to set. * @return the ContainerListBlobFlatSegmentHeaders object itself. */ - public ContainerListBlobFlatSegmentHeaders contentType(String contentType) { + public ContainerListBlobFlatSegmentHeaders setContentType(String contentType) { this.contentType = contentType; return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerListBlobFlatSegmentHeaders object itself. + */ + public ContainerListBlobFlatSegmentHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -90,7 +121,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the ContainerListBlobFlatSegmentHeaders object itself. */ - public ContainerListBlobFlatSegmentHeaders requestId(String requestId) { + public ContainerListBlobFlatSegmentHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -102,7 +133,7 @@ public ContainerListBlobFlatSegmentHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -114,7 +145,7 @@ public String version() { * @param version the version value to set. * @return the ContainerListBlobFlatSegmentHeaders object itself. */ - public ContainerListBlobFlatSegmentHeaders version(String version) { + public ContainerListBlobFlatSegmentHeaders setVersion(String version) { this.version = version; return this; } @@ -125,11 +156,11 @@ public ContainerListBlobFlatSegmentHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -139,7 +170,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the ContainerListBlobFlatSegmentHeaders object itself. */ - public ContainerListBlobFlatSegmentHeaders dateProperty(OffsetDateTime dateProperty) { + public ContainerListBlobFlatSegmentHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -153,7 +184,7 @@ public ContainerListBlobFlatSegmentHeaders dateProperty(OffsetDateTime datePrope * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -163,7 +194,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the ContainerListBlobFlatSegmentHeaders object itself. */ - public ContainerListBlobFlatSegmentHeaders errorCode(String errorCode) { + public ContainerListBlobFlatSegmentHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobHierarchySegmentHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobHierarchySegmentHeaders.java index d1a671cf7550..262ab42c8168 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobHierarchySegmentHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobHierarchySegmentHeaders.java @@ -23,6 +23,13 @@ public final class ContainerListBlobHierarchySegmentHeaders { @JsonProperty(value = "Content-Type") private String contentType; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -57,7 +64,7 @@ public final class ContainerListBlobHierarchySegmentHeaders { * * @return the contentType value. */ - public String contentType() { + public String getContentType() { return this.contentType; } @@ -68,18 +75,42 @@ public String contentType() { * @param contentType the contentType value to set. * @return the ContainerListBlobHierarchySegmentHeaders object itself. */ - public ContainerListBlobHierarchySegmentHeaders contentType(String contentType) { + public ContainerListBlobHierarchySegmentHeaders setContentType(String contentType) { this.contentType = contentType; return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerListBlobHierarchySegmentHeaders object itself. + */ + public ContainerListBlobHierarchySegmentHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -90,7 +121,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the ContainerListBlobHierarchySegmentHeaders object itself. */ - public ContainerListBlobHierarchySegmentHeaders requestId(String requestId) { + public ContainerListBlobHierarchySegmentHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -102,7 +133,7 @@ public ContainerListBlobHierarchySegmentHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -114,7 +145,7 @@ public String version() { * @param version the version value to set. * @return the ContainerListBlobHierarchySegmentHeaders object itself. */ - public ContainerListBlobHierarchySegmentHeaders version(String version) { + public ContainerListBlobHierarchySegmentHeaders setVersion(String version) { this.version = version; return this; } @@ -125,11 +156,11 @@ public ContainerListBlobHierarchySegmentHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -139,7 +170,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the ContainerListBlobHierarchySegmentHeaders object itself. */ - public ContainerListBlobHierarchySegmentHeaders dateProperty(OffsetDateTime dateProperty) { + public ContainerListBlobHierarchySegmentHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -153,7 +184,7 @@ public ContainerListBlobHierarchySegmentHeaders dateProperty(OffsetDateTime date * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -163,7 +194,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the ContainerListBlobHierarchySegmentHeaders object itself. */ - public ContainerListBlobHierarchySegmentHeaders errorCode(String errorCode) { + public ContainerListBlobHierarchySegmentHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListDetails.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListDetails.java index fbca16f733d7..ca8f39373487 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListDetails.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListDetails.java @@ -24,7 +24,7 @@ public ContainerListDetails() { * * @return a flag indicating whether metadata should be returned in the listing */ - public boolean metadata() { + public boolean getMetadata() { return this.metadata; } @@ -34,7 +34,7 @@ public boolean metadata() { * @param metadata Flag indicating whether metadata should be returned * @return the updated ContainerListDetails object */ - public ContainerListDetails metadata(boolean metadata) { + public ContainerListDetails setMetadata(boolean metadata) { this.metadata = metadata; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerProperties.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerProperties.java index f159a57f2cd5..f54271613eb5 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerProperties.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerProperties.java @@ -70,11 +70,11 @@ public final class ContainerProperties { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -83,7 +83,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the ContainerProperties object itself. */ - public ContainerProperties lastModified(OffsetDateTime lastModified) { + public ContainerProperties setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -97,7 +97,7 @@ public ContainerProperties lastModified(OffsetDateTime lastModified) { * * @return the etag value. */ - public String etag() { + public String getEtag() { return this.etag; } @@ -107,7 +107,7 @@ public String etag() { * @param etag the etag value to set. * @return the ContainerProperties object itself. */ - public ContainerProperties etag(String etag) { + public ContainerProperties setEtag(String etag) { this.etag = etag; return this; } @@ -118,7 +118,7 @@ public ContainerProperties etag(String etag) { * * @return the leaseStatus value. */ - public LeaseStatusType leaseStatus() { + public LeaseStatusType getLeaseStatus() { return this.leaseStatus; } @@ -129,7 +129,7 @@ public LeaseStatusType leaseStatus() { * @param leaseStatus the leaseStatus value to set. * @return the ContainerProperties object itself. */ - public ContainerProperties leaseStatus(LeaseStatusType leaseStatus) { + public ContainerProperties setLeaseStatus(LeaseStatusType leaseStatus) { this.leaseStatus = leaseStatus; return this; } @@ -140,7 +140,7 @@ public ContainerProperties leaseStatus(LeaseStatusType leaseStatus) { * * @return the leaseState value. */ - public LeaseStateType leaseState() { + public LeaseStateType getLeaseState() { return this.leaseState; } @@ -151,7 +151,7 @@ public LeaseStateType leaseState() { * @param leaseState the leaseState value to set. * @return the ContainerProperties object itself. */ - public ContainerProperties leaseState(LeaseStateType leaseState) { + public ContainerProperties setLeaseState(LeaseStateType leaseState) { this.leaseState = leaseState; return this; } @@ -162,7 +162,7 @@ public ContainerProperties leaseState(LeaseStateType leaseState) { * * @return the leaseDuration value. */ - public LeaseDurationType leaseDuration() { + public LeaseDurationType getLeaseDuration() { return this.leaseDuration; } @@ -173,7 +173,7 @@ public LeaseDurationType leaseDuration() { * @param leaseDuration the leaseDuration value to set. * @return the ContainerProperties object itself. */ - public ContainerProperties leaseDuration(LeaseDurationType leaseDuration) { + public ContainerProperties setLeaseDuration(LeaseDurationType leaseDuration) { this.leaseDuration = leaseDuration; return this; } @@ -184,7 +184,7 @@ public ContainerProperties leaseDuration(LeaseDurationType leaseDuration) { * * @return the publicAccess value. */ - public PublicAccessType publicAccess() { + public PublicAccessType getPublicAccess() { return this.publicAccess; } @@ -195,7 +195,7 @@ public PublicAccessType publicAccess() { * @param publicAccess the publicAccess value to set. * @return the ContainerProperties object itself. */ - public ContainerProperties publicAccess(PublicAccessType publicAccess) { + public ContainerProperties setPublicAccess(PublicAccessType publicAccess) { this.publicAccess = publicAccess; return this; } @@ -206,7 +206,7 @@ public ContainerProperties publicAccess(PublicAccessType publicAccess) { * * @return the hasImmutabilityPolicy value. */ - public Boolean hasImmutabilityPolicy() { + public Boolean isHasImmutabilityPolicy() { return this.hasImmutabilityPolicy; } @@ -217,7 +217,7 @@ public Boolean hasImmutabilityPolicy() { * @param hasImmutabilityPolicy the hasImmutabilityPolicy value to set. * @return the ContainerProperties object itself. */ - public ContainerProperties hasImmutabilityPolicy(Boolean hasImmutabilityPolicy) { + public ContainerProperties setHasImmutabilityPolicy(Boolean hasImmutabilityPolicy) { this.hasImmutabilityPolicy = hasImmutabilityPolicy; return this; } @@ -227,7 +227,7 @@ public ContainerProperties hasImmutabilityPolicy(Boolean hasImmutabilityPolicy) * * @return the hasLegalHold value. */ - public Boolean hasLegalHold() { + public Boolean isHasLegalHold() { return this.hasLegalHold; } @@ -237,7 +237,7 @@ public Boolean hasLegalHold() { * @param hasLegalHold the hasLegalHold value to set. * @return the ContainerProperties object itself. */ - public ContainerProperties hasLegalHold(Boolean hasLegalHold) { + public ContainerProperties setHasLegalHold(Boolean hasLegalHold) { this.hasLegalHold = hasLegalHold; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerReleaseLeaseHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerReleaseLeaseHeaders.java index 7a8766ab2424..0a69ab3a6f5e 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerReleaseLeaseHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerReleaseLeaseHeaders.java @@ -32,6 +32,13 @@ public final class ContainerReleaseLeaseHeaders { @JsonProperty(value = "Last-Modified") private DateTimeRfc1123 lastModified; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -67,7 +74,7 @@ public final class ContainerReleaseLeaseHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -79,7 +86,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the ContainerReleaseLeaseHeaders object itself. */ - public ContainerReleaseLeaseHeaders eTag(String eTag) { + public ContainerReleaseLeaseHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -92,11 +99,11 @@ public ContainerReleaseLeaseHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -108,7 +115,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the ContainerReleaseLeaseHeaders object itself. */ - public ContainerReleaseLeaseHeaders lastModified(OffsetDateTime lastModified) { + public ContainerReleaseLeaseHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -117,13 +124,37 @@ public ContainerReleaseLeaseHeaders lastModified(OffsetDateTime lastModified) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerReleaseLeaseHeaders object itself. + */ + public ContainerReleaseLeaseHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -134,7 +165,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the ContainerReleaseLeaseHeaders object itself. */ - public ContainerReleaseLeaseHeaders requestId(String requestId) { + public ContainerReleaseLeaseHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -146,7 +177,7 @@ public ContainerReleaseLeaseHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -158,7 +189,7 @@ public String version() { * @param version the version value to set. * @return the ContainerReleaseLeaseHeaders object itself. */ - public ContainerReleaseLeaseHeaders version(String version) { + public ContainerReleaseLeaseHeaders setVersion(String version) { this.version = version; return this; } @@ -169,11 +200,11 @@ public ContainerReleaseLeaseHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -183,7 +214,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the ContainerReleaseLeaseHeaders object itself. */ - public ContainerReleaseLeaseHeaders dateProperty(OffsetDateTime dateProperty) { + public ContainerReleaseLeaseHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -197,7 +228,7 @@ public ContainerReleaseLeaseHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -207,7 +238,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the ContainerReleaseLeaseHeaders object itself. */ - public ContainerReleaseLeaseHeaders errorCode(String errorCode) { + public ContainerReleaseLeaseHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerRenewLeaseHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerRenewLeaseHeaders.java index a192e95a96c8..a8fc107ba02d 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerRenewLeaseHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerRenewLeaseHeaders.java @@ -38,6 +38,13 @@ public final class ContainerRenewLeaseHeaders { @JsonProperty(value = "x-ms-lease-id") private String leaseId; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -73,7 +80,7 @@ public final class ContainerRenewLeaseHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -85,7 +92,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the ContainerRenewLeaseHeaders object itself. */ - public ContainerRenewLeaseHeaders eTag(String eTag) { + public ContainerRenewLeaseHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -98,11 +105,11 @@ public ContainerRenewLeaseHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -114,7 +121,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the ContainerRenewLeaseHeaders object itself. */ - public ContainerRenewLeaseHeaders lastModified(OffsetDateTime lastModified) { + public ContainerRenewLeaseHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -128,7 +135,7 @@ public ContainerRenewLeaseHeaders lastModified(OffsetDateTime lastModified) { * * @return the leaseId value. */ - public String leaseId() { + public String getLeaseId() { return this.leaseId; } @@ -138,18 +145,42 @@ public String leaseId() { * @param leaseId the leaseId value to set. * @return the ContainerRenewLeaseHeaders object itself. */ - public ContainerRenewLeaseHeaders leaseId(String leaseId) { + public ContainerRenewLeaseHeaders setLeaseId(String leaseId) { this.leaseId = leaseId; return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerRenewLeaseHeaders object itself. + */ + public ContainerRenewLeaseHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -160,7 +191,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the ContainerRenewLeaseHeaders object itself. */ - public ContainerRenewLeaseHeaders requestId(String requestId) { + public ContainerRenewLeaseHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -172,7 +203,7 @@ public ContainerRenewLeaseHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -184,7 +215,7 @@ public String version() { * @param version the version value to set. * @return the ContainerRenewLeaseHeaders object itself. */ - public ContainerRenewLeaseHeaders version(String version) { + public ContainerRenewLeaseHeaders setVersion(String version) { this.version = version; return this; } @@ -195,11 +226,11 @@ public ContainerRenewLeaseHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -209,7 +240,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the ContainerRenewLeaseHeaders object itself. */ - public ContainerRenewLeaseHeaders dateProperty(OffsetDateTime dateProperty) { + public ContainerRenewLeaseHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -223,7 +254,7 @@ public ContainerRenewLeaseHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -233,7 +264,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the ContainerRenewLeaseHeaders object itself. */ - public ContainerRenewLeaseHeaders errorCode(String errorCode) { + public ContainerRenewLeaseHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerSetAccessPolicyHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerSetAccessPolicyHeaders.java index 763e75291800..b2e5425b3cf2 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerSetAccessPolicyHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerSetAccessPolicyHeaders.java @@ -32,6 +32,13 @@ public final class ContainerSetAccessPolicyHeaders { @JsonProperty(value = "Last-Modified") private DateTimeRfc1123 lastModified; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -67,7 +74,7 @@ public final class ContainerSetAccessPolicyHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -79,7 +86,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the ContainerSetAccessPolicyHeaders object itself. */ - public ContainerSetAccessPolicyHeaders eTag(String eTag) { + public ContainerSetAccessPolicyHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -92,11 +99,11 @@ public ContainerSetAccessPolicyHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -108,7 +115,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the ContainerSetAccessPolicyHeaders object itself. */ - public ContainerSetAccessPolicyHeaders lastModified(OffsetDateTime lastModified) { + public ContainerSetAccessPolicyHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -117,13 +124,37 @@ public ContainerSetAccessPolicyHeaders lastModified(OffsetDateTime lastModified) return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerSetAccessPolicyHeaders object itself. + */ + public ContainerSetAccessPolicyHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -134,7 +165,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the ContainerSetAccessPolicyHeaders object itself. */ - public ContainerSetAccessPolicyHeaders requestId(String requestId) { + public ContainerSetAccessPolicyHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -146,7 +177,7 @@ public ContainerSetAccessPolicyHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -158,7 +189,7 @@ public String version() { * @param version the version value to set. * @return the ContainerSetAccessPolicyHeaders object itself. */ - public ContainerSetAccessPolicyHeaders version(String version) { + public ContainerSetAccessPolicyHeaders setVersion(String version) { this.version = version; return this; } @@ -169,11 +200,11 @@ public ContainerSetAccessPolicyHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -183,7 +214,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the ContainerSetAccessPolicyHeaders object itself. */ - public ContainerSetAccessPolicyHeaders dateProperty(OffsetDateTime dateProperty) { + public ContainerSetAccessPolicyHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -197,7 +228,7 @@ public ContainerSetAccessPolicyHeaders dateProperty(OffsetDateTime dateProperty) * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -207,7 +238,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the ContainerSetAccessPolicyHeaders object itself. */ - public ContainerSetAccessPolicyHeaders errorCode(String errorCode) { + public ContainerSetAccessPolicyHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerSetMetadataHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerSetMetadataHeaders.java index e685322b83ff..909b0681b7df 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerSetMetadataHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerSetMetadataHeaders.java @@ -32,6 +32,13 @@ public final class ContainerSetMetadataHeaders { @JsonProperty(value = "Last-Modified") private DateTimeRfc1123 lastModified; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -67,7 +74,7 @@ public final class ContainerSetMetadataHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -79,7 +86,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the ContainerSetMetadataHeaders object itself. */ - public ContainerSetMetadataHeaders eTag(String eTag) { + public ContainerSetMetadataHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -92,11 +99,11 @@ public ContainerSetMetadataHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -108,7 +115,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the ContainerSetMetadataHeaders object itself. */ - public ContainerSetMetadataHeaders lastModified(OffsetDateTime lastModified) { + public ContainerSetMetadataHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -117,13 +124,37 @@ public ContainerSetMetadataHeaders lastModified(OffsetDateTime lastModified) { return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ContainerSetMetadataHeaders object itself. + */ + public ContainerSetMetadataHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -134,7 +165,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the ContainerSetMetadataHeaders object itself. */ - public ContainerSetMetadataHeaders requestId(String requestId) { + public ContainerSetMetadataHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -146,7 +177,7 @@ public ContainerSetMetadataHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -158,7 +189,7 @@ public String version() { * @param version the version value to set. * @return the ContainerSetMetadataHeaders object itself. */ - public ContainerSetMetadataHeaders version(String version) { + public ContainerSetMetadataHeaders setVersion(String version) { this.version = version; return this; } @@ -169,11 +200,11 @@ public ContainerSetMetadataHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -183,7 +214,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the ContainerSetMetadataHeaders object itself. */ - public ContainerSetMetadataHeaders dateProperty(OffsetDateTime dateProperty) { + public ContainerSetMetadataHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -197,7 +228,7 @@ public ContainerSetMetadataHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -207,7 +238,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the ContainerSetMetadataHeaders object itself. */ - public ContainerSetMetadataHeaders errorCode(String errorCode) { + public ContainerSetMetadataHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersGetAccessPolicyResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersGetAccessPolicyResponse.java index 8003bad140ac..abbe7cfc7722 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersGetAccessPolicyResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersGetAccessPolicyResponse.java @@ -30,7 +30,7 @@ public ContainersGetAccessPolicyResponse(HttpRequest request, int statusCode, Ht * @return the deserialized response body. */ @Override - public List value() { - return super.value(); + public List getValue() { + return super.getValue(); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersListBlobFlatSegmentResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersListBlobFlatSegmentResponse.java index 30a585890905..d4eacc0c169e 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersListBlobFlatSegmentResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersListBlobFlatSegmentResponse.java @@ -29,7 +29,7 @@ public ContainersListBlobFlatSegmentResponse(HttpRequest request, int statusCode * @return the deserialized response body. */ @Override - public ListBlobsFlatSegmentResponse value() { - return super.value(); + public ListBlobsFlatSegmentResponse getValue() { + return super.getValue(); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersListBlobHierarchySegmentResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersListBlobHierarchySegmentResponse.java index 2077bc46574e..df7eddaeecde 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersListBlobHierarchySegmentResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersListBlobHierarchySegmentResponse.java @@ -29,7 +29,7 @@ public ContainersListBlobHierarchySegmentResponse(HttpRequest request, int statu * @return the deserialized response body. */ @Override - public ListBlobsHierarchySegmentResponse value() { - return super.value(); + public ListBlobsHierarchySegmentResponse getValue() { + return super.getValue(); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CorsRule.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CorsRule.java index e111fbb62e30..3dad836e25a8 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CorsRule.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CorsRule.java @@ -67,7 +67,7 @@ public final class CorsRule { * * @return the allowedOrigins value. */ - public String allowedOrigins() { + public String getAllowedOrigins() { return this.allowedOrigins; } @@ -82,7 +82,7 @@ public String allowedOrigins() { * @param allowedOrigins the allowedOrigins value to set. * @return the CorsRule object itself. */ - public CorsRule allowedOrigins(String allowedOrigins) { + public CorsRule setAllowedOrigins(String allowedOrigins) { this.allowedOrigins = allowedOrigins; return this; } @@ -93,7 +93,7 @@ public CorsRule allowedOrigins(String allowedOrigins) { * * @return the allowedMethods value. */ - public String allowedMethods() { + public String getAllowedMethods() { return this.allowedMethods; } @@ -104,7 +104,7 @@ public String allowedMethods() { * @param allowedMethods the allowedMethods value to set. * @return the CorsRule object itself. */ - public CorsRule allowedMethods(String allowedMethods) { + public CorsRule setAllowedMethods(String allowedMethods) { this.allowedMethods = allowedMethods; return this; } @@ -115,7 +115,7 @@ public CorsRule allowedMethods(String allowedMethods) { * * @return the allowedHeaders value. */ - public String allowedHeaders() { + public String getAllowedHeaders() { return this.allowedHeaders; } @@ -126,7 +126,7 @@ public String allowedHeaders() { * @param allowedHeaders the allowedHeaders value to set. * @return the CorsRule object itself. */ - public CorsRule allowedHeaders(String allowedHeaders) { + public CorsRule setAllowedHeaders(String allowedHeaders) { this.allowedHeaders = allowedHeaders; return this; } @@ -138,7 +138,7 @@ public CorsRule allowedHeaders(String allowedHeaders) { * * @return the exposedHeaders value. */ - public String exposedHeaders() { + public String getExposedHeaders() { return this.exposedHeaders; } @@ -150,7 +150,7 @@ public String exposedHeaders() { * @param exposedHeaders the exposedHeaders value to set. * @return the CorsRule object itself. */ - public CorsRule exposedHeaders(String exposedHeaders) { + public CorsRule setExposedHeaders(String exposedHeaders) { this.exposedHeaders = exposedHeaders; return this; } @@ -161,7 +161,7 @@ public CorsRule exposedHeaders(String exposedHeaders) { * * @return the maxAgeInSeconds value. */ - public int maxAgeInSeconds() { + public int getMaxAgeInSeconds() { return this.maxAgeInSeconds; } @@ -172,7 +172,7 @@ public int maxAgeInSeconds() { * @param maxAgeInSeconds the maxAgeInSeconds value to set. * @return the CorsRule object itself. */ - public CorsRule maxAgeInSeconds(int maxAgeInSeconds) { + public CorsRule setMaxAgeInSeconds(int maxAgeInSeconds) { this.maxAgeInSeconds = maxAgeInSeconds; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CpkInfo.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CpkInfo.java new file mode 100644 index 000000000000..d55be810f7ad --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CpkInfo.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * Additional parameters for a set of operations. + */ +@JacksonXmlRootElement(localName = "cpk-info") +@Fluent +public final class CpkInfo { + /* + * Optional. Specifies the encryption key to use to encrypt the data + * provided in the request. If not specified, encryption is performed with + * the root account encryption key. For more information, see Encryption + * at Rest for Azure Storage Services. + */ + @JsonProperty(value = "encryptionKey") + private String encryptionKey; + + /* + * The SHA-256 hash of the provided encryption key. Must be provided if the + * x-ms-encryption-key header is provided. + */ + @JsonProperty(value = "encryptionKeySha256") + private String encryptionKeySha256; + + /* + * The algorithm used to produce the encryption key hash. Currently, the + * only accepted value is "AES256". Must be provided if the + * x-ms-encryption-key header is provided. Possible values include: + * 'AES256' + */ + @JsonProperty(value = "encryptionAlgorithm") + private EncryptionAlgorithmType encryptionAlgorithm; + + /** + * Get the encryptionKey property: Optional. Specifies the encryption key + * to use to encrypt the data provided in the request. If not specified, + * encryption is performed with the root account encryption key. For more + * information, see Encryption at Rest for Azure Storage Services. + * + * @return the encryptionKey value. + */ + public String getEncryptionKey() { + return this.encryptionKey; + } + + /** + * Set the encryptionKey property: Optional. Specifies the encryption key + * to use to encrypt the data provided in the request. If not specified, + * encryption is performed with the root account encryption key. For more + * information, see Encryption at Rest for Azure Storage Services. + * + * @param encryptionKey the encryptionKey value to set. + * @return the CpkInfo object itself. + */ + public CpkInfo setEncryptionKey(String encryptionKey) { + this.encryptionKey = encryptionKey; + return this; + } + + /** + * Get the encryptionKeySha256 property: The SHA-256 hash of the provided + * encryption key. Must be provided if the x-ms-encryption-key header is + * provided. + * + * @return the encryptionKeySha256 value. + */ + public String getEncryptionKeySha256() { + return this.encryptionKeySha256; + } + + /** + * Set the encryptionKeySha256 property: The SHA-256 hash of the provided + * encryption key. Must be provided if the x-ms-encryption-key header is + * provided. + * + * @param encryptionKeySha256 the encryptionKeySha256 value to set. + * @return the CpkInfo object itself. + */ + public CpkInfo setEncryptionKeySha256(String encryptionKeySha256) { + this.encryptionKeySha256 = encryptionKeySha256; + return this; + } + + /** + * Get the encryptionAlgorithm property: The algorithm used to produce the + * encryption key hash. Currently, the only accepted value is "AES256". + * Must be provided if the x-ms-encryption-key header is provided. Possible + * values include: 'AES256'. + * + * @return the encryptionAlgorithm value. + */ + public EncryptionAlgorithmType getEncryptionAlgorithm() { + return this.encryptionAlgorithm; + } + + /** + * Set the encryptionAlgorithm property: The algorithm used to produce the + * encryption key hash. Currently, the only accepted value is "AES256". + * Must be provided if the x-ms-encryption-key header is provided. Possible + * values include: 'AES256'. + * + * @param encryptionAlgorithm the encryptionAlgorithm value to set. + * @return the CpkInfo object itself. + */ + public CpkInfo setEncryptionAlgorithm(EncryptionAlgorithmType encryptionAlgorithm) { + this.encryptionAlgorithm = encryptionAlgorithm; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CustomHierarchicalListingDeserializer.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CustomHierarchicalListingDeserializer.java index 1a6a0652c406..5207ff299d13 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CustomHierarchicalListingDeserializer.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CustomHierarchicalListingDeserializer.java @@ -19,9 +19,9 @@ public BlobHierarchyListSegment deserialize(JsonParser p, DeserializationContext ArrayList blobPrefixes = new ArrayList<>(); JsonDeserializer blobItemDeserializer = - ctxt.findRootValueDeserializer(ctxt.constructType(BlobItem.class)); + ctxt.findRootValueDeserializer(ctxt.constructType(BlobItem.class)); JsonDeserializer blobPrefixDeserializer = - ctxt.findRootValueDeserializer(ctxt.constructType(BlobPrefix.class)); + ctxt.findRootValueDeserializer(ctxt.constructType(BlobPrefix.class)); for (JsonToken currentToken = p.nextToken(); !currentToken.name().equals("END_OBJECT"); currentToken = p.nextToken()) { @@ -29,14 +29,13 @@ public BlobHierarchyListSegment deserialize(JsonParser p, DeserializationContext p.nextToken(); if (p.getCurrentName().equals("Blob")) { - blobItems.add((BlobItem)blobItemDeserializer.deserialize(p, ctxt)); - } - else if (p.getCurrentName().equals("BlobPrefix")) { - blobPrefixes.add((BlobPrefix)blobPrefixDeserializer.deserialize(p, ctxt)); + blobItems.add((BlobItem) blobItemDeserializer.deserialize(p, ctxt)); + } else if (p.getCurrentName().equals("BlobPrefix")) { + blobPrefixes.add((BlobPrefix) blobPrefixDeserializer.deserialize(p, ctxt)); } } - return new BlobHierarchyListSegment().blobItems(blobItems).blobPrefixes(blobPrefixes); + return new BlobHierarchyListSegment().setBlobItems(blobItems).setBlobPrefixes(blobPrefixes); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CustomerProvidedKey.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CustomerProvidedKey.java new file mode 100644 index 000000000000..cc3484fe9c99 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CustomerProvidedKey.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob.models; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Base64; + +public class CustomerProvidedKey { + + /** + * Base64 encoded string of the encryption key. + */ + private final String key; + + /** + * Base64 encoded string of the encryption key's SHA256 hash. + */ + private final String keySHA256; + + /** + * The algorithm for Azure Blob Storage to encrypt with. + * Azure Blob Storage only offers AES256 encryption. + */ + private final EncryptionAlgorithmType encryptionAlgorithm = EncryptionAlgorithmType.AES256; + + + /** + * Creates a new wrapper for a client provided key. + * + * @param key The encryption key encoded as a base64 string. + * @throws NoSuchAlgorithmException Throws if MessageDigest "SHA-256" cannot be found. + */ + public CustomerProvidedKey(String key) throws NoSuchAlgorithmException { + + this.key = key; + + MessageDigest sha256 = MessageDigest.getInstance("SHA-256"); + byte[] keyhash = sha256.digest(Base64.getDecoder().decode(key)); + this.keySHA256 = Base64.getEncoder().encodeToString(keyhash); + } + + /** + * Creates a new wrapper for a client provided key. + * + * @param key The encryption key bytes. + * + * @throws NoSuchAlgorithmException Throws if MessageDigest "SHA-256" cannot be found. + */ + public CustomerProvidedKey(byte[] key) throws NoSuchAlgorithmException { + + this.key = Base64.getEncoder().encodeToString(key); + + MessageDigest sha256 = MessageDigest.getInstance("SHA-256"); + byte[] keyhash = sha256.digest(key); + this.keySHA256 = Base64.getEncoder().encodeToString(keyhash); + } + + + /** + * Gets the encryption key. + * + * @return A base64 encoded string of the encryption key. + */ + public String getKey() { + return key; + } + + /** + * Gets the encryption key's hash. + * + * @return A base64 encoded string of the encryption key hash. + */ + public String getKeySHA256() { + return keySHA256; + } + + /** + * Gets the algorithm to use this key with. + * + * @return A label for the encryption algorithm, as understood by Azure Storage. + */ + public EncryptionAlgorithmType getEncryptionAlgorithm() { + return encryptionAlgorithm; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CustomerProvidedKeyInfo.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CustomerProvidedKeyInfo.java new file mode 100644 index 000000000000..3c033adb0ccc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CustomerProvidedKeyInfo.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * Additional parameters for a set of operations. + */ +@JacksonXmlRootElement(localName = "customer-provided-key-info") +@Fluent +public final class CustomerProvidedKeyInfo { + /* + * Optional. Specifies the encryption scope to use to encrypt the data + * provided in the request. If not specified, encryption is performed with + * the root account encryption key. For more information, see Encryption + * at Rest for Azure Storage Services. + */ + @JsonProperty(value = "encryptionScope") + private String encryptionScope; + + /** + * Get the encryptionScope property: Optional. Specifies the encryption + * scope to use to encrypt the data provided in the request. If not + * specified, encryption is performed with the root account encryption key. + * For more information, see Encryption at Rest for Azure Storage Services. + * + * @return the encryptionScope value. + */ + public String encryptionScope() { + return this.encryptionScope; + } + + /** + * Set the encryptionScope property: Optional. Specifies the encryption + * scope to use to encrypt the data provided in the request. If not + * specified, encryption is performed with the root account encryption key. + * For more information, see Encryption at Rest for Azure Storage Services. + * + * @param encryptionScope the encryptionScope value to set. + * @return the CustomerProvidedKeyInfo object itself. + */ + public CustomerProvidedKeyInfo encryptionScope(String encryptionScope) { + this.encryptionScope = encryptionScope; + return this; + } +} 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/models/DataLakeStorageError.java new file mode 100644 index 000000000000..589ed102661d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DataLakeStorageError.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * The DataLakeStorageError model. + */ +@JacksonXmlRootElement(localName = "DataLakeStorageError") +@Fluent +public final class DataLakeStorageError { + /* + * The service error response object. + */ + @JsonProperty(value = "error") + private DataLakeStorageErrorError error; + + /** + * Get the error property: The service error response object. + * + * @return the error value. + */ + public DataLakeStorageErrorError getError() { + return this.error; + } + + /** + * Set the error property: The service error response object. + * + * @param error the error value to set. + * @return the DataLakeStorageError object itself. + */ + public DataLakeStorageError setError(DataLakeStorageErrorError error) { + this.error = error; + return this; + } +} 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/models/DataLakeStorageErrorError.java new file mode 100644 index 000000000000..b32bcf08073a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DataLakeStorageErrorError.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * The service error response object. + */ +@JacksonXmlRootElement(localName = "DataLakeStorageError_error") +@Fluent +public final class DataLakeStorageErrorError { + /* + * The service error code. + */ + @JsonProperty(value = "Code") + private String code; + + /* + * The service error message. + */ + @JsonProperty(value = "Message") + private String message; + + /** + * Get the code property: The service error code. + * + * @return the code value. + */ + public String getCode() { + return this.code; + } + + /** + * Set the code property: The service error code. + * + * @param code the code value to set. + * @return the DataLakeStorageErrorError object itself. + */ + public DataLakeStorageErrorError setCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message property: The service error message. + * + * @return the message value. + */ + public String getMessage() { + return this.message; + } + + /** + * Set the message property: The service error message. + * + * @param message the message value to set. + * @return the DataLakeStorageErrorError object itself. + */ + public DataLakeStorageErrorError setMessage(String message) { + this.message = message; + return this; + } +} 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/models/DataLakeStorageErrorException.java new file mode 100644 index 000000000000..4516ccd4031b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DataLakeStorageErrorException.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.HttpResponse; + +/** + * Exception thrown for an invalid response with DataLakeStorageError information. + */ +public final class DataLakeStorageErrorException extends HttpResponseException { + /** + * Initializes a new instance of the DataLakeStorageErrorException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + */ + public DataLakeStorageErrorException(String message, HttpResponse response) { + super(message, response); + } + + /** + * Initializes a new instance of the DataLakeStorageErrorException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + * @param value the deserialized response value. + */ + public DataLakeStorageErrorException(String message, HttpResponse response, DataLakeStorageError value) { + super(message, response, value); + } + + @Override + public DataLakeStorageError getValue() { + return (DataLakeStorageError) super.getValue(); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryCreateHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryCreateHeaders.java new file mode 100644 index 000000000000..b7031f4ef96d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryCreateHeaders.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for Create operation. + */ +@JacksonXmlRootElement(localName = "Directory-Create-Headers") +@Fluent +public final class DirectoryCreateHeaders { + /* + * An HTTP entity tag associated with the file or directory. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /* + * The data and time the file or directory was last modified. Write + * operations on the file or directory update the last modified time. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + + /* + * A server-generated UUID recorded in the analytics logs for + * troubleshooting and correlation. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * The version of the REST protocol used to process the request. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * The size of the resource in bytes. + */ + @JsonProperty(value = "Content-Length") + private Long contentLength; + + /* + * A UTC date/time value generated by the service that indicates the time + * at which the response was initiated. + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /** + * Get the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @param eTag the eTag value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @param lastModified the lastModified value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @return the requestId value. + */ + public String getRequestId() { + return this.requestId; + } + + /** + * Set the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @param requestId the requestId value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: The version of the REST protocol used to + * process the request. + * + * @return the version value. + */ + public String getVersion() { + return this.version; + } + + /** + * Set the version property: The version of the REST protocol used to + * process the request. + * + * @param version the version value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders setVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the contentLength property: The size of the resource in bytes. + * + * @return the contentLength value. + */ + public Long getContentLength() { + return this.contentLength; + } + + /** + * Set the contentLength property: The size of the resource in bytes. + * + * @param contentLength the contentLength value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders setContentLength(Long contentLength) { + this.contentLength = contentLength; + return this; + } + + /** + * Get the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime getDateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.getDateTime(); + } + + /** + * Set the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the DirectoryCreateHeaders object itself. + */ + public DirectoryCreateHeaders setDateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryDeleteHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryDeleteHeaders.java new file mode 100644 index 000000000000..2efe591a4bb6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryDeleteHeaders.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for Delete operation. + */ +@JacksonXmlRootElement(localName = "Directory-Delete-Headers") +@Fluent +public final class DirectoryDeleteHeaders { + /* + * When renaming a directory, the number of paths that are renamed with + * each invocation is limited. If the number of paths to be renamed exceeds + * this limit, a continuation token is returned in this response header. + * When a continuation token is returned in the response, it must be + * specified in a subsequent invocation of the rename operation to continue + * renaming the directory. + */ + @JsonProperty(value = "x-ms-continuation") + private String marker; + + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + + /* + * A server-generated UUID recorded in the analytics logs for + * troubleshooting and correlation. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * The version of the REST protocol used to process the request. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * A UTC date/time value generated by the service that indicates the time + * at which the response was initiated. + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /** + * Get the marker property: When renaming a directory, the number of paths + * that are renamed with each invocation is limited. If the number of paths + * to be renamed exceeds this limit, a continuation token is returned in + * this response header. When a continuation token is returned in the + * response, it must be specified in a subsequent invocation of the rename + * operation to continue renaming the directory. + * + * @return the marker value. + */ + public String getMarker() { + return this.marker; + } + + /** + * Set the marker property: When renaming a directory, the number of paths + * that are renamed with each invocation is limited. If the number of paths + * to be renamed exceeds this limit, a continuation token is returned in + * this response header. When a continuation token is returned in the + * response, it must be specified in a subsequent invocation of the rename + * operation to continue renaming the directory. + * + * @param marker the marker value to set. + * @return the DirectoryDeleteHeaders object itself. + */ + public DirectoryDeleteHeaders setMarker(String marker) { + this.marker = marker; + return this; + } + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the DirectoryDeleteHeaders object itself. + */ + public DirectoryDeleteHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @return the requestId value. + */ + public String getRequestId() { + return this.requestId; + } + + /** + * Set the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @param requestId the requestId value to set. + * @return the DirectoryDeleteHeaders object itself. + */ + public DirectoryDeleteHeaders setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: The version of the REST protocol used to + * process the request. + * + * @return the version value. + */ + public String getVersion() { + return this.version; + } + + /** + * Set the version property: The version of the REST protocol used to + * process the request. + * + * @param version the version value to set. + * @return the DirectoryDeleteHeaders object itself. + */ + public DirectoryDeleteHeaders setVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime getDateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.getDateTime(); + } + + /** + * Set the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the DirectoryDeleteHeaders object itself. + */ + public DirectoryDeleteHeaders setDateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryGetAccessControlHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryGetAccessControlHeaders.java new file mode 100644 index 000000000000..15750adda3c3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryGetAccessControlHeaders.java @@ -0,0 +1,334 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for GetAccessControl operation. + */ +@JacksonXmlRootElement(localName = "Directory-GetAccessControl-Headers") +@Fluent +public final class DirectoryGetAccessControlHeaders { + /* + * A UTC date/time value generated by the service that indicates the time + * at which the response was initiated. + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /* + * An HTTP entity tag associated with the file or directory. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /* + * The data and time the file or directory was last modified. Write + * operations on the file or directory update the last modified time. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /* + * The owner of the file or directory. Included in the response if + * Hierarchical Namespace is enabled for the account. + */ + @JsonProperty(value = "x-ms-owner") + private String xMsOwner; + + /* + * The owning group of the file or directory. Included in the response if + * Hierarchical Namespace is enabled for the account. + */ + @JsonProperty(value = "x-ms-group") + private String xMsGroup; + + /* + * The POSIX access permissions for the file owner, the file owning group, + * and others. Included in the response if Hierarchical Namespace is + * enabled for the account. + */ + @JsonProperty(value = "x-ms-permissions") + private String xMsPermissions; + + /* + * The POSIX access control list for the file or directory. Included in + * the response only if the action is "getAccessControl" and Hierarchical + * Namespace is enabled for the account. + */ + @JsonProperty(value = "x-ms-acl") + private String xMsAcl; + + /* + * A server-generated UUID recorded in the analytics logs for + * troubleshooting and correlation. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * The version of the REST protocol used to process the request. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + + /** + * Get the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime getDateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.getDateTime(); + } + + /** + * Set the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the DirectoryGetAccessControlHeaders object itself. + */ + public DirectoryGetAccessControlHeaders setDateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } + + /** + * Get the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @param eTag the eTag value to set. + * @return the DirectoryGetAccessControlHeaders object itself. + */ + public DirectoryGetAccessControlHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @param lastModified the lastModified value to set. + * @return the DirectoryGetAccessControlHeaders object itself. + */ + public DirectoryGetAccessControlHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the xMsOwner property: The owner of the file or directory. Included + * in the response if Hierarchical Namespace is enabled for the account. + * + * @return the xMsOwner value. + */ + public String getXMsOwner() { + return this.xMsOwner; + } + + /** + * Set the xMsOwner property: The owner of the file or directory. Included + * in the response if Hierarchical Namespace is enabled for the account. + * + * @param xMsOwner the xMsOwner value to set. + * @return the DirectoryGetAccessControlHeaders object itself. + */ + public DirectoryGetAccessControlHeaders setXMsOwner(String xMsOwner) { + this.xMsOwner = xMsOwner; + return this; + } + + /** + * Get the xMsGroup property: The owning group of the file or directory. + * Included in the response if Hierarchical Namespace is enabled for the + * account. + * + * @return the xMsGroup value. + */ + public String getXMsGroup() { + return this.xMsGroup; + } + + /** + * Set the xMsGroup property: The owning group of the file or directory. + * Included in the response if Hierarchical Namespace is enabled for the + * account. + * + * @param xMsGroup the xMsGroup value to set. + * @return the DirectoryGetAccessControlHeaders object itself. + */ + public DirectoryGetAccessControlHeaders setXMsGroup(String xMsGroup) { + this.xMsGroup = xMsGroup; + return this; + } + + /** + * Get the xMsPermissions property: The POSIX access permissions for the + * file owner, the file owning group, and others. Included in the response + * if Hierarchical Namespace is enabled for the account. + * + * @return the xMsPermissions value. + */ + public String getXMsPermissions() { + return this.xMsPermissions; + } + + /** + * Set the xMsPermissions property: The POSIX access permissions for the + * file owner, the file owning group, and others. Included in the response + * if Hierarchical Namespace is enabled for the account. + * + * @param xMsPermissions the xMsPermissions value to set. + * @return the DirectoryGetAccessControlHeaders object itself. + */ + public DirectoryGetAccessControlHeaders setXMsPermissions(String xMsPermissions) { + this.xMsPermissions = xMsPermissions; + return this; + } + + /** + * Get the xMsAcl property: The POSIX access control list for the file or + * directory. Included in the response only if the action is + * "getAccessControl" and Hierarchical Namespace is enabled for the + * account. + * + * @return the xMsAcl value. + */ + public String getXMsAcl() { + return this.xMsAcl; + } + + /** + * Set the xMsAcl property: The POSIX access control list for the file or + * directory. Included in the response only if the action is + * "getAccessControl" and Hierarchical Namespace is enabled for the + * account. + * + * @param xMsAcl the xMsAcl value to set. + * @return the DirectoryGetAccessControlHeaders object itself. + */ + public DirectoryGetAccessControlHeaders setXMsAcl(String xMsAcl) { + this.xMsAcl = xMsAcl; + return this; + } + + /** + * Get the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @return the requestId value. + */ + public String getRequestId() { + return this.requestId; + } + + /** + * Set the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @param requestId the requestId value to set. + * @return the DirectoryGetAccessControlHeaders object itself. + */ + public DirectoryGetAccessControlHeaders setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: The version of the REST protocol used to + * process the request. + * + * @return the version value. + */ + public String getVersion() { + return this.version; + } + + /** + * Set the version property: The version of the REST protocol used to + * process the request. + * + * @param version the version value to set. + * @return the DirectoryGetAccessControlHeaders object itself. + */ + public DirectoryGetAccessControlHeaders setVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the DirectoryGetAccessControlHeaders object itself. + */ + public DirectoryGetAccessControlHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryHttpHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryHttpHeaders.java new file mode 100644 index 000000000000..879a98a08d82 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryHttpHeaders.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * Additional parameters for a set of operations, such as: Directorys_create, + * Directorys_rename, Blobs_rename. + */ +@JacksonXmlRootElement(localName = "directory-http-headers") +@Fluent +public final class DirectoryHttpHeaders { + /* + * Cache control for given resource + */ + @JsonProperty(value = "cacheControl") + private String cacheControl; + + /* + * Content type for given resource + */ + @JsonProperty(value = "contentType") + private String contentType; + + /* + * Content encoding for given resource + */ + @JsonProperty(value = "contentEncoding") + private String contentEncoding; + + /* + * Content language for given resource + */ + @JsonProperty(value = "contentLanguage") + private String contentLanguage; + + /* + * Content disposition for given resource + */ + @JsonProperty(value = "contentDisposition") + private String contentDisposition; + + /** + * Get the cacheControl property: Cache control for given resource. + * + * @return the cacheControl value. + */ + public String getCacheControl() { + return this.cacheControl; + } + + /** + * Set the cacheControl property: Cache control for given resource. + * + * @param cacheControl the cacheControl value to set. + * @return the DirectoryHttpHeaders object itself. + */ + public DirectoryHttpHeaders setCacheControl(String cacheControl) { + this.cacheControl = cacheControl; + return this; + } + + /** + * Get the contentType property: Content type for given resource. + * + * @return the contentType value. + */ + public String getContentType() { + return this.contentType; + } + + /** + * Set the contentType property: Content type for given resource. + * + * @param contentType the contentType value to set. + * @return the DirectoryHttpHeaders object itself. + */ + public DirectoryHttpHeaders setContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the contentEncoding property: Content encoding for given resource. + * + * @return the contentEncoding value. + */ + public String getContentEncoding() { + return this.contentEncoding; + } + + /** + * Set the contentEncoding property: Content encoding for given resource. + * + * @param contentEncoding the contentEncoding value to set. + * @return the DirectoryHttpHeaders object itself. + */ + public DirectoryHttpHeaders setContentEncoding(String contentEncoding) { + this.contentEncoding = contentEncoding; + return this; + } + + /** + * Get the contentLanguage property: Content language for given resource. + * + * @return the contentLanguage value. + */ + public String getContentLanguage() { + return this.contentLanguage; + } + + /** + * Set the contentLanguage property: Content language for given resource. + * + * @param contentLanguage the contentLanguage value to set. + * @return the DirectoryHttpHeaders object itself. + */ + public DirectoryHttpHeaders setContentLanguage(String contentLanguage) { + this.contentLanguage = contentLanguage; + return this; + } + + /** + * Get the contentDisposition property: Content disposition for given + * resource. + * + * @return the contentDisposition value. + */ + public String getContentDisposition() { + return this.contentDisposition; + } + + /** + * Set the contentDisposition property: Content disposition for given + * resource. + * + * @param contentDisposition the contentDisposition value to set. + * @return the DirectoryHttpHeaders object itself. + */ + public DirectoryHttpHeaders setContentDisposition(String contentDisposition) { + this.contentDisposition = contentDisposition; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryRenameHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryRenameHeaders.java new file mode 100644 index 000000000000..d7b719b8bc72 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectoryRenameHeaders.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for Rename operation. + */ +@JacksonXmlRootElement(localName = "Directory-Rename-Headers") +@Fluent +public final class DirectoryRenameHeaders { + /* + * When renaming a directory, the number of paths that are renamed with + * each invocation is limited. If the number of paths to be renamed exceeds + * this limit, a continuation token is returned in this response header. + * When a continuation token is returned in the response, it must be + * specified in a subsequent invocation of the rename operation to continue + * renaming the directory. + */ + @JsonProperty(value = "x-ms-continuation") + private String marker; + + /* + * An HTTP entity tag associated with the file or directory. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /* + * The data and time the file or directory was last modified. Write + * operations on the file or directory update the last modified time. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + + /* + * A server-generated UUID recorded in the analytics logs for + * troubleshooting and correlation. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * The version of the REST protocol used to process the request. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * The size of the resource in bytes. + */ + @JsonProperty(value = "Content-Length") + private Long contentLength; + + /* + * A UTC date/time value generated by the service that indicates the time + * at which the response was initiated. + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /** + * Get the marker property: When renaming a directory, the number of paths + * that are renamed with each invocation is limited. If the number of paths + * to be renamed exceeds this limit, a continuation token is returned in + * this response header. When a continuation token is returned in the + * response, it must be specified in a subsequent invocation of the rename + * operation to continue renaming the directory. + * + * @return the marker value. + */ + public String getMarker() { + return this.marker; + } + + /** + * Set the marker property: When renaming a directory, the number of paths + * that are renamed with each invocation is limited. If the number of paths + * to be renamed exceeds this limit, a continuation token is returned in + * this response header. When a continuation token is returned in the + * response, it must be specified in a subsequent invocation of the rename + * operation to continue renaming the directory. + * + * @param marker the marker value to set. + * @return the DirectoryRenameHeaders object itself. + */ + public DirectoryRenameHeaders setMarker(String marker) { + this.marker = marker; + return this; + } + + /** + * Get the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @param eTag the eTag value to set. + * @return the DirectoryRenameHeaders object itself. + */ + public DirectoryRenameHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @param lastModified the lastModified value to set. + * @return the DirectoryRenameHeaders object itself. + */ + public DirectoryRenameHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the DirectoryRenameHeaders object itself. + */ + public DirectoryRenameHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @return the requestId value. + */ + public String getRequestId() { + return this.requestId; + } + + /** + * Set the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @param requestId the requestId value to set. + * @return the DirectoryRenameHeaders object itself. + */ + public DirectoryRenameHeaders setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: The version of the REST protocol used to + * process the request. + * + * @return the version value. + */ + public String getVersion() { + return this.version; + } + + /** + * Set the version property: The version of the REST protocol used to + * process the request. + * + * @param version the version value to set. + * @return the DirectoryRenameHeaders object itself. + */ + public DirectoryRenameHeaders setVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the contentLength property: The size of the resource in bytes. + * + * @return the contentLength value. + */ + public Long getContentLength() { + return this.contentLength; + } + + /** + * Set the contentLength property: The size of the resource in bytes. + * + * @param contentLength the contentLength value to set. + * @return the DirectoryRenameHeaders object itself. + */ + public DirectoryRenameHeaders setContentLength(Long contentLength) { + this.contentLength = contentLength; + return this; + } + + /** + * Get the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime getDateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.getDateTime(); + } + + /** + * Set the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the DirectoryRenameHeaders object itself. + */ + public DirectoryRenameHeaders setDateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorySetAccessControlHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorySetAccessControlHeaders.java new file mode 100644 index 000000000000..0b1cf0b38cd4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorySetAccessControlHeaders.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for SetAccessControl operation. + */ +@JacksonXmlRootElement(localName = "Directory-SetAccessControl-Headers") +@Fluent +public final class DirectorySetAccessControlHeaders { + /* + * A UTC date/time value generated by the service that indicates the time + * at which the response was initiated. + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /* + * An HTTP entity tag associated with the file or directory. + */ + @JsonProperty(value = "ETag") + private String eTag; + + /* + * The data and time the file or directory was last modified. Write + * operations on the file or directory update the last modified time. + */ + @JsonProperty(value = "Last-Modified") + private DateTimeRfc1123 lastModified; + + /* + * A server-generated UUID recorded in the analytics logs for + * troubleshooting and correlation. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * The version of the REST protocol used to process the request. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + + /** + * Get the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime getDateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.getDateTime(); + } + + /** + * Set the dateProperty property: A UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the DirectorySetAccessControlHeaders object itself. + */ + public DirectorySetAccessControlHeaders setDateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } + + /** + * Get the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @return the eTag value. + */ + public String getETag() { + return this.eTag; + } + + /** + * Set the eTag property: An HTTP entity tag associated with the file or + * directory. + * + * @param eTag the eTag value to set. + * @return the DirectorySetAccessControlHeaders object itself. + */ + public DirectorySetAccessControlHeaders setETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @return the lastModified value. + */ + public OffsetDateTime getLastModified() { + if (this.lastModified == null) { + return null; + } + return this.lastModified.getDateTime(); + } + + /** + * Set the lastModified property: The data and time the file or directory + * was last modified. Write operations on the file or directory update the + * last modified time. + * + * @param lastModified the lastModified value to set. + * @return the DirectorySetAccessControlHeaders object itself. + */ + public DirectorySetAccessControlHeaders setLastModified(OffsetDateTime lastModified) { + if (lastModified == null) { + this.lastModified = null; + } else { + this.lastModified = new DateTimeRfc1123(lastModified); + } + return this; + } + + /** + * Get the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @return the requestId value. + */ + public String getRequestId() { + return this.requestId; + } + + /** + * Set the requestId property: A server-generated UUID recorded in the + * analytics logs for troubleshooting and correlation. + * + * @param requestId the requestId value to set. + * @return the DirectorySetAccessControlHeaders object itself. + */ + public DirectorySetAccessControlHeaders setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: The version of the REST protocol used to + * process the request. + * + * @return the version value. + */ + public String getVersion() { + return this.version; + } + + /** + * Set the version property: The version of the REST protocol used to + * process the request. + * + * @param version the version value to set. + * @return the DirectorySetAccessControlHeaders object itself. + */ + public DirectorySetAccessControlHeaders setVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the DirectorySetAccessControlHeaders object itself. + */ + public DirectorySetAccessControlHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysCreateResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysCreateResponse.java new file mode 100644 index 000000000000..884c526dda38 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysCreateResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the create operation. + */ +public final class DirectorysCreateResponse extends ResponseBase { + /** + * Creates an instance of DirectorysCreateResponse. + * + * @param request the request which resulted in this DirectorysCreateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public DirectorysCreateResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, DirectoryCreateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysDeleteResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysDeleteResponse.java new file mode 100644 index 000000000000..6e3c9d532875 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysDeleteResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the delete operation. + */ +public final class DirectorysDeleteResponse extends ResponseBase { + /** + * Creates an instance of DirectorysDeleteResponse. + * + * @param request the request which resulted in this DirectorysDeleteResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public DirectorysDeleteResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, DirectoryDeleteHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysGetAccessControlResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysGetAccessControlResponse.java new file mode 100644 index 000000000000..6104b8c9afa7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysGetAccessControlResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the getAccessControl operation. + */ +public final class DirectorysGetAccessControlResponse extends ResponseBase { + /** + * Creates an instance of DirectorysGetAccessControlResponse. + * + * @param request the request which resulted in this DirectorysGetAccessControlResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public DirectorysGetAccessControlResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, DirectoryGetAccessControlHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysRenameResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysRenameResponse.java new file mode 100644 index 000000000000..afea46a8180b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysRenameResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the rename operation. + */ +public final class DirectorysRenameResponse extends ResponseBase { + /** + * Creates an instance of DirectorysRenameResponse. + * + * @param request the request which resulted in this DirectorysRenameResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public DirectorysRenameResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, DirectoryRenameHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysSetAccessControlResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysSetAccessControlResponse.java new file mode 100644 index 000000000000..3395f9a2a10b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DirectorysSetAccessControlResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the setAccessControl operation. + */ +public final class DirectorysSetAccessControlResponse extends ResponseBase { + /** + * Creates an instance of DirectorysSetAccessControlResponse. + * + * @param request the request which resulted in this DirectorysSetAccessControlResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public DirectorysSetAccessControlResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, DirectorySetAccessControlHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/FilterBlobsItem.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/FilterBlobsItem.java new file mode 100644 index 000000000000..477c3efb3f87 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/FilterBlobsItem.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * The FilterBlobsItem model. + */ +@JacksonXmlRootElement(localName = "Blob") +@Fluent +public final class FilterBlobsItem { + /* + * The name property. + */ + @JsonProperty(value = "Name") + private String name; + + /* + * The containerName property. + */ + @JsonProperty(value = "ContainerName") + private String containerName; + + /* + * The tagValue property. + */ + @JsonProperty(value = "TagValue") + private String tagValue; + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name property. + * + * @param name the name value to set. + * @return the FilterBlobsItem object itself. + */ + public FilterBlobsItem name(String name) { + this.name = name; + return this; + } + + /** + * Get the containerName property: The containerName property. + * + * @return the containerName value. + */ + public String containerName() { + return this.containerName; + } + + /** + * Set the containerName property: The containerName property. + * + * @param containerName the containerName value to set. + * @return the FilterBlobsItem object itself. + */ + public FilterBlobsItem containerName(String containerName) { + this.containerName = containerName; + return this; + } + + /** + * Get the tagValue property: The tagValue property. + * + * @return the tagValue value. + */ + public String tagValue() { + return this.tagValue; + } + + /** + * Set the tagValue property: The tagValue property. + * + * @param tagValue the tagValue value to set. + * @return the FilterBlobsItem object itself. + */ + public FilterBlobsItem tagValue(String tagValue) { + this.tagValue = tagValue; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/FilterBlobsResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/FilterBlobsResponse.java new file mode 100644 index 000000000000..12484870f130 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/FilterBlobsResponse.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * An enumeration of blobs which matched the filter. + */ +@JacksonXmlRootElement(localName = "EnumerationResults") +@Fluent +public final class FilterBlobsResponse { + /* + * The serviceEndpoint property. + */ + @JacksonXmlProperty(localName = "ServiceEndpoint", isAttribute = true) + private String serviceEndpoint; + + /* + * The filter property. + */ + @JsonProperty(value = "Filter", required = true) + private String filter; + + /* + * The marker property. + */ + @JsonProperty(value = "Marker") + private String marker; + + /* + * The maxResults property. + */ + @JsonProperty(value = "MaxResults") + private Integer maxResults; + + /* + * The segment property. + */ + @JsonProperty(value = "Blobs", required = true) + private FilterBlobsSegment segment; + + /* + * The nextMarker property. + */ + @JsonProperty(value = "NextMarker", required = true) + private String nextMarker; + + /** + * Get the serviceEndpoint property: The serviceEndpoint property. + * + * @return the serviceEndpoint value. + */ + public String serviceEndpoint() { + return this.serviceEndpoint; + } + + /** + * Set the serviceEndpoint property: The serviceEndpoint property. + * + * @param serviceEndpoint the serviceEndpoint value to set. + * @return the FilterBlobsResponse object itself. + */ + public FilterBlobsResponse serviceEndpoint(String serviceEndpoint) { + this.serviceEndpoint = serviceEndpoint; + return this; + } + + /** + * Get the filter property: The filter property. + * + * @return the filter value. + */ + public String filter() { + return this.filter; + } + + /** + * Set the filter property: The filter property. + * + * @param filter the filter value to set. + * @return the FilterBlobsResponse object itself. + */ + public FilterBlobsResponse filter(String filter) { + this.filter = filter; + return this; + } + + /** + * Get the marker property: The marker property. + * + * @return the marker value. + */ + public String marker() { + return this.marker; + } + + /** + * Set the marker property: The marker property. + * + * @param marker the marker value to set. + * @return the FilterBlobsResponse object itself. + */ + public FilterBlobsResponse marker(String marker) { + this.marker = marker; + return this; + } + + /** + * Get the maxResults property: The maxResults property. + * + * @return the maxResults value. + */ + public Integer maxResults() { + return this.maxResults; + } + + /** + * Set the maxResults property: The maxResults property. + * + * @param maxResults the maxResults value to set. + * @return the FilterBlobsResponse object itself. + */ + public FilterBlobsResponse maxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + /** + * Get the segment property: The segment property. + * + * @return the segment value. + */ + public FilterBlobsSegment getSegment() { + return this.segment; + } + + /** + * Set the segment property: The segment property. + * + * @param segment the segment value to set. + * @return the FilterBlobsResponse object itself. + */ + public FilterBlobsResponse segment(FilterBlobsSegment segment) { + this.segment = segment; + return this; + } + + /** + * Get the nextMarker property: The nextMarker property. + * + * @return the nextMarker value. + */ + public String getNextMarker() { + return this.nextMarker; + } + + /** + * Set the nextMarker property: The nextMarker property. + * + * @param nextMarker the nextMarker value to set. + * @return the FilterBlobsResponse object itself. + */ + public FilterBlobsResponse nextMarker(String nextMarker) { + this.nextMarker = nextMarker; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/FilterBlobsSegment.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/FilterBlobsSegment.java new file mode 100644 index 000000000000..b48c49abf999 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/FilterBlobsSegment.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.util.ArrayList; +import java.util.List; + +/** + * The FilterBlobsSegment model. + */ +@JacksonXmlRootElement(localName = "Blobs") +@Fluent +public final class FilterBlobsSegment { + /* + * The blobItems property. + */ + @JsonProperty("Blob") + private List blobItems = new ArrayList<>(); + + /** + * Get the blobItems property: The blobItems property. + * + * @return the blobItems value. + */ + public List getBlobItems() { + return this.blobItems; + } + + /** + * Set the blobItems property: The blobItems property. + * + * @param blobItems the blobItems value to set. + * @return the FilterBlobsSegment object itself. + */ + public FilterBlobsSegment blobItems(List blobItems) { + this.blobItems = blobItems; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/GeoReplication.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/GeoReplication.java index d583130cc13a..837f79359dc6 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/GeoReplication.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/GeoReplication.java @@ -38,7 +38,7 @@ public final class GeoReplication { * * @return the status value. */ - public GeoReplicationStatusType status() { + public GeoReplicationStatusType getStatus() { return this.status; } @@ -49,7 +49,7 @@ public GeoReplicationStatusType status() { * @param status the status value to set. * @return the GeoReplication object itself. */ - public GeoReplication status(GeoReplicationStatusType status) { + public GeoReplication setStatus(GeoReplicationStatusType status) { this.status = status; return this; } @@ -62,11 +62,11 @@ public GeoReplication status(GeoReplicationStatusType status) { * * @return the lastSyncTime value. */ - public OffsetDateTime lastSyncTime() { + public OffsetDateTime getLastSyncTime() { if (this.lastSyncTime == null) { return null; } - return this.lastSyncTime.dateTime(); + return this.lastSyncTime.getDateTime(); } /** @@ -78,7 +78,7 @@ public OffsetDateTime lastSyncTime() { * @param lastSyncTime the lastSyncTime value to set. * @return the GeoReplication object itself. */ - public GeoReplication lastSyncTime(OffsetDateTime lastSyncTime) { + public GeoReplication setLastSyncTime(OffsetDateTime lastSyncTime) { if (lastSyncTime == null) { this.lastSyncTime = null; } else { diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/KeyInfo.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/KeyInfo.java index 6c742e4ed786..b52a13c6ada0 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/KeyInfo.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/KeyInfo.java @@ -32,7 +32,7 @@ public final class KeyInfo { * * @return the start value. */ - public String start() { + public String getStart() { return this.start; } @@ -43,7 +43,7 @@ public String start() { * @param start the start value to set. * @return the KeyInfo object itself. */ - public KeyInfo start(String start) { + public KeyInfo setStart(String start) { this.start = start; return this; } @@ -54,7 +54,7 @@ public KeyInfo start(String start) { * * @return the expiry value. */ - public String expiry() { + public String getExpiry() { return this.expiry; } @@ -65,7 +65,7 @@ public String expiry() { * @param expiry the expiry value to set. * @return the KeyInfo object itself. */ - public KeyInfo expiry(String expiry) { + public KeyInfo setExpiry(String expiry) { this.expiry = expiry; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/LeaseAccessConditions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/LeaseAccessConditions.java index 9a43064e549f..badaf0c0adb9 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/LeaseAccessConditions.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/LeaseAccessConditions.java @@ -27,7 +27,7 @@ public final class LeaseAccessConditions { * * @return the leaseId value. */ - public String leaseId() { + public String getLeaseId() { return this.leaseId; } @@ -38,7 +38,7 @@ public String leaseId() { * @param leaseId the leaseId value to set. * @return the LeaseAccessConditions object itself. */ - public LeaseAccessConditions leaseId(String leaseId) { + public LeaseAccessConditions setLeaseId(String leaseId) { this.leaseId = leaseId; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobsFlatSegmentResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobsFlatSegmentResponse.java index 593688ccc3e1..54f954691d70 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobsFlatSegmentResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobsFlatSegmentResponse.java @@ -68,7 +68,7 @@ public final class ListBlobsFlatSegmentResponse { * * @return the serviceEndpoint value. */ - public String serviceEndpoint() { + public String getServiceEndpoint() { return this.serviceEndpoint; } @@ -78,7 +78,7 @@ public String serviceEndpoint() { * @param serviceEndpoint the serviceEndpoint value to set. * @return the ListBlobsFlatSegmentResponse object itself. */ - public ListBlobsFlatSegmentResponse serviceEndpoint(String serviceEndpoint) { + public ListBlobsFlatSegmentResponse setServiceEndpoint(String serviceEndpoint) { this.serviceEndpoint = serviceEndpoint; return this; } @@ -88,7 +88,7 @@ public ListBlobsFlatSegmentResponse serviceEndpoint(String serviceEndpoint) { * * @return the containerName value. */ - public String containerName() { + public String getContainerName() { return this.containerName; } @@ -98,7 +98,7 @@ public String containerName() { * @param containerName the containerName value to set. * @return the ListBlobsFlatSegmentResponse object itself. */ - public ListBlobsFlatSegmentResponse containerName(String containerName) { + public ListBlobsFlatSegmentResponse setContainerName(String containerName) { this.containerName = containerName; return this; } @@ -108,7 +108,7 @@ public ListBlobsFlatSegmentResponse containerName(String containerName) { * * @return the prefix value. */ - public String prefix() { + public String getPrefix() { return this.prefix; } @@ -118,7 +118,7 @@ public String prefix() { * @param prefix the prefix value to set. * @return the ListBlobsFlatSegmentResponse object itself. */ - public ListBlobsFlatSegmentResponse prefix(String prefix) { + public ListBlobsFlatSegmentResponse setPrefix(String prefix) { this.prefix = prefix; return this; } @@ -128,7 +128,7 @@ public ListBlobsFlatSegmentResponse prefix(String prefix) { * * @return the marker value. */ - public String marker() { + public String getMarker() { return this.marker; } @@ -138,7 +138,7 @@ public String marker() { * @param marker the marker value to set. * @return the ListBlobsFlatSegmentResponse object itself. */ - public ListBlobsFlatSegmentResponse marker(String marker) { + public ListBlobsFlatSegmentResponse setMarker(String marker) { this.marker = marker; return this; } @@ -148,7 +148,7 @@ public ListBlobsFlatSegmentResponse marker(String marker) { * * @return the maxResults value. */ - public int maxResults() { + public int getMaxResults() { return this.maxResults; } @@ -158,7 +158,7 @@ public int maxResults() { * @param maxResults the maxResults value to set. * @return the ListBlobsFlatSegmentResponse object itself. */ - public ListBlobsFlatSegmentResponse maxResults(int maxResults) { + public ListBlobsFlatSegmentResponse setMaxResults(int maxResults) { this.maxResults = maxResults; return this; } @@ -168,7 +168,7 @@ public ListBlobsFlatSegmentResponse maxResults(int maxResults) { * * @return the delimiter value. */ - public String delimiter() { + public String getDelimiter() { return this.delimiter; } @@ -178,7 +178,7 @@ public String delimiter() { * @param delimiter the delimiter value to set. * @return the ListBlobsFlatSegmentResponse object itself. */ - public ListBlobsFlatSegmentResponse delimiter(String delimiter) { + public ListBlobsFlatSegmentResponse setDelimiter(String delimiter) { this.delimiter = delimiter; return this; } @@ -188,7 +188,7 @@ public ListBlobsFlatSegmentResponse delimiter(String delimiter) { * * @return the segment value. */ - public BlobFlatListSegment segment() { + public BlobFlatListSegment getSegment() { return this.segment; } @@ -198,7 +198,7 @@ public BlobFlatListSegment segment() { * @param segment the segment value to set. * @return the ListBlobsFlatSegmentResponse object itself. */ - public ListBlobsFlatSegmentResponse segment(BlobFlatListSegment segment) { + public ListBlobsFlatSegmentResponse setSegment(BlobFlatListSegment segment) { this.segment = segment; return this; } @@ -208,7 +208,7 @@ public ListBlobsFlatSegmentResponse segment(BlobFlatListSegment segment) { * * @return the nextMarker value. */ - public String nextMarker() { + public String getNextMarker() { return this.nextMarker; } @@ -218,7 +218,7 @@ public String nextMarker() { * @param nextMarker the nextMarker value to set. * @return the ListBlobsFlatSegmentResponse object itself. */ - public ListBlobsFlatSegmentResponse nextMarker(String nextMarker) { + public ListBlobsFlatSegmentResponse setNextMarker(String nextMarker) { this.nextMarker = nextMarker; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobsHierarchySegmentResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobsHierarchySegmentResponse.java index 51aee2856567..bd6e8711b9fe 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobsHierarchySegmentResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobsHierarchySegmentResponse.java @@ -68,7 +68,7 @@ public final class ListBlobsHierarchySegmentResponse { * * @return the serviceEndpoint value. */ - public String serviceEndpoint() { + public String getServiceEndpoint() { return this.serviceEndpoint; } @@ -78,7 +78,7 @@ public String serviceEndpoint() { * @param serviceEndpoint the serviceEndpoint value to set. * @return the ListBlobsHierarchySegmentResponse object itself. */ - public ListBlobsHierarchySegmentResponse serviceEndpoint(String serviceEndpoint) { + public ListBlobsHierarchySegmentResponse setServiceEndpoint(String serviceEndpoint) { this.serviceEndpoint = serviceEndpoint; return this; } @@ -88,7 +88,7 @@ public ListBlobsHierarchySegmentResponse serviceEndpoint(String serviceEndpoint) * * @return the containerName value. */ - public String containerName() { + public String getContainerName() { return this.containerName; } @@ -98,7 +98,7 @@ public String containerName() { * @param containerName the containerName value to set. * @return the ListBlobsHierarchySegmentResponse object itself. */ - public ListBlobsHierarchySegmentResponse containerName(String containerName) { + public ListBlobsHierarchySegmentResponse setContainerName(String containerName) { this.containerName = containerName; return this; } @@ -108,7 +108,7 @@ public ListBlobsHierarchySegmentResponse containerName(String containerName) { * * @return the prefix value. */ - public String prefix() { + public String getPrefix() { return this.prefix; } @@ -118,7 +118,7 @@ public String prefix() { * @param prefix the prefix value to set. * @return the ListBlobsHierarchySegmentResponse object itself. */ - public ListBlobsHierarchySegmentResponse prefix(String prefix) { + public ListBlobsHierarchySegmentResponse setPrefix(String prefix) { this.prefix = prefix; return this; } @@ -128,7 +128,7 @@ public ListBlobsHierarchySegmentResponse prefix(String prefix) { * * @return the marker value. */ - public String marker() { + public String getMarker() { return this.marker; } @@ -138,7 +138,7 @@ public String marker() { * @param marker the marker value to set. * @return the ListBlobsHierarchySegmentResponse object itself. */ - public ListBlobsHierarchySegmentResponse marker(String marker) { + public ListBlobsHierarchySegmentResponse setMarker(String marker) { this.marker = marker; return this; } @@ -148,7 +148,7 @@ public ListBlobsHierarchySegmentResponse marker(String marker) { * * @return the maxResults value. */ - public int maxResults() { + public int getMaxResults() { return this.maxResults; } @@ -158,7 +158,7 @@ public int maxResults() { * @param maxResults the maxResults value to set. * @return the ListBlobsHierarchySegmentResponse object itself. */ - public ListBlobsHierarchySegmentResponse maxResults(int maxResults) { + public ListBlobsHierarchySegmentResponse setMaxResults(int maxResults) { this.maxResults = maxResults; return this; } @@ -168,7 +168,7 @@ public ListBlobsHierarchySegmentResponse maxResults(int maxResults) { * * @return the delimiter value. */ - public String delimiter() { + public String getDelimiter() { return this.delimiter; } @@ -178,7 +178,7 @@ public String delimiter() { * @param delimiter the delimiter value to set. * @return the ListBlobsHierarchySegmentResponse object itself. */ - public ListBlobsHierarchySegmentResponse delimiter(String delimiter) { + public ListBlobsHierarchySegmentResponse setDelimiter(String delimiter) { this.delimiter = delimiter; return this; } @@ -188,7 +188,7 @@ public ListBlobsHierarchySegmentResponse delimiter(String delimiter) { * * @return the segment value. */ - public BlobHierarchyListSegment segment() { + public BlobHierarchyListSegment getSegment() { return this.segment; } @@ -198,7 +198,7 @@ public BlobHierarchyListSegment segment() { * @param segment the segment value to set. * @return the ListBlobsHierarchySegmentResponse object itself. */ - public ListBlobsHierarchySegmentResponse segment(BlobHierarchyListSegment segment) { + public ListBlobsHierarchySegmentResponse setSegment(BlobHierarchyListSegment segment) { this.segment = segment; return this; } @@ -208,7 +208,7 @@ public ListBlobsHierarchySegmentResponse segment(BlobHierarchyListSegment segmen * * @return the nextMarker value. */ - public String nextMarker() { + public String getNextMarker() { return this.nextMarker; } @@ -218,7 +218,7 @@ public String nextMarker() { * @param nextMarker the nextMarker value to set. * @return the ListBlobsHierarchySegmentResponse object itself. */ - public ListBlobsHierarchySegmentResponse nextMarker(String nextMarker) { + public ListBlobsHierarchySegmentResponse setNextMarker(String nextMarker) { this.nextMarker = nextMarker; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobsOptions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobsOptions.java index eb44c946bc01..56b14cd7fda5 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobsOptions.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobsOptions.java @@ -3,6 +3,7 @@ package com.azure.storage.blob.models; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.ContainerClient; /** @@ -10,6 +11,7 @@ * object. See the constructor for details on each of the options. */ public final class ListBlobsOptions { + private final ClientLogger logger = new ClientLogger(ListBlobsOptions.class); private BlobListDetails details; @@ -24,7 +26,7 @@ public ListBlobsOptions() { /** * @return the details for listing specific blobs */ - public BlobListDetails details() { + public BlobListDetails getDetails() { return details; } @@ -32,29 +34,29 @@ public BlobListDetails details() { * @param details The details for listing specific blobs * @return the updated ListBlobsOptions object */ - public ListBlobsOptions details(BlobListDetails details) { + public ListBlobsOptions setDetails(BlobListDetails details) { this.details = details; return this; } /** - * Filters the results to return only blobs whose names begin with the specified prefix. May be null to return - * all blobs. + * Filters the results to return only blobs whose names begin with the specified prefix. May be null to return all + * blobs. * * @return the prefix that a blob must match to be returned in the listing */ - public String prefix() { + public String getPrefix() { return prefix; } /** - * Filters the results to return only blobs whose names begin with the specified prefix. May be null to return - * all blobs. + * Filters the results to return only blobs whose names begin with the specified prefix. May be null to return all + * blobs. * * @param prefix A prefix that a blob must match to be returned * @return the updated ListBlobsOptions object */ - public ListBlobsOptions prefix(String prefix) { + public ListBlobsOptions setPrefix(String prefix) { this.prefix = prefix; return this; } @@ -65,7 +67,7 @@ public ListBlobsOptions prefix(String prefix) { * * @return the number of blobs that will be returned in a single response */ - public Integer maxResults() { + public Integer getMaxResults() { return maxResults; } @@ -75,10 +77,11 @@ public Integer maxResults() { * * @param maxResults The number of blobs to returned in a single response * @return the updated ListBlobsOptions object + * @throws IllegalArgumentException If {@code maxResults} is less than or equal to {@code 0}. */ - public ListBlobsOptions maxResults(Integer maxResults) { + public ListBlobsOptions setMaxResults(Integer maxResults) { if (maxResults != null && maxResults <= 0) { - throw new IllegalArgumentException("MaxResults must be greater than 0."); + throw logger.logExceptionAsError(new IllegalArgumentException("MaxResults must be greater than 0.")); } this.maxResults = maxResults; return this; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListContainersOptions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListContainersOptions.java index ed6c27b57d90..a50b02a38423 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListContainersOptions.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListContainersOptions.java @@ -3,14 +3,16 @@ package com.azure.storage.blob.models; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.BlobServiceClient; /** * Defines options available to configure the behavior of a call to listContainersSegment on a {@link BlobServiceClient} - * object. See the constructor for details on each of the options. Null may be passed in place of an object of this - * type if no options are desirable. + * object. See the constructor for details on each of the options. Null may be passed in place of an object of this type + * if no options are desirable. */ public final class ListContainersOptions { + private final ClientLogger logger = new ClientLogger(ListContainersOptions.class); private ContainerListDetails details; @@ -25,7 +27,7 @@ public ListContainersOptions() { /** * @return the details for listing specific containers */ - public ContainerListDetails details() { + public ContainerListDetails getDetails() { return details; } @@ -33,7 +35,7 @@ public ContainerListDetails details() { * @param details The details for listing specific containers * @return the updated ListContainersOptions object */ - public ListContainersOptions details(ContainerListDetails details) { + public ListContainersOptions setDetails(ContainerListDetails details) { this.details = details; return this; } @@ -43,7 +45,7 @@ public ListContainersOptions details(ContainerListDetails details) { * * @return the prefix a container must start with to be returned */ - public String prefix() { + public String getPrefix() { return prefix; } @@ -53,7 +55,7 @@ public String prefix() { * @param prefix The prefix that a container must match to be returned * @return the updated ListContainersOptions object */ - public ListContainersOptions prefix(String prefix) { + public ListContainersOptions setPrefix(String prefix) { this.prefix = prefix; return this; } @@ -64,7 +66,7 @@ public ListContainersOptions prefix(String prefix) { * * @return the number of containers to be returned in a single response */ - public Integer maxResults() { + public Integer getMaxResults() { return maxResults; } @@ -74,10 +76,11 @@ public Integer maxResults() { * * @param maxResults The number of containers to return in a single response * @return the updated ListContainersOptions object + * @throws IllegalArgumentException If {@code maxResults} is less than or equal to {@code 0}. */ - public ListContainersOptions maxResults(Integer maxResults) { + public ListContainersOptions setMaxResults(Integer maxResults) { if (maxResults != null && maxResults <= 0) { - throw new IllegalArgumentException("MaxResults must be greater than 0."); + throw logger.logExceptionAsError(new IllegalArgumentException("MaxResults must be greater than 0.")); } this.maxResults = maxResults; return this; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListContainersSegmentResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListContainersSegmentResponse.java index 97f342484a8f..a946518293a6 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListContainersSegmentResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListContainersSegmentResponse.java @@ -69,7 +69,7 @@ private ContainersWrapper(@JacksonXmlProperty(localName = "Container") List containerItems() { + public List getContainerItems() { if (this.containerItems == null) { this.containerItems = new ContainersWrapper(new ArrayList()); } @@ -162,7 +162,7 @@ public List containerItems() { * @param containerItems the containerItems value to set. * @return the ListContainersSegmentResponse object itself. */ - public ListContainersSegmentResponse containerItems(List containerItems) { + public ListContainersSegmentResponse setContainerItems(List containerItems) { this.containerItems = new ContainersWrapper(containerItems); return this; } @@ -172,7 +172,7 @@ public ListContainersSegmentResponse containerItems(List containe * * @return the nextMarker value. */ - public String nextMarker() { + public String getNextMarker() { return this.nextMarker; } @@ -182,7 +182,7 @@ public String nextMarker() { * @param nextMarker the nextMarker value to set. * @return the ListContainersSegmentResponse object itself. */ - public ListContainersSegmentResponse nextMarker(String nextMarker) { + public ListContainersSegmentResponse setNextMarker(String nextMarker) { this.nextMarker = nextMarker; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Logging.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Logging.java index 9aa3f4cce40b..6365042a9846 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Logging.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Logging.java @@ -49,7 +49,7 @@ public final class Logging { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -59,7 +59,7 @@ public String version() { * @param version the version value to set. * @return the Logging object itself. */ - public Logging version(String version) { + public Logging setVersion(String version) { this.version = version; return this; } @@ -70,7 +70,7 @@ public Logging version(String version) { * * @return the delete value. */ - public boolean delete() { + public boolean isDelete() { return this.delete; } @@ -81,7 +81,7 @@ public boolean delete() { * @param delete the delete value to set. * @return the Logging object itself. */ - public Logging delete(boolean delete) { + public Logging setDelete(boolean delete) { this.delete = delete; return this; } @@ -92,7 +92,7 @@ public Logging delete(boolean delete) { * * @return the read value. */ - public boolean read() { + public boolean isRead() { return this.read; } @@ -103,7 +103,7 @@ public boolean read() { * @param read the read value to set. * @return the Logging object itself. */ - public Logging read(boolean read) { + public Logging setRead(boolean read) { this.read = read; return this; } @@ -114,7 +114,7 @@ public Logging read(boolean read) { * * @return the write value. */ - public boolean write() { + public boolean isWrite() { return this.write; } @@ -125,7 +125,7 @@ public boolean write() { * @param write the write value to set. * @return the Logging object itself. */ - public Logging write(boolean write) { + public Logging setWrite(boolean write) { this.write = write; return this; } @@ -135,7 +135,7 @@ public Logging write(boolean write) { * * @return the retentionPolicy value. */ - public RetentionPolicy retentionPolicy() { + public RetentionPolicy getRetentionPolicy() { return this.retentionPolicy; } @@ -145,7 +145,7 @@ public RetentionPolicy retentionPolicy() { * @param retentionPolicy the retentionPolicy value to set. * @return the Logging object itself. */ - public Logging retentionPolicy(RetentionPolicy retentionPolicy) { + public Logging setRetentionPolicy(RetentionPolicy retentionPolicy) { this.retentionPolicy = retentionPolicy; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Metrics.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Metrics.java index ee8ad19b2856..0066f0100f22 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Metrics.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Metrics.java @@ -45,7 +45,7 @@ public final class Metrics { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -55,7 +55,7 @@ public String version() { * @param version the version value to set. * @return the Metrics object itself. */ - public Metrics version(String version) { + public Metrics setVersion(String version) { this.version = version; return this; } @@ -66,7 +66,7 @@ public Metrics version(String version) { * * @return the enabled value. */ - public boolean enabled() { + public boolean isEnabled() { return this.enabled; } @@ -77,7 +77,7 @@ public boolean enabled() { * @param enabled the enabled value to set. * @return the Metrics object itself. */ - public Metrics enabled(boolean enabled) { + public Metrics setEnabled(boolean enabled) { this.enabled = enabled; return this; } @@ -88,7 +88,7 @@ public Metrics enabled(boolean enabled) { * * @return the includeAPIs value. */ - public Boolean includeAPIs() { + public Boolean isIncludeAPIs() { return this.includeAPIs; } @@ -99,7 +99,7 @@ public Boolean includeAPIs() { * @param includeAPIs the includeAPIs value to set. * @return the Metrics object itself. */ - public Metrics includeAPIs(Boolean includeAPIs) { + public Metrics setIncludeAPIs(Boolean includeAPIs) { this.includeAPIs = includeAPIs; return this; } @@ -109,7 +109,7 @@ public Metrics includeAPIs(Boolean includeAPIs) { * * @return the retentionPolicy value. */ - public RetentionPolicy retentionPolicy() { + public RetentionPolicy getRetentionPolicy() { return this.retentionPolicy; } @@ -119,7 +119,7 @@ public RetentionPolicy retentionPolicy() { * @param retentionPolicy the retentionPolicy value to set. * @return the Metrics object itself. */ - public Metrics retentionPolicy(RetentionPolicy retentionPolicy) { + public Metrics setRetentionPolicy(RetentionPolicy retentionPolicy) { this.retentionPolicy = retentionPolicy; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ModifiedAccessConditions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ModifiedAccessConditions.java index 01e9de89ae16..236ea8880df2 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ModifiedAccessConditions.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ModifiedAccessConditions.java @@ -48,11 +48,11 @@ public final class ModifiedAccessConditions { * * @return the ifModifiedSince value. */ - public OffsetDateTime ifModifiedSince() { + public OffsetDateTime getIfModifiedSince() { if (this.ifModifiedSince == null) { return null; } - return this.ifModifiedSince.dateTime(); + return this.ifModifiedSince.getDateTime(); } /** @@ -62,7 +62,7 @@ public OffsetDateTime ifModifiedSince() { * @param ifModifiedSince the ifModifiedSince value to set. * @return the ModifiedAccessConditions object itself. */ - public ModifiedAccessConditions ifModifiedSince(OffsetDateTime ifModifiedSince) { + public ModifiedAccessConditions setIfModifiedSince(OffsetDateTime ifModifiedSince) { if (ifModifiedSince == null) { this.ifModifiedSince = null; } else { @@ -78,11 +78,11 @@ public ModifiedAccessConditions ifModifiedSince(OffsetDateTime ifModifiedSince) * * @return the ifUnmodifiedSince value. */ - public OffsetDateTime ifUnmodifiedSince() { + public OffsetDateTime getIfUnmodifiedSince() { if (this.ifUnmodifiedSince == null) { return null; } - return this.ifUnmodifiedSince.dateTime(); + return this.ifUnmodifiedSince.getDateTime(); } /** @@ -93,7 +93,7 @@ public OffsetDateTime ifUnmodifiedSince() { * @param ifUnmodifiedSince the ifUnmodifiedSince value to set. * @return the ModifiedAccessConditions object itself. */ - public ModifiedAccessConditions ifUnmodifiedSince(OffsetDateTime ifUnmodifiedSince) { + public ModifiedAccessConditions setIfUnmodifiedSince(OffsetDateTime ifUnmodifiedSince) { if (ifUnmodifiedSince == null) { this.ifUnmodifiedSince = null; } else { @@ -108,7 +108,7 @@ public ModifiedAccessConditions ifUnmodifiedSince(OffsetDateTime ifUnmodifiedSin * * @return the ifMatch value. */ - public String ifMatch() { + public String getIfMatch() { return this.ifMatch; } @@ -119,7 +119,7 @@ public String ifMatch() { * @param ifMatch the ifMatch value to set. * @return the ModifiedAccessConditions object itself. */ - public ModifiedAccessConditions ifMatch(String ifMatch) { + public ModifiedAccessConditions setIfMatch(String ifMatch) { this.ifMatch = ifMatch; return this; } @@ -130,7 +130,7 @@ public ModifiedAccessConditions ifMatch(String ifMatch) { * * @return the ifNoneMatch value. */ - public String ifNoneMatch() { + public String getIfNoneMatch() { return this.ifNoneMatch; } @@ -141,7 +141,7 @@ public String ifNoneMatch() { * @param ifNoneMatch the ifNoneMatch value to set. * @return the ModifiedAccessConditions object itself. */ - public ModifiedAccessConditions ifNoneMatch(String ifNoneMatch) { + public ModifiedAccessConditions setIfNoneMatch(String ifNoneMatch) { this.ifNoneMatch = ifNoneMatch; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobAccessConditions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobAccessConditions.java index 96250a2d60cc..8d52111311b7 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobAccessConditions.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobAccessConditions.java @@ -32,7 +32,7 @@ public PageBlobAccessConditions() { * * @return the sequence number access conditions */ - public SequenceNumberAccessConditions sequenceNumberAccessConditions() { + public SequenceNumberAccessConditions getSequenceNumberAccessConditions() { return sequenceNumberAccessConditions; } @@ -42,7 +42,7 @@ public SequenceNumberAccessConditions sequenceNumberAccessConditions() { * @param sequenceNumberAccessConditions the sequence number access conditions to set * @return the updated PageBlobAccessConditions object */ - public PageBlobAccessConditions sequenceNumberAccessConditions( + public PageBlobAccessConditions setSequenceNumberAccessConditions( SequenceNumberAccessConditions sequenceNumberAccessConditions) { this.sequenceNumberAccessConditions = sequenceNumberAccessConditions; return this; @@ -55,7 +55,7 @@ public PageBlobAccessConditions sequenceNumberAccessConditions( * * @return the modified access conditions */ - public ModifiedAccessConditions modifiedAccessConditions() { + public ModifiedAccessConditions getModifiedAccessConditions() { return modifiedAccessConditions; } @@ -67,7 +67,7 @@ public ModifiedAccessConditions modifiedAccessConditions() { * @param modifiedAccessConditions the modified access conditions to set * @return the updated PageBlobAccessConditions object */ - public PageBlobAccessConditions modifiedAccessConditions(ModifiedAccessConditions modifiedAccessConditions) { + public PageBlobAccessConditions setModifiedAccessConditions(ModifiedAccessConditions modifiedAccessConditions) { this.modifiedAccessConditions = modifiedAccessConditions; return this; } @@ -78,7 +78,7 @@ public PageBlobAccessConditions modifiedAccessConditions(ModifiedAccessCondition * * @return the lease access conditions */ - public LeaseAccessConditions leaseAccessConditions() { + public LeaseAccessConditions getLeaseAccessConditions() { return leaseAccessConditions; } @@ -89,7 +89,7 @@ public LeaseAccessConditions leaseAccessConditions() { * @param leaseAccessConditions the lease access conditions to set * @return the updated PageBlobAccessConditions object */ - public PageBlobAccessConditions leaseAccessConditions(LeaseAccessConditions leaseAccessConditions) { + public PageBlobAccessConditions setLeaseAccessConditions(LeaseAccessConditions leaseAccessConditions) { this.leaseAccessConditions = leaseAccessConditions; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobClearPagesHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobClearPagesHeaders.java index 543c829bf271..fa57a345d259 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobClearPagesHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobClearPagesHeaders.java @@ -41,12 +41,27 @@ public final class PageBlobClearPagesHeaders { @JsonProperty(value = "Content-MD5") private byte[] contentMD5; + /* + * This header is returned so that the client can check for message content + * integrity. The value of this header is computed by the Blob service; it + * is not necessarily the same value specified in the request headers. + */ + @JsonProperty(value = "x-ms-content-crc64") + private byte[] xMsContentCrc64; + /* * The current sequence number for the page blob. */ @JsonProperty(value = "x-ms-blob-sequence-number") private Long blobSequenceNumber; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -82,7 +97,7 @@ public final class PageBlobClearPagesHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -94,7 +109,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the PageBlobClearPagesHeaders object itself. */ - public PageBlobClearPagesHeaders eTag(String eTag) { + public PageBlobClearPagesHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -107,11 +122,11 @@ public PageBlobClearPagesHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -123,7 +138,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the PageBlobClearPagesHeaders object itself. */ - public PageBlobClearPagesHeaders lastModified(OffsetDateTime lastModified) { + public PageBlobClearPagesHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -139,7 +154,7 @@ public PageBlobClearPagesHeaders lastModified(OffsetDateTime lastModified) { * * @return the contentMD5 value. */ - public byte[] contentMD5() { + public byte[] getContentMD5() { return ImplUtils.clone(this.contentMD5); } @@ -151,18 +166,44 @@ public byte[] contentMD5() { * @param contentMD5 the contentMD5 value to set. * @return the PageBlobClearPagesHeaders object itself. */ - public PageBlobClearPagesHeaders contentMD5(byte[] contentMD5) { + public PageBlobClearPagesHeaders setContentMD5(byte[] contentMD5) { this.contentMD5 = ImplUtils.clone(contentMD5); return this; } + /** + * Get the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @return the xMsContentCrc64 value. + */ + public byte[] getXMsContentCrc64() { + return ImplUtils.clone(this.xMsContentCrc64); + } + + /** + * Set the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the PageBlobClearPagesHeaders object itself. + */ + public PageBlobClearPagesHeaders setXMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = ImplUtils.clone(xMsContentCrc64); + return this; + } + /** * Get the blobSequenceNumber property: The current sequence number for the * page blob. * * @return the blobSequenceNumber value. */ - public Long blobSequenceNumber() { + public Long getBlobSequenceNumber() { return this.blobSequenceNumber; } @@ -173,18 +214,42 @@ public Long blobSequenceNumber() { * @param blobSequenceNumber the blobSequenceNumber value to set. * @return the PageBlobClearPagesHeaders object itself. */ - public PageBlobClearPagesHeaders blobSequenceNumber(Long blobSequenceNumber) { + public PageBlobClearPagesHeaders setBlobSequenceNumber(Long blobSequenceNumber) { this.blobSequenceNumber = blobSequenceNumber; return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the PageBlobClearPagesHeaders object itself. + */ + public PageBlobClearPagesHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -195,7 +260,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the PageBlobClearPagesHeaders object itself. */ - public PageBlobClearPagesHeaders requestId(String requestId) { + public PageBlobClearPagesHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -207,7 +272,7 @@ public PageBlobClearPagesHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -219,7 +284,7 @@ public String version() { * @param version the version value to set. * @return the PageBlobClearPagesHeaders object itself. */ - public PageBlobClearPagesHeaders version(String version) { + public PageBlobClearPagesHeaders setVersion(String version) { this.version = version; return this; } @@ -230,11 +295,11 @@ public PageBlobClearPagesHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -244,7 +309,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the PageBlobClearPagesHeaders object itself. */ - public PageBlobClearPagesHeaders dateProperty(OffsetDateTime dateProperty) { + public PageBlobClearPagesHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -258,7 +323,7 @@ public PageBlobClearPagesHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -268,7 +333,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the PageBlobClearPagesHeaders object itself. */ - public PageBlobClearPagesHeaders errorCode(String errorCode) { + public PageBlobClearPagesHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobCopyIncrementalHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobCopyIncrementalHeaders.java index 7e9aa95c1ff3..be3f3291d08f 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobCopyIncrementalHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobCopyIncrementalHeaders.java @@ -32,6 +32,13 @@ public final class PageBlobCopyIncrementalHeaders { @JsonProperty(value = "Last-Modified") private DateTimeRfc1123 lastModified; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -82,7 +89,7 @@ public final class PageBlobCopyIncrementalHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -94,7 +101,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the PageBlobCopyIncrementalHeaders object itself. */ - public PageBlobCopyIncrementalHeaders eTag(String eTag) { + public PageBlobCopyIncrementalHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -107,11 +114,11 @@ public PageBlobCopyIncrementalHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -123,7 +130,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the PageBlobCopyIncrementalHeaders object itself. */ - public PageBlobCopyIncrementalHeaders lastModified(OffsetDateTime lastModified) { + public PageBlobCopyIncrementalHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -132,13 +139,37 @@ public PageBlobCopyIncrementalHeaders lastModified(OffsetDateTime lastModified) return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the PageBlobCopyIncrementalHeaders object itself. + */ + public PageBlobCopyIncrementalHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -149,7 +180,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the PageBlobCopyIncrementalHeaders object itself. */ - public PageBlobCopyIncrementalHeaders requestId(String requestId) { + public PageBlobCopyIncrementalHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -161,7 +192,7 @@ public PageBlobCopyIncrementalHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -173,7 +204,7 @@ public String version() { * @param version the version value to set. * @return the PageBlobCopyIncrementalHeaders object itself. */ - public PageBlobCopyIncrementalHeaders version(String version) { + public PageBlobCopyIncrementalHeaders setVersion(String version) { this.version = version; return this; } @@ -184,11 +215,11 @@ public PageBlobCopyIncrementalHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -198,7 +229,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the PageBlobCopyIncrementalHeaders object itself. */ - public PageBlobCopyIncrementalHeaders dateProperty(OffsetDateTime dateProperty) { + public PageBlobCopyIncrementalHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -214,7 +245,7 @@ public PageBlobCopyIncrementalHeaders dateProperty(OffsetDateTime dateProperty) * * @return the copyId value. */ - public String copyId() { + public String getCopyId() { return this.copyId; } @@ -226,7 +257,7 @@ public String copyId() { * @param copyId the copyId value to set. * @return the PageBlobCopyIncrementalHeaders object itself. */ - public PageBlobCopyIncrementalHeaders copyId(String copyId) { + public PageBlobCopyIncrementalHeaders setCopyId(String copyId) { this.copyId = copyId; return this; } @@ -238,7 +269,7 @@ public PageBlobCopyIncrementalHeaders copyId(String copyId) { * * @return the copyStatus value. */ - public CopyStatusType copyStatus() { + public CopyStatusType getCopyStatus() { return this.copyStatus; } @@ -250,7 +281,7 @@ public CopyStatusType copyStatus() { * @param copyStatus the copyStatus value to set. * @return the PageBlobCopyIncrementalHeaders object itself. */ - public PageBlobCopyIncrementalHeaders copyStatus(CopyStatusType copyStatus) { + public PageBlobCopyIncrementalHeaders setCopyStatus(CopyStatusType copyStatus) { this.copyStatus = copyStatus; return this; } @@ -260,7 +291,7 @@ public PageBlobCopyIncrementalHeaders copyStatus(CopyStatusType copyStatus) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -270,7 +301,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the PageBlobCopyIncrementalHeaders object itself. */ - public PageBlobCopyIncrementalHeaders errorCode(String errorCode) { + public PageBlobCopyIncrementalHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobCreateHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobCreateHeaders.java index 6c4192fe4806..3297df1b5e8e 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobCreateHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobCreateHeaders.java @@ -41,6 +41,13 @@ public final class PageBlobCreateHeaders { @JsonProperty(value = "Content-MD5") private byte[] contentMD5; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -56,14 +63,6 @@ public final class PageBlobCreateHeaders { @JsonProperty(value = "x-ms-version") private String version; - /* - * UTC date/time value generated by the service that identifies a version - * of the blob. This header is returned for requests made against version - * 2018-11-09 and above. - */ - @JsonProperty(value = "x-ms-version-id") - private String versionId; - /* * UTC date/time value generated by the service that indicates the time at * which the response was initiated @@ -100,7 +99,7 @@ public final class PageBlobCreateHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -112,7 +111,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the PageBlobCreateHeaders object itself. */ - public PageBlobCreateHeaders eTag(String eTag) { + public PageBlobCreateHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -125,11 +124,11 @@ public PageBlobCreateHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -141,7 +140,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the PageBlobCreateHeaders object itself. */ - public PageBlobCreateHeaders lastModified(OffsetDateTime lastModified) { + public PageBlobCreateHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -157,7 +156,7 @@ public PageBlobCreateHeaders lastModified(OffsetDateTime lastModified) { * * @return the contentMD5 value. */ - public byte[] contentMD5() { + public byte[] getContentMD5() { return ImplUtils.clone(this.contentMD5); } @@ -169,18 +168,42 @@ public byte[] contentMD5() { * @param contentMD5 the contentMD5 value to set. * @return the PageBlobCreateHeaders object itself. */ - public PageBlobCreateHeaders contentMD5(byte[] contentMD5) { + public PageBlobCreateHeaders setContentMD5(byte[] contentMD5) { this.contentMD5 = ImplUtils.clone(contentMD5); return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the PageBlobCreateHeaders object itself. + */ + public PageBlobCreateHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -191,7 +214,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the PageBlobCreateHeaders object itself. */ - public PageBlobCreateHeaders requestId(String requestId) { + public PageBlobCreateHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -203,7 +226,7 @@ public PageBlobCreateHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -215,46 +238,22 @@ public String version() { * @param version the version value to set. * @return the PageBlobCreateHeaders object itself. */ - public PageBlobCreateHeaders version(String version) { + public PageBlobCreateHeaders setVersion(String version) { this.version = version; return this; } - /** - * Get the versionId property: UTC date/time value generated by the service - * that identifies a version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @return the versionId value. - */ - public String versionId() { - return this.versionId; - } - - /** - * Set the versionId property: UTC date/time value generated by the service - * that identifies a version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @param versionId the versionId value to set. - * @return the PageBlobCreateHeaders object itself. - */ - public PageBlobCreateHeaders versionId(String versionId) { - this.versionId = versionId; - return this; - } - /** * Get the dateProperty property: UTC date/time value generated by the * service that indicates the time at which the response was initiated. * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -264,7 +263,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the PageBlobCreateHeaders object itself. */ - public PageBlobCreateHeaders dateProperty(OffsetDateTime dateProperty) { + public PageBlobCreateHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -292,7 +291,7 @@ public Boolean isServerEncrypted() { * @param isServerEncrypted the isServerEncrypted value to set. * @return the PageBlobCreateHeaders object itself. */ - public PageBlobCreateHeaders isServerEncrypted(Boolean isServerEncrypted) { + public PageBlobCreateHeaders setIsServerEncrypted(Boolean isServerEncrypted) { this.isServerEncrypted = isServerEncrypted; return this; } @@ -304,7 +303,7 @@ public PageBlobCreateHeaders isServerEncrypted(Boolean isServerEncrypted) { * * @return the encryptionKeySha256 value. */ - public String encryptionKeySha256() { + public String getEncryptionKeySha256() { return this.encryptionKeySha256; } @@ -316,7 +315,7 @@ public String encryptionKeySha256() { * @param encryptionKeySha256 the encryptionKeySha256 value to set. * @return the PageBlobCreateHeaders object itself. */ - public PageBlobCreateHeaders encryptionKeySha256(String encryptionKeySha256) { + public PageBlobCreateHeaders setEncryptionKeySha256(String encryptionKeySha256) { this.encryptionKeySha256 = encryptionKeySha256; return this; } @@ -326,7 +325,7 @@ public PageBlobCreateHeaders encryptionKeySha256(String encryptionKeySha256) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -336,7 +335,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the PageBlobCreateHeaders object itself. */ - public PageBlobCreateHeaders errorCode(String errorCode) { + public PageBlobCreateHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesDiffHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesDiffHeaders.java index c1d14635bf44..004c8bd98556 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesDiffHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesDiffHeaders.java @@ -38,6 +38,13 @@ public final class PageBlobGetPageRangesDiffHeaders { @JsonProperty(value = "x-ms-blob-content-length") private Long blobContentLength; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -74,11 +81,11 @@ public final class PageBlobGetPageRangesDiffHeaders { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -90,7 +97,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the PageBlobGetPageRangesDiffHeaders object itself. */ - public PageBlobGetPageRangesDiffHeaders lastModified(OffsetDateTime lastModified) { + public PageBlobGetPageRangesDiffHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -106,7 +113,7 @@ public PageBlobGetPageRangesDiffHeaders lastModified(OffsetDateTime lastModified * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -118,7 +125,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the PageBlobGetPageRangesDiffHeaders object itself. */ - public PageBlobGetPageRangesDiffHeaders eTag(String eTag) { + public PageBlobGetPageRangesDiffHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -128,7 +135,7 @@ public PageBlobGetPageRangesDiffHeaders eTag(String eTag) { * * @return the blobContentLength value. */ - public Long blobContentLength() { + public Long getBlobContentLength() { return this.blobContentLength; } @@ -138,18 +145,42 @@ public Long blobContentLength() { * @param blobContentLength the blobContentLength value to set. * @return the PageBlobGetPageRangesDiffHeaders object itself. */ - public PageBlobGetPageRangesDiffHeaders blobContentLength(Long blobContentLength) { + public PageBlobGetPageRangesDiffHeaders setBlobContentLength(Long blobContentLength) { this.blobContentLength = blobContentLength; return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the PageBlobGetPageRangesDiffHeaders object itself. + */ + public PageBlobGetPageRangesDiffHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -160,7 +191,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the PageBlobGetPageRangesDiffHeaders object itself. */ - public PageBlobGetPageRangesDiffHeaders requestId(String requestId) { + public PageBlobGetPageRangesDiffHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -172,7 +203,7 @@ public PageBlobGetPageRangesDiffHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -184,7 +215,7 @@ public String version() { * @param version the version value to set. * @return the PageBlobGetPageRangesDiffHeaders object itself. */ - public PageBlobGetPageRangesDiffHeaders version(String version) { + public PageBlobGetPageRangesDiffHeaders setVersion(String version) { this.version = version; return this; } @@ -195,11 +226,11 @@ public PageBlobGetPageRangesDiffHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -209,7 +240,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the PageBlobGetPageRangesDiffHeaders object itself. */ - public PageBlobGetPageRangesDiffHeaders dateProperty(OffsetDateTime dateProperty) { + public PageBlobGetPageRangesDiffHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -223,7 +254,7 @@ public PageBlobGetPageRangesDiffHeaders dateProperty(OffsetDateTime dateProperty * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -233,7 +264,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the PageBlobGetPageRangesDiffHeaders object itself. */ - public PageBlobGetPageRangesDiffHeaders errorCode(String errorCode) { + public PageBlobGetPageRangesDiffHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesHeaders.java index 32b37ef1452c..151bb8fb3696 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesHeaders.java @@ -38,6 +38,13 @@ public final class PageBlobGetPageRangesHeaders { @JsonProperty(value = "x-ms-blob-content-length") private Long blobContentLength; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -74,11 +81,11 @@ public final class PageBlobGetPageRangesHeaders { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -90,7 +97,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the PageBlobGetPageRangesHeaders object itself. */ - public PageBlobGetPageRangesHeaders lastModified(OffsetDateTime lastModified) { + public PageBlobGetPageRangesHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -106,7 +113,7 @@ public PageBlobGetPageRangesHeaders lastModified(OffsetDateTime lastModified) { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -118,7 +125,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the PageBlobGetPageRangesHeaders object itself. */ - public PageBlobGetPageRangesHeaders eTag(String eTag) { + public PageBlobGetPageRangesHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -128,7 +135,7 @@ public PageBlobGetPageRangesHeaders eTag(String eTag) { * * @return the blobContentLength value. */ - public Long blobContentLength() { + public Long getBlobContentLength() { return this.blobContentLength; } @@ -138,18 +145,42 @@ public Long blobContentLength() { * @param blobContentLength the blobContentLength value to set. * @return the PageBlobGetPageRangesHeaders object itself. */ - public PageBlobGetPageRangesHeaders blobContentLength(Long blobContentLength) { + public PageBlobGetPageRangesHeaders setBlobContentLength(Long blobContentLength) { this.blobContentLength = blobContentLength; return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the PageBlobGetPageRangesHeaders object itself. + */ + public PageBlobGetPageRangesHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -160,7 +191,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the PageBlobGetPageRangesHeaders object itself. */ - public PageBlobGetPageRangesHeaders requestId(String requestId) { + public PageBlobGetPageRangesHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -172,7 +203,7 @@ public PageBlobGetPageRangesHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -184,7 +215,7 @@ public String version() { * @param version the version value to set. * @return the PageBlobGetPageRangesHeaders object itself. */ - public PageBlobGetPageRangesHeaders version(String version) { + public PageBlobGetPageRangesHeaders setVersion(String version) { this.version = version; return this; } @@ -195,11 +226,11 @@ public PageBlobGetPageRangesHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -209,7 +240,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the PageBlobGetPageRangesHeaders object itself. */ - public PageBlobGetPageRangesHeaders dateProperty(OffsetDateTime dateProperty) { + public PageBlobGetPageRangesHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -223,7 +254,7 @@ public PageBlobGetPageRangesHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -233,7 +264,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the PageBlobGetPageRangesHeaders object itself. */ - public PageBlobGetPageRangesHeaders errorCode(String errorCode) { + public PageBlobGetPageRangesHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobItem.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobItem.java index 52f6911c667d..6206acd558cb 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobItem.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobItem.java @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + package com.azure.storage.blob.models; import com.azure.core.implementation.util.ImplUtils; @@ -5,72 +8,107 @@ import java.time.OffsetDateTime; public class PageBlobItem { - - private OffsetDateTime lastModified; - - private byte[] contentMD5; - - private Boolean isServerEncrypted; - - private String encryptionKeySha256; - - private Long blobSequenceNumber; + private final String eTag; + private final OffsetDateTime lastModified; + private final byte[] contentMD5; + private final Boolean isServerEncrypted; + private final String encryptionKeySha256; + private final Long blobSequenceNumber; public PageBlobItem(PageBlobCreateHeaders generatedHeaders) { - this.lastModified = generatedHeaders.lastModified(); - this.contentMD5 = generatedHeaders.contentMD5(); + this.eTag = generatedHeaders.getETag(); + this.lastModified = generatedHeaders.getLastModified(); + this.contentMD5 = generatedHeaders.getContentMD5(); this.isServerEncrypted = generatedHeaders.isServerEncrypted(); - this.encryptionKeySha256 = generatedHeaders.encryptionKeySha256(); + this.encryptionKeySha256 = generatedHeaders.getEncryptionKeySha256(); + this.blobSequenceNumber = null; } public PageBlobItem(PageBlobUploadPagesHeaders generatedHeaders) { - this.lastModified = generatedHeaders.lastModified(); - this.contentMD5 = generatedHeaders.contentMD5(); + this.eTag = generatedHeaders.getETag(); + this.lastModified = generatedHeaders.getLastModified(); + this.contentMD5 = generatedHeaders.getContentMD5(); this.isServerEncrypted = generatedHeaders.isServerEncrypted(); - this.encryptionKeySha256 = generatedHeaders.encryptionKeySha256(); - this.blobSequenceNumber = generatedHeaders.blobSequenceNumber(); + this.encryptionKeySha256 = generatedHeaders.getEncryptionKeySha256(); + this.blobSequenceNumber = generatedHeaders.getBlobSequenceNumber(); } - public PageBlobItem(PageBlobUploadPagesFromURLHeaders generatedHeaders) { - this.lastModified = generatedHeaders.lastModified(); - this.contentMD5 = generatedHeaders.contentMD5(); + public PageBlobItem(PageBlobUploadPagesFromURLHeaders generatedHeaders, String encryptionKeySha256Header) { + this.eTag = generatedHeaders.getETag(); + this.lastModified = generatedHeaders.getLastModified(); + this.contentMD5 = generatedHeaders.getContentMD5(); this.isServerEncrypted = generatedHeaders.isServerEncrypted(); - this.blobSequenceNumber = generatedHeaders.blobSequenceNumber(); + this.encryptionKeySha256 = encryptionKeySha256Header; + this.blobSequenceNumber = generatedHeaders.getBlobSequenceNumber(); } - public PageBlobItem(PageBlobClearPagesHeaders generatedHeaders) { - this.lastModified = generatedHeaders.lastModified(); - this.contentMD5 = generatedHeaders.contentMD5(); - this.blobSequenceNumber = generatedHeaders.blobSequenceNumber(); + public PageBlobItem(PageBlobClearPagesHeaders generatedHeaders, String isServerEncryptedHeader, + String encryptionKeySha256Header) { + this.eTag = generatedHeaders.getETag(); + this.lastModified = generatedHeaders.getLastModified(); + this.contentMD5 = generatedHeaders.getContentMD5(); + this.isServerEncrypted = Boolean.parseBoolean(isServerEncryptedHeader); + this.encryptionKeySha256 = encryptionKeySha256Header; + this.blobSequenceNumber = generatedHeaders.getBlobSequenceNumber(); } public PageBlobItem(PageBlobResizeHeaders generatedHeaders) { - this.lastModified = generatedHeaders.lastModified(); - this.blobSequenceNumber = generatedHeaders.blobSequenceNumber(); + this.eTag = generatedHeaders.getETag(); + this.lastModified = generatedHeaders.getLastModified(); + this.blobSequenceNumber = generatedHeaders.getBlobSequenceNumber(); + this.isServerEncrypted = null; + this.encryptionKeySha256 = null; + this.contentMD5 = null; } public PageBlobItem(PageBlobUpdateSequenceNumberHeaders generatedHeaders) { - this.lastModified = generatedHeaders.lastModified(); - this.blobSequenceNumber = generatedHeaders.blobSequenceNumber(); + this.eTag = generatedHeaders.getETag(); + this.lastModified = generatedHeaders.getLastModified(); + this.blobSequenceNumber = generatedHeaders.getBlobSequenceNumber(); + this.isServerEncrypted = null; + this.encryptionKeySha256 = null; + this.contentMD5 = null; + } + + /** + * @return the eTag of the page blob + */ + public String getETag() { + return eTag; } - public OffsetDateTime lastModified() { + /** + * @return the time this page blob was last modified + */ + public OffsetDateTime getLastModified() { return lastModified; - }; + } + /** + * @return the encryption status of the page blob on the server + */ public Boolean isServerEncrypted() { return isServerEncrypted; } - public String encryptionKeySha256() { + /** + * @return the key used to encrypt the page blob + */ + public String getEncryptionKeySha256() { return encryptionKeySha256; } - public byte[] contentMD5() { + /** + * @return the MD5 of the page blob's content + */ + public byte[] getContentMD5() { return ImplUtils.clone(contentMD5); } - public Long blobSequenceNumber() { + /** + * @return the current sequence number of the page blob + */ + public Long getBlobSequenceNumber() { return blobSequenceNumber; } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobResizeHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobResizeHeaders.java index e03c8720d2b6..865e699c9509 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobResizeHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobResizeHeaders.java @@ -39,6 +39,13 @@ public final class PageBlobResizeHeaders { @JsonProperty(value = "x-ms-blob-sequence-number") private Long blobSequenceNumber; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -74,7 +81,7 @@ public final class PageBlobResizeHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -86,7 +93,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the PageBlobResizeHeaders object itself. */ - public PageBlobResizeHeaders eTag(String eTag) { + public PageBlobResizeHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -99,11 +106,11 @@ public PageBlobResizeHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -115,7 +122,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the PageBlobResizeHeaders object itself. */ - public PageBlobResizeHeaders lastModified(OffsetDateTime lastModified) { + public PageBlobResizeHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -130,7 +137,7 @@ public PageBlobResizeHeaders lastModified(OffsetDateTime lastModified) { * * @return the blobSequenceNumber value. */ - public Long blobSequenceNumber() { + public Long getBlobSequenceNumber() { return this.blobSequenceNumber; } @@ -141,18 +148,42 @@ public Long blobSequenceNumber() { * @param blobSequenceNumber the blobSequenceNumber value to set. * @return the PageBlobResizeHeaders object itself. */ - public PageBlobResizeHeaders blobSequenceNumber(Long blobSequenceNumber) { + public PageBlobResizeHeaders setBlobSequenceNumber(Long blobSequenceNumber) { this.blobSequenceNumber = blobSequenceNumber; return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the PageBlobResizeHeaders object itself. + */ + public PageBlobResizeHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -163,7 +194,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the PageBlobResizeHeaders object itself. */ - public PageBlobResizeHeaders requestId(String requestId) { + public PageBlobResizeHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -175,7 +206,7 @@ public PageBlobResizeHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -187,7 +218,7 @@ public String version() { * @param version the version value to set. * @return the PageBlobResizeHeaders object itself. */ - public PageBlobResizeHeaders version(String version) { + public PageBlobResizeHeaders setVersion(String version) { this.version = version; return this; } @@ -198,11 +229,11 @@ public PageBlobResizeHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -212,7 +243,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the PageBlobResizeHeaders object itself. */ - public PageBlobResizeHeaders dateProperty(OffsetDateTime dateProperty) { + public PageBlobResizeHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -226,7 +257,7 @@ public PageBlobResizeHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -236,7 +267,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the PageBlobResizeHeaders object itself. */ - public PageBlobResizeHeaders errorCode(String errorCode) { + public PageBlobResizeHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUpdateSequenceNumberHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUpdateSequenceNumberHeaders.java index 5f606b24c262..158644f39668 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUpdateSequenceNumberHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUpdateSequenceNumberHeaders.java @@ -39,6 +39,13 @@ public final class PageBlobUpdateSequenceNumberHeaders { @JsonProperty(value = "x-ms-blob-sequence-number") private Long blobSequenceNumber; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -74,7 +81,7 @@ public final class PageBlobUpdateSequenceNumberHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -86,7 +93,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the PageBlobUpdateSequenceNumberHeaders object itself. */ - public PageBlobUpdateSequenceNumberHeaders eTag(String eTag) { + public PageBlobUpdateSequenceNumberHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -99,11 +106,11 @@ public PageBlobUpdateSequenceNumberHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -115,7 +122,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the PageBlobUpdateSequenceNumberHeaders object itself. */ - public PageBlobUpdateSequenceNumberHeaders lastModified(OffsetDateTime lastModified) { + public PageBlobUpdateSequenceNumberHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -130,7 +137,7 @@ public PageBlobUpdateSequenceNumberHeaders lastModified(OffsetDateTime lastModif * * @return the blobSequenceNumber value. */ - public Long blobSequenceNumber() { + public Long getBlobSequenceNumber() { return this.blobSequenceNumber; } @@ -141,18 +148,42 @@ public Long blobSequenceNumber() { * @param blobSequenceNumber the blobSequenceNumber value to set. * @return the PageBlobUpdateSequenceNumberHeaders object itself. */ - public PageBlobUpdateSequenceNumberHeaders blobSequenceNumber(Long blobSequenceNumber) { + public PageBlobUpdateSequenceNumberHeaders setBlobSequenceNumber(Long blobSequenceNumber) { this.blobSequenceNumber = blobSequenceNumber; return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the PageBlobUpdateSequenceNumberHeaders object itself. + */ + public PageBlobUpdateSequenceNumberHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -163,7 +194,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the PageBlobUpdateSequenceNumberHeaders object itself. */ - public PageBlobUpdateSequenceNumberHeaders requestId(String requestId) { + public PageBlobUpdateSequenceNumberHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -175,7 +206,7 @@ public PageBlobUpdateSequenceNumberHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -187,7 +218,7 @@ public String version() { * @param version the version value to set. * @return the PageBlobUpdateSequenceNumberHeaders object itself. */ - public PageBlobUpdateSequenceNumberHeaders version(String version) { + public PageBlobUpdateSequenceNumberHeaders setVersion(String version) { this.version = version; return this; } @@ -198,11 +229,11 @@ public PageBlobUpdateSequenceNumberHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -212,7 +243,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the PageBlobUpdateSequenceNumberHeaders object itself. */ - public PageBlobUpdateSequenceNumberHeaders dateProperty(OffsetDateTime dateProperty) { + public PageBlobUpdateSequenceNumberHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -226,7 +257,7 @@ public PageBlobUpdateSequenceNumberHeaders dateProperty(OffsetDateTime datePrope * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -236,7 +267,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the PageBlobUpdateSequenceNumberHeaders object itself. */ - public PageBlobUpdateSequenceNumberHeaders errorCode(String errorCode) { + public PageBlobUpdateSequenceNumberHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesFromURLHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesFromURLHeaders.java index cebeb20842e3..b4ae8f1ee0f4 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesFromURLHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesFromURLHeaders.java @@ -41,6 +41,14 @@ public final class PageBlobUploadPagesFromURLHeaders { @JsonProperty(value = "Content-MD5") private byte[] contentMD5; + /* + * This header is returned so that the client can check for message content + * integrity. The value of this header is computed by the Blob service; it + * is not necessarily the same value specified in the request headers. + */ + @JsonProperty(value = "x-ms-content-crc64") + private byte[] xMsContentCrc64; + /* * The current sequence number for the page blob. */ @@ -90,7 +98,7 @@ public final class PageBlobUploadPagesFromURLHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -102,7 +110,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the PageBlobUploadPagesFromURLHeaders object itself. */ - public PageBlobUploadPagesFromURLHeaders eTag(String eTag) { + public PageBlobUploadPagesFromURLHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -115,11 +123,11 @@ public PageBlobUploadPagesFromURLHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -131,7 +139,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the PageBlobUploadPagesFromURLHeaders object itself. */ - public PageBlobUploadPagesFromURLHeaders lastModified(OffsetDateTime lastModified) { + public PageBlobUploadPagesFromURLHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -147,7 +155,7 @@ public PageBlobUploadPagesFromURLHeaders lastModified(OffsetDateTime lastModifie * * @return the contentMD5 value. */ - public byte[] contentMD5() { + public byte[] getContentMD5() { return ImplUtils.clone(this.contentMD5); } @@ -159,18 +167,44 @@ public byte[] contentMD5() { * @param contentMD5 the contentMD5 value to set. * @return the PageBlobUploadPagesFromURLHeaders object itself. */ - public PageBlobUploadPagesFromURLHeaders contentMD5(byte[] contentMD5) { + public PageBlobUploadPagesFromURLHeaders setContentMD5(byte[] contentMD5) { this.contentMD5 = ImplUtils.clone(contentMD5); return this; } + /** + * Get the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @return the xMsContentCrc64 value. + */ + public byte[] getXMsContentCrc64() { + return ImplUtils.clone(this.xMsContentCrc64); + } + + /** + * Set the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the PageBlobUploadPagesFromURLHeaders object itself. + */ + public PageBlobUploadPagesFromURLHeaders setXMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = ImplUtils.clone(xMsContentCrc64); + return this; + } + /** * Get the blobSequenceNumber property: The current sequence number for the * page blob. * * @return the blobSequenceNumber value. */ - public Long blobSequenceNumber() { + public Long getBlobSequenceNumber() { return this.blobSequenceNumber; } @@ -181,7 +215,7 @@ public Long blobSequenceNumber() { * @param blobSequenceNumber the blobSequenceNumber value to set. * @return the PageBlobUploadPagesFromURLHeaders object itself. */ - public PageBlobUploadPagesFromURLHeaders blobSequenceNumber(Long blobSequenceNumber) { + public PageBlobUploadPagesFromURLHeaders setBlobSequenceNumber(Long blobSequenceNumber) { this.blobSequenceNumber = blobSequenceNumber; return this; } @@ -192,7 +226,7 @@ public PageBlobUploadPagesFromURLHeaders blobSequenceNumber(Long blobSequenceNum * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -203,7 +237,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the PageBlobUploadPagesFromURLHeaders object itself. */ - public PageBlobUploadPagesFromURLHeaders requestId(String requestId) { + public PageBlobUploadPagesFromURLHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -215,7 +249,7 @@ public PageBlobUploadPagesFromURLHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -227,7 +261,7 @@ public String version() { * @param version the version value to set. * @return the PageBlobUploadPagesFromURLHeaders object itself. */ - public PageBlobUploadPagesFromURLHeaders version(String version) { + public PageBlobUploadPagesFromURLHeaders setVersion(String version) { this.version = version; return this; } @@ -238,11 +272,11 @@ public PageBlobUploadPagesFromURLHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -252,7 +286,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the PageBlobUploadPagesFromURLHeaders object itself. */ - public PageBlobUploadPagesFromURLHeaders dateProperty(OffsetDateTime dateProperty) { + public PageBlobUploadPagesFromURLHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -280,7 +314,7 @@ public Boolean isServerEncrypted() { * @param isServerEncrypted the isServerEncrypted value to set. * @return the PageBlobUploadPagesFromURLHeaders object itself. */ - public PageBlobUploadPagesFromURLHeaders isServerEncrypted(Boolean isServerEncrypted) { + public PageBlobUploadPagesFromURLHeaders setIsServerEncrypted(Boolean isServerEncrypted) { this.isServerEncrypted = isServerEncrypted; return this; } @@ -290,7 +324,7 @@ public PageBlobUploadPagesFromURLHeaders isServerEncrypted(Boolean isServerEncry * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -300,7 +334,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the PageBlobUploadPagesFromURLHeaders object itself. */ - public PageBlobUploadPagesFromURLHeaders errorCode(String errorCode) { + public PageBlobUploadPagesFromURLHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesHeaders.java index 7dd8eb12ae72..0c4f917b0028 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesHeaders.java @@ -41,12 +41,27 @@ public final class PageBlobUploadPagesHeaders { @JsonProperty(value = "Content-MD5") private byte[] contentMD5; + /* + * This header is returned so that the client can check for message content + * integrity. The value of this header is computed by the Blob service; it + * is not necessarily the same value specified in the request headers. + */ + @JsonProperty(value = "x-ms-content-crc64") + private byte[] xMsContentCrc64; + /* * The current sequence number for the page blob. */ @JsonProperty(value = "x-ms-blob-sequence-number") private Long blobSequenceNumber; + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -98,7 +113,7 @@ public final class PageBlobUploadPagesHeaders { * * @return the eTag value. */ - public String eTag() { + public String getETag() { return this.eTag; } @@ -110,7 +125,7 @@ public String eTag() { * @param eTag the eTag value to set. * @return the PageBlobUploadPagesHeaders object itself. */ - public PageBlobUploadPagesHeaders eTag(String eTag) { + public PageBlobUploadPagesHeaders setETag(String eTag) { this.eTag = eTag; return this; } @@ -123,11 +138,11 @@ public PageBlobUploadPagesHeaders eTag(String eTag) { * * @return the lastModified value. */ - public OffsetDateTime lastModified() { + public OffsetDateTime getLastModified() { if (this.lastModified == null) { return null; } - return this.lastModified.dateTime(); + return this.lastModified.getDateTime(); } /** @@ -139,7 +154,7 @@ public OffsetDateTime lastModified() { * @param lastModified the lastModified value to set. * @return the PageBlobUploadPagesHeaders object itself. */ - public PageBlobUploadPagesHeaders lastModified(OffsetDateTime lastModified) { + public PageBlobUploadPagesHeaders setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { this.lastModified = null; } else { @@ -155,7 +170,7 @@ public PageBlobUploadPagesHeaders lastModified(OffsetDateTime lastModified) { * * @return the contentMD5 value. */ - public byte[] contentMD5() { + public byte[] getContentMD5() { return ImplUtils.clone(this.contentMD5); } @@ -167,18 +182,44 @@ public byte[] contentMD5() { * @param contentMD5 the contentMD5 value to set. * @return the PageBlobUploadPagesHeaders object itself. */ - public PageBlobUploadPagesHeaders contentMD5(byte[] contentMD5) { + public PageBlobUploadPagesHeaders setContentMD5(byte[] contentMD5) { this.contentMD5 = ImplUtils.clone(contentMD5); return this; } + /** + * Get the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @return the xMsContentCrc64 value. + */ + public byte[] getXMsContentCrc64() { + return ImplUtils.clone(this.xMsContentCrc64); + } + + /** + * Set the xMsContentCrc64 property: This header is returned so that the + * client can check for message content integrity. The value of this header + * is computed by the Blob service; it is not necessarily the same value + * specified in the request headers. + * + * @param xMsContentCrc64 the xMsContentCrc64 value to set. + * @return the PageBlobUploadPagesHeaders object itself. + */ + public PageBlobUploadPagesHeaders setXMsContentCrc64(byte[] xMsContentCrc64) { + this.xMsContentCrc64 = ImplUtils.clone(xMsContentCrc64); + return this; + } + /** * Get the blobSequenceNumber property: The current sequence number for the * page blob. * * @return the blobSequenceNumber value. */ - public Long blobSequenceNumber() { + public Long getBlobSequenceNumber() { return this.blobSequenceNumber; } @@ -189,18 +230,42 @@ public Long blobSequenceNumber() { * @param blobSequenceNumber the blobSequenceNumber value to set. * @return the PageBlobUploadPagesHeaders object itself. */ - public PageBlobUploadPagesHeaders blobSequenceNumber(Long blobSequenceNumber) { + public PageBlobUploadPagesHeaders setBlobSequenceNumber(Long blobSequenceNumber) { this.blobSequenceNumber = blobSequenceNumber; return this; } + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the PageBlobUploadPagesHeaders object itself. + */ + public PageBlobUploadPagesHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -211,7 +276,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the PageBlobUploadPagesHeaders object itself. */ - public PageBlobUploadPagesHeaders requestId(String requestId) { + public PageBlobUploadPagesHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -223,7 +288,7 @@ public PageBlobUploadPagesHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -235,7 +300,7 @@ public String version() { * @param version the version value to set. * @return the PageBlobUploadPagesHeaders object itself. */ - public PageBlobUploadPagesHeaders version(String version) { + public PageBlobUploadPagesHeaders setVersion(String version) { this.version = version; return this; } @@ -246,11 +311,11 @@ public PageBlobUploadPagesHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -260,7 +325,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the PageBlobUploadPagesHeaders object itself. */ - public PageBlobUploadPagesHeaders dateProperty(OffsetDateTime dateProperty) { + public PageBlobUploadPagesHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -288,7 +353,7 @@ public Boolean isServerEncrypted() { * @param isServerEncrypted the isServerEncrypted value to set. * @return the PageBlobUploadPagesHeaders object itself. */ - public PageBlobUploadPagesHeaders isServerEncrypted(Boolean isServerEncrypted) { + public PageBlobUploadPagesHeaders setIsServerEncrypted(Boolean isServerEncrypted) { this.isServerEncrypted = isServerEncrypted; return this; } @@ -300,7 +365,7 @@ public PageBlobUploadPagesHeaders isServerEncrypted(Boolean isServerEncrypted) { * * @return the encryptionKeySha256 value. */ - public String encryptionKeySha256() { + public String getEncryptionKeySha256() { return this.encryptionKeySha256; } @@ -312,7 +377,7 @@ public String encryptionKeySha256() { * @param encryptionKeySha256 the encryptionKeySha256 value to set. * @return the PageBlobUploadPagesHeaders object itself. */ - public PageBlobUploadPagesHeaders encryptionKeySha256(String encryptionKeySha256) { + public PageBlobUploadPagesHeaders setEncryptionKeySha256(String encryptionKeySha256) { this.encryptionKeySha256 = encryptionKeySha256; return this; } @@ -322,7 +387,7 @@ public PageBlobUploadPagesHeaders encryptionKeySha256(String encryptionKeySha256 * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -332,7 +397,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the PageBlobUploadPagesHeaders object itself. */ - public PageBlobUploadPagesHeaders errorCode(String errorCode) { + public PageBlobUploadPagesHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsGetPageRangesDiffResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsGetPageRangesDiffResponse.java index 987b49716aab..731938d27919 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsGetPageRangesDiffResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsGetPageRangesDiffResponse.java @@ -29,7 +29,7 @@ public PageBlobsGetPageRangesDiffResponse(HttpRequest request, int statusCode, H * @return the deserialized response body. */ @Override - public PageList value() { - return super.value(); + public PageList getValue() { + return super.getValue(); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsGetPageRangesResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsGetPageRangesResponse.java index 0e90e1714262..aa5f60f5ab42 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsGetPageRangesResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsGetPageRangesResponse.java @@ -29,7 +29,7 @@ public PageBlobsGetPageRangesResponse(HttpRequest request, int statusCode, HttpH * @return the deserialized response body. */ @Override - public PageList value() { - return super.value(); + public PageList getValue() { + return super.getValue(); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageList.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageList.java index b981bdf2f6ed..68f2213ee013 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageList.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageList.java @@ -33,7 +33,7 @@ public final class PageList { * * @return the pageRange value. */ - public List pageRange() { + public List getPageRange() { return this.pageRange; } @@ -43,7 +43,7 @@ public List pageRange() { * @param pageRange the pageRange value to set. * @return the PageList object itself. */ - public PageList pageRange(List pageRange) { + public PageList setPageRange(List pageRange) { this.pageRange = pageRange; return this; } @@ -53,7 +53,7 @@ public PageList pageRange(List pageRange) { * * @return the clearRange value. */ - public List clearRange() { + public List getClearRange() { return this.clearRange; } @@ -63,7 +63,7 @@ public List clearRange() { * @param clearRange the clearRange value to set. * @return the PageList object itself. */ - public PageList clearRange(List clearRange) { + public PageList setClearRange(List clearRange) { this.clearRange = clearRange; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageRange.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageRange.java index 53a76779cd4d..2c0ccfe3be0a 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageRange.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageRange.java @@ -31,7 +31,7 @@ public final class PageRange { * * @return the start value. */ - public long start() { + public long getStart() { return this.start; } @@ -41,7 +41,7 @@ public long start() { * @param start the start value to set. * @return the PageRange object itself. */ - public PageRange start(long start) { + public PageRange setStart(long start) { this.start = start; return this; } @@ -51,7 +51,7 @@ public PageRange start(long start) { * * @return the end value. */ - public long end() { + public long getEnd() { return this.end; } @@ -61,7 +61,7 @@ public long end() { * @param end the end value to set. * @return the PageRange object itself. */ - public PageRange end(long end) { + public PageRange setEnd(long end) { this.end = end; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PathRenameMode.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PathRenameMode.java new file mode 100644 index 000000000000..a63e11af27c3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PathRenameMode.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for PathRenameMode. + */ +public enum PathRenameMode { + /** + * Enum value legacy. + */ + LEGACY("legacy"), + + /** + * Enum value posix. + */ + POSIX("posix"); + + /** + * The actual serialized value for a PathRenameMode instance. + */ + private final String value; + + PathRenameMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PathRenameMode instance. + * + * @param value the serialized value to parse. + * @return the parsed PathRenameMode object, or null if unable to parse. + */ + @JsonCreator + public static PathRenameMode fromString(String value) { + PathRenameMode[] items = PathRenameMode.values(); + for (PathRenameMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/RehydratePriority.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/RehydratePriority.java new file mode 100644 index 000000000000..8fc928767f37 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/RehydratePriority.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Defines values for RehydratePriority. + */ +public final class RehydratePriority extends ExpandableStringEnum { + /** + * Static value High for RehydratePriority. + */ + public static final RehydratePriority HIGH = fromString("High"); + + /** + * Static value Standard for RehydratePriority. + */ + public static final RehydratePriority STANDARD = fromString("Standard"); + + /** + * Creates or finds a RehydratePriority from its string representation. + * + * @param name a name to look for. + * @return the corresponding RehydratePriority. + */ + @JsonCreator + public static RehydratePriority fromString(String name) { + return fromString(name, RehydratePriority.class); + } + + /** + * @return known RehydratePriority values. + */ + public static Collection values() { + return values(RehydratePriority.class); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ReliableDownloadOptions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ReliableDownloadOptions.java index b85680617a12..0120f0e3c35e 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ReliableDownloadOptions.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ReliableDownloadOptions.java @@ -3,17 +3,20 @@ package com.azure.storage.blob.models; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.DownloadAsyncResponse; import java.util.Locale; /** - * {@code ReliableDownloadOptions} contains properties which help the {@code Flux} returned from - * {@link DownloadAsyncResponse#body(ReliableDownloadOptions)} determine when to retry. + * {@code ReliableDownloadOptions} contains properties which help the {@code Flux} returned from {@link + * DownloadAsyncResponse#body(ReliableDownloadOptions)} determine when to retry. */ public final class ReliableDownloadOptions { private static final String PARAMETER_NOT_IN_RANGE = "The value of the parameter '%s' should be between %s and %s."; + private final ClientLogger logger = new ClientLogger(ReliableDownloadOptions.class); + /* We use "retry" here because by the time the user passes this type, the initial request, or try, has already been issued and returned. This is in contrast to the retry policy options, which includes the initial try in its count, @@ -41,8 +44,9 @@ public int maxRetryRequests() { */ public ReliableDownloadOptions maxRetryRequests(int maxRetryRequests) { if (maxRetryRequests < 0) { - throw new IllegalArgumentException(String.format(Locale.ROOT, PARAMETER_NOT_IN_RANGE, - "options.maxRetryRequests", 0, Integer.MAX_VALUE)); + throw logger.logExceptionAsError( + new IllegalArgumentException(String.format(Locale.ROOT, PARAMETER_NOT_IN_RANGE, + "options.maxRetryRequests", 0, Integer.MAX_VALUE))); } this.maxRetryRequests = maxRetryRequests; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/RetentionPolicy.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/RetentionPolicy.java index 7877f6dd0bd7..11c1f3df4074 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/RetentionPolicy.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/RetentionPolicy.java @@ -34,7 +34,7 @@ public final class RetentionPolicy { * * @return the enabled value. */ - public boolean enabled() { + public boolean isEnabled() { return this.enabled; } @@ -45,7 +45,7 @@ public boolean enabled() { * @param enabled the enabled value to set. * @return the RetentionPolicy object itself. */ - public RetentionPolicy enabled(boolean enabled) { + public RetentionPolicy setEnabled(boolean enabled) { this.enabled = enabled; return this; } @@ -57,7 +57,7 @@ public RetentionPolicy enabled(boolean enabled) { * * @return the days value. */ - public Integer days() { + public Integer getDays() { return this.days; } @@ -69,7 +69,7 @@ public Integer days() { * @param days the days value to set. * @return the RetentionPolicy object itself. */ - public RetentionPolicy days(Integer days) { + public RetentionPolicy setDays(Integer days) { this.days = days; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SequenceNumberAccessConditions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SequenceNumberAccessConditions.java index c211020aeb24..b57b8c4f7c3a 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SequenceNumberAccessConditions.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SequenceNumberAccessConditions.java @@ -43,7 +43,7 @@ public final class SequenceNumberAccessConditions { * * @return the ifSequenceNumberLessThanOrEqualTo value. */ - public Long ifSequenceNumberLessThanOrEqualTo() { + public Long getIfSequenceNumberLessThanOrEqualTo() { return this.ifSequenceNumberLessThanOrEqualTo; } @@ -56,7 +56,7 @@ public Long ifSequenceNumberLessThanOrEqualTo() { * ifSequenceNumberLessThanOrEqualTo value to set. * @return the SequenceNumberAccessConditions object itself. */ - public SequenceNumberAccessConditions ifSequenceNumberLessThanOrEqualTo(Long ifSequenceNumberLessThanOrEqualTo) { + public SequenceNumberAccessConditions setIfSequenceNumberLessThanOrEqualTo(Long ifSequenceNumberLessThanOrEqualTo) { this.ifSequenceNumberLessThanOrEqualTo = ifSequenceNumberLessThanOrEqualTo; return this; } @@ -68,7 +68,7 @@ public SequenceNumberAccessConditions ifSequenceNumberLessThanOrEqualTo(Long ifS * * @return the ifSequenceNumberLessThan value. */ - public Long ifSequenceNumberLessThan() { + public Long getIfSequenceNumberLessThan() { return this.ifSequenceNumberLessThan; } @@ -81,7 +81,7 @@ public Long ifSequenceNumberLessThan() { * set. * @return the SequenceNumberAccessConditions object itself. */ - public SequenceNumberAccessConditions ifSequenceNumberLessThan(Long ifSequenceNumberLessThan) { + public SequenceNumberAccessConditions setIfSequenceNumberLessThan(Long ifSequenceNumberLessThan) { this.ifSequenceNumberLessThan = ifSequenceNumberLessThan; return this; } @@ -92,7 +92,7 @@ public SequenceNumberAccessConditions ifSequenceNumberLessThan(Long ifSequenceNu * * @return the ifSequenceNumberEqualTo value. */ - public Long ifSequenceNumberEqualTo() { + public Long getIfSequenceNumberEqualTo() { return this.ifSequenceNumberEqualTo; } @@ -103,7 +103,7 @@ public Long ifSequenceNumberEqualTo() { * @param ifSequenceNumberEqualTo the ifSequenceNumberEqualTo value to set. * @return the SequenceNumberAccessConditions object itself. */ - public SequenceNumberAccessConditions ifSequenceNumberEqualTo(Long ifSequenceNumberEqualTo) { + public SequenceNumberAccessConditions setIfSequenceNumberEqualTo(Long ifSequenceNumberEqualTo) { this.ifSequenceNumberEqualTo = ifSequenceNumberEqualTo; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceFilterBlobsHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceFilterBlobsHeaders.java new file mode 100644 index 000000000000..0bf1e93e1c71 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceFilterBlobsHeaders.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.time.OffsetDateTime; + +/** + * Defines headers for FilterBlobs operation. + */ +@JacksonXmlRootElement(localName = "Service-FilterBlobs-Headers") +@Fluent +public final class ServiceFilterBlobsHeaders { + /* + * The media type of the body of the response. For Filter Blobs this is + * 'application/xml' + */ + @JsonProperty(value = "Content-Type") + private String contentType; + + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + + /* + * This header uniquely identifies the request that was made and can be + * used for troubleshooting the request. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * Indicates the version of the Blob service used to execute the request. + * This header is returned for requests made against version 2009-09-19 and + * above. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * UTC date/time value generated by the service that indicates the time at + * which the response was initiated + */ + @JsonProperty(value = "Date") + private DateTimeRfc1123 dateProperty; + + /* + * The errorCode property. + */ + @JsonProperty(value = "x-ms-error-code") + private String errorCode; + + /** + * Get the contentType property: The media type of the body of the + * response. For Filter Blobs this is 'application/xml'. + * + * @return the contentType value. + */ + public String contentType() { + return this.contentType; + } + + /** + * Set the contentType property: The media type of the body of the + * response. For Filter Blobs this is 'application/xml'. + * + * @param contentType the contentType value to set. + * @return the ServiceFilterBlobsHeaders object itself. + */ + public ServiceFilterBlobsHeaders contentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ServiceFilterBlobsHeaders object itself. + */ + public ServiceFilterBlobsHeaders clientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get the requestId property: This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @return the requestId value. + */ + public String requestId() { + return this.requestId; + } + + /** + * Set the requestId property: This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @param requestId the requestId value to set. + * @return the ServiceFilterBlobsHeaders object itself. + */ + public ServiceFilterBlobsHeaders requestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: Indicates the version of the Blob service used + * to execute the request. This header is returned for requests made + * against version 2009-09-19 and above. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Indicates the version of the Blob service used + * to execute the request. This header is returned for requests made + * against version 2009-09-19 and above. + * + * @param version the version value to set. + * @return the ServiceFilterBlobsHeaders object itself. + */ + public ServiceFilterBlobsHeaders version(String version) { + this.version = version; + return this; + } + + /** + * Get the dateProperty property: UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @return the dateProperty value. + */ + public OffsetDateTime dateProperty() { + if (this.dateProperty == null) { + return null; + } + return this.dateProperty.getDateTime(); + } + + /** + * Set the dateProperty property: UTC date/time value generated by the + * service that indicates the time at which the response was initiated. + * + * @param dateProperty the dateProperty value to set. + * @return the ServiceFilterBlobsHeaders object itself. + */ + public ServiceFilterBlobsHeaders dateProperty(OffsetDateTime dateProperty) { + if (dateProperty == null) { + this.dateProperty = null; + } else { + this.dateProperty = new DateTimeRfc1123(dateProperty); + } + return this; + } + + /** + * Get the errorCode property: The errorCode property. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Set the errorCode property: The errorCode property. + * + * @param errorCode the errorCode value to set. + * @return the ServiceFilterBlobsHeaders object itself. + */ + public ServiceFilterBlobsHeaders errorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetAccountInfoHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetAccountInfoHeaders.java index 88fa50830518..9cc74aebb022 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetAccountInfoHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetAccountInfoHeaders.java @@ -16,6 +16,13 @@ @JacksonXmlRootElement(localName = "Service-GetAccountInfo-Headers") @Fluent public final class ServiceGetAccountInfoHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -59,13 +66,37 @@ public final class ServiceGetAccountInfoHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ServiceGetAccountInfoHeaders object itself. + */ + public ServiceGetAccountInfoHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -76,7 +107,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the ServiceGetAccountInfoHeaders object itself. */ - public ServiceGetAccountInfoHeaders requestId(String requestId) { + public ServiceGetAccountInfoHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -88,7 +119,7 @@ public ServiceGetAccountInfoHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -100,7 +131,7 @@ public String version() { * @param version the version value to set. * @return the ServiceGetAccountInfoHeaders object itself. */ - public ServiceGetAccountInfoHeaders version(String version) { + public ServiceGetAccountInfoHeaders setVersion(String version) { this.version = version; return this; } @@ -111,11 +142,11 @@ public ServiceGetAccountInfoHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -125,7 +156,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the ServiceGetAccountInfoHeaders object itself. */ - public ServiceGetAccountInfoHeaders dateProperty(OffsetDateTime dateProperty) { + public ServiceGetAccountInfoHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -141,7 +172,7 @@ public ServiceGetAccountInfoHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the skuName value. */ - public SkuName skuName() { + public SkuName getSkuName() { return this.skuName; } @@ -153,7 +184,7 @@ public SkuName skuName() { * @param skuName the skuName value to set. * @return the ServiceGetAccountInfoHeaders object itself. */ - public ServiceGetAccountInfoHeaders skuName(SkuName skuName) { + public ServiceGetAccountInfoHeaders setSkuName(SkuName skuName) { this.skuName = skuName; return this; } @@ -164,7 +195,7 @@ public ServiceGetAccountInfoHeaders skuName(SkuName skuName) { * * @return the accountKind value. */ - public AccountKind accountKind() { + public AccountKind getAccountKind() { return this.accountKind; } @@ -175,7 +206,7 @@ public AccountKind accountKind() { * @param accountKind the accountKind value to set. * @return the ServiceGetAccountInfoHeaders object itself. */ - public ServiceGetAccountInfoHeaders accountKind(AccountKind accountKind) { + public ServiceGetAccountInfoHeaders setAccountKind(AccountKind accountKind) { this.accountKind = accountKind; return this; } @@ -185,7 +216,7 @@ public ServiceGetAccountInfoHeaders accountKind(AccountKind accountKind) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -195,7 +226,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the ServiceGetAccountInfoHeaders object itself. */ - public ServiceGetAccountInfoHeaders errorCode(String errorCode) { + public ServiceGetAccountInfoHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetPropertiesHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetPropertiesHeaders.java index 3b5b06ab3259..116eef6e7de8 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetPropertiesHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetPropertiesHeaders.java @@ -14,6 +14,13 @@ @JacksonXmlRootElement(localName = "Service-GetProperties-Headers") @Fluent public final class ServiceGetPropertiesHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -35,13 +42,37 @@ public final class ServiceGetPropertiesHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ServiceGetPropertiesHeaders object itself. + */ + public ServiceGetPropertiesHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -52,7 +83,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the ServiceGetPropertiesHeaders object itself. */ - public ServiceGetPropertiesHeaders requestId(String requestId) { + public ServiceGetPropertiesHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -64,7 +95,7 @@ public ServiceGetPropertiesHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -76,7 +107,7 @@ public String version() { * @param version the version value to set. * @return the ServiceGetPropertiesHeaders object itself. */ - public ServiceGetPropertiesHeaders version(String version) { + public ServiceGetPropertiesHeaders setVersion(String version) { this.version = version; return this; } @@ -86,7 +117,7 @@ public ServiceGetPropertiesHeaders version(String version) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -96,7 +127,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the ServiceGetPropertiesHeaders object itself. */ - public ServiceGetPropertiesHeaders errorCode(String errorCode) { + public ServiceGetPropertiesHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetStatisticsHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetStatisticsHeaders.java index 55dda9cc8ddb..e74f35bfb286 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetStatisticsHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetStatisticsHeaders.java @@ -16,6 +16,13 @@ @JacksonXmlRootElement(localName = "Service-GetStatistics-Headers") @Fluent public final class ServiceGetStatisticsHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -44,13 +51,37 @@ public final class ServiceGetStatisticsHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ServiceGetStatisticsHeaders object itself. + */ + public ServiceGetStatisticsHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -61,7 +92,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the ServiceGetStatisticsHeaders object itself. */ - public ServiceGetStatisticsHeaders requestId(String requestId) { + public ServiceGetStatisticsHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -73,7 +104,7 @@ public ServiceGetStatisticsHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -85,7 +116,7 @@ public String version() { * @param version the version value to set. * @return the ServiceGetStatisticsHeaders object itself. */ - public ServiceGetStatisticsHeaders version(String version) { + public ServiceGetStatisticsHeaders setVersion(String version) { this.version = version; return this; } @@ -96,11 +127,11 @@ public ServiceGetStatisticsHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -110,7 +141,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the ServiceGetStatisticsHeaders object itself. */ - public ServiceGetStatisticsHeaders dateProperty(OffsetDateTime dateProperty) { + public ServiceGetStatisticsHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -124,7 +155,7 @@ public ServiceGetStatisticsHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -134,7 +165,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the ServiceGetStatisticsHeaders object itself. */ - public ServiceGetStatisticsHeaders errorCode(String errorCode) { + public ServiceGetStatisticsHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetUserDelegationKeyHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetUserDelegationKeyHeaders.java index 4a74086587af..969e79d764ba 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetUserDelegationKeyHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetUserDelegationKeyHeaders.java @@ -16,6 +16,13 @@ @JacksonXmlRootElement(localName = "Service-GetUserDelegationKey-Headers") @Fluent public final class ServiceGetUserDelegationKeyHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -44,13 +51,37 @@ public final class ServiceGetUserDelegationKeyHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ServiceGetUserDelegationKeyHeaders object itself. + */ + public ServiceGetUserDelegationKeyHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -61,7 +92,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the ServiceGetUserDelegationKeyHeaders object itself. */ - public ServiceGetUserDelegationKeyHeaders requestId(String requestId) { + public ServiceGetUserDelegationKeyHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -73,7 +104,7 @@ public ServiceGetUserDelegationKeyHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -85,7 +116,7 @@ public String version() { * @param version the version value to set. * @return the ServiceGetUserDelegationKeyHeaders object itself. */ - public ServiceGetUserDelegationKeyHeaders version(String version) { + public ServiceGetUserDelegationKeyHeaders setVersion(String version) { this.version = version; return this; } @@ -96,11 +127,11 @@ public ServiceGetUserDelegationKeyHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -110,7 +141,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the ServiceGetUserDelegationKeyHeaders object itself. */ - public ServiceGetUserDelegationKeyHeaders dateProperty(OffsetDateTime dateProperty) { + public ServiceGetUserDelegationKeyHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -124,7 +155,7 @@ public ServiceGetUserDelegationKeyHeaders dateProperty(OffsetDateTime dateProper * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -134,7 +165,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the ServiceGetUserDelegationKeyHeaders object itself. */ - public ServiceGetUserDelegationKeyHeaders errorCode(String errorCode) { + public ServiceGetUserDelegationKeyHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceListContainersSegmentHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceListContainersSegmentHeaders.java index 94908506ede7..9966c84c93fd 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceListContainersSegmentHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceListContainersSegmentHeaders.java @@ -14,6 +14,13 @@ @JacksonXmlRootElement(localName = "Service-ListContainersSegment-Headers") @Fluent public final class ServiceListContainersSegmentHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -35,13 +42,37 @@ public final class ServiceListContainersSegmentHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ServiceListContainersSegmentHeaders object itself. + */ + public ServiceListContainersSegmentHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -52,7 +83,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the ServiceListContainersSegmentHeaders object itself. */ - public ServiceListContainersSegmentHeaders requestId(String requestId) { + public ServiceListContainersSegmentHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -64,7 +95,7 @@ public ServiceListContainersSegmentHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -76,7 +107,7 @@ public String version() { * @param version the version value to set. * @return the ServiceListContainersSegmentHeaders object itself. */ - public ServiceListContainersSegmentHeaders version(String version) { + public ServiceListContainersSegmentHeaders setVersion(String version) { this.version = version; return this; } @@ -86,7 +117,7 @@ public ServiceListContainersSegmentHeaders version(String version) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -96,7 +127,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the ServiceListContainersSegmentHeaders object itself. */ - public ServiceListContainersSegmentHeaders errorCode(String errorCode) { + public ServiceListContainersSegmentHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceSetPropertiesHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceSetPropertiesHeaders.java index df15cc766400..24023ccd6443 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceSetPropertiesHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceSetPropertiesHeaders.java @@ -14,6 +14,13 @@ @JacksonXmlRootElement(localName = "Service-SetProperties-Headers") @Fluent public final class ServiceSetPropertiesHeaders { + /* + * If a client request id header is sent in the request, this header will + * be present in the response with the same value. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String clientRequestId; + /* * This header uniquely identifies the request that was made and can be * used for troubleshooting the request. @@ -35,13 +42,37 @@ public final class ServiceSetPropertiesHeaders { @JsonProperty(value = "x-ms-error-code") private String errorCode; + /** + * Get the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @return the clientRequestId value. + */ + public String getClientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: If a client request id header is sent + * in the request, this header will be present in the response with the + * same value. + * + * @param clientRequestId the clientRequestId value to set. + * @return the ServiceSetPropertiesHeaders object itself. + */ + public ServiceSetPropertiesHeaders setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + /** * Get the requestId property: This header uniquely identifies the request * that was made and can be used for troubleshooting the request. * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -52,7 +83,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the ServiceSetPropertiesHeaders object itself. */ - public ServiceSetPropertiesHeaders requestId(String requestId) { + public ServiceSetPropertiesHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -64,7 +95,7 @@ public ServiceSetPropertiesHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -76,7 +107,7 @@ public String version() { * @param version the version value to set. * @return the ServiceSetPropertiesHeaders object itself. */ - public ServiceSetPropertiesHeaders version(String version) { + public ServiceSetPropertiesHeaders setVersion(String version) { this.version = version; return this; } @@ -86,7 +117,7 @@ public ServiceSetPropertiesHeaders version(String version) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -96,7 +127,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the ServiceSetPropertiesHeaders object itself. */ - public ServiceSetPropertiesHeaders errorCode(String errorCode) { + public ServiceSetPropertiesHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceSubmitBatchHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceSubmitBatchHeaders.java new file mode 100644 index 000000000000..c85fb17583d4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceSubmitBatchHeaders.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * Defines headers for SubmitBatch operation. + */ +@JacksonXmlRootElement(localName = "Service-SubmitBatch-Headers") +@Fluent +public final class ServiceSubmitBatchHeaders { + /* + * The media type of the body of the response. For batch requests, this is + * multipart/mixed; boundary=batchresponse_GUID + */ + @JsonProperty(value = "Content-Type") + private String contentType; + + /* + * This header uniquely identifies the request that was made and can be + * used for troubleshooting the request. + */ + @JsonProperty(value = "x-ms-request-id") + private String requestId; + + /* + * Indicates the version of the Blob service used to execute the request. + * This header is returned for requests made against version 2009-09-19 and + * above. + */ + @JsonProperty(value = "x-ms-version") + private String version; + + /* + * The errorCode property. + */ + @JsonProperty(value = "x-ms-error-code") + private String errorCode; + + /** + * Get the contentType property: The media type of the body of the + * response. For batch requests, this is multipart/mixed; + * boundary=batchresponse_GUID. + * + * @return the contentType value. + */ + public String getContentType() { + return this.contentType; + } + + /** + * Set the contentType property: The media type of the body of the + * response. For batch requests, this is multipart/mixed; + * boundary=batchresponse_GUID. + * + * @param contentType the contentType value to set. + * @return the ServiceSubmitBatchHeaders object itself. + */ + public ServiceSubmitBatchHeaders setContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the requestId property: This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @return the requestId value. + */ + public String getRequestId() { + return this.requestId; + } + + /** + * Set the requestId property: This header uniquely identifies the request + * that was made and can be used for troubleshooting the request. + * + * @param requestId the requestId value to set. + * @return the ServiceSubmitBatchHeaders object itself. + */ + public ServiceSubmitBatchHeaders setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Get the version property: Indicates the version of the Blob service used + * to execute the request. This header is returned for requests made + * against version 2009-09-19 and above. + * + * @return the version value. + */ + public String getVersion() { + return this.version; + } + + /** + * Set the version property: Indicates the version of the Blob service used + * to execute the request. This header is returned for requests made + * against version 2009-09-19 and above. + * + * @param version the version value to set. + * @return the ServiceSubmitBatchHeaders object itself. + */ + public ServiceSubmitBatchHeaders setVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the errorCode property: The errorCode property. + * + * @return the errorCode value. + */ + public String getErrorCode() { + return this.errorCode; + } + + /** + * Set the errorCode property: The errorCode property. + * + * @param errorCode the errorCode value to set. + * @return the ServiceSubmitBatchHeaders object itself. + */ + public ServiceSubmitBatchHeaders setErrorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesFilterBlobsResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesFilterBlobsResponse.java new file mode 100644 index 000000000000..34efeb8b2c62 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesFilterBlobsResponse.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the filterBlobs operation. + */ +public final class ServicesFilterBlobsResponse extends ResponseBase { + /** + * Creates an instance of ServicesFilterBlobsResponse. + * + * @param request the request which resulted in this ServicesFilterBlobsResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public ServicesFilterBlobsResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, FilterBlobsResponse value, ServiceFilterBlobsHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * @return the deserialized response body. + */ + @Override + public FilterBlobsResponse getValue() { + return super.getValue(); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesGetPropertiesResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesGetPropertiesResponse.java index 8ac29adaf0b7..5c58630cc776 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesGetPropertiesResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesGetPropertiesResponse.java @@ -29,7 +29,7 @@ public ServicesGetPropertiesResponse(HttpRequest request, int statusCode, HttpHe * @return the deserialized response body. */ @Override - public StorageServiceProperties value() { - return super.value(); + public StorageServiceProperties getValue() { + return super.getValue(); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesGetStatisticsResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesGetStatisticsResponse.java index e99c9ad3906f..80f7beedfc19 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesGetStatisticsResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesGetStatisticsResponse.java @@ -29,7 +29,7 @@ public ServicesGetStatisticsResponse(HttpRequest request, int statusCode, HttpHe * @return the deserialized response body. */ @Override - public StorageServiceStats value() { - return super.value(); + public StorageServiceStats getValue() { + return super.getValue(); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesGetUserDelegationKeyResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesGetUserDelegationKeyResponse.java index ee7db7122a4f..4c221693725d 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesGetUserDelegationKeyResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesGetUserDelegationKeyResponse.java @@ -29,7 +29,7 @@ public ServicesGetUserDelegationKeyResponse(HttpRequest request, int statusCode, * @return the deserialized response body. */ @Override - public UserDelegationKey value() { - return super.value(); + public UserDelegationKey getValue() { + return super.getValue(); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesListContainersSegmentResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesListContainersSegmentResponse.java index ab701d9d6139..987868fd194a 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesListContainersSegmentResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesListContainersSegmentResponse.java @@ -29,7 +29,7 @@ public ServicesListContainersSegmentResponse(HttpRequest request, int statusCode * @return the deserialized response body. */ @Override - public ListContainersSegmentResponse value() { - return super.value(); + public ListContainersSegmentResponse getValue() { + return super.getValue(); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesSubmitBatchResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesSubmitBatchResponse.java new file mode 100644 index 000000000000..06b222204d05 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesSubmitBatchResponse.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import java.io.Closeable; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; + +/** + * Contains all response data for the submitBatch operation. + */ +public final class ServicesSubmitBatchResponse extends ResponseBase> implements Closeable { + /** + * Creates an instance of ServicesSubmitBatchResponse. + * + * @param request the request which resulted in this ServicesSubmitBatchResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the content stream. + * @param headers the deserialized headers of the HTTP response. + */ + public ServicesSubmitBatchResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Flux value, ServiceSubmitBatchHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * @return the response content stream. + */ + @Override + public Flux getValue() { + return super.getValue(); + } + + /** + * Disposes of the connection associated with this stream response. + */ + @Override + public void close() { + getValue().subscribe(bb -> { }, t -> { }).dispose(); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SignedIdentifier.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SignedIdentifier.java index 63e3aea5e584..a7f707384e89 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SignedIdentifier.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SignedIdentifier.java @@ -31,7 +31,7 @@ public final class SignedIdentifier { * * @return the id value. */ - public String id() { + public String getId() { return this.id; } @@ -41,7 +41,7 @@ public String id() { * @param id the id value to set. * @return the SignedIdentifier object itself. */ - public SignedIdentifier id(String id) { + public SignedIdentifier setId(String id) { this.id = id; return this; } @@ -51,7 +51,7 @@ public SignedIdentifier id(String id) { * * @return the accessPolicy value. */ - public AccessPolicy accessPolicy() { + public AccessPolicy getAccessPolicy() { return this.accessPolicy; } @@ -61,7 +61,7 @@ public AccessPolicy accessPolicy() { * @param accessPolicy the accessPolicy value to set. * @return the SignedIdentifier object itself. */ - public SignedIdentifier accessPolicy(AccessPolicy accessPolicy) { + public SignedIdentifier setAccessPolicy(AccessPolicy accessPolicy) { this.accessPolicy = accessPolicy; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SourceModifiedAccessConditions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SourceModifiedAccessConditions.java index 9874a3b9557e..377927bc03db 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SourceModifiedAccessConditions.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SourceModifiedAccessConditions.java @@ -49,11 +49,11 @@ public final class SourceModifiedAccessConditions { * * @return the sourceIfModifiedSince value. */ - public OffsetDateTime sourceIfModifiedSince() { + public OffsetDateTime getSourceIfModifiedSince() { if (this.sourceIfModifiedSince == null) { return null; } - return this.sourceIfModifiedSince.dateTime(); + return this.sourceIfModifiedSince.getDateTime(); } /** @@ -64,7 +64,7 @@ public OffsetDateTime sourceIfModifiedSince() { * @param sourceIfModifiedSince the sourceIfModifiedSince value to set. * @return the SourceModifiedAccessConditions object itself. */ - public SourceModifiedAccessConditions sourceIfModifiedSince(OffsetDateTime sourceIfModifiedSince) { + public SourceModifiedAccessConditions setSourceIfModifiedSince(OffsetDateTime sourceIfModifiedSince) { if (sourceIfModifiedSince == null) { this.sourceIfModifiedSince = null; } else { @@ -80,11 +80,11 @@ public SourceModifiedAccessConditions sourceIfModifiedSince(OffsetDateTime sourc * * @return the sourceIfUnmodifiedSince value. */ - public OffsetDateTime sourceIfUnmodifiedSince() { + public OffsetDateTime getSourceIfUnmodifiedSince() { if (this.sourceIfUnmodifiedSince == null) { return null; } - return this.sourceIfUnmodifiedSince.dateTime(); + return this.sourceIfUnmodifiedSince.getDateTime(); } /** @@ -95,7 +95,7 @@ public OffsetDateTime sourceIfUnmodifiedSince() { * @param sourceIfUnmodifiedSince the sourceIfUnmodifiedSince value to set. * @return the SourceModifiedAccessConditions object itself. */ - public SourceModifiedAccessConditions sourceIfUnmodifiedSince(OffsetDateTime sourceIfUnmodifiedSince) { + public SourceModifiedAccessConditions setSourceIfUnmodifiedSince(OffsetDateTime sourceIfUnmodifiedSince) { if (sourceIfUnmodifiedSince == null) { this.sourceIfUnmodifiedSince = null; } else { @@ -110,7 +110,7 @@ public SourceModifiedAccessConditions sourceIfUnmodifiedSince(OffsetDateTime sou * * @return the sourceIfMatch value. */ - public String sourceIfMatch() { + public String getSourceIfMatch() { return this.sourceIfMatch; } @@ -121,7 +121,7 @@ public String sourceIfMatch() { * @param sourceIfMatch the sourceIfMatch value to set. * @return the SourceModifiedAccessConditions object itself. */ - public SourceModifiedAccessConditions sourceIfMatch(String sourceIfMatch) { + public SourceModifiedAccessConditions setSourceIfMatch(String sourceIfMatch) { this.sourceIfMatch = sourceIfMatch; return this; } @@ -132,7 +132,7 @@ public SourceModifiedAccessConditions sourceIfMatch(String sourceIfMatch) { * * @return the sourceIfNoneMatch value. */ - public String sourceIfNoneMatch() { + public String getSourceIfNoneMatch() { return this.sourceIfNoneMatch; } @@ -143,7 +143,7 @@ public String sourceIfNoneMatch() { * @param sourceIfNoneMatch the sourceIfNoneMatch value to set. * @return the SourceModifiedAccessConditions object itself. */ - public SourceModifiedAccessConditions sourceIfNoneMatch(String sourceIfNoneMatch) { + public SourceModifiedAccessConditions setSourceIfNoneMatch(String sourceIfNoneMatch) { this.sourceIfNoneMatch = sourceIfNoneMatch; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StaticWebsite.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StaticWebsite.java index 91fffc8ba4bc..aa8e5bb50ce2 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StaticWebsite.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StaticWebsite.java @@ -38,7 +38,7 @@ public final class StaticWebsite { * * @return the enabled value. */ - public boolean enabled() { + public boolean isEnabled() { return this.enabled; } @@ -49,7 +49,7 @@ public boolean enabled() { * @param enabled the enabled value to set. * @return the StaticWebsite object itself. */ - public StaticWebsite enabled(boolean enabled) { + public StaticWebsite setEnabled(boolean enabled) { this.enabled = enabled; return this; } @@ -60,7 +60,7 @@ public StaticWebsite enabled(boolean enabled) { * * @return the indexDocument value. */ - public String indexDocument() { + public String getIndexDocument() { return this.indexDocument; } @@ -71,7 +71,7 @@ public String indexDocument() { * @param indexDocument the indexDocument value to set. * @return the StaticWebsite object itself. */ - public StaticWebsite indexDocument(String indexDocument) { + public StaticWebsite setIndexDocument(String indexDocument) { this.indexDocument = indexDocument; return this; } @@ -82,7 +82,7 @@ public StaticWebsite indexDocument(String indexDocument) { * * @return the errorDocument404Path value. */ - public String errorDocument404Path() { + public String getErrorDocument404Path() { return this.errorDocument404Path; } @@ -93,7 +93,7 @@ public String errorDocument404Path() { * @param errorDocument404Path the errorDocument404Path value to set. * @return the StaticWebsite object itself. */ - public StaticWebsite errorDocument404Path(String errorDocument404Path) { + public StaticWebsite setErrorDocument404Path(String errorDocument404Path) { this.errorDocument404Path = errorDocument404Path; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageAccountInfo.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageAccountInfo.java index 15e0d910c9d7..d019752ac029 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageAccountInfo.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageAccountInfo.java @@ -1,33 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. package com.azure.storage.blob.models; public class StorageAccountInfo { - private final SkuName skuName; - private final AccountKind accountKind; - public StorageAccountInfo(BlobGetAccountInfoHeaders generatedResponseHeaders) { - this.skuName = generatedResponseHeaders.skuName(); - this.accountKind = generatedResponseHeaders.accountKind(); + this.skuName = generatedResponseHeaders.getSkuName(); + this.accountKind = generatedResponseHeaders.getAccountKind(); } public StorageAccountInfo(ContainerGetAccountInfoHeaders generatedResponseHeaders) { - this.skuName = generatedResponseHeaders.skuName(); - this.accountKind = generatedResponseHeaders.accountKind(); + this.skuName = generatedResponseHeaders.getSkuName(); + this.accountKind = generatedResponseHeaders.getAccountKind(); } public StorageAccountInfo(ServiceGetAccountInfoHeaders generatedResponseHeaders) { - this.skuName = generatedResponseHeaders.skuName(); - this.accountKind = generatedResponseHeaders.accountKind(); + this.skuName = generatedResponseHeaders.getSkuName(); + this.accountKind = generatedResponseHeaders.getAccountKind(); } - - public SkuName skuName() { + /** + * @return the SKU of the account + */ + public SkuName getSkuName() { return skuName; } - public AccountKind accountKind() { + /** + * @return the type of the account + */ + public AccountKind getAccountKind() { return accountKind; } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageError.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageError.java index 2f8f01f4f6f9..ab1f1904ad9e 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageError.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageError.java @@ -14,44 +14,18 @@ @JacksonXmlRootElement(localName = "StorageError") @Fluent public final class StorageError { - /* - * The code property. - */ - @JsonProperty(value = "Code") - private String code; - /* * The message property. */ @JsonProperty(value = "Message") private String message; - /** - * Get the code property: The code property. - * - * @return the code value. - */ - public String code() { - return this.code; - } - - /** - * Set the code property: The code property. - * - * @param code the code value to set. - * @return the StorageError object itself. - */ - public StorageError code(String code) { - this.code = code; - return this; - } - /** * Get the message property: The message property. * * @return the message value. */ - public String message() { + public String getMessage() { return this.message; } @@ -61,7 +35,7 @@ public String message() { * @param message the message value to set. * @return the StorageError object itself. */ - public StorageError message(String message) { + public StorageError setMessage(String message) { this.message = message; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageErrorException.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageErrorException.java index 11303394c211..0e19203331c6 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageErrorException.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageErrorException.java @@ -33,7 +33,7 @@ public StorageErrorException(String message, HttpResponse response, StorageError } @Override - public StorageError value() { - return (StorageError) super.value(); + public StorageError getValue() { + return (StorageError) super.getValue(); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageException.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageException.java new file mode 100644 index 000000000000..44dadbe0f9ec --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageException.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob.models; + +import com.azure.core.exception.HttpResponseException; + +/** + * A {@code StorageException} is thrown whenever Azure Storage successfully returns an error code that is not 200-level. + * Users can inspect the status code and error code to determine the cause of the error response. The exception message + * may also contain more detailed information depending on the type of error. The user may also inspect the raw HTTP + * response or call toString to get the full payload of the error response if present. + * Note that even some expected "errors" will be thrown as a {@code StorageException}. For example, some users may + * perform a getProperties request on an entity to determine whether it exists or not. If it does not exists, an + * exception will be thrown even though this may be considered an expected indication of absence in this case. + * + *

    Sample Code

    + *

    For more samples, please see the sample file

    + */ +public final class StorageException extends HttpResponseException { + private static final String ERROR_CODE = "x-ms-error-code"; + + private final StorageErrorCode errorCode; + private final String message; + + /** + * Constructs a {@code StorageException} from the given {@link StorageErrorException}. + * + * @param e The StorageErrorException returned from the service. + * @param responseBody The exception body. + */ + public StorageException(StorageErrorException e, String responseBody) { + super(e.getMessage(), e.getResponse(), e); + this.errorCode = StorageErrorCode.fromString(e.getResponse().getHeaders().value(ERROR_CODE)); + this.message = responseBody; + } + + /** + * @return The error code returned by the service. + */ + public StorageErrorCode getErrorCode() { + return this.errorCode; + } + + /** + * @return The message returned by the service. + */ + public String getServiceMessage() { + return this.message; + } + + /** + * @return The status code on the response. + */ + public int getStatusCode() { + return super.getResponse().getStatusCode(); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageServiceProperties.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageServiceProperties.java index a83c072fcce9..90d3863e8a22 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageServiceProperties.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageServiceProperties.java @@ -77,7 +77,7 @@ private CorsWrapper(@JacksonXmlProperty(localName = "CorsRule") List i * * @return the logging value. */ - public Logging logging() { + public Logging getLogging() { return this.logging; } @@ -87,7 +87,7 @@ public Logging logging() { * @param logging the logging value to set. * @return the StorageServiceProperties object itself. */ - public StorageServiceProperties logging(Logging logging) { + public StorageServiceProperties setLogging(Logging logging) { this.logging = logging; return this; } @@ -97,7 +97,7 @@ public StorageServiceProperties logging(Logging logging) { * * @return the hourMetrics value. */ - public Metrics hourMetrics() { + public Metrics getHourMetrics() { return this.hourMetrics; } @@ -107,7 +107,7 @@ public Metrics hourMetrics() { * @param hourMetrics the hourMetrics value to set. * @return the StorageServiceProperties object itself. */ - public StorageServiceProperties hourMetrics(Metrics hourMetrics) { + public StorageServiceProperties setHourMetrics(Metrics hourMetrics) { this.hourMetrics = hourMetrics; return this; } @@ -117,7 +117,7 @@ public StorageServiceProperties hourMetrics(Metrics hourMetrics) { * * @return the minuteMetrics value. */ - public Metrics minuteMetrics() { + public Metrics getMinuteMetrics() { return this.minuteMetrics; } @@ -127,7 +127,7 @@ public Metrics minuteMetrics() { * @param minuteMetrics the minuteMetrics value to set. * @return the StorageServiceProperties object itself. */ - public StorageServiceProperties minuteMetrics(Metrics minuteMetrics) { + public StorageServiceProperties setMinuteMetrics(Metrics minuteMetrics) { this.minuteMetrics = minuteMetrics; return this; } @@ -137,7 +137,7 @@ public StorageServiceProperties minuteMetrics(Metrics minuteMetrics) { * * @return the cors value. */ - public List cors() { + public List getCors() { if (this.cors == null) { this.cors = new CorsWrapper(new ArrayList()); } @@ -150,7 +150,7 @@ public List cors() { * @param cors the cors value to set. * @return the StorageServiceProperties object itself. */ - public StorageServiceProperties cors(List cors) { + public StorageServiceProperties setCors(List cors) { this.cors = new CorsWrapper(cors); return this; } @@ -163,7 +163,7 @@ public StorageServiceProperties cors(List cors) { * * @return the defaultServiceVersion value. */ - public String defaultServiceVersion() { + public String getDefaultServiceVersion() { return this.defaultServiceVersion; } @@ -176,7 +176,7 @@ public String defaultServiceVersion() { * @param defaultServiceVersion the defaultServiceVersion value to set. * @return the StorageServiceProperties object itself. */ - public StorageServiceProperties defaultServiceVersion(String defaultServiceVersion) { + public StorageServiceProperties setDefaultServiceVersion(String defaultServiceVersion) { this.defaultServiceVersion = defaultServiceVersion; return this; } @@ -187,7 +187,7 @@ public StorageServiceProperties defaultServiceVersion(String defaultServiceVersi * * @return the deleteRetentionPolicy value. */ - public RetentionPolicy deleteRetentionPolicy() { + public RetentionPolicy getDeleteRetentionPolicy() { return this.deleteRetentionPolicy; } @@ -198,7 +198,7 @@ public RetentionPolicy deleteRetentionPolicy() { * @param deleteRetentionPolicy the deleteRetentionPolicy value to set. * @return the StorageServiceProperties object itself. */ - public StorageServiceProperties deleteRetentionPolicy(RetentionPolicy deleteRetentionPolicy) { + public StorageServiceProperties setDeleteRetentionPolicy(RetentionPolicy deleteRetentionPolicy) { this.deleteRetentionPolicy = deleteRetentionPolicy; return this; } @@ -208,7 +208,7 @@ public StorageServiceProperties deleteRetentionPolicy(RetentionPolicy deleteRete * * @return the staticWebsite value. */ - public StaticWebsite staticWebsite() { + public StaticWebsite getStaticWebsite() { return this.staticWebsite; } @@ -218,7 +218,7 @@ public StaticWebsite staticWebsite() { * @param staticWebsite the staticWebsite value to set. * @return the StorageServiceProperties object itself. */ - public StorageServiceProperties staticWebsite(StaticWebsite staticWebsite) { + public StorageServiceProperties setStaticWebsite(StaticWebsite staticWebsite) { this.staticWebsite = staticWebsite; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageServiceStats.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageServiceStats.java index 04dd8dfc94dd..a4896902dfc1 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageServiceStats.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageServiceStats.java @@ -25,7 +25,7 @@ public final class StorageServiceStats { * * @return the geoReplication value. */ - public GeoReplication geoReplication() { + public GeoReplication getGeoReplication() { return this.geoReplication; } @@ -35,7 +35,7 @@ public GeoReplication geoReplication() { * @param geoReplication the geoReplication value to set. * @return the StorageServiceStats object itself. */ - public StorageServiceStats geoReplication(GeoReplication geoReplication) { + public StorageServiceStats setGeoReplication(GeoReplication geoReplication) { this.geoReplication = geoReplication; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Tag.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Tag.java new file mode 100644 index 000000000000..121da3ef84ba --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Tag.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.storage.blob.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * Represents a single user-provided tag. + */ +@JacksonXmlRootElement(localName = "Tag") +@Fluent +public final class Tag { + /* + * The tag name. + */ + @JsonProperty(value = "Key", required = true) + private String key; + + /* + * The tag value. + */ + @JsonProperty(value = "Value", required = true) + private String value; + + /** + * Get the key property: The tag name. + * + * @return the key value. + */ + public String key() { + return this.key; + } + + /** + * Set the key property: The tag name. + * + * @param key the key value to set. + * @return the Tag object itself. + */ + public Tag key(String key) { + this.key = key; + return this; + } + + /** + * Get the value property: The tag value. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The tag value. + * + * @param value the value value to set. + * @return the Tag object itself. + */ + public Tag value(String value) { + this.value = value; + return this; + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/UserDelegationKey.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/UserDelegationKey.java index 7598fd90340d..b3ff90d9d91d 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/UserDelegationKey.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/UserDelegationKey.java @@ -63,7 +63,7 @@ public final class UserDelegationKey { * * @return the signedOid value. */ - public String signedOid() { + public String getSignedOid() { return this.signedOid; } @@ -74,7 +74,7 @@ public String signedOid() { * @param signedOid the signedOid value to set. * @return the UserDelegationKey object itself. */ - public UserDelegationKey signedOid(String signedOid) { + public UserDelegationKey setSignedOid(String signedOid) { this.signedOid = signedOid; return this; } @@ -85,7 +85,7 @@ public UserDelegationKey signedOid(String signedOid) { * * @return the signedTid value. */ - public String signedTid() { + public String getSignedTid() { return this.signedTid; } @@ -96,7 +96,7 @@ public String signedTid() { * @param signedTid the signedTid value to set. * @return the UserDelegationKey object itself. */ - public UserDelegationKey signedTid(String signedTid) { + public UserDelegationKey setSignedTid(String signedTid) { this.signedTid = signedTid; return this; } @@ -106,7 +106,7 @@ public UserDelegationKey signedTid(String signedTid) { * * @return the signedStart value. */ - public OffsetDateTime signedStart() { + public OffsetDateTime getSignedStart() { return this.signedStart; } @@ -116,7 +116,7 @@ public OffsetDateTime signedStart() { * @param signedStart the signedStart value to set. * @return the UserDelegationKey object itself. */ - public UserDelegationKey signedStart(OffsetDateTime signedStart) { + public UserDelegationKey setSignedStart(OffsetDateTime signedStart) { this.signedStart = signedStart; return this; } @@ -126,7 +126,7 @@ public UserDelegationKey signedStart(OffsetDateTime signedStart) { * * @return the signedExpiry value. */ - public OffsetDateTime signedExpiry() { + public OffsetDateTime getSignedExpiry() { return this.signedExpiry; } @@ -136,7 +136,7 @@ public OffsetDateTime signedExpiry() { * @param signedExpiry the signedExpiry value to set. * @return the UserDelegationKey object itself. */ - public UserDelegationKey signedExpiry(OffsetDateTime signedExpiry) { + public UserDelegationKey setSignedExpiry(OffsetDateTime signedExpiry) { this.signedExpiry = signedExpiry; return this; } @@ -147,7 +147,7 @@ public UserDelegationKey signedExpiry(OffsetDateTime signedExpiry) { * * @return the signedService value. */ - public String signedService() { + public String getSignedService() { return this.signedService; } @@ -158,7 +158,7 @@ public String signedService() { * @param signedService the signedService value to set. * @return the UserDelegationKey object itself. */ - public UserDelegationKey signedService(String signedService) { + public UserDelegationKey setSignedService(String signedService) { this.signedService = signedService; return this; } @@ -169,7 +169,7 @@ public UserDelegationKey signedService(String signedService) { * * @return the signedVersion value. */ - public String signedVersion() { + public String getSignedVersion() { return this.signedVersion; } @@ -180,7 +180,7 @@ public String signedVersion() { * @param signedVersion the signedVersion value to set. * @return the UserDelegationKey object itself. */ - public UserDelegationKey signedVersion(String signedVersion) { + public UserDelegationKey setSignedVersion(String signedVersion) { this.signedVersion = signedVersion; return this; } @@ -190,7 +190,7 @@ public UserDelegationKey signedVersion(String signedVersion) { * * @return the value value. */ - public String value() { + public String getValue() { return this.value; } @@ -200,7 +200,7 @@ public String value() { * @param value the value value to set. * @return the UserDelegationKey object itself. */ - public UserDelegationKey value(String value) { + public UserDelegationKey setValue(String value) { this.value = value; return this; } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AppendBlobAsyncClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AppendBlobAsyncClientJavaDocCodeSnippets.java new file mode 100644 index 000000000000..839e07fada36 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AppendBlobAsyncClientJavaDocCodeSnippets.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +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.BlobRange; +import com.azure.storage.blob.models.LeaseAccessConditions; +import com.azure.storage.blob.models.Metadata; +import com.azure.storage.blob.models.ModifiedAccessConditions; +import com.azure.storage.blob.models.SourceModifiedAccessConditions; +import reactor.core.publisher.Flux; + +import java.io.UnsupportedEncodingException; +import java.net.URL; +import java.nio.ByteBuffer; +import java.time.OffsetDateTime; +import java.util.Collections; + +/** + * Code snippets for {@link AppendBlobAsyncClient} + */ +public class AppendBlobAsyncClientJavaDocCodeSnippets { + private AppendBlobAsyncClient client = JavaDocCodeSnippetsHelpers.getBlobAsyncClient("blobName") + .asAppendBlobAsyncClient(); + private String leaseId = "leaseId"; + private Flux data = Flux.just(ByteBuffer.wrap("data".getBytes("UTF-8"))); + private long length = 4L; + private static final Long POSITION = null; + private Long maxSize = length; + private URL sourceUrl = JavaDocCodeSnippetsHelpers.generateURL("https://example.com"); + private long offset = 1024; + private long count = 1024; + + /** + * + * @throws UnsupportedEncodingException if cannot get bytes from sample sting as utf-8 encoding + */ + AppendBlobAsyncClientJavaDocCodeSnippets() throws UnsupportedEncodingException { + } + + /** + * Code snippet for {@link AppendBlobAsyncClient#create()} + */ + public void create() { + // BEGIN: com.azure.storage.blob.AppendBlobAsyncClient.create + client.create().subscribe(response -> + System.out.printf("Created AppendBlob at %s%n", response.getLastModified())); + // END: com.azure.storage.blob.AppendBlobAsyncClient.create + } + + /** + * Code snippet for {@link AppendBlobAsyncClient#createWithResponse(BlobHTTPHeaders, Metadata, BlobAccessConditions)} + */ + public void create2() { + // BEGIN: com.azure.storage.blob.AppendBlobAsyncClient.createWithResponse#BlobHTTPHeaders-Metadata-BlobAccessConditions + BlobHTTPHeaders headers = new BlobHTTPHeaders() + .setBlobContentType("binary") + .setBlobContentLanguage("en-US"); + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + BlobAccessConditions accessConditions = new BlobAccessConditions() + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3))); + + client.createWithResponse(headers, metadata, accessConditions).subscribe(response -> + System.out.printf("Created AppendBlob at %s%n", response.getValue().getLastModified())); + // END: com.azure.storage.blob.AppendBlobAsyncClient.createWithResponse#BlobHTTPHeaders-Metadata-BlobAccessConditions + } + + /** + * Code snippet for {@link AppendBlobAsyncClient#appendBlock(Flux, long)} + */ + public void appendBlock() { + // BEGIN: com.azure.storage.blob.AppendBlobAsyncClient.appendBlock#Flux-long + client.appendBlock(data, length).subscribe(response -> + System.out.printf("AppendBlob has %d committed blocks%n", response.getBlobCommittedBlockCount())); + // END: com.azure.storage.blob.AppendBlobAsyncClient.appendBlock#Flux-long + } + + /** + * Code snippet for {@link AppendBlobAsyncClient#appendBlockWithResponse(Flux, long, AppendBlobAccessConditions)} + */ + public void appendBlock2() { + // BEGIN: com.azure.storage.blob.AppendBlobAsyncClient.appendBlockWithResponse#Flux-long-AppendBlobAccessConditions + AppendBlobAccessConditions accessConditions = new AppendBlobAccessConditions() + .setAppendPositionAccessConditions(new AppendPositionAccessConditions() + .setAppendPosition(POSITION) + .setMaxSize(maxSize)); + + client.appendBlockWithResponse(data, length, accessConditions).subscribe(response -> + System.out.printf("AppendBlob has %d committed blocks%n", response.getValue().getBlobCommittedBlockCount())); + // END: com.azure.storage.blob.AppendBlobAsyncClient.appendBlockWithResponse#Flux-long-AppendBlobAccessConditions + } + + /** + * Code snippet for {@link AppendBlobAsyncClient#appendBlockFromUrl(URL, BlobRange)} + */ + public void appendBlockFromUrl() { + // BEGIN: com.azure.storage.blob.AppendBlobAsyncClient.appendBlockFromUrl#URL-BlobRange + client.appendBlockFromUrl(sourceUrl, new BlobRange(offset, count)).subscribe(response -> + System.out.printf("AppendBlob has %d committed blocks%n", response.getBlobCommittedBlockCount())); + // END: com.azure.storage.blob.AppendBlobAsyncClient.appendBlockFromUrl#URL-BlobRange + } + + /** + * Code snippet for {@link AppendBlobAsyncClient#appendBlockFromUrlWithResponse(URL, BlobRange, byte[], AppendBlobAccessConditions, SourceModifiedAccessConditions)} + */ + public void appendBlockFromUrl2() { + // BEGIN: com.azure.storage.blob.AppendBlobAsyncClient.appendBlockFromUrlWithResponse#URL-BlobRange-byte-AppendBlobAccessConditions-SourceModifiedAccessConditions + AppendBlobAccessConditions appendBlobAccessConditions = new AppendBlobAccessConditions() + .setAppendPositionAccessConditions(new AppendPositionAccessConditions() + .setAppendPosition(POSITION) + .setMaxSize(maxSize)); + + SourceModifiedAccessConditions modifiedAccessConditions = new SourceModifiedAccessConditions() + .setSourceIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + client.appendBlockFromUrlWithResponse(sourceUrl, new BlobRange(offset, count), null, + appendBlobAccessConditions, modifiedAccessConditions).subscribe(response -> + System.out.printf("AppendBlob has %d committed blocks%n", response.getValue().getBlobCommittedBlockCount())); + // END: com.azure.storage.blob.AppendBlobAsyncClient.appendBlockFromUrlWithResponse#URL-BlobRange-byte-AppendBlobAccessConditions-SourceModifiedAccessConditions + } +} diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AppendBlobClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AppendBlobClientJavaDocCodeSnippets.java new file mode 100644 index 000000000000..79983fddc7a0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AppendBlobClientJavaDocCodeSnippets.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +import com.azure.core.util.Context; + +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.BlobRange; +import com.azure.storage.blob.models.LeaseAccessConditions; +import com.azure.storage.blob.models.Metadata; +import com.azure.storage.blob.models.ModifiedAccessConditions; +import com.azure.storage.blob.models.SourceModifiedAccessConditions; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.net.URL; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Collections; + +/** + * Code snippets for {@link AppendBlobClient} + */ +public class AppendBlobClientJavaDocCodeSnippets { + + private AppendBlobClient client = JavaDocCodeSnippetsHelpers.getBlobClient("blobName") + .asAppendBlobClient(); + private Duration timeout = Duration.ofSeconds(30); + private String leaseId = "leaseId"; + private InputStream data = new ByteArrayInputStream("data".getBytes("UTF-8")); + private long length = 4L; + private static final Long POSITION = null; + private Long maxSize = length; + private URL sourceUrl = JavaDocCodeSnippetsHelpers.generateURL("https://example.com"); + private long offset = 1024; + private long count = 1024; + + /** + * @throws UnsupportedEncodingException if cannot get bytes from sample sting as utf-8 encoding + */ + AppendBlobClientJavaDocCodeSnippets() throws UnsupportedEncodingException { + } + + /** + * Code snippet for {@link AppendBlobClient#create()} + */ + public void setCreate() { + // BEGIN: com.azure.storage.blob.AppendBlobClient.create + System.out.printf("Created AppendBlob at %s%n", client.create().getLastModified()); + // END: com.azure.storage.blob.AppendBlobClient.create + } + + /** + * Code snippet for {@link AppendBlobClient#create(BlobHTTPHeaders, Metadata, BlobAccessConditions, Duration)} + */ + public void create2() { + // BEGIN: com.azure.storage.blob.AppendBlobClient.create#BlobHTTPHeaders-Metadata-BlobAccessConditions-Duration + BlobHTTPHeaders headers = new BlobHTTPHeaders() + .setBlobContentType("binary") + .setBlobContentLanguage("en-US"); + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + BlobAccessConditions accessConditions = new BlobAccessConditions() + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3))); + + System.out.printf("Created AppendBlob at %s%n", + client.create(headers, metadata, accessConditions, timeout).getLastModified()); + // END: com.azure.storage.blob.AppendBlobClient.create#BlobHTTPHeaders-Metadata-BlobAccessConditions-Duration + } + + /** + * Code snippet for {@link AppendBlobClient#createWithResponse(BlobHTTPHeaders, Metadata, BlobAccessConditions, + * Duration, Context)} + */ + public void create3() { + // BEGIN: com.azure.storage.blob.AppendBlobClient.createWithResponse#BlobHTTPHeaders-Metadata-BlobAccessConditions-Duration-Context + BlobHTTPHeaders headers = new BlobHTTPHeaders() + .setBlobContentType("binary") + .setBlobContentLanguage("en-US"); + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + BlobAccessConditions accessConditions = new BlobAccessConditions() + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3))); + Context context = new Context("key", "value"); + + System.out.printf("Created AppendBlob at %s%n", + client.createWithResponse(headers, metadata, accessConditions, timeout, context).getValue().getLastModified()); + // END: com.azure.storage.blob.AppendBlobClient.createWithResponse#BlobHTTPHeaders-Metadata-BlobAccessConditions-Duration-Context + } + + /** + * Code snippet for {@link AppendBlobClient#appendBlock(InputStream, long)} + */ + public void appendBlock() { + // BEGIN: com.azure.storage.blob.AppendBlobClient.appendBlock#InputStream-long + System.out.printf("AppendBlob has %d committed blocks%n", + client.appendBlock(data, length).getBlobCommittedBlockCount()); + // END: com.azure.storage.blob.AppendBlobClient.appendBlock#InputStream-long + } + + /** + * Code snippet for {@link AppendBlobClient#appendBlockWithResponse(InputStream, long, AppendBlobAccessConditions, + * Duration, Context)} + */ + public void appendBlock2() { + // BEGIN: com.azure.storage.blob.AppendBlobClient.appendBlockWithResponse#InputStream-long-AppendBlobAccessConditions-Duration-Context + AppendBlobAccessConditions accessConditions = new AppendBlobAccessConditions() + .setAppendPositionAccessConditions(new AppendPositionAccessConditions() + .setAppendPosition(POSITION) + .setMaxSize(maxSize)); + Context context = new Context("key", "value"); + + System.out.printf("AppendBlob has %d committed blocks%n", + client.appendBlockWithResponse(data, length, accessConditions, timeout, + context).getValue().getBlobCommittedBlockCount()); + // END: com.azure.storage.blob.AppendBlobClient.appendBlockWithResponse#InputStream-long-AppendBlobAccessConditions-Duration-Context + } + + /** + * Code snippet for {@link AppendBlobClient#appendBlockFromUrl(URL, BlobRange)} + */ + public void appendBlockFromUrl() { + // BEGIN: com.azure.storage.blob.AppendBlobClient.appendBlockFromUrl#URL-BlobRange + System.out.printf("AppendBlob has %d committed blocks%n", + client.appendBlockFromUrl(sourceUrl, new BlobRange(offset, count)).getBlobCommittedBlockCount()); + // END: com.azure.storage.blob.AppendBlobClient.appendBlockFromUrl#URL-BlobRange + } + + /** + * Code snippet for {@link AppendBlobClient#appendBlockFromUrl(URL, BlobRange, byte[], AppendBlobAccessConditions, + * SourceModifiedAccessConditions, Duration)} + */ + public void appendBlockFromUrl2() { + // BEGIN: com.azure.storage.blob.AppendBlobClient.appendBlockFromUrl#URL-BlobRange-byte-AppendBlobAccessConditions-SourceModifiedAccessConditions-Duration + AppendBlobAccessConditions appendBlobAccessConditions = new AppendBlobAccessConditions() + .setAppendPositionAccessConditions(new AppendPositionAccessConditions() + .setAppendPosition(POSITION) + .setMaxSize(maxSize)); + + SourceModifiedAccessConditions modifiedAccessConditions = new SourceModifiedAccessConditions() + .setSourceIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + System.out.printf("AppendBlob has %d committed blocks%n", + client.appendBlockFromUrl(sourceUrl, new BlobRange(offset, count), null, + appendBlobAccessConditions, modifiedAccessConditions, timeout).getBlobCommittedBlockCount()); + // END: com.azure.storage.blob.AppendBlobClient.appendBlockFromUrl#URL-BlobRange-byte-AppendBlobAccessConditions-SourceModifiedAccessConditions-Duration + } + + /** + * Code snippet for {@link AppendBlobClient#appendBlockFromUrlWithResponse(URL, BlobRange, byte[], + * AppendBlobAccessConditions, SourceModifiedAccessConditions, Duration, Context)} + */ + public void appendBlockFromUrl3() { + // BEGIN: com.azure.storage.blob.AppendBlobClient.appendBlockFromUrlWithResponse#URL-BlobRange-byte-AppendBlobAccessConditions-SourceModifiedAccessConditions-Duration-Context + AppendBlobAccessConditions appendBlobAccessConditions = new AppendBlobAccessConditions() + .setAppendPositionAccessConditions(new AppendPositionAccessConditions() + .setAppendPosition(POSITION) + .setMaxSize(maxSize)); + + SourceModifiedAccessConditions modifiedAccessConditions = new SourceModifiedAccessConditions() + .setSourceIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + Context context = new Context("key", "value"); + + System.out.printf("AppendBlob has %d committed blocks%n", + client.appendBlockFromUrlWithResponse(sourceUrl, new BlobRange(offset, count), null, + appendBlobAccessConditions, modifiedAccessConditions, timeout, + context).getValue().getBlobCommittedBlockCount()); + // END: com.azure.storage.blob.AppendBlobClient.appendBlockFromUrlWithResponse#URL-BlobRange-byte-AppendBlobAccessConditions-SourceModifiedAccessConditions-Duration-Context + } +} diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AsyncBufferedUploadExample.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AsyncBufferedUploadExample.java new file mode 100644 index 000000000000..5c4478f45971 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AsyncBufferedUploadExample.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +import com.azure.storage.common.credentials.SharedKeyCredential; +import reactor.core.publisher.Flux; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.util.Locale; +import java.util.Random; + +/** + * This example shows how to use the buffered upload method on BlockBlobAsyncClient. + * + * Note that the use of .block() in the method is only used to enable the sample to run effectively in isolation. It is + * not recommended for use in async environments. + */ +public class AsyncBufferedUploadExample { + /** + * Entry point into the basic examples for Storage blobs. + * @param args Unused. Arguments to the program. + * @throws IOException If an I/O error occurs + * @throws RuntimeException If the downloaded data doesn't match the uploaded data + */ + public static void main(String[] args) throws IOException { + + /* + * For more information on this setup, please refer to the BasicExample. + */ + String accountName = SampleHelper.getAccountName(); + String accountKey = SampleHelper.getAccountKey(); + SharedKeyCredential credential = new SharedKeyCredential(accountName, accountKey); + String endpoint = String.format(Locale.ROOT, "https://%s.blob.core.windows.net", accountName); + String containerName = "myjavacontainerbufferedupload" + System.currentTimeMillis(); + BlobServiceAsyncClient storageClient = new BlobServiceClientBuilder().endpoint(endpoint).credential(credential) + .buildAsyncClient(); + + ContainerAsyncClient containerClient = storageClient.getContainerAsyncClient(containerName); + containerClient.create().block(); + + uploadSourceBlob(endpoint, credential, containerName); + BlockBlobAsyncClient blobClient = containerClient.getBlockBlobAsyncClient("HelloWorld.txt"); + + + /* + sourceData has a network stream as its source and therefore likely does not support multiple subscribers. Even + if it did support multiple subscribers, it would not produce the same data each time it was subscribed to. While + we could inspect the http headers for the content-length, let us suppose that this information is unavailable + at this time. All three of these factors would individually make the use of the standard upload method + impossible--the first two because retries would not work and the third one because we could not satisfy the + argument list. + */ + Flux sourceData = getSourceBlobClient(endpoint, credential, containerName).download() + .flatMapMany(flux -> flux) + // Perform some unpredicatable transformation. + .map(AsyncBufferedUploadExample::randomTransformation); + + /* + This upload overload permits the use of such unreliable data sources. The length need not be specified, but + the tradeoff is that data must be buffered, so a buffer size and number of buffers is required instead. The + Javadoc on the method will give more detailed information on the significance of these parameters, but they are + likely context dependent. + */ + int blockSize = 10 * 1024; + int numBuffers = 5; + blobClient.upload(sourceData, blockSize, numBuffers).block(); + } + + @SuppressWarnings("cast") + private static ByteBuffer randomTransformation(ByteBuffer buffer) { + // The JDK changed the return type of ByteBuffer#limit between 8 and 9. In 8 and below it returns Buffer, whereas + // in JDK 9 and later, it returns ByteBuffer. To compile on both, we explicitly cast the returned value to + // ByteBuffer. + // See https://bugs-stage.openjdk.java.net/browse/JDK-8062376 + return (ByteBuffer) buffer.limit(new Random().nextInt(buffer.limit())); + } + + private static void uploadSourceBlob(String endpoint, SharedKeyCredential credential, String containerName) { + getSourceBlobClient(endpoint, credential, containerName) + .upload(Flux.just(ByteBuffer.wrap("Hello world".getBytes(Charset.defaultCharset()))), "Hello world".length()).block(); + } + + private static BlockBlobAsyncClient getSourceBlobClient(String endpoint, SharedKeyCredential credential, + String containerName) { + return new BlobServiceClientBuilder().endpoint(endpoint).credential(credential).buildAsyncClient() + .getContainerAsyncClient(containerName).getBlockBlobAsyncClient("sourceBlob"); + } +} diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AzureIdentityExample.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AzureIdentityExample.java index 40794a0b9c6f..3168c4612034 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AzureIdentityExample.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AzureIdentityExample.java @@ -36,7 +36,7 @@ public static void main(String[] args) { .buildClient(); System.out.println("Successfully setup client using the Azure Identity, please check the service version: " - + storageClient.getProperties().value().defaultServiceVersion()); + + storageClient.getProperties().getDefaultServiceVersion()); } } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BasicExample.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BasicExample.java index c47e753b3f07..3283c0e51512 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BasicExample.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BasicExample.java @@ -9,8 +9,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; -import java.io.OutputStream; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.Locale; /** @@ -72,7 +72,7 @@ public static void main(String[] args) throws IOException { BlockBlobClient blobClient = containerClient.getBlockBlobClient("HelloWorld.txt"); String data = "Hello world!"; - InputStream dataStream = new ByteArrayInputStream(data.getBytes()); + InputStream dataStream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8)); /* * Create the blob with string (plain text) content. @@ -84,15 +84,15 @@ public static void main(String[] args) throws IOException { /* * Download the blob's content to output stream. */ - int dataSize = (int) blobClient.getProperties().value().blobSize(); - OutputStream outputStream = new ByteArrayOutputStream(dataSize); + int dataSize = (int) blobClient.getProperties().getBlobSize(); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(dataSize); blobClient.download(outputStream); outputStream.close(); /* * Verify that the blob data round-tripped correctly. */ - if (!data.equals(outputStream.toString())) { + if (!data.equals(new String(outputStream.toByteArray(), StandardCharsets.UTF_8))) { throw new RuntimeException("The downloaded data does not match the uploaded data."); } @@ -111,7 +111,7 @@ public static void main(String[] args) throws IOException { * List the blob(s) in our container. */ containerClient.listBlobsFlat() - .forEach(blobItem -> System.out.println("Blob name: " + blobItem.name() + ", Snapshot: " + blobItem.snapshot())); + .forEach(blobItem -> System.out.println("Blob name: " + blobItem.getName() + ", Snapshot: " + blobItem.getSnapshot())); /* * Delete the blob we created earlier. 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 54d5bc091850..d503b1427ec1 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 @@ -11,7 +11,12 @@ import com.azure.storage.blob.models.LeaseAccessConditions; import com.azure.storage.blob.models.Metadata; import com.azure.storage.blob.models.ModifiedAccessConditions; +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; @@ -36,81 +41,48 @@ public class BlobAsyncClientJavaDocCodeSnippets { */ public void existsCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.exists - client.exists().subscribe(response -> System.out.printf("Exists? %b%n", response.value())); + client.exists().subscribe(response -> System.out.printf("Exists? %b%n", response)); // END: com.azure.storage.blob.BlobAsyncClient.exists } /** - * Code snippets for {@link BlobAsyncClient#startCopyFromURL(URL)} and - * {@link BlobAsyncClient#startCopyFromURL(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions)} + * Code snippets for {@link BlobAsyncClient#startCopyFromURL(URL)} */ - public void startCopyFromURL() { + public void startCopyFromURLCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL client.startCopyFromURL(url) - .subscribe(response -> System.out.printf("Copy identifier: %s%n", response.value())); + .subscribe(response -> System.out.printf("Copy identifier: %s%n", response)); // END: com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL - - // BEGIN: com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions - Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); - ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() - .ifUnmodifiedSince(OffsetDateTime.now().minusDays(7)); - BlobAccessConditions blobAccessConditions = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); - - client.startCopyFromURL(url, metadata, modifiedAccessConditions, blobAccessConditions) - .subscribe(response -> System.out.printf("Copy identifier: %s%n", response.value())); - // END: com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#abortCopyFromURL(String)} and - * {@link BlobAsyncClient#abortCopyFromURL(String, LeaseAccessConditions)} + * Code snippets for {@link BlobAsyncClient#abortCopyFromURL(String)} */ - public void abortCopyFromURL() { + public void abortCopyFromURLCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.abortCopyFromURL#String - client.abortCopyFromURL(copyId) - .subscribe(response -> System.out.printf("Aborted copy completed with status %d%n", response.statusCode())); + client.abortCopyFromURL(copyId).doOnSuccess(response -> System.out.println("Aborted copy from URL")); // END: com.azure.storage.blob.BlobAsyncClient.abortCopyFromURL#String - - // BEGIN: com.azure.storage.blob.BlobAsyncClient.abortCopyFromURL#String-LeaseAccessConditions - LeaseAccessConditions leaseAccessConditions = new LeaseAccessConditions().leaseId(leaseId); - client.abortCopyFromURL(copyId, leaseAccessConditions) - .subscribe(response -> System.out.printf("Aborted copy completed with status %d%n", response.statusCode())); - // END: com.azure.storage.blob.BlobAsyncClient.abortCopyFromURL#String-LeaseAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#copyFromURL(URL)} and - * {@link BlobAsyncClient#copyFromURL(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions)} + * Code snippets for {@link BlobAsyncClient#copyFromURL(URL)} */ - public void copyFromURL() { + public void copyFromURLCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL - client.copyFromURL(url).subscribe(response -> System.out.printf("Copy identifier: %s%n", response.value())); + client.copyFromURL(url).subscribe(response -> System.out.printf("Copy identifier: %s%n", response)); // END: com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL - - // BEGIN: com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions - Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); - ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() - .ifUnmodifiedSince(OffsetDateTime.now().minusDays(7)); - BlobAccessConditions blobAccessConditions = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); - - client.copyFromURL(url, metadata, modifiedAccessConditions, blobAccessConditions) - .subscribe(response -> System.out.printf("Copy identifier: %s%n", response.value())); - // END: com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#download()} and - * {@link BlobAsyncClient#download(BlobRange, ReliableDownloadOptions, BlobAccessConditions, boolean)} + * Code snippets for {@link BlobAsyncClient#download()} * * @throws UncheckedIOException If an I/O error occurs */ - public void download() { + public void downloadCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.download client.download().subscribe(response -> { ByteArrayOutputStream downloadData = new ByteArrayOutputStream(); - response.value().subscribe(piece -> { + response.subscribe(piece -> { try { downloadData.write(piece.array()); } catch (IOException ex) { @@ -124,9 +96,9 @@ public void download() { BlobRange range = new BlobRange(1024, 2048L); ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5); - client.download(range, options, null, false).subscribe(response -> { + client.downloadWithResponse(range, options, null, false).subscribe(response -> { ByteArrayOutputStream downloadData = new ByteArrayOutputStream(); - response.value().subscribe(piece -> { + response.getValue().subscribe(piece -> { try { downloadData.write(piece.array()); } catch (IOException ex) { @@ -138,10 +110,10 @@ public void download() { } /** - * Code snippets for {@link BlobAsyncClient#downloadToFile(String)} and - * {@link BlobAsyncClient#downloadToFile(String, BlobRange, Integer, ReliableDownloadOptions, BlobAccessConditions, boolean)} + * Code snippets for {@link BlobAsyncClient#downloadToFile(String)} and {@link BlobAsyncClient#downloadToFile(String, + * BlobRange, Integer, ReliableDownloadOptions, BlobAccessConditions, boolean)} */ - public void downloadToFile() { + public void downloadToFileCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.downloadToFile#String client.downloadToFile(file).subscribe(response -> System.out.println("Completed download to file")); // END: com.azure.storage.blob.BlobAsyncClient.downloadToFile#String @@ -156,237 +128,456 @@ public void downloadToFile() { } /** - * Code snippets for {@link BlobAsyncClient#delete()} and - * {@link BlobAsyncClient#delete(DeleteSnapshotsOptionType, BlobAccessConditions)} + * Code snippets for {@link BlobAsyncClient#delete()} */ - public void delete() { + public void deleteCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.delete - client.delete() - .subscribe(response -> System.out.printf("Delete completed with status %d%n", response.statusCode())); + client.delete().doOnSuccess(response -> System.out.println("Completed delete")); // END: com.azure.storage.blob.BlobAsyncClient.delete - - // BEGIN: com.azure.storage.blob.BlobAsyncClient.delete#DeleteSnapshotsOptionType-BlobAccessConditions - client.delete(DeleteSnapshotsOptionType.INCLUDE, null) - .subscribe(response -> System.out.printf("Delete completed with status %d%n", response.statusCode())); - // END: com.azure.storage.blob.BlobAsyncClient.delete#DeleteSnapshotsOptionType-BlobAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#getProperties()} and - * {@link BlobAsyncClient#getProperties(BlobAccessConditions)} + * Code snippets for {@link BlobAsyncClient#getProperties()} */ - public void getProperties() { + public void getPropertiesCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.getProperties client.getProperties().subscribe(response -> - System.out.printf("Type: %s, Size: %d%n", response.value().blobType(), response.value().blobSize())); + System.out.printf("Type: %s, Size: %d%n", response.getBlobType(), response.getBlobSize())); // END: com.azure.storage.blob.BlobAsyncClient.getProperties - - // BEGIN: com.azure.storage.blob.BlobAsyncClient.getProperties#BlobAccessConditions - BlobAccessConditions accessConditions = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); - - client.getProperties(accessConditions).subscribe(response -> - System.out.printf("Type: %s, Size: %d%n", response.value().blobType(), response.value().blobSize())); - // END: com.azure.storage.blob.BlobAsyncClient.getProperties#BlobAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#setHTTPHeaders(BlobHTTPHeaders)} and - * {@link BlobAsyncClient#setHTTPHeaders(BlobHTTPHeaders, BlobAccessConditions)} + * Code snippets for {@link BlobAsyncClient#setHTTPHeaders(BlobHTTPHeaders)} */ - public void setHTTPHeaders() { + public void setHTTPHeadersCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.setHTTPHeaders#BlobHTTPHeaders client.setHTTPHeaders(new BlobHTTPHeaders() - .blobContentLanguage("en-US") - .blobContentType("binary")).subscribe(response -> - System.out.printf("Set HTTP headers completed with status %d%n", response.statusCode())); + .setBlobContentLanguage("en-US") + .setBlobContentType("binary")); // END: com.azure.storage.blob.BlobAsyncClient.setHTTPHeaders#BlobHTTPHeaders - - // BEGIN: com.azure.storage.blob.BlobAsyncClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions - BlobAccessConditions accessConditions = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); - - client.setHTTPHeaders(new BlobHTTPHeaders() - .blobContentLanguage("en-US") - .blobContentType("binary"), accessConditions).subscribe(response -> - System.out.printf("Set HTTP headers completed with status %d%n", response.statusCode())); - // END: com.azure.storage.blob.BlobAsyncClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#setMetadata(Metadata)} and - * {@link BlobAsyncClient#setMetadata(Metadata, BlobAccessConditions)} + * Code snippets for {@link BlobAsyncClient#setMetadata(Metadata)} */ - public void setMetadata() { + public void setMetadataCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.setMetadata#Metadata - client.setMetadata(new Metadata(Collections.singletonMap("metadata", "value"))) - .subscribe(response -> System.out.printf("Set metadata completed with status %d%n", response.statusCode())); + client.setMetadata(new Metadata(Collections.singletonMap("metadata", "value"))); // END: com.azure.storage.blob.BlobAsyncClient.setMetadata#Metadata - - // BEGIN: com.azure.storage.blob.BlobAsyncClient.setMetadata#Metadata-BlobAccessConditions - BlobAccessConditions accessConditions = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); - - client.setMetadata(new Metadata(Collections.singletonMap("metadata", "value")), accessConditions) - .subscribe(response -> System.out.printf("Set metadata completed with status %d%n", response.statusCode())); - // END: com.azure.storage.blob.BlobAsyncClient.setMetadata#Metadata-BlobAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#createSnapshot()} and - * {@link BlobAsyncClient#createSnapshot(Metadata, BlobAccessConditions)} + * Code snippets for {@link BlobAsyncClient#createSnapshot()} */ - public void createSnapshot() { + public void createSnapshotCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.createSnapshot client.createSnapshot() .subscribe(response -> System.out.printf("Identifier for the snapshot is %s%n", - response.value().getSnapshotId())); + response.getSnapshotId())); // END: com.azure.storage.blob.BlobAsyncClient.createSnapshot - - // BEGIN: com.azure.storage.blob.BlobAsyncClient.createSnapshot#Metadata-BlobAccessConditions - Metadata snapshotMetadata = new Metadata(Collections.singletonMap("metadata", "value")); - BlobAccessConditions accessConditions = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); - - client.createSnapshot(snapshotMetadata, accessConditions) - .subscribe(response -> System.out.printf("Identifier for the snapshot is %s%n", - response.value().getSnapshotId())); - // END: com.azure.storage.blob.BlobAsyncClient.createSnapshot#Metadata-BlobAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#setTier(AccessTier)} and - * {@link BlobAsyncClient#setTier(AccessTier, LeaseAccessConditions)} + * Code snippets for {@link BlobAsyncClient#setTier(AccessTier)} */ - public void setTier() { + public void setTierCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.setTier#AccessTier - client.setTier(AccessTier.HOT) - .subscribe(response -> System.out.printf("Set tier completed with status code %d%n", response.statusCode())); + client.setTier(AccessTier.HOT); // END: com.azure.storage.blob.BlobAsyncClient.setTier#AccessTier - - // BEGIN: com.azure.storage.blob.BlobAsyncClient.setTier#AccessTier-LeaseAccessConditions - LeaseAccessConditions accessConditions = new LeaseAccessConditions().leaseId(leaseId); - - client.setTier(AccessTier.HOT, accessConditions) - .subscribe(response -> System.out.printf("Set tier completed with status code %d%n", response.statusCode())); - // END: com.azure.storage.blob.BlobAsyncClient.setTier#AccessTier-LeaseAccessConditions } /** * Code snippet for {@link BlobAsyncClient#undelete()} */ - public void undelete() { + public void undeleteCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.undelete - client.undelete() - .subscribe(response -> System.out.printf("Undelete completed with status %d%n", response.statusCode())); + client.undelete().doOnSuccess(response -> System.out.println("Completed undelete")); // END: com.azure.storage.blob.BlobAsyncClient.undelete } /** - * Code snippets for {@link BlobAsyncClient#acquireLease(String, int)} and - * {@link BlobAsyncClient#acquireLease(String, int, ModifiedAccessConditions)} + * Code snippets for {@link BlobAsyncClient#acquireLease(String, int)} */ - public void acquireLease() { + public void acquireLeaseCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int client.acquireLease("proposedId", 60) - .subscribe(response -> System.out.printf("Lease ID is %s%n", response.value())); + .subscribe(response -> System.out.printf("Lease ID is %s%n", response)); // END: com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int - - // BEGIN: com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int-ModifiedAccessConditions - ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() - .ifModifiedSince(OffsetDateTime.now().minusDays(3)); - - client.acquireLease("proposedId", 60, modifiedAccessConditions) - .subscribe(response -> System.out.printf("Lease ID is %s%n", response.value())); - // END: com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int-ModifiedAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#renewLease(String)} and - * {@link BlobAsyncClient#renewLease(String, ModifiedAccessConditions)} + * Code snippets for {@link BlobAsyncClient#renewLease(String)} */ - public void renewLease() { + public void renewLeaseCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.renewLease#String client.renewLease(leaseId) - .subscribe(response -> System.out.printf("Renewed lease ID is %s%n", response.value())); + .subscribe(response -> System.out.printf("Renewed lease ID is %s%n", response)); // END: com.azure.storage.blob.BlobAsyncClient.renewLease#String - - // BEGIN: com.azure.storage.blob.BlobAsyncClient.renewLease#String-ModifiedAccessConditions - ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() - .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); - - client.renewLease(leaseId, modifiedAccessConditions) - .subscribe(response -> System.out.printf("Renewed lease ID is %s%n", response.value())); - // END: com.azure.storage.blob.BlobAsyncClient.renewLease#String-ModifiedAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#releaseLease(String)} and - * {@link BlobAsyncClient#releaseLease(String, ModifiedAccessConditions)} + * Code snippets for {@link BlobAsyncClient#releaseLease(String)} */ - public void releaseLease() { + public void releaseLeaseCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.releaseLease#String - client.releaseLease(leaseId) - .subscribe(response -> System.out.printf("Release lease completed with status %d%n", response.statusCode())); + client.releaseLease(leaseId).doOnSuccess(response -> System.out.println("Completed release lease")); // END: com.azure.storage.blob.BlobAsyncClient.releaseLease#String - - // BEGIN: com.azure.storage.blob.BlobAsyncClient.releaseLease#String-ModifiedAccessConditions - ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() - .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); - - client.releaseLease(leaseId, modifiedAccessConditions) - .subscribe(response -> System.out.printf("Release lease completed with status %d%n", response.statusCode())); - // END: com.azure.storage.blob.BlobAsyncClient.releaseLease#String-ModifiedAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#breakLease()} and - * {@link BlobAsyncClient#breakLease(Integer, ModifiedAccessConditions)} + * Code snippets for {@link BlobAsyncClient#breakLease()} */ - public void breakLease() { + public void breakLeaseCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobAsyncClient.breakLease client.breakLease() .subscribe(response -> - System.out.printf("The broken lease has %d seconds remaining on the lease", response.value())); + System.out.printf("The broken lease has %d seconds remaining on the lease", response)); // END: com.azure.storage.blob.BlobAsyncClient.breakLease + } + + /** + * Code snippets for {@link BlobAsyncClient#changeLease(String, String)} + */ + public void changeLeaseCodeSnippet() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.changeLease#String-String + client.changeLease(leaseId, "proposedId") + .subscribe(response -> System.out.printf("Changed lease ID is %s%n", response)); + // END: com.azure.storage.blob.BlobAsyncClient.changeLease#String-String + } + + /** + * Code snippet for {@link BlobAsyncClient#getAccountInfo()} + */ + public void getAccountInfoCodeSnippet() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.getAccountInfo + client.getAccountInfo().subscribe(response -> System.out.printf("Account Kind: %s, SKU: %s%n", + response.getAccountKind(), response.getSkuName())); + // END: com.azure.storage.blob.BlobAsyncClient.getAccountInfo + } + + /** + * Code snippet for {@link BlobAsyncClient#existsWithResponse()} + */ + public void existsWithResponseCodeSnippet() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.existsWithResponse + client.existsWithResponse().subscribe(response -> System.out.printf("Exists? %b%n", response.getValue())); + // END: com.azure.storage.blob.BlobAsyncClient.existsWithResponse + } + + /** + * Code snippets for {@link BlobAsyncClient#startCopyFromURLWithResponse(URL, Metadata, AccessTier, + * RehydratePriority, ModifiedAccessConditions, BlobAccessConditions)} + */ + public void startCopyFromURLWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.startCopyFromURLWithResponse#URL-Metadata-AccessTier-RehydratePriority-ModifiedAccessConditions-BlobAccessConditions + Metadata metadata = new 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, + 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 + } + + /** + * Code snippets for {@link BlobAsyncClient#abortCopyFromURLWithResponse(String, LeaseAccessConditions)} + */ + public void abortCopyFromURLWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.abortCopyFromURLWithResponse#String-LeaseAccessConditions + LeaseAccessConditions leaseAccessConditions = new LeaseAccessConditions().setLeaseId(leaseId); + 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 + } + + /** + * Code snippets for {@link BlobAsyncClient#copyFromURLWithResponse(URL, Metadata, AccessTier, + * ModifiedAccessConditions, BlobAccessConditions)} + */ + public void copyFromURLWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.copyFromURLWithResponse#URL-Metadata-AccessTier-ModifiedAccessConditions-BlobAccessConditions + Metadata metadata = new 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) + .subscribe(response -> System.out.printf("Copy identifier: %s%n", response)); + // END: com.azure.storage.blob.BlobAsyncClient.copyFromURLWithResponse#URL-Metadata-AccessTier-ModifiedAccessConditions-BlobAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#downloadWithResponse(BlobRange, ReliableDownloadOptions, + * BlobAccessConditions, boolean)} + * + * @throws UncheckedIOException If an I/O error occurs + */ + public void downloadWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.downloadWithResponse#BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean + BlobRange range = new BlobRange(1024, (long) 2048); + ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5); - // BEGIN: com.azure.storage.blob.BlobAsyncClient.breakLease#Integer-ModifiedAccessConditions + client.downloadWithResponse(range, options, null, false).subscribe(response -> { + ByteArrayOutputStream downloadData = new ByteArrayOutputStream(); + response.getValue().subscribe(piece -> { + try { + downloadData.write(piece.array()); + } catch (IOException ex) { + throw new UncheckedIOException(ex); + } + }); + }); + // END: com.azure.storage.blob.BlobAsyncClient.downloadWithResponse#BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean + } + + /** + * Code snippets for {@link BlobAsyncClient#deleteWithResponse(DeleteSnapshotsOptionType, BlobAccessConditions)} + */ + public void deleteWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.deleteWithResponse#DeleteSnapshotsOptionType-BlobAccessConditions + client.deleteWithResponse(DeleteSnapshotsOptionType.INCLUDE, null) + .subscribe(response -> System.out.printf("Delete completed with status %d%n", response.getStatusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.deleteWithResponse#DeleteSnapshotsOptionType-BlobAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#getPropertiesWithResponse(BlobAccessConditions)} + */ + public void getPropertiesWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.getPropertiesWithResponse#BlobAccessConditions + BlobAccessConditions accessConditions = new BlobAccessConditions() + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)); + + client.getPropertiesWithResponse(accessConditions).subscribe( + response -> System.out.printf("Type: %s, Size: %d%n", response.getValue().getBlobType(), + response.getValue().getBlobType())); + // END: com.azure.storage.blob.BlobAsyncClient.getPropertiesWithResponse#BlobAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#setHTTPHeadersWithResponse(BlobHTTPHeaders, BlobAccessConditions)} + */ + public void setHTTPHeadersWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.setHTTPHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions + BlobAccessConditions accessConditions = new BlobAccessConditions() + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)); + + 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 + } + + /** + * Code snippets for {@link BlobAsyncClient#setMetadataWithResponse(Metadata, BlobAccessConditions)} + */ + public void setMetadataWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.setMetadataWithResponse#Metadata-BlobAccessConditions + BlobAccessConditions accessConditions = new BlobAccessConditions() + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)); + + client.setMetadataWithResponse(new Metadata(Collections.singletonMap("metadata", "value")), accessConditions) + .subscribe(response -> System.out.printf("Set metadata completed with status %d%n", response.getStatusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.setMetadataWithResponse#Metadata-BlobAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#createSnapshotWithResponse(Metadata, BlobAccessConditions)} + */ + public void createSnapshotWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.createSnapshotWithResponse#Metadata-BlobAccessConditions + Metadata snapshotMetadata = new Metadata(Collections.singletonMap("metadata", "value")); + BlobAccessConditions accessConditions = new BlobAccessConditions().setLeaseAccessConditions( + new LeaseAccessConditions().setLeaseId(leaseId)); + + client.createSnapshotWithResponse(snapshotMetadata, accessConditions) + .subscribe(response -> System.out.printf("Identifier for the snapshot is %s%n", response.getValue())); + // END: com.azure.storage.blob.BlobAsyncClient.createSnapshotWithResponse#Metadata-BlobAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#setTierWithResponse(AccessTier, RehydratePriority, + * LeaseAccessConditions)} + */ + public void setTierWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.setTierWithResponse#AccessTier-RehydratePriority-LeaseAccessConditions + LeaseAccessConditions accessConditions = new LeaseAccessConditions().setLeaseId(leaseId); + + client.setTierWithResponse(AccessTier.HOT, RehydratePriority.STANDARD, accessConditions) + .subscribe(response -> System.out.printf("Set tier completed with status code %d%n", + response.getStatusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.setTierWithResponse#AccessTier-RehydratePriority-LeaseAccessConditions + } + + /** + * Code snippet for {@link BlobAsyncClient#undeleteWithResponse()} + */ + public void undeleteWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.undeleteWithResponse + client.undeleteWithResponse() + .subscribe(response -> System.out.printf("Undelete completed with status %d%n", response.getStatusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.undeleteWithResponse + } + + /** + * Code snippets for {@link BlobAsyncClient#acquireLeaseWithResponse(String, int, ModifiedAccessConditions)} + */ + public void acquireLeaseWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.acquireLeaseWithResponse#String-int-ModifiedAccessConditions + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .setIfModifiedSince(OffsetDateTime.now().minusDays(3)); + + client.acquireLeaseWithResponse("proposedId", 60, modifiedAccessConditions) + .subscribe(response -> System.out.printf("Lease ID is %s%n", response.getValue())); + // END: com.azure.storage.blob.BlobAsyncClient.acquireLeaseWithResponse#String-int-ModifiedAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#renewLeaseWithResponse(String, ModifiedAccessConditions)} + */ + public void renewLeaseWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.renewLeaseWithResponse#String-ModifiedAccessConditions + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + client.renewLeaseWithResponse(leaseId, modifiedAccessConditions) + .subscribe(response -> System.out.printf("Renewed lease ID is %s%n", response.getValue())); + // END: com.azure.storage.blob.BlobAsyncClient.renewLeaseWithResponse#String-ModifiedAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#releaseLeaseWithResponse(String, ModifiedAccessConditions)} + */ + public void releaseLeaseWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.releaseLeaseWithResponse#String-ModifiedAccessConditions + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + client.releaseLeaseWithResponse(leaseId, modifiedAccessConditions) + .subscribe(response -> System.out.printf("Release lease completed with status %d%n", + response.getStatusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.releaseLeaseWithResponse#String-ModifiedAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#breakLeaseWithResponse(Integer, ModifiedAccessConditions)} + */ + public void breakLeaseWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.breakLeaseWithResponse#Integer-ModifiedAccessConditions Integer retainLeaseInSeconds = 5; ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() - .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); - client.breakLease(retainLeaseInSeconds, modifiedAccessConditions) + client.breakLeaseWithResponse(retainLeaseInSeconds, modifiedAccessConditions) .subscribe(response -> - System.out.printf("The broken lease has %d seconds remaining on the lease", response.value())); - // END: com.azure.storage.blob.BlobAsyncClient.breakLease#Integer-ModifiedAccessConditions + System.out.printf("The broken lease has %d seconds remaining on the lease", + response.getValue())); + // END: com.azure.storage.blob.BlobAsyncClient.breakLeaseWithResponse#Integer-ModifiedAccessConditions } /** - * Code snippets for {@link BlobAsyncClient#changeLease(String, String)} and - * {@link BlobAsyncClient#changeLease(String, String, ModifiedAccessConditions)} + * Code snippets for {@link BlobAsyncClient#changeLeaseWithResponse(String, String, ModifiedAccessConditions)} */ - public void changeLease() { - // BEGIN: com.azure.storage.blob.BlobAsyncClient.changeLease#String-String - client.changeLease(leaseId, "proposedId") - .subscribe(response -> System.out.printf("Changed lease ID is %s%n", response.value())); - // END: com.azure.storage.blob.BlobAsyncClient.changeLease#String-String + public void changeLeaseWithResponseCodeSnippets() { - // BEGIN: com.azure.storage.blob.BlobAsyncClient.changeLease#String-String-ModifiedAccessConditions + // BEGIN: com.azure.storage.blob.BlobAsyncClient.changeLeaseWithResponse#String-String-ModifiedAccessConditions ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() - .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); - client.changeLease(leaseId, "proposedId", modifiedAccessConditions) - .subscribe(response -> System.out.printf("Changed lease ID is %s%n", response.value())); - // END: com.azure.storage.blob.BlobAsyncClient.changeLease#String-String-ModifiedAccessConditions + client.changeLeaseWithResponse(leaseId, "proposedId", modifiedAccessConditions) + .subscribe(response -> System.out.printf("Changed lease ID is %s%n", response.getValue())); + // END: com.azure.storage.blob.BlobAsyncClient.changeLeaseWithResponse#String-String-ModifiedAccessConditions } /** - * Code snippet for {@link BlobAsyncClient#getAccountInfo()} + * Code snippet for {@link BlobAsyncClient#getAccountInfoWithResponse()} */ - public void getAccountInfo() { - // BEGIN: com.azure.storage.blob.BlobAsyncClient.getAccountInfo - client.getAccountInfo().subscribe(response -> System.out.printf("Account Kind: %s, SKU: %s%n", - response.value().accountKind(), response.value().skuName())); - // END: com.azure.storage.blob.BlobAsyncClient.getAccountInfo + public void getAccountInfoWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.getAccountInfoWithResponse + client.getAccountInfoWithResponse().subscribe(response -> System.out.printf("Account Kind: %s, SKU: %s%n", + response.getValue().getAccountKind(), response.getValue().getSkuName())); + // 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() + .setRead(true) + .setWrite(true) + .setCreate(true) + .setDelete(true) + .setAdd(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() + .setRead(true) + .setWrite(true) + .setCreate(true) + .setDelete(true) + .setAdd(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 } } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobClientBuilderJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobClientBuilderJavaDocCodeSnippets.java new file mode 100644 index 000000000000..93f08404f089 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobClientBuilderJavaDocCodeSnippets.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.storage.common.credentials.SharedKeyCredential; +import com.azure.storage.common.policy.RequestRetryOptions; +import com.azure.storage.common.policy.RequestRetryPolicy; +import com.azure.storage.common.policy.SharedKeyCredentialPolicy; + +/** + * Code snippets for {@link BlobClientBuilder} + */ +@SuppressWarnings({"unused"}) +public class BlobClientBuilderJavaDocCodeSnippets { + private String connectionString = "AccountName=name;AccountKey=key;DefaultEndpointProtocol=protocol;EndpointSuffix=suffix"; + private String endpoint = "endpointURL"; + private String containerName = "container Name"; + private SharedKeyCredential sharedKeyCredential = new SharedKeyCredential("accountName", "accountKey"); + private HttpPipeline httpPipeline = new HttpPipelineBuilder() + .httpClient(HttpClient.createDefault()) + .policies(new AddDatePolicy()) + .policies(new RequestIdPolicy()) + .policies(new SharedKeyCredentialPolicy(sharedKeyCredential)) + .policies(new RequestRetryPolicy(new RequestRetryOptions())) + .build(); + + /** + * Code snippet for {@link BlobClientBuilder#buildBlobClient()} using connection string + */ + public void blobClientConnectionString() { + // BEGIN: com.azure.storage.blob.BlobClientBuilder.buildBlobClient + BlobClient client = new BlobClientBuilder() + .connectionString(connectionString) + .buildBlobClient(); + // END: com.azure.storage.blob.BlobClientBuilder.buildBlobClient + } + + /** + * Code snippet for {@link BlobClientBuilder#buildBlobAsyncClient()} using connection string + */ + public void blobAsyncClientConnectionString() { + // BEGIN: com.azure.storage.blob.BlobClientBuilder.buildBlobAsyncClient + BlobAsyncClient client = new BlobClientBuilder() + .connectionString(connectionString) + .buildBlobAsyncClient(); + // END: com.azure.storage.blob.BlobClientBuilder.buildBlobAsyncClient + } + + /** + * Code snippet for {@link BlobClientBuilder#endpoint(String)} using credential and endpoint + */ + public void blobClientCredentialAndEndpoint() { + // BEGIN: com.azure.storage.blob.BlobClientBuilder.endpoint#String + BlobClient client = new BlobClientBuilder() + .endpoint(endpoint) + .credential(sharedKeyCredential) + .buildBlobClient(); + // END: com.azure.storage.blob.BlobClientBuilder.endpoint#String + } + + /** + * Code snippet for {@link BlobClientBuilder#containerName(String)} using HttpPipeline + */ + public void blobClientHttpPipeline() { + // BEGIN: com.azure.storage.blob.BlobClientBuilder.containerName#String + BlobClient client = new BlobClientBuilder() + .endpoint(endpoint) + .containerName(containerName) + .buildBlobClient(); + // END: com.azure.storage.blob.BlobClientBuilder.containerName#String + } +} 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 90a64765f384..f9c1ff0226f6 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 @@ -3,6 +3,7 @@ package com.azure.storage.blob; +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; @@ -11,11 +12,17 @@ import com.azure.storage.blob.models.LeaseAccessConditions; import com.azure.storage.blob.models.Metadata; import com.azure.storage.blob.models.ModifiedAccessConditions; +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; +import java.io.UncheckedIOException; import java.net.URL; import java.time.Duration; import java.time.OffsetDateTime; @@ -32,100 +39,62 @@ public class BlobClientJavaDocCodeSnippets { private URL url = JavaDocCodeSnippetsHelpers.generateURL("https://sample.com"); private String file = "file"; private Duration timeout = Duration.ofSeconds(30); + private String key1 = "key1"; + private String key2 = "key2"; + private String value1 = "val1"; + private String value2 = "val2"; /** - * Code snippets for {@link BlobClient#exists()} and {@link BlobClient#exists(Duration)} + * Code snippets for {@link BlobClient#exists()} */ public void existsCodeSnippet() { // BEGIN: com.azure.storage.blob.BlobClient.exists - System.out.printf("Exists? %b%n", client.exists().value()); + System.out.printf("Exists? %b%n", client.exists()); // END: com.azure.storage.blob.BlobClient.exists - - // BEGIN: com.azure.storage.blob.BlobClient.exists#Duration - System.out.printf("Exists? %b%n", client.exists(timeout).value()); - // END: com.azure.storage.blob.BlobClient.exists#Duration } /** - * Code snippets for {@link BlobClient#startCopyFromURL(URL)} and - * {@link BlobClient#startCopyFromURL(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions, Duration)} + * 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).value()); + System.out.printf("Copy identifier: %s%n", client.startCopyFromURL(url)); // END: com.azure.storage.blob.BlobClient.startCopyFromURL#URL - - // BEGIN: com.azure.storage.blob.BlobClient.startCopyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration - Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); - ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() - .ifUnmodifiedSince(OffsetDateTime.now().minusDays(7)); - BlobAccessConditions blobAccessConditions = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); - - System.out.printf("Copy identifier: %s%n", - client.startCopyFromURL(url, metadata, modifiedAccessConditions, blobAccessConditions, timeout)); - // END: com.azure.storage.blob.BlobClient.startCopyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration } /** - * Code snippets for {@link BlobClient#abortCopyFromURL(String)} and - * {@link BlobClient#abortCopyFromURL(String, LeaseAccessConditions, Duration)} + * Code snippets for {@link BlobClient#abortCopyFromURL(String)} */ public void abortCopyFromURL() { // BEGIN: com.azure.storage.blob.BlobClient.abortCopyFromURL#String - System.out.printf("Aborted copy completed with status %d%n", client.abortCopyFromURL(copyId).statusCode()); + client.abortCopyFromURL(copyId); + System.out.println("Aborted copy completed."); // END: com.azure.storage.blob.BlobClient.abortCopyFromURL#String - - // BEGIN: com.azure.storage.blob.BlobClient.abortCopyFromURL#String-LeaseAccessConditions-Duration - LeaseAccessConditions leaseAccessConditions = new LeaseAccessConditions().leaseId(leaseId); - System.out.printf("Aborted copy completed with status %d%n", - client.abortCopyFromURL(copyId, leaseAccessConditions, timeout).statusCode()); - // END: com.azure.storage.blob.BlobClient.abortCopyFromURL#String-LeaseAccessConditions-Duration } /** - * Code snippets for {@link BlobClient#copyFromURL(URL)} and - * {@link BlobClient#copyFromURL(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions, Duration)} + * 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).value()); + System.out.printf("Copy identifier: %s%n", client.copyFromURL(url)); // END: com.azure.storage.blob.BlobClient.copyFromURL#URL - - // BEGIN: com.azure.storage.blob.BlobClient.copyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration - Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); - ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() - .ifUnmodifiedSince(OffsetDateTime.now().minusDays(7)); - BlobAccessConditions blobAccessConditions = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); - - System.out.printf("Copy identifier: %s%n", - client.copyFromURL(url, metadata, modifiedAccessConditions, blobAccessConditions, timeout).value()); - // END: com.azure.storage.blob.BlobClient.copyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration } /** - * Code snippets for {@link BlobClient#download(OutputStream)} and - * {@link BlobClient#download(OutputStream, BlobRange, ReliableDownloadOptions, BlobAccessConditions, boolean, Duration)} + * Code snippets for {@link BlobClient#download(OutputStream)} */ public void download() { // BEGIN: com.azure.storage.blob.BlobClient.download#OutputStream - System.out.printf("Download completed with status %d%n", - client.download(new ByteArrayOutputStream()).statusCode()); + client.download(new ByteArrayOutputStream()); + System.out.println("Download completed."); // END: com.azure.storage.blob.BlobClient.download#OutputStream - - // BEGIN: com.azure.storage.blob.BlobClient.download#OutputStream-BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration - BlobRange range = new BlobRange(1024, 2048L); - ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5); - - System.out.printf("Download completed with status %d%n", - client.download(new ByteArrayOutputStream(), range, options, null, false, timeout).statusCode()); - // END: com.azure.storage.blob.BlobClient.download#OutputStream-BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration } /** * Code snippets for {@link BlobClient#downloadToFile(String)} and - * {@link BlobClient#downloadToFile(String, BlobRange, Integer, ReliableDownloadOptions, BlobAccessConditions, boolean, Duration)} + * {@link BlobClient#downloadToFile(String, BlobRange, Integer, ReliableDownloadOptions, BlobAccessConditions, + * boolean, Duration, Context)} */ public void downloadToFile() { // BEGIN: com.azure.storage.blob.BlobClient.downloadToFile#String @@ -133,28 +102,23 @@ public void downloadToFile() { System.out.println("Completed download to file"); // END: com.azure.storage.blob.BlobClient.downloadToFile#String - // BEGIN: com.azure.storage.blob.BlobClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration + // BEGIN: com.azure.storage.blob.BlobClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration-Context BlobRange range = new BlobRange(1024, 2048L); ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5); - client.downloadToFile(file, range, null, options, null, false, timeout); + client.downloadToFile(file, range, 4 * Constants.MB, options, null, false, timeout, new Context(key2, value2)); System.out.println("Completed download to file"); - // END: com.azure.storage.blob.BlobClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration + // END: com.azure.storage.blob.BlobClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration-Context } /** - * Code snippets for {@link BlobClient#delete()} and - * {@link BlobClient#delete(DeleteSnapshotsOptionType, BlobAccessConditions, Duration)} + * Code snippets for {@link BlobClient#delete()} */ - public void delete() { + public void setDelete() { // BEGIN: com.azure.storage.blob.BlobClient.delete - System.out.printf("Delete completed with status %d%n", client.delete().statusCode()); + client.delete(); + System.out.println("Delete completed."); // END: com.azure.storage.blob.BlobClient.delete - - // BEGIN: com.azure.storage.blob.BlobClient.delete#DeleteSnapshotsOptionType-BlobAccessConditions-Duration - System.out.printf("Delete completed with status %d%n", - client.delete(DeleteSnapshotsOptionType.INCLUDE, null, timeout).statusCode()); - // END: com.azure.storage.blob.BlobClient.delete#DeleteSnapshotsOptionType-BlobAccessConditions-Duration } /** @@ -162,207 +126,114 @@ public void delete() { */ public void getProperties() { // BEGIN: com.azure.storage.blob.BlobClient.getProperties - BlobProperties properties = client.getProperties().value(); - System.out.printf("Type: %s, Size: %d%n", properties.blobType(), properties.blobSize()); + BlobProperties properties = client.getProperties(); + System.out.printf("Type: %s, Size: %d%n", properties.getBlobType(), properties.getBlobSize()); // END: com.azure.storage.blob.BlobClient.getProperties } /** - * Code snippet for {@link BlobClient#getProperties(BlobAccessConditions, Duration)} - */ - public void getPropertiesWithTimeout() { - // BEGIN: com.azure.storage.blob.BlobClient.getProperties#BlobAccessConditions-Duration - BlobAccessConditions accessConditions = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); - - BlobProperties properties = client.getProperties(accessConditions, timeout).value(); - System.out.printf("Type: %s, Size: %d%n", properties.blobType(), properties.blobSize()); - // END: com.azure.storage.blob.BlobClient.getProperties#BlobAccessConditions-Duration - } - - /** - * Code snippets for {@link BlobClient#setHTTPHeaders(BlobHTTPHeaders)} and - * {@link BlobClient#setHTTPHeaders(BlobHTTPHeaders, BlobAccessConditions, Duration)} + * Code snippets for {@link BlobClient#setHTTPHeaders(BlobHTTPHeaders)} */ public void setHTTPHeaders() { // BEGIN: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders - System.out.printf("Set HTTP headers completed with status %d%n", - client.setHTTPHeaders(new BlobHTTPHeaders() - .blobContentLanguage("en-US") - .blobContentType("binary")) - .statusCode()); + client.setHTTPHeaders(new BlobHTTPHeaders() + .setBlobContentLanguage("en-US") + .setBlobContentType("binary")); + System.out.println("Set HTTP headers completed"); // END: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders - - // BEGIN: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions-Duration - BlobAccessConditions accessConditions = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); - - System.out.printf("Set HTTP headers completed with status %d%n", - client.setHTTPHeaders(new BlobHTTPHeaders() - .blobContentLanguage("en-US") - .blobContentType("binary"), accessConditions, timeout) - .statusCode()); - // END: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions-Duration } /** - * Code snippets for {@link BlobClient#setMetadata(Metadata)} and - * {@link BlobClient#setMetadata(Metadata, BlobAccessConditions, Duration)} + * Code snippets for {@link BlobClient#setMetadata(Metadata)} */ public void setMetadata() { // BEGIN: com.azure.storage.blob.BlobClient.setMetadata#Metadata - System.out.printf("Set metadata completed with status %d%n", - client.setMetadata(new Metadata(Collections.singletonMap("metadata", "value"))).statusCode()); + client.setMetadata(new Metadata(Collections.singletonMap("metadata", "value"))); + System.out.println("Set metadata completed"); // END: com.azure.storage.blob.BlobClient.setMetadata#Metadata - - // BEGIN: com.azure.storage.blob.BlobClient.setMetadata#Metadata-BlobAccessConditions-Duration - BlobAccessConditions accessConditions = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); - - System.out.printf("Set metadata completed with status %d%n", - client.setMetadata( - new Metadata(Collections.singletonMap("metadata", "value")), accessConditions, timeout).statusCode()); - // END: com.azure.storage.blob.BlobClient.setMetadata#Metadata-BlobAccessConditions-Duration } /** - * Code snippets for {@link BlobClient#createSnapshot()} and - * {@link BlobClient#createSnapshot(Metadata, BlobAccessConditions, Duration)} + * Code snippets for {@link BlobClient#createSnapshot()} */ public void createSnapshot() { // BEGIN: com.azure.storage.blob.BlobClient.createSnapshot - System.out.printf("Identifier for the snapshot is %s%n", client.createSnapshot().value().getSnapshotId()); + System.out.printf("Identifier for the snapshot is %s%n", client.createSnapshot().getSnapshotId()); // END: com.azure.storage.blob.BlobClient.createSnapshot - - // BEGIN: com.azure.storage.blob.BlobClient.createSnapshot#Metadata-BlobAccessConditions-Duration - Metadata snapshotMetadata = new Metadata(Collections.singletonMap("metadata", "value")); - BlobAccessConditions accessConditions = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); - - System.out.printf("Identifier for the snapshot is %s%n", - client.createSnapshot(snapshotMetadata, accessConditions, timeout).value().getSnapshotId()); - // END: com.azure.storage.blob.BlobClient.createSnapshot#Metadata-BlobAccessConditions-Duration } /** * Code snippets for {@link BlobClient#setTier(AccessTier)} and - * {@link BlobClient#setTier(AccessTier, LeaseAccessConditions, Duration)} + * {@link BlobClient#setTierWithResponse(AccessTier, RehydratePriority, LeaseAccessConditions, Duration, Context)} */ public void setTier() { // BEGIN: com.azure.storage.blob.BlobClient.setTier#AccessTier - System.out.printf("Set tier completed with status code %d%n", client.setTier(AccessTier.HOT).statusCode()); + System.out.printf("Set tier completed with status code %d%n", + client.setTierWithResponse(AccessTier.HOT, null, null, null, null).getStatusCode()); // END: com.azure.storage.blob.BlobClient.setTier#AccessTier - // BEGIN: com.azure.storage.blob.BlobClient.setTier#AccessTier-LeaseAccessConditions-Duration - LeaseAccessConditions accessConditions = new LeaseAccessConditions().leaseId(leaseId); - System.out.printf("Set tier completed with status code %d%n", - client.setTier(AccessTier.HOT, accessConditions, timeout).statusCode()); - // END: com.azure.storage.blob.BlobClient.setTier#AccessTier-LeaseAccessConditions-Duration } /** - * Code snippets for {@link BlobClient#undelete()} and {@link BlobClient#undelete(Duration)} + * Code snippets for {@link BlobClient#undelete()} */ - public void undelete() { + public void unsetDelete() { // BEGIN: com.azure.storage.blob.BlobClient.undelete - System.out.printf("Undelete completed with status %d%n", client.undelete().statusCode()); + client.undelete(); + System.out.printf("Undelete completed"); // END: com.azure.storage.blob.BlobClient.undelete - - // BEGIN: com.azure.storage.blob.BlobClient.undelete#Duration - System.out.printf("Undelete completed with status %d%n", client.undelete(timeout).statusCode()); - // END: com.azure.storage.blob.BlobClient.undelete#Duration } /** - * Code snippets for {@link BlobClient#acquireLease(String, int)} and - * {@link BlobClient#acquireLease(String, int, ModifiedAccessConditions, Duration)} + * Code snippets for {@link BlobClient#acquireLease(String, int)} */ public void acquireLease() { // BEGIN: com.azure.storage.blob.BlobClient.acquireLease#String-int - System.out.printf("Lease ID is %s%n", client.acquireLease("proposedId", 60).value()); + System.out.printf("Lease ID is %s%n", client.acquireLease("proposedId", 60)); // END: com.azure.storage.blob.BlobClient.acquireLease#String-int - - // BEGIN: com.azure.storage.blob.BlobClient.acquireLease#String-int-ModifiedAccessConditions-Duration - ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() - .ifModifiedSince(OffsetDateTime.now().minusDays(3)); - - System.out.printf("Lease ID is %s%n", - client.acquireLease("proposedId", 60, modifiedAccessConditions, timeout).value()); - // END: com.azure.storage.blob.BlobClient.acquireLease#String-int-ModifiedAccessConditions-Duration } /** - * Code snippets for {@link BlobClient#renewLease(String)} and - * {@link BlobClient#renewLease(String, ModifiedAccessConditions, Duration)} + * Code snippets for {@link BlobClient#renewLease(String)} */ public void renewLease() { // BEGIN: com.azure.storage.blob.BlobClient.renewLease#String - System.out.printf("Renewed lease ID is %s%n", client.renewLease(leaseId).value()); + System.out.printf("Renewed lease ID is %s%n", client.renewLease(leaseId)); // END: com.azure.storage.blob.BlobClient.renewLease#String - - // BEGIN: com.azure.storage.blob.BlobClient.renewLease#String-ModifiedAccessConditions-Duration - ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() - .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); - - System.out.printf("Renewed lease ID is %s%n", - client.renewLease(leaseId, modifiedAccessConditions, timeout).value()); - // END: com.azure.storage.blob.BlobClient.renewLease#String-ModifiedAccessConditions-Duration } /** - * Code snippets for {@link BlobClient#releaseLease(String)} and - * {@link BlobClient#releaseLease(String, ModifiedAccessConditions, Duration)} + * Code snippets for {@link BlobClient#releaseLease(String)} */ public void releaseLease() { // BEGIN: com.azure.storage.blob.BlobClient.releaseLease#String - System.out.printf("Release lease completed with status %d%n", client.releaseLease(leaseId).statusCode()); + client.releaseLease(leaseId); + System.out.printf("Release lease completed"); // END: com.azure.storage.blob.BlobClient.releaseLease#String - // BEGIN: com.azure.storage.blob.BlobClient.releaseLease#String-ModifiedAccessConditions-Duration - ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() - .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); - System.out.printf("Release lease completed with status %d%n", - client.releaseLease(leaseId, modifiedAccessConditions, timeout).statusCode()); - // END: com.azure.storage.blob.BlobClient.releaseLease#String-ModifiedAccessConditions-Duration } /** - * Code snippets for {@link BlobClient#breakLease()} and - * {@link BlobClient#breakLease(Integer, ModifiedAccessConditions, Duration)} + * Code snippets for {@link BlobClient#breakLease()} */ public void breakLease() { // BEGIN: com.azure.storage.blob.BlobClient.breakLease - System.out.printf("The broken lease has %d seconds remaining on the lease", client.breakLease().value()); + System.out.printf("The broken lease has %d seconds remaining on the lease", client.breakLease()); // END: com.azure.storage.blob.BlobClient.breakLease - // BEGIN: com.azure.storage.blob.BlobClient.breakLease#Integer-ModifiedAccessConditions-Duration - Integer retainLeaseInSeconds = 5; - ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() - .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); - System.out.printf("The broken lease has %d seconds remaining on the lease", - client.breakLease(retainLeaseInSeconds, modifiedAccessConditions, timeout).value()); - // END: com.azure.storage.blob.BlobClient.breakLease#Integer-ModifiedAccessConditions-Duration } /** - * Code snippets for {@link BlobClient#changeLease(String, String)} and - * {@link BlobClient#changeLease(String, String, ModifiedAccessConditions, Duration)} + * Code snippets for {@link BlobClient#changeLease(String, String)} */ public void changeLease() { // BEGIN: com.azure.storage.blob.BlobClient.changeLease#String-String - System.out.printf("Changed lease ID is %s%n", client.changeLease(leaseId, "proposedId").value()); + System.out.printf("Changed lease ID is %s%n", client.changeLease(leaseId, "proposedId")); // END: com.azure.storage.blob.BlobClient.changeLease#String-String - // BEGIN: com.azure.storage.blob.BlobClient.changeLease#String-String-ModifiedAccessConditions-Duration - ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() - .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); - - System.out.printf("Changed lease ID is %s%n", - client.changeLease(leaseId, "proposedId", modifiedAccessConditions, timeout).value()); - // END: com.azure.storage.blob.BlobClient.changeLease#String-String-ModifiedAccessConditions-Duration } /** @@ -370,18 +241,342 @@ public void changeLease() { */ public void getAccountInfo() { // BEGIN: com.azure.storage.blob.BlobClient.getAccountInfo - StorageAccountInfo accountInfo = client.getAccountInfo().value(); - System.out.printf("Account Kind: %s, SKU: %s%n", accountInfo.accountKind(), accountInfo.skuName()); + StorageAccountInfo accountInfo = client.getAccountInfo(); + System.out.printf("Account Kind: %s, SKU: %s%n", accountInfo.getAccountKind(), accountInfo.getSkuName()); // END: com.azure.storage.blob.BlobClient.getAccountInfo } /** - * Code snippet for {@link BlobClient#getAccountInfo(Duration)} + * Code snippet for {@link BlobClient#existsWithResponse(Duration, Context)} + */ + public void existsWithResponseCodeSnippet() { + // BEGIN: com.azure.storage.blob.BlobClient.existsWithResponse#Duration-Context + System.out.printf("Exists? %b%n", client.existsWithResponse(timeout, new Context(key2, value2)).getValue()); + // END: com.azure.storage.blob.BlobClient.existsWithResponse#Duration-Context + } + + /** + * Code snippets for {@link BlobClient#startCopyFromURLWithResponse(URL, Metadata, AccessTier, RehydratePriority, + * ModifiedAccessConditions, BlobAccessConditions, Duration, Context)} + */ + public void startCopyFromURLWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobClient.startCopyFromURLWithResponse#URL-Metadata-AccessTier-RehydratePriority-ModifiedAccessConditions-BlobAccessConditions-Duration-Context + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(7)); + BlobAccessConditions blobAccessConditions = new BlobAccessConditions().setLeaseAccessConditions( + new LeaseAccessConditions().setLeaseId(leaseId)); + + System.out.printf("Copy identifier: %s%n", + 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 + } + + /** + * Code snippets for {@link BlobClient#abortCopyFromURLWithResponse(String, LeaseAccessConditions, Duration, Context)} + */ + public void abortCopyFromURLWithResponseCodeSnippets() { + + // 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, + new Context(key2, value2)).getStatusCode()); + // END: com.azure.storage.blob.BlobClient.abortCopyFromURLWithResponse#String-LeaseAccessConditions-Duration-Context + } + + /** + * Code snippets for {@link BlobClient#copyFromURLWithResponse(URL, Metadata, AccessTier, ModifiedAccessConditions, + * BlobAccessConditions, Duration, Context)} + */ + public void copyFromURLWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobClient.copyFromURLWithResponse#URL-Metadata-AccessTier-ModifiedAccessConditions-BlobAccessConditions-Duration-Context + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(7)); + BlobAccessConditions blobAccessConditions = new BlobAccessConditions().setLeaseAccessConditions( + new LeaseAccessConditions().setLeaseId(leaseId)); + + System.out.printf("Copy identifier: %s%n", + 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 + } + + /** + * Code snippets for {@link BlobClient#downloadWithResponse(OutputStream, BlobRange, ReliableDownloadOptions, + * BlobAccessConditions, boolean, Duration, Context)} + * @throws UncheckedIOException If an I/O error occurs + */ + public void downloadWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobClient.downloadWithResponse#OutputStream-BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration-Context + BlobRange range = new BlobRange(1024, 2048L); + ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5); + + System.out.printf("Download completed with status %d%n", + client.downloadWithResponse(new ByteArrayOutputStream(), range, options, null, false, + timeout, new Context(key2, value2)).getStatusCode()); + // END: com.azure.storage.blob.BlobClient.downloadWithResponse#OutputStream-BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration-Context + + } + + /** + * Code snippets for {@link BlobClient#deleteWithResponse(DeleteSnapshotsOptionType, BlobAccessConditions, Duration, + * Context)} + */ + public void deleteWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobClient.deleteWithResponse#DeleteSnapshotsOptionType-BlobAccessConditions-Duration-Context + System.out.printf("Delete completed with status %d%n", + client.deleteWithResponse(DeleteSnapshotsOptionType.INCLUDE, null, timeout, + new Context(key1, value1)).getStatusCode()); + // END: com.azure.storage.blob.BlobClient.deleteWithResponse#DeleteSnapshotsOptionType-BlobAccessConditions-Duration-Context + } + + /** + * Code snippets for {@link BlobClient#getPropertiesWithResponse(BlobAccessConditions, Duration, Context)} + */ + public void getPropertiesWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobClient.getPropertiesWithResponse#BlobAccessConditions-Duration-Context + BlobAccessConditions accessConditions = new BlobAccessConditions() + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)); + + BlobProperties properties = client.getPropertiesWithResponse(accessConditions, timeout, + new Context(key2, value2)).getValue(); + System.out.printf("Type: %s, Size: %d%n", properties.getBlobType(), properties.getBlobSize()); + // END: com.azure.storage.blob.BlobClient.getPropertiesWithResponse#BlobAccessConditions-Duration-Context + } + + /** + * Code snippets for {@link 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() + .setBlobContentLanguage("en-US") + .setBlobContentType("binary"), accessConditions, timeout, new Context(key1, value1)) + .getStatusCode()); + // END: com.azure.storage.blob.BlobClient.setHTTPHeadersWithResponse#BlobHTTPHeaders-BlobAccessConditions-Duration-Context + } + + /** + * Code snippets for {@link BlobClient#setMetadataWithResponse(Metadata, BlobAccessConditions, Duration, Context)} + */ + public void setMetadataWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobClient.setMetadataWithResponse#Metadata-BlobAccessConditions-Duration-Context + BlobAccessConditions accessConditions = new BlobAccessConditions().setLeaseAccessConditions( + new LeaseAccessConditions().setLeaseId(leaseId)); + + System.out.printf("Set metadata completed with status %d%n", + client.setMetadataWithResponse( + new Metadata(Collections.singletonMap("metadata", "value")), accessConditions, timeout, + new Context(key1, value1)).getStatusCode()); + // END: com.azure.storage.blob.BlobClient.setMetadataWithResponse#Metadata-BlobAccessConditions-Duration-Context + } + + /** + * Code snippets for {@link BlobClient#createSnapshotWithResponse(Metadata, BlobAccessConditions, Duration, + * Context)} + */ + public void createSnapshotWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobClient.createSnapshotWithResponse#Metadata-BlobAccessConditions-Duration-Context + Metadata snapshotMetadata = new Metadata(Collections.singletonMap("metadata", "value")); + BlobAccessConditions accessConditions = new BlobAccessConditions().setLeaseAccessConditions( + new LeaseAccessConditions().setLeaseId(leaseId)); + + System.out.printf("Identifier for the snapshot is %s%n", + client.createSnapshotWithResponse(snapshotMetadata, accessConditions, timeout, + new Context(key1, value1)).getValue()); + // END: com.azure.storage.blob.BlobClient.createSnapshotWithResponse#Metadata-BlobAccessConditions-Duration-Context + } + + /** + * Code snippets for {@link BlobClient#setTierWithResponse(AccessTier, RehydratePriority, LeaseAccessConditions, + * Duration, Context)} + */ + public void setTierWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobClient.setTierWithResponse#AccessTier-RehydratePriority-LeaseAccessConditions-Duration-Context + LeaseAccessConditions accessConditions = new LeaseAccessConditions().setLeaseId(leaseId); + + System.out.printf("Set tier completed with status code %d%n", + client.setTierWithResponse(AccessTier.HOT, RehydratePriority.STANDARD, accessConditions, timeout, + new Context(key2, value2)).getStatusCode()); + // END: com.azure.storage.blob.BlobClient.setTierWithResponse#AccessTier-RehydratePriority-LeaseAccessConditions-Duration-Context + } + + /** + * Code snippet for {@link BlobClient#undeleteWithResponse(Duration, Context)} + */ + public void undeleteWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobClient.undeleteWithResponse#Duration-Context + System.out.printf("Undelete completed with status %d%n", client.undeleteWithResponse(timeout, + new Context(key1, value1)).getStatusCode()); + // END: com.azure.storage.blob.BlobClient.undeleteWithResponse#Duration-Context + } + + /** + * Code snippets for {@link BlobClient#acquireLeaseWithResponse(String, int, ModifiedAccessConditions, Duration, + * Context)} + */ + public void acquireLeaseWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobClient.acquireLeaseWithResponse#String-int-ModifiedAccessConditions-Duration-Context + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .setIfModifiedSince(OffsetDateTime.now().minusDays(3)); + + System.out.printf("Lease ID is %s%n", + client.acquireLeaseWithResponse("proposedId", 60, modifiedAccessConditions, timeout, + new Context(key1, value1)).getValue()); + // END: com.azure.storage.blob.BlobClient.acquireLeaseWithResponse#String-int-ModifiedAccessConditions-Duration-Context + } + + /** + * Code snippets for {@link BlobClient#renewLeaseWithResponse(String, ModifiedAccessConditions, Duration, Context)} + */ + public void renewLeaseWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobClient.renewLeaseWithResponse#String-ModifiedAccessConditions-Duration-Context + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + System.out.printf("Renewed lease ID is %s%n", + client.renewLeaseWithResponse(leaseId, modifiedAccessConditions, timeout, + new Context(key1, value1)).getValue()); + // END: com.azure.storage.blob.BlobClient.renewLeaseWithResponse#String-ModifiedAccessConditions-Duration-Context + } + + /** + * Code snippets for {@link BlobClient#releaseLeaseWithResponse(String, ModifiedAccessConditions, Duration, + * Context)} + */ + public void releaseLeaseWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobClient.releaseLeaseWithResponse#String-ModifiedAccessConditions-Duration-Context + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + System.out.printf("Release lease completed with status %d%n", + client.releaseLeaseWithResponse(leaseId, modifiedAccessConditions, timeout, + new Context(key2, value2)).getStatusCode()); + // END: com.azure.storage.blob.BlobClient.releaseLeaseWithResponse#String-ModifiedAccessConditions-Duration-Context + } + + /** + * Code snippets for {@link BlobClient#breakLeaseWithResponse(Integer, ModifiedAccessConditions, Duration, Context)} + */ + public void breakLeaseWithResponseCodeSnippets() { + + // BEGIN: com.azure.storage.blob.BlobClient.breakLeaseWithResponse#Integer-ModifiedAccessConditions-Duration-Context + Integer retainLeaseInSeconds = 5; + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + System.out.printf("The broken lease has %d seconds remaining on the lease", + client.breakLeaseWithResponse(retainLeaseInSeconds, modifiedAccessConditions, timeout, + new Context(key1, value1)).getValue()); + // END: com.azure.storage.blob.BlobClient.breakLeaseWithResponse#Integer-ModifiedAccessConditions-Duration-Context + } + + /** + * Code snippets for {@link BlobClient#changeLeaseWithResponse(String, String, ModifiedAccessConditions, Duration, + * Context)} + */ + public void changeLeaseWithResponseCodeSnippets() { + + + // BEGIN: com.azure.storage.blob.BlobClient.changeLeaseWithResponse#String-String-ModifiedAccessConditions-Duration-Context + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + System.out.printf("Changed lease ID is %s%n", + client.changeLeaseWithResponse(leaseId, "proposedId", modifiedAccessConditions, timeout, + new Context(key1, value1)).getValue()); + // END: com.azure.storage.blob.BlobClient.changeLeaseWithResponse#String-String-ModifiedAccessConditions-Duration-Context + } + + /** + * Code snippet for {@link BlobClient#getAccountInfoWithResponse(Duration, Context)} + */ + public void getAccountInfoWithResponseCodeSnippets() { + // BEGIN: com.azure.storage.blob.BlobClient.getAccountInfoWithResponse#Duration-Context + StorageAccountInfo accountInfo = client.getAccountInfoWithResponse(timeout, new Context(key1, value1)).getValue(); + System.out.printf("Account Kind: %s, SKU: %s%n", accountInfo.getAccountKind(), accountInfo.getSkuName()); + // 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() + .setRead(true) + .setWrite(true) + .setCreate(true) + .setDelete(true) + .setAdd(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 getAccountInfoWithTimeout() { - // BEGIN: com.azure.storage.blob.BlobClient.getAccountInfo#Duration - StorageAccountInfo accountInfo = client.getAccountInfo(timeout).value(); - System.out.printf("Account Kind: %s, SKU: %s%n", accountInfo.accountKind(), accountInfo.skuName()); - // END: com.azure.storage.blob.BlobClient.getAccountInfo#Duration + 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() + .setRead(true) + .setWrite(true) + .setCreate(true) + .setDelete(true) + .setAdd(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 } } 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 new file mode 100644 index 000000000000..e12efe9a1136 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +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.blob.models.ContainerListDetails; +import com.azure.storage.blob.models.ListContainersOptions; +import com.azure.storage.blob.models.Logging; +import com.azure.storage.blob.models.Metadata; +import com.azure.storage.blob.models.Metrics; +import com.azure.storage.blob.models.PublicAccessType; +import com.azure.storage.blob.models.RetentionPolicy; +import com.azure.storage.blob.models.StorageServiceProperties; + +import java.util.Collections; +import java.time.OffsetDateTime; + +/** + * Code snippets for {@link BlobServiceAsyncClient} + */ +@SuppressWarnings({"unused"}) +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() + .setRead(true) + .setAdd(true) + .setCreate(true) + .setWrite(true) + .setDelete(true) + .setList(true) + .setProcessMessages(true) + .setUpdate(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#getContainerAsyncClient(String)} + */ + public void getContainerClient() { + // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.getContainerAsyncClient#String + ContainerAsyncClient containerAsyncClient = client.getContainerAsyncClient("containerName"); + // END: com.azure.storage.blob.BlobServiceAsyncClient.getContainerAsyncClient#String + } + + /** + * Code snippet for {@link BlobServiceAsyncClient#createContainer(String)} + */ + public void createContainer() { + // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.createContainer#String + ContainerAsyncClient containerAsyncClient = + client.createContainer("containerName").block(); + // END: com.azure.storage.blob.BlobServiceAsyncClient.createContainer#String + } + + /** + * Code snippet for {@link BlobServiceAsyncClient#createContainerWithResponse(String, Metadata, PublicAccessType)} + */ + public void createContainerWithResponse() { + // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.createContainerWithResponse#String-Metadata-PublicAccessType + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + + ContainerAsyncClient containerClient = + client.createContainerWithResponse("containerName", metadata, PublicAccessType.CONTAINER).block().getValue(); + // END: com.azure.storage.blob.BlobServiceAsyncClient.createContainerWithResponse#String-Metadata-PublicAccessType + } + + /** + * Code snippet for {@link BlobServiceAsyncClient#deleteContainer(String)} + */ + public void deleteContainer() { + // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.deleteContainer#String + client.deleteContainer("containerName").subscribe( + response -> System.out.printf("Delete container completed%n"), + error -> System.out.printf("Delete container failed: %s%n", error)); + // END: com.azure.storage.blob.BlobServiceAsyncClient.deleteContainer#String + } + + /** + * Code snippet for {@link BlobServiceAsyncClient#deleteContainerWithResponse(String, Context)} + */ + public void deleteContainerWithResponse() { + // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.deleteContainerWithResponse#String-Context + Context context = new Context("Key", "Value"); + client.deleteContainerWithResponse("containerName").subscribe(response -> + System.out.printf("Delete container completed with status %d%n", response.getStatusCode())); + // END: com.azure.storage.blob.BlobServiceAsyncClient.deleteContainerWithResponse#String-Context + } + + /** + * Code snippets for {@link BlobServiceAsyncClient#listContainers()} and + * {@link BlobServiceAsyncClient#listContainers(ListContainersOptions)} + */ + public void listContainers() { + // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.listContainers + client.listContainers().subscribe(container -> System.out.printf("Name: %s%n", container.getName())); + // END: com.azure.storage.blob.BlobServiceAsyncClient.listContainers + + // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.listContainers#ListContainersOptions + ListContainersOptions options = new ListContainersOptions() + .setPrefix("containerNamePrefixToMatch") + .setDetails(new ContainerListDetails().setMetadata(true)); + + client.listContainers(options).subscribe(container -> System.out.printf("Name: %s%n", container.getName())); + // END: com.azure.storage.blob.BlobServiceAsyncClient.listContainers#ListContainersOptions + } + + /** + * Code snippet for {@link BlobServiceAsyncClient#getProperties()} + */ + public void getProperties() { + // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.getProperties + client.getProperties().subscribe(response -> + System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b%n", + response.getHourMetrics().isEnabled(), + response.getMinuteMetrics().isEnabled())); + // END: com.azure.storage.blob.BlobServiceAsyncClient.getProperties + } + + /** + * Code snippet for {@link BlobServiceAsyncClient#getPropertiesWithResponse()} + */ + public void getPropertiesWithResponse() { + // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.getPropertiesWithResponse + client.getPropertiesWithResponse().subscribe(response -> + System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b%n", + response.getValue().getHourMetrics().isEnabled(), + response.getValue().getMinuteMetrics().isEnabled())); + // END: com.azure.storage.blob.BlobServiceAsyncClient.getPropertiesWithResponse + } + + /** + * Code snippet for {@link BlobServiceAsyncClient#setProperties(StorageServiceProperties)} + */ + public void setProperties() { + // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.setProperties#StorageServiceProperties + RetentionPolicy loggingRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(3); + RetentionPolicy metricsRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(1); + + StorageServiceProperties properties = new StorageServiceProperties() + .setLogging(new Logging() + .setWrite(true) + .setDelete(true) + .setRetentionPolicy(loggingRetentionPolicy)) + .setHourMetrics(new Metrics() + .setEnabled(true) + .setRetentionPolicy(metricsRetentionPolicy)) + .setMinuteMetrics(new Metrics() + .setEnabled(true) + .setRetentionPolicy(metricsRetentionPolicy)); + + client.setProperties(properties).subscribe( + response -> System.out.printf("Setting properties completed%n"), + error -> System.out.printf("Setting properties failed: %s%n", error)); + // END: com.azure.storage.blob.BlobServiceAsyncClient.setProperties#StorageServiceProperties + } + + /** + * Code snippet for {@link BlobServiceAsyncClient#setPropertiesWithResponse(StorageServiceProperties)} + */ + public void setPropertiesWithResponse() { + // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.setPropertiesWithResponse#StorageServiceProperties + RetentionPolicy loggingRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(3); + RetentionPolicy metricsRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(1); + + StorageServiceProperties properties = new StorageServiceProperties() + .setLogging(new Logging() + .setWrite(true) + .setDelete(true) + .setRetentionPolicy(loggingRetentionPolicy)) + .setHourMetrics(new Metrics() + .setEnabled(true) + .setRetentionPolicy(metricsRetentionPolicy)) + .setMinuteMetrics(new Metrics() + .setEnabled(true) + .setRetentionPolicy(metricsRetentionPolicy)); + + client.setPropertiesWithResponse(properties).subscribe(response -> + System.out.printf("Setting properties completed with status %d%n", response.getStatusCode())); + // END: com.azure.storage.blob.BlobServiceAsyncClient.setPropertiesWithResponse#StorageServiceProperties + } + + /** + * Code snippet for {@link BlobServiceAsyncClient#getUserDelegationKey(OffsetDateTime, OffsetDateTime)} + */ + public void getUserDelegationKey() { + OffsetDateTime delegationKeyStartTime = OffsetDateTime.now(); + OffsetDateTime delegationKeyExpiryTime = OffsetDateTime.now().plusDays(7); + // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.getUserDelegationKey#OffsetDateTime-OffsetDateTime + client.getUserDelegationKey(delegationKeyStartTime, delegationKeyExpiryTime).subscribe(response -> + System.out.printf("User delegation key: %s%n", response.getValue())); + // END: com.azure.storage.blob.BlobServiceAsyncClient.getUserDelegationKey#OffsetDateTime-OffsetDateTime + } + + /** + * Code snippet for {@link BlobServiceAsyncClient#getUserDelegationKeyWithResponse(OffsetDateTime, OffsetDateTime)} + */ + public void getUserDelegationKeyWithResponse() { + OffsetDateTime delegationKeyStartTime = OffsetDateTime.now(); + OffsetDateTime delegationKeyExpiryTime = OffsetDateTime.now().plusDays(7); + // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.getUserDelegationKeyWithResponse#OffsetDateTime-OffsetDateTime + client.getUserDelegationKeyWithResponse(delegationKeyStartTime, delegationKeyExpiryTime).subscribe(response -> + System.out.printf("User delegation key: %s%n", response.getValue().getValue())); + // END: com.azure.storage.blob.BlobServiceAsyncClient.getUserDelegationKeyWithResponse#OffsetDateTime-OffsetDateTime + } + + /** + * Code snippets for {@link BlobServiceAsyncClient#getStatistics()} + */ + public void getStatistics() { + // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.getStatistics + client.getStatistics().subscribe(response -> + System.out.printf("Geo-replication status: %s%n", response.getGeoReplication().getStatus())); + // END: com.azure.storage.blob.BlobServiceAsyncClient.getStatistics + } + + /** + * Code snippets for {@link BlobServiceAsyncClient#getStatisticsWithResponse()} + */ + public void getStatisticsWithResponse() { + // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.getStatisticsWithResponse + client.getStatisticsWithResponse().subscribe(response -> + System.out.printf("Geo-replication status: %s%n", response.getValue().getGeoReplication().getStatus())); + // END: com.azure.storage.blob.BlobServiceAsyncClient.getStatisticsWithResponse + } + + /** + * Code snippet for {@link BlobServiceAsyncClient#getAccountInfo} + */ + public void getAccountInfo() { + // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.getAccountInfo + client.getAccountInfo().subscribe(response -> + System.out.printf("Account kind: %s, SKU: %s%n", response.getAccountKind(), response.getSkuName())); + // END: com.azure.storage.blob.BlobServiceAsyncClient.getAccountInfo + } + + /** + * Code snippet for {@link BlobServiceAsyncClient#getAccountInfoWithResponse} + */ + public void getAccountInfoWithResponse() { + // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.getAccountInfoWithResponse + client.getAccountInfoWithResponse().subscribe(response -> + System.out.printf("Account kind: %s, SKU: %s%n", response.getValue().getAccountKind(), + response.getValue().getSkuName())); + // END: com.azure.storage.blob.BlobServiceAsyncClient.getAccountInfoWithResponse + } +} 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 new file mode 100644 index 000000000000..4dae5139ebfd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +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.blob.models.ContainerListDetails; +import com.azure.storage.blob.models.ListContainersOptions; +import com.azure.storage.blob.models.Logging; +import com.azure.storage.blob.models.Metadata; +import com.azure.storage.blob.models.Metrics; +import com.azure.storage.blob.models.PublicAccessType; +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; + +/** + * Code snippets for {@link BlobServiceClient} + */ +@SuppressWarnings({"unused"}) +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() + .setRead(true) + .setAdd(true) + .setCreate(true) + .setWrite(true) + .setDelete(true) + .setList(true) + .setProcessMessages(true) + .setUpdate(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#getContainerClient(String)} + */ + public void getContainerClient() { + // BEGIN: com.azure.storage.blob.BlobServiceClient.getContainerClient#String + ContainerClient containerClient = client.getContainerClient("containerName"); + // END: com.azure.storage.blob.BlobServiceClient.getContainerClient#String + } + + /** + * Code snippet for {@link BlobServiceClient#createContainer(String)} + */ + public void createContainer() { + // BEGIN: com.azure.storage.blob.BlobServiceClient.createContainer#String + ContainerClient containerClient = client.createContainer("containerName"); + // END: com.azure.storage.blob.BlobServiceClient.createContainer#String + } + + /** + * Code snippet for {@link BlobServiceClient#createContainerWithResponse(String, Metadata, PublicAccessType, Context)} + */ + public void createContainerWithResponse() { + // BEGIN: com.azure.storage.blob.BlobServiceClient.createContainerWithResponse#String-Metadata-PublicAccessType-Context + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + Context context = new Context("Key", "Value"); + + ContainerClient containerClient = client.createContainerWithResponse( + "containerName", + metadata, + PublicAccessType.CONTAINER, + context).getValue(); + // END: com.azure.storage.blob.BlobServiceClient.createContainerWithResponse#String-Metadata-PublicAccessType-Context + } + + /** + * Code snippet for {@link BlobServiceClient#deleteContainer(String)} + */ + public void deleteContainer() { + // BEGIN: com.azure.storage.blob.BlobServiceClient.deleteContainer#String + try { + client.deleteContainer("container Name"); + System.out.printf("Delete container completed with status %n"); + } catch (UnsupportedOperationException error) { + System.out.printf("Delete container failed: %s%n", error); + } + // END: com.azure.storage.blob.BlobServiceClient.deleteContainer#String + } + + /** + * Code snippet for {@link BlobServiceClient#deleteContainerWithResponse(String, Context)} + */ + public void deleteContainerWithResponse() { + // BEGIN: com.azure.storage.blob.BlobServiceClient.deleteContainerWithResponse#String-Context + Context context = new Context("Key", "Value"); + System.out.printf("Delete container completed with status %d%n", + client.deleteContainerWithResponse("containerName", context).getStatusCode()); + // END: com.azure.storage.blob.BlobServiceClient.deleteContainerWithResponse#String-Context + } + + /** + * Code snippets for {@link BlobServiceClient#listContainers()} and + * {@link BlobServiceClient#listContainers(ListContainersOptions, Duration)} + */ + public void listContainers() { + // BEGIN: com.azure.storage.blob.BlobServiceClient.listContainers + client.listContainers().forEach(container -> System.out.printf("Name: %s%n", container.getName())); + // END: com.azure.storage.blob.BlobServiceClient.listContainers + + // BEGIN: com.azure.storage.blob.BlobServiceClient.listContainers#ListContainersOptions-Duration + ListContainersOptions options = new ListContainersOptions() + .setPrefix("containerNamePrefixToMatch") + .setDetails(new ContainerListDetails().setMetadata(true)); + + client.listContainers(options, timeout).forEach(container -> System.out.printf("Name: %s%n", container.getName())); + // END: com.azure.storage.blob.BlobServiceClient.listContainers#ListContainersOptions-Duration + } + + /** + * Code snippet for {@link BlobServiceClient#getProperties()} + */ + public void getProperties() { + // BEGIN: com.azure.storage.blob.BlobServiceClient.getProperties + StorageServiceProperties properties = client.getProperties(); + + System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b%n", + properties.getHourMetrics().isEnabled(), + properties.getMinuteMetrics().isEnabled()); + // END: com.azure.storage.blob.BlobServiceClient.getProperties + } + + /** + * Code snippet for {@link BlobServiceClient#getPropertiesWithResponse(Duration, Context)} + */ + public void getPropertiesWithResponse() { + // BEGIN: com.azure.storage.blob.BlobServiceClient.getPropertiesWithResponse#Duration-Context + Context context = new Context("Key", "Value"); + StorageServiceProperties properties = client.getPropertiesWithResponse(timeout, context).getValue(); + + System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b%n", + properties.getHourMetrics().isEnabled(), + properties.getMinuteMetrics().isEnabled()); + // END: com.azure.storage.blob.BlobServiceClient.getPropertiesWithResponse#Duration-Context + } + + /** + * Code snippet for {@link BlobServiceClient#setProperties(StorageServiceProperties)} + */ + public void setProperties() { + // BEGIN: com.azure.storage.blob.BlobServiceClient.setProperties#StorageServiceProperties + RetentionPolicy loggingRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(3); + RetentionPolicy metricsRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(1); + + StorageServiceProperties properties = new StorageServiceProperties() + .setLogging(new Logging() + .setWrite(true) + .setDelete(true) + .setRetentionPolicy(loggingRetentionPolicy)) + .setHourMetrics(new Metrics() + .setEnabled(true) + .setRetentionPolicy(metricsRetentionPolicy)) + .setMinuteMetrics(new Metrics() + .setEnabled(true) + .setRetentionPolicy(metricsRetentionPolicy)); + + try { + client.setProperties(properties); + System.out.printf("Setting properties completed%n"); + } catch (UnsupportedOperationException error) { + System.out.printf("Setting properties failed: %s%n", error); + } + // END: com.azure.storage.blob.BlobServiceClient.setProperties#StorageServiceProperties + } + + /** + * Code snippet for {@link BlobServiceClient#setPropertiesWithResponse(StorageServiceProperties, Duration, Context)} + */ + public void setPropertiesWithResponse() { + // BEGIN: com.azure.storage.blob.BlobServiceClient.setPropertiesWithResponse#StorageServiceProperties-Duration-Context + RetentionPolicy loggingRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(3); + RetentionPolicy metricsRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(1); + + StorageServiceProperties properties = new StorageServiceProperties() + .setLogging(new Logging() + .setWrite(true) + .setDelete(true) + .setRetentionPolicy(loggingRetentionPolicy)) + .setHourMetrics(new Metrics() + .setEnabled(true) + .setRetentionPolicy(metricsRetentionPolicy)) + .setMinuteMetrics(new Metrics() + .setEnabled(true) + .setRetentionPolicy(metricsRetentionPolicy)); + + Context context = new Context("Key", "Value"); + + System.out.printf("Setting properties completed with status %d%n", + client.setPropertiesWithResponse(properties, timeout, context).getStatusCode()); + // END: com.azure.storage.blob.BlobServiceClient.setPropertiesWithResponse#StorageServiceProperties-Duration-Context + } + + /** + * Code snippets for {@link BlobServiceClient#getUserDelegationKey(OffsetDateTime, OffsetDateTime)} + * and {@link BlobServiceClient#getUserDelegationKeyWithResponse(OffsetDateTime, OffsetDateTime, Duration, Context)} + */ + public void getUserDelegationKey() { + OffsetDateTime delegationKeyStartTime = OffsetDateTime.now(); + OffsetDateTime delegationKeyExpiryTime = OffsetDateTime.now().plusDays(7); + Context context = new Context("Key", "Value"); + // BEGIN: com.azure.storage.blob.BlobServiceClient.getUserDelegationKey#OffsetDateTime-OffsetDateTime + System.out.printf("User delegation key: %s%n", + client.getUserDelegationKey(delegationKeyStartTime, delegationKeyExpiryTime)); + // END: com.azure.storage.blob.BlobServiceClient.getUserDelegationKey#OffsetDateTime-OffsetDateTime + + // BEGIN: com.azure.storage.blob.BlobServiceClient.getUserDelegationKeyWithResponse#OffsetDateTime-OffsetDateTime-Duration-Context + System.out.printf("User delegation key: %s%n", + client.getUserDelegationKeyWithResponse(delegationKeyStartTime, delegationKeyExpiryTime, timeout, context)); + // END: com.azure.storage.blob.BlobServiceClient.getUserDelegationKeyWithResponse#OffsetDateTime-OffsetDateTime-Duration-Context + } + + /** + * Code snippets for {@link BlobServiceClient#getStatistics()} and {@link BlobServiceClient#getStatisticsWithResponse(Duration, Context)} + */ + public void getStatistics() { + Context context = new Context("Key", "Value"); + // BEGIN: com.azure.storage.blob.BlobServiceClient.getStatistics + System.out.printf("Geo-replication status: %s%n", + client.getStatistics().getGeoReplication().getStatus()); + // END: com.azure.storage.blob.BlobServiceClient.getStatistics + + // BEGIN: com.azure.storage.blob.BlobServiceClient.getStatisticsWithResponse#Duration-Context + System.out.printf("Geo-replication status: %s%n", + client.getStatisticsWithResponse(timeout, context).getValue().getGeoReplication().getStatus()); + // END: com.azure.storage.blob.BlobServiceClient.getStatisticsWithResponse#Duration-Context + } + + /** + * Code snippet for {@link BlobServiceClient#getAccountInfo} + */ + public void getAccountInfo() { + // BEGIN: com.azure.storage.blob.BlobServiceClient.getAccountInfo + StorageAccountInfo accountInfo = client.getAccountInfo(); + + System.out.printf("Account kind: %s, SKU: %s%n", accountInfo.getAccountKind(), accountInfo.getSkuName()); + // END: com.azure.storage.blob.BlobServiceClient.getAccountInfo + } + + /** + * Code snippet for {@link BlobServiceClient#getAccountInfoWithResponse(Duration, Context)} + */ + public void getAccountInfoWithResponse() { + Context context = new Context("Key", "Value"); + // BEGIN: com.azure.storage.blob.BlobServiceClient.getAccountInfoWithResponse#Duration-Context + StorageAccountInfo accountInfo = client.getAccountInfoWithResponse(timeout, context).getValue(); + // END: com.azure.storage.blob.BlobServiceClient.getAccountInfoWithResponse#Duration-Context + } +} diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlockBlobAsyncClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlockBlobAsyncClientJavaDocCodeSnippets.java new file mode 100644 index 000000000000..992a0f598a6d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlockBlobAsyncClientJavaDocCodeSnippets.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +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.BlobRange; +import com.azure.storage.blob.models.BlockList; +import com.azure.storage.blob.models.BlockListType; +import com.azure.storage.blob.models.LeaseAccessConditions; +import com.azure.storage.blob.models.Metadata; +import com.azure.storage.blob.models.ModifiedAccessConditions; +import com.azure.storage.blob.models.SourceModifiedAccessConditions; +import reactor.core.publisher.Flux; + +import java.net.URL; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Base64; +import java.util.Collections; +import java.util.List; + +/** + * Code snippet for {@link BlockBlobAsyncClient} + */ +@SuppressWarnings({"unused"}) +public class BlockBlobAsyncClientJavaDocCodeSnippets { + private BlockBlobAsyncClient client = JavaDocCodeSnippetsHelpers.getBlobAsyncClient("blobName") + .asBlockBlobAsyncClient(); + + private Flux data = Flux.just(ByteBuffer.wrap("data".getBytes(StandardCharsets.UTF_8))); + private long length = 4L; + private String leaseId = "leaseId"; + private String filePath = "filePath"; + private String base64BlockID = "base64BlockID"; + private URL sourceURL = JavaDocCodeSnippetsHelpers.generateURL("https://example.com"); + private long offset = 1024L; + private long count = length; + private int blockSize = 50; + private int numBuffers = 2; + + /** + * + */ + public BlockBlobAsyncClientJavaDocCodeSnippets() { + } + + /** + * Code snippet for {@link BlockBlobAsyncClient#upload(Flux, long)} + */ + public void upload() { + // BEGIN: com.azure.storage.blob.BlockBlobAsyncClient.upload#Flux-long + client.upload(data, length).subscribe(response -> + System.out.printf("Uploaded BlockBlob MD5 is %s%n", + Base64.getEncoder().encodeToString(response.getContentMD5()))); + // END: com.azure.storage.blob.BlockBlobAsyncClient.upload#Flux-long + } + + /** + * Code snippet for {@link BlockBlobAsyncClient#uploadWithResponse(Flux, long, BlobHTTPHeaders, Metadata, AccessTier, BlobAccessConditions)} + */ + public void upload2() { + // BEGIN: com.azure.storage.blob.BlockBlobAsyncClient.uploadWithResponse#Flux-long-BlobHTTPHeaders-Metadata-AccessTier-BlobAccessConditions + BlobHTTPHeaders headers = new BlobHTTPHeaders() + .setBlobContentMD5("data".getBytes(StandardCharsets.UTF_8)) + .setBlobContentLanguage("en-US") + .setBlobContentType("binary"); + + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + BlobAccessConditions accessConditions = new BlobAccessConditions() + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3))); + + client.uploadWithResponse(data, length, 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.BlockBlobAsyncClient.uploadWithResponse#Flux-long-BlobHTTPHeaders-Metadata-AccessTier-BlobAccessConditions + } + + /** + * Code snippet for {@link BlockBlobAsyncClient#upload(Flux, int, int)} + */ + public void upload3() { + // BEGIN: com.azure.storage.blob.BlockBlobAsyncClient.upload#Flux-int-int + client.upload(data, blockSize, numBuffers).subscribe(response -> + System.out.printf("Uploaded BlockBlob MD5 is %s%n", + Base64.getEncoder().encodeToString(response.getContentMD5()))); + // END: com.azure.storage.blob.BlockBlobAsyncClient.upload#Flux-int-int + } + + /** + * Code snippet for {@link BlockBlobAsyncClient#uploadWithResponse(Flux, int, int, BlobHTTPHeaders, Metadata, AccessTier, BlobAccessConditions)} + */ + public void upload4() { + // BEGIN: com.azure.storage.blob.BlockBlobAsyncClient.uploadWithResponse#Flux-int-int-BlobHTTPHeaders-Metadata-AccessTier-BlobAccessConditions + BlobHTTPHeaders headers = new BlobHTTPHeaders() + .setBlobContentMD5("data".getBytes(StandardCharsets.UTF_8)) + .setBlobContentLanguage("en-US") + .setBlobContentType("binary"); + + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + BlobAccessConditions accessConditions = new BlobAccessConditions() + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3))); + + client.uploadWithResponse(data, blockSize, numBuffers, 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.BlockBlobAsyncClient.uploadWithResponse#Flux-int-int-BlobHTTPHeaders-Metadata-AccessTier-BlobAccessConditions + } + + /** + * Code snippet for {@link BlockBlobAsyncClient#uploadFromFile(String)} + */ + public void uploadFromFile() { + // BEGIN: com.azure.storage.blob.BlockBlobAsyncClient.uploadFromFile#String + client.uploadFromFile(filePath) + .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.BlockBlobAsyncClient.uploadFromFile#String + } + + /** + * Code snippet for {@link BlockBlobAsyncClient#uploadFromFile(String, Integer, BlobHTTPHeaders, Metadata, AccessTier, BlobAccessConditions)} + */ + public void uploadFromFile2() { + // BEGIN: com.azure.storage.blob.BlockBlobAsyncClient.uploadFromFile#String-Integer-BlobHTTPHeaders-Metadata-AccessTier-BlobAccessConditions + BlobHTTPHeaders headers = new BlobHTTPHeaders() + .setBlobContentMD5("data".getBytes(StandardCharsets.UTF_8)) + .setBlobContentLanguage("en-US") + .setBlobContentType("binary"); + + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + BlobAccessConditions accessConditions = new BlobAccessConditions() + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3))); + + client.uploadFromFile(filePath, BlockBlobAsyncClient.BLOB_MAX_UPLOAD_BLOCK_SIZE, + 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.BlockBlobAsyncClient.uploadFromFile#String-Integer-BlobHTTPHeaders-Metadata-AccessTier-BlobAccessConditions + } + + /** + * Code snippet for {@link BlockBlobAsyncClient#stageBlock(String, Flux, long)} + */ + public void stageBlock() { + // BEGIN: com.azure.storage.blob.BlockBlobAsyncClient.stageBlock#String-Flux-long + client.stageBlock(base64BlockID, data, length) + .subscribe( + response -> System.out.println("Staging block completed"), + error -> System.out.printf("Error when calling stage Block: %s", error)); + // END: com.azure.storage.blob.BlockBlobAsyncClient.stageBlock#String-Flux-long + } + + /** + * Code snippet for {@link BlockBlobAsyncClient#stageBlockWithResponse(String, Flux, long, LeaseAccessConditions)} + */ + public void stageBlock2() { + // BEGIN: com.azure.storage.blob.BlockBlobAsyncClient.stageBlockWithResponse#String-Flux-long-LeaseAccessConditions + LeaseAccessConditions accessConditions = new LeaseAccessConditions().setLeaseId(leaseId); + client.stageBlockWithResponse(base64BlockID, data, length, accessConditions).subscribe(response -> + System.out.printf("Staging block completed with status %d%n", response.getStatusCode())); + // END: com.azure.storage.blob.BlockBlobAsyncClient.stageBlockWithResponse#String-Flux-long-LeaseAccessConditions + } + + /** + * Code snippet for {@link BlockBlobAsyncClient#stageBlockFromURL(String, URL, BlobRange)} + */ + public void stageBlockFromURL() { + // BEGIN: com.azure.storage.blob.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.BlockBlobAsyncClient.stageBlockFromURL#String-URL-BlobRange + } + + /** + * Code snippet for {@link BlockBlobAsyncClient#stageBlockFromURLWithResponse(String, URL, BlobRange, byte[], LeaseAccessConditions, SourceModifiedAccessConditions)} + */ + public void stageBlockFromURL2() { + // BEGIN: com.azure.storage.blob.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, + leaseAccessConditions, sourceModifiedAccessConditions).subscribe(response -> + System.out.printf("Staging block from URL completed with status %d%n", response.getStatusCode())); + // END: com.azure.storage.blob.BlockBlobAsyncClient.stageBlockFromURLWithResponse#String-URL-BlobRange-byte-LeaseAccessConditions-SourceModifiedAccessConditions + } + + /** + * Code snippet for {@link BlockBlobAsyncClient#listBlocks(BlockListType)} + */ + public void listBlocks() { + // BEGIN: com.azure.storage.blob.BlockBlobAsyncClient.listBlocks#BlockListType + client.listBlocks(BlockListType.ALL).subscribe(block -> { + System.out.println("Committed Blocks:"); + block.getCommittedBlocks().forEach(b -> System.out.printf("Name: %s, Size: %d", b.getName(), b.getSize())); + + System.out.println("Uncommitted Blocks:"); + block.getUncommittedBlocks().forEach(b -> System.out.printf("Name: %s, Size: %d", b.getName(), b.getSize())); + }); + // END: com.azure.storage.blob.BlockBlobAsyncClient.listBlocks#BlockListType + } + + /** + * Code snippet for {@link BlockBlobAsyncClient#listBlocksWithResponse(BlockListType, LeaseAccessConditions)} + */ + public void listBlocks2() { + // BEGIN: com.azure.storage.blob.BlockBlobAsyncClient.listBlocksWithResponse#BlockListType-LeaseAccessConditions + LeaseAccessConditions accessConditions = new LeaseAccessConditions().setLeaseId(leaseId); + + client.listBlocksWithResponse(BlockListType.ALL, accessConditions).subscribe(response -> { + BlockList block = response.getValue(); + System.out.println("Committed Blocks:"); + block.getCommittedBlocks().forEach(b -> System.out.printf("Name: %s, Size: %d", b.getName(), b.getSize())); + + System.out.println("Uncommitted Blocks:"); + block.getUncommittedBlocks().forEach(b -> System.out.printf("Name: %s, Size: %d", b.getName(), b.getSize())); + }); + // END: com.azure.storage.blob.BlockBlobAsyncClient.listBlocksWithResponse#BlockListType-LeaseAccessConditions + } + + /** + * Code snippet for {@link BlockBlobAsyncClient#commitBlockList(List)} + */ + public void commitBlockList() { + // BEGIN: com.azure.storage.blob.BlockBlobAsyncClient.commitBlockList#List + client.commitBlockList(Collections.singletonList(base64BlockID)).subscribe(response -> + System.out.printf("Committing block list completed. Last modified: %s%n", response.getLastModified())); + // END: com.azure.storage.blob.BlockBlobAsyncClient.commitBlockList#List + } + + /** + * Code snippet for {@link BlockBlobAsyncClient#commitBlockListWithResponse(List, BlobHTTPHeaders, Metadata, AccessTier, BlobAccessConditions)} + */ + public void commitBlockList2() { + // BEGIN: com.azure.storage.blob.BlockBlobAsyncClient.commitBlockListWithResponse#List-BlobHTTPHeaders-Metadata-AccessTier-BlobAccessConditions + BlobHTTPHeaders headers = new BlobHTTPHeaders() + .setBlobContentMD5("data".getBytes(StandardCharsets.UTF_8)) + .setBlobContentLanguage("en-US") + .setBlobContentType("binary"); + + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + BlobAccessConditions accessConditions = new BlobAccessConditions() + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3))); + 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.BlockBlobAsyncClient.commitBlockListWithResponse#List-BlobHTTPHeaders-Metadata-AccessTier-BlobAccessConditions + } +} diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlockBlobClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlockBlobClientJavaDocCodeSnippets.java new file mode 100644 index 000000000000..fbb204a091ce --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlockBlobClientJavaDocCodeSnippets.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +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.BlobRange; +import com.azure.storage.blob.models.BlockList; +import com.azure.storage.blob.models.BlockListType; +import com.azure.storage.blob.models.LeaseAccessConditions; +import com.azure.storage.blob.models.Metadata; +import com.azure.storage.blob.models.ModifiedAccessConditions; +import com.azure.storage.blob.models.SourceModifiedAccessConditions; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.UncheckedIOException; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Base64; +import java.util.Collections; +import java.util.List; + +/** + * Code snippet for {@link BlockBlobClient} + */ +@SuppressWarnings({"unused"}) +public class BlockBlobClientJavaDocCodeSnippets { + private BlockBlobClient client = JavaDocCodeSnippetsHelpers.getBlobClient("blobName") + .asBlockBlobClient(); + + private InputStream data = new ByteArrayInputStream("data".getBytes(StandardCharsets.UTF_8)); + private long length = 4L; + private Duration timeout = Duration.ofSeconds(30); + private String leaseId = "leaseId"; + private String filePath = "filePath"; + private String base64BlockID = "base64BlockID"; + private URL sourceURL = JavaDocCodeSnippetsHelpers.generateURL("https://example.com"); + private long offset = 1024L; + private long count = length; + + /** + * + */ + public BlockBlobClientJavaDocCodeSnippets() { + } + + /** + * Code snippet for {@link BlockBlobClient#upload(InputStream, long)} + * + * @throws IOException If an I/O error occurs + */ + public void upload() throws IOException { + // BEGIN: com.azure.storage.blob.BlockBlobClient.upload#InputStream-long + System.out.printf("Uploaded BlockBlob MD5 is %s%n", + Base64.getEncoder().encodeToString(client.upload(data, length).getContentMD5())); + // END: com.azure.storage.blob.BlockBlobClient.upload#InputStream-long + } + + /** + * Code snippet for {@link BlockBlobClient#uploadWithResponse(InputStream, long, BlobHTTPHeaders, Metadata, AccessTier, BlobAccessConditions, Duration, Context)} + * + * @throws IOException If an I/O error occurs + */ + public void upload2() throws IOException { + // BEGIN: com.azure.storage.blob.BlockBlobClient.uploadWithResponse#InputStream-long-BlobHTTPHeaders-Metadata-AccessTier-BlobAccessConditions-Duration-Context + BlobHTTPHeaders headers = new BlobHTTPHeaders() + .setBlobContentMD5("data".getBytes(StandardCharsets.UTF_8)) + .setBlobContentLanguage("en-US") + .setBlobContentType("binary"); + + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + BlobAccessConditions accessConditions = new BlobAccessConditions() + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3))); + Context context = new Context("key", "value"); + + System.out.printf("Uploaded BlockBlob MD5 is %s%n", Base64.getEncoder() + .encodeToString(client.uploadWithResponse(data, length, headers, metadata, AccessTier.HOT, + accessConditions, timeout, context) + .getValue() + .getContentMD5())); + // END: com.azure.storage.blob.BlockBlobClient.uploadWithResponse#InputStream-long-BlobHTTPHeaders-Metadata-AccessTier-BlobAccessConditions-Duration-Context + } + + /** + * Code snippet for {@link BlockBlobClient#uploadFromFile(String)} + * + * @throws IOException If an I/O error occurs + */ + public void uploadFromFile() throws IOException { + // BEGIN: com.azure.storage.blob.BlockBlobClient.uploadFromFile#String + try { + client.uploadFromFile(filePath); + System.out.println("Upload from file succeeded"); + } catch (UncheckedIOException ex) { + System.err.printf("Failed to upload from file %s%n", ex.getMessage()); + } + // END: com.azure.storage.blob.BlockBlobClient.uploadFromFile#String + } + + /** + * Code snippet for {@link BlockBlobClient#uploadFromFile(String, BlobHTTPHeaders, Metadata, AccessTier, BlobAccessConditions, Duration)} + * + * @throws IOException If an I/O error occurs + */ + public void uploadFromFile2() throws IOException { + // BEGIN: com.azure.storage.blob.BlockBlobClient.uploadFromFile#String-BlobHTTPHeaders-Metadata-AccessTier-BlobAccessConditions-Duration + BlobHTTPHeaders headers = new BlobHTTPHeaders() + .setBlobContentMD5("data".getBytes(StandardCharsets.UTF_8)) + .setBlobContentLanguage("en-US") + .setBlobContentType("binary"); + + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + BlobAccessConditions accessConditions = new BlobAccessConditions() + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3))); + + try { + client.uploadFromFile(filePath, headers, metadata, AccessTier.HOT, accessConditions, timeout); + System.out.println("Upload from file succeeded"); + } catch (UncheckedIOException ex) { + System.err.printf("Failed to upload from file %s%n", ex.getMessage()); + } + // END: com.azure.storage.blob.BlockBlobClient.uploadFromFile#String-BlobHTTPHeaders-Metadata-AccessTier-BlobAccessConditions-Duration + } + + /** + * Code snippet for {@link BlockBlobClient#stageBlock(String, InputStream, long)} + */ + public void stageBlock() { + // BEGIN: com.azure.storage.blob.BlockBlobClient.stageBlock#String-InputStream-long + client.stageBlock(base64BlockID, data, length); + // END: com.azure.storage.blob.BlockBlobClient.stageBlock#String-InputStream-long + } + + /** + * Code snippet for {@link BlockBlobClient#stageBlockWithResponse(String, InputStream, long, LeaseAccessConditions, Duration, Context)} + */ + public void stageBlock2() { + // BEGIN: com.azure.storage.blob.BlockBlobClient.stageBlockWithResponse#String-InputStream-long-LeaseAccessConditions-Duration-Context + LeaseAccessConditions accessConditions = new LeaseAccessConditions().setLeaseId(leaseId); + Context context = new Context("key", "value"); + System.out.printf("Staging block completed with status %d%n", + client.stageBlockWithResponse(base64BlockID, data, length, accessConditions, timeout, context).getStatusCode()); + // END: com.azure.storage.blob.BlockBlobClient.stageBlockWithResponse#String-InputStream-long-LeaseAccessConditions-Duration-Context + } + + /** + * Code snippet for {@link BlockBlobClient#stageBlockFromURL(String, URL, BlobRange)} + */ + public void stageBlockFromURL() { + // BEGIN: com.azure.storage.blob.BlockBlobClient.stageBlockFromURL#String-URL-BlobRange + client.stageBlockFromURL(base64BlockID, sourceURL, new BlobRange(offset, count)); + // END: com.azure.storage.blob.BlockBlobClient.stageBlockFromURL#String-URL-BlobRange + } + + /** + * Code snippet for {@link BlockBlobClient#stageBlockFromURLWithResponse(String, URL, BlobRange, byte[], LeaseAccessConditions, SourceModifiedAccessConditions, Duration, Context)} + */ + public void stageBlockFromURL2() { + // BEGIN: com.azure.storage.blob.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, + leaseAccessConditions, sourceModifiedAccessConditions, timeout, context).getStatusCode()); + // END: com.azure.storage.blob.BlockBlobClient.stageBlockFromURLWithResponse#String-URL-BlobRange-byte-LeaseAccessConditions-SourceModifiedAccessConditions-Duration-Context + } + + /** + * Code snippet for {@link BlockBlobClient#listBlocks(BlockListType)} + */ + public void listBlocks() { + // BEGIN: com.azure.storage.blob.BlockBlobClient.listBlocks#BlockListType + BlockList block = client.listBlocks(BlockListType.ALL); + + System.out.println("Committed Blocks:"); + block.getCommittedBlocks().forEach(b -> System.out.printf("Name: %s, Size: %d", b.getName(), b.getSize())); + + System.out.println("Uncommitted Blocks:"); + block.getUncommittedBlocks().forEach(b -> System.out.printf("Name: %s, Size: %d", b.getName(), b.getSize())); + // END: com.azure.storage.blob.BlockBlobClient.listBlocks#BlockListType + } + + /** + * Code snippet for {@link BlockBlobClient#listBlocksWithResponse(BlockListType, LeaseAccessConditions, Duration, Context)} + */ + public void listBlocks2() { + // BEGIN: com.azure.storage.blob.BlockBlobClient.listBlocksWithResponse#BlockListType-LeaseAccessConditions-Duration-Context + LeaseAccessConditions accessConditions = new LeaseAccessConditions().setLeaseId(leaseId); + Context context = new Context("key", "value"); + BlockList block = client.listBlocksWithResponse(BlockListType.ALL, accessConditions, timeout, context).getValue(); + + System.out.println("Committed Blocks:"); + block.getCommittedBlocks().forEach(b -> System.out.printf("Name: %s, Size: %d", b.getName(), b.getSize())); + + System.out.println("Uncommitted Blocks:"); + block.getUncommittedBlocks().forEach(b -> System.out.printf("Name: %s, Size: %d", b.getName(), b.getSize())); + // END: com.azure.storage.blob.BlockBlobClient.listBlocksWithResponse#BlockListType-LeaseAccessConditions-Duration-Context + } + + /** + * Code snippet for {@link BlockBlobClient#commitBlockList(List)} + */ + public void commitBlockList() { + // BEGIN: com.azure.storage.blob.BlockBlobClient.commitBlockList#List + System.out.printf("Committing block list completed. Last modified: %s%n", + client.commitBlockList(Collections.singletonList(base64BlockID)).getLastModified()); + // END: com.azure.storage.blob.BlockBlobClient.commitBlockList#List + } + + /** + * Code snippet for {@link BlockBlobClient#commitBlockListWithResponse(List, BlobHTTPHeaders, Metadata, AccessTier, BlobAccessConditions, Duration, Context)} + */ + public void commitBlockList2() { + // BEGIN: com.azure.storage.blob.BlockBlobClient.commitBlockListWithResponse#List-BlobHTTPHeaders-Metadata-AccessTier-BlobAccessConditions-Duration-Context + BlobHTTPHeaders headers = new BlobHTTPHeaders() + .setBlobContentMD5("data".getBytes(StandardCharsets.UTF_8)) + .setBlobContentLanguage("en-US") + .setBlobContentType("binary"); + + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + BlobAccessConditions accessConditions = new BlobAccessConditions() + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3))); + Context context = new Context("key", "value"); + + 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.BlockBlobClient.commitBlockListWithResponse#List-BlobHTTPHeaders-Metadata-AccessTier-BlobAccessConditions-Duration-Context + } +} diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/ContainerAsyncClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/ContainerAsyncClientJavaDocCodeSnippets.java new file mode 100644 index 000000000000..1dd147f17fff --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/ContainerAsyncClientJavaDocCodeSnippets.java @@ -0,0 +1,589 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +import com.azure.core.util.Context; +import com.azure.storage.blob.models.AccessPolicy; +import com.azure.storage.blob.models.BlobListDetails; +import com.azure.storage.blob.models.ContainerAccessConditions; +import com.azure.storage.blob.models.LeaseAccessConditions; +import com.azure.storage.blob.models.ListBlobsOptions; +import com.azure.storage.blob.models.Metadata; +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; +import java.util.Collections; +import java.util.List; + +/** + * Code snippets for {@link ContainerAsyncClient} + */ +@SuppressWarnings({"unused"}) +public class ContainerAsyncClientJavaDocCodeSnippets { + + private ContainerAsyncClient client = JavaDocCodeSnippetsHelpers.getContainerAsyncClient(); + private String blobName = "blobName"; + private String snapshot = "snapshot"; + private String leaseId = "leaseId"; + private String proposedId = "proposedId"; + private int leaseDuration = (int) Duration.ofSeconds(30).getSeconds(); + + /** + * Code snippet for {@link ContainerAsyncClient#generateUserDelegationSAS(UserDelegationKey, String, + * ContainerSASPermission, OffsetDateTime, OffsetDateTime, String, SASProtocol, IPRange, String, String, String, + * String, String)} + */ + public void generateUserDelegationSASCodeSnippets() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.generateUserDelegationSAS#UserDelegationKey-String-ContainerSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IPRange-String-String-String-String-String + ContainerSASPermission permissions = new ContainerSASPermission() + .setRead(true) + .setWrite(true) + .setCreate(true) + .setDelete(true) + .setAdd(true) + .setList(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.ContainerAsyncClient.generateUserDelegationSAS#UserDelegationKey-String-ContainerSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IPRange-String-String-String-String-String + } + + /** + * Code snippet for {@link ContainerAsyncClient#generateSAS(String, ContainerSASPermission, OffsetDateTime, + * OffsetDateTime, String, SASProtocol, IPRange, String, String, String, String, String)} + */ + public void generateSASCodeSnippets() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.generateSAS#String-ContainerSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IPRange-String-String-String-String-String + ContainerSASPermission permissions = new ContainerSASPermission() + .setRead(true) + .setWrite(true) + .setCreate(true) + .setDelete(true) + .setAdd(true) + .setList(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.ContainerAsyncClient.generateSAS#String-ContainerSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IPRange-String-String-String-String-String + } + + /** + * Code snippet for {@link ContainerAsyncClient#getBlobAsyncClient(String)} + */ + public void getBlobAsyncClient() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.getBlobAsyncClient#String + BlobAsyncClient blobAsyncClient = client.getBlobAsyncClient(blobName); + // END: com.azure.storage.blob.ContainerAsyncClient.getBlobAsyncClient#String + } + + /** + * Code snippet for {@link ContainerAsyncClient#getBlobAsyncClient(String, String)} + */ + public void getSnapshotBlobAsyncClient() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.getBlobAsyncClient#String-String + BlobAsyncClient blobAsyncClient = client.getBlobAsyncClient(blobName, snapshot); + // END: com.azure.storage.blob.ContainerAsyncClient.getBlobAsyncClient#String-String + } + + /** + * Code snippet for {@link ContainerAsyncClient#getAppendBlobAsyncClient(String)} + */ + public void getAppendBlobAsyncClient() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.getAppendBlobAsyncClient#String + AppendBlobAsyncClient appendBlobAsyncClient = client.getAppendBlobAsyncClient(blobName); + // END: com.azure.storage.blob.ContainerAsyncClient.getAppendBlobAsyncClient#String + } + + /** + * Code snippet for {@link ContainerAsyncClient#getAppendBlobAsyncClient(String, String)} + */ + public void getSnapshotAppendBlobAsyncClient() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.getAppendBlobAsyncClient#String-String + AppendBlobAsyncClient appendBlobAsyncClient = client.getAppendBlobAsyncClient(blobName, snapshot); + // END: com.azure.storage.blob.ContainerAsyncClient.getAppendBlobAsyncClient#String-String + } + + /** + * Code snippet for {@link ContainerAsyncClient#getBlockBlobAsyncClient(String)} + */ + public void getBlockBlobAsyncClient() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.getBlockBlobAsyncClient#String + BlockBlobAsyncClient blockBlobAsyncClient = client.getBlockBlobAsyncClient(blobName); + // END: com.azure.storage.blob.ContainerAsyncClient.getBlockBlobAsyncClient#String + } + + /** + * Code snippet for {@link ContainerAsyncClient#getBlockBlobAsyncClient(String, String)} + */ + public void getSnapshotBlockBlobAsyncClient() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.getBlockBlobAsyncClient#String-String + BlockBlobAsyncClient blockBlobAsyncClient = client.getBlockBlobAsyncClient(blobName, snapshot); + // END: com.azure.storage.blob.ContainerAsyncClient.getBlockBlobAsyncClient#String-String + } + + /** + * Code snippet for {@link ContainerAsyncClient#getPageBlobAsyncClient(String)} + */ + public void getPageBlobAsyncClient() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.getPageBlobAsyncClient#String + PageBlobAsyncClient pageBlobAsyncClient = client.getPageBlobAsyncClient(blobName); + // END: com.azure.storage.blob.ContainerAsyncClient.getPageBlobAsyncClient#String + } + + /** + * Code snippet for {@link ContainerAsyncClient#getPageBlobAsyncClient(String, String)} + */ + public void getSnapshotPageBlobAsyncClient() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.getPageBlobAsyncClient#String-String + PageBlobAsyncClient pageBlobAsyncClient = client.getPageBlobAsyncClient(blobName, snapshot); + // END: com.azure.storage.blob.ContainerAsyncClient.getPageBlobAsyncClient#String-String + } + + /** + * Code snippet for {@link ContainerAsyncClient#exists()} + */ + public void exists() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.exists + client.exists().subscribe(response -> System.out.printf("Exists? %b%n", response)); + // END: com.azure.storage.blob.ContainerAsyncClient.exists + } + + /** + * Code snippet for {@link ContainerAsyncClient#existsWithResponse()} + */ + public void existsWithResponse() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.existsWithResponse + client.existsWithResponse().subscribe(response -> System.out.printf("Exists? %b%n", response.getValue())); + // END: com.azure.storage.blob.ContainerAsyncClient.existsWithResponse + } + + /** + * Code snippet for {@link ContainerAsyncClient#existsWithResponse(Context)} + */ + public void existsWithResponse2() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.existsWithResponse-Context + Context context = new Context("key", "value"); + client.existsWithResponse(context).subscribe(response -> System.out.printf("Exists? %b%n", response.getValue())); + // END: com.azure.storage.blob.ContainerAsyncClient.existsWithResponse-Context + } + + /** + * Code snippet for {@link ContainerAsyncClient#create()} + */ + public void setCreate() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.create + client.create().subscribe( + response -> System.out.printf("Create completed%n"), + error -> System.out.printf("Error while creating container %s%n", error)); + // END: com.azure.storage.blob.ContainerAsyncClient.create + } + + /** + * Code snippet for {@link ContainerAsyncClient#createWithResponse(Metadata, PublicAccessType)} + */ + public void create2() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.createWithResponse#Metadata-PublicAccessType + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + + client.createWithResponse(metadata, PublicAccessType.CONTAINER).subscribe(response -> + System.out.printf("Create completed with status %d%n", response.getStatusCode())); + // END: com.azure.storage.blob.ContainerAsyncClient.createWithResponse#Metadata-PublicAccessType + } + + /** + * Code snippet for {@link ContainerAsyncClient#delete()} + */ + public void setDelete() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.delete + client.delete().subscribe( + response -> System.out.printf("Delete completed%n"), + error -> System.out.printf("Delete failed: %s%n", error)); + // END: com.azure.storage.blob.ContainerAsyncClient.delete + } + + /** + * Code snippet for {@link ContainerAsyncClient#deleteWithResponse(ContainerAccessConditions)} + */ + public void delete2() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.deleteWithResponse#ContainerAccessConditions + ContainerAccessConditions accessConditions = new ContainerAccessConditions() + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3))); + + client.deleteWithResponse(accessConditions).subscribe(response -> + System.out.printf("Delete completed with status %d%n", response.getStatusCode())); + // END: com.azure.storage.blob.ContainerAsyncClient.deleteWithResponse#ContainerAccessConditions + } + + /** + * Code snippet for {@link ContainerAsyncClient#getProperties()} + */ + public void getProperties() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.getProperties + client.getProperties().subscribe(response -> + System.out.printf("Public Access Type: %s, Legal Hold? %b, Immutable? %b%n", + response.getBlobPublicAccess(), + response.hasLegalHold(), + response.hasImmutabilityPolicy())); + // END: com.azure.storage.blob.ContainerAsyncClient.getProperties + } + + /** + * Code snippet for {@link ContainerAsyncClient#getPropertiesWithResponse(LeaseAccessConditions)} + */ + public void getProperties2() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.getPropertiesWithResponse#LeaseAccessConditions + LeaseAccessConditions accessConditions = new LeaseAccessConditions().setLeaseId(leaseId); + + client.getPropertiesWithResponse(accessConditions).subscribe(response -> + System.out.printf("Public Access Type: %s, Legal Hold? %b, Immutable? %b%n", + response.getValue().getBlobPublicAccess(), + response.getValue().hasLegalHold(), + response.getValue().hasImmutabilityPolicy())); + // END: com.azure.storage.blob.ContainerAsyncClient.getPropertiesWithResponse#LeaseAccessConditions + } + + /** + * Code snippet for {@link ContainerAsyncClient#setMetadata(Metadata)} + */ + public void setMetadata() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.setMetadata#Metadata + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + + client.setMetadata(metadata).subscribe( + response -> System.out.printf("Set metadata completed%n"), + error -> System.out.printf("Set metadata failed: %s%n", error)); + // END: com.azure.storage.blob.ContainerAsyncClient.setMetadata#Metadata + } + + /** + * Code snippet for {@link ContainerAsyncClient#setMetadataWithResponse(Metadata, ContainerAccessConditions)} + */ + public void setMetadata2() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.setMetadataWithResponse#Metadata-ContainerAccessConditions + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + ContainerAccessConditions accessConditions = new ContainerAccessConditions() + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3))); + + client.setMetadataWithResponse(metadata, accessConditions).subscribe(response -> + System.out.printf("Set metadata completed with status %d%n", response.getStatusCode())); + // END: com.azure.storage.blob.ContainerAsyncClient.setMetadataWithResponse#Metadata-ContainerAccessConditions + } + + /** + * Code snippet for {@link ContainerAsyncClient#getAccessPolicy()} + */ + public void getAccessPolicy() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.getAccessPolicy + client.getAccessPolicy().subscribe(response -> { + System.out.printf("Blob Access Type: %s%n", response.getBlobAccessType()); + + for (SignedIdentifier identifier : response.getIdentifiers()) { + System.out.printf("Identifier Name: %s, Permissions %s%n", + identifier.getId(), + identifier.getAccessPolicy().getPermission()); + } + }); + // END: com.azure.storage.blob.ContainerAsyncClient.getAccessPolicy + } + + /** + * Code snippet for {@link ContainerAsyncClient#getAccessPolicyWithResponse(LeaseAccessConditions)} + */ + public void getAccessPolicy2() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.getAccessPolicyWithResponse#LeaseAccessConditions + LeaseAccessConditions accessConditions = new LeaseAccessConditions().setLeaseId(leaseId); + + client.getAccessPolicyWithResponse(accessConditions).subscribe(response -> { + System.out.printf("Blob Access Type: %s%n", response.getValue().getBlobAccessType()); + + for (SignedIdentifier identifier : response.getValue().getIdentifiers()) { + System.out.printf("Identifier Name: %s, Permissions %s%n", + identifier.getId(), + identifier.getAccessPolicy().getPermission()); + } + }); + // END: com.azure.storage.blob.ContainerAsyncClient.getAccessPolicyWithResponse#LeaseAccessConditions + } + + /** + * Code snippet for {@link ContainerAsyncClient#setAccessPolicy(PublicAccessType, List)} + */ + public void setAccessPolicy() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.setAccessPolicy#PublicAccessType-List + SignedIdentifier identifier = new SignedIdentifier() + .setId("name") + .setAccessPolicy(new AccessPolicy() + .setStart(OffsetDateTime.now()) + .setExpiry(OffsetDateTime.now().plusDays(7)) + .setPermission("permissionString")); + + client.setAccessPolicy(PublicAccessType.CONTAINER, Collections.singletonList(identifier)).subscribe( + response -> System.out.printf("Set access policy completed%n"), + error -> System.out.printf("Set access policy failed: %s%n", error)); + // END: com.azure.storage.blob.ContainerAsyncClient.setAccessPolicy#PublicAccessType-List + } + + /** + * Code snippet for {@link ContainerAsyncClient#setAccessPolicyWithResponse(PublicAccessType, List, ContainerAccessConditions)} + */ + public void setAccessPolicy2() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.setAccessPolicyWithResponse#PublicAccessType-List-ContainerAccessConditions + SignedIdentifier identifier = new SignedIdentifier() + .setId("name") + .setAccessPolicy(new AccessPolicy() + .setStart(OffsetDateTime.now()) + .setExpiry(OffsetDateTime.now().plusDays(7)) + .setPermission("permissionString")); + + ContainerAccessConditions accessConditions = new ContainerAccessConditions() + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3))); + + client.setAccessPolicyWithResponse(PublicAccessType.CONTAINER, Collections.singletonList(identifier), accessConditions) + .subscribe(response -> + System.out.printf("Set access policy completed with status %d%n", response.getStatusCode())); + // END: com.azure.storage.blob.ContainerAsyncClient.setAccessPolicyWithResponse#PublicAccessType-List-ContainerAccessConditions + } + + /** + * Code snippet for {@link ContainerAsyncClient#listBlobsFlat()} + */ + public void listBlobsFlat() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.listBlobsFlat + client.listBlobsFlat().subscribe(blob -> + System.out.printf("Name: %s, Directory? %b%n", blob.getName(), blob.isPrefix())); + // END: com.azure.storage.blob.ContainerAsyncClient.listBlobsFlat + } + + /** + * Code snippet for {@link ContainerAsyncClient#listBlobsFlat(ListBlobsOptions)} + */ + public void listBlobsFlat2() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.listBlobsFlat#ListBlobsOptions + ListBlobsOptions options = new ListBlobsOptions() + .setPrefix("prefixToMatch") + .setDetails(new BlobListDetails() + .setDeletedBlobs(true) + .setSnapshots(true)); + + client.listBlobsFlat(options).subscribe(blob -> + System.out.printf("Name: %s, Directory? %b, Deleted? %b, Snapshot ID: %s%n", + blob.getName(), + blob.isPrefix(), + blob.isDeleted(), + blob.getSnapshot())); + // END: com.azure.storage.blob.ContainerAsyncClient.listBlobsFlat#ListBlobsOptions + } + + /** + * Code snippet for {@link ContainerAsyncClient#listBlobsHierarchy(String)} + */ + public void listBlobsHierarchy() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.listBlobsHierarchy#String + client.listBlobsHierarchy("directoryName").subscribe(blob -> + System.out.printf("Name: %s, Directory? %b%n", blob.getName(), blob.isDeleted())); + // END: com.azure.storage.blob.ContainerAsyncClient.listBlobsHierarchy#String + } + + /** + * Code snippet for {@link ContainerAsyncClient#listBlobsHierarchy(String, ListBlobsOptions)} + */ + public void listBlobsHierarchy2() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.listBlobsHierarchy#String-ListBlobsOptions + ListBlobsOptions options = new ListBlobsOptions() + .setPrefix("directoryName") + .setDetails(new BlobListDetails() + .setDeletedBlobs(true) + .setSnapshots(true)); + + client.listBlobsHierarchy("/", options).subscribe(blob -> + System.out.printf("Name: %s, Directory? %b, Deleted? %b, Snapshot ID: %s%n", + blob.getName(), + blob.isPrefix(), + blob.isDeleted(), + blob.getSnapshot())); + // END: com.azure.storage.blob.ContainerAsyncClient.listBlobsHierarchy#String-ListBlobsOptions + } + + /** + * Code snippet for {@link ContainerAsyncClient#acquireLease(String, int)} + */ + public void acquireLease() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.acquireLease#String-int + client.acquireLease(proposedId, leaseDuration).subscribe(response -> + System.out.printf("Lease ID: %s%n", response)); + // END: com.azure.storage.blob.ContainerAsyncClient.acquireLease#String-int + } + + /** + * Code snippet for {@link ContainerAsyncClient#acquireLeaseWithResponse(String, int, ModifiedAccessConditions)} + */ + public void acquireLease2() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.acquireLeaseWithResponse#String-int-ModifiedAccessConditions + ModifiedAccessConditions accessConditions = new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + client.acquireLeaseWithResponse(proposedId, leaseDuration, accessConditions).subscribe(response -> + System.out.printf("Lease ID: %s%n", response.getValue())); + // END: com.azure.storage.blob.ContainerAsyncClient.acquireLeaseWithResponse#String-int-ModifiedAccessConditions + } + + /** + * Code snippet for {@link ContainerAsyncClient#renewLease(String)} + */ + public void renewLease() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.renewLease#String + client.renewLease(leaseId).subscribe(response -> + System.out.printf("Renewed Lease ID: %s%n", response)); + // END: com.azure.storage.blob.ContainerAsyncClient.renewLease#String + } + + /** + * Code snippet for {@link ContainerAsyncClient#renewLeaseWithResponse(String, ModifiedAccessConditions)} + */ + public void renewLease2() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.renewLeaseWithResponse#String-ModifiedAccessConditions + ModifiedAccessConditions accessConditions = new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + client.renewLeaseWithResponse(leaseId, accessConditions).subscribe(response -> + System.out.printf("Renewed Lease ID: %s%n", response.getValue())); + // END: com.azure.storage.blob.ContainerAsyncClient.renewLeaseWithResponse#String-ModifiedAccessConditions + } + + /** + * Code snippet for {@link ContainerAsyncClient#releaseLease(String)} + */ + public void releaseLease() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.releaseLease#String + client.releaseLease(leaseId).subscribe( + response -> System.out.printf("Release lease completed%n"), + error -> System.out.printf("Release lease failed: %s%n", error)); + // END: com.azure.storage.blob.ContainerAsyncClient.releaseLease#String + } + + /** + * Code snippet for {@link ContainerAsyncClient#releaseLeaseWithResponse(String, ModifiedAccessConditions)} + */ + public void releaseLease2() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.releaseLeaseWithResponse#String-ModifiedAccessConditions + ModifiedAccessConditions accessConditions = new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + client.releaseLeaseWithResponse(leaseId, accessConditions).subscribe(response -> + System.out.printf("Release lease completed with status %d%n", response.getStatusCode())); + // END: com.azure.storage.blob.ContainerAsyncClient.releaseLeaseWithResponse#String-ModifiedAccessConditions + } + + /** + * Code snippet for {@link ContainerAsyncClient#breakLease()} + */ + public void breakLease() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.breakLease + client.breakLease().subscribe(response -> + System.out.printf("Broken lease had %d seconds remaining on the lease%n", response.getSeconds())); + // END: com.azure.storage.blob.ContainerAsyncClient.breakLease + } + + /** + * Code snippet for {@link ContainerAsyncClient#breakLeaseWithResponse(Integer, ModifiedAccessConditions)} + */ + public void breakLease2() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.breakLeaseWithResponse#Integer-ModifiedAccessConditions + ModifiedAccessConditions accessConditions = new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + client.breakLeaseWithResponse(10, accessConditions).subscribe(response -> + System.out.printf("Broken lease had %d seconds remaining on the lease%n", response.getValue().getSeconds())); + // END: com.azure.storage.blob.ContainerAsyncClient.breakLeaseWithResponse#Integer-ModifiedAccessConditions + } + + /** + * Code snippet for {@link ContainerAsyncClient#changeLease(String, String)} + */ + public void changeLease() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.changeLease#String-String + client.changeLease(leaseId, proposedId).subscribe(response -> + System.out.printf("Changed Lease ID: %s%n", response)); + // END: com.azure.storage.blob.ContainerAsyncClient.changeLease#String-String + } + + /** + * Code snippet for {@link ContainerAsyncClient#changeLeaseWithResponse(String, String, ModifiedAccessConditions)} + */ + public void changeLease2() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.changeLeaseWithResponse#String-String-ModifiedAccessConditions + ModifiedAccessConditions accessConditions = new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + client.changeLeaseWithResponse(leaseId, proposedId, accessConditions).subscribe(response -> + System.out.printf("Changed Lease ID: %s%n", response.getValue())); + // END: com.azure.storage.blob.ContainerAsyncClient.changeLeaseWithResponse#String-String-ModifiedAccessConditions + } + + /** + * Code snippet for {@link ContainerAsyncClient#getAccountInfo()} + */ + public void getAccountInfo() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.getAccountInfo + client.getAccountInfo().subscribe(response -> + System.out.printf("Account Kind: %s, SKU: %s%n", + response.getAccountKind(), + response.getSkuName())); + // END: com.azure.storage.blob.ContainerAsyncClient.getAccountInfo + } + + /** + * Code snippet for {@link ContainerAsyncClient#getAccountInfoWithResponse()} + */ + public void getAccountInfo2() { + // BEGIN: com.azure.storage.blob.ContainerAsyncClient.getAccountInfoWithResponse + client.getAccountInfoWithResponse().subscribe(response -> + System.out.printf("Account Kind: %s, SKU: %s%n", + response.getValue().getAccountKind(), + response.getValue().getSkuName())); + // END: com.azure.storage.blob.ContainerAsyncClient.getAccountInfoWithResponse + } +} diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/ContainerClientBuilderJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/ContainerClientBuilderJavaDocCodeSnippets.java new file mode 100644 index 000000000000..576584ffb66e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/ContainerClientBuilderJavaDocCodeSnippets.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.storage.common.credentials.SharedKeyCredential; +import com.azure.storage.common.policy.RequestRetryOptions; +import com.azure.storage.common.policy.RequestRetryPolicy; +import com.azure.storage.common.policy.SharedKeyCredentialPolicy; + +/** + * Code snippets for {@link ContainerClientBuilder} + */ +@SuppressWarnings({"unused"}) +public class ContainerClientBuilderJavaDocCodeSnippets { + private String connectionString = "AccountName=name;AccountKey=key;DefaultEndpointProtocol=protocol;EndpointSuffix=suffix"; + private String endpoint = "endpointURL"; + private String containerName = "container Name"; + private SharedKeyCredential sharedKeyCredential = new SharedKeyCredential("accountName", "accountKey"); + private HttpPipeline httpPipeline = new HttpPipelineBuilder() + .httpClient(HttpClient.createDefault()) + .policies(new AddDatePolicy()) + .policies(new RequestIdPolicy()) + .policies(new SharedKeyCredentialPolicy(sharedKeyCredential)) + .policies(new RequestRetryPolicy(new RequestRetryOptions())) + .build(); + + /** + * Code snippet for {@link ContainerClientBuilder#buildClient()} using connection string + */ + public void containerClientConnectionString() { + // BEGIN: com.azure.storage.blob.ContainerClientBuilder.buildClient + ContainerClient client = new ContainerClientBuilder() + .connectionString(connectionString) + .buildClient(); + // END: com.azure.storage.blob.ContainerClientBuilder.buildClient + } + + /** + * Code snippet for {@link ContainerClientBuilder#buildAsyncClient()} using connection string + */ + public void containerAsyncClientConnectionString() { + // BEGIN: com.azure.storage.blob.ContainerClientBuilder.buildAsyncClient + ContainerAsyncClient client = new ContainerClientBuilder() + .connectionString(connectionString) + .buildAsyncClient(); + // END: com.azure.storage.blob.ContainerClientBuilder.buildAsyncClient + } + + /** + * Code snippet for {@link ContainerClientBuilder#buildClient()} using credential and endpoint + */ + public void containerClientCredentialAndEndpoint() { + // BEGIN: com.azure.storage.blob.ContainerClientBuilder.endpoint#String + ContainerClient client = new ContainerClientBuilder() + .endpoint(endpoint) + .credential(sharedKeyCredential) + .buildClient(); + // END: com.azure.storage.blob.ContainerClientBuilder.endpoint#String + } + + /** + * Code snippet for {@link ContainerClientBuilder#buildClient()} using Container Name + */ + public void containerClientContainerName() { + // BEGIN: com.azure.storage.blob.ContainerClientBuilder.containerName#String + ContainerClient client = new ContainerClientBuilder() + .endpoint(endpoint) + .containerName(containerName) + .buildClient(); + // END: com.azure.storage.blob.ContainerClientBuilder.containerName#String + } +} diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/ContainerClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/ContainerClientJavaDocCodeSnippets.java new file mode 100644 index 000000000000..315b12e71028 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/ContainerClientJavaDocCodeSnippets.java @@ -0,0 +1,629 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +import com.azure.core.util.Context; +import com.azure.storage.blob.models.AccessPolicy; +import com.azure.storage.blob.models.BlobListDetails; +import com.azure.storage.blob.models.ContainerAccessConditions; +import com.azure.storage.blob.models.ContainerAccessPolicies; +import com.azure.storage.blob.models.LeaseAccessConditions; +import com.azure.storage.blob.models.ListBlobsOptions; +import com.azure.storage.blob.models.Metadata; +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.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; +import java.util.Collections; +import java.util.List; + +@SuppressWarnings({"unused"}) +public class ContainerClientJavaDocCodeSnippets { + + private ContainerClient client = JavaDocCodeSnippetsHelpers.getContainerClient(); + private String blobName = "blobName"; + private String snapshot = "snapshot"; + private String leaseId = "leaseId"; + private String proposedId = "proposedId"; + private int leaseDuration = (int) Duration.ofSeconds(30).getSeconds(); + private Duration timeout = Duration.ofSeconds(30); + + /** + * Code snippet for {@link ContainerClient#generateUserDelegationSAS(UserDelegationKey, String, + * ContainerSASPermission, OffsetDateTime, OffsetDateTime, String, SASProtocol, IPRange, String, String, String, + * String, String)} + */ + public void generateUserDelegationSASCodeSnippets() { + // BEGIN: com.azure.storage.blob.ContainerClient.generateUserDelegationSAS#UserDelegationKey-String-ContainerSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IPRange-String-String-String-String-String + ContainerSASPermission permissions = new ContainerSASPermission() + .setRead(true) + .setWrite(true) + .setCreate(true) + .setDelete(true) + .setAdd(true) + .setList(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.ContainerClient.generateUserDelegationSAS#UserDelegationKey-String-ContainerSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IPRange-String-String-String-String-String + } + + /** + * Code snippet for {@link ContainerClient#generateSAS(String, ContainerSASPermission, OffsetDateTime, + * OffsetDateTime, String, SASProtocol, IPRange, String, String, String, String, String)} + */ + public void generateSASCodeSnippets() { + // BEGIN: com.azure.storage.blob.ContainerClient.generateSAS#String-ContainerSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IPRange-String-String-String-String-String + ContainerSASPermission permissions = new ContainerSASPermission() + .setRead(true) + .setWrite(true) + .setCreate(true) + .setDelete(true) + .setAdd(true) + .setList(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.ContainerClient.generateSAS#String-ContainerSASPermission-OffsetDateTime-OffsetDateTime-String-SASProtocol-IPRange-String-String-String-String-String + } + + /** + * Code snippet for {@link ContainerClient#getBlobClient(String)} + */ + public void getBlobClient() { + // BEGIN: com.azure.storage.blob.ContainerClient.getBlobClient#String + BlobClient blobClient = client.getBlobClient(blobName); + // END: com.azure.storage.blob.ContainerClient.getBlobClient#String + } + + /** + * Code snippet for {@link ContainerClient#getBlobClient(String, String)} + */ + public void getSnapshotBlobClient() { + // BEGIN: com.azure.storage.blob.ContainerClient.getBlobClient#String-String + BlobClient blobClient = client.getBlobClient(blobName, snapshot); + // END: com.azure.storage.blob.ContainerClient.getBlobClient#String-String + } + + /** + * Code snippet for {@link ContainerClient#getAppendBlobClient(String)} + */ + public void getAppendBlobClient() { + // BEGIN: com.azure.storage.blob.ContainerClient.getAppendBlobClient#String + AppendBlobClient appendBlobClient = client.getAppendBlobClient(blobName); + // END: com.azure.storage.blob.ContainerClient.getAppendBlobClient#String + } + + /** + * Code snippet for {@link ContainerClient#getAppendBlobClient(String, String)} + */ + public void getSnapshotAppendBlobClient() { + // BEGIN: com.azure.storage.blob.ContainerClient.getAppendBlobClient#String-String + AppendBlobClient appendBlobClient = client.getAppendBlobClient(blobName, snapshot); + // END: com.azure.storage.blob.ContainerClient.getAppendBlobClient#String-String + } + + /** + * Code snippet for {@link ContainerClient#getBlockBlobClient(String)} + */ + public void getBlockBlobClient() { + // BEGIN: com.azure.storage.blob.ContainerClient.getBlockBlobClient#String + BlockBlobClient blockBlobClient = client.getBlockBlobClient(blobName); + // END: com.azure.storage.blob.ContainerClient.getBlockBlobClient#String + } + + /** + * Code snippet for {@link ContainerClient#getBlockBlobClient(String, String)} + */ + public void getSnapshotBlockBlobClient() { + // BEGIN: com.azure.storage.blob.ContainerClient.getBlockBlobClient#String-String + BlockBlobClient blockBlobClient = client.getBlockBlobClient(blobName, snapshot); + // END: com.azure.storage.blob.ContainerClient.getBlockBlobClient#String-String + } + + /** + * Code snippet for {@link ContainerClient#getPageBlobClient(String)} + */ + public void getPageBlobClient() { + // BEGIN: com.azure.storage.blob.ContainerClient.getPageBlobClient#String + PageBlobClient pageBlobClient = client.getPageBlobClient(blobName); + // END: com.azure.storage.blob.ContainerClient.getPageBlobClient#String + } + + /** + * Code snippet for {@link ContainerClient#getPageBlobClient(String, String)} + */ + public void getSnapshotPageBlobClient() { + // BEGIN: com.azure.storage.blob.ContainerClient.getPageBlobClient#String-String + PageBlobClient pageBlobClient = client.getPageBlobClient(blobName, snapshot); + // END: com.azure.storage.blob.ContainerClient.getPageBlobClient#String-String + } + + /** + * Code snippets for {@link ContainerClient#exists()} and {@link ContainerClient#existsWithResponse(Duration, + * Context)} + */ + public void exists() { + // BEGIN: com.azure.storage.blob.ContainerClient.exists + System.out.printf("Exists? %b%n", client.exists()); + // END: com.azure.storage.blob.ContainerClient.exists + + // BEGIN: com.azure.storage.blob.ContainerClient.existsWithResponse#Duration-Context + Context context = new Context("Key", "Value"); + System.out.printf("Exists? %b%n", client.existsWithResponse(timeout, context).getValue()); + // END: com.azure.storage.blob.ContainerClient.existsWithResponse#Duration-Context + } + + /** + * Code snippet for {@link ContainerClient#create()} + */ + public void setCreate() { + // BEGIN: com.azure.storage.blob.ContainerClient.create + try { + client.create(); + System.out.printf("Create completed%n"); + } catch (StorageException error) { + if (error.getErrorCode().equals(StorageErrorCode.CONTAINER_ALREADY_EXISTS)) { + System.out.printf("Can't create container. It already exists %n"); + } + } + // END: com.azure.storage.blob.ContainerClient.create + } + + /** + * Code snippet for {@link ContainerClient#createWithResponse(Metadata, PublicAccessType, Duration, Context)} + */ + public void create2() { + // BEGIN: com.azure.storage.blob.ContainerClient.createWithResponse#Metadata-PublicAccessType-Duration-Context + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + Context context = new Context("Key", "Value"); + + System.out.printf("Create completed with status %d%n", + client.createWithResponse(metadata, PublicAccessType.CONTAINER, timeout, context).getStatusCode()); + // END: com.azure.storage.blob.ContainerClient.createWithResponse#Metadata-PublicAccessType-Duration-Context + } + + /** + * Code snippet for {@link ContainerClient#delete()} + */ + public void setDelete() { + // BEGIN: com.azure.storage.blob.ContainerClient.delete + try { + client.delete(); + System.out.printf("Delete completed%n"); + } catch (StorageException error) { + if (error.getErrorCode().equals(StorageErrorCode.CONTAINER_NOT_FOUND)) { + System.out.printf("Delete failed. Container was not found %n"); + } + } + // END: com.azure.storage.blob.ContainerClient.delete + } + + /** + * Code snippet for {@link ContainerClient#deleteWithResponse(ContainerAccessConditions, Duration, Context)} + */ + public void delete2() { + // BEGIN: com.azure.storage.blob.ContainerClient.deleteWithResponse#ContainerAccessConditions-Duration-Context + ContainerAccessConditions accessConditions = new ContainerAccessConditions() + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3))); + Context context = new Context("Key", "Value"); + + System.out.printf("Delete completed with status %d%n", client.deleteWithResponse( + accessConditions, timeout, context).getStatusCode()); + // END: com.azure.storage.blob.ContainerClient.deleteWithResponse#ContainerAccessConditions-Duration-Context + } + + /** + * Code snippet for {@link ContainerClient#getProperties()} + */ + public void getProperties() { + // BEGIN: com.azure.storage.blob.ContainerClient.getProperties + ContainerProperties properties = client.getProperties(); + System.out.printf("Public Access Type: %s, Legal Hold? %b, Immutable? %b%n", + properties.getBlobPublicAccess(), + properties.hasLegalHold(), + properties.hasImmutabilityPolicy()); + // END: com.azure.storage.blob.ContainerClient.getProperties + } + + /** + * Code snippet for {@link ContainerClient#getPropertiesWithResponse(LeaseAccessConditions, Duration, Context)} + */ + public void getProperties2() { + // BEGIN: com.azure.storage.blob.ContainerClient.getPropertiesWithResponse#LeaseAccessConditions-Duration-Context + LeaseAccessConditions accessConditions = new LeaseAccessConditions().setLeaseId(leaseId); + Context context = new Context("Key", "Value"); + + ContainerProperties properties = client.getPropertiesWithResponse(accessConditions, timeout, context) + .getValue(); + System.out.printf("Public Access Type: %s, Legal Hold? %b, Immutable? %b%n", + properties.getBlobPublicAccess(), + properties.hasLegalHold(), + properties.hasImmutabilityPolicy()); + // END: com.azure.storage.blob.ContainerClient.getPropertiesWithResponse#LeaseAccessConditions-Duration-Context + } + + /** + * Code snippet for {@link ContainerClient#setMetadata(Metadata)} + */ + public void setMetadata() { + // BEGIN: com.azure.storage.blob.ContainerClient.setMetadata#Metadata + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + + try { + client.setMetadata(metadata); + System.out.printf("Set metadata completed with status %n"); + } catch (UnsupportedOperationException error) { + System.out.printf("Fail while setting metadata %n"); + } + // END: com.azure.storage.blob.ContainerClient.setMetadata#Metadata + } + + /** + * Code snippet for {@link ContainerClient#setMetadataWithResponse(Metadata, ContainerAccessConditions, Duration, + * Context)} + */ + public void setMetadata2() { + // BEGIN: com.azure.storage.blob.ContainerClient.setMetadataWithResponse#Metadata-ContainerAccessConditions-Duration-Context + Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value")); + ContainerAccessConditions accessConditions = new ContainerAccessConditions() + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3))); + Context context = new Context("Key", "Value"); + + System.out.printf("Set metadata completed with status %d%n", + client.setMetadataWithResponse(metadata, accessConditions, timeout, context).getStatusCode()); + // END: com.azure.storage.blob.ContainerClient.setMetadataWithResponse#Metadata-ContainerAccessConditions-Duration-Context + } + + /** + * Code snippet for {@link ContainerClient#getAccessPolicy()} + */ + public void getAccessPolicy() { + // BEGIN: com.azure.storage.blob.ContainerClient.getAccessPolicy + ContainerAccessPolicies accessPolicies = client.getAccessPolicy(); + System.out.printf("Blob Access Type: %s%n", accessPolicies.getBlobAccessType()); + + for (SignedIdentifier identifier : accessPolicies.getIdentifiers()) { + System.out.printf("Identifier Name: %s, Permissions %s%n", + identifier.getId(), + identifier.getAccessPolicy().getPermission()); + } + // END: com.azure.storage.blob.ContainerClient.getAccessPolicy + } + + /** + * Code snippet for {@link ContainerClient#getAccessPolicyWithResponse(LeaseAccessConditions, Duration, Context)} + */ + public void getAccessPolicy2() { + // BEGIN: com.azure.storage.blob.ContainerClient.getAccessPolicyWithResponse#LeaseAccessConditions-Duration-Context + LeaseAccessConditions accessConditions = new LeaseAccessConditions().setLeaseId(leaseId); + Context context = new Context("Key", "Value"); + ContainerAccessPolicies accessPolicies = client.getAccessPolicyWithResponse(accessConditions, timeout, context) + .getValue(); + System.out.printf("Blob Access Type: %s%n", accessPolicies.getBlobAccessType()); + + for (SignedIdentifier identifier : accessPolicies.getIdentifiers()) { + System.out.printf("Identifier Name: %s, Permissions %s%n", + identifier.getId(), + identifier.getAccessPolicy().getPermission()); + } + // END: com.azure.storage.blob.ContainerClient.getAccessPolicyWithResponse#LeaseAccessConditions-Duration-Context + } + + /** + * Code snippet for {@link ContainerClient#setAccessPolicy(PublicAccessType, List)} + */ + public void setAccessPolicy() { + // BEGIN: com.azure.storage.blob.ContainerClient.setAccessPolicy#PublicAccessType-List + SignedIdentifier identifier = new SignedIdentifier() + .setId("name") + .setAccessPolicy(new AccessPolicy() + .setStart(OffsetDateTime.now()) + .setExpiry(OffsetDateTime.now().plusDays(7)) + .setPermission("permissionString")); + + try { + client.setAccessPolicy(PublicAccessType.CONTAINER, Collections.singletonList(identifier)); + System.out.printf("Set Access Policy completed %n"); + } catch (UnsupportedOperationException error) { + System.out.printf("Set Access Policy completed %s%n", error); + } + // END: com.azure.storage.blob.ContainerClient.setAccessPolicy#PublicAccessType-List + } + + /** + * Code snippet for {@link ContainerClient#setAccessPolicyWithResponse(PublicAccessType, List, + * ContainerAccessConditions, Duration, Context)} + */ + public void setAccessPolicy2() { + // BEGIN: com.azure.storage.blob.ContainerClient.setAccessPolicyWithResponse#PublicAccessType-List-ContainerAccessConditions-Duration-Context + SignedIdentifier identifier = new SignedIdentifier() + .setId("name") + .setAccessPolicy(new AccessPolicy() + .setStart(OffsetDateTime.now()) + .setExpiry(OffsetDateTime.now().plusDays(7)) + .setPermission("permissionString")); + + ContainerAccessConditions accessConditions = new ContainerAccessConditions() + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseId)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3))); + + Context context = new Context("Key", "Value"); + + System.out.printf("Set access policy completed with status %d%n", + client.setAccessPolicyWithResponse(PublicAccessType.CONTAINER, + Collections.singletonList(identifier), + accessConditions, + timeout, + context).getStatusCode()); + // END: com.azure.storage.blob.ContainerClient.setAccessPolicyWithResponse#PublicAccessType-List-ContainerAccessConditions-Duration-Context + } + + /** + * Code snippet for {@link ContainerClient#listBlobsFlat()} + */ + public void listBlobsFlat() { + // BEGIN: com.azure.storage.blob.ContainerClient.listBlobsFlat + client.listBlobsFlat().forEach(blob -> + System.out.printf("Name: %s, Directory? %b%n", blob.getName(), blob.isPrefix())); + // END: com.azure.storage.blob.ContainerClient.listBlobsFlat + } + + /** + * Code snippet for {@link ContainerClient#listBlobsFlat(ListBlobsOptions, Duration)} + */ + public void listBlobsFlat2() { + // BEGIN: com.azure.storage.blob.ContainerClient.listBlobsFlat#ListBlobsOptions-Duration + ListBlobsOptions options = new ListBlobsOptions() + .setPrefix("prefixToMatch") + .setDetails(new BlobListDetails() + .setDeletedBlobs(true) + .setSnapshots(true)); + + client.listBlobsFlat(options, timeout).forEach(blob -> + System.out.printf("Name: %s, Directory? %b, Deleted? %b, Snapshot ID: %s%n", + blob.getName(), + blob.isPrefix(), + blob.isDeleted(), + blob.getSnapshot())); + // END: com.azure.storage.blob.ContainerClient.listBlobsFlat#ListBlobsOptions-Duration + } + + /** + * Code snippet for {@link ContainerClient#listBlobsHierarchy(String)} + */ + public void listBlobsHierarchy() { + // BEGIN: com.azure.storage.blob.ContainerClient.listBlobsHierarchy#String + client.listBlobsHierarchy("directoryName").forEach(blob -> + System.out.printf("Name: %s, Directory? %b%n", blob.getName(), blob.isPrefix())); + // END: com.azure.storage.blob.ContainerClient.listBlobsHierarchy#String + } + + /** + * Code snippet for {@link ContainerClient#listBlobsHierarchy(String, ListBlobsOptions, Duration)} + */ + public void listBlobsHierarchy2() { + // BEGIN: com.azure.storage.blob.ContainerClient.listBlobsHierarchy#String-ListBlobsOptions-Duration + ListBlobsOptions options = new ListBlobsOptions() + .setPrefix("directoryName") + .setDetails(new BlobListDetails() + .setDeletedBlobs(true) + .setSnapshots(true)); + + client.listBlobsHierarchy("/", options, timeout).forEach(blob -> + System.out.printf("Name: %s, Directory? %b, Deleted? %b, Snapshot ID: %s%n", + blob.getName(), + blob.isPrefix(), + blob.isDeleted(), + blob.getSnapshot())); + // END: com.azure.storage.blob.ContainerClient.listBlobsHierarchy#String-ListBlobsOptions-Duration + } + + /** + * Code snippet for {@link ContainerClient#acquireLease(String, int)} + */ + public void acquireLease() { + // BEGIN: com.azure.storage.blob.ContainerClient.acquireLease#String-int + System.out.printf("Lease ID: %s%n", client.acquireLease(proposedId, leaseDuration)); + // END: com.azure.storage.blob.ContainerClient.acquireLease#String-int + } + + /** + * Code snippet for {@link ContainerClient#acquireLeaseWithResponse(String, int, ModifiedAccessConditions, Duration, + * Context)} + */ + public void acquireLease2() { + // BEGIN: com.azure.storage.blob.ContainerClient.acquireLeaseWithResponse#String-int-ModifiedAccessConditions-Duration-Context + ModifiedAccessConditions accessConditions = new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + Context context = new Context("Key", "Value"); + + System.out.printf("Lease ID: %s%n", + client.acquireLeaseWithResponse(proposedId, leaseDuration, accessConditions, timeout, context).getValue()); + // END: com.azure.storage.blob.ContainerClient.acquireLeaseWithResponse#String-int-ModifiedAccessConditions-Duration-Context + } + + /** + * Code snippet for {@link ContainerClient#renewLease(String)} + */ + public void renewLease() { + // BEGIN: com.azure.storage.blob.ContainerClient.renewLease#String + System.out.printf("Renewed Lease ID: %s%n", client.renewLease(leaseId)); + // END: com.azure.storage.blob.ContainerClient.renewLease#String + } + + /** + * Code snippet for {@link ContainerClient#renewLease(String, ModifiedAccessConditions, Duration)} + */ + public void renewLease2() { + // BEGIN: com.azure.storage.blob.ContainerClient.renewLease#String-ModifiedAccessConditions-Duration + ModifiedAccessConditions accessConditions = new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + System.out.printf("Renewed Lease ID: %s%n", client.renewLease(leaseId, accessConditions, timeout)); + // END: com.azure.storage.blob.ContainerClient.renewLease#String-ModifiedAccessConditions-Duration + } + + /** + * Code snippet for {@link ContainerClient#renewLeaseWithResponse(String, ModifiedAccessConditions, Duration, + * Context)} + */ + public void renewLease3() { + // BEGIN: com.azure.storage.blob.ContainerClient.renewLeaseWithResponse#String-ModifiedAccessConditions-Duration-Context + ModifiedAccessConditions accessConditions = new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + Context context = new Context("Key", "Value"); + + System.out.printf("Renewed Lease ID: %s%n", + client.renewLeaseWithResponse(leaseId, accessConditions, timeout, context)); + // END: com.azure.storage.blob.ContainerClient.renewLeaseWithResponse#String-ModifiedAccessConditions-Duration-Context + } + + /** + * Code snippet for {@link ContainerClient#releaseLease(String)} + */ + public void releaseLease() { + // BEGIN: com.azure.storage.blob.ContainerClient.releaseLease#String + try { + client.releaseLease(leaseId); + System.out.printf("Release lease completed %n"); + } catch (UnsupportedOperationException error) { + System.out.printf("Release lease completed %s%n", error); + } + // END: com.azure.storage.blob.ContainerClient.releaseLease#String + } + + /** + * Code snippet for {@link ContainerClient#releaseLeaseWithResponse(String, ModifiedAccessConditions, Duration, + * Context)} + */ + public void releaseLease2() { + // BEGIN: com.azure.storage.blob.ContainerClient.releaseLeaseWithResponse#String-ModifiedAccessConditions-Duration-Context + ModifiedAccessConditions accessConditions = new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + Context context = new Context("Key", "Value"); + + System.out.printf("Release lease completed with status %d%n", + client.releaseLeaseWithResponse(leaseId, accessConditions, timeout, context).getStatusCode()); + // END: com.azure.storage.blob.ContainerClient.releaseLeaseWithResponse#String-ModifiedAccessConditions-Duration-Context + } + + /** + * Code snippet for {@link ContainerClient#breakLease()} + */ + public void breakLease() { + // BEGIN: com.azure.storage.blob.ContainerClient.breakLease + System.out.printf("Broken lease had %d seconds remaining on the lease%n", + client.breakLease().getSeconds()); + // END: com.azure.storage.blob.ContainerClient.breakLease + } + + /** + * Code snippet for {@link ContainerClient#breakLeaseWithResponse(Integer, ModifiedAccessConditions, Duration, + * Context)} + */ + public void breakLease2() { + // BEGIN: com.azure.storage.blob.ContainerClient.breakLeaseWithResponse#Integer-ModifiedAccessConditions-Duration-Context + ModifiedAccessConditions accessConditions = new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + Context context = new Context("Key", "Value"); + + System.out.printf("Broken lease had %d seconds remaining on the lease%n", + client.breakLeaseWithResponse(10, accessConditions, timeout, context).getValue().getSeconds()); + // END: com.azure.storage.blob.ContainerClient.breakLeaseWithResponse#Integer-ModifiedAccessConditions-Duration-Context + } + + /** + * Code snippet for {@link ContainerClient#changeLease(String, String)} + */ + public void changeLease() { + // BEGIN: com.azure.storage.blob.ContainerClient.changeLease#String-String + System.out.printf("Changed Lease ID: %s%n", client.changeLease(leaseId, proposedId)); + // END: com.azure.storage.blob.ContainerClient.changeLease#String-String + } + + /** + * Code snippet for {@link ContainerClient#changeLeaseWithResponse(String, String, ModifiedAccessConditions, + * Duration, Context)} + */ + public void changeLease2() { + // BEGIN: com.azure.storage.blob.ContainerClient.changeLeaseWithResponse#String-String-ModifiedAccessConditions-Duration-Context + ModifiedAccessConditions accessConditions = new ModifiedAccessConditions() + .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + Context context = new Context("Key", "Value"); + + System.out.printf("Changed Lease ID: %s%n", + client.changeLeaseWithResponse(leaseId, proposedId, accessConditions, timeout, context).getValue()); + // END: com.azure.storage.blob.ContainerClient.changeLeaseWithResponse#String-String-ModifiedAccessConditions-Duration-Context + } + + /** + * Code snippet for {@link ContainerClient#getAccountInfo(Duration)} + */ + public void getAccountInfo() { + // BEGIN: com.azure.storage.blob.ContainerClient.getAccountInfo#Duration + StorageAccountInfo accountInfo = client.getAccountInfo(timeout); + System.out.printf("Account Kind: %s, SKU: %s%n", accountInfo.getAccountKind(), accountInfo.getSkuName()); + // END: com.azure.storage.blob.ContainerClient.getAccountInfo#Duration + } + + /** + * Code snippet for {@link ContainerClient#getAccountInfoWithResponse(Duration, Context)} + */ + public void getAccountInfo2() { + // BEGIN: com.azure.storage.blob.ContainerClient.getAccountInfoWithResponse#Duration-Context + Context context = new Context("Key", "Value"); + StorageAccountInfo accountInfo = client.getAccountInfoWithResponse(timeout, context).getValue(); + System.out.printf("Account Kind: %s, SKU: %s%n", accountInfo.getAccountKind(), accountInfo.getSkuName()); + // END: com.azure.storage.blob.ContainerClient.getAccountInfoWithResponse#Duration-Context + } +} diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/FileTransferExample.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/FileTransferExample.java index 33886cd10750..6d462368bba7 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/FileTransferExample.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/FileTransferExample.java @@ -9,9 +9,9 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.RandomAccessFile; -import java.net.URL; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; @@ -121,16 +121,17 @@ public static void main(String[] args) throws IOException, NoSuchAlgorithmExcept } private static File createTempEmptyFile(String fileName) throws IOException { - URL folderUrl = FileTransferExample.class.getClassLoader().getResource("."); + String pathName = "./folderPath/" + LARGE_TEST_FOLDER; - File dirPath = new File(folderUrl.getPath() + LARGE_TEST_FOLDER); + File dirPath = new File(pathName); if (dirPath.exists() || dirPath.mkdir()) { - File f = new File(folderUrl.getPath() + LARGE_TEST_FOLDER + fileName); - if (!f.exists()) { - f.createNewFile(); + File f = new File(pathName + fileName); + if (f.exists() || f.createNewFile()) { + return f; + } else { + throw new RuntimeException("Failed to create the large file."); } - return f; } else { throw new RuntimeException("Failed to create the large file dir."); } @@ -164,9 +165,8 @@ private static String getFileChecksum(File file) throws IOException, NoSuchAlgor buf.clear(); b = ch.read(buf); } - ch.close(); - fis.close(); - return new String(md.digest()); + + return new String(md.digest(), StandardCharsets.UTF_8); } } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/JavaDocCodeSnippetsHelpers.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/JavaDocCodeSnippetsHelpers.java index febf2861cad9..81e749932ffa 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/JavaDocCodeSnippetsHelpers.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/JavaDocCodeSnippetsHelpers.java @@ -11,6 +11,10 @@ static ContainerAsyncClient getContainerAsyncClient() { return new ContainerClientBuilder().buildAsyncClient(); } + static ContainerClient getContainerClient() { + return new ContainerClientBuilder().buildClient(); + } + static BlobAsyncClient getBlobAsyncClient(String blobName) { return getContainerAsyncClient().getBlobAsyncClient(blobName); } @@ -19,6 +23,14 @@ static BlobClient getBlobClient(String blobName) { return new BlobClient(getBlobAsyncClient(blobName)); } + static BlobServiceAsyncClient getBlobServiceAsyncClient() { + return new BlobServiceClientBuilder().buildAsyncClient(); + } + + static BlobServiceClient getBlobServiceClient() { + return new BlobServiceClientBuilder().buildClient(); + } + static URL generateURL(String urlString) { try { return new URL(urlString); diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/ListContainersExample.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/ListContainersExample.java index 5588ef64241c..551a4416705e 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/ListContainersExample.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/ListContainersExample.java @@ -47,12 +47,12 @@ public static void main(String[] args) { * List the containers' name under the Azure storage account. */ storageClient.listContainers().forEach(containerItem -> { - System.out.println("Container name: " + containerItem.name()); + System.out.println("Container name: " + containerItem.getName()); /* * Clean up the containers at the same time. */ - storageClient.getContainerClient(containerItem.name()).delete(); + storageClient.getContainerClient(containerItem.getName()).delete(); }); } } 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 591e78141f70..0599c91f3b45 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 @@ -3,6 +3,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.Metadata; import com.azure.storage.common.credentials.SharedKeyCredential; @@ -10,6 +11,7 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.Locale; @@ -22,6 +24,7 @@ public class SetMetadataAndHTTPHeadersExample { /** * Entry point into the setting metadata examples for Storage blobs. * @param args Unused. Arguments to the program. + * * @throws IOException If an I/O error occurs */ public static void main(String[] args) throws IOException { @@ -57,7 +60,7 @@ public static void main(String[] args) throws IOException { /* * Create a container with the containerMetadata above. */ - containerClient.create(containerMetadata, null, null); + containerClient.createWithResponse(containerMetadata, null, null, new Context("key1", "value1")); /* * Create a blob client. @@ -68,15 +71,15 @@ public static void main(String[] args) throws IOException { * Create a blob with blob's blobMetadata and BlobHttpHeaders. */ Metadata blobMetadata = new Metadata(Collections.singletonMap("myblobmetadata", "sample")); - BlobHTTPHeaders blobHTTPHeaders = new BlobHTTPHeaders().blobContentDisposition("attachment") - .blobContentType("text/html; charset=utf-8"); + BlobHTTPHeaders blobHTTPHeaders = new BlobHTTPHeaders().setBlobContentDisposition("attachment") + .setBlobContentType("text/html; charset=utf-8"); /* * Data which will upload to block blob. */ String data = "Hello world!"; - InputStream dataStream = new ByteArrayInputStream(data.getBytes()); - blobClient.upload(dataStream, data.length(), blobHTTPHeaders, blobMetadata, null, null); + InputStream dataStream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8)); + blobClient.uploadWithResponse(dataStream, data.length(), blobHTTPHeaders, blobMetadata, null, null, null, null); /* * Clean up the container and blob. diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/StorageErrorHandlingExample.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/StorageErrorHandlingExample.java index 3a84d7026f7b..db6343683f37 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/StorageErrorHandlingExample.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/StorageErrorHandlingExample.java @@ -5,6 +5,7 @@ import com.azure.core.http.HttpResponse; import com.azure.storage.blob.models.StorageErrorCode; +import com.azure.storage.blob.models.StorageException; /** * This example shows how to handle errors thrown by various XxxURL methods. Any client-side error will be @@ -34,26 +35,26 @@ public static void main(String[] args) { /* * StorageErrorCode defines constants corresponding to all error codes returned by the service. */ - if (e.errorCode() == StorageErrorCode.RESOURCE_NOT_FOUND) { + if (e.getErrorCode() == StorageErrorCode.RESOURCE_NOT_FOUND) { /* * Log more detailed information. */ - System.out.println("Extended details: " + e.getMessage()); + System.out.println("Extended details: " + e.getStatusCode()); /* * Examine the raw response. */ - HttpResponse response = e.response(); - System.out.println("Error creating the container with status code: " + response.statusCode()); - } else if (e.errorCode() == StorageErrorCode.CONTAINER_BEING_DELETED) { + HttpResponse response = e.getResponse(); + System.out.println("Error creating the container with status code: " + response.getStatusCode()); + } else if (e.getErrorCode() == StorageErrorCode.CONTAINER_BEING_DELETED) { /* * Log more detailed information. */ - System.out.println("Extended details: " + e.getMessage()); + System.out.println("Extended details: " + e.getServiceMessage()); - } else if (e.errorCode() == StorageErrorCode.CONTAINER_ALREADY_EXISTS) { + } else if (e.getErrorCode() == StorageErrorCode.CONTAINER_ALREADY_EXISTS) { /* * Process the error. 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 20d03a45a55c..8d8ebcfb4082 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 @@ -11,65 +11,73 @@ import com.azure.core.http.HttpPipelineNextPolicy import com.azure.core.http.HttpRequest import com.azure.core.http.HttpResponse import com.azure.core.http.ProxyOptions +import com.azure.core.http.netty.NettyAsyncHttpClientBuilder import com.azure.core.http.policy.HttpLogDetailLevel import com.azure.core.http.policy.HttpPipelinePolicy import com.azure.core.http.rest.Response +import com.azure.core.implementation.util.FluxUtil +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.ConfigurationManager +import com.azure.core.util.logging.ClientLogger import com.azure.identity.credential.EnvironmentCredentialBuilder import com.azure.storage.blob.models.ContainerItem import com.azure.storage.blob.models.CopyStatusType import com.azure.storage.blob.models.LeaseStateType -import com.azure.storage.blob.models.Metadata +import com.azure.storage.blob.models.ListContainersOptions import com.azure.storage.blob.models.RetentionPolicy import com.azure.storage.blob.models.StorageServiceProperties +import com.azure.storage.common.BaseClientBuilder import com.azure.storage.common.Constants +import com.azure.storage.common.credentials.SASTokenCredential import com.azure.storage.common.credentials.SharedKeyCredential -import io.netty.buffer.ByteBuf -import org.junit.Assume -import org.spockframework.lang.ISpecificationContext import reactor.core.publisher.Flux import reactor.core.publisher.Mono +import spock.lang.Requires import spock.lang.Shared import spock.lang.Specification import java.nio.ByteBuffer import java.nio.charset.Charset import java.nio.charset.StandardCharsets +import java.time.Duration import java.time.OffsetDateTime import java.util.function.Supplier class APISpec extends Specification { - static final String RECORD_MODE = "RECORD" - @Shared - Integer iterationNo = 0 // Used to generate stable container names for recording tests with multiple iterations. + ClientLogger logger = new ClientLogger(APISpec.class) Integer entityNo = 0 // Used to generate stable container names for recording tests requiring multiple containers. + // both sync and async clients point to same container + @Shared + ContainerClient cc + @Shared - ContainerClient cu + ContainerAsyncClient ccAsync // Fields used for conveniently creating blobs with data. static final String defaultText = "default" - static final ByteBuffer defaultData = ByteBuffer.wrap(defaultText.getBytes(StandardCharsets.UTF_8)) + public static final ByteBuffer defaultData = ByteBuffer.wrap(defaultText.getBytes(StandardCharsets.UTF_8)) - static final Supplier defaultInputStream = new Supplier() { + static final Supplier defaultInputStream = new Supplier(){ @Override InputStream get() { return new ByteArrayInputStream(defaultText.getBytes(StandardCharsets.UTF_8)) } } - static defaultDataSize = defaultData.remaining() + static int defaultDataSize = defaultData.remaining() - // If debugging is enabled, recordings cannot run as there can only be one proxy at a time. - static boolean enableDebugging = false + static final Flux defaultFlux = Flux.just(defaultData).map{buffer -> buffer.duplicate()} // Prefixes for blobs and containers - static String containerPrefix = "jtc" // java test container + String containerPrefix = "jtc" // java test container - static String blobPrefix = "javablob" + String blobPrefix = "javablob" /* The values below are used to create data-driven tests for access conditions. @@ -94,227 +102,355 @@ class APISpec extends Specification { static final String garbageLeaseID = UUID.randomUUID().toString() - /* - credential for various kinds of accounts. - */ - @Shared - static SharedKeyCredential primaryCreds + public static final String defaultEndpointTemplate = "https://%s.blob.core.windows.net/" - @Shared - static SharedKeyCredential alternateCreds + static def AZURE_TEST_MODE = "AZURE_TEST_MODE" + static def PRIMARY_STORAGE = "PRIMARY_STORAGE_" + static def SECONDARY_STORAGE = "SECONDARY_STORAGE_" + static def BLOB_STORAGE = "BLOB_STORAGE_" + static def PREMIUM_STORAGE = "PREMIUM_STORAGE_" - /* - URLs to various kinds of accounts. - */ - BlobServiceClient primaryServiceURL + static SharedKeyCredential primaryCredential + static SharedKeyCredential alternateCredential + static SharedKeyCredential blobCredential + static SharedKeyCredential premiumCredential + static TestMode testMode - @Shared - static BlobServiceClient alternateServiceURL + BlobServiceClient primaryBlobServiceClient + BlobServiceAsyncClient primaryBlobServiceAsyncClient + BlobServiceClient alternateBlobServiceClient + BlobServiceClient blobServiceClient + BlobServiceClient premiumBlobServiceClient - @Shared - static BlobServiceClient blobStorageServiceURL + private InterceptorManager interceptorManager + private boolean recordLiveMode + private TestResourceNamer resourceNamer + protected String testName - @Shared - static BlobServiceClient premiumServiceURL + def setupSpec() { + testMode = setupTestMode() + primaryCredential = getCredential(PRIMARY_STORAGE) + alternateCredential = getCredential(SECONDARY_STORAGE) + blobCredential = getCredential(BLOB_STORAGE) + premiumCredential = getCredential(PREMIUM_STORAGE) + } - /* - Constants for testing that the context parameter is properly passed to the pipeline. - */ - static final String defaultContextKey = "Key" + def setup() { + String fullTestName = specificationContext.getCurrentIteration().getName().replace(' ', '').toLowerCase() + String className = specificationContext.getCurrentSpec().getName() + int iterationIndex = fullTestName.lastIndexOf("[") + int substringIndex = (int) Math.min((iterationIndex != -1) ? iterationIndex : fullTestName.length(), 50) + this.testName = fullTestName.substring(0, substringIndex) + this.interceptorManager = new InterceptorManager(className + fullTestName, testMode) + this.resourceNamer = new TestResourceNamer(className + testName, testMode, interceptorManager.getRecordedData()) + + // If the test doesn't have the Requires tag record it in live mode. + recordLiveMode = specificationContext.getCurrentIteration().getDescription().getAnnotation(Requires.class) == null - static String getTestName(ISpecificationContext ctx) { - return ctx.getCurrentFeature().name.replace(' ', '').toLowerCase() + primaryBlobServiceClient = setClient(primaryCredential) + primaryBlobServiceAsyncClient = getServiceAsyncClient(primaryCredential) + alternateBlobServiceClient = setClient(alternateCredential) + blobServiceClient = setClient(blobCredential) + premiumBlobServiceClient = setClient(premiumCredential) + + def containerName = generateContainerName() + cc = primaryBlobServiceClient.getContainerClient(containerName) + ccAsync = primaryBlobServiceAsyncClient.getContainerAsyncClient(containerName) + cc.create() } - def generateContainerName() { - generateContainerName(specificationContext, iterationNo, entityNo++) + def cleanup() { + def options = new ListContainersOptions().setPrefix(containerPrefix + testName) + for (ContainerItem container : primaryBlobServiceClient.listContainers(options, Duration.ofSeconds(120))) { + ContainerClient containerClient = primaryBlobServiceClient.getContainerClient(container.getName()) + + if (container.getProperties().getLeaseState() == LeaseStateType.LEASED) { + containerClient.breakLeaseWithResponse(0, null, null, null) + } + + containerClient.delete() + } + + interceptorManager.close() } - def generateBlobName() { - generateBlobName(specificationContext, iterationNo, entityNo++) + //TODO: Should this go in core. + static Mono collectBytesInBuffer(Flux content) { + return FluxUtil.collectBytesInByteBufferStream(content).map{bytes -> ByteBuffer.wrap(bytes)} } - /** - * This function generates an entity name by concatenating the passed prefix, the name of the test requesting the - * entity name, and some unique suffix. This ensures that the entity name is unique for each test so there are - * no conflicts on the service. If we are not recording, we can just use the time. If we are recording, the suffix - * must always be the same so we can match requests. To solve this, we use the entityNo for how many entities have - * already been created by this test so far. This would sufficiently distinguish entities within a recording, but - * could still yield duplicates on the service for data-driven tests. Therefore, we also add the iteration number - * of the data driven tests. - * - * @param specificationContext - * Used to obtain the name of the test running. - * @param prefix - * Used to group all entities created by these tests under common prefixes. Useful for listing. - * @param iterationNo - * Indicates which iteration of a data-driven test is being executed. - * @param entityNo - * Indicates how man entities have been created by the test so far. This distinguishes multiple containers - * or multiple blobs created by the same test. Only used when dealing with recordings. - * @return - */ - static String generateResourceName(ISpecificationContext specificationContext, String prefix, int iterationNo, - int entityNo) { - String suffix = "" - suffix += System.currentTimeMillis() // For uniqueness between runs. - suffix += entityNo // For easy identification of which call created this resource. - return prefix + getTestName(specificationContext).take(63 - suffix.length() - prefix.length()) + suffix + static TestMode setupTestMode() { + String testMode = ConfigurationManager.getConfiguration().get(AZURE_TEST_MODE) + + if (testMode != null) { + try { + return TestMode.valueOf(testMode.toUpperCase(Locale.US)) + } catch (IllegalArgumentException ignore) { + return TestMode.PLAYBACK + } + } + + return TestMode.PLAYBACK } - static int updateIterationNo(ISpecificationContext specificationContext, int iterationNo) { - if (specificationContext.currentIteration.estimatedNumIterations > 1) { - return iterationNo + 1 + static boolean liveMode() { + return setupTestMode() == TestMode.RECORD + } + + private SharedKeyCredential getCredential(String accountType) { + String accountName + String accountKey + + if (testMode == TestMode.RECORD) { + accountName = ConfigurationManager.getConfiguration().get(accountType + "ACCOUNT_NAME") + accountKey = ConfigurationManager.getConfiguration().get(accountType + "ACCOUNT_KEY") } else { - return 0 + accountName = "storageaccount" + accountKey = "astorageaccountkey" } - } - static String generateContainerName(ISpecificationContext specificationContext, int iterationNo, int entityNo) { - return generateResourceName(specificationContext, containerPrefix, iterationNo, entityNo) + if (accountName == null || accountKey == null) { + logger.warning("Account name or key for the {} account was null. Test's requiring these credentials will fail.", accountType) + return null } - static String generateBlobName(ISpecificationContext specificationContext, int iterationNo, int entityNo) { - return generateResourceName(specificationContext, blobPrefix, iterationNo, entityNo) + return new SharedKeyCredential(accountName, accountKey) +} + +BlobServiceClient setClient(SharedKeyCredential credential) { + try { + return getServiceClient(credential) + } catch (Exception ignore) { + return null } +} - static getGenericCreds(String accountType) { - String accountName = ConfigurationManager.getConfiguration().get(accountType + "ACCOUNT_NAME") - String accountKey = ConfigurationManager.getConfiguration().get(accountType + "ACCOUNT_KEY") +def getOAuthServiceClient() { + BlobServiceClientBuilder builder = new BlobServiceClientBuilder() + .endpoint(String.format(defaultEndpointTemplate, primaryCredential.getAccountName())) + .httpClient(getHttpClient()) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - if (accountName == null || accountKey == null) { - System.out.println("Account name or key for the " + accountType + " account was null. Test's requiring " + - "these credential will fail.") - return null + if (testMode == TestMode.RECORD) { + if (recordLiveMode) { + builder.addPolicy(interceptorManager.getRecordPolicy()) } - return new SharedKeyCredential(accountName, accountKey) + + // AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET + return builder.credential(new EnvironmentCredentialBuilder().build()).buildClient() + } else { + // Running in playback, we don't have access to the AAD environment variables, just use SharedKeyCredential. + return builder.credential(primaryCredential).buildClient() } +} - static HttpClient getHttpClient() { - if (enableDebugging) { - return HttpClient.createDefault().proxy(new Supplier() { - @Override - ProxyOptions get() { - return new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)) - } - }) - } else { - return HttpClient.createDefault() - } +BlobServiceClient getServiceClient(String endpoint) { + return getServiceClient(null, endpoint, null) +} + +BlobServiceClient getServiceClient(SharedKeyCredential credential) { + return getServiceClient(credential, String.format(defaultEndpointTemplate, credential.getAccountName()), null) +} + + BlobServiceClient getServiceClient(SharedKeyCredential credential, String endpoint) { + return getServiceClient(credential, endpoint, null) + } + + BlobServiceClient getServiceClient(SharedKeyCredential credential, String endpoint, + HttpPipelinePolicy... policies) { + return getServiceClientBuilder(credential, endpoint, policies).buildClient() } - static BlobServiceClient getGenericServiceURL(SharedKeyCredential creds) { - // TODO: logging? + BlobServiceClient getServiceClient(SASTokenCredential credential, String endpoint) { + return getServiceClientBuilder(null, endpoint, null).credential(credential).buildClient() + } - return new BlobServiceClientBuilder() - .endpoint("https://" + creds.accountName() + ".blob.core.windows.net") + BlobServiceAsyncClient getServiceAsyncClient(SharedKeyCredential credential) { + return getServiceClientBuilder(credential, String.format(defaultEndpointTemplate, credential.getAccountName())) + .buildAsyncClient() + } + + BlobServiceClientBuilder getServiceClientBuilder(SharedKeyCredential credential, String endpoint, + HttpPipelinePolicy... policies) { + BlobServiceClientBuilder builder = new BlobServiceClientBuilder() + .endpoint(endpoint) .httpClient(getHttpClient()) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .credential(creds) - .buildClient() - } - - static void cleanupContainers() throws MalformedURLException { - BlobServiceClient serviceURL = new BlobServiceClientBuilder() - .endpoint("http://" + primaryCreds.accountName() + ".blob.core.windows.net") - .credential(primaryCreds) - .buildClient() - // There should not be more than 5000 containers from these tests - for (ContainerItem c : serviceURL.listContainers()) { - ContainerClient containerURL = serviceURL.getContainerClient(c.name()) - if (c.properties().leaseState() == LeaseStateType.LEASED) { - containerURL.breakLease(0, null, null) - } - containerURL.delete() + + for (HttpPipelinePolicy policy : policies) { + builder.addPolicy(policy) + } + + addOptionalRecording(builder) + + if (credential != null) { + builder.credential(credential) } + + return builder } - static byte[] getRandomByteArray(int size) { - Random rand = new Random(getRandomSeed()) - byte[] data = new byte[size] - rand.nextBytes(data) - return data + def addOptionalRecording(BaseClientBuilder builder) { + if (testMode == TestMode.RECORD && recordLiveMode) { + builder.addPolicy(interceptorManager.getRecordPolicy()) + } + return builder } - /* - Size must be an int because ByteBuffer sizes can only be an int. Long is not supported. - */ - static ByteBuffer getRandomData(int size) { - return ByteBuffer.wrap(getRandomByteArray(size)) + ContainerClient getContainerClient(SASTokenCredential credential, String endpoint) { + ContainerClientBuilder builder = new ContainerClientBuilder() + .endpoint(endpoint) + .httpClient(getHttpClient()) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + + if (testMode == TestMode.RECORD && recordLiveMode) { + builder.addPolicy(interceptorManager.getRecordPolicy()) + } + + builder.credential(credential).buildClient() } - /* - We only allow int because anything larger than 2GB (which would require a long) is left to stress/perf. - */ - static File getRandomFile(int size) { - File file = File.createTempFile(UUID.randomUUID().toString(), ".txt") - file.deleteOnExit() - FileOutputStream fos = new FileOutputStream(file) - fos.write(getRandomData(size).array()) - fos.close() - return file + BlobAsyncClient getBlobAsyncClient(SharedKeyCredential credential, String endpoint, String blobName) { + BlobClientBuilder builder = new BlobClientBuilder() + .endpoint(endpoint) + .blobName(blobName) + .httpClient(getHttpClient()) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + + if (testMode == TestMode.RECORD && recordLiveMode) { + builder.addPolicy(interceptorManager.getRecordPolicy()) + } + + builder.credential(credential).buildBlobAsyncClient() } - static long getRandomSeed() { - return System.currentTimeMillis() + BlobClient getBlobClient(SASTokenCredential credential, String endpoint, String blobName) { + return getBlobClient(credential, endpoint, blobName, null) } - def setupSpec() { - /* - We'll let primary creds throw and crash if there are no credential specified because everything else will fail. - */ - primaryCreds = getGenericCreds("PRIMARY_STORAGE_") + BlobClient getBlobClient(SASTokenCredential credential, String endpoint, String blobName, String snapshotId) { + BlobClientBuilder builder = new BlobClientBuilder() + .endpoint(endpoint) + .blobName(blobName) + .snapshot(snapshotId) + .httpClient(getHttpClient()) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + + if (testMode == TestMode.RECORD && recordLiveMode) { + builder.addPolicy(interceptorManager.getRecordPolicy()) + } + + return builder.credential(credential).buildBlobClient() + } + + BlobClient getBlobClient(SharedKeyCredential credential, String endpoint, HttpPipelinePolicy... policies) { + BlobClientBuilder builder = new BlobClientBuilder() + .endpoint(endpoint) + .httpClient(getHttpClient()) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - /* - It's feasible someone wants to test a specific subset of tests, so we'll still attempt to create each of the - ServiceURLs separately. We don't really need to take any action here, as we've already reported to the user, - so we just swallow the exception and let the relevant tests fail later. Perhaps we can add annotations or - something in the future. - */ - try { - alternateCreds = getGenericCreds("SECONDARY_STORAGE_") - alternateServiceURL = getGenericServiceURL(alternateCreds) + for (HttpPipelinePolicy policy : policies) { + builder.addPolicy(policy) } - catch (Exception e) { + + if (testMode == TestMode.RECORD && recordLiveMode) { + builder.addPolicy(interceptorManager.getRecordPolicy()) } - try { - blobStorageServiceURL = getGenericServiceURL(getGenericCreds("BLOB_STORAGE_")) + return builder.credential(credential).buildBlobClient() + } + + BlobClient getBlobClient(SharedKeyCredential credential, String endpoint, String blobName) { + BlobClientBuilder builder = new BlobClientBuilder() + .endpoint(endpoint) + .blobName(blobName) + .httpClient(getHttpClient()) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + + if (testMode == TestMode.RECORD && recordLiveMode) { + builder.addPolicy(interceptorManager.getRecordPolicy()) } - catch (Exception e) { + + return builder.credential(credential).buildBlobClient() + } + + BlobClient getBlobClient(String endpoint, SASTokenCredential credential) { + BlobClientBuilder builder = new BlobClientBuilder() + .endpoint(endpoint) + .httpClient(getHttpClient()) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + + if (credential != null) { + builder.credential(credential) } - try { - premiumServiceURL = getGenericServiceURL(getGenericCreds("PREMIUM_STORAGE_")) + if (testMode == TestMode.RECORD && recordLiveMode) { + builder.addPolicy(interceptorManager.getRecordPolicy()) } - catch (Exception e) { + + return builder.buildBlobClient() + } + + HttpClient getHttpClient() { + NettyAsyncHttpClientBuilder builder = new NettyAsyncHttpClientBuilder() + if (testMode == TestMode.RECORD) { + builder.wiretap(true) + + if (Boolean.parseBoolean(ConfigurationManager.getConfiguration().get("AZURE_TEST_DEBUGGING"))) { + builder.proxy(new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888))) + } + + return builder.build() + } else { + return interceptorManager.getPlaybackClient() } } - def cleanupSpec() { - Assume.assumeTrue("The test only runs in Live mode.", getTestMode().equalsIgnoreCase(RECORD_MODE)) - cleanupContainers() + def generateContainerName() { + generateResourceName(containerPrefix, entityNo++) } - def setup() { - Assume.assumeTrue("The test only runs in Live mode.", getTestMode().equalsIgnoreCase(RECORD_MODE)) - String containerName = generateContainerName() + def generateBlobName() { + generateResourceName(blobPrefix, entityNo++) + } - primaryServiceURL = getGenericServiceURL(primaryCreds) - cu = primaryServiceURL.getContainerClient(containerName) - cu.create() + private String generateResourceName(String prefix, int entityNo) { + return resourceNamer.randomName(prefix + testName + entityNo, 63) } - def cleanup() { - // TODO: Scrub auth header here? - iterationNo = updateIterationNo(specificationContext, iterationNo) + String getRandomUUID() { + return resourceNamer.randomUuid() + } + + String getBlockID() { + return Base64.encoder.encodeToString(resourceNamer.randomUuid().getBytes(StandardCharsets.UTF_8)) + } + + OffsetDateTime getUTCNow() { + return resourceNamer.now() + } + + byte[] getRandomByteArray(int size) { + long seed = UUID.fromString(resourceNamer.randomUuid()).getMostSignificantBits() & Long.MAX_VALUE + Random rand = new Random(seed) + byte[] data = new byte[size] + rand.nextBytes(data) + return data + } + + /* + Size must be an int because ByteBuffer sizes can only be an int. Long is not supported. + */ + + ByteBuffer getRandomData(int size) { + return ByteBuffer.wrap(getRandomByteArray(size)) } /** * This will retrieve the etag to be used in testing match conditions. The result will typically be assigned to * the ifMatch condition when testing success and the ifNoneMatch condition when testing failure. * - * @param bu + * @param bc * The URL to the blob to get the etag on. * @param match * The ETag value for this test. If {@code receivedEtag} is passed, that will signal that the test is expecting @@ -322,9 +458,17 @@ class APISpec extends Specification { * @return * The appropriate etag value to run the current test. */ - def setupBlobMatchCondition(BlobClient bu, String match) { + def setupBlobMatchCondition(BlobClient bc, String match) { + if (match == receivedEtag) { + return bc.getProperties().getETag() + } else { + return match + } + } + + def setupBlobMatchCondition(BlobAsyncClient bac, String match) { if (match == receivedEtag) { - return bu.getProperties().headers().value("ETag") + return bac.getProperties().block().getETag() } else { return match } @@ -336,7 +480,7 @@ class APISpec extends Specification { * proper setting of the header. If we pass null, though, we don't want to acquire a lease, as that will interfere * with other AC tests. * - * @param bu + * @param bc * The blob on which to acquire a lease. * @param leaseID * The signalID. Values should only ever be {@code receivedLeaseID}, {@code garbageLeaseID}, or {@code null}. @@ -344,10 +488,22 @@ class APISpec extends Specification { * The actual leaseAccessConditions of the blob if recievedLeaseID is passed, otherwise whatever was passed will be * returned. */ - def setupBlobLeaseCondition(BlobClient bu, String leaseID) { + def setupBlobLeaseCondition(BlobClient bc, String leaseID) { String responseLeaseId = null if (leaseID == receivedLeaseID || leaseID == garbageLeaseID) { - responseLeaseId = bu.acquireLease(null, -1, null, null).value() + responseLeaseId = bc.acquireLease(null, -1) + } + if (leaseID == receivedLeaseID) { + return responseLeaseId + } else { + return leaseID + } + } + + def setupBlobLeaseCondition(BlobAsyncClient bac, String leaseID) { + String responseLeaseId = null + if (leaseID == receivedLeaseID || leaseID == garbageLeaseID) { + responseLeaseId = bac.acquireLease(null, -1).block() } if (leaseID == receivedLeaseID) { return responseLeaseId @@ -358,7 +514,7 @@ class APISpec extends Specification { def setupContainerMatchCondition(ContainerClient cu, String match) { if (match == receivedEtag) { - return cu.getProperties().headers().value("ETag") + return cu.getProperties().getETag() } else { return match } @@ -366,7 +522,7 @@ class APISpec extends Specification { def setupContainerLeaseCondition(ContainerClient cu, String leaseID) { if (leaseID == receivedLeaseID) { - return cu.acquireLease(null, -1).value() + return cu.acquireLease(null, -1) } else { return leaseID } @@ -380,15 +536,60 @@ class APISpec extends Specification { return request } + /* + This is for stubbing responses that will actually go through the pipeline and autorest code. Autorest does not seem + to play too nicely with mocked objects and the complex reflection stuff on both ends made it more difficult to work + with than was worth it. + */ + def getStubResponse(int code, HttpRequest request) { + return new HttpResponse() { + + @Override + int getStatusCode() { + return code + } + + @Override + String getHeaderValue(String s) { + return null + } + + @Override + HttpHeaders getHeaders() { + return new HttpHeaders() + } + + @Override + Flux getBody() { + return Flux.empty() + } + + @Override + Mono getBodyAsByteArray() { + return Mono.just(new byte[0]) + } + + @Override + Mono getBodyAsString() { + return Mono.just("") + } + + @Override + Mono getBodyAsString(Charset charset) { + return Mono.just("") + } + }.setRequest(request) + } + def waitForCopy(ContainerClient bu, String status) { OffsetDateTime start = OffsetDateTime.now() while (status != CopyStatusType.SUCCESS.toString()) { - status = bu.getProperties().headers().value("x-ms-copy-status") + status = bu.getPropertiesWithResponse(null, null, null).getHeaders().value("x-ms-copy-status") OffsetDateTime currentTime = OffsetDateTime.now() if (status == CopyStatusType.FAILED.toString() || currentTime.minusMinutes(1) == start) { throw new Exception("Copy failed or took too long") } - sleep(1000) + sleepIfRecord(1000) } } @@ -411,98 +612,48 @@ class APISpec extends Specification { } def validateBlobProperties(Response response, String cacheControl, String contentDisposition, String contentEncoding, - String contentLanguage, byte[] contentMD5, String contentType) { - return response.value().cacheControl() == cacheControl && - response.value().contentDisposition() == contentDisposition && - response.value().contentEncoding() == contentEncoding && - response.value().contentLanguage() == contentLanguage && - response.value().contentMD5() == contentMD5 && - response.headers().value("Content-Type") == contentType - } - - static Metadata getMetadataFromHeaders(HttpHeaders headers) { - Metadata metadata = new Metadata() - - for (Map.Entry header : headers.toMap()) { - if (header.getKey().startsWith("x-ms-meta-")) { - String metadataKey = header.getKey().substring(10) - metadata.put(metadataKey, header.getValue()) - } - } - - return metadata + String contentLanguage, byte[] contentMD5, String contentType) { + return response.getValue().getCacheControl() == cacheControl && + response.getValue().getContentDisposition() == contentDisposition && + response.getValue().getContentEncoding() == contentEncoding && + response.getValue().getContentLanguage() == contentLanguage && + response.getValue().getContentMD5() == contentMD5 && + response.getHeaders().value("Content-Type") == contentType } def enableSoftDelete() { - primaryServiceURL.setProperties(new StorageServiceProperties() - .deleteRetentionPolicy(new RetentionPolicy().enabled(true).days(2))) - sleep(30000) // Wait for the policy to take effect. + primaryBlobServiceClient.setProperties(new StorageServiceProperties() + .setDeleteRetentionPolicy(new RetentionPolicy().setEnabled(true).setDays(2))) + + sleepIfRecord(30000) } def disableSoftDelete() { - primaryServiceURL.setProperties(new StorageServiceProperties() - .deleteRetentionPolicy(new RetentionPolicy().enabled(false))) + primaryBlobServiceClient.setProperties(new StorageServiceProperties() + .setDeleteRetentionPolicy(new RetentionPolicy().setEnabled(false))) - sleep(30000) // Wait for the policy to take effect. + sleepIfRecord(30000) } - - - /* - This method returns a stub of an HttpResponse. This is for when we want to test policies in isolation but don't care - about the status code, so we stub a response that always returns a given value for the status code. We never care - about the number or nature of interactions with this stub. - */ - - def getStubResponse(int code) { - return Stub(HttpResponse) { - statusCode() >> code + // Only sleep if test is running in live mode + def sleepIfRecord(long milliseconds) { + if (testMode == TestMode.RECORD) { + sleep(milliseconds) } } - /* - This is for stubbing responses that will actually go through the pipeline and autorest code. Autorest does not seem - to play too nicely with mocked objects and the complex reflection stuff on both ends made it more difficult to work - with than was worth it. - */ - def getStubResponse(int code, HttpRequest request) { - return new HttpResponse() { - - @Override - int statusCode() { - return code - } - - @Override - String headerValue(String s) { - return null - } - - @Override - HttpHeaders headers() { - return new HttpHeaders() - } - - @Override - Flux body() { - return Flux.empty() - } - - @Override - Mono bodyAsByteArray() { - return Mono.just(new byte[0]) - } - - @Override - Mono bodyAsString() { - return Mono.just("") - } - - @Override - Mono bodyAsString(Charset charset) { - return Mono.just("") + class MockRetryRangeResponsePolicy implements HttpPipelinePolicy { + @Override + Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { + return next.process().flatMap { HttpResponse response -> + if (response.getRequest().getHeaders().value("x-ms-range") != "bytes=2-6") { + return Mono. error(new IllegalArgumentException("The range header was not set correctly on retry.")) + } else { + // ETag can be a dummy value. It's not validated, but DownloadResponse requires one + return Mono. just(new MockDownloadHttpResponse(response, 206, Flux.error(new IOException()))) + } } - }.request(request) + } } /* @@ -510,80 +661,51 @@ class APISpec extends Specification { to play too nicely with mocked objects and the complex reflection stuff on both ends made it more difficult to work with than was worth it. Because this type is just for BlobDownload, we don't need to accept a header type. */ - static class MockDownloadHttpResponse extends HttpResponse { + class MockDownloadHttpResponse extends HttpResponse { private final int statusCode private final HttpHeaders headers - private final Flux body + private final Flux body - MockDownloadHttpResponse(HttpResponse response, int statusCode, Flux body) { - this.request(response.request()) + MockDownloadHttpResponse(HttpResponse response, int statusCode, Flux body) { + this.setRequest(response.getRequest()) this.statusCode = statusCode - this.headers = response.headers() + this.headers = response.getHeaders() this.body = body } @Override - int statusCode() { + int getStatusCode() { return statusCode } @Override - String headerValue(String s) { + String getHeaderValue(String s) { return headers.value(s) } @Override - HttpHeaders headers() { + HttpHeaders getHeaders() { return headers } @Override - Flux body() { + Flux getBody() { return body } @Override - Mono bodyAsByteArray() { + Mono getBodyAsByteArray() { return Mono.error(new IOException()) } @Override - Mono bodyAsString() { + Mono getBodyAsString() { return Mono.error(new IOException()) } @Override - Mono bodyAsString(Charset charset) { + Mono getBodyAsString(Charset charset) { return Mono.error(new IOException()) } } - - def getContextStubPolicy(int successCode, Class responseHeadersType) { - return Mock(HttpPipelinePolicy) { - process(_ as HttpPipelineCallContext, _ as HttpPipelineNextPolicy) >> { - HttpPipelineCallContext context, HttpPipelineNextPolicy next -> - if (!context.getData(defaultContextKey).isPresent()) { - return Mono.error(new RuntimeException("Context key not present.")) - } else { - return Mono.just(getStubResponse(successCode, context.httpRequest())) - } - } - } - } - - def getOAuthServiceURL() { - return new BlobServiceClientBuilder() - .endpoint(String.format("https://%s.blob.core.windows.net/", primaryCreds.accountName())) - .credential(new EnvironmentCredentialBuilder().build()) // AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildClient() - } - - def getTestMode(){ - String testMode = System.getenv("AZURE_TEST_MODE") - if(testMode == null){ - testMode = "PLAYBACK" - } - return testMode - } } diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/AppendBlobAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/AppendBlobAPITest.groovy index 5d6f364f7e5e..2a869d688bab 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/AppendBlobAPITest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/AppendBlobAPITest.groovy @@ -4,39 +4,51 @@ package com.azure.storage.blob import com.azure.core.http.rest.Response -import com.azure.storage.blob.models.* +import com.azure.core.exception.UnexpectedLengthException +import com.azure.storage.blob.models.AppendBlobAccessConditions +import com.azure.storage.blob.models.AppendBlobItem +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.BlobRange +import com.azure.storage.blob.models.LeaseAccessConditions +import com.azure.storage.blob.models.Metadata +import com.azure.storage.blob.models.ModifiedAccessConditions +import com.azure.storage.blob.models.PublicAccessType +import com.azure.storage.blob.models.SourceModifiedAccessConditions +import com.azure.storage.blob.models.StorageException import spock.lang.Unroll import java.security.MessageDigest class AppendBlobAPITest extends APISpec { - AppendBlobClient bu + AppendBlobClient bc def setup() { - bu = cu.getAppendBlobClient(generateBlobName()) - bu.create() + bc = cc.getAppendBlobClient(generateBlobName()) + bc.create() } def "Create defaults"() { when: - Response createResponse = bu.create() + Response createResponse = bc.createWithResponse(null, null, null, null, null) then: - createResponse.statusCode() == 201 - validateBasicHeaders(createResponse.headers()) - createResponse.value().contentMD5() == null - createResponse.value().isServerEncrypted() + createResponse.getStatusCode() == 201 + validateBasicHeaders(createResponse.getHeaders()) + createResponse.getValue().getContentMD5() == null + createResponse.getValue().isServerEncrypted() } def "Create min"() { expect: - bu.create().statusCode() == 201 + bc.createWithResponse(null, null, null, null, null).getStatusCode() == 201 } def "Create error"() { when: - bu.create(null, null, - new BlobAccessConditions().modifiedAccessConditions(new ModifiedAccessConditions().ifMatch("garbage")), + bc.create(null, null, + new BlobAccessConditions().setModifiedAccessConditions(new ModifiedAccessConditions().setIfMatch("garbage")), null) then: @@ -46,16 +58,16 @@ class AppendBlobAPITest extends APISpec { @Unroll def "Create headers"() { setup: - BlobHTTPHeaders headers = new BlobHTTPHeaders().blobCacheControl(cacheControl) - .blobContentDisposition(contentDisposition) - .blobContentEncoding(contentEncoding) - .blobContentLanguage(contentLanguage) - .blobContentMD5(contentMD5) - .blobContentType(contentType) + BlobHTTPHeaders headers = new BlobHTTPHeaders().setBlobCacheControl(cacheControl) + .setBlobContentDisposition(contentDisposition) + .setBlobContentEncoding(contentEncoding) + .setBlobContentLanguage(contentLanguage) + .setBlobContentMD5(contentMD5) + .setBlobContentType(contentType) when: - bu.create(headers, null, null, null) - Response response = bu.getProperties() + bc.createWithResponse(headers, null, null, null, null) + Response response = bc.getPropertiesWithResponse(null, null, null) // If the value isn't set the service will automatically set it contentType = (contentType == null) ? "application/octet-stream" : contentType @@ -64,15 +76,15 @@ class AppendBlobAPITest extends APISpec { validateBlobProperties(response, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentMD5, contentType) where: - cacheControl | contentDisposition | contentEncoding | contentLanguage | contentMD5 | contentType - null | null | null | null | null | null - "control" | "disposition" | "encoding" | "language" | Base64.getEncoder().encode(MessageDigest.getInstance("MD5").digest(defaultText.getBytes())) | "type" + cacheControl | contentDisposition | contentEncoding | contentLanguage | contentMD5 | contentType + null | null | null | null | null | null + "control" | "disposition" | "encoding" | "language" | Base64.getEncoder().encode(MessageDigest.getInstance("MD5").digest(defaultText.getBytes())) | "type" } @Unroll def "Create metadata"() { setup: - Metadata metadata = new Metadata() + def metadata = new Metadata() if (key1 != null) { metadata.put(key1, value1) } @@ -81,11 +93,11 @@ class AppendBlobAPITest extends APISpec { } when: - bu.create(null, metadata, null, null) - Response response = bu.getProperties(null, null) + bc.create(null, metadata, null, null) + def response = bc.getProperties() then: - response.value().metadata() == metadata + response.getMetadata() == metadata where: key1 | value1 | key2 | value2 @@ -96,19 +108,18 @@ class AppendBlobAPITest extends APISpec { @Unroll def "Create AC"() { setup: - match = setupBlobMatchCondition(bu, match) - leaseID = setupBlobLeaseCondition(bu, leaseID) + match = setupBlobMatchCondition(bc, match) + leaseID = setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions().ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) - + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions().setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) expect: - bu.create(null, null, bac, null).statusCode() == 201 + bc.createWithResponse(null, null, bac, null, null).getStatusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID @@ -123,17 +134,17 @@ class AppendBlobAPITest extends APISpec { @Unroll def "Create AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) - setupBlobLeaseCondition(bu, leaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions().ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions().setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) when: - bu.create(null, null, bac, null) + bc.create(null, null, bac, null) then: thrown(StorageException) @@ -149,45 +160,45 @@ class AppendBlobAPITest extends APISpec { def "Append block defaults"() { setup: - Response appendResponse = bu.appendBlock(defaultInputStream.get(), defaultDataSize) + Response appendResponse = bc.appendBlockWithResponse(defaultInputStream.get(), defaultDataSize, null, null, null) - expect: + when: ByteArrayOutputStream downloadStream = new ByteArrayOutputStream() - bu.download(downloadStream) + bc.download(downloadStream) + then: downloadStream.toByteArray() == defaultData.array() - validateBasicHeaders(appendResponse.headers()) - appendResponse.value().contentMD5() != null - appendResponse.value().blobAppendOffset() != null - appendResponse.value().blobCommittedBlockCount() != null - Integer.parseInt(bu.getProperties().headers().value("x-ms-blob-committed-block-count")) == 1 + validateBasicHeaders(appendResponse.getHeaders()) + appendResponse.getHeaders().value("x-ms-content-crc64") != null + appendResponse.getValue().getBlobAppendOffset() != null + appendResponse.getValue().getBlobCommittedBlockCount() != null + + expect: + bc.getProperties().getCommittedBlockCount() == 1 } def "Append block min"() { - expect: - bu.appendBlock(defaultInputStream.get(), defaultDataSize).statusCode() == 201 + bc.appendBlockWithResponse(defaultInputStream.get(), defaultDataSize, null, null, null).getStatusCode() == 201 } @Unroll def "Append block IA"() { when: - bu.appendBlock(data, dataSize) + bc.appendBlock(data, dataSize) then: - def e = thrown(Exception) - exceptionType.isInstance(e) + thrown(exceptionType) where: - data | dataSize | exceptionType - null | defaultDataSize | NullPointerException - defaultInputStream.get() | defaultDataSize + 1 | IndexOutOfBoundsException - // TODO (alzimmer): This doesn't throw an error as the stream is larger than the stated size - //defaultInputStream.get() | defaultDataSize - 1 | StorageException + data | dataSize | exceptionType + null | defaultDataSize | NullPointerException + defaultInputStream.get() | defaultDataSize + 1 | UnexpectedLengthException + defaultInputStream.get() | defaultDataSize - 1 | UnexpectedLengthException } def "Append block empty body"() { when: - bu.appendBlock(new ByteArrayInputStream(new byte[0]), 0) + bc.appendBlock(new ByteArrayInputStream(new byte[0]), 0) then: thrown(StorageException) @@ -195,7 +206,7 @@ class AppendBlobAPITest extends APISpec { def "Append block null body"() { when: - bu.appendBlock(new ByteArrayInputStream(null), 0) + bc.appendBlock(new ByteArrayInputStream(null), 0) then: thrown(NullPointerException) @@ -204,23 +215,22 @@ class AppendBlobAPITest extends APISpec { @Unroll def "Append block AC"() { setup: - match = setupBlobMatchCondition(bu, match) - leaseID = setupBlobLeaseCondition(bu, leaseID) + match = setupBlobMatchCondition(bc, match) + leaseID = setupBlobLeaseCondition(bc, leaseID) AppendBlobAccessConditions bac = new AppendBlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .appendPositionAccessConditions(new AppendPositionAccessConditions() - .appendPosition(appendPosE) - .maxSize(maxSizeLTE)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) - + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setAppendPositionAccessConditions(new AppendPositionAccessConditions() + .setAppendPosition(appendPosE) + .setMaxSize(maxSizeLTE)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) expect: - bu.appendBlock(defaultInputStream.get(), defaultDataSize, bac, null).statusCode() == 201 + bc.appendBlockWithResponse(defaultInputStream.get(), defaultDataSize, bac, null, null).getStatusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID | appendPosE | maxSizeLTE @@ -237,26 +247,29 @@ class AppendBlobAPITest extends APISpec { @Unroll def "Append block AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) - setupBlobLeaseCondition(bu, leaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + setupBlobLeaseCondition(bc, leaseID) AppendBlobAccessConditions bac = new AppendBlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .appendPositionAccessConditions(new AppendPositionAccessConditions() - .appendPosition(appendPosE) - .maxSize(maxSizeLTE)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setAppendPositionAccessConditions(new AppendPositionAccessConditions() + .setAppendPosition(appendPosE) + .setMaxSize(maxSizeLTE)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) when: - bu.appendBlock(defaultInputStream.get(), defaultDataSize, bac, null) + bc.appendBlockWithResponse(defaultInputStream.get(), defaultDataSize, bac, null, null) then: thrown(StorageException) + cleanup: + defaultInputStream.get().reset() + where: modified | unmodified | match | noneMatch | leaseID | appendPosE | maxSizeLTE newDate | null | null | null | null | null | null @@ -266,14 +279,15 @@ class AppendBlobAPITest extends APISpec { null | null | null | null | garbageLeaseID | null | null null | null | null | null | null | 1 | null null | null | null | null | null | null | 1 + } def "Append block error"() { setup: - bu = cu.getAppendBlobClient(generateBlobName()) + bc = cc.getAppendBlobClient(generateBlobName()) when: - bu.appendBlock(defaultInputStream.get(), defaultDataSize) + bc.appendBlock(defaultInputStream.get(), defaultDataSize) then: thrown(StorageException) @@ -281,34 +295,34 @@ class AppendBlobAPITest extends APISpec { def "Append block from URL min"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) byte[] data = getRandomByteArray(1024) - bu.appendBlock(new ByteArrayInputStream(data), data.length) + bc.appendBlock(new ByteArrayInputStream(data), data.length) - AppendBlobClient destURL = cu.getAppendBlobClient(generateBlobName()) + AppendBlobClient destURL = cc.getAppendBlobClient(generateBlobName()) destURL.create() BlobRange blobRange = new BlobRange(0, (long) PageBlobClient.PAGE_BYTES) when: - Response response = destURL.appendBlockFromUrl(bu.getBlobUrl(), blobRange) + Response response = destURL.appendBlockFromUrlWithResponse(bc.getBlobUrl(), blobRange, null, null, null, null, null) then: - response.statusCode() == 201 - validateBasicHeaders(response.headers()) + response.getStatusCode() == 201 + validateBasicHeaders(response.getHeaders()) } def "Append block from URL range"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) byte[] data = getRandomByteArray(4 * 1024) - bu.appendBlock(new ByteArrayInputStream(data), data.length) + bc.appendBlock(new ByteArrayInputStream(data), data.length) - AppendBlobClient destURL = cu.getAppendBlobClient(generateBlobName()) + AppendBlobClient destURL = cc.getAppendBlobClient(generateBlobName()) destURL.create() when: - destURL.appendBlockFromUrl(bu.getBlobUrl(), new BlobRange(2 * 1024, 1024)) + destURL.appendBlockFromUrl(bc.getBlobUrl(), new BlobRange(2 * 1024, 1024)) then: ByteArrayOutputStream downloadStream = new ByteArrayOutputStream(1024) @@ -318,16 +332,16 @@ class AppendBlobAPITest extends APISpec { def "Append block from URL MD5"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) byte[] data = getRandomByteArray(1024) - bu.appendBlock(new ByteArrayInputStream(data), data.length) + bc.appendBlock(new ByteArrayInputStream(data), data.length) - AppendBlobClient destURL = cu.getAppendBlobClient(generateBlobName()) + AppendBlobClient destURL = cc.getAppendBlobClient(generateBlobName()) destURL.create() when: - destURL.appendBlockFromUrl(bu.getBlobUrl(), null, MessageDigest.getInstance("MD5").digest(data), - null, null, null) + destURL.appendBlockFromUrl(bc.getBlobUrl(), null, MessageDigest.getInstance("MD5").digest(data), + null, null, null) then: notThrown(StorageException) @@ -335,16 +349,16 @@ class AppendBlobAPITest extends APISpec { def "Append block from URL MD5 fail"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) byte[] data = getRandomByteArray(1024) - bu.appendBlock(new ByteArrayInputStream(data), data.length) + bc.appendBlock(new ByteArrayInputStream(data), data.length) - def destURL = cu.getAppendBlobClient(generateBlobName()) + def destURL = cc.getAppendBlobClient(generateBlobName()) destURL.create() when: - destURL.appendBlockFromUrl(bu.getBlobUrl(), null, MessageDigest.getInstance("MD5").digest("garbage".getBytes()), - null, null, null) + destURL.appendBlockFromUrl(bc.getBlobUrl(), null, MessageDigest.getInstance("MD5").digest("garbage".getBytes()), + null, null, null) then: thrown(StorageException) @@ -353,26 +367,26 @@ class AppendBlobAPITest extends APISpec { @Unroll def "Append block from URL destination AC"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - match = setupBlobMatchCondition(bu, match) - leaseID = setupBlobLeaseCondition(bu, leaseID) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + match = setupBlobMatchCondition(bc, match) + leaseID = setupBlobLeaseCondition(bc, leaseID) def bac = new AppendBlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .appendPositionAccessConditions(new AppendPositionAccessConditions() - .appendPosition(appendPosE) - .maxSize(maxSizeLTE)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) - - def sourceURL = cu.getAppendBlobClient(generateBlobName()) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setAppendPositionAccessConditions(new AppendPositionAccessConditions() + .setAppendPosition(appendPosE) + .setMaxSize(maxSizeLTE)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) + + def sourceURL = cc.getAppendBlobClient(generateBlobName()) sourceURL.create() - sourceURL.appendBlock(defaultInputStream.get(), defaultDataSize).statusCode() + sourceURL.appendBlockWithResponse(defaultInputStream.get(), defaultDataSize, null, null, null).getStatusCode() expect: - bu.appendBlockFromUrl(sourceURL.getBlobUrl(), null, null, bac, null, null).statusCode() == 201 + bc.appendBlockFromUrlWithResponse(sourceURL.getBlobUrl(), null, null, bac, null, null, null).getStatusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID | appendPosE | maxSizeLTE @@ -389,27 +403,27 @@ class AppendBlobAPITest extends APISpec { @Unroll def "Append block from URL AC destination fail"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - noneMatch = setupBlobMatchCondition(bu, noneMatch) - setupBlobLeaseCondition(bu, leaseID) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + setupBlobLeaseCondition(bc, leaseID) def bac = new AppendBlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .appendPositionAccessConditions(new AppendPositionAccessConditions() - .appendPosition(appendPosE) - .maxSize(maxSizeLTE)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) - - def sourceURL = cu.getAppendBlobClient(generateBlobName()) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setAppendPositionAccessConditions(new AppendPositionAccessConditions() + .setAppendPosition(appendPosE) + .setMaxSize(maxSizeLTE)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) + + def sourceURL = cc.getAppendBlobClient(generateBlobName()) sourceURL.create() - sourceURL.appendBlock(defaultInputStream.get(), defaultDataSize).statusCode() + sourceURL.appendBlockWithResponse(defaultInputStream.get(), defaultDataSize, null, null, null).getStatusCode() when: - bu.appendBlockFromUrl(sourceURL.getBlobUrl(), null, null, bac, null, null) + bc.appendBlockFromUrl(sourceURL.getBlobUrl(), null, null, bac, null, null) then: thrown(StorageException) @@ -428,20 +442,20 @@ class AppendBlobAPITest extends APISpec { @Unroll def "Append block from URL source AC"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) - def sourceURL = cu.getAppendBlobClient(generateBlobName()) + def sourceURL = cc.getAppendBlobClient(generateBlobName()) sourceURL.create() - sourceURL.appendBlock(defaultInputStream.get(), defaultDataSize).statusCode() + sourceURL.appendBlockWithResponse(defaultInputStream.get(), defaultDataSize, null, null, null).getStatusCode() def smac = new SourceModifiedAccessConditions() - .sourceIfModifiedSince(sourceIfModifiedSince) - .sourceIfUnmodifiedSince(sourceIfUnmodifiedSince) - .sourceIfMatch(setupBlobMatchCondition(sourceURL, sourceIfMatch)) - .sourceIfNoneMatch(sourceIfNoneMatch) + .setSourceIfModifiedSince(sourceIfModifiedSince) + .setSourceIfUnmodifiedSince(sourceIfUnmodifiedSince) + .setSourceIfMatch(setupBlobMatchCondition(sourceURL, sourceIfMatch)) + .setSourceIfNoneMatch(sourceIfNoneMatch) expect: - bu.appendBlockFromUrl(sourceURL.getBlobUrl(), null, null, null, smac, null).statusCode() == 201 + bc.appendBlockFromUrlWithResponse(sourceURL.getBlobUrl(), null, null, null, smac, null, null).getStatusCode() == 201 where: sourceIfModifiedSince | sourceIfUnmodifiedSince | sourceIfMatch | sourceIfNoneMatch @@ -455,20 +469,20 @@ class AppendBlobAPITest extends APISpec { @Unroll def "Append block from URL AC source fail"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null, null, null) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) - def sourceURL = cu.getAppendBlobClient(generateBlobName()) + def sourceURL = cc.getAppendBlobClient(generateBlobName()) sourceURL.create() - sourceURL.appendBlock(defaultInputStream.get(), defaultDataSize).statusCode() + sourceURL.appendBlockWithResponse(defaultInputStream.get(), defaultDataSize, null, null, null).getStatusCode() def smac = new SourceModifiedAccessConditions() - .sourceIfModifiedSince(sourceIfModifiedSince) - .sourceIfUnmodifiedSince(sourceIfUnmodifiedSince) - .sourceIfMatch(sourceIfMatch) - .sourceIfNoneMatch(setupBlobMatchCondition(sourceURL, sourceIfNoneMatch)) + .setSourceIfModifiedSince(sourceIfModifiedSince) + .setSourceIfUnmodifiedSince(sourceIfUnmodifiedSince) + .setSourceIfMatch(sourceIfMatch) + .setSourceIfNoneMatch(setupBlobMatchCondition(sourceURL, sourceIfNoneMatch)) when: - bu.appendBlockFromUrl(sourceURL.getBlobUrl(), null, null, null, smac, null) + bc.appendBlockFromUrl(sourceURL.getBlobUrl(), null, null, null, smac, null) then: thrown(StorageException) 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 4ad895869cba..c2455e98ecd4 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 @@ -4,39 +4,55 @@ package com.azure.storage.blob import com.azure.core.http.HttpHeaders -import com.azure.core.http.HttpPipelineCallContext -import com.azure.core.http.HttpPipelineNextPolicy -import com.azure.core.http.policy.HttpPipelinePolicy import com.azure.core.http.rest.Response import com.azure.core.http.rest.VoidResponse import com.azure.core.implementation.util.ImplUtils -import com.azure.storage.blob.models.* -import reactor.core.publisher.Flux -import reactor.core.publisher.Mono +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.BlobRange +import com.azure.storage.blob.models.BlobType +import com.azure.storage.blob.models.CopyStatusType +import com.azure.storage.blob.models.DeleteSnapshotsOptionType +import com.azure.storage.blob.models.LeaseAccessConditions +import com.azure.storage.blob.models.LeaseDurationType +import com.azure.storage.blob.models.LeaseStateType +import com.azure.storage.blob.models.LeaseStatusType +import com.azure.storage.blob.models.Metadata +import com.azure.storage.blob.models.ModifiedAccessConditions +import com.azure.storage.blob.models.PublicAccessType +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.StorageErrorCode +import com.azure.storage.blob.models.StorageException +import com.azure.storage.blob.models.SyncCopyStatusType import spock.lang.Unroll import java.nio.ByteBuffer +import java.nio.file.FileAlreadyExistsException import java.security.MessageDigest import java.time.OffsetDateTime class BlobAPITest extends APISpec { - BlobClient bu + BlobClient bc def setup() { - bu = cu.getBlockBlobClient(generateBlobName()) - bu.upload(defaultInputStream.get(), defaultDataSize) + bc = cc.getBlockBlobClient(generateBlobName()) + bc.upload(defaultInputStream.get(), defaultDataSize) } def "Download all null"() { when: - ByteArrayOutputStream stream = new ByteArrayOutputStream() - VoidResponse response = bu.download(stream) - ByteBuffer body = ByteBuffer.wrap(stream.toByteArray()) - HttpHeaders headers = response.headers() + def stream = new ByteArrayOutputStream() + def response = bc.downloadWithResponse(stream, null, null, null, false, null, null) + def body = ByteBuffer.wrap(stream.toByteArray()) + def headers = response.getHeaders() then: body == defaultData - ImplUtils.isNullOrEmpty(getMetadataFromHeaders(headers)) + headers.toMap().keySet().stream().noneMatch({ it.startsWith("x-ms-meta-") }) headers.value("Content-Length") != null headers.value("Content-Type") != null headers.value("Content-Range") == null @@ -64,12 +80,12 @@ class BlobAPITest extends APISpec { def "Download empty file"() { setup: - bu = cu.getAppendBlobClient("emptyAppendBlob") - bu.create() + bc = cc.getAppendBlobClient("emptyAppendBlob") + bc.create() when: def outStream = new ByteArrayOutputStream() - bu.download(outStream) + bc.download(outStream) def result = outStream.toByteArray() then: @@ -91,31 +107,12 @@ class BlobAPITest extends APISpec { constructed in BlobClient.download(). */ setup: - HttpPipelinePolicy mockPolicy = Mock(HttpPipelinePolicy) { - process(_ as HttpPipelineCallContext, _ as HttpPipelineNextPolicy) >> { - HttpPipelineCallContext context, HttpPipelineNextPolicy next -> - return next.process() - .flatMap { - if (it.request().headers().value("x-ms-range") != "bytes=2-6") { - return Mono.error(new IllegalArgumentException("The range header was not set correctly on retry.")) - } else { - // ETag can be a dummy value. It's not validated, but DownloadResponse requires one - return Mono.just(new MockDownloadHttpResponse(it, 206, Flux.error(new IOException()))) - } - } - } - } - - BlobClient bu2 = new BlobClientBuilder() - .endpoint(bu.getBlobUrl().toString()) - .credential(primaryCreds) - .addPolicy(mockPolicy) - .buildBlobClient() + BlobClient bu2 = getBlobClient(primaryCredential, bc.getBlobUrl().toString(), new MockRetryRangeResponsePolicy()) when: BlobRange range = new BlobRange(2, 5L) ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(3) - bu2.download(new ByteArrayOutputStream(), range, options, null, false, null) + bu2.downloadWithResponse(new ByteArrayOutputStream(), range, options, null, false, null, null) then: /* @@ -129,7 +126,7 @@ class BlobAPITest extends APISpec { def "Download min"() { when: def outStream = new ByteArrayOutputStream() - bu.download(outStream) + bc.download(outStream) byte[] result = outStream.toByteArray() then: @@ -143,7 +140,7 @@ class BlobAPITest extends APISpec { when: def outStream = new ByteArrayOutputStream() - bu.download(outStream, range, null, null, false, null) + bc.downloadWithResponse(outStream, range, null, null, false, null, null) String bodyStr = outStream.toString() then: @@ -152,27 +149,27 @@ class BlobAPITest extends APISpec { where: offset | count || expectedData 0 | null || defaultText - 0 | 5L || defaultText.substring(0, 5) + 0 | 5L || defaultText.substring(0, 5) 3 | 2L || defaultText.substring(3, 3 + 2) } @Unroll def "Download AC"() { setup: - match = setupBlobMatchCondition(bu, match) - leaseID = setupBlobLeaseCondition(bu, leaseID) + match = setupBlobMatchCondition(bc, match) + leaseID = setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions().ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions().setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) when: - def response = bu.download(new ByteArrayOutputStream(), null, null, bac, false, null) + def response = bc.downloadWithResponse(new ByteArrayOutputStream(), null, null, bac, false, null, null) then: - response.statusCode() == 200 + response.getStatusCode() == 200 where: modified | unmodified | match | noneMatch | leaseID @@ -187,17 +184,17 @@ class BlobAPITest extends APISpec { @Unroll def "Download AC fail"() { setup: - setupBlobLeaseCondition(bu, leaseID) + setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(setupBlobMatchCondition(bu, noneMatch))) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(setupBlobMatchCondition(bc, noneMatch))) when: - bu.download(new ByteArrayOutputStream(), null, null, bac, false, null).statusCode() == 206 + bc.downloadWithResponse(new ByteArrayOutputStream(), null, null, bac, false, null, null).getStatusCode() then: thrown(StorageException) @@ -213,8 +210,8 @@ class BlobAPITest extends APISpec { def "Download md5"() { when: - VoidResponse response = bu.download(new ByteArrayOutputStream(), new BlobRange(0 ,3), null, null, true, null) - byte[] contentMD5 = response.headers().value("content-md5").getBytes() + VoidResponse response = bc.downloadWithResponse(new ByteArrayOutputStream(), new BlobRange(0, 3), null, null, true, null, null) + byte[] contentMD5 = response.getHeaders().value("content-md5").getBytes() then: contentMD5 == Base64.getEncoder().encode(MessageDigest.getInstance("MD5").digest(defaultText.substring(0, 3).getBytes())) @@ -222,10 +219,10 @@ class BlobAPITest extends APISpec { def "Download error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.download(null, null, null, null, false, null) + bc.download(null) then: thrown(StorageException) @@ -234,73 +231,109 @@ class BlobAPITest extends APISpec { def "Download snapshot"() { when: ByteArrayOutputStream originalStream = new ByteArrayOutputStream() - bu.download(originalStream) + bc.download(originalStream) - BlockBlobClient bu2 = bu.asBlockBlobClient() - BlobClient bu3 = bu.createSnapshot().value() - bu2.upload(new ByteArrayInputStream("ABC".getBytes()), 3) + def bc2 = bc.createSnapshot() + bc.asBlockBlobClient().upload(new ByteArrayInputStream("ABC".getBytes()), 3) then: ByteArrayOutputStream snapshotStream = new ByteArrayOutputStream() - bu3.download(snapshotStream) + bc2.download(snapshotStream) snapshotStream.toByteArray() == originalStream.toByteArray() } + def "Download to file exists"() { + setup: + def testFile = new File(testName + ".txt") + if (!testFile.exists()) { + assert testFile.createNewFile() + } + + when: + bc.downloadToFile(testFile.getPath()) + + then: + def ex = thrown(UncheckedIOException) + ex.getCause() instanceof FileAlreadyExistsException + + cleanup: + testFile.delete() + } + + def "Download to file does not exist"() { + setup: + def testFile = new File(testName + ".txt") + if (testFile.exists()) { + assert testFile.delete() + } + + when: + bc.downloadToFile(testFile.getPath()) + def fileContent = new Scanner(testFile).useDelimiter("\\Z").next() + + then: + fileContent == defaultText + + cleanup: + testFile.delete() + } + def "Get properties default"() { when: - Response response = bu.getProperties(null, null) - HttpHeaders headers = response.headers() + def response = bc.getPropertiesWithResponse(null, null, null) + def headers = response.getHeaders() + def properties = response.getValue() then: validateBasicHeaders(headers) - ImplUtils.isNullOrEmpty(getMetadataFromHeaders(headers)) - headers.value("x-ms-blob-type") == BlobType.BLOCK_BLOB.toString() - headers.value("x-ms-copy-completion-time") == null // tested in "copy" - headers.value("x-ms-copy-status-description") == null // only returned when the service has errors; cannot validate. - headers.value("x-ms-copy-id") == null // tested in "abort copy" - headers.value("x-ms-copy-progress") == null // tested in "copy" - headers.value("x-ms-copy-source") == null // tested in "copy" - headers.value("x-ms-copy-status") == null // tested in "copy" - headers.value("x-ms-incremental-copy") == null // tested in PageBlob."start incremental copy" - headers.value("x-ms-copy-destination-snapshot") == null // tested in PageBlob."start incremental copy" - headers.value("x-ms-lease-duration") == null // tested in "acquire lease" - headers.value("x-ms-lease-state") == LeaseStateType.AVAILABLE.toString() - headers.value("x-ms-lease-status") == LeaseStatusType.UNLOCKED.toString() - headers.value("Content-Length") != null - headers.value("Content-Type") != null - headers.value("Content-MD5") != null - headers.value("Content-Encoding") == null // tested in "set HTTP headers" - headers.value("Content-Disposition") == null // tested in "set HTTP headers" - headers.value("Content-Language") == null // tested in "set HTTP headers" - headers.value("Cache-Control") == null // tested in "set HTTP headers" - headers.value("x-ms-blob-sequence-number") == null // tested in PageBlob."create sequence number" + ImplUtils.isNullOrEmpty(properties.getMetadata()) + properties.getBlobType() == BlobType.BLOCK_BLOB + properties.getCopyCompletionTime() == null // tested in "copy" + properties.getCopyStatusDescription() == null // only returned when the service has errors; cannot validate. + properties.getCopyId() == null // tested in "abort copy" + properties.getCopyProgress() == null // tested in "copy" + properties.getCopySource() == null // tested in "copy" + properties.getCopyStatus() == null // tested in "copy" + !properties.isIncrementalCopy() // tested in PageBlob."start incremental copy" + properties.getCopyDestinationSnapshot() == null // tested in PageBlob."start incremental copy" + properties.getLeaseDuration() == null // tested in "acquire lease" + properties.getLeaseState() == LeaseStateType.AVAILABLE + properties.getLeaseStatus() == LeaseStatusType.UNLOCKED + properties.getBlobSize() >= 0 + properties.getContentType() != null + properties.getContentMD5() != null + properties.getContentEncoding() == null // tested in "set HTTP headers" + properties.getContentDisposition() == null // tested in "set HTTP headers" + properties.getContentLanguage() == null // tested in "set HTTP headers" + properties.getCacheControl() == null // tested in "set HTTP headers" + properties.getBlobSequenceNumber() == null // tested in PageBlob."create sequence number" headers.value("Accept-Ranges") == "bytes" - headers.value("x-ms-blob-committed-block-count") == null // tested in AppendBlob."append block" - Boolean.parseBoolean(headers.value("x-ms-server-encrypted")) - headers.value("x-ms-access-tier") == AccessTier.HOT.toString() - Boolean.parseBoolean(headers.value("x-ms-access-tier-inferred")) - headers.value("x-ms-archive-status") == null - headers.value("x-ms-creation-time") != null + properties.getCommittedBlockCount() == null // tested in AppendBlob."append block" + properties.isServerEncrypted() + properties.getAccessTier() == AccessTier.HOT + properties.isAccessTierInferred() + properties.getArchiveStatus() == null + properties.getCreationTime() != null } def "Get properties min"() { expect: - bu.getProperties().statusCode() == 200 + bc.getPropertiesWithResponse(null, null, null).getStatusCode() == 200 } @Unroll def "Get properties AC"() { setup: BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(setupBlobMatchCondition(bu, match)) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(setupBlobLeaseCondition(bc, leaseID))) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(setupBlobMatchCondition(bc, match)) + .setIfNoneMatch(noneMatch)) expect: - bu.getProperties(bac, null).statusCode() == 200 + bc.getPropertiesWithResponse(bac, null, null).getStatusCode() == 200 where: modified | unmodified | match | noneMatch | leaseID @@ -316,15 +349,15 @@ class BlobAPITest extends APISpec { def "Get properties AC fail"() { setup: BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(setupBlobMatchCondition(bu, noneMatch))) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(setupBlobLeaseCondition(bc, leaseID))) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(setupBlobMatchCondition(bc, noneMatch))) when: - bu.getProperties(bac, null) + bc.getPropertiesWithResponse(bac, null, null) then: thrown(StorageException) @@ -340,10 +373,10 @@ class BlobAPITest extends APISpec { def "Get properties error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.getProperties(null, null) + bc.getProperties() then: thrown(StorageException) @@ -351,46 +384,46 @@ class BlobAPITest extends APISpec { def "Set HTTP headers null"() { setup: - VoidResponse response = bu.setHTTPHeaders(null) + VoidResponse response = bc.setHTTPHeadersWithResponse(null, null, null, null) expect: - response.statusCode() == 200 - validateBasicHeaders(response.headers()) + response.getStatusCode() == 200 + validateBasicHeaders(response.getHeaders()) } def "Set HTTP headers min"() { - when: - BlobProperties properties = bu.getProperties().value() + setup: + BlobProperties properties = bc.getProperties() BlobHTTPHeaders headers = new BlobHTTPHeaders() - .blobContentEncoding(properties.contentEncoding()) - .blobContentDisposition(properties.contentDisposition()) - .blobContentType("type") - .blobCacheControl(properties.cacheControl()) - .blobContentLanguage(properties.contentLanguage()) - .blobContentMD5(Base64.getEncoder().encode(MessageDigest.getInstance("MD5").digest(defaultData.array()))) + .setBlobContentEncoding(properties.getContentEncoding()) + .setBlobContentDisposition(properties.getContentDisposition()) + .setBlobContentType("type") + .setBlobCacheControl(properties.getCacheControl()) + .setBlobContentLanguage(properties.getContentLanguage()) + .setBlobContentMD5(Base64.getEncoder().encode(MessageDigest.getInstance("MD5").digest(defaultData.array()))) - bu.setHTTPHeaders(headers) + bc.setHTTPHeaders(headers) - then: - bu.getProperties().headers().value("Content-Type") == "type" + expect: + bc.getProperties().getContentType() == "type" } @Unroll def "Set HTTP headers headers"() { setup: - BlobHTTPHeaders putHeaders = new BlobHTTPHeaders().blobCacheControl(cacheControl) - .blobContentDisposition(contentDisposition) - .blobContentEncoding(contentEncoding) - .blobContentLanguage(contentLanguage) - .blobContentMD5(contentMD5) - .blobContentType(contentType) - - bu.setHTTPHeaders(putHeaders) + BlobHTTPHeaders putHeaders = new BlobHTTPHeaders().setBlobCacheControl(cacheControl) + .setBlobContentDisposition(contentDisposition) + .setBlobContentEncoding(contentEncoding) + .setBlobContentLanguage(contentLanguage) + .setBlobContentMD5(contentMD5) + .setBlobContentType(contentType) - Response response = bu.getProperties() + bc.setHTTPHeaders(putHeaders) expect: - validateBlobProperties(response, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentMD5, contentType) + validateBlobProperties( + bc.getPropertiesWithResponse(null, null, null), + cacheControl, contentDisposition, contentEncoding, contentLanguage, contentMD5, contentType) where: cacheControl | contentDisposition | contentEncoding | contentLanguage | contentMD5 | contentType @@ -402,18 +435,18 @@ class BlobAPITest extends APISpec { @Unroll def "Set HTTP headers AC"() { setup: - match = setupBlobMatchCondition(bu, match) - leaseID = setupBlobLeaseCondition(bu, leaseID) + match = setupBlobMatchCondition(bc, match) + leaseID = setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) expect: - bu.setHTTPHeaders(null, bac, null).statusCode() == 200 + bc.setHTTPHeadersWithResponse(null, bac, null, null).getStatusCode() == 200 where: modified | unmodified | match | noneMatch | leaseID @@ -428,18 +461,18 @@ class BlobAPITest extends APISpec { @Unroll def "Set HTTP headers AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) - setupBlobLeaseCondition(bu, leaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) when: - bu.setHTTPHeaders(null, bac, null) + bc.setHTTPHeadersWithResponse(null, bac, null, null) then: thrown(StorageException) @@ -455,36 +488,36 @@ class BlobAPITest extends APISpec { def "Set HTTP headers error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.setHTTPHeaders(null, null, null) + bc.setHTTPHeaders(null) then: thrown(StorageException) } def "Set metadata all null"() { - setup: - VoidResponse response = bu.setMetadata(null, null, null) + when: + def response = bc.setMetadataWithResponse(null, null, null, null) - expect: - bu.getProperties(null, null).value().metadata().size() == 0 - response.statusCode() == 200 - validateBasicHeaders(response.headers()) - Boolean.parseBoolean(response.headers().value("x-ms-request-server-encrypted")) + then: + bc.getProperties().getMetadata().size() == 0 + response.getStatusCode() == 200 + validateBasicHeaders(response.getHeaders()) + Boolean.parseBoolean(response.getHeaders().value("x-ms-request-server-encrypted")) } def "Set metadata min"() { setup: - Metadata metadata = new Metadata() + def metadata = new Metadata() metadata.put("foo", "bar") when: - bu.setMetadata(metadata) + bc.setMetadata(metadata) then: - bu.getProperties().value().metadata() == metadata + bc.getProperties().getMetadata() == metadata } @Unroll @@ -499,8 +532,8 @@ class BlobAPITest extends APISpec { } expect: - bu.setMetadata(metadata, null, null).statusCode() == statusCode - bu.getProperties(null, null).value().metadata() == metadata + bc.setMetadataWithResponse(metadata, null, null, null).getStatusCode() == statusCode + bc.getProperties().getMetadata() == metadata where: key1 | value1 | key2 | value2 || statusCode @@ -511,18 +544,18 @@ class BlobAPITest extends APISpec { @Unroll def "Set metadata AC"() { setup: - match = setupBlobMatchCondition(bu, match) - leaseID = setupBlobLeaseCondition(bu, leaseID) + match = setupBlobMatchCondition(bc, match) + leaseID = setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) expect: - bu.setMetadata(null, bac, null).statusCode() == 200 + bc.setMetadataWithResponse(null, bac, null, null).getStatusCode() == 200 where: modified | unmodified | match | noneMatch | leaseID @@ -537,19 +570,19 @@ class BlobAPITest extends APISpec { @Unroll def "Set metadata AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) - setupBlobLeaseCondition(bu, leaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) when: - bu.setMetadata(null, bac, null) + bc.setMetadataWithResponse(null, bac, null, null) then: thrown(StorageException) @@ -565,10 +598,10 @@ class BlobAPITest extends APISpec { def "Set metadata error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.setMetadata(null, null, null) + bc.setMetadata(null) then: thrown(StorageException) @@ -576,16 +609,20 @@ class BlobAPITest extends APISpec { @Unroll def "Acquire lease"() { - setup: - String leaseId = bu.acquireLease(proposedID, leaseTime, null, null).value() - when: - HttpHeaders headers = bu.getProperties(null, null).headers() + def leaseId = bc.acquireLease(proposedID, leaseTime) then: - headers.value("x-ms-lease-state") == leaseState.toString() - headers.value("x-ms-lease-duration") == leaseDuration.toString() leaseId != null + + when: + def response = bc.getPropertiesWithResponse(null, null, null) + def properties = response.getValue() + def headers = response.getHeaders() + + then: + properties.getLeaseState() == leaseState + properties.getLeaseDuration() == leaseDuration validateBasicHeaders(headers) where: @@ -596,22 +633,22 @@ class BlobAPITest extends APISpec { } def "Acquire lease min"() { - setup: - bu.acquireLease(null, -1).statusCode() == 201 + expect: + bc.acquireLeaseWithResponse(null, -1, null, null, null).getStatusCode() == 201 } @Unroll def "Acquire lease AC"() { setup: - match = setupBlobMatchCondition(bu, match) + match = setupBlobMatchCondition(bc, match) def mac = new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch) expect: - bu.acquireLease(null, -1, mac, null).statusCode() == 201 + bc.acquireLeaseWithResponse(null, -1, mac, null, null).getStatusCode() == 201 where: modified | unmodified | match | noneMatch @@ -625,15 +662,15 @@ class BlobAPITest extends APISpec { @Unroll def "Acquire lease AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) + noneMatch = setupBlobMatchCondition(bc, noneMatch) def mac = new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch) when: - bu.acquireLease(null, -1, mac, null) + bc.acquireLeaseWithResponse(null, -1, mac, null, null) then: thrown(StorageException) @@ -648,10 +685,10 @@ class BlobAPITest extends APISpec { def "Acquire lease error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.acquireLease(null, 20, null, null) + bc.acquireLease(null, 20) then: thrown(StorageException) @@ -659,38 +696,39 @@ class BlobAPITest extends APISpec { def "Renew lease"() { setup: - String leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + String leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) - Thread.sleep(16000) // Wait for the lease to expire to ensure we are actually renewing it - Response renewLeaseResponse = bu.renewLease(leaseID, null, null) + // If running in live mode wait for the lease to expire to ensure we are actually renewing it + sleepIfRecord(16000) + Response renewLeaseResponse = bc.renewLeaseWithResponse(leaseID, null, null, null) expect: - bu.getProperties(null, null).headers().value("x-ms-lease-state") == LeaseStateType.LEASED.toString() - validateBasicHeaders(renewLeaseResponse.headers()) - renewLeaseResponse.value() != null + bc.getProperties().getLeaseState() == LeaseStateType.LEASED + validateBasicHeaders(renewLeaseResponse.getHeaders()) + renewLeaseResponse.getValue() != null } def "Renew lease min"() { setup: - String leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + String leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) expect: - bu.renewLease(leaseID).statusCode() == 200 + bc.renewLeaseWithResponse(leaseID, null, null, null).getStatusCode() == 200 } @Unroll def "Renew lease AC"() { setup: - match = setupBlobMatchCondition(bu, match) - String leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + match = setupBlobMatchCondition(bc, match) + String leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) def mac = new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch) expect: - bu.renewLease(leaseID, mac, null).statusCode() == 200 + bc.renewLeaseWithResponse(leaseID, mac, null, null).getStatusCode() == 200 where: modified | unmodified | match | noneMatch @@ -703,16 +741,16 @@ class BlobAPITest extends APISpec { @Unroll def "Renew lease AC fail"() { - noneMatch = setupBlobMatchCondition(bu, noneMatch) - String leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + String leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) def mac = new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch) when: - bu.renewLease(leaseID, mac, null) + bc.renewLeaseWithResponse(leaseID, mac, null, null) then: thrown(StorageException) @@ -727,10 +765,10 @@ class BlobAPITest extends APISpec { def "Renew lease error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.renewLease("id", null, null) + bc.renewLease("id") then: thrown(StorageException) @@ -738,36 +776,35 @@ class BlobAPITest extends APISpec { def "Release lease"() { setup: - String leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) - - HttpHeaders headers = bu.releaseLease(leaseID, null, null).headers() + String leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) + HttpHeaders headers = bc.releaseLeaseWithResponse(leaseID, null, null, null).getHeaders() expect: - bu.getProperties(null, null).headers().value("x-ms-lease-state") == LeaseStateType.AVAILABLE.toString() + bc.getProperties().getLeaseState() == LeaseStateType.AVAILABLE validateBasicHeaders(headers) } def "Release lease min"() { setup: - String leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + String leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) expect: - bu.releaseLease(leaseID).statusCode() == 200 + bc.releaseLeaseWithResponse(leaseID, null, null, null).getStatusCode() == 200 } @Unroll def "Release lease AC"() { setup: - match = setupBlobMatchCondition(bu, match) - String leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + match = setupBlobMatchCondition(bc, match) + String leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) def mac = new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch) expect: - bu.releaseLease(leaseID, mac, null).statusCode() == 200 + bc.releaseLeaseWithResponse(leaseID, mac, null, null).getStatusCode() == 200 where: modified | unmodified | match | noneMatch @@ -781,16 +818,16 @@ class BlobAPITest extends APISpec { @Unroll def "Release lease AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) - String leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + String leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) def mac = new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch) when: - bu.releaseLease(leaseID, mac, null) + bc.releaseLeaseWithResponse(leaseID, mac, null, null) then: thrown(StorageException) @@ -805,10 +842,10 @@ class BlobAPITest extends APISpec { def "Release lease error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.releaseLease("id", null, null) + bc.releaseLease("id") then: thrown(StorageException) @@ -817,44 +854,44 @@ class BlobAPITest extends APISpec { @Unroll def "Break lease"() { setup: - bu.acquireLease(UUID.randomUUID().toString(), leaseTime, null, null) + bc.acquireLeaseWithResponse(getRandomUUID(), leaseTime, null, null, null) - Response breakLeaseResponse = bu.breakLease(breakPeriod, null, null) - String leaseState = bu.getProperties(null, null).headers().value("x-ms-lease-state") + Response breakLeaseResponse = bc.breakLeaseWithResponse(breakPeriod, null, null, null) + def leaseState = bc.getProperties().getLeaseState() expect: - leaseState == LeaseStateType.BROKEN.toString() || leaseState == LeaseStateType.BREAKING.toString() - breakLeaseResponse.value() <= remainingTime - validateBasicHeaders(breakLeaseResponse.headers()) + leaseState == LeaseStateType.BROKEN || leaseState == LeaseStateType.BREAKING + breakLeaseResponse.getValue() <= remainingTime + validateBasicHeaders(breakLeaseResponse.getHeaders()) where: leaseTime | breakPeriod | remainingTime - -1 | null | 0 - -1 | 20 | 25 - 20 | 15 | 16 + -1 | null | 0 + -1 | 20 | 25 + 20 | 15 | 16 } def "Break lease min"() { setup: - setupBlobLeaseCondition(bu, receivedLeaseID) + setupBlobLeaseCondition(bc, receivedLeaseID) expect: - bu.breakLease().statusCode() == 202 + bc.breakLeaseWithResponse(null, null, null, null).getStatusCode() == 202 } @Unroll def "Break lease AC"() { setup: - match = setupBlobMatchCondition(bu, match) - setupBlobLeaseCondition(bu, receivedLeaseID) + match = setupBlobMatchCondition(bc, match) + setupBlobLeaseCondition(bc, receivedLeaseID) def mac = new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch) expect: - bu.breakLease(null, mac, null).statusCode() == 202 + bc.breakLeaseWithResponse(null, mac, null, null).getStatusCode() == 202 where: modified | unmodified | match | noneMatch @@ -868,16 +905,16 @@ class BlobAPITest extends APISpec { @Unroll def "Break lease AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) - setupBlobLeaseCondition(bu, receivedLeaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + setupBlobLeaseCondition(bc, receivedLeaseID) def mac = new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch) when: - bu.breakLease(null, mac, null) + bc.breakLeaseWithResponse(null, mac, null, null) then: thrown(StorageException) @@ -892,10 +929,10 @@ class BlobAPITest extends APISpec { def "Break lease error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.breakLease(null, null, null) + bc.breakLease() then: thrown(StorageException) @@ -903,35 +940,35 @@ class BlobAPITest extends APISpec { def "Change lease"() { setup: - Response acquireLeaseResponse = bu.acquireLease(UUID.randomUUID().toString(), 15) - Response changeLeaseResponse = bu.changeLease(acquireLeaseResponse.value(), UUID.randomUUID().toString()) + String acquireLease = bc.acquireLease(getRandomUUID(), 15) + Response changeLeaseResponse = bc.changeLeaseWithResponse(acquireLease, getRandomUUID(), null, null, null) expect: - bu.releaseLease(changeLeaseResponse.value(), null, null).statusCode() == 200 - validateBasicHeaders(changeLeaseResponse.headers()) + bc.releaseLeaseWithResponse(changeLeaseResponse.getValue(), null, null, null).getStatusCode() == 200 + validateBasicHeaders(changeLeaseResponse.getHeaders()) } def "Change lease min"() { setup: - def leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + def leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) expect: - bu.changeLease(leaseID, UUID.randomUUID().toString()).statusCode() == 200 + bc.changeLeaseWithResponse(leaseID, getRandomUUID(), null, null, null).getStatusCode() == 200 } @Unroll def "Change lease AC"() { setup: - match = setupBlobMatchCondition(bu, match) - String leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + match = setupBlobMatchCondition(bc, match) + String leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) def mac = new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch) expect: - bu.changeLease(leaseID, UUID.randomUUID().toString(), mac, null).statusCode() == 200 + bc.changeLeaseWithResponse(leaseID, getRandomUUID(), mac, null, null).getStatusCode() == 200 where: modified | unmodified | match | noneMatch @@ -945,16 +982,16 @@ class BlobAPITest extends APISpec { @Unroll def "Change lease AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) - String leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + String leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) def mac = new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch) when: - bu.changeLease(leaseID, UUID.randomUUID().toString(), mac, null) + bc.changeLeaseWithResponse(leaseID, getRandomUUID(), mac, null, null) then: thrown(StorageException) @@ -969,10 +1006,10 @@ class BlobAPITest extends APISpec { def "Change lease error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.changeLease("id", "id", null, null) + bc.changeLease("id", "id") then: thrown(StorageException) @@ -980,17 +1017,15 @@ class BlobAPITest extends APISpec { def "Snapshot"() { when: - Response snapshotResponse = bu.createSnapshot() - BlobClient bu2 = snapshotResponse.value() + def response = bc.createSnapshotWithResponse(null, null, null, null) then: - bu2.getProperties().statusCode() == 200 - validateBasicHeaders(snapshotResponse.headers()) + response.getValue().exists() + validateBasicHeaders(response.getHeaders()) } def "Snapshot min"() { - expect: - bu.createSnapshot().statusCode() == 201 + bc.createSnapshotWithResponse(null, null, null, null).getStatusCode() == 201 } @Unroll @@ -1004,12 +1039,12 @@ class BlobAPITest extends APISpec { metadata.put(key2, value2) } - Response response = bu.createSnapshot(metadata, null, null) - BlobClient bu2 = response.value() + def response = bc.createSnapshotWithResponse(metadata, null, null, null) + def bcSnap = response.getValue() expect: - response.statusCode() == 201 - bu2.getProperties().value().metadata() == metadata + response.getStatusCode() == 201 + bcSnap.getProperties().getMetadata() == metadata where: key1 | value1 | key2 | value2 @@ -1020,18 +1055,18 @@ class BlobAPITest extends APISpec { @Unroll def "Snapshot AC"() { setup: - match = setupBlobMatchCondition(bu, match) - leaseID = setupBlobLeaseCondition(bu, leaseID) + match = setupBlobMatchCondition(bc, match) + leaseID = setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) expect: - bu.createSnapshot(null, bac, null).statusCode() == 201 + bc.createSnapshotWithResponse(null, bac, null, null).getStatusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID @@ -1046,19 +1081,19 @@ class BlobAPITest extends APISpec { @Unroll def "Snapshot AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) - setupBlobLeaseCondition(bu, leaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) when: - bu.createSnapshot(null, bac, null) + bc.createSnapshotWithResponse(null, bac, null, null) then: thrown(StorageException) @@ -1074,10 +1109,10 @@ class BlobAPITest extends APISpec { def "Snapshot error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.createSnapshot(null, null, null) + bc.createSnapshot() then: thrown(StorageException) @@ -1085,34 +1120,34 @@ class BlobAPITest extends APISpec { def "Copy"() { setup: - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) - HttpHeaders headers = - bu2.startCopyFromURL(bu.getBlobUrl(), null, null, null, null).headers() + def copyDestBlob = cc.getBlockBlobClient(generateBlobName()) + def headers = + copyDestBlob.startCopyFromURLWithResponse(bc.getBlobUrl(), null, null, null, null, null, null, null).getHeaders() when: - while (bu2.getProperties(null, null).headers().value("x-ms-copy-status") == CopyStatusType.PENDING.toString()) { - sleep(1000) + while (copyDestBlob.getProperties().getCopyStatus() == CopyStatusType.PENDING) { + sleepIfRecord(1000) } - HttpHeaders headers2 = bu2.getProperties(null, null).headers() + def properties = copyDestBlob.getProperties() then: - headers2.value("x-ms-copy-status") == CopyStatusType.SUCCESS.toString() - headers2.value("x-ms-copy-completion-time") != null - headers2.value("x-ms-copy-progress") != null - headers2.value("x-ms-copy-source") != null + properties.getCopyStatus() == CopyStatusType.SUCCESS + properties.getCopyCompletionTime() != null + properties.getCopyProgress() != null + properties.getCopySource() != null validateBasicHeaders(headers) headers.value("x-ms-copy-id") != null } def "Copy min"() { expect: - bu.startCopyFromURL(bu.getBlobUrl()).statusCode() == 202 + bc.startCopyFromURLWithResponse(bc.getBlobUrl(), null, null, null, null, null, null, null).getStatusCode() == 202 } @Unroll def "Copy metadata"() { setup: - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) + BlobClient bu2 = cc.getBlockBlobClient(generateBlobName()) Metadata metadata = new Metadata() if (key1 != null && value1 != null) { metadata.put(key1, value1) @@ -1121,14 +1156,13 @@ class BlobAPITest extends APISpec { metadata.put(key2, value2) } - String status = - bu2.startCopyFromURL(bu.getBlobUrl(), metadata, null, null, null) - .headers().value("x-ms-copy-status") + def status = bu2.startCopyFromURLWithResponse(bc.getBlobUrl(), metadata, null, null, null, null, null, null) + .getHeaders().value("x-ms-copy-status") OffsetDateTime start = OffsetDateTime.now() while (status != CopyStatusType.SUCCESS.toString()) { - sleep(1000) - status = bu2.getProperties().headers().value("x-ms-copy-status") + sleepIfRecord(1000) + status = bu2.getPropertiesWithResponse(null, null, null).getHeaders().value("x-ms-copy-status") OffsetDateTime currentTime = OffsetDateTime.now() if (status == CopyStatusType.FAILED.toString() || currentTime.minusMinutes(1) == start) { throw new Exception("Copy failed or took too long") @@ -1136,7 +1170,7 @@ class BlobAPITest extends APISpec { } expect: - getMetadataFromHeaders(bu2.getProperties().headers()) == metadata + bu2.getProperties().getMetadata() == metadata where: key1 | value1 | key2 | value2 @@ -1147,16 +1181,16 @@ class BlobAPITest extends APISpec { @Unroll def "Copy source AC"() { setup: - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) - match = setupBlobMatchCondition(bu, match) + BlobClient copyDestBlob = cc.getBlockBlobClient(generateBlobName()) + match = setupBlobMatchCondition(bc, match) def mac = new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch) expect: - bu2.startCopyFromURL(bu.getBlobUrl(), null, mac, null, null).statusCode() == 202 + copyDestBlob.startCopyFromURLWithResponse(bc.getBlobUrl(), null, null, null, mac, null, null, null).getStatusCode() == 202 where: modified | unmodified | match | noneMatch @@ -1170,16 +1204,16 @@ class BlobAPITest extends APISpec { @Unroll def "Copy source AC fail"() { setup: - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) - noneMatch = setupBlobMatchCondition(bu, noneMatch) + BlobClient bu2 = cc.getBlockBlobClient(generateBlobName()) + noneMatch = setupBlobMatchCondition(bc, noneMatch) def mac = new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch) when: - bu2.startCopyFromURL(bu.getBlobUrl(), null, mac, null, null) + bu2.startCopyFromURLWithResponse(bc.getBlobUrl(), null, null, null, mac, null, null, null) then: thrown(StorageException) @@ -1195,21 +1229,21 @@ class BlobAPITest extends APISpec { @Unroll def "Copy dest AC"() { setup: - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) + BlobClient bu2 = cc.getBlockBlobClient(generateBlobName()) bu2.upload(defaultInputStream.get(), defaultDataSize) match = setupBlobMatchCondition(bu2, match) leaseID = setupBlobLeaseCondition(bu2, leaseID) BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) expect: - bu2.startCopyFromURL(bu.getBlobUrl(), null, null, bac, null).statusCode() == 202 + bu2.startCopyFromURLWithResponse(bc.getBlobUrl(), null, null, null, null, bac, null, null).getStatusCode() == 202 where: modified | unmodified | match | noneMatch | leaseID @@ -1224,20 +1258,20 @@ class BlobAPITest extends APISpec { @Unroll def "Copy dest AC fail"() { setup: - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) + BlobClient bu2 = cc.getBlockBlobClient(generateBlobName()) bu2.upload(defaultInputStream.get(), defaultDataSize) noneMatch = setupBlobMatchCondition(bu2, noneMatch) setupBlobLeaseCondition(bu2, leaseID) BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) when: - bu2.startCopyFromURL(bu.getBlobUrl(), null, null, bac, null) + bu2.startCopyFromURLWithResponse(bc.getBlobUrl(), null, null, null, null, bac, null, null) then: thrown(StorageException) @@ -1252,13 +1286,14 @@ class BlobAPITest extends APISpec { } def "Abort copy lease fail"() { + setup: // Data has to be large enough and copied between accounts to give us enough time to abort - bu.asBlockBlobClient() + bc.asBlockBlobClient() .upload(new ByteArrayInputStream(getRandomByteArray(8 * 1024 * 1024)), 8 * 1024 * 1024) // So we don't have to create a SAS. - cu.setAccessPolicy(PublicAccessType.BLOB, null) + cc.setAccessPolicy(PublicAccessType.BLOB, null) - ContainerClient cu2 = alternateServiceURL.getContainerClient(generateBlobName()) + ContainerClient cu2 = alternateBlobServiceClient.getContainerClient(generateBlobName()) cu2.create() BlockBlobClient bu2 = cu2.getBlockBlobClient(generateBlobName()) bu2.upload(defaultInputStream.get(), defaultDataSize) @@ -1266,68 +1301,69 @@ class BlobAPITest extends APISpec { when: String copyID = - bu2.startCopyFromURL(bu.getBlobUrl(), null, null, - new BlobAccessConditions().leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)), null).value() - bu2.abortCopyFromURL(copyID, new LeaseAccessConditions().leaseId(garbageLeaseID), null) + bu2.startCopyFromURLWithResponse(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) then: def e = thrown(StorageException) - e.statusCode() == 412 + e.getStatusCode() == 412 + + cleanup: cu2.delete() } def "Abort copy"() { setup: // Data has to be large enough and copied between accounts to give us enough time to abort - bu.asBlockBlobClient().upload(new ByteArrayInputStream(getRandomByteArray(8 * 1024 * 1024)), 8 * 1024 * 1024) + bc.asBlockBlobClient().upload(new ByteArrayInputStream(getRandomByteArray(8 * 1024 * 1024)), 8 * 1024 * 1024) // So we don't have to create a SAS. - cu.setAccessPolicy(PublicAccessType.BLOB, null) + cc.setAccessPolicy(PublicAccessType.BLOB, null) - ContainerClient cu2 = alternateServiceURL.getContainerClient(generateBlobName()) + ContainerClient cu2 = alternateBlobServiceClient.getContainerClient(generateBlobName()) cu2.create() BlobClient bu2 = cu2.getBlobClient(generateBlobName()) when: - String copyID = bu2.startCopyFromURL(bu.getBlobUrl()).value() - VoidResponse response = bu2.abortCopyFromURL(copyID) - HttpHeaders headers = response.headers() + String copyID = bu2.startCopyFromURLWithResponse(bc.getBlobUrl(), null, null, null, null, null, null, null).getValue() + VoidResponse response = bu2.abortCopyFromURLWithResponse(copyID, null, null, null) + HttpHeaders headers = response.getHeaders() then: - response.statusCode() == 204 + response.getStatusCode() == 204 headers.value("x-ms-request-id") != null headers.value("x-ms-version") != null headers.value("Date") != null // Normal test cleanup will not clean up containers in the alternate account. - cu2.delete().statusCode() == 202 + cu2.deleteWithResponse(null, null, null).getStatusCode() == 202 } def "Abort copy min"() { setup: // Data has to be large enough and copied between accounts to give us enough time to abort - bu.asBlockBlobClient().upload(new ByteArrayInputStream(getRandomByteArray(8 * 1024 * 1024)), 8 * 1024 * 1024) + bc.asBlockBlobClient().upload(new ByteArrayInputStream(getRandomByteArray(8 * 1024 * 1024)), 8 * 1024 * 1024) // So we don't have to create a SAS. - cu.setAccessPolicy(PublicAccessType.BLOB, null) + cc.setAccessPolicy(PublicAccessType.BLOB, null) - ContainerClient cu2 = alternateServiceURL.getContainerClient(generateBlobName()) + ContainerClient cu2 = alternateBlobServiceClient.getContainerClient(generateBlobName()) cu2.create() BlobClient bu2 = cu2.getBlobClient(generateBlobName()) when: - String copyID = - bu2.startCopyFromURL(bu.getBlobUrl()).value() + String copyID = bu2.startCopyFromURL(bc.getBlobUrl()) then: - bu2.abortCopyFromURL(copyID).statusCode() == 204 + bu2.abortCopyFromURLWithResponse(copyID, null, null, null).getStatusCode() == 204 } def "Abort copy lease"() { setup: // Data has to be large enough and copied between accounts to give us enough time to abort - bu.asBlockBlobClient().upload(new ByteArrayInputStream(getRandomByteArray(8 * 1024 * 1024)), 8 * 1024 * 1024) + bc.asBlockBlobClient().upload(new ByteArrayInputStream(getRandomByteArray(8 * 1024 * 1024)), 8 * 1024 * 1024) // So we don't have to create a SAS. - cu.setAccessPolicy(PublicAccessType.BLOB, null) + cc.setAccessPolicy(PublicAccessType.BLOB, null) - ContainerClient cu2 = alternateServiceURL.getContainerClient(generateContainerName()) + ContainerClient cu2 = alternateBlobServiceClient.getContainerClient(generateContainerName()) cu2.create() BlockBlobClient bu2 = cu2.getBlockBlobClient(generateBlobName()) bu2.upload(defaultInputStream.get(), defaultDataSize) @@ -1335,21 +1371,21 @@ class BlobAPITest extends APISpec { when: String copyID = - bu2.startCopyFromURL(bu.getBlobUrl(), null, null, - new BlobAccessConditions().leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)), null).value() + bu2.startCopyFromURLWithResponse(bc.getBlobUrl(), null, null, null, null, + new BlobAccessConditions().setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)), null, null).getValue() then: - bu2.abortCopyFromURL(copyID, new LeaseAccessConditions().leaseId(leaseID), null).statusCode() == 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() } def "Copy error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.startCopyFromURL(new URL("http://www.error.com")) + bc.startCopyFromURL(new URL("http://www.error.com")) then: thrown(StorageException) @@ -1357,10 +1393,10 @@ class BlobAPITest extends APISpec { def "Abort copy error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.abortCopyFromURL("id") + bc.abortCopyFromURL("id") then: thrown(StorageException) @@ -1369,11 +1405,13 @@ class BlobAPITest extends APISpec { def "Sync copy"() { setup: // Sync copy is a deep copy, which requires either sas or public access. - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) - HttpHeaders headers = bu2.copyFromURL(bu.getBlobUrl(), null, null,null, null).headers() + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + BlobClient bu2 = cc.getBlockBlobClient(generateBlobName()) - expect: + when: + HttpHeaders headers = bu2.copyFromURLWithResponse(bc.getBlobUrl(), null, null, null, null, null, null).getHeaders() + + then: headers.value("x-ms-copy-status") == SyncCopyStatusType.SUCCESS.toString() headers.value("x-ms-copy-id") != null validateBasicHeaders(headers) @@ -1381,18 +1419,18 @@ class BlobAPITest extends APISpec { def "Sync copy min"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + BlobClient bu2 = cc.getBlockBlobClient(generateBlobName()) expect: - bu2.copyFromURL(bu.getBlobUrl()).statusCode() == 202 + bu2.copyFromURLWithResponse(bc.getBlobUrl(), null, null, null, null, null, null).getStatusCode() == 202 } @Unroll def "Sync copy metadata"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + BlobClient bu2 = cc.getBlockBlobClient(generateBlobName()) Metadata metadata = new Metadata() if (key1 != null && value1 != null) { metadata.put(key1, value1) @@ -1402,10 +1440,10 @@ class BlobAPITest extends APISpec { } when: - bu2.copyFromURL(bu.getBlobUrl(), metadata, null, null, null) + bu2.copyFromURLWithResponse(bc.getBlobUrl(), metadata, null, null, null, null, null) then: - getMetadataFromHeaders(bu2.getProperties().headers()) == metadata + bu2.getProperties().getMetadata() == metadata where: key1 | value1 | key2 | value2 @@ -1416,17 +1454,17 @@ class BlobAPITest extends APISpec { @Unroll def "Sync copy source AC"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) - match = setupBlobMatchCondition(bu, match) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + BlobClient bu2 = cc.getBlockBlobClient(generateBlobName()) + match = setupBlobMatchCondition(bc, match) def mac = new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch) expect: - bu2.copyFromURL(bu.getBlobUrl(), null, mac, null, null).statusCode() == 202 + bu2.copyFromURLWithResponse(bc.getBlobUrl(), null, null, mac, null, null, null).getStatusCode() == 202 where: modified | unmodified | match | noneMatch @@ -1440,17 +1478,17 @@ class BlobAPITest extends APISpec { @Unroll def "Sync copy source AC fail"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) - noneMatch = setupBlobMatchCondition(bu, noneMatch) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + BlobClient bu2 = cc.getBlockBlobClient(generateBlobName()) + noneMatch = setupBlobMatchCondition(bc, noneMatch) def mac = new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch) when: - bu2.copyFromURL(bu.getBlobUrl(), null, mac, null, null) + bu2.copyFromURLWithResponse(bc.getBlobUrl(), null, null, mac, null, null, null) then: thrown(StorageException) @@ -1466,21 +1504,21 @@ class BlobAPITest extends APISpec { @Unroll def "Sync copy dest AC"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + BlobClient bu2 = cc.getBlockBlobClient(generateBlobName()) bu2.upload(defaultInputStream.get(), defaultDataSize) match = setupBlobMatchCondition(bu2, match) leaseID = setupBlobLeaseCondition(bu2, leaseID) BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) expect: - bu2.copyFromURL(bu.getBlobUrl(), null, null, bac, null).statusCode() == 202 + bu2.copyFromURLWithResponse(bc.getBlobUrl(), null, null, null, bac, null, null).getStatusCode() == 202 where: modified | unmodified | match | noneMatch | leaseID @@ -1495,21 +1533,21 @@ class BlobAPITest extends APISpec { @Unroll def "Sync copy dest AC fail"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - BlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + BlobClient bu2 = cc.getBlockBlobClient(generateBlobName()) bu2.upload(defaultInputStream.get(), defaultDataSize) noneMatch = setupBlobMatchCondition(bu2, noneMatch) setupBlobLeaseCondition(bu2, leaseID) BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) when: - bu2.copyFromURL(bu.getBlobUrl(), null, null, bac, null) + bu2.copyFromURLWithResponse(bc.getBlobUrl(), null, null, null, bac, null, null) then: thrown(StorageException) @@ -1525,10 +1563,10 @@ class BlobAPITest extends APISpec { def "Sync copy error"() { setup: - def bu2 = cu.getBlockBlobClient(generateBlobName()) + def bu2 = cc.getBlockBlobClient(generateBlobName()) when: - bu2.copyFromURL(bu.getBlobUrl()) + bu2.copyFromURL(bc.getBlobUrl()) then: thrown(StorageException) @@ -1536,11 +1574,11 @@ class BlobAPITest extends APISpec { def "Delete"() { when: - VoidResponse response = bu.delete() - HttpHeaders headers = response.headers() + VoidResponse response = bc.deleteWithResponse(null, null, null, null) + HttpHeaders headers = response.getHeaders() then: - response.statusCode() == 202 + response.getStatusCode() == 202 headers.value("x-ms-request-id") != null headers.value("x-ms-version") != null headers.value("Date") != null @@ -1548,28 +1586,22 @@ class BlobAPITest extends APISpec { def "Delete min"() { expect: - bu.delete().statusCode() == 202 + bc.deleteWithResponse(null, null, null, null).getStatusCode() == 202 } @Unroll def "Delete options"() { setup: - bu.createSnapshot() + bc.createSnapshot() // Create an extra blob so the list isn't empty (null) when we delete base blob, too - BlockBlobClient bu2 = cu.getBlockBlobClient(generateBlobName()) + BlockBlobClient bu2 = cc.getBlockBlobClient(generateBlobName()) bu2.upload(defaultInputStream.get(), defaultDataSize) when: - bu.delete(option, null, null) + bc.deleteWithResponse(option, null, null, null) then: - Iterator blobs = cu.listBlobsFlat().iterator() - - int blobCount = 0 - for ( ; blobs.hasNext(); blobCount++ ) - blobs.next() - - blobCount == blobsRemaining + cc.listBlobsFlat().stream().count() == blobsRemaining where: option | blobsRemaining @@ -1580,18 +1612,18 @@ class BlobAPITest extends APISpec { @Unroll def "Delete AC"() { setup: - match = setupBlobMatchCondition(bu, match) - leaseID = setupBlobLeaseCondition(bu, leaseID) + match = setupBlobMatchCondition(bc, match) + leaseID = setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) expect: - bu.delete(DeleteSnapshotsOptionType.INCLUDE, bac, null).statusCode() == 202 + bc.deleteWithResponse(DeleteSnapshotsOptionType.INCLUDE, bac, null, null).getStatusCode() == 202 where: modified | unmodified | match | noneMatch | leaseID @@ -1606,18 +1638,18 @@ class BlobAPITest extends APISpec { @Unroll def "Delete AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) - setupBlobLeaseCondition(bu, leaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) when: - bu.delete(DeleteSnapshotsOptionType.INCLUDE, bac, null) + bc.deleteWithResponse(DeleteSnapshotsOptionType.INCLUDE, bac, null, null) then: thrown(StorageException) @@ -1633,10 +1665,10 @@ class BlobAPITest extends APISpec { def "Blob delete error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.delete(null, null, null) + bc.delete() then: thrown(StorageException) @@ -1645,21 +1677,23 @@ class BlobAPITest extends APISpec { @Unroll def "Set tier block blob"() { setup: - ContainerClient cu = blobStorageServiceURL.getContainerClient(generateContainerName()) - BlockBlobClient bu = cu.getBlockBlobClient(generateBlobName()) - cu.create() - bu.upload(defaultInputStream.get(), defaultData.remaining()) + ContainerClient cc = blobServiceClient.createContainer(generateContainerName()) + BlockBlobClient bc = cc.getBlockBlobClient(generateBlobName()) + bc.upload(defaultInputStream.get(), defaultData.remaining()) when: - VoidResponse initialResponse = bu.setTier(tier) - HttpHeaders headers = initialResponse.headers() + VoidResponse initialResponse = bc.setTierWithResponse(tier, null, null, null, null) + HttpHeaders headers = initialResponse.getHeaders() then: - initialResponse.statusCode() == 200 || initialResponse.statusCode() == 202 + initialResponse.getStatusCode() == 200 || initialResponse.getStatusCode() == 202 headers.value("x-ms-version") != null headers.value("x-ms-request-id") != null - bu.getProperties().headers().value("x-ms-access-tier") == tier.toString() - cu.listBlobsFlat().iterator().next().properties().accessTier() == tier + bc.getProperties().getAccessTier() == tier + cc.listBlobsFlat().iterator().next().getProperties().getAccessTier() == tier + + cleanup: + cc.delete() where: tier | _ @@ -1671,19 +1705,20 @@ class BlobAPITest extends APISpec { @Unroll def "Set tier page blob"() { setup: - ContainerClient cu = premiumServiceURL.getContainerClient(generateContainerName()) - cu.create() + ContainerClient cc = premiumBlobServiceClient.createContainer(generateContainerName()) - PageBlobClient bu = cu.getPageBlobClient(generateBlobName()) - bu.create(512) + def bc = cc.getPageBlobClient(generateBlobName()) + bc.setCreate(512) when: - bu.setTier(tier, null, null) + bc.setTier(tier) then: - bu.getProperties().headers().value("x-ms-access-tier") == tier.toString() - cu.listBlobsFlat().iterator().next().properties().accessTier() == tier - cu.delete() + bc.getProperties().getAccessTier() == tier + cc.listBlobsFlat().iterator().next().getProperties().getAccessTier() == tier + + cleanup: + cc.delete() where: tier | _ @@ -1698,33 +1733,34 @@ class BlobAPITest extends APISpec { def "Set tier min"() { setup: - ContainerClient cu = blobStorageServiceURL.getContainerClient(generateContainerName()) - BlockBlobClient bu = cu.getBlockBlobClient(generateBlobName()) - cu.create() + ContainerClient cc = blobServiceClient.createContainer(generateContainerName()) + BlockBlobClient bu = cc.getBlockBlobClient(generateBlobName()) bu.upload(defaultInputStream.get(), defaultData.remaining()) when: - int statusCode = bu.setTier(AccessTier.HOT).statusCode() + int statusCode = bc.setTierWithResponse(AccessTier.HOT, null, null, null, null).getStatusCode() then: statusCode == 200 || statusCode == 202 + + cleanup: + cc.delete() } def "Set tier inferred"() { setup: - ContainerClient cu = blobStorageServiceURL.getContainerClient(generateBlobName()) - BlockBlobClient bu = cu.getBlockBlobClient(generateBlobName()) - cu.create() - bu.upload(defaultInputStream.get(), defaultDataSize) + def cc = blobServiceClient.createContainer(generateBlobName()) + def bc = cc.getBlockBlobClient(generateBlobName()) + bc.upload(defaultInputStream.get(), defaultDataSize) when: - boolean inferred1 = Boolean.parseBoolean(bu.getProperties().headers().value("x-ms-access-tier-inferred")) - Boolean inferredList1 = cu.listBlobsFlat().iterator().next().properties().accessTierInferred() + boolean inferred1 = bc.getProperties().isAccessTierInferred() + Boolean inferredList1 = cc.listBlobsFlat().iterator().next().getProperties().isAccessTierInferred() - bu.setTier(AccessTier.HOT) + bc.setTier(AccessTier.HOT) - boolean inferred2 = Boolean.parseBoolean(bu.getProperties().headers().value("x-ms-access-tier-inferred")) - Boolean inferredList2 = cu.listBlobsFlat().iterator().next().properties().accessTierInferred() + boolean inferred2 = bc.getProperties().isAccessTierInferred() + Boolean inferredList2 = cc.listBlobsFlat().iterator().next().getProperties().isAccessTierInferred() then: inferred1 @@ -1736,43 +1772,45 @@ class BlobAPITest extends APISpec { @Unroll def "Set tier archive status"() { setup: - ContainerClient cu = blobStorageServiceURL.getContainerClient(generateBlobName()) - BlockBlobClient bu = cu.getBlockBlobClient(generateBlobName()) - cu.create() - bu.upload(defaultInputStream.get(), defaultDataSize) + def cc = blobServiceClient.createContainer(generateBlobName()) + def bc = cc.getBlockBlobClient(generateBlobName()) + bc.upload(defaultInputStream.get(), defaultDataSize) when: - bu.setTier(sourceTier) - bu.setTier(destTier) + bc.setTier(sourceTier) + bc.setTier(destTier) then: - bu.getProperties().headers().value("x-ms-archive-status") == status.toString() - cu.listBlobsFlat().iterator().next().properties().archiveStatus() == status + bc.getProperties().getArchiveStatus() == status + cc.listBlobsFlat().iterator().next().getProperties().getArchiveStatus() == status where: - sourceTier | destTier | status - AccessTier.ARCHIVE | AccessTier.COOL | ArchiveStatus.REHYDRATE_PENDING_TO_COOL - AccessTier.ARCHIVE | AccessTier.HOT | ArchiveStatus.REHYDRATE_PENDING_TO_HOT + sourceTier | destTier | priority | status + AccessTier.ARCHIVE | AccessTier.COOL | RehydratePriority.STANDARD | ArchiveStatus.REHYDRATE_PENDING_TO_COOL + AccessTier.ARCHIVE | AccessTier.HOT | RehydratePriority.STANDARD | ArchiveStatus.REHYDRATE_PENDING_TO_HOT + AccessTier.ARCHIVE | AccessTier.HOT | RehydratePriority.HIGH | ArchiveStatus.REHYDRATE_PENDING_TO_HOT } def "Set tier error"() { setup: - ContainerClient cu = blobStorageServiceURL.getContainerClient(generateBlobName()) - BlockBlobClient bu = cu.getBlockBlobClient(generateBlobName()) - cu.create() - bu.upload(defaultInputStream.get(), defaultDataSize) + def cc = blobServiceClient.createContainer(generateContainerName()) + def bc = cc.getBlockBlobClient(generateBlobName()) + bc.upload(defaultInputStream.get(), defaultDataSize) when: - bu.setTier(AccessTier.fromString("garbage")) + bc.setTier(AccessTier.fromString("garbage")) then: def e = thrown(StorageException) - e.errorCode() == StorageErrorCode.INVALID_HEADER_VALUE + e.getErrorCode() == StorageErrorCode.INVALID_HEADER_VALUE + + cleanup: + cc.delete() } def "Set tier illegal argument"() { when: - bu.setTier(null) + bc.setTier(null) then: thrown(IllegalArgumentException) @@ -1780,47 +1818,68 @@ class BlobAPITest extends APISpec { def "Set tier lease"() { setup: - ContainerClient cu = blobStorageServiceURL.getContainerClient(generateBlobName()) - BlockBlobClient bu = cu.getBlockBlobClient(generateBlobName()) - cu.create() - bu.upload(defaultInputStream.get(), defaultDataSize) - def leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + + def cc = blobServiceClient.createContainer(generateContainerName()) + def bc = cc.getBlockBlobClient(generateBlobName()) + bc.upload(defaultInputStream.get(), defaultDataSize) + def leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) when: - bu.setTier(AccessTier.HOT, new LeaseAccessConditions().leaseId(leaseID), null) + bc.setTierWithResponse(AccessTier.HOT, null, new LeaseAccessConditions().setLeaseId(leaseID), null, null) then: notThrown(StorageException) + + cleanup: + cc.delete() } def "Set tier lease fail"() { setup: - ContainerClient cu = blobStorageServiceURL.getContainerClient(generateBlobName()) - BlockBlobClient bu = cu.getBlockBlobClient(generateBlobName()) - cu.create() - bu.upload(defaultInputStream.get(), defaultDataSize) + def cc = blobServiceClient.createContainer(generateContainerName()) + def bc = cc.getBlockBlobClient(generateBlobName()) + bc.upload(defaultInputStream.get(), defaultDataSize) when: - bu.setTier(AccessTier.HOT, new LeaseAccessConditions().leaseId("garbage"), null) + bc.setTierWithResponse(AccessTier.HOT, null, new LeaseAccessConditions().setLeaseId("garbage"), null, null) then: thrown(StorageException) } + @Unroll + def "Copy with tier"() { + setup: + def bc = cc.getBlockBlobClient(generateBlobName()) + bc.uploadWithResponse(defaultInputStream.get(), defaultDataSize, null, null, tier1, null, null, null) + def bcCopy = cc.getBlockBlobClient(generateBlobName()) + + when: + bcCopy.copyFromURLWithResponse(new URL(bc.getBlobUrl().toString() + "?" + bc.generateSAS(OffsetDateTime.now().plusHours(1), new BlobSASPermission().setRead(true))), null, tier2, null, null, null, null) + + then: + bcCopy.getProperties().getAccessTier() == tier2 + + where: + tier1 | tier2 + AccessTier.HOT | AccessTier.COOL + AccessTier.COOL | AccessTier.HOT + } + def "Undelete"() { setup: enableSoftDelete() - bu.delete() + bc.delete() when: - HttpHeaders headers = bu.undelete().headers() - bu.getProperties() + def undeleteHeaders = bc.undeleteWithResponse(null, null).getHeaders() + bc.getProperties() then: notThrown(StorageException) - headers.value("x-ms-request-id") != null - headers.value("x-ms-version") != null - headers.value("Date") != null + undeleteHeaders.value("x-ms-request-id") != null + undeleteHeaders.value("x-ms-version") != null + undeleteHeaders.value("Date") != null disableSoftDelete() == null } @@ -1828,17 +1887,17 @@ class BlobAPITest extends APISpec { def "Undelete min"() { setup: enableSoftDelete() - bu.delete() + bc.delete() expect: - bu.undelete().statusCode() == 200 + bc.undeleteWithResponse(null, null).getStatusCode() == 200 } def "Undelete error"() { - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.undelete() + bc.undelete() then: thrown(StorageException) @@ -1846,28 +1905,26 @@ class BlobAPITest extends APISpec { def "Get account info"() { when: - Response response = primaryServiceURL.getAccountInfo() + Response response = primaryBlobServiceClient.getAccountInfoWithResponse(null, null) then: - response.headers().value("Date") != null - response.headers().value("x-ms-request-id") != null - response.headers().value("x-ms-version") != null - response.value().accountKind() != null - response.value().skuName() != null + response.getHeaders().value("Date") != null + response.getHeaders().value("x-ms-request-id") != null + response.getHeaders().value("x-ms-version") != null + response.getValue().getAccountKind() != null + response.getValue().getSkuName() != null } def "Get account info min"() { expect: - bu.getAccountInfo().statusCode() == 200 + bc.getAccountInfoWithResponse(null, null).getStatusCode() == 200 } def "Get account info error"() { when: - BlobServiceClient serviceURL = new BlobServiceClientBuilder() - .endpoint(primaryServiceURL.getAccountUrl().toString()) - .buildClient() - serviceURL.getContainerClient(generateContainerName()).getBlobClient(generateBlobName()) - .getAccountInfo(null) + BlobServiceClient serviceURL = getServiceClient(primaryBlobServiceClient.getAccountUrl().toString()) + + serviceURL.getContainerClient(generateContainerName()).getBlobClient(generateBlobName()).getAccountInfo() then: thrown(StorageException) 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 new file mode 100644 index 000000000000..d2ada0c39415 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.groovy @@ -0,0 +1,74 @@ +package com.azure.storage.blob + +import com.azure.storage.common.Constants +import spock.lang.Ignore + +class BlobOutputStreamTest extends APISpec { + private static int FOUR_MB = 4 * Constants.MB + + @Ignore + def "BlockBlob output stream"() { + setup: + byte[] data = getRandomByteArray(100 * Constants.MB) + BlockBlobClient blockBlobClient = cu.getBlockBlobClient(generateBlobName()) + + when: + BlobOutputStream outputStream = blockBlobClient.getBlobOutputStream() + outputStream.setWrite(data) + outputStream.close() + + then: + blockBlobClient.getProperties().getBlobSize() == data.length + convertInputStreamToByteArray(blockBlobClient.openInputStream()) == data + } + + @Ignore + def "PageBlob output stream"() { + setup: + byte[] data = getRandomByteArray(1024 * Constants.MB - 512) + PageBlobClient pageBlobClient = cu.getPageBlobClient(generateBlobName()) + pageBlobClient.setCreate(data.length) + + + when: + BlobOutputStream outputStream = pageBlobClient.getBlobOutputStream(data.length) + outputStream.setWrite(data) + outputStream.close() + + then: + convertInputStreamToByteArray(pageBlobClient.openInputStream()) == data + } + + @Ignore + def "AppendBlob output stream"() { + setup: + byte[] data = getRandomByteArray(64 * FOUR_MB) + AppendBlobClient appendBlobClient = cu.getAppendBlobClient(generateBlobName()) + appendBlobClient.setCreate() + + when: + BlobOutputStream outputStream = appendBlobClient.getBlobOutputStream() + for (int i = 0; i != 64; i++) { + outputStream.setWrite(Arrays.copyOfRange(data, i * FOUR_MB, ((i + 1) * FOUR_MB) - 1)) + } + outputStream.close() + + then: + appendBlobClient.getProperties().getBlobSize() == data.length + convertInputStreamToByteArray(appendBlobClient.openInputStream()) == data + } + + private static byte[] convertInputStreamToByteArray(InputStream inputStream) { + int b + ByteArrayOutputStream outputStream = new ByteArrayOutputStream() + try { + while ((b = inputStream.setRead()) != -1) { + outputStream.setWrite(b) + } + } catch (IOException ex) { + throw new UncheckedIOException(ex) + } + + return outputStream.toByteArray() + } +} diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.java deleted file mode 100644 index 899d0f2b6595..000000000000 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.java +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.storage.common.Constants; -import com.azure.storage.common.credentials.SharedKeyCredential; -import org.junit.Assert; -import org.junit.BeforeClass; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.UncheckedIOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -public class BlobOutputStreamTest { - private static final Random RANDOM = new Random(); - private static BlobServiceClient storageClient; - private static ContainerClient containerClient; - - @BeforeClass - public static void setup() { - storageClient = new BlobServiceClientBuilder() - .endpoint("https://" + System.getenv("ACCOUNT_NAME") + ".blob.core.windows.net") - .credential(new SharedKeyCredential(System.getenv("ACCOUNT_NAME"), System.getenv("ACCOUNT_KEY"))) -// .httpClient(HttpClient.createDefault().proxy(() -> new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888)))) - .buildClient(); - String containerName = "testcontainer" + RANDOM.nextInt(1000); - containerClient = storageClient.getContainerClient(containerName); - if (!containerClient.exists().value()) { - containerClient.create(); - } - } - -// @Test - public void testBlockBlobOutputStream() throws Exception { - String blobName = "testblob" + RANDOM.nextInt(1000); - int length = 100 * Constants.MB; - byte[] randomBytes = new byte[length]; - RANDOM.nextBytes(randomBytes); - - BlockBlobClient blockBlobClient = containerClient.getBlockBlobClient(blobName); - BlobOutputStream outStream = blockBlobClient.getBlobOutputStream(); - outStream.write(randomBytes); - outStream.close(); - - Assert.assertEquals(length, blockBlobClient.getProperties().value().blobSize()); - BlobInputStream blobInputStream = blockBlobClient.openInputStream(); - byte[] downloaded = convertInputStreamToByteArray(blobInputStream); - Assert.assertArrayEquals(randomBytes, downloaded); - } - -// @Test - public void testPageBlobOutputStream() throws Exception { - int length = 1024 * Constants.MB - 512; - String blobName = "testblob" + RANDOM.nextInt(1000); - byte[] randomBytes = new byte[length]; - RANDOM.nextBytes(randomBytes); - - PageBlobClient pageBlobClient = containerClient.getPageBlobClient(blobName); - pageBlobClient.create(length); - BlobOutputStream outStream = pageBlobClient.getBlobOutputStream(length); - outStream.write(randomBytes); - outStream.close(); - - BlobInputStream blobInputStream = pageBlobClient.openInputStream(); - byte[] downloaded = convertInputStreamToByteArray(blobInputStream); - Assert.assertArrayEquals(randomBytes, downloaded); - } - -// @Test - public void testAppendBlobOutputStream() throws Exception { - int length = 0; - String blobName = "testblob" + RANDOM.nextInt(1000); - List randomBytes = new ArrayList<>(); - ByteArrayOutputStream stream = new ByteArrayOutputStream(); - for (int i = 0; i != 64; ++i) { - int subLength = RANDOM.nextInt(4 * Constants.MB); - length += subLength; - byte[] bytes = new byte[subLength]; - RANDOM.nextBytes(bytes); - randomBytes.add(bytes); - stream.write(bytes); - } - - byte[] uploaded = stream.toByteArray(); - - AppendBlobClient appendBlobClient = containerClient.getAppendBlobClient(blobName); - appendBlobClient.create(); - BlobOutputStream outStream = appendBlobClient.getBlobOutputStream(); - for (int i = 0; i != 64; i++) { - outStream.write(randomBytes.get(i)); - } - outStream.close(); - - Assert.assertEquals(length, appendBlobClient.getProperties().value().blobSize()); - BlobInputStream blobInputStream = appendBlobClient.openInputStream(); - byte[] downloaded = convertInputStreamToByteArray(blobInputStream); - Assert.assertArrayEquals(uploaded, downloaded); - } - - private byte[] convertInputStreamToByteArray(InputStream inputStream) { - int b; - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - try { - while ((b = inputStream.read()) != -1) { - outputStream.write(b); - } - } catch (IOException ex) { - throw new UncheckedIOException(ex); - } - - return outputStream.toByteArray(); - } -} diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlockBlobAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlockBlobAPITest.groovy index d5aaa8a65dcd..6492c01b5d73 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlockBlobAPITest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlockBlobAPITest.groovy @@ -3,10 +3,34 @@ package com.azure.storage.blob +import com.azure.core.exception.UnexpectedLengthException import com.azure.core.http.HttpHeaders +import com.azure.core.http.HttpMethod +import com.azure.core.http.HttpPipelineCallContext +import com.azure.core.http.HttpPipelineNextPolicy +import com.azure.core.http.HttpRequest +import com.azure.core.http.policy.HttpLogDetailLevel +import com.azure.core.http.policy.HttpPipelinePolicy import com.azure.core.http.rest.Response -import com.azure.core.http.rest.VoidResponse -import com.azure.storage.blob.models.* +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.BlobRange +import com.azure.storage.blob.models.BlockItem +import com.azure.storage.blob.models.BlockListType +import com.azure.storage.blob.models.LeaseAccessConditions +import com.azure.storage.blob.models.Metadata +import com.azure.storage.blob.models.ModifiedAccessConditions +import com.azure.storage.blob.models.PublicAccessType +import com.azure.storage.blob.models.SourceModifiedAccessConditions +import com.azure.storage.blob.models.StorageErrorCode +import com.azure.storage.blob.models.StorageErrorException +import com.azure.storage.blob.models.StorageException +import com.azure.storage.common.policy.RequestRetryOptions +import reactor.core.publisher.Flux +import reactor.core.publisher.Mono +import spock.lang.Requires import spock.lang.Unroll import java.nio.ByteBuffer @@ -14,25 +38,24 @@ import java.nio.charset.StandardCharsets import java.security.MessageDigest class BlockBlobAPITest extends APISpec { - BlockBlobClient bu + BlockBlobClient bc + BlockBlobAsyncClient bac def setup() { - bu = cu.getBlockBlobClient(generateBlobName()) - bu.upload(defaultInputStream.get(), defaultDataSize) - } - - def getBlockID() { - return Base64.encoder.encodeToString(UUID.randomUUID().toString().getBytes(StandardCharsets.UTF_8)) + bc = cc.getBlockBlobClient(generateBlobName()) + bc.upload(defaultInputStream.get(), defaultDataSize) + bac = ccAsync.getBlockBlobAsyncClient(generateBlobName()) + bac.upload(defaultFlux, defaultDataSize) } def "Stage block"() { setup: - VoidResponse response = bu.stageBlock(getBlockID(), defaultInputStream.get(), defaultDataSize) - HttpHeaders headers = response.headers() + def response = bc.stageBlockWithResponse(getBlockID(), defaultInputStream.get(), defaultDataSize, null, null, null) + HttpHeaders headers = response.getHeaders() expect: - response.statusCode() == 201 - headers.value("Content-MD5") != null + response.getStatusCode() == 201 + headers.value("x-ms-content-crc64") != null headers.value("x-ms-request-id") != null headers.value("x-ms-version") != null headers.value("Date") != null @@ -40,31 +63,33 @@ class BlockBlobAPITest extends APISpec { } def "Stage block min"() { - expect: - bu.stageBlock(getBlockID(), defaultInputStream.get(), defaultDataSize).statusCode() == 201 + when: + bc.stageBlock(getBlockID(), defaultInputStream.get(), defaultDataSize) == 201 + + then: + bc.listBlocks(BlockListType.ALL).getUncommittedBlocks().size() == 1 } @Unroll def "Stage block illegal arguments"() { when: - bu.stageBlock(blockID, data == null ? null : data.get(), dataSize) + String blockID = (getBlockId) ? getBlockID() : null + bc.stageBlock(blockID, data == null ? null : data.get(), dataSize) then: - def e = thrown(Exception) - exceptionType.isInstance(e) + thrown(exceptionType) where: - blockID | data | dataSize | exceptionType - null | defaultInputStream | defaultDataSize | StorageException - getBlockID() | null | defaultDataSize | NullPointerException - getBlockID() | defaultInputStream | defaultDataSize + 1 | IndexOutOfBoundsException - // TODO (alzimmer): This doesn't throw an error as the stream is larger than the stated size - //getBlockID() | defaultInputStream | defaultDataSize - 1 | IllegalArgumentException + getBlockId | data | dataSize | exceptionType + false | defaultInputStream | defaultDataSize | StorageException + true | null | defaultDataSize | NullPointerException + true | defaultInputStream | defaultDataSize + 1 | UnexpectedLengthException + true | defaultInputStream | defaultDataSize - 1 | UnexpectedLengthException } def "Stage block empty body"() { when: - bu.stageBlock(getBlockID(), new ByteArrayInputStream(new byte[0]), 0) + bc.stageBlock(getBlockID(), new ByteArrayInputStream(new byte[0]), 0) then: thrown(StorageException) @@ -72,40 +97,40 @@ class BlockBlobAPITest extends APISpec { def "Stage block null body"() { when: - bu.stageBlock(getBlockID(), null, 0) + bc.stageBlock(getBlockID(), null, 0) then: - thrown(StorageException) + thrown(NullPointerException) } def "Stage block lease"() { setup: - String leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + String leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) expect: - bu.stageBlock(getBlockID(), defaultInputStream.get(), defaultDataSize, new LeaseAccessConditions().leaseId(leaseID), - null).statusCode() == 201 + bc.stageBlockWithResponse(getBlockID(), defaultInputStream.get(), defaultDataSize, new LeaseAccessConditions().setLeaseId(leaseID), + null, null).getStatusCode() == 201 } def "Stage block lease fail"() { setup: - setupBlobLeaseCondition(bu, receivedLeaseID) + setupBlobLeaseCondition(bc, receivedLeaseID) when: - bu.stageBlock(getBlockID(), defaultInputStream.get(), defaultDataSize, new LeaseAccessConditions() - .leaseId(garbageLeaseID), null) + bc.stageBlockWithResponse(getBlockID(), defaultInputStream.get(), defaultDataSize, new LeaseAccessConditions() + .setLeaseId(garbageLeaseID), null, null) then: def e = thrown(StorageException) - e.errorCode() == StorageErrorCode.LEASE_ID_MISMATCH_WITH_BLOB_OPERATION + e.getErrorCode() == StorageErrorCode.LEASE_ID_MISMATCH_WITH_BLOB_OPERATION } def "Stage block error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.stageBlock("id", defaultInputStream.get(), defaultDataSize) + bc.stageBlock("id", defaultInputStream.get(), defaultDataSize) then: thrown(StorageException) @@ -113,63 +138,65 @@ class BlockBlobAPITest extends APISpec { def "Stage block from url"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - def bu2 = cu.getBlockBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def bu2 = cc.getBlockBlobClient(generateBlobName()) def blockID = getBlockID() when: - HttpHeaders headers = bu2.stageBlockFromURL(blockID, bu.getBlobUrl(), null).headers() - Iterator listResponse = bu2.listBlocks(BlockListType.ALL).iterator() - BlockItem block = listResponse.next() - bu2.commitBlockList(Arrays.asList(blockID)) - ByteArrayOutputStream outputStream = new ByteArrayOutputStream() - bu2.download(outputStream) + def headers = bu2.stageBlockFromURLWithResponse(blockID, bc.getBlobUrl(), null, null, null, null, null, null).getHeaders() then: headers.value("x-ms-request-id") != null headers.value("x-ms-version") != null - headers.value("Content-MD5") != null + headers.value("x-ms-content-crc64") != null headers.value("x-ms-request-server-encrypted") != null + def response = bu2.listBlocks(BlockListType.ALL) + response.getUncommittedBlocks().size() == 1 + response.getCommittedBlocks().size() == 0 + response.getUncommittedBlocks().first().getName() == blockID - block.name() == blockID - !block.isCommitted() - !listResponse.hasNext() + when: + bu2.commitBlockList(Arrays.asList(blockID)) + def outputStream = new ByteArrayOutputStream() + bu2.download(outputStream) + then: ByteBuffer.wrap(outputStream.toByteArray()) == defaultData } def "Stage block from url min"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - def bu2 = cu.getBlockBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def bu2 = cc.getBlockBlobClient(generateBlobName()) def blockID = getBlockID() expect: - bu2.stageBlockFromURL(blockID, bu.getBlobUrl(), null).statusCode() == 201 + bu2.stageBlockFromURLWithResponse(blockID, bc.getBlobUrl(), null, null, null, null, null, null).getStatusCode() == 201 } @Unroll def "Stage block from URL IA"() { when: - bu.stageBlockFromURL(blockID, sourceURL, null) + String blockID = (getBlockId) ? getBlockID() : null + bc.stageBlockFromURL(blockID, sourceURL, null) then: thrown(StorageException) where: - blockID | sourceURL - null | new URL("http://www.example.com") - getBlockID() | null + getBlockId | sourceURL + false | new URL("http://www.example.com") + true | null } def "Stage block from URL range"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - def destURL = cu.getBlockBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def destURL = cc.getBlockBlobClient(generateBlobName()) when: - destURL.stageBlockFromURL(getBlockID(), bu.getBlobUrl(), new BlobRange(2, 3)) + destURL.stageBlockFromURL(getBlockID(), bc.getBlobUrl(), new BlobRange(2, 3)) Iterator uncommittedBlock = destURL.listBlocks(BlockListType.UNCOMMITTED).iterator() then: @@ -180,12 +207,12 @@ class BlockBlobAPITest extends APISpec { def "Stage block from URL MD5"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - def destURL = cu.getBlockBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def destURL = cc.getBlockBlobClient(generateBlobName()) when: - destURL.stageBlockFromURL(getBlockID(), bu.getBlobUrl(), null, - MessageDigest.getInstance("MD5").digest(defaultData.array()), null, null, null) + destURL.stageBlockFromURLWithResponse(getBlockID(), bc.getBlobUrl(), null, + MessageDigest.getInstance("MD5").digest(defaultData.array()), null, null, null, null) then: notThrown(StorageException) @@ -193,12 +220,12 @@ class BlockBlobAPITest extends APISpec { def "Stage block from URL MD5 fail"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - def destURL = cu.getBlockBlobClient(generateBlobName()) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def destURL = cc.getBlockBlobClient(generateBlobName()) when: - destURL.stageBlockFromURL(getBlockID(), bu.getBlobUrl(), null, "garbage".getBytes(), - null, null, null) + destURL.stageBlockFromURLWithResponse(getBlockID(), bc.getBlobUrl(), null, "garbage".getBytes(), + null, null, null, null) then: thrown(StorageException) @@ -206,11 +233,11 @@ class BlockBlobAPITest extends APISpec { def "Stage block from URL lease"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - def lease = new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, receivedLeaseID)) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def lease = new LeaseAccessConditions().setLeaseId(setupBlobLeaseCondition(bc, receivedLeaseID)) when: - bu.stageBlockFromURL(getBlockID(), bu.getBlobUrl(), null, null, lease, null, null) + bc.stageBlockFromURLWithResponse(getBlockID(), bc.getBlobUrl(), null, null, lease, null, null, null) then: notThrown(StorageException) @@ -218,11 +245,11 @@ class BlockBlobAPITest extends APISpec { def "Stage block from URL lease fail"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - def lease = new LeaseAccessConditions().leaseId("garbage") + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def lease = new LeaseAccessConditions().setLeaseId("garbage") when: - bu.stageBlockFromURL(getBlockID(), bu.getBlobUrl(), null, null, lease, null, null) + bc.stageBlockFromURLWithResponse(getBlockID(), bc.getBlobUrl(), null, null, lease, null, null, null) then: thrown(StorageException) @@ -230,11 +257,10 @@ class BlockBlobAPITest extends APISpec { def "Stage block from URL error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) - bu = cu.getBlockBlobClient(generateBlobName()) + bc = primaryBlobServiceClient.getContainerClient(generateContainerName()).getBlockBlobClient(generateBlobName()) when: - bu.stageBlockFromURL(getBlockID(), bu.getBlobUrl(), null) + bc.stageBlockFromURL(getBlockID(), bc.getBlobUrl(), null) then: thrown(StorageException) @@ -243,21 +269,21 @@ class BlockBlobAPITest extends APISpec { @Unroll def "Stage block from URL source AC"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) def blockID = getBlockID() - def sourceURL = cu.getBlockBlobClient(generateBlobName()) + def sourceURL = cc.getBlockBlobClient(generateBlobName()) sourceURL.upload(defaultInputStream.get(), defaultDataSize) sourceIfMatch = setupBlobMatchCondition(sourceURL, sourceIfMatch) def smac = new SourceModifiedAccessConditions() - .sourceIfModifiedSince(sourceIfModifiedSince) - .sourceIfUnmodifiedSince(sourceIfUnmodifiedSince) - .sourceIfMatch(sourceIfMatch) - .sourceIfNoneMatch(sourceIfNoneMatch) + .setSourceIfModifiedSince(sourceIfModifiedSince) + .setSourceIfUnmodifiedSince(sourceIfUnmodifiedSince) + .setSourceIfMatch(sourceIfMatch) + .setSourceIfNoneMatch(sourceIfNoneMatch) expect: - bu.stageBlockFromURL(blockID, sourceURL.getBlobUrl(), null, null, null, smac, null).statusCode() == 201 + bc.stageBlockFromURLWithResponse(blockID, sourceURL.getBlobUrl(), null, null, null, smac, null, null).getStatusCode() == 201 where: sourceIfModifiedSince | sourceIfUnmodifiedSince | sourceIfMatch | sourceIfNoneMatch @@ -271,20 +297,20 @@ class BlockBlobAPITest extends APISpec { @Unroll def "Stage block from URL source AC fail"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) def blockID = getBlockID() - def sourceURL = cu.getBlockBlobClient(generateBlobName()) + def sourceURL = cc.getBlockBlobClient(generateBlobName()) sourceURL.upload(defaultInputStream.get(), defaultDataSize) def smac = new SourceModifiedAccessConditions() - .sourceIfModifiedSince(sourceIfModifiedSince) - .sourceIfUnmodifiedSince(sourceIfUnmodifiedSince) - .sourceIfMatch(sourceIfMatch) - .sourceIfNoneMatch(setupBlobMatchCondition(sourceURL, sourceIfNoneMatch)) + .setSourceIfModifiedSince(sourceIfModifiedSince) + .setSourceIfUnmodifiedSince(sourceIfUnmodifiedSince) + .setSourceIfMatch(sourceIfMatch) + .setSourceIfNoneMatch(setupBlobMatchCondition(sourceURL, sourceIfNoneMatch)) when: - bu.stageBlockFromURL(blockID, sourceURL.getBlobUrl(), null, null, null, smac, null).statusCode() == 201 + bc.stageBlockFromURLWithResponse(blockID, sourceURL.getBlobUrl(), null, null, null, smac, null, null).getStatusCode() == 201 then: thrown(StorageException) @@ -300,54 +326,54 @@ class BlockBlobAPITest extends APISpec { def "Commit block list"() { setup: String blockID = getBlockID() - bu.stageBlock(blockID, defaultInputStream.get(), defaultDataSize) + bc.stageBlock(blockID, defaultInputStream.get(), defaultDataSize) ArrayList ids = new ArrayList<>() ids.add(blockID) when: - Response response = bu.commitBlockList(ids) - HttpHeaders headers = response.headers() + def response = bc.commitBlockListWithResponse(ids, null, null, null, null, null, null) + def headers = response.getHeaders() then: - response.statusCode() == 201 + response.getStatusCode() == 201 validateBasicHeaders(headers) - headers.value("Content-MD5") + headers.value("x-ms-content-crc64") Boolean.parseBoolean(headers.value("x-ms-request-server-encrypted")) } def "Commit block list min"() { setup: String blockID = getBlockID() - bu.stageBlock(blockID, defaultInputStream.get(), defaultDataSize) + bc.stageBlock(blockID, defaultInputStream.get(), defaultDataSize) ArrayList ids = new ArrayList<>() ids.add(blockID) expect: - bu.commitBlockList(ids).value() != null + bc.commitBlockList(ids) != null } def "Commit block list null"() { expect: - bu.commitBlockList(null).statusCode() == 201 + bc.commitBlockListWithResponse(null, null, null, null, null, null, null).getStatusCode() == 201 } @Unroll def "Commit block list headers"() { setup: String blockID = getBlockID() - bu.stageBlock(blockID, defaultInputStream.get(), defaultDataSize) + bc.stageBlock(blockID, defaultInputStream.get(), defaultDataSize) ArrayList ids = new ArrayList<>() ids.add(blockID) - BlobHTTPHeaders headers = new BlobHTTPHeaders().blobCacheControl(cacheControl) - .blobContentDisposition(contentDisposition) - .blobContentEncoding(contentEncoding) - .blobContentLanguage(contentLanguage) - .blobContentMD5(contentMD5) - .blobContentType(contentType) + BlobHTTPHeaders headers = new BlobHTTPHeaders().setBlobCacheControl(cacheControl) + .setBlobContentDisposition(contentDisposition) + .setBlobContentEncoding(contentEncoding) + .setBlobContentLanguage(contentLanguage) + .setBlobContentMD5(contentMD5) + .setBlobContentType(contentType) when: - bu.commitBlockList(ids, headers, null, null, null) - Response response = bu.getProperties() + bc.commitBlockListWithResponse(ids, headers, null, null, null, null, null) + def response = bc.getPropertiesWithResponse(null, null, null) // If the value isn't set the service will automatically set it contentType = (contentType == null) ? "application/octet-stream" : contentType @@ -373,12 +399,12 @@ class BlockBlobAPITest extends APISpec { } when: - bu.commitBlockList(null, null, metadata, null, null) - Response response = bu.getProperties() + bc.commitBlockListWithResponse(null, null, metadata, null, null, null, null) + def response = bc.getPropertiesWithResponse(null, null, null) then: - response.statusCode() == 200 - getMetadataFromHeaders(response.headers()) == metadata + response.getStatusCode() == 200 + response.getValue().getMetadata() == metadata where: key1 | value1 | key2 | value2 @@ -389,19 +415,19 @@ class BlockBlobAPITest extends APISpec { @Unroll def "Commit block list AC"() { setup: - match = setupBlobMatchCondition(bu, match) - leaseID = setupBlobLeaseCondition(bu, leaseID) + match = setupBlobMatchCondition(bc, match) + leaseID = setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) expect: - bu.commitBlockList(null, null, null, bac, null).statusCode() == 201 + bc.commitBlockListWithResponse(null, null, null, null, bac, null, null).getStatusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID @@ -416,23 +442,22 @@ class BlockBlobAPITest extends APISpec { @Unroll def "Commit block list AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) - setupBlobLeaseCondition(bu, leaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) when: - bu.commitBlockList(null, null, null, bac, null) - + bc.commitBlockListWithResponse(null, null, null, null, bac, null, null) then: def e = thrown(StorageException) - e.errorCode() == StorageErrorCode.CONDITION_NOT_MET || - e.errorCode() == StorageErrorCode.LEASE_ID_MISMATCH_WITH_BLOB_OPERATION + e.getErrorCode() == StorageErrorCode.CONDITION_NOT_MET || + e.getErrorCode() == StorageErrorCode.LEASE_ID_MISMATCH_WITH_BLOB_OPERATION where: modified | unmodified | match | noneMatch | leaseID @@ -445,11 +470,11 @@ class BlockBlobAPITest extends APISpec { def "Commit block list error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.commitBlockList(new ArrayList(), null, null, - new BlobAccessConditions().leaseAccessConditions(new LeaseAccessConditions().leaseId("garbage")), null) + bc.commitBlockListWithResponse(new ArrayList(), null, null, null, + new BlobAccessConditions().setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId("garbage")), null, null) then: thrown(StorageException) @@ -457,38 +482,30 @@ class BlockBlobAPITest extends APISpec { def "Get block list"() { setup: - List committedBlocks = Arrays.asList(getBlockID(), getBlockID()) - bu.stageBlock(committedBlocks.get(0), defaultInputStream.get(), defaultDataSize) - bu.stageBlock(committedBlocks.get(1), defaultInputStream.get(), defaultDataSize) - bu.commitBlockList(committedBlocks) - - List uncommittedBlocks = Arrays.asList(getBlockID(), getBlockID()) - bu.stageBlock(uncommittedBlocks.get(0), defaultInputStream.get(), defaultDataSize) - bu.stageBlock(uncommittedBlocks.get(1), defaultInputStream.get(), defaultDataSize) + def committedBlocks = [getBlockID(), getBlockID()] + bc.stageBlock(committedBlocks.get(0), defaultInputStream.get(), defaultDataSize) + bc.stageBlock(committedBlocks.get(1), defaultInputStream.get(), defaultDataSize) + bc.commitBlockList(committedBlocks) + + def uncommittedBlocks = [getBlockID(), getBlockID()] + bc.stageBlock(uncommittedBlocks.get(0), defaultInputStream.get(), defaultDataSize) + bc.stageBlock(uncommittedBlocks.get(1), defaultInputStream.get(), defaultDataSize) uncommittedBlocks.sort(true) when: - Iterable response = bu.listBlocks(BlockListType.ALL) + def blockList = bc.listBlocks(BlockListType.ALL) then: - for (BlockItem block : response) { - assert committedBlocks.contains(block.name()) || uncommittedBlocks.contains(block.name()) - assert block.size() == defaultDataSize - } -// for (int i = 0; i < committedBlocks.size(); i++) { -// assert response.body().committedBlocks().get(i).name() == committedBlocks.get(i) -// assert response.body().committedBlocks().get(i).size() == defaultDataSize -// assert response.body().uncommittedBlocks().get(i).name() == uncommittedBlocks.get(i) -// assert response.body().uncommittedBlocks().get(i).size() == defaultDataSize -// } -// validateBasicHeaders(response.headers()) -// response.headers().contentType() != null -// response.headers().blobContentLength() == defaultDataSize * 2L + blockList.getCommittedBlocks().collect { it.getName() } as Set == committedBlocks as Set + blockList.getUncommittedBlocks().collect { it.getName() } as Set == uncommittedBlocks as Set + + (blockList.getCommittedBlocks() + blockList.getUncommittedBlocks()) + .each { assert it.getSize() == defaultDataSize } } def "Get block list min"() { when: - bu.listBlocks(BlockListType.ALL) + bc.listBlocks(BlockListType.ALL) then: notThrown(StorageErrorException) @@ -497,29 +514,17 @@ class BlockBlobAPITest extends APISpec { @Unroll def "Get block list type"() { setup: - String blockID = getBlockID() - bu.stageBlock(blockID, defaultInputStream.get(), defaultDataSize) - ArrayList ids = new ArrayList<>() - ids.add(blockID) - bu.commitBlockList(ids) - blockID = new String(getBlockID()) - bu.stageBlock(blockID, defaultInputStream.get(), defaultDataSize) + def blockID = getBlockID() + bc.stageBlock(blockID, defaultInputStream.get(), defaultDataSize) + bc.commitBlockList([blockID]) + bc.stageBlock(getBlockID(), defaultInputStream.get(), defaultDataSize) when: - Iterable response = bu.listBlocks(type) + def response = bc.listBlocks(type) then: - int committed = 0 - int uncommitted = 0 - for (BlockItem item : response) { - if (item.isCommitted()) { - committed ++ - } else { - uncommitted ++ - } - } - committed == committedCount - uncommitted == uncommittedCount + response.getCommittedBlocks().size() == committedCount + response.getUncommittedBlocks().size() == uncommittedCount where: type | committedCount | uncommittedCount @@ -530,7 +535,7 @@ class BlockBlobAPITest extends APISpec { def "Get block list type null"() { when: - bu.listBlocks(null).iterator().hasNext() + bc.listBlocks(null).iterator().hasNext() then: notThrown(IllegalArgumentException) @@ -538,10 +543,10 @@ class BlockBlobAPITest extends APISpec { def "Get block list lease"() { setup: - String leaseID = setupBlobLeaseCondition(bu, receivedLeaseID) + String leaseID = setupBlobLeaseCondition(bc, receivedLeaseID) when: - bu.listBlocks(BlockListType.ALL, new LeaseAccessConditions().leaseId(leaseID), null).iterator().hasNext() + bc.listBlocksWithResponse(BlockListType.ALL, new LeaseAccessConditions().setLeaseId(leaseID), null, Context.NONE) then: notThrown(StorageException) @@ -549,22 +554,22 @@ class BlockBlobAPITest extends APISpec { def "Get block list lease fail"() { setup: - setupBlobLeaseCondition(bu, garbageLeaseID) + setupBlobLeaseCondition(bc, garbageLeaseID) when: - bu.listBlocks(BlockListType.ALL, new LeaseAccessConditions().leaseId(garbageLeaseID), null).iterator().hasNext() + bc.listBlocksWithResponse(BlockListType.ALL, new LeaseAccessConditions().setLeaseId(garbageLeaseID), null, Context.NONE) then: def e = thrown(StorageException) - e.errorCode() == StorageErrorCode.LEASE_ID_MISMATCH_WITH_BLOB_OPERATION + e.getErrorCode() == StorageErrorCode.LEASE_ID_MISMATCH_WITH_BLOB_OPERATION } def "Get block list error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.listBlocks(BlockListType.ALL).iterator().hasNext() + bc.listBlocks(BlockListType.ALL).iterator().hasNext() then: thrown(StorageException) @@ -572,64 +577,69 @@ class BlockBlobAPITest extends APISpec { def "Upload"() { when: - Response response = bu.upload(defaultInputStream.get(), defaultDataSize) - HttpHeaders headers = response.headers() + def response = bc.uploadWithResponse(defaultInputStream.get(), defaultDataSize, null, null, null, null, null, null) then: - response.statusCode() == 201 + response.getStatusCode() == 201 def outStream = new ByteArrayOutputStream() - bu.download(outStream) - outStream.toByteArray() == "default".getBytes(StandardCharsets.UTF_8) - validateBasicHeaders(headers) - headers.value("Content-MD5") != null - Boolean.parseBoolean(headers.value("x-ms-request-server-encrypted")) + bc.download(outStream) + outStream.toByteArray() == defaultText.getBytes(StandardCharsets.UTF_8) + validateBasicHeaders(response.getHeaders()) + response.getHeaders().value("Content-MD5") != null + Boolean.parseBoolean(response.getHeaders().value("x-ms-request-server-encrypted")) } def "Upload min"() { - expect: - bu.upload(defaultInputStream.get(), defaultDataSize).statusCode() == 201 + when: + bc.upload(defaultInputStream.get(), defaultDataSize) + + then: + def outStream = new ByteArrayOutputStream() + bc.download(outStream) + outStream.toByteArray() == defaultText.getBytes(StandardCharsets.UTF_8) } @Unroll def "Upload illegal argument"() { when: - bu.upload(data, dataSize) + bc.upload(data, dataSize) then: - def e = thrown(Exception) - exceptionType.isInstance(e) + thrown(exceptionType) where: - data | dataSize | exceptionType - null | defaultDataSize | NullPointerException - defaultInputStream.get() | defaultDataSize + 1 | IndexOutOfBoundsException - // This doesn't error as it isn't reading the entire stream which is valid in the new client - // defaultInputStream.get() | defaultDataSize - 1 | StorageErrorException + data | dataSize | exceptionType + null | defaultDataSize | NullPointerException + defaultInputStream.get() | defaultDataSize + 1 | UnexpectedLengthException + defaultInputStream.get() | defaultDataSize - 1 | UnexpectedLengthException } def "Upload empty body"() { expect: - bu.upload(new ByteArrayInputStream(new byte[0]), 0).statusCode() == 201 + bc.uploadWithResponse(new ByteArrayInputStream(new byte[0]), 0, null, null, null, null, null, null).getStatusCode() == 201 } def "Upload null body"() { - expect: - bu.upload(null, 0).statusCode() == 201 + when: + bc.uploadWithResponse(null, 0, null, null, null, null, null, null) + + then: + thrown(NullPointerException) } @Unroll def "Upload headers"() { setup: - BlobHTTPHeaders headers = new BlobHTTPHeaders().blobCacheControl(cacheControl) - .blobContentDisposition(contentDisposition) - .blobContentEncoding(contentEncoding) - .blobContentLanguage(contentLanguage) - .blobContentMD5(contentMD5) - .blobContentType(contentType) + BlobHTTPHeaders headers = new BlobHTTPHeaders().setBlobCacheControl(cacheControl) + .setBlobContentDisposition(contentDisposition) + .setBlobContentEncoding(contentEncoding) + .setBlobContentLanguage(contentLanguage) + .setBlobContentMD5(contentMD5) + .setBlobContentType(contentType) when: - bu.upload(defaultInputStream.get(), defaultDataSize, headers, null, null, null) - Response response = bu.getProperties() + bc.uploadWithResponse(defaultInputStream.get(), defaultDataSize, headers, null, null, null, null, null) + def response = bc.getPropertiesWithResponse(null, null, null) // If the value isn't set the service will automatically set it contentMD5 = (contentMD5 == null) ? MessageDigest.getInstance("MD5").digest(defaultData.array()) : contentMD5 @@ -639,9 +649,9 @@ class BlockBlobAPITest extends APISpec { validateBlobProperties(response, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentMD5, contentType) where: - cacheControl | contentDisposition | contentEncoding | contentLanguage | contentMD5 | contentType - null | null | null | null | null | null - "control" | "disposition" | "encoding" | "language" | MessageDigest.getInstance("MD5").digest(defaultData.array()) | "type" + cacheControl | contentDisposition | contentEncoding | contentLanguage | contentMD5 | contentType + null | null | null | null | null | null + "control" | "disposition" | "encoding" | "language" | MessageDigest.getInstance("MD5").digest(defaultData.array()) | "type" } @Unroll @@ -656,12 +666,12 @@ class BlockBlobAPITest extends APISpec { } when: - bu.upload(defaultInputStream.get(), defaultDataSize, null, metadata, null, null) - Response response = bu.getProperties() + bc.uploadWithResponse(defaultInputStream.get(), defaultDataSize, null, metadata, null, null, null, null) + def response = bc.getPropertiesWithResponse(null, null, null) then: - response.statusCode() == 200 - response.value().metadata() == metadata + response.getStatusCode() == 200 + response.getValue().getMetadata() == metadata where: key1 | value1 | key2 | value2 @@ -672,19 +682,19 @@ class BlockBlobAPITest extends APISpec { @Unroll def "Upload AC"() { setup: - match = setupBlobMatchCondition(bu, match) - leaseID = setupBlobLeaseCondition(bu, leaseID) + match = setupBlobMatchCondition(bc, match) + leaseID = setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) expect: - bu.upload(defaultInputStream.get(), defaultDataSize, null, null, bac, null).statusCode() == 201 + bc.uploadWithResponse(defaultInputStream.get(), defaultDataSize, null, null, null, bac, null, null).getStatusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID @@ -699,23 +709,23 @@ class BlockBlobAPITest extends APISpec { @Unroll def "Upload AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) - setupBlobLeaseCondition(bu, leaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) when: - bu.upload(defaultInputStream.get(), defaultDataSize, null, null, bac, null) + bc.uploadWithResponse(defaultInputStream.get(), defaultDataSize, null, null, null, bac, null, null) then: def e = thrown(StorageException) - e.errorCode() == StorageErrorCode.CONDITION_NOT_MET || - e.errorCode() == StorageErrorCode.LEASE_ID_MISMATCH_WITH_BLOB_OPERATION + e.getErrorCode() == StorageErrorCode.CONDITION_NOT_MET || + e.getErrorCode() == StorageErrorCode.LEASE_ID_MISMATCH_WITH_BLOB_OPERATION where: modified | unmodified | match | noneMatch | leaseID @@ -728,14 +738,307 @@ class BlockBlobAPITest extends APISpec { def "Upload error"() { setup: - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) when: - bu.upload(defaultInputStream.get(), defaultDataSize, null, null, - new BlobAccessConditions().leaseAccessConditions(new LeaseAccessConditions().leaseId("id")), - null) + bc.uploadWithResponse(defaultInputStream.get(), defaultDataSize, null, null, null, + new BlobAccessConditions().setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId("id")), + null, null) then: thrown(StorageException) } + + def "Upload with tier"() { + setup: + def bc = cc.getBlockBlobClient(generateBlobName()) + + when: + bc.uploadWithResponse(defaultInputStream.get(), defaultDataSize, null, null, AccessTier.COOL, null, null, null) + + then: + bc.getProperties().getAccessTier() == AccessTier.COOL + } + + // Only run these tests in live mode as they use variables that can't be captured. + @Unroll + @Requires({ APISpec.liveMode() }) + def "Async buffered upload"() { + when: + def data = getRandomData(dataSize) + bac.upload(Flux.just(data), bufferSize, numBuffs).block() + data.position(0) + + then: + // Due to memory issues, this check only runs on small to medium sized data sets. + if (dataSize < 100 * 1024 * 1024) { + assert collectBytesInBuffer(bac.download().block()).block() == data + } + bac.listBlocks(BlockListType.ALL).block().getCommittedBlocks().size() == blockCount + + where: + dataSize | bufferSize | numBuffs || blockCount + 350 | 50 | 2 || 7 // Requires cycling through the same buffers multiple times. + 350 | 50 | 5 || 7 // Most buffers may only be used once. + 10 * 1024 * 1024 | 1 * 1024 * 1024 | 2 || 10 // Larger data set. + 10 * 1024 * 1024 | 1 * 1024 * 1024 | 5 || 10 // Larger number of Buffs. + 10 * 1024 * 1024 | 1 * 1024 * 1024 | 10 || 10 // Exactly enough buffer space to hold all the data. + 500 * 1024 * 1024 | 100 * 1024 * 1024 | 2 || 5 // Larger data. + 100 * 1024 * 1024 | 20 * 1024 * 1024 | 4 || 5 + 10 * 1024 * 1024 | 3 * 512 * 1024 | 3 || 7 // Data does not squarely fit in buffers. + } + + def compareListToBuffer(List buffers, ByteBuffer result) { + result.position(0) + for (ByteBuffer buffer : buffers) { + buffer.position(0) + result.limit(result.position() + buffer.remaining()) + if (buffer != result) { + return false + } + result.position(result.position() + buffer.remaining()) + } + return result.remaining() == 0 + } + + // Only run these tests in live mode as they use variables that can't be captured. + @Unroll + @Requires({ APISpec.liveMode() }) + def "Buffered upload chunked source"() { + /* + This test should validate that the upload should work regardless of what format the passed data is in because + it will be chunked appropriately. + */ + setup: + List dataList = new ArrayList<>() + dataSizeList.each { size -> dataList.add(getRandomData(size)) } + bac.upload(Flux.fromIterable(dataList), bufferSize, numBuffers).block() + + expect: + compareListToBuffer(dataList, collectBytesInBuffer(bac.download().block()).block()) + bac.listBlocks(BlockListType.ALL).block().getCommittedBlocks().size() == blockCount + + where: + dataSizeList | bufferSize | numBuffers || blockCount + [7, 7] | 10 | 2 || 2 // First item fits entirely in the buffer, next item spans two buffers + [3, 3, 3, 3, 3, 3, 3] | 10 | 2 || 3 // Multiple items fit non-exactly in one buffer. + [10, 10] | 10 | 2 || 2 // Data fits exactly and does not need chunking. + [50, 51, 49] | 10 | 2 || 15 // Data needs chunking and does not fit neatly in buffers. Requires waiting for buffers to be released. + // The case of one large buffer needing to be broken up is tested in the previous test. + } + + def "Buffered upload illegal arguments null"() { + when: + bac.upload(null, 4, 4) + + then: + thrown(NullPointerException) + } + + @Unroll + def "Buffered upload illegal args out of bounds"() { + when: + bac.upload(Flux.just(defaultData), bufferSize, numBuffs) + + then: + thrown(IllegalArgumentException) + + where: + bufferSize | numBuffs + 0 | 5 + BlockBlobAsyncClient.MAX_STAGE_BLOCK_BYTES + 1 | 5 + 5 | 1 + } + + // Only run these tests in live mode as they use variables that can't be captured. + @Unroll + @Requires({ APISpec.liveMode() }) + def "Buffered upload headers"() { + when: + bac.uploadWithResponse(defaultFlux, 10, 2, new BlobHTTPHeaders().setBlobCacheControl(cacheControl) + .setBlobContentDisposition(contentDisposition) + .setBlobContentEncoding(contentEncoding) + .setBlobContentLanguage(contentLanguage) + .setBlobContentMD5(contentMD5) + .setBlobContentType(contentType), + null, null, null).block() + + then: + validateBlobProperties(bac.getPropertiesWithResponse(null).block(), cacheControl, contentDisposition, contentEncoding, + contentLanguage, contentMD5, contentType == null ? "application/octet-stream" : contentType) + // HTTP default content type is application/octet-stream. + + where: + // The MD5 is simply set on the blob for commitBlockList, not validated. + cacheControl | contentDisposition | contentEncoding | contentLanguage | contentMD5 | contentType + null | null | null | null | null | null + "control" | "disposition" | "encoding" | "language" | MessageDigest.getInstance("MD5").digest(defaultData.array()) | "type" + } + + // Only run these tests in live mode as they use variables that can't be captured. + @Unroll + @Requires({ APISpec.liveMode() }) + def "Buffered upload metadata"() { + setup: + Metadata metadata = new Metadata() + if (key1 != null) { + metadata.put(key1, value1) + } + if (key2 != null) { + metadata.put(key2, value2) + } + + when: + bac.uploadWithResponse(Flux.just(getRandomData(10)), 10, 10, null, metadata, null, null).block() + Response response = bac.getPropertiesWithResponse(null).block() + + then: + response.getStatusCode() == 200 + response.getValue().getMetadata() == metadata + + where: + key1 | value1 | key2 | value2 + null | null | null | null + "foo" | "bar" | "fizz" | "buzz" + } + + // Only run these tests in live mode as they use variables that can't be captured. + @Unroll + @Requires({ APISpec.liveMode() }) + def "Buffered upload AC"() { + setup: + bac.upload(defaultFlux, defaultDataSize).block() + match = setupBlobMatchCondition(bac, match) + leaseID = setupBlobLeaseCondition(bac, leaseID) + def accessConditions = new BlobAccessConditions().setModifiedAccessConditions( + new ModifiedAccessConditions().setIfModifiedSince(modified).setIfUnmodifiedSince(unmodified) + .setIfMatch(match).setIfNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + + expect: + bac.uploadWithResponse(Flux.just(getRandomData(10)), 10, 2, null, null, null, accessConditions).block().getStatusCode() == 201 + + where: + modified | unmodified | match | noneMatch | leaseID + null | null | null | null | null + oldDate | null | null | null | null + null | newDate | null | null | null + null | null | receivedEtag | null | null + null | null | null | garbageEtag | null + null | null | null | null | receivedLeaseID + } + + // Only run these tests in live mode as they use variables that can't be captured. + @Unroll + @Requires({ APISpec.liveMode() }) + def "Buffered upload AC fail"() { + setup: + bac.upload(defaultFlux, defaultDataSize).block() + noneMatch = setupBlobMatchCondition(bac, noneMatch) + leaseID = setupBlobLeaseCondition(bac, leaseID) + BlobAccessConditions accessConditions = new BlobAccessConditions().setModifiedAccessConditions( + new ModifiedAccessConditions().setIfModifiedSince(modified).setIfUnmodifiedSince(unmodified) + .setIfMatch(match).setIfNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + + when: + bac.uploadWithResponse(Flux.just(getRandomData(10)), 10, 2, null, null, null, accessConditions).block() + + then: + def e = thrown(StorageException) + e.getErrorCode() == StorageErrorCode.CONDITION_NOT_MET || + e.getErrorCode() == StorageErrorCode.LEASE_ID_MISMATCH_WITH_BLOB_OPERATION + + where: + modified | unmodified | match | noneMatch | leaseID + newDate | null | null | null | null + null | oldDate | null | null | null + null | null | garbageEtag | null | null + null | null | null | receivedEtag | null + null | null | null | null | garbageLeaseID + } + + /*def "Upload NRF progress"() { + setup: + def data = getRandomData(BlockBlobURL.MAX_UPLOAD_BLOB_BYTES + 1) + def numBlocks = data.remaining() / BlockBlobURL.MAX_STAGE_BLOCK_BYTES + long prevCount = 0 + def mockReceiver = Mock(IProgressReceiver) + + + when: + TransferManager.uploadFromNonReplayableFlowable(Flowable.just(data), bu, BlockBlobURL.MAX_STAGE_BLOCK_BYTES, 10, + new TransferManagerUploadToBlockBlobOptions(mockReceiver, null, null, null, 20)).blockingGet() + data.position(0) + + then: + // We should receive exactly one notification of the completed progress. + 1 * mockReceiver.reportProgress(data.remaining()) */ + + /* + We should receive at least one notification reporting an intermediary value per block, but possibly more + notifications will be received depending on the implementation. We specify numBlocks - 1 because the last block + will be the total size as above. Finally, we assert that the number reported monotonically increases. + */ + /*(numBlocks - 1.._) * mockReceiver.reportProgress(!data.remaining()) >> { long bytesTransferred -> + if (!(bytesTransferred > prevCount)) { + throw new IllegalArgumentException("Reported progress should monotonically increase") + } else { + prevCount = bytesTransferred + } + } + + // We should receive no notifications that report more progress than the size of the file. + 0 * mockReceiver.reportProgress({ it > data.remaining() }) + notThrown(IllegalArgumentException) +}*/ + + def "Buffered upload network error"() { + setup: + /* + This test uses a Flowable that does not allow multiple subscriptions and therefore ensures that we are + buffering properly to allow for retries even given this source behavior. + */ + bac.upload(Flux.just(defaultData), defaultDataSize).block() + def nonReplayableFlux = bac.download().block() + + // Mock a response that will always be retried. + def mockHttpResponse = getStubResponse(500, new HttpRequest(HttpMethod.PUT, new URL("https://www.fake.com"))) + + // Mock a policy that will always then check that the data is still the same and return a retryable error. + def mockPolicy = Mock(HttpPipelinePolicy) { + process(*_) >> { HttpPipelineCallContext context, HttpPipelineNextPolicy next -> + return collectBytesInBuffer(context.getHttpRequest().getBody()) + .map { b -> + return b == defaultData + } + .flatMap { b -> + if (b) { + return Mono.just(mockHttpResponse) + } + return Mono.error(new IllegalArgumentException()) + } + } + } + + // Build the pipeline + bac = new BlobServiceClientBuilder() + .credential(primaryCredential) + .endpoint(String.format(defaultEndpointTemplate, primaryCredential.getAccountName())) + .httpClient(getHttpClient()) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .retryOptions(new RequestRetryOptions(null, 3, null, 500, 1500, null)) + .addPolicy(mockPolicy).buildAsyncClient() + .getContainerAsyncClient(generateContainerName()).getBlockBlobAsyncClient(generateBlobName()) + + when: + // Try to upload the flowable, which will hit a retry. A normal upload would throw, but buffering prevents that. + bac.upload(nonReplayableFlux, 1024, 4).block() + // TODO: It could be that duplicates aren't getting made in the retry policy? Or before the retry policy? + + then: + // A second subscription to a download stream will + def e = thrown(StorageException) + e.getStatusCode() == 500 + } } 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 71396829fb10..a11adbd4d104 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,26 +1,28 @@ package com.azure.storage.blob import com.azure.storage.common.Constants +import spock.lang.Requires class BlockBlobInputOutputStreamTest extends APISpec { - BlockBlobClient bu + BlockBlobClient bc def setup() { - bu = cu.getBlockBlobClient(generateBlobName()) + bc = cc.getBlockBlobClient(generateBlobName()) } + // Only run this test in live mode as BlobOutputStream dynamically assigns blocks + @Requires({ APISpec.liveMode() }) def "Upload download"() { when: int length = 30 * Constants.MB - byte[] randomBytes = new byte[length] - (new Random()).nextBytes(randomBytes) + byte[] randomBytes = getRandomByteArray(length) - BlobOutputStream outStream = bu.getBlobOutputStream() + BlobOutputStream outStream = bc.getBlobOutputStream() outStream.write(randomBytes) outStream.close() then: - BlobInputStream inputStream = bu.openInputStream() + BlobInputStream inputStream = bc.openInputStream() int b ByteArrayOutputStream outputStream = new ByteArrayOutputStream() try { 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 new file mode 100644 index 000000000000..3a6fabddae8e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/CPKTest.groovy @@ -0,0 +1,244 @@ +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.Metadata +import com.azure.storage.blob.models.PageRange +import com.azure.storage.common.Constants + +import java.time.OffsetDateTime + +class CPKTest extends APISpec { + + CustomerProvidedKey key + ContainerClient cpkContainer + BlockBlobClient cpkBlockBlob + PageBlobClient cpkPageBlob + AppendBlobClient cpkAppendBlob + BlobClient cpkExistingBlob + + def setup() { + key = new CustomerProvidedKey(getRandomKey()) + def builder = new ContainerClientBuilder() + .endpoint(cc.getContainerUrl().toString()) + .customerProvidedKey(key) + .httpClient(getHttpClient()) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .credential(primaryCredential) + + addOptionalRecording(builder) + + cpkContainer = builder.buildClient() + cpkBlockBlob = cpkContainer.getBlockBlobClient(generateBlobName()) + cpkPageBlob = cpkContainer.getPageBlobClient(generateBlobName()) + cpkAppendBlob = cpkContainer.getAppendBlobClient(generateBlobName()) + + def existingBlobSetup = cpkContainer.getBlockBlobClient(generateBlobName()) + existingBlobSetup.upload(defaultInputStream.get(), defaultDataSize) + cpkExistingBlob = existingBlobSetup + } + + /** + * Insecurely and quickly generates a random AES256 key for the purpose of unit tests. No one should ever make a + * real key this way. + */ + def getRandomKey(long seed = new Random().nextLong()) { + def key = new byte[32] // 256 bit key + new Random(seed).nextBytes(key) + return key + } + + def "Put blob with CPK"() { + when: + def response = cpkBlockBlob.uploadWithResponse(defaultInputStream.get(), defaultDataSize, + null, null, null, null, null, null) + + then: + response.getStatusCode() == 201 + response.getValue().isServerEncrypted() + response.getValue().getEncryptionKeySha256() == key.getKeySHA256() + } + + def "Get blob with CPK"() { + setup: + cpkBlockBlob.upload(defaultInputStream.get(), defaultDataSize) + def datastream = new ByteArrayOutputStream() + + when: + def response = cpkBlockBlob.downloadWithResponse(datastream, null, null, null, false, null, null) + + then: + response.getStatusCode() == 200 + datastream.toByteArray() == defaultData.array() + } + + def "Put block with CPK"() { + when: + def response = cpkBlockBlob.stageBlockWithResponse(getBlockID(), defaultInputStream.get(), defaultDataSize, + null, null, null) + + then: + response.getStatusCode() == 201 + Boolean.parseBoolean(response.getHeaders().value(Constants.HeaderConstants.REQUEST_SERVER_ENCRYPTED)) + } + + def "Put block from URL with CPK"() { + setup: + def sourceBlob = cc.getBlockBlobClient(generateBlobName()) + sourceBlob.upload(defaultInputStream.get(), defaultDataSize) + + when: + def response = cpkBlockBlob.stageBlockFromURLWithResponse(getBlockID(), + new URL(sourceBlob.getBlobUrl().toString() + "?" + sourceBlob.generateSAS(OffsetDateTime.now().plusHours(1), new BlobSASPermission().setRead(true))), + null, null, null, null, null, null) + + then: + response.getStatusCode() == 201 + Boolean.parseBoolean(response.getHeaders().value(Constants.HeaderConstants.REQUEST_SERVER_ENCRYPTED)) + } + + def "Put block list with CPK"() { + setup: + def blockIDList = [getBlockID(), getBlockID()] + for (def blockId in blockIDList) { + cpkBlockBlob.stageBlock(blockId, defaultInputStream.get(), defaultDataSize) + } + + when: + def response = cpkBlockBlob.commitBlockListWithResponse(blockIDList, null, null, null, null, null, null) + + then: + response.getStatusCode() == 201 + response.getValue().isServerEncrypted() + response.getValue().getEncryptionKeySha256() == key.getKeySHA256() + } + + def "Put page with CPK"() { + setup: + cpkPageBlob.setCreate(PageBlobClient.PAGE_BYTES) + + when: + def response = cpkPageBlob.uploadPagesWithResponse(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1), + new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)), null, null, null) + + then: + response.getStatusCode() == 201 + response.getValue().isServerEncrypted() + response.getValue().getEncryptionKeySha256() == key.getKeySHA256() + } + + def "Put page from URL wih CPK"() { + setup: + def sourceBlob = cc.getPageBlobClient(generateBlobName()) + sourceBlob.setCreate(PageBlobClient.PAGE_BYTES) + sourceBlob.uploadPagesWithResponse(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1), + new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)), null, null, null) + + cpkPageBlob.setCreate(PageBlobClient.PAGE_BYTES) + + when: + def response = cpkPageBlob.uploadPagesFromURLWithResponse(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1), + new URL(sourceBlob.getBlobUrl().toString() + "?" + sourceBlob.generateSAS(OffsetDateTime.now().plusHours(1), new BlobSASPermission().setRead(true))), + null, null, null, null, null, null) + + then: + response.getStatusCode() == 201 + response.getValue().isServerEncrypted() + //TODO uncomment when swagger is fixed so PageBlobUploadPagesFromURLHeaders contains the encryption SHA + //response.value().setEncryptionKeySha256() == key.getKeySHA256() + } + + def "Put multiple pages with CPK"() { + setup: + cpkPageBlob.setCreate(PageBlobClient.PAGE_BYTES * 2) + + when: + def response = cpkPageBlob.uploadPagesWithResponse(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES * 2 - 1), + new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES * 2)), null, null, null) + + then: + response.getStatusCode() == 201 + response.getValue().isServerEncrypted() + response.getValue().getEncryptionKeySha256() == key.getKeySHA256() + } + + def "Append block with CPK"() { + setup: + cpkAppendBlob.create() + + when: + def response = cpkAppendBlob.appendBlockWithResponse(defaultInputStream.get(), defaultDataSize, null, null, null) + + then: + response.getStatusCode() == 201 + response.getValue().isServerEncrypted() + response.getValue().getEncryptionKeySha256() == key.getKeySHA256() + } + + def "Append block from URL with CPK"() { + setup: + cpkAppendBlob.create() + def sourceBlob = cc.getBlockBlobClient(generateBlobName()) + sourceBlob.upload(defaultInputStream.get(), defaultDataSize) + + when: + def response = cpkAppendBlob.appendBlockFromUrlWithResponse( + new URL(sourceBlob.getBlobUrl().toString() + "?" + sourceBlob.generateSAS(OffsetDateTime.now().plusHours(1), new BlobSASPermission().setRead(true))), + null, null, null, null, null, null) + + then: + response.getStatusCode() == 201 + //TODO uncomment when swagger is fixed so AppendBlobAppendBLockFromURLHeaders contains isrequestserverencrypted + //response.value().isServerEncrypted() + response.getValue().getEncryptionKeySha256() == key.getKeySHA256() + } + + def "Set blob metadata with CPK"() { + setup: + def metadata = new Metadata() + metadata.put("foo", "bar") + + when: + def response = cpkExistingBlob.setMetadataWithResponse(metadata, null, null, null) + + then: + response.getStatusCode() == 200 + Boolean.parseBoolean(response.getHeaders().value(Constants.HeaderConstants.REQUEST_SERVER_ENCRYPTED)) + response.getHeaders().value(Constants.HeaderConstants.ENCRYPTION_KEY_SHA256) == key.getKeySHA256() + } + + def "Get blob properties and metadata with CPK"() { + when: + def response = cpkExistingBlob.getPropertiesWithResponse(null, null, null) + + then: + response.getStatusCode() == 200 + Boolean.parseBoolean(response.getHeaders().value(Constants.HeaderConstants.SERVER_ENCRYPTED)) + response.getHeaders().value(Constants.HeaderConstants.ENCRYPTION_KEY_SHA256) == key.getKeySHA256() + } + +// TODO unignore when swagger is resolved with service team +// def "Set blob tier with CPK"() { +// when: +// def response = cpkExistingBlob.setTierWithResponse(AccessTier.COOL, null, null, null) +// +// then: +// response.getStatusCode() == 200 +// Boolean.parseBoolean(response.headers().value(Constants.HeaderConstants.SERVER_ENCRYPTED)) +// response.headers().value(Constants.HeaderConstants.ENCRYPTION_KEY_SHA256) == key.getKeySHA256() +// } + + def "Snapshot blob with CPK"() { + setup: + def metadata = new Metadata() + metadata.put("foo", "bar") + + when: + def response = cpkExistingBlob.createSnapshotWithResponse(null, null, null, null) + + then: + response.getStatusCode() == 201 + } + + //TODO add tests for copy blob CPK tests once generated code supports it +} 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 d0027bffbb83..eff02a8626e2 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 @@ -3,41 +3,63 @@ package com.azure.storage.blob - import com.azure.core.http.rest.Response import com.azure.core.http.rest.VoidResponse -import com.azure.storage.blob.models.* +import com.azure.storage.blob.models.AccessPolicy +import com.azure.storage.blob.models.AccessTier +import com.azure.storage.blob.models.AppendBlobItem +import com.azure.storage.blob.models.BlobItem +import com.azure.storage.blob.models.BlobListDetails +import com.azure.storage.blob.models.BlobType +import com.azure.storage.blob.models.ContainerAccessConditions +import com.azure.storage.blob.models.ContainerAccessPolicies +import com.azure.storage.blob.models.CopyStatusType +import com.azure.storage.blob.models.LeaseAccessConditions +import com.azure.storage.blob.models.LeaseDurationType +import com.azure.storage.blob.models.LeaseStateType +import com.azure.storage.blob.models.LeaseStatusType +import com.azure.storage.blob.models.ListBlobsOptions +import com.azure.storage.blob.models.Metadata +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.StorageErrorCode +import com.azure.storage.blob.models.StorageException import spock.lang.Unroll import java.time.Duration import java.time.OffsetDateTime import java.time.ZoneId +import java.util.stream.Collectors class ContainerAPITest extends APISpec { def "Create all null"() { setup: - // Overwrite the existing cu, which has already been created - cu = primaryServiceURL.getContainerClient(generateContainerName()) + // Overwrite the existing cc, which has already been created + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - VoidResponse response = cu.create() + def response = cc.createWithResponse(null, null, null, null) then: - response.statusCode() == 201 - validateBasicHeaders(response.headers()) + response.getStatusCode() == 201 + validateBasicHeaders(response.getHeaders()) } def "Create min"() { - expect: - primaryServiceURL.createContainer(generateContainerName()).statusCode() == 201 + when: + def cc = primaryBlobServiceClient.createContainer(generateContainerName()) + + then: + cc.exists() } @Unroll def "Create metadata"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) - Metadata metadata = new Metadata() + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) + def metadata = new Metadata() if (key1 != null) { metadata.put(key1, value1) } @@ -46,11 +68,11 @@ class ContainerAPITest extends APISpec { } when: - cu.create(metadata, null, null) - Response response = cu.getProperties() + cc.createWithResponse(metadata, null, null, null) + def response = cc.getPropertiesWithResponse(null, null, null) then: - getMetadataFromHeaders(response.headers()) == metadata + response.getValue().getMetadata() == metadata where: key1 | value1 | key2 | value2 @@ -61,14 +83,14 @@ class ContainerAPITest extends APISpec { @Unroll def "Create publicAccess"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.create(null, publicAccess, null) - PublicAccessType access = cu.getProperties().value().blobPublicAccess() + cc.createWithResponse(null, publicAccess, null, null) + def access = cc.getProperties().getBlobPublicAccess() then: - access.toString() == publicAccess.toString() + access == publicAccess where: publicAccess | _ @@ -79,46 +101,46 @@ class ContainerAPITest extends APISpec { def "Create error"() { when: - cu.create() + cc.create() then: def e = thrown(StorageException) - e.response().statusCode() == 409 - e.errorCode() == StorageErrorCode.CONTAINER_ALREADY_EXISTS - e.message().contains("The specified container already exists.") + e.getResponse().getStatusCode() == 409 + e.getErrorCode() == StorageErrorCode.CONTAINER_ALREADY_EXISTS + e.getServiceMessage().contains("The specified container already exists.") } def "Get properties null"() { when: - Response response = cu.getProperties() + def response = cc.getPropertiesWithResponse(null, null, null) then: - validateBasicHeaders(response.headers()) - response.value().blobPublicAccess() == null - !response.value().hasImmutabilityPolicy() - !response.value().hasLegalHold() - response.headers().value("x-ms-lease-duration") == null - response.headers().value("x-ms-lease-state") == LeaseStateType.AVAILABLE.toString() - response.headers().value("x-ms-lease-status") == LeaseStatusType.UNLOCKED.toString() - getMetadataFromHeaders(response.headers()).size() == 0 + validateBasicHeaders(response.getHeaders()) + response.getValue().getBlobPublicAccess() == null + !response.getValue().hasImmutabilityPolicy() + !response.getValue().hasLegalHold() + response.getValue().getLeaseDuration() == null + response.getValue().getLeaseState() == LeaseStateType.AVAILABLE + response.getValue().getLeaseStatus() == LeaseStatusType.UNLOCKED + response.getValue().getMetadata().size() == 0 } def "Get properties min"() { expect: - cu.getProperties().statusCode() == 200 + cc.getProperties() != null } def "Get properties lease"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) expect: - cu.getProperties(new LeaseAccessConditions().leaseId(leaseID), null).statusCode() == 200 + cc.getPropertiesWithResponse(new LeaseAccessConditions().setLeaseId(leaseID), null, null).getStatusCode() == 200 } def "Get properties lease fail"() { when: - cu.getProperties(new LeaseAccessConditions().leaseId("garbage"), null) + cc.getPropertiesWithResponse(new LeaseAccessConditions().setLeaseId("garbage"), null, null) then: thrown(StorageException) @@ -126,10 +148,10 @@ class ContainerAPITest extends APISpec { def "Get properties error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.getProperties(null, null) + cc.getProperties() then: thrown(StorageException) @@ -137,34 +159,36 @@ class ContainerAPITest extends APISpec { def "Set metadata"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) Metadata metadata = new Metadata() metadata.put("key", "value") - cu.create(metadata, null, null) - VoidResponse response = cu.setMetadata(null) + cc.createWithResponse(metadata, null, null, null) - expect: - response.statusCode() == 200 - validateBasicHeaders(response.headers()) - getMetadataFromHeaders(cu.getProperties().headers()).size() == 0 + when: + def response = cc.setMetadataWithResponse(null, null, null, null) + + then: + response.getStatusCode() == 200 + validateBasicHeaders(response.getHeaders()) + cc.getPropertiesWithResponse(null, null, null).getValue().getMetadata().size() == 0 } def "Set metadata min"() { setup: - Metadata metadata = new Metadata() + def metadata = new Metadata() metadata.put("foo", "bar") when: - cu.setMetadata(metadata) + cc.setMetadata(metadata) then: - getMetadataFromHeaders(cu.getProperties().headers()) == metadata + cc.getPropertiesWithResponse(null, null, null).getValue().getMetadata() == metadata } @Unroll def "Set metadata metadata"() { setup: - Metadata metadata = new Metadata() + def metadata = new Metadata() if (key1 != null) { metadata.put(key1, value1) } @@ -173,8 +197,8 @@ class ContainerAPITest extends APISpec { } expect: - cu.setMetadata(metadata).statusCode() == 200 - getMetadataFromHeaders(cu.getProperties().headers()) == metadata + cc.setMetadataWithResponse(metadata, null, null, null).getStatusCode() == 200 + cc.getPropertiesWithResponse(null, null, null).getValue().getMetadata() == metadata where: key1 | value1 | key2 | value2 @@ -185,14 +209,14 @@ class ContainerAPITest extends APISpec { @Unroll def "Set metadata AC"() { setup: - leaseID = setupContainerLeaseCondition(cu, leaseID) + leaseID = setupContainerLeaseCondition(cc, leaseID) ContainerAccessConditions cac = new ContainerAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified)) expect: - cu.setMetadata(null, cac, null).statusCode() == 200 + cc.setMetadataWithResponse(null, cac, null, null).getStatusCode() == 200 where: modified | leaseID @@ -205,12 +229,12 @@ class ContainerAPITest extends APISpec { def "Set metadata AC fail"() { setup: ContainerAccessConditions cac = new ContainerAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified)) when: - cu.setMetadata(null, cac, null) + cc.setMetadataWithResponse(null, cac, null, null) then: thrown(StorageException) @@ -225,12 +249,12 @@ class ContainerAPITest extends APISpec { def "Set metadata AC illegal"() { setup: ModifiedAccessConditions mac = new ModifiedAccessConditions() - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch) when: - cu.setMetadata(null, new ContainerAccessConditions().modifiedAccessConditions(mac), null) + cc.setMetadataWithResponse(null, new ContainerAccessConditions().setModifiedAccessConditions(mac), null, null) then: thrown(UnsupportedOperationException) @@ -244,10 +268,10 @@ class ContainerAPITest extends APISpec { def "Set metadata error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.setMetadata(null) + cc.setMetadata(null) then: thrown(StorageException) @@ -256,11 +280,11 @@ class ContainerAPITest extends APISpec { @Unroll def "Set access policy"() { setup: - def response = cu.setAccessPolicy(access, null, null, null) + def response = cc.setAccessPolicyWithResponse(access, null, null, null, null) expect: - validateBasicHeaders(response.headers()) - cu.getProperties().value().blobPublicAccess() == access + validateBasicHeaders(response.getHeaders()) + cc.getProperties().getBlobPublicAccess() == access where: access | _ @@ -271,79 +295,77 @@ class ContainerAPITest extends APISpec { def "Set access policy min access"() { when: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) then: - cu.getProperties().value().blobPublicAccess() == PublicAccessType.CONTAINER + cc.getProperties().getBlobPublicAccess() == PublicAccessType.CONTAINER } def "Set access policy min ids"() { setup: SignedIdentifier identifier = new SignedIdentifier() - .id("0000") - .accessPolicy(new AccessPolicy() - .start(OffsetDateTime.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime()) - .expiry(OffsetDateTime.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime() - .plusDays(1)) - .permission("r")) - - List ids = new ArrayList<>() + .setId("0000") + .setAccessPolicy(new AccessPolicy() + .setStart(OffsetDateTime.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime()) + .setExpiry(OffsetDateTime.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime() + .plusDays(1)) + .setPermission("r")) + + def ids = [] ids.push(identifier) when: - cu.setAccessPolicy(null, ids) + cc.setAccessPolicy(null, ids) then: - cu.getAccessPolicy().value().getIdentifiers().get(0).id() == "0000" + cc.getAccessPolicy().getIdentifiers().get(0).getId() == "0000" } def "Set access policy ids"() { setup: SignedIdentifier identifier = new SignedIdentifier() - .id("0000") - .accessPolicy(new AccessPolicy() - .start(OffsetDateTime.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime()) - .expiry(OffsetDateTime.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime() - .plusDays(1)) - .permission("r")) + .setId("0000") + .setAccessPolicy(new AccessPolicy() + .setStart(getUTCNow()) + .setExpiry(getUTCNow().plusDays(1)) + .setPermission("r")) SignedIdentifier identifier2 = new SignedIdentifier() - .id("0001") - .accessPolicy(new AccessPolicy() - .start(OffsetDateTime.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime()) - .expiry(OffsetDateTime.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime() - .plusDays(2)) - .permission("w")) + .setId("0001") + .setAccessPolicy(new AccessPolicy() + .setStart(getUTCNow()) + .setExpiry(getUTCNow().plusDays(2)) + .setPermission("w")) List ids = new ArrayList<>() - ids.push(identifier) - ids.push(identifier2) + ids.add(identifier) + ids.add(identifier2) when: - VoidResponse response = cu.setAccessPolicy(null, ids, null, null) - List receivedIdentifiers = cu.getAccessPolicy().value().getIdentifiers() + def response = cc.setAccessPolicyWithResponse(null, ids, null, null, null) + def receivedIdentifiers = cc.getAccessPolicyWithResponse(null, null, null).getValue().getIdentifiers() then: - response.statusCode() == 200 - validateBasicHeaders(response.headers()) - receivedIdentifiers.get(0).accessPolicy().expiry() == identifier.accessPolicy().expiry() - receivedIdentifiers.get(0).accessPolicy().start() == identifier.accessPolicy().start() - receivedIdentifiers.get(0).accessPolicy().permission() == identifier.accessPolicy().permission() - receivedIdentifiers.get(1).accessPolicy().expiry() == identifier2.accessPolicy().expiry() - receivedIdentifiers.get(1).accessPolicy().start() == identifier2.accessPolicy().start() - receivedIdentifiers.get(1).accessPolicy().permission() == identifier2.accessPolicy().permission() + response.getStatusCode() == 200 + validateBasicHeaders(response.getHeaders()) + receivedIdentifiers.get(0).getAccessPolicy().getExpiry() == identifier.getAccessPolicy().getExpiry() + receivedIdentifiers.get(0).getAccessPolicy().getStart() == identifier.getAccessPolicy().getStart() + receivedIdentifiers.get(0).getAccessPolicy().getPermission() == identifier.getAccessPolicy().getPermission() + receivedIdentifiers.get(1).getAccessPolicy().getExpiry() == identifier2.getAccessPolicy().getExpiry() + receivedIdentifiers.get(1).getAccessPolicy().getStart() == identifier2.getAccessPolicy().getStart() + receivedIdentifiers.get(1).getAccessPolicy().getPermission() == identifier2.getAccessPolicy().getPermission() } @Unroll def "Set access policy AC"() { setup: - leaseID = setupContainerLeaseCondition(cu, leaseID) + leaseID = setupContainerLeaseCondition(cc, leaseID) ContainerAccessConditions cac = new ContainerAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified)) expect: - cu.setAccessPolicy(null, null, cac, null).statusCode() == 200 + cc.setAccessPolicyWithResponse(null, null, cac, null, null).getStatusCode() == 200 where: modified | unmodified | leaseID @@ -357,13 +379,13 @@ class ContainerAPITest extends APISpec { def "Set access policy AC fail"() { setup: ContainerAccessConditions cac = new ContainerAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified)) when: - cu.setAccessPolicy(null, null, cac, null) + cc.setAccessPolicyWithResponse(null, null, cac, null, null) then: thrown(StorageException) @@ -378,10 +400,10 @@ class ContainerAPITest extends APISpec { @Unroll def "Set access policy AC illegal"() { setup: - ModifiedAccessConditions mac = new ModifiedAccessConditions().ifMatch(match).ifNoneMatch(noneMatch) + ModifiedAccessConditions mac = new ModifiedAccessConditions().setIfMatch(match).setIfNoneMatch(noneMatch) when: - cu.setAccessPolicy(null, null, new ContainerAccessConditions().modifiedAccessConditions(mac), null) + cc.setAccessPolicyWithResponse(null, null, new ContainerAccessConditions().setModifiedAccessConditions(mac), null, null) then: thrown(UnsupportedOperationException) @@ -394,10 +416,10 @@ class ContainerAPITest extends APISpec { def "Set access policy error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.setAccessPolicy(null, null, null, null) + cc.setAccessPolicy(null, null) then: thrown(StorageException) @@ -406,37 +428,36 @@ class ContainerAPITest extends APISpec { def "Get access policy"() { setup: SignedIdentifier identifier = new SignedIdentifier() - .id("0000") - .accessPolicy(new AccessPolicy() - .start(OffsetDateTime.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime()) - .expiry(OffsetDateTime.now().atZoneSameInstant(ZoneId.of("UTC")).toOffsetDateTime() - .plusDays(1)) - .permission("r")) + .setId("0000") + .setAccessPolicy(new AccessPolicy() + .setStart(getUTCNow()) + .setExpiry(getUTCNow().plusDays(1)) + .setPermission("r")) List ids = new ArrayList<>() ids.push(identifier) - cu.setAccessPolicy(PublicAccessType.BLOB, ids) - Response response = cu.getAccessPolicy() + cc.setAccessPolicy(PublicAccessType.BLOB, ids) + Response response = cc.getAccessPolicyWithResponse(null, null, null) expect: - response.statusCode() == 200 - response.value().getBlobAccessType() == PublicAccessType.BLOB - validateBasicHeaders(response.headers()) - response.value().getIdentifiers().get(0).accessPolicy().expiry() == identifier.accessPolicy().expiry() - response.value().getIdentifiers().get(0).accessPolicy().start() == identifier.accessPolicy().start() - response.value().getIdentifiers().get(0).accessPolicy().permission() == identifier.accessPolicy().permission() + response.getStatusCode() == 200 + response.getValue().getBlobAccessType() == PublicAccessType.BLOB + validateBasicHeaders(response.getHeaders()) + response.getValue().getIdentifiers().get(0).getAccessPolicy().getExpiry() == identifier.getAccessPolicy().getExpiry() + response.getValue().getIdentifiers().get(0).getAccessPolicy().getStart() == identifier.getAccessPolicy().getStart() + response.getValue().getIdentifiers().get(0).getAccessPolicy().getPermission() == identifier.getAccessPolicy().getPermission() } def "Get access policy lease"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) expect: - cu.getAccessPolicy(new LeaseAccessConditions().leaseId(leaseID), null).statusCode() == 200 + cc.getAccessPolicyWithResponse(new LeaseAccessConditions().setLeaseId(leaseID), null, null).getStatusCode() == 200 } def "Get access policy lease fail"() { when: - cu.getAccessPolicy(new LeaseAccessConditions().leaseId(garbageLeaseID), null) + cc.getAccessPolicyWithResponse(new LeaseAccessConditions().setLeaseId(garbageLeaseID), null, null) then: thrown(StorageException) @@ -444,10 +465,10 @@ class ContainerAPITest extends APISpec { def "Get access policy error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.getAccessPolicy() + cc.getAccessPolicy() then: thrown(StorageException) @@ -455,32 +476,35 @@ class ContainerAPITest extends APISpec { def "Delete"() { when: - VoidResponse response = cu.delete() + VoidResponse response = cc.deleteWithResponse(null, null, null) then: - response.statusCode() == 202 - response.headers().value("x-ms-request-id") != null - response.headers().value("x-ms-version") != null - response.headers().value("Date") != null + response.getStatusCode() == 202 + response.getHeaders().value("x-ms-request-id") != null + response.getHeaders().value("x-ms-version") != null + response.getHeaders().value("Date") != null } def "Delete min"() { - expect: - cu.delete().statusCode() == 202 + when: + cc.delete() + + then: + !cc.exists() } @Unroll def "Delete AC"() { setup: - leaseID = setupContainerLeaseCondition(cu, leaseID) + leaseID = setupContainerLeaseCondition(cc, leaseID) ContainerAccessConditions cac = new ContainerAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified)) expect: - cu.delete(cac, null).statusCode() == 202 + cc.deleteWithResponse(cac, null, null).getStatusCode() == 202 where: modified | unmodified | leaseID @@ -494,13 +518,13 @@ class ContainerAPITest extends APISpec { def "Delete AC fail"() { setup: ContainerAccessConditions cac = new ContainerAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified)) when: - cu.delete(cac, null) + cc.deleteWithResponse(cac, null, null) then: thrown(StorageException) @@ -515,10 +539,10 @@ class ContainerAPITest extends APISpec { @Unroll def "Delete AC illegal"() { setup: - ModifiedAccessConditions mac = new ModifiedAccessConditions().ifMatch(match).ifNoneMatch(noneMatch) + ModifiedAccessConditions mac = new ModifiedAccessConditions().setIfMatch(match).setIfNoneMatch(noneMatch) when: - cu.delete(new ContainerAccessConditions().modifiedAccessConditions(mac), null) + cc.deleteWithResponse(new ContainerAccessConditions().setModifiedAccessConditions(mac), null, null) then: thrown(UnsupportedOperationException) @@ -531,10 +555,10 @@ class ContainerAPITest extends APISpec { def "Delete error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.delete(null, null) + cc.delete() then: thrown(StorageException) @@ -543,84 +567,85 @@ class ContainerAPITest extends APISpec { def "List blobs flat"() { setup: String name = generateBlobName() - PageBlobClient bu = cu.getPageBlobClient(name) - bu.create(512) + PageBlobClient bu = cc.getPageBlobClient(name) + bu.setCreate(512) when: - Iterator blobs = cu.listBlobsFlat().iterator() + Iterator blobs = cc.listBlobsFlat().iterator() //ContainerListBlobFlatSegmentHeaders headers = response.headers() //List blobs = responseiterator()() then: -// response.statusCode() == 200 +// response.getStatusCode() == 200 // headers.contentType() != null // headers.requestId() != null -// headers.version() != null +// headers.getVersion() != null // headers.date() != null BlobItem blob = blobs.next() !blobs.hasNext() - blob.name() == name - blob.properties().blobType() == BlobType.PAGE_BLOB - blob.properties().copyCompletionTime() == null - blob.properties().copyStatusDescription() == null - blob.properties().copyId() == null - blob.properties().copyProgress() == null - blob.properties().copySource() == null - blob.properties().copyStatus() == null - blob.properties().incrementalCopy() == null - blob.properties().destinationSnapshot() == null - blob.properties().leaseDuration() == null - blob.properties().leaseState() == LeaseStateType.AVAILABLE - blob.properties().leaseStatus() == LeaseStatusType.UNLOCKED - blob.properties().contentLength() != null - blob.properties().contentType() != null - blob.properties().contentMD5() == null - blob.properties().contentEncoding() == null - blob.properties().contentDisposition() == null - blob.properties().contentLanguage() == null - blob.properties().cacheControl() == null - blob.properties().blobSequenceNumber() == 0 - blob.properties().serverEncrypted() - blob.properties().accessTierInferred() - blob.properties().accessTier() == AccessTier.HOT - blob.properties().archiveStatus() == null - blob.properties().creationTime() != null + blob.getName() == name + blob.getProperties().getBlobType() == BlobType.PAGE_BLOB + blob.getProperties().getCopyCompletionTime() == null + blob.getProperties().getCopyStatusDescription() == null + blob.getProperties().getCopyId() == null + blob.getProperties().getCopyProgress() == null + blob.getProperties().getCopySource() == null + blob.getProperties().getCopyStatus() == null + blob.getProperties().isIncrementalCopy() == null + blob.getProperties().getDestinationSnapshot() == null + blob.getProperties().getLeaseDuration() == null + blob.getProperties().getLeaseState() == LeaseStateType.AVAILABLE + blob.getProperties().getLeaseStatus() == LeaseStatusType.UNLOCKED + blob.getProperties().getContentLength() != null + blob.getProperties().getContentType() != null + blob.getProperties().getContentMD5() == null + blob.getProperties().getContentEncoding() == null + blob.getProperties().getContentDisposition() == null + blob.getProperties().getContentLanguage() == null + blob.getProperties().getCacheControl() == null + blob.getProperties().getBlobSequenceNumber() == 0 + blob.getProperties().isServerEncrypted() + blob.getProperties().isAccessTierInferred() + blob.getProperties().getAccessTier() == AccessTier.HOT + blob.getProperties().getArchiveStatus() == null + blob.getProperties().getCreationTime() != null } def "List blobs flat min"() { when: - cu.listBlobsFlat().iterator().hasNext() + cc.listBlobsFlat().iterator().hasNext() then: notThrown(StorageException) } def setupListBlobsTest(String normalName, String copyName, String metadataName, String uncommittedName) { - PageBlobClient normal = cu.getPageBlobClient(normalName) - normal.create(512) + def normal = cc.getPageBlobClient(normalName) + normal.setCreate(512) - PageBlobClient copyBlob = cu.getPageBlobClient(copyName) + def copyBlob = cc.getPageBlobClient(copyName) - String status = copyBlob.startCopyFromURL(normal.getBlobUrl()).value() - OffsetDateTime start = OffsetDateTime.now() - while (status != CopyStatusType.SUCCESS.toString()) { - status = copyBlob.getProperties().headers().value("x-ms-copy-status") + copyBlob.startCopyFromURL(normal.getBlobUrl()) + def start = OffsetDateTime.now() + def status = CopyStatusType.PENDING + while (status != CopyStatusType.SUCCESS) { + status = copyBlob.getProperties().getCopyStatus() OffsetDateTime currentTime = OffsetDateTime.now() - if (status == CopyStatusType.FAILED.toString() || currentTime.minusMinutes(1) == start) { + if (status == CopyStatusType.FAILED || currentTime.minusMinutes(1) == start) { throw new Exception("Copy failed or took too long") } - sleep(1000) + sleepIfRecord(1000) } - PageBlobClient metadataBlob = cu.getPageBlobClient(metadataName) - Metadata values = new Metadata() + def metadataBlob = cc.getPageBlobClient(metadataName) + def values = new Metadata() values.put("foo", "bar") - metadataBlob.create(512, null, null, values, null, null) + metadataBlob.createWithResponse(512, null, null, values, null, null, null) - String snapshotTime = normal.createSnapshot().value().getSnapshotId() + def snapshotTime = normal.createSnapshot().getSnapshotId() - BlockBlobClient uncommittedBlob = cu.getBlockBlobClient(uncommittedName) + def uncommittedBlob = cc.getBlockBlobClient(uncommittedName) uncommittedBlob.stageBlock("0000", defaultInputStream.get(), defaultData.remaining()) @@ -638,7 +663,7 @@ class ContainerAPITest extends APISpec { def "List blobs flat options copy"() { setup: - ListBlobsOptions options = new ListBlobsOptions().details(new BlobListDetails().copy(true)) + ListBlobsOptions options = new ListBlobsOptions().setDetails(new BlobListDetails().setCopy(true)) String normalName = "a" + generateBlobName() String copyName = "c" + generateBlobName() String metadataName = "m" + generateBlobName() @@ -646,23 +671,23 @@ class ContainerAPITest extends APISpec { setupListBlobsTest(normalName, copyName, metadataName, uncommittedName) when: - List blobs = blobListResponseToList(cu.listBlobsFlat(options, null).iterator()) + List blobs = blobListResponseToList(cc.listBlobsFlat(options, null).iterator()) then: - blobs.get(0).name() == normalName - blobs.get(1).name() == copyName - blobs.get(1).properties().copyId() != null + blobs.get(0).getName() == normalName + blobs.get(1).getName() == copyName + blobs.get(1).getProperties().getCopyId() != null // Comparing the urls isn't reliable because the service may use https. - blobs.get(1).properties().copySource().contains(normalName) - blobs.get(1).properties().copyStatus() == CopyStatusType.SUCCESS // We waited for the copy to complete. - blobs.get(1).properties().copyProgress() != null - blobs.get(1).properties().copyCompletionTime() != null + blobs.get(1).getProperties().getCopySource().contains(normalName) + blobs.get(1).getProperties().getCopyStatus() == CopyStatusType.SUCCESS // We waited for the copy to complete. + blobs.get(1).getProperties().getCopyProgress() != null + blobs.get(1).getProperties().getCopyCompletionTime() != null blobs.size() == 3 // Normal, copy, metadata } def "List blobs flat options metadata"() { setup: - ListBlobsOptions options = new ListBlobsOptions().details(new BlobListDetails().metadata(true)) + ListBlobsOptions options = new ListBlobsOptions().setDetails(new BlobListDetails().setMetadata(true)) String normalName = "a" + generateBlobName() String copyName = "c" + generateBlobName() String metadataName = "m" + generateBlobName() @@ -670,20 +695,20 @@ class ContainerAPITest extends APISpec { setupListBlobsTest(normalName, copyName, metadataName, uncommittedName) when: - List blobs = blobListResponseToList(cu.listBlobsFlat(options, null).iterator()) + List blobs = blobListResponseToList(cc.listBlobsFlat(options, null).iterator()) then: - blobs.get(0).name() == normalName - blobs.get(1).name() == copyName - blobs.get(1).properties().copyCompletionTime() == null - blobs.get(2).name() == metadataName - blobs.get(2).metadata().get("foo") == "bar" + blobs.get(0).getName() == normalName + blobs.get(1).getName() == copyName + blobs.get(1).getProperties().getCopyCompletionTime() == null + blobs.get(2).getName() == metadataName + blobs.get(2).getMetadata().get("foo") == "bar" blobs.size() == 3 // Normal, copy, metadata } def "List blobs flat options snapshots"() { setup: - ListBlobsOptions options = new ListBlobsOptions().details(new BlobListDetails().snapshots(true)) + ListBlobsOptions options = new ListBlobsOptions().setDetails(new BlobListDetails().setSnapshots(true)) String normalName = "a" + generateBlobName() String copyName = "c" + generateBlobName() String metadataName = "m" + generateBlobName() @@ -691,18 +716,18 @@ class ContainerAPITest extends APISpec { String snapshotTime = setupListBlobsTest(normalName, copyName, metadataName, uncommittedName) when: - List blobs = blobListResponseToList(cu.listBlobsFlat(options, null).iterator()) + List blobs = blobListResponseToList(cc.listBlobsFlat(options, null).iterator()) then: - blobs.get(0).name() == normalName - blobs.get(0).snapshot() == snapshotTime - blobs.get(1).name() == normalName + blobs.get(0).getName() == normalName + blobs.get(0).getSnapshot() == snapshotTime + blobs.get(1).getName() == normalName blobs.size() == 4 // Normal, snapshot, copy, metadata } def "List blobs flat options uncommitted"() { setup: - ListBlobsOptions options = new ListBlobsOptions().details(new BlobListDetails().uncommittedBlobs(true)) + ListBlobsOptions options = new ListBlobsOptions().setDetails(new BlobListDetails().setUncommittedBlobs(true)) String normalName = "a" + generateBlobName() String copyName = "c" + generateBlobName() String metadataName = "m" + generateBlobName() @@ -710,11 +735,11 @@ class ContainerAPITest extends APISpec { setupListBlobsTest(normalName, copyName, metadataName, uncommittedName) when: - List blobs = blobListResponseToList(cu.listBlobsFlat(options, null).iterator()) + List blobs = blobListResponseToList(cc.listBlobsFlat(options, null).iterator()) then: - blobs.get(0).name() == normalName - blobs.get(3).name() == uncommittedName + blobs.get(0).getName() == normalName + blobs.get(3).getName() == uncommittedName blobs.size() == 4 // Normal, copy, metadata, uncommitted } @@ -722,16 +747,16 @@ class ContainerAPITest extends APISpec { setup: enableSoftDelete() String name = generateBlobName() - AppendBlobClient bu = cu.getAppendBlobClient(name) + AppendBlobClient bu = cc.getAppendBlobClient(name) bu.create() bu.delete() when: - ListBlobsOptions options = new ListBlobsOptions().details(new BlobListDetails().deletedBlobs(true)) - Iterator blobs = cu.listBlobsFlat(options, null).iterator() + ListBlobsOptions options = new ListBlobsOptions().setDetails(new BlobListDetails().setDeletedBlobs(true)) + Iterator blobs = cc.listBlobsFlat(options, null).iterator() then: - blobs.next().name() == name + blobs.next().getName() == name !blobs.hasNext() disableSoftDelete() == null // Must produce a true value or test will fail. @@ -739,7 +764,7 @@ class ContainerAPITest extends APISpec { def "List blobs flat options prefix"() { setup: - ListBlobsOptions options = new ListBlobsOptions().prefix("a") + ListBlobsOptions options = new ListBlobsOptions().setPrefix("a") String normalName = "a" + generateBlobName() String copyName = "c" + generateBlobName() String metadataName = "m" + generateBlobName() @@ -747,92 +772,139 @@ class ContainerAPITest extends APISpec { setupListBlobsTest(normalName, copyName, metadataName, uncommittedName) when: - Iterator blobs = cu.listBlobsFlat(options, null).iterator() + Iterator blobs = cc.listBlobsFlat(options, null).iterator() then: - blobs.next().name() == normalName + blobs.next().getName() == normalName !blobs.hasNext() // Normal } - // TODO (alzimmer): Turn this on once paged responses are available - /*def "List blobs flat options maxResults"() { + def "List blobs flat options maxResults"() { setup: - ListBlobsOptions options = new ListBlobsOptions().details(new BlobListDetails().copy(true) - .snapshots(true).uncommittedBlobs(true)).maxResults(2) - String normalName = "a" + generateBlobName() - String copyName = "c" + generateBlobName() - String metadataName = "m" + generateBlobName() - String uncommittedName = "u" + generateBlobName() + def PAGE_SIZE = 2 + def options = new ListBlobsOptions().setDetails(new BlobListDetails().setCopy(true) + .setSnapshots(true).setUncommittedBlobs(true)).setMaxResults(PAGE_SIZE) + def normalName = "a" + generateBlobName() + def copyName = "c" + generateBlobName() + def metadataName = "m" + generateBlobName() + def uncommittedName = "u" + generateBlobName() setupListBlobsTest(normalName, copyName, metadataName, uncommittedName) - when: - Iterator blobs = cu.listBlobsFlat(options, null).iterator() - - then: - blobs.size() == 2 - }*/ + expect: "Get first page of blob listings (sync and async)" + cc.listBlobsFlat(options, null).iterableByPage().iterator().next().getValue().size() == PAGE_SIZE + ccAsync.listBlobsFlat(options).byPage().blockFirst().getValue().size() == PAGE_SIZE + } def "List blobs flat options fail"() { when: - new ListBlobsOptions().maxResults(0) + new ListBlobsOptions().setMaxResults(0) then: thrown(IllegalArgumentException) } - // TODO (alzimmer): Turn this on once paged responses are available - /*def "List blobs flat marker"() { + def "List blobs flat marker"() { setup: - for (int i = 0; i < 10; i++) { - PageBlobClient bu = cu.getPageBlobClient(generateBlobName()) - bu.create(512) + def NUM_BLOBS = 10 + def PAGE_SIZE = 6 + for (int i = 0; i < NUM_BLOBS ; i++) { + PageBlobClient bc = cc.getPageBlobClient(generateBlobName()) + bc.setCreate(512) } - Iterator response = cu.listBlobsFlat(new ListBlobsOptions().maxResults(6), null) + when: "list blobs with sync client" + def pagedIterable = cc.listBlobsFlat(new ListBlobsOptions().setMaxResults(PAGE_SIZE), null) + def pagedSyncResponse1 = pagedIterable.iterableByPage().iterator().next() + def pagedSyncResponse2 = pagedIterable.iterableByPage(pagedSyncResponse1.getNextLink()).iterator().next() - String marker = response.body().nextMarker() - int firstSegmentSize = response.iterator().size() - response = cu.listBlobsFlat(marker, null, null) + then: + pagedSyncResponse1.getValue().size() == PAGE_SIZE + pagedSyncResponse2.getValue().size() == NUM_BLOBS - PAGE_SIZE + pagedSyncResponse2.getNextLink() == null - expect: - firstSegmentSize == 6 - response.body().nextMarker() == null - responseiterator()().size() == 4 - }*/ + + when: "list blobs with async client" + def pagedFlux = ccAsync.listBlobsFlat(new ListBlobsOptions().setMaxResults(PAGE_SIZE)) + def pagedResponse1 = pagedFlux.byPage().blockFirst() + def pagedResponse2 = pagedFlux.byPage(pagedResponse1.getNextLink()).blockFirst() + + then: + pagedResponse1.getValue().size() == PAGE_SIZE + pagedResponse2.getValue().size() == NUM_BLOBS - PAGE_SIZE + pagedResponse2.getNextLink() == null + } def "List blobs flat error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.listBlobsFlat().iterator().hasNext() + cc.listBlobsFlat().iterator().hasNext() then: thrown(StorageException) } + def "List blobs flat with timeout still backed by PagedFlux"() { + setup: + def NUM_BLOBS = 5 + def PAGE_RESULTS = 3 + + def blobs = [] as Collection + for (i in (1..NUM_BLOBS)) { + def blob = cc.getBlockBlobClient(generateBlobName()) + blob.upload(defaultInputStream.get(), defaultDataSize) + blobs << blob + } + + when: "Consume results by page" + cc.listBlobsFlat(new ListBlobsOptions().setMaxResults(PAGE_RESULTS), Duration.ofSeconds(10)).streamByPage().count() + + then: "Still have paging functionality" + notThrown(Exception) + } + + def "List blobs hier with timeout still backed by PagedFlux"() { + setup: + def NUM_BLOBS = 5 + def PAGE_RESULTS = 3 + + def blobs = [] as Collection + for (i in (1..NUM_BLOBS)) { + def blob = cc.getBlockBlobClient(generateBlobName()) + blob.upload(defaultInputStream.get(), defaultDataSize) + blobs << blob + } + + when: "Consume results by page" + cc.listBlobsHierarchy("/", new ListBlobsOptions().setMaxResults(PAGE_RESULTS), Duration.ofSeconds(10)).streamByPage().count() + + then: "Still have paging functionality" + notThrown(Exception) + } + def "List blobs hierarchy"() { setup: String name = generateBlobName() - PageBlobClient bu = cu.getPageBlobClient(name) - bu.create(512) + PageBlobClient bu = cc.getPageBlobClient(name) + bu.setCreate(512) when: - Iterator blobs = cu.listBlobsHierarchy(null).iterator() + Iterator blobs = cc.listBlobsHierarchy(null).iterator() then: -// response.statusCode() == 200 +// response.getStatusCode() == 200 // headers.contentType() != null // headers.requestId() != null -// headers.version() != null +// headers.getVersion() != null // headers.date() != null - blobs.next().name() == name + blobs.next().getName() == name !blobs.hasNext() } def "List blobs hierarchy min"() { when: - cu.listBlobsHierarchy("/").iterator().hasNext() + cc.listBlobsHierarchy("/").iterator().hasNext() then: notThrown(StorageException) @@ -840,7 +912,7 @@ class ContainerAPITest extends APISpec { def "List blobs hier options copy"() { setup: - ListBlobsOptions options = new ListBlobsOptions().details(new BlobListDetails().copy(true)) + ListBlobsOptions options = new ListBlobsOptions().setDetails(new BlobListDetails().setCopy(true)) String normalName = "a" + generateBlobName() String copyName = "c" + generateBlobName() String metadataName = "m" + generateBlobName() @@ -848,23 +920,23 @@ class ContainerAPITest extends APISpec { setupListBlobsTest(normalName, copyName, metadataName, uncommittedName) when: - List blobs = blobListResponseToList(cu.listBlobsHierarchy("", options, null).iterator()) + List blobs = blobListResponseToList(cc.listBlobsHierarchy("", options, null).iterator()) then: - blobs.get(0).name() == normalName - blobs.get(1).name() == copyName - blobs.get(1).properties().copyId() != null + blobs.get(0).getName() == normalName + blobs.get(1).getName() == copyName + blobs.get(1).getProperties().getCopyId() != null // Comparing the urls isn't reliable because the service may use https. - blobs.get(1).properties().copySource().contains(normalName) - blobs.get(1).properties().copyStatus() == CopyStatusType.SUCCESS // We waited for the copy to complete. - blobs.get(1).properties().copyProgress() != null - blobs.get(1).properties().copyCompletionTime() != null + blobs.get(1).getProperties().getCopySource().contains(normalName) + blobs.get(1).getProperties().getCopyStatus() == CopyStatusType.SUCCESS // We waited for the copy to complete. + blobs.get(1).getProperties().getCopyProgress() != null + blobs.get(1).getProperties().getCopyCompletionTime() != null blobs.size() == 3 // Normal, copy, metadata } def "List blobs hier options metadata"() { setup: - ListBlobsOptions options = new ListBlobsOptions().details(new BlobListDetails().metadata(true)) + ListBlobsOptions options = new ListBlobsOptions().setDetails(new BlobListDetails().setMetadata(true)) String normalName = "a" + generateBlobName() String copyName = "c" + generateBlobName() String metadataName = "m" + generateBlobName() @@ -872,20 +944,20 @@ class ContainerAPITest extends APISpec { setupListBlobsTest(normalName, copyName, metadataName, uncommittedName) when: - List blobs = blobListResponseToList(cu.listBlobsHierarchy("", options, null).iterator()) + List blobs = blobListResponseToList(cc.listBlobsHierarchy("", options, null).iterator()) then: - blobs.get(0).name() == normalName - blobs.get(1).name() == copyName - blobs.get(1).properties().copyCompletionTime() == null - blobs.get(2).name() == metadataName - blobs.get(2).metadata().get("foo") == "bar" + blobs.get(0).getName() == normalName + blobs.get(1).getName() == copyName + blobs.get(1).getProperties().getCopyCompletionTime() == null + blobs.get(2).getName() == metadataName + blobs.get(2).getMetadata().get("foo") == "bar" blobs.size() == 3 // Normal, copy, metadata } def "List blobs hier options uncommitted"() { setup: - ListBlobsOptions options = new ListBlobsOptions().details(new BlobListDetails().uncommittedBlobs(true)) + ListBlobsOptions options = new ListBlobsOptions().setDetails(new BlobListDetails().setUncommittedBlobs(true)) String normalName = "a" + generateBlobName() String copyName = "c" + generateBlobName() String metadataName = "m" + generateBlobName() @@ -893,28 +965,28 @@ class ContainerAPITest extends APISpec { setupListBlobsTest(normalName, copyName, metadataName, uncommittedName) when: - List blobs = blobListResponseToList(cu.listBlobsHierarchy("", options, null).iterator()) + List blobs = blobListResponseToList(cc.listBlobsHierarchy("", options, null).iterator()) then: - blobs.get(0).name() == normalName - blobs.get(3).name() == uncommittedName + blobs.get(0).getName() == normalName + blobs.get(3).getName() == uncommittedName blobs.size() == 4 // Normal, copy, metadata, uncommitted } def "List blobs hier options deleted"() { setup: enableSoftDelete() - String name = generateBlobName() - AppendBlobClient bu = cu.getAppendBlobClient(name) - bu.create() - bu.delete() + def name = generateBlobName() + def bc = cc.getAppendBlobClient(name) + bc.create() + bc.delete() when: - ListBlobsOptions options = new ListBlobsOptions().details(new BlobListDetails().deletedBlobs(true)) - Iterator blobs = cu.listBlobsHierarchy("", options, null).iterator() + def options = new ListBlobsOptions().setDetails(new BlobListDetails().setDeletedBlobs(true)) + def blobs = cc.listBlobsHierarchy("", options, null).iterator() then: - blobs.next().name() == name + blobs.next().getName() == name !blobs.hasNext() disableSoftDelete() == null @@ -922,7 +994,7 @@ class ContainerAPITest extends APISpec { def "List blobs hier options prefix"() { setup: - ListBlobsOptions options = new ListBlobsOptions().prefix("a") + ListBlobsOptions options = new ListBlobsOptions().setPrefix("a") String normalName = "a" + generateBlobName() String copyName = "c" + generateBlobName() String metadataName = "m" + generateBlobName() @@ -930,41 +1002,41 @@ class ContainerAPITest extends APISpec { setupListBlobsTest(normalName, copyName, metadataName, uncommittedName) when: - Iterator blobs = cu.listBlobsHierarchy("", options, null).iterator() + Iterator blobs = cc.listBlobsHierarchy("", options, null).iterator() then: - blobs.next().name() == normalName + blobs.next().getName() == normalName !blobs.hasNext() // Normal } - // TODO (alzimmer): Turn this on when paged responses becomes available - /*def "List blobs hier options maxResults"() { + + def "List blobs hier options maxResults"() { setup: - ListBlobsOptions options = new ListBlobsOptions().details(new BlobListDetails().copy(true) - .uncommittedBlobs(true)).maxResults(1) - String normalName = "a" + generateBlobName() - String copyName = "c" + generateBlobName() - String metadataName = "m" + generateBlobName() - String uncommittedName = "u" + generateBlobName() + def options = new ListBlobsOptions().setDetails(new BlobListDetails().setCopy(true) + .setUncommittedBlobs(true)).setMaxResults(1) + def normalName = "a" + generateBlobName() + def copyName = "c" + generateBlobName() + def metadataName = "m" + generateBlobName() + def uncommittedName = "u" + generateBlobName() setupListBlobsTest(normalName, copyName, metadataName, uncommittedName) when: - Iterator blobs = cu.listBlobsHierarchy("", options, null).iterator() + // use async client, as there is no paging functionality for sync yet + def blobs = ccAsync.listBlobsHierarchy("", options).byPage().blockFirst() then: - blobs.size() == 1 - }*/ + blobs.getValue().size() == 1 + } @Unroll def "List blobs hier options fail"() { when: - def options = new ListBlobsOptions().details(new BlobListDetails().snapshots(snapshots)) - .maxResults(maxResults) - cu.listBlobsHierarchy(null, options, null).iterator().hasNext() + def options = new ListBlobsOptions().setDetails(new BlobListDetails().setSnapshots(snapshots)) + .setMaxResults(maxResults) + cc.listBlobsHierarchy(null, options, null).iterator().hasNext() then: - def e = thrown(Exception) - exceptionType.isInstance(e) + thrown(exceptionType) where: snapshots | maxResults | exceptionType @@ -974,86 +1046,79 @@ class ContainerAPITest extends APISpec { def "List blobs hier delim"() { setup: - def blobNames = Arrays.asList("a", "b/a", "c", "d/a", "e", "f", "g/a") - for (String blobName : blobNames) { - def bu = cu.getAppendBlobClient(blobName) + def blobNames = ["a", "b/a", "c", "d/a", "e", "f", "g/a"] + for (def blobName : blobNames) { + def bu = cc.getAppendBlobClient(blobName) bu.create() } when: - Iterator blobs = cu.listBlobsHierarchy(null).iterator() + def foundBlobs = [] as Set + def foundPrefixes = [] as Set + cc.listBlobsHierarchy(null).stream().collect(Collectors.toList()) + .forEach { blobItem -> + if (blobItem.isPrefix()) { + foundPrefixes << blobItem.getName() + } + else { + foundBlobs << blobItem.getName() + } + } and: - ArrayDeque expectedBlobs = new ArrayDeque<>() - expectedBlobs.add("a") - expectedBlobs.add("c") - expectedBlobs.add("e") - expectedBlobs.add("f") - - ArrayDeque expectedPrefixes = new ArrayDeque<>() - expectedPrefixes.add("b/") - expectedPrefixes.add("d/") - expectedPrefixes.add("g/") + def expectedBlobs = ["a", "c", "e", "f"] as Set + def expectedPrefixes = ["b/", "d/", "g/"] as Set then: - while (blobs.hasNext()) { - BlobItem blob = blobs.next() - - if (blob.isPrefix()) { - blob.name() == expectedPrefixes.pop() - } else { - blob.name() == expectedBlobs.pop() - } - } - - expectedPrefixes.isEmpty() - expectedBlobs.isEmpty() + expectedBlobs == foundBlobs + expectedPrefixes == foundPrefixes } - // TODO (alzimmer): Turn this on when paged response become available - /*def "List blobs hier marker"() { + def "List blobs hier marker"() { setup: - for (int i = 0; i < 10; i++) { - PageBlobClient bu = cu.getPageBlobClient(generateBlobName()) - bu.create(512) + def NUM_BLOBS = 10 + def PAGE_SIZE = 6 + for (int i = 0; i < NUM_BLOBS; i++) { + PageBlobClient bc = cc.getPageBlobClient(generateBlobName()) + bc.setCreate(512) } - ContainerListBlobHierarchySegmentResponse response = cu.listBlobsHierarchySegment(null, "/", - new ListBlobsOptions().maxResults(6), null) + def blobs = cc.listBlobsHierarchy("/", new ListBlobsOptions().setMaxResults(PAGE_SIZE), null) + + when: + def firstPage = blobs.iterableByPage().iterator().next() - String marker = response.body().nextMarker() - int firstSegmentSize = responseiterator()().size() - response = cu.listBlobsHierarchySegment(marker, "/", null, null) + then: + firstPage.getValue().size() == PAGE_SIZE + firstPage.getNextLink() != null - expect: - firstSegmentSize == 6 - response.body().nextMarker() == null - response.iterator().size() == 4 - }*/ + when: + def secondPage = blobs.iterableByPage(firstPage.getNextLink()).iterator().next() + + then: + secondPage.getValue().size() == NUM_BLOBS - PAGE_SIZE + secondPage.getNextLink() == null + } def "List blobs flat simple"() { - setup: - // Create 10 page blobs in the container - for (int i = 0; i < 10; i++) { - PageBlobClient bu = cu.getPageBlobClient(generateBlobName()) - bu.create(512) + setup: "Create 10 page blobs in the container" + def NUM_BLOBS = 10 + def PAGE_SIZE = 3 + for (int i = 0; i < NUM_BLOBS; i++) { + def bc = cc.getPageBlobClient(generateBlobName()) + bc.setCreate(512) } - // Setting maxResult limits the number of items per page, this way we validate - // that blob.size() make multiple calls - one call per page to retrieve all 10 blobs. - // - Iterable blobs = cu.listBlobsFlat(new ListBlobsOptions().maxResults(3), null) - int size = blobs.size() - expect: - size == 10 + expect: "listing operation will fetch all 10 blobs, despite page size being smaller than 10" + cc.listBlobsFlat(new ListBlobsOptions().setMaxResults(PAGE_SIZE), null).stream().count() == NUM_BLOBS } def "List blobs hier error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.listBlobsHierarchy(".").iterator().hasNext() + cc.listBlobsHierarchy(".").iterator().hasNext() then: thrown(StorageException) @@ -1062,16 +1127,16 @@ class ContainerAPITest extends APISpec { @Unroll def "Acquire lease"() { setup: - Response leaseResponse = cu.acquireLease(proposedID, leaseTime) + def leaseResponse = cc.acquireLeaseWithResponse(proposedID, leaseTime, null, null, null) when: - Response propertiesResponse = cu.getProperties() + def properties = cc.getProperties() then: - leaseResponse.value() != null - validateBasicHeaders(leaseResponse.headers()) - propertiesResponse.headers().value("x-ms-lease-state") == leaseState.toString() - propertiesResponse.headers().value("x-ms-lease-duration") == leaseDuration.toString() + leaseResponse.getValue() != null + validateBasicHeaders(leaseResponse.getHeaders()) + properties.getLeaseState() == leaseState + properties.getLeaseDuration() == leaseDuration where: proposedID | leaseTime || leaseState | leaseDuration @@ -1082,16 +1147,16 @@ class ContainerAPITest extends APISpec { def "Acquire lease min"() { expect: - cu.acquireLease(null, -1).statusCode() == 201 + cc.acquireLeaseWithResponse(null, -1, null, null, null).getStatusCode() == 201 } @Unroll def "Acquire lease AC"() { setup: - def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) + def mac = new ModifiedAccessConditions().setIfModifiedSince(modified).setIfUnmodifiedSince(unmodified) expect: - cu.acquireLease(null, -1, mac, null).statusCode() == 201 + cc.acquireLeaseWithResponse(null, -1, mac, null, null).getStatusCode() == 201 where: modified | unmodified @@ -1103,10 +1168,10 @@ class ContainerAPITest extends APISpec { @Unroll def "Acquire lease AC fail"() { setup: - def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) + def mac = new ModifiedAccessConditions().setIfModifiedSince(modified).setIfUnmodifiedSince(unmodified) when: - cu.acquireLease(null, -1, mac, null) + cc.acquireLeaseWithResponse(null, -1, mac, null, null) then: thrown(StorageException) @@ -1120,10 +1185,10 @@ class ContainerAPITest extends APISpec { @Unroll def "Acquire lease AC illegal"() { setup: - ModifiedAccessConditions mac = new ModifiedAccessConditions().ifMatch(match).ifNoneMatch(noneMatch) + def mac = new ModifiedAccessConditions().setIfMatch(match).setIfNoneMatch(noneMatch) when: - cu.acquireLease(null, -1, mac, null) + cc.acquireLeaseWithResponse(null, -1, mac, null, null) then: thrown(UnsupportedOperationException) @@ -1136,10 +1201,10 @@ class ContainerAPITest extends APISpec { def "Acquire lease error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.acquireLease(null, 50, null, null) + cc.acquireLease(null, 50) then: thrown(StorageException) @@ -1147,33 +1212,33 @@ class ContainerAPITest extends APISpec { def "Renew lease"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) - Thread.sleep(16000) // Wait for the lease to expire to ensure we are actually renewing it - Response renewLeaseResponse = cu.renewLease(leaseID) + // If running in live mode wait for the lease to expire to ensure we are actually renewing it + sleepIfRecord(16000) + def renewLeaseResponse = cc.renewLeaseWithResponse(leaseID, null, null, null) expect: - renewLeaseResponse.value() != null - cu.getProperties().headers().value("x-ms-lease-state") == LeaseStateType.LEASED.toString() - validateBasicHeaders(renewLeaseResponse.headers()) + cc.getProperties().getLeaseState() == LeaseStateType.LEASED + validateBasicHeaders(renewLeaseResponse.getHeaders()) } def "Renew lease min"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) expect: - cu.renewLease(leaseID).statusCode() == 200 + cc.renewLeaseWithResponse(leaseID, null, null, null).getStatusCode() == 200 } @Unroll def "Renew lease AC"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) - def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) + def mac = new ModifiedAccessConditions().setIfModifiedSince(modified).setIfUnmodifiedSince(unmodified) expect: - cu.renewLease(leaseID, mac, null).statusCode() == 200 + cc.renewLeaseWithResponse(leaseID, mac, null, null).getStatusCode() == 200 where: modified | unmodified @@ -1185,11 +1250,11 @@ class ContainerAPITest extends APISpec { @Unroll def "Renew lease AC fail"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) - def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) + def mac = new ModifiedAccessConditions().setIfModifiedSince(modified).setIfUnmodifiedSince(unmodified) when: - cu.renewLease(leaseID, mac, null) + cc.renewLease(leaseID, mac, null) then: thrown(StorageException) @@ -1203,10 +1268,10 @@ class ContainerAPITest extends APISpec { @Unroll def "Renew lease AC illegal"() { setup: - ModifiedAccessConditions mac = new ModifiedAccessConditions().ifMatch(match).ifNoneMatch(noneMatch) + ModifiedAccessConditions mac = new ModifiedAccessConditions().setIfMatch(match).setIfNoneMatch(noneMatch) when: - cu.renewLease(receivedLeaseID, mac, null) + cc.renewLease(receivedLeaseID, mac, null) then: thrown(UnsupportedOperationException) @@ -1219,10 +1284,10 @@ class ContainerAPITest extends APISpec { def "Renew lease error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.renewLease("id") + cc.renewLease("id") then: thrown(StorageException) @@ -1230,31 +1295,31 @@ class ContainerAPITest extends APISpec { def "Release lease"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + def leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) - VoidResponse releaseLeaseResponse = cu.releaseLease(leaseID) + def releaseLeaseResponse = cc.releaseLeaseWithResponse(leaseID, null, null, null) expect: - cu.getProperties().headers().value("x-ms-lease-state") == LeaseStateType.AVAILABLE.toString() - validateBasicHeaders(releaseLeaseResponse.headers()) + cc.getProperties().getLeaseState() == LeaseStateType.AVAILABLE + validateBasicHeaders(releaseLeaseResponse.getHeaders()) } def "Release lease min"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) expect: - cu.releaseLease(leaseID).statusCode() == 200 + cc.releaseLeaseWithResponse(leaseID, null, null, null).getStatusCode() == 200 } @Unroll def "Release lease AC"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) - def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) + def mac = new ModifiedAccessConditions().setIfModifiedSince(modified).setIfUnmodifiedSince(unmodified) expect: - cu.releaseLease(leaseID, mac, null).statusCode() == 200 + cc.releaseLeaseWithResponse(leaseID, mac, null, null).getStatusCode() == 200 where: modified | unmodified @@ -1266,11 +1331,11 @@ class ContainerAPITest extends APISpec { @Unroll def "Release lease AC fail"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) - def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) + def mac = new ModifiedAccessConditions().setIfModifiedSince(modified).setIfUnmodifiedSince(unmodified) when: - cu.releaseLease(leaseID, mac, null) + cc.releaseLeaseWithResponse(leaseID, mac, null, null) then: thrown(StorageException) @@ -1284,10 +1349,10 @@ class ContainerAPITest extends APISpec { @Unroll def "Release lease AC illegal"() { setup: - ModifiedAccessConditions mac = new ModifiedAccessConditions().ifMatch(match).ifNoneMatch(noneMatch) + ModifiedAccessConditions mac = new ModifiedAccessConditions().setIfMatch(match).setIfNoneMatch(noneMatch) when: - cu.releaseLease(receivedLeaseID, mac, null) + cc.releaseLeaseWithResponse(receivedLeaseID, mac, null, null) then: thrown(UnsupportedOperationException) @@ -1300,10 +1365,10 @@ class ContainerAPITest extends APISpec { def "Release lease error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.releaseLease("id") + cc.releaseLease("id") then: thrown(StorageException) @@ -1312,17 +1377,18 @@ class ContainerAPITest extends APISpec { @Unroll def "Break lease"() { setup: - cu.acquireLease(UUID.randomUUID().toString(), leaseTime) + cc.acquireLease(getRandomUUID(), leaseTime) - Response breakLeaseResponse = cu.breakLease(breakPeriod, null, null) - LeaseStateType state = LeaseStateType.fromString(cu.getProperties().headers().value("x-ms-lease-state")) + def breakLeaseResponse = cc.breakLeaseWithResponse(breakPeriod, null, null, null) + def state = cc.getProperties().getLeaseState() expect: state == LeaseStateType.BROKEN || state == LeaseStateType.BREAKING - breakLeaseResponse.value().getSeconds() <= remainingTime - validateBasicHeaders(breakLeaseResponse.headers()) + breakLeaseResponse.getValue().getSeconds() <= remainingTime + validateBasicHeaders(breakLeaseResponse.getHeaders()) if (breakPeriod != null) { - sleep(breakPeriod * 1000) // so we can delete the container after the test completes + // If running in live mode wait for the lease to break so we can delete the container after the test completes + sleepIfRecord(breakPeriod * 1000) } where: @@ -1335,20 +1401,20 @@ class ContainerAPITest extends APISpec { def "Break lease min"() { setup: - setupContainerLeaseCondition(cu, receivedLeaseID) + setupContainerLeaseCondition(cc, receivedLeaseID) expect: - cu.breakLease().statusCode() == 202 + cc.breakLeaseWithResponse(null, null, null, null).getStatusCode() == 202 } @Unroll def "Break lease AC"() { setup: - setupContainerLeaseCondition(cu, receivedLeaseID) - def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) + setupContainerLeaseCondition(cc, receivedLeaseID) + def mac = new ModifiedAccessConditions().setIfModifiedSince(modified).setIfUnmodifiedSince(unmodified) expect: - cu.breakLease(null, mac, null).statusCode() == 202 + cc.breakLeaseWithResponse(null, mac, null, null).getStatusCode() == 202 where: modified | unmodified @@ -1360,11 +1426,11 @@ class ContainerAPITest extends APISpec { @Unroll def "Break lease AC fail"() { setup: - setupContainerLeaseCondition(cu, receivedLeaseID) - def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) + setupContainerLeaseCondition(cc, receivedLeaseID) + def mac = new ModifiedAccessConditions().setIfModifiedSince(modified).setIfUnmodifiedSince(unmodified) when: - cu.breakLease(null, mac, null) + cc.breakLeaseWithResponse(null, mac, null, null) then: thrown(StorageException) @@ -1378,10 +1444,10 @@ class ContainerAPITest extends APISpec { @Unroll def "Break lease AC illegal"() { setup: - ModifiedAccessConditions mac = new ModifiedAccessConditions().ifMatch(match).ifNoneMatch(noneMatch) + ModifiedAccessConditions mac = new ModifiedAccessConditions().setIfMatch(match).setIfNoneMatch(noneMatch) when: - cu.breakLease(null, mac, null) + cc.breakLeaseWithResponse(null, mac, null, null) then: thrown(UnsupportedOperationException) @@ -1394,10 +1460,10 @@ class ContainerAPITest extends APISpec { def "Break lease error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.breakLease() + cc.breakLease() then: thrown(StorageException) @@ -1405,31 +1471,31 @@ class ContainerAPITest extends APISpec { def "Change lease"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) - Response changeLeaseResponse = cu.changeLease(leaseID, UUID.randomUUID().toString()) - leaseID = changeLeaseResponse.value() + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) + Response changeLeaseResponse = cc.changeLeaseWithResponse(leaseID, getRandomUUID(), null, null, null) + leaseID = changeLeaseResponse.getValue() expect: - cu.releaseLease(leaseID).statusCode() == 200 - validateBasicHeaders(changeLeaseResponse.headers()) + cc.releaseLeaseWithResponse(leaseID, null, null, null).getStatusCode() == 200 + validateBasicHeaders(changeLeaseResponse.getHeaders()) } def "Change lease min"() { setup: - def leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) + def leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) expect: - cu.changeLease(leaseID, UUID.randomUUID().toString()).statusCode() == 200 + cc.changeLeaseWithResponse(leaseID, getRandomUUID(), null, null, null).getStatusCode() == 200 } @Unroll def "Change lease AC"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) - def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) + def mac = new ModifiedAccessConditions().setIfModifiedSince(modified).setIfUnmodifiedSince(unmodified) expect: - cu.changeLease(leaseID, UUID.randomUUID().toString(), mac, null).statusCode() == 200 + cc.changeLeaseWithResponse(leaseID, getRandomUUID(), mac, null, null).getStatusCode() == 200 where: modified | unmodified @@ -1441,11 +1507,11 @@ class ContainerAPITest extends APISpec { @Unroll def "Change lease AC fail"() { setup: - String leaseID = setupContainerLeaseCondition(cu, receivedLeaseID) - def mac = new ModifiedAccessConditions().ifModifiedSince(modified).ifUnmodifiedSince(unmodified) + String leaseID = setupContainerLeaseCondition(cc, receivedLeaseID) + def mac = new ModifiedAccessConditions().setIfModifiedSince(modified).setIfUnmodifiedSince(unmodified) when: - cu.changeLease(leaseID, UUID.randomUUID().toString(), mac, null) + cc.changeLeaseWithResponse(leaseID, getRandomUUID(), mac, null, null) then: thrown(StorageException) @@ -1459,10 +1525,10 @@ class ContainerAPITest extends APISpec { @Unroll def "Change lease AC illegal"() { setup: - ModifiedAccessConditions mac = new ModifiedAccessConditions().ifMatch(match).ifNoneMatch(noneMatch) + ModifiedAccessConditions mac = new ModifiedAccessConditions().setIfMatch(match).setIfNoneMatch(noneMatch) when: - cu.changeLease(receivedLeaseID, garbageLeaseID, mac, null) + cc.changeLeaseWithResponse(receivedLeaseID, garbageLeaseID, mac, null, null) then: thrown(UnsupportedOperationException) @@ -1475,10 +1541,10 @@ class ContainerAPITest extends APISpec { def "Change lease error"() { setup: - cu = primaryServiceURL.getContainerClient(generateContainerName()) + cc = primaryBlobServiceClient.getContainerClient(generateContainerName()) when: - cu.changeLease("id", "id") + cc.changeLease("id", "id") then: thrown(StorageException) @@ -1488,114 +1554,110 @@ class ContainerAPITest extends APISpec { def "Create URL special chars"() { // This test checks that we encode special characters in blob names correctly. setup: - AppendBlobClient bu2 = cu.getAppendBlobClient(name) - PageBlobClient bu3 = cu.getPageBlobClient(name + "2") - BlockBlobClient bu4 = cu.getBlockBlobClient(name + "3") - BlockBlobClient bu5 = cu.getBlockBlobClient(name) + AppendBlobClient bu2 = cc.getAppendBlobClient(name) + PageBlobClient bu3 = cc.getPageBlobClient(name + "2") + BlockBlobClient bu4 = cc.getBlockBlobClient(name + "3") + BlockBlobClient bu5 = cc.getBlockBlobClient(name) expect: - bu2.create().statusCode() == 201 - bu5.getProperties().statusCode() == 200 - bu3.create(512).statusCode() == 201 - bu4.upload(defaultInputStream.get(), defaultDataSize).statusCode() == 201 + bu2.createWithResponse(null, null, null, null, null).getStatusCode() == 201 + bu5.getPropertiesWithResponse(null, null, null).getStatusCode() == 200 + bu3.createWithResponse(512, null, null, null, null, null, null).getStatusCode() == 201 + bu4.uploadWithResponse(defaultInputStream.get(), defaultDataSize, null, null, null, null, null, null).getStatusCode() == 201 when: - Iterator blobs = cu.listBlobsFlat().iterator() + Iterator blobs = cc.listBlobsFlat().iterator() then: - blobs.next().name() == name - blobs.next().name() == name + "2" - blobs.next().name() == name + "3" + blobs.next().getName() == name + blobs.next().getName() == name + "2" + blobs.next().getName() == name + "3" where: - name | _ + name | _ // "中文" | _ TODO: requires blob name to be url encoded, deferred for post preview-1, storage team to decide on encoding story across SDKS - "az[]" | _ + "az[]" | _ // "hello world" | _ TODO: see previous TODO - "hello/world" | _ - "hello&world" | _ + "hello/world" | _ + "hello&world" | _ // "!*'();:@&=+\$,/?#[]" | _ TODO: see previous TODO } def "Root explicit"() { setup: - cu = primaryServiceURL.getContainerClient(ContainerClient.ROOT_CONTAINER_NAME) + cc = primaryBlobServiceClient.getContainerClient(ContainerClient.ROOT_CONTAINER_NAME) // Create root container if not exist. - if (!cu.exists().value()) { - cu.create() + if (!cc.exists()) { + cc.create() } - AppendBlobClient bu = cu.getAppendBlobClient("rootblob") + AppendBlobClient bu = cc.getAppendBlobClient("rootblob") expect: - bu.create().statusCode() == 201 + bu.createWithResponse(null, null, null, null, null).getStatusCode() == 201 } def "Root explicit in endpoint"() { setup: - cu = primaryServiceURL.getContainerClient(ContainerClient.ROOT_CONTAINER_NAME) + cc = primaryBlobServiceClient.getContainerClient(ContainerClient.ROOT_CONTAINER_NAME) // Create root container if not exist. - if (!cu.exists().value()) { - cu.create() + if (!cc.exists()) { + cc.create() } - AppendBlobClient bu = new BlobClientBuilder() - .credential(primaryCreds) - .endpoint("http://" + primaryCreds.accountName() + ".blob.core.windows.net/\$root/rootblob") - .httpClient(getHttpClient()) - .buildAppendBlobClient() + AppendBlobClient bu = cc.getAppendBlobClient("rootblob") when: - Response createResponse = bu.create() + Response createResponse = bu.createWithResponse(null, null, null, null, null) - Response propsResponse = bu.getProperties() + Response propsResponse = bu.getPropertiesWithResponse(null, null, null) then: - createResponse.statusCode() == 201 - propsResponse.statusCode() == 200 - propsResponse.value().blobType() == BlobType.APPEND_BLOB + createResponse.getStatusCode() == 201 + propsResponse.getStatusCode() == 200 + propsResponse.getValue().getBlobType() == BlobType.APPEND_BLOB } /* def "Root implicit"() { setup: - cu = primaryServiceURL.getContainerClient(ContainerClient.ROOT_CONTAINER_NAME) + cc = primaryBlobServiceClient.getContainerClient(ContainerClient.ROOT_CONTAINER_NAME) // Create root container if not exist. - if (!cu.exists().value()) { - cu.create() + if (!cc.exists().value()) { + cc.setCreate() } - AppendBlobClient bu = new BlobClientBuilder() + AppendBlobClient bc = new BlobClientBuilder() .credential(primaryCreds) .endpoint("http://" + primaryCreds.accountName() + ".blob.core.windows.net/rootblob") .httpClient(getHttpClient()) .buildAppendBlobClient() when: - Response createResponse = bu.create() + Response createResponse = bc.setCreate() - Response propsResponse = bu.getProperties() + Response propsResponse = bc.getProperties() then: - createResponse.statusCode() == 201 - propsResponse.statusCode() == 200 - propsResponse.value().blobType() == BlobType.APPEND_BLOB + createResponse.getStatusCode() == 201 + propsResponse.getStatusCode() == 200 + propsResponse.value().getBlobType() == BlobType.APPEND_BLOB } */ def "Web container"() { setup: - cu = primaryServiceURL.getContainerClient(ContainerClient.STATIC_WEBSITE_CONTAINER_NAME) + cc = primaryBlobServiceClient.getContainerClient(ContainerClient.STATIC_WEBSITE_CONTAINER_NAME) // Create root container if not exist. try { - cu.create(null, null, null) + cc.create() } catch (StorageException se) { - if (se.errorCode() != StorageErrorCode.CONTAINER_ALREADY_EXISTS) { + if (se.getErrorCode() != StorageErrorCode.CONTAINER_ALREADY_EXISTS) { throw se } } - def webContainer = primaryServiceURL.getContainerClient(ContainerClient.STATIC_WEBSITE_CONTAINER_NAME) + def webContainer = primaryBlobServiceClient.getContainerClient(ContainerClient.STATIC_WEBSITE_CONTAINER_NAME) when: // Validate some basic operation. @@ -1607,26 +1669,24 @@ class ContainerAPITest extends APISpec { def "Get account info"() { when: - Response response = primaryServiceURL.getAccountInfo() + def response = primaryBlobServiceClient.getAccountInfoWithResponse(null, null) then: - response.headers().value("Date") != null - response.headers().value("x-ms-version") != null - response.headers().value("x-ms-request-id") != null - response.value().accountKind() != null - response.value().skuName() != null + response.getHeaders().value("Date") != null + response.getHeaders().value("x-ms-version") != null + response.getHeaders().value("x-ms-request-id") != null + response.getValue().getAccountKind() != null + response.getValue().getSkuName() != null } def "Get account info min"() { expect: - primaryServiceURL.getAccountInfo().statusCode() == 200 + primaryBlobServiceClient.getAccountInfoWithResponse(null, null).getStatusCode() == 200 } def "Get account info error"() { when: - BlobServiceClient serviceURL = new BlobServiceClientBuilder() - .endpoint(primaryServiceURL.getAccountUrl().toString()) - .buildClient() + BlobServiceClient serviceURL = getServiceClient(primaryBlobServiceClient.getAccountUrl().toString()) serviceURL.getContainerClient(generateContainerName()).getAccountInfo() diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/DownloadResponseMockFlux.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/DownloadResponseMockFlux.java index 864e23a7a082..84bc682f5604 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/DownloadResponseMockFlux.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/DownloadResponseMockFlux.java @@ -8,8 +8,6 @@ import com.azure.storage.blob.models.BlobDownloadHeaders; import com.azure.storage.blob.models.BlobsDownloadResponse; import com.azure.storage.blob.models.StorageErrorException; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import reactor.core.CoreSubscriber; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -19,7 +17,7 @@ import java.nio.ByteBuffer; import java.nio.charset.Charset; -class DownloadResponseMockFlux extends Flux { +class DownloadResponseMockFlux extends Flux { static final int DR_TEST_SCENARIO_SUCCESSFUL_ONE_CHUNK = 0; static final int DR_TEST_SCENARIO_SUCCESSFUL_MULTI_CHUNK = 1; static final int DR_TEST_SCENARIO_SUCCESSFUL_STREAM_FAILURES = 2; @@ -33,15 +31,16 @@ class DownloadResponseMockFlux extends Flux { private HTTPGetterInfo info; private ByteBuffer scenarioData; - DownloadResponseMockFlux(int scenario) { + DownloadResponseMockFlux(int scenario, APISpec apiSpec) { this.scenario = scenario; + switch (this.scenario) { case DR_TEST_SCENARIO_SUCCESSFUL_ONE_CHUNK: - this.scenarioData = APISpec.getRandomData(512 * 1024); + this.scenarioData = apiSpec.getRandomData(512 * 1024); break; case DR_TEST_SCENARIO_SUCCESSFUL_MULTI_CHUNK: case DR_TEST_SCENARIO_SUCCESSFUL_STREAM_FAILURES: - this.scenarioData = APISpec.getRandomData(1024); + this.scenarioData = apiSpec.getRandomData(1024); break; case DR_TEST_SCENARIO_MAX_RETRIES_EXCEEDED: case DR_TEST_SCENARIO_NON_RETRYABLE_ERROR: @@ -62,10 +61,10 @@ int getTryNumber() { } @Override - public void subscribe(CoreSubscriber subscriber) { + public void subscribe(CoreSubscriber subscriber) { switch (this.scenario) { case DR_TEST_SCENARIO_SUCCESSFUL_ONE_CHUNK: - subscriber.onNext(Unpooled.wrappedBuffer(this.scenarioData.duplicate())); + subscriber.onNext(this.scenarioData.duplicate()); Operators.complete(subscriber); break; @@ -74,7 +73,7 @@ public void subscribe(CoreSubscriber subscriber) { ByteBuffer toSend = this.scenarioData.duplicate(); toSend.position(i * 256); toSend.limit((i + 1) * 256); - subscriber.onNext(Unpooled.wrappedBuffer(toSend)); + subscriber.onNext(toSend); } Operators.complete(subscriber); break; @@ -82,27 +81,27 @@ public void subscribe(CoreSubscriber subscriber) { case DR_TEST_SCENARIO_SUCCESSFUL_STREAM_FAILURES: if (this.tryNumber <= 3) { // tryNumber is 1 indexed, so we have to sub 1. - if (this.info.offset() != (this.tryNumber - 1) * 256 - || this.info.count() != this.scenarioData.remaining() - (this.tryNumber - 1) * 256) { + if (this.info.getOffset() != (this.tryNumber - 1) * 256 + || this.info.getCount() != this.scenarioData.remaining() - (this.tryNumber - 1) * 256) { Operators.error(subscriber, new IllegalArgumentException("Info values are incorrect.")); return; } ByteBuffer toSend = this.scenarioData.duplicate(); toSend.position((this.tryNumber - 1) * 256); toSend.limit(this.tryNumber * 256); - subscriber.onNext(Unpooled.wrappedBuffer(toSend)); + subscriber.onNext(toSend); Operators.error(subscriber, new IOException()); break; } - if (this.info.offset() != (this.tryNumber - 1) * 256 - || this.info.count() != this.scenarioData.remaining() - (this.tryNumber - 1) * 256) { + if (this.info.getOffset() != (this.tryNumber - 1) * 256 + || this.info.getCount() != this.scenarioData.remaining() - (this.tryNumber - 1) * 256) { Operators.error(subscriber, new IllegalArgumentException("Info values are incorrect.")); return; } ByteBuffer toSend = this.scenarioData.duplicate(); toSend.position((this.tryNumber - 1) * 256); toSend.limit(this.tryNumber * 256); - subscriber.onNext(Unpooled.wrappedBuffer(toSend)); + subscriber.onNext(toSend); Operators.complete(subscriber); break; @@ -164,37 +163,37 @@ Mono getter(HTTPGetterInfo info) { */ throw new StorageErrorException("Message", new HttpResponse() { @Override - public int statusCode() { + public int getStatusCode() { return 500; } @Override - public String headerValue(String s) { + public String getHeaderValue(String s) { return null; } @Override - public HttpHeaders headers() { + public HttpHeaders getHeaders() { return null; } @Override - public Flux body() { + public Flux getBody() { return null; } @Override - public Mono bodyAsByteArray() { + public Mono getBodyAsByteArray() { return null; } @Override - public Mono bodyAsString() { + public Mono getBodyAsString() { return null; } @Override - public Mono bodyAsString(Charset charset) { + public Mono getBodyAsString(Charset charset) { return null; } }); @@ -203,7 +202,7 @@ public Mono bodyAsString(Charset charset) { } case DR_TEST_SCENARIO_INFO_TEST: // We also test that the info is updated in DR_TEST_SCENARIO_SUCCESSFUL_STREAM_FAILURES. - if (info.count() != 10 || info.offset() != 20 || !info.eTag().equals("etag")) { + if (info.getCount() != 10 || info.getOffset() != 20 || !info.getETag().equals("etag")) { throw new IllegalArgumentException("Info values incorrect"); } return Mono.just(response); diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/DownloadResponseTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/DownloadResponseTest.groovy index f784283d4de6..c6fd7f8e4843 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/DownloadResponseTest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/DownloadResponseTest.groovy @@ -13,7 +13,7 @@ class DownloadResponseTest extends APISpec { BlockBlobClient bu def setup() { - bu = cu.getBlockBlobClient(generateBlobName()) + bu = cc.getBlockBlobClient(generateBlobName()) bu.upload(defaultInputStream.get(), defaultText.length()) } @@ -32,12 +32,12 @@ class DownloadResponseTest extends APISpec { @Unroll def "Successful"() { setup: - DownloadResponseMockFlux flux = new DownloadResponseMockFlux(scenario) + DownloadResponseMockFlux flux = new DownloadResponseMockFlux(scenario, this) HTTPGetterInfo info = new HTTPGetterInfo() - .offset(0) - .count(flux.getScenarioData().remaining()) - .eTag("etag") + .setOffset(0) + .setCount(flux.getScenarioData().remaining()) + .setETag("etag") ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5) @@ -45,7 +45,7 @@ class DownloadResponseTest extends APISpec { DownloadAsyncResponse response = flux.getter(info).block() then: - FluxUtil.collectByteBufStream(response.body(options), false).block().nioBuffer() == flux.getScenarioData() + FluxUtil.collectBytesInByteBufferStream(response.body(options)).block() == flux.getScenarioData().array() flux.getTryNumber() == tryNumber @@ -59,9 +59,9 @@ class DownloadResponseTest extends APISpec { @Unroll def "Failure"() { setup: - DownloadResponseMockFlux flux = new DownloadResponseMockFlux(scenario) + DownloadResponseMockFlux flux = new DownloadResponseMockFlux(scenario, this) ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5) - HTTPGetterInfo info = new HTTPGetterInfo().eTag("etag") + HTTPGetterInfo info = new HTTPGetterInfo().setETag("etag") when: DownloadAsyncResponse response = flux.getter(info).block() @@ -89,10 +89,10 @@ class DownloadResponseTest extends APISpec { @Unroll def "Info null IA"() { setup: - DownloadResponseMockFlux flux = new DownloadResponseMockFlux(DownloadResponseMockFlux.DR_TEST_SCENARIO_SUCCESSFUL_ONE_CHUNK) + DownloadResponseMockFlux flux = new DownloadResponseMockFlux(DownloadResponseMockFlux.DR_TEST_SCENARIO_SUCCESSFUL_ONE_CHUNK, this) when: - new DownloadAsyncResponse(flux.getter(info).block().rawResponse(), info, { HTTPGetterInfo newInfo -> flux.getter(newInfo) }) + new DownloadAsyncResponse(flux.getter(info).block().getRawResponse(), info, { HTTPGetterInfo newInfo -> flux.getter(newInfo) }) then: thrown(IllegalArgumentException) @@ -100,7 +100,7 @@ class DownloadResponseTest extends APISpec { where: info | _ null | _ - new HTTPGetterInfo().eTag(null) | _ + new HTTPGetterInfo().setETag(null) | _ } def "Options IA"() { @@ -113,11 +113,11 @@ class DownloadResponseTest extends APISpec { def "Getter IA"() { setup: - DownloadResponseMockFlux flux = new DownloadResponseMockFlux(DownloadResponseMockFlux.DR_TEST_SCENARIO_SUCCESSFUL_ONE_CHUNK) + DownloadResponseMockFlux flux = new DownloadResponseMockFlux(DownloadResponseMockFlux.DR_TEST_SCENARIO_SUCCESSFUL_ONE_CHUNK, this) when: DownloadAsyncResponse response = new DownloadAsyncResponse(flux.getter(new HTTPGetterInfo()).block() - .rawResponse(), new HTTPGetterInfo().eTag("etag"), null) + .getRawResponse(), new HTTPGetterInfo().setETag("etag"), null) response.body(null).blockFirst() then: @@ -126,11 +126,11 @@ class DownloadResponseTest extends APISpec { def "Info"() { setup: - DownloadResponseMockFlux flux = new DownloadResponseMockFlux(DownloadResponseMockFlux.DR_TEST_SCENARIO_INFO_TEST) + DownloadResponseMockFlux flux = new DownloadResponseMockFlux(DownloadResponseMockFlux.DR_TEST_SCENARIO_INFO_TEST, this) HTTPGetterInfo info = new HTTPGetterInfo() - .offset(20) - .count(10) - .eTag("etag") + .setOffset(20) + .setCount(10) + .setETag("etag") ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5) @@ -144,7 +144,7 @@ class DownloadResponseTest extends APISpec { def "Info count IA"() { when: - new HTTPGetterInfo().count(-1) + new HTTPGetterInfo().setCount(-1) then: thrown(IllegalArgumentException) diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/HelperTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/HelperTest.groovy index 01000a486529..664f87c19444 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/HelperTest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/HelperTest.groovy @@ -3,15 +3,16 @@ package com.azure.storage.blob -import com.azure.core.http.rest.Response -import com.azure.core.http.rest.VoidResponse + 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.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.SASTokenCredential import com.azure.storage.common.credentials.SharedKeyCredential import spock.lang.Unroll @@ -24,14 +25,14 @@ class HelperTest extends APISpec { // TODO (alzimmer): Turn this on when nextPageLink can be passed into listing /*def "responseError"() { when: - cu.listBlobsFlat().iterator().hasNext() + cc.listBlobsFlat().iterator().hasNext() then: def e = thrown(StorageException) - e.errorCode() == StorageErrorCode.INVALID_QUERY_PARAMETER_VALUE - e.statusCode() == 400 + e.getErrorCode() == StorageErrorCode.INVALID_QUERY_PARAMETER_VALUE + e.getStatusCode() == 400 e.message().contains("Value for one of the query parameters specified in the request URI is invalid.") - e.getMessage().contains(" properties = bsu.getProperties() - - then: - properties.value().cacheControl() == "cache" - properties.value().contentDisposition() == "disposition" - properties.value().contentEncoding() == "encoding" - properties.value().contentLanguage() == "language" - properties.headers().value("Content-Type") == "type" - } - /* 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 @@ -156,56 +82,56 @@ class HelperTest extends APISpec { @Unroll def "serviceSasSignatures string to sign"() { when: - ServiceSASSignatureValues v = new ServiceSASSignatureValues() + BlobServiceSASSignatureValues v = new BlobServiceSASSignatureValues() if (permissions != null) { - v.permissions(new BlobSASPermission().read(true).toString()) + v.setPermissions(new BlobSASPermission().setRead(true).toString()) } else { - v.permissions("") + v.setPermissions("") } if (snapId != null) { - v.resource(Constants.UrlConstants.SAS_BLOB_SNAPSHOT_CONSTANT) + v.setResource(Constants.UrlConstants.SAS_BLOB_SNAPSHOT_CONSTANT) } else { - v.resource(Constants.UrlConstants.SAS_BLOB_CONSTANT) + v.setResource(Constants.UrlConstants.SAS_BLOB_CONSTANT) } - v.startTime(startTime) - .canonicalName(String.format("/blob/%s/containerName/blobName", primaryCreds.accountName())) - .snapshotId(snapId) + v.setStartTime(startTime) + .setCanonicalName(String.format("/blob/%s/containerName/blobName", primaryCredential.getAccountName())) + .setSnapshotId(snapId) if (expiryTime == null) { - v.expiryTime(OffsetDateTime.now()) + v.setExpiryTime(OffsetDateTime.now()) } else { - v.expiryTime(expiryTime) + v.setExpiryTime(expiryTime) } if (ipRange != null) { - v.ipRange(new IPRange().ipMin("ip")) + v.setIpRange(new IPRange().setIpMin("ip")) } - v.identifier(identifier) - .protocol(protocol) - .cacheControl(cacheControl) - .contentDisposition(disposition) - .contentEncoding(encoding) - .contentLanguage(language) - .contentType(type) + v.setIdentifier(identifier) + .setProtocol(protocol) + .setCacheControl(cacheControl) + .setContentDisposition(disposition) + .setContentEncoding(encoding) + .setContentLanguage(language) + .setContentType(type) - SASQueryParameters token = v.generateSASQueryParameters(primaryCreds) + BlobServiceSASQueryParameters token = v.generateSASQueryParameters(primaryCredential) if (startTime != null) { expectedStringToSign = String.format(expectedStringToSign, Utility.ISO_8601_UTC_DATE_FORMATTER.format(startTime), Utility.ISO_8601_UTC_DATE_FORMATTER.format(expiryTime), - primaryCreds.accountName()) + primaryCredential.getAccountName()) } else { expectedStringToSign = String.format(expectedStringToSign, Utility.ISO_8601_UTC_DATE_FORMATTER.format(expiryTime), - primaryCreds.accountName()) + primaryCredential.getAccountName()) } then: - token.signature() == primaryCreds.computeHmac256(expectedStringToSign) + token.getSignature() == primaryCredential.computeHmac256(expectedStringToSign) /* We don't test the blob or containerName properties because canonicalized resource is always added as at least @@ -232,55 +158,55 @@ class HelperTest extends APISpec { @Unroll def "serviceSasSignatures string to sign user delegation key"() { when: - ServiceSASSignatureValues v = new ServiceSASSignatureValues() + BlobServiceSASSignatureValues v = new BlobServiceSASSignatureValues() if (permissions != null) { - v.permissions(new BlobSASPermission().read(true).toString()) + v.setPermissions(new BlobSASPermission().setRead(true).toString()) } else { - v.permissions("") + v.setPermissions("") } - v.startTime(startTime) - .canonicalName(String.format("/blob/%s/containerName/blobName", primaryCreds.accountName())) - .snapshotId(snapId) + v.setStartTime(startTime) + .setCanonicalName(String.format("/blob/%s/containerName/blobName", primaryCredential.getAccountName())) + .setSnapshotId(snapId) if (expiryTime == null) { - v.expiryTime(OffsetDateTime.now()) + v.setExpiryTime(OffsetDateTime.now()) } else { - v.expiryTime(expiryTime) + v.setExpiryTime(expiryTime) } if (snapId != null) { - v.resource(Constants.UrlConstants.SAS_BLOB_SNAPSHOT_CONSTANT) + v.setResource(Constants.UrlConstants.SAS_BLOB_SNAPSHOT_CONSTANT) } else { - v.resource(Constants.UrlConstants.SAS_BLOB_CONSTANT) + v.setResource(Constants.UrlConstants.SAS_BLOB_CONSTANT) } if (ipRange != null) { - v.ipRange(new IPRange().ipMin("ip")) + v.setIpRange(new IPRange().setIpMin("ip")) } - v.protocol(protocol) - .cacheControl(cacheControl) - .contentDisposition(disposition) - .contentEncoding(encoding) - .contentLanguage(language) - .contentType(type) + v.setProtocol(protocol) + .setCacheControl(cacheControl) + .setContentDisposition(disposition) + .setContentEncoding(encoding) + .setContentLanguage(language) + .setContentType(type) UserDelegationKey key = new UserDelegationKey() - .signedOid(keyOid) - .signedTid(keyTid) - .signedStart(keyStart) - .signedExpiry(keyExpiry) - .signedService(keyService) - .signedVersion(keyVersion) - .value(keyValue) + .setSignedOid(keyOid) + .setSignedTid(keyTid) + .setSignedStart(keyStart) + .setSignedExpiry(keyExpiry) + .setSignedService(keyService) + .setSignedVersion(keyVersion) + .setValue(keyValue) - SASQueryParameters token = v.generateSASQueryParameters(key) + BlobServiceSASQueryParameters token = v.generateSASQueryParameters(key) - expectedStringToSign = String.format(expectedStringToSign, Utility.ISO_8601_UTC_DATE_FORMATTER.format(v.expiryTime()), primaryCreds.accountName()) + expectedStringToSign = String.format(expectedStringToSign, Utility.ISO_8601_UTC_DATE_FORMATTER.format(v.getExpiryTime()), primaryCredential.getAccountName()) then: - token.signature() == Utility.computeHMac256(key.value(), expectedStringToSign) + token.getSignature() == Utility.computeHMac256(key.getValue(), expectedStringToSign) /* We test string to sign functionality directly related to user delegation sas specific parameters @@ -309,27 +235,27 @@ class HelperTest extends APISpec { @Unroll def "serviceSASSignatureValues canonicalizedResource"() { setup: - ServiceSASSignatureValues v = new ServiceSASSignatureValues() - .expiryTime(expiryTime) - .permissions(new BlobSASPermission().toString()) - .resource(expectedResource) - .canonicalName(String.format("/blob/%s/%s", primaryCreds.accountName(), containerName)) - .snapshotId(snapId) + BlobServiceSASSignatureValues v = new BlobServiceSASSignatureValues() + .setExpiryTime(expiryTime) + .setPermissions(new BlobSASPermission().toString()) + .setResource(expectedResource) + .setCanonicalName(String.format("/blob/%s/%s", primaryCredential.getAccountName(), containerName)) + .setSnapshotId(snapId) if (blobName != null) { - v.canonicalName(v.canonicalName() + "/" + blobName) + v.setCanonicalName(v.getCanonicalName() + "/" + blobName) } expectedStringToSign = String.format(expectedStringToSign, Utility.ISO_8601_UTC_DATE_FORMATTER.format(expiryTime), - primaryCreds.accountName()) + primaryCredential.getAccountName()) when: - SASQueryParameters token = v.generateSASQueryParameters(primaryCreds) + BlobServiceSASQueryParameters token = v.generateSASQueryParameters(primaryCredential) then: - token.signature() == primaryCreds.computeHmac256(expectedStringToSign) - token.resource() == expectedResource + token.getSignature() == primaryCredential.computeHmac256(expectedStringToSign) + token.getResource() == expectedResource where: containerName | blobName | snapId | expiryTime || expectedResource | expectedStringToSign @@ -342,13 +268,13 @@ class HelperTest extends APISpec { @Unroll def "serviceSasSignatureValues IA"() { setup: - ServiceSASSignatureValues v = new ServiceSASSignatureValues() - .permissions(new AccountSASPermission().toString()) - .expiryTime(OffsetDateTime.now()) - .resource(containerName) - .canonicalName(blobName) - .snapshotId("2018-01-01T00:00:00.0000000Z") - .version(version) + BlobServiceSASSignatureValues v = new BlobServiceSASSignatureValues() + .setPermissions(new AccountSASPermission().toString()) + .setExpiryTime(OffsetDateTime.now()) + .setResource(containerName) + .setCanonicalName(blobName) + .setSnapshotId("2018-01-01T00:00:00.0000000Z") + .setVersion(version) when: v.generateSASQueryParameters((SharedKeyCredential)creds) @@ -358,21 +284,21 @@ class HelperTest extends APISpec { e.getMessage().contains(parameter) where: - containerName | version | creds | blobName || parameter - "c" | null | primaryCreds | "b" | "version" - "c" | "v" | null | "b" | "sharedKeyCredentials" - "c" | "v" | primaryCreds | null | "canonicalName" + containerName | version | creds | blobName || parameter + "c" | null | primaryCredential | "b" | "version" + "c" | "v" | null | "b" | "sharedKeyCredentials" + "c" | "v" | primaryCredential | null | "canonicalName" } @Unroll def "BlobSASPermissions toString"() { setup: BlobSASPermission perms = new BlobSASPermission() - .read(read) - .write(write) - .delete(delete) - .create(create) - .add(add) + .setRead(read) + .setWrite(write) + .setDelete(delete) + .setCreate(create) + .setAdd(add) expect: perms.toString() == expectedString @@ -393,11 +319,11 @@ class HelperTest extends APISpec { BlobSASPermission perms = BlobSASPermission.parse(permString) then: - perms.read() == read - perms.write() == write - perms.delete() == delete - perms.create() == create - perms.add() == add + perms.getRead() == read + perms.getWrite() == write + perms.getDelete() == delete + perms.getCreate() == create + perms.getAdd() == add where: permString || read | write | delete | create | add @@ -422,12 +348,12 @@ class HelperTest extends APISpec { def "ContainerSASPermissions toString"() { setup: ContainerSASPermission perms = new ContainerSASPermission() - .read(read) - .write(write) - .delete(delete) - .create(create) - .add(add) - .list(list) + .setRead(read) + .setWrite(write) + .setDelete(delete) + .setCreate(create) + .setAdd(add) + .setList(list) expect: perms.toString() == expectedString @@ -449,12 +375,12 @@ class HelperTest extends APISpec { ContainerSASPermission perms = ContainerSASPermission.parse(permString) then: - perms.read() == read - perms.write() == write - perms.delete() == delete - perms.create() == create - perms.add() == add - perms.list() == list + perms.getRead() == read + perms.getWrite() == write + perms.getDelete() == delete + perms.getCreate() == create + perms.getAdd() == add + perms.getList() == list where: permString || read | write | delete | create | add | list @@ -480,8 +406,8 @@ class HelperTest extends APISpec { def "IPRange toString"() { setup: def ip = new IPRange() - .ipMin(min) - .ipMax(max) + .setIpMin(min) + .setIpMax(max) expect: ip.toString() == expectedString @@ -499,8 +425,8 @@ class HelperTest extends APISpec { IPRange ip = IPRange.parse(rangeStr) then: - ip.ipMin() == min - ip.ipMax() == max + ip.getIpMin() == min + ip.getIpMax() == max where: rangeStr || min | max @@ -530,23 +456,23 @@ class HelperTest extends APISpec { def "accountSasSignatures string to sign"() { when: AccountSASSignatureValues v = new AccountSASSignatureValues() - .permissions(new AccountSASPermission().read(true).toString()) - .services("b") - .resourceTypes("o") - .startTime(startTime) - .expiryTime(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) - .protocol(protocol) + .setPermissions(new AccountSASPermission().setRead(true).toString()) + .setServices("b") + .setResourceTypes("o") + .setStartTime(startTime) + .setExpiryTime(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + .setProtocol(protocol) if (ipRange != null) { - v.ipRange(new IPRange().ipMin("ip")) + v.setIpRange(new IPRange().setIpMin("ip")) } - def token = v.generateSASQueryParameters(primaryCreds) + def token = v.generateSASQueryParameters(primaryCredential) - expectedStringToSign = String.format(expectedStringToSign, primaryCreds.accountName()) + expectedStringToSign = String.format(expectedStringToSign, primaryCredential.getAccountName()) then: - token.signature() == primaryCreds.computeHmac256(expectedStringToSign) + token.getSignature() == primaryCredential.computeHmac256(expectedStringToSign) where: startTime | ipRange | protocol || expectedStringToSign @@ -559,11 +485,11 @@ class HelperTest extends APISpec { def "accountSasSignatureValues IA"() { setup: AccountSASSignatureValues v = new AccountSASSignatureValues() - .permissions(permissions) - .services(service) - .resourceTypes(resourceType) - .expiryTime(expiryTime) - .version(version) + .setPermissions(permissions) + .setServices(service) + .setResourceTypes(resourceType) + .setExpiryTime(expiryTime) + .setVersion(version) when: v.generateSASQueryParameters(creds) @@ -573,27 +499,27 @@ class HelperTest extends APISpec { e.getMessage().contains(parameter) where: - permissions | service | resourceType | expiryTime | version | creds || parameter - null | "b" | "c" | OffsetDateTime.now() | "v" | primaryCreds || "permissions" - "c" | null | "c" | OffsetDateTime.now() | "v" | primaryCreds || "services" - "c" | "b" | null | OffsetDateTime.now() | "v" | primaryCreds || "resourceTypes" - "c" | "b" | "c" | null | "v" | primaryCreds || "expiryTime" - "c" | "b" | "c" | OffsetDateTime.now() | null | primaryCreds || "version" - "c" | "b" | "c" | OffsetDateTime.now() | "v" | null || "SharedKeyCredential" + permissions | service | resourceType | expiryTime | version | creds || parameter + null | "b" | "c" | OffsetDateTime.now() | "v" | primaryCredential || "permissions" + "c" | null | "c" | OffsetDateTime.now() | "v" | primaryCredential || "services" + "c" | "b" | null | OffsetDateTime.now() | "v" | primaryCredential || "resourceTypes" + "c" | "b" | "c" | null | "v" | primaryCredential || "expiryTime" + "c" | "b" | "c" | OffsetDateTime.now() | null | primaryCredential || "version" + "c" | "b" | "c" | OffsetDateTime.now() | "v" | null || "SharedKeyCredential" } @Unroll def "AccountSASPermissions toString"() { setup: AccountSASPermission perms = new AccountSASPermission() - .read(read) - .write(write) - .delete(delete) - .list(list) - .add(add) - .create(create) - .update(update) - .processMessages(process) + .setRead(read) + .setWrite(write) + .setDelete(delete) + .setList(list) + .setAdd(add) + .setCreate(create) + .setUpdate(update) + .setProcessMessages(process) expect: perms.toString() == expectedString @@ -617,14 +543,14 @@ class HelperTest extends APISpec { AccountSASPermission perms = AccountSASPermission.parse(permString) then: - perms.read() == read - perms.write() == write - perms.delete() == delete - perms.list() == list - perms.add() == add - perms.create() == create - perms.update() == update - perms.processMessages() == process + perms.isRead() == read + perms.isWrite() == write + perms.isDelete() == delete + perms.isList() == list + perms.isAdd() == add + perms.isCreate() == create + perms.isUpdate() == update + perms.getProcessMessages() == process where: permString || read | write | delete | list | add | create | update | process @@ -652,9 +578,9 @@ class HelperTest extends APISpec { def "AccountSASResourceType toString"() { setup: AccountSASResourceType resourceTypes = new AccountSASResourceType() - .service(service) - .container(container) - .object(object) + .setService(service) + .setContainer(container) + .setObject(object) expect: resourceTypes.toString() == expectedString @@ -673,9 +599,9 @@ class HelperTest extends APISpec { AccountSASResourceType resourceTypes = AccountSASResourceType.parse(resourceTypeString) then: - resourceTypes.service() == service - resourceTypes.container() == container - resourceTypes.object() == object + resourceTypes.isService() == service + resourceTypes.isContainer() == container + resourceTypes.getObject() == object where: resourceTypeString || service | container | object @@ -697,19 +623,19 @@ class HelperTest extends APISpec { def "BlobURLParts"() { setup: BlobURLParts parts = new BlobURLParts() - .scheme("http") - .host("host") - .containerName("container") - .blobName("blob") - .snapshot("snapshot") + .setScheme("http") + .setHost("host") + .setContainerName("container") + .setBlobName("blob") + .setSnapshot("snapshot") - ServiceSASSignatureValues sasValues = new ServiceSASSignatureValues() - .expiryTime(OffsetDateTime.now(ZoneOffset.UTC).plusDays(1)) - .permissions("r") - .canonicalName(String.format("/blob/%s/container/blob", primaryCreds.accountName())) - .resource(Constants.UrlConstants.SAS_BLOB_SNAPSHOT_CONSTANT) + BlobServiceSASSignatureValues sasValues = new BlobServiceSASSignatureValues() + .setExpiryTime(OffsetDateTime.now(ZoneOffset.UTC).plusDays(1)) + .setPermissions("r") + .setCanonicalName(String.format("/blob/%s/container/blob", primaryCredential.getAccountName())) + .setResource(Constants.UrlConstants.SAS_BLOB_SNAPSHOT_CONSTANT) - parts.sasQueryParameters(sasValues.generateSASQueryParameters(primaryCreds)) + parts.setSasQueryParameters(sasValues.generateSASQueryParameters(primaryCredential)) when: String[] splitParts = parts.toURL().toString().split("\\?") @@ -728,14 +654,14 @@ class HelperTest extends APISpec { BlobURLParts parts = URLParser.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.scheme() == "http" - parts.host() == "host" - parts.containerName() == "container" - parts.blobName() == "blob" - parts.snapshot() == "snapshot" - parts.sasQueryParameters().permissions() == "r" - parts.sasQueryParameters().version() == Constants.HeaderConstants.TARGET_STORAGE_VERSION - parts.sasQueryParameters().resource() == "c" - parts.sasQueryParameters().signature() == Utility.urlDecode("Ee%2BSodSXamKSzivSdRTqYGh7AeMVEk3wEoRZ1yzkpSc%3D") + parts.getScheme() == "http" + parts.getHost() == "host" + parts.getContainerName() == "container" + parts.getBlobName() == "blob" + parts.getSnapshot() == "snapshot" + parts.getSasQueryParameters().getPermissions() == "r" + parts.getSasQueryParameters().getVersion() == Constants.HeaderConstants.TARGET_STORAGE_VERSION + parts.getSasQueryParameters().getResource() == "c" + parts.getSasQueryParameters().getSignature() == Utility.urlDecode("Ee%2BSodSXamKSzivSdRTqYGh7AeMVEk3wEoRZ1yzkpSc%3D") } } diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/PageBlobAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/PageBlobAPITest.groovy index 26e8ce24a9a0..2ae025affb0e 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/PageBlobAPITest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/PageBlobAPITest.groovy @@ -4,62 +4,79 @@ package com.azure.storage.blob import com.azure.core.http.rest.Response -import com.azure.storage.blob.models.* +import com.azure.core.exception.UnexpectedLengthException +import com.azure.storage.blob.models.BlobAccessConditions +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 +import com.azure.storage.blob.models.Metadata +import com.azure.storage.blob.models.ModifiedAccessConditions +import com.azure.storage.blob.models.PageBlobAccessConditions +import com.azure.storage.blob.models.PageBlobItem +import com.azure.storage.blob.models.PageRange +import com.azure.storage.blob.models.PublicAccessType +import com.azure.storage.blob.models.SequenceNumberAccessConditions +import com.azure.storage.blob.models.SequenceNumberActionType +import com.azure.storage.blob.models.SourceModifiedAccessConditions +import com.azure.storage.blob.models.StorageException import spock.lang.Unroll import java.security.MessageDigest import java.time.OffsetDateTime class PageBlobAPITest extends APISpec { - PageBlobClient bu + PageBlobClient bc + PageBlobAsyncClient bcAsync def setup() { - bu = cu.getPageBlobClient(generateBlobName()) - bu.create(PageBlobClient.PAGE_BYTES) + def name = generateBlobName() + bc = cc.getPageBlobClient(name) + bcAsync = ccAsync.getPageBlobAsyncClient(name) + bc.setCreate(PageBlobClient.PAGE_BYTES) } def "Create all null"() { setup: - bu = cu.getPageBlobClient(generateBlobName()) + bc = cc.getPageBlobClient(generateBlobName()) when: - Response response = bu.create(PageBlobClient.PAGE_BYTES) + def response = bc.createWithResponse(PageBlobClient.PAGE_BYTES, null, null, null, null, null, null) then: - response.statusCode() == 201 - validateBasicHeaders(response.headers()) - response.value().contentMD5() == null - response.value().isServerEncrypted() + response.getStatusCode() == 201 + validateBasicHeaders(response.getHeaders()) + response.getValue().getContentMD5() == null + response.getValue().isServerEncrypted() } def "Create min"() { expect: - bu.create(PageBlobClient.PAGE_BYTES).statusCode() == 201 + bc.createWithResponse(PageBlobClient.PAGE_BYTES, null, null, null, null, null, null).getStatusCode() == 201 } def "Create sequence number"() { when: - bu.create(PageBlobClient.PAGE_BYTES, 2, null, null, - null, null) + bc.createWithResponse(PageBlobClient.PAGE_BYTES, 2, null, null, null, null, null) then: - Integer.parseInt(bu.getProperties().headers().value("x-ms-blob-sequence-number")) == 2 + bc.getProperties().getBlobSequenceNumber() == 2 } @Unroll def "Create headers"() { setup: - BlobHTTPHeaders headers = new BlobHTTPHeaders().blobCacheControl(cacheControl) - .blobContentDisposition(contentDisposition) - .blobContentEncoding(contentEncoding) - .blobContentLanguage(contentLanguage) - .blobContentMD5(contentMD5) - .blobContentType(contentType) + BlobHTTPHeaders headers = new BlobHTTPHeaders().setBlobCacheControl(cacheControl) + .setBlobContentDisposition(contentDisposition) + .setBlobContentEncoding(contentEncoding) + .setBlobContentLanguage(contentLanguage) + .setBlobContentMD5(contentMD5) + .setBlobContentType(contentType) when: - bu.create(PageBlobClient.PAGE_BYTES, null, headers, null, null, null) + bc.createWithResponse(PageBlobClient.PAGE_BYTES, null, headers, null, null, null, null) - Response response = bu.getProperties(null, null) + def response = bc.getPropertiesWithResponse(null, null, null) // If the value isn't set the service will automatically set it contentType = (contentType == null) ? "application/octet-stream" : contentType @@ -85,13 +102,13 @@ class PageBlobAPITest extends APISpec { } when: - bu.create(PageBlobClient.PAGE_BYTES, null, null, metadata, null, null) + bc.createWithResponse(PageBlobClient.PAGE_BYTES, null, null, metadata, null, null, null) - Response response = bu.getProperties(null, null) + def response = bc.getPropertiesWithResponse(null, null, null) then: - response.statusCode() == 200 - response.value().metadata() == metadata + response.getStatusCode() == 200 + response.getValue().getMetadata() == metadata where: key1 | value1 | key2 | value2 @@ -103,16 +120,16 @@ class PageBlobAPITest extends APISpec { def "Create AC"() { setup: BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(setupBlobMatchCondition(bu, match)) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(setupBlobLeaseCondition(bc, leaseID))) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(setupBlobMatchCondition(bc, match)) + .setIfNoneMatch(noneMatch)) expect: - bu.create(PageBlobClient.PAGE_BYTES, null, null, null, bac, null) - .statusCode() == 201 + + bc.createWithResponse(PageBlobClient.PAGE_BYTES, null, null, null, bac, null, null).getStatusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID @@ -128,15 +145,15 @@ class PageBlobAPITest extends APISpec { def "Create AC fail"() { setup: BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(setupBlobMatchCondition(bu, noneMatch))) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(setupBlobLeaseCondition(bc, leaseID))) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(setupBlobMatchCondition(bc, noneMatch))) when: - bu.create(PageBlobClient.PAGE_BYTES, null, null, null, bac, null) + bc.createWithResponse(PageBlobClient.PAGE_BYTES, null, null, null, bac, null, null) then: thrown(StorageException) @@ -152,8 +169,8 @@ class PageBlobAPITest extends APISpec { def "Create error"() { when: - bu.create(PageBlobClient.PAGE_BYTES, null, null, null, - new BlobAccessConditions().leaseAccessConditions(new LeaseAccessConditions().leaseId("id")), null) + bc.createWithResponse(PageBlobClient.PAGE_BYTES, null, null, null, + new BlobAccessConditions().setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId("id")), null, null) then: thrown(StorageException) @@ -161,57 +178,57 @@ class PageBlobAPITest extends APISpec { def "Upload page"() { when: - Response response = bu.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), - new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) + def response = bc.uploadPagesWithResponse(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1), + new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)), null, null, null) then: - response.statusCode() == 201 - validateBasicHeaders(response.headers()) - response.value().contentMD5() != null - response.value().blobSequenceNumber() == 0 - response.value().isServerEncrypted() + response.getStatusCode() == 201 + validateBasicHeaders(response.getHeaders()) + response.getHeaders().value("x-ms-content-crc64") != null + response.getValue().getBlobSequenceNumber() == 0 + response.getValue().isServerEncrypted() } def "Upload page min"() { expect: - bu.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), - new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))).statusCode() == 201 + bc.uploadPagesWithResponse(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1), + new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)), null, null, null).getStatusCode() == 201 } @Unroll def "Upload page IA"() { when: - bu.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES * 2 - 1), data) + def data = (dataSize == null) ? null : new ByteArrayInputStream(getRandomByteArray(dataSize)) + bc.uploadPages(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES * 2 - 1), data) then: - def e = thrown(Exception) - exceptionType.isInstance(e) + thrown(exceptionType) where: - data | exceptionType - null | NullPointerException - new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)) | IndexOutOfBoundsException - new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES * 3)) | StorageException + dataSize | exceptionType + null | NullPointerException + PageBlobClient.PAGE_BYTES | UnexpectedLengthException + PageBlobClient.PAGE_BYTES * 3 | UnexpectedLengthException } @Unroll def "Upload page AC"() { setup: PageBlobAccessConditions pac = new PageBlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(setupBlobMatchCondition(bu, match)) - .ifNoneMatch(noneMatch)) - .sequenceNumberAccessConditions(new SequenceNumberAccessConditions() - .ifSequenceNumberLessThan(sequenceNumberLT) - .ifSequenceNumberLessThanOrEqualTo(sequenceNumberLTE) - .ifSequenceNumberEqualTo(sequenceNumberEqual)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(setupBlobLeaseCondition(bc, leaseID))) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(setupBlobMatchCondition(bc, match)) + .setIfNoneMatch(noneMatch)) + .setSequenceNumberAccessConditions(new SequenceNumberAccessConditions() + .setIfSequenceNumberLessThan(sequenceNumberLT) + .setIfSequenceNumberLessThanOrEqualTo(sequenceNumberLTE) + .setIfSequenceNumberEqualTo(sequenceNumberEqual)) expect: - bu.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), - new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)), pac, null).statusCode() == 201 + bc.uploadPagesWithResponse(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1), + new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)), pac, null, null).getStatusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID | sequenceNumberLT | sequenceNumberLTE | sequenceNumberEqual @@ -229,23 +246,23 @@ class PageBlobAPITest extends APISpec { @Unroll def "Upload page AC fail"() { setup: - noneMatch = setupBlobMatchCondition(bu, noneMatch) - setupBlobLeaseCondition(bu, leaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + setupBlobLeaseCondition(bc, leaseID) PageBlobAccessConditions pac = new PageBlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) - .sequenceNumberAccessConditions(new SequenceNumberAccessConditions() - .ifSequenceNumberLessThan(sequenceNumberLT) - .ifSequenceNumberLessThanOrEqualTo(sequenceNumberLTE) - .ifSequenceNumberEqualTo(sequenceNumberEqual)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) + .setSequenceNumberAccessConditions(new SequenceNumberAccessConditions() + .setIfSequenceNumberLessThan(sequenceNumberLT) + .setIfSequenceNumberLessThanOrEqualTo(sequenceNumberLTE) + .setIfSequenceNumberEqualTo(sequenceNumberEqual)) when: - bu.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), - new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)), pac, null) + bc.uploadPagesWithResponse(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1), + new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)), pac, null, null) then: thrown(StorageException) @@ -264,13 +281,13 @@ class PageBlobAPITest extends APISpec { def "Upload page error"() { setup: - bu = cu.getPageBlobClient(generateBlobName()) + bc = cc.getPageBlobClient(generateBlobName()) when: - bu.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), + bc.uploadPagesWithResponse(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1), new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)), - new PageBlobAccessConditions().leaseAccessConditions(new LeaseAccessConditions().leaseId("id")), - null) + new PageBlobAccessConditions().setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId("id")), + null, null) then: thrown(StorageException) @@ -278,37 +295,37 @@ class PageBlobAPITest extends APISpec { def "Upload page from URL min"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null) - def destURL = cu.getPageBlobClient(generateBlobName()) - destURL.create(PageBlobClient.PAGE_BYTES) - destURL.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def destURL = cc.getPageBlobClient(generateBlobName()) + destURL.setCreate(PageBlobClient.PAGE_BYTES) + destURL.uploadPages(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1), new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) - def pageRange = new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1) + def pageRange = new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1) when: - Response response = bu.uploadPagesFromURL(pageRange, destURL.getBlobUrl(), null) + Response response = bc.uploadPagesFromURLWithResponse(pageRange, destURL.getBlobUrl(), null, null, null, null, null, null) then: - response.statusCode() == 201 - validateBasicHeaders(response.headers()) + response.getStatusCode() == 201 + validateBasicHeaders(response.getHeaders()) } def "Upload page from URL range"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null, null, null) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) byte[] data = getRandomByteArray(PageBlobClient.PAGE_BYTES * 4) - def sourceURL = cu.getPageBlobClient(generateBlobName()) - sourceURL.create(PageBlobClient.PAGE_BYTES * 4) - sourceURL.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES * 4 - 1), + def sourceURL = cc.getPageBlobClient(generateBlobName()) + sourceURL.setCreate(PageBlobClient.PAGE_BYTES * 4) + sourceURL.uploadPages(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES * 4 - 1), new ByteArrayInputStream(data)) - def destURL = cu.getPageBlobClient(generateBlobName()) - destURL.create(PageBlobClient.PAGE_BYTES * 2) + def destURL = cc.getPageBlobClient(generateBlobName()) + destURL.setCreate(PageBlobClient.PAGE_BYTES * 2) when: - destURL.uploadPagesFromURL(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES * 2 - 1), + destURL.uploadPagesFromURL(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES * 2 - 1), sourceURL.getBlobUrl(), PageBlobClient.PAGE_BYTES * 2) then: @@ -317,31 +334,26 @@ class PageBlobAPITest extends APISpec { outputStream.toByteArray() == Arrays.copyOfRange(data, PageBlobClient.PAGE_BYTES * 2, PageBlobClient.PAGE_BYTES * 4) } - @Unroll def "Upload page from URL IA"() { when: - bu.uploadPagesFromURL(range, bu.getBlobUrl(), sourceOffset) + bc.uploadPagesFromURL(null, bc.getBlobUrl(), (Long) PageBlobClient.PAGE_BYTES) then: thrown(IllegalArgumentException) - - where: - sourceOffset | range - (Long) PageBlobClient.PAGE_BYTES | null } def "Upload page from URL MD5"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null, null, null) - def destURL = cu.getPageBlobClient(generateBlobName()) - destURL.create(PageBlobClient.PAGE_BYTES) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def destURL = cc.getPageBlobClient(generateBlobName()) + destURL.setCreate(PageBlobClient.PAGE_BYTES) def data = getRandomByteArray(PageBlobClient.PAGE_BYTES) - def pageRange = new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1) - bu.uploadPages(pageRange, new ByteArrayInputStream(data)) + def pageRange = new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1) + bc.uploadPages(pageRange, new ByteArrayInputStream(data)) when: - destURL.uploadPagesFromURL(pageRange, bu.getBlobUrl(), null, MessageDigest.getInstance("MD5").digest(data), - null, null, null) + destURL.uploadPagesFromURLWithResponse(pageRange, bc.getBlobUrl(), null, MessageDigest.getInstance("MD5").digest(data), + null, null, null, null) then: notThrown(StorageException) @@ -349,15 +361,15 @@ class PageBlobAPITest extends APISpec { def "Upload page from URL MD5 fail"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null, null, null) - def destURL = cu.getPageBlobClient(generateBlobName()) - destURL.create(PageBlobClient.PAGE_BYTES) - def pageRange = new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1) - bu.uploadPages(pageRange, new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def destURL = cc.getPageBlobClient(generateBlobName()) + destURL.setCreate(PageBlobClient.PAGE_BYTES) + def pageRange = new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1) + bc.uploadPages(pageRange, new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) when: - destURL.uploadPagesFromURL(pageRange, bu.getBlobUrl(), null, - MessageDigest.getInstance("MD5").digest("garbage".getBytes()), null, null, null) + destURL.uploadPagesFromURLWithResponse(pageRange, bc.getBlobUrl(), null, + MessageDigest.getInstance("MD5").digest("garbage".getBytes()), null, null, null, null) then: thrown(StorageException) @@ -366,26 +378,26 @@ class PageBlobAPITest extends APISpec { @Unroll def "Upload page from URL destination AC"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null, null, null) - def sourceURL = cu.getPageBlobClient(generateBlobName()) - sourceURL.create(PageBlobClient.PAGE_BYTES) - def pageRange = new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def sourceURL = cc.getPageBlobClient(generateBlobName()) + sourceURL.setCreate(PageBlobClient.PAGE_BYTES) + def pageRange = new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1) sourceURL.uploadPages(pageRange, new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) def pac = new PageBlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(setupBlobMatchCondition(bu, match)) - .ifNoneMatch(noneMatch)) - .sequenceNumberAccessConditions(new SequenceNumberAccessConditions() - .ifSequenceNumberLessThan(sequenceNumberLT) - .ifSequenceNumberLessThanOrEqualTo(sequenceNumberLTE) - .ifSequenceNumberEqualTo(sequenceNumberEqual)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(setupBlobLeaseCondition(bc, leaseID))) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(setupBlobMatchCondition(bc, match)) + .setIfNoneMatch(noneMatch)) + .setSequenceNumberAccessConditions(new SequenceNumberAccessConditions() + .setIfSequenceNumberLessThan(sequenceNumberLT) + .setIfSequenceNumberLessThanOrEqualTo(sequenceNumberLTE) + .setIfSequenceNumberEqualTo(sequenceNumberEqual)) expect: - bu.uploadPagesFromURL(pageRange, sourceURL.getBlobUrl(), null, null, pac, null, null).statusCode() == 201 + bc.uploadPagesFromURLWithResponse(pageRange, sourceURL.getBlobUrl(), null, null, pac, null, null, null).getStatusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID | sequenceNumberLT | sequenceNumberLTE | sequenceNumberEqual @@ -403,28 +415,28 @@ class PageBlobAPITest extends APISpec { @Unroll def "Upload page from URL destination AC fail"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null, null, null) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) - def sourceURL = cu.getPageBlobClient(generateBlobName()) - sourceURL.create(PageBlobClient.PAGE_BYTES) - def pageRange = new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1) + def sourceURL = cc.getPageBlobClient(generateBlobName()) + sourceURL.setCreate(PageBlobClient.PAGE_BYTES) + def pageRange = new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1) sourceURL.uploadPages(pageRange, new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) - noneMatch = setupBlobMatchCondition(bu, noneMatch) + noneMatch = setupBlobMatchCondition(bc, noneMatch) def pac = new PageBlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) - .sequenceNumberAccessConditions(new SequenceNumberAccessConditions() - .ifSequenceNumberLessThan(sequenceNumberLT) - .ifSequenceNumberLessThanOrEqualTo(sequenceNumberLTE) - .ifSequenceNumberEqualTo(sequenceNumberEqual)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) + .setSequenceNumberAccessConditions(new SequenceNumberAccessConditions() + .setIfSequenceNumberLessThan(sequenceNumberLT) + .setIfSequenceNumberLessThanOrEqualTo(sequenceNumberLTE) + .setIfSequenceNumberEqualTo(sequenceNumberEqual)) when: - bu.uploadPagesFromURL(pageRange, sourceURL.getBlobUrl(), null, null, pac, null, null) + bc.uploadPagesFromURLWithResponse(pageRange, sourceURL.getBlobUrl(), null, null, pac, null, null, null) then: thrown(StorageException) @@ -444,21 +456,21 @@ class PageBlobAPITest extends APISpec { @Unroll def "Upload page from URL source AC"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null, null, null) - def sourceURL = cu.getPageBlobClient(generateBlobName()) - sourceURL.create(PageBlobClient.PAGE_BYTES) - def pageRange = new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def sourceURL = cc.getPageBlobClient(generateBlobName()) + sourceURL.setCreate(PageBlobClient.PAGE_BYTES) + def pageRange = new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1) sourceURL.uploadPages(pageRange, new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) sourceIfMatch = setupBlobMatchCondition(sourceURL, sourceIfMatch) def smac = new SourceModifiedAccessConditions() - .sourceIfModifiedSince(sourceIfModifiedSince) - .sourceIfUnmodifiedSince(sourceIfUnmodifiedSince) - .sourceIfMatch(sourceIfMatch) - .sourceIfNoneMatch(sourceIfNoneMatch) + .setSourceIfModifiedSince(sourceIfModifiedSince) + .setSourceIfUnmodifiedSince(sourceIfUnmodifiedSince) + .setSourceIfMatch(sourceIfMatch) + .setSourceIfNoneMatch(sourceIfNoneMatch) expect: - bu.uploadPagesFromURL(pageRange, sourceURL.getBlobUrl(), null, null, null, smac, null).statusCode() == 201 + bc.uploadPagesFromURLWithResponse(pageRange, sourceURL.getBlobUrl(), null, null, null, smac, null, null).getStatusCode() == 201 where: sourceIfModifiedSince | sourceIfUnmodifiedSince | sourceIfMatch | sourceIfNoneMatch @@ -472,21 +484,20 @@ class PageBlobAPITest extends APISpec { @Unroll def "Upload page from URL source AC fail"() { setup: - cu.setAccessPolicy(PublicAccessType.CONTAINER, null, null, null) - def sourceURL = cu.getPageBlobClient(generateBlobName()) - sourceURL.create(PageBlobClient.PAGE_BYTES) - def pageRange = new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1) + cc.setAccessPolicy(PublicAccessType.CONTAINER, null) + def sourceURL = cc.getPageBlobClient(generateBlobName()) + sourceURL.setCreate(PageBlobClient.PAGE_BYTES) + def pageRange = new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1) sourceURL.uploadPages(pageRange, new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) def smac = new SourceModifiedAccessConditions() - .sourceIfModifiedSince(sourceIfModifiedSince) - .sourceIfUnmodifiedSince(sourceIfUnmodifiedSince) - .sourceIfMatch(sourceIfMatch) - .sourceIfNoneMatch(setupBlobMatchCondition(sourceURL, sourceIfNoneMatch)) + .setSourceIfModifiedSince(sourceIfModifiedSince) + .setSourceIfUnmodifiedSince(sourceIfUnmodifiedSince) + .setSourceIfMatch(sourceIfMatch) + .setSourceIfNoneMatch(setupBlobMatchCondition(sourceURL, sourceIfNoneMatch)) when: - bu.uploadPagesFromURL(pageRange, sourceURL.getBlobUrl(), null, null, null, smac, null) - + bc.uploadPagesFromURLWithResponse(pageRange, sourceURL.getBlobUrl(), null, null, null, smac, null, null) then: thrown(StorageException) @@ -500,46 +511,46 @@ class PageBlobAPITest extends APISpec { def "Clear page"() { setup: - bu.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), - new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)), null, null) + bc.uploadPagesWithResponse(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1), + new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES)), null, null, null) when: - Response response = bu.clearPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1)) + Response response = bc.clearPagesWithResponse(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1), null, null, null) then: - bu.getPageRanges(new BlobRange(0)).value().pageRange().size() == 0 - validateBasicHeaders(response.headers()) - response.value().contentMD5() == null - response.value().blobSequenceNumber() == 0 + bc.getPageRanges(new BlobRange(0)).getPageRange().size() == 0 + validateBasicHeaders(response.getHeaders()) + response.getValue().getContentMD5() == null + response.getValue().getBlobSequenceNumber() == 0 } def "Clear page min"() { expect: - bu.clearPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1)) + bc.clearPages(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1)) } @Unroll def "Clear pages AC"() { setup: - bu.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), + bc.uploadPages(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1), new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) - match = setupBlobMatchCondition(bu, match) - leaseID = setupBlobLeaseCondition(bu, leaseID) + match = setupBlobMatchCondition(bc, match) + leaseID = setupBlobLeaseCondition(bc, leaseID) def pac = new PageBlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) - .sequenceNumberAccessConditions(new SequenceNumberAccessConditions() - .ifSequenceNumberLessThan(sequenceNumberLT) - .ifSequenceNumberLessThanOrEqualTo(sequenceNumberLTE) - .ifSequenceNumberEqualTo(sequenceNumberEqual)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) + .setSequenceNumberAccessConditions(new SequenceNumberAccessConditions() + .setIfSequenceNumberLessThan(sequenceNumberLT) + .setIfSequenceNumberLessThanOrEqualTo(sequenceNumberLTE) + .setIfSequenceNumberEqualTo(sequenceNumberEqual)) expect: - bu.clearPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), pac, null) - .statusCode() == 201 + bc.clearPagesWithResponse(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1), pac, null, null) + .getStatusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID | sequenceNumberLT | sequenceNumberLTE | sequenceNumberEqual @@ -557,25 +568,25 @@ class PageBlobAPITest extends APISpec { @Unroll def "Clear pages AC fail"() { setup: - bu.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), + bc.uploadPages(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1), new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) - noneMatch = setupBlobMatchCondition(bu, noneMatch) - setupBlobLeaseCondition(bu, leaseID) + noneMatch = setupBlobMatchCondition(bc, noneMatch) + setupBlobLeaseCondition(bc, leaseID) def pac = new PageBlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) - .sequenceNumberAccessConditions(new SequenceNumberAccessConditions() - .ifSequenceNumberLessThan(sequenceNumberLT) - .ifSequenceNumberLessThanOrEqualTo(sequenceNumberLTE) - .ifSequenceNumberEqualTo(sequenceNumberEqual)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) + .setSequenceNumberAccessConditions(new SequenceNumberAccessConditions() + .setIfSequenceNumberLessThan(sequenceNumberLT) + .setIfSequenceNumberLessThanOrEqualTo(sequenceNumberLTE) + .setIfSequenceNumberEqualTo(sequenceNumberEqual)) when: - bu.clearPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), pac, null) + bc.clearPagesWithResponse(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1), pac, null, null) then: thrown(StorageException) @@ -594,10 +605,10 @@ class PageBlobAPITest extends APISpec { def "Clear page error"() { setup: - bu = cu.getPageBlobClient(generateBlobName()) + bc = cc.getPageBlobClient(generateBlobName()) when: - bu.clearPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1)) + bc.clearPages(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1)) then: thrown(StorageException) @@ -605,22 +616,22 @@ class PageBlobAPITest extends APISpec { def "Get page ranges"() { setup: - bu.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), + bc.uploadPages(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1), new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) when: - Response response = bu.getPageRanges(new BlobRange(0, PageBlobClient.PAGE_BYTES)) + def response = bc.getPageRangesWithResponse(new BlobRange(0, PageBlobClient.PAGE_BYTES), null, null, null) then: - response.statusCode() == 200 - response.value().pageRange().size() == 1 - validateBasicHeaders(response.headers()) - Integer.parseInt(response.headers().value("x-ms-blob-content-length")) == PageBlobClient.PAGE_BYTES + response.getStatusCode() == 200 + response.getValue().getPageRange().size() == 1 + validateBasicHeaders(response.getHeaders()) + Long.parseLong(response.getHeaders().get("x-ms-blob-content-length").getValue()) == (long) PageBlobClient.PAGE_BYTES } def "Get page ranges min"() { when: - bu.getPageRanges(null) + bc.getPageRanges(null) then: notThrown(StorageException) @@ -629,19 +640,19 @@ class PageBlobAPITest extends APISpec { @Unroll def "Get page ranges AC"() { setup: - match = setupBlobMatchCondition(bu, match) - leaseID = setupBlobLeaseCondition(bu, leaseID) + match = setupBlobMatchCondition(bc, match) + leaseID = setupBlobLeaseCondition(bc, leaseID) BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseID)) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(leaseID)) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch)) when: - bu.getPageRanges(new BlobRange(0, PageBlobClient.PAGE_BYTES), bac, null) + bc.getPageRangesWithResponse(new BlobRange(0, PageBlobClient.PAGE_BYTES), bac, null, null) then: notThrown(StorageException) @@ -660,15 +671,15 @@ class PageBlobAPITest extends APISpec { def "Get page ranges AC fail"() { setup: BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(setupBlobMatchCondition(bu, noneMatch))) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(setupBlobLeaseCondition(bc, leaseID))) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(setupBlobMatchCondition(bc, noneMatch))) when: - bu.getPageRanges(new BlobRange(0, PageBlobClient.PAGE_BYTES), bac, null) + bc.getPageRangesWithResponse(new BlobRange(0, PageBlobClient.PAGE_BYTES), bac, null, null) then: thrown(StorageException) @@ -684,10 +695,10 @@ class PageBlobAPITest extends APISpec { def "Get page ranges error"() { setup: - bu = cu.getPageBlobClient(generateBlobName()) + bc = cc.getPageBlobClient(generateBlobName()) when: - bu.getPageRanges(null) + bc.getPageRanges(null) then: thrown(StorageException) @@ -695,38 +706,38 @@ class PageBlobAPITest extends APISpec { def "Get page ranges diff"() { setup: - bu.create(PageBlobClient.PAGE_BYTES * 2) + bc.setCreate(PageBlobClient.PAGE_BYTES * 2) - bu.uploadPages(new PageRange().start(PageBlobClient.PAGE_BYTES).end(PageBlobClient.PAGE_BYTES * 2 - 1), + bc.uploadPages(new PageRange().setStart(PageBlobClient.PAGE_BYTES).setEnd(PageBlobClient.PAGE_BYTES * 2 - 1), new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) - String snapshot = bu.createSnapshot(null, null, null).value().getSnapshotId() + def snapId = bc.createSnapshot().getSnapshotId() - bu.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), + bc.uploadPages(new PageRange().setStart(0).setEnd(PageBlobClient.PAGE_BYTES - 1), new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) - bu.clearPages(new PageRange().start(PageBlobClient.PAGE_BYTES).end(PageBlobClient.PAGE_BYTES * 2 - 1)) + bc.clearPages(new PageRange().setStart(PageBlobClient.PAGE_BYTES).setEnd(PageBlobClient.PAGE_BYTES * 2 - 1)) when: - Response response = bu.getPageRangesDiff(new BlobRange(0, PageBlobClient.PAGE_BYTES * 2), snapshot) + def response = bc.getPageRangesDiffWithResponse(new BlobRange(0, PageBlobClient.PAGE_BYTES * 2), snapId, null, null, null) then: - response.value().pageRange().size() == 1 - response.value().pageRange().get(0).start() == 0 - response.value().pageRange().get(0).end() == PageBlobClient.PAGE_BYTES - 1 - response.value().clearRange().size() == 1 - response.value().clearRange().get(0).start() == PageBlobClient.PAGE_BYTES - response.value().clearRange().get(0).end() == PageBlobClient.PAGE_BYTES * 2 - 1 - validateBasicHeaders(response.headers()) - Integer.parseInt(response.headers().value("x-ms-blob-content-length")) == PageBlobClient.PAGE_BYTES * 2 + response.getValue().getPageRange().size() == 1 + response.getValue().getPageRange().get(0).getStart() == 0 + response.getValue().getPageRange().get(0).getEnd() == PageBlobClient.PAGE_BYTES - 1 + response.getValue().getClearRange().size() == 1 + response.getValue().getClearRange().get(0).getStart() == PageBlobClient.PAGE_BYTES + response.getValue().getClearRange().get(0).getEnd() == PageBlobClient.PAGE_BYTES * 2 - 1 + validateBasicHeaders(response.getHeaders()) + Integer.parseInt(response.getHeaders().value("x-ms-blob-content-length")) == PageBlobClient.PAGE_BYTES * 2 } def "Get page ranges diff min"() { setup: - String snapshot = bu.createSnapshot().value().getSnapshotId() + def snapId = bc.createSnapshot().getSnapshotId() when: - bu.getPageRangesDiff(null, snapshot).iterator().hasNext() + bc.getPageRangesDiff(null, snapId).iterator().hasNext() then: notThrown(StorageException) @@ -735,17 +746,17 @@ class PageBlobAPITest extends APISpec { @Unroll def "Get page ranges diff AC"() { setup: - String snapshot = bu.createSnapshot().value().getSnapshotId() + def snapId = bc.createSnapshot().getSnapshotId() BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(setupBlobMatchCondition(bu, match)) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(setupBlobLeaseCondition(bc, leaseID))) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(setupBlobMatchCondition(bc, match)) + .setIfNoneMatch(noneMatch)) when: - bu.getPageRangesDiff(new BlobRange(0, PageBlobClient.PAGE_BYTES), snapshot, bac, null) + bc.getPageRangesDiffWithResponse(new BlobRange(0, PageBlobClient.PAGE_BYTES), snapId, bac, null, null) then: notThrown(StorageException) @@ -763,18 +774,18 @@ class PageBlobAPITest extends APISpec { @Unroll def "Get page ranges diff AC fail"() { setup: - String snapshot = bu.createSnapshot().value() + def snapId = bc.createSnapshot().getSnapshotId() BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(setupBlobMatchCondition(bu, noneMatch))) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(setupBlobLeaseCondition(bc, leaseID))) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(setupBlobMatchCondition(bc, noneMatch))) when: - bu.getPageRangesDiff(new BlobRange(0, PageBlobClient.PAGE_BYTES), snapshot, bac, null) + bc.getPageRangesDiffWithResponse(new BlobRange(0, PageBlobClient.PAGE_BYTES), snapId, bac, null, null) then: thrown(StorageException) @@ -790,10 +801,10 @@ class PageBlobAPITest extends APISpec { def "Get page ranges diff error"() { setup: - bu = cu.getPageBlobClient(generateBlobName()) + bc = cc.getPageBlobClient(generateBlobName()) when: - bu.getPageRangesDiff(null, "snapshot") + bc.getPageRangesDiff(null, "snapshot") then: thrown(StorageException) @@ -802,10 +813,10 @@ class PageBlobAPITest extends APISpec { @Unroll def "PageRange IA"() { setup: - def range = new PageRange().start(start).end(end) + def range = new PageRange().setStart(start).setEnd(end) when: - bu.clearPages(range) + bc.clearPages(range) then: thrown(IllegalArgumentException) @@ -822,32 +833,32 @@ class PageBlobAPITest extends APISpec { def "Resize"() { setup: - Response response = bu.resize(PageBlobClient.PAGE_BYTES * 2) + def response = bc.resizeWithResponse(PageBlobClient.PAGE_BYTES * 2, null, null, null) expect: - Integer.parseInt(bu.getProperties().headers().value("Content-Length")) == PageBlobClient.PAGE_BYTES * 2 - validateBasicHeaders(response.headers()) - response.value().blobSequenceNumber() != null + bc.getProperties().getBlobSize() == PageBlobClient.PAGE_BYTES * 2 + validateBasicHeaders(response.getHeaders()) + response.getValue().getBlobSequenceNumber() != null } def "Resize min"() { expect: - bu.resize(PageBlobClient.PAGE_BYTES).statusCode() == 200 + bc.resizeWithResponse(PageBlobClient.PAGE_BYTES, null, null, null).getStatusCode() == 200 } @Unroll def "Resize AC"() { setup: BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(setupBlobMatchCondition(bu, match)) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(setupBlobLeaseCondition(bc, leaseID))) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(setupBlobMatchCondition(bc, match)) + .setIfNoneMatch(noneMatch)) expect: - bu.resize(PageBlobClient.PAGE_BYTES * 2, bac, null).statusCode() == 200 + bc.resizeWithResponse(PageBlobClient.PAGE_BYTES * 2, bac, null, null).getStatusCode() == 200 where: modified | unmodified | match | noneMatch | leaseID @@ -863,15 +874,15 @@ class PageBlobAPITest extends APISpec { def "Resize AC fail"() { setup: BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(setupBlobMatchCondition(bu, noneMatch))) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(setupBlobLeaseCondition(bc, leaseID))) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(setupBlobMatchCondition(bc, noneMatch))) when: - bu.resize(PageBlobClient.PAGE_BYTES * 2, bac, null) + bc.resizeWithResponse(PageBlobClient.PAGE_BYTES * 2, bac, null, null) then: thrown(StorageException) @@ -887,10 +898,10 @@ class PageBlobAPITest extends APISpec { def "Resize error"() { setup: - bu = cu.getPageBlobClient(generateBlobName()) + bc = cc.getPageBlobClient(generateBlobName()) when: - bu.resize(0) + bc.resize(0) then: thrown(StorageException) @@ -899,12 +910,12 @@ class PageBlobAPITest extends APISpec { @Unroll def "Sequence number"() { setup: - Response response = bu.updateSequenceNumber(action, number) + Response response = bc.updateSequenceNumberWithResponse(action, number, null, null, null) expect: - Integer.parseInt(bu.getProperties().headers().value("x-ms-blob-sequence-number")) == result - validateBasicHeaders(response.headers()) - response.value().blobSequenceNumber() == result + bc.getProperties().getBlobSequenceNumber() == result + validateBasicHeaders(response.getHeaders()) + response.getValue().getBlobSequenceNumber() == result where: action | number || result @@ -915,23 +926,23 @@ class PageBlobAPITest extends APISpec { def "Sequence number min"() { expect: - bu.updateSequenceNumber(SequenceNumberActionType.INCREMENT, null).statusCode() == 200 + bc.updateSequenceNumberWithResponse(SequenceNumberActionType.INCREMENT, null, null, null, null).getStatusCode() == 200 } @Unroll def "Sequence number AC"() { setup: BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(setupBlobMatchCondition(bu, match)) - .ifNoneMatch(noneMatch)) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(setupBlobLeaseCondition(bc, leaseID))) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(setupBlobMatchCondition(bc, match)) + .setIfNoneMatch(noneMatch)) expect: - bu.updateSequenceNumber(SequenceNumberActionType.UPDATE, 1, bac, null) - .statusCode() == 200 + bc.updateSequenceNumberWithResponse(SequenceNumberActionType.UPDATE, 1, bac, null, null) + .getStatusCode() == 200 where: modified | unmodified | match | noneMatch | leaseID @@ -947,15 +958,15 @@ class PageBlobAPITest extends APISpec { def "Sequence number AC fail"() { setup: BlobAccessConditions bac = new BlobAccessConditions() - .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) - .modifiedAccessConditions(new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(setupBlobMatchCondition(bu, noneMatch))) + .setLeaseAccessConditions(new LeaseAccessConditions().setLeaseId(setupBlobLeaseCondition(bc, leaseID))) + .setModifiedAccessConditions(new ModifiedAccessConditions() + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(setupBlobMatchCondition(bc, noneMatch))) when: - bu.updateSequenceNumber(SequenceNumberActionType.UPDATE, 1, bac, null) + bc.updateSequenceNumberWithResponse(SequenceNumberActionType.UPDATE, 1, bac, null, null) then: thrown(StorageException) @@ -971,10 +982,10 @@ class PageBlobAPITest extends APISpec { def "Sequence number error"() { setup: - bu = cu.getPageBlobClient(generateBlobName()) + bc = cc.getPageBlobClient(generateBlobName()) when: - bu.updateSequenceNumber(SequenceNumberActionType.UPDATE, 0) + bc.updateSequenceNumber(SequenceNumberActionType.UPDATE, 0) then: thrown(StorageException) @@ -982,72 +993,72 @@ class PageBlobAPITest extends APISpec { def "Start incremental copy"() { setup: - cu.setAccessPolicy(PublicAccessType.BLOB, null) - PageBlobClient bu2 = cu.getPageBlobClient(generateBlobName()) - String snapshot = bu.createSnapshot().value().getSnapshotId() + cc.setAccessPolicy(PublicAccessType.BLOB, null) + def bc2 = cc.getPageBlobClient(generateBlobName()) + def snapId = bc.createSnapshot().getSnapshotId() - Response copyResponse = bu2.copyIncremental(bu.getBlobUrl(), snapshot) - String status = copyResponse.value().toString() + def copyResponse = bc2.copyIncrementalWithResponse(bc.getBlobUrl(), snapId, null, null, null) - OffsetDateTime start = OffsetDateTime.now() - while (status != CopyStatusType.SUCCESS.toString()) { - status = bu2.getProperties().headers().value("x-ms-copy-status") + def status = copyResponse.getValue() + def start = OffsetDateTime.now() + while (status != CopyStatusType.SUCCESS) { + status = bc2.getProperties().getCopyStatus() OffsetDateTime currentTime = OffsetDateTime.now() - if (status == CopyStatusType.FAILED.toString() || currentTime.minusMinutes(1) == start) { + if (status == CopyStatusType.FAILED || currentTime.minusMinutes(1) == start) { throw new Exception("Copy failed or took too long") } - sleep(1000) + sleepIfRecord(1000) } expect: - Response propertiesResponse = bu2.getProperties() - Boolean.parseBoolean(propertiesResponse.headers().value("x-ms-incremental-copy")) - propertiesResponse.headers().value("x-ms-copy-destination-snapshot") != null - validateBasicHeaders(copyResponse.headers()) - copyResponse.headers().value("x-ms-copy-id") != null - copyResponse.value() != null + def properties = bc2.getProperties() + properties.isIncrementalCopy() + properties.getCopyDestinationSnapshot() != null + validateBasicHeaders(copyResponse.getHeaders()) + copyResponse.getHeaders().value("x-ms-copy-id") != null + copyResponse.getValue() != null } def "Start incremental copy min"() { setup: - cu.setAccessPolicy(PublicAccessType.BLOB, null) - PageBlobClient bu2 = cu.getPageBlobClient(generateBlobName()) - String snapshot = bu.createSnapshot().value().getSnapshotId() + cc.setAccessPolicy(PublicAccessType.BLOB, null) + def bc2 = cc.getPageBlobClient(generateBlobName()) + String snapshot = bc.createSnapshot().getSnapshotId() expect: - bu2.copyIncremental(bu.getBlobUrl(), snapshot).statusCode() == 202 + bc2.copyIncrementalWithResponse(bc.getBlobUrl(), snapshot, null, null, null).getStatusCode() == 202 } @Unroll def "Start incremental copy AC"() { setup: - cu.setAccessPolicy(PublicAccessType.BLOB, null) - PageBlobClient bu2 = cu.getPageBlobClient(generateBlobName()) - String snapshot = bu.createSnapshot().value().getSnapshotId() + cc.setAccessPolicy(PublicAccessType.BLOB, null) + PageBlobClient bu2 = cc.getPageBlobClient(generateBlobName()) + String snapshot = bc.createSnapshot().getSnapshotId() - Response copyResponse = bu2.copyIncremental(bu.getBlobUrl(), snapshot) - String status = copyResponse.value().toString() + def copyResponse = bu2.copyIncrementalWithResponse(bc.getBlobUrl(), snapshot, null, null, null) - OffsetDateTime start = OffsetDateTime.now() - while (status != CopyStatusType.SUCCESS.toString()) { - status = bu2.getProperties().headers().value("x-ms-copy-status") + def status = copyResponse.getValue() + def start = OffsetDateTime.now() + while (status != CopyStatusType.SUCCESS) { + status = bu2.getProperties().getCopyStatus() OffsetDateTime currentTime = OffsetDateTime.now() - if (status == CopyStatusType.FAILED.toString() || currentTime.minusMinutes(1) == start) { + if (status == CopyStatusType.FAILED || currentTime.minusMinutes(1) == start) { throw new Exception("Copy failed or took too long") } - sleep(1000) + sleepIfRecord(1000) } - snapshot = bu.createSnapshot().value().getSnapshotId() + snapshot = bc.createSnapshot().getSnapshotId() match = setupBlobMatchCondition(bu2, match) def mac = new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch) expect: - bu2.copyIncremental(bu.getBlobUrl(), snapshot, mac, null).statusCode() == 202 + bu2.copyIncrementalWithResponse(bc.getBlobUrl(), snapshot, mac, null, null).getStatusCode() == 202 where: modified | unmodified | match | noneMatch @@ -1061,20 +1072,20 @@ class PageBlobAPITest extends APISpec { @Unroll def "Start incremental copy AC fail"() { setup: - cu.setAccessPolicy(PublicAccessType.BLOB, null) - PageBlobClient bu2 = cu.getPageBlobClient(generateBlobName()) - String snapshot = bu.createSnapshot().value().getSnapshotId() - bu2.copyIncremental(bu.getBlobUrl(), snapshot) - snapshot = bu.createSnapshot().value().getSnapshotId() + cc.setAccessPolicy(PublicAccessType.BLOB, null) + PageBlobClient bu2 = cc.getPageBlobClient(generateBlobName()) + String snapshot = bc.createSnapshot().getSnapshotId() + bu2.copyIncremental(bc.getBlobUrl(), snapshot) + snapshot = bc.createSnapshot().getSnapshotId() noneMatch = setupBlobMatchCondition(bu2, noneMatch) def mac = new ModifiedAccessConditions() - .ifModifiedSince(modified) - .ifUnmodifiedSince(unmodified) - .ifMatch(match) - .ifNoneMatch(noneMatch) + .setIfModifiedSince(modified) + .setIfUnmodifiedSince(unmodified) + .setIfMatch(match) + .setIfNoneMatch(noneMatch) when: - bu2.copyIncremental(bu.getBlobUrl(), snapshot, mac, null).statusCode() + bu2.copyIncrementalWithResponse(bc.getBlobUrl(), snapshot, mac, null, null) then: thrown(StorageException) @@ -1089,10 +1100,10 @@ class PageBlobAPITest extends APISpec { def "Start incremental copy error"() { setup: - bu = cu.getPageBlobClient(generateBlobName()) + bc = cc.getPageBlobClient(generateBlobName()) when: - bu.copyIncremental(new URL("https://www.error.com"), "snapshot") + bc.copyIncremental(new URL("https://www.error.com"), "snapshot") then: thrown(StorageException) diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ProgressReporterTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ProgressReporterTest.groovy index 773d552ea319..3363d431ca82 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ProgressReporterTest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ProgressReporterTest.groovy @@ -3,9 +3,9 @@ package com.azure.storage.blob -import io.netty.buffer.ByteBuf -import io.netty.buffer.Unpooled + import reactor.core.publisher.Flux +import spock.lang.Requires import java.nio.ByteBuffer import java.util.concurrent.atomic.AtomicLong @@ -32,23 +32,21 @@ class ProgressReporterTest extends APISpec { 2 * mockReceiver.reportProgress(10) 2 * mockReceiver.reportProgress(25) 2 * mockReceiver.reportProgress(30) - 0 * mockReceiver.reportProgress({it > 30}) + 0 * mockReceiver.reportProgress({ it > 30 }) } + @Requires({ APISpec.liveMode() }) def "Report progress sequential network test"() { setup: IProgressReceiver mockReceiver = Mock(IProgressReceiver) ByteBuffer buffer = getRandomData(1 * 1024 * 1024) - Flux data = ProgressReporter.addProgressReporting(Flux.just(buffer), mockReceiver) - .map({ it -> Unpooled.wrappedBuffer(it) }) + Flux data = ProgressReporter.addProgressReporting(Flux.just(buffer), mockReceiver) when: - BlockBlobAsyncClient bu = new BlobClientBuilder() - .endpoint(cu.getContainerUrl().toString()) - .blobName(generateBlobName()) - .credential(primaryCreds) - .buildBlockBlobAsyncClient() + BlockBlobAsyncClient bu = getBlobAsyncClient(primaryCredential, cc.getContainerUrl().toString(), generateBlobName()) + .asBlockBlobAsyncClient() + bu.upload(data, buffer.remaining()).block() then: @@ -102,7 +100,7 @@ class ProgressReporterTest extends APISpec { We should never report more progress than the 60 total (30 from each Flux--Resubscribing is a retry and therefore rewinds). */ - 0 * mockReceiver.reportProgress({it > 60}) + 0 * mockReceiver.reportProgress({ it > 60 }) } // See TransferManagerTest for network tests of the parallel ProgressReporter. 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 a0b3c2d69e84..00b979aab9a7 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 @@ -9,25 +9,25 @@ import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; -import com.azure.core.http.ProxyOptions; +import com.azure.core.exception.UnexpectedLengthException; import com.azure.core.implementation.http.UrlBuilder; import com.azure.storage.common.policy.RequestRetryOptions; import com.azure.storage.common.policy.RequestRetryPolicy; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import reactor.core.Disposable; +import reactor.core.Exceptions; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import java.io.ByteArrayOutputStream; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; +import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.time.Duration; import java.time.OffsetDateTime; import java.time.temporal.ChronoUnit; import java.util.concurrent.TimeoutException; -import java.util.function.Supplier; import static java.lang.StrictMath.pow; @@ -55,7 +55,7 @@ class RequestRetryTestFactory { static final String RETRY_TEST_PRIMARY_HOST = "PrimaryDC"; static final String RETRY_TEST_SECONDARY_HOST = "SecondaryDC"; - static final ByteBuf RETRY_TEST_DEFAULT_DATA = Unpooled.wrappedBuffer("Default data".getBytes()); + static final ByteBuffer RETRY_TEST_DEFAULT_DATA = ByteBuffer.wrap("Default data".getBytes()); private static final String RETRY_TEST_HEADER = "TestHeader"; private static final String RETRY_TEST_QUERY_PARAM = "TestQueryParam"; private static final Mono RETRY_TEST_OK_RESPONSE = Mono.just(new RetryTestResponse(200)); @@ -95,7 +95,7 @@ Mono send(URL url) { .policies(new RequestRetryPolicy(this.options)) .httpClient(new RetryTestClient(this)) .build() - .send(new HttpRequest(HttpMethod.GET, url).body(Flux.just(RETRY_TEST_DEFAULT_DATA))); + .send(new HttpRequest(HttpMethod.GET, url).setBody(Flux.just(RETRY_TEST_DEFAULT_DATA))); } int getTryNumber() { @@ -111,37 +111,37 @@ private static final class RetryTestResponse extends HttpResponse { } @Override - public int statusCode() { + public int getStatusCode() { return this.statusCode; } @Override - public String headerValue(String headerName) { + public String getHeaderValue(String headerName) { return null; } @Override - public HttpHeaders headers() { + public HttpHeaders getHeaders() { return null; } @Override - public Flux body() { + public Flux getBody() { return null; } @Override - public Mono bodyAsByteArray() { + public Mono getBodyAsByteArray() { return null; } @Override - public Mono bodyAsString() { + public Mono getBodyAsString() { return null; } @Override - public Mono bodyAsString(Charset charset) { + public Mono getBodyAsString(Charset charset) { return null; } } @@ -176,7 +176,7 @@ public Mono send(HttpRequest request) { } } - if (!request.url().getHost().equals(expectedHost)) { + if (!request.getUrl().getHost().equals(expectedHost)) { throw new IllegalArgumentException("The host does not match the expected host"); } @@ -184,20 +184,26 @@ public Mono send(HttpRequest request) { This policy will add test headers and query parameters. Ensure they are removed/reset for each retry. The retry policy should be starting with a fresh copy of the request for every try. */ - if (request.headers().value(RETRY_TEST_HEADER) != null) { + if (request.getHeaders().value(RETRY_TEST_HEADER) != null) { throw new IllegalArgumentException("Headers not reset."); } - if ((request.url().getQuery() != null && request.url().getQuery().contains(RETRY_TEST_QUERY_PARAM))) { + if ((request.getUrl().getQuery() != null && request.getUrl().getQuery().contains(RETRY_TEST_QUERY_PARAM))) { throw new IllegalArgumentException("Query params not reset."); } // Subscribe and block until all information is read to prevent a blocking on another thread exception from Reactor. - ByteBuf buf = Unpooled.buffer(); - Disposable disposable = request.body().subscribe(buf::writeBytes); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + Disposable disposable = request.getBody().subscribe(data -> { + try { + outputStream.write(data.array()); + } catch (IOException ex) { + throw Exceptions.propagate(ex); + } + }); while (!disposable.isDisposed()) { System.out.println("Waiting for Flux to finish to prevent blocking on another thread exception"); } - if (RETRY_TEST_DEFAULT_DATA.compareTo(buf) != 0) { + if (RETRY_TEST_DEFAULT_DATA.compareTo(ByteBuffer.wrap(outputStream.toByteArray())) != 0) { throw new IllegalArgumentException(("Body not reset.")); } @@ -205,11 +211,11 @@ public Mono send(HttpRequest request) { Modify the request as policies downstream of the retry policy are likely to do. These must be reset on each try. */ - request.headers().put(RETRY_TEST_HEADER, "testheader"); - UrlBuilder builder = UrlBuilder.parse(request.url()); + request.getHeaders().put(RETRY_TEST_HEADER, "testheader"); + UrlBuilder builder = UrlBuilder.parse(request.getUrl()); builder.setQueryParameter(RETRY_TEST_QUERY_PARAM, "testquery"); try { - request.url(builder.toURL()); + request.setUrl(builder.toURL()); } catch (MalformedURLException e) { throw new IllegalArgumentException("The URL has been mangled"); } @@ -347,21 +353,6 @@ public Mono send(HttpRequest request) { } } - @Override - public HttpClient proxy(Supplier supplier) { - return null; - } - - @Override - public HttpClient wiretap(boolean b) { - return null; - } - - @Override - public HttpClient port(int i) { - return null; - } - /* Calculate the delay in seconds. Round up to ensure we include the maximum value and some offset for the code executing between the original calculation in the retry policy and this check. diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RetryTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RetryTest.groovy index ab5f9aabd872..976a7b3987e3 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RetryTest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RetryTest.groovy @@ -3,11 +3,12 @@ package com.azure.storage.blob - import com.azure.core.http.HttpResponse +import com.azure.core.exception.UnexpectedLengthException import com.azure.storage.common.policy.RequestRetryOptions import com.azure.storage.common.policy.RetryPolicyType import spock.lang.Unroll + // Tests for package-private functionality. class RetryTest extends APISpec { static URL retryTestURL = new URL("https://" + RequestRetryTestFactory.RETRY_TEST_PRIMARY_HOST) @@ -22,7 +23,7 @@ class RetryTest extends APISpec { HttpResponse response = retryTestFactory.send(retryTestURL).block() then: - response.statusCode() == 200 + response.getStatusCode() == 200 retryTestFactory.getTryNumber() == 6 } @@ -34,7 +35,7 @@ class RetryTest extends APISpec { HttpResponse response = retryTestFactory.send(retryTestURL).block() then: - response.statusCode() == 503 + response.getStatusCode() == 503 retryTestFactory.getTryNumber() == retryTestOptions.maxTries() } @@ -46,7 +47,7 @@ class RetryTest extends APISpec { HttpResponse response = retryTestFactory.send(retryTestURL).block() then: - response.statusCode() == 400 + response.getStatusCode() == 400 retryTestFactory.getTryNumber() == 1 } @@ -58,7 +59,7 @@ class RetryTest extends APISpec { HttpResponse response = retryTestFactory.send(retryTestURL).block() then: - response.statusCode() == 400 + response.getStatusCode() == 400 retryTestFactory.getTryNumber() == 2 } @@ -70,7 +71,7 @@ class RetryTest extends APISpec { HttpResponse response = retryTestFactory.send(retryTestURL).block() then: - response.statusCode() == 200 + response.getStatusCode() == 200 retryTestFactory.getTryNumber() == 3 } @@ -82,7 +83,7 @@ class RetryTest extends APISpec { HttpResponse response = retryTestFactory.send(retryTestURL).block() then: - response.statusCode() == 200 + response.getStatusCode() == 200 retryTestFactory.getTryNumber() == 3 } @@ -94,7 +95,7 @@ class RetryTest extends APISpec { HttpResponse response = retryTestFactory.send(retryTestURL).block() then: - response.statusCode() == 200 + response.getStatusCode() == 200 retryTestFactory.getTryNumber() == 6 } @@ -106,7 +107,7 @@ class RetryTest extends APISpec { HttpResponse response = retryTestFactory.send(retryTestURL).block() then: - response.statusCode() == 200 + response.getStatusCode() == 200 retryTestFactory.getTryNumber() == 4 } 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 39f2ce4e5d11..e7a35cce8777 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 @@ -3,17 +3,22 @@ package com.azure.storage.blob -import com.azure.core.http.policy.HttpLogDetailLevel import com.azure.storage.blob.models.AccessPolicy import com.azure.storage.blob.models.BlobRange import com.azure.storage.blob.models.SignedIdentifier +import com.azure.storage.blob.models.StorageException 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.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.SASTokenCredential import com.azure.storage.common.credentials.SharedKeyCredential +import spock.lang.Ignore import spock.lang.Unroll import java.time.LocalDateTime @@ -21,17 +26,6 @@ import java.time.OffsetDateTime import java.time.ZoneOffset class SASTest extends APISpec { - /* - This test is to validate the workaround for the autorest bug that forgets to set the request property on the - response. - */ - def "Request property"() { - when: - def response = cu.delete() - - then: - response.request() != null - } @Unroll def "Blob range"() { @@ -68,12 +62,12 @@ class SASTest extends APISpec { setup: def data = "test".getBytes() def blobName = generateBlobName() - def bu = cu.getBlockBlobClient(blobName) + def bu = cc.getBlockBlobClient(blobName) bu.upload(new ByteArrayInputStream(data), data.length) - def snapshotId = bu.createSnapshot().value().getSnapshotId() + def snapshotId = bu.createSnapshot().getSnapshotId() when: - def snapshotBlob = cu.getBlockBlobClient(blobName, snapshotId) + def snapshotBlob = cc.getBlockBlobClient(blobName, snapshotId) then: snapshotBlob.getSnapshotId() == snapshotId @@ -84,12 +78,12 @@ class SASTest extends APISpec { setup: def data = "test".getBytes() def blobName = generateBlobName() - def bu = cu.getBlockBlobClient(blobName) + def bu = cc.getBlockBlobClient(blobName) bu.upload(new ByteArrayInputStream(data), data.length) - def snapshotId = bu.createSnapshot().value().getSnapshotId() + def snapshotId = bu.createSnapshot().getSnapshotId() when: - def snapshotBlob = cu.getBlockBlobClient(blobName, snapshotId) + def snapshotBlob = cc.getBlockBlobClient(blobName, snapshotId) then: snapshotBlob.isSnapshot() @@ -101,20 +95,20 @@ class SASTest extends APISpec { setup: def data = "test".getBytes() def blobName = generateBlobName() - def bu = cu.getBlockBlobClient(blobName) + def bu = getBlobClient(primaryCredential, cc.getContainerUrl().toString(), blobName).asBlockBlobClient() bu.upload(new ByteArrayInputStream(data), data.length) def permissions = new BlobSASPermission() - .read(true) - .write(true) - .create(true) - .delete(true) - .add(true) - def startTime = OffsetDateTime.now().minusDays(1) - def expiryTime = OffsetDateTime.now().plusDays(1) + .setRead(true) + .setWrite(true) + .setCreate(true) + .setDelete(true) + .setAdd(true) + def startTime = getUTCNow().minusDays(1) + def expiryTime = getUTCNow().plusDays(1) def ipRange = new IPRange() - .ipMin("0.0.0.0") - .ipMax("255.255.255.255") + .setIpMin("0.0.0.0") + .setIpMax("255.255.255.255") def sasProtocol = SASProtocol.HTTPS_HTTP def cacheControl = "cache" def contentDisposition = "disposition" @@ -125,23 +119,18 @@ class SASTest extends APISpec { when: def sas = bu.generateSAS(null, permissions, expiryTime, startTime, null, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType) - def client = new BlobClientBuilder() - .endpoint(cu.getContainerUrl().toString()) - .blobName(blobName) - .credential(SASTokenCredential.fromSASTokenString(sas)) - .httpClient(getHttpClient()) - .buildBlockBlobClient() + def client = getBlobClient(SASTokenCredential.fromSASTokenString(sas), cc.getContainerUrl().toString(), blobName).asBlockBlobClient() def os = new ByteArrayOutputStream() client.download(os) - def properties = client.getProperties().value() + def properties = client.getProperties() then: os.toString() == new String(data) - properties.cacheControl() == "cache" - properties.contentDisposition() == "disposition" - properties.contentEncoding() == "encoding" - properties.contentLanguage() == "language" + properties.getCacheControl() == "cache" + properties.getContentDisposition() == "disposition" + properties.getContentEncoding() == "encoding" + properties.getContentLanguage() == "language" notThrown(StorageException) } @@ -150,23 +139,23 @@ class SASTest extends APISpec { def data = "test".getBytes() def blobName = generateBlobName() - def bu = cu.getBlockBlobClient(blobName) + def bu = getBlobClient(primaryCredential, cc.getContainerUrl().toString(), blobName).asBlockBlobClient() bu.upload(new ByteArrayInputStream(data), data.length) - String snapshotId = bu.createSnapshot().value().getSnapshotId() + String snapshotId = bu.createSnapshot().getSnapshotId() - def snapshotBlob = cu.getBlockBlobClient(blobName, snapshotId) + def snapshotBlob = cc.getBlockBlobClient(blobName, snapshotId) def permissions = new BlobSASPermission() - .read(true) - .write(true) - .create(true) - .delete(true) - .add(true) - def startTime = OffsetDateTime.now().minusDays(1) - def expiryTime = OffsetDateTime.now().plusDays(1) + .setRead(true) + .setWrite(true) + .setCreate(true) + .setDelete(true) + .setAdd(true) + def startTime = getUTCNow().minusDays(1) + def expiryTime = getUTCNow().plusDays(1) def ipRange = new IPRange() - .ipMin("0.0.0.0") - .ipMax("255.255.255.255") + .setIpMin("0.0.0.0") + .setIpMax("255.255.255.255") def sasProtocol = SASProtocol.HTTPS_HTTP def cacheControl = "cache" def contentDisposition = "disposition" @@ -177,62 +166,50 @@ class SASTest extends APISpec { when: def sas = snapshotBlob.generateSAS(null, permissions, expiryTime, startTime, null, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType) - def client = new BlobClientBuilder() - .endpoint(cu.getContainerUrl().toString()) - .blobName(blobName) - .snapshot(snapshotId) - .credential(SASTokenCredential.fromSASTokenString(sas)) - .httpClient(getHttpClient()) - .buildBlockBlobClient() + def client = getBlobClient(SASTokenCredential.fromSASTokenString(sas), cc.getContainerUrl().toString(), blobName, snapshotId).asBlockBlobClient() def os = new ByteArrayOutputStream() client.download(os) - def properties = client.getProperties().value() + def properties = client.getProperties() then: os.toString() == new String(data) - properties.cacheControl() == "cache" - properties.contentDisposition() == "disposition" - properties.contentEncoding() == "encoding" - properties.contentLanguage() == "language" + properties.getCacheControl() == "cache" + properties.getContentDisposition() == "disposition" + properties.getContentEncoding() == "encoding" + properties.getContentLanguage() == "language" } def "serviceSASSignatureValues network test container"() { setup: - SignedIdentifier identifier = new SignedIdentifier() - .id("0000") - .accessPolicy(new AccessPolicy().permission("racwdl") - .expiry(OffsetDateTime.now().plusDays(1))) - cu.setAccessPolicy(null, Arrays.asList(identifier), null, null) + def identifier = new SignedIdentifier() + .setId("0000") + .setAccessPolicy(new AccessPolicy().setPermission("racwdl") + .setExpiry(getUTCNow().plusDays(1))) + cc.setAccessPolicy(null, Arrays.asList(identifier)) // Check containerSASPermissions ContainerSASPermission permissions = new ContainerSASPermission() - .read(true) - .write(true) - .create(true) - .delete(true) - .add(true) + .setRead(true) + .setWrite(true) + .setList(true) + .setCreate(true) + .setDelete(true) + .setAdd(true) + .setList(true) - OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1) + OffsetDateTime expiryTime = getUTCNow().plusDays(1) when: - String sasWithId = cu.generateSAS(identifier.id()) + String sasWithId = cc.generateSAS(identifier.getId()) - ContainerClient client1 = new ContainerClientBuilder() - .endpoint(cu.getContainerUrl().toString()) - .credential(SASTokenCredential.fromSASTokenString(sasWithId)) - .httpClient(getHttpClient()) - .buildClient() + ContainerClient client1 = getContainerClient(SASTokenCredential.fromSASTokenString(sasWithId), cc.getContainerUrl().toString()) client1.listBlobsFlat().iterator().hasNext() - String sasWithPermissions = cu.generateSAS(permissions, expiryTime) + String sasWithPermissions = cc.generateSAS(permissions, expiryTime) - ContainerClient client2 = new ContainerClientBuilder() - .endpoint(cu.getContainerUrl().toString()) - .credential(SASTokenCredential.fromSASTokenString(sasWithPermissions)) - .httpClient(getHttpClient()) - .buildClient() + ContainerClient client2 = getContainerClient(SASTokenCredential.fromSASTokenString(sasWithPermissions), cc.getContainerUrl().toString()) client2.listBlobsFlat().iterator().hasNext() @@ -240,27 +217,28 @@ class SASTest extends APISpec { notThrown(StorageException) } - + /* TODO: Fix user delegation tests to run in CI */ + @Ignore def "serviceSASSignatureValues network test blob user delegation"() { setup: byte[] data = "test".getBytes() String blobName = generateBlobName() - BlockBlobClient bu = cu.getBlockBlobClient(blobName) + BlockBlobClient bu = cc.getBlockBlobClient(blobName) bu.upload(new ByteArrayInputStream(data), data.length) BlobSASPermission permissions = new BlobSASPermission() - .read(true) - .write(true) - .create(true) - .delete(true) - .add(true) + .setRead(true) + .setWrite(true) + .setCreate(true) + .setDelete(true) + .setAdd(true) - OffsetDateTime startTime = OffsetDateTime.now().minusDays(1) - OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1) + OffsetDateTime startTime = getUTCNow().minusDays(1) + OffsetDateTime expiryTime = getUTCNow().plusDays(1) IPRange ipRange = new IPRange() - .ipMin("0.0.0.0") - .ipMax("255.255.255.255") + .setIpMin("0.0.0.0") + .setIpMax("255.255.255.255") SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP String cacheControl = "cache" @@ -269,53 +247,113 @@ class SASTest extends APISpec { String contentLanguage = "language" String contentType = "type" - UserDelegationKey key = getOAuthServiceURL().getUserDelegationKey(null, OffsetDateTime.now().plusDays(1)).value() + UserDelegationKey key = getOAuthServiceClient().getUserDelegationKey(null, expiryTime) when: - String sas = bu.generateUserDelegationSAS(key, primaryCreds.accountName(), permissions, expiryTime, startTime, null, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType) + String sas = bu.generateUserDelegationSAS(key, primaryCredential.getAccountName(), permissions, expiryTime, startTime, key.getSignedVersion(), sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType) - BlockBlobClient client = new BlobClientBuilder() - .endpoint(cu.getContainerUrl().toString()) - .blobName(blobName) - .credential(SASTokenCredential.fromSASTokenString(sas)) - .httpClient(getHttpClient()) - .buildBlockBlobClient() + then: + sas != null + + when: + BlockBlobClient client = getBlobClient(SASTokenCredential.fromSASTokenString(sas), cc.getContainerUrl().toString(), blobName).asBlockBlobClient() OutputStream os = new ByteArrayOutputStream() client.download(os) - BlobProperties properties = client.getProperties().value() + BlobProperties properties = client.getProperties() then: os.toString() == new String(data) - properties.cacheControl() == "cache" - properties.contentDisposition() == "disposition" - properties.contentEncoding() == "encoding" - properties.contentLanguage() == "language" + properties.getCacheControl() == "cache" + properties.getContentDisposition() == "disposition" + properties.getContentEncoding() == "encoding" + properties.getContentLanguage() == "language" + notThrown(StorageException) + } + + def "BlobServiceSAS network test blob snapshot"() { + setup: + String containerName = generateContainerName() + String blobName = generateBlobName() + ContainerClient containerClient = primaryBlobServiceClient.createContainer(containerName) + BlockBlobClient blobClient = containerClient.getBlockBlobClient(blobName) + blobClient.upload(defaultInputStream.get(), defaultDataSize) // need something to snapshot + BlockBlobClient snapshotBlob = blobClient.createSnapshot().asBlockBlobClient() + String snapshotId = snapshotBlob.getSnapshotId() + + BlobSASPermission permissions = new BlobSASPermission() + .setRead(true) + .setWrite(true) + .setCreate(true) + .setDelete(true) + .setAdd(true) + OffsetDateTime startTime = getUTCNow().minusDays(1) + OffsetDateTime expiryTime = getUTCNow().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" + + when: + String sas = snapshotBlob.generateSAS(null, permissions, expiryTime, startTime, null, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType) + + and: + AppendBlobClient client = getBlobClient(SASTokenCredential.fromSASTokenString(sas), containerClient.getContainerUrl().toString(), blobName).asAppendBlobClient() + + client.download(new ByteArrayOutputStream()) + + then: + thrown(StorageException) + + when: + AppendBlobClient snapClient = getBlobClient(SASTokenCredential.fromSASTokenString(sas), containerClient.getContainerUrl().toString(), blobName, snapshotId).asAppendBlobClient() + + ByteArrayOutputStream data = new ByteArrayOutputStream() + snapClient.download(data) + + then: notThrown(StorageException) + data.toByteArray() == defaultData.array() + + and: + BlobProperties properties = snapClient.getProperties() + + then: + properties.getCacheControl() == "cache" + properties.getContentDisposition() == "disposition" + properties.getContentEncoding() == "encoding" + properties.getContentLanguage() == "language" + } + @Ignore def "serviceSASSignatureValues network test blob snapshot user delegation"() { setup: byte[] data = "test".getBytes() String blobName = generateBlobName() - BlockBlobClient bu = cu.getBlockBlobClient(blobName) + BlockBlobClient bu = cc.getBlockBlobClient(blobName) bu.upload(new ByteArrayInputStream(data), data.length) - BlockBlobClient snapshotBlob = bu.createSnapshot().value().asBlockBlobClient() + BlockBlobClient snapshotBlob = bu.createSnapshot().asBlockBlobClient() String snapshotId = snapshotBlob.getSnapshotId() BlobSASPermission permissions = new BlobSASPermission() - .read(true) - .write(true) - .create(true) - .delete(true) - .add(true) + .setRead(true) + .setWrite(true) + .setCreate(true) + .setDelete(true) + .setAdd(true) - OffsetDateTime startTime = OffsetDateTime.now().minusDays(1) - OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1) + OffsetDateTime startTime = getUTCNow().minusDays(1) + OffsetDateTime expiryTime = getUTCNow().plusDays(1) IPRange ipRange = new IPRange() - .ipMin("0.0.0.0") - .ipMax("255.255.255.255") + .setIpMin("0.0.0.0") + .setIpMax("255.255.255.255") SASProtocol sasProtocol = SASProtocol.HTTPS_HTTP String cacheControl = "cache" @@ -324,20 +362,13 @@ class SASTest extends APISpec { String contentLanguage = "language" String contentType = "type" - UserDelegationKey key = getOAuthServiceURL().getUserDelegationKey(startTime, expiryTime).value() + UserDelegationKey key = getOAuthServiceClient().getUserDelegationKey(startTime, expiryTime) when: - - String sas = snapshotBlob.generateUserDelegationSAS(key, primaryCreds.accountName(), permissions, expiryTime, startTime, null, sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType) + String sas = snapshotBlob.generateUserDelegationSAS(key, primaryCredential.getAccountName(), permissions, expiryTime, startTime, key.getSignedVersion(), sasProtocol, ipRange, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType) // base blob with snapshot SAS - BlockBlobClient client1 = new BlobClientBuilder() - .endpoint(cu.getContainerUrl().toString()) - .blobName(blobName) - .credential(SASTokenCredential.fromSASTokenString(sas)) - .httpClient(getHttpClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildBlockBlobClient() + BlockBlobClient client1 = getBlobClient(SASTokenCredential.fromSASTokenString(sas), cc.getContainerUrl().toString(), blobName).asBlockBlobClient() client1.download(new ByteArrayOutputStream()) then: @@ -346,15 +377,7 @@ class SASTest extends APISpec { when: // blob snapshot with snapshot SAS - BlockBlobClient client2 = new BlobClientBuilder() - .endpoint(cu.getContainerUrl().toString()) - .blobName(blobName) - .snapshot(snapshotId) - .credential(SASTokenCredential.fromSASTokenString(sas)) - .httpClient(getHttpClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildBlockBlobClient() - + BlockBlobClient client2 = getBlobClient(SASTokenCredential.fromSASTokenString(sas), cc.getContainerUrl().toString(), blobName, snapshotId).asBlockBlobClient() OutputStream os = new ByteArrayOutputStream() client2.download(os) @@ -363,38 +386,34 @@ class SASTest extends APISpec { os.toString() == new String(data) and: - def properties = client2.getProperties().value() + def properties = client2.getProperties() then: - properties.cacheControl() == "cache" - properties.contentDisposition() == "disposition" - properties.contentEncoding() == "encoding" - properties.contentLanguage() == "language" + properties.getCacheControl() == "cache" + properties.getContentDisposition() == "disposition" + properties.getContentEncoding() == "encoding" + properties.getContentLanguage() == "language" } + @Ignore def "serviceSASSignatureValues network test container user delegation"() { setup: ContainerSASPermission permissions = new ContainerSASPermission() - .read(true) - .write(true) - .create(true) - .delete(true) - .add(true) + .setRead(true) + .setWrite(true) + .setCreate(true) + .setDelete(true) + .setAdd(true) + .setList(true) - OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1) + OffsetDateTime expiryTime = getUTCNow().plusDays(1) - UserDelegationKey key = getOAuthServiceURL().getUserDelegationKey(null, OffsetDateTime.now().plusDays(1)).value() + UserDelegationKey key = getOAuthServiceClient().getUserDelegationKey(null, expiryTime) when: + String sasWithPermissions = cc.generateUserDelegationSAS(key, primaryCredential.getAccountName(), permissions, expiryTime) - String sasWithPermissions = cu.generateUserDelegationSAS(key, primaryCreds.accountName(), permissions, expiryTime) - - ContainerClient client = new ContainerClientBuilder() - .endpoint(cu.getContainerUrl().toString()) - .credential(SASTokenCredential.fromSASTokenString(sasWithPermissions)) - .httpClient(getHttpClient()) - .buildClient() - + ContainerClient client = getContainerClient(SASTokenCredential.fromSASTokenString(sasWithPermissions), cc.getContainerUrl().toString()) client.listBlobsFlat().iterator().hasNext() then: @@ -405,29 +424,23 @@ class SASTest extends APISpec { setup: def data = "test".getBytes() def blobName = generateBlobName() - def bu = cu.getBlockBlobClient(blobName) + def bu = cc.getBlockBlobClient(blobName) bu.upload(new ByteArrayInputStream(data), data.length) def service = new AccountSASService() - .blob(true) + .setBlob(true) def resourceType = new AccountSASResourceType() - .container(true) - .service(true) - .object(true) + .setContainer(true) + .setService(true) + .setObject(true) def permissions = new AccountSASPermission() - .read(true) - def expiryTime = OffsetDateTime.now().plusDays(1) + .setRead(true) + def expiryTime = getUTCNow().plusDays(1) when: - def sas = primaryServiceURL.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null) - - def client = new BlobClientBuilder() - .endpoint(cu.getContainerUrl().toString()) - .blobName(blobName) - .credential(SASTokenCredential.fromSASTokenString(sas)) - .httpClient(getHttpClient()) - .buildBlockBlobClient() + def sas = primaryBlobServiceClient.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null) + def client = getBlobClient(SASTokenCredential.fromSASTokenString(sas), cc.getContainerUrl().toString(), blobName).asBlockBlobClient() def os = new ByteArrayOutputStream() client.download(os) @@ -439,28 +452,23 @@ class SASTest extends APISpec { setup: def data = "test".getBytes() def blobName = generateBlobName() - def bu = cu.getBlockBlobClient(blobName) + def bu = cc.getBlockBlobClient(blobName) bu.upload(new ByteArrayInputStream(data), data.length) def service = new AccountSASService() - .blob(true) + .setBlob(true) def resourceType = new AccountSASResourceType() - .container(true) - .service(true) - .object(true) + .setContainer(true) + .setService(true) + .setObject(true) def permissions = new AccountSASPermission() - .read(true) - def expiryTime = OffsetDateTime.now().plusDays(1) + .setRead(true) + def expiryTime = getUTCNow().plusDays(1) when: - def sas = primaryServiceURL.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null) - - def client = new BlobClientBuilder() - .endpoint(cu.getContainerUrl().toString()) - .blobName(blobName) - .credential(SASTokenCredential.fromSASTokenString(sas)) - .httpClient(getHttpClient()) - .buildBlockBlobClient() + def sas = primaryBlobServiceClient.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null) + + def client = getBlobClient(SASTokenCredential.fromSASTokenString(sas), cc.getContainerUrl().toString(), blobName).asBlockBlobClient() client.delete() then: @@ -470,25 +478,21 @@ class SASTest extends APISpec { def "accountSAS network create container fails"() { setup: def service = new AccountSASService() - .blob(true) + .setBlob(true) def resourceType = new AccountSASResourceType() - .container(true) - .service(true) - .object(true) + .setContainer(true) + .setService(true) + .setObject(true) def permissions = new AccountSASPermission() - .read(true) - .create(false) - def expiryTime = OffsetDateTime.now().plusDays(1) + .setRead(true) + .setCreate(false) + def expiryTime = getUTCNow().plusDays(1) when: - def sas = primaryServiceURL.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null) + def sas = primaryBlobServiceClient.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null) - def scBuilder = new BlobServiceClientBuilder() - scBuilder.endpoint(primaryServiceURL.getAccountUrl().toString()) - .httpClient(getHttpClient()) - .credential(SASTokenCredential.fromSASTokenString(sas)) - def sc = scBuilder.buildClient() - sc.createContainer("container") + def sc = getServiceClient(SASTokenCredential.fromSASTokenString(sas), primaryBlobServiceClient.getAccountUrl().toString()) + sc.createContainer(generateContainerName()) then: thrown(StorageException) @@ -497,25 +501,21 @@ class SASTest extends APISpec { def "accountSAS network create container succeeds"() { setup: def service = new AccountSASService() - .blob(true) + .setBlob(true) def resourceType = new AccountSASResourceType() - .container(true) - .service(true) - .object(true) + .setContainer(true) + .setService(true) + .setObject(true) def permissions = new AccountSASPermission() - .read(true) - .create(true) - def expiryTime = OffsetDateTime.now().plusDays(1) + .setRead(true) + .setCreate(true) + def expiryTime = getUTCNow().plusDays(1) when: - def sas = primaryServiceURL.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null) + def sas = primaryBlobServiceClient.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null) - def scBuilder = new BlobServiceClientBuilder() - scBuilder.endpoint(primaryServiceURL.getAccountUrl().toString()) - .httpClient(getHttpClient()) - .credential(SASTokenCredential.fromSASTokenString(sas)) - def sc = scBuilder.buildClient() - sc.createContainer("container") + def sc = getServiceClient(SASTokenCredential.fromSASTokenString(sas), primaryBlobServiceClient.getAccountUrl().toString()) + sc.createContainer(generateContainerName()) then: notThrown(StorageException) @@ -530,33 +530,34 @@ class SASTest extends APISpec { @Unroll def "serviceSasSignatures string to sign"() { when: - def v = new ServiceSASSignatureValues() + BlobServiceSASSignatureValues v = new BlobServiceSASSignatureValues() def p = new BlobSASPermission() - p.read(true) - v.permissions(p.toString()) + p.setRead(true) + v.setPermissions(p.toString()) - v.startTime(startTime) + v.setStartTime(startTime) def e = OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC) - v.expiryTime(e) + v.setExpiryTime(e) - v.canonicalName("containerName/blobName") - .snapshotId(snapId) + v.setCanonicalName("containerName/blobName") + .setSnapshotId(snapId) if (ipRange != null) { def ipR = new IPRange() - ipR.ipMin("ip") - v.ipRange(ipR) + ipR.setIpMin("ip") + v.setIpRange(ipR) } - v.identifier(identifier) - .protocol(protocol) - .cacheControl(cacheControl) - .contentDisposition(disposition) - .contentEncoding(encoding) - .contentLanguage(language) - .contentType(type) - - def token = v.generateSASQueryParameters(primaryCreds) + v.setIdentifier(identifier) + .setProtocol(protocol) + .setCacheControl(cacheControl) + .setContentDisposition(disposition) + .setContentEncoding(encoding) + .setContentLanguage(language) + .setContentType(type) + v.setResource("bs") + + def token = v.generateSASQueryParameters(primaryCredential) then: - token.signature() == primaryCreds.computeHmac256(expectedStringToSign) + token.getSignature() == primaryCredential.computeHmac256(expectedStringToSign) /* We don't test the blob or containerName properties because canonicalized resource is always added as at least @@ -566,99 +567,99 @@ 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 + "\n\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 + "\n\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 + "\n\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 + "\n\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 + "\n\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 + "\n\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 + "\n\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 + "\n\n\n\n\nencoding\n\n" - null | null | null | null | null | null | null | null | "language" | 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 + "\n\n\n\n\n\nlanguage\n" - null | null | null | null | null | null | null | null | null | "type" || "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 + "\n\n\n\n\n\n\ntype" + 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 | 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" + null | null | null | null | null | null | null | null | "language" | 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\n\nlanguage\n" + null | null | null | null | null | null | null | null | null | "type" || "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\n\n\ntype" } @Unroll def "serviceSasSignatures string to sign user delegation key"() { when: - def v = new ServiceSASSignatureValues() + def v = new BlobServiceSASSignatureValues() def p = new BlobSASPermission() - p.read(true) - v.permissions(p.toString()) + p.setRead(true) + v.setPermissions(p.toString()) - v.startTime(startTime) + v.setStartTime(startTime) def e = OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC) - v.expiryTime(e) + v.setExpiryTime(e) - v.canonicalName("containerName/blobName") - .snapshotId(snapId) + v.setCanonicalName("containerName/blobName") + .setSnapshotId(snapId) if (ipRange != null) { def ipR = new IPRange() - ipR.ipMin("ip") - v.ipRange(ipR) + ipR.setIpMin("ip") + v.setIpRange(ipR) } - v.protocol(protocol) - .cacheControl(cacheControl) - .contentDisposition(disposition) - .contentEncoding(encoding) - .contentLanguage(language) - .contentType(type) + v.setProtocol(protocol) + .setCacheControl(cacheControl) + .setContentDisposition(disposition) + .setContentEncoding(encoding) + .setContentLanguage(language) + .setContentType(type) + v.setResource("bs") def key = new UserDelegationKey() - .signedOid(keyOid) - .signedTid(keyTid) - .signedStart(keyStart) - .signedExpiry(keyExpiry) - .signedService(keyService) - .signedVersion(keyVersion) - .value(keyValue) + .setSignedOid(keyOid) + .setSignedTid(keyTid) + .setSignedStart(keyStart) + .setSignedExpiry(keyExpiry) + .setSignedService(keyService) + .setSignedVersion(keyVersion) + .setValue(keyValue) def token = v.generateSASQueryParameters(key) then: - token.signature() == Utility.computeHMac256(key.value(), expectedStringToSign) + token.getSignature() == Utility.computeHMac256(key.getValue(), expectedStringToSign) /* We test string to sign functionality directly related to user delegation sas specific parameters */ where: startTime | keyOid | keyTid | keyStart | keyExpiry | keyService | keyVersion | keyValue | ipRange | protocol | snapId | cacheControl | disposition | encoding | language | type || expectedStringToSign - OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC) | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "r\n" + 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\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\n\n\n\n\n\n\n" - null | "11111111-1111-1111-1111-111111111111" | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "r\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n11111111-1111-1111-1111-111111111111\n\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\n\n\n\n\n\n\n" - null | null | "22222222-2222-2222-2222-222222222222" | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "r\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n\n22222222-2222-2222-2222-222222222222\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\n\n\n\n\n\n\n" - null | null | null | OffsetDateTime.of(LocalDateTime.of(2018, 1, 1, 0, 0), ZoneOffset.UTC) | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "r\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n\n\n2018-01-01T00:00:00Z\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\n\n\n\n\n\n\n" - null | null | null | null | OffsetDateTime.of(LocalDateTime.of(2018, 1, 1, 0, 0), ZoneOffset.UTC) | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "r\n\n" + 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 + "\n\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 + "\n\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 + "\n\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 + "\n\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 + "\n\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 + "\n\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 + "\n\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 + "\n\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 + "\n\n\n\n\nencoding\n\n" - null | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | "language" | null || "r\n\n" + 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 + "\n\n\n\n\n\nlanguage\n" - null | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | "type" || "r\n\n" + 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 + "\n\n\n\n\n\n\ntype" + OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC) | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "r\n" + 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\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\n\n\n\n\n\n" + null | "11111111-1111-1111-1111-111111111111" | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "r\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n11111111-1111-1111-1111-111111111111\n\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\n\n\n\n\n\n" + null | null | "22222222-2222-2222-2222-222222222222" | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "r\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n\n22222222-2222-2222-2222-222222222222\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\n\n\n\n\n\n" + null | null | null | OffsetDateTime.of(LocalDateTime.of(2018, 1, 1, 0, 0), ZoneOffset.UTC) | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "r\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\ncontainerName/blobName\n\n\n2018-01-01T00:00:00Z\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\n\n\n\n\n\n" + null | null | null | null | OffsetDateTime.of(LocalDateTime.of(2018, 1, 1, 0, 0), ZoneOffset.UTC) | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "r\n\n" + 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=" | 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" + null | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | "language" | 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\n\nlanguage\n" + null | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | "type" || "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\n\n\ntype" } - @Unroll def "serviceSASSignatureValues canonicalizedResource"() { setup: def blobName = generateBlobName() def accountName = "account" - def bu = cu.getBlockBlobClient(blobName) + def bu = cc.getBlockBlobClient(blobName) when: - def serviceSASSignatureValues = bu.blockBlobAsyncClient.configureServiceSASSignatureValues(new ServiceSASSignatureValues(), accountName) + def serviceSASSignatureValues = bu.blockBlobAsyncClient.configureServiceSASSignatureValues(new BlobServiceSASSignatureValues(), accountName) then: - serviceSASSignatureValues.canonicalName() == "/blob/" + accountName + cu.containerUrl.path + "/" + blobName + serviceSASSignatureValues.getCanonicalName() == "/blob/" + accountName + cc.containerUrl.path + "/" + blobName } @Unroll def "serviceSasSignatureValues IA"() { setup: - def v = new ServiceSASSignatureValues() - .snapshotId("2018-01-01T00:00:00.0000000Z") - .version(version) + def v = new BlobServiceSASSignatureValues() + .setSnapshotId("2018-01-01T00:00:00.0000000Z") + .setVersion(version) when: v.generateSASQueryParameters((SharedKeyCredential) creds) @@ -668,20 +669,20 @@ class SASTest extends APISpec { e.getMessage().contains(parameter) where: - version | creds || parameter - null | primaryCreds | "version" - "v" | null | "sharedKeyCredentials" + version | creds || parameter + null | primaryCredential || "version" + "v" | null || "sharedKeyCredentials" } @Unroll def "BlobSASPermissions toString"() { setup: def perms = new BlobSASPermission() - .read(read) - .write(write) - .delete(delete) - .create(create) - .add(add) + .setRead(read) + .setWrite(write) + .setDelete(delete) + .setCreate(create) + .setAdd(add) expect: perms.toString() == expectedString @@ -702,11 +703,11 @@ class SASTest extends APISpec { def perms = BlobSASPermission.parse(permString) then: - perms.read() == read - perms.write() == write - perms.delete() == delete - perms.create() == create - perms.add() == add + perms.getRead() == read + perms.getWrite() == write + perms.getDelete() == delete + perms.getCreate() == create + perms.getAdd() == add where: permString || read | write | delete | create | add @@ -731,12 +732,12 @@ class SASTest extends APISpec { def "ContainerSASPermissions toString"() { setup: def perms = new ContainerSASPermission() - .read(read) - .write(write) - .delete(delete) - .create(create) - .add(add) - .list(list) + .setRead(read) + .setWrite(write) + .setDelete(delete) + .setCreate(create) + .setAdd(add) + .setList(list) expect: perms.toString() == expectedString @@ -758,12 +759,12 @@ class SASTest extends APISpec { def perms = ContainerSASPermission.parse(permString) then: - perms.read() == read - perms.write() == write - perms.delete() == delete - perms.create() == create - perms.add() == add - perms.list() == list + perms.getRead() == read + perms.getWrite() == write + perms.getDelete() == delete + perms.getCreate() == create + perms.getAdd() == add + perms.getList() == list where: permString || read | write | delete | create | add | list @@ -789,8 +790,8 @@ class SASTest extends APISpec { def "IPRange toString"() { setup: def ip = new IPRange() - .ipMin(min) - .ipMax(max) + .setIpMin(min) + .setIpMax(max) expect: ip.toString() == expectedString @@ -808,8 +809,8 @@ class SASTest extends APISpec { def ip = IPRange.parse(rangeStr) then: - ip.ipMin() == min - ip.ipMax() == max + ip.getIpMin() == min + ip.getIpMax() == max where: rangeStr || min | max @@ -832,14 +833,14 @@ class SASTest extends APISpec { @Unroll def "ServiceSASSignatureValues assertGenerateOk"() { when: - def serviceSASSignatureValues = new ServiceSASSignatureValues() - serviceSASSignatureValues.version(version) - serviceSASSignatureValues.canonicalName(canonicalName) - serviceSASSignatureValues.expiryTime(expiryTime) - serviceSASSignatureValues.permissions(permissions) - serviceSASSignatureValues.identifier(identifier) - serviceSASSignatureValues.resource(resource) - serviceSASSignatureValues.snapshotId(snapshotId) + BlobServiceSASSignatureValues serviceSASSignatureValues = new BlobServiceSASSignatureValues() + serviceSASSignatureValues.setVersion(version) + serviceSASSignatureValues.setCanonicalName(canonicalName) + serviceSASSignatureValues.setExpiryTime(expiryTime) + serviceSASSignatureValues.setPermissions(permissions) + serviceSASSignatureValues.setIdentifier(identifier) + serviceSASSignatureValues.setResource(resource) + serviceSASSignatureValues.setSnapshotId(snapshotId) if (usingUserDelegation) { serviceSASSignatureValues.generateSASQueryParameters(new UserDelegationKey()) @@ -853,14 +854,15 @@ class SASTest extends APISpec { 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().read(true).toString() | null | null | null - false | null | null | null | null | "0000" | "c" | "id" + 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().setRead(true).toString() | 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 @@ -872,23 +874,23 @@ class SASTest extends APISpec { when: def v = new AccountSASSignatureValues() def p = new AccountSASPermission() - .read(true) - v.permissions(p.toString()) - .services("b") - .resourceTypes("o") - .startTime(startTime) - .expiryTime(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + .setRead(true) + v.setPermissions(p.toString()) + .setServices("b") + .setResourceTypes("o") + .setStartTime(startTime) + .setExpiryTime(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) if (ipRange != null) { def ipR = new IPRange() - ipR.ipMin("ip") - v.ipRange(ipR) + ipR.setIpMin("ip") + v.setIpRange(ipR) } - v.protocol(protocol) + v.setProtocol(protocol) - def token = v.generateSASQueryParameters(primaryCreds) + def token = v.generateSASQueryParameters(primaryCredential) then: - token.signature() == primaryCreds.computeHmac256(String.format(expectedStringToSign, primaryCreds.accountName())) + token.getSignature() == primaryCredential.computeHmac256(String.format(expectedStringToSign, primaryCredential.getAccountName())) where: startTime | ipRange | protocol || expectedStringToSign @@ -901,11 +903,11 @@ class SASTest extends APISpec { def "accountSasSignatureValues IA"() { setup: def v = new AccountSASSignatureValues() - .permissions(permissions) - .services(service) - .resourceTypes(resourceType) - .expiryTime(expiryTime) - .version(version) + .setPermissions(permissions) + .setServices(service) + .setResourceTypes(resourceType) + .setExpiryTime(expiryTime) + .setVersion(version) when: v.generateSASQueryParameters(creds) @@ -915,27 +917,27 @@ class SASTest extends APISpec { e.getMessage().contains(parameter) where: - permissions | service | resourceType | expiryTime | version | creds || parameter - null | "b" | "c" | OffsetDateTime.now() | "v" | primaryCreds || "permissions" - "c" | null | "c" | OffsetDateTime.now() | "v" | primaryCreds || "services" - "c" | "b" | null | OffsetDateTime.now() | "v" | primaryCreds || "resourceTypes" - "c" | "b" | "c" | null | "v" | primaryCreds || "expiryTime" - "c" | "b" | "c" | OffsetDateTime.now() | null | primaryCreds || "version" - "c" | "b" | "c" | OffsetDateTime.now() | "v" | null || "SharedKeyCredential" + permissions | service | resourceType | expiryTime | version | creds || parameter + null | "b" | "c" | OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC) | "v" | primaryCredential || "permissions" + "c" | null | "c" | OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC) | "v" | primaryCredential || "services" + "c" | "b" | null | OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC) | "v" | primaryCredential || "resourceTypes" + "c" | "b" | "c" | null | "v" | primaryCredential || "expiryTime" + "c" | "b" | "c" | OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC) | null | primaryCredential || "version" + "c" | "b" | "c" | OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC) | "v" | null || "SharedKeyCredential" } @Unroll def "AccountSASPermissions toString"() { setup: def perms = new AccountSASPermission() - perms.read(read) - .write(write) - .delete(delete) - .list(list) - .add(add) - .create(create) - .update(update) - .processMessages(process) + perms.setRead(read) + .setWrite(write) + .setDelete(delete) + .setList(list) + .setAdd(add) + .setCreate(create) + .setUpdate(update) + .setProcessMessages(process) expect: perms.toString() == expectedString @@ -959,14 +961,14 @@ class SASTest extends APISpec { def perms = AccountSASPermission.parse(permString) then: - perms.read() == read - perms.write() == write - perms.delete() == delete - perms.list() == list - perms.add() == add - perms.create() == create - perms.update() == update - perms.processMessages() == process + perms.isRead() == read + perms.isWrite() == write + perms.isDelete() == delete + perms.isList() == list + perms.isAdd() == add + perms.isCreate() == create + perms.isUpdate() == update + perms.getProcessMessages() == process where: permString || read | write | delete | list | add | create | update | process @@ -994,9 +996,9 @@ class SASTest extends APISpec { def "AccountSASResourceType toString"() { setup: def resourceTypes = new AccountSASResourceType() - .service(service) - .container(container) - .object(object) + .setService(service) + .setContainer(container) + .setObject(object) expect: resourceTypes.toString() == expectedString @@ -1015,9 +1017,9 @@ class SASTest extends APISpec { def resourceTypes = AccountSASResourceType.parse(resourceTypeString) then: - resourceTypes.service() == service - resourceTypes.container() == container - resourceTypes.object() == object + resourceTypes.isService() == service + resourceTypes.isContainer() == container + resourceTypes.getObject() == object where: resourceTypeString || service | container | object @@ -1039,16 +1041,17 @@ class SASTest extends APISpec { def "BlobURLParts"() { setup: def parts = new BlobURLParts() - parts.scheme("http") - .host("host") - .containerName("container") - .blobName("blob") - .snapshot("snapshot") - def sasValues = new ServiceSASSignatureValues() - .permissions("r") - .canonicalName("/containerName/blobName") - .expiryTime(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) - parts.sasQueryParameters(sasValues.generateSASQueryParameters(primaryCreds)) + parts.setScheme("http") + .setHost("host") + .setContainerName("container") + .setBlobName("blob") + .setSnapshot("snapshot") + def sasValues = new BlobServiceSASSignatureValues() + .setPermissions("r") + .setCanonicalName("/containerName/blobName") + .setExpiryTime(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + .setResource("bs") + parts.setSasQueryParameters(sasValues.generateSASQueryParameters(primaryCredential)) when: def splitParts = parts.toURL().toString().split("\\?") @@ -1059,7 +1062,7 @@ class SASTest extends APISpec { splitParts[1].contains("snapshot=snapshot") splitParts[1].contains("sp=r") splitParts[1].contains("sig=") - splitParts[1].split("&").size() == 5 // snapshot & sv & sr & sp & sig + splitParts[1].split("&").size() == 6 // snapshot & sv & sr & sp & sig } def "URLParser"() { @@ -1067,14 +1070,14 @@ class SASTest extends APISpec { def parts = URLParser.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.scheme() == "http" - parts.host() == "host" - parts.containerName() == "container" - parts.blobName() == "blob" - parts.snapshot() == "snapshot" - parts.sasQueryParameters().permissions() == "r" - parts.sasQueryParameters().version() == Constants.HeaderConstants.TARGET_STORAGE_VERSION - parts.sasQueryParameters().resource() == "c" - parts.sasQueryParameters().signature() == Utility.urlDecode("Ee%2BSodSXamKSzivSdRTqYGh7AeMVEk3wEoRZ1yzkpSc%3D") + parts.getScheme() == "http" + parts.getHost() == "host" + parts.getContainerName() == "container" + parts.getBlobName() == "blob" + parts.getSnapshot() == "snapshot" + parts.getSasQueryParameters().getPermissions() == "r" + parts.getSasQueryParameters().getVersion() == Constants.HeaderConstants.TARGET_STORAGE_VERSION + parts.getSasQueryParameters().getResource() == "c" + parts.getSasQueryParameters().getSignature() == Utility.urlDecode("Ee%2BSodSXamKSzivSdRTqYGh7AeMVEk3wEoRZ1yzkpSc%3D") } } diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/Sample.java b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/Sample.java index d5955365880a..07f653a09522 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/Sample.java +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/Sample.java @@ -4,12 +4,9 @@ package com.azure.storage.blob; import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.Response; import com.azure.storage.blob.models.BlobItem; import com.azure.storage.blob.models.ContainerItem; import com.azure.storage.common.credentials.SharedKeyCredential; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -18,6 +15,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; +import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.UUID; @@ -32,7 +30,7 @@ public void sample() throws IOException { // get service client BlobServiceClient serviceClient = new BlobServiceClientBuilder().endpoint(ACCOUNT_ENDPOINT) .credential(new SharedKeyCredential(ACCOUNT_NAME, ACCOUNT_KEY)) - .httpClient(HttpClient.createDefault()/*.proxy(() -> new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)))*/) + .httpClient(HttpClient.createDefault()/*.setProxy(() -> new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)))*/) .buildClient(); // create 5 containers @@ -48,7 +46,7 @@ public void sample() throws IOException { // list containers in account System.out.println("Listing containers in account:"); for (ContainerItem item : serviceClient.listContainers()) { - System.out.println(item.name()); + System.out.println(item.getName()); } System.out.println(); @@ -66,16 +64,16 @@ public void sample() throws IOException { System.out.println("Listing/downloading blobs:"); for (BlobItem item : containerClient.listBlobsFlat()) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); - containerClient.getBlobClient(item.name()).download(stream); - System.out.println(item.name() + ": " + new String(stream.toByteArray())); + containerClient.getBlobClient(item.getName()).download(stream); + System.out.println(item.getName() + ": " + new String(stream.toByteArray())); } System.out.println(); // cleanup for (ContainerItem item : serviceClient.listContainers()) { - containerClient = serviceClient.getContainerClient(item.name()); + containerClient = serviceClient.getContainerClient(item.getName()); containerClient.delete(); - System.out.println("Deleted container: " + item.name()); + System.out.println("Deleted container: " + item.getName()); } } @@ -84,7 +82,7 @@ public void asyncSample() throws IOException { // get service client BlobServiceAsyncClient serviceClient = new BlobServiceClientBuilder().endpoint(ACCOUNT_ENDPOINT) .credential(new SharedKeyCredential(ACCOUNT_NAME, ACCOUNT_KEY)) - .httpClient(HttpClient.createDefault()/*.proxy(() -> new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)))*/) + .httpClient(HttpClient.createDefault()/*.setProxy(() -> new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)))*/) .buildAsyncClient(); // create 5 containers @@ -107,7 +105,7 @@ public void asyncSample() throws IOException { System.out.println("Listing containers in account:"); return serviceClient.listContainers() .flatMap(containerItem -> { - System.out.println(containerItem.name()); + System.out.println(containerItem.getName()); return Mono.empty(); }); })) @@ -117,7 +115,7 @@ public void asyncSample() throws IOException { for (int i = 0; i < 5; i++) { BlockBlobAsyncClient blobClient = finalContainerClient.getBlockBlobAsyncClient("testblob-" + i); byte[] message = ("test data" + i).getBytes(StandardCharsets.UTF_8); - Flux testdata = Flux.just(ByteBufAllocator.DEFAULT.buffer(message.length).writeBytes(message)); + Flux testdata = Flux.just(ByteBuffer.wrap(message)); finished = finished.and(blobClient.upload(testdata, message.length) .then(Mono.defer(() -> { @@ -136,15 +134,15 @@ public void asyncSample() throws IOException { })) // download results .flatMap(listItem -> - finalContainerClient.getBlobAsyncClient(listItem.name()) + finalContainerClient.getBlobAsyncClient(listItem.getName()) .download() - .flatMapMany(Response::value) + .flatMapMany(flux -> flux) .map(buffer -> new String(buffer.array())) - .doOnNext(string -> System.out.println(listItem.name() + ": " + string))) + .doOnNext(string -> System.out.println(listItem.getName() + ": " + string))) // cleanup .thenMany(serviceClient.listContainers()) .flatMap(containerItem -> serviceClient - .getContainerAsyncClient(containerItem.name()) + .getContainerAsyncClient(containerItem.getName()) .delete()) .blockLast(); } @@ -163,7 +161,7 @@ public void uploadDownloadFromFile() throws IOException { // get service client BlobServiceClient serviceClient = new BlobServiceClientBuilder().endpoint(ACCOUNT_ENDPOINT) .credential(new SharedKeyCredential(ACCOUNT_NAME, ACCOUNT_KEY)) - .httpClient(HttpClient.createDefault()/*.proxy(() -> new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)))*/) + .httpClient(HttpClient.createDefault()/*.setProxy(() -> new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)))*/) .buildClient(); // make container @@ -193,7 +191,7 @@ public void uploadDownloadFromFileAsync() throws IOException { // get service client BlobServiceAsyncClient serviceClient = new BlobServiceClientBuilder().endpoint(ACCOUNT_ENDPOINT) .credential(new SharedKeyCredential(ACCOUNT_NAME, ACCOUNT_KEY)) - .httpClient(HttpClient.createDefault()/*.proxy(() -> new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)))*/) + .httpClient(HttpClient.createDefault()/*.setProxy(() -> new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)))*/) .buildAsyncClient(); // make container diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy index 830dd34c2203..d95be992f093 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy @@ -3,69 +3,82 @@ package com.azure.storage.blob - import com.azure.core.http.HttpHeaders import com.azure.core.http.rest.Response -import com.azure.storage.blob.models.* +import com.azure.storage.blob.models.ContainerItem +import com.azure.storage.blob.models.ContainerListDetails +import com.azure.storage.blob.models.CorsRule +import com.azure.storage.blob.models.ListContainersOptions +import com.azure.storage.blob.models.Logging +import com.azure.storage.blob.models.Metadata +import com.azure.storage.blob.models.Metrics +import com.azure.storage.blob.models.RetentionPolicy +import com.azure.storage.blob.models.StaticWebsite +import com.azure.storage.blob.models.StorageAccountInfo +import com.azure.storage.blob.models.StorageException +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.credentials.SharedKeyCredential import com.azure.storage.common.policy.RequestRetryOptions -import org.junit.Assume +import com.azure.storage.common.policy.RequestRetryPolicy +import java.time.Duration import java.time.OffsetDateTime class ServiceAPITest extends APISpec { def setup() { - RetentionPolicy disabled = new RetentionPolicy().enabled(false) - primaryServiceURL.setProperties(new StorageServiceProperties() - .staticWebsite(new StaticWebsite().enabled(false)) - .deleteRetentionPolicy(disabled) - .cors(null) - .hourMetrics(new Metrics().version("1.0").enabled(false) - .retentionPolicy(disabled)) - .minuteMetrics(new Metrics().version("1.0").enabled(false) - .retentionPolicy(disabled)) - .logging(new Logging().version("1.0") - .retentionPolicy(disabled)) - .defaultServiceVersion("2018-03-28"), null) + RetentionPolicy disabled = new RetentionPolicy().setEnabled(false) + primaryBlobServiceClient.setProperties(new StorageServiceProperties() + .setStaticWebsite(new StaticWebsite().setEnabled(false)) + .setDeleteRetentionPolicy(disabled) + .setCors(null) + .setHourMetrics(new Metrics().setVersion("1.0").setEnabled(false) + .setRetentionPolicy(disabled)) + .setMinuteMetrics(new Metrics().setVersion("1.0").setEnabled(false) + .setRetentionPolicy(disabled)) + .setLogging(new Logging().setVersion("1.0") + .setRetentionPolicy(disabled)) + .setDefaultServiceVersion("2018-03-28")) } def cleanup() { - Assume.assumeTrue("The test only runs in Live mode.", testMode.equalsIgnoreCase("RECORD")) - RetentionPolicy disabled = new RetentionPolicy().enabled(false) - primaryServiceURL.setProperties(new StorageServiceProperties() - .staticWebsite(new StaticWebsite().enabled(false)) - .deleteRetentionPolicy(disabled) - .cors(null) - .hourMetrics(new Metrics().version("1.0").enabled(false) - .retentionPolicy(disabled)) - .minuteMetrics(new Metrics().version("1.0").enabled(false) - .retentionPolicy(disabled)) - .logging(new Logging().version("1.0") - .retentionPolicy(disabled)) - .defaultServiceVersion("2018-03-28"), null) + RetentionPolicy disabled = new RetentionPolicy().setEnabled(false) + primaryBlobServiceClient.setProperties(new StorageServiceProperties() + .setStaticWebsite(new StaticWebsite().setEnabled(false)) + .setDeleteRetentionPolicy(disabled) + .setCors(null) + .setHourMetrics(new Metrics().setVersion("1.0").setEnabled(false) + .setRetentionPolicy(disabled)) + .setMinuteMetrics(new Metrics().setVersion("1.0").setEnabled(false) + .setRetentionPolicy(disabled)) + .setLogging(new Logging().setVersion("1.0") + .setRetentionPolicy(disabled)) + .setDefaultServiceVersion("2018-03-28")) } def "List containers"() { when: - Iterable response = - primaryServiceURL.listContainers(new ListContainersOptions().prefix(containerPrefix), null) + def response = + primaryBlobServiceClient.listContainers(new ListContainersOptions().setPrefix(containerPrefix + testName), null) then: for (ContainerItem c : response) { - assert c.name().startsWith(containerPrefix) - assert c.properties().lastModified() != null - assert c.properties().etag() != null - assert c.properties().leaseStatus() != null - assert c.properties().leaseState() != null - assert c.properties().leaseDuration() == null - assert c.properties().publicAccess() == null - assert !c.properties().hasLegalHold() - assert !c.properties().hasImmutabilityPolicy() + assert c.getName().startsWith(containerPrefix) + assert c.getProperties().getLastModified() != null + assert c.getProperties().getEtag() != null + assert c.getProperties().getLeaseStatus() != null + assert c.getProperties().getLeaseState() != null + assert c.getProperties().getLeaseDuration() == null + assert c.getProperties().getPublicAccess() == null + assert !c.getProperties().isHasLegalHold() + assert !c.getProperties().isHasImmutabilityPolicy() } } def "List containers min"() { when: - primaryServiceURL.listContainers().iterator().hasNext() + primaryBlobServiceClient.listContainers().iterator().hasNext() then: notThrown(StorageException) @@ -74,125 +87,148 @@ class ServiceAPITest extends APISpec { def "List containers marker"() { setup: for (int i = 0; i < 10; i++) { - primaryServiceURL.createContainer(generateContainerName()) + primaryBlobServiceClient.createContainer(generateContainerName()) } - Iterator listResponse = primaryServiceURL.listContainers().iterator() - String firstContainerName = listResponse.next().name() + Iterator listResponse = primaryBlobServiceClient.listContainers().iterator() + String firstContainerName = listResponse.next().getName() expect: // Assert that the second segment is indeed after the first alphabetically - firstContainerName < listResponse.next().name() + firstContainerName < listResponse.next().getName() } def "List containers details"() { setup: Metadata metadata = new Metadata() metadata.put("foo", "bar") - cu = primaryServiceURL.createContainer("aaa" + generateContainerName(), metadata, null).value() + cc = primaryBlobServiceClient.createContainerWithResponse("aaa" + generateContainerName(), metadata, null, null).getValue() expect: - primaryServiceURL.listContainers(new ListContainersOptions() - .details(new ContainerListDetails().metadata(true)) - .prefix("aaa" + containerPrefix), null) - .iterator().next().metadata() == metadata + primaryBlobServiceClient.listContainers(new ListContainersOptions() + .setDetails(new ContainerListDetails().setMetadata(true)) + .setPrefix("aaa" + containerPrefix), null) + .iterator().next().getMetadata() == metadata // Container with prefix "aaa" will not be cleaned up by normal test cleanup. - cu.delete().statusCode() == 202 + cc.deleteWithResponse(null, null, null).getStatusCode() == 202 } - // TODO (alzimmer): Turn this test back on when listing by page is implemented - /*def "List containers maxResults"() { + def "List containers maxResults"() { setup: - for (int i = 0; i < 11; i++) { - primaryServiceURL.createContainer(generateContainerName()) + def NUM_CONTAINERS = 5 + def PAGE_RESULTS = 3 + + def containers = [] as Collection + for (i in (1..NUM_CONTAINERS)) { + containers << primaryBlobServiceClient.createContainer(generateContainerName()) } expect: + primaryBlobServiceClient.listContainers(new ListContainersOptions().setMaxResults(PAGE_RESULTS), null) + .iterableByPage().iterator().next().getValue().size() == PAGE_RESULTS - primaryServiceURL.listContainersSegment(null, - new ListContainersOptions().maxResults(10), null) - .blockingGet().body().containerItems().size() == 10 - }*/ + cleanup: + containers.each { container -> container.delete() } + } - // TODO (alzimmer): Turn this test back on when listing by page is implemented as this requires being able to set a marker - /*def "List containers error"() { + def "List containers error"() { when: - primaryServiceURL.listContainers("garbage", null, null).blockingGet() + primaryBlobServiceClient.listContainers().streamByPage("garbage continuation token").count() then: thrown(StorageException) - }*/ + } + + def "List containers with timeout still backed by PagedFlux"() { + setup: + def NUM_CONTAINERS = 5 + def PAGE_RESULTS = 3 + + def containers = [] as Collection + for (i in (1..NUM_CONTAINERS)) { + containers << primaryBlobServiceClient.createContainer(generateContainerName()) + } + + when: "Consume results by page" + primaryBlobServiceClient.listContainers(new ListContainersOptions().setMaxResults(PAGE_RESULTS), Duration.ofSeconds(10)).streamByPage().count() + + then: "Still have paging functionality" + notThrown(Exception) + + cleanup: + containers.each { container -> container.delete() } + } def validatePropsSet(StorageServiceProperties sent, StorageServiceProperties received) { - return received.logging().read() == sent.logging().read() && - received.logging().delete() == sent.logging().delete() && - received.logging().write() == sent.logging().write() && - received.logging().version() == sent.logging().version() && - received.logging().retentionPolicy().days() == sent.logging().retentionPolicy().days() && - received.logging().retentionPolicy().enabled() == sent.logging().retentionPolicy().enabled() && - - received.cors().size() == sent.cors().size() && - received.cors().get(0).allowedMethods() == sent.cors().get(0).allowedMethods() && - received.cors().get(0).allowedHeaders() == sent.cors().get(0).allowedHeaders() && - received.cors().get(0).allowedOrigins() == sent.cors().get(0).allowedOrigins() && - received.cors().get(0).exposedHeaders() == sent.cors().get(0).exposedHeaders() && - received.cors().get(0).maxAgeInSeconds() == sent.cors().get(0).maxAgeInSeconds() && - - received.defaultServiceVersion() == sent.defaultServiceVersion() && - - received.hourMetrics().enabled() == sent.hourMetrics().enabled() && - received.hourMetrics().includeAPIs() == sent.hourMetrics().includeAPIs() && - received.hourMetrics().retentionPolicy().enabled() == sent.hourMetrics().retentionPolicy().enabled() && - received.hourMetrics().retentionPolicy().days() == sent.hourMetrics().retentionPolicy().days() && - received.hourMetrics().version() == sent.hourMetrics().version() && - - received.minuteMetrics().enabled() == sent.minuteMetrics().enabled() && - received.minuteMetrics().includeAPIs() == sent.minuteMetrics().includeAPIs() && - received.minuteMetrics().retentionPolicy().enabled() == sent.minuteMetrics().retentionPolicy().enabled() && - received.minuteMetrics().retentionPolicy().days() == sent.minuteMetrics().retentionPolicy().days() && - received.minuteMetrics().version() == sent.minuteMetrics().version() && - - received.deleteRetentionPolicy().enabled() == sent.deleteRetentionPolicy().enabled() && - received.deleteRetentionPolicy().days() == sent.deleteRetentionPolicy().days() && - - received.staticWebsite().enabled() == sent.staticWebsite().enabled() && - received.staticWebsite().indexDocument() == sent.staticWebsite().indexDocument() && - received.staticWebsite().errorDocument404Path() == sent.staticWebsite().errorDocument404Path() + return received.getLogging().isRead() == sent.getLogging().isRead() && + received.getLogging().isDelete() == sent.getLogging().isDelete() && + received.getLogging().isWrite() == sent.getLogging().isWrite() && + received.getLogging().getVersion() == sent.getLogging().getVersion() && + received.getLogging().getRetentionPolicy().getDays() == sent.getLogging().getRetentionPolicy().getDays() && + received.getLogging().getRetentionPolicy().isEnabled() == sent.getLogging().getRetentionPolicy().isEnabled() && + + received.getCors().size() == sent.getCors().size() && + received.getCors().get(0).getAllowedMethods() == sent.getCors().get(0).getAllowedMethods() && + received.getCors().get(0).getAllowedHeaders() == sent.getCors().get(0).getAllowedHeaders() && + received.getCors().get(0).getAllowedOrigins() == sent.getCors().get(0).getAllowedOrigins() && + received.getCors().get(0).getExposedHeaders() == sent.getCors().get(0).getExposedHeaders() && + received.getCors().get(0).getMaxAgeInSeconds() == sent.getCors().get(0).getMaxAgeInSeconds() && + + received.getDefaultServiceVersion() == sent.getDefaultServiceVersion() && + + received.getHourMetrics().isEnabled() == sent.getHourMetrics().isEnabled() && + received.getHourMetrics().isIncludeAPIs() == sent.getHourMetrics().isIncludeAPIs() && + received.getHourMetrics().getRetentionPolicy().isEnabled() == sent.getHourMetrics().getRetentionPolicy().isEnabled() && + received.getHourMetrics().getRetentionPolicy().getDays() == sent.getHourMetrics().getRetentionPolicy().getDays() && + received.getHourMetrics().getVersion() == sent.getHourMetrics().getVersion() && + + received.getMinuteMetrics().isEnabled() == sent.getMinuteMetrics().isEnabled() && + received.getMinuteMetrics().isIncludeAPIs() == sent.getMinuteMetrics().isIncludeAPIs() && + received.getMinuteMetrics().getRetentionPolicy().isEnabled() == sent.getMinuteMetrics().getRetentionPolicy().isEnabled() && + received.getMinuteMetrics().getRetentionPolicy().getDays() == sent.getMinuteMetrics().getRetentionPolicy().getDays() && + received.getMinuteMetrics().getVersion() == sent.getMinuteMetrics().getVersion() && + + received.getDeleteRetentionPolicy().isEnabled() == sent.getDeleteRetentionPolicy().isEnabled() && + received.getDeleteRetentionPolicy().getDays() == sent.getDeleteRetentionPolicy().getDays() && + + received.getStaticWebsite().isEnabled() == sent.getStaticWebsite().isEnabled() && + received.getStaticWebsite().getIndexDocument() == sent.getStaticWebsite().getIndexDocument() && + received.getStaticWebsite().getErrorDocument404Path() == sent.getStaticWebsite().getErrorDocument404Path() } def "Set get properties"() { when: - RetentionPolicy retentionPolicy = new RetentionPolicy().days(5).enabled(true) - Logging logging = new Logging().read(true).version("1.0") - .retentionPolicy(retentionPolicy) + RetentionPolicy retentionPolicy = new RetentionPolicy().setDays(5).setEnabled(true) + Logging logging = new Logging().setRead(true).setVersion("1.0") + .setRetentionPolicy(retentionPolicy) ArrayList corsRules = new ArrayList<>() - corsRules.add(new CorsRule().allowedMethods("GET,PUT,HEAD") - .allowedOrigins("*") - .allowedHeaders("x-ms-version") - .exposedHeaders("x-ms-client-request-id") - .maxAgeInSeconds(10)) + corsRules.add(new CorsRule().setAllowedMethods("GET,PUT,HEAD") + .setAllowedOrigins("*") + .setAllowedHeaders("x-ms-version") + .setExposedHeaders("x-ms-client-request-id") + .setMaxAgeInSeconds(10)) String defaultServiceVersion = "2016-05-31" - Metrics hourMetrics = new Metrics().enabled(true).version("1.0") - .retentionPolicy(retentionPolicy).includeAPIs(true) - Metrics minuteMetrics = new Metrics().enabled(true).version("1.0") - .retentionPolicy(retentionPolicy).includeAPIs(true) - StaticWebsite website = new StaticWebsite().enabled(true) - .indexDocument("myIndex.html") - .errorDocument404Path("custom/error/path.html") + Metrics hourMetrics = new Metrics().setEnabled(true).setVersion("1.0") + .setRetentionPolicy(retentionPolicy).setIncludeAPIs(true) + Metrics minuteMetrics = new Metrics().setEnabled(true).setVersion("1.0") + .setRetentionPolicy(retentionPolicy).setIncludeAPIs(true) + StaticWebsite website = new StaticWebsite().setEnabled(true) + .setIndexDocument("myIndex.html") + .setErrorDocument404Path("custom/error/path.html") StorageServiceProperties sentProperties = new StorageServiceProperties() - .logging(logging).cors(corsRules).defaultServiceVersion(defaultServiceVersion) - .minuteMetrics(minuteMetrics).hourMetrics(hourMetrics) - .deleteRetentionPolicy(retentionPolicy) - .staticWebsite(website) + .setLogging(logging).setCors(corsRules).setDefaultServiceVersion(defaultServiceVersion) + .setMinuteMetrics(minuteMetrics).setHourMetrics(hourMetrics) + .setDeleteRetentionPolicy(retentionPolicy) + .setStaticWebsite(website) - HttpHeaders headers = primaryServiceURL.setProperties(sentProperties).headers() + HttpHeaders headers = primaryBlobServiceClient.setPropertiesWithResponse(sentProperties, null, null).getHeaders() // Service properties may take up to 30s to take effect. If they weren't already in place, wait. - sleep(30 * 1000) + sleepIfRecord(30 * 1000) - StorageServiceProperties receivedProperties = primaryServiceURL.getProperties().value() + StorageServiceProperties receivedProperties = primaryBlobServiceClient.getProperties() then: headers.value("x-ms-request-id") != null @@ -204,40 +240,37 @@ class ServiceAPITest extends APISpec { def "Set props min"() { setup: - RetentionPolicy retentionPolicy = new RetentionPolicy().days(5).enabled(true) - Logging logging = new Logging().read(true).version("1.0") - .retentionPolicy(retentionPolicy) + RetentionPolicy retentionPolicy = new RetentionPolicy().setDays(5).setEnabled(true) + Logging logging = new Logging().setRead(true).setVersion("1.0") + .setRetentionPolicy(retentionPolicy) ArrayList corsRules = new ArrayList<>() - corsRules.add(new CorsRule().allowedMethods("GET,PUT,HEAD") - .allowedOrigins("*") - .allowedHeaders("x-ms-version") - .exposedHeaders("x-ms-client-request-id") - .maxAgeInSeconds(10)) + corsRules.add(new CorsRule().setAllowedMethods("GET,PUT,HEAD") + .setAllowedOrigins("*") + .setAllowedHeaders("x-ms-version") + .setExposedHeaders("x-ms-client-request-id") + .setMaxAgeInSeconds(10)) String defaultServiceVersion = "2016-05-31" - Metrics hourMetrics = new Metrics().enabled(true).version("1.0") - .retentionPolicy(retentionPolicy).includeAPIs(true) - Metrics minuteMetrics = new Metrics().enabled(true).version("1.0") - .retentionPolicy(retentionPolicy).includeAPIs(true) - StaticWebsite website = new StaticWebsite().enabled(true) - .indexDocument("myIndex.html") - .errorDocument404Path("custom/error/path.html") + Metrics hourMetrics = new Metrics().setEnabled(true).setVersion("1.0") + .setRetentionPolicy(retentionPolicy).setIncludeAPIs(true) + Metrics minuteMetrics = new Metrics().setEnabled(true).setVersion("1.0") + .setRetentionPolicy(retentionPolicy).setIncludeAPIs(true) + StaticWebsite website = new StaticWebsite().setEnabled(true) + .setIndexDocument("myIndex.html") + .setErrorDocument404Path("custom/error/path.html") StorageServiceProperties sentProperties = new StorageServiceProperties() - .logging(logging).cors(corsRules).defaultServiceVersion(defaultServiceVersion) - .minuteMetrics(minuteMetrics).hourMetrics(hourMetrics) - .deleteRetentionPolicy(retentionPolicy) - .staticWebsite(website) + .setLogging(logging).setCors(corsRules).setDefaultServiceVersion(defaultServiceVersion) + .setMinuteMetrics(minuteMetrics).setHourMetrics(hourMetrics) + .setDeleteRetentionPolicy(retentionPolicy) + .setStaticWebsite(website) expect: - primaryServiceURL.setProperties(sentProperties).statusCode() == 202 + primaryBlobServiceClient.setPropertiesWithResponse(sentProperties, null, null).getStatusCode() == 202 } def "Set props error"() { when: - new BlobServiceClientBuilder() - .endpoint("https://error.blob.core.windows.net") - .credential(primaryCreds) - .buildClient() + getServiceClient(primaryCredential, "https://error.blob.core.windows.net") .setProperties(new StorageServiceProperties()) then: @@ -246,15 +279,12 @@ class ServiceAPITest extends APISpec { def "Get props min"() { expect: - primaryServiceURL.getProperties().statusCode() == 200 + primaryBlobServiceClient.getPropertiesWithResponse(null, null).getStatusCode() == 200 } def "Get props error"() { when: - new BlobServiceClientBuilder() - .endpoint("https://error.blob.core.windows.net") - .credential(primaryCreds) - .buildClient() + getServiceClient(primaryCredential, "https://error.blob.core.windows.net") .getProperties() then: @@ -266,33 +296,33 @@ class ServiceAPITest extends APISpec { def start = OffsetDateTime.now() def expiry = start.plusDays(1) - Response response = getOAuthServiceURL().getUserDelegationKey(start, expiry, null) + Response response = getOAuthServiceClient().getUserDelegationKeyWithResponse(start, expiry, null, null) expect: - response.statusCode() == 200 - response.value() != null - response.value().signedOid() != null - response.value().signedTid() != null - response.value().signedStart() != null - response.value().signedExpiry() != null - response.value().signedService() != null - response.value().signedVersion() != null - response.value().value() != null + response.getStatusCode() == 200 + response.getValue() != null + response.getValue().getSignedOid() != null + response.getValue().getSignedTid() != null + response.getValue().getSignedStart() != null + response.getValue().getSignedExpiry() != null + response.getValue().getSignedService() != null + response.getValue().getSignedVersion() != null + response.getValue().getValue() != null } def "Get UserDelegationKey min"() { setup: def expiry = OffsetDateTime.now().plusDays(1) - def response = getOAuthServiceURL().getUserDelegationKey(null, expiry) + def response = getOAuthServiceClient().getUserDelegationKeyWithResponse(null, expiry, null, null) expect: - response.statusCode() == 200 + response.getStatusCode() == 200 } def "Get UserDelegationKey error"() { when: - getOAuthServiceURL().getUserDelegationKey(start, expiry) + getOAuthServiceClient().getUserDelegationKey(start, expiry) then: thrown(exception) @@ -305,31 +335,30 @@ class ServiceAPITest extends APISpec { def "Get stats"() { setup: - String secondaryEndpoint = String.format("https://%s-secondary.blob.core.windows.net", primaryCreds.accountName()) - BlobServiceClient serviceClient = new BlobServiceClientBuilder().endpoint(secondaryEndpoint) - .credential(primaryCreds).buildClient() - Response response = serviceClient.getStatistics() + String secondaryEndpoint = String.format("https://%s-secondary.blob.core.windows.net", primaryCredential.getAccountName()) + BlobServiceClient serviceClient = getServiceClient(primaryCredential, secondaryEndpoint) + Response response = serviceClient.getStatisticsWithResponse(null, null) expect: - response.headers().value("x-ms-version") != null - response.headers().value("x-ms-request-id") != null - response.headers().value("Date") != null - response.value().geoReplication().status() != null - response.value().geoReplication().lastSyncTime() != null + response.getHeaders().value("x-ms-version") != null + response.getHeaders().value("x-ms-request-id") != null + response.getHeaders().value("Date") != null + response.getValue().getGeoReplication().getStatus() != null + response.getValue().getGeoReplication().getLastSyncTime() != null } def "Get stats min"() { setup: - String secondaryEndpoint = String.format("https://%s-secondary.blob.core.windows.net", primaryCreds.accountName()) - BlobServiceClient serviceClient = new BlobServiceClientBuilder().endpoint(secondaryEndpoint) - .credential(primaryCreds).buildClient() + String secondaryEndpoint = String.format("https://%s-secondary.blob.core.windows.net", primaryCredential.getAccountName()) + BlobServiceClient serviceClient = getServiceClient(primaryCredential, secondaryEndpoint) + expect: - serviceClient.getStatistics().statusCode() == 200 + serviceClient.getStatisticsWithResponse(null, null).getStatusCode() == 200 } def "Get stats error"() { when: - primaryServiceURL.getStatistics() + primaryBlobServiceClient.getStatistics() then: thrown(StorageException) @@ -337,26 +366,24 @@ class ServiceAPITest extends APISpec { def "Get account info"() { when: - Response response = primaryServiceURL.getAccountInfo() + Response response = primaryBlobServiceClient.getAccountInfoWithResponse(null, null) then: - response.headers().value("Date") != null - response.headers().value("x-ms-version") != null - response.headers().value("x-ms-request-id") != null - response.value().accountKind() != null - response.value().skuName() != null + response.getHeaders().value("Date") != null + response.getHeaders().value("x-ms-version") != null + response.getHeaders().value("x-ms-request-id") != null + response.getValue().getAccountKind() != null + response.getValue().getSkuName() != null } def "Get account info min"() { expect: - primaryServiceURL.getAccountInfo().statusCode() == 200 + primaryBlobServiceClient.getAccountInfoWithResponse(null, null).getStatusCode() == 200 } def "Get account info error"() { when: - BlobServiceClient serviceURL = new BlobServiceClientBuilder() - .endpoint(primaryServiceURL.getAccountUrl().toString()) - .buildClient() + BlobServiceClient serviceURL = getServiceClient((SharedKeyCredential) null, primaryBlobServiceClient.getAccountUrl().toString()) serviceURL.getAccountInfo() then: @@ -368,11 +395,8 @@ class ServiceAPITest extends APISpec { def "Invalid account name"() { setup: URL badURL = new URL("http://fake.blobfake.core.windows.net") - BlobServiceClient client = new BlobServiceClientBuilder() - .endpoint(badURL.toString()) - .credential(primaryCreds) - .retryOptions(new RequestRetryOptions(null, 2, null, null, null, null)) - .buildClient() + BlobServiceClient client = getServiceClient(primaryCredential, badURL.toString(), + new RequestRetryPolicy(new RequestRetryOptions(null, 2, null, null, null, null))) when: client.getProperties() diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[0].json new file mode 100644 index 000000000000..7339d06b31c9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[0].json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacd10822027049?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" : "139ce379-bb50-498c-badd-ca61ee37aade" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356238FF736C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7a06-901e-0029-374b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:47 GMT", + "x-ms-client-request-id" : "139ce379-bb50-498c-badd-ca61ee37aade" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacd10822027049/javablobappendblockac1appendblobapitestappendblockacd1098928e", + "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" : "26803ffc-287f-4d69-8cd6-fb53fb59da94" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562390C9F47\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7a11-901e-0029-414b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:47 GMT", + "x-ms-client-request-id" : "26803ffc-287f-4d69-8cd6-fb53fb59da94" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacd10822027049/javablobappendblockac1appendblobapitestappendblockacd1098928e?comp=appendblock", + "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" : "d0e659a0-da9d-4c3b-abf2-489e069cc7f9", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:47 GMT", + "ETag" : "\"0x8D73562391A364F\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c7a20-901e-0029-4f4b-6796e9000000", + "x-ms-client-request-id" : "d0e659a0-da9d-4c3b-abf2-489e069cc7f9", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockac&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" : "86faf3d1-76f0-4164-b108-a1ca30f949c2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c7a2d-901e-0029-5c4b-6796e9000000", + "Body" : "jtcappendblockacjtcappendblockac0appendblobapitestappendblockacd10822027049Mon, 09 Sep 2019 20:13:47 GMT\"0x8D7356238FF736C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:47 GMT", + "x-ms-client-request-id" : "86faf3d1-76f0-4164-b108-a1ca30f949c2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacd10822027049?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" : "3f8ee7de-e204-487d-a21a-d3d4a633ec7c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c7a38-901e-0029-674b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:47 GMT", + "x-ms-client-request-id" : "3f8ee7de-e204-487d-a21a-d3d4a633ec7c" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockac0appendblobapitestappendblockacd10822027049", "javablobappendblockac1appendblobapitestappendblockacd1098928e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[1].json new file mode 100644 index 000000000000..e321c4d2716e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[1].json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac4bc42354747b?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" : "353e0b35-4558-490f-ae8d-313e1af590cb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356239411C3D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7a4c-901e-0029-784b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:47 GMT", + "x-ms-client-request-id" : "353e0b35-4558-490f-ae8d-313e1af590cb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac4bc42354747b/javablobappendblockac1appendblobapitestappendblockac4bc36841c", + "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" : "df5b3608-3151-4490-9978-ebfb85d26965" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562394E2106\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7a5a-901e-0029-044b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:47 GMT", + "x-ms-client-request-id" : "df5b3608-3151-4490-9978-ebfb85d26965" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac4bc42354747b/javablobappendblockac1appendblobapitestappendblockac4bc36841c?comp=appendblock", + "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" : "6f7e0ff5-b87e-4dfc-957e-c0f7f90a38a3", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:47 GMT", + "ETag" : "\"0x8D73562395AA66A\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c7a6a-901e-0029-134b-6796e9000000", + "x-ms-client-request-id" : "6f7e0ff5-b87e-4dfc-957e-c0f7f90a38a3", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockac&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" : "f1867fda-464c-43c3-95ef-6f32edb9a66e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c7a74-901e-0029-1d4b-6796e9000000", + "Body" : "jtcappendblockacjtcappendblockac0appendblobapitestappendblockac4bc42354747bMon, 09 Sep 2019 20:13:47 GMT\"0x8D7356239411C3D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:47 GMT", + "x-ms-client-request-id" : "f1867fda-464c-43c3-95ef-6f32edb9a66e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac4bc42354747b?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" : "d88ddd4e-48f3-4cc1-8381-24ea2da983e6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c7a85-901e-0029-2b4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:47 GMT", + "x-ms-client-request-id" : "d88ddd4e-48f3-4cc1-8381-24ea2da983e6" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockac0appendblobapitestappendblockac4bc42354747b", "javablobappendblockac1appendblobapitestappendblockac4bc36841c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[2].json new file mode 100644 index 000000000000..283439f33271 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[2].json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac62848458241b?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" : "8a5ac9c9-3485-4961-b3c3-9d26bbbec853" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562397F41F3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7a93-901e-0029-394b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:47 GMT", + "x-ms-client-request-id" : "8a5ac9c9-3485-4961-b3c3-9d26bbbec853" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac62848458241b/javablobappendblockac1appendblobapitestappendblockac628816393", + "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" : "2333a47e-c369-4807-ab27-4326fbee94c7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562398BD182\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7aa3-901e-0029-464b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:48 GMT", + "x-ms-client-request-id" : "2333a47e-c369-4807-ab27-4326fbee94c7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac62848458241b/javablobappendblockac1appendblobapitestappendblockac628816393?comp=appendblock", + "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" : "002bbdfe-d74b-4776-b68c-8211705f8956", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:48 GMT", + "ETag" : "\"0x8D7356239982FD1\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c7ab4-901e-0029-564b-6796e9000000", + "x-ms-client-request-id" : "002bbdfe-d74b-4776-b68c-8211705f8956", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockac&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" : "a88fd357-f52e-4c59-85de-2d2688262916" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c7ac4-901e-0029-654b-6796e9000000", + "Body" : "jtcappendblockacjtcappendblockac0appendblobapitestappendblockac62848458241bMon, 09 Sep 2019 20:13:48 GMT\"0x8D73562397F41F3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:48 GMT", + "x-ms-client-request-id" : "a88fd357-f52e-4c59-85de-2d2688262916", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac62848458241b?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" : "678e270a-2b84-4155-8b32-3edf81353491" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c7adb-901e-0029-7a4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:48 GMT", + "x-ms-client-request-id" : "678e270a-2b84-4155-8b32-3edf81353491" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockac0appendblobapitestappendblockac62848458241b", "javablobappendblockac1appendblobapitestappendblockac628816393" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[3].json new file mode 100644 index 000000000000..d0457eebe932 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[3].json @@ -0,0 +1,145 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac7987397504a4?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" : "514eeb3d-edab-4f7f-a569-5e7aa4da9af9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356239BCCB5B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7ae9-901e-0029-084b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:48 GMT", + "x-ms-client-request-id" : "514eeb3d-edab-4f7f-a569-5e7aa4da9af9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac7987397504a4/javablobappendblockac1appendblobapitestappendblockac798533820", + "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" : "6c3e7c35-79db-4547-8b3e-08237154ba90" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356239C98212\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7af6-901e-0029-144b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:48 GMT", + "x-ms-client-request-id" : "6c3e7c35-79db-4547-8b3e-08237154ba90" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac7987397504a4/javablobappendblockac1appendblobapitestappendblockac798533820", + "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" : "aaaba7d1-1128-40ba-a42b-42b90da0b15e" + }, + "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", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:48 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:13:48 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7356239C98212\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:13:48 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "e27c7aff-901e-0029-1c4b-6796e9000000", + "x-ms-client-request-id" : "aaaba7d1-1128-40ba-a42b-42b90da0b15e", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac7987397504a4/javablobappendblockac1appendblobapitestappendblockac798533820?comp=appendblock", + "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" : "38911961-e915-46ea-a2a0-8f2d760d2067", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:48 GMT", + "ETag" : "\"0x8D7356239E17B48\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c7b0d-901e-0029-294b-6796e9000000", + "x-ms-client-request-id" : "38911961-e915-46ea-a2a0-8f2d760d2067", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockac&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" : "cf58faff-42f3-4b49-bb7d-c0de412a8222" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c7b1e-901e-0029-3a4b-6796e9000000", + "Body" : "jtcappendblockacjtcappendblockac0appendblobapitestappendblockac7987397504a4Mon, 09 Sep 2019 20:13:48 GMT\"0x8D7356239BCCB5B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:48 GMT", + "x-ms-client-request-id" : "cf58faff-42f3-4b49-bb7d-c0de412a8222", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac7987397504a4?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" : "5962b77f-940d-4a86-9b3b-c70697792118" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c7b2d-901e-0029-484b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:48 GMT", + "x-ms-client-request-id" : "5962b77f-940d-4a86-9b3b-c70697792118" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockac0appendblobapitestappendblockac7987397504a4", "javablobappendblockac1appendblobapitestappendblockac798533820" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[4].json new file mode 100644 index 000000000000..4f62198ff3f7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[4].json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac1f88319910b4?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" : "8dfae226-cdb3-4af9-b906-676ed07bc29a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623A063DC4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7b3c-901e-0029-574b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:48 GMT", + "x-ms-client-request-id" : "8dfae226-cdb3-4af9-b906-676ed07bc29a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac1f88319910b4/javablobappendblockac1appendblobapitestappendblockac1f866951b", + "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" : "4ae17cf3-d66f-4477-bd03-89a08d939f59" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623A12CD8A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7b48-901e-0029-624b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:48 GMT", + "x-ms-client-request-id" : "4ae17cf3-d66f-4477-bd03-89a08d939f59" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac1f88319910b4/javablobappendblockac1appendblobapitestappendblockac1f866951b?comp=appendblock", + "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" : "947e474d-f262-4d86-964b-5ae13f26fb69", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:49 GMT", + "ETag" : "\"0x8D735623A1F04CE\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c7b55-901e-0029-6f4b-6796e9000000", + "x-ms-client-request-id" : "947e474d-f262-4d86-964b-5ae13f26fb69", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockac&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" : "4e36ba3e-24d4-4a2e-aa9b-2b22cc48a967" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c7b64-901e-0029-7b4b-6796e9000000", + "Body" : "jtcappendblockacjtcappendblockac0appendblobapitestappendblockac1f88319910b4Mon, 09 Sep 2019 20:13:49 GMT\"0x8D735623A063DC4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:49 GMT", + "x-ms-client-request-id" : "4e36ba3e-24d4-4a2e-aa9b-2b22cc48a967", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac1f88319910b4?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" : "c00f89e8-2b6d-49bb-9c21-cd1ba5945cea" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c7b70-901e-0029-064b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:49 GMT", + "x-ms-client-request-id" : "c00f89e8-2b6d-49bb-9c21-cd1ba5945cea" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockac0appendblobapitestappendblockac1f88319910b4", "javablobappendblockac1appendblobapitestappendblockac1f866951b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[5].json new file mode 100644 index 000000000000..408a3d1b7122 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[5].json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac3cb722357e87?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" : "13768cf5-cfa2-473c-a857-a422e9593c22" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623A43C722\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7b7c-901e-0029-124b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:49 GMT", + "x-ms-client-request-id" : "13768cf5-cfa2-473c-a857-a422e9593c22" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac3cb722357e87/javablobappendblockac1appendblobapitestappendblockac3cb35372c", + "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" : "3d48ea10-3e90-4805-a465-985d00f9f0d9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623A50CC4B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7b91-901e-0029-244b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:49 GMT", + "x-ms-client-request-id" : "3d48ea10-3e90-4805-a465-985d00f9f0d9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac3cb722357e87/javablobappendblockac1appendblobapitestappendblockac3cb35372c?comp=lease", + "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" : "0e04c182-079d-415d-b26e-3ac50c42354a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623A50CC4B\"", + "x-ms-lease-id" : "65e26f6a-1610-4820-94c2-e5ec80b68e44", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7b99-901e-0029-2c4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:49 GMT", + "x-ms-client-request-id" : "0e04c182-079d-415d-b26e-3ac50c42354a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac3cb722357e87/javablobappendblockac1appendblobapitestappendblockac3cb35372c?comp=appendblock", + "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" : "ea74dc80-703b-4968-8726-53b3ad82cc12", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:49 GMT", + "ETag" : "\"0x8D735623A6A4C69\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c7bb5-901e-0029-414b-6796e9000000", + "x-ms-client-request-id" : "ea74dc80-703b-4968-8726-53b3ad82cc12", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockac&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" : "8bfab926-3c4b-4fa5-b9fa-29b811420100" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c7bc3-901e-0029-4d4b-6796e9000000", + "Body" : "jtcappendblockacjtcappendblockac0appendblobapitestappendblockac3cb722357e87Mon, 09 Sep 2019 20:13:49 GMT\"0x8D735623A43C722\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:49 GMT", + "x-ms-client-request-id" : "8bfab926-3c4b-4fa5-b9fa-29b811420100", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockac3cb722357e87?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" : "11240ee1-0fc9-46a6-8914-b12148caff91" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c7bd4-901e-0029-5a4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:49 GMT", + "x-ms-client-request-id" : "11240ee1-0fc9-46a6-8914-b12148caff91" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockac0appendblobapitestappendblockac3cb722357e87", "javablobappendblockac1appendblobapitestappendblockac3cb35372c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[6].json new file mode 100644 index 000000000000..9a03d223215e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[6].json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacc8976354d9e2?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" : "de689742-8ddf-4303-9e54-832643e60b32" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623A91A72C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7be1-901e-0029-664b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:49 GMT", + "x-ms-client-request-id" : "de689742-8ddf-4303-9e54-832643e60b32" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacc8976354d9e2/javablobappendblockac1appendblobapitestappendblockacc89146681", + "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" : "f397dece-7e8d-470a-a72a-3df427c4f84f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623A9F48D8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7bef-901e-0029-724b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:49 GMT", + "x-ms-client-request-id" : "f397dece-7e8d-470a-a72a-3df427c4f84f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacc8976354d9e2/javablobappendblockac1appendblobapitestappendblockacc89146681?comp=appendblock", + "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" : "926d519b-c26c-4db4-8acb-787376ab7df6", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:49 GMT", + "ETag" : "\"0x8D735623AABF55F\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c7bfb-901e-0029-7d4b-6796e9000000", + "x-ms-client-request-id" : "926d519b-c26c-4db4-8acb-787376ab7df6", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockac&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" : "da2488c5-de36-4a8f-8439-961d4192fad0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c7c03-901e-0029-054b-6796e9000000", + "Body" : "jtcappendblockacjtcappendblockac0appendblobapitestappendblockacc8976354d9e2Mon, 09 Sep 2019 20:13:50 GMT\"0x8D735623A91A72C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:50 GMT", + "x-ms-client-request-id" : "da2488c5-de36-4a8f-8439-961d4192fad0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockacc8976354d9e2?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" : "85a8b12c-df45-4e85-a95a-397017e2a5eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c7c14-901e-0029-124b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:50 GMT", + "x-ms-client-request-id" : "85a8b12c-df45-4e85-a95a-397017e2a5eb" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockac0appendblobapitestappendblockacc8976354d9e2", "javablobappendblockac1appendblobapitestappendblockacc89146681" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[7].json new file mode 100644 index 000000000000..70a2836a11ff --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockac[7].json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockaca25225611b23?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" : "0ff18a28-aa4c-4299-9b79-91389181e8ce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623AD41372\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7c24-901e-0029-224b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:50 GMT", + "x-ms-client-request-id" : "0ff18a28-aa4c-4299-9b79-91389181e8ce" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockaca25225611b23/javablobappendblockac1appendblobapitestappendblockaca2588440b", + "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" : "5b575811-2764-4316-a401-bed11b8941ff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623AE0CAB0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7c2f-901e-0029-2c4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:50 GMT", + "x-ms-client-request-id" : "5b575811-2764-4316-a401-bed11b8941ff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockaca25225611b23/javablobappendblockac1appendblobapitestappendblockaca2588440b?comp=appendblock", + "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" : "32c6f127-db55-467f-94bf-3d7a4c680f90", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:50 GMT", + "ETag" : "\"0x8D735623AEE139C\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c7c41-901e-0029-3d4b-6796e9000000", + "x-ms-client-request-id" : "32c6f127-db55-467f-94bf-3d7a4c680f90", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockac&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" : "4e1e6923-d7ac-41b3-a83a-ec24dcc01cee" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c7c5b-901e-0029-524b-6796e9000000", + "Body" : "jtcappendblockacjtcappendblockac0appendblobapitestappendblockaca25225611b23Mon, 09 Sep 2019 20:13:50 GMT\"0x8D735623AD41372\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:50 GMT", + "x-ms-client-request-id" : "4e1e6923-d7ac-41b3-a83a-ec24dcc01cee", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockac0appendblobapitestappendblockaca25225611b23?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" : "0a047143-07b0-4ff8-9638-a88f305acd9b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c7c73-901e-0029-684b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:50 GMT", + "x-ms-client-request-id" : "0a047143-07b0-4ff8-9638-a88f305acd9b" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockac0appendblobapitestappendblockaca25225611b23", "javablobappendblockac1appendblobapitestappendblockaca2588440b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[0].json new file mode 100644 index 000000000000..f00a73eb2b9d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[0].json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail05957835e1eaf69813449a80?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" : "4ab4b8c3-5db4-4d76-98b1-5ec753ced991" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623B14D1B8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7c7f-901e-0029-744b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:50 GMT", + "x-ms-client-request-id" : "4ab4b8c3-5db4-4d76-98b1-5ec753ced991" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail05957835e1eaf69813449a80/javablobappendblockacfail153929744e74b3c5584661", + "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" : "ea3c775f-c37e-4944-bfdf-96c71249e092" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623B21FE4A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7c8f-901e-0029-014b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:50 GMT", + "x-ms-client-request-id" : "ea3c775f-c37e-4944-bfdf-96c71249e092" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail05957835e1eaf69813449a80/javablobappendblockacfail153929744e74b3c5584661?comp=appendblock", + "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" : "d0320111-584d-46cb-9183-ca43a73f94ac", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "e27c7c9a-901e-0029-0c4b-6796e9000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:e27c7c9a-901e-0029-0c4b-6796e9000000\nTime:2019-09-09T20:13:51.2213034Z", + "Date" : "Mon, 09 Sep 2019 20:13:50 GMT", + "x-ms-client-request-id" : "d0320111-584d-46cb-9183-ca43a73f94ac", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockacfail&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" : "f709a59e-e704-4aaa-b113-54189dfdf728" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c7c9e-901e-0029-104b-6796e9000000", + "Body" : "jtcappendblockacfailjtcappendblockacfail05957835e1eaf69813449a80Mon, 09 Sep 2019 20:13:51 GMT\"0x8D735623B14D1B8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:50 GMT", + "x-ms-client-request-id" : "f709a59e-e704-4aaa-b113-54189dfdf728", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail05957835e1eaf69813449a80?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" : "fae2549e-6ca4-4daf-979b-67349bc8e4a1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c7cac-901e-0029-1d4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:50 GMT", + "x-ms-client-request-id" : "fae2549e-6ca4-4daf-979b-67349bc8e4a1" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockacfail05957835e1eaf69813449a80", "javablobappendblockacfail153929744e74b3c5584661" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[1].json new file mode 100644 index 000000000000..4122afa9910d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[1].json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail033429ab8f43054cf64f8981?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" : "39d0c73b-bec1-42a6-b323-3fe55eb0dc78" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623B54F3AB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7cc0-901e-0029-2d4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:51 GMT", + "x-ms-client-request-id" : "39d0c73b-bec1-42a6-b323-3fe55eb0dc78" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail033429ab8f43054cf64f8981/javablobappendblockacfail1267458ff0c3f309704079", + "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" : "7e61996b-2996-4746-8424-7758ca860fd0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623B61D1F7\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7cd0-901e-0029-3c4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:51 GMT", + "x-ms-client-request-id" : "7e61996b-2996-4746-8424-7758ca860fd0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail033429ab8f43054cf64f8981/javablobappendblockacfail1267458ff0c3f309704079?comp=appendblock", + "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" : "9889612a-1a9b-4f39-ad9c-c8ad904e78f4", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "e27c7cdd-901e-0029-494b-6796e9000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:e27c7cdd-901e-0029-494b-6796e9000000\nTime:2019-09-09T20:13:51.6365982Z", + "Date" : "Mon, 09 Sep 2019 20:13:51 GMT", + "x-ms-client-request-id" : "9889612a-1a9b-4f39-ad9c-c8ad904e78f4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockacfail&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" : "da03b1d3-b9a5-47fe-a6ef-0d9811368f44" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c7cee-901e-0029-5a4b-6796e9000000", + "Body" : "jtcappendblockacfailjtcappendblockacfail033429ab8f43054cf64f8981Mon, 09 Sep 2019 20:13:51 GMT\"0x8D735623B54F3AB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:51 GMT", + "x-ms-client-request-id" : "da03b1d3-b9a5-47fe-a6ef-0d9811368f44", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail033429ab8f43054cf64f8981?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" : "32462371-1ae7-4a77-be20-f4b33f02f7d4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c7d08-901e-0029-714b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:51 GMT", + "x-ms-client-request-id" : "32462371-1ae7-4a77-be20-f4b33f02f7d4" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockacfail033429ab8f43054cf64f8981", "javablobappendblockacfail1267458ff0c3f309704079" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[2].json new file mode 100644 index 000000000000..4d2aa9368f68 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[2].json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail0232927bee587565524fa9a6?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" : "a8fa98ae-9d07-4cf4-852b-8645b78a385f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623B94C762\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7d11-901e-0029-7a4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:51 GMT", + "x-ms-client-request-id" : "a8fa98ae-9d07-4cf4-852b-8645b78a385f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail0232927bee587565524fa9a6/javablobappendblockacfail170185248bebcbdee540e7", + "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" : "1fb5032a-7678-4931-aa91-0ea009b392b2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623BA1F404\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7d1f-901e-0029-064b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:51 GMT", + "x-ms-client-request-id" : "1fb5032a-7678-4931-aa91-0ea009b392b2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail0232927bee587565524fa9a6/javablobappendblockacfail170185248bebcbdee540e7?comp=appendblock", + "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" : "30a2926b-f90b-4cf6-8280-44d7fe155705", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "e27c7d2d-901e-0029-124b-6796e9000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:e27c7d2d-901e-0029-124b-6796e9000000\nTime:2019-09-09T20:13:52.0568963Z", + "Date" : "Mon, 09 Sep 2019 20:13:51 GMT", + "x-ms-client-request-id" : "30a2926b-f90b-4cf6-8280-44d7fe155705", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockacfail&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" : "2ac4a9d9-4323-4be1-b9c3-395315064a1d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c7d39-901e-0029-1d4b-6796e9000000", + "Body" : "jtcappendblockacfailjtcappendblockacfail0232927bee587565524fa9a6Mon, 09 Sep 2019 20:13:51 GMT\"0x8D735623B94C762\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:51 GMT", + "x-ms-client-request-id" : "2ac4a9d9-4323-4be1-b9c3-395315064a1d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail0232927bee587565524fa9a6?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" : "aff1f2b3-fe3d-423e-b789-f9990f9635b2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c7d43-901e-0029-274b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:51 GMT", + "x-ms-client-request-id" : "aff1f2b3-fe3d-423e-b789-f9990f9635b2" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockacfail0232927bee587565524fa9a6", "javablobappendblockacfail170185248bebcbdee540e7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[3].json new file mode 100644 index 000000000000..65420b14f1c8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[3].json @@ -0,0 +1,142 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail038634faf963293c03462e91?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" : "79a598f4-de0d-45e0-8542-321b8110b6ec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623BD44CEB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7d50-901e-0029-314b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:51 GMT", + "x-ms-client-request-id" : "79a598f4-de0d-45e0-8542-321b8110b6ec" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail038634faf963293c03462e91/javablobappendblockacfail1563993ace217c4b674fbd", + "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" : "b4a26575-d5fe-43c5-866f-bc653070c39a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623BE1046D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7d64-901e-0029-444b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:51 GMT", + "x-ms-client-request-id" : "b4a26575-d5fe-43c5-866f-bc653070c39a" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail038634faf963293c03462e91/javablobappendblockacfail1563993ace217c4b674fbd", + "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" : "26df85ea-e193-4a71-969c-b4b53417f7d8" + }, + "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", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:52 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:13:52 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735623BE1046D\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:13:52 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "e27c7d6c-901e-0029-4c4b-6796e9000000", + "x-ms-client-request-id" : "26df85ea-e193-4a71-969c-b4b53417f7d8", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail038634faf963293c03462e91/javablobappendblockacfail1563993ace217c4b674fbd?comp=appendblock", + "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" : "f3bb0784-9275-4fac-9b37-577f182a429a", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "e27c7d7c-901e-0029-5a4b-6796e9000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:e27c7d7c-901e-0029-5a4b-6796e9000000\nTime:2019-09-09T20:13:52.5512469Z", + "Date" : "Mon, 09 Sep 2019 20:13:52 GMT", + "x-ms-client-request-id" : "f3bb0784-9275-4fac-9b37-577f182a429a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockacfail&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" : "56c883e2-6a8f-4d47-960e-58eaa371e648" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c7d93-901e-0029-704b-6796e9000000", + "Body" : "jtcappendblockacfailjtcappendblockacfail038634faf963293c03462e91Mon, 09 Sep 2019 20:13:52 GMT\"0x8D735623BD44CEB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:52 GMT", + "x-ms-client-request-id" : "56c883e2-6a8f-4d47-960e-58eaa371e648", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail038634faf963293c03462e91?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" : "0012220d-40ad-413d-b2eb-bc21fbca98fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c7da0-901e-0029-7b4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:52 GMT", + "x-ms-client-request-id" : "0012220d-40ad-413d-b2eb-bc21fbca98fc" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockacfail038634faf963293c03462e91", "javablobappendblockacfail1563993ace217c4b674fbd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[4].json new file mode 100644 index 000000000000..a7b27517d5d0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[4].json @@ -0,0 +1,132 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail006482d0a992b25cd8489699?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" : "bddbc008-33eb-489b-ae14-29d7e18725e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623C1F4625\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7dab-901e-0029-064b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:52 GMT", + "x-ms-client-request-id" : "bddbc008-33eb-489b-ae14-29d7e18725e8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail006482d0a992b25cd8489699/javablobappendblockacfail104733ed3e2c5315af4d51", + "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" : "b8379937-3537-40a6-beec-d3e12a6a66c3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623C2CE86E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7db9-901e-0029-124b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:52 GMT", + "x-ms-client-request-id" : "b8379937-3537-40a6-beec-d3e12a6a66c3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail006482d0a992b25cd8489699/javablobappendblockacfail104733ed3e2c5315af4d51?comp=lease", + "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" : "71984095-2ee3-417b-bc6d-2c19ddbf18de" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623C2CE86E\"", + "x-ms-lease-id" : "e4ee7e02-4e6b-4085-8b42-8a178d1dc4d2", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7dcb-901e-0029-214b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:52 GMT", + "x-ms-client-request-id" : "71984095-2ee3-417b-bc6d-2c19ddbf18de" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail006482d0a992b25cd8489699/javablobappendblockacfail104733ed3e2c5315af4d51?comp=appendblock", + "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" : "c925ebda-a9a4-4d37-b8f0-02b1ad72c228", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "e27c7de9-901e-0029-394b-6796e9000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:e27c7de9-901e-0029-394b-6796e9000000\nTime:2019-09-09T20:13:53.0856236Z", + "Date" : "Mon, 09 Sep 2019 20:13:52 GMT", + "x-ms-client-request-id" : "c925ebda-a9a4-4d37-b8f0-02b1ad72c228", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockacfail&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" : "095e414d-9df8-4aad-960d-861cf995e665" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c7dff-901e-0029-4c4b-6796e9000000", + "Body" : "jtcappendblockacfailjtcappendblockacfail006482d0a992b25cd8489699Mon, 09 Sep 2019 20:13:52 GMT\"0x8D735623C1F4625\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:52 GMT", + "x-ms-client-request-id" : "095e414d-9df8-4aad-960d-861cf995e665", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail006482d0a992b25cd8489699?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" : "c5789a42-8e2e-4b51-b6e6-ad741504fe45" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c7e0a-901e-0029-574b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:52 GMT", + "x-ms-client-request-id" : "c5789a42-8e2e-4b51-b6e6-ad741504fe45" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockacfail006482d0a992b25cd8489699", "javablobappendblockacfail104733ed3e2c5315af4d51" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[5].json new file mode 100644 index 000000000000..9aa3ae0dcdb5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[5].json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail07027081268cc0346140adbb?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" : "2456b3a8-ab97-4860-b487-a2e4d4c23ba7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623C7033DC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7e18-901e-0029-624b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:52 GMT", + "x-ms-client-request-id" : "2456b3a8-ab97-4860-b487-a2e4d4c23ba7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail07027081268cc0346140adbb/javablobappendblockacfail113619d1697977160e47c3", + "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" : "dfe7274f-a4ef-4247-9fda-a26ca474e562" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623C7CC4C9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7e26-901e-0029-6f4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:53 GMT", + "x-ms-client-request-id" : "dfe7274f-a4ef-4247-9fda-a26ca474e562" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail07027081268cc0346140adbb/javablobappendblockacfail113619d1697977160e47c3?comp=appendblock", + "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" : "37125efd-e016-48c9-9f8f-cb755b7d763c", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AppendPositionConditionNotMet", + "retry-after" : "0", + "Content-Length" : "250", + "StatusCode" : "412", + "x-ms-request-id" : "e27c7e2d-901e-0029-764b-6796e9000000", + "Body" : "AppendPositionConditionNotMetThe append position condition specified was not met.\nRequestId:e27c7e2d-901e-0029-764b-6796e9000000\nTime:2019-09-09T20:13:53.4919095Z", + "Date" : "Mon, 09 Sep 2019 20:13:53 GMT", + "x-ms-client-request-id" : "37125efd-e016-48c9-9f8f-cb755b7d763c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockacfail&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" : "ff4d63a5-9ddf-4c7b-ab56-abf433590d88" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c7e39-901e-0029-804b-6796e9000000", + "Body" : "jtcappendblockacfailjtcappendblockacfail07027081268cc0346140adbbMon, 09 Sep 2019 20:13:53 GMT\"0x8D735623C7033DC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:53 GMT", + "x-ms-client-request-id" : "ff4d63a5-9ddf-4c7b-ab56-abf433590d88", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail07027081268cc0346140adbb?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" : "baf92acb-9379-4fc6-b00e-8daca2b42080" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c7e4b-901e-0029-114b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:53 GMT", + "x-ms-client-request-id" : "baf92acb-9379-4fc6-b00e-8daca2b42080" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockacfail07027081268cc0346140adbb", "javablobappendblockacfail113619d1697977160e47c3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[6].json new file mode 100644 index 000000000000..255ccbf42786 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockacfail[6].json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail0328806602fe9957a24132b5?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" : "f3ede7e1-ca00-4866-ae06-221a672e9f2d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623CAE5993\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7e58-901e-0029-1c4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:53 GMT", + "x-ms-client-request-id" : "f3ede7e1-ca00-4866-ae06-221a672e9f2d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail0328806602fe9957a24132b5/javablobappendblockacfail195613fd9cdff22ee844c3", + "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" : "45052f3c-a124-4993-9788-95f4125ee3b4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623CBAEAA3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7e69-901e-0029-294b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:53 GMT", + "x-ms-client-request-id" : "45052f3c-a124-4993-9788-95f4125ee3b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail0328806602fe9957a24132b5/javablobappendblockacfail195613fd9cdff22ee844c3?comp=appendblock", + "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" : "25d75671-33df-47eb-9766-d980cf124027", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "MaxBlobSizeConditionNotMet", + "retry-after" : "0", + "Content-Length" : "245", + "StatusCode" : "412", + "x-ms-request-id" : "e27c7e7e-901e-0029-3c4b-6796e9000000", + "Body" : "MaxBlobSizeConditionNotMetThe max blob size condition specified was not met.\nRequestId:e27c7e7e-901e-0029-3c4b-6796e9000000\nTime:2019-09-09T20:13:53.8981985Z", + "Date" : "Mon, 09 Sep 2019 20:13:53 GMT", + "x-ms-client-request-id" : "25d75671-33df-47eb-9766-d980cf124027", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockacfail&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" : "79742a57-5292-4a09-8a6e-2e48bca23499" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c7e8b-901e-0029-494b-6796e9000000", + "Body" : "jtcappendblockacfailjtcappendblockacfail0328806602fe9957a24132b5Mon, 09 Sep 2019 20:13:53 GMT\"0x8D735623CAE5993\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:53 GMT", + "x-ms-client-request-id" : "79742a57-5292-4a09-8a6e-2e48bca23499", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockacfail0328806602fe9957a24132b5?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" : "4bcd3a59-a88a-4a3c-97d9-854ff804cb6d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c7e97-901e-0029-544b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:53 GMT", + "x-ms-client-request-id" : "4bcd3a59-a88a-4a3c-97d9-854ff804cb6d" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockacfail0328806602fe9957a24132b5", "javablobappendblockacfail195613fd9cdff22ee844c3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockdefaults.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockdefaults.json new file mode 100644 index 000000000000..55e61e1bec7d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockdefaults.json @@ -0,0 +1,176 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockdefaults077994b68ec740bdaa46549?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" : "3517c34f-8b90-49ff-bf56-ecc709e153cc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562378DD756\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "034814e8-301e-0024-7b4b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:44 GMT", + "x-ms-client-request-id" : "3517c34f-8b90-49ff-bf56-ecc709e153cc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockdefaults077994b68ec740bdaa46549/javablobappendblockdefaults155688e4e7777a16764b8", + "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" : "df5f98a9-ae2b-4e17-ad65-a3cae33459f4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356237A0221B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "034814f5-301e-0024-064b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:44 GMT", + "x-ms-client-request-id" : "df5f98a9-ae2b-4e17-ad65-a3cae33459f4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockdefaults077994b68ec740bdaa46549/javablobappendblockdefaults155688e4e7777a16764b8?comp=appendblock", + "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" : "67a1c3db-a46e-42f6-a688-4d5b4980f0bf", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:44 GMT", + "ETag" : "\"0x8D7356237B02AA1\"", + "Content-Length" : "0", + "x-ms-request-id" : "03481512-301e-0024-224b-6779e5000000", + "x-ms-client-request-id" : "67a1c3db-a46e-42f6-a688-4d5b4980f0bf", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockdefaults077994b68ec740bdaa46549/javablobappendblockdefaults155688e4e7777a16764b8", + "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" : "43f90fbe-01b8-45e0-89fc-644e85267b62" + }, + "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", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:45 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:13:44 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D7356237B02AA1\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:13:45 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "0348152c-301e-0024-3a4b-6779e5000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "43f90fbe-01b8-45e0-89fc-644e85267b62", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockdefaults077994b68ec740bdaa46549/javablobappendblockdefaults155688e4e7777a16764b8", + "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" : "95388030-42de-45e3-bcc2-53e9c226f2e3" + }, + "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", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:45 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:13:45 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7356237B02AA1\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:13:45 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "03481549-301e-0024-574b-6779e5000000", + "x-ms-client-request-id" : "95388030-42de-45e3-bcc2-53e9c226f2e3", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockdefaults&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" : "c3bd5a49-bc31-431f-9551-3a60ad7fa1da" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "03481553-301e-0024-614b-6779e5000000", + "Body" : "jtcappendblockdefaultsjtcappendblockdefaults077994b68ec740bdaa46549Mon, 09 Sep 2019 20:13:45 GMT\"0x8D73562378DD756\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:45 GMT", + "x-ms-client-request-id" : "c3bd5a49-bc31-431f-9551-3a60ad7fa1da", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockdefaults077994b68ec740bdaa46549?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" : "e82c2a2e-b0d2-46cb-8e9e-b9add526f3f0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "03481561-301e-0024-6f4b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:45 GMT", + "x-ms-client-request-id" : "e82c2a2e-b0d2-46cb-8e9e-b9add526f3f0" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockdefaults077994b68ec740bdaa46549", "javablobappendblockdefaults155688e4e7777a16764b8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockemptybody.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockemptybody.json new file mode 100644 index 000000000000..f8206d869624 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockemptybody.json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockemptybody034850414aa9baa74a4f03b?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" : "2e1d4fbe-315e-4f07-9259-477a88e15058" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623887E3BB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c795e-901e-0029-1f4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:46 GMT", + "x-ms-client-request-id" : "2e1d4fbe-315e-4f07-9259-477a88e15058" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockemptybody034850414aa9baa74a4f03b/javablobappendblockemptybody130634fbc3b3bf501e4f", + "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" : "cbd1ff14-fef2-434a-8117-24b802b08fd0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356238953678\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7971-901e-0029-314b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:46 GMT", + "x-ms-client-request-id" : "cbd1ff14-fef2-434a-8117-24b802b08fd0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockemptybody034850414aa9baa74a4f03b/javablobappendblockemptybody130634fbc3b3bf501e4f?comp=appendblock", + "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" : "e56a022f-6cb9-431c-984d-c2be2d856c18", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "e27c7981-901e-0029-3f4b-6796e9000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:e27c7981-901e-0029-3f4b-6796e9000000\nTime:2019-09-09T20:13:46.9412632ZContent-Length0", + "Date" : "Mon, 09 Sep 2019 20:13:46 GMT", + "x-ms-client-request-id" : "e56a022f-6cb9-431c-984d-c2be2d856c18", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockemptybody&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" : "cf875701-9620-43b6-b9d3-a0baefb58c9a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c798f-901e-0029-4b4b-6796e9000000", + "Body" : "jtcappendblockemptybodyjtcappendblockemptybody034850414aa9baa74a4f03bMon, 09 Sep 2019 20:13:46 GMT\"0x8D735623887E3BB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:46 GMT", + "x-ms-client-request-id" : "cf875701-9620-43b6-b9d3-a0baefb58c9a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockemptybody034850414aa9baa74a4f03b?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" : "dd09451e-65ab-42e7-8f39-5adb38c342dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c79a7-901e-0029-604b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:46 GMT", + "x-ms-client-request-id" : "dd09451e-65ab-42e7-8f39-5adb38c342dc" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockemptybody034850414aa9baa74a4f03b", "javablobappendblockemptybody130634fbc3b3bf501e4f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockerror.json new file mode 100644 index 000000000000..95f21b595668 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockerror.json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockerror0appendblobapitestappendblockerrora77431932?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" : "a5c3be9a-0d6c-40ce-9b3e-f15505319063" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623CED9100\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7eb9-901e-0029-724b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:53 GMT", + "x-ms-client-request-id" : "a5c3be9a-0d6c-40ce-9b3e-f15505319063" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockerror0appendblobapitestappendblockerrora77431932/javablobappendblockerror11430971db3155ff2046dd", + "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" : "aa69d511-b434-4a8b-8922-6bc80214d51f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623CFB0CAD\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7ed3-901e-0029-094b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:53 GMT", + "x-ms-client-request-id" : "aa69d511-b434-4a8b-8922-6bc80214d51f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockerror0appendblobapitestappendblockerrora77431932/javablobappendblockerror284953ef86eeac2f4347f7?comp=appendblock", + "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" : "3088ba5b-6c63-4111-a127-b6f5c43bdcfc", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "BlobNotFound", + "retry-after" : "0", + "Content-Length" : "215", + "StatusCode" : "404", + "x-ms-request-id" : "e27c7edd-901e-0029-124b-6796e9000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:e27c7edd-901e-0029-124b-6796e9000000\nTime:2019-09-09T20:13:54.3225008Z", + "Date" : "Mon, 09 Sep 2019 20:13:53 GMT", + "x-ms-client-request-id" : "3088ba5b-6c63-4111-a127-b6f5c43bdcfc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockerror&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" : "140eee8e-f056-4e19-bdb2-081b94ba6e13" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c7ee7-901e-0029-1c4b-6796e9000000", + "Body" : "jtcappendblockerrorjtcappendblockerror0appendblobapitestappendblockerrora77431932Mon, 09 Sep 2019 20:13:54 GMT\"0x8D735623CED9100\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:53 GMT", + "x-ms-client-request-id" : "140eee8e-f056-4e19-bdb2-081b94ba6e13", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockerror0appendblobapitestappendblockerrora77431932?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" : "739f1b1b-aa10-4109-8503-1255eaafa828" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c7ef0-901e-0029-254b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:54 GMT", + "x-ms-client-request-id" : "739f1b1b-aa10-4109-8503-1255eaafa828" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockerror0appendblobapitestappendblockerrora77431932", "javablobappendblockerror11430971db3155ff2046dd", "javablobappendblockerror284953ef86eeac2f4347f7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[0].json new file mode 100644 index 000000000000..acd43d76d3dd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[0].json @@ -0,0 +1,179 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail073902a94ee8477?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" : "df183447-61e3-4c78-9116-72e125c9f1bb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735624248792D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8575-901e-0029-184b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:02 GMT", + "x-ms-client-request-id" : "df183447-61e3-4c78-9116-72e125c9f1bb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail073902a94ee8477/javablobappendblockfromurlacdestinationfail11574425d27b9", + "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" : "b1023d5a-2298-4d2f-b2b3-c6031f2ce1a7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735624255CFEB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8580-901e-0029-224b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:02 GMT", + "x-ms-client-request-id" : "b1023d5a-2298-4d2f-b2b3-c6031f2ce1a7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail073902a94ee8477?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" : "570c449c-43e8-4890-b830-404a63209133", + "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" : "\"0x8D73562426223A6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8599-901e-0029-364b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:02 GMT", + "x-ms-client-request-id" : "570c449c-43e8-4890-b830-404a63209133" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail073902a94ee8477/javablobappendblockfromurlacdestinationfail227324f606167", + "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" : "8db14c72-a136-469a-bf95-1a7cc3d3018b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562426FEC61\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c85a5-901e-0029-414b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:02 GMT", + "x-ms-client-request-id" : "8db14c72-a136-469a-bf95-1a7cc3d3018b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail073902a94ee8477/javablobappendblockfromurlacdestinationfail227324f606167?comp=appendblock", + "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" : "4c8968ad-55a2-41b3-974e-85b6b5e4c7d8", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:03 GMT", + "ETag" : "\"0x8D73562427D354A\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c85ac-901e-0029-484b-6796e9000000", + "x-ms-client-request-id" : "4c8968ad-55a2-41b3-974e-85b6b5e4c7d8", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail073902a94ee8477/javablobappendblockfromurlacdestinationfail11574425d27b9?comp=appendblock", + "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" : "8469800c-c5fa-42af-aab8-ea011fbd32f7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "253", + "StatusCode" : "412", + "x-ms-request-id" : "e27c85bc-901e-0029-584b-6796e9000000", + "Body" : "\nConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:e27c85bc-901e-0029-584b-6796e9000000\nTime:2019-09-09T20:14:03.5630574Z", + "Date" : "Mon, 09 Sep 2019 20:14:03 GMT", + "x-ms-client-request-id" : "8469800c-c5fa-42af-aab8-ea011fbd32f7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurlacdestinationfail&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" : "e52d584d-fc71-4028-84f7-a3524056a18e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c85d5-901e-0029-704b-6796e9000000", + "Body" : "jtcappendblockfromurlacdestinationfailjtcappendblockfromurlacdestinationfail073902a94ee8477Mon, 09 Sep 2019 20:14:03 GMT\"0x8D73562426223A6\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:14:03 GMT", + "x-ms-client-request-id" : "e52d584d-fc71-4028-84f7-a3524056a18e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail073902a94ee8477?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" : "b52b2e37-c9ce-462c-aacd-c9915a738e29" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c85e8-901e-0029-804b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:03 GMT", + "x-ms-client-request-id" : "b52b2e37-c9ce-462c-aacd-c9915a738e29" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacdestinationfail073902a94ee8477", "javablobappendblockfromurlacdestinationfail11574425d27b9", "javablobappendblockfromurlacdestinationfail227324f606167" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[1].json new file mode 100644 index 000000000000..4fe68e67a9ae --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[1].json @@ -0,0 +1,179 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail04292088559ad80?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" : "f8b09bb5-b994-4306-927a-a8e68767e91d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356242B00051\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c85f0-901e-0029-084b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:03 GMT", + "x-ms-client-request-id" : "f8b09bb5-b994-4306-927a-a8e68767e91d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail04292088559ad80/javablobappendblockfromurlacdestinationfail11657027c99ef", + "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" : "763824e7-db20-477b-b52a-33010c45b4e7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356242BDCC95\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c85fc-901e-0029-124b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:03 GMT", + "x-ms-client-request-id" : "763824e7-db20-477b-b52a-33010c45b4e7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail04292088559ad80?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" : "b5327db9-a90b-434e-aa57-a40e71fea0e0", + "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" : "\"0x8D7356242CA473C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8609-901e-0029-1e4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:03 GMT", + "x-ms-client-request-id" : "b5327db9-a90b-434e-aa57-a40e71fea0e0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail04292088559ad80/javablobappendblockfromurlacdestinationfail23676140bd171", + "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" : "058facac-27b9-423d-9067-75bd537850a8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356242D81025\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8615-901e-0029-2a4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:03 GMT", + "x-ms-client-request-id" : "058facac-27b9-423d-9067-75bd537850a8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail04292088559ad80/javablobappendblockfromurlacdestinationfail23676140bd171?comp=appendblock", + "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" : "015a59cc-6011-4daa-b953-3f9537695278", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:03 GMT", + "ETag" : "\"0x8D7356242E58022\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c861b-901e-0029-304b-6796e9000000", + "x-ms-client-request-id" : "015a59cc-6011-4daa-b953-3f9537695278", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail04292088559ad80/javablobappendblockfromurlacdestinationfail11657027c99ef?comp=appendblock", + "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" : "f734ba09-e588-40ad-a42f-82b90f03c35e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "253", + "StatusCode" : "412", + "x-ms-request-id" : "e27c8626-901e-0029-3b4b-6796e9000000", + "Body" : "\nConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:e27c8626-901e-0029-3b4b-6796e9000000\nTime:2019-09-09T20:14:04.2565507Z", + "Date" : "Mon, 09 Sep 2019 20:14:03 GMT", + "x-ms-client-request-id" : "f734ba09-e588-40ad-a42f-82b90f03c35e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurlacdestinationfail&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" : "3161e4bf-d222-41dd-b60f-e0f32253f40d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c863e-901e-0029-534b-6796e9000000", + "Body" : "jtcappendblockfromurlacdestinationfailjtcappendblockfromurlacdestinationfail04292088559ad80Mon, 09 Sep 2019 20:14:03 GMT\"0x8D7356242CA473C\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:14:03 GMT", + "x-ms-client-request-id" : "3161e4bf-d222-41dd-b60f-e0f32253f40d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail04292088559ad80?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" : "9e3b65dd-793e-474f-8677-43c9a50f76a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c8652-901e-0029-654b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:03 GMT", + "x-ms-client-request-id" : "9e3b65dd-793e-474f-8677-43c9a50f76a4" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacdestinationfail04292088559ad80", "javablobappendblockfromurlacdestinationfail11657027c99ef", "javablobappendblockfromurlacdestinationfail23676140bd171" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[2].json new file mode 100644 index 000000000000..4739422202e9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[2].json @@ -0,0 +1,179 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail028650cb5dabbed?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" : "dc2971d8-13eb-476d-a9e9-717114e2a930" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562431C6A6D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8667-901e-0029-794b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:04 GMT", + "x-ms-client-request-id" : "dc2971d8-13eb-476d-a9e9-717114e2a930" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail028650cb5dabbed/javablobappendblockfromurlacdestinationfail1033638a73308", + "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" : "2bf5b7a3-4849-419b-84e3-db3059e800eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562432A5DF6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8677-901e-0029-074b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:04 GMT", + "x-ms-client-request-id" : "2bf5b7a3-4849-419b-84e3-db3059e800eb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail028650cb5dabbed?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" : "3bcbc32a-d7ca-4a72-b1c5-060e6ba98f15", + "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" : "\"0x8D735624336B170\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8686-901e-0029-154b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:04 GMT", + "x-ms-client-request-id" : "3bcbc32a-d7ca-4a72-b1c5-060e6ba98f15" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail028650cb5dabbed/javablobappendblockfromurlacdestinationfail2283661c46718", + "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" : "dc6c15c4-019b-4b48-93a2-dc59f7a6ce96" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735624358A24C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c86ab-901e-0029-384b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:04 GMT", + "x-ms-client-request-id" : "dc6c15c4-019b-4b48-93a2-dc59f7a6ce96" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail028650cb5dabbed/javablobappendblockfromurlacdestinationfail2283661c46718?comp=appendblock", + "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" : "b2d681a4-284d-4105-915d-5cd31617d516", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:04 GMT", + "ETag" : "\"0x8D73562436527BD\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c86b7-901e-0029-424b-6796e9000000", + "x-ms-client-request-id" : "b2d681a4-284d-4105-915d-5cd31617d516", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail028650cb5dabbed/javablobappendblockfromurlacdestinationfail1033638a73308?comp=appendblock", + "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" : "6634ae89-bb74-4a3d-a0c5-bb27bbf1bead" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "253", + "StatusCode" : "412", + "x-ms-request-id" : "e27c86c8-901e-0029-524b-6796e9000000", + "Body" : "\nConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:e27c86c8-901e-0029-524b-6796e9000000\nTime:2019-09-09T20:14:05.0781341Z", + "Date" : "Mon, 09 Sep 2019 20:14:04 GMT", + "x-ms-client-request-id" : "6634ae89-bb74-4a3d-a0c5-bb27bbf1bead", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurlacdestinationfail&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" : "1699a901-3d1c-4d35-a3e6-212d67585ab4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c86cd-901e-0029-574b-6796e9000000", + "Body" : "jtcappendblockfromurlacdestinationfailjtcappendblockfromurlacdestinationfail028650cb5dabbedMon, 09 Sep 2019 20:14:04 GMT\"0x8D735624336B170\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:14:04 GMT", + "x-ms-client-request-id" : "1699a901-3d1c-4d35-a3e6-212d67585ab4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail028650cb5dabbed?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" : "c7d24d43-962c-4614-94c1-5df8f0729098" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c86d6-901e-0029-5f4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:04 GMT", + "x-ms-client-request-id" : "c7d24d43-962c-4614-94c1-5df8f0729098" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacdestinationfail028650cb5dabbed", "javablobappendblockfromurlacdestinationfail1033638a73308", "javablobappendblockfromurlacdestinationfail2283661c46718" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[3].json new file mode 100644 index 000000000000..bd8b7d6e4bbe --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[3].json @@ -0,0 +1,211 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0878527c8647488?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" : "278dcca0-b4b2-43d4-b582-cbcde493a93d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735624397CB5D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c86eb-901e-0029-724b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:04 GMT", + "x-ms-client-request-id" : "278dcca0-b4b2-43d4-b582-cbcde493a93d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0878527c8647488/javablobappendblockfromurlacdestinationfail119406fc8cad8", + "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" : "f5dc0c93-6339-4af3-98ba-9b0c6c48d04b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356243A4FB77\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c86f8-901e-0029-7c4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:04 GMT", + "x-ms-client-request-id" : "f5dc0c93-6339-4af3-98ba-9b0c6c48d04b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0878527c8647488?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" : "e927c551-7b1b-4016-b7d1-3337b39aee86", + "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" : "\"0x8D7356243B127CF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8706-901e-0029-094b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:05 GMT", + "x-ms-client-request-id" : "e927c551-7b1b-4016-b7d1-3337b39aee86" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0878527c8647488/javablobappendblockfromurlacdestinationfail119406fc8cad8", + "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" : "217ce2da-3fb7-4844-bf99-05c23a617640" + }, + "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", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:05 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:14:05 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7356243A4FB77\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:14:05 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "e27c8717-901e-0029-194b-6796e9000000", + "x-ms-client-request-id" : "217ce2da-3fb7-4844-bf99-05c23a617640", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0878527c8647488/javablobappendblockfromurlacdestinationfail257840b618486", + "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" : "5db04886-e347-4896-876b-b85c257c2fd1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356243CA1670\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c871b-901e-0029-1d4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:05 GMT", + "x-ms-client-request-id" : "5db04886-e347-4896-876b-b85c257c2fd1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0878527c8647488/javablobappendblockfromurlacdestinationfail257840b618486?comp=appendblock", + "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" : "4690aa50-2112-4361-812f-5a3176d3bb00", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:05 GMT", + "ETag" : "\"0x8D7356243D69BDE\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c8726-901e-0029-274b-6796e9000000", + "x-ms-client-request-id" : "4690aa50-2112-4361-812f-5a3176d3bb00", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0878527c8647488/javablobappendblockfromurlacdestinationfail119406fc8cad8?comp=appendblock", + "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" : "6151643f-6eaf-4ce9-b837-67b0f3de4817" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "253", + "StatusCode" : "412", + "x-ms-request-id" : "e27c8740-901e-0029-3f4b-6796e9000000", + "Body" : "\nConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:e27c8740-901e-0029-3f4b-6796e9000000\nTime:2019-09-09T20:14:05.8586886Z", + "Date" : "Mon, 09 Sep 2019 20:14:05 GMT", + "x-ms-client-request-id" : "6151643f-6eaf-4ce9-b837-67b0f3de4817", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurlacdestinationfail&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" : "7f3986f4-7207-45cc-b01c-04a2573be68e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8759-901e-0029-584b-6796e9000000", + "Body" : "jtcappendblockfromurlacdestinationfailjtcappendblockfromurlacdestinationfail0878527c8647488Mon, 09 Sep 2019 20:14:05 GMT\"0x8D7356243B127CF\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:14:05 GMT", + "x-ms-client-request-id" : "7f3986f4-7207-45cc-b01c-04a2573be68e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0878527c8647488?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" : "b69cdaff-ed70-4e20-a95a-c91516be4969" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c8768-901e-0029-664b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:05 GMT", + "x-ms-client-request-id" : "b69cdaff-ed70-4e20-a95a-c91516be4969" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacdestinationfail0878527c8647488", "javablobappendblockfromurlacdestinationfail119406fc8cad8", "javablobappendblockfromurlacdestinationfail257840b618486" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[4].json new file mode 100644 index 000000000000..56105a76e816 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[4].json @@ -0,0 +1,201 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0657107ca4c733c?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" : "0273b661-94a8-47e4-bcad-12b5c84eaffc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562440E4969\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8778-901e-0029-764b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:05 GMT", + "x-ms-client-request-id" : "0273b661-94a8-47e4-bcad-12b5c84eaffc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0657107ca4c733c/javablobappendblockfromurlacdestinationfail1162670d4567b", + "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" : "5253774b-c05a-4dc9-a568-f9f4ac542d51" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562441BA0CC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8788-901e-0029-044b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:05 GMT", + "x-ms-client-request-id" : "5253774b-c05a-4dc9-a568-f9f4ac542d51" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0657107ca4c733c?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" : "d29b6935-5a19-4e15-9dd3-cbad1b600682", + "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" : "\"0x8D735624427F42D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8795-901e-0029-104b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:05 GMT", + "x-ms-client-request-id" : "d29b6935-5a19-4e15-9dd3-cbad1b600682" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0657107ca4c733c/javablobappendblockfromurlacdestinationfail1162670d4567b?comp=lease", + "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" : "6e9a1219-2ebd-4dc2-b52d-0335d3dfd1a0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562441BA0CC\"", + "x-ms-lease-id" : "28635823-8b50-42af-b12f-337db8339f96", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c879d-901e-0029-184b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:05 GMT", + "x-ms-client-request-id" : "6e9a1219-2ebd-4dc2-b52d-0335d3dfd1a0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0657107ca4c733c/javablobappendblockfromurlacdestinationfail29724490ee95a", + "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" : "a2453a8a-6f64-4d53-a6e1-83a3a64c418c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356244421B9F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c87a9-901e-0029-234b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:05 GMT", + "x-ms-client-request-id" : "a2453a8a-6f64-4d53-a6e1-83a3a64c418c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0657107ca4c733c/javablobappendblockfromurlacdestinationfail29724490ee95a?comp=appendblock", + "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" : "9f102e6d-3da3-4483-8558-1cc572ad727e", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:06 GMT", + "ETag" : "\"0x8D73562444E79F8\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c87b7-901e-0029-314b-6796e9000000", + "x-ms-client-request-id" : "9f102e6d-3da3-4483-8558-1cc572ad727e", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0657107ca4c733c/javablobappendblockfromurlacdestinationfail1162670d4567b?comp=appendblock", + "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" : "9bbb24ec-51c6-4ac6-ba08-5277487af542" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "e27c87be-901e-0029-384b-6796e9000000", + "Body" : "\nLeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:e27c87be-901e-0029-384b-6796e9000000\nTime:2019-09-09T20:14:06.6382422Z", + "Date" : "Mon, 09 Sep 2019 20:14:06 GMT", + "x-ms-client-request-id" : "9bbb24ec-51c6-4ac6-ba08-5277487af542", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurlacdestinationfail&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" : "ea114bbb-4e5a-4655-8a0a-158e106783f5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c87d4-901e-0029-4e4b-6796e9000000", + "Body" : "jtcappendblockfromurlacdestinationfailjtcappendblockfromurlacdestinationfail0657107ca4c733cMon, 09 Sep 2019 20:14:06 GMT\"0x8D735624427F42D\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:14:06 GMT", + "x-ms-client-request-id" : "ea114bbb-4e5a-4655-8a0a-158e106783f5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0657107ca4c733c?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" : "b7e1a72d-f585-43ab-9c12-b6be84feed91" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c87e2-901e-0029-5b4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:06 GMT", + "x-ms-client-request-id" : "b7e1a72d-f585-43ab-9c12-b6be84feed91" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacdestinationfail0657107ca4c733c", "javablobappendblockfromurlacdestinationfail1162670d4567b", "javablobappendblockfromurlacdestinationfail29724490ee95a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[5].json new file mode 100644 index 000000000000..4f9fd8c7ed5b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[5].json @@ -0,0 +1,179 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0474225a1e32f68?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" : "a869465d-4981-4e43-b48c-eeda1e4cdb75" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735624484EE8A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c87f0-901e-0029-654b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:06 GMT", + "x-ms-client-request-id" : "a869465d-4981-4e43-b48c-eeda1e4cdb75" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0474225a1e32f68/javablobappendblockfromurlacdestinationfail169794307cf32", + "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" : "71dcd5ea-5ce9-4cd5-974d-559a8f7e5f88" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562449182B7\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8802-901e-0029-754b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:06 GMT", + "x-ms-client-request-id" : "71dcd5ea-5ce9-4cd5-974d-559a8f7e5f88" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0474225a1e32f68?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" : "f664e67b-64f6-4ec8-bd8c-553ba8c6096e", + "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" : "\"0x8D73562449DAEED\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c880d-901e-0029-7f4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:06 GMT", + "x-ms-client-request-id" : "f664e67b-64f6-4ec8-bd8c-553ba8c6096e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0474225a1e32f68/javablobappendblockfromurlacdestinationfail2854385ddaf16", + "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" : "7eb8865c-4ab8-45e1-b7f7-e7193204791a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356244AADBBF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c881b-901e-0029-0d4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:06 GMT", + "x-ms-client-request-id" : "7eb8865c-4ab8-45e1-b7f7-e7193204791a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0474225a1e32f68/javablobappendblockfromurlacdestinationfail2854385ddaf16?comp=appendblock", + "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" : "df6e25a3-c0a8-452f-b1d9-b19f2d9b69c5", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:06 GMT", + "ETag" : "\"0x8D7356244B7D671\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c882e-901e-0029-1d4b-6796e9000000", + "x-ms-client-request-id" : "df6e25a3-c0a8-452f-b1d9-b19f2d9b69c5", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0474225a1e32f68/javablobappendblockfromurlacdestinationfail169794307cf32?comp=appendblock", + "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" : "38302540-4310-4e47-ba84-32cc37f84bff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AppendPositionConditionNotMet", + "retry-after" : "0", + "Content-Length" : "251", + "StatusCode" : "412", + "x-ms-request-id" : "e27c883e-901e-0029-284b-6796e9000000", + "Body" : "\nAppendPositionConditionNotMetThe append position condition specified was not met.\nRequestId:e27c883e-901e-0029-284b-6796e9000000\nTime:2019-09-09T20:14:07.3457450Z", + "Date" : "Mon, 09 Sep 2019 20:14:06 GMT", + "x-ms-client-request-id" : "38302540-4310-4e47-ba84-32cc37f84bff", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurlacdestinationfail&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" : "892d87f8-8c88-48b9-8067-10c2ce5b8a65" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8856-901e-0029-3d4b-6796e9000000", + "Body" : "jtcappendblockfromurlacdestinationfailjtcappendblockfromurlacdestinationfail0474225a1e32f68Mon, 09 Sep 2019 20:14:07 GMT\"0x8D73562449DAEED\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:14:06 GMT", + "x-ms-client-request-id" : "892d87f8-8c88-48b9-8067-10c2ce5b8a65", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0474225a1e32f68?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" : "53804d4f-e4ab-4dd6-b957-7e66d7bad3a7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c8865-901e-0029-4c4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:07 GMT", + "x-ms-client-request-id" : "53804d4f-e4ab-4dd6-b957-7e66d7bad3a7" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacdestinationfail0474225a1e32f68", "javablobappendblockfromurlacdestinationfail169794307cf32", "javablobappendblockfromurlacdestinationfail2854385ddaf16" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[6].json new file mode 100644 index 000000000000..e9a017640f9f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacdestinationfail[6].json @@ -0,0 +1,179 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0422823308e7ff5?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" : "59d4c89c-f5ce-4af1-ae4b-d13d8273dbe5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356244F1CDFB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c887b-901e-0029-614b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:07 GMT", + "x-ms-client-request-id" : "59d4c89c-f5ce-4af1-ae4b-d13d8273dbe5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0422823308e7ff5/javablobappendblockfromurlacdestinationfail188871499b001", + "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" : "336ecae6-2fad-455d-8d8e-6d065eb872a6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356244FFC21A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c888f-901e-0029-744b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:07 GMT", + "x-ms-client-request-id" : "336ecae6-2fad-455d-8d8e-6d065eb872a6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0422823308e7ff5?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" : "1a9cf627-1f45-48eb-8209-74a3adc54444", + "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" : "\"0x8D73562450BEE1F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c889a-901e-0029-7f4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:07 GMT", + "x-ms-client-request-id" : "1a9cf627-1f45-48eb-8209-74a3adc54444" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0422823308e7ff5/javablobappendblockfromurlacdestinationfail2715750e9a582", + "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" : "61103724-8685-4e9f-8298-2e5f8d84e7f8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735624518F409\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c88a8-901e-0029-0d4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:07 GMT", + "x-ms-client-request-id" : "61103724-8685-4e9f-8298-2e5f8d84e7f8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0422823308e7ff5/javablobappendblockfromurlacdestinationfail2715750e9a582?comp=appendblock", + "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" : "91848344-b80e-464f-8184-fc32e46a3fef", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:07 GMT", + "ETag" : "\"0x8D7356245266403\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c88bb-901e-0029-1f4b-6796e9000000", + "x-ms-client-request-id" : "91848344-b80e-464f-8184-fc32e46a3fef", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0422823308e7ff5/javablobappendblockfromurlacdestinationfail188871499b001?comp=appendblock", + "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" : "018cc2d0-ac1c-46eb-a7c0-a8900b485fbe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "MaxBlobSizeConditionNotMet", + "retry-after" : "0", + "Content-Length" : "246", + "StatusCode" : "412", + "x-ms-request-id" : "e27c88d4-901e-0029-354b-6796e9000000", + "Body" : "\nMaxBlobSizeConditionNotMetThe max blob size condition specified was not met.\nRequestId:e27c88d4-901e-0029-354b-6796e9000000\nTime:2019-09-09T20:14:08.0722611Z", + "Date" : "Mon, 09 Sep 2019 20:14:07 GMT", + "x-ms-client-request-id" : "018cc2d0-ac1c-46eb-a7c0-a8900b485fbe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurlacdestinationfail&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" : "f26df8d3-3dab-4e59-8a86-c1f2db3c0c79" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c88e9-901e-0029-4a4b-6796e9000000", + "Body" : "jtcappendblockfromurlacdestinationfailjtcappendblockfromurlacdestinationfail0422823308e7ff5Mon, 09 Sep 2019 20:14:07 GMT\"0x8D73562450BEE1F\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:14:07 GMT", + "x-ms-client-request-id" : "f26df8d3-3dab-4e59-8a86-c1f2db3c0c79", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacdestinationfail0422823308e7ff5?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" : "4c6a150c-09bf-4339-aaae-8abb01b47f5a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c88f2-901e-0029-524b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:07 GMT", + "x-ms-client-request-id" : "4c6a150c-09bf-4339-aaae-8abb01b47f5a" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacdestinationfail0422823308e7ff5", "javablobappendblockfromurlacdestinationfail188871499b001", "javablobappendblockfromurlacdestinationfail2715750e9a582" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacsourcefail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacsourcefail[0].json new file mode 100644 index 000000000000..6ac360a91ad2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacsourcefail[0].json @@ -0,0 +1,176 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail026717447c7532a6fa?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" : "bcfbe253-6cee-4050-b5fb-84ea2aa6a111" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562477E1F93\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8b8d-901e-0029-384b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:11 GMT", + "x-ms-client-request-id" : "bcfbe253-6cee-4050-b5fb-84ea2aa6a111" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail026717447c7532a6fa/javablobappendblockfromurlacsourcefail191304ded57ed69", + "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" : "025deced-b553-48ba-992e-1c1c3320d8d0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562478B2A31\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8b98-901e-0029-424b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:11 GMT", + "x-ms-client-request-id" : "025deced-b553-48ba-992e-1c1c3320d8d0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail026717447c7532a6fa?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" : "7f842567-051f-415e-bbba-40f26f82888e", + "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" : "\"0x8D7356247972E85\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8ba0-901e-0029-4a4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:11 GMT", + "x-ms-client-request-id" : "7f842567-051f-415e-bbba-40f26f82888e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail026717447c7532a6fa/javablobappendblockfromurlacsourcefail293488c6ec8799f", + "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" : "5cb2b07e-ff99-46da-9dd7-a54f9b44df16" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356247A4D168\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8bae-901e-0029-564b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:11 GMT", + "x-ms-client-request-id" : "5cb2b07e-ff99-46da-9dd7-a54f9b44df16" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail026717447c7532a6fa/javablobappendblockfromurlacsourcefail293488c6ec8799f?comp=appendblock", + "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" : "1a9f00d7-2f5e-463a-963b-2d5f444bcb49", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:11 GMT", + "ETag" : "\"0x8D7356247B24161\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c8bbd-901e-0029-644b-6796e9000000", + "x-ms-client-request-id" : "1a9f00d7-2f5e-463a-963b-2d5f444bcb49", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail026717447c7532a6fa/javablobappendblockfromurlacsourcefail191304ded57ed69?comp=appendblock", + "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" : "05d630b3-7c59-4765-a0b4-ad31d0d954fb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "e27c8bcc-901e-0029-724b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:11 GMT", + "x-ms-client-request-id" : "05d630b3-7c59-4765-a0b4-ad31d0d954fb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurlacsourcefail&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" : "7628cd4a-9468-4878-8482-450474caf15f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8bd8-901e-0029-7e4b-6796e9000000", + "Body" : "jtcappendblockfromurlacsourcefailjtcappendblockfromurlacsourcefail026717447c7532a6faMon, 09 Sep 2019 20:14:12 GMT\"0x8D7356247972E85\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:14:11 GMT", + "x-ms-client-request-id" : "7628cd4a-9468-4878-8482-450474caf15f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail026717447c7532a6fa?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" : "e0e04bd4-bd7c-4c42-86c4-505454d3360f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c8be7-901e-0029-0c4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:12 GMT", + "x-ms-client-request-id" : "e0e04bd4-bd7c-4c42-86c4-505454d3360f" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacsourcefail026717447c7532a6fa", "javablobappendblockfromurlacsourcefail191304ded57ed69", "javablobappendblockfromurlacsourcefail293488c6ec8799f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacsourcefail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacsourcefail[1].json new file mode 100644 index 000000000000..63bd4e4e8b8c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacsourcefail[1].json @@ -0,0 +1,179 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail0271445332637db50c?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" : "65055d63-d71a-49ea-b1f7-93d5526e3623" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356247E929CA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8bef-901e-0029-134b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:12 GMT", + "x-ms-client-request-id" : "65055d63-d71a-49ea-b1f7-93d5526e3623" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail0271445332637db50c/javablobappendblockfromurlacsourcefail10176332ec08a09", + "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" : "4decbc9d-6d70-4d5e-95f6-29467748bb44" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356247F7BB92\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8bfe-901e-0029-204b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:12 GMT", + "x-ms-client-request-id" : "4decbc9d-6d70-4d5e-95f6-29467748bb44" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail0271445332637db50c?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" : "89d90b61-22fb-48e1-abb2-cea762adf585", + "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" : "\"0x8D735624803BFB7\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8c0d-901e-0029-2f4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:12 GMT", + "x-ms-client-request-id" : "89d90b61-22fb-48e1-abb2-cea762adf585" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail0271445332637db50c/javablobappendblockfromurlacsourcefail27970807d2fa3c8", + "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" : "05a805a7-88c0-4728-a527-ce7742c376f0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562481189D3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8c17-901e-0029-374b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:12 GMT", + "x-ms-client-request-id" : "05a805a7-88c0-4728-a527-ce7742c376f0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail0271445332637db50c/javablobappendblockfromurlacsourcefail27970807d2fa3c8?comp=appendblock", + "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" : "31713242-f4a2-4dbd-af67-799784e5d6d8", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:12 GMT", + "ETag" : "\"0x8D73562481EF9C6\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c8c21-901e-0029-404b-6796e9000000", + "x-ms-client-request-id" : "31713242-f4a2-4dbd-af67-799784e5d6d8", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail0271445332637db50c/javablobappendblockfromurlacsourcefail10176332ec08a09?comp=appendblock", + "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" : "8089ccc6-520b-4988-ae37-895ce019827b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "Content-Length" : "251", + "StatusCode" : "412", + "x-ms-request-id" : "e27c8c29-901e-0029-484b-6796e9000000", + "Body" : "\nCannotVerifyCopySourceCould not verify the copy source within the specified time.\nRequestId:e27c8c29-901e-0029-484b-6796e9000000\nTime:2019-09-09T20:14:13.0197756Z", + "Date" : "Mon, 09 Sep 2019 20:14:12 GMT", + "x-ms-client-request-id" : "8089ccc6-520b-4988-ae37-895ce019827b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurlacsourcefail&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" : "bd461463-1d21-4581-b99e-5beb49d9beea" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8c4c-901e-0029-644b-6796e9000000", + "Body" : "jtcappendblockfromurlacsourcefailjtcappendblockfromurlacsourcefail0271445332637db50cMon, 09 Sep 2019 20:14:12 GMT\"0x8D735624803BFB7\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:14:12 GMT", + "x-ms-client-request-id" : "bd461463-1d21-4581-b99e-5beb49d9beea", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail0271445332637db50c?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" : "4af68e2f-74ef-40c0-b386-66a19ee6e6e3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c8c5d-901e-0029-724b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:12 GMT", + "x-ms-client-request-id" : "4af68e2f-74ef-40c0-b386-66a19ee6e6e3" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacsourcefail0271445332637db50c", "javablobappendblockfromurlacsourcefail10176332ec08a09", "javablobappendblockfromurlacsourcefail27970807d2fa3c8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacsourcefail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacsourcefail[2].json new file mode 100644 index 000000000000..28efbca5b048 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacsourcefail[2].json @@ -0,0 +1,179 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail0837542c0628b68eb5?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" : "e6f9786c-af3c-407a-870b-a82924f1e9e2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735624854F78E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8c6b-901e-0029-7f4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:12 GMT", + "x-ms-client-request-id" : "e6f9786c-af3c-407a-870b-a82924f1e9e2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail0837542c0628b68eb5/javablobappendblockfromurlacsourcefail1681507a6917471", + "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" : "99132041-d5b6-4ac0-b67e-17b4cf5184ce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356248629EC4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8c7c-901e-0029-0d4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:12 GMT", + "x-ms-client-request-id" : "99132041-d5b6-4ac0-b67e-17b4cf5184ce" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail0837542c0628b68eb5?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" : "892b46dd-36fb-49ee-b23b-c2420d1b7de9", + "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" : "\"0x8D73562486EA2EE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8c88-901e-0029-194b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:12 GMT", + "x-ms-client-request-id" : "892b46dd-36fb-49ee-b23b-c2420d1b7de9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail0837542c0628b68eb5/javablobappendblockfromurlacsourcefail256253dad1fb653", + "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" : "9a2879d9-08b8-405d-8ab9-74d283b75092" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562487B5B65\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8c93-901e-0029-244b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:13 GMT", + "x-ms-client-request-id" : "9a2879d9-08b8-405d-8ab9-74d283b75092" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail0837542c0628b68eb5/javablobappendblockfromurlacsourcefail256253dad1fb653?comp=appendblock", + "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" : "8a4af6c0-58af-4b42-a983-39e5c73f1f6b", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:13 GMT", + "ETag" : "\"0x8D735624888A445\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c8cab-901e-0029-364b-6796e9000000", + "x-ms-client-request-id" : "8a4af6c0-58af-4b42-a983-39e5c73f1f6b", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail0837542c0628b68eb5/javablobappendblockfromurlacsourcefail1681507a6917471?comp=appendblock", + "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" : "f92e649c-ec79-46ce-a274-ff300bc5a3b5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "Content-Length" : "251", + "StatusCode" : "412", + "x-ms-request-id" : "e27c8cbb-901e-0029-454b-6796e9000000", + "Body" : "\nCannotVerifyCopySourceCould not verify the copy source within the specified time.\nRequestId:e27c8cbb-901e-0029-454b-6796e9000000\nTime:2019-09-09T20:14:13.7062618Z", + "Date" : "Mon, 09 Sep 2019 20:14:13 GMT", + "x-ms-client-request-id" : "f92e649c-ec79-46ce-a274-ff300bc5a3b5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurlacsourcefail&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" : "cdc5d3b8-076a-437e-bf20-8f7c5be58f11" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8ccf-901e-0029-554b-6796e9000000", + "Body" : "jtcappendblockfromurlacsourcefailjtcappendblockfromurlacsourcefail0837542c0628b68eb5Mon, 09 Sep 2019 20:14:13 GMT\"0x8D73562486EA2EE\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:14:13 GMT", + "x-ms-client-request-id" : "cdc5d3b8-076a-437e-bf20-8f7c5be58f11", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail0837542c0628b68eb5?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" : "46b30863-1207-4a32-a2f1-5301a596dea7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c8ce4-901e-0029-664b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:13 GMT", + "x-ms-client-request-id" : "46b30863-1207-4a32-a2f1-5301a596dea7" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacsourcefail0837542c0628b68eb5", "javablobappendblockfromurlacsourcefail1681507a6917471", "javablobappendblockfromurlacsourcefail256253dad1fb653" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacsourcefail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacsourcefail[3].json new file mode 100644 index 000000000000..d828d53704d1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlacsourcefail[3].json @@ -0,0 +1,208 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail06706831ef3a4397cf?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" : "3d20e65b-ca75-4704-997c-256df7a14583" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356248BD6931\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8cf4-901e-0029-764b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:13 GMT", + "x-ms-client-request-id" : "3d20e65b-ca75-4704-997c-256df7a14583" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail06706831ef3a4397cf/javablobappendblockfromurlacsourcefail191440484507309", + "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" : "8c54f0c2-8dc8-46fd-824b-0abbcac6a087" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356248CA4D36\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8d04-901e-0029-034b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:13 GMT", + "x-ms-client-request-id" : "8c54f0c2-8dc8-46fd-824b-0abbcac6a087" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail06706831ef3a4397cf?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" : "cdeef808-9294-49f1-bae1-82c7e2e9e978", + "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" : "\"0x8D7356248D65145\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8d1b-901e-0029-1a4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:13 GMT", + "x-ms-client-request-id" : "cdeef808-9294-49f1-bae1-82c7e2e9e978" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail06706831ef3a4397cf/javablobappendblockfromurlacsourcefail257729234e2155d", + "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" : "7a02139b-00aa-4fc2-82a2-25566d009de0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356248E3F46D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8d2c-901e-0029-2b4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:13 GMT", + "x-ms-client-request-id" : "7a02139b-00aa-4fc2-82a2-25566d009de0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail06706831ef3a4397cf/javablobappendblockfromurlacsourcefail257729234e2155d?comp=appendblock", + "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" : "7bddeae4-c4dc-4a98-8d23-e3c0bb3814fc", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:13 GMT", + "ETag" : "\"0x8D7356248F0EF1E\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c8d38-901e-0029-374b-6796e9000000", + "x-ms-client-request-id" : "7bddeae4-c4dc-4a98-8d23-e3c0bb3814fc", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail06706831ef3a4397cf/javablobappendblockfromurlacsourcefail257729234e2155d", + "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" : "1ac64abb-6d69-4e41-b314-a0d1b8b84c55" + }, + "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", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:14 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:14:13 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7356248F0EF1E\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:14:14 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "e27c8d49-901e-0029-454b-6796e9000000", + "x-ms-client-request-id" : "1ac64abb-6d69-4e41-b314-a0d1b8b84c55", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail06706831ef3a4397cf/javablobappendblockfromurlacsourcefail191440484507309?comp=appendblock", + "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" : "f5c5d19f-4c1b-43cb-bf44-d885677fb4ed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "e27c8d57-901e-0029-534b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:14 GMT", + "x-ms-client-request-id" : "f5c5d19f-4c1b-43cb-bf44-d885677fb4ed" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurlacsourcefail&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" : "9dab5bd3-a4a1-46a3-9f8f-b2531143c080" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8d62-901e-0029-5e4b-6796e9000000", + "Body" : "jtcappendblockfromurlacsourcefailjtcappendblockfromurlacsourcefail06706831ef3a4397cfMon, 09 Sep 2019 20:14:14 GMT\"0x8D7356248D65145\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:14:14 GMT", + "x-ms-client-request-id" : "9dab5bd3-a4a1-46a3-9f8f-b2531143c080", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlacsourcefail06706831ef3a4397cf?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" : "abf32a52-5dae-4991-b536-54167ec4ec5c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c8d73-901e-0029-6d4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:14 GMT", + "x-ms-client-request-id" : "abf32a52-5dae-4991-b536-54167ec4ec5c" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlacsourcefail06706831ef3a4397cf", "javablobappendblockfromurlacsourcefail191440484507309", "javablobappendblockfromurlacsourcefail257729234e2155d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[0].json new file mode 100644 index 000000000000..84259c241203 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[0].json @@ -0,0 +1,182 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac08632501f8aadaf3a?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" : "cccb139b-efa6-44f3-a298-5aa9ad6a3336" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623EE6615B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c815b-901e-0029-564b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:57 GMT", + "x-ms-client-request-id" : "cccb139b-efa6-44f3-a298-5aa9ad6a3336" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac08632501f8aadaf3a/javablobappendblockfromurldestinationac1435479fe6cbc1c", + "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" : "9ad4c639-c1df-48a8-bbda-8cb6e2fb13a0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623EF42C05\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c816c-901e-0029-664b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:57 GMT", + "x-ms-client-request-id" : "9ad4c639-c1df-48a8-bbda-8cb6e2fb13a0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac08632501f8aadaf3a?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" : "fdb855c9-62cc-40c1-ba4b-47a9f91bde4c", + "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" : "\"0x8D735623F00A78B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c817b-901e-0029-754b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:57 GMT", + "x-ms-client-request-id" : "fdb855c9-62cc-40c1-ba4b-47a9f91bde4c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac08632501f8aadaf3a/javablobappendblockfromurldestinationac275482d7c133f2b", + "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" : "9c1cfa78-48eb-4f97-8c5b-48f24229ecdd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623F0DD333\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8190-901e-0029-084b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:57 GMT", + "x-ms-client-request-id" : "9c1cfa78-48eb-4f97-8c5b-48f24229ecdd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac08632501f8aadaf3a/javablobappendblockfromurldestinationac275482d7c133f2b?comp=appendblock", + "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" : "df2a8cc6-96d5-417c-ab52-95d5600d37a0", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:57 GMT", + "ETag" : "\"0x8D735623F1A3182\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c81a4-901e-0029-1a4b-6796e9000000", + "x-ms-client-request-id" : "df2a8cc6-96d5-417c-ab52-95d5600d37a0", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac08632501f8aadaf3a/javablobappendblockfromurldestinationac1435479fe6cbc1c?comp=appendblock", + "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" : "8da094e4-f485-45c1-870a-4bae90688522" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:57 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735623F275347\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c81b9-901e-0029-2f4b-6796e9000000", + "x-ms-client-request-id" : "8da094e4-f485-45c1-870a-4bae90688522", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurldestinationac&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" : "d58fd0df-48d3-4075-a09f-5e643dc8ca52" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c81ca-901e-0029-404b-6796e9000000", + "Body" : "jtcappendblockfromurldestinationacjtcappendblockfromurldestinationac08632501f8aadaf3aMon, 09 Sep 2019 20:13:57 GMT\"0x8D735623F00A78B\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:57 GMT", + "x-ms-client-request-id" : "d58fd0df-48d3-4075-a09f-5e643dc8ca52", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac08632501f8aadaf3a?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" : "cbab3ca8-0d67-4adb-bab9-0d8599496ee0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c81d5-901e-0029-4b4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:57 GMT", + "x-ms-client-request-id" : "cbab3ca8-0d67-4adb-bab9-0d8599496ee0" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurldestinationac08632501f8aadaf3a", "javablobappendblockfromurldestinationac1435479fe6cbc1c", "javablobappendblockfromurldestinationac275482d7c133f2b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[1].json new file mode 100644 index 000000000000..c8b390ed9633 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[1].json @@ -0,0 +1,182 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac035297741ee335765?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" : "a1d2cd71-c267-4cfd-aebf-986fe0635831" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623F4D4C37\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c81ee-901e-0029-644b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:57 GMT", + "x-ms-client-request-id" : "a1d2cd71-c267-4cfd-aebf-986fe0635831" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac035297741ee335765/javablobappendblockfromurldestinationac1552722af250504", + "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" : "bb0fffbc-12ef-4657-a926-ebcc542988ae" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623F5B16E0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c81ff-901e-0029-734b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:57 GMT", + "x-ms-client-request-id" : "bb0fffbc-12ef-4657-a926-ebcc542988ae" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac035297741ee335765?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" : "286974b7-9c59-408d-8d1c-e3c84add6eef", + "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" : "\"0x8D735623F674440\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8211-901e-0029-054b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:57 GMT", + "x-ms-client-request-id" : "286974b7-9c59-408d-8d1c-e3c84add6eef" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac035297741ee335765/javablobappendblockfromurldestinationac2351408f6d809f6", + "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" : "d5852702-aa2c-4e20-9ec2-e724e3f48d21" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623F7421B0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c821a-901e-0029-0e4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:57 GMT", + "x-ms-client-request-id" : "d5852702-aa2c-4e20-9ec2-e724e3f48d21" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac035297741ee335765/javablobappendblockfromurldestinationac2351408f6d809f6?comp=appendblock", + "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" : "898d316e-d934-4388-ad58-44ddbd274ec0", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:58 GMT", + "ETag" : "\"0x8D735623F816A8E\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c8225-901e-0029-194b-6796e9000000", + "x-ms-client-request-id" : "898d316e-d934-4388-ad58-44ddbd274ec0", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac035297741ee335765/javablobappendblockfromurldestinationac1552722af250504?comp=appendblock", + "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" : "4bfff1b5-cb74-4896-a7b7-b52394e30df6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:58 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735623F8FEC29\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c8233-901e-0029-274b-6796e9000000", + "x-ms-client-request-id" : "4bfff1b5-cb74-4896-a7b7-b52394e30df6", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurldestinationac&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" : "05bb2e61-d698-4fc5-8173-7d298d4d70da" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8242-901e-0029-364b-6796e9000000", + "Body" : "jtcappendblockfromurldestinationacjtcappendblockfromurldestinationac035297741ee335765Mon, 09 Sep 2019 20:13:58 GMT\"0x8D735623F674440\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:58 GMT", + "x-ms-client-request-id" : "05bb2e61-d698-4fc5-8173-7d298d4d70da", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac035297741ee335765?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" : "e8d04887-e640-447b-bda5-18f4f394db8a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c8253-901e-0029-474b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:58 GMT", + "x-ms-client-request-id" : "e8d04887-e640-447b-bda5-18f4f394db8a" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurldestinationac035297741ee335765", "javablobappendblockfromurldestinationac1552722af250504", "javablobappendblockfromurldestinationac2351408f6d809f6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[2].json new file mode 100644 index 000000000000..6f0a1253a9b3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[2].json @@ -0,0 +1,182 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0228018943a7db26f?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" : "5be9bce3-626e-4ece-98f2-236f696cbd15" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623FB7BA20\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8263-901e-0029-554b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:58 GMT", + "x-ms-client-request-id" : "5be9bce3-626e-4ece-98f2-236f696cbd15" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0228018943a7db26f/javablobappendblockfromurldestinationac1860000b6e542b2", + "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" : "a39d9ed2-e7d0-42a2-ab99-10bd56d6c773" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623FC50FA7\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c826d-901e-0029-5e4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:58 GMT", + "x-ms-client-request-id" : "a39d9ed2-e7d0-42a2-ab99-10bd56d6c773" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0228018943a7db26f?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" : "2c7ce146-eae7-4c48-ab75-bdd258334c17", + "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" : "\"0x8D735623FD13CEB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8277-901e-0029-674b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:58 GMT", + "x-ms-client-request-id" : "2c7ce146-eae7-4c48-ab75-bdd258334c17" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0228018943a7db26f/javablobappendblockfromurldestinationac27737871b275563", + "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" : "44a178fb-352e-4a0d-988b-5595d95e5ec4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623FDE4196\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c828a-901e-0029-754b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:58 GMT", + "x-ms-client-request-id" : "44a178fb-352e-4a0d-988b-5595d95e5ec4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0228018943a7db26f/javablobappendblockfromurldestinationac27737871b275563?comp=appendblock", + "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" : "0a46ea0f-3a82-4292-ba95-ab736ee430f6", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:58 GMT", + "ETag" : "\"0x8D735623FEAC708\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c82a9-901e-0029-114b-6796e9000000", + "x-ms-client-request-id" : "0a46ea0f-3a82-4292-ba95-ab736ee430f6", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0228018943a7db26f/javablobappendblockfromurldestinationac1860000b6e542b2?comp=appendblock", + "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" : "05cff389-8909-43e5-a450-bef6ccca1f5a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:58 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735623FF80FE7\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c82b2-901e-0029-1a4b-6796e9000000", + "x-ms-client-request-id" : "05cff389-8909-43e5-a450-bef6ccca1f5a", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurldestinationac&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" : "b8161c3b-e856-47fa-93fb-a1becd41cabd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c82bd-901e-0029-254b-6796e9000000", + "Body" : "jtcappendblockfromurldestinationacjtcappendblockfromurldestinationac0228018943a7db26fMon, 09 Sep 2019 20:13:58 GMT\"0x8D735623FD13CEB\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:58 GMT", + "x-ms-client-request-id" : "b8161c3b-e856-47fa-93fb-a1becd41cabd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0228018943a7db26f?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" : "88f36cd7-41e3-4c18-8934-8c7b6b7117da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c82ce-901e-0029-354b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:58 GMT", + "x-ms-client-request-id" : "88f36cd7-41e3-4c18-8934-8c7b6b7117da" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurldestinationac0228018943a7db26f", "javablobappendblockfromurldestinationac1860000b6e542b2", "javablobappendblockfromurldestinationac27737871b275563" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[3].json new file mode 100644 index 000000000000..9afb3567cd01 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[3].json @@ -0,0 +1,214 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0511120d428c133f7?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" : "cbf874f1-9d0a-463f-a0ef-8f49d93fc14d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562401D4529\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c82de-901e-0029-454b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:59 GMT", + "x-ms-client-request-id" : "cbf874f1-9d0a-463f-a0ef-8f49d93fc14d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0511120d428c133f7/javablobappendblockfromurldestinationac148171a913271dc", + "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" : "a86cc996-bbe0-4af1-be80-e6dd045fba97" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562402A4CB0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c82ea-901e-0029-4f4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:59 GMT", + "x-ms-client-request-id" : "a86cc996-bbe0-4af1-be80-e6dd045fba97" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0511120d428c133f7?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" : "6ee8f918-84d0-4dcb-b377-1ba47a98ae9e", + "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" : "\"0x8D73562403652AF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c82fc-901e-0029-604b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:59 GMT", + "x-ms-client-request-id" : "6ee8f918-84d0-4dcb-b377-1ba47a98ae9e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0511120d428c133f7/javablobappendblockfromurldestinationac148171a913271dc", + "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" : "21dc0a9f-5841-4acb-bdd2-acc40147b41b" + }, + "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", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:59 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:13:59 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73562402A4CB0\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:13:59 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "e27c8308-901e-0029-6a4b-6796e9000000", + "x-ms-client-request-id" : "21dc0a9f-5841-4acb-bdd2-acc40147b41b", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0511120d428c133f7/javablobappendblockfromurldestinationac210635fe7b6875e", + "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" : "ecaee0d3-eac8-471c-9ccf-05541ced90fb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562404ECB53\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8319-901e-0029-7b4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:59 GMT", + "x-ms-client-request-id" : "ecaee0d3-eac8-471c-9ccf-05541ced90fb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0511120d428c133f7/javablobappendblockfromurldestinationac210635fe7b6875e?comp=appendblock", + "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" : "15b89617-1acf-463d-a64a-afd383466a17", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:59 GMT", + "ETag" : "\"0x8D73562405BED22\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c832f-901e-0029-0d4b-6796e9000000", + "x-ms-client-request-id" : "15b89617-1acf-463d-a64a-afd383466a17", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0511120d428c133f7/javablobappendblockfromurldestinationac148171a913271dc?comp=appendblock", + "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" : "b869ae89-f14a-4e3b-b72f-5bfd35e60597" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:59 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73562406A6EBA\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c833d-901e-0029-1a4b-6796e9000000", + "x-ms-client-request-id" : "b869ae89-f14a-4e3b-b72f-5bfd35e60597", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurldestinationac&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" : "10a1242c-e19d-4303-9862-c13df91508ab" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8350-901e-0029-2c4b-6796e9000000", + "Body" : "jtcappendblockfromurldestinationacjtcappendblockfromurldestinationac0511120d428c133f7Mon, 09 Sep 2019 20:13:59 GMT\"0x8D73562403652AF\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:59 GMT", + "x-ms-client-request-id" : "10a1242c-e19d-4303-9862-c13df91508ab", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0511120d428c133f7?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" : "c6432ce1-bbb3-4833-8d6b-a1f279c5dbd5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c8358-901e-0029-344b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:59 GMT", + "x-ms-client-request-id" : "c6432ce1-bbb3-4833-8d6b-a1f279c5dbd5" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurldestinationac0511120d428c133f7", "javablobappendblockfromurldestinationac148171a913271dc", "javablobappendblockfromurldestinationac210635fe7b6875e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[4].json new file mode 100644 index 000000000000..daa81fb63d1c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[4].json @@ -0,0 +1,182 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac009860cd35612a93e?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" : "93daeb57-11e8-402d-8313-01732e3f23c0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735624093C331\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c835f-901e-0029-3b4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:59 GMT", + "x-ms-client-request-id" : "93daeb57-11e8-402d-8313-01732e3f23c0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac009860cd35612a93e/javablobappendblockfromurldestinationac176210cab75f71f", + "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" : "6a0296b9-2e57-45d4-a968-a9038f59a099" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356240A11925\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c836e-901e-0029-484b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:59 GMT", + "x-ms-client-request-id" : "6a0296b9-2e57-45d4-a968-a9038f59a099" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac009860cd35612a93e?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" : "d5798df1-8b01-4464-8fa7-5a92b85e35ea", + "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" : "\"0x8D7356240ACF7D7\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8379-901e-0029-514b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:00 GMT", + "x-ms-client-request-id" : "d5798df1-8b01-4464-8fa7-5a92b85e35ea" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac009860cd35612a93e/javablobappendblockfromurldestinationac262711373645e90", + "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" : "d0b458a6-7797-4cfc-b61b-186df549b24c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356240B9AEB8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8388-901e-0029-604b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:00 GMT", + "x-ms-client-request-id" : "d0b458a6-7797-4cfc-b61b-186df549b24c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac009860cd35612a93e/javablobappendblockfromurldestinationac262711373645e90?comp=appendblock", + "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" : "88f3afac-c933-41e6-9450-88ee96e6073c", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:00 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:00 GMT", + "ETag" : "\"0x8D7356240C6A972\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c8398-901e-0029-704b-6796e9000000", + "x-ms-client-request-id" : "88f3afac-c933-41e6-9450-88ee96e6073c", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac009860cd35612a93e/javablobappendblockfromurldestinationac176210cab75f71f?comp=appendblock", + "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" : "a13541af-6fd8-4840-a4a1-d124d5d6c4c7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:00 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:00 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356240D52B0B\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c83a3-901e-0029-7b4b-6796e9000000", + "x-ms-client-request-id" : "a13541af-6fd8-4840-a4a1-d124d5d6c4c7", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurldestinationac&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" : "ea90da47-c53f-4ddb-89a8-cb79646a7461" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c83b1-901e-0029-094b-6796e9000000", + "Body" : "jtcappendblockfromurldestinationacjtcappendblockfromurldestinationac009860cd35612a93eMon, 09 Sep 2019 20:14:00 GMT\"0x8D7356240ACF7D7\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:14:00 GMT", + "x-ms-client-request-id" : "ea90da47-c53f-4ddb-89a8-cb79646a7461", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac009860cd35612a93e?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" : "944a48a4-0938-4ccf-965a-3a525e788210" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c83c0-901e-0029-164b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:00 GMT", + "x-ms-client-request-id" : "944a48a4-0938-4ccf-965a-3a525e788210" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurldestinationac009860cd35612a93e", "javablobappendblockfromurldestinationac176210cab75f71f", "javablobappendblockfromurldestinationac262711373645e90" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[5].json new file mode 100644 index 000000000000..04472adbbd62 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[5].json @@ -0,0 +1,204 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0356127ddac276b1d?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" : "2ca4b042-2dc0-435c-825e-2713d7aee329" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356240FCF865\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c83ca-901e-0029-204b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:00 GMT", + "x-ms-client-request-id" : "2ca4b042-2dc0-435c-825e-2713d7aee329" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0356127ddac276b1d/javablobappendblockfromurldestinationac1937935cfcca4ca", + "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" : "d0868fe0-bca5-4457-9dcf-f8f5b800a139" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562410A4E8E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c83d9-901e-0029-2e4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:00 GMT", + "x-ms-client-request-id" : "d0868fe0-bca5-4457-9dcf-f8f5b800a139" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0356127ddac276b1d?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" : "f82cfe00-fbc1-4753-b64f-f9b3dc9800a3", + "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" : "\"0x8D7356241167B3F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c83e7-901e-0029-3c4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:00 GMT", + "x-ms-client-request-id" : "f82cfe00-fbc1-4753-b64f-f9b3dc9800a3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0356127ddac276b1d/javablobappendblockfromurldestinationac1937935cfcca4ca?comp=lease", + "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" : "1a375a94-86d6-40d1-b3f7-682757f2c7b2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562410A4E8E\"", + "x-ms-lease-id" : "461ec133-c61a-499e-bd05-7b24e33ce0ff", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c840a-901e-0029-554b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:00 GMT", + "x-ms-client-request-id" : "1a375a94-86d6-40d1-b3f7-682757f2c7b2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0356127ddac276b1d/javablobappendblockfromurldestinationac214236951cc9389", + "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" : "7fd4b9eb-ee26-41b5-8d54-941782ef3c60" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562413005E6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8420-901e-0029-694b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:00 GMT", + "x-ms-client-request-id" : "7fd4b9eb-ee26-41b5-8d54-941782ef3c60" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0356127ddac276b1d/javablobappendblockfromurldestinationac214236951cc9389?comp=appendblock", + "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" : "00d0b230-8e19-4cd6-9027-83ad9ed40d38", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:00 GMT", + "ETag" : "\"0x8D73562413D4ECF\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c842f-901e-0029-774b-6796e9000000", + "x-ms-client-request-id" : "00d0b230-8e19-4cd6-9027-83ad9ed40d38", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0356127ddac276b1d/javablobappendblockfromurldestinationac1937935cfcca4ca?comp=appendblock", + "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" : "90956e28-74f1-479b-a553-554eae852c11" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:01 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73562414C1E95\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c8444-901e-0029-054b-6796e9000000", + "x-ms-client-request-id" : "90956e28-74f1-479b-a553-554eae852c11", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurldestinationac&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" : "82e9b603-b8d6-451b-b335-3b21eb071de1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8452-901e-0029-0f4b-6796e9000000", + "Body" : "jtcappendblockfromurldestinationacjtcappendblockfromurldestinationac0356127ddac276b1dMon, 09 Sep 2019 20:14:01 GMT\"0x8D7356241167B3F\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:14:01 GMT", + "x-ms-client-request-id" : "82e9b603-b8d6-451b-b335-3b21eb071de1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0356127ddac276b1d?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" : "d8694417-e856-4a00-acf4-1ff189f4950f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c845d-901e-0029-1a4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:01 GMT", + "x-ms-client-request-id" : "d8694417-e856-4a00-acf4-1ff189f4950f" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurldestinationac0356127ddac276b1d", "javablobappendblockfromurldestinationac1937935cfcca4ca", "javablobappendblockfromurldestinationac214236951cc9389" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[6].json new file mode 100644 index 000000000000..cdcdc5814321 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[6].json @@ -0,0 +1,182 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0417557f08f0b0501?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" : "04b34fc5-3d0d-4d9a-901d-df55e47eee96" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562417460FC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c846c-901e-0029-284b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:01 GMT", + "x-ms-client-request-id" : "04b34fc5-3d0d-4d9a-901d-df55e47eee96" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0417557f08f0b0501/javablobappendblockfromurldestinationac19323036612ea8e", + "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" : "46c5e996-adf2-431c-b6b3-b4efedf73b88" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562418428C2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c847c-901e-0029-374b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:01 GMT", + "x-ms-client-request-id" : "46c5e996-adf2-431c-b6b3-b4efedf73b88" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0417557f08f0b0501?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" : "8ccff165-1b27-4b94-8270-2a85474087bc", + "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" : "\"0x8D735624190555D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8484-901e-0029-3f4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:01 GMT", + "x-ms-client-request-id" : "8ccff165-1b27-4b94-8270-2a85474087bc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0417557f08f0b0501/javablobappendblockfromurldestinationac2584210076a826c", + "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" : "a4f7d94f-32d2-4f3f-b7f8-9c5411a36aea" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562419D0C7C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8498-901e-0029-524b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:01 GMT", + "x-ms-client-request-id" : "a4f7d94f-32d2-4f3f-b7f8-9c5411a36aea" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0417557f08f0b0501/javablobappendblockfromurldestinationac2584210076a826c?comp=appendblock", + "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" : "2835e8c8-cb5a-4d89-b88e-e694f8aefa5c", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:01 GMT", + "ETag" : "\"0x8D7356241A991E0\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c84a8-901e-0029-614b-6796e9000000", + "x-ms-client-request-id" : "2835e8c8-cb5a-4d89-b88e-e694f8aefa5c", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0417557f08f0b0501/javablobappendblockfromurldestinationac19323036612ea8e?comp=appendblock", + "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" : "8f1f24c0-2d7f-42eb-951e-eebc38b9259d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:01 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356241BA5DCF\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c84b6-901e-0029-6d4b-6796e9000000", + "x-ms-client-request-id" : "8f1f24c0-2d7f-42eb-951e-eebc38b9259d", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurldestinationac&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" : "d9e58166-df51-4886-9fd6-339eebbfc120" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c84cb-901e-0029-7e4b-6796e9000000", + "Body" : "jtcappendblockfromurldestinationacjtcappendblockfromurldestinationac0417557f08f0b0501Mon, 09 Sep 2019 20:14:01 GMT\"0x8D735624190555D\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:14:01 GMT", + "x-ms-client-request-id" : "d9e58166-df51-4886-9fd6-339eebbfc120", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac0417557f08f0b0501?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" : "f7318e23-bd74-428d-97f8-2750d1e0d1ab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c84d9-901e-0029-0c4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:01 GMT", + "x-ms-client-request-id" : "f7318e23-bd74-428d-97f8-2750d1e0d1ab" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurldestinationac0417557f08f0b0501", "javablobappendblockfromurldestinationac19323036612ea8e", "javablobappendblockfromurldestinationac2584210076a826c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[7].json new file mode 100644 index 000000000000..daa54e113a17 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurldestinationac[7].json @@ -0,0 +1,182 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac07759343059bef40b?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" : "cebe4e43-2e61-4c5b-bb03-9926829f8100" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356241E1DCB3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c84ea-901e-0029-1c4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:02 GMT", + "x-ms-client-request-id" : "cebe4e43-2e61-4c5b-bb03-9926829f8100" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac07759343059bef40b/javablobappendblockfromurldestinationac1905419dc603656", + "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" : "02099a47-4a27-4060-919e-1efea0a4de15" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356241EF0BF4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c84fb-901e-0029-2b4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:02 GMT", + "x-ms-client-request-id" : "02099a47-4a27-4060-919e-1efea0a4de15" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac07759343059bef40b?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" : "3418f3b4-0120-487d-adbc-23e3053d177c", + "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" : "\"0x8D7356241FB38C3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8509-901e-0029-384b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:02 GMT", + "x-ms-client-request-id" : "3418f3b4-0120-487d-adbc-23e3053d177c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac07759343059bef40b/javablobappendblockfromurldestinationac263428aeffc991e", + "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" : "c6a572c4-d1c3-4c42-98fe-87f68d9ed9bd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735624207EFB6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c851f-901e-0029-4c4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:02 GMT", + "x-ms-client-request-id" : "c6a572c4-d1c3-4c42-98fe-87f68d9ed9bd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac07759343059bef40b/javablobappendblockfromurldestinationac263428aeffc991e?comp=appendblock", + "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" : "3690627b-a9c2-4441-990b-992f001871c1", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:02 GMT", + "ETag" : "\"0x8D7356242147529\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c8531-901e-0029-5c4b-6796e9000000", + "x-ms-client-request-id" : "3690627b-a9c2-4441-990b-992f001871c1", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac07759343059bef40b/javablobappendblockfromurldestinationac1905419dc603656?comp=appendblock", + "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" : "0d02faf5-0bc7-4dc0-ba6f-079f514dd2e4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:02 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73562422196F3\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c853f-901e-0029-684b-6796e9000000", + "x-ms-client-request-id" : "0d02faf5-0bc7-4dc0-ba6f-079f514dd2e4", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurldestinationac&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" : "78f7ccff-169b-4be2-a4cf-e7476f439cf9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c854c-901e-0029-744b-6796e9000000", + "Body" : "jtcappendblockfromurldestinationacjtcappendblockfromurldestinationac07759343059bef40bMon, 09 Sep 2019 20:14:02 GMT\"0x8D7356241FB38C3\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:14:02 GMT", + "x-ms-client-request-id" : "78f7ccff-169b-4be2-a4cf-e7476f439cf9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurldestinationac07759343059bef40b?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" : "eff145af-d95a-427e-b527-102ab263df27" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c8561-901e-0029-074b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:02 GMT", + "x-ms-client-request-id" : "eff145af-d95a-427e-b527-102ab263df27" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurldestinationac07759343059bef40b", "javablobappendblockfromurldestinationac1905419dc603656", "javablobappendblockfromurldestinationac263428aeffc991e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlmd5.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlmd5.json new file mode 100644 index 000000000000..30e2774bc9c4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlmd5.json @@ -0,0 +1,182 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlmd5008813aeefdc2f95064196?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" : "5faddf25-4cfe-4ad6-af9e-e7f602a07faf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623E161A40\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8046-901e-0029-584b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:55 GMT", + "x-ms-client-request-id" : "5faddf25-4cfe-4ad6-af9e-e7f602a07faf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlmd5008813aeefdc2f95064196/javablobappendblockfromurlmd5193726c6a0ca883e5e4d", + "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" : "464e4021-8e86-4652-8b2c-27862c44dceb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623E23E47D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c805b-901e-0029-674b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:55 GMT", + "x-ms-client-request-id" : "464e4021-8e86-4652-8b2c-27862c44dceb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlmd5008813aeefdc2f95064196?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" : "35a02208-90fa-49af-bb1b-0512674c114f", + "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" : "\"0x8D735623E2FEADE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8072-901e-0029-7e4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:55 GMT", + "x-ms-client-request-id" : "35a02208-90fa-49af-bb1b-0512674c114f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlmd5008813aeefdc2f95064196/javablobappendblockfromurlmd5193726c6a0ca883e5e4d?comp=appendblock", + "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" : "2d99ebfb-c121-49cd-bad1-225a343b1d12", + "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" : "y7Je8RbOLTc=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:55 GMT", + "ETag" : "\"0x8D735623E3CA12A\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c8085-901e-0029-114b-6796e9000000", + "x-ms-client-request-id" : "2d99ebfb-c121-49cd-bad1-225a343b1d12", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlmd5008813aeefdc2f95064196/javablobappendblockfromurlmd52360489470f808977546", + "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" : "f2474321-238e-4eee-9369-21036eef86c0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623E492696\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c80a3-901e-0029-2b4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:56 GMT", + "x-ms-client-request-id" : "f2474321-238e-4eee-9369-21036eef86c0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlmd5008813aeefdc2f95064196/javablobappendblockfromurlmd52360489470f808977546?comp=appendblock", + "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" : "63038c73-a65a-46b3-9aed-65fd4aad95cf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:56 GMT", + "Content-MD5" : "qcpi12Nmn2Z7qEWAi1GaZw==", + "ETag" : "\"0x8D735623E56968F\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c80ab-901e-0029-334b-6796e9000000", + "x-ms-client-request-id" : "63038c73-a65a-46b3-9aed-65fd4aad95cf", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurlmd5&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" : "9185088e-eff9-4076-92b3-81ed42516113" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c80bd-901e-0029-444b-6796e9000000", + "Body" : "jtcappendblockfromurlmd5jtcappendblockfromurlmd5008813aeefdc2f95064196Mon, 09 Sep 2019 20:13:56 GMT\"0x8D735623E2FEADE\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:56 GMT", + "x-ms-client-request-id" : "9185088e-eff9-4076-92b3-81ed42516113", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlmd5008813aeefdc2f95064196?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" : "65b9282f-1a12-40b0-8c5a-377862139eec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c80cb-901e-0029-4f4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:56 GMT", + "x-ms-client-request-id" : "65b9282f-1a12-40b0-8c5a-377862139eec" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlmd5008813aeefdc2f95064196", "javablobappendblockfromurlmd5193726c6a0ca883e5e4d", "35c2c2a1-62ae-40c8-b18f-a676bdb724f5", "javablobappendblockfromurlmd52360489470f808977546" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlmd5fail.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlmd5fail.json new file mode 100644 index 000000000000..ca30a9b1bc92 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlmd5fail.json @@ -0,0 +1,179 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlmd5fail0950844662a9bad9404c?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" : "6cbe91aa-bc77-424d-b688-0f0a622bdd0f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623E7D051B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c80d9-901e-0029-5d4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:56 GMT", + "x-ms-client-request-id" : "6cbe91aa-bc77-424d-b688-0f0a622bdd0f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlmd5fail0950844662a9bad9404c/javablobappendblockfromurlmd5fail192701bed8e0bb8379", + "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" : "104b11ac-eaad-45b9-b356-02d25ea10816" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623E89BDE3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c80e5-901e-0029-684b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:56 GMT", + "x-ms-client-request-id" : "104b11ac-eaad-45b9-b356-02d25ea10816" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlmd5fail0950844662a9bad9404c?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" : "f4bcce43-d3fb-4a13-8f35-ac166316f521", + "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" : "\"0x8D735623E961250\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c80f9-901e-0029-7a4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:56 GMT", + "x-ms-client-request-id" : "f4bcce43-d3fb-4a13-8f35-ac166316f521" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlmd5fail0950844662a9bad9404c/javablobappendblockfromurlmd5fail192701bed8e0bb8379?comp=appendblock", + "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" : "5226116f-f822-4d58-9d46-3df740081b8c", + "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" : "Y9BppOLGVLY=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:56 GMT", + "ETag" : "\"0x8D735623EA38C30\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c8100-901e-0029-014b-6796e9000000", + "x-ms-client-request-id" : "5226116f-f822-4d58-9d46-3df740081b8c", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlmd5fail0950844662a9bad9404c/javablobappendblockfromurlmd5fail231341e92b23e4eed7", + "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" : "66337c67-3b08-4324-8233-60edc5b656d1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623EB12345\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8112-901e-0029-114b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:56 GMT", + "x-ms-client-request-id" : "66337c67-3b08-4324-8233-60edc5b656d1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlmd5fail0950844662a9bad9404c/javablobappendblockfromurlmd5fail231341e92b23e4eed7?comp=appendblock", + "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" : "84e1a57b-8fe3-4ce2-b6c0-e495c8ab113b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "Md5Mismatch", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "e27c8120-901e-0029-1f4b-6796e9000000", + "Body" : "\nMd5MismatchThe MD5 value specified in the request did not match with the MD5 value calculated by the server.\nRequestId:e27c8120-901e-0029-1f4b-6796e9000000\nTime:2019-09-09T20:13:57.2025458Z", + "Date" : "Mon, 09 Sep 2019 20:13:56 GMT", + "x-ms-client-request-id" : "84e1a57b-8fe3-4ce2-b6c0-e495c8ab113b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurlmd5fail&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" : "bafa96fb-a90e-4a20-8b56-d7e13d2c6473" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c812c-901e-0029-2a4b-6796e9000000", + "Body" : "jtcappendblockfromurlmd5failjtcappendblockfromurlmd5fail0950844662a9bad9404cMon, 09 Sep 2019 20:13:56 GMT\"0x8D735623E961250\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:56 GMT", + "x-ms-client-request-id" : "bafa96fb-a90e-4a20-8b56-d7e13d2c6473", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlmd5fail0950844662a9bad9404c?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" : "4b7e7f24-72ab-4cd5-b93e-e661b0d605bb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c8141-901e-0029-3c4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:56 GMT", + "x-ms-client-request-id" : "4b7e7f24-72ab-4cd5-b93e-e661b0d605bb" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlmd5fail0950844662a9bad9404c", "javablobappendblockfromurlmd5fail192701bed8e0bb8379", "24c89313-8e93-45c3-afc4-d2e722d8b6c9", "javablobappendblockfromurlmd5fail231341e92b23e4eed7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlmin.json new file mode 100644 index 000000000000..58567897dedf --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlmin.json @@ -0,0 +1,182 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlmin093771dc343c176a4d433c?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" : "c82a9cb3-d5bd-48f7-98ff-7f3925897309" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623D2E7652\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7f04-901e-0029-354b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:54 GMT", + "x-ms-client-request-id" : "c82a9cb3-d5bd-48f7-98ff-7f3925897309" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlmin093771dc343c176a4d433c/javablobappendblockfromurlmin1467798924ac7145db42", + "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" : "356ff4b2-0789-49b2-9a60-cbbab14fd34c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623D3BA3F9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7f20-901e-0029-4d4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:54 GMT", + "x-ms-client-request-id" : "356ff4b2-0789-49b2-9a60-cbbab14fd34c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlmin093771dc343c176a4d433c?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" : "644544c6-1f97-4f08-8eb4-71251601a0da", + "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" : "\"0x8D735623D47AA79\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c7f33-901e-0029-5f4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:54 GMT", + "x-ms-client-request-id" : "644544c6-1f97-4f08-8eb4-71251601a0da" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlmin093771dc343c176a4d433c/javablobappendblockfromurlmin1467798924ac7145db42?comp=appendblock", + "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" : "64f781ee-ccb7-4a70-bd58-da2c0db78d53", + "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" : "4rTtf0b5/ME=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:54 GMT", + "ETag" : "\"0x8D735623D5487B0\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c7f3e-901e-0029-6a4b-6796e9000000", + "x-ms-client-request-id" : "64f781ee-ccb7-4a70-bd58-da2c0db78d53", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlmin093771dc343c176a4d433c/javablobappendblockfromurlmin2304781cd40eb934e74f", + "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" : "43cac41c-4813-4bb0-a898-b69c93cc184a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623D61F7A5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7f50-901e-0029-7a4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:54 GMT", + "x-ms-client-request-id" : "43cac41c-4813-4bb0-a898-b69c93cc184a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlmin093771dc343c176a4d433c/javablobappendblockfromurlmin2304781cd40eb934e74f?comp=appendblock", + "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" : "cb9ecf8c-0297-47e3-ba83-9cef1f443835" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:54 GMT", + "Content-MD5" : "D1jsNy/M5p8X44EebnhcwA==", + "ETag" : "\"0x8D735623D75F879\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c7f62-901e-0029-0a4b-6796e9000000", + "x-ms-client-request-id" : "cb9ecf8c-0297-47e3-ba83-9cef1f443835", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurlmin&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" : "70d2cc70-de4e-484c-bda9-4ec2999681ba" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c7f7b-901e-0029-204b-6796e9000000", + "Body" : "jtcappendblockfromurlminjtcappendblockfromurlmin093771dc343c176a4d433cMon, 09 Sep 2019 20:13:54 GMT\"0x8D735623D47AA79\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:54 GMT", + "x-ms-client-request-id" : "70d2cc70-de4e-484c-bda9-4ec2999681ba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlmin093771dc343c176a4d433c?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" : "68f6eca7-3226-4c49-993d-715c78b606b1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c7f8d-901e-0029-2f4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:54 GMT", + "x-ms-client-request-id" : "68f6eca7-3226-4c49-993d-715c78b606b1" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlmin093771dc343c176a4d433c", "javablobappendblockfromurlmin1467798924ac7145db42", "14d17316-238e-4676-ba48-8fe5af945cb1", "javablobappendblockfromurlmin2304781cd40eb934e74f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlrange.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlrange.json new file mode 100644 index 000000000000..ae49b1947bb1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlrange.json @@ -0,0 +1,213 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlrange017382868c66afb5ff455?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" : "9d093b32-5f6c-4253-9d3c-3d2292a0156c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623D9EB1A9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7f9a-901e-0029-3a4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:54 GMT", + "x-ms-client-request-id" : "9d093b32-5f6c-4253-9d3c-3d2292a0156c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlrange017382868c66afb5ff455/javablobappendblockfromurlrange1796539031022cbe974", + "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" : "9dbfb9f5-9c7e-4a17-89dc-d0fd1dbb0b47" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623DAC066F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7fa9-901e-0029-484b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:54 GMT", + "x-ms-client-request-id" : "9dbfb9f5-9c7e-4a17-89dc-d0fd1dbb0b47" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlrange017382868c66afb5ff455?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" : "e915856d-a04e-4cdd-aedf-3e7f9a474047", + "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" : "\"0x8D735623DB80D01\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c7fc7-901e-0029-634b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:55 GMT", + "x-ms-client-request-id" : "e915856d-a04e-4cdd-aedf-3e7f9a474047" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlrange017382868c66afb5ff455/javablobappendblockfromurlrange1796539031022cbe974?comp=appendblock", + "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" : "95ce56dd-fd74-453e-8f43-72d9383576b2", + "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" : "I4BeA45EIyY=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:55 GMT", + "ETag" : "\"0x8D735623DC53859\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c7fdd-901e-0029-754b-6796e9000000", + "x-ms-client-request-id" : "95ce56dd-fd74-453e-8f43-72d9383576b2", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlrange017382868c66afb5ff455/javablobappendblockfromurlrange20062678ad43ab42c14", + "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" : "bf44b411-def5-4383-b048-94bc5675c1cb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623DD2CF5F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c7ff9-901e-0029-114b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:55 GMT", + "x-ms-client-request-id" : "bf44b411-def5-4383-b048-94bc5675c1cb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlrange017382868c66afb5ff455/javablobappendblockfromurlrange20062678ad43ab42c14?comp=appendblock", + "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" : "028ae820-7633-4292-afe4-1d8f196d1ce5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:55 GMT", + "Content-MD5" : "/l0y3f0qoh481uG3mpcNTw==", + "ETag" : "\"0x8D735623DE0B4A5\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c8009-901e-0029-214b-6796e9000000", + "x-ms-client-request-id" : "028ae820-7633-4292-afe4-1d8f196d1ce5", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlrange017382868c66afb5ff455/javablobappendblockfromurlrange20062678ad43ab42c14", + "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" : "1adef1f4-309e-4566-82c0-91d62510994d" + }, + "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", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:55 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:13:55 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D735623DE0B4A5\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:13:55 GMT", + "Content-Length" : "1024", + "x-ms-request-id" : "e27c8019-901e-0029-2f4b-6796e9000000", + "Body" : "[13, 127, 46, 109, 50, 106, 54, 117, 57, 96, 96, 110, 83, -72, -104, -40, 72, -54, 82, 44, 86, -104, -22, -12, -83, 8, 57, -64, -104, 121, 100, -45, 104, -28, -21, 102, -50, 75, 1, -100, -94, -41, -7, 112, 57, -80, -91, 44, 8, -17, -53, -54, -53, -14, -22, 127, -18, 31, 112, -42, 28, -20, -58, -122, 73, -72, 47, 18, 37, 14, -57, -115, -10, 53, 63, -96, 18, 1, 52, -46, -11, 84, 66, 47, -77, 42, 25, -97, 116, 16, 96, -14, 76, -110, -47, 108, -26, -72, 61, 64, -36, -101, -61, -24, 122, -79, -13, 65, 14, 97, -99, 121, -88, -15, 81, -117, 110, -53, 90, 66, -73, -101, -28, -4, -94, 82, 120, 98, 93, -25, -14, 87, -82, 50, -67, 17, -9, -41, -45, 89, -114, 97, -74, -32, -31, -57, -58, 90, -81, 80, 9, 113, -16, 78, -110, 106, 8, -18, 31, -102, 46, -128, 109, -128, -25, 49, -52, 92, 58, 123, 47, -24, -86, 33, -45, -54, 0, -24, -5, -61, -2, 92, -40, 34, -97, -73, -78, -88, 97, 90, 43, 0, -69, -125, -117, -34, -23, 56, -34, -64, -107, -83, 36, 68, -85, -48, -65, 48, -116, 0, -22, -105, 55, 64, -36, -111, 7, -88, -30, -28, 1, -19, -23, -112, -49, -50, -127, 83, -85, -107, 14, 84, 91, -50, -115, 94, -111, 0, 87, 37, -80, 126, 71, -62, 10, -50, 106, -53, -80, -117, -124, 123, 47, 85, 48, -3, 20, -61, 13, -15, 52, 3, 46, -72, 103, -90, -12, -118, -115, -56, -97, 22, -71, 62, 92, -28, 121, -124, -48, -126, -27, -53, 120, -19, -86, 102, 38, -102, -101, 127, 3, -90, 37, -72, 19, 112, -106, -108, 28, 4, -120, -73, -99, 102, -103, -52, 106, -57, 92, 2, 20, -50, 52, 68, -50, 25, 33, -76, 19, -32, 88, -87, 58, 124, 45, -59, -111, -49, 72, -54, -11, -63, -101, -106, 60, -46, 103, 52, -47, 77, -32, -51, 65, -126, -15, -58, 92, -100, -70, -7, 52, -85, -92, -61, 27, 31, -110, -61, 38, -39, -29, -105, 11, 95, -107, -5, 1, -64, -35, 98, 67, -116, 4, 107, -6, 89, -78, -79, 123, -98, -116, 87, -28, 8, -70, 24, 80, 72, -81, -45, -58, -27, 80, -55, -65, -69, 121, -85, 110, 91, -39, 21, -63, -66, 26, -62, 60, -18, -44, -111, 70, 27, 36, 92, -98, -102, 58, 50, 86, 30, 112, -21, 85, 100, 124, 18, -27, -59, -4, -52, 57, 85, -36, 92, 41, -33, 76, -42, -90, -50, -11, -40, 33, -107, 4, -33, -83, 127, -88, -31, -4, -122, -41, 116, -83, 87, -39, -117, -118, 75, 11, -21, -49, 59, -114, -87, -115, -67, 21, -52, -90, -77, 120, -95, 113, 126, 32, -85, -120, 69, -19, -40, 6, -18, 123, 60, 71, 123, -38, 62, 10, 8, 67, -57, -65, -94, 56, 112, -90, -100, -60, 63, 86, -38, 4, -125, -76, 35, 95, -7, 38, -106, -43, -46, 120, 6, 4, -80, -25, 31, 122, -62, -84, 42, 119, -4, -2, -70, 72, 88, 11, 127, -3, -21, -7, 22, 5, 119, 116, -71, 32, -69, -33, 58, -112, 75, 84, -101, -80, 108, -31, -30, -74, -25, 115, 110, 47, 113, 48, -111, -47, -4, 16, -124, 55, -96, 95, 16, 42, -51, -65, 76, -78, -76, -109, -111, 50, -55, -64, -102, -47, 29, -52, 91, 14, 118, -34, 122, 35, -102, 86, -30, 8, 61, 110, -19, 62, -121, -108, 99, -27, 47, 28, -71, -38, 103, 49, -63, 52, -76, -27, 36, 77, -85, -56, -67, 8, -8, -74, -83, -61, -116, -101, 90, -56, 28, 11, -87, -78, -67, -83, 36, -18, -72, 37, 115, 81, -50, -37, -47, -16, -65, -10, -115, 29, -72, -84, 50, -83, -105, 63, -98, -78, -31, 24, 29, 15, 53, -101, -124, -121, 56, -99, 78, -64, 21, 76, -21, 68, -28, 61, 76, 40, -29, 52, -15, -50, 112, -81, 103, 10, 11, 77, -94, 70, 103, -55, -90, 127, -76, -27, -126, -124, -5, 76, 57, 27, -68, 95, -120, -46, 2, -43, 42, 127, -32, -27, 40, 3, -86, 113, 92, -79, -112, 34, 94, 11, -92, 14, 122, -34, -17, -36, 36, -60, -97, 122, 26, -128, 46, -31, -67, -110, 10, 60, -73, -2, 94, -124, -67, -16, 78, 123, 6, 53, -4, 32, -16, 61, 41, 116, -125, -106, -126, -25, -38, 55, 42, 13, -21, -72, 80, 68, -114, 10, 94, -63, 100, -111, -110, -86, -92, -31, 31, -120, -60, -79, -46, -102, -103, 81, -75, -102, -45, 54, -1, -4, 60, 34, 50, -33, -57, 78, -52, -103, -35, 57, -84, -47, -40, -120, 116, 121, 118, -79, -64, 61, -18, 66, 119, 95, -34, 108, 38, 117, 29, -17, 47, 120, 26, -101, 87, 55, 10, 16, -123, 80, 85, 14, -117, 1, 25, 23, -116, 126, 22, 83, 23, 37, 6, -120, 103, -49, -12, -22, 60, 65, 99, 23, -25, -64, -20, 14, 10, 105, -31, -110, 29, 1, 62, -18, -31, -65, 69, -42, 70, 90, -85, 77, -6, 0, 53, 42, -120, -117, 8, -39, 45, -26, 95, -87, 95, 47, -70, -69, -98, 87, 44, -86, -117, 117, -96, 50, 36, -5, 95, 65, -31, -88, 38, 56, 47, -36, -66, 79, -127, 17, 66, 123, 5, -93, -123, -60, 45, -53, 0, 53, -73, -43, -82, -11, -68, 94, 51, -90, 91, 67, 87, 56, -33, -17, -116, 66, -71, 104, 19, 37, 43, -41, -67, -56, -39, 54, -34, 40, -65, -57, -46, -28, -9, 26, -124, 81, 75, 106, 23, 12, 3, 51, 5, -127, 20, -110, -93, -85, 119, -118, -12, 93, 10, -73, -99, -23, -52, -20, -77, -68, 107, -32, -24, -124, 14, -54, -36, 97, 65, -86, 39, -105, -80, 40, -54, 65, 61, 12, -87, 75, 20, 39, -17, -83, -36, -65, 39, -66, -33, 53, -82, 10, 22, -10, 16, -92, 8, 65, -84, 13, -17, -128, -80, 112, -112, -101, 54]", + "x-ms-client-request-id" : "1adef1f4-309e-4566-82c0-91d62510994d", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurlrange&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" : "4fd5e7aa-9c01-492e-95fd-894974407ed4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8027-901e-0029-3b4b-6796e9000000", + "Body" : "jtcappendblockfromurlrangejtcappendblockfromurlrange017382868c66afb5ff455Mon, 09 Sep 2019 20:13:55 GMT\"0x8D735623DB80D01\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:55 GMT", + "x-ms-client-request-id" : "4fd5e7aa-9c01-492e-95fd-894974407ed4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlrange017382868c66afb5ff455?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" : "33ee5dbf-deb1-4edc-8f91-700cdb683e61" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c802d-901e-0029-414b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:55 GMT", + "x-ms-client-request-id" : "33ee5dbf-deb1-4edc-8f91-700cdb683e61" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlrange017382868c66afb5ff455", "javablobappendblockfromurlrange1796539031022cbe974", "28818490-4400-4f1e-855e-56356cab35ce", "javablobappendblockfromurlrange20062678ad43ab42c14" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[0].json new file mode 100644 index 000000000000..f6d2cf79f888 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[0].json @@ -0,0 +1,182 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac005720e10981de7fb445?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" : "922c6819-c4ad-4891-adea-483e689e0176" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735624560343C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8900-901e-0029-5f4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:07 GMT", + "x-ms-client-request-id" : "922c6819-c4ad-4891-adea-483e689e0176" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac005720e10981de7fb445/javablobappendblockfromurlsourceac103531c72344facff", + "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" : "0a633eaf-d3e2-4deb-8496-3397ad280760" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562456CEFDD\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8908-901e-0029-664b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:07 GMT", + "x-ms-client-request-id" : "0a633eaf-d3e2-4deb-8496-3397ad280760" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac005720e10981de7fb445?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" : "84fd867b-a963-4597-a7ea-947f825c2b28", + "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" : "\"0x8D735624578F499\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8914-901e-0029-724b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:08 GMT", + "x-ms-client-request-id" : "84fd867b-a963-4597-a7ea-947f825c2b28" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac005720e10981de7fb445/javablobappendblockfromurlsourceac225999ab74aeaecea", + "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" : "c58dd6d5-3d81-4291-abe0-710c102ba567" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735624585FAB8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8922-901e-0029-7e4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:08 GMT", + "x-ms-client-request-id" : "c58dd6d5-3d81-4291-abe0-710c102ba567" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac005720e10981de7fb445/javablobappendblockfromurlsourceac225999ab74aeaecea?comp=appendblock", + "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" : "e21bde74-a4c1-41e9-99f7-4251d8f3ddc6", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:08 GMT", + "ETag" : "\"0x8D7356245925908\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c892b-901e-0029-064b-6796e9000000", + "x-ms-client-request-id" : "e21bde74-a4c1-41e9-99f7-4251d8f3ddc6", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac005720e10981de7fb445/javablobappendblockfromurlsourceac103531c72344facff?comp=appendblock", + "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" : "825e1ba0-1e48-4b55-ad87-8bb12220eb70" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356245A101B4\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c893a-901e-0029-154b-6796e9000000", + "x-ms-client-request-id" : "825e1ba0-1e48-4b55-ad87-8bb12220eb70", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurlsourceac&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" : "98812756-6235-4685-a514-5db0e5ba1e5a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8948-901e-0029-234b-6796e9000000", + "Body" : "jtcappendblockfromurlsourceacjtcappendblockfromurlsourceac005720e10981de7fb445Mon, 09 Sep 2019 20:14:08 GMT\"0x8D735624578F499\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:14:08 GMT", + "x-ms-client-request-id" : "98812756-6235-4685-a514-5db0e5ba1e5a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac005720e10981de7fb445?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" : "27227301-ca05-4506-b214-ed7ebdac3077" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c8955-901e-0029-2f4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:08 GMT", + "x-ms-client-request-id" : "27227301-ca05-4506-b214-ed7ebdac3077" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlsourceac005720e10981de7fb445", "javablobappendblockfromurlsourceac103531c72344facff", "javablobappendblockfromurlsourceac225999ab74aeaecea" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[1].json new file mode 100644 index 000000000000..1b007516613a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[1].json @@ -0,0 +1,182 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac052446581fac7c0e464d?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" : "df2378d2-6fc0-49c7-a73e-0b29691cbcee" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356245C6D0D8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c895f-901e-0029-384b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:08 GMT", + "x-ms-client-request-id" : "df2378d2-6fc0-49c7-a73e-0b29691cbcee" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac052446581fac7c0e464d/javablobappendblockfromurlsourceac128732e52c6827f5b", + "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" : "cec57cc0-471c-45c3-afbc-ba421e69692a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356245D49E39\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c897a-901e-0029-4e4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:08 GMT", + "x-ms-client-request-id" : "cec57cc0-471c-45c3-afbc-ba421e69692a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac052446581fac7c0e464d?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" : "8377011b-e14e-49dc-9e27-e53c3796360b", + "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" : "\"0x8D7356245E0F11B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c898c-901e-0029-5e4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:08 GMT", + "x-ms-client-request-id" : "8377011b-e14e-49dc-9e27-e53c3796360b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac052446581fac7c0e464d/javablobappendblockfromurlsourceac208236e16b5965ad3", + "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" : "6d72cc8b-f148-4068-a4a7-8138dd0a0fa2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356245ED81EE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8996-901e-0029-674b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:08 GMT", + "x-ms-client-request-id" : "6d72cc8b-f148-4068-a4a7-8138dd0a0fa2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac052446581fac7c0e464d/javablobappendblockfromurlsourceac208236e16b5965ad3?comp=appendblock", + "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" : "05cf0db9-a372-4418-b70c-4c8f5452a68b", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:08 GMT", + "ETag" : "\"0x8D7356245FA7C9F\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c89ab-901e-0029-7b4b-6796e9000000", + "x-ms-client-request-id" : "05cf0db9-a372-4418-b70c-4c8f5452a68b", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac052446581fac7c0e464d/javablobappendblockfromurlsourceac128732e52c6827f5b?comp=appendblock", + "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" : "e0e2d5b8-7287-49ab-ac7d-8ae83ca0f49d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735624607774E\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c89bb-901e-0029-084b-6796e9000000", + "x-ms-client-request-id" : "e0e2d5b8-7287-49ab-ac7d-8ae83ca0f49d", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurlsourceac&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" : "ec4e137a-9270-4b2c-ae09-863147dc1427" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c89c4-901e-0029-114b-6796e9000000", + "Body" : "jtcappendblockfromurlsourceacjtcappendblockfromurlsourceac052446581fac7c0e464dMon, 09 Sep 2019 20:14:09 GMT\"0x8D7356245E0F11B\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:14:09 GMT", + "x-ms-client-request-id" : "ec4e137a-9270-4b2c-ae09-863147dc1427", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac052446581fac7c0e464d?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" : "13f3e7d4-494a-4f81-88d5-f3ebbed9b7f6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c89da-901e-0029-254b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:09 GMT", + "x-ms-client-request-id" : "13f3e7d4-494a-4f81-88d5-f3ebbed9b7f6" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlsourceac052446581fac7c0e464d", "javablobappendblockfromurlsourceac128732e52c6827f5b", "javablobappendblockfromurlsourceac208236e16b5965ad3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[2].json new file mode 100644 index 000000000000..11efe8efba3a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[2].json @@ -0,0 +1,182 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac039852737d5f2ecde04f?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" : "ef633e12-5732-4211-b2b6-a4f9b2236466" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562462DE2C0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c89ec-901e-0029-364b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:09 GMT", + "x-ms-client-request-id" : "ef633e12-5732-4211-b2b6-a4f9b2236466" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac039852737d5f2ecde04f/javablobappendblockfromurlsourceac11824770ade54b438", + "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" : "15a9717d-4fc6-46e0-8522-b89d4e1afe41" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562463B8921\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8a01-901e-0029-4a4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:09 GMT", + "x-ms-client-request-id" : "15a9717d-4fc6-46e0-8522-b89d4e1afe41" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac039852737d5f2ecde04f?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" : "5658929e-391b-42fc-92cb-4c5f5b43fd0c", + "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" : "\"0x8D7356246480309\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8a0f-901e-0029-564b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:09 GMT", + "x-ms-client-request-id" : "5658929e-391b-42fc-92cb-4c5f5b43fd0c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac039852737d5f2ecde04f/javablobappendblockfromurlsourceac2710427986c47fc4c", + "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" : "2789fda4-7da2-4f95-9449-bd0639cb507b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735624654E22A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8a21-901e-0029-644b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:09 GMT", + "x-ms-client-request-id" : "2789fda4-7da2-4f95-9449-bd0639cb507b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac039852737d5f2ecde04f/javablobappendblockfromurlsourceac2710427986c47fc4c?comp=appendblock", + "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" : "556b2bc3-d45c-4797-95e6-b5d2a74df627", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:09 GMT", + "ETag" : "\"0x8D735624661679C\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c8a2b-901e-0029-6e4b-6796e9000000", + "x-ms-client-request-id" : "556b2bc3-d45c-4797-95e6-b5d2a74df627", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac039852737d5f2ecde04f/javablobappendblockfromurlsourceac11824770ade54b438?comp=appendblock", + "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" : "7225e918-54bc-48a3-970a-3c32fbb8f348" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73562466F73ED\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c8a3c-901e-0029-7e4b-6796e9000000", + "x-ms-client-request-id" : "7225e918-54bc-48a3-970a-3c32fbb8f348", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurlsourceac&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" : "8aa94d4f-c19b-46c0-89bf-69f3d822a19a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8a50-901e-0029-0b4b-6796e9000000", + "Body" : "jtcappendblockfromurlsourceacjtcappendblockfromurlsourceac039852737d5f2ecde04fMon, 09 Sep 2019 20:14:09 GMT\"0x8D7356246480309\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:14:09 GMT", + "x-ms-client-request-id" : "8aa94d4f-c19b-46c0-89bf-69f3d822a19a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac039852737d5f2ecde04f?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" : "8ffd1809-af6e-4d04-998d-d8088fbdc9f4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c8a5f-901e-0029-184b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:09 GMT", + "x-ms-client-request-id" : "8ffd1809-af6e-4d04-998d-d8088fbdc9f4" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlsourceac039852737d5f2ecde04f", "javablobappendblockfromurlsourceac11824770ade54b438", "javablobappendblockfromurlsourceac2710427986c47fc4c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[3].json new file mode 100644 index 000000000000..81b59517bfac --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[3].json @@ -0,0 +1,214 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac042894c020f201d6ad40?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" : "b7f68d3e-22ea-4875-85d3-ac5240b5b0d0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356246976622\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8a6a-901e-0029-234b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:09 GMT", + "x-ms-client-request-id" : "b7f68d3e-22ea-4875-85d3-ac5240b5b0d0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac042894c020f201d6ad40/javablobappendblockfromurlsourceac126005ad3065738d8", + "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" : "43113722-db75-4177-a4f4-c0a13a0aa8eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356246A49779\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8a78-901e-0029-304b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:09 GMT", + "x-ms-client-request-id" : "43113722-db75-4177-a4f4-c0a13a0aa8eb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac042894c020f201d6ad40?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" : "c4cb9b8e-1d74-4452-927f-bcf58552f17f", + "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" : "\"0x8D7356246B0EA19\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8a8b-901e-0029-434b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:10 GMT", + "x-ms-client-request-id" : "c4cb9b8e-1d74-4452-927f-bcf58552f17f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac042894c020f201d6ad40/javablobappendblockfromurlsourceac248312a471c8db78e", + "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" : "8f42e356-b110-4d18-87f3-db4d5ec805b2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356246BE8CD5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8a9e-901e-0029-554b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:10 GMT", + "x-ms-client-request-id" : "8f42e356-b110-4d18-87f3-db4d5ec805b2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac042894c020f201d6ad40/javablobappendblockfromurlsourceac248312a471c8db78e?comp=appendblock", + "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" : "7638b36c-7490-49b4-bc93-cb8cfe0fec80", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:10 GMT", + "ETag" : "\"0x8D7356246CBAEA5\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c8aae-901e-0029-634b-6796e9000000", + "x-ms-client-request-id" : "7638b36c-7490-49b4-bc93-cb8cfe0fec80", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac042894c020f201d6ad40/javablobappendblockfromurlsourceac248312a471c8db78e", + "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" : "b90245ff-8234-40cc-9686-b2a979e243cb" + }, + "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", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:10 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:14:10 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7356246CBAEA5\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:14:10 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "e27c8ac6-901e-0029-7a4b-6796e9000000", + "x-ms-client-request-id" : "b90245ff-8234-40cc-9686-b2a979e243cb", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac042894c020f201d6ad40/javablobappendblockfromurlsourceac126005ad3065738d8?comp=appendblock", + "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" : "0be4b472-3344-454c-8ef4-38087bf1e2ef" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:10 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356246E7C74A\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c8ad3-901e-0029-074b-6796e9000000", + "x-ms-client-request-id" : "0be4b472-3344-454c-8ef4-38087bf1e2ef", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurlsourceac&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" : "62baf4df-5dcb-4ca0-9ea3-396d42d63227" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8ae3-901e-0029-174b-6796e9000000", + "Body" : "jtcappendblockfromurlsourceacjtcappendblockfromurlsourceac042894c020f201d6ad40Mon, 09 Sep 2019 20:14:10 GMT\"0x8D7356246B0EA19\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:14:10 GMT", + "x-ms-client-request-id" : "62baf4df-5dcb-4ca0-9ea3-396d42d63227", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac042894c020f201d6ad40?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" : "c431b980-5887-4085-9603-9f5f2b753818" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c8af8-901e-0029-2c4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:10 GMT", + "x-ms-client-request-id" : "c431b980-5887-4085-9603-9f5f2b753818" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlsourceac042894c020f201d6ad40", "javablobappendblockfromurlsourceac126005ad3065738d8", "javablobappendblockfromurlsourceac248312a471c8db78e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[4].json new file mode 100644 index 000000000000..5364c9c0b80a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockfromurlsourceac[4].json @@ -0,0 +1,182 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac0280572092393d3e1d40?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" : "6bff8f9d-3465-4d82-8ac4-3839da7e7319" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356247100777\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8b05-901e-0029-384b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:10 GMT", + "x-ms-client-request-id" : "6bff8f9d-3465-4d82-8ac4-3839da7e7319" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac0280572092393d3e1d40/javablobappendblockfromurlsourceac144275f0caf201136", + "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" : "befb4ce3-43a4-4189-87e3-875441821e2d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562471D6015\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8b0d-901e-0029-3f4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:10 GMT", + "x-ms-client-request-id" : "befb4ce3-43a4-4189-87e3-875441821e2d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac0280572092393d3e1d40?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" : "bd46243a-1d6d-4d4d-b2df-df0260dc12b8", + "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" : "\"0x8D735624729647F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8b22-901e-0029-534b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:10 GMT", + "x-ms-client-request-id" : "bd46243a-1d6d-4d4d-b2df-df0260dc12b8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac0280572092393d3e1d40/javablobappendblockfromurlsourceac221500d4d03030658", + "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" : "8527e27e-1f4c-41c7-bbf1-fb803496bd92" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356247366AF0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c8b2d-901e-0029-5e4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:10 GMT", + "x-ms-client-request-id" : "8527e27e-1f4c-41c7-bbf1-fb803496bd92" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac0280572092393d3e1d40/javablobappendblockfromurlsourceac221500d4d03030658?comp=appendblock", + "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" : "b8776483-9ab4-442d-9d38-496098047bbc", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:11 GMT", + "ETag" : "\"0x8D7356247431777\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c8b46-901e-0029-754b-6796e9000000", + "x-ms-client-request-id" : "b8776483-9ab4-442d-9d38-496098047bbc", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac0280572092393d3e1d40/javablobappendblockfromurlsourceac144275f0caf201136?comp=appendblock", + "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" : "a47322d5-0afa-4860-8588-f5d9d4208267" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:14:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:14:11 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735624758C64F\"", + "Content-Length" : "0", + "x-ms-request-id" : "e27c8b5e-901e-0029-0c4b-6796e9000000", + "x-ms-client-request-id" : "a47322d5-0afa-4860-8588-f5d9d4208267", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurlsourceac&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" : "5bb7f91d-f099-45b0-ad33-973b0f413006" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c8b74-901e-0029-204b-6796e9000000", + "Body" : "jtcappendblockfromurlsourceacjtcappendblockfromurlsourceac0280572092393d3e1d40Mon, 09 Sep 2019 20:14:11 GMT\"0x8D735624729647F\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:14:11 GMT", + "x-ms-client-request-id" : "5bb7f91d-f099-45b0-ad33-973b0f413006", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlsourceac0280572092393d3e1d40?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" : "3e86bc78-188b-4419-93fc-04c39315d806" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c8b80-901e-0029-2b4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:14:11 GMT", + "x-ms-client-request-id" : "3e86bc78-188b-4419-93fc-04c39315d806" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlsourceac0280572092393d3e1d40", "javablobappendblockfromurlsourceac144275f0caf201136", "javablobappendblockfromurlsourceac221500d4d03030658" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockia[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockia[0].json new file mode 100644 index 000000000000..d6ad4699e73d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockia[0].json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockia881470115f47?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" : "7a5aca31-0ca7-48b2-a599-c0de0ea299c0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356237F16636\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0348158c-301e-0024-134b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:45 GMT", + "x-ms-client-request-id" : "7a5aca31-0ca7-48b2-a599-c0de0ea299c0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockia881470115f47/javablobappendblockia1appendblobapitestappendblockia88144665c", + "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" : "cac70007-ae56-4be3-ba1d-9741c27850a9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356237FE8013\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0348159c-301e-0024-204b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:45 GMT", + "x-ms-client-request-id" : "cac70007-ae56-4be3-ba1d-9741c27850a9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockia&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" : "f6f552a3-ae25-4b95-98a8-1e1adb75ea0a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "034815ab-301e-0024-2f4b-6779e5000000", + "Body" : "jtcappendblockiajtcappendblockia0appendblobapitestappendblockia881470115f47Mon, 09 Sep 2019 20:13:45 GMT\"0x8D7356237F16636\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:45 GMT", + "x-ms-client-request-id" : "f6f552a3-ae25-4b95-98a8-1e1adb75ea0a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockia881470115f47?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" : "6bf8e5e9-3e17-4af4-8e0e-c3f049ae2805" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "034815b3-301e-0024-374b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:45 GMT", + "x-ms-client-request-id" : "6bf8e5e9-3e17-4af4-8e0e-c3f049ae2805" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockia0appendblobapitestappendblockia881470115f47", "javablobappendblockia1appendblobapitestappendblockia88144665c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockia[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockia[1].json new file mode 100644 index 000000000000..b73a3e930739 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockia[1].json @@ -0,0 +1,101 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockia7f7962999aaf?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" : "76603424-0ea5-4f3c-9727-9bb5ed04969c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623822DF6E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "034815c4-301e-0024-474b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:45 GMT", + "x-ms-client-request-id" : "76603424-0ea5-4f3c-9727-9bb5ed04969c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockia7f7962999aaf/javablobappendblockia1appendblobapitestappendblockia7f715285e", + "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" : "307b69fa-b0b8-41a1-b932-af889ae866cd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562382F5D13\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "034815de-301e-0024-5e4b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:45 GMT", + "x-ms-client-request-id" : "307b69fa-b0b8-41a1-b932-af889ae866cd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockia7f7962999aaf/javablobappendblockia1appendblobapitestappendblockia7f715285e?comp=appendblock", + "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" : "e7b9150d-1032-4ca3-b1b6-de5a6f04d663", + "Content-Type" : "application/octet-stream" + }, + "Response" : null, + "Exception" : { + "ClassName" : "com.azure.core.exception.UnexpectedLengthException", + "ErrorMessage" : "Request body emitted 7 bytes less than the expected 8 bytes." + } + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockia&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" : "7d7bbe22-d62f-40e3-b338-bf9aa69e876e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755c47b7-601e-0051-204b-67fe5e000000", + "Body" : "jtcappendblockiajtcappendblockia0appendblobapitestappendblockia7f7962999aafMon, 09 Sep 2019 20:13:46 GMT\"0x8D735623822DF6E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:45 GMT", + "x-ms-client-request-id" : "7d7bbe22-d62f-40e3-b338-bf9aa69e876e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockia7f7962999aaf?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" : "a49a3200-bbae-4a82-8dff-3075960bf16a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755c47c5-601e-0051-2b4b-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:13:45 GMT", + "x-ms-client-request-id" : "a49a3200-bbae-4a82-8dff-3075960bf16a" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockia0appendblobapitestappendblockia7f7962999aaf", "javablobappendblockia1appendblobapitestappendblockia7f715285e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockia[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockia[2].json new file mode 100644 index 000000000000..495b5979201f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockia[2].json @@ -0,0 +1,101 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockiaf2c0659198b0?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" : "ec57f342-536b-4186-a82c-98ac5658b991" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623855780C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755c47d6-601e-0051-3a4b-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:13:45 GMT", + "x-ms-client-request-id" : "ec57f342-536b-4186-a82c-98ac5658b991" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockiaf2c0659198b0/javablobappendblockia1appendblobapitestappendblockiaf2c95135e", + "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" : "75c1225f-ce8d-4828-b6b9-ac50f72d651e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356238623639\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755c47e3-601e-0051-464b-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:45 GMT", + "x-ms-client-request-id" : "75c1225f-ce8d-4828-b6b9-ac50f72d651e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockiaf2c0659198b0/javablobappendblockia1appendblobapitestappendblockiaf2c95135e?comp=appendblock", + "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" : "0a5e0889-e0e1-46d0-b87b-2f2549824cd6", + "Content-Type" : "application/octet-stream" + }, + "Response" : null, + "Exception" : { + "ClassName" : "com.azure.core.exception.UnexpectedLengthException", + "ErrorMessage" : "Request body emitted 7 bytes more than the expected 6 bytes." + } + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockia&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" : "1b623504-fff0-4bcc-8d05-2b29a8bfe623" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c7952-901e-0029-144b-6796e9000000", + "Body" : "jtcappendblockiajtcappendblockia0appendblobapitestappendblockiaf2c0659198b0Mon, 09 Sep 2019 20:13:46 GMT\"0x8D735623855780C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:46 GMT", + "x-ms-client-request-id" : "1b623504-fff0-4bcc-8d05-2b29a8bfe623", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockia0appendblobapitestappendblockiaf2c0659198b0?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" : "710a29b1-c740-4de6-ae58-dc12a0ef0bb9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c7957-901e-0029-184b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:46 GMT", + "x-ms-client-request-id" : "710a29b1-c740-4de6-ae58-dc12a0ef0bb9" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockia0appendblobapitestappendblockiaf2c0659198b0", "javablobappendblockia1appendblobapitestappendblockiaf2c95135e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockmin.json new file mode 100644 index 000000000000..e799173da01b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblockmin.json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockmin0appendblobapitestappendblockmine3a16335851?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72740128BCBCA\"", + "Last-Modified" : "Thu, 22 Aug 2019 20:34:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec04d2bf-101e-00c7-8028-594cb7000000", + "Date" : "Thu, 22 Aug 2019 20:34:02 GMT", + "x-ms-client-request-id" : "ff23cdf3-3769-4bdb-88c5-3e6a5ceb0b62" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockmin0appendblobapitestappendblockmine3a16335851/javablobappendblockmin1appendblobapitestappendblockmine3a65767", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72740129253C8\"", + "Last-Modified" : "Thu, 22 Aug 2019 20:34:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "ec04d2d8-101e-00c7-1228-594cb7000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 22 Aug 2019 20:34:03 GMT", + "x-ms-client-request-id" : "d1f2b9d4-d398-4e88-854c-4e8c7d40e2b2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockmin0appendblobapitestappendblockmine3a16335851/javablobappendblockmin1appendblobapitestappendblockmine3a65767?comp=appendblock", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Thu, 22 Aug 2019 20:34:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 22 Aug 2019 20:34:03 GMT", + "ETag" : "\"0x8D7274012A1246F\"", + "Content-Length" : "0", + "x-ms-request-id" : "ec04d30b-101e-00c7-3928-594cb7000000", + "x-ms-client-request-id" : "ea0e33c8-285c-43c0-9ed5-37a16da1057d", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcappendblockmin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "ec04d31b-101e-00c7-4728-594cb7000000", + "Body" : "jtcappendblockminjtcappendblockmin0appendblobapitestappendblockmine3a16335851Thu, 22 Aug 2019 20:34:03 GMT\"0x8D72740128BCBCA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Thu, 22 Aug 2019 20:34:03 GMT", + "x-ms-client-request-id" : "780a8629-0384-4bf9-b64e-c86151495212", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcappendblockmin0appendblobapitestappendblockmine3a16335851?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ec04d368-101e-00c7-0928-594cb7000000", + "Date" : "Thu, 22 Aug 2019 20:34:03 GMT", + "x-ms-client-request-id" : "4f5b9840-65f1-477b-a806-ddd82c25ac07" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockmin0appendblobapitestappendblockmine3a16335851", "javablobappendblockmin1appendblobapitestappendblockmine3a65767" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblocknullbody.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblocknullbody.json new file mode 100644 index 000000000000..4d1ef3a8056a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestappendblocknullbody.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblocknullbody0351732028785f0f044f319?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" : "aca89ffa-9d57-4e9e-b64a-341596bac770" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356238CA5002\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c79b6-901e-0029-6d4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:46 GMT", + "x-ms-client-request-id" : "aca89ffa-9d57-4e9e-b64a-341596bac770" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblocknullbody0351732028785f0f044f319/javablobappendblocknullbody1370129d0e906dbdac49b", + "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" : "01e6bef7-c60b-438f-add0-d94721188779" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356238D754B2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e27c79c5-901e-0029-7a4b-6796e9000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:46 GMT", + "x-ms-client-request-id" : "01e6bef7-c60b-438f-add0-d94721188779" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblocknullbody&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" : "fa4f5a7d-bbe0-481a-8dc5-a10ec8166e7d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e27c79da-901e-0029-0f4b-6796e9000000", + "Body" : "jtcappendblocknullbodyjtcappendblocknullbody0351732028785f0f044f319Mon, 09 Sep 2019 20:13:47 GMT\"0x8D7356238CA5002\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:46 GMT", + "x-ms-client-request-id" : "fa4f5a7d-bbe0-481a-8dc5-a10ec8166e7d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblocknullbody0351732028785f0f044f319?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" : "6b9a16b7-0239-46b3-b6eb-8f2a3b332966" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e27c79ed-901e-0029-1f4b-6796e9000000", + "Date" : "Mon, 09 Sep 2019 20:13:47 GMT", + "x-ms-client-request-id" : "6b9a16b7-0239-46b3-b6eb-8f2a3b332966" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblocknullbody0351732028785f0f044f319", "javablobappendblocknullbody1370129d0e906dbdac49b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[0].json new file mode 100644 index 000000000000..d90af54f94a6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[0].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateac7fe20870dd6b08b77?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" : "7b7df9e2-a1a9-4e28-a6c1-e8d7466abbe5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562348B5640\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0348107c-301e-0024-6c4b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:39 GMT", + "x-ms-client-request-id" : "7b7df9e2-a1a9-4e28-a6c1-e8d7466abbe5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateac7fe20870dd6b08b77/javablobcreateac1appendblobapitestcreateac7fe4857135bd90", + "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" : "6e83872b-9ba5-4605-b7e6-f331f90b0580" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356234986E79\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03481091-301e-0024-7a4b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:39 GMT", + "x-ms-client-request-id" : "6e83872b-9ba5-4605-b7e6-f331f90b0580" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateac7fe20870dd6b08b77/javablobcreateac1appendblobapitestcreateac7fe4857135bd90", + "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" : "eb76fac9-cafa-4243-a4a9-90f91ca5bbb0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356234A47E8B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0348109d-301e-0024-064b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:39 GMT", + "x-ms-client-request-id" : "eb76fac9-cafa-4243-a4a9-90f91ca5bbb0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateac&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" : "cd40aaeb-26d1-4d10-837b-9234e26dff3e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "034810b1-301e-0024-1a4b-6779e5000000", + "Body" : "jtccreateacjtccreateac0appendblobapitestcreateac7fe20870dd6b08b77Mon, 09 Sep 2019 20:13:40 GMT\"0x8D73562348B5640\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:39 GMT", + "x-ms-client-request-id" : "cd40aaeb-26d1-4d10-837b-9234e26dff3e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateac7fe20870dd6b08b77?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" : "99afe4e5-a13b-4d83-9849-08e868f1f4ce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "034810c2-301e-0024-294b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:39 GMT", + "x-ms-client-request-id" : "99afe4e5-a13b-4d83-9849-08e868f1f4ce" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0appendblobapitestcreateac7fe20870dd6b08b77", "javablobcreateac1appendblobapitestcreateac7fe4857135bd90" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[1].json new file mode 100644 index 000000000000..212c79755d79 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[1].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateac51943675b80abcf7e?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" : "0a99d08a-d501-423b-91bf-898d16b13d14" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356234C9A2FE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "034810d8-301e-0024-3d4b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:40 GMT", + "x-ms-client-request-id" : "0a99d08a-d501-423b-91bf-898d16b13d14" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateac51943675b80abcf7e/javablobcreateac1appendblobapitestcreateac51965330d15cfc", + "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" : "2cfcd2d2-aea0-435e-b277-8d76c88516ad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356234D757A0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "034810ea-301e-0024-4b4b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:40 GMT", + "x-ms-client-request-id" : "2cfcd2d2-aea0-435e-b277-8d76c88516ad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateac51943675b80abcf7e/javablobcreateac1appendblobapitestcreateac51965330d15cfc", + "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" : "bef691b0-f99d-45b0-b35e-4610d0047adb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356234E38EDB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "034810f4-301e-0024-554b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:40 GMT", + "x-ms-client-request-id" : "bef691b0-f99d-45b0-b35e-4610d0047adb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateac&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" : "fe4ddb3e-ccd1-4bad-84eb-460c171ca33c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "03481107-301e-0024-674b-6779e5000000", + "Body" : "jtccreateacjtccreateac0appendblobapitestcreateac51943675b80abcf7eMon, 09 Sep 2019 20:13:40 GMT\"0x8D7356234C9A2FE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:40 GMT", + "x-ms-client-request-id" : "fe4ddb3e-ccd1-4bad-84eb-460c171ca33c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateac51943675b80abcf7e?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" : "958707d7-8e29-41d4-8a22-696d18df97e1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "03481123-301e-0024-7f4b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:40 GMT", + "x-ms-client-request-id" : "958707d7-8e29-41d4-8a22-696d18df97e1" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0appendblobapitestcreateac51943675b80abcf7e", "javablobcreateac1appendblobapitestcreateac51965330d15cfc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[2].json new file mode 100644 index 000000000000..7c8542ed4376 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[2].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateac83971099ff557debf?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" : "5efb54c9-8410-4799-9d75-9dbbe805ca36" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623509EBE8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03481145-301e-0024-204b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:40 GMT", + "x-ms-client-request-id" : "5efb54c9-8410-4799-9d75-9dbbe805ca36" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateac83971099ff557debf/javablobcreateac1appendblobapitestcreateac839078346c1382", + "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" : "6b09efc5-db3b-4bae-97a6-c84f0e583ca5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356235170478\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0348115a-301e-0024-2f4b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:40 GMT", + "x-ms-client-request-id" : "6b09efc5-db3b-4bae-97a6-c84f0e583ca5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateac83971099ff557debf/javablobcreateac1appendblobapitestcreateac839078346c1382", + "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" : "2686cd41-966e-4164-8134-6e4b45aeba18" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356235233BA5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03481161-301e-0024-364b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:40 GMT", + "x-ms-client-request-id" : "2686cd41-966e-4164-8134-6e4b45aeba18" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateac&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" : "8da07fb7-432f-476c-8ed3-490d311c7da3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "03481176-301e-0024-484b-6779e5000000", + "Body" : "jtccreateacjtccreateac0appendblobapitestcreateac83971099ff557debfMon, 09 Sep 2019 20:13:40 GMT\"0x8D735623509EBE8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:40 GMT", + "x-ms-client-request-id" : "8da07fb7-432f-476c-8ed3-490d311c7da3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateac83971099ff557debf?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" : "114880d6-f885-4122-ade7-29ecfe013207" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "03481187-301e-0024-564b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:40 GMT", + "x-ms-client-request-id" : "114880d6-f885-4122-ade7-29ecfe013207" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0appendblobapitestcreateac83971099ff557debf", "javablobcreateac1appendblobapitestcreateac839078346c1382" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[3].json new file mode 100644 index 000000000000..9d2b34fe1389 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[3].json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateac01f67705716f39cc9?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" : "05e69f91-315a-4358-97ed-0e687b3fd6de" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562354886DD\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03481191-301e-0024-604b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:40 GMT", + "x-ms-client-request-id" : "05e69f91-315a-4358-97ed-0e687b3fd6de" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateac01f67705716f39cc9/javablobcreateac1appendblobapitestcreateac01f02764ef308a", + "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" : "d4126d92-495d-4e75-bae6-d48821ca2723" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356235552A41\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "034811a2-301e-0024-6f4b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:40 GMT", + "x-ms-client-request-id" : "d4126d92-495d-4e75-bae6-d48821ca2723" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateac01f67705716f39cc9/javablobcreateac1appendblobapitestcreateac01f02764ef308a", + "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" : "d7675988-cd72-4b92-8664-f1fc82816be4" + }, + "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", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:41 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:13:41 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7356235552A41\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:13:41 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "034811ad-301e-0024-7a4b-6779e5000000", + "x-ms-client-request-id" : "d7675988-cd72-4b92-8664-f1fc82816be4", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateac01f67705716f39cc9/javablobcreateac1appendblobapitestcreateac01f02764ef308a", + "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" : "c7ceddb9-f482-4088-b009-36bc9c121afd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562356E351B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "034811ca-301e-0024-154b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:41 GMT", + "x-ms-client-request-id" : "c7ceddb9-f482-4088-b009-36bc9c121afd" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateac&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" : "4fba54b1-bb64-454d-9a22-b1065b5a29ec" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "034811d8-301e-0024-214b-6779e5000000", + "Body" : "jtccreateacjtccreateac0appendblobapitestcreateac01f67705716f39cc9Mon, 09 Sep 2019 20:13:41 GMT\"0x8D73562354886DD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:41 GMT", + "x-ms-client-request-id" : "4fba54b1-bb64-454d-9a22-b1065b5a29ec", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateac01f67705716f39cc9?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" : "bd02d529-a7f6-4b8c-917f-d3659004de38" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "034811e1-301e-0024-2a4b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:41 GMT", + "x-ms-client-request-id" : "bd02d529-a7f6-4b8c-917f-d3659004de38" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0appendblobapitestcreateac01f67705716f39cc9", "javablobcreateac1appendblobapitestcreateac01f02764ef308a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[4].json new file mode 100644 index 000000000000..99d585598b62 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[4].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateac16559300c55f8d21b?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" : "546cdbbe-607a-407e-836b-144754485fab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356235950716\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "034811ef-301e-0024-364b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:41 GMT", + "x-ms-client-request-id" : "546cdbbe-607a-407e-836b-144754485fab" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateac16559300c55f8d21b/javablobcreateac1appendblobapitestcreateac1656272721faff", + "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" : "7e5dd277-b82a-4541-ac01-17de77c6fb7c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356235A1F8E3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "034811fe-301e-0024-444b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:41 GMT", + "x-ms-client-request-id" : "7e5dd277-b82a-4541-ac01-17de77c6fb7c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateac16559300c55f8d21b/javablobcreateac1appendblobapitestcreateac1656272721faff", + "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" : "ebca0ce1-b90d-4535-aa58-ae50e9a528de" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356235AE08F6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03481212-301e-0024-534b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:41 GMT", + "x-ms-client-request-id" : "ebca0ce1-b90d-4535-aa58-ae50e9a528de" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateac&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" : "d39f3fab-1055-4152-b203-7be92af81c85" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "03481226-301e-0024-664b-6779e5000000", + "Body" : "jtccreateacjtccreateac0appendblobapitestcreateac16559300c55f8d21bMon, 09 Sep 2019 20:13:41 GMT\"0x8D7356235950716\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:41 GMT", + "x-ms-client-request-id" : "d39f3fab-1055-4152-b203-7be92af81c85", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateac16559300c55f8d21b?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" : "4548d420-4278-46c5-b115-bfcce23f4d8e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "03481238-301e-0024-774b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:41 GMT", + "x-ms-client-request-id" : "4548d420-4278-46c5-b115-bfcce23f4d8e" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0appendblobapitestcreateac16559300c55f8d21b", "javablobcreateac1appendblobapitestcreateac1656272721faff" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[5].json new file mode 100644 index 000000000000..676b10173b35 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateac[5].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateacd53113895f84992e7?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" : "548428d6-3f16-4ed0-9a46-5a8af2158890" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356235D305BE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0348125c-301e-0024-1b4b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:41 GMT", + "x-ms-client-request-id" : "548428d6-3f16-4ed0-9a46-5a8af2158890" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateacd53113895f84992e7/javablobcreateac1appendblobapitestcreateacd53949065e1a7f", + "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" : "5fce1a9f-5fc3-4151-899c-017ce3c1f264" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356235DFA967\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0348126d-301e-0024-294b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:41 GMT", + "x-ms-client-request-id" : "5fce1a9f-5fc3-4151-899c-017ce3c1f264" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateacd53113895f84992e7/javablobcreateac1appendblobapitestcreateacd53949065e1a7f?comp=lease", + "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" : "1f28536d-9a3c-4c19-a108-3ecdfad02c1a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356235DFA967\"", + "x-ms-lease-id" : "0e9f95ba-9d50-4c9d-a92f-7bf9ecb9b857", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03481285-301e-0024-3c4b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:42 GMT", + "x-ms-client-request-id" : "1f28536d-9a3c-4c19-a108-3ecdfad02c1a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateacd53113895f84992e7/javablobcreateac1appendblobapitestcreateacd53949065e1a7f", + "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" : "418855a2-33fa-4b6d-966a-dea01059ec2c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623607D232\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "034812c5-301e-0024-7a4b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:42 GMT", + "x-ms-client-request-id" : "418855a2-33fa-4b6d-966a-dea01059ec2c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateac&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" : "d61a10ee-b1a7-4ecd-9208-8b5cc5726ee0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "034812e3-301e-0024-184b-6779e5000000", + "Body" : "jtccreateacjtccreateac0appendblobapitestcreateacd53113895f84992e7Mon, 09 Sep 2019 20:13:42 GMT\"0x8D7356235D305BE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:42 GMT", + "x-ms-client-request-id" : "d61a10ee-b1a7-4ecd-9208-8b5cc5726ee0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0appendblobapitestcreateacd53113895f84992e7?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" : "be75956c-43f0-4962-873b-979d1b643f10" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "034812f9-301e-0024-2e4b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:42 GMT", + "x-ms-client-request-id" : "be75956c-43f0-4962-873b-979d1b643f10" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0appendblobapitestcreateacd53113895f84992e7", "javablobcreateac1appendblobapitestcreateacd53949065e1a7f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[0].json new file mode 100644 index 000000000000..e45648f2340f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[0].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail5488882914054?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" : "636be806-4c4e-4f36-94f3-438292158448" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562362DE074\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0348130f-301e-0024-434b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:42 GMT", + "x-ms-client-request-id" : "636be806-4c4e-4f36-94f3-438292158448" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail5488882914054/javablobcreateacfail1appendblobapitestcreateacfail548003956d", + "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" : "2109c006-ee34-40c8-bac8-b0a766ddb1ac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562363A8443\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0348131c-301e-0024-4f4b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:42 GMT", + "x-ms-client-request-id" : "2109c006-ee34-40c8-bac8-b0a766ddb1ac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail5488882914054/javablobcreateacfail1appendblobapitestcreateacfail548003956d", + "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" : "e68fa8aa-120c-4c33-a999-7aaba65c1263" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "0348132c-301e-0024-5f4b-6779e5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:0348132c-301e-0024-5f4b-6779e5000000\nTime:2019-09-09T20:13:42.9869056Z", + "Date" : "Mon, 09 Sep 2019 20:13:42 GMT", + "x-ms-client-request-id" : "e68fa8aa-120c-4c33-a999-7aaba65c1263", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateacfail&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" : "066b2c15-72ad-40d1-9ec2-ccf3d832a472" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0348133f-301e-0024-714b-6779e5000000", + "Body" : "jtccreateacfailjtccreateacfail0appendblobapitestcreateacfail5488882914054Mon, 09 Sep 2019 20:13:42 GMT\"0x8D73562362DE074\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:42 GMT", + "x-ms-client-request-id" : "066b2c15-72ad-40d1-9ec2-ccf3d832a472", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail5488882914054?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" : "79d3d567-e01a-46ec-ba5b-5a1bdeb2a45b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0348134c-301e-0024-7e4b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:42 GMT", + "x-ms-client-request-id" : "79d3d567-e01a-46ec-ba5b-5a1bdeb2a45b" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0appendblobapitestcreateacfail5488882914054", "javablobcreateacfail1appendblobapitestcreateacfail548003956d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[1].json new file mode 100644 index 000000000000..775e436ebc6c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[1].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail8be8344174fbd?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" : "50c951fa-43ce-45cb-98be-d2266dcb896f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562366EC5DA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03481365-301e-0024-154b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:42 GMT", + "x-ms-client-request-id" : "50c951fa-43ce-45cb-98be-d2266dcb896f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail8be8344174fbd/javablobcreateacfail1appendblobapitestcreateacfail8be823456b", + "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" : "4a216ff7-add4-457a-b878-2a2ff37a38ba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562367BDF0B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03481373-301e-0024-224b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:42 GMT", + "x-ms-client-request-id" : "4a216ff7-add4-457a-b878-2a2ff37a38ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail8be8344174fbd/javablobcreateacfail1appendblobapitestcreateacfail8be823456b", + "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" : "87d0b0ef-539b-40ec-b078-c30ffc878772" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "03481382-301e-0024-304b-6779e5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:03481382-301e-0024-304b-6779e5000000\nTime:2019-09-09T20:13:43.4182119Z", + "Date" : "Mon, 09 Sep 2019 20:13:42 GMT", + "x-ms-client-request-id" : "87d0b0ef-539b-40ec-b078-c30ffc878772", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateacfail&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" : "c167ccb0-7cd9-40d3-a0c3-061d99bfda70" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "03481389-301e-0024-374b-6779e5000000", + "Body" : "jtccreateacfailjtccreateacfail0appendblobapitestcreateacfail8be8344174fbdMon, 09 Sep 2019 20:13:43 GMT\"0x8D73562366EC5DA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:43 GMT", + "x-ms-client-request-id" : "c167ccb0-7cd9-40d3-a0c3-061d99bfda70", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail8be8344174fbd?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" : "6ae41d0f-67a2-4129-8525-1ff040842440" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "034813a4-301e-0024-504b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:43 GMT", + "x-ms-client-request-id" : "6ae41d0f-67a2-4129-8525-1ff040842440" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0appendblobapitestcreateacfail8be8344174fbd", "javablobcreateacfail1appendblobapitestcreateacfail8be823456b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[2].json new file mode 100644 index 000000000000..cf07c1ff4fa0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[2].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail2b149774013e4?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" : "b6e58c32-5c96-44cf-8f35-ccce25de6947" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356236B06EB6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "034813ba-301e-0024-644b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:43 GMT", + "x-ms-client-request-id" : "b6e58c32-5c96-44cf-8f35-ccce25de6947" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail2b149774013e4/javablobcreateacfail1appendblobapitestcreateacfail2b184306f9", + "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" : "1d127eac-f611-427b-88c5-a3a6eecf5a7e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356236BDFD37\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "034813cf-301e-0024-774b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:43 GMT", + "x-ms-client-request-id" : "1d127eac-f611-427b-88c5-a3a6eecf5a7e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail2b149774013e4/javablobcreateacfail1appendblobapitestcreateacfail2b184306f9", + "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" : "5c9efce8-72fd-442f-a90e-b2ded0580621" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "034813d6-301e-0024-7e4b-6779e5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:034813d6-301e-0024-7e4b-6779e5000000\nTime:2019-09-09T20:13:43.8485182Z", + "Date" : "Mon, 09 Sep 2019 20:13:43 GMT", + "x-ms-client-request-id" : "5c9efce8-72fd-442f-a90e-b2ded0580621", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateacfail&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" : "f0035fa4-9ed2-4dc9-a2f8-0904e93d3879" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "034813ea-301e-0024-114b-6779e5000000", + "Body" : "jtccreateacfailjtccreateacfail0appendblobapitestcreateacfail2b149774013e4Mon, 09 Sep 2019 20:13:43 GMT\"0x8D7356236B06EB6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:43 GMT", + "x-ms-client-request-id" : "f0035fa4-9ed2-4dc9-a2f8-0904e93d3879", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail2b149774013e4?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" : "97cade7d-4e29-4caf-8eb8-d566588fc620" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "034813fc-301e-0024-1f4b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:43 GMT", + "x-ms-client-request-id" : "97cade7d-4e29-4caf-8eb8-d566588fc620" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0appendblobapitestcreateacfail2b149774013e4", "javablobcreateacfail1appendblobapitestcreateacfail2b184306f9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[3].json new file mode 100644 index 000000000000..396dc6c8366e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[3].json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail78f5170661971?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" : "5c21c051-5b95-4f04-9f08-f5ad0977127b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356236F17B1E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03481415-301e-0024-354b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:43 GMT", + "x-ms-client-request-id" : "5c21c051-5b95-4f04-9f08-f5ad0977127b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail78f5170661971/javablobcreateacfail1appendblobapitestcreateacfail78f028566f", + "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" : "e1863870-6448-44eb-a7b7-fdc10cfd4a54" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356236FF30BF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03481427-301e-0024-464b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:43 GMT", + "x-ms-client-request-id" : "e1863870-6448-44eb-a7b7-fdc10cfd4a54" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail78f5170661971/javablobcreateacfail1appendblobapitestcreateacfail78f028566f", + "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" : "e0c74a8f-5d9d-41c8-82a0-db6fd9e455ef" + }, + "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", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:44 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:13:43 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7356236FF30BF\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:13:44 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "0348143d-301e-0024-5c4b-6779e5000000", + "x-ms-client-request-id" : "e0c74a8f-5d9d-41c8-82a0-db6fd9e455ef", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail78f5170661971/javablobcreateacfail1appendblobapitestcreateacfail78f028566f", + "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" : "f14cf44f-18a3-463f-8b86-d33942a1ee29" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "0348144b-301e-0024-694b-6779e5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:0348144b-301e-0024-694b-6779e5000000\nTime:2019-09-09T20:13:44.3618826Z", + "Date" : "Mon, 09 Sep 2019 20:13:43 GMT", + "x-ms-client-request-id" : "f14cf44f-18a3-463f-8b86-d33942a1ee29", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateacfail&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" : "2030e3fa-5307-41fd-99f4-bd7dace632a2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "03481454-301e-0024-724b-6779e5000000", + "Body" : "jtccreateacfailjtccreateacfail0appendblobapitestcreateacfail78f5170661971Mon, 09 Sep 2019 20:13:44 GMT\"0x8D7356236F17B1E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:43 GMT", + "x-ms-client-request-id" : "2030e3fa-5307-41fd-99f4-bd7dace632a2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail78f5170661971?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" : "24d03480-6715-4a6f-a787-859ccc78ecd4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "03481461-301e-0024-7f4b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:44 GMT", + "x-ms-client-request-id" : "24d03480-6715-4a6f-a787-859ccc78ecd4" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0appendblobapitestcreateacfail78f5170661971", "javablobcreateacfail1appendblobapitestcreateacfail78f028566f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[4].json new file mode 100644 index 000000000000..a23910edc10d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateacfail[4].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail8f97157789c7b?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" : "3f0a2bf7-74a2-4a29-8c42-b6348dac6f28" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562373FA941\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03481478-301e-0024-164b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:44 GMT", + "x-ms-client-request-id" : "3f0a2bf7-74a2-4a29-8c42-b6348dac6f28" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail8f97157789c7b/javablobcreateacfail1appendblobapitestcreateacfail8f9998968f", + "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" : "94b28d45-8fc0-4401-8568-ccfa7753f358" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562374CC2AD\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03481485-301e-0024-204b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:44 GMT", + "x-ms-client-request-id" : "94b28d45-8fc0-4401-8568-ccfa7753f358" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail8f97157789c7b/javablobcreateacfail1appendblobapitestcreateacfail8f9998968f?comp=lease", + "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" : "6ea473dc-e3f7-47e0-93b6-1f7767de9c9c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562374CC2AD\"", + "x-ms-lease-id" : "6b6b93f6-7d95-40cd-a82f-f5ce5bbea5c9", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03481491-301e-0024-2c4b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:44 GMT", + "x-ms-client-request-id" : "6ea473dc-e3f7-47e0-93b6-1f7767de9c9c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail8f97157789c7b/javablobcreateacfail1appendblobapitestcreateacfail8f9998968f", + "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" : "3ab977a4-78a7-44d9-96c9-cdd7651d9cdc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "034814a1-301e-0024-394b-6779e5000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:034814a1-301e-0024-394b-6779e5000000\nTime:2019-09-09T20:13:44.8712408Z", + "Date" : "Mon, 09 Sep 2019 20:13:44 GMT", + "x-ms-client-request-id" : "3ab977a4-78a7-44d9-96c9-cdd7651d9cdc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateacfail&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" : "3242840c-b9ff-4cc7-9ab7-b1c16e896390" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "034814b8-301e-0024-504b-6779e5000000", + "Body" : "jtccreateacfailjtccreateacfail0appendblobapitestcreateacfail8f97157789c7bMon, 09 Sep 2019 20:13:44 GMT\"0x8D73562373FA941\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:44 GMT", + "x-ms-client-request-id" : "3242840c-b9ff-4cc7-9ab7-b1c16e896390", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0appendblobapitestcreateacfail8f97157789c7b?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" : "c89f8f0d-6012-4915-94f9-0582bbaee4cb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "034814cb-301e-0024-614b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:44 GMT", + "x-ms-client-request-id" : "c89f8f0d-6012-4915-94f9-0582bbaee4cb" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0appendblobapitestcreateacfail8f97157789c7b", "javablobcreateacfail1appendblobapitestcreateacfail8f9998968f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatedefaults.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatedefaults.json new file mode 100644 index 000000000000..0b9e42bbe546 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatedefaults.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatedefaults0appendblobapitestcreatedefaultsed674870356?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" : "de28b23b-8f94-4a1b-bf8b-b596c1f055f5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562329A4F9B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03480ddc-301e-0024-7e4b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:36 GMT", + "x-ms-client-request-id" : "de28b23b-8f94-4a1b-bf8b-b596c1f055f5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatedefaults0appendblobapitestcreatedefaultsed674870356/javablobcreatedefaults1appendblobapitestcreatedefaultsed673250", + "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" : "bb55e1a3-57f3-4991-9866-647609fb6efe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356232A7DC3B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03480df8-301e-0024-144b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:36 GMT", + "x-ms-client-request-id" : "bb55e1a3-57f3-4991-9866-647609fb6efe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatedefaults0appendblobapitestcreatedefaultsed674870356/javablobcreatedefaults1appendblobapitestcreatedefaultsed673250", + "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" : "ac096698-c621-410b-8146-49e0928f7a2e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356232B461A2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03480e04-301e-0024-204b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:36 GMT", + "x-ms-client-request-id" : "ac096698-c621-410b-8146-49e0928f7a2e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreatedefaults&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" : "82416ca1-a3af-4c46-9dcd-f9794b309707" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "03480e2b-301e-0024-434b-6779e5000000", + "Body" : "jtccreatedefaultsjtccreatedefaults0appendblobapitestcreatedefaultsed674870356Mon, 09 Sep 2019 20:13:36 GMT\"0x8D73562329A4F9B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:36 GMT", + "x-ms-client-request-id" : "82416ca1-a3af-4c46-9dcd-f9794b309707", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatedefaults0appendblobapitestcreatedefaultsed674870356?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" : "16c414c6-d7f3-4524-a422-68f7c2a548e6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "03480e41-301e-0024-584b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:36 GMT", + "x-ms-client-request-id" : "16c414c6-d7f3-4524-a422-68f7c2a548e6" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatedefaults0appendblobapitestcreatedefaultsed674870356", "javablobcreatedefaults1appendblobapitestcreatedefaultsed673250" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateerror.json new file mode 100644 index 000000000000..c523b524975b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateerror.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateerror0appendblobapitestcreateerror1b37245163ee18?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" : "20421166-7233-45ea-a897-00d404e34660" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562331E8BAE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03480eba-301e-0024-484b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:37 GMT", + "x-ms-client-request-id" : "20421166-7233-45ea-a897-00d404e34660" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateerror0appendblobapitestcreateerror1b37245163ee18/javablobcreateerror1appendblobapitestcreateerror1b3249220cf", + "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" : "ce93ccc0-f508-4a56-88cf-047dd049b58f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562332C3F92\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03480ecc-301e-0024-594b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:37 GMT", + "x-ms-client-request-id" : "ce93ccc0-f508-4a56-88cf-047dd049b58f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateerror0appendblobapitestcreateerror1b37245163ee18/javablobcreateerror1appendblobapitestcreateerror1b3249220cf", + "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" : "02ec1580-9710-4e68-995e-ba5ce9ad8e16" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "03480ee4-301e-0024-704b-6779e5000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:03480ee4-301e-0024-704b-6779e5000000\nTime:2019-09-09T20:13:37.8612703Z", + "Date" : "Mon, 09 Sep 2019 20:13:37 GMT", + "x-ms-client-request-id" : "02ec1580-9710-4e68-995e-ba5ce9ad8e16", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateerror&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" : "02cd87fb-bb70-4329-b9b4-680bcff726ef" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "03480ef3-301e-0024-7f4b-6779e5000000", + "Body" : "jtccreateerrorjtccreateerror0appendblobapitestcreateerror1b37245163ee18Mon, 09 Sep 2019 20:13:37 GMT\"0x8D73562331E8BAE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:37 GMT", + "x-ms-client-request-id" : "02cd87fb-bb70-4329-b9b4-680bcff726ef", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateerror0appendblobapitestcreateerror1b37245163ee18?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" : "755f673f-6b90-43ad-9c22-a3e0ec5d4027" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "03480efb-301e-0024-074b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:37 GMT", + "x-ms-client-request-id" : "755f673f-6b90-43ad-9c22-a3e0ec5d4027" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateerror0appendblobapitestcreateerror1b37245163ee18", "javablobcreateerror1appendblobapitestcreateerror1b3249220cf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateheaders[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateheaders[0].json new file mode 100644 index 000000000000..6b1015fd1abb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateheaders[0].json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheaders0c4834152288?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" : "b95aa8ab-c1b9-4cce-bf7c-f1e27873261a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562335D2699\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03480f11-301e-0024-1a4b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:37 GMT", + "x-ms-client-request-id" : "b95aa8ab-c1b9-4cce-bf7c-f1e27873261a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheaders0c4834152288/javablobcreateheaders1appendblobapitestcreateheaders0c4457633", + "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" : "2d3a1a9f-a2b0-455f-980d-60d91d49d56e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562336B01CD\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03480f27-301e-0024-2c4b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:37 GMT", + "x-ms-client-request-id" : "2d3a1a9f-a2b0-455f-980d-60d91d49d56e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheaders0c4834152288/javablobcreateheaders1appendblobapitestcreateheaders0c4457633", + "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" : "e7a7d107-2fec-48bf-a2af-d5cbde3dea08" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623377390C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03480f33-301e-0024-384b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:37 GMT", + "x-ms-client-request-id" : "e7a7d107-2fec-48bf-a2af-d5cbde3dea08" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheaders0c4834152288/javablobcreateheaders1appendblobapitestcreateheaders0c4457633", + "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" : "6815beef-59e7-4a40-9091-59acaea6a8c1" + }, + "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", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:38 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:13:37 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735623377390C\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:13:38 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "03480f42-301e-0024-464b-6779e5000000", + "x-ms-client-request-id" : "6815beef-59e7-4a40-9091-59acaea6a8c1", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateheaders&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" : "57f281b8-1882-4521-8306-c25d1f8c8d17" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "03480f4c-301e-0024-504b-6779e5000000", + "Body" : "jtccreateheadersjtccreateheaders0appendblobapitestcreateheaders0c4834152288Mon, 09 Sep 2019 20:13:38 GMT\"0x8D73562335D2699\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:37 GMT", + "x-ms-client-request-id" : "57f281b8-1882-4521-8306-c25d1f8c8d17", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheaders0c4834152288?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" : "adfe6baf-634e-4cb5-a9d3-d1f3a1c4633a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "03480f63-301e-0024-674b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:38 GMT", + "x-ms-client-request-id" : "adfe6baf-634e-4cb5-a9d3-d1f3a1c4633a" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateheaders0appendblobapitestcreateheaders0c4834152288", "javablobcreateheaders1appendblobapitestcreateheaders0c4457633" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateheaders[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateheaders[1].json new file mode 100644 index 000000000000..fec56d6351e0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreateheaders[1].json @@ -0,0 +1,146 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheaders91216951fcde?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" : "e8a28713-79ca-48f7-aa4b-6baa8f11a912" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356233AA1C0D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03480f6e-301e-0024-724b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:38 GMT", + "x-ms-client-request-id" : "e8a28713-79ca-48f7-aa4b-6baa8f11a912" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheaders91216951fcde/javablobcreateheaders1appendblobapitestcreateheaders912794661", + "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" : "625f8add-52bd-4672-9838-f6f5fbb5eae2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356233B6E5C9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03480f81-301e-0024-034b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:38 GMT", + "x-ms-client-request-id" : "625f8add-52bd-4672-9838-f6f5fbb5eae2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheaders91216951fcde/javablobcreateheaders1appendblobapitestcreateheaders912794661", + "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" : "56b5e35d-01c8-447f-ade1-fb53b101b610" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356233C3442A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03480f8b-301e-0024-0d4b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:38 GMT", + "x-ms-client-request-id" : "56b5e35d-01c8-447f-ade1-fb53b101b610" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheaders91216951fcde/javablobcreateheaders1appendblobapitestcreateheaders912794661", + "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" : "da644e86-b0e8-43c5-a876-3c5a61c020e0" + }, + "Response" : { + "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 20:13:38 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "AppendBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "Content-Encoding" : "encoding", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:13:38 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "03480f9f-301e-0024-204b-6779e5000000", + "Content-Type" : "type", + "x-ms-version" : "2019-02-02", + "x-ms-blob-committed-block-count" : "0", + "Date" : "Mon, 09 Sep 2019 20:13:38 GMT", + "Content-MD5" : "d2grV20xOEQwejFENEUrUEUyNTJnZz09", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "control", + "ETag" : "\"0x8D7356233C3442A\"", + "Content-Disposition" : "disposition", + "x-ms-client-request-id" : "da644e86-b0e8-43c5-a876-3c5a61c020e0", + "Content-Language" : "language" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateheaders&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" : "904a8d86-fafd-4a91-ae31-2bf8679250c1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "03480fac-301e-0024-2b4b-6779e5000000", + "Body" : "jtccreateheadersjtccreateheaders0appendblobapitestcreateheaders91216951fcdeMon, 09 Sep 2019 20:13:38 GMT\"0x8D7356233AA1C0D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:38 GMT", + "x-ms-client-request-id" : "904a8d86-fafd-4a91-ae31-2bf8679250c1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateheaders0appendblobapitestcreateheaders91216951fcde?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" : "71decb76-da05-4919-ae97-0e7c8fccdef6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "03480fb4-301e-0024-334b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:38 GMT", + "x-ms-client-request-id" : "71decb76-da05-4919-ae97-0e7c8fccdef6" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateheaders0appendblobapitestcreateheaders91216951fcde", "javablobcreateheaders1appendblobapitestcreateheaders912794661" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatemetadata[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatemetadata[0].json new file mode 100644 index 000000000000..dcf5a511b7b5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatemetadata[0].json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata60833848a33?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" : "eae5ecaa-8cc5-4ad1-b773-241d84530c01" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356233F4C732\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03480fd0-301e-0024-4b4b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:38 GMT", + "x-ms-client-request-id" : "eae5ecaa-8cc5-4ad1-b773-241d84530c01" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata60833848a33/javablobcreatemetadata1appendblobapitestcreatemetadata60873707", + "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" : "82778a83-e5bf-4247-a617-27fe50090a93" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735623402548B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03480fdf-301e-0024-594b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:38 GMT", + "x-ms-client-request-id" : "82778a83-e5bf-4247-a617-27fe50090a93" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata60833848a33/javablobcreatemetadata1appendblobapitestcreatemetadata60873707", + "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" : "b5402da5-031b-43a6-9b17-871b0f6274e9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562340E8BC9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03480fe9-301e-0024-634b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:38 GMT", + "x-ms-client-request-id" : "b5402da5-031b-43a6-9b17-871b0f6274e9" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata60833848a33/javablobcreatemetadata1appendblobapitestcreatemetadata60873707", + "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" : "78c032c3-e32a-4410-a68b-e4a084be8d06" + }, + "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", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:39 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:13:38 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73562340E8BC9\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:13:39 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "03480ff4-301e-0024-6b4b-6779e5000000", + "x-ms-client-request-id" : "78c032c3-e32a-4410-a68b-e4a084be8d06", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreatemetadata&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" : "468f41e6-74cc-4150-bd0e-cfc56013939b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "03480ffe-301e-0024-754b-6779e5000000", + "Body" : "jtccreatemetadatajtccreatemetadata0appendblobapitestcreatemetadata60833848a33Mon, 09 Sep 2019 20:13:39 GMT\"0x8D7356233F4C732\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:38 GMT", + "x-ms-client-request-id" : "468f41e6-74cc-4150-bd0e-cfc56013939b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata60833848a33?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" : "ce8ce156-6785-4bfe-85d3-c01ab2de8b0f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0348100a-301e-0024-804b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:39 GMT", + "x-ms-client-request-id" : "ce8ce156-6785-4bfe-85d3-c01ab2de8b0f" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemetadata0appendblobapitestcreatemetadata60833848a33", "javablobcreatemetadata1appendblobapitestcreatemetadata60873707" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatemetadata[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatemetadata[1].json new file mode 100644 index 000000000000..8ba72d5ee4ea --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatemetadata[1].json @@ -0,0 +1,143 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata8a8332350bf?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" : "4021b141-a932-4ade-bd1a-16e27106bd13" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562343F242C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0348101d-301e-0024-134b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:39 GMT", + "x-ms-client-request-id" : "4021b141-a932-4ade-bd1a-16e27106bd13" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata8a8332350bf/javablobcreatemetadata1appendblobapitestcreatemetadata8a811458", + "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" : "20a5aba7-14bc-47f3-b420-3d74d427fb60" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562344C3C59\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03481033-301e-0024-264b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:39 GMT", + "x-ms-client-request-id" : "20a5aba7-14bc-47f3-b420-3d74d427fb60" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata8a8332350bf/javablobcreatemetadata1appendblobapitestcreatemetadata8a811458", + "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" : "815c9114-0427-4b31-abc6-41e4045851bc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356234584C7E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0348104a-301e-0024-3d4b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:39 GMT", + "x-ms-client-request-id" : "815c9114-0427-4b31-abc6-41e4045851bc" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata8a8332350bf/javablobcreatemetadata1appendblobapitestcreatemetadata8a811458", + "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" : "c0d7eb8a-f3f6-466e-a2eb-877b3da0f84a" + }, + "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", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:39 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:13:39 GMT", + "x-ms-meta-foo" : "bar", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7356234584C7E\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:13:39 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "03481059-301e-0024-4c4b-6779e5000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "c0d7eb8a-f3f6-466e-a2eb-877b3da0f84a", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreatemetadata&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" : "5cff6ca0-0e25-47b6-9850-ac20629693b7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "03481064-301e-0024-564b-6779e5000000", + "Body" : "jtccreatemetadatajtccreatemetadata0appendblobapitestcreatemetadata8a8332350bfMon, 09 Sep 2019 20:13:39 GMT\"0x8D73562343F242C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:39 GMT", + "x-ms-client-request-id" : "5cff6ca0-0e25-47b6-9850-ac20629693b7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata0appendblobapitestcreatemetadata8a8332350bf?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" : "ebe3b8a8-5c73-4eab-8a4f-dc052297ed80" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0348106c-301e-0024-5c4b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:39 GMT", + "x-ms-client-request-id" : "ebe3b8a8-5c73-4eab-8a4f-dc052297ed80" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemetadata0appendblobapitestcreatemetadata8a8332350bf", "javablobcreatemetadata1appendblobapitestcreatemetadata8a811458" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatemin.json new file mode 100644 index 000000000000..f3eaaa742c94 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/AppendBlobAPITestcreatemin.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemin0appendblobapitestcreatemin06a101155f78161e?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" : "baa1bc5f-c6db-476c-ac1b-e1966fe691e3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356232DE69DD\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03480e5f-301e-0024-734b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:36 GMT", + "x-ms-client-request-id" : "baa1bc5f-c6db-476c-ac1b-e1966fe691e3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemin0appendblobapitestcreatemin06a101155f78161e/javablobcreatemin1appendblobapitestcreatemin06a62117c6534", + "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" : "8ccad02a-2e9a-4145-afc8-b0ed213a16f7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356232EB5A20\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03480e71-301e-0024-014b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:36 GMT", + "x-ms-client-request-id" : "8ccad02a-2e9a-4145-afc8-b0ed213a16f7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemin0appendblobapitestcreatemin06a101155f78161e/javablobcreatemin1appendblobapitestcreatemin06a62117c6534", + "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" : "834326f1-6af2-4da1-9b3b-352459bbe223" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356232F7915A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:13:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "03480e80-301e-0024-104b-6779e5000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:13:36 GMT", + "x-ms-client-request-id" : "834326f1-6af2-4da1-9b3b-352459bbe223" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreatemin&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" : "2740d312-6d8c-45ba-adb4-e301522c48ec" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "03480e92-301e-0024-224b-6779e5000000", + "Body" : "jtccreateminjtccreatemin0appendblobapitestcreatemin06a101155f78161eMon, 09 Sep 2019 20:13:37 GMT\"0x8D7356232DE69DD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:37 GMT", + "x-ms-client-request-id" : "2740d312-6d8c-45ba-adb4-e301522c48ec", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemin0appendblobapitestcreatemin06a101155f78161e?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" : "902db5eb-23fd-4b6e-92fa-47f9f020ebbb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "03480e9f-301e-0024-2f4b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:37 GMT", + "x-ms-client-request-id" : "902db5eb-23fd-4b6e-92fa-47f9f020ebbb" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemin0appendblobapitestcreatemin06a101155f78161e", "javablobcreatemin1appendblobapitestcreatemin06a62117c6534" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopy.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopy.json new file mode 100644 index 000000000000..d4cd1823e37b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopy.json @@ -0,0 +1,219 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcabortcopy0blobapitestabortcopy802911970e44f1a67a0?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" : "cc4bc71c-9362-4505-98f7-b67149b58e1a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356125559229\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca955d-301e-0042-234a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:04 GMT", + "x-ms-client-request-id" : "cc4bc71c-9362-4505-98f7-b67149b58e1a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcabortcopy0blobapitestabortcopy802911970e44f1a67a0/javablobabortcopy1blobapitestabortcopy80205732aa3bd73d", + "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" : "94fac106-0f42-498a-87f2-5c0da71de183", + "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 20:06:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:04 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612563808E\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca9582-301e-0042-424a-67cbbf000000", + "x-ms-client-request-id" : "94fac106-0f42-498a-87f2-5c0da71de183" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcabortcopy0blobapitestabortcopy802911970e44f1a67a0/javablobabortcopy1blobapitestabortcopy80205732aa3bd73d", + "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" : "09954616-2137-429f-a307-d2a95b1aaafe", + "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" : "qT7bc1hoy8A=", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:05 GMT", + "Content-MD5" : "r2JT8oiHieSjEAiYBztwrA==", + "ETag" : "\"0x8D7356125D8026E\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca959c-301e-0042-5b4a-67cbbf000000", + "x-ms-client-request-id" : "09954616-2137-429f-a307-d2a95b1aaafe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcabortcopy0blobapitestabortcopy802911970e44f1a67a0?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" : "bde4abcd-75dc-4c15-ad27-ff3366f909ee", + "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" : "\"0x8D7356125E40ADD\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca962f-301e-0042-644a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:05 GMT", + "x-ms-client-request-id" : "bde4abcd-75dc-4c15-ad27-ff3366f909ee" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobabortcopy2blobapitestabortcopy802853406c9abf0d?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" : "2ef34d1e-0e2c-4d58-933f-9744b2fd5f91" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356125EC3794\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "67f21928-d01e-00b8-324a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:05 GMT", + "x-ms-client-request-id" : "2ef34d1e-0e2c-4d58-933f-9744b2fd5f91" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobabortcopy2blobapitestabortcopy802853406c9abf0d/javablobabortcopy3blobapitestabortcopy802161168b0ca4bb", + "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" : "624a3a8e-26e1-4ef7-a24b-355542c02ec9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "545440c9-eef3-4049-9352-3791766afbf9", + "ETag" : "\"0x8D7356125FB380C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "67f2194f-d01e-00b8-564a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:05 GMT", + "x-ms-client-request-id" : "624a3a8e-26e1-4ef7-a24b-355542c02ec9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobabortcopy2blobapitestabortcopy802853406c9abf0d/javablobabortcopy3blobapitestabortcopy802161168b0ca4bb?copyid=545440c9-eef3-4049-9352-3791766afbf9&comp=copy", + "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" : "c60ecee6-c0a2-4c7d-a581-eb7b2e8e2106" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "67f21999-d01e-00b8-164a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:06 GMT", + "x-ms-client-request-id" : "c60ecee6-c0a2-4c7d-a581-eb7b2e8e2106" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobabortcopy2blobapitestabortcopy802853406c9abf0d?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" : "f12edfd5-599f-472b-8476-52747ebfe5e6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "67f219b5-d01e-00b8-2c4a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:06 GMT", + "x-ms-client-request-id" : "f12edfd5-599f-472b-8476-52747ebfe5e6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcabortcopy&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" : "2399a895-da83-48f5-9029-a52ad368ec1e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9664-301e-0042-144a-67cbbf000000", + "Body" : "jtcabortcopyjtcabortcopy0blobapitestabortcopy802911970e44f1a67a0Mon, 09 Sep 2019 20:06:06 GMT\"0x8D7356125E40ADD\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:06 GMT", + "x-ms-client-request-id" : "2399a895-da83-48f5-9029-a52ad368ec1e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcabortcopy0blobapitestabortcopy802911970e44f1a67a0?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" : "a4c7517c-e560-471f-91c6-dcff4f73477d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca9675-301e-0042-244a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:06 GMT", + "x-ms-client-request-id" : "a4c7517c-e560-471f-91c6-dcff4f73477d" + }, + "Exception" : null + } ], + "variables" : [ "jtcabortcopy0blobapitestabortcopy802911970e44f1a67a0", "javablobabortcopy1blobapitestabortcopy80205732aa3bd73d", "d6ba6650-832b-425e-a944-3f2e80ec513b", "javablobabortcopy2blobapitestabortcopy802853406c9abf0d", "javablobabortcopy3blobapitestabortcopy802161168b0ca4bb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopyerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopyerror.json new file mode 100644 index 000000000000..335452dbf895 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopyerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcabortcopyerror0blobapitestabortcopyerror5e80260114f384?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" : "79406172-72ac-494c-b715-03d1b245b00c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561282E632C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca9a2a-301e-0042-174a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:09 GMT", + "x-ms-client-request-id" : "79406172-72ac-494c-b715-03d1b245b00c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcabortcopyerror0blobapitestabortcopyerror5e80260114f384/javablobabortcopyerror1blobapitestabortcopyerror5e807084f89", + "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" : "773e0d3b-8676-44cf-9a08-af5603ba425a", + "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 20:06:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561283C528C\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca9a40-301e-0042-2a4a-67cbbf000000", + "x-ms-client-request-id" : "773e0d3b-8676-44cf-9a08-af5603ba425a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcabortcopyerror0blobapitestabortcopyerror5e80260114f384/javablobabortcopyerror2blobapitestabortcopyerror5e800925ce4?copyid=id&comp=copy", + "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" : "9affb176-0508-4a58-93c5-f36400229132" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "412", + "StatusCode" : "400", + "x-ms-request-id" : "c5ca9a4e-301e-0042-384a-67cbbf000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:c5ca9a4e-301e-0042-384a-67cbbf000000\nTime:2019-09-09T20:06:10.0224309Zcopyididcopyid needs to be valid Guid.", + "Date" : "Mon, 09 Sep 2019 20:06:09 GMT", + "x-ms-client-request-id" : "9affb176-0508-4a58-93c5-f36400229132", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcabortcopyerror&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" : "492d365e-98a0-4536-976c-954fda2f1ecb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9a5c-301e-0042-464a-67cbbf000000", + "Body" : "jtcabortcopyerrorjtcabortcopyerror0blobapitestabortcopyerror5e80260114f384Mon, 09 Sep 2019 20:06:09 GMT\"0x8D73561282E632C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:09 GMT", + "x-ms-client-request-id" : "492d365e-98a0-4536-976c-954fda2f1ecb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcabortcopyerror0blobapitestabortcopyerror5e80260114f384?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" : "75a91b16-37f1-4782-add2-09ab059bc12a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca9a6b-301e-0042-544a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:09 GMT", + "x-ms-client-request-id" : "75a91b16-37f1-4782-add2-09ab059bc12a" + }, + "Exception" : null + } ], + "variables" : [ "jtcabortcopyerror0blobapitestabortcopyerror5e80260114f384", "javablobabortcopyerror1blobapitestabortcopyerror5e807084f89", "javablobabortcopyerror2blobapitestabortcopyerror5e800925ce4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopylease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopylease.json new file mode 100644 index 000000000000..35fb9b920432 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopylease.json @@ -0,0 +1,266 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcabortcopylease0blobapitestabortcopylease08e2754897cbf7?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" : "eeb0ea38-4331-44c3-adda-cf7739a45a62" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356126FEACFC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca9818-301e-0042-2a4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:07 GMT", + "x-ms-client-request-id" : "eeb0ea38-4331-44c3-adda-cf7739a45a62" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcabortcopylease0blobapitestabortcopylease08e2754897cbf7/javablobabortcopylease1blobapitestabortcopylease08e28097258", + "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" : "0b50771a-0141-4c6a-b9d1-a62479d66cad", + "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 20:06:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:07 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561270CC306\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca9832-301e-0042-434a-67cbbf000000", + "x-ms-client-request-id" : "0b50771a-0141-4c6a-b9d1-a62479d66cad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcabortcopylease0blobapitestabortcopylease08e2754897cbf7/javablobabortcopylease1blobapitestabortcopylease08e28097258", + "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" : "b11f7089-4e3f-49d7-bb8b-e35abe25f5da", + "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" : "HbM9syXaxW8=", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:08 GMT", + "Content-MD5" : "/0UnhvN14DnP2ikePGj1Ew==", + "ETag" : "\"0x8D73561277EAC64\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca984e-301e-0042-5d4a-67cbbf000000", + "x-ms-client-request-id" : "b11f7089-4e3f-49d7-bb8b-e35abe25f5da" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcabortcopylease0blobapitestabortcopylease08e2754897cbf7?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" : "2c260363-da94-4491-aeb7-3b211581f0c7", + "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" : "\"0x8D73561278ADBF4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9918-301e-0042-1f4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:08 GMT", + "x-ms-client-request-id" : "2c260363-da94-4491-aeb7-3b211581f0c7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcabortcopylease2blobapitestabortcopylease08e419773ccf83?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" : "f46743e3-ffea-4918-963d-db8c1c5cf761" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561279307FF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "67f220d2-d01e-00b8-254a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:08 GMT", + "x-ms-client-request-id" : "f46743e3-ffea-4918-963d-db8c1c5cf761" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcabortcopylease2blobapitestabortcopylease08e419773ccf83/javablobabortcopylease3blobapitestabortcopylease08e492054cb", + "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" : "f0eff7c4-61bc-4111-aefb-4d2980b1d67b", + "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 20:06:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356127981AFE\"", + "Content-Length" : "0", + "x-ms-request-id" : "67f220e5-d01e-00b8-344a-67634c000000", + "x-ms-client-request-id" : "f0eff7c4-61bc-4111-aefb-4d2980b1d67b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcabortcopylease2blobapitestabortcopylease08e419773ccf83/javablobabortcopylease3blobapitestabortcopylease08e492054cb?comp=lease", + "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" : "d72eedd0-4e96-4f1a-ba6c-14d51f26098b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356127981AFE\"", + "x-ms-lease-id" : "1ff6344f-57aa-477d-8533-edfbb687e125", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "67f22103-d01e-00b8-4f4a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:08 GMT", + "x-ms-client-request-id" : "d72eedd0-4e96-4f1a-ba6c-14d51f26098b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcabortcopylease2blobapitestabortcopylease08e419773ccf83/javablobabortcopylease3blobapitestabortcopylease08e492054cb", + "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" : "1d7eea56-91f3-4410-bf69-b5a359918b65" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "506c53fb-cca5-40b5-b654-8758c1caec36", + "ETag" : "\"0x8D7356127AC69F1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "67f22112-d01e-00b8-5d4a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:08 GMT", + "x-ms-client-request-id" : "1d7eea56-91f3-4410-bf69-b5a359918b65" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcabortcopylease2blobapitestabortcopylease08e419773ccf83/javablobabortcopylease3blobapitestabortcopylease08e492054cb?copyid=506c53fb-cca5-40b5-b654-8758c1caec36&comp=copy", + "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" : "7901361d-748f-496e-8d01-531cf6706dce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "67f2214a-d01e-00b8-0f4a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:08 GMT", + "x-ms-client-request-id" : "7901361d-748f-496e-8d01-531cf6706dce" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcabortcopylease2blobapitestabortcopylease08e419773ccf83?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" : "624ad03c-8007-4e92-aa84-03c36854a4d9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "67f22162-d01e-00b8-214a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:08 GMT", + "x-ms-client-request-id" : "624ad03c-8007-4e92-aa84-03c36854a4d9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcabortcopylease&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" : "c56820d0-922a-4711-80ad-012463db7494" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9959-301e-0042-5b4a-67cbbf000000", + "Body" : "jtcabortcopyleasejtcabortcopylease0blobapitestabortcopylease08e2754897cbf7Mon, 09 Sep 2019 20:06:08 GMT\"0x8D73561278ADBF4\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:08 GMT", + "x-ms-client-request-id" : "c56820d0-922a-4711-80ad-012463db7494", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcabortcopylease0blobapitestabortcopylease08e2754897cbf7?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" : "1aef0ebb-60c0-4e4a-bc77-9706ef103315" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca9969-301e-0042-684a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:09 GMT", + "x-ms-client-request-id" : "1aef0ebb-60c0-4e4a-bc77-9706ef103315" + }, + "Exception" : null + } ], + "variables" : [ "jtcabortcopylease0blobapitestabortcopylease08e2754897cbf7", "javablobabortcopylease1blobapitestabortcopylease08e28097258", "34c2138b-9f9c-4b97-9f58-0f8b655ca8dd", "jtcabortcopylease2blobapitestabortcopylease08e419773ccf83", "javablobabortcopylease3blobapitestabortcopylease08e492054cb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopyleasefail.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopyleasefail.json new file mode 100644 index 000000000000..ad16198529d3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopyleasefail.json @@ -0,0 +1,269 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcabortcopyleasefail0blobapitestabortcopyleasefailda81985537?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" : "d591ab19-c0d6-43ca-ba7b-255e09c7a57b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735612430B35D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca937a-301e-0042-624a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:02 GMT", + "x-ms-client-request-id" : "d591ab19-c0d6-43ca-ba7b-255e09c7a57b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcabortcopyleasefail0blobapitestabortcopyleasefailda81985537/javablobabortcopyleasefail126478fd4f28059a02429", + "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" : "91347779-3b96-49e0-ba16-060b5d7aaa07", + "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 20:06:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:03 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561243D8FB7\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca9390-301e-0042-764a-67cbbf000000", + "x-ms-client-request-id" : "91347779-3b96-49e0-ba16-060b5d7aaa07" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcabortcopyleasefail0blobapitestabortcopyleasefailda81985537/javablobabortcopyleasefail126478fd4f28059a02429", + "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" : "51312c86-8023-4536-a615-c947d838707f", + "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" : "jTtbwAeRbek=", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:03 GMT", + "Content-MD5" : "QZyLEz7wbXK1nTKJkSyj3A==", + "ETag" : "\"0x8D7356124ADF22D\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca93a7-301e-0042-0b4a-67cbbf000000", + "x-ms-client-request-id" : "51312c86-8023-4536-a615-c947d838707f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcabortcopyleasefail0blobapitestabortcopyleasefailda81985537?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" : "019d7023-c4f3-4db7-ad47-0fb49dded108", + "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" : "\"0x8D7356124BA48A1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9451-301e-0042-274a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:03 GMT", + "x-ms-client-request-id" : "019d7023-c4f3-4db7-ad47-0fb49dded108" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobabortcopyleasefail2339397b3ac866c4b34b8?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" : "7b923f95-020d-40bb-9992-88e6fb475281" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356124DF51FB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "67f21431-d01e-00b8-404a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:04 GMT", + "x-ms-client-request-id" : "7b923f95-020d-40bb-9992-88e6fb475281" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobabortcopyleasefail2339397b3ac866c4b34b8/javablobabortcopyleasefail333721f65588d72c94417", + "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" : "db8878e5-77a6-49f0-acf9-8e7eaac64ef1", + "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 20:06:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:04 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356124E8856A\"", + "Content-Length" : "0", + "x-ms-request-id" : "67f2144e-d01e-00b8-584a-67634c000000", + "x-ms-client-request-id" : "db8878e5-77a6-49f0-acf9-8e7eaac64ef1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobabortcopyleasefail2339397b3ac866c4b34b8/javablobabortcopyleasefail333721f65588d72c94417?comp=lease", + "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" : "3935957a-4425-4004-8821-674c3e3fc3d0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356124E8856A\"", + "x-ms-lease-id" : "389aa0af-c4ea-4aec-8592-c7059e94dc5f", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "67f2146b-d01e-00b8-704a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:04 GMT", + "x-ms-client-request-id" : "3935957a-4425-4004-8821-674c3e3fc3d0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobabortcopyleasefail2339397b3ac866c4b34b8/javablobabortcopyleasefail333721f65588d72c94417", + "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" : "6c023fdb-9236-47dd-a05a-02f731d23e88" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "b841ede2-7a91-4a1a-964c-336530725aab", + "ETag" : "\"0x8D735612523EB5D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "67f21482-d01e-00b8-054a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:04 GMT", + "x-ms-client-request-id" : "6c023fdb-9236-47dd-a05a-02f731d23e88" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobabortcopyleasefail2339397b3ac866c4b34b8/javablobabortcopyleasefail333721f65588d72c94417?copyid=b841ede2-7a91-4a1a-964c-336530725aab&comp=copy", + "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" : "81c949af-2fdd-4649-bf2c-a156dd6bac1a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "67f21576-d01e-00b8-5e4a-67634c000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:67f21576-d01e-00b8-5e4a-67634c000000\nTime:2019-09-09T20:06:04.8073276Z", + "Date" : "Mon, 09 Sep 2019 20:06:04 GMT", + "x-ms-client-request-id" : "81c949af-2fdd-4649-bf2c-a156dd6bac1a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobabortcopyleasefail2339397b3ac866c4b34b8?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" : "168b0dd6-3ac2-4987-98b7-ab0eec44a1cb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "67f215b0-d01e-00b8-144a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:04 GMT", + "x-ms-client-request-id" : "168b0dd6-3ac2-4987-98b7-ab0eec44a1cb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcabortcopyleasefail&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" : "638a8155-c60c-4971-b804-6a1e3732b77b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9536-301e-0042-024a-67cbbf000000", + "Body" : "jtcabortcopyleasefailjtcabortcopyleasefail0blobapitestabortcopyleasefailda81985537Mon, 09 Sep 2019 20:06:04 GMT\"0x8D7356124BA48A1\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:04 GMT", + "x-ms-client-request-id" : "638a8155-c60c-4971-b804-6a1e3732b77b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcabortcopyleasefail0blobapitestabortcopyleasefailda81985537?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" : "bd6790ae-f4b7-4e5e-ae60-2c2bb23d3846" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca954e-301e-0042-164a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:04 GMT", + "x-ms-client-request-id" : "bd6790ae-f4b7-4e5e-ae60-2c2bb23d3846" + }, + "Exception" : null + } ], + "variables" : [ "jtcabortcopyleasefail0blobapitestabortcopyleasefailda81985537", "javablobabortcopyleasefail126478fd4f28059a02429", "afc59993-543b-4958-bc53-a84613f95277", "javablobabortcopyleasefail2339397b3ac866c4b34b8", "javablobabortcopyleasefail333721f65588d72c94417" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopymin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopymin.json new file mode 100644 index 000000000000..68d181892f27 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestabortcopymin.json @@ -0,0 +1,200 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcabortcopymin0blobapitestabortcopyminec6378823d72fcfa?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" : "789ee7e2-369c-465c-b1d3-5d3524f3bbfd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735612625D90D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca9689-301e-0042-374a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:06 GMT", + "x-ms-client-request-id" : "789ee7e2-369c-465c-b1d3-5d3524f3bbfd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcabortcopymin0blobapitestabortcopyminec6378823d72fcfa/javablobabortcopymin1blobapitestabortcopyminec69925633b02", + "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" : "abe6c2a3-b2be-41f3-a1ba-7077c5bb86c1", + "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 20:06:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:06 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612633A09D\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca96a8-301e-0042-544a-67cbbf000000", + "x-ms-client-request-id" : "abe6c2a3-b2be-41f3-a1ba-7077c5bb86c1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcabortcopymin0blobapitestabortcopyminec6378823d72fcfa/javablobabortcopymin1blobapitestabortcopyminec69925633b02", + "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" : "fbef857d-6d5b-47a5-9572-2e6222a2e177", + "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" : "vk0RpYvSH94=", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:07 GMT", + "Content-MD5" : "ASqnylEyXitk9qirhiF9Tw==", + "ETag" : "\"0x8D7356126A98258\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca96ce-301e-0042-764a-67cbbf000000", + "x-ms-client-request-id" : "fbef857d-6d5b-47a5-9572-2e6222a2e177" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcabortcopymin0blobapitestabortcopyminec6378823d72fcfa?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" : "aae4a928-4f00-4f83-a929-214337b43c66", + "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" : "\"0x8D7356126B5B1E0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9785-301e-0042-1f4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:07 GMT", + "x-ms-client-request-id" : "aae4a928-4f00-4f83-a929-214337b43c66" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobabortcopymin2blobapitestabortcopyminec625737df17f?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" : "37b56ac8-2f85-4d12-9dcd-c53f95c30acd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356126C6443B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "67f21d44-d01e-00b8-4d4a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:07 GMT", + "x-ms-client-request-id" : "37b56ac8-2f85-4d12-9dcd-c53f95c30acd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobabortcopymin2blobapitestabortcopyminec625737df17f/javablobabortcopymin3blobapitestabortcopyminec608710abae5", + "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" : "44b6d1b1-4f37-44c4-aa48-6c3a2d425d98" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "d38fb9cb-2448-40fb-9197-bbc6d713610c", + "ETag" : "\"0x8D7356126D5928B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "67f21d70-d01e-00b8-6b4a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:07 GMT", + "x-ms-client-request-id" : "44b6d1b1-4f37-44c4-aa48-6c3a2d425d98" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobabortcopymin2blobapitestabortcopyminec625737df17f/javablobabortcopymin3blobapitestabortcopyminec608710abae5?copyid=d38fb9cb-2448-40fb-9197-bbc6d713610c&comp=copy", + "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" : "824c1926-86f9-44f1-b895-45281799b051" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "67f21db7-d01e-00b8-254a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:07 GMT", + "x-ms-client-request-id" : "824c1926-86f9-44f1-b895-45281799b051" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcabortcopymin&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" : "7ef81915-dcb1-44e3-a302-5991ce9d64df" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca97db-301e-0042-704a-67cbbf000000", + "Body" : "jtcabortcopyminjtcabortcopymin0blobapitestabortcopyminec6378823d72fcfaMon, 09 Sep 2019 20:06:07 GMT\"0x8D7356126B5B1E0\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:07 GMT", + "x-ms-client-request-id" : "7ef81915-dcb1-44e3-a302-5991ce9d64df", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcabortcopymin0blobapitestabortcopyminec6378823d72fcfa?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" : "4032040f-3ed7-44ee-b881-1d89f29893c1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca97f9-301e-0042-0c4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:07 GMT", + "x-ms-client-request-id" : "4032040f-3ed7-44ee-b881-1d89f29893c1" + }, + "Exception" : null + } ], + "variables" : [ "jtcabortcopymin0blobapitestabortcopyminec6378823d72fcfa", "javablobabortcopymin1blobapitestabortcopyminec69925633b02", "800cf876-b388-45dc-890c-4b5e78130a83", "javablobabortcopymin2blobapitestabortcopyminec625737df17f", "javablobabortcopymin3blobapitestabortcopyminec608710abae5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquirelease[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquirelease[0].json new file mode 100644 index 000000000000..2bfde0f04911 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquirelease[0].json @@ -0,0 +1,145 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease00974173ffe5c1a5?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" : "c449b792-787b-41a5-bf03-5ddd04a3a28e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FB4550E6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca4d2e-301e-0042-1849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:54 GMT", + "x-ms-client-request-id" : "c449b792-787b-41a5-bf03-5ddd04a3a28e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease00974173ffe5c1a5/javablobacquirelease1blobapitestacquirelease00936987e76bb", + "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" : "9ab3c957-964b-4d7c-90b2-c0a7e8fe8529", + "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 20:04:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:54 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560FB535854\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca4d4c-301e-0042-3549-67cbbf000000", + "x-ms-client-request-id" : "9ab3c957-964b-4d7c-90b2-c0a7e8fe8529" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease00974173ffe5c1a5/javablobacquirelease1blobapitestacquirelease00936987e76bb?comp=lease", + "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" : "9963a47c-2fff-46a7-a1cb-d00744fe5e25" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FB535854\"", + "x-ms-lease-id" : "ffad0487-eef3-4168-b6e4-e5d160c34290", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca4d6e-301e-0042-5749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:54 GMT", + "x-ms-client-request-id" : "9963a47c-2fff-46a7-a1cb-d00744fe5e25" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease00974173ffe5c1a5/javablobacquirelease1blobapitestacquirelease00936987e76bb", + "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" : "0bfccdeb-da66-40da-a5fa-930113e8db50" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "leased", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:54 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:54 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560FB535854\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:54 GMT", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca4d89-301e-0042-7049-67cbbf000000", + "x-ms-client-request-id" : "0bfccdeb-da66-40da-a5fa-930113e8db50", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquirelease&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" : "16b727f6-20c2-4619-805c-41c8fb30dbfb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca4d9f-301e-0042-0449-67cbbf000000", + "Body" : "jtcacquireleasejtcacquirelease0blobapitestacquirelease00974173ffe5c1a5Mon, 09 Sep 2019 20:04:54 GMT\"0x8D73560FB4550E6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:54 GMT", + "x-ms-client-request-id" : "16b727f6-20c2-4619-805c-41c8fb30dbfb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease00974173ffe5c1a5?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" : "4d093dbd-4f03-4a59-8619-837cb9546048" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca4db7-301e-0042-1c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:54 GMT", + "x-ms-client-request-id" : "4d093dbd-4f03-4a59-8619-837cb9546048" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquirelease0blobapitestacquirelease00974173ffe5c1a5", "javablobacquirelease1blobapitestacquirelease00936987e76bb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquirelease[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquirelease[1].json new file mode 100644 index 000000000000..1b3389b7cb70 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquirelease[1].json @@ -0,0 +1,145 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease546221593eedc90e?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" : "c04d2dec-0e8f-45b8-92c4-acb6bc222fe3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FB92BBB1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca4dd0-301e-0042-3449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:54 GMT", + "x-ms-client-request-id" : "c04d2dec-0e8f-45b8-92c4-acb6bc222fe3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease546221593eedc90e/javablobacquirelease1blobapitestacquirelease546755328899b", + "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" : "f1c330f2-d0a3-4cb0-b1b2-de13a5706d2b", + "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 20:04:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:55 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560FB9FFFA9\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca4ded-301e-0042-4b49-67cbbf000000", + "x-ms-client-request-id" : "f1c330f2-d0a3-4cb0-b1b2-de13a5706d2b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease546221593eedc90e/javablobacquirelease1blobapitestacquirelease546755328899b?comp=lease", + "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" : "2e1f5773-ad58-427a-ada0-0e335567799d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FB9FFFA9\"", + "x-ms-lease-id" : "0a164785-f9fc-4b3f-9116-e29a936574e9", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca4e09-301e-0042-6249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:55 GMT", + "x-ms-client-request-id" : "2e1f5773-ad58-427a-ada0-0e335567799d" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease546221593eedc90e/javablobacquirelease1blobapitestacquirelease546755328899b", + "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" : "7d2aa1e4-f404-4d8d-8e73-705592a425a9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "leased", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:55 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:55 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560FB9FFFA9\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:55 GMT", + "x-ms-lease-duration" : "fixed", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca4e20-301e-0042-7549-67cbbf000000", + "x-ms-client-request-id" : "7d2aa1e4-f404-4d8d-8e73-705592a425a9", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquirelease&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" : "7a46d735-2096-46ef-ae72-9c4dde26b1b8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca4e3b-301e-0042-1049-67cbbf000000", + "Body" : "jtcacquireleasejtcacquirelease0blobapitestacquirelease546221593eedc90eMon, 09 Sep 2019 20:04:55 GMT\"0x8D73560FB92BBB1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:55 GMT", + "x-ms-client-request-id" : "7a46d735-2096-46ef-ae72-9c4dde26b1b8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0blobapitestacquirelease546221593eedc90e?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" : "771ad832-0a98-4bb7-a1c8-161094d31dbd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca4e53-301e-0042-2749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:55 GMT", + "x-ms-client-request-id" : "771ad832-0a98-4bb7-a1c8-161094d31dbd" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquirelease0blobapitestacquirelease546221593eedc90e", "javablobacquirelease1blobapitestacquirelease546755328899b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquirelease[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquirelease[2].json new file mode 100644 index 000000000000..a895193a6110 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquirelease[2].json @@ -0,0 +1,145 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0blobapitestacquireleasec4a168778470f3f4?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" : "62e13623-d14f-4f27-acaa-30cdc2ae7e44" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FBE13820\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca4e76-301e-0042-4849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:55 GMT", + "x-ms-client-request-id" : "62e13623-d14f-4f27-acaa-30cdc2ae7e44" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0blobapitestacquireleasec4a168778470f3f4/javablobacquirelease1blobapitestacquireleasec4a6624636527", + "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" : "94b96fcc-bd0d-4faf-8119-fc789fdff974", + "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 20:04:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:55 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560FBEEF15B\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca4ea2-301e-0042-6e49-67cbbf000000", + "x-ms-client-request-id" : "94b96fcc-bd0d-4faf-8119-fc789fdff974" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0blobapitestacquireleasec4a168778470f3f4/javablobacquirelease1blobapitestacquireleasec4a6624636527?comp=lease", + "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" : "e9196b56-b0d8-433a-9ddc-c07697ff65d8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FBEEF15B\"", + "x-ms-lease-id" : "d97b5b8b-dc24-4066-8538-a4c4514a25c6", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca4ec6-301e-0042-0d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:55 GMT", + "x-ms-client-request-id" : "e9196b56-b0d8-433a-9ddc-c07697ff65d8" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0blobapitestacquireleasec4a168778470f3f4/javablobacquirelease1blobapitestacquireleasec4a6624636527", + "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" : "4eec16d6-277c-401b-a283-6e86069b834a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "leased", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:55 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:55 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560FBEEF15B\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:55 GMT", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca4eec-301e-0042-3149-67cbbf000000", + "x-ms-client-request-id" : "4eec16d6-277c-401b-a283-6e86069b834a", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquirelease&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" : "70c1dd7b-0bf6-4993-a9e8-01c2ca5a558d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca4efe-301e-0042-4149-67cbbf000000", + "Body" : "jtcacquireleasejtcacquirelease0blobapitestacquireleasec4a168778470f3f4Mon, 09 Sep 2019 20:04:55 GMT\"0x8D73560FBE13820\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:55 GMT", + "x-ms-client-request-id" : "70c1dd7b-0bf6-4993-a9e8-01c2ca5a558d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0blobapitestacquireleasec4a168778470f3f4?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" : "548b80e3-d059-498a-9261-0d94b6fcdba9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca4f0f-301e-0042-5249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:55 GMT", + "x-ms-client-request-id" : "548b80e3-d059-498a-9261-0d94b6fcdba9" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquirelease0blobapitestacquireleasec4a168778470f3f4", "javablobacquirelease1blobapitestacquireleasec4a6624636527" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[0].json new file mode 100644 index 000000000000..19f69ee02e10 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[0].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac83844682cf2caf?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" : "463d72c8-6e4f-4e49-9cd2-f9d00c326455" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FC6D8C23\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca4fbc-301e-0042-7449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:56 GMT", + "x-ms-client-request-id" : "463d72c8-6e4f-4e49-9cd2-f9d00c326455" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac83844682cf2caf/javablobacquireleaseac1blobapitestacquireleaseac83854468042", + "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" : "3557d104-2c28-4f6f-ac4b-8405ce760cf9", + "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 20:04:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:56 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560FC7B6C6F\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca4fcc-301e-0042-0349-67cbbf000000", + "x-ms-client-request-id" : "3557d104-2c28-4f6f-ac4b-8405ce760cf9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac83844682cf2caf/javablobacquireleaseac1blobapitestacquireleaseac83854468042?comp=lease", + "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" : "53d499d7-3afe-4810-8401-33c1341cf6c3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FC7B6C6F\"", + "x-ms-lease-id" : "c33812de-3770-4823-855b-c649dabc0b16", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca4fde-301e-0042-1549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:56 GMT", + "x-ms-client-request-id" : "53d499d7-3afe-4810-8401-33c1341cf6c3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquireleaseac&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" : "62bbf814-ed98-47ae-8fdb-be97f1f36ee0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca4ffe-301e-0042-3549-67cbbf000000", + "Body" : "jtcacquireleaseacjtcacquireleaseac0blobapitestacquireleaseac83844682cf2cafMon, 09 Sep 2019 20:04:56 GMT\"0x8D73560FC6D8C23\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:56 GMT", + "x-ms-client-request-id" : "62bbf814-ed98-47ae-8fdb-be97f1f36ee0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac83844682cf2caf?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" : "27206546-2adf-475f-bcc3-bb8c8848141d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca5015-301e-0042-4c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:56 GMT", + "x-ms-client-request-id" : "27206546-2adf-475f-bcc3-bb8c8848141d" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseac0blobapitestacquireleaseac83844682cf2caf", "javablobacquireleaseac1blobapitestacquireleaseac83854468042" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[1].json new file mode 100644 index 000000000000..4eee288a7185 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[1].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac744833262c547c?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" : "ec32b727-c690-426e-b14e-2a803852180e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FCAFAA3F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca502c-301e-0042-6249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:56 GMT", + "x-ms-client-request-id" : "ec32b727-c690-426e-b14e-2a803852180e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac744833262c547c/javablobacquireleaseac1blobapitestacquireleaseac74482674293", + "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" : "97ab9f59-4ed5-4cda-8c0a-736d273eb549", + "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 20:04:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:56 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560FCBCC716\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca504b-301e-0042-7e49-67cbbf000000", + "x-ms-client-request-id" : "97ab9f59-4ed5-4cda-8c0a-736d273eb549" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac744833262c547c/javablobacquireleaseac1blobapitestacquireleaseac74482674293?comp=lease", + "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" : "ae6696b2-e1ad-4147-816e-f2081d6d99ff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FCBCC716\"", + "x-ms-lease-id" : "9ce6f020-6790-4b71-b63f-04f7b87acc5a", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca505f-301e-0042-1249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:56 GMT", + "x-ms-client-request-id" : "ae6696b2-e1ad-4147-816e-f2081d6d99ff" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquireleaseac&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" : "56bfeacc-6d91-4026-b35d-48481704578d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca5074-301e-0042-2649-67cbbf000000", + "Body" : "jtcacquireleaseacjtcacquireleaseac0blobapitestacquireleaseac744833262c547cMon, 09 Sep 2019 20:04:56 GMT\"0x8D73560FCAFAA3F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:57 GMT", + "x-ms-client-request-id" : "56bfeacc-6d91-4026-b35d-48481704578d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac744833262c547c?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" : "93affd53-70d9-4372-b050-e2e7c600b44a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca5088-301e-0042-3a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:57 GMT", + "x-ms-client-request-id" : "93affd53-70d9-4372-b050-e2e7c600b44a" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseac0blobapitestacquireleaseac744833262c547c", "javablobacquireleaseac1blobapitestacquireleaseac74482674293" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[2].json new file mode 100644 index 000000000000..13e55bf88051 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[2].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac28853600b21839?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" : "8d5eb1d2-89ed-4a9f-a830-be0606e2a00e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FCF0DDD9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca50b1-301e-0042-5f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:57 GMT", + "x-ms-client-request-id" : "8d5eb1d2-89ed-4a9f-a830-be0606e2a00e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac28853600b21839/javablobacquireleaseac1blobapitestacquireleaseac28864907500", + "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" : "20e86fe6-41ca-473b-b553-db2d29995a4c", + "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 20:04:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:57 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560FCFDD38E\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca50cd-301e-0042-7a49-67cbbf000000", + "x-ms-client-request-id" : "20e86fe6-41ca-473b-b553-db2d29995a4c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac28853600b21839/javablobacquireleaseac1blobapitestacquireleaseac28864907500?comp=lease", + "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" : "b6b720fa-ea46-45ff-bc3f-c84d005042f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FCFDD38E\"", + "x-ms-lease-id" : "6392edb1-08d4-4f0c-9a4d-3a95130820c4", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca50e8-301e-0042-1549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:57 GMT", + "x-ms-client-request-id" : "b6b720fa-ea46-45ff-bc3f-c84d005042f2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquireleaseac&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" : "025d55fd-383e-445b-8d06-bc39a66e2987" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca5106-301e-0042-3349-67cbbf000000", + "Body" : "jtcacquireleaseacjtcacquireleaseac0blobapitestacquireleaseac28853600b21839Mon, 09 Sep 2019 20:04:57 GMT\"0x8D73560FCF0DDD9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:57 GMT", + "x-ms-client-request-id" : "025d55fd-383e-445b-8d06-bc39a66e2987", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac28853600b21839?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" : "c4d5b62b-c8b4-4299-8358-9cb03a8ab176" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca5119-301e-0042-4649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:57 GMT", + "x-ms-client-request-id" : "c4d5b62b-c8b4-4299-8358-9cb03a8ab176" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseac0blobapitestacquireleaseac28853600b21839", "javablobacquireleaseac1blobapitestacquireleaseac28864907500" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[3].json new file mode 100644 index 000000000000..8119cc750e6d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[3].json @@ -0,0 +1,144 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac4ee68748cb7406?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" : "4826e14c-93a5-4172-91c6-7582538b504c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FD2F78D5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca5141-301e-0042-6b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:57 GMT", + "x-ms-client-request-id" : "4826e14c-93a5-4172-91c6-7582538b504c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac4ee68748cb7406/javablobacquireleaseac1blobapitestacquireleaseac4ee7215959d", + "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" : "7ff13995-d087-41e5-a8a4-b4ea680cd244", + "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 20:04:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:57 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560FD3C6E94\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca515d-301e-0042-0649-67cbbf000000", + "x-ms-client-request-id" : "7ff13995-d087-41e5-a8a4-b4ea680cd244" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac4ee68748cb7406/javablobacquireleaseac1blobapitestacquireleaseac4ee7215959d", + "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" : "672866b7-62f6-4fd3-b760-262e1a297e4c" + }, + "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 20:04:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:57 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560FD3C6E94\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:57 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca5171-301e-0042-1849-67cbbf000000", + "x-ms-client-request-id" : "672866b7-62f6-4fd3-b760-262e1a297e4c", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac4ee68748cb7406/javablobacquireleaseac1blobapitestacquireleaseac4ee7215959d?comp=lease", + "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" : "4ba8d987-1aff-4fb3-aafc-0a445925265a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FD3C6E94\"", + "x-ms-lease-id" : "bd01362b-6f2f-41a0-88f6-4ac0993642c1", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca5193-301e-0042-3749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:57 GMT", + "x-ms-client-request-id" : "4ba8d987-1aff-4fb3-aafc-0a445925265a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquireleaseac&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" : "f318216c-1b2e-4857-8efb-7828084bb71d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca51ab-301e-0042-4f49-67cbbf000000", + "Body" : "jtcacquireleaseacjtcacquireleaseac0blobapitestacquireleaseac4ee68748cb7406Mon, 09 Sep 2019 20:04:57 GMT\"0x8D73560FD2F78D5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:57 GMT", + "x-ms-client-request-id" : "f318216c-1b2e-4857-8efb-7828084bb71d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac4ee68748cb7406?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" : "1a16de49-35b3-4737-b587-1b531d4c7410" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca51be-301e-0042-6149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:58 GMT", + "x-ms-client-request-id" : "1a16de49-35b3-4737-b587-1b531d4c7410" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseac0blobapitestacquireleaseac4ee68748cb7406", "javablobacquireleaseac1blobapitestacquireleaseac4ee7215959d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[4].json new file mode 100644 index 000000000000..cad13eb0ea2b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseac[4].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac9193246516e42b?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" : "d58a4165-7bf6-431f-a8b3-f983825ff106" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FD7DCE0B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca51e3-301e-0042-0649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:58 GMT", + "x-ms-client-request-id" : "d58a4165-7bf6-431f-a8b3-f983825ff106" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac9193246516e42b/javablobacquireleaseac1blobapitestacquireleaseac91999687ff6", + "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" : "006f816e-1399-4443-a9db-2a396fd4632a", + "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 20:04:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:58 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560FD8BAE74\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca51fd-301e-0042-1e49-67cbbf000000", + "x-ms-client-request-id" : "006f816e-1399-4443-a9db-2a396fd4632a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac9193246516e42b/javablobacquireleaseac1blobapitestacquireleaseac91999687ff6?comp=lease", + "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" : "5a92cb67-8c82-487b-8615-58f9f695f060" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FD8BAE74\"", + "x-ms-lease-id" : "a7fe5fe9-c03f-4d66-ada6-00dc012f4843", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca520d-301e-0042-2d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:58 GMT", + "x-ms-client-request-id" : "5a92cb67-8c82-487b-8615-58f9f695f060" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquireleaseac&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" : "1f3e2a19-9a28-4ce1-a69d-58df47c98372" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca521c-301e-0042-3b49-67cbbf000000", + "Body" : "jtcacquireleaseacjtcacquireleaseac0blobapitestacquireleaseac9193246516e42bMon, 09 Sep 2019 20:04:58 GMT\"0x8D73560FD7DCE0B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:58 GMT", + "x-ms-client-request-id" : "1f3e2a19-9a28-4ce1-a69d-58df47c98372", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0blobapitestacquireleaseac9193246516e42b?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" : "d09f1827-2268-4d0b-9e0a-f07add340664" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca522d-301e-0042-4949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:58 GMT", + "x-ms-client-request-id" : "d09f1827-2268-4d0b-9e0a-f07add340664" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseac0blobapitestacquireleaseac9193246516e42b", "javablobacquireleaseac1blobapitestacquireleaseac91999687ff6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseacfail[0].json new file mode 100644 index 000000000000..950528b8bc93 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseacfail[0].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfail92663877be?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" : "26fe279b-361e-41e5-bc8b-f32d20072ab5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FDC01325\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca5250-301e-0042-6c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:58 GMT", + "x-ms-client-request-id" : "26fe279b-361e-41e5-bc8b-f32d20072ab5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfail92663877be/javablobacquireleaseacfail154437adcc9d6be2cb4d4", + "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" : "0b7c0107-954f-455d-ae35-57a3696fcae0", + "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 20:04:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:58 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560FDCD302B\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca5268-301e-0042-7f49-67cbbf000000", + "x-ms-client-request-id" : "0b7c0107-954f-455d-ae35-57a3696fcae0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfail92663877be/javablobacquireleaseacfail154437adcc9d6be2cb4d4?comp=lease", + "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" : "9950f82c-8be1-4f45-b531-657ff2b39991" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca5276-301e-0042-0b49-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca5276-301e-0042-0b49-67cbbf000000\nTime:2019-09-09T20:04:58.8281743Z", + "Date" : "Mon, 09 Sep 2019 20:04:58 GMT", + "x-ms-client-request-id" : "9950f82c-8be1-4f45-b531-657ff2b39991", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquireleaseacfail&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" : "d17c4db5-c9a5-4552-b06c-00da0d717138" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca5295-301e-0042-2a49-67cbbf000000", + "Body" : "jtcacquireleaseacfailjtcacquireleaseacfail0blobapitestacquireleaseacfail92663877beMon, 09 Sep 2019 20:04:58 GMT\"0x8D73560FDC01325\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:58 GMT", + "x-ms-client-request-id" : "d17c4db5-c9a5-4552-b06c-00da0d717138", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfail92663877be?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" : "4b296906-61e3-4e81-859d-97da30ccd431" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca52b6-301e-0042-4949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:58 GMT", + "x-ms-client-request-id" : "4b296906-61e3-4e81-859d-97da30ccd431" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseacfail0blobapitestacquireleaseacfail92663877be", "javablobacquireleaseacfail154437adcc9d6be2cb4d4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseacfail[1].json new file mode 100644 index 000000000000..bcce63b09668 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseacfail[1].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfail774739871f?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" : "f6fe5f25-5780-42b8-aa81-4eea86d43b1a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FE011F86\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca52c6-301e-0042-5949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:59 GMT", + "x-ms-client-request-id" : "f6fe5f25-5780-42b8-aa81-4eea86d43b1a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfail774739871f/javablobacquireleaseacfail1221149ef32c5a45f24a8", + "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" : "5a0f13a0-5d5d-4df3-892a-ba7fd116c74d", + "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 20:04:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:59 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560FE0E63C1\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca52f5-301e-0042-0349-67cbbf000000", + "x-ms-client-request-id" : "5a0f13a0-5d5d-4df3-892a-ba7fd116c74d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfail774739871f/javablobacquireleaseacfail1221149ef32c5a45f24a8?comp=lease", + "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" : "3fa25c76-54c0-4359-b234-5ed1a18d38d7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca530f-301e-0042-1d49-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca530f-301e-0042-1d49-67cbbf000000\nTime:2019-09-09T20:04:59.2544752Z", + "Date" : "Mon, 09 Sep 2019 20:04:59 GMT", + "x-ms-client-request-id" : "3fa25c76-54c0-4359-b234-5ed1a18d38d7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquireleaseacfail&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" : "e9173a0e-6889-4f14-97cd-26d589e75c9b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca5328-301e-0042-3449-67cbbf000000", + "Body" : "jtcacquireleaseacfailjtcacquireleaseacfail0blobapitestacquireleaseacfail774739871fMon, 09 Sep 2019 20:04:59 GMT\"0x8D73560FE011F86\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:59 GMT", + "x-ms-client-request-id" : "e9173a0e-6889-4f14-97cd-26d589e75c9b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfail774739871f?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" : "8d9cc98d-f017-46f4-a848-edabdbd5e16c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca5342-301e-0042-4b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:59 GMT", + "x-ms-client-request-id" : "8d9cc98d-f017-46f4-a848-edabdbd5e16c" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseacfail0blobapitestacquireleaseacfail774739871f", "javablobacquireleaseacfail1221149ef32c5a45f24a8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseacfail[2].json new file mode 100644 index 000000000000..50f0e4db3e81 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseacfail[2].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailc917530222?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" : "0680c3dc-9c64-44ca-bbc5-2e17b7f4ea03" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FE425301\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca5354-301e-0042-5b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:59 GMT", + "x-ms-client-request-id" : "0680c3dc-9c64-44ca-bbc5-2e17b7f4ea03" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailc917530222/javablobacquireleaseacfail107196ca6aee9feea5482", + "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" : "2bb6386e-bb7a-4919-a4a1-a5cecded7d84", + "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 20:04:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:59 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560FE4F491B\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca5361-301e-0042-6649-67cbbf000000", + "x-ms-client-request-id" : "2bb6386e-bb7a-4919-a4a1-a5cecded7d84" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailc917530222/javablobacquireleaseacfail107196ca6aee9feea5482?comp=lease", + "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" : "6b5b82fc-7b1e-4b9f-8c03-4878ea429946" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca5383-301e-0042-0849-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca5383-301e-0042-0849-67cbbf000000\nTime:2019-09-09T20:04:59.6767733Z", + "Date" : "Mon, 09 Sep 2019 20:04:59 GMT", + "x-ms-client-request-id" : "6b5b82fc-7b1e-4b9f-8c03-4878ea429946", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquireleaseacfail&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" : "532a3277-6cb3-4aae-afdd-8aed11624c5b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca5396-301e-0042-1b49-67cbbf000000", + "Body" : "jtcacquireleaseacfailjtcacquireleaseacfail0blobapitestacquireleaseacfailc917530222Mon, 09 Sep 2019 20:04:59 GMT\"0x8D73560FE425301\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:59 GMT", + "x-ms-client-request-id" : "532a3277-6cb3-4aae-afdd-8aed11624c5b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailc917530222?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" : "85484a35-1776-40a3-9bc2-8794c6b8eb37" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca53ab-301e-0042-3049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:59 GMT", + "x-ms-client-request-id" : "85484a35-1776-40a3-9bc2-8794c6b8eb37" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseacfail0blobapitestacquireleaseacfailc917530222", "javablobacquireleaseacfail107196ca6aee9feea5482" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseacfail[3].json new file mode 100644 index 000000000000..7d2ca5c6ae16 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseacfail[3].json @@ -0,0 +1,144 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailc2f39178bc?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" : "074e4165-64f2-4264-8083-f0dcfef33b65" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FE811506\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca53c1-301e-0042-4449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:59 GMT", + "x-ms-client-request-id" : "074e4165-64f2-4264-8083-f0dcfef33b65" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailc2f39178bc/javablobacquireleaseacfail128891122878b1baa841d", + "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" : "db2fcc33-6f06-4fbd-bc1e-5ea808789fce", + "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 20:05:00 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:59 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560FE8DE426\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca53e6-301e-0042-6549-67cbbf000000", + "x-ms-client-request-id" : "db2fcc33-6f06-4fbd-bc1e-5ea808789fce" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailc2f39178bc/javablobacquireleaseacfail128891122878b1baa841d", + "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" : "f6d2b2e2-4a3c-44d0-a084-a015635b7050" + }, + "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 20:05:00 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:05:00 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560FE8DE426\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:00 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca53f8-301e-0042-7749-67cbbf000000", + "x-ms-client-request-id" : "f6d2b2e2-4a3c-44d0-a084-a015635b7050", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailc2f39178bc/javablobacquireleaseacfail128891122878b1baa841d?comp=lease", + "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" : "65d7bf44-b97e-4a0e-b6e1-30c035d44d62" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca5414-301e-0042-1249-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca5414-301e-0042-1249-67cbbf000000\nTime:2019-09-09T20:05:00.1691209Z", + "Date" : "Mon, 09 Sep 2019 20:05:00 GMT", + "x-ms-client-request-id" : "65d7bf44-b97e-4a0e-b6e1-30c035d44d62", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquireleaseacfail&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" : "0baddce5-08d7-4571-8a07-db57b24e8be9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca5433-301e-0042-3149-67cbbf000000", + "Body" : "jtcacquireleaseacfailjtcacquireleaseacfail0blobapitestacquireleaseacfailc2f39178bcMon, 09 Sep 2019 20:04:59 GMT\"0x8D73560FE811506\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:00 GMT", + "x-ms-client-request-id" : "0baddce5-08d7-4571-8a07-db57b24e8be9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacfail0blobapitestacquireleaseacfailc2f39178bc?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" : "bbfed758-9dcb-4d13-bbd7-94c5ca71047b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca5458-301e-0042-5649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:00 GMT", + "x-ms-client-request-id" : "bbfed758-9dcb-4d13-bbd7-94c5ca71047b" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseacfail0blobapitestacquireleaseacfailc2f39178bc", "javablobacquireleaseacfail128891122878b1baa841d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseerror.json new file mode 100644 index 000000000000..e16331f7fcb8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleaseerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseerror0blobapitestacquireleaseerror1db98909899?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" : "5a16c09f-2277-4e8d-8cd7-bdaf7e4a768d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FECCAAA1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca5489-301e-0042-0249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:00 GMT", + "x-ms-client-request-id" : "5a16c09f-2277-4e8d-8cd7-bdaf7e4a768d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseerror0blobapitestacquireleaseerror1db98909899/javablobacquireleaseerror1blobapitestacquireleaseerror1db64065", + "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" : "68cef7d0-1227-4261-8c3d-18ca0775af59", + "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 20:05:00 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:00 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560FED952C7\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca54a9-301e-0042-1f49-67cbbf000000", + "x-ms-client-request-id" : "68cef7d0-1227-4261-8c3d-18ca0775af59" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseerror0blobapitestacquireleaseerror1db98909899/javablobacquireleaseerror2blobapitestacquireleaseerror1db35064?comp=lease", + "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" : "56a2b99b-ff06-4921-98a5-6d473be763fe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "BlobNotFound", + "retry-after" : "0", + "Content-Length" : "215", + "StatusCode" : "404", + "x-ms-request-id" : "c5ca54b8-301e-0042-2d49-67cbbf000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:c5ca54b8-301e-0042-2d49-67cbbf000000\nTime:2019-09-09T20:05:00.5824124Z", + "Date" : "Mon, 09 Sep 2019 20:05:00 GMT", + "x-ms-client-request-id" : "56a2b99b-ff06-4921-98a5-6d473be763fe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquireleaseerror&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" : "2e2ac5a5-399c-4c1f-ae56-a7c412bdb9c5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca54c2-301e-0042-3749-67cbbf000000", + "Body" : "jtcacquireleaseerrorjtcacquireleaseerror0blobapitestacquireleaseerror1db98909899Mon, 09 Sep 2019 20:05:00 GMT\"0x8D73560FECCAAA1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:00 GMT", + "x-ms-client-request-id" : "2e2ac5a5-399c-4c1f-ae56-a7c412bdb9c5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseerror0blobapitestacquireleaseerror1db98909899?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" : "cdba8f3d-27ed-465b-84bd-f45a77bbf4d8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca54d8-301e-0042-4c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:00 GMT", + "x-ms-client-request-id" : "cdba8f3d-27ed-465b-84bd-f45a77bbf4d8" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseerror0blobapitestacquireleaseerror1db98909899", "javablobacquireleaseerror1blobapitestacquireleaseerror1db64065", "javablobacquireleaseerror2blobapitestacquireleaseerror1db35064" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleasemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleasemin.json new file mode 100644 index 000000000000..70efb9d16b86 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestacquireleasemin.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleasemin0blobapitestacquireleaseminc1d027209769b?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" : "ee890d4c-b163-4890-bf33-02d2a74b500d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FC2F6661\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca4f37-301e-0042-7749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:55 GMT", + "x-ms-client-request-id" : "ee890d4c-b163-4890-bf33-02d2a74b500d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleasemin0blobapitestacquireleaseminc1d027209769b/javablobacquireleasemin1blobapitestacquireleaseminc1d220986f", + "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" : "dc7731f4-4a5d-4074-ba09-e34476f682cf", + "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 20:04:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:56 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560FC3BE6DA\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca4f60-301e-0042-1b49-67cbbf000000", + "x-ms-client-request-id" : "dc7731f4-4a5d-4074-ba09-e34476f682cf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleasemin0blobapitestacquireleaseminc1d027209769b/javablobacquireleasemin1blobapitestacquireleaseminc1d220986f?comp=lease", + "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" : "628855cb-a9ad-489f-9cf9-1a418c394b7a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FC3BE6DA\"", + "x-ms-lease-id" : "b8b2313c-f71a-46a1-8e51-adbcfc8f1602", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca4f75-301e-0042-2f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:56 GMT", + "x-ms-client-request-id" : "628855cb-a9ad-489f-9cf9-1a418c394b7a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquireleasemin&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" : "8f849854-5a37-4dd0-8ed9-f70056b5f65f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca4f86-301e-0042-3f49-67cbbf000000", + "Body" : "jtcacquireleaseminjtcacquireleasemin0blobapitestacquireleaseminc1d027209769bMon, 09 Sep 2019 20:04:56 GMT\"0x8D73560FC2F6661\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:56 GMT", + "x-ms-client-request-id" : "8f849854-5a37-4dd0-8ed9-f70056b5f65f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleasemin0blobapitestacquireleaseminc1d027209769b?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" : "3e7595f3-19d6-4504-b6e4-d65344e1edc0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca4f9e-301e-0042-5649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:56 GMT", + "x-ms-client-request-id" : "3e7595f3-19d6-4504-b6e4-d65344e1edc0" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleasemin0blobapitestacquireleaseminc1d027209769b", "javablobacquireleasemin1blobapitestacquireleaseminc1d220986f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestblobdeleteerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestblobdeleteerror.json new file mode 100644 index 000000000000..9ddad21b0a6f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestblobdeleteerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobdeleteerror0blobapitestblobdeleteerrorddc70966adde2?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" : "63136492-b67e-4dfb-8d6d-ca97bbad2a00" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561359D3F30\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cab1f5-301e-0042-1c4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:32 GMT", + "x-ms-client-request-id" : "63136492-b67e-4dfb-8d6d-ca97bbad2a00" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobdeleteerror0blobapitestblobdeleteerrorddc70966adde2/javablobblobdeleteerror1blobapitestblobdeleteerrorddc473162f", + "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" : "2472cc48-b749-4003-8b0a-6b807d1ebce8", + "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 20:06:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:32 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356135AB5A61\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cab212-301e-0042-364a-67cbbf000000", + "x-ms-client-request-id" : "2472cc48-b749-4003-8b0a-6b807d1ebce8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobdeleteerror0blobapitestblobdeleteerrorddc70966adde2/javablobblobdeleteerror2blobapitestblobdeleteerrorddc7103619", + "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" : "7d999c35-d4c9-422f-8916-6e538847e9d0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "BlobNotFound", + "retry-after" : "0", + "Content-Length" : "215", + "StatusCode" : "404", + "x-ms-request-id" : "c5cab230-301e-0042-544a-67cbbf000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:c5cab230-301e-0042-544a-67cbbf000000\nTime:2019-09-09T20:06:32.5573383Z", + "Date" : "Mon, 09 Sep 2019 20:06:32 GMT", + "x-ms-client-request-id" : "7d999c35-d4c9-422f-8916-6e538847e9d0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobdeleteerror&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" : "c9cc393a-2f14-440a-b3a2-18c031e55106" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cab242-301e-0042-654a-67cbbf000000", + "Body" : "jtcblobdeleteerrorjtcblobdeleteerror0blobapitestblobdeleteerrorddc70966adde2Mon, 09 Sep 2019 20:06:32 GMT\"0x8D73561359D3F30\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:32 GMT", + "x-ms-client-request-id" : "c9cc393a-2f14-440a-b3a2-18c031e55106", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobdeleteerror0blobapitestblobdeleteerrorddc70966adde2?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" : "d2397ed1-2957-40ab-8dee-8e272443aeb6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cab250-301e-0042-734a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:32 GMT", + "x-ms-client-request-id" : "d2397ed1-2957-40ab-8dee-8e272443aeb6" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobdeleteerror0blobapitestblobdeleteerrorddc70966adde2", "javablobblobdeleteerror1blobapitestblobdeleteerrorddc473162f", "javablobblobdeleteerror2blobapitestblobdeleteerrorddc7103619" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreaklease[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreaklease[0].json new file mode 100644 index 000000000000..d0ed0e53452b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreaklease[0].json @@ -0,0 +1,166 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease05d47419d4d05e1216?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" : "8edba37a-a639-4555-8552-041535477f79" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611017295F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca71bd-301e-0042-0149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:29 GMT", + "x-ms-client-request-id" : "8edba37a-a639-4555-8552-041535477f79" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease05d47419d4d05e1216/javablobbreaklease1blobapitestbreaklease05d774471402963", + "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" : "01d4090a-8b5e-4966-99a4-130b1d1178a8", + "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 20:05:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611025104B\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca71d3-301e-0042-1649-67cbbf000000", + "x-ms-client-request-id" : "01d4090a-8b5e-4966-99a4-130b1d1178a8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease05d47419d4d05e1216/javablobbreaklease1blobapitestbreaklease05d774471402963?comp=lease", + "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" : "b47e3096-90a6-43b3-b7d1-688abf78acf1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611025104B\"", + "x-ms-lease-id" : "468744b3-147c-4737-b551-296658beea05", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca71e2-301e-0042-2549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:29 GMT", + "x-ms-client-request-id" : "b47e3096-90a6-43b3-b7d1-688abf78acf1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease05d47419d4d05e1216/javablobbreaklease1blobapitestbreaklease05d774471402963?comp=lease", + "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" : "e2ba4885-2586-4191-a859-e693efde7144" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611025104B\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca71ef-301e-0042-3249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:29 GMT", + "x-ms-client-request-id" : "e2ba4885-2586-4191-a859-e693efde7144" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease05d47419d4d05e1216/javablobbreaklease1blobapitestbreaklease05d774471402963", + "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" : "3685d9a7-b8c5-4cbd-a013-fb54c19288f0" + }, + "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" : "broken", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:05:29 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735611025104B\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:29 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca7203-301e-0042-4649-67cbbf000000", + "x-ms-client-request-id" : "3685d9a7-b8c5-4cbd-a013-fb54c19288f0", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreaklease&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" : "ff69a47a-babf-48c9-8bd0-a95545814133" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca7214-301e-0042-5749-67cbbf000000", + "Body" : "jtcbreakleasejtcbreaklease0blobapitestbreaklease05d47419d4d05e1216Mon, 09 Sep 2019 20:05:29 GMT\"0x8D735611017295F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:29 GMT", + "x-ms-client-request-id" : "ff69a47a-babf-48c9-8bd0-a95545814133", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease05d47419d4d05e1216?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" : "a9844ebf-de44-4393-b10a-552188b17073" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca7228-301e-0042-6b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:29 GMT", + "x-ms-client-request-id" : "a9844ebf-de44-4393-b10a-552188b17073" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreaklease0blobapitestbreaklease05d47419d4d05e1216", "javablobbreaklease1blobapitestbreaklease05d774471402963", "468744b3-147c-4737-b551-296658beea05" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreaklease[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreaklease[1].json new file mode 100644 index 000000000000..866e9968f474 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreaklease[1].json @@ -0,0 +1,166 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease7a732352426c4bddad?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" : "d249ea96-a0f1-49d5-a967-d751a3664b1b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356110762365\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7241-301e-0042-0249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:29 GMT", + "x-ms-client-request-id" : "d249ea96-a0f1-49d5-a967-d751a3664b1b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease7a732352426c4bddad/javablobbreaklease1blobapitestbreaklease7a739884cf89d0c", + "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" : "6adeb31d-080e-43e0-be99-6c7cb8b692eb", + "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 20:05:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611083E362\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca725e-301e-0042-1c49-67cbbf000000", + "x-ms-client-request-id" : "6adeb31d-080e-43e0-be99-6c7cb8b692eb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease7a732352426c4bddad/javablobbreaklease1blobapitestbreaklease7a739884cf89d0c?comp=lease", + "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" : "688d3e2b-8fae-443d-961e-a5c32faa3526" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611083E362\"", + "x-ms-lease-id" : "6e1146ed-a2ca-4007-a9fa-18f0d6ab90d4", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7278-301e-0042-3549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:30 GMT", + "x-ms-client-request-id" : "688d3e2b-8fae-443d-961e-a5c32faa3526" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease7a732352426c4bddad/javablobbreaklease1blobapitestbreaklease7a739884cf89d0c?comp=lease", + "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" : "0d5d48f4-8990-4248-8723-4fa129e6501a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611083E362\"", + "x-ms-lease-time" : "20", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca728a-301e-0042-4549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:30 GMT", + "x-ms-client-request-id" : "0d5d48f4-8990-4248-8723-4fa129e6501a" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease7a732352426c4bddad/javablobbreaklease1blobapitestbreaklease7a739884cf89d0c", + "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" : "107a1c5b-fea5-48ee-ae9b-e55e25166736" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "breaking", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:05:30 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735611083E362\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:30 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca729e-301e-0042-5749-67cbbf000000", + "x-ms-client-request-id" : "107a1c5b-fea5-48ee-ae9b-e55e25166736", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreaklease&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" : "2d7394a5-089a-4b69-934c-8ce583dd758d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca72ad-301e-0042-6549-67cbbf000000", + "Body" : "jtcbreakleasejtcbreaklease0blobapitestbreaklease7a732352426c4bddadMon, 09 Sep 2019 20:05:30 GMT\"0x8D7356110762365\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:30 GMT", + "x-ms-client-request-id" : "2d7394a5-089a-4b69-934c-8ce583dd758d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease7a732352426c4bddad?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" : "11a7e450-03a4-47c4-8adf-4b5cd7446ab9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca72bc-301e-0042-7249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:30 GMT", + "x-ms-client-request-id" : "11a7e450-03a4-47c4-8adf-4b5cd7446ab9" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreaklease0blobapitestbreaklease7a732352426c4bddad", "javablobbreaklease1blobapitestbreaklease7a739884cf89d0c", "6e1146ed-a2ca-4007-a9fa-18f0d6ab90d4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreaklease[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreaklease[2].json new file mode 100644 index 000000000000..bcd721ad0c72 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreaklease[2].json @@ -0,0 +1,166 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease9f492406e069b7ee97?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" : "c4139a7e-84ee-415b-a81e-4a1b35b16060" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356110D01378\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca72d2-301e-0042-0549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:30 GMT", + "x-ms-client-request-id" : "c4139a7e-84ee-415b-a81e-4a1b35b16060" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease9f492406e069b7ee97/javablobbreaklease1blobapitestbreaklease9f487978dd76028", + "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" : "d99e467b-b457-4f16-9c17-0b9149a0f15e", + "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 20:05:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356110DCE901\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca72ee-301e-0042-1c49-67cbbf000000", + "x-ms-client-request-id" : "d99e467b-b457-4f16-9c17-0b9149a0f15e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease9f492406e069b7ee97/javablobbreaklease1blobapitestbreaklease9f487978dd76028?comp=lease", + "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" : "b700f33e-fee0-438b-a346-b31025ea9689" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356110DCE901\"", + "x-ms-lease-id" : "52fb2f01-e02c-42df-9ea4-ccf4678ccd4d", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca72f4-301e-0042-2149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:30 GMT", + "x-ms-client-request-id" : "b700f33e-fee0-438b-a346-b31025ea9689" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease9f492406e069b7ee97/javablobbreaklease1blobapitestbreaklease9f487978dd76028?comp=lease", + "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" : "4f20e3f3-5423-4dfc-91d7-25f7c4c0975a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356110DCE901\"", + "x-ms-lease-time" : "15", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca7304-301e-0042-2d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:30 GMT", + "x-ms-client-request-id" : "4f20e3f3-5423-4dfc-91d7-25f7c4c0975a" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease9f492406e069b7ee97/javablobbreaklease1blobapitestbreaklease9f487978dd76028", + "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" : "dd67d27a-2005-4ccd-937a-a532d0988cd3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "breaking", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:05:30 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7356110DCE901\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:30 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca7316-301e-0042-3c49-67cbbf000000", + "x-ms-client-request-id" : "dd67d27a-2005-4ccd-937a-a532d0988cd3", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreaklease&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" : "98d5bb26-7d61-4303-a263-463721fb18d2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca7326-301e-0042-4c49-67cbbf000000", + "Body" : "jtcbreakleasejtcbreaklease0blobapitestbreaklease9f492406e069b7ee97Mon, 09 Sep 2019 20:05:30 GMT\"0x8D7356110D01378\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:30 GMT", + "x-ms-client-request-id" : "98d5bb26-7d61-4303-a263-463721fb18d2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0blobapitestbreaklease9f492406e069b7ee97?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" : "87f94858-e860-442a-91d3-2279f31c7d89" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca7339-301e-0042-5c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:31 GMT", + "x-ms-client-request-id" : "87f94858-e860-442a-91d3-2279f31c7d89" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreaklease0blobapitestbreaklease9f492406e069b7ee97", "javablobbreaklease1blobapitestbreaklease9f487978dd76028", "52fb2f01-e02c-42df-9ea4-ccf4678ccd4d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[0].json new file mode 100644 index 000000000000..c475f1a017dc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[0].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac63c98108354a96ef?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" : "1806ab6c-5c42-4c4b-94a8-ba5170d2ef7c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561117683B0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca73b0-301e-0042-4b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:31 GMT", + "x-ms-client-request-id" : "1806ab6c-5c42-4c4b-94a8-ba5170d2ef7c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac63c98108354a96ef/javablobbreakleaseac1blobapitestbreakleaseac63c35449096ea", + "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" : "19e59c7c-aa74-4b84-aec9-caa0da831579", + "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 20:05:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611183CEB6\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca73ca-301e-0042-6049-67cbbf000000", + "x-ms-client-request-id" : "19e59c7c-aa74-4b84-aec9-caa0da831579" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac63c98108354a96ef/javablobbreakleaseac1blobapitestbreakleaseac63c35449096ea?comp=lease", + "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" : "b17aae2e-f006-4044-9b08-aa4feaa0f8b4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611183CEB6\"", + "x-ms-lease-id" : "2f92ed84-b0c1-4752-aefe-5db8d8b538eb", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca73e2-301e-0042-7749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:31 GMT", + "x-ms-client-request-id" : "b17aae2e-f006-4044-9b08-aa4feaa0f8b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac63c98108354a96ef/javablobbreakleaseac1blobapitestbreakleaseac63c35449096ea?comp=lease", + "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" : "3322cce7-8654-4611-b8f1-077ba5307c72" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611183CEB6\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca73ef-301e-0042-0449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:31 GMT", + "x-ms-client-request-id" : "3322cce7-8654-4611-b8f1-077ba5307c72" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreakleaseac&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" : "99cf9f14-cd58-495b-95fb-a70c29da9c75" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca7404-301e-0042-1849-67cbbf000000", + "Body" : "jtcbreakleaseacjtcbreakleaseac0blobapitestbreakleaseac63c98108354a96efMon, 09 Sep 2019 20:05:31 GMT\"0x8D73561117683B0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:31 GMT", + "x-ms-client-request-id" : "99cf9f14-cd58-495b-95fb-a70c29da9c75", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac63c98108354a96ef?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" : "e080f3a0-0559-4796-af05-24c3610cda0a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca741f-301e-0042-3249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:32 GMT", + "x-ms-client-request-id" : "e080f3a0-0559-4796-af05-24c3610cda0a" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseac0blobapitestbreakleaseac63c98108354a96ef", "javablobbreakleaseac1blobapitestbreakleaseac63c35449096ea" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[1].json new file mode 100644 index 000000000000..9cd41dc1e2cd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[1].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac21020402438f46f9?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" : "60be8aee-4059-4e91-b6ef-6485dbcae84f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356111C54E24\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7437-301e-0042-4a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:32 GMT", + "x-ms-client-request-id" : "60be8aee-4059-4e91-b6ef-6485dbcae84f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac21020402438f46f9/javablobbreakleaseac1blobapitestbreakleaseac21020607af1d0", + "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" : "0e59826e-6554-4448-8616-b5abe10f7716", + "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 20:05:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:32 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356111D2723A\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca744a-301e-0042-5c49-67cbbf000000", + "x-ms-client-request-id" : "0e59826e-6554-4448-8616-b5abe10f7716" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac21020402438f46f9/javablobbreakleaseac1blobapitestbreakleaseac21020607af1d0?comp=lease", + "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" : "e8235c61-f8f3-45ea-b3d0-55f1ea3fce74" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356111D2723A\"", + "x-ms-lease-id" : "8e8852b4-0776-4380-ad05-4e6f6fb7595c", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7461-301e-0042-7149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:32 GMT", + "x-ms-client-request-id" : "e8235c61-f8f3-45ea-b3d0-55f1ea3fce74" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac21020402438f46f9/javablobbreakleaseac1blobapitestbreakleaseac21020607af1d0?comp=lease", + "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" : "7fba652b-39f4-428a-b8a4-44b91039edcb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356111D2723A\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca7471-301e-0042-8049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:32 GMT", + "x-ms-client-request-id" : "7fba652b-39f4-428a-b8a4-44b91039edcb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreakleaseac&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" : "0aa30b67-ecfb-46ba-a8d9-4e93aece0937" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca748c-301e-0042-1749-67cbbf000000", + "Body" : "jtcbreakleaseacjtcbreakleaseac0blobapitestbreakleaseac21020402438f46f9Mon, 09 Sep 2019 20:05:32 GMT\"0x8D7356111C54E24\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:32 GMT", + "x-ms-client-request-id" : "0aa30b67-ecfb-46ba-a8d9-4e93aece0937", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac21020402438f46f9?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" : "9e1cbd60-4ebe-47c3-b7a7-dcc3af47b56a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca7499-301e-0042-2449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:32 GMT", + "x-ms-client-request-id" : "9e1cbd60-4ebe-47c3-b7a7-dcc3af47b56a" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseac0blobapitestbreakleaseac21020402438f46f9", "javablobbreakleaseac1blobapitestbreakleaseac21020607af1d0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[2].json new file mode 100644 index 000000000000..46b067424b7b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[2].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac17b98309409809b6?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" : "70f6b804-e922-48b4-a769-5895d1cbddf8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611211CE4A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca74ab-301e-0042-3649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:32 GMT", + "x-ms-client-request-id" : "70f6b804-e922-48b4-a769-5895d1cbddf8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac17b98309409809b6/javablobbreakleaseac1blobapitestbreakleaseac17b16097df1a2", + "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" : "fec3b43c-4d73-4c18-ad56-708bc42b1a06", + "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 20:05:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:32 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561121FB5EC\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca74ba-301e-0042-4349-67cbbf000000", + "x-ms-client-request-id" : "fec3b43c-4d73-4c18-ad56-708bc42b1a06" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac17b98309409809b6/javablobbreakleaseac1blobapitestbreakleaseac17b16097df1a2?comp=lease", + "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" : "0a707a9b-2eea-44a4-9803-63807c896344" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561121FB5EC\"", + "x-ms-lease-id" : "c1b714bd-cf49-4993-ab59-33c585f1209d", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca74d3-301e-0042-5a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:32 GMT", + "x-ms-client-request-id" : "0a707a9b-2eea-44a4-9803-63807c896344" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac17b98309409809b6/javablobbreakleaseac1blobapitestbreakleaseac17b16097df1a2?comp=lease", + "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" : "e8b82318-765b-4f04-b69d-2dc216eb5b3c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561121FB5EC\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca74eb-301e-0042-6e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:32 GMT", + "x-ms-client-request-id" : "e8b82318-765b-4f04-b69d-2dc216eb5b3c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreakleaseac&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" : "1d6dbff2-174f-4018-a7a1-f552980a7c42" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca750a-301e-0042-0b49-67cbbf000000", + "Body" : "jtcbreakleaseacjtcbreakleaseac0blobapitestbreakleaseac17b98309409809b6Mon, 09 Sep 2019 20:05:32 GMT\"0x8D735611211CE4A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:32 GMT", + "x-ms-client-request-id" : "1d6dbff2-174f-4018-a7a1-f552980a7c42", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac17b98309409809b6?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" : "db43ad40-27ac-4c2a-9600-3b04b4aa5691" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca751d-301e-0042-1e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:33 GMT", + "x-ms-client-request-id" : "db43ad40-27ac-4c2a-9600-3b04b4aa5691" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseac0blobapitestbreakleaseac17b98309409809b6", "javablobbreakleaseac1blobapitestbreakleaseac17b16097df1a2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[3].json new file mode 100644 index 000000000000..30984f15e6bd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[3].json @@ -0,0 +1,166 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac10b469666b7f4d43?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" : "49fc944e-6d1f-4a57-bfbe-d895f2effa63" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611260BFE0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca753c-301e-0042-3b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:33 GMT", + "x-ms-client-request-id" : "49fc944e-6d1f-4a57-bfbe-d895f2effa63" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac10b469666b7f4d43/javablobbreakleaseac1blobapitestbreakleaseac10b72117403db", + "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" : "58cc97d9-cb59-4cde-a315-13f3e688b520", + "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 20:05:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:33 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561126E0B3D\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca755b-301e-0042-5849-67cbbf000000", + "x-ms-client-request-id" : "58cc97d9-cb59-4cde-a315-13f3e688b520" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac10b469666b7f4d43/javablobbreakleaseac1blobapitestbreakleaseac10b72117403db", + "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" : "0e5643ec-1248-4408-bea1-8b12060d1c6c" + }, + "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 20:05:33 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:05:33 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561126E0B3D\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:33 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca7574-301e-0042-7149-67cbbf000000", + "x-ms-client-request-id" : "0e5643ec-1248-4408-bea1-8b12060d1c6c", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac10b469666b7f4d43/javablobbreakleaseac1blobapitestbreakleaseac10b72117403db?comp=lease", + "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" : "14bd54c9-4648-4dd5-b2dd-65f07a33e307" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561126E0B3D\"", + "x-ms-lease-id" : "47561823-05cc-4ed8-9fcb-facfefc2b8e8", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca75a5-301e-0042-2149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:33 GMT", + "x-ms-client-request-id" : "14bd54c9-4648-4dd5-b2dd-65f07a33e307" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac10b469666b7f4d43/javablobbreakleaseac1blobapitestbreakleaseac10b72117403db?comp=lease", + "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" : "5ce0749d-f33c-4126-b29a-571648e9fdbb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561126E0B3D\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca75bb-301e-0042-3649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:33 GMT", + "x-ms-client-request-id" : "5ce0749d-f33c-4126-b29a-571648e9fdbb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreakleaseac&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" : "ed96ac1c-1f12-4e3d-93e9-df6b827f55a0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca75ce-301e-0042-4949-67cbbf000000", + "Body" : "jtcbreakleaseacjtcbreakleaseac0blobapitestbreakleaseac10b469666b7f4d43Mon, 09 Sep 2019 20:05:33 GMT\"0x8D735611260BFE0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:33 GMT", + "x-ms-client-request-id" : "ed96ac1c-1f12-4e3d-93e9-df6b827f55a0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac10b469666b7f4d43?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" : "a7755b8b-9e11-4567-ac78-8cc281043be4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca75e9-301e-0042-6149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:33 GMT", + "x-ms-client-request-id" : "a7755b8b-9e11-4567-ac78-8cc281043be4" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseac0blobapitestbreakleaseac10b469666b7f4d43", "javablobbreakleaseac1blobapitestbreakleaseac10b72117403db" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[4].json new file mode 100644 index 000000000000..9ccf3370db78 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseac[4].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac15a10286b085607f?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" : "61bde30e-f267-4c48-bd04-ed96ede17071" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356112BBE8AB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca75fb-301e-0042-7349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:33 GMT", + "x-ms-client-request-id" : "61bde30e-f267-4c48-bd04-ed96ede17071" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac15a10286b085607f/javablobbreakleaseac1blobapitestbreakleaseac15a7883127d76", + "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" : "9e615d65-bbbf-48ba-94e8-083e87426b40", + "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 20:05:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:33 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356112C90D0F\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca7619-301e-0042-0849-67cbbf000000", + "x-ms-client-request-id" : "9e615d65-bbbf-48ba-94e8-083e87426b40" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac15a10286b085607f/javablobbreakleaseac1blobapitestbreakleaseac15a7883127d76?comp=lease", + "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" : "eafdd522-47fe-43d9-bca8-008b55875228" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356112C90D0F\"", + "x-ms-lease-id" : "32126540-9b0d-463a-b9e8-cb960b05eb22", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7627-301e-0042-1449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:33 GMT", + "x-ms-client-request-id" : "eafdd522-47fe-43d9-bca8-008b55875228" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac15a10286b085607f/javablobbreakleaseac1blobapitestbreakleaseac15a7883127d76?comp=lease", + "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" : "b52844e2-ec37-4117-ac64-aac0d2acc648" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356112C90D0F\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca763c-301e-0042-2949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:34 GMT", + "x-ms-client-request-id" : "b52844e2-ec37-4117-ac64-aac0d2acc648" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreakleaseac&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" : "03f8ac07-fbc5-4c09-8bf3-098d4c8907d9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca7650-301e-0042-3d49-67cbbf000000", + "Body" : "jtcbreakleaseacjtcbreakleaseac0blobapitestbreakleaseac15a10286b085607fMon, 09 Sep 2019 20:05:33 GMT\"0x8D7356112BBE8AB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:34 GMT", + "x-ms-client-request-id" : "03f8ac07-fbc5-4c09-8bf3-098d4c8907d9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0blobapitestbreakleaseac15a10286b085607f?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" : "f262407b-e511-48af-9b98-5ce9c0a6dd78" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca7668-301e-0042-5249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:34 GMT", + "x-ms-client-request-id" : "f262407b-e511-48af-9b98-5ce9c0a6dd78" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseac0blobapitestbreakleaseac15a10286b085607f", "javablobbreakleaseac1blobapitestbreakleaseac15a7883127d76" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseacfail[0].json new file mode 100644 index 000000000000..9feb5f12fc63 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseacfail[0].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail92644559dab1?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" : "a652822c-6f35-42fe-aff1-8834f12d2baa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611309A185\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7680-301e-0042-6a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:34 GMT", + "x-ms-client-request-id" : "a652822c-6f35-42fe-aff1-8834f12d2baa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail92644559dab1/javablobbreakleaseacfail1blobapitestbreakleaseacfail926360515", + "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" : "df26c8e2-3c34-49e2-90b5-bd4bb2df6eee", + "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 20:05:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:34 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356113178979\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca769f-301e-0042-0749-67cbbf000000", + "x-ms-client-request-id" : "df26c8e2-3c34-49e2-90b5-bd4bb2df6eee" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail92644559dab1/javablobbreakleaseacfail1blobapitestbreakleaseacfail926360515?comp=lease", + "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" : "f4faa4bb-e3ce-4f1c-a482-e07de39da108" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356113178979\"", + "x-ms-lease-id" : "11a0a792-fe4f-4c7e-b674-99c502e25f49", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca76c5-301e-0042-2b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:34 GMT", + "x-ms-client-request-id" : "f4faa4bb-e3ce-4f1c-a482-e07de39da108" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail92644559dab1/javablobbreakleaseacfail1blobapitestbreakleaseacfail926360515?comp=lease", + "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" : "778c7bcb-5c2c-4d28-b0b1-e0a8ca37c2cc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca76d4-301e-0042-3a49-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca76d4-301e-0042-3a49-67cbbf000000\nTime:2019-09-09T20:05:34.6264444Z", + "Date" : "Mon, 09 Sep 2019 20:05:34 GMT", + "x-ms-client-request-id" : "778c7bcb-5c2c-4d28-b0b1-e0a8ca37c2cc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreakleaseacfail&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" : "ff1d2d71-ec38-46be-b40f-ba2aadf64d27" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca76eb-301e-0042-4d49-67cbbf000000", + "Body" : "jtcbreakleaseacfailjtcbreakleaseacfail0blobapitestbreakleaseacfail92644559dab1Mon, 09 Sep 2019 20:05:34 GMT\"0x8D735611309A185\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:34 GMT", + "x-ms-client-request-id" : "ff1d2d71-ec38-46be-b40f-ba2aadf64d27", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail92644559dab1?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" : "3cc69546-b3fe-4635-9154-8baaee9e612f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca7703-301e-0042-6449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:34 GMT", + "x-ms-client-request-id" : "3cc69546-b3fe-4635-9154-8baaee9e612f" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseacfail0blobapitestbreakleaseacfail92644559dab1", "javablobbreakleaseacfail1blobapitestbreakleaseacfail926360515" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseacfail[1].json new file mode 100644 index 000000000000..5451f135a223 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseacfail[1].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail3a8246398fdc?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" : "786b38ab-4ebe-4b87-a154-a385c1a681bd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356113566FD8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca771b-301e-0042-7c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:34 GMT", + "x-ms-client-request-id" : "786b38ab-4ebe-4b87-a154-a385c1a681bd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail3a8246398fdc/javablobbreakleaseacfail1blobapitestbreakleaseacfail3a8133777", + "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" : "d8f45f8a-4e80-4564-899d-247170b80d7b", + "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 20:05:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:34 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611363BB8B\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca7733-301e-0042-0f49-67cbbf000000", + "x-ms-client-request-id" : "d8f45f8a-4e80-4564-899d-247170b80d7b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail3a8246398fdc/javablobbreakleaseacfail1blobapitestbreakleaseacfail3a8133777?comp=lease", + "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" : "5c482d65-ad31-46a5-8da5-481b5c93e68a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611363BB8B\"", + "x-ms-lease-id" : "c21d7603-8483-49e4-a1b1-367fc8f9c863", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7745-301e-0042-2049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:34 GMT", + "x-ms-client-request-id" : "5c482d65-ad31-46a5-8da5-481b5c93e68a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail3a8246398fdc/javablobbreakleaseacfail1blobapitestbreakleaseacfail3a8133777?comp=lease", + "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" : "219e39cd-527a-4498-9684-68ef8c5640ba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca775a-301e-0042-3349-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca775a-301e-0042-3349-67cbbf000000\nTime:2019-09-09T20:05:35.1257971Z", + "Date" : "Mon, 09 Sep 2019 20:05:35 GMT", + "x-ms-client-request-id" : "219e39cd-527a-4498-9684-68ef8c5640ba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreakleaseacfail&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" : "3b3631a4-bcde-46ce-b4a9-1f98bd1ba8ed" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca7767-301e-0042-3f49-67cbbf000000", + "Body" : "jtcbreakleaseacfailjtcbreakleaseacfail0blobapitestbreakleaseacfail3a8246398fdcMon, 09 Sep 2019 20:05:34 GMT\"0x8D7356113566FD8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:35 GMT", + "x-ms-client-request-id" : "3b3631a4-bcde-46ce-b4a9-1f98bd1ba8ed", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail3a8246398fdc?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" : "6003151d-2773-49f5-ac4d-226aa6f725e1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca7772-301e-0042-4949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:35 GMT", + "x-ms-client-request-id" : "6003151d-2773-49f5-ac4d-226aa6f725e1" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseacfail0blobapitestbreakleaseacfail3a8246398fdc", "javablobbreakleaseacfail1blobapitestbreakleaseacfail3a8133777" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseacfail[2].json new file mode 100644 index 000000000000..237ac024e512 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseacfail[2].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfaild5878308163f?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" : "c37f71f0-2cb0-4f7f-9130-48c1382daf32" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356113A53A51\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7780-301e-0042-5749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:35 GMT", + "x-ms-client-request-id" : "c37f71f0-2cb0-4f7f-9130-48c1382daf32" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfaild5878308163f/javablobbreakleaseacfail1blobapitestbreakleaseacfaild5877716a", + "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" : "c9eddd38-e961-41bc-80c5-935908943260", + "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 20:05:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356113B28624\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca779c-301e-0042-6f49-67cbbf000000", + "x-ms-client-request-id" : "c9eddd38-e961-41bc-80c5-935908943260" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfaild5878308163f/javablobbreakleaseacfail1blobapitestbreakleaseacfaild5877716a?comp=lease", + "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" : "8e02e572-699d-4c53-81c1-3d9038418501" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356113B28624\"", + "x-ms-lease-id" : "00664685-cdd4-4fdd-9553-4220aa858e43", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca77b0-301e-0042-0149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:35 GMT", + "x-ms-client-request-id" : "8e02e572-699d-4c53-81c1-3d9038418501" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfaild5878308163f/javablobbreakleaseacfail1blobapitestbreakleaseacfaild5877716a?comp=lease", + "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" : "4236eaa3-7988-48b5-ad3b-b3798c93fafa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca77c4-301e-0042-1349-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca77c4-301e-0042-1349-67cbbf000000\nTime:2019-09-09T20:05:35.6391593Z", + "Date" : "Mon, 09 Sep 2019 20:05:35 GMT", + "x-ms-client-request-id" : "4236eaa3-7988-48b5-ad3b-b3798c93fafa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreakleaseacfail&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" : "bb1af0b0-60c2-4c32-8422-af44952041a4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca77d7-301e-0042-2449-67cbbf000000", + "Body" : "jtcbreakleaseacfailjtcbreakleaseacfail0blobapitestbreakleaseacfaild5878308163fMon, 09 Sep 2019 20:05:35 GMT\"0x8D7356113A53A51\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:35 GMT", + "x-ms-client-request-id" : "bb1af0b0-60c2-4c32-8422-af44952041a4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfaild5878308163f?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" : "837ac571-202e-4995-8c24-f0a6e4825515" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca77e4-301e-0042-3049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:35 GMT", + "x-ms-client-request-id" : "837ac571-202e-4995-8c24-f0a6e4825515" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseacfail0blobapitestbreakleaseacfaild5878308163f", "javablobbreakleaseacfail1blobapitestbreakleaseacfaild5877716a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseacfail[3].json new file mode 100644 index 000000000000..6e7afce1484f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseacfail[3].json @@ -0,0 +1,166 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail2d9478621ccc?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" : "bda43525-61ae-445b-8deb-12f412caf06d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356113F2A501\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca77fa-301e-0042-4549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:35 GMT", + "x-ms-client-request-id" : "bda43525-61ae-445b-8deb-12f412caf06d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail2d9478621ccc/javablobbreakleaseacfail1blobapitestbreakleaseacfail2d990664b", + "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" : "98d7a2a9-53aa-46a2-a74f-61bc6038cc33", + "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 20:05:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356113FFC9D1\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca780a-301e-0042-5449-67cbbf000000", + "x-ms-client-request-id" : "98d7a2a9-53aa-46a2-a74f-61bc6038cc33" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail2d9478621ccc/javablobbreakleaseacfail1blobapitestbreakleaseacfail2d990664b", + "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" : "bdc171c7-56cb-429d-9b8b-ddeba5d595ab" + }, + "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 20:05:35 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:05:35 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7356113FFC9D1\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:35 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca781b-301e-0042-6449-67cbbf000000", + "x-ms-client-request-id" : "bdc171c7-56cb-429d-9b8b-ddeba5d595ab", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail2d9478621ccc/javablobbreakleaseacfail1blobapitestbreakleaseacfail2d990664b?comp=lease", + "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" : "af81f2ea-4c2f-43c9-9ec1-6fb97d6c2a59" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356113FFC9D1\"", + "x-ms-lease-id" : "a81c341e-f65c-4de1-86d2-7fb2870a1593", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca782f-301e-0042-7549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:36 GMT", + "x-ms-client-request-id" : "af81f2ea-4c2f-43c9-9ec1-6fb97d6c2a59" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail2d9478621ccc/javablobbreakleaseacfail1blobapitestbreakleaseacfail2d990664b?comp=lease", + "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" : "62b15f41-0b33-4ef5-a417-f3cad160d2eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca7837-301e-0042-7c49-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca7837-301e-0042-7c49-67cbbf000000\nTime:2019-09-09T20:05:36.2275746Z", + "Date" : "Mon, 09 Sep 2019 20:05:36 GMT", + "x-ms-client-request-id" : "62b15f41-0b33-4ef5-a417-f3cad160d2eb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreakleaseacfail&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" : "c2251fcc-a3ac-4995-a034-ce84bd5353ac" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca784c-301e-0042-0e49-67cbbf000000", + "Body" : "jtcbreakleaseacfailjtcbreakleaseacfail0blobapitestbreakleaseacfail2d9478621cccMon, 09 Sep 2019 20:05:35 GMT\"0x8D7356113F2A501\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:36 GMT", + "x-ms-client-request-id" : "c2251fcc-a3ac-4995-a034-ce84bd5353ac", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0blobapitestbreakleaseacfail2d9478621ccc?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" : "19d7deef-2550-4ee7-bcee-8d68c6a80b09" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca7869-301e-0042-2a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:36 GMT", + "x-ms-client-request-id" : "19d7deef-2550-4ee7-bcee-8d68c6a80b09" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseacfail0blobapitestbreakleaseacfail2d9478621ccc", "javablobbreakleaseacfail1blobapitestbreakleaseacfail2d990664b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseerror.json new file mode 100644 index 000000000000..45322da3cd79 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleaseerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseerror0blobapitestbreakleaseerrorffc98742f9799?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" : "a92404f0-3d8b-4ad5-b9c2-ada645b26a0f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561144D0A56\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7888-301e-0042-4849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:36 GMT", + "x-ms-client-request-id" : "a92404f0-3d8b-4ad5-b9c2-ada645b26a0f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseerror0blobapitestbreakleaseerrorffc98742f9799/javablobbreakleaseerror1blobapitestbreakleaseerrorffc919689f", + "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" : "ec1e0ee4-1969-44df-a013-d8a51f2f291f", + "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 20:05:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:36 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561145A2F47\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca78af-301e-0042-6a49-67cbbf000000", + "x-ms-client-request-id" : "ec1e0ee4-1969-44df-a013-d8a51f2f291f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseerror0blobapitestbreakleaseerrorffc98742f9799/javablobbreakleaseerror2blobapitestbreakleaseerrorffc95049a4?comp=lease", + "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" : "bfe80475-5e07-4f31-995d-1cba264e908d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "BlobNotFound", + "retry-after" : "0", + "Content-Length" : "215", + "StatusCode" : "404", + "x-ms-request-id" : "c5ca78c5-301e-0042-7f49-67cbbf000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:c5ca78c5-301e-0042-7f49-67cbbf000000\nTime:2019-09-09T20:05:36.6588793Z", + "Date" : "Mon, 09 Sep 2019 20:05:36 GMT", + "x-ms-client-request-id" : "bfe80475-5e07-4f31-995d-1cba264e908d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreakleaseerror&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" : "5fd3f854-a70a-4402-b31e-9616a457a2ef" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca78e0-301e-0042-1849-67cbbf000000", + "Body" : "jtcbreakleaseerrorjtcbreakleaseerror0blobapitestbreakleaseerrorffc98742f9799Mon, 09 Sep 2019 20:05:36 GMT\"0x8D73561144D0A56\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:36 GMT", + "x-ms-client-request-id" : "5fd3f854-a70a-4402-b31e-9616a457a2ef", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseerror0blobapitestbreakleaseerrorffc98742f9799?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" : "be5441e4-625e-4b78-b69f-a05ef8dcfe63" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca78ec-301e-0042-2449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:36 GMT", + "x-ms-client-request-id" : "be5441e4-625e-4b78-b69f-a05ef8dcfe63" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseerror0blobapitestbreakleaseerrorffc98742f9799", "javablobbreakleaseerror1blobapitestbreakleaseerrorffc919689f", "javablobbreakleaseerror2blobapitestbreakleaseerrorffc95049a4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleasemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleasemin.json new file mode 100644 index 000000000000..310b216544b4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestbreakleasemin.json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleasemin0blobapitestbreakleasemin67649376540ad3b?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" : "96107605-66a3-4a55-8211-53d44a234c0d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611126F5BD\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca734c-301e-0042-6b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:31 GMT", + "x-ms-client-request-id" : "96107605-66a3-4a55-8211-53d44a234c0d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleasemin0blobapitestbreakleasemin67649376540ad3b/javablobbreakleasemin1blobapitestbreakleasemin676360295a2b", + "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" : "bda84deb-cdb6-4ac4-9e21-dd374fd2fe07", + "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 20:05:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611135041E\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca735d-301e-0042-7b49-67cbbf000000", + "x-ms-client-request-id" : "bda84deb-cdb6-4ac4-9e21-dd374fd2fe07" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleasemin0blobapitestbreakleasemin67649376540ad3b/javablobbreakleasemin1blobapitestbreakleasemin676360295a2b?comp=lease", + "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" : "b0573251-41c6-48d1-8894-c306a3456297" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611135041E\"", + "x-ms-lease-id" : "6c450f57-e867-4fac-9044-89123af86d23", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7369-301e-0042-0749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:31 GMT", + "x-ms-client-request-id" : "b0573251-41c6-48d1-8894-c306a3456297" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleasemin0blobapitestbreakleasemin67649376540ad3b/javablobbreakleasemin1blobapitestbreakleasemin676360295a2b?comp=lease", + "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" : "20ca8305-4fa9-4765-891f-6679fc4454c1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611135041E\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca737c-301e-0042-1a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:31 GMT", + "x-ms-client-request-id" : "20ca8305-4fa9-4765-891f-6679fc4454c1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreakleasemin&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" : "4c6b2d0e-c94f-46df-8d7f-01a967a1b215" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca738e-301e-0042-2b49-67cbbf000000", + "Body" : "jtcbreakleaseminjtcbreakleasemin0blobapitestbreakleasemin67649376540ad3bMon, 09 Sep 2019 20:05:31 GMT\"0x8D735611126F5BD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:31 GMT", + "x-ms-client-request-id" : "4c6b2d0e-c94f-46df-8d7f-01a967a1b215", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleasemin0blobapitestbreakleasemin67649376540ad3b?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" : "0a0d943c-d397-4aa7-a6ed-3d3c9398df77" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca7398-301e-0042-3549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:31 GMT", + "x-ms-client-request-id" : "0a0d943c-d397-4aa7-a6ed-3d3c9398df77" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleasemin0blobapitestbreakleasemin67649376540ad3b", "javablobbreakleasemin1blobapitestbreakleasemin676360295a2b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangelease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangelease.json new file mode 100644 index 000000000000..4323de06f59b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangelease.json @@ -0,0 +1,155 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangelease0blobapitestchangeleasea505226790d91ab3e?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" : "faeb29e4-0567-4077-9d69-8729f14235bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561148C41A3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca78fd-301e-0042-3449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:36 GMT", + "x-ms-client-request-id" : "faeb29e4-0567-4077-9d69-8729f14235bf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangelease0blobapitestchangeleasea505226790d91ab3e/javablobchangelease1blobapitestchangeleasea507005970c7cd", + "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" : "4aa9b2ba-0c11-4a81-b540-4ca378d14b0b", + "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 20:05:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:36 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561149A5134\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca7910-301e-0042-4349-67cbbf000000", + "x-ms-client-request-id" : "4aa9b2ba-0c11-4a81-b540-4ca378d14b0b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangelease0blobapitestchangeleasea505226790d91ab3e/javablobchangelease1blobapitestchangeleasea507005970c7cd?comp=lease", + "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" : "24e70039-e61c-4802-a6ae-db583270febc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561149A5134\"", + "x-ms-lease-id" : "48a5dd15-61bc-4fbc-a1de-2bf8c16e53c1", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7926-301e-0042-5849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:36 GMT", + "x-ms-client-request-id" : "24e70039-e61c-4802-a6ae-db583270febc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangelease0blobapitestchangeleasea505226790d91ab3e/javablobchangelease1blobapitestchangeleasea507005970c7cd?comp=lease", + "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" : "eb6988e3-e179-4742-b3e9-92827289ba14" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561149A5134\"", + "x-ms-lease-id" : "1d34c81c-1cda-4d71-88e8-336b9f1718d5", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca7941-301e-0042-7149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:37 GMT", + "x-ms-client-request-id" : "eb6988e3-e179-4742-b3e9-92827289ba14" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangelease0blobapitestchangeleasea505226790d91ab3e/javablobchangelease1blobapitestchangeleasea507005970c7cd?comp=lease", + "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" : "fced400e-dabd-478f-932a-641110a1d8ab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561149A5134\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca7950-301e-0042-7d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:37 GMT", + "x-ms-client-request-id" : "fced400e-dabd-478f-932a-641110a1d8ab" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcchangelease&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" : "0b2b4984-a727-4f1e-9212-4cb5ba6c953a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca795a-301e-0042-0749-67cbbf000000", + "Body" : "jtcchangeleasejtcchangelease0blobapitestchangeleasea505226790d91ab3eMon, 09 Sep 2019 20:05:36 GMT\"0x8D73561148C41A3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:37 GMT", + "x-ms-client-request-id" : "0b2b4984-a727-4f1e-9212-4cb5ba6c953a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangelease0blobapitestchangeleasea505226790d91ab3e?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" : "3176e0b9-9ec7-47c1-bd2b-921d29c4b2af" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca796f-301e-0042-1949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:37 GMT", + "x-ms-client-request-id" : "3176e0b9-9ec7-47c1-bd2b-921d29c4b2af" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangelease0blobapitestchangeleasea505226790d91ab3e", "javablobchangelease1blobapitestchangeleasea507005970c7cd", "48a5dd15-61bc-4fbc-a1de-2bf8c16e53c1", "1d34c81c-1cda-4d71-88e8-336b9f1718d5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[0].json new file mode 100644 index 000000000000..b15d9aef54fd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[0].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacfe521840670bfba?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" : "9de94dd3-0b3f-43dc-b579-e2b2c95702f1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611534AE05\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca79e5-301e-0042-0649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:37 GMT", + "x-ms-client-request-id" : "9de94dd3-0b3f-43dc-b579-e2b2c95702f1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacfe521840670bfba/javablobchangeleaseac1blobapitestchangeleaseacfe555387cd66", + "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" : "c1180e2b-2012-4802-bbc4-95896d9c6aee", + "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 20:05:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356115418518\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca79fb-301e-0042-1849-67cbbf000000", + "x-ms-client-request-id" : "c1180e2b-2012-4802-bbc4-95896d9c6aee" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacfe521840670bfba/javablobchangeleaseac1blobapitestchangeleaseacfe555387cd66?comp=lease", + "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" : "b03093ae-f773-40e6-b06a-412f85635d9d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356115418518\"", + "x-ms-lease-id" : "e9477d72-cc70-4333-bdbb-8507aa548663", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7a09-301e-0042-2649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:38 GMT", + "x-ms-client-request-id" : "b03093ae-f773-40e6-b06a-412f85635d9d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacfe521840670bfba/javablobchangeleaseac1blobapitestchangeleaseacfe555387cd66?comp=lease", + "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" : "0ad9ee73-ce68-4257-ba03-ce41cb4f0e10" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356115418518\"", + "x-ms-lease-id" : "15d1b2ec-19ca-40e9-a1b0-cbc43ab80c8c", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca7a1b-301e-0042-3849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:38 GMT", + "x-ms-client-request-id" : "0ad9ee73-ce68-4257-ba03-ce41cb4f0e10" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcchangeleaseac&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" : "6a255836-c67e-4dc5-8ad2-1d4f58e7f576" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca7a46-301e-0042-6049-67cbbf000000", + "Body" : "jtcchangeleaseacjtcchangeleaseac0blobapitestchangeleaseacfe521840670bfbaMon, 09 Sep 2019 20:05:38 GMT\"0x8D735611534AE05\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:38 GMT", + "x-ms-client-request-id" : "6a255836-c67e-4dc5-8ad2-1d4f58e7f576", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacfe521840670bfba?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" : "648d2c88-59ea-4c6b-8022-7bd8938b8275" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca7a5a-301e-0042-7349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:38 GMT", + "x-ms-client-request-id" : "648d2c88-59ea-4c6b-8022-7bd8938b8275" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseac0blobapitestchangeleaseacfe521840670bfba", "javablobchangeleaseac1blobapitestchangeleaseacfe555387cd66", "15d1b2ec-19ca-40e9-a1b0-cbc43ab80c8c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[1].json new file mode 100644 index 000000000000..e833b5e0246f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[1].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac0df6505559adf4d?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" : "cb43be3c-689c-415d-808d-7e8250455631" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356115828DF3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7a76-301e-0042-0e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:38 GMT", + "x-ms-client-request-id" : "cb43be3c-689c-415d-808d-7e8250455631" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac0df6505559adf4d/javablobchangeleaseac1blobapitestchangeleaseac0df49864bce0", + "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" : "a0a90be4-bdd8-49f3-8183-2e1be35794e7", + "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 20:05:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:38 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561158FB355\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca7a93-301e-0042-2949-67cbbf000000", + "x-ms-client-request-id" : "a0a90be4-bdd8-49f3-8183-2e1be35794e7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac0df6505559adf4d/javablobchangeleaseac1blobapitestchangeleaseac0df49864bce0?comp=lease", + "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" : "8052565f-3e04-40f7-a8bc-41acfa797906" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561158FB355\"", + "x-ms-lease-id" : "a25dc330-31ab-4e45-a3f9-a608533e82bc", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7a9c-301e-0042-3249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:38 GMT", + "x-ms-client-request-id" : "8052565f-3e04-40f7-a8bc-41acfa797906" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac0df6505559adf4d/javablobchangeleaseac1blobapitestchangeleaseac0df49864bce0?comp=lease", + "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" : "4cee9cf4-3410-46da-90bd-2b180a979237" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561158FB355\"", + "x-ms-lease-id" : "23a9c667-8a9c-40c8-b9ba-0c2a33e33be5", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca7ab4-301e-0042-4849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:38 GMT", + "x-ms-client-request-id" : "4cee9cf4-3410-46da-90bd-2b180a979237" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcchangeleaseac&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" : "05a71443-04f6-4fee-af8e-73f7975f5fae" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca7ac1-301e-0042-5549-67cbbf000000", + "Body" : "jtcchangeleaseacjtcchangeleaseac0blobapitestchangeleaseac0df6505559adf4dMon, 09 Sep 2019 20:05:38 GMT\"0x8D7356115828DF3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:38 GMT", + "x-ms-client-request-id" : "05a71443-04f6-4fee-af8e-73f7975f5fae", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac0df6505559adf4d?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" : "1607b848-62d3-40f1-97cf-8115b7bd202f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca7acf-301e-0042-6149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:38 GMT", + "x-ms-client-request-id" : "1607b848-62d3-40f1-97cf-8115b7bd202f" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseac0blobapitestchangeleaseac0df6505559adf4d", "javablobchangeleaseac1blobapitestchangeleaseac0df49864bce0", "23a9c667-8a9c-40c8-b9ba-0c2a33e33be5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[2].json new file mode 100644 index 000000000000..f3ea46f37932 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[2].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac9ca9956557ec647?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" : "3b0e67c8-457b-4769-a06d-76c9bfacac39" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356115CF0E18\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7ae7-301e-0042-7749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:38 GMT", + "x-ms-client-request-id" : "3b0e67c8-457b-4769-a06d-76c9bfacac39" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac9ca9956557ec647/javablobchangeleaseac1blobapitestchangeleaseac9ca950854e59", + "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" : "a9bb49a4-dddd-416d-b2ea-f68367cc5a7a", + "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 20:05:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:38 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356115DCF70F\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca7b03-301e-0042-1149-67cbbf000000", + "x-ms-client-request-id" : "a9bb49a4-dddd-416d-b2ea-f68367cc5a7a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac9ca9956557ec647/javablobchangeleaseac1blobapitestchangeleaseac9ca950854e59?comp=lease", + "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" : "bc754e17-df9c-4adb-923f-ee34af5e8afa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356115DCF70F\"", + "x-ms-lease-id" : "713eae9f-7f71-4318-b93c-a93cd7d1a2b3", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7b19-301e-0042-2549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:39 GMT", + "x-ms-client-request-id" : "bc754e17-df9c-4adb-923f-ee34af5e8afa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac9ca9956557ec647/javablobchangeleaseac1blobapitestchangeleaseac9ca950854e59?comp=lease", + "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" : "2f9bee1d-3bad-4a46-afab-5ce3b5f48d63" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356115DCF70F\"", + "x-ms-lease-id" : "2b573748-c069-447b-95f7-753c109c0b71", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca7b2d-301e-0042-3949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:39 GMT", + "x-ms-client-request-id" : "2f9bee1d-3bad-4a46-afab-5ce3b5f48d63" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcchangeleaseac&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" : "4f09313e-7326-4b5e-99aa-b095b9bc2f42" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca7b46-301e-0042-5149-67cbbf000000", + "Body" : "jtcchangeleaseacjtcchangeleaseac0blobapitestchangeleaseac9ca9956557ec647Mon, 09 Sep 2019 20:05:39 GMT\"0x8D7356115CF0E18\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:39 GMT", + "x-ms-client-request-id" : "4f09313e-7326-4b5e-99aa-b095b9bc2f42", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseac9ca9956557ec647?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" : "e98c115f-9135-4d1a-9489-035e65083c69" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca7b5b-301e-0042-6549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:39 GMT", + "x-ms-client-request-id" : "e98c115f-9135-4d1a-9489-035e65083c69" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseac0blobapitestchangeleaseac9ca9956557ec647", "javablobchangeleaseac1blobapitestchangeleaseac9ca950854e59", "2b573748-c069-447b-95f7-753c109c0b71" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[3].json new file mode 100644 index 000000000000..4a4048995187 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[3].json @@ -0,0 +1,166 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacced87467bb7850e?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" : "15dc7b7a-895a-4c89-9308-7f5103eadcec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561161DD895\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7b72-301e-0042-7b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:39 GMT", + "x-ms-client-request-id" : "15dc7b7a-895a-4c89-9308-7f5103eadcec" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacced87467bb7850e/javablobchangeleaseac1blobapitestchangeleaseacced0753204dd", + "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" : "1e696fdd-8113-4f87-8e28-5380d15d4adc", + "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 20:05:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:39 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561162AFE2D\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca7b87-301e-0042-0e49-67cbbf000000", + "x-ms-client-request-id" : "1e696fdd-8113-4f87-8e28-5380d15d4adc" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacced87467bb7850e/javablobchangeleaseac1blobapitestchangeleaseacced0753204dd", + "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" : "b78bfe04-d0a8-4600-aa86-b8ce91dec9ff" + }, + "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 20:05:39 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:05:39 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561162AFE2D\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:39 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca7b95-301e-0042-1c49-67cbbf000000", + "x-ms-client-request-id" : "b78bfe04-d0a8-4600-aa86-b8ce91dec9ff", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacced87467bb7850e/javablobchangeleaseac1blobapitestchangeleaseacced0753204dd?comp=lease", + "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" : "1a6b351c-8d0d-45cb-a236-a308c2fef485" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561162AFE2D\"", + "x-ms-lease-id" : "fb2b0c54-4463-4904-a0d2-3049ae86000e", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7b9e-301e-0042-2549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:39 GMT", + "x-ms-client-request-id" : "1a6b351c-8d0d-45cb-a236-a308c2fef485" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacced87467bb7850e/javablobchangeleaseac1blobapitestchangeleaseacced0753204dd?comp=lease", + "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" : "1497e923-e219-4ea5-a802-30c46a48fe19" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561162AFE2D\"", + "x-ms-lease-id" : "4d01ca81-f545-4e90-8621-e61fb9c1fa70", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca7baf-301e-0042-3649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:39 GMT", + "x-ms-client-request-id" : "1497e923-e219-4ea5-a802-30c46a48fe19" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcchangeleaseac&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" : "003c15c9-cdc0-4a36-b45a-8300e478a087" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca7bbb-301e-0042-4249-67cbbf000000", + "Body" : "jtcchangeleaseacjtcchangeleaseac0blobapitestchangeleaseacced87467bb7850eMon, 09 Sep 2019 20:05:39 GMT\"0x8D73561161DD895\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:39 GMT", + "x-ms-client-request-id" : "003c15c9-cdc0-4a36-b45a-8300e478a087", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacced87467bb7850e?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" : "ecbd4fbe-6f7e-4769-8fe2-6e445c522580" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca7bcb-301e-0042-5249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:39 GMT", + "x-ms-client-request-id" : "ecbd4fbe-6f7e-4769-8fe2-6e445c522580" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseac0blobapitestchangeleaseacced87467bb7850e", "javablobchangeleaseac1blobapitestchangeleaseacced0753204dd", "4d01ca81-f545-4e90-8621-e61fb9c1fa70" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[4].json new file mode 100644 index 000000000000..5b8913df580c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseac[4].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacce89270598c69ee?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" : "66b4e5e5-5a2e-4140-9fac-05b1725c17a6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356116799DB9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7be5-301e-0042-6749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:40 GMT", + "x-ms-client-request-id" : "66b4e5e5-5a2e-4140-9fac-05b1725c17a6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacce89270598c69ee/javablobchangeleaseac1blobapitestchangeleaseacce87765844e8", + "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" : "b097fd9d-64e9-47fc-9387-42b0df7dd43e", + "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 20:05:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:40 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611687D515\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca7bfa-301e-0042-7a49-67cbbf000000", + "x-ms-client-request-id" : "b097fd9d-64e9-47fc-9387-42b0df7dd43e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacce89270598c69ee/javablobchangeleaseac1blobapitestchangeleaseacce87765844e8?comp=lease", + "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" : "d7d7520c-1117-4918-ba47-2da273507b7c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611687D515\"", + "x-ms-lease-id" : "0e07292e-7ba2-4bea-a72a-a6eda19230a8", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7c1e-301e-0042-1749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:40 GMT", + "x-ms-client-request-id" : "d7d7520c-1117-4918-ba47-2da273507b7c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacce89270598c69ee/javablobchangeleaseac1blobapitestchangeleaseacce87765844e8?comp=lease", + "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" : "aa26a51c-50d0-4fc0-9882-ed3c9490f832" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611687D515\"", + "x-ms-lease-id" : "3bcd21be-9e07-42c3-9fec-60aabbc590d3", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca7c32-301e-0042-2b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:40 GMT", + "x-ms-client-request-id" : "aa26a51c-50d0-4fc0-9882-ed3c9490f832" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcchangeleaseac&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" : "47354611-25ce-402c-b671-063f7cb8e4b2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca7c45-301e-0042-3d49-67cbbf000000", + "Body" : "jtcchangeleaseacjtcchangeleaseac0blobapitestchangeleaseacce89270598c69eeMon, 09 Sep 2019 20:05:40 GMT\"0x8D7356116799DB9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:40 GMT", + "x-ms-client-request-id" : "47354611-25ce-402c-b671-063f7cb8e4b2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0blobapitestchangeleaseacce89270598c69ee?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" : "a7d5a7cb-451d-46c2-89cc-e1bcd67f4fa8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca7c59-301e-0042-4c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:40 GMT", + "x-ms-client-request-id" : "a7d5a7cb-451d-46c2-89cc-e1bcd67f4fa8" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseac0blobapitestchangeleaseacce89270598c69ee", "javablobchangeleaseac1blobapitestchangeleaseacce87765844e8", "3bcd21be-9e07-42c3-9fec-60aabbc590d3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseacfail[0].json new file mode 100644 index 000000000000..94a40736ef60 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseacfail[0].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail671400094d7?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" : "19eae9b2-fa72-4840-a76b-ada0a5bd9ac5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356116C7A4C0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7c71-301e-0042-6349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:40 GMT", + "x-ms-client-request-id" : "19eae9b2-fa72-4840-a76b-ada0a5bd9ac5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail671400094d7/javablobchangeleaseacfail1blobapitestchangeleaseacfail67120378", + "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" : "f039f7e8-322e-4cfb-b744-b76eb971c933", + "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 20:05:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:40 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356116D45551\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca7c7d-301e-0042-6e49-67cbbf000000", + "x-ms-client-request-id" : "f039f7e8-322e-4cfb-b744-b76eb971c933" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail671400094d7/javablobchangeleaseacfail1blobapitestchangeleaseacfail67120378?comp=lease", + "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" : "01d58f6b-5344-4f03-b773-5625aa6216b8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356116D45551\"", + "x-ms-lease-id" : "0edfe6b5-87d7-4072-8672-d74af111ebdf", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7c8c-301e-0042-7d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:40 GMT", + "x-ms-client-request-id" : "01d58f6b-5344-4f03-b773-5625aa6216b8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail671400094d7/javablobchangeleaseacfail1blobapitestchangeleaseacfail67120378?comp=lease", + "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" : "3f443c54-4093-4931-b6a9-b4dcd5757624" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca7c9a-301e-0042-0949-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca7c9a-301e-0042-0949-67cbbf000000\nTime:2019-09-09T20:05:40.8938688Z", + "Date" : "Mon, 09 Sep 2019 20:05:40 GMT", + "x-ms-client-request-id" : "3f443c54-4093-4931-b6a9-b4dcd5757624", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcchangeleaseacfail&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" : "5509564e-04e0-4984-b176-644785164f8e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca7cb1-301e-0042-1d49-67cbbf000000", + "Body" : "jtcchangeleaseacfailjtcchangeleaseacfail0blobapitestchangeleaseacfail671400094d7Mon, 09 Sep 2019 20:05:40 GMT\"0x8D7356116C7A4C0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:40 GMT", + "x-ms-client-request-id" : "5509564e-04e0-4984-b176-644785164f8e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail671400094d7?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" : "bab53c9d-20b7-4d5f-8c44-ea292e94649b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca7cc1-301e-0042-2b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:40 GMT", + "x-ms-client-request-id" : "bab53c9d-20b7-4d5f-8c44-ea292e94649b" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseacfail0blobapitestchangeleaseacfail671400094d7", "javablobchangeleaseacfail1blobapitestchangeleaseacfail67120378", "e0e34a8b-40ca-43b7-b9a4-4abf7e500e41" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseacfail[1].json new file mode 100644 index 000000000000..d10ecdaa463b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseacfail[1].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfailb6b997367d3?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" : "89b8b9e8-bd4d-4895-b935-afc4393f7c42" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356117144C03\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7cdb-301e-0042-4349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:41 GMT", + "x-ms-client-request-id" : "89b8b9e8-bd4d-4895-b935-afc4393f7c42" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfailb6b997367d3/javablobchangeleaseacfail1blobapitestchangeleaseacfailb6b92176", + "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" : "f2fde0ee-fdff-4601-b4d3-d7c2fbd576d2", + "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 20:05:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:41 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561172A2611\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca7cfc-301e-0042-6149-67cbbf000000", + "x-ms-client-request-id" : "f2fde0ee-fdff-4601-b4d3-d7c2fbd576d2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfailb6b997367d3/javablobchangeleaseacfail1blobapitestchangeleaseacfailb6b92176?comp=lease", + "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" : "22223a7f-65bb-4215-96a7-a1037372a5a8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561172A2611\"", + "x-ms-lease-id" : "5ea07934-8f01-4909-91ec-e93e2892f574", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7d0f-301e-0042-7149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:41 GMT", + "x-ms-client-request-id" : "22223a7f-65bb-4215-96a7-a1037372a5a8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfailb6b997367d3/javablobchangeleaseacfail1blobapitestchangeleaseacfailb6b92176?comp=lease", + "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" : "b16e1108-8213-4c14-b5b5-a3dddebb03bb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca7d24-301e-0042-0349-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca7d24-301e-0042-0349-67cbbf000000\nTime:2019-09-09T20:05:41.4602696Z", + "Date" : "Mon, 09 Sep 2019 20:05:41 GMT", + "x-ms-client-request-id" : "b16e1108-8213-4c14-b5b5-a3dddebb03bb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcchangeleaseacfail&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" : "4a04e870-b348-4ce7-98e8-ce69d2bd1a15" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca7d38-301e-0042-1649-67cbbf000000", + "Body" : "jtcchangeleaseacfailjtcchangeleaseacfail0blobapitestchangeleaseacfailb6b997367d3Mon, 09 Sep 2019 20:05:41 GMT\"0x8D7356117144C03\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:41 GMT", + "x-ms-client-request-id" : "4a04e870-b348-4ce7-98e8-ce69d2bd1a15", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfailb6b997367d3?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" : "4fc4fe97-6193-48bd-9e74-f030b6c45877" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca7d4a-301e-0042-2749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:41 GMT", + "x-ms-client-request-id" : "4fc4fe97-6193-48bd-9e74-f030b6c45877" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseacfail0blobapitestchangeleaseacfailb6b997367d3", "javablobchangeleaseacfail1blobapitestchangeleaseacfailb6b92176", "3b1933f2-4a7f-470d-808e-3459d7e38bd9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseacfail[2].json new file mode 100644 index 000000000000..987f96371be2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseacfail[2].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail0397113144f?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" : "bfd222e3-3443-4f01-aa69-4498ed1a078e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561176B5559\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7d61-301e-0042-3c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:41 GMT", + "x-ms-client-request-id" : "bfd222e3-3443-4f01-aa69-4498ed1a078e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail0397113144f/javablobchangeleaseacfail1blobapitestchangeleaseacfail03907411", + "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" : "b8310062-d0e3-43b9-90a4-0a89da8e719d", + "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 20:05:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:41 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356117787B66\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca7d78-301e-0042-4e49-67cbbf000000", + "x-ms-client-request-id" : "b8310062-d0e3-43b9-90a4-0a89da8e719d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail0397113144f/javablobchangeleaseacfail1blobapitestchangeleaseacfail03907411?comp=lease", + "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" : "9fd9811f-bb09-4a94-b430-9694652c44e7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356117787B66\"", + "x-ms-lease-id" : "974fe5b8-7204-407f-8775-1cd7f15d9d47", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7d8a-301e-0042-6049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:41 GMT", + "x-ms-client-request-id" : "9fd9811f-bb09-4a94-b430-9694652c44e7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail0397113144f/javablobchangeleaseacfail1blobapitestchangeleaseacfail03907411?comp=lease", + "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" : "44817ac8-6f6f-434a-8e56-2244d76a4c73" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca7d95-301e-0042-6a49-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca7d95-301e-0042-6a49-67cbbf000000\nTime:2019-09-09T20:05:41.9796355Z", + "Date" : "Mon, 09 Sep 2019 20:05:41 GMT", + "x-ms-client-request-id" : "44817ac8-6f6f-434a-8e56-2244d76a4c73", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcchangeleaseacfail&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" : "85ada137-e38d-4b3f-8f64-b7be913989d4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca7da3-301e-0042-7849-67cbbf000000", + "Body" : "jtcchangeleaseacfailjtcchangeleaseacfail0blobapitestchangeleaseacfail0397113144fMon, 09 Sep 2019 20:05:41 GMT\"0x8D73561176B5559\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:41 GMT", + "x-ms-client-request-id" : "85ada137-e38d-4b3f-8f64-b7be913989d4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail0397113144f?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" : "d274a959-0506-4e55-a9c8-2f907716602d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca7db5-301e-0042-0949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:42 GMT", + "x-ms-client-request-id" : "d274a959-0506-4e55-a9c8-2f907716602d" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseacfail0blobapitestchangeleaseacfail0397113144f", "javablobchangeleaseacfail1blobapitestchangeleaseacfail03907411", "9736b4c7-1d91-490f-8005-5fc2b41b5e91" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseacfail[3].json new file mode 100644 index 000000000000..9d128ff5c7c9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseacfail[3].json @@ -0,0 +1,166 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail1e980841306?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" : "28ce99f3-ca77-4551-b3ef-637d55891cb1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356117BB0A61\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7dc7-301e-0042-1b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:42 GMT", + "x-ms-client-request-id" : "28ce99f3-ca77-4551-b3ef-637d55891cb1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail1e980841306/javablobchangeleaseacfail1blobapitestchangeleaseacfail1e963789", + "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" : "4a09809e-443f-4758-aebe-4781efef9eae", + "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 20:05:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:42 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356117C8579F\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca7dd6-301e-0042-2949-67cbbf000000", + "x-ms-client-request-id" : "4a09809e-443f-4758-aebe-4781efef9eae" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail1e980841306/javablobchangeleaseacfail1blobapitestchangeleaseacfail1e963789", + "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" : "9c4078e4-24ac-4b59-a56a-bc3af39af318" + }, + "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 20:05:42 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:05:42 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7356117C8579F\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:42 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca7de7-301e-0042-3849-67cbbf000000", + "x-ms-client-request-id" : "9c4078e4-24ac-4b59-a56a-bc3af39af318", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail1e980841306/javablobchangeleaseacfail1blobapitestchangeleaseacfail1e963789?comp=lease", + "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" : "42468487-78af-485d-bf3c-dbd86bc1c2a3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356117C8579F\"", + "x-ms-lease-id" : "55282110-24d9-436d-97ac-ea5548782349", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7df6-301e-0042-4749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:42 GMT", + "x-ms-client-request-id" : "42468487-78af-485d-bf3c-dbd86bc1c2a3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail1e980841306/javablobchangeleaseacfail1blobapitestchangeleaseacfail1e963789?comp=lease", + "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" : "5e0cf4dd-a293-48d5-900f-8df31bb3ffae" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca7e02-301e-0042-5349-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca7e02-301e-0042-5349-67cbbf000000\nTime:2019-09-09T20:05:42.5760561Z", + "Date" : "Mon, 09 Sep 2019 20:05:42 GMT", + "x-ms-client-request-id" : "5e0cf4dd-a293-48d5-900f-8df31bb3ffae", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcchangeleaseacfail&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" : "6edf2f3a-20ea-4ca3-9606-1335405e5d66" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca7e13-301e-0042-6349-67cbbf000000", + "Body" : "jtcchangeleaseacfailjtcchangeleaseacfail0blobapitestchangeleaseacfail1e980841306Mon, 09 Sep 2019 20:05:42 GMT\"0x8D7356117BB0A61\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:42 GMT", + "x-ms-client-request-id" : "6edf2f3a-20ea-4ca3-9606-1335405e5d66", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0blobapitestchangeleaseacfail1e980841306?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" : "70565797-abb0-4c93-8e37-4f8f26179835" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca7e27-301e-0042-7749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:42 GMT", + "x-ms-client-request-id" : "70565797-abb0-4c93-8e37-4f8f26179835" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseacfail0blobapitestchangeleaseacfail1e980841306", "javablobchangeleaseacfail1blobapitestchangeleaseacfail1e963789", "29ebcc62-dc7b-4fb6-b0af-639259389170" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseerror.json new file mode 100644 index 000000000000..17721a9d30ae --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleaseerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseerror0blobapitestchangeleaseerror4ab07322e03e?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" : "9451f504-e39f-48da-a838-125409e77d23" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356118145E18\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7e3e-301e-0042-0c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:42 GMT", + "x-ms-client-request-id" : "9451f504-e39f-48da-a838-125409e77d23" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseerror0blobapitestchangeleaseerror4ab07322e03e/javablobchangeleaseerror1blobapitestchangeleaseerror4ab347242", + "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" : "a59bc4a8-c25d-433c-8a1d-3a7c1b307878", + "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 20:05:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:42 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611821845B\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca7e50-301e-0042-1d49-67cbbf000000", + "x-ms-client-request-id" : "a59bc4a8-c25d-433c-8a1d-3a7c1b307878" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseerror0blobapitestchangeleaseerror4ab07322e03e/javablobchangeleaseerror2blobapitestchangeleaseerror4ab548357?comp=lease", + "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" : "dfc1652b-0f33-47de-8b8e-fdbab6526403" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "c5ca7e67-301e-0042-3349-67cbbf000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:c5ca7e67-301e-0042-3349-67cbbf000000\nTime:2019-09-09T20:05:42.9973537Zx-ms-lease-idid", + "Date" : "Mon, 09 Sep 2019 20:05:42 GMT", + "x-ms-client-request-id" : "dfc1652b-0f33-47de-8b8e-fdbab6526403", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcchangeleaseerror&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" : "6db059a0-56ea-448f-b3c0-622ee1dbf574" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca7e8a-301e-0042-5049-67cbbf000000", + "Body" : "jtcchangeleaseerrorjtcchangeleaseerror0blobapitestchangeleaseerror4ab07322e03eMon, 09 Sep 2019 20:05:42 GMT\"0x8D7356118145E18\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:42 GMT", + "x-ms-client-request-id" : "6db059a0-56ea-448f-b3c0-622ee1dbf574", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseerror0blobapitestchangeleaseerror4ab07322e03e?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" : "b25d04f1-acb2-4dfb-ac4b-642162d97c91" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca7ea5-301e-0042-6b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:43 GMT", + "x-ms-client-request-id" : "b25d04f1-acb2-4dfb-ac4b-642162d97c91" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseerror0blobapitestchangeleaseerror4ab07322e03e", "javablobchangeleaseerror1blobapitestchangeleaseerror4ab347242", "javablobchangeleaseerror2blobapitestchangeleaseerror4ab548357" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleasemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleasemin.json new file mode 100644 index 000000000000..7834c9e20e86 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestchangeleasemin.json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleasemin0blobapitestchangeleasemin4ed118852195a0?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" : "be9982e7-7c51-4a47-9745-431269a196fe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356114E806C6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca797f-301e-0042-2949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:37 GMT", + "x-ms-client-request-id" : "be9982e7-7c51-4a47-9745-431269a196fe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleasemin0blobapitestchangeleasemin4ed118852195a0/javablobchangeleasemin1blobapitestchangeleasemin4ed399329cc", + "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" : "34c655fd-9fe2-4656-b42a-a7615bcccc08", + "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 20:05:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356114F4B6AE\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca798f-301e-0042-3849-67cbbf000000", + "x-ms-client-request-id" : "34c655fd-9fe2-4656-b42a-a7615bcccc08" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleasemin0blobapitestchangeleasemin4ed118852195a0/javablobchangeleasemin1blobapitestchangeleasemin4ed399329cc?comp=lease", + "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" : "1c9a2b5f-21fa-4564-8e90-14cd2d44736a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356114F4B6AE\"", + "x-ms-lease-id" : "73b68b18-1822-4148-952c-f859ebfebf0c", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca79a1-301e-0042-4949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:37 GMT", + "x-ms-client-request-id" : "1c9a2b5f-21fa-4564-8e90-14cd2d44736a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleasemin0blobapitestchangeleasemin4ed118852195a0/javablobchangeleasemin1blobapitestchangeleasemin4ed399329cc?comp=lease", + "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" : "520640e7-5a76-4c71-8c14-4048c364de4e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356114F4B6AE\"", + "x-ms-lease-id" : "1402a4fe-7500-4cda-bba9-fab1171205fd", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca79ac-301e-0042-5449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:37 GMT", + "x-ms-client-request-id" : "520640e7-5a76-4c71-8c14-4048c364de4e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcchangeleasemin&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" : "68a885c4-8716-414d-a785-a6efd8f65c06" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca79c0-301e-0042-6749-67cbbf000000", + "Body" : "jtcchangeleaseminjtcchangeleasemin0blobapitestchangeleasemin4ed118852195a0Mon, 09 Sep 2019 20:05:37 GMT\"0x8D7356114E806C6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:37 GMT", + "x-ms-client-request-id" : "68a885c4-8716-414d-a785-a6efd8f65c06", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleasemin0blobapitestchangeleasemin4ed118852195a0?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" : "2a58d773-b242-41c8-aaee-a7ab78034495" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca79d4-301e-0042-7849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:37 GMT", + "x-ms-client-request-id" : "2a58d773-b242-41c8-aaee-a7ab78034495" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleasemin0blobapitestchangeleasemin4ed118852195a0", "javablobchangeleasemin1blobapitestchangeleasemin4ed399329cc", "1402a4fe-7500-4cda-bba9-fab1171205fd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopy.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopy.json new file mode 100644 index 000000000000..92fcfd60242c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopy.json @@ -0,0 +1,187 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopy0blobapitestcopy2594057322b83d450d334977?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" : "5ffc8e7a-2e51-491d-af14-4f1536463f96" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611C875318\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca866d-301e-0042-3b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:50 GMT", + "x-ms-client-request-id" : "5ffc8e7a-2e51-491d-af14-4f1536463f96" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopy0blobapitestcopy2594057322b83d450d334977/javablobcopy1blobapitestcopy2594367963848b84cff34", + "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" : "d1b2d458-96ef-4497-8e94-af67cfd1a10d", + "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 20:05:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:50 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611C94C91A\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca8682-301e-0042-4e49-67cbbf000000", + "x-ms-client-request-id" : "d1b2d458-96ef-4497-8e94-af67cfd1a10d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopy0blobapitestcopy2594057322b83d450d334977/javablobcopy2blobapitestcopy25958013ceab5681b1624", + "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" : "1761e668-2cd7-4915-98cb-a76a9e9b6330" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "67c586cf-8317-4f7f-b854-0b3be146965b", + "ETag" : "\"0x8D735611CA2602A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca869b-301e-0042-6649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:50 GMT", + "x-ms-client-request-id" : "1761e668-2cd7-4915-98cb-a76a9e9b6330" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopy0blobapitestcopy2594057322b83d450d334977/javablobcopy2blobapitestcopy25958013ceab5681b1624", + "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" : "71c94744-1fa1-4fae-ab76-877f4f324b6f" + }, + "Response" : { + "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 20:05:50 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "BlockBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:50 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca86b9-301e-0042-0349-67cbbf000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "67c586cf-8317-4f7f-b854-0b3be146965b", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtccopy0blobapitestcopy2594057322b83d450d334977/javablobcopy1blobapitestcopy2594367963848b84cff34", + "x-ms-copy-progress" : "7/7", + "Date" : "Mon, 09 Sep 2019 20:05:50 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:05:50 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D735611CA2602A\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "71c94744-1fa1-4fae-ab76-877f4f324b6f" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopy0blobapitestcopy2594057322b83d450d334977/javablobcopy2blobapitestcopy25958013ceab5681b1624", + "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" : "a5e72d7c-fce2-41f7-81ce-3ae92369176a" + }, + "Response" : { + "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 20:05:50 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "BlockBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:50 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca86c7-301e-0042-1149-67cbbf000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "67c586cf-8317-4f7f-b854-0b3be146965b", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtccopy0blobapitestcopy2594057322b83d450d334977/javablobcopy1blobapitestcopy2594367963848b84cff34", + "x-ms-copy-progress" : "7/7", + "Date" : "Mon, 09 Sep 2019 20:05:50 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:05:50 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D735611CA2602A\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "a5e72d7c-fce2-41f7-81ce-3ae92369176a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopy&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" : "dbe5c45c-a39b-4697-9593-864c9ed6a4fe" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca86e0-301e-0042-2949-67cbbf000000", + "Body" : "jtccopyjtccopy0blobapitestcopy2594057322b83d450d334977Mon, 09 Sep 2019 20:05:50 GMT\"0x8D735611C875318\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:50 GMT", + "x-ms-client-request-id" : "dbe5c45c-a39b-4697-9593-864c9ed6a4fe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopy0blobapitestcopy2594057322b83d450d334977?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" : "b0a6d5a4-3d5d-45ef-a1fc-5fd07a3d7c76" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8703-301e-0042-4749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:50 GMT", + "x-ms-client-request-id" : "b0a6d5a4-3d5d-45ef-a1fc-5fd07a3d7c76" + }, + "Exception" : null + } ], + "variables" : [ "jtccopy0blobapitestcopy2594057322b83d450d334977", "javablobcopy1blobapitestcopy2594367963848b84cff34", "javablobcopy2blobapitestcopy25958013ceab5681b1624" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[0].json new file mode 100644 index 000000000000..433c5ed18b55 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[0].json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac2127193608c4099b5c?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" : "858c69e3-dac9-4f42-a955-048558f53971" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561203AA60A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca8d0d-301e-0042-6649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:56 GMT", + "x-ms-client-request-id" : "858c69e3-dac9-4f42-a955-048558f53971" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac2127193608c4099b5c/javablobcopydestac1blobapitestcopydestac212637463d0f398", + "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" : "8066dc29-fc41-4596-a212-80db360a5f7a", + "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 20:05:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:56 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356120481D58\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca8d27-301e-0042-7b49-67cbbf000000", + "x-ms-client-request-id" : "8066dc29-fc41-4596-a212-80db360a5f7a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac2127193608c4099b5c/javablobcopydestac2blobapitestcopydestac212589973d2455f", + "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" : "ce5f0912-decd-4a9a-a704-344a42680f32", + "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 20:05:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:56 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356120553F1C\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca8d3e-301e-0042-1049-67cbbf000000", + "x-ms-client-request-id" : "ce5f0912-decd-4a9a-a704-344a42680f32" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac2127193608c4099b5c/javablobcopydestac2blobapitestcopydestac212589973d2455f", + "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" : "d7a7ce3f-104f-4960-85d6-b1197205bbc6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "83a4ead7-b703-4797-91fa-e3009bf203d8", + "ETag" : "\"0x8D73561206239D4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8d51-301e-0042-2249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:56 GMT", + "x-ms-client-request-id" : "d7a7ce3f-104f-4960-85d6-b1197205bbc6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopydestac&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" : "78541c28-ac21-4809-91dd-43a599824b74" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca8d62-301e-0042-3249-67cbbf000000", + "Body" : "jtccopydestacjtccopydestac0blobapitestcopydestac2127193608c4099b5cMon, 09 Sep 2019 20:05:56 GMT\"0x8D73561203AA60A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:56 GMT", + "x-ms-client-request-id" : "78541c28-ac21-4809-91dd-43a599824b74", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac2127193608c4099b5c?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" : "396e33ac-7759-4e09-891a-8698f8c6892f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8d71-301e-0042-4149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:56 GMT", + "x-ms-client-request-id" : "396e33ac-7759-4e09-891a-8698f8c6892f" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestac0blobapitestcopydestac2127193608c4099b5c", "javablobcopydestac1blobapitestcopydestac212637463d0f398", "javablobcopydestac2blobapitestcopydestac212589973d2455f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[1].json new file mode 100644 index 000000000000..7eeac8c79fbf --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[1].json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac9ed54540e2c34a3381?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" : "ae36f966-7090-4926-a02d-fcb9715a8a52" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561208AD054\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca8d8b-301e-0042-5749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:56 GMT", + "x-ms-client-request-id" : "ae36f966-7090-4926-a02d-fcb9715a8a52" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac9ed54540e2c34a3381/javablobcopydestac1blobapitestcopydestac9ed498550b9eca9", + "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" : "1ad73589-d871-4c49-a630-a374c6370186", + "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 20:05:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:56 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612099324E\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca8da7-301e-0042-6e49-67cbbf000000", + "x-ms-client-request-id" : "1ad73589-d871-4c49-a630-a374c6370186" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac9ed54540e2c34a3381/javablobcopydestac2blobapitestcopydestac9ed2017039fed7e", + "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" : "69e3b2b9-fc08-4ab0-b0b3-139571c84764", + "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 20:05:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:57 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356120A6A240\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca8db5-301e-0042-7b49-67cbbf000000", + "x-ms-client-request-id" : "69e3b2b9-fc08-4ab0-b0b3-139571c84764" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac9ed54540e2c34a3381/javablobcopydestac2blobapitestcopydestac9ed2017039fed7e", + "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" : "47c58ac0-c6f5-4604-8b43-78e369a04e61" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "8c5daef9-4a1b-4fb7-9e47-ba88d1a099d0", + "ETag" : "\"0x8D7356120B523D6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8dd4-301e-0042-1449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:57 GMT", + "x-ms-client-request-id" : "47c58ac0-c6f5-4604-8b43-78e369a04e61" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopydestac&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" : "22b00cef-a3ef-4315-9071-b9a13ba4bc8d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca8de6-301e-0042-2649-67cbbf000000", + "Body" : "jtccopydestacjtccopydestac0blobapitestcopydestac9ed54540e2c34a3381Mon, 09 Sep 2019 20:05:57 GMT\"0x8D73561208AD054\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:57 GMT", + "x-ms-client-request-id" : "22b00cef-a3ef-4315-9071-b9a13ba4bc8d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac9ed54540e2c34a3381?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" : "b9e44eea-433b-48dc-8e1b-e6359bb349a7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8dff-301e-0042-3a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:57 GMT", + "x-ms-client-request-id" : "b9e44eea-433b-48dc-8e1b-e6359bb349a7" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestac0blobapitestcopydestac9ed54540e2c34a3381", "javablobcopydestac1blobapitestcopydestac9ed498550b9eca9", "javablobcopydestac2blobapitestcopydestac9ed2017039fed7e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[2].json new file mode 100644 index 000000000000..379c768ce4cd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[2].json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac792625277f08b2753d?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" : "46bc61e1-00fb-4d1f-bcc2-be90d3091eb2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356120DCA8A3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca8e12-301e-0042-4c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:57 GMT", + "x-ms-client-request-id" : "46bc61e1-00fb-4d1f-bcc2-be90d3091eb2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac792625277f08b2753d/javablobcopydestac1blobapitestcopydestac79231769ec7a152", + "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" : "b2cd1eea-5d74-4dc1-8f7c-d0dae19971d4", + "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 20:05:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:57 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356120E9AAE7\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca8e26-301e-0042-5f49-67cbbf000000", + "x-ms-client-request-id" : "b2cd1eea-5d74-4dc1-8f7c-d0dae19971d4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac792625277f08b2753d/javablobcopydestac2blobapitestcopydestac79243114a21bbf4", + "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" : "86f273c9-7cbe-40d2-92a6-0463ae1d97e4", + "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 20:05:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:57 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356120F6CCAB\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca8e36-301e-0042-6f49-67cbbf000000", + "x-ms-client-request-id" : "86f273c9-7cbe-40d2-92a6-0463ae1d97e4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac792625277f08b2753d/javablobcopydestac2blobapitestcopydestac79243114a21bbf4", + "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" : "b888db7e-eb79-4c6f-85d8-27bcb0a514c3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "1a10b309-b964-4a32-9d2f-3b73abbf5c7a", + "ETag" : "\"0x8D7356121048AC7\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8e47-301e-0042-8049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:57 GMT", + "x-ms-client-request-id" : "b888db7e-eb79-4c6f-85d8-27bcb0a514c3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopydestac&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" : "c6419eca-45d0-4b00-95fb-9bf01f4b7f50" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca8e5a-301e-0042-1149-67cbbf000000", + "Body" : "jtccopydestacjtccopydestac0blobapitestcopydestac792625277f08b2753dMon, 09 Sep 2019 20:05:57 GMT\"0x8D7356120DCA8A3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:57 GMT", + "x-ms-client-request-id" : "c6419eca-45d0-4b00-95fb-9bf01f4b7f50", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac792625277f08b2753d?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" : "768f8ecb-b7f1-4739-825a-b2ab0d7404c0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8e65-301e-0042-1c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:57 GMT", + "x-ms-client-request-id" : "768f8ecb-b7f1-4739-825a-b2ab0d7404c0" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestac0blobapitestcopydestac792625277f08b2753d", "javablobcopydestac1blobapitestcopydestac79231769ec7a152", "javablobcopydestac2blobapitestcopydestac79243114a21bbf4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[3].json new file mode 100644 index 000000000000..d09d8b228070 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[3].json @@ -0,0 +1,170 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac16e20804390663c48c?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" : "e6c932f2-412f-4452-88fc-946918863385" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561212BE863\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca8e7c-301e-0042-2f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:57 GMT", + "x-ms-client-request-id" : "e6c932f2-412f-4452-88fc-946918863385" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac16e20804390663c48c/javablobcopydestac1blobapitestcopydestac16e52943762db85", + "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" : "5f32a4c4-c849-4b78-8216-6250c8017315", + "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 20:05:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:58 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612139D54E\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca8e89-301e-0042-3b49-67cbbf000000", + "x-ms-client-request-id" : "5f32a4c4-c849-4b78-8216-6250c8017315" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac16e20804390663c48c/javablobcopydestac2blobapitestcopydestac16e97443ae7820a", + "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" : "5109db89-0a70-4cfc-8d2d-3952082b0ad9", + "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 20:05:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:58 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356121482FCB\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca8e9b-301e-0042-4c49-67cbbf000000", + "x-ms-client-request-id" : "5109db89-0a70-4cfc-8d2d-3952082b0ad9" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac16e20804390663c48c/javablobcopydestac2blobapitestcopydestac16e97443ae7820a", + "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" : "3d49e7a1-be5f-493b-b745-29359cebef79" + }, + "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 20:05:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:05:58 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7356121482FCB\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:58 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca8eac-301e-0042-5d49-67cbbf000000", + "x-ms-client-request-id" : "3d49e7a1-be5f-493b-b745-29359cebef79", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac16e20804390663c48c/javablobcopydestac2blobapitestcopydestac16e97443ae7820a", + "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" : "1c1e0974-ec4b-4d22-9b49-b4d24db1e509" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "576906bb-82ba-4adf-8c1d-fcc05bb96ca6", + "ETag" : "\"0x8D7356121627353\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8eb6-301e-0042-6749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:58 GMT", + "x-ms-client-request-id" : "1c1e0974-ec4b-4d22-9b49-b4d24db1e509" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopydestac&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" : "039debed-57cc-4a67-84b9-e47830fca6c3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca8ec8-301e-0042-7949-67cbbf000000", + "Body" : "jtccopydestacjtccopydestac0blobapitestcopydestac16e20804390663c48cMon, 09 Sep 2019 20:05:58 GMT\"0x8D73561212BE863\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:58 GMT", + "x-ms-client-request-id" : "039debed-57cc-4a67-84b9-e47830fca6c3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac16e20804390663c48c?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" : "53adfdcf-f3de-42ba-aed6-9be2a504e270" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8ed6-301e-0042-0649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:58 GMT", + "x-ms-client-request-id" : "53adfdcf-f3de-42ba-aed6-9be2a504e270" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestac0blobapitestcopydestac16e20804390663c48c", "javablobcopydestac1blobapitestcopydestac16e52943762db85", "javablobcopydestac2blobapitestcopydestac16e97443ae7820a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[4].json new file mode 100644 index 000000000000..f91c3ea75cc1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[4].json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac373971124c4a4dadc9?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" : "04ad8b1a-08e3-43f3-adb4-dd57a6459130" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561218B7EC9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca8eec-301e-0042-1c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:58 GMT", + "x-ms-client-request-id" : "04ad8b1a-08e3-43f3-adb4-dd57a6459130" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac373971124c4a4dadc9/javablobcopydestac1blobapitestcopydestac3731299632c5fcb", + "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" : "85873ce1-1ca0-422d-a449-2c0bddbe8f6b", + "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 20:05:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:58 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612198A864\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca8f07-301e-0042-3349-67cbbf000000", + "x-ms-client-request-id" : "85873ce1-1ca0-422d-a449-2c0bddbe8f6b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac373971124c4a4dadc9/javablobcopydestac2blobapitestcopydestac3733119336d4a04", + "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" : "452c6e60-531f-4048-a01c-c2c3cbc0caa3", + "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 20:05:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:58 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356121A57BFA\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca8f1c-301e-0042-4849-67cbbf000000", + "x-ms-client-request-id" : "452c6e60-531f-4048-a01c-c2c3cbc0caa3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac373971124c4a4dadc9/javablobcopydestac2blobapitestcopydestac3733119336d4a04", + "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" : "efcf6cab-f3e0-4ddb-8a01-198af334dc47" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "616329e3-29d4-4d40-9dd9-b6114e4b5dae", + "ETag" : "\"0x8D7356121B44BB5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8f2d-301e-0042-5749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:58 GMT", + "x-ms-client-request-id" : "efcf6cab-f3e0-4ddb-8a01-198af334dc47" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopydestac&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" : "796482d3-65dc-4eda-b30e-9a600fd6ff44" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca8f48-301e-0042-6c49-67cbbf000000", + "Body" : "jtccopydestacjtccopydestac0blobapitestcopydestac373971124c4a4dadc9Mon, 09 Sep 2019 20:05:58 GMT\"0x8D73561218B7EC9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:58 GMT", + "x-ms-client-request-id" : "796482d3-65dc-4eda-b30e-9a600fd6ff44", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestac373971124c4a4dadc9?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" : "ce79013c-6696-4381-b49f-60d6209d33e9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8f5f-301e-0042-0249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:58 GMT", + "x-ms-client-request-id" : "ce79013c-6696-4381-b49f-60d6209d33e9" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestac0blobapitestcopydestac373971124c4a4dadc9", "javablobcopydestac1blobapitestcopydestac3731299632c5fcb", "javablobcopydestac2blobapitestcopydestac3733119336d4a04" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[5].json new file mode 100644 index 000000000000..7ee588acbf68 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestac[5].json @@ -0,0 +1,160 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestaceb5011495b13de5aee?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" : "ca17e005-f40b-4478-85dc-2a1d708cc7f9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356121DB33D1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca8f77-301e-0042-1a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:59 GMT", + "x-ms-client-request-id" : "ca17e005-f40b-4478-85dc-2a1d708cc7f9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestaceb5011495b13de5aee/javablobcopydestac1blobapitestcopydestaceb541851f780721", + "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" : "7cf9b134-8325-488d-8899-f37ae350b26b", + "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 20:05:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:59 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356121EACEF9\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca8f90-301e-0042-3249-67cbbf000000", + "x-ms-client-request-id" : "7cf9b134-8325-488d-8899-f37ae350b26b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestaceb5011495b13de5aee/javablobcopydestac2blobapitestcopydestaceb5942063ef1107", + "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" : "46f4d20d-b453-4075-98ce-4cf6c63f61d1", + "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 20:05:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:59 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356121F7A28F\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca8f9f-301e-0042-4149-67cbbf000000", + "x-ms-client-request-id" : "46f4d20d-b453-4075-98ce-4cf6c63f61d1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestaceb5011495b13de5aee/javablobcopydestac2blobapitestcopydestaceb5942063ef1107?comp=lease", + "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" : "b93f9124-7520-4e69-b7e6-fffe13d54b39" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356121F7A28F\"", + "x-ms-lease-id" : "9dfbe50d-1bf4-4247-bbc6-1cc1f6a325be", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca8faf-301e-0042-5049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:59 GMT", + "x-ms-client-request-id" : "b93f9124-7520-4e69-b7e6-fffe13d54b39" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestaceb5011495b13de5aee/javablobcopydestac2blobapitestcopydestaceb5942063ef1107", + "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" : "f4fdcb2b-3e43-4d79-91a9-c37609a26c00" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "f2177556-827f-4f73-b96a-b024d90ba1ab", + "ETag" : "\"0x8D73561221149B6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8fca-301e-0042-6a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:59 GMT", + "x-ms-client-request-id" : "f4fdcb2b-3e43-4d79-91a9-c37609a26c00" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopydestac&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" : "d1d7d997-0dd7-47ef-9c1f-2fbe624baca1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca8fea-301e-0042-0949-67cbbf000000", + "Body" : "jtccopydestacjtccopydestac0blobapitestcopydestaceb5011495b13de5aeeMon, 09 Sep 2019 20:05:59 GMT\"0x8D7356121DB33D1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:59 GMT", + "x-ms-client-request-id" : "d1d7d997-0dd7-47ef-9c1f-2fbe624baca1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestac0blobapitestcopydestaceb5011495b13de5aee?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" : "671dce81-93e5-4a86-ba14-7f4b4d71b2d8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8ffb-301e-0042-1a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:59 GMT", + "x-ms-client-request-id" : "671dce81-93e5-4a86-ba14-7f4b4d71b2d8" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestac0blobapitestcopydestaceb5011495b13de5aee", "javablobcopydestac1blobapitestcopydestaceb541851f780721", "javablobcopydestac2blobapitestcopydestaceb5942063ef1107" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[0].json new file mode 100644 index 000000000000..23d155279d6e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[0].json @@ -0,0 +1,137 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail87921638a6f32b?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" : "38ce00f9-4d7f-4c09-99b1-53eafdb36997" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561223AF14C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca9010-301e-0042-2f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:59 GMT", + "x-ms-client-request-id" : "38ce00f9-4d7f-4c09-99b1-53eafdb36997" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail87921638a6f32b/javablobcopydestacfail1blobapitestcopydestacfail879596184a6", + "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" : "acf941e2-5db7-4d68-9691-7e2b7ef3b509", + "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 20:05:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:59 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356122481B24\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca9024-301e-0042-4049-67cbbf000000", + "x-ms-client-request-id" : "acf941e2-5db7-4d68-9691-7e2b7ef3b509" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail87921638a6f32b/javablobcopydestacfail2blobapitestcopydestacfail87994410440", + "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" : "9054a377-c830-479b-9c18-2d41bab93af2", + "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 20:06:00 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:59 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561225515D3\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca9035-301e-0042-5049-67cbbf000000", + "x-ms-client-request-id" : "9054a377-c830-479b-9c18-2d41bab93af2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail87921638a6f32b/javablobcopydestacfail2blobapitestcopydestacfail87994410440", + "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" : "6c86faa9-c2ad-4ecf-8bb8-8cf8216c78e6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "TargetConditionNotMet", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca904d-301e-0042-6649-67cbbf000000", + "Body" : "TargetConditionNotMetThe target condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca904d-301e-0042-6649-67cbbf000000\nTime:2019-09-09T20:06:00.1224427Z", + "Date" : "Mon, 09 Sep 2019 20:05:59 GMT", + "x-ms-client-request-id" : "6c86faa9-c2ad-4ecf-8bb8-8cf8216c78e6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopydestacfail&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" : "e05f56f8-b68b-44de-ab44-a4d0cadab346" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca906e-301e-0042-0649-67cbbf000000", + "Body" : "jtccopydestacfailjtccopydestacfail0blobapitestcopydestacfail87921638a6f32bMon, 09 Sep 2019 20:05:59 GMT\"0x8D73561223AF14C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:00 GMT", + "x-ms-client-request-id" : "e05f56f8-b68b-44de-ab44-a4d0cadab346", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail87921638a6f32b?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" : "16d9c1e1-81af-4ff2-8fd1-9f518488ee22" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca9082-301e-0042-194a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:00 GMT", + "x-ms-client-request-id" : "16d9c1e1-81af-4ff2-8fd1-9f518488ee22" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestacfail0blobapitestcopydestacfail87921638a6f32b", "javablobcopydestacfail1blobapitestcopydestacfail879596184a6", "javablobcopydestacfail2blobapitestcopydestacfail87994410440" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[1].json new file mode 100644 index 000000000000..6c681d981077 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[1].json @@ -0,0 +1,137 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail13d5924710acfe?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" : "d46b3ac0-bb3b-42c1-a192-f5f1caf7dbf2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356122885BFB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca9099-301e-0042-304a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:00 GMT", + "x-ms-client-request-id" : "d46b3ac0-bb3b-42c1-a192-f5f1caf7dbf2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail13d5924710acfe/javablobcopydestacfail1blobapitestcopydestacfail13d06327ae5", + "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" : "cabb084d-e751-4e44-b8f6-511d7479b6b3", + "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 20:06:00 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:00 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356122E5B05A\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca90a8-301e-0042-3e4a-67cbbf000000", + "x-ms-client-request-id" : "cabb084d-e751-4e44-b8f6-511d7479b6b3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail13d5924710acfe/javablobcopydestacfail2blobapitestcopydestacfail13d88468ea1", + "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" : "d29c6f64-b433-4d44-acb1-9434ab7bc580", + "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 20:06:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:00 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356122F3BCA8\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca912e-301e-0042-404a-67cbbf000000", + "x-ms-client-request-id" : "d29c6f64-b433-4d44-acb1-9434ab7bc580" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail13d5924710acfe/javablobcopydestacfail2blobapitestcopydestacfail13d88468ea1", + "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" : "f5250027-47da-403c-a832-cf08fbaf5f25" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "TargetConditionNotMet", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca9141-301e-0042-534a-67cbbf000000", + "Body" : "TargetConditionNotMetThe target condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca9141-301e-0042-534a-67cbbf000000\nTime:2019-09-09T20:06:01.1631769Z", + "Date" : "Mon, 09 Sep 2019 20:06:00 GMT", + "x-ms-client-request-id" : "f5250027-47da-403c-a832-cf08fbaf5f25", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopydestacfail&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" : "a2039e3e-196a-4a90-b400-bc513664b699" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9165-301e-0042-724a-67cbbf000000", + "Body" : "jtccopydestacfailjtccopydestacfail0blobapitestcopydestacfail13d5924710acfeMon, 09 Sep 2019 20:06:00 GMT\"0x8D7356122885BFB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:01 GMT", + "x-ms-client-request-id" : "a2039e3e-196a-4a90-b400-bc513664b699", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail13d5924710acfe?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" : "d6abedfb-046f-4499-b50e-50db5ccefcd1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca917b-301e-0042-064a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:01 GMT", + "x-ms-client-request-id" : "d6abedfb-046f-4499-b50e-50db5ccefcd1" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestacfail0blobapitestcopydestacfail13d5924710acfe", "javablobcopydestacfail1blobapitestcopydestacfail13d06327ae5", "javablobcopydestacfail2blobapitestcopydestacfail13d88468ea1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[2].json new file mode 100644 index 000000000000..3e114b0c1a37 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[2].json @@ -0,0 +1,137 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfailb0e62129edfb74?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" : "7f599588-97cf-4a1f-af3b-cd1b1b03a8e9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561232925D7\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca9193-301e-0042-1c4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:01 GMT", + "x-ms-client-request-id" : "7f599588-97cf-4a1f-af3b-cd1b1b03a8e9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfailb0e62129edfb74/javablobcopydestacfail1blobapitestcopydestacfailb0e31140db6", + "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" : "f84d2aae-e54f-45d5-bcb0-7af9badca6d8", + "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 20:06:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:01 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356123373AB2\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca91b0-301e-0042-364a-67cbbf000000", + "x-ms-client-request-id" : "f84d2aae-e54f-45d5-bcb0-7af9badca6d8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfailb0e62129edfb74/javablobcopydestacfail2blobapitestcopydestacfailb0e201633d8", + "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" : "7df22383-80c7-46d0-ae45-02e21c265067", + "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 20:06:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:01 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356123443539\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca91c0-301e-0042-464a-67cbbf000000", + "x-ms-client-request-id" : "7df22383-80c7-46d0-ae45-02e21c265067" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfailb0e62129edfb74/javablobcopydestacfail2blobapitestcopydestacfailb0e201633d8", + "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" : "16c8bd83-672a-4337-a156-184e88997570" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "TargetConditionNotMet", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca91e4-301e-0042-684a-67cbbf000000", + "Body" : "TargetConditionNotMetThe target condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca91e4-301e-0042-684a-67cbbf000000\nTime:2019-09-09T20:06:01.6815433Z", + "Date" : "Mon, 09 Sep 2019 20:06:01 GMT", + "x-ms-client-request-id" : "16c8bd83-672a-4337-a156-184e88997570", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopydestacfail&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" : "d2584c19-fb34-470b-bb60-5efb5a906eaa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca91fc-301e-0042-7f4a-67cbbf000000", + "Body" : "jtccopydestacfailjtccopydestacfail0blobapitestcopydestacfailb0e62129edfb74Mon, 09 Sep 2019 20:06:01 GMT\"0x8D73561232925D7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:01 GMT", + "x-ms-client-request-id" : "d2584c19-fb34-470b-bb60-5efb5a906eaa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfailb0e62129edfb74?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" : "9e736ee2-0826-42cb-a043-aac902ba532e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca9205-301e-0042-084a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:01 GMT", + "x-ms-client-request-id" : "9e736ee2-0826-42cb-a043-aac902ba532e" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestacfail0blobapitestcopydestacfailb0e62129edfb74", "javablobcopydestacfail1blobapitestcopydestacfailb0e31140db6", "javablobcopydestacfail2blobapitestcopydestacfailb0e201633d8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[3].json new file mode 100644 index 000000000000..27e8e3cad387 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[3].json @@ -0,0 +1,169 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail4af477998a22ed?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" : "9bc203ab-6c5f-4c80-ae15-9cfd31add430" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356123783E83\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca9248-301e-0042-474a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:01 GMT", + "x-ms-client-request-id" : "9bc203ab-6c5f-4c80-ae15-9cfd31add430" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail4af477998a22ed/javablobcopydestacfail1blobapitestcopydestacfail4af907499ed", + "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" : "b502fc38-7fc8-4e90-a127-b237db43b97f", + "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 20:06:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:01 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612385DE12\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca9262-301e-0042-5c4a-67cbbf000000", + "x-ms-client-request-id" : "b502fc38-7fc8-4e90-a127-b237db43b97f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail4af477998a22ed/javablobcopydestacfail2blobapitestcopydestacfail4af444189af", + "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" : "8761ecb4-ce20-42bb-aed6-4079d20b484a", + "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 20:06:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:01 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612393EA61\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca9278-301e-0042-724a-67cbbf000000", + "x-ms-client-request-id" : "8761ecb4-ce20-42bb-aed6-4079d20b484a" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail4af477998a22ed/javablobcopydestacfail2blobapitestcopydestacfail4af444189af", + "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" : "ba6719fd-dde6-40b1-ac1d-43d152b004a6" + }, + "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 20:06:02 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:06:02 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735612393EA61\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:02 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca928e-301e-0042-044a-67cbbf000000", + "x-ms-client-request-id" : "ba6719fd-dde6-40b1-ac1d-43d152b004a6", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail4af477998a22ed/javablobcopydestacfail2blobapitestcopydestacfail4af444189af", + "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" : "ca4b330e-53bb-4609-9054-270bad72cbed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "TargetConditionNotMet", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca92a4-301e-0042-184a-67cbbf000000", + "Body" : "TargetConditionNotMetThe target condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca92a4-301e-0042-184a-67cbbf000000\nTime:2019-09-09T20:06:02.2889723Z", + "Date" : "Mon, 09 Sep 2019 20:06:02 GMT", + "x-ms-client-request-id" : "ca4b330e-53bb-4609-9054-270bad72cbed", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopydestacfail&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" : "a8a4c0d7-f7a4-4853-8af8-bd518acba5ba" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca92be-301e-0042-2f4a-67cbbf000000", + "Body" : "jtccopydestacfailjtccopydestacfail0blobapitestcopydestacfail4af477998a22edMon, 09 Sep 2019 20:06:01 GMT\"0x8D7356123783E83\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:02 GMT", + "x-ms-client-request-id" : "a8a4c0d7-f7a4-4853-8af8-bd518acba5ba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail4af477998a22ed?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" : "3dfe08f9-73b3-4054-94d6-4323d094fbf1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca92d0-301e-0042-414a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:02 GMT", + "x-ms-client-request-id" : "3dfe08f9-73b3-4054-94d6-4323d094fbf1" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestacfail0blobapitestcopydestacfail4af477998a22ed", "javablobcopydestacfail1blobapitestcopydestacfail4af907499ed", "javablobcopydestacfail2blobapitestcopydestacfail4af444189af" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[4].json new file mode 100644 index 000000000000..fc1e93ae7653 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopydestacfail[4].json @@ -0,0 +1,159 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail1b0340043d115c?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" : "35404a1b-6aac-407e-b2dd-1fbf784b5c14" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356123D403AA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca92e4-301e-0042-544a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:02 GMT", + "x-ms-client-request-id" : "35404a1b-6aac-407e-b2dd-1fbf784b5c14" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail1b0340043d115c/javablobcopydestacfail1blobapitestcopydestacfail1b049332a4b", + "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" : "a1b1bd3d-c43f-43ba-b65c-deb0a3a9827c", + "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 20:06:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:02 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356123E1F184\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca92f9-301e-0042-684a-67cbbf000000", + "x-ms-client-request-id" : "a1b1bd3d-c43f-43ba-b65c-deb0a3a9827c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail1b0340043d115c/javablobcopydestacfail2blobapitestcopydestacfail1b0513279ac", + "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" : "fd19c4e6-bf15-4a4d-a606-c2f8e59db332", + "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 20:06:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:02 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356123EF888F\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca9317-301e-0042-034a-67cbbf000000", + "x-ms-client-request-id" : "fd19c4e6-bf15-4a4d-a606-c2f8e59db332" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail1b0340043d115c/javablobcopydestacfail2blobapitestcopydestacfail1b0513279ac?comp=lease", + "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" : "b816e289-1b8b-4fd4-9d2e-d0dc3ce71284" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356123EF888F\"", + "x-ms-lease-id" : "c9fecd77-22ca-4a78-a49c-76c42c72e40a", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca932b-301e-0042-164a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:02 GMT", + "x-ms-client-request-id" : "b816e289-1b8b-4fd4-9d2e-d0dc3ce71284" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail1b0340043d115c/javablobcopydestacfail2blobapitestcopydestacfail1b0513279ac", + "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" : "a8583cf8-aafd-4fce-abef-d23d70d81a6e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca9342-301e-0042-2c4a-67cbbf000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:c5ca9342-301e-0042-2c4a-67cbbf000000\nTime:2019-09-09T20:06:02.8984023Z", + "Date" : "Mon, 09 Sep 2019 20:06:02 GMT", + "x-ms-client-request-id" : "a8583cf8-aafd-4fce-abef-d23d70d81a6e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopydestacfail&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" : "8aa7d314-2d1c-49f8-8ca9-e903bdb744bc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9355-301e-0042-3f4a-67cbbf000000", + "Body" : "jtccopydestacfailjtccopydestacfail0blobapitestcopydestacfail1b0340043d115cMon, 09 Sep 2019 20:06:02 GMT\"0x8D7356123D403AA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:02 GMT", + "x-ms-client-request-id" : "8aa7d314-2d1c-49f8-8ca9-e903bdb744bc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopydestacfail0blobapitestcopydestacfail1b0340043d115c?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" : "8f26594a-3f81-4057-bae1-5a3c03258157" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca9366-301e-0042-4e4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:02 GMT", + "x-ms-client-request-id" : "8f26594a-3f81-4057-bae1-5a3c03258157" + }, + "Exception" : null + } ], + "variables" : [ "jtccopydestacfail0blobapitestcopydestacfail1b0340043d115c", "javablobcopydestacfail1blobapitestcopydestacfail1b049332a4b", "javablobcopydestacfail2blobapitestcopydestacfail1b0513279ac" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopyerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopyerror.json new file mode 100644 index 000000000000..ef497c0873df --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopyerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopyerror0blobapitestcopyerrorf9c373279db5c01888e?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" : "db62641f-d63b-4082-8f61-ef5072f25eda" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356127D9F25C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca9984-301e-0042-034a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:09 GMT", + "x-ms-client-request-id" : "db62641f-d63b-4082-8f61-ef5072f25eda" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopyerror0blobapitestcopyerrorf9c373279db5c01888e/javablobcopyerror1blobapitestcopyerrorf9c38786cac4b813", + "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" : "994252af-d2d6-4ac8-a5f2-d2b9891cc234", + "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 20:06:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356127E7E1A3\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca99a2-301e-0042-1c4a-67cbbf000000", + "x-ms-client-request-id" : "994252af-d2d6-4ac8-a5f2-d2b9891cc234" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopyerror0blobapitestcopyerrorf9c373279db5c01888e/javablobcopyerror2blobapitestcopyerrorf9c1786982442841", + "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" : "d052e118-2624-488b-8e50-739c93ea3ce2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "Content-Length" : "229", + "StatusCode" : "404", + "x-ms-request-id" : "c5ca99c1-301e-0042-374a-67cbbf000000", + "Body" : "CannotVerifyCopySourceThe specified resource does not exist.\nRequestId:c5ca99c1-301e-0042-374a-67cbbf000000\nTime:2019-09-09T20:06:09.5981314Z", + "Date" : "Mon, 09 Sep 2019 20:06:09 GMT", + "x-ms-client-request-id" : "d052e118-2624-488b-8e50-739c93ea3ce2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopyerror&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" : "07dadd65-6150-48c1-8342-1cd971d284fc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9a00-301e-0042-724a-67cbbf000000", + "Body" : "jtccopyerrorjtccopyerror0blobapitestcopyerrorf9c373279db5c01888eMon, 09 Sep 2019 20:06:09 GMT\"0x8D7356127D9F25C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:09 GMT", + "x-ms-client-request-id" : "07dadd65-6150-48c1-8342-1cd971d284fc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopyerror0blobapitestcopyerrorf9c373279db5c01888e?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" : "fe4d22eb-13b8-441e-a371-7fcebb2e48b0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca9a0f-301e-0042-804a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:09 GMT", + "x-ms-client-request-id" : "fe4d22eb-13b8-441e-a371-7fcebb2e48b0" + }, + "Exception" : null + } ], + "variables" : [ "jtccopyerror0blobapitestcopyerrorf9c373279db5c01888e", "javablobcopyerror1blobapitestcopyerrorf9c38786cac4b813", "javablobcopyerror2blobapitestcopyerrorf9c1786982442841" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopymetadata[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopymetadata[0].json new file mode 100644 index 000000000000..fdd2b1e5a51d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopymetadata[0].json @@ -0,0 +1,150 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadatae8e73700344f587a?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" : "51ab16b8-0345-4bf0-9d85-9433cb3b2770" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611D229DB6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca87ac-301e-0042-5e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:51 GMT", + "x-ms-client-request-id" : "51ab16b8-0345-4bf0-9d85-9433cb3b2770" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadatae8e73700344f587a/javablobcopymetadata1blobapitestcopymetadatae8e45537111fb", + "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" : "ca04433c-d7ec-4c6f-b56d-56222756c7bb", + "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 20:05:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:51 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611D2F7796\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca87c3-301e-0042-7049-67cbbf000000", + "x-ms-client-request-id" : "ca04433c-d7ec-4c6f-b56d-56222756c7bb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadatae8e73700344f587a/javablobcopymetadata2blobapitestcopymetadatae8e2341504296", + "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" : "d3394700-3221-429f-a87f-c0ef58daf14c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "22f22691-dc05-43b7-aef3-3d6dc5e00924", + "ETag" : "\"0x8D735611D3CC086\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca87de-301e-0042-0949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:51 GMT", + "x-ms-client-request-id" : "d3394700-3221-429f-a87f-c0ef58daf14c" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadatae8e73700344f587a/javablobcopymetadata2blobapitestcopymetadatae8e2341504296", + "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" : "8b94ac94-3460-4c93-83da-0b7bf7bab0a1" + }, + "Response" : { + "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 20:05:51 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "BlockBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:51 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca87f9-301e-0042-2249-67cbbf000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "22f22691-dc05-43b7-aef3-3d6dc5e00924", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadatae8e73700344f587a/javablobcopymetadata1blobapitestcopymetadatae8e45537111fb", + "x-ms-copy-progress" : "7/7", + "Date" : "Mon, 09 Sep 2019 20:05:51 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:05:51 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D735611D3CC086\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "8b94ac94-3460-4c93-83da-0b7bf7bab0a1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopymetadata&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" : "1a01a848-4f80-4a0a-aba9-d086bf5b09fa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca8808-301e-0042-3049-67cbbf000000", + "Body" : "jtccopymetadatajtccopymetadata0blobapitestcopymetadatae8e73700344f587aMon, 09 Sep 2019 20:05:51 GMT\"0x8D735611D229DB6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:51 GMT", + "x-ms-client-request-id" : "1a01a848-4f80-4a0a-aba9-d086bf5b09fa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadatae8e73700344f587a?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" : "c29a20b9-43c8-4315-8971-4266460d7bf5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8826-301e-0042-4d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:51 GMT", + "x-ms-client-request-id" : "c29a20b9-43c8-4315-8971-4266460d7bf5" + }, + "Exception" : null + } ], + "variables" : [ "jtccopymetadata0blobapitestcopymetadatae8e73700344f587a", "javablobcopymetadata1blobapitestcopymetadatae8e45537111fb", "javablobcopymetadata2blobapitestcopymetadatae8e2341504296" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopymetadata[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopymetadata[1].json new file mode 100644 index 000000000000..7416188121b2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopymetadata[1].json @@ -0,0 +1,152 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadata824370738fde4685?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" : "92bc6b26-8064-4531-aeb7-bf79a573151a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611D72049D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca883a-301e-0042-6149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:51 GMT", + "x-ms-client-request-id" : "92bc6b26-8064-4531-aeb7-bf79a573151a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadata824370738fde4685/javablobcopymetadata1blobapitestcopymetadata82435096ed5cc", + "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" : "8c9a7209-7031-4461-b208-e3a903f8ea5e", + "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 20:05:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:51 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611D7F2CB5\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca885c-301e-0042-8049-67cbbf000000", + "x-ms-client-request-id" : "8c9a7209-7031-4461-b208-e3a903f8ea5e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadata824370738fde4685/javablobcopymetadata2blobapitestcopymetadata8243109000725", + "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" : "4e6d828e-884e-47cc-a82d-c417adfde555" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "9cdfe3b7-f2e9-4aa1-a293-9c6a602c46f8", + "ETag" : "\"0x8D735611D8D8737\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca886e-301e-0042-1249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:51 GMT", + "x-ms-client-request-id" : "4e6d828e-884e-47cc-a82d-c417adfde555" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadata824370738fde4685/javablobcopymetadata2blobapitestcopymetadata8243109000725", + "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" : "9b5b8d35-ec4a-4001-830f-789a9cabaad6" + }, + "Response" : { + "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 20:05:52 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "BlockBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:52 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca8888-301e-0042-2c49-67cbbf000000", + "x-ms-meta-fizz" : "buzz", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "9cdfe3b7-f2e9-4aa1-a293-9c6a602c46f8", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadata824370738fde4685/javablobcopymetadata1blobapitestcopymetadata82435096ed5cc", + "x-ms-copy-progress" : "7/7", + "Date" : "Mon, 09 Sep 2019 20:05:51 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "x-ms-meta-foo" : "bar", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:05:52 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D735611D8D8737\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "9b5b8d35-ec4a-4001-830f-789a9cabaad6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopymetadata&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" : "f9a06c8a-d0b1-4da3-b0c5-582fdc367a9a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca88a2-301e-0042-4549-67cbbf000000", + "Body" : "jtccopymetadatajtccopymetadata0blobapitestcopymetadata824370738fde4685Mon, 09 Sep 2019 20:05:51 GMT\"0x8D735611D72049D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:52 GMT", + "x-ms-client-request-id" : "f9a06c8a-d0b1-4da3-b0c5-582fdc367a9a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopymetadata0blobapitestcopymetadata824370738fde4685?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" : "8e93624f-8c83-4953-b68c-f52fe7cb59b9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca88b9-301e-0042-5949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:52 GMT", + "x-ms-client-request-id" : "8e93624f-8c83-4953-b68c-f52fe7cb59b9" + }, + "Exception" : null + } ], + "variables" : [ "jtccopymetadata0blobapitestcopymetadata824370738fde4685", "javablobcopymetadata1blobapitestcopymetadata82435096ed5cc", "javablobcopymetadata2blobapitestcopymetadata8243109000725" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopymin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopymin.json new file mode 100644 index 000000000000..d42d52d06c0e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopymin.json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopymin0blobapitestcopymina437432465c8e347bab44?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" : "7896dee0-4ba6-42c8-bd9c-f4629f2337ed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611CE11C12\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca871a-301e-0042-5c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:50 GMT", + "x-ms-client-request-id" : "7896dee0-4ba6-42c8-bd9c-f4629f2337ed" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopymin0blobapitestcopymina437432465c8e347bab44/javablobcopymin1blobapitestcopymina433640487ecc675b5", + "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" : "144503c5-b3c9-42f9-8227-ac5cd677fccd", + "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 20:05:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:50 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611CEDCEC2\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca873f-301e-0042-7d49-67cbbf000000", + "x-ms-client-request-id" : "144503c5-b3c9-42f9-8227-ac5cd677fccd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopymin0blobapitestcopymina437432465c8e347bab44/javablobcopymin1blobapitestcopymina433640487ecc675b5", + "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" : "9130f2bd-ccb3-4f9c-a733-65487e5ad968" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "7cb8fca7-c2c5-4be8-b379-5d85ec016ebb", + "ETag" : "\"0x8D735611CFAC971\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8759-301e-0042-1349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:50 GMT", + "x-ms-client-request-id" : "9130f2bd-ccb3-4f9c-a733-65487e5ad968" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopymin&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" : "7ea87522-42ad-429d-945e-9339c302c385" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca877c-301e-0042-3449-67cbbf000000", + "Body" : "jtccopyminjtccopymin0blobapitestcopymina437432465c8e347bab44Mon, 09 Sep 2019 20:05:50 GMT\"0x8D735611CE11C12\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:50 GMT", + "x-ms-client-request-id" : "7ea87522-42ad-429d-945e-9339c302c385", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopymin0blobapitestcopymina437432465c8e347bab44?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" : "dbbc6d3e-5c18-4fc2-9883-8231736e05bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8791-301e-0042-4549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:51 GMT", + "x-ms-client-request-id" : "dbbc6d3e-5c18-4fc2-9883-8231736e05bf" + }, + "Exception" : null + } ], + "variables" : [ "jtccopymin0blobapitestcopymina437432465c8e347bab44", "javablobcopymin1blobapitestcopymina433640487ecc675b5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[0].json new file mode 100644 index 000000000000..39f50d44fbc1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[0].json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac6bf623094de3f5cf?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" : "babe4471-86c9-42af-9f2f-45b798524837" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611DC27D0D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca88d6-301e-0042-7649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:52 GMT", + "x-ms-client-request-id" : "babe4471-86c9-42af-9f2f-45b798524837" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac6bf623094de3f5cf/javablobcopysourceac1blobapitestcopysourceac6bf800520f8b4", + "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" : "dc37ad8e-b297-49b4-9e66-e0cca44ca5d2", + "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 20:05:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:52 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611DD10525\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca88eb-301e-0042-0a49-67cbbf000000", + "x-ms-client-request-id" : "dc37ad8e-b297-49b4-9e66-e0cca44ca5d2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac6bf623094de3f5cf/javablobcopysourceac2blobapitestcopysourceac6bf4356273ce3", + "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" : "cffc70c4-71f4-4bca-a8d3-8953430c8ed6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "0e0d85d7-8c95-4e29-bb60-196de75f26b4", + "ETag" : "\"0x8D735611DDE4DFE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca88f9-301e-0042-1749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:52 GMT", + "x-ms-client-request-id" : "cffc70c4-71f4-4bca-a8d3-8953430c8ed6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopysourceac&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" : "b9357d68-05d9-4559-b745-c6799b1209e8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca890e-301e-0042-2c49-67cbbf000000", + "Body" : "jtccopysourceacjtccopysourceac0blobapitestcopysourceac6bf623094de3f5cfMon, 09 Sep 2019 20:05:52 GMT\"0x8D735611DC27D0D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:52 GMT", + "x-ms-client-request-id" : "b9357d68-05d9-4559-b745-c6799b1209e8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac6bf623094de3f5cf?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" : "cf138ad7-b075-4d1d-943f-1a9b4c46615b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8924-301e-0042-4049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:52 GMT", + "x-ms-client-request-id" : "cf138ad7-b075-4d1d-943f-1a9b4c46615b" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceac0blobapitestcopysourceac6bf623094de3f5cf", "javablobcopysourceac1blobapitestcopysourceac6bf800520f8b4", "javablobcopysourceac2blobapitestcopysourceac6bf4356273ce3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[1].json new file mode 100644 index 000000000000..757e1a3d186e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[1].json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceacf2246632514bb4fb?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" : "fe729fff-bc14-4274-a1ec-8aea4f9665c4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611E06BE54\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca893b-301e-0042-5649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:52 GMT", + "x-ms-client-request-id" : "fe729fff-bc14-4274-a1ec-8aea4f9665c4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceacf2246632514bb4fb/javablobcopysourceac1blobapitestcopysourceacf22588555219b", + "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" : "e1493335-47d6-40b4-8c93-e82dfa7bd7ba", + "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 20:05:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:52 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611E16A64F\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca8962-301e-0042-7649-67cbbf000000", + "x-ms-client-request-id" : "e1493335-47d6-40b4-8c93-e82dfa7bd7ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceacf2246632514bb4fb/javablobcopysourceac2blobapitestcopysourceacf2281719fc44a", + "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" : "4dc95cca-86a6-425f-afda-0fba94bde0ad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "6d6c209b-14e2-46ca-b5c9-0d0f97c61b29", + "ETag" : "\"0x8D735611E24646F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8977-301e-0042-0849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:52 GMT", + "x-ms-client-request-id" : "4dc95cca-86a6-425f-afda-0fba94bde0ad" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopysourceac&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" : "796c4ea5-6e29-4ffa-84ff-39335f814873" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca899a-301e-0042-2749-67cbbf000000", + "Body" : "jtccopysourceacjtccopysourceac0blobapitestcopysourceacf2246632514bb4fbMon, 09 Sep 2019 20:05:52 GMT\"0x8D735611E06BE54\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:52 GMT", + "x-ms-client-request-id" : "796c4ea5-6e29-4ffa-84ff-39335f814873", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceacf2246632514bb4fb?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" : "5b2bbd17-39e1-4c28-ae28-7566da5e57fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca89a9-301e-0042-3649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:53 GMT", + "x-ms-client-request-id" : "5b2bbd17-39e1-4c28-ae28-7566da5e57fc" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceac0blobapitestcopysourceacf2246632514bb4fb", "javablobcopysourceac1blobapitestcopysourceacf22588555219b", "javablobcopysourceac2blobapitestcopysourceacf2281719fc44a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[2].json new file mode 100644 index 000000000000..8d6ba33c11d0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[2].json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac4f305078369cad2b?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" : "4b01ddf8-cbcb-4862-a82a-74fb0e526de7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611E4A6344\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca89c4-301e-0042-4f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:53 GMT", + "x-ms-client-request-id" : "4b01ddf8-cbcb-4862-a82a-74fb0e526de7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac4f305078369cad2b/javablobcopysourceac1blobapitestcopysourceac4f3667096f866", + "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" : "42dcf382-6fb2-448b-b077-f8b542493c10", + "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 20:05:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611E57B2C7\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca89ee-301e-0042-7849-67cbbf000000", + "x-ms-client-request-id" : "42dcf382-6fb2-448b-b077-f8b542493c10" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac4f305078369cad2b/javablobcopysourceac2blobapitestcopysourceac4f3525492c20d", + "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" : "29bf4e6a-ae71-4780-9d85-12596d18f28e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "d8596fce-9635-4c41-84cf-cf0efbe3d533", + "ETag" : "\"0x8D735611E64FBC3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8a0b-301e-0042-1349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:53 GMT", + "x-ms-client-request-id" : "29bf4e6a-ae71-4780-9d85-12596d18f28e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopysourceac&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" : "3eb3230b-f831-44e0-ad23-8d2b5e5a295c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca8a25-301e-0042-2d49-67cbbf000000", + "Body" : "jtccopysourceacjtccopysourceac0blobapitestcopysourceac4f305078369cad2bMon, 09 Sep 2019 20:05:53 GMT\"0x8D735611E4A6344\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:53 GMT", + "x-ms-client-request-id" : "3eb3230b-f831-44e0-ad23-8d2b5e5a295c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac4f305078369cad2b?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" : "4b144e71-b103-4e3d-ba56-35c28dc887bb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8a45-301e-0042-4b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:53 GMT", + "x-ms-client-request-id" : "4b144e71-b103-4e3d-ba56-35c28dc887bb" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceac0blobapitestcopysourceac4f305078369cad2b", "javablobcopysourceac1blobapitestcopysourceac4f3667096f866", "javablobcopysourceac2blobapitestcopysourceac4f3525492c20d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[3].json new file mode 100644 index 000000000000..5fbe0ad82890 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[3].json @@ -0,0 +1,145 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac1a978659967c8580?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" : "88c34efc-38a0-4ac4-86dd-e07f81ead188" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611E8F67F5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca8a5d-301e-0042-6349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:53 GMT", + "x-ms-client-request-id" : "88c34efc-38a0-4ac4-86dd-e07f81ead188" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac1a978659967c8580/javablobcopysourceac1blobapitestcopysourceac1a984068aa384", + "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" : "4ddf1e19-7143-452c-ad3b-826cf07a4842", + "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 20:05:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611E9DC938\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca8a71-301e-0042-7549-67cbbf000000", + "x-ms-client-request-id" : "4ddf1e19-7143-452c-ad3b-826cf07a4842" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac1a978659967c8580/javablobcopysourceac1blobapitestcopysourceac1a984068aa384", + "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" : "d9f1da31-9858-49d6-9d67-4995562905b3" + }, + "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 20:05:53 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:05:53 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735611E9DC938\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:53 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca8a82-301e-0042-0449-67cbbf000000", + "x-ms-client-request-id" : "d9f1da31-9858-49d6-9d67-4995562905b3", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac1a978659967c8580/javablobcopysourceac2blobapitestcopysourceac1a9943818dca2", + "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" : "756a83d6-0de8-4a38-8e19-32de9a11e1ea" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "1240eb5b-11a6-4580-a001-9dcd0702aec9", + "ETag" : "\"0x8D735611EB85AF2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8a92-301e-0042-1449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:53 GMT", + "x-ms-client-request-id" : "756a83d6-0de8-4a38-8e19-32de9a11e1ea" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopysourceac&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" : "ec8379e8-7bbc-4348-9924-71adac1d2773" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca8aaa-301e-0042-2b49-67cbbf000000", + "Body" : "jtccopysourceacjtccopysourceac0blobapitestcopysourceac1a978659967c8580Mon, 09 Sep 2019 20:05:53 GMT\"0x8D735611E8F67F5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:53 GMT", + "x-ms-client-request-id" : "ec8379e8-7bbc-4348-9924-71adac1d2773", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceac1a978659967c8580?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" : "cab09a03-66fe-4d00-bd7b-72608508ece5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8ac0-301e-0042-4149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:53 GMT", + "x-ms-client-request-id" : "cab09a03-66fe-4d00-bd7b-72608508ece5" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceac0blobapitestcopysourceac1a978659967c8580", "javablobcopysourceac1blobapitestcopysourceac1a984068aa384", "javablobcopysourceac2blobapitestcopysourceac1a9943818dca2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[4].json new file mode 100644 index 000000000000..7e2f6b010553 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceac[4].json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceaca9946973ac70bb4d?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" : "e1b59fa9-9cc9-46d6-a0b6-e04c55044969" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611EDE80A0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca8acc-301e-0042-4c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:54 GMT", + "x-ms-client-request-id" : "e1b59fa9-9cc9-46d6-a0b6-e04c55044969" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceaca9946973ac70bb4d/javablobcopysourceac1blobapitestcopysourceaca9953699afe0c", + "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" : "c605fb82-7aeb-425b-9a14-e88e17b1d76a", + "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 20:05:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:54 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611EEB0CEE\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca8ae1-301e-0042-5f49-67cbbf000000", + "x-ms-client-request-id" : "c605fb82-7aeb-425b-9a14-e88e17b1d76a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceaca9946973ac70bb4d/javablobcopysourceac2blobapitestcopysourceaca9934798a9db3", + "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" : "46d834cd-3784-4d9f-9e0f-ef0bddb69f63" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "1698d253-67a7-4333-b7f2-f4e3a7cedba2", + "ETag" : "\"0x8D735611EF80798\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8af6-301e-0042-7449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:54 GMT", + "x-ms-client-request-id" : "46d834cd-3784-4d9f-9e0f-ef0bddb69f63" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopysourceac&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" : "a9547be5-b8f1-4703-8e16-e7d897af243e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca8b0c-301e-0042-0749-67cbbf000000", + "Body" : "jtccopysourceacjtccopysourceac0blobapitestcopysourceaca9946973ac70bb4dMon, 09 Sep 2019 20:05:54 GMT\"0x8D735611EDE80A0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:54 GMT", + "x-ms-client-request-id" : "a9547be5-b8f1-4703-8e16-e7d897af243e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceac0blobapitestcopysourceaca9946973ac70bb4d?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" : "84200257-3571-4b70-b6fc-b40214540647" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8b22-301e-0042-1b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:54 GMT", + "x-ms-client-request-id" : "84200257-3571-4b70-b6fc-b40214540647" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceac0blobapitestcopysourceaca9946973ac70bb4d", "javablobcopysourceac1blobapitestcopysourceaca9953699afe0c", "javablobcopysourceac2blobapitestcopysourceaca9934798a9db3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceacfail[0].json new file mode 100644 index 000000000000..563448410750 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceacfail[0].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail157940675bb5?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" : "a6544e88-a5c8-42f0-83e1-89a83c59d416" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611F20778B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca8b35-301e-0042-2e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:54 GMT", + "x-ms-client-request-id" : "a6544e88-a5c8-42f0-83e1-89a83c59d416" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail157940675bb5/javablobcopysourceacfail1blobapitestcopysourceacfail157577178", + "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" : "d8aa900f-f878-4125-90fc-ad86428293c2", + "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 20:05:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:54 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611F2D521A\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca8b48-301e-0042-3e49-67cbbf000000", + "x-ms-client-request-id" : "d8aa900f-f878-4125-90fc-ad86428293c2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail157940675bb5/javablobcopysourceacfail2blobapitestcopysourceacfail15728923f", + "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" : "5794324e-f255-487b-8f96-93c6bd3e4ac7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "SourceConditionNotMet", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca8b54-301e-0042-4a49-67cbbf000000", + "Body" : "SourceConditionNotMetThe source condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca8b54-301e-0042-4a49-67cbbf000000\nTime:2019-09-09T20:05:54.8257034Z", + "Date" : "Mon, 09 Sep 2019 20:05:54 GMT", + "x-ms-client-request-id" : "5794324e-f255-487b-8f96-93c6bd3e4ac7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopysourceacfail&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" : "7f0248fe-ea1d-4f85-8db7-2c3f02b78a42" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca8b68-301e-0042-5e49-67cbbf000000", + "Body" : "jtccopysourceacfailjtccopysourceacfail0blobapitestcopysourceacfail157940675bb5Mon, 09 Sep 2019 20:05:54 GMT\"0x8D735611F20778B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:54 GMT", + "x-ms-client-request-id" : "7f0248fe-ea1d-4f85-8db7-2c3f02b78a42", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail157940675bb5?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" : "f3afb2f3-4c81-410d-bc02-a4442e838654" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8b80-301e-0042-7349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:54 GMT", + "x-ms-client-request-id" : "f3afb2f3-4c81-410d-bc02-a4442e838654" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceacfail0blobapitestcopysourceacfail157940675bb5", "javablobcopysourceacfail1blobapitestcopysourceacfail157577178", "javablobcopysourceacfail2blobapitestcopysourceacfail15728923f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceacfail[1].json new file mode 100644 index 000000000000..d523155d3505 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceacfail[1].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfaile1182162a3c6?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" : "b90b239e-5808-4537-97e5-dcac5a4e91c1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611F62BCA5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca8ba8-301e-0042-1849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:54 GMT", + "x-ms-client-request-id" : "b90b239e-5808-4537-97e5-dcac5a4e91c1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfaile1182162a3c6/javablobcopysourceacfail1blobapitestcopysourceacfaile11232324", + "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" : "c6b2c58a-89e6-4be9-bb83-36f932355d44", + "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 20:05:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:55 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611F6FBE65\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca8bc4-301e-0042-3049-67cbbf000000", + "x-ms-client-request-id" : "c6b2c58a-89e6-4be9-bb83-36f932355d44" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfaile1182162a3c6/javablobcopysourceacfail2blobapitestcopysourceacfaile11622626", + "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" : "21749a00-0886-4ed8-8cf4-d73c70712425" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "SourceConditionNotMet", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca8bd7-301e-0042-4149-67cbbf000000", + "Body" : "SourceConditionNotMetThe source condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca8bd7-301e-0042-4149-67cbbf000000\nTime:2019-09-09T20:05:55.2590091Z", + "Date" : "Mon, 09 Sep 2019 20:05:55 GMT", + "x-ms-client-request-id" : "21749a00-0886-4ed8-8cf4-d73c70712425", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopysourceacfail&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" : "90118bb0-9ff1-4201-813f-6d1e062e28a7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca8beb-301e-0042-5549-67cbbf000000", + "Body" : "jtccopysourceacfailjtccopysourceacfail0blobapitestcopysourceacfaile1182162a3c6Mon, 09 Sep 2019 20:05:55 GMT\"0x8D735611F62BCA5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:55 GMT", + "x-ms-client-request-id" : "90118bb0-9ff1-4201-813f-6d1e062e28a7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfaile1182162a3c6?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" : "5ce5562c-96e4-4839-ae81-cbcb3b983778" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8bfd-301e-0042-6449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:55 GMT", + "x-ms-client-request-id" : "5ce5562c-96e4-4839-ae81-cbcb3b983778" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceacfail0blobapitestcopysourceacfaile1182162a3c6", "javablobcopysourceacfail1blobapitestcopysourceacfaile11232324", "javablobcopysourceacfail2blobapitestcopysourceacfaile11622626" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceacfail[2].json new file mode 100644 index 000000000000..68bd67b3554d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceacfail[2].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfailf40204091201?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" : "3c2dad5c-26d4-4751-8808-41fa141e0c5a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611FA59E1B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca8c0f-301e-0042-7549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:55 GMT", + "x-ms-client-request-id" : "3c2dad5c-26d4-4751-8808-41fa141e0c5a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfailf40204091201/javablobcopysourceacfail1blobapitestcopysourceacfailf40362693", + "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" : "4b16a554-9428-4bfe-b781-ef28702d4aef", + "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 20:05:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:55 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611FB3FFC4\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca8c23-301e-0042-0849-67cbbf000000", + "x-ms-client-request-id" : "4b16a554-9428-4bfe-b781-ef28702d4aef" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfailf40204091201/javablobcopysourceacfail2blobapitestcopysourceacfailf4055998a", + "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" : "1c7c2816-0623-4cf3-9803-0570ab2145a0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "SourceConditionNotMet", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca8c3b-301e-0042-1e49-67cbbf000000", + "Body" : "SourceConditionNotMetThe source condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca8c3b-301e-0042-1e49-67cbbf000000\nTime:2019-09-09T20:05:55.7083265Z", + "Date" : "Mon, 09 Sep 2019 20:05:55 GMT", + "x-ms-client-request-id" : "1c7c2816-0623-4cf3-9803-0570ab2145a0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopysourceacfail&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" : "d9a2f729-1c31-4efb-8228-f6a113b9639c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca8c48-301e-0042-2b49-67cbbf000000", + "Body" : "jtccopysourceacfailjtccopysourceacfail0blobapitestcopysourceacfailf40204091201Mon, 09 Sep 2019 20:05:55 GMT\"0x8D735611FA59E1B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:55 GMT", + "x-ms-client-request-id" : "d9a2f729-1c31-4efb-8228-f6a113b9639c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfailf40204091201?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" : "df7a4b5a-4e0b-4700-9607-cbfd4448948b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8c55-301e-0042-3849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:55 GMT", + "x-ms-client-request-id" : "df7a4b5a-4e0b-4700-9607-cbfd4448948b" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceacfail0blobapitestcopysourceacfailf40204091201", "javablobcopysourceacfail1blobapitestcopysourceacfailf40362693", "javablobcopysourceacfail2blobapitestcopysourceacfailf4055998a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceacfail[3].json new file mode 100644 index 000000000000..4f2dc52366bb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopysourceacfail[3].json @@ -0,0 +1,144 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail7736235594e3?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" : "94fc6f73-4d39-4339-94ac-52dc9d413db2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611FE99135\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca8c6c-301e-0042-4f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:55 GMT", + "x-ms-client-request-id" : "94fc6f73-4d39-4339-94ac-52dc9d413db2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail7736235594e3/javablobcopysourceacfail1blobapitestcopysourceacfail773147717", + "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" : "1e1b16d8-49fe-4350-8e79-0f5bd6cd23cb", + "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 20:05:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:55 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611FF7CBE6\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca8c86-301e-0042-6749-67cbbf000000", + "x-ms-client-request-id" : "1e1b16d8-49fe-4350-8e79-0f5bd6cd23cb" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail7736235594e3/javablobcopysourceacfail1blobapitestcopysourceacfail773147717", + "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" : "7aed243e-5c4b-40e9-a8b4-1ab3280eda9c" + }, + "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 20:05:56 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:05:55 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735611FF7CBE6\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:56 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca8ca3-301e-0042-0249-67cbbf000000", + "x-ms-client-request-id" : "7aed243e-5c4b-40e9-a8b4-1ab3280eda9c", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail7736235594e3/javablobcopysourceacfail2blobapitestcopysourceacfail773303549", + "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" : "357e27bf-deb2-492d-890a-3ac011c4df88" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "SourceConditionNotMet", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca8cca-301e-0042-2949-67cbbf000000", + "Body" : "SourceConditionNotMetThe source condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca8cca-301e-0042-2949-67cbbf000000\nTime:2019-09-09T20:05:56.2346981Z", + "Date" : "Mon, 09 Sep 2019 20:05:56 GMT", + "x-ms-client-request-id" : "357e27bf-deb2-492d-890a-3ac011c4df88", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopysourceacfail&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" : "b7c547d1-b996-4977-a70e-ca8af581fe60" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca8cf0-301e-0042-4a49-67cbbf000000", + "Body" : "jtccopysourceacfailjtccopysourceacfail0blobapitestcopysourceacfail7736235594e3Mon, 09 Sep 2019 20:05:55 GMT\"0x8D735611FE99135\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:56 GMT", + "x-ms-client-request-id" : "b7c547d1-b996-4977-a70e-ca8af581fe60", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopysourceacfail0blobapitestcopysourceacfail7736235594e3?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" : "7b71c373-aba9-4b0c-a978-b8e5e756d7ee" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8cfb-301e-0042-5549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:56 GMT", + "x-ms-client-request-id" : "7b71c373-aba9-4b0c-a978-b8e5e756d7ee" + }, + "Exception" : null + } ], + "variables" : [ "jtccopysourceacfail0blobapitestcopysourceacfail7736235594e3", "javablobcopysourceacfail1blobapitestcopysourceacfail773147717", "javablobcopysourceacfail2blobapitestcopysourceacfail773303549" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopywithtier[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopywithtier[0].json new file mode 100644 index 000000000000..cbb8c8643f08 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopywithtier[0].json @@ -0,0 +1,176 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopywithtier0blobapitestcopywithtiera19026698e686eda?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" : "61d9829b-14f3-4731-a125-fe15c0972983" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613E38A53A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cac007-301e-0042-0b4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:46 GMT", + "x-ms-client-request-id" : "61d9829b-14f3-4731-a125-fe15c0972983" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopywithtier0blobapitestcopywithtiera19026698e686eda/javablobcopywithtier1blobapitestcopywithtiera19302403369d", + "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" : "cecc9c74-a7c1-47f2-b5ed-4c56645b716c", + "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 20:06:46 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:46 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613E45B1CC\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cac020-301e-0042-204a-67cbbf000000", + "x-ms-client-request-id" : "cecc9c74-a7c1-47f2-b5ed-4c56645b716c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopywithtier0blobapitestcopywithtiera19026698e686eda/javablobcopywithtier2blobapitestcopywithtiera1972302b7291", + "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" : "cb70fdd0-cacb-424e-a69c-c64341c5855e", + "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 20:06:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:46 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613E54336B\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cac02e-301e-0042-2e4a-67cbbf000000", + "x-ms-client-request-id" : "cb70fdd0-cacb-424e-a69c-c64341c5855e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopywithtier0blobapitestcopywithtiera19026698e686eda/javablobcopywithtier3blobapitestcopywithtiera1922195f8945", + "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" : "cc0c81d9-cdec-4c06-8f1e-cd483ccadd3c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "b03e061a-9ca1-428d-9dea-fd0dafd85904", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:47 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Mon, 09 Sep 2019 20:06:46 GMT", + "ETag" : "\"0x8D735613E65B0D0\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "c5cac042-301e-0042-414a-67cbbf000000", + "x-ms-client-request-id" : "cc0c81d9-cdec-4c06-8f1e-cd483ccadd3c" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopywithtier0blobapitestcopywithtiera19026698e686eda/javablobcopywithtier3blobapitestcopywithtiera1922195f8945", + "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" : "59b6df22-c2de-4978-85ac-46bc59609c77" + }, + "Response" : { + "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 20:06:47 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Mon, 09 Sep 2019 20:06:47 GMT", + "StatusCode" : "200", + "x-ms-blob-type" : "BlockBlob", + "x-ms-access-tier" : "Cool", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:47 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5cac063-301e-0042-5d4a-67cbbf000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "b03e061a-9ca1-428d-9dea-fd0dafd85904", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtccopywithtier0blobapitestcopywithtiera19026698e686eda/javablobcopywithtier2blobapitestcopywithtiera1972302b7291?sv=2019-02-02&se=2019-09-09T21%3A06%3A47Z&sr=b&sp=r&sig=Cb2HA6qz4%2Fue%2Bj3Gj%2Fg2ow2%2FHsAdISuLZWjifTmAa%2F8%3D", + "x-ms-copy-progress" : "7/7", + "Date" : "Mon, 09 Sep 2019 20:06:46 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:06:47 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D735613E65B0D0\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "59b6df22-c2de-4978-85ac-46bc59609c77" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopywithtier&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" : "d1072d29-d49b-459c-abd8-752a4efcc7b4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cac074-301e-0042-6d4a-67cbbf000000", + "Body" : "jtccopywithtierjtccopywithtier0blobapitestcopywithtiera19026698e686edaMon, 09 Sep 2019 20:06:46 GMT\"0x8D735613E38A53A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:47 GMT", + "x-ms-client-request-id" : "d1072d29-d49b-459c-abd8-752a4efcc7b4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopywithtier0blobapitestcopywithtiera19026698e686eda?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" : "cb8887db-3b12-49e7-8f10-e81e9df1a9ed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cac089-301e-0042-7f4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:47 GMT", + "x-ms-client-request-id" : "cb8887db-3b12-49e7-8f10-e81e9df1a9ed" + }, + "Exception" : null + } ], + "variables" : [ "jtccopywithtier0blobapitestcopywithtiera19026698e686eda", "javablobcopywithtier1blobapitestcopywithtiera19302403369d", "javablobcopywithtier2blobapitestcopywithtiera1972302b7291", "javablobcopywithtier3blobapitestcopywithtiera1922195f8945" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopywithtier[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopywithtier[1].json new file mode 100644 index 000000000000..505dbeba560f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestcopywithtier[1].json @@ -0,0 +1,176 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopywithtier0blobapitestcopywithtiere5246890214a5bf5?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" : "a5be3794-39de-4823-abac-25ad6b050cf3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613E9BBEB5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cac09a-301e-0042-104a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:47 GMT", + "x-ms-client-request-id" : "a5be3794-39de-4823-abac-25ad6b050cf3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopywithtier0blobapitestcopywithtiere5246890214a5bf5/javablobcopywithtier1blobapitestcopywithtiere5274908e3f4c", + "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" : "c0f91954-c626-4579-b35a-efd26e7e426e", + "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 20:06:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:47 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613EA87D3B\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cac0ac-301e-0042-214a-67cbbf000000", + "x-ms-client-request-id" : "c0f91954-c626-4579-b35a-efd26e7e426e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopywithtier0blobapitestcopywithtiere5246890214a5bf5/javablobcopywithtier2blobapitestcopywithtiere5221856b2e5c", + "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" : "cfb5c212-744c-4e67-8d62-179d91c21bd6", + "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 20:06:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:47 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613EB59EFF\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cac0c3-301e-0042-364a-67cbbf000000", + "x-ms-client-request-id" : "cfb5c212-744c-4e67-8d62-179d91c21bd6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopywithtier0blobapitestcopywithtiere5246890214a5bf5/javablobcopywithtier3blobapitestcopywithtiere52433422ed45", + "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" : "d52983ce-6dda-4821-b4ea-e034d3b32316" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "6209b6e0-1ee1-4272-9ec0-1b06d6c0556f", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:47 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Mon, 09 Sep 2019 20:06:47 GMT", + "ETag" : "\"0x8D735613EC3E769\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "c5cac0dd-301e-0042-504a-67cbbf000000", + "x-ms-client-request-id" : "d52983ce-6dda-4821-b4ea-e034d3b32316" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopywithtier0blobapitestcopywithtiere5246890214a5bf5/javablobcopywithtier3blobapitestcopywithtiere52433422ed45", + "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" : "e8aca95a-629d-4917-a440-038044e5255c" + }, + "Response" : { + "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 20:06:47 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Mon, 09 Sep 2019 20:06:47 GMT", + "StatusCode" : "200", + "x-ms-blob-type" : "BlockBlob", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:47 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5cac0f9-301e-0042-6c4a-67cbbf000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "6209b6e0-1ee1-4272-9ec0-1b06d6c0556f", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtccopywithtier0blobapitestcopywithtiere5246890214a5bf5/javablobcopywithtier2blobapitestcopywithtiere5221856b2e5c?sv=2019-02-02&se=2019-09-09T21%3A06%3A47Z&sr=b&sp=r&sig=VW8ObC1plTSNg3lk68kY1okx6MeDNlTeRDEP6LVfJVc%3D", + "x-ms-copy-progress" : "7/7", + "Date" : "Mon, 09 Sep 2019 20:06:47 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:06:47 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D735613EC3E769\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "e8aca95a-629d-4917-a440-038044e5255c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccopywithtier&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" : "f4146215-6901-4492-95f9-ca8123a34447" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cac109-301e-0042-7a4a-67cbbf000000", + "Body" : "jtccopywithtierjtccopywithtier0blobapitestcopywithtiere5246890214a5bf5Mon, 09 Sep 2019 20:06:47 GMT\"0x8D735613E9BBEB5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:47 GMT", + "x-ms-client-request-id" : "f4146215-6901-4492-95f9-ca8123a34447", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccopywithtier0blobapitestcopywithtiere5246890214a5bf5?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" : "1cf06532-44b2-492d-91cb-b95ec6b5788c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cac11a-301e-0042-0a4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:47 GMT", + "x-ms-client-request-id" : "1cf06532-44b2-492d-91cb-b95ec6b5788c" + }, + "Exception" : null + } ], + "variables" : [ "jtccopywithtier0blobapitestcopywithtiere5246890214a5bf5", "javablobcopywithtier1blobapitestcopywithtiere5274908e3f4c", "javablobcopywithtier2blobapitestcopywithtiere5221856b2e5c", "javablobcopywithtier3blobapitestcopywithtiere52433422ed45" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdelete.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdelete.json new file mode 100644 index 000000000000..666dfa5dbb60 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdelete.json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdelete0blobapitestdelete66b98231dc5a980ce64e43?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" : "672e45dd-ec25-44dd-a2a2-ac8ed4addb56" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613142917C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caa9db-301e-0042-434a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:24 GMT", + "x-ms-client-request-id" : "672e45dd-ec25-44dd-a2a2-ac8ed4addb56" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdelete0blobapitestdelete66b98231dc5a980ce64e43/javablobdelete1blobapitestdelete66b900389d7941117ad", + "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" : "0c3c3b4a-33e3-4153-9ea2-f75462bdd5c7", + "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 20:06:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613150AB25\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa9ef-301e-0042-534a-67cbbf000000", + "x-ms-client-request-id" : "0c3c3b4a-33e3-4153-9ea2-f75462bdd5c7" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdelete0blobapitestdelete66b98231dc5a980ce64e43/javablobdelete1blobapitestdelete66b900389d7941117ad", + "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" : "ab23cccc-f42f-494f-b08f-4f1fc8b6375a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "true", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caaa05-301e-0042-654a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:25 GMT", + "x-ms-client-request-id" : "ab23cccc-f42f-494f-b08f-4f1fc8b6375a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdelete&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" : "2a6049db-ee67-4fae-ba6f-f99cad956aeb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caaa15-301e-0042-734a-67cbbf000000", + "Body" : "jtcdeletejtcdelete0blobapitestdelete66b98231dc5a980ce64e43Mon, 09 Sep 2019 20:06:25 GMT\"0x8D735613142917C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:25 GMT", + "x-ms-client-request-id" : "2a6049db-ee67-4fae-ba6f-f99cad956aeb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdelete0blobapitestdelete66b98231dc5a980ce64e43?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" : "b27c5046-ad26-4665-bb29-92f4038af666" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caaa22-301e-0042-804a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:25 GMT", + "x-ms-client-request-id" : "b27c5046-ad26-4665-bb29-92f4038af666" + }, + "Exception" : null + } ], + "variables" : [ "jtcdelete0blobapitestdelete66b98231dc5a980ce64e43", "javablobdelete1blobapitestdelete66b900389d7941117ad" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[0].json new file mode 100644 index 000000000000..d6074cc70f4d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[0].json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteaceb778701638b1a22652f?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" : "66a9ec3b-318c-4986-b991-37a09bc0ad4a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561329B0CC1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caac3f-301e-0042-5c4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:27 GMT", + "x-ms-client-request-id" : "66a9ec3b-318c-4986-b991-37a09bc0ad4a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteaceb778701638b1a22652f/javablobdeleteac1blobapitestdeleteaceb757668ef7458015", + "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" : "89e27aba-b8c1-4029-a66a-76749fc7eb61", + "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 20:06:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356132A83C58\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caac51-301e-0042-6c4a-67cbbf000000", + "x-ms-client-request-id" : "89e27aba-b8c1-4029-a66a-76749fc7eb61" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteaceb778701638b1a22652f/javablobdeleteac1blobapitestdeleteaceb757668ef7458015", + "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" : "0922f430-1470-4686-a1bd-be64f0331df1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "true", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caac73-301e-0042-0a4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:27 GMT", + "x-ms-client-request-id" : "0922f430-1470-4686-a1bd-be64f0331df1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeleteac&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" : "b0295ab5-2537-4487-8a7b-135404ed8c99" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caac88-301e-0042-1d4a-67cbbf000000", + "Body" : "jtcdeleteacjtcdeleteac0blobapitestdeleteaceb778701638b1a22652fMon, 09 Sep 2019 20:06:27 GMT\"0x8D73561329B0CC1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:27 GMT", + "x-ms-client-request-id" : "b0295ab5-2537-4487-8a7b-135404ed8c99", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteaceb778701638b1a22652f?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" : "1e778afb-c6d6-47c6-b1d3-6bd04a4aaf9f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caac9b-301e-0042-2f4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:27 GMT", + "x-ms-client-request-id" : "1e778afb-c6d6-47c6-b1d3-6bd04a4aaf9f" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0blobapitestdeleteaceb778701638b1a22652f", "javablobdeleteac1blobapitestdeleteaceb757668ef7458015" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[1].json new file mode 100644 index 000000000000..51e8c8cb84be --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[1].json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac88b876416a85c39a6ed8?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" : "b0b35a5e-c4a5-4bc6-95e0-319e9070f321" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356132DDEE33\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caacae-301e-0042-414a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:27 GMT", + "x-ms-client-request-id" : "b0b35a5e-c4a5-4bc6-95e0-319e9070f321" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac88b876416a85c39a6ed8/javablobdeleteac1blobapitestdeleteac88b28959b476ec51f", + "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" : "db33ec5a-eda9-4d2d-b109-d6910ec04829", + "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 20:06:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356132EBBA3E\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caaccc-301e-0042-5c4a-67cbbf000000", + "x-ms-client-request-id" : "db33ec5a-eda9-4d2d-b109-d6910ec04829" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac88b876416a85c39a6ed8/javablobdeleteac1blobapitestdeleteac88b28959b476ec51f", + "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" : "e0f525e1-95c1-42a8-a07c-5d561d0d14b9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "true", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caace5-301e-0042-744a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:27 GMT", + "x-ms-client-request-id" : "e0f525e1-95c1-42a8-a07c-5d561d0d14b9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeleteac&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" : "a130c206-6254-4c81-bf2c-61222a83382e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caacf9-301e-0042-074a-67cbbf000000", + "Body" : "jtcdeleteacjtcdeleteac0blobapitestdeleteac88b876416a85c39a6ed8Mon, 09 Sep 2019 20:06:27 GMT\"0x8D7356132DDEE33\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:27 GMT", + "x-ms-client-request-id" : "a130c206-6254-4c81-bf2c-61222a83382e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac88b876416a85c39a6ed8?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" : "f27e620e-6a8a-49ef-933a-796e4158e8b6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caad0e-301e-0042-194a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:27 GMT", + "x-ms-client-request-id" : "f27e620e-6a8a-49ef-933a-796e4158e8b6" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0blobapitestdeleteac88b876416a85c39a6ed8", "javablobdeleteac1blobapitestdeleteac88b28959b476ec51f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[2].json new file mode 100644 index 000000000000..54156487247c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[2].json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteaca9d93183607d836907fd?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" : "4ea5876c-9ffe-4677-aaf6-e9814d0f6b77" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561331FE51E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caad24-301e-0042-2d4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:27 GMT", + "x-ms-client-request-id" : "4ea5876c-9ffe-4677-aaf6-e9814d0f6b77" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteaca9d93183607d836907fd/javablobdeleteac1blobapitestdeleteaca9d12143cc5ea0d11", + "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" : "383bde1d-f628-4dae-9635-4a5e35f602ec", + "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 20:06:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561332DB141\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caad3a-301e-0042-414a-67cbbf000000", + "x-ms-client-request-id" : "383bde1d-f628-4dae-9635-4a5e35f602ec" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteaca9d93183607d836907fd/javablobdeleteac1blobapitestdeleteaca9d12143cc5ea0d11", + "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" : "3c2e3329-87f2-44db-9699-69edbf6d25ec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "true", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caad52-301e-0042-584a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:28 GMT", + "x-ms-client-request-id" : "3c2e3329-87f2-44db-9699-69edbf6d25ec" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeleteac&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" : "86b38995-766f-4a15-93d9-4b2c495ad589" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caad6b-301e-0042-6f4a-67cbbf000000", + "Body" : "jtcdeleteacjtcdeleteac0blobapitestdeleteaca9d93183607d836907fdMon, 09 Sep 2019 20:06:28 GMT\"0x8D73561331FE51E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:28 GMT", + "x-ms-client-request-id" : "86b38995-766f-4a15-93d9-4b2c495ad589", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteaca9d93183607d836907fd?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" : "08eb3119-cb3a-48b2-b783-aaac65976642" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caad7c-301e-0042-7f4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:28 GMT", + "x-ms-client-request-id" : "08eb3119-cb3a-48b2-b783-aaac65976642" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0blobapitestdeleteaca9d93183607d836907fd", "javablobdeleteac1blobapitestdeleteaca9d12143cc5ea0d11" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[3].json new file mode 100644 index 000000000000..9ec2018f9c85 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[3].json @@ -0,0 +1,142 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac6a308978da01dcf6e624?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" : "dda11050-cffa-4bce-a9e6-039aa13ae057" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356133655F1F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caad96-301e-0042-194a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:28 GMT", + "x-ms-client-request-id" : "dda11050-cffa-4bce-a9e6-039aa13ae057" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac6a308978da01dcf6e624/javablobdeleteac1blobapitestdeleteac6a34999667fc289a9", + "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" : "2326801b-644b-46ba-8455-8373f0b1263e", + "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 20:06:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356133732B5A\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caadb6-301e-0042-364a-67cbbf000000", + "x-ms-client-request-id" : "2326801b-644b-46ba-8455-8373f0b1263e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac6a308978da01dcf6e624/javablobdeleteac1blobapitestdeleteac6a34999667fc289a9", + "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" : "5b3af6f7-e5a4-4bde-bdcb-ee3c4f7b7215" + }, + "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 20:06:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:06:28 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7356133732B5A\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:28 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5caadca-301e-0042-484a-67cbbf000000", + "x-ms-client-request-id" : "5b3af6f7-e5a4-4bde-bdcb-ee3c4f7b7215", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac6a308978da01dcf6e624/javablobdeleteac1blobapitestdeleteac6a34999667fc289a9", + "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" : "d9c3cc54-1033-497e-b495-03fc6865f112" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "true", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caadda-301e-0042-584a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:28 GMT", + "x-ms-client-request-id" : "d9c3cc54-1033-497e-b495-03fc6865f112" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeleteac&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" : "97caddd8-c528-4d63-8965-135638991395" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caadee-301e-0042-6c4a-67cbbf000000", + "Body" : "jtcdeleteacjtcdeleteac0blobapitestdeleteac6a308978da01dcf6e624Mon, 09 Sep 2019 20:06:28 GMT\"0x8D7356133655F1F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:28 GMT", + "x-ms-client-request-id" : "97caddd8-c528-4d63-8965-135638991395", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteac6a308978da01dcf6e624?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" : "d89e7f88-798c-4843-81c1-bcd1a8d475d9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caae09-301e-0042-054a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:28 GMT", + "x-ms-client-request-id" : "d89e7f88-798c-4843-81c1-bcd1a8d475d9" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0blobapitestdeleteac6a308978da01dcf6e624", "javablobdeleteac1blobapitestdeleteac6a34999667fc289a9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[4].json new file mode 100644 index 000000000000..02ee02e00ad5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[4].json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacce38895605a5a1728994?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" : "1ce179f3-466a-45f5-a67a-bde697d6234f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356133B53B3F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caae25-301e-0042-214a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:28 GMT", + "x-ms-client-request-id" : "1ce179f3-466a-45f5-a67a-bde697d6234f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacce38895605a5a1728994/javablobdeleteac1blobapitestdeleteacce307887916a23b05", + "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" : "257b14f9-90e4-44c7-8ee8-4a1bb11c10b7", + "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 20:06:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356133C32EAB\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caae48-301e-0042-434a-67cbbf000000", + "x-ms-client-request-id" : "257b14f9-90e4-44c7-8ee8-4a1bb11c10b7" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacce38895605a5a1728994/javablobdeleteac1blobapitestdeleteacce307887916a23b05", + "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" : "b547ff4d-6825-4ac1-8389-6c5a0db200a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "true", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caae59-301e-0042-534a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:29 GMT", + "x-ms-client-request-id" : "b547ff4d-6825-4ac1-8389-6c5a0db200a4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeleteac&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" : "b35b1fc5-e2f1-4162-b069-660b0178f430" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caae72-301e-0042-694a-67cbbf000000", + "Body" : "jtcdeleteacjtcdeleteac0blobapitestdeleteacce38895605a5a1728994Mon, 09 Sep 2019 20:06:29 GMT\"0x8D7356133B53B3F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:29 GMT", + "x-ms-client-request-id" : "b35b1fc5-e2f1-4162-b069-660b0178f430", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacce38895605a5a1728994?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" : "3beb1a71-6b14-4df2-93e9-abb2042bac36" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caae86-301e-0042-7d4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:29 GMT", + "x-ms-client-request-id" : "3beb1a71-6b14-4df2-93e9-abb2042bac36" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0blobapitestdeleteacce38895605a5a1728994", "javablobdeleteac1blobapitestdeleteacce307887916a23b05" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[5].json new file mode 100644 index 000000000000..dfd9425fc8d1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteac[5].json @@ -0,0 +1,132 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacfd969803874c732ab46f?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" : "4f12c443-d270-43fc-ba72-d57fe0994895" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356133F58427\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caae9c-301e-0042-114a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:29 GMT", + "x-ms-client-request-id" : "4f12c443-d270-43fc-ba72-d57fe0994895" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacfd969803874c732ab46f/javablobdeleteac1blobapitestdeleteacfd92431984c5c0626", + "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" : "89b5664e-e88b-4d0d-a5ed-0eed0d8b7530", + "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 20:06:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356134023EF5\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caaeb2-301e-0042-244a-67cbbf000000", + "x-ms-client-request-id" : "89b5664e-e88b-4d0d-a5ed-0eed0d8b7530" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacfd969803874c732ab46f/javablobdeleteac1blobapitestdeleteacfd92431984c5c0626?comp=lease", + "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" : "b3012bd9-5dff-4d8e-8d02-f23d4a51b1db" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356134023EF5\"", + "x-ms-lease-id" : "47450233-9dc2-4030-b67d-8c5cdb5f1aa6", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caaebf-301e-0042-2f4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:29 GMT", + "x-ms-client-request-id" : "b3012bd9-5dff-4d8e-8d02-f23d4a51b1db" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacfd969803874c732ab46f/javablobdeleteac1blobapitestdeleteacfd92431984c5c0626", + "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" : "5f54fe90-c6aa-4e0c-9c2b-e2e52af46ce5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "true", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caaecf-301e-0042-3d4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:29 GMT", + "x-ms-client-request-id" : "5f54fe90-c6aa-4e0c-9c2b-e2e52af46ce5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeleteac&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" : "601743de-f7b9-4d26-8ab9-c6c100287ded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caaef1-301e-0042-5d4a-67cbbf000000", + "Body" : "jtcdeleteacjtcdeleteac0blobapitestdeleteacfd969803874c732ab46fMon, 09 Sep 2019 20:06:29 GMT\"0x8D7356133F58427\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:29 GMT", + "x-ms-client-request-id" : "601743de-f7b9-4d26-8ab9-c6c100287ded", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0blobapitestdeleteacfd969803874c732ab46f?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" : "7b9c78ee-ef6e-48ed-93ee-b05e235ec26a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caaf06-301e-0042-724a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:29 GMT", + "x-ms-client-request-id" : "7b9c78ee-ef6e-48ed-93ee-b05e235ec26a" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0blobapitestdeleteacfd969803874c732ab46f", "javablobdeleteac1blobapitestdeleteacfd92431984c5c0626" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[0].json new file mode 100644 index 000000000000..9d50365ee313 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[0].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail5a226123fe217212?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" : "466691b1-754f-416e-bb88-5649e8fb5ba1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561344167F4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caaf27-301e-0042-0f4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:29 GMT", + "x-ms-client-request-id" : "466691b1-754f-416e-bb88-5649e8fb5ba1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail5a226123fe217212/javablobdeleteacfail1blobapitestdeleteacfail5a2741517d4cf", + "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" : "0f86675e-5236-47f9-a768-8493f6fbdb7b", + "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 20:06:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561344F82A6\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caaf49-301e-0042-2e4a-67cbbf000000", + "x-ms-client-request-id" : "0f86675e-5236-47f9-a768-8493f6fbdb7b" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail5a226123fe217212/javablobdeleteacfail1blobapitestdeleteacfail5a2741517d4cf", + "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" : "88e9f5e3-5f06-440a-bd11-b16fdda22dd6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5caaf63-301e-0042-464a-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5caaf63-301e-0042-464a-67cbbf000000\nTime:2019-09-09T20:06:30.2777291Z", + "Date" : "Mon, 09 Sep 2019 20:06:30 GMT", + "x-ms-client-request-id" : "88e9f5e3-5f06-440a-bd11-b16fdda22dd6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeleteacfail&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" : "4d67bfc9-455b-4d79-8c37-743afa2e30d5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caaf73-301e-0042-564a-67cbbf000000", + "Body" : "jtcdeleteacfailjtcdeleteacfail0blobapitestdeleteacfail5a226123fe217212Mon, 09 Sep 2019 20:06:30 GMT\"0x8D73561344167F4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:30 GMT", + "x-ms-client-request-id" : "4d67bfc9-455b-4d79-8c37-743afa2e30d5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail5a226123fe217212?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" : "21ff3d0a-724e-45b1-a0cc-cad76d662f37" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caaf8a-301e-0042-6d4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:30 GMT", + "x-ms-client-request-id" : "21ff3d0a-724e-45b1-a0cc-cad76d662f37" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacfail0blobapitestdeleteacfail5a226123fe217212", "javablobdeleteacfail1blobapitestdeleteacfail5a2741517d4cf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[1].json new file mode 100644 index 000000000000..31654ab1b01e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[1].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfailc4d55190cdb716b3?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" : "d7ce9147-ec71-4eae-b548-19eff9f3f8a9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613482C284\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caafa3-301e-0042-034a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:30 GMT", + "x-ms-client-request-id" : "d7ce9147-ec71-4eae-b548-19eff9f3f8a9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfailc4d55190cdb716b3/javablobdeleteacfail1blobapitestdeleteacfailc4d134238dfa9", + "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" : "1e8251c5-2503-4526-913f-8cb8e94af594", + "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 20:06:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561349019DB\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caafba-301e-0042-164a-67cbbf000000", + "x-ms-client-request-id" : "1e8251c5-2503-4526-913f-8cb8e94af594" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfailc4d55190cdb716b3/javablobdeleteacfail1blobapitestdeleteacfailc4d134238dfa9", + "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" : "091f7186-8a6e-456e-8525-475d57fd82b6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5caafcf-301e-0042-2b4a-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5caafcf-301e-0042-2b4a-67cbbf000000\nTime:2019-09-09T20:06:30.7030296Z", + "Date" : "Mon, 09 Sep 2019 20:06:30 GMT", + "x-ms-client-request-id" : "091f7186-8a6e-456e-8525-475d57fd82b6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeleteacfail&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" : "a4f1977b-6374-4fcb-8278-a312ffc1f7aa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caaff6-301e-0042-4a4a-67cbbf000000", + "Body" : "jtcdeleteacfailjtcdeleteacfail0blobapitestdeleteacfailc4d55190cdb716b3Mon, 09 Sep 2019 20:06:30 GMT\"0x8D735613482C284\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:30 GMT", + "x-ms-client-request-id" : "a4f1977b-6374-4fcb-8278-a312ffc1f7aa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfailc4d55190cdb716b3?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" : "0d5caa47-146c-4c70-8de5-5ef50665b861" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cab008-301e-0042-5a4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:30 GMT", + "x-ms-client-request-id" : "0d5caa47-146c-4c70-8de5-5ef50665b861" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacfail0blobapitestdeleteacfailc4d55190cdb716b3", "javablobdeleteacfail1blobapitestdeleteacfailc4d134238dfa9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[2].json new file mode 100644 index 000000000000..de10ab66f969 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[2].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfailf0a52286d173aa3c?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" : "e4b8137b-dbee-461d-979a-8bf0160288ff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356134C247FA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cab025-301e-0042-734a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:30 GMT", + "x-ms-client-request-id" : "e4b8137b-dbee-461d-979a-8bf0160288ff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfailf0a52286d173aa3c/javablobdeleteacfail1blobapitestdeleteacfailf0a8190112871", + "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" : "fc8cbdcb-6373-4108-af23-faaae0864faf", + "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 20:06:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356134CEDBF6\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cab04e-301e-0042-184a-67cbbf000000", + "x-ms-client-request-id" : "fc8cbdcb-6373-4108-af23-faaae0864faf" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfailf0a52286d173aa3c/javablobdeleteacfail1blobapitestdeleteacfailf0a8190112871", + "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" : "87c5d7f0-a682-4408-abc6-28787741952b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5cab068-301e-0042-2e4a-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5cab068-301e-0042-2e4a-67cbbf000000\nTime:2019-09-09T20:06:31.1123187Z", + "Date" : "Mon, 09 Sep 2019 20:06:30 GMT", + "x-ms-client-request-id" : "87c5d7f0-a682-4408-abc6-28787741952b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeleteacfail&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" : "f0002a5f-22ba-4598-ad74-9a201525c41e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cab088-301e-0042-4b4a-67cbbf000000", + "Body" : "jtcdeleteacfailjtcdeleteacfail0blobapitestdeleteacfailf0a52286d173aa3cMon, 09 Sep 2019 20:06:30 GMT\"0x8D7356134C247FA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:30 GMT", + "x-ms-client-request-id" : "f0002a5f-22ba-4598-ad74-9a201525c41e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfailf0a52286d173aa3c?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" : "cefbedec-f818-460d-8df4-710a0af93850" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cab09a-301e-0042-5b4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:31 GMT", + "x-ms-client-request-id" : "cefbedec-f818-460d-8df4-710a0af93850" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacfail0blobapitestdeleteacfailf0a52286d173aa3c", "javablobdeleteacfail1blobapitestdeleteacfailf0a8190112871" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[3].json new file mode 100644 index 000000000000..3d1b0c052395 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[3].json @@ -0,0 +1,144 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail89579357cd4563e6?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" : "e3cacaae-89d5-40f6-abfa-e602bc0cf760" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561350417D1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cab0b5-301e-0042-734a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:31 GMT", + "x-ms-client-request-id" : "e3cacaae-89d5-40f6-abfa-e602bc0cf760" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail89579357cd4563e6/javablobdeleteacfail1blobapitestdeleteacfail895984857b3e4", + "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" : "46e1e290-c787-456d-b2b6-e6fa91c23085", + "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 20:06:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356135112127\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cab0cb-301e-0042-074a-67cbbf000000", + "x-ms-client-request-id" : "46e1e290-c787-456d-b2b6-e6fa91c23085" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail89579357cd4563e6/javablobdeleteacfail1blobapitestdeleteacfail895984857b3e4", + "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" : "0e910001-0339-4881-9443-3b3f5326a390" + }, + "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 20:06:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:06:31 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7356135112127\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:31 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5cab0e4-301e-0042-1d4a-67cbbf000000", + "x-ms-client-request-id" : "0e910001-0339-4881-9443-3b3f5326a390", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail89579357cd4563e6/javablobdeleteacfail1blobapitestdeleteacfail895984857b3e4", + "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" : "9d2f459f-d57f-4454-85bf-f7b2d6c7a423" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5cab0fa-301e-0042-314a-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5cab0fa-301e-0042-314a-67cbbf000000\nTime:2019-09-09T20:06:31.6296841Z", + "Date" : "Mon, 09 Sep 2019 20:06:31 GMT", + "x-ms-client-request-id" : "9d2f459f-d57f-4454-85bf-f7b2d6c7a423", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeleteacfail&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" : "6e7c8817-35ef-4eaf-b2bd-a5869ef52228" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cab111-301e-0042-474a-67cbbf000000", + "Body" : "jtcdeleteacfailjtcdeleteacfail0blobapitestdeleteacfail89579357cd4563e6Mon, 09 Sep 2019 20:06:31 GMT\"0x8D73561350417D1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:31 GMT", + "x-ms-client-request-id" : "6e7c8817-35ef-4eaf-b2bd-a5869ef52228", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfail89579357cd4563e6?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" : "b6152df0-d999-4e71-b2d8-4671f5139174" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cab129-301e-0042-5f4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:31 GMT", + "x-ms-client-request-id" : "b6152df0-d999-4e71-b2d8-4671f5139174" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacfail0blobapitestdeleteacfail89579357cd4563e6", "javablobdeleteacfail1blobapitestdeleteacfail895984857b3e4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[4].json new file mode 100644 index 000000000000..c6433dff95ff --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteacfail[4].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfaildf235789433dd012?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" : "0a3036a4-a69f-4617-837b-dd4e52022414" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561355049C3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cab13f-301e-0042-734a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:31 GMT", + "x-ms-client-request-id" : "0a3036a4-a69f-4617-837b-dd4e52022414" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfaildf235789433dd012/javablobdeleteacfail1blobapitestdeleteacfaildf27004106eff", + "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" : "bd9d0c91-0bd4-4433-abe6-f9a3b339de71", + "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 20:06:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561355D2C20\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cab15e-301e-0042-114a-67cbbf000000", + "x-ms-client-request-id" : "bd9d0c91-0bd4-4433-abe6-f9a3b339de71" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfaildf235789433dd012/javablobdeleteacfail1blobapitestdeleteacfaildf27004106eff?comp=lease", + "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" : "02986471-bb25-415d-b057-4d395a7a3426" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561355D2C20\"", + "x-ms-lease-id" : "86c96756-4aaf-41e9-a6fd-22dd8ff7ab32", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cab17f-301e-0042-2c4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:31 GMT", + "x-ms-client-request-id" : "02986471-bb25-415d-b057-4d395a7a3426" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfaildf235789433dd012/javablobdeleteacfail1blobapitestdeleteacfaildf27004106eff", + "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" : "c16298d9-21ed-47bd-85c2-7ac58afd3fa3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "c5cab19e-301e-0042-484a-67cbbf000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:c5cab19e-301e-0042-484a-67cbbf000000\nTime:2019-09-09T20:06:32.1280355Z", + "Date" : "Mon, 09 Sep 2019 20:06:31 GMT", + "x-ms-client-request-id" : "c16298d9-21ed-47bd-85c2-7ac58afd3fa3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeleteacfail&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" : "c8579eb0-7835-45ab-9810-caa2600f1c0d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cab1af-301e-0042-584a-67cbbf000000", + "Body" : "jtcdeleteacfailjtcdeleteacfail0blobapitestdeleteacfaildf235789433dd012Mon, 09 Sep 2019 20:06:31 GMT\"0x8D73561355049C3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:31 GMT", + "x-ms-client-request-id" : "c8579eb0-7835-45ab-9810-caa2600f1c0d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0blobapitestdeleteacfaildf235789433dd012?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" : "000efbcd-f307-4b99-aa95-f43a371426df" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cab1cb-301e-0042-744a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:32 GMT", + "x-ms-client-request-id" : "000efbcd-f307-4b99-aa95-f43a371426df" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacfail0blobapitestdeleteacfaildf235789433dd012", "javablobdeleteacfail1blobapitestdeleteacfaildf27004106eff" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeletemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeletemin.json new file mode 100644 index 000000000000..4194a5ddc75f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeletemin.json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeletemin0blobapitestdeleteminb4f0568551037f954a7?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" : "4fbe5aaf-de39-4687-bfce-3e7e929d7b6d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561318524C8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caaa44-301e-0042-1c4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:25 GMT", + "x-ms-client-request-id" : "4fbe5aaf-de39-4687-bfce-3e7e929d7b6d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeletemin0blobapitestdeleteminb4f0568551037f954a7/javablobdeletemin1blobapitestdeleteminb4f1018436485f23", + "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" : "2082ade5-44ce-4ac3-98b5-6f4a180e00f4", + "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 20:06:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561319253FA\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caaa60-301e-0042-344a-67cbbf000000", + "x-ms-client-request-id" : "2082ade5-44ce-4ac3-98b5-6f4a180e00f4" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeletemin0blobapitestdeleteminb4f0568551037f954a7/javablobdeletemin1blobapitestdeleteminb4f1018436485f23", + "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" : "36eb67d3-bcc7-437a-afc9-6d415445aff8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "true", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caaa78-301e-0042-4a4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:25 GMT", + "x-ms-client-request-id" : "36eb67d3-bcc7-437a-afc9-6d415445aff8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeletemin&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" : "6ffdfb74-b055-44aa-9577-e48915b37b0f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caaa8f-301e-0042-5f4a-67cbbf000000", + "Body" : "jtcdeleteminjtcdeletemin0blobapitestdeleteminb4f0568551037f954a7Mon, 09 Sep 2019 20:06:25 GMT\"0x8D73561318524C8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:25 GMT", + "x-ms-client-request-id" : "6ffdfb74-b055-44aa-9577-e48915b37b0f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeletemin0blobapitestdeleteminb4f0568551037f954a7?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" : "2d24bc01-326f-44e0-b7ae-1467e0acce16" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caaaa2-301e-0042-714a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:25 GMT", + "x-ms-client-request-id" : "2d24bc01-326f-44e0-b7ae-1467e0acce16" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeletemin0blobapitestdeleteminb4f0568551037f954a7", "javablobdeletemin1blobapitestdeleteminb4f1018436485f23" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteoptions[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteoptions[0].json new file mode 100644 index 000000000000..077cf9dc7613 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteoptions[0].json @@ -0,0 +1,179 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions75d011433885787?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" : "09a2a77e-d624-468f-9117-ff7a27d0a720" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356131C6583F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caaab6-301e-0042-044a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:25 GMT", + "x-ms-client-request-id" : "09a2a77e-d624-468f-9117-ff7a27d0a720" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions75d011433885787/javablobdeleteoptions1blobapitestdeleteoptions75d16535360f", + "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" : "d52f112a-d8a8-465d-8de5-9f63fc54fe73", + "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 20:06:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356131D33959\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caaad1-301e-0042-1c4a-67cbbf000000", + "x-ms-client-request-id" : "d52f112a-d8a8-465d-8de5-9f63fc54fe73" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions75d011433885787/javablobdeleteoptions1blobapitestdeleteoptions75d16535360f?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" : "35a5fe41-2328-465f-b2c7-dee0bdfb5506" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:06:26.1061317Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356131D33959\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caaaec-301e-0042-324a-67cbbf000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:06:25 GMT", + "x-ms-client-request-id" : "35a5fe41-2328-465f-b2c7-dee0bdfb5506" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions75d011433885787/javablobdeleteoptions2blobapitestdeleteoptions75d48445a41e", + "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" : "b6b7844c-04c3-4f83-ad32-efa636bb7862", + "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 20:06:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356131ED079E\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caab03-301e-0042-454a-67cbbf000000", + "x-ms-client-request-id" : "b6b7844c-04c3-4f83-ad32-efa636bb7862" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions75d011433885787/javablobdeleteoptions1blobapitestdeleteoptions75d16535360f", + "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" : "ba75ca7b-7909-402b-a1e5-1c48d48a8167" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "true", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caab1f-301e-0042-5f4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:26 GMT", + "x-ms-client-request-id" : "ba75ca7b-7909-402b-a1e5-1c48d48a8167" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions75d011433885787?include=&restype=container&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" : "f8d39d36-0ccf-4b49-8427-de8ace3411d2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caab33-301e-0042-704a-67cbbf000000", + "Body" : "javablobdeleteoptions2blobapitestdeleteoptions75d48445a41eMon, 09 Sep 2019 20:06:26 GMTMon, 09 Sep 2019 20:06:26 GMT0x8D7356131ED079E7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:06:26 GMT", + "x-ms-client-request-id" : "f8d39d36-0ccf-4b49-8427-de8ace3411d2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeleteoptions&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" : "ba85cbca-21a9-42da-bb7a-a116d2aa5069" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caab4c-301e-0042-084a-67cbbf000000", + "Body" : "jtcdeleteoptionsjtcdeleteoptions0blobapitestdeleteoptions75d011433885787Mon, 09 Sep 2019 20:06:25 GMT\"0x8D7356131C6583F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:26 GMT", + "x-ms-client-request-id" : "ba85cbca-21a9-42da-bb7a-a116d2aa5069", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions75d011433885787?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" : "e5031022-d87d-4fce-be94-ad4675b7b32a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caab59-301e-0042-144a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:26 GMT", + "x-ms-client-request-id" : "e5031022-d87d-4fce-be94-ad4675b7b32a" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteoptions0blobapitestdeleteoptions75d011433885787", "javablobdeleteoptions1blobapitestdeleteoptions75d16535360f", "javablobdeleteoptions2blobapitestdeleteoptions75d48445a41e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteoptions[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteoptions[1].json new file mode 100644 index 000000000000..4c5059b653a7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdeleteoptions[1].json @@ -0,0 +1,179 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions68f733134f44da1?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" : "07ec67e4-2284-42f5-bd5a-04228cd7db48" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561322FB469\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caab7a-301e-0042-324a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:26 GMT", + "x-ms-client-request-id" : "07ec67e4-2284-42f5-bd5a-04228cd7db48" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions68f733134f44da1/javablobdeleteoptions1blobapitestdeleteoptions68f90000d3b9", + "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" : "d5caae33-ad03-47c3-94b1-4a13e9b4ea0f", + "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 20:06:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561323DA747\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caab93-301e-0042-474a-67cbbf000000", + "x-ms-client-request-id" : "d5caae33-ad03-47c3-94b1-4a13e9b4ea0f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions68f733134f44da1/javablobdeleteoptions1blobapitestdeleteoptions68f90000d3b9?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" : "e1205a77-ad15-4c45-9d32-a2b052068ef5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:06:26.8076304Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561323DA747\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caabad-301e-0042-5d4a-67cbbf000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:06:26 GMT", + "x-ms-client-request-id" : "e1205a77-ad15-4c45-9d32-a2b052068ef5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions68f733134f44da1/javablobdeleteoptions2blobapitestdeleteoptions68f256842391", + "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" : "844b3e30-ea52-4765-b3eb-55a80a26073e", + "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 20:06:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613258D55F\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caabca-301e-0042-764a-67cbbf000000", + "x-ms-client-request-id" : "844b3e30-ea52-4765-b3eb-55a80a26073e" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions68f733134f44da1/javablobdeleteoptions1blobapitestdeleteoptions68f90000d3b9", + "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" : "2fa9f774-dfee-4f37-b31b-052867c47bea" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "true", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caabe9-301e-0042-114a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:26 GMT", + "x-ms-client-request-id" : "2fa9f774-dfee-4f37-b31b-052867c47bea" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions68f733134f44da1?include=&restype=container&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" : "7aeba791-ba90-4c94-9393-cabc95e01122" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caabfc-301e-0042-224a-67cbbf000000", + "Body" : "javablobdeleteoptions1blobapitestdeleteoptions68f90000d3b9Mon, 09 Sep 2019 20:06:26 GMTMon, 09 Sep 2019 20:06:26 GMT0x8D73561323DA7477application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0javablobdeleteoptions2blobapitestdeleteoptions68f256842391Mon, 09 Sep 2019 20:06:26 GMTMon, 09 Sep 2019 20:06:26 GMT0x8D735613258D55F7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:06:26 GMT", + "x-ms-client-request-id" : "7aeba791-ba90-4c94-9393-cabc95e01122", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeleteoptions&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" : "d2646c32-da02-430c-a707-da61962a4b71" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caac0c-301e-0042-2f4a-67cbbf000000", + "Body" : "jtcdeleteoptionsjtcdeleteoptions0blobapitestdeleteoptions68f733134f44da1Mon, 09 Sep 2019 20:06:26 GMT\"0x8D73561322FB469\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:26 GMT", + "x-ms-client-request-id" : "d2646c32-da02-430c-a707-da61962a4b71", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteoptions0blobapitestdeleteoptions68f733134f44da1?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" : "007d70e0-6c66-4bfb-b818-a10302284313" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caac2a-301e-0042-494a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:27 GMT", + "x-ms-client-request-id" : "007d70e0-6c66-4bfb-b818-a10302284313" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteoptions0blobapitestdeleteoptions68f733134f44da1", "javablobdeleteoptions1blobapitestdeleteoptions68f90000d3b9", "javablobdeleteoptions2blobapitestdeleteoptions68f256842391" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[0].json new file mode 100644 index 000000000000..53b01837886d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[0].json @@ -0,0 +1,121 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadaca5064131ac757ea826?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" : "a51021db-e5b8-4411-8af0-72573762a196" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560E9EAC3CD\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca2cc2-301e-0042-6f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:25 GMT", + "x-ms-client-request-id" : "a51021db-e5b8-4411-8af0-72573762a196" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadaca5064131ac757ea826/javablobdownloadac1blobapitestdownloadaca5001247dc197a7", + "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" : "637c69db-e175-42b7-9bd7-5b7dd07da619", + "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 20:04:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560E9F7E085\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca2cd7-301e-0042-8049-67cbbf000000", + "x-ms-client-request-id" : "637c69db-e175-42b7-9bd7-5b7dd07da619" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadaca5064131ac757ea826/javablobdownloadac1blobapitestdownloadaca5001247dc197a7", + "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" : "560abd17-d827-4e86-ad4a-ce20b19208a6" + }, + "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 20:04:25 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:25 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560E9F7E085\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:25 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca2cea-301e-0042-1049-67cbbf000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "560abd17-d827-4e86-ad4a-ce20b19208a6", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdownloadac&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" : "1ae34d24-17d1-4896-8880-843e5d55907e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca2cfa-301e-0042-2049-67cbbf000000", + "Body" : "jtcdownloadacjtcdownloadac0blobapitestdownloadaca5064131ac757ea826Mon, 09 Sep 2019 20:04:25 GMT\"0x8D73560E9EAC3CD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:25 GMT", + "x-ms-client-request-id" : "1ae34d24-17d1-4896-8880-843e5d55907e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadaca5064131ac757ea826?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" : "e3ef3290-47f4-4e7f-a215-e7455e12fbe4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca2d0b-301e-0042-3149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:25 GMT", + "x-ms-client-request-id" : "e3ef3290-47f4-4e7f-a215-e7455e12fbe4" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadac0blobapitestdownloadaca5064131ac757ea826", "javablobdownloadac1blobapitestdownloadaca5001247dc197a7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[1].json new file mode 100644 index 000000000000..424f669221ca --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[1].json @@ -0,0 +1,121 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac99d24847ab309b8076?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" : "83ae48ec-45a9-42ad-862f-006c47cf8bf0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560EA2DA55F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca2d24-301e-0042-4849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:25 GMT", + "x-ms-client-request-id" : "83ae48ec-45a9-42ad-862f-006c47cf8bf0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac99d24847ab309b8076/javablobdownloadac1blobapitestdownloadac99d07598532f963", + "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" : "f531bcb9-7beb-471e-aae9-fd3016c238fa", + "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 20:04:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560EA3AC20E\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca2d3d-301e-0042-5d49-67cbbf000000", + "x-ms-client-request-id" : "f531bcb9-7beb-471e-aae9-fd3016c238fa" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac99d24847ab309b8076/javablobdownloadac1blobapitestdownloadac99d07598532f963", + "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" : "39a8598e-bf87-4eba-80c0-3a4ffcbcf3fc" + }, + "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 20:04:25 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:26 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560EA3AC20E\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:25 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca2d50-301e-0042-7049-67cbbf000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "39a8598e-bf87-4eba-80c0-3a4ffcbcf3fc", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdownloadac&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" : "8e90b342-3305-4fb5-b443-456d67f79060" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca2d64-301e-0042-0249-67cbbf000000", + "Body" : "jtcdownloadacjtcdownloadac0blobapitestdownloadac99d24847ab309b8076Mon, 09 Sep 2019 20:04:25 GMT\"0x8D73560EA2DA55F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:26 GMT", + "x-ms-client-request-id" : "8e90b342-3305-4fb5-b443-456d67f79060", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac99d24847ab309b8076?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" : "86c8559d-ea83-4799-9354-709f914f5424" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca2d77-301e-0042-1449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:26 GMT", + "x-ms-client-request-id" : "86c8559d-ea83-4799-9354-709f914f5424" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadac0blobapitestdownloadac99d24847ab309b8076", "javablobdownloadac1blobapitestdownloadac99d07598532f963" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[2].json new file mode 100644 index 000000000000..46ce2df9b2bd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[2].json @@ -0,0 +1,121 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac47c30723076abf5834?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" : "61943593-2bdb-4f9f-851b-e41c97c2978e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560EA72831F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca2d87-301e-0042-2449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:26 GMT", + "x-ms-client-request-id" : "61943593-2bdb-4f9f-851b-e41c97c2978e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac47c30723076abf5834/javablobdownloadac1blobapitestdownloadac47c3055120b3e42", + "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" : "4382fc1b-41ea-4ef6-8292-d9ceb6828ae3", + "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 20:04:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560EA7FC6E3\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca2d93-301e-0042-2d49-67cbbf000000", + "x-ms-client-request-id" : "4382fc1b-41ea-4ef6-8292-d9ceb6828ae3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac47c30723076abf5834/javablobdownloadac1blobapitestdownloadac47c3055120b3e42", + "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" : "e965b171-ef8b-4fe7-901c-dd2292cdcb89" + }, + "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 20:04:26 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:26 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560EA7FC6E3\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:26 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca2da2-301e-0042-3c49-67cbbf000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "e965b171-ef8b-4fe7-901c-dd2292cdcb89", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdownloadac&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" : "51c88d6a-1e5d-424d-bc9c-51c094ac2a4b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca2dbb-301e-0042-4f49-67cbbf000000", + "Body" : "jtcdownloadacjtcdownloadac0blobapitestdownloadac47c30723076abf5834Mon, 09 Sep 2019 20:04:26 GMT\"0x8D73560EA72831F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:26 GMT", + "x-ms-client-request-id" : "51c88d6a-1e5d-424d-bc9c-51c094ac2a4b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac47c30723076abf5834?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" : "31026c89-83c4-4ba1-96f0-20277042cb87" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca2dd4-301e-0042-6649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:26 GMT", + "x-ms-client-request-id" : "31026c89-83c4-4ba1-96f0-20277042cb87" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadac0blobapitestdownloadac47c30723076abf5834", "javablobdownloadac1blobapitestdownloadac47c3055120b3e42" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[3].json new file mode 100644 index 000000000000..b78cb1c113a8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[3].json @@ -0,0 +1,153 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac20813466638a1aa502?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" : "d55198ee-c524-415e-91b8-e1162634d2df" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560EAB53D97\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca2de1-301e-0042-7349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:26 GMT", + "x-ms-client-request-id" : "d55198ee-c524-415e-91b8-e1162634d2df" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac20813466638a1aa502/javablobdownloadac1blobapitestdownloadac208608698555acd", + "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" : "3087121c-4078-487f-8f34-6f68cd69e2d6", + "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 20:04:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560EAC28157\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca2dff-301e-0042-0e49-67cbbf000000", + "x-ms-client-request-id" : "3087121c-4078-487f-8f34-6f68cd69e2d6" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac20813466638a1aa502/javablobdownloadac1blobapitestdownloadac208608698555acd", + "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" : "68fa0756-3a10-46c3-9c3f-aa4afed96034" + }, + "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 20:04:26 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:26 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560EAC28157\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:26 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca2e18-301e-0042-2349-67cbbf000000", + "x-ms-client-request-id" : "68fa0756-3a10-46c3-9c3f-aa4afed96034", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac20813466638a1aa502/javablobdownloadac1blobapitestdownloadac208608698555acd", + "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" : "ee15ec40-63b3-4b7a-9ea1-fcb088588258" + }, + "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 20:04:26 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:26 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560EAC28157\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:26 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca2e35-301e-0042-3f49-67cbbf000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "ee15ec40-63b3-4b7a-9ea1-fcb088588258", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdownloadac&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" : "b5288b1a-bc07-4282-9d28-d15a763d0ead" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca2e43-301e-0042-4d49-67cbbf000000", + "Body" : "jtcdownloadacjtcdownloadac0blobapitestdownloadac20813466638a1aa502Mon, 09 Sep 2019 20:04:26 GMT\"0x8D73560EAB53D97\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:27 GMT", + "x-ms-client-request-id" : "b5288b1a-bc07-4282-9d28-d15a763d0ead", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac20813466638a1aa502?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" : "5d3049e4-20f4-4421-84c6-8d5e8f2f5190" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca2e54-301e-0042-5d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:27 GMT", + "x-ms-client-request-id" : "5d3049e4-20f4-4421-84c6-8d5e8f2f5190" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadac0blobapitestdownloadac20813466638a1aa502", "javablobdownloadac1blobapitestdownloadac208608698555acd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[4].json new file mode 100644 index 000000000000..ef044d7ae9cc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[4].json @@ -0,0 +1,121 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac28852400bfde86186f?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" : "3a8b9521-d239-46a3-ab41-b339b08b0ded" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560EB036BDC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca2e6b-301e-0042-7349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:27 GMT", + "x-ms-client-request-id" : "3a8b9521-d239-46a3-ab41-b339b08b0ded" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac28852400bfde86186f/javablobdownloadac1blobapitestdownloadac28814138c4c3e9e", + "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" : "e12b61e5-edee-42b2-9d4b-11f43fca51a8", + "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 20:04:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560EB108883\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca2e80-301e-0042-0649-67cbbf000000", + "x-ms-client-request-id" : "e12b61e5-edee-42b2-9d4b-11f43fca51a8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac28852400bfde86186f/javablobdownloadac1blobapitestdownloadac28814138c4c3e9e", + "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" : "8158fe39-e8ea-4eb9-9912-0d20b67bcc8f" + }, + "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 20:04:27 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:27 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560EB108883\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:27 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca2e94-301e-0042-1949-67cbbf000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "8158fe39-e8ea-4eb9-9912-0d20b67bcc8f", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdownloadac&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" : "282b966f-fdb0-42de-a19d-8f327b11106d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca2ea6-301e-0042-2a49-67cbbf000000", + "Body" : "jtcdownloadacjtcdownloadac0blobapitestdownloadac28852400bfde86186fMon, 09 Sep 2019 20:04:27 GMT\"0x8D73560EB036BDC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:27 GMT", + "x-ms-client-request-id" : "282b966f-fdb0-42de-a19d-8f327b11106d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadac28852400bfde86186f?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" : "60cecd82-0654-43c8-96f7-d9f027ecbcf4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca2eb8-301e-0042-3a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:27 GMT", + "x-ms-client-request-id" : "60cecd82-0654-43c8-96f7-d9f027ecbcf4" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadac0blobapitestdownloadac28852400bfde86186f", "javablobdownloadac1blobapitestdownloadac28814138c4c3e9e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[5].json new file mode 100644 index 000000000000..aae234bcd806 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadac[5].json @@ -0,0 +1,144 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacb5f055047988181f1e?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" : "a6ae50ee-a878-4818-a386-fcddae135859" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560EB44513F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca2ec4-301e-0042-4649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:27 GMT", + "x-ms-client-request-id" : "a6ae50ee-a878-4818-a386-fcddae135859" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacb5f055047988181f1e/javablobdownloadac1blobapitestdownloadacb5f205854a43172", + "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" : "b6ea49f5-8149-41a2-8622-422a7a4bd336", + "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 20:04:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560EB516DEB\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca2ed1-301e-0042-5149-67cbbf000000", + "x-ms-client-request-id" : "b6ea49f5-8149-41a2-8622-422a7a4bd336" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacb5f055047988181f1e/javablobdownloadac1blobapitestdownloadacb5f205854a43172?comp=lease", + "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" : "7d558fa7-7b10-48ad-8880-b0b7cd39c7fd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560EB516DEB\"", + "x-ms-lease-id" : "0a1da952-d313-426d-b6af-957e8898a79a", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca2ee1-301e-0042-5e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:27 GMT", + "x-ms-client-request-id" : "7d558fa7-7b10-48ad-8880-b0b7cd39c7fd" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacb5f055047988181f1e/javablobdownloadac1blobapitestdownloadacb5f205854a43172", + "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" : "91b23d25-8890-470d-a767-df599f46e836" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "leased", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:27 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:27 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560EB516DEB\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:27 GMT", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca2f02-301e-0042-7d49-67cbbf000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "91b23d25-8890-470d-a767-df599f46e836", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdownloadac&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" : "05ed301f-1e20-4f5b-8fee-a8986eb3f9f6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca2f11-301e-0042-0b49-67cbbf000000", + "Body" : "jtcdownloadacjtcdownloadac0blobapitestdownloadacb5f055047988181f1eMon, 09 Sep 2019 20:04:27 GMT\"0x8D73560EB44513F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:28 GMT", + "x-ms-client-request-id" : "05ed301f-1e20-4f5b-8fee-a8986eb3f9f6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadac0blobapitestdownloadacb5f055047988181f1e?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" : "c01d6b20-5b9d-41c3-83ed-022c9d5deb92" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca2f29-301e-0042-1d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:28 GMT", + "x-ms-client-request-id" : "c01d6b20-5b9d-41c3-83ed-022c9d5deb92" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadac0blobapitestdownloadacb5f055047988181f1e", "javablobdownloadac1blobapitestdownloadacb5f205854a43172" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[0].json new file mode 100644 index 000000000000..192b16c70a50 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[0].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfail07f536921ac2f0?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" : "85064ded-a7cd-4c9f-b3d1-eed55ce3f597" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560EB9FEF73\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca2f3f-301e-0042-3349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:28 GMT", + "x-ms-client-request-id" : "85064ded-a7cd-4c9f-b3d1-eed55ce3f597" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfail07f536921ac2f0/javablobdownloadacfail1blobapitestdownloadacfail07f5664903d", + "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" : "02b7ef8e-c784-4f10-916b-9c2820a35089", + "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 20:04:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560EBADCF94\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca2f4c-301e-0042-3f49-67cbbf000000", + "x-ms-client-request-id" : "02b7ef8e-c784-4f10-916b-9c2820a35089" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfail07f536921ac2f0/javablobdownloadacfail1blobapitestdownloadacfail07f5664903d", + "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" : "d3054776-9967-416c-a532-dfad16209c1f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "c5ca2f64-301e-0042-5649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:28 GMT", + "x-ms-client-request-id" : "d3054776-9967-416c-a532-dfad16209c1f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdownloadacfail&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" : "56e09cbc-9b14-4a33-97dc-5106cb7b0758" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca2f70-301e-0042-6249-67cbbf000000", + "Body" : "jtcdownloadacfailjtcdownloadacfail0blobapitestdownloadacfail07f536921ac2f0Mon, 09 Sep 2019 20:04:28 GMT\"0x8D73560EB9FEF73\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:28 GMT", + "x-ms-client-request-id" : "56e09cbc-9b14-4a33-97dc-5106cb7b0758", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfail07f536921ac2f0?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" : "aa644353-8f53-47cc-afd7-dc8236531494" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca2f80-301e-0042-6f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:28 GMT", + "x-ms-client-request-id" : "aa644353-8f53-47cc-afd7-dc8236531494" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadacfail0blobapitestdownloadacfail07f536921ac2f0", "javablobdownloadacfail1blobapitestdownloadacfail07f5664903d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[1].json new file mode 100644 index 000000000000..e526840e810e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[1].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfaile4a4084196c02b?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" : "764d3150-8c32-4a56-b75e-3536a4617a32" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560EBE19846\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca2fa3-301e-0042-0d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:28 GMT", + "x-ms-client-request-id" : "764d3150-8c32-4a56-b75e-3536a4617a32" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfaile4a4084196c02b/javablobdownloadacfail1blobapitestdownloadacfaile4a93474d5a", + "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" : "9993381f-d777-4f4c-923c-5ee7fba50cb5", + "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 20:04:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560EBEE66B3\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca2fb7-301e-0042-1f49-67cbbf000000", + "x-ms-client-request-id" : "9993381f-d777-4f4c-923c-5ee7fba50cb5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfaile4a4084196c02b/javablobdownloadacfail1blobapitestdownloadacfaile4a93474d5a", + "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" : "35a03867-dae2-40f3-8e94-7e6bfe8a6ad2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca2fcf-301e-0042-3749-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca2fcf-301e-0042-3749-67cbbf000000\nTime:2019-09-09T20:04:28.8448592Z", + "Date" : "Mon, 09 Sep 2019 20:04:28 GMT", + "x-ms-client-request-id" : "35a03867-dae2-40f3-8e94-7e6bfe8a6ad2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdownloadacfail&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" : "d0756e4b-919e-49f3-9b2f-277c0588eed9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca2fe0-301e-0042-4849-67cbbf000000", + "Body" : "jtcdownloadacfailjtcdownloadacfail0blobapitestdownloadacfaile4a4084196c02bMon, 09 Sep 2019 20:04:28 GMT\"0x8D73560EBE19846\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:28 GMT", + "x-ms-client-request-id" : "d0756e4b-919e-49f3-9b2f-277c0588eed9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfaile4a4084196c02b?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" : "36ec5c77-35b0-4be1-945a-bcbab7b9d8d8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca2ff2-301e-0042-5949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:28 GMT", + "x-ms-client-request-id" : "36ec5c77-35b0-4be1-945a-bcbab7b9d8d8" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadacfail0blobapitestdownloadacfaile4a4084196c02b", "javablobdownloadacfail1blobapitestdownloadacfaile4a93474d5a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[2].json new file mode 100644 index 000000000000..cb306b798978 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[2].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfaile5c3564460167e?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" : "a3858011-7b57-4446-a194-a20a2207564a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560EC219304\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca300a-301e-0042-7149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:29 GMT", + "x-ms-client-request-id" : "a3858011-7b57-4446-a194-a20a2207564a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfaile5c3564460167e/javablobdownloadacfail1blobapitestdownloadacfaile5c50227a63", + "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" : "fc765513-1020-4bb2-a55c-4c84ff30abc7", + "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 20:04:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560EC2FC159\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca301a-301e-0042-8049-67cbbf000000", + "x-ms-client-request-id" : "fc765513-1020-4bb2-a55c-4c84ff30abc7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfaile5c3564460167e/javablobdownloadacfail1blobapitestdownloadacfaile5c50227a63", + "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" : "c7f48d68-79b3-4971-97c6-0f653aa84fe0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca302f-301e-0042-1149-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca302f-301e-0042-1149-67cbbf000000\nTime:2019-09-09T20:04:29.2771644Z", + "Date" : "Mon, 09 Sep 2019 20:04:29 GMT", + "x-ms-client-request-id" : "c7f48d68-79b3-4971-97c6-0f653aa84fe0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdownloadacfail&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" : "6f2a340e-c5bd-41d8-a303-f3569fd7c431" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca3043-301e-0042-2549-67cbbf000000", + "Body" : "jtcdownloadacfailjtcdownloadacfail0blobapitestdownloadacfaile5c3564460167eMon, 09 Sep 2019 20:04:29 GMT\"0x8D73560EC219304\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:29 GMT", + "x-ms-client-request-id" : "6f2a340e-c5bd-41d8-a303-f3569fd7c431", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfaile5c3564460167e?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" : "f08301fa-c45e-4d5b-8bce-ccd7d4e0251c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca3051-301e-0042-3349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:29 GMT", + "x-ms-client-request-id" : "f08301fa-c45e-4d5b-8bce-ccd7d4e0251c" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadacfail0blobapitestdownloadacfaile5c3564460167e", "javablobdownloadacfail1blobapitestdownloadacfaile5c50227a63" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[3].json new file mode 100644 index 000000000000..ac63072c9de6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[3].json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfail9b03477896894d?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" : "5a840276-d6bb-467f-b94d-0878bccccf5c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560EC6314AD\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca3067-301e-0042-4749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:29 GMT", + "x-ms-client-request-id" : "5a840276-d6bb-467f-b94d-0878bccccf5c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfail9b03477896894d/javablobdownloadacfail1blobapitestdownloadacfail9b0476949db", + "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" : "0262f53f-62bd-47c4-b071-80372e1294ec", + "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 20:04:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560EC7E64DD\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca3083-301e-0042-6249-67cbbf000000", + "x-ms-client-request-id" : "0262f53f-62bd-47c4-b071-80372e1294ec" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfail9b03477896894d/javablobdownloadacfail1blobapitestdownloadacfail9b0476949db", + "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" : "71c43f18-2053-4be0-890e-d054574e4b5e" + }, + "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 20:04:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:29 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560EC7E64DD\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:29 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca3093-301e-0042-7049-67cbbf000000", + "x-ms-client-request-id" : "71c43f18-2053-4be0-890e-d054574e4b5e", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfail9b03477896894d/javablobdownloadacfail1blobapitestdownloadacfail9b0476949db", + "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" : "f3a9ffa6-50fc-4b5a-a173-e9bd780af56d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "c5ca30a4-301e-0042-7d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:29 GMT", + "x-ms-client-request-id" : "f3a9ffa6-50fc-4b5a-a173-e9bd780af56d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdownloadacfail&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" : "3429f08f-b72e-42d9-94ee-164efb82ab4a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca30bc-301e-0042-1549-67cbbf000000", + "Body" : "jtcdownloadacfailjtcdownloadacfail0blobapitestdownloadacfail9b03477896894dMon, 09 Sep 2019 20:04:29 GMT\"0x8D73560EC6314AD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:29 GMT", + "x-ms-client-request-id" : "3429f08f-b72e-42d9-94ee-164efb82ab4a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfail9b03477896894d?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" : "14bc13dd-5641-4071-8fda-7d7ab7e9256d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca30d3-301e-0042-2949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:30 GMT", + "x-ms-client-request-id" : "14bc13dd-5641-4071-8fda-7d7ab7e9256d" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadacfail0blobapitestdownloadacfail9b03477896894d", "javablobdownloadacfail1blobapitestdownloadacfail9b0476949db" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[4].json new file mode 100644 index 000000000000..a32b7357e5ed --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadacfail[4].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailbc562422bc2bbe?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" : "4e823cd3-4b05-4d55-be1f-59098dad26f3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560ECBE167B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca30eb-301e-0042-3f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:30 GMT", + "x-ms-client-request-id" : "4e823cd3-4b05-4d55-be1f-59098dad26f3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailbc562422bc2bbe/javablobdownloadacfail1blobapitestdownloadacfailbc53396123f", + "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" : "278c5cd5-64e7-433e-a5dc-a9a8431ba0d2", + "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 20:04:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560ECCB334B\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca30fc-301e-0042-4d49-67cbbf000000", + "x-ms-client-request-id" : "278c5cd5-64e7-433e-a5dc-a9a8431ba0d2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailbc562422bc2bbe/javablobdownloadacfail1blobapitestdownloadacfailbc53396123f?comp=lease", + "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" : "3df2f0a4-5903-467a-80be-98469e00aa08" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560ECCB334B\"", + "x-ms-lease-id" : "c06eac73-3bff-4b63-8402-079333f36d38", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca3114-301e-0042-6249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:30 GMT", + "x-ms-client-request-id" : "3df2f0a4-5903-467a-80be-98469e00aa08" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailbc562422bc2bbe/javablobdownloadacfail1blobapitestdownloadacfailbc53396123f", + "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" : "84562a39-ec17-4c7a-bbfe-c232b843d128" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca3123-301e-0042-7049-67cbbf000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:c5ca3123-301e-0042-7049-67cbbf000000\nTime:2019-09-09T20:04:30.3789468Z", + "Date" : "Mon, 09 Sep 2019 20:04:30 GMT", + "x-ms-client-request-id" : "84562a39-ec17-4c7a-bbfe-c232b843d128", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdownloadacfail&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" : "8877b81d-9954-4a3c-82a9-9fa83283b2c8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca312e-301e-0042-7b49-67cbbf000000", + "Body" : "jtcdownloadacfailjtcdownloadacfail0blobapitestdownloadacfailbc562422bc2bbeMon, 09 Sep 2019 20:04:30 GMT\"0x8D73560ECBE167B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:30 GMT", + "x-ms-client-request-id" : "8877b81d-9954-4a3c-82a9-9fa83283b2c8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadacfail0blobapitestdownloadacfailbc562422bc2bbe?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" : "815af74c-9b6f-43f8-ab27-1ab6838efe6e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca313b-301e-0042-0849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:30 GMT", + "x-ms-client-request-id" : "815af74c-9b6f-43f8-ab27-1ab6838efe6e" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadacfail0blobapitestdownloadacfailbc562422bc2bbe", "javablobdownloadacfail1blobapitestdownloadacfailbc53396123f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadallnull.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadallnull.json new file mode 100644 index 000000000000..0fbe94382705 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadallnull.json @@ -0,0 +1,121 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadallnull0blobapitestdownloadallnullf4a1907896754?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" : "99dfa788-8835-4944-a860-a827f8a3d613" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560E7D3905A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca29b3-301e-0042-2149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:21 GMT", + "x-ms-client-request-id" : "99dfa788-8835-4944-a860-a827f8a3d613" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadallnull0blobapitestdownloadallnullf4a1907896754/javablobdownloadallnull1blobapitestdownloadallnullf4a57090b9", + "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" : "315feec9-c127-4fc4-a54f-87285e40efef", + "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 20:04:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560E7E0ACFF\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca29c7-301e-0042-3249-67cbbf000000", + "x-ms-client-request-id" : "315feec9-c127-4fc4-a54f-87285e40efef" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadallnull0blobapitestdownloadallnullf4a1907896754/javablobdownloadallnull1blobapitestdownloadallnullf4a57090b9", + "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" : "4621debf-796c-439b-94c5-31aebdbfcbb7" + }, + "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 20:04:21 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:22 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560E7E0ACFF\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:21 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca29d4-301e-0042-3f49-67cbbf000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "4621debf-796c-439b-94c5-31aebdbfcbb7", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdownloadallnull&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" : "4d31fcf8-25ce-4ad4-929a-6c2ecfa4fabc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca29e9-301e-0042-5249-67cbbf000000", + "Body" : "jtcdownloadallnulljtcdownloadallnull0blobapitestdownloadallnullf4a1907896754Mon, 09 Sep 2019 20:04:21 GMT\"0x8D73560E7D3905A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:22 GMT", + "x-ms-client-request-id" : "4d31fcf8-25ce-4ad4-929a-6c2ecfa4fabc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadallnull0blobapitestdownloadallnullf4a1907896754?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" : "f68aa786-8f8b-482c-9a68-bbbd4ecbc910" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca29fe-301e-0042-6449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:22 GMT", + "x-ms-client-request-id" : "f68aa786-8f8b-482c-9a68-bbbd4ecbc910" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadallnull0blobapitestdownloadallnullf4a1907896754", "javablobdownloadallnull1blobapitestdownloadallnullf4a57090b9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloademptyfile.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloademptyfile.json new file mode 100644 index 000000000000..9bdfa43e8e08 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloademptyfile.json @@ -0,0 +1,142 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloademptyfile0blobapitestdownloademptyfile1e521172667?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" : "d4dc2813-075e-409a-951a-2a176a518205" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560E8153929\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca2a15-301e-0042-7a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:22 GMT", + "x-ms-client-request-id" : "d4dc2813-075e-409a-951a-2a176a518205" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloademptyfile0blobapitestdownloademptyfile1e521172667/javablobdownloademptyfile1blobapitestdownloademptyfile1e579829", + "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" : "59740e9b-27a7-41b9-b350-b4ec5fef779e", + "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 20:04:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560E82255CF\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca2a28-301e-0042-0b49-67cbbf000000", + "x-ms-client-request-id" : "59740e9b-27a7-41b9-b350-b4ec5fef779e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloademptyfile0blobapitestdownloademptyfile1e521172667/emptyAppendBlob", + "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" : "eda98123-79ac-4e35-aa56-9f89ab29b649" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560E82F0255\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca2a38-301e-0042-1b49-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:22 GMT", + "x-ms-client-request-id" : "eda98123-79ac-4e35-aa56-9f89ab29b649" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloademptyfile0blobapitestdownloademptyfile1e521172667/emptyAppendBlob", + "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" : "ffe538c1-59ce-4012-a2e1-a4b8fa354d84" + }, + "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", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:22 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:22 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560E82F0255\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:22 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca2a4a-301e-0042-2c49-67cbbf000000", + "x-ms-client-request-id" : "ffe538c1-59ce-4012-a2e1-a4b8fa354d84", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdownloademptyfile&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" : "8b9dd756-3324-4968-a8ee-7ac76eea2140" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca2a58-301e-0042-3949-67cbbf000000", + "Body" : "jtcdownloademptyfilejtcdownloademptyfile0blobapitestdownloademptyfile1e521172667Mon, 09 Sep 2019 20:04:22 GMT\"0x8D73560E8153929\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:22 GMT", + "x-ms-client-request-id" : "8b9dd756-3324-4968-a8ee-7ac76eea2140", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloademptyfile0blobapitestdownloademptyfile1e521172667?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" : "ba5500cc-7377-4a46-9bde-3b89ae142796" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca2a6c-301e-0042-4c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:22 GMT", + "x-ms-client-request-id" : "ba5500cc-7377-4a46-9bde-3b89ae142796" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloademptyfile0blobapitestdownloademptyfile1e521172667", "javablobdownloademptyfile1blobapitestdownloademptyfile1e579829" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloaderror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloaderror.json new file mode 100644 index 000000000000..b6840de84d0b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloaderror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloaderror0blobapitestdownloaderror71b517514658b61?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" : "be00ba60-fd65-4526-831e-5405aa9d6359" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560ED51E5F2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca31ab-301e-0042-6a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:31 GMT", + "x-ms-client-request-id" : "be00ba60-fd65-4526-831e-5405aa9d6359" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloaderror0blobapitestdownloaderror71b517514658b61/javablobdownloaderror1blobapitestdownloaderror71b53348f229", + "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" : "fcc828de-4ad8-4b83-835a-b901f02558b8", + "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 20:04:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560ED5FED44\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca31cb-301e-0042-8049-67cbbf000000", + "x-ms-client-request-id" : "fcc828de-4ad8-4b83-835a-b901f02558b8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloaderror0blobapitestdownloaderror71b517514658b61/javablobdownloaderror2blobapitestdownloaderror71b27282e93b", + "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" : "e54c791d-4370-4cc3-bbb7-9606e066360d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "BlobNotFound", + "retry-after" : "0", + "Content-Length" : "215", + "StatusCode" : "404", + "x-ms-request-id" : "c5ca31e2-301e-0042-1349-67cbbf000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:c5ca31e2-301e-0042-1349-67cbbf000000\nTime:2019-09-09T20:04:31.2675800Z", + "Date" : "Mon, 09 Sep 2019 20:04:31 GMT", + "x-ms-client-request-id" : "e54c791d-4370-4cc3-bbb7-9606e066360d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdownloaderror&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" : "591c41d3-be43-4d38-b147-128319d12afd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca31ed-301e-0042-1e49-67cbbf000000", + "Body" : "jtcdownloaderrorjtcdownloaderror0blobapitestdownloaderror71b517514658b61Mon, 09 Sep 2019 20:04:31 GMT\"0x8D73560ED51E5F2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:31 GMT", + "x-ms-client-request-id" : "591c41d3-be43-4d38-b147-128319d12afd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloaderror0blobapitestdownloaderror71b517514658b61?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" : "334bef6d-d7a6-44db-9b02-411fe6d407ad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca31fa-301e-0042-2949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:31 GMT", + "x-ms-client-request-id" : "334bef6d-d7a6-44db-9b02-411fe6d407ad" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloaderror0blobapitestdownloaderror71b517514658b61", "javablobdownloaderror1blobapitestdownloaderror71b53348f229", "javablobdownloaderror2blobapitestdownloaderror71b27282e93b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadmd5.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadmd5.json new file mode 100644 index 000000000000..f0830ef891c6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadmd5.json @@ -0,0 +1,123 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadmd50blobapitestdownloadmd55f8288733848f815f?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" : "420d0ddd-644c-433f-9c1b-78a8e00cf76b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560ED0DA48E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca314e-301e-0042-1749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:30 GMT", + "x-ms-client-request-id" : "420d0ddd-644c-433f-9c1b-78a8e00cf76b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadmd50blobapitestdownloadmd55f8288733848f815f/javablobdownloadmd51blobapitestdownloadmd55f821470743415", + "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" : "172a7107-7326-41f7-9e5e-8f8211fbcaa2", + "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 20:04:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560ED1A4C0E\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca3161-301e-0042-2649-67cbbf000000", + "x-ms-client-request-id" : "172a7107-7326-41f7-9e5e-8f8211fbcaa2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadmd50blobapitestdownloadmd55f8288733848f815f/javablobdownloadmd51blobapitestdownloadmd55f821470743415", + "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" : "74d39574-4c58-4415-953f-6b70034dceda" + }, + "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", + "Content-Range" : "bytes 0-2/7", + "x-ms-lease-state" : "available", + "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:30 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Mon, 09 Sep 2019 20:04:30 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "TtlAdjDrEADA9rY4Qt76fQ==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560ED1A4C0E\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:30 GMT", + "Content-Length" : "3", + "x-ms-request-id" : "c5ca316f-301e-0042-3349-67cbbf000000", + "Body" : "[100, 101, 102]", + "x-ms-client-request-id" : "74d39574-4c58-4415-953f-6b70034dceda", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdownloadmd5&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" : "d532c8fa-3dc7-4c5b-a686-71c86315f8dc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca317a-301e-0042-3e49-67cbbf000000", + "Body" : "jtcdownloadmd5jtcdownloadmd50blobapitestdownloadmd55f8288733848f815fMon, 09 Sep 2019 20:04:30 GMT\"0x8D73560ED0DA48E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:30 GMT", + "x-ms-client-request-id" : "d532c8fa-3dc7-4c5b-a686-71c86315f8dc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadmd50blobapitestdownloadmd55f8288733848f815f?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" : "0bba2afa-d1c3-4f87-9885-7d9b65b1ca2f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca3196-301e-0042-5849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:30 GMT", + "x-ms-client-request-id" : "0bba2afa-d1c3-4f87-9885-7d9b65b1ca2f" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadmd50blobapitestdownloadmd55f8288733848f815f", "javablobdownloadmd51blobapitestdownloadmd55f821470743415" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadmin.json new file mode 100644 index 000000000000..3b0a561e76ce --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadmin.json @@ -0,0 +1,121 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadmin0blobapitestdownloadmin060599885814e9542?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" : "e2487674-9d1c-49ce-b5b4-e8a8fe39eed8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560E8DD415D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca2b43-301e-0042-0d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:23 GMT", + "x-ms-client-request-id" : "e2487674-9d1c-49ce-b5b4-e8a8fe39eed8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadmin0blobapitestdownloadmin060599885814e9542/javablobdownloadmin1blobapitestdownloadmin060245662b89da", + "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" : "275c7cee-c2d4-499d-90d3-dd89a5cd32fb", + "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 20:04:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560E8E9C1C3\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca2b52-301e-0042-1b49-67cbbf000000", + "x-ms-client-request-id" : "275c7cee-c2d4-499d-90d3-dd89a5cd32fb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadmin0blobapitestdownloadmin060599885814e9542/javablobdownloadmin1blobapitestdownloadmin060245662b89da", + "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" : "8fa988d1-8879-4a4c-bfcf-09d6ca34d769" + }, + "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 20:04:23 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:23 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560E8E9C1C3\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:23 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca2b69-301e-0042-3049-67cbbf000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "8fa988d1-8879-4a4c-bfcf-09d6ca34d769", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdownloadmin&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" : "32cca227-dbf9-46d5-9ede-2097e644ddbe" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca2b7d-301e-0042-4349-67cbbf000000", + "Body" : "jtcdownloadminjtcdownloadmin0blobapitestdownloadmin060599885814e9542Mon, 09 Sep 2019 20:04:23 GMT\"0x8D73560E8DD415D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:23 GMT", + "x-ms-client-request-id" : "32cca227-dbf9-46d5-9ede-2097e644ddbe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadmin0blobapitestdownloadmin060599885814e9542?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" : "39842fc1-d1f5-47bc-aee5-85e1df0c2244" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca2b8f-301e-0042-5349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:23 GMT", + "x-ms-client-request-id" : "39842fc1-d1f5-47bc-aee5-85e1df0c2244" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadmin0blobapitestdownloadmin060599885814e9542", "javablobdownloadmin1blobapitestdownloadmin060245662b89da" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadrange[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadrange[0].json new file mode 100644 index 000000000000..fd5f1e2dfb38 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadrange[0].json @@ -0,0 +1,121 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange9a0774452034240?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" : "826d123f-f3db-413f-ad81-3db191e5f632" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560E922BB71\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca2ba2-301e-0042-6249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:24 GMT", + "x-ms-client-request-id" : "826d123f-f3db-413f-ad81-3db191e5f632" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange9a0774452034240/javablobdownloadrange1blobapitestdownloadrange9a0427523240", + "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" : "708d25a4-02ca-4cf1-9cdc-59d42f236a7f", + "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 20:04:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560E92FB11F\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca2bb7-301e-0042-7349-67cbbf000000", + "x-ms-client-request-id" : "708d25a4-02ca-4cf1-9cdc-59d42f236a7f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange9a0774452034240/javablobdownloadrange1blobapitestdownloadrange9a0427523240", + "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" : "4ce720eb-4bed-495e-aa1c-d0971ec688e8" + }, + "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 20:04:24 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:24 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560E92FB11F\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:24 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca2bc6-301e-0042-0149-67cbbf000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "4ce720eb-4bed-495e-aa1c-d0971ec688e8", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdownloadrange&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" : "aca06959-fbda-4ad4-842c-430bf6a22c73" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca2bdd-301e-0042-1849-67cbbf000000", + "Body" : "jtcdownloadrangejtcdownloadrange0blobapitestdownloadrange9a0774452034240Mon, 09 Sep 2019 20:04:24 GMT\"0x8D73560E922BB71\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:24 GMT", + "x-ms-client-request-id" : "aca06959-fbda-4ad4-842c-430bf6a22c73", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange9a0774452034240?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" : "834abb0a-5db5-4138-95f9-3a245b856a1a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca2bed-301e-0042-2849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:24 GMT", + "x-ms-client-request-id" : "834abb0a-5db5-4138-95f9-3a245b856a1a" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadrange0blobapitestdownloadrange9a0774452034240", "javablobdownloadrange1blobapitestdownloadrange9a0427523240" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadrange[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadrange[1].json new file mode 100644 index 000000000000..a5fcf8eb9d46 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadrange[1].json @@ -0,0 +1,122 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange4bb44791597be3e?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" : "ce337a58-5596-47e4-8bc9-d80b005557af" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560E9641620\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca2c00-301e-0042-3a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:24 GMT", + "x-ms-client-request-id" : "ce337a58-5596-47e4-8bc9-d80b005557af" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange4bb44791597be3e/javablobdownloadrange1blobapitestdownloadrange4bb300918c58", + "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" : "5d0499a6-c820-401a-a285-d6d4a18bdefc", + "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 20:04:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560E971F650\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca2c14-301e-0042-4d49-67cbbf000000", + "x-ms-client-request-id" : "5d0499a6-c820-401a-a285-d6d4a18bdefc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange4bb44791597be3e/javablobdownloadrange1blobapitestdownloadrange4bb300918c58", + "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" : "21b8a349-515c-47ef-9872-b4d77828e7cf" + }, + "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", + "Content-Range" : "bytes 0-4/7", + "x-ms-lease-state" : "available", + "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:24 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Mon, 09 Sep 2019 20:04:24 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560E971F650\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:24 GMT", + "Content-Length" : "5", + "x-ms-request-id" : "c5ca2c20-301e-0042-5849-67cbbf000000", + "Body" : "[100, 101, 102, 97, 117]", + "x-ms-client-request-id" : "21b8a349-515c-47ef-9872-b4d77828e7cf", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdownloadrange&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" : "494d01ad-b27e-4dd5-8af5-94a94c24fb49" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca2c36-301e-0042-6d49-67cbbf000000", + "Body" : "jtcdownloadrangejtcdownloadrange0blobapitestdownloadrange4bb44791597be3eMon, 09 Sep 2019 20:04:24 GMT\"0x8D73560E9641620\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:24 GMT", + "x-ms-client-request-id" : "494d01ad-b27e-4dd5-8af5-94a94c24fb49", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange4bb44791597be3e?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" : "84498680-5f11-41e7-9413-a0e7720f72cb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca2c42-301e-0042-7949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:24 GMT", + "x-ms-client-request-id" : "84498680-5f11-41e7-9413-a0e7720f72cb" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadrange0blobapitestdownloadrange4bb44791597be3e", "javablobdownloadrange1blobapitestdownloadrange4bb300918c58" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadrange[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadrange[2].json new file mode 100644 index 000000000000..eaab5e9bed2b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadrange[2].json @@ -0,0 +1,122 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange37957487cf59c0b?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" : "e86c3ee5-335c-419d-963f-fe2c5482716b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560E9A99041\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca2c57-301e-0042-0b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:24 GMT", + "x-ms-client-request-id" : "e86c3ee5-335c-419d-963f-fe2c5482716b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange37957487cf59c0b/javablobdownloadrange1blobapitestdownloadrange379480939968", + "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" : "10c42f7f-fd72-4c25-bf0c-0d587ffd5842", + "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 20:04:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560E9B685E3\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca2c6d-301e-0042-1f49-67cbbf000000", + "x-ms-client-request-id" : "10c42f7f-fd72-4c25-bf0c-0d587ffd5842" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange37957487cf59c0b/javablobdownloadrange1blobapitestdownloadrange379480939968", + "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" : "0eefc4cd-7bfc-43a3-a652-fa764d710f21" + }, + "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", + "Content-Range" : "bytes 3-4/7", + "x-ms-lease-state" : "available", + "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:25 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Mon, 09 Sep 2019 20:04:25 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560E9B685E3\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:25 GMT", + "Content-Length" : "2", + "x-ms-request-id" : "c5ca2c8b-301e-0042-3b49-67cbbf000000", + "Body" : "[97, 117]", + "x-ms-client-request-id" : "0eefc4cd-7bfc-43a3-a652-fa764d710f21", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdownloadrange&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" : "7a71fa41-0283-465e-b6cf-25e45b8828f0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca2c96-301e-0042-4649-67cbbf000000", + "Body" : "jtcdownloadrangejtcdownloadrange0blobapitestdownloadrange37957487cf59c0bMon, 09 Sep 2019 20:04:24 GMT\"0x8D73560E9A99041\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:25 GMT", + "x-ms-client-request-id" : "7a71fa41-0283-465e-b6cf-25e45b8828f0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadrange0blobapitestdownloadrange37957487cf59c0b?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" : "4be552e8-56b8-4fd5-9e0e-c40ded4ac29a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca2caa-301e-0042-5849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:25 GMT", + "x-ms-client-request-id" : "4be552e8-56b8-4fd5-9e0e-c40ded4ac29a" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadrange0blobapitestdownloadrange37957487cf59c0b", "javablobdownloadrange1blobapitestdownloadrange379480939968" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadsnapshot.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadsnapshot.json new file mode 100644 index 000000000000..729b0049a5d9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadsnapshot.json @@ -0,0 +1,199 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadsnapshot0blobapitestdownloadsnapshotb3706184f1c1?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" : "1657385e-7a69-4140-b442-3549928ad0c0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560ED9367B1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca3209-301e-0042-3849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:31 GMT", + "x-ms-client-request-id" : "1657385e-7a69-4140-b442-3549928ad0c0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadsnapshot0blobapitestdownloadsnapshotb3706184f1c1/javablobdownloadsnapshot1blobapitestdownloadsnapshotb37462643", + "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" : "87bedbcd-d6e1-4f1f-9ac9-18c34fc65d1e", + "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 20:04:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560EDA0F9B3\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca321a-301e-0042-4749-67cbbf000000", + "x-ms-client-request-id" : "87bedbcd-d6e1-4f1f-9ac9-18c34fc65d1e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadsnapshot0blobapitestdownloadsnapshotb3706184f1c1/javablobdownloadsnapshot1blobapitestdownloadsnapshotb37462643", + "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" : "238ea0b9-682b-4169-851c-da8adc38618f" + }, + "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 20:04:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:31 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560EDA0F9B3\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:31 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca3227-301e-0042-5449-67cbbf000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "238ea0b9-682b-4169-851c-da8adc38618f", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadsnapshot0blobapitestdownloadsnapshotb3706184f1c1/javablobdownloadsnapshot1blobapitestdownloadsnapshotb37462643?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" : "eec97964-edcc-4abc-b860-1f26dcc3a866" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:04:31.7838186Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560EDA0F9B3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca323f-301e-0042-6749-67cbbf000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:04:31 GMT", + "x-ms-client-request-id" : "eec97964-edcc-4abc-b860-1f26dcc3a866" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadsnapshot0blobapitestdownloadsnapshotb3706184f1c1/javablobdownloadsnapshot1blobapitestdownloadsnapshotb37462643", + "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" : "7a606498-deb3-4e43-9fb2-3f6e370ec8c9", + "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" : "Ky/Mhvo/J+s=", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:31 GMT", + "Content-MD5" : "kC+90rHfDE9wtKXSNSXpMg==", + "ETag" : "\"0x8D73560EDC92276\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca324d-301e-0042-7549-67cbbf000000", + "x-ms-client-request-id" : "7a606498-deb3-4e43-9fb2-3f6e370ec8c9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadsnapshot0blobapitestdownloadsnapshotb3706184f1c1/javablobdownloadsnapshot1blobapitestdownloadsnapshotb37462643?snapshot=2019-09-09T20%3a04%3a31.7838186Z", + "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" : "9948eddb-9ada-424a-985c-d790250e482c" + }, + "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 20:04:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:31 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-snapshot" : "2019-09-09T20:04:31.7838186Z", + "ETag" : "\"0x8D73560EDA0F9B3\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:31 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca3259-301e-0042-0149-67cbbf000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "9948eddb-9ada-424a-985c-d790250e482c", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdownloadsnapshot&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" : "683fc3d6-3b6b-41aa-89a0-4da7fa97d8c3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca3271-301e-0042-1849-67cbbf000000", + "Body" : "jtcdownloadsnapshotjtcdownloadsnapshot0blobapitestdownloadsnapshotb3706184f1c1Mon, 09 Sep 2019 20:04:31 GMT\"0x8D73560ED9367B1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:32 GMT", + "x-ms-client-request-id" : "683fc3d6-3b6b-41aa-89a0-4da7fa97d8c3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadsnapshot0blobapitestdownloadsnapshotb3706184f1c1?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" : "43f608f7-b3cf-4ed8-abd8-7069baef6eac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca3286-301e-0042-2b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:32 GMT", + "x-ms-client-request-id" : "43f608f7-b3cf-4ed8-abd8-7069baef6eac" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadsnapshot0blobapitestdownloadsnapshotb3706184f1c1", "javablobdownloadsnapshot1blobapitestdownloadsnapshotb37462643" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofiledoesnotexist.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofiledoesnotexist.json new file mode 100644 index 000000000000..d950d3a79c9b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofiledoesnotexist.json @@ -0,0 +1,154 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadtofiledoesnotexist094554e56f6041f44840?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" : "1cc4ee14-eb38-4dd9-8b7c-cb0dcf8a9ccb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560EE36CA5B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca32dc-301e-0042-7c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:32 GMT", + "x-ms-client-request-id" : "1cc4ee14-eb38-4dd9-8b7c-cb0dcf8a9ccb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadtofiledoesnotexist094554e56f6041f44840/javablobdownloadtofiledoesnotexist1216166a1f95cb9af", + "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" : "9aeb81c7-5ae7-4d23-a7b5-ea0ea560e860", + "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 20:04:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:32 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560EE4371C9\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca3304-301e-0042-2149-67cbbf000000", + "x-ms-client-request-id" : "9aeb81c7-5ae7-4d23-a7b5-ea0ea560e860" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadtofiledoesnotexist094554e56f6041f44840/javablobdownloadtofiledoesnotexist1216166a1f95cb9af", + "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" : "b6b86751-89b1-44a1-9156-90ffb277bc13" + }, + "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 20:04:32 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:32 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560EE4371C9\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:32 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca3317-301e-0042-3449-67cbbf000000", + "x-ms-client-request-id" : "b6b86751-89b1-44a1-9156-90ffb277bc13", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadtofiledoesnotexist094554e56f6041f44840/javablobdownloadtofiledoesnotexist1216166a1f95cb9af", + "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" : "01b7685a-fc96-4a40-ad4f-9a9cf655658a" + }, + "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", + "Content-Range" : "bytes 0-6/7", + "x-ms-lease-state" : "available", + "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:32 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Mon, 09 Sep 2019 20:04:32 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560EE4371C9\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:32 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca3326-301e-0042-4249-67cbbf000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "01b7685a-fc96-4a40-ad4f-9a9cf655658a", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdownloadtofiledoesnotexist&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" : "24775563-10b2-4dfd-b021-289e4c8ae4df" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca3347-301e-0042-5f49-67cbbf000000", + "Body" : "jtcdownloadtofiledoesnotexistjtcdownloadtofiledoesnotexist094554e56f6041f44840Mon, 09 Sep 2019 20:04:32 GMT\"0x8D73560EE36CA5B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:32 GMT", + "x-ms-client-request-id" : "24775563-10b2-4dfd-b021-289e4c8ae4df", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadtofiledoesnotexist094554e56f6041f44840?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" : "926b4a6c-7e67-4f64-bea1-749969798ab0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca3373-301e-0042-0949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:33 GMT", + "x-ms-client-request-id" : "926b4a6c-7e67-4f64-bea1-749969798ab0" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadtofiledoesnotexist094554e56f6041f44840", "javablobdownloadtofiledoesnotexist1216166a1f95cb9af" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofileexists.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofileexists.json new file mode 100644 index 000000000000..bf912ccef602 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadtofileexists.json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadtofileexists0795060213cb6f15ad44568?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" : "f0b47d5d-4139-4591-94d5-b8c761505364" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560EDFDAE91\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca3295-301e-0042-3a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:32 GMT", + "x-ms-client-request-id" : "f0b47d5d-4139-4591-94d5-b8c761505364" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadtofileexists0795060213cb6f15ad44568/javablobdownloadtofileexists1997099a52b736eb7049", + "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" : "1243a171-5c46-4218-8325-0b93faf64a62", + "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 20:04:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:32 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560EE0AF264\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca329f-301e-0042-4349-67cbbf000000", + "x-ms-client-request-id" : "1243a171-5c46-4218-8325-0b93faf64a62" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdownloadtofileexists&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" : "3c00f618-8d0f-4ba4-b262-b5e0bb445e55" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca32b5-301e-0042-5649-67cbbf000000", + "Body" : "jtcdownloadtofileexistsjtcdownloadtofileexists0795060213cb6f15ad44568Mon, 09 Sep 2019 20:04:32 GMT\"0x8D73560EDFDAE91\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:32 GMT", + "x-ms-client-request-id" : "3c00f618-8d0f-4ba4-b262-b5e0bb445e55", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadtofileexists0795060213cb6f15ad44568?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" : "f5595df9-d49f-429c-ab38-2f2357f01689" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca32c4-301e-0042-6549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:32 GMT", + "x-ms-client-request-id" : "f5595df9-d49f-429c-ab38-2f2357f01689" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadtofileexists0795060213cb6f15ad44568", "javablobdownloadtofileexists1997099a52b736eb7049" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadwithretryrange.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadwithretryrange.json new file mode 100644 index 000000000000..c1bfff45f443 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestdownloadwithretryrange.json @@ -0,0 +1,250 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadwithretryrange002181c3b322eb573a4b5c?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" : "696126eb-d1db-4ab2-af95-3cfccb68abc1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560E8627CBB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca2a85-301e-0042-6449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:22 GMT", + "x-ms-client-request-id" : "696126eb-d1db-4ab2-af95-3cfccb68abc1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadwithretryrange002181c3b322eb573a4b5c/javablobdownloadwithretryrange175818a228bb1526be4", + "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" : "03040b7e-ad25-4cb7-96f7-73d7af3f5f26", + "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 20:04:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560E86F9985\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca2a9a-301e-0042-7549-67cbbf000000", + "x-ms-client-request-id" : "03040b7e-ad25-4cb7-96f7-73d7af3f5f26" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadwithretryrange002181c3b322eb573a4b5c/javablobdownloadwithretryrange175818a228bb1526be4", + "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" : "b06fea75-3e8c-46fa-a074-758f9af87b1c" + }, + "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", + "Content-Range" : "bytes 2-6/7", + "x-ms-lease-state" : "available", + "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:22 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Mon, 09 Sep 2019 20:04:23 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560E86F9985\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:22 GMT", + "Content-Length" : "5", + "x-ms-request-id" : "c5ca2aac-301e-0042-0749-67cbbf000000", + "Body" : "[102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "b06fea75-3e8c-46fa-a074-758f9af87b1c", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadwithretryrange002181c3b322eb573a4b5c/javablobdownloadwithretryrange175818a228bb1526be4", + "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" : "305ca8c7-a4fb-48f3-9bb3-b7f36bc97441" + }, + "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", + "Content-Range" : "bytes 2-6/7", + "x-ms-lease-state" : "available", + "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:22 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Mon, 09 Sep 2019 20:04:23 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560E86F9985\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:22 GMT", + "Content-Length" : "5", + "x-ms-request-id" : "c5ca2ad9-301e-0042-2c49-67cbbf000000", + "Body" : "[102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "305ca8c7-a4fb-48f3-9bb3-b7f36bc97441", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadwithretryrange002181c3b322eb573a4b5c/javablobdownloadwithretryrange175818a228bb1526be4", + "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" : "d26fb3b0-8fef-4b5d-9c1b-81fd0b38974d" + }, + "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", + "Content-Range" : "bytes 2-6/7", + "x-ms-lease-state" : "available", + "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:22 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Mon, 09 Sep 2019 20:04:23 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560E86F9985\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:22 GMT", + "Content-Length" : "5", + "x-ms-request-id" : "c5ca2af2-301e-0042-4049-67cbbf000000", + "Body" : "[102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "d26fb3b0-8fef-4b5d-9c1b-81fd0b38974d", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadwithretryrange002181c3b322eb573a4b5c/javablobdownloadwithretryrange175818a228bb1526be4", + "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" : "21068bfe-ff63-49a6-83d8-58dc550c011d" + }, + "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", + "Content-Range" : "bytes 2-6/7", + "x-ms-lease-state" : "available", + "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:22 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Mon, 09 Sep 2019 20:04:23 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560E86F9985\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:22 GMT", + "Content-Length" : "5", + "x-ms-request-id" : "c5ca2b03-301e-0042-5149-67cbbf000000", + "Body" : "[102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "21068bfe-ff63-49a6-83d8-58dc550c011d", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadwithretryrange002181c3b322eb573a4b5c/javablobdownloadwithretryrange175818a228bb1526be4", + "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" : "133af7cd-df9a-4763-b932-c2444cc4fafd" + }, + "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", + "Content-Range" : "bytes 2-6/7", + "x-ms-lease-state" : "available", + "x-ms-blob-content-md5" : "wh+Wm18D0z1D4E+PE252gg==", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:22 GMT", + "retry-after" : "0", + "StatusCode" : "206", + "Date" : "Mon, 09 Sep 2019 20:04:23 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560E86F9985\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:22 GMT", + "Content-Length" : "5", + "x-ms-request-id" : "c5ca2b17-301e-0042-6349-67cbbf000000", + "Body" : "[102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "133af7cd-df9a-4763-b932-c2444cc4fafd", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdownloadwithretryrange&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" : "fbd06ad3-b23c-4f65-8037-427ae35f312b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca2b29-301e-0042-7449-67cbbf000000", + "Body" : "jtcdownloadwithretryrangejtcdownloadwithretryrange002181c3b322eb573a4b5cMon, 09 Sep 2019 20:04:22 GMT\"0x8D73560E8627CBB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:23 GMT", + "x-ms-client-request-id" : "fbd06ad3-b23c-4f65-8037-427ae35f312b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdownloadwithretryrange002181c3b322eb573a4b5c?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" : "81e40de3-2083-4504-98a5-9c13dc481977" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca2b34-301e-0042-7f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:23 GMT", + "x-ms-client-request-id" : "81e40de3-2083-4504-98a5-9c13dc481977" + }, + "Exception" : null + } ], + "variables" : [ "jtcdownloadwithretryrange002181c3b322eb573a4b5c", "javablobdownloadwithretryrange175818a228bb1526be4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetaccountinfo.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetaccountinfo.json new file mode 100644 index 000000000000..86ceb25863ae --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetaccountinfo.json @@ -0,0 +1,111 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccountinfo0blobapitestgetaccountinfoce676908a90c65?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" : "acbd4b37-b0d1-4bbc-83ca-853aacf9b1e7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356175CA89D9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb174f-301e-0042-3f4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:19 GMT", + "x-ms-client-request-id" : "acbd4b37-b0d1-4bbc-83ca-853aacf9b1e7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccountinfo0blobapitestgetaccountinfoce676908a90c65/javablobgetaccountinfo1blobapitestgetaccountinfoce68777728b", + "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" : "a80c0436-381b-4d54-bcb9-c030d785cbb7", + "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 20:08:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356175D765E4\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cb1763-301e-0042-524a-67cbbf000000", + "x-ms-client-request-id" : "a80c0436-381b-4d54-bcb9-c030d785cbb7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=account&comp=properties", + "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" : "203a565d-3b2f-4d88-adc9-777c0c8bd671" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-account-kind" : "StorageV2", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-sku-name" : "Standard_RAGRS", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb1779-301e-0042-674a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:19 GMT", + "x-ms-client-request-id" : "203a565d-3b2f-4d88-adc9-777c0c8bd671" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetaccountinfo&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" : "68b20bdd-c19c-4696-a391-12e000962231" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb1783-301e-0042-714a-67cbbf000000", + "Body" : "jtcgetaccountinfojtcgetaccountinfo0blobapitestgetaccountinfoce676908a90c65Mon, 09 Sep 2019 20:08:20 GMT\"0x8D7356175CA89D9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:19 GMT", + "x-ms-client-request-id" : "68b20bdd-c19c-4696-a391-12e000962231", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccountinfo0blobapitestgetaccountinfoce676908a90c65?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" : "2fe61d45-08e0-4ea6-872d-f67d3245aa1b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb179a-301e-0042-044a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:19 GMT", + "x-ms-client-request-id" : "2fe61d45-08e0-4ea6-872d-f67d3245aa1b" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfo0blobapitestgetaccountinfoce676908a90c65", "javablobgetaccountinfo1blobapitestgetaccountinfoce68777728b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetaccountinfoerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetaccountinfoerror.json new file mode 100644 index 000000000000..fa1e117a8ea9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetaccountinfoerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccountinfoerror0blobapitestgetaccountinfoerror854002198?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" : "1a6868fa-c4e6-42df-ab29-a7ccddbf6e66" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617648D159\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1810-301e-0042-734a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:20 GMT", + "x-ms-client-request-id" : "1a6868fa-c4e6-42df-ab29-a7ccddbf6e66" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccountinfoerror0blobapitestgetaccountinfoerror854002198/javablobgetaccountinfoerror156818eb286ef6966b491", + "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" : "c19f6984-efc1-47fe-b69e-0243f7cd65d2", + "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 20:08:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735617655FBFA\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cb1828-301e-0042-074a-67cbbf000000", + "x-ms-client-request-id" : "c19f6984-efc1-47fe-b69e-0243f7cd65d2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccountinfoerror2blobapitestgetaccountinfoerror854224714/javablobgetaccountinfoerror338981b71c381e1b224eb?restype=account&comp=properties", + "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" : "1f168259-00ea-43bc-9b73-a91a693e49af" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "c5cb1845-301e-0042-234a-67cbbf000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:c5cb1845-301e-0042-234a-67cbbf000000\nTime:2019-09-09T20:08:21.0459218Z", + "Date" : "Mon, 09 Sep 2019 20:08:20 GMT", + "x-ms-client-request-id" : "1f168259-00ea-43bc-9b73-a91a693e49af", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetaccountinfoerror&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" : "7f482b8b-c9a9-48ed-857c-538fbb828e9b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb1864-301e-0042-414a-67cbbf000000", + "Body" : "jtcgetaccountinfoerrorjtcgetaccountinfoerror0blobapitestgetaccountinfoerror854002198Mon, 09 Sep 2019 20:08:20 GMT\"0x8D735617648D159\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:20 GMT", + "x-ms-client-request-id" : "7f482b8b-c9a9-48ed-857c-538fbb828e9b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccountinfoerror0blobapitestgetaccountinfoerror854002198?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" : "d598bc2d-ea83-4945-9a42-430623faaffa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb1880-301e-0042-5d4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:20 GMT", + "x-ms-client-request-id" : "d598bc2d-ea83-4945-9a42-430623faaffa" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfoerror0blobapitestgetaccountinfoerror854002198", "javablobgetaccountinfoerror156818eb286ef6966b491", "jtcgetaccountinfoerror2blobapitestgetaccountinfoerror854224714", "javablobgetaccountinfoerror338981b71c381e1b224eb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetaccountinfomin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetaccountinfomin.json new file mode 100644 index 000000000000..9d511b46b8bc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetaccountinfomin.json @@ -0,0 +1,111 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccountinfomin0blobapitestgetaccountinfominb1e6713938f?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" : "ac118365-db30-4b08-8a02-a40d2521f253" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356176099A0C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb17ba-301e-0042-234a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:20 GMT", + "x-ms-client-request-id" : "ac118365-db30-4b08-8a02-a40d2521f253" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccountinfomin0blobapitestgetaccountinfominb1e6713938f/javablobgetaccountinfomin1blobapitestgetaccountinfominb1e73187", + "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" : "851bf523-5f0c-44a9-9970-8749fe1a251d", + "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 20:08:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356176164F34\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cb17cc-301e-0042-344a-67cbbf000000", + "x-ms-client-request-id" : "851bf523-5f0c-44a9-9970-8749fe1a251d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccountinfomin0blobapitestgetaccountinfominb1e6713938f/javablobgetaccountinfomin1blobapitestgetaccountinfominb1e73187?restype=account&comp=properties", + "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" : "7e1bcf3f-f0d5-4b9c-aa89-6675dfe849ca" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-account-kind" : "StorageV2", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-sku-name" : "Standard_RAGRS", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb17da-301e-0042-424a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:20 GMT", + "x-ms-client-request-id" : "7e1bcf3f-f0d5-4b9c-aa89-6675dfe849ca" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetaccountinfomin&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" : "f5559ada-f747-4c63-9bfe-fcb73ecfdd78" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb17e6-301e-0042-4c4a-67cbbf000000", + "Body" : "jtcgetaccountinfominjtcgetaccountinfomin0blobapitestgetaccountinfominb1e6713938fMon, 09 Sep 2019 20:08:20 GMT\"0x8D7356176099A0C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:20 GMT", + "x-ms-client-request-id" : "f5559ada-f747-4c63-9bfe-fcb73ecfdd78", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccountinfomin0blobapitestgetaccountinfominb1e6713938f?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" : "3e86f88b-c95a-4d7d-a695-b4f6850c9bcc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb17f7-301e-0042-5b4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:20 GMT", + "x-ms-client-request-id" : "3e86f88b-c95a-4d7d-a695-b4f6850c9bcc" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfomin0blobapitestgetaccountinfominb1e6713938f", "javablobgetaccountinfomin1blobapitestgetaccountinfominb1e73187" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[0].json new file mode 100644 index 000000000000..761c62642186 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[0].json @@ -0,0 +1,122 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesacb2b84215fd828?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" : "c72ed818-9f19-4279-8166-d1f570a7d852" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560EF103AFF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca3480-301e-0042-7f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:34 GMT", + "x-ms-client-request-id" : "c72ed818-9f19-4279-8166-d1f570a7d852" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesacb2b84215fd828/javablobgetpropertiesac1blobapitestgetpropertiesacb2b3507286", + "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" : "926866ef-524e-409e-9081-46be84fe1a08", + "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 20:04:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:34 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560EF1D0975\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca3494-301e-0042-1149-67cbbf000000", + "x-ms-client-request-id" : "926866ef-524e-409e-9081-46be84fe1a08" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesacb2b84215fd828/javablobgetpropertiesac1blobapitestgetpropertiesacb2b3507286", + "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" : "3897e196-2a65-4872-ac03-b8b596894c99" + }, + "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 20:04:34 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:34 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560EF1D0975\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:34 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca34a6-301e-0042-2349-67cbbf000000", + "x-ms-client-request-id" : "3897e196-2a65-4872-ac03-b8b596894c99", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpropertiesac&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" : "8a7a87ad-6f09-42cd-9b6e-68e1cbb22082" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca34b4-301e-0042-3149-67cbbf000000", + "Body" : "jtcgetpropertiesacjtcgetpropertiesac0blobapitestgetpropertiesacb2b84215fd828Mon, 09 Sep 2019 20:04:34 GMT\"0x8D73560EF103AFF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:34 GMT", + "x-ms-client-request-id" : "8a7a87ad-6f09-42cd-9b6e-68e1cbb22082", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesacb2b84215fd828?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" : "14bdba5f-18f5-41a9-a8dd-3f6970bd727f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca34cc-301e-0042-4749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:34 GMT", + "x-ms-client-request-id" : "14bdba5f-18f5-41a9-a8dd-3f6970bd727f" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesac0blobapitestgetpropertiesacb2b84215fd828", "javablobgetpropertiesac1blobapitestgetpropertiesacb2b3507286" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[1].json new file mode 100644 index 000000000000..aa5321a5360c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[1].json @@ -0,0 +1,122 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesacf1445286b7d37?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" : "652b240e-bfe9-40f6-a24a-980adfd56857" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560EF4FC094\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca34da-301e-0042-5549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:34 GMT", + "x-ms-client-request-id" : "652b240e-bfe9-40f6-a24a-980adfd56857" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesacf1445286b7d37/javablobgetpropertiesac1blobapitestgetpropertiesacf14346308c", + "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" : "3e9603d9-3872-4165-a7a2-22a53a8cb4ab", + "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 20:04:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:34 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560EF5DEED8\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca34eb-301e-0042-6249-67cbbf000000", + "x-ms-client-request-id" : "3e9603d9-3872-4165-a7a2-22a53a8cb4ab" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesacf1445286b7d37/javablobgetpropertiesac1blobapitestgetpropertiesacf14346308c", + "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" : "a06ab209-280b-45d4-a103-8e9af78ab560" + }, + "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 20:04:34 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:34 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560EF5DEED8\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:34 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca34fe-301e-0042-7349-67cbbf000000", + "x-ms-client-request-id" : "a06ab209-280b-45d4-a103-8e9af78ab560", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpropertiesac&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" : "bdd1b195-f8e2-4f3e-92af-f5c3794ffb71" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca351a-301e-0042-0c49-67cbbf000000", + "Body" : "jtcgetpropertiesacjtcgetpropertiesac0blobapitestgetpropertiesacf1445286b7d37Mon, 09 Sep 2019 20:04:34 GMT\"0x8D73560EF4FC094\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:34 GMT", + "x-ms-client-request-id" : "bdd1b195-f8e2-4f3e-92af-f5c3794ffb71", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesacf1445286b7d37?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" : "3efa7f74-4704-4730-924b-942ee9423fe8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca352e-301e-0042-1f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:34 GMT", + "x-ms-client-request-id" : "3efa7f74-4704-4730-924b-942ee9423fe8" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesac0blobapitestgetpropertiesacf1445286b7d37", "javablobgetpropertiesac1blobapitestgetpropertiesacf14346308c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[2].json new file mode 100644 index 000000000000..c3f5dd53920d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[2].json @@ -0,0 +1,122 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac51c06209dd7df?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" : "cc9b2ffe-1286-410f-a9e6-10c46acf3382" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560EF938C9F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca3543-301e-0042-3249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:34 GMT", + "x-ms-client-request-id" : "cc9b2ffe-1286-410f-a9e6-10c46acf3382" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac51c06209dd7df/javablobgetpropertiesac1blobapitestgetpropertiesac51c2462141", + "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" : "2c98bf3d-1be3-4b2a-a440-2ad04916916e", + "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 20:04:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:34 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560EFA05B1E\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca355b-301e-0042-4949-67cbbf000000", + "x-ms-client-request-id" : "2c98bf3d-1be3-4b2a-a440-2ad04916916e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac51c06209dd7df/javablobgetpropertiesac1blobapitestgetpropertiesac51c2462141", + "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" : "0c42cfea-ad52-44a3-8b7a-b496c0bfd4f4" + }, + "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 20:04:34 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:35 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560EFA05B1E\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:34 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca3579-301e-0042-6549-67cbbf000000", + "x-ms-client-request-id" : "0c42cfea-ad52-44a3-8b7a-b496c0bfd4f4", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpropertiesac&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" : "3e60c6ed-94e4-4fbd-b93c-15fe3346322f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca3591-301e-0042-7c49-67cbbf000000", + "Body" : "jtcgetpropertiesacjtcgetpropertiesac0blobapitestgetpropertiesac51c06209dd7dfMon, 09 Sep 2019 20:04:34 GMT\"0x8D73560EF938C9F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:35 GMT", + "x-ms-client-request-id" : "3e60c6ed-94e4-4fbd-b93c-15fe3346322f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac51c06209dd7df?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" : "7c25c468-6bf0-4daa-affb-cd2e86b3de66" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca35a1-301e-0042-0c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:35 GMT", + "x-ms-client-request-id" : "7c25c468-6bf0-4daa-affb-cd2e86b3de66" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesac0blobapitestgetpropertiesac51c06209dd7df", "javablobgetpropertiesac1blobapitestgetpropertiesac51c2462141" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[3].json new file mode 100644 index 000000000000..03db3504a44c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[3].json @@ -0,0 +1,154 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesacd1262939d6dee?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" : "0f42625c-4629-4a60-b064-3c892fd9b971" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560EFD5838A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca35b7-301e-0042-2249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:35 GMT", + "x-ms-client-request-id" : "0f42625c-4629-4a60-b064-3c892fd9b971" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesacd1262939d6dee/javablobgetpropertiesac1blobapitestgetpropertiesacd12904372f", + "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" : "15f84c67-bb65-40ee-aa10-a713acddb7f7", + "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 20:04:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560EFE2A054\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca35d0-301e-0042-3749-67cbbf000000", + "x-ms-client-request-id" : "15f84c67-bb65-40ee-aa10-a713acddb7f7" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesacd1262939d6dee/javablobgetpropertiesac1blobapitestgetpropertiesacd12904372f", + "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" : "779d73b4-6486-4fa7-beea-7b72f7638947" + }, + "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 20:04:35 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:35 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560EFE2A054\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:35 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca35e5-301e-0042-4b49-67cbbf000000", + "x-ms-client-request-id" : "779d73b4-6486-4fa7-beea-7b72f7638947", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesacd1262939d6dee/javablobgetpropertiesac1blobapitestgetpropertiesacd12904372f", + "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" : "3d1e8938-fead-4fd0-86b9-58b897970607" + }, + "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 20:04:35 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:35 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560EFE2A054\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:35 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca35f5-301e-0042-5a49-67cbbf000000", + "x-ms-client-request-id" : "3d1e8938-fead-4fd0-86b9-58b897970607", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpropertiesac&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" : "5b248608-e0eb-4481-9300-57f3a3b6ebb1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca35ff-301e-0042-6449-67cbbf000000", + "Body" : "jtcgetpropertiesacjtcgetpropertiesac0blobapitestgetpropertiesacd1262939d6deeMon, 09 Sep 2019 20:04:35 GMT\"0x8D73560EFD5838A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:35 GMT", + "x-ms-client-request-id" : "5b248608-e0eb-4481-9300-57f3a3b6ebb1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesacd1262939d6dee?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" : "b3fde2f7-631f-4f92-9c8a-2d886b8ab7bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca3611-301e-0042-7349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:35 GMT", + "x-ms-client-request-id" : "b3fde2f7-631f-4f92-9c8a-2d886b8ab7bf" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesac0blobapitestgetpropertiesacd1262939d6dee", "javablobgetpropertiesac1blobapitestgetpropertiesacd12904372f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[4].json new file mode 100644 index 000000000000..43088aff8857 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[4].json @@ -0,0 +1,122 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesacea296869e0d2f?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" : "ed6859b7-f072-44c0-a4be-815eee57c95e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F023B1B9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca3625-301e-0042-0549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:35 GMT", + "x-ms-client-request-id" : "ed6859b7-f072-44c0-a4be-815eee57c95e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesacea296869e0d2f/javablobgetpropertiesac1blobapitestgetpropertiesacea20181240", + "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" : "5ec92811-6de8-4958-9a3e-32e7161a03ec", + "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 20:04:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F030F5A9\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca362d-301e-0042-0c49-67cbbf000000", + "x-ms-client-request-id" : "5ec92811-6de8-4958-9a3e-32e7161a03ec" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesacea296869e0d2f/javablobgetpropertiesac1blobapitestgetpropertiesacea20181240", + "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" : "ac8d0aa0-536d-4873-b4ef-c4c630cc6dd3" + }, + "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 20:04:35 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:35 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560F030F5A9\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:35 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca3645-301e-0042-2249-67cbbf000000", + "x-ms-client-request-id" : "ac8d0aa0-536d-4873-b4ef-c4c630cc6dd3", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpropertiesac&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" : "7086031c-4ce3-4e54-8af9-4b9652d07d74" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca3653-301e-0042-3049-67cbbf000000", + "Body" : "jtcgetpropertiesacjtcgetpropertiesac0blobapitestgetpropertiesacea296869e0d2fMon, 09 Sep 2019 20:04:35 GMT\"0x8D73560F023B1B9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:36 GMT", + "x-ms-client-request-id" : "7086031c-4ce3-4e54-8af9-4b9652d07d74", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesacea296869e0d2f?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" : "e6494f50-e6e9-4715-9cf8-b59a86d32295" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca3668-301e-0042-4549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:36 GMT", + "x-ms-client-request-id" : "e6494f50-e6e9-4715-9cf8-b59a86d32295" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesac0blobapitestgetpropertiesacea296869e0d2f", "javablobgetpropertiesac1blobapitestgetpropertiesacea20181240" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[5].json new file mode 100644 index 000000000000..5bd7c474365c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesac[5].json @@ -0,0 +1,145 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac04d73877923c1?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" : "ebdeb48a-4c9c-48fa-9c7c-f5facd8c5bdf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F063AC95\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca3684-301e-0042-5f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:36 GMT", + "x-ms-client-request-id" : "ebdeb48a-4c9c-48fa-9c7c-f5facd8c5bdf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac04d73877923c1/javablobgetpropertiesac1blobapitestgetpropertiesac04d06126de", + "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" : "c6913a55-41aa-4559-a061-dbe0ad31cdcc", + "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 20:04:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:36 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F0702D0C\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca3693-301e-0042-6d49-67cbbf000000", + "x-ms-client-request-id" : "c6913a55-41aa-4559-a061-dbe0ad31cdcc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac04d73877923c1/javablobgetpropertiesac1blobapitestgetpropertiesac04d06126de?comp=lease", + "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" : "b17c5b2a-7adb-4703-8517-b049a13ead14" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F0702D0C\"", + "x-ms-lease-id" : "d24b234f-9476-400e-ace9-f3ff27d17841", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca36ad-301e-0042-0549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:36 GMT", + "x-ms-client-request-id" : "b17c5b2a-7adb-4703-8517-b049a13ead14" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac04d73877923c1/javablobgetpropertiesac1blobapitestgetpropertiesac04d06126de", + "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" : "c428eeb7-0a78-43f2-9e69-912e5cfc250a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "leased", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:36 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:36 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560F0702D0C\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:36 GMT", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca36cf-301e-0042-2249-67cbbf000000", + "x-ms-client-request-id" : "c428eeb7-0a78-43f2-9e69-912e5cfc250a", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpropertiesac&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" : "a0da4f11-87f2-43e2-b3db-7f655469ed19" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca36e3-301e-0042-3449-67cbbf000000", + "Body" : "jtcgetpropertiesacjtcgetpropertiesac0blobapitestgetpropertiesac04d73877923c1Mon, 09 Sep 2019 20:04:36 GMT\"0x8D73560F063AC95\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:36 GMT", + "x-ms-client-request-id" : "a0da4f11-87f2-43e2-b3db-7f655469ed19", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesac0blobapitestgetpropertiesac04d73877923c1?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" : "09e8ed3f-415e-4395-bdd1-58958dff522e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca3701-301e-0042-5249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:36 GMT", + "x-ms-client-request-id" : "09e8ed3f-415e-4395-bdd1-58958dff522e" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesac0blobapitestgetpropertiesac04d73877923c1", "javablobgetpropertiesac1blobapitestgetpropertiesac04d06126de" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[0].json new file mode 100644 index 000000000000..077936d9567b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[0].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfaild2c201396?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" : "32773651-70cd-4bfc-9ccc-290afdad8c44" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F0B0F04B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca3719-301e-0042-6949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:36 GMT", + "x-ms-client-request-id" : "32773651-70cd-4bfc-9ccc-290afdad8c44" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfaild2c201396/javablobgetpropertiesacfail102788cd01212c4dbe4db", + "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" : "224722c3-9865-4025-9c05-c8912ee7251e", + "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 20:04:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:36 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F0BED08B\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca3742-301e-0042-0e49-67cbbf000000", + "x-ms-client-request-id" : "224722c3-9865-4025-9c05-c8912ee7251e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfaild2c201396/javablobgetpropertiesacfail102788cd01212c4dbe4db", + "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" : "c66827e6-3c67-4a5e-b82e-dabe63285e06" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "c5ca3756-301e-0042-2249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:36 GMT", + "x-ms-client-request-id" : "c66827e6-3c67-4a5e-b82e-dabe63285e06" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpropertiesacfail&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" : "03a620e6-d363-4ded-aae1-c895ab5b4bb8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca3761-301e-0042-2d49-67cbbf000000", + "Body" : "jtcgetpropertiesacfailjtcgetpropertiesacfail0blobapitestgetpropertiesacfaild2c201396Mon, 09 Sep 2019 20:04:36 GMT\"0x8D73560F0B0F04B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:36 GMT", + "x-ms-client-request-id" : "03a620e6-d363-4ded-aae1-c895ab5b4bb8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfaild2c201396?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" : "cc4daedf-af3f-4142-954d-e19802666891" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca377b-301e-0042-4549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:37 GMT", + "x-ms-client-request-id" : "cc4daedf-af3f-4142-954d-e19802666891" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesacfail0blobapitestgetpropertiesacfaild2c201396", "javablobgetpropertiesacfail102788cd01212c4dbe4db" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[1].json new file mode 100644 index 000000000000..c6e3cbbf9db1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[1].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfailacc244788?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" : "ba1bc844-f2d7-49a1-b5f2-74c8a759ec17" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F0F29924\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca379b-301e-0042-6049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:37 GMT", + "x-ms-client-request-id" : "ba1bc844-f2d7-49a1-b5f2-74c8a759ec17" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfailacc244788/javablobgetpropertiesacfail14845511994d2a9e84452", + "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" : "6d8fffda-45d0-4709-a922-588ec5980fd8", + "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 20:04:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F100795C\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca37bb-301e-0042-7f49-67cbbf000000", + "x-ms-client-request-id" : "6d8fffda-45d0-4709-a922-588ec5980fd8" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfailacc244788/javablobgetpropertiesacfail14845511994d2a9e84452", + "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" : "b2d0ce9f-d393-4336-9487-699debaf9533" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca37c9-301e-0042-0d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:37 GMT", + "x-ms-client-request-id" : "b2d0ce9f-d393-4336-9487-699debaf9533" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpropertiesacfail&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" : "f066e2a1-3b06-48c7-8dc4-6e842850471b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca37ed-301e-0042-3049-67cbbf000000", + "Body" : "jtcgetpropertiesacfailjtcgetpropertiesacfail0blobapitestgetpropertiesacfailacc244788Mon, 09 Sep 2019 20:04:37 GMT\"0x8D73560F0F29924\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:37 GMT", + "x-ms-client-request-id" : "f066e2a1-3b06-48c7-8dc4-6e842850471b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfailacc244788?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" : "b7d376d2-e6d8-48a6-a684-69fbed91d36c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca37fc-301e-0042-3f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:37 GMT", + "x-ms-client-request-id" : "b7d376d2-e6d8-48a6-a684-69fbed91d36c" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesacfail0blobapitestgetpropertiesacfailacc244788", "javablobgetpropertiesacfail14845511994d2a9e84452" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[2].json new file mode 100644 index 000000000000..bcd2b0d7e263 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[2].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail61935795a?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" : "c4b7921b-c5d8-4caf-8552-b3c4a89e799a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F1346911\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca3816-301e-0042-5649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:37 GMT", + "x-ms-client-request-id" : "c4b7921b-c5d8-4caf-8552-b3c4a89e799a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail61935795a/javablobgetpropertiesacfail1458252905fad337b1447", + "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" : "dc82902b-fc1e-4250-8529-ac3d45a807fe", + "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 20:04:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F141108C\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca383f-301e-0042-7a49-67cbbf000000", + "x-ms-client-request-id" : "dc82902b-fc1e-4250-8529-ac3d45a807fe" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail61935795a/javablobgetpropertiesacfail1458252905fad337b1447", + "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" : "4e884867-604b-46d7-bda6-07484f808d87" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca3859-301e-0042-1249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:37 GMT", + "x-ms-client-request-id" : "4e884867-604b-46d7-bda6-07484f808d87" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpropertiesacfail&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" : "89c130b7-cbb5-438e-bf83-384b99b2327a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca386d-301e-0042-2149-67cbbf000000", + "Body" : "jtcgetpropertiesacfailjtcgetpropertiesacfail0blobapitestgetpropertiesacfail61935795aMon, 09 Sep 2019 20:04:37 GMT\"0x8D73560F1346911\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:37 GMT", + "x-ms-client-request-id" : "89c130b7-cbb5-438e-bf83-384b99b2327a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail61935795a?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" : "b06bf996-e647-4a50-a7bf-47347ac68690" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca3892-301e-0042-4649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:37 GMT", + "x-ms-client-request-id" : "b06bf996-e647-4a50-a7bf-47347ac68690" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesacfail0blobapitestgetpropertiesacfail61935795a", "javablobgetpropertiesacfail1458252905fad337b1447" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[3].json new file mode 100644 index 000000000000..c2102425e67b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[3].json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfailfac140513?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" : "d9e2c882-62e0-4ab6-8736-ec032bfc42ed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F1748B02\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca38ab-301e-0042-5f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:38 GMT", + "x-ms-client-request-id" : "d9e2c882-62e0-4ab6-8736-ec032bfc42ed" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfailfac140513/javablobgetpropertiesacfail1924477c1b968f71a6442", + "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" : "00a9cc7a-40d5-48c6-8d1a-595480ad23ac", + "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 20:04:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:38 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F181CEDA\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca38ce-301e-0042-7f49-67cbbf000000", + "x-ms-client-request-id" : "00a9cc7a-40d5-48c6-8d1a-595480ad23ac" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfailfac140513/javablobgetpropertiesacfail1924477c1b968f71a6442", + "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" : "085be352-0be1-479c-a36d-52adfad2235f" + }, + "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 20:04:38 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:38 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560F181CEDA\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:38 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca38f4-301e-0042-2249-67cbbf000000", + "x-ms-client-request-id" : "085be352-0be1-479c-a36d-52adfad2235f", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfailfac140513/javablobgetpropertiesacfail1924477c1b968f71a6442", + "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" : "3352766d-e6aa-42de-898d-54572b582555" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "c5ca3914-301e-0042-4249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:38 GMT", + "x-ms-client-request-id" : "3352766d-e6aa-42de-898d-54572b582555" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpropertiesacfail&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" : "40014dd6-800b-4836-9f88-ea3d410d1d11" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca393a-301e-0042-6849-67cbbf000000", + "Body" : "jtcgetpropertiesacfailjtcgetpropertiesacfail0blobapitestgetpropertiesacfailfac140513Mon, 09 Sep 2019 20:04:38 GMT\"0x8D73560F1748B02\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:38 GMT", + "x-ms-client-request-id" : "40014dd6-800b-4836-9f88-ea3d410d1d11", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfailfac140513?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" : "eb091bb1-e1a3-45f6-9e4f-9312ea6cf2c3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca396a-301e-0042-1649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:38 GMT", + "x-ms-client-request-id" : "eb091bb1-e1a3-45f6-9e4f-9312ea6cf2c3" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesacfail0blobapitestgetpropertiesacfailfac140513", "javablobgetpropertiesacfail1924477c1b968f71a6442" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[4].json new file mode 100644 index 000000000000..7d574a5511c6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesacfail[4].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail308642405?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" : "a8e0ab80-6212-496f-904f-e503b4a47352" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F1C2B93E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca3993-301e-0042-3d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:38 GMT", + "x-ms-client-request-id" : "a8e0ab80-6212-496f-904f-e503b4a47352" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail308642405/javablobgetpropertiesacfail109510754b5ea701ce47a", + "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" : "aa595a8a-39d5-4afb-a05c-b750a4cfab85", + "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 20:04:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:38 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F1CFFD17\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca39a8-301e-0042-5049-67cbbf000000", + "x-ms-client-request-id" : "aa595a8a-39d5-4afb-a05c-b750a4cfab85" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail308642405/javablobgetpropertiesacfail109510754b5ea701ce47a?comp=lease", + "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" : "884908f7-b3c7-48b8-966a-de37e4b3c788" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F1CFFD17\"", + "x-ms-lease-id" : "9499c39c-5525-4eeb-8533-e6984a5440c4", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca39c2-301e-0042-6949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:38 GMT", + "x-ms-client-request-id" : "884908f7-b3c7-48b8-966a-de37e4b3c788" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail308642405/javablobgetpropertiesacfail109510754b5ea701ce47a", + "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" : "bd0a45fa-99e2-43dd-9964-ecdb58ba1954" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca39df-301e-0042-0349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:38 GMT", + "x-ms-client-request-id" : "bd0a45fa-99e2-43dd-9964-ecdb58ba1954" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpropertiesacfail&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" : "23cf5259-cf94-472a-b896-2df2117a2ab9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca39fa-301e-0042-1c49-67cbbf000000", + "Body" : "jtcgetpropertiesacfailjtcgetpropertiesacfail0blobapitestgetpropertiesacfail308642405Mon, 09 Sep 2019 20:04:38 GMT\"0x8D73560F1C2B93E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:38 GMT", + "x-ms-client-request-id" : "23cf5259-cf94-472a-b896-2df2117a2ab9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesacfail0blobapitestgetpropertiesacfail308642405?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" : "172640e6-2c04-4e04-aeaa-0f57121c869b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca3a0d-301e-0042-2f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:38 GMT", + "x-ms-client-request-id" : "172640e6-2c04-4e04-aeaa-0f57121c869b" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesacfail0blobapitestgetpropertiesacfail308642405", "javablobgetpropertiesacfail109510754b5ea701ce47a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesdefault.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesdefault.json new file mode 100644 index 000000000000..279aef8a63b5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesdefault.json @@ -0,0 +1,122 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesdefault030151c1a25c7037e345bdb?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" : "af4794f1-cf55-46ce-8867-dfc4a63763cd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560EE90454B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca338d-301e-0042-1e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:33 GMT", + "x-ms-client-request-id" : "af4794f1-cf55-46ce-8867-dfc4a63763cd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesdefault030151c1a25c7037e345bdb/javablobgetpropertiesdefault112661f0501822903244", + "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" : "13777060-7bac-4114-8133-3a71d081ae22", + "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 20:04:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:33 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560EE9D61FB\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca33a5-301e-0042-3449-67cbbf000000", + "x-ms-client-request-id" : "13777060-7bac-4114-8133-3a71d081ae22" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesdefault030151c1a25c7037e345bdb/javablobgetpropertiesdefault112661f0501822903244", + "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" : "b322ea94-0451-4e49-be33-7b88494118a9" + }, + "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 20:04:33 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:33 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560EE9D61FB\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:33 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca33c0-301e-0042-4e49-67cbbf000000", + "x-ms-client-request-id" : "b322ea94-0451-4e49-be33-7b88494118a9", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpropertiesdefault&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" : "fc05d4ed-4e54-4ddc-9fa3-f590c6a45536" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca33da-301e-0042-6749-67cbbf000000", + "Body" : "jtcgetpropertiesdefaultjtcgetpropertiesdefault030151c1a25c7037e345bdbMon, 09 Sep 2019 20:04:33 GMT\"0x8D73560EE90454B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:33 GMT", + "x-ms-client-request-id" : "fc05d4ed-4e54-4ddc-9fa3-f590c6a45536", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesdefault030151c1a25c7037e345bdb?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" : "d9300ffa-26a4-4e60-85d4-dd0370ccf9eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca33ef-301e-0042-7c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:33 GMT", + "x-ms-client-request-id" : "d9300ffa-26a4-4e60-85d4-dd0370ccf9eb" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesdefault030151c1a25c7037e345bdb", "javablobgetpropertiesdefault112661f0501822903244" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertieserror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertieserror.json new file mode 100644 index 000000000000..97a89f3abdbf --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertieserror.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertieserror0blobapitestgetpropertieserrora3b4812080?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" : "570f52bd-9003-4437-acd8-755b35e0ef59" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F2107240\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca3a3c-301e-0042-5849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:39 GMT", + "x-ms-client-request-id" : "570f52bd-9003-4437-acd8-755b35e0ef59" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertieserror0blobapitestgetpropertieserrora3b4812080/javablobgetpropertieserror1914866919234efe8642d", + "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" : "2f6ecb2a-593d-4c6c-b807-9401aba88929", + "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 20:04:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:39 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F21E526C\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca3a68-301e-0042-0249-67cbbf000000", + "x-ms-client-request-id" : "2f6ecb2a-593d-4c6c-b807-9401aba88929" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertieserror0blobapitestgetpropertieserrora3b4812080/javablobgetpropertieserror2841261cacc197c40b42e", + "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" : "84d078db-5f45-4790-8613-a42092a06f83" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "BlobNotFound", + "retry-after" : "0", + "StatusCode" : "404", + "x-ms-request-id" : "c5ca3a7e-301e-0042-1849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:39 GMT", + "x-ms-client-request-id" : "84d078db-5f45-4790-8613-a42092a06f83" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpropertieserror&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" : "a3fa012a-fdf4-4e98-8d7c-a8910580548c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca3a93-301e-0042-2d49-67cbbf000000", + "Body" : "jtcgetpropertieserrorjtcgetpropertieserror0blobapitestgetpropertieserrora3b4812080Mon, 09 Sep 2019 20:04:39 GMT\"0x8D73560F2107240\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:39 GMT", + "x-ms-client-request-id" : "a3fa012a-fdf4-4e98-8d7c-a8910580548c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertieserror0blobapitestgetpropertieserrora3b4812080?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" : "f964b3e5-c797-4ba7-8fbf-072af60f1d2e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca3ab0-301e-0042-4949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:39 GMT", + "x-ms-client-request-id" : "f964b3e5-c797-4ba7-8fbf-072af60f1d2e" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertieserror0blobapitestgetpropertieserrora3b4812080", "javablobgetpropertieserror1914866919234efe8642d", "javablobgetpropertieserror2841261cacc197c40b42e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesmin.json new file mode 100644 index 000000000000..4976493236f2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestgetpropertiesmin.json @@ -0,0 +1,122 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesmin0blobapitestgetpropertiesmin02f58405a36d?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" : "f49f9dca-6a85-4cf1-9b0c-0e066f2fa46b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560EED0190E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca33fc-301e-0042-0949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:33 GMT", + "x-ms-client-request-id" : "f49f9dca-6a85-4cf1-9b0c-0e066f2fa46b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesmin0blobapitestgetpropertiesmin02f58405a36d/javablobgetpropertiesmin1blobapitestgetpropertiesmin02f901818", + "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" : "fd23f6b0-f4e2-4928-884d-f5e08020cb76", + "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 20:04:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:33 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560EEDD5CCF\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca3429-301e-0042-2b49-67cbbf000000", + "x-ms-client-request-id" : "fd23f6b0-f4e2-4928-884d-f5e08020cb76" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesmin0blobapitestgetpropertiesmin02f58405a36d/javablobgetpropertiesmin1blobapitestgetpropertiesmin02f901818", + "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" : "09202fd0-e567-4892-9052-21a3f0586c65" + }, + "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 20:04:33 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:33 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560EEDD5CCF\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:33 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca3440-301e-0042-4149-67cbbf000000", + "x-ms-client-request-id" : "09202fd0-e567-4892-9052-21a3f0586c65", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpropertiesmin&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" : "aa85fb57-1e99-4c7d-a120-caf056b2f6f9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca3453-301e-0042-5449-67cbbf000000", + "Body" : "jtcgetpropertiesminjtcgetpropertiesmin0blobapitestgetpropertiesmin02f58405a36dMon, 09 Sep 2019 20:04:33 GMT\"0x8D73560EED0190E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:33 GMT", + "x-ms-client-request-id" : "aa85fb57-1e99-4c7d-a120-caf056b2f6f9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesmin0blobapitestgetpropertiesmin02f58405a36d?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" : "795c21a0-95d9-4618-86f1-457056c9c8cc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca3467-301e-0042-6849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:33 GMT", + "x-ms-client-request-id" : "795c21a0-95d9-4618-86f1-457056c9c8cc" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesmin0blobapitestgetpropertiesmin02f58405a36d", "javablobgetpropertiesmin1blobapitestgetpropertiesmin02f901818" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaselease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaselease.json new file mode 100644 index 000000000000..ff819fda4431 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaselease.json @@ -0,0 +1,165 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaselease0blobapitestreleaselease1416256756208a08?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" : "ab015d36-59a4-488c-9ae9-1d12ef6f3946" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610C605359\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6bb6-301e-0042-7c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:23 GMT", + "x-ms-client-request-id" : "ab015d36-59a4-488c-9ae9-1d12ef6f3946" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaselease0blobapitestreleaselease1416256756208a08/javablobreleaselease1blobapitestreleaselease14115028861a2", + "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" : "049a8cc3-8897-4d6a-85bb-4a291746b555", + "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 20:05:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735610C6E38F7\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca6bd4-301e-0042-1649-67cbbf000000", + "x-ms-client-request-id" : "049a8cc3-8897-4d6a-85bb-4a291746b555" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaselease0blobapitestreleaselease1416256756208a08/javablobreleaselease1blobapitestreleaselease14115028861a2?comp=lease", + "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" : "e09a6289-221e-4f67-89e9-609104def952" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610C6E38F7\"", + "x-ms-lease-id" : "84e7e7f9-abb2-4679-b027-2984c60a081b", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6beb-301e-0042-2849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:23 GMT", + "x-ms-client-request-id" : "e09a6289-221e-4f67-89e9-609104def952" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaselease0blobapitestreleaselease1416256756208a08/javablobreleaselease1blobapitestreleaselease14115028861a2?comp=lease", + "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" : "6eacfd66-71bf-4b08-b116-fd11cbec9318" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610C6E38F7\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca6bfe-301e-0042-3a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:23 GMT", + "x-ms-client-request-id" : "6eacfd66-71bf-4b08-b116-fd11cbec9318" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaselease0blobapitestreleaselease1416256756208a08/javablobreleaselease1blobapitestreleaselease14115028861a2", + "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" : "e8f10cbd-ce6f-4c0e-88e2-f0c78a6a1e25" + }, + "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 20:05:23 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:05:23 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735610C6E38F7\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:23 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca6c10-301e-0042-4b49-67cbbf000000", + "x-ms-client-request-id" : "e8f10cbd-ce6f-4c0e-88e2-f0c78a6a1e25", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcreleaselease&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" : "0af492df-bf3e-4386-b356-959e84490438" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca6c22-301e-0042-5d49-67cbbf000000", + "Body" : "jtcreleaseleasejtcreleaselease0blobapitestreleaselease1416256756208a08Mon, 09 Sep 2019 20:05:23 GMT\"0x8D735610C605359\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:23 GMT", + "x-ms-client-request-id" : "0af492df-bf3e-4386-b356-959e84490438", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaselease0blobapitestreleaselease1416256756208a08?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" : "c9f6cb1e-7af7-4ade-829d-e3874523a35a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca6c38-301e-0042-7349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:23 GMT", + "x-ms-client-request-id" : "c9f6cb1e-7af7-4ade-829d-e3874523a35a" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaselease0blobapitestreleaselease1416256756208a08", "javablobreleaselease1blobapitestreleaselease14115028861a2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[0].json new file mode 100644 index 000000000000..1236f2c347e5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[0].json @@ -0,0 +1,133 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac305914766381fa?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" : "c4123e90-55de-4695-baa2-2324df3e2473" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610D08BFB7\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6cca-301e-0042-7849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:24 GMT", + "x-ms-client-request-id" : "c4123e90-55de-4695-baa2-2324df3e2473" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac305914766381fa/javablobreleaseleaseac1blobapitestreleaseleaseac305327479d3", + "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" : "fa6bff70-7359-43bc-836b-7ba43da04537", + "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 20:05:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735610D15E21F\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca6cdb-301e-0042-0849-67cbbf000000", + "x-ms-client-request-id" : "fa6bff70-7359-43bc-836b-7ba43da04537" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac305914766381fa/javablobreleaseleaseac1blobapitestreleaseleaseac305327479d3?comp=lease", + "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" : "f9a9c7a3-ee2e-4d1a-b32b-0ebbe2d74e67" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610D15E21F\"", + "x-ms-lease-id" : "1fa2175f-168d-4dea-aafe-edf5b1b57c07", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6cef-301e-0042-1949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:24 GMT", + "x-ms-client-request-id" : "f9a9c7a3-ee2e-4d1a-b32b-0ebbe2d74e67" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac305914766381fa/javablobreleaseleaseac1blobapitestreleaseleaseac305327479d3?comp=lease", + "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" : "baabbc67-76cc-4da5-b4dd-9591b5790a58" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610D15E21F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca6cfc-301e-0042-2649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:24 GMT", + "x-ms-client-request-id" : "baabbc67-76cc-4da5-b4dd-9591b5790a58" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcreleaseleaseac&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" : "328ce236-346c-4d13-a174-714cfc338ad4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca6d0d-301e-0042-3749-67cbbf000000", + "Body" : "jtcreleaseleaseacjtcreleaseleaseac0blobapitestreleaseleaseac305914766381faMon, 09 Sep 2019 20:05:24 GMT\"0x8D735610D08BFB7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:24 GMT", + "x-ms-client-request-id" : "328ce236-346c-4d13-a174-714cfc338ad4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac305914766381fa?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" : "a3ca7b22-f9a5-4786-b70a-035aa91ec413" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca6d1b-301e-0042-4549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:24 GMT", + "x-ms-client-request-id" : "a3ca7b22-f9a5-4786-b70a-035aa91ec413" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseac0blobapitestreleaseleaseac305914766381fa", "javablobreleaseleaseac1blobapitestreleaseleaseac305327479d3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[1].json new file mode 100644 index 000000000000..a0f1c3ce1687 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[1].json @@ -0,0 +1,133 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacf1517505d81b78?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" : "39dbfe02-2b22-4939-9166-20ce2a532dbf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610D55B523\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6d2f-301e-0042-5949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:24 GMT", + "x-ms-client-request-id" : "39dbfe02-2b22-4939-9166-20ce2a532dbf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacf1517505d81b78/javablobreleaseleaseac1blobapitestreleaseleaseacf1521812887", + "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" : "bf8626aa-1eac-4898-bb13-3651b07879a9", + "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 20:05:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735610D62D7A2\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca6d40-301e-0042-6949-67cbbf000000", + "x-ms-client-request-id" : "bf8626aa-1eac-4898-bb13-3651b07879a9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacf1517505d81b78/javablobreleaseleaseac1blobapitestreleaseleaseacf1521812887?comp=lease", + "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" : "a35bfe87-5d51-400a-98cf-f4b3d7a83331" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610D62D7A2\"", + "x-ms-lease-id" : "109c12eb-2e6f-4484-8452-0a4b7636e718", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6d50-301e-0042-7849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:24 GMT", + "x-ms-client-request-id" : "a35bfe87-5d51-400a-98cf-f4b3d7a83331" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacf1517505d81b78/javablobreleaseleaseac1blobapitestreleaseleaseacf1521812887?comp=lease", + "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" : "abbd3cb6-f402-4f18-8215-aaff71bb6e2a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610D62D7A2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca6d62-301e-0042-0849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:24 GMT", + "x-ms-client-request-id" : "abbd3cb6-f402-4f18-8215-aaff71bb6e2a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcreleaseleaseac&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" : "0aa0648d-aa80-4142-9442-7c5e5ac2ca83" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca6d81-301e-0042-2449-67cbbf000000", + "Body" : "jtcreleaseleaseacjtcreleaseleaseac0blobapitestreleaseleaseacf1517505d81b78Mon, 09 Sep 2019 20:05:24 GMT\"0x8D735610D55B523\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:25 GMT", + "x-ms-client-request-id" : "0aa0648d-aa80-4142-9442-7c5e5ac2ca83", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacf1517505d81b78?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" : "d7270ee5-b0bf-421a-810c-bf8f2411b6ad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca6d97-301e-0042-3949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:25 GMT", + "x-ms-client-request-id" : "d7270ee5-b0bf-421a-810c-bf8f2411b6ad" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseac0blobapitestreleaseleaseacf1517505d81b78", "javablobreleaseleaseac1blobapitestreleaseleaseacf1521812887" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[2].json new file mode 100644 index 000000000000..c9d4d7de38fa --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[2].json @@ -0,0 +1,133 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac26371806ff5d06?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" : "b3a83462-9803-45c0-a2f3-eb97b4305d6c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610DA28372\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6da7-301e-0042-4849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:25 GMT", + "x-ms-client-request-id" : "b3a83462-9803-45c0-a2f3-eb97b4305d6c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac26371806ff5d06/javablobreleaseleaseac1blobapitestreleaseleaseac263447666f5", + "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" : "0f35ea29-397f-459a-9d6c-ec93c4fbd9a5", + "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 20:05:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735610DAFA60C\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca6dc0-301e-0042-5d49-67cbbf000000", + "x-ms-client-request-id" : "0f35ea29-397f-459a-9d6c-ec93c4fbd9a5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac26371806ff5d06/javablobreleaseleaseac1blobapitestreleaseleaseac263447666f5?comp=lease", + "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" : "b308ebcc-233a-4696-9899-6900d0500d91" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610DAFA60C\"", + "x-ms-lease-id" : "601f83c0-7277-4887-953f-3c2807b02d5e", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6de3-301e-0042-7c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:25 GMT", + "x-ms-client-request-id" : "b308ebcc-233a-4696-9899-6900d0500d91" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac26371806ff5d06/javablobreleaseleaseac1blobapitestreleaseleaseac263447666f5?comp=lease", + "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" : "6b665a0b-eeed-4f42-8351-544c853f0608" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610DAFA60C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca6df7-301e-0042-0f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:25 GMT", + "x-ms-client-request-id" : "6b665a0b-eeed-4f42-8351-544c853f0608" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcreleaseleaseac&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" : "01e87412-0996-4e58-a0b3-2386ba938695" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca6e07-301e-0042-1e49-67cbbf000000", + "Body" : "jtcreleaseleaseacjtcreleaseleaseac0blobapitestreleaseleaseac26371806ff5d06Mon, 09 Sep 2019 20:05:25 GMT\"0x8D735610DA28372\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:25 GMT", + "x-ms-client-request-id" : "01e87412-0996-4e58-a0b3-2386ba938695", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac26371806ff5d06?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" : "e0f123c1-2239-433e-a213-af4a294e3833" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca6e21-301e-0042-3749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:25 GMT", + "x-ms-client-request-id" : "e0f123c1-2239-433e-a213-af4a294e3833" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseac0blobapitestreleaseleaseac26371806ff5d06", "javablobreleaseleaseac1blobapitestreleaseleaseac263447666f5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[3].json new file mode 100644 index 000000000000..de57c30bcc7a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[3].json @@ -0,0 +1,165 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacdcb24527f17efe?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" : "892a3283-1bb6-4322-a1e6-6f86418bdd69" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610DEFC709\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6e36-301e-0042-4c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:25 GMT", + "x-ms-client-request-id" : "892a3283-1bb6-4322-a1e6-6f86418bdd69" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacdcb24527f17efe/javablobreleaseleaseac1blobapitestreleaseleaseacdcb51643cb4", + "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" : "51274d7c-ed19-4754-b9a5-29eeba205405", + "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 20:05:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735610DFD37EC\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca6e4f-301e-0042-6349-67cbbf000000", + "x-ms-client-request-id" : "51274d7c-ed19-4754-b9a5-29eeba205405" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacdcb24527f17efe/javablobreleaseleaseac1blobapitestreleaseleaseacdcb51643cb4", + "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" : "fa02397d-7181-4613-9d8f-318f2068bad8" + }, + "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 20:05:25 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:05:25 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735610DFD37EC\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:25 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca6e6b-301e-0042-7f49-67cbbf000000", + "x-ms-client-request-id" : "fa02397d-7181-4613-9d8f-318f2068bad8", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacdcb24527f17efe/javablobreleaseleaseac1blobapitestreleaseleaseacdcb51643cb4?comp=lease", + "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" : "c9d66674-6a71-4bd3-b633-89857af3f6fe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610DFD37EC\"", + "x-ms-lease-id" : "e8cea52b-9570-427b-87b0-510a0f3c478b", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6e83-301e-0042-1649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:26 GMT", + "x-ms-client-request-id" : "c9d66674-6a71-4bd3-b633-89857af3f6fe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacdcb24527f17efe/javablobreleaseleaseac1blobapitestreleaseleaseacdcb51643cb4?comp=lease", + "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" : "8d431d6c-2760-4243-afb4-101727325674" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610DFD37EC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca6ec6-301e-0042-5549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:26 GMT", + "x-ms-client-request-id" : "8d431d6c-2760-4243-afb4-101727325674" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcreleaseleaseac&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" : "4cc7f353-869a-4563-9631-222a69e02c8c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca6eeb-301e-0042-7649-67cbbf000000", + "Body" : "jtcreleaseleaseacjtcreleaseleaseac0blobapitestreleaseleaseacdcb24527f17efeMon, 09 Sep 2019 20:05:25 GMT\"0x8D735610DEFC709\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:26 GMT", + "x-ms-client-request-id" : "4cc7f353-869a-4563-9631-222a69e02c8c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseacdcb24527f17efe?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" : "92592649-6d9c-4746-bfc5-13ae7fa4b754" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca6efd-301e-0042-0749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:26 GMT", + "x-ms-client-request-id" : "92592649-6d9c-4746-bfc5-13ae7fa4b754" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseac0blobapitestreleaseleaseacdcb24527f17efe", "javablobreleaseleaseac1blobapitestreleaseleaseacdcb51643cb4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[4].json new file mode 100644 index 000000000000..8a338aeffc7d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseac[4].json @@ -0,0 +1,133 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac5b24064167cf22?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" : "5c456bec-04cc-4d19-a07c-a74235ecd79d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610E548E7F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6f0f-301e-0042-1949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:26 GMT", + "x-ms-client-request-id" : "5c456bec-04cc-4d19-a07c-a74235ecd79d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac5b24064167cf22/javablobreleaseleaseac1blobapitestreleaseleaseac5b237934c90", + "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" : "c3b19391-6dd9-48c9-acdd-2fee7c9e21b6", + "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 20:05:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735610E61632D\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca6f1e-301e-0042-2749-67cbbf000000", + "x-ms-client-request-id" : "c3b19391-6dd9-48c9-acdd-2fee7c9e21b6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac5b24064167cf22/javablobreleaseleaseac1blobapitestreleaseleaseac5b237934c90?comp=lease", + "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" : "7bae92e3-fb32-45ac-88c2-a0ad956e46c8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610E61632D\"", + "x-ms-lease-id" : "19a1c0a1-0071-4621-a05e-1671b533e28f", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6f2f-301e-0042-3449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:26 GMT", + "x-ms-client-request-id" : "7bae92e3-fb32-45ac-88c2-a0ad956e46c8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac5b24064167cf22/javablobreleaseleaseac1blobapitestreleaseleaseac5b237934c90?comp=lease", + "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" : "71e3bc07-5278-4999-bb97-7992c4e4d41f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610E61632D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca6f40-301e-0042-4549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:26 GMT", + "x-ms-client-request-id" : "71e3bc07-5278-4999-bb97-7992c4e4d41f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcreleaseleaseac&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" : "59d9d514-a4bd-4555-ac0a-c4d98e1662f2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca6f4c-301e-0042-5149-67cbbf000000", + "Body" : "jtcreleaseleaseacjtcreleaseleaseac0blobapitestreleaseleaseac5b24064167cf22Mon, 09 Sep 2019 20:05:26 GMT\"0x8D735610E548E7F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:26 GMT", + "x-ms-client-request-id" : "59d9d514-a4bd-4555-ac0a-c4d98e1662f2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0blobapitestreleaseleaseac5b24064167cf22?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" : "88f4a486-d722-4b72-b86a-7433b30502af" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca6f5e-301e-0042-6149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:26 GMT", + "x-ms-client-request-id" : "88f4a486-d722-4b72-b86a-7433b30502af" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseac0blobapitestreleaseleaseac5b24064167cf22", "javablobreleaseleaseac1blobapitestreleaseleaseac5b237934c90" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseacfail[0].json new file mode 100644 index 000000000000..fe9c2ae23249 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseacfail[0].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail5ba911001c?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" : "eabb6fbd-01b0-49ba-ae64-ba98cc237ac2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610EA02416\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6f72-301e-0042-7149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:26 GMT", + "x-ms-client-request-id" : "eabb6fbd-01b0-49ba-ae64-ba98cc237ac2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail5ba911001c/javablobreleaseleaseacfail123331ff25e4ffeb25492", + "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" : "92e32c23-f2e0-4839-b348-c98ffd5ff97f", + "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 20:05:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735610EADE369\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca6f7f-301e-0042-7c49-67cbbf000000", + "x-ms-client-request-id" : "92e32c23-f2e0-4839-b348-c98ffd5ff97f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail5ba911001c/javablobreleaseleaseacfail123331ff25e4ffeb25492?comp=lease", + "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" : "55d81d91-2b8d-454c-bee6-e895990c18b2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610EADE369\"", + "x-ms-lease-id" : "3706c8c7-48c3-4af9-b944-a9d9745e8872", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6f8f-301e-0042-0a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:27 GMT", + "x-ms-client-request-id" : "55d81d91-2b8d-454c-bee6-e895990c18b2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail5ba911001c/javablobreleaseleaseacfail123331ff25e4ffeb25492?comp=lease", + "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" : "5a687f41-3b6a-4762-8da3-2602f74401ac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca6f9d-301e-0042-1649-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca6f9d-301e-0042-1649-67cbbf000000\nTime:2019-09-09T20:05:27.2192160Z", + "Date" : "Mon, 09 Sep 2019 20:05:27 GMT", + "x-ms-client-request-id" : "5a687f41-3b6a-4762-8da3-2602f74401ac", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcreleaseleaseacfail&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" : "1e188711-4f55-4f46-9f57-91a5dae2f400" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca6fa9-301e-0042-2249-67cbbf000000", + "Body" : "jtcreleaseleaseacfailjtcreleaseleaseacfail0blobapitestreleaseleaseacfail5ba911001cMon, 09 Sep 2019 20:05:26 GMT\"0x8D735610EA02416\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:27 GMT", + "x-ms-client-request-id" : "1e188711-4f55-4f46-9f57-91a5dae2f400", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail5ba911001c?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" : "edc03d32-e7cf-455c-b5e9-d8f446ff92ce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca6fb7-301e-0042-3049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:27 GMT", + "x-ms-client-request-id" : "edc03d32-e7cf-455c-b5e9-d8f446ff92ce" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseacfail0blobapitestreleaseleaseacfail5ba911001c", "javablobreleaseleaseacfail123331ff25e4ffeb25492" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseacfail[1].json new file mode 100644 index 000000000000..8d8db3c7fd27 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseacfail[1].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail14a8329632?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" : "6948439c-20bb-46d3-abcd-2e9431d3dc9d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610EEAF63B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6fca-301e-0042-4049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:27 GMT", + "x-ms-client-request-id" : "6948439c-20bb-46d3-abcd-2e9431d3dc9d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail14a8329632/javablobreleaseleaseacfail10217753ee5e271c92457", + "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" : "bbbd1d57-12e9-445e-989f-c5f07e1efa93", + "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 20:05:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735610EF77CF4\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca6fe1-301e-0042-5649-67cbbf000000", + "x-ms-client-request-id" : "bbbd1d57-12e9-445e-989f-c5f07e1efa93" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail14a8329632/javablobreleaseleaseacfail10217753ee5e271c92457?comp=lease", + "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" : "7bffe077-3800-42d0-b9b7-5687d6acacf0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610EF77CF4\"", + "x-ms-lease-id" : "c415c062-14e2-4333-94c3-4a28df6abc9d", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6ff0-301e-0042-6349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:27 GMT", + "x-ms-client-request-id" : "7bffe077-3800-42d0-b9b7-5687d6acacf0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail14a8329632/javablobreleaseleaseacfail10217753ee5e271c92457?comp=lease", + "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" : "e9774162-ab13-4bbb-a0ad-5a26d6f81d2f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca700e-301e-0042-7e49-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca700e-301e-0042-7e49-67cbbf000000\nTime:2019-09-09T20:05:27.7005551Z", + "Date" : "Mon, 09 Sep 2019 20:05:27 GMT", + "x-ms-client-request-id" : "e9774162-ab13-4bbb-a0ad-5a26d6f81d2f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcreleaseleaseacfail&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" : "a2dc6f1a-52ab-4f30-ad9b-e80b82c26be7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca701f-301e-0042-0f49-67cbbf000000", + "Body" : "jtcreleaseleaseacfailjtcreleaseleaseacfail0blobapitestreleaseleaseacfail14a8329632Mon, 09 Sep 2019 20:05:27 GMT\"0x8D735610EEAF63B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:27 GMT", + "x-ms-client-request-id" : "a2dc6f1a-52ab-4f30-ad9b-e80b82c26be7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail14a8329632?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" : "4f32383c-3e2e-413e-aa9c-e1937b2910c8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca702c-301e-0042-1c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:27 GMT", + "x-ms-client-request-id" : "4f32383c-3e2e-413e-aa9c-e1937b2910c8" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseacfail0blobapitestreleaseleaseacfail14a8329632", "javablobreleaseleaseacfail10217753ee5e271c92457" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseacfail[2].json new file mode 100644 index 000000000000..61f7dab4536a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseacfail[2].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail8d7903461f?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" : "229388c3-2e8c-4c86-b15b-044ad0383018" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610F36168F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca703a-301e-0042-2849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:27 GMT", + "x-ms-client-request-id" : "229388c3-2e8c-4c86-b15b-044ad0383018" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail8d7903461f/javablobreleaseleaseacfail1694216582dd328865480", + "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" : "fa18abd0-5e9e-404d-adbf-380a62092c97", + "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 20:05:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735610F4339BA\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca7051-301e-0042-3c49-67cbbf000000", + "x-ms-client-request-id" : "fa18abd0-5e9e-404d-adbf-380a62092c97" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail8d7903461f/javablobreleaseleaseacfail1694216582dd328865480?comp=lease", + "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" : "03a8e979-a34f-410f-8375-8e394fd204ff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610F4339BA\"", + "x-ms-lease-id" : "aab81d29-faa8-43ab-9279-6796521424ae", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca706d-301e-0042-5649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:28 GMT", + "x-ms-client-request-id" : "03a8e979-a34f-410f-8375-8e394fd204ff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail8d7903461f/javablobreleaseleaseacfail1694216582dd328865480?comp=lease", + "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" : "32891585-5a7e-4eb2-8f5e-4a6449677c0b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca7081-301e-0042-6649-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca7081-301e-0042-6649-67cbbf000000\nTime:2019-09-09T20:05:28.2029102Z", + "Date" : "Mon, 09 Sep 2019 20:05:28 GMT", + "x-ms-client-request-id" : "32891585-5a7e-4eb2-8f5e-4a6449677c0b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcreleaseleaseacfail&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" : "b5c8a9b6-99af-4425-bcbe-05f347fc58f7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca708e-301e-0042-7249-67cbbf000000", + "Body" : "jtcreleaseleaseacfailjtcreleaseleaseacfail0blobapitestreleaseleaseacfail8d7903461fMon, 09 Sep 2019 20:05:27 GMT\"0x8D735610F36168F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:28 GMT", + "x-ms-client-request-id" : "b5c8a9b6-99af-4425-bcbe-05f347fc58f7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfail8d7903461f?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" : "f3d83c2e-2f91-4c05-bfd1-f0b3407180fe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca70a4-301e-0042-0749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:28 GMT", + "x-ms-client-request-id" : "f3d83c2e-2f91-4c05-bfd1-f0b3407180fe" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseacfail0blobapitestreleaseleaseacfail8d7903461f", "javablobreleaseleaseacfail1694216582dd328865480" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseacfail[3].json new file mode 100644 index 000000000000..85df24c54758 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseacfail[3].json @@ -0,0 +1,166 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfailc915575982?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" : "e63ea91e-6827-4885-9c6f-5c5c84856686" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610F8296B4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca70c3-301e-0042-1f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:28 GMT", + "x-ms-client-request-id" : "e63ea91e-6827-4885-9c6f-5c5c84856686" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfailc915575982/javablobreleaseleaseacfail1716629b0a4498edcd448", + "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" : "0d88913e-0d0f-4bec-94fc-f7272c0df51e", + "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 20:05:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735610F8F6BCC\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca70d5-301e-0042-2f49-67cbbf000000", + "x-ms-client-request-id" : "0d88913e-0d0f-4bec-94fc-f7272c0df51e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfailc915575982/javablobreleaseleaseacfail1716629b0a4498edcd448", + "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" : "fb4cc130-3f3c-406b-9781-c75258fb982a" + }, + "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 20:05:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:05:28 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735610F8F6BCC\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:28 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca70e5-301e-0042-3d49-67cbbf000000", + "x-ms-client-request-id" : "fb4cc130-3f3c-406b-9781-c75258fb982a", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfailc915575982/javablobreleaseleaseacfail1716629b0a4498edcd448?comp=lease", + "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" : "fcbf02c7-f41b-44f9-a74b-9cd66789a0f9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610F8F6BCC\"", + "x-ms-lease-id" : "d8a16b70-4eca-4910-be54-3cd710295dc5", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca70f4-301e-0042-4b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:28 GMT", + "x-ms-client-request-id" : "fcbf02c7-f41b-44f9-a74b-9cd66789a0f9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfailc915575982/javablobreleaseleaseacfail1716629b0a4498edcd448?comp=lease", + "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" : "3a8abe7a-484a-4fc8-adf6-b5063edf0314" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca710a-301e-0042-5e49-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca710a-301e-0042-5e49-67cbbf000000\nTime:2019-09-09T20:05:28.7793171Z", + "Date" : "Mon, 09 Sep 2019 20:05:28 GMT", + "x-ms-client-request-id" : "3a8abe7a-484a-4fc8-adf6-b5063edf0314", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcreleaseleaseacfail&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" : "ed632881-b034-4216-98e9-950fb76cd37b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca711c-301e-0042-6e49-67cbbf000000", + "Body" : "jtcreleaseleaseacfailjtcreleaseleaseacfail0blobapitestreleaseleaseacfailc915575982Mon, 09 Sep 2019 20:05:28 GMT\"0x8D735610F8296B4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:28 GMT", + "x-ms-client-request-id" : "ed632881-b034-4216-98e9-950fb76cd37b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0blobapitestreleaseleaseacfailc915575982?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" : "8a57f4bd-1e72-4269-8e1c-cab31297e24c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca7138-301e-0042-0849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:28 GMT", + "x-ms-client-request-id" : "8a57f4bd-1e72-4269-8e1c-cab31297e24c" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseacfail0blobapitestreleaseleaseacfailc915575982", "javablobreleaseleaseacfail1716629b0a4498edcd448" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseerror.json new file mode 100644 index 000000000000..3bafb26027c4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleaseerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseerror0blobapitestreleaseleaseerrorc06544991fd?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" : "3fa15cc4-511b-46fa-b190-f3147b811292" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610FD92ACB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7155-301e-0042-2149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:28 GMT", + "x-ms-client-request-id" : "3fa15cc4-511b-46fa-b190-f3147b811292" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseerror0blobapitestreleaseleaseerrorc06544991fd/javablobreleaseleaseerror1blobapitestreleaseleaseerrorc0655658", + "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" : "1b485d5e-0d33-47d2-99d0-c613fc43fae3", + "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 20:05:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735610FE5B1DD\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca7174-301e-0042-3b49-67cbbf000000", + "x-ms-client-request-id" : "1b485d5e-0d33-47d2-99d0-c613fc43fae3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseerror0blobapitestreleaseleaseerrorc06544991fd/javablobreleaseleaseerror2blobapitestreleaseleaseerrorc0687971?comp=lease", + "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" : "82b92f03-f075-491c-a27a-a74cf2c308e2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "c5ca718c-301e-0042-5049-67cbbf000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:c5ca718c-301e-0042-5049-67cbbf000000\nTime:2019-09-09T20:05:29.1836025Zx-ms-lease-idid", + "Date" : "Mon, 09 Sep 2019 20:05:29 GMT", + "x-ms-client-request-id" : "82b92f03-f075-491c-a27a-a74cf2c308e2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcreleaseleaseerror&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" : "5a977244-3598-46e5-8262-fa0ba0015d76" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca719b-301e-0042-5f49-67cbbf000000", + "Body" : "jtcreleaseleaseerrorjtcreleaseleaseerror0blobapitestreleaseleaseerrorc06544991fdMon, 09 Sep 2019 20:05:29 GMT\"0x8D735610FD92ACB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:29 GMT", + "x-ms-client-request-id" : "5a977244-3598-46e5-8262-fa0ba0015d76", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseerror0blobapitestreleaseleaseerrorc06544991fd?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" : "c0e074db-ee2c-4797-a09b-00fe35df0f71" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca71a4-301e-0042-6849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:29 GMT", + "x-ms-client-request-id" : "c0e074db-ee2c-4797-a09b-00fe35df0f71" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseerror0blobapitestreleaseleaseerrorc06544991fd", "javablobreleaseleaseerror1blobapitestreleaseleaseerrorc0655658", "javablobreleaseleaseerror2blobapitestreleaseleaseerrorc0687971" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleasemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleasemin.json new file mode 100644 index 000000000000..6c9a3e162887 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestreleaseleasemin.json @@ -0,0 +1,133 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleasemin0blobapitestreleaseleaseminbcf3491710c23?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" : "9dbb4b21-9bf9-4fc8-b7bd-5fc35abdf0d2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610CB9F53A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6c49-301e-0042-0349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:23 GMT", + "x-ms-client-request-id" : "9dbb4b21-9bf9-4fc8-b7bd-5fc35abdf0d2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleasemin0blobapitestreleaseleaseminbcf3491710c23/javablobreleaseleasemin1blobapitestreleaseleaseminbcf891676e", + "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" : "7212024d-4874-4c7a-8838-7009d2fb1a51", + "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 20:05:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735610CC71786\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca6c57-301e-0042-1049-67cbbf000000", + "x-ms-client-request-id" : "7212024d-4874-4c7a-8838-7009d2fb1a51" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleasemin0blobapitestreleaseleaseminbcf3491710c23/javablobreleaseleasemin1blobapitestreleaseleaseminbcf891676e?comp=lease", + "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" : "6941fff1-8fb1-487a-bea2-d8fd54e5729a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610CC71786\"", + "x-ms-lease-id" : "820dc150-9417-482c-8952-c246016aca80", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6c6e-301e-0042-2349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:23 GMT", + "x-ms-client-request-id" : "6941fff1-8fb1-487a-bea2-d8fd54e5729a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleasemin0blobapitestreleaseleaseminbcf3491710c23/javablobreleaseleasemin1blobapitestreleaseleaseminbcf891676e?comp=lease", + "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" : "b4150d7f-8f43-4d83-84ac-86e25e75610a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610CC71786\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca6c82-301e-0042-3549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:23 GMT", + "x-ms-client-request-id" : "b4150d7f-8f43-4d83-84ac-86e25e75610a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcreleaseleasemin&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" : "f2bd5df7-e151-4eb8-bf25-94fe01196b30" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca6ca6-301e-0042-5649-67cbbf000000", + "Body" : "jtcreleaseleaseminjtcreleaseleasemin0blobapitestreleaseleaseminbcf3491710c23Mon, 09 Sep 2019 20:05:23 GMT\"0x8D735610CB9F53A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:24 GMT", + "x-ms-client-request-id" : "f2bd5df7-e151-4eb8-bf25-94fe01196b30", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleasemin0blobapitestreleaseleaseminbcf3491710c23?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" : "101ffa59-e922-427f-83f3-889e7faf7105" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca6cb3-301e-0042-6149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:24 GMT", + "x-ms-client-request-id" : "101ffa59-e922-427f-83f3-889e7faf7105" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleasemin0blobapitestreleaseleaseminbcf3491710c23", "javablobreleaseleasemin1blobapitestreleaseleaseminbcf891676e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewlease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewlease.json new file mode 100644 index 000000000000..f6022b5befab --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewlease.json @@ -0,0 +1,167 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewlease0blobapitestrenewlease11434573546ab23050?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" : "46874e54-8c90-4014-8b93-c17f0fafd355" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FF0E535A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca54f2-301e-0042-6549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:00 GMT", + "x-ms-client-request-id" : "46874e54-8c90-4014-8b93-c17f0fafd355" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewlease0blobapitestrenewlease11434573546ab23050/javablobrenewlease1blobapitestrenewlease11428426b370a55", + "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" : "f974d48d-d769-4ab2-b5c5-8314be8b597f", + "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 20:05:00 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:00 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560FF1BE622\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca5507-301e-0042-7949-67cbbf000000", + "x-ms-client-request-id" : "f974d48d-d769-4ab2-b5c5-8314be8b597f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewlease0blobapitestrenewlease11434573546ab23050/javablobrenewlease1blobapitestrenewlease11428426b370a55?comp=lease", + "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" : "827467b9-52e9-4195-9302-26d5f17e6a76" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FF1BE622\"", + "x-ms-lease-id" : "0b40df8e-2614-4579-a655-48f1aecc1ebc", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca5529-301e-0042-1749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:00 GMT", + "x-ms-client-request-id" : "827467b9-52e9-4195-9302-26d5f17e6a76" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewlease0blobapitestrenewlease11434573546ab23050/javablobrenewlease1blobapitestrenewlease11428426b370a55?comp=lease", + "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" : "d4f5db71-1be7-4442-8bf9-60d733b90e1b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FF1BE622\"", + "x-ms-lease-id" : "0b40df8e-2614-4579-a655-48f1aecc1ebc", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca660d-301e-0042-3b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:17 GMT", + "x-ms-client-request-id" : "d4f5db71-1be7-4442-8bf9-60d733b90e1b" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewlease0blobapitestrenewlease11434573546ab23050/javablobrenewlease1blobapitestrenewlease11428426b370a55", + "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" : "f5bdaf23-1d4b-4114-b326-80c3d1694c76" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-lease-state" : "leased", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:00 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:05:17 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560FF1BE622\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:00 GMT", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca661f-301e-0042-4849-67cbbf000000", + "x-ms-client-request-id" : "f5bdaf23-1d4b-4114-b326-80c3d1694c76", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrenewlease&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" : "120f76bf-cbe9-4636-b539-9f24d127f7fb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca6635-301e-0042-5c49-67cbbf000000", + "Body" : "jtcrenewleasejtcrenewlease0blobapitestrenewlease11434573546ab23050Mon, 09 Sep 2019 20:05:00 GMT\"0x8D73560FF0E535A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:17 GMT", + "x-ms-client-request-id" : "120f76bf-cbe9-4636-b539-9f24d127f7fb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewlease0blobapitestrenewlease11434573546ab23050?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" : "6e33b4e2-c32d-4d9b-aad5-e4497e068e9a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca6642-301e-0042-6749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:17 GMT", + "x-ms-client-request-id" : "6e33b4e2-c32d-4d9b-aad5-e4497e068e9a" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewlease0blobapitestrenewlease11434573546ab23050", "javablobrenewlease1blobapitestrenewlease11428426b370a55" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[0].json new file mode 100644 index 000000000000..bea1eb2cedf6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[0].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacb2e71280b45fe7f9?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" : "04bc8430-641f-46bf-aec0-8bb63294a00d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610942A4B2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca66ca-301e-0042-5f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:17 GMT", + "x-ms-client-request-id" : "04bc8430-641f-46bf-aec0-8bb63294a00d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacb2e71280b45fe7f9/javablobrenewleaseac1blobapitestrenewleaseacb2e1578257a37", + "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" : "333d8e20-d41f-4770-ad92-65340ff9a90f", + "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 20:05:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:17 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735610950B052\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca66e7-301e-0042-7949-67cbbf000000", + "x-ms-client-request-id" : "333d8e20-d41f-4770-ad92-65340ff9a90f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacb2e71280b45fe7f9/javablobrenewleaseac1blobapitestrenewleaseacb2e1578257a37?comp=lease", + "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" : "10f67722-2116-4eb2-878e-a001a1d217a0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610950B052\"", + "x-ms-lease-id" : "84a560a9-46cb-4421-b834-06dce6ddd1f0", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca66f9-301e-0042-0a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:18 GMT", + "x-ms-client-request-id" : "10f67722-2116-4eb2-878e-a001a1d217a0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacb2e71280b45fe7f9/javablobrenewleaseac1blobapitestrenewleaseacb2e1578257a37?comp=lease", + "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" : "90cd5324-f109-4277-b987-4bafc5f95779" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610950B052\"", + "x-ms-lease-id" : "84a560a9-46cb-4421-b834-06dce6ddd1f0", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca670d-301e-0042-1b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:18 GMT", + "x-ms-client-request-id" : "90cd5324-f109-4277-b987-4bafc5f95779" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrenewleaseac&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" : "4fbff6c0-4d40-423c-ae59-589bc27a4782" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca671d-301e-0042-2b49-67cbbf000000", + "Body" : "jtcrenewleaseacjtcrenewleaseac0blobapitestrenewleaseacb2e71280b45fe7f9Mon, 09 Sep 2019 20:05:17 GMT\"0x8D735610942A4B2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:18 GMT", + "x-ms-client-request-id" : "4fbff6c0-4d40-423c-ae59-589bc27a4782", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacb2e71280b45fe7f9?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" : "1238f041-676a-4c19-9f4e-bcee1731fe5c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca6734-301e-0042-4049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:18 GMT", + "x-ms-client-request-id" : "1238f041-676a-4c19-9f4e-bcee1731fe5c" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseac0blobapitestrenewleaseacb2e71280b45fe7f9", "javablobrenewleaseac1blobapitestrenewleaseacb2e1578257a37" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[1].json new file mode 100644 index 000000000000..a47641c206c7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[1].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac21040384b5be1799?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" : "7ca47d2e-15e8-4a61-8201-e27aa37bd331" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356109905D8C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6748-301e-0042-5449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:18 GMT", + "x-ms-client-request-id" : "7ca47d2e-15e8-4a61-8201-e27aa37bd331" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac21040384b5be1799/javablobrenewleaseac1blobapitestrenewleaseac21083477cdc93", + "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" : "5a243479-4f4f-4fdc-9173-b72acd0e4c8b", + "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 20:05:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561099E422D\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca6763-301e-0042-6c49-67cbbf000000", + "x-ms-client-request-id" : "5a243479-4f4f-4fdc-9173-b72acd0e4c8b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac21040384b5be1799/javablobrenewleaseac1blobapitestrenewleaseac21083477cdc93?comp=lease", + "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" : "50d63cd8-6d2b-4b9e-88c0-be77a27af7bd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561099E422D\"", + "x-ms-lease-id" : "d2772fdf-b283-409d-84f4-f1401cc7e38a", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6779-301e-0042-0149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:18 GMT", + "x-ms-client-request-id" : "50d63cd8-6d2b-4b9e-88c0-be77a27af7bd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac21040384b5be1799/javablobrenewleaseac1blobapitestrenewleaseac21083477cdc93?comp=lease", + "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" : "6345ddad-7412-4f29-88c2-5233efcc4a97" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561099E422D\"", + "x-ms-lease-id" : "d2772fdf-b283-409d-84f4-f1401cc7e38a", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca6786-301e-0042-0d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:18 GMT", + "x-ms-client-request-id" : "6345ddad-7412-4f29-88c2-5233efcc4a97" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrenewleaseac&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" : "464df98b-47d7-4219-bbbb-7bf53d412a59" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca6796-301e-0042-1b49-67cbbf000000", + "Body" : "jtcrenewleaseacjtcrenewleaseac0blobapitestrenewleaseac21040384b5be1799Mon, 09 Sep 2019 20:05:18 GMT\"0x8D7356109905D8C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:18 GMT", + "x-ms-client-request-id" : "464df98b-47d7-4219-bbbb-7bf53d412a59", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac21040384b5be1799?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" : "468c8a61-e662-4ab9-b43f-19d6869656d5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca67a9-301e-0042-2d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:18 GMT", + "x-ms-client-request-id" : "468c8a61-e662-4ab9-b43f-19d6869656d5" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseac0blobapitestrenewleaseac21040384b5be1799", "javablobrenewleaseac1blobapitestrenewleaseac21083477cdc93" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[2].json new file mode 100644 index 000000000000..fe0e959d297a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[2].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac85b00319e33defb1?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" : "de7bdc96-c3f7-4d00-91fa-c93535355883" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356109DD52F9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca67c4-301e-0042-4749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:18 GMT", + "x-ms-client-request-id" : "de7bdc96-c3f7-4d00-91fa-c93535355883" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac85b00319e33defb1/javablobrenewleaseac1blobapitestrenewleaseac85b3772725de4", + "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" : "8d203f8f-c6e8-429e-a736-cf00e0f60957", + "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 20:05:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356109EA9B54\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca67da-301e-0042-5b49-67cbbf000000", + "x-ms-client-request-id" : "8d203f8f-c6e8-429e-a736-cf00e0f60957" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac85b00319e33defb1/javablobrenewleaseac1blobapitestrenewleaseac85b3772725de4?comp=lease", + "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" : "d067ea70-96fd-4f73-93c3-844776159708" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356109EA9B54\"", + "x-ms-lease-id" : "68dbf0af-73f7-4303-9655-8c451d2fb4b9", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca67ee-301e-0042-6c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:19 GMT", + "x-ms-client-request-id" : "d067ea70-96fd-4f73-93c3-844776159708" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac85b00319e33defb1/javablobrenewleaseac1blobapitestrenewleaseac85b3772725de4?comp=lease", + "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" : "07984bdd-b3fc-4cc2-8b0f-a89fac2c9edb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356109EA9B54\"", + "x-ms-lease-id" : "68dbf0af-73f7-4303-9655-8c451d2fb4b9", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca6802-301e-0042-7d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:19 GMT", + "x-ms-client-request-id" : "07984bdd-b3fc-4cc2-8b0f-a89fac2c9edb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrenewleaseac&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" : "cb1bb42e-00a6-45ff-8430-7e34a5aaf494" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca681a-301e-0042-1249-67cbbf000000", + "Body" : "jtcrenewleaseacjtcrenewleaseac0blobapitestrenewleaseac85b00319e33defb1Mon, 09 Sep 2019 20:05:18 GMT\"0x8D7356109DD52F9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:19 GMT", + "x-ms-client-request-id" : "cb1bb42e-00a6-45ff-8430-7e34a5aaf494", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac85b00319e33defb1?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" : "a985eb48-22dc-4efe-b08c-0f441c2be439" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca6835-301e-0042-2c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:19 GMT", + "x-ms-client-request-id" : "a985eb48-22dc-4efe-b08c-0f441c2be439" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseac0blobapitestrenewleaseac85b00319e33defb1", "javablobrenewleaseac1blobapitestrenewleaseac85b3772725de4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[3].json new file mode 100644 index 000000000000..ce6b86f3b84a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[3].json @@ -0,0 +1,166 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacfb921080ccd7d81a?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" : "7bf57bf1-6b1d-4382-a8e5-aea47e6bc0e7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610A2BA82E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6847-301e-0042-3e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:19 GMT", + "x-ms-client-request-id" : "7bf57bf1-6b1d-4382-a8e5-aea47e6bc0e7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacfb921080ccd7d81a/javablobrenewleaseac1blobapitestrenewleaseacfb907418102ac", + "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" : "40e78314-5274-4df7-9a9f-6123bb934ea6", + "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 20:05:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735610A3A5081\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca685e-301e-0042-5349-67cbbf000000", + "x-ms-client-request-id" : "40e78314-5274-4df7-9a9f-6123bb934ea6" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacfb921080ccd7d81a/javablobrenewleaseac1blobapitestrenewleaseacfb907418102ac", + "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" : "d63a4182-8866-4b76-b076-c11be755268d" + }, + "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 20:05:19 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:05:19 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735610A3A5081\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:19 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca686b-301e-0042-6049-67cbbf000000", + "x-ms-client-request-id" : "d63a4182-8866-4b76-b076-c11be755268d", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacfb921080ccd7d81a/javablobrenewleaseac1blobapitestrenewleaseacfb907418102ac?comp=lease", + "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" : "a80c5126-89cb-45ae-a131-834e395d028d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610A3A5081\"", + "x-ms-lease-id" : "ee3cbf2b-c0d5-4395-a349-e1ac7fb8b248", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6892-301e-0042-0549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:19 GMT", + "x-ms-client-request-id" : "a80c5126-89cb-45ae-a131-834e395d028d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacfb921080ccd7d81a/javablobrenewleaseac1blobapitestrenewleaseacfb907418102ac?comp=lease", + "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" : "920e8057-bce3-41b9-ae86-e19f0a157239" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610A3A5081\"", + "x-ms-lease-id" : "ee3cbf2b-c0d5-4395-a349-e1ac7fb8b248", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca689f-301e-0042-1249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:19 GMT", + "x-ms-client-request-id" : "920e8057-bce3-41b9-ae86-e19f0a157239" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrenewleaseac&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" : "7b54bc03-4667-4995-ad21-ee2ebdad6b15" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca68ab-301e-0042-1e49-67cbbf000000", + "Body" : "jtcrenewleaseacjtcrenewleaseac0blobapitestrenewleaseacfb921080ccd7d81aMon, 09 Sep 2019 20:05:19 GMT\"0x8D735610A2BA82E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:19 GMT", + "x-ms-client-request-id" : "7b54bc03-4667-4995-ad21-ee2ebdad6b15", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseacfb921080ccd7d81a?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" : "29bc727c-9ffe-40e4-98b4-e2e7ee949565" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca68c0-301e-0042-3149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:19 GMT", + "x-ms-client-request-id" : "29bc727c-9ffe-40e4-98b4-e2e7ee949565" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseac0blobapitestrenewleaseacfb921080ccd7d81a", "javablobrenewleaseac1blobapitestrenewleaseacfb907418102ac" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[4].json new file mode 100644 index 000000000000..8b711bd913ee --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseac[4].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac0174530618fbb808?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" : "d0fb51e1-3bba-464f-8f0c-d069509cecc1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610A85E66B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca68db-301e-0042-4b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:20 GMT", + "x-ms-client-request-id" : "d0fb51e1-3bba-464f-8f0c-d069509cecc1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac0174530618fbb808/javablobrenewleaseac1blobapitestrenewleaseac0178429193d5d", + "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" : "37147a7d-b49f-4a7a-a750-4c34b8727833", + "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 20:05:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735610A9307F6\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca68ee-301e-0042-5d49-67cbbf000000", + "x-ms-client-request-id" : "37147a7d-b49f-4a7a-a750-4c34b8727833" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac0174530618fbb808/javablobrenewleaseac1blobapitestrenewleaseac0178429193d5d?comp=lease", + "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" : "56a538f3-b544-4dc1-9282-62a1d5cab378" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610A9307F6\"", + "x-ms-lease-id" : "1b47440c-baf2-46f8-a283-9166affa2845", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6909-301e-0042-7749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:20 GMT", + "x-ms-client-request-id" : "56a538f3-b544-4dc1-9282-62a1d5cab378" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac0174530618fbb808/javablobrenewleaseac1blobapitestrenewleaseac0178429193d5d?comp=lease", + "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" : "959b8d83-d057-4282-8024-0446a5d7bb75" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610A9307F6\"", + "x-ms-lease-id" : "1b47440c-baf2-46f8-a283-9166affa2845", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca691f-301e-0042-0b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:20 GMT", + "x-ms-client-request-id" : "959b8d83-d057-4282-8024-0446a5d7bb75" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrenewleaseac&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" : "db1ec112-7620-4a25-86e7-9b86ca354ef4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca692f-301e-0042-1b49-67cbbf000000", + "Body" : "jtcrenewleaseacjtcrenewleaseac0blobapitestrenewleaseac0174530618fbb808Mon, 09 Sep 2019 20:05:20 GMT\"0x8D735610A85E66B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:20 GMT", + "x-ms-client-request-id" : "db1ec112-7620-4a25-86e7-9b86ca354ef4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0blobapitestrenewleaseac0174530618fbb808?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" : "d22f6bb8-19f7-4ae9-ae62-75c6fed546ca" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca6948-301e-0042-3149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:20 GMT", + "x-ms-client-request-id" : "d22f6bb8-19f7-4ae9-ae62-75c6fed546ca" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseac0blobapitestrenewleaseac0174530618fbb808", "javablobrenewleaseac1blobapitestrenewleaseac0178429193d5d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseacfail[0].json new file mode 100644 index 000000000000..95fda4ddac00 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseacfail[0].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail816809211eec?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" : "9d916557-8bff-49c4-b022-35d77abd88b4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610AD59B77\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6966-301e-0042-4f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:20 GMT", + "x-ms-client-request-id" : "9d916557-8bff-49c4-b022-35d77abd88b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail816809211eec/javablobrenewleaseacfail1blobapitestrenewleaseacfail816968074", + "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" : "9dd54c17-f6a5-4626-b9b9-e7ef9ab2c4dd", + "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 20:05:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735610AE3597A\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca697c-301e-0042-6349-67cbbf000000", + "x-ms-client-request-id" : "9dd54c17-f6a5-4626-b9b9-e7ef9ab2c4dd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail816809211eec/javablobrenewleaseacfail1blobapitestrenewleaseacfail816968074?comp=lease", + "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" : "777d0bcb-70ae-4d9d-bd1c-7a0ed8317cfb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610AE3597A\"", + "x-ms-lease-id" : "e8d249de-40a5-4ea2-bd3e-bfe3b3f854fb", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca698a-301e-0042-7149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:20 GMT", + "x-ms-client-request-id" : "777d0bcb-70ae-4d9d-bd1c-7a0ed8317cfb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail816809211eec/javablobrenewleaseacfail1blobapitestrenewleaseacfail816968074?comp=lease", + "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" : "4a47e02c-0c7c-4a48-a9f0-72b82212cf78" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca69a1-301e-0042-0449-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca69a1-301e-0042-0449-67cbbf000000\nTime:2019-09-09T20:05:20.8677322Z", + "Date" : "Mon, 09 Sep 2019 20:05:20 GMT", + "x-ms-client-request-id" : "4a47e02c-0c7c-4a48-a9f0-72b82212cf78", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrenewleaseacfail&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" : "f4ec1c5e-360c-4cb3-95f2-1c782bb5c9b7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca69b0-301e-0042-1149-67cbbf000000", + "Body" : "jtcrenewleaseacfailjtcrenewleaseacfail0blobapitestrenewleaseacfail816809211eecMon, 09 Sep 2019 20:05:20 GMT\"0x8D735610AD59B77\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:20 GMT", + "x-ms-client-request-id" : "f4ec1c5e-360c-4cb3-95f2-1c782bb5c9b7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail816809211eec?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" : "f63e4759-e6b8-4409-bcc1-168e4ab2a784" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca69c0-301e-0042-2049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:20 GMT", + "x-ms-client-request-id" : "f63e4759-e6b8-4409-bcc1-168e4ab2a784" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseacfail0blobapitestrenewleaseacfail816809211eec", "javablobrenewleaseacfail1blobapitestrenewleaseacfail816968074" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseacfail[1].json new file mode 100644 index 000000000000..7405256cbbff --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseacfail[1].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfailfac00275908a?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" : "472d437f-4769-4d44-87b2-39180f52e054" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610B25507A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca69cf-301e-0042-2e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:21 GMT", + "x-ms-client-request-id" : "472d437f-4769-4d44-87b2-39180f52e054" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfailfac00275908a/javablobrenewleaseacfail1blobapitestrenewleaseacfailfac54774b", + "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" : "fa1e8ba6-8db1-4a68-a587-112b4e04b65f", + "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 20:05:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735610B36B8C4\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca69e5-301e-0042-4249-67cbbf000000", + "x-ms-client-request-id" : "fa1e8ba6-8db1-4a68-a587-112b4e04b65f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfailfac00275908a/javablobrenewleaseacfail1blobapitestrenewleaseacfailfac54774b?comp=lease", + "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" : "27d97c0a-e3ca-46c0-a61b-c040a13474b6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610B36B8C4\"", + "x-ms-lease-id" : "6a8e158e-7fdd-4808-afac-529862653af1", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca69f0-301e-0042-4d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:21 GMT", + "x-ms-client-request-id" : "27d97c0a-e3ca-46c0-a61b-c040a13474b6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfailfac00275908a/javablobrenewleaseacfail1blobapitestrenewleaseacfailfac54774b?comp=lease", + "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" : "0bff418c-1271-44f8-8455-b1ce06ce88fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca6a06-301e-0042-6149-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca6a06-301e-0042-6149-67cbbf000000\nTime:2019-09-09T20:05:21.4151215Z", + "Date" : "Mon, 09 Sep 2019 20:05:21 GMT", + "x-ms-client-request-id" : "0bff418c-1271-44f8-8455-b1ce06ce88fc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrenewleaseacfail&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" : "c7cb93c8-1d42-4c8f-8ce6-85ddc2129c8f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca6a20-301e-0042-7a49-67cbbf000000", + "Body" : "jtcrenewleaseacfailjtcrenewleaseacfail0blobapitestrenewleaseacfailfac00275908aMon, 09 Sep 2019 20:05:21 GMT\"0x8D735610B25507A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:21 GMT", + "x-ms-client-request-id" : "c7cb93c8-1d42-4c8f-8ce6-85ddc2129c8f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfailfac00275908a?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" : "40badecf-2586-4706-8c97-f342095ca28e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca6a3d-301e-0042-1449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:21 GMT", + "x-ms-client-request-id" : "40badecf-2586-4706-8c97-f342095ca28e" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseacfail0blobapitestrenewleaseacfailfac00275908a", "javablobrenewleaseacfail1blobapitestrenewleaseacfailfac54774b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseacfail[2].json new file mode 100644 index 000000000000..de4dda198884 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseacfail[2].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfaildce58332d4ff?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" : "20cbba06-62fe-4d66-aed0-ae5df056b443" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610B779E14\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6a4e-301e-0042-2549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:21 GMT", + "x-ms-client-request-id" : "20cbba06-62fe-4d66-aed0-ae5df056b443" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfaildce58332d4ff/javablobrenewleaseacfail1blobapitestrenewleaseacfaildce723469", + "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" : "d7c6b535-9e8c-4cc0-92d5-4d425ce702b3", + "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 20:05:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735610B844A9F\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca6a5c-301e-0042-3249-67cbbf000000", + "x-ms-client-request-id" : "d7c6b535-9e8c-4cc0-92d5-4d425ce702b3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfaildce58332d4ff/javablobrenewleaseacfail1blobapitestrenewleaseacfaildce723469?comp=lease", + "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" : "1dfa5387-2fa5-4ab3-b461-6d3e4e96cbea" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610B844A9F\"", + "x-ms-lease-id" : "d3e4c550-961f-4a73-90d1-c5bfa6d8bdda", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6a6b-301e-0042-4149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:21 GMT", + "x-ms-client-request-id" : "1dfa5387-2fa5-4ab3-b461-6d3e4e96cbea" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfaildce58332d4ff/javablobrenewleaseacfail1blobapitestrenewleaseacfaildce723469?comp=lease", + "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" : "fdbd0f45-7eb9-41a3-a42c-94aaca92686f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca6a7b-301e-0042-5049-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca6a7b-301e-0042-5049-67cbbf000000\nTime:2019-09-09T20:05:21.9174735Z", + "Date" : "Mon, 09 Sep 2019 20:05:21 GMT", + "x-ms-client-request-id" : "fdbd0f45-7eb9-41a3-a42c-94aaca92686f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrenewleaseacfail&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" : "af23dbd2-3601-47cb-bf1f-cd00e2430f46" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca6a8a-301e-0042-5d49-67cbbf000000", + "Body" : "jtcrenewleaseacfailjtcrenewleaseacfail0blobapitestrenewleaseacfaildce58332d4ffMon, 09 Sep 2019 20:05:21 GMT\"0x8D735610B779E14\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:21 GMT", + "x-ms-client-request-id" : "af23dbd2-3601-47cb-bf1f-cd00e2430f46", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfaildce58332d4ff?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" : "7669dfb3-250d-47a2-8ad6-9850cb9b7263" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca6aa1-301e-0042-7449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:21 GMT", + "x-ms-client-request-id" : "7669dfb3-250d-47a2-8ad6-9850cb9b7263" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseacfail0blobapitestrenewleaseacfaildce58332d4ff", "javablobrenewleaseacfail1blobapitestrenewleaseacfaildce723469" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseacfail[3].json new file mode 100644 index 000000000000..b7be5ea5666c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseacfail[3].json @@ -0,0 +1,166 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail1cb596978968?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" : "6fe394f3-3061-4221-b45e-5f303ad8d6b9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610BC3A8F7\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6ab9-301e-0042-0c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:22 GMT", + "x-ms-client-request-id" : "6fe394f3-3061-4221-b45e-5f303ad8d6b9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail1cb596978968/javablobrenewleaseacfail1blobapitestrenewleaseacfail1cb138726", + "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" : "68993aec-a5b4-4380-9522-0deaf2ed5770", + "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 20:05:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735610BD1673C\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca6ad2-301e-0042-2149-67cbbf000000", + "x-ms-client-request-id" : "68993aec-a5b4-4380-9522-0deaf2ed5770" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail1cb596978968/javablobrenewleaseacfail1blobapitestrenewleaseacfail1cb138726", + "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" : "765a5c47-e3f7-4ad9-9099-ee7ba34fa001" + }, + "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 20:05:22 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:05:22 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735610BD1673C\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:22 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca6aeb-301e-0042-3849-67cbbf000000", + "x-ms-client-request-id" : "765a5c47-e3f7-4ad9-9099-ee7ba34fa001", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail1cb596978968/javablobrenewleaseacfail1blobapitestrenewleaseacfail1cb138726?comp=lease", + "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" : "f3e42fa0-63b7-4034-8404-dd9346648a40" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610BD1673C\"", + "x-ms-lease-id" : "7b25f5cd-1478-41d0-849f-9dee49ac3c3c", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6b00-301e-0042-4c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:22 GMT", + "x-ms-client-request-id" : "f3e42fa0-63b7-4034-8404-dd9346648a40" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail1cb596978968/javablobrenewleaseacfail1blobapitestrenewleaseacfail1cb138726?comp=lease", + "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" : "52dcf272-4451-4dfa-a5cf-0385f263d215" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca6b1a-301e-0042-6549-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca6b1a-301e-0042-6549-67cbbf000000\nTime:2019-09-09T20:05:22.5028865Z", + "Date" : "Mon, 09 Sep 2019 20:05:22 GMT", + "x-ms-client-request-id" : "52dcf272-4451-4dfa-a5cf-0385f263d215", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrenewleaseacfail&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" : "28b4dfaa-9762-4fd1-8bea-7538be2f32bd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca6b2d-301e-0042-7849-67cbbf000000", + "Body" : "jtcrenewleaseacfailjtcrenewleaseacfail0blobapitestrenewleaseacfail1cb596978968Mon, 09 Sep 2019 20:05:22 GMT\"0x8D735610BC3A8F7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:22 GMT", + "x-ms-client-request-id" : "28b4dfaa-9762-4fd1-8bea-7538be2f32bd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0blobapitestrenewleaseacfail1cb596978968?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" : "3f9e8538-7763-413d-b731-04067a2df42d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca6b3d-301e-0042-0849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:22 GMT", + "x-ms-client-request-id" : "3f9e8538-7763-413d-b731-04067a2df42d" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseacfail0blobapitestrenewleaseacfail1cb596978968", "javablobrenewleaseacfail1blobapitestrenewleaseacfail1cb138726" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseerror.json new file mode 100644 index 000000000000..53370fafc3ad --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleaseerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseerror0blobapitestrenewleaseerror0b6997256c099?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" : "086c99a0-22d0-4a90-9d87-62f745788bb2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735610C1D98FC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6b4f-301e-0042-1a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:22 GMT", + "x-ms-client-request-id" : "086c99a0-22d0-4a90-9d87-62f745788bb2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseerror0blobapitestrenewleaseerror0b6997256c099/javablobrenewleaseerror1blobapitestrenewleaseerror0b6299309d", + "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" : "02a1e4a3-b2dd-460e-87ab-8d1547388244", + "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 20:05:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735610C2CDE51\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca6b64-301e-0042-2e49-67cbbf000000", + "x-ms-client-request-id" : "02a1e4a3-b2dd-460e-87ab-8d1547388244" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseerror0blobapitestrenewleaseerror0b6997256c099/javablobrenewleaseerror2blobapitestrenewleaseerror0b69806693?comp=lease", + "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" : "866f540a-5aa9-49ce-a18d-06907f8eda9a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "c5ca6b76-301e-0042-3f49-67cbbf000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:c5ca6b76-301e-0042-3f49-67cbbf000000\nTime:2019-09-09T20:05:22.9391945Zx-ms-lease-idid", + "Date" : "Mon, 09 Sep 2019 20:05:22 GMT", + "x-ms-client-request-id" : "866f540a-5aa9-49ce-a18d-06907f8eda9a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrenewleaseerror&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" : "ee4e542e-5a8b-4e7f-b1d9-7206cee182cd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca6b83-301e-0042-4c49-67cbbf000000", + "Body" : "jtcrenewleaseerrorjtcrenewleaseerror0blobapitestrenewleaseerror0b6997256c099Mon, 09 Sep 2019 20:05:22 GMT\"0x8D735610C1D98FC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:22 GMT", + "x-ms-client-request-id" : "ee4e542e-5a8b-4e7f-b1d9-7206cee182cd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseerror0blobapitestrenewleaseerror0b6997256c099?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" : "20f99f53-d8ad-4d40-b8db-8193b75362ec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca6ba5-301e-0042-6d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:23 GMT", + "x-ms-client-request-id" : "20f99f53-d8ad-4d40-b8db-8193b75362ec" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseerror0blobapitestrenewleaseerror0b6997256c099", "javablobrenewleaseerror1blobapitestrenewleaseerror0b6299309d", "javablobrenewleaseerror2blobapitestrenewleaseerror0b69806693" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleasemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleasemin.json new file mode 100644 index 000000000000..2a7cd656460c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestrenewleasemin.json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleasemin0blobapitestrenewleasemin40144823ea1e728?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" : "ebfcb29e-4f37-422e-a807-d5a459817056" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356108F316C0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca665b-301e-0042-7e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:17 GMT", + "x-ms-client-request-id" : "ebfcb29e-4f37-422e-a807-d5a459817056" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleasemin0blobapitestrenewleasemin40144823ea1e728/javablobrenewleasemin1blobapitestrenewleasemin4019058974a3", + "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" : "badee326-4b85-4457-a371-c81ded98787b", + "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 20:05:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:17 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356109005ED2\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca666f-301e-0042-0e49-67cbbf000000", + "x-ms-client-request-id" : "badee326-4b85-4457-a371-c81ded98787b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleasemin0blobapitestrenewleasemin40144823ea1e728/javablobrenewleasemin1blobapitestrenewleasemin4019058974a3?comp=lease", + "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" : "150774f6-bdcf-4705-8ca2-0413bf12a403" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356109005ED2\"", + "x-ms-lease-id" : "3bb86598-b6f3-439f-a4ca-dc131125a56e", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca6687-301e-0042-2449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:17 GMT", + "x-ms-client-request-id" : "150774f6-bdcf-4705-8ca2-0413bf12a403" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleasemin0blobapitestrenewleasemin40144823ea1e728/javablobrenewleasemin1blobapitestrenewleasemin4019058974a3?comp=lease", + "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" : "c2c5ca73-b55d-489d-9620-c79e69bf8fc7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356109005ED2\"", + "x-ms-lease-id" : "3bb86598-b6f3-439f-a4ca-dc131125a56e", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca6697-301e-0042-3449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:17 GMT", + "x-ms-client-request-id" : "c2c5ca73-b55d-489d-9620-c79e69bf8fc7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrenewleasemin&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" : "c559e210-2253-41f5-afcb-cfddd26a3988" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca66ad-301e-0042-4649-67cbbf000000", + "Body" : "jtcrenewleaseminjtcrenewleasemin0blobapitestrenewleasemin40144823ea1e728Mon, 09 Sep 2019 20:05:17 GMT\"0x8D7356108F316C0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:17 GMT", + "x-ms-client-request-id" : "c559e210-2253-41f5-afcb-cfddd26a3988", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleasemin0blobapitestrenewleasemin40144823ea1e728?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" : "df645989-a9da-4ed7-9282-fafd9acfe1e2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca66b9-301e-0042-5149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:17 GMT", + "x-ms-client-request-id" : "df645989-a9da-4ed7-9282-fafd9acfe1e2" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleasemin0blobapitestrenewleasemin40144823ea1e728", "javablobrenewleasemin1blobapitestrenewleasemin4019058974a3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[0].json new file mode 100644 index 000000000000..912c2c922311 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[0].json @@ -0,0 +1,111 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac84b1741648f2?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" : "3f43b784-61da-4240-b893-f540b9bd0bcd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F38FDDD9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca3d93-301e-0042-8049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:41 GMT", + "x-ms-client-request-id" : "3f43b784-61da-4240-b893-f540b9bd0bcd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac84b1741648f2/javablobsethttpheadersac1blobapitestsethttpheadersac84b643084", + "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" : "e03c86fb-4690-462a-bffb-3ff84f8ea384", + "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 20:04:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:41 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F39C8572\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca3db4-301e-0042-2049-67cbbf000000", + "x-ms-client-request-id" : "e03c86fb-4690-462a-bffb-3ff84f8ea384" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac84b1741648f2/javablobsethttpheadersac1blobapitestsethttpheadersac84b643084?comp=properties", + "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" : "33a29a32-d496-42e8-bddd-6c9680229bc0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F3AA1C74\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca3dd4-301e-0042-3d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:41 GMT", + "x-ms-client-request-id" : "33a29a32-d496-42e8-bddd-6c9680229bc0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsethttpheadersac&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" : "7688c242-4861-46d2-b04e-35f9d1c8ded3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca3dec-301e-0042-5349-67cbbf000000", + "Body" : "jtcsethttpheadersacjtcsethttpheadersac0blobapitestsethttpheadersac84b1741648f2Mon, 09 Sep 2019 20:04:41 GMT\"0x8D73560F38FDDD9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:41 GMT", + "x-ms-client-request-id" : "7688c242-4861-46d2-b04e-35f9d1c8ded3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac84b1741648f2?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" : "4c210a5d-69a4-48c9-88ac-edaca2fccd4e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca3e0e-301e-0042-7349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:41 GMT", + "x-ms-client-request-id" : "4c210a5d-69a4-48c9-88ac-edaca2fccd4e" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersac0blobapitestsethttpheadersac84b1741648f2", "javablobsethttpheadersac1blobapitestsethttpheadersac84b643084" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[1].json new file mode 100644 index 000000000000..64320c9022e0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[1].json @@ -0,0 +1,111 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacfc2042382954?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" : "b22f83d1-88ed-4a98-bbf0-b48c48d3d899" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F3D29858\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca3e27-301e-0042-0c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:41 GMT", + "x-ms-client-request-id" : "b22f83d1-88ed-4a98-bbf0-b48c48d3d899" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacfc2042382954/javablobsethttpheadersac1blobapitestsethttpheadersacfc2095682", + "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" : "9573004e-3831-4584-b353-291cb902391a", + "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 20:04:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:42 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F3DFB529\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca3e3d-301e-0042-1f49-67cbbf000000", + "x-ms-client-request-id" : "9573004e-3831-4584-b353-291cb902391a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacfc2042382954/javablobsethttpheadersac1blobapitestsethttpheadersacfc2095682?comp=properties", + "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" : "0ca56764-dae0-4fb0-aa5e-fc0255e3f977" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F3EC61AE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca3e5c-301e-0042-3a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:42 GMT", + "x-ms-client-request-id" : "0ca56764-dae0-4fb0-aa5e-fc0255e3f977" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsethttpheadersac&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" : "088afdf6-9c32-4924-8a3f-55e928ac6257" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca3e71-301e-0042-4f49-67cbbf000000", + "Body" : "jtcsethttpheadersacjtcsethttpheadersac0blobapitestsethttpheadersacfc2042382954Mon, 09 Sep 2019 20:04:42 GMT\"0x8D73560F3D29858\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:42 GMT", + "x-ms-client-request-id" : "088afdf6-9c32-4924-8a3f-55e928ac6257", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersacfc2042382954?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" : "9060a67d-c21d-4321-b346-cb66fe8556d8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca3e87-301e-0042-6449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:42 GMT", + "x-ms-client-request-id" : "9060a67d-c21d-4321-b346-cb66fe8556d8" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersac0blobapitestsethttpheadersacfc2042382954", "javablobsethttpheadersac1blobapitestsethttpheadersacfc2095682" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[2].json new file mode 100644 index 000000000000..f9776e7718a4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[2].json @@ -0,0 +1,111 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac05149074705a?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" : "f3397f4c-d9ff-473d-bf5e-626d6a90ef83" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F4121DE8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca3e9d-301e-0042-7a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:42 GMT", + "x-ms-client-request-id" : "f3397f4c-d9ff-473d-bf5e-626d6a90ef83" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac05149074705a/javablobsethttpheadersac1blobapitestsethttpheadersac05105685a", + "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" : "be985fa9-29cb-4760-b5b8-751c48aeb164", + "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 20:04:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:42 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F4202545\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca3ebf-301e-0042-1749-67cbbf000000", + "x-ms-client-request-id" : "be985fa9-29cb-4760-b5b8-751c48aeb164" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac05149074705a/javablobsethttpheadersac1blobapitestsethttpheadersac05105685a?comp=properties", + "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" : "c72703b9-cc82-4f89-b53a-7a85632b8f7c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F42CF8DF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca3ee3-301e-0042-3a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:42 GMT", + "x-ms-client-request-id" : "c72703b9-cc82-4f89-b53a-7a85632b8f7c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsethttpheadersac&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" : "f5a6d175-2c02-4ec8-8e28-50579c26bbc8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca3f02-301e-0042-5849-67cbbf000000", + "Body" : "jtcsethttpheadersacjtcsethttpheadersac0blobapitestsethttpheadersac05149074705aMon, 09 Sep 2019 20:04:42 GMT\"0x8D73560F4121DE8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:42 GMT", + "x-ms-client-request-id" : "f5a6d175-2c02-4ec8-8e28-50579c26bbc8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac05149074705a?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" : "c992a795-8a6b-4b02-904b-9be6b54b6953" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca3f26-301e-0042-7c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:42 GMT", + "x-ms-client-request-id" : "c992a795-8a6b-4b02-904b-9be6b54b6953" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersac0blobapitestsethttpheadersac05149074705a", "javablobsethttpheadersac1blobapitestsethttpheadersac05105685a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[3].json new file mode 100644 index 000000000000..8b03b9b6abde --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[3].json @@ -0,0 +1,143 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac3a63743892ef?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" : "ad7775e4-4c3a-4e3d-a093-0e711523db19" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F4548A63\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca3f4e-301e-0042-2449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:42 GMT", + "x-ms-client-request-id" : "ad7775e4-4c3a-4e3d-a093-0e711523db19" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac3a63743892ef/javablobsethttpheadersac1blobapitestsethttpheadersac3a604314e", + "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" : "5418dd89-de05-4a7a-ba2b-d311271ccf29", + "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 20:04:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:42 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F461F532\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca3f67-301e-0042-3749-67cbbf000000", + "x-ms-client-request-id" : "5418dd89-de05-4a7a-ba2b-d311271ccf29" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac3a63743892ef/javablobsethttpheadersac1blobapitestsethttpheadersac3a604314e", + "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" : "6560f9af-b291-46af-aa08-46d34715f1e6" + }, + "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 20:04:42 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:42 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560F461F532\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:42 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca3f78-301e-0042-4849-67cbbf000000", + "x-ms-client-request-id" : "6560f9af-b291-46af-aa08-46d34715f1e6", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac3a63743892ef/javablobsethttpheadersac1blobapitestsethttpheadersac3a604314e?comp=properties", + "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" : "b8814a4b-aa4a-47dd-980d-4141724051ed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F47B0006\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca3f9e-301e-0042-6b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:43 GMT", + "x-ms-client-request-id" : "b8814a4b-aa4a-47dd-980d-4141724051ed" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsethttpheadersac&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" : "56bc6e0e-5c7b-4166-9a3f-26da5c1ceaae" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca3fb4-301e-0042-0149-67cbbf000000", + "Body" : "jtcsethttpheadersacjtcsethttpheadersac0blobapitestsethttpheadersac3a63743892efMon, 09 Sep 2019 20:04:42 GMT\"0x8D73560F4548A63\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:43 GMT", + "x-ms-client-request-id" : "56bc6e0e-5c7b-4166-9a3f-26da5c1ceaae", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac3a63743892ef?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" : "b4f2639e-4322-4b6d-862c-11d5a0556570" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca3fce-301e-0042-1a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:43 GMT", + "x-ms-client-request-id" : "b4f2639e-4322-4b6d-862c-11d5a0556570" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersac0blobapitestsethttpheadersac3a63743892ef", "javablobsethttpheadersac1blobapitestsethttpheadersac3a604314e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[4].json new file mode 100644 index 000000000000..af71c912a4cc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[4].json @@ -0,0 +1,111 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac77943261425e?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" : "7d30c663-786d-4bc0-bdda-4206c3310702" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F4A2B872\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca3ff9-301e-0042-4349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:43 GMT", + "x-ms-client-request-id" : "7d30c663-786d-4bc0-bdda-4206c3310702" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac77943261425e/javablobsethttpheadersac1blobapitestsethttpheadersac779635413", + "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" : "3eabde1b-71ef-49c8-a839-0ee0f27d0a15", + "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 20:04:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:43 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F4B098BF\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca4018-301e-0042-6049-67cbbf000000", + "x-ms-client-request-id" : "3eabde1b-71ef-49c8-a839-0ee0f27d0a15" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac77943261425e/javablobsethttpheadersac1blobapitestsethttpheadersac779635413?comp=properties", + "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" : "feab4c48-0046-40bc-aa7d-21d6b2eebebd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F4BD6C51\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca402e-301e-0042-7549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:43 GMT", + "x-ms-client-request-id" : "feab4c48-0046-40bc-aa7d-21d6b2eebebd" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsethttpheadersac&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" : "6396d7c9-b518-44bd-9a0a-483d20463bc5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca404f-301e-0042-1649-67cbbf000000", + "Body" : "jtcsethttpheadersacjtcsethttpheadersac0blobapitestsethttpheadersac77943261425eMon, 09 Sep 2019 20:04:43 GMT\"0x8D73560F4A2B872\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:43 GMT", + "x-ms-client-request-id" : "6396d7c9-b518-44bd-9a0a-483d20463bc5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac77943261425e?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" : "f65708ca-3aa9-45a2-bfb2-51b4f7daf30c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca4065-301e-0042-2949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:43 GMT", + "x-ms-client-request-id" : "f65708ca-3aa9-45a2-bfb2-51b4f7daf30c" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersac0blobapitestsethttpheadersac77943261425e", "javablobsethttpheadersac1blobapitestsethttpheadersac779635413" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[5].json new file mode 100644 index 000000000000..3c0d0de399e8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersac[5].json @@ -0,0 +1,133 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac70345053bc4f?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" : "55ce8846-3e4e-43ca-a569-7db207a696c7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F4E572EF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca4085-301e-0042-4849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:43 GMT", + "x-ms-client-request-id" : "55ce8846-3e4e-43ca-a569-7db207a696c7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac70345053bc4f/javablobsethttpheadersac1blobapitestsethttpheadersac703807053", + "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" : "8377732a-3948-4b29-ab41-c3b0163f9a29", + "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 20:04:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:43 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F4F2DDEC\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca409f-301e-0042-6049-67cbbf000000", + "x-ms-client-request-id" : "8377732a-3948-4b29-ab41-c3b0163f9a29" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac70345053bc4f/javablobsethttpheadersac1blobapitestsethttpheadersac703807053?comp=lease", + "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" : "4feddcae-2ebf-4507-9d4a-8fd0934009e4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F4F2DDEC\"", + "x-ms-lease-id" : "7f78d0c7-fe61-4ca9-aa74-ccc5b2e8f44b", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca40c2-301e-0042-7a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:43 GMT", + "x-ms-client-request-id" : "4feddcae-2ebf-4507-9d4a-8fd0934009e4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac70345053bc4f/javablobsethttpheadersac1blobapitestsethttpheadersac703807053?comp=properties", + "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" : "c47a853a-96a7-41df-aba7-7e258ba85490" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F50C36E5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca40d8-301e-0042-1049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:44 GMT", + "x-ms-client-request-id" : "c47a853a-96a7-41df-aba7-7e258ba85490" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsethttpheadersac&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" : "232c280b-410c-4584-bbc6-c780f4028b6b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca40f7-301e-0042-2c49-67cbbf000000", + "Body" : "jtcsethttpheadersacjtcsethttpheadersac0blobapitestsethttpheadersac70345053bc4fMon, 09 Sep 2019 20:04:43 GMT\"0x8D73560F4E572EF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:44 GMT", + "x-ms-client-request-id" : "232c280b-410c-4584-bbc6-c780f4028b6b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersac0blobapitestsethttpheadersac70345053bc4f?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" : "b51bd4d0-f170-4800-952c-33f6ac040990" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca4124-301e-0042-5549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:44 GMT", + "x-ms-client-request-id" : "b51bd4d0-f170-4800-952c-33f6ac040990" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersac0blobapitestsethttpheadersac70345053bc4f", "javablobsethttpheadersac1blobapitestsethttpheadersac703807053" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[0].json new file mode 100644 index 000000000000..58528f80e4ba --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[0].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersacfail070819751a774c85f34272b?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" : "e6948e1b-24ad-41a9-9454-82fc4bd958f5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F531CC16\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca414f-301e-0042-7d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:44 GMT", + "x-ms-client-request-id" : "e6948e1b-24ad-41a9-9454-82fc4bd958f5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersacfail070819751a774c85f34272b/javablobsethttpheadersacfail16439302de839865b34d", + "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" : "58eb9fc9-2056-47a3-9fbf-306bafe782cb", + "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 20:04:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:44 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F53E7398\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca416d-301e-0042-1a49-67cbbf000000", + "x-ms-client-request-id" : "58eb9fc9-2056-47a3-9fbf-306bafe782cb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersacfail070819751a774c85f34272b/javablobsethttpheadersacfail16439302de839865b34d?comp=properties", + "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" : "bd8cacca-d340-4e50-83af-544be0d7762d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca4182-301e-0042-2f49-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca4182-301e-0042-2f49-67cbbf000000\nTime:2019-09-09T20:04:44.4679680Z", + "Date" : "Mon, 09 Sep 2019 20:04:44 GMT", + "x-ms-client-request-id" : "bd8cacca-d340-4e50-83af-544be0d7762d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsethttpheadersacfail&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" : "e015dd30-e6cd-4c81-b017-dc2690b7ce37" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca419f-301e-0042-4c49-67cbbf000000", + "Body" : "jtcsethttpheadersacfailjtcsethttpheadersacfail070819751a774c85f34272bMon, 09 Sep 2019 20:04:44 GMT\"0x8D73560F531CC16\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:44 GMT", + "x-ms-client-request-id" : "e015dd30-e6cd-4c81-b017-dc2690b7ce37", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersacfail070819751a774c85f34272b?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" : "7db95efd-66c0-4376-9f5c-71ac93d5a98f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca41b2-301e-0042-5f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:44 GMT", + "x-ms-client-request-id" : "7db95efd-66c0-4376-9f5c-71ac93d5a98f" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersacfail070819751a774c85f34272b", "javablobsethttpheadersacfail16439302de839865b34d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[1].json new file mode 100644 index 000000000000..09a190f8fab4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[1].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersacfail087555f67160a25841417aa?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" : "546d0d92-1a12-4420-9918-4726942ca8a6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F571C6F2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca41ce-301e-0042-7949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:44 GMT", + "x-ms-client-request-id" : "546d0d92-1a12-4420-9918-4726942ca8a6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersacfail087555f67160a25841417aa/javablobsethttpheadersacfail134555325dbb8754a247", + "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" : "2c295586-4e33-4d4e-ae52-b80bf305a72b", + "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 20:04:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:44 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F57F0ACD\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca41ed-301e-0042-1449-67cbbf000000", + "x-ms-client-request-id" : "2c295586-4e33-4d4e-ae52-b80bf305a72b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersacfail087555f67160a25841417aa/javablobsethttpheadersacfail134555325dbb8754a247?comp=properties", + "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" : "302c16b1-7545-4174-a6a0-e4b84e3b5ca1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca41fe-301e-0042-2449-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca41fe-301e-0042-2449-67cbbf000000\nTime:2019-09-09T20:04:44.8992754Z", + "Date" : "Mon, 09 Sep 2019 20:04:44 GMT", + "x-ms-client-request-id" : "302c16b1-7545-4174-a6a0-e4b84e3b5ca1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsethttpheadersacfail&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" : "6d20608d-bfd2-4b94-afeb-2fa1f6011e84" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca4221-301e-0042-4249-67cbbf000000", + "Body" : "jtcsethttpheadersacfailjtcsethttpheadersacfail087555f67160a25841417aaMon, 09 Sep 2019 20:04:44 GMT\"0x8D73560F571C6F2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:44 GMT", + "x-ms-client-request-id" : "6d20608d-bfd2-4b94-afeb-2fa1f6011e84", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersacfail087555f67160a25841417aa?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" : "d831d324-3c7e-4b93-a995-938659b43be2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca423b-301e-0042-5b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:45 GMT", + "x-ms-client-request-id" : "d831d324-3c7e-4b93-a995-938659b43be2" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersacfail087555f67160a25841417aa", "javablobsethttpheadersacfail134555325dbb8754a247" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[2].json new file mode 100644 index 000000000000..852be0d608f2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[2].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersacfail01670278a0d48ad3294afbb?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" : "479e2734-d857-470a-a51f-dc7ba0253915" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F5B36FCB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca4267-301e-0042-0349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:45 GMT", + "x-ms-client-request-id" : "479e2734-d857-470a-a51f-dc7ba0253915" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersacfail01670278a0d48ad3294afbb/javablobsethttpheadersacfail181469f1b9547ca0e147", + "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" : "1a049d1a-2d08-41af-aefb-03d66606ace7", + "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 20:04:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:45 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F5C0B3A2\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca4283-301e-0042-1b49-67cbbf000000", + "x-ms-client-request-id" : "1a049d1a-2d08-41af-aefb-03d66606ace7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersacfail01670278a0d48ad3294afbb/javablobsethttpheadersacfail181469f1b9547ca0e147?comp=properties", + "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" : "b2b14b97-29f3-4d22-971d-f0f8767ea15a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca429d-301e-0042-3449-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca429d-301e-0042-3449-67cbbf000000\nTime:2019-09-09T20:04:45.3245780Z", + "Date" : "Mon, 09 Sep 2019 20:04:45 GMT", + "x-ms-client-request-id" : "b2b14b97-29f3-4d22-971d-f0f8767ea15a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsethttpheadersacfail&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" : "f4be8faa-c80e-4d3d-876d-3b6940fcee5a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca42b4-301e-0042-4a49-67cbbf000000", + "Body" : "jtcsethttpheadersacfailjtcsethttpheadersacfail01670278a0d48ad3294afbbMon, 09 Sep 2019 20:04:45 GMT\"0x8D73560F5B36FCB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:45 GMT", + "x-ms-client-request-id" : "f4be8faa-c80e-4d3d-876d-3b6940fcee5a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersacfail01670278a0d48ad3294afbb?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" : "9ddd0f75-5bbd-445b-9859-0c58d69736a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca42c1-301e-0042-5649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:45 GMT", + "x-ms-client-request-id" : "9ddd0f75-5bbd-445b-9859-0c58d69736a4" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersacfail01670278a0d48ad3294afbb", "javablobsethttpheadersacfail181469f1b9547ca0e147" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[3].json new file mode 100644 index 000000000000..b3498f98bd81 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[3].json @@ -0,0 +1,144 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersacfail025759bdf33c918c2048798?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" : "c9da1784-45e2-4098-a95f-8df097b86c7e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F5F4F18E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca42e2-301e-0042-7749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:45 GMT", + "x-ms-client-request-id" : "c9da1784-45e2-4098-a95f-8df097b86c7e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersacfail025759bdf33c918c2048798/javablobsethttpheadersacfail1222386409a5d121c743", + "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" : "50d0e650-6670-46be-a627-22dbbd156661", + "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 20:04:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:45 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F602F8D3\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca4306-301e-0042-1949-67cbbf000000", + "x-ms-client-request-id" : "50d0e650-6670-46be-a627-22dbbd156661" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersacfail025759bdf33c918c2048798/javablobsethttpheadersacfail1222386409a5d121c743", + "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" : "8ce1ccaf-c62a-4849-8133-53d631d027a2" + }, + "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 20:04:45 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:45 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560F602F8D3\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:45 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca431f-301e-0042-3149-67cbbf000000", + "x-ms-client-request-id" : "8ce1ccaf-c62a-4849-8133-53d631d027a2", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersacfail025759bdf33c918c2048798/javablobsethttpheadersacfail1222386409a5d121c743?comp=properties", + "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" : "74771555-ffcc-4126-92e3-77d024fbba1a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca4333-301e-0042-4449-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca4333-301e-0042-4449-67cbbf000000\nTime:2019-09-09T20:04:45.8439477Z", + "Date" : "Mon, 09 Sep 2019 20:04:45 GMT", + "x-ms-client-request-id" : "74771555-ffcc-4126-92e3-77d024fbba1a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsethttpheadersacfail&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" : "d0283aa8-540e-4270-a533-b87ef23da936" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca434b-301e-0042-5c49-67cbbf000000", + "Body" : "jtcsethttpheadersacfailjtcsethttpheadersacfail025759bdf33c918c2048798Mon, 09 Sep 2019 20:04:45 GMT\"0x8D73560F5F4F18E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:45 GMT", + "x-ms-client-request-id" : "d0283aa8-540e-4270-a533-b87ef23da936", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersacfail025759bdf33c918c2048798?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" : "f6d706ad-4028-41e3-9bfc-fb4e6cc567dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca4366-301e-0042-7749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:45 GMT", + "x-ms-client-request-id" : "f6d706ad-4028-41e3-9bfc-fb4e6cc567dc" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersacfail025759bdf33c918c2048798", "javablobsethttpheadersacfail1222386409a5d121c743" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[4].json new file mode 100644 index 000000000000..94137b3a26a4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersacfail[4].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersacfail0196340393c4e294b24dbaa?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" : "629703bf-9658-4eed-b736-55f834c15f95" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F645B856\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca438a-301e-0042-1749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:46 GMT", + "x-ms-client-request-id" : "629703bf-9658-4eed-b736-55f834c15f95" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersacfail0196340393c4e294b24dbaa/javablobsethttpheadersacfail131542ae8badbbf8d344", + "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" : "574dad2a-2f7d-4609-9830-b6341ce2fe58", + "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 20:04:46 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:46 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F652ADF6\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca439f-301e-0042-2b49-67cbbf000000", + "x-ms-client-request-id" : "574dad2a-2f7d-4609-9830-b6341ce2fe58" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersacfail0196340393c4e294b24dbaa/javablobsethttpheadersacfail131542ae8badbbf8d344?comp=lease", + "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" : "eea40291-b481-4965-a7da-99f97549be3e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F652ADF6\"", + "x-ms-lease-id" : "9821fa37-e256-45d2-8877-5b4cf43d8945", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca43b8-301e-0042-4349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:46 GMT", + "x-ms-client-request-id" : "eea40291-b481-4965-a7da-99f97549be3e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersacfail0196340393c4e294b24dbaa/javablobsethttpheadersacfail131542ae8badbbf8d344?comp=properties", + "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" : "eb78d448-8b2f-4686-b710-1f95a3fa2442" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca43e0-301e-0042-6b49-67cbbf000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:c5ca43e0-301e-0042-6b49-67cbbf000000\nTime:2019-09-09T20:04:46.3583144Z", + "Date" : "Mon, 09 Sep 2019 20:04:46 GMT", + "x-ms-client-request-id" : "eb78d448-8b2f-4686-b710-1f95a3fa2442", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsethttpheadersacfail&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" : "2c17a498-0dad-4bb6-949e-bade0dd55928" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca43ef-301e-0042-7a49-67cbbf000000", + "Body" : "jtcsethttpheadersacfailjtcsethttpheadersacfail0196340393c4e294b24dbaaMon, 09 Sep 2019 20:04:46 GMT\"0x8D73560F645B856\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:46 GMT", + "x-ms-client-request-id" : "2c17a498-0dad-4bb6-949e-bade0dd55928", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersacfail0196340393c4e294b24dbaa?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" : "c351bb66-99fc-4361-aa2e-2300999da63e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca440e-301e-0042-1849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:46 GMT", + "x-ms-client-request-id" : "c351bb66-99fc-4361-aa2e-2300999da63e" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersacfail0196340393c4e294b24dbaa", "javablobsethttpheadersacfail131542ae8badbbf8d344" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheaderserror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheaderserror.json new file mode 100644 index 000000000000..fd5a6111e5ca --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheaderserror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheaderserror0blobapitestsethttpheaderserror3f905504d?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" : "e865f481-dd1d-4820-91ff-89486a7551aa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F6939868\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca442d-301e-0042-3649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:46 GMT", + "x-ms-client-request-id" : "e865f481-dd1d-4820-91ff-89486a7551aa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheaderserror0blobapitestsethttpheaderserror3f905504d/javablobsethttpheaderserror10161406177b8961d2484", + "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" : "578ad7b5-586f-4bd8-881d-773f2538e098", + "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 20:04:46 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:46 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F6A0B51E\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca4445-301e-0042-4a49-67cbbf000000", + "x-ms-client-request-id" : "578ad7b5-586f-4bd8-881d-773f2538e098" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheaderserror0blobapitestsethttpheaderserror3f905504d/javablobsethttpheaderserror22613751aea772314b40e?comp=properties", + "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" : "9de47a6f-e248-4c38-964e-fc72b07d7077" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "BlobNotFound", + "retry-after" : "0", + "Content-Length" : "215", + "StatusCode" : "404", + "x-ms-request-id" : "c5ca4459-301e-0042-5c49-67cbbf000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:c5ca4459-301e-0042-5c49-67cbbf000000\nTime:2019-09-09T20:04:46.7926226Z", + "Date" : "Mon, 09 Sep 2019 20:04:46 GMT", + "x-ms-client-request-id" : "9de47a6f-e248-4c38-964e-fc72b07d7077", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsethttpheaderserror&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" : "72d00945-3873-46bb-88bd-684f977534e1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca4472-301e-0042-7449-67cbbf000000", + "Body" : "jtcsethttpheaderserrorjtcsethttpheaderserror0blobapitestsethttpheaderserror3f905504dMon, 09 Sep 2019 20:04:46 GMT\"0x8D73560F6939868\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:46 GMT", + "x-ms-client-request-id" : "72d00945-3873-46bb-88bd-684f977534e1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheaderserror0blobapitestsethttpheaderserror3f905504d?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" : "08b8c253-c0ed-494c-a70f-5c59336d53f4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca4490-301e-0042-0c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:46 GMT", + "x-ms-client-request-id" : "08b8c253-c0ed-494c-a70f-5c59336d53f4" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheaderserror0blobapitestsethttpheaderserror3f905504d", "javablobsethttpheaderserror10161406177b8961d2484", "javablobsethttpheaderserror22613751aea772314b40e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersheaders[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersheaders[0].json new file mode 100644 index 000000000000..9679a5750edb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersheaders[0].json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersheaders009879b7ac2d3c920646d5?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" : "b51b06a8-2ada-4f1a-8450-64fb1c52ecc0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F2EFD768\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca3c29-301e-0042-3049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:40 GMT", + "x-ms-client-request-id" : "b51b06a8-2ada-4f1a-8450-64fb1c52ecc0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersheaders009879b7ac2d3c920646d5/javablobsethttpheadersheaders122985241c93530b7d40", + "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" : "cda5f85b-f1d5-4407-8c4b-c4cfb25d2df1", + "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 20:04:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:40 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F2FCCCFD\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca3c43-301e-0042-4949-67cbbf000000", + "x-ms-client-request-id" : "cda5f85b-f1d5-4407-8c4b-c4cfb25d2df1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersheaders009879b7ac2d3c920646d5/javablobsethttpheadersheaders122985241c93530b7d40?comp=properties", + "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" : "97f4ef76-7d29-4a8f-adf7-3b6b4cd09d63" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F3095260\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca3c57-301e-0042-5c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:40 GMT", + "x-ms-client-request-id" : "97f4ef76-7d29-4a8f-adf7-3b6b4cd09d63" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersheaders009879b7ac2d3c920646d5/javablobsethttpheadersheaders122985241c93530b7d40", + "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" : "e19e840d-c07b-4bfb-bb07-0d508ca2602e" + }, + "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 20:04:40 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:40 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560F3095260\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:40 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca3c66-301e-0042-6a49-67cbbf000000", + "x-ms-client-request-id" : "e19e840d-c07b-4bfb-bb07-0d508ca2602e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsethttpheadersheaders&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" : "9cdccb9f-9076-42a2-bd40-70355276c1b7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca3c9a-301e-0042-1649-67cbbf000000", + "Body" : "jtcsethttpheadersheadersjtcsethttpheadersheaders009879b7ac2d3c920646d5Mon, 09 Sep 2019 20:04:40 GMT\"0x8D73560F2EFD768\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:40 GMT", + "x-ms-client-request-id" : "9cdccb9f-9076-42a2-bd40-70355276c1b7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersheaders009879b7ac2d3c920646d5?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" : "d7e82b7b-c418-43d9-9ea6-69c8acafbb60" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca3cc7-301e-0042-4249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:40 GMT", + "x-ms-client-request-id" : "d7e82b7b-c418-43d9-9ea6-69c8acafbb60" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersheaders009879b7ac2d3c920646d5", "javablobsethttpheadersheaders122985241c93530b7d40" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersheaders[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersheaders[1].json new file mode 100644 index 000000000000..9ced9912beb8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersheaders[1].json @@ -0,0 +1,147 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersheaders0013560e729fd4d46f4894?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" : "f8f40497-68ce-449b-bece-ad518d4c9a1b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F33E058F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca3cea-301e-0042-6249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:40 GMT", + "x-ms-client-request-id" : "f8f40497-68ce-449b-bece-ad518d4c9a1b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersheaders0013560e729fd4d46f4894/javablobsethttpheadersheaders1524155364067c9ed741", + "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" : "b340be73-41fb-45a2-ad21-76ca12f89455", + "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 20:04:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:41 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F34FDE1D\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca3d1d-301e-0042-1149-67cbbf000000", + "x-ms-client-request-id" : "b340be73-41fb-45a2-ad21-76ca12f89455" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersheaders0013560e729fd4d46f4894/javablobsethttpheadersheaders1524155364067c9ed741?comp=properties", + "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" : "8ffe28af-ae90-4c06-bbe2-20a957d7ba4a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F35D7528\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca3d3d-301e-0042-2f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:41 GMT", + "x-ms-client-request-id" : "8ffe28af-ae90-4c06-bbe2-20a957d7ba4a" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersheaders0013560e729fd4d46f4894/javablobsethttpheadersheaders1524155364067c9ed741", + "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" : "92bbec95-4e49-4e2c-9bd8-684bcd671b7a" + }, + "Response" : { + "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 20:04:41 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "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 20:04:41 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca3d51-301e-0042-4149-67cbbf000000", + "Content-Type" : "type", + "x-ms-version" : "2019-02-02", + "Date" : "Mon, 09 Sep 2019 20:04:41 GMT", + "Content-MD5" : "d2grV20xOEQwejFENEUrUEUyNTJnZz09", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "control", + "ETag" : "\"0x8D73560F35D7528\"", + "Content-Disposition" : "disposition", + "x-ms-client-request-id" : "92bbec95-4e49-4e2c-9bd8-684bcd671b7a", + "Content-Language" : "language" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsethttpheadersheaders&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" : "03242c0d-2d7f-4612-af4d-175bc329a2d5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca3d61-301e-0042-5149-67cbbf000000", + "Body" : "jtcsethttpheadersheadersjtcsethttpheadersheaders0013560e729fd4d46f4894Mon, 09 Sep 2019 20:04:41 GMT\"0x8D73560F33E058F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:41 GMT", + "x-ms-client-request-id" : "03242c0d-2d7f-4612-af4d-175bc329a2d5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersheaders0013560e729fd4d46f4894?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" : "4f30587d-6c45-468e-8240-cda53c6ee9a9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca3d7d-301e-0042-6c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:41 GMT", + "x-ms-client-request-id" : "4f30587d-6c45-468e-8240-cda53c6ee9a9" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersheaders0013560e729fd4d46f4894", "javablobsethttpheadersheaders1524155364067c9ed741" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersmin.json new file mode 100644 index 000000000000..f360ae0f11ce --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersmin.json @@ -0,0 +1,176 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersmin0blobapitestsethttpheadersmin0d937525435?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" : "26424e1a-0efe-49c7-a73e-3da91c9a9e63" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F295E735\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca3b51-301e-0042-6649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:39 GMT", + "x-ms-client-request-id" : "26424e1a-0efe-49c7-a73e-3da91c9a9e63" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersmin0blobapitestsethttpheadersmin0d937525435/javablobsethttpheadersmin1blobapitestsethttpheadersmin0d969138", + "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" : "cc3efb6a-431a-482a-b22e-926f30a24ef6", + "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 20:04:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:39 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F2A32B01\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca3b6a-301e-0042-7d49-67cbbf000000", + "x-ms-client-request-id" : "cc3efb6a-431a-482a-b22e-926f30a24ef6" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersmin0blobapitestsethttpheadersmin0d937525435/javablobsethttpheadersmin1blobapitestsethttpheadersmin0d969138", + "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" : "ee22dba4-4a3e-454f-91c7-16eb9581d10e" + }, + "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 20:04:40 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:40 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560F2A32B01\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:40 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca3b87-301e-0042-1849-67cbbf000000", + "x-ms-client-request-id" : "ee22dba4-4a3e-454f-91c7-16eb9581d10e", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersmin0blobapitestsethttpheadersmin0d937525435/javablobsethttpheadersmin1blobapitestsethttpheadersmin0d969138?comp=properties", + "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" : "72ddc4a1-071f-4571-a10c-dd2f106ca2a6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F2BECE53\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca3bba-301e-0042-4849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:40 GMT", + "x-ms-client-request-id" : "72ddc4a1-071f-4571-a10c-dd2f106ca2a6" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersmin0blobapitestsethttpheadersmin0d937525435/javablobsethttpheadersmin1blobapitestsethttpheadersmin0d969138", + "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" : "4078d12e-425a-469b-9a9a-37c104739132" + }, + "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 20:04:40 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:40 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "d2grV20xOEQwejFENEUrUEUyNTJnZz09", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560F2BECE53\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:40 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca3bcf-301e-0042-5d49-67cbbf000000", + "Body" : "", + "x-ms-client-request-id" : "4078d12e-425a-469b-9a9a-37c104739132", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsethttpheadersmin&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" : "2f44e71a-6151-4a68-abaa-5bd7ee24df0c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca3bea-301e-0042-7749-67cbbf000000", + "Body" : "jtcsethttpheadersminjtcsethttpheadersmin0blobapitestsethttpheadersmin0d937525435Mon, 09 Sep 2019 20:04:39 GMT\"0x8D73560F295E735\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:40 GMT", + "x-ms-client-request-id" : "2f44e71a-6151-4a68-abaa-5bd7ee24df0c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersmin0blobapitestsethttpheadersmin0d937525435?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" : "1a6d7f08-5ba4-4d4b-86ac-46a6668a41ab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca3c10-301e-0042-1949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:40 GMT", + "x-ms-client-request-id" : "1a6d7f08-5ba4-4d4b-86ac-46a6668a41ab" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersmin0blobapitestsethttpheadersmin0d937525435", "javablobsethttpheadersmin1blobapitestsethttpheadersmin0d969138" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersnull.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersnull.json new file mode 100644 index 000000000000..bdbaa5fcdfab --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsethttpheadersnull.json @@ -0,0 +1,111 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersnull0blobapitestsethttpheadersnullcbd6452533?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" : "4c266132-2cfd-4f46-9b3b-b708a05de36c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F251A5D1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca3abf-301e-0042-5849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:39 GMT", + "x-ms-client-request-id" : "4c266132-2cfd-4f46-9b3b-b708a05de36c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersnull0blobapitestsethttpheadersnullcbd6452533/javablobsethttpheadersnull14794189a49027cad041d", + "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" : "b6030df3-2682-401a-a172-ceee56ca1b46", + "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 20:04:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:39 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F25E745A\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca3ade-301e-0042-7449-67cbbf000000", + "x-ms-client-request-id" : "b6030df3-2682-401a-a172-ceee56ca1b46" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersnull0blobapitestsethttpheadersnullcbd6452533/javablobsethttpheadersnull14794189a49027cad041d?comp=properties", + "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" : "89b3c3c0-7a5d-4de3-a23d-e0c55e38a403" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F26B20DB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca3afc-301e-0042-1249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:39 GMT", + "x-ms-client-request-id" : "89b3c3c0-7a5d-4de3-a23d-e0c55e38a403" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsethttpheadersnull&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" : "f6676587-1f3d-4077-a9f1-0bacdfcb41ff" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca3b17-301e-0042-2c49-67cbbf000000", + "Body" : "jtcsethttpheadersnulljtcsethttpheadersnull0blobapitestsethttpheadersnullcbd6452533Mon, 09 Sep 2019 20:04:39 GMT\"0x8D73560F251A5D1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:39 GMT", + "x-ms-client-request-id" : "f6676587-1f3d-4077-a9f1-0bacdfcb41ff", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsethttpheadersnull0blobapitestsethttpheadersnullcbd6452533?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" : "7d2b63fc-5f32-4f84-9617-b93852f0724d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca3b35-301e-0042-4a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:39 GMT", + "x-ms-client-request-id" : "7d2b63fc-5f32-4f84-9617-b93852f0724d" + }, + "Exception" : null + } ], + "variables" : [ "jtcsethttpheadersnull0blobapitestsethttpheadersnullcbd6452533", "javablobsethttpheadersnull14794189a49027cad041d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[0].json new file mode 100644 index 000000000000..e77534b234d9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[0].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac46b074792913486?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" : "26fcda2d-e9ac-41d1-8d64-16d8dc4ede86" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F80C24F0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca46be-301e-0042-1649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:49 GMT", + "x-ms-client-request-id" : "26fcda2d-e9ac-41d1-8d64-16d8dc4ede86" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac46b074792913486/javablobsetmetadataac1blobapitestsetmetadataac46b598888727", + "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" : "5253e3a6-fbed-4aff-b445-511744399e62", + "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 20:04:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:49 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F81A2C59\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca46d4-301e-0042-2a49-67cbbf000000", + "x-ms-client-request-id" : "5253e3a6-fbed-4aff-b445-511744399e62" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac46b074792913486/javablobsetmetadataac1blobapitestsetmetadataac46b598888727?comp=metadata", + "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" : "7a9f9066-2f06-49fb-b03c-99e751741404" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F826FFEF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca46ea-301e-0042-3f49-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:49 GMT", + "x-ms-client-request-id" : "7a9f9066-2f06-49fb-b03c-99e751741404" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadataac&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" : "2d88c25f-9b07-4886-b9ab-cebdbee59309" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca46fa-301e-0042-4f49-67cbbf000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0blobapitestsetmetadataac46b074792913486Mon, 09 Sep 2019 20:04:49 GMT\"0x8D73560F80C24F0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:49 GMT", + "x-ms-client-request-id" : "2d88c25f-9b07-4886-b9ab-cebdbee59309", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac46b074792913486?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" : "c2646424-a9cd-4b7d-828d-d0f96a0b0a2e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca470c-301e-0042-5f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:49 GMT", + "x-ms-client-request-id" : "c2646424-a9cd-4b7d-828d-d0f96a0b0a2e" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0blobapitestsetmetadataac46b074792913486", "javablobsetmetadataac1blobapitestsetmetadataac46b598888727" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[1].json new file mode 100644 index 000000000000..c8b0b2fd88d3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[1].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac01c52393aa7e51a?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" : "db111ae0-7f16-4e3c-a947-7ef8e6e70255" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F84C950F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca471d-301e-0042-7049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:49 GMT", + "x-ms-client-request-id" : "db111ae0-7f16-4e3c-a947-7ef8e6e70255" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac01c52393aa7e51a/javablobsetmetadataac1blobapitestsetmetadataac01c049051520", + "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" : "bbd6b231-9661-4df2-86a5-01a69b5f1f04", + "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 20:04:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:49 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F859B1EA\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca472a-301e-0042-7c49-67cbbf000000", + "x-ms-client-request-id" : "bbd6b231-9661-4df2-86a5-01a69b5f1f04" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac01c52393aa7e51a/javablobsetmetadataac1blobapitestsetmetadataac01c049051520?comp=metadata", + "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" : "ef2c83c0-52ed-470f-8e0d-951a37ebcc9f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F8665E66\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca4740-301e-0042-1249-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:49 GMT", + "x-ms-client-request-id" : "ef2c83c0-52ed-470f-8e0d-951a37ebcc9f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadataac&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" : "a013ac3d-7f3b-4b8a-8cb1-4e1e0618b59b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca475c-301e-0042-2c49-67cbbf000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0blobapitestsetmetadataac01c52393aa7e51aMon, 09 Sep 2019 20:04:49 GMT\"0x8D73560F84C950F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:49 GMT", + "x-ms-client-request-id" : "a013ac3d-7f3b-4b8a-8cb1-4e1e0618b59b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac01c52393aa7e51a?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" : "651ca27f-4da1-4a1a-9040-41af738a6cce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca4785-301e-0042-5149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:49 GMT", + "x-ms-client-request-id" : "651ca27f-4da1-4a1a-9040-41af738a6cce" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0blobapitestsetmetadataac01c52393aa7e51a", "javablobsetmetadataac1blobapitestsetmetadataac01c049051520" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[2].json new file mode 100644 index 000000000000..7ec58b889f9e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[2].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac822180321a136c0?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" : "12990f53-4456-4f2e-a858-8d755186c097" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F88D7A72\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca47ac-301e-0042-7649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:49 GMT", + "x-ms-client-request-id" : "12990f53-4456-4f2e-a858-8d755186c097" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac822180321a136c0/javablobsetmetadataac1blobapitestsetmetadataac822214394273", + "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" : "03ae26f3-f32b-44d1-be5f-0af26f1af2be", + "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 20:04:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:49 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F89ABE62\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca47c1-301e-0042-0949-67cbbf000000", + "x-ms-client-request-id" : "03ae26f3-f32b-44d1-be5f-0af26f1af2be" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac822180321a136c0/javablobsetmetadataac1blobapitestsetmetadataac822214394273?comp=metadata", + "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" : "ca896ecf-5ad8-45e3-9137-3d06b1d5940f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F8A76AE3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca47e5-301e-0042-2749-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:50 GMT", + "x-ms-client-request-id" : "ca896ecf-5ad8-45e3-9137-3d06b1d5940f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadataac&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" : "9f053e92-b060-49b8-8e08-e57cf51a042f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca4804-301e-0042-4249-67cbbf000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0blobapitestsetmetadataac822180321a136c0Mon, 09 Sep 2019 20:04:49 GMT\"0x8D73560F88D7A72\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:50 GMT", + "x-ms-client-request-id" : "9f053e92-b060-49b8-8e08-e57cf51a042f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac822180321a136c0?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" : "d4fabf7b-5c3b-4807-9fe3-e22a376e1ac5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca481c-301e-0042-5849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:50 GMT", + "x-ms-client-request-id" : "d4fabf7b-5c3b-4807-9fe3-e22a376e1ac5" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0blobapitestsetmetadataac822180321a136c0", "javablobsetmetadataac1blobapitestsetmetadataac822214394273" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[3].json new file mode 100644 index 000000000000..726058fa9457 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[3].json @@ -0,0 +1,144 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac7d48793349cdf3e?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" : "1999e258-6633-4035-8269-06df921ef39b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F8CEAE07\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca482b-301e-0042-6649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:50 GMT", + "x-ms-client-request-id" : "1999e258-6633-4035-8269-06df921ef39b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac7d48793349cdf3e/javablobsetmetadataac1blobapitestsetmetadataac7d455533d51b", + "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" : "35d83d53-3476-462f-8c80-329497092e07", + "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 20:04:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:50 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F8DBF1EF\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca4850-301e-0042-0949-67cbbf000000", + "x-ms-client-request-id" : "35d83d53-3476-462f-8c80-329497092e07" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac7d48793349cdf3e/javablobsetmetadataac1blobapitestsetmetadataac7d455533d51b", + "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" : "33950c07-d127-4f24-a0b4-d46a0105bc02" + }, + "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 20:04:50 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:50 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560F8DBF1EF\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:50 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca4876-301e-0042-2d49-67cbbf000000", + "x-ms-client-request-id" : "33950c07-d127-4f24-a0b4-d46a0105bc02", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac7d48793349cdf3e/javablobsetmetadataac1blobapitestsetmetadataac7d455533d51b?comp=metadata", + "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" : "341a8e91-889f-45d3-8ece-cc30303e810c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F8F523D3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca488b-301e-0042-4249-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:50 GMT", + "x-ms-client-request-id" : "341a8e91-889f-45d3-8ece-cc30303e810c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadataac&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" : "baca929d-2711-4628-b6f8-a810a83e2a2a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca48a3-301e-0042-5849-67cbbf000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0blobapitestsetmetadataac7d48793349cdf3eMon, 09 Sep 2019 20:04:50 GMT\"0x8D73560F8CEAE07\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:50 GMT", + "x-ms-client-request-id" : "baca929d-2711-4628-b6f8-a810a83e2a2a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac7d48793349cdf3e?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" : "1a3c7e84-f227-4ee9-8b51-524a2132d1c5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca48c1-301e-0042-7349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:50 GMT", + "x-ms-client-request-id" : "1a3c7e84-f227-4ee9-8b51-524a2132d1c5" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0blobapitestsetmetadataac7d48793349cdf3e", "javablobsetmetadataac1blobapitestsetmetadataac7d455533d51b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[4].json new file mode 100644 index 000000000000..b9a67004b516 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[4].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataacb1a2778812610c6?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" : "4ced6202-2a09-496a-ad03-8688c1e2a987" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F91BCAA8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca48d8-301e-0042-0949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:50 GMT", + "x-ms-client-request-id" : "4ced6202-2a09-496a-ad03-8688c1e2a987" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataacb1a2778812610c6/javablobsetmetadataac1blobapitestsetmetadataacb1a5048018b9", + "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" : "be94e070-78b6-48b0-b19a-73a6c9b381c1", + "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 20:04:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:50 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F9289951\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca48f1-301e-0042-1f49-67cbbf000000", + "x-ms-client-request-id" : "be94e070-78b6-48b0-b19a-73a6c9b381c1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataacb1a2778812610c6/javablobsetmetadataac1blobapitestsetmetadataacb1a5048018b9?comp=metadata", + "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" : "bf6ad042-2f0e-4443-97a2-885a92adf20a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F935BB08\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca4906-301e-0042-3249-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:50 GMT", + "x-ms-client-request-id" : "bf6ad042-2f0e-4443-97a2-885a92adf20a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadataac&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" : "f5dc45cc-6223-4528-bb55-37f0d7c12d9b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca4925-301e-0042-4c49-67cbbf000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0blobapitestsetmetadataacb1a2778812610c6Mon, 09 Sep 2019 20:04:50 GMT\"0x8D73560F91BCAA8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:51 GMT", + "x-ms-client-request-id" : "f5dc45cc-6223-4528-bb55-37f0d7c12d9b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataacb1a2778812610c6?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" : "18e79bda-a6d0-4987-8324-5158ab35ad40" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca493f-301e-0042-6449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:51 GMT", + "x-ms-client-request-id" : "18e79bda-a6d0-4987-8324-5158ab35ad40" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0blobapitestsetmetadataacb1a2778812610c6", "javablobsetmetadataac1blobapitestsetmetadataacb1a5048018b9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[5].json new file mode 100644 index 000000000000..206dfebefbd7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataac[5].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac37515514ca4ce6f?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" : "863332d6-49b5-404d-a578-5a8cc4c5c6b8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F95B5039\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca4959-301e-0042-7c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:51 GMT", + "x-ms-client-request-id" : "863332d6-49b5-404d-a578-5a8cc4c5c6b8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac37515514ca4ce6f/javablobsetmetadataac1blobapitestsetmetadataac37589501f4e3", + "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" : "9375f170-4951-403a-87a6-7f938a7dfed1", + "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 20:04:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:51 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F967D0A7\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca4974-301e-0042-1549-67cbbf000000", + "x-ms-client-request-id" : "9375f170-4951-403a-87a6-7f938a7dfed1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac37515514ca4ce6f/javablobsetmetadataac1blobapitestsetmetadataac37589501f4e3?comp=lease", + "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" : "c946f38a-cb26-4956-9dc9-b28b64341b73" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F967D0A7\"", + "x-ms-lease-id" : "7fdb6cff-d0e8-4a3e-a27a-2518cd24d34f", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca498b-301e-0042-2c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:51 GMT", + "x-ms-client-request-id" : "c946f38a-cb26-4956-9dc9-b28b64341b73" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac37515514ca4ce6f/javablobsetmetadataac1blobapitestsetmetadataac37589501f4e3?comp=metadata", + "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" : "0e3b481d-8e0e-44ea-b72a-367a0c1041d3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F980DB76\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca49a2-301e-0042-4349-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:51 GMT", + "x-ms-client-request-id" : "0e3b481d-8e0e-44ea-b72a-367a0c1041d3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadataac&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" : "9a3b2ff6-60da-4c77-88dc-ce5db4787b0e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca49c7-301e-0042-6249-67cbbf000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0blobapitestsetmetadataac37515514ca4ce6fMon, 09 Sep 2019 20:04:51 GMT\"0x8D73560F95B5039\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:51 GMT", + "x-ms-client-request-id" : "9a3b2ff6-60da-4c77-88dc-ce5db4787b0e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0blobapitestsetmetadataac37515514ca4ce6f?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" : "e31c30e0-5721-4aa0-bfaf-339a9780136f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca49ea-301e-0042-0449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:51 GMT", + "x-ms-client-request-id" : "e31c30e0-5721-4aa0-bfaf-339a9780136f" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0blobapitestsetmetadataac37515514ca4ce6f", "javablobsetmetadataac1blobapitestsetmetadataac37589501f4e3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[0].json new file mode 100644 index 000000000000..07acdc33e70d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[0].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail37d2259890b?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" : "5517d9bf-a444-4c96-aff0-0f67dee45c4c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F9A90936\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca4a1a-301e-0042-3249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:51 GMT", + "x-ms-client-request-id" : "5517d9bf-a444-4c96-aff0-0f67dee45c4c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail37d2259890b/javablobsetmetadataacfail1blobapitestsetmetadataacfail37d82706", + "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" : "6d115e79-47c6-481c-a3a1-47e0e2a1d882", + "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 20:04:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:51 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F9B625F8\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca4a2f-301e-0042-4649-67cbbf000000", + "x-ms-client-request-id" : "6d115e79-47c6-481c-a3a1-47e0e2a1d882" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail37d2259890b/javablobsetmetadataacfail1blobapitestsetmetadataacfail37d82706?comp=metadata", + "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" : "51c19fd0-b965-4884-9414-224677dd9855" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca4a58-301e-0042-6d49-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca4a58-301e-0042-6d49-67cbbf000000\nTime:2019-09-09T20:04:51.9643005Z", + "Date" : "Mon, 09 Sep 2019 20:04:51 GMT", + "x-ms-client-request-id" : "51c19fd0-b965-4884-9414-224677dd9855", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadataacfail&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" : "a273465e-e371-49e4-956d-633e65adadc5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca4a6c-301e-0042-7f49-67cbbf000000", + "Body" : "jtcsetmetadataacfailjtcsetmetadataacfail0blobapitestsetmetadataacfail37d2259890bMon, 09 Sep 2019 20:04:51 GMT\"0x8D73560F9A90936\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:51 GMT", + "x-ms-client-request-id" : "a273465e-e371-49e4-956d-633e65adadc5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail37d2259890b?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" : "4e2cf631-ccf1-4c40-9c1a-32e5b07c2355" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca4a88-301e-0042-1a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:52 GMT", + "x-ms-client-request-id" : "4e2cf631-ccf1-4c40-9c1a-32e5b07c2355" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacfail0blobapitestsetmetadataacfail37d2259890b", "javablobsetmetadataacfail1blobapitestsetmetadataacfail37d82706" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[1].json new file mode 100644 index 000000000000..daa2f7cb293d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[1].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfaila3b23321869?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" : "87a0b1d1-07a0-464b-a7a7-6f8c5b378595" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F9E8409D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca4a9d-301e-0042-2c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:52 GMT", + "x-ms-client-request-id" : "87a0b1d1-07a0-464b-a7a7-6f8c5b378595" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfaila3b23321869/javablobsetmetadataacfail1blobapitestsetmetadataacfaila3b66848", + "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" : "b4bf8ac7-2a64-404a-b55b-93b2a3d672c9", + "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 20:04:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:52 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F9F58474\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca4aac-301e-0042-3a49-67cbbf000000", + "x-ms-client-request-id" : "b4bf8ac7-2a64-404a-b55b-93b2a3d672c9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfaila3b23321869/javablobsetmetadataacfail1blobapitestsetmetadataacfaila3b66848?comp=metadata", + "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" : "ced6cd11-77d7-419a-adce-405d805705bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca4ac0-301e-0042-4d49-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca4ac0-301e-0042-4d49-67cbbf000000\nTime:2019-09-09T20:04:52.3805970Z", + "Date" : "Mon, 09 Sep 2019 20:04:52 GMT", + "x-ms-client-request-id" : "ced6cd11-77d7-419a-adce-405d805705bf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadataacfail&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" : "8b913b23-cbff-4197-9840-07bfde1fd421" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca4ad5-301e-0042-6149-67cbbf000000", + "Body" : "jtcsetmetadataacfailjtcsetmetadataacfail0blobapitestsetmetadataacfaila3b23321869Mon, 09 Sep 2019 20:04:52 GMT\"0x8D73560F9E8409D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:52 GMT", + "x-ms-client-request-id" : "8b913b23-cbff-4197-9840-07bfde1fd421", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfaila3b23321869?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" : "c184530a-3858-4751-882f-3a4a005993fa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca4aef-301e-0042-7b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:52 GMT", + "x-ms-client-request-id" : "c184530a-3858-4751-882f-3a4a005993fa" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacfail0blobapitestsetmetadataacfaila3b23321869", "javablobsetmetadataacfail1blobapitestsetmetadataacfaila3b66848" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[2].json new file mode 100644 index 000000000000..bdf9afcee8db --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[2].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail527555247e1?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" : "e63ca868-2a66-4566-b286-da3efb1244b7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FA2AD3FF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca4b00-301e-0042-0b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:52 GMT", + "x-ms-client-request-id" : "e63ca868-2a66-4566-b286-da3efb1244b7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail527555247e1/javablobsetmetadataacfail1blobapitestsetmetadataacfail52791504", + "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" : "e659fdc1-1e78-42be-9a2e-57797d9ae60f", + "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 20:04:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:52 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560FA3817D3\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca4b13-301e-0042-1c49-67cbbf000000", + "x-ms-client-request-id" : "e659fdc1-1e78-42be-9a2e-57797d9ae60f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail527555247e1/javablobsetmetadataacfail1blobapitestsetmetadataacfail52791504?comp=metadata", + "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" : "09774193-0b74-4b1f-980a-095ad87f5365" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca4b3b-301e-0042-4049-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca4b3b-301e-0042-4049-67cbbf000000\nTime:2019-09-09T20:04:52.8139041Z", + "Date" : "Mon, 09 Sep 2019 20:04:52 GMT", + "x-ms-client-request-id" : "09774193-0b74-4b1f-980a-095ad87f5365", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadataacfail&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" : "d8f5c384-090f-44af-b7c8-44899ae266ce" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca4b50-301e-0042-5449-67cbbf000000", + "Body" : "jtcsetmetadataacfailjtcsetmetadataacfail0blobapitestsetmetadataacfail527555247e1Mon, 09 Sep 2019 20:04:52 GMT\"0x8D73560FA2AD3FF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:52 GMT", + "x-ms-client-request-id" : "d8f5c384-090f-44af-b7c8-44899ae266ce", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail527555247e1?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" : "6a40f6f9-9368-477c-a0f8-ff6cf8fa308e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca4b5e-301e-0042-6049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:52 GMT", + "x-ms-client-request-id" : "6a40f6f9-9368-477c-a0f8-ff6cf8fa308e" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacfail0blobapitestsetmetadataacfail527555247e1", "javablobsetmetadataacfail1blobapitestsetmetadataacfail52791504" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[3].json new file mode 100644 index 000000000000..68b0cdd7da0d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[3].json @@ -0,0 +1,144 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfailb95063656bf?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" : "28f7e603-9940-44ae-83e1-90f897293ae6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FA6A0B50\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca4b79-301e-0042-7849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:53 GMT", + "x-ms-client-request-id" : "28f7e603-9940-44ae-83e1-90f897293ae6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfailb95063656bf/javablobsetmetadataacfail1blobapitestsetmetadataacfailb9567101", + "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" : "c0c112e6-401f-47c2-a6bc-9e66a6a8a2af", + "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 20:04:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560FA76D9F7\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca4b97-301e-0042-1449-67cbbf000000", + "x-ms-client-request-id" : "c0c112e6-401f-47c2-a6bc-9e66a6a8a2af" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfailb95063656bf/javablobsetmetadataacfail1blobapitestsetmetadataacfailb9567101", + "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" : "588ee00f-f99a-48b4-a162-2bcf59a626c8" + }, + "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 20:04:53 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:53 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560FA76D9F7\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:53 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca4bbd-301e-0042-3949-67cbbf000000", + "x-ms-client-request-id" : "588ee00f-f99a-48b4-a162-2bcf59a626c8", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfailb95063656bf/javablobsetmetadataacfail1blobapitestsetmetadataacfailb9567101?comp=metadata", + "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" : "cc6569d3-0a5b-450c-8bfa-77ab7804e52a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca4bd7-301e-0042-5349-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca4bd7-301e-0042-5349-67cbbf000000\nTime:2019-09-09T20:04:53.3132569Z", + "Date" : "Mon, 09 Sep 2019 20:04:53 GMT", + "x-ms-client-request-id" : "cc6569d3-0a5b-450c-8bfa-77ab7804e52a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadataacfail&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" : "5cafce37-ca1f-4864-bea0-067df9ec2b13" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca4bea-301e-0042-6649-67cbbf000000", + "Body" : "jtcsetmetadataacfailjtcsetmetadataacfail0blobapitestsetmetadataacfailb95063656bfMon, 09 Sep 2019 20:04:53 GMT\"0x8D73560FA6A0B50\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:53 GMT", + "x-ms-client-request-id" : "5cafce37-ca1f-4864-bea0-067df9ec2b13", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfailb95063656bf?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" : "2ee00c97-a96b-4290-abd1-9ea620650b76" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca4bf7-301e-0042-7249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:53 GMT", + "x-ms-client-request-id" : "2ee00c97-a96b-4290-abd1-9ea620650b76" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacfail0blobapitestsetmetadataacfailb95063656bf", "javablobsetmetadataacfail1blobapitestsetmetadataacfailb9567101" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[4].json new file mode 100644 index 000000000000..b09121698c8c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataacfail[4].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail41183083f1d?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" : "6382d842-576b-46d9-b30f-3970eeaac202" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FAB94B10\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca4c23-301e-0042-1b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:53 GMT", + "x-ms-client-request-id" : "6382d842-576b-46d9-b30f-3970eeaac202" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail41183083f1d/javablobsetmetadataacfail1blobapitestsetmetadataacfail41172426", + "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" : "d2719ed3-ac51-4599-b300-d1adc02a6cc1", + "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 20:04:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:53 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560FAC619CE\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca4c36-301e-0042-2c49-67cbbf000000", + "x-ms-client-request-id" : "d2719ed3-ac51-4599-b300-d1adc02a6cc1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail41183083f1d/javablobsetmetadataacfail1blobapitestsetmetadataacfail41172426?comp=lease", + "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" : "7df3c981-c0cb-4b2b-b2c5-00e541bf1936" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FAC619CE\"", + "x-ms-lease-id" : "f49d7313-68bc-4875-9ec0-5f1604c122a1", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca4c47-301e-0042-3b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:53 GMT", + "x-ms-client-request-id" : "7df3c981-c0cb-4b2b-b2c5-00e541bf1936" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail41183083f1d/javablobsetmetadataacfail1blobapitestsetmetadataacfail41172426?comp=metadata", + "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" : "8429ab47-79c9-4ee9-a931-a8666074ecf5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca4c68-301e-0042-5849-67cbbf000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:c5ca4c68-301e-0042-5849-67cbbf000000\nTime:2019-09-09T20:04:53.8246193Z", + "Date" : "Mon, 09 Sep 2019 20:04:53 GMT", + "x-ms-client-request-id" : "8429ab47-79c9-4ee9-a931-a8666074ecf5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadataacfail&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" : "8488894c-ad6d-4c7e-8f9a-72e58a638533" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca4c7c-301e-0042-6b49-67cbbf000000", + "Body" : "jtcsetmetadataacfailjtcsetmetadataacfail0blobapitestsetmetadataacfail41183083f1dMon, 09 Sep 2019 20:04:53 GMT\"0x8D73560FAB94B10\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:53 GMT", + "x-ms-client-request-id" : "8488894c-ad6d-4c7e-8f9a-72e58a638533", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0blobapitestsetmetadataacfail41183083f1d?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" : "184f96cf-37df-4dd2-9081-ed3dc1d9c5d0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca4ca0-301e-0042-0e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:53 GMT", + "x-ms-client-request-id" : "184f96cf-37df-4dd2-9081-ed3dc1d9c5d0" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacfail0blobapitestsetmetadataacfail41183083f1d", "javablobsetmetadataacfail1blobapitestsetmetadataacfail41172426" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataallnull.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataallnull.json new file mode 100644 index 000000000000..0a67c5f8b33c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataallnull.json @@ -0,0 +1,144 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataallnull0blobapitestsetmetadataallnull91e2414236?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" : "d1c111c5-8eac-41fd-a365-a4646e193332" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F6D31DDE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca44a2-301e-0042-1b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:46 GMT", + "x-ms-client-request-id" : "d1c111c5-8eac-41fd-a365-a4646e193332" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataallnull0blobapitestsetmetadataallnull91e2414236/javablobsetmetadataallnull1673053b35b35c13a448f", + "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" : "c10536f1-ba65-4e88-aff0-8e38d9043a2a", + "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 20:04:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:47 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F6E17363\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca44bf-301e-0042-3549-67cbbf000000", + "x-ms-client-request-id" : "c10536f1-ba65-4e88-aff0-8e38d9043a2a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataallnull0blobapitestsetmetadataallnull91e2414236/javablobsetmetadataallnull1673053b35b35c13a448f?comp=metadata", + "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" : "89bb41c5-640b-4ddf-8771-022b7876ba86" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F6EDF8F8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca44d0-301e-0042-4549-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:47 GMT", + "x-ms-client-request-id" : "89bb41c5-640b-4ddf-8771-022b7876ba86" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataallnull0blobapitestsetmetadataallnull91e2414236/javablobsetmetadataallnull1673053b35b35c13a448f", + "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" : "5d119d23-649e-4229-aa2a-aae22392af3a" + }, + "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 20:04:47 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:47 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560F6EDF8F8\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:47 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca44e1-301e-0042-5649-67cbbf000000", + "x-ms-client-request-id" : "5d119d23-649e-4229-aa2a-aae22392af3a", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadataallnull&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" : "23c1bc29-3ec9-4d2d-b542-e1defa96e9d7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca44ef-301e-0042-6449-67cbbf000000", + "Body" : "jtcsetmetadataallnulljtcsetmetadataallnull0blobapitestsetmetadataallnull91e2414236Mon, 09 Sep 2019 20:04:47 GMT\"0x8D73560F6D31DDE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:47 GMT", + "x-ms-client-request-id" : "23c1bc29-3ec9-4d2d-b542-e1defa96e9d7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataallnull0blobapitestsetmetadataallnull91e2414236?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" : "25c90e75-7e34-459e-ad29-d19582e217c0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca4501-301e-0042-7649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:47 GMT", + "x-ms-client-request-id" : "25c90e75-7e34-459e-ad29-d19582e217c0" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataallnull0blobapitestsetmetadataallnull91e2414236", "javablobsetmetadataallnull1673053b35b35c13a448f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataerror.json new file mode 100644 index 000000000000..33ba2f224f91 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadataerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataerror0blobapitestsetmetadataerrord2478234b8a8?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" : "0db0f1d3-5797-4446-828e-ba4634605c27" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560FB055605\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca4cba-301e-0042-2749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:54 GMT", + "x-ms-client-request-id" : "0db0f1d3-5797-4446-828e-ba4634605c27" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataerror0blobapitestsetmetadataerrord2478234b8a8/javablobsetmetadataerror1blobapitestsetmetadataerrord2476024f", + "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" : "8825e759-dd15-4d49-acc0-bbc66526486a", + "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 20:04:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:54 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560FB129A13\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca4ccd-301e-0042-3849-67cbbf000000", + "x-ms-client-request-id" : "8825e759-dd15-4d49-acc0-bbc66526486a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataerror0blobapitestsetmetadataerrord2478234b8a8/javablobsetmetadataerror2blobapitestsetmetadataerrord24614026?comp=metadata", + "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" : "445cb693-09d9-4545-a62c-d5998aee4ee0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "BlobNotFound", + "retry-after" : "0", + "Content-Length" : "215", + "StatusCode" : "404", + "x-ms-request-id" : "c5ca4ce3-301e-0042-4e49-67cbbf000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:c5ca4ce3-301e-0042-4e49-67cbbf000000\nTime:2019-09-09T20:04:54.2469200Z", + "Date" : "Mon, 09 Sep 2019 20:04:54 GMT", + "x-ms-client-request-id" : "445cb693-09d9-4545-a62c-d5998aee4ee0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadataerror&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" : "dd695ebc-b723-44c4-a73e-39e96e3f8d30" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca4cf9-301e-0042-6449-67cbbf000000", + "Body" : "jtcsetmetadataerrorjtcsetmetadataerror0blobapitestsetmetadataerrord2478234b8a8Mon, 09 Sep 2019 20:04:54 GMT\"0x8D73560FB055605\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:54 GMT", + "x-ms-client-request-id" : "dd695ebc-b723-44c4-a73e-39e96e3f8d30", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataerror0blobapitestsetmetadataerrord2478234b8a8?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" : "df41c1db-33a6-43b4-ac92-f8ad583fcc64" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca4d13-301e-0042-7e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:54 GMT", + "x-ms-client-request-id" : "df41c1db-33a6-43b4-ac92-f8ad583fcc64" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataerror0blobapitestsetmetadataerrord2478234b8a8", "javablobsetmetadataerror1blobapitestsetmetadataerrord2476024f", "javablobsetmetadataerror2blobapitestsetmetadataerrord24614026" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadatametadata[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadatametadata[0].json new file mode 100644 index 000000000000..a86067bcdbbf --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadatametadata[0].json @@ -0,0 +1,144 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadata8c484180a?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" : "062f86e2-4643-4b11-8b56-f4522c549ee6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F771EBB2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca458e-301e-0042-7b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:48 GMT", + "x-ms-client-request-id" : "062f86e2-4643-4b11-8b56-f4522c549ee6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadata8c484180a/javablobsetmetadatametadata15196779f4da0f564343e", + "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" : "29a91bbd-4ebf-4ea0-9335-4fa3800330d8", + "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 20:04:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:48 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F77FCC0A\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca45ac-301e-0042-1349-67cbbf000000", + "x-ms-client-request-id" : "29a91bbd-4ebf-4ea0-9335-4fa3800330d8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadata8c484180a/javablobsetmetadatametadata15196779f4da0f564343e?comp=metadata", + "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" : "8f74c0f2-e6c3-4df8-b751-ab9e59499c1c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F78C7887\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca45c5-301e-0042-2a49-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:48 GMT", + "x-ms-client-request-id" : "8f74c0f2-e6c3-4df8-b751-ab9e59499c1c" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadata8c484180a/javablobsetmetadatametadata15196779f4da0f564343e", + "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" : "787a9bfd-4ce8-486d-a3fd-f3e19c339925" + }, + "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 20:04:48 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:48 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560F78C7887\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:48 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca45e3-301e-0042-4849-67cbbf000000", + "x-ms-client-request-id" : "787a9bfd-4ce8-486d-a3fd-f3e19c339925", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadatametadata&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" : "b16d9f9f-1242-40c3-85e8-40f07e1742a2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca45f6-301e-0042-5b49-67cbbf000000", + "Body" : "jtcsetmetadatametadatajtcsetmetadatametadata0blobapitestsetmetadatametadata8c484180aMon, 09 Sep 2019 20:04:48 GMT\"0x8D73560F771EBB2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:48 GMT", + "x-ms-client-request-id" : "b16d9f9f-1242-40c3-85e8-40f07e1742a2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadata8c484180a?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" : "0e9a7a21-f0df-4ab6-bf66-5d426bff0890" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca4607-301e-0042-6c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:48 GMT", + "x-ms-client-request-id" : "0e9a7a21-f0df-4ab6-bf66-5d426bff0890" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadatametadata0blobapitestsetmetadatametadata8c484180a", "javablobsetmetadatametadata15196779f4da0f564343e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadatametadata[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadatametadata[1].json new file mode 100644 index 000000000000..4ef21fde0564 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadatametadata[1].json @@ -0,0 +1,146 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadatacb3739604?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" : "bd0dbce4-9f07-4371-aa3b-9ce12ef3a3c6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F7BEE13A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca4623-301e-0042-0749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:48 GMT", + "x-ms-client-request-id" : "bd0dbce4-9f07-4371-aa3b-9ce12ef3a3c6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadatacb3739604/javablobsetmetadatametadata1043478415386303fb461", + "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" : "54b12eeb-ed07-4db7-925c-a8a94bc377f7", + "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 20:04:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:48 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F7CBAFEA\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca4640-301e-0042-1f49-67cbbf000000", + "x-ms-client-request-id" : "54b12eeb-ed07-4db7-925c-a8a94bc377f7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadatacb3739604/javablobsetmetadatametadata1043478415386303fb461?comp=metadata", + "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" : "da4150a5-e43a-408b-b3eb-9544fb6dd720" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F7D83551\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca4655-301e-0042-3249-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:48 GMT", + "x-ms-client-request-id" : "da4150a5-e43a-408b-b3eb-9544fb6dd720" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadatacb3739604/javablobsetmetadatametadata1043478415386303fb461", + "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" : "063f7717-67ec-41df-b5a3-a4dc4fd8e7ca" + }, + "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 20:04:48 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:48 GMT", + "x-ms-meta-foo" : "bar", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560F7D83551\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:48 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca4669-301e-0042-4449-67cbbf000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "063f7717-67ec-41df-b5a3-a4dc4fd8e7ca", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadatametadata&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" : "03a42dda-fb96-40ea-8f45-668a05ffee76" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca4688-301e-0042-6349-67cbbf000000", + "Body" : "jtcsetmetadatametadatajtcsetmetadatametadata0blobapitestsetmetadatametadatacb3739604Mon, 09 Sep 2019 20:04:48 GMT\"0x8D73560F7BEE13A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:48 GMT", + "x-ms-client-request-id" : "03a42dda-fb96-40ea-8f45-668a05ffee76", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatametadata0blobapitestsetmetadatametadatacb3739604?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" : "4dc61b6b-1e9b-4181-9627-fdc411a40fd4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca46a1-301e-0042-7b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:48 GMT", + "x-ms-client-request-id" : "4dc61b6b-1e9b-4181-9627-fdc411a40fd4" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadatametadata0blobapitestsetmetadatametadatacb3739604", "javablobsetmetadatametadata1043478415386303fb461" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadatamin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadatamin.json new file mode 100644 index 000000000000..5e5ad8607083 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsetmetadatamin.json @@ -0,0 +1,145 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatamin0blobapitestsetmetadatamin45703149f6ca68?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" : "203863bc-de9d-448f-9bce-2a32673f2eaa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F723482D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca451b-301e-0042-0e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:47 GMT", + "x-ms-client-request-id" : "203863bc-de9d-448f-9bce-2a32673f2eaa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatamin0blobapitestsetmetadatamin45703149f6ca68/javablobsetmetadatamin1blobapitestsetmetadatamin457043871ce", + "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" : "b70732ee-3310-47ee-a47c-ac2cf1f39e7d", + "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 20:04:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:47 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560F73016EC\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca452a-301e-0042-1c49-67cbbf000000", + "x-ms-client-request-id" : "b70732ee-3310-47ee-a47c-ac2cf1f39e7d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatamin0blobapitestsetmetadatamin45703149f6ca68/javablobsetmetadatamin1blobapitestsetmetadatamin457043871ce?comp=metadata", + "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" : "51c02b00-16ea-4249-a595-d31f3b9c129f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560F73D86D9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca4541-301e-0042-3149-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:47 GMT", + "x-ms-client-request-id" : "51c02b00-16ea-4249-a595-d31f3b9c129f" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatamin0blobapitestsetmetadatamin45703149f6ca68/javablobsetmetadatamin1blobapitestsetmetadatamin457043871ce", + "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" : "0766cc41-3e86-4a2c-b9c6-a3c7dd4913f9" + }, + "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 20:04:47 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:47 GMT", + "x-ms-meta-foo" : "bar", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560F73D86D9\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:47 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca4553-301e-0042-4349-67cbbf000000", + "x-ms-client-request-id" : "0766cc41-3e86-4a2c-b9c6-a3c7dd4913f9", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadatamin&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" : "2ef53785-d1a2-42bf-bcb5-4952fb188c59" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca4563-301e-0042-5249-67cbbf000000", + "Body" : "jtcsetmetadataminjtcsetmetadatamin0blobapitestsetmetadatamin45703149f6ca68Mon, 09 Sep 2019 20:04:47 GMT\"0x8D73560F723482D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:47 GMT", + "x-ms-client-request-id" : "2ef53785-d1a2-42bf-bcb5-4952fb188c59", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatamin0blobapitestsetmetadatamin45703149f6ca68?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" : "f31f6eba-7936-4cbc-afab-4cd84f67c9e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca4576-301e-0042-6549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:47 GMT", + "x-ms-client-request-id" : "f31f6eba-7936-4cbc-afab-4cd84f67c9e8" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadatamin0blobapitestsetmetadatamin45703149f6ca68", "javablobsetmetadatamin1blobapitestsetmetadatamin457043871ce" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierarchivestatus[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierarchivestatus[0].json new file mode 100644 index 000000000000..e9376db9879c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierarchivestatus[0].json @@ -0,0 +1,228 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierarchivestatus0309101b1bdda7ae7b4ce8a?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" : "4e2b2263-1885-4966-92d9-2dd495802134" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613C2DF7D8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cabca3-301e-0042-704a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:43 GMT", + "x-ms-client-request-id" : "4e2b2263-1885-4966-92d9-2dd495802134" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierarchivestatus0309101b1bdda7ae7b4ce8a/javablobsettierarchivestatus126922e2177431aaf948", + "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" : "c7f8cada-ccab-41a2-b656-41f42051b15e", + "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 20:06:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:43 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613C3BC728\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cabcb3-301e-0042-7f4a-67cbbf000000", + "x-ms-client-request-id" : "c7f8cada-ccab-41a2-b656-41f42051b15e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatus2715631c2f8b8782e447?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" : "51b3bd3b-92e5-4013-96de-643c008202c4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613C44588F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "67f27f47-d01e-00b8-614a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:43 GMT", + "x-ms-client-request-id" : "51b3bd3b-92e5-4013-96de-643c008202c4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatus2715631c2f8b8782e447/javablobsettierarchivestatus355624b20cf76a7f7749", + "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" : "fbbd52a2-08ae-4f22-90bd-082632e4fbaa", + "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 20:06:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:43 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613C4A2762\"", + "Content-Length" : "0", + "x-ms-request-id" : "67f27f68-d01e-00b8-7e4a-67634c000000", + "x-ms-client-request-id" : "fbbd52a2-08ae-4f22-90bd-082632e4fbaa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatus2715631c2f8b8782e447/javablobsettierarchivestatus355624b20cf76a7f7749?comp=tier", + "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" : "fdf1422d-3331-48e3-856d-f13579b01e56" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "67f27f7f-d01e-00b8-114a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:43 GMT", + "x-ms-client-request-id" : "fdf1422d-3331-48e3-856d-f13579b01e56" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatus2715631c2f8b8782e447/javablobsettierarchivestatus355624b20cf76a7f7749?comp=tier", + "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" : "f24c18f1-86e9-43c0-a2a0-9571972c4919" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "67f27f8f-d01e-00b8-214a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:43 GMT", + "x-ms-client-request-id" : "f24c18f1-86e9-43c0-a2a0-9571972c4919" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatus2715631c2f8b8782e447/javablobsettierarchivestatus355624b20cf76a7f7749", + "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" : "a4a32023-f3f1-4dff-8b70-5810a0ea4a3e" + }, + "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 20:06:43 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Mon, 09 Sep 2019 20:06:43 GMT", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:06:43 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "Archive", + "ETag" : "\"0x8D735613C4A2762\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:43 GMT", + "Content-Length" : "7", + "x-ms-archive-status" : "rehydrate-pending-to-cool", + "x-ms-request-id" : "67f27fa8-d01e-00b8-364a-67634c000000", + "x-ms-client-request-id" : "a4a32023-f3f1-4dff-8b70-5810a0ea4a3e", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatus2715631c2f8b8782e447?include=&restype=container&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" : "df11bc66-b3ab-4bbb-83e8-5550fa54b33b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "67f27fc1-d01e-00b8-4f4a-67634c000000", + "Body" : "javablobsettierarchivestatus355624b20cf76a7f7749Mon, 09 Sep 2019 20:06:43 GMTMon, 09 Sep 2019 20:06:43 GMT0x8D735613C4A27627application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobArchiverehydrate-pending-to-coolMon, 09 Sep 2019 20:06:43 GMTunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:06:43 GMT", + "x-ms-client-request-id" : "df11bc66-b3ab-4bbb-83e8-5550fa54b33b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsettierarchivestatus&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" : "32448dbb-63ce-4a94-b2c0-d40168cf38c3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cabcde-301e-0042-274a-67cbbf000000", + "Body" : "jtcsettierarchivestatusjtcsettierarchivestatus0309101b1bdda7ae7b4ce8aMon, 09 Sep 2019 20:06:43 GMT\"0x8D735613C2DF7D8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:43 GMT", + "x-ms-client-request-id" : "32448dbb-63ce-4a94-b2c0-d40168cf38c3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierarchivestatus0309101b1bdda7ae7b4ce8a?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" : "88c1c4ba-004a-405a-9251-877eb45f1074" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cabcf1-301e-0042-394a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:43 GMT", + "x-ms-client-request-id" : "88c1c4ba-004a-405a-9251-877eb45f1074" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierarchivestatus0309101b1bdda7ae7b4ce8a", "javablobsettierarchivestatus126922e2177431aaf948", "javablobsettierarchivestatus2715631c2f8b8782e447", "javablobsettierarchivestatus355624b20cf76a7f7749" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierarchivestatus[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierarchivestatus[1].json new file mode 100644 index 000000000000..00c3d7139433 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierarchivestatus[1].json @@ -0,0 +1,228 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierarchivestatus02047059b2f9c149e84a4aa?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" : "8fabdcfc-d6c7-43d3-bd0a-519f35d372b4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613C7CE96F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cabcff-301e-0042-474a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:43 GMT", + "x-ms-client-request-id" : "8fabdcfc-d6c7-43d3-bd0a-519f35d372b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierarchivestatus02047059b2f9c149e84a4aa/javablobsettierarchivestatus137835348ed74efbcd44", + "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" : "245bf038-393b-48ad-b87d-78fd1ee0df73", + "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 20:06:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:43 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613C8A439C\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cabd17-301e-0042-5d4a-67cbbf000000", + "x-ms-client-request-id" : "245bf038-393b-48ad-b87d-78fd1ee0df73" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatus2709870a7ed720a6ea4b?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" : "4b869fb7-9d3a-4d76-9cf1-756f451ef5b2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613C9482D9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "67f2808d-d01e-00b8-014a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:43 GMT", + "x-ms-client-request-id" : "4b869fb7-9d3a-4d76-9cf1-756f451ef5b2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatus2709870a7ed720a6ea4b/javablobsettierarchivestatus376230aacf2a770bc64b", + "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" : "bfb86234-94b8-4a0d-bac4-f281f61b843c", + "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 20:06:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:43 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613C9B8A46\"", + "Content-Length" : "0", + "x-ms-request-id" : "67f280c5-d01e-00b8-314a-67634c000000", + "x-ms-client-request-id" : "bfb86234-94b8-4a0d-bac4-f281f61b843c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatus2709870a7ed720a6ea4b/javablobsettierarchivestatus376230aacf2a770bc64b?comp=tier", + "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" : "9e1a5d4c-9b24-4153-ba37-a3f192835728" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "67f280df-d01e-00b8-484a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:43 GMT", + "x-ms-client-request-id" : "9e1a5d4c-9b24-4153-ba37-a3f192835728" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatus2709870a7ed720a6ea4b/javablobsettierarchivestatus376230aacf2a770bc64b?comp=tier", + "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" : "ea174552-34b4-40ed-af55-87b0fda3909b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "67f280f6-d01e-00b8-5f4a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:43 GMT", + "x-ms-client-request-id" : "ea174552-34b4-40ed-af55-87b0fda3909b" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatus2709870a7ed720a6ea4b/javablobsettierarchivestatus376230aacf2a770bc64b", + "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" : "109d11c1-94d0-4632-85a4-19d72c84cb2b" + }, + "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 20:06:44 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Mon, 09 Sep 2019 20:06:44 GMT", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:06:43 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "Archive", + "ETag" : "\"0x8D735613C9B8A46\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:44 GMT", + "Content-Length" : "7", + "x-ms-archive-status" : "rehydrate-pending-to-hot", + "x-ms-request-id" : "67f2810b-d01e-00b8-714a-67634c000000", + "x-ms-client-request-id" : "109d11c1-94d0-4632-85a4-19d72c84cb2b", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatus2709870a7ed720a6ea4b?include=&restype=container&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" : "582580f5-f636-44c8-bf70-4444c7498f77" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "67f28117-d01e-00b8-7c4a-67634c000000", + "Body" : "javablobsettierarchivestatus376230aacf2a770bc64bMon, 09 Sep 2019 20:06:44 GMTMon, 09 Sep 2019 20:06:44 GMT0x8D735613C9B8A467application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobArchiverehydrate-pending-to-hotMon, 09 Sep 2019 20:06:44 GMTunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:06:44 GMT", + "x-ms-client-request-id" : "582580f5-f636-44c8-bf70-4444c7498f77", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsettierarchivestatus&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" : "3f589c9e-187c-43aa-99cb-2276d4d6e5f0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cabd76-301e-0042-324a-67cbbf000000", + "Body" : "jtcsettierarchivestatusjtcsettierarchivestatus02047059b2f9c149e84a4aaMon, 09 Sep 2019 20:06:43 GMT\"0x8D735613C7CE96F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:44 GMT", + "x-ms-client-request-id" : "3f589c9e-187c-43aa-99cb-2276d4d6e5f0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierarchivestatus02047059b2f9c149e84a4aa?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" : "c4e3bccd-f6f9-4a13-8fd6-72fccc1978d0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cabd8c-301e-0042-424a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:44 GMT", + "x-ms-client-request-id" : "c4e3bccd-f6f9-4a13-8fd6-72fccc1978d0" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierarchivestatus02047059b2f9c149e84a4aa", "javablobsettierarchivestatus137835348ed74efbcd44", "javablobsettierarchivestatus2709870a7ed720a6ea4b", "javablobsettierarchivestatus376230aacf2a770bc64b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierarchivestatus[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierarchivestatus[2].json new file mode 100644 index 000000000000..fb326c2f8d0a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierarchivestatus[2].json @@ -0,0 +1,228 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierarchivestatus0302184357673eff6848799?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" : "24f788e5-00fb-486a-a8b1-4fcbf80c49f7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613CD4680C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cabda4-301e-0042-5a4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:44 GMT", + "x-ms-client-request-id" : "24f788e5-00fb-486a-a8b1-4fcbf80c49f7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierarchivestatus0302184357673eff6848799/javablobsettierarchivestatus199671d15d0c76c8e74e", + "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" : "0d4bd12c-67e7-4777-b959-159a9e4557e2", + "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 20:06:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:44 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613CE0D7C4\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cabdbd-301e-0042-724a-67cbbf000000", + "x-ms-client-request-id" : "0d4bd12c-67e7-4777-b959-159a9e4557e2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatus279430bc52899477554d?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" : "7c300b33-d351-4660-a15f-2acabbded79e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613CE941D8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "67f2823e-d01e-00b8-7d4a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:44 GMT", + "x-ms-client-request-id" : "7c300b33-d351-4660-a15f-2acabbded79e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatus279430bc52899477554d/javablobsettierarchivestatus3906150ce00cd01feb40", + "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" : "e752486e-faec-46f0-ac28-2a080312960c", + "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 20:06:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:44 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613CEEE954\"", + "Content-Length" : "0", + "x-ms-request-id" : "67f2825f-d01e-00b8-194a-67634c000000", + "x-ms-client-request-id" : "e752486e-faec-46f0-ac28-2a080312960c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatus279430bc52899477554d/javablobsettierarchivestatus3906150ce00cd01feb40?comp=tier", + "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" : "d92bc197-d354-49dc-91e2-0bbb49783f21" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "67f28272-d01e-00b8-2a4a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:44 GMT", + "x-ms-client-request-id" : "d92bc197-d354-49dc-91e2-0bbb49783f21" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatus279430bc52899477554d/javablobsettierarchivestatus3906150ce00cd01feb40?comp=tier", + "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" : "ce0812a5-772e-47ce-a66f-734cfdf8ddf8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "67f28283-d01e-00b8-394a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:44 GMT", + "x-ms-client-request-id" : "ce0812a5-772e-47ce-a66f-734cfdf8ddf8" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatus279430bc52899477554d/javablobsettierarchivestatus3906150ce00cd01feb40", + "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" : "a74f0471-aaa8-4487-ac9a-9698edd0e4c4" + }, + "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 20:06:44 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Mon, 09 Sep 2019 20:06:44 GMT", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:06:44 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "Archive", + "ETag" : "\"0x8D735613CEEE954\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:44 GMT", + "Content-Length" : "7", + "x-ms-archive-status" : "rehydrate-pending-to-hot", + "x-ms-request-id" : "67f2829d-d01e-00b8-4f4a-67634c000000", + "x-ms-client-request-id" : "a74f0471-aaa8-4487-ac9a-9698edd0e4c4", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatus279430bc52899477554d?include=&restype=container&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" : "82c3b3fd-c417-46fd-805c-be7f5ce7f577" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "67f282b4-d01e-00b8-654a-67634c000000", + "Body" : "javablobsettierarchivestatus3906150ce00cd01feb40Mon, 09 Sep 2019 20:06:44 GMTMon, 09 Sep 2019 20:06:44 GMT0x8D735613CEEE9547application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobArchiverehydrate-pending-to-hotMon, 09 Sep 2019 20:06:44 GMTunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:06:44 GMT", + "x-ms-client-request-id" : "82c3b3fd-c417-46fd-805c-be7f5ce7f577", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsettierarchivestatus&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" : "74a72504-9a1a-460b-a203-46e9e462b294" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cabdf6-301e-0042-274a-67cbbf000000", + "Body" : "jtcsettierarchivestatusjtcsettierarchivestatus0302184357673eff6848799Mon, 09 Sep 2019 20:06:44 GMT\"0x8D735613CD4680C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:44 GMT", + "x-ms-client-request-id" : "74a72504-9a1a-460b-a203-46e9e462b294", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierarchivestatus0302184357673eff6848799?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" : "6cea03a0-2d2a-4534-acf7-e1be97f4f31b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cabe16-301e-0042-454a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:44 GMT", + "x-ms-client-request-id" : "6cea03a0-2d2a-4534-acf7-e1be97f4f31b" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierarchivestatus0302184357673eff6848799", "javablobsettierarchivestatus199671d15d0c76c8e74e", "javablobsettierarchivestatus279430bc52899477554d", "javablobsettierarchivestatus3906150ce00cd01feb40" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierarchivestatuswithrehydratepriority[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierarchivestatuswithrehydratepriority[0].json new file mode 100644 index 000000000000..6e615c3ddc20 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierarchivestatuswithrehydratepriority[0].json @@ -0,0 +1,228 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierarchivestatuswithrehydratepriority015653d48c0c?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" : "1e658d07-a5a7-4551-8213-64e26c46f550" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355EC0FEBEFA\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:48:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "09045997-a01e-004c-1947-6727b4000000", + "Date" : "Mon, 09 Sep 2019 19:48:57 GMT", + "x-ms-client-request-id" : "1e658d07-a5a7-4551-8213-64e26c46f550" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierarchivestatuswithrehydratepriority015653d48c0c/javablobsettierarchivestatuswithrehydratepriority166568ec4f", + "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" : "ecc7708c-ebb8-4b5e-a604-50da4d7a7af9", + "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:48:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:48:57 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7355EC1454DD4\"", + "Content-Length" : "0", + "x-ms-request-id" : "afe2d6ec-601e-003c-7e47-675470000000", + "x-ms-client-request-id" : "ecc7708c-ebb8-4b5e-a604-50da4d7a7af9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatuswithrehydratepriority29319210d0?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" : "9272f322-7a19-4aa1-a238-fc8dccce5c67" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355EC1666973\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:48:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "e1cecc5f-d01e-00de-5547-67d116000000", + "Date" : "Mon, 09 Sep 2019 19:48:57 GMT", + "x-ms-client-request-id" : "9272f322-7a19-4aa1-a238-fc8dccce5c67" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatuswithrehydratepriority29319210d0/javablobsettierarchivestatuswithrehydratepriority308498e55e", + "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" : "d04634d5-5a15-4109-bf13-473f5ac7ad7d", + "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:48:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:48:57 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7355EC17FC7BF\"", + "Content-Length" : "0", + "x-ms-request-id" : "1c861141-b01e-0064-6d47-67311f000000", + "x-ms-client-request-id" : "d04634d5-5a15-4109-bf13-473f5ac7ad7d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatuswithrehydratepriority29319210d0/javablobsettierarchivestatuswithrehydratepriority308498e55e?comp=tier", + "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" : "0f1c9e0d-5c49-4374-8681-c89556e0a932" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "176bdb1d-601e-00ee-6347-678b3c000000", + "Date" : "Mon, 09 Sep 2019 19:48:58 GMT", + "x-ms-client-request-id" : "0f1c9e0d-5c49-4374-8681-c89556e0a932" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatuswithrehydratepriority29319210d0/javablobsettierarchivestatuswithrehydratepriority308498e55e?comp=tier", + "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" : "9b86a08a-10de-4eed-a3eb-ee12f17ec4ad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "19d20a98-901e-00fb-1647-6749a5000000", + "Date" : "Mon, 09 Sep 2019 19:48:57 GMT", + "x-ms-client-request-id" : "9b86a08a-10de-4eed-a3eb-ee12f17ec4ad" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatuswithrehydratepriority29319210d0/javablobsettierarchivestatuswithrehydratepriority308498e55e", + "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" : "4301e7a8-867c-4a89-a147-5e18322414cb" + }, + "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:48:58 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Mon, 09 Sep 2019 19:48:58 GMT", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:48:58 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "Archive", + "ETag" : "\"0x8D7355EC17FC7BF\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 19:48:58 GMT", + "Content-Length" : "7", + "x-ms-archive-status" : "rehydrate-pending-to-cool", + "x-ms-request-id" : "d7c84c6a-a01e-00b7-1847-678eba000000", + "x-ms-client-request-id" : "4301e7a8-867c-4a89-a147-5e18322414cb", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatuswithrehydratepriority29319210d0?include=&restype=container&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" : "d77a8876-cb2d-4e0c-9088-8cbf7c67131f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "3ebb72a6-901e-0051-5e47-679f4a000000", + "Body" : "javablobsettierarchivestatuswithrehydratepriority308498e55eMon, 09 Sep 2019 19:48:58 GMTMon, 09 Sep 2019 19:48:58 GMT0x8D7355EC17FC7BF7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobArchiverehydrate-pending-to-coolMon, 09 Sep 2019 19:48:58 GMTunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 19:48:58 GMT", + "x-ms-client-request-id" : "d77a8876-cb2d-4e0c-9088-8cbf7c67131f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsettierarchivestatuswithrehydratepriority&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" : "3891cc3e-f4e0-407d-a1f7-9ce54b052820" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9d63a1aa-401e-0020-0247-678c67000000", + "Body" : "jtcsettierarchivestatuswithrehydratepriorityjtcsettierarchivestatuswithrehydratepriority015653d48c0cMon, 09 Sep 2019 19:48:57 GMT\"0x8D7355EC0FEBEFA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:48:59 GMT", + "x-ms-client-request-id" : "3891cc3e-f4e0-407d-a1f7-9ce54b052820", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierarchivestatuswithrehydratepriority015653d48c0c?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" : "ddb49273-7448-4c0d-b491-f6617bcdca9b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8803cb02-401e-004d-6447-672649000000", + "Date" : "Mon, 09 Sep 2019 19:48:59 GMT", + "x-ms-client-request-id" : "ddb49273-7448-4c0d-b491-f6617bcdca9b" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierarchivestatuswithrehydratepriority015653d48c0c", "javablobsettierarchivestatuswithrehydratepriority166568ec4f", "javablobsettierarchivestatuswithrehydratepriority29319210d0", "javablobsettierarchivestatuswithrehydratepriority308498e55e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierarchivestatuswithrehydratepriority[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierarchivestatuswithrehydratepriority[1].json new file mode 100644 index 000000000000..1f09651b4843 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierarchivestatuswithrehydratepriority[1].json @@ -0,0 +1,228 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierarchivestatuswithrehydratepriority077101db15ab?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" : "5503e4ee-c5b5-4b55-84c1-31e734677f34" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355EC26EBA12\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:49:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "36ef455a-901e-0066-1947-6752f1000000", + "Date" : "Mon, 09 Sep 2019 19:48:59 GMT", + "x-ms-client-request-id" : "5503e4ee-c5b5-4b55-84c1-31e734677f34" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierarchivestatuswithrehydratepriority077101db15ab/javablobsettierarchivestatuswithrehydratepriority1445859d05", + "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" : "5aaaa449-c432-40fc-b623-a83051efa82e", + "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:49:00 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:49:00 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7355EC2A2AC6C\"", + "Content-Length" : "0", + "x-ms-request-id" : "7fa9c5d2-601e-005a-0a47-67e62a000000", + "x-ms-client-request-id" : "5aaaa449-c432-40fc-b623-a83051efa82e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatuswithrehydratepriority278353c24c?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" : "a9c4a98c-9f81-4d23-b551-59fcc4e99850" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355EC2B83DD5\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:49:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "3505ee8f-901e-0037-6a47-672d10000000", + "Date" : "Mon, 09 Sep 2019 19:49:00 GMT", + "x-ms-client-request-id" : "a9c4a98c-9f81-4d23-b551-59fcc4e99850" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatuswithrehydratepriority278353c24c/javablobsettierarchivestatuswithrehydratepriority3518711021", + "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" : "84df53e4-ca57-44c2-b984-c3e4a132c0a4", + "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:49:00 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:49:00 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7355EC2C92484\"", + "Content-Length" : "0", + "x-ms-request-id" : "c0887f64-801e-00ab-5547-6756ad000000", + "x-ms-client-request-id" : "84df53e4-ca57-44c2-b984-c3e4a132c0a4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatuswithrehydratepriority278353c24c/javablobsettierarchivestatuswithrehydratepriority3518711021?comp=tier", + "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" : "07b0a922-97d9-48a9-90db-6b6ea39e51ea" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e2023537-801e-0089-7a47-67389b000000", + "Date" : "Mon, 09 Sep 2019 19:49:00 GMT", + "x-ms-client-request-id" : "07b0a922-97d9-48a9-90db-6b6ea39e51ea" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatuswithrehydratepriority278353c24c/javablobsettierarchivestatuswithrehydratepriority3518711021?comp=tier", + "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" : "5ebc0a87-0dc0-4c14-bf8d-9cc719bb89d7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "4c46c5d2-101e-0069-3547-67de13000000", + "Date" : "Mon, 09 Sep 2019 19:49:00 GMT", + "x-ms-client-request-id" : "5ebc0a87-0dc0-4c14-bf8d-9cc719bb89d7" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatuswithrehydratepriority278353c24c/javablobsettierarchivestatuswithrehydratepriority3518711021", + "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" : "23e68f68-b701-4ffc-b687-76cbce540821" + }, + "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:49:00 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Mon, 09 Sep 2019 19:49:00 GMT", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:49:00 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "Archive", + "ETag" : "\"0x8D7355EC2C92484\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 19:49:00 GMT", + "Content-Length" : "7", + "x-ms-archive-status" : "rehydrate-pending-to-hot", + "x-ms-request-id" : "ba6f062e-201e-002e-4b47-670178000000", + "x-ms-client-request-id" : "23e68f68-b701-4ffc-b687-76cbce540821", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierarchivestatuswithrehydratepriority278353c24c?include=&restype=container&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" : "289281f7-0807-4e36-8dba-5018c84ad262" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "252894fe-a01e-001d-6847-675855000000", + "Body" : "javablobsettierarchivestatuswithrehydratepriority3518711021Mon, 09 Sep 2019 19:49:00 GMTMon, 09 Sep 2019 19:49:00 GMT0x8D7355EC2C924847application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobArchiverehydrate-pending-to-hotMon, 09 Sep 2019 19:49:00 GMTunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 19:49:01 GMT", + "x-ms-client-request-id" : "289281f7-0807-4e36-8dba-5018c84ad262", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsettierarchivestatuswithrehydratepriority&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" : "c24a79e4-832c-436d-bf9b-e209db0001dd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "e277e2b0-901e-0029-0747-6796e9000000", + "Body" : "jtcsettierarchivestatuswithrehydratepriorityjtcsettierarchivestatuswithrehydratepriority077101db15abMon, 09 Sep 2019 19:49:00 GMT\"0x8D7355EC26EBA12\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:49:01 GMT", + "x-ms-client-request-id" : "c24a79e4-832c-436d-bf9b-e209db0001dd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierarchivestatuswithrehydratepriority077101db15ab?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" : "fd6af37a-5d75-4aac-98c2-332a3360d9c5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077e4f71-801e-001f-3d47-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:49:01 GMT", + "x-ms-client-request-id" : "fd6af37a-5d75-4aac-98c2-332a3360d9c5" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierarchivestatuswithrehydratepriority077101db15ab", "javablobsettierarchivestatuswithrehydratepriority1445859d05", "javablobsettierarchivestatuswithrehydratepriority278353c24c", "javablobsettierarchivestatuswithrehydratepriority3518711021" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierblockblob[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierblockblob[0].json new file mode 100644 index 000000000000..d28f0a12dd6a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierblockblob[0].json @@ -0,0 +1,227 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblobb2a30920fe27?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" : "0cb5d3c2-b3b7-4227-86f2-d7a675aef9f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356135E020A2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cab278-301e-0042-1a4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:32 GMT", + "x-ms-client-request-id" : "0cb5d3c2-b3b7-4227-86f2-d7a675aef9f2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblobb2a30920fe27/javablobsettierblockblob1blobapitestsettierblockblobb2a78315a", + "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" : "22196463-4968-4970-8669-72da248f882a", + "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 20:06:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:32 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356135ED5163\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cab296-301e-0042-374a-67cbbf000000", + "x-ms-client-request-id" : "22196463-4968-4970-8669-72da248f882a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobb2a65705c435?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" : "1021cd95-edc0-4583-b70c-fac4cbe3a01b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356135F6338E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "67f26288-d01e-00b8-6e4a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:32 GMT", + "x-ms-client-request-id" : "1021cd95-edc0-4583-b70c-fac4cbe3a01b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobb2a65705c435/javablobsettierblockblob3blobapitestsettierblockblobb2a383076", + "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" : "d3397350-c39d-471d-8d6d-4470b2045fc0", + "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 20:06:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:32 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356135FBB671\"", + "Content-Length" : "0", + "x-ms-request-id" : "67f2629d-d01e-00b8-7e4a-67634c000000", + "x-ms-client-request-id" : "d3397350-c39d-471d-8d6d-4470b2045fc0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobb2a65705c435/javablobsettierblockblob3blobapitestsettierblockblobb2a383076?comp=tier", + "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" : "f0357f74-995f-40d8-888f-e1b05976b869" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "67f262ba-d01e-00b8-134a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:32 GMT", + "x-ms-client-request-id" : "f0357f74-995f-40d8-888f-e1b05976b869" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobb2a65705c435/javablobsettierblockblob3blobapitestsettierblockblobb2a383076", + "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" : "ea6f11b9-891f-4d78-89a5-7cc2c79fcda5" + }, + "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 20:06:33 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Mon, 09 Sep 2019 20:06:33 GMT", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:06:32 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7356135FBB671\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:33 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "67f262df-d01e-00b8-354a-67634c000000", + "x-ms-client-request-id" : "ea6f11b9-891f-4d78-89a5-7cc2c79fcda5", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobb2a65705c435?include=&restype=container&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" : "62c878d0-a7c4-493a-b107-bba7f4611d11" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "67f26302-d01e-00b8-524a-67634c000000", + "Body" : "javablobsettierblockblob3blobapitestsettierblockblobb2a383076Mon, 09 Sep 2019 20:06:33 GMTMon, 09 Sep 2019 20:06:33 GMT0x8D7356135FBB6717application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHotMon, 09 Sep 2019 20:06:33 GMTunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:06:32 GMT", + "x-ms-client-request-id" : "62c878d0-a7c4-493a-b107-bba7f4611d11", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobb2a65705c435?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" : "b5650b36-f560-481d-a66b-667b7890f6d7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "67f26318-d01e-00b8-634a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:32 GMT", + "x-ms-client-request-id" : "b5650b36-f560-481d-a66b-667b7890f6d7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsettierblockblob&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" : "c9e0fe8d-4f06-422e-9c8e-2535c583bb17" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cab2f0-301e-0042-094a-67cbbf000000", + "Body" : "jtcsettierblockblobjtcsettierblockblob0blobapitestsettierblockblobb2a30920fe27Mon, 09 Sep 2019 20:06:32 GMT\"0x8D7356135E020A2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:32 GMT", + "x-ms-client-request-id" : "c9e0fe8d-4f06-422e-9c8e-2535c583bb17", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblobb2a30920fe27?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" : "551b28f4-f527-4837-b2b8-eee8f94016b0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cab2fe-301e-0042-174a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:33 GMT", + "x-ms-client-request-id" : "551b28f4-f527-4837-b2b8-eee8f94016b0" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierblockblob0blobapitestsettierblockblobb2a30920fe27", "javablobsettierblockblob1blobapitestsettierblockblobb2a78315a", "jtcsettierblockblob2blobapitestsettierblockblobb2a65705c435", "javablobsettierblockblob3blobapitestsettierblockblobb2a383076" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierblockblob[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierblockblob[1].json new file mode 100644 index 000000000000..4f071cb482d5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierblockblob[1].json @@ -0,0 +1,227 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblob22659050fbd8?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" : "7965e314-3225-470d-9850-bfd4067c74e9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613632E377\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cab316-301e-0042-2e4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:33 GMT", + "x-ms-client-request-id" : "7965e314-3225-470d-9850-bfd4067c74e9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblob22659050fbd8/javablobsettierblockblob1blobapitestsettierblockblob226255699", + "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" : "00984481-a019-44a4-9dc4-5be46291db6b", + "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 20:06:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:33 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356136401451\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cab32b-301e-0042-424a-67cbbf000000", + "x-ms-client-request-id" : "00984481-a019-44a4-9dc4-5be46291db6b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblob2261819685af?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" : "ee1a867f-4901-4fdb-abf6-217b3263216d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613648811F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "67f263e5-d01e-00b8-1a4a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:33 GMT", + "x-ms-client-request-id" : "ee1a867f-4901-4fdb-abf6-217b3263216d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblob2261819685af/javablobsettierblockblob3blobapitestsettierblockblob22663310f", + "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" : "cb082d18-e9f6-4b47-a152-143306cb6820", + "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 20:06:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:33 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561364EEE68\"", + "Content-Length" : "0", + "x-ms-request-id" : "67f263fe-d01e-00b8-2e4a-67634c000000", + "x-ms-client-request-id" : "cb082d18-e9f6-4b47-a152-143306cb6820" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblob2261819685af/javablobsettierblockblob3blobapitestsettierblockblob22663310f?comp=tier", + "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" : "02f44c4f-67d0-4f9b-b5f4-71ab6d9fd15b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "67f26412-d01e-00b8-3e4a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:33 GMT", + "x-ms-client-request-id" : "02f44c4f-67d0-4f9b-b5f4-71ab6d9fd15b" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblob2261819685af/javablobsettierblockblob3blobapitestsettierblockblob22663310f", + "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" : "072f7838-38ac-4cdb-863e-9b3a211cd966" + }, + "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 20:06:33 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Mon, 09 Sep 2019 20:06:33 GMT", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:06:33 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "Cool", + "ETag" : "\"0x8D73561364EEE68\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:33 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "67f26423-d01e-00b8-4b4a-67634c000000", + "x-ms-client-request-id" : "072f7838-38ac-4cdb-863e-9b3a211cd966", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblob2261819685af?include=&restype=container&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" : "998a4f51-c25d-403b-809d-1dcf9f88eecb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "67f26432-d01e-00b8-564a-67634c000000", + "Body" : "javablobsettierblockblob3blobapitestsettierblockblob22663310fMon, 09 Sep 2019 20:06:33 GMTMon, 09 Sep 2019 20:06:33 GMT0x8D73561364EEE687application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobCoolMon, 09 Sep 2019 20:06:33 GMTunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:06:33 GMT", + "x-ms-client-request-id" : "998a4f51-c25d-403b-809d-1dcf9f88eecb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblob2261819685af?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" : "ad52f784-660d-4ed6-b462-62c10eb5e94b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "67f2643e-d01e-00b8-614a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:33 GMT", + "x-ms-client-request-id" : "ad52f784-660d-4ed6-b462-62c10eb5e94b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsettierblockblob&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" : "c488c674-e16a-485b-973d-92eff187d65b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cab370-301e-0042-034a-67cbbf000000", + "Body" : "jtcsettierblockblobjtcsettierblockblob0blobapitestsettierblockblob22659050fbd8Mon, 09 Sep 2019 20:06:33 GMT\"0x8D735613632E377\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:33 GMT", + "x-ms-client-request-id" : "c488c674-e16a-485b-973d-92eff187d65b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblob22659050fbd8?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" : "a49e4fe7-3792-49b7-ad4b-7ee543f47165" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cab38c-301e-0042-1e4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:33 GMT", + "x-ms-client-request-id" : "a49e4fe7-3792-49b7-ad4b-7ee543f47165" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierblockblob0blobapitestsettierblockblob22659050fbd8", "javablobsettierblockblob1blobapitestsettierblockblob226255699", "jtcsettierblockblob2blobapitestsettierblockblob2261819685af", "javablobsettierblockblob3blobapitestsettierblockblob22663310f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierblockblob[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierblockblob[2].json new file mode 100644 index 000000000000..8ef2756a7cc8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierblockblob[2].json @@ -0,0 +1,227 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblobb1c44107f69c?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" : "14269bdb-bda1-49eb-8ac9-4d42e27a1160" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356136829882\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cab3aa-301e-0042-384a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:33 GMT", + "x-ms-client-request-id" : "14269bdb-bda1-49eb-8ac9-4d42e27a1160" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblobb1c44107f69c/javablobsettierblockblob1blobapitestsettierblockblobb1c025382", + "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" : "fbd4aca3-7235-4e46-a2ae-4fd3a73188d5", + "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 20:06:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:33 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613696F6B1\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cab3d1-301e-0042-594a-67cbbf000000", + "x-ms-client-request-id" : "fbd4aca3-7235-4e46-a2ae-4fd3a73188d5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobb1c185275d82?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" : "8848fa2a-ce45-4162-bba9-fe9a4f52b3bd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561369FB18F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "67f26553-d01e-00b8-554a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:33 GMT", + "x-ms-client-request-id" : "8848fa2a-ce45-4162-bba9-fe9a4f52b3bd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobb1c185275d82/javablobsettierblockblob3blobapitestsettierblockblobb1c09471f", + "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" : "4e78c11c-cca6-4d4b-aeef-316111d71c51", + "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 20:06:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:33 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356136A58259\"", + "Content-Length" : "0", + "x-ms-request-id" : "67f26577-d01e-00b8-734a-67634c000000", + "x-ms-client-request-id" : "4e78c11c-cca6-4d4b-aeef-316111d71c51" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobb1c185275d82/javablobsettierblockblob3blobapitestsettierblockblobb1c09471f?comp=tier", + "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" : "cf4bbc49-8e97-4722-88e8-9c03588bb874" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "67f2658c-d01e-00b8-054a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:33 GMT", + "x-ms-client-request-id" : "cf4bbc49-8e97-4722-88e8-9c03588bb874" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobb1c185275d82/javablobsettierblockblob3blobapitestsettierblockblobb1c09471f", + "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" : "4c295ac8-d822-469c-b03d-e21e84863a0a" + }, + "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 20:06:34 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Mon, 09 Sep 2019 20:06:34 GMT", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:06:33 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "Archive", + "ETag" : "\"0x8D7356136A58259\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:34 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "67f2659e-d01e-00b8-174a-67634c000000", + "x-ms-client-request-id" : "4c295ac8-d822-469c-b03d-e21e84863a0a", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobb1c185275d82?include=&restype=container&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" : "bb1e3a9b-8311-4448-baf7-18401525f8b0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "67f265b0-d01e-00b8-254a-67634c000000", + "Body" : "javablobsettierblockblob3blobapitestsettierblockblobb1c09471fMon, 09 Sep 2019 20:06:34 GMTMon, 09 Sep 2019 20:06:34 GMT0x8D7356136A582597application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobArchiveMon, 09 Sep 2019 20:06:34 GMTunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:06:33 GMT", + "x-ms-client-request-id" : "bb1e3a9b-8311-4448-baf7-18401525f8b0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierblockblob2blobapitestsettierblockblobb1c185275d82?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" : "34bde23f-546a-4d66-8796-9e17e8e5e59b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "67f265c2-d01e-00b8-364a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:34 GMT", + "x-ms-client-request-id" : "34bde23f-546a-4d66-8796-9e17e8e5e59b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsettierblockblob&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" : "b149c4ee-3d50-4b5e-8ff8-acc5183b4a20" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cab40a-301e-0042-104a-67cbbf000000", + "Body" : "jtcsettierblockblobjtcsettierblockblob0blobapitestsettierblockblobb1c44107f69cMon, 09 Sep 2019 20:06:33 GMT\"0x8D7356136829882\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:34 GMT", + "x-ms-client-request-id" : "b149c4ee-3d50-4b5e-8ff8-acc5183b4a20", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierblockblob0blobapitestsettierblockblobb1c44107f69c?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" : "92c3bd07-4c8f-4a73-b9ee-3be0c48629ab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cab41a-301e-0042-1f4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:34 GMT", + "x-ms-client-request-id" : "92c3bd07-4c8f-4a73-b9ee-3be0c48629ab" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierblockblob0blobapitestsettierblockblobb1c44107f69c", "javablobsettierblockblob1blobapitestsettierblockblobb1c025382", "jtcsettierblockblob2blobapitestsettierblockblobb1c185275d82", "javablobsettierblockblob3blobapitestsettierblockblobb1c09471f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettiererror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettiererror.json new file mode 100644 index 000000000000..74781f8398ae --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettiererror.json @@ -0,0 +1,177 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettiererror0blobapitestsettiererror70651556427d7cee?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" : "40b65bec-903f-4011-bf85-46f6ae15c89a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613D21365B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cabe2a-301e-0042-564a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:44 GMT", + "x-ms-client-request-id" : "40b65bec-903f-4011-bf85-46f6ae15c89a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettiererror0blobapitestsettiererror70651556427d7cee/javablobsettiererror1blobapitestsettiererror70635753950d4", + "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" : "eac3216e-26b1-453c-9e0d-a384733474ae", + "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 20:06:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:44 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613D2DCD50\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cabe4d-301e-0042-724a-67cbbf000000", + "x-ms-client-request-id" : "eac3216e-26b1-453c-9e0d-a384733474ae" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettiererror2blobapitestsettiererror706275270a63356c?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" : "55aae2b6-a0c9-48fb-8306-8257c1fda1a9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613D368568\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "67f283b9-d01e-00b8-594a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:44 GMT", + "x-ms-client-request-id" : "55aae2b6-a0c9-48fb-8306-8257c1fda1a9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettiererror2blobapitestsettiererror706275270a63356c/javablobsettiererror3blobapitestsettiererror7069446732f71", + "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" : "f97c4eda-3d68-4479-9a5e-22df4fb2b703", + "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 20:06:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:44 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613D3CF03D\"", + "Content-Length" : "0", + "x-ms-request-id" : "67f283d0-d01e-00b8-6e4a-67634c000000", + "x-ms-client-request-id" : "f97c4eda-3d68-4479-9a5e-22df4fb2b703" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettiererror2blobapitestsettiererror706275270a63356c/javablobsettiererror3blobapitestsettiererror7069446732f71?comp=tier", + "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" : "1c0fe3ff-6e55-4837-8b3a-a395dfe1842d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "329", + "StatusCode" : "400", + "x-ms-request-id" : "67f283e5-d01e-00b8-804a-67634c000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:67f283e5-d01e-00b8-804a-67634c000000\nTime:2019-09-09T20:06:45.2018153Zx-ms-access-tiergarbage", + "Date" : "Mon, 09 Sep 2019 20:06:44 GMT", + "x-ms-client-request-id" : "1c0fe3ff-6e55-4837-8b3a-a395dfe1842d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettiererror2blobapitestsettiererror706275270a63356c?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" : "b128041b-4721-4a97-bd5c-7c1c75e39ddd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "67f283fe-d01e-00b8-144a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:45 GMT", + "x-ms-client-request-id" : "b128041b-4721-4a97-bd5c-7c1c75e39ddd" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsettiererror&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" : "b1b5dff4-bcfe-4fa3-9f0c-99b79849d30b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cabe8b-301e-0042-2c4a-67cbbf000000", + "Body" : "jtcsettiererrorjtcsettiererror0blobapitestsettiererror70651556427d7ceeMon, 09 Sep 2019 20:06:44 GMT\"0x8D735613D21365B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:45 GMT", + "x-ms-client-request-id" : "b1b5dff4-bcfe-4fa3-9f0c-99b79849d30b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettiererror0blobapitestsettiererror70651556427d7cee?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" : "a7568864-d363-428f-aa9d-0fa3cf1621e9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cabe9b-301e-0042-3c4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:45 GMT", + "x-ms-client-request-id" : "a7568864-d363-428f-aa9d-0fa3cf1621e9" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettiererror0blobapitestsettiererror70651556427d7cee", "javablobsettiererror1blobapitestsettiererror70635753950d4", "jtcsettiererror2blobapitestsettiererror706275270a63356c", "javablobsettiererror3blobapitestsettiererror7069446732f71" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierillegalargument.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierillegalargument.json new file mode 100644 index 000000000000..635b91ef1756 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierillegalargument.json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierillegalargument0214335508825dbb794a1a?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" : "8633ec2b-9bf6-496a-8017-7cf7cee81dfa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613D6ACFCC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cabea8-301e-0042-474a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:45 GMT", + "x-ms-client-request-id" : "8633ec2b-9bf6-496a-8017-7cf7cee81dfa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierillegalargument0214335508825dbb794a1a/javablobsettierillegalargument14329879bd85b3eb904", + "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" : "7b12f9c8-c7be-4d97-9bde-9f94f8de3c3a", + "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 20:06:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:45 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613D78C6A1\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cabebe-301e-0042-5a4a-67cbbf000000", + "x-ms-client-request-id" : "7b12f9c8-c7be-4d97-9bde-9f94f8de3c3a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsettierillegalargument&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" : "db6da421-78c7-45ab-a7f9-7d46c00c3e5f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cabed9-301e-0042-714a-67cbbf000000", + "Body" : "jtcsettierillegalargumentjtcsettierillegalargument0214335508825dbb794a1aMon, 09 Sep 2019 20:06:45 GMT\"0x8D735613D6ACFCC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:45 GMT", + "x-ms-client-request-id" : "db6da421-78c7-45ab-a7f9-7d46c00c3e5f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierillegalargument0214335508825dbb794a1a?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" : "fccd7f77-5ced-4c32-ac4c-de11df466bc7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cabeea-301e-0042-7f4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:45 GMT", + "x-ms-client-request-id" : "fccd7f77-5ced-4c32-ac4c-de11df466bc7" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierillegalargument0214335508825dbb794a1a", "javablobsettierillegalargument14329879bd85b3eb904" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierinferred.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierinferred.json new file mode 100644 index 000000000000..903b284719d9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierinferred.json @@ -0,0 +1,261 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierinferred0blobapitestsettierinferredb4422401da778?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" : "a1ac1e77-68ee-45eb-b09e-52342dae8944" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613BD8001D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cabc2c-301e-0042-074a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:42 GMT", + "x-ms-client-request-id" : "a1ac1e77-68ee-45eb-b09e-52342dae8944" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierinferred0blobapitestsettierinferredb4422401da778/javablobsettierinferred1blobapitestsettierinferredb44692697f", + "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" : "fe7e5dc6-84a9-4e2b-b37b-c3cdcb91bf23", + "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 20:06:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:42 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613BE50BE2\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cabc37-301e-0042-114a-67cbbf000000", + "x-ms-client-request-id" : "fe7e5dc6-84a9-4e2b-b37b-c3cdcb91bf23" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierinferred2blobapitestsettierinferredb44992962e?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" : "b3fa6c4d-81cd-4491-90b5-99efa293d518" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613BEE87EF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "67f27d9b-d01e-00b8-634a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:42 GMT", + "x-ms-client-request-id" : "b3fa6c4d-81cd-4491-90b5-99efa293d518" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierinferred2blobapitestsettierinferredb44992962e/javablobsettierinferred3blobapitestsettierinferredb44239999e", + "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" : "9b901122-a773-4bbc-8034-121ea2524d50", + "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 20:06:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:42 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613BF56889\"", + "Content-Length" : "0", + "x-ms-request-id" : "67f27dc6-d01e-00b8-0a4a-67634c000000", + "x-ms-client-request-id" : "9b901122-a773-4bbc-8034-121ea2524d50" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierinferred2blobapitestsettierinferredb44992962e/javablobsettierinferred3blobapitestsettierinferredb44239999e", + "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" : "cddb0898-2ac5-4617-a3e7-9191898b83f1" + }, + "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 20:06:43 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:06:42 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735613BF56889\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:43 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "67f27dd4-d01e-00b8-184a-67634c000000", + "x-ms-client-request-id" : "cddb0898-2ac5-4617-a3e7-9191898b83f1", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierinferred2blobapitestsettierinferredb44992962e?include=&restype=container&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" : "1ae72b48-59d2-49c1-8859-e84167fb9360" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "67f27dfd-d01e-00b8-394a-67634c000000", + "Body" : "javablobsettierinferred3blobapitestsettierinferredb44239999eMon, 09 Sep 2019 20:06:43 GMTMon, 09 Sep 2019 20:06:43 GMT0x8D735613BF568897application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:06:42 GMT", + "x-ms-client-request-id" : "1ae72b48-59d2-49c1-8859-e84167fb9360", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierinferred2blobapitestsettierinferredb44992962e/javablobsettierinferred3blobapitestsettierinferredb44239999e?comp=tier", + "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" : "7adba6db-e5c5-4909-94e5-14f0d7c76659" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "67f27e19-d01e-00b8-504a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:42 GMT", + "x-ms-client-request-id" : "7adba6db-e5c5-4909-94e5-14f0d7c76659" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierinferred2blobapitestsettierinferredb44992962e/javablobsettierinferred3blobapitestsettierinferredb44239999e", + "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" : "0e57c2f0-6b35-4fe8-a46c-79bd477df43c" + }, + "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 20:06:43 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Mon, 09 Sep 2019 20:06:43 GMT", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:06:42 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735613BF56889\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:43 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "67f27e30-d01e-00b8-654a-67634c000000", + "x-ms-client-request-id" : "0e57c2f0-6b35-4fe8-a46c-79bd477df43c", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jamesschreppler.blob.core.windows.net/javablobsettierinferred2blobapitestsettierinferredb44992962e?include=&restype=container&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" : "54d807c6-6002-4009-b303-6cdcbfa1d33c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "67f27e46-d01e-00b8-794a-67634c000000", + "Body" : "javablobsettierinferred3blobapitestsettierinferredb44239999eMon, 09 Sep 2019 20:06:43 GMTMon, 09 Sep 2019 20:06:43 GMT0x8D735613BF568897application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHotMon, 09 Sep 2019 20:06:43 GMTunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:06:42 GMT", + "x-ms-client-request-id" : "54d807c6-6002-4009-b303-6cdcbfa1d33c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsettierinferred&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" : "bec72aee-325d-4354-8afb-95416311d1bf" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cabc77-301e-0042-484a-67cbbf000000", + "Body" : "jtcsettierinferredjtcsettierinferred0blobapitestsettierinferredb4422401da778Mon, 09 Sep 2019 20:06:42 GMT\"0x8D735613BD8001D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:42 GMT", + "x-ms-client-request-id" : "bec72aee-325d-4354-8afb-95416311d1bf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierinferred0blobapitestsettierinferredb4422401da778?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" : "c326852b-d75f-4d52-8ff6-f3bddc2375de" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cabc83-301e-0042-534a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:43 GMT", + "x-ms-client-request-id" : "c326852b-d75f-4d52-8ff6-f3bddc2375de" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierinferred0blobapitestsettierinferredb4422401da778", "javablobsettierinferred1blobapitestsettierinferredb44692697f", "javablobsettierinferred2blobapitestsettierinferredb44992962e", "javablobsettierinferred3blobapitestsettierinferredb44239999e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierlease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierlease.json new file mode 100644 index 000000000000..6a2907d34b02 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierlease.json @@ -0,0 +1,196 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierlease0blobapitestsettierlease17c914282af74c98?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" : "33d494d3-4abc-4931-ae41-fceae0906b8b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613D9FF327\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cabf00-301e-0042-144a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:45 GMT", + "x-ms-client-request-id" : "33d494d3-4abc-4931-ae41-fceae0906b8b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierlease0blobapitestsettierlease17c914282af74c98/javablobsettierlease1blobapitestsettierlease17c914336414c", + "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" : "738b3fa5-58ff-4e95-ab30-91e2fa1bb6cd", + "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 20:06:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:45 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613DAC8A3B\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cabf0b-301e-0042-1e4a-67cbbf000000", + "x-ms-client-request-id" : "738b3fa5-58ff-4e95-ab30-91e2fa1bb6cd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierlease2blobapitestsettierlease17c6890442c595ea?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" : "31d2a736-74be-4a9d-817d-2fd1ddcd8fa8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613DB4A5D9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "67f28631-d01e-00b8-104a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:45 GMT", + "x-ms-client-request-id" : "31d2a736-74be-4a9d-817d-2fd1ddcd8fa8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierlease2blobapitestsettierlease17c6890442c595ea/javablobsettierlease3blobapitestsettierlease17c29416e1051", + "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" : "fc38e61a-cbfb-453a-8c7a-ecf86fd72821", + "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 20:06:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:45 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613DBAE961\"", + "Content-Length" : "0", + "x-ms-request-id" : "67f28647-d01e-00b8-224a-67634c000000", + "x-ms-client-request-id" : "fc38e61a-cbfb-453a-8c7a-ecf86fd72821" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierlease2blobapitestsettierlease17c6890442c595ea/javablobsettierlease3blobapitestsettierlease17c29416e1051?comp=lease", + "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" : "3eb120a6-c6a5-45cb-bf9b-204b833d8407" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613DBAE961\"", + "x-ms-lease-id" : "f3b2e9d0-f552-4e63-8a7c-5a3d0c85a44d", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "67f2865d-d01e-00b8-354a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:45 GMT", + "x-ms-client-request-id" : "3eb120a6-c6a5-45cb-bf9b-204b833d8407" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierlease2blobapitestsettierlease17c6890442c595ea/javablobsettierlease3blobapitestsettierlease17c29416e1051?comp=tier", + "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" : "bb6b6333-ee64-473a-a7d2-ec721ddf3678" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "67f2866b-d01e-00b8-434a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:45 GMT", + "x-ms-client-request-id" : "bb6b6333-ee64-473a-a7d2-ec721ddf3678" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierlease2blobapitestsettierlease17c6890442c595ea?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" : "ab1dc2e1-f7e6-4738-9168-5e3592787016" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "67f28690-d01e-00b8-664a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:45 GMT", + "x-ms-client-request-id" : "ab1dc2e1-f7e6-4738-9168-5e3592787016" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsettierlease&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" : "12593690-a1bb-4275-a3b3-ab37eb47fce1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cabf44-301e-0042-534a-67cbbf000000", + "Body" : "jtcsettierleasejtcsettierlease0blobapitestsettierlease17c914282af74c98Mon, 09 Sep 2019 20:06:45 GMT\"0x8D735613D9FF327\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:45 GMT", + "x-ms-client-request-id" : "12593690-a1bb-4275-a3b3-ab37eb47fce1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierlease0blobapitestsettierlease17c914282af74c98?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" : "028639ae-e56d-4e21-8cad-c07420511c5b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cabf52-301e-0042-5f4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:45 GMT", + "x-ms-client-request-id" : "028639ae-e56d-4e21-8cad-c07420511c5b" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierlease0blobapitestsettierlease17c914282af74c98", "javablobsettierlease1blobapitestsettierlease17c914336414c", "jtcsettierlease2blobapitestsettierlease17c6890442c595ea", "javablobsettierlease3blobapitestsettierlease17c29416e1051" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierleasefail.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierleasefail.json new file mode 100644 index 000000000000..251d3423f525 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierleasefail.json @@ -0,0 +1,158 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierleasefail0blobapitestsettierleasefail8f59369290a4?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" : "9c25b81b-d612-4950-a02f-d4c74d47b0fe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613DECE88F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cabf73-301e-0042-7f4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:46 GMT", + "x-ms-client-request-id" : "9c25b81b-d612-4950-a02f-d4c74d47b0fe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierleasefail0blobapitestsettierleasefail8f59369290a4/javablobsettierleasefail1blobapitestsettierleasefail8f5480985", + "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" : "3fcb12a9-1796-4002-bcad-14dea83fd60d", + "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 20:06:46 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:46 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613DFB54D4\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cabf9c-301e-0042-274a-67cbbf000000", + "x-ms-client-request-id" : "3fcb12a9-1796-4002-bcad-14dea83fd60d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierleasefail2blobapitestsettierleasefail8f51664284f1?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" : "5b596f9c-117a-4a17-8879-6a188ca15225" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613E03E595\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "67f28799-d01e-00b8-454a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:46 GMT", + "x-ms-client-request-id" : "5b596f9c-117a-4a17-8879-6a188ca15225" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierleasefail2blobapitestsettierleasefail8f51664284f1/javablobsettierleasefail3blobapitestsettierleasefail8f5860725", + "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" : "235f4e27-2515-458f-8d10-2f03da836fa8", + "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 20:06:46 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:46 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613E0A5015\"", + "Content-Length" : "0", + "x-ms-request-id" : "67f287b8-d01e-00b8-5c4a-67634c000000", + "x-ms-client-request-id" : "235f4e27-2515-458f-8d10-2f03da836fa8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettierleasefail2blobapitestsettierleasefail8f51664284f1/javablobsettierleasefail3blobapitestsettierleasefail8f5860725?comp=tier", + "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" : "04d06b47-84f6-47ef-8997-fe58912b9b27" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "326", + "StatusCode" : "400", + "x-ms-request-id" : "67f287c8-d01e-00b8-694a-67634c000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:67f287c8-d01e-00b8-694a-67634c000000\nTime:2019-09-09T20:06:46.5877928Zx-ms-lease-idgarbage", + "Date" : "Mon, 09 Sep 2019 20:06:46 GMT", + "x-ms-client-request-id" : "04d06b47-84f6-47ef-8997-fe58912b9b27", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsettierleasefail&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" : "25c8c5f8-ddb6-477c-a987-8fea4bdc96c7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cabfcc-301e-0042-564a-67cbbf000000", + "Body" : "jtcsettierleasefailjtcsettierleasefail0blobapitestsettierleasefail8f59369290a4Mon, 09 Sep 2019 20:06:46 GMT\"0x8D735613DECE88F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:46 GMT", + "x-ms-client-request-id" : "25c8c5f8-ddb6-477c-a987-8fea4bdc96c7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierleasefail0blobapitestsettierleasefail8f59369290a4?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" : "de8939bf-b0ca-464d-b9ab-566ec8048118" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cabfed-301e-0042-724a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:46 GMT", + "x-ms-client-request-id" : "de8939bf-b0ca-464d-b9ab-566ec8048118" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierleasefail0blobapitestsettierleasefail8f59369290a4", "javablobsettierleasefail1blobapitestsettierleasefail8f5480985", "jtcsettierleasefail2blobapitestsettierleasefail8f51664284f1", "javablobsettierleasefail3blobapitestsettierleasefail8f5860725" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettiermin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettiermin.json new file mode 100644 index 000000000000..a590db2b7ed6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettiermin.json @@ -0,0 +1,174 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettiermin0blobapitestsettierminf9a57949c32ea0d4c7?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" : "d5b6e6ad-fdf9-4e17-8104-cee9d7139d81" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613B84EF1F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cabbb4-301e-0042-214a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:42 GMT", + "x-ms-client-request-id" : "d5b6e6ad-fdf9-4e17-8104-cee9d7139d81" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettiermin0blobapitestsettierminf9a57949c32ea0d4c7/javablobsettiermin1blobapitestsettierminf9a44466c5ff6a5", + "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" : "a0bf7374-6bf0-41d0-a7de-5372d52947aa", + "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 20:06:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:42 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613B92BE2F\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cabbcb-301e-0042-364a-67cbbf000000", + "x-ms-client-request-id" : "a0bf7374-6bf0-41d0-a7de-5372d52947aa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettiermin2blobapitestsettierminf9a94264ecc426acad?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" : "85be7395-b3db-4477-8e4b-30f0c2bb6132" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613B9B4FD7\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "67f27c21-d01e-00b8-254a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:42 GMT", + "x-ms-client-request-id" : "85be7395-b3db-4477-8e4b-30f0c2bb6132" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettiermin2blobapitestsettierminf9a94264ecc426acad/javablobsettiermin3blobapitestsettierminf9a707830ca28e0", + "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" : "4d40470b-f899-42f3-9fed-ed04858ca0f5", + "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 20:06:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:42 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613BA2A5D3\"", + "Content-Length" : "0", + "x-ms-request-id" : "67f27c3d-d01e-00b8-384a-67634c000000", + "x-ms-client-request-id" : "4d40470b-f899-42f3-9fed-ed04858ca0f5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettiermin0blobapitestsettierminf9a57949c32ea0d4c7/javablobsettiermin1blobapitestsettierminf9a44466c5ff6a5?comp=tier", + "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" : "e8bff178-fa2c-4f43-8d8d-306e94c511ce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cabbe6-301e-0042-4c4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:42 GMT", + "x-ms-client-request-id" : "e8bff178-fa2c-4f43-8d8d-306e94c511ce" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jamesschreppler.blob.core.windows.net/jtcsettiermin2blobapitestsettierminf9a94264ecc426acad?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" : "35ad6d57-8b19-4e6e-8df7-fe64179180a7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "67f27c7c-d01e-00b8-694a-67634c000000", + "Date" : "Mon, 09 Sep 2019 20:06:42 GMT", + "x-ms-client-request-id" : "35ad6d57-8b19-4e6e-8df7-fe64179180a7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsettiermin&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" : "a4c79520-9661-4bba-892d-9d20f0c29d07" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cabc01-301e-0042-614a-67cbbf000000", + "Body" : "jtcsettierminjtcsettiermin0blobapitestsettierminf9a57949c32ea0d4c7Mon, 09 Sep 2019 20:06:42 GMT\"0x8D735613B84EF1F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:42 GMT", + "x-ms-client-request-id" : "a4c79520-9661-4bba-892d-9d20f0c29d07", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettiermin0blobapitestsettierminf9a57949c32ea0d4c7?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" : "28a1111b-c5d4-47b4-acf3-0c83e2890941" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cabc16-301e-0042-734a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:42 GMT", + "x-ms-client-request-id" : "28a1111b-c5d4-47b4-acf3-0c83e2890941" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettiermin0blobapitestsettierminf9a57949c32ea0d4c7", "javablobsettiermin1blobapitestsettierminf9a44466c5ff6a5", "jtcsettiermin2blobapitestsettierminf9a94264ecc426acad", "javablobsettiermin3blobapitestsettierminf9a707830ca28e0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[0].json new file mode 100644 index 000000000000..6e7ef25776c4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[0].json @@ -0,0 +1,222 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobf8191016bfdcb?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" : "ec37bba5-c79d-414e-9f45-980e3043f4a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356136DA1720\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cab434-301e-0042-374a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:34 GMT", + "x-ms-client-request-id" : "ec37bba5-c79d-414e-9f45-980e3043f4a4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobf8191016bfdcb/javablobsettierpageblob1blobapitestsettierpageblobf8124250cf", + "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" : "b12afb31-c1c0-4fe9-8cc1-fed103e662b6", + "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 20:06:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:34 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356136E7211C\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cab44e-301e-0042-4e4a-67cbbf000000", + "x-ms-client-request-id" : "b12afb31-c1c0-4fe9-8cc1-fed103e662b6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobf8181134c581a?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" : "c65f7bbd-4367-47f3-bae0-d6a29ceb0d0b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356137EB7E14\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2ccdd11a-501c-0049-234a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:35 GMT", + "x-ms-client-request-id" : "c65f7bbd-4367-47f3-bae0-d6a29ceb0d0b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobf8181134c581a/javablobsettierpageblob3blobapitestsettierpageblobf81988336c", + "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" : "5add9819-044c-427d-bc1a-407f6c64193e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356137FF131A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "x-ms-request-id" : "2ccdd196-501c-0049-1f4a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:35 GMT", + "x-ms-client-request-id" : "5add9819-044c-427d-bc1a-407f6c64193e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobf8181134c581a/javablobsettierpageblob3blobapitestsettierpageblobf81988336c?comp=tier", + "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" : "41975106-8f30-4bf0-acca-ac12cf81dc6b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2ccdd1f1-501c-0049-7a4a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:35 GMT", + "x-ms-client-request-id" : "41975106-8f30-4bf0-acca-ac12cf81dc6b" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobf8181134c581a/javablobsettierpageblob3blobapitestsettierpageblobf81988336c", + "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" : "5ecf5a72-0428-4688-afb2-31d9929ca6f6" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:36 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:06:35 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "P4", + "ETag" : "\"0x8D7356137FF131A\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:36 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "2ccdd27e-501c-0049-074a-67bcb1000000", + "x-ms-client-request-id" : "5ecf5a72-0428-4688-afb2-31d9929ca6f6", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobf8181134c581a?include=&restype=container&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" : "58169b3a-f0c1-4a4b-a66d-67ce7977c2cd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2ccdd2bd-501c-0049-464a-67bcb1000000", + "Body" : "\njavablobsettierpageblob3blobapitestsettierpageblobf81988336cMon, 09 Sep 2019 20:06:36 GMTMon, 09 Sep 2019 20:06:36 GMT0x8D7356137FF131A512application/octet-stream0PageBlobP4unlockedavailabletrue", + "Date" : "Mon, 09 Sep 2019 20:06:35 GMT", + "x-ms-client-request-id" : "58169b3a-f0c1-4a4b-a66d-67ce7977c2cd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobf8181134c581a?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" : "d1f28fdd-e799-45d8-bbb4-33f8b5b82bbb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "2ccdd300-501c-0049-094a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:35 GMT", + "x-ms-client-request-id" : "d1f28fdd-e799-45d8-bbb4-33f8b5b82bbb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsettierpageblob&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" : "f0dfa0d4-07f5-4f80-bf88-999304d56ea6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cab679-301e-0042-554a-67cbbf000000", + "Body" : "jtcsettierpageblobjtcsettierpageblob0blobapitestsettierpageblobf8191016bfdcbMon, 09 Sep 2019 20:06:34 GMT\"0x8D7356136DA1720\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:36 GMT", + "x-ms-client-request-id" : "f0dfa0d4-07f5-4f80-bf88-999304d56ea6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobf8191016bfdcb?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" : "c91a447c-6ce2-4a2b-9581-fa29b0e3dad2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cab68f-301e-0042-6a4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:36 GMT", + "x-ms-client-request-id" : "c91a447c-6ce2-4a2b-9581-fa29b0e3dad2" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierpageblob0blobapitestsettierpageblobf8191016bfdcb", "javablobsettierpageblob1blobapitestsettierpageblobf8124250cf", "jtcsettierpageblob2blobapitestsettierpageblobf8181134c581a", "javablobsettierpageblob3blobapitestsettierpageblobf81988336c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[1].json new file mode 100644 index 000000000000..c7852b515817 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[1].json @@ -0,0 +1,222 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobe722538284a73?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" : "019a93a8-cc8a-4066-9a1a-937081e2f28f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561386480D9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cab69f-301e-0042-7a4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:36 GMT", + "x-ms-client-request-id" : "019a93a8-cc8a-4066-9a1a-937081e2f28f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobe722538284a73/javablobsettierpageblob1blobapitestsettierpageblobe723541475", + "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" : "5c28655c-2200-4d5b-b70f-61b2c6a437b6", + "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 20:06:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:36 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356138729CFE\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cab6ba-301e-0042-134a-67cbbf000000", + "x-ms-client-request-id" : "5c28655c-2200-4d5b-b70f-61b2c6a437b6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobe7254998d8003?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" : "80dde81a-424c-4b09-953b-4ab387342e6f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561387E8A78\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2ccdd58c-501c-0049-154a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:36 GMT", + "x-ms-client-request-id" : "80dde81a-424c-4b09-953b-4ab387342e6f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobe7254998d8003/javablobsettierpageblob3blobapitestsettierpageblobe725419300", + "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" : "e34aaa71-e872-4b7a-bd80-0434f2cda168" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561388BDD08\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "x-ms-request-id" : "2ccdd610-501c-0049-194a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:36 GMT", + "x-ms-client-request-id" : "e34aaa71-e872-4b7a-bd80-0434f2cda168" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobe7254998d8003/javablobsettierpageblob3blobapitestsettierpageblobe725419300?comp=tier", + "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" : "aad1dc33-afcf-4457-92b5-09462a011df3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2ccdd696-501c-0049-1f4a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:36 GMT", + "x-ms-client-request-id" : "aad1dc33-afcf-4457-92b5-09462a011df3" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobe7254998d8003/javablobsettierpageblob3blobapitestsettierpageblobe725419300", + "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" : "3779b859-b923-470a-bfd6-b8495e29c060" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:37 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:06:36 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "P6", + "ETag" : "\"0x8D73561388BDD08\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:37 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "2ccdd72a-501c-0049-334a-67bcb1000000", + "x-ms-client-request-id" : "3779b859-b923-470a-bfd6-b8495e29c060", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobe7254998d8003?include=&restype=container&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" : "0e40dc5e-c6a2-4432-aab4-2f7fc173e6ac" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2ccdd792-501c-0049-1b4a-67bcb1000000", + "Body" : "\njavablobsettierpageblob3blobapitestsettierpageblobe725419300Mon, 09 Sep 2019 20:06:37 GMTMon, 09 Sep 2019 20:06:37 GMT0x8D73561388BDD08512application/octet-stream0PageBlobP6unlockedavailabletrue", + "Date" : "Mon, 09 Sep 2019 20:06:36 GMT", + "x-ms-client-request-id" : "0e40dc5e-c6a2-4432-aab4-2f7fc173e6ac", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobe7254998d8003?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" : "73881f00-0d2b-45cd-82f1-d90d6c054cf0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "2ccdd7f3-501c-0049-7c4a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:36 GMT", + "x-ms-client-request-id" : "73881f00-0d2b-45cd-82f1-d90d6c054cf0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsettierpageblob&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" : "7fdd9ea1-73b7-4af9-a143-7fd9c22a5edc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cab73a-301e-0042-074a-67cbbf000000", + "Body" : "jtcsettierpageblobjtcsettierpageblob0blobapitestsettierpageblobe722538284a73Mon, 09 Sep 2019 20:06:37 GMT\"0x8D73561386480D9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:37 GMT", + "x-ms-client-request-id" : "7fdd9ea1-73b7-4af9-a143-7fd9c22a5edc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobe722538284a73?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" : "98c81f58-c8f3-46c0-8dfb-5805de244899" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cab74d-301e-0042-184a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:37 GMT", + "x-ms-client-request-id" : "98c81f58-c8f3-46c0-8dfb-5805de244899" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierpageblob0blobapitestsettierpageblobe722538284a73", "javablobsettierpageblob1blobapitestsettierpageblobe723541475", "jtcsettierpageblob2blobapitestsettierpageblobe7254998d8003", "javablobsettierpageblob3blobapitestsettierpageblobe725419300" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[2].json new file mode 100644 index 000000000000..55c7ac160b11 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[2].json @@ -0,0 +1,222 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblob2fa18994d231c?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" : "685f2159-df30-4162-8360-ae2813713680" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356138E539C9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cab776-301e-0042-3d4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:37 GMT", + "x-ms-client-request-id" : "685f2159-df30-4162-8360-ae2813713680" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblob2fa18994d231c/javablobsettierpageblob1blobapitestsettierpageblob2fa48567fa", + "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" : "0e0a48bd-228b-48e5-b55f-9023593196c7", + "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 20:06:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356138F1F64E\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cab787-301e-0042-4d4a-67cbbf000000", + "x-ms-client-request-id" : "0e0a48bd-228b-48e5-b55f-9023593196c7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob2fa834834f5ba?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" : "4b14d7a7-1bed-4ec7-b147-ede2ce120fe9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356138FDBD13\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2ccdd9b2-501c-0049-3b4a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:37 GMT", + "x-ms-client-request-id" : "4b14d7a7-1bed-4ec7-b147-ede2ce120fe9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob2fa834834f5ba/javablobsettierpageblob3blobapitestsettierpageblob2fa0449701", + "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" : "2098969b-3b0d-4152-abf4-3ef0cd33483d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561390B5E72\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "x-ms-request-id" : "2ccdda22-501c-0049-2b4a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:37 GMT", + "x-ms-client-request-id" : "2098969b-3b0d-4152-abf4-3ef0cd33483d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob2fa834834f5ba/javablobsettierpageblob3blobapitestsettierpageblob2fa0449701?comp=tier", + "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" : "e31df5f0-7fff-4d66-b6d4-e66503070c0c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2ccdda7c-501c-0049-054a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:37 GMT", + "x-ms-client-request-id" : "e31df5f0-7fff-4d66-b6d4-e66503070c0c" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob2fa834834f5ba/javablobsettierpageblob3blobapitestsettierpageblob2fa0449701", + "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" : "cdb5137d-043a-45e8-929b-dbeb91121d7d" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:38 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:06:37 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "P10", + "ETag" : "\"0x8D73561390B5E72\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:38 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "2ccddae7-501c-0049-704a-67bcb1000000", + "x-ms-client-request-id" : "cdb5137d-043a-45e8-929b-dbeb91121d7d", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob2fa834834f5ba?include=&restype=container&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" : "9db4e6a3-18a6-4534-8f95-909ab9a5325b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2ccddb4c-501c-0049-554a-67bcb1000000", + "Body" : "\njavablobsettierpageblob3blobapitestsettierpageblob2fa0449701Mon, 09 Sep 2019 20:06:38 GMTMon, 09 Sep 2019 20:06:38 GMT0x8D73561390B5E72512application/octet-stream0PageBlobP10unlockedavailabletrue", + "Date" : "Mon, 09 Sep 2019 20:06:37 GMT", + "x-ms-client-request-id" : "9db4e6a3-18a6-4534-8f95-909ab9a5325b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob2fa834834f5ba?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" : "858da93c-9fb5-440f-8918-6419c732f291" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "2ccddbb2-501c-0049-3b4a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:37 GMT", + "x-ms-client-request-id" : "858da93c-9fb5-440f-8918-6419c732f291" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsettierpageblob&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" : "8cc21b98-bef4-44dd-a748-817dc57eca72" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cab822-301e-0042-604a-67cbbf000000", + "Body" : "jtcsettierpageblobjtcsettierpageblob0blobapitestsettierpageblob2fa18994d231cMon, 09 Sep 2019 20:06:37 GMT\"0x8D7356138E539C9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:38 GMT", + "x-ms-client-request-id" : "8cc21b98-bef4-44dd-a748-817dc57eca72", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblob2fa18994d231c?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" : "132fe00c-df03-4d38-97fd-cfc81ac659ce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cab832-301e-0042-704a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:38 GMT", + "x-ms-client-request-id" : "132fe00c-df03-4d38-97fd-cfc81ac659ce" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierpageblob0blobapitestsettierpageblob2fa18994d231c", "javablobsettierpageblob1blobapitestsettierpageblob2fa48567fa", "jtcsettierpageblob2blobapitestsettierpageblob2fa834834f5ba", "javablobsettierpageblob3blobapitestsettierpageblob2fa0449701" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[3].json new file mode 100644 index 000000000000..7f065b0f4257 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[3].json @@ -0,0 +1,222 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblob3256986750ccf?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" : "d50218b9-b663-414f-9e42-b40ea70d8b33" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613965565E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cab849-301e-0042-064a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:38 GMT", + "x-ms-client-request-id" : "d50218b9-b663-414f-9e42-b40ea70d8b33" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblob3256986750ccf/javablobsettierpageblob1blobapitestsettierpageblob325598194a", + "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" : "3393f6d3-4c98-4718-a67c-92bcb36a39ef", + "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 20:06:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:38 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613972FD9B\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cab859-301e-0042-154a-67cbbf000000", + "x-ms-client-request-id" : "3393f6d3-4c98-4718-a67c-92bcb36a39ef" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob325774618521b?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" : "a0f3db71-a4de-4130-9385-9ba1760136ad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561397F1328\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2ccddd9d-501c-0049-264a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:38 GMT", + "x-ms-client-request-id" : "a0f3db71-a4de-4130-9385-9ba1760136ad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob325774618521b/javablobsettierpageblob3blobapitestsettierpageblob3255804231", + "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" : "8309dc28-f735-4a16-88ec-94d6ef3f5cd7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561398C3EBA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "x-ms-request-id" : "2ccdde3f-501c-0049-484a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:38 GMT", + "x-ms-client-request-id" : "8309dc28-f735-4a16-88ec-94d6ef3f5cd7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob325774618521b/javablobsettierpageblob3blobapitestsettierpageblob3255804231?comp=tier", + "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" : "aae98fa2-e94b-461e-baf1-d16ff8812571" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2ccddeab-501c-0049-344a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:38 GMT", + "x-ms-client-request-id" : "aae98fa2-e94b-461e-baf1-d16ff8812571" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob325774618521b/javablobsettierpageblob3blobapitestsettierpageblob3255804231", + "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" : "4a77f485-a66a-4a72-97c8-1771a9fe9b1b" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:38 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:06:38 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "P20", + "ETag" : "\"0x8D73561398C3EBA\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:38 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "2ccddf0c-501c-0049-154a-67bcb1000000", + "x-ms-client-request-id" : "4a77f485-a66a-4a72-97c8-1771a9fe9b1b", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob325774618521b?include=&restype=container&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" : "ce42024f-df35-45dd-86b9-7c08d50e03e8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2ccddf53-501c-0049-5c4a-67bcb1000000", + "Body" : "\njavablobsettierpageblob3blobapitestsettierpageblob3255804231Mon, 09 Sep 2019 20:06:38 GMTMon, 09 Sep 2019 20:06:38 GMT0x8D73561398C3EBA512application/octet-stream0PageBlobP20unlockedavailabletrue", + "Date" : "Mon, 09 Sep 2019 20:06:38 GMT", + "x-ms-client-request-id" : "ce42024f-df35-45dd-86b9-7c08d50e03e8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob325774618521b?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" : "4ed859b4-39cb-4204-b7b9-856c51265e93" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "2ccddfb4-501c-0049-3d4a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:38 GMT", + "x-ms-client-request-id" : "4ed859b4-39cb-4204-b7b9-856c51265e93" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsettierpageblob&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" : "2c3278a7-4d0e-455b-93dd-70e7943feff7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cab8e4-301e-0042-134a-67cbbf000000", + "Body" : "jtcsettierpageblobjtcsettierpageblob0blobapitestsettierpageblob3256986750ccfMon, 09 Sep 2019 20:06:38 GMT\"0x8D735613965565E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:39 GMT", + "x-ms-client-request-id" : "2c3278a7-4d0e-455b-93dd-70e7943feff7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblob3256986750ccf?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" : "90b796b6-a975-4a0c-8afc-44bcc8ded244" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cab8f8-301e-0042-244a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:39 GMT", + "x-ms-client-request-id" : "90b796b6-a975-4a0c-8afc-44bcc8ded244" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierpageblob0blobapitestsettierpageblob3256986750ccf", "javablobsettierpageblob1blobapitestsettierpageblob325598194a", "jtcsettierpageblob2blobapitestsettierpageblob325774618521b", "javablobsettierpageblob3blobapitestsettierpageblob3255804231" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[4].json new file mode 100644 index 000000000000..f70ad7d208b5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[4].json @@ -0,0 +1,222 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobe246804040549?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" : "2c89691e-a27b-40f3-a1e4-b2cc4d690de8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356139E6F9DE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cab918-301e-0042-3f4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:39 GMT", + "x-ms-client-request-id" : "2c89691e-a27b-40f3-a1e4-b2cc4d690de8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobe246804040549/javablobsettierpageblob1blobapitestsettierpageblobe24474530f", + "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" : "1cf7ab99-5cf8-4df6-94ad-c4ee69ebca48", + "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 20:06:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:39 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356139F45319\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cab933-301e-0042-564a-67cbbf000000", + "x-ms-client-request-id" : "1cf7ab99-5cf8-4df6-94ad-c4ee69ebca48" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobe245778911a08?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" : "c1e8d8eb-3240-4398-b074-7ee2bad8f262" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613A0041F9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2ccde19b-501c-0049-244a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:38 GMT", + "x-ms-client-request-id" : "c1e8d8eb-3240-4398-b074-7ee2bad8f262" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobe245778911a08/javablobsettierpageblob3blobapitestsettierpageblobe246469579", + "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" : "0c10e3bf-aec6-4eea-8506-9609db76dda2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613A0DBBEC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "x-ms-request-id" : "2ccde1f1-501c-0049-7a4a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:38 GMT", + "x-ms-client-request-id" : "0c10e3bf-aec6-4eea-8506-9609db76dda2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobe245778911a08/javablobsettierpageblob3blobapitestsettierpageblobe246469579?comp=tier", + "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" : "8aefc9ab-5822-4743-bcb2-65434c17cf84" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2ccde264-501c-0049-6d4a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:39 GMT", + "x-ms-client-request-id" : "8aefc9ab-5822-4743-bcb2-65434c17cf84" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobe245778911a08/javablobsettierpageblob3blobapitestsettierpageblobe246469579", + "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" : "bda1f08f-f5bf-4762-8e2d-caedaf5e3f89" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:39 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:06:39 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "P30", + "ETag" : "\"0x8D735613A0DBBEC\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:39 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "2ccde2be-501c-0049-474a-67bcb1000000", + "x-ms-client-request-id" : "bda1f08f-f5bf-4762-8e2d-caedaf5e3f89", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobe245778911a08?include=&restype=container&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" : "f772a489-2b52-4755-9117-909349b0f416" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2ccde30d-501c-0049-164a-67bcb1000000", + "Body" : "\njavablobsettierpageblob3blobapitestsettierpageblobe246469579Mon, 09 Sep 2019 20:06:39 GMTMon, 09 Sep 2019 20:06:39 GMT0x8D735613A0DBBEC512application/octet-stream0PageBlobP30unlockedavailabletrue", + "Date" : "Mon, 09 Sep 2019 20:06:39 GMT", + "x-ms-client-request-id" : "f772a489-2b52-4755-9117-909349b0f416", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobe245778911a08?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" : "87ee8aca-05b3-411a-be21-8fe7467b17e7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "2ccde365-501c-0049-6e4a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:39 GMT", + "x-ms-client-request-id" : "87ee8aca-05b3-411a-be21-8fe7467b17e7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsettierpageblob&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" : "bcb7fc02-dbce-463d-a6c5-553ae3aec6d1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cab9d9-301e-0042-704a-67cbbf000000", + "Body" : "jtcsettierpageblobjtcsettierpageblob0blobapitestsettierpageblobe246804040549Mon, 09 Sep 2019 20:06:39 GMT\"0x8D7356139E6F9DE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:39 GMT", + "x-ms-client-request-id" : "bcb7fc02-dbce-463d-a6c5-553ae3aec6d1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobe246804040549?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" : "72e1b14f-e8e4-4cf6-9158-c92ab894ef16" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cab9ec-301e-0042-024a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:40 GMT", + "x-ms-client-request-id" : "72e1b14f-e8e4-4cf6-9158-c92ab894ef16" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierpageblob0blobapitestsettierpageblobe246804040549", "javablobsettierpageblob1blobapitestsettierpageblobe24474530f", "jtcsettierpageblob2blobapitestsettierpageblobe245778911a08", "javablobsettierpageblob3blobapitestsettierpageblobe246469579" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[5].json new file mode 100644 index 000000000000..504316885feb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[5].json @@ -0,0 +1,222 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobe128701309611?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" : "36ac965c-fc7b-4f80-a939-98c13f1924e9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613A67D9E8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caba04-301e-0042-194a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:40 GMT", + "x-ms-client-request-id" : "36ac965c-fc7b-4f80-a939-98c13f1924e9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobe128701309611/javablobsettierpageblob1blobapitestsettierpageblobe122889706", + "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" : "5e8fae63-e440-4b1b-a0ba-a5fa8186d9c5", + "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 20:06:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:40 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613A74E523\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caba17-301e-0042-294a-67cbbf000000", + "x-ms-client-request-id" : "5e8fae63-e440-4b1b-a0ba-a5fa8186d9c5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobe126069346a3f?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" : "e416761d-b339-4fff-8e99-0e90848b8396" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613A80FB9B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2ccde4ca-501c-0049-534a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:39 GMT", + "x-ms-client-request-id" : "e416761d-b339-4fff-8e99-0e90848b8396" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobe126069346a3f/javablobsettierpageblob3blobapitestsettierpageblobe125193404", + "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" : "8684743d-92a7-4101-be7f-b686e65904cc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613A8DD9C4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "x-ms-request-id" : "2ccde50e-501c-0049-174a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:39 GMT", + "x-ms-client-request-id" : "8684743d-92a7-4101-be7f-b686e65904cc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobe126069346a3f/javablobsettierpageblob3blobapitestsettierpageblobe125193404?comp=tier", + "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" : "dcf81295-b5cf-47b1-85e5-72fac79a9856" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2ccde563-501c-0049-6c4a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:39 GMT", + "x-ms-client-request-id" : "dcf81295-b5cf-47b1-85e5-72fac79a9856" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobe126069346a3f/javablobsettierpageblob3blobapitestsettierpageblobe125193404", + "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" : "d6b369b4-1953-4ff0-b69a-0bab6a0f46c3" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:40 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:06:39 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "P40", + "ETag" : "\"0x8D735613A8DD9C4\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:40 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "2ccde5e4-501c-0049-6d4a-67bcb1000000", + "x-ms-client-request-id" : "d6b369b4-1953-4ff0-b69a-0bab6a0f46c3", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobe126069346a3f?include=&restype=container&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" : "b4e9bbee-9b85-4b63-9275-232cdf02d66b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2ccde629-501c-0049-324a-67bcb1000000", + "Body" : "\njavablobsettierpageblob3blobapitestsettierpageblobe125193404Mon, 09 Sep 2019 20:06:40 GMTMon, 09 Sep 2019 20:06:40 GMT0x8D735613A8DD9C4512application/octet-stream0PageBlobP40unlockedavailabletrue", + "Date" : "Mon, 09 Sep 2019 20:06:40 GMT", + "x-ms-client-request-id" : "b4e9bbee-9b85-4b63-9275-232cdf02d66b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblobe126069346a3f?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" : "6e38f7f3-68ab-466d-afa1-b8e3c8610322" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "2ccde683-501c-0049-0c4a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:40 GMT", + "x-ms-client-request-id" : "6e38f7f3-68ab-466d-afa1-b8e3c8610322" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsettierpageblob&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" : "4a2f96f8-2abb-435d-a9da-89a43513580f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cababb-301e-0042-3a4a-67cbbf000000", + "Body" : "jtcsettierpageblobjtcsettierpageblob0blobapitestsettierpageblobe128701309611Mon, 09 Sep 2019 20:06:40 GMT\"0x8D735613A67D9E8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:40 GMT", + "x-ms-client-request-id" : "4a2f96f8-2abb-435d-a9da-89a43513580f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblobe128701309611?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" : "cfa8490b-e4d5-4850-bac2-0ef300362cb6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cabace-301e-0042-4d4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:41 GMT", + "x-ms-client-request-id" : "cfa8490b-e4d5-4850-bac2-0ef300362cb6" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierpageblob0blobapitestsettierpageblobe128701309611", "javablobsettierpageblob1blobapitestsettierpageblobe122889706", "jtcsettierpageblob2blobapitestsettierpageblobe126069346a3f", "javablobsettierpageblob3blobapitestsettierpageblobe125193404" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[6].json new file mode 100644 index 000000000000..73cc992f6e78 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsettierpageblob[6].json @@ -0,0 +1,222 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblob6aa29125920ee?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" : "334ac0d5-9ce6-40ea-9e00-6c597efaee66" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613B014F71\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cabafe-301e-0042-7a4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:41 GMT", + "x-ms-client-request-id" : "334ac0d5-9ce6-40ea-9e00-6c597efaee66" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblob6aa29125920ee/javablobsettierpageblob1blobapitestsettierpageblob6aa648927b", + "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" : "60998433-831e-482b-a6b3-ff3828bd1ec1", + "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 20:06:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:41 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613B0F4571\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cabb18-301e-0042-114a-67cbbf000000", + "x-ms-client-request-id" : "60998433-831e-482b-a6b3-ff3828bd1ec1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob6aa5692705667?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" : "35c0bf18-c732-4863-8efe-3106e01acaa8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613B1B840E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2ccde891-501c-0049-1a4a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:40 GMT", + "x-ms-client-request-id" : "35c0bf18-c732-4863-8efe-3106e01acaa8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob6aa5692705667/javablobsettierpageblob3blobapitestsettierpageblob6aa5227447", + "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" : "9cf24d67-681b-4c83-8f17-35f0d64be612" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613B2A0FF9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "x-ms-request-id" : "2ccde8f6-501c-0049-7f4a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:40 GMT", + "x-ms-client-request-id" : "9cf24d67-681b-4c83-8f17-35f0d64be612" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob6aa5692705667/javablobsettierpageblob3blobapitestsettierpageblob6aa5227447?comp=tier", + "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" : "eb4debc9-4e25-44b3-b631-fa2bc8427d37" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2ccde943-501c-0049-4c4a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:40 GMT", + "x-ms-client-request-id" : "eb4debc9-4e25-44b3-b631-fa2bc8427d37" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob6aa5692705667/javablobsettierpageblob3blobapitestsettierpageblob6aa5227447", + "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" : "98a9324a-c0e6-4fa9-a0b8-75b194f0cc79" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:41 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:06:40 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "P50", + "ETag" : "\"0x8D735613B2A0FF9\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:41 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "2ccde983-501c-0049-0c4a-67bcb1000000", + "x-ms-client-request-id" : "98a9324a-c0e6-4fa9-a0b8-75b194f0cc79", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob6aa5692705667?include=&restype=container&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" : "a21d37c5-63ab-48ff-8ecc-9749b6fb8675" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2ccde9bf-501c-0049-484a-67bcb1000000", + "Body" : "\njavablobsettierpageblob3blobapitestsettierpageblob6aa5227447Mon, 09 Sep 2019 20:06:41 GMTMon, 09 Sep 2019 20:06:41 GMT0x8D735613B2A0FF9512application/octet-stream0PageBlobP50unlockedavailabletrue", + "Date" : "Mon, 09 Sep 2019 20:06:41 GMT", + "x-ms-client-request-id" : "a21d37c5-63ab-48ff-8ecc-9749b6fb8675", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschreppremium.blob.core.windows.net/jtcsettierpageblob2blobapitestsettierpageblob6aa5692705667?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" : "5e2d8b70-03e7-435d-809b-d4eb283e84ac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "2ccdea11-501c-0049-1a4a-67bcb1000000", + "Date" : "Mon, 09 Sep 2019 20:06:41 GMT", + "x-ms-client-request-id" : "5e2d8b70-03e7-435d-809b-d4eb283e84ac" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsettierpageblob&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" : "76f37e74-5e59-40c1-9931-742613364b87" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cabb98-301e-0042-074a-67cbbf000000", + "Body" : "jtcsettierpageblobjtcsettierpageblob0blobapitestsettierpageblob6aa29125920eeMon, 09 Sep 2019 20:06:41 GMT\"0x8D735613B014F71\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:41 GMT", + "x-ms-client-request-id" : "76f37e74-5e59-40c1-9931-742613364b87", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsettierpageblob0blobapitestsettierpageblob6aa29125920ee?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" : "5927532f-2dbb-48c0-9cb9-c0a447ed7d0d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cabba3-301e-0042-124a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:41 GMT", + "x-ms-client-request-id" : "5927532f-2dbb-48c0-9cb9-c0a447ed7d0d" + }, + "Exception" : null + } ], + "variables" : [ "jtcsettierpageblob0blobapitestsettierpageblob6aa29125920ee", "javablobsettierpageblob1blobapitestsettierpageblob6aa648927b", "jtcsettierpageblob2blobapitestsettierpageblob6aa5692705667", "javablobsettierpageblob3blobapitestsettierpageblob6aa5227447" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshot.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshot.json new file mode 100644 index 000000000000..2f2d6c7af8bc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshot.json @@ -0,0 +1,144 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshot0blobapitestsnapshot7d2491795cb3e511a069?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" : "be362e68-cc17-4133-a203-db2ba66b9e40" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356118536E54\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7eb8-301e-0042-7e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:43 GMT", + "x-ms-client-request-id" : "be362e68-cc17-4133-a203-db2ba66b9e40" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshot0blobapitestsnapshot7d2491795cb3e511a069/javablobsnapshot1blobapitestsnapshot7d249078846da3d25", + "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" : "f3935798-e898-4c76-94f7-b5071f6666d8", + "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 20:05:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:43 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561186094A9\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca7ed4-301e-0042-1749-67cbbf000000", + "x-ms-client-request-id" : "f3935798-e898-4c76-94f7-b5071f6666d8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshot0blobapitestsnapshot7d2491795cb3e511a069/javablobsnapshot1blobapitestsnapshot7d249078846da3d25?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" : "028acbb8-bdcd-4995-996f-cf7fea48111c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:05:43.4127654Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561186094A9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7eee-301e-0042-2e49-67cbbf000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:05:43 GMT", + "x-ms-client-request-id" : "028acbb8-bdcd-4995-996f-cf7fea48111c" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshot0blobapitestsnapshot7d2491795cb3e511a069/javablobsnapshot1blobapitestsnapshot7d249078846da3d25?snapshot=2019-09-09T20%3a05%3a43.4127654Z", + "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" : "add93ab9-ef1f-4796-b3ca-01a5ca5a1a0d" + }, + "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 20:05:43 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:05:43 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-09T20:05:43.4127654Z", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561186094A9\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:43 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca7f05-301e-0042-4449-67cbbf000000", + "x-ms-client-request-id" : "add93ab9-ef1f-4796-b3ca-01a5ca5a1a0d", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsnapshot&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" : "6e68a127-2d98-4046-800a-d7611309512c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca7f18-301e-0042-5749-67cbbf000000", + "Body" : "jtcsnapshotjtcsnapshot0blobapitestsnapshot7d2491795cb3e511a069Mon, 09 Sep 2019 20:05:43 GMT\"0x8D7356118536E54\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:43 GMT", + "x-ms-client-request-id" : "6e68a127-2d98-4046-800a-d7611309512c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshot0blobapitestsnapshot7d2491795cb3e511a069?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" : "529d59a0-d12d-435e-b90f-a439c288fe15" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca7f28-301e-0042-6749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:43 GMT", + "x-ms-client-request-id" : "529d59a0-d12d-435e-b90f-a439c288fe15" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshot0blobapitestsnapshot7d2491795cb3e511a069", "javablobsnapshot1blobapitestsnapshot7d249078846da3d25" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[0].json new file mode 100644 index 000000000000..0f36b4c9d267 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[0].json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotacfc362242e986e79e42?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" : "04a89d14-94a2-47d4-bd9e-0d19f0fc455f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561193D836A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca80a3-301e-0042-4d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:44 GMT", + "x-ms-client-request-id" : "04a89d14-94a2-47d4-bd9e-0d19f0fc455f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotacfc362242e986e79e42/javablobsnapshotac1blobapitestsnapshotacfc3453192654757", + "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" : "187ca1d9-52a9-4204-801d-fc9ea5033833", + "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 20:05:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:44 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561194B6D88\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca80c0-301e-0042-6949-67cbbf000000", + "x-ms-client-request-id" : "187ca1d9-52a9-4204-801d-fc9ea5033833" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotacfc362242e986e79e42/javablobsnapshotac1blobapitestsnapshotacfc3453192654757?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" : "622123e2-e023-46dc-be23-761c60def87e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:05:44.9528610Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561194B6D88\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca80db-301e-0042-0249-67cbbf000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:05:44 GMT", + "x-ms-client-request-id" : "622123e2-e023-46dc-be23-761c60def87e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsnapshotac&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" : "c8b80bdd-259a-47a6-bca0-be59d237ddba" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca80e1-301e-0042-0849-67cbbf000000", + "Body" : "jtcsnapshotacjtcsnapshotac0blobapitestsnapshotacfc362242e986e79e42Mon, 09 Sep 2019 20:05:44 GMT\"0x8D73561193D836A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:44 GMT", + "x-ms-client-request-id" : "c8b80bdd-259a-47a6-bca0-be59d237ddba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotacfc362242e986e79e42?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" : "5bcfdb47-5794-4bd1-a005-019264c02394" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8103-301e-0042-2549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:44 GMT", + "x-ms-client-request-id" : "5bcfdb47-5794-4bd1-a005-019264c02394" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotac0blobapitestsnapshotacfc362242e986e79e42", "javablobsnapshotac1blobapitestsnapshotacfc3453192654757" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[1].json new file mode 100644 index 000000000000..e7c4667403ef --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[1].json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac5dd9496863e7e4e411?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" : "2454d3af-4ff2-4d1f-929d-8e6a9e26e024" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561197F533D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca8119-301e-0042-3a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:45 GMT", + "x-ms-client-request-id" : "2454d3af-4ff2-4d1f-929d-8e6a9e26e024" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac5dd9496863e7e4e411/javablobsnapshotac1blobapitestsnapshotac5dd79318ddb0711", + "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" : "e3af86b7-a725-41e6-a459-53bd8344f083", + "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 20:05:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:45 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561198CEF47\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca812e-301e-0042-4e49-67cbbf000000", + "x-ms-client-request-id" : "e3af86b7-a725-41e6-a459-53bd8344f083" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac5dd9496863e7e4e411/javablobsnapshotac1blobapitestsnapshotac5dd79318ddb0711?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" : "d4e3d623-8ee9-4932-a1b7-6b741469380b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:05:45.3821661Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561198CEF47\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca813b-301e-0042-5b49-67cbbf000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:05:45 GMT", + "x-ms-client-request-id" : "d4e3d623-8ee9-4932-a1b7-6b741469380b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsnapshotac&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" : "008c9710-92c5-4f6e-9ddc-beefcc6122b8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca8157-301e-0042-7649-67cbbf000000", + "Body" : "jtcsnapshotacjtcsnapshotac0blobapitestsnapshotac5dd9496863e7e4e411Mon, 09 Sep 2019 20:05:45 GMT\"0x8D73561197F533D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:45 GMT", + "x-ms-client-request-id" : "008c9710-92c5-4f6e-9ddc-beefcc6122b8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac5dd9496863e7e4e411?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" : "90113c85-df26-442d-bb3f-72c6c8ed5746" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8160-301e-0042-7e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:45 GMT", + "x-ms-client-request-id" : "90113c85-df26-442d-bb3f-72c6c8ed5746" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotac0blobapitestsnapshotac5dd9496863e7e4e411", "javablobsnapshotac1blobapitestsnapshotac5dd79318ddb0711" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[2].json new file mode 100644 index 000000000000..87997c2bb706 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[2].json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotacd5d7561415b048ecff?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" : "1eeae72c-3135-4145-b430-3b3307a2b60c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356119C03885\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca816f-301e-0042-0b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:45 GMT", + "x-ms-client-request-id" : "1eeae72c-3135-4145-b430-3b3307a2b60c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotacd5d7561415b048ecff/javablobsnapshotac1blobapitestsnapshotacd5d42131874ff20", + "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" : "b47dc652-aaa3-44f4-a505-bf3422b5b155", + "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 20:05:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:45 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356119CE7107\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca8184-301e-0042-1e49-67cbbf000000", + "x-ms-client-request-id" : "b47dc652-aaa3-44f4-a505-bf3422b5b155" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotacd5d7561415b048ecff/javablobsnapshotac1blobapitestsnapshotacd5d42131874ff20?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" : "087ceb3c-1d3e-4d24-b7e5-aee10b7b2135" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:05:45.8084702Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356119CE7107\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca81a3-301e-0042-3d49-67cbbf000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:05:45 GMT", + "x-ms-client-request-id" : "087ceb3c-1d3e-4d24-b7e5-aee10b7b2135" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsnapshotac&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" : "8f5cb49f-722f-4e1b-8b88-69912144f86a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca81bc-301e-0042-5249-67cbbf000000", + "Body" : "jtcsnapshotacjtcsnapshotac0blobapitestsnapshotacd5d7561415b048ecffMon, 09 Sep 2019 20:05:45 GMT\"0x8D7356119C03885\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:45 GMT", + "x-ms-client-request-id" : "8f5cb49f-722f-4e1b-8b88-69912144f86a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotacd5d7561415b048ecff?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" : "01a63627-a3e3-4c56-9ad8-604381884a6a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca81da-301e-0042-6e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:45 GMT", + "x-ms-client-request-id" : "01a63627-a3e3-4c56-9ad8-604381884a6a" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotac0blobapitestsnapshotacd5d7561415b048ecff", "javablobsnapshotac1blobapitestsnapshotacd5d42131874ff20" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[3].json new file mode 100644 index 000000000000..9e18647f1b9f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[3].json @@ -0,0 +1,145 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac4f5330345acce6da89?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" : "7dd9bcf7-29e0-4c0b-bf4f-6614deee4d71" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611A038F42\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca81f6-301e-0042-0a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:45 GMT", + "x-ms-client-request-id" : "7dd9bcf7-29e0-4c0b-bf4f-6614deee4d71" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac4f5330345acce6da89/javablobsnapshotac1blobapitestsnapshotac4f568328b23e5c2", + "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" : "c43852ea-0ca5-4fcb-a9fb-d12930845ddd", + "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 20:05:46 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:46 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611A11A0BE\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca8216-301e-0042-2749-67cbbf000000", + "x-ms-client-request-id" : "c43852ea-0ca5-4fcb-a9fb-d12930845ddd" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac4f5330345acce6da89/javablobsnapshotac1blobapitestsnapshotac4f568328b23e5c2", + "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" : "9b94f653-d90f-4782-9bf1-5838ca196795" + }, + "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 20:05:46 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:05:46 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735611A11A0BE\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:46 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca822c-301e-0042-3d49-67cbbf000000", + "x-ms-client-request-id" : "9b94f653-d90f-4782-9bf1-5838ca196795", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac4f5330345acce6da89/javablobsnapshotac1blobapitestsnapshotac4f568328b23e5c2?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" : "adf296a8-dc1d-40e8-aae7-3e2572087f1f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:05:46.3348437Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611A11A0BE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca823e-301e-0042-4f49-67cbbf000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:05:46 GMT", + "x-ms-client-request-id" : "adf296a8-dc1d-40e8-aae7-3e2572087f1f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsnapshotac&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" : "e40b4658-c480-4584-b7c3-596e6c0e9c99" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca8257-301e-0042-6849-67cbbf000000", + "Body" : "jtcsnapshotacjtcsnapshotac0blobapitestsnapshotac4f5330345acce6da89Mon, 09 Sep 2019 20:05:46 GMT\"0x8D735611A038F42\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:46 GMT", + "x-ms-client-request-id" : "e40b4658-c480-4584-b7c3-596e6c0e9c99", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac4f5330345acce6da89?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" : "12435da6-4218-4431-bb3b-4a3ddbf809a3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca826f-301e-0042-7f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:46 GMT", + "x-ms-client-request-id" : "12435da6-4218-4431-bb3b-4a3ddbf809a3" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotac0blobapitestsnapshotac4f5330345acce6da89", "javablobsnapshotac1blobapitestsnapshotac4f568328b23e5c2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[4].json new file mode 100644 index 000000000000..fedad1a40763 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[4].json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotacfab145712b19c49d1f?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" : "fba94cef-2f5f-45e2-9768-daf95e129c01" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611A512107\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca8282-301e-0042-1249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:46 GMT", + "x-ms-client-request-id" : "fba94cef-2f5f-45e2-9768-daf95e129c01" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotacfab145712b19c49d1f/javablobsnapshotac1blobapitestsnapshotacfab762958d10e04", + "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" : "e68320fa-3104-49df-8298-87f6c9a67129", + "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 20:05:46 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:46 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611A5F0B89\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca829e-301e-0042-2c49-67cbbf000000", + "x-ms-client-request-id" : "e68320fa-3104-49df-8298-87f6c9a67129" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotacfab145712b19c49d1f/javablobsnapshotac1blobapitestsnapshotacfab762958d10e04?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" : "41abf506-dc56-4319-9f6c-1541dc2237b5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:05:46.7581446Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611A5F0B89\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca82c1-301e-0042-4c49-67cbbf000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:05:46 GMT", + "x-ms-client-request-id" : "41abf506-dc56-4319-9f6c-1541dc2237b5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsnapshotac&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" : "dec97679-241d-4c47-a234-6863d9588c02" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca82e2-301e-0042-6949-67cbbf000000", + "Body" : "jtcsnapshotacjtcsnapshotac0blobapitestsnapshotacfab145712b19c49d1fMon, 09 Sep 2019 20:05:46 GMT\"0x8D735611A512107\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:46 GMT", + "x-ms-client-request-id" : "dec97679-241d-4c47-a234-6863d9588c02", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotacfab145712b19c49d1f?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" : "80ac35fa-6518-4d88-94fd-6089a8b540e1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca82f5-301e-0042-7b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:46 GMT", + "x-ms-client-request-id" : "80ac35fa-6518-4d88-94fd-6089a8b540e1" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotac0blobapitestsnapshotacfab145712b19c49d1f", "javablobsnapshotac1blobapitestsnapshotacfab762958d10e04" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[5].json new file mode 100644 index 000000000000..57d93b9455d0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotac[5].json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac89184429fbd855f08d?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" : "3df5ba90-7bc7-4dd2-95b8-dd8d7b16aa37" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611A920653\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca8309-301e-0042-0f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:46 GMT", + "x-ms-client-request-id" : "3df5ba90-7bc7-4dd2-95b8-dd8d7b16aa37" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac89184429fbd855f08d/javablobsnapshotac1blobapitestsnapshotac8915040788ba07a", + "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" : "6fd15eed-6960-4a3a-88e8-39a7195b1bf0", + "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 20:05:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:46 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611A9FF0E8\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca8321-301e-0042-2649-67cbbf000000", + "x-ms-client-request-id" : "6fd15eed-6960-4a3a-88e8-39a7195b1bf0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac89184429fbd855f08d/javablobsnapshotac1blobapitestsnapshotac8915040788ba07a?comp=lease", + "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" : "6cf7c37e-0518-4413-b29d-118c12da4f81" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611A9FF0E8\"", + "x-ms-lease-id" : "92aa7532-ca58-48ed-b3fd-2935267b358d", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca832f-301e-0042-3349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:47 GMT", + "x-ms-client-request-id" : "6cf7c37e-0518-4413-b29d-118c12da4f81" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac89184429fbd855f08d/javablobsnapshotac1blobapitestsnapshotac8915040788ba07a?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" : "46479039-66a9-430f-a433-f1422a1bce15" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:05:47.2685076Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611A9FF0E8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca8341-301e-0042-4549-67cbbf000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:05:47 GMT", + "x-ms-client-request-id" : "46479039-66a9-430f-a433-f1422a1bce15" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsnapshotac&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" : "9d331ea6-2aa1-44e4-b35c-150b8e83714c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca8350-301e-0042-5249-67cbbf000000", + "Body" : "jtcsnapshotacjtcsnapshotac0blobapitestsnapshotac89184429fbd855f08dMon, 09 Sep 2019 20:05:47 GMT\"0x8D735611A920653\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:47 GMT", + "x-ms-client-request-id" : "9d331ea6-2aa1-44e4-b35c-150b8e83714c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotac0blobapitestsnapshotac89184429fbd855f08d?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" : "8cd1ae06-799f-4b09-871c-d0385ad66065" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8364-301e-0042-6449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:47 GMT", + "x-ms-client-request-id" : "8cd1ae06-799f-4b09-871c-d0385ad66065" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotac0blobapitestsnapshotac89184429fbd855f08d", "javablobsnapshotac1blobapitestsnapshotac8915040788ba07a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[0].json new file mode 100644 index 000000000000..dd316df9dd27 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[0].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfaile7410971e32746?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" : "815a02a2-6c01-4cd2-afaa-595e34a1c636" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611AE0829E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca8376-301e-0042-7649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:47 GMT", + "x-ms-client-request-id" : "815a02a2-6c01-4cd2-afaa-595e34a1c636" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfaile7410971e32746/javablobsnapshotacfail1blobapitestsnapshotacfaile740945308a", + "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" : "df3cd5e7-ccc9-434d-a6c3-296a0830b9ef", + "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 20:05:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:47 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611AED349E\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca8385-301e-0042-0449-67cbbf000000", + "x-ms-client-request-id" : "df3cd5e7-ccc9-434d-a6c3-296a0830b9ef" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfaile7410971e32746/javablobsnapshotacfail1blobapitestsnapshotacfaile740945308a?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" : "02c161d3-9dfd-46f3-91ac-cc159e8e7a61" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca839b-301e-0042-1749-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca839b-301e-0042-1749-67cbbf000000\nTime:2019-09-09T20:05:47.6936691Z", + "Date" : "Mon, 09 Sep 2019 20:05:47 GMT", + "x-ms-client-request-id" : "02c161d3-9dfd-46f3-91ac-cc159e8e7a61", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsnapshotacfail&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" : "a67162d6-85ba-4f37-a0e1-31ea6b7a58b2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca83b1-301e-0042-2c49-67cbbf000000", + "Body" : "jtcsnapshotacfailjtcsnapshotacfail0blobapitestsnapshotacfaile7410971e32746Mon, 09 Sep 2019 20:05:47 GMT\"0x8D735611AE0829E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:47 GMT", + "x-ms-client-request-id" : "a67162d6-85ba-4f37-a0e1-31ea6b7a58b2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfaile7410971e32746?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" : "87249091-dc2f-42f5-9e79-6c1341a85e5f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca83bd-301e-0042-3749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:47 GMT", + "x-ms-client-request-id" : "87249091-dc2f-42f5-9e79-6c1341a85e5f" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotacfail0blobapitestsnapshotacfaile7410971e32746", "javablobsnapshotacfail1blobapitestsnapshotacfaile740945308a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[1].json new file mode 100644 index 000000000000..553ddd9887a3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[1].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail4d31791604e990?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" : "dfccf463-8ccf-449e-a2ab-978d8ece28ce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611B222B60\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca83cd-301e-0042-4749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:47 GMT", + "x-ms-client-request-id" : "dfccf463-8ccf-449e-a2ab-978d8ece28ce" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail4d31791604e990/javablobsnapshotacfail1blobapitestsnapshotacfail4d384979a2b", + "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" : "f92208c9-25ca-42da-8552-fa01375cfead", + "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 20:05:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:47 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611B2F79CF\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca83e4-301e-0042-5949-67cbbf000000", + "x-ms-client-request-id" : "f92208c9-25ca-42da-8552-fa01375cfead" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail4d31791604e990/javablobsnapshotacfail1blobapitestsnapshotacfail4d384979a2b?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" : "a0227c50-c3c5-4f55-afeb-8756332dcd62" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca83fc-301e-0042-6e49-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca83fc-301e-0042-6e49-67cbbf000000\nTime:2019-09-09T20:05:48.1259738Z", + "Date" : "Mon, 09 Sep 2019 20:05:47 GMT", + "x-ms-client-request-id" : "a0227c50-c3c5-4f55-afeb-8756332dcd62", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsnapshotacfail&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" : "4414303b-d90f-47ca-9b7f-9aa077fde8e4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca8418-301e-0042-0849-67cbbf000000", + "Body" : "jtcsnapshotacfailjtcsnapshotacfail0blobapitestsnapshotacfail4d31791604e990Mon, 09 Sep 2019 20:05:47 GMT\"0x8D735611B222B60\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:48 GMT", + "x-ms-client-request-id" : "4414303b-d90f-47ca-9b7f-9aa077fde8e4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfail4d31791604e990?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" : "74845b48-cf12-4842-b13d-9e0f48caf9a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8424-301e-0042-1349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:48 GMT", + "x-ms-client-request-id" : "74845b48-cf12-4842-b13d-9e0f48caf9a4" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotacfail0blobapitestsnapshotacfail4d31791604e990", "javablobsnapshotacfail1blobapitestsnapshotacfail4d384979a2b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[2].json new file mode 100644 index 000000000000..7fc2c7050520 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[2].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfaild26995145b3aa0?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" : "7f8b9329-1dc0-4493-bc09-c79c9a2de0f6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611B647079\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca8441-301e-0042-2e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:48 GMT", + "x-ms-client-request-id" : "7f8b9329-1dc0-4493-bc09-c79c9a2de0f6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfaild26995145b3aa0/javablobsnapshotacfail1blobapitestsnapshotacfaild2683653423", + "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" : "1c3a880e-7ef1-45c8-8386-fa591cdf4705", + "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 20:05:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:48 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611B7197E7\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca845b-301e-0042-4349-67cbbf000000", + "x-ms-client-request-id" : "1c3a880e-7ef1-45c8-8386-fa591cdf4705" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfaild26995145b3aa0/javablobsnapshotacfail1blobapitestsnapshotacfaild2683653423?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" : "9aed4942-f993-47d8-a79d-7c448bab825a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca846e-301e-0042-5649-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca846e-301e-0042-5649-67cbbf000000\nTime:2019-09-09T20:05:48.5562776Z", + "Date" : "Mon, 09 Sep 2019 20:05:48 GMT", + "x-ms-client-request-id" : "9aed4942-f993-47d8-a79d-7c448bab825a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsnapshotacfail&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" : "3e910108-8f5b-46f0-8600-acafd767f98c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca8482-301e-0042-6a49-67cbbf000000", + "Body" : "jtcsnapshotacfailjtcsnapshotacfail0blobapitestsnapshotacfaild26995145b3aa0Mon, 09 Sep 2019 20:05:48 GMT\"0x8D735611B647079\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:48 GMT", + "x-ms-client-request-id" : "3e910108-8f5b-46f0-8600-acafd767f98c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfaild26995145b3aa0?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" : "eacb0d13-2305-490e-bb8b-d23fa5b2f18b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8495-301e-0042-7c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:48 GMT", + "x-ms-client-request-id" : "eacb0d13-2305-490e-bb8b-d23fa5b2f18b" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotacfail0blobapitestsnapshotacfaild26995145b3aa0", "javablobsnapshotacfail1blobapitestsnapshotacfaild2683653423" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[3].json new file mode 100644 index 000000000000..8dcf36c9d540 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[3].json @@ -0,0 +1,144 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfaila819434188046e?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" : "89d0e2df-adf5-4eb8-b581-97a5dc0d7434" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611BA68E7A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca84b7-301e-0042-1e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:48 GMT", + "x-ms-client-request-id" : "89d0e2df-adf5-4eb8-b581-97a5dc0d7434" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfaila819434188046e/javablobsnapshotacfail1blobapitestsnapshotacfaila81554133f1", + "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" : "7e872e4b-bffd-4d4c-b59a-aa65e4f262de", + "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 20:05:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:48 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611BB3DD1C\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca84d2-301e-0042-3849-67cbbf000000", + "x-ms-client-request-id" : "7e872e4b-bffd-4d4c-b59a-aa65e4f262de" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfaila819434188046e/javablobsnapshotacfail1blobapitestsnapshotacfaila81554133f1", + "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" : "5819c10b-7e99-46eb-ab89-b5d2f10a4e87" + }, + "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 20:05:48 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:05:48 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735611BB3DD1C\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:48 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca84ee-301e-0042-5349-67cbbf000000", + "x-ms-client-request-id" : "5819c10b-7e99-46eb-ab89-b5d2f10a4e87", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfaila819434188046e/javablobsnapshotacfail1blobapitestsnapshotacfaila81554133f1?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" : "f62203e4-3aad-42ad-b141-14509ed7ff74" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca8509-301e-0042-6d49-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca8509-301e-0042-6d49-67cbbf000000\nTime:2019-09-09T20:05:49.0726421Z", + "Date" : "Mon, 09 Sep 2019 20:05:48 GMT", + "x-ms-client-request-id" : "f62203e4-3aad-42ad-b141-14509ed7ff74", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsnapshotacfail&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" : "23744e48-df54-4753-8a0a-c75ff9ca9e47" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca851f-301e-0042-8049-67cbbf000000", + "Body" : "jtcsnapshotacfailjtcsnapshotacfail0blobapitestsnapshotacfaila819434188046eMon, 09 Sep 2019 20:05:48 GMT\"0x8D735611BA68E7A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:49 GMT", + "x-ms-client-request-id" : "23744e48-df54-4753-8a0a-c75ff9ca9e47", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfaila819434188046e?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" : "2afebb69-abcb-43e4-a16c-2699dcc09b08" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8534-301e-0042-1349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:49 GMT", + "x-ms-client-request-id" : "2afebb69-abcb-43e4-a16c-2699dcc09b08" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotacfail0blobapitestsnapshotacfaila819434188046e", "javablobsnapshotacfail1blobapitestsnapshotacfaila81554133f1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[4].json new file mode 100644 index 000000000000..4fedd9cf96f7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotacfail[4].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfaild5c65702327633?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" : "8e473214-bb38-4cf5-90d4-6bf90c3bb48c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611BF3AAF7\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca854b-301e-0042-2849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:49 GMT", + "x-ms-client-request-id" : "8e473214-bb38-4cf5-90d4-6bf90c3bb48c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfaild5c65702327633/javablobsnapshotacfail1blobapitestsnapshotacfaild5c39235ab6", + "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" : "ba83f615-e8f5-4c71-9abf-1e087eaa763d", + "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 20:05:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:49 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611C02326E\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca856f-301e-0042-4949-67cbbf000000", + "x-ms-client-request-id" : "ba83f615-e8f5-4c71-9abf-1e087eaa763d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfaild5c65702327633/javablobsnapshotacfail1blobapitestsnapshotacfaild5c39235ab6?comp=lease", + "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" : "53a6b3a1-1867-4a6a-bb2b-7e0ed3fb7e71" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611C02326E\"", + "x-ms-lease-id" : "b6c42528-4ab4-4f6f-9c24-897a9b049c4f", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca857e-301e-0042-5649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:49 GMT", + "x-ms-client-request-id" : "53a6b3a1-1867-4a6a-bb2b-7e0ed3fb7e71" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfaild5c65702327633/javablobsnapshotacfail1blobapitestsnapshotacfaild5c39235ab6?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" : "6dc70a5e-7b44-4149-9996-df20a61bf630" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca8591-301e-0042-6949-67cbbf000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:c5ca8591-301e-0042-6949-67cbbf000000\nTime:2019-09-09T20:05:49.5950113Z", + "Date" : "Mon, 09 Sep 2019 20:05:49 GMT", + "x-ms-client-request-id" : "6dc70a5e-7b44-4149-9996-df20a61bf630", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsnapshotacfail&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" : "0053cac2-e132-4035-9e3d-9cd57db6f55d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca85a1-301e-0042-7949-67cbbf000000", + "Body" : "jtcsnapshotacfailjtcsnapshotacfail0blobapitestsnapshotacfaild5c65702327633Mon, 09 Sep 2019 20:05:49 GMT\"0x8D735611BF3AAF7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:49 GMT", + "x-ms-client-request-id" : "0053cac2-e132-4035-9e3d-9cd57db6f55d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotacfail0blobapitestsnapshotacfaild5c65702327633?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" : "bb88a78f-0322-4b7e-a19e-591208debe25" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca85b9-301e-0042-1149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:49 GMT", + "x-ms-client-request-id" : "bb88a78f-0322-4b7e-a19e-591208debe25" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotacfail0blobapitestsnapshotacfaild5c65702327633", "javablobsnapshotacfail1blobapitestsnapshotacfaild5c39235ab6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshoterror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshoterror.json new file mode 100644 index 000000000000..299ed6f71bc1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshoterror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshoterror0blobapitestsnapshoterrorad245200cf4b846?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" : "edce4b55-504a-45ae-8700-3bb24bfe7b34" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735611C44BFD0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca85dc-301e-0042-3149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:49 GMT", + "x-ms-client-request-id" : "edce4b55-504a-45ae-8700-3bb24bfe7b34" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshoterror0blobapitestsnapshoterrorad245200cf4b846/javablobsnapshoterror1blobapitestsnapshoterrorad2300685c16", + "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" : "ddbe45fe-3f53-4c50-baa3-2fd6d28eef88", + "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 20:05:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:49 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735611C520EAA\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca85ed-301e-0042-4049-67cbbf000000", + "x-ms-client-request-id" : "ddbe45fe-3f53-4c50-baa3-2fd6d28eef88" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshoterror0blobapitestsnapshoterrorad245200cf4b846/javablobsnapshoterror2blobapitestsnapshoterrorad288917ebd1?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" : "47e93c0e-b02a-42ba-8cea-5179b7198822" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "BlobNotFound", + "retry-after" : "0", + "Content-Length" : "215", + "StatusCode" : "404", + "x-ms-request-id" : "c5ca860b-301e-0042-5c49-67cbbf000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:c5ca860b-301e-0042-5c49-67cbbf000000\nTime:2019-09-09T20:05:50.0293174Z", + "Date" : "Mon, 09 Sep 2019 20:05:49 GMT", + "x-ms-client-request-id" : "47e93c0e-b02a-42ba-8cea-5179b7198822", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsnapshoterror&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" : "9f02a568-96b7-4e5c-9210-a219166cb5a8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca8636-301e-0042-0549-67cbbf000000", + "Body" : "jtcsnapshoterrorjtcsnapshoterror0blobapitestsnapshoterrorad245200cf4b846Mon, 09 Sep 2019 20:05:49 GMT\"0x8D735611C44BFD0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:49 GMT", + "x-ms-client-request-id" : "9f02a568-96b7-4e5c-9210-a219166cb5a8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshoterror0blobapitestsnapshoterrorad245200cf4b846?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" : "7d886a45-9b04-4396-bfe4-e411b780ad52" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8648-301e-0042-1749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:50 GMT", + "x-ms-client-request-id" : "7d886a45-9b04-4396-bfe4-e411b780ad52" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshoterror0blobapitestsnapshoterrorad245200cf4b846", "javablobsnapshoterror1blobapitestsnapshoterrorad2300685c16", "javablobsnapshoterror2blobapitestsnapshoterrorad288917ebd1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotmetadata[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotmetadata[0].json new file mode 100644 index 000000000000..958d09581e74 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotmetadata[0].json @@ -0,0 +1,144 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadata390083852f82?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" : "57dc18e9-826f-4cf1-9617-05ef07da6103" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356118A3E6C3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7f3d-301e-0042-7c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:43 GMT", + "x-ms-client-request-id" : "57dc18e9-826f-4cf1-9617-05ef07da6103" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadata390083852f82/javablobsnapshotmetadata1blobapitestsnapshotmetadata39054423a", + "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" : "5d2eaa5d-497b-432d-b7b1-2216294d1604", + "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 20:05:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:43 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356118B10D3E\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca7f56-301e-0042-1349-67cbbf000000", + "x-ms-client-request-id" : "5d2eaa5d-497b-432d-b7b1-2216294d1604" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadata390083852f82/javablobsnapshotmetadata1blobapitestsnapshotmetadata39054423a?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" : "030ef81c-9e15-4bc4-94c4-61311ff7fa5b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:05:43.9441435Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356118B10D3E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7f6b-301e-0042-2849-67cbbf000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:05:43 GMT", + "x-ms-client-request-id" : "030ef81c-9e15-4bc4-94c4-61311ff7fa5b" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadata390083852f82/javablobsnapshotmetadata1blobapitestsnapshotmetadata39054423a?snapshot=2019-09-09T20%3a05%3a43.9441435Z", + "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" : "3dee5b41-6681-4b80-845c-995efe6b2b52" + }, + "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 20:05:43 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:05:43 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-09T20:05:43.9441435Z", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7356118B10D3E\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:43 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca7f7b-301e-0042-3649-67cbbf000000", + "x-ms-client-request-id" : "3dee5b41-6681-4b80-845c-995efe6b2b52", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsnapshotmetadata&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" : "279d689f-b25c-484a-8c44-1ddaf850bc13" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca7f99-301e-0042-4f49-67cbbf000000", + "Body" : "jtcsnapshotmetadatajtcsnapshotmetadata0blobapitestsnapshotmetadata390083852f82Mon, 09 Sep 2019 20:05:43 GMT\"0x8D7356118A3E6C3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:43 GMT", + "x-ms-client-request-id" : "279d689f-b25c-484a-8c44-1ddaf850bc13", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadata390083852f82?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" : "8e3f9ff8-2949-488e-809d-5027dd15eac0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca7fac-301e-0042-6149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:44 GMT", + "x-ms-client-request-id" : "8e3f9ff8-2949-488e-809d-5027dd15eac0" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotmetadata0blobapitestsnapshotmetadata390083852f82", "javablobsnapshotmetadata1blobapitestsnapshotmetadata39054423a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotmetadata[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotmetadata[1].json new file mode 100644 index 000000000000..f86bcea6af1f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotmetadata[1].json @@ -0,0 +1,146 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadatad61875095b60?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" : "696d4ba8-fd64-484f-8fbd-ab54b36c7d24" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356118F1EDCF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca7fd2-301e-0042-0349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:44 GMT", + "x-ms-client-request-id" : "696d4ba8-fd64-484f-8fbd-ab54b36c7d24" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadatad61875095b60/javablobsnapshotmetadata1blobapitestsnapshotmetadatad61754319", + "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" : "d6dcbe76-5fe4-4900-8c46-bd2f5212e9f7", + "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 20:05:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:44 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356118FE7809\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca7ff2-301e-0042-2249-67cbbf000000", + "x-ms-client-request-id" : "d6dcbe76-5fe4-4900-8c46-bd2f5212e9f7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadatad61875095b60/javablobsnapshotmetadata1blobapitestsnapshotmetadatad61754319?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" : "19bd3fc7-c182-40d6-ad9c-c23668d04485" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:05:44.4455004Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561190AD65C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:05:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca801e-301e-0042-4d49-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:05:44 GMT", + "x-ms-client-request-id" : "19bd3fc7-c182-40d6-ad9c-c23668d04485" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadatad61875095b60/javablobsnapshotmetadata1blobapitestsnapshotmetadatad61754319?snapshot=2019-09-09T20%3a05%3a44.4455004Z", + "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" : "63076200-9ce6-46b6-afef-d904b3d439c6" + }, + "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 20:05:44 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:05:44 GMT", + "x-ms-meta-foo" : "bar", + "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-09T20:05:44.4455004Z", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561190AD65C\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:05:44 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca804b-301e-0042-7849-67cbbf000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "63076200-9ce6-46b6-afef-d904b3d439c6", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsnapshotmetadata&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" : "7969cd64-ce11-4380-a3de-96d0ab523a4a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca8069-301e-0042-1549-67cbbf000000", + "Body" : "jtcsnapshotmetadatajtcsnapshotmetadata0blobapitestsnapshotmetadatad61875095b60Mon, 09 Sep 2019 20:05:44 GMT\"0x8D7356118F1EDCF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:05:44 GMT", + "x-ms-client-request-id" : "7969cd64-ce11-4380-a3de-96d0ab523a4a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotmetadata0blobapitestsnapshotmetadatad61875095b60?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" : "81e4664d-ca78-4eed-81be-61997714080f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca8078-301e-0042-2449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:05:44 GMT", + "x-ms-client-request-id" : "81e4664d-ca78-4eed-81be-61997714080f" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotmetadata0blobapitestsnapshotmetadatad61875095b60", "javablobsnapshotmetadata1blobapitestsnapshotmetadatad61754319" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotmin.json new file mode 100644 index 000000000000..ae62b3728335 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsnapshotmin.json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmin0blobapitestsnapshotminaa696761771d3a006?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7274039EE2189\"", + "Last-Modified" : "Thu, 22 Aug 2019 20:35:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "25b246a2-f01e-012c-4229-59f41e000000", + "Date" : "Thu, 22 Aug 2019 20:35:09 GMT", + "x-ms-client-request-id" : "3aa1df2f-7795-4925-8b5d-b75046e5258e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmin0blobapitestsnapshotminaa696761771d3a006/javablobsnapshotmin1blobapitestsnapshotminaa617559a367db", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "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" : "Thu, 22 Aug 2019 20:35:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Thu, 22 Aug 2019 20:35:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7274039F46B09\"", + "Content-Length" : "0", + "x-ms-request-id" : "25b246ea-f01e-012c-0629-59f41e000000", + "x-ms-client-request-id" : "f8e59c2b-ce4c-48f9-868f-289ef08b5e22" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmin0blobapitestsnapshotminaa696761771d3a006/javablobsnapshotmin1blobapitestsnapshotminaa617559a367db?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-22T20:35:10.0564843Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7274039F46B09\"", + "Last-Modified" : "Thu, 22 Aug 2019 20:35:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "25b24760-f01e-012c-7529-59f41e000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Thu, 22 Aug 2019 20:35:09 GMT", + "x-ms-client-request-id" : "f67f3a12-978b-4f85-bfa8-8aa5c6d43c00" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcsnapshotmin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "25b247a3-f01e-012c-3429-59f41e000000", + "Body" : "jtcsnapshotminjtcsnapshotmin0blobapitestsnapshotminaa696761771d3a006Thu, 22 Aug 2019 20:35:09 GMT\"0x8D7274039EE2189\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Thu, 22 Aug 2019 20:35:09 GMT", + "x-ms-client-request-id" : "d40323ea-6729-4ded-95da-08637c44a2a1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcsnapshotmin0blobapitestsnapshotminaa696761771d3a006?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "25b247cc-f01e-012c-5c29-59f41e000000", + "Date" : "Thu, 22 Aug 2019 20:35:09 GMT", + "x-ms-client-request-id" : "85570c32-fc9c-4909-b8f8-7ef462d9dc2c" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotmin0blobapitestsnapshotminaa696761771d3a006", "javablobsnapshotmin1blobapitestsnapshotminaa617559a367db" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopy.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopy.json new file mode 100644 index 000000000000..12f58cf7da91 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopy.json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopy0blobapitestsynccopy0fe365023108bde8b5d1?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" : "7878654e-6639-423f-abef-ec4d61902ade" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356128700BEA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca9a8e-301e-0042-754a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:10 GMT", + "x-ms-client-request-id" : "7878654e-6639-423f-abef-ec4d61902ade" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopy0blobapitestsynccopy0fe365023108bde8b5d1/javablobsynccopy1blobapitestsynccopy0fe417446ab81612d", + "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" : "b88bf05c-50f4-4480-81cd-4a4db3bd9323", + "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 20:06:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:10 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561287CE9C6\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca9aa3-301e-0042-094a-67cbbf000000", + "x-ms-client-request-id" : "b88bf05c-50f4-4480-81cd-4a4db3bd9323" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopy0blobapitestsynccopy0fe365023108bde8b5d1?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" : "b21dd0f8-3d2e-4fb2-9c10-cd32060de293", + "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" : "\"0x8D735612889409D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9aba-301e-0042-1e4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:10 GMT", + "x-ms-client-request-id" : "b21dd0f8-3d2e-4fb2-9c10-cd32060de293" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopy0blobapitestsynccopy0fe365023108bde8b5d1/javablobsynccopy2blobapitestsynccopy0fe181484d693ba74", + "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" : "3ee3b690-f01c-4220-a8c2-fc82a08dda1a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "be2b5e40-3e6a-46e0-967d-3f176f235166", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:10 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Mon, 09 Sep 2019 20:06:10 GMT", + "ETag" : "\"0x8D7356128A1851A\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "c5ca9acf-301e-0042-324a-67cbbf000000", + "x-ms-client-request-id" : "3ee3b690-f01c-4220-a8c2-fc82a08dda1a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopy&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" : "bba67033-8598-4326-99b0-a4b3b3d99d3c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9b07-301e-0042-624a-67cbbf000000", + "Body" : "jtcsynccopyjtcsynccopy0blobapitestsynccopy0fe365023108bde8b5d1Mon, 09 Sep 2019 20:06:10 GMT\"0x8D735612889409D\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:10 GMT", + "x-ms-client-request-id" : "bba67033-8598-4326-99b0-a4b3b3d99d3c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopy0blobapitestsynccopy0fe365023108bde8b5d1?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" : "f4b3449c-4c8c-4525-b86c-dc84a41a5806" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca9b1c-301e-0042-764a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:10 GMT", + "x-ms-client-request-id" : "f4b3449c-4c8c-4525-b86c-dc84a41a5806" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopy0blobapitestsynccopy0fe365023108bde8b5d1", "javablobsynccopy1blobapitestsynccopy0fe417446ab81612d", "javablobsynccopy2blobapitestsynccopy0fe181484d693ba74" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[0].json new file mode 100644 index 000000000000..c4c53aa10d78 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[0].json @@ -0,0 +1,161 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacaa181457f3593a?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" : "d08c6cbe-c5e9-46c6-a2ea-df8f575a26d7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735612CC69A2D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caa1f3-301e-0042-234a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:17 GMT", + "x-ms-client-request-id" : "d08c6cbe-c5e9-46c6-a2ea-df8f575a26d7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacaa181457f3593a/javablobsynccopydestac1blobapitestsynccopydestacaa1471622a6", + "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" : "a41de7d1-7fd8-45fa-b8ad-b2776cd2071a", + "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 20:06:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:17 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612CD4B23F\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa206-301e-0042-324a-67cbbf000000", + "x-ms-client-request-id" : "a41de7d1-7fd8-45fa-b8ad-b2776cd2071a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacaa181457f3593a?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" : "276d326f-50ca-454e-a89b-d4c74197620e", + "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" : "\"0x8D735612CE17EAD\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa220-301e-0042-484a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:17 GMT", + "x-ms-client-request-id" : "276d326f-50ca-454e-a89b-d4c74197620e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacaa181457f3593a/javablobsynccopydestac2blobapitestsynccopydestacaa1604223b7", + "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" : "aa3f41ee-4a8c-4de1-8bbf-c40addbf2ef0", + "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 20:06:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:17 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612CEEA7A2\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa239-301e-0042-604a-67cbbf000000", + "x-ms-client-request-id" : "aa3f41ee-4a8c-4de1-8bbf-c40addbf2ef0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacaa181457f3593a/javablobsynccopydestac2blobapitestsynccopydestacaa1604223b7", + "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" : "1ba892bb-1c34-4a50-9841-7001c0c958ce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "17e21750-fa6a-43dc-af8e-5872e91ff5d6", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:17 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Mon, 09 Sep 2019 20:06:17 GMT", + "ETag" : "\"0x8D735612CFD1D54\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "c5caa24f-301e-0042-744a-67cbbf000000", + "x-ms-client-request-id" : "1ba892bb-1c34-4a50-9841-7001c0c958ce" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopydestac&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" : "3f7557bd-dff7-498c-b53e-8cd665ae4da6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa264-301e-0042-084a-67cbbf000000", + "Body" : "jtcsynccopydestacjtcsynccopydestac0blobapitestsynccopydestacaa181457f3593aMon, 09 Sep 2019 20:06:17 GMT\"0x8D735612CE17EAD\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:17 GMT", + "x-ms-client-request-id" : "3f7557bd-dff7-498c-b53e-8cd665ae4da6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestacaa181457f3593a?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" : "77eb9c49-9f36-4ee2-acbf-48ea766399f1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caa27f-301e-0042-1e4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:17 GMT", + "x-ms-client-request-id" : "77eb9c49-9f36-4ee2-acbf-48ea766399f1" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestac0blobapitestsynccopydestacaa181457f3593a", "javablobsynccopydestac1blobapitestsynccopydestacaa1471622a6", "javablobsynccopydestac2blobapitestsynccopydestacaa1604223b7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[1].json new file mode 100644 index 000000000000..e53d5c05f979 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[1].json @@ -0,0 +1,161 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac122064545d8b55?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" : "c6017e2e-ed30-481e-9d84-682e596d909b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735612D24D0C1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caa298-301e-0042-334a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:17 GMT", + "x-ms-client-request-id" : "c6017e2e-ed30-481e-9d84-682e596d909b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac122064545d8b55/javablobsynccopydestac1blobapitestsynccopydestac12275084a70", + "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" : "b8993b26-f6e4-4f35-baa6-257395f7469b", + "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 20:06:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612D31D75D\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa2a9-301e-0042-424a-67cbbf000000", + "x-ms-client-request-id" : "b8993b26-f6e4-4f35-baa6-257395f7469b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac122064545d8b55?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" : "d2182e18-6dd6-489a-b18b-4c84bce5a61e", + "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" : "\"0x8D735612D3E078F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa2c0-301e-0042-594a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:18 GMT", + "x-ms-client-request-id" : "d2182e18-6dd6-489a-b18b-4c84bce5a61e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac122064545d8b55/javablobsynccopydestac2blobapitestsynccopydestac12208540f76", + "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" : "a2751895-eb32-4bbe-9f13-14ae15be47fa", + "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 20:06:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612D4ABB0A\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa2d5-301e-0042-6e4a-67cbbf000000", + "x-ms-client-request-id" : "a2751895-eb32-4bbe-9f13-14ae15be47fa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac122064545d8b55/javablobsynccopydestac2blobapitestsynccopydestac12208540f76", + "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" : "3de027e4-4136-4531-b1e0-30866c15642f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "fc125166-0fcc-4da5-9400-99392830b7cb", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:18 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Mon, 09 Sep 2019 20:06:18 GMT", + "ETag" : "\"0x8D735612D5D5017\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "c5caa2e7-301e-0042-7e4a-67cbbf000000", + "x-ms-client-request-id" : "3de027e4-4136-4531-b1e0-30866c15642f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopydestac&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" : "8c44031e-5edc-41ed-bdc5-4a5ae4c04431" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa305-301e-0042-1a4a-67cbbf000000", + "Body" : "jtcsynccopydestacjtcsynccopydestac0blobapitestsynccopydestac122064545d8b55Mon, 09 Sep 2019 20:06:18 GMT\"0x8D735612D3E078F\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:18 GMT", + "x-ms-client-request-id" : "8c44031e-5edc-41ed-bdc5-4a5ae4c04431", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac122064545d8b55?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" : "f551025b-91c8-44b9-b4ae-a86e337892b8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caa326-301e-0042-354a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:18 GMT", + "x-ms-client-request-id" : "f551025b-91c8-44b9-b4ae-a86e337892b8" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestac0blobapitestsynccopydestac122064545d8b55", "javablobsynccopydestac1blobapitestsynccopydestac12275084a70", "javablobsynccopydestac2blobapitestsynccopydestac12208540f76" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[2].json new file mode 100644 index 000000000000..9caf94614020 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[2].json @@ -0,0 +1,161 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestaca4022774c7a8fa?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" : "a64ca95a-5a13-4253-a654-f47db36cb719" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735612D866355\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caa33f-301e-0042-4a4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:18 GMT", + "x-ms-client-request-id" : "a64ca95a-5a13-4253-a654-f47db36cb719" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestaca4022774c7a8fa/javablobsynccopydestac1blobapitestsynccopydestaca407739069f", + "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" : "fe67fea2-83da-4f68-96ad-b217862ebe91", + "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 20:06:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612D936A06\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa35e-301e-0042-664a-67cbbf000000", + "x-ms-client-request-id" : "fe67fea2-83da-4f68-96ad-b217862ebe91" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestaca4022774c7a8fa?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" : "6dc8b2d8-a1ce-4737-bf01-c611d5d1b943", + "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" : "\"0x8D735612D9FC168\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa36f-301e-0042-754a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:18 GMT", + "x-ms-client-request-id" : "6dc8b2d8-a1ce-4737-bf01-c611d5d1b943" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestaca4022774c7a8fa/javablobsynccopydestac2blobapitestsynccopydestaca4047583da5", + "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" : "acff7293-203e-48db-b88c-4a21c86e49eb", + "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 20:06:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612DAC74DA\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa383-301e-0042-064a-67cbbf000000", + "x-ms-client-request-id" : "acff7293-203e-48db-b88c-4a21c86e49eb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestaca4022774c7a8fa/javablobsynccopydestac2blobapitestsynccopydestaca4047583da5", + "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" : "adaa033b-81ae-453b-835f-94bfd047361c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "b3df20b7-16f5-4640-8244-41e7ce72e6ca", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:19 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Mon, 09 Sep 2019 20:06:18 GMT", + "ETag" : "\"0x8D735612DBB86AB\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "c5caa3a0-301e-0042-204a-67cbbf000000", + "x-ms-client-request-id" : "adaa033b-81ae-453b-835f-94bfd047361c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopydestac&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" : "7da210e0-745e-41ad-9569-e2632744eb7f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa3b3-301e-0042-324a-67cbbf000000", + "Body" : "jtcsynccopydestacjtcsynccopydestac0blobapitestsynccopydestaca4022774c7a8faMon, 09 Sep 2019 20:06:18 GMT\"0x8D735612D9FC168\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:19 GMT", + "x-ms-client-request-id" : "7da210e0-745e-41ad-9569-e2632744eb7f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestaca4022774c7a8fa?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" : "0ef3caac-8ae8-4162-bf98-6b783b15cee0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caa3bf-301e-0042-3e4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:19 GMT", + "x-ms-client-request-id" : "0ef3caac-8ae8-4162-bf98-6b783b15cee0" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestac0blobapitestsynccopydestaca4022774c7a8fa", "javablobsynccopydestac1blobapitestsynccopydestaca407739069f", "javablobsynccopydestac2blobapitestsynccopydestaca4047583da5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[3].json new file mode 100644 index 000000000000..8db08ee75602 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[3].json @@ -0,0 +1,193 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestace1739524affb56?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" : "4ef07a2c-5ef8-4688-a367-b038c3b04902" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735612DE424A2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caa3d3-301e-0042-4f4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:19 GMT", + "x-ms-client-request-id" : "4ef07a2c-5ef8-4688-a367-b038c3b04902" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestace1739524affb56/javablobsynccopydestac1blobapitestsynccopydestace17694628df", + "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" : "0025f3ca-4b59-49d5-ab2c-7b3e3ee13416", + "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 20:06:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612DF1EEEE\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa3ee-301e-0042-674a-67cbbf000000", + "x-ms-client-request-id" : "0025f3ca-4b59-49d5-ab2c-7b3e3ee13416" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestace1739524affb56?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" : "e6cf00dc-001c-4c8e-997a-2397d7e38251", + "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" : "\"0x8D735612DFE9483\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa3fd-301e-0042-764a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:19 GMT", + "x-ms-client-request-id" : "e6cf00dc-001c-4c8e-997a-2397d7e38251" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestace1739524affb56/javablobsynccopydestac2blobapitestsynccopydestace17210087e6", + "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" : "707d4185-8b18-47ed-b8a5-90df6810bc2d", + "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 20:06:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612E0B47E8\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa40f-301e-0042-064a-67cbbf000000", + "x-ms-client-request-id" : "707d4185-8b18-47ed-b8a5-90df6810bc2d" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestace1739524affb56/javablobsynccopydestac2blobapitestsynccopydestace17210087e6", + "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" : "a37cfa2d-8284-4b0d-91b3-187fda61c3e4" + }, + "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 20:06:19 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:06:19 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735612E0B47E8\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:19 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5caa42d-301e-0042-1f4a-67cbbf000000", + "x-ms-client-request-id" : "a37cfa2d-8284-4b0d-91b3-187fda61c3e4", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestace1739524affb56/javablobsynccopydestac2blobapitestsynccopydestace17210087e6", + "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" : "c0412170-209f-463c-8cb4-614d7f909a5c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "ad8d705b-06ef-4624-ab9d-523d6fb2f1d2", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:19 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Mon, 09 Sep 2019 20:06:19 GMT", + "ETag" : "\"0x8D735612E2690D5\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "c5caa443-301e-0042-324a-67cbbf000000", + "x-ms-client-request-id" : "c0412170-209f-463c-8cb4-614d7f909a5c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopydestac&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" : "445b847f-0e53-4b32-9483-efaf3dd69a2d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa453-301e-0042-424a-67cbbf000000", + "Body" : "jtcsynccopydestacjtcsynccopydestac0blobapitestsynccopydestace1739524affb56Mon, 09 Sep 2019 20:06:19 GMT\"0x8D735612DFE9483\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:19 GMT", + "x-ms-client-request-id" : "445b847f-0e53-4b32-9483-efaf3dd69a2d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestace1739524affb56?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" : "4b9bb267-8c27-4ba0-99db-c6c97d3a90b2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caa461-301e-0042-4f4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:19 GMT", + "x-ms-client-request-id" : "4b9bb267-8c27-4ba0-99db-c6c97d3a90b2" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestac0blobapitestsynccopydestace1739524affb56", "javablobsynccopydestac1blobapitestsynccopydestace17694628df", "javablobsynccopydestac2blobapitestsynccopydestace17210087e6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[4].json new file mode 100644 index 000000000000..387ca3bdc537 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[4].json @@ -0,0 +1,161 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac430553290ab654?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" : "2aaef940-fc0b-4fcb-a3a1-2528efc0521b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735612E4C20FF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caa47b-301e-0042-624a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:19 GMT", + "x-ms-client-request-id" : "2aaef940-fc0b-4fcb-a3a1-2528efc0521b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac430553290ab654/javablobsynccopydestac1blobapitestsynccopydestac43053530353", + "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" : "557bc0fe-3817-4d1c-add0-672f1704f231", + "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 20:06:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612E5A1285\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa48e-301e-0042-734a-67cbbf000000", + "x-ms-client-request-id" : "557bc0fe-3817-4d1c-add0-672f1704f231" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac430553290ab654?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" : "26b7da2c-fd1e-48f1-9732-c8fedfe9ecdb", + "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" : "\"0x8D735612E6669EF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa4a2-301e-0042-064a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:20 GMT", + "x-ms-client-request-id" : "26b7da2c-fd1e-48f1-9732-c8fedfe9ecdb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac430553290ab654/javablobsynccopydestac2blobapitestsynccopydestac43097143069", + "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" : "20df3975-12b3-4b6a-b23e-ff988ca24be9", + "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 20:06:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612E747D22\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa4b1-301e-0042-144a-67cbbf000000", + "x-ms-client-request-id" : "20df3975-12b3-4b6a-b23e-ff988ca24be9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac430553290ab654/javablobsynccopydestac2blobapitestsynccopydestac43097143069", + "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" : "c6b32846-348e-4712-b30f-df15cc043bdb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "b616000a-a915-4100-89e5-72630843bd01", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:20 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Mon, 09 Sep 2019 20:06:20 GMT", + "ETag" : "\"0x8D735612E834083\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "c5caa4c3-301e-0042-254a-67cbbf000000", + "x-ms-client-request-id" : "c6b32846-348e-4712-b30f-df15cc043bdb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopydestac&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" : "fc868e73-f891-435b-983e-f301778409fc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa4de-301e-0042-3e4a-67cbbf000000", + "Body" : "jtcsynccopydestacjtcsynccopydestac0blobapitestsynccopydestac430553290ab654Mon, 09 Sep 2019 20:06:20 GMT\"0x8D735612E6669EF\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:20 GMT", + "x-ms-client-request-id" : "fc868e73-f891-435b-983e-f301778409fc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac430553290ab654?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" : "901dda77-d566-409a-aa44-0b874a30cf90" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caa4f6-301e-0042-544a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:20 GMT", + "x-ms-client-request-id" : "901dda77-d566-409a-aa44-0b874a30cf90" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestac0blobapitestsynccopydestac430553290ab654", "javablobsynccopydestac1blobapitestsynccopydestac43053530353", "javablobsynccopydestac2blobapitestsynccopydestac43097143069" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[5].json new file mode 100644 index 000000000000..e6956954bf9a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestac[5].json @@ -0,0 +1,183 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac9b15352408def6?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" : "8edb6d77-d44f-4e1a-a8f8-e42a0bd93b7b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735612EACA1FD\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caa506-301e-0042-634a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:20 GMT", + "x-ms-client-request-id" : "8edb6d77-d44f-4e1a-a8f8-e42a0bd93b7b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac9b15352408def6/javablobsynccopydestac1blobapitestsynccopydestac9b11275953c", + "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" : "f05d9bb3-3611-49ad-9f2a-777f0ef1bd7c", + "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 20:06:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612EBA9397\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa519-301e-0042-744a-67cbbf000000", + "x-ms-client-request-id" : "f05d9bb3-3611-49ad-9f2a-777f0ef1bd7c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac9b15352408def6?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" : "09b82b04-da71-4727-9e0d-c7eb7a82b2fc", + "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" : "\"0x8D735612EC6C3E4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa52f-301e-0042-094a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:20 GMT", + "x-ms-client-request-id" : "09b82b04-da71-4727-9e0d-c7eb7a82b2fc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac9b15352408def6/javablobsynccopydestac2blobapitestsynccopydestac9b167632593", + "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" : "14b28396-61c5-47ab-a116-b542f686d0b0", + "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 20:06:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612ED35038\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa53f-301e-0042-184a-67cbbf000000", + "x-ms-client-request-id" : "14b28396-61c5-47ab-a116-b542f686d0b0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac9b15352408def6/javablobsynccopydestac2blobapitestsynccopydestac9b167632593?comp=lease", + "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" : "86cbd037-ba0e-4fc9-b8a1-07351928d779" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735612ED35038\"", + "x-ms-lease-id" : "3a9efda0-8119-48c3-8178-8c1cac3964cf", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caa55d-301e-0042-354a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:20 GMT", + "x-ms-client-request-id" : "86cbd037-ba0e-4fc9-b8a1-07351928d779" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac9b15352408def6/javablobsynccopydestac2blobapitestsynccopydestac9b167632593", + "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" : "c885a1e2-09a2-4a66-8ddf-1454ba619405" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "c318520a-077a-4489-a640-842b58be320e", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:21 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Mon, 09 Sep 2019 20:06:20 GMT", + "ETag" : "\"0x8D735612EF24305\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "c5caa56a-301e-0042-424a-67cbbf000000", + "x-ms-client-request-id" : "c885a1e2-09a2-4a66-8ddf-1454ba619405" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopydestac&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" : "607c28ee-1812-489c-b2f6-3b7f83bea1fa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa589-301e-0042-5d4a-67cbbf000000", + "Body" : "jtcsynccopydestacjtcsynccopydestac0blobapitestsynccopydestac9b15352408def6Mon, 09 Sep 2019 20:06:20 GMT\"0x8D735612EC6C3E4\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:21 GMT", + "x-ms-client-request-id" : "607c28ee-1812-489c-b2f6-3b7f83bea1fa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestac0blobapitestsynccopydestac9b15352408def6?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" : "90c9ba5c-c0ee-480b-b3fd-2a2537ae290c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caa59d-301e-0042-6e4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:21 GMT", + "x-ms-client-request-id" : "90c9ba5c-c0ee-480b-b3fd-2a2537ae290c" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestac0blobapitestsynccopydestac9b15352408def6", "javablobsynccopydestac1blobapitestsynccopydestac9b11275953c", "javablobsynccopydestac2blobapitestsynccopydestac9b167632593" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[0].json new file mode 100644 index 000000000000..522e4e65f18e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[0].json @@ -0,0 +1,159 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail6f399185e3?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" : "e7d0370e-94c3-4795-aa6e-66291eaa6bb2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735612F1A6BB9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caa5b0-301e-0042-7f4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:21 GMT", + "x-ms-client-request-id" : "e7d0370e-94c3-4795-aa6e-66291eaa6bb2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail6f399185e3/javablobsynccopydestacfail13484654fc004f4043445", + "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" : "eb0bdac6-821f-4eb4-be69-c942ec3c1b46", + "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 20:06:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612F285D87\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa5c5-301e-0042-114a-67cbbf000000", + "x-ms-client-request-id" : "eb0bdac6-821f-4eb4-be69-c942ec3c1b46" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail6f399185e3?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" : "3d5249a2-ea79-4f30-b0de-3f8157a1cad1", + "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" : "\"0x8D735612F35031D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa5d8-301e-0042-244a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:21 GMT", + "x-ms-client-request-id" : "3d5249a2-ea79-4f30-b0de-3f8157a1cad1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail6f399185e3/javablobsynccopydestacfail217942fa5214784dbb497", + "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" : "11b89cf0-c50f-46db-afbe-d42582c2b521", + "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 20:06:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612F4252E1\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa5ec-301e-0042-364a-67cbbf000000", + "x-ms-client-request-id" : "11b89cf0-c50f-46db-afbe-d42582c2b521" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail6f399185e3/javablobsynccopydestacfail217942fa5214784dbb497", + "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" : "5451a445-c696-4644-b488-be053aad887f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5caa5fe-301e-0042-474a-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5caa5fe-301e-0042-474a-67cbbf000000\nTime:2019-09-09T20:06:21.8147552Z", + "Date" : "Mon, 09 Sep 2019 20:06:21 GMT", + "x-ms-client-request-id" : "5451a445-c696-4644-b488-be053aad887f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopydestacfail&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" : "1c21ace7-5cf0-49ae-9021-a703871da44b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa619-301e-0042-5f4a-67cbbf000000", + "Body" : "jtcsynccopydestacfailjtcsynccopydestacfail0blobapitestsynccopydestacfail6f399185e3Mon, 09 Sep 2019 20:06:21 GMT\"0x8D735612F35031D\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:21 GMT", + "x-ms-client-request-id" : "1c21ace7-5cf0-49ae-9021-a703871da44b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail6f399185e3?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" : "55f174c9-332b-4694-a2b0-e6c8d6af57da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caa638-301e-0042-7b4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:21 GMT", + "x-ms-client-request-id" : "55f174c9-332b-4694-a2b0-e6c8d6af57da" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestacfail0blobapitestsynccopydestacfail6f399185e3", "javablobsynccopydestacfail13484654fc004f4043445", "javablobsynccopydestacfail217942fa5214784dbb497" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[1].json new file mode 100644 index 000000000000..c38bc47ffd0d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[1].json @@ -0,0 +1,159 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail7fd76815d0?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" : "c9c97438-3e04-4220-8357-dfb4dfb8cb8e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735612F75E2BB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caa64d-301e-0042-0e4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:21 GMT", + "x-ms-client-request-id" : "c9c97438-3e04-4220-8357-dfb4dfb8cb8e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail7fd76815d0/javablobsynccopydestacfail158178e6b1dbed780d431", + "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" : "47ae8383-2b95-4dcc-8afd-f3460fcc1aae", + "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 20:06:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612F824DB5\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa66f-301e-0042-2c4a-67cbbf000000", + "x-ms-client-request-id" : "47ae8383-2b95-4dcc-8afd-f3460fcc1aae" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail7fd76815d0?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" : "c302eb55-15d8-46d6-8dd7-32d7915e234d", + "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" : "\"0x8D735612F8E5716\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa686-301e-0042-404a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:22 GMT", + "x-ms-client-request-id" : "c302eb55-15d8-46d6-8dd7-32d7915e234d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail7fd76815d0/javablobsynccopydestacfail240213b2672aa4d6ea480", + "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" : "b18ffa11-4d65-4684-becd-13e03c2808e4", + "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 20:06:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612F9B5884\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa69f-301e-0042-574a-67cbbf000000", + "x-ms-client-request-id" : "b18ffa11-4d65-4684-becd-13e03c2808e4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail7fd76815d0/javablobsynccopydestacfail240213b2672aa4d6ea480", + "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" : "78d9ba5a-8e99-40fd-9d47-88ea7006f0ce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5caa6b8-301e-0042-704a-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5caa6b8-301e-0042-704a-67cbbf000000\nTime:2019-09-09T20:06:22.3961659Z", + "Date" : "Mon, 09 Sep 2019 20:06:22 GMT", + "x-ms-client-request-id" : "78d9ba5a-8e99-40fd-9d47-88ea7006f0ce", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopydestacfail&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" : "a0eb4366-7c03-46fd-b994-8f29c136fceb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa6cd-301e-0042-034a-67cbbf000000", + "Body" : "jtcsynccopydestacfailjtcsynccopydestacfail0blobapitestsynccopydestacfail7fd76815d0Mon, 09 Sep 2019 20:06:22 GMT\"0x8D735612F8E5716\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:22 GMT", + "x-ms-client-request-id" : "a0eb4366-7c03-46fd-b994-8f29c136fceb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail7fd76815d0?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" : "8f4833cd-ca6c-42ba-b2ad-db002edb54dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caa6e4-301e-0042-184a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:22 GMT", + "x-ms-client-request-id" : "8f4833cd-ca6c-42ba-b2ad-db002edb54dc" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestacfail0blobapitestsynccopydestacfail7fd76815d0", "javablobsynccopydestacfail158178e6b1dbed780d431", "javablobsynccopydestacfail240213b2672aa4d6ea480" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[2].json new file mode 100644 index 000000000000..d5be7b104991 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[2].json @@ -0,0 +1,159 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail2d43554736?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" : "1f3f0278-9f6b-445f-b397-920ea0f0ab2c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735612FCEE832\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caa6f9-301e-0042-2d4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:22 GMT", + "x-ms-client-request-id" : "1f3f0278-9f6b-445f-b397-920ea0f0ab2c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail2d43554736/javablobsynccopydestacfail15591383dd560c9add477", + "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" : "d082e4a1-d054-4120-9bf1-4b3015d563cb", + "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 20:06:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612FDCB32B\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa715-301e-0042-464a-67cbbf000000", + "x-ms-client-request-id" : "d082e4a1-d054-4120-9bf1-4b3015d563cb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail2d43554736?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" : "d43609a1-00d2-4e8c-9706-2639e96169f9", + "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" : "\"0x8D735612FE931E8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa72f-301e-0042-5f4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:22 GMT", + "x-ms-client-request-id" : "d43609a1-00d2-4e8c-9706-2639e96169f9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail2d43554736/javablobsynccopydestacfail22165335d90eaf2984496", + "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" : "860b87fd-7cc6-406c-af88-3e6efec37c42", + "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 20:06:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612FF6F6BC\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa748-301e-0042-764a-67cbbf000000", + "x-ms-client-request-id" : "860b87fd-7cc6-406c-af88-3e6efec37c42" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail2d43554736/javablobsynccopydestacfail22165335d90eaf2984496", + "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" : "eec8fd3e-54ca-4a59-9fd8-5ced58713fea" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "TargetConditionNotMet", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "c5caa767-301e-0042-134a-67cbbf000000", + "Body" : "TargetConditionNotMetThe target condition specified using HTTP conditional header(s) is not met.\nRequestId:c5caa767-301e-0042-134a-67cbbf000000\nTime:2019-09-09T20:06:22.9855826Z", + "Date" : "Mon, 09 Sep 2019 20:06:22 GMT", + "x-ms-client-request-id" : "eec8fd3e-54ca-4a59-9fd8-5ced58713fea", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopydestacfail&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" : "58f75f77-2f91-4a7e-a7e8-a348c89d4472" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa77f-301e-0042-294a-67cbbf000000", + "Body" : "jtcsynccopydestacfailjtcsynccopydestacfail0blobapitestsynccopydestacfail2d43554736Mon, 09 Sep 2019 20:06:22 GMT\"0x8D735612FE931E8\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:22 GMT", + "x-ms-client-request-id" : "58f75f77-2f91-4a7e-a7e8-a348c89d4472", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail2d43554736?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" : "d410f195-17aa-4f05-8640-42a22fedf83a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caa796-301e-0042-3d4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:22 GMT", + "x-ms-client-request-id" : "d410f195-17aa-4f05-8640-42a22fedf83a" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestacfail0blobapitestsynccopydestacfail2d43554736", "javablobsynccopydestacfail15591383dd560c9add477", "javablobsynccopydestacfail22165335d90eaf2984496" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[3].json new file mode 100644 index 000000000000..ec0b832fe605 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[3].json @@ -0,0 +1,191 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail0db191211b?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" : "77b65a46-2f2f-4eba-afb6-25765c1c0906" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561302AAD55\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caa7bc-301e-0042-5d4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:23 GMT", + "x-ms-client-request-id" : "77b65a46-2f2f-4eba-afb6-25765c1c0906" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail0db191211b/javablobsynccopydestacfail139573154f59ce7dfd468", + "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" : "3a56a9d3-f5dd-494a-9b13-db60bf2d9c2b", + "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 20:06:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356130389F87\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa7e4-301e-0042-804a-67cbbf000000", + "x-ms-client-request-id" : "3a56a9d3-f5dd-494a-9b13-db60bf2d9c2b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail0db191211b?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" : "ca64155d-7daf-4dd6-9227-9ed6689ce5eb", + "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" : "\"0x8D735613044D017\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa7f9-301e-0042-134a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:23 GMT", + "x-ms-client-request-id" : "ca64155d-7daf-4dd6-9227-9ed6689ce5eb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail0db191211b/javablobsynccopydestacfail233347833f83d16d61431", + "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" : "52d4cb8c-1743-414f-b15b-3b610fe2cc5b", + "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 20:06:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356130521FA7\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa804-301e-0042-1d4a-67cbbf000000", + "x-ms-client-request-id" : "52d4cb8c-1743-414f-b15b-3b610fe2cc5b" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail0db191211b/javablobsynccopydestacfail233347833f83d16d61431", + "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" : "8bdd20c0-7a84-4d90-8701-10f7019742a3" + }, + "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 20:06:23 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:06:23 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7356130521FA7\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:23 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5caa819-301e-0042-304a-67cbbf000000", + "x-ms-client-request-id" : "8bdd20c0-7a84-4d90-8701-10f7019742a3", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail0db191211b/javablobsynccopydestacfail233347833f83d16d61431", + "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" : "54b6c6a9-cfec-4d3e-9149-aa0044d744da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5caa843-301e-0042-564a-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5caa843-301e-0042-564a-67cbbf000000\nTime:2019-09-09T20:06:23.6850753Z", + "Date" : "Mon, 09 Sep 2019 20:06:23 GMT", + "x-ms-client-request-id" : "54b6c6a9-cfec-4d3e-9149-aa0044d744da", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopydestacfail&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" : "753bd978-2924-4d2a-8c89-a72327e2550c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa864-301e-0042-744a-67cbbf000000", + "Body" : "jtcsynccopydestacfailjtcsynccopydestacfail0blobapitestsynccopydestacfail0db191211bMon, 09 Sep 2019 20:06:23 GMT\"0x8D735613044D017\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:23 GMT", + "x-ms-client-request-id" : "753bd978-2924-4d2a-8c89-a72327e2550c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail0db191211b?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" : "9844ab84-a89a-47a1-9c2a-c663ea6d10b3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caa87b-301e-0042-0a4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:23 GMT", + "x-ms-client-request-id" : "9844ab84-a89a-47a1-9c2a-c663ea6d10b3" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestacfail0blobapitestsynccopydestacfail0db191211b", "javablobsynccopydestacfail139573154f59ce7dfd468", "javablobsynccopydestacfail233347833f83d16d61431" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[4].json new file mode 100644 index 000000000000..299c2c3dceab --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopydestacfail[4].json @@ -0,0 +1,181 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail6906640020?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" : "709e5e92-d370-4164-bf76-464414aff344" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613094A5E0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caa891-301e-0042-174a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:23 GMT", + "x-ms-client-request-id" : "709e5e92-d370-4164-bf76-464414aff344" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail6906640020/javablobsynccopydestacfail1190489076516c4b4747f", + "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" : "d0bc9b4a-3cfc-4c09-ae0e-04c203aa16ad", + "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 20:06:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356130A29838\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa8ae-301e-0042-304a-67cbbf000000", + "x-ms-client-request-id" : "d0bc9b4a-3cfc-4c09-ae0e-04c203aa16ad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail6906640020?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" : "8aafe886-9b20-44d6-89c7-0aaa62412883", + "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" : "\"0x8D7356130AF3E0A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa8cb-301e-0042-494a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:23 GMT", + "x-ms-client-request-id" : "8aafe886-9b20-44d6-89c7-0aaa62412883" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail6906640020/javablobsynccopydestacfail25935156f32ae644c6481", + "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" : "b779da48-e30b-4a47-80f7-8b0d8d398e4a", + "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 20:06:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356130BC3F5F\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa8d9-301e-0042-554a-67cbbf000000", + "x-ms-client-request-id" : "b779da48-e30b-4a47-80f7-8b0d8d398e4a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail6906640020/javablobsynccopydestacfail25935156f32ae644c6481?comp=lease", + "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" : "d653109d-4ac2-43d0-842b-3242bcde376e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356130BC3F5F\"", + "x-ms-lease-id" : "4e330d7a-64e3-4c8a-9752-1280d72b5a95", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caa8ef-301e-0042-694a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:24 GMT", + "x-ms-client-request-id" : "d653109d-4ac2-43d0-842b-3242bcde376e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail6906640020/javablobsynccopydestacfail25935156f32ae644c6481", + "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" : "e02e951c-733c-40c7-96dd-50e2626a583f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "c5caa8fc-301e-0042-764a-67cbbf000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:c5caa8fc-301e-0042-764a-67cbbf000000\nTime:2019-09-09T20:06:24.3805665Z", + "Date" : "Mon, 09 Sep 2019 20:06:24 GMT", + "x-ms-client-request-id" : "e02e951c-733c-40c7-96dd-50e2626a583f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopydestacfail&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" : "6cc9733f-eb89-45ce-8576-8aeac31cde3e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa92c-301e-0042-214a-67cbbf000000", + "Body" : "jtcsynccopydestacfailjtcsynccopydestacfail0blobapitestsynccopydestacfail6906640020Mon, 09 Sep 2019 20:06:24 GMT\"0x8D7356130AF3E0A\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:24 GMT", + "x-ms-client-request-id" : "6cc9733f-eb89-45ce-8576-8aeac31cde3e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopydestacfail0blobapitestsynccopydestacfail6906640020?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" : "24ec7fca-4ec4-4181-9a04-b4350b21fc75" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caa947-301e-0042-394a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:24 GMT", + "x-ms-client-request-id" : "24ec7fca-4ec4-4181-9a04-b4350b21fc75" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopydestacfail0blobapitestsynccopydestacfail6906640020", "javablobsynccopydestacfail1190489076516c4b4747f", "javablobsynccopydestacfail25935156f32ae644c6481" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopyerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopyerror.json new file mode 100644 index 000000000000..eae93d50c333 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopyerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopyerror0blobapitestsynccopyerror75495917cbc5dcf?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" : "8ae7b32d-ccfa-4aac-b345-3769b112c1df" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613100C1AE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caa95e-301e-0042-504a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:24 GMT", + "x-ms-client-request-id" : "8ae7b32d-ccfa-4aac-b345-3769b112c1df" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopyerror0blobapitestsynccopyerror75495917cbc5dcf/javablobsynccopyerror1blobapitestsynccopyerror75457561c4a2", + "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" : "ccb330bd-9f3a-4c73-afc7-eeded7fc9de2", + "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 20:06:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561310D7B6A\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa974-301e-0042-634a-67cbbf000000", + "x-ms-client-request-id" : "ccb330bd-9f3a-4c73-afc7-eeded7fc9de2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopyerror0blobapitestsynccopyerror75495917cbc5dcf/javablobsynccopyerror2blobapitestsynccopyerror75470137a466", + "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" : "77c50fbb-63c2-4b68-bc00-663b1734b295" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "Content-Length" : "229", + "StatusCode" : "404", + "x-ms-request-id" : "c5caa98f-301e-0042-7c4a-67cbbf000000", + "Body" : "CannotVerifyCopySourceThe specified resource does not exist.\nRequestId:c5caa98f-301e-0042-7c4a-67cbbf000000\nTime:2019-09-09T20:06:24.8198768Z", + "Date" : "Mon, 09 Sep 2019 20:06:24 GMT", + "x-ms-client-request-id" : "77c50fbb-63c2-4b68-bc00-663b1734b295", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopyerror&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" : "e02816be-dfbc-4276-9bec-3bafdbb073dd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa9a0-301e-0042-0c4a-67cbbf000000", + "Body" : "jtcsynccopyerrorjtcsynccopyerror0blobapitestsynccopyerror75495917cbc5dcfMon, 09 Sep 2019 20:06:24 GMT\"0x8D735613100C1AE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:24 GMT", + "x-ms-client-request-id" : "e02816be-dfbc-4276-9bec-3bafdbb073dd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopyerror0blobapitestsynccopyerror75495917cbc5dcf?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" : "f5af7304-0562-4f04-88c7-3897a3f7e7ed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caa9b9-301e-0042-254a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:24 GMT", + "x-ms-client-request-id" : "f5af7304-0562-4f04-88c7-3897a3f7e7ed" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopyerror0blobapitestsynccopyerror75495917cbc5dcf", "javablobsynccopyerror1blobapitestsynccopyerror75457561c4a2", "javablobsynccopyerror2blobapitestsynccopyerror75470137a466" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopymetadata[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopymetadata[0].json new file mode 100644 index 000000000000..64eeaa761ff4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopymetadata[0].json @@ -0,0 +1,173 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata76281451eb4c?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" : "38653530-fe89-44ce-8abf-99eb707d95ae" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561291FCC9F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca9bd6-301e-0042-184a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:11 GMT", + "x-ms-client-request-id" : "38653530-fe89-44ce-8abf-99eb707d95ae" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata76281451eb4c/javablobsynccopymetadata1blobapitestsynccopymetadata762730803", + "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" : "f8470340-c351-43c1-ae1a-f44dac9a7913", + "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 20:06:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:11 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561292CAAB4\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca9bf4-301e-0042-334a-67cbbf000000", + "x-ms-client-request-id" : "f8470340-c351-43c1-ae1a-f44dac9a7913" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata76281451eb4c?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" : "1ab68f19-01c4-4883-863e-cf3ae7474387", + "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" : "\"0x8D735612938B361\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9c03-301e-0042-414a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:11 GMT", + "x-ms-client-request-id" : "1ab68f19-01c4-4883-863e-cf3ae7474387" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata76281451eb4c/javablobsynccopymetadata2blobapitestsynccopymetadata762311649", + "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" : "5dd4c2cc-9057-454b-93b4-4595c544b858" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "bda62901-87da-4f92-a8ee-f48b3d5f93be", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:11 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Mon, 09 Sep 2019 20:06:11 GMT", + "ETag" : "\"0x8D735612947800B\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "c5ca9c1c-301e-0042-5a4a-67cbbf000000", + "x-ms-client-request-id" : "5dd4c2cc-9057-454b-93b4-4595c544b858" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata76281451eb4c/javablobsynccopymetadata2blobapitestsynccopymetadata762311649", + "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" : "86e386d6-ff33-4f72-b7d2-b1cd35ff35c4" + }, + "Response" : { + "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 20:06:11 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "BlockBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:11 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca9c31-301e-0042-6d4a-67cbbf000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "bda62901-87da-4f92-a8ee-f48b3d5f93be", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata76281451eb4c/javablobsynccopymetadata1blobapitestsynccopymetadata762730803", + "x-ms-copy-progress" : "7/7", + "Date" : "Mon, 09 Sep 2019 20:06:11 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:06:11 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D735612947800B\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "86e386d6-ff33-4f72-b7d2-b1cd35ff35c4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopymetadata&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" : "30b65e0e-8783-443f-b915-3121d9a1c352" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9c40-301e-0042-7b4a-67cbbf000000", + "Body" : "jtcsynccopymetadatajtcsynccopymetadata0blobapitestsynccopymetadata76281451eb4cMon, 09 Sep 2019 20:06:11 GMT\"0x8D735612938B361\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:11 GMT", + "x-ms-client-request-id" : "30b65e0e-8783-443f-b915-3121d9a1c352", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata76281451eb4c?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" : "f5b5eaef-42fe-4722-8d1d-53f2cc5d87b6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca9c51-301e-0042-0c4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:11 GMT", + "x-ms-client-request-id" : "f5b5eaef-42fe-4722-8d1d-53f2cc5d87b6" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopymetadata0blobapitestsynccopymetadata76281451eb4c", "javablobsynccopymetadata1blobapitestsynccopymetadata762730803", "javablobsynccopymetadata2blobapitestsynccopymetadata762311649" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopymetadata[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopymetadata[1].json new file mode 100644 index 000000000000..a7ab4f8eccc2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopymetadata[1].json @@ -0,0 +1,175 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata21235621635b?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" : "7af14700-008e-4e17-93bf-73319a5e3a14" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561297BB8D7\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca9c64-301e-0042-1d4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:11 GMT", + "x-ms-client-request-id" : "7af14700-008e-4e17-93bf-73319a5e3a14" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata21235621635b/javablobsynccopymetadata1blobapitestsynccopymetadata21235430c", + "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" : "6f0e41b4-684e-4880-97e9-f35cf01d69cc", + "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 20:06:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:11 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612988BE21\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca9c7b-301e-0042-2f4a-67cbbf000000", + "x-ms-client-request-id" : "6f0e41b4-684e-4880-97e9-f35cf01d69cc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata21235621635b?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" : "adb85572-9034-4d92-a418-31ece24065a0", + "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" : "\"0x8D735612994C6D3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9c90-301e-0042-414a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:12 GMT", + "x-ms-client-request-id" : "adb85572-9034-4d92-a418-31ece24065a0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata21235621635b/javablobsynccopymetadata2blobapitestsynccopymetadata21285519c", + "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" : "4d292341-1ed2-4770-9e9d-92f07ec0a984" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "6666c5b7-7d75-46b2-8754-5587ba38bc5f", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:12 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Mon, 09 Sep 2019 20:06:12 GMT", + "ETag" : "\"0x8D7356129A2CFE7\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "c5ca9ca1-301e-0042-514a-67cbbf000000", + "x-ms-client-request-id" : "4d292341-1ed2-4770-9e9d-92f07ec0a984" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata21235621635b/javablobsynccopymetadata2blobapitestsynccopymetadata21285519c", + "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" : "5847d467-5902-43b8-b64b-d3c8dee6ac8b" + }, + "Response" : { + "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 20:06:12 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "BlockBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:12 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca9cb4-301e-0042-644a-67cbbf000000", + "x-ms-meta-fizz" : "buzz", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "6666c5b7-7d75-46b2-8754-5587ba38bc5f", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata21235621635b/javablobsynccopymetadata1blobapitestsynccopymetadata21235430c", + "x-ms-copy-progress" : "7/7", + "Date" : "Mon, 09 Sep 2019 20:06:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "x-ms-meta-foo" : "bar", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:06:12 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D7356129A2CFE7\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "5847d467-5902-43b8-b64b-d3c8dee6ac8b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopymetadata&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" : "96bd797e-5f2e-4d6f-a777-99c11f155116" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9ccb-301e-0042-784a-67cbbf000000", + "Body" : "jtcsynccopymetadatajtcsynccopymetadata0blobapitestsynccopymetadata21235621635bMon, 09 Sep 2019 20:06:12 GMT\"0x8D735612994C6D3\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:12 GMT", + "x-ms-client-request-id" : "96bd797e-5f2e-4d6f-a777-99c11f155116", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopymetadata0blobapitestsynccopymetadata21235621635b?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" : "531212a8-9b64-4cc5-84c2-c20ced8b72d2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca9ce8-301e-0042-0f4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:12 GMT", + "x-ms-client-request-id" : "531212a8-9b64-4cc5-84c2-c20ced8b72d2" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopymetadata0blobapitestsynccopymetadata21235621635b", "javablobsynccopymetadata1blobapitestsynccopymetadata21235430c", "javablobsynccopymetadata2blobapitestsynccopymetadata21285519c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopymin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopymin.json new file mode 100644 index 000000000000..bf6555f8951a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopymin.json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopymin0blobapitestsynccopymina3350314744d5d82f?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" : "803083bb-9f6d-4e3c-9ecf-1d245a23ddba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356128CA4A26\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca9b3a-301e-0042-114a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:10 GMT", + "x-ms-client-request-id" : "803083bb-9f6d-4e3c-9ecf-1d245a23ddba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopymin0blobapitestsynccopymina3350314744d5d82f/javablobsynccopymin1blobapitestsynccopymina3366696062b82", + "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" : "98e678f9-f332-4571-bee4-46c83670e91a", + "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 20:06:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:10 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356128D839C6\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca9b55-301e-0042-254a-67cbbf000000", + "x-ms-client-request-id" : "98e678f9-f332-4571-bee4-46c83670e91a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopymin0blobapitestsynccopymina3350314744d5d82f?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" : "7464ea97-d962-4a22-b6e7-a0b174ede6f5", + "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" : "\"0x8D7356128E4909D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9b6d-301e-0042-384a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:10 GMT", + "x-ms-client-request-id" : "7464ea97-d962-4a22-b6e7-a0b174ede6f5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopymin0blobapitestsynccopymina3350314744d5d82f/javablobsynccopymin2blobapitestsynccopymina3326362f1012c", + "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" : "6f244dd2-3609-40a3-be25-6a5891c7d296" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "f3de403d-ee95-4aef-8553-5f688a17868c", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:11 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Mon, 09 Sep 2019 20:06:10 GMT", + "ETag" : "\"0x8D7356128F9EE47\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "c5ca9b8a-301e-0042-544a-67cbbf000000", + "x-ms-client-request-id" : "6f244dd2-3609-40a3-be25-6a5891c7d296" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopymin&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" : "19958c6c-62af-4481-be5e-aed0028cc55a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9ba7-301e-0042-704a-67cbbf000000", + "Body" : "jtcsynccopyminjtcsynccopymin0blobapitestsynccopymina3350314744d5d82fMon, 09 Sep 2019 20:06:11 GMT\"0x8D7356128E4909D\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:11 GMT", + "x-ms-client-request-id" : "19958c6c-62af-4481-be5e-aed0028cc55a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopymin0blobapitestsynccopymina3350314744d5d82f?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" : "385efb99-ba95-48af-a9b3-2d59b9126822" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca9bbc-301e-0042-024a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:11 GMT", + "x-ms-client-request-id" : "385efb99-ba95-48af-a9b3-2d59b9126822" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopymin0blobapitestsynccopymina3350314744d5d82f", "javablobsynccopymin1blobapitestsynccopymina3366696062b82", "javablobsynccopymin2blobapitestsynccopymina3326362f1012c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[0].json new file mode 100644 index 000000000000..f100f83edab6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[0].json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceaccc08134246e2?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" : "e271e9dd-d0b2-4937-9f19-6ed4892dbc07" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356129D5A8EE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca9cfe-301e-0042-224a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:12 GMT", + "x-ms-client-request-id" : "e271e9dd-d0b2-4937-9f19-6ed4892dbc07" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceaccc08134246e2/javablobsynccopysourceac1blobapitestsynccopysourceaccc0402912", + "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" : "930751cb-1ce9-45cc-beab-678205dc957e", + "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 20:06:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356129E371C5\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca9d18-301e-0042-3b4a-67cbbf000000", + "x-ms-client-request-id" : "930751cb-1ce9-45cc-beab-678205dc957e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceaccc08134246e2?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" : "7876cbab-9e12-446e-bafe-1a6c0b2427e9", + "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" : "\"0x8D7356129EFC8B6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9d2a-301e-0042-4b4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:12 GMT", + "x-ms-client-request-id" : "7876cbab-9e12-446e-bafe-1a6c0b2427e9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceaccc08134246e2/javablobsynccopysourceac2blobapitestsynccopysourceaccc0711394", + "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" : "29973435-55e2-4d39-917e-7357ddac1ad7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "c7440997-82ac-4c3e-9136-abe84828763e", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:12 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Mon, 09 Sep 2019 20:06:12 GMT", + "ETag" : "\"0x8D735612A00B856\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "c5ca9d41-301e-0042-5f4a-67cbbf000000", + "x-ms-client-request-id" : "29973435-55e2-4d39-917e-7357ddac1ad7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopysourceac&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" : "cf41bac0-d8df-420a-b4a5-ae3397cf403d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9d53-301e-0042-704a-67cbbf000000", + "Body" : "jtcsynccopysourceacjtcsynccopysourceac0blobapitestsynccopysourceaccc08134246e2Mon, 09 Sep 2019 20:06:12 GMT\"0x8D7356129EFC8B6\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:12 GMT", + "x-ms-client-request-id" : "cf41bac0-d8df-420a-b4a5-ae3397cf403d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceaccc08134246e2?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" : "00830c26-1276-46e8-b715-4a7ff24d7db5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca9d6d-301e-0042-084a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:12 GMT", + "x-ms-client-request-id" : "00830c26-1276-46e8-b715-4a7ff24d7db5" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceac0blobapitestsynccopysourceaccc08134246e2", "javablobsynccopysourceac1blobapitestsynccopysourceaccc0402912", "javablobsynccopysourceac2blobapitestsynccopysourceaccc0711394" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[1].json new file mode 100644 index 000000000000..14fc3f374319 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[1].json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac65d736998a8f?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" : "22c6fdcd-c430-4ccd-afbb-534c3ce3fb25" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735612A2844A9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca9d88-301e-0042-224a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:12 GMT", + "x-ms-client-request-id" : "22c6fdcd-c430-4ccd-afbb-534c3ce3fb25" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac65d736998a8f/javablobsynccopysourceac1blobapitestsynccopysourceac65d600109", + "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" : "05649828-32a9-4558-b6b8-b6fcf36d42a0", + "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 20:06:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:13 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612A3634C0\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca9d99-301e-0042-2e4a-67cbbf000000", + "x-ms-client-request-id" : "05649828-32a9-4558-b6b8-b6fcf36d42a0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac65d736998a8f?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" : "664dc1fc-50c8-4c68-84f8-6052f916d0a1", + "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" : "\"0x8D735612A4264AE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9db0-301e-0042-434a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:13 GMT", + "x-ms-client-request-id" : "664dc1fc-50c8-4c68-84f8-6052f916d0a1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac65d736998a8f/javablobsynccopysourceac2blobapitestsynccopysourceac65d227524", + "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" : "e120392b-0471-4409-b7b7-ec151ae60d09" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "c8de04b6-ea03-4001-850a-23358e4c07ab", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:13 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Mon, 09 Sep 2019 20:06:13 GMT", + "ETag" : "\"0x8D735612A5157E4\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "c5ca9dc2-301e-0042-544a-67cbbf000000", + "x-ms-client-request-id" : "e120392b-0471-4409-b7b7-ec151ae60d09" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopysourceac&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" : "93bf9ee0-2fcf-4627-8074-5555492f3a69" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9de0-301e-0042-714a-67cbbf000000", + "Body" : "jtcsynccopysourceacjtcsynccopysourceac0blobapitestsynccopysourceac65d736998a8fMon, 09 Sep 2019 20:06:13 GMT\"0x8D735612A4264AE\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:13 GMT", + "x-ms-client-request-id" : "93bf9ee0-2fcf-4627-8074-5555492f3a69", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac65d736998a8f?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" : "5f567d72-1973-42f8-8eb3-b15793b24ee2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca9df2-301e-0042-014a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:13 GMT", + "x-ms-client-request-id" : "5f567d72-1973-42f8-8eb3-b15793b24ee2" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceac0blobapitestsynccopysourceac65d736998a8f", "javablobsynccopysourceac1blobapitestsynccopysourceac65d600109", "javablobsynccopysourceac2blobapitestsynccopysourceac65d227524" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[2].json new file mode 100644 index 000000000000..729dcd4b7c1b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[2].json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac906003216bbf?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" : "8b7113b7-ba88-4fde-92db-22a55e2c05d7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735612A7A1CF4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca9e12-301e-0042-1d4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:13 GMT", + "x-ms-client-request-id" : "8b7113b7-ba88-4fde-92db-22a55e2c05d7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac906003216bbf/javablobsynccopysourceac1blobapitestsynccopysourceac906049405", + "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" : "b0618085-f6cf-495b-80d5-0683af84cd12", + "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 20:06:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:13 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612A8770C6\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca9e28-301e-0042-2f4a-67cbbf000000", + "x-ms-client-request-id" : "b0618085-f6cf-495b-80d5-0683af84cd12" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac906003216bbf?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" : "d485165b-acbc-4124-907f-489725784f76", + "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" : "\"0x8D735612A93C7E4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9e4e-301e-0042-504a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:13 GMT", + "x-ms-client-request-id" : "d485165b-acbc-4124-907f-489725784f76" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac906003216bbf/javablobsynccopysourceac2blobapitestsynccopysourceac906876825", + "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" : "2eda83c6-badb-40c2-9bf9-b2e5cb4f30ba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "158dcb26-838b-4a25-8e33-99c2a945d2a6", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:13 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Mon, 09 Sep 2019 20:06:13 GMT", + "ETag" : "\"0x8D735612AA245A3\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "c5ca9e6a-301e-0042-6a4a-67cbbf000000", + "x-ms-client-request-id" : "2eda83c6-badb-40c2-9bf9-b2e5cb4f30ba" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopysourceac&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" : "734075d9-6ba2-40e1-b69e-700442344fef" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9e89-301e-0042-044a-67cbbf000000", + "Body" : "jtcsynccopysourceacjtcsynccopysourceac0blobapitestsynccopysourceac906003216bbfMon, 09 Sep 2019 20:06:13 GMT\"0x8D735612A93C7E4\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:13 GMT", + "x-ms-client-request-id" : "734075d9-6ba2-40e1-b69e-700442344fef", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceac906003216bbf?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" : "3105c6b3-9ae2-4cdc-b252-3e2c1030748d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca9ea7-301e-0042-1f4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:13 GMT", + "x-ms-client-request-id" : "3105c6b3-9ae2-4cdc-b252-3e2c1030748d" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceac0blobapitestsynccopysourceac906003216bbf", "javablobsynccopysourceac1blobapitestsynccopysourceac906049405", "javablobsynccopysourceac2blobapitestsynccopysourceac906876825" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[3].json new file mode 100644 index 000000000000..6bb220f3812f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[3].json @@ -0,0 +1,168 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceacb7f321770377?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" : "9ac11f62-c6f8-4377-a84f-82c5b0dd2fe6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735612AC7AEB4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca9ebd-301e-0042-354a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:14 GMT", + "x-ms-client-request-id" : "9ac11f62-c6f8-4377-a84f-82c5b0dd2fe6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceacb7f321770377/javablobsynccopysourceac1blobapitestsynccopysourceacb7f44580d", + "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" : "1113b8a4-bd21-4e07-990b-ad1e35f5d1fc", + "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 20:06:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612AD502A6\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca9ecf-301e-0042-454a-67cbbf000000", + "x-ms-client-request-id" : "1113b8a4-bd21-4e07-990b-ad1e35f5d1fc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceacb7f321770377?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" : "c2a71bce-55b7-4db4-9dc8-ade286a5aefd", + "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" : "\"0x8D735612AE159C0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9ee0-301e-0042-564a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:14 GMT", + "x-ms-client-request-id" : "c2a71bce-55b7-4db4-9dc8-ade286a5aefd" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceacb7f321770377/javablobsynccopysourceac1blobapitestsynccopysourceacb7f44580d", + "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" : "84d4f429-5a1e-470c-81b6-68e2126214d7" + }, + "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 20:06:14 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:06:14 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735612AD502A6\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:14 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca9ef5-301e-0042-674a-67cbbf000000", + "x-ms-client-request-id" : "84d4f429-5a1e-470c-81b6-68e2126214d7", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceacb7f321770377/javablobsynccopysourceac2blobapitestsynccopysourceacb7f260208", + "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" : "37dc2816-360b-42a6-98b9-49018eb930d0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "9c2c2079-6882-4bd3-92e1-72e769b3c94c", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:14 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Mon, 09 Sep 2019 20:06:14 GMT", + "ETag" : "\"0x8D735612AFBC06F\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "c5ca9f0e-301e-0042-7c4a-67cbbf000000", + "x-ms-client-request-id" : "37dc2816-360b-42a6-98b9-49018eb930d0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopysourceac&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" : "7c72ab44-77b7-40eb-a38d-484832fa53da" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9f31-301e-0042-1d4a-67cbbf000000", + "Body" : "jtcsynccopysourceacjtcsynccopysourceac0blobapitestsynccopysourceacb7f321770377Mon, 09 Sep 2019 20:06:14 GMT\"0x8D735612AE159C0\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:14 GMT", + "x-ms-client-request-id" : "7c72ab44-77b7-40eb-a38d-484832fa53da", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceacb7f321770377?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" : "43261788-5bc9-450a-91f4-ef28fbaaeda6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca9f48-301e-0042-344a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:14 GMT", + "x-ms-client-request-id" : "43261788-5bc9-450a-91f4-ef28fbaaeda6" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceac0blobapitestsynccopysourceacb7f321770377", "javablobsynccopysourceac1blobapitestsynccopysourceacb7f44580d", "javablobsynccopysourceac2blobapitestsynccopysourceacb7f260208" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[4].json new file mode 100644 index 000000000000..989373a92974 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceac[4].json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceaccf0493497f71?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" : "e39a32ef-85c9-4c24-9148-40a513c56d3f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735612B219EC7\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca9f70-301e-0042-594a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:14 GMT", + "x-ms-client-request-id" : "e39a32ef-85c9-4c24-9148-40a513c56d3f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceaccf0493497f71/javablobsynccopysourceac1blobapitestsynccopysourceaccf076331e", + "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" : "71aaf39b-0262-48cd-b7f7-c13450dd4c49", + "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 20:06:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612B2F8F35\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca9f89-301e-0042-6f4a-67cbbf000000", + "x-ms-client-request-id" : "71aaf39b-0262-48cd-b7f7-c13450dd4c49" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceaccf0493497f71?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" : "f5fe50c0-4cbf-40fa-9016-8e258c13423a", + "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" : "\"0x8D735612B3C3478\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9fa1-301e-0042-054a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:14 GMT", + "x-ms-client-request-id" : "f5fe50c0-4cbf-40fa-9016-8e258c13423a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceaccf0493497f71/javablobsynccopysourceac2blobapitestsynccopysourceaccf007909f", + "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" : "0716a19e-d956-4538-8ca3-9540eee29b1f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "66a2c22b-2f72-4d85-8666-5791af3ed4dc", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:15 GMT", + "retry-after" : "0", + "StatusCode" : "202", + "Date" : "Mon, 09 Sep 2019 20:06:14 GMT", + "ETag" : "\"0x8D735612B4B0033\"", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "x-ms-request-id" : "c5ca9fb4-301e-0042-174a-67cbbf000000", + "x-ms-client-request-id" : "0716a19e-d956-4538-8ca3-9540eee29b1f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopysourceac&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" : "beb659a2-1246-48a8-8877-6b3eef65caac" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca9fce-301e-0042-2e4a-67cbbf000000", + "Body" : "jtcsynccopysourceacjtcsynccopysourceac0blobapitestsynccopysourceaccf0493497f71Mon, 09 Sep 2019 20:06:14 GMT\"0x8D735612B3C3478\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:14 GMT", + "x-ms-client-request-id" : "beb659a2-1246-48a8-8877-6b3eef65caac", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceac0blobapitestsynccopysourceaccf0493497f71?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" : "24741d58-6b51-4fd2-9378-f5514a9cda95" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca9fe5-301e-0042-414a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:15 GMT", + "x-ms-client-request-id" : "24741d58-6b51-4fd2-9378-f5514a9cda95" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceac0blobapitestsynccopysourceaccf0493497f71", "javablobsynccopysourceac1blobapitestsynccopysourceaccf076331e", "javablobsynccopysourceac2blobapitestsynccopysourceaccf007909f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceacfail[0].json new file mode 100644 index 000000000000..9c3bdd920254 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceacfail[0].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceacfail0544665a12aa631b514e359?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" : "3cc04e93-5630-43f6-a696-bb3684b8724b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735612B73C53F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca9ffc-301e-0042-554a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:15 GMT", + "x-ms-client-request-id" : "3cc04e93-5630-43f6-a696-bb3684b8724b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceacfail0544665a12aa631b514e359/javablobsynccopysourceacfail104054023149bada6343", + "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" : "698a11df-eda7-400c-8fb3-51b4e7534f8a", + "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 20:06:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612B80A42A\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa00b-301e-0042-634a-67cbbf000000", + "x-ms-client-request-id" : "698a11df-eda7-400c-8fb3-51b4e7534f8a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceacfail0544665a12aa631b514e359?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" : "34616017-c9e7-405d-99bc-117951f199b8", + "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" : "\"0x8D735612B907E51\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa026-301e-0042-7a4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:15 GMT", + "x-ms-client-request-id" : "34616017-c9e7-405d-99bc-117951f199b8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceacfail0544665a12aa631b514e359/javablobsynccopysourceacfail29917570d16b40779f41", + "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" : "92f15311-ea00-411a-9a0d-cfe28c5cee9c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "c5caa038-301e-0042-0a4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:15 GMT", + "x-ms-client-request-id" : "92f15311-ea00-411a-9a0d-cfe28c5cee9c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopysourceacfail&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" : "8bf66440-39df-4316-b94b-6f4a84c86dda" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa04c-301e-0042-1c4a-67cbbf000000", + "Body" : "jtcsynccopysourceacfailjtcsynccopysourceacfail0544665a12aa631b514e359Mon, 09 Sep 2019 20:06:15 GMT\"0x8D735612B907E51\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:15 GMT", + "x-ms-client-request-id" : "8bf66440-39df-4316-b94b-6f4a84c86dda", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceacfail0544665a12aa631b514e359?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" : "7c66fbb4-9f2f-4d6d-a92c-3ec58e3fb4cc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caa05c-301e-0042-2b4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:15 GMT", + "x-ms-client-request-id" : "7c66fbb4-9f2f-4d6d-a92c-3ec58e3fb4cc" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceacfail0544665a12aa631b514e359", "javablobsynccopysourceacfail104054023149bada6343", "javablobsynccopysourceacfail29917570d16b40779f41" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceacfail[1].json new file mode 100644 index 000000000000..0a1b18149d96 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceacfail[1].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceacfail03821957294d034afc433cb?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" : "71e681af-df33-4190-8609-97504f8fa5a0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735612BC6D642\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caa070-301e-0042-3b4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:15 GMT", + "x-ms-client-request-id" : "71e681af-df33-4190-8609-97504f8fa5a0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceacfail03821957294d034afc433cb/javablobsynccopysourceacfail195056e0b00ed1353e4b", + "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" : "7da2f09a-8a1b-43da-9d26-3237b3d0adc6", + "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 20:06:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612BD3B546\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa082-301e-0042-4b4a-67cbbf000000", + "x-ms-client-request-id" : "7da2f09a-8a1b-43da-9d26-3237b3d0adc6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceacfail03821957294d034afc433cb?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" : "38b2b6cc-963c-4921-8ba4-420f5ddd37f6", + "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" : "\"0x8D735612BE05A8E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa095-301e-0042-5e4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:15 GMT", + "x-ms-client-request-id" : "38b2b6cc-963c-4921-8ba4-420f5ddd37f6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceacfail03821957294d034afc433cb/javablobsynccopysourceacfail297081f251d1a63a4b42", + "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" : "9e4a9f8f-d990-4edf-ba94-47422c613d85" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "Content-Length" : "259", + "StatusCode" : "412", + "x-ms-request-id" : "c5caa0a9-301e-0042-704a-67cbbf000000", + "Body" : "CannotVerifyCopySourceThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5caa0a9-301e-0042-704a-67cbbf000000\nTime:2019-09-09T20:06:16.1347457Z", + "Date" : "Mon, 09 Sep 2019 20:06:15 GMT", + "x-ms-client-request-id" : "9e4a9f8f-d990-4edf-ba94-47422c613d85", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopysourceacfail&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" : "c0752716-85c4-4ab0-a1f2-2ee3ffaaca64" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa0b7-301e-0042-7c4a-67cbbf000000", + "Body" : "jtcsynccopysourceacfailjtcsynccopysourceacfail03821957294d034afc433cbMon, 09 Sep 2019 20:06:16 GMT\"0x8D735612BE05A8E\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:16 GMT", + "x-ms-client-request-id" : "c0752716-85c4-4ab0-a1f2-2ee3ffaaca64", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceacfail03821957294d034afc433cb?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" : "370e8d1a-7d32-4e2a-a4fb-6fd61fc35217" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caa0cb-301e-0042-0d4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:16 GMT", + "x-ms-client-request-id" : "370e8d1a-7d32-4e2a-a4fb-6fd61fc35217" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceacfail03821957294d034afc433cb", "javablobsynccopysourceacfail195056e0b00ed1353e4b", "javablobsynccopysourceacfail297081f251d1a63a4b42" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceacfail[2].json new file mode 100644 index 000000000000..58b6da6203f9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceacfail[2].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceacfail01136451205f67d27a4b3b8?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" : "91e4dc4b-f48d-4e5b-9f31-ad97b2b73f0d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735612C15EEED\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caa0de-301e-0042-1e4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:16 GMT", + "x-ms-client-request-id" : "91e4dc4b-f48d-4e5b-9f31-ad97b2b73f0d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceacfail01136451205f67d27a4b3b8/javablobsynccopysourceacfail11885656845bba56a74a", + "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" : "274db708-ce1e-4926-b747-0658899127f2", + "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 20:06:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:16 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612C23B89C\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa0fe-301e-0042-3d4a-67cbbf000000", + "x-ms-client-request-id" : "274db708-ce1e-4926-b747-0658899127f2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceacfail01136451205f67d27a4b3b8?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" : "78ac89a7-c581-4f9c-98eb-015eae370abf", + "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" : "\"0x8D735612C3036C6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa111-301e-0042-504a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:16 GMT", + "x-ms-client-request-id" : "78ac89a7-c581-4f9c-98eb-015eae370abf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceacfail01136451205f67d27a4b3b8/javablobsynccopysourceacfail287986e17fdb2ab32547", + "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" : "d669d690-c3cf-4806-ba1d-7d7ece9f49a5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "SourceConditionNotMet", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "c5caa13d-301e-0042-784a-67cbbf000000", + "Body" : "SourceConditionNotMetThe source condition specified using HTTP conditional header(s) is not met.\nRequestId:c5caa13d-301e-0042-784a-67cbbf000000\nTime:2019-09-09T20:06:16.7011455Z", + "Date" : "Mon, 09 Sep 2019 20:06:16 GMT", + "x-ms-client-request-id" : "d669d690-c3cf-4806-ba1d-7d7ece9f49a5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopysourceacfail&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" : "5923b1b7-6dee-4e03-8024-36d25133ab09" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa14b-301e-0042-064a-67cbbf000000", + "Body" : "jtcsynccopysourceacfailjtcsynccopysourceacfail01136451205f67d27a4b3b8Mon, 09 Sep 2019 20:06:16 GMT\"0x8D735612C3036C6\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:16 GMT", + "x-ms-client-request-id" : "5923b1b7-6dee-4e03-8024-36d25133ab09", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceacfail01136451205f67d27a4b3b8?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" : "0b4dda92-06dd-4eaf-9a93-4014df95edf4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caa15b-301e-0042-164a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:16 GMT", + "x-ms-client-request-id" : "0b4dda92-06dd-4eaf-9a93-4014df95edf4" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceacfail01136451205f67d27a4b3b8", "javablobsynccopysourceacfail11885656845bba56a74a", "javablobsynccopysourceacfail287986e17fdb2ab32547" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceacfail[3].json new file mode 100644 index 000000000000..9cf55698dee7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestsynccopysourceacfail[3].json @@ -0,0 +1,163 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceacfail024921620509af6e684928b?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" : "8aae6205-925c-45d4-a13b-7ebc66ffe9c7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735612C6A38A9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caa16a-301e-0042-254a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:16 GMT", + "x-ms-client-request-id" : "8aae6205-925c-45d4-a13b-7ebc66ffe9c7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceacfail024921620509af6e684928b/javablobsynccopysourceacfail123316bf26d0b623504c", + "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" : "e70b7e8a-2e9a-4ba7-b127-34c3bcdbfe2a", + "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 20:06:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:16 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735612C78509F\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caa186-301e-0042-404a-67cbbf000000", + "x-ms-client-request-id" : "e70b7e8a-2e9a-4ba7-b127-34c3bcdbfe2a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceacfail024921620509af6e684928b?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" : "8a167de5-9e7f-41df-81b0-7b63bcf4f0d1", + "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" : "\"0x8D735612C84A7BD\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa1a9-301e-0042-5f4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:16 GMT", + "x-ms-client-request-id" : "8a167de5-9e7f-41df-81b0-7b63bcf4f0d1" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceacfail024921620509af6e684928b/javablobsynccopysourceacfail123316bf26d0b623504c", + "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" : "5f068056-54e5-442f-af44-d61c719b25d7" + }, + "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 20:06:17 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:06:17 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735612C78509F\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:17 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5caa1bd-301e-0042-6f4a-67cbbf000000", + "x-ms-client-request-id" : "5f068056-54e5-442f-af44-d61c719b25d7", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceacfail024921620509af6e684928b/javablobsynccopysourceacfail249025868d95b73e6647", + "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" : "5f7fa2b6-d040-43b6-87ff-e1c687968256" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "c5caa1c4-301e-0042-754a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:17 GMT", + "x-ms-client-request-id" : "5f7fa2b6-d040-43b6-87ff-e1c687968256" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsynccopysourceacfail&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" : "b83d5876-ffe7-46fd-90c6-0f1b0c2ec484" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caa1d3-301e-0042-044a-67cbbf000000", + "Body" : "jtcsynccopysourceacfailjtcsynccopysourceacfail024921620509af6e684928bMon, 09 Sep 2019 20:06:17 GMT\"0x8D735612C84A7BD\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:06:17 GMT", + "x-ms-client-request-id" : "b83d5876-ffe7-46fd-90c6-0f1b0c2ec484", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsynccopysourceacfail024921620509af6e684928b?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" : "e60be0ee-5443-462b-9a67-a63c0a56986f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caa1e3-301e-0042-144a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:17 GMT", + "x-ms-client-request-id" : "e60be0ee-5443-462b-9a67-a63c0a56986f" + }, + "Exception" : null + } ], + "variables" : [ "jtcsynccopysourceacfail024921620509af6e684928b", "javablobsynccopysourceacfail123316bf26d0b623504c", "javablobsynccopysourceacfail249025868d95b73e6647" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestundelete.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestundelete.json new file mode 100644 index 000000000000..a8457c7e724f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestundelete.json @@ -0,0 +1,201 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcundelete0blobapitestundeletede04871752a8e86cf8dd?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" : "5cde785e-729d-4cc3-bf3d-e555874696fa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735613EF82039\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:06:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cac138-301e-0042-274a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:47 GMT", + "x-ms-client-request-id" : "5cde785e-729d-4cc3-bf3d-e555874696fa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcundelete0blobapitestundeletede04871752a8e86cf8dd/javablobundelete1blobapitestundeletede035234c80a486df", + "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" : "3e71d999-38ca-4aef-b983-06da0cbdcc75", + "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 20:06:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:06:47 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735613F063EB2\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cac156-301e-0042-424a-67cbbf000000", + "x-ms-client-request-id" : "3e71d999-38ca-4aef-b983-06da0cbdcc75" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "d57dc938-982c-4cff-aa68-0398f2e90806", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cac16a-301e-0042-564a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:06:48 GMT", + "x-ms-client-request-id" : "d57dc938-982c-4cff-aa68-0398f2e90806" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcundelete0blobapitestundeletede04871752a8e86cf8dd/javablobundelete1blobapitestundeletede035234c80a486df", + "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" : "4eb1c373-2fd2-48b0-a3f4-a222bf9ace28" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "false", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cade16-301e-0042-604a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:07:18 GMT", + "x-ms-client-request-id" : "4eb1c373-2fd2-48b0-a3f4-a222bf9ace28" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcundelete0blobapitestundeletede04871752a8e86cf8dd/javablobundelete1blobapitestundeletede035234c80a486df?comp=undelete", + "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" : "ad449eb8-1435-4187-a82e-59bd03d451d1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cade37-301e-0042-7d4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:07:18 GMT", + "x-ms-client-request-id" : "ad449eb8-1435-4187-a82e-59bd03d451d1" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcundelete0blobapitestundeletede04871752a8e86cf8dd/javablobundelete1blobapitestundeletede035234c80a486df", + "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" : "9f10200b-3f87-4f27-8304-e24247b36bcd" + }, + "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 20:06:48 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:07:18 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735613F063EB2\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:06:48 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5cade4f-301e-0042-144a-67cbbf000000", + "x-ms-client-request-id" : "9f10200b-3f87-4f27-8304-e24247b36bcd", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "9b90809c-2f52-4c33-8e5b-90b1f587337e", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cade6c-301e-0042-304a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:07:18 GMT", + "x-ms-client-request-id" : "9b90809c-2f52-4c33-8e5b-90b1f587337e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcundelete&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" : "28f4746d-f42e-4976-a9fb-5828ea297aea" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5caf91d-301e-0042-584a-67cbbf000000", + "Body" : "jtcundeletejtcundelete0blobapitestundeletede04871752a8e86cf8ddMon, 09 Sep 2019 20:06:48 GMT\"0x8D735613EF82039\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:07:48 GMT", + "x-ms-client-request-id" : "28f4746d-f42e-4976-a9fb-5828ea297aea", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcundelete0blobapitestundeletede04871752a8e86cf8dd?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" : "e1fd31e0-8ae1-4fe3-bf16-2b19c0f84cfb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caf92d-301e-0042-674a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:07:48 GMT", + "x-ms-client-request-id" : "e1fd31e0-8ae1-4fe3-bf16-2b19c0f84cfb" + }, + "Exception" : null + } ], + "variables" : [ "jtcundelete0blobapitestundeletede04871752a8e86cf8dd", "javablobundelete1blobapitestundeletede035234c80a486df" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestundeleteerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestundeleteerror.json new file mode 100644 index 000000000000..1010edf2fe9d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestundeleteerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcundeleteerror0blobapitestundeleteerrorc6e1233250ef121?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" : "32126d81-68fa-406c-8eef-7d0c725ed4b5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561758844BF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb16de-301e-0042-564a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:19 GMT", + "x-ms-client-request-id" : "32126d81-68fa-406c-8eef-7d0c725ed4b5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcundeleteerror0blobapitestundeleteerrorc6e1233250ef121/javablobundeleteerror1blobapitestundeleteerrorc6e89543cd9d", + "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" : "3633f712-df89-4dea-96dd-5d1bc2ddfbf7", + "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 20:08:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561759595D9\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cb16f7-301e-0042-6e4a-67cbbf000000", + "x-ms-client-request-id" : "3633f712-df89-4dea-96dd-5d1bc2ddfbf7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcundeleteerror0blobapitestundeleteerrorc6e1233250ef121/javablobundeleteerror2blobapitestundeleteerrorc6e018226cdb?comp=undelete", + "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" : "7c7c3044-7f03-44b3-b48c-c225703d857e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "BlobNotFound", + "retry-after" : "0", + "Content-Length" : "215", + "StatusCode" : "404", + "x-ms-request-id" : "c5cb170a-301e-0042-014a-67cbbf000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:c5cb170a-301e-0042-014a-67cbbf000000\nTime:2019-09-09T20:08:19.7880331Z", + "Date" : "Mon, 09 Sep 2019 20:08:19 GMT", + "x-ms-client-request-id" : "7c7c3044-7f03-44b3-b48c-c225703d857e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcundeleteerror&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" : "4d00d3e7-9e70-45b9-bd42-b262cd1dca70" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb1722-301e-0042-164a-67cbbf000000", + "Body" : "jtcundeleteerrorjtcundeleteerror0blobapitestundeleteerrorc6e1233250ef121Mon, 09 Sep 2019 20:08:19 GMT\"0x8D73561758844BF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:19 GMT", + "x-ms-client-request-id" : "4d00d3e7-9e70-45b9-bd42-b262cd1dca70", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcundeleteerror0blobapitestundeleteerrorc6e1233250ef121?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" : "3f29b7d3-2e9d-44fd-8adb-efbab582efe5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb1730-301e-0042-244a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:19 GMT", + "x-ms-client-request-id" : "3f29b7d3-2e9d-44fd-8adb-efbab582efe5" + }, + "Exception" : null + } ], + "variables" : [ "jtcundeleteerror0blobapitestundeleteerrorc6e1233250ef121", "javablobundeleteerror1blobapitestundeleteerrorc6e89543cd9d", "javablobundeleteerror2blobapitestundeleteerrorc6e018226cdb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestundeletemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestundeletemin.json new file mode 100644 index 000000000000..f989cd355b10 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlobAPITestundeletemin.json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcundeletemin0blobapitestundeleteminee2734016f9960145?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" : "0612436e-be88-4fc9-be5a-cd32245ce5ad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735616343A872\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:07:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5caf943-301e-0042-7b4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:07:48 GMT", + "x-ms-client-request-id" : "0612436e-be88-4fc9-be5a-cd32245ce5ad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcundeletemin0blobapitestundeleteminee2734016f9960145/javablobundeletemin1blobapitestundeleteminee2999305005c0", + "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" : "f167c523-f18d-4aa3-9b6d-058f8b2b3220", + "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 20:07:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:07:48 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561635189DB\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5caf959-301e-0042-0e4a-67cbbf000000", + "x-ms-client-request-id" : "f167c523-f18d-4aa3-9b6d-058f8b2b3220" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "76ea68a1-5622-4be6-9f54-75aad42737e5", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5caf979-301e-0042-294a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:07:48 GMT", + "x-ms-client-request-id" : "76ea68a1-5622-4be6-9f54-75aad42737e5" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcundeletemin0blobapitestundeleteminee2734016f9960145/javablobundeletemin1blobapitestundeleteminee2999305005c0", + "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" : "b430eae5-906f-4e9a-8bd8-510ce64ded33" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "false", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb1688-301e-0042-094a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:18 GMT", + "x-ms-client-request-id" : "b430eae5-906f-4e9a-8bd8-510ce64ded33" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcundeletemin0blobapitestundeleteminee2734016f9960145/javablobundeletemin1blobapitestundeleteminee2999305005c0?comp=undelete", + "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" : "093ce58f-e2f4-40b7-8651-bbe32e98b052" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb16a5-301e-0042-224a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:18 GMT", + "x-ms-client-request-id" : "093ce58f-e2f4-40b7-8651-bbe32e98b052" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcundeletemin&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" : "48ce4154-00e3-44a5-bf6e-f2a4a3e5af43" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb16b4-301e-0042-314a-67cbbf000000", + "Body" : "jtcundeleteminjtcundeletemin0blobapitestundeleteminee2734016f9960145Mon, 09 Sep 2019 20:07:48 GMT\"0x8D735616343A872\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:19 GMT", + "x-ms-client-request-id" : "48ce4154-00e3-44a5-bf6e-f2a4a3e5af43", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcundeletemin0blobapitestundeleteminee2734016f9960145?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" : "74293ab5-24ec-47ad-8ef9-a0875257c851" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb16cc-301e-0042-444a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:19 GMT", + "x-ms-client-request-id" : "74293ab5-24ec-47ad-8ef9-a0875257c851" + }, + "Exception" : null + } ], + "variables" : [ "jtcundeletemin0blobapitestundeleteminee2734016f9960145", "javablobundeletemin1blobapitestundeleteminee2999305005c0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[0].json new file mode 100644 index 000000000000..dae9dd35e489 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[0].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcasyncbufferedupload0673949605e61caed8406d9", "javablobasyncbufferedupload125170117c4e257d404e7", "javablobasyncbufferedupload218913ac563e9ee86043d", "aeb67b73-c565-43f8-b551-59fb74230ab6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[1].json new file mode 100644 index 000000000000..2917e35921a4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[1].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcasyncbufferedupload0750926f3d9490a2904ecc9", "javablobasyncbufferedupload136218e32c234f1f81419", "javablobasyncbufferedupload2676904c172f149264456", "f06aeb90-d9ad-48ea-b999-fc8e5e524249" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[2].json new file mode 100644 index 000000000000..4360c26b11c0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[2].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcasyncbufferedupload076829a6195fa0a2be44e1b", "javablobasyncbufferedupload103421b0ebc939f65045c", "javablobasyncbufferedupload2149028ebcfa2603ee415", "4ff5df5f-0408-468c-9c4a-084bbb7d16b5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[3].json new file mode 100644 index 000000000000..1aafc93b0281 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[3].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcasyncbufferedupload076305e62288438461419e9", "javablobasyncbufferedupload1572753cfc6933b099449", "javablobasyncbufferedupload257997cc4d8a9f2d54455", "30c93d6e-2d6b-4c63-b0fb-42513fdda86e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[4].json new file mode 100644 index 000000000000..710c623d3fcb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[4].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcasyncbufferedupload029289fcb4fc3333a847658", "javablobasyncbufferedupload14844589bcc3e919534a4", "javablobasyncbufferedupload278300798ddea5c7b44a8", "3f09352f-6064-4e5a-961a-998718e2e1f5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[5].json new file mode 100644 index 000000000000..a7ea71ca5373 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[5].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcasyncbufferedupload0566144716dd21e6fe49a7a", "javablobasyncbufferedupload1299611569a5a69e624ea", "javablobasyncbufferedupload26333781fdcc1b2535464", "82d8b017-c22e-4b20-a544-c8e0a82755d1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[6].json new file mode 100644 index 000000000000..68314e45e236 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[6].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcasyncbufferedupload0729446f7493b5cf7d4c278", "javablobasyncbufferedupload1103217bfd1430dff5451", "javablobasyncbufferedupload2240816c7719424570455", "e3b93e37-9ff8-4323-8dbc-b90cb1799a7f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[7].json new file mode 100644 index 000000000000..53c6f478a9cc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestasyncbufferedupload[7].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcasyncbufferedupload099389d5cb3e5f4d724ade8", "javablobasyncbufferedupload1736807d53b69ada5648b", "javablobasyncbufferedupload2073617da48614ac174c8", "f88f9fef-f8a8-44bb-9bb6-85dd6ee0b1df" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadac[0].json new file mode 100644 index 000000000000..25bc8bec844f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadac[0].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadac0blockblobapitestbuffereduploadaca6d82494b", "javablobbuffereduploadac123497c00e609becd14b5c", "javablobbuffereduploadac241323fa2339ddf5934041", "e00ff054-5126-43c0-885e-8edd646037e2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadac[1].json new file mode 100644 index 000000000000..1e3c4dc974d1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadac[1].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadac0blockblobapitestbuffereduploadac467987911", "javablobbuffereduploadac17659458986187a0ca4173", "javablobbuffereduploadac280868dfa4e4cc091449ec", "60bfa281-9cee-4d39-b751-44b8e6cd5445" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadac[2].json new file mode 100644 index 000000000000..4768e36a50b4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadac[2].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadac0blockblobapitestbuffereduploadac09861448c", "javablobbuffereduploadac182410b05017ce8fa84998", "javablobbuffereduploadac292172a125115a55bc4610", "0eabfad3-7b0e-4c41-b4b3-44576d303c9c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadac[3].json new file mode 100644 index 000000000000..a43dcbfa4cde --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadac[3].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadac0blockblobapitestbuffereduploadac22b853538", "javablobbuffereduploadac15642952e74c7052584c74", "javablobbuffereduploadac294008929549674203492f", "6a96930d-7483-4502-9e2f-ec47c8b7b862" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadac[4].json new file mode 100644 index 000000000000..65ecce3628fc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadac[4].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadac0blockblobapitestbuffereduploadacfbf611324", "javablobbuffereduploadac1656399526ad309c5a4b22", "javablobbuffereduploadac2220052b38915edc644d01", "78a019db-298e-4341-a621-00c714d50c5e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadac[5].json new file mode 100644 index 000000000000..b3efde15208c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadac[5].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadac0blockblobapitestbuffereduploadac3e9081244", "javablobbuffereduploadac18907003091d4975334d06", "javablobbuffereduploadac262643c0f5e3e2436349fd", "e8142635-b9b4-44ef-95c2-dfbb94a5f47d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadacfail[0].json new file mode 100644 index 000000000000..b5bc30fd7865 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadacfail[0].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadacfail051204646d01d5a75e42718", "javablobbuffereduploadacfail130991973d096f4cd34b", "javablobbuffereduploadacfail2289407583741453b94c", "634c7704-06e1-4e78-9e70-cbbb7fbddf61" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadacfail[1].json new file mode 100644 index 000000000000..57f201b2b08f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadacfail[1].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadacfail095755066e17cfdfd14c25a", "javablobbuffereduploadacfail16904590d95f97e52f46", "javablobbuffereduploadacfail25124604baf784c29f4a", "482eb07a-cd03-40a4-bc38-c30d4c6a9c17" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadacfail[2].json new file mode 100644 index 000000000000..703d0e40c4a8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadacfail[2].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadacfail029507e578ecc828534b38b", "javablobbuffereduploadacfail1334548ca89877074d44", "javablobbuffereduploadacfail282730c89692fda0594e", "a9c6e543-9165-408e-b3bb-95d86917b5cd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadacfail[3].json new file mode 100644 index 000000000000..019ea7b536c5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadacfail[3].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadacfail015617757874b3d7224919a", "javablobbuffereduploadacfail139927d3e6c4fb3d3847", "javablobbuffereduploadacfail286258907ce461f20748", "c15f8b9f-aad8-44b6-8074-cebb62c05804" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadacfail[4].json new file mode 100644 index 000000000000..80c9d916752d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadacfail[4].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadacfail007096acb7b25bc49842829", "javablobbuffereduploadacfail148800efc019f2f9ae48", "javablobbuffereduploadacfail225749e42be9edef5546", "f03b08c8-6ce2-4a18-9b99-ac9a5553587d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadchunkedsource[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadchunkedsource[0].json new file mode 100644 index 000000000000..dd03ec08b623 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadchunkedsource[0].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadchunkedsource04871411fed64ffc3d4", "javablobbuffereduploadchunkedsource1617519a84cac78c1", "javablobbuffereduploadchunkedsource2046709410d952281", "ee9ff3af-23fc-436d-b2a9-9a6cd3bb9a22", "c2b33e93-d340-44c3-be82-0ae78cec5148" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadchunkedsource[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadchunkedsource[1].json new file mode 100644 index 000000000000..b041781ec80b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadchunkedsource[1].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadchunkedsource081404258e5133665a4", "javablobbuffereduploadchunkedsource1447439981134b884", "javablobbuffereduploadchunkedsource2741475568211770a", "30f2baeb-9f90-4b1f-88fb-58adcbe4bdb2", "f54fad1c-53e2-454c-b116-e5a37f35cdce", "152680b6-e243-40c5-93e2-103c732ffbb1", "57c4b046-5974-479a-adde-024365fc52f1", "c184b49e-4cd9-4825-924c-9e787bc9e2b2", "a64ff069-4d3d-45d5-bee2-8224d220db12", "fea3c650-a971-4050-956d-768507b2dc3c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadchunkedsource[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadchunkedsource[2].json new file mode 100644 index 000000000000..7366ed7c900f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadchunkedsource[2].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadchunkedsource086726aa36b91021cf4", "javablobbuffereduploadchunkedsource12758460f5d7b05ca", "javablobbuffereduploadchunkedsource220164d5ff8479ca0", "68301341-cf80-4441-a581-4110aecdb6f5", "81790017-5e03-490f-bc00-af86078e464c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadchunkedsource[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadchunkedsource[3].json new file mode 100644 index 000000000000..a43bf6435beb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadchunkedsource[3].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadchunkedsource040134a7075af320354", "javablobbuffereduploadchunkedsource177308849835f3e57", "javablobbuffereduploadchunkedsource268660e9b7c895403", "c993af04-3c01-433a-9c28-648bc70d0dcf", "9ab210da-1bfd-4a22-a4a2-00c5fee40527", "4f9aedb7-5974-4c2e-9c83-3c10d9674f0a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadheaders[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadheaders[0].json new file mode 100644 index 000000000000..ea91ad587291 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadheaders[0].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadheaders0609986faeed849655429a", "javablobbuffereduploadheaders115645df14fc5efb5d40", "javablobbuffereduploadheaders26646148f1a8371d7e4b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadheaders[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadheaders[1].json new file mode 100644 index 000000000000..c224b42f1ab6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadheaders[1].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadheaders006297304030c2bd204567", "javablobbuffereduploadheaders106715a244ea1009fb40", "javablobbuffereduploadheaders2286649eed77f911d74a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadillegalargsoutofbounds[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadillegalargsoutofbounds[0].json new file mode 100644 index 000000000000..5c770f3fa9ce --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadillegalargsoutofbounds[0].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbuffereduploadillegalargsoutofbounds03671038d818108?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" : "2b2ba71e-0b15-49c3-b234-e6483b4b40ff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561EA9AADB7\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bea0d-601e-0051-4c4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:35 GMT", + "x-ms-client-request-id" : "2b2ba71e-0b15-49c3-b234-e6483b4b40ff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbuffereduploadillegalargsoutofbounds03671038d818108/javablobbuffereduploadillegalargsoutofbounds13366245f99d", + "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" : "e87e65a9-4dcc-4253-9594-4e6dcbcb4fff", + "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 20:11:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:11:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561EAA83C1D\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bea2b-601e-0051-654a-67fe5e000000", + "x-ms-client-request-id" : "e87e65a9-4dcc-4253-9594-4e6dcbcb4fff" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbuffereduploadillegalargsoutofbounds&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" : "12fe83b0-7e48-47b4-bb27-392fd8890d17" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bea44-601e-0051-7a4a-67fe5e000000", + "Body" : "jtcbuffereduploadillegalargsoutofboundsjtcbuffereduploadillegalargsoutofbounds03671038d818108Mon, 09 Sep 2019 20:11:36 GMT\"0x8D73561EA9AADB7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:11:35 GMT", + "x-ms-client-request-id" : "12fe83b0-7e48-47b4-bb27-392fd8890d17", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbuffereduploadillegalargsoutofbounds03671038d818108?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" : "47bf0f80-e8bd-4ac2-a619-66598742c0e4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bea51-601e-0051-054a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:35 GMT", + "x-ms-client-request-id" : "47bf0f80-e8bd-4ac2-a619-66598742c0e4" + }, + "Exception" : null + } ], + "variables" : [ "jtcbuffereduploadillegalargsoutofbounds03671038d818108", "javablobbuffereduploadillegalargsoutofbounds13366245f99d", "javablobbuffereduploadillegalargsoutofbounds2077997c193e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadillegalargsoutofbounds[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadillegalargsoutofbounds[1].json new file mode 100644 index 000000000000..ccd54c202744 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadillegalargsoutofbounds[1].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbuffereduploadillegalargsoutofbounds039293bd8e50ccd?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" : "86ac31f9-4aa4-411e-b97b-cd32ae3d9c9f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561EAD01F4D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bea62-601e-0051-154a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:35 GMT", + "x-ms-client-request-id" : "86ac31f9-4aa4-411e-b97b-cd32ae3d9c9f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbuffereduploadillegalargsoutofbounds039293bd8e50ccd/javablobbuffereduploadillegalargsoutofbounds127674b23cb7", + "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" : "5616a2f9-a024-4c69-8fe7-a7b832607f06", + "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 20:11:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:11:36 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561EADD5FA1\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bea7d-601e-0051-2c4a-67fe5e000000", + "x-ms-client-request-id" : "5616a2f9-a024-4c69-8fe7-a7b832607f06" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbuffereduploadillegalargsoutofbounds&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" : "9235ee06-76c6-449b-aedd-d86e9b7d6d81" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bea97-601e-0051-444a-67fe5e000000", + "Body" : "jtcbuffereduploadillegalargsoutofboundsjtcbuffereduploadillegalargsoutofbounds039293bd8e50ccdMon, 09 Sep 2019 20:11:36 GMT\"0x8D73561EAD01F4D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:11:36 GMT", + "x-ms-client-request-id" : "9235ee06-76c6-449b-aedd-d86e9b7d6d81", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbuffereduploadillegalargsoutofbounds039293bd8e50ccd?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" : "93149e33-3a88-4d96-83ef-4b0f9450c886" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755beaac-601e-0051-574a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:36 GMT", + "x-ms-client-request-id" : "93149e33-3a88-4d96-83ef-4b0f9450c886" + }, + "Exception" : null + } ], + "variables" : [ "jtcbuffereduploadillegalargsoutofbounds039293bd8e50ccd", "javablobbuffereduploadillegalargsoutofbounds127674b23cb7", "javablobbuffereduploadillegalargsoutofbounds28959231065e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadillegalargsoutofbounds[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadillegalargsoutofbounds[2].json new file mode 100644 index 000000000000..c03477d3616a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadillegalargsoutofbounds[2].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbuffereduploadillegalargsoutofbounds024614c2f07ecd5?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" : "abf61ad1-6168-48a0-9785-ff9b57118096" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561EB04F48C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755beabb-601e-0051-644a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:36 GMT", + "x-ms-client-request-id" : "abf61ad1-6168-48a0-9785-ff9b57118096" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbuffereduploadillegalargsoutofbounds024614c2f07ecd5/javablobbuffereduploadillegalargsoutofbounds14050655e61f", + "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" : "877200d1-ac24-4f81-b62e-8f96bae81614", + "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 20:11:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:11:36 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561EB12D154\"", + "Content-Length" : "0", + "x-ms-request-id" : "755beacc-601e-0051-744a-67fe5e000000", + "x-ms-client-request-id" : "877200d1-ac24-4f81-b62e-8f96bae81614" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbuffereduploadillegalargsoutofbounds&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" : "aa958258-f97a-4613-8408-4605c2227bce" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755beae4-601e-0051-064a-67fe5e000000", + "Body" : "jtcbuffereduploadillegalargsoutofboundsjtcbuffereduploadillegalargsoutofbounds024614c2f07ecd5Mon, 09 Sep 2019 20:11:36 GMT\"0x8D73561EB04F48C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:11:36 GMT", + "x-ms-client-request-id" : "aa958258-f97a-4613-8408-4605c2227bce", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbuffereduploadillegalargsoutofbounds024614c2f07ecd5?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" : "fc03a48c-6e5a-47ee-aad1-dc402edc23c2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755beb05-601e-0051-244a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:36 GMT", + "x-ms-client-request-id" : "fc03a48c-6e5a-47ee-aad1-dc402edc23c2" + }, + "Exception" : null + } ], + "variables" : [ "jtcbuffereduploadillegalargsoutofbounds024614c2f07ecd5", "javablobbuffereduploadillegalargsoutofbounds14050655e61f", "javablobbuffereduploadillegalargsoutofbounds21821508eee7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadillegalargumentsnull.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadillegalargumentsnull.json new file mode 100644 index 000000000000..c5935f960573 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadillegalargumentsnull.json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbuffereduploadillegalargumentsnull048449ba4f9d6ef4?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" : "416e4f96-052f-48df-b856-a62b7746c2eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561EA6674D0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755be9cf-601e-0051-104a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:35 GMT", + "x-ms-client-request-id" : "416e4f96-052f-48df-b856-a62b7746c2eb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbuffereduploadillegalargumentsnull048449ba4f9d6ef4/javablobbuffereduploadillegalargumentsnull168079ac59d71", + "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" : "e3697f3e-18e3-4d19-b754-c6c7c96af872", + "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 20:11:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:11:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561EA733FB2\"", + "Content-Length" : "0", + "x-ms-request-id" : "755be9e7-601e-0051-264a-67fe5e000000", + "x-ms-client-request-id" : "e3697f3e-18e3-4d19-b754-c6c7c96af872" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbuffereduploadillegalargumentsnull&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" : "43781ebf-2548-4b8e-9c25-d3ce4dbdb553" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755be9f4-601e-0051-334a-67fe5e000000", + "Body" : "jtcbuffereduploadillegalargumentsnulljtcbuffereduploadillegalargumentsnull048449ba4f9d6ef4Mon, 09 Sep 2019 20:11:35 GMT\"0x8D73561EA6674D0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:11:35 GMT", + "x-ms-client-request-id" : "43781ebf-2548-4b8e-9c25-d3ce4dbdb553", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbuffereduploadillegalargumentsnull048449ba4f9d6ef4?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" : "014f2467-65d7-4b56-89fa-e725f6c57ca7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755be9fa-601e-0051-394a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:35 GMT", + "x-ms-client-request-id" : "014f2467-65d7-4b56-89fa-e725f6c57ca7" + }, + "Exception" : null + } ], + "variables" : [ "jtcbuffereduploadillegalargumentsnull048449ba4f9d6ef4", "javablobbuffereduploadillegalargumentsnull168079ac59d71", "javablobbuffereduploadillegalargumentsnull276618de7f81b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadmetadata[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadmetadata[0].json new file mode 100644 index 000000000000..6fcd31493809 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadmetadata[0].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadmetadata00367639cf46dfd18b4dbc", "javablobbuffereduploadmetadata128786e858bf31bc444", "javablobbuffereduploadmetadata24856484f1bee7b8a74", "31c3cf63-2f95-4c5b-99e2-c82564af11a5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadmetadata[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadmetadata[1].json new file mode 100644 index 000000000000..38c0a1dd3111 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadmetadata[1].json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcbuffereduploadmetadata0780156a0de28ea2574309", "javablobbuffereduploadmetadata17467932f24f8a9aa44", "javablobbuffereduploadmetadata265890a986fc2842474", "91499c89-a9e1-4ca0-8dd0-0e358a2c1c89" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadnetworkerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadnetworkerror.json new file mode 100644 index 000000000000..70b6cca8f74b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestbuffereduploadnetworkerror.json @@ -0,0 +1,146 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbuffereduploadnetworkerror0907979d92c5df18a14f?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" : "bca51290-7488-49f0-ad8a-5a16a869e9ba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F0C87628\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bf2a2-601e-0051-2f4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:45 GMT", + "x-ms-client-request-id" : "bca51290-7488-49f0-ad8a-5a16a869e9ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbuffereduploadnetworkerror0907979d92c5df18a14f/javablobbuffereduploadnetworkerror13522801d58f6a400", + "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" : "d788c517-c444-4046-af56-0e706221849d", + "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 20:11:46 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:11:46 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561F0D59139\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bf2bb-601e-0051-464a-67fe5e000000", + "x-ms-client-request-id" : "d788c517-c444-4046-af56-0e706221849d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbuffereduploadnetworkerror0907979d92c5df18a14f/javablobbuffereduploadnetworkerror254162597abc5f02a", + "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" : "e13d9089-62f0-4233-8a28-4953861899cc", + "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 20:11:46 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:11:46 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561F0E216A5\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bf2d6-601e-0051-5d4a-67fe5e000000", + "x-ms-client-request-id" : "e13d9089-62f0-4233-8a28-4953861899cc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbuffereduploadnetworkerror0907979d92c5df18a14f/javablobbuffereduploadnetworkerror254162597abc5f02a", + "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" : "b9722a75-7a6d-4b7e-8cdc-ce102a742090" + }, + "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 20:11:46 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:11:46 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73561F0E216A5\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:11:46 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "755bf2e7-601e-0051-6a4a-67fe5e000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "b9722a75-7a6d-4b7e-8cdc-ce102a742090", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbuffereduploadnetworkerror&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" : "02542984-f13b-4c24-a39e-c65c0575357a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bf49d-601e-0051-804a-67fe5e000000", + "Body" : "jtcbuffereduploadnetworkerrorjtcbuffereduploadnetworkerror0907979d92c5df18a14fMon, 09 Sep 2019 20:11:46 GMT\"0x8D73561F0C87628\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:11:48 GMT", + "x-ms-client-request-id" : "02542984-f13b-4c24-a39e-c65c0575357a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbuffereduploadnetworkerror0907979d92c5df18a14f?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" : "6886cc28-0f00-49f0-932e-28fb2c195e8f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf4af-601e-0051-124a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:48 GMT", + "x-ms-client-request-id" : "6886cc28-0f00-49f0-932e-28fb2c195e8f" + }, + "Exception" : null + } ], + "variables" : [ "jtcbuffereduploadnetworkerror0907979d92c5df18a14f", "javablobbuffereduploadnetworkerror13522801d58f6a400", "javablobbuffereduploadnetworkerror254162597abc5f02a", "jtcbuffereduploadnetworkerror324646057e3126516a4d", "javablobbuffereduploadnetworkerror43623671e9ce74aa0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklist.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklist.json new file mode 100644 index 000000000000..d716d18045ba --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklist.json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklist0blockblobapitestcommitblocklist4295761156?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" : "183a98f4-a3f1-4d5e-9d74-09c1f9edd88b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561BD7454DD\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb5e0-601e-0051-6a4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:20 GMT", + "x-ms-client-request-id" : "183a98f4-a3f1-4d5e-9d74-09c1f9edd88b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklist0blockblobapitestcommitblocklist4295761156/javablobcommitblocklist1696080081d540c0a1401d8", + "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" : "853ead9b-3749-45c3-9154-585d9e722304", + "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 20:10:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BD8134EF\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb5f3-601e-0051-784a-67fe5e000000", + "x-ms-client-request-id" : "853ead9b-3749-45c3-9154-585d9e722304" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklist0blockblobapitestcommitblocklist4295761156/javablobcommitblocklist1696080081d540c0a1401d8?blockid=YTNhNTkxNGEtYjMxNS00YmVmLTg1YjctODlhMWM0ZWJiYmI2&comp=block", + "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" : "989e51e0-7f2e-4aaf-af8e-8ad9cad01ced", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb5fd-601e-0051-014a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:20 GMT", + "x-ms-client-request-id" : "989e51e0-7f2e-4aaf-af8e-8ad9cad01ced" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklist0blockblobapitestcommitblocklist4295761156/javablobcommitblocklist1696080081d540c0a1401d8?comp=blocklist", + "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" : "c334c64a-f777-424b-b2e0-3bb3463b337c", + "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" : "\"0x8D73561BD9A3FC5\"", + "x-ms-content-crc64" : "dbvzNoFMuDw=", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb60e-601e-0051-104a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:20 GMT", + "x-ms-client-request-id" : "c334c64a-f777-424b-b2e0-3bb3463b337c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccommitblocklist&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" : "634e534f-5d57-48c4-9abf-25f8ab892cbc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb617-601e-0051-184a-67fe5e000000", + "Body" : "jtccommitblocklistjtccommitblocklist0blockblobapitestcommitblocklist4295761156Mon, 09 Sep 2019 20:10:20 GMT\"0x8D73561BD7454DD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:20 GMT", + "x-ms-client-request-id" : "634e534f-5d57-48c4-9abf-25f8ab892cbc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklist0blockblobapitestcommitblocklist4295761156?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" : "863704eb-a394-4642-b1f4-add1fc88f059" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb623-601e-0051-234a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:20 GMT", + "x-ms-client-request-id" : "863704eb-a394-4642-b1f4-add1fc88f059" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklist0blockblobapitestcommitblocklist4295761156", "javablobcommitblocklist1696080081d540c0a1401d8", "javablobcommitblocklist257097141d22dde7a048b7b", "a3a5914a-b315-4bef-85b7-89a1c4ebbbb6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[0].json new file mode 100644 index 000000000000..32a410da448d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[0].json @@ -0,0 +1,114 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistacb7a81083?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" : "95e89cd9-be1e-4e1b-a43a-e11bdd748ea9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561BFD0661F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb890-601e-0051-424a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:23 GMT", + "x-ms-client-request-id" : "95e89cd9-be1e-4e1b-a43a-e11bdd748ea9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistacb7a81083/javablobcommitblocklistac199870908678ca6db34efc", + "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" : "e6c8b6f3-8110-4544-95da-b0624935c218", + "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 20:10:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BFDD6E0F\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb89e-601e-0051-4f4a-67fe5e000000", + "x-ms-client-request-id" : "e6c8b6f3-8110-4544-95da-b0624935c218" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistacb7a81083/javablobcommitblocklistac199870908678ca6db34efc?comp=blocklist", + "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" : "8588cd68-a45d-4f53-8f57-9f4f30388eb8", + "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" : "\"0x8D73561BFEB5349\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb8b0-601e-0051-5f4a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:24 GMT", + "x-ms-client-request-id" : "8588cd68-a45d-4f53-8f57-9f4f30388eb8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccommitblocklistac&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" : "8f003bef-0e34-4a04-84f7-14a54b670694" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb8b9-601e-0051-654a-67fe5e000000", + "Body" : "jtccommitblocklistacjtccommitblocklistac0blockblobapitestcommitblocklistacb7a81083Mon, 09 Sep 2019 20:10:24 GMT\"0x8D73561BFD0661F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:24 GMT", + "x-ms-client-request-id" : "8f003bef-0e34-4a04-84f7-14a54b670694", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistacb7a81083?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" : "0040503e-e16b-4042-9e2e-085d2df80b3a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb8c6-601e-0051-724a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:24 GMT", + "x-ms-client-request-id" : "0040503e-e16b-4042-9e2e-085d2df80b3a" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistac0blockblobapitestcommitblocklistacb7a81083", "javablobcommitblocklistac199870908678ca6db34efc", "javablobcommitblocklistac21480861cea122bccd4af1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[1].json new file mode 100644 index 000000000000..a097e7e43832 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[1].json @@ -0,0 +1,114 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac52364848?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" : "20cdaafc-af64-4224-bc56-6a9fa8c6729c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C0136EBD\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb8d9-601e-0051-054a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:24 GMT", + "x-ms-client-request-id" : "20cdaafc-af64-4224-bc56-6a9fa8c6729c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac52364848/javablobcommitblocklistac1776634f9341bc113945bc", + "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" : "8fb10da3-08fe-44de-874b-4ea4f38623d6", + "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 20:10:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C0216157\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb8ee-601e-0051-184a-67fe5e000000", + "x-ms-client-request-id" : "8fb10da3-08fe-44de-874b-4ea4f38623d6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac52364848/javablobcommitblocklistac1776634f9341bc113945bc?comp=blocklist", + "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" : "d06776e3-1f2d-4815-bc74-4f1f205e3e0a", + "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" : "\"0x8D73561C02E5C08\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb90b-601e-0051-2c4a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:24 GMT", + "x-ms-client-request-id" : "d06776e3-1f2d-4815-bc74-4f1f205e3e0a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccommitblocklistac&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" : "6db1f5a7-23a8-4b4d-8c91-d63c700f29f0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb91a-601e-0051-384a-67fe5e000000", + "Body" : "jtccommitblocklistacjtccommitblocklistac0blockblobapitestcommitblocklistac52364848Mon, 09 Sep 2019 20:10:24 GMT\"0x8D73561C0136EBD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:24 GMT", + "x-ms-client-request-id" : "6db1f5a7-23a8-4b4d-8c91-d63c700f29f0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac52364848?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" : "e1fd0b4c-d2fa-49d7-bb08-e20cba8a1668" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb926-601e-0051-434a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:24 GMT", + "x-ms-client-request-id" : "e1fd0b4c-d2fa-49d7-bb08-e20cba8a1668" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistac0blockblobapitestcommitblocklistac52364848", "javablobcommitblocklistac1776634f9341bc113945bc", "javablobcommitblocklistac233607daa0d54f00e849af" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[2].json new file mode 100644 index 000000000000..530fd4e18327 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[2].json @@ -0,0 +1,114 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac53271430?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" : "e26452bd-4306-4fbc-ae6c-c23630cfb794" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C0558CD9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb944-601e-0051-5b4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:24 GMT", + "x-ms-client-request-id" : "e26452bd-4306-4fbc-ae6c-c23630cfb794" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac53271430/javablobcommitblocklistac1937371e0567be265647b6", + "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" : "0e20193e-61b7-41a5-88fc-1b3bf98251cd", + "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 20:10:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:24 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C062BC16\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb953-601e-0051-674a-67fe5e000000", + "x-ms-client-request-id" : "0e20193e-61b7-41a5-88fc-1b3bf98251cd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac53271430/javablobcommitblocklistac1937371e0567be265647b6?comp=blocklist", + "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" : "24b4eb65-f920-48ee-b65b-8bf63d5be9df", + "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" : "\"0x8D73561C070A15A\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb961-601e-0051-744a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:25 GMT", + "x-ms-client-request-id" : "24b4eb65-f920-48ee-b65b-8bf63d5be9df" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccommitblocklistac&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" : "c98421ec-baa6-45e8-82ea-71a2b859caa4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb979-601e-0051-0a4a-67fe5e000000", + "Body" : "jtccommitblocklistacjtccommitblocklistac0blockblobapitestcommitblocklistac53271430Mon, 09 Sep 2019 20:10:25 GMT\"0x8D73561C0558CD9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:25 GMT", + "x-ms-client-request-id" : "c98421ec-baa6-45e8-82ea-71a2b859caa4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac53271430?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" : "d1522898-0046-49c9-9e6c-0fbf5b66a935" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb987-601e-0051-174a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:25 GMT", + "x-ms-client-request-id" : "d1522898-0046-49c9-9e6c-0fbf5b66a935" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistac0blockblobapitestcommitblocklistac53271430", "javablobcommitblocklistac1937371e0567be265647b6", "javablobcommitblocklistac2770403dca29edb5cb4a9c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[3].json new file mode 100644 index 000000000000..b84e93aad52f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[3].json @@ -0,0 +1,146 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistacc5299372?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" : "fe05fe8b-90bf-4187-9646-c035dad4adc8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C098BC95\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb9a0-601e-0051-2c4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:25 GMT", + "x-ms-client-request-id" : "fe05fe8b-90bf-4187-9646-c035dad4adc8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistacc5299372/javablobcommitblocklistac159846905f4c3842334171", + "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" : "fe3cdd40-79b9-4417-a467-b2dda4d861ce", + "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 20:10:25 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C0A6884C\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb9b3-601e-0051-3d4a-67fe5e000000", + "x-ms-client-request-id" : "fe3cdd40-79b9-4417-a467-b2dda4d861ce" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistacc5299372/javablobcommitblocklistac159846905f4c3842334171", + "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" : "6e74536a-9b81-4f35-b8a2-f9354dd73a28" + }, + "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 20:10:25 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:10:25 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561C0A6884C\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:10:25 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "755bb9cb-601e-0051-524a-67fe5e000000", + "x-ms-client-request-id" : "6e74536a-9b81-4f35-b8a2-f9354dd73a28", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistacc5299372/javablobcommitblocklistac159846905f4c3842334171?comp=blocklist", + "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" : "88fa759a-d8dd-42b3-a8f4-e5cc4176e3fd", + "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" : "\"0x8D73561C0C02F87\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb9e1-601e-0051-654a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:25 GMT", + "x-ms-client-request-id" : "88fa759a-d8dd-42b3-a8f4-e5cc4176e3fd" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccommitblocklistac&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" : "752c64ce-4bf9-428e-818a-58a2c7e59421" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb9eb-601e-0051-6c4a-67fe5e000000", + "Body" : "jtccommitblocklistacjtccommitblocklistac0blockblobapitestcommitblocklistacc5299372Mon, 09 Sep 2019 20:10:25 GMT\"0x8D73561C098BC95\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:25 GMT", + "x-ms-client-request-id" : "752c64ce-4bf9-428e-818a-58a2c7e59421", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistacc5299372?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" : "13ac0a60-aa84-4c8a-a0d4-d46aad06ee61" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb9f8-601e-0051-794a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:25 GMT", + "x-ms-client-request-id" : "13ac0a60-aa84-4c8a-a0d4-d46aad06ee61" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistac0blockblobapitestcommitblocklistacc5299372", "javablobcommitblocklistac159846905f4c3842334171", "javablobcommitblocklistac237790b10c219fdef844ae" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[4].json new file mode 100644 index 000000000000..60eaa3d53b1d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[4].json @@ -0,0 +1,114 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac0dd30969?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" : "c72e6499-30a5-428a-8e05-2b6bb9441ea5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C0E53CD5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bba03-601e-0051-044a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:25 GMT", + "x-ms-client-request-id" : "c72e6499-30a5-428a-8e05-2b6bb9441ea5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac0dd30969/javablobcommitblocklistac101669e38219c2018f427b", + "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" : "779f0003-905a-4b42-a136-97f63dd174f1", + "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 20:10:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C0F1F709\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bba17-601e-0051-164a-67fe5e000000", + "x-ms-client-request-id" : "779f0003-905a-4b42-a136-97f63dd174f1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac0dd30969/javablobcommitblocklistac101669e38219c2018f427b?comp=blocklist", + "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" : "4ed7216e-c4fa-427a-aeed-a5fb8ab88557", + "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" : "\"0x8D73561C0FFDC49\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bba23-601e-0051-214a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:25 GMT", + "x-ms-client-request-id" : "4ed7216e-c4fa-427a-aeed-a5fb8ab88557" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccommitblocklistac&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" : "21a800f6-7a56-42dc-8657-34ffda8855da" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bba29-601e-0051-264a-67fe5e000000", + "Body" : "jtccommitblocklistacjtccommitblocklistac0blockblobapitestcommitblocklistac0dd30969Mon, 09 Sep 2019 20:10:26 GMT\"0x8D73561C0E53CD5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:26 GMT", + "x-ms-client-request-id" : "21a800f6-7a56-42dc-8657-34ffda8855da", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac0dd30969?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" : "e89cebf3-a714-4f78-8aac-fc5508bf0ec8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bba39-601e-0051-364a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:26 GMT", + "x-ms-client-request-id" : "e89cebf3-a714-4f78-8aac-fc5508bf0ec8" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistac0blockblobapitestcommitblocklistac0dd30969", "javablobcommitblocklistac101669e38219c2018f427b", "javablobcommitblocklistac277774bc63d83d25964e1f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[5].json new file mode 100644 index 000000000000..ccebab04d18b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistac[5].json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac42384181?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" : "25a9e5cb-b271-4d3d-9263-ab4ae652ac9e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C1264949\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bba4a-601e-0051-454a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:26 GMT", + "x-ms-client-request-id" : "25a9e5cb-b271-4d3d-9263-ab4ae652ac9e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac42384181/javablobcommitblocklistac19813585db15a471a94380", + "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" : "2ec42703-b8b8-4c67-bd9b-4c44cc54818d", + "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 20:10:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C1339FFA\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bba5e-601e-0051-564a-67fe5e000000", + "x-ms-client-request-id" : "2ec42703-b8b8-4c67-bd9b-4c44cc54818d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac42384181/javablobcommitblocklistac19813585db15a471a94380?comp=lease", + "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" : "d9148cdd-e442-4b03-ab6a-2cd4923b23be" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C1339FFA\"", + "x-ms-lease-id" : "d411f4fa-5888-4f7b-bb50-eb651ea44450", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bba6b-601e-0051-634a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:26 GMT", + "x-ms-client-request-id" : "d9148cdd-e442-4b03-ab6a-2cd4923b23be" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac42384181/javablobcommitblocklistac19813585db15a471a94380?comp=blocklist", + "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" : "00fc862c-c67c-4e33-ab5a-98dcca7faf78", + "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" : "\"0x8D73561C14D954B\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bba77-601e-0051-6f4a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:26 GMT", + "x-ms-client-request-id" : "00fc862c-c67c-4e33-ab5a-98dcca7faf78" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccommitblocklistac&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" : "a44b8aa8-c400-431f-96d3-d219e05758b6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bba89-601e-0051-7d4a-67fe5e000000", + "Body" : "jtccommitblocklistacjtccommitblocklistac0blockblobapitestcommitblocklistac42384181Mon, 09 Sep 2019 20:10:26 GMT\"0x8D73561C1264949\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:26 GMT", + "x-ms-client-request-id" : "a44b8aa8-c400-431f-96d3-d219e05758b6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistac0blockblobapitestcommitblocklistac42384181?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" : "ae08e08a-2718-41c8-8ab9-3b8621a660e3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bba98-601e-0051-0c4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:26 GMT", + "x-ms-client-request-id" : "ae08e08a-2718-41c8-8ab9-3b8621a660e3" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistac0blockblobapitestcommitblocklistac42384181", "javablobcommitblocklistac19813585db15a471a94380", "javablobcommitblocklistac239410e528b3d51edf4fb3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[0].json new file mode 100644 index 000000000000..006504608dc8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[0].json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistacfail0466073ec75f43de13432b?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" : "5e8d9917-ecb8-486b-abb2-9bffd31c64e5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C175FE6C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbaa6-601e-0051-194a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:26 GMT", + "x-ms-client-request-id" : "5e8d9917-ecb8-486b-abb2-9bffd31c64e5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistacfail0466073ec75f43de13432b/javablobcommitblocklistacfail15095088396fa050a947", + "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" : "379ce986-3f7e-4d48-ae54-0ccf3f3a133b", + "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 20:10:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C183CA5C\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bbabf-601e-0051-2c4a-67fe5e000000", + "x-ms-client-request-id" : "379ce986-3f7e-4d48-ae54-0ccf3f3a133b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistacfail0466073ec75f43de13432b/javablobcommitblocklistacfail15095088396fa050a947?comp=blocklist", + "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" : "0f69d880-9218-4133-bb7d-0515b98569c4", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "755bbacd-601e-0051-394a-67fe5e000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:755bbacd-601e-0051-394a-67fe5e000000\nTime:2019-09-09T20:10:27.1841177Z", + "Date" : "Mon, 09 Sep 2019 20:10:26 GMT", + "x-ms-client-request-id" : "0f69d880-9218-4133-bb7d-0515b98569c4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccommitblocklistacfail&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" : "8e8a3ed3-6233-43a4-a6a1-81915cced53d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bbadc-601e-0051-484a-67fe5e000000", + "Body" : "jtccommitblocklistacfailjtccommitblocklistacfail0466073ec75f43de13432bMon, 09 Sep 2019 20:10:27 GMT\"0x8D73561C175FE6C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:26 GMT", + "x-ms-client-request-id" : "8e8a3ed3-6233-43a4-a6a1-81915cced53d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistacfail0466073ec75f43de13432b?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" : "d17a8b75-6ae5-489f-855e-95e28259d43a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bbaeb-601e-0051-574a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:27 GMT", + "x-ms-client-request-id" : "d17a8b75-6ae5-489f-855e-95e28259d43a" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistacfail0466073ec75f43de13432b", "javablobcommitblocklistacfail15095088396fa050a947", "javablobcommitblocklistacfail28201387997564a43443" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[1].json new file mode 100644 index 000000000000..61846b666769 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[1].json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistacfail0469622d1a80a019b0488a?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" : "adcf0a82-0f11-4d5b-af41-c14a0738f59f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C1B7CE5A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbafa-601e-0051-664a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:27 GMT", + "x-ms-client-request-id" : "adcf0a82-0f11-4d5b-af41-c14a0738f59f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistacfail0469622d1a80a019b0488a/javablobcommitblocklistacfail19372396ff04da27bf40", + "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" : "97611a57-52f4-4d3a-a610-168b81f75465", + "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 20:10:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C1C54C1E\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bbb0d-601e-0051-764a-67fe5e000000", + "x-ms-client-request-id" : "97611a57-52f4-4d3a-a610-168b81f75465" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistacfail0469622d1a80a019b0488a/javablobcommitblocklistacfail19372396ff04da27bf40?comp=blocklist", + "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" : "8784ae8f-f662-44a3-9acb-6dcf9757d17d", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "755bbb17-601e-0051-804a-67fe5e000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:755bbb17-601e-0051-804a-67fe5e000000\nTime:2019-09-09T20:10:27.6104209Z", + "Date" : "Mon, 09 Sep 2019 20:10:27 GMT", + "x-ms-client-request-id" : "8784ae8f-f662-44a3-9acb-6dcf9757d17d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccommitblocklistacfail&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" : "9f3639c2-e8d2-4000-be32-6d68cd6fd664" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bbb27-601e-0051-0e4a-67fe5e000000", + "Body" : "jtccommitblocklistacfailjtccommitblocklistacfail0469622d1a80a019b0488aMon, 09 Sep 2019 20:10:27 GMT\"0x8D73561C1B7CE5A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:27 GMT", + "x-ms-client-request-id" : "9f3639c2-e8d2-4000-be32-6d68cd6fd664", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistacfail0469622d1a80a019b0488a?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" : "c5c3376e-ed3b-42cb-bc1c-d69aca980310" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bbb33-601e-0051-1a4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:27 GMT", + "x-ms-client-request-id" : "c5c3376e-ed3b-42cb-bc1c-d69aca980310" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistacfail0469622d1a80a019b0488a", "javablobcommitblocklistacfail19372396ff04da27bf40", "javablobcommitblocklistacfail256247e2833272a5074d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[2].json new file mode 100644 index 000000000000..d1e091d5c77a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[2].json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistacfail0778459f0be8d447144b68?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" : "5f6278d2-56c8-49e6-9415-94a48bfb7e84" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C1F705BD\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbb41-601e-0051-264a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:27 GMT", + "x-ms-client-request-id" : "5f6278d2-56c8-49e6-9415-94a48bfb7e84" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistacfail0778459f0be8d447144b68/javablobcommitblocklistacfail1475258ad2614c908548", + "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" : "80706c12-9c2d-4fa6-b65b-9637d8f8e83a", + "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 20:10:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C203991A\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bbb4f-601e-0051-334a-67fe5e000000", + "x-ms-client-request-id" : "80706c12-9c2d-4fa6-b65b-9637d8f8e83a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistacfail0778459f0be8d447144b68/javablobcommitblocklistacfail1475258ad2614c908548?comp=blocklist", + "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" : "477717af-6969-4457-a787-80fcefbd8e06", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "755bbb5a-601e-0051-3e4a-67fe5e000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:755bbb5a-601e-0051-3e4a-67fe5e000000\nTime:2019-09-09T20:10:28.0117065Z", + "Date" : "Mon, 09 Sep 2019 20:10:27 GMT", + "x-ms-client-request-id" : "477717af-6969-4457-a787-80fcefbd8e06", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccommitblocklistacfail&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" : "c1aa794b-b07b-441c-a666-5abec98bfc05" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bbb66-601e-0051-474a-67fe5e000000", + "Body" : "jtccommitblocklistacfailjtccommitblocklistacfail0778459f0be8d447144b68Mon, 09 Sep 2019 20:10:27 GMT\"0x8D73561C1F705BD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:27 GMT", + "x-ms-client-request-id" : "c1aa794b-b07b-441c-a666-5abec98bfc05", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistacfail0778459f0be8d447144b68?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" : "2233bc65-5c2c-4cd2-bd29-af9fc8717258" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bbb73-601e-0051-534a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:27 GMT", + "x-ms-client-request-id" : "2233bc65-5c2c-4cd2-bd29-af9fc8717258" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistacfail0778459f0be8d447144b68", "javablobcommitblocklistacfail1475258ad2614c908548", "javablobcommitblocklistacfail213408d6bac5a72d694c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[3].json new file mode 100644 index 000000000000..39559ba615c0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[3].json @@ -0,0 +1,145 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistacfail04758516fc98b24a774b65?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" : "7772ea04-1e21-44d1-b8ff-6623309a9f3f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C2348F1F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbb80-601e-0051-5e4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:27 GMT", + "x-ms-client-request-id" : "7772ea04-1e21-44d1-b8ff-6623309a9f3f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistacfail04758516fc98b24a774b65/javablobcommitblocklistacfail17019280bb98d90cdc48", + "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" : "d187b24a-777f-417f-9820-381d801abb89", + "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 20:10:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C24149B5\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bbb93-601e-0051-6e4a-67fe5e000000", + "x-ms-client-request-id" : "d187b24a-777f-417f-9820-381d801abb89" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistacfail04758516fc98b24a774b65/javablobcommitblocklistacfail17019280bb98d90cdc48", + "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" : "7d6af9d8-df53-40e1-9233-7720271e7167" + }, + "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 20:10:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:10:28 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561C24149B5\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:10:28 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "755bbb9c-601e-0051-764a-67fe5e000000", + "x-ms-client-request-id" : "7d6af9d8-df53-40e1-9233-7720271e7167", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistacfail04758516fc98b24a774b65/javablobcommitblocklistacfail17019280bb98d90cdc48?comp=blocklist", + "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" : "360f9ed2-90ab-4a8e-8659-3a2d3455f6f8", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "755bbba4-601e-0051-7e4a-67fe5e000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:755bbba4-601e-0051-7e4a-67fe5e000000\nTime:2019-09-09T20:10:28.4970515Z", + "Date" : "Mon, 09 Sep 2019 20:10:28 GMT", + "x-ms-client-request-id" : "360f9ed2-90ab-4a8e-8659-3a2d3455f6f8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccommitblocklistacfail&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" : "07193d70-ef6d-46f5-b2f2-05fa8f8cba12" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bbbb2-601e-0051-0a4a-67fe5e000000", + "Body" : "jtccommitblocklistacfailjtccommitblocklistacfail04758516fc98b24a774b65Mon, 09 Sep 2019 20:10:28 GMT\"0x8D73561C2348F1F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:28 GMT", + "x-ms-client-request-id" : "07193d70-ef6d-46f5-b2f2-05fa8f8cba12", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistacfail04758516fc98b24a774b65?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" : "164d98ae-afb6-43aa-b8bb-6793027b9a08" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bbbd1-601e-0051-274a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:28 GMT", + "x-ms-client-request-id" : "164d98ae-afb6-43aa-b8bb-6793027b9a08" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistacfail04758516fc98b24a774b65", "javablobcommitblocklistacfail17019280bb98d90cdc48", "javablobcommitblocklistacfail257949957dce26141b4f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[4].json new file mode 100644 index 000000000000..b6d96fed69e6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistacfail[4].json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistacfail04227548eb9c94d31a403f?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" : "25357e4a-e2a7-4f63-9819-31473dc7a4d5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C2807303\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbbdf-601e-0051-354a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:28 GMT", + "x-ms-client-request-id" : "25357e4a-e2a7-4f63-9819-31473dc7a4d5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistacfail04227548eb9c94d31a403f/javablobcommitblocklistacfail1741062b86503ce7b847", + "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" : "d38aaf82-e734-4c65-a7e8-58a2507e06ca", + "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 20:10:28 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:28 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C28E8D84\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bbbe4-601e-0051-394a-67fe5e000000", + "x-ms-client-request-id" : "d38aaf82-e734-4c65-a7e8-58a2507e06ca" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistacfail04227548eb9c94d31a403f/javablobcommitblocklistacfail1741062b86503ce7b847?comp=lease", + "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" : "7ebdb146-a91d-461c-a29a-b802ea5c7d1d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C28E8D84\"", + "x-ms-lease-id" : "eb88fd33-9f73-4d6e-917d-2d1d66d18e0a", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbbeb-601e-0051-3f4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:28 GMT", + "x-ms-client-request-id" : "7ebdb146-a91d-461c-a29a-b802ea5c7d1d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistacfail04227548eb9c94d31a403f/javablobcommitblocklistacfail1741062b86503ce7b847?comp=blocklist", + "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" : "ded24c19-ce96-462d-ab48-cc6a500ba716", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "755bbbf5-601e-0051-494a-67fe5e000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:755bbbf5-601e-0051-494a-67fe5e000000\nTime:2019-09-09T20:10:29.0064140Z", + "Date" : "Mon, 09 Sep 2019 20:10:28 GMT", + "x-ms-client-request-id" : "ded24c19-ce96-462d-ab48-cc6a500ba716", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccommitblocklistacfail&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" : "cf38d177-a759-4429-bb36-c99ef6d65431" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bbbfb-601e-0051-4e4a-67fe5e000000", + "Body" : "jtccommitblocklistacfailjtccommitblocklistacfail04227548eb9c94d31a403fMon, 09 Sep 2019 20:10:28 GMT\"0x8D73561C2807303\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:28 GMT", + "x-ms-client-request-id" : "cf38d177-a759-4429-bb36-c99ef6d65431", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistacfail04227548eb9c94d31a403f?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" : "c1b077a0-48a8-49a0-932f-fa9a25cf78e7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bbc21-601e-0051-6d4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:28 GMT", + "x-ms-client-request-id" : "c1b077a0-48a8-49a0-932f-fa9a25cf78e7" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistacfail04227548eb9c94d31a403f", "javablobcommitblocklistacfail1741062b86503ce7b847", "javablobcommitblocklistacfail299556c36280928fb743" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklisterror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklisterror.json new file mode 100644 index 000000000000..c0c5f2e698c9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklisterror.json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklisterror0223858a36218f427a48df9?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" : "65d1bbc3-e551-4d72-86ae-fb03e589cc55" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C2CCA515\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbc3a-601e-0051-064a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:28 GMT", + "x-ms-client-request-id" : "65d1bbc3-e551-4d72-86ae-fb03e589cc55" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklisterror0223858a36218f427a48df9/javablobcommitblocklisterror11377908c766f515b747", + "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" : "492c7aef-ba48-4101-b650-d69a72e1ca6f", + "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 20:10:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C2D938C7\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bbc44-601e-0051-0f4a-67fe5e000000", + "x-ms-client-request-id" : "492c7aef-ba48-4101-b650-d69a72e1ca6f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklisterror0223858a36218f427a48df9/javablobcommitblocklisterror397923910d2873c19449?comp=blocklist", + "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" : "8c5046bb-f093-4ee8-9d7e-9500f8a06162", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "326", + "StatusCode" : "400", + "x-ms-request-id" : "755bbc53-601e-0051-1c4a-67fe5e000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:755bbc53-601e-0051-1c4a-67fe5e000000\nTime:2019-09-09T20:10:29.4147040Zx-ms-lease-idgarbage", + "Date" : "Mon, 09 Sep 2019 20:10:29 GMT", + "x-ms-client-request-id" : "8c5046bb-f093-4ee8-9d7e-9500f8a06162", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccommitblocklisterror&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" : "dc072b03-8750-40b1-a2be-14f30a0bb33d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bbc66-601e-0051-2c4a-67fe5e000000", + "Body" : "jtccommitblocklisterrorjtccommitblocklisterror0223858a36218f427a48df9Mon, 09 Sep 2019 20:10:29 GMT\"0x8D73561C2CCA515\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:29 GMT", + "x-ms-client-request-id" : "dc072b03-8750-40b1-a2be-14f30a0bb33d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklisterror0223858a36218f427a48df9?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" : "d35604e5-31be-4044-9d97-4ff1da3fbf52" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bbc71-601e-0051-354a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:29 GMT", + "x-ms-client-request-id" : "d35604e5-31be-4044-9d97-4ff1da3fbf52" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklisterror0223858a36218f427a48df9", "javablobcommitblocklisterror11377908c766f515b747", "javablobcommitblocklisterror265852c87a50e0413347", "javablobcommitblocklisterror397923910d2873c19449" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistheaders[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistheaders[0].json new file mode 100644 index 000000000000..d7a242d26a39 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistheaders[0].json @@ -0,0 +1,167 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistheaders022620414ceaee977244af?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" : "df0e632f-df7b-4ab5-91cc-9bdd15da4591" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561BE78FC05\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb722-601e-0051-014a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:21 GMT", + "x-ms-client-request-id" : "df0e632f-df7b-4ab5-91cc-9bdd15da4591" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistheaders022620414ceaee977244af/javablobcommitblocklistheaders118649038bc62da60b4", + "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" : "58e33568-ea67-47f9-bde8-1d9e2e974489", + "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 20:10:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BE85DC86\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb732-601e-0051-0f4a-67fe5e000000", + "x-ms-client-request-id" : "58e33568-ea67-47f9-bde8-1d9e2e974489" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistheaders022620414ceaee977244af/javablobcommitblocklistheaders118649038bc62da60b4?blockid=YTYzZDE4YzctMWJlYi00N2NlLWI5OWYtYzk1NDE4YjM3N2Fm&comp=block", + "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" : "15390e4c-f159-4664-8390-1e51613aaea4", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb73b-601e-0051-164a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:21 GMT", + "x-ms-client-request-id" : "15390e4c-f159-4664-8390-1e51613aaea4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistheaders022620414ceaee977244af/javablobcommitblocklistheaders118649038bc62da60b4?comp=blocklist", + "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" : "bb223a51-d4fd-4103-9ace-938a2866d93d", + "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" : "\"0x8D73561BEA0BC83\"", + "x-ms-content-crc64" : "d315XbuZeq0=", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb74f-601e-0051-254a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:21 GMT", + "x-ms-client-request-id" : "bb223a51-d4fd-4103-9ace-938a2866d93d" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistheaders022620414ceaee977244af/javablobcommitblocklistheaders118649038bc62da60b4", + "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" : "9c5849d9-dc87-4768-a060-1d571c0b6cc7" + }, + "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 20:10:22 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:10:22 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561BEA0BC83\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:10:22 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "755bb759-601e-0051-2d4a-67fe5e000000", + "x-ms-client-request-id" : "9c5849d9-dc87-4768-a060-1d571c0b6cc7", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccommitblocklistheaders&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" : "d09d825c-9f55-4c16-a3a0-988184d442c1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb771-601e-0051-424a-67fe5e000000", + "Body" : "jtccommitblocklistheadersjtccommitblocklistheaders022620414ceaee977244afMon, 09 Sep 2019 20:10:21 GMT\"0x8D73561BE78FC05\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:22 GMT", + "x-ms-client-request-id" : "d09d825c-9f55-4c16-a3a0-988184d442c1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistheaders022620414ceaee977244af?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" : "72df591d-07db-4f0f-bcfc-a0c3eb82ff7b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb781-601e-0051-524a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:22 GMT", + "x-ms-client-request-id" : "72df591d-07db-4f0f-bcfc-a0c3eb82ff7b" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistheaders022620414ceaee977244af", "javablobcommitblocklistheaders118649038bc62da60b4", "javablobcommitblocklistheaders2261714018fd3122c14", "a63d18c7-1beb-47ce-b99f-c95418b377af" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistheaders[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistheaders[1].json new file mode 100644 index 000000000000..e2e28ccfc7be --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistheaders[1].json @@ -0,0 +1,172 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistheaders01483299c9fbc892fe42c3?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" : "9c7df112-2256-4a20-967e-962b731e2ac4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561BED3D6BE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb78c-601e-0051-594a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:22 GMT", + "x-ms-client-request-id" : "9c7df112-2256-4a20-967e-962b731e2ac4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistheaders01483299c9fbc892fe42c3/javablobcommitblocklistheaders14933695f6648d432f4", + "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" : "8e5dec4e-bc75-4f5a-88f0-8a0206932cea", + "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 20:10:22 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BEE28C7C\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb7a1-601e-0051-6c4a-67fe5e000000", + "x-ms-client-request-id" : "8e5dec4e-bc75-4f5a-88f0-8a0206932cea" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistheaders01483299c9fbc892fe42c3/javablobcommitblocklistheaders14933695f6648d432f4?blockid=MzZmYjc1NGItYTc1YS00NzUwLWFjNDMtZjE1NzdkZWM4Mjk2&comp=block", + "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" : "5ed18978-4af9-4821-ab75-82b85d31fcf3", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb7b4-601e-0051-7d4a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:22 GMT", + "x-ms-client-request-id" : "5ed18978-4af9-4821-ab75-82b85d31fcf3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistheaders01483299c9fbc892fe42c3/javablobcommitblocklistheaders14933695f6648d432f4?comp=blocklist", + "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" : "59dbe52a-ee0a-4218-8e6e-ff89f12b5d33", + "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" : "\"0x8D73561BEFD4558\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb7c1-601e-0051-094a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:22 GMT", + "x-ms-client-request-id" : "59dbe52a-ee0a-4218-8e6e-ff89f12b5d33", + "Content-MD5" : "lTJhPXjKEbczcqcGd9gfHw==" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistheaders01483299c9fbc892fe42c3/javablobcommitblocklistheaders14933695f6648d432f4", + "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" : "6c1ab886-0ec9-48ad-b660-384e182091d7" + }, + "Response" : { + "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 20:10:22 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "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 20:10:22 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "755bb7cf-601e-0051-174a-67fe5e000000", + "Content-Type" : "type", + "x-ms-version" : "2019-02-02", + "Date" : "Mon, 09 Sep 2019 20:10:22 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "control", + "ETag" : "\"0x8D73561BEFD4558\"", + "Content-Disposition" : "disposition", + "x-ms-client-request-id" : "6c1ab886-0ec9-48ad-b660-384e182091d7", + "Content-Language" : "language" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccommitblocklistheaders&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" : "b25c8f36-7a31-4005-8a20-72c11a2ca5be" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb7d8-601e-0051-1f4a-67fe5e000000", + "Body" : "jtccommitblocklistheadersjtccommitblocklistheaders01483299c9fbc892fe42c3Mon, 09 Sep 2019 20:10:22 GMT\"0x8D73561BED3D6BE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:22 GMT", + "x-ms-client-request-id" : "b25c8f36-7a31-4005-8a20-72c11a2ca5be", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistheaders01483299c9fbc892fe42c3?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" : "78e2aef6-d834-4d2c-ab24-40862a425362" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb7e3-601e-0051-294a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:22 GMT", + "x-ms-client-request-id" : "78e2aef6-d834-4d2c-ab24-40862a425362" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistheaders01483299c9fbc892fe42c3", "javablobcommitblocklistheaders14933695f6648d432f4", "javablobcommitblocklistheaders2742233a16e3c4bf584", "36fb754b-a75a-4750-ac43-f1577dec8296" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistmetadata[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistmetadata[0].json new file mode 100644 index 000000000000..aa39ff8d2e85 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistmetadata[0].json @@ -0,0 +1,145 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistmetadata04471442040e2c9a054e2?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" : "6212769a-c253-4d86-9dc4-77ddd0525406" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561BF323488\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb7f2-601e-0051-364a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:22 GMT", + "x-ms-client-request-id" : "6212769a-c253-4d86-9dc4-77ddd0525406" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistmetadata04471442040e2c9a054e2/javablobcommitblocklistmetadata1398582bef411bd95e4", + "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" : "e7ae06d9-cfd9-402e-9b81-4d7f415afcf9", + "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 20:10:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BF402710\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb804-601e-0051-454a-67fe5e000000", + "x-ms-client-request-id" : "e7ae06d9-cfd9-402e-9b81-4d7f415afcf9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistmetadata04471442040e2c9a054e2/javablobcommitblocklistmetadata1398582bef411bd95e4?comp=blocklist", + "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" : "6e5e10e0-a863-4e9f-9a9c-96daaa3f9222", + "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" : "\"0x8D73561BF4E0C43\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb814-601e-0051-544a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:23 GMT", + "x-ms-client-request-id" : "6e5e10e0-a863-4e9f-9a9c-96daaa3f9222" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistmetadata04471442040e2c9a054e2/javablobcommitblocklistmetadata1398582bef411bd95e4", + "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" : "c809dbff-6ed0-440b-b5ac-296706ec0bea" + }, + "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 20:10:23 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:10:23 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561BF4E0C43\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:10:23 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "755bb820-601e-0051-5f4a-67fe5e000000", + "x-ms-client-request-id" : "c809dbff-6ed0-440b-b5ac-296706ec0bea", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccommitblocklistmetadata&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" : "6ce3f5d7-0ba7-42d7-9c35-71e1242c32e8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb827-601e-0051-664a-67fe5e000000", + "Body" : "jtccommitblocklistmetadatajtccommitblocklistmetadata04471442040e2c9a054e2Mon, 09 Sep 2019 20:10:23 GMT\"0x8D73561BF323488\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:23 GMT", + "x-ms-client-request-id" : "6ce3f5d7-0ba7-42d7-9c35-71e1242c32e8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistmetadata04471442040e2c9a054e2?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" : "74f6ee2f-6128-475a-97f8-dc2a4dc941e9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb83a-601e-0051-774a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:23 GMT", + "x-ms-client-request-id" : "74f6ee2f-6128-475a-97f8-dc2a4dc941e9" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistmetadata04471442040e2c9a054e2", "javablobcommitblocklistmetadata1398582bef411bd95e4", "javablobcommitblocklistmetadata255083f00204e78bb64" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistmetadata[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistmetadata[1].json new file mode 100644 index 000000000000..5f54f8c6c257 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistmetadata[1].json @@ -0,0 +1,147 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistmetadata094210f18738b8b90b4a5?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" : "f10367af-8622-4197-94d5-6e2fff167d07" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561BF825EF3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb84a-601e-0051-064a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:23 GMT", + "x-ms-client-request-id" : "f10367af-8622-4197-94d5-6e2fff167d07" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistmetadata094210f18738b8b90b4a5/javablobcommitblocklistmetadata148684ebf77afeace34", + "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" : "3a772cf2-9b52-45c0-b809-ac277a7deef1", + "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 20:10:23 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:23 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BF902A5D\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb854-601e-0051-0e4a-67fe5e000000", + "x-ms-client-request-id" : "3a772cf2-9b52-45c0-b809-ac277a7deef1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistmetadata094210f18738b8b90b4a5/javablobcommitblocklistmetadata148684ebf77afeace34?comp=blocklist", + "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" : "d751e81c-abd2-4be7-a2f4-158b9c6c2e4d", + "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" : "\"0x8D73561BF9E0F97\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb860-601e-0051-184a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:23 GMT", + "x-ms-client-request-id" : "d751e81c-abd2-4be7-a2f4-158b9c6c2e4d" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistmetadata094210f18738b8b90b4a5/javablobcommitblocklistmetadata148684ebf77afeace34", + "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" : "67981b4c-1dd6-4b6e-9fad-b7e980b961de" + }, + "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 20:10:23 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:10:23 GMT", + "x-ms-meta-foo" : "bar", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561BF9E0F97\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:10:23 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "755bb86b-601e-0051-234a-67fe5e000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "67981b4c-1dd6-4b6e-9fad-b7e980b961de", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccommitblocklistmetadata&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" : "4ab2682c-11b0-4913-bf71-4fadbe82a004" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb877-601e-0051-2d4a-67fe5e000000", + "Body" : "jtccommitblocklistmetadatajtccommitblocklistmetadata094210f18738b8b90b4a5Mon, 09 Sep 2019 20:10:23 GMT\"0x8D73561BF825EF3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:23 GMT", + "x-ms-client-request-id" : "4ab2682c-11b0-4913-bf71-4fadbe82a004", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistmetadata094210f18738b8b90b4a5?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" : "c6c98660-0965-4ff7-82bc-d90f2dabc4d1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb883-601e-0051-384a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:23 GMT", + "x-ms-client-request-id" : "c6c98660-0965-4ff7-82bc-d90f2dabc4d1" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistmetadata094210f18738b8b90b4a5", "javablobcommitblocklistmetadata148684ebf77afeace34", "javablobcommitblocklistmetadata2958567bf370421df34" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistmin.json new file mode 100644 index 000000000000..4cdc200e166d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistmin.json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistmin0863904921d4c746834aab89?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" : "20f2d97f-6377-4b44-aa15-551d4bf359d9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561BDC25C00\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb632-601e-0051-314a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:20 GMT", + "x-ms-client-request-id" : "20f2d97f-6377-4b44-aa15-551d4bf359d9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistmin0863904921d4c746834aab89/javablobcommitblocklistmin15385554bfd34a13fc480", + "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" : "c8e9f126-c6da-43a9-a5c2-7de7b4e23d94", + "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 20:10:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:20 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BDCFFFAB\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb640-601e-0051-3c4a-67fe5e000000", + "x-ms-client-request-id" : "c8e9f126-c6da-43a9-a5c2-7de7b4e23d94" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistmin0863904921d4c746834aab89/javablobcommitblocklistmin15385554bfd34a13fc480?blockid=Y2E1NjlmNjItZmZlNy00ODJkLTlhNjktODEyMWFhODZhNjM3&comp=block", + "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" : "3e129c7b-8508-47a3-9f31-fa1f54970960", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb649-601e-0051-454a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:20 GMT", + "x-ms-client-request-id" : "3e129c7b-8508-47a3-9f31-fa1f54970960" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistmin0863904921d4c746834aab89/javablobcommitblocklistmin15385554bfd34a13fc480?comp=blocklist", + "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" : "c02eaed9-2aa8-4aac-81b8-aff52f7f9cf3", + "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" : "\"0x8D73561BDE90A85\"", + "x-ms-content-crc64" : "nhwiqkWQZ1Y=", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb656-601e-0051-504a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:20 GMT", + "x-ms-client-request-id" : "c02eaed9-2aa8-4aac-81b8-aff52f7f9cf3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccommitblocklistmin&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" : "bd6d3f15-3028-4076-b8a1-01821a4a2926" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb66d-601e-0051-644a-67fe5e000000", + "Body" : "jtccommitblocklistminjtccommitblocklistmin0863904921d4c746834aab89Mon, 09 Sep 2019 20:10:20 GMT\"0x8D73561BDC25C00\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:20 GMT", + "x-ms-client-request-id" : "bd6d3f15-3028-4076-b8a1-01821a4a2926", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistmin0863904921d4c746834aab89?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" : "5b7268ec-4141-4893-9ff0-9454a0d012dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb67b-601e-0051-6f4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:20 GMT", + "x-ms-client-request-id" : "5b7268ec-4141-4893-9ff0-9454a0d012dc" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistmin0863904921d4c746834aab89", "javablobcommitblocklistmin15385554bfd34a13fc480", "javablobcommitblocklistmin2273022742cdcb6e2747c", "ca569f62-ffe7-482d-9a69-8121aa86a637" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistnull.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistnull.json new file mode 100644 index 000000000000..f490824449ee --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestcommitblocklistnull.json @@ -0,0 +1,114 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistnull063085ddfb824d7b5b43d09?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" : "4aadf67d-b8ac-42b7-b465-d7711ab700af" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561BE125F5B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb68d-601e-0051-7e4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:21 GMT", + "x-ms-client-request-id" : "4aadf67d-b8ac-42b7-b465-d7711ab700af" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistnull063085ddfb824d7b5b43d09/javablobcommitblocklistnull117699dc1d52b4326b4bb", + "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" : "70beaa3c-d43a-418a-8ad4-5502b5feba9f", + "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 20:10:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:21 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BE4321F4\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb6e9-601e-0051-4d4a-67fe5e000000", + "x-ms-client-request-id" : "70beaa3c-d43a-418a-8ad4-5502b5feba9f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistnull063085ddfb824d7b5b43d09/javablobcommitblocklistnull117699dc1d52b4326b4bb?comp=blocklist", + "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" : "64946d2c-fb63-4c01-85fd-90220c677ff8", + "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" : "\"0x8D73561BE510734\"", + "x-ms-content-crc64" : "p1vsGtjjPsk=", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb6f5-601e-0051-594a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:21 GMT", + "x-ms-client-request-id" : "64946d2c-fb63-4c01-85fd-90220c677ff8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccommitblocklistnull&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" : "9e692472-8bd6-445d-96f7-6d29b217f082" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb705-601e-0051-674a-67fe5e000000", + "Body" : "jtccommitblocklistnulljtccommitblocklistnull063085ddfb824d7b5b43d09Mon, 09 Sep 2019 20:10:21 GMT\"0x8D73561BE125F5B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:21 GMT", + "x-ms-client-request-id" : "9e692472-8bd6-445d-96f7-6d29b217f082", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccommitblocklistnull063085ddfb824d7b5b43d09?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" : "bdfaa190-fef2-4957-ad36-4297297143b3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb712-601e-0051-744a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:21 GMT", + "x-ms-client-request-id" : "bdfaa190-fef2-4957-ad36-4297297143b3" + }, + "Exception" : null + } ], + "variables" : [ "jtccommitblocklistnull063085ddfb824d7b5b43d09", "javablobcommitblocklistnull117699dc1d52b4326b4bb", "javablobcommitblocklistnull26835312c6179def4f412" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklist.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklist.json new file mode 100644 index 000000000000..22c3e68f62da --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklist.json @@ -0,0 +1,226 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist0b8352809c1d8?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" : "a455a285-02ea-4535-88e5-fa15a3f2575e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C30C9FE9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbc7a-601e-0051-3e4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:29 GMT", + "x-ms-client-request-id" : "a455a285-02ea-4535-88e5-fa15a3f2575e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist0b8352809c1d8/javablobgetblocklist1blockblobapitestgetblocklist0b8639533b4", + "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" : "658ca38f-cd9e-467d-9fa1-dce5211ff885", + "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 20:10:29 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C31933B7\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bbc87-601e-0051-4a4a-67fe5e000000", + "x-ms-client-request-id" : "658ca38f-cd9e-467d-9fa1-dce5211ff885" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist0b8352809c1d8/javablobgetblocklist1blockblobapitestgetblocklist0b8639533b4?blockid=M2YwYmYwMDUtZTAyZi00NjJlLWE1NjctMDg3MGNjY2YyMDFh&comp=block", + "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" : "4879421a-0fae-4716-a015-89a2384c8596", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbc9d-601e-0051-5e4a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:29 GMT", + "x-ms-client-request-id" : "4879421a-0fae-4716-a015-89a2384c8596" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist0b8352809c1d8/javablobgetblocklist1blockblobapitestgetblocklist0b8639533b4?blockid=ZGRmNDY2NGQtZDliMy00NzEzLWIzMTgtZjA0ZTBjMDZhMzdm&comp=block", + "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" : "4b236e1e-1514-4a6d-b1e6-a26f5ab475f4", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbca9-601e-0051-694a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:29 GMT", + "x-ms-client-request-id" : "4b236e1e-1514-4a6d-b1e6-a26f5ab475f4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist0b8352809c1d8/javablobgetblocklist1blockblobapitestgetblocklist0b8639533b4?comp=blocklist", + "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" : "2fde3463-1585-4fff-b683-d4cbfe01f7c2", + "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" : "\"0x8D73561C33FFCBC\"", + "x-ms-content-crc64" : "jN3BMXnN2Aw=", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbcb2-601e-0051-724a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:29 GMT", + "x-ms-client-request-id" : "2fde3463-1585-4fff-b683-d4cbfe01f7c2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist0b8352809c1d8/javablobgetblocklist1blockblobapitestgetblocklist0b8639533b4?blockid=MTNkZmZiY2ItNTEyZi00M2QwLWEwODAtYmZhY2RkZWFhYTQ3&comp=block", + "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" : "bf014efb-cf2c-44a6-8792-9919b9fc3690", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbcbe-601e-0051-7d4a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:29 GMT", + "x-ms-client-request-id" : "bf014efb-cf2c-44a6-8792-9919b9fc3690" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist0b8352809c1d8/javablobgetblocklist1blockblobapitestgetblocklist0b8639533b4?blockid=ZWM4ZTdhOTQtNGYxNS00YzdkLThlOTktODBjNjQ3ZWY0ZWU0&comp=block", + "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" : "fa808085-d737-45ae-930c-5c7ea83a4c4c", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbcca-601e-0051-094a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:29 GMT", + "x-ms-client-request-id" : "fa808085-d737-45ae-930c-5c7ea83a4c4c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist0b8352809c1d8/javablobgetblocklist1blockblobapitestgetblocklist0b8639533b4?blocklisttype=all&comp=blocklist", + "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" : "3c7491fb-7d97-44c1-af72-1eb8bfdc2d3e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "14", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:10:29 GMT", + "ETag" : "\"0x8D73561C33FFCBC\"", + "x-ms-request-id" : "755bbcd1-601e-0051-104a-67fe5e000000", + "Body" : "M2YwYmYwMDUtZTAyZi00NjJlLWE1NjctMDg3MGNjY2YyMDFh7ZGRmNDY2NGQtZDliMy00NzEzLWIzMTgtZjA0ZTBjMDZhMzdm7MTNkZmZiY2ItNTEyZi00M2QwLWEwODAtYmZhY2RkZWFhYTQ37ZWM4ZTdhOTQtNGYxNS00YzdkLThlOTktODBjNjQ3ZWY0ZWU07", + "x-ms-client-request-id" : "3c7491fb-7d97-44c1-af72-1eb8bfdc2d3e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetblocklist&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" : "af5dcf56-14b4-4302-be61-f178a4ee20c4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bbce4-601e-0051-214a-67fe5e000000", + "Body" : "jtcgetblocklistjtcgetblocklist0blockblobapitestgetblocklist0b8352809c1d8Mon, 09 Sep 2019 20:10:29 GMT\"0x8D73561C30C9FE9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:30 GMT", + "x-ms-client-request-id" : "af5dcf56-14b4-4302-be61-f178a4ee20c4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklist0blockblobapitestgetblocklist0b8352809c1d8?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" : "0d38f519-c3eb-4c6e-856a-ff80071b47c3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bbcf5-601e-0051-304a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:30 GMT", + "x-ms-client-request-id" : "0d38f519-c3eb-4c6e-856a-ff80071b47c3" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklist0blockblobapitestgetblocklist0b8352809c1d8", "javablobgetblocklist1blockblobapitestgetblocklist0b8639533b4", "javablobgetblocklist2blockblobapitestgetblocklist0b844440b48", "3f0bf005-e02f-462e-a567-0870cccf201a", "ddf4664d-d9b3-4713-b318-f04e0c06a37f", "13dffbcb-512f-43d0-a080-bfacddeaaa47", "ec8e7a94-4f15-4c7d-8e99-80c647ef4ee4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisterror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisterror.json new file mode 100644 index 000000000000..783a9e6be8fa --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisterror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisterror0blockblobapitestgetblocklisterror6b428810?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" : "5c9112a6-6a0d-4f1d-a702-e665acc277a9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C5E8318B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbfa9-601e-0051-294a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:34 GMT", + "x-ms-client-request-id" : "5c9112a6-6a0d-4f1d-a702-e665acc277a9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisterror0blockblobapitestgetblocklisterror6b428810/javablobgetblocklisterror15781202d86dbfde664ac9", + "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" : "71076bde-7254-45cb-aee8-49041f653f53", + "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 20:10:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:34 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C5F5FF0D\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bbfb3-601e-0051-314a-67fe5e000000", + "x-ms-client-request-id" : "71076bde-7254-45cb-aee8-49041f653f53" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisterror0blockblobapitestgetblocklisterror6b428810/javablobgetblocklisterror337028817d80d9002945e8?blocklisttype=all&comp=blocklist", + "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" : "6d941bd0-fa2f-4a1a-8401-29af3f7ed5f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "BlobNotFound", + "retry-after" : "0", + "Content-Length" : "215", + "StatusCode" : "404", + "x-ms-request-id" : "755bbfba-601e-0051-364a-67fe5e000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:755bbfba-601e-0051-364a-67fe5e000000\nTime:2019-09-09T20:10:34.6354179Z", + "Date" : "Mon, 09 Sep 2019 20:10:34 GMT", + "x-ms-client-request-id" : "6d941bd0-fa2f-4a1a-8401-29af3f7ed5f2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetblocklisterror&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" : "56e1b34a-973c-4f26-8509-2d3f35532370" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bbfc3-601e-0051-3e4a-67fe5e000000", + "Body" : "jtcgetblocklisterrorjtcgetblocklisterror0blockblobapitestgetblocklisterror6b428810Mon, 09 Sep 2019 20:10:34 GMT\"0x8D73561C5E8318B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:34 GMT", + "x-ms-client-request-id" : "56e1b34a-973c-4f26-8509-2d3f35532370", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisterror0blockblobapitestgetblocklisterror6b428810?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" : "1a5b3ae5-c295-41c6-a7f1-c3aaf461ae79" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bbfcd-601e-0051-484a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:34 GMT", + "x-ms-client-request-id" : "1a5b3ae5-c295-41c6-a7f1-c3aaf461ae79" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklisterror0blockblobapitestgetblocklisterror6b428810", "javablobgetblocklisterror15781202d86dbfde664ac9", "javablobgetblocklisterror217107f770bd41070a4e77", "javablobgetblocklisterror337028817d80d9002945e8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklistlease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklistlease.json new file mode 100644 index 000000000000..9d55fa1dfa4a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklistlease.json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklistlease0blockblobapitestgetblocklistlease49716864?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" : "b455ff5f-1295-4a6c-961b-9d8313d01dad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C5539EB0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbefc-601e-0051-084a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:33 GMT", + "x-ms-client-request-id" : "b455ff5f-1295-4a6c-961b-9d8313d01dad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklistlease0blockblobapitestgetblocklistlease49716864/javablobgetblocklistlease14088059de18b96e2641b7", + "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" : "7c455192-bc23-4066-9136-5d5288340799", + "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 20:10:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:33 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C560CF97\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bbf0c-601e-0051-174a-67fe5e000000", + "x-ms-client-request-id" : "7c455192-bc23-4066-9136-5d5288340799" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklistlease0blockblobapitestgetblocklistlease49716864/javablobgetblocklistlease14088059de18b96e2641b7?comp=lease", + "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" : "1178a903-5d03-449a-b720-18e8d28cad9c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C560CF97\"", + "x-ms-lease-id" : "1633a932-c6c5-4c42-b63f-7a50cb5ec636", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbf17-601e-0051-224a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:33 GMT", + "x-ms-client-request-id" : "1178a903-5d03-449a-b720-18e8d28cad9c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklistlease0blockblobapitestgetblocklistlease49716864/javablobgetblocklistlease14088059de18b96e2641b7?blocklisttype=all&comp=blocklist", + "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" : "5a5e99dc-4a98-4785-8f67-8094650483de" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "7", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:33 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:10:33 GMT", + "ETag" : "\"0x8D73561C560CF97\"", + "x-ms-request-id" : "755bbf23-601e-0051-2e4a-67fe5e000000", + "Body" : "", + "x-ms-client-request-id" : "5a5e99dc-4a98-4785-8f67-8094650483de", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetblocklistlease&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" : "9bee0ae0-2171-48f7-94f9-db56f433e81b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bbf30-601e-0051-3b4a-67fe5e000000", + "Body" : "jtcgetblocklistleasejtcgetblocklistlease0blockblobapitestgetblocklistlease49716864Mon, 09 Sep 2019 20:10:33 GMT\"0x8D73561C5539EB0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:33 GMT", + "x-ms-client-request-id" : "9bee0ae0-2171-48f7-94f9-db56f433e81b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklistlease0blockblobapitestgetblocklistlease49716864?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" : "291e14a8-9bb2-4dbf-8918-6b857b190cce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bbf3b-601e-0051-444a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:33 GMT", + "x-ms-client-request-id" : "291e14a8-9bb2-4dbf-8918-6b857b190cce" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklistlease0blockblobapitestgetblocklistlease49716864", "javablobgetblocklistlease14088059de18b96e2641b7", "javablobgetblocklistlease2153870347eb29879b45ef" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklistleasefail.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklistleasefail.json new file mode 100644 index 000000000000..33a0e50e61f2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklistleasefail.json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklistleasefail08686849df67420fd149ab?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" : "b5134a92-2503-48ac-922b-96247c58bd9a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C59E49DF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbf47-601e-0051-504a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:33 GMT", + "x-ms-client-request-id" : "b5134a92-2503-48ac-922b-96247c58bd9a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklistleasefail08686849df67420fd149ab/javablobgetblocklistleasefail116548c8ee65802af54a", + "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" : "3171a402-93fa-4e9a-9339-5a0ae1a1ec3e", + "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 20:10:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:33 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C5AADE86\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bbf5f-601e-0051-644a-67fe5e000000", + "x-ms-client-request-id" : "3171a402-93fa-4e9a-9339-5a0ae1a1ec3e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklistleasefail08686849df67420fd149ab/javablobgetblocklistleasefail116548c8ee65802af54a?comp=lease", + "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" : "058c5f6a-90f4-4de2-9798-f24a0e748007" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C5AADE86\"", + "x-ms-lease-id" : "93098735-9a38-4427-aa2e-215b2e9b5700", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbf73-601e-0051-784a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:33 GMT", + "x-ms-client-request-id" : "058c5f6a-90f4-4de2-9798-f24a0e748007" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklistleasefail08686849df67420fd149ab/javablobgetblocklistleasefail116548c8ee65802af54a?blocklisttype=all&comp=blocklist", + "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" : "7af0f94e-74fd-44c5-ab8f-94151992d86a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "755bbf7f-601e-0051-034a-67fe5e000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:755bbf7f-601e-0051-034a-67fe5e000000\nTime:2019-09-09T20:10:34.2211233Z", + "Date" : "Mon, 09 Sep 2019 20:10:33 GMT", + "x-ms-client-request-id" : "7af0f94e-74fd-44c5-ab8f-94151992d86a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetblocklistleasefail&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" : "63d96b41-cdd0-4f2b-bc66-f89b926a895f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bbf84-601e-0051-084a-67fe5e000000", + "Body" : "jtcgetblocklistleasefailjtcgetblocklistleasefail08686849df67420fd149abMon, 09 Sep 2019 20:10:33 GMT\"0x8D73561C59E49DF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:33 GMT", + "x-ms-client-request-id" : "63d96b41-cdd0-4f2b-bc66-f89b926a895f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklistleasefail08686849df67420fd149ab?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" : "7be19a91-4a53-4695-b4b9-83e1148c32ff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bbf91-601e-0051-154a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:34 GMT", + "x-ms-client-request-id" : "7be19a91-4a53-4695-b4b9-83e1148c32ff" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklistleasefail08686849df67420fd149ab", "javablobgetblocklistleasefail116548c8ee65802af54a", "javablobgetblocklistleasefail295551a359d71db89146" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklistmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklistmin.json new file mode 100644 index 000000000000..87b69e0c4a97 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklistmin.json @@ -0,0 +1,114 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklistmin0blockblobapitestgetblocklistminb9359121ad?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" : "f26bae55-fcff-415a-bf50-2cc2b1312985" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C391EDBD\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbd0c-601e-0051-474a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:30 GMT", + "x-ms-client-request-id" : "f26bae55-fcff-415a-bf50-2cc2b1312985" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklistmin0blockblobapitestgetblocklistminb9359121ad/javablobgetblocklistmin145200c4c1d9f35f8b4b919", + "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" : "4dc0eb95-82fc-4527-92ad-981d18d21c6b", + "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 20:10:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C3A22BF4\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bbd1c-601e-0051-564a-67fe5e000000", + "x-ms-client-request-id" : "4dc0eb95-82fc-4527-92ad-981d18d21c6b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklistmin0blockblobapitestgetblocklistminb9359121ad/javablobgetblocklistmin145200c4c1d9f35f8b4b919?blocklisttype=all&comp=blocklist", + "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" : "a51d717e-7f72-4976-adbc-e541ad9a58a9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "7", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:10:30 GMT", + "ETag" : "\"0x8D73561C3A22BF4\"", + "x-ms-request-id" : "755bbd2c-601e-0051-624a-67fe5e000000", + "Body" : "", + "x-ms-client-request-id" : "a51d717e-7f72-4976-adbc-e541ad9a58a9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetblocklistmin&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" : "1b293dd3-feb6-4eff-bfcb-5b06fe4a6392" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bbd3d-601e-0051-704a-67fe5e000000", + "Body" : "jtcgetblocklistminjtcgetblocklistmin0blockblobapitestgetblocklistminb9359121adMon, 09 Sep 2019 20:10:30 GMT\"0x8D73561C391EDBD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:30 GMT", + "x-ms-client-request-id" : "1b293dd3-feb6-4eff-bfcb-5b06fe4a6392", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklistmin0blockblobapitestgetblocklistminb9359121ad?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" : "623c8886-8857-4848-8ccf-ac3e88152754" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bbd4c-601e-0051-7f4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:30 GMT", + "x-ms-client-request-id" : "623c8886-8857-4848-8ccf-ac3e88152754" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklistmin0blockblobapitestgetblocklistminb9359121ad", "javablobgetblocklistmin145200c4c1d9f35f8b4b919", "javablobgetblocklistmin253987bab76234f49d4c398" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttype[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttype[0].json new file mode 100644 index 000000000000..98d26a7cf1f4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttype[0].json @@ -0,0 +1,182 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype0f2179483?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" : "0801596c-0abc-459d-adf6-54e4aa527411" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C3D8C7A8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbd57-601e-0051-0a4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:30 GMT", + "x-ms-client-request-id" : "0801596c-0abc-459d-adf6-54e4aa527411" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype0f2179483/javablobgetblocklisttype17521249889fa576db4555", + "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" : "3a940c3c-5160-4f8e-ba12-143746433fa9", + "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 20:10:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:30 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C3E84261\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bbd67-601e-0051-174a-67fe5e000000", + "x-ms-client-request-id" : "3a940c3c-5160-4f8e-ba12-143746433fa9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype0f2179483/javablobgetblocklisttype17521249889fa576db4555?blockid=YWFhNWUyNWEtODMzNC00MjNiLTg5NDYtZjQxNTQwYzc0MWRj&comp=block", + "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" : "3c9dcff9-54a3-4b62-9b07-6db3b48124fd", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbd70-601e-0051-1f4a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:30 GMT", + "x-ms-client-request-id" : "3c9dcff9-54a3-4b62-9b07-6db3b48124fd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype0f2179483/javablobgetblocklisttype17521249889fa576db4555?comp=blocklist", + "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" : "be5a6b1a-2689-4c52-8d4b-40169a543f36", + "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" : "\"0x8D73561C400FEF9\"", + "x-ms-content-crc64" : "wFTCGxDBd4Y=", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbd7b-601e-0051-2a4a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:30 GMT", + "x-ms-client-request-id" : "be5a6b1a-2689-4c52-8d4b-40169a543f36" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype0f2179483/javablobgetblocklisttype17521249889fa576db4555?blockid=OTZhYjhiMzUtZGM2ZS00ZDJjLTliNTUtZTE5YWY5OTYxNTVl&comp=block", + "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" : "79c2e8e3-f61a-49d2-9844-94bcfd597766", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbd83-601e-0051-304a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:31 GMT", + "x-ms-client-request-id" : "79c2e8e3-f61a-49d2-9844-94bcfd597766" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype0f2179483/javablobgetblocklisttype17521249889fa576db4555?blocklisttype=all&comp=blocklist", + "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" : "f2c67398-6055-4e93-a830-26b7db9c081a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "7", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:10:31 GMT", + "ETag" : "\"0x8D73561C400FEF9\"", + "x-ms-request-id" : "755bbd8f-601e-0051-3c4a-67fe5e000000", + "Body" : "YWFhNWUyNWEtODMzNC00MjNiLTg5NDYtZjQxNTQwYzc0MWRj7OTZhYjhiMzUtZGM2ZS00ZDJjLTliNTUtZTE5YWY5OTYxNTVl7", + "x-ms-client-request-id" : "f2c67398-6055-4e93-a830-26b7db9c081a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetblocklisttype&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" : "9db8e6e1-de1a-4e9a-93c1-026247f7785c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bbd9c-601e-0051-484a-67fe5e000000", + "Body" : "jtcgetblocklisttypejtcgetblocklisttype0blockblobapitestgetblocklisttype0f2179483Mon, 09 Sep 2019 20:10:31 GMT\"0x8D73561C3D8C7A8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:31 GMT", + "x-ms-client-request-id" : "9db8e6e1-de1a-4e9a-93c1-026247f7785c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype0f2179483?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" : "7f7eaf4d-763a-481c-a30d-ace08f7e9d54" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bbda7-601e-0051-534a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:31 GMT", + "x-ms-client-request-id" : "7f7eaf4d-763a-481c-a30d-ace08f7e9d54" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklisttype0blockblobapitestgetblocklisttype0f2179483", "javablobgetblocklisttype17521249889fa576db4555", "javablobgetblocklisttype2921193ec4e262f1be4c5d", "aaa5e25a-8334-423b-8946-f41540c741dc", "96ab8b35-dc6e-4d2c-9b55-e19af996155e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttype[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttype[1].json new file mode 100644 index 000000000000..ff35f3561801 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttype[1].json @@ -0,0 +1,182 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttypeccf702711?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" : "08e4e481-777f-47aa-a9c8-201c4e7f6b75" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C4477C1E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbdb9-601e-0051-654a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:31 GMT", + "x-ms-client-request-id" : "08e4e481-777f-47aa-a9c8-201c4e7f6b75" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttypeccf702711/javablobgetblocklisttype1553009345a2a1569a40c4", + "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" : "a1417b2b-f3a5-4162-b952-c387f594333d", + "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 20:10:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C454857F\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bbdd4-601e-0051-7d4a-67fe5e000000", + "x-ms-client-request-id" : "a1417b2b-f3a5-4162-b952-c387f594333d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttypeccf702711/javablobgetblocklisttype1553009345a2a1569a40c4?blockid=ZmY5MmE5Y2YtNTBiMS00MDc4LWE2MGQtMzc2ODYyNjU0MGRl&comp=block", + "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" : "fdfdae78-5e9f-4c8c-9bad-394528239a25", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbde5-601e-0051-0d4a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:31 GMT", + "x-ms-client-request-id" : "fdfdae78-5e9f-4c8c-9bad-394528239a25" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttypeccf702711/javablobgetblocklisttype1553009345a2a1569a40c4?comp=blocklist", + "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" : "089ec1b7-5677-44df-b1d9-54538b5ff2ba", + "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" : "\"0x8D73561C46DB76E\"", + "x-ms-content-crc64" : "PzK4jNytbKk=", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbdf5-601e-0051-1d4a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:31 GMT", + "x-ms-client-request-id" : "089ec1b7-5677-44df-b1d9-54538b5ff2ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttypeccf702711/javablobgetblocklisttype1553009345a2a1569a40c4?blockid=MWRlNjU4ODUtM2QzZS00NGQ4LTljN2QtNDRlMjEwNmU4NTk4&comp=block", + "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" : "410aebe0-b233-4632-9a79-d012ac14e4df", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbe0c-601e-0051-2c4a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:31 GMT", + "x-ms-client-request-id" : "410aebe0-b233-4632-9a79-d012ac14e4df" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttypeccf702711/javablobgetblocklisttype1553009345a2a1569a40c4?blocklisttype=committed&comp=blocklist", + "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" : "033fc8f3-7eab-4c83-a0df-8fbd9ea786b1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "7", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:10:31 GMT", + "ETag" : "\"0x8D73561C46DB76E\"", + "x-ms-request-id" : "755bbe20-601e-0051-404a-67fe5e000000", + "Body" : "ZmY5MmE5Y2YtNTBiMS00MDc4LWE2MGQtMzc2ODYyNjU0MGRl7", + "x-ms-client-request-id" : "033fc8f3-7eab-4c83-a0df-8fbd9ea786b1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetblocklisttype&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" : "3cbe9bd8-a4ee-4312-9c35-a733ac7c1d47" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bbe28-601e-0051-484a-67fe5e000000", + "Body" : "jtcgetblocklisttypejtcgetblocklisttype0blockblobapitestgetblocklisttypeccf702711Mon, 09 Sep 2019 20:10:31 GMT\"0x8D73561C4477C1E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:31 GMT", + "x-ms-client-request-id" : "3cbe9bd8-a4ee-4312-9c35-a733ac7c1d47", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttypeccf702711?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" : "ddee1746-d0a3-4b32-bad6-eb2456d2a594" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bbe39-601e-0051-574a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:32 GMT", + "x-ms-client-request-id" : "ddee1746-d0a3-4b32-bad6-eb2456d2a594" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklisttype0blockblobapitestgetblocklisttypeccf702711", "javablobgetblocklisttype1553009345a2a1569a40c4", "javablobgetblocklisttype213015655cc34a42ec4049", "ff92a9cf-50b1-4078-a60d-3768626540de", "1de65885-3d3e-44d8-9c7d-44e2106e8598" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttype[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttype[2].json new file mode 100644 index 000000000000..cbd088ac2cb3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttype[2].json @@ -0,0 +1,182 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype55f814353?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" : "b4d2fe91-1c86-4990-bae7-3ae55241e84a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C4AD5557\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbe4c-601e-0051-684a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:32 GMT", + "x-ms-client-request-id" : "b4d2fe91-1c86-4990-bae7-3ae55241e84a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype55f814353/javablobgetblocklisttype160601e5bdcf73905b45d5", + "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" : "76c67034-9255-4268-bde8-2d07488cffbc", + "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 20:10:32 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:32 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C4BB225F\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bbe5d-601e-0051-774a-67fe5e000000", + "x-ms-client-request-id" : "76c67034-9255-4268-bde8-2d07488cffbc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype55f814353/javablobgetblocklisttype160601e5bdcf73905b45d5?blockid=NjFhODI1NGMtOGJjYy00MjEzLTg4MWQtMDRmZTc3NWViZGQ5&comp=block", + "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" : "592ef43b-19c0-4e60-9663-566813631444", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbe66-601e-0051-7f4a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:32 GMT", + "x-ms-client-request-id" : "592ef43b-19c0-4e60-9663-566813631444" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype55f814353/javablobgetblocklisttype160601e5bdcf73905b45d5?comp=blocklist", + "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" : "157fd4ed-3e2e-493f-a507-25ec50f4d5bc", + "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" : "\"0x8D73561C4D565EA\"", + "x-ms-content-crc64" : "Ojciw9a0W3g=", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbe70-601e-0051-094a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:32 GMT", + "x-ms-client-request-id" : "157fd4ed-3e2e-493f-a507-25ec50f4d5bc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype55f814353/javablobgetblocklisttype160601e5bdcf73905b45d5?blockid=ZDIyMTM0ODMtM2EzOC00ODRkLWI0NmUtMWIyYmVlZDM0YTM0&comp=block", + "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" : "38f48bf2-c83a-43f8-9783-32b63da6f411", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbe7e-601e-0051-154a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:32 GMT", + "x-ms-client-request-id" : "38f48bf2-c83a-43f8-9783-32b63da6f411" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype55f814353/javablobgetblocklisttype160601e5bdcf73905b45d5?blocklisttype=uncommitted&comp=blocklist", + "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" : "84be3adf-9c4e-474b-9ad9-b36848843c4f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "7", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:32 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:10:32 GMT", + "ETag" : "\"0x8D73561C4D565EA\"", + "x-ms-request-id" : "755bbe8f-601e-0051-244a-67fe5e000000", + "Body" : "ZDIyMTM0ODMtM2EzOC00ODRkLWI0NmUtMWIyYmVlZDM0YTM07", + "x-ms-client-request-id" : "84be3adf-9c4e-474b-9ad9-b36848843c4f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetblocklisttype&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" : "bd098a91-f58b-45af-aaed-55acba1dec61" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bbe98-601e-0051-2d4a-67fe5e000000", + "Body" : "jtcgetblocklisttypejtcgetblocklisttype0blockblobapitestgetblocklisttype55f814353Mon, 09 Sep 2019 20:10:32 GMT\"0x8D73561C4AD5557\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:32 GMT", + "x-ms-client-request-id" : "bd098a91-f58b-45af-aaed-55acba1dec61", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttype0blockblobapitestgetblocklisttype55f814353?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" : "86de091b-dc6f-4ad7-9c39-d015d4ee7b16" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bbea0-601e-0051-344a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:32 GMT", + "x-ms-client-request-id" : "86de091b-dc6f-4ad7-9c39-d015d4ee7b16" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklisttype0blockblobapitestgetblocklisttype55f814353", "javablobgetblocklisttype160601e5bdcf73905b45d5", "javablobgetblocklisttype289323a567c980c99c42db", "61a8254c-8bcc-4213-881d-04fe775ebdd9", "d2213483-3a38-484d-b46e-1b2beed34a34" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttypenull.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttypenull.json new file mode 100644 index 000000000000..aca27d3783a8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestgetblocklisttypenull.json @@ -0,0 +1,114 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttypenull0255147a12faeae36244919?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" : "689897a4-99d4-4b99-a000-108a0b6660f4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C513CAF1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbeb3-601e-0051-454a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:32 GMT", + "x-ms-client-request-id" : "689897a4-99d4-4b99-a000-108a0b6660f4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttypenull0255147a12faeae36244919/javablobgetblocklisttypenull14884613eec347d6034d", + "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" : "53e9fc5b-1dcb-41e7-9173-29d2055afb06", + "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 20:10:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:32 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C520D4A7\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bbec2-601e-0051-524a-67fe5e000000", + "x-ms-client-request-id" : "53e9fc5b-1dcb-41e7-9173-29d2055afb06" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttypenull0255147a12faeae36244919/javablobgetblocklisttypenull14884613eec347d6034d?comp=blocklist", + "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" : "8be7787c-5da0-4c23-afef-6e9505da3dfa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "7", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:33 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:10:32 GMT", + "ETag" : "\"0x8D73561C520D4A7\"", + "x-ms-request-id" : "755bbecd-601e-0051-5b4a-67fe5e000000", + "Body" : "", + "x-ms-client-request-id" : "8be7787c-5da0-4c23-afef-6e9505da3dfa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetblocklisttypenull&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" : "d420252e-89a5-4e8f-ac89-e82685638b1b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bbed7-601e-0051-654a-67fe5e000000", + "Body" : "jtcgetblocklisttypenulljtcgetblocklisttypenull0255147a12faeae36244919Mon, 09 Sep 2019 20:10:33 GMT\"0x8D73561C513CAF1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:33 GMT", + "x-ms-client-request-id" : "d420252e-89a5-4e8f-ac89-e82685638b1b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblocklisttypenull0255147a12faeae36244919?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" : "4579b72a-b301-470e-9bc1-3ea6b54fcce3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bbeea-601e-0051-774a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:33 GMT", + "x-ms-client-request-id" : "4579b72a-b301-470e-9bc1-3ea6b54fcce3" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblocklisttypenull0255147a12faeae36244919", "javablobgetblocklisttypenull14884613eec347d6034d", "javablobgetblocklisttypenull27211243c32da70ce843" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblock.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblock.json new file mode 100644 index 000000000000..64a6662b17b6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblock.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblock0blockblobapiteststageblock068913665a68775?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" : "9d4867e7-ff0e-4292-bece-21bced75aa11" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B3E1A199\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd5add-501e-003f-204a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:10:03 GMT", + "x-ms-client-request-id" : "9d4867e7-ff0e-4292-bece-21bced75aa11" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblock0blockblobapiteststageblock068913665a68775/javablobstageblock1blockblobapiteststageblock0689380569b9c", + "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" : "208a4993-c5f3-4f95-9f12-af16dd5c53c2", + "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 20:10:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:03 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561B3EE438F\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd5b10-501e-003f-504a-675777000000", + "x-ms-client-request-id" : "208a4993-c5f3-4f95-9f12-af16dd5c53c2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblock0blockblobapiteststageblock068913665a68775/javablobstageblock1blockblobapiteststageblock0689380569b9c?blockid=Y2VhNTEzYmEtODdjNy00ZjkzLWIwMGItZGJiZDUwNTI1NmMx&comp=block", + "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" : "47a7222d-9eda-4c1c-aaf7-37f0db6629b1", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd5b2f-501e-003f-6d4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:03 GMT", + "x-ms-client-request-id" : "47a7222d-9eda-4c1c-aaf7-37f0db6629b1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblock&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" : "a2d8e65b-f212-49f5-ad16-e69fee2504f1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd5b3c-501e-003f-7a4a-675777000000", + "Body" : "jtcstageblockjtcstageblock0blockblobapiteststageblock068913665a68775Mon, 09 Sep 2019 20:10:04 GMT\"0x8D73561B3E1A199\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:04 GMT", + "x-ms-client-request-id" : "a2d8e65b-f212-49f5-ad16-e69fee2504f1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblock0blockblobapiteststageblock068913665a68775?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" : "81db1af3-1182-4550-bb9b-b6526b6d9be1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd5b4f-501e-003f-0c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:10:04 GMT", + "x-ms-client-request-id" : "81db1af3-1182-4550-bb9b-b6526b6d9be1" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblock0blockblobapiteststageblock068913665a68775", "javablobstageblock1blockblobapiteststageblock0689380569b9c", "javablobstageblock2blockblobapiteststageblock068108371abb4", "cea513ba-87c7-4f93-b00b-dbbd505256c1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockemptybody.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockemptybody.json new file mode 100644 index 000000000000..7e0d883925c0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockemptybody.json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockemptybody0271884269ff5200c34f98a?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" : "f7d5fd64-613f-40b9-84b3-5d6b91999129" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B5A513C2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bae1f-601e-0051-3d4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:06 GMT", + "x-ms-client-request-id" : "f7d5fd64-613f-40b9-84b3-5d6b91999129" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockemptybody0271884269ff5200c34f98a/javablobstageblockemptybody1655129c5025cd3b70464", + "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" : "8f66b573-7dce-4c23-9401-d39dcf1c1fda", + "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 20:10:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:07 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561B5B1F139\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bae29-601e-0051-464a-67fe5e000000", + "x-ms-client-request-id" : "8f66b573-7dce-4c23-9401-d39dcf1c1fda" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockemptybody0271884269ff5200c34f98a/javablobstageblockemptybody1655129c5025cd3b70464?blockid=NmVmMTNkMzQtMjM1ZC00ODk2LWI2MWMtMGZhYzI2OTgxMWIw&comp=block", + "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" : "3f59cccc-3f81-4974-8277-b060de7d22eb", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "755bae35-601e-0051-524a-67fe5e000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:755bae35-601e-0051-524a-67fe5e000000\nTime:2019-09-09T20:10:07.3510172ZContent-Length0", + "Date" : "Mon, 09 Sep 2019 20:10:07 GMT", + "x-ms-client-request-id" : "3f59cccc-3f81-4974-8277-b060de7d22eb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockemptybody&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" : "1630b5b7-9cff-4ba7-b272-0a2c8bc60e32" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bae3f-601e-0051-5a4a-67fe5e000000", + "Body" : "jtcstageblockemptybodyjtcstageblockemptybody0271884269ff5200c34f98aMon, 09 Sep 2019 20:10:07 GMT\"0x8D73561B5A513C2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:07 GMT", + "x-ms-client-request-id" : "1630b5b7-9cff-4ba7-b272-0a2c8bc60e32", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockemptybody0271884269ff5200c34f98a?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" : "b13fcbbc-7891-45d0-b7f0-8b9ce8fce589" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bae4f-601e-0051-684a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:07 GMT", + "x-ms-client-request-id" : "b13fcbbc-7891-45d0-b7f0-8b9ce8fce589" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockemptybody0271884269ff5200c34f98a", "javablobstageblockemptybody1655129c5025cd3b70464", "javablobstageblockemptybody21047294dade4da9dc4bf", "6ef13d34-235d-4896-b61c-0fac269811b0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockerror.json new file mode 100644 index 000000000000..9962f839b389 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockerror.json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockerror0blockblobapiteststageblockerror9e015856c9?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" : "aa973508-1704-42fe-8313-ba2008e9dd90" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B6B1AB67\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755baee4-601e-0051-714a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:08 GMT", + "x-ms-client-request-id" : "aa973508-1704-42fe-8313-ba2008e9dd90" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockerror0blockblobapiteststageblockerror9e015856c9/javablobstageblockerror1968922053b35ec85a40d18", + "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" : "5d4a4b9a-1a83-40ad-a864-d621be9c4abe", + "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 20:10:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561B6BEB09A\"", + "Content-Length" : "0", + "x-ms-request-id" : "755baef6-601e-0051-024a-67fe5e000000", + "x-ms-client-request-id" : "5d4a4b9a-1a83-40ad-a864-d621be9c4abe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockerror0blockblobapiteststageblockerror9e015856c9/javablobstageblockerror334948cb560c0b669f4ef18?blockid=id&comp=block", + "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" : "287cc072-6d56-4f0c-b957-0712a6a59187", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "409", + "StatusCode" : "400", + "x-ms-request-id" : "755baf03-601e-0051-0d4a-67fe5e000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:755baf03-601e-0051-0d4a-67fe5e000000\nTime:2019-09-09T20:10:09.1062594ZblockididNot a valid base64 string.", + "Date" : "Mon, 09 Sep 2019 20:10:08 GMT", + "x-ms-client-request-id" : "287cc072-6d56-4f0c-b957-0712a6a59187", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockerror&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" : "546d0de3-10c4-47d2-9a10-0fb88015f112" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755baf0a-601e-0051-134a-67fe5e000000", + "Body" : "jtcstageblockerrorjtcstageblockerror0blockblobapiteststageblockerror9e015856c9Mon, 09 Sep 2019 20:10:08 GMT\"0x8D73561B6B1AB67\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:08 GMT", + "x-ms-client-request-id" : "546d0de3-10c4-47d2-9a10-0fb88015f112", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockerror0blockblobapiteststageblockerror9e015856c9?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" : "c2f05584-121f-4738-9923-9bbd5259d10d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755baf0d-601e-0051-164a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:09 GMT", + "x-ms-client-request-id" : "c2f05584-121f-4738-9923-9bbd5259d10d" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockerror0blockblobapiteststageblockerror9e015856c9", "javablobstageblockerror1968922053b35ec85a40d18", "javablobstageblockerror2443441b1b12cd89dc40bf9", "javablobstageblockerror334948cb560c0b669f4ef18" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurl.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurl.json new file mode 100644 index 000000000000..9001a63129c1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurl.json @@ -0,0 +1,208 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurl0blockblobapiteststageblockfromurlf8466163?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" : "dc99f9af-ed65-47d6-b025-88c6b7b0566c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B6F30604\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755baf28-601e-0051-2a4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:09 GMT", + "x-ms-client-request-id" : "dc99f9af-ed65-47d6-b025-88c6b7b0566c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurl0blockblobapiteststageblockfromurlf8466163/javablobstageblockfromurl174400200f8b30edf842de", + "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" : "0cc31a26-8922-4fd7-87d4-84d8e09e4d7f", + "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 20:10:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:09 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561B700326F\"", + "Content-Length" : "0", + "x-ms-request-id" : "755baf37-601e-0051-364a-67fe5e000000", + "x-ms-client-request-id" : "0cc31a26-8922-4fd7-87d4-84d8e09e4d7f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurl0blockblobapiteststageblockfromurlf8466163?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" : "eddac929-57d2-42f0-bf05-195b33825cb1", + "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" : "\"0x8D73561B70C563D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755baf3f-601e-0051-3e4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:09 GMT", + "x-ms-client-request-id" : "eddac929-57d2-42f0-bf05-195b33825cb1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurl0blockblobapiteststageblockfromurlf8466163/javablobstageblockfromurl317239cdb7c8d282114244?blockid=ODZjNzU1NGEtY2U4Ny00N2FiLTk1ODktNDY5OGE4YzgyZTdm&comp=block", + "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" : "2c99b6c1-a65d-4793-bae0-74ab11086d19" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755baf4d-601e-0051-4b4a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:09 GMT", + "x-ms-client-request-id" : "2c99b6c1-a65d-4793-bae0-74ab11086d19" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurl0blockblobapiteststageblockfromurlf8466163/javablobstageblockfromurl317239cdb7c8d282114244?blocklisttype=all&comp=blocklist", + "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" : "6455ee84-7eb2-42b2-9511-787e4749f7d4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755baf6a-601e-0051-644a-67fe5e000000", + "Body" : "ODZjNzU1NGEtY2U4Ny00N2FiLTk1ODktNDY5OGE4YzgyZTdm7", + "Date" : "Mon, 09 Sep 2019 20:10:09 GMT", + "x-ms-client-request-id" : "6455ee84-7eb2-42b2-9511-787e4749f7d4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurl0blockblobapiteststageblockfromurlf8466163/javablobstageblockfromurl317239cdb7c8d282114244?comp=blocklist", + "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" : "a822047e-43ab-4624-8e13-bfaa9b2cb25e", + "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" : "\"0x8D73561B74648E9\"", + "x-ms-content-crc64" : "ZWcxrIby4mU=", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755baf74-601e-0051-6e4a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:09 GMT", + "x-ms-client-request-id" : "a822047e-43ab-4624-8e13-bfaa9b2cb25e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurl0blockblobapiteststageblockfromurlf8466163/javablobstageblockfromurl317239cdb7c8d282114244", + "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" : "5e1ccef3-9cff-47d5-9b44-4868c672872a" + }, + "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 20:10:09 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:10:09 GMT", + "x-ms-blob-type" : "BlockBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73561B74648E9\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:10:09 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "755baf81-601e-0051-784a-67fe5e000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "5e1ccef3-9cff-47d5-9b44-4868c672872a", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockfromurl&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" : "a69776f1-54b6-435f-ab56-109149de550a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755baf92-601e-0051-074a-67fe5e000000", + "Body" : "jtcstageblockfromurljtcstageblockfromurl0blockblobapiteststageblockfromurlf8466163Mon, 09 Sep 2019 20:10:09 GMT\"0x8D73561B70C563D\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:09 GMT", + "x-ms-client-request-id" : "a69776f1-54b6-435f-ab56-109149de550a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurl0blockblobapiteststageblockfromurlf8466163?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" : "e28c5a06-261c-4169-8733-acae7267693c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755baf9b-601e-0051-104a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:09 GMT", + "x-ms-client-request-id" : "e28c5a06-261c-4169-8733-acae7267693c" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurl0blockblobapiteststageblockfromurlf8466163", "javablobstageblockfromurl174400200f8b30edf842de", "javablobstageblockfromurl2315141d57f17a15064bed", "javablobstageblockfromurl317239cdb7c8d282114244", "86c7554a-ce87-47ab-9589-4698a8c82e7f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlerror.json new file mode 100644 index 000000000000..d66fb0c566a3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlerror.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlerror039008bc7c35f654774d7b?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" : "83e6b50c-70d5-43d2-909d-955051eb6667" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B9E72D33\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb1f1-601e-0051-194a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:14 GMT", + "x-ms-client-request-id" : "83e6b50c-70d5-43d2-909d-955051eb6667" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlerror039008bc7c35f654774d7b/javablobstageblockfromurlerror14805870a5f089a0364", + "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" : "077a6316-4f51-4dcd-9623-3f37d46bb573", + "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 20:10:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561B9F48184\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb1f7-601e-0051-1d4a-67fe5e000000", + "x-ms-client-request-id" : "077a6316-4f51-4dcd-9623-3f37d46bb573" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlerror318882edcf60d5e3414269/javablobstageblockfromurlerror44481031426294ea534?blockid=YWIzMTA2OTctYjIwMS00ZmZmLTlhYzAtZmY1MzQ4ZTE3NWU5&comp=block", + "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" : "b658c417-d3cf-4361-9486-1cd51539f254" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "Content-Length" : "229", + "StatusCode" : "404", + "x-ms-request-id" : "755bb1fe-601e-0051-234a-67fe5e000000", + "Body" : "CannotVerifyCopySourceThe specified resource does not exist.\nRequestId:755bb1fe-601e-0051-234a-67fe5e000000\nTime:2019-09-09T20:10:14.4980944Z", + "Date" : "Mon, 09 Sep 2019 20:10:14 GMT", + "x-ms-client-request-id" : "b658c417-d3cf-4361-9486-1cd51539f254", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockfromurlerror&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" : "4cf5237c-d54b-44c1-b800-684872d3c19b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb204-601e-0051-284a-67fe5e000000", + "Body" : "jtcstageblockfromurlerrorjtcstageblockfromurlerror039008bc7c35f654774d7bMon, 09 Sep 2019 20:10:14 GMT\"0x8D73561B9E72D33\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:14 GMT", + "x-ms-client-request-id" : "4cf5237c-d54b-44c1-b800-684872d3c19b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlerror039008bc7c35f654774d7b?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" : "1093cf1a-7d71-4866-9e62-f6b00ea7eb88" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb213-601e-0051-354a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:14 GMT", + "x-ms-client-request-id" : "1093cf1a-7d71-4866-9e62-f6b00ea7eb88" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlerror039008bc7c35f654774d7b", "javablobstageblockfromurlerror14805870a5f089a0364", "javablobstageblockfromurlerror27637117a14569cedc4", "jtcstageblockfromurlerror318882edcf60d5e3414269", "javablobstageblockfromurlerror44481031426294ea534", "ab310697-b201-4fff-9ac0-ff5348e175e9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlia[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlia[0].json new file mode 100644 index 000000000000..7350cd922cfa --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlia[0].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlia072412e70b4beb91d04b65a?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" : "dee10e03-b246-41fc-bfe7-9b31df3cd327" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B7C85729\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755baff5-601e-0051-644a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:10 GMT", + "x-ms-client-request-id" : "dee10e03-b246-41fc-bfe7-9b31df3cd327" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlia072412e70b4beb91d04b65a/javablobstageblockfromurlia1716180392a8def01d4a6", + "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" : "66c7da41-2443-40cd-a190-887d777efc48", + "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 20:10:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:10 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561B7D50E6E\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb004-601e-0051-6e4a-67fe5e000000", + "x-ms-client-request-id" : "66c7da41-2443-40cd-a190-887d777efc48" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlia072412e70b4beb91d04b65a/javablobstageblockfromurlia1716180392a8def01d4a6?comp=block", + "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" : "8f6f75e0-2663-415f-9f3c-2e97ec1d8876" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "MissingRequiredQueryParameter", + "retry-after" : "0", + "Content-Length" : "315", + "StatusCode" : "400", + "x-ms-request-id" : "755bb012-601e-0051-7a4a-67fe5e000000", + "Body" : "MissingRequiredQueryParameterA query parameter that's mandatory for this request is not specified.\nRequestId:755bb012-601e-0051-7a4a-67fe5e000000\nTime:2019-09-09T20:10:10.9385629Zblockid", + "Date" : "Mon, 09 Sep 2019 20:10:10 GMT", + "x-ms-client-request-id" : "8f6f75e0-2663-415f-9f3c-2e97ec1d8876", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockfromurlia&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" : "0abc30cc-0bc4-45c1-9407-5c6b56c62cbd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb01b-601e-0051-034a-67fe5e000000", + "Body" : "jtcstageblockfromurliajtcstageblockfromurlia072412e70b4beb91d04b65aMon, 09 Sep 2019 20:10:10 GMT\"0x8D73561B7C85729\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:10 GMT", + "x-ms-client-request-id" : "0abc30cc-0bc4-45c1-9407-5c6b56c62cbd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlia072412e70b4beb91d04b65a?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" : "3f1b8b39-e6cb-464e-8f9d-b9aa66a26592" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb026-601e-0051-0c4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:10 GMT", + "x-ms-client-request-id" : "3f1b8b39-e6cb-464e-8f9d-b9aa66a26592" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlia072412e70b4beb91d04b65a", "javablobstageblockfromurlia1716180392a8def01d4a6", "javablobstageblockfromurlia283994f5412498f6cd4e8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlia[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlia[1].json new file mode 100644 index 000000000000..8670ca299454 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlia[1].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlia0902563ba9a505753249ddb?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" : "f81866a2-ccc4-4241-b81e-2d413a65e0f1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B807B5A5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb035-601e-0051-1a4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:10 GMT", + "x-ms-client-request-id" : "f81866a2-ccc4-4241-b81e-2d413a65e0f1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlia0902563ba9a505753249ddb/javablobstageblockfromurlia175507c082e0b521c74ad", + "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" : "6347aed3-0758-4a12-bee1-e5d8b696e10e", + "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 20:10:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:11 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561B814941B\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb040-601e-0051-244a-67fe5e000000", + "x-ms-client-request-id" : "6347aed3-0758-4a12-bee1-e5d8b696e10e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlia0902563ba9a505753249ddb/javablobstageblockfromurlia175507c082e0b521c74ad?blockid=OTZlMzU0NTUtZDRmOC00NTBkLWI2YjAtYjI3NzFiNGI2NDc5&comp=block", + "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" : "2e492a54-028e-42bf-be00-eab78cf1f331" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "755bb04a-601e-0051-2c4a-67fe5e000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:755bb04a-601e-0051-2c4a-67fe5e000000\nTime:2019-09-09T20:10:11.3458532ZContent-Length0", + "Date" : "Mon, 09 Sep 2019 20:10:11 GMT", + "x-ms-client-request-id" : "2e492a54-028e-42bf-be00-eab78cf1f331", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockfromurlia&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" : "7e0d4c73-996a-4202-a661-725ac1dedc14" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb054-601e-0051-364a-67fe5e000000", + "Body" : "jtcstageblockfromurliajtcstageblockfromurlia0902563ba9a505753249ddbMon, 09 Sep 2019 20:10:11 GMT\"0x8D73561B807B5A5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:11 GMT", + "x-ms-client-request-id" : "7e0d4c73-996a-4202-a661-725ac1dedc14", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlia0902563ba9a505753249ddb?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" : "1533ed5f-b178-4ab3-ac57-10cfb7bc7040" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb061-601e-0051-404a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:11 GMT", + "x-ms-client-request-id" : "1533ed5f-b178-4ab3-ac57-10cfb7bc7040" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlia0902563ba9a505753249ddb", "javablobstageblockfromurlia175507c082e0b521c74ad", "javablobstageblockfromurlia260074e0ef7895aef2467", "96e35455-d4f8-450d-b6b0-b2771b4b6479" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurllease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurllease.json new file mode 100644 index 000000000000..6fb12edf0bc8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurllease.json @@ -0,0 +1,155 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurllease032706d86cb25605ad4279?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" : "9c044ac2-55f6-4f77-a5fa-53276f975331" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B93F0EC4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb164-601e-0051-274a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:12 GMT", + "x-ms-client-request-id" : "9c044ac2-55f6-4f77-a5fa-53276f975331" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurllease032706d86cb25605ad4279/javablobstageblockfromurllease18615378e8257d92224", + "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" : "dc7f5359-1c77-4cc5-9e1f-57bfe16b8e6f", + "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 20:10:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:13 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561B94CFF2F\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb16b-601e-0051-2d4a-67fe5e000000", + "x-ms-client-request-id" : "dc7f5359-1c77-4cc5-9e1f-57bfe16b8e6f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurllease032706d86cb25605ad4279?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" : "f157c9ca-b2ec-45c1-aee9-e43a7b383699", + "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" : "\"0x8D73561B958D486\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb175-601e-0051-344a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:13 GMT", + "x-ms-client-request-id" : "f157c9ca-b2ec-45c1-aee9-e43a7b383699" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurllease032706d86cb25605ad4279/javablobstageblockfromurllease18615378e8257d92224?comp=lease", + "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" : "f7e97e75-ce3b-4a36-9088-1485da455df4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B94CFF2F\"", + "x-ms-lease-id" : "afd0b7d1-79d9-4052-bffc-d1e02bd4f61a", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb180-601e-0051-3b4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:13 GMT", + "x-ms-client-request-id" : "f7e97e75-ce3b-4a36-9088-1485da455df4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurllease032706d86cb25605ad4279/javablobstageblockfromurllease18615378e8257d92224?blockid=NWJjZGJiMmQtY2Q4NS00NGRjLWJhMTctMDUyMmU2NmQ2ZDA3&comp=block", + "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" : "57e6422d-a01e-4191-aa76-e5ce3b157850" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb192-601e-0051-494a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:13 GMT", + "x-ms-client-request-id" : "57e6422d-a01e-4191-aa76-e5ce3b157850" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockfromurllease&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" : "caf0324e-ac73-4d63-a3ec-6283965cb8d1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb19f-601e-0051-564a-67fe5e000000", + "Body" : "jtcstageblockfromurlleasejtcstageblockfromurllease032706d86cb25605ad4279Mon, 09 Sep 2019 20:10:13 GMT\"0x8D73561B958D486\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:13 GMT", + "x-ms-client-request-id" : "caf0324e-ac73-4d63-a3ec-6283965cb8d1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurllease032706d86cb25605ad4279?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" : "715aaeab-1a76-4939-b382-3d297f53f3f3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb1af-601e-0051-624a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:13 GMT", + "x-ms-client-request-id" : "715aaeab-1a76-4939-b382-3d297f53f3f3" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurllease032706d86cb25605ad4279", "javablobstageblockfromurllease18615378e8257d92224", "javablobstageblockfromurllease293322c84dd210f25b4", "5bcdbb2d-cd85-44dc-ba17-0522e66d6d07" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlleasefail.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlleasefail.json new file mode 100644 index 000000000000..100f723e0300 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlleasefail.json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlleasefail0103491936257a2ecd45?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" : "17aa1c8e-739e-4078-933b-6eb8194cdf32" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B99B2236\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb1b8-601e-0051-6a4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:13 GMT", + "x-ms-client-request-id" : "17aa1c8e-739e-4078-933b-6eb8194cdf32" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlleasefail0103491936257a2ecd45/javablobstageblockfromurlleasefail193139e2d9011fd5c", + "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" : "dc6890e8-e301-47a2-8a6e-a034e5ee5408", + "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 20:10:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:13 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561B9A7DA09\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb1bd-601e-0051-6e4a-67fe5e000000", + "x-ms-client-request-id" : "dc6890e8-e301-47a2-8a6e-a034e5ee5408" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlleasefail0103491936257a2ecd45?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" : "19381057-be54-4305-8ba7-f792aafa34b6", + "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" : "\"0x8D73561B9B3D65F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb1cf-601e-0051-7c4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:13 GMT", + "x-ms-client-request-id" : "19381057-be54-4305-8ba7-f792aafa34b6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlleasefail0103491936257a2ecd45/javablobstageblockfromurlleasefail193139e2d9011fd5c?blockid=OTAzMDUyZTgtOTk2MS00ZjE2LTkzOTUtN2ZlNDE1NDkxZDhk&comp=block", + "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" : "a7cc2471-0062-4e73-b7f1-fdd235082b26" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "326", + "StatusCode" : "400", + "x-ms-request-id" : "755bb1d7-601e-0051-044a-67fe5e000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:755bb1d7-601e-0051-044a-67fe5e000000\nTime:2019-09-09T20:10:14.0697902Zx-ms-lease-idgarbage", + "Date" : "Mon, 09 Sep 2019 20:10:13 GMT", + "x-ms-client-request-id" : "a7cc2471-0062-4e73-b7f1-fdd235082b26", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockfromurlleasefail&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" : "58a1d08b-b1c0-480e-9c7e-5fc800f49c29" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb1e1-601e-0051-0c4a-67fe5e000000", + "Body" : "jtcstageblockfromurlleasefailjtcstageblockfromurlleasefail0103491936257a2ecd45Mon, 09 Sep 2019 20:10:13 GMT\"0x8D73561B9B3D65F\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:13 GMT", + "x-ms-client-request-id" : "58a1d08b-b1c0-480e-9c7e-5fc800f49c29", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlleasefail0103491936257a2ecd45?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" : "fb5e9890-dc67-4565-93de-de5386191089" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb1e4-601e-0051-0f4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:13 GMT", + "x-ms-client-request-id" : "fb5e9890-dc67-4565-93de-de5386191089" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlleasefail0103491936257a2ecd45", "javablobstageblockfromurlleasefail193139e2d9011fd5c", "javablobstageblockfromurlleasefail272828d65b591f44b", "903052e8-9961-4f16-9395-7fe415491d8d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlmd5.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlmd5.json new file mode 100644 index 000000000000..234f851ad7a5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlmd5.json @@ -0,0 +1,133 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlmd503944278946df7cbc54b63a?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" : "99c209b2-c2f0-4d84-931a-0aa5308e7053" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B8A0DD36\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb0c9-601e-0051-1c4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:11 GMT", + "x-ms-client-request-id" : "99c209b2-c2f0-4d84-931a-0aa5308e7053" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlmd503944278946df7cbc54b63a/javablobstageblockfromurlmd51820621d1ed606f88e41", + "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" : "b4666906-2921-4408-b462-6b6dd7058e32", + "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 20:10:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561B8AEA67E\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb0df-601e-0051-2e4a-67fe5e000000", + "x-ms-client-request-id" : "b4666906-2921-4408-b462-6b6dd7058e32" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlmd503944278946df7cbc54b63a?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" : "344da816-0dbf-478a-8898-45732b46d4d9", + "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" : "\"0x8D73561B8BB3F1D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb0e6-601e-0051-354a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:12 GMT", + "x-ms-client-request-id" : "344da816-0dbf-478a-8898-45732b46d4d9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlmd503944278946df7cbc54b63a/javablobstageblockfromurlmd536871122c17bf14bec4f?blockid=Y2Q1ODdmZGQtMzQ2NC00NTE2LWE0NTAtMzY3MmQyNWJmNmZm&comp=block", + "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" : "455539ca-496b-4700-a1bc-d09a7959793e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb0ee-601e-0051-3d4a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:12 GMT", + "x-ms-client-request-id" : "455539ca-496b-4700-a1bc-d09a7959793e", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockfromurlmd5&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" : "6f2df42f-5174-49c9-8c23-17118bd16f5e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb0fc-601e-0051-494a-67fe5e000000", + "Body" : "jtcstageblockfromurlmd5jtcstageblockfromurlmd503944278946df7cbc54b63aMon, 09 Sep 2019 20:10:12 GMT\"0x8D73561B8BB3F1D\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:12 GMT", + "x-ms-client-request-id" : "6f2df42f-5174-49c9-8c23-17118bd16f5e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlmd503944278946df7cbc54b63a?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" : "49b9d54d-7c1f-40e1-81a9-e3ee4fb7a551" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb110-601e-0051-5d4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:12 GMT", + "x-ms-client-request-id" : "49b9d54d-7c1f-40e1-81a9-e3ee4fb7a551" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlmd503944278946df7cbc54b63a", "javablobstageblockfromurlmd51820621d1ed606f88e41", "javablobstageblockfromurlmd5200011ed97cc218e174d", "javablobstageblockfromurlmd536871122c17bf14bec4f", "cd587fdd-3464-4516-a450-3672d25bf6ff" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlmd5fail.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlmd5fail.json new file mode 100644 index 000000000000..feed305c4c54 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlmd5fail.json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlmd5fail0584137d576adf8089499?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" : "23a055ba-40f1-4dbb-9a2f-5c4c5cada28d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B8EE20E8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb11e-601e-0051-694a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:12 GMT", + "x-ms-client-request-id" : "23a055ba-40f1-4dbb-9a2f-5c4c5cada28d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlmd5fail0584137d576adf8089499/javablobstageblockfromurlmd5fail122823a71f47381c25", + "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" : "62954411-8526-4188-b7d2-f2cffbccdca1", + "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 20:10:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:12 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561B8FC1153\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb126-601e-0051-704a-67fe5e000000", + "x-ms-client-request-id" : "62954411-8526-4188-b7d2-f2cffbccdca1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlmd5fail0584137d576adf8089499?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" : "d9a17a43-edbc-4748-b016-c00b447cafe7", + "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" : "\"0x8D73561B90882DF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb135-601e-0051-7c4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:12 GMT", + "x-ms-client-request-id" : "d9a17a43-edbc-4748-b016-c00b447cafe7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlmd5fail0584137d576adf8089499/javablobstageblockfromurlmd5fail318540aec75a623e10?blockid=NGIyNDVhYmYtZWExZC00YTQ5LWI3ODUtMGE2Mzc5MWRiNzdl&comp=block", + "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" : "5bb939ab-5244-49ba-8b02-2bce300d628e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidMd5", + "retry-after" : "0", + "Content-Length" : "276", + "StatusCode" : "400", + "x-ms-request-id" : "755bb13d-601e-0051-044a-67fe5e000000", + "Body" : "InvalidMd5The MD5 value specified in the request is invalid. MD5 value must be 128 bits and base64 encoded.\nRequestId:755bb13d-601e-0051-044a-67fe5e000000\nTime:2019-09-09T20:10:12.9640039Z", + "Date" : "Mon, 09 Sep 2019 20:10:12 GMT", + "x-ms-client-request-id" : "5bb939ab-5244-49ba-8b02-2bce300d628e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockfromurlmd5fail&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" : "cf8f4203-804c-49ef-881e-3b57c0cab0d2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb14a-601e-0051-114a-67fe5e000000", + "Body" : "jtcstageblockfromurlmd5failjtcstageblockfromurlmd5fail0584137d576adf8089499Mon, 09 Sep 2019 20:10:12 GMT\"0x8D73561B90882DF\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:12 GMT", + "x-ms-client-request-id" : "cf8f4203-804c-49ef-881e-3b57c0cab0d2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlmd5fail0584137d576adf8089499?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" : "ba3b9eba-a861-413b-bcc2-95ed4aead76d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb15b-601e-0051-204a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:12 GMT", + "x-ms-client-request-id" : "ba3b9eba-a861-413b-bcc2-95ed4aead76d" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlmd5fail0584137d576adf8089499", "javablobstageblockfromurlmd5fail122823a71f47381c25", "javablobstageblockfromurlmd5fail25087542e283bce7a8", "javablobstageblockfromurlmd5fail318540aec75a623e10", "4b245abf-ea1d-4a49-b785-0a63791db77e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlmin.json new file mode 100644 index 000000000000..3a0454fa179f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlmin.json @@ -0,0 +1,133 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlmin014334d03e9ce20ea843b08?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" : "473abb70-aed9-474c-8e9b-12b9d3708667" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B77B1378\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bafa3-601e-0051-184a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:10 GMT", + "x-ms-client-request-id" : "473abb70-aed9-474c-8e9b-12b9d3708667" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlmin014334d03e9ce20ea843b08/javablobstageblockfromurlmin178247d39e6e7dcdd44b", + "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" : "05467a9d-745c-4fde-b48e-9bbbc2729ec8", + "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 20:10:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:10 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561B78818D2\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bafb8-601e-0051-2c4a-67fe5e000000", + "x-ms-client-request-id" : "05467a9d-745c-4fde-b48e-9bbbc2729ec8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlmin014334d03e9ce20ea843b08?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" : "f7f6c81f-8839-4a25-bfcc-1d26d3a4d93a", + "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" : "\"0x8D73561B794B1ED\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bafbe-601e-0051-324a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:10 GMT", + "x-ms-client-request-id" : "f7f6c81f-8839-4a25-bfcc-1d26d3a4d93a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlmin014334d03e9ce20ea843b08/javablobstageblockfromurlmin3502754d2c0c2f141c44?blockid=MGFiYTczMGMtNTg2OC00NGY1LTk0NDItNGNjZTZkMDk4OGEz&comp=block", + "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" : "27ea947c-044f-4e93-a574-347efb63a181" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bafc9-601e-0051-3b4a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:10 GMT", + "x-ms-client-request-id" : "27ea947c-044f-4e93-a574-347efb63a181" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockfromurlmin&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" : "ce470a9c-f8f0-4dd0-b6f0-e350afa5fe48" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bafdc-601e-0051-4e4a-67fe5e000000", + "Body" : "jtcstageblockfromurlminjtcstageblockfromurlmin014334d03e9ce20ea843b08Mon, 09 Sep 2019 20:10:10 GMT\"0x8D73561B794B1ED\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:10 GMT", + "x-ms-client-request-id" : "ce470a9c-f8f0-4dd0-b6f0-e350afa5fe48", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlmin014334d03e9ce20ea843b08?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" : "5183eeb1-88b7-490c-b8a7-8ddeb96a65f7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bafee-601e-0051-5d4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:10 GMT", + "x-ms-client-request-id" : "5183eeb1-88b7-490c-b8a7-8ddeb96a65f7" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlmin014334d03e9ce20ea843b08", "javablobstageblockfromurlmin178247d39e6e7dcdd44b", "javablobstageblockfromurlmin201511140062ffa32147", "javablobstageblockfromurlmin3502754d2c0c2f141c44", "0aba730c-5868-44f5-9442-4cce6d0988a3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlrange.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlrange.json new file mode 100644 index 000000000000..629e9e2d1789 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlrange.json @@ -0,0 +1,154 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlrange0280091f37ea8fc00e429d?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" : "2ccf076c-3e69-464d-a09b-932539f2a384" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B846C5F3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb075-601e-0051-504a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:11 GMT", + "x-ms-client-request-id" : "2ccf076c-3e69-464d-a09b-932539f2a384" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlrange0280091f37ea8fc00e429d/javablobstageblockfromurlrange183317b526145dee654", + "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" : "cc3e060a-7d74-4650-9702-6692728ddfb9", + "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 20:10:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:11 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561B853565A\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb084-601e-0051-5e4a-67fe5e000000", + "x-ms-client-request-id" : "cc3e060a-7d74-4650-9702-6692728ddfb9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlrange0280091f37ea8fc00e429d?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" : "29b449a6-f566-4b3a-9259-6e3076bad002", + "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" : "\"0x8D73561B85FEF18\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb08c-601e-0051-664a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:11 GMT", + "x-ms-client-request-id" : "29b449a6-f566-4b3a-9259-6e3076bad002" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlrange0280091f37ea8fc00e429d/javablobstageblockfromurlrange38184829530f6c3bcf4?blockid=MDdiZThlNTgtMGMyYy00YjQ0LWJmNDYtZGIxNDYwNTk3M2Y0&comp=block", + "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" : "de954b9e-50cf-4578-844d-b22ab21c8f3d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "K07r2U1KQWI=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb09b-601e-0051-704a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:11 GMT", + "x-ms-client-request-id" : "de954b9e-50cf-4578-844d-b22ab21c8f3d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlrange0280091f37ea8fc00e429d/javablobstageblockfromurlrange38184829530f6c3bcf4?blocklisttype=uncommitted&comp=blocklist", + "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" : "f0be0538-f636-492d-bc80-37a1c91592f6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb0a6-601e-0051-7a4a-67fe5e000000", + "Body" : "MDdiZThlNTgtMGMyYy00YjQ0LWJmNDYtZGIxNDYwNTk3M2Y03", + "Date" : "Mon, 09 Sep 2019 20:10:11 GMT", + "x-ms-client-request-id" : "f0be0538-f636-492d-bc80-37a1c91592f6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockfromurlrange&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" : "31af9700-1cd5-4230-a8c6-8c9c19d308a9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb0b4-601e-0051-084a-67fe5e000000", + "Body" : "jtcstageblockfromurlrangejtcstageblockfromurlrange0280091f37ea8fc00e429dMon, 09 Sep 2019 20:10:11 GMT\"0x8D73561B85FEF18\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:11 GMT", + "x-ms-client-request-id" : "31af9700-1cd5-4230-a8c6-8c9c19d308a9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlrange0280091f37ea8fc00e429d?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" : "c3e1ba60-0a19-4d97-8339-7f8a7f0adee5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb0c1-601e-0051-154a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:11 GMT", + "x-ms-client-request-id" : "c3e1ba60-0a19-4d97-8339-7f8a7f0adee5" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlrange0280091f37ea8fc00e429d", "javablobstageblockfromurlrange183317b526145dee654", "javablobstageblockfromurlrange22937386525010f67b4", "javablobstageblockfromurlrange38184829530f6c3bcf4", "07be8e58-0c2c-4b44-bf46-db14605973f4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[0].json new file mode 100644 index 000000000000..d92be2e40d8e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[0].json @@ -0,0 +1,158 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac098610174e0009714a45?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" : "90c884cd-1f11-4cc4-8b35-a851a05ff0d4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561BA299979\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb224-601e-0051-434a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:14 GMT", + "x-ms-client-request-id" : "90c884cd-1f11-4cc4-8b35-a851a05ff0d4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac098610174e0009714a45/javablobstageblockfromurlsourceac14782865985a16676f", + "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" : "d058a37e-b635-4550-b235-86036aa44eff", + "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 20:10:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BA37632A\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb23c-601e-0051-574a-67fe5e000000", + "x-ms-client-request-id" : "d058a37e-b635-4550-b235-86036aa44eff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac098610174e0009714a45?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" : "2aece780-0b90-475e-940f-176faffa2098", + "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" : "\"0x8D73561BA435F46\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb257-601e-0051-6c4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:14 GMT", + "x-ms-client-request-id" : "2aece780-0b90-475e-940f-176faffa2098" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac098610174e0009714a45/javablobstageblockfromurlsourceac32571885690aa68b5d", + "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" : "752a7a9e-db35-4022-878d-edc5c247fe7f", + "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 20:10:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BA5046F0\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb261-601e-0051-764a-67fe5e000000", + "x-ms-client-request-id" : "752a7a9e-db35-4022-878d-edc5c247fe7f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac098610174e0009714a45/javablobstageblockfromurlsourceac14782865985a16676f?blockid=NzVkODY1YjktOGJiYy00NmQ0LTlhMDAtNGI3YWQwMDc4M2Mz&comp=block", + "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" : "0b1bc3ba-e512-46b6-89d4-47c2685a8309" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb270-601e-0051-024a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:14 GMT", + "x-ms-client-request-id" : "0b1bc3ba-e512-46b6-89d4-47c2685a8309" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockfromurlsourceac&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" : "e483b2c7-c75e-4ad2-a822-efa63b24cb3e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb283-601e-0051-124a-67fe5e000000", + "Body" : "jtcstageblockfromurlsourceacjtcstageblockfromurlsourceac098610174e0009714a45Mon, 09 Sep 2019 20:10:14 GMT\"0x8D73561BA435F46\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:14 GMT", + "x-ms-client-request-id" : "e483b2c7-c75e-4ad2-a822-efa63b24cb3e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac098610174e0009714a45?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" : "07b76845-68c8-483b-8386-0949cdfb2bc6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb28f-601e-0051-1c4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:15 GMT", + "x-ms-client-request-id" : "07b76845-68c8-483b-8386-0949cdfb2bc6" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceac098610174e0009714a45", "javablobstageblockfromurlsourceac14782865985a16676f", "javablobstageblockfromurlsourceac280595765e1b0ee6b4", "75d865b9-8bbc-46d4-9a00-4b7ad00783c3", "javablobstageblockfromurlsourceac32571885690aa68b5d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[1].json new file mode 100644 index 000000000000..aa45e510d894 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[1].json @@ -0,0 +1,158 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac041897d43945fb8cca42?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" : "804f4865-91f6-4360-8abf-306ddc77676b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561BA87A919\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb2a7-601e-0051-2a4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:15 GMT", + "x-ms-client-request-id" : "804f4865-91f6-4360-8abf-306ddc77676b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac041897d43945fb8cca42/javablobstageblockfromurlsourceac155018b6df553edd2e", + "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" : "0095986d-9185-45cf-abc1-c9a6c462bbe7", + "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 20:10:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BA94FDB5\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb2b9-601e-0051-394a-67fe5e000000", + "x-ms-client-request-id" : "0095986d-9185-45cf-abc1-c9a6c462bbe7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac041897d43945fb8cca42?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" : "51d587fc-e812-4a64-94cd-518f0a09b2df", + "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" : "\"0x8D73561BAA0F9A3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb2c7-601e-0051-454a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:15 GMT", + "x-ms-client-request-id" : "51d587fc-e812-4a64-94cd-518f0a09b2df" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac041897d43945fb8cca42/javablobstageblockfromurlsourceac37865385b7fd57790d", + "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" : "a0f60512-3528-4901-ae78-f618b3010e0e", + "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 20:10:15 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BAAEA4E8\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb2d6-601e-0051-524a-67fe5e000000", + "x-ms-client-request-id" : "a0f60512-3528-4901-ae78-f618b3010e0e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac041897d43945fb8cca42/javablobstageblockfromurlsourceac155018b6df553edd2e?blockid=NjZkNjkzNWQtNjhkYi00ZmM1LTlkYjMtYjc2NmZjMmJkOGQ3&comp=block", + "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" : "281dc9e5-83c5-4bc1-84e6-ed9fa98030d0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb2e4-601e-0051-5f4a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:15 GMT", + "x-ms-client-request-id" : "281dc9e5-83c5-4bc1-84e6-ed9fa98030d0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockfromurlsourceac&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" : "6bbff4de-2e11-46a3-bd8a-186e829af9b5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb2f3-601e-0051-6c4a-67fe5e000000", + "Body" : "jtcstageblockfromurlsourceacjtcstageblockfromurlsourceac041897d43945fb8cca42Mon, 09 Sep 2019 20:10:15 GMT\"0x8D73561BAA0F9A3\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:15 GMT", + "x-ms-client-request-id" : "6bbff4de-2e11-46a3-bd8a-186e829af9b5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac041897d43945fb8cca42?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" : "513ebd65-5d71-45e9-bdd9-6499b679e510" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb300-601e-0051-774a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:15 GMT", + "x-ms-client-request-id" : "513ebd65-5d71-45e9-bdd9-6499b679e510" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceac041897d43945fb8cca42", "javablobstageblockfromurlsourceac155018b6df553edd2e", "javablobstageblockfromurlsourceac20875220efac527499", "66d6935d-68db-4fc5-9db3-b766fc2bd8d7", "javablobstageblockfromurlsourceac37865385b7fd57790d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[2].json new file mode 100644 index 000000000000..a53e367dceff --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[2].json @@ -0,0 +1,158 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac0012703420ea4be9704e?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" : "34abafbf-3f2d-4381-8733-c99e0cbb6e9a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561BAE4F548\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb30f-601e-0051-024a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:15 GMT", + "x-ms-client-request-id" : "34abafbf-3f2d-4381-8733-c99e0cbb6e9a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac0012703420ea4be9704e/javablobstageblockfromurlsourceac1970003cab5e1c117c", + "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" : "4cc7cb65-d06b-48c4-96c4-6e96e31d962d", + "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 20:10:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BAF2E661\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb31a-601e-0051-0b4a-67fe5e000000", + "x-ms-client-request-id" : "4cc7cb65-d06b-48c4-96c4-6e96e31d962d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac0012703420ea4be9704e?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" : "e0429967-ba3b-42c6-b41b-87f92136f458", + "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" : "\"0x8D73561BAFF577B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb327-601e-0051-164a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:15 GMT", + "x-ms-client-request-id" : "e0429967-ba3b-42c6-b41b-87f92136f458" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac0012703420ea4be9704e/javablobstageblockfromurlsourceac30398014ae19ee38de", + "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" : "7c0c52be-7001-4d9a-908c-ae4540996ed7", + "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 20:10:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:15 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BB0C8D98\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb332-601e-0051-214a-67fe5e000000", + "x-ms-client-request-id" : "7c0c52be-7001-4d9a-908c-ae4540996ed7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac0012703420ea4be9704e/javablobstageblockfromurlsourceac1970003cab5e1c117c?blockid=MDVjYzFhNmItY2M3My00MDY3LWI0Y2EtOGMyNTRlMDQyMTEz&comp=block", + "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" : "24800ea9-92e6-4b13-af0a-88494002f0c3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb344-601e-0051-2f4a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:16 GMT", + "x-ms-client-request-id" : "24800ea9-92e6-4b13-af0a-88494002f0c3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockfromurlsourceac&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" : "a1a59c47-fdd3-43cf-9737-77c246e478cb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb35d-601e-0051-424a-67fe5e000000", + "Body" : "jtcstageblockfromurlsourceacjtcstageblockfromurlsourceac0012703420ea4be9704eMon, 09 Sep 2019 20:10:16 GMT\"0x8D73561BAFF577B\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:16 GMT", + "x-ms-client-request-id" : "a1a59c47-fdd3-43cf-9737-77c246e478cb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac0012703420ea4be9704e?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" : "f6247111-5e9e-4620-af7a-4f54b68f9735" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb361-601e-0051-464a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:16 GMT", + "x-ms-client-request-id" : "f6247111-5e9e-4620-af7a-4f54b68f9735" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceac0012703420ea4be9704e", "javablobstageblockfromurlsourceac1970003cab5e1c117c", "javablobstageblockfromurlsourceac29215873fa0dd38bf5", "05cc1a6b-cc73-4067-b4ca-8c254e042113", "javablobstageblockfromurlsourceac30398014ae19ee38de" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[3].json new file mode 100644 index 000000000000..3a10c6c7a07d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[3].json @@ -0,0 +1,190 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac07429125942b60d47048?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" : "7b311f38-5d92-4f33-8a6a-44369c9b6693" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561BB42688C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb370-601e-0051-524a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:16 GMT", + "x-ms-client-request-id" : "7b311f38-5d92-4f33-8a6a-44369c9b6693" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac07429125942b60d47048/javablobstageblockfromurlsourceac179043626060fd93b8", + "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" : "d67d7664-0cec-4507-a4b6-b822102f0a61", + "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 20:10:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:16 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BB4F481C\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb379-601e-0051-584a-67fe5e000000", + "x-ms-client-request-id" : "d67d7664-0cec-4507-a4b6-b822102f0a61" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac07429125942b60d47048?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" : "e09a1907-da3e-433c-bef6-123a419bc0e8", + "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" : "\"0x8D73561BB5B43CA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb386-601e-0051-634a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:16 GMT", + "x-ms-client-request-id" : "e09a1907-da3e-433c-bef6-123a419bc0e8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac07429125942b60d47048/javablobstageblockfromurlsourceac327862a5afbfa6cdbb", + "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" : "d8ec5675-92d1-4b13-9a46-5679605597ce", + "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 20:10:16 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:16 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BB67B68F\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb396-601e-0051-734a-67fe5e000000", + "x-ms-client-request-id" : "d8ec5675-92d1-4b13-9a46-5679605597ce" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac07429125942b60d47048/javablobstageblockfromurlsourceac327862a5afbfa6cdbb", + "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" : "5a4d9693-618a-4ae3-b516-94f663b6a660" + }, + "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 20:10:16 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:10:16 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561BB67B68F\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:10:16 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "755bb3a5-601e-0051-7f4a-67fe5e000000", + "x-ms-client-request-id" : "5a4d9693-618a-4ae3-b516-94f663b6a660", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac07429125942b60d47048/javablobstageblockfromurlsourceac179043626060fd93b8?blockid=YWEyZDE4NTItMjhhMi00NTliLWI3NzYtZjRkODk0NzFmMjRl&comp=block", + "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" : "26b057ac-1cb5-4baf-abdb-fa281e8d1c2a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb3b4-601e-0051-0b4a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:16 GMT", + "x-ms-client-request-id" : "26b057ac-1cb5-4baf-abdb-fa281e8d1c2a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockfromurlsourceac&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" : "7ba11015-fe4e-4a43-92f4-efe8fdcfd1d2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb3bf-601e-0051-154a-67fe5e000000", + "Body" : "jtcstageblockfromurlsourceacjtcstageblockfromurlsourceac07429125942b60d47048Mon, 09 Sep 2019 20:10:16 GMT\"0x8D73561BB5B43CA\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:16 GMT", + "x-ms-client-request-id" : "7ba11015-fe4e-4a43-92f4-efe8fdcfd1d2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac07429125942b60d47048?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" : "da31c820-a11b-4fbe-b891-1cff4291c4d4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb3cc-601e-0051-1f4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:16 GMT", + "x-ms-client-request-id" : "da31c820-a11b-4fbe-b891-1cff4291c4d4" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceac07429125942b60d47048", "javablobstageblockfromurlsourceac179043626060fd93b8", "javablobstageblockfromurlsourceac2969048d6373b516ee", "aa2d1852-28a2-459b-b776-f4d89471f24e", "javablobstageblockfromurlsourceac327862a5afbfa6cdbb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[4].json new file mode 100644 index 000000000000..fd2fe4a56f82 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceac[4].json @@ -0,0 +1,158 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac07925194b0dc836ff243?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" : "e0ec0936-bd7d-4c77-a0df-fc8cc06c9d65" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561BBA6459B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb3db-601e-0051-2b4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:17 GMT", + "x-ms-client-request-id" : "e0ec0936-bd7d-4c77-a0df-fc8cc06c9d65" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac07925194b0dc836ff243/javablobstageblockfromurlsourceac157249b541b1b750ec", + "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" : "923762ca-fc83-4eff-a1ec-001bce7bcb51", + "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 20:10:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:17 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BBB3C188\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb3e4-601e-0051-314a-67fe5e000000", + "x-ms-client-request-id" : "923762ca-fc83-4eff-a1ec-001bce7bcb51" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac07925194b0dc836ff243?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" : "18fc1308-c2a8-4055-9668-13a109c96d18", + "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" : "\"0x8D73561BBBFBD3F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb3ee-601e-0051-3b4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:17 GMT", + "x-ms-client-request-id" : "18fc1308-c2a8-4055-9668-13a109c96d18" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac07925194b0dc836ff243/javablobstageblockfromurlsourceac329563f60e15803e52", + "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" : "5913f039-31a1-4f0b-8503-16870435db72", + "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 20:10:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:17 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BBCC7E2A\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb406-601e-0051-4e4a-67fe5e000000", + "x-ms-client-request-id" : "5913f039-31a1-4f0b-8503-16870435db72" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac07925194b0dc836ff243/javablobstageblockfromurlsourceac157249b541b1b750ec?blockid=ZDIyM2IwYzgtM2M2MS00YjZlLWE2ZDctYjdhZGJkZmVkZjA1&comp=block", + "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" : "f6d55439-30a0-41f5-9a08-f66981bef3fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb40e-601e-0051-564a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:17 GMT", + "x-ms-client-request-id" : "f6d55439-30a0-41f5-9a08-f66981bef3fc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockfromurlsourceac&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" : "09cf1897-d8c9-48d8-926b-dff35de631c9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb41c-601e-0051-624a-67fe5e000000", + "Body" : "jtcstageblockfromurlsourceacjtcstageblockfromurlsourceac07925194b0dc836ff243Mon, 09 Sep 2019 20:10:17 GMT\"0x8D73561BBBFBD3F\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:17 GMT", + "x-ms-client-request-id" : "09cf1897-d8c9-48d8-926b-dff35de631c9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceac07925194b0dc836ff243?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" : "7570b38c-02ce-4722-8653-fdd6f2bdc0e5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb42b-601e-0051-714a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:17 GMT", + "x-ms-client-request-id" : "7570b38c-02ce-4722-8653-fdd6f2bdc0e5" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceac07925194b0dc836ff243", "javablobstageblockfromurlsourceac157249b541b1b750ec", "javablobstageblockfromurlsourceac2545744ad7bc5d4dbd", "d223b0c8-3c61-4b6e-a6d7-b7adbdfedf05", "javablobstageblockfromurlsourceac329563f60e15803e52" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceacfail[0].json new file mode 100644 index 000000000000..4d2bb6a03b08 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceacfail[0].json @@ -0,0 +1,156 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail08342309d6f580e392?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" : "aea77708-0f36-486d-97e5-eb9bff1a4c80" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561BC01BCB1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb43c-601e-0051-7e4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:17 GMT", + "x-ms-client-request-id" : "aea77708-0f36-486d-97e5-eb9bff1a4c80" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail08342309d6f580e392/javablobstageblockfromurlsourceacfail144168cab0721069", + "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" : "a907eadc-7e48-4ef3-adee-69d8ed6939c8", + "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 20:10:17 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:17 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BC0E754E\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb448-601e-0051-074a-67fe5e000000", + "x-ms-client-request-id" : "a907eadc-7e48-4ef3-adee-69d8ed6939c8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail08342309d6f580e392?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" : "e9c19022-87f2-456b-94dc-0c72ba8e519b", + "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" : "\"0x8D73561BC1A9812\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb455-601e-0051-134a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:17 GMT", + "x-ms-client-request-id" : "e9c19022-87f2-456b-94dc-0c72ba8e519b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail08342309d6f580e392/javablobstageblockfromurlsourceacfail32517408f2c6f7bc", + "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" : "b9957177-274d-4fb7-87b6-401bfb9da4da", + "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 20:10:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:17 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BC278028\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb45d-601e-0051-1a4a-67fe5e000000", + "x-ms-client-request-id" : "b9957177-274d-4fb7-87b6-401bfb9da4da" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail08342309d6f580e392/javablobstageblockfromurlsourceacfail144168cab0721069?blockid=NDIxMzZkMDEtZTczMi00YmJiLTlmZDYtMDljODBiMDJiNWRi&comp=block", + "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" : "9905aa3a-3c09-4942-80af-a6833ee18791" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "755bb476-601e-0051-314a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:17 GMT", + "x-ms-client-request-id" : "9905aa3a-3c09-4942-80af-a6833ee18791" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockfromurlsourceacfail&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" : "a6bf971c-6f8b-43c8-abcc-3f5d557395f5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb47f-601e-0051-394a-67fe5e000000", + "Body" : "jtcstageblockfromurlsourceacfailjtcstageblockfromurlsourceacfail08342309d6f580e392Mon, 09 Sep 2019 20:10:18 GMT\"0x8D73561BC1A9812\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:18 GMT", + "x-ms-client-request-id" : "a6bf971c-6f8b-43c8-abcc-3f5d557395f5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail08342309d6f580e392?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" : "e51b6488-0d56-4f34-8a08-ea061a8bff88" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb490-601e-0051-474a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:18 GMT", + "x-ms-client-request-id" : "e51b6488-0d56-4f34-8a08-ea061a8bff88" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceacfail08342309d6f580e392", "javablobstageblockfromurlsourceacfail144168cab0721069", "javablobstageblockfromurlsourceacfail2242196198796a68", "42136d01-e732-4bbb-9fd6-09c80b02b5db", "javablobstageblockfromurlsourceacfail32517408f2c6f7bc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceacfail[1].json new file mode 100644 index 000000000000..47586cf0f40e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceacfail[1].json @@ -0,0 +1,159 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail065425bdbb576ca6b7?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" : "ceea9ad9-fc54-4944-be00-d999174a857e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561BC5EE1C6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb49e-601e-0051-514a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:18 GMT", + "x-ms-client-request-id" : "ceea9ad9-fc54-4944-be00-d999174a857e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail065425bdbb576ca6b7/javablobstageblockfromurlsourceacfail1585280b268ec813", + "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" : "fe94d2a7-eb0b-4231-bfa7-f2d79d9659c2", + "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 20:10:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BC6BC1A6\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb4a7-601e-0051-594a-67fe5e000000", + "x-ms-client-request-id" : "fe94d2a7-eb0b-4231-bfa7-f2d79d9659c2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail065425bdbb576ca6b7?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" : "02df60db-5039-4d55-b0cd-4093f41e39fe", + "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" : "\"0x8D73561BC779632\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb4b9-601e-0051-6a4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:18 GMT", + "x-ms-client-request-id" : "02df60db-5039-4d55-b0cd-4093f41e39fe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail065425bdbb576ca6b7/javablobstageblockfromurlsourceacfail32501469f1a0f6b9", + "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" : "f506ed27-1646-4aa5-a120-b67bcc2ffb03", + "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 20:10:18 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BC845739\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb4c2-601e-0051-734a-67fe5e000000", + "x-ms-client-request-id" : "f506ed27-1646-4aa5-a120-b67bcc2ffb03" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail065425bdbb576ca6b7/javablobstageblockfromurlsourceacfail1585280b268ec813?blockid=YmVmOTMxMzMtOTI3NC00M2JiLWEwM2YtOTdlNGUwNzZlNWVh&comp=block", + "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" : "1b96ecfa-47b1-4650-b77b-f63f5b919935" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "Content-Length" : "259", + "StatusCode" : "412", + "x-ms-request-id" : "755bb4d2-601e-0051-7f4a-67fe5e000000", + "Body" : "CannotVerifyCopySourceThe condition specified using HTTP conditional header(s) is not met.\nRequestId:755bb4d2-601e-0051-7f4a-67fe5e000000\nTime:2019-09-09T20:10:18.8021559Z", + "Date" : "Mon, 09 Sep 2019 20:10:18 GMT", + "x-ms-client-request-id" : "1b96ecfa-47b1-4650-b77b-f63f5b919935", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockfromurlsourceacfail&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" : "e1a2e8c8-1628-4556-a0d4-5d7470c93cf2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb4e3-601e-0051-0e4a-67fe5e000000", + "Body" : "jtcstageblockfromurlsourceacfailjtcstageblockfromurlsourceacfail065425bdbb576ca6b7Mon, 09 Sep 2019 20:10:18 GMT\"0x8D73561BC779632\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:18 GMT", + "x-ms-client-request-id" : "e1a2e8c8-1628-4556-a0d4-5d7470c93cf2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail065425bdbb576ca6b7?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" : "cebf2ae1-9204-460d-ab2f-2a2e2ad34219" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb4ec-601e-0051-164a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:18 GMT", + "x-ms-client-request-id" : "cebf2ae1-9204-460d-ab2f-2a2e2ad34219" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceacfail065425bdbb576ca6b7", "javablobstageblockfromurlsourceacfail1585280b268ec813", "javablobstageblockfromurlsourceacfail280614896c8b8879", "bef93133-9274-43bb-a03f-97e4e076e5ea", "javablobstageblockfromurlsourceacfail32501469f1a0f6b9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceacfail[2].json new file mode 100644 index 000000000000..5b6543f1b2f0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceacfail[2].json @@ -0,0 +1,159 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail0883162ea8cdff1331?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" : "045af61c-7014-4390-84f4-8a1660a986f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561BCB7722B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb4f7-601e-0051-204a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:18 GMT", + "x-ms-client-request-id" : "045af61c-7014-4390-84f4-8a1660a986f2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail0883162ea8cdff1331/javablobstageblockfromurlsourceacfail143207e46ca492e3", + "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" : "6a44f4c3-1828-42d1-b22b-6bfcb4800063", + "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 20:10:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:18 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BCC4793E\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb503-601e-0051-2b4a-67fe5e000000", + "x-ms-client-request-id" : "6a44f4c3-1828-42d1-b22b-6bfcb4800063" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail0883162ea8cdff1331?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" : "99a1362e-4eae-4255-b30f-110702aaaab3", + "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" : "\"0x8D73561BCD09BDF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb517-601e-0051-3b4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:18 GMT", + "x-ms-client-request-id" : "99a1362e-4eae-4255-b30f-110702aaaab3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail0883162ea8cdff1331/javablobstageblockfromurlsourceacfail348138d2f6da1e3b", + "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" : "0cc4b7f7-ccc9-4458-ad5e-dd02741b0ab2", + "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 20:10:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BCDD0ED5\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb520-601e-0051-434a-67fe5e000000", + "x-ms-client-request-id" : "0cc4b7f7-ccc9-4458-ad5e-dd02741b0ab2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail0883162ea8cdff1331/javablobstageblockfromurlsourceacfail143207e46ca492e3?blockid=OWNhZjUzYTMtYWM2Ni00ZGZjLThjNjMtNzdhNTgzYWVkZjIw&comp=block", + "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" : "3e8c1adc-9aef-4ece-8456-5b6af0e4145c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "SourceConditionNotMet", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "755bb533-601e-0051-564a-67fe5e000000", + "Body" : "SourceConditionNotMetThe source condition specified using HTTP conditional header(s) is not met.\nRequestId:755bb533-601e-0051-564a-67fe5e000000\nTime:2019-09-09T20:10:19.3705602Z", + "Date" : "Mon, 09 Sep 2019 20:10:19 GMT", + "x-ms-client-request-id" : "3e8c1adc-9aef-4ece-8456-5b6af0e4145c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockfromurlsourceacfail&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" : "2369563e-0235-4e9d-aabf-f8ee603defbe" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb546-601e-0051-664a-67fe5e000000", + "Body" : "jtcstageblockfromurlsourceacfailjtcstageblockfromurlsourceacfail0883162ea8cdff1331Mon, 09 Sep 2019 20:10:19 GMT\"0x8D73561BCD09BDF\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:19 GMT", + "x-ms-client-request-id" : "2369563e-0235-4e9d-aabf-f8ee603defbe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail0883162ea8cdff1331?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" : "81de8d81-a4f8-4a45-9be2-b84ec42a67be" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb554-601e-0051-734a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:19 GMT", + "x-ms-client-request-id" : "81de8d81-a4f8-4a45-9be2-b84ec42a67be" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceacfail0883162ea8cdff1331", "javablobstageblockfromurlsourceacfail143207e46ca492e3", "javablobstageblockfromurlsourceacfail2741070106b70c9c", "9caf53a3-ac66-4dfc-8c63-77a583aedf20", "javablobstageblockfromurlsourceacfail348138d2f6da1e3b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceacfail[3].json new file mode 100644 index 000000000000..f83da18bb99e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockfromurlsourceacfail[3].json @@ -0,0 +1,188 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail05562716d6ded07f7a?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" : "1583f491-7a05-481b-8441-c7e706605da7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561BD0F662A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bb564-601e-0051-7e4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:19 GMT", + "x-ms-client-request-id" : "1583f491-7a05-481b-8441-c7e706605da7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail05562716d6ded07f7a/javablobstageblockfromurlsourceacfail1870316bf03eb570", + "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" : "8124798b-b0a2-44a9-a6ef-62bc7150a9b8", + "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 20:10:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BD1C1F27\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb56c-601e-0051-054a-67fe5e000000", + "x-ms-client-request-id" : "8124798b-b0a2-44a9-a6ef-62bc7150a9b8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail05562716d6ded07f7a?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" : "d33eb737-9067-45fb-ad5b-474c3730c770", + "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" : "\"0x8D73561BD27F381\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb580-601e-0051-184a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:19 GMT", + "x-ms-client-request-id" : "d33eb737-9067-45fb-ad5b-474c3730c770" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail05562716d6ded07f7a/javablobstageblockfromurlsourceacfail397547dac9abd514", + "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" : "e0d998bd-9fa2-46c8-88f4-18ed1e521e05", + "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 20:10:19 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:19 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561BD346685\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bb58d-601e-0051-244a-67fe5e000000", + "x-ms-client-request-id" : "e0d998bd-9fa2-46c8-88f4-18ed1e521e05" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail05562716d6ded07f7a/javablobstageblockfromurlsourceacfail397547dac9abd514", + "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" : "d7d46b81-e3db-4841-a64e-355a9bcf21d6" + }, + "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 20:10:19 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:10:19 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561BD346685\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:10:19 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "755bb59d-601e-0051-304a-67fe5e000000", + "x-ms-client-request-id" : "d7d46b81-e3db-4841-a64e-355a9bcf21d6", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail05562716d6ded07f7a/javablobstageblockfromurlsourceacfail1870316bf03eb570?blockid=YTBmYTVlYTItZjg0ZS00NzlkLTk0ZGQtMzVlNGIwN2YzZDgz&comp=block", + "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" : "4cfbf13f-b521-47c6-8dd1-ee2f7211d737" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "755bb5b2-601e-0051-414a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:19 GMT", + "x-ms-client-request-id" : "4cfbf13f-b521-47c6-8dd1-ee2f7211d737" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockfromurlsourceacfail&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" : "572bb619-58c2-4b9c-ad9f-9ddf08ff4eb7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bb5be-601e-0051-4b4a-67fe5e000000", + "Body" : "jtcstageblockfromurlsourceacfailjtcstageblockfromurlsourceacfail05562716d6ded07f7aMon, 09 Sep 2019 20:10:19 GMT\"0x8D73561BD27F381\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:19 GMT", + "x-ms-client-request-id" : "572bb619-58c2-4b9c-ad9f-9ddf08ff4eb7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockfromurlsourceacfail05562716d6ded07f7a?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" : "fd09800a-a434-4016-a574-3e5fbd00a0d2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bb5c9-601e-0051-554a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:19 GMT", + "x-ms-client-request-id" : "fd09800a-a434-4016-a574-3e5fbd00a0d2" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockfromurlsourceacfail05562716d6ded07f7a", "javablobstageblockfromurlsourceacfail1870316bf03eb570", "javablobstageblockfromurlsourceacfail2008408701cb07f8", "a0fa5ea2-f84e-479d-94dd-35e4b07f3d83", "javablobstageblockfromurlsourceacfail397547dac9abd514" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockillegalarguments[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockillegalarguments[0].json new file mode 100644 index 000000000000..a249ed1bc51a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockillegalarguments[0].json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockillegalarguments03719177a78353812744?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" : "c2232b4d-1a46-454a-9024-8addccf4818a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B47745D2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd5bc8-501e-003f-034a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:10:04 GMT", + "x-ms-client-request-id" : "c2232b4d-1a46-454a-9024-8addccf4818a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockillegalarguments03719177a78353812744/javablobstageblockillegalarguments1901420a7774a814e", + "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" : "fba69255-8133-4bf6-9868-03bae9d42c52", + "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 20:10:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:04 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561B4840F72\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd5bdd-501e-003f-164a-675777000000", + "x-ms-client-request-id" : "fba69255-8133-4bf6-9868-03bae9d42c52" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockillegalarguments03719177a78353812744/javablobstageblockillegalarguments1901420a7774a814e?comp=block", + "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" : "f65e767b-1e3f-4c85-91bf-41ac797f6cdd", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "MissingRequiredQueryParameter", + "retry-after" : "0", + "Content-Length" : "315", + "StatusCode" : "400", + "x-ms-request-id" : "9ebd5bfa-501e-003f-324a-675777000000", + "Body" : "MissingRequiredQueryParameterA query parameter that's mandatory for this request is not specified.\nRequestId:9ebd5bfa-501e-003f-324a-675777000000\nTime:2019-09-09T20:10:05.3661054Zblockid", + "Date" : "Mon, 09 Sep 2019 20:10:04 GMT", + "x-ms-client-request-id" : "f65e767b-1e3f-4c85-91bf-41ac797f6cdd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockillegalarguments&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" : "4a89a665-faf9-4805-a106-ba7d539f990d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd5c0c-501e-003f-434a-675777000000", + "Body" : "jtcstageblockillegalargumentsjtcstageblockillegalarguments03719177a78353812744Mon, 09 Sep 2019 20:10:05 GMT\"0x8D73561B47745D2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:05 GMT", + "x-ms-client-request-id" : "4a89a665-faf9-4805-a106-ba7d539f990d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockillegalarguments03719177a78353812744?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" : "03a35163-28fb-4937-8346-45fa26032d64" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd5c1b-501e-003f-514a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:10:05 GMT", + "x-ms-client-request-id" : "03a35163-28fb-4937-8346-45fa26032d64" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockillegalarguments03719177a78353812744", "javablobstageblockillegalarguments1901420a7774a814e", "javablobstageblockillegalarguments211717a85c8595d38" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockillegalarguments[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockillegalarguments[1].json new file mode 100644 index 000000000000..24e429adc5a5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockillegalarguments[1].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockillegalarguments03851361375edd223d41?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" : "cf9b9018-4db6-468e-9dda-b8a2752f7b79" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B4B80402\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd5c28-501e-003f-5e4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:10:05 GMT", + "x-ms-client-request-id" : "cf9b9018-4db6-468e-9dda-b8a2752f7b79" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockillegalarguments03851361375edd223d41/javablobstageblockillegalarguments182397d84bb38602b", + "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" : "1cb3c167-dccd-468f-8bc5-c83a62739468", + "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 20:10:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:05 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561B4C4F4D5\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd5c3b-501e-003f-704a-675777000000", + "x-ms-client-request-id" : "1cb3c167-dccd-468f-8bc5-c83a62739468" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockillegalarguments&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" : "0bea835b-0042-45c6-a316-ad06f805b4b4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd5c4b-501e-003f-804a-675777000000", + "Body" : "jtcstageblockillegalargumentsjtcstageblockillegalarguments03851361375edd223d41Mon, 09 Sep 2019 20:10:05 GMT\"0x8D73561B4B80402\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:05 GMT", + "x-ms-client-request-id" : "0bea835b-0042-45c6-a316-ad06f805b4b4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockillegalarguments03851361375edd223d41?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" : "8712f527-ad0c-41fc-9b8e-8e20ed94375b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd5c57-501e-003f-0a4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:10:05 GMT", + "x-ms-client-request-id" : "8712f527-ad0c-41fc-9b8e-8e20ed94375b" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockillegalarguments03851361375edd223d41", "javablobstageblockillegalarguments182397d84bb38602b", "javablobstageblockillegalarguments298776dd422aa1718", "6d6970f0-9fc2-46da-8219-33ae2f6d009b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockillegalarguments[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockillegalarguments[2].json new file mode 100644 index 000000000000..f708f47e92fe --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockillegalarguments[2].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockillegalarguments0098539e880ac99fcd47?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" : "46e4d164-9e4f-412d-8681-379fd29325ed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B4EB0416\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd5c62-501e-003f-144a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:10:05 GMT", + "x-ms-client-request-id" : "46e4d164-9e4f-412d-8681-379fd29325ed" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockillegalarguments0098539e880ac99fcd47/javablobstageblockillegalarguments129983afd9e6c0d6f", + "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" : "db82a2a6-f42b-40a6-b626-36ddb7161ab1", + "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 20:10:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:05 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561B4F8432D\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd5c77-501e-003f-264a-675777000000", + "x-ms-client-request-id" : "db82a2a6-f42b-40a6-b626-36ddb7161ab1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockillegalarguments0098539e880ac99fcd47/javablobstageblockillegalarguments129983afd9e6c0d6f?blockid=ODIwN2Y1MzEtNzZhZS00ZjBiLTk4ZWQtMmE2MjhmNjJjMWJj&comp=block", + "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" : "1cf3ed77-a3f0-4a80-a492-a02632d8b31f", + "Content-Type" : "application/octet-stream" + }, + "Response" : null, + "Exception" : { + "ClassName" : "com.azure.core.exception.UnexpectedLengthException", + "ErrorMessage" : "Request body emitted 7 bytes less than the expected 8 bytes." + } + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockillegalarguments&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" : "5157d47d-3920-42b9-9f86-894f5a489ffb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "a78c2363-401e-002b-2c4a-679413000000", + "Body" : "jtcstageblockillegalargumentsjtcstageblockillegalarguments0098539e880ac99fcd47Mon, 09 Sep 2019 20:10:05 GMT\"0x8D73561B4EB0416\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:06 GMT", + "x-ms-client-request-id" : "5157d47d-3920-42b9-9f86-894f5a489ffb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockillegalarguments0098539e880ac99fcd47?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" : "3c2dc44c-c2ba-48b5-8091-21252647f32c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "a78c2374-401e-002b-3c4a-679413000000", + "Date" : "Mon, 09 Sep 2019 20:10:06 GMT", + "x-ms-client-request-id" : "3c2dc44c-c2ba-48b5-8091-21252647f32c" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockillegalarguments0098539e880ac99fcd47", "javablobstageblockillegalarguments129983afd9e6c0d6f", "javablobstageblockillegalarguments29539024f93dac32a", "8207f531-76ae-4f0b-98ed-2a628f62c1bc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockillegalarguments[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockillegalarguments[3].json new file mode 100644 index 000000000000..fbfa9e2fc182 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockillegalarguments[3].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockillegalarguments07502379e1adb42f1242?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" : "89343805-d8d5-48fe-892f-c425f2f20a18" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B54DEDAC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "a78c237e-401e-002b-464a-679413000000", + "Date" : "Mon, 09 Sep 2019 20:10:06 GMT", + "x-ms-client-request-id" : "89343805-d8d5-48fe-892f-c425f2f20a18" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockillegalarguments07502379e1adb42f1242/javablobstageblockillegalarguments1136696dba30bd416", + "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" : "54b4127d-9cb7-4e7a-bc60-6219b3e8afa4", + "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 20:10:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:06 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561B55A9967\"", + "Content-Length" : "0", + "x-ms-request-id" : "a78c238e-401e-002b-514a-679413000000", + "x-ms-client-request-id" : "54b4127d-9cb7-4e7a-bc60-6219b3e8afa4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockillegalarguments07502379e1adb42f1242/javablobstageblockillegalarguments1136696dba30bd416?blockid=NzM3MDNiYmYtMDg3My00MTIzLWE3NTctMTJhMjNmNmM2M2Uy&comp=block", + "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" : "bf6eb12f-db9b-472b-b87f-ee842fb816e7", + "Content-Type" : "application/octet-stream" + }, + "Response" : null, + "Exception" : { + "ClassName" : "com.azure.core.exception.UnexpectedLengthException", + "ErrorMessage" : "Request body emitted 7 bytes more than the expected 6 bytes." + } + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockillegalarguments&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" : "d06467fa-0e6d-403c-81dd-d1960ad0abaa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bae0b-601e-0051-2d4a-67fe5e000000", + "Body" : "jtcstageblockillegalargumentsjtcstageblockillegalarguments07502379e1adb42f1242Mon, 09 Sep 2019 20:10:06 GMT\"0x8D73561B54DEDAC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:06 GMT", + "x-ms-client-request-id" : "d06467fa-0e6d-403c-81dd-d1960ad0abaa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockillegalarguments07502379e1adb42f1242?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" : "70740a08-4c91-482d-b0bc-2d3a59008392" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bae16-601e-0051-354a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:06 GMT", + "x-ms-client-request-id" : "70740a08-4c91-482d-b0bc-2d3a59008392" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockillegalarguments07502379e1adb42f1242", "javablobstageblockillegalarguments1136696dba30bd416", "javablobstageblockillegalarguments269759a25d62a966a", "73703bbf-0873-4123-a757-12a23f6c63e2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblocklease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblocklease.json new file mode 100644 index 000000000000..485c7413d61c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblocklease.json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblocklease0blockblobapiteststageblockleasec0042875aa?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" : "777039ba-a23d-4cf0-bae3-827883e7cc97" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B61A3208\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bae89-601e-0051-1e4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:07 GMT", + "x-ms-client-request-id" : "777039ba-a23d-4cf0-bae3-827883e7cc97" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblocklease0blockblobapiteststageblockleasec0042875aa/javablobstageblocklease134748d476ca272e0f409e8", + "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" : "4866d27d-d610-4df4-92f4-e0516e0bd507", + "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 20:10:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:07 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561B627AC06\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bae91-601e-0051-244a-67fe5e000000", + "x-ms-client-request-id" : "4866d27d-d610-4df4-92f4-e0516e0bd507" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblocklease0blockblobapiteststageblockleasec0042875aa/javablobstageblocklease134748d476ca272e0f409e8?comp=lease", + "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" : "17293392-0254-45f3-a2af-fa0184358a5b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B627AC06\"", + "x-ms-lease-id" : "53167a47-6c0b-44d2-87d3-367009c20f80", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bae94-601e-0051-274a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:07 GMT", + "x-ms-client-request-id" : "17293392-0254-45f3-a2af-fa0184358a5b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblocklease0blockblobapiteststageblockleasec0042875aa/javablobstageblocklease134748d476ca272e0f409e8?blockid=YjEyYWU1YWEtNzVlZS00MjYzLTliZTctOTA1ODE0ZmNlNDgw&comp=block", + "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" : "48309dfb-f369-4493-8777-e68091de9fde", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bae98-601e-0051-2b4a-67fe5e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:07 GMT", + "x-ms-client-request-id" : "48309dfb-f369-4493-8777-e68091de9fde" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblocklease&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" : "7739b5bc-9de4-466b-b951-b30527636153" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755baea0-601e-0051-334a-67fe5e000000", + "Body" : "jtcstageblockleasejtcstageblocklease0blockblobapiteststageblockleasec0042875aaMon, 09 Sep 2019 20:10:07 GMT\"0x8D73561B61A3208\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:08 GMT", + "x-ms-client-request-id" : "7739b5bc-9de4-466b-b951-b30527636153", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblocklease0blockblobapiteststageblockleasec0042875aa?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" : "b1b6d10a-e2a7-459d-b507-311e9f1b01b6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755baeaa-601e-0051-3d4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:08 GMT", + "x-ms-client-request-id" : "b1b6d10a-e2a7-459d-b507-311e9f1b01b6" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblocklease0blockblobapiteststageblockleasec0042875aa", "javablobstageblocklease134748d476ca272e0f409e8", "javablobstageblocklease2948955622902f99e140d09", "b12ae5aa-75ee-4263-9be7-905814fce480" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockleasefail.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockleasefail.json new file mode 100644 index 000000000000..bb152ded7bfc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockleasefail.json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockleasefail07622129d21709bf2540e08?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" : "6812e912-a840-48c3-b081-0dea607b42f1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B6679CBB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755baeb4-601e-0051-454a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:08 GMT", + "x-ms-client-request-id" : "6812e912-a840-48c3-b081-0dea607b42f1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockleasefail07622129d21709bf2540e08/javablobstageblockleasefail1519428a9e08b7a1da45b", + "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" : "274f403f-72d8-473c-a63a-e91640c5be7a", + "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 20:10:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:08 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561B6742C68\"", + "Content-Length" : "0", + "x-ms-request-id" : "755baebd-601e-0051-4d4a-67fe5e000000", + "x-ms-client-request-id" : "274f403f-72d8-473c-a63a-e91640c5be7a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockleasefail07622129d21709bf2540e08/javablobstageblockleasefail1519428a9e08b7a1da45b?comp=lease", + "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" : "1807c315-f386-4528-8715-1410a38ec193" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B6742C68\"", + "x-ms-lease-id" : "efe9b0c9-34b1-4d90-a131-5fa228bc90a4", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755baec6-601e-0051-564a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:08 GMT", + "x-ms-client-request-id" : "1807c315-f386-4528-8715-1410a38ec193" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockleasefail07622129d21709bf2540e08/javablobstageblockleasefail1519428a9e08b7a1da45b?blockid=OWZjNzQ1ZGYtZDFlMy00ZWM1LWIxNzgtNmRlYTdlNjhjMzUw&comp=block", + "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" : "5ba51ece-f74c-4cfe-9364-31f43940bdc9", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "755baed4-601e-0051-634a-67fe5e000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:755baed4-601e-0051-634a-67fe5e000000\nTime:2019-09-09T20:10:08.6969709Z", + "Date" : "Mon, 09 Sep 2019 20:10:08 GMT", + "x-ms-client-request-id" : "5ba51ece-f74c-4cfe-9364-31f43940bdc9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockleasefail&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" : "22fb7b32-d44f-42fa-ab73-8a9771d36c5d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755baedc-601e-0051-694a-67fe5e000000", + "Body" : "jtcstageblockleasefailjtcstageblockleasefail07622129d21709bf2540e08Mon, 09 Sep 2019 20:10:08 GMT\"0x8D73561B6679CBB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:08 GMT", + "x-ms-client-request-id" : "22fb7b32-d44f-42fa-ab73-8a9771d36c5d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockleasefail07622129d21709bf2540e08?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" : "815e6ba9-4b80-4698-8194-801448640ae4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755baee1-601e-0051-6e4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:08 GMT", + "x-ms-client-request-id" : "815e6ba9-4b80-4698-8194-801448640ae4" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockleasefail07622129d21709bf2540e08", "javablobstageblockleasefail1519428a9e08b7a1da45b", "javablobstageblockleasefail28268505502d1c70da4a8", "9fc745df-d1e3-4ec5-b178-6dea7e68c350" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockmin.json new file mode 100644 index 000000000000..1971a8d6d179 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblockmin.json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockmin0blockblobapiteststageblockmin024243127f24?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" : "65480fb7-094f-4db8-bd65-04a458183759" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B422D50B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd5b66-501e-003f-234a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:10:04 GMT", + "x-ms-client-request-id" : "65480fb7-094f-4db8-bd65-04a458183759" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockmin0blockblobapiteststageblockmin024243127f24/javablobstageblockmin1blockblobapiteststageblockmin02467734fb", + "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" : "f457c638-65bf-4915-b310-7965140793dc", + "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 20:10:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:04 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561B42FEC85\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd5b7d-501e-003f-384a-675777000000", + "x-ms-client-request-id" : "f457c638-65bf-4915-b310-7965140793dc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockmin0blockblobapiteststageblockmin024243127f24/javablobstageblockmin1blockblobapiteststageblockmin02467734fb?blockid=ZjMxN2IwYTgtZTMxOS00MTU1LWIzMmYtMGNhYjUzZmZjYWZh&comp=block", + "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" : "0110938d-8f1b-4b48-a9ad-9e3ccd75bf2e", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd5b89-501e-003f-444a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:04 GMT", + "x-ms-client-request-id" : "0110938d-8f1b-4b48-a9ad-9e3ccd75bf2e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockmin0blockblobapiteststageblockmin024243127f24/javablobstageblockmin1blockblobapiteststageblockmin02467734fb?blocklisttype=all&comp=blocklist", + "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" : "8ef62dca-9025-487e-9b75-84a0aca1dbff" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "7", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:04 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:10:04 GMT", + "ETag" : "\"0x8D73561B42FEC85\"", + "x-ms-request-id" : "9ebd5b96-501e-003f-514a-675777000000", + "Body" : "ZjMxN2IwYTgtZTMxOS00MTU1LWIzMmYtMGNhYjUzZmZjYWZh7", + "x-ms-client-request-id" : "8ef62dca-9025-487e-9b75-84a0aca1dbff", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblockmin&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" : "9f1a8402-19bf-4a95-a76d-c582f057baf6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd5ba6-501e-003f-614a-675777000000", + "Body" : "jtcstageblockminjtcstageblockmin0blockblobapiteststageblockmin024243127f24Mon, 09 Sep 2019 20:10:04 GMT\"0x8D73561B422D50B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:04 GMT", + "x-ms-client-request-id" : "9f1a8402-19bf-4a95-a76d-c582f057baf6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblockmin0blockblobapiteststageblockmin024243127f24?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" : "c405902f-6415-4f79-acd6-925a414117d0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd5bb2-501e-003f-6d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:10:04 GMT", + "x-ms-client-request-id" : "c405902f-6415-4f79-acd6-925a414117d0" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblockmin0blockblobapiteststageblockmin024243127f24", "javablobstageblockmin1blockblobapiteststageblockmin02467734fb", "javablobstageblockmin2blockblobapiteststageblockmin02413668ee", "f317b0a8-e319-4155-b32f-0cab53ffcafa" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblocknullbody.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblocknullbody.json new file mode 100644 index 000000000000..70c9515530a6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITeststageblocknullbody.json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblocknullbody0261608c9d68ddcb364460bc?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" : "0b59b696-7c68-45a4-9080-67ecc543b555" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B5E50E9B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bae5f-601e-0051-784a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:07 GMT", + "x-ms-client-request-id" : "0b59b696-7c68-45a4-9080-67ecc543b555" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblocknullbody0261608c9d68ddcb364460bc/javablobstageblocknullbody1125452d6636c71e9c4c9", + "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" : "13b1361c-3b2e-46c9-94f3-cc42afae0286", + "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 20:10:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:07 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561B5F2FDC9\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bae68-601e-0051-7f4a-67fe5e000000", + "x-ms-client-request-id" : "13b1361c-3b2e-46c9-94f3-cc42afae0286" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstageblocknullbody&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" : "3d43b949-4638-4e27-ae52-5f1e3b4dd223" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bae76-601e-0051-0b4a-67fe5e000000", + "Body" : "jtcstageblocknullbodyjtcstageblocknullbody0261608c9d68ddcb364460bcMon, 09 Sep 2019 20:10:07 GMT\"0x8D73561B5E50E9B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:07 GMT", + "x-ms-client-request-id" : "3d43b949-4638-4e27-ae52-5f1e3b4dd223", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstageblocknullbody0261608c9d68ddcb364460bc?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" : "06578248-96f4-44c9-88ef-2d71597f5ff0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bae81-601e-0051-164a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:07 GMT", + "x-ms-client-request-id" : "06578248-96f4-44c9-88ef-2d71597f5ff0" + }, + "Exception" : null + } ], + "variables" : [ "jtcstageblocknullbody0261608c9d68ddcb364460bc", "javablobstageblocknullbody1125452d6636c71e9c4c9", "javablobstageblocknullbody2167267a8e72c2e25640c", "2fa6e338-2a03-46a3-9dd6-27d1cb4074cf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestupload.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestupload.json new file mode 100644 index 000000000000..765f02820e0c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestupload.json @@ -0,0 +1,146 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcupload0blockblobapitestupload6d607483ccbd64107a8?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" : "be8065de-6afa-49fc-bc9c-05c47a343cad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C62768EE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bbfd6-601e-0051-504a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:34 GMT", + "x-ms-client-request-id" : "be8065de-6afa-49fc-bc9c-05c47a343cad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcupload0blockblobapitestupload6d607483ccbd64107a8/javablobupload1blockblobapitestupload6d673469063119faa", + "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" : "1d748078-8a0e-478b-83e0-65e0685915e2", + "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 20:10:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:34 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C6344BE5\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bbfe4-601e-0051-5d4a-67fe5e000000", + "x-ms-client-request-id" : "1d748078-8a0e-478b-83e0-65e0685915e2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcupload0blockblobapitestupload6d607483ccbd64107a8/javablobupload1blockblobapitestupload6d673469063119faa", + "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" : "b183a6dd-eeaa-4871-93b5-de7cee7cf380", + "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 20:10:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:34 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C640831F\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bbff3-601e-0051-6b4a-67fe5e000000", + "x-ms-client-request-id" : "b183a6dd-eeaa-4871-93b5-de7cee7cf380" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcupload0blockblobapitestupload6d607483ccbd64107a8/javablobupload1blockblobapitestupload6d673469063119faa", + "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" : "2540486a-2256-445c-86c6-aaf988f62257" + }, + "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 20:10:35 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:10:34 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73561C640831F\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:10:34 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "755bc006-601e-0051-7d4a-67fe5e000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "2540486a-2256-445c-86c6-aaf988f62257", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcupload&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" : "4406bf46-9ff3-4995-874f-541b6d838288" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bc013-601e-0051-0a4a-67fe5e000000", + "Body" : "jtcuploadjtcupload0blockblobapitestupload6d607483ccbd64107a8Mon, 09 Sep 2019 20:10:34 GMT\"0x8D73561C62768EE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:34 GMT", + "x-ms-client-request-id" : "4406bf46-9ff3-4995-874f-541b6d838288", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcupload0blockblobapitestupload6d607483ccbd64107a8?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" : "1d294d06-345f-40f2-b1b4-fc3bc252ba02" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bc01c-601e-0051-124a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:34 GMT", + "x-ms-client-request-id" : "1d294d06-345f-40f2-b1b4-fc3bc252ba02" + }, + "Exception" : null + } ], + "variables" : [ "jtcupload0blockblobapitestupload6d607483ccbd64107a8", "javablobupload1blockblobapitestupload6d673469063119faa", "javablobupload2blockblobapitestupload6d632278aa758bd90" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[0].json new file mode 100644 index 000000000000..022ac3a2a9dd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[0].json @@ -0,0 +1,115 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac52f61072b3be26088?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" : "dd5ee435-d856-48ce-934f-a0609e8d7325" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C94F385C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "806c7255-a01e-006e-2b4a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:39 GMT", + "x-ms-client-request-id" : "dd5ee435-d856-48ce-934f-a0609e8d7325" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac52f61072b3be26088/javablobuploadac1blockblobapitestuploadac52f5033508071ea", + "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" : "95021588-6461-480b-a817-07855df9b92f", + "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 20:10:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:39 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C95DBE9A\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c7271-a01e-006e-434a-674982000000", + "x-ms-client-request-id" : "95021588-6461-480b-a817-07855df9b92f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac52f61072b3be26088/javablobuploadac1blockblobapitestuploadac52f5033508071ea", + "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" : "3befc3a4-2c92-471f-a263-bbec2a28ed2e", + "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 20:10:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:39 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C96A1CEE\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c728a-a01e-006e-584a-674982000000", + "x-ms-client-request-id" : "3befc3a4-2c92-471f-a263-bbec2a28ed2e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadac&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" : "8d1b8e2e-acbe-448a-ac14-bfbeb9191d11" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "806c7299-a01e-006e-664a-674982000000", + "Body" : "jtcuploadacjtcuploadac0blockblobapitestuploadac52f61072b3be26088Mon, 09 Sep 2019 20:10:40 GMT\"0x8D73561C94F385C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:39 GMT", + "x-ms-client-request-id" : "8d1b8e2e-acbe-448a-ac14-bfbeb9191d11", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac52f61072b3be26088?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" : "9d035421-c749-4308-b52e-beb3fec577c8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "806c72ae-a01e-006e-794a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:39 GMT", + "x-ms-client-request-id" : "9d035421-c749-4308-b52e-beb3fec577c8" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadac0blockblobapitestuploadac52f61072b3be26088", "javablobuploadac1blockblobapitestuploadac52f5033508071ea", "javablobuploadac2blockblobapitestuploadac52f61742b0bbab5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[1].json new file mode 100644 index 000000000000..6c60f11542c1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[1].json @@ -0,0 +1,115 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadaccfc10950dc23ff628?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" : "d5f4f7f9-e3d4-4e28-8e89-450cfd47dab0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C9901CF4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "806c72b8-a01e-006e-034a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:39 GMT", + "x-ms-client-request-id" : "d5f4f7f9-e3d4-4e28-8e89-450cfd47dab0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadaccfc10950dc23ff628/javablobuploadac1blockblobapitestuploadaccfc43305af6d3ae", + "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" : "5539f454-971c-4337-aac4-fc01e5831a03", + "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 20:10:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:39 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C99DB98B\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c72c3-a01e-006e-0d4a-674982000000", + "x-ms-client-request-id" : "5539f454-971c-4337-aac4-fc01e5831a03" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadaccfc10950dc23ff628/javablobuploadac1blockblobapitestuploadaccfc43305af6d3ae", + "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" : "90d306a0-b1ee-42b2-a9d9-648a3b87d7ac", + "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 20:10:40 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:39 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C9AA17E3\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c72d0-a01e-006e-1a4a-674982000000", + "x-ms-client-request-id" : "90d306a0-b1ee-42b2-a9d9-648a3b87d7ac" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadac&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" : "1e4f1cd2-c642-4294-b156-2750b4bf50ab" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "806c72d9-a01e-006e-234a-674982000000", + "Body" : "jtcuploadacjtcuploadac0blockblobapitestuploadaccfc10950dc23ff628Mon, 09 Sep 2019 20:10:40 GMT\"0x8D73561C9901CF4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:39 GMT", + "x-ms-client-request-id" : "1e4f1cd2-c642-4294-b156-2750b4bf50ab", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadaccfc10950dc23ff628?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" : "7d2ab006-85c4-4bdc-89ea-3aebf936eeb6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "806c72e4-a01e-006e-2d4a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:40 GMT", + "x-ms-client-request-id" : "7d2ab006-85c4-4bdc-89ea-3aebf936eeb6" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadac0blockblobapitestuploadaccfc10950dc23ff628", "javablobuploadac1blockblobapitestuploadaccfc43305af6d3ae", "javablobuploadac2blockblobapitestuploadaccfc119726dba9e5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[2].json new file mode 100644 index 000000000000..cc1f0e8cd0ba --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[2].json @@ -0,0 +1,115 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac78966903298ff365e?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" : "9e542b22-7725-4aff-aa49-c8004a0f9d53" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C9CF539E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "806c72fb-a01e-006e-434a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:40 GMT", + "x-ms-client-request-id" : "9e542b22-7725-4aff-aa49-c8004a0f9d53" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac78966903298ff365e/javablobuploadac1blockblobapitestuploadac78943350f2851ba", + "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" : "b2593e71-8f34-40a4-8174-c22490eab51e", + "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 20:10:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:40 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C9DCA2DF\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c730b-a01e-006e-514a-674982000000", + "x-ms-client-request-id" : "b2593e71-8f34-40a4-8174-c22490eab51e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac78966903298ff365e/javablobuploadac1blockblobapitestuploadac78943350f2851ba", + "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" : "c87d37b5-7a6d-4169-a574-c5e35d69272d", + "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 20:10:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:40 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C9E92848\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c7316-a01e-006e-5a4a-674982000000", + "x-ms-client-request-id" : "c87d37b5-7a6d-4169-a574-c5e35d69272d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadac&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" : "beef30dd-f8ad-43d5-b46f-ca0db64a6e3e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "806c7324-a01e-006e-684a-674982000000", + "Body" : "jtcuploadacjtcuploadac0blockblobapitestuploadac78966903298ff365eMon, 09 Sep 2019 20:10:41 GMT\"0x8D73561C9CF539E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:40 GMT", + "x-ms-client-request-id" : "beef30dd-f8ad-43d5-b46f-ca0db64a6e3e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac78966903298ff365e?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" : "dbe32621-7bd3-42a2-9eee-d30c1d89de91" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "806c7337-a01e-006e-7a4a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:40 GMT", + "x-ms-client-request-id" : "dbe32621-7bd3-42a2-9eee-d30c1d89de91" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadac0blockblobapitestuploadac78966903298ff365e", "javablobuploadac1blockblobapitestuploadac78943350f2851ba", "javablobuploadac2blockblobapitestuploadac78972633a06c9e3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[3].json new file mode 100644 index 000000000000..ac27b2afb100 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[3].json @@ -0,0 +1,147 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac66f6395868482e823?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" : "50ba85d6-5bc0-437b-8a94-abaddafaefaf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561CA108679\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "806c7354-a01e-006e-174a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:40 GMT", + "x-ms-client-request-id" : "50ba85d6-5bc0-437b-8a94-abaddafaefaf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac66f6395868482e823/javablobuploadac1blockblobapitestuploadac66f268574847344", + "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" : "432b58ef-43c8-4758-929a-455756d62d9b", + "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 20:10:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:40 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561CA1E24AD\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c7361-a01e-006e-214a-674982000000", + "x-ms-client-request-id" : "432b58ef-43c8-4758-929a-455756d62d9b" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac66f6395868482e823/javablobuploadac1blockblobapitestuploadac66f268574847344", + "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" : "4bdfc820-85d8-4f52-9736-d44ac570ed05" + }, + "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 20:10:41 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:10:40 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561CA1E24AD\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:10:41 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "806c7374-a01e-006e-334a-674982000000", + "x-ms-client-request-id" : "4bdfc820-85d8-4f52-9736-d44ac570ed05", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac66f6395868482e823/javablobuploadac1blockblobapitestuploadac66f268574847344", + "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" : "46711dd5-b853-40b9-8a21-8884a1d266f6", + "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 20:10:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:40 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561CA36BA3D\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c7385-a01e-006e-414a-674982000000", + "x-ms-client-request-id" : "46711dd5-b853-40b9-8a21-8884a1d266f6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadac&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" : "01942434-a8ec-4377-9e9a-dfffbbac2f16" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "806c7391-a01e-006e-4d4a-674982000000", + "Body" : "jtcuploadacjtcuploadac0blockblobapitestuploadac66f6395868482e823Mon, 09 Sep 2019 20:10:41 GMT\"0x8D73561CA108679\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:40 GMT", + "x-ms-client-request-id" : "01942434-a8ec-4377-9e9a-dfffbbac2f16", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac66f6395868482e823?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" : "610d81c0-9bc6-4886-a7b3-49db5ebb240d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "806c739d-a01e-006e-584a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:40 GMT", + "x-ms-client-request-id" : "610d81c0-9bc6-4886-a7b3-49db5ebb240d" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadac0blockblobapitestuploadac66f6395868482e823", "javablobuploadac1blockblobapitestuploadac66f268574847344", "javablobuploadac2blockblobapitestuploadac66f57327efcc59b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[4].json new file mode 100644 index 000000000000..615efb42f6e1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[4].json @@ -0,0 +1,115 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadace14232541406d1978?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" : "54181212-2f63-4e27-98eb-6b2951f5b409" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561CA5E179B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "806c73a8-a01e-006e-634a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:41 GMT", + "x-ms-client-request-id" : "54181212-2f63-4e27-98eb-6b2951f5b409" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadace14232541406d1978/javablobuploadac1blockblobapitestuploadace1439526ac57654", + "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" : "a2995014-35f2-442e-a1cb-5ebf048ef53b", + "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 20:10:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:41 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561CA6B8F81\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c73bc-a01e-006e-734a-674982000000", + "x-ms-client-request-id" : "a2995014-35f2-442e-a1cb-5ebf048ef53b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadace14232541406d1978/javablobuploadac1blockblobapitestuploadace1439526ac57654", + "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" : "45913e7c-7947-4f96-9f13-550d27d9d386", + "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 20:10:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:41 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561CA77C6B1\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c73d0-a01e-006e-054a-674982000000", + "x-ms-client-request-id" : "45913e7c-7947-4f96-9f13-550d27d9d386" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadac&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" : "0ed75c6d-5773-4a80-97be-f3dc9c305140" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "806c73dd-a01e-006e-104a-674982000000", + "Body" : "jtcuploadacjtcuploadac0blockblobapitestuploadace14232541406d1978Mon, 09 Sep 2019 20:10:41 GMT\"0x8D73561CA5E179B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:41 GMT", + "x-ms-client-request-id" : "0ed75c6d-5773-4a80-97be-f3dc9c305140", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadace14232541406d1978?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" : "359034c1-d4e9-4a85-8f47-d1ebe32cab52" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "806c73e9-a01e-006e-1c4a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:41 GMT", + "x-ms-client-request-id" : "359034c1-d4e9-4a85-8f47-d1ebe32cab52" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadac0blockblobapitestuploadace14232541406d1978", "javablobuploadac1blockblobapitestuploadace1439526ac57654", "javablobuploadac2blockblobapitestuploadace1413566a3fcb6b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[5].json new file mode 100644 index 000000000000..7aa6e0c08dff --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadac[5].json @@ -0,0 +1,137 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac2e042286ddee4edb3?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" : "74742a1a-1295-428c-86e4-a8307dd6cae7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561CA9F4A7F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "806c73fe-a01e-006e-2d4a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:41 GMT", + "x-ms-client-request-id" : "74742a1a-1295-428c-86e4-a8307dd6cae7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac2e042286ddee4edb3/javablobuploadac1blockblobapitestuploadac2e03765602efd08", + "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" : "dec6cbfb-9f8f-4bbc-800e-47fc469019f5", + "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 20:10:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:41 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561CAAC74D8\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c740a-a01e-006e-384a-674982000000", + "x-ms-client-request-id" : "dec6cbfb-9f8f-4bbc-800e-47fc469019f5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac2e042286ddee4edb3/javablobuploadac1blockblobapitestuploadac2e03765602efd08?comp=lease", + "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" : "c48eca0c-2561-43f7-a11b-3dbf9ed2e0b8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561CAAC74D8\"", + "x-ms-lease-id" : "36e9f9a8-344c-456a-b42f-e2fb4a680155", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "806c7413-a01e-006e-3f4a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:41 GMT", + "x-ms-client-request-id" : "c48eca0c-2561-43f7-a11b-3dbf9ed2e0b8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac2e042286ddee4edb3/javablobuploadac1blockblobapitestuploadac2e03765602efd08", + "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" : "7bb6d9a6-e4ef-40f2-92bc-e3c9e0cd3f7c", + "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 20:10:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:41 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561CAC5589D\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c7419-a01e-006e-454a-674982000000", + "x-ms-client-request-id" : "7bb6d9a6-e4ef-40f2-92bc-e3c9e0cd3f7c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadac&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" : "586aa4ec-aacb-40a1-b8b9-f3da04a291d1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "806c7420-a01e-006e-4c4a-674982000000", + "Body" : "jtcuploadacjtcuploadac0blockblobapitestuploadac2e042286ddee4edb3Mon, 09 Sep 2019 20:10:42 GMT\"0x8D73561CA9F4A7F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:41 GMT", + "x-ms-client-request-id" : "586aa4ec-aacb-40a1-b8b9-f3da04a291d1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadac0blockblobapitestuploadac2e042286ddee4edb3?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" : "090a5167-b9b1-4962-9ffa-4e2344cc6ab9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "806c742e-a01e-006e-574a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:41 GMT", + "x-ms-client-request-id" : "090a5167-b9b1-4962-9ffa-4e2344cc6ab9" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadac0blockblobapitestuploadac2e042286ddee4edb3", "javablobuploadac1blockblobapitestuploadac2e03765602efd08", "javablobuploadac2blockblobapitestuploadac2e026102b695d1c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[0].json new file mode 100644 index 000000000000..6ebabf8333b6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[0].json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfailbe06431368b74?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" : "e46a36c5-c24a-4079-a6d9-f70014ea6850" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561CAECDB77\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "806c743d-a01e-006e-664a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:41 GMT", + "x-ms-client-request-id" : "e46a36c5-c24a-4079-a6d9-f70014ea6850" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfailbe06431368b74/javablobuploadacfail1blockblobapitestuploadacfailbe056270f55", + "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" : "4a770d3e-b84b-47b6-9515-051552ddbbed", + "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 20:10:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:42 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561CAFB3F98\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c7449-a01e-006e-714a-674982000000", + "x-ms-client-request-id" : "4a770d3e-b84b-47b6-9515-051552ddbbed" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfailbe06431368b74/javablobuploadacfail1blockblobapitestuploadacfailbe056270f55", + "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" : "f3a70d2a-3f0d-427f-a8e4-85b277499f1d", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "806c745d-a01e-006e-024a-674982000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:806c745d-a01e-006e-024a-674982000000\nTime:2019-09-09T20:10:43.0595853Z", + "Date" : "Mon, 09 Sep 2019 20:10:42 GMT", + "x-ms-client-request-id" : "f3a70d2a-3f0d-427f-a8e4-85b277499f1d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadacfail&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" : "785a7e4d-7788-49a7-bbae-8bc812f28b6d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "806c746d-a01e-006e-0f4a-674982000000", + "Body" : "jtcuploadacfailjtcuploadacfail0blockblobapitestuploadacfailbe06431368b74Mon, 09 Sep 2019 20:10:42 GMT\"0x8D73561CAECDB77\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:42 GMT", + "x-ms-client-request-id" : "785a7e4d-7788-49a7-bbae-8bc812f28b6d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfailbe06431368b74?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" : "8269761b-69d0-4bb2-aa6e-f9f377e6afa9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "806c747f-a01e-006e-214a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:42 GMT", + "x-ms-client-request-id" : "8269761b-69d0-4bb2-aa6e-f9f377e6afa9" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadacfail0blockblobapitestuploadacfailbe06431368b74", "javablobuploadacfail1blockblobapitestuploadacfailbe056270f55", "javablobuploadacfail2blockblobapitestuploadacfailbe0496835f3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[1].json new file mode 100644 index 000000000000..43583585d8dc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[1].json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail396488564698b?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" : "0e99173f-f424-4400-b6cf-25c4c2cfe2f1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561CB2F1FEC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "806c7498-a01e-006e-364a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:42 GMT", + "x-ms-client-request-id" : "0e99173f-f424-4400-b6cf-25c4c2cfe2f1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail396488564698b/javablobuploadacfail1blockblobapitestuploadacfail396926286b1", + "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" : "d76bd402-64f7-42d3-a07d-aa42052efed6", + "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 20:10:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:42 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561CB3C9A5F\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c74aa-a01e-006e-464a-674982000000", + "x-ms-client-request-id" : "d76bd402-64f7-42d3-a07d-aa42052efed6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail396488564698b/javablobuploadacfail1blockblobapitestuploadacfail396926286b1", + "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" : "139781b4-6b69-48f9-8c8e-ad9132a3582f", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "806c74b0-a01e-006e-4c4a-674982000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:806c74b0-a01e-006e-4c4a-674982000000\nTime:2019-09-09T20:10:43.4848707Z", + "Date" : "Mon, 09 Sep 2019 20:10:42 GMT", + "x-ms-client-request-id" : "139781b4-6b69-48f9-8c8e-ad9132a3582f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadacfail&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" : "fe277250-49f4-49aa-9323-6929f0604cc8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "806c74bd-a01e-006e-594a-674982000000", + "Body" : "jtcuploadacfailjtcuploadacfail0blockblobapitestuploadacfail396488564698bMon, 09 Sep 2019 20:10:43 GMT\"0x8D73561CB2F1FEC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:42 GMT", + "x-ms-client-request-id" : "fe277250-49f4-49aa-9323-6929f0604cc8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail396488564698b?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" : "830fc01c-8e22-4798-b4cc-18d8d717d8ec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "806c74ca-a01e-006e-664a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:42 GMT", + "x-ms-client-request-id" : "830fc01c-8e22-4798-b4cc-18d8d717d8ec" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadacfail0blockblobapitestuploadacfail396488564698b", "javablobuploadacfail1blockblobapitestuploadacfail396926286b1", "javablobuploadacfail2blockblobapitestuploadacfail39629783575" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[2].json new file mode 100644 index 000000000000..d0ee466f4361 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[2].json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail5c13901528c2f?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" : "645abe77-985d-4b4d-ae96-e7db326df811" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561CB6F4138\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "806c74d8-a01e-006e-744a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:42 GMT", + "x-ms-client-request-id" : "645abe77-985d-4b4d-ae96-e7db326df811" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail5c13901528c2f/javablobuploadacfail1blockblobapitestuploadacfail5c111351f1b", + "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" : "f0ab2440-ffdf-476c-b6c6-6e2547623778", + "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 20:10:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:42 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561CB7CBC64\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c74ed-a01e-006e-044a-674982000000", + "x-ms-client-request-id" : "f0ab2440-ffdf-476c-b6c6-6e2547623778" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail5c13901528c2f/javablobuploadacfail1blockblobapitestuploadacfail5c111351f1b", + "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" : "0c4dcd31-2b66-458a-9088-11848bac286b", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "806c74fd-a01e-006e-124a-674982000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:806c74fd-a01e-006e-124a-674982000000\nTime:2019-09-09T20:10:43.9041526Z", + "Date" : "Mon, 09 Sep 2019 20:10:43 GMT", + "x-ms-client-request-id" : "0c4dcd31-2b66-458a-9088-11848bac286b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadacfail&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" : "2f14f71d-2463-4694-9bd9-abf748ac1624" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "806c751b-a01e-006e-2f4a-674982000000", + "Body" : "jtcuploadacfailjtcuploadacfail0blockblobapitestuploadacfail5c13901528c2fMon, 09 Sep 2019 20:10:43 GMT\"0x8D73561CB6F4138\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:43 GMT", + "x-ms-client-request-id" : "2f14f71d-2463-4694-9bd9-abf748ac1624", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfail5c13901528c2f?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" : "9f7e055e-f834-411f-9015-f3e8656ae6bd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "806c7540-a01e-006e-544a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:43 GMT", + "x-ms-client-request-id" : "9f7e055e-f834-411f-9015-f3e8656ae6bd" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadacfail0blockblobapitestuploadacfail5c13901528c2f", "javablobuploadacfail1blockblobapitestuploadacfail5c111351f1b", "javablobuploadacfail2blockblobapitestuploadacfail5c140763f13" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[3].json new file mode 100644 index 000000000000..59ff54e15fa6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[3].json @@ -0,0 +1,145 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfailca286123ed82c?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" : "f226657a-8660-4b0f-9fbc-e13465994413" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561CBAF3B70\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "806c7560-a01e-006e-744a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:43 GMT", + "x-ms-client-request-id" : "f226657a-8660-4b0f-9fbc-e13465994413" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfailca286123ed82c/javablobuploadacfail1blockblobapitestuploadacfailca293507cf0", + "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" : "1ae4841b-d4b1-4e75-a26b-b8d7248e3cf3", + "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 20:10:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:43 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561CBBC4211\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c756b-a01e-006e-7e4a-674982000000", + "x-ms-client-request-id" : "1ae4841b-d4b1-4e75-a26b-b8d7248e3cf3" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfailca286123ed82c/javablobuploadacfail1blockblobapitestuploadacfailca293507cf0", + "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" : "b6d88b88-23b7-4858-826f-d227526f0ae4" + }, + "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 20:10:44 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:10:43 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561CBBC4211\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:10:44 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "806c757f-a01e-006e-124a-674982000000", + "x-ms-client-request-id" : "b6d88b88-23b7-4858-826f-d227526f0ae4", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfailca286123ed82c/javablobuploadacfail1blockblobapitestuploadacfailca293507cf0", + "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" : "b5f026b5-08a4-401d-bab2-4b925f8ab622", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "806c7594-a01e-006e-254a-674982000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:806c7594-a01e-006e-254a-674982000000\nTime:2019-09-09T20:10:44.4044882Z", + "Date" : "Mon, 09 Sep 2019 20:10:43 GMT", + "x-ms-client-request-id" : "b5f026b5-08a4-401d-bab2-4b925f8ab622", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadacfail&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" : "5ca61ad7-5897-4e11-9be5-df7e5a7a8839" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "806c759d-a01e-006e-2e4a-674982000000", + "Body" : "jtcuploadacfailjtcuploadacfail0blockblobapitestuploadacfailca286123ed82cMon, 09 Sep 2019 20:10:44 GMT\"0x8D73561CBAF3B70\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:43 GMT", + "x-ms-client-request-id" : "5ca61ad7-5897-4e11-9be5-df7e5a7a8839", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfailca286123ed82c?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" : "3e0a11d2-46dc-4bf7-a139-9769baf8e116" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "806c75ab-a01e-006e-3a4a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:43 GMT", + "x-ms-client-request-id" : "3e0a11d2-46dc-4bf7-a139-9769baf8e116" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadacfail0blockblobapitestuploadacfailca286123ed82c", "javablobuploadacfail1blockblobapitestuploadacfailca293507cf0", "javablobuploadacfail2blockblobapitestuploadacfailca222921370" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[4].json new file mode 100644 index 000000000000..98502271cacb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadacfail[4].json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfaila7780088db359?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" : "6f1f4f03-f8ee-4042-8b7d-e69930d80c80" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561CBFAA934\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "806c75bf-a01e-006e-4d4a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:43 GMT", + "x-ms-client-request-id" : "6f1f4f03-f8ee-4042-8b7d-e69930d80c80" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfaila7780088db359/javablobuploadacfail1blockblobapitestuploadacfaila7797806086", + "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" : "bfa59858-afff-492b-9d29-1183e1f5e7d9", + "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 20:10:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:43 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561CC0789A1\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c75d8-a01e-006e-654a-674982000000", + "x-ms-client-request-id" : "bfa59858-afff-492b-9d29-1183e1f5e7d9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfaila7780088db359/javablobuploadacfail1blockblobapitestuploadacfaila7797806086?comp=lease", + "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" : "350d8bd2-3cad-4964-8e75-3ae40ce422fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561CC0789A1\"", + "x-ms-lease-id" : "f6a021be-4726-487d-86f9-207bed39d5cb", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "806c75f2-a01e-006e-7c4a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:43 GMT", + "x-ms-client-request-id" : "350d8bd2-3cad-4964-8e75-3ae40ce422fc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfaila7780088db359/javablobuploadacfail1blockblobapitestuploadacfaila7797806086", + "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" : "0e817d8b-df3f-4475-a34e-f7bf49b153bc", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "806c75ff-a01e-006e-074a-674982000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:806c75ff-a01e-006e-074a-674982000000\nTime:2019-09-09T20:10:44.8918133Z", + "Date" : "Mon, 09 Sep 2019 20:10:43 GMT", + "x-ms-client-request-id" : "0e817d8b-df3f-4475-a34e-f7bf49b153bc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadacfail&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" : "a6f584a9-a7cc-4765-9e8b-d9d72ba44e6a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "806c760b-a01e-006e-114a-674982000000", + "Body" : "jtcuploadacfailjtcuploadacfail0blockblobapitestuploadacfaila7780088db359Mon, 09 Sep 2019 20:10:44 GMT\"0x8D73561CBFAA934\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:44 GMT", + "x-ms-client-request-id" : "a6f584a9-a7cc-4765-9e8b-d9d72ba44e6a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadacfail0blockblobapitestuploadacfaila7780088db359?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" : "6b94376c-ad2b-4b58-b68f-e0685a611b65" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "806c7616-a01e-006e-1b4a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:44 GMT", + "x-ms-client-request-id" : "6b94376c-ad2b-4b58-b68f-e0685a611b65" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadacfail0blockblobapitestuploadacfaila7780088db359", "javablobuploadacfail1blockblobapitestuploadacfaila7797806086", "javablobuploadacfail2blockblobapitestuploadacfaila7747697cf0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploademptybody.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploademptybody.json new file mode 100644 index 000000000000..353dbba1f021 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploademptybody.json @@ -0,0 +1,115 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploademptybody0blockblobapitestuploademptybodyf6b47745d1?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" : "941b18ef-69b2-45b1-b8fa-97883c8215be" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C7A4255F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "806c7058-a01e-006e-544a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:36 GMT", + "x-ms-client-request-id" : "941b18ef-69b2-45b1-b8fa-97883c8215be" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploademptybody0blockblobapitestuploademptybodyf6b47745d1/javablobuploademptybody1829475a417b342402480a9", + "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" : "a957f3f3-83e2-429a-aea5-0fd779b04cce", + "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 20:10:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:36 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C7B2585B\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c706d-a01e-006e-684a-674982000000", + "x-ms-client-request-id" : "a957f3f3-83e2-429a-aea5-0fd779b04cce" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploademptybody0blockblobapitestuploademptybodyf6b47745d1/javablobuploademptybody1829475a417b342402480a9", + "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" : "0a263b22-2477-4682-816c-0400026b0ef9", + "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" : "AAAAAAAAAAA=", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:36 GMT", + "Content-MD5" : "1B2M2Y8AsgTpgAmY7PhCfg==", + "ETag" : "\"0x8D73561C7BE8F95\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c7079-a01e-006e-744a-674982000000", + "x-ms-client-request-id" : "0a263b22-2477-4682-816c-0400026b0ef9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploademptybody&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" : "f40a55c9-89c3-41d7-aeef-d07f1c2d1427" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "806c7094-a01e-006e-0a4a-674982000000", + "Body" : "jtcuploademptybodyjtcuploademptybody0blockblobapitestuploademptybodyf6b47745d1Mon, 09 Sep 2019 20:10:37 GMT\"0x8D73561C7A4255F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:36 GMT", + "x-ms-client-request-id" : "f40a55c9-89c3-41d7-aeef-d07f1c2d1427", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploademptybody0blockblobapitestuploademptybodyf6b47745d1?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" : "6f21f905-9042-4103-a1ec-114d1efbce67" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "806c70a6-a01e-006e-1a4a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:36 GMT", + "x-ms-client-request-id" : "6f21f905-9042-4103-a1ec-114d1efbce67" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploademptybody0blockblobapitestuploademptybodyf6b47745d1", "javablobuploademptybody1829475a417b342402480a9", "javablobuploademptybody26314780a4f82d520544aba" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploaderror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploaderror.json new file mode 100644 index 000000000000..a98d9d085e1a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploaderror.json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploaderror0blockblobapitestuploaderror4e826505d4cef6?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" : "ac29fdd2-2593-48fa-8491-0c6321e1f797" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561CC4616F3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "806c7628-a01e-006e-2d4a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:44 GMT", + "x-ms-client-request-id" : "ac29fdd2-2593-48fa-8491-0c6321e1f797" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploaderror0blockblobapitestuploaderror4e826505d4cef6/javablobuploaderror1blockblobapitestuploaderror4e8941393ac3", + "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" : "f0bf27f7-1102-4f70-98ab-dc370594c48f", + "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 20:10:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:44 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561CC5409DD\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c762f-a01e-006e-334a-674982000000", + "x-ms-client-request-id" : "f0bf27f7-1102-4f70-98ab-dc370594c48f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploaderror0blockblobapitestuploaderror4e826505d4cef6/javablobuploaderror3blockblobapitestuploaderror4e81083894f4", + "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" : "494c65ce-dc49-4321-935d-c04834997295", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "806c7640-a01e-006e-444a-674982000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:806c7640-a01e-006e-444a-674982000000\nTime:2019-09-09T20:10:45.3200988Zx-ms-lease-idid", + "Date" : "Mon, 09 Sep 2019 20:10:44 GMT", + "x-ms-client-request-id" : "494c65ce-dc49-4321-935d-c04834997295", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploaderror&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" : "9efc33ae-2549-4807-9cee-f280db9e3bb4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "806c7661-a01e-006e-5a4a-674982000000", + "Body" : "jtcuploaderrorjtcuploaderror0blockblobapitestuploaderror4e826505d4cef6Mon, 09 Sep 2019 20:10:45 GMT\"0x8D73561CC4616F3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:44 GMT", + "x-ms-client-request-id" : "9efc33ae-2549-4807-9cee-f280db9e3bb4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploaderror0blockblobapitestuploaderror4e826505d4cef6?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" : "9529706f-ab4f-498b-9e37-2074a76c28d8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "806c7671-a01e-006e-694a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:44 GMT", + "x-ms-client-request-id" : "9529706f-ab4f-498b-9e37-2074a76c28d8" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploaderror0blockblobapitestuploaderror4e826505d4cef6", "javablobuploaderror1blockblobapitestuploaderror4e8941393ac3", "javablobuploaderror2blockblobapitestuploaderror4e800458f4d9", "javablobuploaderror3blockblobapitestuploaderror4e81083894f4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadheaders[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadheaders[0].json new file mode 100644 index 000000000000..d9e3396aa006 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadheaders[0].json @@ -0,0 +1,147 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheadersa1237232b1b7?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" : "da0b403d-fc10-4a4e-a42e-a82e876a102b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C819907B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "806c710d-a01e-006e-764a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:37 GMT", + "x-ms-client-request-id" : "da0b403d-fc10-4a4e-a42e-a82e876a102b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheadersa1237232b1b7/javablobuploadheaders1blockblobapitestuploadheadersa1210531c1", + "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" : "8cd3019f-890f-43fa-af30-06ae572ec8ae", + "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 20:10:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C8268C1B\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c711a-a01e-006e-024a-674982000000", + "x-ms-client-request-id" : "8cd3019f-890f-43fa-af30-06ae572ec8ae" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheadersa1237232b1b7/javablobuploadheaders1blockblobapitestuploadheadersa1210531c1", + "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" : "ff2ac699-62ba-4274-8d0d-735283b65e30", + "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 20:10:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C8331179\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c7121-a01e-006e-094a-674982000000", + "x-ms-client-request-id" : "ff2ac699-62ba-4274-8d0d-735283b65e30" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheadersa1237232b1b7/javablobuploadheaders1blockblobapitestuploadheadersa1210531c1", + "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" : "9ab0b0b3-3404-4aca-b2cc-a08516e963ec" + }, + "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 20:10:38 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:10:37 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561C8331179\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:10:38 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "806c712c-a01e-006e-144a-674982000000", + "x-ms-client-request-id" : "9ab0b0b3-3404-4aca-b2cc-a08516e963ec", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadheaders&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" : "89840a3a-54db-4794-bf1a-bd9b8269ab61" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "806c713d-a01e-006e-234a-674982000000", + "Body" : "jtcuploadheadersjtcuploadheaders0blockblobapitestuploadheadersa1237232b1b7Mon, 09 Sep 2019 20:10:38 GMT\"0x8D73561C819907B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:37 GMT", + "x-ms-client-request-id" : "89840a3a-54db-4794-bf1a-bd9b8269ab61", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheadersa1237232b1b7?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" : "5a17cdf6-4585-4895-b309-b3bdd9c79448" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "806c7144-a01e-006e-2a4a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:37 GMT", + "x-ms-client-request-id" : "5a17cdf6-4585-4895-b309-b3bdd9c79448" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadheaders0blockblobapitestuploadheadersa1237232b1b7", "javablobuploadheaders1blockblobapitestuploadheadersa1210531c1", "javablobuploadheaders2blockblobapitestuploadheadersa122751927" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadheaders[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadheaders[1].json new file mode 100644 index 000000000000..7fa35cc71736 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadheaders[1].json @@ -0,0 +1,151 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheaders8f646697be46?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" : "d2fa48e0-c55b-49ea-8df1-ae905c51240d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C864B023\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "806c714f-a01e-006e-354a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:37 GMT", + "x-ms-client-request-id" : "d2fa48e0-c55b-49ea-8df1-ae905c51240d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheaders8f646697be46/javablobuploadheaders1blockblobapitestuploadheaders8f613567fd", + "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" : "24b8970e-bcbc-4526-981c-252a8b800cae", + "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 20:10:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C872E54C\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c7160-a01e-006e-454a-674982000000", + "x-ms-client-request-id" : "24b8970e-bcbc-4526-981c-252a8b800cae" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheaders8f646697be46/javablobuploadheaders1blockblobapitestuploadheaders8f613567fd", + "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" : "10ce4792-9ddb-4d99-b9e0-2678f7453151", + "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 20:10:38 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C87F43A4\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c716a-a01e-006e-4e4a-674982000000", + "x-ms-client-request-id" : "10ce4792-9ddb-4d99-b9e0-2678f7453151" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheaders8f646697be46/javablobuploadheaders1blockblobapitestuploadheaders8f613567fd", + "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" : "75c29b4e-1693-4f53-a788-5841bad163a6" + }, + "Response" : { + "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 20:10:38 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "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 20:10:38 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "806c7173-a01e-006e-574a-674982000000", + "Content-Type" : "type", + "x-ms-version" : "2019-02-02", + "Date" : "Mon, 09 Sep 2019 20:10:38 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "control", + "ETag" : "\"0x8D73561C87F43A4\"", + "Content-Disposition" : "disposition", + "x-ms-client-request-id" : "75c29b4e-1693-4f53-a788-5841bad163a6", + "Content-Language" : "language" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadheaders&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" : "35cd1068-25d4-4022-8606-b347cfde16ed" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "806c717c-a01e-006e-604a-674982000000", + "Body" : "jtcuploadheadersjtcuploadheaders0blockblobapitestuploadheaders8f646697be46Mon, 09 Sep 2019 20:10:38 GMT\"0x8D73561C864B023\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:38 GMT", + "x-ms-client-request-id" : "35cd1068-25d4-4022-8606-b347cfde16ed", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadheaders0blockblobapitestuploadheaders8f646697be46?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" : "4204d8d1-e26a-47aa-9c96-c40f6bdb696c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "806c7188-a01e-006e-6c4a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:38 GMT", + "x-ms-client-request-id" : "4204d8d1-e26a-47aa-9c96-c40f6bdb696c" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadheaders0blockblobapitestuploadheaders8f646697be46", "javablobuploadheaders1blockblobapitestuploadheaders8f613567fd", "javablobuploadheaders2blockblobapitestuploadheaders8f6476822a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadillegalargument[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadillegalargument[0].json new file mode 100644 index 000000000000..39bbf8bca45b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadillegalargument[0].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadillegalargument05072914c76238683640ab?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" : "f6e0fc39-7275-46c9-9fb3-8f588b193c57" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C6C0425E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bc071-601e-0051-5f4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:35 GMT", + "x-ms-client-request-id" : "f6e0fc39-7275-46c9-9fb3-8f588b193c57" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadillegalargument05072914c76238683640ab/javablobuploadillegalargument179889ea27fc3ca70d44", + "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" : "e2621ada-77d2-4a4d-bded-b5bd2006dede", + "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 20:10:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C6CD4C84\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bc07f-601e-0051-6b4a-67fe5e000000", + "x-ms-client-request-id" : "e2621ada-77d2-4a4d-bded-b5bd2006dede" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadillegalargument&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" : "ae90e597-43e2-4e20-a2a3-bbf7315fedfe" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bc08b-601e-0051-774a-67fe5e000000", + "Body" : "jtcuploadillegalargumentjtcuploadillegalargument05072914c76238683640abMon, 09 Sep 2019 20:10:35 GMT\"0x8D73561C6C0425E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:35 GMT", + "x-ms-client-request-id" : "ae90e597-43e2-4e20-a2a3-bbf7315fedfe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadillegalargument05072914c76238683640ab?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" : "58c5317f-8edc-4778-9719-fbb5a46f451f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bc098-601e-0051-044a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:35 GMT", + "x-ms-client-request-id" : "58c5317f-8edc-4778-9719-fbb5a46f451f" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadillegalargument05072914c76238683640ab", "javablobuploadillegalargument179889ea27fc3ca70d44", "javablobuploadillegalargument208397661f4cb60a3345" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadillegalargument[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadillegalargument[1].json new file mode 100644 index 000000000000..6fb7dc3de2c6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadillegalargument[1].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadillegalargument0285676a90bc2646124c64?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" : "97be9459-0c8b-4b99-aa25-fdecb867bd28" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C6F31B65\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bc0a0-601e-0051-0c4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:35 GMT", + "x-ms-client-request-id" : "97be9459-0c8b-4b99-aa25-fdecb867bd28" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadillegalargument0285676a90bc2646124c64/javablobuploadillegalargument1398145cbb32888c2d46", + "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" : "de6beec5-a626-44ce-b1ff-51205f78e03c", + "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 20:10:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C6FFD77C\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bc0ae-601e-0051-174a-67fe5e000000", + "x-ms-client-request-id" : "de6beec5-a626-44ce-b1ff-51205f78e03c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadillegalargument0285676a90bc2646124c64/javablobuploadillegalargument1398145cbb32888c2d46", + "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" : "14a8b915-c56c-4e5d-bfaf-4b6e4b92abdf", + "Content-Type" : "application/octet-stream" + }, + "Response" : null, + "Exception" : { + "ClassName" : "com.azure.core.exception.UnexpectedLengthException", + "ErrorMessage" : "Request body emitted 7 bytes less than the expected 8 bytes." + } + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadillegalargument&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" : "3f16037b-55e6-4353-9a97-04004d1dd8dc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "751ad556-601e-0015-4c4a-672232000000", + "Body" : "jtcuploadillegalargumentjtcuploadillegalargument0285676a90bc2646124c64Mon, 09 Sep 2019 20:10:36 GMT\"0x8D73561C6F31B65\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:35 GMT", + "x-ms-client-request-id" : "3f16037b-55e6-4353-9a97-04004d1dd8dc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadillegalargument0285676a90bc2646124c64?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" : "d3d23bd6-028d-4602-b7dd-11086d7b165d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "751ad565-601e-0015-584a-672232000000", + "Date" : "Mon, 09 Sep 2019 20:10:35 GMT", + "x-ms-client-request-id" : "d3d23bd6-028d-4602-b7dd-11086d7b165d" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadillegalargument0285676a90bc2646124c64", "javablobuploadillegalargument1398145cbb32888c2d46", "javablobuploadillegalargument274161477a0620ddaa40" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadillegalargument[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadillegalargument[2].json new file mode 100644 index 000000000000..7ae0c6b5cf19 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadillegalargument[2].json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadillegalargument068161724128a639324e1b?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" : "1a662cc8-d5c0-4f0a-887f-9b3908bf4f3c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C74A401A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "751ad56b-601e-0015-5e4a-672232000000", + "Date" : "Mon, 09 Sep 2019 20:10:35 GMT", + "x-ms-client-request-id" : "1a662cc8-d5c0-4f0a-887f-9b3908bf4f3c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadillegalargument068161724128a639324e1b/javablobuploadillegalargument19786600668923343845", + "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" : "4033f856-745c-43ba-a0d1-de3b62805ef5", + "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 20:10:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C75819DA\"", + "Content-Length" : "0", + "x-ms-request-id" : "751ad576-601e-0015-684a-672232000000", + "x-ms-client-request-id" : "4033f856-745c-43ba-a0d1-de3b62805ef5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadillegalargument068161724128a639324e1b/javablobuploadillegalargument19786600668923343845", + "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" : "f59c1029-fd83-4488-b3bb-92161d00c0d8", + "Content-Type" : "application/octet-stream" + }, + "Response" : null, + "Exception" : { + "ClassName" : "com.azure.core.exception.UnexpectedLengthException", + "ErrorMessage" : "Request body emitted 7 bytes more than the expected 6 bytes." + } + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadillegalargument&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" : "2ee52af9-967d-4691-8e72-ab99a4031770" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "806c703c-a01e-006e-3d4a-674982000000", + "Body" : "jtcuploadillegalargumentjtcuploadillegalargument068161724128a639324e1bMon, 09 Sep 2019 20:10:36 GMT\"0x8D73561C74A401A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:36 GMT", + "x-ms-client-request-id" : "2ee52af9-967d-4691-8e72-ab99a4031770", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadillegalargument068161724128a639324e1b?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" : "b2395772-1b00-433a-90ad-9b9fb55e6f8f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "806c7048-a01e-006e-464a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:36 GMT", + "x-ms-client-request-id" : "b2395772-1b00-433a-90ad-9b9fb55e6f8f" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadillegalargument068161724128a639324e1b", "javablobuploadillegalargument19786600668923343845", "javablobuploadillegalargument223919ba8af64d37c04d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadmetadata[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadmetadata[0].json new file mode 100644 index 000000000000..ac92c31decb6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadmetadata[0].json @@ -0,0 +1,147 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata02e23712c05?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" : "649667ca-510b-423b-93d7-d884df9d0371" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C8B28F76\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "806c719f-a01e-006e-024a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:38 GMT", + "x-ms-client-request-id" : "649667ca-510b-423b-93d7-d884df9d0371" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata02e23712c05/javablobuploadmetadata1blockblobapitestuploadmetadata02e92748a", + "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" : "793d1d44-34ae-46e7-92d1-c7ac0c93fbfe", + "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 20:10:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:38 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C8C02924\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c71aa-a01e-006e-0b4a-674982000000", + "x-ms-client-request-id" : "793d1d44-34ae-46e7-92d1-c7ac0c93fbfe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata02e23712c05/javablobuploadmetadata1blockblobapitestuploadmetadata02e92748a", + "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" : "e24e170f-6c14-4350-a2c6-e9032087c226", + "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 20:10:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:38 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C8CC6063\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c71b4-a01e-006e-154a-674982000000", + "x-ms-client-request-id" : "e24e170f-6c14-4350-a2c6-e9032087c226" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata02e23712c05/javablobuploadmetadata1blockblobapitestuploadmetadata02e92748a", + "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" : "016898a0-70a5-4ddf-95cd-4b25edabb367" + }, + "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 20:10:39 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:10:38 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561C8CC6063\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:10:39 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "806c71bc-a01e-006e-1c4a-674982000000", + "x-ms-client-request-id" : "016898a0-70a5-4ddf-95cd-4b25edabb367", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadmetadata&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" : "f6c9651a-b80c-415e-8812-5eeaa9091a5e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "806c71c3-a01e-006e-234a-674982000000", + "Body" : "jtcuploadmetadatajtcuploadmetadata0blockblobapitestuploadmetadata02e23712c05Mon, 09 Sep 2019 20:10:39 GMT\"0x8D73561C8B28F76\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:38 GMT", + "x-ms-client-request-id" : "f6c9651a-b80c-415e-8812-5eeaa9091a5e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata02e23712c05?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" : "2c8a068c-542d-443b-8915-61987924ec53" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "806c71d6-a01e-006e-344a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:38 GMT", + "x-ms-client-request-id" : "2c8a068c-542d-443b-8915-61987924ec53" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadmetadata0blockblobapitestuploadmetadata02e23712c05", "javablobuploadmetadata1blockblobapitestuploadmetadata02e92748a", "javablobuploadmetadata2blockblobapitestuploadmetadata02e822494" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadmetadata[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadmetadata[1].json new file mode 100644 index 000000000000..775bfbdd594a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadmetadata[1].json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata5e207365b76?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" : "4b64cb2a-4cc6-40bf-972e-37df15f39a55" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C901CE6F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "806c71dd-a01e-006e-3b4a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:38 GMT", + "x-ms-client-request-id" : "4b64cb2a-4cc6-40bf-972e-37df15f39a55" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata5e207365b76/javablobuploadmetadata1blockblobapitestuploadmetadata5e241277f", + "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" : "b360a322-d9b9-4a6a-ba2a-746fc01ae8b4", + "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 20:10:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:38 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C90F1AF4\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c71ef-a01e-006e-4c4a-674982000000", + "x-ms-client-request-id" : "b360a322-d9b9-4a6a-ba2a-746fc01ae8b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata5e207365b76/javablobuploadmetadata1blockblobapitestuploadmetadata5e241277f", + "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" : "34beb358-1ee0-4642-b820-bd260a99dfc5", + "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 20:10:39 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:38 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C91B5233\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c7202-a01e-006e-5f4a-674982000000", + "x-ms-client-request-id" : "34beb358-1ee0-4642-b820-bd260a99dfc5" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata5e207365b76/javablobuploadmetadata1blockblobapitestuploadmetadata5e241277f", + "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" : "ef3ecc03-a1a0-4682-9f98-73525487f98e" + }, + "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 20:10:39 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:10:39 GMT", + "x-ms-meta-foo" : "bar", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561C91B5233\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:10:39 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "806c7216-a01e-006e-734a-674982000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "ef3ecc03-a1a0-4682-9f98-73525487f98e", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadmetadata&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" : "455b554c-1308-4989-9297-8142e8bcd35e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "806c7221-a01e-006e-7d4a-674982000000", + "Body" : "jtcuploadmetadatajtcuploadmetadata0blockblobapitestuploadmetadata5e207365b76Mon, 09 Sep 2019 20:10:39 GMT\"0x8D73561C901CE6F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:39 GMT", + "x-ms-client-request-id" : "455b554c-1308-4989-9297-8142e8bcd35e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadmetadata0blockblobapitestuploadmetadata5e207365b76?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" : "76035abf-3a88-49af-bddc-48d5b4f0587a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "806c7231-a01e-006e-0c4a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:39 GMT", + "x-ms-client-request-id" : "76035abf-3a88-49af-bddc-48d5b4f0587a" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadmetadata0blockblobapitestuploadmetadata5e207365b76", "javablobuploadmetadata1blockblobapitestuploadmetadata5e241277f", "javablobuploadmetadata2blockblobapitestuploadmetadata5e2941410" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadmin.json new file mode 100644 index 000000000000..833dc3318d8c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadmin.json @@ -0,0 +1,146 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadmin0blockblobapitestuploadmin78b0922111d82e0f?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" : "cfbae8e1-993d-42ed-95c2-444163985bad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C674FAD7\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bc023-601e-0051-194a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:35 GMT", + "x-ms-client-request-id" : "cfbae8e1-993d-42ed-95c2-444163985bad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadmin0blockblobapitestuploadmin78b0922111d82e0f/javablobuploadmin1blockblobapitestuploadmin78b06519666b8d", + "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" : "5cfe0ddf-5cac-4f5f-b181-486a8991fcb1", + "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 20:10:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C682C852\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bc032-601e-0051-264a-67fe5e000000", + "x-ms-client-request-id" : "5cfe0ddf-5cac-4f5f-b181-486a8991fcb1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadmin0blockblobapitestuploadmin78b0922111d82e0f/javablobuploadmin1blockblobapitestuploadmin78b06519666b8d", + "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" : "77e89146-a83a-4b93-ad9a-968c98f42138", + "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 20:10:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C68F26AF\"", + "Content-Length" : "0", + "x-ms-request-id" : "755bc03b-601e-0051-2f4a-67fe5e000000", + "x-ms-client-request-id" : "77e89146-a83a-4b93-ad9a-968c98f42138" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadmin0blockblobapitestuploadmin78b0922111d82e0f/javablobuploadmin1blockblobapitestuploadmin78b06519666b8d", + "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" : "e66d1128-81c9-4018-ba87-f703ba9aeabb" + }, + "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 20:10:35 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:10:35 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73561C68F26AF\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:10:35 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "755bc046-601e-0051-374a-67fe5e000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "e66d1128-81c9-4018-ba87-f703ba9aeabb", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadmin&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" : "d5a3f7eb-7412-4cea-97b3-3e1cd535c667" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bc056-601e-0051-464a-67fe5e000000", + "Body" : "jtcuploadminjtcuploadmin0blockblobapitestuploadmin78b0922111d82e0fMon, 09 Sep 2019 20:10:35 GMT\"0x8D73561C674FAD7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:35 GMT", + "x-ms-client-request-id" : "d5a3f7eb-7412-4cea-97b3-3e1cd535c667", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadmin0blockblobapitestuploadmin78b0922111d82e0f?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" : "ffda8241-114a-46a5-b5e4-3caaf5df9d2d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bc068-601e-0051-574a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:10:35 GMT", + "x-ms-client-request-id" : "ffda8241-114a-46a5-b5e4-3caaf5df9d2d" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadmin0blockblobapitestuploadmin78b0922111d82e0f", "javablobuploadmin1blockblobapitestuploadmin78b06519666b8d", "javablobuploadmin2blockblobapitestuploadmin78b83927e97b5b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadnullbody.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadnullbody.json new file mode 100644 index 000000000000..eeca0a18933d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadnullbody.json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadnullbody0blockblobapitestuploadnullbodyd8160756ac5?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" : "84af7c1d-ffd2-4504-8bfd-2583a0382530" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561C7E5F491\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "806c70b5-a01e-006e-274a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:36 GMT", + "x-ms-client-request-id" : "84af7c1d-ffd2-4504-8bfd-2583a0382530" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadnullbody0blockblobapitestuploadnullbodyd8160756ac5/javablobuploadnullbody1blockblobapitestuploadnullbodyd8179146e", + "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" : "93003c2d-ee62-4c4e-9091-5b66f7ff32d1", + "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 20:10:37 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561C7F2EF90\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c70cb-a01e-006e-384a-674982000000", + "x-ms-client-request-id" : "93003c2d-ee62-4c4e-9091-5b66f7ff32d1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadnullbody&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" : "13b0ae15-9e04-4016-96f4-26272dd10df7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "806c70de-a01e-006e-4a4a-674982000000", + "Body" : "jtcuploadnullbodyjtcuploadnullbody0blockblobapitestuploadnullbodyd8160756ac5Mon, 09 Sep 2019 20:10:37 GMT\"0x8D73561C7E5F491\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:37 GMT", + "x-ms-client-request-id" : "13b0ae15-9e04-4016-96f4-26272dd10df7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadnullbody0blockblobapitestuploadnullbodyd8160756ac5?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" : "371bca69-dfcf-403a-a277-14c391f16088" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "806c70f1-a01e-006e-5c4a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:37 GMT", + "x-ms-client-request-id" : "371bca69-dfcf-403a-a277-14c391f16088" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadnullbody0blockblobapitestuploadnullbodyd8160756ac5", "javablobuploadnullbody1blockblobapitestuploadnullbodyd8179146e", "javablobuploadnullbody2blockblobapitestuploadnullbodyd8190242c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadwithtier.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadwithtier.json new file mode 100644 index 000000000000..c3210b32cdc6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobAPITestuploadwithtier.json @@ -0,0 +1,147 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadwithtier0blockblobapitestuploadwithtier96e16785ac4?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" : "2ea34fb0-f8a1-4657-ae05-e8b212ec414d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561CC88D0A4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "806c767a-a01e-006e-724a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:44 GMT", + "x-ms-client-request-id" : "2ea34fb0-f8a1-4657-ae05-e8b212ec414d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadwithtier0blockblobapitestuploadwithtier96e16785ac4/javablobuploadwithtier1blockblobapitestuploadwithtier96e751835", + "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" : "dc973a25-38eb-4823-a550-f9d2d1e01bf4", + "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 20:10:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:44 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561CC971298\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c768a-a01e-006e-7d4a-674982000000", + "x-ms-client-request-id" : "dc973a25-38eb-4823-a550-f9d2d1e01bf4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadwithtier0blockblobapitestuploadwithtier96e16785ac4/javablobuploadwithtier3blockblobapitestuploadwithtier96e088298", + "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" : "83186985-b203-4245-a99c-f3dc02b40841", + "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 20:10:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:10:44 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73561CCA54602\"", + "Content-Length" : "0", + "x-ms-request-id" : "806c7690-a01e-006e-034a-674982000000", + "x-ms-client-request-id" : "83186985-b203-4245-a99c-f3dc02b40841" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadwithtier0blockblobapitestuploadwithtier96e16785ac4/javablobuploadwithtier3blockblobapitestuploadwithtier96e088298", + "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" : "ff1c9521-cb65-48b3-ae9a-751c92f985bc" + }, + "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 20:10:45 GMT", + "retry-after" : "0", + "x-ms-access-tier-change-time" : "Mon, 09 Sep 2019 20:10:45 GMT", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:10:44 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier" : "Cool", + "ETag" : "\"0x8D73561CCA54602\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:10:45 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "806c769e-a01e-006e-104a-674982000000", + "x-ms-client-request-id" : "ff1c9521-cb65-48b3-ae9a-751c92f985bc", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadwithtier&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" : "bade0dcd-c2da-4dee-bb4e-3164cde36306" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "806c76b3-a01e-006e-254a-674982000000", + "Body" : "jtcuploadwithtierjtcuploadwithtier0blockblobapitestuploadwithtier96e16785ac4Mon, 09 Sep 2019 20:10:45 GMT\"0x8D73561CC88D0A4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:45 GMT", + "x-ms-client-request-id" : "bade0dcd-c2da-4dee-bb4e-3164cde36306", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadwithtier0blockblobapitestuploadwithtier96e16785ac4?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" : "7a58a207-249b-4b77-a0b0-a6b8a815904c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "806c76c0-a01e-006e-324a-674982000000", + "Date" : "Mon, 09 Sep 2019 20:10:45 GMT", + "x-ms-client-request-id" : "7a58a207-249b-4b77-a0b0-a6b8a815904c" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadwithtier0blockblobapitestuploadwithtier96e16785ac4", "javablobuploadwithtier1blockblobapitestuploadwithtier96e751835", "javablobuploadwithtier2blockblobapitestuploadwithtier96e500952", "javablobuploadwithtier3blockblobapitestuploadwithtier96e088298" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobInputOutputStreamTestuploaddownload.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobInputOutputStreamTestuploaddownload.json new file mode 100644 index 000000000000..a6ae9d6346df --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/BlockBlobInputOutputStreamTestuploaddownload.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcuploaddownload039998d07d4e6f70f949b287df", "javablobuploaddownload14457897826d6fbc38455fa", "9764e46a-22f0-43a5-8bc4-03f7fc5162ab" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestappendblockfromurlwithcpk.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestappendblockfromurlwithcpk.json new file mode 100644 index 000000000000..d263969135d0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestappendblockfromurlwithcpk.json @@ -0,0 +1,165 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlwithcpk021539e3ef499f0a5e45?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" : "f9af0111-1a07-4885-b3ce-f07c3348dc85" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355CEAAA7493\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c65dc64e-f01e-005f-1a45-671255000000", + "Date" : "Mon, 09 Sep 2019 19:35:47 GMT", + "x-ms-client-request-id" : "f9af0111-1a07-4885-b3ce-f07c3348dc85" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlwithcpk021539e3ef499f0a5e45/javablobappendblockfromurlwithcpk436708797dee00b2fe", + "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" : "c71d5240-a0e7-441f-bfd2-5e7d8380996a", + "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:35:48 GMT", + "retry-after" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:48 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7355CEADE2FF6\"", + "Content-Length" : "0", + "x-ms-request-id" : "b9efdec2-001e-0068-1a45-67befa000000", + "x-ms-client-request-id" : "c71d5240-a0e7-441f-bfd2-5e7d8380996a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlwithcpk021539e3ef499f0a5e45/javablobappendblockfromurlwithcpk316181e5e73771fb62", + "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" : "a119812c-7abc-4caa-863b-c705bc2f8c7d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355CEB1045B5\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-id" : "2aeb4951-a01e-0065-1345-6751f6000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:48 GMT", + "x-ms-client-request-id" : "a119812c-7abc-4caa-863b-c705bc2f8c7d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlwithcpk021539e3ef499f0a5e45/javablobappendblockfromurlwithcpk54336192d0e050f5c6", + "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" : "2057b787-34c1-4abb-bc2d-18ce7f2fd04e", + "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:35:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:49 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7355CEB44577E\"", + "Content-Length" : "0", + "x-ms-request-id" : "1d171c91-001e-000e-5145-670ca0000000", + "x-ms-client-request-id" : "2057b787-34c1-4abb-bc2d-18ce7f2fd04e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlwithcpk021539e3ef499f0a5e45/javablobappendblockfromurlwithcpk316181e5e73771fb62?comp=appendblock", + "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" : "56cf6b48-14fc-4b1f-82db-c82eb13f55a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:50 GMT", + "retry-after" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:49 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7355CEB811D8B\"", + "Content-Length" : "0", + "x-ms-request-id" : "afdf2fc4-601e-003c-4545-675470000000", + "x-ms-client-request-id" : "56cf6b48-14fc-4b1f-82db-c82eb13f55a4", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockfromurlwithcpk&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" : "78541d39-25c2-4dda-85e6-113f7da10180" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "5ecc0deb-a01e-002a-2545-6795ee000000", + "Body" : "jtcappendblockfromurlwithcpkjtcappendblockfromurlwithcpk021539e3ef499f0a5e45Mon, 09 Sep 2019 19:35:48 GMT\"0x8D7355CEAAA7493\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:35:49 GMT", + "x-ms-client-request-id" : "78541d39-25c2-4dda-85e6-113f7da10180", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockfromurlwithcpk021539e3ef499f0a5e45?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" : "33f8a028-71c8-4778-8d2c-b79b28ab4853" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "10782d37-601e-001e-2045-673a46000000", + "Date" : "Mon, 09 Sep 2019 19:35:50 GMT", + "x-ms-client-request-id" : "33f8a028-71c8-4778-8d2c-b79b28ab4853" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockfromurlwithcpk021539e3ef499f0a5e45", "javablobappendblockfromurlwithcpk129319b0007d24153f", "javablobappendblockfromurlwithcpk2411026f943bc36277", "javablobappendblockfromurlwithcpk316181e5e73771fb62", "javablobappendblockfromurlwithcpk436708797dee00b2fe", "javablobappendblockfromurlwithcpk54336192d0e050f5c6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestappendblockwithcpk.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestappendblockwithcpk.json new file mode 100644 index 000000000000..598ad491cdc5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestappendblockwithcpk.json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockwithcpk0cpktestappendblockwithcpkd6642400d179?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" : "2ed14968-99ea-4246-ae4f-c90b58b9c336" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355CE979059E\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7854f5f8-d01e-006a-4445-67bc00000000", + "Date" : "Mon, 09 Sep 2019 19:35:45 GMT", + "x-ms-client-request-id" : "2ed14968-99ea-4246-ae4f-c90b58b9c336" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockwithcpk0cpktestappendblockwithcpkd6642400d179/javablobappendblockwithcpk4cpktestappendblockwithcpkd66229940", + "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" : "68287ccc-b003-4683-b454-1d9fe95c43ac", + "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:35:46 GMT", + "retry-after" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:46 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7355CE9AC2EAB\"", + "Content-Length" : "0", + "x-ms-request-id" : "c22d27e4-301e-0006-7f45-6717d3000000", + "x-ms-client-request-id" : "68287ccc-b003-4683-b454-1d9fe95c43ac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockwithcpk0cpktestappendblockwithcpkd6642400d179/javablobappendblockwithcpk3cpktestappendblockwithcpkd66000719", + "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" : "7bed2388-5b23-4a2f-adcf-9e78a7c96c2a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355CE9E10400\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-id" : "6c44e66f-e01e-004b-2645-67d131000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:46 GMT", + "x-ms-client-request-id" : "7bed2388-5b23-4a2f-adcf-9e78a7c96c2a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockwithcpk0cpktestappendblockwithcpkd6642400d179/javablobappendblockwithcpk3cpktestappendblockwithcpkd66000719?comp=appendblock", + "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" : "d9ec9b09-b739-4112-b397-3c4c95ad80f5", + "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=", + "x-ms-blob-committed-block-count" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:47 GMT", + "retry-after" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:47 GMT", + "ETag" : "\"0x8D7355CEA11E101\"", + "Content-Length" : "0", + "x-ms-request-id" : "8066b208-a01e-006e-4645-674982000000", + "x-ms-client-request-id" : "d9ec9b09-b739-4112-b397-3c4c95ad80f5", + "x-ms-blob-append-offset" : "0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcappendblockwithcpk&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" : "28b12f23-4a9e-4f52-a90e-4221d10caaf2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "23ca9bfb-a01e-0008-7f45-67fbd8000000", + "Body" : "jtcappendblockwithcpkjtcappendblockwithcpk0cpktestappendblockwithcpkd6642400d179Mon, 09 Sep 2019 19:35:46 GMT\"0x8D7355CE979059E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:35:47 GMT", + "x-ms-client-request-id" : "28b12f23-4a9e-4f52-a90e-4221d10caaf2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcappendblockwithcpk0cpktestappendblockwithcpkd6642400d179?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" : "9f9bd4a5-e4ef-4ba4-9944-af1d161cded9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "ad2cbd3d-d01e-000c-3845-670e5a000000", + "Date" : "Mon, 09 Sep 2019 19:35:48 GMT", + "x-ms-client-request-id" : "9f9bd4a5-e4ef-4ba4-9944-af1d161cded9" + }, + "Exception" : null + } ], + "variables" : [ "jtcappendblockwithcpk0cpktestappendblockwithcpkd6642400d179", "javablobappendblockwithcpk1cpktestappendblockwithcpkd66031312", "javablobappendblockwithcpk2cpktestappendblockwithcpkd66552791", "javablobappendblockwithcpk3cpktestappendblockwithcpkd66000719", "javablobappendblockwithcpk4cpktestappendblockwithcpkd66229940" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestgetblobpropertiesandmetadatawithcpk.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestgetblobpropertiesandmetadatawithcpk.json new file mode 100644 index 000000000000..e86b08b84677 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestgetblobpropertiesandmetadatawithcpk.json @@ -0,0 +1,124 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblobpropertiesandmetadatawithcpk03047701d931aa6?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" : "bfc8e474-14fa-4ea6-b33e-ef4b513e795b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355CED2314D6\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "19e5ec47-f01e-0039-8045-67a00f000000", + "Date" : "Mon, 09 Sep 2019 19:35:52 GMT", + "x-ms-client-request-id" : "bfc8e474-14fa-4ea6-b33e-ef4b513e795b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblobpropertiesandmetadatawithcpk03047701d931aa6/javablobgetblobpropertiesandmetadatawithcpk4963883446155", + "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" : "15909991-e758-47dc-9fa2-1384d3600d42", + "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:35:53 GMT", + "retry-after" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:52 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7355CED580894\"", + "Content-Length" : "0", + "x-ms-request-id" : "14db58f8-801e-003d-7c45-67558d000000", + "x-ms-client-request-id" : "15909991-e758-47dc-9fa2-1384d3600d42" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblobpropertiesandmetadatawithcpk03047701d931aa6/javablobgetblobpropertiesandmetadatawithcpk4963883446155", + "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" : "b6a8cdff-d5bb-433d-9c91-50ae1ec56c49" + }, + "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:35:53 GMT", + "retry-after" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:35:53 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7355CED580894\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 19:35:53 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "23ca9f81-a01e-0008-3445-67fbd8000000", + "x-ms-client-request-id" : "b6a8cdff-d5bb-433d-9c91-50ae1ec56c49", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetblobpropertiesandmetadatawithcpk&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" : "977a3288-7531-40ed-8d20-db80444b8051" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c46eedf7-801e-005b-5345-67e7d7000000", + "Body" : "jtcgetblobpropertiesandmetadatawithcpkjtcgetblobpropertiesandmetadatawithcpk03047701d931aa6Mon, 09 Sep 2019 19:35:52 GMT\"0x8D7355CED2314D6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:35:53 GMT", + "x-ms-client-request-id" : "977a3288-7531-40ed-8d20-db80444b8051", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblobpropertiesandmetadatawithcpk03047701d931aa6?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" : "f057e63f-24a2-4d82-8d19-559d8684017b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c7f429b1-d01e-0043-3a45-67ca42000000", + "Date" : "Mon, 09 Sep 2019 19:35:53 GMT", + "x-ms-client-request-id" : "f057e63f-24a2-4d82-8d19-559d8684017b" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblobpropertiesandmetadatawithcpk03047701d931aa6", "javablobgetblobpropertiesandmetadatawithcpk133322910e1ee", "javablobgetblobpropertiesandmetadatawithcpk216668b45f485", "javablobgetblobpropertiesandmetadatawithcpk39609301b3e1e", "javablobgetblobpropertiesandmetadatawithcpk4963883446155" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestgetblobwithcpk.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestgetblobwithcpk.json new file mode 100644 index 000000000000..76fa9a6ab961 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestgetblobwithcpk.json @@ -0,0 +1,149 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblobwithcpk0cpktestgetblobwithcpk8c3886258958ab10?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" : "b1b08a0f-600a-4ae9-a92d-d9d5c4cb6b17" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355CE0890D2B\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9d60e2df-401e-0020-4f45-678c67000000", + "Date" : "Mon, 09 Sep 2019 19:35:30 GMT", + "x-ms-client-request-id" : "b1b08a0f-600a-4ae9-a92d-d9d5c4cb6b17" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblobwithcpk0cpktestgetblobwithcpk8c3886258958ab10/javablobgetblobwithcpk4cpktestgetblobwithcpk8c324257be779", + "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" : "a6e9b72d-e7ff-4d0e-976a-ddf3406b4f13", + "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:35:31 GMT", + "retry-after" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7355CE0BC51C9\"", + "Content-Length" : "0", + "x-ms-request-id" : "c7f41c3c-d01e-0043-4745-67ca42000000", + "x-ms-client-request-id" : "a6e9b72d-e7ff-4d0e-976a-ddf3406b4f13" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblobwithcpk0cpktestgetblobwithcpk8c3886258958ab10/javablobgetblobwithcpk1cpktestgetblobwithcpk8c365849c3bbd", + "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" : "be9e6b23-d4bb-413e-b7a5-db307da77b5d", + "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:35:32 GMT", + "retry-after" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:31 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7355CE0EEDCC6\"", + "Content-Length" : "0", + "x-ms-request-id" : "a36932ab-601e-0037-6b45-674c04000000", + "x-ms-client-request-id" : "be9e6b23-d4bb-413e-b7a5-db307da77b5d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblobwithcpk0cpktestgetblobwithcpk8c3886258958ab10/javablobgetblobwithcpk1cpktestgetblobwithcpk8c365849c3bbd", + "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" : "dfbf2535-47b5-4a6a-ae2c-dfabc7e98607" + }, + "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:35:32 GMT", + "retry-after" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:35:31 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D7355CE0EEDCC6\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 19:35:32 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5c3b92f-301e-0042-6145-67cbbf000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "dfbf2535-47b5-4a6a-ae2c-dfabc7e98607", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetblobwithcpk&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" : "00eacd21-5152-4258-a5dc-745dec3c8e86" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2973bc8d-901e-000b-3b45-67f8df000000", + "Body" : "jtcgetblobwithcpkjtcgetblobwithcpk0cpktestgetblobwithcpk8c3886258958ab10Mon, 09 Sep 2019 19:35:31 GMT\"0x8D7355CE0890D2B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:35:32 GMT", + "x-ms-client-request-id" : "00eacd21-5152-4258-a5dc-745dec3c8e86", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetblobwithcpk0cpktestgetblobwithcpk8c3886258958ab10?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" : "3db16771-122c-49db-8d56-ebd4dab5f626" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "dea1b428-a01e-0021-7545-678d9a000000", + "Date" : "Mon, 09 Sep 2019 19:35:33 GMT", + "x-ms-client-request-id" : "3db16771-122c-49db-8d56-ebd4dab5f626" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetblobwithcpk0cpktestgetblobwithcpk8c3886258958ab10", "javablobgetblobwithcpk1cpktestgetblobwithcpk8c365849c3bbd", "javablobgetblobwithcpk2cpktestgetblobwithcpk8c390478cd3eb", "javablobgetblobwithcpk3cpktestgetblobwithcpk8c33029849d5f", "javablobgetblobwithcpk4cpktestgetblobwithcpk8c324257be779" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestputblobwithcpk.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestputblobwithcpk.json new file mode 100644 index 000000000000..bb42e317ab61 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestputblobwithcpk.json @@ -0,0 +1,117 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputblobwithcpk0cpktestputblobwithcpk33f2927088bec3c5?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" : "0192c12d-c869-4d32-9554-79d5c0463045" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355CDF5B3F63\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "00988de3-501e-001d-7545-673941000000", + "Date" : "Mon, 09 Sep 2019 19:35:29 GMT", + "x-ms-client-request-id" : "0192c12d-c869-4d32-9554-79d5c0463045" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputblobwithcpk0cpktestputblobwithcpk33f2927088bec3c5/javablobputblobwithcpk4cpktestputblobwithcpk33f2795311f3a", + "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" : "e8a9b5b4-18b8-476f-8bc4-1a5ed6f0b6b5", + "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:35:30 GMT", + "retry-after" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7355CDFAF4436\"", + "Content-Length" : "0", + "x-ms-request-id" : "dce1e613-c01e-003a-1245-67a308000000", + "x-ms-client-request-id" : "e8a9b5b4-18b8-476f-8bc4-1a5ed6f0b6b5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputblobwithcpk0cpktestputblobwithcpk33f2927088bec3c5/javablobputblobwithcpk1cpktestputblobwithcpk33f74819a8c20", + "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" : "bfb336ea-b3d7-4402-9fac-af572d03727f", + "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:35:30 GMT", + "retry-after" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:29 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7355CDFE41990\"", + "Content-Length" : "0", + "x-ms-request-id" : "8066a72b-a01e-006e-6f45-674982000000", + "x-ms-client-request-id" : "bfb336ea-b3d7-4402-9fac-af572d03727f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcputblobwithcpk&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" : "68e07ed7-ebc0-44ec-9ff8-e69994f8638e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "f0d7d17c-201e-0030-1845-67ba81000000", + "Body" : "jtcputblobwithcpkjtcputblobwithcpk0cpktestputblobwithcpk33f2927088bec3c5Mon, 09 Sep 2019 19:35:29 GMT\"0x8D7355CDF5B3F63\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:35:30 GMT", + "x-ms-client-request-id" : "68e07ed7-ebc0-44ec-9ff8-e69994f8638e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputblobwithcpk0cpktestputblobwithcpk33f2927088bec3c5?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" : "9700b7d2-690d-49bb-9e6a-49cfbe6668c8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "a36931c9-601e-0037-1f45-674c04000000", + "Date" : "Mon, 09 Sep 2019 19:35:30 GMT", + "x-ms-client-request-id" : "9700b7d2-690d-49bb-9e6a-49cfbe6668c8" + }, + "Exception" : null + } ], + "variables" : [ "jtcputblobwithcpk0cpktestputblobwithcpk33f2927088bec3c5", "javablobputblobwithcpk1cpktestputblobwithcpk33f74819a8c20", "javablobputblobwithcpk2cpktestputblobwithcpk33f172835f107", "javablobputblobwithcpk3cpktestputblobwithcpk33f3298114b0b", "javablobputblobwithcpk4cpktestputblobwithcpk33f2795311f3a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestputblockfromurlwithcpk.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestputblockfromurlwithcpk.json new file mode 100644 index 000000000000..7a54f4efb926 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestputblockfromurlwithcpk.json @@ -0,0 +1,138 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputblockfromurlwithcpk061977820cadb3fe814a51?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" : "bce6c260-734e-45ce-ae48-ba935b19d8a0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355CE2B6F3A7\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "3261feae-b01e-0035-4845-674efe000000", + "Date" : "Mon, 09 Sep 2019 19:35:34 GMT", + "x-ms-client-request-id" : "bce6c260-734e-45ce-ae48-ba935b19d8a0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputblockfromurlwithcpk061977820cadb3fe814a51/javablobputblockfromurlwithcpk4475868049f12d5d054", + "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" : "15cbecf6-a6cd-4339-9ae7-90a3852b21c2", + "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:35:35 GMT", + "retry-after" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7355CE2EAE2D4\"", + "Content-Length" : "0", + "x-ms-request-id" : "d04b88d6-e01e-0026-3345-677b1f000000", + "x-ms-client-request-id" : "15cbecf6-a6cd-4339-9ae7-90a3852b21c2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputblockfromurlwithcpk061977820cadb3fe814a51/javablobputblockfromurlwithcpk522216db29f78d2a2b4", + "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" : "c17d4152-c760-4796-b0a2-9a25f607d36d", + "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:35:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:35 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7355CE31C0DF9\"", + "Content-Length" : "0", + "x-ms-request-id" : "c7f41e4c-d01e-0043-1245-67ca42000000", + "x-ms-client-request-id" : "c17d4152-c760-4796-b0a2-9a25f607d36d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputblockfromurlwithcpk061977820cadb3fe814a51/javablobputblockfromurlwithcpk1005035bb758949bd94?blockid=Mzg4ZGYxYmItMDlhNi00YTMyLThmYjQtOTVmY2M5NDVjYWQw&comp=block", + "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" : "15429b00-11ab-4686-8fdc-2193c90dc616" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "6RYQPwaVsyQ=", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-id" : "cee47216-501e-0052-5845-67fd59000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:35 GMT", + "x-ms-client-request-id" : "15429b00-11ab-4686-8fdc-2193c90dc616" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcputblockfromurlwithcpk&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" : "51e975ad-daa5-478f-acb8-d479483aca22" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b49f4012-701e-0001-4a45-67e156000000", + "Body" : "jtcputblockfromurlwithcpkjtcputblockfromurlwithcpk061977820cadb3fe814a51Mon, 09 Sep 2019 19:35:35 GMT\"0x8D7355CE2B6F3A7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:35:35 GMT", + "x-ms-client-request-id" : "51e975ad-daa5-478f-acb8-d479483aca22", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputblockfromurlwithcpk061977820cadb3fe814a51?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" : "4d876ace-7efe-4bce-a8ad-f75cadb5c2b6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e95ffeb9-d01e-0061-6745-67a474000000", + "Date" : "Mon, 09 Sep 2019 19:35:37 GMT", + "x-ms-client-request-id" : "4d876ace-7efe-4bce-a8ad-f75cadb5c2b6" + }, + "Exception" : null + } ], + "variables" : [ "jtcputblockfromurlwithcpk061977820cadb3fe814a51", "javablobputblockfromurlwithcpk1005035bb758949bd94", "javablobputblockfromurlwithcpk266849dd730f327fdb4", "javablobputblockfromurlwithcpk368195cca5447ae8594", "javablobputblockfromurlwithcpk4475868049f12d5d054", "javablobputblockfromurlwithcpk522216db29f78d2a2b4", "388df1bb-09a6-4a32-8fb4-95fcc945cad0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestputblocklistwithcpk.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestputblocklistwithcpk.json new file mode 100644 index 000000000000..e6cc1095bca6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestputblocklistwithcpk.json @@ -0,0 +1,162 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputblocklistwithcpk0cpktestputblocklistwithcpk66383924f07?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" : "36c6031a-d966-4e20-a5e8-20d19d210e84" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355CE3F12D51\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9af4ece7-501e-0070-6845-67936f000000", + "Date" : "Mon, 09 Sep 2019 19:35:36 GMT", + "x-ms-client-request-id" : "36c6031a-d966-4e20-a5e8-20d19d210e84" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputblocklistwithcpk0cpktestputblocklistwithcpk66383924f07/javablobputblocklistwithcpk4cpktestputblocklistwithcpk66313438", + "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" : "0ee69819-2540-44cc-85c0-8163e1c73286", + "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:35:37 GMT", + "retry-after" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:37 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7355CE426A9F9\"", + "Content-Length" : "0", + "x-ms-request-id" : "b35d9100-201e-0012-6145-67d4b7000000", + "x-ms-client-request-id" : "0ee69819-2540-44cc-85c0-8163e1c73286" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputblocklistwithcpk0cpktestputblocklistwithcpk66383924f07/javablobputblocklistwithcpk1cpktestputblocklistwithcpk66320567?blockid=NjQxOWZmOTgtM2VkMS00MzU4LTk3MmMtOGZiYjVmYjBkY2Qz&comp=block", + "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" : "f03dcdfc-f2bb-49d1-af16-9b70cd272e92", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-id" : "859bdc3b-201e-0019-6245-67ccc3000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:37 GMT", + "x-ms-client-request-id" : "f03dcdfc-f2bb-49d1-af16-9b70cd272e92" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputblocklistwithcpk0cpktestputblocklistwithcpk66383924f07/javablobputblocklistwithcpk1cpktestputblocklistwithcpk66320567?blockid=NjMzM2EzMTUtOGFhYS00Njk4LThlMmMtY2VjYzQ3YmNiNDFh&comp=block", + "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" : "e73938b5-8a94-49c2-8c58-dcde733b9dec", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-id" : "38b30509-901e-0022-6f45-678e9d000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:37 GMT", + "x-ms-client-request-id" : "e73938b5-8a94-49c2-8c58-dcde733b9dec" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputblocklistwithcpk0cpktestputblocklistwithcpk66383924f07/javablobputblocklistwithcpk1cpktestputblocklistwithcpk66320567?comp=blocklist", + "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" : "33695cf1-632a-4d55-a620-34bd79bd7301", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-content-crc64" : "9puXYsV5UEE=", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:38 GMT", + "retry-after" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:38 GMT", + "ETag" : "\"0x8D7355CE4C97061\"", + "Content-Length" : "0", + "x-ms-request-id" : "e14fba3f-401e-0009-6d45-67fa25000000", + "x-ms-client-request-id" : "33695cf1-632a-4d55-a620-34bd79bd7301" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcputblocklistwithcpk&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" : "c8e8edd1-99fd-4209-9ebb-4bd20348895b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "2d0faade-e01e-002d-2545-67636b000000", + "Body" : "jtcputblocklistwithcpkjtcputblocklistwithcpk0cpktestputblocklistwithcpk66383924f07Mon, 09 Sep 2019 19:35:37 GMT\"0x8D7355CE3F12D51\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:35:38 GMT", + "x-ms-client-request-id" : "c8e8edd1-99fd-4209-9ebb-4bd20348895b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputblocklistwithcpk0cpktestputblocklistwithcpk66383924f07?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" : "0c0d6daa-95a0-4955-8b9d-a974279c90f9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8eb6b187-001e-0041-0145-67c8b8000000", + "Date" : "Mon, 09 Sep 2019 19:35:38 GMT", + "x-ms-client-request-id" : "0c0d6daa-95a0-4955-8b9d-a974279c90f9" + }, + "Exception" : null + } ], + "variables" : [ "jtcputblocklistwithcpk0cpktestputblocklistwithcpk66383924f07", "javablobputblocklistwithcpk1cpktestputblocklistwithcpk66320567", "javablobputblocklistwithcpk2cpktestputblocklistwithcpk66345500", "javablobputblocklistwithcpk3cpktestputblocklistwithcpk66301538", "javablobputblocklistwithcpk4cpktestputblocklistwithcpk66313438", "6419ff98-3ed1-4358-972c-8fbb5fb0dcd3", "6333a315-8aaa-4698-8e2c-cecc47bcb41a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestputblockwithcpk.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestputblockwithcpk.json new file mode 100644 index 000000000000..61399db60c47 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestputblockwithcpk.json @@ -0,0 +1,114 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputblockwithcpk0cpktestputblockwithcpk7d01219448087f3?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" : "f2c3f0d0-d7e1-4d38-814e-1cfdfafd10a9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355CE1B99BFA\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c22d1bd8-301e-0006-4045-6717d3000000", + "Date" : "Mon, 09 Sep 2019 19:35:33 GMT", + "x-ms-client-request-id" : "f2c3f0d0-d7e1-4d38-814e-1cfdfafd10a9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputblockwithcpk0cpktestputblockwithcpk7d01219448087f3/javablobputblockwithcpk4cpktestputblockwithcpk7d0439533567", + "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" : "ecb149f6-e75d-435b-be9a-89e88b826001", + "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:35:33 GMT", + "retry-after" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:33 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7355CE1EBBA88\"", + "Content-Length" : "0", + "x-ms-request-id" : "db8eba4b-f01e-0054-3045-670a21000000", + "x-ms-client-request-id" : "ecb149f6-e75d-435b-be9a-89e88b826001" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputblockwithcpk0cpktestputblockwithcpk7d01219448087f3/javablobputblockwithcpk1cpktestputblockwithcpk7d0107804645?blockid=NjVhYjBmMjUtYjhjYi00NjllLTg3MWEtMzI5MTQwZjc3YWVh&comp=block", + "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" : "fd636e33-991f-4a5c-9a74-228a922110e5", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-id" : "c84315c0-301e-0049-0f45-67d3cb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:33 GMT", + "x-ms-client-request-id" : "fd636e33-991f-4a5c-9a74-228a922110e5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcputblockwithcpk&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" : "624d1551-2834-48d6-9bcf-a7dc77179fcc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "38b30313-901e-0022-2745-678e9d000000", + "Body" : "jtcputblockwithcpkjtcputblockwithcpk0cpktestputblockwithcpk7d01219448087f3Mon, 09 Sep 2019 19:35:33 GMT\"0x8D7355CE1B99BFA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:35:33 GMT", + "x-ms-client-request-id" : "624d1551-2834-48d6-9bcf-a7dc77179fcc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputblockwithcpk0cpktestputblockwithcpk7d01219448087f3?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" : "3a4f0a5d-3ee1-45d6-81ea-310c9e82a5c4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "7fa75264-601e-005a-5945-67e62a000000", + "Date" : "Mon, 09 Sep 2019 19:35:34 GMT", + "x-ms-client-request-id" : "3a4f0a5d-3ee1-45d6-81ea-310c9e82a5c4" + }, + "Exception" : null + } ], + "variables" : [ "jtcputblockwithcpk0cpktestputblockwithcpk7d01219448087f3", "javablobputblockwithcpk1cpktestputblockwithcpk7d0107804645", "javablobputblockwithcpk2cpktestputblockwithcpk7d026994dab9", "javablobputblockwithcpk3cpktestputblockwithcpk7d008040d2f9", "javablobputblockwithcpk4cpktestputblockwithcpk7d0439533567", "65ab0f25-b8cb-469e-871a-329140f77aea" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestputmultiplepageswithcpk.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestputmultiplepageswithcpk.json new file mode 100644 index 000000000000..431e58f217c4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestputmultiplepageswithcpk.json @@ -0,0 +1,140 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputmultiplepageswithcpk0575160adf5f0ce1244d6?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" : "9562466d-8719-4318-87f9-4d6309dd58b2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355CE8462FDC\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2aeb43c4-a01e-0065-6045-6751f6000000", + "Date" : "Mon, 09 Sep 2019 19:35:43 GMT", + "x-ms-client-request-id" : "9562466d-8719-4318-87f9-4d6309dd58b2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputmultiplepageswithcpk0575160adf5f0ce1244d6/javablobputmultiplepageswithcpk414746f3a23e599eb14", + "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" : "35eff852-d0f0-410f-a940-4e6fa60de560", + "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:35:44 GMT", + "retry-after" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:44 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7355CE8791BA3\"", + "Content-Length" : "0", + "x-ms-request-id" : "75568aaf-601e-0051-7445-67fe5e000000", + "x-ms-client-request-id" : "35eff852-d0f0-410f-a940-4e6fa60de560" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputmultiplepageswithcpk0575160adf5f0ce1244d6/javablobputmultiplepageswithcpk28639386942f308a2c4", + "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" : "58890b9d-4574-4984-8a4b-aaa62a815c59" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355CE8ACB829\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-id" : "36ec6e23-901e-0066-3345-6752f1000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:45 GMT", + "x-ms-client-request-id" : "58890b9d-4574-4984-8a4b-aaa62a815c59" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputmultiplepageswithcpk0575160adf5f0ce1244d6/javablobputmultiplepageswithcpk28639386942f308a2c4?comp=page", + "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" : "c6519ba8-1da9-46bd-b6aa-39097d25df15", + "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" : "BlSfcX0sbSY=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:45 GMT", + "retry-after" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:45 GMT", + "ETag" : "\"0x8D7355CE8E36291\"", + "Content-Length" : "0", + "x-ms-request-id" : "1655ca8f-301e-0060-0545-67a589000000", + "x-ms-client-request-id" : "c6519ba8-1da9-46bd-b6aa-39097d25df15" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcputmultiplepageswithcpk&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" : "9b104187-dea3-4296-81a9-9720ab4a4708" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "a17f3ee4-b01e-0017-6d45-6720c8000000", + "Body" : "jtcputmultiplepageswithcpkjtcputmultiplepageswithcpk0575160adf5f0ce1244d6Mon, 09 Sep 2019 19:35:44 GMT\"0x8D7355CE8462FDC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:35:45 GMT", + "x-ms-client-request-id" : "9b104187-dea3-4296-81a9-9720ab4a4708", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputmultiplepageswithcpk0575160adf5f0ce1244d6?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" : "064c208c-79a0-48d0-a420-d806717e2fdf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "3262062f-b01e-0035-2a45-674efe000000", + "Date" : "Mon, 09 Sep 2019 19:35:45 GMT", + "x-ms-client-request-id" : "064c208c-79a0-48d0-a420-d806717e2fdf" + }, + "Exception" : null + } ], + "variables" : [ "jtcputmultiplepageswithcpk0575160adf5f0ce1244d6", "javablobputmultiplepageswithcpk186193b95bba9a348e4", "javablobputmultiplepageswithcpk28639386942f308a2c4", "javablobputmultiplepageswithcpk385393257265b379f34", "javablobputmultiplepageswithcpk414746f3a23e599eb14", "d98b3139-4900-4567-bba8-3686df959ebf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestputpagefromurlwihcpk.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestputpagefromurlwihcpk.json new file mode 100644 index 000000000000..bcd70efd11ee --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestputpagefromurlwihcpk.json @@ -0,0 +1,186 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputpagefromurlwihcpk0cpktestputpagefromurlwihcpk7eb337222a?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" : "64b72947-dd65-400d-892e-8f4d0d908dad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355CE6AD2603\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "a369389c-601e-0037-5e45-674c04000000", + "Date" : "Mon, 09 Sep 2019 19:35:41 GMT", + "x-ms-client-request-id" : "64b72947-dd65-400d-892e-8f4d0d908dad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputpagefromurlwihcpk0cpktestputpagefromurlwihcpk7eb337222a/javablobputpagefromurlwihcpk481390dc8e4436c98844", + "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" : "57e9480c-4ad7-4018-a371-b54622657e5a", + "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:35:42 GMT", + "retry-after" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:42 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7355CE6E07D75\"", + "Content-Length" : "0", + "x-ms-request-id" : "340b2fc1-b01e-0053-1c45-67fca4000000", + "x-ms-client-request-id" : "57e9480c-4ad7-4018-a371-b54622657e5a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputpagefromurlwihcpk0cpktestputpagefromurlwihcpk7eb337222a/javablobputpagefromurlwihcpk5939469cd6e054833f4a", + "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" : "9cda542b-df37-499c-add2-9af19c6309a9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355CE711A89F\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "757dc807-001e-0063-7c45-67a68e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:42 GMT", + "x-ms-client-request-id" : "9cda542b-df37-499c-add2-9af19c6309a9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputpagefromurlwihcpk0cpktestputpagefromurlwihcpk7eb337222a/javablobputpagefromurlwihcpk5939469cd6e054833f4a?comp=page", + "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" : "0c23e22c-72dc-4a35-a500-c5e19cbca3c3", + "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" : "fPrH/6SuCCE=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:42 GMT", + "ETag" : "\"0x8D7355CE7445AB0\"", + "Content-Length" : "0", + "x-ms-request-id" : "c22d2451-301e-0006-2445-6717d3000000", + "x-ms-client-request-id" : "0c23e22c-72dc-4a35-a500-c5e19cbca3c3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputpagefromurlwihcpk0cpktestputpagefromurlwihcpk7eb337222a/javablobputpagefromurlwihcpk277574b0a1ceb6f6ab4b", + "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" : "562ecf2a-cfde-43ca-b4d6-15ac14ed7c11" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355CE7793006\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-id" : "1655c979-301e-0060-0c45-67a589000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:43 GMT", + "x-ms-client-request-id" : "562ecf2a-cfde-43ca-b4d6-15ac14ed7c11" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputpagefromurlwihcpk0cpktestputpagefromurlwihcpk7eb337222a/javablobputpagefromurlwihcpk277574b0a1ceb6f6ab4b?comp=page", + "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" : "6b6c1cea-4ce5-41a8-b5e2-31aa75a18a7f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:43 GMT", + "retry-after" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:43 GMT", + "Content-MD5" : "ZQYw2AfWuxKQHxXMYMhp9A==", + "ETag" : "\"0x8D7355CE7B18873\"", + "Content-Length" : "0", + "x-ms-request-id" : "9af4f23e-501e-0070-5445-67936f000000", + "x-ms-client-request-id" : "6b6c1cea-4ce5-41a8-b5e2-31aa75a18a7f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcputpagefromurlwihcpk&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" : "90d7af30-0006-4de2-8b34-a47d8ded52c3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "afdf2996-601e-003c-6c45-675470000000", + "Body" : "jtcputpagefromurlwihcpkjtcputpagefromurlwihcpk0cpktestputpagefromurlwihcpk7eb337222aMon, 09 Sep 2019 19:35:41 GMT\"0x8D7355CE6AD2603\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:35:43 GMT", + "x-ms-client-request-id" : "90d7af30-0006-4de2-8b34-a47d8ded52c3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputpagefromurlwihcpk0cpktestputpagefromurlwihcpk7eb337222a?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" : "bf2b0351-bb09-427a-8309-c94989cc221f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "e14fbd2f-401e-0009-7d45-67fa25000000", + "Date" : "Mon, 09 Sep 2019 19:35:43 GMT", + "x-ms-client-request-id" : "bf2b0351-bb09-427a-8309-c94989cc221f" + }, + "Exception" : null + } ], + "variables" : [ "jtcputpagefromurlwihcpk0cpktestputpagefromurlwihcpk7eb337222a", "javablobputpagefromurlwihcpk198048c0a0f1d8aa9549", "javablobputpagefromurlwihcpk277574b0a1ceb6f6ab4b", "javablobputpagefromurlwihcpk3097923d5d040918a64e", "javablobputpagefromurlwihcpk481390dc8e4436c98844", "javablobputpagefromurlwihcpk5939469cd6e054833f4a", "aaa7c342-f0ed-458e-9623-eb7f8d84e578" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestputpagewithcpk.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestputpagewithcpk.json new file mode 100644 index 000000000000..6900129759b2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestputpagewithcpk.json @@ -0,0 +1,140 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputpagewithcpk0cpktestputpagewithcpkf978355467978a94?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" : "64ac54e3-0906-4957-9485-349a88ef9251" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355CE56292B7\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "80257e7a-501e-0034-1f45-674f03000000", + "Date" : "Mon, 09 Sep 2019 19:35:39 GMT", + "x-ms-client-request-id" : "64ac54e3-0906-4957-9485-349a88ef9251" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputpagewithcpk0cpktestputpagewithcpkf978355467978a94/javablobputpagewithcpk4cpktestputpagewithcpkf97784221ae26", + "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" : "0aa8a1d2-7554-4f5c-8e4d-fdb54edd84ba", + "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:35:40 GMT", + "retry-after" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:39 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7355CE594FC1D\"", + "Content-Length" : "0", + "x-ms-request-id" : "69bd8e94-701e-004e-2b45-67254e000000", + "x-ms-client-request-id" : "0aa8a1d2-7554-4f5c-8e4d-fdb54edd84ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputpagewithcpk0cpktestputpagewithcpkf978355467978a94/javablobputpagewithcpk2cpktestputpagewithcpkf97080896f456", + "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" : "f524abfa-8210-4f3a-b531-8992cb2ab47f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355CE5CBCD92\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-id" : "da771d7a-d01e-0007-6a45-67162e000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:40 GMT", + "x-ms-client-request-id" : "f524abfa-8210-4f3a-b531-8992cb2ab47f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputpagewithcpk0cpktestputpagewithcpkf978355467978a94/javablobputpagewithcpk2cpktestputpagewithcpkf97080896f456?comp=page", + "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" : "a59afcaf-c645-4f0b-ba8b-be2782e71d7d", + "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" : "zatjIP1wKqo=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:40 GMT", + "retry-after" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:40 GMT", + "ETag" : "\"0x8D7355CE60CB2F0\"", + "Content-Length" : "0", + "x-ms-request-id" : "7e9d2c25-b01e-001c-0245-6738bc000000", + "x-ms-client-request-id" : "a59afcaf-c645-4f0b-ba8b-be2782e71d7d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcputpagewithcpk&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" : "4943fd08-45f6-4eec-bd8f-fc8e94815510" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b407db18-701e-0023-1e45-678f60000000", + "Body" : "jtcputpagewithcpkjtcputpagewithcpk0cpktestputpagewithcpkf978355467978a94Mon, 09 Sep 2019 19:35:39 GMT\"0x8D7355CE56292B7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:35:40 GMT", + "x-ms-client-request-id" : "4943fd08-45f6-4eec-bd8f-fc8e94815510", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcputpagewithcpk0cpktestputpagewithcpkf978355467978a94?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" : "79b90c1a-9779-424e-a7ad-4b349b20614a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "7e273fdd-e01e-000f-8045-670d5d000000", + "Date" : "Mon, 09 Sep 2019 19:35:41 GMT", + "x-ms-client-request-id" : "79b90c1a-9779-424e-a7ad-4b349b20614a" + }, + "Exception" : null + } ], + "variables" : [ "jtcputpagewithcpk0cpktestputpagewithcpkf978355467978a94", "javablobputpagewithcpk1cpktestputpagewithcpkf97290687dde9", "javablobputpagewithcpk2cpktestputpagewithcpkf97080896f456", "javablobputpagewithcpk3cpktestputpagewithcpkf97399349b194", "javablobputpagewithcpk4cpktestputpagewithcpkf97784221ae26", "86596eee-d95b-42d6-ab09-613ea47ea68e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestsetblobmetadatawithcpk.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestsetblobmetadatawithcpk.json new file mode 100644 index 000000000000..421c7cfa6385 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestsetblobmetadatawithcpk.json @@ -0,0 +1,114 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetblobmetadatawithcpk08778729a2c0ff4d3f4037?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" : "aa1f77ec-78cc-4312-ae17-4ef56651ca13" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355CEC18C22F\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "2747e329-701e-006c-3245-674b78000000", + "Date" : "Mon, 09 Sep 2019 19:35:50 GMT", + "x-ms-client-request-id" : "aa1f77ec-78cc-4312-ae17-4ef56651ca13" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetblobmetadatawithcpk08778729a2c0ff4d3f4037/javablobsetblobmetadatawithcpk420041cd4685dc70544", + "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" : "1f63a0d9-32cb-4082-b674-93b49d314c0e", + "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:35:51 GMT", + "retry-after" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:50 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7355CEC4A85FC\"", + "Content-Length" : "0", + "x-ms-request-id" : "7854f929-d01e-006a-2345-67bc00000000", + "x-ms-client-request-id" : "1f63a0d9-32cb-4082-b674-93b49d314c0e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetblobmetadatawithcpk08778729a2c0ff4d3f4037/javablobsetblobmetadatawithcpk420041cd4685dc70544?comp=metadata", + "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" : "27c6060a-3a73-4509-8299-8abe862334eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355CEC832C76\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "200", + "x-ms-request-id" : "b1123671-b01e-0071-3e45-679292000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:51 GMT", + "x-ms-client-request-id" : "27c6060a-3a73-4509-8299-8abe862334eb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetblobmetadatawithcpk&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" : "196e5b9f-190d-45df-85d9-3376725bc596" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "75568e20-601e-0051-7f45-67fe5e000000", + "Body" : "jtcsetblobmetadatawithcpkjtcsetblobmetadatawithcpk08778729a2c0ff4d3f4037Mon, 09 Sep 2019 19:35:51 GMT\"0x8D7355CEC18C22F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:35:51 GMT", + "x-ms-client-request-id" : "196e5b9f-190d-45df-85d9-3376725bc596", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetblobmetadatawithcpk08778729a2c0ff4d3f4037?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" : "ffd551af-da42-41c1-8fd2-613870e295be" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "1d1721c0-001e-000e-4145-670ca0000000", + "Date" : "Mon, 09 Sep 2019 19:35:52 GMT", + "x-ms-client-request-id" : "ffd551af-da42-41c1-8fd2-613870e295be" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetblobmetadatawithcpk08778729a2c0ff4d3f4037", "javablobsetblobmetadatawithcpk144696a6b7e1224b0a4", "javablobsetblobmetadatawithcpk212567be9179e0d2b34", "javablobsetblobmetadatawithcpk390654e7072e357c744", "javablobsetblobmetadatawithcpk420041cd4685dc70544" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestsetblobtierwithcpk.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestsetblobtierwithcpk.json new file mode 100644 index 000000000000..98d9de7b6355 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestsetblobtierwithcpk.json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetblobtierwithcpk0cpktestsetblobtierwithcpkeb804983409c?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" : "699eca2f-99c8-4414-a106-4f382351b639" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D733231F61218A\"", + "Last-Modified" : "Fri, 06 Sep 2019 23:37:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "888b4577-e01e-004b-4e0b-65d131000000", + "Date" : "Fri, 06 Sep 2019 23:37:03 GMT", + "x-ms-client-request-id" : "699eca2f-99c8-4414-a106-4f382351b639" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetblobtierwithcpk0cpktestsetblobtierwithcpkeb804983409c/javablobsetblobtierwithcpk4cpktestsetblobtierwithcpkeb8112843", + "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" : "1d0103c6-ba17-4b9c-aba0-a5d00c4a6e8c", + "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" : "Fri, 06 Sep 2019 23:37:04 GMT", + "retry-after" : "0", + "x-ms-encryption-key-sha256" : "cluOz3B2OjVDe53jfsJjFksLm6dxq1qF8ETRqeAin7A=", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 06 Sep 2019 23:37:03 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D733231F928A22\"", + "Content-Length" : "0", + "x-ms-request-id" : "23f36d73-601e-001e-330b-653a46000000", + "x-ms-client-request-id" : "1d0103c6-ba17-4b9c-aba0-a5d00c4a6e8c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetblobtierwithcpk0cpktestsetblobtierwithcpkeb804983409c/javablobsetblobtierwithcpk4cpktestsetblobtierwithcpkeb8112843?comp=tier", + "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" : "771474c4-5e4e-4e15-9c01-3b995776023d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "BlobUsesCustomerSpecifiedEncryption", + "retry-after" : "0", + "Content-Length" : "301", + "StatusCode" : "409", + "x-ms-request-id" : "e6097357-801e-0050-6c0b-65ffa3000000", + "Body" : "BlobUsesCustomerSpecifiedEncryptionThe blob is encrypted with customer specified encryption, but it was not provided in the request.\nRequestId:e6097357-801e-0050-6c0b-65ffa3000000\nTime:2019-09-06T23:37:04.6608346Z", + "Date" : "Fri, 06 Sep 2019 23:37:03 GMT", + "x-ms-client-request-id" : "771474c4-5e4e-4e15-9c01-3b995776023d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetblobtierwithcpk&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" : "2c504c24-02b6-4dad-be9f-a80c39344b72" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "4f27d033-201e-0030-5a0b-65ba81000000", + "Body" : "jtcsetblobtierwithcpkjtcsetblobtierwithcpk0cpktestsetblobtierwithcpkeb804983409cFri, 06 Sep 2019 23:37:03 GMT\"0x8D733231F61218A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 23:37:04 GMT", + "x-ms-client-request-id" : "2c504c24-02b6-4dad-be9f-a80c39344b72", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetblobtierwithcpk0cpktestsetblobtierwithcpkeb804983409c?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" : "220a3453-e30d-4de9-8701-13c435bf7cb9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "7eaddb53-901e-0000-5a0b-65e0ab000000", + "Date" : "Fri, 06 Sep 2019 23:37:05 GMT", + "x-ms-client-request-id" : "220a3453-e30d-4de9-8701-13c435bf7cb9" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetblobtierwithcpk0cpktestsetblobtierwithcpkeb804983409c", "javablobsetblobtierwithcpk1cpktestsetblobtierwithcpkeb8034738", "javablobsetblobtierwithcpk2cpktestsetblobtierwithcpkeb805379b", "javablobsetblobtierwithcpk3cpktestsetblobtierwithcpkeb8826745", "javablobsetblobtierwithcpk4cpktestsetblobtierwithcpkeb8112843" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestsnapshotblobwithcpk.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestsnapshotblobwithcpk.json new file mode 100644 index 000000000000..d5ccf983c26d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/CPKTestsnapshotblobwithcpk.json @@ -0,0 +1,114 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotblobwithcpk0cpktestsnapshotblobwithcpk94804131a0c?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" : "7c5b2b1a-e8f3-46d5-a800-714b869b586f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355CEE1C906D\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0341519f-301e-0024-7a45-6779e5000000", + "Date" : "Mon, 09 Sep 2019 19:35:54 GMT", + "x-ms-client-request-id" : "7c5b2b1a-e8f3-46d5-a800-714b869b586f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotblobwithcpk0cpktestsnapshotblobwithcpk94804131a0c/javablobsnapshotblobwithcpk4cpktestsnapshotblobwithcpk94880465", + "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" : "04ae044c-f79b-4b44-b8bb-4237091806bc", + "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:35:54 GMT", + "retry-after" : "0", + "x-ms-encryption-key-sha256" : "REDACTED", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:35:54 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7355CEE4D4407\"", + "Content-Length" : "0", + "x-ms-request-id" : "2747e582-701e-006c-4c45-674b78000000", + "x-ms-client-request-id" : "04ae044c-f79b-4b44-b8bb-4237091806bc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotblobwithcpk0cpktestsnapshotblobwithcpk94804131a0c/javablobsnapshotblobwithcpk4cpktestsnapshotblobwithcpk94880465?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" : "e495a8ac-ae76-4a18-9c3a-8dc8b4653f89" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T19:35:55.0781325Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355CEE4D4407\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:35:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "3fec23d1-501e-0016-2c45-672135000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 19:35:54 GMT", + "x-ms-client-request-id" : "e495a8ac-ae76-4a18-9c3a-8dc8b4653f89" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsnapshotblobwithcpk&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" : "7679dcc3-e2cb-4fb2-8fd1-03d9bd3c7034" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8066b728-a01e-006e-6e45-674982000000", + "Body" : "jtcsnapshotblobwithcpkjtcsnapshotblobwithcpk0cpktestsnapshotblobwithcpk94804131a0cMon, 09 Sep 2019 19:35:54 GMT\"0x8D7355CEE1C906D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:35:55 GMT", + "x-ms-client-request-id" : "7679dcc3-e2cb-4fb2-8fd1-03d9bd3c7034", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsnapshotblobwithcpk0cpktestsnapshotblobwithcpk94804131a0c?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" : "407bf93f-91bd-4125-8da3-4fdc30c63bf8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9d01ca1c-101e-0033-7045-67b986000000", + "Date" : "Mon, 09 Sep 2019 19:35:55 GMT", + "x-ms-client-request-id" : "407bf93f-91bd-4125-8da3-4fdc30c63bf8" + }, + "Exception" : null + } ], + "variables" : [ "jtcsnapshotblobwithcpk0cpktestsnapshotblobwithcpk94804131a0c", "javablobsnapshotblobwithcpk1cpktestsnapshotblobwithcpk94820404", "javablobsnapshotblobwithcpk2cpktestsnapshotblobwithcpk94808470", "javablobsnapshotblobwithcpk3cpktestsnapshotblobwithcpk94879573", "javablobsnapshotblobwithcpk4cpktestsnapshotblobwithcpk94880465" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquirelease[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquirelease[0].json new file mode 100644 index 000000000000..94a85d7fb6af --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquirelease[0].json @@ -0,0 +1,137 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0containerapitestacquireleaseba20396444ce3?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" : "3a89874c-79d6-4d64-a7c7-7edc5a0b87e7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AE1AF8F3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9d0b1-301e-0042-3d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:44 GMT", + "x-ms-client-request-id" : "3a89874c-79d6-4d64-a7c7-7edc5a0b87e7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0containerapitestacquireleaseba20396444ce3?comp=lease&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" : "db2cb208-10a6-4495-9164-6908edbe8df0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AE1AF8F3\"", + "x-ms-lease-id" : "04dcc393-65b1-4b51-bc03-ace84fbaeb68", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9d0d3-301e-0042-5c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:44 GMT", + "x-ms-client-request-id" : "db2cb208-10a6-4495-9164-6908edbe8df0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0containerapitestacquireleaseba20396444ce3?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" : "2ba16922-bffe-4059-86af-7e51c791ddca" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "leased", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:45 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:02:44 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D73560AE1AF8F3\"", + "x-ms-has-immutability-policy" : "false", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "0", + "x-ms-request-id" : "c5c9d0f0-301e-0042-7849-67cbbf000000", + "x-ms-client-request-id" : "2ba16922-bffe-4059-86af-7e51c791ddca" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquirelease&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" : "0b8bff6f-ecda-4b0a-8444-48421b49b8b3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9d10d-301e-0042-1249-67cbbf000000", + "Body" : "jtcacquireleasejtcacquirelease0containerapitestacquireleaseba20396444ce3Mon, 09 Sep 2019 20:02:45 GMT\"0x8D73560AE1AF8F3\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:02:44 GMT", + "x-ms-client-request-id" : "0b8bff6f-ecda-4b0a-8444-48421b49b8b3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0containerapitestacquireleaseba20396444ce3?comp=lease&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" : "da54b9f9-e454-4f3a-bd05-33544d6605e0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AE1AF8F3\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9d126-301e-0042-2b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:44 GMT", + "x-ms-client-request-id" : "da54b9f9-e454-4f3a-bd05-33544d6605e0" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0containerapitestacquireleaseba20396444ce3?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" : "8bdbbec3-2c4d-4a97-b175-1881c463fc83" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9d146-301e-0042-4949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:44 GMT", + "x-ms-client-request-id" : "8bdbbec3-2c4d-4a97-b175-1881c463fc83" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquirelease0containerapitestacquireleaseba20396444ce3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquirelease[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquirelease[1].json new file mode 100644 index 000000000000..8c4a46179ae5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquirelease[1].json @@ -0,0 +1,137 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease787498596e7c1?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" : "0c6c308f-589e-43ed-81d5-2e9ecaeb6508" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AE692734\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9d168-301e-0042-6b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:44 GMT", + "x-ms-client-request-id" : "0c6c308f-589e-43ed-81d5-2e9ecaeb6508" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease787498596e7c1?comp=lease&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" : "e1e8817f-d0d9-49af-a657-4faf2263f396" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AE692734\"", + "x-ms-lease-id" : "ccfb04c7-75d8-46f5-abcc-e33caf734413", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9d18f-301e-0042-1149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:44 GMT", + "x-ms-client-request-id" : "e1e8817f-d0d9-49af-a657-4faf2263f396" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease787498596e7c1?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" : "e8b4a093-24e0-4e96-94a9-67deefb41687" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "leased", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:45 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:02:44 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D73560AE692734\"", + "x-ms-has-immutability-policy" : "false", + "x-ms-lease-duration" : "fixed", + "Content-Length" : "0", + "x-ms-request-id" : "c5c9d1ba-301e-0042-3b49-67cbbf000000", + "x-ms-client-request-id" : "e8b4a093-24e0-4e96-94a9-67deefb41687" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquirelease&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" : "d002a682-d81b-4eff-ba17-5c671452114d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9d1ef-301e-0042-6f49-67cbbf000000", + "Body" : "jtcacquireleasejtcacquirelease0containerapitestacquirelease787498596e7c1Mon, 09 Sep 2019 20:02:45 GMT\"0x8D73560AE692734\"lockedleasedfixed$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:02:44 GMT", + "x-ms-client-request-id" : "d002a682-d81b-4eff-ba17-5c671452114d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease787498596e7c1?comp=lease&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" : "d5a47f0c-7ed9-43eb-8795-84a70524d62c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AE692734\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9d219-301e-0042-1949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:45 GMT", + "x-ms-client-request-id" : "d5a47f0c-7ed9-43eb-8795-84a70524d62c" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease787498596e7c1?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" : "b8f6dbef-7ac6-4bc2-8dd6-6a407608c28c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9d232-301e-0042-2e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:45 GMT", + "x-ms-client-request-id" : "b8f6dbef-7ac6-4bc2-8dd6-6a407608c28c" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquirelease0containerapitestacquirelease787498596e7c1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquirelease[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquirelease[2].json new file mode 100644 index 000000000000..a17927a6f731 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquirelease[2].json @@ -0,0 +1,137 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease2059418197b76?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" : "5471c4a7-bcc8-4165-91a3-78b6da863187" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AEB61CBC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9d24a-301e-0042-4549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:45 GMT", + "x-ms-client-request-id" : "5471c4a7-bcc8-4165-91a3-78b6da863187" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease2059418197b76?comp=lease&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" : "3768e078-342d-46b2-9a56-6763e58d3339" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AEB61CBC\"", + "x-ms-lease-id" : "3ff4fb90-4369-455c-a8d0-4b2aca9cad94", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9d264-301e-0042-5d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:45 GMT", + "x-ms-client-request-id" : "3768e078-342d-46b2-9a56-6763e58d3339" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease2059418197b76?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" : "896421c1-cb60-454e-83a9-fa96dd82313c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "leased", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:46 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:02:45 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D73560AEB61CBC\"", + "x-ms-has-immutability-policy" : "false", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "0", + "x-ms-request-id" : "c5c9d288-301e-0042-0149-67cbbf000000", + "x-ms-client-request-id" : "896421c1-cb60-454e-83a9-fa96dd82313c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquirelease&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" : "eac9e78f-6789-4399-b469-b594bb78dad5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9d296-301e-0042-0f49-67cbbf000000", + "Body" : "jtcacquireleasejtcacquirelease0containerapitestacquirelease2059418197b76Mon, 09 Sep 2019 20:02:46 GMT\"0x8D73560AEB61CBC\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:02:45 GMT", + "x-ms-client-request-id" : "eac9e78f-6789-4399-b469-b594bb78dad5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease2059418197b76?comp=lease&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" : "9cd93141-c7bd-4e1c-9a0e-cd8702525156" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AEB61CBC\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9d2ac-301e-0042-2149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:45 GMT", + "x-ms-client-request-id" : "9cd93141-c7bd-4e1c-9a0e-cd8702525156" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquirelease0containerapitestacquirelease2059418197b76?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" : "7814ab55-1411-4505-9d74-5fa4f3316e0c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9d2b4-301e-0042-2949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:45 GMT", + "x-ms-client-request-id" : "7814ab55-1411-4505-9d74-5fa4f3316e0c" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquirelease0containerapitestacquirelease2059418197b76" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseac[0].json new file mode 100644 index 000000000000..bdcd293828cb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseac[0].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseacb9484490979?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" : "0279d75e-9b54-4ac3-b0f1-a464b1e37cb9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AF430D20\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9d339-301e-0042-2a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:46 GMT", + "x-ms-client-request-id" : "0279d75e-9b54-4ac3-b0f1-a464b1e37cb9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseacb9484490979?comp=lease&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" : "816b62ce-5da6-47e3-9c20-84902d885382" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AF430D20\"", + "x-ms-lease-id" : "c88b9ae7-2895-440f-afb5-6c7e15e1b1a3", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9d34c-301e-0042-3b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:46 GMT", + "x-ms-client-request-id" : "816b62ce-5da6-47e3-9c20-84902d885382" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquireleaseac&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" : "f27cf172-5e29-4c5a-92a8-85dbee60bdc5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9d35c-301e-0042-4b49-67cbbf000000", + "Body" : "jtcacquireleaseacjtcacquireleaseac0containerapitestacquireleaseacb9484490979Mon, 09 Sep 2019 20:02:46 GMT\"0x8D73560AF430D20\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:02:46 GMT", + "x-ms-client-request-id" : "f27cf172-5e29-4c5a-92a8-85dbee60bdc5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseacb9484490979?comp=lease&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" : "286366b5-08a3-4440-b2c1-6c4bcaa2f321" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AF430D20\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9d36f-301e-0042-5c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:46 GMT", + "x-ms-client-request-id" : "286366b5-08a3-4440-b2c1-6c4bcaa2f321" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseacb9484490979?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" : "851b1831-7568-42d5-8588-6271e30d1510" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9d382-301e-0042-6c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:46 GMT", + "x-ms-client-request-id" : "851b1831-7568-42d5-8588-6271e30d1510" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseac0containerapitestacquireleaseacb9484490979" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseac[1].json new file mode 100644 index 000000000000..4c7d82ba4b3d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseac[1].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseacfc190354ec5?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" : "bd8ff939-b3a4-4c58-b175-65012ccb8d19" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AF86D938\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9d391-301e-0042-7b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:46 GMT", + "x-ms-client-request-id" : "bd8ff939-b3a4-4c58-b175-65012ccb8d19" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseacfc190354ec5?comp=lease&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" : "1bb5dc29-9b13-44db-ba3a-ffa9eb01dcb5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AF86D938\"", + "x-ms-lease-id" : "7f9f79ac-3d87-4a94-83bd-e361361a1011", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9d3a3-301e-0042-0949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:46 GMT", + "x-ms-client-request-id" : "1bb5dc29-9b13-44db-ba3a-ffa9eb01dcb5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquireleaseac&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" : "bc4c651e-25f3-4b5e-bf86-85f1b6ab352e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9d3af-301e-0042-1349-67cbbf000000", + "Body" : "jtcacquireleaseacjtcacquireleaseac0containerapitestacquireleaseacfc190354ec5Mon, 09 Sep 2019 20:02:47 GMT\"0x8D73560AF86D938\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:02:46 GMT", + "x-ms-client-request-id" : "bc4c651e-25f3-4b5e-bf86-85f1b6ab352e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseacfc190354ec5?comp=lease&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" : "cf58b08c-4408-4b51-b272-f367fdcb49c9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AF86D938\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9d3c0-301e-0042-2349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:46 GMT", + "x-ms-client-request-id" : "cf58b08c-4408-4b51-b272-f367fdcb49c9" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseacfc190354ec5?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" : "9b70550e-d0e2-4447-a343-d804bdb3487d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9d3cb-301e-0042-2e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:46 GMT", + "x-ms-client-request-id" : "9b70550e-d0e2-4447-a343-d804bdb3487d" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseac0containerapitestacquireleaseacfc190354ec5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseac[2].json new file mode 100644 index 000000000000..cc40d2c6a387 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseac[2].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseacc81518405fa?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" : "46613e67-ef6e-4f26-8c38-716ef92867a8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AFC85AFB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9d3df-301e-0042-4049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:47 GMT", + "x-ms-client-request-id" : "46613e67-ef6e-4f26-8c38-716ef92867a8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseacc81518405fa?comp=lease&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" : "f0dfdbb5-375e-4ee9-bf43-fa8279e63cb5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AFC85AFB\"", + "x-ms-lease-id" : "722b3a72-b92f-4a43-9cd9-e77a990b1d84", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9d3ee-301e-0042-4d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:47 GMT", + "x-ms-client-request-id" : "f0dfdbb5-375e-4ee9-bf43-fa8279e63cb5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquireleaseac&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" : "98278d1c-6b15-4613-a815-832ca312cb66" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9d3fd-301e-0042-5c49-67cbbf000000", + "Body" : "jtcacquireleaseacjtcacquireleaseac0containerapitestacquireleaseacc81518405faMon, 09 Sep 2019 20:02:47 GMT\"0x8D73560AFC85AFB\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:02:47 GMT", + "x-ms-client-request-id" : "98278d1c-6b15-4613-a815-832ca312cb66", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseacc81518405fa?comp=lease&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" : "4d0bc5ea-7e8d-4d81-b566-46a466bed9be" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AFC85AFB\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9d413-301e-0042-6f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:47 GMT", + "x-ms-client-request-id" : "4d0bc5ea-7e8d-4d81-b566-46a466bed9be" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseac0containerapitestacquireleaseacc81518405fa?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" : "676cf2f0-1e58-4415-8c41-84ed74d473a0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9d41f-301e-0042-7b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:47 GMT", + "x-ms-client-request-id" : "676cf2f0-1e58-4415-8c41-84ed74d473a0" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseac0containerapitestacquireleaseacc81518405fa" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseacfail[0].json new file mode 100644 index 000000000000..8a12b61abdca --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseacfail[0].json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacfail029147ed717a31a60f4c11b2?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" : "67a145ca-b05d-4445-8d0e-700afa287583" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560B0091949\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9d441-301e-0042-1949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:47 GMT", + "x-ms-client-request-id" : "67a145ca-b05d-4445-8d0e-700afa287583" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacfail029147ed717a31a60f4c11b2?comp=lease&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" : "2331bfaf-034f-4ed7-875a-3830a4e0f62f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5c9d457-301e-0042-2b49-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5c9d457-301e-0042-2b49-67cbbf000000\nTime:2019-09-09T20:02:48.3593998Z", + "Date" : "Mon, 09 Sep 2019 20:02:47 GMT", + "x-ms-client-request-id" : "2331bfaf-034f-4ed7-875a-3830a4e0f62f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquireleaseacfail&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" : "200ab91e-eba5-42bb-8f07-d9816905e71e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9d470-301e-0042-4449-67cbbf000000", + "Body" : "jtcacquireleaseacfailjtcacquireleaseacfail029147ed717a31a60f4c11b2Mon, 09 Sep 2019 20:02:48 GMT\"0x8D73560B0091949\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:02:47 GMT", + "x-ms-client-request-id" : "200ab91e-eba5-42bb-8f07-d9816905e71e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacfail029147ed717a31a60f4c11b2?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" : "4646b4eb-4795-4fda-8f12-a7bcf478023f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9d481-301e-0042-5449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:47 GMT", + "x-ms-client-request-id" : "4646b4eb-4795-4fda-8f12-a7bcf478023f" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseacfail029147ed717a31a60f4c11b2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseacfail[1].json new file mode 100644 index 000000000000..63cc3e8237db --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseacfail[1].json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacfail086773ed4f4a8235a4422d93?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" : "3ed13b2e-1400-4dd3-a34d-dd0176c408c7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560B03DC771\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9d496-301e-0042-6949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:47 GMT", + "x-ms-client-request-id" : "3ed13b2e-1400-4dd3-a34d-dd0176c408c7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacfail086773ed4f4a8235a4422d93?comp=lease&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" : "9ffa5462-63d8-40eb-9125-7e0d5948bb55" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5c9d4ae-301e-0042-7d49-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5c9d4ae-301e-0042-7d49-67cbbf000000\nTime:2019-09-09T20:02:48.7016440Z", + "Date" : "Mon, 09 Sep 2019 20:02:47 GMT", + "x-ms-client-request-id" : "9ffa5462-63d8-40eb-9125-7e0d5948bb55", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquireleaseacfail&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" : "78e41bf6-b36e-42fb-8820-b281d6fe1d0b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9d4c2-301e-0042-0f49-67cbbf000000", + "Body" : "jtcacquireleaseacfailjtcacquireleaseacfail086773ed4f4a8235a4422d93Mon, 09 Sep 2019 20:02:48 GMT\"0x8D73560B03DC771\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:02:47 GMT", + "x-ms-client-request-id" : "78e41bf6-b36e-42fb-8820-b281d6fe1d0b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacfail086773ed4f4a8235a4422d93?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" : "16944bf2-9a73-42ef-87a6-aa947729e976" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9d4db-301e-0042-2249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:48 GMT", + "x-ms-client-request-id" : "16944bf2-9a73-42ef-87a6-aa947729e976" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseacfail086773ed4f4a8235a4422d93" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseacillegal[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseacillegal[0].json new file mode 100644 index 000000000000..5537b4adf860 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseacillegal[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacillegal098031a07c709fa6f2467a?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" : "80204486-bd5a-42c8-8111-1b6287f58c66" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560B073FC86\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9d4f4-301e-0042-3b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:48 GMT", + "x-ms-client-request-id" : "80204486-bd5a-42c8-8111-1b6287f58c66" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquireleaseacillegal&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" : "a68105a3-1dec-4223-ba38-c874d1dd9e7d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9d50f-301e-0042-5249-67cbbf000000", + "Body" : "jtcacquireleaseacillegaljtcacquireleaseacillegal098031a07c709fa6f2467aMon, 09 Sep 2019 20:02:48 GMT\"0x8D73560B073FC86\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:02:48 GMT", + "x-ms-client-request-id" : "a68105a3-1dec-4223-ba38-c874d1dd9e7d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacillegal098031a07c709fa6f2467a?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" : "7d9f2114-8d8e-4322-a133-85c89302b1ed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9d533-301e-0042-7249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:48 GMT", + "x-ms-client-request-id" : "7d9f2114-8d8e-4322-a133-85c89302b1ed" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseacillegal098031a07c709fa6f2467a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseacillegal[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseacillegal[1].json new file mode 100644 index 000000000000..ee93cec55574 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseacillegal[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacillegal0185284863e1bccb804af9?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" : "8e5f83a2-55ca-4dc4-bafb-090db3192b4c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560B099B3D4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9d556-301e-0042-1349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:48 GMT", + "x-ms-client-request-id" : "8e5f83a2-55ca-4dc4-bafb-090db3192b4c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquireleaseacillegal&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" : "5a5ae354-763e-41d0-b4fd-dc71cb4460a6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9d568-301e-0042-2249-67cbbf000000", + "Body" : "jtcacquireleaseacillegaljtcacquireleaseacillegal0185284863e1bccb804af9Mon, 09 Sep 2019 20:02:49 GMT\"0x8D73560B099B3D4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:02:48 GMT", + "x-ms-client-request-id" : "5a5ae354-763e-41d0-b4fd-dc71cb4460a6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseacillegal0185284863e1bccb804af9?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" : "f77d1a96-5722-4b98-9d6f-0d79622d1fc9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9d576-301e-0042-3049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:48 GMT", + "x-ms-client-request-id" : "f77d1a96-5722-4b98-9d6f-0d79622d1fc9" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseacillegal0185284863e1bccb804af9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseerror.json new file mode 100644 index 000000000000..0a40f03ed131 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleaseerror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseerror0containerapitestacquireleaseerrore8a09435?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" : "aa33b525-9ac3-4301-a531-d95b36a53bf3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560B0C0CAF9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9d593-301e-0042-4b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:48 GMT", + "x-ms-client-request-id" : "aa33b525-9ac3-4301-a531-d95b36a53bf3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseerror1containerapitestacquireleaseerrore8a79688?comp=lease&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" : "b81f0329-079a-4a4d-8b8a-c2c7e90e9198" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "c5c9d5ae-301e-0042-6149-67cbbf000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:c5c9d5ae-301e-0042-6149-67cbbf000000\nTime:2019-09-09T20:02:49.5652581Z", + "Date" : "Mon, 09 Sep 2019 20:02:48 GMT", + "x-ms-client-request-id" : "b81f0329-079a-4a4d-8b8a-c2c7e90e9198", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquireleaseerror&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" : "967fe905-94fd-4e5c-a808-26c31bf8ec0f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9d5c2-301e-0042-7149-67cbbf000000", + "Body" : "jtcacquireleaseerrorjtcacquireleaseerror0containerapitestacquireleaseerrore8a09435Mon, 09 Sep 2019 20:02:49 GMT\"0x8D73560B0C0CAF9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:02:48 GMT", + "x-ms-client-request-id" : "967fe905-94fd-4e5c-a808-26c31bf8ec0f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleaseerror0containerapitestacquireleaseerrore8a09435?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" : "d42dd55a-dcac-4105-ba66-db09ec30bd22" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9d5d4-301e-0042-0349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:48 GMT", + "x-ms-client-request-id" : "d42dd55a-dcac-4105-ba66-db09ec30bd22" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleaseerror0containerapitestacquireleaseerrore8a09435", "jtcacquireleaseerror1containerapitestacquireleaseerrore8a79688" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleasemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleasemin.json new file mode 100644 index 000000000000..1632345cb054 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestacquireleasemin.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleasemin0containerapitestacquireleaseminc282215830?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" : "e2f56548-122d-427b-877f-341a238079b0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AF024EDB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9d2cd-301e-0042-4149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:45 GMT", + "x-ms-client-request-id" : "e2f56548-122d-427b-877f-341a238079b0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleasemin0containerapitestacquireleaseminc282215830?comp=lease&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" : "8ad0400d-c4ab-489f-b1b1-205ae6a54198" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AF024EDB\"", + "x-ms-lease-id" : "f0673764-51c6-40c2-b76e-938a80a540f8", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9d2df-301e-0042-5249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:45 GMT", + "x-ms-client-request-id" : "8ad0400d-c4ab-489f-b1b1-205ae6a54198" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcacquireleasemin&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" : "cf690aac-14b6-4075-ac9e-deacf2340546" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9d2f1-301e-0042-6449-67cbbf000000", + "Body" : "jtcacquireleaseminjtcacquireleasemin0containerapitestacquireleaseminc282215830Mon, 09 Sep 2019 20:02:46 GMT\"0x8D73560AF024EDB\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:02:45 GMT", + "x-ms-client-request-id" : "cf690aac-14b6-4075-ac9e-deacf2340546", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleasemin0containerapitestacquireleaseminc282215830?comp=lease&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" : "7e8f427b-465d-41df-af55-27f67a59fc19" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AF024EDB\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9d306-301e-0042-7749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:45 GMT", + "x-ms-client-request-id" : "7e8f427b-465d-41df-af55-27f67a59fc19" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcacquireleasemin0containerapitestacquireleaseminc282215830?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" : "ce30d5d9-c660-4711-b94a-5748bc963fae" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9d318-301e-0042-0949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:46 GMT", + "x-ms-client-request-id" : "ce30d5d9-c660-4711-b94a-5748bc963fae" + }, + "Exception" : null + } ], + "variables" : [ "jtcacquireleasemin0containerapitestacquireleaseminc282215830" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreaklease[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreaklease[0].json new file mode 100644 index 000000000000..aeef4c1fd60f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreaklease[0].json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease4ae598780413d17?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" : "3f0c48cf-d8ba-404a-8ad8-c577e92cce4f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BF8C1FA5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9eadb-301e-0042-3749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:13 GMT", + "x-ms-client-request-id" : "3f0c48cf-d8ba-404a-8ad8-c577e92cce4f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease4ae598780413d17?comp=lease&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" : "bce54f33-fd21-4d4c-8e5d-6ae2c2f54319" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BF8C1FA5\"", + "x-ms-lease-id" : "ff79ead2-5df5-479c-80cb-1e6501124985", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9eafb-301e-0042-5549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:13 GMT", + "x-ms-client-request-id" : "bce54f33-fd21-4d4c-8e5d-6ae2c2f54319" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease4ae598780413d17?comp=lease&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" : "bfd87a8e-58a3-40a8-8457-71df197be765" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BF8C1FA5\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9eb09-301e-0042-6349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:13 GMT", + "x-ms-client-request-id" : "bfd87a8e-58a3-40a8-8457-71df197be765" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease4ae598780413d17?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" : "814a9baf-04ac-4c8a-88e1-e8b612c3321b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "broken", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:14 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:03:13 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D73560BF8C1FA5\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "c5c9eb12-301e-0042-6c49-67cbbf000000", + "x-ms-client-request-id" : "814a9baf-04ac-4c8a-88e1-e8b612c3321b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreaklease&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" : "4e64174e-2a5d-48e0-b0cb-7beedb178dda" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9eb23-301e-0042-7b49-67cbbf000000", + "Body" : "jtcbreakleasejtcbreaklease0containerapitestbreaklease4ae598780413d17Mon, 09 Sep 2019 20:03:14 GMT\"0x8D73560BF8C1FA5\"unlockedbroken$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:13 GMT", + "x-ms-client-request-id" : "4e64174e-2a5d-48e0-b0cb-7beedb178dda", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease4ae598780413d17?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" : "4e9791eb-b62d-4424-8b29-490c9fbed435" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9eb31-301e-0042-0749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:13 GMT", + "x-ms-client-request-id" : "4e9791eb-b62d-4424-8b29-490c9fbed435" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreaklease0containerapitestbreaklease4ae598780413d17", "ff79ead2-5df5-479c-80cb-1e6501124985" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreaklease[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreaklease[1].json new file mode 100644 index 000000000000..68789d1cf22b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreaklease[1].json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease39644115cf52c81?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" : "a26e7164-5f2b-4097-8f18-652e6237de4c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BFD98A64\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9eb45-301e-0042-1849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:13 GMT", + "x-ms-client-request-id" : "a26e7164-5f2b-4097-8f18-652e6237de4c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease39644115cf52c81?comp=lease&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" : "da53cdc0-6839-49ff-b6eb-e2d3f92c7d76" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BFD98A64\"", + "x-ms-lease-id" : "fe1b3299-2d6b-4aae-88e8-db8fd3ded787", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9eb5d-301e-0042-2d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:14 GMT", + "x-ms-client-request-id" : "da53cdc0-6839-49ff-b6eb-e2d3f92c7d76" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease39644115cf52c81?comp=lease&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" : "bf959f1e-189f-4a25-ad9a-87750d0f458c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BFD98A64\"", + "x-ms-lease-time" : "20", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9eb6f-301e-0042-3c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:14 GMT", + "x-ms-client-request-id" : "bf959f1e-189f-4a25-ad9a-87750d0f458c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease39644115cf52c81?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" : "89f97cfb-467c-48fe-a828-03d90ea1c6f7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "breaking", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:14 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:03:14 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D73560BFD98A64\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "c5c9eb86-301e-0042-5049-67cbbf000000", + "x-ms-client-request-id" : "89f97cfb-467c-48fe-a828-03d90ea1c6f7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreaklease&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" : "08715fd4-4cc0-4bdd-9d03-e53002427797" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9fd9d-301e-0042-7d49-67cbbf000000", + "Body" : "jtcbreakleasejtcbreaklease0containerapitestbreaklease39644115cf52c81Mon, 09 Sep 2019 20:03:14 GMT\"0x8D73560BFD98A64\"unlockedbroken$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:34 GMT", + "x-ms-client-request-id" : "08715fd4-4cc0-4bdd-9d03-e53002427797", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease39644115cf52c81?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" : "2ef8ee55-e539-4988-a47f-355239856256" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9fdb6-301e-0042-1449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:34 GMT", + "x-ms-client-request-id" : "2ef8ee55-e539-4988-a47f-355239856256" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreaklease0containerapitestbreaklease39644115cf52c81", "fe1b3299-2d6b-4aae-88e8-db8fd3ded787" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreaklease[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreaklease[2].json new file mode 100644 index 000000000000..771695ba1e78 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreaklease[2].json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease56327921cfb9c94?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" : "41ed3906-ff60-455f-bb28-dd1ab8174d8d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560CC17064D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9fdda-301e-0042-3349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:34 GMT", + "x-ms-client-request-id" : "41ed3906-ff60-455f-bb28-dd1ab8174d8d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease56327921cfb9c94?comp=lease&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" : "e18b4fa1-4ba0-484d-9a20-8e7eeb4fd070" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560CC17064D\"", + "x-ms-lease-id" : "598ef5a3-2c34-4682-b7c8-13b29c0d5732", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9fdf4-301e-0042-4849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:34 GMT", + "x-ms-client-request-id" : "e18b4fa1-4ba0-484d-9a20-8e7eeb4fd070" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease56327921cfb9c94?comp=lease&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" : "182b8e83-3a64-4e4c-85de-84bb1648e080" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560CC17064D\"", + "x-ms-lease-time" : "15", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9fe10-301e-0042-6349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:34 GMT", + "x-ms-client-request-id" : "182b8e83-3a64-4e4c-85de-84bb1648e080" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease56327921cfb9c94?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" : "50e2bc39-aa5e-4fa5-b356-bfe91170dcaf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "breaking", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:35 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:03:34 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D73560CC17064D\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "c5c9fe21-301e-0042-7449-67cbbf000000", + "x-ms-client-request-id" : "50e2bc39-aa5e-4fa5-b356-bfe91170dcaf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreaklease&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" : "0aba7d02-38b1-4dea-acd9-10799401258c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca0a71-301e-0042-3a49-67cbbf000000", + "Body" : "jtcbreakleasejtcbreaklease0containerapitestbreaklease56327921cfb9c94Mon, 09 Sep 2019 20:03:35 GMT\"0x8D73560CC17064D\"unlockedbroken$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:49 GMT", + "x-ms-client-request-id" : "0aba7d02-38b1-4dea-acd9-10799401258c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreaklease0containerapitestbreaklease56327921cfb9c94?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" : "84f92e17-97a8-40e7-8398-c7c1c1df1152" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca0a81-301e-0042-4949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:49 GMT", + "x-ms-client-request-id" : "84f92e17-97a8-40e7-8398-c7c1c1df1152" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreaklease0containerapitestbreaklease56327921cfb9c94", "598ef5a3-2c34-4682-b7c8-13b29c0d5732" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseac[0].json new file mode 100644 index 000000000000..738b157bb7c3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseac[0].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseacf5c72563e911e?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" : "a8319757-b026-4f75-bd3a-800b341f7439" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D591AD78\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0ae5-301e-0042-2749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:50 GMT", + "x-ms-client-request-id" : "a8319757-b026-4f75-bd3a-800b341f7439" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseacf5c72563e911e?comp=lease&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" : "07fa835d-c89a-4275-b2ef-10c2444cb671" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D591AD78\"", + "x-ms-lease-id" : "d50d4e5a-16eb-44b9-8a7d-56d78f763ab0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0afb-301e-0042-3c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:50 GMT", + "x-ms-client-request-id" : "07fa835d-c89a-4275-b2ef-10c2444cb671" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseacf5c72563e911e?comp=lease&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" : "fcf76ccc-bcdd-4910-b9fb-b63dbde64dc7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D591AD78\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca0b0c-301e-0042-4d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:50 GMT", + "x-ms-client-request-id" : "fcf76ccc-bcdd-4910-b9fb-b63dbde64dc7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreakleaseac&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" : "71eb8695-3980-4c21-a6d5-9d7f39598b97" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca0b22-301e-0042-6249-67cbbf000000", + "Body" : "jtcbreakleaseacjtcbreakleaseac0containerapitestbreakleaseacf5c72563e911eMon, 09 Sep 2019 20:03:51 GMT\"0x8D73560D591AD78\"unlockedbroken$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:50 GMT", + "x-ms-client-request-id" : "71eb8695-3980-4c21-a6d5-9d7f39598b97", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseacf5c72563e911e?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" : "f403f819-f0db-4aa7-8a0e-aa828d8b98bc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca0b3b-301e-0042-7a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:50 GMT", + "x-ms-client-request-id" : "f403f819-f0db-4aa7-8a0e-aa828d8b98bc" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseac0containerapitestbreakleaseacf5c72563e911e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseac[1].json new file mode 100644 index 000000000000..f9636c6a80d2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseac[1].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseacf9754249eb6f5?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" : "a0a212a8-8d09-4a3f-a96c-8203e4491a76" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D5D8AE73\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0b59-301e-0042-1749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:50 GMT", + "x-ms-client-request-id" : "a0a212a8-8d09-4a3f-a96c-8203e4491a76" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseacf9754249eb6f5?comp=lease&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" : "c8c36c89-95ad-4dc8-9b6d-39304065321b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D5D8AE73\"", + "x-ms-lease-id" : "621e64fa-e8fb-4bde-8073-5d626adc750b", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0b73-301e-0042-2b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:50 GMT", + "x-ms-client-request-id" : "c8c36c89-95ad-4dc8-9b6d-39304065321b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseacf9754249eb6f5?comp=lease&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" : "5fc7ddb0-2fcd-4b2e-a9bb-f089a77954e7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D5D8AE73\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca0b83-301e-0042-3949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:50 GMT", + "x-ms-client-request-id" : "5fc7ddb0-2fcd-4b2e-a9bb-f089a77954e7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreakleaseac&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" : "08046a3e-9f7b-4fce-bf13-d78901c7fb9d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca0b90-301e-0042-4649-67cbbf000000", + "Body" : "jtcbreakleaseacjtcbreakleaseac0containerapitestbreakleaseacf9754249eb6f5Mon, 09 Sep 2019 20:03:51 GMT\"0x8D73560D5D8AE73\"unlockedbroken$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:50 GMT", + "x-ms-client-request-id" : "08046a3e-9f7b-4fce-bf13-d78901c7fb9d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseacf9754249eb6f5?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" : "59990d63-fd22-415e-9ecd-84e7ae609862" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca0ba2-301e-0042-5749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:51 GMT", + "x-ms-client-request-id" : "59990d63-fd22-415e-9ecd-84e7ae609862" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseac0containerapitestbreakleaseacf9754249eb6f5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseac[2].json new file mode 100644 index 000000000000..0ae5d9502cc8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseac[2].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseac8208089864914?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" : "0e36079c-199a-4d79-924c-9fd1cf1350c9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D6177074\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0bc3-301e-0042-7649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:51 GMT", + "x-ms-client-request-id" : "0e36079c-199a-4d79-924c-9fd1cf1350c9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseac8208089864914?comp=lease&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" : "5d46e19c-ba06-468f-bd1c-249574344d60" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D6177074\"", + "x-ms-lease-id" : "0712407e-9bcc-4b32-8000-e6626759260f", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0be8-301e-0042-1949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:51 GMT", + "x-ms-client-request-id" : "5d46e19c-ba06-468f-bd1c-249574344d60" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseac8208089864914?comp=lease&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" : "404984cd-62a5-4273-a5c6-5b24c72a4f93" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D6177074\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca0bfc-301e-0042-2a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:51 GMT", + "x-ms-client-request-id" : "404984cd-62a5-4273-a5c6-5b24c72a4f93" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreakleaseac&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" : "bee6a9a9-eef1-4101-b0cb-e551dc0e5db0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca0c09-301e-0042-3649-67cbbf000000", + "Body" : "jtcbreakleaseacjtcbreakleaseac0containerapitestbreakleaseac8208089864914Mon, 09 Sep 2019 20:03:52 GMT\"0x8D73560D6177074\"unlockedbroken$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:51 GMT", + "x-ms-client-request-id" : "bee6a9a9-eef1-4101-b0cb-e551dc0e5db0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseac0containerapitestbreakleaseac8208089864914?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" : "3fab0638-772e-4e6c-9443-c717dc56a1d3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca0c1b-301e-0042-4849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:51 GMT", + "x-ms-client-request-id" : "3fab0638-772e-4e6c-9443-c717dc56a1d3" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseac0containerapitestbreakleaseac8208089864914" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseacfail[0].json new file mode 100644 index 000000000000..a35d2d5c7a13 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseacfail[0].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfailcba24692c?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" : "ceb81cc9-18c0-4734-9508-0ce844ec59a7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D6582EAC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0c2a-301e-0042-5649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:51 GMT", + "x-ms-client-request-id" : "ceb81cc9-18c0-4734-9508-0ce844ec59a7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfailcba24692c?comp=lease&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" : "993088d5-fa85-42d4-be0e-9b085313144e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D6582EAC\"", + "x-ms-lease-id" : "8e9f1c0e-b843-4f33-a2ba-7272c75afed9", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0c45-301e-0042-7049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:51 GMT", + "x-ms-client-request-id" : "993088d5-fa85-42d4-be0e-9b085313144e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfailcba24692c?comp=lease&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" : "c9b74d14-6de5-44d8-b5c1-149f5a3e8ffd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca0c56-301e-0042-0149-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca0c56-301e-0042-0149-67cbbf000000\nTime:2019-09-09T20:03:52.7101583Z", + "Date" : "Mon, 09 Sep 2019 20:03:51 GMT", + "x-ms-client-request-id" : "c9b74d14-6de5-44d8-b5c1-149f5a3e8ffd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreakleaseacfail&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" : "dff1df2a-be01-42c5-bead-20b59cb513e8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca0c6a-301e-0042-1449-67cbbf000000", + "Body" : "jtcbreakleaseacfailjtcbreakleaseacfail0containerapitestbreakleaseacfailcba24692cMon, 09 Sep 2019 20:03:52 GMT\"0x8D73560D6582EAC\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:51 GMT", + "x-ms-client-request-id" : "dff1df2a-be01-42c5-bead-20b59cb513e8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfailcba24692c?comp=lease&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" : "48e6f803-ecd6-488a-ac80-6a67616cc9f9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D6582EAC\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca0c7e-301e-0042-2749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:51 GMT", + "x-ms-client-request-id" : "48e6f803-ecd6-488a-ac80-6a67616cc9f9" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfailcba24692c?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" : "f724ed60-c65c-4221-a125-a38e4af3ed07" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca0c9d-301e-0042-4349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:51 GMT", + "x-ms-client-request-id" : "f724ed60-c65c-4221-a125-a38e4af3ed07" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseacfail0containerapitestbreakleaseacfailcba24692c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseacfail[1].json new file mode 100644 index 000000000000..e8346f858788 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseacfail[1].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfail1e3520006?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" : "3cc2fffd-8cb3-4d3f-b38c-08673f3af552" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D6A3EB79\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0cbb-301e-0042-5f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:52 GMT", + "x-ms-client-request-id" : "3cc2fffd-8cb3-4d3f-b38c-08673f3af552" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfail1e3520006?comp=lease&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" : "0e8627b8-661a-41b1-9e68-bc7452186f70" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D6A3EB79\"", + "x-ms-lease-id" : "ce4c9dcc-a143-41ab-b8b3-b6309938d829", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0cdb-301e-0042-7949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:52 GMT", + "x-ms-client-request-id" : "0e8627b8-661a-41b1-9e68-bc7452186f70" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfail1e3520006?comp=lease&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" : "ab0f29b0-72fc-4c9f-bcc9-b98646eed152" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca0cf5-301e-0042-1349-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca0cf5-301e-0042-1349-67cbbf000000\nTime:2019-09-09T20:03:53.2025090Z", + "Date" : "Mon, 09 Sep 2019 20:03:52 GMT", + "x-ms-client-request-id" : "ab0f29b0-72fc-4c9f-bcc9-b98646eed152", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreakleaseacfail&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" : "21725bd6-f01d-42d4-a04a-8c1a9019afb8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca0d0a-301e-0042-2649-67cbbf000000", + "Body" : "jtcbreakleaseacfailjtcbreakleaseacfail0containerapitestbreakleaseacfail1e3520006Mon, 09 Sep 2019 20:03:53 GMT\"0x8D73560D6A3EB79\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:52 GMT", + "x-ms-client-request-id" : "21725bd6-f01d-42d4-a04a-8c1a9019afb8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfail1e3520006?comp=lease&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" : "c6919959-5d50-49fa-8e22-8771d26deee0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D6A3EB79\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca0d15-301e-0042-3149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:52 GMT", + "x-ms-client-request-id" : "c6919959-5d50-49fa-8e22-8771d26deee0" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacfail0containerapitestbreakleaseacfail1e3520006?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" : "44502a4c-d1de-4681-aac1-03a5875dd4e6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca0d24-301e-0042-4049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:52 GMT", + "x-ms-client-request-id" : "44502a4c-d1de-4681-aac1-03a5875dd4e6" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseacfail0containerapitestbreakleaseacfail1e3520006" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseacillegal[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseacillegal[0].json new file mode 100644 index 000000000000..5731c5bc30a0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseacillegal[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacillegal018474d7a38e5627cd4f8eb?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" : "e61a903e-da0c-4ae9-b5fb-9f48126377c8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D6EEBDBD\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0d31-301e-0042-4c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:52 GMT", + "x-ms-client-request-id" : "e61a903e-da0c-4ae9-b5fb-9f48126377c8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreakleaseacillegal&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" : "1c59b566-76fd-4df8-b876-51b7e0c5a907" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca0d48-301e-0042-6049-67cbbf000000", + "Body" : "jtcbreakleaseacillegaljtcbreakleaseacillegal018474d7a38e5627cd4f8ebMon, 09 Sep 2019 20:03:53 GMT\"0x8D73560D6EEBDBD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:52 GMT", + "x-ms-client-request-id" : "1c59b566-76fd-4df8-b876-51b7e0c5a907", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacillegal018474d7a38e5627cd4f8eb?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" : "c47faea8-fc4d-4841-99dd-87dddce99a01" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca0d65-301e-0042-7d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:52 GMT", + "x-ms-client-request-id" : "c47faea8-fc4d-4841-99dd-87dddce99a01" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseacillegal018474d7a38e5627cd4f8eb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseacillegal[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseacillegal[1].json new file mode 100644 index 000000000000..367465c99d41 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseacillegal[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacillegal00766792538a3fa94540dc8?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" : "80c826cf-0295-4417-bd1e-274b653fcf8a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D71586B3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0d82-301e-0042-1749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:52 GMT", + "x-ms-client-request-id" : "80c826cf-0295-4417-bd1e-274b653fcf8a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreakleaseacillegal&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" : "730c033f-7b2a-4468-8712-7e2f4cec041a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca0d9b-301e-0042-2e49-67cbbf000000", + "Body" : "jtcbreakleaseacillegaljtcbreakleaseacillegal00766792538a3fa94540dc8Mon, 09 Sep 2019 20:03:53 GMT\"0x8D73560D71586B3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:52 GMT", + "x-ms-client-request-id" : "730c033f-7b2a-4468-8712-7e2f4cec041a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseacillegal00766792538a3fa94540dc8?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" : "56fccf75-4488-42e4-a5c0-b1e0f7f0851d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca0db1-301e-0042-3b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:52 GMT", + "x-ms-client-request-id" : "56fccf75-4488-42e4-a5c0-b1e0f7f0851d" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseacillegal00766792538a3fa94540dc8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseerror.json new file mode 100644 index 000000000000..59bdc514248f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleaseerror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseerror0containerapitestbreakleaseerrora3902636d3?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" : "6aa2650d-4925-4850-8b71-e4a0b60f4753" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D73C2888\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0dc4-301e-0042-4b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:53 GMT", + "x-ms-client-request-id" : "6aa2650d-4925-4850-8b71-e4a0b60f4753" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseerror1containerapitestbreakleaseerrora397957076?comp=lease&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" : "b6926565-9af8-4d7d-a952-20877f0d3435" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "c5ca0dda-301e-0042-5e49-67cbbf000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:c5ca0dda-301e-0042-5e49-67cbbf000000\nTime:2019-09-09T20:03:54.1241651Z", + "Date" : "Mon, 09 Sep 2019 20:03:53 GMT", + "x-ms-client-request-id" : "b6926565-9af8-4d7d-a952-20877f0d3435", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreakleaseerror&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" : "5a73f4a3-ca61-42ab-b0f2-35c344f0088f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca0de9-301e-0042-6c49-67cbbf000000", + "Body" : "jtcbreakleaseerrorjtcbreakleaseerror0containerapitestbreakleaseerrora3902636d3Mon, 09 Sep 2019 20:03:54 GMT\"0x8D73560D73C2888\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:53 GMT", + "x-ms-client-request-id" : "5a73f4a3-ca61-42ab-b0f2-35c344f0088f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleaseerror0containerapitestbreakleaseerrora3902636d3?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" : "6b406f10-9811-4e48-8a57-cfee1dfeae9c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca0df8-301e-0042-7b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:53 GMT", + "x-ms-client-request-id" : "6b406f10-9811-4e48-8a57-cfee1dfeae9c" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleaseerror0containerapitestbreakleaseerrora3902636d3", "jtcbreakleaseerror1containerapitestbreakleaseerrora397957076" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleasemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleasemin.json new file mode 100644 index 000000000000..eafa6ee9f4fb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestbreakleasemin.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleasemin0containerapitestbreakleasemin10c684978f0f?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" : "4093c1ef-be64-486b-b312-5b930128f401" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D553FD02\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0a95-301e-0042-5949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:49 GMT", + "x-ms-client-request-id" : "4093c1ef-be64-486b-b312-5b930128f401" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleasemin0containerapitestbreakleasemin10c684978f0f?comp=lease&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" : "beea55a0-5e41-4d65-a166-e161722a420d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D553FD02\"", + "x-ms-lease-id" : "d1475811-be76-4735-b8bf-d6aebaae3670", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0aa7-301e-0042-6a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:49 GMT", + "x-ms-client-request-id" : "beea55a0-5e41-4d65-a166-e161722a420d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleasemin0containerapitestbreakleasemin10c684978f0f?comp=lease&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" : "0453324c-e1c0-409d-ab5b-d6f9a543f5b1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D553FD02\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca0ab7-301e-0042-7a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:50 GMT", + "x-ms-client-request-id" : "0453324c-e1c0-409d-ab5b-d6f9a543f5b1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbreakleasemin&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" : "c4e059bd-136b-49f0-b7ef-2bc9ba424978" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca0ac6-301e-0042-0949-67cbbf000000", + "Body" : "jtcbreakleaseminjtcbreakleasemin0containerapitestbreakleasemin10c684978f0fMon, 09 Sep 2019 20:03:50 GMT\"0x8D73560D553FD02\"unlockedbroken$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:50 GMT", + "x-ms-client-request-id" : "c4e059bd-136b-49f0-b7ef-2bc9ba424978", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbreakleasemin0containerapitestbreakleasemin10c684978f0f?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" : "cf115a7c-2c36-4b23-b9eb-755e5e726f99" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca0ad9-301e-0042-1b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:50 GMT", + "x-ms-client-request-id" : "cf115a7c-2c36-4b23-b9eb-755e5e726f99" + }, + "Exception" : null + } ], + "variables" : [ "jtcbreakleasemin0containerapitestbreakleasemin10c684978f0f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangelease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangelease.json new file mode 100644 index 000000000000..e02523f20dd9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangelease.json @@ -0,0 +1,130 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangelease0containerapitestchangelease2f304462a70848?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" : "3c973bbf-51f0-4bb9-8a5d-08ca427fb525" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D77124E3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0e0f-301e-0042-0f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:53 GMT", + "x-ms-client-request-id" : "3c973bbf-51f0-4bb9-8a5d-08ca427fb525" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangelease0containerapitestchangelease2f304462a70848?comp=lease&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" : "64af6f99-04c4-46d8-965e-9512fa01f92d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D77124E3\"", + "x-ms-lease-id" : "804c3583-eca8-4eac-bd7f-cbdfd9b46236", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0e1d-301e-0042-1b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:53 GMT", + "x-ms-client-request-id" : "64af6f99-04c4-46d8-965e-9512fa01f92d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangelease0containerapitestchangelease2f304462a70848?comp=lease&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" : "bba8f2a4-cb98-4b9f-9a4e-981114101d72" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D77124E3\"", + "x-ms-lease-id" : "c80b155c-95c9-4586-9b4a-cc3e70e1aa2e", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca0e2f-301e-0042-2c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:53 GMT", + "x-ms-client-request-id" : "bba8f2a4-cb98-4b9f-9a4e-981114101d72" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangelease0containerapitestchangelease2f304462a70848?comp=lease&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" : "d8ff70d3-a44d-4aec-a722-c8a3fffc2c09" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D77124E3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca0e41-301e-0042-3e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:53 GMT", + "x-ms-client-request-id" : "d8ff70d3-a44d-4aec-a722-c8a3fffc2c09" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcchangelease&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" : "d3b302b8-ab85-4d1b-9133-a0e7ebddefe7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca0e57-301e-0042-5349-67cbbf000000", + "Body" : "jtcchangeleasejtcchangelease0containerapitestchangelease2f304462a70848Mon, 09 Sep 2019 20:03:54 GMT\"0x8D73560D77124E3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:53 GMT", + "x-ms-client-request-id" : "d3b302b8-ab85-4d1b-9133-a0e7ebddefe7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangelease0containerapitestchangelease2f304462a70848?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" : "250d41db-5300-4c90-a88b-eaa3d0d07d88" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca0e66-301e-0042-6049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:53 GMT", + "x-ms-client-request-id" : "250d41db-5300-4c90-a88b-eaa3d0d07d88" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangelease0containerapitestchangelease2f304462a70848", "c80b155c-95c9-4586-9b4a-cc3e70e1aa2e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseac[0].json new file mode 100644 index 000000000000..de5ce9fdc626 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseac[0].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseaceb835921f9dc?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" : "8ab30db2-2b12-4c0f-ac83-c31659eb7682" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D80DA879\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0f05-301e-0042-7049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:54 GMT", + "x-ms-client-request-id" : "8ab30db2-2b12-4c0f-ac83-c31659eb7682" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseaceb835921f9dc?comp=lease&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" : "7ab59070-e118-4dc5-a6cf-4b35369022a6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D80DA879\"", + "x-ms-lease-id" : "14686136-431c-4e9d-bdcd-c56744094b9d", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0f0f-301e-0042-7949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:54 GMT", + "x-ms-client-request-id" : "7ab59070-e118-4dc5-a6cf-4b35369022a6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseaceb835921f9dc?comp=lease&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" : "306ac4f8-d9bc-4d99-a7f1-732c1713b059" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D80DA879\"", + "x-ms-lease-id" : "4a34115f-5923-45c0-bd49-7bfae69ac795", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca0f21-301e-0042-0749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:54 GMT", + "x-ms-client-request-id" : "306ac4f8-d9bc-4d99-a7f1-732c1713b059" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcchangeleaseac&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" : "cb94f90b-7269-4071-96c6-e5da5a9a6e06" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca0f38-301e-0042-1d49-67cbbf000000", + "Body" : "jtcchangeleaseacjtcchangeleaseac0containerapitestchangeleaseaceb835921f9dcMon, 09 Sep 2019 20:03:55 GMT\"0x8D73560D80DA879\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:54 GMT", + "x-ms-client-request-id" : "cb94f90b-7269-4071-96c6-e5da5a9a6e06", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseaceb835921f9dc?comp=lease&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" : "f054ade0-d979-4cd0-8f06-4d5a9d6b119f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D80DA879\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca0f4b-301e-0042-3049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:54 GMT", + "x-ms-client-request-id" : "f054ade0-d979-4cd0-8f06-4d5a9d6b119f" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseaceb835921f9dc?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" : "ff6127c1-757c-4c5f-b0e9-be67343ee806" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca0f5c-301e-0042-3e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:54 GMT", + "x-ms-client-request-id" : "ff6127c1-757c-4c5f-b0e9-be67343ee806" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseac0containerapitestchangeleaseaceb835921f9dc", "4a34115f-5923-45c0-bd49-7bfae69ac795" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseac[1].json new file mode 100644 index 000000000000..611f85c06c58 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseac[1].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacd0b781935b13?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" : "04875c61-f0ac-477b-b556-b1f383cb8528" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D85A76EC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0f6d-301e-0042-4f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:54 GMT", + "x-ms-client-request-id" : "04875c61-f0ac-477b-b556-b1f383cb8528" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacd0b781935b13?comp=lease&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" : "790b9ff8-8ce4-467e-8eb7-733c5eb9e04f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D85A76EC\"", + "x-ms-lease-id" : "fc7be552-0351-4c90-a711-05ceca5353f5", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0f85-301e-0042-6649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:55 GMT", + "x-ms-client-request-id" : "790b9ff8-8ce4-467e-8eb7-733c5eb9e04f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacd0b781935b13?comp=lease&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" : "597db804-9713-4164-bb63-e207590a9ef0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D85A76EC\"", + "x-ms-lease-id" : "6e63712b-2dec-485f-be3d-47c34d9c4d82", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca0f9a-301e-0042-7a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:55 GMT", + "x-ms-client-request-id" : "597db804-9713-4164-bb63-e207590a9ef0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcchangeleaseac&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" : "33a3bdb9-562c-42ef-9794-e6cff6465635" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca0fa8-301e-0042-0749-67cbbf000000", + "Body" : "jtcchangeleaseacjtcchangeleaseac0containerapitestchangeleaseacd0b781935b13Mon, 09 Sep 2019 20:03:55 GMT\"0x8D73560D85A76EC\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:55 GMT", + "x-ms-client-request-id" : "33a3bdb9-562c-42ef-9794-e6cff6465635", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacd0b781935b13?comp=lease&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" : "715d1fc1-c239-4e30-9b1e-c78dd72d5f95" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D85A76EC\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca0fb6-301e-0042-1549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:55 GMT", + "x-ms-client-request-id" : "715d1fc1-c239-4e30-9b1e-c78dd72d5f95" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacd0b781935b13?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" : "c2178b08-3fc3-4534-bb4c-faebfb086ab3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca0fca-301e-0042-2849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:55 GMT", + "x-ms-client-request-id" : "c2178b08-3fc3-4534-bb4c-faebfb086ab3" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseac0containerapitestchangeleaseacd0b781935b13", "6e63712b-2dec-485f-be3d-47c34d9c4d82" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseac[2].json new file mode 100644 index 000000000000..555b2795c0b2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseac[2].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacf4f230784863?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" : "d4893a0c-0f94-4f73-a3bd-7f70de696ed2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D8A4D3ED\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0fde-301e-0042-3c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:55 GMT", + "x-ms-client-request-id" : "d4893a0c-0f94-4f73-a3bd-7f70de696ed2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacf4f230784863?comp=lease&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" : "39775421-59d2-41d3-9b9e-d841fb31ef62" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D8A4D3ED\"", + "x-ms-lease-id" : "5c471775-51f3-43d2-9070-3e645e02a7d2", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0ff3-301e-0042-5049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:55 GMT", + "x-ms-client-request-id" : "39775421-59d2-41d3-9b9e-d841fb31ef62" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacf4f230784863?comp=lease&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" : "4cd0f595-19c6-469c-8fb3-44161f983a94" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D8A4D3ED\"", + "x-ms-lease-id" : "9a3b261e-4d4a-4d97-a2ff-a27cdf6c0e07", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca1006-301e-0042-6149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:55 GMT", + "x-ms-client-request-id" : "4cd0f595-19c6-469c-8fb3-44161f983a94" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcchangeleaseac&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" : "b40c0bc6-cf7a-4b60-9ac9-a8c0679cc334" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca1029-301e-0042-8049-67cbbf000000", + "Body" : "jtcchangeleaseacjtcchangeleaseac0containerapitestchangeleaseacf4f230784863Mon, 09 Sep 2019 20:03:56 GMT\"0x8D73560D8A4D3ED\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:55 GMT", + "x-ms-client-request-id" : "b40c0bc6-cf7a-4b60-9ac9-a8c0679cc334", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacf4f230784863?comp=lease&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" : "712bd2c2-c903-439c-93d9-6b46acb26de7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D8A4D3ED\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca1048-301e-0042-1e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:55 GMT", + "x-ms-client-request-id" : "712bd2c2-c903-439c-93d9-6b46acb26de7" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseac0containerapitestchangeleaseacf4f230784863?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" : "a5337fc7-fd02-40c2-958a-91609308dd33" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca105f-301e-0042-3549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:55 GMT", + "x-ms-client-request-id" : "a5337fc7-fd02-40c2-958a-91609308dd33" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseac0containerapitestchangeleaseacf4f230784863", "9a3b261e-4d4a-4d97-a2ff-a27cdf6c0e07" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseacfail[0].json new file mode 100644 index 000000000000..08b018eba82f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseacfail[0].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfail49f85045?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" : "eafd7ea6-daaa-40c0-aff9-50c226d9e8f8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D8F1542D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca106f-301e-0042-4549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:55 GMT", + "x-ms-client-request-id" : "eafd7ea6-daaa-40c0-aff9-50c226d9e8f8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfail49f85045?comp=lease&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" : "65de6707-be44-4794-b10c-193cf57d8c80" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D8F1542D\"", + "x-ms-lease-id" : "96402089-9983-4efd-a83d-8f4efc134724", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca1083-301e-0042-5849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:56 GMT", + "x-ms-client-request-id" : "65de6707-be44-4794-b10c-193cf57d8c80" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfail49f85045?comp=lease&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" : "d82a543d-7d52-4329-a08f-54ec83f46107" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca1094-301e-0042-6749-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca1094-301e-0042-6749-67cbbf000000\nTime:2019-09-09T20:03:57.0882765Z", + "Date" : "Mon, 09 Sep 2019 20:03:56 GMT", + "x-ms-client-request-id" : "d82a543d-7d52-4329-a08f-54ec83f46107", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcchangeleaseacfail&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" : "071fb8b5-914d-43bb-ae83-9531219438fe" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca10b5-301e-0042-0649-67cbbf000000", + "Body" : "jtcchangeleaseacfailjtcchangeleaseacfail0containerapitestchangeleaseacfail49f85045Mon, 09 Sep 2019 20:03:56 GMT\"0x8D73560D8F1542D\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:56 GMT", + "x-ms-client-request-id" : "071fb8b5-914d-43bb-ae83-9531219438fe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfail49f85045?comp=lease&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" : "2e3e2e1b-1f5f-4d05-a9ba-133d72a03443" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D8F1542D\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca10c3-301e-0042-1249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:56 GMT", + "x-ms-client-request-id" : "2e3e2e1b-1f5f-4d05-a9ba-133d72a03443" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfail49f85045?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" : "58e018e7-ef2a-4cad-a533-a1201f2b3800" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca10d8-301e-0042-2249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:56 GMT", + "x-ms-client-request-id" : "58e018e7-ef2a-4cad-a533-a1201f2b3800" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseacfail0containerapitestchangeleaseacfail49f85045", "a3a345de-d7ed-4548-9036-5a7db1f145d7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseacfail[1].json new file mode 100644 index 000000000000..c8213afe2b3d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseacfail[1].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfail69619867?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" : "7f36101c-58c8-423f-8ebc-d1d5899766ee" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D940BB27\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca10eb-301e-0042-3549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:56 GMT", + "x-ms-client-request-id" : "7f36101c-58c8-423f-8ebc-d1d5899766ee" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfail69619867?comp=lease&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" : "9298ec57-a5b8-4a72-92a2-b538d2b72aa7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D940BB27\"", + "x-ms-lease-id" : "b7269386-3b17-4bc8-9b61-59c79d5d330c", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca10f7-301e-0042-4049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:56 GMT", + "x-ms-client-request-id" : "9298ec57-a5b8-4a72-92a2-b538d2b72aa7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfail69619867?comp=lease&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" : "ac9b13a7-1d60-44b7-bb17-39660adf16fe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5ca110f-301e-0042-5849-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5ca110f-301e-0042-5849-67cbbf000000\nTime:2019-09-09T20:03:57.5896336Z", + "Date" : "Mon, 09 Sep 2019 20:03:56 GMT", + "x-ms-client-request-id" : "ac9b13a7-1d60-44b7-bb17-39660adf16fe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcchangeleaseacfail&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" : "722ac8d8-c66b-4044-b7ad-7bb75ce776d4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca111f-301e-0042-6849-67cbbf000000", + "Body" : "jtcchangeleaseacfailjtcchangeleaseacfail0containerapitestchangeleaseacfail69619867Mon, 09 Sep 2019 20:03:57 GMT\"0x8D73560D940BB27\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:56 GMT", + "x-ms-client-request-id" : "722ac8d8-c66b-4044-b7ad-7bb75ce776d4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfail69619867?comp=lease&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" : "a45a5ed6-eca3-42ea-b370-4a7793bee9ee" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D940BB27\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca1130-301e-0042-7549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:56 GMT", + "x-ms-client-request-id" : "a45a5ed6-eca3-42ea-b370-4a7793bee9ee" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacfail0containerapitestchangeleaseacfail69619867?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" : "ea7256eb-1b34-4738-a15e-3cc5b01ae62f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca1141-301e-0042-0549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:56 GMT", + "x-ms-client-request-id" : "ea7256eb-1b34-4738-a15e-3cc5b01ae62f" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseacfail0containerapitestchangeleaseacfail69619867", "feffd927-7373-471a-b9a8-282e80b1310a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseacillegal[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseacillegal[0].json new file mode 100644 index 000000000000..2b482c5faec3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseacillegal[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacillegal081278067f66750b4f49e7b?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" : "f029303d-1df3-4fbf-b920-a81e89887501" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D98DFEC7\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca1155-301e-0042-1549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:56 GMT", + "x-ms-client-request-id" : "f029303d-1df3-4fbf-b920-a81e89887501" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcchangeleaseacillegal&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" : "60647338-764a-4e6c-a335-557471baab35" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca116d-301e-0042-2b49-67cbbf000000", + "Body" : "jtcchangeleaseacillegaljtcchangeleaseacillegal081278067f66750b4f49e7bMon, 09 Sep 2019 20:03:57 GMT\"0x8D73560D98DFEC7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:57 GMT", + "x-ms-client-request-id" : "60647338-764a-4e6c-a335-557471baab35", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacillegal081278067f66750b4f49e7b?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" : "4473c203-ec19-45a9-958a-c6eb59880d3c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca1182-301e-0042-3e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:57 GMT", + "x-ms-client-request-id" : "4473c203-ec19-45a9-958a-c6eb59880d3c" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseacillegal081278067f66750b4f49e7b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseacillegal[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseacillegal[1].json new file mode 100644 index 000000000000..3c0d6d5eec87 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseacillegal[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacillegal027062a0908044c10a419aa?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" : "f43e72ef-870c-4081-9ba5-fdd33be4c77a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D9B4EEBE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca1196-301e-0042-5149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:57 GMT", + "x-ms-client-request-id" : "f43e72ef-870c-4081-9ba5-fdd33be4c77a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcchangeleaseacillegal&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" : "08ff61fb-d5ba-4cd5-8222-cafacee3db41" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca11b8-301e-0042-6b49-67cbbf000000", + "Body" : "jtcchangeleaseacillegaljtcchangeleaseacillegal027062a0908044c10a419aaMon, 09 Sep 2019 20:03:58 GMT\"0x8D73560D9B4EEBE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:57 GMT", + "x-ms-client-request-id" : "08ff61fb-d5ba-4cd5-8222-cafacee3db41", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseacillegal027062a0908044c10a419aa?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" : "882976ba-1836-47a0-b51e-6fb2a67b805d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca11ce-301e-0042-8049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:57 GMT", + "x-ms-client-request-id" : "882976ba-1836-47a0-b51e-6fb2a67b805d" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseacillegal027062a0908044c10a419aa" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseerror.json new file mode 100644 index 000000000000..28f21f3e44bf --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleaseerror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseerror0containerapitestchangeleaseerror74e60203f?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" : "f6230f8f-08fc-49c5-a566-1a6ce84e783e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D9DB6972\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca11e0-301e-0042-1249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:57 GMT", + "x-ms-client-request-id" : "f6230f8f-08fc-49c5-a566-1a6ce84e783e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseerror1containerapitestchangeleaseerror74e79545f?comp=lease&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" : "2e10bd5b-7729-47d3-901c-1cdff73e501c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "c5ca11f1-301e-0042-2249-67cbbf000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:c5ca11f1-301e-0042-2249-67cbbf000000\nTime:2019-09-09T20:03:58.5182892Zx-ms-lease-idid", + "Date" : "Mon, 09 Sep 2019 20:03:57 GMT", + "x-ms-client-request-id" : "2e10bd5b-7729-47d3-901c-1cdff73e501c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcchangeleaseerror&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" : "a7e45415-2594-4a2e-9f0b-eb69318a76ef" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca1208-301e-0042-3949-67cbbf000000", + "Body" : "jtcchangeleaseerrorjtcchangeleaseerror0containerapitestchangeleaseerror74e60203fMon, 09 Sep 2019 20:03:58 GMT\"0x8D73560D9DB6972\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:57 GMT", + "x-ms-client-request-id" : "a7e45415-2594-4a2e-9f0b-eb69318a76ef", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleaseerror0containerapitestchangeleaseerror74e60203f?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" : "d87a9b68-e61b-49c5-b47c-c9c9ca6869cf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca121e-301e-0042-4e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:57 GMT", + "x-ms-client-request-id" : "d87a9b68-e61b-49c5-b47c-c9c9ca6869cf" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleaseerror0containerapitestchangeleaseerror74e60203f", "jtcchangeleaseerror1containerapitestchangeleaseerror74e79545f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleasemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleasemin.json new file mode 100644 index 000000000000..e58eed1f6a61 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestchangeleasemin.json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleasemin0containerapitestchangeleasemin7606406365c?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" : "2900ea9b-f604-46d6-b8f7-f9657de3e60c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D7BF2C0A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0e77-301e-0042-7049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:53 GMT", + "x-ms-client-request-id" : "2900ea9b-f604-46d6-b8f7-f9657de3e60c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleasemin0containerapitestchangeleasemin7606406365c?comp=lease&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" : "ccc5b8b5-0d61-4b6f-94b7-02dcb1cb503e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D7BF2C0A\"", + "x-ms-lease-id" : "f205c466-0035-466a-bc75-418d28dc48cb", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca0e8d-301e-0042-0349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:54 GMT", + "x-ms-client-request-id" : "ccc5b8b5-0d61-4b6f-94b7-02dcb1cb503e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleasemin0containerapitestchangeleasemin7606406365c?comp=lease&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" : "27952b83-dd21-4462-a41b-d2d9071dc329" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D7BF2C0A\"", + "x-ms-lease-id" : "b08d41e0-cc25-451a-b30f-6b4d857dc2b7", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca0eab-301e-0042-1e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:54 GMT", + "x-ms-client-request-id" : "27952b83-dd21-4462-a41b-d2d9071dc329" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcchangeleasemin&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" : "726e8b5b-dffb-47f8-906e-655530392be8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca0ecb-301e-0042-3949-67cbbf000000", + "Body" : "jtcchangeleaseminjtcchangeleasemin0containerapitestchangeleasemin7606406365cMon, 09 Sep 2019 20:03:54 GMT\"0x8D73560D7BF2C0A\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:54 GMT", + "x-ms-client-request-id" : "726e8b5b-dffb-47f8-906e-655530392be8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleasemin0containerapitestchangeleasemin7606406365c?comp=lease&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" : "22a1d1d0-9f5c-4b0b-af30-ee77edc82b07" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560D7BF2C0A\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca0ee1-301e-0042-4e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:54 GMT", + "x-ms-client-request-id" : "22a1d1d0-9f5c-4b0b-af30-ee77edc82b07" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcchangeleasemin0containerapitestchangeleasemin7606406365c?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" : "fc181132-cea6-47da-8366-4e231344b256" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca0ef5-301e-0042-6149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:54 GMT", + "x-ms-client-request-id" : "fc181132-cea6-47da-8366-4e231344b256" + }, + "Exception" : null + } ], + "variables" : [ "jtcchangeleasemin0containerapitestchangeleasemin7606406365c", "b08d41e0-cc25-451a-b30f-6b4d857dc2b7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateallnull.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateallnull.json new file mode 100644 index 000000000000..5a95b6a123b1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateallnull.json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateallnull0containerapitestcreateallnullc8b86266ef35?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" : "c5e03a9e-cc53-4feb-9a4c-aac41269f1b4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356044FDA348\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fede4-801e-001f-7049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:48 GMT", + "x-ms-client-request-id" : "c5e03a9e-cc53-4feb-9a4c-aac41269f1b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateallnull1containerapitestcreateallnullc8b417947d64?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" : "8a3c4313-2158-4d5a-a567-ffd79a133f7d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560450A4FC9\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fedf2-801e-001f-7b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:48 GMT", + "x-ms-client-request-id" : "8a3c4313-2158-4d5a-a567-ffd79a133f7d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateallnull&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" : "25c170f1-f8d3-4454-86fe-348a32779460" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fee01-801e-001f-0849-673bbb000000", + "Body" : "jtccreateallnulljtccreateallnull0containerapitestcreateallnullc8b86266ef35Mon, 09 Sep 2019 19:59:48 GMT\"0x8D7356044FDA348\"unlockedavailable$account-encryption-keyfalsefalsefalsejtccreateallnull1containerapitestcreateallnullc8b417947d64Mon, 09 Sep 2019 19:59:48 GMT\"0x8D73560450A4FC9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:48 GMT", + "x-ms-client-request-id" : "25c170f1-f8d3-4454-86fe-348a32779460", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateallnull0containerapitestcreateallnullc8b86266ef35?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" : "fe01407f-18af-41c9-86a2-ffd6a24d63da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fee16-801e-001f-1c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:48 GMT", + "x-ms-client-request-id" : "fe01407f-18af-41c9-86a2-ffd6a24d63da" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateallnull1containerapitestcreateallnullc8b417947d64?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" : "636ef2a2-6ec2-443b-9788-1ec2c67a5fda" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fee1e-801e-001f-2449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:48 GMT", + "x-ms-client-request-id" : "636ef2a2-6ec2-443b-9788-1ec2c67a5fda" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateallnull0containerapitestcreateallnullc8b86266ef35", "jtccreateallnull1containerapitestcreateallnullc8b417947d64" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateerror.json new file mode 100644 index 000000000000..97202ed1ea0a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateerror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateerror0containerapitestcreateerror5cd25875cc3086?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" : "b3a2c571-efc6-48d7-9af8-04a10db1809f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356047112D40\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff081-801e-001f-4b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:51 GMT", + "x-ms-client-request-id" : "b3a2c571-efc6-48d7-9af8-04a10db1809f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateerror0containerapitestcreateerror5cd25875cc3086?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" : "35c089a6-f861-4aec-a97e-6b5c563cdc86" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerAlreadyExists", + "retry-after" : "0", + "Content-Length" : "230", + "StatusCode" : "409", + "x-ms-request-id" : "077ff092-801e-001f-5b49-673bbb000000", + "Body" : "ContainerAlreadyExistsThe specified container already exists.\nRequestId:077ff092-801e-001f-5b49-673bbb000000\nTime:2019-09-09T19:59:52.2465684Z", + "Date" : "Mon, 09 Sep 2019 19:59:51 GMT", + "x-ms-client-request-id" : "35c089a6-f861-4aec-a97e-6b5c563cdc86", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateerror&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" : "2e40a3b0-67b3-4522-a1a3-d483f210f900" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff0a5-801e-001f-6b49-673bbb000000", + "Body" : "jtccreateerrorjtccreateerror0containerapitestcreateerror5cd25875cc3086Mon, 09 Sep 2019 19:59:52 GMT\"0x8D7356047112D40\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:51 GMT", + "x-ms-client-request-id" : "2e40a3b0-67b3-4522-a1a3-d483f210f900", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateerror0containerapitestcreateerror5cd25875cc3086?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" : "5078aad1-0382-498b-ab19-d40e398dc98a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff0af-801e-001f-7349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:51 GMT", + "x-ms-client-request-id" : "5078aad1-0382-498b-ab19-d40e398dc98a" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateerror0containerapitestcreateerror5cd25875cc3086" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatemetadata[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatemetadata[0].json new file mode 100644 index 000000000000..2f4e416d207c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatemetadata[0].json @@ -0,0 +1,132 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata0containerapitestcreatemetadata1cd99714255?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" : "af6e5265-a370-4648-b07c-56ca42b4f8fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604593962E\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fee93-801e-001f-0f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:49 GMT", + "x-ms-client-request-id" : "af6e5265-a370-4648-b07c-56ca42b4f8fc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata1containerapitestcreatemetadata1cd963008bf?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" : "a6bcb1bc-59c0-4b7e-b4e4-37a9e06425c1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356045A28D0E\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077feea6-801e-001f-2149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:49 GMT", + "x-ms-client-request-id" : "a6bcb1bc-59c0-4b7e-b4e4-37a9e06425c1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata1containerapitestcreatemetadata1cd963008bf?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" : "d317e7d4-354c-4d46-9c14-39147b8fd05d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:49 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:59:49 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D7356045A28D0E\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "077feeb3-801e-001f-2b49-673bbb000000", + "x-ms-client-request-id" : "d317e7d4-354c-4d46-9c14-39147b8fd05d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreatemetadata&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" : "e35085c3-cf2a-4127-98cd-392967148dcc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077feec7-801e-001f-3e49-673bbb000000", + "Body" : "jtccreatemetadatajtccreatemetadata0containerapitestcreatemetadata1cd99714255Mon, 09 Sep 2019 19:59:49 GMT\"0x8D735604593962E\"unlockedavailable$account-encryption-keyfalsefalsefalsejtccreatemetadata1containerapitestcreatemetadata1cd963008bfMon, 09 Sep 2019 19:59:49 GMT\"0x8D7356045A28D0E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:49 GMT", + "x-ms-client-request-id" : "e35085c3-cf2a-4127-98cd-392967148dcc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata0containerapitestcreatemetadata1cd99714255?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" : "55767707-50a9-41cc-ad84-9e6745bba0fe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077feed9-801e-001f-4e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:49 GMT", + "x-ms-client-request-id" : "55767707-50a9-41cc-ad84-9e6745bba0fe" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata1containerapitestcreatemetadata1cd963008bf?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" : "29493543-1412-41e9-80b1-b3e477a69ee9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077feeeb-801e-001f-5f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:49 GMT", + "x-ms-client-request-id" : "29493543-1412-41e9-80b1-b3e477a69ee9" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemetadata0containerapitestcreatemetadata1cd99714255", "jtccreatemetadata1containerapitestcreatemetadata1cd963008bf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatemetadata[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatemetadata[1].json new file mode 100644 index 000000000000..b0a46175f774 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatemetadata[1].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata0containerapitestcreatemetadatac0832482644?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" : "644819f6-1528-48a9-a56f-60f9c788e46d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356045E1EBA2\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077feef5-801e-001f-6849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:49 GMT", + "x-ms-client-request-id" : "644819f6-1528-48a9-a56f-60f9c788e46d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata1containerapitestcreatemetadatac0836828cf3?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" : "1a6e2037-2f54-4856-9b64-8001af8abccc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356045EE7113\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fef09-801e-001f-7a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:49 GMT", + "x-ms-client-request-id" : "1a6e2037-2f54-4856-9b64-8001af8abccc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata1containerapitestcreatemetadatac0836828cf3?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" : "90efd843-d9b3-4b16-81f1-f96cff9b43b2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:50 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:59:49 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-meta-foo" : "bar", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D7356045EE7113\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "077fef1c-801e-001f-0c49-673bbb000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "90efd843-d9b3-4b16-81f1-f96cff9b43b2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreatemetadata&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" : "e88b7852-96e4-40d4-b523-2b2226caeed0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fef29-801e-001f-1949-673bbb000000", + "Body" : "jtccreatemetadatajtccreatemetadata0containerapitestcreatemetadatac0832482644Mon, 09 Sep 2019 19:59:50 GMT\"0x8D7356045E1EBA2\"unlockedavailable$account-encryption-keyfalsefalsefalsejtccreatemetadata1containerapitestcreatemetadatac0836828cf3Mon, 09 Sep 2019 19:59:50 GMT\"0x8D7356045EE7113\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:49 GMT", + "x-ms-client-request-id" : "e88b7852-96e4-40d4-b523-2b2226caeed0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata0containerapitestcreatemetadatac0832482644?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" : "95535762-b6b7-45cb-8da6-73837a8a361f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fef3a-801e-001f-2a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:49 GMT", + "x-ms-client-request-id" : "95535762-b6b7-45cb-8da6-73837a8a361f" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata1containerapitestcreatemetadatac0836828cf3?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" : "d6c87947-d0d9-4633-b99d-3bc324a8bd00" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fef46-801e-001f-3449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:49 GMT", + "x-ms-client-request-id" : "d6c87947-d0d9-4633-b99d-3bc324a8bd00" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemetadata0containerapitestcreatemetadatac0832482644", "jtccreatemetadata1containerapitestcreatemetadatac0836828cf3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatemin.json new file mode 100644 index 000000000000..9c0978f675f6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatemin.json @@ -0,0 +1,132 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemin0containerapitestcreateminebf74211b8399c28?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" : "f60971fc-4ba4-46c4-98b9-2c7cdb1398ef" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560453D01E0\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fee32-801e-001f-3449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:48 GMT", + "x-ms-client-request-id" : "f60971fc-4ba4-46c4-98b9-2c7cdb1398ef" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemin1containerapitestcreateminebf23642ea6b214f?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" : "0d7aaf19-209e-46a3-9486-58118687af95" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356045519F0F\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fee43-801e-001f-4449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:48 GMT", + "x-ms-client-request-id" : "0d7aaf19-209e-46a3-9486-58118687af95" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemin1containerapitestcreateminebf23642ea6b214f?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" : "a80618a3-3076-4e4e-a421-ee72f2c192cd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:49 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:59:48 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D7356045519F0F\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "077fee4f-801e-001f-4e49-673bbb000000", + "x-ms-client-request-id" : "a80618a3-3076-4e4e-a421-ee72f2c192cd" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreatemin&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" : "42380faf-8b46-4859-adaf-3c042e024739" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fee5f-801e-001f-5e49-673bbb000000", + "Body" : "jtccreateminjtccreatemin0containerapitestcreateminebf74211b8399c28Mon, 09 Sep 2019 19:59:49 GMT\"0x8D73560453D01E0\"unlockedavailable$account-encryption-keyfalsefalsefalsejtccreatemin1containerapitestcreateminebf23642ea6b214fMon, 09 Sep 2019 19:59:49 GMT\"0x8D7356045519F0F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:48 GMT", + "x-ms-client-request-id" : "42380faf-8b46-4859-adaf-3c042e024739", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemin0containerapitestcreateminebf74211b8399c28?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" : "a20f9afa-4baa-4869-8a7e-a6b2fc785540" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fee6e-801e-001f-6b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:48 GMT", + "x-ms-client-request-id" : "a20f9afa-4baa-4869-8a7e-a6b2fc785540" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemin1containerapitestcreateminebf23642ea6b214f?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" : "0e32cc50-9d13-4d8b-a5f3-1c3b9c0a4c01" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fee79-801e-001f-7649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:48 GMT", + "x-ms-client-request-id" : "0e32cc50-9d13-4d8b-a5f3-1c3b9c0a4c01" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemin0containerapitestcreateminebf74211b8399c28", "jtccreatemin1containerapitestcreateminebf23642ea6b214f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatepublicaccess[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatepublicaccess[0].json new file mode 100644 index 000000000000..e5f89e5b08a1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatepublicaccess[0].json @@ -0,0 +1,133 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatepublicaccess090419512c2eae8414409ca1?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" : "207c003d-bf74-423d-9bb6-dec6dfe680d9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560462EBA36\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fef56-801e-001f-4149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:50 GMT", + "x-ms-client-request-id" : "207c003d-bf74-423d-9bb6-dec6dfe680d9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatepublicaccess124818bcea35527df64a5dbb?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" : "85e48861-3aca-437a-bf49-7700049d9467" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560463BB4E7\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fef68-801e-001f-4f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:50 GMT", + "x-ms-client-request-id" : "85e48861-3aca-437a-bf49-7700049d9467" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatepublicaccess124818bcea35527df64a5dbb?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" : "04c70be4-e782-4a06-a8ed-28ee80960aae" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:50 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:59:50 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D73560463BB4E7\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-blob-public-access" : "blob", + "x-ms-request-id" : "077fef72-801e-001f-5749-673bbb000000", + "x-ms-client-request-id" : "04c70be4-e782-4a06-a8ed-28ee80960aae" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreatepublicaccess&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" : "a5fb8da6-823d-4e8f-af0f-e53c6d0ef2d0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fef80-801e-001f-6549-673bbb000000", + "Body" : "jtccreatepublicaccessjtccreatepublicaccess090419512c2eae8414409ca1Mon, 09 Sep 2019 19:59:50 GMT\"0x8D73560462EBA36\"unlockedavailable$account-encryption-keyfalsefalsefalsejtccreatepublicaccess124818bcea35527df64a5dbbMon, 09 Sep 2019 19:59:50 GMT\"0x8D73560463BB4E7\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:50 GMT", + "x-ms-client-request-id" : "a5fb8da6-823d-4e8f-af0f-e53c6d0ef2d0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatepublicaccess090419512c2eae8414409ca1?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" : "f7b334a4-8472-42da-8802-7d2ebbe69a5e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fef92-801e-001f-7549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:50 GMT", + "x-ms-client-request-id" : "f7b334a4-8472-42da-8802-7d2ebbe69a5e" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatepublicaccess124818bcea35527df64a5dbb?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" : "1d401244-a839-4a95-be59-a75b136d6200" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fefa5-801e-001f-0549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:50 GMT", + "x-ms-client-request-id" : "1d401244-a839-4a95-be59-a75b136d6200" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatepublicaccess090419512c2eae8414409ca1", "jtccreatepublicaccess124818bcea35527df64a5dbb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatepublicaccess[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatepublicaccess[1].json new file mode 100644 index 000000000000..ab75f715fef9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatepublicaccess[1].json @@ -0,0 +1,133 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatepublicaccess02972562f63058feec4a5e98?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" : "01eb147f-5454-4a22-b03f-31eb30bbdae2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560467B3A76\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fefb8-801e-001f-1649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:50 GMT", + "x-ms-client-request-id" : "01eb147f-5454-4a22-b03f-31eb30bbdae2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatepublicaccess15380438c3b75f96094543a3?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" : "8b199107-c143-4e88-832b-c9b570370c56" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560468798C9\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fefcb-801e-001f-2849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:50 GMT", + "x-ms-client-request-id" : "8b199107-c143-4e88-832b-c9b570370c56" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatepublicaccess15380438c3b75f96094543a3?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" : "107faabf-ad05-4a45-9261-9534f66b3700" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:51 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:59:50 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D73560468798C9\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-blob-public-access" : "container", + "x-ms-request-id" : "077fefd8-801e-001f-3449-673bbb000000", + "x-ms-client-request-id" : "107faabf-ad05-4a45-9261-9534f66b3700" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreatepublicaccess&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" : "b28aca6a-553c-4545-a0b3-58235210f387" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fefe5-801e-001f-4149-673bbb000000", + "Body" : "jtccreatepublicaccessjtccreatepublicaccess02972562f63058feec4a5e98Mon, 09 Sep 2019 19:59:51 GMT\"0x8D73560467B3A76\"unlockedavailable$account-encryption-keyfalsefalsefalsejtccreatepublicaccess15380438c3b75f96094543a3Mon, 09 Sep 2019 19:59:51 GMT\"0x8D73560468798C9\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:50 GMT", + "x-ms-client-request-id" : "b28aca6a-553c-4545-a0b3-58235210f387", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatepublicaccess02972562f63058feec4a5e98?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" : "ce6554a3-6232-48ea-b5fd-9a98647dd09d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077feffa-801e-001f-5249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:50 GMT", + "x-ms-client-request-id" : "ce6554a3-6232-48ea-b5fd-9a98647dd09d" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatepublicaccess15380438c3b75f96094543a3?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" : "81189026-4e69-4d7e-9220-c7e7f265fd12" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff00f-801e-001f-6649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:50 GMT", + "x-ms-client-request-id" : "81189026-4e69-4d7e-9220-c7e7f265fd12" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatepublicaccess02972562f63058feec4a5e98", "jtccreatepublicaccess15380438c3b75f96094543a3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatepublicaccess[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatepublicaccess[2].json new file mode 100644 index 000000000000..8a58338247a4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreatepublicaccess[2].json @@ -0,0 +1,132 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatepublicaccess074617adfad8c5f6044fa3b2?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" : "48545107-fb57-4fed-8ce2-c59e1f5ac493" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356046C76C88\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff029-801e-001f-7c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:51 GMT", + "x-ms-client-request-id" : "48545107-fb57-4fed-8ce2-c59e1f5ac493" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatepublicaccess1420899c7e762a55054b9da4?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" : "76017318-e333-4c2f-8665-92c16d90800c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356046D3F1F4\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff038-801e-001f-0949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:51 GMT", + "x-ms-client-request-id" : "76017318-e333-4c2f-8665-92c16d90800c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatepublicaccess1420899c7e762a55054b9da4?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" : "b35804bb-9211-43f4-830a-0de1ddfd454c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:51 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:59:51 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D7356046D3F1F4\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "077ff046-801e-001f-1549-673bbb000000", + "x-ms-client-request-id" : "b35804bb-9211-43f4-830a-0de1ddfd454c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreatepublicaccess&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" : "8d72aa93-d221-434e-a16e-f9975262cd9e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff055-801e-001f-2449-673bbb000000", + "Body" : "jtccreatepublicaccessjtccreatepublicaccess074617adfad8c5f6044fa3b2Mon, 09 Sep 2019 19:59:51 GMT\"0x8D7356046C76C88\"unlockedavailable$account-encryption-keyfalsefalsefalsejtccreatepublicaccess1420899c7e762a55054b9da4Mon, 09 Sep 2019 19:59:51 GMT\"0x8D7356046D3F1F4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:51 GMT", + "x-ms-client-request-id" : "8d72aa93-d221-434e-a16e-f9975262cd9e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatepublicaccess074617adfad8c5f6044fa3b2?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" : "ccdfaec7-7c26-415f-b3f8-c3581979a87a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff062-801e-001f-2f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:51 GMT", + "x-ms-client-request-id" : "ccdfaec7-7c26-415f-b3f8-c3581979a87a" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatepublicaccess1420899c7e762a55054b9da4?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" : "b8c0aab2-2469-4b4b-ae2f-2ba98c0d8e43" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff074-801e-001f-3f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:51 GMT", + "x-ms-client-request-id" : "b8c0aab2-2469-4b4b-ae2f-2ba98c0d8e43" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatepublicaccess074617adfad8c5f6044fa3b2", "jtccreatepublicaccess1420899c7e762a55054b9da4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateurlspecialchars[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateurlspecialchars[0].json new file mode 100644 index 000000000000..f071997e5d1a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateurlspecialchars[0].json @@ -0,0 +1,187 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateurlspecialchars0696289cb9db1a177f45a5?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" : "a74bd8ef-e271-44ac-a474-b57b8778ea79" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DA0CE2B3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca1230-301e-0042-5d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:57 GMT", + "x-ms-client-request-id" : "a74bd8ef-e271-44ac-a474-b57b8778ea79" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateurlspecialchars0696289cb9db1a177f45a5/az[]", + "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" : "05be525c-2480-4fe1-80c9-7cb952fb8241" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DA19D840\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca1244-301e-0042-6e49-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:03:57 GMT", + "x-ms-client-request-id" : "05be525c-2480-4fe1-80c9-7cb952fb8241" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateurlspecialchars0696289cb9db1a177f45a5/az[]", + "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" : "dfb1c5cc-82fd-4457-999d-256944c83232" + }, + "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", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:03:57 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560DA19D840\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:03:58 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca1250-301e-0042-7949-67cbbf000000", + "x-ms-client-request-id" : "dfb1c5cc-82fd-4457-999d-256944c83232", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateurlspecialchars0696289cb9db1a177f45a5/az[]2", + "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" : "5821d11a-fd50-449b-bb76-e7393fbab944" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DA333142\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca1262-301e-0042-0b49-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:03:58 GMT", + "x-ms-client-request-id" : "5821d11a-fd50-449b-bb76-e7393fbab944" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateurlspecialchars0696289cb9db1a177f45a5/az[]3", + "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" : "8b42f835-9b3b-4d14-b2df-c3968eb33ddd", + "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 20:03:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:03:58 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560DA47A757\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca1282-301e-0042-2a49-67cbbf000000", + "x-ms-client-request-id" : "8b42f835-9b3b-4d14-b2df-c3968eb33ddd" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateurlspecialchars0696289cb9db1a177f45a5?include=&restype=container&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" : "e06d7237-f382-4269-a6b8-e32992514d02" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca1297-301e-0042-3d49-67cbbf000000", + "Body" : "az[]Mon, 09 Sep 2019 20:03:58 GMTMon, 09 Sep 2019 20:03:58 GMT0x8D73560DA19D8400application/octet-streamAppendBlobHottrueunlockedavailabletrue0az[]2Mon, 09 Sep 2019 20:03:59 GMTMon, 09 Sep 2019 20:03:59 GMT0x8D73560DA333142512application/octet-stream0PageBlobHottrueunlockedavailabletrue0az[]3Mon, 09 Sep 2019 20:03:59 GMTMon, 09 Sep 2019 20:03:59 GMT0x8D73560DA47A7577application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:03:58 GMT", + "x-ms-client-request-id" : "e06d7237-f382-4269-a6b8-e32992514d02", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateurlspecialchars&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" : "cef1c953-012a-4ba8-9480-d3a5ebf12d9c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca12a9-301e-0042-4f49-67cbbf000000", + "Body" : "jtccreateurlspecialcharsjtccreateurlspecialchars0696289cb9db1a177f45a5Mon, 09 Sep 2019 20:03:58 GMT\"0x8D73560DA0CE2B3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:58 GMT", + "x-ms-client-request-id" : "cef1c953-012a-4ba8-9480-d3a5ebf12d9c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateurlspecialchars0696289cb9db1a177f45a5?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" : "e87a14d0-5cbd-45cc-a91c-3bfb8c4ca851" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca12be-301e-0042-6349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:58 GMT", + "x-ms-client-request-id" : "e87a14d0-5cbd-45cc-a91c-3bfb8c4ca851" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateurlspecialchars0696289cb9db1a177f45a5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateurlspecialchars[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateurlspecialchars[1].json new file mode 100644 index 000000000000..90bd62e4f89e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateurlspecialchars[1].json @@ -0,0 +1,187 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateurlspecialchars061315331c6c97f5a5449f?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" : "0bce1382-52c9-4c17-aed8-3920b181c82d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DA87803B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca12e4-301e-0042-0649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:58 GMT", + "x-ms-client-request-id" : "0bce1382-52c9-4c17-aed8-3920b181c82d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateurlspecialchars061315331c6c97f5a5449f/hello/world", + "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" : "c5c15f2d-1217-4d9f-99de-dffc6b4b695c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DA94C3F9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca12f6-301e-0042-1749-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:03:58 GMT", + "x-ms-client-request-id" : "c5c15f2d-1217-4d9f-99de-dffc6b4b695c" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateurlspecialchars061315331c6c97f5a5449f/hello/world", + "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" : "f4149b59-be08-4fb0-b705-b73ee544511a" + }, + "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", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:59 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:03:58 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560DA94C3F9\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:03:59 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca130c-301e-0042-2b49-67cbbf000000", + "x-ms-client-request-id" : "f4149b59-be08-4fb0-b705-b73ee544511a", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateurlspecialchars061315331c6c97f5a5449f/hello/world2", + "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" : "5dceb43e-a251-4578-9a82-76ecb2309e22" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DAADF5D8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca1325-301e-0042-4449-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:03:58 GMT", + "x-ms-client-request-id" : "5dceb43e-a251-4578-9a82-76ecb2309e22" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateurlspecialchars061315331c6c97f5a5449f/hello/world3", + "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" : "8f59eab7-4ae4-4152-8c0a-12bcf1fa02f0", + "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 20:03:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:03:58 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560DABBB3FD\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca133b-301e-0042-5949-67cbbf000000", + "x-ms-client-request-id" : "8f59eab7-4ae4-4152-8c0a-12bcf1fa02f0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateurlspecialchars061315331c6c97f5a5449f?include=&restype=container&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" : "713b09bd-13e6-43ab-96f0-caff07eba284" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca134f-301e-0042-6d49-67cbbf000000", + "Body" : "hello/worldMon, 09 Sep 2019 20:03:59 GMTMon, 09 Sep 2019 20:03:59 GMT0x8D73560DA94C3F90application/octet-streamAppendBlobHottrueunlockedavailabletrue0hello/world2Mon, 09 Sep 2019 20:03:59 GMTMon, 09 Sep 2019 20:03:59 GMT0x8D73560DAADF5D8512application/octet-stream0PageBlobHottrueunlockedavailabletrue0hello/world3Mon, 09 Sep 2019 20:03:59 GMTMon, 09 Sep 2019 20:03:59 GMT0x8D73560DABBB3FD7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:03:59 GMT", + "x-ms-client-request-id" : "713b09bd-13e6-43ab-96f0-caff07eba284", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateurlspecialchars&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" : "4e96ca71-e378-43d6-afbe-df5fc05cc6c9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca136d-301e-0042-0a49-67cbbf000000", + "Body" : "jtccreateurlspecialcharsjtccreateurlspecialchars061315331c6c97f5a5449fMon, 09 Sep 2019 20:03:59 GMT\"0x8D73560DA87803B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:59 GMT", + "x-ms-client-request-id" : "4e96ca71-e378-43d6-afbe-df5fc05cc6c9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateurlspecialchars061315331c6c97f5a5449f?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" : "a7f26914-eef0-4e43-95e3-09e23dd58a6a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca137f-301e-0042-1a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:59 GMT", + "x-ms-client-request-id" : "a7f26914-eef0-4e43-95e3-09e23dd58a6a" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateurlspecialchars061315331c6c97f5a5449f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateurlspecialchars[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateurlspecialchars[2].json new file mode 100644 index 000000000000..a74d2c33468a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestcreateurlspecialchars[2].json @@ -0,0 +1,187 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateurlspecialchars022019b0dc896713ba4d34?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" : "7da9d437-2774-4562-a681-fb979cbde1a2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DAFBDB16\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca1390-301e-0042-2849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:59 GMT", + "x-ms-client-request-id" : "7da9d437-2774-4562-a681-fb979cbde1a2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateurlspecialchars022019b0dc896713ba4d34/hello&world", + "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" : "e8afc826-4ded-4ac4-85fd-d58c2045d9b3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DB09BB1C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca13a4-301e-0042-3749-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:03:59 GMT", + "x-ms-client-request-id" : "e8afc826-4ded-4ac4-85fd-d58c2045d9b3" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateurlspecialchars022019b0dc896713ba4d34/hello&world", + "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" : "bb34ad7a-126b-4ca4-82d6-091f776220f5" + }, + "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", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:00 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:03:59 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560DB09BB1C\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:00 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca13b3-301e-0042-4649-67cbbf000000", + "x-ms-client-request-id" : "bb34ad7a-126b-4ca4-82d6-091f776220f5", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateurlspecialchars022019b0dc896713ba4d34/hello&world2", + "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" : "52566cc5-d9ca-45e2-adc9-ccd8551f2116" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DB2473EC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca13c4-301e-0042-5749-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:03:59 GMT", + "x-ms-client-request-id" : "52566cc5-d9ca-45e2-adc9-ccd8551f2116" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateurlspecialchars022019b0dc896713ba4d34/hello&world3", + "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" : "c105b96a-9c11-4812-ad3d-8eafb36d24be", + "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 20:04:00 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:03:59 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560DB325926\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca13e0-301e-0042-7249-67cbbf000000", + "x-ms-client-request-id" : "c105b96a-9c11-4812-ad3d-8eafb36d24be" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateurlspecialchars022019b0dc896713ba4d34?include=&restype=container&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" : "6940dd1b-468a-4b9a-8a62-e8c2b8961ad5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca13f8-301e-0042-0649-67cbbf000000", + "Body" : "hello&worldMon, 09 Sep 2019 20:04:00 GMTMon, 09 Sep 2019 20:04:00 GMT0x8D73560DB09BB1C0application/octet-streamAppendBlobHottrueunlockedavailabletrue0hello&world2Mon, 09 Sep 2019 20:04:00 GMTMon, 09 Sep 2019 20:04:00 GMT0x8D73560DB2473EC512application/octet-stream0PageBlobHottrueunlockedavailabletrue0hello&world3Mon, 09 Sep 2019 20:04:00 GMTMon, 09 Sep 2019 20:04:00 GMT0x8D73560DB3259267application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:03:59 GMT", + "x-ms-client-request-id" : "6940dd1b-468a-4b9a-8a62-e8c2b8961ad5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateurlspecialchars&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" : "90bd15a7-7149-40d4-b385-75ec7937ab27" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca1423-301e-0042-2d49-67cbbf000000", + "Body" : "jtccreateurlspecialcharsjtccreateurlspecialchars022019b0dc896713ba4d34Mon, 09 Sep 2019 20:04:00 GMT\"0x8D73560DAFBDB16\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:59 GMT", + "x-ms-client-request-id" : "90bd15a7-7149-40d4-b385-75ec7937ab27", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateurlspecialchars022019b0dc896713ba4d34?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" : "71c0b9b5-e526-496b-91fc-776520f2dbf8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca1444-301e-0042-4c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:00 GMT", + "x-ms-client-request-id" : "71c0b9b5-e526-496b-91fc-776520f2dbf8" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateurlspecialchars022019b0dc896713ba4d34" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdelete.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdelete.json new file mode 100644 index 000000000000..4e357f2f0f2c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdelete.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdelete0containerapitestdeletec3a65452467f047dd17?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" : "525e60c3-1f63-4ecf-a8a7-8a22e6de479e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604FA4F69A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff9bf-801e-001f-2149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:05 GMT", + "x-ms-client-request-id" : "525e60c3-1f63-4ecf-a8a7-8a22e6de479e" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdelete0containerapitestdeletec3a65452467f047dd17?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" : "a73ff055-193b-4e78-b510-6caaaf67b084" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff9cc-801e-001f-2d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:05 GMT", + "x-ms-client-request-id" : "a73ff055-193b-4e78-b510-6caaaf67b084" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdelete&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" : "b2f78030-86b0-45fc-88da-075aa27010c0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff9d7-801e-001f-3849-673bbb000000", + "Body" : "jtcdelete", + "Date" : "Mon, 09 Sep 2019 20:00:06 GMT", + "x-ms-client-request-id" : "b2f78030-86b0-45fc-88da-075aa27010c0", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "jtcdelete0containerapitestdeletec3a65452467f047dd17" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteac[0].json new file mode 100644 index 000000000000..685915f4baa4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteac[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0containerapitestdeleteac4c107464d3c62b567?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" : "b53868e7-1f45-457a-8dc2-d4d99ac60105" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604FFBD90D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ffa4a-801e-001f-2349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:06 GMT", + "x-ms-client-request-id" : "b53868e7-1f45-457a-8dc2-d4d99ac60105" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0containerapitestdeleteac4c107464d3c62b567?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" : "5e997433-84dc-4775-ac22-099a1f21aaaf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ffa60-801e-001f-3649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:06 GMT", + "x-ms-client-request-id" : "5e997433-84dc-4775-ac22-099a1f21aaaf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeleteac&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" : "859d990d-d414-43bf-a35a-dd023877f8f0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ffa8a-801e-001f-5e49-673bbb000000", + "Body" : "jtcdeleteac", + "Date" : "Mon, 09 Sep 2019 20:00:06 GMT", + "x-ms-client-request-id" : "859d990d-d414-43bf-a35a-dd023877f8f0", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0containerapitestdeleteac4c107464d3c62b567" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteac[1].json new file mode 100644 index 000000000000..e82bbf2f03dc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteac[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0containerapitestdeleteac43439572ff1085f9f?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" : "c33a1347-6983-4cc8-85d5-d30ebcb7ef89" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560502428F6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ffaba-801e-001f-0e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:06 GMT", + "x-ms-client-request-id" : "c33a1347-6983-4cc8-85d5-d30ebcb7ef89" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0containerapitestdeleteac43439572ff1085f9f?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" : "1357864e-5c51-4048-ba1d-b802fb5cf814" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ffadc-801e-001f-2e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:06 GMT", + "x-ms-client-request-id" : "1357864e-5c51-4048-ba1d-b802fb5cf814" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeleteac&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" : "4ecef6db-c830-4a31-a546-1c4a79c75492" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ffae6-801e-001f-3649-673bbb000000", + "Body" : "jtcdeleteac", + "Date" : "Mon, 09 Sep 2019 20:00:06 GMT", + "x-ms-client-request-id" : "4ecef6db-c830-4a31-a546-1c4a79c75492", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0containerapitestdeleteac43439572ff1085f9f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteac[2].json new file mode 100644 index 000000000000..ecee24c55c3f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteac[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0containerapitestdeleteacb1799896042a7f7c7?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" : "dfd04561-3dce-410a-b041-480a0cf6bcd0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560504ACAE2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ffafb-801e-001f-4b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:06 GMT", + "x-ms-client-request-id" : "dfd04561-3dce-410a-b041-480a0cf6bcd0" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0containerapitestdeleteacb1799896042a7f7c7?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" : "418728c8-bd11-4824-b1f5-1f07505c79ac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ffb1c-801e-001f-6449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:07 GMT", + "x-ms-client-request-id" : "418728c8-bd11-4824-b1f5-1f07505c79ac" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeleteac&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" : "29feb217-4d37-45f0-9d8b-368aeae6148b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ffb2f-801e-001f-7449-673bbb000000", + "Body" : "jtcdeleteac", + "Date" : "Mon, 09 Sep 2019 20:00:07 GMT", + "x-ms-client-request-id" : "29feb217-4d37-45f0-9d8b-368aeae6148b", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0containerapitestdeleteacb1799896042a7f7c7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteac[3].json new file mode 100644 index 000000000000..9dd6ea0c1c6b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteac[3].json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0containerapitestdeleteac5b574644158ec3c6c?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" : "be14be08-d6fc-4660-90b9-c8066a65f74b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735605071BAF8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ffb4c-801e-001f-1049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:07 GMT", + "x-ms-client-request-id" : "be14be08-d6fc-4660-90b9-c8066a65f74b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0containerapitestdeleteac5b574644158ec3c6c?comp=lease&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" : "16ac86c5-7104-49d7-9825-54da9d46453d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735605071BAF8\"", + "x-ms-lease-id" : "0d191d9e-4bb8-4374-9ce1-81b4d11ecf1b", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ffb59-801e-001f-1c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:07 GMT", + "x-ms-client-request-id" : "16ac86c5-7104-49d7-9825-54da9d46453d" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteac0containerapitestdeleteac5b574644158ec3c6c?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" : "105cc34d-61e3-4a3c-bb51-5cb686549606" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ffb67-801e-001f-2849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:07 GMT", + "x-ms-client-request-id" : "105cc34d-61e3-4a3c-bb51-5cb686549606" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeleteac&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" : "cab04d43-fd43-4c80-8f97-57ca95220b73" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ffb72-801e-001f-3349-673bbb000000", + "Body" : "jtcdeleteac", + "Date" : "Mon, 09 Sep 2019 20:00:07 GMT", + "x-ms-client-request-id" : "cab04d43-fd43-4c80-8f97-57ca95220b73", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteac0containerapitestdeleteac5b574644158ec3c6c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacfail[0].json new file mode 100644 index 000000000000..4c07b5d69960 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacfail[0].json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfail7374558536d79?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" : "5edd40b6-7573-4d9b-8b17-d3e918ec1104" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356050A5F3F5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ffb81-801e-001f-4249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:07 GMT", + "x-ms-client-request-id" : "5edd40b6-7573-4d9b-8b17-d3e918ec1104" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfail7374558536d79?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" : "02680e02-e46e-4d0c-a226-358205378714" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "077ffb92-801e-001f-5049-673bbb000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:077ffb92-801e-001f-5049-673bbb000000\nTime:2019-09-09T20:00:08.3230839Z", + "Date" : "Mon, 09 Sep 2019 20:00:07 GMT", + "x-ms-client-request-id" : "02680e02-e46e-4d0c-a226-358205378714", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeleteacfail&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" : "f4cd5d49-ac3c-4298-8b20-ab801a64d87e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ffba1-801e-001f-5b49-673bbb000000", + "Body" : "jtcdeleteacfailjtcdeleteacfail0containerapitestdeleteacfail7374558536d79Mon, 09 Sep 2019 20:00:08 GMT\"0x8D7356050A5F3F5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:07 GMT", + "x-ms-client-request-id" : "f4cd5d49-ac3c-4298-8b20-ab801a64d87e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfail7374558536d79?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" : "1811a6cf-d8a0-460d-b920-8e4f891558f8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ffbae-801e-001f-6449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:07 GMT", + "x-ms-client-request-id" : "1811a6cf-d8a0-460d-b920-8e4f891558f8" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacfail0containerapitestdeleteacfail7374558536d79" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacfail[1].json new file mode 100644 index 000000000000..de315ab0da40 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacfail[1].json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfail8e1716512ebed?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" : "6fead180-e9ab-4f19-afa8-3535439a2e8a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356050D8A602\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ffbb8-801e-001f-6e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:07 GMT", + "x-ms-client-request-id" : "6fead180-e9ab-4f19-afa8-3535439a2e8a" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfail8e1716512ebed?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" : "205c8826-5542-40d4-989f-d5311ab416ae" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "077ffbc8-801e-001f-7d49-673bbb000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:077ffbc8-801e-001f-7d49-673bbb000000\nTime:2019-09-09T20:00:08.6543211Z", + "Date" : "Mon, 09 Sep 2019 20:00:07 GMT", + "x-ms-client-request-id" : "205c8826-5542-40d4-989f-d5311ab416ae", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeleteacfail&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" : "a4bac006-abf3-4424-a460-5255f992c485" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ffbd3-801e-001f-0649-673bbb000000", + "Body" : "jtcdeleteacfailjtcdeleteacfail0containerapitestdeleteacfail8e1716512ebedMon, 09 Sep 2019 20:00:08 GMT\"0x8D7356050D8A602\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:08 GMT", + "x-ms-client-request-id" : "a4bac006-abf3-4424-a460-5255f992c485", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfail8e1716512ebed?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" : "5546846b-d75f-4d51-ba2f-ccba8b366b31" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ffbe2-801e-001f-1549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:08 GMT", + "x-ms-client-request-id" : "5546846b-d75f-4d51-ba2f-ccba8b366b31" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacfail0containerapitestdeleteacfail8e1716512ebed" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacfail[2].json new file mode 100644 index 000000000000..5c2ba799e505 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacfail[2].json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfail7c690890f9942?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" : "dc6903c4-423d-4e70-8b84-8fb81cec2b62" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560510ABBB7\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ffbf1-801e-001f-2349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:08 GMT", + "x-ms-client-request-id" : "dc6903c4-423d-4e70-8b84-8fb81cec2b62" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfail7c690890f9942?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" : "d1d981f0-201b-4f4a-a9cc-30e671208efa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseNotPresentWithContainerOperation", + "retry-after" : "0", + "Content-Length" : "251", + "StatusCode" : "412", + "x-ms-request-id" : "077ffbf8-801e-001f-2949-673bbb000000", + "Body" : "LeaseNotPresentWithContainerOperationThere is currently no lease on the container.\nRequestId:077ffbf8-801e-001f-2949-673bbb000000\nTime:2019-09-09T20:00:08.9825572Z", + "Date" : "Mon, 09 Sep 2019 20:00:08 GMT", + "x-ms-client-request-id" : "d1d981f0-201b-4f4a-a9cc-30e671208efa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeleteacfail&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" : "184a4c47-ab10-48ec-939b-73ee9b95c4d2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ffc01-801e-001f-3049-673bbb000000", + "Body" : "jtcdeleteacfailjtcdeleteacfail0containerapitestdeleteacfail7c690890f9942Mon, 09 Sep 2019 20:00:08 GMT\"0x8D73560510ABBB7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:08 GMT", + "x-ms-client-request-id" : "184a4c47-ab10-48ec-939b-73ee9b95c4d2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacfail0containerapitestdeleteacfail7c690890f9942?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" : "987060e8-eace-451b-9df8-0b41bfd861e4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ffc0a-801e-001f-3949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:08 GMT", + "x-ms-client-request-id" : "987060e8-eace-451b-9df8-0b41bfd861e4" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacfail0containerapitestdeleteacfail7c690890f9942" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacillegal[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacillegal[0].json new file mode 100644 index 000000000000..05a7875787fb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacillegal[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacillegal0containerapitestdeleteacillegale567538897?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" : "3e5bd3f8-9282-40ee-9fa2-3e9d79c9b854" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560513C5C2C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ffc11-801e-001f-4049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:08 GMT", + "x-ms-client-request-id" : "3e5bd3f8-9282-40ee-9fa2-3e9d79c9b854" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeleteacillegal&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" : "bb14ba23-9b65-4699-9618-cd2b5d01ff1f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ffc21-801e-001f-4c49-673bbb000000", + "Body" : "jtcdeleteacillegaljtcdeleteacillegal0containerapitestdeleteacillegale567538897Mon, 09 Sep 2019 20:00:09 GMT\"0x8D73560513C5C2C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:08 GMT", + "x-ms-client-request-id" : "bb14ba23-9b65-4699-9618-cd2b5d01ff1f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacillegal0containerapitestdeleteacillegale567538897?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" : "489eed73-387d-4076-9e3b-84038feb4df3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ffc27-801e-001f-5249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:08 GMT", + "x-ms-client-request-id" : "489eed73-387d-4076-9e3b-84038feb4df3" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacillegal0containerapitestdeleteacillegale567538897" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacillegal[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacillegal[1].json new file mode 100644 index 000000000000..e23a8354c7ff --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteacillegal[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacillegal0containerapitestdeleteacillegalca18404880?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" : "3e37c30d-0677-4fc8-9c94-bcab6efe3411" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735605162FE0B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ffc35-801e-001f-6049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:08 GMT", + "x-ms-client-request-id" : "3e37c30d-0677-4fc8-9c94-bcab6efe3411" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeleteacillegal&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" : "6cf3f598-f1df-43ad-9470-4b2705a504b6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ffc41-801e-001f-6b49-673bbb000000", + "Body" : "jtcdeleteacillegaljtcdeleteacillegal0containerapitestdeleteacillegalca18404880Mon, 09 Sep 2019 20:00:09 GMT\"0x8D735605162FE0B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:08 GMT", + "x-ms-client-request-id" : "6cf3f598-f1df-43ad-9470-4b2705a504b6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteacillegal0containerapitestdeleteacillegalca18404880?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" : "e1ecb5fe-7919-496b-8603-83de0f58931f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ffc48-801e-001f-7249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:08 GMT", + "x-ms-client-request-id" : "e1ecb5fe-7919-496b-8603-83de0f58931f" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteacillegal0containerapitestdeleteacillegalca18404880" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteerror.json new file mode 100644 index 000000000000..823ad7af1ac0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeleteerror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteerror0containerapitestdeleteerror11e65936e1013e?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" : "db42320a-5706-41b6-a6a0-94db3de08874" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560518A3C54\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ffc59-801e-001f-0149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:09 GMT", + "x-ms-client-request-id" : "db42320a-5706-41b6-a6a0-94db3de08874" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteerror1containerapitestdeleteerror11e89948ac9730?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" : "ca36f59d-28db-4668-980e-7d9cb51779c4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "077ffc60-801e-001f-0749-673bbb000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:077ffc60-801e-001f-0749-673bbb000000\nTime:2019-09-09T20:00:09.8221598Z", + "Date" : "Mon, 09 Sep 2019 20:00:09 GMT", + "x-ms-client-request-id" : "ca36f59d-28db-4668-980e-7d9cb51779c4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeleteerror&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" : "b8dc4096-a1d1-4243-9e54-65e01339f348" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ffc67-801e-001f-0d49-673bbb000000", + "Body" : "jtcdeleteerrorjtcdeleteerror0containerapitestdeleteerror11e65936e1013eMon, 09 Sep 2019 20:00:09 GMT\"0x8D73560518A3C54\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:09 GMT", + "x-ms-client-request-id" : "b8dc4096-a1d1-4243-9e54-65e01339f348", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeleteerror0containerapitestdeleteerror11e65936e1013e?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" : "efe51da0-e7c1-4889-9c8e-0b45ac063502" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ffc70-801e-001f-1649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:09 GMT", + "x-ms-client-request-id" : "efe51da0-e7c1-4889-9c8e-0b45ac063502" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeleteerror0containerapitestdeleteerror11e65936e1013e", "jtcdeleteerror1containerapitestdeleteerror11e89948ac9730" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeletemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeletemin.json new file mode 100644 index 000000000000..4d059b88f93b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestdeletemin.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeletemin0containerapitestdeletemince4726982bd27527?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" : "dd807f6a-1d65-4991-ae06-2221b3c84625" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604FCA38A3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff9f0-801e-001f-4c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:06 GMT", + "x-ms-client-request-id" : "dd807f6a-1d65-4991-ae06-2221b3c84625" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeletemin0containerapitestdeletemince4726982bd27527?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" : "77b485cb-c9e1-44f8-9de7-62744ac4edeb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ffa03-801e-001f-5e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:06 GMT", + "x-ms-client-request-id" : "77b485cb-c9e1-44f8-9de7-62744ac4edeb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcdeletemin0containerapitestdeletemince4726982bd27527?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" : "e46369d4-52a4-4a1e-a7f4-58889fb8e28b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "077ffa08-801e-001f-6349-673bbb000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:077ffa08-801e-001f-6349-673bbb000000\nTime:2019-09-09T20:00:06.9641083Z", + "Date" : "Mon, 09 Sep 2019 20:00:06 GMT", + "x-ms-client-request-id" : "e46369d4-52a4-4a1e-a7f4-58889fb8e28b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcdeletemin&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" : "b24e1992-9223-446c-b294-71f64d6994a7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ffa29-801e-001f-0449-673bbb000000", + "Body" : "jtcdeletemin", + "Date" : "Mon, 09 Sep 2019 20:00:06 GMT", + "x-ms-client-request-id" : "b24e1992-9223-446c-b294-71f64d6994a7", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "jtcdeletemin0containerapitestdeletemince4726982bd27527" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicy.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicy.json new file mode 100644 index 000000000000..7a3b46cc4084 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicy.json @@ -0,0 +1,111 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccesspolicy0containerapitestgetaccesspolicy8e340316c8?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" : "308d9402-0eca-4036-a444-dca5c520b6d0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604EB428F6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff8dd-801e-001f-5149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:04 GMT", + "x-ms-client-request-id" : "308d9402-0eca-4036-a444-dca5c520b6d0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccesspolicy0containerapitestgetaccesspolicy8e340316c8?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" : "bd96e105-c745-4aac-992e-b7ed85729683", + "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" : "\"0x8D735604EC06F50\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff8ed-801e-001f-5d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:04 GMT", + "x-ms-client-request-id" : "bd96e105-c745-4aac-992e-b7ed85729683" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccesspolicy0containerapitestgetaccesspolicy8e340316c8?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" : "ed562762-c576-4f77-8084-ad0e52d5a5ab" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:05 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:00:04 GMT", + "ETag" : "\"0x8D735604EC06F50\"", + "x-ms-blob-public-access" : "blob", + "x-ms-request-id" : "077ff8fa-801e-001f-6a49-673bbb000000", + "Body" : "00002019-09-09T20:00:05.0000000Z2019-09-10T20:00:05.0000000Zr", + "x-ms-client-request-id" : "ed562762-c576-4f77-8084-ad0e52d5a5ab", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetaccesspolicy&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" : "6efc23d1-6d4b-475a-aa28-bf3a83705038" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff905-801e-001f-7549-673bbb000000", + "Body" : "jtcgetaccesspolicyjtcgetaccesspolicy0containerapitestgetaccesspolicy8e340316c8Mon, 09 Sep 2019 20:00:05 GMT\"0x8D735604EC06F50\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:04 GMT", + "x-ms-client-request-id" : "6efc23d1-6d4b-475a-aa28-bf3a83705038", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccesspolicy0containerapitestgetaccesspolicy8e340316c8?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" : "d49286cb-8e27-408e-833f-7f666cf92b20" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff90c-801e-001f-7c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:04 GMT", + "x-ms-client-request-id" : "d49286cb-8e27-408e-833f-7f666cf92b20" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccesspolicy0containerapitestgetaccesspolicy8e340316c8", "2019-09-09T20:00:05.057Z", "2019-09-09T20:00:05.057Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicyerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicyerror.json new file mode 100644 index 000000000000..068281e9498e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicyerror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccesspolicyerror008578f52b76a5a87148fcb?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" : "d10a7351-830b-4b05-a7fc-760e43b01d81" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604F72B9E3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff988-801e-001f-6d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:05 GMT", + "x-ms-client-request-id" : "d10a7351-830b-4b05-a7fc-760e43b01d81" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccesspolicyerror194394a246457a024348f48?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" : "6139244c-652e-42be-9625-4039365b587e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "077ff995-801e-001f-7849-673bbb000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:077ff995-801e-001f-7849-673bbb000000\nTime:2019-09-09T20:00:06.3076405Z", + "Date" : "Mon, 09 Sep 2019 20:00:05 GMT", + "x-ms-client-request-id" : "6139244c-652e-42be-9625-4039365b587e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetaccesspolicyerror&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" : "e73d4663-df70-47fb-8c73-fc8ee6d710ee" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff99e-801e-001f-0149-673bbb000000", + "Body" : "jtcgetaccesspolicyerrorjtcgetaccesspolicyerror008578f52b76a5a87148fcbMon, 09 Sep 2019 20:00:06 GMT\"0x8D735604F72B9E3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:05 GMT", + "x-ms-client-request-id" : "e73d4663-df70-47fb-8c73-fc8ee6d710ee", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccesspolicyerror008578f52b76a5a87148fcb?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" : "c7a67ca3-817f-45e7-8262-4171a768c926" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff9a8-801e-001f-0b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:05 GMT", + "x-ms-client-request-id" : "c7a67ca3-817f-45e7-8262-4171a768c926" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccesspolicyerror008578f52b76a5a87148fcb", "jtcgetaccesspolicyerror194394a246457a024348f48" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicylease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicylease.json new file mode 100644 index 000000000000..ec5e5ba4dc50 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicylease.json @@ -0,0 +1,132 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccesspolicylease0086991fc92ec3bc0c48bcb?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" : "0beb2db2-d033-42b5-b410-448f1ad37a1d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604EF3395B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff916-801e-001f-0649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:04 GMT", + "x-ms-client-request-id" : "0beb2db2-d033-42b5-b410-448f1ad37a1d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccesspolicylease0086991fc92ec3bc0c48bcb?comp=lease&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" : "b3187e55-a366-4565-a791-297185103eed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604EF3395B\"", + "x-ms-lease-id" : "dac900cc-45a1-4816-83dc-1a7ca0cf0b46", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff920-801e-001f-0f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:04 GMT", + "x-ms-client-request-id" : "b3187e55-a366-4565-a791-297185103eed" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccesspolicylease0086991fc92ec3bc0c48bcb?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" : "cb05b5af-f60e-47c5-b20a-76e445ec20c7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604EF3395B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:05 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff92e-801e-001f-1c49-673bbb000000", + "Body" : "", + "Date" : "Mon, 09 Sep 2019 20:00:04 GMT", + "x-ms-client-request-id" : "cb05b5af-f60e-47c5-b20a-76e445ec20c7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetaccesspolicylease&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" : "308b2187-2920-4a63-8565-ac1dffd71216" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff936-801e-001f-2449-673bbb000000", + "Body" : "jtcgetaccesspolicyleasejtcgetaccesspolicylease0086991fc92ec3bc0c48bcbMon, 09 Sep 2019 20:00:05 GMT\"0x8D735604EF3395B\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:04 GMT", + "x-ms-client-request-id" : "308b2187-2920-4a63-8565-ac1dffd71216", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccesspolicylease0086991fc92ec3bc0c48bcb?comp=lease&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" : "38271814-ded7-4a78-8ff4-912d2fbb7b05" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604EF3395B\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff942-801e-001f-2d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:05 GMT", + "x-ms-client-request-id" : "38271814-ded7-4a78-8ff4-912d2fbb7b05" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccesspolicylease0086991fc92ec3bc0c48bcb?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" : "22060361-feb0-47a3-89da-8cc3bca7f86e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff952-801e-001f-3b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:05 GMT", + "x-ms-client-request-id" : "22060361-feb0-47a3-89da-8cc3bca7f86e" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccesspolicylease0086991fc92ec3bc0c48bcb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicyleasefail.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicyleasefail.json new file mode 100644 index 000000000000..0c854daa625d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccesspolicyleasefail.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccesspolicyleasefail048843e682885640e8461?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" : "7d672337-1a7a-4e3c-9274-a7df51dbda28" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604F3E8100\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff958-801e-001f-4149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:05 GMT", + "x-ms-client-request-id" : "7d672337-1a7a-4e3c-9274-a7df51dbda28" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccesspolicyleasefail048843e682885640e8461?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" : "7da1be5a-ee56-4123-af4f-9f200335911d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseNotPresentWithContainerOperation", + "retry-after" : "0", + "Content-Length" : "251", + "StatusCode" : "412", + "x-ms-request-id" : "077ff960-801e-001f-4849-673bbb000000", + "Body" : "LeaseNotPresentWithContainerOperationThere is currently no lease on the container.\nRequestId:077ff960-801e-001f-4849-673bbb000000\nTime:2019-09-09T20:00:05.9663976Z", + "Date" : "Mon, 09 Sep 2019 20:00:05 GMT", + "x-ms-client-request-id" : "7da1be5a-ee56-4123-af4f-9f200335911d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetaccesspolicyleasefail&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" : "e3179d21-4099-4811-9479-164ed0ca137f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff970-801e-001f-5849-673bbb000000", + "Body" : "jtcgetaccesspolicyleasefailjtcgetaccesspolicyleasefail048843e682885640e8461Mon, 09 Sep 2019 20:00:05 GMT\"0x8D735604F3E8100\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:05 GMT", + "x-ms-client-request-id" : "e3179d21-4099-4811-9479-164ed0ca137f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccesspolicyleasefail048843e682885640e8461?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" : "8147f1ed-7387-4835-8ffe-2a261feadf16" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff97c-801e-001f-6449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:05 GMT", + "x-ms-client-request-id" : "8147f1ed-7387-4835-8ffe-2a261feadf16" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccesspolicyleasefail048843e682885640e8461" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccountinfo.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccountinfo.json new file mode 100644 index 000000000000..5c8d382f7b39 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccountinfo.json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccountinfo0containerapitestgetaccountinfo52d98959732?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" : "7d86bbb7-17a5-4c19-ab4a-83ff89acbd94" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DC462377\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca15af-301e-0042-1249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:01 GMT", + "x-ms-client-request-id" : "7d86bbb7-17a5-4c19-ab4a-83ff89acbd94" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=account&comp=properties", + "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" : "920fbee6-2d54-47f9-9b1a-b69dac62b613" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-account-kind" : "StorageV2", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-sku-name" : "Standard_RAGRS", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca15be-301e-0042-1e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:01 GMT", + "x-ms-client-request-id" : "920fbee6-2d54-47f9-9b1a-b69dac62b613" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetaccountinfo&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" : "4fccee8f-1b87-4ab8-95e3-453b4e3d6b81" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca15d9-301e-0042-3949-67cbbf000000", + "Body" : "jtcgetaccountinfojtcgetaccountinfo0containerapitestgetaccountinfo52d98959732Mon, 09 Sep 2019 20:04:02 GMT\"0x8D73560DC462377\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:01 GMT", + "x-ms-client-request-id" : "4fccee8f-1b87-4ab8-95e3-453b4e3d6b81", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccountinfo0containerapitestgetaccountinfo52d98959732?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" : "f85c29f5-2423-4143-a812-44f5451b9bad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca15f0-301e-0042-4f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:01 GMT", + "x-ms-client-request-id" : "f85c29f5-2423-4143-a812-44f5451b9bad" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfo0containerapitestgetaccountinfo52d98959732" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccountinfoerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccountinfoerror.json new file mode 100644 index 000000000000..9008e548d7d1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccountinfoerror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccountinfoerror072504618872c95ffc4e008?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" : "f4811c76-a3a5-4b27-a179-e52ce12a7851" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DCAFCDFF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca16a5-301e-0042-7c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:02 GMT", + "x-ms-client-request-id" : "f4811c76-a3a5-4b27-a179-e52ce12a7851" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccountinfoerror16622548acbedd40f04dc78?restype=account&comp=properties", + "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" : "a4a191a7-0a73-4705-a5e6-b7cd3824af8a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "c5ca16d1-301e-0042-2649-67cbbf000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:c5ca16d1-301e-0042-2649-67cbbf000000\nTime:2019-09-09T20:04:03.2656697Z", + "Date" : "Mon, 09 Sep 2019 20:04:02 GMT", + "x-ms-client-request-id" : "a4a191a7-0a73-4705-a5e6-b7cd3824af8a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetaccountinfoerror&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" : "395cce3c-3907-4b24-8305-0a2ebf741037" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca1707-301e-0042-5a49-67cbbf000000", + "Body" : "jtcgetaccountinfoerrorjtcgetaccountinfoerror072504618872c95ffc4e008Mon, 09 Sep 2019 20:04:03 GMT\"0x8D73560DCAFCDFF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:02 GMT", + "x-ms-client-request-id" : "395cce3c-3907-4b24-8305-0a2ebf741037", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccountinfoerror072504618872c95ffc4e008?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" : "2c83bfb3-4d9c-4ef8-99ee-8c87c6fcaf5b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca1730-301e-0042-0149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:02 GMT", + "x-ms-client-request-id" : "2c83bfb3-4d9c-4ef8-99ee-8c87c6fcaf5b" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfoerror072504618872c95ffc4e008", "jtcgetaccountinfoerror16622548acbedd40f04dc78" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccountinfomin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccountinfomin.json new file mode 100644 index 000000000000..fe6b27515178 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetaccountinfomin.json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccountinfomin0containerapitestgetaccountinfomin64773831?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" : "759a98b1-509d-47be-a59c-df9e8137b67a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DC7C588B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca1609-301e-0042-6749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:01 GMT", + "x-ms-client-request-id" : "759a98b1-509d-47be-a59c-df9e8137b67a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=account&comp=properties", + "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" : "9301787a-f9d8-4718-9d68-3c0268d48e0a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-account-kind" : "StorageV2", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-sku-name" : "Standard_RAGRS", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca161e-301e-0042-7949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:01 GMT", + "x-ms-client-request-id" : "9301787a-f9d8-4718-9d68-3c0268d48e0a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetaccountinfomin&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" : "0cf53f0d-aaef-400b-b929-648b378aad2a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca1644-301e-0042-1d49-67cbbf000000", + "Body" : "jtcgetaccountinfominjtcgetaccountinfomin0containerapitestgetaccountinfomin64773831Mon, 09 Sep 2019 20:04:02 GMT\"0x8D73560DC7C588B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:02 GMT", + "x-ms-client-request-id" : "0cf53f0d-aaef-400b-b929-648b378aad2a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccountinfomin0containerapitestgetaccountinfomin64773831?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" : "5bfad065-8a56-40b7-89b6-9bf152058d83" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca167c-301e-0042-5349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:02 GMT", + "x-ms-client-request-id" : "5bfad065-8a56-40b7-89b6-9bf152058d83" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfomin0containerapitestgetaccountinfomin64773831" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertieserror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertieserror.json new file mode 100644 index 000000000000..fb8fde56996d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertieserror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertieserror077084a46c02ca3a7b449c83?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" : "dd8b583e-ecf1-40b4-884c-fc185ef77b3a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560483437D9\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff1a8-801e-001f-5a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:53 GMT", + "x-ms-client-request-id" : "dd8b583e-ecf1-40b4-884c-fc185ef77b3a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertieserror1988241c81ad5235a2424f95?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" : "8de29632-a09f-46ec-abc9-025cde0fac43" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "077ff1b9-801e-001f-6649-673bbb000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:077ff1b9-801e-001f-6649-673bbb000000\nTime:2019-09-09T19:59:54.1539378Z", + "Date" : "Mon, 09 Sep 2019 19:59:53 GMT", + "x-ms-client-request-id" : "8de29632-a09f-46ec-abc9-025cde0fac43", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpropertieserror&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" : "41612781-21cf-47cd-8215-17d42840c578" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff1c0-801e-001f-6c49-673bbb000000", + "Body" : "jtcgetpropertieserrorjtcgetpropertieserror077084a46c02ca3a7b449c83Mon, 09 Sep 2019 19:59:54 GMT\"0x8D73560483437D9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:53 GMT", + "x-ms-client-request-id" : "41612781-21cf-47cd-8215-17d42840c578", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertieserror077084a46c02ca3a7b449c83?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" : "bb6e10da-1fd5-4645-8283-c52bb96d2c61" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff1cc-801e-001f-7549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:53 GMT", + "x-ms-client-request-id" : "bb6e10da-1fd5-4645-8283-c52bb96d2c61" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertieserror077084a46c02ca3a7b449c83", "jtcgetpropertieserror1988241c81ad5235a2424f95" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertieslease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertieslease.json new file mode 100644 index 000000000000..5ccbe3fa06b8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertieslease.json @@ -0,0 +1,137 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertieslease039230b48cd5221161498b9e?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" : "97c66f53-b63d-4521-9c7a-968837d1d7b0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356047ADD834\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff13f-801e-001f-7649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:52 GMT", + "x-ms-client-request-id" : "97c66f53-b63d-4521-9c7a-968837d1d7b0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertieslease039230b48cd5221161498b9e?comp=lease&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" : "932f8ba4-2641-4441-a1a1-3ac513199c3f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356047ADD834\"", + "x-ms-lease-id" : "fb294388-d757-4d4d-8972-a6f3e4e7d5d1", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff149-801e-001f-7f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:52 GMT", + "x-ms-client-request-id" : "932f8ba4-2641-4441-a1a1-3ac513199c3f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertieslease039230b48cd5221161498b9e?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" : "970c5a66-9670-4164-b6de-d2280a0be7ec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "leased", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:53 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:59:52 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D7356047ADD834\"", + "x-ms-has-immutability-policy" : "false", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "0", + "x-ms-request-id" : "077ff154-801e-001f-0a49-673bbb000000", + "x-ms-client-request-id" : "970c5a66-9670-4164-b6de-d2280a0be7ec" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpropertieslease&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" : "4055be9c-9a65-4bc0-ad9d-14f0151d9138" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff162-801e-001f-1749-673bbb000000", + "Body" : "jtcgetpropertiesleasejtcgetpropertieslease039230b48cd5221161498b9eMon, 09 Sep 2019 19:59:53 GMT\"0x8D7356047ADD834\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:52 GMT", + "x-ms-client-request-id" : "4055be9c-9a65-4bc0-ad9d-14f0151d9138", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertieslease039230b48cd5221161498b9e?comp=lease&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" : "45a4a300-6f0e-4b45-8832-b3a06c31f43c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356047ADD834\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff168-801e-001f-1d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:52 GMT", + "x-ms-client-request-id" : "45a4a300-6f0e-4b45-8832-b3a06c31f43c" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertieslease039230b48cd5221161498b9e?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" : "88098a0b-49dd-4c69-bcd5-80597583c68c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff177-801e-001f-2c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:52 GMT", + "x-ms-client-request-id" : "88098a0b-49dd-4c69-bcd5-80597583c68c" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertieslease039230b48cd5221161498b9e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertiesleasefail.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertiesleasefail.json new file mode 100644 index 000000000000..b2671a9b6375 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertiesleasefail.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesleasefail00531763fd574c94644a04?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" : "2186c4d2-9635-4912-bbb4-c98546818e88" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356048015EBC\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff17c-801e-001f-3149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:53 GMT", + "x-ms-client-request-id" : "2186c4d2-9635-4912-bbb4-c98546818e88" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesleasefail00531763fd574c94644a04?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" : "7d438832-7fae-4b16-aa02-1604cca6a9c4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "326", + "StatusCode" : "400", + "x-ms-request-id" : "077ff189-801e-001f-3b49-673bbb000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:077ff189-801e-001f-3b49-673bbb000000\nTime:2019-09-09T19:59:53.8237016Zx-ms-lease-idgarbage", + "Date" : "Mon, 09 Sep 2019 19:59:53 GMT", + "x-ms-client-request-id" : "7d438832-7fae-4b16-aa02-1604cca6a9c4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpropertiesleasefail&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" : "ab83bd48-6c4e-4202-988c-f6d254a67d6f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff191-801e-001f-4349-673bbb000000", + "Body" : "jtcgetpropertiesleasefailjtcgetpropertiesleasefail00531763fd574c94644a04Mon, 09 Sep 2019 19:59:53 GMT\"0x8D7356048015EBC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:53 GMT", + "x-ms-client-request-id" : "ab83bd48-6c4e-4202-988c-f6d254a67d6f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesleasefail00531763fd574c94644a04?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" : "69de86e0-59bd-40dc-9431-1a1f4ddd2be3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff19d-801e-001f-4f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:53 GMT", + "x-ms-client-request-id" : "69de86e0-59bd-40dc-9431-1a1f4ddd2be3" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesleasefail00531763fd574c94644a04" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertiesmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertiesmin.json new file mode 100644 index 000000000000..9e6a96bfae6e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertiesmin.json @@ -0,0 +1,92 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesmin0containerapitestgetpropertiesmince0747349?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" : "eadf6b99-9576-4417-bd5b-1ef1cc80520d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560477902D6\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff104-801e-001f-4049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:52 GMT", + "x-ms-client-request-id" : "eadf6b99-9576-4417-bd5b-1ef1cc80520d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesmin0containerapitestgetpropertiesmince0747349?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" : "69a7a5a5-ac9d-4904-912d-79a027265a3c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:52 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:59:52 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D73560477902D6\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "077ff110-801e-001f-4a49-673bbb000000", + "x-ms-client-request-id" : "69a7a5a5-ac9d-4904-912d-79a027265a3c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpropertiesmin&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" : "14a17a9b-b27c-4193-86f2-fffba2d9d1d9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff120-801e-001f-5849-673bbb000000", + "Body" : "jtcgetpropertiesminjtcgetpropertiesmin0containerapitestgetpropertiesmince0747349Mon, 09 Sep 2019 19:59:52 GMT\"0x8D73560477902D6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:52 GMT", + "x-ms-client-request-id" : "14a17a9b-b27c-4193-86f2-fffba2d9d1d9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesmin0containerapitestgetpropertiesmince0747349?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" : "391b3097-617c-43b1-9bb5-92f3f83ca8c5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff131-801e-001f-6849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:52 GMT", + "x-ms-client-request-id" : "391b3097-617c-43b1-9bb5-92f3f83ca8c5" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesmin0containerapitestgetpropertiesmince0747349" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertiesnull.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertiesnull.json new file mode 100644 index 000000000000..823f636340fe --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestgetpropertiesnull.json @@ -0,0 +1,92 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesnull0containerapitestgetpropertiesnullc5f00504?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" : "23262ff2-b57c-4c41-857b-92157f560abb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356047469EF3\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff0ba-801e-001f-7d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:51 GMT", + "x-ms-client-request-id" : "23262ff2-b57c-4c41-857b-92157f560abb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesnull0containerapitestgetpropertiesnullc5f00504?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" : "c926e67a-9e6d-4cc3-b21c-8035df7e7c77" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:52 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:59:51 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D7356047469EF3\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "077ff0c9-801e-001f-0a49-673bbb000000", + "x-ms-client-request-id" : "c926e67a-9e6d-4cc3-b21c-8035df7e7c77" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpropertiesnull&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" : "8004c45c-cf89-4b6f-92b4-f1b7b615b309" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff0d8-801e-001f-1749-673bbb000000", + "Body" : "jtcgetpropertiesnulljtcgetpropertiesnull0containerapitestgetpropertiesnullc5f00504Mon, 09 Sep 2019 19:59:52 GMT\"0x8D7356047469EF3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:52 GMT", + "x-ms-client-request-id" : "8004c45c-cf89-4b6f-92b4-f1b7b615b309", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropertiesnull0containerapitestgetpropertiesnullc5f00504?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" : "11f26723-de30-41a2-b353-f4a63d217530" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff0e8-801e-001f-2649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:52 GMT", + "x-ms-client-request-id" : "11f26723-de30-41a2-b353-f4a63d217530" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropertiesnull0containerapitestgetpropertiesnullc5f00504" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflat.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflat.json new file mode 100644 index 000000000000..a9bfd305a12d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflat.json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflat0containerapitestlistblobsflat4d658745423d?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" : "b9e18fd9-83ac-4399-879a-bde69fac4fe1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356051BD3C85\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ffc75-801e-001f-1b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:09 GMT", + "x-ms-client-request-id" : "b9e18fd9-83ac-4399-879a-bde69fac4fe1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflat0containerapitestlistblobsflat4d658745423d/javabloblistblobsflat1containerapitestlistblobsflat4d61980710", + "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" : "a3d2f53d-5f5a-4f08-abf7-92ae441f2609" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356051CC8191\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ffc84-801e-001f-2749-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:00:09 GMT", + "x-ms-client-request-id" : "a3d2f53d-5f5a-4f08-abf7-92ae441f2609" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflat0containerapitestlistblobsflat4d658745423d?include=&restype=container&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" : "d8fccc30-066f-4ee5-a3b3-7871672cd5e4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ffca0-801e-001f-3c49-673bbb000000", + "Body" : "javabloblistblobsflat1containerapitestlistblobsflat4d61980710Mon, 09 Sep 2019 20:00:10 GMTMon, 09 Sep 2019 20:00:10 GMT0x8D7356051CC8191512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:00:09 GMT", + "x-ms-client-request-id" : "d8fccc30-066f-4ee5-a3b3-7871672cd5e4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobsflat&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" : "43322ea9-8ef1-4591-8489-e87890682c49" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ffcac-801e-001f-4749-673bbb000000", + "Body" : "jtclistblobsflatjtclistblobsflat0containerapitestlistblobsflat4d658745423dMon, 09 Sep 2019 20:00:10 GMT\"0x8D7356051BD3C85\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:09 GMT", + "x-ms-client-request-id" : "43322ea9-8ef1-4591-8489-e87890682c49", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflat0containerapitestlistblobsflat4d658745423d?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" : "5e2c1d25-a31f-4635-9e70-bca5d0038db0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ffcb8-801e-001f-5249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:09 GMT", + "x-ms-client-request-id" : "5e2c1d25-a31f-4635-9e70-bca5d0038db0" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflat0containerapitestlistblobsflat4d658745423d", "javabloblistblobsflat1containerapitestlistblobsflat4d61980710" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflaterror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflaterror.json new file mode 100644 index 000000000000..69823db3e636 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflaterror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflaterror00492097e8d83af279488da3?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" : "7becca60-056d-46eb-be5e-43c514361859" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735607F24D1D3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078034fb-801e-001f-7249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:25 GMT", + "x-ms-client-request-id" : "7becca60-056d-46eb-be5e-43c514361859" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflaterror115593ed10bb8c27f648ffba?include=&restype=container&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" : "0f3ea39c-05e3-41c3-8cd5-092379febd69" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "07803507-801e-001f-7d49-673bbb000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:07803507-801e-001f-7d49-673bbb000000\nTime:2019-09-09T20:01:26.3287095Z", + "Date" : "Mon, 09 Sep 2019 20:01:25 GMT", + "x-ms-client-request-id" : "0f3ea39c-05e3-41c3-8cd5-092379febd69", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobsflaterror&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" : "690aa949-153e-490e-84ad-ab6c7c782599" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07803512-801e-001f-0649-673bbb000000", + "Body" : "jtclistblobsflaterrorjtclistblobsflaterror00492097e8d83af279488da3Mon, 09 Sep 2019 20:01:26 GMT\"0x8D735607F24D1D3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:01:25 GMT", + "x-ms-client-request-id" : "690aa949-153e-490e-84ad-ab6c7c782599", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflaterror00492097e8d83af279488da3?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" : "6e6722c2-be5c-48c4-9757-85ac478ce754" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0780351d-801e-001f-0f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:25 GMT", + "x-ms-client-request-id" : "6e6722c2-be5c-48c4-9757-85ac478ce754" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflaterror00492097e8d83af279488da3", "jtclistblobsflaterror115593ed10bb8c27f648ffba" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatmarker.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatmarker.json new file mode 100644 index 000000000000..5cd538439f1a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatmarker.json @@ -0,0 +1,390 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatmarker00606265d48a3b10f64a979?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" : "a7be1695-b9eb-4d69-bfa8-2d0ae083f7c6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735607E12C873\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9801a-301e-0042-0b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:01:23 GMT", + "x-ms-client-request-id" : "a7be1695-b9eb-4d69-bfa8-2d0ae083f7c6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatmarker00606265d48a3b10f64a979/javabloblistblobsflatmarker11714641894ac79e6447c", + "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" : "bdafded6-4f0c-4812-bb38-fd0f95713873" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735607E202AAB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9802a-301e-0042-1a49-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:23 GMT", + "x-ms-client-request-id" : "bdafded6-4f0c-4812-bb38-fd0f95713873" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatmarker00606265d48a3b10f64a979/javabloblistblobsflatmarker248262d2cbc5a6d63a4f8", + "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" : "5534d9e0-c3e8-4650-ab0f-9caaa9bcae03" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735607E2D4C74\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9803b-301e-0042-2b49-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:23 GMT", + "x-ms-client-request-id" : "5534d9e0-c3e8-4650-ab0f-9caaa9bcae03" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatmarker00606265d48a3b10f64a979/javabloblistblobsflatmarker3969292db775e74f8b492", + "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" : "6311cf6c-d05e-4f9e-a656-6741f6f402bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735607E3B31A5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c98054-301e-0042-4349-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:24 GMT", + "x-ms-client-request-id" : "6311cf6c-d05e-4f9e-a656-6741f6f402bf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatmarker00606265d48a3b10f64a979/javabloblistblobsflatmarker4011882ffb6620addd482", + "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" : "ffe4712c-f1ba-4a1d-8939-92e95dd00824" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735607E49B33B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9806c-301e-0042-5749-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:24 GMT", + "x-ms-client-request-id" : "ffe4712c-f1ba-4a1d-8939-92e95dd00824" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatmarker00606265d48a3b10f64a979/javabloblistblobsflatmarker5456134f3be824f9e9471", + "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" : "6aebfad3-5a0c-4a6e-a7b6-a3868abd2273" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735607E56FC14\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c98081-301e-0042-6b49-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:24 GMT", + "x-ms-client-request-id" : "6aebfad3-5a0c-4a6e-a7b6-a3868abd2273" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatmarker00606265d48a3b10f64a979/javabloblistblobsflatmarker611534e7f4d68ef3a242b", + "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" : "fb32e7a0-f1b3-490b-9fbc-feddceeccf40" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735607E641DD8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c98092-301e-0042-7a49-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:24 GMT", + "x-ms-client-request-id" : "fb32e7a0-f1b3-490b-9fbc-feddceeccf40" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatmarker00606265d48a3b10f64a979/javabloblistblobsflatmarker707289547c51dd646d419", + "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" : "915b2e33-5a12-4fd0-97ed-61199638b8cf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735607E718DCB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c980ae-301e-0042-1449-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:24 GMT", + "x-ms-client-request-id" : "915b2e33-5a12-4fd0-97ed-61199638b8cf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatmarker00606265d48a3b10f64a979/javabloblistblobsflatmarker849878520c8ff7a9364cc", + "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" : "6bd765c2-11b0-4117-aae1-35629bdaa6ed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735607E7EAF93\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c980bf-301e-0042-2349-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:24 GMT", + "x-ms-client-request-id" : "6bd765c2-11b0-4117-aae1-35629bdaa6ed" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatmarker00606265d48a3b10f64a979/javabloblistblobsflatmarker987076ca28fe988c56441", + "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" : "a8cfff6b-1494-4c96-a4ff-f81133942604" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735607E8BF871\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c980d7-301e-0042-3949-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:24 GMT", + "x-ms-client-request-id" : "a8cfff6b-1494-4c96-a4ff-f81133942604" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatmarker00606265d48a3b10f64a979/javabloblistblobsflatmarker10288759b95d85a3d0e43", + "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" : "d7f8ddb6-5d3b-4a4f-98a2-8f5561fecbc2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735607E9A04BB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c980f1-301e-0042-4e49-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:24 GMT", + "x-ms-client-request-id" : "d7f8ddb6-5d3b-4a4f-98a2-8f5561fecbc2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatmarker00606265d48a3b10f64a979?maxresults=6&include=&restype=container&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" : "fff44beb-5501-4afe-8920-b0682475da16" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9810c-301e-0042-6849-67cbbf000000", + "Body" : "6javabloblistblobsflatmarker10288759b95d85a3d0e43Mon, 09 Sep 2019 20:01:25 GMTMon, 09 Sep 2019 20:01:25 GMT0x8D735607E9A04BB512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker11714641894ac79e6447cMon, 09 Sep 2019 20:01:24 GMTMon, 09 Sep 2019 20:01:24 GMT0x8D735607E202AAB512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker248262d2cbc5a6d63a4f8Mon, 09 Sep 2019 20:01:24 GMTMon, 09 Sep 2019 20:01:24 GMT0x8D735607E2D4C74512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker3969292db775e74f8b492Mon, 09 Sep 2019 20:01:24 GMTMon, 09 Sep 2019 20:01:24 GMT0x8D735607E3B31A5512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker4011882ffb6620addd482Mon, 09 Sep 2019 20:01:24 GMTMon, 09 Sep 2019 20:01:24 GMT0x8D735607E49B33B512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker5456134f3be824f9e9471Mon, 09 Sep 2019 20:01:24 GMTMon, 09 Sep 2019 20:01:24 GMT0x8D735607E56FC14512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdG1hcmtlcjYxMTUzNGU3ZjRkNjhlZjNhMjQyYiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Mon, 09 Sep 2019 20:01:24 GMT", + "x-ms-client-request-id" : "fff44beb-5501-4afe-8920-b0682475da16", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatmarker00606265d48a3b10f64a979?marker=2%21124%21MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdG1hcmtlcjYxMTUzNGU3ZjRkNjhlZjNhMjQyYiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&maxresults=6&include=&restype=container&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" : "90a70014-d1f1-4bc0-8418-575cb46e4a46" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c98139-301e-0042-1249-67cbbf000000", + "Body" : "2!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdG1hcmtlcjYxMTUzNGU3ZjRkNjhlZjNhMjQyYiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-6javabloblistblobsflatmarker611534e7f4d68ef3a242bMon, 09 Sep 2019 20:01:24 GMTMon, 09 Sep 2019 20:01:24 GMT0x8D735607E641DD8512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker707289547c51dd646d419Mon, 09 Sep 2019 20:01:25 GMTMon, 09 Sep 2019 20:01:25 GMT0x8D735607E718DCB512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker849878520c8ff7a9364ccMon, 09 Sep 2019 20:01:25 GMTMon, 09 Sep 2019 20:01:25 GMT0x8D735607E7EAF93512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker987076ca28fe988c56441Mon, 09 Sep 2019 20:01:25 GMTMon, 09 Sep 2019 20:01:25 GMT0x8D735607E8BF871512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:01:24 GMT", + "x-ms-client-request-id" : "90a70014-d1f1-4bc0-8418-575cb46e4a46", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatmarker00606265d48a3b10f64a979?marker=2%21124%21MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdG1hcmtlcjYxMTUzNGU3ZjRkNjhlZjNhMjQyYiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&maxresults=6&include=&restype=container&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" : "59bc6f9f-3e50-4ded-8487-722b4e742aa9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0780347e-801e-001f-7e49-673bbb000000", + "Body" : "2!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdG1hcmtlcjYxMTUzNGU3ZjRkNjhlZjNhMjQyYiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-6javabloblistblobsflatmarker611534e7f4d68ef3a242bMon, 09 Sep 2019 20:01:24 GMTMon, 09 Sep 2019 20:01:24 GMT0x8D735607E641DD8512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker707289547c51dd646d419Mon, 09 Sep 2019 20:01:25 GMTMon, 09 Sep 2019 20:01:25 GMT0x8D735607E718DCB512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker849878520c8ff7a9364ccMon, 09 Sep 2019 20:01:25 GMTMon, 09 Sep 2019 20:01:25 GMT0x8D735607E7EAF93512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker987076ca28fe988c56441Mon, 09 Sep 2019 20:01:25 GMTMon, 09 Sep 2019 20:01:25 GMT0x8D735607E8BF871512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:01:24 GMT", + "x-ms-client-request-id" : "59bc6f9f-3e50-4ded-8487-722b4e742aa9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatmarker00606265d48a3b10f64a979?maxresults=6&include=&restype=container&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" : "baecb6a9-852a-45a4-b2d1-2dd907561b3a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "078034ac-801e-001f-2949-673bbb000000", + "Body" : "6javabloblistblobsflatmarker10288759b95d85a3d0e43Mon, 09 Sep 2019 20:01:25 GMTMon, 09 Sep 2019 20:01:25 GMT0x8D735607E9A04BB512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker11714641894ac79e6447cMon, 09 Sep 2019 20:01:24 GMTMon, 09 Sep 2019 20:01:24 GMT0x8D735607E202AAB512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker248262d2cbc5a6d63a4f8Mon, 09 Sep 2019 20:01:24 GMTMon, 09 Sep 2019 20:01:24 GMT0x8D735607E2D4C74512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker3969292db775e74f8b492Mon, 09 Sep 2019 20:01:24 GMTMon, 09 Sep 2019 20:01:24 GMT0x8D735607E3B31A5512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker4011882ffb6620addd482Mon, 09 Sep 2019 20:01:24 GMTMon, 09 Sep 2019 20:01:24 GMT0x8D735607E49B33B512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker5456134f3be824f9e9471Mon, 09 Sep 2019 20:01:24 GMTMon, 09 Sep 2019 20:01:24 GMT0x8D735607E56FC14512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdG1hcmtlcjYxMTUzNGU3ZjRkNjhlZjNhMjQyYiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Mon, 09 Sep 2019 20:01:24 GMT", + "x-ms-client-request-id" : "baecb6a9-852a-45a4-b2d1-2dd907561b3a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatmarker00606265d48a3b10f64a979?marker=2%21124%21MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdG1hcmtlcjYxMTUzNGU3ZjRkNjhlZjNhMjQyYiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&maxresults=6&include=&restype=container&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" : "2ef118b9-8cc6-4f80-8b08-13c53d3ef18e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "078034c7-801e-001f-3f49-673bbb000000", + "Body" : "2!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdG1hcmtlcjYxMTUzNGU3ZjRkNjhlZjNhMjQyYiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-6javabloblistblobsflatmarker611534e7f4d68ef3a242bMon, 09 Sep 2019 20:01:24 GMTMon, 09 Sep 2019 20:01:24 GMT0x8D735607E641DD8512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker707289547c51dd646d419Mon, 09 Sep 2019 20:01:25 GMTMon, 09 Sep 2019 20:01:25 GMT0x8D735607E718DCB512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker849878520c8ff7a9364ccMon, 09 Sep 2019 20:01:25 GMTMon, 09 Sep 2019 20:01:25 GMT0x8D735607E7EAF93512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatmarker987076ca28fe988c56441Mon, 09 Sep 2019 20:01:25 GMTMon, 09 Sep 2019 20:01:25 GMT0x8D735607E8BF871512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:01:25 GMT", + "x-ms-client-request-id" : "2ef118b9-8cc6-4f80-8b08-13c53d3ef18e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobsflatmarker&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" : "2f8b1c7b-4459-48f1-80d2-6631f21307b9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "078034e0-801e-001f-5849-673bbb000000", + "Body" : "jtclistblobsflatmarkerjtclistblobsflatmarker00606265d48a3b10f64a979Mon, 09 Sep 2019 20:01:24 GMT\"0x8D735607E12C873\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:01:25 GMT", + "x-ms-client-request-id" : "2f8b1c7b-4459-48f1-80d2-6631f21307b9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatmarker00606265d48a3b10f64a979?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" : "d82ac9dd-713f-42aa-9359-6400079cde0d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "078034f0-801e-001f-6749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:25 GMT", + "x-ms-client-request-id" : "d82ac9dd-713f-42aa-9359-6400079cde0d" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatmarker00606265d48a3b10f64a979", "javabloblistblobsflatmarker11714641894ac79e6447c", "javabloblistblobsflatmarker248262d2cbc5a6d63a4f8", "javabloblistblobsflatmarker3969292db775e74f8b492", "javabloblistblobsflatmarker4011882ffb6620addd482", "javabloblistblobsflatmarker5456134f3be824f9e9471", "javabloblistblobsflatmarker611534e7f4d68ef3a242b", "javabloblistblobsflatmarker707289547c51dd646d419", "javabloblistblobsflatmarker849878520c8ff7a9364cc", "javabloblistblobsflatmarker987076ca28fe988c56441", "javabloblistblobsflatmarker10288759b95d85a3d0e43" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatmin.json new file mode 100644 index 000000000000..8c52bfdeed85 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatmin.json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatmin0containerapitestlistblobsflatmin6af66277c?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" : "eda85cc6-bd8e-4745-aacd-32f0a230ab05" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735605209BCC5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ffcc5-801e-001f-5e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:09 GMT", + "x-ms-client-request-id" : "eda85cc6-bd8e-4745-aacd-32f0a230ab05" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatmin0containerapitestlistblobsflatmin6af66277c?include=&restype=container&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" : "1332d25a-baee-4066-b2c4-492c358b511e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ffcd0-801e-001f-6749-673bbb000000", + "Body" : "", + "Date" : "Mon, 09 Sep 2019 20:00:09 GMT", + "x-ms-client-request-id" : "1332d25a-baee-4066-b2c4-492c358b511e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobsflatmin&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" : "f7daba7f-7050-45c9-904f-eb7ea099e2ad" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ffcdc-801e-001f-7249-673bbb000000", + "Body" : "jtclistblobsflatminjtclistblobsflatmin0containerapitestlistblobsflatmin6af66277cMon, 09 Sep 2019 20:00:10 GMT\"0x8D735605209BCC5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:10 GMT", + "x-ms-client-request-id" : "f7daba7f-7050-45c9-904f-eb7ea099e2ad", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatmin0containerapitestlistblobsflatmin6af66277c?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" : "80d928d4-2a41-4e3d-8c3d-5ec5e93162ec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ffce9-801e-001f-7d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:10 GMT", + "x-ms-client-request-id" : "80d928d4-2a41-4e3d-8c3d-5ec5e93162ec" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatmin0containerapitestlistblobsflatmin6af66277c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionscopy.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionscopy.json new file mode 100644 index 000000000000..2c9b9b498ff8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionscopy.json @@ -0,0 +1,235 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionscopy0843910843b877e22f410?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" : "9c75e801-8bdf-4ce2-be50-922626c41ecc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560523BD26B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ffcf1-801e-001f-0549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:10 GMT", + "x-ms-client-request-id" : "9c75e801-8bdf-4ce2-be50-922626c41ecc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionscopy0843910843b877e22f410/ajavabloblistblobsflatoptionscopy1672985368db57f112", + "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" : "9914e1e5-0064-422b-ba39-3387edbb3fa1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560524C7744\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ffcfe-801e-001f-1049-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:00:10 GMT", + "x-ms-client-request-id" : "9914e1e5-0064-422b-ba39-3387edbb3fa1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionscopy0843910843b877e22f410/cjavabloblistblobsflatoptionscopy255823e0645352f937", + "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" : "17046eb3-5d73-4dda-b473-07be34c5528e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "2f5e45bb-0510-45c2-808b-070b4eeff4c6", + "ETag" : "\"0x8D73560527FECCB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "077ffd14-801e-001f-2449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:10 GMT", + "x-ms-client-request-id" : "17046eb3-5d73-4dda-b473-07be34c5528e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionscopy0843910843b877e22f410/cjavabloblistblobsflatoptionscopy255823e0645352f937", + "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" : "e89b81cf-bf19-416e-8183-62cb654b2431" + }, + "Response" : { + "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 20:00:11 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:00:11 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "077ffd5a-801e-001f-6349-673bbb000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "2f5e45bb-0510-45c2-808b-070b4eeff4c6", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionscopy0843910843b877e22f410/ajavabloblistblobsflatoptionscopy1672985368db57f112", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Mon, 09 Sep 2019 20:00:10 GMT", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:00:11 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560527FECCB\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "e89b81cf-bf19-416e-8183-62cb654b2431" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionscopy0843910843b877e22f410/mjavabloblistblobsflatoptionscopy350662ebdcca52d782", + "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" : "1d3792ae-f84f-40a4-9741-c98474e1c8c4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735605334DF24\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ffe2f-801e-001f-2849-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:00:11 GMT", + "x-ms-client-request-id" : "1d3792ae-f84f-40a4-9741-c98474e1c8c4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionscopy0843910843b877e22f410/ajavabloblistblobsflatoptionscopy1672985368db57f112?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" : "9824d6b2-536f-47d8-91c2-2f8f32fa3f80" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:00:12.6131566Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560524C7744\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ffe3d-801e-001f-3649-673bbb000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:00:11 GMT", + "x-ms-client-request-id" : "9824d6b2-536f-47d8-91c2-2f8f32fa3f80" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionscopy0843910843b877e22f410/ujavabloblistblobsflatoptionscopy40312660c2bb908085?blockid=0000&comp=block", + "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" : "e6de4a10-c2c4-4e6d-8101-87bb365eeabc", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ffe4d-801e-001f-4649-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:00:12 GMT", + "x-ms-client-request-id" : "e6de4a10-c2c4-4e6d-8101-87bb365eeabc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionscopy0843910843b877e22f410?include=copy&restype=container&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" : "be0dde26-960d-4ac7-9aa4-ce0c32700bb8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ffe5c-801e-001f-5349-673bbb000000", + "Body" : "ajavabloblistblobsflatoptionscopy1672985368db57f112Mon, 09 Sep 2019 20:00:11 GMTMon, 09 Sep 2019 20:00:11 GMT0x8D73560524C7744512application/octet-stream0PageBlobHottrueunlockedavailabletrue0cjavabloblistblobsflatoptionscopy255823e0645352f937Mon, 09 Sep 2019 20:00:11 GMTMon, 09 Sep 2019 20:00:11 GMT0x8D73560527FECCB512application/octet-stream0PageBlobHottrueunlockedavailable2f5e45bb-0510-45c2-808b-070b4eeff4c6https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionscopy0843910843b877e22f410/ajavabloblistblobsflatoptionscopy1672985368db57f112success512/512Mon, 09 Sep 2019 20:00:11 GMTtrue0mjavabloblistblobsflatoptionscopy350662ebdcca52d782Mon, 09 Sep 2019 20:00:12 GMTMon, 09 Sep 2019 20:00:12 GMT0x8D735605334DF24512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:00:12 GMT", + "x-ms-client-request-id" : "be0dde26-960d-4ac7-9aa4-ce0c32700bb8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobsflatoptionscopy&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" : "69e28c53-ddda-4d48-b568-cf0010cd7ff5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ffe7e-801e-001f-7349-673bbb000000", + "Body" : "jtclistblobsflatoptionscopyjtclistblobsflatoptionscopy0843910843b877e22f410Mon, 09 Sep 2019 20:00:10 GMT\"0x8D73560523BD26B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:12 GMT", + "x-ms-client-request-id" : "69e28c53-ddda-4d48-b568-cf0010cd7ff5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionscopy0843910843b877e22f410?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" : "02a4ae41-bb0a-424a-b537-bff3b501ce04" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ffe8b-801e-001f-7e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:12 GMT", + "x-ms-client-request-id" : "02a4ae41-bb0a-424a-b537-bff3b501ce04" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatoptionscopy0843910843b877e22f410", "javabloblistblobsflatoptionscopy1672985368db57f112", "javabloblistblobsflatoptionscopy255823e0645352f937", "javabloblistblobsflatoptionscopy350662ebdcca52d782", "javabloblistblobsflatoptionscopy40312660c2bb908085" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsdeleted.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsdeleted.json new file mode 100644 index 000000000000..ab8ed45cee68 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsdeleted.json @@ -0,0 +1,168 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsdeleted09409248d6a49602c74?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" : "075878fc-ce0a-4687-b942-68433176670b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560570CDA2E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078002cb-801e-001f-6049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:18 GMT", + "x-ms-client-request-id" : "075878fc-ce0a-4687-b942-68433176670b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "57568a68-32a3-44f3-9161-9308ad35d3f8", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "078002df-801e-001f-7049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:18 GMT", + "x-ms-client-request-id" : "57568a68-32a3-44f3-9161-9308ad35d3f8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsdeleted09409248d6a49602c74/javabloblistblobsflatoptionsdeleted145703067bc889d9c", + "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" : "200a0e8d-ccb4-46d1-86a4-4cac30111fda" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560691F6AE8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07801c91-801e-001f-4449-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:00:48 GMT", + "x-ms-client-request-id" : "200a0e8d-ccb4-46d1-86a4-4cac30111fda" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsdeleted09409248d6a49602c74/javabloblistblobsflatoptionsdeleted145703067bc889d9c", + "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" : "2e27acca-45e4-4fd5-a441-2fb5265857c5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "false", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "07801c9e-801e-001f-4f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:48 GMT", + "x-ms-client-request-id" : "2e27acca-45e4-4fd5-a441-2fb5265857c5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsdeleted09409248d6a49602c74?include=deleted&restype=container&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" : "e17c5948-e343-4c7f-9dff-574d97975859" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07801cc5-801e-001f-7249-673bbb000000", + "Body" : "javabloblistblobsflatoptionsdeleted145703067bc889d9ctrueMon, 09 Sep 2019 20:00:49 GMTMon, 09 Sep 2019 20:00:49 GMT0x8D73560691F6AE80application/octet-streamAppendBlobHottruetrueMon, 09 Sep 2019 20:00:49 GMT10", + "Date" : "Mon, 09 Sep 2019 20:00:48 GMT", + "x-ms-client-request-id" : "e17c5948-e343-4c7f-9dff-574d97975859", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "57a537c0-20ef-43b9-a124-6823d089f2ff", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "07801ccd-801e-001f-7a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:48 GMT", + "x-ms-client-request-id" : "57a537c0-20ef-43b9-a124-6823d089f2ff" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobsflatoptionsdeleted&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" : "f885a67c-7b05-4721-8a9e-20bc788cd33d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07802f7f-801e-001f-5b49-673bbb000000", + "Body" : "jtclistblobsflatoptionsdeletedjtclistblobsflatoptionsdeleted09409248d6a49602c74Mon, 09 Sep 2019 20:00:18 GMT\"0x8D73560570CDA2E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:01:18 GMT", + "x-ms-client-request-id" : "f885a67c-7b05-4721-8a9e-20bc788cd33d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsdeleted09409248d6a49602c74?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" : "def9900f-d725-4cc6-a491-06e6d794cac9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "07802f8e-801e-001f-6949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:18 GMT", + "x-ms-client-request-id" : "def9900f-d725-4cc6-a491-06e6d794cac9" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatoptionsdeleted09409248d6a49602c74", "javabloblistblobsflatoptionsdeleted145703067bc889d9c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsfail.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsfail.json new file mode 100644 index 000000000000..f167344cfe35 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsfail.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsfail037484e5f8555bcfa4492?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" : "0102722f-61a7-4954-8330-00639a848efd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735607DEBD87C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c97fdc-301e-0042-5049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:01:23 GMT", + "x-ms-client-request-id" : "0102722f-61a7-4954-8330-00639a848efd" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobsflatoptionsfail&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" : "c7dc04c3-1093-4cc3-8458-c065be36837d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c97fec-301e-0042-5e49-67cbbf000000", + "Body" : "jtclistblobsflatoptionsfailjtclistblobsflatoptionsfail037484e5f8555bcfa4492Mon, 09 Sep 2019 20:01:24 GMT\"0x8D735607DEBD87C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:01:23 GMT", + "x-ms-client-request-id" : "c7dc04c3-1093-4cc3-8458-c065be36837d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsfail037484e5f8555bcfa4492?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" : "d86f8e3d-3005-47a7-97e0-8409a7ae471b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c98002-301e-0042-7349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:01:23 GMT", + "x-ms-client-request-id" : "d86f8e3d-3005-47a7-97e0-8409a7ae471b" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatoptionsfail037484e5f8555bcfa4492" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsmaxresults.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsmaxresults.json new file mode 100644 index 000000000000..b6065369bedf --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsmaxresults.json @@ -0,0 +1,298 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsmaxresults084857ee5cfbc365b4?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" : "0ae2a672-a16d-4f22-b1e9-7ea05ddc1993" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735607C8542B0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078030bc-801e-001f-7949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:21 GMT", + "x-ms-client-request-id" : "0ae2a672-a16d-4f22-b1e9-7ea05ddc1993" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsmaxresults084857ee5cfbc365b4/ajavabloblistblobsflatoptionsmaxresults185398a352e5e9a", + "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" : "9c1cffc9-79ed-4917-872b-8bf5e2755084" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735607C926470\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078030c7-801e-001f-0349-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:21 GMT", + "x-ms-client-request-id" : "9c1cffc9-79ed-4917-872b-8bf5e2755084" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsmaxresults084857ee5cfbc365b4/cjavabloblistblobsflatoptionsmaxresults2429306efc5edfb", + "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" : "082ac915-fabc-45d7-8b32-7145c82767d6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "5b2e796e-3899-4d7a-82c5-d3885ab8fb4a", + "ETag" : "\"0x8D735607CA21EBB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "078030d5-801e-001f-0f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:21 GMT", + "x-ms-client-request-id" : "082ac915-fabc-45d7-8b32-7145c82767d6" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsmaxresults084857ee5cfbc365b4/cjavabloblistblobsflatoptionsmaxresults2429306efc5edfb", + "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" : "9549cf9b-6615-4b87-8b59-52e71070b2cb" + }, + "Response" : { + "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 20:01:22 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:01:22 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "078030ed-801e-001f-2449-673bbb000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "5b2e796e-3899-4d7a-82c5-d3885ab8fb4a", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsmaxresults084857ee5cfbc365b4/ajavabloblistblobsflatoptionsmaxresults185398a352e5e9a", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Mon, 09 Sep 2019 20:01:21 GMT", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:01:22 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D735607CA21EBB\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "9549cf9b-6615-4b87-8b59-52e71070b2cb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsmaxresults084857ee5cfbc365b4/mjavabloblistblobsflatoptionsmaxresults358395d42a05b79", + "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" : "7c30037a-cbfe-4d02-8c3e-20fc3e0c6cba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735607D5710BB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07803242-801e-001f-6649-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:22 GMT", + "x-ms-client-request-id" : "7c30037a-cbfe-4d02-8c3e-20fc3e0c6cba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsmaxresults084857ee5cfbc365b4/ajavabloblistblobsflatoptionsmaxresults185398a352e5e9a?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" : "cd8b1fbd-88c9-47c2-892e-6588b9853bc9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:01:23.3065599Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735607C926470\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07803258-801e-001f-7b49-673bbb000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:01:22 GMT", + "x-ms-client-request-id" : "cd8b1fbd-88c9-47c2-892e-6588b9853bc9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsmaxresults084857ee5cfbc365b4/ujavabloblistblobsflatoptionsmaxresults463375aac18ac5a?blockid=0000&comp=block", + "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" : "776985df-61a8-496e-b364-bac4b000e2e6", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07803269-801e-001f-0c49-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:22 GMT", + "x-ms-client-request-id" : "776985df-61a8-496e-b364-bac4b000e2e6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsmaxresults084857ee5cfbc365b4?maxresults=2&include=copy%2csnapshots%2cuncommittedblobs&restype=container&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" : "e425a3bc-f877-4fdc-91cb-2d279dca5871" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07803279-801e-001f-1c49-673bbb000000", + "Body" : "2ajavabloblistblobsflatoptionsmaxresults185398a352e5e9a2019-09-09T20:01:23.3065599ZMon, 09 Sep 2019 20:01:21 GMTMon, 09 Sep 2019 20:01:21 GMT0x8D735607C926470512application/octet-stream0PageBlobHottruetrue0ajavabloblistblobsflatoptionsmaxresults185398a352e5e9aMon, 09 Sep 2019 20:01:21 GMTMon, 09 Sep 2019 20:01:21 GMT0x8D735607C926470512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!132!MDAwMDU0IWNqYXZhYmxvYmxpc3RibG9ic2ZsYXRvcHRpb25zbWF4cmVzdWx0czI0MjkzMDZlZmM1ZWRmYiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Mon, 09 Sep 2019 20:01:22 GMT", + "x-ms-client-request-id" : "e425a3bc-f877-4fdc-91cb-2d279dca5871", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsmaxresults084857ee5cfbc365b4?marker=2%21132%21MDAwMDU0IWNqYXZhYmxvYmxpc3RibG9ic2ZsYXRvcHRpb25zbWF4cmVzdWx0czI0MjkzMDZlZmM1ZWRmYiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&maxresults=2&include=copy%2csnapshots%2cuncommittedblobs&restype=container&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" : "25c33c3e-5a9e-479b-9ce3-ef53220ddca2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0780328b-801e-001f-2e49-673bbb000000", + "Body" : "2!132!MDAwMDU0IWNqYXZhYmxvYmxpc3RibG9ic2ZsYXRvcHRpb25zbWF4cmVzdWx0czI0MjkzMDZlZmM1ZWRmYiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-2cjavabloblistblobsflatoptionsmaxresults2429306efc5edfbMon, 09 Sep 2019 20:01:22 GMTMon, 09 Sep 2019 20:01:22 GMT0x8D735607CA21EBB512application/octet-stream0PageBlobHottrueunlockedavailable5b2e796e-3899-4d7a-82c5-d3885ab8fb4ahttps://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsmaxresults084857ee5cfbc365b4/ajavabloblistblobsflatoptionsmaxresults185398a352e5e9asuccess512/512Mon, 09 Sep 2019 20:01:22 GMTtrue0mjavabloblistblobsflatoptionsmaxresults358395d42a05b79Mon, 09 Sep 2019 20:01:23 GMTMon, 09 Sep 2019 20:01:23 GMT0x8D735607D5710BB512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!132!MDAwMDU0IXVqYXZhYmxvYmxpc3RibG9ic2ZsYXRvcHRpb25zbWF4cmVzdWx0czQ2MzM3NWFhYzE4YWM1YSEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Mon, 09 Sep 2019 20:01:22 GMT", + "x-ms-client-request-id" : "25c33c3e-5a9e-479b-9ce3-ef53220ddca2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsmaxresults084857ee5cfbc365b4?marker=2%21132%21MDAwMDU0IXVqYXZhYmxvYmxpc3RibG9ic2ZsYXRvcHRpb25zbWF4cmVzdWx0czQ2MzM3NWFhYzE4YWM1YSEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&maxresults=2&include=copy%2csnapshots%2cuncommittedblobs&restype=container&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" : "25e6b320-2e8e-4cfa-b894-c60d1b64367d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "078032ac-801e-001f-4c49-673bbb000000", + "Body" : "2!132!MDAwMDU0IXVqYXZhYmxvYmxpc3RibG9ic2ZsYXRvcHRpb25zbWF4cmVzdWx0czQ2MzM3NWFhYzE4YWM1YSEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-2ujavabloblistblobsflatoptionsmaxresults463375aac18ac5a0BlockBlobHottrueunlockedavailablefalse0", + "Date" : "Mon, 09 Sep 2019 20:01:22 GMT", + "x-ms-client-request-id" : "25e6b320-2e8e-4cfa-b894-c60d1b64367d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsmaxresults084857ee5cfbc365b4?maxresults=2&include=copy%2csnapshots%2cuncommittedblobs&restype=container&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" : "790806bd-8b0e-4593-a499-1f291ccc0503" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c97f95-301e-0042-1249-67cbbf000000", + "Body" : "2ajavabloblistblobsflatoptionsmaxresults185398a352e5e9a2019-09-09T20:01:23.3065599ZMon, 09 Sep 2019 20:01:21 GMTMon, 09 Sep 2019 20:01:21 GMT0x8D735607C926470512application/octet-stream0PageBlobHottruetrue0ajavabloblistblobsflatoptionsmaxresults185398a352e5e9aMon, 09 Sep 2019 20:01:21 GMTMon, 09 Sep 2019 20:01:21 GMT0x8D735607C926470512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!132!MDAwMDU0IWNqYXZhYmxvYmxpc3RibG9ic2ZsYXRvcHRpb25zbWF4cmVzdWx0czI0MjkzMDZlZmM1ZWRmYiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Mon, 09 Sep 2019 20:01:23 GMT", + "x-ms-client-request-id" : "790806bd-8b0e-4593-a499-1f291ccc0503", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobsflatoptionsmaxresults&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" : "0bb1cc1f-f0db-4371-82e4-89a1b2219af1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c97fa5-301e-0042-1d49-67cbbf000000", + "Body" : "jtclistblobsflatoptionsmaxresultsjtclistblobsflatoptionsmaxresults084857ee5cfbc365b4Mon, 09 Sep 2019 20:01:21 GMT\"0x8D735607C8542B0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:01:23 GMT", + "x-ms-client-request-id" : "0bb1cc1f-f0db-4371-82e4-89a1b2219af1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsmaxresults084857ee5cfbc365b4?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" : "60689f7b-2ba4-48ad-be8d-60ae7f806cc3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c97fc0-301e-0042-3749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:01:23 GMT", + "x-ms-client-request-id" : "60689f7b-2ba4-48ad-be8d-60ae7f806cc3" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatoptionsmaxresults084857ee5cfbc365b4", "javabloblistblobsflatoptionsmaxresults185398a352e5e9a", "javabloblistblobsflatoptionsmaxresults2429306efc5edfb", "javabloblistblobsflatoptionsmaxresults358395d42a05b79", "javabloblistblobsflatoptionsmaxresults463375aac18ac5a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsmetadata.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsmetadata.json new file mode 100644 index 000000000000..330d369c17ac --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsmetadata.json @@ -0,0 +1,235 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsmetadata080830e7a522b6a30f4?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" : "6e8eb1a2-264f-4f89-b64a-242f54b02dac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356053907D63\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ffe98-801e-001f-0b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:12 GMT", + "x-ms-client-request-id" : "6e8eb1a2-264f-4f89-b64a-242f54b02dac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsmetadata080830e7a522b6a30f4/ajavabloblistblobsflatoptionsmetadata14389896e62204cd", + "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" : "a35c5f8c-e343-4fb9-9d92-becfe0abc091" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560539E146F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ffe9d-801e-001f-0f49-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:00:12 GMT", + "x-ms-client-request-id" : "a35c5f8c-e343-4fb9-9d92-becfe0abc091" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsmetadata080830e7a522b6a30f4/cjavabloblistblobsflatoptionsmetadata200781eaf0095ff7", + "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" : "02b39ee9-44bf-427d-b8cd-faa0e26b82c3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "20b7af5f-19c2-4487-b3cc-b52d405f24dd", + "ETag" : "\"0x8D7356053B28A84\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "077ffeb2-801e-001f-2049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:12 GMT", + "x-ms-client-request-id" : "02b39ee9-44bf-427d-b8cd-faa0e26b82c3" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsmetadata080830e7a522b6a30f4/cjavabloblistblobsflatoptionsmetadata200781eaf0095ff7", + "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" : "2d54c7a4-d87f-47b9-b67b-35fea30f4cce" + }, + "Response" : { + "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 20:00:13 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:00:13 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "077ffec3-801e-001f-3049-673bbb000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "20b7af5f-19c2-4487-b3cc-b52d405f24dd", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsmetadata080830e7a522b6a30f4/ajavabloblistblobsflatoptionsmetadata14389896e62204cd", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Mon, 09 Sep 2019 20:00:12 GMT", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:00:13 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D7356053B28A84\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "2d54c7a4-d87f-47b9-b67b-35fea30f4cce" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsmetadata080830e7a522b6a30f4/mjavabloblistblobsflatoptionsmetadata303953ce7db54afc", + "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" : "9c84d184-c26d-4efe-920d-b6ffd1cd5c8c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735605463D286\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fff7d-801e-001f-5a49-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:00:13 GMT", + "x-ms-client-request-id" : "9c84d184-c26d-4efe-920d-b6ffd1cd5c8c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsmetadata080830e7a522b6a30f4/ajavabloblistblobsflatoptionsmetadata14389896e62204cd?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" : "644a5de0-c77f-48ee-a1e8-9f6dd3837f20" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:00:14.5985754Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560539E146F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fff88-801e-001f-6449-673bbb000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:00:13 GMT", + "x-ms-client-request-id" : "644a5de0-c77f-48ee-a1e8-9f6dd3837f20" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsmetadata080830e7a522b6a30f4/ujavabloblistblobsflatoptionsmetadata4197162fb5ab669c?blockid=0000&comp=block", + "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" : "a9d3f63e-3e8d-4bba-a030-1a29e7dd96ca", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fff9b-801e-001f-7749-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:00:13 GMT", + "x-ms-client-request-id" : "a9d3f63e-3e8d-4bba-a030-1a29e7dd96ca" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsmetadata080830e7a522b6a30f4?include=metadata&restype=container&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" : "9678b5f4-3562-4a0e-8e13-81b6918d06a7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fffae-801e-001f-0949-673bbb000000", + "Body" : "ajavabloblistblobsflatoptionsmetadata14389896e62204cdMon, 09 Sep 2019 20:00:13 GMTMon, 09 Sep 2019 20:00:13 GMT0x8D73560539E146F512application/octet-stream0PageBlobHottrueunlockedavailabletrue0cjavabloblistblobsflatoptionsmetadata200781eaf0095ff7Mon, 09 Sep 2019 20:00:13 GMTMon, 09 Sep 2019 20:00:13 GMT0x8D7356053B28A84512application/octet-stream0PageBlobHottrueunlockedavailabletrue0mjavabloblistblobsflatoptionsmetadata303953ce7db54afcMon, 09 Sep 2019 20:00:14 GMTMon, 09 Sep 2019 20:00:14 GMT0x8D735605463D286512application/octet-stream0PageBlobHottrueunlockedavailabletrue0bar", + "Date" : "Mon, 09 Sep 2019 20:00:14 GMT", + "x-ms-client-request-id" : "9678b5f4-3562-4a0e-8e13-81b6918d06a7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobsflatoptionsmetadata&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" : "5e40fbe3-e5e8-4d8b-a695-f92092cd9d5a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fffd4-801e-001f-2d49-673bbb000000", + "Body" : "jtclistblobsflatoptionsmetadatajtclistblobsflatoptionsmetadata080830e7a522b6a30f4Mon, 09 Sep 2019 20:00:13 GMT\"0x8D7356053907D63\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:14 GMT", + "x-ms-client-request-id" : "5e40fbe3-e5e8-4d8b-a695-f92092cd9d5a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsmetadata080830e7a522b6a30f4?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" : "5dbd16d2-6445-49f6-9462-9f7f363dcb35" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fffe0-801e-001f-3949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:14 GMT", + "x-ms-client-request-id" : "5dbd16d2-6445-49f6-9462-9f7f363dcb35" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatoptionsmetadata080830e7a522b6a30f4", "javabloblistblobsflatoptionsmetadata14389896e62204cd", "javabloblistblobsflatoptionsmetadata200781eaf0095ff7", "javabloblistblobsflatoptionsmetadata303953ce7db54afc", "javabloblistblobsflatoptionsmetadata4197162fb5ab669c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsprefix.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsprefix.json new file mode 100644 index 000000000000..33cf53aa545e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsprefix.json @@ -0,0 +1,235 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsprefix01339291deaaac2d504f?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" : "15771324-bbe7-4e76-ac74-0b4668ed7010" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735607B523010\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07802f99-801e-001f-7449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:18 GMT", + "x-ms-client-request-id" : "15771324-bbe7-4e76-ac74-0b4668ed7010" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsprefix01339291deaaac2d504f/ajavabloblistblobsflatoptionsprefix120319d912edd2a0a", + "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" : "120dc96a-0686-4326-8702-320fc24aa26a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735607B5F03AA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07802fa4-801e-001f-7c49-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:19 GMT", + "x-ms-client-request-id" : "120dc96a-0686-4326-8702-320fc24aa26a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsprefix01339291deaaac2d504f/cjavabloblistblobsflatoptionsprefix2970252f989d9dd90", + "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" : "60ba51fb-4205-40f1-834c-2ea5c8ad02fe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "d8769785-bbec-4d71-8192-fac426e6bc36", + "ETag" : "\"0x8D735607B80E9B2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "07802fb0-801e-001f-0849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:19 GMT", + "x-ms-client-request-id" : "60ba51fb-4205-40f1-834c-2ea5c8ad02fe" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsprefix01339291deaaac2d504f/cjavabloblistblobsflatoptionsprefix2970252f989d9dd90", + "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" : "2712bb4c-5abb-4473-9250-326ec6eba20f" + }, + "Response" : { + "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 20:01:20 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:01:20 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "07802fd0-801e-001f-2249-673bbb000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "d8769785-bbec-4d71-8192-fac426e6bc36", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsprefix01339291deaaac2d504f/ajavabloblistblobsflatoptionsprefix120319d912edd2a0a", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Mon, 09 Sep 2019 20:01:19 GMT", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:01:20 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D735607B80E9B2\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "2712bb4c-5abb-4473-9250-326ec6eba20f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsprefix01339291deaaac2d504f/mjavabloblistblobsflatoptionsprefix34646717bb56a8fea", + "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" : "c0f7414f-eb88-45f1-ae7d-9d1756df55d8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735607C33915E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07803068-801e-001f-2e49-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:20 GMT", + "x-ms-client-request-id" : "c0f7414f-eb88-45f1-ae7d-9d1756df55d8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsprefix01339291deaaac2d504f/ajavabloblistblobsflatoptionsprefix120319d912edd2a0a?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" : "cfd664c4-ea75-4e8e-831b-643f22b44f3b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:01:21.4232208Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735607B5F03AA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0780307a-801e-001f-3f49-673bbb000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:01:20 GMT", + "x-ms-client-request-id" : "cfd664c4-ea75-4e8e-831b-643f22b44f3b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsprefix01339291deaaac2d504f/ujavabloblistblobsflatoptionsprefix403539ecc43ae56d7?blockid=0000&comp=block", + "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" : "eeddc8f8-5220-48f4-af1f-9583b16dfa57", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07803088-801e-001f-4d49-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:20 GMT", + "x-ms-client-request-id" : "eeddc8f8-5220-48f4-af1f-9583b16dfa57" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsprefix01339291deaaac2d504f?prefix=a&include=&restype=container&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" : "26f9128e-baba-42aa-b0d9-cb30063b7dd0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07803093-801e-001f-5649-673bbb000000", + "Body" : "aajavabloblistblobsflatoptionsprefix120319d912edd2a0aMon, 09 Sep 2019 20:01:19 GMTMon, 09 Sep 2019 20:01:19 GMT0x8D735607B5F03AA512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:01:20 GMT", + "x-ms-client-request-id" : "26f9128e-baba-42aa-b0d9-cb30063b7dd0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobsflatoptionsprefix&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" : "f6e3ba5d-ff4d-4597-9798-a43882a5b338" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0780309c-801e-001f-5f49-673bbb000000", + "Body" : "jtclistblobsflatoptionsprefixjtclistblobsflatoptionsprefix01339291deaaac2d504fMon, 09 Sep 2019 20:01:19 GMT\"0x8D735607B523010\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:01:20 GMT", + "x-ms-client-request-id" : "f6e3ba5d-ff4d-4597-9798-a43882a5b338", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsprefix01339291deaaac2d504f?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" : "8e75eb83-8045-4e0f-8422-a3a907fabd6b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "078030ab-801e-001f-6c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:20 GMT", + "x-ms-client-request-id" : "8e75eb83-8045-4e0f-8422-a3a907fabd6b" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatoptionsprefix01339291deaaac2d504f", "javabloblistblobsflatoptionsprefix120319d912edd2a0a", "javabloblistblobsflatoptionsprefix2970252f989d9dd90", "javabloblistblobsflatoptionsprefix34646717bb56a8fea", "javabloblistblobsflatoptionsprefix403539ecc43ae56d7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionssnapshots.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionssnapshots.json new file mode 100644 index 000000000000..df61439ccdb9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionssnapshots.json @@ -0,0 +1,235 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionssnapshots01857129d93296609a?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" : "e43e1676-9797-48e0-a803-64904696bb98" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356054BA18B3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ffff8-801e-001f-4f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:14 GMT", + "x-ms-client-request-id" : "e43e1676-9797-48e0-a803-64904696bb98" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionssnapshots01857129d93296609a/ajavabloblistblobsflatoptionssnapshots113515280b4c9935", + "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" : "8b13a1f9-b5af-480f-a98b-ec8488c194b5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356054C71368\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07800005-801e-001f-5a49-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:00:14 GMT", + "x-ms-client-request-id" : "8b13a1f9-b5af-480f-a98b-ec8488c194b5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionssnapshots01857129d93296609a/cjavabloblistblobsflatoptionssnapshots22011084c06e9c6c", + "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" : "17173128-0b3a-4c07-831b-877da8bc1a04" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "97dbf782-9cfe-4ba0-a42f-fd1785f77457", + "ETag" : "\"0x8D7356054DD3788\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "07800019-801e-001f-6d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:14 GMT", + "x-ms-client-request-id" : "17173128-0b3a-4c07-831b-877da8bc1a04" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionssnapshots01857129d93296609a/cjavabloblistblobsflatoptionssnapshots22011084c06e9c6c", + "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" : "b0dc4cc8-eb71-47ed-a223-54343223a5be" + }, + "Response" : { + "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 20:00:15 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:00:15 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "07800033-801e-001f-0249-673bbb000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "97dbf782-9cfe-4ba0-a42f-fd1785f77457", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionssnapshots01857129d93296609a/ajavabloblistblobsflatoptionssnapshots113515280b4c9935", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Mon, 09 Sep 2019 20:00:14 GMT", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:00:15 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D7356054DD3788\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "b0dc4cc8-eb71-47ed-a223-54343223a5be" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionssnapshots01857129d93296609a/mjavabloblistblobsflatoptionssnapshots308464be9fef087a", + "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" : "61bd3e9d-0deb-4bfd-aa10-c1997f93b255" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560558F6A44\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0780010c-801e-001f-4549-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:00:15 GMT", + "x-ms-client-request-id" : "61bd3e9d-0deb-4bfd-aa10-c1997f93b255" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionssnapshots01857129d93296609a/ajavabloblistblobsflatoptionssnapshots113515280b4c9935?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" : "9c0ffb63-2461-4a36-b6ed-11f255ed451a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:00:16.5629859Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356054C71368\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07800116-801e-001f-4e49-673bbb000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:00:15 GMT", + "x-ms-client-request-id" : "9c0ffb63-2461-4a36-b6ed-11f255ed451a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionssnapshots01857129d93296609a/ujavabloblistblobsflatoptionssnapshots4729234ed6390596?blockid=0000&comp=block", + "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" : "99091fa6-f2ea-427c-b0b8-7b60daa4129a", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07800125-801e-001f-5b49-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:00:15 GMT", + "x-ms-client-request-id" : "99091fa6-f2ea-427c-b0b8-7b60daa4129a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionssnapshots01857129d93296609a?include=snapshots&restype=container&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" : "9534abd2-1b3f-4104-a432-0a242f0e7b98" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0780012c-801e-001f-6249-673bbb000000", + "Body" : "ajavabloblistblobsflatoptionssnapshots113515280b4c99352019-09-09T20:00:16.5629859ZMon, 09 Sep 2019 20:00:15 GMTMon, 09 Sep 2019 20:00:15 GMT0x8D7356054C71368512application/octet-stream0PageBlobHottruetrue0ajavabloblistblobsflatoptionssnapshots113515280b4c9935Mon, 09 Sep 2019 20:00:15 GMTMon, 09 Sep 2019 20:00:15 GMT0x8D7356054C71368512application/octet-stream0PageBlobHottrueunlockedavailabletrue0cjavabloblistblobsflatoptionssnapshots22011084c06e9c6cMon, 09 Sep 2019 20:00:15 GMTMon, 09 Sep 2019 20:00:15 GMT0x8D7356054DD3788512application/octet-stream0PageBlobHottrueunlockedavailabletrue0mjavabloblistblobsflatoptionssnapshots308464be9fef087aMon, 09 Sep 2019 20:00:16 GMTMon, 09 Sep 2019 20:00:16 GMT0x8D73560558F6A44512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:00:16 GMT", + "x-ms-client-request-id" : "9534abd2-1b3f-4104-a432-0a242f0e7b98", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobsflatoptionssnapshots&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" : "aead0768-4dd8-46a3-8e54-99396df1d695" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0780014f-801e-001f-0249-673bbb000000", + "Body" : "jtclistblobsflatoptionssnapshotsjtclistblobsflatoptionssnapshots01857129d93296609aMon, 09 Sep 2019 20:00:15 GMT\"0x8D7356054BA18B3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:16 GMT", + "x-ms-client-request-id" : "aead0768-4dd8-46a3-8e54-99396df1d695", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionssnapshots01857129d93296609a?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" : "63d4efc2-1aa8-4b4f-a6a2-cd9c3450a7a7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "07800164-801e-001f-1749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:16 GMT", + "x-ms-client-request-id" : "63d4efc2-1aa8-4b4f-a6a2-cd9c3450a7a7" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatoptionssnapshots01857129d93296609a", "javabloblistblobsflatoptionssnapshots113515280b4c9935", "javabloblistblobsflatoptionssnapshots22011084c06e9c6c", "javabloblistblobsflatoptionssnapshots308464be9fef087a", "javabloblistblobsflatoptionssnapshots4729234ed6390596" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsuncommitted.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsuncommitted.json new file mode 100644 index 000000000000..5a4c780d8760 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatoptionsuncommitted.json @@ -0,0 +1,235 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsuncommitted080769bfe5ba995f3?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" : "e6d58fcb-b0c3-453a-b24d-1da4007e234b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356055E78576\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07800181-801e-001f-3149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:16 GMT", + "x-ms-client-request-id" : "e6d58fcb-b0c3-453a-b24d-1da4007e234b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsuncommitted080769bfe5ba995f3/ajavabloblistblobsflatoptionsuncommitted192321764d69f75", + "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" : "0089d65d-645e-4e22-b4b3-d233b7e06429" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356055F45903\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0780019e-801e-001f-4a49-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:00:16 GMT", + "x-ms-client-request-id" : "0089d65d-645e-4e22-b4b3-d233b7e06429" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsuncommitted080769bfe5ba995f3/cjavabloblistblobsflatoptionsuncommitted26524081ad7416f", + "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" : "dd6e6a27-39fb-4d59-be4b-1ad215fdc37e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "677eb033-1994-4411-95fb-9d630ee9f78c", + "ETag" : "\"0x8D735605606ABEF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "078001b8-801e-001f-6249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:16 GMT", + "x-ms-client-request-id" : "dd6e6a27-39fb-4d59-be4b-1ad215fdc37e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsuncommitted080769bfe5ba995f3/cjavabloblistblobsflatoptionsuncommitted26524081ad7416f", + "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" : "aca5cb5c-5c04-48a3-9c83-c12429fb6ef7" + }, + "Response" : { + "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 20:00:17 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:00:17 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "078001c9-801e-001f-7249-673bbb000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "677eb033-1994-4411-95fb-9d630ee9f78c", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsuncommitted080769bfe5ba995f3/ajavabloblistblobsflatoptionsuncommitted192321764d69f75", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Mon, 09 Sep 2019 20:00:16 GMT", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:00:17 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D735605606ABEF\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "aca5cb5c-5c04-48a3-9c83-c12429fb6ef7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsuncommitted080769bfe5ba995f3/mjavabloblistblobsflatoptionsuncommitted364131ff1d3822c", + "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" : "193c3648-44d9-4e60-83ce-a2fedde695c7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356056B77E90\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0780026a-801e-001f-0649-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:00:17 GMT", + "x-ms-client-request-id" : "193c3648-44d9-4e60-83ce-a2fedde695c7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsuncommitted080769bfe5ba995f3/ajavabloblistblobsflatoptionsuncommitted192321764d69f75?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" : "01eda4fc-eb7e-4311-9d6f-9ca3d80785d0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:00:18.5023721Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356055F45903\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07800275-801e-001f-1049-673bbb000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:00:17 GMT", + "x-ms-client-request-id" : "01eda4fc-eb7e-4311-9d6f-9ca3d80785d0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsuncommitted080769bfe5ba995f3/ujavabloblistblobsflatoptionsuncommitted4200558e082af4b?blockid=0000&comp=block", + "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" : "5616e04c-3875-4cfa-8d88-d0c3c4eda101", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07800283-801e-001f-1d49-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:00:17 GMT", + "x-ms-client-request-id" : "5616e04c-3875-4cfa-8d88-d0c3c4eda101" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsuncommitted080769bfe5ba995f3?include=uncommittedblobs&restype=container&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" : "0c2df876-6cc0-4bae-ae7d-7d8646c61d24" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07800295-801e-001f-2f49-673bbb000000", + "Body" : "ajavabloblistblobsflatoptionsuncommitted192321764d69f75Mon, 09 Sep 2019 20:00:17 GMTMon, 09 Sep 2019 20:00:17 GMT0x8D7356055F45903512application/octet-stream0PageBlobHottrueunlockedavailabletrue0cjavabloblistblobsflatoptionsuncommitted26524081ad7416fMon, 09 Sep 2019 20:00:17 GMTMon, 09 Sep 2019 20:00:17 GMT0x8D735605606ABEF512application/octet-stream0PageBlobHottrueunlockedavailabletrue0mjavabloblistblobsflatoptionsuncommitted364131ff1d3822cMon, 09 Sep 2019 20:00:18 GMTMon, 09 Sep 2019 20:00:18 GMT0x8D7356056B77E90512application/octet-stream0PageBlobHottrueunlockedavailabletrue0ujavabloblistblobsflatoptionsuncommitted4200558e082af4b0BlockBlobHottrueunlockedavailablefalse0", + "Date" : "Mon, 09 Sep 2019 20:00:17 GMT", + "x-ms-client-request-id" : "0c2df876-6cc0-4bae-ae7d-7d8646c61d24", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobsflatoptionsuncommitted&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" : "a9bdfe04-8f7b-4213-9a1f-d23c4f35ca97" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "078002ac-801e-001f-4549-673bbb000000", + "Body" : "jtclistblobsflatoptionsuncommittedjtclistblobsflatoptionsuncommitted080769bfe5ba995f3Mon, 09 Sep 2019 20:00:17 GMT\"0x8D7356055E78576\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:18 GMT", + "x-ms-client-request-id" : "a9bdfe04-8f7b-4213-9a1f-d23c4f35ca97", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatoptionsuncommitted080769bfe5ba995f3?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" : "e0ef18e6-def3-4c87-8a02-588ba9767d2f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "078002b6-801e-001f-4d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:18 GMT", + "x-ms-client-request-id" : "e0ef18e6-def3-4c87-8a02-588ba9767d2f" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatoptionsuncommitted080769bfe5ba995f3", "javabloblistblobsflatoptionsuncommitted192321764d69f75", "javabloblistblobsflatoptionsuncommitted26524081ad7416f", "javabloblistblobsflatoptionsuncommitted364131ff1d3822c", "javabloblistblobsflatoptionsuncommitted4200558e082af4b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatsimple.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatsimple.json new file mode 100644 index 000000000000..8bd950a8f08e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatsimple.json @@ -0,0 +1,369 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatsimple07165734bfa568a88c4ac49?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" : "9a96f5bc-56a9-4c6c-a5ed-d73dc5e98f08" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560ACE96D6B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9ce6f-301e-0042-3749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:42 GMT", + "x-ms-client-request-id" : "9a96f5bc-56a9-4c6c-a5ed-d73dc5e98f08" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatsimple07165734bfa568a88c4ac49/javabloblistblobsflatsimple103345febc2a7e55a24e4", + "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" : "0b719fc4-c24a-4669-a43d-e328f1827ed2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560ACF6ADCE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9ce83-301e-0042-4749-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:42 GMT", + "x-ms-client-request-id" : "0b719fc4-c24a-4669-a43d-e328f1827ed2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatsimple07165734bfa568a88c4ac49/javabloblistblobsflatsimple2645831f52ca54312c40d", + "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" : "9fa639af-ce54-43dc-899b-0e1d305ebd22" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AD03A87F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9ce9f-301e-0042-6149-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:42 GMT", + "x-ms-client-request-id" : "9fa639af-ce54-43dc-899b-0e1d305ebd22" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatsimple07165734bfa568a88c4ac49/javabloblistblobsflatsimple3020708e5ffc37620a43e", + "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" : "f96a067a-e2e5-4bbd-96d0-4399355bda41" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AD10CA4D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9ceb4-301e-0042-7549-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:42 GMT", + "x-ms-client-request-id" : "f96a067a-e2e5-4bbd-96d0-4399355bda41" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatsimple07165734bfa568a88c4ac49/javabloblistblobsflatsimple4921202e9f021798ca456", + "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" : "a028ba19-7407-44ea-873b-45518d0d3c3c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AD1DC4FE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9cec4-301e-0042-0149-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:42 GMT", + "x-ms-client-request-id" : "a028ba19-7407-44ea-873b-45518d0d3c3c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatsimple07165734bfa568a88c4ac49/javabloblistblobsflatsimple5481766a7641ae8cc8498", + "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" : "57d944fa-7400-4fb2-9d90-af5c96506681" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AD2ABFAE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9cee1-301e-0042-1d49-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:42 GMT", + "x-ms-client-request-id" : "57d944fa-7400-4fb2-9d90-af5c96506681" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatsimple07165734bfa568a88c4ac49/javabloblistblobsflatsimple621299d2c2a08aa7a14d7", + "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" : "f795cf77-380c-42e5-9fcd-d48fa541b084" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AD37934A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9ceff-301e-0042-3b49-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:42 GMT", + "x-ms-client-request-id" : "f795cf77-380c-42e5-9fcd-d48fa541b084" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatsimple07165734bfa568a88c4ac49/javabloblistblobsflatsimple700846c2c53a2ee7304be", + "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" : "b75d38b5-4ffb-4db8-b78a-5c45e03a517f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AD4466E5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9cf15-301e-0042-4f49-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:42 GMT", + "x-ms-client-request-id" : "b75d38b5-4ffb-4db8-b78a-5c45e03a517f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatsimple07165734bfa568a88c4ac49/javabloblistblobsflatsimple8333803f12e249367d4fa", + "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" : "5ecc7277-ae96-4e69-81dc-b47739c38003" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AD5188AF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9cf27-301e-0042-6149-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:42 GMT", + "x-ms-client-request-id" : "5ecc7277-ae96-4e69-81dc-b47739c38003" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatsimple07165734bfa568a88c4ac49/javabloblistblobsflatsimple968956ac4266638cba45b", + "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" : "1bac5031-ffaf-454d-81f0-ce8a29f18d94" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AD5EAA75\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9cf3a-301e-0042-7149-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:42 GMT", + "x-ms-client-request-id" : "1bac5031-ffaf-454d-81f0-ce8a29f18d94" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatsimple07165734bfa568a88c4ac49/javabloblistblobsflatsimple10008974b2ce78a167b41", + "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" : "93632dbf-0de4-4557-bd21-a14496843c28" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AD6C1A71\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9cf60-301e-0042-0f49-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:43 GMT", + "x-ms-client-request-id" : "93632dbf-0de4-4557-bd21-a14496843c28" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatsimple07165734bfa568a88c4ac49?maxresults=3&include=&restype=container&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" : "1a2d386d-bda4-42f1-9d24-019f70fc59df" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9cf78-301e-0042-2649-67cbbf000000", + "Body" : "3javabloblistblobsflatsimple10008974b2ce78a167b41Mon, 09 Sep 2019 20:02:43 GMTMon, 09 Sep 2019 20:02:43 GMT0x8D73560AD6C1A71512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatsimple103345febc2a7e55a24e4Mon, 09 Sep 2019 20:02:43 GMTMon, 09 Sep 2019 20:02:43 GMT0x8D73560ACF6ADCE512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatsimple2645831f52ca54312c40dMon, 09 Sep 2019 20:02:43 GMTMon, 09 Sep 2019 20:02:43 GMT0x8D73560AD03A87F512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTMwMjA3MDhlNWZmYzM3NjIwYTQzZSEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Mon, 09 Sep 2019 20:02:43 GMT", + "x-ms-client-request-id" : "1a2d386d-bda4-42f1-9d24-019f70fc59df", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatsimple07165734bfa568a88c4ac49?marker=2%21124%21MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTMwMjA3MDhlNWZmYzM3NjIwYTQzZSEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&maxresults=3&include=&restype=container&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" : "a5d1a7e3-cac9-4db9-ba9d-47253841ab28" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9cfa0-301e-0042-4b49-67cbbf000000", + "Body" : "2!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTMwMjA3MDhlNWZmYzM3NjIwYTQzZSEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-3javabloblistblobsflatsimple3020708e5ffc37620a43eMon, 09 Sep 2019 20:02:43 GMTMon, 09 Sep 2019 20:02:43 GMT0x8D73560AD10CA4D512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatsimple4921202e9f021798ca456Mon, 09 Sep 2019 20:02:43 GMTMon, 09 Sep 2019 20:02:43 GMT0x8D73560AD1DC4FE512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatsimple5481766a7641ae8cc8498Mon, 09 Sep 2019 20:02:43 GMTMon, 09 Sep 2019 20:02:43 GMT0x8D73560AD2ABFAE512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTYyMTI5OWQyYzJhMDhhYTdhMTRkNyEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Mon, 09 Sep 2019 20:02:43 GMT", + "x-ms-client-request-id" : "a5d1a7e3-cac9-4db9-ba9d-47253841ab28", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatsimple07165734bfa568a88c4ac49?marker=2%21124%21MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTYyMTI5OWQyYzJhMDhhYTdhMTRkNyEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&maxresults=3&include=&restype=container&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" : "2e64cbc2-d026-4c6a-902b-8abbd3722446" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9cfd6-301e-0042-7649-67cbbf000000", + "Body" : "2!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTYyMTI5OWQyYzJhMDhhYTdhMTRkNyEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-3javabloblistblobsflatsimple621299d2c2a08aa7a14d7Mon, 09 Sep 2019 20:02:43 GMTMon, 09 Sep 2019 20:02:43 GMT0x8D73560AD37934A512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatsimple700846c2c53a2ee7304beMon, 09 Sep 2019 20:02:43 GMTMon, 09 Sep 2019 20:02:43 GMT0x8D73560AD4466E5512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobsflatsimple8333803f12e249367d4faMon, 09 Sep 2019 20:02:43 GMTMon, 09 Sep 2019 20:02:43 GMT0x8D73560AD5188AF512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTk2ODk1NmFjNDI2NjYzOGNiYTQ1YiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Mon, 09 Sep 2019 20:02:43 GMT", + "x-ms-client-request-id" : "2e64cbc2-d026-4c6a-902b-8abbd3722446", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatsimple07165734bfa568a88c4ac49?marker=2%21124%21MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTk2ODk1NmFjNDI2NjYzOGNiYTQ1YiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&maxresults=3&include=&restype=container&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" : "510e7467-8a4e-42b6-9253-8157e492014a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9d00d-301e-0042-2849-67cbbf000000", + "Body" : "2!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzZmxhdHNpbXBsZTk2ODk1NmFjNDI2NjYzOGNiYTQ1YiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-3javabloblistblobsflatsimple968956ac4266638cba45bMon, 09 Sep 2019 20:02:43 GMTMon, 09 Sep 2019 20:02:43 GMT0x8D73560AD5EAA75512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:02:43 GMT", + "x-ms-client-request-id" : "510e7467-8a4e-42b6-9253-8157e492014a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobsflatsimple&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" : "f9c3a246-5bb3-4105-9314-223fdaf822f1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9d019-301e-0042-3449-67cbbf000000", + "Body" : "jtclistblobsflatsimplejtclistblobsflatsimple07165734bfa568a88c4ac49Mon, 09 Sep 2019 20:02:43 GMT\"0x8D73560ACE96D6B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:02:43 GMT", + "x-ms-client-request-id" : "f9c3a246-5bb3-4105-9314-223fdaf822f1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatsimple07165734bfa568a88c4ac49?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" : "aee2af15-76a0-4ed8-86a0-57af56841510" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9d02a-301e-0042-4449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:43 GMT", + "x-ms-client-request-id" : "aee2af15-76a0-4ed8-86a0-57af56841510" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatsimple07165734bfa568a88c4ac49", "javabloblistblobsflatsimple103345febc2a7e55a24e4", "javabloblistblobsflatsimple2645831f52ca54312c40d", "javabloblistblobsflatsimple3020708e5ffc37620a43e", "javabloblistblobsflatsimple4921202e9f021798ca456", "javabloblistblobsflatsimple5481766a7641ae8cc8498", "javabloblistblobsflatsimple621299d2c2a08aa7a14d7", "javabloblistblobsflatsimple700846c2c53a2ee7304be", "javabloblistblobsflatsimple8333803f12e249367d4fa", "javabloblistblobsflatsimple968956ac4266638cba45b", "javabloblistblobsflatsimple10008974b2ce78a167b41" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatwithtimeoutstillbackedbypagedflux.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatwithtimeoutstillbackedbypagedflux.json new file mode 100644 index 000000000000..dc445be8fe86 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobsflatwithtimeoutstillbackedbypagedflux.json @@ -0,0 +1,232 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0503408067?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" : "88ffb62f-db1e-4c20-abb7-25e719f43405" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735607F59CE27\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07803525-801e-001f-1749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:25 GMT", + "x-ms-client-request-id" : "88ffb62f-db1e-4c20-abb7-25e719f43405" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0503408067/javabloblistblobsflatwithtimeoutstillbackedbypagedflux181380a", + "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" : "b2dad5c0-457c-4203-8942-c651bc25bd87", + "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 20:01:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735607F6C20FD\"", + "Content-Length" : "0", + "x-ms-request-id" : "0780353a-801e-001f-2749-673bbb000000", + "x-ms-client-request-id" : "b2dad5c0-457c-4203-8942-c651bc25bd87" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0503408067/javabloblistblobsflatwithtimeoutstillbackedbypagedflux2708672", + "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" : "38de68fd-5b45-495b-9027-8f01737315c8", + "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 20:01:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:25 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735607F7A7B7A\"", + "Content-Length" : "0", + "x-ms-request-id" : "07803548-801e-001f-3549-673bbb000000", + "x-ms-client-request-id" : "38de68fd-5b45-495b-9027-8f01737315c8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0503408067/javabloblistblobsflatwithtimeoutstillbackedbypagedflux3474811", + "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" : "f2e2459a-1882-4817-8249-7e595695d08e", + "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 20:01:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735607F88D600\"", + "Content-Length" : "0", + "x-ms-request-id" : "07803554-801e-001f-4149-673bbb000000", + "x-ms-client-request-id" : "f2e2459a-1882-4817-8249-7e595695d08e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0503408067/javabloblistblobsflatwithtimeoutstillbackedbypagedflux4739965", + "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" : "60b78eda-0e27-4c50-99c0-ddc771ca136c", + "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 20:01:26 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735607F9645E5\"", + "Content-Length" : "0", + "x-ms-request-id" : "07803565-801e-001f-5049-673bbb000000", + "x-ms-client-request-id" : "60b78eda-0e27-4c50-99c0-ddc771ca136c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0503408067/javabloblistblobsflatwithtimeoutstillbackedbypagedflux532641d", + "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" : "4a54be4a-b25f-472c-b35d-aa848d4fd3ea", + "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 20:01:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735607FA2F278\"", + "Content-Length" : "0", + "x-ms-request-id" : "07803574-801e-001f-5e49-673bbb000000", + "x-ms-client-request-id" : "4a54be4a-b25f-472c-b35d-aa848d4fd3ea" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0503408067?maxresults=3&include=&restype=container&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" : "2e66d16e-33d0-411d-b10d-bab20bc1d04e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07803582-801e-001f-6a49-673bbb000000", + "Body" : "3javabloblistblobsflatwithtimeoutstillbackedbypagedflux181380aMon, 09 Sep 2019 20:01:26 GMTMon, 09 Sep 2019 20:01:26 GMT0x8D735607F6C20FD7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0javabloblistblobsflatwithtimeoutstillbackedbypagedflux2708672Mon, 09 Sep 2019 20:01:26 GMTMon, 09 Sep 2019 20:01:26 GMT0x8D735607F7A7B7A7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0javabloblistblobsflatwithtimeoutstillbackedbypagedflux3474811Mon, 09 Sep 2019 20:01:26 GMTMon, 09 Sep 2019 20:01:26 GMT0x8D735607F88D6007application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue02!140!MDAwMDYxIWphdmFibG9ibGlzdGJsb2JzZmxhdHdpdGh0aW1lb3V0c3RpbGxiYWNrZWRieXBhZ2VkZmx1eDQ3Mzk5NjUhMDAwMDI4ITk5OTktMTItMzFUMjM6NTk6NTkuOTk5OTk5OVoh", + "Date" : "Mon, 09 Sep 2019 20:01:26 GMT", + "x-ms-client-request-id" : "2e66d16e-33d0-411d-b10d-bab20bc1d04e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0503408067?marker=2%21140%21MDAwMDYxIWphdmFibG9ibGlzdGJsb2JzZmxhdHdpdGh0aW1lb3V0c3RpbGxiYWNrZWRieXBhZ2VkZmx1eDQ3Mzk5NjUhMDAwMDI4ITk5OTktMTItMzFUMjM6NTk6NTkuOTk5OTk5OVoh&maxresults=3&include=&restype=container&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" : "0e260490-cb5e-48d1-94f7-9bdb989156ca" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07803597-801e-001f-7c49-673bbb000000", + "Body" : "2!140!MDAwMDYxIWphdmFibG9ibGlzdGJsb2JzZmxhdHdpdGh0aW1lb3V0c3RpbGxiYWNrZWRieXBhZ2VkZmx1eDQ3Mzk5NjUhMDAwMDI4ITk5OTktMTItMzFUMjM6NTk6NTkuOTk5OTk5OVoh3javabloblistblobsflatwithtimeoutstillbackedbypagedflux4739965Mon, 09 Sep 2019 20:01:26 GMTMon, 09 Sep 2019 20:01:26 GMT0x8D735607F9645E57application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0javabloblistblobsflatwithtimeoutstillbackedbypagedflux532641dMon, 09 Sep 2019 20:01:27 GMTMon, 09 Sep 2019 20:01:27 GMT0x8D735607FA2F2787application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:01:26 GMT", + "x-ms-client-request-id" : "0e260490-cb5e-48d1-94f7-9bdb989156ca", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobsflatwithtimeoutstillbackedbypagedflux&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" : "de10c109-4af6-4a1e-8de9-4c76c693facf" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "078035a9-801e-001f-0b49-673bbb000000", + "Body" : "jtclistblobsflatwithtimeoutstillbackedbypagedfluxjtclistblobsflatwithtimeoutstillbackedbypagedflux0503408067Mon, 09 Sep 2019 20:01:26 GMT\"0x8D735607F59CE27\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:01:26 GMT", + "x-ms-client-request-id" : "de10c109-4af6-4a1e-8de9-4c76c693facf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobsflatwithtimeoutstillbackedbypagedflux0503408067?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" : "e6ce303b-baa8-49a1-8e73-3cc8a26d8fdb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "078035b2-801e-001f-1449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:26 GMT", + "x-ms-client-request-id" : "e6ce303b-baa8-49a1-8e73-3cc8a26d8fdb" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobsflatwithtimeoutstillbackedbypagedflux0503408067", "javabloblistblobsflatwithtimeoutstillbackedbypagedflux181380a", "javabloblistblobsflatwithtimeoutstillbackedbypagedflux2708672", "javabloblistblobsflatwithtimeoutstillbackedbypagedflux3474811", "javabloblistblobsflatwithtimeoutstillbackedbypagedflux4739965", "javabloblistblobsflatwithtimeoutstillbackedbypagedflux532641d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierarchy.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierarchy.json new file mode 100644 index 000000000000..2708e3634f5b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierarchy.json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierarchy0186911fd04b46c70a4eb8a2?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" : "014236ab-ccc4-41c0-b89e-80e59c0f60bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735608084F011\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07803669-801e-001f-3449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:27 GMT", + "x-ms-client-request-id" : "014236ab-ccc4-41c0-b89e-80e59c0f60bf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierarchy0186911fd04b46c70a4eb8a2/javabloblistblobshierarchy181531b834ff51100843b", + "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" : "a85297e8-6572-4a25-8aa5-e66082bb4825" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735608091EABB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0780367a-801e-001f-4049-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:27 GMT", + "x-ms-client-request-id" : "a85297e8-6572-4a25-8aa5-e66082bb4825" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierarchy0186911fd04b46c70a4eb8a2?delimiter=/&include=&restype=container&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" : "8210ab1a-f366-46c7-ab05-4fcb33cffa98" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07803695-801e-001f-5949-673bbb000000", + "Body" : "/javabloblistblobshierarchy181531b834ff51100843bMon, 09 Sep 2019 20:01:28 GMTMon, 09 Sep 2019 20:01:28 GMT0x8D735608091EABB512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:01:27 GMT", + "x-ms-client-request-id" : "8210ab1a-f366-46c7-ab05-4fcb33cffa98", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobshierarchy&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" : "2de7987f-66a9-4837-a490-c8a8a6b0206e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "078036ac-801e-001f-6e49-673bbb000000", + "Body" : "jtclistblobshierarchyjtclistblobshierarchy0186911fd04b46c70a4eb8a2Mon, 09 Sep 2019 20:01:28 GMT\"0x8D735608084F011\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:01:27 GMT", + "x-ms-client-request-id" : "2de7987f-66a9-4837-a490-c8a8a6b0206e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierarchy0186911fd04b46c70a4eb8a2?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" : "74f8abe1-f19e-4bc0-b280-fa2ddb8a654b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "078036bf-801e-001f-7f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:28 GMT", + "x-ms-client-request-id" : "74f8abe1-f19e-4bc0-b280-fa2ddb8a654b" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshierarchy0186911fd04b46c70a4eb8a2", "javabloblistblobshierarchy181531b834ff51100843b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierarchymin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierarchymin.json new file mode 100644 index 000000000000..b343451e9206 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierarchymin.json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierarchymin099667087a9157a91749c4?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" : "6cdf513f-04c0-47f7-a77e-9ddac3330544" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356080C6239E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078036ca-801e-001f-0949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:28 GMT", + "x-ms-client-request-id" : "6cdf513f-04c0-47f7-a77e-9ddac3330544" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierarchymin099667087a9157a91749c4?prefix=/&delimiter=/&include=&restype=container&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" : "44ec1649-a76e-491e-a95b-98419e0f8eca" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "078036db-801e-001f-1649-673bbb000000", + "Body" : "//", + "Date" : "Mon, 09 Sep 2019 20:01:28 GMT", + "x-ms-client-request-id" : "44ec1649-a76e-491e-a95b-98419e0f8eca", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobshierarchymin&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" : "2b298b92-8dea-40e4-8259-30e6ef8636e1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "078036e9-801e-001f-2449-673bbb000000", + "Body" : "jtclistblobshierarchyminjtclistblobshierarchymin099667087a9157a91749c4Mon, 09 Sep 2019 20:01:28 GMT\"0x8D7356080C6239E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:01:28 GMT", + "x-ms-client-request-id" : "2b298b92-8dea-40e4-8259-30e6ef8636e1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierarchymin099667087a9157a91749c4?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" : "dcf91e54-55af-4255-af9f-1eae1049aed9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "078036f2-801e-001f-2d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:28 GMT", + "x-ms-client-request-id" : "dcf91e54-55af-4255-af9f-1eae1049aed9" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshierarchymin099667087a9157a91749c4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierdelim.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierdelim.json new file mode 100644 index 000000000000..ca55232db443 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierdelim.json @@ -0,0 +1,240 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierdelim03805988ad9e71b5f04c3ba8?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" : "8e28863b-8613-4aea-bb31-13905ee131ad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AB5EF5A4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0780668d-801e-001f-5e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:02:40 GMT", + "x-ms-client-request-id" : "8e28863b-8613-4aea-bb31-13905ee131ad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierdelim03805988ad9e71b5f04c3ba8/a", + "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" : "91201930-2a93-454d-859a-2d3960686345" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AB6CDADE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078066a5-801e-001f-7549-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:40 GMT", + "x-ms-client-request-id" : "91201930-2a93-454d-859a-2d3960686345" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierdelim03805988ad9e71b5f04c3ba8/b/a", + "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" : "d83af068-0ea5-4bdc-ad28-228b6b076fe2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AB7AC013\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078066b3-801e-001f-0249-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:40 GMT", + "x-ms-client-request-id" : "d83af068-0ea5-4bdc-ad28-228b6b076fe2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierdelim03805988ad9e71b5f04c3ba8/c", + "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" : "af3617ce-1eae-457d-82de-114480682fb2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AB887E2F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078066bd-801e-001f-0c49-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:40 GMT", + "x-ms-client-request-id" : "af3617ce-1eae-457d-82de-114480682fb2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierdelim03805988ad9e71b5f04c3ba8/d/a", + "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" : "c7ccc845-e304-41fe-bb7a-ec16ba562746" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AB963C54\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078066c5-801e-001f-1449-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:40 GMT", + "x-ms-client-request-id" : "c7ccc845-e304-41fe-bb7a-ec16ba562746" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierdelim03805988ad9e71b5f04c3ba8/e", + "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" : "2dccf2d3-b05c-4542-8fc7-b163fb7bea28" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560ABA4489F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078066d4-801e-001f-2249-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:40 GMT", + "x-ms-client-request-id" : "2dccf2d3-b05c-4542-8fc7-b163fb7bea28" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierdelim03805988ad9e71b5f04c3ba8/f", + "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" : "c962cff9-b76d-4c4b-be17-176a8367ae37" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560ABB11C39\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078066e4-801e-001f-3149-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:40 GMT", + "x-ms-client-request-id" : "c962cff9-b76d-4c4b-be17-176a8367ae37" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierdelim03805988ad9e71b5f04c3ba8/g/a", + "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" : "6a706a4a-5ac0-4c87-8fba-556412af4174" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560ABBE174C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078066ee-801e-001f-3b49-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:41 GMT", + "x-ms-client-request-id" : "6a706a4a-5ac0-4c87-8fba-556412af4174" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierdelim03805988ad9e71b5f04c3ba8?delimiter=/&include=&restype=container&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" : "9c5c0da5-e930-439e-9a3e-16a42c0a3189" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0780670b-801e-001f-5649-673bbb000000", + "Body" : "/aMon, 09 Sep 2019 20:02:40 GMTMon, 09 Sep 2019 20:02:40 GMT0x8D73560AB6CDADE0application/octet-streamAppendBlobHottrueunlockedavailabletrue0b/cMon, 09 Sep 2019 20:02:40 GMTMon, 09 Sep 2019 20:02:40 GMT0x8D73560AB887E2F0application/octet-streamAppendBlobHottrueunlockedavailabletrue0d/eMon, 09 Sep 2019 20:02:40 GMTMon, 09 Sep 2019 20:02:40 GMT0x8D73560ABA4489F0application/octet-streamAppendBlobHottrueunlockedavailabletrue0fMon, 09 Sep 2019 20:02:40 GMTMon, 09 Sep 2019 20:02:40 GMT0x8D73560ABB11C390application/octet-streamAppendBlobHottrueunlockedavailabletrue0g/", + "Date" : "Mon, 09 Sep 2019 20:02:41 GMT", + "x-ms-client-request-id" : "9c5c0da5-e930-439e-9a3e-16a42c0a3189", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobshierdelim&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" : "1b28bcef-fa8e-4c05-9bb4-93415a7c0cdb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0780672e-801e-001f-7749-673bbb000000", + "Body" : "jtclistblobshierdelimjtclistblobshierdelim03805988ad9e71b5f04c3ba8Mon, 09 Sep 2019 20:02:40 GMT\"0x8D73560AB5EF5A4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:02:41 GMT", + "x-ms-client-request-id" : "1b28bcef-fa8e-4c05-9bb4-93415a7c0cdb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierdelim03805988ad9e71b5f04c3ba8?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" : "43db7873-bec3-4891-b04e-cd4feee84019" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "07806744-801e-001f-0b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:02:41 GMT", + "x-ms-client-request-id" : "43db7873-bec3-4891-b04e-cd4feee84019" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshierdelim03805988ad9e71b5f04c3ba8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshiererror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshiererror.json new file mode 100644 index 000000000000..6f6963b6f750 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshiererror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshiererror05552311b2ccf7fd7c4193be?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" : "a2f26617-ac0c-4eec-a2e5-5e5cf1c719fa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560ADE623B2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9d03e-301e-0042-5749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:43 GMT", + "x-ms-client-request-id" : "a2f26617-ac0c-4eec-a2e5-5e5cf1c719fa" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshiererror176557780ca5cbfe494b0e8b?prefix=.&delimiter=/&include=&restype=container&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" : "8b114a66-d175-400d-a3aa-86d1443e2d2f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "c5c9d05f-301e-0042-7649-67cbbf000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:c5c9d05f-301e-0042-7649-67cbbf000000\nTime:2019-09-09T20:02:44.7808513Z", + "Date" : "Mon, 09 Sep 2019 20:02:43 GMT", + "x-ms-client-request-id" : "8b114a66-d175-400d-a3aa-86d1443e2d2f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobshiererror&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" : "47ad0f31-979b-4ced-bad2-527c1bce81c6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9d074-301e-0042-0749-67cbbf000000", + "Body" : "jtclistblobshiererrorjtclistblobshiererror05552311b2ccf7fd7c4193beMon, 09 Sep 2019 20:02:44 GMT\"0x8D73560ADE623B2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:02:44 GMT", + "x-ms-client-request-id" : "47ad0f31-979b-4ced-bad2-527c1bce81c6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshiererror05552311b2ccf7fd7c4193be?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" : "d7202898-b147-4624-9635-ed1b7ffb8d33" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9d09a-301e-0042-2a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:44 GMT", + "x-ms-client-request-id" : "d7202898-b147-4624-9635-ed1b7ffb8d33" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshiererror05552311b2ccf7fd7c4193be", "jtclistblobshiererror176557780ca5cbfe494b0e8b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshiermarker.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshiermarker.json new file mode 100644 index 000000000000..8c551983bab1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshiermarker.json @@ -0,0 +1,348 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshiermarker0823223fa6034504be46f99?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" : "6fe68f05-a023-4b88-889a-06e0811f74ba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AC019748\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07806753-801e-001f-1a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:02:41 GMT", + "x-ms-client-request-id" : "6fe68f05-a023-4b88-889a-06e0811f74ba" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshiermarker0823223fa6034504be46f99/javabloblistblobshiermarker1467814452179f1a044f9", + "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" : "217fc145-71db-4294-a5d5-3f1d7e5e5240" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AC0FF237\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0780675f-801e-001f-2449-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:41 GMT", + "x-ms-client-request-id" : "217fc145-71db-4294-a5d5-3f1d7e5e5240" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshiermarker0823223fa6034504be46f99/javabloblistblobshiermarker2558114ed7aadaf04e408", + "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" : "3d902ef6-181e-4697-8170-044740de5965" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AC1E260D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07806772-801e-001f-3449-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:41 GMT", + "x-ms-client-request-id" : "3d902ef6-181e-4697-8170-044740de5965" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshiermarker0823223fa6034504be46f99/javabloblistblobshiermarker3164743357ba57e25f45e", + "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" : "9f008a34-2ad3-4c31-90af-723ad069533e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AC2B6F54\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0780677d-801e-001f-3f49-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:41 GMT", + "x-ms-client-request-id" : "9f008a34-2ad3-4c31-90af-723ad069533e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshiermarker0823223fa6034504be46f99/javabloblistblobshiermarker44463786bf055a98254f0", + "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" : "f6c7e9f9-cac1-4748-b57a-904607e0457f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AC397C13\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0780679a-801e-001f-5549-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:41 GMT", + "x-ms-client-request-id" : "f6c7e9f9-cac1-4748-b57a-904607e0457f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshiermarker0823223fa6034504be46f99/javabloblistblobshiermarker548652840ff647a48a4f2", + "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" : "8a5eb227-bbea-4a03-941f-4ad0979e4502" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AC473AA1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078067b6-801e-001f-6f49-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:41 GMT", + "x-ms-client-request-id" : "8a5eb227-bbea-4a03-941f-4ad0979e4502" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshiermarker0823223fa6034504be46f99/javabloblistblobshiermarker69908548f0991a4ef14d2", + "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" : "7d757aaa-ff3c-4c18-97ae-f0fcba48d9c2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AC57DF9E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078067d1-801e-001f-0a49-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:42 GMT", + "x-ms-client-request-id" : "7d757aaa-ff3c-4c18-97ae-f0fcba48d9c2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshiermarker0823223fa6034504be46f99/javabloblistblobshiermarker79201069748851aa924cf", + "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" : "87162d47-c3bb-415a-ad07-088da1984694" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AC65287D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078067ec-801e-001f-2349-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:42 GMT", + "x-ms-client-request-id" : "87162d47-c3bb-415a-ad07-088da1984694" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshiermarker0823223fa6034504be46f99/javabloblistblobshiermarker868229e12861674f1b479", + "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" : "d50ed428-b9a4-4cc4-8712-f22479f381f6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AC72BF8A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078067fe-801e-001f-3349-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:42 GMT", + "x-ms-client-request-id" : "d50ed428-b9a4-4cc4-8712-f22479f381f6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshiermarker0823223fa6034504be46f99/javabloblistblobshiermarker9345350e74d11605e34d5", + "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" : "a8f0d415-cd7c-4fb9-8d30-31e364ba7a46" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AC80A4CF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0780680e-801e-001f-4149-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:42 GMT", + "x-ms-client-request-id" : "a8f0d415-cd7c-4fb9-8d30-31e364ba7a46" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshiermarker0823223fa6034504be46f99/javabloblistblobshiermarker104761693e7cd4d8e7342", + "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" : "118702fb-0771-4e8b-b393-8e3c43b34328" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AC8EB120\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07806826-801e-001f-5649-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:42 GMT", + "x-ms-client-request-id" : "118702fb-0771-4e8b-b393-8e3c43b34328" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshiermarker0823223fa6034504be46f99?delimiter=/&maxresults=6&include=&restype=container&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" : "11dde4ae-1c95-41d7-8e66-36f67b0db778" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07806833-801e-001f-6349-673bbb000000", + "Body" : "6/javabloblistblobshiermarker104761693e7cd4d8e7342Mon, 09 Sep 2019 20:02:42 GMTMon, 09 Sep 2019 20:02:42 GMT0x8D73560AC8EB120512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker1467814452179f1a044f9Mon, 09 Sep 2019 20:02:41 GMTMon, 09 Sep 2019 20:02:41 GMT0x8D73560AC0FF237512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker2558114ed7aadaf04e408Mon, 09 Sep 2019 20:02:41 GMTMon, 09 Sep 2019 20:02:41 GMT0x8D73560AC1E260D512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker3164743357ba57e25f45eMon, 09 Sep 2019 20:02:41 GMTMon, 09 Sep 2019 20:02:41 GMT0x8D73560AC2B6F54512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker44463786bf055a98254f0Mon, 09 Sep 2019 20:02:41 GMTMon, 09 Sep 2019 20:02:41 GMT0x8D73560AC397C13512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker548652840ff647a48a4f2Mon, 09 Sep 2019 20:02:41 GMTMon, 09 Sep 2019 20:02:41 GMT0x8D73560AC473AA1512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzaGllcm1hcmtlcjY5OTA4NTQ4ZjA5OTFhNGVmMTRkMiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Mon, 09 Sep 2019 20:02:42 GMT", + "x-ms-client-request-id" : "11dde4ae-1c95-41d7-8e66-36f67b0db778", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshiermarker0823223fa6034504be46f99?delimiter=/&marker=2%21124%21MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzaGllcm1hcmtlcjY5OTA4NTQ4ZjA5OTFhNGVmMTRkMiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&maxresults=6&include=&restype=container&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" : "6c563e68-8ce1-4f16-bef9-7af9ad300125" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07806854-801e-001f-7e49-673bbb000000", + "Body" : "2!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzaGllcm1hcmtlcjY5OTA4NTQ4ZjA5OTFhNGVmMTRkMiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-6/javabloblistblobshiermarker69908548f0991a4ef14d2Mon, 09 Sep 2019 20:02:42 GMTMon, 09 Sep 2019 20:02:42 GMT0x8D73560AC57DF9E512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker79201069748851aa924cfMon, 09 Sep 2019 20:02:42 GMTMon, 09 Sep 2019 20:02:42 GMT0x8D73560AC65287D512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker868229e12861674f1b479Mon, 09 Sep 2019 20:02:42 GMTMon, 09 Sep 2019 20:02:42 GMT0x8D73560AC72BF8A512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker9345350e74d11605e34d5Mon, 09 Sep 2019 20:02:42 GMTMon, 09 Sep 2019 20:02:42 GMT0x8D73560AC80A4CF512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:02:42 GMT", + "x-ms-client-request-id" : "6c563e68-8ce1-4f16-bef9-7af9ad300125", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshiermarker0823223fa6034504be46f99?delimiter=/&marker=2%21124%21MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzaGllcm1hcmtlcjY5OTA4NTQ4ZjA5OTFhNGVmMTRkMiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-&maxresults=6&include=&restype=container&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" : "3ded6a43-c55f-4b60-8f9a-139780c0343a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9ce10-301e-0042-5d49-67cbbf000000", + "Body" : "2!124!MDAwMDQ4IWphdmFibG9ibGlzdGJsb2JzaGllcm1hcmtlcjY5OTA4NTQ4ZjA5OTFhNGVmMTRkMiEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-6/javabloblistblobshiermarker69908548f0991a4ef14d2Mon, 09 Sep 2019 20:02:42 GMTMon, 09 Sep 2019 20:02:42 GMT0x8D73560AC57DF9E512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker79201069748851aa924cfMon, 09 Sep 2019 20:02:42 GMTMon, 09 Sep 2019 20:02:42 GMT0x8D73560AC65287D512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker868229e12861674f1b479Mon, 09 Sep 2019 20:02:42 GMTMon, 09 Sep 2019 20:02:42 GMT0x8D73560AC72BF8A512application/octet-stream0PageBlobHottrueunlockedavailabletrue0javabloblistblobshiermarker9345350e74d11605e34d5Mon, 09 Sep 2019 20:02:42 GMTMon, 09 Sep 2019 20:02:42 GMT0x8D73560AC80A4CF512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:02:41 GMT", + "x-ms-client-request-id" : "3ded6a43-c55f-4b60-8f9a-139780c0343a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobshiermarker&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" : "a3b78399-87db-4ca1-82e8-4413f81f5e1e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9ce3f-301e-0042-0949-67cbbf000000", + "Body" : "jtclistblobshiermarkerjtclistblobshiermarker0823223fa6034504be46f99Mon, 09 Sep 2019 20:02:41 GMT\"0x8D73560AC019748\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:02:42 GMT", + "x-ms-client-request-id" : "a3b78399-87db-4ca1-82e8-4413f81f5e1e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshiermarker0823223fa6034504be46f99?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" : "d7cbce54-74b2-4fc3-891b-a700e4348c33" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9ce57-301e-0042-2149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:42 GMT", + "x-ms-client-request-id" : "d7cbce54-74b2-4fc3-891b-a700e4348c33" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshiermarker0823223fa6034504be46f99", "javabloblistblobshiermarker1467814452179f1a044f9", "javabloblistblobshiermarker2558114ed7aadaf04e408", "javabloblistblobshiermarker3164743357ba57e25f45e", "javabloblistblobshiermarker44463786bf055a98254f0", "javabloblistblobshiermarker548652840ff647a48a4f2", "javabloblistblobshiermarker69908548f0991a4ef14d2", "javabloblistblobshiermarker79201069748851aa924cf", "javabloblistblobshiermarker868229e12861674f1b479", "javabloblistblobshiermarker9345350e74d11605e34d5", "javabloblistblobshiermarker104761693e7cd4d8e7342" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionscopy.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionscopy.json new file mode 100644 index 000000000000..3951aca4ff0a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionscopy.json @@ -0,0 +1,235 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionscopy0843899cecde42e081400?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" : "8ca36deb-d014-4284-993b-e6650b85babd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356080F971F5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07803706-801e-001f-3e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:28 GMT", + "x-ms-client-request-id" : "8ca36deb-d014-4284-993b-e6650b85babd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionscopy0843899cecde42e081400/ajavabloblistblobshieroptionscopy15056693a7c836348c", + "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" : "5b5662ec-54b8-4fa3-8ff1-5600f4725ecd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560810CFD84\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07803715-801e-001f-4a49-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:28 GMT", + "x-ms-client-request-id" : "5b5662ec-54b8-4fa3-8ff1-5600f4725ecd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionscopy0843899cecde42e081400/cjavabloblistblobshieroptionscopy281282a13a6989e1c9", + "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" : "333d509f-2d1c-4e63-bc6c-94e0ddfa0b20" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "8e0e1aaa-df75-48ca-8b2a-70ec104e7ae5", + "ETag" : "\"0x8D73560811E17A1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "07803728-801e-001f-5d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:28 GMT", + "x-ms-client-request-id" : "333d509f-2d1c-4e63-bc6c-94e0ddfa0b20" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionscopy0843899cecde42e081400/cjavabloblistblobshieroptionscopy281282a13a6989e1c9", + "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" : "cfced73b-929e-452f-b5bf-31ecc73e06fe" + }, + "Response" : { + "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 20:01:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:01:29 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "07803737-801e-001f-6b49-673bbb000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "8e0e1aaa-df75-48ca-8b2a-70ec104e7ae5", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionscopy0843899cecde42e081400/ajavabloblistblobshieroptionscopy15056693a7c836348c", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Mon, 09 Sep 2019 20:01:28 GMT", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:01:29 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560811E17A1\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "cfced73b-929e-452f-b5bf-31ecc73e06fe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionscopy0843899cecde42e081400/mjavabloblistblobshieroptionscopy333072117d6507d7f1", + "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" : "3148345f-e983-45e2-b4b5-4ecc14defb9c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356081CFD4D5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078037d1-801e-001f-7749-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:29 GMT", + "x-ms-client-request-id" : "3148345f-e983-45e2-b4b5-4ecc14defb9c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionscopy0843899cecde42e081400/ajavabloblistblobshieroptionscopy15056693a7c836348c?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" : "a101c4e1-6044-4f21-aa2d-04a9c9cce472" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:01:30.8319128Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560810CFD84\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078037de-801e-001f-0149-673bbb000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:01:29 GMT", + "x-ms-client-request-id" : "a101c4e1-6044-4f21-aa2d-04a9c9cce472" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionscopy0843899cecde42e081400/ujavabloblistblobshieroptionscopy45848186d0cd49f3fd?blockid=0000&comp=block", + "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" : "ab12cefd-00e0-45aa-9611-04503858f005", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078037f1-801e-001f-1149-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:30 GMT", + "x-ms-client-request-id" : "ab12cefd-00e0-45aa-9611-04503858f005" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionscopy0843899cecde42e081400?delimiter=&include=copy&restype=container&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" : "2b2bce0e-c27f-448f-93fb-f903fb877b0b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07803802-801e-001f-2049-673bbb000000", + "Body" : "ajavabloblistblobshieroptionscopy15056693a7c836348cMon, 09 Sep 2019 20:01:29 GMTMon, 09 Sep 2019 20:01:29 GMT0x8D73560810CFD84512application/octet-stream0PageBlobHottrueunlockedavailabletrue0cjavabloblistblobshieroptionscopy281282a13a6989e1c9Mon, 09 Sep 2019 20:01:29 GMTMon, 09 Sep 2019 20:01:29 GMT0x8D73560811E17A1512application/octet-stream0PageBlobHottrueunlockedavailable8e0e1aaa-df75-48ca-8b2a-70ec104e7ae5https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionscopy0843899cecde42e081400/ajavabloblistblobshieroptionscopy15056693a7c836348csuccess512/512Mon, 09 Sep 2019 20:01:29 GMTtrue0mjavabloblistblobshieroptionscopy333072117d6507d7f1Mon, 09 Sep 2019 20:01:30 GMTMon, 09 Sep 2019 20:01:30 GMT0x8D7356081CFD4D5512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:01:30 GMT", + "x-ms-client-request-id" : "2b2bce0e-c27f-448f-93fb-f903fb877b0b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobshieroptionscopy&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" : "b47ede21-8c0d-4c64-9679-e8b276090ba3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07803827-801e-001f-3f49-673bbb000000", + "Body" : "jtclistblobshieroptionscopyjtclistblobshieroptionscopy0843899cecde42e081400Mon, 09 Sep 2019 20:01:29 GMT\"0x8D7356080F971F5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:01:30 GMT", + "x-ms-client-request-id" : "b47ede21-8c0d-4c64-9679-e8b276090ba3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionscopy0843899cecde42e081400?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" : "54091f62-f9d1-4e90-88aa-4a88915bd03f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0780383d-801e-001f-5149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:30 GMT", + "x-ms-client-request-id" : "54091f62-f9d1-4e90-88aa-4a88915bd03f" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshieroptionscopy0843899cecde42e081400", "javabloblistblobshieroptionscopy15056693a7c836348c", "javabloblistblobshieroptionscopy281282a13a6989e1c9", "javabloblistblobshieroptionscopy333072117d6507d7f1", "javabloblistblobshieroptionscopy45848186d0cd49f3fd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsdeleted.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsdeleted.json new file mode 100644 index 000000000000..60035ceed696 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsdeleted.json @@ -0,0 +1,168 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsdeleted018782d2661cbad7a74?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" : "ec17ce3d-60af-4137-aa93-167891d3e2dd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735608483B2EB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07803b1c-801e-001f-7949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:34 GMT", + "x-ms-client-request-id" : "ec17ce3d-60af-4137-aa93-167891d3e2dd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "ec4fdb41-954b-436c-86b9-b529a36d7956", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "07803b37-801e-001f-1049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:34 GMT", + "x-ms-client-request-id" : "ec4fdb41-954b-436c-86b9-b529a36d7956" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsdeleted018782d2661cbad7a74/javabloblistblobshieroptionsdeleted18715661d52685e92", + "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" : "01487037-9c74-44cb-9661-fb721238cd11" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560967FF4CF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07804e20-801e-001f-2e49-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:04 GMT", + "x-ms-client-request-id" : "01487037-9c74-44cb-9661-fb721238cd11" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsdeleted018782d2661cbad7a74/javabloblistblobshieroptionsdeleted18715661d52685e92", + "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" : "ae4d1c00-8a0c-4afd-96fa-301d78d85acf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-delete-type-permanent" : "false", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "07804e2c-801e-001f-3949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:02:04 GMT", + "x-ms-client-request-id" : "ae4d1c00-8a0c-4afd-96fa-301d78d85acf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsdeleted018782d2661cbad7a74?delimiter=&include=deleted&restype=container&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" : "95a58fda-243f-4f4f-830a-d8b49bae0f68" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07804e3d-801e-001f-4749-673bbb000000", + "Body" : "javabloblistblobshieroptionsdeleted18715661d52685e92trueMon, 09 Sep 2019 20:02:05 GMTMon, 09 Sep 2019 20:02:05 GMT0x8D73560967FF4CF0application/octet-streamAppendBlobHottruetrueMon, 09 Sep 2019 20:02:05 GMT10", + "Date" : "Mon, 09 Sep 2019 20:02:04 GMT", + "x-ms-client-request-id" : "95a58fda-243f-4f4f-830a-d8b49bae0f68", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "0444c965-a3c9-4e0a-b7c1-6c42f91aa7dc", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "07804e47-801e-001f-5149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:02:04 GMT", + "x-ms-client-request-id" : "0444c965-a3c9-4e0a-b7c1-6c42f91aa7dc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobshieroptionsdeleted&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" : "35d5f83d-d0a9-44a4-9a3f-410e111a4ca9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07806355-801e-001f-7149-673bbb000000", + "Body" : "jtclistblobshieroptionsdeletedjtclistblobshieroptionsdeleted018782d2661cbad7a74Mon, 09 Sep 2019 20:01:35 GMT\"0x8D735608483B2EB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:02:35 GMT", + "x-ms-client-request-id" : "35d5f83d-d0a9-44a4-9a3f-410e111a4ca9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsdeleted018782d2661cbad7a74?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" : "1113e9a7-bde1-415e-bdb1-df9ba878c9a8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0780635e-801e-001f-7949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:02:35 GMT", + "x-ms-client-request-id" : "1113e9a7-bde1-415e-bdb1-df9ba878c9a8" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshieroptionsdeleted018782d2661cbad7a74", "javabloblistblobshieroptionsdeleted18715661d52685e92" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsfail[0].json new file mode 100644 index 000000000000..7daf85e9374a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsfail[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsfail01149300e49fc4ab5e4d3?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" : "652286fc-c680-4a8c-98b5-695f904d1175" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AB10EE81\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0780663d-801e-001f-1c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:02:39 GMT", + "x-ms-client-request-id" : "652286fc-c680-4a8c-98b5-695f904d1175" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobshieroptionsfail&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" : "a60c2ded-db65-4d86-b06b-4756454154c4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07806647-801e-001f-2549-673bbb000000", + "Body" : "jtclistblobshieroptionsfailjtclistblobshieroptionsfail01149300e49fc4ab5e4d3Mon, 09 Sep 2019 20:02:39 GMT\"0x8D73560AB10EE81\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:02:39 GMT", + "x-ms-client-request-id" : "a60c2ded-db65-4d86-b06b-4756454154c4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsfail01149300e49fc4ab5e4d3?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" : "f874ee7c-82c6-4c56-9080-54656c8e5404" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "07806655-801e-001f-2f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:02:40 GMT", + "x-ms-client-request-id" : "f874ee7c-82c6-4c56-9080-54656c8e5404" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshieroptionsfail01149300e49fc4ab5e4d3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsfail[1].json new file mode 100644 index 000000000000..6a6b979ef7fb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsfail[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsfail088151c8f154055e40483?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" : "2895c7e8-242a-40bb-82ca-2204ba10bd45" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AB379057\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07806668-801e-001f-3f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:02:40 GMT", + "x-ms-client-request-id" : "2895c7e8-242a-40bb-82ca-2204ba10bd45" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobshieroptionsfail&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" : "1848155e-7f9f-42c1-8a7e-ced3dc5bc4f8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0780667a-801e-001f-4d49-673bbb000000", + "Body" : "jtclistblobshieroptionsfailjtclistblobshieroptionsfail088151c8f154055e40483Mon, 09 Sep 2019 20:02:40 GMT\"0x8D73560AB379057\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:02:40 GMT", + "x-ms-client-request-id" : "1848155e-7f9f-42c1-8a7e-ced3dc5bc4f8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsfail088151c8f154055e40483?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" : "ae2f11c2-35a0-4f5e-8a48-eb54d772aa77" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "07806681-801e-001f-5449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:02:40 GMT", + "x-ms-client-request-id" : "ae2f11c2-35a0-4f5e-8a48-eb54d772aa77" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshieroptionsfail088151c8f154055e40483" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsmaxresults.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsmaxresults.json new file mode 100644 index 000000000000..217c1e31a928 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsmaxresults.json @@ -0,0 +1,235 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsmaxresults030291132e402a1129?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" : "c3d26e99-008c-4608-9aff-854e0b3593d8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560A9EFE091\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078064cd-801e-001f-4c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:02:38 GMT", + "x-ms-client-request-id" : "c3d26e99-008c-4608-9aff-854e0b3593d8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsmaxresults030291132e402a1129/ajavabloblistblobshieroptionsmaxresults134310ae43d70bf", + "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" : "9b663d75-c369-46c7-a636-693996b7ebff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560A9FCDB38\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078064e8-801e-001f-6349-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:38 GMT", + "x-ms-client-request-id" : "9b663d75-c369-46c7-a636-693996b7ebff" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsmaxresults030291132e402a1129/cjavabloblistblobshieroptionsmaxresults273491bfa2a4d73", + "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" : "4191207c-f2dc-4708-9245-2d6830493e06" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "0473ca9f-ee85-465a-a7fb-f90beaaea16f", + "ETag" : "\"0x8D73560AA0E91B1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "078064f4-801e-001f-6c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:02:38 GMT", + "x-ms-client-request-id" : "4191207c-f2dc-4708-9245-2d6830493e06" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsmaxresults030291132e402a1129/cjavabloblistblobshieroptionsmaxresults273491bfa2a4d73", + "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" : "83b1a355-2db9-46ee-a7f0-6db2048efd2a" + }, + "Response" : { + "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 20:02:38 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:02:38 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "07806504-801e-001f-7949-673bbb000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "0473ca9f-ee85-465a-a7fb-f90beaaea16f", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsmaxresults030291132e402a1129/ajavabloblistblobshieroptionsmaxresults134310ae43d70bf", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Mon, 09 Sep 2019 20:02:38 GMT", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:02:38 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560AA0E91B1\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "83b1a355-2db9-46ee-a7f0-6db2048efd2a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsmaxresults030291132e402a1129/mjavabloblistblobshieroptionsmaxresults399111b45e20a34", + "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" : "9f170cff-d003-42bc-a277-46793d63bb72" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560AAC027B5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078065dd-801e-001f-3f49-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:39 GMT", + "x-ms-client-request-id" : "9f170cff-d003-42bc-a277-46793d63bb72" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsmaxresults030291132e402a1129/ajavabloblistblobshieroptionsmaxresults134310ae43d70bf?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" : "64264200-9244-4be3-8372-e13bbdc90fc5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:02:39.5097609Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560A9FCDB38\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078065f1-801e-001f-5049-673bbb000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:02:39 GMT", + "x-ms-client-request-id" : "64264200-9244-4be3-8372-e13bbdc90fc5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsmaxresults030291132e402a1129/ujavabloblistblobshieroptionsmaxresults4270043df531771?blockid=0000&comp=block", + "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" : "9ee0b46e-f165-4536-bf68-0ebfa4133bf9", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0780660b-801e-001f-6a49-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:39 GMT", + "x-ms-client-request-id" : "9ee0b46e-f165-4536-bf68-0ebfa4133bf9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsmaxresults030291132e402a1129?delimiter=&maxresults=1&include=copy%2cuncommittedblobs&restype=container&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" : "3ed36857-09d8-4789-b84a-a1a9e7be6b99" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07806616-801e-001f-7549-673bbb000000", + "Body" : "1ajavabloblistblobshieroptionsmaxresults134310ae43d70bfMon, 09 Sep 2019 20:02:38 GMTMon, 09 Sep 2019 20:02:38 GMT0x8D73560A9FCDB38512application/octet-stream0PageBlobHottrueunlockedavailabletrue02!132!MDAwMDU0IWNqYXZhYmxvYmxpc3RibG9ic2hpZXJvcHRpb25zbWF4cmVzdWx0czI3MzQ5MWJmYTJhNGQ3MyEwMDAwMjghOTk5OS0xMi0zMVQyMzo1OTo1OS45OTk5OTk5WiE-", + "Date" : "Mon, 09 Sep 2019 20:02:39 GMT", + "x-ms-client-request-id" : "3ed36857-09d8-4789-b84a-a1a9e7be6b99", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobshieroptionsmaxresults&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" : "e0a3d491-7ff1-4ee1-8ed3-0260b4c112e1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07806624-801e-001f-0349-673bbb000000", + "Body" : "jtclistblobshieroptionsmaxresultsjtclistblobshieroptionsmaxresults030291132e402a1129Mon, 09 Sep 2019 20:02:38 GMT\"0x8D73560A9EFE091\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:02:39 GMT", + "x-ms-client-request-id" : "e0a3d491-7ff1-4ee1-8ed3-0260b4c112e1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsmaxresults030291132e402a1129?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" : "0b07ec58-ba07-4516-b540-543fc17d03a9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "07806634-801e-001f-1349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:02:39 GMT", + "x-ms-client-request-id" : "0b07ec58-ba07-4516-b540-543fc17d03a9" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshieroptionsmaxresults030291132e402a1129", "javabloblistblobshieroptionsmaxresults134310ae43d70bf", "javabloblistblobshieroptionsmaxresults273491bfa2a4d73", "javabloblistblobshieroptionsmaxresults399111b45e20a34", "javabloblistblobshieroptionsmaxresults4270043df531771" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsmetadata.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsmetadata.json new file mode 100644 index 000000000000..b490c45e032a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsmetadata.json @@ -0,0 +1,235 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsmetadata0333339b27f76a383a4?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" : "569f4a3e-d0ca-45f8-a753-2eb9ae7e4039" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560822DBD46\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07803856-801e-001f-6949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:30 GMT", + "x-ms-client-request-id" : "569f4a3e-d0ca-45f8-a753-2eb9ae7e4039" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsmetadata0333339b27f76a383a4/ajavabloblistblobshieroptionsmetadata1193198e14253f96", + "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" : "b90208e8-b12f-407d-b47c-620d75d11477" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560823A90DB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07803860-801e-001f-7049-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:30 GMT", + "x-ms-client-request-id" : "b90208e8-b12f-407d-b47c-620d75d11477" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsmetadata0333339b27f76a383a4/cjavabloblistblobshieroptionsmetadata2557152f71014632", + "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" : "26bb548d-04ac-4205-a479-0c4c5128deca" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "39aeeebc-f3a0-4dbe-93dc-4bc077b254ae", + "ETag" : "\"0x8D73560824BAAF9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "0780386f-801e-001f-7f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:30 GMT", + "x-ms-client-request-id" : "26bb548d-04ac-4205-a479-0c4c5128deca" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsmetadata0333339b27f76a383a4/cjavabloblistblobshieroptionsmetadata2557152f71014632", + "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" : "84ea7dfd-7e5e-4bf0-8c2c-0c46c8035482" + }, + "Response" : { + "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 20:01:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:01:31 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "07803880-801e-001f-1049-673bbb000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "39aeeebc-f3a0-4dbe-93dc-4bc077b254ae", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsmetadata0333339b27f76a383a4/ajavabloblistblobshieroptionsmetadata1193198e14253f96", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Mon, 09 Sep 2019 20:01:30 GMT", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:01:31 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560824BAAF9\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "84ea7dfd-7e5e-4bf0-8c2c-0c46c8035482" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsmetadata0333339b27f76a383a4/mjavabloblistblobshieroptionsmetadata344199dfeba1b0c3", + "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" : "93f23108-cdcd-478b-a695-fdfeb2a64245" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356082FE79BA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07803974-801e-001f-7449-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:31 GMT", + "x-ms-client-request-id" : "93f23108-cdcd-478b-a695-fdfeb2a64245" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsmetadata0333339b27f76a383a4/ajavabloblistblobshieroptionsmetadata1193198e14253f96?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" : "eb61ddb2-0999-4ad7-a120-7e088c0e0b39" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:01:32.7893051Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560823A90DB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07803983-801e-001f-0349-673bbb000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:01:31 GMT", + "x-ms-client-request-id" : "eb61ddb2-0999-4ad7-a120-7e088c0e0b39" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsmetadata0333339b27f76a383a4/ujavabloblistblobshieroptionsmetadata4220865e11a0751e?blockid=0000&comp=block", + "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" : "d7978265-8a96-4c29-b3f5-114caff59146", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07803995-801e-001f-1449-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:32 GMT", + "x-ms-client-request-id" : "d7978265-8a96-4c29-b3f5-114caff59146" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsmetadata0333339b27f76a383a4?delimiter=&include=metadata&restype=container&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" : "05294055-8d86-440f-be2c-3c331304c800" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "078039b1-801e-001f-2c49-673bbb000000", + "Body" : "ajavabloblistblobshieroptionsmetadata1193198e14253f96Mon, 09 Sep 2019 20:01:31 GMTMon, 09 Sep 2019 20:01:31 GMT0x8D73560823A90DB512application/octet-stream0PageBlobHottrueunlockedavailabletrue0cjavabloblistblobshieroptionsmetadata2557152f71014632Mon, 09 Sep 2019 20:01:31 GMTMon, 09 Sep 2019 20:01:31 GMT0x8D73560824BAAF9512application/octet-stream0PageBlobHottrueunlockedavailabletrue0mjavabloblistblobshieroptionsmetadata344199dfeba1b0c3Mon, 09 Sep 2019 20:01:32 GMTMon, 09 Sep 2019 20:01:32 GMT0x8D7356082FE79BA512application/octet-stream0PageBlobHottrueunlockedavailabletrue0bar", + "Date" : "Mon, 09 Sep 2019 20:01:32 GMT", + "x-ms-client-request-id" : "05294055-8d86-440f-be2c-3c331304c800", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobshieroptionsmetadata&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" : "63d0420a-c05d-4ed2-af61-648d7e50ae58" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "078039cb-801e-001f-4649-673bbb000000", + "Body" : "jtclistblobshieroptionsmetadatajtclistblobshieroptionsmetadata0333339b27f76a383a4Mon, 09 Sep 2019 20:01:31 GMT\"0x8D73560822DBD46\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:01:32 GMT", + "x-ms-client-request-id" : "63d0420a-c05d-4ed2-af61-648d7e50ae58", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsmetadata0333339b27f76a383a4?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" : "9205d73f-b0c3-4e44-a9c6-fda0f2a8a5b4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "078039d9-801e-001f-5449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:32 GMT", + "x-ms-client-request-id" : "9205d73f-b0c3-4e44-a9c6-fda0f2a8a5b4" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshieroptionsmetadata0333339b27f76a383a4", "javabloblistblobshieroptionsmetadata1193198e14253f96", "javabloblistblobshieroptionsmetadata2557152f71014632", "javabloblistblobshieroptionsmetadata344199dfeba1b0c3", "javabloblistblobshieroptionsmetadata4220865e11a0751e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsprefix.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsprefix.json new file mode 100644 index 000000000000..dc83b9992d75 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsprefix.json @@ -0,0 +1,235 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsprefix038972ebaf43402b8d4b?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" : "beab2ec0-ab4b-4be3-94e2-b9e846ca457e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560A8BA5C7F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0780637c-801e-001f-1449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:02:35 GMT", + "x-ms-client-request-id" : "beab2ec0-ab4b-4be3-94e2-b9e846ca457e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsprefix038972ebaf43402b8d4b/ajavabloblistblobshieroptionsprefix12321005d071e2b2c", + "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" : "37110018-ebc8-4500-a10d-0cbfb66a01e6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560A8C7572A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0780638e-801e-001f-2349-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:36 GMT", + "x-ms-client-request-id" : "37110018-ebc8-4500-a10d-0cbfb66a01e6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsprefix038972ebaf43402b8d4b/cjavabloblistblobshieroptionsprefix243488593d5d9555b", + "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" : "58438e4f-29a8-44bd-965c-0795e4dc88ea" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "b71e5caf-4aff-45c9-82ea-6cc959d2dd7c", + "ETag" : "\"0x8D73560A8EFCE1A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "078063aa-801e-001f-3a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:02:36 GMT", + "x-ms-client-request-id" : "58438e4f-29a8-44bd-965c-0795e4dc88ea" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsprefix038972ebaf43402b8d4b/cjavabloblistblobshieroptionsprefix243488593d5d9555b", + "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" : "32054a22-57d7-4a36-be95-64a6d5cc2130" + }, + "Response" : { + "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 20:02:36 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:02:36 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "078063d0-801e-001f-5e49-673bbb000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "b71e5caf-4aff-45c9-82ea-6cc959d2dd7c", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsprefix038972ebaf43402b8d4b/ajavabloblistblobshieroptionsprefix12321005d071e2b2c", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Mon, 09 Sep 2019 20:02:36 GMT", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:02:36 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560A8EFCE1A\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "32054a22-57d7-4a36-be95-64a6d5cc2130" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsprefix038972ebaf43402b8d4b/mjavabloblistblobshieroptionsprefix3284174dbc85defd1", + "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" : "0f683ac2-602f-41ac-9de6-e8758c5a65c0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560A9A1B24C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07806459-801e-001f-6149-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:37 GMT", + "x-ms-client-request-id" : "0f683ac2-602f-41ac-9de6-e8758c5a65c0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsprefix038972ebaf43402b8d4b/ajavabloblistblobshieroptionsprefix12321005d071e2b2c?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" : "779a112c-a88f-4486-9c87-cfe1405531cf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:02:37.6154128Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560A8C7572A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0780646c-801e-001f-7249-673bbb000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:02:37 GMT", + "x-ms-client-request-id" : "779a112c-a88f-4486-9c87-cfe1405531cf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsprefix038972ebaf43402b8d4b/ujavabloblistblobshieroptionsprefix446201c86efc6c057?blockid=0000&comp=block", + "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" : "f00a3892-44ce-4596-93dd-41856392fd35", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07806480-801e-001f-0449-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:02:37 GMT", + "x-ms-client-request-id" : "f00a3892-44ce-4596-93dd-41856392fd35" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsprefix038972ebaf43402b8d4b?prefix=a&delimiter=&include=&restype=container&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" : "4be64622-95d3-4802-ae38-33ebac145881" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07806491-801e-001f-1449-673bbb000000", + "Body" : "aajavabloblistblobshieroptionsprefix12321005d071e2b2cMon, 09 Sep 2019 20:02:36 GMTMon, 09 Sep 2019 20:02:36 GMT0x8D73560A8C7572A512application/octet-stream0PageBlobHottrueunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:02:37 GMT", + "x-ms-client-request-id" : "4be64622-95d3-4802-ae38-33ebac145881", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobshieroptionsprefix&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" : "1d61d289-0302-49a5-b948-11ef08249956" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "078064a2-801e-001f-2549-673bbb000000", + "Body" : "jtclistblobshieroptionsprefixjtclistblobshieroptionsprefix038972ebaf43402b8d4bMon, 09 Sep 2019 20:02:36 GMT\"0x8D73560A8BA5C7F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:02:37 GMT", + "x-ms-client-request-id" : "1d61d289-0302-49a5-b948-11ef08249956", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsprefix038972ebaf43402b8d4b?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" : "387b8cb5-a7af-442a-b673-be0adcd9183c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "078064ba-801e-001f-3a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:02:37 GMT", + "x-ms-client-request-id" : "387b8cb5-a7af-442a-b673-be0adcd9183c" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshieroptionsprefix038972ebaf43402b8d4b", "javabloblistblobshieroptionsprefix12321005d071e2b2c", "javabloblistblobshieroptionsprefix243488593d5d9555b", "javabloblistblobshieroptionsprefix3284174dbc85defd1", "javabloblistblobshieroptionsprefix446201c86efc6c057" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsuncommitted.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsuncommitted.json new file mode 100644 index 000000000000..b837074ad0b4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshieroptionsuncommitted.json @@ -0,0 +1,235 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsuncommitted070837a3a1a8a34e0?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" : "b476fc33-4ae3-478a-861a-a593a2a70dd0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735608358DF2F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078039ea-801e-001f-6549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:32 GMT", + "x-ms-client-request-id" : "b476fc33-4ae3-478a-861a-a593a2a70dd0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsuncommitted070837a3a1a8a34e0/ajavabloblistblobshieroptionsuncommitted190041e4fb707d9", + "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" : "c82afef0-7b81-4b22-a4ec-fb50595e2516" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356083664F22\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078039f8-801e-001f-7249-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:32 GMT", + "x-ms-client-request-id" : "c82afef0-7b81-4b22-a4ec-fb50595e2516" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsuncommitted070837a3a1a8a34e0/cjavabloblistblobshieroptionsuncommitted213364c7b02ea81", + "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" : "145ce2a2-7d10-47bb-b7ef-0e37eb3ded11" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "248c77ec-8b8b-491c-95d5-8b8746953f3a", + "ETag" : "\"0x8D73560837A28DF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "success", + "StatusCode" : "202", + "x-ms-request-id" : "07803a0a-801e-001f-7e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:32 GMT", + "x-ms-client-request-id" : "145ce2a2-7d10-47bb-b7ef-0e37eb3ded11" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsuncommitted070837a3a1a8a34e0/cjavabloblistblobshieroptionsuncommitted213364c7b02ea81", + "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" : "b9e2c683-9900-484f-9097-45e23bf7232e" + }, + "Response" : { + "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 20:01:33 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:01:33 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "07803a1c-801e-001f-0f49-673bbb000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "248c77ec-8b8b-491c-95d5-8b8746953f3a", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsuncommitted070837a3a1a8a34e0/ajavabloblistblobshieroptionsuncommitted190041e4fb707d9", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Mon, 09 Sep 2019 20:01:32 GMT", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:01:33 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560837A28DF\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "b9e2c683-9900-484f-9097-45e23bf7232e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsuncommitted070837a3a1a8a34e0/mjavabloblistblobshieroptionsuncommitted3509034008b723d", + "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" : "89feab2c-d09f-4de0-9250-7e2787b93ca9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560842C342A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07803aba-801e-001f-1f49-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:33 GMT", + "x-ms-client-request-id" : "89feab2c-d09f-4de0-9250-7e2787b93ca9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsuncommitted070837a3a1a8a34e0/ajavabloblistblobshieroptionsuncommitted190041e4fb707d9?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" : "9ad6d0b2-7c1b-4883-ab7a-0cd2d68f75eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:01:34.7707144Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356083664F22\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07803ac4-801e-001f-2949-673bbb000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:01:33 GMT", + "x-ms-client-request-id" : "9ad6d0b2-7c1b-4883-ab7a-0cd2d68f75eb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsuncommitted070837a3a1a8a34e0/ujavabloblistblobshieroptionsuncommitted467543f1728f7ef?blockid=0000&comp=block", + "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" : "1b413e03-6ae7-44ee-98f1-efd82b0dca5d", + "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=", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "07803ad0-801e-001f-3549-673bbb000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:33 GMT", + "x-ms-client-request-id" : "1b413e03-6ae7-44ee-98f1-efd82b0dca5d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsuncommitted070837a3a1a8a34e0?delimiter=&include=uncommittedblobs&restype=container&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" : "5c6232f6-5a31-44a4-8003-5febd41c3120" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07803ad9-801e-001f-3d49-673bbb000000", + "Body" : "ajavabloblistblobshieroptionsuncommitted190041e4fb707d9Mon, 09 Sep 2019 20:01:33 GMTMon, 09 Sep 2019 20:01:33 GMT0x8D7356083664F22512application/octet-stream0PageBlobHottrueunlockedavailabletrue0cjavabloblistblobshieroptionsuncommitted213364c7b02ea81Mon, 09 Sep 2019 20:01:33 GMTMon, 09 Sep 2019 20:01:33 GMT0x8D73560837A28DF512application/octet-stream0PageBlobHottrueunlockedavailabletrue0mjavabloblistblobshieroptionsuncommitted3509034008b723dMon, 09 Sep 2019 20:01:34 GMTMon, 09 Sep 2019 20:01:34 GMT0x8D73560842C342A512application/octet-stream0PageBlobHottrueunlockedavailabletrue0ujavabloblistblobshieroptionsuncommitted467543f1728f7ef0BlockBlobHottrueunlockedavailablefalse0", + "Date" : "Mon, 09 Sep 2019 20:01:34 GMT", + "x-ms-client-request-id" : "5c6232f6-5a31-44a4-8003-5febd41c3120", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobshieroptionsuncommitted&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" : "e5a04f7d-d6f7-40df-bbb7-79b4790ae773" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07803afd-801e-001f-5b49-673bbb000000", + "Body" : "jtclistblobshieroptionsuncommittedjtclistblobshieroptionsuncommitted070837a3a1a8a34e0Mon, 09 Sep 2019 20:01:33 GMT\"0x8D735608358DF2F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:01:34 GMT", + "x-ms-client-request-id" : "e5a04f7d-d6f7-40df-bbb7-79b4790ae773", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshieroptionsuncommitted070837a3a1a8a34e0?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" : "10645f29-530b-4a89-b558-2125b71d8b96" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "07803b10-801e-001f-6d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:34 GMT", + "x-ms-client-request-id" : "10645f29-530b-4a89-b558-2125b71d8b96" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshieroptionsuncommitted070837a3a1a8a34e0", "javabloblistblobshieroptionsuncommitted190041e4fb707d9", "javabloblistblobshieroptionsuncommitted213364c7b02ea81", "javabloblistblobshieroptionsuncommitted3509034008b723d", "javabloblistblobshieroptionsuncommitted467543f1728f7ef" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierwithtimeoutstillbackedbypagedflux.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierwithtimeoutstillbackedbypagedflux.json new file mode 100644 index 000000000000..e6b63eb02682 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestlistblobshierwithtimeoutstillbackedbypagedflux.json @@ -0,0 +1,232 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux087856d962?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" : "b2f12809-1b3a-49d1-978b-05fa2ba6dc1f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735607FEEAF35\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:01:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "078035c0-801e-001f-2049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:26 GMT", + "x-ms-client-request-id" : "b2f12809-1b3a-49d1-978b-05fa2ba6dc1f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux087856d962/javabloblistblobshierwithtimeoutstillbackedbypagedflux168601e", + "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" : "0e47a8e7-fe20-44f9-b627-1c526263210d", + "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 20:01:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735607FFBA9E0\"", + "Content-Length" : "0", + "x-ms-request-id" : "078035ca-801e-001f-2949-673bbb000000", + "x-ms-client-request-id" : "0e47a8e7-fe20-44f9-b627-1c526263210d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux087856d962/javabloblistblobshierwithtimeoutstillbackedbypagedflux2148372", + "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" : "52d870e7-b68e-4b8a-995f-f4defeac2dbd", + "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 20:01:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D7356080085661\"", + "Content-Length" : "0", + "x-ms-request-id" : "078035d1-801e-001f-3049-673bbb000000", + "x-ms-client-request-id" : "52d870e7-b68e-4b8a-995f-f4defeac2dbd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux087856d962/javabloblistblobshierwithtimeoutstillbackedbypagedflux3448602", + "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" : "68c07140-105e-4b45-a239-2e702f146307", + "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 20:01:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:26 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560801502D9\"", + "Content-Length" : "0", + "x-ms-request-id" : "078035dc-801e-001f-3b49-673bbb000000", + "x-ms-client-request-id" : "68c07140-105e-4b45-a239-2e702f146307" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux087856d962/javabloblistblobshierwithtimeoutstillbackedbypagedflux4743518", + "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" : "f01ffd1d-b99d-4528-a8cc-c2a9e24c43a0", + "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 20:01:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735608021AF5A\"", + "Content-Length" : "0", + "x-ms-request-id" : "078035f2-801e-001f-4c49-673bbb000000", + "x-ms-client-request-id" : "f01ffd1d-b99d-4528-a8cc-c2a9e24c43a0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux087856d962/javabloblistblobshierwithtimeoutstillbackedbypagedflux527330d", + "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" : "ebae55ee-0ab5-4a40-8b0e-502b226460b5", + "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 20:01:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:01:27 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560803030F0\"", + "Content-Length" : "0", + "x-ms-request-id" : "078035fe-801e-001f-5649-673bbb000000", + "x-ms-client-request-id" : "ebae55ee-0ab5-4a40-8b0e-502b226460b5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux087856d962?delimiter=/&maxresults=3&include=&restype=container&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" : "f0eeabf7-abcc-45df-bad4-8c770fe0b604" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07803610-801e-001f-6749-673bbb000000", + "Body" : "3/javabloblistblobshierwithtimeoutstillbackedbypagedflux168601eMon, 09 Sep 2019 20:01:27 GMTMon, 09 Sep 2019 20:01:27 GMT0x8D735607FFBA9E07application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0javabloblistblobshierwithtimeoutstillbackedbypagedflux2148372Mon, 09 Sep 2019 20:01:27 GMTMon, 09 Sep 2019 20:01:27 GMT0x8D73560800856617application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0javabloblistblobshierwithtimeoutstillbackedbypagedflux3448602Mon, 09 Sep 2019 20:01:27 GMTMon, 09 Sep 2019 20:01:27 GMT0x8D73560801502D97application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue02!140!MDAwMDYxIWphdmFibG9ibGlzdGJsb2JzaGllcndpdGh0aW1lb3V0c3RpbGxiYWNrZWRieXBhZ2VkZmx1eDQ3NDM1MTghMDAwMDI4ITk5OTktMTItMzFUMjM6NTk6NTkuOTk5OTk5OVoh", + "Date" : "Mon, 09 Sep 2019 20:01:27 GMT", + "x-ms-client-request-id" : "f0eeabf7-abcc-45df-bad4-8c770fe0b604", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux087856d962?delimiter=/&marker=2%21140%21MDAwMDYxIWphdmFibG9ibGlzdGJsb2JzaGllcndpdGh0aW1lb3V0c3RpbGxiYWNrZWRieXBhZ2VkZmx1eDQ3NDM1MTghMDAwMDI4ITk5OTktMTItMzFUMjM6NTk6NTkuOTk5OTk5OVoh&maxresults=3&include=&restype=container&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" : "a2b19f10-e1de-4178-b392-85bfb5abd9da" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07803641-801e-001f-0f49-673bbb000000", + "Body" : "2!140!MDAwMDYxIWphdmFibG9ibGlzdGJsb2JzaGllcndpdGh0aW1lb3V0c3RpbGxiYWNrZWRieXBhZ2VkZmx1eDQ3NDM1MTghMDAwMDI4ITk5OTktMTItMzFUMjM6NTk6NTkuOTk5OTk5OVoh3/javabloblistblobshierwithtimeoutstillbackedbypagedflux4743518Mon, 09 Sep 2019 20:01:27 GMTMon, 09 Sep 2019 20:01:27 GMT0x8D735608021AF5A7application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0javabloblistblobshierwithtimeoutstillbackedbypagedflux527330dMon, 09 Sep 2019 20:01:27 GMTMon, 09 Sep 2019 20:01:27 GMT0x8D73560803030F07application/octet-stream6RYQPwaVsyQ=wh+Wm18D0z1D4E+PE252gg==BlockBlobHottrueunlockedavailabletrue0", + "Date" : "Mon, 09 Sep 2019 20:01:27 GMT", + "x-ms-client-request-id" : "a2b19f10-e1de-4178-b392-85bfb5abd9da", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistblobshierwithtimeoutstillbackedbypagedflux&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" : "d93a8d4b-d16b-4c85-b8ff-d05b5fd79229" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "07803649-801e-001f-1649-673bbb000000", + "Body" : "jtclistblobshierwithtimeoutstillbackedbypagedfluxjtclistblobshierwithtimeoutstillbackedbypagedflux087856d962Mon, 09 Sep 2019 20:01:27 GMT\"0x8D735607FEEAF35\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:01:27 GMT", + "x-ms-client-request-id" : "d93a8d4b-d16b-4c85-b8ff-d05b5fd79229", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistblobshierwithtimeoutstillbackedbypagedflux087856d962?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" : "ba2fff2b-1657-4cdc-8fa8-79874f355bc7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "07803652-801e-001f-1e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:01:27 GMT", + "x-ms-client-request-id" : "ba2fff2b-1657-4cdc-8fa8-79874f355bc7" + }, + "Exception" : null + } ], + "variables" : [ "jtclistblobshierwithtimeoutstillbackedbypagedflux087856d962", "javabloblistblobshierwithtimeoutstillbackedbypagedflux168601e", "javabloblistblobshierwithtimeoutstillbackedbypagedflux2148372", "javabloblistblobshierwithtimeoutstillbackedbypagedflux3448602", "javabloblistblobshierwithtimeoutstillbackedbypagedflux4743518", "javabloblistblobshierwithtimeoutstillbackedbypagedflux527330d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaselease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaselease.json new file mode 100644 index 000000000000..ff225d79f476 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaselease.json @@ -0,0 +1,135 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaselease0containerapitestreleaselease27a4929401619?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" : "4f8a1e01-9771-4f8c-9d4e-87b62b158a4b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BD281D92\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e744-301e-0042-6749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:09 GMT", + "x-ms-client-request-id" : "4f8a1e01-9771-4f8c-9d4e-87b62b158a4b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaselease0containerapitestreleaselease27a4929401619?comp=lease&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" : "212a79c2-774e-4bc8-822f-ce8476fe94e5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BD281D92\"", + "x-ms-lease-id" : "e120ff23-6fda-4086-9b8e-e92ba124ba7b", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e75a-301e-0042-7a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:09 GMT", + "x-ms-client-request-id" : "212a79c2-774e-4bc8-822f-ce8476fe94e5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaselease0containerapitestreleaselease27a4929401619?comp=lease&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" : "7352e1e1-6aad-4acf-9a1b-97081ce70cc1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BD281D92\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e768-301e-0042-0849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:09 GMT", + "x-ms-client-request-id" : "7352e1e1-6aad-4acf-9a1b-97081ce70cc1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaselease0containerapitestreleaselease27a4929401619?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" : "b0f8847e-6b66-411f-b590-08e86978ceb8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:10 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:03:09 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D73560BD281D92\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "c5c9e781-301e-0042-2149-67cbbf000000", + "x-ms-client-request-id" : "b0f8847e-6b66-411f-b590-08e86978ceb8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcreleaselease&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" : "d9c4e0c1-df51-4669-beb0-745343af8530" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e79e-301e-0042-3c49-67cbbf000000", + "Body" : "jtcreleaseleasejtcreleaselease0containerapitestreleaselease27a4929401619Mon, 09 Sep 2019 20:03:10 GMT\"0x8D73560BD281D92\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:09 GMT", + "x-ms-client-request-id" : "d9c4e0c1-df51-4669-beb0-745343af8530", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaselease0containerapitestreleaselease27a4929401619?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" : "6736a9a3-738b-4122-817c-64bbf3801c02" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e7b0-301e-0042-4e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:09 GMT", + "x-ms-client-request-id" : "6736a9a3-738b-4122-817c-64bbf3801c02" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaselease0containerapitestreleaselease27a4929401619" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseac[0].json new file mode 100644 index 000000000000..c2f35bc0da43 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseac[0].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseacb9571027ac9?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" : "6e308d44-8220-4a70-8a90-57756f667e08" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BDB7584E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e822-301e-0042-3849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:10 GMT", + "x-ms-client-request-id" : "6e308d44-8220-4a70-8a90-57756f667e08" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseacb9571027ac9?comp=lease&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" : "2f6b5831-fa8b-4f27-a364-07c3802812fa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BDB7584E\"", + "x-ms-lease-id" : "3294503d-bcf9-4165-af04-cc9ce44538f2", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e834-301e-0042-4949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:10 GMT", + "x-ms-client-request-id" : "2f6b5831-fa8b-4f27-a364-07c3802812fa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseacb9571027ac9?comp=lease&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" : "4ea5ec19-2ea5-4eba-95ed-687cc26cabd2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BDB7584E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e849-301e-0042-5e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:10 GMT", + "x-ms-client-request-id" : "4ea5ec19-2ea5-4eba-95ed-687cc26cabd2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcreleaseleaseac&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" : "6867f90d-ef2b-4d07-b0dc-4b54cc39b446" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e865-301e-0042-7749-67cbbf000000", + "Body" : "jtcreleaseleaseacjtcreleaseleaseac0containerapitestreleaseleaseacb9571027ac9Mon, 09 Sep 2019 20:03:11 GMT\"0x8D73560BDB7584E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:10 GMT", + "x-ms-client-request-id" : "6867f90d-ef2b-4d07-b0dc-4b54cc39b446", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseacb9571027ac9?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" : "a24cc496-6f55-4e7a-a461-a7f55477556b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e870-301e-0042-0149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:10 GMT", + "x-ms-client-request-id" : "a24cc496-6f55-4e7a-a461-a7f55477556b" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseac0containerapitestreleaseleaseacb9571027ac9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseac[1].json new file mode 100644 index 000000000000..ea1e00d4f56f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseac[1].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseac1d887123dfb?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" : "b52c0099-5570-44e5-9cca-2a8801d6cdfd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BDF4BAA4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e880-301e-0042-1149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:10 GMT", + "x-ms-client-request-id" : "b52c0099-5570-44e5-9cca-2a8801d6cdfd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseac1d887123dfb?comp=lease&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" : "28e97b9f-e65c-4a6e-80d9-9922d383f84f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BDF4BAA4\"", + "x-ms-lease-id" : "2269c41f-8c73-4646-9d30-0b440a5ff74b", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e88a-301e-0042-1a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:10 GMT", + "x-ms-client-request-id" : "28e97b9f-e65c-4a6e-80d9-9922d383f84f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseac1d887123dfb?comp=lease&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" : "3a62393c-9f58-4f63-9123-8c244234e06a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BDF4BAA4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e897-301e-0042-2749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:10 GMT", + "x-ms-client-request-id" : "3a62393c-9f58-4f63-9123-8c244234e06a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcreleaseleaseac&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" : "0452d3a9-873e-42e7-9fa7-664d271e18fe" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e8a7-301e-0042-3649-67cbbf000000", + "Body" : "jtcreleaseleaseacjtcreleaseleaseac0containerapitestreleaseleaseac1d887123dfbMon, 09 Sep 2019 20:03:11 GMT\"0x8D73560BDF4BAA4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:10 GMT", + "x-ms-client-request-id" : "0452d3a9-873e-42e7-9fa7-664d271e18fe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseac1d887123dfb?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" : "557946ae-deb1-43ee-8e95-456215b44324" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e8ac-301e-0042-3b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:11 GMT", + "x-ms-client-request-id" : "557946ae-deb1-43ee-8e95-456215b44324" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseac0containerapitestreleaseleaseac1d887123dfb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseac[2].json new file mode 100644 index 000000000000..bc1158b7a493 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseac[2].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseacd8f04126093?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" : "8ea01ebe-d777-48f5-bd44-c09dbb110fcd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BE3503AA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e8bf-301e-0042-4d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:11 GMT", + "x-ms-client-request-id" : "8ea01ebe-d777-48f5-bd44-c09dbb110fcd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseacd8f04126093?comp=lease&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" : "0bfd6085-5c76-4771-be50-1a8b0206d957" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BE3503AA\"", + "x-ms-lease-id" : "7e357a54-82e5-4bdc-be29-05e717770f33", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e8d5-301e-0042-6049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:11 GMT", + "x-ms-client-request-id" : "0bfd6085-5c76-4771-be50-1a8b0206d957" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseacd8f04126093?comp=lease&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" : "7c906b12-f383-4483-8cb0-bfaf5bf48030" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BE3503AA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e8f0-301e-0042-7749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:11 GMT", + "x-ms-client-request-id" : "7c906b12-f383-4483-8cb0-bfaf5bf48030" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcreleaseleaseac&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" : "fca49915-82ca-49b3-85bb-16bccaee4c1f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e902-301e-0042-0749-67cbbf000000", + "Body" : "jtcreleaseleaseacjtcreleaseleaseac0containerapitestreleaseleaseacd8f04126093Mon, 09 Sep 2019 20:03:12 GMT\"0x8D73560BE3503AA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:11 GMT", + "x-ms-client-request-id" : "fca49915-82ca-49b3-85bb-16bccaee4c1f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseac0containerapitestreleaseleaseacd8f04126093?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" : "f30d78f5-68f5-4ec5-ae84-fd66d888d9cc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e911-301e-0042-1649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:11 GMT", + "x-ms-client-request-id" : "f30d78f5-68f5-4ec5-ae84-fd66d888d9cc" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseac0containerapitestreleaseleaseacd8f04126093" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseacfail[0].json new file mode 100644 index 000000000000..3460f2c20e73 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseacfail[0].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0057417acb46203df84213b5?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" : "b92180de-e63c-488b-ad8c-3d6b30a3698d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BE754CB0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e925-301e-0042-2a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:11 GMT", + "x-ms-client-request-id" : "b92180de-e63c-488b-ad8c-3d6b30a3698d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0057417acb46203df84213b5?comp=lease&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" : "27678a27-c860-4fd1-891f-bb65509a8a9d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BE754CB0\"", + "x-ms-lease-id" : "68f72d97-c966-4e3f-8563-e837ba6f47e0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e937-301e-0042-3a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:11 GMT", + "x-ms-client-request-id" : "27678a27-c860-4fd1-891f-bb65509a8a9d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0057417acb46203df84213b5?comp=lease&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" : "cc7b6fe3-ccc4-40c6-8b24-b92be294f416" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5c9e944-301e-0042-4549-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5c9e944-301e-0042-4549-67cbbf000000\nTime:2019-09-09T20:03:12.6396658Z", + "Date" : "Mon, 09 Sep 2019 20:03:11 GMT", + "x-ms-client-request-id" : "cc7b6fe3-ccc4-40c6-8b24-b92be294f416", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcreleaseleaseacfail&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" : "da3fb755-5799-42fa-bfed-36460a752b09" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e95a-301e-0042-5849-67cbbf000000", + "Body" : "jtcreleaseleaseacfailjtcreleaseleaseacfail0057417acb46203df84213b5Mon, 09 Sep 2019 20:03:12 GMT\"0x8D73560BE754CB0\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:11 GMT", + "x-ms-client-request-id" : "da3fb755-5799-42fa-bfed-36460a752b09", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0057417acb46203df84213b5?comp=lease&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" : "5f9c1383-a6ac-4a12-b7bd-c7069d43672a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BE754CB0\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e965-301e-0042-6349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:11 GMT", + "x-ms-client-request-id" : "5f9c1383-a6ac-4a12-b7bd-c7069d43672a" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail0057417acb46203df84213b5?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" : "116a9191-b79f-4ac0-a910-aeb3b84f4e5b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e973-301e-0042-7149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:12 GMT", + "x-ms-client-request-id" : "116a9191-b79f-4ac0-a910-aeb3b84f4e5b" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseacfail0057417acb46203df84213b5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseacfail[1].json new file mode 100644 index 000000000000..749c3bfc0d60 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseacfail[1].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail066866deab23fa7cde45e396?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" : "1a0dd499-2473-448b-ac4e-f3ea62086cb3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BEC2DE94\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e98a-301e-0042-0749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:12 GMT", + "x-ms-client-request-id" : "1a0dd499-2473-448b-ac4e-f3ea62086cb3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail066866deab23fa7cde45e396?comp=lease&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" : "9f672a44-e64b-47c8-9a11-d5fc730238bb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BEC2DE94\"", + "x-ms-lease-id" : "ef9a83c8-2b9a-4bac-97a1-a67ee83b82f8", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e9aa-301e-0042-2449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:12 GMT", + "x-ms-client-request-id" : "9f672a44-e64b-47c8-9a11-d5fc730238bb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail066866deab23fa7cde45e396?comp=lease&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" : "e1aa07fd-ef6a-43f6-9e43-c15830f14efb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5c9e9ca-301e-0042-3f49-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5c9e9ca-301e-0042-3f49-67cbbf000000\nTime:2019-09-09T20:03:13.1490288Z", + "Date" : "Mon, 09 Sep 2019 20:03:12 GMT", + "x-ms-client-request-id" : "e1aa07fd-ef6a-43f6-9e43-c15830f14efb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcreleaseleaseacfail&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" : "f0219a42-aa9e-47b2-bb96-35a96015e74c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e9de-301e-0042-5049-67cbbf000000", + "Body" : "jtcreleaseleaseacfailjtcreleaseleaseacfail066866deab23fa7cde45e396Mon, 09 Sep 2019 20:03:12 GMT\"0x8D73560BEC2DE94\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:12 GMT", + "x-ms-client-request-id" : "f0219a42-aa9e-47b2-bb96-35a96015e74c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail066866deab23fa7cde45e396?comp=lease&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" : "bbf17d8c-3f83-4a75-92db-9f3b2be4d5ed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BEC2DE94\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e9ef-301e-0042-6149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:12 GMT", + "x-ms-client-request-id" : "bbf17d8c-3f83-4a75-92db-9f3b2be4d5ed" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacfail066866deab23fa7cde45e396?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" : "c746a867-8268-4ae2-8429-c6fb631dd980" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e9fc-301e-0042-6e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:12 GMT", + "x-ms-client-request-id" : "c746a867-8268-4ae2-8429-c6fb631dd980" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseacfail066866deab23fa7cde45e396" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseacillegal[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseacillegal[0].json new file mode 100644 index 000000000000..3e6821482f3f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseacillegal[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacillegal051010c88dd91c7b804c36?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" : "bbf3de68-b562-491b-a41c-2672b91fc719" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BF0E4D35\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9ea0d-301e-0042-7c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:12 GMT", + "x-ms-client-request-id" : "bbf3de68-b562-491b-a41c-2672b91fc719" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcreleaseleaseacillegal&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" : "ea8fabb5-0b3a-4dab-a177-2961ed44912b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9ea2b-301e-0042-1549-67cbbf000000", + "Body" : "jtcreleaseleaseacillegaljtcreleaseleaseacillegal051010c88dd91c7b804c36Mon, 09 Sep 2019 20:03:13 GMT\"0x8D73560BF0E4D35\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:12 GMT", + "x-ms-client-request-id" : "ea8fabb5-0b3a-4dab-a177-2961ed44912b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacillegal051010c88dd91c7b804c36?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" : "d1790e6c-87cd-4ef5-8873-d0a060fc756d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9ea3c-301e-0042-2549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:12 GMT", + "x-ms-client-request-id" : "d1790e6c-87cd-4ef5-8873-d0a060fc756d" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseacillegal051010c88dd91c7b804c36" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseacillegal[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseacillegal[1].json new file mode 100644 index 000000000000..b7ef48682998 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseacillegal[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacillegal036286dc0a264833744175?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" : "5ebfb7c8-c8b6-4fba-b3d4-43f974d76386" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BF3452B6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9ea59-301e-0042-4149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:12 GMT", + "x-ms-client-request-id" : "5ebfb7c8-c8b6-4fba-b3d4-43f974d76386" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcreleaseleaseacillegal&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" : "7a3565d1-928a-4001-af8d-a864915fa517" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9ea6b-301e-0042-5149-67cbbf000000", + "Body" : "jtcreleaseleaseacillegaljtcreleaseleaseacillegal036286dc0a264833744175Mon, 09 Sep 2019 20:03:13 GMT\"0x8D73560BF3452B6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:12 GMT", + "x-ms-client-request-id" : "7a3565d1-928a-4001-af8d-a864915fa517", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseacillegal036286dc0a264833744175?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" : "b53c091a-7826-4002-970c-22fdae8a550b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9ea81-301e-0042-6549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:13 GMT", + "x-ms-client-request-id" : "b53c091a-7826-4002-970c-22fdae8a550b" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseacillegal036286dc0a264833744175" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseerror.json new file mode 100644 index 000000000000..9b13a04c3ca7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleaseerror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseerror0containerapitestreleaseleaseerror53032355?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" : "35af3d21-f7d9-40c8-8b8b-f56aaad4c190" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BF5AA665\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9ea90-301e-0042-7349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:13 GMT", + "x-ms-client-request-id" : "35af3d21-f7d9-40c8-8b8b-f56aaad4c190" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseerror1containerapitestreleaseleaseerror53000518?comp=lease&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" : "b39bd8fe-b90a-49fa-bbba-e00b7a34b836" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "c5c9eaa3-301e-0042-0349-67cbbf000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:c5c9eaa3-301e-0042-0349-67cbbf000000\nTime:2019-09-09T20:03:14.0556744Zx-ms-lease-idid", + "Date" : "Mon, 09 Sep 2019 20:03:13 GMT", + "x-ms-client-request-id" : "b39bd8fe-b90a-49fa-bbba-e00b7a34b836", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcreleaseleaseerror&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" : "a1af780f-99cc-47b1-bbfb-0c5605ff557c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9eab5-301e-0042-1449-67cbbf000000", + "Body" : "jtcreleaseleaseerrorjtcreleaseleaseerror0containerapitestreleaseleaseerror53032355Mon, 09 Sep 2019 20:03:13 GMT\"0x8D73560BF5AA665\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:13 GMT", + "x-ms-client-request-id" : "a1af780f-99cc-47b1-bbfb-0c5605ff557c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleaseerror0containerapitestreleaseleaseerror53032355?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" : "2b915727-f4b2-4d49-ad61-5c0cf44f4499" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9eac9-301e-0042-2749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:13 GMT", + "x-ms-client-request-id" : "2b915727-f4b2-4d49-ad61-5c0cf44f4499" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleaseerror0containerapitestreleaseleaseerror53032355", "jtcreleaseleaseerror1containerapitestreleaseleaseerror53000518" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleasemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleasemin.json new file mode 100644 index 000000000000..f4b8c0373943 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestreleaseleasemin.json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleasemin0containerapitestreleaseleasemindea3134726?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" : "6688bcd9-22b9-40af-a825-bb61c9a171ea" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BD77D2B5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e7c3-301e-0042-6149-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:09 GMT", + "x-ms-client-request-id" : "6688bcd9-22b9-40af-a825-bb61c9a171ea" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleasemin0containerapitestreleaseleasemindea3134726?comp=lease&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" : "93258cb7-bf17-4682-83ba-e26223f3def3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BD77D2B5\"", + "x-ms-lease-id" : "067f851d-0e56-4821-af73-e0aa0d5c2a04", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e7d8-301e-0042-7449-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:10 GMT", + "x-ms-client-request-id" : "93258cb7-bf17-4682-83ba-e26223f3def3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleasemin0containerapitestreleaseleasemindea3134726?comp=lease&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" : "2b47004c-2be0-4e06-addd-6560ba6f2af2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BD77D2B5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e7f0-301e-0042-0949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:10 GMT", + "x-ms-client-request-id" : "2b47004c-2be0-4e06-addd-6560ba6f2af2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcreleaseleasemin&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" : "baaf2375-0275-4779-ae67-5e4d3d83ede5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e802-301e-0042-1949-67cbbf000000", + "Body" : "jtcreleaseleaseminjtcreleaseleasemin0containerapitestreleaseleasemindea3134726Mon, 09 Sep 2019 20:03:10 GMT\"0x8D73560BD77D2B5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:10 GMT", + "x-ms-client-request-id" : "baaf2375-0275-4779-ae67-5e4d3d83ede5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreleaseleasemin0containerapitestreleaseleasemindea3134726?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" : "81494fb0-9282-46f3-8609-575a3908964e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e818-301e-0042-2e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:10 GMT", + "x-ms-client-request-id" : "81494fb0-9282-46f3-8609-575a3908964e" + }, + "Exception" : null + } ], + "variables" : [ "jtcreleaseleasemin0containerapitestreleaseleasemindea3134726" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewlease.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewlease.json new file mode 100644 index 000000000000..cd63c1174cad --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewlease.json @@ -0,0 +1,159 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewlease0containerapitestrenewlease88143672267f8f7?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" : "05fe98a3-2b4c-44c1-9aa1-235384a83a71" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560B0F5790E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9d5ea-301e-0042-1649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:49 GMT", + "x-ms-client-request-id" : "05fe98a3-2b4c-44c1-9aa1-235384a83a71" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewlease0containerapitestrenewlease88143672267f8f7?comp=lease&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" : "00e19e10-e3fd-4546-a1fc-a91b89e10e09" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560B0F5790E\"", + "x-ms-lease-id" : "a02bf736-e25f-4370-b317-10c92048094f", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9d5f7-301e-0042-2249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:02:49 GMT", + "x-ms-client-request-id" : "00e19e10-e3fd-4546-a1fc-a91b89e10e09" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewlease0containerapitestrenewlease88143672267f8f7?comp=lease&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" : "1cf09d65-51b2-4693-8528-3cfbfe494115" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560B0F5790E\"", + "x-ms-lease-id" : "a02bf736-e25f-4370-b317-10c92048094f", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e32f-301e-0042-3649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:05 GMT", + "x-ms-client-request-id" : "1cf09d65-51b2-4693-8528-3cfbfe494115" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewlease0containerapitestrenewlease88143672267f8f7?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" : "8b66ad95-979c-4a02-a108-3147d2e23b6b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "locked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "leased", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:49 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:03:05 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D73560B0F5790E\"", + "x-ms-has-immutability-policy" : "false", + "x-ms-lease-duration" : "infinite", + "Content-Length" : "0", + "x-ms-request-id" : "c5c9e345-301e-0042-4849-67cbbf000000", + "x-ms-client-request-id" : "8b66ad95-979c-4a02-a108-3147d2e23b6b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrenewlease&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" : "285dea0d-91b5-4bae-9dc0-41cdf37ff3a1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e356-301e-0042-5949-67cbbf000000", + "Body" : "jtcrenewleasejtcrenewlease0containerapitestrenewlease88143672267f8f7Mon, 09 Sep 2019 20:02:49 GMT\"0x8D73560B0F5790E\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:05 GMT", + "x-ms-client-request-id" : "285dea0d-91b5-4bae-9dc0-41cdf37ff3a1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewlease0containerapitestrenewlease88143672267f8f7?comp=lease&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" : "6b760ca8-6a27-4fe3-a960-38275fb76823" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560B0F5790E\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:02:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e368-301e-0042-6849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:05 GMT", + "x-ms-client-request-id" : "6b760ca8-6a27-4fe3-a960-38275fb76823" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewlease0containerapitestrenewlease88143672267f8f7?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" : "4b74dcb8-5ed0-4ea2-82cb-e089e97fa21f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e378-301e-0042-7649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:05 GMT", + "x-ms-client-request-id" : "4b74dcb8-5ed0-4ea2-82cb-e089e97fa21f" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewlease0containerapitestrenewlease88143672267f8f7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseac[0].json new file mode 100644 index 000000000000..41e6ef737366 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseac[0].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseac09f4872690321?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" : "8bd9a08f-286c-4603-85e4-f8dc5bb17032" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BB290A76\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e3f7-301e-0042-6849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:06 GMT", + "x-ms-client-request-id" : "8bd9a08f-286c-4603-85e4-f8dc5bb17032" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseac09f4872690321?comp=lease&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" : "aab7d3d1-bfdc-4690-9d56-ef2ffbb40098" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BB290A76\"", + "x-ms-lease-id" : "a8b18e40-2430-43d3-9bc6-236dc4343a88", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e40d-301e-0042-7a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:06 GMT", + "x-ms-client-request-id" : "aab7d3d1-bfdc-4690-9d56-ef2ffbb40098" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseac09f4872690321?comp=lease&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" : "683da7c5-acc7-43ca-bd94-a5d168242773" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BB290A76\"", + "x-ms-lease-id" : "a8b18e40-2430-43d3-9bc6-236dc4343a88", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e422-301e-0042-0c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:06 GMT", + "x-ms-client-request-id" : "683da7c5-acc7-43ca-bd94-a5d168242773" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrenewleaseac&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" : "dfd752db-fdd3-4eb8-8d56-30f3b4f2625c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e433-301e-0042-1c49-67cbbf000000", + "Body" : "jtcrenewleaseacjtcrenewleaseac0containerapitestrenewleaseac09f4872690321Mon, 09 Sep 2019 20:03:06 GMT\"0x8D73560BB290A76\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:06 GMT", + "x-ms-client-request-id" : "dfd752db-fdd3-4eb8-8d56-30f3b4f2625c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseac09f4872690321?comp=lease&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" : "061d437d-92f2-4d79-b407-c28dd9e992fb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BB290A76\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e448-301e-0042-2d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:06 GMT", + "x-ms-client-request-id" : "061d437d-92f2-4d79-b407-c28dd9e992fb" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseac09f4872690321?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" : "f08e46d2-83f8-44cc-8827-c3b2878e3a2e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e458-301e-0042-3c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:06 GMT", + "x-ms-client-request-id" : "f08e46d2-83f8-44cc-8827-c3b2878e3a2e" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseac0containerapitestrenewleaseac09f4872690321" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseac[1].json new file mode 100644 index 000000000000..42e57189d50e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseac[1].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseace5f1517977ee1?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" : "3b089a41-5c55-4f67-a559-0b451d1672d8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BB76C36F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e473-301e-0042-5749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:06 GMT", + "x-ms-client-request-id" : "3b089a41-5c55-4f67-a559-0b451d1672d8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseace5f1517977ee1?comp=lease&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" : "ee992f82-739b-47f1-a864-c9eefa14b303" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BB76C36F\"", + "x-ms-lease-id" : "b9e1545c-5046-4ede-87e2-12a4474ebe17", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e487-301e-0042-6849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:06 GMT", + "x-ms-client-request-id" : "ee992f82-739b-47f1-a864-c9eefa14b303" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseace5f1517977ee1?comp=lease&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" : "26c2cf2a-6817-4ff4-94d9-9cb1c527414b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BB76C36F\"", + "x-ms-lease-id" : "b9e1545c-5046-4ede-87e2-12a4474ebe17", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e49d-301e-0042-7d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:06 GMT", + "x-ms-client-request-id" : "26c2cf2a-6817-4ff4-94d9-9cb1c527414b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrenewleaseac&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" : "329c1976-80b6-4eff-9c28-8d5b999fb121" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e4b6-301e-0042-1449-67cbbf000000", + "Body" : "jtcrenewleaseacjtcrenewleaseac0containerapitestrenewleaseace5f1517977ee1Mon, 09 Sep 2019 20:03:07 GMT\"0x8D73560BB76C36F\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:06 GMT", + "x-ms-client-request-id" : "329c1976-80b6-4eff-9c28-8d5b999fb121", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseace5f1517977ee1?comp=lease&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" : "142d8e20-9da5-4439-806f-05eb405cf3b5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BB76C36F\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e4cc-301e-0042-2a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:06 GMT", + "x-ms-client-request-id" : "142d8e20-9da5-4439-806f-05eb405cf3b5" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseace5f1517977ee1?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" : "852967bc-1fce-488a-a18b-d7a8a05354d9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e4da-301e-0042-3849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:06 GMT", + "x-ms-client-request-id" : "852967bc-1fce-488a-a18b-d7a8a05354d9" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseac0containerapitestrenewleaseace5f1517977ee1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseac[2].json new file mode 100644 index 000000000000..a99bc5fac01a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseac[2].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseacdb1771478c479?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" : "6db6d776-dbce-4161-b165-0e45c2e2db2e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BBC12053\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e4e9-301e-0042-4649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:07 GMT", + "x-ms-client-request-id" : "6db6d776-dbce-4161-b165-0e45c2e2db2e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseacdb1771478c479?comp=lease&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" : "8d7ccf72-ed87-4c93-9e5a-873cd578055b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BBC12053\"", + "x-ms-lease-id" : "d7abe7e6-aff5-49a5-848c-27a1a8a72112", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e4ff-301e-0042-5749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:07 GMT", + "x-ms-client-request-id" : "8d7ccf72-ed87-4c93-9e5a-873cd578055b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseacdb1771478c479?comp=lease&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" : "4c718294-3d9a-46f0-b0ec-b01a97d8c085" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BBC12053\"", + "x-ms-lease-id" : "d7abe7e6-aff5-49a5-848c-27a1a8a72112", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e516-301e-0042-6d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:07 GMT", + "x-ms-client-request-id" : "4c718294-3d9a-46f0-b0ec-b01a97d8c085" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrenewleaseac&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" : "4568719d-267d-4d1a-9221-fcc96b3e86f3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e52a-301e-0042-8049-67cbbf000000", + "Body" : "jtcrenewleaseacjtcrenewleaseac0containerapitestrenewleaseacdb1771478c479Mon, 09 Sep 2019 20:03:07 GMT\"0x8D73560BBC12053\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:07 GMT", + "x-ms-client-request-id" : "4568719d-267d-4d1a-9221-fcc96b3e86f3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseacdb1771478c479?comp=lease&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" : "67d8b4fd-afae-4bde-a8c2-dcb49abe9e41" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BBC12053\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e53b-301e-0042-0f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:07 GMT", + "x-ms-client-request-id" : "67d8b4fd-afae-4bde-a8c2-dcb49abe9e41" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseac0containerapitestrenewleaseacdb1771478c479?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" : "1063f85c-a5c4-453e-be9c-6a9f375abed8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e555-301e-0042-2549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:07 GMT", + "x-ms-client-request-id" : "1063f85c-a5c4-453e-be9c-6a9f375abed8" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseac0containerapitestrenewleaseacdb1771478c479" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseacfail[0].json new file mode 100644 index 000000000000..b9f38c511073 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseacfail[0].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfaildcd26661e?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" : "a813eb41-7d98-478c-ae3f-31ee12ddd98d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BC0C67BF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e567-301e-0042-3749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:07 GMT", + "x-ms-client-request-id" : "a813eb41-7d98-478c-ae3f-31ee12ddd98d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfaildcd26661e?comp=lease&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" : "3408606d-44be-4d35-b656-2f3d99a325eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BC0C67BF\"", + "x-ms-lease-id" : "c8ef0e57-442c-419b-b440-26212d5c4409", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e584-301e-0042-5049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:07 GMT", + "x-ms-client-request-id" : "3408606d-44be-4d35-b656-2f3d99a325eb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfaildcd26661e?comp=lease&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" : "04eed385-d5b1-49fd-9824-c3b6f8ab985d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5c9e5a2-301e-0042-6a49-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5c9e5a2-301e-0042-6a49-67cbbf000000\nTime:2019-09-09T20:03:08.5897819Z", + "Date" : "Mon, 09 Sep 2019 20:03:07 GMT", + "x-ms-client-request-id" : "04eed385-d5b1-49fd-9824-c3b6f8ab985d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrenewleaseacfail&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" : "96148caa-4b42-4da1-8e51-7c88cb833f51" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e5b5-301e-0042-7d49-67cbbf000000", + "Body" : "jtcrenewleaseacfailjtcrenewleaseacfail0containerapitestrenewleaseacfaildcd26661eMon, 09 Sep 2019 20:03:08 GMT\"0x8D73560BC0C67BF\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:07 GMT", + "x-ms-client-request-id" : "96148caa-4b42-4da1-8e51-7c88cb833f51", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfaildcd26661e?comp=lease&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" : "6205aca9-f6f9-423b-a629-21fa0192358d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BC0C67BF\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e5d1-301e-0042-1849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:07 GMT", + "x-ms-client-request-id" : "6205aca9-f6f9-423b-a629-21fa0192358d" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfaildcd26661e?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" : "5b9199eb-d8b4-46bd-8993-845df1441eeb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e5e4-301e-0042-2949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:07 GMT", + "x-ms-client-request-id" : "5b9199eb-d8b4-46bd-8993-845df1441eeb" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseacfail0containerapitestrenewleaseacfaildcd26661e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseacfail[1].json new file mode 100644 index 000000000000..36d4f8d5afc2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseacfail[1].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfail78540209c?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" : "0f2e2005-b3ce-4fad-ab3a-3d1ddbadb96f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BC584B9C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e600-301e-0042-4249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:08 GMT", + "x-ms-client-request-id" : "0f2e2005-b3ce-4fad-ab3a-3d1ddbadb96f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfail78540209c?comp=lease&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" : "fd453a5b-ee93-41b9-aea1-b2dcb1433688" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BC584B9C\"", + "x-ms-lease-id" : "a4e092a2-3ac7-448a-9e57-66896154e1ac", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e616-301e-0042-5749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:08 GMT", + "x-ms-client-request-id" : "fd453a5b-ee93-41b9-aea1-b2dcb1433688" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfail78540209c?comp=lease&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" : "f2e19bcd-7286-4bea-9ee5-3beffd99157f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5c9e633-301e-0042-7149-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5c9e633-301e-0042-7149-67cbbf000000\nTime:2019-09-09T20:03:09.0861354Z", + "Date" : "Mon, 09 Sep 2019 20:03:08 GMT", + "x-ms-client-request-id" : "f2e19bcd-7286-4bea-9ee5-3beffd99157f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrenewleaseacfail&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" : "6f3f7298-f295-4383-a742-3cec2d2c5384" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e649-301e-0042-0649-67cbbf000000", + "Body" : "jtcrenewleaseacfailjtcrenewleaseacfail0containerapitestrenewleaseacfail78540209cMon, 09 Sep 2019 20:03:08 GMT\"0x8D73560BC584B9C\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:08 GMT", + "x-ms-client-request-id" : "6f3f7298-f295-4383-a742-3cec2d2c5384", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfail78540209c?comp=lease&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" : "c25dec72-6d1b-4cdc-a195-3aa2c83d5e79" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BC584B9C\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e659-301e-0042-1549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:08 GMT", + "x-ms-client-request-id" : "c25dec72-6d1b-4cdc-a195-3aa2c83d5e79" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacfail0containerapitestrenewleaseacfail78540209c?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" : "9cb5f4fa-3476-4066-be0c-cf6e60a29f55" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e66e-301e-0042-2749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:08 GMT", + "x-ms-client-request-id" : "9cb5f4fa-3476-4066-be0c-cf6e60a29f55" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseacfail0containerapitestrenewleaseacfail78540209c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseacillegal[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseacillegal[0].json new file mode 100644 index 000000000000..73844f128e8c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseacillegal[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacillegal0003110da3360c067d4b74b?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" : "0fcdc3cb-7b19-4616-aa9c-a08ecdb74a9f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BCA5683D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e68c-301e-0042-4349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:08 GMT", + "x-ms-client-request-id" : "0fcdc3cb-7b19-4616-aa9c-a08ecdb74a9f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrenewleaseacillegal&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" : "72a9c5ce-dccc-4cf0-9f69-5c528fc5e5d0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e699-301e-0042-4e49-67cbbf000000", + "Body" : "jtcrenewleaseacillegaljtcrenewleaseacillegal0003110da3360c067d4b74bMon, 09 Sep 2019 20:03:09 GMT\"0x8D73560BCA5683D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:08 GMT", + "x-ms-client-request-id" : "72a9c5ce-dccc-4cf0-9f69-5c528fc5e5d0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacillegal0003110da3360c067d4b74b?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" : "4dd6b2e8-7eb7-4f78-b53a-9525576a4ef0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e6a5-301e-0042-5949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:08 GMT", + "x-ms-client-request-id" : "4dd6b2e8-7eb7-4f78-b53a-9525576a4ef0" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseacillegal0003110da3360c067d4b74b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseacillegal[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseacillegal[1].json new file mode 100644 index 000000000000..5fad6cb190e9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseacillegal[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacillegal0114949844c27878f44e388?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" : "2cd46331-914a-4d52-a53d-f1d4448896e3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BCCDDF2C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e6bc-301e-0042-6d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:08 GMT", + "x-ms-client-request-id" : "2cd46331-914a-4d52-a53d-f1d4448896e3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrenewleaseacillegal&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" : "ae4a6785-1ce0-4734-a963-402d46e2edb3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e6c8-301e-0042-7849-67cbbf000000", + "Body" : "jtcrenewleaseacillegaljtcrenewleaseacillegal0114949844c27878f44e388Mon, 09 Sep 2019 20:03:09 GMT\"0x8D73560BCCDDF2C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:08 GMT", + "x-ms-client-request-id" : "ae4a6785-1ce0-4734-a963-402d46e2edb3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseacillegal0114949844c27878f44e388?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" : "3c5daa2c-20b7-49c1-af89-704cb905e194" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e6de-301e-0042-0a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:08 GMT", + "x-ms-client-request-id" : "3c5daa2c-20b7-49c1-af89-704cb905e194" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseacillegal0114949844c27878f44e388" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseerror.json new file mode 100644 index 000000000000..7d621892d5e9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleaseerror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseerror0containerapitestrenewleaseerror3db7697213?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" : "df566780-a0c4-4c18-81fc-12c79da0a4cb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BCF432DB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e6f2-301e-0042-1d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:09 GMT", + "x-ms-client-request-id" : "df566780-a0c4-4c18-81fc-12c79da0a4cb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseerror1containerapitestrenewleaseerror3db759829d?comp=lease&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" : "c1025b8b-64fa-4c26-8995-27b38da543fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "c5c9e707-301e-0042-2f49-67cbbf000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:c5c9e707-301e-0042-2f49-67cbbf000000\nTime:2019-09-09T20:03:10.0288067Zx-ms-lease-idid", + "Date" : "Mon, 09 Sep 2019 20:03:09 GMT", + "x-ms-client-request-id" : "c1025b8b-64fa-4c26-8995-27b38da543fc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrenewleaseerror&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" : "12d3a1ec-3ba1-45cc-b431-10481b20727d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e718-301e-0042-3e49-67cbbf000000", + "Body" : "jtcrenewleaseerrorjtcrenewleaseerror0containerapitestrenewleaseerror3db7697213Mon, 09 Sep 2019 20:03:09 GMT\"0x8D73560BCF432DB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:09 GMT", + "x-ms-client-request-id" : "12d3a1ec-3ba1-45cc-b431-10481b20727d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleaseerror0containerapitestrenewleaseerror3db7697213?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" : "366920a3-f57c-4edb-bd1b-983745e62d0f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e72c-301e-0042-5049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:09 GMT", + "x-ms-client-request-id" : "366920a3-f57c-4edb-bd1b-983745e62d0f" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleaseerror0containerapitestrenewleaseerror3db7697213", "jtcrenewleaseerror1containerapitestrenewleaseerror3db759829d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleasemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleasemin.json new file mode 100644 index 000000000000..394b8bb5d92f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrenewleasemin.json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleasemin0containerapitestrenewleasemin911932910f5a?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" : "f7a69616-d2ad-4fe6-b022-37ad3c45549c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BAD9F1A6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e38d-301e-0042-0749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:05 GMT", + "x-ms-client-request-id" : "f7a69616-d2ad-4fe6-b022-37ad3c45549c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleasemin0containerapitestrenewleasemin911932910f5a?comp=lease&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" : "4e01cba8-f7e9-4f98-a80b-9e9ab338123c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BAD9F1A6\"", + "x-ms-lease-id" : "c32d7416-18a4-450a-a442-64e768c25af4", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5c9e3a2-301e-0042-1b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:05 GMT", + "x-ms-client-request-id" : "4e01cba8-f7e9-4f98-a80b-9e9ab338123c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleasemin0containerapitestrenewleasemin911932910f5a?comp=lease&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" : "8ff82b0c-dbac-4c0f-9b20-9f7106dce4c7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BAD9F1A6\"", + "x-ms-lease-id" : "c32d7416-18a4-450a-a442-64e768c25af4", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e3b4-301e-0042-2b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:05 GMT", + "x-ms-client-request-id" : "8ff82b0c-dbac-4c0f-9b20-9f7106dce4c7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrenewleasemin&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" : "84a2e22c-2ecb-4fba-80ec-1929dc2a8317" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5c9e3c1-301e-0042-3749-67cbbf000000", + "Body" : "jtcrenewleaseminjtcrenewleasemin0containerapitestrenewleasemin911932910f5aMon, 09 Sep 2019 20:03:06 GMT\"0x8D73560BAD9F1A6\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:03:05 GMT", + "x-ms-client-request-id" : "84a2e22c-2ecb-4fba-80ec-1929dc2a8317", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleasemin0containerapitestrenewleasemin911932910f5a?comp=lease&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" : "e9aafe1f-4972-4b22-959f-7e21b53f1744" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560BAD9F1A6\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:03:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e3d8-301e-0042-4c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:05 GMT", + "x-ms-client-request-id" : "e9aafe1f-4972-4b22-959f-7e21b53f1744" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrenewleasemin0containerapitestrenewleasemin911932910f5a?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" : "2f8014e6-16bf-4d46-953a-c932039a21dd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5c9e3ea-301e-0042-5b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:03:05 GMT", + "x-ms-client-request-id" : "2f8014e6-16bf-4d46-953a-c932039a21dd" + }, + "Exception" : null + } ], + "variables" : [ "jtcrenewleasemin0containerapitestrenewleasemin911932910f5a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrootexplicit.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrootexplicit.json new file mode 100644 index 000000000000..eccb72121c24 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrootexplicit.json @@ -0,0 +1,114 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrootexplicit0containerapitestrootexplicit25542905d6839?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" : "4395afbb-7e21-45f0-bb7a-78622ef1c828" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DB716EA1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca145b-301e-0042-6249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:00 GMT", + "x-ms-client-request-id" : "4395afbb-7e21-45f0-bb7a-78622ef1c828" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/$root?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" : "1d66f3ad-28b4-42df-b397-595b7b5dcdd0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Thu, 05 Sep 2019 18:04:42 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:00 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D7322B86ADF78A\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca1480-301e-0042-0249-67cbbf000000", + "x-ms-client-request-id" : "1d66f3ad-28b4-42df-b397-595b7b5dcdd0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/$root/rootblob", + "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" : "c797695f-0400-4f00-b248-71149153ea9f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DB8CE5B5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca149e-301e-0042-1b49-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:00 GMT", + "x-ms-client-request-id" : "c797695f-0400-4f00-b248-71149153ea9f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrootexplicit&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" : "fc854822-e161-4974-992a-6703eb495166" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca14b1-301e-0042-2a49-67cbbf000000", + "Body" : "jtcrootexplicitjtcrootexplicit0containerapitestrootexplicit25542905d6839Mon, 09 Sep 2019 20:04:01 GMT\"0x8D73560DB716EA1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:00 GMT", + "x-ms-client-request-id" : "fc854822-e161-4974-992a-6703eb495166", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrootexplicit0containerapitestrootexplicit25542905d6839?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" : "a91bdd24-082c-4e12-b872-155bf854fe9e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca14c3-301e-0042-3b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:00 GMT", + "x-ms-client-request-id" : "a91bdd24-082c-4e12-b872-155bf854fe9e" + }, + "Exception" : null + } ], + "variables" : [ "jtcrootexplicit0containerapitestrootexplicit25542905d6839" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrootexplicitinendpoint.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrootexplicitinendpoint.json new file mode 100644 index 000000000000..c8f83af28ad6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestrootexplicitinendpoint.json @@ -0,0 +1,146 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrootexplicitinendpoint0678549bb3b8a92f1d4e59?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" : "35aa2dcb-e3c0-4491-af05-7bb84ec37959" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DBB62548\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca14d1-301e-0042-4849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:00 GMT", + "x-ms-client-request-id" : "35aa2dcb-e3c0-4491-af05-7bb84ec37959" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/$root?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" : "44b136ac-680c-44ff-9fd4-dec4c831c9cf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Thu, 05 Sep 2019 18:04:42 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:00 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D7322B86ADF78A\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca14e0-301e-0042-5549-67cbbf000000", + "x-ms-client-request-id" : "44b136ac-680c-44ff-9fd4-dec4c831c9cf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/$root/rootblob", + "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" : "6993a1de-6573-4328-8258-c28772b191f1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DBCEB5A2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca14fa-301e-0042-6d49-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:00 GMT", + "x-ms-client-request-id" : "6993a1de-6573-4328-8258-c28772b191f1" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/$root/rootblob", + "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" : "3960f272-73fb-4e2f-97ff-7c47f0256dc3" + }, + "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", + "x-ms-blob-committed-block-count" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:01 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:00 GMT", + "x-ms-blob-type" : "AppendBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73560DBCEB5A2\"", + "x-ms-creation-time" : "Thu, 05 Sep 2019 18:04:42 GMT", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca1511-301e-0042-0249-67cbbf000000", + "x-ms-client-request-id" : "3960f272-73fb-4e2f-97ff-7c47f0256dc3", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrootexplicitinendpoint&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" : "32112c30-d45d-4f74-a934-a0fb86a0009c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca1520-301e-0042-0f49-67cbbf000000", + "Body" : "jtcrootexplicitinendpointjtcrootexplicitinendpoint0678549bb3b8a92f1d4e59Mon, 09 Sep 2019 20:04:01 GMT\"0x8D73560DBB62548\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:00 GMT", + "x-ms-client-request-id" : "32112c30-d45d-4f74-a934-a0fb86a0009c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrootexplicitinendpoint0678549bb3b8a92f1d4e59?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" : "c6210244-c292-4a5e-b26d-8846dafac684" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca1533-301e-0042-1f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:00 GMT", + "x-ms-client-request-id" : "c6210244-c292-4a5e-b26d-8846dafac684" + }, + "Exception" : null + } ], + "variables" : [ "jtcrootexplicitinendpoint0678549bb3b8a92f1d4e59" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicy[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicy[0].json new file mode 100644 index 000000000000..16f665b027f4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicy[0].json @@ -0,0 +1,115 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicy7dc815795e?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" : "a16a8c1c-32d1-4b36-9c23-cdb675675858" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604B3E0EDB\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff4f6-801e-001f-4749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:58 GMT", + "x-ms-client-request-id" : "a16a8c1c-32d1-4b36-9c23-cdb675675858" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicy7dc815795e?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" : "4f8309b8-4bcc-41d5-b7a5-e3fadfa74c78", + "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" : "\"0x8D735604B4A2EC2\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff500-801e-001f-5049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:58 GMT", + "x-ms-client-request-id" : "4f8309b8-4bcc-41d5-b7a5-e3fadfa74c78" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicy7dc815795e?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" : "ca112c40-4110-448b-9f74-4a9d97eee13d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:59 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:59:58 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D735604B4A2EC2\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-blob-public-access" : "blob", + "x-ms-request-id" : "077ff513-801e-001f-6049-673bbb000000", + "x-ms-client-request-id" : "ca112c40-4110-448b-9f74-4a9d97eee13d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetaccesspolicy&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" : "800b6dcc-fc04-49dc-be0c-30d353b999e8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff51d-801e-001f-6a49-673bbb000000", + "Body" : "jtcsetaccesspolicyjtcsetaccesspolicy0containerapitestsetaccesspolicy7dc815795eMon, 09 Sep 2019 19:59:59 GMT\"0x8D735604B4A2EC2\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:58 GMT", + "x-ms-client-request-id" : "800b6dcc-fc04-49dc-be0c-30d353b999e8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicy7dc815795e?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" : "6d70b8a3-449f-4c53-ab4d-e123890e5b55" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff522-801e-001f-6f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:58 GMT", + "x-ms-client-request-id" : "6d70b8a3-449f-4c53-ab4d-e123890e5b55" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicy0containerapitestsetaccesspolicy7dc815795e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicy[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicy[1].json new file mode 100644 index 000000000000..fc059c8791d2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicy[1].json @@ -0,0 +1,115 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicy8ea074479b?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" : "da928a9e-9746-4873-9c75-fd0a70c872db" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604B7B7128\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff52d-801e-001f-7949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:58 GMT", + "x-ms-client-request-id" : "da928a9e-9746-4873-9c75-fd0a70c872db" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicy8ea074479b?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" : "f479ea2e-5ecb-4714-bfed-ac292a777286", + "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" : "\"0x8D735604B8742FB\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff537-801e-001f-0249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:58 GMT", + "x-ms-client-request-id" : "f479ea2e-5ecb-4714-bfed-ac292a777286" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicy8ea074479b?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" : "2f71c361-3920-4c43-a31f-e293cf76d95c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:59 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:59:59 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D735604B8742FB\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-blob-public-access" : "container", + "x-ms-request-id" : "077ff53e-801e-001f-0949-673bbb000000", + "x-ms-client-request-id" : "2f71c361-3920-4c43-a31f-e293cf76d95c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetaccesspolicy&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" : "0ce9b1eb-74de-4c39-8b97-40c6d4832a03" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff545-801e-001f-1049-673bbb000000", + "Body" : "jtcsetaccesspolicyjtcsetaccesspolicy0containerapitestsetaccesspolicy8ea074479bMon, 09 Sep 2019 19:59:59 GMT\"0x8D735604B8742FB\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:59 GMT", + "x-ms-client-request-id" : "0ce9b1eb-74de-4c39-8b97-40c6d4832a03", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicy8ea074479b?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" : "1fd1bb5e-b869-4ce9-a551-c25b2e6fa084" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff553-801e-001f-1b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:59 GMT", + "x-ms-client-request-id" : "1fd1bb5e-b869-4ce9-a551-c25b2e6fa084" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicy0containerapitestsetaccesspolicy8ea074479b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicy[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicy[2].json new file mode 100644 index 000000000000..8f56287911b5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicy[2].json @@ -0,0 +1,114 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicy2f313291c6?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" : "09d1c058-8656-4166-8301-d37c1036c10e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604BBACFAA\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff55e-801e-001f-2549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:59 GMT", + "x-ms-client-request-id" : "09d1c058-8656-4166-8301-d37c1036c10e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicy2f313291c6?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" : "e0a55660-94bc-4434-b4c3-2dbb5e700be4", + "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" : "\"0x8D735604BC6C8A2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff56e-801e-001f-3149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:59 GMT", + "x-ms-client-request-id" : "e0a55660-94bc-4434-b4c3-2dbb5e700be4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicy2f313291c6?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" : "6d386281-a281-4de7-9de2-d913c8cef800" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:00 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:59:59 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D735604BC6C8A2\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "077ff57b-801e-001f-3d49-673bbb000000", + "x-ms-client-request-id" : "6d386281-a281-4de7-9de2-d913c8cef800" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetaccesspolicy&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" : "132319d9-a380-4d06-968d-3a3b5262a425" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff58b-801e-001f-4b49-673bbb000000", + "Body" : "jtcsetaccesspolicyjtcsetaccesspolicy0containerapitestsetaccesspolicy2f313291c6Mon, 09 Sep 2019 20:00:00 GMT\"0x8D735604BC6C8A2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:59 GMT", + "x-ms-client-request-id" : "132319d9-a380-4d06-968d-3a3b5262a425", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicy0containerapitestsetaccesspolicy2f313291c6?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" : "10bbf36f-8863-4ec4-b000-049fc561c0bb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff5a2-801e-001f-5f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:59 GMT", + "x-ms-client-request-id" : "10bbf36f-8863-4ec4-b000-049fc561c0bb" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicy0containerapitestsetaccesspolicy2f313291c6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyac[0].json new file mode 100644 index 000000000000..017743f3ee53 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyac[0].json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyacfba97843?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" : "f81afb64-1625-4c33-87d8-d4a0be5707fe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604CB90D77\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff68d-801e-001f-3349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:00 GMT", + "x-ms-client-request-id" : "f81afb64-1625-4c33-87d8-d4a0be5707fe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyacfba97843?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" : "581b6de1-5257-4862-8174-454d33e8e501", + "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" : "\"0x8D735604CC505FB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff69c-801e-001f-4049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:01 GMT", + "x-ms-client-request-id" : "581b6de1-5257-4862-8174-454d33e8e501" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetaccesspolicyac&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" : "dfd97a11-4fb8-4999-b785-792f518d4b48" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff6aa-801e-001f-4d49-673bbb000000", + "Body" : "jtcsetaccesspolicyacjtcsetaccesspolicyac0containerapitestsetaccesspolicyacfba97843Mon, 09 Sep 2019 20:00:01 GMT\"0x8D735604CC505FB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:01 GMT", + "x-ms-client-request-id" : "dfd97a11-4fb8-4999-b785-792f518d4b48", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyacfba97843?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" : "a1555492-6bf5-4f1a-863b-7ccd4d9e705b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff6ba-801e-001f-5d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:01 GMT", + "x-ms-client-request-id" : "a1555492-6bf5-4f1a-863b-7ccd4d9e705b" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyac0containerapitestsetaccesspolicyacfba97843" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyac[1].json new file mode 100644 index 000000000000..fec057c625fe --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyac[1].json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac56a84504?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" : "cb22b48c-4116-475b-be45-64e9e12471d3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604CEBE697\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff6cf-801e-001f-7049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:01 GMT", + "x-ms-client-request-id" : "cb22b48c-4116-475b-be45-64e9e12471d3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac56a84504?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" : "13dc2a8b-6188-4a9c-a85b-481e79a361ff", + "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" : "\"0x8D735604CF7DF0F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff6e1-801e-001f-7f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:01 GMT", + "x-ms-client-request-id" : "13dc2a8b-6188-4a9c-a85b-481e79a361ff" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetaccesspolicyac&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" : "79d81914-0e53-46fa-9df0-f314d95cdbe7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff6f1-801e-001f-0f49-673bbb000000", + "Body" : "jtcsetaccesspolicyacjtcsetaccesspolicyac0containerapitestsetaccesspolicyac56a84504Mon, 09 Sep 2019 20:00:02 GMT\"0x8D735604CF7DF0F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:01 GMT", + "x-ms-client-request-id" : "79d81914-0e53-46fa-9df0-f314d95cdbe7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac56a84504?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" : "76d9fb84-eab1-4633-a01c-a60f87bed375" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff700-801e-001f-1e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:01 GMT", + "x-ms-client-request-id" : "76d9fb84-eab1-4633-a01c-a60f87bed375" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyac0containerapitestsetaccesspolicyac56a84504" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyac[2].json new file mode 100644 index 000000000000..65b4fba9a53e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyac[2].json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac08814724?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" : "adf41886-52a0-4373-88e5-c07b392458d4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604D1E7179\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff70f-801e-001f-2d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:01 GMT", + "x-ms-client-request-id" : "adf41886-52a0-4373-88e5-c07b392458d4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac08814724?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" : "59072dfb-b25e-45f5-a24c-83c317fc7b97", + "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" : "\"0x8D735604D2A9106\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff719-801e-001f-3549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:01 GMT", + "x-ms-client-request-id" : "59072dfb-b25e-45f5-a24c-83c317fc7b97" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetaccesspolicyac&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" : "39e788ec-3233-434e-8bcf-3564b23c3ebe" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff728-801e-001f-4449-673bbb000000", + "Body" : "jtcsetaccesspolicyacjtcsetaccesspolicyac0containerapitestsetaccesspolicyac08814724Mon, 09 Sep 2019 20:00:02 GMT\"0x8D735604D2A9106\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:01 GMT", + "x-ms-client-request-id" : "39e788ec-3233-434e-8bcf-3564b23c3ebe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac08814724?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" : "1e98fd62-4958-43a1-839e-a28c2d9bed99" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff734-801e-001f-4f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:01 GMT", + "x-ms-client-request-id" : "1e98fd62-4958-43a1-839e-a28c2d9bed99" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyac0containerapitestsetaccesspolicyac08814724" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyac[3].json new file mode 100644 index 000000000000..991404055592 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyac[3].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac09448466?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" : "e4ffef3c-a60c-4432-b3eb-5585e7dc803e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604D50AE2C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff740-801e-001f-5b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:01 GMT", + "x-ms-client-request-id" : "e4ffef3c-a60c-4432-b3eb-5585e7dc803e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac09448466?comp=lease&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" : "a11aa640-a420-47f7-a9d6-5c7d1fa763ee" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604D50AE2C\"", + "x-ms-lease-id" : "58da7824-79e5-462c-aa6b-1945dd394b19", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff756-801e-001f-6e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:02 GMT", + "x-ms-client-request-id" : "a11aa640-a420-47f7-a9d6-5c7d1fa763ee" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac09448466?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" : "bf07183d-fc7d-4312-a9ec-136764b9ea2d", + "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" : "\"0x8D735604D692C0C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff765-801e-001f-7b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:02 GMT", + "x-ms-client-request-id" : "bf07183d-fc7d-4312-a9ec-136764b9ea2d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetaccesspolicyac&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" : "7f9ec386-b0cb-40c5-80a2-ae09188046ac" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff76b-801e-001f-0149-673bbb000000", + "Body" : "jtcsetaccesspolicyacjtcsetaccesspolicyac0containerapitestsetaccesspolicyac09448466Mon, 09 Sep 2019 20:00:02 GMT\"0x8D735604D692C0C\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:02 GMT", + "x-ms-client-request-id" : "7f9ec386-b0cb-40c5-80a2-ae09188046ac", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac09448466?comp=lease&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" : "0130e783-80f8-46fc-a8ba-605ccca105e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604D692C0C\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff777-801e-001f-0d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:02 GMT", + "x-ms-client-request-id" : "0130e783-80f8-46fc-a8ba-605ccca105e8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyac0containerapitestsetaccesspolicyac09448466?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" : "44fa34bb-220f-4f1d-aaf2-15969d2ed0f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff784-801e-001f-1a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:02 GMT", + "x-ms-client-request-id" : "44fa34bb-220f-4f1d-aaf2-15969d2ed0f2" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyac0containerapitestsetaccesspolicyac09448466" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacfail[0].json new file mode 100644 index 000000000000..28696f1c33f6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacfail[0].json @@ -0,0 +1,88 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyacfail01096194dc357c14d1420a?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" : "b6bc3f41-83cd-47b4-8152-d3e1f50894f8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604D9ABD0F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff793-801e-001f-2649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:02 GMT", + "x-ms-client-request-id" : "b6bc3f41-83cd-47b4-8152-d3e1f50894f8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyacfail01096194dc357c14d1420a?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" : "a60f7add-0804-4d9b-844a-92227cef6ed2", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "077ff7a6-801e-001f-3749-673bbb000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:077ff7a6-801e-001f-3749-673bbb000000\nTime:2019-09-09T20:00:03.2154236Z", + "Date" : "Mon, 09 Sep 2019 20:00:02 GMT", + "x-ms-client-request-id" : "a60f7add-0804-4d9b-844a-92227cef6ed2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetaccesspolicyacfail&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" : "147d0f57-463f-449b-a8e8-284c192cc687" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff7ae-801e-001f-3f49-673bbb000000", + "Body" : "jtcsetaccesspolicyacfailjtcsetaccesspolicyacfail01096194dc357c14d1420aMon, 09 Sep 2019 20:00:03 GMT\"0x8D735604D9ABD0F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:02 GMT", + "x-ms-client-request-id" : "147d0f57-463f-449b-a8e8-284c192cc687", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyacfail01096194dc357c14d1420a?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" : "90969a8e-80ce-44c1-8049-d10739b4089e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff7bd-801e-001f-4e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:02 GMT", + "x-ms-client-request-id" : "90969a8e-80ce-44c1-8049-d10739b4089e" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyacfail01096194dc357c14d1420a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacfail[1].json new file mode 100644 index 000000000000..89019f6c7c8a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacfail[1].json @@ -0,0 +1,88 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyacfail08064458572a1332fb4052?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" : "792d4791-82f1-449d-92ba-f2a731b9b1ef" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604DCC8491\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff7ce-801e-001f-5f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:02 GMT", + "x-ms-client-request-id" : "792d4791-82f1-449d-92ba-f2a731b9b1ef" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyacfail08064458572a1332fb4052?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" : "c62ad142-969d-4fab-a931-9fc3afeffe83", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "077ff7e4-801e-001f-7249-673bbb000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:077ff7e4-801e-001f-7249-673bbb000000\nTime:2019-09-09T20:00:03.5406569Z", + "Date" : "Mon, 09 Sep 2019 20:00:02 GMT", + "x-ms-client-request-id" : "c62ad142-969d-4fab-a931-9fc3afeffe83", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetaccesspolicyacfail&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" : "ecc21519-7c7a-4aaa-9607-147463211316" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff7f9-801e-001f-0349-673bbb000000", + "Body" : "jtcsetaccesspolicyacfailjtcsetaccesspolicyacfail08064458572a1332fb4052Mon, 09 Sep 2019 20:00:03 GMT\"0x8D735604DCC8491\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:02 GMT", + "x-ms-client-request-id" : "ecc21519-7c7a-4aaa-9607-147463211316", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyacfail08064458572a1332fb4052?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" : "03bedcc2-3899-447d-89e6-dccfc559124d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff804-801e-001f-0d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:03 GMT", + "x-ms-client-request-id" : "03bedcc2-3899-447d-89e6-dccfc559124d" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyacfail08064458572a1332fb4052" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacfail[2].json new file mode 100644 index 000000000000..2c4db745de92 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacfail[2].json @@ -0,0 +1,88 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyacfail07376777c7ce8696dd48de?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" : "08f221e8-bf48-40e4-b990-3c4b789a10b9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604E002131\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff814-801e-001f-1b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:03 GMT", + "x-ms-client-request-id" : "08f221e8-bf48-40e4-b990-3c4b789a10b9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyacfail07376777c7ce8696dd48de?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" : "ca2d0434-ca4e-4d8f-970b-bda16bfae22e", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseNotPresentWithContainerOperation", + "retry-after" : "0", + "Content-Length" : "251", + "StatusCode" : "412", + "x-ms-request-id" : "077ff824-801e-001f-2849-673bbb000000", + "Body" : "LeaseNotPresentWithContainerOperationThere is currently no lease on the container.\nRequestId:077ff824-801e-001f-2849-673bbb000000\nTime:2019-09-09T20:00:03.8799007Z", + "Date" : "Mon, 09 Sep 2019 20:00:03 GMT", + "x-ms-client-request-id" : "ca2d0434-ca4e-4d8f-970b-bda16bfae22e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetaccesspolicyacfail&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" : "f5e806d5-ba8e-46f6-88c5-826716f65cfa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff831-801e-001f-3449-673bbb000000", + "Body" : "jtcsetaccesspolicyacfailjtcsetaccesspolicyacfail07376777c7ce8696dd48deMon, 09 Sep 2019 20:00:03 GMT\"0x8D735604E002131\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:03 GMT", + "x-ms-client-request-id" : "f5e806d5-ba8e-46f6-88c5-826716f65cfa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyacfail07376777c7ce8696dd48de?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" : "7c56d055-14fd-4df5-90e5-d944152951a7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff83d-801e-001f-4049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:03 GMT", + "x-ms-client-request-id" : "7c56d055-14fd-4df5-90e5-d944152951a7" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyacfail07376777c7ce8696dd48de" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacillegal[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacillegal[0].json new file mode 100644 index 000000000000..3885c4656416 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacillegal[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyacillegal03451381953fc7dbd84d7?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" : "1b42a9f6-2d30-4697-8bef-9e8a7cd12b7e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604E328514\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff84b-801e-001f-4e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:03 GMT", + "x-ms-client-request-id" : "1b42a9f6-2d30-4697-8bef-9e8a7cd12b7e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetaccesspolicyacillegal&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" : "64177a07-7df5-481d-a197-a63c18ef4e29" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff85b-801e-001f-5d49-673bbb000000", + "Body" : "jtcsetaccesspolicyacillegaljtcsetaccesspolicyacillegal03451381953fc7dbd84d7Mon, 09 Sep 2019 20:00:04 GMT\"0x8D735604E328514\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:03 GMT", + "x-ms-client-request-id" : "64177a07-7df5-481d-a197-a63c18ef4e29", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyacillegal03451381953fc7dbd84d7?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" : "a15642c7-0bb7-4a04-afcb-58803ea782b1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff868-801e-001f-6949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:03 GMT", + "x-ms-client-request-id" : "a15642c7-0bb7-4a04-afcb-58803ea782b1" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyacillegal03451381953fc7dbd84d7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacillegal[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacillegal[1].json new file mode 100644 index 000000000000..f46d98e2a12c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyacillegal[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyacillegal027262bd870ee194ef4aa?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" : "6999587d-37d4-4746-b25f-b3526f0c3e22" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604E5926FC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff879-801e-001f-7949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:03 GMT", + "x-ms-client-request-id" : "6999587d-37d4-4746-b25f-b3526f0c3e22" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetaccesspolicyacillegal&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" : "8a262259-3c18-4576-aaf8-25f2925a2e39" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff888-801e-001f-0549-673bbb000000", + "Body" : "jtcsetaccesspolicyacillegaljtcsetaccesspolicyacillegal027262bd870ee194ef4aaMon, 09 Sep 2019 20:00:04 GMT\"0x8D735604E5926FC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:03 GMT", + "x-ms-client-request-id" : "8a262259-3c18-4576-aaf8-25f2925a2e39", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyacillegal027262bd870ee194ef4aa?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" : "4944aae7-9034-4d02-bb10-cf8f49903ea3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff891-801e-001f-0d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:03 GMT", + "x-ms-client-request-id" : "4944aae7-9034-4d02-bb10-cf8f49903ea3" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyacillegal027262bd870ee194ef4aa" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyerror.json new file mode 100644 index 000000000000..28335e90e8d6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyerror.json @@ -0,0 +1,88 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyerror085446225ca636a10547c2a?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" : "cbcc8cba-5ad5-483c-97df-1202f24f0e9a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604E803E2B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff8a8-801e-001f-2149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:03 GMT", + "x-ms-client-request-id" : "cbcc8cba-5ad5-483c-97df-1202f24f0e9a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyerror180876e88607a70c294dfda?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" : "b12117f7-80b3-46c3-b5b7-7e7b27027e49", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "077ff8b4-801e-001f-2c49-673bbb000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:077ff8b4-801e-001f-2c49-673bbb000000\nTime:2019-09-09T20:00:04.7205042Z", + "Date" : "Mon, 09 Sep 2019 20:00:04 GMT", + "x-ms-client-request-id" : "b12117f7-80b3-46c3-b5b7-7e7b27027e49", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetaccesspolicyerror&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" : "a2055f4f-a9b9-4bf6-b3ca-2e25627d408e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff8c2-801e-001f-3849-673bbb000000", + "Body" : "jtcsetaccesspolicyerrorjtcsetaccesspolicyerror085446225ca636a10547c2aMon, 09 Sep 2019 20:00:04 GMT\"0x8D735604E803E2B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:04 GMT", + "x-ms-client-request-id" : "a2055f4f-a9b9-4bf6-b3ca-2e25627d408e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyerror085446225ca636a10547c2a?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" : "3e75f9e2-2706-425d-bd4f-434deb3003b6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff8cc-801e-001f-4149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:04 GMT", + "x-ms-client-request-id" : "3e75f9e2-2706-425d-bd4f-434deb3003b6" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyerror085446225ca636a10547c2a", "jtcsetaccesspolicyerror180876e88607a70c294dfda" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyids.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyids.json new file mode 100644 index 000000000000..57dc41c0a4c6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyids.json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyids016609cace6c46187a4392bf?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" : "fd042e37-488a-485e-ad9a-2f5559a6c8e4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604C778B9A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff62f-801e-001f-5a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:00 GMT", + "x-ms-client-request-id" : "fd042e37-488a-485e-ad9a-2f5559a6c8e4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyids016609cace6c46187a4392bf?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" : "28a03097-de4e-4f39-b9e7-274b237efe44", + "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" : "\"0x8D735604C83F983\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff63c-801e-001f-6649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:00 GMT", + "x-ms-client-request-id" : "28a03097-de4e-4f39-b9e7-274b237efe44" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyids016609cace6c46187a4392bf?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" : "558dded8-9c14-4ea5-9999-a5c93372d265" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604C83F983\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:01 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff64a-801e-001f-7249-673bbb000000", + "Body" : "00002019-09-09T20:00:01.0000000Z2019-09-10T20:00:01.0000000Zr00012019-09-09T20:00:01.0000000Z2019-09-11T20:00:01.0000000Zw", + "Date" : "Mon, 09 Sep 2019 20:00:00 GMT", + "x-ms-client-request-id" : "558dded8-9c14-4ea5-9999-a5c93372d265", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetaccesspolicyids&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" : "4e2f542f-d223-4a07-a185-98da342ec506" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff666-801e-001f-0e49-673bbb000000", + "Body" : "jtcsetaccesspolicyidsjtcsetaccesspolicyids016609cace6c46187a4392bfMon, 09 Sep 2019 20:00:01 GMT\"0x8D735604C83F983\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:00 GMT", + "x-ms-client-request-id" : "4e2f542f-d223-4a07-a185-98da342ec506", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyids016609cace6c46187a4392bf?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" : "8e90bf10-ec1b-4b63-887a-fe64b0fe0657" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff67a-801e-001f-2249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:00 GMT", + "x-ms-client-request-id" : "8e90bf10-ec1b-4b63-887a-fe64b0fe0657" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyids016609cace6c46187a4392bf", "2019-09-09T20:00:01.305Z", "2019-09-09T20:00:01.305Z", "2019-09-09T20:00:01.305Z", "2019-09-09T20:00:01.305Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyminaccess.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyminaccess.json new file mode 100644 index 000000000000..221589f70ff6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyminaccess.json @@ -0,0 +1,115 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyminaccess028630293b16599ffa412?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" : "9d30bd1f-a6aa-4f81-aa7a-3986f7f600b4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604BF8803C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff5b0-801e-001f-6d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:59 GMT", + "x-ms-client-request-id" : "9d30bd1f-a6aa-4f81-aa7a-3986f7f600b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyminaccess028630293b16599ffa412?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" : "b2cf57ab-ed3b-4904-bc46-8d96664c6e97", + "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" : "\"0x8D735604C04791E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff5bc-801e-001f-7649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:59 GMT", + "x-ms-client-request-id" : "b2cf57ab-ed3b-4904-bc46-8d96664c6e97" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyminaccess028630293b16599ffa412?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" : "4e0d790c-581a-420c-a553-8c682dd84ce2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:00 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:59:59 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D735604C04791E\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-blob-public-access" : "container", + "x-ms-request-id" : "077ff5c4-801e-001f-7e49-673bbb000000", + "x-ms-client-request-id" : "4e0d790c-581a-420c-a553-8c682dd84ce2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetaccesspolicyminaccess&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" : "5ce620ae-171f-4861-932e-ed82e18a7329" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff5cf-801e-001f-0849-673bbb000000", + "Body" : "jtcsetaccesspolicyminaccessjtcsetaccesspolicyminaccess028630293b16599ffa412Mon, 09 Sep 2019 20:00:00 GMT\"0x8D735604C04791E\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:59 GMT", + "x-ms-client-request-id" : "5ce620ae-171f-4861-932e-ed82e18a7329", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyminaccess028630293b16599ffa412?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" : "e4b00c06-2a7d-4af5-85d5-105cd98d9489" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff5d6-801e-001f-0f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:00 GMT", + "x-ms-client-request-id" : "e4b00c06-2a7d-4af5-85d5-105cd98d9489" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyminaccess028630293b16599ffa412" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyminids.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyminids.json new file mode 100644 index 000000000000..222782dfc0d0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetaccesspolicyminids.json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyminids07961782c81c488e99499d?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" : "7af82a1d-0c73-4a20-9511-d94933530c12" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604C3657EC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff5e4-801e-001f-1d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:00 GMT", + "x-ms-client-request-id" : "7af82a1d-0c73-4a20-9511-d94933530c12" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyminids07961782c81c488e99499d?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" : "f6103698-e833-4380-b098-26faa8083a19", + "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" : "\"0x8D735604C4473FB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff5ee-801e-001f-2449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:00 GMT", + "x-ms-client-request-id" : "f6103698-e833-4380-b098-26faa8083a19" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyminids07961782c81c488e99499d?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" : "77a1e7b1-7fbc-4a8a-bd73-dfad94d7fcf6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604C4473FB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:00:00 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff600-801e-001f-3049-673bbb000000", + "Body" : "00002019-09-09T20:00:00.0000000Z2019-09-10T20:00:00.0000000Zr", + "Date" : "Mon, 09 Sep 2019 20:00:00 GMT", + "x-ms-client-request-id" : "77a1e7b1-7fbc-4a8a-bd73-dfad94d7fcf6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetaccesspolicyminids&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" : "5549d6f5-4e5c-4431-b859-c99a25b319b4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff60e-801e-001f-3d49-673bbb000000", + "Body" : "jtcsetaccesspolicyminidsjtcsetaccesspolicyminids07961782c81c488e99499dMon, 09 Sep 2019 20:00:00 GMT\"0x8D735604C4473FB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:00:00 GMT", + "x-ms-client-request-id" : "5549d6f5-4e5c-4431-b859-c99a25b319b4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetaccesspolicyminids07961782c81c488e99499d?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" : "e7d56c62-216c-4df4-b8fb-a0da0513e281" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff622-801e-001f-4e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 20:00:00 GMT", + "x-ms-client-request-id" : "e7d56c62-216c-4df4-b8fb-a0da0513e281" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetaccesspolicyminids07961782c81c488e99499d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadata.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadata.json new file mode 100644 index 000000000000..35dc38be8127 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadata.json @@ -0,0 +1,153 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadata0containerapitestsetmetadatabbf86185c2f945?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" : "59e965d9-2c63-470d-8fe1-0fe436a72a3e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604868BF05\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff1da-801e-001f-0249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:53 GMT", + "x-ms-client-request-id" : "59e965d9-2c63-470d-8fe1-0fe436a72a3e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadata1containerapitestsetmetadatabbf0983358ca37?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" : "2202662c-8749-4150-a45c-34ccb114edf2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356048751D59\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff1e9-801e-001f-0e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:53 GMT", + "x-ms-client-request-id" : "2202662c-8749-4150-a45c-34ccb114edf2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadata1containerapitestsetmetadatabbf0983358ca37?restype=container&comp=metadata", + "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" : "2444a8fb-f588-493d-81f1-1d43b9f42747" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356048813DF2\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff1f4-801e-001f-1849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:53 GMT", + "x-ms-client-request-id" : "2444a8fb-f588-493d-81f1-1d43b9f42747" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadata1containerapitestsetmetadatabbf0983358ca37?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" : "234807b4-3b89-4e85-aea5-856a7fab23eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:54 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:59:54 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D7356048813DF2\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "077ff1fe-801e-001f-2049-673bbb000000", + "x-ms-client-request-id" : "234807b4-3b89-4e85-aea5-856a7fab23eb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadata&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" : "6196b0b8-de9f-4736-8a76-017955f9ccff" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff207-801e-001f-2749-673bbb000000", + "Body" : "jtcsetmetadatajtcsetmetadata0containerapitestsetmetadatabbf86185c2f945Mon, 09 Sep 2019 19:59:54 GMT\"0x8D735604868BF05\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcsetmetadata1containerapitestsetmetadatabbf0983358ca37Mon, 09 Sep 2019 19:59:54 GMT\"0x8D7356048813DF2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:54 GMT", + "x-ms-client-request-id" : "6196b0b8-de9f-4736-8a76-017955f9ccff", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadata0containerapitestsetmetadatabbf86185c2f945?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" : "8f55f557-3f8d-4471-9ff5-8b34753992bc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff214-801e-001f-3249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:54 GMT", + "x-ms-client-request-id" : "8f55f557-3f8d-4471-9ff5-8b34753992bc" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadata1containerapitestsetmetadatabbf0983358ca37?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" : "08ede7cc-7d45-4c98-984b-6749f25829cb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff222-801e-001f-3e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:54 GMT", + "x-ms-client-request-id" : "08ede7cc-7d45-4c98-984b-6749f25829cb" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadata0containerapitestsetmetadatabbf86185c2f945", "jtcsetmetadata1containerapitestsetmetadatabbf0983358ca37" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataac[0].json new file mode 100644 index 000000000000..4a987eeb3b3f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataac[0].json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataacf0911185269d?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" : "cccb469d-7cbf-454c-b894-e7b6b3f3fc23" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604981B562\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff2e3-801e-001f-6949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:55 GMT", + "x-ms-client-request-id" : "cccb469d-7cbf-454c-b894-e7b6b3f3fc23" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataacf0911185269d?restype=container&comp=metadata", + "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" : "a43f60e3-0fec-4bc4-bb49-e93a84de42d3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560498F0EA4\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff2f1-801e-001f-7349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:55 GMT", + "x-ms-client-request-id" : "a43f60e3-0fec-4bc4-bb49-e93a84de42d3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadataac&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" : "59a1c53c-3668-4fb0-a5df-94f1b76dc9f6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff2fa-801e-001f-7c49-673bbb000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0containerapitestsetmetadataacf0911185269dMon, 09 Sep 2019 19:59:56 GMT\"0x8D73560498F0EA4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:55 GMT", + "x-ms-client-request-id" : "59a1c53c-3668-4fb0-a5df-94f1b76dc9f6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataacf0911185269d?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" : "fffe80a1-9bd6-4e8b-b9cf-2581d02eed56" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff305-801e-001f-0749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:55 GMT", + "x-ms-client-request-id" : "fffe80a1-9bd6-4e8b-b9cf-2581d02eed56" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0containerapitestsetmetadataacf0911185269d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataac[1].json new file mode 100644 index 000000000000..cc49491f1523 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataac[1].json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataac0d967818758c?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" : "35f9696e-d433-462f-953c-0d3e369f04cd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356049B55203\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff318-801e-001f-1949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:55 GMT", + "x-ms-client-request-id" : "35f9696e-d433-462f-953c-0d3e369f04cd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataac0d967818758c?restype=container&comp=metadata", + "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" : "79f66796-f595-49e6-b6af-a1c432c41b12" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356049C1727E\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff328-801e-001f-2749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:56 GMT", + "x-ms-client-request-id" : "79f66796-f595-49e6-b6af-a1c432c41b12" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadataac&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" : "c36cd35e-ee40-45b0-8eca-613f18983c70" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff33c-801e-001f-3949-673bbb000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0containerapitestsetmetadataac0d967818758cMon, 09 Sep 2019 19:59:56 GMT\"0x8D7356049C1727E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:56 GMT", + "x-ms-client-request-id" : "c36cd35e-ee40-45b0-8eca-613f18983c70", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataac0d967818758c?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" : "5e83282c-5a0a-4e18-b30b-3ecaa6b473f7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff343-801e-001f-4049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:56 GMT", + "x-ms-client-request-id" : "5e83282c-5a0a-4e18-b30b-3ecaa6b473f7" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0containerapitestsetmetadataac0d967818758c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataac[2].json new file mode 100644 index 000000000000..210aea785eae --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataac[2].json @@ -0,0 +1,130 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataac162897590514?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" : "7af5ae39-b6d4-458f-8652-7f47bef46f6f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356049E9B211\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff353-801e-001f-5049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:56 GMT", + "x-ms-client-request-id" : "7af5ae39-b6d4-458f-8652-7f47bef46f6f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataac162897590514?comp=lease&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" : "9db98b63-b506-48aa-99be-af0bd31d99dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356049E9B211\"", + "x-ms-lease-id" : "827a0658-93ef-4201-9d21-87195416da56", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff36a-801e-001f-6649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:56 GMT", + "x-ms-client-request-id" : "9db98b63-b506-48aa-99be-af0bd31d99dc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataac162897590514?restype=container&comp=metadata", + "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" : "4d3309db-3860-46ac-ac97-3005651c115f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604A020999\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff381-801e-001f-7a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:56 GMT", + "x-ms-client-request-id" : "4d3309db-3860-46ac-ac97-3005651c115f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadataac&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" : "c19c2409-ce16-4685-ac3f-4dd9adcdd42c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff399-801e-001f-1149-673bbb000000", + "Body" : "jtcsetmetadataacjtcsetmetadataac0containerapitestsetmetadataac162897590514Mon, 09 Sep 2019 19:59:57 GMT\"0x8D735604A020999\"lockedleasedinfinite$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:56 GMT", + "x-ms-client-request-id" : "c19c2409-ce16-4685-ac3f-4dd9adcdd42c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataac162897590514?comp=lease&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" : "3119c8c7-6a6e-48a4-8558-c651eb8e7cf3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604A020999\"", + "x-ms-lease-time" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff3aa-801e-001f-2149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:56 GMT", + "x-ms-client-request-id" : "3119c8c7-6a6e-48a4-8558-c651eb8e7cf3" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataac0containerapitestsetmetadataac162897590514?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" : "382a2781-7f15-4f53-ba4b-a99f1f40a362" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff3b8-801e-001f-2e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:56 GMT", + "x-ms-client-request-id" : "382a2781-7f15-4f53-ba4b-a99f1f40a362" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataac0containerapitestsetmetadataac162897590514" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacfail[0].json new file mode 100644 index 000000000000..ef3de9878c83 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacfail[0].json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0containerapitestsetmetadataacfailfd482702?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" : "eb46a9b5-4792-4e78-b8ed-fd756fb6e4c0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604A33C0FB\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff3c8-801e-001f-3849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:56 GMT", + "x-ms-client-request-id" : "eb46a9b5-4792-4e78-b8ed-fd756fb6e4c0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0containerapitestsetmetadataacfailfd482702?restype=container&comp=metadata", + "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" : "c9e049a7-9b0f-4104-bc72-e58dcb024ef3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "077ff3d9-801e-001f-4849-673bbb000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:077ff3d9-801e-001f-4849-673bbb000000\nTime:2019-09-09T19:59:57.5063379Z", + "Date" : "Mon, 09 Sep 2019 19:59:56 GMT", + "x-ms-client-request-id" : "c9e049a7-9b0f-4104-bc72-e58dcb024ef3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadataacfail&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" : "f0ef5c5f-d7a6-47fa-b3bd-9ede9914e265" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff3e5-801e-001f-5449-673bbb000000", + "Body" : "jtcsetmetadataacfailjtcsetmetadataacfail0containerapitestsetmetadataacfailfd482702Mon, 09 Sep 2019 19:59:57 GMT\"0x8D735604A33C0FB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:56 GMT", + "x-ms-client-request-id" : "f0ef5c5f-d7a6-47fa-b3bd-9ede9914e265", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0containerapitestsetmetadataacfailfd482702?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" : "c2386d6b-dadc-41df-bf9d-ab7460c54263" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff3ec-801e-001f-5b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:57 GMT", + "x-ms-client-request-id" : "c2386d6b-dadc-41df-bf9d-ab7460c54263" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacfail0containerapitestsetmetadataacfailfd482702" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacfail[1].json new file mode 100644 index 000000000000..28d632d98515 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacfail[1].json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0containerapitestsetmetadataacfaild0c45543?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" : "ebc1d1aa-61e9-4b9e-bd71-99c547658114" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604A670F6E\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff3fb-801e-001f-6a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:57 GMT", + "x-ms-client-request-id" : "ebc1d1aa-61e9-4b9e-bd71-99c547658114" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0containerapitestsetmetadataacfaild0c45543?restype=container&comp=metadata", + "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" : "c230b02a-28ae-41e0-9a29-958b945e5a9b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseNotPresentWithContainerOperation", + "retry-after" : "0", + "Content-Length" : "251", + "StatusCode" : "412", + "x-ms-request-id" : "077ff40c-801e-001f-7849-673bbb000000", + "Body" : "LeaseNotPresentWithContainerOperationThere is currently no lease on the container.\nRequestId:077ff40c-801e-001f-7849-673bbb000000\nTime:2019-09-09T19:59:57.8435803Z", + "Date" : "Mon, 09 Sep 2019 19:59:57 GMT", + "x-ms-client-request-id" : "c230b02a-28ae-41e0-9a29-958b945e5a9b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadataacfail&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" : "0efe4783-dc69-4dfb-b2d0-dcce5f6ac71d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff416-801e-001f-0249-673bbb000000", + "Body" : "jtcsetmetadataacfailjtcsetmetadataacfail0containerapitestsetmetadataacfaild0c45543Mon, 09 Sep 2019 19:59:57 GMT\"0x8D735604A670F6E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:57 GMT", + "x-ms-client-request-id" : "0efe4783-dc69-4dfb-b2d0-dcce5f6ac71d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacfail0containerapitestsetmetadataacfaild0c45543?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" : "16720d44-fe7d-4834-ac47-c79409caaaaf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff420-801e-001f-0c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:57 GMT", + "x-ms-client-request-id" : "16720d44-fe7d-4834-ac47-c79409caaaaf" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacfail0containerapitestsetmetadataacfaild0c45543" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacillegal[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacillegal[0].json new file mode 100644 index 000000000000..fc5ee14de928 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacillegal[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacillegal001672a8b9ad9ddd1f4cf0b?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" : "a6e30435-8f01-4f2e-9aa1-7b8aa79ad0db" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604A9888CA\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff42d-801e-001f-1949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:57 GMT", + "x-ms-client-request-id" : "a6e30435-8f01-4f2e-9aa1-7b8aa79ad0db" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadataacillegal&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" : "751b61f8-a188-4283-bbe4-bd7aa65e9e64" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff43b-801e-001f-2349-673bbb000000", + "Body" : "jtcsetmetadataacillegaljtcsetmetadataacillegal001672a8b9ad9ddd1f4cf0bMon, 09 Sep 2019 19:59:58 GMT\"0x8D735604A9888CA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:57 GMT", + "x-ms-client-request-id" : "751b61f8-a188-4283-bbe4-bd7aa65e9e64", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacillegal001672a8b9ad9ddd1f4cf0b?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" : "100f56cf-a2e7-40a4-bc18-2d0795de12bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff44c-801e-001f-3249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:57 GMT", + "x-ms-client-request-id" : "100f56cf-a2e7-40a4-bc18-2d0795de12bf" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacillegal001672a8b9ad9ddd1f4cf0b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacillegal[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacillegal[1].json new file mode 100644 index 000000000000..af3a1a49c388 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacillegal[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacillegal089153b43bb18cde5547b2b?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" : "a3c99ceb-1999-48f1-9318-3654f94adf36" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604ABF2AAD\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff465-801e-001f-4149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:57 GMT", + "x-ms-client-request-id" : "a3c99ceb-1999-48f1-9318-3654f94adf36" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadataacillegal&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" : "20b8deff-08e5-4614-be86-bf36c9d7d262" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff471-801e-001f-4c49-673bbb000000", + "Body" : "jtcsetmetadataacillegaljtcsetmetadataacillegal089153b43bb18cde5547b2bMon, 09 Sep 2019 19:59:58 GMT\"0x8D735604ABF2AAD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:57 GMT", + "x-ms-client-request-id" : "20b8deff-08e5-4614-be86-bf36c9d7d262", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacillegal089153b43bb18cde5547b2b?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" : "8474c1d1-0fea-4af3-b270-7f602c5f0b63" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff47e-801e-001f-5949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:57 GMT", + "x-ms-client-request-id" : "8474c1d1-0fea-4af3-b270-7f602c5f0b63" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacillegal089153b43bb18cde5547b2b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacillegal[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacillegal[2].json new file mode 100644 index 000000000000..e341efaddb73 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataacillegal[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacillegal01357231f510071fe44bb78?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" : "d9717edc-5b3f-4390-b1c7-b7105b12619a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604AE46CDC\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff48b-801e-001f-6449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:57 GMT", + "x-ms-client-request-id" : "d9717edc-5b3f-4390-b1c7-b7105b12619a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadataacillegal&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" : "63c68ae1-71e4-4ae3-ad47-d23d0634c944" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff49f-801e-001f-7749-673bbb000000", + "Body" : "jtcsetmetadataacillegaljtcsetmetadataacillegal01357231f510071fe44bb78Mon, 09 Sep 2019 19:59:58 GMT\"0x8D735604AE46CDC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:57 GMT", + "x-ms-client-request-id" : "63c68ae1-71e4-4ae3-ad47-d23d0634c944", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataacillegal01357231f510071fe44bb78?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" : "6d52f648-b253-493a-9831-582479fdfb84" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff4b8-801e-001f-0e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:58 GMT", + "x-ms-client-request-id" : "6d52f648-b253-493a-9831-582479fdfb84" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataacillegal01357231f510071fe44bb78" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataerror.json new file mode 100644 index 000000000000..c8e6e0821a2d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadataerror.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataerror0containerapitestsetmetadataerrore70376002?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" : "15d7c8a5-73ba-4729-a8fe-cb8b507896d2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604B09FD16\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff4c6-801e-001f-1a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:58 GMT", + "x-ms-client-request-id" : "15d7c8a5-73ba-4729-a8fe-cb8b507896d2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataerror1containerapitestsetmetadataerrore70968996?restype=container&comp=metadata", + "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" : "a5c73083-173c-427d-b225-9241245cf77e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerNotFound", + "retry-after" : "0", + "Content-Length" : "225", + "StatusCode" : "404", + "x-ms-request-id" : "077ff4d7-801e-001f-2949-673bbb000000", + "Body" : "ContainerNotFoundThe specified container does not exist.\nRequestId:077ff4d7-801e-001f-2949-673bbb000000\nTime:2019-09-09T19:59:58.9103452Z", + "Date" : "Mon, 09 Sep 2019 19:59:58 GMT", + "x-ms-client-request-id" : "a5c73083-173c-427d-b225-9241245cf77e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadataerror&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" : "0517e970-02ce-4d0b-9f84-ac598744909d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff4df-801e-001f-3149-673bbb000000", + "Body" : "jtcsetmetadataerrorjtcsetmetadataerror0containerapitestsetmetadataerrore70376002Mon, 09 Sep 2019 19:59:58 GMT\"0x8D735604B09FD16\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:58 GMT", + "x-ms-client-request-id" : "0517e970-02ce-4d0b-9f84-ac598744909d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadataerror0containerapitestsetmetadataerrore70376002?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" : "3dd09a83-75c4-4b29-8fbc-006704284df1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff4ed-801e-001f-3e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:58 GMT", + "x-ms-client-request-id" : "3dd09a83-75c4-4b29-8fbc-006704284df1" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadataerror0containerapitestsetmetadataerrore70376002", "jtcsetmetadataerror1containerapitestsetmetadataerrore70968996" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadatametadata[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadatametadata[0].json new file mode 100644 index 000000000000..6998ef327838 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadatametadata[0].json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatametadata02811129de3d4eeb4c4a21a?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" : "03824998-1d95-441d-8a9d-70954d748b67" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356049019883\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff270-801e-001f-0449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:54 GMT", + "x-ms-client-request-id" : "03824998-1d95-441d-8a9d-70954d748b67" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatametadata02811129de3d4eeb4c4a21a?restype=container&comp=metadata", + "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" : "af708e3d-9b41-410c-8f30-f8ceaa4cd4be" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560490E2E68\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff27e-801e-001f-1049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:54 GMT", + "x-ms-client-request-id" : "af708e3d-9b41-410c-8f30-f8ceaa4cd4be" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatametadata02811129de3d4eeb4c4a21a?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" : "b61a984e-f259-49a3-89b7-0ca961499fcb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:55 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:59:54 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D73560490E2E68\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "077ff290-801e-001f-2049-673bbb000000", + "x-ms-client-request-id" : "b61a984e-f259-49a3-89b7-0ca961499fcb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadatametadata&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" : "0580ab41-89a4-43cf-a275-22bc4513abc6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff29e-801e-001f-2c49-673bbb000000", + "Body" : "jtcsetmetadatametadatajtcsetmetadatametadata02811129de3d4eeb4c4a21aMon, 09 Sep 2019 19:59:55 GMT\"0x8D73560490E2E68\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:55 GMT", + "x-ms-client-request-id" : "0580ab41-89a4-43cf-a275-22bc4513abc6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatametadata02811129de3d4eeb4c4a21a?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" : "58ddaf0e-91ae-482e-a8aa-2b8879b01e4d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff2a3-801e-001f-3149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:55 GMT", + "x-ms-client-request-id" : "58ddaf0e-91ae-482e-a8aa-2b8879b01e4d" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadatametadata02811129de3d4eeb4c4a21a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadatametadata[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadatametadata[1].json new file mode 100644 index 000000000000..a6dd37a34ec7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadatametadata[1].json @@ -0,0 +1,115 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatametadata06083944237b795978409db?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" : "70d8c3b7-f6fb-4214-96db-1aa995b6335a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604941E187\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff2b3-801e-001f-3d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:55 GMT", + "x-ms-client-request-id" : "70d8c3b7-f6fb-4214-96db-1aa995b6335a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatametadata06083944237b795978409db?restype=container&comp=metadata", + "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" : "9aaa8080-cb31-418d-b330-e96059b8e0cc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560494DDB0E\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff2b9-801e-001f-4249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:55 GMT", + "x-ms-client-request-id" : "9aaa8080-cb31-418d-b330-e96059b8e0cc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatametadata06083944237b795978409db?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" : "3b7b89f2-172e-44ee-947b-12d8e02e38da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:55 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:59:55 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-meta-foo" : "bar", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D73560494DDB0E\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "077ff2bd-801e-001f-4649-673bbb000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "3b7b89f2-172e-44ee-947b-12d8e02e38da" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadatametadata&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" : "6c7aed17-b729-4813-ac7e-2b715a4e2ee4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff2cc-801e-001f-5449-673bbb000000", + "Body" : "jtcsetmetadatametadatajtcsetmetadatametadata06083944237b795978409dbMon, 09 Sep 2019 19:59:55 GMT\"0x8D73560494DDB0E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:55 GMT", + "x-ms-client-request-id" : "6c7aed17-b729-4813-ac7e-2b715a4e2ee4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatametadata06083944237b795978409db?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" : "74cf1e72-1c4c-4d6e-a739-f6cb9b344d1d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff2da-801e-001f-6049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:55 GMT", + "x-ms-client-request-id" : "74cf1e72-1c4c-4d6e-a739-f6cb9b344d1d" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadatametadata06083944237b795978409db" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadatamin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadatamin.json new file mode 100644 index 000000000000..e258bc0d21a8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestsetmetadatamin.json @@ -0,0 +1,114 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatamin0containerapitestsetmetadatamin3a498784e62?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" : "10f49d81-c401-4334-9c36-12d52ef865c0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356048C1C4C9\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077ff230-801e-001f-4c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:54 GMT", + "x-ms-client-request-id" : "10f49d81-c401-4334-9c36-12d52ef865c0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatamin0containerapitestsetmetadatamin3a498784e62?restype=container&comp=metadata", + "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" : "5154cdd4-5e82-4d97-90e2-b980740b60dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356048CE0C7B\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff23e-801e-001f-5949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:54 GMT", + "x-ms-client-request-id" : "5154cdd4-5e82-4d97-90e2-b980740b60dc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatamin0containerapitestsetmetadatamin3a498784e62?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" : "c76528fc-1549-475c-b449-f20507b849ba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "x-ms-deny-encryption-scope-override" : "false", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:55 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:59:54 GMT", + "x-ms-has-legal-hold" : "false", + "x-ms-meta-foo" : "bar", + "x-ms-default-encryption-scope" : "$account-encryption-key", + "ETag" : "\"0x8D7356048CE0C7B\"", + "x-ms-has-immutability-policy" : "false", + "Content-Length" : "0", + "x-ms-request-id" : "077ff248-801e-001f-6149-673bbb000000", + "x-ms-client-request-id" : "c76528fc-1549-475c-b449-f20507b849ba" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetmetadatamin&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" : "82070562-9219-42f5-95c1-aa0214c115a1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077ff25d-801e-001f-7449-673bbb000000", + "Body" : "jtcsetmetadataminjtcsetmetadatamin0containerapitestsetmetadatamin3a498784e62Mon, 09 Sep 2019 19:59:55 GMT\"0x8D7356048CE0C7B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:54 GMT", + "x-ms-client-request-id" : "82070562-9219-42f5-95c1-aa0214c115a1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetmetadatamin0containerapitestsetmetadatamin3a498784e62?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" : "1a3f38c6-6e14-4686-9008-747509674537" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077ff267-801e-001f-7b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:54 GMT", + "x-ms-client-request-id" : "1a3f38c6-6e14-4686-9008-747509674537" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetmetadatamin0containerapitestsetmetadatamin3a498784e62" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestwebcontainer.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestwebcontainer.json new file mode 100644 index 000000000000..77c000711692 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ContainerAPITestwebcontainer.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcwebcontainer0containerapitestwebcontainer1a639404b1d66?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" : "b410becc-437f-4f5a-9088-7e32ee48c74d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DC02F3BB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca1549-301e-0042-3249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:01 GMT", + "x-ms-client-request-id" : "b410becc-437f-4f5a-9088-7e32ee48c74d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/$web?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" : "c8612d15-6a44-4ac0-9529-4681631012a7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ContainerAlreadyExists", + "retry-after" : "0", + "Content-Length" : "230", + "StatusCode" : "409", + "x-ms-request-id" : "c5ca1559-301e-0042-4149-67cbbf000000", + "Body" : "ContainerAlreadyExistsThe specified container already exists.\nRequestId:c5ca1559-301e-0042-4149-67cbbf000000\nTime:2019-09-09T20:04:02.1348639Z", + "Date" : "Mon, 09 Sep 2019 20:04:01 GMT", + "x-ms-client-request-id" : "c8612d15-6a44-4ac0-9529-4681631012a7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/$web?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" : "1996ed14-b0b8-467f-ae5d-ef9aa72b1349", + "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" : "\"0x8D73560DC1BE0D0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca1571-301e-0042-5849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:01 GMT", + "x-ms-client-request-id" : "1996ed14-b0b8-467f-ae5d-ef9aa72b1349" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcwebcontainer&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" : "c6e11897-400f-4915-9acb-050787d58d39" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca1583-301e-0042-6849-67cbbf000000", + "Body" : "jtcwebcontainerjtcwebcontainer0containerapitestwebcontainer1a639404b1d66Mon, 09 Sep 2019 20:04:02 GMT\"0x8D73560DC02F3BB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:01 GMT", + "x-ms-client-request-id" : "c6e11897-400f-4915-9acb-050787d58d39", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcwebcontainer0containerapitestwebcontainer1a639404b1d66?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" : "001a730a-4e92-4395-9d10-9ea4bde2f34e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca1592-301e-0042-7749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:01 GMT", + "x-ms-client-request-id" : "001a730a-4e92-4395-9d10-9ea4bde2f34e" + }, + "Exception" : null + } ], + "variables" : [ "jtcwebcontainer0containerapitestwebcontainer1a639404b1d66" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestfailure[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestfailure[0].json new file mode 100644 index 000000000000..707e266ee929 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestfailure[0].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcfailure0downloadresponsetestfailure4f6321945f9bdec0?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" : "95ae24b8-fca8-4d60-a2d4-44f289e74f0f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DDD83017\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca190f-301e-0042-3a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:04 GMT", + "x-ms-client-request-id" : "95ae24b8-fca8-4d60-a2d4-44f289e74f0f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcfailure0downloadresponsetestfailure4f6321945f9bdec0/javablobfailure1downloadresponsetestfailure4f648495c28dae", + "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" : "455ced44-0e9c-456d-a53b-39a7e2f1b924", + "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 20:04:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:04 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560DDE59AF5\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca1921-301e-0042-4a49-67cbbf000000", + "x-ms-client-request-id" : "455ced44-0e9c-456d-a53b-39a7e2f1b924" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcfailure&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" : "24e95d19-927b-4157-bad9-86acb48161ae" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca1938-301e-0042-5d49-67cbbf000000", + "Body" : "jtcfailurejtcfailure0downloadresponsetestfailure4f6321945f9bdec0Mon, 09 Sep 2019 20:04:05 GMT\"0x8D73560DDD83017\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:04 GMT", + "x-ms-client-request-id" : "24e95d19-927b-4157-bad9-86acb48161ae", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcfailure0downloadresponsetestfailure4f6321945f9bdec0?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" : "57aa57a3-1317-43ae-9536-3e793cf56740" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca194d-301e-0042-7249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:04 GMT", + "x-ms-client-request-id" : "57aa57a3-1317-43ae-9536-3e793cf56740" + }, + "Exception" : null + } ], + "variables" : [ "jtcfailure0downloadresponsetestfailure4f6321945f9bdec0", "javablobfailure1downloadresponsetestfailure4f648495c28dae" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestfailure[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestfailure[1].json new file mode 100644 index 000000000000..f3615b13ff58 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestfailure[1].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcfailure0downloadresponsetestfailurea8b8685910ec2eb3?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" : "da461aee-34fc-4248-9558-eeb955fd6efe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DE0DC8CA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca1965-301e-0042-0949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:04 GMT", + "x-ms-client-request-id" : "da461aee-34fc-4248-9558-eeb955fd6efe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcfailure0downloadresponsetestfailurea8b8685910ec2eb3/javablobfailure1downloadresponsetestfailurea8b01215ef1843", + "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" : "fe078178-6105-4c9e-9552-55ea9a3eccd6", + "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 20:04:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:04 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560DE1B33A5\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca1976-301e-0042-1849-67cbbf000000", + "x-ms-client-request-id" : "fe078178-6105-4c9e-9552-55ea9a3eccd6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcfailure&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" : "3c457641-5a66-4901-bd89-aa9c57974279" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca1989-301e-0042-2b49-67cbbf000000", + "Body" : "jtcfailurejtcfailure0downloadresponsetestfailurea8b8685910ec2eb3Mon, 09 Sep 2019 20:04:05 GMT\"0x8D73560DE0DC8CA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:04 GMT", + "x-ms-client-request-id" : "3c457641-5a66-4901-bd89-aa9c57974279", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcfailure0downloadresponsetestfailurea8b8685910ec2eb3?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" : "8c11e570-55eb-465a-abbe-2b7371930322" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca199e-301e-0042-4049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:04 GMT", + "x-ms-client-request-id" : "8c11e570-55eb-465a-abbe-2b7371930322" + }, + "Exception" : null + } ], + "variables" : [ "jtcfailure0downloadresponsetestfailurea8b8685910ec2eb3", "javablobfailure1downloadresponsetestfailurea8b01215ef1843" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestfailure[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestfailure[2].json new file mode 100644 index 000000000000..4d0789d02f5c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestfailure[2].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcfailure0downloadresponsetestfailureeab886433f2e15c7?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" : "c5d30644-b5a0-4a8d-ba6d-7793fe0564f8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DE436181\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca19bc-301e-0042-5b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:04 GMT", + "x-ms-client-request-id" : "c5d30644-b5a0-4a8d-ba6d-7793fe0564f8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcfailure0downloadresponsetestfailureeab886433f2e15c7/javablobfailure1downloadresponsetestfailureeab81302e6fb42", + "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" : "a19992a9-0122-46f9-b2af-ecacb3b10250", + "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 20:04:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:04 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560DE50F36F\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca19d3-301e-0042-7049-67cbbf000000", + "x-ms-client-request-id" : "a19992a9-0122-46f9-b2af-ecacb3b10250" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcfailure&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" : "52cdf148-1583-4577-9665-f3437316caf9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca19de-301e-0042-7a49-67cbbf000000", + "Body" : "jtcfailurejtcfailure0downloadresponsetestfailureeab886433f2e15c7Mon, 09 Sep 2019 20:04:05 GMT\"0x8D73560DE436181\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:05 GMT", + "x-ms-client-request-id" : "52cdf148-1583-4577-9665-f3437316caf9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcfailure0downloadresponsetestfailureeab886433f2e15c7?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" : "40f9507b-d57f-4aac-9ee6-84abdf226eb2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca19fb-301e-0042-1349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:05 GMT", + "x-ms-client-request-id" : "40f9507b-d57f-4aac-9ee6-84abdf226eb2" + }, + "Exception" : null + } ], + "variables" : [ "jtcfailure0downloadresponsetestfailureeab886433f2e15c7", "javablobfailure1downloadresponsetestfailureeab81302e6fb42" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestgetteria.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestgetteria.json new file mode 100644 index 000000000000..06a6f5aac956 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestgetteria.json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetteria0downloadresponsetestgetteriadbd2505464b647c?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" : "0e179c48-bb9c-4dc0-a964-36f92026fffc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DF1B242A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca1b1a-301e-0042-1749-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:06 GMT", + "x-ms-client-request-id" : "0e179c48-bb9c-4dc0-a964-36f92026fffc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetteria0downloadresponsetestgetteriadbd2505464b647c/javablobgetteria1downloadresponsetestgetteriadbd026815ea31", + "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" : "617f4191-0e2e-4312-a3da-42af4b17d6ca", + "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 20:04:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:06 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560DF2819A9\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca1b2d-301e-0042-2749-67cbbf000000", + "x-ms-client-request-id" : "617f4191-0e2e-4312-a3da-42af4b17d6ca" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetteria&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" : "922197c7-d29e-4cce-b029-0c8ad90d0b6d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca1b49-301e-0042-4249-67cbbf000000", + "Body" : "jtcgetteriajtcgetteria0downloadresponsetestgetteriadbd2505464b647cMon, 09 Sep 2019 20:04:07 GMT\"0x8D73560DF1B242A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:06 GMT", + "x-ms-client-request-id" : "922197c7-d29e-4cce-b029-0c8ad90d0b6d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetteria0downloadresponsetestgetteriadbd2505464b647c?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" : "99ee049a-59c1-45a5-972b-2d2268b51a44" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca1b57-301e-0042-4f49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:06 GMT", + "x-ms-client-request-id" : "99ee049a-59c1-45a5-972b-2d2268b51a44" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetteria0downloadresponsetestgetteriadbd2505464b647c", "javablobgetteria1downloadresponsetestgetteriadbd026815ea31", "0dd27a30-ff1c-4d83-97a3-6412bf38e40d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfo.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfo.json new file mode 100644 index 000000000000..6b2c62326aaf --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfo.json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcinfo0downloadresponsetestinfocfb73172cfdf1d668cb?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" : "2aa188a1-755a-47a8-9b2c-63a1ee21c59f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DF506EAE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca1b74-301e-0042-6c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:06 GMT", + "x-ms-client-request-id" : "2aa188a1-755a-47a8-9b2c-63a1ee21c59f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcinfo0downloadresponsetestinfocfb73172cfdf1d668cb/javablobinfo1downloadresponsetestinfocfb286977e68688cc", + "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" : "373a5aa7-2261-4409-b1f4-b3a8c6a1cf02", + "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 20:04:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:06 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560DF5DB25E\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca1b96-301e-0042-0949-67cbbf000000", + "x-ms-client-request-id" : "373a5aa7-2261-4409-b1f4-b3a8c6a1cf02" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcinfo&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" : "9eb09964-2d01-4bf3-91b3-8d366fed33db" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca1bab-301e-0042-1d49-67cbbf000000", + "Body" : "jtcinfojtcinfo0downloadresponsetestinfocfb73172cfdf1d668cbMon, 09 Sep 2019 20:04:07 GMT\"0x8D73560DF506EAE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:06 GMT", + "x-ms-client-request-id" : "9eb09964-2d01-4bf3-91b3-8d366fed33db", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcinfo0downloadresponsetestinfocfb73172cfdf1d668cb?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" : "8909a3ac-9cd3-4af0-94a3-0886ab62c733" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca1bb5-301e-0042-2649-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:06 GMT", + "x-ms-client-request-id" : "8909a3ac-9cd3-4af0-94a3-0886ab62c733" + }, + "Exception" : null + } ], + "variables" : [ "jtcinfo0downloadresponsetestinfocfb73172cfdf1d668cb", "javablobinfo1downloadresponsetestinfocfb286977e68688cc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfocountia.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfocountia.json new file mode 100644 index 000000000000..2ed8a0c9a35e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfocountia.json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcinfocountia0downloadresponsetestinfocountiaff33215120d1?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" : "c524fbc3-1ad8-422d-a13f-7f60d926d99b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DF860766\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca1bc9-301e-0042-3a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:06 GMT", + "x-ms-client-request-id" : "c524fbc3-1ad8-422d-a13f-7f60d926d99b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcinfocountia0downloadresponsetestinfocountiaff33215120d1/javablobinfocountia1downloadresponsetestinfocountiaff385355ea", + "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" : "afbc1a94-d2cd-44f2-b537-31b3395a8e24", + "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 20:04:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:07 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560DF92FCE4\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca1bdb-301e-0042-4a49-67cbbf000000", + "x-ms-client-request-id" : "afbc1a94-d2cd-44f2-b537-31b3395a8e24" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcinfocountia&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" : "80a47ac1-37d1-44db-baa7-8a3072211515" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca1bed-301e-0042-5b49-67cbbf000000", + "Body" : "jtcinfocountiajtcinfocountia0downloadresponsetestinfocountiaff33215120d1Mon, 09 Sep 2019 20:04:07 GMT\"0x8D73560DF860766\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:07 GMT", + "x-ms-client-request-id" : "80a47ac1-37d1-44db-baa7-8a3072211515", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcinfocountia0downloadresponsetestinfocountiaff33215120d1?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" : "2314d76c-d1e4-4c48-9a6e-1a437fde7d5f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca1c07-301e-0042-7549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:07 GMT", + "x-ms-client-request-id" : "2314d76c-d1e4-4c48-9a6e-1a437fde7d5f" + }, + "Exception" : null + } ], + "variables" : [ "jtcinfocountia0downloadresponsetestinfocountiaff33215120d1", "javablobinfocountia1downloadresponsetestinfocountiaff385355ea" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfonullia[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfonullia[0].json new file mode 100644 index 000000000000..9796283a40a6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfonullia[0].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcinfonullia0downloadresponsetestinfonulliaf0e023679ad75?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" : "920413c8-c72b-4482-9dd3-2549a6de4757" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DE7AA831\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca1a0d-301e-0042-2349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:05 GMT", + "x-ms-client-request-id" : "920413c8-c72b-4482-9dd3-2549a6de4757" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcinfonullia0downloadresponsetestinfonulliaf0e023679ad75/javablobinfonullia1downloadresponsetestinfonulliaf0e267014a6", + "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" : "96def468-7890-4e81-998f-49661b7372f3", + "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 20:04:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:05 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560DE87C4DC\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca1a2c-301e-0042-3c49-67cbbf000000", + "x-ms-client-request-id" : "96def468-7890-4e81-998f-49661b7372f3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcinfonullia&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" : "3484a4e6-5ae0-4484-90ca-894a91870ad4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca1a38-301e-0042-4849-67cbbf000000", + "Body" : "jtcinfonulliajtcinfonullia0downloadresponsetestinfonulliaf0e023679ad75Mon, 09 Sep 2019 20:04:06 GMT\"0x8D73560DE7AA831\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:05 GMT", + "x-ms-client-request-id" : "3484a4e6-5ae0-4484-90ca-894a91870ad4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcinfonullia0downloadresponsetestinfonulliaf0e023679ad75?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" : "708dc5d5-126e-4c55-bb5b-5e19c3788824" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca1a5e-301e-0042-6849-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:05 GMT", + "x-ms-client-request-id" : "708dc5d5-126e-4c55-bb5b-5e19c3788824" + }, + "Exception" : null + } ], + "variables" : [ "jtcinfonullia0downloadresponsetestinfonulliaf0e023679ad75", "javablobinfonullia1downloadresponsetestinfonulliaf0e267014a6", "32cbcacb-e7a1-4ec4-a347-76318a39944f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfonullia[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfonullia[1].json new file mode 100644 index 000000000000..748af6e7f00d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestinfonullia[1].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcinfonullia0downloadresponsetestinfonullia90e86482c44c2?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" : "35eac996-df48-4095-a517-19bf7b7593db" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DEAFF2BA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca1a76-301e-0042-8049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:05 GMT", + "x-ms-client-request-id" : "35eac996-df48-4095-a517-19bf7b7593db" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcinfonullia0downloadresponsetestinfonullia90e86482c44c2/javablobinfonullia1downloadresponsetestinfonullia90e93339448", + "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" : "f5dfe2d9-ef47-4747-bb06-d030a6cdfbc2", + "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 20:04:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:05 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560DEBD3673\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca1a8c-301e-0042-1449-67cbbf000000", + "x-ms-client-request-id" : "f5dfe2d9-ef47-4747-bb06-d030a6cdfbc2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcinfonullia&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" : "03d1072f-1f8a-4a6d-86e0-02abf76a95f2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca1a9a-301e-0042-2149-67cbbf000000", + "Body" : "jtcinfonulliajtcinfonullia0downloadresponsetestinfonullia90e86482c44c2Mon, 09 Sep 2019 20:04:06 GMT\"0x8D73560DEAFF2BA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:05 GMT", + "x-ms-client-request-id" : "03d1072f-1f8a-4a6d-86e0-02abf76a95f2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcinfonullia0downloadresponsetestinfonullia90e86482c44c2?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" : "917b84af-42a6-43d7-894e-d94a36652990" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca1ab5-301e-0042-3a49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:05 GMT", + "x-ms-client-request-id" : "917b84af-42a6-43d7-894e-d94a36652990" + }, + "Exception" : null + } ], + "variables" : [ "jtcinfonullia0downloadresponsetestinfonullia90e86482c44c2", "javablobinfonullia1downloadresponsetestinfonullia90e93339448", "f92e1b12-b32c-4411-9dcb-9760d075826c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestnetworkcall.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestnetworkcall.json new file mode 100644 index 000000000000..1d1ce9a489ea --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestnetworkcall.json @@ -0,0 +1,121 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcnetworkcall0downloadresponsetestnetworkcall7f245402237a?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" : "85f9f19f-0c11-4d12-bc8f-b196c401832a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DCE4550E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca1768-301e-0042-3949-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:02 GMT", + "x-ms-client-request-id" : "85f9f19f-0c11-4d12-bc8f-b196c401832a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcnetworkcall0downloadresponsetestnetworkcall7f245402237a/javablobnetworkcall1downloadresponsetestnetworkcall7f267553a1", + "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" : "3b69cc89-31e6-43d7-b32b-b554a17af965", + "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 20:04:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:02 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560DCF0D532\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca178d-301e-0042-5c49-67cbbf000000", + "x-ms-client-request-id" : "3b69cc89-31e6-43d7-b32b-b554a17af965" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcnetworkcall0downloadresponsetestnetworkcall7f245402237a/javablobnetworkcall1downloadresponsetestnetworkcall7f267553a1", + "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" : "015454eb-a302-48c2-ba17-d3bb037330cb" + }, + "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 20:04:03 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:04:02 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73560DCF0D532\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:04:03 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "c5ca17a7-301e-0042-7549-67cbbf000000", + "Body" : "[100, 101, 102, 97, 117, 108, 116]", + "x-ms-client-request-id" : "015454eb-a302-48c2-ba17-d3bb037330cb", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcnetworkcall&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" : "5d7b94bb-353d-441f-9a0a-a875c01c0515" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca17b7-301e-0042-0449-67cbbf000000", + "Body" : "jtcnetworkcalljtcnetworkcall0downloadresponsetestnetworkcall7f245402237aMon, 09 Sep 2019 20:04:03 GMT\"0x8D73560DCE4550E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:02 GMT", + "x-ms-client-request-id" : "5d7b94bb-353d-441f-9a0a-a875c01c0515", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcnetworkcall0downloadresponsetestnetworkcall7f245402237a?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" : "51334ba4-79a2-4e56-98e4-2b67cca4995c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca17c7-301e-0042-1349-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:02 GMT", + "x-ms-client-request-id" : "51334ba4-79a2-4e56-98e4-2b67cca4995c" + }, + "Exception" : null + } ], + "variables" : [ "jtcnetworkcall0downloadresponsetestnetworkcall7f245402237a", "javablobnetworkcall1downloadresponsetestnetworkcall7f267553a1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestoptionsia.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestoptionsia.json new file mode 100644 index 000000000000..17a1cc244a9f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestoptionsia.json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcoptionsia0downloadresponsetestoptionsia3cf69594c804a4?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" : "9c06b2a8-e8a3-44dc-8cf0-c72d8ca834bd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DEE4A0E7\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca1ac7-301e-0042-4b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:05 GMT", + "x-ms-client-request-id" : "9c06b2a8-e8a3-44dc-8cf0-c72d8ca834bd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcoptionsia0downloadresponsetestoptionsia3cf69594c804a4/javabloboptionsia1downloadresponsetestoptionsia3cf21540410e", + "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" : "7abf22a1-30ce-452c-9d90-0c96af22a70a", + "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 20:04:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:05 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560DEF1E49D\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca1ada-301e-0042-5b49-67cbbf000000", + "x-ms-client-request-id" : "7abf22a1-30ce-452c-9d90-0c96af22a70a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcoptionsia&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" : "e1191432-3ae2-4f6c-84e8-36bd8aa36026" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca1ae7-301e-0042-6849-67cbbf000000", + "Body" : "jtcoptionsiajtcoptionsia0downloadresponsetestoptionsia3cf69594c804a4Mon, 09 Sep 2019 20:04:06 GMT\"0x8D73560DEE4A0E7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:06 GMT", + "x-ms-client-request-id" : "e1191432-3ae2-4f6c-84e8-36bd8aa36026", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcoptionsia0downloadresponsetestoptionsia3cf69594c804a4?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" : "327f3912-7cb4-4983-8a98-798f6dde5421" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca1aff-301e-0042-7e49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:06 GMT", + "x-ms-client-request-id" : "327f3912-7cb4-4983-8a98-798f6dde5421" + }, + "Exception" : null + } ], + "variables" : [ "jtcoptionsia0downloadresponsetestoptionsia3cf69594c804a4", "javabloboptionsia1downloadresponsetestoptionsia3cf21540410e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestsuccessful[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestsuccessful[0].json new file mode 100644 index 000000000000..c0232239eb2c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestsuccessful[0].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessfulabb664241447b?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" : "c8c16afc-aa13-45d7-8631-3fb7d0ec1259" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DD25AFA5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca17e5-301e-0042-3049-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:02 GMT", + "x-ms-client-request-id" : "c8c16afc-aa13-45d7-8631-3fb7d0ec1259" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessfulabb664241447b/javablobsuccessful1downloadresponsetestsuccessfulabb4204718a", + "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" : "4613a364-b562-4cc6-956a-716466d06fc0", + "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 20:04:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:03 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560DD33B6BF\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca17fa-301e-0042-4249-67cbbf000000", + "x-ms-client-request-id" : "4613a364-b562-4cc6-956a-716466d06fc0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsuccessful&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" : "9e1e558f-868a-4f89-96f7-63cd8957f198" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca1831-301e-0042-7549-67cbbf000000", + "Body" : "jtcsuccessfuljtcsuccessful0downloadresponsetestsuccessfulabb664241447bMon, 09 Sep 2019 20:04:03 GMT\"0x8D73560DD25AFA5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:03 GMT", + "x-ms-client-request-id" : "9e1e558f-868a-4f89-96f7-63cd8957f198", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessfulabb664241447b?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" : "25714b72-2dc2-402f-9f14-e3ca2cb0bf22" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca1838-301e-0042-7c49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:03 GMT", + "x-ms-client-request-id" : "25714b72-2dc2-402f-9f14-e3ca2cb0bf22" + }, + "Exception" : null + } ], + "variables" : [ "jtcsuccessful0downloadresponsetestsuccessfulabb664241447b", "javablobsuccessful1downloadresponsetestsuccessfulabb4204718a", "51361d3a-66ba-407f-89d2-6ee4b85dd2a0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestsuccessful[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestsuccessful[1].json new file mode 100644 index 000000000000..315ac7f1d606 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestsuccessful[1].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessful1ac194803c52f?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" : "fc691294-76ad-49f3-93e6-d88ca260c2b7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DD6FE56E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca1851-301e-0042-1249-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:03 GMT", + "x-ms-client-request-id" : "fc691294-76ad-49f3-93e6-d88ca260c2b7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessful1ac194803c52f/javablobsuccessful1downloadresponsetestsuccessful1ac655783cf", + "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" : "466cf9a0-532a-4b0f-a6f2-761b220deb87", + "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 20:04:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:03 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560DD7D775B\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca185a-301e-0042-1a49-67cbbf000000", + "x-ms-client-request-id" : "466cf9a0-532a-4b0f-a6f2-761b220deb87" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsuccessful&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" : "f4253c0b-6431-408c-8522-4317d9d77df9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca1876-301e-0042-3149-67cbbf000000", + "Body" : "jtcsuccessfuljtcsuccessful0downloadresponsetestsuccessful1ac194803c52fMon, 09 Sep 2019 20:04:04 GMT\"0x8D73560DD6FE56E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:03 GMT", + "x-ms-client-request-id" : "f4253c0b-6431-408c-8522-4317d9d77df9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessful1ac194803c52f?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" : "e371310b-f373-476d-a85b-9251339c4582" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca1892-301e-0042-4b49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:03 GMT", + "x-ms-client-request-id" : "e371310b-f373-476d-a85b-9251339c4582" + }, + "Exception" : null + } ], + "variables" : [ "jtcsuccessful0downloadresponsetestsuccessful1ac194803c52f", "javablobsuccessful1downloadresponsetestsuccessful1ac655783cf", "79b92410-c761-4941-b51d-a7761e0c6da4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestsuccessful[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestsuccessful[2].json new file mode 100644 index 000000000000..3576731d07ce --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/DownloadResponseTestsuccessful[2].json @@ -0,0 +1,90 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessfule307593532e4c?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" : "79991693-b7e4-41ce-aea2-1f94bda723bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560DDA46C79\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:04:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5ca18ac-301e-0042-6549-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:03 GMT", + "x-ms-client-request-id" : "79991693-b7e4-41ce-aea2-1f94bda723bf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessfule307593532e4c/javablobsuccessful1downloadresponsetestsuccessfule3003220cf5", + "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" : "017f9269-d9fc-4db0-bdc8-b5eec84270b0", + "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 20:04:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:04:03 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D73560DDB13AFE\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5ca18c0-301e-0042-7549-67cbbf000000", + "x-ms-client-request-id" : "017f9269-d9fc-4db0-bdc8-b5eec84270b0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsuccessful&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" : "7ec0d255-227d-461d-b3ff-8554ed7ad508" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5ca18d5-301e-0042-0949-67cbbf000000", + "Body" : "jtcsuccessfuljtcsuccessful0downloadresponsetestsuccessfule307593532e4cMon, 09 Sep 2019 20:04:04 GMT\"0x8D73560DDA46C79\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:04:03 GMT", + "x-ms-client-request-id" : "7ec0d255-227d-461d-b3ff-8554ed7ad508", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsuccessful0downloadresponsetestsuccessfule307593532e4c?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" : "0a8a2e55-2396-4261-a92e-8a6974c9d28f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5ca18ee-301e-0042-1d49-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:04:04 GMT", + "x-ms-client-request-id" : "0a8a2e55-2396-4261-a92e-8a6974c9d28f" + }, + "Exception" : null + } ], + "variables" : [ "jtcsuccessful0downloadresponsetestsuccessfule307593532e4c", "javablobsuccessful1downloadresponsetestsuccessfule3003220cf5", "b9d4e994-ee1b-4a98-973d-9959add6863a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[0].json new file mode 100644 index 000000000000..89ddcd2fb850 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse048368b906bf96272a4a?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" : "e740bfd6-c454-4f78-ad73-fb86fc50d366" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356041A21AF8\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe9f5-801e-001f-7249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:42 GMT", + "x-ms-client-request-id" : "e740bfd6-c454-4f78-ad73-fb86fc50d366" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&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" : "75672c59-640d-4f1d-83af-e3ececc82f1c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fea02-801e-001f-7c49-673bbb000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse048368b906bf96272a4aMon, 09 Sep 2019 19:59:43 GMT\"0x8D7356041A21AF8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:42 GMT", + "x-ms-client-request-id" : "75672c59-640d-4f1d-83af-e3ececc82f1c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse048368b906bf96272a4a?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" : "3b5ca06b-f503-4be5-a414-e814ebae7852" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fea0c-801e-001f-0649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:42 GMT", + "x-ms-client-request-id" : "3b5ca06b-f503-4be5-a414-e814ebae7852" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse048368b906bf96272a4a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[1].json new file mode 100644 index 000000000000..7637fc075527 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse0328742b58c39b2d3f48?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" : "c70d9af3-11fd-4b44-8f8c-adcb4472e610" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356041C8BCE4\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fea1b-801e-001f-1249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:42 GMT", + "x-ms-client-request-id" : "c70d9af3-11fd-4b44-8f8c-adcb4472e610" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&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" : "7fac8148-278e-4527-b778-e50a64225e8d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fea2a-801e-001f-1e49-673bbb000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse0328742b58c39b2d3f48Mon, 09 Sep 2019 19:59:43 GMT\"0x8D7356041C8BCE4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:42 GMT", + "x-ms-client-request-id" : "7fac8148-278e-4527-b778-e50a64225e8d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse0328742b58c39b2d3f48?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" : "b070ebaa-bdfd-4e22-b40f-cc4c6ea4dafb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fea38-801e-001f-2c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:42 GMT", + "x-ms-client-request-id" : "b070ebaa-bdfd-4e22-b40f-cc4c6ea4dafb" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse0328742b58c39b2d3f48" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[2].json new file mode 100644 index 000000000000..8965b1133c11 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse01568673f0f406aeda49?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" : "f9d4a8f8-b1ac-420f-8ef8-9ba79949d5af" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356041F04957\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fea4d-801e-001f-4149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:42 GMT", + "x-ms-client-request-id" : "f9d4a8f8-b1ac-420f-8ef8-9ba79949d5af" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&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" : "1653364f-6c93-4dfd-97b1-67eb155174a4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fea5a-801e-001f-4b49-673bbb000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse01568673f0f406aeda49Mon, 09 Sep 2019 19:59:43 GMT\"0x8D7356041F04957\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:43 GMT", + "x-ms-client-request-id" : "1653364f-6c93-4dfd-97b1-67eb155174a4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse01568673f0f406aeda49?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" : "a91de5b4-646f-4e5e-a0bf-3f8dafd4988f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fea69-801e-001f-5a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:43 GMT", + "x-ms-client-request-id" : "a91de5b4-646f-4e5e-a0bf-3f8dafd4988f" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse01568673f0f406aeda49" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[3].json new file mode 100644 index 000000000000..521849c7b42e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[3].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse034700c62eb5e572014c?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" : "30e2c795-8bea-41b2-b9e1-1a0963351a42" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356042184B2B\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fea78-801e-001f-6949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:43 GMT", + "x-ms-client-request-id" : "30e2c795-8bea-41b2-b9e1-1a0963351a42" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&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" : "396f1acd-f555-4fcf-9aff-d0317fc04e7d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fea8a-801e-001f-7749-673bbb000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse034700c62eb5e572014cMon, 09 Sep 2019 19:59:43 GMT\"0x8D7356042184B2B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:43 GMT", + "x-ms-client-request-id" : "396f1acd-f555-4fcf-9aff-d0317fc04e7d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse034700c62eb5e572014c?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" : "a388e372-932e-4424-ad89-ff3296727614" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fea92-801e-001f-7f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:43 GMT", + "x-ms-client-request-id" : "a388e372-932e-4424-ad89-ff3296727614" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse034700c62eb5e572014c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[4].json new file mode 100644 index 000000000000..c27def81f3f3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[4].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse022858418f41a350b14e?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" : "525cbdd1-1f25-4750-8e63-eb5e386d11aa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560423DDB47\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077feaa0-801e-001f-0949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:43 GMT", + "x-ms-client-request-id" : "525cbdd1-1f25-4750-8e63-eb5e386d11aa" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&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" : "c88c35f1-528a-4929-ab40-825f2e5a5055" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077feab1-801e-001f-1849-673bbb000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse022858418f41a350b14eMon, 09 Sep 2019 19:59:44 GMT\"0x8D73560423DDB47\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:43 GMT", + "x-ms-client-request-id" : "c88c35f1-528a-4929-ab40-825f2e5a5055", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse022858418f41a350b14e?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" : "828140d6-33b8-4580-9bdd-4b32568684e0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077feac1-801e-001f-2849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:43 GMT", + "x-ms-client-request-id" : "828140d6-33b8-4580-9bdd-4b32568684e0" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse022858418f41a350b14e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[5].json new file mode 100644 index 000000000000..8a72c78d3f4c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[5].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse087224f666e88309b742?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" : "327f07dc-24ff-4eaa-90b7-d6331e92f934" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604263E0C5\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fead2-801e-001f-3749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:43 GMT", + "x-ms-client-request-id" : "327f07dc-24ff-4eaa-90b7-d6331e92f934" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&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" : "22f4354a-716a-4bd2-95f6-6dd51bca9862" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077feae0-801e-001f-4449-673bbb000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse087224f666e88309b742Mon, 09 Sep 2019 19:59:44 GMT\"0x8D735604263E0C5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:43 GMT", + "x-ms-client-request-id" : "22f4354a-716a-4bd2-95f6-6dd51bca9862", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse087224f666e88309b742?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" : "48012084-c974-4533-b30d-f6c58dd5bde2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077feae6-801e-001f-4a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:43 GMT", + "x-ms-client-request-id" : "48012084-c974-4533-b30d-f6c58dd5bde2" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse087224f666e88309b742" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[6].json new file mode 100644 index 000000000000..2c7e92e0e9f8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[6].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse041778d961d5d42e2d49?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" : "b76a528e-151a-43a9-bd86-724a370961af" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560428A82A0\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077feaf1-801e-001f-5549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:43 GMT", + "x-ms-client-request-id" : "b76a528e-151a-43a9-bd86-724a370961af" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&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" : "81747347-1e96-4120-8ac2-7d5cfab9d496" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077feafe-801e-001f-5f49-673bbb000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse041778d961d5d42e2d49Mon, 09 Sep 2019 19:59:44 GMT\"0x8D73560428A82A0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:44 GMT", + "x-ms-client-request-id" : "81747347-1e96-4120-8ac2-7d5cfab9d496", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse041778d961d5d42e2d49?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" : "1625dfc1-2540-43ff-bc1d-7a307a217b54" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077feb0d-801e-001f-6e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:44 GMT", + "x-ms-client-request-id" : "1625dfc1-2540-43ff-bc1d-7a307a217b54" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse041778d961d5d42e2d49" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[7].json new file mode 100644 index 000000000000..734764d0ea33 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[7].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse020539a823531cb61242?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" : "afde017c-9cff-4893-a53e-e436f61f72e0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356042B039ED\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077feb16-801e-001f-7749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:44 GMT", + "x-ms-client-request-id" : "afde017c-9cff-4893-a53e-e436f61f72e0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&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" : "0b40ef23-b6f4-458b-9fac-828554072c54" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077feb25-801e-001f-0249-673bbb000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse020539a823531cb61242Mon, 09 Sep 2019 19:59:44 GMT\"0x8D7356042B039ED\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:44 GMT", + "x-ms-client-request-id" : "0b40ef23-b6f4-458b-9fac-828554072c54", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse020539a823531cb61242?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" : "501d961e-c233-4c8b-b836-60728e91a1d4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077feb31-801e-001f-0c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:44 GMT", + "x-ms-client-request-id" : "501d961e-c233-4c8b-b836-60728e91a1d4" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse020539a823531cb61242" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[8].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[8].json new file mode 100644 index 000000000000..415d20a9d31b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[8].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse047262fecc005b754940?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" : "b3ef00c7-e67b-44c2-917d-3baa23e2fb8c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356042DCA94A\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077feb45-801e-001f-1f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:44 GMT", + "x-ms-client-request-id" : "b3ef00c7-e67b-44c2-917d-3baa23e2fb8c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&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" : "f5d59804-868e-4fbe-9ac3-f41eab166faa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077feb55-801e-001f-2b49-673bbb000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse047262fecc005b754940Mon, 09 Sep 2019 19:59:45 GMT\"0x8D7356042DCA94A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:44 GMT", + "x-ms-client-request-id" : "f5d59804-868e-4fbe-9ac3-f41eab166faa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse047262fecc005b754940?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" : "c4f3207f-4f1b-4f06-b106-b69e1b08298d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077feb5d-801e-001f-3349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:44 GMT", + "x-ms-client-request-id" : "c4f3207f-4f1b-4f06-b106-b69e1b08298d" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse047262fecc005b754940" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[9].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[9].json new file mode 100644 index 000000000000..efadda7ad08f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparse[9].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse09002293eb49d30cb94a?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" : "af06fc1d-e43f-488e-adb3-ecbfcd31227e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356043021278\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077feb72-801e-001f-4649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:44 GMT", + "x-ms-client-request-id" : "af06fc1d-e43f-488e-adb3-ecbfcd31227e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&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" : "ceac682c-6c84-4c46-826d-8fe330e80e67" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077feb7d-801e-001f-4f49-673bbb000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse09002293eb49d30cb94aMon, 09 Sep 2019 19:59:45 GMT\"0x8D7356043021278\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:44 GMT", + "x-ms-client-request-id" : "ceac682c-6c84-4c46-826d-8fe330e80e67", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse09002293eb49d30cb94a?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" : "b7ee4da9-a1fc-4cb7-842f-bce5361c7fd7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077feb89-801e-001f-5a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:44 GMT", + "x-ms-client-request-id" : "b7ee4da9-a1fc-4cb7-842f-bce5361c7fd7" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse09002293eb49d30cb94a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparseia.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparseia.json new file mode 100644 index 000000000000..f16ec37bc98c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionsparseia.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparseia02949741749582d8024?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" : "73e11b73-8327-480f-a2ca-2ce0c0d834e7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356043277BAF\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077feb9c-801e-001f-6b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:44 GMT", + "x-ms-client-request-id" : "73e11b73-8327-480f-a2ca-2ce0c0d834e7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionsparseia&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" : "6f55ffd6-ac58-4562-adf9-1c29aca1807a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077feba9-801e-001f-7649-673bbb000000", + "Body" : "jtcaccountsaspermissionsparseiajtcaccountsaspermissionsparseia02949741749582d8024Mon, 09 Sep 2019 19:59:45 GMT\"0x8D7356043277BAF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:45 GMT", + "x-ms-client-request-id" : "6f55ffd6-ac58-4562-adf9-1c29aca1807a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparseia02949741749582d8024?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" : "fdb12f4f-7416-4fa3-8d08-05c99813716a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077febc0-801e-001f-0949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:45 GMT", + "x-ms-client-request-id" : "fdb12f4f-7416-4fa3-8d08-05c99813716a" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparseia02949741749582d8024" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[0].json new file mode 100644 index 000000000000..809c4495563d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring031533f1fffa3fb383?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" : "480f1818-526e-4f47-8d1a-372d4a398ca4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604045F47E\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe877-801e-001f-1549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:40 GMT", + "x-ms-client-request-id" : "480f1818-526e-4f47-8d1a-372d4a398ca4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&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" : "0b7f0447-b22e-4534-b702-1a3ab6554901" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe886-801e-001f-2249-673bbb000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring031533f1fffa3fb383Mon, 09 Sep 2019 19:59:40 GMT\"0x8D735604045F47E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:40 GMT", + "x-ms-client-request-id" : "0b7f0447-b22e-4534-b702-1a3ab6554901", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring031533f1fffa3fb383?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" : "461e18bd-d14f-4f59-b66a-24a72f78b4e7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe890-801e-001f-2c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:40 GMT", + "x-ms-client-request-id" : "461e18bd-d14f-4f59-b66a-24a72f78b4e7" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring031533f1fffa3fb383" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[1].json new file mode 100644 index 000000000000..b7008a8afab7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring084249929b7e5f35f7?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" : "af4b3697-bb95-4357-aa9d-20cd51e66d46" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560406C6F52\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe89c-801e-001f-3749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:40 GMT", + "x-ms-client-request-id" : "af4b3697-bb95-4357-aa9d-20cd51e66d46" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&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" : "2c514cd8-5401-4e43-af56-1aa5b442c116" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe8ab-801e-001f-4449-673bbb000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring084249929b7e5f35f7Mon, 09 Sep 2019 19:59:41 GMT\"0x8D73560406C6F52\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:40 GMT", + "x-ms-client-request-id" : "2c514cd8-5401-4e43-af56-1aa5b442c116", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring084249929b7e5f35f7?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" : "3ffd4604-3bbb-4664-acdb-59d39fefa745" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe8b7-801e-001f-5049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:40 GMT", + "x-ms-client-request-id" : "3ffd4604-3bbb-4664-acdb-59d39fefa745" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring084249929b7e5f35f7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[2].json new file mode 100644 index 000000000000..1587c851c0ef --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring0438174c69495e2772?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" : "d603aaa4-a484-41f3-8d5e-159194721ecb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604091FF95\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe8c7-801e-001f-5e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:40 GMT", + "x-ms-client-request-id" : "d603aaa4-a484-41f3-8d5e-159194721ecb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&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" : "d02c511a-9cfb-46f0-8e29-69b94129cede" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe8dd-801e-001f-7049-673bbb000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring0438174c69495e2772Mon, 09 Sep 2019 19:59:41 GMT\"0x8D735604091FF95\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:40 GMT", + "x-ms-client-request-id" : "d02c511a-9cfb-46f0-8e29-69b94129cede", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring0438174c69495e2772?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" : "9704a18e-8827-43c9-9d28-d3a71f02da1b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe8ea-801e-001f-7d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:40 GMT", + "x-ms-client-request-id" : "9704a18e-8827-43c9-9d28-d3a71f02da1b" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring0438174c69495e2772" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[3].json new file mode 100644 index 000000000000..78e85d67d517 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[3].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring0678095678dde87b94?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" : "ff147036-47c3-43d6-8da4-4dab6623f940" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356040B93DE3\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe900-801e-001f-1049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:40 GMT", + "x-ms-client-request-id" : "ff147036-47c3-43d6-8da4-4dab6623f940" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&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" : "fedd7bd1-96e4-4445-a03f-073f04d46bac" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe912-801e-001f-1e49-673bbb000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring0678095678dde87b94Mon, 09 Sep 2019 19:59:41 GMT\"0x8D7356040B93DE3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:40 GMT", + "x-ms-client-request-id" : "fedd7bd1-96e4-4445-a03f-073f04d46bac", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring0678095678dde87b94?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" : "d34e1677-0285-41b0-a11c-41bd916a3438" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe91b-801e-001f-2549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:41 GMT", + "x-ms-client-request-id" : "d34e1677-0285-41b0-a11c-41bd916a3438" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring0678095678dde87b94" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[4].json new file mode 100644 index 000000000000..833cdc030910 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[4].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring054432c47357da1737?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" : "25841578-9d4f-47cb-b9e5-051f07b39544" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356040E0CA51\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe92d-801e-001f-3749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:41 GMT", + "x-ms-client-request-id" : "25841578-9d4f-47cb-b9e5-051f07b39544" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&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" : "c931afa0-4101-4a89-8051-6abd12c70ce7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe937-801e-001f-3e49-673bbb000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring054432c47357da1737Mon, 09 Sep 2019 19:59:41 GMT\"0x8D7356040E0CA51\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:41 GMT", + "x-ms-client-request-id" : "c931afa0-4101-4a89-8051-6abd12c70ce7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring054432c47357da1737?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" : "8978d1fa-d2b5-4318-a580-aac519f6d226" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe942-801e-001f-4949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:41 GMT", + "x-ms-client-request-id" : "8978d1fa-d2b5-4318-a580-aac519f6d226" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring054432c47357da1737" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[5].json new file mode 100644 index 000000000000..cd09cad86ae7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[5].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring093885788aea40d184?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" : "c32ec377-3226-4703-9013-83804642e3b1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356041091A39\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe953-801e-001f-5949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:41 GMT", + "x-ms-client-request-id" : "c32ec377-3226-4703-9013-83804642e3b1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&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" : "dda9d541-ec3b-4264-a05e-3a59f2d668d8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe96b-801e-001f-6f49-673bbb000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring093885788aea40d184Mon, 09 Sep 2019 19:59:42 GMT\"0x8D7356041091A39\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:41 GMT", + "x-ms-client-request-id" : "dda9d541-ec3b-4264-a05e-3a59f2d668d8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring093885788aea40d184?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" : "e1e0c86f-7ee3-4d3c-9dcd-412a77a4ac3b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe978-801e-001f-7b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:41 GMT", + "x-ms-client-request-id" : "e1e0c86f-7ee3-4d3c-9dcd-412a77a4ac3b" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring093885788aea40d184" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[6].json new file mode 100644 index 000000000000..1ac988699c0d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[6].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring036504ba8b57846426?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" : "e7683ea6-92f6-423f-be42-da5ee202e216" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560412ED196\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe988-801e-001f-0b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:41 GMT", + "x-ms-client-request-id" : "e7683ea6-92f6-423f-be42-da5ee202e216" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&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" : "cec355cc-6673-43b9-8ace-8ea6cff3cb9e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe990-801e-001f-1149-673bbb000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring036504ba8b57846426Mon, 09 Sep 2019 19:59:42 GMT\"0x8D73560412ED196\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:41 GMT", + "x-ms-client-request-id" : "cec355cc-6673-43b9-8ace-8ea6cff3cb9e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring036504ba8b57846426?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" : "e0a2452d-d149-4895-b4a8-b55985684804" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe99b-801e-001f-1c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:41 GMT", + "x-ms-client-request-id" : "e0a2452d-d149-4895-b4a8-b55985684804" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring036504ba8b57846426" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[7].json new file mode 100644 index 000000000000..229ca8385102 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[7].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring081971ca866ab0dd2a?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" : "aacc847f-1a47-4edb-bbcc-01cb9f91dfb7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356041560FE3\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe9b1-801e-001f-3049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:41 GMT", + "x-ms-client-request-id" : "aacc847f-1a47-4edb-bbcc-01cb9f91dfb7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&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" : "5fcd93a5-966a-42e6-adc9-9d7a2a34c0e1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe9bc-801e-001f-3a49-673bbb000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring081971ca866ab0dd2aMon, 09 Sep 2019 19:59:42 GMT\"0x8D7356041560FE3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:42 GMT", + "x-ms-client-request-id" : "5fcd93a5-966a-42e6-adc9-9d7a2a34c0e1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring081971ca866ab0dd2a?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" : "a05e8b22-fce7-4397-985a-b80380017989" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe9cf-801e-001f-4d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:42 GMT", + "x-ms-client-request-id" : "a05e8b22-fce7-4397-985a-b80380017989" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring081971ca866ab0dd2a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[8].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[8].json new file mode 100644 index 000000000000..1459dabf1710 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsaspermissionstostring[8].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring013581129d3146700a?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" : "1e3e0502-55b0-4c80-817c-7d6795cf55ab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560417BA02A\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe9d5-801e-001f-5349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:42 GMT", + "x-ms-client-request-id" : "1e3e0502-55b0-4c80-817c-7d6795cf55ab" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&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" : "23980559-27d2-4004-9d4f-baa32a1977a9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe9de-801e-001f-5b49-673bbb000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring013581129d3146700aMon, 09 Sep 2019 19:59:42 GMT\"0x8D73560417BA02A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:42 GMT", + "x-ms-client-request-id" : "23980559-27d2-4004-9d4f-baa32a1977a9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring013581129d3146700a?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" : "04e08ddf-d5a8-4e8b-ad5b-4f6f4a5b2ef8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe9eb-801e-001f-6849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:42 GMT", + "x-ms-client-request-id" : "04e08ddf-d5a8-4e8b-ad5b-4f6f4a5b2ef8" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring013581129d3146700a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeia.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeia.json new file mode 100644 index 000000000000..e686eb5590c2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeia.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypeia02496452715b3cfeb24d1?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" : "f71326f0-5c32-42c1-b07d-a228882f94a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560447F0D76\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fed57-801e-001f-7149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:47 GMT", + "x-ms-client-request-id" : "f71326f0-5c32-42c1-b07d-a228882f94a4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsasresourcetypeia&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" : "adeaafed-1397-4caf-b648-827a3fed34f4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fed65-801e-001f-7c49-673bbb000000", + "Body" : "jtcaccountsasresourcetypeiajtcaccountsasresourcetypeia02496452715b3cfeb24d1Mon, 09 Sep 2019 19:59:47 GMT\"0x8D73560447F0D76\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:47 GMT", + "x-ms-client-request-id" : "adeaafed-1397-4caf-b648-827a3fed34f4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypeia02496452715b3cfeb24d1?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" : "3141dc27-df30-41b2-badd-c1c0ca62f7e3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fed70-801e-001f-0749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:47 GMT", + "x-ms-client-request-id" : "3141dc27-df30-41b2-badd-c1c0ca62f7e3" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeia02496452715b3cfeb24d1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeparse[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeparse[0].json new file mode 100644 index 000000000000..408ef2bb9b54 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeparse[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypeparse031905b4dc8cf5ea304?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" : "dc09ee45-1244-4c9e-ab50-d692d53f2724" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356043E5E598\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fec8d-801e-001f-3f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:46 GMT", + "x-ms-client-request-id" : "dc09ee45-1244-4c9e-ab50-d692d53f2724" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsasresourcetypeparse&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" : "ebb2f736-56e1-498a-90b0-46833be830c2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fec96-801e-001f-4749-673bbb000000", + "Body" : "jtcaccountsasresourcetypeparsejtcaccountsasresourcetypeparse031905b4dc8cf5ea304Mon, 09 Sep 2019 19:59:46 GMT\"0x8D7356043E5E598\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:46 GMT", + "x-ms-client-request-id" : "ebb2f736-56e1-498a-90b0-46833be830c2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypeparse031905b4dc8cf5ea304?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" : "db4f7dd0-9e29-48fa-87f7-a68db0cd6b7d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fecb0-801e-001f-6149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:46 GMT", + "x-ms-client-request-id" : "db4f7dd0-9e29-48fa-87f7-a68db0cd6b7d" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeparse031905b4dc8cf5ea304" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeparse[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeparse[1].json new file mode 100644 index 000000000000..c7e2ec6aebd7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeparse[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypeparse09872310a2a0db9cfe4?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" : "80940220-60c8-416e-a893-d2ef2ef8b15d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560440CD5B7\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fecbf-801e-001f-6d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:46 GMT", + "x-ms-client-request-id" : "80940220-60c8-416e-a893-d2ef2ef8b15d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsasresourcetypeparse&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" : "3b9cd0e7-db19-4338-9a90-bab45cc36c9f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077feccd-801e-001f-7749-673bbb000000", + "Body" : "jtcaccountsasresourcetypeparsejtcaccountsasresourcetypeparse09872310a2a0db9cfe4Mon, 09 Sep 2019 19:59:47 GMT\"0x8D73560440CD5B7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:46 GMT", + "x-ms-client-request-id" : "3b9cd0e7-db19-4338-9a90-bab45cc36c9f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypeparse09872310a2a0db9cfe4?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" : "60db3116-1560-4e8b-b134-14e24a294517" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fecd9-801e-001f-0349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:46 GMT", + "x-ms-client-request-id" : "60db3116-1560-4e8b-b134-14e24a294517" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeparse09872310a2a0db9cfe4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeparse[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeparse[2].json new file mode 100644 index 000000000000..de01c2c36bce --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeparse[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypeparse095476f31e8e7eb9854?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" : "56ba7f88-e44a-4bc7-85df-c180065e983b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356044343B19\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fecee-801e-001f-1349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:46 GMT", + "x-ms-client-request-id" : "56ba7f88-e44a-4bc7-85df-c180065e983b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsasresourcetypeparse&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" : "15b7aafb-56fa-4e08-8fe4-c30735b060c7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fed02-801e-001f-2349-673bbb000000", + "Body" : "jtcaccountsasresourcetypeparsejtcaccountsasresourcetypeparse095476f31e8e7eb9854Mon, 09 Sep 2019 19:59:47 GMT\"0x8D7356044343B19\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:46 GMT", + "x-ms-client-request-id" : "15b7aafb-56fa-4e08-8fe4-c30735b060c7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypeparse095476f31e8e7eb9854?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" : "b199a3af-f9f1-487c-bd29-c375d922bc35" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fed0e-801e-001f-2f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:46 GMT", + "x-ms-client-request-id" : "b199a3af-f9f1-487c-bd29-c375d922bc35" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeparse095476f31e8e7eb9854" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeparse[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeparse[3].json new file mode 100644 index 000000000000..a1a4f753f171 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypeparse[3].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypeparse056553f8b6bf4f8c144?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" : "4f7304c9-9423-4013-84de-d5a84c02dc09" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604459A43E\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fed21-801e-001f-4049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:46 GMT", + "x-ms-client-request-id" : "4f7304c9-9423-4013-84de-d5a84c02dc09" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsasresourcetypeparse&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" : "8fb73029-be19-448b-b449-f793a7718986" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fed3d-801e-001f-5b49-673bbb000000", + "Body" : "jtcaccountsasresourcetypeparsejtcaccountsasresourcetypeparse056553f8b6bf4f8c144Mon, 09 Sep 2019 19:59:47 GMT\"0x8D735604459A43E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:47 GMT", + "x-ms-client-request-id" : "8fb73029-be19-448b-b449-f793a7718986", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypeparse056553f8b6bf4f8c144?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" : "aad3c0a2-8e98-4768-ab6e-e27db3eb8733" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fed44-801e-001f-6249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:47 GMT", + "x-ms-client-request-id" : "aad3c0a2-8e98-4768-ab6e-e27db3eb8733" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeparse056553f8b6bf4f8c144" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypetostring[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypetostring[0].json new file mode 100644 index 000000000000..efc072fc1675 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypetostring[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypetostring0940131a17848303ab?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" : "deb58705-b24a-4b13-86ab-21e0692c5264" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560434E1DA0\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077febce-801e-001f-1649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:45 GMT", + "x-ms-client-request-id" : "deb58705-b24a-4b13-86ab-21e0692c5264" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsasresourcetypetostring&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" : "b266e494-686a-46c8-b070-671a98e55895" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077febdd-801e-001f-2249-673bbb000000", + "Body" : "jtcaccountsasresourcetypetostringjtcaccountsasresourcetypetostring0940131a17848303abMon, 09 Sep 2019 19:59:45 GMT\"0x8D73560434E1DA0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:45 GMT", + "x-ms-client-request-id" : "b266e494-686a-46c8-b070-671a98e55895", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypetostring0940131a17848303ab?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" : "5eac5196-ed68-4ced-b1af-d808dac2cc65" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077febec-801e-001f-3049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:45 GMT", + "x-ms-client-request-id" : "5eac5196-ed68-4ced-b1af-d808dac2cc65" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypetostring0940131a17848303ab" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypetostring[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypetostring[1].json new file mode 100644 index 000000000000..86c5a7bc063f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypetostring[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypetostring033285150e1a22e62a?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" : "7a96a3dd-2ed3-4c9c-a03a-6c2bf6bd5673" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735604373ADDA\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fec05-801e-001f-4349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:45 GMT", + "x-ms-client-request-id" : "7a96a3dd-2ed3-4c9c-a03a-6c2bf6bd5673" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsasresourcetypetostring&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" : "e28ce3fb-bfce-4c3d-af0e-f900d029ab93" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fec17-801e-001f-5249-673bbb000000", + "Body" : "jtcaccountsasresourcetypetostringjtcaccountsasresourcetypetostring033285150e1a22e62aMon, 09 Sep 2019 19:59:46 GMT\"0x8D735604373ADDA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:45 GMT", + "x-ms-client-request-id" : "e28ce3fb-bfce-4c3d-af0e-f900d029ab93", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypetostring033285150e1a22e62a?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" : "57f63daf-be2d-451f-8aaa-884825b26e13" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fec25-801e-001f-6049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:45 GMT", + "x-ms-client-request-id" : "57f63daf-be2d-451f-8aaa-884825b26e13" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypetostring033285150e1a22e62a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypetostring[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypetostring[2].json new file mode 100644 index 000000000000..588c3bed3ee8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypetostring[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypetostring0787132a4448d311e2?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" : "af5e7e39-c547-446c-a519-ecadbb7cec31" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356043993E21\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fec35-801e-001f-6e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:45 GMT", + "x-ms-client-request-id" : "af5e7e39-c547-446c-a519-ecadbb7cec31" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsasresourcetypetostring&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" : "09123894-8752-45ac-b409-44b23fa0993b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fec3f-801e-001f-7749-673bbb000000", + "Body" : "jtcaccountsasresourcetypetostringjtcaccountsasresourcetypetostring0787132a4448d311e2Mon, 09 Sep 2019 19:59:46 GMT\"0x8D7356043993E21\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:45 GMT", + "x-ms-client-request-id" : "09123894-8752-45ac-b409-44b23fa0993b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypetostring0787132a4448d311e2?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" : "3e38880f-a751-4953-9a48-2333ea5cabe4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fec50-801e-001f-0749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:45 GMT", + "x-ms-client-request-id" : "3e38880f-a751-4953-9a48-2333ea5cabe4" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypetostring0787132a4448d311e2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypetostring[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypetostring[3].json new file mode 100644 index 000000000000..4d75775350e0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsasresourcetypetostring[3].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypetostring0000966d886facc6f2?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" : "88ba1b8a-97fe-46a3-aab1-8aeec5942e08" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356043C02E3B\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fec5c-801e-001f-1349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:45 GMT", + "x-ms-client-request-id" : "88ba1b8a-97fe-46a3-aab1-8aeec5942e08" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsasresourcetypetostring&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" : "883df59c-987d-46f6-8486-bdb097efa88f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fec68-801e-001f-1d49-673bbb000000", + "Body" : "jtcaccountsasresourcetypetostringjtcaccountsasresourcetypetostring0000966d886facc6f2Mon, 09 Sep 2019 19:59:46 GMT\"0x8D7356043C02E3B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:46 GMT", + "x-ms-client-request-id" : "883df59c-987d-46f6-8486-bdb097efa88f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypetostring0000966d886facc6f2?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" : "33ca4008-49c1-4963-b21d-df8537eb4997" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fec76-801e-001f-2a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:46 GMT", + "x-ms-client-request-id" : "33ca4008-49c1-4963-b21d-df8537eb4997" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypetostring0000966d886facc6f2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturesstringtosign[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturesstringtosign[0].json new file mode 100644 index 000000000000..a55561860cef --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturesstringtosign[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturesstringtosign06191324667209601?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" : "ee0f3528-ac0b-482a-8b15-457a980373e6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603ED30DCA\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe649-801e-001f-1649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:37 GMT", + "x-ms-client-request-id" : "ee0f3528-ac0b-482a-8b15-457a980373e6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsassignaturesstringtosign&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" : "1347c7f9-945c-43da-a328-69abe56886d6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe65c-801e-001f-2849-673bbb000000", + "Body" : "jtcaccountsassignaturesstringtosignjtcaccountsassignaturesstringtosign06191324667209601Mon, 09 Sep 2019 19:59:38 GMT\"0x8D735603ED30DCA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:37 GMT", + "x-ms-client-request-id" : "1347c7f9-945c-43da-a328-69abe56886d6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturesstringtosign06191324667209601?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" : "1d869830-6647-4c30-9a9b-2c8d2bad6e2f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe66b-801e-001f-3649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:37 GMT", + "x-ms-client-request-id" : "1d869830-6647-4c30-9a9b-2c8d2bad6e2f" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturesstringtosign06191324667209601" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturesstringtosign[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturesstringtosign[1].json new file mode 100644 index 000000000000..7ddb2eaf0fe3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturesstringtosign[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturesstringtosign0249668662b6187ed?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" : "2cb0567a-dfc8-41ec-ae97-df88aa7bda4e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603EF8EC3F\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe680-801e-001f-4b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:37 GMT", + "x-ms-client-request-id" : "2cb0567a-dfc8-41ec-ae97-df88aa7bda4e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsassignaturesstringtosign&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" : "fc14132e-b8c2-4916-bd36-a9463cba08dd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe690-801e-001f-5949-673bbb000000", + "Body" : "jtcaccountsassignaturesstringtosignjtcaccountsassignaturesstringtosign0249668662b6187edMon, 09 Sep 2019 19:59:38 GMT\"0x8D735603EF8EC3F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:38 GMT", + "x-ms-client-request-id" : "fc14132e-b8c2-4916-bd36-a9463cba08dd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturesstringtosign0249668662b6187ed?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" : "fae95be4-63dc-430f-91ff-7877ee8a88d4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe69f-801e-001f-6649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:38 GMT", + "x-ms-client-request-id" : "fae95be4-63dc-430f-91ff-7877ee8a88d4" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturesstringtosign0249668662b6187ed" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturesstringtosign[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturesstringtosign[2].json new file mode 100644 index 000000000000..3eb2d1cc327b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturesstringtosign[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturesstringtosign00635278d23b2688a?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" : "46af9652-f49c-4087-809e-6358be532ae3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603F202A8D\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe6b4-801e-001f-7b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:38 GMT", + "x-ms-client-request-id" : "46af9652-f49c-4087-809e-6358be532ae3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsassignaturesstringtosign&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" : "62e0af3e-7d01-45b0-b5fa-108961617090" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe6c5-801e-001f-0b49-673bbb000000", + "Body" : "jtcaccountsassignaturesstringtosignjtcaccountsassignaturesstringtosign00635278d23b2688aMon, 09 Sep 2019 19:59:38 GMT\"0x8D735603F202A8D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:38 GMT", + "x-ms-client-request-id" : "62e0af3e-7d01-45b0-b5fa-108961617090", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturesstringtosign00635278d23b2688a?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" : "520e3595-a37b-48ad-bbbd-c4aa3914809e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe6d5-801e-001f-1b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:38 GMT", + "x-ms-client-request-id" : "520e3595-a37b-48ad-bbbd-c4aa3914809e" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturesstringtosign00635278d23b2688a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[0].json new file mode 100644 index 000000000000..ff7dd1839586 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturevaluesia041380fa01b2de37374?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" : "e95562b4-bd50-416b-9dcf-44f6b84cc27e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603F46F380\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe6ed-801e-001f-2f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:38 GMT", + "x-ms-client-request-id" : "e95562b4-bd50-416b-9dcf-44f6b84cc27e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsassignaturevaluesia&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" : "7965bd27-5c8a-46d3-aa1a-685911f94f19" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe721-801e-001f-6049-673bbb000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia041380fa01b2de37374Mon, 09 Sep 2019 19:59:39 GMT\"0x8D735603F46F380\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:38 GMT", + "x-ms-client-request-id" : "7965bd27-5c8a-46d3-aa1a-685911f94f19", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturevaluesia041380fa01b2de37374?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" : "ec5dea58-9723-41ff-968d-e726739ff008" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe731-801e-001f-7049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:38 GMT", + "x-ms-client-request-id" : "ec5dea58-9723-41ff-968d-e726739ff008" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia041380fa01b2de37374" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[1].json new file mode 100644 index 000000000000..c19311bbbd36 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturevaluesia064850664c3eceb2c84?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" : "79080af3-d5a1-4fab-aded-42c9e385c244" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603F8603EA\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe744-801e-001f-8049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:38 GMT", + "x-ms-client-request-id" : "79080af3-d5a1-4fab-aded-42c9e385c244" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsassignaturevaluesia&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" : "55d1e805-4cae-47c5-ba5a-db57fd9041de" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe755-801e-001f-1049-673bbb000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia064850664c3eceb2c84Mon, 09 Sep 2019 19:59:39 GMT\"0x8D735603F8603EA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:38 GMT", + "x-ms-client-request-id" : "55d1e805-4cae-47c5-ba5a-db57fd9041de", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturevaluesia064850664c3eceb2c84?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" : "52f420d9-8a0a-4d71-b446-338e07041016" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe768-801e-001f-2149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:39 GMT", + "x-ms-client-request-id" : "52f420d9-8a0a-4d71-b446-338e07041016" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia064850664c3eceb2c84" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[2].json new file mode 100644 index 000000000000..97abdf75080a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturevaluesia003862c4eb5c8c667c4?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" : "c3cf4270-9a59-45a9-9b88-9209eb7905f4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603FACCCEF\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe782-801e-001f-3849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:39 GMT", + "x-ms-client-request-id" : "c3cf4270-9a59-45a9-9b88-9209eb7905f4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsassignaturevaluesia&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" : "7382b3ff-9fe7-4bf2-b57b-bfa19a765b05" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe792-801e-001f-4549-673bbb000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia003862c4eb5c8c667c4Mon, 09 Sep 2019 19:59:39 GMT\"0x8D735603FACCCEF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:39 GMT", + "x-ms-client-request-id" : "7382b3ff-9fe7-4bf2-b57b-bfa19a765b05", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturevaluesia003862c4eb5c8c667c4?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" : "2cacf0d3-c651-4f9d-b9cb-2aa0845c1c66" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe7a7-801e-001f-5849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:39 GMT", + "x-ms-client-request-id" : "2cacf0d3-c651-4f9d-b9cb-2aa0845c1c66" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia003862c4eb5c8c667c4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[3].json new file mode 100644 index 000000000000..8543581fc52c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[3].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturevaluesia0520650003c1dc09e34?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" : "2e74b469-f873-461f-ae85-92b05c75c482" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603FD2D267\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe7b0-801e-001f-5f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:39 GMT", + "x-ms-client-request-id" : "2e74b469-f873-461f-ae85-92b05c75c482" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsassignaturevaluesia&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" : "136fb1d9-4369-4085-9669-d15511ea3a09" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe7c4-801e-001f-7149-673bbb000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia0520650003c1dc09e34Mon, 09 Sep 2019 19:59:40 GMT\"0x8D735603FD2D267\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:39 GMT", + "x-ms-client-request-id" : "136fb1d9-4369-4085-9669-d15511ea3a09", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturevaluesia0520650003c1dc09e34?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" : "a4325f5b-2632-467a-801c-33faac83c272" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe7db-801e-001f-0649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:39 GMT", + "x-ms-client-request-id" : "a4325f5b-2632-467a-801c-33faac83c272" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia0520650003c1dc09e34" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[4].json new file mode 100644 index 000000000000..44784dad6b9d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[4].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturevaluesia077787b19e07ca7c3a4?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" : "cb68a26e-1299-4dfd-b88b-0009f2341961" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603FF8B0D0\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe7ff-801e-001f-2649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:39 GMT", + "x-ms-client-request-id" : "cb68a26e-1299-4dfd-b88b-0009f2341961" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsassignaturevaluesia&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" : "59de24b2-d583-43d9-b17c-c75b3fd0c61f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe812-801e-001f-3849-673bbb000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia077787b19e07ca7c3a4Mon, 09 Sep 2019 19:59:40 GMT\"0x8D735603FF8B0D0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:39 GMT", + "x-ms-client-request-id" : "59de24b2-d583-43d9-b17c-c75b3fd0c61f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturevaluesia077787b19e07ca7c3a4?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" : "77504c87-7c39-4449-b7f1-ff8269d095f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe821-801e-001f-4549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:39 GMT", + "x-ms-client-request-id" : "77504c87-7c39-4449-b7f1-ff8269d095f2" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia077787b19e07ca7c3a4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[5].json new file mode 100644 index 000000000000..d0317d4ea307 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestaccountsassignaturevaluesia[5].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturevaluesia01515844908d69425e4?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" : "7177e634-f9ae-410c-95a0-9752e44c035c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560401E8F3A\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe83e-801e-001f-6049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:39 GMT", + "x-ms-client-request-id" : "7177e634-f9ae-410c-95a0-9752e44c035c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsassignaturevaluesia&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" : "4761aedf-eb83-4fad-9967-7f2bbce1fa83" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe855-801e-001f-7649-673bbb000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia01515844908d69425e4Mon, 09 Sep 2019 19:59:40 GMT\"0x8D73560401E8F3A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:39 GMT", + "x-ms-client-request-id" : "4761aedf-eb83-4fad-9967-7f2bbce1fa83", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturevaluesia01515844908d69425e4?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" : "2dd30010-6222-4179-9c76-c5e760524c14" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe862-801e-001f-0249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:40 GMT", + "x-ms-client-request-id" : "2dd30010-6222-4179-9c76-c5e760524c14" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia01515844908d69425e4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrange[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrange[0].json new file mode 100644 index 000000000000..ff68bb409054 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrange[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobrange0helpertestblobrange6f7954936dd81775e83?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" : "7d3eb988-0d0e-4261-a710-48023ca75bb6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356032DE640E\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd739-801e-001f-6f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:17 GMT", + "x-ms-client-request-id" : "7d3eb988-0d0e-4261-a710-48023ca75bb6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobrange&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" : "421bc877-c570-40e6-aa50-275e98738b2f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd746-801e-001f-7b49-673bbb000000", + "Body" : "jtcblobrangejtcblobrange0helpertestblobrange6f7954936dd81775e83Mon, 09 Sep 2019 19:59:18 GMT\"0x8D7356032DE640E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:17 GMT", + "x-ms-client-request-id" : "421bc877-c570-40e6-aa50-275e98738b2f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobrange0helpertestblobrange6f7954936dd81775e83?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" : "74b51b26-26c0-41f5-9d17-c67b4c2d1d6d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd74c-801e-001f-0149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:17 GMT", + "x-ms-client-request-id" : "74b51b26-26c0-41f5-9d17-c67b4c2d1d6d" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrange0helpertestblobrange6f7954936dd81775e83" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrange[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrange[1].json new file mode 100644 index 000000000000..65d412577b1f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrange[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobrange0helpertestblobrangeb1e1397650e65147b32?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" : "ce589aa4-2a5d-4840-ab94-2ddf93f38df8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356033050603\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd759-801e-001f-0e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:17 GMT", + "x-ms-client-request-id" : "ce589aa4-2a5d-4840-ab94-2ddf93f38df8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobrange&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" : "216a273a-9ad9-497b-a4db-5623eeb9ee08" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd76f-801e-001f-1e49-673bbb000000", + "Body" : "jtcblobrangejtcblobrange0helpertestblobrangeb1e1397650e65147b32Mon, 09 Sep 2019 19:59:18 GMT\"0x8D7356033050603\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:18 GMT", + "x-ms-client-request-id" : "216a273a-9ad9-497b-a4db-5623eeb9ee08", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobrange0helpertestblobrangeb1e1397650e65147b32?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" : "65510764-4dd7-41a5-b8c8-cffced1b01e2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd782-801e-001f-2d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:18 GMT", + "x-ms-client-request-id" : "65510764-4dd7-41a5-b8c8-cffced1b01e2" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrange0helpertestblobrangeb1e1397650e65147b32" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrange[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrange[2].json new file mode 100644 index 000000000000..f1042b106d5d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrange[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobrange0helpertestblobrange82494317d2fec037e35?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" : "3fd66a34-32c2-4b46-9249-50e835cf1209" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560332AE470\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd793-801e-001f-3c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:18 GMT", + "x-ms-client-request-id" : "3fd66a34-32c2-4b46-9249-50e835cf1209" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobrange&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" : "f24aa0c0-6bff-4c2b-ad35-741b95c7867d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd7a1-801e-001f-4949-673bbb000000", + "Body" : "jtcblobrangejtcblobrange0helpertestblobrange82494317d2fec037e35Mon, 09 Sep 2019 19:59:18 GMT\"0x8D73560332AE470\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:18 GMT", + "x-ms-client-request-id" : "f24aa0c0-6bff-4c2b-ad35-741b95c7867d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobrange0helpertestblobrange82494317d2fec037e35?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" : "4ede6cbd-88d8-488a-ab1a-ce570cb5c1ed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd7b2-801e-001f-5549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:18 GMT", + "x-ms-client-request-id" : "4ede6cbd-88d8-488a-ab1a-ce570cb5c1ed" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrange0helpertestblobrange82494317d2fec037e35" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrangeia[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrangeia[0].json new file mode 100644 index 000000000000..8dc1e9f1d93c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrangeia[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobrangeia0helpertestblobrangeia9c904033b458f7624?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" : "cb12a6fa-55f3-40de-9b55-a0f30764e44c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603352BF0D\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd7c1-801e-001f-6349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:18 GMT", + "x-ms-client-request-id" : "cb12a6fa-55f3-40de-9b55-a0f30764e44c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobrangeia&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" : "1abbdf92-85bb-4405-8adc-4549062ba582" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd7da-801e-001f-7849-673bbb000000", + "Body" : "jtcblobrangeiajtcblobrangeia0helpertestblobrangeia9c904033b458f7624Mon, 09 Sep 2019 19:59:19 GMT\"0x8D735603352BF0D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:18 GMT", + "x-ms-client-request-id" : "1abbdf92-85bb-4405-8adc-4549062ba582", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobrangeia0helpertestblobrangeia9c904033b458f7624?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" : "ad75ff10-84ef-42c9-aad4-250280bacd0c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd7ea-801e-001f-0649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:18 GMT", + "x-ms-client-request-id" : "ad75ff10-84ef-42c9-aad4-250280bacd0c" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrangeia0helpertestblobrangeia9c904033b458f7624" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrangeia[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrangeia[1].json new file mode 100644 index 000000000000..ecd36ebcb901 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobrangeia[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobrangeia0helpertestblobrangeiaa6234159936aa2174?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" : "2f1adc78-822d-4497-aa44-609f57177c0a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603378C479\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd7f7-801e-001f-1149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:18 GMT", + "x-ms-client-request-id" : "2f1adc78-822d-4497-aa44-609f57177c0a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobrangeia&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" : "2b14fd82-7a7a-4120-ab3f-372a363814c9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd807-801e-001f-1f49-673bbb000000", + "Body" : "jtcblobrangeiajtcblobrangeia0helpertestblobrangeiaa6234159936aa2174Mon, 09 Sep 2019 19:59:19 GMT\"0x8D735603378C479\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:18 GMT", + "x-ms-client-request-id" : "2b14fd82-7a7a-4120-ab3f-372a363814c9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobrangeia0helpertestblobrangeiaa6234159936aa2174?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" : "5e372259-a47f-4829-97c4-cbae52337da1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd81b-801e-001f-3249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:18 GMT", + "x-ms-client-request-id" : "5e372259-a47f-4829-97c4-cbae52337da1" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrangeia0helpertestblobrangeiaa6234159936aa2174" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[0].json new file mode 100644 index 000000000000..1f24b20178a2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse076963a03c1a07429b4e1?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" : "edcd33ee-0313-40c7-bec9-f6dd88d9b1d8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356039F9EE56\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe04c-801e-001f-2e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:29 GMT", + "x-ms-client-request-id" : "edcd33ee-0313-40c7-bec9-f6dd88d9b1d8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&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" : "546a739f-dac2-4753-a1f2-1847cee8fc4b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe059-801e-001f-3a49-673bbb000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse076963a03c1a07429b4e1Mon, 09 Sep 2019 19:59:30 GMT\"0x8D7356039F9EE56\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:29 GMT", + "x-ms-client-request-id" : "546a739f-dac2-4753-a1f2-1847cee8fc4b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse076963a03c1a07429b4e1?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" : "9aeb0df2-a60d-47f4-9a46-c01917619f6d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe060-801e-001f-4149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:29 GMT", + "x-ms-client-request-id" : "9aeb0df2-a60d-47f4-9a46-c01917619f6d" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse076963a03c1a07429b4e1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[1].json new file mode 100644 index 000000000000..5f4474b83cc6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse023345da550ba5d5c0462?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" : "e3a9faf6-cbc3-4ce1-bfe9-7960eddc631a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603A22B374\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe06b-801e-001f-4c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:29 GMT", + "x-ms-client-request-id" : "e3a9faf6-cbc3-4ce1-bfe9-7960eddc631a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&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" : "9c87e66f-7cb6-41ed-a62e-cbda5afddb43" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe077-801e-001f-5549-673bbb000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse023345da550ba5d5c0462Mon, 09 Sep 2019 19:59:30 GMT\"0x8D735603A22B374\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:29 GMT", + "x-ms-client-request-id" : "9c87e66f-7cb6-41ed-a62e-cbda5afddb43", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse023345da550ba5d5c0462?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" : "ba7bbf11-083e-4f3f-a0aa-bf349a2be8e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe083-801e-001f-5f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:30 GMT", + "x-ms-client-request-id" : "ba7bbf11-083e-4f3f-a0aa-bf349a2be8e8" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse023345da550ba5d5c0462" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[2].json new file mode 100644 index 000000000000..3ab30561ab00 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse036766e0532c7c3e6c482?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" : "95f67eae-88a4-4aee-9c7d-cd6f5107fd4d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603A4843A7\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe09b-801e-001f-7549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:30 GMT", + "x-ms-client-request-id" : "95f67eae-88a4-4aee-9c7d-cd6f5107fd4d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&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" : "bd2cdc37-2ba7-4c14-9a3e-d74d3c8fd63f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe0a7-801e-001f-8049-673bbb000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse036766e0532c7c3e6c482Mon, 09 Sep 2019 19:59:30 GMT\"0x8D735603A4843A7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:30 GMT", + "x-ms-client-request-id" : "bd2cdc37-2ba7-4c14-9a3e-d74d3c8fd63f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse036766e0532c7c3e6c482?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" : "c8b8206a-6ada-4b3d-8086-e0fa549b9fc1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe0b3-801e-001f-0c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:30 GMT", + "x-ms-client-request-id" : "c8b8206a-6ada-4b3d-8086-e0fa549b9fc1" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse036766e0532c7c3e6c482" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[3].json new file mode 100644 index 000000000000..6ce297900d4d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[3].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse094474e0f436ad40d74d2?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" : "3aa0ad9e-bf1a-4469-96ea-021e5c4ae48d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603A6DFB07\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe0c0-801e-001f-1949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:30 GMT", + "x-ms-client-request-id" : "3aa0ad9e-bf1a-4469-96ea-021e5c4ae48d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&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" : "b8a3927d-eadb-4001-99a4-4bc241837a10" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe0db-801e-001f-2e49-673bbb000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse094474e0f436ad40d74d2Mon, 09 Sep 2019 19:59:30 GMT\"0x8D735603A6DFB07\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:30 GMT", + "x-ms-client-request-id" : "b8a3927d-eadb-4001-99a4-4bc241837a10", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse094474e0f436ad40d74d2?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" : "d3acf7a1-41fc-4bd1-bcc9-95596bcb6f6f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe0ea-801e-001f-3a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:30 GMT", + "x-ms-client-request-id" : "d3acf7a1-41fc-4bd1-bcc9-95596bcb6f6f" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse094474e0f436ad40d74d2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[4].json new file mode 100644 index 000000000000..c985223bfb72 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[4].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse05685534fd0da707d54c1?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" : "2d728e6f-e533-4dbb-8863-d2fac7633a5d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603A93B25F\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe0fa-801e-001f-4849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:30 GMT", + "x-ms-client-request-id" : "2d728e6f-e533-4dbb-8863-d2fac7633a5d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&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" : "e616c5ec-fc8f-4f30-af4f-094624a76ca0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe112-801e-001f-5e49-673bbb000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse05685534fd0da707d54c1Mon, 09 Sep 2019 19:59:31 GMT\"0x8D735603A93B25F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:30 GMT", + "x-ms-client-request-id" : "e616c5ec-fc8f-4f30-af4f-094624a76ca0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse05685534fd0da707d54c1?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" : "91a098db-97b8-424b-b3d1-a11a3a3d75fb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe119-801e-001f-6549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:30 GMT", + "x-ms-client-request-id" : "91a098db-97b8-424b-b3d1-a11a3a3d75fb" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse05685534fd0da707d54c1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[5].json new file mode 100644 index 000000000000..926516ce6e5d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[5].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse04389389aab0b1f2c0432?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" : "3c713992-a6e8-4f0f-af58-c297b3bb1589" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603AB942A6\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe12b-801e-001f-7649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:30 GMT", + "x-ms-client-request-id" : "3c713992-a6e8-4f0f-af58-c297b3bb1589" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&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" : "9faf6357-3061-47b9-ad33-bd52011653d7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe134-801e-001f-7e49-673bbb000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse04389389aab0b1f2c0432Mon, 09 Sep 2019 19:59:31 GMT\"0x8D735603AB942A6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:30 GMT", + "x-ms-client-request-id" : "9faf6357-3061-47b9-ad33-bd52011653d7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse04389389aab0b1f2c0432?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" : "adcc5eb8-a282-4cbd-b85c-32d4ba91145d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe142-801e-001f-0c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:31 GMT", + "x-ms-client-request-id" : "adcc5eb8-a282-4cbd-b85c-32d4ba91145d" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse04389389aab0b1f2c0432" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[6].json new file mode 100644 index 000000000000..312f1b588968 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparse[6].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse097655ca9681d0a41547d?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" : "e7b7ce97-9559-48eb-a6cb-d50dde3a1426" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603ADFBD79\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe156-801e-001f-1f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:31 GMT", + "x-ms-client-request-id" : "e7b7ce97-9559-48eb-a6cb-d50dde3a1426" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&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" : "9139bd5e-e4e0-4aa7-8d72-dcdec6bcdefa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe15e-801e-001f-2649-673bbb000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse097655ca9681d0a41547dMon, 09 Sep 2019 19:59:31 GMT\"0x8D735603ADFBD79\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:31 GMT", + "x-ms-client-request-id" : "9139bd5e-e4e0-4aa7-8d72-dcdec6bcdefa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse097655ca9681d0a41547d?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" : "74a677db-4f88-4b71-bbe9-513768668a25" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe171-801e-001f-3649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:31 GMT", + "x-ms-client-request-id" : "74a677db-4f88-4b71-bbe9-513768668a25" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse097655ca9681d0a41547d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparseia.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparseia.json new file mode 100644 index 000000000000..d4e32d48d333 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionsparseia.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparseia063841830f2268c18b44?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" : "671a6c41-ce37-4997-bdef-b6eabf781576" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603B06AD93\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe186-801e-001f-4949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:31 GMT", + "x-ms-client-request-id" : "671a6c41-ce37-4997-bdef-b6eabf781576" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionsparseia&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" : "7410be39-6d65-4cc6-b617-605728b94d3e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe191-801e-001f-5349-673bbb000000", + "Body" : "jtcblobsaspermissionsparseiajtcblobsaspermissionsparseia063841830f2268c18b44Mon, 09 Sep 2019 19:59:31 GMT\"0x8D735603B06AD93\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:31 GMT", + "x-ms-client-request-id" : "7410be39-6d65-4cc6-b617-605728b94d3e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparseia063841830f2268c18b44?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" : "2888f537-6a80-4ad7-89fb-3487ea8556a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe1a3-801e-001f-6349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:31 GMT", + "x-ms-client-request-id" : "2888f537-6a80-4ad7-89fb-3487ea8556a4" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparseia063841830f2268c18b44" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[0].json new file mode 100644 index 000000000000..b6c385ee8402 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionstostring061881f2fd885b1ece47?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" : "1d68eded-4558-42af-b4d1-016da09c2c1c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603909209D\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fdf22-801e-001f-2349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:28 GMT", + "x-ms-client-request-id" : "1d68eded-4558-42af-b4d1-016da09c2c1c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionstostring&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" : "ca02a7ba-d0e6-4142-8060-7af52940aa08" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fdf31-801e-001f-2e49-673bbb000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring061881f2fd885b1ece47Mon, 09 Sep 2019 19:59:28 GMT\"0x8D735603909209D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:28 GMT", + "x-ms-client-request-id" : "ca02a7ba-d0e6-4142-8060-7af52940aa08", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionstostring061881f2fd885b1ece47?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" : "4fcdf69f-12be-4c15-bd3c-d98155450e27" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fdf41-801e-001f-3e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:28 GMT", + "x-ms-client-request-id" : "4fcdf69f-12be-4c15-bd3c-d98155450e27" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring061881f2fd885b1ece47" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[1].json new file mode 100644 index 000000000000..bf708aa0b238 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionstostring041430279313cff2a147?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" : "dd93e5f2-7539-43ec-bf75-95462a11c685" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560392EB0E9\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fdf50-801e-001f-4b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:28 GMT", + "x-ms-client-request-id" : "dd93e5f2-7539-43ec-bf75-95462a11c685" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionstostring&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" : "cc9558a5-9062-42dc-b4ea-861c2bf399c2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fdf57-801e-001f-5149-673bbb000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring041430279313cff2a147Mon, 09 Sep 2019 19:59:28 GMT\"0x8D73560392EB0E9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:28 GMT", + "x-ms-client-request-id" : "cc9558a5-9062-42dc-b4ea-861c2bf399c2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionstostring041430279313cff2a147?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" : "2e102093-21fa-441d-882d-49931990e2c0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fdf63-801e-001f-5b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:28 GMT", + "x-ms-client-request-id" : "2e102093-21fa-441d-882d-49931990e2c0" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring041430279313cff2a147" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[2].json new file mode 100644 index 000000000000..79fac77ca327 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionstostring0931707ba83b48b9c344?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" : "1830fd1c-7706-470e-8207-66f74acd5ca9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603956D9B8\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fdf77-801e-001f-6e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:28 GMT", + "x-ms-client-request-id" : "1830fd1c-7706-470e-8207-66f74acd5ca9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionstostring&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" : "01797d5c-a4b2-4fd4-8259-748c50b6da86" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fdfa0-801e-001f-1149-673bbb000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring0931707ba83b48b9c344Mon, 09 Sep 2019 19:59:29 GMT\"0x8D735603956D9B8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:28 GMT", + "x-ms-client-request-id" : "01797d5c-a4b2-4fd4-8259-748c50b6da86", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionstostring0931707ba83b48b9c344?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" : "c3892b0f-14ab-467c-9fe2-fa950b80fa98" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fdfb3-801e-001f-2449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:28 GMT", + "x-ms-client-request-id" : "c3892b0f-14ab-467c-9fe2-fa950b80fa98" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring0931707ba83b48b9c344" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[3].json new file mode 100644 index 000000000000..b97b22e3299b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[3].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionstostring07148836a8ee70293b46?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" : "ea9d653b-6cef-4087-9185-8081020a0f0d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560398656E5\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fdfc8-801e-001f-3449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:28 GMT", + "x-ms-client-request-id" : "ea9d653b-6cef-4087-9185-8081020a0f0d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionstostring&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" : "32a41f40-e72b-4fc9-be6c-5f5da3a6ebdd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fdfd3-801e-001f-3e49-673bbb000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring07148836a8ee70293b46Mon, 09 Sep 2019 19:59:29 GMT\"0x8D73560398656E5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:28 GMT", + "x-ms-client-request-id" : "32a41f40-e72b-4fc9-be6c-5f5da3a6ebdd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionstostring07148836a8ee70293b46?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" : "7b0baac1-469a-4664-b033-0c226493115d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fdfd9-801e-001f-4449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:29 GMT", + "x-ms-client-request-id" : "7b0baac1-469a-4664-b033-0c226493115d" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring07148836a8ee70293b46" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[4].json new file mode 100644 index 000000000000..bebb153255ff --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[4].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionstostring011912cccc9e9f111f40?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" : "22c4eb94-864e-41d7-8402-822eb2b8891b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356039AB98FE\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fdfe6-801e-001f-5049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:29 GMT", + "x-ms-client-request-id" : "22c4eb94-864e-41d7-8402-822eb2b8891b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionstostring&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" : "8367a878-62f1-4e77-b8ca-856a4215659b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fdff2-801e-001f-5b49-673bbb000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring011912cccc9e9f111f40Mon, 09 Sep 2019 19:59:29 GMT\"0x8D7356039AB98FE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:29 GMT", + "x-ms-client-request-id" : "8367a878-62f1-4e77-b8ca-856a4215659b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionstostring011912cccc9e9f111f40?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" : "6cd29885-19e8-4f56-9136-d221af260135" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fdffb-801e-001f-6349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:29 GMT", + "x-ms-client-request-id" : "6cd29885-19e8-4f56-9136-d221af260135" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring011912cccc9e9f111f40" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[5].json new file mode 100644 index 000000000000..e7cabdab3cab --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestblobsaspermissionstostring[5].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionstostring057202dae0b63a97b74d?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" : "65875318-8c77-447f-b486-197d63236514" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356039D23AD6\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe00e-801e-001f-7649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:29 GMT", + "x-ms-client-request-id" : "65875318-8c77-447f-b486-197d63236514" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionstostring&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" : "6b70f460-a033-4d00-84da-90d5dd588ff0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe020-801e-001f-0649-673bbb000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring057202dae0b63a97b74dMon, 09 Sep 2019 19:59:29 GMT\"0x8D7356039D23AD6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:29 GMT", + "x-ms-client-request-id" : "6b70f460-a033-4d00-84da-90d5dd588ff0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionstostring057202dae0b63a97b74d?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" : "cf4abbcf-e0cb-4a6c-ae2b-446f40b2d7c7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe040-801e-001f-2449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:29 GMT", + "x-ms-client-request-id" : "cf4abbcf-e0cb-4a6c-ae2b-446f40b2d7c7" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring057202dae0b63a97b74d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestbloburlparts.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestbloburlparts.json new file mode 100644 index 000000000000..2265c45dad99 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestbloburlparts.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbloburlparts0helpertestbloburlparts279057027986b0ea?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" : "11e1a20f-2f3e-4250-9bec-a787dfca70d3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356044A672BE\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fed88-801e-001f-1b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:47 GMT", + "x-ms-client-request-id" : "11e1a20f-2f3e-4250-9bec-a787dfca70d3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbloburlparts&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" : "5a7b1eff-e9ed-45a8-b49a-33e9dde043c0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fed9a-801e-001f-2c49-673bbb000000", + "Body" : "jtcbloburlpartsjtcbloburlparts0helpertestbloburlparts279057027986b0eaMon, 09 Sep 2019 19:59:48 GMT\"0x8D7356044A672BE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:47 GMT", + "x-ms-client-request-id" : "5a7b1eff-e9ed-45a8-b49a-33e9dde043c0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbloburlparts0helpertestbloburlparts279057027986b0ea?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" : "4bb1d0a4-3f29-4b12-a64e-b06dbc061920" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077feda5-801e-001f-3749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:47 GMT", + "x-ms-client-request-id" : "4bb1d0a4-3f29-4b12-a64e-b06dbc061920" + }, + "Exception" : null + } ], + "variables" : [ "jtcbloburlparts0helpertestbloburlparts279057027986b0ea" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[0].json new file mode 100644 index 000000000000..d9250f0ddc56 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse071396ce496b0210464?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" : "062eaf26-d0d1-421f-8a1c-4526ede73ed5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603C3AD213\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe2f6-801e-001f-1549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:33 GMT", + "x-ms-client-request-id" : "062eaf26-d0d1-421f-8a1c-4526ede73ed5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&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" : "08ac7fe5-fdde-42c4-8900-19bfc8c07f04" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe304-801e-001f-2249-673bbb000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse071396ce496b0210464Mon, 09 Sep 2019 19:59:33 GMT\"0x8D735603C3AD213\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:33 GMT", + "x-ms-client-request-id" : "08ac7fe5-fdde-42c4-8900-19bfc8c07f04", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse071396ce496b0210464?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" : "f044498b-f6d8-4281-8883-a4137e9b26a6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe30d-801e-001f-2b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:33 GMT", + "x-ms-client-request-id" : "f044498b-f6d8-4281-8883-a4137e9b26a6" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse071396ce496b0210464" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[1].json new file mode 100644 index 000000000000..ca05b7cc04ba --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse05202271697bb043904?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" : "abf14795-3454-4b65-895f-294e79bef883" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603C60896F\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe31e-801e-001f-3949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:33 GMT", + "x-ms-client-request-id" : "abf14795-3454-4b65-895f-294e79bef883" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&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" : "d48f8e3a-4955-4d92-abef-5fa198e0102e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe32b-801e-001f-4249-673bbb000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse05202271697bb043904Mon, 09 Sep 2019 19:59:34 GMT\"0x8D735603C60896F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:33 GMT", + "x-ms-client-request-id" : "d48f8e3a-4955-4d92-abef-5fa198e0102e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse05202271697bb043904?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" : "e6eae533-c8d7-4a9d-83f5-9e69743caf5a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe339-801e-001f-4d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:33 GMT", + "x-ms-client-request-id" : "e6eae533-c8d7-4a9d-83f5-9e69743caf5a" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse05202271697bb043904" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[2].json new file mode 100644 index 000000000000..50feec5e71bc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse064857d59ee19f26ab4?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" : "f9ed8e2a-aa01-4ed6-8fd8-df7f2d5d5af5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603C8667EA\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe349-801e-001f-5d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:33 GMT", + "x-ms-client-request-id" : "f9ed8e2a-aa01-4ed6-8fd8-df7f2d5d5af5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&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" : "4e279e55-7ee1-439e-900e-48fd485af019" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe358-801e-001f-6949-673bbb000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse064857d59ee19f26ab4Mon, 09 Sep 2019 19:59:34 GMT\"0x8D735603C8667EA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:33 GMT", + "x-ms-client-request-id" : "4e279e55-7ee1-439e-900e-48fd485af019", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse064857d59ee19f26ab4?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" : "0b9541b0-dac7-4600-8fb9-3d5ca6b7412d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe35f-801e-001f-7049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:34 GMT", + "x-ms-client-request-id" : "0b9541b0-dac7-4600-8fb9-3d5ca6b7412d" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse064857d59ee19f26ab4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[3].json new file mode 100644 index 000000000000..63c33a6faa9c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[3].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse04120230bc700ddd704?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" : "1aa932ec-62ba-4c40-8611-8b9ea9e2ad9b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603CADCD43\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe36d-801e-001f-7d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:34 GMT", + "x-ms-client-request-id" : "1aa932ec-62ba-4c40-8611-8b9ea9e2ad9b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&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" : "35beda0f-9d83-4fa2-83d6-bccd520effe1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe377-801e-001f-0649-673bbb000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse04120230bc700ddd704Mon, 09 Sep 2019 19:59:34 GMT\"0x8D735603CADCD43\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:34 GMT", + "x-ms-client-request-id" : "35beda0f-9d83-4fa2-83d6-bccd520effe1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse04120230bc700ddd704?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" : "f407fdda-22c9-4e74-8b19-f8e46570e343" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe386-801e-001f-1349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:34 GMT", + "x-ms-client-request-id" : "f407fdda-22c9-4e74-8b19-f8e46570e343" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse04120230bc700ddd704" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[4].json new file mode 100644 index 000000000000..5f7701b2607e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[4].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse043247c8064aa061524?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" : "fa3afbe4-bbad-4a21-8ba3-37263ca4ba10" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603CD5CF02\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe39a-801e-001f-2649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:34 GMT", + "x-ms-client-request-id" : "fa3afbe4-bbad-4a21-8ba3-37263ca4ba10" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&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" : "75b3e8ee-20e6-461e-a5a8-ed2957989291" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe3b3-801e-001f-3849-673bbb000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse043247c8064aa061524Mon, 09 Sep 2019 19:59:34 GMT\"0x8D735603CD5CF02\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:34 GMT", + "x-ms-client-request-id" : "75b3e8ee-20e6-461e-a5a8-ed2957989291", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse043247c8064aa061524?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" : "a153901f-41d2-43c6-9b7d-f48f74d08d4b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe3c2-801e-001f-4749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:34 GMT", + "x-ms-client-request-id" : "a153901f-41d2-43c6-9b7d-f48f74d08d4b" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse043247c8064aa061524" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[5].json new file mode 100644 index 000000000000..e28aaba260e7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[5].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse062821d043dd86da5b4?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" : "af6505c0-e829-44f0-b9ae-f7af8b12c2d7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603CFDA9A3\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe3d9-801e-001f-5c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:34 GMT", + "x-ms-client-request-id" : "af6505c0-e829-44f0-b9ae-f7af8b12c2d7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&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" : "0e11c1d3-37a8-440c-be02-531003858ca7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe3ee-801e-001f-6c49-673bbb000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse062821d043dd86da5b4Mon, 09 Sep 2019 19:59:35 GMT\"0x8D735603CFDA9A3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:34 GMT", + "x-ms-client-request-id" : "0e11c1d3-37a8-440c-be02-531003858ca7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse062821d043dd86da5b4?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" : "75db1a76-6d2d-4fb5-8f43-a7def700349f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe3fc-801e-001f-7949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:34 GMT", + "x-ms-client-request-id" : "75db1a76-6d2d-4fb5-8f43-a7def700349f" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse062821d043dd86da5b4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[6].json new file mode 100644 index 000000000000..c8a38dc70d5f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[6].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse014230112e2f3d524e4?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" : "1ee42b5f-a653-4348-8610-3d8ab816705d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603D242475\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe415-801e-001f-0e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:34 GMT", + "x-ms-client-request-id" : "1ee42b5f-a653-4348-8610-3d8ab816705d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&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" : "241c5b54-6b79-426d-bef6-a8663049f2c8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe429-801e-001f-2049-673bbb000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse014230112e2f3d524e4Mon, 09 Sep 2019 19:59:35 GMT\"0x8D735603D242475\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:34 GMT", + "x-ms-client-request-id" : "241c5b54-6b79-426d-bef6-a8663049f2c8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse014230112e2f3d524e4?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" : "c831df52-0004-43ad-9bb2-d5b718292aa3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe432-801e-001f-2849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:35 GMT", + "x-ms-client-request-id" : "c831df52-0004-43ad-9bb2-d5b718292aa3" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse014230112e2f3d524e4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[7].json new file mode 100644 index 000000000000..71d4bf458801 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparse[7].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse075516521ba19c53744?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" : "4e84c5f7-33a2-41e7-8563-e9ff918edf7c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603D49DBD6\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe44a-801e-001f-3f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:35 GMT", + "x-ms-client-request-id" : "4e84c5f7-33a2-41e7-8563-e9ff918edf7c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&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" : "f91ab7b7-7d42-49fd-8305-e80055867d8a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe45e-801e-001f-4f49-673bbb000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse075516521ba19c53744Mon, 09 Sep 2019 19:59:35 GMT\"0x8D735603D49DBD6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:35 GMT", + "x-ms-client-request-id" : "f91ab7b7-7d42-49fd-8305-e80055867d8a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse075516521ba19c53744?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" : "f0b16e70-e443-438c-a641-50e4f1915046" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe470-801e-001f-6149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:35 GMT", + "x-ms-client-request-id" : "f0b16e70-e443-438c-a641-50e4f1915046" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse075516521ba19c53744" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparseia.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparseia.json new file mode 100644 index 000000000000..4aec00f99834 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionsparseia.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparseia0365173c9ee16b8e1a?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" : "a5e01f38-6b3f-442d-8ae9-4f9283e5da9f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603D6F6C1D\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe487-801e-001f-7849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:35 GMT", + "x-ms-client-request-id" : "a5e01f38-6b3f-442d-8ae9-4f9283e5da9f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionsparseia&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" : "282fb706-30bb-4c35-9202-3a86f95a5731" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe496-801e-001f-0549-673bbb000000", + "Body" : "jtccontainersaspermissionsparseiajtccontainersaspermissionsparseia0365173c9ee16b8e1aMon, 09 Sep 2019 19:59:36 GMT\"0x8D735603D6F6C1D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:35 GMT", + "x-ms-client-request-id" : "282fb706-30bb-4c35-9202-3a86f95a5731", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparseia0365173c9ee16b8e1a?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" : "d4f26bb3-8169-4314-a41b-2ad2ff630e26" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe4ab-801e-001f-1949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:35 GMT", + "x-ms-client-request-id" : "d4f26bb3-8169-4314-a41b-2ad2ff630e26" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparseia0365173c9ee16b8e1a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[0].json new file mode 100644 index 000000000000..217adc4e1069 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring090355bba8734e069?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" : "79a6fac1-ddf0-4938-beb0-4c5fb8a3ef07" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603B2CDA37\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe1af-801e-001f-6e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:31 GMT", + "x-ms-client-request-id" : "79a6fac1-ddf0-4938-beb0-4c5fb8a3ef07" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&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" : "d20190d8-3e5a-4e10-8c61-d7a6a103dc4f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe1c2-801e-001f-7f49-673bbb000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring090355bba8734e069Mon, 09 Sep 2019 19:59:32 GMT\"0x8D735603B2CDA37\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:31 GMT", + "x-ms-client-request-id" : "d20190d8-3e5a-4e10-8c61-d7a6a103dc4f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring090355bba8734e069?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" : "b048fcf7-fa58-4daa-b38f-a44bc3e2c881" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe1cf-801e-001f-0a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:31 GMT", + "x-ms-client-request-id" : "b048fcf7-fa58-4daa-b38f-a44bc3e2c881" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring090355bba8734e069" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[1].json new file mode 100644 index 000000000000..c1ed2e5edecd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring07799411a9069af89?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" : "67593785-46a4-4f63-91d3-d2cc58150f30" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603B52B8AD\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe1e3-801e-001f-1e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:31 GMT", + "x-ms-client-request-id" : "67593785-46a4-4f63-91d3-d2cc58150f30" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&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" : "c758fc65-e2a9-4cf8-8123-04c6aaca1e5d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe1f3-801e-001f-2a49-673bbb000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring07799411a9069af89Mon, 09 Sep 2019 19:59:32 GMT\"0x8D735603B52B8AD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:31 GMT", + "x-ms-client-request-id" : "c758fc65-e2a9-4cf8-8123-04c6aaca1e5d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring07799411a9069af89?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" : "f5f91ad8-d760-42d5-aae5-679dbc175fe9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe207-801e-001f-3c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:32 GMT", + "x-ms-client-request-id" : "f5f91ad8-d760-42d5-aae5-679dbc175fe9" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring07799411a9069af89" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[2].json new file mode 100644 index 000000000000..56f4f441fc99 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring062826b41923b5c2e?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" : "64529ffc-4797-4977-8433-1647c527ed82" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603B78E551\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe211-801e-001f-4649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:32 GMT", + "x-ms-client-request-id" : "64529ffc-4797-4977-8433-1647c527ed82" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&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" : "a701adbd-8af8-4e2c-9784-b398e3717d99" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe225-801e-001f-5849-673bbb000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring062826b41923b5c2eMon, 09 Sep 2019 19:59:32 GMT\"0x8D735603B78E551\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:32 GMT", + "x-ms-client-request-id" : "a701adbd-8af8-4e2c-9784-b398e3717d99", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring062826b41923b5c2e?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" : "cf0f95d2-9e65-4a89-98a5-8789b7afb6b9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe232-801e-001f-6549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:32 GMT", + "x-ms-client-request-id" : "cf0f95d2-9e65-4a89-98a5-8789b7afb6b9" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring062826b41923b5c2e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[3].json new file mode 100644 index 000000000000..012681058bbd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[3].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring018760d88048752f2?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" : "e5309131-08f6-4a31-be75-44d480fd938e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603B9FFC75\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe248-801e-001f-7a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:32 GMT", + "x-ms-client-request-id" : "e5309131-08f6-4a31-be75-44d480fd938e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&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" : "de216413-e7a7-4dd6-8c1d-ab74fcaa066e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe254-801e-001f-0349-673bbb000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring018760d88048752f2Mon, 09 Sep 2019 19:59:32 GMT\"0x8D735603B9FFC75\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:32 GMT", + "x-ms-client-request-id" : "de216413-e7a7-4dd6-8c1d-ab74fcaa066e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring018760d88048752f2?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" : "49fbca4e-fa33-45d2-9860-b22a4736daf4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe268-801e-001f-1649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:32 GMT", + "x-ms-client-request-id" : "49fbca4e-fa33-45d2-9860-b22a4736daf4" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring018760d88048752f2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[4].json new file mode 100644 index 000000000000..06c1ce555cf4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[4].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring049944fc86d43dd88?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" : "0bb317ff-62b1-4c10-8950-dde6d5082b3d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603BC601EF\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe27b-801e-001f-2849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:32 GMT", + "x-ms-client-request-id" : "0bb317ff-62b1-4c10-8950-dde6d5082b3d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&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" : "a9190ce8-1528-40df-9bfe-173e5a8c18d5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe287-801e-001f-3049-673bbb000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring049944fc86d43dd88Mon, 09 Sep 2019 19:59:33 GMT\"0x8D735603BC601EF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:32 GMT", + "x-ms-client-request-id" : "a9190ce8-1528-40df-9bfe-173e5a8c18d5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring049944fc86d43dd88?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" : "ead90a87-a771-4667-b6f0-bb55d70cf498" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe29b-801e-001f-4249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:32 GMT", + "x-ms-client-request-id" : "ead90a87-a771-4667-b6f0-bb55d70cf498" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring049944fc86d43dd88" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[5].json new file mode 100644 index 000000000000..debd378f8418 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[5].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring018029ba60d0a7e13?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" : "10039973-e125-4cd4-8caf-c77612297925" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603BEBB944\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe2aa-801e-001f-5049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:32 GMT", + "x-ms-client-request-id" : "10039973-e125-4cd4-8caf-c77612297925" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&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" : "0f3f113a-e9dc-40ef-9bd4-810b3415e333" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe2b3-801e-001f-5849-673bbb000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring018029ba60d0a7e13Mon, 09 Sep 2019 19:59:33 GMT\"0x8D735603BEBB944\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:32 GMT", + "x-ms-client-request-id" : "0f3f113a-e9dc-40ef-9bd4-810b3415e333", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring018029ba60d0a7e13?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" : "9d73e661-d52a-4528-9f3d-5489b37a515b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe2be-801e-001f-6149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:33 GMT", + "x-ms-client-request-id" : "9d73e661-d52a-4528-9f3d-5489b37a515b" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring018029ba60d0a7e13" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[6].json new file mode 100644 index 000000000000..7b40b735df30 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestcontainersaspermissionstostring[6].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring054578dd269e1d428?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" : "116004e5-fdd9-427f-96eb-927a47dbe52b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603C1345A5\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe2d1-801e-001f-7149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:33 GMT", + "x-ms-client-request-id" : "116004e5-fdd9-427f-96eb-927a47dbe52b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&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" : "e92d6105-0ea4-4570-942b-29a9a9b54070" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe2db-801e-001f-7a49-673bbb000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring054578dd269e1d428Mon, 09 Sep 2019 19:59:33 GMT\"0x8D735603C1345A5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:33 GMT", + "x-ms-client-request-id" : "e92d6105-0ea4-4570-942b-29a9a9b54070", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring054578dd269e1d428?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" : "4d776122-a1a0-49b1-badb-a21697ade04a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe2e6-801e-001f-0549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:33 GMT", + "x-ms-client-request-id" : "4d776122-a1a0-49b1-badb-a21697ade04a" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring054578dd269e1d428" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangeparse[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangeparse[0].json new file mode 100644 index 000000000000..cbe1f3fca90d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangeparse[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtciprangeparse0helpertestiprangeparsee567284461df7df9?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" : "7f3abd17-66f8-4e70-b11f-08cbb6c4fabf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603E0BC8CB\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe554-801e-001f-3849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:36 GMT", + "x-ms-client-request-id" : "7f3abd17-66f8-4e70-b11f-08cbb6c4fabf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtciprangeparse&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" : "1c50b0f5-eecd-40d0-a8f8-0c902e91f8cb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe571-801e-001f-4f49-673bbb000000", + "Body" : "jtciprangeparsejtciprangeparse0helpertestiprangeparsee567284461df7df9Mon, 09 Sep 2019 19:59:37 GMT\"0x8D735603E0BC8CB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:36 GMT", + "x-ms-client-request-id" : "1c50b0f5-eecd-40d0-a8f8-0c902e91f8cb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtciprangeparse0helpertestiprangeparsee567284461df7df9?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" : "79aed11e-2dc6-41d9-9a0b-599abe199f23" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe582-801e-001f-6049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:36 GMT", + "x-ms-client-request-id" : "79aed11e-2dc6-41d9-9a0b-599abe199f23" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangeparse0helpertestiprangeparsee567284461df7df9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangeparse[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangeparse[1].json new file mode 100644 index 000000000000..5c818954a4a7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangeparse[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtciprangeparse0helpertestiprangeparse6c881937b159a74d?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" : "7a60a2c4-cc79-4b1d-bce5-de8973d080d0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603E350328\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe58d-801e-001f-6a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:36 GMT", + "x-ms-client-request-id" : "7a60a2c4-cc79-4b1d-bce5-de8973d080d0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtciprangeparse&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" : "5f0e8c2b-f3e3-4c2a-8d17-4d11e15a3769" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe599-801e-001f-7349-673bbb000000", + "Body" : "jtciprangeparsejtciprangeparse0helpertestiprangeparse6c881937b159a74dMon, 09 Sep 2019 19:59:37 GMT\"0x8D735603E350328\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:36 GMT", + "x-ms-client-request-id" : "5f0e8c2b-f3e3-4c2a-8d17-4d11e15a3769", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtciprangeparse0helpertestiprangeparse6c881937b159a74d?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" : "bee39ffd-50e3-41fc-b036-c30ee2d3f249" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe5a4-801e-001f-7e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:36 GMT", + "x-ms-client-request-id" : "bee39ffd-50e3-41fc-b036-c30ee2d3f249" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangeparse0helpertestiprangeparse6c881937b159a74d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangeparse[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangeparse[2].json new file mode 100644 index 000000000000..0f34912e865d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangeparse[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtciprangeparse0helpertestiprangeparse9056453100db0f52?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" : "4d4db3f9-7a3b-4de4-9336-f37e9ecd3c9f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603E5CDDC0\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe5b3-801e-001f-0d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:36 GMT", + "x-ms-client-request-id" : "4d4db3f9-7a3b-4de4-9336-f37e9ecd3c9f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtciprangeparse&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" : "02fdf043-9442-43ce-bc77-3fbe326fcda9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe5ce-801e-001f-2549-673bbb000000", + "Body" : "jtciprangeparsejtciprangeparse0helpertestiprangeparse9056453100db0f52Mon, 09 Sep 2019 19:59:37 GMT\"0x8D735603E5CDDC0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:37 GMT", + "x-ms-client-request-id" : "02fdf043-9442-43ce-bc77-3fbe326fcda9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtciprangeparse0helpertestiprangeparse9056453100db0f52?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" : "2fe5052f-bb4a-403e-a87e-f8f078659a1a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe5dc-801e-001f-3249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:37 GMT", + "x-ms-client-request-id" : "2fe5052f-bb4a-403e-a87e-f8f078659a1a" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangeparse0helpertestiprangeparse9056453100db0f52" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangetostring[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangetostring[0].json new file mode 100644 index 000000000000..184f8c156cda --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangetostring[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtciprangetostring0helpertestiprangetostring7931103921124?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" : "2c9eb320-c737-4278-b7bc-e45f734fd73d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603D971FA5\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe4bd-801e-001f-2949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:35 GMT", + "x-ms-client-request-id" : "2c9eb320-c737-4278-b7bc-e45f734fd73d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtciprangetostring&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" : "4ab39703-b0eb-46b3-95e7-819369a83dec" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe4c8-801e-001f-3349-673bbb000000", + "Body" : "jtciprangetostringjtciprangetostring0helpertestiprangetostring7931103921124Mon, 09 Sep 2019 19:59:36 GMT\"0x8D735603D971FA5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:35 GMT", + "x-ms-client-request-id" : "4ab39703-b0eb-46b3-95e7-819369a83dec", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtciprangetostring0helpertestiprangetostring7931103921124?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" : "408d098f-aed1-442d-82ae-8038e06ee765" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe4ce-801e-001f-3949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:35 GMT", + "x-ms-client-request-id" : "408d098f-aed1-442d-82ae-8038e06ee765" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangetostring0helpertestiprangetostring7931103921124" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangetostring[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangetostring[1].json new file mode 100644 index 000000000000..e93968ac53fc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangetostring[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtciprangetostring0helpertestiprangetostring28b47478e129e?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" : "370be3bc-5d66-4fe0-8896-16eebacc520d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603DBD9A89\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe4db-801e-001f-4649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:35 GMT", + "x-ms-client-request-id" : "370be3bc-5d66-4fe0-8896-16eebacc520d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtciprangetostring&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" : "d4e7124c-232c-4bf1-ac1b-5fb3928a884f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe4ef-801e-001f-5849-673bbb000000", + "Body" : "jtciprangetostringjtciprangetostring0helpertestiprangetostring28b47478e129eMon, 09 Sep 2019 19:59:36 GMT\"0x8D735603DBD9A89\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:35 GMT", + "x-ms-client-request-id" : "d4e7124c-232c-4bf1-ac1b-5fb3928a884f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtciprangetostring0helpertestiprangetostring28b47478e129e?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" : "6e29b606-36e9-4888-a617-aa8ae2faa9cd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe4fd-801e-001f-6449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:36 GMT", + "x-ms-client-request-id" : "6e29b606-36e9-4888-a617-aa8ae2faa9cd" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangetostring0helpertestiprangetostring28b47478e129e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangetostring[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangetostring[2].json new file mode 100644 index 000000000000..0de0e4df5078 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestiprangetostring[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtciprangetostring0helpertestiprangetostringdfe620811410a?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" : "d253a324-ba0b-463d-a42c-f7af0a7c1e14" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603DE378F2\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe509-801e-001f-7049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:36 GMT", + "x-ms-client-request-id" : "d253a324-ba0b-463d-a42c-f7af0a7c1e14" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtciprangetostring&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" : "f40c4f64-9675-49f5-ba1a-36dcfd3ab052" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe517-801e-001f-7d49-673bbb000000", + "Body" : "jtciprangetostringjtciprangetostring0helpertestiprangetostringdfe620811410aMon, 09 Sep 2019 19:59:36 GMT\"0x8D735603DE378F2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:36 GMT", + "x-ms-client-request-id" : "f40c4f64-9675-49f5-ba1a-36dcfd3ab052", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtciprangetostring0helpertestiprangetostringdfe620811410a?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" : "0dac7eb2-6bf4-460b-9e7b-a7fd0303f799" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe52a-801e-001f-0f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:36 GMT", + "x-ms-client-request-id" : "0dac7eb2-6bf4-460b-9e7b-a7fd0303f799" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangetostring0helpertestiprangetostringdfe620811410a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestrequestproperty.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestrequestproperty.json new file mode 100644 index 000000000000..245a1b7e23c2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestrequestproperty.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrequestproperty0helpertestrequestpropertyc7d2642690041?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" : "685907a2-4533-4c73-9807-c6c0936003c4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356032B8376A\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd70c-801e-001f-4649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:17 GMT", + "x-ms-client-request-id" : "685907a2-4533-4c73-9807-c6c0936003c4" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcrequestproperty0helpertestrequestpropertyc7d2642690041?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" : "4aa70ffb-db64-4941-84a3-9dfd01a2f82b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd71f-801e-001f-5649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:17 GMT", + "x-ms-client-request-id" : "4aa70ffb-db64-4941-84a3-9dfd01a2f82b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcrequestproperty&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" : "4bd057bf-c9e1-469b-a3d9-73c3add60481" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd72b-801e-001f-6249-673bbb000000", + "Body" : "jtcrequestproperty", + "Date" : "Mon, 09 Sep 2019 19:59:17 GMT", + "x-ms-client-request-id" : "4bd057bf-c9e1-469b-a3d9-73c3add60481", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "jtcrequestproperty0helpertestrequestpropertyc7d2642690041" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestsasprotocolparse[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestsasprotocolparse[0].json new file mode 100644 index 000000000000..dfb59fd5c117 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestsasprotocolparse[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsasprotocolparse0helpertestsasprotocolparse4e8352297aa5?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" : "d80a1830-3962-46a1-b1ca-539aab5c92b0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603E82950D\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe5ea-801e-001f-3e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:37 GMT", + "x-ms-client-request-id" : "d80a1830-3962-46a1-b1ca-539aab5c92b0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsasprotocolparse&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" : "87d9fc83-3858-4199-ae7c-085cf40951aa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe5fb-801e-001f-4c49-673bbb000000", + "Body" : "jtcsasprotocolparsejtcsasprotocolparse0helpertestsasprotocolparse4e8352297aa5Mon, 09 Sep 2019 19:59:37 GMT\"0x8D735603E82950D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:37 GMT", + "x-ms-client-request-id" : "87d9fc83-3858-4199-ae7c-085cf40951aa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsasprotocolparse0helpertestsasprotocolparse4e8352297aa5?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" : "659e2f4a-997c-4cd6-9352-ddb289a51e72" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe60d-801e-001f-5e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:37 GMT", + "x-ms-client-request-id" : "659e2f4a-997c-4cd6-9352-ddb289a51e72" + }, + "Exception" : null + } ], + "variables" : [ "jtcsasprotocolparse0helpertestsasprotocolparse4e8352297aa5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestsasprotocolparse[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestsasprotocolparse[1].json new file mode 100644 index 000000000000..f0c3ac29fffc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestsasprotocolparse[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsasprotocolparse0helpertestsasprotocolparse22774780046c?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" : "2614ce14-934e-423f-a7fa-d69b854620ab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603EAB332D\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fe625-801e-001f-7649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:37 GMT", + "x-ms-client-request-id" : "2614ce14-934e-423f-a7fa-d69b854620ab" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsasprotocolparse&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" : "48b09588-e4ae-47c3-882e-c67a4aa79470" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fe632-801e-001f-8049-673bbb000000", + "Body" : "jtcsasprotocolparsejtcsasprotocolparse0helpertestsasprotocolparse22774780046cMon, 09 Sep 2019 19:59:38 GMT\"0x8D735603EAB332D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:37 GMT", + "x-ms-client-request-id" : "48b09588-e4ae-47c3-882e-c67a4aa79470", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsasprotocolparse0helpertestsasprotocolparse22774780046c?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" : "95fb4809-aeef-4b3f-a9f4-83a6de006947" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fe63b-801e-001f-0949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:37 GMT", + "x-ms-client-request-id" : "95fb4809-aeef-4b3f-a9f4-83a6de006947" + }, + "Exception" : null + } ], + "variables" : [ "jtcsasprotocolparse0helpertestsasprotocolparse22774780046c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[0].json new file mode 100644 index 000000000000..5803e65cfdf9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign0501857f2d8e1f7c8?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" : "9895b068-584e-4adf-b93b-c58c0792fc0a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560339FB487\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd82b-801e-001f-4249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:18 GMT", + "x-ms-client-request-id" : "9895b068-584e-4adf-b93b-c58c0792fc0a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&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" : "abe9e6f4-b5f1-4764-b6e8-c940506411e7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd837-801e-001f-4d49-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign0501857f2d8e1f7c8Mon, 09 Sep 2019 19:59:19 GMT\"0x8D73560339FB487\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:19 GMT", + "x-ms-client-request-id" : "abe9e6f4-b5f1-4764-b6e8-c940506411e7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign0501857f2d8e1f7c8?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" : "6895e265-cb46-4121-bd59-86c3b195b83f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd848-801e-001f-5e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:19 GMT", + "x-ms-client-request-id" : "6895e265-cb46-4121-bd59-86c3b195b83f" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign0501857f2d8e1f7c8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[10].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[10].json new file mode 100644 index 000000000000..024cafc9bf08 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[10].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign047492f2ebff8f34f?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" : "798f4fa6-3976-473d-b9b6-8559cf98e349" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560352F776E\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fda53-801e-001f-4149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:21 GMT", + "x-ms-client-request-id" : "798f4fa6-3976-473d-b9b6-8559cf98e349" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&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" : "3d1c02ad-6d05-4ee7-bd41-fbbe0dcce0bb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fda5f-801e-001f-4b49-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign047492f2ebff8f34fMon, 09 Sep 2019 19:59:22 GMT\"0x8D73560352F776E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:21 GMT", + "x-ms-client-request-id" : "3d1c02ad-6d05-4ee7-bd41-fbbe0dcce0bb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign047492f2ebff8f34f?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" : "c3c8b578-823a-446e-83eb-494f841235fe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fda6c-801e-001f-5649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:21 GMT", + "x-ms-client-request-id" : "c3c8b578-823a-446e-83eb-494f841235fe" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign047492f2ebff8f34f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[11].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[11].json new file mode 100644 index 000000000000..385968d4a65b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[11].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign0823700985c534ff0?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" : "3e827414-78fe-45b0-a670-f722064b577c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356035557CED\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fda7d-801e-001f-6749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:21 GMT", + "x-ms-client-request-id" : "3e827414-78fe-45b0-a670-f722064b577c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&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" : "7608c660-92f4-4e19-adfd-7f8ead6f77c0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fda8c-801e-001f-7549-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign0823700985c534ff0Mon, 09 Sep 2019 19:59:22 GMT\"0x8D7356035557CED\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:21 GMT", + "x-ms-client-request-id" : "7608c660-92f4-4e19-adfd-7f8ead6f77c0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign0823700985c534ff0?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" : "14c68829-3f81-43df-8fae-3b1564fbe71a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fda98-801e-001f-0149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:21 GMT", + "x-ms-client-request-id" : "14c68829-3f81-43df-8fae-3b1564fbe71a" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign0823700985c534ff0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[1].json new file mode 100644 index 000000000000..5e263dedc678 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign09740194aa2a9c77c?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" : "5f80585c-34b1-46a5-9843-2b8244469e1d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356033C719D1\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd85c-801e-001f-7249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:19 GMT", + "x-ms-client-request-id" : "5f80585c-34b1-46a5-9843-2b8244469e1d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&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" : "f6777271-bd7c-4693-a205-c1e85d6033aa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd86f-801e-001f-0249-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign09740194aa2a9c77cMon, 09 Sep 2019 19:59:19 GMT\"0x8D7356033C719D1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:19 GMT", + "x-ms-client-request-id" : "f6777271-bd7c-4693-a205-c1e85d6033aa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign09740194aa2a9c77c?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" : "47b18ce7-a898-4ca0-8006-30d0b8dc9af0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd87a-801e-001f-0b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:19 GMT", + "x-ms-client-request-id" : "47b18ce7-a898-4ca0-8006-30d0b8dc9af0" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign09740194aa2a9c77c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[2].json new file mode 100644 index 000000000000..113e22cf85c9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign00295967b081752f7?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" : "2f6461ce-133a-40ab-97c3-789759c0339d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356033EF42A0\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd886-801e-001f-1749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:19 GMT", + "x-ms-client-request-id" : "2f6461ce-133a-40ab-97c3-789759c0339d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&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" : "e84951e5-a9cf-4220-b909-04d75bba176f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd898-801e-001f-2749-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign00295967b081752f7Mon, 09 Sep 2019 19:59:20 GMT\"0x8D7356033EF42A0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:19 GMT", + "x-ms-client-request-id" : "e84951e5-a9cf-4220-b909-04d75bba176f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign00295967b081752f7?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" : "6a00320a-b337-4a83-acd9-dc23c62869b8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd8a4-801e-001f-3049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:19 GMT", + "x-ms-client-request-id" : "6a00320a-b337-4a83-acd9-dc23c62869b8" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign00295967b081752f7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[3].json new file mode 100644 index 000000000000..6cfc2c4f2bbc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[3].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign08408942cde8cda00?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" : "4bfa7daa-d13d-4856-967f-388c5e90ebef" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603417928D\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd8b7-801e-001f-3d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:19 GMT", + "x-ms-client-request-id" : "4bfa7daa-d13d-4856-967f-388c5e90ebef" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&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" : "6d726603-533f-4ecf-bfea-4500e3edcbe5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd8c0-801e-001f-4549-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign08408942cde8cda00Mon, 09 Sep 2019 19:59:20 GMT\"0x8D735603417928D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:19 GMT", + "x-ms-client-request-id" : "6d726603-533f-4ecf-bfea-4500e3edcbe5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign08408942cde8cda00?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" : "8c6d37b8-90b0-4abc-b3fa-0246b1a4563e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd8cf-801e-001f-5249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:19 GMT", + "x-ms-client-request-id" : "8c6d37b8-90b0-4abc-b3fa-0246b1a4563e" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign08408942cde8cda00" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[4].json new file mode 100644 index 000000000000..64e63871c043 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[4].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign0098356ddddfd6c0b?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" : "c96e3169-16d4-40f9-9137-470e61bfcdf0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356034445014\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd8de-801e-001f-6149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:20 GMT", + "x-ms-client-request-id" : "c96e3169-16d4-40f9-9137-470e61bfcdf0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&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" : "5c4b24fe-ca6f-4f94-80c0-66ef01605aef" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd8f1-801e-001f-7349-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign0098356ddddfd6c0bMon, 09 Sep 2019 19:59:20 GMT\"0x8D7356034445014\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:20 GMT", + "x-ms-client-request-id" : "5c4b24fe-ca6f-4f94-80c0-66ef01605aef", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign0098356ddddfd6c0b?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" : "1c2e8ffa-078e-443a-b790-2adb54552b22" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd8ff-801e-001f-8049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:20 GMT", + "x-ms-client-request-id" : "1c2e8ffa-078e-443a-b790-2adb54552b22" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign0098356ddddfd6c0b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[5].json new file mode 100644 index 000000000000..61bc59cad780 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[5].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign079563ba759a83f67?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" : "97069b29-6991-4ac3-9f83-3187d92e61ef" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560346C2AB5\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd912-801e-001f-1349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:20 GMT", + "x-ms-client-request-id" : "97069b29-6991-4ac3-9f83-3187d92e61ef" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&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" : "dbb07c42-4c05-4e1d-a6ea-62a8bb147898" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd927-801e-001f-2449-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign079563ba759a83f67Mon, 09 Sep 2019 19:59:20 GMT\"0x8D73560346C2AB5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:20 GMT", + "x-ms-client-request-id" : "dbb07c42-4c05-4e1d-a6ea-62a8bb147898", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign079563ba759a83f67?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" : "37d7b890-3a1f-443d-8c86-3a84d9d7cf68" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd93b-801e-001f-3749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:20 GMT", + "x-ms-client-request-id" : "37d7b890-3a1f-443d-8c86-3a84d9d7cf68" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign079563ba759a83f67" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[6].json new file mode 100644 index 000000000000..c5259abcc9e7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[6].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign024818c158147d86f?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" : "120248bf-88fa-4274-b881-a1fb7fbf6bf0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356034931ACF\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd95d-801e-001f-5849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:20 GMT", + "x-ms-client-request-id" : "120248bf-88fa-4274-b881-a1fb7fbf6bf0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&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" : "3fb7aa0c-f350-4b23-9600-f6c59eb28084" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd96f-801e-001f-6949-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign024818c158147d86fMon, 09 Sep 2019 19:59:21 GMT\"0x8D7356034931ACF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:20 GMT", + "x-ms-client-request-id" : "3fb7aa0c-f350-4b23-9600-f6c59eb28084", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign024818c158147d86f?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" : "d61187d2-87e0-4e56-b087-05acb169d557" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd97a-801e-001f-7449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:20 GMT", + "x-ms-client-request-id" : "d61187d2-87e0-4e56-b087-05acb169d557" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign024818c158147d86f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[7].json new file mode 100644 index 000000000000..2e65fe07bf49 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[7].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign0770872c33b646e91?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" : "de851199-1544-48c5-86d9-a80c455e79e5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356034BA802D\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd9a8-801e-001f-1e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:20 GMT", + "x-ms-client-request-id" : "de851199-1544-48c5-86d9-a80c455e79e5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&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" : "f3055f16-7dd8-48b1-a010-616bfa41a027" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd9bc-801e-001f-3149-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign0770872c33b646e91Mon, 09 Sep 2019 19:59:21 GMT\"0x8D7356034BA802D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:20 GMT", + "x-ms-client-request-id" : "f3055f16-7dd8-48b1-a010-616bfa41a027", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign0770872c33b646e91?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" : "29cabc2b-4391-4a7a-ba00-9469bd2afe38" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd9cb-801e-001f-4049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:20 GMT", + "x-ms-client-request-id" : "29cabc2b-4391-4a7a-ba00-9469bd2afe38" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign0770872c33b646e91" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[8].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[8].json new file mode 100644 index 000000000000..cea411b48d4b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[8].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign08256499fc3edba1c?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" : "4a17df93-ac96-4d1a-9bd7-e21c0768dc18" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356034E233B9\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd9e0-801e-001f-5449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:21 GMT", + "x-ms-client-request-id" : "4a17df93-ac96-4d1a-9bd7-e21c0768dc18" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&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" : "a1000e83-1f3f-4b1f-993c-12a8626be41a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd9f1-801e-001f-6449-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign08256499fc3edba1cMon, 09 Sep 2019 19:59:21 GMT\"0x8D7356034E233B9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:21 GMT", + "x-ms-client-request-id" : "a1000e83-1f3f-4b1f-993c-12a8626be41a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign08256499fc3edba1c?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" : "293d431f-690f-4397-97f3-a9d99c239933" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd9fb-801e-001f-6c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:21 GMT", + "x-ms-client-request-id" : "293d431f-690f-4397-97f3-a9d99c239933" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign08256499fc3edba1c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[9].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[9].json new file mode 100644 index 000000000000..01f71cab8f7f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosign[9].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign0338292e15b10ddfa?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" : "4984b0d2-64e5-44f3-8a01-b89e9c847324" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603508AE87\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fda1a-801e-001f-0949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:21 GMT", + "x-ms-client-request-id" : "4984b0d2-64e5-44f3-8a01-b89e9c847324" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&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" : "11e9e325-4d03-4b31-9c29-d949f820906b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fda32-801e-001f-2049-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign0338292e15b10ddfaMon, 09 Sep 2019 19:59:21 GMT\"0x8D735603508AE87\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:21 GMT", + "x-ms-client-request-id" : "11e9e325-4d03-4b31-9c29-d949f820906b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign0338292e15b10ddfa?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" : "68a72dcd-a7e4-4e90-9fbc-9ceec8c61b0a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fda42-801e-001f-3049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:21 GMT", + "x-ms-client-request-id" : "68a72dcd-a7e4-4e90-9fbc-9ceec8c61b0a" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign0338292e15b10ddfa" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[0].json new file mode 100644 index 000000000000..6edf5f7e6aa1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey04763816?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" : "2d189e56-6bd8-42c4-ba85-239360f378ef" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560357C1EC8\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fdaa7-801e-001f-0f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:22 GMT", + "x-ms-client-request-id" : "2d189e56-6bd8-42c4-ba85-239360f378ef" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "486b9c04-84fa-4fc0-879c-b308646ff6df" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fdab6-801e-001f-1d49-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey04763816Mon, 09 Sep 2019 19:59:22 GMT\"0x8D73560357C1EC8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:22 GMT", + "x-ms-client-request-id" : "486b9c04-84fa-4fc0-879c-b308646ff6df", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey04763816?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" : "bbe8e1b4-98ff-4665-a55b-2afbdd919846" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fdabe-801e-001f-2549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:22 GMT", + "x-ms-client-request-id" : "bbe8e1b4-98ff-4665-a55b-2afbdd919846" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey04763816" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[10].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[10].json new file mode 100644 index 000000000000..fe67831a2eeb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[10].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0168364c?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" : "f1e6b043-afa0-4408-a6c4-6f88f5c7f3fa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603705ED53\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fdc8b-801e-001f-4c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:24 GMT", + "x-ms-client-request-id" : "f1e6b043-afa0-4408-a6c4-6f88f5c7f3fa" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "cc4ca716-97ac-46ac-b086-98db4e38de70" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fdc9b-801e-001f-5a49-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0168364cMon, 09 Sep 2019 19:59:25 GMT\"0x8D735603705ED53\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:24 GMT", + "x-ms-client-request-id" : "cc4ca716-97ac-46ac-b086-98db4e38de70", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0168364c?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" : "4d69a274-2952-41ae-b527-d794cb536fa6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fdca8-801e-001f-6749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:24 GMT", + "x-ms-client-request-id" : "4d69a274-2952-41ae-b527-d794cb536fa6" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0168364c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[11].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[11].json new file mode 100644 index 000000000000..d95b87d065c9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[11].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey080669d3?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" : "d4db46b0-5f72-436a-bbd1-2ad112d780df" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560372BF2DE\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fdcb4-801e-001f-7249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:24 GMT", + "x-ms-client-request-id" : "d4db46b0-5f72-436a-bbd1-2ad112d780df" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "614f7ef6-707e-4051-9521-4f332134f243" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fdcbe-801e-001f-7a49-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey080669d3Mon, 09 Sep 2019 19:59:25 GMT\"0x8D73560372BF2DE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:24 GMT", + "x-ms-client-request-id" : "614f7ef6-707e-4051-9521-4f332134f243", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey080669d3?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" : "52ee9d52-2210-4c19-af76-db5419595887" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fdcc5-801e-001f-0149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:25 GMT", + "x-ms-client-request-id" : "52ee9d52-2210-4c19-af76-db5419595887" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey080669d3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[12].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[12].json new file mode 100644 index 000000000000..cb83a4021a29 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[12].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey054231db?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" : "5e3aedde-25e0-42d0-872d-cb33858adfc1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603752E2F4\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fdcdd-801e-001f-1749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:25 GMT", + "x-ms-client-request-id" : "5e3aedde-25e0-42d0-872d-cb33858adfc1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "780f74ac-f7e2-41d8-8f9a-3c74fd3d197c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fdcf3-801e-001f-2a49-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey054231dbMon, 09 Sep 2019 19:59:25 GMT\"0x8D735603752E2F4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:25 GMT", + "x-ms-client-request-id" : "780f74ac-f7e2-41d8-8f9a-3c74fd3d197c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey054231db?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" : "4a5905e0-547c-4449-b110-f6ce6b194ae2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fdd00-801e-001f-3549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:25 GMT", + "x-ms-client-request-id" : "4a5905e0-547c-4449-b110-f6ce6b194ae2" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey054231db" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[13].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[13].json new file mode 100644 index 000000000000..b5716cf53d72 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[13].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey05189449?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" : "08fdbb9f-97b9-439b-ad65-a6b8c2047f41" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356037789A46\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fdd13-801e-001f-4549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:25 GMT", + "x-ms-client-request-id" : "08fdbb9f-97b9-439b-ad65-a6b8c2047f41" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "6ea0a679-0cdc-47fe-813a-5743d32fa2d4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fdd2d-801e-001f-5d49-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey05189449Mon, 09 Sep 2019 19:59:25 GMT\"0x8D7356037789A46\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:25 GMT", + "x-ms-client-request-id" : "6ea0a679-0cdc-47fe-813a-5743d32fa2d4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey05189449?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" : "57b8dc3e-2562-42b4-9adc-d86765536768" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fdd35-801e-001f-6349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:25 GMT", + "x-ms-client-request-id" : "57b8dc3e-2562-42b4-9adc-d86765536768" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey05189449" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[14].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[14].json new file mode 100644 index 000000000000..a17ecf26bfed --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[14].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey02893593?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" : "27440f63-2280-46f3-8cbe-2b88771fe820" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356037A026AC\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fdd4a-801e-001f-7849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:25 GMT", + "x-ms-client-request-id" : "27440f63-2280-46f3-8cbe-2b88771fe820" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "23755dc3-7e5b-4cd7-aeb0-825b57f98617" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fdd54-801e-001f-0149-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey02893593Mon, 09 Sep 2019 19:59:26 GMT\"0x8D7356037A026AC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:25 GMT", + "x-ms-client-request-id" : "23755dc3-7e5b-4cd7-aeb0-825b57f98617", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey02893593?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" : "0f8ca44d-b952-4b06-a1d8-ceae47b46d02" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fdd65-801e-001f-1149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:25 GMT", + "x-ms-client-request-id" : "0f8ca44d-b952-4b06-a1d8-ceae47b46d02" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey02893593" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[15].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[15].json new file mode 100644 index 000000000000..6ec8bee3fc82 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[15].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0989243e?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" : "9ddafee4-c8e9-4ac6-9a53-8267acb0912c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356037C6C87E\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fdd76-801e-001f-2149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:25 GMT", + "x-ms-client-request-id" : "9ddafee4-c8e9-4ac6-9a53-8267acb0912c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "d268b89c-727b-4e90-8367-3fde68485050" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fdd82-801e-001f-2c49-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0989243eMon, 09 Sep 2019 19:59:26 GMT\"0x8D7356037C6C87E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:25 GMT", + "x-ms-client-request-id" : "d268b89c-727b-4e90-8367-3fde68485050", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0989243e?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" : "8ab2d4f7-2234-4d93-9fdb-4cdf01c65b23" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fdd8d-801e-001f-3549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:26 GMT", + "x-ms-client-request-id" : "8ab2d4f7-2234-4d93-9fdb-4cdf01c65b23" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0989243e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[16].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[16].json new file mode 100644 index 000000000000..694e3a209ec7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[16].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey02476408?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" : "257fdbe8-468f-4c34-90d3-c7b40f93f749" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356037ED4344\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fdd98-801e-001f-4049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:26 GMT", + "x-ms-client-request-id" : "257fdbe8-468f-4c34-90d3-c7b40f93f749" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "64f4d24c-3edd-4607-ad93-8abd2d306372" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fdda8-801e-001f-4f49-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey02476408Mon, 09 Sep 2019 19:59:26 GMT\"0x8D7356037ED4344\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:26 GMT", + "x-ms-client-request-id" : "64f4d24c-3edd-4607-ad93-8abd2d306372", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey02476408?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" : "f23b01be-add7-4b3e-a4ce-7a7cb22426c0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fddb6-801e-001f-5d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:26 GMT", + "x-ms-client-request-id" : "f23b01be-add7-4b3e-a4ce-7a7cb22426c0" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey02476408" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[1].json new file mode 100644 index 000000000000..fe39ead2b0d3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey09839071?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" : "2f112826-65e1-49db-8f02-fb355b6a6eac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356035A44794\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fdaca-801e-001f-3149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:22 GMT", + "x-ms-client-request-id" : "2f112826-65e1-49db-8f02-fb355b6a6eac" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "20f034eb-0e1c-4325-8f57-f0b150961df7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fdad8-801e-001f-3c49-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey09839071Mon, 09 Sep 2019 19:59:22 GMT\"0x8D7356035A44794\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:22 GMT", + "x-ms-client-request-id" : "20f034eb-0e1c-4325-8f57-f0b150961df7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey09839071?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" : "1871cc53-04a3-408a-9f67-2e5c85527aab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fdaeb-801e-001f-4b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:22 GMT", + "x-ms-client-request-id" : "1871cc53-04a3-408a-9f67-2e5c85527aab" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey09839071" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[2].json new file mode 100644 index 000000000000..125c5ef23a76 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey02001573?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" : "c757f02d-056c-490a-a594-67d61a273320" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356035CCE5AB\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fdafb-801e-001f-5a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:22 GMT", + "x-ms-client-request-id" : "c757f02d-056c-490a-a594-67d61a273320" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "90c3b933-c262-4fcd-a48e-a408f8567112" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fdb0f-801e-001f-6c49-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey02001573Mon, 09 Sep 2019 19:59:23 GMT\"0x8D7356035CCE5AB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:22 GMT", + "x-ms-client-request-id" : "90c3b933-c262-4fcd-a48e-a408f8567112", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey02001573?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" : "4449493d-c336-48e1-a9c0-9bccb56a1532" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fdb23-801e-001f-7e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:22 GMT", + "x-ms-client-request-id" : "4449493d-c336-48e1-a9c0-9bccb56a1532" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey02001573" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[3].json new file mode 100644 index 000000000000..e10bfd452621 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[3].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey045821d0?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" : "71328467-4bed-483a-a5f2-c059a9d9e878" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356035F29D07\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fdb38-801e-001f-1149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:22 GMT", + "x-ms-client-request-id" : "71328467-4bed-483a-a5f2-c059a9d9e878" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "87d27e25-b69d-422d-890c-57c4686c6201" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fdb43-801e-001f-1b49-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey045821d0Mon, 09 Sep 2019 19:59:23 GMT\"0x8D7356035F29D07\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:22 GMT", + "x-ms-client-request-id" : "87d27e25-b69d-422d-890c-57c4686c6201", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey045821d0?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" : "99065b6e-0f5d-444e-8983-6aca5ad362aa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fdb5d-801e-001f-3349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:23 GMT", + "x-ms-client-request-id" : "99065b6e-0f5d-444e-8983-6aca5ad362aa" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey045821d0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[4].json new file mode 100644 index 000000000000..597e6b4eb965 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[4].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0947990c?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" : "9290e249-ff1f-4a37-99fd-ee7a683be5ec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560361A5093\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fdb6d-801e-001f-4149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:23 GMT", + "x-ms-client-request-id" : "9290e249-ff1f-4a37-99fd-ee7a683be5ec" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "e3aee29e-9ddb-4b2f-848a-bdfd13681c96" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fdb80-801e-001f-5349-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0947990cMon, 09 Sep 2019 19:59:23 GMT\"0x8D73560361A5093\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:23 GMT", + "x-ms-client-request-id" : "e3aee29e-9ddb-4b2f-848a-bdfd13681c96", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0947990c?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" : "b29fd5e5-6eb7-484a-b7d5-c7e2ba136a12" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fdb94-801e-001f-6549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:23 GMT", + "x-ms-client-request-id" : "b29fd5e5-6eb7-484a-b7d5-c7e2ba136a12" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0947990c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[5].json new file mode 100644 index 000000000000..45c07d1f78f0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[5].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0613973c?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" : "679952b2-2af8-4de3-bb91-51fb4c3b2fb3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603640561E\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fdba5-801e-001f-7649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:23 GMT", + "x-ms-client-request-id" : "679952b2-2af8-4de3-bb91-51fb4c3b2fb3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "d4b468a9-2337-4bb4-b41c-3decc623b28a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fdbbc-801e-001f-0949-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0613973cMon, 09 Sep 2019 19:59:23 GMT\"0x8D735603640561E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:23 GMT", + "x-ms-client-request-id" : "d4b468a9-2337-4bb4-b41c-3decc623b28a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0613973c?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" : "66af9ada-37be-41bd-b3b9-550fc59a7efd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fdbc8-801e-001f-1549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:23 GMT", + "x-ms-client-request-id" : "66af9ada-37be-41bd-b3b9-550fc59a7efd" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0613973c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[6].json new file mode 100644 index 000000000000..8d28c1ce2436 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[6].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey017579c5?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" : "7652e435-05f9-49c0-b320-472a0627ab79" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603667BB80\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fdbd4-801e-001f-2149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:23 GMT", + "x-ms-client-request-id" : "7652e435-05f9-49c0-b320-472a0627ab79" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "d157dbfa-0bf7-4d44-9b88-5ffc35c811c3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fdbe5-801e-001f-3049-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey017579c5Mon, 09 Sep 2019 19:59:24 GMT\"0x8D735603667BB80\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:23 GMT", + "x-ms-client-request-id" : "d157dbfa-0bf7-4d44-9b88-5ffc35c811c3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey017579c5?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" : "dd7a4e36-b7c4-4ebd-976e-2939b4947736" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fdbf4-801e-001f-3f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:23 GMT", + "x-ms-client-request-id" : "dd7a4e36-b7c4-4ebd-976e-2939b4947736" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey017579c5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[7].json new file mode 100644 index 000000000000..695e3c9520c4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[7].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0887146d?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" : "8ea45101-218d-4fda-83d4-2bdf70c91854" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560368EAB96\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fdc00-801e-001f-4b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:23 GMT", + "x-ms-client-request-id" : "8ea45101-218d-4fda-83d4-2bdf70c91854" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "ae808e8f-a7f0-465e-835d-2a4602392e7b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fdc14-801e-001f-5c49-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0887146dMon, 09 Sep 2019 19:59:24 GMT\"0x8D73560368EAB96\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:23 GMT", + "x-ms-client-request-id" : "ae808e8f-a7f0-465e-835d-2a4602392e7b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0887146d?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" : "18543124-6b03-4207-8c5d-eb2e5032939e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fdc23-801e-001f-6b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:24 GMT", + "x-ms-client-request-id" : "18543124-6b03-4207-8c5d-eb2e5032939e" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0887146d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[8].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[8].json new file mode 100644 index 000000000000..5e984a27a94c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[8].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey07966657?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" : "7edb7f69-0121-4fe8-8dfd-eae939b0b6db" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356036B797DB\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fdc2e-801e-001f-7649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:24 GMT", + "x-ms-client-request-id" : "7edb7f69-0121-4fe8-8dfd-eae939b0b6db" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "89f7f0bc-7071-458d-b797-d772fd62a158" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fdc3a-801e-001f-0149-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey07966657Mon, 09 Sep 2019 19:59:24 GMT\"0x8D7356036B797DB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:24 GMT", + "x-ms-client-request-id" : "89f7f0bc-7071-458d-b797-d772fd62a158", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey07966657?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" : "7df8a712-8773-4b3b-beb9-4d0b07421151" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fdc44-801e-001f-0a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:24 GMT", + "x-ms-client-request-id" : "7df8a712-8773-4b3b-beb9-4d0b07421151" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey07966657" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[9].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[9].json new file mode 100644 index 000000000000..c122ac5892ea --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturesstringtosignuserdelegationkey[9].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey08440128?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" : "60c8c5ce-a216-4f50-a0d2-0653c84a6b71" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356036DF2453\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fdc5b-801e-001f-1e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:24 GMT", + "x-ms-client-request-id" : "60c8c5ce-a216-4f50-a0d2-0653c84a6b71" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "365106f2-0e99-40a5-bae3-2c389b45af2d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fdc66-801e-001f-2849-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey08440128Mon, 09 Sep 2019 19:59:24 GMT\"0x8D7356036DF2453\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:24 GMT", + "x-ms-client-request-id" : "365106f2-0e99-40a5-bae3-2c389b45af2d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey08440128?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" : "c2d9b121-9441-45c7-b494-93cfba975d8f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fdc75-801e-001f-3649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:24 GMT", + "x-ms-client-request-id" : "c2d9b121-9441-45c7-b494-93cfba975d8f" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey08440128" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluescanonicalizedresource[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluescanonicalizedresource[0].json new file mode 100644 index 000000000000..8b29e24971c1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluescanonicalizedresource[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluescanonicalizedresource070028e08c?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" : "0607a415-f571-43f8-be79-59b304c3bf28" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356038139700\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fddc6-801e-001f-6b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:26 GMT", + "x-ms-client-request-id" : "0607a415-f571-43f8-be79-59b304c3bf28" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturevaluescanonicalizedresource&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" : "4972d7af-5025-4fe4-be4a-c3264d7b0e8c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fddd7-801e-001f-7649-673bbb000000", + "Body" : "jtcservicesassignaturevaluescanonicalizedresourcejtcservicesassignaturevaluescanonicalizedresource070028e08cMon, 09 Sep 2019 19:59:27 GMT\"0x8D7356038139700\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:26 GMT", + "x-ms-client-request-id" : "4972d7af-5025-4fe4-be4a-c3264d7b0e8c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluescanonicalizedresource070028e08c?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" : "7e20cd5b-0514-4f63-9d64-3753e453eb8d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fdde4-801e-001f-0149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:26 GMT", + "x-ms-client-request-id" : "7e20cd5b-0514-4f63-9d64-3753e453eb8d" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluescanonicalizedresource070028e08c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluescanonicalizedresource[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluescanonicalizedresource[1].json new file mode 100644 index 000000000000..c7dc27cde707 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluescanonicalizedresource[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluescanonicalizedresource081720c88f?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" : "f1a93f28-ccdd-408f-94ad-5c95f3550c8d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560383CAA5F\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fddf0-801e-001f-0d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:26 GMT", + "x-ms-client-request-id" : "f1a93f28-ccdd-408f-94ad-5c95f3550c8d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturevaluescanonicalizedresource&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" : "b519baa9-7180-4e7f-bf73-c5e27aadefbe" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fde05-801e-001f-1e49-673bbb000000", + "Body" : "jtcservicesassignaturevaluescanonicalizedresourcejtcservicesassignaturevaluescanonicalizedresource081720c88fMon, 09 Sep 2019 19:59:27 GMT\"0x8D73560383CAA5F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:26 GMT", + "x-ms-client-request-id" : "b519baa9-7180-4e7f-bf73-c5e27aadefbe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluescanonicalizedresource081720c88f?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" : "cd42c829-fc43-44dd-8d02-931a2c5f582e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fde10-801e-001f-2749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:26 GMT", + "x-ms-client-request-id" : "cd42c829-fc43-44dd-8d02-931a2c5f582e" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluescanonicalizedresource081720c88f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluescanonicalizedresource[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluescanonicalizedresource[2].json new file mode 100644 index 000000000000..5bf06b9ad13f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluescanonicalizedresource[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluescanonicalizedresource029520403f?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" : "aee8d16e-f25a-4714-811f-79de38226f82" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603863E8A4\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fde22-801e-001f-3949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:27 GMT", + "x-ms-client-request-id" : "aee8d16e-f25a-4714-811f-79de38226f82" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturevaluescanonicalizedresource&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" : "cff23141-614c-4ec3-834b-370e71279d85" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fde47-801e-001f-5c49-673bbb000000", + "Body" : "jtcservicesassignaturevaluescanonicalizedresourcejtcservicesassignaturevaluescanonicalizedresource029520403fMon, 09 Sep 2019 19:59:27 GMT\"0x8D735603863E8A4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:27 GMT", + "x-ms-client-request-id" : "cff23141-614c-4ec3-834b-370e71279d85", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluescanonicalizedresource029520403f?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" : "a2d0404a-4c8b-4eec-861c-764bd97fe598" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fde57-801e-001f-6a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:27 GMT", + "x-ms-client-request-id" : "a2d0404a-4c8b-4eec-861c-764bd97fe598" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluescanonicalizedresource029520403f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluesia[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluesia[0].json new file mode 100644 index 000000000000..7837c198546f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluesia[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesia03109661300efea6884?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" : "0cb962d9-7f75-4e76-a6b9-2fcb629f3d47" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603893B3FA\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fde66-801e-001f-7949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:27 GMT", + "x-ms-client-request-id" : "0cb962d9-7f75-4e76-a6b9-2fcb629f3d47" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturevaluesia&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" : "b47ff20d-99ab-4274-8c31-a9ce4109e6c6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fde76-801e-001f-0849-673bbb000000", + "Body" : "jtcservicesassignaturevaluesiajtcservicesassignaturevaluesia03109661300efea6884Mon, 09 Sep 2019 19:59:27 GMT\"0x8D735603893B3FA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:27 GMT", + "x-ms-client-request-id" : "b47ff20d-99ab-4274-8c31-a9ce4109e6c6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesia03109661300efea6884?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" : "37a2981b-50c5-44b6-8b48-79941a852457" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fde92-801e-001f-2449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:27 GMT", + "x-ms-client-request-id" : "37a2981b-50c5-44b6-8b48-79941a852457" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesia03109661300efea6884" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluesia[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluesia[1].json new file mode 100644 index 000000000000..03bfe2dbffdc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluesia[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesia0235092030a6e0bbcf4?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" : "d9320b0e-62c1-41c8-88b1-21030434cdb9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356038BAA414\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fdea5-801e-001f-3449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:27 GMT", + "x-ms-client-request-id" : "d9320b0e-62c1-41c8-88b1-21030434cdb9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturevaluesia&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" : "90b6955f-2795-4bd5-b267-21fc4cdbf751" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fdeb2-801e-001f-4049-673bbb000000", + "Body" : "jtcservicesassignaturevaluesiajtcservicesassignaturevaluesia0235092030a6e0bbcf4Mon, 09 Sep 2019 19:59:28 GMT\"0x8D7356038BAA414\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:27 GMT", + "x-ms-client-request-id" : "90b6955f-2795-4bd5-b267-21fc4cdbf751", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesia0235092030a6e0bbcf4?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" : "1e29fc27-e3ee-4e29-8512-13fd932fcb39" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fdec5-801e-001f-5249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:27 GMT", + "x-ms-client-request-id" : "1e29fc27-e3ee-4e29-8512-13fd932fcb39" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesia0235092030a6e0bbcf4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluesia[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluesia[2].json new file mode 100644 index 000000000000..06e20a032cf0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluesia[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesia018059fca1d7db05754?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" : "0c3677a2-9cd4-43de-95e0-6d60bc4a0cfd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356038E1942F\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fdee1-801e-001f-6a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:27 GMT", + "x-ms-client-request-id" : "0c3677a2-9cd4-43de-95e0-6d60bc4a0cfd" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturevaluesia&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" : "03a4c936-e5f0-4b64-91d1-00785a38a99c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fdef5-801e-001f-7a49-673bbb000000", + "Body" : "jtcservicesassignaturevaluesiajtcservicesassignaturevaluesia018059fca1d7db05754Mon, 09 Sep 2019 19:59:28 GMT\"0x8D7356038E1942F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:27 GMT", + "x-ms-client-request-id" : "03a4c936-e5f0-4b64-91d1-00785a38a99c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesia018059fca1d7db05754?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" : "c7a64739-a348-49f1-a427-d8679a4e894a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fdf09-801e-001f-0e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:27 GMT", + "x-ms-client-request-id" : "c7a64739-a348-49f1-a427-d8679a4e894a" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesia018059fca1d7db05754" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluesnetworktestblobsnapshot.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluesnetworktestblobsnapshot.json new file mode 100644 index 000000000000..fbb8a8d0c37e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTestservicesassignaturevaluesnetworktestblobsnapshot.json @@ -0,0 +1,231 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot00973756c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BDA340E9\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02192-501e-00c0-02fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "5e51d577-eff0-41da-b54a-9bffdcbbd4fb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot10201430a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BDA87242\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d021c2-501e-00c0-2afc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "6a210b3c-f7ce-4eb8-bdc5-cf2378ac1c7a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot10201430a/javablobservicesassignaturevaluesnetworktestblobsnapshot284499", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "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" : "Fri, 23 Aug 2019 21:49:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D72813BDADEEA4\"", + "Content-Length" : "0", + "x-ms-request-id" : "77d021e6-501e-00c0-4bfc-59ba32000000", + "x-ms-client-request-id" : "2096360f-4e39-4cc2-90d2-a42d0345eb51" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot10201430a/javablobservicesassignaturevaluesnetworktestblobsnapshot284499?comp=snapshot", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-23T21:49:14.8327160Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72813BDADEEA4\"", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "77d02209-501e-00c0-67fc-59ba32000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "62906b46-f061-4c3c-9f27-ed2e04a60621" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot10201430a/javablobservicesassignaturevaluesnetworktestblobsnapshot284499?sv=2018-11-09&spr=https&st=2019-08-23T21%3A49%3A14Z&se=2019-08-24T21%3A49%3A14Z&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_212; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "447", + "StatusCode" : "403", + "x-ms-request-id" : "77d0225c-501e-00c0-30fc-59ba32000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:77d0225c-501e-00c0-30fc-59ba32000000\nTime:2019-08-23T21:49:14.9008614ZThe specified signed resource is not allowed for the this resource level", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot10201430a/javablobservicesassignaturevaluesnetworktestblobsnapshot284499?snapshot=2019-08-23T21%3a49%3a14.8327160Z&sv=2018-11-09&spr=https&st=2019-08-23T21%3A49%3A14Z&se=2019-08-24T21%3A49%3A14Z&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_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:14 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-snapshot" : "2019-08-23T21:49:14.8327160Z", + "Cache-Control" : "cache", + "ETag" : "\"0x8D72813BDADEEA4\"", + "Content-Disposition" : "disposition", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:14 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "77d0227f-501e-00c0-4ffc-59ba32000000", + "Body" : "default", + "x-ms-client-request-id" : "cf6fe629-66bd-4e67-98e6-ced1fe21be74", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot10201430a/javablobservicesassignaturevaluesnetworktestblobsnapshot284499?snapshot=2019-08-23T21%3a49%3a14.8327160Z&sv=2018-11-09&spr=https&st=2019-08-23T21%3A49%3A14Z&se=2019-08-24T21%3A49%3A14Z&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_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "Last-Modified" : "Fri, 23 Aug 2019 21:49:14 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Fri, 23 Aug 2019 21:49:14 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-08-23T21:49:14.8327160Z", + "x-ms-access-tier" : "Hot", + "Cache-Control" : "cache", + "ETag" : "\"0x8D72813BDADEEA4\"", + "Content-Disposition" : "disposition", + "Content-Encoding" : "encoding", + "x-ms-creation-time" : "Fri, 23 Aug 2019 21:49:14 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "77d022a3-501e-00c0-6dfc-59ba32000000", + "x-ms-client-request-id" : "1d9774f4-2389-459b-8c32-4e83a862a44f", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "GET", + "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_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "77d022bd-501e-00c0-06fc-59ba32000000", + "Body" : "jtcservicesassignaturevaluesnetworktestblobsnapshotjtcservicesassignaturevaluesnetworktestblobsnapshot00973756cFri, 23 Aug 2019 21:49:14 GMT\"0x8D72813BDA340E9\"unlockedavailable$account-encryption-keyfalsefalsefalsejtcservicesassignaturevaluesnetworktestblobsnapshot10201430aFri, 23 Aug 2019 21:49:14 GMT\"0x8D72813BDA87242\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "5ccd2de2-4002-4e32-927d-18a071dbf888", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot00973756c?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77d022d7-501e-00c0-1dfc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "53ff19ca-1f97-4abb-909a-9b69ac3a86ef" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot10201430a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "77d022f4-501e-00c0-38fc-59ba32000000", + "Date" : "Fri, 23 Aug 2019 21:49:14 GMT", + "x-ms-client-request-id" : "b81035d1-1c1b-4050-ac65-a80512071c07" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesnetworktestblobsnapshot00973756c", "jtcservicesassignaturevaluesnetworktestblobsnapshot10201430a", "javablobservicesassignaturevaluesnetworktestblobsnapshot284499", "2019-08-23T21:49:14.890Z", "2019-08-23T21:49:14.890Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTesturlparser.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTesturlparser.json new file mode 100644 index 000000000000..fe171b3dcdf4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/HelperTesturlparser.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcurlparser0helpertesturlparserf9e6226148d95712e8a?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" : "fd6a8326-c663-4e05-85d1-fc717b998a7e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356044CF10C3\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fedaf-801e-001f-4049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:47 GMT", + "x-ms-client-request-id" : "fd6a8326-c663-4e05-85d1-fc717b998a7e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcurlparser&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" : "235148e8-ed44-4997-9e70-e20caff369dc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fedc1-801e-001f-4d49-673bbb000000", + "Body" : "jtcurlparserjtcurlparser0helpertesturlparserf9e6226148d95712e8aMon, 09 Sep 2019 19:59:48 GMT\"0x8D7356044CF10C3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:47 GMT", + "x-ms-client-request-id" : "235148e8-ed44-4997-9e70-e20caff369dc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcurlparser0helpertesturlparserf9e6226148d95712e8a?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" : "d20dc48d-13be-4e87-8071-ac88d4e6f1ba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fedcd-801e-001f-5949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:47 GMT", + "x-ms-client-request-id" : "d20dc48d-13be-4e87-8071-ac88d4e6f1ba" + }, + "Exception" : null + } ], + "variables" : [ "jtcurlparser0helpertesturlparserf9e6226148d95712e8a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpage.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpage.json new file mode 100644 index 000000000000..b76c2bb4ff7e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpage.json @@ -0,0 +1,158 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpage0pageblobapitestclearpage1d904476b8a9d1feb?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" : "d66332aa-b97c-4790-8953-8798a0d8c8ec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618F9BE1E3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd22ff-501e-003f-3d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:03 GMT", + "x-ms-client-request-id" : "d66332aa-b97c-4790-8953-8798a0d8c8ec" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpage0pageblobapitestclearpage1d904476b8a9d1feb/javablobclearpage1pageblobapitestclearpage1d980145a1996c", + "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" : "cd9af543-1def-4d16-90bc-1a69d958dfcf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618FA9D068\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd231d-501e-003f-574a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:03 GMT", + "x-ms-client-request-id" : "cd9af543-1def-4d16-90bc-1a69d958dfcf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpage0pageblobapitestclearpage1d904476b8a9d1feb/javablobclearpage1pageblobapitestclearpage1d980145a1996c?comp=page", + "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" : "e9206dce-e96a-4088-aaf7-ed679e1ac0ad", + "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" : "Em0AIv39pcw=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:03 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:03 GMT", + "ETag" : "\"0x8D735618FB6CB19\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd2336-501e-003f-6e4a-675777000000", + "x-ms-client-request-id" : "e9206dce-e96a-4088-aaf7-ed679e1ac0ad" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpage0pageblobapitestclearpage1d904476b8a9d1feb/javablobclearpage1pageblobapitestclearpage1d980145a1996c?comp=page", + "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" : "3af9a257-b02f-456f-8627-32f8b12ab72e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618FC8819F\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd234d-501e-003f-054a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:03 GMT", + "x-ms-client-request-id" : "3af9a257-b02f-456f-8627-32f8b12ab72e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpage0pageblobapitestclearpage1d904476b8a9d1feb/javablobclearpage1pageblobapitestclearpage1d980145a1996c?comp=pagelist", + "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" : "b9053287-f7c6-4aee-942f-b54168169f2c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:03 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:03 GMT", + "ETag" : "\"0x8D735618FC8819F\"", + "x-ms-request-id" : "9ebd235d-501e-003f-154a-675777000000", + "Body" : "", + "x-ms-client-request-id" : "b9053287-f7c6-4aee-942f-b54168169f2c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcclearpage&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" : "8a4d69c5-d03e-49a9-a81c-661aed411d42" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd2378-501e-003f-2e4a-675777000000", + "Body" : "jtcclearpagejtcclearpage0pageblobapitestclearpage1d904476b8a9d1febMon, 09 Sep 2019 20:09:03 GMT\"0x8D735618F9BE1E3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:03 GMT", + "x-ms-client-request-id" : "8a4d69c5-d03e-49a9-a81c-661aed411d42", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpage0pageblobapitestclearpage1d904476b8a9d1feb?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" : "abdbefdc-6dc5-4637-8a74-8481cc4e5e73" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd2393-501e-003f-494a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:03 GMT", + "x-ms-client-request-id" : "abdbefdc-6dc5-4637-8a74-8481cc4e5e73" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpage0pageblobapitestclearpage1d904476b8a9d1feb", "javablobclearpage1pageblobapitestclearpage1d980145a1996c", "76cee01b-42e3-4cf2-81e1-f7a3d5e07996" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpageerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpageerror.json new file mode 100644 index 000000000000..b31b4a7ded0e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpageerror.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpageerror0pageblobapitestclearpageerror22e87140ca36?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" : "5dc8df4c-b8df-4d20-a94f-b61411ec92e1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356195C38C37\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2d16-501e-003f-734a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:13 GMT", + "x-ms-client-request-id" : "5dc8df4c-b8df-4d20-a94f-b61411ec92e1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpageerror0pageblobapitestclearpageerror22e87140ca36/javablobclearpageerror1pageblobapitestclearpageerror22e121242", + "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" : "3edd3010-a120-4c80-bc75-b466d369581e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356195D0E2E1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2d24-501e-003f-7e4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:13 GMT", + "x-ms-client-request-id" : "3edd3010-a120-4c80-bc75-b466d369581e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpageerror0pageblobapitestclearpageerror22e87140ca36/javablobclearpageerror2pageblobapitestclearpageerror22e96813f?comp=page", + "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" : "45f05efb-e2c5-4942-ada8-46b703289538" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "BlobNotFound", + "retry-after" : "0", + "Content-Length" : "215", + "StatusCode" : "404", + "x-ms-request-id" : "9ebd2d33-501e-003f-0c4a-675777000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:9ebd2d33-501e-003f-0c4a-675777000000\nTime:2019-09-09T20:09:13.8636171Z", + "Date" : "Mon, 09 Sep 2019 20:09:13 GMT", + "x-ms-client-request-id" : "45f05efb-e2c5-4942-ada8-46b703289538", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcclearpageerror&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" : "504c5c82-6868-4b04-937b-4a47cc57c39e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd2d43-501e-003f-184a-675777000000", + "Body" : "jtcclearpageerrorjtcclearpageerror0pageblobapitestclearpageerror22e87140ca36Mon, 09 Sep 2019 20:09:13 GMT\"0x8D7356195C38C37\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:13 GMT", + "x-ms-client-request-id" : "504c5c82-6868-4b04-937b-4a47cc57c39e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpageerror0pageblobapitestclearpageerror22e87140ca36?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" : "bd908919-dba3-4033-8718-edb83da0c5ae" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd2d49-501e-003f-1e4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:13 GMT", + "x-ms-client-request-id" : "bd908919-dba3-4033-8718-edb83da0c5ae" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpageerror0pageblobapitestclearpageerror22e87140ca36", "javablobclearpageerror1pageblobapitestclearpageerror22e121242", "javablobclearpageerror2pageblobapitestclearpageerror22e96813f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagemin.json new file mode 100644 index 000000000000..1afc54f1e6df --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagemin.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagemin0pageblobapitestclearpagemin81125448b33efa?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" : "35238764-5fdf-4dd6-9119-03acd8cdd7e7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619004EFD9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd23ab-501e-003f-614a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:03 GMT", + "x-ms-client-request-id" : "35238764-5fdf-4dd6-9119-03acd8cdd7e7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagemin0pageblobapitestclearpagemin81125448b33efa/javablobclearpagemin1pageblobapitestclearpagemin81165735f21", + "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" : "8424102d-4c8f-4554-976a-c9bc834639c9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356190132CE6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd23c7-501e-003f-794a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:03 GMT", + "x-ms-client-request-id" : "8424102d-4c8f-4554-976a-c9bc834639c9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagemin0pageblobapitestclearpagemin81125448b33efa/javablobclearpagemin1pageblobapitestclearpagemin81165735f21?comp=page", + "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" : "65651e72-7dbf-4ad6-814e-f1efc7364b94" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356190200081\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd23e1-501e-003f-0f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:03 GMT", + "x-ms-client-request-id" : "65651e72-7dbf-4ad6-814e-f1efc7364b94" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcclearpagemin&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" : "b14eaf2f-389b-4b9e-83f3-753bbe0199be" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd2407-501e-003f-324a-675777000000", + "Body" : "jtcclearpageminjtcclearpagemin0pageblobapitestclearpagemin81125448b33efaMon, 09 Sep 2019 20:09:04 GMT\"0x8D735619004EFD9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:03 GMT", + "x-ms-client-request-id" : "b14eaf2f-389b-4b9e-83f3-753bbe0199be", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagemin0pageblobapitestclearpagemin81125448b33efa?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" : "977d9530-6747-429b-a44f-59c0ac734de5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd2426-501e-003f-504a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:04 GMT", + "x-ms-client-request-id" : "977d9530-6747-429b-a44f-59c0ac734de5" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagemin0pageblobapitestclearpagemin81125448b33efa", "javablobclearpagemin1pageblobapitestclearpagemin81165735f21" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[0].json new file mode 100644 index 000000000000..b458bfd546f8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[0].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf9e84280608dc2?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" : "9e439cb1-9dc6-4964-b87d-737ab0e64271" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561904B062D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2444-501e-003f-6c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:04 GMT", + "x-ms-client-request-id" : "9e439cb1-9dc6-4964-b87d-737ab0e64271" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf9e84280608dc2/javablobclearpagesac1pageblobapitestclearpagesacf9e406834cf", + "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" : "a614ad7a-ce97-4b12-b6e4-eb5547a5851b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356190591C51\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd245e-501e-003f-034a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:04 GMT", + "x-ms-client-request-id" : "a614ad7a-ce97-4b12-b6e4-eb5547a5851b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf9e84280608dc2/javablobclearpagesac1pageblobapitestclearpagesacf9e406834cf?comp=page", + "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" : "85ab730b-8ea3-41c8-97e7-e47f6355697a", + "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" : "IBQkh4ZOjvk=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:04 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:04 GMT", + "ETag" : "\"0x8D735619066170D\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd2476-501e-003f-184a-675777000000", + "x-ms-client-request-id" : "85ab730b-8ea3-41c8-97e7-e47f6355697a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf9e84280608dc2/javablobclearpagesac1pageblobapitestclearpagesacf9e406834cf?comp=page", + "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" : "0a751483-e8b3-42dd-b75e-b5e4ab60363a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619072754A\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2488-501e-003f-2a4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:04 GMT", + "x-ms-client-request-id" : "0a751483-e8b3-42dd-b75e-b5e4ab60363a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcclearpagesac&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" : "50e91f65-e709-411d-98f3-877be74200b8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd249b-501e-003f-3c4a-675777000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesacf9e84280608dc2Mon, 09 Sep 2019 20:09:04 GMT\"0x8D73561904B062D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:04 GMT", + "x-ms-client-request-id" : "50e91f65-e709-411d-98f3-877be74200b8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf9e84280608dc2?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" : "ef9854a1-57ba-4669-be08-c953898a21f7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd24af-501e-003f-4f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:04 GMT", + "x-ms-client-request-id" : "ef9854a1-57ba-4669-be08-c953898a21f7" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesacf9e84280608dc2", "javablobclearpagesac1pageblobapitestclearpagesacf9e406834cf", "031ff369-14a6-46b8-a05a-0d3bff08cc07" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[1].json new file mode 100644 index 000000000000..46acd4c65b02 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[1].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac78793987c2992c?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" : "63e1c76f-530b-4ada-aeba-7cdb8d358c13" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561909DF01B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd24d3-501e-003f-734a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:04 GMT", + "x-ms-client-request-id" : "63e1c76f-530b-4ada-aeba-7cdb8d358c13" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac78793987c2992c/javablobclearpagesac1pageblobapitestclearpagesac78780327307", + "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" : "19400d86-09c1-4b07-b498-08692d732b5a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356190AB1BD1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd24fb-501e-003f-194a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:04 GMT", + "x-ms-client-request-id" : "19400d86-09c1-4b07-b498-08692d732b5a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac78793987c2992c/javablobclearpagesac1pageblobapitestclearpagesac78780327307?comp=page", + "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" : "856b8975-d281-4504-bd96-107b7bda6404", + "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" : "QgIkiPrJ/Xg=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:04 GMT", + "ETag" : "\"0x8D7356190B7EF62\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd251e-501e-003f-3b4a-675777000000", + "x-ms-client-request-id" : "856b8975-d281-4504-bd96-107b7bda6404" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac78793987c2992c/javablobclearpagesac1pageblobapitestclearpagesac78780327307?comp=page", + "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" : "a3943f39-85d1-41de-9812-0e72868967fd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356190C3FF87\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2531-501e-003f-4b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:04 GMT", + "x-ms-client-request-id" : "a3943f39-85d1-41de-9812-0e72868967fd" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcclearpagesac&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" : "a9d50cb1-5fbc-4a74-8f39-9a4ac5c09b10" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd2549-501e-003f-624a-675777000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesac78793987c2992cMon, 09 Sep 2019 20:09:05 GMT\"0x8D73561909DF01B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:05 GMT", + "x-ms-client-request-id" : "a9d50cb1-5fbc-4a74-8f39-9a4ac5c09b10", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac78793987c2992c?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" : "85dea823-7503-44ae-bbc8-9b5061838c38" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd255f-501e-003f-774a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:05 GMT", + "x-ms-client-request-id" : "85dea823-7503-44ae-bbc8-9b5061838c38" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesac78793987c2992c", "javablobclearpagesac1pageblobapitestclearpagesac78780327307", "b37fbfe4-53d6-45c2-9166-fe577f97f1f8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[2].json new file mode 100644 index 000000000000..b78f68b04ff8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[2].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf9c677548a51c7?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" : "36b35218-523a-4f53-bdde-d74efde66253" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356190E9D3D7\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2576-501e-003f-0e4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:05 GMT", + "x-ms-client-request-id" : "36b35218-523a-4f53-bdde-d74efde66253" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf9c677548a51c7/javablobclearpagesac1pageblobapitestclearpagesacf9c77952754", + "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" : "e897d8b8-fe70-4c24-ab27-2e1fbb9f3faa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356190F886A6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd258d-501e-003f-234a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:05 GMT", + "x-ms-client-request-id" : "e897d8b8-fe70-4c24-ab27-2e1fbb9f3faa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf9c677548a51c7/javablobclearpagesac1pageblobapitestclearpagesacf9c77952754?comp=page", + "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" : "b0a5cdca-6237-4392-bdcb-13b16c8fc9db", + "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" : "+XnRLQOEd+I=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:05 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:05 GMT", + "ETag" : "\"0x8D7356191066BE6\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd2599-501e-003f-2d4a-675777000000", + "x-ms-client-request-id" : "b0a5cdca-6237-4392-bdcb-13b16c8fc9db" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf9c677548a51c7/javablobclearpagesac1pageblobapitestclearpagesacf9c77952754?comp=page", + "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" : "ee876e9b-6fe0-464f-9583-7872f2ed2001" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356191133F81\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd25b0-501e-003f-414a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:05 GMT", + "x-ms-client-request-id" : "ee876e9b-6fe0-464f-9583-7872f2ed2001" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcclearpagesac&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" : "08a4213c-90c1-43e3-804b-03d26604c09e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd25c0-501e-003f-4d4a-675777000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesacf9c677548a51c7Mon, 09 Sep 2019 20:09:05 GMT\"0x8D7356190E9D3D7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:05 GMT", + "x-ms-client-request-id" : "08a4213c-90c1-43e3-804b-03d26604c09e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesacf9c677548a51c7?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" : "22797558-9661-43b6-ada4-e26c436f6a55" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd25d2-501e-003f-5f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:05 GMT", + "x-ms-client-request-id" : "22797558-9661-43b6-ada4-e26c436f6a55" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesacf9c677548a51c7", "javablobclearpagesac1pageblobapitestclearpagesacf9c77952754", "9bce7a0d-3f20-4744-a159-39ea9fb18a58" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[3].json new file mode 100644 index 000000000000..79281d90cdc9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[3].json @@ -0,0 +1,166 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac1a580998be6723?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" : "ed2b7151-42a9-4cac-93bc-5b5cc172d936" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561913B8507\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd25e6-501e-003f-714a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:05 GMT", + "x-ms-client-request-id" : "ed2b7151-42a9-4cac-93bc-5b5cc172d936" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac1a580998be6723/javablobclearpagesac1pageblobapitestclearpagesac1a5012003c5", + "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" : "de292270-e45e-4c01-955f-d682b2506f24" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619148B134\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd25f8-501e-003f-804a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:05 GMT", + "x-ms-client-request-id" : "de292270-e45e-4c01-955f-d682b2506f24" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac1a580998be6723/javablobclearpagesac1pageblobapitestclearpagesac1a5012003c5?comp=page", + "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" : "dbc64950-3150-41fa-9470-2e6e1fd4a01e", + "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" : "PqBWrI24IQ0=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:05 GMT", + "ETag" : "\"0x8D735619155ABE9\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd2602-501e-003f-0a4a-675777000000", + "x-ms-client-request-id" : "dbc64950-3150-41fa-9470-2e6e1fd4a01e" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac1a580998be6723/javablobclearpagesac1pageblobapitestclearpagesac1a5012003c5", + "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" : "0d151937-6332-4c44-bed0-7af15dd89f50" + }, + "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", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:06 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:06 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735619155ABE9\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:09:06 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd260f-501e-003f-174a-675777000000", + "x-ms-client-request-id" : "0d151937-6332-4c44-bed0-7af15dd89f50", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac1a580998be6723/javablobclearpagesac1pageblobapitestclearpagesac1a5012003c5?comp=page", + "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" : "2abba776-5d2d-4524-944b-a8b4c7d8a34a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561916E8FAA\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2628-501e-003f-2c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:06 GMT", + "x-ms-client-request-id" : "2abba776-5d2d-4524-944b-a8b4c7d8a34a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcclearpagesac&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" : "8e499e4e-e448-4c70-a73a-90dfbdb8385d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd263e-501e-003f-3f4a-675777000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesac1a580998be6723Mon, 09 Sep 2019 20:09:06 GMT\"0x8D73561913B8507\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:06 GMT", + "x-ms-client-request-id" : "8e499e4e-e448-4c70-a73a-90dfbdb8385d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac1a580998be6723?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" : "e1419fef-0bcf-419b-8e66-ab6cf3c9d2e6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd264b-501e-003f-4c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:06 GMT", + "x-ms-client-request-id" : "e1419fef-0bcf-419b-8e66-ab6cf3c9d2e6" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesac1a580998be6723", "javablobclearpagesac1pageblobapitestclearpagesac1a5012003c5", "49b02e58-2f6d-4b6e-8d0b-7d7be2a82468" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[4].json new file mode 100644 index 000000000000..7113b5752a32 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[4].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac94e48147f0f07e?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" : "3ebf5b9f-de9e-4faa-b91b-a101f2f1c75b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356191959C2E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2653-501e-003f-534a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:06 GMT", + "x-ms-client-request-id" : "3ebf5b9f-de9e-4faa-b91b-a101f2f1c75b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac94e48147f0f07e/javablobclearpagesac1pageblobapitestclearpagesac94e83775286", + "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" : "b91706c5-0829-4619-b331-18a853762421" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356191A2EFBC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2671-501e-003f-6e4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:06 GMT", + "x-ms-client-request-id" : "b91706c5-0829-4619-b331-18a853762421" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac94e48147f0f07e/javablobclearpagesac1pageblobapitestclearpagesac94e83775286?comp=page", + "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" : "13ada900-377a-477a-886b-0baab5dfd339", + "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" : "SSq7vnmAzh0=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:06 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:06 GMT", + "ETag" : "\"0x8D7356191B05FB9\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd2694-501e-003f-0f4a-675777000000", + "x-ms-client-request-id" : "13ada900-377a-477a-886b-0baab5dfd339" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac94e48147f0f07e/javablobclearpagesac1pageblobapitestclearpagesac94e83775286?comp=page", + "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" : "2146ee14-3f46-49f9-a54b-94db3850c6a7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356191BD0C37\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd269d-501e-003f-184a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:06 GMT", + "x-ms-client-request-id" : "2146ee14-3f46-49f9-a54b-94db3850c6a7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcclearpagesac&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" : "f6c7d57c-0206-4257-9127-bebe230e73ca" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd26b0-501e-003f-284a-675777000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesac94e48147f0f07eMon, 09 Sep 2019 20:09:06 GMT\"0x8D7356191959C2E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:06 GMT", + "x-ms-client-request-id" : "f6c7d57c-0206-4257-9127-bebe230e73ca", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac94e48147f0f07e?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" : "2da0a003-4ccf-4935-816d-6a1340b9c923" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd26c1-501e-003f-374a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:06 GMT", + "x-ms-client-request-id" : "2da0a003-4ccf-4935-816d-6a1340b9c923" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesac94e48147f0f07e", "javablobclearpagesac1pageblobapitestclearpagesac94e83775286", "83778355-f6de-4d12-b826-85025809455e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[5].json new file mode 100644 index 000000000000..4bb39870ea5a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[5].json @@ -0,0 +1,156 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac04f02864b895b6?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" : "41a8d430-3746-43dc-8fa3-8033a60a8b35" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356191E41874\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd26d2-501e-003f-464a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:06 GMT", + "x-ms-client-request-id" : "41a8d430-3746-43dc-8fa3-8033a60a8b35" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac04f02864b895b6/javablobclearpagesac1pageblobapitestclearpagesac04f48632c85", + "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" : "8ff3ede0-e5a4-45c6-81e6-ae71f41eee4b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356191F1935A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd26e5-501e-003f-564a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:06 GMT", + "x-ms-client-request-id" : "8ff3ede0-e5a4-45c6-81e6-ae71f41eee4b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac04f02864b895b6/javablobclearpagesac1pageblobapitestclearpagesac04f48632c85?comp=page", + "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" : "f13b1357-f4ab-4576-8123-d13a90db0c20", + "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" : "CQ1Z/mNyA8M=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:07 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:07 GMT", + "ETag" : "\"0x8D7356191FEB528\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd26f4-501e-003f-654a-675777000000", + "x-ms-client-request-id" : "f13b1357-f4ab-4576-8123-d13a90db0c20" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac04f02864b895b6/javablobclearpagesac1pageblobapitestclearpagesac04f48632c85?comp=lease", + "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" : "96a5371d-b866-459b-b72b-d5e4dbc8d977" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356191FEB528\"", + "x-ms-lease-id" : "ae83968c-1923-4388-ad6a-f2bf22cf758d", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2707-501e-003f-764a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:07 GMT", + "x-ms-client-request-id" : "96a5371d-b866-459b-b72b-d5e4dbc8d977" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac04f02864b895b6/javablobclearpagesac1pageblobapitestclearpagesac04f48632c85?comp=page", + "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" : "ac99b959-1f04-46bd-9a1c-7de5c27d3eea" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356192183546\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2713-501e-003f-014a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:07 GMT", + "x-ms-client-request-id" : "ac99b959-1f04-46bd-9a1c-7de5c27d3eea" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcclearpagesac&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" : "ca8666e1-a003-4b72-8450-37eab05e33d6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd272b-501e-003f-144a-675777000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesac04f02864b895b6Mon, 09 Sep 2019 20:09:07 GMT\"0x8D7356191E41874\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:07 GMT", + "x-ms-client-request-id" : "ca8666e1-a003-4b72-8450-37eab05e33d6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac04f02864b895b6?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" : "999d900a-1d19-41ea-b933-878cd97a1012" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd2748-501e-003f-2b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:07 GMT", + "x-ms-client-request-id" : "999d900a-1d19-41ea-b933-878cd97a1012" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesac04f02864b895b6", "javablobclearpagesac1pageblobapitestclearpagesac04f48632c85", "c6118769-5eb5-4195-ab9b-b5b7a6d7c3f5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[6].json new file mode 100644 index 000000000000..de74d9347aba --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[6].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac4a4619790fcfc5?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" : "ebad65f8-2398-4bbf-8f3c-0292863fbf96" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561924891B6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd276a-501e-003f-4d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:07 GMT", + "x-ms-client-request-id" : "ebad65f8-2398-4bbf-8f3c-0292863fbf96" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac4a4619790fcfc5/javablobclearpagesac1pageblobapitestclearpagesac4a47130909c", + "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" : "5682d026-c244-4cba-b5c0-5d1b36d4140a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619256823D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd277b-501e-003f-5a4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:07 GMT", + "x-ms-client-request-id" : "5682d026-c244-4cba-b5c0-5d1b36d4140a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac4a4619790fcfc5/javablobclearpagesac1pageblobapitestclearpagesac4a47130909c?comp=page", + "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" : "49cdb089-a623-4ae1-ba27-97429f5b5092", + "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" : "qRVNr+OUfG0=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:07 GMT", + "ETag" : "\"0x8D7356192644060\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd2796-501e-003f-744a-675777000000", + "x-ms-client-request-id" : "49cdb089-a623-4ae1-ba27-97429f5b5092" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac4a4619790fcfc5/javablobclearpagesac1pageblobapitestclearpagesac4a47130909c?comp=page", + "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" : "9f5665ae-0032-4686-9111-918a51da7549" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356192713B15\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd27a7-501e-003f-034a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:07 GMT", + "x-ms-client-request-id" : "9f5665ae-0032-4686-9111-918a51da7549" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcclearpagesac&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" : "8ee50775-85d7-41cc-bce7-cc52ac1114be" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd27b9-501e-003f-134a-675777000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesac4a4619790fcfc5Mon, 09 Sep 2019 20:09:07 GMT\"0x8D73561924891B6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:07 GMT", + "x-ms-client-request-id" : "8ee50775-85d7-41cc-bce7-cc52ac1114be", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac4a4619790fcfc5?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" : "1719193a-c535-4688-a06d-f195a20f4b6f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd27d0-501e-003f-264a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:07 GMT", + "x-ms-client-request-id" : "1719193a-c535-4688-a06d-f195a20f4b6f" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesac4a4619790fcfc5", "javablobclearpagesac1pageblobapitestclearpagesac4a47130909c", "e2adfdfa-fc04-49bc-b37d-e660cd610a0d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[7].json new file mode 100644 index 000000000000..48467a336457 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[7].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesaca2c3505395683c?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" : "f4617976-de80-43ae-afe7-1d6ef2502248" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561929846B9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd27e3-501e-003f-374a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:08 GMT", + "x-ms-client-request-id" : "f4617976-de80-43ae-afe7-1d6ef2502248" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesaca2c3505395683c/javablobclearpagesac1pageblobapitestclearpagesaca2c89448f3d", + "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" : "ebca5ae9-ea0f-4d5d-aa73-5fa1b8e5829e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356192A54CEE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd27f6-501e-003f-494a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:08 GMT", + "x-ms-client-request-id" : "ebca5ae9-ea0f-4d5d-aa73-5fa1b8e5829e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesaca2c3505395683c/javablobclearpagesac1pageblobapitestclearpagesaca2c89448f3d?comp=page", + "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" : "260b8c13-cb1a-494b-abaa-efa24c71a37b", + "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" : "s0XgA8tVFOg=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:08 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:08 GMT", + "ETag" : "\"0x8D7356192B1AB46\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd2803-501e-003f-564a-675777000000", + "x-ms-client-request-id" : "260b8c13-cb1a-494b-abaa-efa24c71a37b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesaca2c3505395683c/javablobclearpagesac1pageblobapitestclearpagesaca2c89448f3d?comp=page", + "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" : "b347db4b-e7c6-4de2-a586-67be9d563029" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356192BDBB61\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2819-501e-003f-694a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:08 GMT", + "x-ms-client-request-id" : "b347db4b-e7c6-4de2-a586-67be9d563029" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcclearpagesac&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" : "492a7a20-f21d-4f85-9d8e-282d616e9b59" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd2823-501e-003f-734a-675777000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesaca2c3505395683cMon, 09 Sep 2019 20:09:08 GMT\"0x8D73561929846B9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:08 GMT", + "x-ms-client-request-id" : "492a7a20-f21d-4f85-9d8e-282d616e9b59", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesaca2c3505395683c?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" : "6b69e0c0-29f5-48a3-97c1-fa4fe894babd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd2835-501e-003f-044a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:08 GMT", + "x-ms-client-request-id" : "6b69e0c0-29f5-48a3-97c1-fa4fe894babd" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesaca2c3505395683c", "javablobclearpagesac1pageblobapitestclearpagesaca2c89448f3d", "2499a5e1-57e1-4a60-b35b-611cd2983a47" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[8].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[8].json new file mode 100644 index 000000000000..e5431f696b43 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesac[8].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac0a407805768aa8?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" : "72a6a473-b608-4aff-8137-a25c46944ffb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356192E2F1CA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2847-501e-003f-154a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:08 GMT", + "x-ms-client-request-id" : "72a6a473-b608-4aff-8137-a25c46944ffb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac0a407805768aa8/javablobclearpagesac1pageblobapitestclearpagesac0a4308538e8", + "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" : "9729140a-c1d5-4033-94c6-38d89f32426a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356192F0BB8F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2854-501e-003f-214a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:08 GMT", + "x-ms-client-request-id" : "9729140a-c1d5-4033-94c6-38d89f32426a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac0a407805768aa8/javablobclearpagesac1pageblobapitestclearpagesac0a4308538e8?comp=page", + "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" : "f3274435-e3d5-4de1-974a-69de5c02e6a6", + "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" : "iYLvZkhfNmg=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:08 GMT", + "ETag" : "\"0x8D7356192FE79B0\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd2861-501e-003f-2b4a-675777000000", + "x-ms-client-request-id" : "f3274435-e3d5-4de1-974a-69de5c02e6a6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac0a407805768aa8/javablobclearpagesac1pageblobapitestclearpagesac0a4308538e8?comp=page", + "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" : "a40167c2-6cf1-49da-9430-09a6a3718a12" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561930A89D0\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd287b-501e-003f-434a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:08 GMT", + "x-ms-client-request-id" : "a40167c2-6cf1-49da-9430-09a6a3718a12" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcclearpagesac&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" : "7163cde5-c22e-4a23-8271-49918f70a246" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd2891-501e-003f-574a-675777000000", + "Body" : "jtcclearpagesacjtcclearpagesac0pageblobapitestclearpagesac0a407805768aa8Mon, 09 Sep 2019 20:09:08 GMT\"0x8D7356192E2F1CA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:08 GMT", + "x-ms-client-request-id" : "7163cde5-c22e-4a23-8271-49918f70a246", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesac0pageblobapitestclearpagesac0a407805768aa8?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" : "b627f9ea-239f-4a62-a440-5cb8cc9c4b99" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd28a5-501e-003f-6b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:08 GMT", + "x-ms-client-request-id" : "b627f9ea-239f-4a62-a440-5cb8cc9c4b99" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesac0pageblobapitestclearpagesac0a407805768aa8", "javablobclearpagesac1pageblobapitestclearpagesac0a4308538e8", "0503fafe-af30-4f7f-898f-5d629c26af07" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[0].json new file mode 100644 index 000000000000..f3fa889ca9ca --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[0].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail78c39496dd?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" : "0427e298-3818-4eb6-808e-3d5037277ea2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619332318A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd28b6-501e-003f-7a4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:09 GMT", + "x-ms-client-request-id" : "0427e298-3818-4eb6-808e-3d5037277ea2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail78c39496dd/javablobclearpagesacfail15619802048ff0a9e242b8", + "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" : "c8296170-9f2e-4404-b2bc-07251d7cb77d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561933F10EB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd28c7-501e-003f-0a4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:09 GMT", + "x-ms-client-request-id" : "c8296170-9f2e-4404-b2bc-07251d7cb77d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail78c39496dd/javablobclearpagesacfail15619802048ff0a9e242b8?comp=page", + "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" : "2ddc4aef-b7fc-4e1a-bac8-9236ee32af75", + "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" : "4oiEgTE4yd8=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:09 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:09 GMT", + "ETag" : "\"0x8D73561934CCF0D\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd28e1-501e-003f-224a-675777000000", + "x-ms-client-request-id" : "2ddc4aef-b7fc-4e1a-bac8-9236ee32af75" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail78c39496dd/javablobclearpagesacfail15619802048ff0a9e242b8?comp=page", + "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" : "11b63edd-c554-4355-8cc6-40ccfd6fc056" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd28ff-501e-003f-3c4a-675777000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd28ff-501e-003f-3c4a-675777000000\nTime:2019-09-09T20:09:09.6436413Z", + "Date" : "Mon, 09 Sep 2019 20:09:09 GMT", + "x-ms-client-request-id" : "11b63edd-c554-4355-8cc6-40ccfd6fc056", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcclearpagesacfail&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" : "00a029bc-9f06-4840-97b4-9b39112ac80f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd290c-501e-003f-494a-675777000000", + "Body" : "jtcclearpagesacfailjtcclearpagesacfail0pageblobapitestclearpagesacfail78c39496ddMon, 09 Sep 2019 20:09:09 GMT\"0x8D735619332318A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:09 GMT", + "x-ms-client-request-id" : "00a029bc-9f06-4840-97b4-9b39112ac80f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail78c39496dd?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" : "dd26c78a-e9fd-467f-aeda-46578bb6b4d0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd291b-501e-003f-584a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:09 GMT", + "x-ms-client-request-id" : "dd26c78a-e9fd-467f-aeda-46578bb6b4d0" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesacfail0pageblobapitestclearpagesacfail78c39496dd", "javablobclearpagesacfail15619802048ff0a9e242b8", "e57687fb-02b8-494a-b6ff-502cc5a83ed3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[1].json new file mode 100644 index 000000000000..f66c669135b2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[1].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail4b217451a2?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" : "a1337379-c9d6-4549-abec-19958762ec66" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561937F750E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2930-501e-003f-6c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:09 GMT", + "x-ms-client-request-id" : "a1337379-c9d6-4549-abec-19958762ec66" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail4b217451a2/javablobclearpagesacfail176282a8c108b95eb34284", + "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" : "36025b9b-250e-474e-bee7-67ee1958d80f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561938D8D73\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2946-501e-003f-7e4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:09 GMT", + "x-ms-client-request-id" : "36025b9b-250e-474e-bee7-67ee1958d80f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail4b217451a2/javablobclearpagesacfail176282a8c108b95eb34284?comp=page", + "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" : "603c806c-04f7-451d-a3f0-4a5c8dd7d34e", + "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" : "mnsOIzdsUXg=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:09 GMT", + "ETag" : "\"0x8D73561939A882D\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd295b-501e-003f-104a-675777000000", + "x-ms-client-request-id" : "603c806c-04f7-451d-a3f0-4a5c8dd7d34e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail4b217451a2/javablobclearpagesacfail176282a8c108b95eb34284?comp=page", + "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" : "c354ae14-8e1d-4438-8cc7-4f21e4ae3c9e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd2974-501e-003f-264a-675777000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd2974-501e-003f-264a-675777000000\nTime:2019-09-09T20:09:10.1499983Z", + "Date" : "Mon, 09 Sep 2019 20:09:09 GMT", + "x-ms-client-request-id" : "c354ae14-8e1d-4438-8cc7-4f21e4ae3c9e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcclearpagesacfail&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" : "3bce783d-5990-4e0b-8d31-11b7878e075d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd298a-501e-003f-3a4a-675777000000", + "Body" : "jtcclearpagesacfailjtcclearpagesacfail0pageblobapitestclearpagesacfail4b217451a2Mon, 09 Sep 2019 20:09:09 GMT\"0x8D73561937F750E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:09 GMT", + "x-ms-client-request-id" : "3bce783d-5990-4e0b-8d31-11b7878e075d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail4b217451a2?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" : "c6808f65-83b0-484d-89bf-57e10ccace55" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd29b6-501e-003f-664a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:09 GMT", + "x-ms-client-request-id" : "c6808f65-83b0-484d-89bf-57e10ccace55" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesacfail0pageblobapitestclearpagesacfail4b217451a2", "javablobclearpagesacfail176282a8c108b95eb34284", "64f4c7ff-42e8-4b96-b31a-e736283b6101" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[2].json new file mode 100644 index 000000000000..2f4417af5b04 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[2].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfailba3208954d?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" : "b4e4e892-66d1-4da9-b722-1234c1dbf0a0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356193CD2DF9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd29d8-501e-003f-084a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:10 GMT", + "x-ms-client-request-id" : "b4e4e892-66d1-4da9-b722-1234c1dbf0a0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfailba3208954d/javablobclearpagesacfail1760983a56a18a0f4743ad", + "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" : "b22b0cce-f157-4feb-b51a-cba8fddccf30" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356193DB468F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd29f6-501e-003f-204a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:10 GMT", + "x-ms-client-request-id" : "b22b0cce-f157-4feb-b51a-cba8fddccf30" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfailba3208954d/javablobclearpagesacfail1760983a56a18a0f4743ad?comp=page", + "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" : "d096b675-e5f2-4e6c-ac93-1ed4d8d36069", + "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" : "FuBHc2h0OTQ=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:10 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:10 GMT", + "ETag" : "\"0x8D7356193E86866\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd2a0d-501e-003f-354a-675777000000", + "x-ms-client-request-id" : "d096b675-e5f2-4e6c-ac93-1ed4d8d36069" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfailba3208954d/javablobclearpagesacfail1760983a56a18a0f4743ad?comp=page", + "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" : "d7e30219-b033-475e-a718-326a9a1319e0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd2a1c-501e-003f-424a-675777000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd2a1c-501e-003f-424a-675777000000\nTime:2019-09-09T20:09:10.6583571Z", + "Date" : "Mon, 09 Sep 2019 20:09:10 GMT", + "x-ms-client-request-id" : "d7e30219-b033-475e-a718-326a9a1319e0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcclearpagesacfail&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" : "c05f5f98-00d5-4c3a-b904-68f8b340ad93" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd2a2f-501e-003f-534a-675777000000", + "Body" : "jtcclearpagesacfailjtcclearpagesacfail0pageblobapitestclearpagesacfailba3208954dMon, 09 Sep 2019 20:09:10 GMT\"0x8D7356193CD2DF9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:10 GMT", + "x-ms-client-request-id" : "c05f5f98-00d5-4c3a-b904-68f8b340ad93", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfailba3208954d?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" : "b07f9d2d-eed6-4531-bc6c-fab8d7dec635" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd2a44-501e-003f-664a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:10 GMT", + "x-ms-client-request-id" : "b07f9d2d-eed6-4531-bc6c-fab8d7dec635" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesacfail0pageblobapitestclearpagesacfailba3208954d", "javablobclearpagesacfail1760983a56a18a0f4743ad", "fed168ab-d241-49a4-be13-42963ad228f6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[3].json new file mode 100644 index 000000000000..2eba8b55f208 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[3].json @@ -0,0 +1,166 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfaild3179418e8?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" : "68438fa7-83b1-42b4-b977-d2d534bf0f74" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561941A4A60\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2a53-501e-003f-724a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:10 GMT", + "x-ms-client-request-id" : "68438fa7-83b1-42b4-b977-d2d534bf0f74" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfaild3179418e8/javablobclearpagesacfail178971ed6fd288fec2456c", + "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" : "7aa0a25a-4fdc-45a0-8fc7-58ce4e93cae8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356194270376\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2a61-501e-003f-7d4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:10 GMT", + "x-ms-client-request-id" : "7aa0a25a-4fdc-45a0-8fc7-58ce4e93cae8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfaild3179418e8/javablobclearpagesacfail178971ed6fd288fec2456c?comp=page", + "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" : "8dbfaf8f-ee9d-4f82-aa36-7a36b0193ccf", + "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" : "T/ElR3p4mFQ=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:10 GMT", + "ETag" : "\"0x8D735619433D716\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd2a7d-501e-003f-174a-675777000000", + "x-ms-client-request-id" : "8dbfaf8f-ee9d-4f82-aa36-7a36b0193ccf" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfaild3179418e8/javablobclearpagesacfail178971ed6fd288fec2456c", + "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" : "bdfd800f-267b-47c0-a289-75397d9b792d" + }, + "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", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:11 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:10 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735619433D716\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:09:10 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd2a8b-501e-003f-234a-675777000000", + "x-ms-client-request-id" : "bdfd800f-267b-47c0-a289-75397d9b792d", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfaild3179418e8/javablobclearpagesacfail178971ed6fd288fec2456c?comp=page", + "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" : "4e922814-8e16-454c-b029-2f7c1e7da2c6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd2aa5-501e-003f-3c4a-675777000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd2aa5-501e-003f-3c4a-675777000000\nTime:2019-09-09T20:09:11.2417678Z", + "Date" : "Mon, 09 Sep 2019 20:09:10 GMT", + "x-ms-client-request-id" : "4e922814-8e16-454c-b029-2f7c1e7da2c6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcclearpagesacfail&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" : "37baf70e-450f-4b9f-9521-4f1cb85ef813" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd2ab2-501e-003f-494a-675777000000", + "Body" : "jtcclearpagesacfailjtcclearpagesacfail0pageblobapitestclearpagesacfaild3179418e8Mon, 09 Sep 2019 20:09:10 GMT\"0x8D73561941A4A60\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:10 GMT", + "x-ms-client-request-id" : "37baf70e-450f-4b9f-9521-4f1cb85ef813", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfaild3179418e8?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" : "d1abe3de-2221-4471-a940-3d39154ded41" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd2ac7-501e-003f-5e4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:11 GMT", + "x-ms-client-request-id" : "d1abe3de-2221-4471-a940-3d39154ded41" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesacfail0pageblobapitestclearpagesacfaild3179418e8", "javablobclearpagesacfail178971ed6fd288fec2456c", "6e9b28f8-4d35-4a87-8c78-29ef96ea06b6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[4].json new file mode 100644 index 000000000000..f8c27bf1d4cf --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[4].json @@ -0,0 +1,156 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail91423242d4?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" : "d8b350fb-e61c-494a-b0d1-bf9bec179b5c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619475E872\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2afd-501e-003f-084a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:11 GMT", + "x-ms-client-request-id" : "d8b350fb-e61c-494a-b0d1-bf9bec179b5c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail91423242d4/javablobclearpagesacfail192335edc612ed760b46ba", + "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" : "a32c546a-d825-468d-b861-c7dfcfc6a381" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561948428AA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2b0b-501e-003f-154a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:11 GMT", + "x-ms-client-request-id" : "a32c546a-d825-468d-b861-c7dfcfc6a381" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail91423242d4/javablobclearpagesacfail192335edc612ed760b46ba?comp=page", + "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" : "3bd288f6-4cdc-4028-952f-f5143cdfb1ac", + "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" : "2vG0fBMxgR8=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:11 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:11 GMT", + "ETag" : "\"0x8D735619491E6C6\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd2b22-501e-003f-294a-675777000000", + "x-ms-client-request-id" : "3bd288f6-4cdc-4028-952f-f5143cdfb1ac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail91423242d4/javablobclearpagesacfail192335edc612ed760b46ba?comp=lease", + "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" : "47ae1c28-cdfe-42f9-8057-863f14b8237b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619491E6C6\"", + "x-ms-lease-id" : "4eac2d2c-5192-4227-a530-9872d7ad69ad", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2b36-501e-003f-384a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:11 GMT", + "x-ms-client-request-id" : "47ae1c28-cdfe-42f9-8057-863f14b8237b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail91423242d4/javablobclearpagesacfail192335edc612ed760b46ba?comp=page", + "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" : "b411e3a7-1a43-4ebd-a4a3-66636dfe59c5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd2b4d-501e-003f-4d4a-675777000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:9ebd2b4d-501e-003f-4d4a-675777000000\nTime:2019-09-09T20:09:11.8541996Z", + "Date" : "Mon, 09 Sep 2019 20:09:11 GMT", + "x-ms-client-request-id" : "b411e3a7-1a43-4ebd-a4a3-66636dfe59c5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcclearpagesacfail&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" : "b6eede71-18e6-4e38-88e7-3b4856954028" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd2b55-501e-003f-544a-675777000000", + "Body" : "jtcclearpagesacfailjtcclearpagesacfail0pageblobapitestclearpagesacfail91423242d4Mon, 09 Sep 2019 20:09:11 GMT\"0x8D735619475E872\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:11 GMT", + "x-ms-client-request-id" : "b6eede71-18e6-4e38-88e7-3b4856954028", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail91423242d4?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" : "aed5cb87-80fa-40d5-a354-37031713276b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd2b68-501e-003f-674a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:11 GMT", + "x-ms-client-request-id" : "aed5cb87-80fa-40d5-a354-37031713276b" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesacfail0pageblobapitestclearpagesacfail91423242d4", "javablobclearpagesacfail192335edc612ed760b46ba", "24ca7821-2762-4a50-b359-14572fc1febe" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[5].json new file mode 100644 index 000000000000..2ec3a675aec5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[5].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail81b89628ec?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" : "2cd76d34-dd82-4ecf-9d1a-0d8632712fd5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356194D1AD90\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2b84-501e-003f-804a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:11 GMT", + "x-ms-client-request-id" : "2cd76d34-dd82-4ecf-9d1a-0d8632712fd5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail81b89628ec/javablobclearpagesacfail136252c4d5be53f9644e9f", + "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" : "ac9c60e3-25e8-435f-b7b9-957b59f9a54f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356194DFC6D8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2b9c-501e-003f-174a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:11 GMT", + "x-ms-client-request-id" : "ac9c60e3-25e8-435f-b7b9-957b59f9a54f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail81b89628ec/javablobclearpagesacfail136252c4d5be53f9644e9f?comp=page", + "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" : "4b903e01-0702-4f3f-b900-57f117417d47", + "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" : "5E9E6EJVI7Y=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:11 GMT", + "ETag" : "\"0x8D7356194ED5DE0\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd2bb2-501e-003f-2d4a-675777000000", + "x-ms-client-request-id" : "4b903e01-0702-4f3f-b900-57f117417d47" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail81b89628ec/javablobclearpagesacfail136252c4d5be53f9644e9f?comp=page", + "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" : "47213245-f01a-412a-89fb-4b9bf261a22b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidInput", + "retry-after" : "0", + "Content-Length" : "220", + "StatusCode" : "400", + "x-ms-request-id" : "9ebd2bc1-501e-003f-3a4a-675777000000", + "Body" : "InvalidInputOne of the request inputs is not valid.\nRequestId:9ebd2bc1-501e-003f-3a4a-675777000000\nTime:2019-09-09T20:09:12.3705641Z", + "Date" : "Mon, 09 Sep 2019 20:09:12 GMT", + "x-ms-client-request-id" : "47213245-f01a-412a-89fb-4b9bf261a22b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcclearpagesacfail&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" : "ef8be00c-1c6e-4e3e-ac48-1f2d15c19e1c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd2bcb-501e-003f-444a-675777000000", + "Body" : "jtcclearpagesacfailjtcclearpagesacfail0pageblobapitestclearpagesacfail81b89628ecMon, 09 Sep 2019 20:09:12 GMT\"0x8D7356194D1AD90\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:12 GMT", + "x-ms-client-request-id" : "ef8be00c-1c6e-4e3e-ac48-1f2d15c19e1c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail81b89628ec?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" : "3e0c0fe9-6612-44f3-869c-0472b172a814" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd2bdd-501e-003f-564a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:12 GMT", + "x-ms-client-request-id" : "3e0c0fe9-6612-44f3-869c-0472b172a814" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesacfail0pageblobapitestclearpagesacfail81b89628ec", "javablobclearpagesacfail136252c4d5be53f9644e9f", "bf2a7324-eac0-4e1a-a020-a9dd63ac1965" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[6].json new file mode 100644 index 000000000000..10cd336407c6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[6].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail33f168608f?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" : "9394290f-f347-48e1-bff4-2bf6a013a8a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619523ACEA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2bfe-501e-003f-744a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:12 GMT", + "x-ms-client-request-id" : "9394290f-f347-48e1-bff4-2bf6a013a8a4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail33f168608f/javablobclearpagesacfail162117fe520edef3d24123", + "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" : "6b38b2ad-e422-4ac5-b8de-88d1e583db5e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356195312A10\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2c15-501e-003f-074a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:12 GMT", + "x-ms-client-request-id" : "6b38b2ad-e422-4ac5-b8de-88d1e583db5e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail33f168608f/javablobclearpagesacfail162117fe520edef3d24123?comp=page", + "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" : "0475098e-727b-4cae-a719-d2462d93b429", + "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" : "NLzm3Delb1I=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:12 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:12 GMT", + "ETag" : "\"0x8D73561953DFDAB\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd2c21-501e-003f-124a-675777000000", + "x-ms-client-request-id" : "0475098e-727b-4cae-a719-d2462d93b429" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail33f168608f/javablobclearpagesacfail162117fe520edef3d24123?comp=page", + "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" : "93f07e31-5b8c-4e4e-9eb9-41b87a3a4988" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidInput", + "retry-after" : "0", + "Content-Length" : "220", + "StatusCode" : "400", + "x-ms-request-id" : "9ebd2c50-501e-003f-414a-675777000000", + "Body" : "InvalidInputOne of the request inputs is not valid.\nRequestId:9ebd2c50-501e-003f-414a-675777000000\nTime:2019-09-09T20:09:12.9209521Z", + "Date" : "Mon, 09 Sep 2019 20:09:12 GMT", + "x-ms-client-request-id" : "93f07e31-5b8c-4e4e-9eb9-41b87a3a4988", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcclearpagesacfail&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" : "6edb927d-d86b-454d-b2ef-41c505365c62" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd2c6f-501e-003f-5e4a-675777000000", + "Body" : "jtcclearpagesacfailjtcclearpagesacfail0pageblobapitestclearpagesacfail33f168608fMon, 09 Sep 2019 20:09:12 GMT\"0x8D735619523ACEA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:12 GMT", + "x-ms-client-request-id" : "6edb927d-d86b-454d-b2ef-41c505365c62", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfail33f168608f?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" : "856e7922-7aae-4d44-a7df-0e77f6d29626" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd2c81-501e-003f-6f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:12 GMT", + "x-ms-client-request-id" : "856e7922-7aae-4d44-a7df-0e77f6d29626" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesacfail0pageblobapitestclearpagesacfail33f168608f", "javablobclearpagesacfail162117fe520edef3d24123", "015194fd-cf0e-4aa6-8b87-11a6b130c47d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[7].json new file mode 100644 index 000000000000..e84e0c5d15c6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestclearpagesacfail[7].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfaila6264028e6?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" : "bfb862a0-328b-4b55-a95c-eaf48c27b20f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619572ECAA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2c9e-501e-003f-034a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:12 GMT", + "x-ms-client-request-id" : "bfb862a0-328b-4b55-a95c-eaf48c27b20f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfaila6264028e6/javablobclearpagesacfail1518855b1b73f742e14f1a", + "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" : "6c1c2674-f5b0-4346-b9de-3b30e21bd017" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561957FCDB2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2cb4-501e-003f-164a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:12 GMT", + "x-ms-client-request-id" : "6c1c2674-f5b0-4346-b9de-3b30e21bd017" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfaila6264028e6/javablobclearpagesacfail1518855b1b73f742e14f1a?comp=page", + "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" : "37a09ffa-fb68-4c3c-92fe-e7e89341e261", + "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" : "r8/GfulOB1w=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:13 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:13 GMT", + "ETag" : "\"0x8D73561958CA152\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd2ccb-501e-003f-2d4a-675777000000", + "x-ms-client-request-id" : "37a09ffa-fb68-4c3c-92fe-e7e89341e261" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfaila6264028e6/javablobclearpagesacfail1518855b1b73f742e14f1a?comp=page", + "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" : "c834f217-6b25-4522-b334-c389238ab3a9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "SequenceNumberConditionNotMet", + "retry-after" : "0", + "Content-Length" : "250", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd2cd7-501e-003f-394a-675777000000", + "Body" : "SequenceNumberConditionNotMetThe sequence number condition specified was not met.\nRequestId:9ebd2cd7-501e-003f-394a-675777000000\nTime:2019-09-09T20:09:13.4373161Z", + "Date" : "Mon, 09 Sep 2019 20:09:13 GMT", + "x-ms-client-request-id" : "c834f217-6b25-4522-b334-c389238ab3a9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcclearpagesacfail&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" : "fc36bc3b-c5f5-4040-8e4c-49fe89937226" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd2ce8-501e-003f-494a-675777000000", + "Body" : "jtcclearpagesacfailjtcclearpagesacfail0pageblobapitestclearpagesacfaila6264028e6Mon, 09 Sep 2019 20:09:13 GMT\"0x8D735619572ECAA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:13 GMT", + "x-ms-client-request-id" : "fc36bc3b-c5f5-4040-8e4c-49fe89937226", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcclearpagesacfail0pageblobapitestclearpagesacfaila6264028e6?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" : "2e69e766-6941-4b39-b1e0-8a95e240c39b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd2cf3-501e-003f-544a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:13 GMT", + "x-ms-client-request-id" : "2e69e766-6941-4b39-b1e0-8a95e240c39b" + }, + "Exception" : null + } ], + "variables" : [ "jtcclearpagesacfail0pageblobapitestclearpagesacfaila6264028e6", "javablobclearpagesacfail1518855b1b73f742e14f1a", "41899425-47cf-4e8b-aa53-fe0c9fbd067f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[0].json new file mode 100644 index 000000000000..45d6fcc32026 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[0].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateac16c888770c1a441081?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" : "4a250a05-bd5d-4a87-a609-b18e0436c903" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356178C7B24D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1bea-301e-0042-804a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:24 GMT", + "x-ms-client-request-id" : "4a250a05-bd5d-4a87-a609-b18e0436c903" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateac16c888770c1a441081/javablobcreateac1pageblobapitestcreateac16c421552b6e096", + "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" : "7abd8611-9c60-403e-9923-ae75be374958" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356178D4DE9F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1c05-301e-0042-194a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:24 GMT", + "x-ms-client-request-id" : "7abd8611-9c60-403e-9923-ae75be374958" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateac16c888770c1a441081/javablobcreateac1pageblobapitestcreateac16c421552b6e096", + "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" : "52cd8eab-8329-4b9f-9873-f842be315016" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356178E16411\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1c10-301e-0042-244a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:24 GMT", + "x-ms-client-request-id" : "52cd8eab-8329-4b9f-9873-f842be315016" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateac&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" : "0b7850f9-e45e-4673-b5df-32ea7c2edd7c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb1c23-301e-0042-334a-67cbbf000000", + "Body" : "jtccreateacjtccreateac0pageblobapitestcreateac16c888770c1a441081Mon, 09 Sep 2019 20:08:25 GMT\"0x8D7356178C7B24D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:24 GMT", + "x-ms-client-request-id" : "0b7850f9-e45e-4673-b5df-32ea7c2edd7c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateac16c888770c1a441081?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" : "773e5b17-26bc-44cd-bf5e-dd873fcfca5a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb1c33-301e-0042-434a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:24 GMT", + "x-ms-client-request-id" : "773e5b17-26bc-44cd-bf5e-dd873fcfca5a" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0pageblobapitestcreateac16c888770c1a441081", "javablobcreateac1pageblobapitestcreateac16c421552b6e096" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[1].json new file mode 100644 index 000000000000..34c0b349f074 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[1].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateac582388727d5ba0687a?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" : "3d889838-6f4b-46ec-b7f2-56cc0830e85b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561790C68D8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1c40-301e-0042-504a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:25 GMT", + "x-ms-client-request-id" : "3d889838-6f4b-46ec-b7f2-56cc0830e85b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateac582388727d5ba0687a/javablobcreateac1pageblobapitestcreateac58275559124d4f6", + "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" : "e032cf81-1a02-4842-8483-9f096b8b271c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617919954F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1c4e-301e-0042-5d4a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:25 GMT", + "x-ms-client-request-id" : "e032cf81-1a02-4842-8483-9f096b8b271c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateac582388727d5ba0687a/javablobcreateac1pageblobapitestcreateac58275559124d4f6", + "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" : "44ada873-d477-4b7d-9479-2a56ed963462" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617925CC8D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1c5f-301e-0042-6c4a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:25 GMT", + "x-ms-client-request-id" : "44ada873-d477-4b7d-9479-2a56ed963462" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateac&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" : "9c9f16f0-2866-4ff5-a194-af5802f13af1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb1c70-301e-0042-7c4a-67cbbf000000", + "Body" : "jtccreateacjtccreateac0pageblobapitestcreateac582388727d5ba0687aMon, 09 Sep 2019 20:08:25 GMT\"0x8D73561790C68D8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:25 GMT", + "x-ms-client-request-id" : "9c9f16f0-2866-4ff5-a194-af5802f13af1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateac582388727d5ba0687a?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" : "c3053f48-6eeb-4b66-80df-96b403e57eed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb1c81-301e-0042-0a4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:25 GMT", + "x-ms-client-request-id" : "c3053f48-6eeb-4b66-80df-96b403e57eed" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0pageblobapitestcreateac582388727d5ba0687a", "javablobcreateac1pageblobapitestcreateac58275559124d4f6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[2].json new file mode 100644 index 000000000000..2bcc6424b3a7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[2].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateac9e773089ce146bbdd2?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" : "63717283-a1cd-4c94-8518-bf9451992abb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561794E86DC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1ca6-301e-0042-2e4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:25 GMT", + "x-ms-client-request-id" : "63717283-a1cd-4c94-8518-bf9451992abb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateac9e773089ce146bbdd2/javablobcreateac1pageblobapitestcreateac9e7747649324717", + "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" : "df240739-78b9-4b44-a30a-2615c16c2613" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561795C76E1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1cd7-301e-0042-5d4a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:25 GMT", + "x-ms-client-request-id" : "df240739-78b9-4b44-a30a-2615c16c2613" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateac9e773089ce146bbdd2/javablobcreateac1pageblobapitestcreateac9e7747649324717", + "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" : "f122d68b-f1f9-4fa4-aee5-c4ef235b8da8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617968D52F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1d0a-301e-0042-074a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:25 GMT", + "x-ms-client-request-id" : "f122d68b-f1f9-4fa4-aee5-c4ef235b8da8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateac&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" : "790b4870-a81b-4c94-9cfd-f08bb56ef1de" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb1d15-301e-0042-124a-67cbbf000000", + "Body" : "jtccreateacjtccreateac0pageblobapitestcreateac9e773089ce146bbdd2Mon, 09 Sep 2019 20:08:25 GMT\"0x8D73561794E86DC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:25 GMT", + "x-ms-client-request-id" : "790b4870-a81b-4c94-9cfd-f08bb56ef1de", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateac9e773089ce146bbdd2?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" : "208db583-f6b0-464d-ab11-785f22501127" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb1d26-301e-0042-224a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:25 GMT", + "x-ms-client-request-id" : "208db583-f6b0-464d-ab11-785f22501127" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0pageblobapitestcreateac9e773089ce146bbdd2", "javablobcreateac1pageblobapitestcreateac9e7747649324717" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[3].json new file mode 100644 index 000000000000..05ebebe33566 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[3].json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateac93f14290548a67ea22?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" : "f82c5d49-6fb9-4a3b-b1bc-4b4d4b82d9db" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356179916853\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1d31-301e-0042-2d4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:25 GMT", + "x-ms-client-request-id" : "f82c5d49-6fb9-4a3b-b1bc-4b4d4b82d9db" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateac93f14290548a67ea22/javablobcreateac1pageblobapitestcreateac93f369296541a98", + "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" : "b5a6eefb-3227-437e-a61b-614fba5a75ba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561799E6DEC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1d4a-301e-0042-434a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:26 GMT", + "x-ms-client-request-id" : "b5a6eefb-3227-437e-a61b-614fba5a75ba" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateac93f14290548a67ea22/javablobcreateac1pageblobapitestcreateac93f369296541a98", + "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" : "b2981457-5461-4a18-8f2b-3f83007a69e4" + }, + "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", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:26 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:08:26 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561799E6DEC\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:08:26 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "c5cb1d5e-301e-0042-544a-67cbbf000000", + "x-ms-client-request-id" : "b2981457-5461-4a18-8f2b-3f83007a69e4", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateac93f14290548a67ea22/javablobcreateac1pageblobapitestcreateac93f369296541a98", + "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" : "66a3caf0-dc64-4ad6-a2db-19c36adf07a5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356179B66722\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1d65-301e-0042-5a4a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:26 GMT", + "x-ms-client-request-id" : "66a3caf0-dc64-4ad6-a2db-19c36adf07a5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateac&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" : "d2c250c9-8583-41d4-a8db-754a17160146" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb1d7c-301e-0042-6e4a-67cbbf000000", + "Body" : "jtccreateacjtccreateac0pageblobapitestcreateac93f14290548a67ea22Mon, 09 Sep 2019 20:08:26 GMT\"0x8D7356179916853\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:26 GMT", + "x-ms-client-request-id" : "d2c250c9-8583-41d4-a8db-754a17160146", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateac93f14290548a67ea22?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" : "96c1df7d-1de2-445c-b2c3-212ab4c88626" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb1d98-301e-0042-094a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:26 GMT", + "x-ms-client-request-id" : "96c1df7d-1de2-445c-b2c3-212ab4c88626" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0pageblobapitestcreateac93f14290548a67ea22", "javablobcreateac1pageblobapitestcreateac93f369296541a98" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[4].json new file mode 100644 index 000000000000..1e8b9bb5a12b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[4].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateacd3e98775112ca45f3a?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" : "ad5a9ac9-b8e1-4248-8c58-4905479b9370" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356179E032D0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1db2-301e-0042-204a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:26 GMT", + "x-ms-client-request-id" : "ad5a9ac9-b8e1-4248-8c58-4905479b9370" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateacd3e98775112ca45f3a/javablobcreateac1pageblobapitestcreateacd3e25468d299053", + "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" : "e6531999-6cd5-4619-8bb1-19421f11893b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356179EE4A50\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1dc1-301e-0042-2e4a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:26 GMT", + "x-ms-client-request-id" : "e6531999-6cd5-4619-8bb1-19421f11893b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateacd3e98775112ca45f3a/javablobcreateac1pageblobapitestcreateacd3e25468d299053", + "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" : "a6dffcef-7753-4ea2-a841-c196a60f0778" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356179FA8186\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1dce-301e-0042-3b4a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:26 GMT", + "x-ms-client-request-id" : "a6dffcef-7753-4ea2-a841-c196a60f0778" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateac&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" : "e28cad6d-7165-48be-91f2-326ee2f55d61" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb1de7-301e-0042-524a-67cbbf000000", + "Body" : "jtccreateacjtccreateac0pageblobapitestcreateacd3e98775112ca45f3aMon, 09 Sep 2019 20:08:26 GMT\"0x8D7356179E032D0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:26 GMT", + "x-ms-client-request-id" : "e28cad6d-7165-48be-91f2-326ee2f55d61", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateacd3e98775112ca45f3a?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" : "dde5423d-cb70-443d-84fc-7fc8fb36a24a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb1dfc-301e-0042-654a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:26 GMT", + "x-ms-client-request-id" : "dde5423d-cb70-443d-84fc-7fc8fb36a24a" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0pageblobapitestcreateacd3e98775112ca45f3a", "javablobcreateac1pageblobapitestcreateacd3e25468d299053" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[5].json new file mode 100644 index 000000000000..f96f7e144450 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateac[5].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateacbe698323385289028a?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" : "d40b1843-9dd8-4678-8b3b-a171ca85a556" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617A229EFE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1e0d-301e-0042-764a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:26 GMT", + "x-ms-client-request-id" : "d40b1843-9dd8-4678-8b3b-a171ca85a556" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateacbe698323385289028a/javablobcreateac1pageblobapitestcreateacbe6127720cdacc2", + "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" : "f1dc15f1-1f0e-482e-8bcc-670e49b54b66" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617A2F7DF6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1e1c-301e-0042-044a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:26 GMT", + "x-ms-client-request-id" : "f1dc15f1-1f0e-482e-8bcc-670e49b54b66" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateacbe698323385289028a/javablobcreateac1pageblobapitestcreateacbe6127720cdacc2?comp=lease", + "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" : "61c74594-c06c-43ba-803b-3e7a38fc60ac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617A2F7DF6\"", + "x-ms-lease-id" : "1aa7a4b7-84a8-457e-8857-098887f792a1", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1e2e-301e-0042-154a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:27 GMT", + "x-ms-client-request-id" : "61c74594-c06c-43ba-803b-3e7a38fc60ac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateacbe698323385289028a/javablobcreateac1pageblobapitestcreateacbe6127720cdacc2", + "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" : "ab228181-041a-4ff8-9f8f-d126779f989d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617A481391\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1e42-301e-0042-284a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:27 GMT", + "x-ms-client-request-id" : "ab228181-041a-4ff8-9f8f-d126779f989d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateac&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" : "1813508c-83ef-4e4d-bdcb-33ad11f29536" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb1e51-301e-0042-374a-67cbbf000000", + "Body" : "jtccreateacjtccreateac0pageblobapitestcreateacbe698323385289028aMon, 09 Sep 2019 20:08:27 GMT\"0x8D735617A229EFE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:27 GMT", + "x-ms-client-request-id" : "1813508c-83ef-4e4d-bdcb-33ad11f29536", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateac0pageblobapitestcreateacbe698323385289028a?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" : "6826e4d0-82e2-442e-9dea-c4b493a19f0d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb1e60-301e-0042-454a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:27 GMT", + "x-ms-client-request-id" : "6826e4d0-82e2-442e-9dea-c4b493a19f0d" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateac0pageblobapitestcreateacbe698323385289028a", "javablobcreateac1pageblobapitestcreateacbe6127720cdacc2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[0].json new file mode 100644 index 000000000000..5039527525c6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[0].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail60181037fea90b?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" : "7b180dc7-9849-40cf-b59d-2cc38241b471" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617A6FBB80\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1e73-301e-0042-564a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:27 GMT", + "x-ms-client-request-id" : "7b180dc7-9849-40cf-b59d-2cc38241b471" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail60181037fea90b/javablobcreateacfail1pageblobapitestcreateacfail60110729db7", + "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" : "3effbdc1-04a5-4643-b58c-884f3061ad7b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617A7DD369\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1e8f-301e-0042-6f4a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:27 GMT", + "x-ms-client-request-id" : "3effbdc1-04a5-4643-b58c-884f3061ad7b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail60181037fea90b/javablobcreateacfail1pageblobapitestcreateacfail60110729db7", + "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" : "e9754846-1626-49f6-b032-e9d957013964" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5cb1e9a-301e-0042-794a-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5cb1e9a-301e-0042-794a-67cbbf000000\nTime:2019-09-09T20:08:28.0188440Z", + "Date" : "Mon, 09 Sep 2019 20:08:27 GMT", + "x-ms-client-request-id" : "e9754846-1626-49f6-b032-e9d957013964", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateacfail&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" : "48426136-c1ed-47a2-ba3b-bddc3de956ce" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb1eb3-301e-0042-0e4a-67cbbf000000", + "Body" : "jtccreateacfailjtccreateacfail0pageblobapitestcreateacfail60181037fea90bMon, 09 Sep 2019 20:08:27 GMT\"0x8D735617A6FBB80\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:27 GMT", + "x-ms-client-request-id" : "48426136-c1ed-47a2-ba3b-bddc3de956ce", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail60181037fea90b?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" : "921b676d-9db8-4803-8011-ece020117a48" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb1ec5-301e-0042-1d4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:27 GMT", + "x-ms-client-request-id" : "921b676d-9db8-4803-8011-ece020117a48" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0pageblobapitestcreateacfail60181037fea90b", "javablobcreateacfail1pageblobapitestcreateacfail60110729db7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[1].json new file mode 100644 index 000000000000..953e4de43203 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[1].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail183019077474fa?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" : "a9dc7b85-7c18-45ed-844d-31b19642b52b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617AB02B89\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1ed5-301e-0042-2c4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:27 GMT", + "x-ms-client-request-id" : "a9dc7b85-7c18-45ed-844d-31b19642b52b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail183019077474fa/javablobcreateacfail1pageblobapitestcreateacfail18352716869", + "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" : "87788c20-86c4-47b4-a43e-2a6859a2d88a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617ABD3201\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1ee3-301e-0042-374a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:27 GMT", + "x-ms-client-request-id" : "87788c20-86c4-47b4-a43e-2a6859a2d88a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail183019077474fa/javablobcreateacfail1pageblobapitestcreateacfail18352716869", + "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" : "3e83cb72-2bba-4c02-b509-8a9f0942624d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5cb1ef4-301e-0042-474a-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5cb1ef4-301e-0042-474a-67cbbf000000\nTime:2019-09-09T20:08:28.4341374Z", + "Date" : "Mon, 09 Sep 2019 20:08:27 GMT", + "x-ms-client-request-id" : "3e83cb72-2bba-4c02-b509-8a9f0942624d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateacfail&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" : "5a9ae391-24c8-4533-aaa1-1e516fc3bfc9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb1f02-301e-0042-544a-67cbbf000000", + "Body" : "jtccreateacfailjtccreateacfail0pageblobapitestcreateacfail183019077474faMon, 09 Sep 2019 20:08:28 GMT\"0x8D735617AB02B89\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:28 GMT", + "x-ms-client-request-id" : "5a9ae391-24c8-4533-aaa1-1e516fc3bfc9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail183019077474fa?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" : "c94467f2-99c7-4c73-94ea-38a621401e8f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb1f0f-301e-0042-604a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:28 GMT", + "x-ms-client-request-id" : "c94467f2-99c7-4c73-94ea-38a621401e8f" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0pageblobapitestcreateacfail183019077474fa", "javablobcreateacfail1pageblobapitestcreateacfail18352716869" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[2].json new file mode 100644 index 000000000000..1662929eac16 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[2].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail15a91379cc674f?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" : "7ea420b9-40aa-4fac-97c5-67eab7502279" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617AEFFF2E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1f1a-301e-0042-6b4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:28 GMT", + "x-ms-client-request-id" : "7ea420b9-40aa-4fac-97c5-67eab7502279" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail15a91379cc674f/javablobcreateacfail1pageblobapitestcreateacfail15a283798c5", + "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" : "c4aa6abe-ed1c-4ecc-b0b7-d5c14fc0ebbd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617AFD05D8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1f25-301e-0042-754a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:28 GMT", + "x-ms-client-request-id" : "c4aa6abe-ed1c-4ecc-b0b7-d5c14fc0ebbd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail15a91379cc674f/javablobcreateacfail1pageblobapitestcreateacfail15a283798c5", + "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" : "1fc77cd2-14be-4daf-8d67-dda7ac7c9fb2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5cb1f33-301e-0042-034a-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5cb1f33-301e-0042-034a-67cbbf000000\nTime:2019-09-09T20:08:28.8494299Z", + "Date" : "Mon, 09 Sep 2019 20:08:28 GMT", + "x-ms-client-request-id" : "1fc77cd2-14be-4daf-8d67-dda7ac7c9fb2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateacfail&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" : "7f232b27-fadc-4808-a4b0-19871b857ef3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb1f4e-301e-0042-1c4a-67cbbf000000", + "Body" : "jtccreateacfailjtccreateacfail0pageblobapitestcreateacfail15a91379cc674fMon, 09 Sep 2019 20:08:28 GMT\"0x8D735617AEFFF2E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:28 GMT", + "x-ms-client-request-id" : "7f232b27-fadc-4808-a4b0-19871b857ef3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfail15a91379cc674f?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" : "8416f039-3a6c-4774-917b-3a16b1f173b7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb1f6f-301e-0042-384a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:28 GMT", + "x-ms-client-request-id" : "8416f039-3a6c-4774-917b-3a16b1f173b7" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0pageblobapitestcreateacfail15a91379cc674f", "javablobcreateacfail1pageblobapitestcreateacfail15a283798c5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[3].json new file mode 100644 index 000000000000..7a97dc1b80c5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[3].json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfailcef9617960b759?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" : "ee1ba0ed-f15d-4444-9159-da9b73a8eb4e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617B2E9A1E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1f88-301e-0042-504a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:28 GMT", + "x-ms-client-request-id" : "ee1ba0ed-f15d-4444-9159-da9b73a8eb4e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfailcef9617960b759/javablobcreateacfail1pageblobapitestcreateacfailcef24826799", + "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" : "861b5104-3a9d-4367-b601-d6d02038aac5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617B3BC817\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1f97-301e-0042-5d4a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:28 GMT", + "x-ms-client-request-id" : "861b5104-3a9d-4367-b601-d6d02038aac5" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfailcef9617960b759/javablobcreateacfail1pageblobapitestcreateacfailcef24826799", + "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" : "568266fa-1f3d-42ad-8ecf-ba51b553a97f" + }, + "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", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:08:28 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735617B3BC817\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:08:29 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "c5cb1fa3-301e-0042-694a-67cbbf000000", + "x-ms-client-request-id" : "568266fa-1f3d-42ad-8ecf-ba51b553a97f", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfailcef9617960b759/javablobcreateacfail1pageblobapitestcreateacfailcef24826799", + "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" : "3917cbe9-1eec-4148-a1f4-4cbea3d5e731" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "c5cb1fb4-301e-0042-7a4a-67cbbf000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:c5cb1fb4-301e-0042-7a4a-67cbbf000000\nTime:2019-09-09T20:08:29.3437793Z", + "Date" : "Mon, 09 Sep 2019 20:08:28 GMT", + "x-ms-client-request-id" : "3917cbe9-1eec-4148-a1f4-4cbea3d5e731", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateacfail&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" : "c5df5ced-bd4f-4306-bd36-167976cf9401" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb1fc1-301e-0042-074a-67cbbf000000", + "Body" : "jtccreateacfailjtccreateacfail0pageblobapitestcreateacfailcef9617960b759Mon, 09 Sep 2019 20:08:29 GMT\"0x8D735617B2E9A1E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:28 GMT", + "x-ms-client-request-id" : "c5df5ced-bd4f-4306-bd36-167976cf9401", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfailcef9617960b759?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" : "6de1f45d-9b2c-48ea-81b6-4ada6b2ba60a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb1fd9-301e-0042-1b4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:29 GMT", + "x-ms-client-request-id" : "6de1f45d-9b2c-48ea-81b6-4ada6b2ba60a" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0pageblobapitestcreateacfailcef9617960b759", "javablobcreateacfail1pageblobapitestcreateacfailcef24826799" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[4].json new file mode 100644 index 000000000000..001f43297f38 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateacfail[4].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfailb12938786acdca?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" : "4280b418-615d-4a49-9db6-f42f5a6db4c9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617B796C43\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1fe5-301e-0042-274a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:29 GMT", + "x-ms-client-request-id" : "4280b418-615d-4a49-9db6-f42f5a6db4c9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfailb12938786acdca/javablobcreateacfail1pageblobapitestcreateacfailb12211935b6", + "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" : "6b8d9e47-ffee-443c-bcac-aa1e0400f927" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617B8784F5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1ff8-301e-0042-394a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:29 GMT", + "x-ms-client-request-id" : "6b8d9e47-ffee-443c-bcac-aa1e0400f927" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfailb12938786acdca/javablobcreateacfail1pageblobapitestcreateacfailb12211935b6?comp=lease", + "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" : "737e784d-e035-411d-85fa-fb02c1e685aa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617B8784F5\"", + "x-ms-lease-id" : "9557ef03-5123-4459-9a66-a48e1e534134", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb2008-301e-0042-494a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:29 GMT", + "x-ms-client-request-id" : "737e784d-e035-411d-85fa-fb02c1e685aa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfailb12938786acdca/javablobcreateacfail1pageblobapitestcreateacfailb12211935b6", + "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" : "73f6b484-bab6-40ff-8966-d1505fbdbed3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "c5cb201c-301e-0042-5d4a-67cbbf000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:c5cb201c-301e-0042-5d4a-67cbbf000000\nTime:2019-09-09T20:08:29.8461335Z", + "Date" : "Mon, 09 Sep 2019 20:08:29 GMT", + "x-ms-client-request-id" : "73f6b484-bab6-40ff-8966-d1505fbdbed3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateacfail&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" : "34b815b4-fe5f-4a1c-99ee-10da9cc6f30b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb2029-301e-0042-6a4a-67cbbf000000", + "Body" : "jtccreateacfailjtccreateacfail0pageblobapitestcreateacfailb12938786acdcaMon, 09 Sep 2019 20:08:29 GMT\"0x8D735617B796C43\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:29 GMT", + "x-ms-client-request-id" : "34b815b4-fe5f-4a1c-99ee-10da9cc6f30b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateacfail0pageblobapitestcreateacfailb12938786acdca?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" : "98d65569-911f-4436-b001-24b146f4050e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb2036-301e-0042-774a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:29 GMT", + "x-ms-client-request-id" : "98d65569-911f-4436-b001-24b146f4050e" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateacfail0pageblobapitestcreateacfailb12938786acdca", "javablobcreateacfail1pageblobapitestcreateacfailb12211935b6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateallnull.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateallnull.json new file mode 100644 index 000000000000..8fca9db0ec97 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateallnull.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateallnull0pageblobapitestcreateallnull02c8773826d2c?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" : "4798bb7a-3ecd-4d00-af32-05e10488dba5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561768B8BBA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb18aa-301e-0042-074a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:20 GMT", + "x-ms-client-request-id" : "4798bb7a-3ecd-4d00-af32-05e10488dba5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateallnull0pageblobapitestcreateallnull02c8773826d2c/javablobcreateallnull1pageblobapitestcreateallnull02c0641752", + "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" : "35672f48-1d59-40b8-bc79-aa65f35a7672" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561769904BA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb18c1-301e-0042-1d4a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:21 GMT", + "x-ms-client-request-id" : "35672f48-1d59-40b8-bc79-aa65f35a7672" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateallnull0pageblobapitestcreateallnull02c8773826d2c/javablobcreateallnull2pageblobapitestcreateallnull02c8204431", + "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" : "60967580-dfb7-4a67-a163-843057444a5c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356176AD7ACF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb18df-301e-0042-394a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:21 GMT", + "x-ms-client-request-id" : "60967580-dfb7-4a67-a163-843057444a5c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateallnull&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" : "88effd55-77f3-43da-a466-437feea83eee" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb18f4-301e-0042-4b4a-67cbbf000000", + "Body" : "jtccreateallnulljtccreateallnull0pageblobapitestcreateallnull02c8773826d2cMon, 09 Sep 2019 20:08:21 GMT\"0x8D73561768B8BBA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:21 GMT", + "x-ms-client-request-id" : "88effd55-77f3-43da-a466-437feea83eee", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateallnull0pageblobapitestcreateallnull02c8773826d2c?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" : "ec2bf8ea-7821-4fa7-969b-668f5145cbd5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb1909-301e-0042-5e4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:21 GMT", + "x-ms-client-request-id" : "ec2bf8ea-7821-4fa7-969b-668f5145cbd5" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateallnull0pageblobapitestcreateallnull02c8773826d2c", "javablobcreateallnull1pageblobapitestcreateallnull02c0641752", "javablobcreateallnull2pageblobapitestcreateallnull02c8204431" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateerror.json new file mode 100644 index 000000000000..7d3fd4efe729 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateerror.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateerror0pageblobapitestcreateerrorb9704694ce041ed?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" : "a344df34-ca12-44f7-b50e-90899ae3d068" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617BC79A69\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb2051-301e-0042-0e4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:29 GMT", + "x-ms-client-request-id" : "a344df34-ca12-44f7-b50e-90899ae3d068" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateerror0pageblobapitestcreateerrorb9704694ce041ed/javablobcreateerror1pageblobapitestcreateerrorb97515277df5", + "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" : "e4a48cd5-fd52-4c2f-b1f2-89abb1e24d48" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617BD47A6B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb206d-301e-0042-264a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:29 GMT", + "x-ms-client-request-id" : "e4a48cd5-fd52-4c2f-b1f2-89abb1e24d48" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateerror0pageblobapitestcreateerrorb9704694ce041ed/javablobcreateerror1pageblobapitestcreateerrorb97515277df5", + "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" : "5543cadd-d03f-4959-90b0-6aade312b9f4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "c5cb2082-301e-0042-3b4a-67cbbf000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:c5cb2082-301e-0042-3b4a-67cbbf000000\nTime:2019-09-09T20:08:30.2624278Zx-ms-lease-idid", + "Date" : "Mon, 09 Sep 2019 20:08:29 GMT", + "x-ms-client-request-id" : "5543cadd-d03f-4959-90b0-6aade312b9f4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateerror&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" : "df34a594-5725-49c4-a5ff-1fc5890103ee" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb2093-301e-0042-4b4a-67cbbf000000", + "Body" : "jtccreateerrorjtccreateerror0pageblobapitestcreateerrorb9704694ce041edMon, 09 Sep 2019 20:08:30 GMT\"0x8D735617BC79A69\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:29 GMT", + "x-ms-client-request-id" : "df34a594-5725-49c4-a5ff-1fc5890103ee", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateerror0pageblobapitestcreateerrorb9704694ce041ed?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" : "d6c20b4d-0a7f-407c-bcbc-e244334cca69" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb20a5-301e-0042-5d4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:29 GMT", + "x-ms-client-request-id" : "d6c20b4d-0a7f-407c-bcbc-e244334cca69" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateerror0pageblobapitestcreateerrorb9704694ce041ed", "javablobcreateerror1pageblobapitestcreateerrorb97515277df5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateheaders[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateheaders[0].json new file mode 100644 index 000000000000..97cd0d39b6c5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateheaders[0].json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders7871088203b25?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" : "ba3e7d3d-b54f-42ba-a265-7ae433f54bac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356177892C61\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1a18-301e-0042-5c4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:22 GMT", + "x-ms-client-request-id" : "ba3e7d3d-b54f-42ba-a265-7ae433f54bac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders7871088203b25/javablobcreateheaders1pageblobapitestcreateheaders7875738261", + "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" : "52913841-f92c-4403-90eb-acd7008d5e3e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356177967ED2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1a31-301e-0042-734a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:22 GMT", + "x-ms-client-request-id" : "52913841-f92c-4403-90eb-acd7008d5e3e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders7871088203b25/javablobcreateheaders1pageblobapitestcreateheaders7875738261", + "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" : "fed3bc7d-8512-49f3-a68a-ae1431ea251c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356177A30436\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1a45-301e-0042-034a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:22 GMT", + "x-ms-client-request-id" : "fed3bc7d-8512-49f3-a68a-ae1431ea251c" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders7871088203b25/javablobcreateheaders1pageblobapitestcreateheaders7875738261", + "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" : "77522664-505d-4021-a17b-788843f68cda" + }, + "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", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:23 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:08:22 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7356177A30436\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:08:23 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "c5cb1a5e-301e-0042-1b4a-67cbbf000000", + "x-ms-client-request-id" : "77522664-505d-4021-a17b-788843f68cda", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateheaders&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" : "fa45731f-ec41-47dd-a46f-33a82a0b34cb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb1a73-301e-0042-2f4a-67cbbf000000", + "Body" : "jtccreateheadersjtccreateheaders0pageblobapitestcreateheaders7871088203b25Mon, 09 Sep 2019 20:08:22 GMT\"0x8D7356177892C61\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:22 GMT", + "x-ms-client-request-id" : "fa45731f-ec41-47dd-a46f-33a82a0b34cb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders7871088203b25?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" : "c7ec488c-810f-4fd6-9163-082c544d3586" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb1a88-301e-0042-414a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:22 GMT", + "x-ms-client-request-id" : "c7ec488c-810f-4fd6-9163-082c544d3586" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateheaders0pageblobapitestcreateheaders7871088203b25", "javablobcreateheaders1pageblobapitestcreateheaders7875738261" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateheaders[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateheaders[1].json new file mode 100644 index 000000000000..d22f805dc71a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreateheaders[1].json @@ -0,0 +1,146 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders00600952432ad?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" : "92515b13-fd1c-420b-9ae6-80934a24886e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356177D89336\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1a99-301e-0042-524a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:23 GMT", + "x-ms-client-request-id" : "92515b13-fd1c-420b-9ae6-80934a24886e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders00600952432ad/javablobcreateheaders1pageblobapitestcreateheaders0069553369", + "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" : "e8bb56a2-2ddb-41f3-87be-3d2a68a13521" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356177E5709D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1aac-301e-0042-634a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:23 GMT", + "x-ms-client-request-id" : "e8bb56a2-2ddb-41f3-87be-3d2a68a13521" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders00600952432ad/javablobcreateheaders1pageblobapitestcreateheaders0069553369", + "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" : "c05b1a1c-9814-47bf-84fa-a90e5abc35a5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356177F2B981\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1ac1-301e-0042-754a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:23 GMT", + "x-ms-client-request-id" : "c05b1a1c-9814-47bf-84fa-a90e5abc35a5" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders00600952432ad/javablobcreateheaders1pageblobapitestcreateheaders0069553369", + "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" : "71a55618-2010-4feb-aba7-c0561f2cca78" + }, + "Response" : { + "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 20:08:23 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "Content-Encoding" : "encoding", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:08:23 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "c5cb1ad5-301e-0042-064a-67cbbf000000", + "Content-Type" : "type", + "x-ms-version" : "2019-02-02", + "x-ms-blob-sequence-number" : "0", + "Date" : "Mon, 09 Sep 2019 20:08:23 GMT", + "Content-MD5" : "d2grV20xOEQwejFENEUrUEUyNTJnZz09", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "control", + "ETag" : "\"0x8D7356177F2B981\"", + "Content-Disposition" : "disposition", + "x-ms-client-request-id" : "71a55618-2010-4feb-aba7-c0561f2cca78", + "Content-Language" : "language" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreateheaders&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" : "490c4a14-f8e4-43e5-a3c3-2797b8f4d5ed" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb1ade-301e-0042-0f4a-67cbbf000000", + "Body" : "jtccreateheadersjtccreateheaders0pageblobapitestcreateheaders00600952432adMon, 09 Sep 2019 20:08:23 GMT\"0x8D7356177D89336\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:23 GMT", + "x-ms-client-request-id" : "490c4a14-f8e4-43e5-a3c3-2797b8f4d5ed", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreateheaders0pageblobapitestcreateheaders00600952432ad?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" : "0547fb76-ddef-4c2b-ab85-0a4dea4f6fdb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb1af7-301e-0042-264a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:23 GMT", + "x-ms-client-request-id" : "0547fb76-ddef-4c2b-ab85-0a4dea4f6fdb" + }, + "Exception" : null + } ], + "variables" : [ "jtccreateheaders0pageblobapitestcreateheaders00600952432ad", "javablobcreateheaders1pageblobapitestcreateheaders0069553369" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatemetadata[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatemetadata[0].json new file mode 100644 index 000000000000..91d575951c0f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatemetadata[0].json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadatade77031524e6?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" : "2e1f16a2-f4f6-408e-b4a9-af5ab4acdac5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617827FA14\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1b0b-301e-0042-374a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:23 GMT", + "x-ms-client-request-id" : "2e1f16a2-f4f6-408e-b4a9-af5ab4acdac5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadatade77031524e6/javablobcreatemetadata1pageblobapitestcreatemetadatade7395607", + "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" : "39d8609d-fb21-441a-8e9e-2b4655744618" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356178357417\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1b2a-301e-0042-554a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:23 GMT", + "x-ms-client-request-id" : "39d8609d-fb21-441a-8e9e-2b4655744618" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadatade77031524e6/javablobcreatemetadata1pageblobapitestcreatemetadatade7395607", + "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" : "bbb679b0-84b5-49db-b348-65b68ef00b98" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617841D26A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1b40-301e-0042-694a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:23 GMT", + "x-ms-client-request-id" : "bbb679b0-84b5-49db-b348-65b68ef00b98" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadatade77031524e6/javablobcreatemetadata1pageblobapitestcreatemetadatade7395607", + "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" : "6a5516eb-3b27-467e-b448-a4fe292554f3" + }, + "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", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:24 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:08:23 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735617841D26A\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:08:24 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "c5cb1b4d-301e-0042-754a-67cbbf000000", + "x-ms-client-request-id" : "6a5516eb-3b27-467e-b448-a4fe292554f3", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreatemetadata&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" : "cdce6e99-b31b-4934-960f-27b17933ef71" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb1b61-301e-0042-064a-67cbbf000000", + "Body" : "jtccreatemetadatajtccreatemetadata0pageblobapitestcreatemetadatade77031524e6Mon, 09 Sep 2019 20:08:24 GMT\"0x8D735617827FA14\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:23 GMT", + "x-ms-client-request-id" : "cdce6e99-b31b-4934-960f-27b17933ef71", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadatade77031524e6?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" : "4d28dcb7-ec9f-4b43-be93-11c6b4bf2c63" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb1b75-301e-0042-164a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:23 GMT", + "x-ms-client-request-id" : "4d28dcb7-ec9f-4b43-be93-11c6b4bf2c63" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemetadata0pageblobapitestcreatemetadatade77031524e6", "javablobcreatemetadata1pageblobapitestcreatemetadatade7395607" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatemetadata[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatemetadata[1].json new file mode 100644 index 000000000000..d326439f84fc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatemetadata[1].json @@ -0,0 +1,143 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadataef7334211abd?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" : "63877ac2-a65c-4198-8c60-3b7b2350471f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617878C0BB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1b8a-301e-0042-294a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:24 GMT", + "x-ms-client-request-id" : "63877ac2-a65c-4198-8c60-3b7b2350471f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadataef7334211abd/javablobcreatemetadata1pageblobapitestcreatemetadataef778105b", + "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" : "c41c3e5c-4ba1-49f1-b773-bb7a2bcb68df" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617885ECCF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1b9b-301e-0042-394a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:24 GMT", + "x-ms-client-request-id" : "c41c3e5c-4ba1-49f1-b773-bb7a2bcb68df" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadataef7334211abd/javablobcreatemetadata1pageblobapitestcreatemetadataef778105b", + "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" : "fccb710f-eb40-4d5f-8512-e19d8e2b89d5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356178924B22\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1ba6-301e-0042-444a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:24 GMT", + "x-ms-client-request-id" : "fccb710f-eb40-4d5f-8512-e19d8e2b89d5" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadataef7334211abd/javablobcreatemetadata1pageblobapitestcreatemetadataef778105b", + "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" : "1fec8fa2-e2ef-4a9d-b0fa-08e1a8588394" + }, + "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", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:24 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:08:24 GMT", + "x-ms-meta-foo" : "bar", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7356178924B22\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:08:24 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "c5cb1bb7-301e-0042-524a-67cbbf000000", + "x-ms-meta-fizz" : "buzz", + "x-ms-client-request-id" : "1fec8fa2-e2ef-4a9d-b0fa-08e1a8588394", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreatemetadata&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" : "40b16dd0-d86a-4ef3-85b7-fd0d2e3e067d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb1bc4-301e-0042-5f4a-67cbbf000000", + "Body" : "jtccreatemetadatajtccreatemetadata0pageblobapitestcreatemetadataef7334211abdMon, 09 Sep 2019 20:08:24 GMT\"0x8D735617878C0BB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:24 GMT", + "x-ms-client-request-id" : "40b16dd0-d86a-4ef3-85b7-fd0d2e3e067d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemetadata0pageblobapitestcreatemetadataef7334211abd?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" : "013f59c7-ef45-4a47-8383-9c5cd24ca4c6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb1bd6-301e-0042-6f4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:24 GMT", + "x-ms-client-request-id" : "013f59c7-ef45-4a47-8383-9c5cd24ca4c6" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemetadata0pageblobapitestcreatemetadataef7334211abd", "javablobcreatemetadata1pageblobapitestcreatemetadataef778105b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatemin.json new file mode 100644 index 000000000000..51d3b3ed3e29 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatemin.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemin0pageblobapitestcreatemind6b51533a4601eeeb?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" : "3a08fe1b-6f08-45e7-87f7-005d405470a9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356176DACB7A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb1923-301e-0042-784a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:21 GMT", + "x-ms-client-request-id" : "3a08fe1b-6f08-45e7-87f7-005d405470a9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemin0pageblobapitestcreatemind6b51533a4601eeeb/javablobcreatemin1pageblobapitestcreatemind6b618092adac1", + "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" : "7b31bfc8-2208-444b-b846-b82bb6310bcb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356176E8B9E2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb193c-301e-0042-104a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:21 GMT", + "x-ms-client-request-id" : "7b31bfc8-2208-444b-b846-b82bb6310bcb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemin0pageblobapitestcreatemind6b51533a4601eeeb/javablobcreatemin1pageblobapitestcreatemind6b618092adac1", + "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" : "5cacc2d8-d5d0-4ca6-96de-a665e5918f28" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356176F4F112\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb195d-301e-0042-2c4a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:21 GMT", + "x-ms-client-request-id" : "5cacc2d8-d5d0-4ca6-96de-a665e5918f28" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreatemin&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" : "c71ea5fe-d663-47ef-bbe9-6f4d90189ca0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb1994-301e-0042-5e4a-67cbbf000000", + "Body" : "jtccreateminjtccreatemin0pageblobapitestcreatemind6b51533a4601eeebMon, 09 Sep 2019 20:08:21 GMT\"0x8D7356176DACB7A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:21 GMT", + "x-ms-client-request-id" : "c71ea5fe-d663-47ef-bbe9-6f4d90189ca0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatemin0pageblobapitestcreatemind6b51533a4601eeeb?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" : "6d3aed86-c1b7-4225-b9ae-d57ad2db4b47" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb19a1-301e-0042-6b4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:21 GMT", + "x-ms-client-request-id" : "6d3aed86-c1b7-4225-b9ae-d57ad2db4b47" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatemin0pageblobapitestcreatemind6b51533a4601eeeb", "javablobcreatemin1pageblobapitestcreatemind6b618092adac1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatesequencenumber.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatesequencenumber.json new file mode 100644 index 000000000000..7309004149a7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestcreatesequencenumber.json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatesequencenumber063132a4f5a5083caa437aa?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" : "83469d8b-ea9d-4a9f-abd9-2c39418c9754" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617734E2A2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb19b8-301e-0042-804a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:21 GMT", + "x-ms-client-request-id" : "83469d8b-ea9d-4a9f-abd9-2c39418c9754" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatesequencenumber063132a4f5a5083caa437aa/javablobcreatesequencenumber13683531e3ab4a686e4d", + "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" : "4d43e25a-4d63-4097-b9e8-1196e76a306d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617741E6A1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb19c4-301e-0042-0b4a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:22 GMT", + "x-ms-client-request-id" : "4d43e25a-4d63-4097-b9e8-1196e76a306d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatesequencenumber063132a4f5a5083caa437aa/javablobcreatesequencenumber13683531e3ab4a686e4d", + "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" : "6a22a165-3675-42c7-89d0-755ef4fa7900" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561774E44F9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb19d4-301e-0042-1b4a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:22 GMT", + "x-ms-client-request-id" : "6a22a165-3675-42c7-89d0-755ef4fa7900" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatesequencenumber063132a4f5a5083caa437aa/javablobcreatesequencenumber13683531e3ab4a686e4d", + "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" : "0635dcbd-e09d-44b6-8bc3-702210c825ca" + }, + "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", + "x-ms-blob-sequence-number" : "2", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:22 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:08:22 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561774E44F9\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:08:22 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "c5cb19eb-301e-0042-2f4a-67cbbf000000", + "x-ms-client-request-id" : "0635dcbd-e09d-44b6-8bc3-702210c825ca", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccreatesequencenumber&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" : "a697cfbf-e714-4e6e-a508-3a7bb537d6cc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb19f8-301e-0042-3c4a-67cbbf000000", + "Body" : "jtccreatesequencenumberjtccreatesequencenumber063132a4f5a5083caa437aaMon, 09 Sep 2019 20:08:22 GMT\"0x8D735617734E2A2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:22 GMT", + "x-ms-client-request-id" : "a697cfbf-e714-4e6e-a508-3a7bb537d6cc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccreatesequencenumber063132a4f5a5083caa437aa?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" : "074817da-d0f0-47bd-99bd-69f61c337a4b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb1a05-301e-0042-494a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:22 GMT", + "x-ms-client-request-id" : "074817da-d0f0-47bd-99bd-69f61c337a4b" + }, + "Exception" : null + } ], + "variables" : [ "jtccreatesequencenumber063132a4f5a5083caa437aa", "javablobcreatesequencenumber13683531e3ab4a686e4d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpageranges.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpageranges.json new file mode 100644 index 000000000000..32effca7fc00 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpageranges.json @@ -0,0 +1,136 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpageranges0pageblobapitestgetpagerangesbfb9342707fa1?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" : "1bbff25d-4afb-42da-9f37-ffa22fd528f7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561960386F6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2d61-501e-003f-344a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:13 GMT", + "x-ms-client-request-id" : "1bbff25d-4afb-42da-9f37-ffa22fd528f7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpageranges0pageblobapitestgetpagerangesbfb9342707fa1/javablobgetpageranges1pageblobapitestgetpagerangesbfb119693b", + "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" : "2c454f26-bb1f-4ed0-9b6b-a6bdf44ccf94" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356196108F96\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2d6e-501e-003f-404a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:13 GMT", + "x-ms-client-request-id" : "2c454f26-bb1f-4ed0-9b6b-a6bdf44ccf94" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpageranges0pageblobapitestgetpagerangesbfb9342707fa1/javablobgetpageranges1pageblobapitestgetpagerangesbfb119693b?comp=page", + "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" : "30f85a05-3e8e-4baf-b4d1-3fc46f7fa97d", + "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" : "3qIHkxw8d1M=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:14 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:13 GMT", + "ETag" : "\"0x8D73561961E26A3\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd2d7e-501e-003f-4b4a-675777000000", + "x-ms-client-request-id" : "30f85a05-3e8e-4baf-b4d1-3fc46f7fa97d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpageranges0pageblobapitestgetpagerangesbfb9342707fa1/javablobgetpageranges1pageblobapitestgetpagerangesbfb119693b?comp=pagelist", + "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" : "601f6175-cb98-4b19-bb88-fc8c151b5061" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:14 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:14 GMT", + "ETag" : "\"0x8D73561961E26A3\"", + "x-ms-request-id" : "9ebd2da2-501e-003f-6b4a-675777000000", + "Body" : "0511", + "x-ms-client-request-id" : "601f6175-cb98-4b19-bb88-fc8c151b5061", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpageranges&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" : "9bdaa971-11ca-46a0-912e-967b6616c03d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd2dd0-501e-003f-134a-675777000000", + "Body" : "jtcgetpagerangesjtcgetpageranges0pageblobapitestgetpagerangesbfb9342707fa1Mon, 09 Sep 2019 20:09:14 GMT\"0x8D73561960386F6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:14 GMT", + "x-ms-client-request-id" : "9bdaa971-11ca-46a0-912e-967b6616c03d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpageranges0pageblobapitestgetpagerangesbfb9342707fa1?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" : "c75022f9-cfc1-4cb8-a713-be10aa994807" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd2dfc-501e-003f-3e4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:14 GMT", + "x-ms-client-request-id" : "c75022f9-cfc1-4cb8-a713-be10aa994807" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpageranges0pageblobapitestgetpagerangesbfb9342707fa1", "javablobgetpageranges1pageblobapitestgetpagerangesbfb119693b", "b3ca202b-c2e1-4236-94cb-fcf8a36e2498" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[0].json new file mode 100644 index 000000000000..bc129ae1b122 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[0].json @@ -0,0 +1,111 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac99454981fdb?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" : "0a97e00a-6550-40be-a150-999299a4df85" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619692250F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2e91-501e-003f-4d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:14 GMT", + "x-ms-client-request-id" : "0a97e00a-6550-40be-a150-999299a4df85" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac99454981fdb/javablobgetpagerangesac1pageblobapitestgetpagerangesac99457339", + "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" : "39b733cf-d1c2-42d4-90f0-da6458b45fba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561969F553D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2ec7-501e-003f-804a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:14 GMT", + "x-ms-client-request-id" : "39b733cf-d1c2-42d4-90f0-da6458b45fba" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac99454981fdb/javablobgetpagerangesac1pageblobapitestgetpagerangesac99457339?comp=pagelist", + "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" : "8f8d5655-e939-4c9c-a07c-f2ab4e836f21" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:15 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:14 GMT", + "ETag" : "\"0x8D73561969F553D\"", + "x-ms-request-id" : "9ebd2ee2-501e-003f-174a-675777000000", + "Body" : "", + "x-ms-client-request-id" : "8f8d5655-e939-4c9c-a07c-f2ab4e836f21", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesac&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" : "cddca50f-6761-43e1-a9de-8f611dd97b2b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd2efd-501e-003f-324a-675777000000", + "Body" : "jtcgetpagerangesacjtcgetpagerangesac0pageblobapitestgetpagerangesac99454981fdbMon, 09 Sep 2019 20:09:15 GMT\"0x8D735619692250F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:14 GMT", + "x-ms-client-request-id" : "cddca50f-6761-43e1-a9de-8f611dd97b2b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac99454981fdb?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" : "e3067b41-b2d9-405e-82d4-0e7868eed2d8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd2f0f-501e-003f-434a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:15 GMT", + "x-ms-client-request-id" : "e3067b41-b2d9-405e-82d4-0e7868eed2d8" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesac0pageblobapitestgetpagerangesac99454981fdb", "javablobgetpagerangesac1pageblobapitestgetpagerangesac99457339" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[1].json new file mode 100644 index 000000000000..4b7804179679 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[1].json @@ -0,0 +1,111 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesacba214131877?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" : "5a3d172e-1328-40b0-a194-6f247769d9c7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356196D35893\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2f1d-501e-003f-514a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:15 GMT", + "x-ms-client-request-id" : "5a3d172e-1328-40b0-a194-6f247769d9c7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesacba214131877/javablobgetpagerangesac1pageblobapitestgetpagerangesacba201446", + "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" : "132eb86c-7280-4a57-8585-489cf6c9c516" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356196E03ABE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2f2a-501e-003f-5d4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:15 GMT", + "x-ms-client-request-id" : "132eb86c-7280-4a57-8585-489cf6c9c516" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesacba214131877/javablobgetpagerangesac1pageblobapitestgetpagerangesacba201446?comp=pagelist", + "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" : "291b83da-d24d-4d5b-bbc0-37e4230a4c6b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:15 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:15 GMT", + "ETag" : "\"0x8D7356196E03ABE\"", + "x-ms-request-id" : "9ebd2f3d-501e-003f-704a-675777000000", + "Body" : "", + "x-ms-client-request-id" : "291b83da-d24d-4d5b-bbc0-37e4230a4c6b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesac&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" : "421c50d3-cc4c-4041-a6da-9fac5eba74e5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd2f4c-501e-003f-7f4a-675777000000", + "Body" : "jtcgetpagerangesacjtcgetpagerangesac0pageblobapitestgetpagerangesacba214131877Mon, 09 Sep 2019 20:09:15 GMT\"0x8D7356196D35893\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:15 GMT", + "x-ms-client-request-id" : "421c50d3-cc4c-4041-a6da-9fac5eba74e5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesacba214131877?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" : "9a56030c-1fa3-4cc5-a9a3-7c481d84128d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd2f5d-501e-003f-104a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:15 GMT", + "x-ms-client-request-id" : "9a56030c-1fa3-4cc5-a9a3-7c481d84128d" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesac0pageblobapitestgetpagerangesacba214131877", "javablobgetpagerangesac1pageblobapitestgetpagerangesacba201446" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[2].json new file mode 100644 index 000000000000..66bc70a361c0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[2].json @@ -0,0 +1,111 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac38718830f40?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" : "5b348a5d-7eb5-488c-953b-a9a642996d28" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561971464DF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2f8e-501e-003f-3f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:15 GMT", + "x-ms-client-request-id" : "5b348a5d-7eb5-488c-953b-a9a642996d28" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac38718830f40/javablobgetpagerangesac1pageblobapitestgetpagerangesac38777411", + "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" : "413d8894-29d3-4465-aaeb-545b42a93b3b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619722A6F6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2fa7-501e-003f-574a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:15 GMT", + "x-ms-client-request-id" : "413d8894-29d3-4465-aaeb-545b42a93b3b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac38718830f40/javablobgetpagerangesac1pageblobapitestgetpagerangesac38777411?comp=pagelist", + "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" : "3492d91f-85c4-4c8f-a3ca-dc8e88667d34" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:15 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:15 GMT", + "ETag" : "\"0x8D735619722A6F6\"", + "x-ms-request-id" : "9ebd2fb2-501e-003f-614a-675777000000", + "Body" : "", + "x-ms-client-request-id" : "3492d91f-85c4-4c8f-a3ca-dc8e88667d34", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesac&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" : "dc470831-6f48-470d-9aa6-34feed34449f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd2fcc-501e-003f-7a4a-675777000000", + "Body" : "jtcgetpagerangesacjtcgetpagerangesac0pageblobapitestgetpagerangesac38718830f40Mon, 09 Sep 2019 20:09:15 GMT\"0x8D73561971464DF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:15 GMT", + "x-ms-client-request-id" : "dc470831-6f48-470d-9aa6-34feed34449f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac38718830f40?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" : "aac94d8e-90e4-4885-8ab1-0dc577e2f096" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd2fe1-501e-003f-0c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:15 GMT", + "x-ms-client-request-id" : "aac94d8e-90e4-4885-8ab1-0dc577e2f096" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesac0pageblobapitestgetpagerangesac38718830f40", "javablobgetpagerangesac1pageblobapitestgetpagerangesac38777411" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[3].json new file mode 100644 index 000000000000..c5c262117a32 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[3].json @@ -0,0 +1,143 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac7f9609344a6?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" : "dbda660d-1261-4e65-9f75-9b565769e530" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619754D4E0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2ff3-501e-003f-1c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:15 GMT", + "x-ms-client-request-id" : "dbda660d-1261-4e65-9f75-9b565769e530" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac7f9609344a6/javablobgetpagerangesac1pageblobapitestgetpagerangesac7f981924", + "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" : "68f23550-bff7-4bcb-ae89-107910bed7dd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619762C8EA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd300e-501e-003f-364a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:16 GMT", + "x-ms-client-request-id" : "68f23550-bff7-4bcb-ae89-107910bed7dd" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac7f9609344a6/javablobgetpagerangesac1pageblobapitestgetpagerangesac7f981924", + "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" : "877ef0d8-c67a-46dd-8dd1-d51345b9a18f" + }, + "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", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:16 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:16 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735619762C8EA\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:09:16 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd3021-501e-003f-474a-675777000000", + "x-ms-client-request-id" : "877ef0d8-c67a-46dd-8dd1-d51345b9a18f", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac7f9609344a6/javablobgetpagerangesac1pageblobapitestgetpagerangesac7f981924?comp=pagelist", + "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" : "757f7bb4-0a6d-410f-8ece-10c753ee7d70" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:16 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:16 GMT", + "ETag" : "\"0x8D735619762C8EA\"", + "x-ms-request-id" : "9ebd3040-501e-003f-644a-675777000000", + "Body" : "", + "x-ms-client-request-id" : "757f7bb4-0a6d-410f-8ece-10c753ee7d70", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesac&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" : "c2db6870-831d-4657-b55e-24c3a4c2bccf" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3050-501e-003f-734a-675777000000", + "Body" : "jtcgetpagerangesacjtcgetpagerangesac0pageblobapitestgetpagerangesac7f9609344a6Mon, 09 Sep 2019 20:09:16 GMT\"0x8D735619754D4E0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:16 GMT", + "x-ms-client-request-id" : "c2db6870-831d-4657-b55e-24c3a4c2bccf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac7f9609344a6?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" : "a6705aa2-5b57-466d-982c-5ea69e1700ca" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3069-501e-003f-094a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:16 GMT", + "x-ms-client-request-id" : "a6705aa2-5b57-466d-982c-5ea69e1700ca" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesac0pageblobapitestgetpagerangesac7f9609344a6", "javablobgetpagerangesac1pageblobapitestgetpagerangesac7f981924" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[4].json new file mode 100644 index 000000000000..8c4310765b3c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[4].json @@ -0,0 +1,111 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac34893378680?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" : "9c21625f-4e94-42d5-b636-c13948cd4dd5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356197A0B8A5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd307a-501e-003f-1a4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:16 GMT", + "x-ms-client-request-id" : "9c21625f-4e94-42d5-b636-c13948cd4dd5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac34893378680/javablobgetpagerangesac1pageblobapitestgetpagerangesac34822785", + "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" : "f754054f-7ad2-4add-8687-5d8e87e09e10" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356197AD9B46\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd308c-501e-003f-294a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:16 GMT", + "x-ms-client-request-id" : "f754054f-7ad2-4add-8687-5d8e87e09e10" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac34893378680/javablobgetpagerangesac1pageblobapitestgetpagerangesac34822785?comp=pagelist", + "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" : "84b4c353-dd3d-4652-9506-bbae0209a3e3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:16 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:16 GMT", + "ETag" : "\"0x8D7356197AD9B46\"", + "x-ms-request-id" : "9ebd3099-501e-003f-364a-675777000000", + "Body" : "", + "x-ms-client-request-id" : "84b4c353-dd3d-4652-9506-bbae0209a3e3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesac&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" : "26a35f87-d0a3-4d3b-85b7-35c096c6e8d8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd30b6-501e-003f-524a-675777000000", + "Body" : "jtcgetpagerangesacjtcgetpagerangesac0pageblobapitestgetpagerangesac34893378680Mon, 09 Sep 2019 20:09:16 GMT\"0x8D7356197A0B8A5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:16 GMT", + "x-ms-client-request-id" : "26a35f87-d0a3-4d3b-85b7-35c096c6e8d8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesac34893378680?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" : "ed24bc50-b9a9-41db-aae7-106f02eeff13" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd30c8-501e-003f-614a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:16 GMT", + "x-ms-client-request-id" : "ed24bc50-b9a9-41db-aae7-106f02eeff13" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesac0pageblobapitestgetpagerangesac34893378680", "javablobgetpagerangesac1pageblobapitestgetpagerangesac34822785" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[5].json new file mode 100644 index 000000000000..08eb545ff9a1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesac[5].json @@ -0,0 +1,133 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesacd53665595a0?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" : "3f18b46a-c75b-4ed8-aed0-376a128edccf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356197E34BE9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd30d3-501e-003f-6c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:16 GMT", + "x-ms-client-request-id" : "3f18b46a-c75b-4ed8-aed0-376a128edccf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesacd53665595a0/javablobgetpagerangesac1pageblobapitestgetpagerangesacd5319621", + "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" : "c0396836-9faa-4c8c-b571-22f97243aaca" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356197F18E96\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd30e3-501e-003f-774a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:17 GMT", + "x-ms-client-request-id" : "c0396836-9faa-4c8c-b571-22f97243aaca" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesacd53665595a0/javablobgetpagerangesac1pageblobapitestgetpagerangesacd5319621?comp=lease", + "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" : "9ce9c348-f38f-4edf-817c-2895ef32839d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356197F18E96\"", + "x-ms-lease-id" : "802fc0b3-9bcc-45cd-ac18-d1c1deac09f5", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd30f9-501e-003f-074a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:17 GMT", + "x-ms-client-request-id" : "9ce9c348-f38f-4edf-817c-2895ef32839d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesacd53665595a0/javablobgetpagerangesac1pageblobapitestgetpagerangesacd5319621?comp=pagelist", + "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" : "81ef8847-9ec4-48f8-8e33-2ef0421e0bf1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:17 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:17 GMT", + "ETag" : "\"0x8D7356197F18E96\"", + "x-ms-request-id" : "9ebd3111-501e-003f-1f4a-675777000000", + "Body" : "", + "x-ms-client-request-id" : "81ef8847-9ec4-48f8-8e33-2ef0421e0bf1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesac&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" : "9e6f16ee-91b5-4031-9637-3c2c7f6c2cad" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3125-501e-003f-324a-675777000000", + "Body" : "jtcgetpagerangesacjtcgetpagerangesac0pageblobapitestgetpagerangesacd53665595a0Mon, 09 Sep 2019 20:09:17 GMT\"0x8D7356197E34BE9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:17 GMT", + "x-ms-client-request-id" : "9e6f16ee-91b5-4031-9637-3c2c7f6c2cad", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesac0pageblobapitestgetpagerangesacd53665595a0?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" : "9f6f78e9-7e95-44d1-83ec-0a5e4048fb6e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3145-501e-003f-504a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:17 GMT", + "x-ms-client-request-id" : "9f6f78e9-7e95-44d1-83ec-0a5e4048fb6e" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesac0pageblobapitestgetpagerangesacd53665595a0", "javablobgetpagerangesac1pageblobapitestgetpagerangesacd5319621" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[0].json new file mode 100644 index 000000000000..f317b3b3d967 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[0].json @@ -0,0 +1,108 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesacfail0350247ff0a28af2da488cb?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" : "51dcd11b-4730-482e-b085-fdf6694e27aa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356198332805\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3152-501e-003f-5c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:17 GMT", + "x-ms-client-request-id" : "51dcd11b-4730-482e-b085-fdf6694e27aa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesacfail0350247ff0a28af2da488cb/javablobgetpagerangesacfail1872919e2c9ed2e45f461", + "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" : "1b5855f0-9475-4cdc-b7ef-c6356c826158" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356198408073\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd316d-501e-003f-754a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:17 GMT", + "x-ms-client-request-id" : "1b5855f0-9475-4cdc-b7ef-c6356c826158" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesacfail0350247ff0a28af2da488cb/javablobgetpagerangesacfail1872919e2c9ed2e45f461?comp=pagelist", + "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" : "40c70fe2-6a6e-4fbc-8321-fbc4e4a1599e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "9ebd3181-501e-003f-094a-675777000000", + "Body" : "", + "Date" : "Mon, 09 Sep 2019 20:09:17 GMT", + "x-ms-client-request-id" : "40c70fe2-6a6e-4fbc-8321-fbc4e4a1599e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesacfail&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" : "d7361fe7-cb2c-4559-aae3-a88d302bd1e7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd318c-501e-003f-124a-675777000000", + "Body" : "jtcgetpagerangesacfailjtcgetpagerangesacfail0350247ff0a28af2da488cbMon, 09 Sep 2019 20:09:17 GMT\"0x8D7356198332805\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:17 GMT", + "x-ms-client-request-id" : "d7361fe7-cb2c-4559-aae3-a88d302bd1e7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesacfail0350247ff0a28af2da488cb?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" : "a9e86dfd-2cdc-4b37-924a-0de1f06ac6e7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd319d-501e-003f-234a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:17 GMT", + "x-ms-client-request-id" : "a9e86dfd-2cdc-4b37-924a-0de1f06ac6e7" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesacfail0350247ff0a28af2da488cb", "javablobgetpagerangesacfail1872919e2c9ed2e45f461" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[1].json new file mode 100644 index 000000000000..326cdee65fb3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[1].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesacfail00975907697c973efb40868?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" : "5564b5b1-1e0f-4bb4-8955-9fd17f369577" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356198751EF1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd31af-501e-003f-334a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:17 GMT", + "x-ms-client-request-id" : "5564b5b1-1e0f-4bb4-8955-9fd17f369577" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesacfail00975907697c973efb40868/javablobgetpagerangesacfail125656d0f07a5b558c466", + "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" : "46507f2e-4f1d-4bb4-a520-17fcbc6d847d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356198822957\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd31bf-501e-003f-414a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:17 GMT", + "x-ms-client-request-id" : "46507f2e-4f1d-4bb4-a520-17fcbc6d847d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesacfail00975907697c973efb40868/javablobgetpagerangesacfail125656d0f07a5b558c466?comp=pagelist", + "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" : "e31b224f-a234-4865-99db-a9f87619118c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd31cd-501e-003f-4f4a-675777000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd31cd-501e-003f-4f4a-675777000000\nTime:2019-09-09T20:09:18.3798004Z", + "Date" : "Mon, 09 Sep 2019 20:09:18 GMT", + "x-ms-client-request-id" : "e31b224f-a234-4865-99db-a9f87619118c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesacfail&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" : "7ba2c1b6-baf8-44bc-9d60-ef4cd8590cbd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd31e3-501e-003f-644a-675777000000", + "Body" : "jtcgetpagerangesacfailjtcgetpagerangesacfail00975907697c973efb40868Mon, 09 Sep 2019 20:09:18 GMT\"0x8D7356198751EF1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:18 GMT", + "x-ms-client-request-id" : "7ba2c1b6-baf8-44bc-9d60-ef4cd8590cbd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesacfail00975907697c973efb40868?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" : "5963c2f2-f244-47ae-8c22-2ecdc08d1571" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd31f3-501e-003f-734a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:18 GMT", + "x-ms-client-request-id" : "5963c2f2-f244-47ae-8c22-2ecdc08d1571" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesacfail00975907697c973efb40868", "javablobgetpagerangesacfail125656d0f07a5b558c466" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[2].json new file mode 100644 index 000000000000..d5ff3c9ef81f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[2].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesacfail000716cd3596148b894ebf9?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" : "c56fe263-cd29-4506-9c13-6ab301fcfbc5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356198B42F37\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3205-501e-003f-054a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:18 GMT", + "x-ms-client-request-id" : "c56fe263-cd29-4506-9c13-6ab301fcfbc5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesacfail000716cd3596148b894ebf9/javablobgetpagerangesacfail1265453e16a0c48cfb446", + "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" : "e9c6fe16-a4ee-44dc-861c-46bea60cec0b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356198DA1D82\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:18 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3248-501e-003f-3e4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:18 GMT", + "x-ms-client-request-id" : "e9c6fe16-a4ee-44dc-861c-46bea60cec0b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesacfail000716cd3596148b894ebf9/javablobgetpagerangesacfail1265453e16a0c48cfb446?comp=pagelist", + "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" : "2cfee5e7-f26e-4d6f-bc55-86818ecb7d23" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd3259-501e-003f-4f4a-675777000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd3259-501e-003f-4f4a-675777000000\nTime:2019-09-09T20:09:18.9562064Z", + "Date" : "Mon, 09 Sep 2019 20:09:18 GMT", + "x-ms-client-request-id" : "2cfee5e7-f26e-4d6f-bc55-86818ecb7d23", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesacfail&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" : "59333746-a08f-40c2-801a-e2cb54ffb6ac" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3270-501e-003f-644a-675777000000", + "Body" : "jtcgetpagerangesacfailjtcgetpagerangesacfail000716cd3596148b894ebf9Mon, 09 Sep 2019 20:09:18 GMT\"0x8D7356198B42F37\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:18 GMT", + "x-ms-client-request-id" : "59333746-a08f-40c2-801a-e2cb54ffb6ac", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesacfail000716cd3596148b894ebf9?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" : "078ac77a-2210-4581-b0e2-e9d786f9fcef" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3282-501e-003f-744a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:18 GMT", + "x-ms-client-request-id" : "078ac77a-2210-4581-b0e2-e9d786f9fcef" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesacfail000716cd3596148b894ebf9", "javablobgetpagerangesacfail1265453e16a0c48cfb446" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[3].json new file mode 100644 index 000000000000..6b89ce395019 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[3].json @@ -0,0 +1,140 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesacfail047887cb38948360394643b?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" : "3afc85ff-e0d1-4534-a693-415fb41177db" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561990E9471\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd329d-501e-003f-084a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:18 GMT", + "x-ms-client-request-id" : "3afc85ff-e0d1-4534-a693-415fb41177db" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesacfail047887cb38948360394643b/javablobgetpagerangesacfail18451251f01990997a401", + "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" : "d0aa5543-9247-42b1-af92-d86fbc0c2153" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561991BC673\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd32be-501e-003f-224a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:18 GMT", + "x-ms-client-request-id" : "d0aa5543-9247-42b1-af92-d86fbc0c2153" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesacfail047887cb38948360394643b/javablobgetpagerangesacfail18451251f01990997a401", + "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" : "2acbfde8-3cbb-443d-9230-17750303a810" + }, + "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", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:19 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:19 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561991BC673\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:09:19 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd32ce-501e-003f-314a-675777000000", + "x-ms-client-request-id" : "2acbfde8-3cbb-443d-9230-17750303a810", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesacfail047887cb38948360394643b/javablobgetpagerangesacfail18451251f01990997a401?comp=pagelist", + "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" : "5f32e302-5f07-4989-8747-3fa3f61bcbc6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "9ebd32eb-501e-003f-4a4a-675777000000", + "Body" : "", + "Date" : "Mon, 09 Sep 2019 20:09:19 GMT", + "x-ms-client-request-id" : "5f32e302-5f07-4989-8747-3fa3f61bcbc6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesacfail&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" : "c9469b98-1962-489e-b734-0a3a4958b313" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3300-501e-003f-5f4a-675777000000", + "Body" : "jtcgetpagerangesacfailjtcgetpagerangesacfail047887cb38948360394643bMon, 09 Sep 2019 20:09:19 GMT\"0x8D73561990E9471\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:19 GMT", + "x-ms-client-request-id" : "c9469b98-1962-489e-b734-0a3a4958b313", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesacfail047887cb38948360394643b?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" : "7f757a85-7818-4583-9225-59d17bc344cf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd330e-501e-003f-6b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:19 GMT", + "x-ms-client-request-id" : "7f757a85-7818-4583-9225-59d17bc344cf" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesacfail047887cb38948360394643b", "javablobgetpagerangesacfail18451251f01990997a401" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[4].json new file mode 100644 index 000000000000..37513a8839fe --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesacfail[4].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesacfail091697e989de5526c64f638?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" : "6fb00e97-bd67-41a2-91bd-8edcfc874ae2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561995A511C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3325-501e-003f-014a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:19 GMT", + "x-ms-client-request-id" : "6fb00e97-bd67-41a2-91bd-8edcfc874ae2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesacfail091697e989de5526c64f638/javablobgetpagerangesacfail175863527dc83598794da", + "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" : "314a7c9e-9c5d-4f58-acc0-ee57857fbab2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356199675C32\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3335-501e-003f-0e4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:19 GMT", + "x-ms-client-request-id" : "314a7c9e-9c5d-4f58-acc0-ee57857fbab2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesacfail091697e989de5526c64f638/javablobgetpagerangesacfail175863527dc83598794da?comp=lease", + "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" : "ec573eaa-c7cd-4369-a258-24e0366d5d55" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356199675C32\"", + "x-ms-lease-id" : "ea3cfae2-f169-499e-aa6e-5f24a2232f8a", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3349-501e-003f-1f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:19 GMT", + "x-ms-client-request-id" : "ec573eaa-c7cd-4369-a258-24e0366d5d55" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesacfail091697e989de5526c64f638/javablobgetpagerangesacfail175863527dc83598794da?comp=pagelist", + "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" : "4f3d92fe-0e5c-4936-8a1c-50b02bbac222" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd3359-501e-003f-2f4a-675777000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:9ebd3359-501e-003f-2f4a-675777000000\nTime:2019-09-09T20:09:19.9659194Z", + "Date" : "Mon, 09 Sep 2019 20:09:19 GMT", + "x-ms-client-request-id" : "4f3d92fe-0e5c-4936-8a1c-50b02bbac222", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesacfail&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" : "ea0d1214-77a4-407e-8bda-5b405282faaf" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3365-501e-003f-3b4a-675777000000", + "Body" : "jtcgetpagerangesacfailjtcgetpagerangesacfail091697e989de5526c64f638Mon, 09 Sep 2019 20:09:19 GMT\"0x8D73561995A511C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:19 GMT", + "x-ms-client-request-id" : "ea0d1214-77a4-407e-8bda-5b405282faaf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesacfail091697e989de5526c64f638?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" : "fd99a007-634f-4aeb-ac96-701ae9b648ac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3371-501e-003f-474a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:19 GMT", + "x-ms-client-request-id" : "fd99a007-634f-4aeb-ac96-701ae9b648ac" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesacfail091697e989de5526c64f638", "javablobgetpagerangesacfail175863527dc83598794da" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiff.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiff.json new file mode 100644 index 000000000000..442aca226cde --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiff.json @@ -0,0 +1,228 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff4ce390967?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" : "407a66e4-6028-4ac9-8ea0-86094a4c0fe3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356199E7B679\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd341b-501e-003f-684a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:20 GMT", + "x-ms-client-request-id" : "407a66e4-6028-4ac9-8ea0-86094a4c0fe3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff4ce390967/javablobgetpagerangesdiff189401340407466a944a75", + "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" : "dccc77b8-d66d-451b-ae20-ca3dc94262e7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356199F51012\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3426-501e-003f-714a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:20 GMT", + "x-ms-client-request-id" : "dccc77b8-d66d-451b-ae20-ca3dc94262e7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff4ce390967/javablobgetpagerangesdiff189401340407466a944a75", + "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" : "aaae462b-8162-480e-9ea6-58944c7d12b3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619A016E6A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd343e-501e-003f-044a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:20 GMT", + "x-ms-client-request-id" : "aaae462b-8162-480e-9ea6-58944c7d12b3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff4ce390967/javablobgetpagerangesdiff189401340407466a944a75?comp=page", + "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" : "887b1ba7-6b40-4cad-9c09-2166e5f22ff2", + "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" : "hlKaUILHBtw=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:20 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:20 GMT", + "ETag" : "\"0x8D735619A12888B\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd3459-501e-003f-1d4a-675777000000", + "x-ms-client-request-id" : "887b1ba7-6b40-4cad-9c09-2166e5f22ff2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff4ce390967/javablobgetpagerangesdiff189401340407466a944a75?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" : "aa77fc58-9400-4578-88be-1da3cb40540d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:21.0050829Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619A12888B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3478-501e-003f-3c4a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:20 GMT", + "x-ms-client-request-id" : "aa77fc58-9400-4578-88be-1da3cb40540d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff4ce390967/javablobgetpagerangesdiff189401340407466a944a75?comp=page", + "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" : "7e2bd2ec-1f4c-451b-8908-516ce9e9617b", + "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" : "6rkWgvS6WjQ=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:21 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:20 GMT", + "ETag" : "\"0x8D735619A2B4536\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd348a-501e-003f-4c4a-675777000000", + "x-ms-client-request-id" : "7e2bd2ec-1f4c-451b-8908-516ce9e9617b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff4ce390967/javablobgetpagerangesdiff189401340407466a944a75?comp=page", + "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" : "c46dcb08-a52f-41f2-bda4-bcb25338c617" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619A37CAA8\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3497-501e-003f-574a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:20 GMT", + "x-ms-client-request-id" : "c46dcb08-a52f-41f2-bda4-bcb25338c617" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff4ce390967/javablobgetpagerangesdiff189401340407466a944a75?prevsnapshot=2019-09-09T20%3a09%3a21.0050829Z&comp=pagelist", + "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" : "fb487598-ea6b-4cb2-a2c2-15d4dbaaa8fe" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "1024", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:21 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:20 GMT", + "ETag" : "\"0x8D735619A37CAA8\"", + "x-ms-request-id" : "9ebd34a2-501e-003f-624a-675777000000", + "Body" : "05115121023", + "x-ms-client-request-id" : "fb487598-ea6b-4cb2-a2c2-15d4dbaaa8fe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesdiff&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" : "43241cd1-a177-4137-bd7d-b8bcc5b21f62" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd34b9-501e-003f-784a-675777000000", + "Body" : "jtcgetpagerangesdiffjtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff4ce390967Mon, 09 Sep 2019 20:09:20 GMT\"0x8D7356199E7B679\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:20 GMT", + "x-ms-client-request-id" : "43241cd1-a177-4137-bd7d-b8bcc5b21f62", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff4ce390967?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" : "4820127c-778f-433e-afa9-14a10ac2eeb9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd34c6-501e-003f-054a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:21 GMT", + "x-ms-client-request-id" : "4820127c-778f-433e-afa9-14a10ac2eeb9" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiff0pageblobapitestgetpagerangesdiff4ce390967", "javablobgetpagerangesdiff189401340407466a944a75", "f1068860-6136-42af-a24c-93b2dd0a4c49", "d7f3d6a9-3140-4dc8-b19f-9e0362656a3b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[0].json new file mode 100644 index 000000000000..8364550a55bd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[0].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac099891c5d9db0e4d5f43aeb?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" : "5292104b-b02d-4ea4-b2e3-80167f764880" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619AC6F42C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3563-501e-003f-154a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:21 GMT", + "x-ms-client-request-id" : "5292104b-b02d-4ea4-b2e3-80167f764880" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac099891c5d9db0e4d5f43aeb/javablobgetpagerangesdiffac153509c3b3e16b3e2c419", + "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" : "1cde77f4-53ee-43a3-a47c-f7b06db2467b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619AD42761\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3573-501e-003f-244a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:21 GMT", + "x-ms-client-request-id" : "1cde77f4-53ee-43a3-a47c-f7b06db2467b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac099891c5d9db0e4d5f43aeb/javablobgetpagerangesdiffac153509c3b3e16b3e2c419?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" : "299695a9-53e9-4d74-959b-7b32bd5706c7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:22.2729934Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619AD42761\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd357f-501e-003f-2f4a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:21 GMT", + "x-ms-client-request-id" : "299695a9-53e9-4d74-959b-7b32bd5706c7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac099891c5d9db0e4d5f43aeb/javablobgetpagerangesdiffac153509c3b3e16b3e2c419?prevsnapshot=2019-09-09T20%3a09%3a22.2729934Z&comp=pagelist", + "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" : "50e266ff-46ea-46d0-803f-340cea40cdd5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:22 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:22 GMT", + "ETag" : "\"0x8D735619AD42761\"", + "x-ms-request-id" : "9ebd3591-501e-003f-414a-675777000000", + "Body" : "", + "x-ms-client-request-id" : "50e266ff-46ea-46d0-803f-340cea40cdd5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesdiffac&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" : "b6f534da-abf3-477f-a2ff-08e91a00d692" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd35a3-501e-003f-524a-675777000000", + "Body" : "jtcgetpagerangesdiffacjtcgetpagerangesdiffac099891c5d9db0e4d5f43aebMon, 09 Sep 2019 20:09:22 GMT\"0x8D735619AC6F42C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:22 GMT", + "x-ms-client-request-id" : "b6f534da-abf3-477f-a2ff-08e91a00d692", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac099891c5d9db0e4d5f43aeb?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" : "91469497-73a4-4794-a5be-3a20f46d7f93" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd35bf-501e-003f-6b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:22 GMT", + "x-ms-client-request-id" : "91469497-73a4-4794-a5be-3a20f46d7f93" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffac099891c5d9db0e4d5f43aeb", "javablobgetpagerangesdiffac153509c3b3e16b3e2c419" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[1].json new file mode 100644 index 000000000000..8f23dcf306d6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[1].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac0863083dd0fb820efb41b09?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" : "ecf5b6a4-32bb-47f2-93e9-5ed2a486330c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619B1289BA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd35db-501e-003f-044a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:22 GMT", + "x-ms-client-request-id" : "ecf5b6a4-32bb-47f2-93e9-5ed2a486330c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac0863083dd0fb820efb41b09/javablobgetpagerangesdiffac1070797d1363bc353f4f6", + "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" : "0b7b8f19-79dd-4e7a-b256-e6f0eb50e6f4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619B1FBD1F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd35ed-501e-003f-144a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:22 GMT", + "x-ms-client-request-id" : "0b7b8f19-79dd-4e7a-b256-e6f0eb50e6f4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac0863083dd0fb820efb41b09/javablobgetpagerangesdiffac1070797d1363bc353f4f6?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" : "af896f84-5a13-462f-85ce-37cc6ee0eb0f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:22.7683462Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619B1FBD1F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd35fd-501e-003f-224a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:22 GMT", + "x-ms-client-request-id" : "af896f84-5a13-462f-85ce-37cc6ee0eb0f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac0863083dd0fb820efb41b09/javablobgetpagerangesdiffac1070797d1363bc353f4f6?prevsnapshot=2019-09-09T20%3a09%3a22.7683462Z&comp=pagelist", + "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" : "c81c1bf5-7ffc-4319-8a28-3e23c9cf5521" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:22 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:22 GMT", + "ETag" : "\"0x8D735619B1FBD1F\"", + "x-ms-request-id" : "9ebd360b-501e-003f-304a-675777000000", + "Body" : "", + "x-ms-client-request-id" : "c81c1bf5-7ffc-4319-8a28-3e23c9cf5521", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesdiffac&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" : "adf3a580-3128-4dc8-8858-83c25cef9c5b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd361c-501e-003f-3f4a-675777000000", + "Body" : "jtcgetpagerangesdiffacjtcgetpagerangesdiffac0863083dd0fb820efb41b09Mon, 09 Sep 2019 20:09:22 GMT\"0x8D735619B1289BA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:22 GMT", + "x-ms-client-request-id" : "adf3a580-3128-4dc8-8858-83c25cef9c5b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac0863083dd0fb820efb41b09?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" : "803d4cc6-d1c2-4fb8-880d-45e4872eaeb3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd362e-501e-003f-4f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:22 GMT", + "x-ms-client-request-id" : "803d4cc6-d1c2-4fb8-880d-45e4872eaeb3" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffac0863083dd0fb820efb41b09", "javablobgetpagerangesdiffac1070797d1363bc353f4f6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[2].json new file mode 100644 index 000000000000..e57c9cc04b68 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[2].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac0883830750472f835c4bbda?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" : "207bef40-a8ca-4b64-81c8-db8e42eac113" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619B601B7E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd363c-501e-003f-5b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:22 GMT", + "x-ms-client-request-id" : "207bef40-a8ca-4b64-81c8-db8e42eac113" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac0883830750472f835c4bbda/javablobgetpagerangesdiffac1794698ddcde0f823042c", + "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" : "9c6b3bb2-6bd4-40e1-af91-0791aed56a78" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619B6D9D2D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd364a-501e-003f-674a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:22 GMT", + "x-ms-client-request-id" : "9c6b3bb2-6bd4-40e1-af91-0791aed56a78" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac0883830750472f835c4bbda/javablobgetpagerangesdiffac1794698ddcde0f823042c?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" : "fc4c51d2-20a2-4524-a82b-a8a1e2b1bc8a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:23.2827125Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619B6D9D2D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd365f-501e-003f-784a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:22 GMT", + "x-ms-client-request-id" : "fc4c51d2-20a2-4524-a82b-a8a1e2b1bc8a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac0883830750472f835c4bbda/javablobgetpagerangesdiffac1794698ddcde0f823042c?prevsnapshot=2019-09-09T20%3a09%3a23.2827125Z&comp=pagelist", + "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" : "2453a44d-a627-46ef-b9a3-6dbb0daca021" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:23 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:23 GMT", + "ETag" : "\"0x8D735619B6D9D2D\"", + "x-ms-request-id" : "9ebd3671-501e-003f-084a-675777000000", + "Body" : "", + "x-ms-client-request-id" : "2453a44d-a627-46ef-b9a3-6dbb0daca021", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesdiffac&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" : "a96d8212-a42b-4a39-b8fd-8680eff9dac8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3681-501e-003f-164a-675777000000", + "Body" : "jtcgetpagerangesdiffacjtcgetpagerangesdiffac0883830750472f835c4bbdaMon, 09 Sep 2019 20:09:23 GMT\"0x8D735619B601B7E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:23 GMT", + "x-ms-client-request-id" : "a96d8212-a42b-4a39-b8fd-8680eff9dac8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac0883830750472f835c4bbda?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" : "3c268bc9-ad47-4920-98fc-4940709ebbd7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd368f-501e-003f-234a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:23 GMT", + "x-ms-client-request-id" : "3c268bc9-ad47-4920-98fc-4940709ebbd7" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffac0883830750472f835c4bbda", "javablobgetpagerangesdiffac1794698ddcde0f823042c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[3].json new file mode 100644 index 000000000000..400c124f0ad2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[3].json @@ -0,0 +1,166 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac0852981f960a0e8044419c8?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" : "75411032-4be7-41b5-9f10-665e06ccc8c2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619BAF3425\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3699-501e-003f-2d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:23 GMT", + "x-ms-client-request-id" : "75411032-4be7-41b5-9f10-665e06ccc8c2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac0852981f960a0e8044419c8/javablobgetpagerangesdiffac159331974eabda7f794c0", + "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" : "18ec7b14-5e1c-496a-b5cb-9037d20a20d3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619BBD526B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd36b6-501e-003f-484a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:23 GMT", + "x-ms-client-request-id" : "18ec7b14-5e1c-496a-b5cb-9037d20a20d3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac0852981f960a0e8044419c8/javablobgetpagerangesdiffac159331974eabda7f794c0?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" : "0248adc4-7e4b-4565-80f1-abd7d8c14d0d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:23.8050864Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619BBD526B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:23 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd36cc-501e-003f-5c4a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:23 GMT", + "x-ms-client-request-id" : "0248adc4-7e4b-4565-80f1-abd7d8c14d0d" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac0852981f960a0e8044419c8/javablobgetpagerangesdiffac159331974eabda7f794c0", + "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" : "0b3c5933-2f0d-4dc2-91d3-efc55c968f55" + }, + "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", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:23 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:23 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735619BBD526B\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:09:23 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd36db-501e-003f-6b4a-675777000000", + "x-ms-client-request-id" : "0b3c5933-2f0d-4dc2-91d3-efc55c968f55", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac0852981f960a0e8044419c8/javablobgetpagerangesdiffac159331974eabda7f794c0?prevsnapshot=2019-09-09T20%3a09%3a23.8050864Z&comp=pagelist", + "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" : "029774da-0be2-4bc8-8da5-4014be020a43" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:23 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:23 GMT", + "ETag" : "\"0x8D735619BBD526B\"", + "x-ms-request-id" : "9ebd36f0-501e-003f-804a-675777000000", + "Body" : "", + "x-ms-client-request-id" : "029774da-0be2-4bc8-8da5-4014be020a43", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesdiffac&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" : "70bcac31-7960-4d6e-aad7-983fe7192a38" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd36fe-501e-003f-0e4a-675777000000", + "Body" : "jtcgetpagerangesdiffacjtcgetpagerangesdiffac0852981f960a0e8044419c8Mon, 09 Sep 2019 20:09:23 GMT\"0x8D735619BAF3425\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:23 GMT", + "x-ms-client-request-id" : "70bcac31-7960-4d6e-aad7-983fe7192a38", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac0852981f960a0e8044419c8?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" : "b48e1e17-34f0-4280-bfe5-5084e79b4f92" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3720-501e-003f-2c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:23 GMT", + "x-ms-client-request-id" : "b48e1e17-34f0-4280-bfe5-5084e79b4f92" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffac0852981f960a0e8044419c8", "javablobgetpagerangesdiffac159331974eabda7f794c0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[4].json new file mode 100644 index 000000000000..67225ce935ab --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[4].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac0219033131fbe2fabb4d0a9?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" : "2efc91da-052d-415f-9915-66e47d2123fb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619C099975\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3738-501e-003f-414a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:23 GMT", + "x-ms-client-request-id" : "2efc91da-052d-415f-9915-66e47d2123fb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac0219033131fbe2fabb4d0a9/javablobgetpagerangesdiffac11966690e92943bc15437", + "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" : "ea60e1ff-3737-42f5-92b2-82c6eaad05c3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619C16F492\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd374d-501e-003f-514a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:23 GMT", + "x-ms-client-request-id" : "ea60e1ff-3737-42f5-92b2-82c6eaad05c3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac0219033131fbe2fabb4d0a9/javablobgetpagerangesdiffac11966690e92943bc15437?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" : "3eccc0cb-0d70-46c3-8942-b927ec1a71da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:24.3885064Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619C16F492\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3758-501e-003f-5c4a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:24 GMT", + "x-ms-client-request-id" : "3eccc0cb-0d70-46c3-8942-b927ec1a71da" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac0219033131fbe2fabb4d0a9/javablobgetpagerangesdiffac11966690e92943bc15437?prevsnapshot=2019-09-09T20%3a09%3a24.3885064Z&comp=pagelist", + "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" : "f38861c8-3b99-4d76-b255-fde2b29decbf" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:24 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:24 GMT", + "ETag" : "\"0x8D735619C16F492\"", + "x-ms-request-id" : "9ebd3768-501e-003f-6c4a-675777000000", + "Body" : "", + "x-ms-client-request-id" : "f38861c8-3b99-4d76-b255-fde2b29decbf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesdiffac&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" : "554aeec0-00f7-4638-a2d5-c0f019ab38d2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd377c-501e-003f-7d4a-675777000000", + "Body" : "jtcgetpagerangesdiffacjtcgetpagerangesdiffac0219033131fbe2fabb4d0a9Mon, 09 Sep 2019 20:09:24 GMT\"0x8D735619C099975\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:24 GMT", + "x-ms-client-request-id" : "554aeec0-00f7-4638-a2d5-c0f019ab38d2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac0219033131fbe2fabb4d0a9?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" : "c8c8a8b8-66a1-41d9-951b-71170a37ba3f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3790-501e-003f-114a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:24 GMT", + "x-ms-client-request-id" : "c8c8a8b8-66a1-41d9-951b-71170a37ba3f" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffac0219033131fbe2fabb4d0a9", "javablobgetpagerangesdiffac11966690e92943bc15437" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[5].json new file mode 100644 index 000000000000..0c562a23d146 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffac[5].json @@ -0,0 +1,156 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac07248546cbf26372254dbea?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" : "08e513bf-d8c0-4400-84fd-4d1f936bdb4a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619C583CD5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd37a7-501e-003f-274a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:24 GMT", + "x-ms-client-request-id" : "08e513bf-d8c0-4400-84fd-4d1f936bdb4a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac07248546cbf26372254dbea/javablobgetpagerangesdiffac160346cc1f166d5bcf4b9", + "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" : "bc83b25d-fb35-42e2-90b8-e0e235ed6a65" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619C665BAA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd37c1-501e-003f-3e4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:24 GMT", + "x-ms-client-request-id" : "bc83b25d-fb35-42e2-90b8-e0e235ed6a65" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac07248546cbf26372254dbea/javablobgetpagerangesdiffac160346cc1f166d5bcf4b9?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" : "d86a1980-fa76-4c33-a5b1-b7b45c7faff4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:24.9128820Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619C665BAA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd37d4-501e-003f-514a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:24 GMT", + "x-ms-client-request-id" : "d86a1980-fa76-4c33-a5b1-b7b45c7faff4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac07248546cbf26372254dbea/javablobgetpagerangesdiffac160346cc1f166d5bcf4b9?comp=lease", + "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" : "09351df6-e9ef-4892-8b55-7f2d51157430" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619C665BAA\"", + "x-ms-lease-id" : "3459f470-6375-4931-9e16-7f8df806efed", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd37e2-501e-003f-5f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:24 GMT", + "x-ms-client-request-id" : "09351df6-e9ef-4892-8b55-7f2d51157430" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac07248546cbf26372254dbea/javablobgetpagerangesdiffac160346cc1f166d5bcf4b9?prevsnapshot=2019-09-09T20%3a09%3a24.9128820Z&comp=pagelist", + "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" : "2b471d97-5561-481e-b1dc-55c8d8575855" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:24 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:24 GMT", + "ETag" : "\"0x8D735619C665BAA\"", + "x-ms-request-id" : "9ebd37ff-501e-003f-794a-675777000000", + "Body" : "", + "x-ms-client-request-id" : "2b471d97-5561-481e-b1dc-55c8d8575855", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesdiffac&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" : "1cb6a1f1-6a64-4162-8815-fc52407d5e58" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3818-501e-003f-104a-675777000000", + "Body" : "jtcgetpagerangesdiffacjtcgetpagerangesdiffac07248546cbf26372254dbeaMon, 09 Sep 2019 20:09:24 GMT\"0x8D735619C583CD5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:24 GMT", + "x-ms-client-request-id" : "1cb6a1f1-6a64-4162-8815-fc52407d5e58", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffac07248546cbf26372254dbea?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" : "cf89a3ed-f7e2-422e-ac30-987e822c4ce7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd382c-501e-003f-214a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:24 GMT", + "x-ms-client-request-id" : "cf89a3ed-f7e2-422e-ac30-987e822c4ce7" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffac07248546cbf26372254dbea", "javablobgetpagerangesdiffac160346cc1f166d5bcf4b9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[0].json new file mode 100644 index 000000000000..437338c815ce --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[0].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail0809779946accfff2e418?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" : "daf0a63c-c4cb-4fd5-8a9d-bf25da08acb9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619CB38CB0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3843-501e-003f-384a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:24 GMT", + "x-ms-client-request-id" : "daf0a63c-c4cb-4fd5-8a9d-bf25da08acb9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail0809779946accfff2e418/javablobgetpagerangesdiffacfail1964085c9dca0c41c34", + "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" : "882fee8b-aec5-474e-9ec3-39ecb94e1d03" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619CC1ABD2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3852-501e-003f-444a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:25 GMT", + "x-ms-client-request-id" : "882fee8b-aec5-474e-9ec3-39ecb94e1d03" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail0809779946accfff2e418/javablobgetpagerangesdiffacfail1964085c9dca0c41c34?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" : "8d7983b7-7872-43fc-b23e-2f7af58226cb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:25.5083097Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619CC1ABD2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3860-501e-003f-4f4a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:25 GMT", + "x-ms-client-request-id" : "8d7983b7-7872-43fc-b23e-2f7af58226cb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail0809779946accfff2e418/javablobgetpagerangesdiffacfail1964085c9dca0c41c34?prevsnapshot=2019-09-09T20%3a09%3a25.5083097Z&comp=pagelist", + "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" : "21ca4185-8212-429d-be97-23cabfb849cf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "9ebd3877-501e-003f-634a-675777000000", + "Body" : "", + "Date" : "Mon, 09 Sep 2019 20:09:25 GMT", + "x-ms-client-request-id" : "21ca4185-8212-429d-be97-23cabfb849cf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesdiffacfail&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" : "322f4af5-106a-41c5-bea2-2744b4129ac6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd388c-501e-003f-784a-675777000000", + "Body" : "jtcgetpagerangesdiffacfailjtcgetpagerangesdiffacfail0809779946accfff2e418Mon, 09 Sep 2019 20:09:25 GMT\"0x8D735619CB38CB0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:25 GMT", + "x-ms-client-request-id" : "322f4af5-106a-41c5-bea2-2744b4129ac6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail0809779946accfff2e418?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" : "7e4c30a8-ce43-4480-9f25-fbfb4c01f202" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd38a2-501e-003f-0b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:25 GMT", + "x-ms-client-request-id" : "7e4c30a8-ce43-4480-9f25-fbfb4c01f202" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffacfail0809779946accfff2e418", "javablobgetpagerangesdiffacfail1964085c9dca0c41c34" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[1].json new file mode 100644 index 000000000000..6c11f28edd20 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[1].json @@ -0,0 +1,132 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail00344099f088a6118441a?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" : "af5e1630-9724-479e-80ec-6c8d089cf0aa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619D038FE0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd38b4-501e-003f-1c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:25 GMT", + "x-ms-client-request-id" : "af5e1630-9724-479e-80ec-6c8d089cf0aa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail00344099f088a6118441a/javablobgetpagerangesdiffacfail1047598c8ec9150b5b4", + "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" : "7d5e5b71-5152-449c-adf3-38628d642a39" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619D11AF47\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd38c6-501e-003f-2b4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:25 GMT", + "x-ms-client-request-id" : "7d5e5b71-5152-449c-adf3-38628d642a39" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail00344099f088a6118441a/javablobgetpagerangesdiffacfail1047598c8ec9150b5b4?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" : "7ab76a26-8428-4a93-9720-9af03d66e93c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:26.0356881Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619D11AF47\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:25 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd38de-501e-003f-414a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:25 GMT", + "x-ms-client-request-id" : "7ab76a26-8428-4a93-9720-9af03d66e93c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail00344099f088a6118441a/javablobgetpagerangesdiffacfail1047598c8ec9150b5b4?prevsnapshot=2019-09-09T20%3a09%3a26.0356881Z&comp=pagelist", + "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" : "bcabbb28-9a0a-4142-9013-7085932b512f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd38f3-501e-003f-534a-675777000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd38f3-501e-003f-534a-675777000000\nTime:2019-09-09T20:09:26.1202583Z", + "Date" : "Mon, 09 Sep 2019 20:09:25 GMT", + "x-ms-client-request-id" : "bcabbb28-9a0a-4142-9013-7085932b512f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesdiffacfail&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" : "f587799a-f692-4f52-9683-a14c82917a8e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3902-501e-003f-624a-675777000000", + "Body" : "jtcgetpagerangesdiffacfailjtcgetpagerangesdiffacfail00344099f088a6118441aMon, 09 Sep 2019 20:09:25 GMT\"0x8D735619D038FE0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:25 GMT", + "x-ms-client-request-id" : "f587799a-f692-4f52-9683-a14c82917a8e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail00344099f088a6118441a?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" : "a0ea1f9d-8088-4318-b2fc-cb6243c23f76" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3920-501e-003f-804a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:25 GMT", + "x-ms-client-request-id" : "a0ea1f9d-8088-4318-b2fc-cb6243c23f76" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffacfail00344099f088a6118441a", "javablobgetpagerangesdiffacfail1047598c8ec9150b5b4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[2].json new file mode 100644 index 000000000000..4d776964d95a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[2].json @@ -0,0 +1,132 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail002069418166ac966c4a4?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" : "b9f3d495-a163-4c3a-bcbb-cab801661c25" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619D547DA0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd392e-501e-003f-0e4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:26 GMT", + "x-ms-client-request-id" : "b9f3d495-a163-4c3a-bcbb-cab801661c25" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail002069418166ac966c4a4/javablobgetpagerangesdiffacfail18049968abb5f92c974", + "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" : "15a34cc3-4a42-4d73-8493-70f163e93686" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619D629D41\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd393c-501e-003f-1a4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:26 GMT", + "x-ms-client-request-id" : "15a34cc3-4a42-4d73-8493-70f163e93686" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail002069418166ac966c4a4/javablobgetpagerangesdiffacfail18049968abb5f92c974?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" : "be2b5602-47e8-40c2-9989-04ba6e687e48" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:26.5650672Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619D629D41\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd394e-501e-003f-2c4a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:26 GMT", + "x-ms-client-request-id" : "be2b5602-47e8-40c2-9989-04ba6e687e48" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail002069418166ac966c4a4/javablobgetpagerangesdiffacfail18049968abb5f92c974?prevsnapshot=2019-09-09T20%3a09%3a26.5650672Z&comp=pagelist", + "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" : "1f86143a-f2df-4b60-8f47-9176f5731cdf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd395c-501e-003f-3a4a-675777000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd395c-501e-003f-3a4a-675777000000\nTime:2019-09-09T20:09:26.6446271Z", + "Date" : "Mon, 09 Sep 2019 20:09:26 GMT", + "x-ms-client-request-id" : "1f86143a-f2df-4b60-8f47-9176f5731cdf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesdiffacfail&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" : "9f46469c-187f-4d16-a5bd-b9fa1a5b12b0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3972-501e-003f-4d4a-675777000000", + "Body" : "jtcgetpagerangesdiffacfailjtcgetpagerangesdiffacfail002069418166ac966c4a4Mon, 09 Sep 2019 20:09:26 GMT\"0x8D735619D547DA0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:26 GMT", + "x-ms-client-request-id" : "9f46469c-187f-4d16-a5bd-b9fa1a5b12b0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail002069418166ac966c4a4?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" : "1217deb3-745a-4567-b197-67b4392575bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3988-501e-003f-5e4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:26 GMT", + "x-ms-client-request-id" : "1217deb3-745a-4567-b197-67b4392575bf" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffacfail002069418166ac966c4a4", "javablobgetpagerangesdiffacfail18049968abb5f92c974" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[3].json new file mode 100644 index 000000000000..e8c5325b1574 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[3].json @@ -0,0 +1,163 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail062620a413a1456599458?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" : "e510ff95-3d9c-47be-bd67-a67b6eadc57f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619DA3BD57\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd39a8-501e-003f-7b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:26 GMT", + "x-ms-client-request-id" : "e510ff95-3d9c-47be-bd67-a67b6eadc57f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail062620a413a1456599458/javablobgetpagerangesdiffacfail1159874c1250c2584e4", + "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" : "0f7a1488-cb15-4c73-99ed-c7bf11d1ad73" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619DB119AB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd39b5-501e-003f-074a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:26 GMT", + "x-ms-client-request-id" : "0f7a1488-cb15-4c73-99ed-c7bf11d1ad73" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail062620a413a1456599458/javablobgetpagerangesdiffacfail1159874c1250c2584e4?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" : "7e20ac8f-cda8-41a6-9fdf-c193593f09ca" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:27.0764311Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619DB119AB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:26 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd39d7-501e-003f-284a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:26 GMT", + "x-ms-client-request-id" : "7e20ac8f-cda8-41a6-9fdf-c193593f09ca" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail062620a413a1456599458/javablobgetpagerangesdiffacfail1159874c1250c2584e4", + "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" : "5e0dc977-cb8b-4a1f-b2e7-73e394ed68f7" + }, + "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", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:26 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:26 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735619DB119AB\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:09:26 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd39ee-501e-003f-3f4a-675777000000", + "x-ms-client-request-id" : "5e0dc977-cb8b-4a1f-b2e7-73e394ed68f7", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail062620a413a1456599458/javablobgetpagerangesdiffacfail1159874c1250c2584e4?prevsnapshot=2019-09-09T20%3a09%3a27.0764311Z&comp=pagelist", + "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" : "643068f2-df13-4435-984f-d3e377b712de" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "9ebd3a04-501e-003f-514a-675777000000", + "Body" : "", + "Date" : "Mon, 09 Sep 2019 20:09:26 GMT", + "x-ms-client-request-id" : "643068f2-df13-4435-984f-d3e377b712de", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesdiffacfail&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" : "a8847077-545c-42ff-89f7-cf0869a4bcb2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3a16-501e-003f-634a-675777000000", + "Body" : "jtcgetpagerangesdiffacfailjtcgetpagerangesdiffacfail062620a413a1456599458Mon, 09 Sep 2019 20:09:26 GMT\"0x8D735619DA3BD57\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:26 GMT", + "x-ms-client-request-id" : "a8847077-545c-42ff-89f7-cf0869a4bcb2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail062620a413a1456599458?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" : "4fa94358-1b28-4982-9d43-a6e58d24a3a0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3a27-501e-003f-724a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:27 GMT", + "x-ms-client-request-id" : "4fa94358-1b28-4982-9d43-a6e58d24a3a0" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffacfail062620a413a1456599458", "javablobgetpagerangesdiffacfail1159874c1250c2584e4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[4].json new file mode 100644 index 000000000000..04b66a5e682f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffacfail[4].json @@ -0,0 +1,154 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail053248d197008f228446e?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" : "1d4dc706-7911-416b-9cbd-115aaa7175ec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619DFD3822\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3a3e-501e-003f-074a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:27 GMT", + "x-ms-client-request-id" : "1d4dc706-7911-416b-9cbd-115aaa7175ec" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail053248d197008f228446e/javablobgetpagerangesdiffacfail1706459e197521fe964", + "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" : "26e0d740-59ea-4851-b155-83d1a03ca220" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619E0A1F5B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3a50-501e-003f-174a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:27 GMT", + "x-ms-client-request-id" : "26e0d740-59ea-4851-b155-83d1a03ca220" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail053248d197008f228446e/javablobgetpagerangesdiffacfail1706459e197521fe964?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" : "868c849c-1cce-4306-a126-ddd12e82aa95" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:27.6608482Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619E0A1F5B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3a67-501e-003f-2d4a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:27 GMT", + "x-ms-client-request-id" : "868c849c-1cce-4306-a126-ddd12e82aa95" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail053248d197008f228446e/javablobgetpagerangesdiffacfail1706459e197521fe964?comp=lease", + "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" : "6f2025b6-3290-4b85-a61e-386cb5edfaf0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619E0A1F5B\"", + "x-ms-lease-id" : "036cd24c-7740-4b0d-b43a-6bdb287801c1", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3a77-501e-003f-3c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:27 GMT", + "x-ms-client-request-id" : "6f2025b6-3290-4b85-a61e-386cb5edfaf0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail053248d197008f228446e/javablobgetpagerangesdiffacfail1706459e197521fe964?prevsnapshot=2019-09-09T20%3a09%3a27.6608482Z&comp=pagelist", + "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" : "7fbcc4bf-efae-41a8-a6e6-72bcf6172e17" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd3a88-501e-003f-4d4a-675777000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:9ebd3a88-501e-003f-4d4a-675777000000\nTime:2019-09-09T20:09:27.8254600Z", + "Date" : "Mon, 09 Sep 2019 20:09:27 GMT", + "x-ms-client-request-id" : "7fbcc4bf-efae-41a8-a6e6-72bcf6172e17", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesdiffacfail&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" : "e3fd0350-7da3-43b8-9481-44210648a207" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3a94-501e-003f-594a-675777000000", + "Body" : "jtcgetpagerangesdiffacfailjtcgetpagerangesdiffacfail053248d197008f228446eMon, 09 Sep 2019 20:09:27 GMT\"0x8D735619DFD3822\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:27 GMT", + "x-ms-client-request-id" : "e3fd0350-7da3-43b8-9481-44210648a207", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffacfail053248d197008f228446e?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" : "5a245b68-c0a9-42de-86b9-286d9439ac75" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3aa3-501e-003f-674a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:27 GMT", + "x-ms-client-request-id" : "5a245b68-c0a9-42de-86b9-286d9439ac75" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffacfail053248d197008f228446e", "javablobgetpagerangesdiffacfail1706459e197521fe964" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdifferror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdifferror.json new file mode 100644 index 000000000000..9e13ae768ba9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdifferror.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdifferror056319f92e424fb81a4447?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" : "9dea7065-0087-41b6-80fe-3673ba91e166" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619E579D77\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3abc-501e-003f-7f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:27 GMT", + "x-ms-client-request-id" : "9dea7065-0087-41b6-80fe-3673ba91e166" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdifferror056319f92e424fb81a4447/javablobgetpagerangesdifferror136111d72d545e180e4", + "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" : "ffbf4bab-c26c-46fa-98fb-18393a87ed96" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619E64D32C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3acf-501e-003f-0f4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:27 GMT", + "x-ms-client-request-id" : "ffbf4bab-c26c-46fa-98fb-18393a87ed96" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdifferror056319f92e424fb81a4447/javablobgetpagerangesdifferror29547975fb84068b334?prevsnapshot=snapshot&comp=pagelist", + "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" : "0eb9f595-d1e2-40fa-ba37-b494313e8be5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "444", + "StatusCode" : "400", + "x-ms-request-id" : "9ebd3ae4-501e-003f-234a-675777000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:9ebd3ae4-501e-003f-234a-675777000000\nTime:2019-09-09T20:09:28.2537615ZprevsnapshotsnapshotMust be in the specific snapshot date time format.", + "Date" : "Mon, 09 Sep 2019 20:09:27 GMT", + "x-ms-client-request-id" : "0eb9f595-d1e2-40fa-ba37-b494313e8be5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesdifferror&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" : "ed1440f6-28aa-47b8-a6e6-9421de55d864" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3af2-501e-003f-314a-675777000000", + "Body" : "jtcgetpagerangesdifferrorjtcgetpagerangesdifferror056319f92e424fb81a4447Mon, 09 Sep 2019 20:09:28 GMT\"0x8D735619E579D77\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:27 GMT", + "x-ms-client-request-id" : "ed1440f6-28aa-47b8-a6e6-9421de55d864", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdifferror056319f92e424fb81a4447?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" : "67e29622-3c68-4344-9be6-46c448e14b78" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3b03-501e-003f-404a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:28 GMT", + "x-ms-client-request-id" : "67e29622-3c68-4344-9be6-46c448e14b78" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdifferror056319f92e424fb81a4447", "javablobgetpagerangesdifferror136111d72d545e180e4", "javablobgetpagerangesdifferror29547975fb84068b334" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffmin.json new file mode 100644 index 000000000000..14c4d4f11609 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesdiffmin.json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffmin049348de12910a3c9e4c339?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" : "1c599649-e27b-42b7-8efd-9c07378155fe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619A72F89B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd34e8-501e-003f-264a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:21 GMT", + "x-ms-client-request-id" : "1c599649-e27b-42b7-8efd-9c07378155fe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffmin049348de12910a3c9e4c339/javablobgetpagerangesdiffmin11733437b76d3adf6441", + "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" : "3bbaed33-4452-47e1-99dd-e81d58e40b9c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619A80EF07\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3500-501e-003f-3b4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:21 GMT", + "x-ms-client-request-id" : "3bbaed33-4452-47e1-99dd-e81d58e40b9c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffmin049348de12910a3c9e4c339/javablobgetpagerangesdiffmin11733437b76d3adf6441?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" : "1ec9e04c-bcf1-4a4b-9807-36b7247f6315" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:21.7286025Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619A80EF07\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:21 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3512-501e-003f-4c4a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:21 GMT", + "x-ms-client-request-id" : "1ec9e04c-bcf1-4a4b-9807-36b7247f6315" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffmin049348de12910a3c9e4c339/javablobgetpagerangesdiffmin11733437b76d3adf6441?prevsnapshot=2019-09-09T20%3a09%3a21.7286025Z&comp=pagelist", + "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" : "6343c425-24a2-4ca2-9515-d85c09c03b1a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:21 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:21 GMT", + "ETag" : "\"0x8D735619A80EF07\"", + "x-ms-request-id" : "9ebd3525-501e-003f-5d4a-675777000000", + "Body" : "", + "x-ms-client-request-id" : "6343c425-24a2-4ca2-9515-d85c09c03b1a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesdiffmin&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" : "343f74d6-c000-4e5a-92ac-48acc6fdea25" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3532-501e-003f-684a-675777000000", + "Body" : "jtcgetpagerangesdiffminjtcgetpagerangesdiffmin049348de12910a3c9e4c339Mon, 09 Sep 2019 20:09:21 GMT\"0x8D735619A72F89B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:21 GMT", + "x-ms-client-request-id" : "343f74d6-c000-4e5a-92ac-48acc6fdea25", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesdiffmin049348de12910a3c9e4c339?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" : "2ded10ed-5135-451e-9cd6-acd14f4690f3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3544-501e-003f-784a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:21 GMT", + "x-ms-client-request-id" : "2ded10ed-5135-451e-9cd6-acd14f4690f3" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesdiffmin049348de12910a3c9e4c339", "javablobgetpagerangesdiffmin11733437b76d3adf6441" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangeserror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangeserror.json new file mode 100644 index 000000000000..e1d92585081e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangeserror.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangeserror036324e539faa80a714dfcbd?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" : "dd7b87e2-7142-4f74-90d2-33954b9e7b3e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356199A65BF6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd337f-501e-003f-534a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:19 GMT", + "x-ms-client-request-id" : "dd7b87e2-7142-4f74-90d2-33954b9e7b3e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangeserror036324e539faa80a714dfcbd/javablobgetpagerangeserror184628c053b1ca4d114b6", + "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" : "27176502-7478-4270-8ad9-511c76905690" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356199B3400D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:20 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd338e-501e-003f-5f4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:19 GMT", + "x-ms-client-request-id" : "27176502-7478-4270-8ad9-511c76905690" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangeserror036324e539faa80a714dfcbd/javablobgetpagerangeserror2399116d285f0e149b4e9?comp=pagelist", + "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" : "47d1e9b8-47e5-4675-bde5-5411f42a2d53" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "BlobNotFound", + "retry-after" : "0", + "Content-Length" : "215", + "StatusCode" : "404", + "x-ms-request-id" : "9ebd33b5-501e-003f-034a-675777000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:9ebd33b5-501e-003f-034a-675777000000\nTime:2019-09-09T20:09:20.3812115Z", + "Date" : "Mon, 09 Sep 2019 20:09:20 GMT", + "x-ms-client-request-id" : "47d1e9b8-47e5-4675-bde5-5411f42a2d53", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangeserror&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" : "1fb9d45d-1de1-4831-a272-4068bcb1a656" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd33ce-501e-003f-1c4a-675777000000", + "Body" : "jtcgetpagerangeserrorjtcgetpagerangeserror036324e539faa80a714dfcbdMon, 09 Sep 2019 20:09:20 GMT\"0x8D7356199A65BF6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:20 GMT", + "x-ms-client-request-id" : "1fb9d45d-1de1-4831-a272-4068bcb1a656", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangeserror036324e539faa80a714dfcbd?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" : "8805135d-6627-4577-bca3-6c74f02d645a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd33f2-501e-003f-404a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:20 GMT", + "x-ms-client-request-id" : "8805135d-6627-4577-bca3-6c74f02d645a" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangeserror036324e539faa80a714dfcbd", "javablobgetpagerangeserror184628c053b1ca4d114b6", "javablobgetpagerangeserror2399116d285f0e149b4e9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesmin.json new file mode 100644 index 000000000000..e02683fa1332 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestgetpagerangesmin.json @@ -0,0 +1,111 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesmin0pageblobapitestgetpagerangesmindb97201941?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" : "cdb02373-8b32-4fde-9309-f15c00eeb286" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619652EDC6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2e18-501e-003f-594a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:14 GMT", + "x-ms-client-request-id" : "cdb02373-8b32-4fde-9309-f15c00eeb286" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesmin0pageblobapitestgetpagerangesmindb97201941/javablobgetpagerangesmin151055ea1b69d232db4a49", + "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" : "6b538fa1-ea17-4594-97dd-7373689e6cf7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561966044D8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2e2a-501e-003f-6a4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:14 GMT", + "x-ms-client-request-id" : "6b538fa1-ea17-4594-97dd-7373689e6cf7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesmin0pageblobapitestgetpagerangesmindb97201941/javablobgetpagerangesmin151055ea1b69d232db4a49?comp=pagelist", + "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" : "a942589b-c9cf-439c-a633-d68ba4dee165" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-content-length" : "512", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:14 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:14 GMT", + "ETag" : "\"0x8D73561966044D8\"", + "x-ms-request-id" : "9ebd2e38-501e-003f-784a-675777000000", + "Body" : "", + "x-ms-client-request-id" : "a942589b-c9cf-439c-a633-d68ba4dee165", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpagerangesmin&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" : "ca73fc14-f325-4b3b-a342-0ff7dd13d892" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd2e4f-501e-003f-0b4a-675777000000", + "Body" : "jtcgetpagerangesminjtcgetpagerangesmin0pageblobapitestgetpagerangesmindb97201941Mon, 09 Sep 2019 20:09:14 GMT\"0x8D735619652EDC6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:14 GMT", + "x-ms-client-request-id" : "ca73fc14-f325-4b3b-a342-0ff7dd13d892", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpagerangesmin0pageblobapitestgetpagerangesmindb97201941?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" : "b93def41-55ee-4a1d-b967-724e6c473852" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd2e6f-501e-003f-2b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:14 GMT", + "x-ms-client-request-id" : "b93def41-55ee-4a1d-b967-724e6c473852" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpagerangesmin0pageblobapitestgetpagerangesmindb97201941", "javablobgetpagerangesmin151055ea1b69d232db4a49" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[0].json new file mode 100644 index 000000000000..6ef55dc822d5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[0].json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia7bb059384c4176e?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" : "a355f1bd-db1c-4dd0-bbb1-51e32ccb3adb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619E9722E9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3b0f-501e-003f-4c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:28 GMT", + "x-ms-client-request-id" : "a355f1bd-db1c-4dd0-bbb1-51e32ccb3adb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia7bb059384c4176e/javablobpagerangeia1pageblobapitestpagerangeia7bb88040f6c6", + "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" : "ae7baae4-6ce9-4883-8bcc-963974cd1ef2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619EA40AA6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3b21-501e-003f-5d4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:28 GMT", + "x-ms-client-request-id" : "ae7baae4-6ce9-4883-8bcc-963974cd1ef2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcpagerangeia&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" : "2c2989ef-0004-4e5d-ba6c-3c0b4334de4a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3b3c-501e-003f-744a-675777000000", + "Body" : "jtcpagerangeiajtcpagerangeia0pageblobapitestpagerangeia7bb059384c4176eMon, 09 Sep 2019 20:09:28 GMT\"0x8D735619E9722E9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:28 GMT", + "x-ms-client-request-id" : "2c2989ef-0004-4e5d-ba6c-3c0b4334de4a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia7bb059384c4176e?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" : "22444fd8-d89c-4de3-af71-d89b4caf1176" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3b48-501e-003f-804a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:28 GMT", + "x-ms-client-request-id" : "22444fd8-d89c-4de3-af71-d89b4caf1176" + }, + "Exception" : null + } ], + "variables" : [ "jtcpagerangeia0pageblobapitestpagerangeia7bb059384c4176e", "javablobpagerangeia1pageblobapitestpagerangeia7bb88040f6c6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[1].json new file mode 100644 index 000000000000..03f0a587b20a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[1].json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeiaaf5584338f328d0?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" : "a6720a67-a6a3-44d8-b37e-700a238517e2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619EC9D4D0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3b5a-501e-003f-124a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:28 GMT", + "x-ms-client-request-id" : "a6720a67-a6a3-44d8-b37e-700a238517e2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeiaaf5584338f328d0/javablobpagerangeia1pageblobapitestpagerangeiaaf5474266abc", + "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" : "303f71c1-4d14-40f4-a99c-17fb781555a5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619ED70AEA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:28 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3b70-501e-003f-244a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:28 GMT", + "x-ms-client-request-id" : "303f71c1-4d14-40f4-a99c-17fb781555a5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcpagerangeia&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" : "ae4f166f-49cb-443c-a221-608e0cdaddc2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3b83-501e-003f-374a-675777000000", + "Body" : "jtcpagerangeiajtcpagerangeia0pageblobapitestpagerangeiaaf5584338f328d0Mon, 09 Sep 2019 20:09:28 GMT\"0x8D735619EC9D4D0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:28 GMT", + "x-ms-client-request-id" : "ae4f166f-49cb-443c-a221-608e0cdaddc2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeiaaf5584338f328d0?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" : "5d9d302f-ce18-4031-b33d-17e7bb1ea283" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3b99-501e-003f-4d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:28 GMT", + "x-ms-client-request-id" : "5d9d302f-ce18-4031-b33d-17e7bb1ea283" + }, + "Exception" : null + } ], + "variables" : [ "jtcpagerangeia0pageblobapitestpagerangeiaaf5584338f328d0", "javablobpagerangeia1pageblobapitestpagerangeiaaf5474266abc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[2].json new file mode 100644 index 000000000000..b8ed5ca36094 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[2].json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia11c29005d90e8ad?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" : "cc861e79-4fed-44b9-aaf8-b1252378dd4e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619EFC5F9D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3bac-501e-003f-604a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:28 GMT", + "x-ms-client-request-id" : "cc861e79-4fed-44b9-aaf8-b1252378dd4e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia11c29005d90e8ad/javablobpagerangeia1pageblobapitestpagerangeia11c66779f47a", + "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" : "2ac1148e-c13f-4bcf-9686-372556ea1241" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619F0947B3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3bba-501e-003f-6c4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:28 GMT", + "x-ms-client-request-id" : "2ac1148e-c13f-4bcf-9686-372556ea1241" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcpagerangeia&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" : "374b5bcd-0f23-411a-a3ef-0a30b38d54c8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3bca-501e-003f-7b4a-675777000000", + "Body" : "jtcpagerangeiajtcpagerangeia0pageblobapitestpagerangeia11c29005d90e8adMon, 09 Sep 2019 20:09:29 GMT\"0x8D735619EFC5F9D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:28 GMT", + "x-ms-client-request-id" : "374b5bcd-0f23-411a-a3ef-0a30b38d54c8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia11c29005d90e8ad?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" : "0323c061-a0d1-4a98-9395-85cc520f89a1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3bd9-501e-003f-084a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:29 GMT", + "x-ms-client-request-id" : "0323c061-a0d1-4a98-9395-85cc520f89a1" + }, + "Exception" : null + } ], + "variables" : [ "jtcpagerangeia0pageblobapitestpagerangeia11c29005d90e8ad", "javablobpagerangeia1pageblobapitestpagerangeia11c66779f47a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[3].json new file mode 100644 index 000000000000..bca8e07fabde --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[3].json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia9ae61552700a2e9?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" : "bf3fb247-5395-42e5-8608-7332368567be" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619F31D122\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3bf0-501e-003f-1b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:29 GMT", + "x-ms-client-request-id" : "bf3fb247-5395-42e5-8608-7332368567be" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia9ae61552700a2e9/javablobpagerangeia1pageblobapitestpagerangeia9ae63956a391", + "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" : "9a3a6f91-0b38-40de-9d55-6d9b4273ce03" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619F3FF21A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3bff-501e-003f-284a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:29 GMT", + "x-ms-client-request-id" : "9a3a6f91-0b38-40de-9d55-6d9b4273ce03" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcpagerangeia&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" : "74bc15b4-15e9-4132-b0dc-942210bdbd1f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3c1c-501e-003f-3f4a-675777000000", + "Body" : "jtcpagerangeiajtcpagerangeia0pageblobapitestpagerangeia9ae61552700a2e9Mon, 09 Sep 2019 20:09:29 GMT\"0x8D735619F31D122\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:29 GMT", + "x-ms-client-request-id" : "74bc15b4-15e9-4132-b0dc-942210bdbd1f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeia9ae61552700a2e9?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" : "1b8c2057-68c9-4ce8-9be4-40a8526ded57" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3c2a-501e-003f-4c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:29 GMT", + "x-ms-client-request-id" : "1b8c2057-68c9-4ce8-9be4-40a8526ded57" + }, + "Exception" : null + } ], + "variables" : [ "jtcpagerangeia0pageblobapitestpagerangeia9ae61552700a2e9", "javablobpagerangeia1pageblobapitestpagerangeia9ae63956a391" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[4].json new file mode 100644 index 000000000000..8a10de3036f6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[4].json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeiaa8122014bf35657?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" : "e24808e7-0b3c-4c80-8446-8e966f4aeff9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619F6594B0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3c36-501e-003f-584a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:29 GMT", + "x-ms-client-request-id" : "e24808e7-0b3c-4c80-8446-8e966f4aeff9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeiaa8122014bf35657/javablobpagerangeia1pageblobapitestpagerangeiaa81912529d10", + "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" : "61ea2c45-794f-4db4-b94e-bcdbcf66f233" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619F7255DD\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:29 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3c4b-501e-003f-6c4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:29 GMT", + "x-ms-client-request-id" : "61ea2c45-794f-4db4-b94e-bcdbcf66f233" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcpagerangeia&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" : "12d89cb4-3026-475d-bbdd-57c4981e60ad" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3c5e-501e-003f-7b4a-675777000000", + "Body" : "jtcpagerangeiajtcpagerangeia0pageblobapitestpagerangeiaa8122014bf35657Mon, 09 Sep 2019 20:09:29 GMT\"0x8D735619F6594B0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:29 GMT", + "x-ms-client-request-id" : "12d89cb4-3026-475d-bbdd-57c4981e60ad", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeiaa8122014bf35657?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" : "d52fc965-253c-4805-9b88-7d6c0e7837fe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3c74-501e-003f-104a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:29 GMT", + "x-ms-client-request-id" : "d52fc965-253c-4805-9b88-7d6c0e7837fe" + }, + "Exception" : null + } ], + "variables" : [ "jtcpagerangeia0pageblobapitestpagerangeiaa8122014bf35657", "javablobpagerangeia1pageblobapitestpagerangeiaa81912529d10" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[5].json new file mode 100644 index 000000000000..2df5524d3bab --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestpagerangeia[5].json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeiab75363066de0f34?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" : "e182ea41-9be9-4c12-809a-929a5315b2e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619F995836\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3c92-501e-003f-2b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:29 GMT", + "x-ms-client-request-id" : "e182ea41-9be9-4c12-809a-929a5315b2e8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeiab75363066de0f34/javablobpagerangeia1pageblobapitestpagerangeiab75512273ff9", + "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" : "c40fad7c-3f86-42fb-aaf2-bf54e0b53453" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619FA77958\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3ca4-501e-003f-3a4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:29 GMT", + "x-ms-client-request-id" : "c40fad7c-3f86-42fb-aaf2-bf54e0b53453" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcpagerangeia&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" : "ef68c315-5b96-4927-bc93-e9127b4fe351" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3cb8-501e-003f-4d4a-675777000000", + "Body" : "jtcpagerangeiajtcpagerangeia0pageblobapitestpagerangeiab75363066de0f34Mon, 09 Sep 2019 20:09:30 GMT\"0x8D735619F995836\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:30 GMT", + "x-ms-client-request-id" : "ef68c315-5b96-4927-bc93-e9127b4fe351", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcpagerangeia0pageblobapitestpagerangeiab75363066de0f34?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" : "a06da8f5-1dce-47b6-a5ab-38707a0852d0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3cd0-501e-003f-654a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:30 GMT", + "x-ms-client-request-id" : "a06da8f5-1dce-47b6-a5ab-38707a0852d0" + }, + "Exception" : null + } ], + "variables" : [ "jtcpagerangeia0pageblobapitestpagerangeiab75363066de0f34", "javablobpagerangeia1pageblobapitestpagerangeiab75512273ff9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresize.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresize.json new file mode 100644 index 000000000000..11e7b9190fe0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresize.json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresize0pageblobapitestresize9b923181e6ac46c33967?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" : "e6ef7966-1ea0-438c-b075-b547e1e30e5d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619FCE0646\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3cde-501e-003f-724a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:30 GMT", + "x-ms-client-request-id" : "e6ef7966-1ea0-438c-b075-b547e1e30e5d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresize0pageblobapitestresize9b923181e6ac46c33967/javablobresize1pageblobapitestresize9b98501468818f73a", + "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" : "4916fd15-a533-48a6-ae10-be2fb1147df2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619FDB15E0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3cee-501e-003f-804a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:30 GMT", + "x-ms-client-request-id" : "4916fd15-a533-48a6-ae10-be2fb1147df2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresize0pageblobapitestresize9b923181e6ac46c33967/javablobresize1pageblobapitestresize9b98501468818f73a?comp=properties", + "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" : "73469494-3706-4896-9ab4-eaf7f92f16bd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735619FEA820C\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3d09-501e-003f-1a4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:30 GMT", + "x-ms-client-request-id" : "73469494-3706-4896-9ab4-eaf7f92f16bd" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresize0pageblobapitestresize9b923181e6ac46c33967/javablobresize1pageblobapitestresize9b98501468818f73a", + "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" : "fc1dc1d0-7f31-4994-8489-a2ea6b5d7589" + }, + "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", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:30 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735619FEA820C\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:09:30 GMT", + "Content-Length" : "1024", + "x-ms-request-id" : "9ebd3d1e-501e-003f-2e4a-675777000000", + "x-ms-client-request-id" : "fc1dc1d0-7f31-4994-8489-a2ea6b5d7589", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcresize&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" : "8ab1e064-1136-457f-b937-4d3e01505252" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3d2a-501e-003f-394a-675777000000", + "Body" : "jtcresizejtcresize0pageblobapitestresize9b923181e6ac46c33967Mon, 09 Sep 2019 20:09:30 GMT\"0x8D735619FCE0646\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:30 GMT", + "x-ms-client-request-id" : "8ab1e064-1136-457f-b937-4d3e01505252", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresize0pageblobapitestresize9b923181e6ac46c33967?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" : "d59691e3-c163-4b27-b450-a762d698e6eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3d4e-501e-003f-5b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:30 GMT", + "x-ms-client-request-id" : "d59691e3-c163-4b27-b450-a762d698e6eb" + }, + "Exception" : null + } ], + "variables" : [ "jtcresize0pageblobapitestresize9b923181e6ac46c33967", "javablobresize1pageblobapitestresize9b98501468818f73a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[0].json new file mode 100644 index 000000000000..a728592a1a1a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[0].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacc6f20552fe77b841ac?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" : "42d44f80-fa0c-4b9d-8c36-2d2901c160a6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A060005A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3dbf-501e-003f-484a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:31 GMT", + "x-ms-client-request-id" : "42d44f80-fa0c-4b9d-8c36-2d2901c160a6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacc6f20552fe77b841ac/javablobresizeac1pageblobapitestresizeacc6f27090ce31966", + "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" : "579aef95-1a5b-462a-99e1-7d8d02e0eb18" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A06DFB00\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3dda-501e-003f-5f4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:31 GMT", + "x-ms-client-request-id" : "579aef95-1a5b-462a-99e1-7d8d02e0eb18" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacc6f20552fe77b841ac/javablobresizeac1pageblobapitestresizeacc6f27090ce31966?comp=properties", + "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" : "266b8b62-2bda-4e95-989c-92909c5a3901" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A07ACE9B\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3df2-501e-003f-764a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:31 GMT", + "x-ms-client-request-id" : "266b8b62-2bda-4e95-989c-92909c5a3901" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcresizeac&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" : "6d967f5d-c410-4b1a-a6db-58bf38db5344" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3e0b-501e-003f-0d4a-675777000000", + "Body" : "jtcresizeacjtcresizeac0pageblobapitestresizeacc6f20552fe77b841acMon, 09 Sep 2019 20:09:31 GMT\"0x8D73561A060005A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:31 GMT", + "x-ms-client-request-id" : "6d967f5d-c410-4b1a-a6db-58bf38db5344", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeacc6f20552fe77b841ac?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" : "16b0472c-6ed9-4046-a243-09bbca1e5e74" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3e1e-501e-003f-1f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:31 GMT", + "x-ms-client-request-id" : "16b0472c-6ed9-4046-a243-09bbca1e5e74" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeac0pageblobapitestresizeacc6f20552fe77b841ac", "javablobresizeac1pageblobapitestresizeacc6f27090ce31966" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[1].json new file mode 100644 index 000000000000..50f309a43b87 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[1].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeace567239157c1da35ba?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" : "09b08edd-03b2-4826-a0bf-53ce53c9e545" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A0A1F74B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3e32-501e-003f-314a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:31 GMT", + "x-ms-client-request-id" : "09b08edd-03b2-4826-a0bf-53ce53c9e545" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeace567239157c1da35ba/javablobresizeac1pageblobapitestresizeace56245920c64a51", + "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" : "14d9c201-bb69-4a67-b032-845b8657d9c5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A0AEB966\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3e3f-501e-003f-3d4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:31 GMT", + "x-ms-client-request-id" : "14d9c201-bb69-4a67-b032-845b8657d9c5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeace567239157c1da35ba/javablobresizeac1pageblobapitestresizeace56245920c64a51?comp=properties", + "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" : "93a51808-0ca7-4df1-b2bb-95570e313450" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A0BD892D\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3e56-501e-003f-524a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:31 GMT", + "x-ms-client-request-id" : "93a51808-0ca7-4df1-b2bb-95570e313450" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcresizeac&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" : "df2917cd-54b0-4556-96a0-3a9359961e9b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3e67-501e-003f-634a-675777000000", + "Body" : "jtcresizeacjtcresizeac0pageblobapitestresizeace567239157c1da35baMon, 09 Sep 2019 20:09:31 GMT\"0x8D73561A0A1F74B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:31 GMT", + "x-ms-client-request-id" : "df2917cd-54b0-4556-96a0-3a9359961e9b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeace567239157c1da35ba?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" : "d1351c34-3f11-406d-b809-8a43e1878ce9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3e82-501e-003f-7e4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:31 GMT", + "x-ms-client-request-id" : "d1351c34-3f11-406d-b809-8a43e1878ce9" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeac0pageblobapitestresizeace567239157c1da35ba", "javablobresizeac1pageblobapitestresizeace56245920c64a51" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[2].json new file mode 100644 index 000000000000..e3e61e68fac9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[2].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac09a18781b17fdfb1ff?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" : "a4d7cacf-173f-4121-9d55-721e40fe1a6a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A0E4B19B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3e97-501e-003f-134a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:32 GMT", + "x-ms-client-request-id" : "a4d7cacf-173f-4121-9d55-721e40fe1a6a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac09a18781b17fdfb1ff/javablobresizeac1pageblobapitestresizeac09a374290571880", + "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" : "e62bc04d-f822-4ed1-b385-8d6f6588ec04" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A0F2ACB1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3ea7-501e-003f-1f4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:32 GMT", + "x-ms-client-request-id" : "e62bc04d-f822-4ed1-b385-8d6f6588ec04" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac09a18781b17fdfb1ff/javablobresizeac1pageblobapitestresizeac09a374290571880?comp=properties", + "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" : "c4cb9bdd-f526-4b67-9224-5b4d9e425beb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A0FF804C\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3ebe-501e-003f-364a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:32 GMT", + "x-ms-client-request-id" : "c4cb9bdd-f526-4b67-9224-5b4d9e425beb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcresizeac&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" : "d83d5c50-14d5-432e-9f02-90e5cf9cb4e9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3ecc-501e-003f-434a-675777000000", + "Body" : "jtcresizeacjtcresizeac0pageblobapitestresizeac09a18781b17fdfb1ffMon, 09 Sep 2019 20:09:32 GMT\"0x8D73561A0E4B19B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:32 GMT", + "x-ms-client-request-id" : "d83d5c50-14d5-432e-9f02-90e5cf9cb4e9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac09a18781b17fdfb1ff?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" : "1ab4e381-5927-464d-a170-b24a383167f7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3ee2-501e-003f-584a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:32 GMT", + "x-ms-client-request-id" : "1ab4e381-5927-464d-a170-b24a383167f7" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeac0pageblobapitestresizeac09a18781b17fdfb1ff", "javablobresizeac1pageblobapitestresizeac09a374290571880" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[3].json new file mode 100644 index 000000000000..ba4c6d5499af --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[3].json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac71c94607744235f02a?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" : "f3efcc58-6bc9-42ff-b088-5ed438e6db13" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A1276BF8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3efd-501e-003f-6f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:32 GMT", + "x-ms-client-request-id" : "f3efcc58-6bc9-42ff-b088-5ed438e6db13" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac71c94607744235f02a/javablobresizeac1pageblobapitestresizeac71c05320a0c3d66", + "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" : "09ef7977-3892-497d-9ffb-3025b84b19a6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A134CAEA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3f11-501e-003f-024a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:32 GMT", + "x-ms-client-request-id" : "09ef7977-3892-497d-9ffb-3025b84b19a6" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac71c94607744235f02a/javablobresizeac1pageblobapitestresizeac71c05320a0c3d66", + "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" : "7c31cc28-9236-4d47-8fb9-aacbbf004a88" + }, + "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", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:32 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:32 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561A134CAEA\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:09:32 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd3f1f-501e-003f-104a-675777000000", + "x-ms-client-request-id" : "7c31cc28-9236-4d47-8fb9-aacbbf004a88", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac71c94607744235f02a/javablobresizeac1pageblobapitestresizeac71c05320a0c3d66?comp=properties", + "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" : "a34e4bfa-01cc-4b7b-bbbd-870f32ba74c1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A14E4B08\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3f2f-501e-003f-1e4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:32 GMT", + "x-ms-client-request-id" : "a34e4bfa-01cc-4b7b-bbbd-870f32ba74c1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcresizeac&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" : "a4c94e86-9f42-46cb-ac0b-de8a8b8bae1a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3f45-501e-003f-334a-675777000000", + "Body" : "jtcresizeacjtcresizeac0pageblobapitestresizeac71c94607744235f02aMon, 09 Sep 2019 20:09:32 GMT\"0x8D73561A1276BF8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:32 GMT", + "x-ms-client-request-id" : "a4c94e86-9f42-46cb-ac0b-de8a8b8bae1a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac71c94607744235f02a?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" : "bbb05896-0e20-4297-adf1-a67498e282ee" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3f60-501e-003f-4b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:32 GMT", + "x-ms-client-request-id" : "bbb05896-0e20-4297-adf1-a67498e282ee" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeac0pageblobapitestresizeac71c94607744235f02a", "javablobresizeac1pageblobapitestresizeac71c05320a0c3d66" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[4].json new file mode 100644 index 000000000000..98b4418d6601 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[4].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac424091017480175e23?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" : "d16a6646-1ce8-4d1a-9240-9b15a20fe0de" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A174FDBC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3f6c-501e-003f-574a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:32 GMT", + "x-ms-client-request-id" : "d16a6646-1ce8-4d1a-9240-9b15a20fe0de" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac424091017480175e23/javablobresizeac1pageblobapitestresizeac4241058793e3ba5", + "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" : "725ec4f5-13ba-40e0-8a38-a83191de1e82" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A183205D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3f7d-501e-003f-654a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:33 GMT", + "x-ms-client-request-id" : "725ec4f5-13ba-40e0-8a38-a83191de1e82" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac424091017480175e23/javablobresizeac1pageblobapitestresizeac4241058793e3ba5?comp=properties", + "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" : "ab7f60aa-8dde-4616-b6a4-f6cc1b240921" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A1901B0C\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3f8f-501e-003f-774a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:33 GMT", + "x-ms-client-request-id" : "ab7f60aa-8dde-4616-b6a4-f6cc1b240921" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcresizeac&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" : "f7e5a57e-98d5-4bf2-afdf-a444a3289bcb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3f99-501e-003f-014a-675777000000", + "Body" : "jtcresizeacjtcresizeac0pageblobapitestresizeac424091017480175e23Mon, 09 Sep 2019 20:09:33 GMT\"0x8D73561A174FDBC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:33 GMT", + "x-ms-client-request-id" : "f7e5a57e-98d5-4bf2-afdf-a444a3289bcb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac424091017480175e23?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" : "0d1738d7-16f8-498a-93dc-1b19c7a13a12" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3fa4-501e-003f-0c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:33 GMT", + "x-ms-client-request-id" : "0d1738d7-16f8-498a-93dc-1b19c7a13a12" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeac0pageblobapitestresizeac424091017480175e23", "javablobresizeac1pageblobapitestresizeac4241058793e3ba5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[5].json new file mode 100644 index 000000000000..6448081a459a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeac[5].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac3db478525a28f0709f?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" : "89c8f4e5-8bbe-429e-ad53-1a5e85b74668" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A1B6F4A4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3fba-501e-003f-214a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:33 GMT", + "x-ms-client-request-id" : "89c8f4e5-8bbe-429e-ad53-1a5e85b74668" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac3db478525a28f0709f/javablobresizeac1pageblobapitestresizeac3db72767992f38f", + "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" : "4e7b5ea6-2faf-42bf-aded-19145a2bdcc1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A1C4F04B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3fe0-501e-003f-464a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:33 GMT", + "x-ms-client-request-id" : "4e7b5ea6-2faf-42bf-aded-19145a2bdcc1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac3db478525a28f0709f/javablobresizeac1pageblobapitestresizeac3db72767992f38f?comp=lease", + "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" : "2c0f7f5d-b93c-43fe-b76f-64fa1a294a9a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A1C4F04B\"", + "x-ms-lease-id" : "9a837b65-cfb3-49a9-8816-d1cacc34277b", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3ff7-501e-003f-5c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:33 GMT", + "x-ms-client-request-id" : "2c0f7f5d-b93c-43fe-b76f-64fa1a294a9a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac3db478525a28f0709f/javablobresizeac1pageblobapitestresizeac3db72767992f38f?comp=properties", + "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" : "73969382-ba04-4bf8-a94a-16e615da421f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A1DE705D\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd400e-501e-003f-6f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:33 GMT", + "x-ms-client-request-id" : "73969382-ba04-4bf8-a94a-16e615da421f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcresizeac&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" : "b5e4b1e6-beb3-4f0b-ac41-77d933090ad8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd4024-501e-003f-034a-675777000000", + "Body" : "jtcresizeacjtcresizeac0pageblobapitestresizeac3db478525a28f0709fMon, 09 Sep 2019 20:09:33 GMT\"0x8D73561A1B6F4A4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:33 GMT", + "x-ms-client-request-id" : "b5e4b1e6-beb3-4f0b-ac41-77d933090ad8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeac0pageblobapitestresizeac3db478525a28f0709f?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" : "20c9ed33-1a63-4907-935d-6dd2480553b3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd4033-501e-003f-0f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:33 GMT", + "x-ms-client-request-id" : "20c9ed33-1a63-4907-935d-6dd2480553b3" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeac0pageblobapitestresizeac3db478525a28f0709f", "javablobresizeac1pageblobapitestresizeac3db72767992f38f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[0].json new file mode 100644 index 000000000000..555488d7e7ca --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[0].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfaila5f77335d05617?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" : "a7ed654f-7d4b-4b6c-aa05-180b68468e13" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A2048669\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4044-501e-003f-204a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:33 GMT", + "x-ms-client-request-id" : "a7ed654f-7d4b-4b6c-aa05-180b68468e13" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfaila5f77335d05617/javablobresizeacfail1pageblobapitestresizeacfaila5f44648151", + "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" : "a1a576f6-cfeb-47b0-b1f5-3f8b47e440ae" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A2114971\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4058-501e-003f-314a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:33 GMT", + "x-ms-client-request-id" : "a1a576f6-cfeb-47b0-b1f5-3f8b47e440ae" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfaila5f77335d05617/javablobresizeacfail1pageblobapitestresizeacfaila5f44648151?comp=properties", + "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" : "3784dcce-76ce-4268-b831-ada032dd2317" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd4066-501e-003f-3f4a-675777000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd4066-501e-003f-3f4a-675777000000\nTime:2019-09-09T20:09:34.4151060Z", + "Date" : "Mon, 09 Sep 2019 20:09:34 GMT", + "x-ms-client-request-id" : "3784dcce-76ce-4268-b831-ada032dd2317", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcresizeacfail&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" : "5de8ce11-6590-4895-b7dc-38c25e841ca9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd4071-501e-003f-4a4a-675777000000", + "Body" : "jtcresizeacfailjtcresizeacfail0pageblobapitestresizeacfaila5f77335d05617Mon, 09 Sep 2019 20:09:34 GMT\"0x8D73561A2048669\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:34 GMT", + "x-ms-client-request-id" : "5de8ce11-6590-4895-b7dc-38c25e841ca9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfaila5f77335d05617?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" : "d91b1988-f1b2-4d71-b226-778b90a8e7db" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd4083-501e-003f-5a4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:34 GMT", + "x-ms-client-request-id" : "d91b1988-f1b2-4d71-b226-778b90a8e7db" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeacfail0pageblobapitestresizeacfaila5f77335d05617", "javablobresizeacfail1pageblobapitestresizeacfaila5f44648151" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[1].json new file mode 100644 index 000000000000..1550931f9e75 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[1].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail48f56410a23b1a?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" : "8bdfee84-2ac8-44f8-90ba-56c1b6bfa98e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A2425DE0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4092-501e-003f-694a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:34 GMT", + "x-ms-client-request-id" : "8bdfee84-2ac8-44f8-90ba-56c1b6bfa98e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail48f56410a23b1a/javablobresizeacfail1pageblobapitestresizeacfail48f20208ded", + "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" : "669ddd63-f059-4bcb-9004-4c5ab8d409c0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A24EFA04\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd40a9-501e-003f-7f4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:34 GMT", + "x-ms-client-request-id" : "669ddd63-f059-4bcb-9004-4c5ab8d409c0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail48f56410a23b1a/javablobresizeacfail1pageblobapitestresizeacfail48f20208ded?comp=properties", + "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" : "c9098fd2-f8b3-4164-a756-cf660f2d3d62" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd40b9-501e-003f-0f4a-675777000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd40b9-501e-003f-0f4a-675777000000\nTime:2019-09-09T20:09:34.8193906Z", + "Date" : "Mon, 09 Sep 2019 20:09:34 GMT", + "x-ms-client-request-id" : "c9098fd2-f8b3-4164-a756-cf660f2d3d62", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcresizeacfail&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" : "8cac9179-d9d8-456b-99a4-ef9228d6d461" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd40ca-501e-003f-1d4a-675777000000", + "Body" : "jtcresizeacfailjtcresizeacfail0pageblobapitestresizeacfail48f56410a23b1aMon, 09 Sep 2019 20:09:34 GMT\"0x8D73561A2425DE0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:34 GMT", + "x-ms-client-request-id" : "8cac9179-d9d8-456b-99a4-ef9228d6d461", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail48f56410a23b1a?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" : "660a59a8-e19d-4be4-b30f-1bda59a8dc04" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd40da-501e-003f-294a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:34 GMT", + "x-ms-client-request-id" : "660a59a8-e19d-4be4-b30f-1bda59a8dc04" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeacfail0pageblobapitestresizeacfail48f56410a23b1a", "javablobresizeacfail1pageblobapitestresizeacfail48f20208ded" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[2].json new file mode 100644 index 000000000000..e397ea38dfa3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[2].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail42521419dcb6b3?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" : "2c4260d6-0cac-44bb-82d1-1f8dfada8a2a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A27FE729\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd40e8-501e-003f-364a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:34 GMT", + "x-ms-client-request-id" : "2c4260d6-0cac-44bb-82d1-1f8dfada8a2a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail42521419dcb6b3/javablobresizeacfail1pageblobapitestresizeacfail4258846423b", + "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" : "ffb8d4e8-a520-41da-befb-aee979f35602" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A28C8381\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4105-501e-003f-504a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:34 GMT", + "x-ms-client-request-id" : "ffb8d4e8-a520-41da-befb-aee979f35602" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail42521419dcb6b3/javablobresizeacfail1pageblobapitestresizeacfail4258846423b?comp=properties", + "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" : "adc1a25d-01cf-4d49-9d52-3da05548ce1d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd4116-501e-003f-5d4a-675777000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd4116-501e-003f-5d4a-675777000000\nTime:2019-09-09T20:09:35.2206733Z", + "Date" : "Mon, 09 Sep 2019 20:09:34 GMT", + "x-ms-client-request-id" : "adc1a25d-01cf-4d49-9d52-3da05548ce1d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcresizeacfail&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" : "23dc2b18-20f1-43d7-83f4-54a6dc417484" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd4121-501e-003f-654a-675777000000", + "Body" : "jtcresizeacfailjtcresizeacfail0pageblobapitestresizeacfail42521419dcb6b3Mon, 09 Sep 2019 20:09:35 GMT\"0x8D73561A27FE729\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:34 GMT", + "x-ms-client-request-id" : "23dc2b18-20f1-43d7-83f4-54a6dc417484", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail42521419dcb6b3?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" : "e328e3dc-7645-41a7-8c7c-b0309ea15f9e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd4130-501e-003f-744a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:35 GMT", + "x-ms-client-request-id" : "e328e3dc-7645-41a7-8c7c-b0309ea15f9e" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeacfail0pageblobapitestresizeacfail42521419dcb6b3", "javablobresizeacfail1pageblobapitestresizeacfail4258846423b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[3].json new file mode 100644 index 000000000000..36a360e22b3e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[3].json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail10e228726f3276?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" : "a4a6a649-0fe0-4c56-8712-c096503de236" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A2BD495D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd413f-501e-003f-034a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:35 GMT", + "x-ms-client-request-id" : "a4a6a649-0fe0-4c56-8712-c096503de236" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail10e228726f3276/javablobresizeacfail1pageblobapitestresizeacfail10e4845785b", + "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" : "1ae88168-91c1-4379-9158-566406d8c7cd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A2CA0D03\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4150-501e-003f-124a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:35 GMT", + "x-ms-client-request-id" : "1ae88168-91c1-4379-9158-566406d8c7cd" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail10e228726f3276/javablobresizeacfail1pageblobapitestresizeacfail10e4845785b", + "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" : "b76bacee-3fda-4206-8b7a-6b5c94736e34" + }, + "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", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:35 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:35 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561A2CA0D03\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:09:35 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd4158-501e-003f-1a4a-675777000000", + "x-ms-client-request-id" : "b76bacee-3fda-4206-8b7a-6b5c94736e34", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail10e228726f3276/javablobresizeacfail1pageblobapitestresizeacfail10e4845785b?comp=properties", + "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" : "96827ca0-0d88-4c22-b4c2-6a704a515951" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd4167-501e-003f-294a-675777000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd4167-501e-003f-294a-675777000000\nTime:2019-09-09T20:09:35.7040143Z", + "Date" : "Mon, 09 Sep 2019 20:09:35 GMT", + "x-ms-client-request-id" : "96827ca0-0d88-4c22-b4c2-6a704a515951", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcresizeacfail&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" : "0d252d27-7966-4da4-ba95-16b29199b2ae" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd4177-501e-003f-374a-675777000000", + "Body" : "jtcresizeacfailjtcresizeacfail0pageblobapitestresizeacfail10e228726f3276Mon, 09 Sep 2019 20:09:35 GMT\"0x8D73561A2BD495D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:35 GMT", + "x-ms-client-request-id" : "0d252d27-7966-4da4-ba95-16b29199b2ae", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail10e228726f3276?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" : "de340ea1-6d75-4642-910b-fea28dd19a5d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd4185-501e-003f-454a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:35 GMT", + "x-ms-client-request-id" : "de340ea1-6d75-4642-910b-fea28dd19a5d" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeacfail0pageblobapitestresizeacfail10e228726f3276", "javablobresizeacfail1pageblobapitestresizeacfail10e4845785b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[4].json new file mode 100644 index 000000000000..9fe8ab627e8b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeacfail[4].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail69019080716885?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" : "91e903ad-8ced-42ee-b2b7-c266ea8f36ca" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A306E2CA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4195-501e-003f-554a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:35 GMT", + "x-ms-client-request-id" : "91e903ad-8ced-42ee-b2b7-c266ea8f36ca" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail69019080716885/javablobresizeacfail1pageblobapitestresizeacfail690947437f1", + "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" : "6c6e8ab7-c330-462c-ad88-625a0436492c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A313A6AA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd41a7-501e-003f-654a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:35 GMT", + "x-ms-client-request-id" : "6c6e8ab7-c330-462c-ad88-625a0436492c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail69019080716885/javablobresizeacfail1pageblobapitestresizeacfail690947437f1?comp=lease", + "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" : "93679a82-7c49-4a26-b2e0-8295e7585521" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A313A6AA\"", + "x-ms-lease-id" : "5684a21c-33c8-4e3b-b34e-46be643208f5", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd41c1-501e-003f-7c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:35 GMT", + "x-ms-client-request-id" : "93679a82-7c49-4a26-b2e0-8295e7585521" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail69019080716885/javablobresizeacfail1pageblobapitestresizeacfail690947437f1?comp=properties", + "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" : "64401779-08af-4c77-8817-cff70c1db9ef" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd41cc-501e-003f-074a-675777000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:9ebd41cc-501e-003f-074a-675777000000\nTime:2019-09-09T20:09:36.1863544Z", + "Date" : "Mon, 09 Sep 2019 20:09:35 GMT", + "x-ms-client-request-id" : "64401779-08af-4c77-8817-cff70c1db9ef", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcresizeacfail&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" : "fa6bd534-357f-4a01-a5ed-b69070371041" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd41d9-501e-003f-144a-675777000000", + "Body" : "jtcresizeacfailjtcresizeacfail0pageblobapitestresizeacfail69019080716885Mon, 09 Sep 2019 20:09:35 GMT\"0x8D73561A306E2CA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:35 GMT", + "x-ms-client-request-id" : "fa6bd534-357f-4a01-a5ed-b69070371041", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeacfail0pageblobapitestresizeacfail69019080716885?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" : "cfa71252-a7eb-4233-aa5c-62e1af6cda06" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd41eb-501e-003f-264a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:35 GMT", + "x-ms-client-request-id" : "cfa71252-a7eb-4233-aa5c-62e1af6cda06" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeacfail0pageblobapitestresizeacfail69019080716885", "javablobresizeacfail1pageblobapitestresizeacfail690947437f1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeerror.json new file mode 100644 index 000000000000..b50e0e151451 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizeerror.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeerror0pageblobapitestresizeerror2808244296bc625?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" : "bb38852b-fb54-4c8b-9f07-578420d462d0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A3505515\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4202-501e-003f-3d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:36 GMT", + "x-ms-client-request-id" : "bb38852b-fb54-4c8b-9f07-578420d462d0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeerror0pageblobapitestresizeerror2808244296bc625/javablobresizeerror1pageblobapitestresizeerror2809905682eb", + "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" : "aff36ac3-0be2-4576-9ff0-4704542482dd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A35D1930\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4214-501e-003f-4b4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:36 GMT", + "x-ms-client-request-id" : "aff36ac3-0be2-4576-9ff0-4704542482dd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeerror0pageblobapitestresizeerror2808244296bc625/javablobresizeerror2pageblobapitestresizeerror28062667c8bd?comp=properties", + "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" : "5d173a4f-98a8-49ea-bc28-527c330aef7c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "BlobNotFound", + "retry-after" : "0", + "Content-Length" : "215", + "StatusCode" : "404", + "x-ms-request-id" : "9ebd4220-501e-003f-574a-675777000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:9ebd4220-501e-003f-574a-675777000000\nTime:2019-09-09T20:09:36.5906389Z", + "Date" : "Mon, 09 Sep 2019 20:09:36 GMT", + "x-ms-client-request-id" : "5d173a4f-98a8-49ea-bc28-527c330aef7c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcresizeerror&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" : "3f114fbf-9c10-428f-9895-4896faf37db2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd422f-501e-003f-634a-675777000000", + "Body" : "jtcresizeerrorjtcresizeerror0pageblobapitestresizeerror2808244296bc625Mon, 09 Sep 2019 20:09:36 GMT\"0x8D73561A3505515\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:36 GMT", + "x-ms-client-request-id" : "3f114fbf-9c10-428f-9895-4896faf37db2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizeerror0pageblobapitestresizeerror2808244296bc625?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" : "629d2076-877b-46f6-99cf-66f8d70a2c41" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd4242-501e-003f-764a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:36 GMT", + "x-ms-client-request-id" : "629d2076-877b-46f6-99cf-66f8d70a2c41" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizeerror0pageblobapitestresizeerror2808244296bc625", "javablobresizeerror1pageblobapitestresizeerror2809905682eb", "javablobresizeerror2pageblobapitestresizeerror28062667c8bd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizemin.json new file mode 100644 index 000000000000..9b8972173023 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestresizemin.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizemin0pageblobapitestresizemin58f6185058b1a2e16?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" : "68c3c869-e708-42b9-8ae4-5fddabc3cc2b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A01D6D1A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3d67-501e-003f-734a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:30 GMT", + "x-ms-client-request-id" : "68c3c869-e708-42b9-8ae4-5fddabc3cc2b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizemin0pageblobapitestresizemin58f6185058b1a2e16/javablobresizemin1pageblobapitestresizemin58f48126b12b97", + "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" : "59ed26f4-0722-4175-9f77-01306d57e6a8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A02ACB26\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd3d7c-501e-003f-064a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:30 GMT", + "x-ms-client-request-id" : "59ed26f4-0722-4175-9f77-01306d57e6a8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizemin0pageblobapitestresizemin58f6185058b1a2e16/javablobresizemin1pageblobapitestresizemin58f48126b12b97?comp=properties", + "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" : "4c0e10da-ec3f-49bc-9b2a-e83708bc07ec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A0375093\"", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3d91-501e-003f-1b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:30 GMT", + "x-ms-client-request-id" : "4c0e10da-ec3f-49bc-9b2a-e83708bc07ec" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcresizemin&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" : "cac8206e-1446-4acd-935f-94910016c096" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd3da2-501e-003f-2c4a-675777000000", + "Body" : "jtcresizeminjtcresizemin0pageblobapitestresizemin58f6185058b1a2e16Mon, 09 Sep 2019 20:09:31 GMT\"0x8D73561A01D6D1A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:30 GMT", + "x-ms-client-request-id" : "cac8206e-1446-4acd-935f-94910016c096", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcresizemin0pageblobapitestresizemin58f6185058b1a2e16?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" : "fe60aea4-ac32-4015-a16a-51b1e4c19bc4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd3db0-501e-003f-394a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:31 GMT", + "x-ms-client-request-id" : "fe60aea4-ac32-4015-a16a-51b1e4c19bc4" + }, + "Exception" : null + } ], + "variables" : [ "jtcresizemin0pageblobapitestresizemin58f6185058b1a2e16", "javablobresizemin1pageblobapitestresizemin58f48126b12b97" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumber[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumber[0].json new file mode 100644 index 000000000000..74379c8a67e6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumber[0].json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumberbfd16434e44a?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" : "02bdeaaf-df86-4f2c-8204-98f932f4c8f5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A38E53A5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4255-501e-003f-084a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:36 GMT", + "x-ms-client-request-id" : "02bdeaaf-df86-4f2c-8204-98f932f4c8f5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumberbfd16434e44a/javablobsequencenumber1pageblobapitestsequencenumberbfd282586", + "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" : "57c4ee31-4d98-4fcb-bfd0-103814d77057" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A39AF0C5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4274-501e-003f-254a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:36 GMT", + "x-ms-client-request-id" : "57c4ee31-4d98-4fcb-bfd0-103814d77057" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumberbfd16434e44a/javablobsequencenumber1pageblobapitestsequencenumberbfd282586?comp=properties", + "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" : "6727a06a-ff88-4135-933b-bb8b2a9ff5ad" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A3A7EB7D\"", + "x-ms-blob-sequence-number" : "5", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd427f-501e-003f-304a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:36 GMT", + "x-ms-client-request-id" : "6727a06a-ff88-4135-933b-bb8b2a9ff5ad" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumberbfd16434e44a/javablobsequencenumber1pageblobapitestsequencenumberbfd282586", + "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" : "f0619ce6-b45d-477f-9438-2ca8c760a816" + }, + "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", + "x-ms-blob-sequence-number" : "5", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:37 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:36 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561A3A7EB7D\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:09:36 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd429a-501e-003f-474a-675777000000", + "x-ms-client-request-id" : "f0619ce6-b45d-477f-9438-2ca8c760a816", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsequencenumber&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" : "d7227d6b-da20-414e-96fa-01b6fa3619cf" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd42af-501e-003f-594a-675777000000", + "Body" : "jtcsequencenumberjtcsequencenumber0pageblobapitestsequencenumberbfd16434e44aMon, 09 Sep 2019 20:09:36 GMT\"0x8D73561A38E53A5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:36 GMT", + "x-ms-client-request-id" : "d7227d6b-da20-414e-96fa-01b6fa3619cf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumberbfd16434e44a?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" : "7c1af8b7-325d-442c-82ea-9b5356a17770" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd42be-501e-003f-684a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:36 GMT", + "x-ms-client-request-id" : "7c1af8b7-325d-442c-82ea-9b5356a17770" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumber0pageblobapitestsequencenumberbfd16434e44a", "javablobsequencenumber1pageblobapitestsequencenumberbfd282586" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumber[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumber[1].json new file mode 100644 index 000000000000..fa5d6da14c6c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumber[1].json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber97289920fa8d?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" : "f60fda69-2a6a-4947-ab65-5f9610cd86ac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A3D8B083\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd42cc-501e-003f-754a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:36 GMT", + "x-ms-client-request-id" : "f60fda69-2a6a-4947-ab65-5f9610cd86ac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber97289920fa8d/javablobsequencenumber1pageblobapitestsequencenumber97267244a", + "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" : "60d037c0-ed34-47d8-bc96-c4922fa89106" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A3E574E0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd42e3-501e-003f-074a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:37 GMT", + "x-ms-client-request-id" : "60d037c0-ed34-47d8-bc96-c4922fa89106" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber97289920fa8d/javablobsequencenumber1pageblobapitestsequencenumber97267244a?comp=properties", + "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" : "e47e4371-79f8-474b-9173-0e4903c533a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A3F1D32F\"", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd42f9-501e-003f-1b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:37 GMT", + "x-ms-client-request-id" : "e47e4371-79f8-474b-9173-0e4903c533a4" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber97289920fa8d/javablobsequencenumber1pageblobapitestsequencenumber97267244a", + "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" : "1b227d70-4662-4a47-bde3-14701408bf4d" + }, + "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", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:37 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:37 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561A3F1D32F\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:09:37 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd4303-501e-003f-254a-675777000000", + "x-ms-client-request-id" : "1b227d70-4662-4a47-bde3-14701408bf4d", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsequencenumber&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" : "4c17849c-6484-479c-aa1f-b9d0521703be" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd430f-501e-003f-314a-675777000000", + "Body" : "jtcsequencenumberjtcsequencenumber0pageblobapitestsequencenumber97289920fa8dMon, 09 Sep 2019 20:09:37 GMT\"0x8D73561A3D8B083\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:37 GMT", + "x-ms-client-request-id" : "4c17849c-6484-479c-aa1f-b9d0521703be", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber97289920fa8d?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" : "1dd0f9d4-89e8-4b70-b6a8-ec46ad0d3700" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd4316-501e-003f-384a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:37 GMT", + "x-ms-client-request-id" : "1dd0f9d4-89e8-4b70-b6a8-ec46ad0d3700" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumber0pageblobapitestsequencenumber97289920fa8d", "javablobsequencenumber1pageblobapitestsequencenumber97267244a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumber[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumber[2].json new file mode 100644 index 000000000000..c78167d3759d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumber[2].json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber74696684718e?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" : "c375097a-9580-4825-aee8-49ed44a3920d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A422981A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd432d-501e-003f-4d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:37 GMT", + "x-ms-client-request-id" : "c375097a-9580-4825-aee8-49ed44a3920d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber74696684718e/javablobsequencenumber1pageblobapitestsequencenumber746737342", + "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" : "15816afb-490a-4b8c-9b66-516d53e27d86" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A42F5CAC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd433b-501e-003f-594a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:37 GMT", + "x-ms-client-request-id" : "15816afb-490a-4b8c-9b66-516d53e27d86" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber74696684718e/javablobsequencenumber1pageblobapitestsequencenumber746737342?comp=properties", + "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" : "9be74d18-3c28-4cab-afb1-a06c3780ab14" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A43B93EF\"", + "x-ms-blob-sequence-number" : "2", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd434d-501e-003f-6a4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:37 GMT", + "x-ms-client-request-id" : "9be74d18-3c28-4cab-afb1-a06c3780ab14" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber74696684718e/javablobsequencenumber1pageblobapitestsequencenumber746737342", + "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" : "168f50aa-4a5b-4686-9347-534890edca5b" + }, + "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", + "x-ms-blob-sequence-number" : "2", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:37 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:37 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561A43B93EF\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:09:37 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd4366-501e-003f-014a-675777000000", + "x-ms-client-request-id" : "168f50aa-4a5b-4686-9347-534890edca5b", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsequencenumber&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" : "65016bec-72a6-4190-b1f0-7043d2875a36" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd437b-501e-003f-144a-675777000000", + "Body" : "jtcsequencenumberjtcsequencenumber0pageblobapitestsequencenumber74696684718eMon, 09 Sep 2019 20:09:37 GMT\"0x8D73561A422981A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:37 GMT", + "x-ms-client-request-id" : "65016bec-72a6-4190-b1f0-7043d2875a36", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumber0pageblobapitestsequencenumber74696684718e?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" : "249ea6c4-83e2-4ef0-bf93-f6c0546741e1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd438c-501e-003f-234a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:37 GMT", + "x-ms-client-request-id" : "249ea6c4-83e2-4ef0-bf93-f6c0546741e1" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumber0pageblobapitestsequencenumber74696684718e", "javablobsequencenumber1pageblobapitestsequencenumber746737342" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[0].json new file mode 100644 index 000000000000..c1bedc344dca --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[0].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberaced57741607?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" : "85291b0b-a1d3-4c75-af94-b2d274bc8ced" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A4A9E1E9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd43ef-501e-003f-804a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:38 GMT", + "x-ms-client-request-id" : "85291b0b-a1d3-4c75-af94-b2d274bc8ced" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberaced57741607/javablobsequencenumberac13327897d32ffef2994e8e", + "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" : "d8f48b0b-bc72-47ee-9041-faa77dfac7fb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A4B6A6EA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd43ff-501e-003f-0f4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:38 GMT", + "x-ms-client-request-id" : "d8f48b0b-bc72-47ee-9041-faa77dfac7fb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberaced57741607/javablobsequencenumberac13327897d32ffef2994e8e?comp=properties", + "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" : "9f2c1092-415e-480b-bdc8-c7e1820cb451" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A4C3053D\"", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd4410-501e-003f-1f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:38 GMT", + "x-ms-client-request-id" : "9f2c1092-415e-480b-bdc8-c7e1820cb451" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsequencenumberac&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" : "0ea194bf-5f60-43e4-bce0-165f6100a8c5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd4428-501e-003f-364a-675777000000", + "Body" : "jtcsequencenumberacjtcsequencenumberac0pageblobapitestsequencenumberaced57741607Mon, 09 Sep 2019 20:09:38 GMT\"0x8D73561A4A9E1E9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:38 GMT", + "x-ms-client-request-id" : "0ea194bf-5f60-43e4-bce0-165f6100a8c5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberaced57741607?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" : "bc960106-5a5a-495c-916f-fa624158096c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd4436-501e-003f-444a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:38 GMT", + "x-ms-client-request-id" : "bc960106-5a5a-495c-916f-fa624158096c" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberac0pageblobapitestsequencenumberaced57741607", "javablobsequencenumberac13327897d32ffef2994e8e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[1].json new file mode 100644 index 000000000000..cdb12f0fe8fd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[1].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac34d288374f?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" : "cc426620-9ff9-4e6c-87ac-36144da19778" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A4E8CB00\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd444a-501e-003f-584a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:38 GMT", + "x-ms-client-request-id" : "cc426620-9ff9-4e6c-87ac-36144da19778" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac34d288374f/javablobsequencenumberac14343223b66da65ec34da0", + "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" : "e189e593-d055-4e2c-8cee-e138f0d6a467" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A4F56920\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4469-501e-003f-724a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:38 GMT", + "x-ms-client-request-id" : "e189e593-d055-4e2c-8cee-e138f0d6a467" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac34d288374f/javablobsequencenumberac14343223b66da65ec34da0?comp=properties", + "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" : "7c3007d0-ec48-496e-b87b-e5956f68fdd9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A501A05F\"", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd447b-501e-003f-024a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:38 GMT", + "x-ms-client-request-id" : "7c3007d0-ec48-496e-b87b-e5956f68fdd9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsequencenumberac&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" : "cccece84-bc99-4f9f-a330-18534cf46ffa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd4487-501e-003f-0e4a-675777000000", + "Body" : "jtcsequencenumberacjtcsequencenumberac0pageblobapitestsequencenumberac34d288374fMon, 09 Sep 2019 20:09:39 GMT\"0x8D73561A4E8CB00\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:38 GMT", + "x-ms-client-request-id" : "cccece84-bc99-4f9f-a330-18534cf46ffa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac34d288374f?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" : "54b23cb3-8ce8-4da0-a3e9-a3134b0827bb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd4496-501e-003f-1b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:39 GMT", + "x-ms-client-request-id" : "54b23cb3-8ce8-4da0-a3e9-a3134b0827bb" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberac0pageblobapitestsequencenumberac34d288374f", "javablobsequencenumberac14343223b66da65ec34da0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[2].json new file mode 100644 index 000000000000..5f819252d5d1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[2].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac9609273055?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" : "8a85a78c-825c-4a8f-a70d-4c6cacc4ce47" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A5278CFD\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd44af-501e-003f-314a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:39 GMT", + "x-ms-client-request-id" : "8a85a78c-825c-4a8f-a70d-4c6cacc4ce47" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac9609273055/javablobsequencenumberac183192dc09f46fa8914b37", + "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" : "3e77e2af-a612-4d82-a275-80d3a7ab9b23" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A534C7B8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd44c2-501e-003f-424a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:39 GMT", + "x-ms-client-request-id" : "3e77e2af-a612-4d82-a275-80d3a7ab9b23" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac9609273055/javablobsequencenumberac183192dc09f46fa8914b37?comp=properties", + "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" : "4dcb74d3-ed63-4f9c-b932-0ceb835375d3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A5414D25\"", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd44d7-501e-003f-574a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:39 GMT", + "x-ms-client-request-id" : "4dcb74d3-ed63-4f9c-b932-0ceb835375d3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsequencenumberac&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" : "c35cd575-a158-4e63-8620-49b95aff672e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd44e7-501e-003f-674a-675777000000", + "Body" : "jtcsequencenumberacjtcsequencenumberac0pageblobapitestsequencenumberac9609273055Mon, 09 Sep 2019 20:09:39 GMT\"0x8D73561A5278CFD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:39 GMT", + "x-ms-client-request-id" : "c35cd575-a158-4e63-8620-49b95aff672e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac9609273055?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" : "73a46df1-9183-4578-8744-679d706adeb0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd44fb-501e-003f-784a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:39 GMT", + "x-ms-client-request-id" : "73a46df1-9183-4578-8744-679d706adeb0" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberac0pageblobapitestsequencenumberac9609273055", "javablobsequencenumberac183192dc09f46fa8914b37" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[3].json new file mode 100644 index 000000000000..19155bb3c685 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[3].json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac4fe20148bf?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" : "209eff9e-2c5f-40e9-9633-0798a6a3bd37" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A567AED4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd451a-501e-003f-134a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:39 GMT", + "x-ms-client-request-id" : "209eff9e-2c5f-40e9-9633-0798a6a3bd37" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac4fe20148bf/javablobsequencenumberac169305a063a4a47e2f4f58", + "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" : "1e476ea3-9b46-4f14-a43a-8cf256876722" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A574E9C2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd452c-501e-003f-224a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:39 GMT", + "x-ms-client-request-id" : "1e476ea3-9b46-4f14-a43a-8cf256876722" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac4fe20148bf/javablobsequencenumberac169305a063a4a47e2f4f58", + "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" : "4e3a5304-ea85-4c44-9e16-522e0eb993eb" + }, + "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", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:40 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:39 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561A574E9C2\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:09:40 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd453f-501e-003f-334a-675777000000", + "x-ms-client-request-id" : "4e3a5304-ea85-4c44-9e16-522e0eb993eb", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac4fe20148bf/javablobsequencenumberac169305a063a4a47e2f4f58?comp=properties", + "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" : "3ae5c5e3-6105-417e-8133-f4bb6422267b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A58D0A15\"", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd4554-501e-003f-484a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:39 GMT", + "x-ms-client-request-id" : "3ae5c5e3-6105-417e-8133-f4bb6422267b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsequencenumberac&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" : "cb0735c8-3a1a-487f-8a81-1a114b3be568" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd456b-501e-003f-5b4a-675777000000", + "Body" : "jtcsequencenumberacjtcsequencenumberac0pageblobapitestsequencenumberac4fe20148bfMon, 09 Sep 2019 20:09:39 GMT\"0x8D73561A567AED4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:39 GMT", + "x-ms-client-request-id" : "cb0735c8-3a1a-487f-8a81-1a114b3be568", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac4fe20148bf?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" : "31e03c8d-7178-402d-9a3a-d7afb0860fd9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd4580-501e-003f-6d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:39 GMT", + "x-ms-client-request-id" : "31e03c8d-7178-402d-9a3a-d7afb0860fd9" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberac0pageblobapitestsequencenumberac4fe20148bf", "javablobsequencenumberac169305a063a4a47e2f4f58" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[4].json new file mode 100644 index 000000000000..1e0f41afcdf8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[4].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac80853435f4?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" : "a81a6994-a9fa-437f-b8fa-9eb6957cb21c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A5B280F5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4591-501e-003f-7d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:40 GMT", + "x-ms-client-request-id" : "a81a6994-a9fa-437f-b8fa-9eb6957cb21c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac80853435f4/javablobsequencenumberac1878140dc3fd2f9c044852", + "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" : "26f78cb6-64d6-47c3-bf59-f9d45e41c5f6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A5C07F90\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd45a8-501e-003f-104a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:40 GMT", + "x-ms-client-request-id" : "26f78cb6-64d6-47c3-bf59-f9d45e41c5f6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac80853435f4/javablobsequencenumberac1878140dc3fd2f9c044852?comp=properties", + "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" : "9f9e95ef-8161-4899-b387-472b3e10bfa0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A5CD5322\"", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd45c1-501e-003f-264a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:40 GMT", + "x-ms-client-request-id" : "9f9e95ef-8161-4899-b387-472b3e10bfa0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsequencenumberac&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" : "ba61373c-afc4-446c-b900-9c36d382cd8a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd45dd-501e-003f-3c4a-675777000000", + "Body" : "jtcsequencenumberacjtcsequencenumberac0pageblobapitestsequencenumberac80853435f4Mon, 09 Sep 2019 20:09:40 GMT\"0x8D73561A5B280F5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:40 GMT", + "x-ms-client-request-id" : "ba61373c-afc4-446c-b900-9c36d382cd8a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac80853435f4?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" : "056d297a-2276-47ea-9ca7-23c8c17d02f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd45ec-501e-003f-4b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:40 GMT", + "x-ms-client-request-id" : "056d297a-2276-47ea-9ca7-23c8c17d02f2" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberac0pageblobapitestsequencenumberac80853435f4", "javablobsequencenumberac1878140dc3fd2f9c044852" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[5].json new file mode 100644 index 000000000000..aeaa45680903 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberac[5].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac1d4204570e?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" : "7bd2a0ae-a2b8-47d4-a6f6-b71994e145c3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A5F3DB85\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd460b-501e-003f-684a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:40 GMT", + "x-ms-client-request-id" : "7bd2a0ae-a2b8-47d4-a6f6-b71994e145c3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac1d4204570e/javablobsequencenumberac1887508907dce0864d4e44", + "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" : "39259405-3f30-4d1d-ba54-57684afc848a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A6018C09\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd461d-501e-003f-794a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:40 GMT", + "x-ms-client-request-id" : "39259405-3f30-4d1d-ba54-57684afc848a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac1d4204570e/javablobsequencenumberac1887508907dce0864d4e44?comp=lease", + "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" : "c6c1c341-7ead-463b-8633-246dff75ac79" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A6018C09\"", + "x-ms-lease-id" : "a42c0ada-686c-4a25-bbf4-927a5e056074", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd462e-501e-003f-0a4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:40 GMT", + "x-ms-client-request-id" : "c6c1c341-7ead-463b-8633-246dff75ac79" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac1d4204570e/javablobsequencenumberac1887508907dce0864d4e44?comp=properties", + "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" : "708d98e3-fab1-4370-9087-bf70c5a10767" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A61A96D3\"", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd4644-501e-003f-1e4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:40 GMT", + "x-ms-client-request-id" : "708d98e3-fab1-4370-9087-bf70c5a10767" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsequencenumberac&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" : "c246ba74-57e3-4550-a5e3-0384f2ab2e6b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd465e-501e-003f-364a-675777000000", + "Body" : "jtcsequencenumberacjtcsequencenumberac0pageblobapitestsequencenumberac1d4204570eMon, 09 Sep 2019 20:09:40 GMT\"0x8D73561A5F3DB85\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:40 GMT", + "x-ms-client-request-id" : "c246ba74-57e3-4550-a5e3-0384f2ab2e6b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberac0pageblobapitestsequencenumberac1d4204570e?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" : "42ca4bc3-e7e4-4ba7-96b7-c5976ba162fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd466f-501e-003f-464a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:40 GMT", + "x-ms-client-request-id" : "42ca4bc3-e7e4-4ba7-96b7-c5976ba162fc" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberac0pageblobapitestsequencenumberac1d4204570e", "javablobsequencenumberac1887508907dce0864d4e44" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[0].json new file mode 100644 index 000000000000..2e444394ed9e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[0].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberacfail005509b4814f0c3b7d405ba?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" : "beaa7e1f-9483-44de-a03f-cab55724eec1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A640D0F1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd467f-501e-003f-544a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:40 GMT", + "x-ms-client-request-id" : "beaa7e1f-9483-44de-a03f-cab55724eec1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberacfail005509b4814f0c3b7d405ba/javablobsequencenumberacfail18169006174ab0cffd4c", + "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" : "ebe31d94-5a72-4ad1-af62-27877245d221" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A64E0C47\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd468e-501e-003f-624a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:41 GMT", + "x-ms-client-request-id" : "ebe31d94-5a72-4ad1-af62-27877245d221" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberacfail005509b4814f0c3b7d405ba/javablobsequencenumberacfail18169006174ab0cffd4c?comp=properties", + "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" : "f0090b45-d1da-454b-b2c4-7cc8326b41d9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd469b-501e-003f-6f4a-675777000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd469b-501e-003f-6f4a-675777000000\nTime:2019-09-09T20:09:41.5281240Z", + "Date" : "Mon, 09 Sep 2019 20:09:41 GMT", + "x-ms-client-request-id" : "f0090b45-d1da-454b-b2c4-7cc8326b41d9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsequencenumberacfail&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" : "6d978182-f772-45c3-8e3b-205b631e571d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd46a8-501e-003f-7c4a-675777000000", + "Body" : "jtcsequencenumberacfailjtcsequencenumberacfail005509b4814f0c3b7d405baMon, 09 Sep 2019 20:09:41 GMT\"0x8D73561A640D0F1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:41 GMT", + "x-ms-client-request-id" : "6d978182-f772-45c3-8e3b-205b631e571d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberacfail005509b4814f0c3b7d405ba?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" : "fdb1b1f2-e009-4fdc-8584-417e61410832" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd46b9-501e-003f-0c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:41 GMT", + "x-ms-client-request-id" : "fdb1b1f2-e009-4fdc-8584-417e61410832" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberacfail005509b4814f0c3b7d405ba", "javablobsequencenumberacfail18169006174ab0cffd4c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[1].json new file mode 100644 index 000000000000..32ea52af4ae6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[1].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberacfail060761235153665fa34f898?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" : "c7f8f4bb-45f7-48ce-ae65-9fae23990343" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A682A0FA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd46d3-501e-003f-234a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:41 GMT", + "x-ms-client-request-id" : "c7f8f4bb-45f7-48ce-ae65-9fae23990343" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberacfail060761235153665fa34f898/javablobsequencenumberacfail10422501bc2d77de8c4f", + "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" : "fd661234-7386-4955-ae6a-8f29c516dfe9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A68FDC4E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd46ef-501e-003f-384a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:41 GMT", + "x-ms-client-request-id" : "fd661234-7386-4955-ae6a-8f29c516dfe9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberacfail060761235153665fa34f898/javablobsequencenumberacfail10422501bc2d77de8c4f?comp=properties", + "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" : "adb91ca2-9d8e-4f7d-9bde-fd44a8e5230e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd4705-501e-003f-4d4a-675777000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd4705-501e-003f-4d4a-675777000000\nTime:2019-09-09T20:09:41.9794448Z", + "Date" : "Mon, 09 Sep 2019 20:09:41 GMT", + "x-ms-client-request-id" : "adb91ca2-9d8e-4f7d-9bde-fd44a8e5230e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsequencenumberacfail&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" : "13007f83-a5c6-45f6-a8e7-4ce1605c57e0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd471d-501e-003f-614a-675777000000", + "Body" : "jtcsequencenumberacfailjtcsequencenumberacfail060761235153665fa34f898Mon, 09 Sep 2019 20:09:41 GMT\"0x8D73561A682A0FA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:41 GMT", + "x-ms-client-request-id" : "13007f83-a5c6-45f6-a8e7-4ce1605c57e0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberacfail060761235153665fa34f898?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" : "cb23b79c-0a92-42c9-b2a4-5bce19f7c88b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd4733-501e-003f-764a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:41 GMT", + "x-ms-client-request-id" : "cb23b79c-0a92-42c9-b2a4-5bce19f7c88b" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberacfail060761235153665fa34f898", "javablobsequencenumberacfail10422501bc2d77de8c4f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[2].json new file mode 100644 index 000000000000..ca854b6980bc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[2].json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberacfail0458850b408fd465274d188?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" : "07125087-0c22-4427-b6bd-95f0e237802f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A6C66CDF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4756-501e-003f-154a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:41 GMT", + "x-ms-client-request-id" : "07125087-0c22-4427-b6bd-95f0e237802f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberacfail0458850b408fd465274d188/javablobsequencenumberacfail135684eeac35ce1ee747", + "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" : "418f2ae7-de59-4d97-96b2-1c62cf8d3a9b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A6D3A888\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4773-501e-003f-2f4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:41 GMT", + "x-ms-client-request-id" : "418f2ae7-de59-4d97-96b2-1c62cf8d3a9b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberacfail0458850b408fd465274d188/javablobsequencenumberacfail135684eeac35ce1ee747?comp=properties", + "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" : "30e62844-2cac-4128-bd48-939f1d208c70" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd4784-501e-003f-3f4a-675777000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd4784-501e-003f-3f4a-675777000000\nTime:2019-09-09T20:09:42.3987383Z", + "Date" : "Mon, 09 Sep 2019 20:09:42 GMT", + "x-ms-client-request-id" : "30e62844-2cac-4128-bd48-939f1d208c70", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsequencenumberacfail&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" : "3a89ba73-b2c3-4c96-bd90-90672d240580" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd479e-501e-003f-574a-675777000000", + "Body" : "jtcsequencenumberacfailjtcsequencenumberacfail0458850b408fd465274d188Mon, 09 Sep 2019 20:09:42 GMT\"0x8D73561A6C66CDF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:42 GMT", + "x-ms-client-request-id" : "3a89ba73-b2c3-4c96-bd90-90672d240580", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberacfail0458850b408fd465274d188?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" : "feb53bde-8d13-4abd-989e-d30c1c5821ee" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd47a7-501e-003f-604a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:42 GMT", + "x-ms-client-request-id" : "feb53bde-8d13-4abd-989e-d30c1c5821ee" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberacfail0458850b408fd465274d188", "javablobsequencenumberacfail135684eeac35ce1ee747" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[3].json new file mode 100644 index 000000000000..195a63031657 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[3].json @@ -0,0 +1,141 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberacfail0633713edbe507df564680a?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" : "e3c7b33b-e6c6-4f89-8735-115258560a0c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A704E09D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd47c0-501e-003f-754a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:42 GMT", + "x-ms-client-request-id" : "e3c7b33b-e6c6-4f89-8735-115258560a0c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberacfail0633713edbe507df564680a/javablobsequencenumberacfail14373037fb04d8c53d45", + "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" : "cd59c949-9acd-4155-a257-cb71185dce91" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A712E002\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd47d3-501e-003f-074a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:42 GMT", + "x-ms-client-request-id" : "cd59c949-9acd-4155-a257-cb71185dce91" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberacfail0633713edbe507df564680a/javablobsequencenumberacfail14373037fb04d8c53d45", + "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" : "c465302d-9a7a-4737-95a5-61fdad963dd7" + }, + "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", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:42 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:42 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D73561A712E002\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:09:42 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd47f6-501e-003f-274a-675777000000", + "x-ms-client-request-id" : "c465302d-9a7a-4737-95a5-61fdad963dd7", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberacfail0633713edbe507df564680a/javablobsequencenumberacfail14373037fb04d8c53d45?comp=properties", + "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" : "d1592183-87bc-4782-beaa-3899b27a6c8c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd4808-501e-003f-374a-675777000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd4808-501e-003f-374a-675777000000\nTime:2019-09-09T20:09:42.8980870Z", + "Date" : "Mon, 09 Sep 2019 20:09:42 GMT", + "x-ms-client-request-id" : "d1592183-87bc-4782-beaa-3899b27a6c8c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsequencenumberacfail&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" : "58049915-aee4-4cf3-a45f-26e13c42d6ca" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd4814-501e-003f-424a-675777000000", + "Body" : "jtcsequencenumberacfailjtcsequencenumberacfail0633713edbe507df564680aMon, 09 Sep 2019 20:09:42 GMT\"0x8D73561A704E09D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:42 GMT", + "x-ms-client-request-id" : "58049915-aee4-4cf3-a45f-26e13c42d6ca", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberacfail0633713edbe507df564680a?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" : "24677983-8bc7-4b22-a146-d4e39e4c4dce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd482a-501e-003f-564a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:42 GMT", + "x-ms-client-request-id" : "24677983-8bc7-4b22-a146-d4e39e4c4dce" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberacfail0633713edbe507df564680a", "javablobsequencenumberacfail14373037fb04d8c53d45" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[4].json new file mode 100644 index 000000000000..4f8631a5dc35 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumberacfail[4].json @@ -0,0 +1,131 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberacfail044951a256622ea05f46fb8?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" : "08182d0f-1d9b-4041-8f22-7edf94b6aeaa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A7524B24\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4846-501e-003f-714a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:42 GMT", + "x-ms-client-request-id" : "08182d0f-1d9b-4041-8f22-7edf94b6aeaa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberacfail044951a256622ea05f46fb8/javablobsequencenumberacfail12110016c52497240a4f", + "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" : "a450e3a4-6b54-4c04-b3b6-cfbc08698cc8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A75F394A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd485d-501e-003f-064a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:42 GMT", + "x-ms-client-request-id" : "a450e3a4-6b54-4c04-b3b6-cfbc08698cc8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberacfail044951a256622ea05f46fb8/javablobsequencenumberacfail12110016c52497240a4f?comp=lease", + "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" : "4d4605cb-64dc-44aa-ab57-d222eee248fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A75F394A\"", + "x-ms-lease-id" : "4159c251-8a0c-484d-821b-380ca844d3b3", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd487a-501e-003f-234a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:42 GMT", + "x-ms-client-request-id" : "4d4605cb-64dc-44aa-ab57-d222eee248fc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberacfail044951a256622ea05f46fb8/javablobsequencenumberacfail12110016c52497240a4f?comp=properties", + "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" : "af4c94b3-41a9-4cef-a5ee-de72f09dfaa1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd488a-501e-003f-314a-675777000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:9ebd488a-501e-003f-314a-675777000000\nTime:2019-09-09T20:09:43.4004376Z", + "Date" : "Mon, 09 Sep 2019 20:09:43 GMT", + "x-ms-client-request-id" : "af4c94b3-41a9-4cef-a5ee-de72f09dfaa1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsequencenumberacfail&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" : "cfe7b146-ef3c-4ba0-93d4-205e7627af30" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd489f-501e-003f-434a-675777000000", + "Body" : "jtcsequencenumberacfailjtcsequencenumberacfail044951a256622ea05f46fb8Mon, 09 Sep 2019 20:09:43 GMT\"0x8D73561A7524B24\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:43 GMT", + "x-ms-client-request-id" : "cfe7b146-ef3c-4ba0-93d4-205e7627af30", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumberacfail044951a256622ea05f46fb8?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" : "8fbc855d-a65c-4f24-91c7-b84218faa6c9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd48ab-501e-003f-4f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:43 GMT", + "x-ms-client-request-id" : "8fbc855d-a65c-4f24-91c7-b84218faa6c9" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumberacfail044951a256622ea05f46fb8", "javablobsequencenumberacfail12110016c52497240a4f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumbererror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumbererror.json new file mode 100644 index 000000000000..f3dd7824a67a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumbererror.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumbererror015897414a49b800164e4fb?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" : "b74e03bf-7f6c-4b76-ae68-1ffe1789c67a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A79ECB33\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd48bc-501e-003f-604a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:43 GMT", + "x-ms-client-request-id" : "b74e03bf-7f6c-4b76-ae68-1ffe1789c67a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumbererror015897414a49b800164e4fb/javablobsequencenumbererror1411112d1da1ab342c427", + "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" : "fdb26e40-6b5f-4b73-975d-fede50abf805" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A7AC07D6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd48d2-501e-003f-734a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:43 GMT", + "x-ms-client-request-id" : "fdb26e40-6b5f-4b73-975d-fede50abf805" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumbererror015897414a49b800164e4fb/javablobsequencenumbererror280735aaf27750c25e42d?comp=properties", + "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" : "fc5b7624-6411-4d65-8118-feac152d71ed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "BlobNotFound", + "retry-after" : "0", + "Content-Length" : "215", + "StatusCode" : "404", + "x-ms-request-id" : "9ebd48ea-501e-003f-094a-675777000000", + "Body" : "BlobNotFoundThe specified blob does not exist.\nRequestId:9ebd48ea-501e-003f-094a-675777000000\nTime:2019-09-09T20:09:43.8227332Z", + "Date" : "Mon, 09 Sep 2019 20:09:43 GMT", + "x-ms-client-request-id" : "fc5b7624-6411-4d65-8118-feac152d71ed", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsequencenumbererror&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" : "bfbcb91b-3cab-4226-bc1f-7daff5290aa8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd4907-501e-003f-234a-675777000000", + "Body" : "jtcsequencenumbererrorjtcsequencenumbererror015897414a49b800164e4fbMon, 09 Sep 2019 20:09:43 GMT\"0x8D73561A79ECB33\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:43 GMT", + "x-ms-client-request-id" : "bfbcb91b-3cab-4226-bc1f-7daff5290aa8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumbererror015897414a49b800164e4fb?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" : "39474eb0-34a3-4e94-89c3-9017e4cecdab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd4918-501e-003f-344a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:43 GMT", + "x-ms-client-request-id" : "39474eb0-34a3-4e94-89c3-9017e4cecdab" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumbererror015897414a49b800164e4fb", "javablobsequencenumbererror1411112d1da1ab342c427", "javablobsequencenumbererror280735aaf27750c25e42d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumbermin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumbermin.json new file mode 100644 index 000000000000..363078148673 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestsequencenumbermin.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumbermin0pageblobapitestsequencenumbermine5e57090a?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" : "407388c2-217c-45d4-8648-0f40ac8d8632" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A46C3183\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd43a6-501e-003f-394a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:37 GMT", + "x-ms-client-request-id" : "407388c2-217c-45d4-8648-0f40ac8d8632" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumbermin0pageblobapitestsequencenumbermine5e57090a/javablobsequencenumbermin14339621523273721443b7", + "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" : "20b723dc-d452-4eff-b6d0-83176a01f723" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A478F653\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd43b8-501e-003f-494a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:37 GMT", + "x-ms-client-request-id" : "20b723dc-d452-4eff-b6d0-83176a01f723" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumbermin0pageblobapitestsequencenumbermine5e57090a/javablobsequencenumbermin14339621523273721443b7?comp=properties", + "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" : "f3f6d698-743f-4707-9f2b-a4e77eb93af9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A4852D92\"", + "x-ms-blob-sequence-number" : "1", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd43c5-501e-003f-564a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:38 GMT", + "x-ms-client-request-id" : "f3f6d698-743f-4707-9f2b-a4e77eb93af9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsequencenumbermin&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" : "b2045dcd-7478-44dd-8fbd-774023beeb95" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd43cf-501e-003f-604a-675777000000", + "Body" : "jtcsequencenumberminjtcsequencenumbermin0pageblobapitestsequencenumbermine5e57090aMon, 09 Sep 2019 20:09:38 GMT\"0x8D73561A46C3183\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:38 GMT", + "x-ms-client-request-id" : "b2045dcd-7478-44dd-8fbd-774023beeb95", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsequencenumbermin0pageblobapitestsequencenumbermine5e57090a?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" : "520d4c2f-4714-4fcd-82a7-49ab36671385" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd43e0-501e-003f-714a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:38 GMT", + "x-ms-client-request-id" : "520d4c2f-4714-4fcd-82a7-49ab36671385" + }, + "Exception" : null + } ], + "variables" : [ "jtcsequencenumbermin0pageblobapitestsequencenumbermine5e57090a", "javablobsequencenumbermin14339621523273721443b7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopy.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopy.json new file mode 100644 index 000000000000..291626b3cdc9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopy.json @@ -0,0 +1,233 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopy0149872153edf195e3412eb?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" : "e602f570-9043-48af-8e50-a02b5aad553e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A7DFFE82\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4937-501e-003f-514a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:43 GMT", + "x-ms-client-request-id" : "e602f570-9043-48af-8e50-a02b5aad553e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopy0149872153edf195e3412eb/javablobstartincrementalcopy17130513ae9b21c94b4a", + "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" : "909a9a2b-e06d-4be6-a2a5-1a61ecbd1264" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A7ECED56\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd494a-501e-003f-624a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:43 GMT", + "x-ms-client-request-id" : "909a9a2b-e06d-4be6-a2a5-1a61ecbd1264" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopy0149872153edf195e3412eb?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" : "920e432b-39a6-4e8b-8d19-aa0d03b81cde", + "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" : "\"0x8D73561A7FC7059\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd4962-501e-003f-784a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:43 GMT", + "x-ms-client-request-id" : "920e432b-39a6-4e8b-8d19-aa0d03b81cde" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopy0149872153edf195e3412eb/javablobstartincrementalcopy17130513ae9b21c94b4a?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" : "a99286c5-3a6a-4977-af40-76219658d89a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:44.3498030Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A7ECED56\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4971-501e-003f-064a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:43 GMT", + "x-ms-client-request-id" : "a99286c5-3a6a-4977-af40-76219658d89a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopy0149872153edf195e3412eb/javablobstartincrementalcopy281634e60631e0bee143?comp=incrementalcopy", + "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" : "9392a1e9-0a80-47bc-80d7-b3933ff879e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "950e8140-992b-4634-bb29-4be97b2134ab", + "ETag" : "\"0x8D73561A81EDBEF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd4985-501e-003f-194a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:44 GMT", + "x-ms-client-request-id" : "9392a1e9-0a80-47bc-80d7-b3933ff879e8" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopy0149872153edf195e3412eb/javablobstartincrementalcopy281634e60631e0bee143", + "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" : "b0e77a3b-b825-4db8-a861-8164ca8c1a11" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-copy-destination-snapshot" : "2019-09-09T20:09:44.5479452Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:44 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:09:44 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd49af-501e-003f-414a-675777000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "950e8140-992b-4634-bb29-4be97b2134ab", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopy0149872153edf195e3412eb/javablobstartincrementalcopy17130513ae9b21c94b4a?snapshot=2019-09-09T20:09:44.3498030Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Mon, 09 Sep 2019 20:09:44 GMT", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:09:44 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73561A81EDBEF\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "b0e77a3b-b825-4db8-a861-8164ca8c1a11" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopy0149872153edf195e3412eb/javablobstartincrementalcopy281634e60631e0bee143", + "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" : "9a2fc617-8d9e-4edb-899d-ba3c92111395" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-copy-destination-snapshot" : "2019-09-09T20:09:44.5479452Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:44 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:09:44 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd4a8f-501e-003f-104a-675777000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "950e8140-992b-4634-bb29-4be97b2134ab", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopy0149872153edf195e3412eb/javablobstartincrementalcopy17130513ae9b21c94b4a?snapshot=2019-09-09T20:09:44.3498030Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Mon, 09 Sep 2019 20:09:45 GMT", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:09:44 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73561A81EDBEF\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "9a2fc617-8d9e-4edb-899d-ba3c92111395" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstartincrementalcopy&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" : "a953ca2c-75c4-4d04-b29f-73367065136f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd4a9c-501e-003f-1c4a-675777000000", + "Body" : "jtcstartincrementalcopyjtcstartincrementalcopy0149872153edf195e3412ebMon, 09 Sep 2019 20:09:44 GMT\"0x8D73561A7FC7059\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:45 GMT", + "x-ms-client-request-id" : "a953ca2c-75c4-4d04-b29f-73367065136f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopy0149872153edf195e3412eb?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" : "a2db50e3-8fa0-4810-9b1c-3e802e48a32c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd4aac-501e-003f-2b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:45 GMT", + "x-ms-client-request-id" : "a2db50e3-8fa0-4810-9b1c-3e802e48a32c" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopy0149872153edf195e3412eb", "javablobstartincrementalcopy17130513ae9b21c94b4a", "javablobstartincrementalcopy281634e60631e0bee143" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[0].json new file mode 100644 index 000000000000..4d95e47eec95 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[0].json @@ -0,0 +1,240 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac001071db025e5be42348b7?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" : "f9a3dc7b-4f59-4137-b963-dea2dfe3d4ab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A956B4EE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4b5a-501e-003f-494a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:46 GMT", + "x-ms-client-request-id" : "f9a3dc7b-4f59-4137-b963-dea2dfe3d4ab" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac001071db025e5be42348b7/javablobstartincrementalcopyac1453372077338763f14", + "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" : "f7a4ac41-f773-45eb-bb1f-e171870f7a74" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A963CC6B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4b6b-501e-003f-594a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:46 GMT", + "x-ms-client-request-id" : "f7a4ac41-f773-45eb-bb1f-e171870f7a74" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac001071db025e5be42348b7?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" : "e1cf0d47-f95b-49d4-ae37-0c62dc5ed3a0", + "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" : "\"0x8D73561A9704182\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd4b74-501e-003f-624a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:46 GMT", + "x-ms-client-request-id" : "e1cf0d47-f95b-49d4-ae37-0c62dc5ed3a0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac001071db025e5be42348b7/javablobstartincrementalcopyac1453372077338763f14?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" : "58a64292-d32c-46dd-8db4-6ea98bebd1b0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:46.7845446Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A963CC6B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4b83-501e-003f-704a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:46 GMT", + "x-ms-client-request-id" : "58a64292-d32c-46dd-8db4-6ea98bebd1b0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac001071db025e5be42348b7/javablobstartincrementalcopyac20293340dca49ef9bf4?comp=incrementalcopy", + "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" : "f83d7069-cfda-4252-be88-c44671c2a495" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "c6062c0a-2dd4-442e-833b-149cfa3e2771", + "ETag" : "\"0x8D73561A98A2029\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd4b96-501e-003f-804a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:46 GMT", + "x-ms-client-request-id" : "f83d7069-cfda-4252-be88-c44671c2a495" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac001071db025e5be42348b7/javablobstartincrementalcopyac20293340dca49ef9bf4", + "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" : "dc8a3b5a-ae78-40ef-9c55-3a98e6053348" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-copy-destination-snapshot" : "2019-09-09T20:09:46.8846164Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:46 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:09:46 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd4baa-501e-003f-144a-675777000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "c6062c0a-2dd4-442e-833b-149cfa3e2771", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac001071db025e5be42348b7/javablobstartincrementalcopyac1453372077338763f14?snapshot=2019-09-09T20:09:46.7845446Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Mon, 09 Sep 2019 20:09:46 GMT", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:09:46 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73561A98A2029\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "dc8a3b5a-ae78-40ef-9c55-3a98e6053348" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac001071db025e5be42348b7/javablobstartincrementalcopyac1453372077338763f14?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" : "8340e90b-cee0-410a-a007-9122edf312e7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:48.0384408Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A963CC6B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4c7b-501e-003f-524a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:47 GMT", + "x-ms-client-request-id" : "8340e90b-cee0-410a-a007-9122edf312e7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac001071db025e5be42348b7/javablobstartincrementalcopyac20293340dca49ef9bf4?comp=incrementalcopy", + "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" : "97b1026b-e26b-476e-954b-f963124e6d19" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "bd2a393b-2a96-4af0-a654-87a688017a4f", + "ETag" : "\"0x8D73561AA497471\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd4c8f-501e-003f-654a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:47 GMT", + "x-ms-client-request-id" : "97b1026b-e26b-476e-954b-f963124e6d19" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstartincrementalcopyac&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" : "d9708060-3b19-441d-9f7e-cb4374aa4ffe" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd4ca4-501e-003f-794a-675777000000", + "Body" : "jtcstartincrementalcopyacjtcstartincrementalcopyac001071db025e5be42348b7Mon, 09 Sep 2019 20:09:46 GMT\"0x8D73561A9704182\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:47 GMT", + "x-ms-client-request-id" : "d9708060-3b19-441d-9f7e-cb4374aa4ffe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac001071db025e5be42348b7?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" : "42c8244b-dce0-43ee-b155-70aa33bc293e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd4cb6-501e-003f-0a4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:47 GMT", + "x-ms-client-request-id" : "42c8244b-dce0-43ee-b155-70aa33bc293e" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyac001071db025e5be42348b7", "javablobstartincrementalcopyac1453372077338763f14", "javablobstartincrementalcopyac20293340dca49ef9bf4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[1].json new file mode 100644 index 000000000000..fad5bacd5a20 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[1].json @@ -0,0 +1,240 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac018425161b563b73154fd2?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" : "d339a5a3-6d58-41ed-a0c5-e9eafa5f7966" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561AA71CDBE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4cc6-501e-003f-184a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:48 GMT", + "x-ms-client-request-id" : "d339a5a3-6d58-41ed-a0c5-e9eafa5f7966" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac018425161b563b73154fd2/javablobstartincrementalcopyac1300956316177a07d24", + "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" : "6e5b068d-49b3-4f3b-9aa8-7039d8bfeb79" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561AA7F343F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4cd7-501e-003f-274a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:48 GMT", + "x-ms-client-request-id" : "6e5b068d-49b3-4f3b-9aa8-7039d8bfeb79" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac018425161b563b73154fd2?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" : "f65a6ab3-b4d4-4a94-bfdf-21f87078c747", + "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" : "\"0x8D73561AA8B5AF2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd4cec-501e-003f-394a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:48 GMT", + "x-ms-client-request-id" : "f65a6ab3-b4d4-4a94-bfdf-21f87078c747" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac018425161b563b73154fd2/javablobstartincrementalcopyac1300956316177a07d24?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" : "ee9b962c-061a-4f87-becc-a5d2ce46b17d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:48.6438728Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561AA7F343F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4d05-501e-003f-504a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:48 GMT", + "x-ms-client-request-id" : "ee9b962c-061a-4f87-becc-a5d2ce46b17d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac018425161b563b73154fd2/javablobstartincrementalcopyac241368f042882da6be4?comp=incrementalcopy", + "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" : "13339bc1-e200-4725-93fc-9e17601f8ce3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "513ba0a1-4ecb-4ae5-8253-2bd3df8b641c", + "ETag" : "\"0x8D73561AAA5D62B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd4d19-501e-003f-624a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:48 GMT", + "x-ms-client-request-id" : "13339bc1-e200-4725-93fc-9e17601f8ce3" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac018425161b563b73154fd2/javablobstartincrementalcopyac241368f042882da6be4", + "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" : "964f25d6-9d22-42f1-a07c-8a76756b75f1" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-copy-destination-snapshot" : "2019-09-09T20:09:48.7479470Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:48 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:09:48 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd4d20-501e-003f-694a-675777000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "513ba0a1-4ecb-4ae5-8253-2bd3df8b641c", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac018425161b563b73154fd2/javablobstartincrementalcopyac1300956316177a07d24?snapshot=2019-09-09T20:09:48.6438728Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Mon, 09 Sep 2019 20:09:48 GMT", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:09:48 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73561AAA5D62B\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "964f25d6-9d22-42f1-a07c-8a76756b75f1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac018425161b563b73154fd2/javablobstartincrementalcopyac1300956316177a07d24?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" : "1c715814-f1bd-4e7c-8d0e-5505143ddfdc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:49.8967723Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561AA7F343F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4e26-501e-003f-5a4a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:49 GMT", + "x-ms-client-request-id" : "1c715814-f1bd-4e7c-8d0e-5505143ddfdc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac018425161b563b73154fd2/javablobstartincrementalcopyac241368f042882da6be4?comp=incrementalcopy", + "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" : "1efcd67c-12d2-4187-9ad7-346899b32023" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "d70498a8-61ea-4512-a07e-61e0b42a498e", + "ETag" : "\"0x8D73561AB6551B8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd4e3b-501e-003f-6e4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:49 GMT", + "x-ms-client-request-id" : "1efcd67c-12d2-4187-9ad7-346899b32023" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstartincrementalcopyac&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" : "0eb1c9cc-7188-4032-9c4e-c6315e9caf0a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd4e57-501e-003f-084a-675777000000", + "Body" : "jtcstartincrementalcopyacjtcstartincrementalcopyac018425161b563b73154fd2Mon, 09 Sep 2019 20:09:48 GMT\"0x8D73561AA8B5AF2\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:49 GMT", + "x-ms-client-request-id" : "0eb1c9cc-7188-4032-9c4e-c6315e9caf0a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac018425161b563b73154fd2?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" : "40e64351-3b03-4a11-8607-64541fca4a40" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd4e75-501e-003f-254a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:49 GMT", + "x-ms-client-request-id" : "40e64351-3b03-4a11-8607-64541fca4a40" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyac018425161b563b73154fd2", "javablobstartincrementalcopyac1300956316177a07d24", "javablobstartincrementalcopyac241368f042882da6be4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[2].json new file mode 100644 index 000000000000..486f0fb36a3a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[2].json @@ -0,0 +1,240 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac072451be471c6377a74f26?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" : "dbb8fd45-813e-4cfa-9011-982fa0a7d035" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561AB8D0DCF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4e8a-501e-003f-384a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:49 GMT", + "x-ms-client-request-id" : "dbb8fd45-813e-4cfa-9011-982fa0a7d035" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac072451be471c6377a74f26/javablobstartincrementalcopyac170936b1d15307b18c4", + "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" : "ea5d9aa8-e1ee-46f9-aedc-da44dd9c9291" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561AB9B38B3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4e97-501e-003f-424a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:49 GMT", + "x-ms-client-request-id" : "ea5d9aa8-e1ee-46f9-aedc-da44dd9c9291" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac072451be471c6377a74f26?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" : "1ccb8a53-afa1-4e46-aefe-8fa143204c80", + "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" : "\"0x8D73561ABA87084\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd4ea8-501e-003f-534a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:50 GMT", + "x-ms-client-request-id" : "1ccb8a53-afa1-4e46-aefe-8fa143204c80" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac072451be471c6377a74f26/javablobstartincrementalcopyac170936b1d15307b18c4?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" : "4f40e6b5-1d1c-4bfc-b438-553259a2e3ac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:50.5102125Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561AB9B38B3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4ebd-501e-003f-654a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:50 GMT", + "x-ms-client-request-id" : "4f40e6b5-1d1c-4bfc-b438-553259a2e3ac" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac072451be471c6377a74f26/javablobstartincrementalcopyac28164036a97f241bfa4?comp=incrementalcopy", + "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" : "e2bcead4-5c8f-4bcc-bff2-ef7a1a1fafd7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "ca2b7bef-3b38-4fb8-bed1-d98d4f292981", + "ETag" : "\"0x8D73561ABC2C52A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd4ecd-501e-003f-754a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:50 GMT", + "x-ms-client-request-id" : "e2bcead4-5c8f-4bcc-bff2-ef7a1a1fafd7" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac072451be471c6377a74f26/javablobstartincrementalcopyac28164036a97f241bfa4", + "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" : "edb5ccb8-a205-4e72-bf2d-4deaf9176cf2" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-copy-destination-snapshot" : "2019-09-09T20:09:50.6112853Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:50 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:09:50 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd4ee4-501e-003f-0c4a-675777000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "ca2b7bef-3b38-4fb8-bed1-d98d4f292981", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac072451be471c6377a74f26/javablobstartincrementalcopyac170936b1d15307b18c4?snapshot=2019-09-09T20:09:50.5102125Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Mon, 09 Sep 2019 20:09:50 GMT", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:09:50 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73561ABC2C52A\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "edb5ccb8-a205-4e72-bf2d-4deaf9176cf2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac072451be471c6377a74f26/javablobstartincrementalcopyac170936b1d15307b18c4?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" : "80dd6808-90fa-43cd-a8c2-7eed3284ddd5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:51.7571053Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561AB9B38B3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4fbf-501e-003f-584a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:51 GMT", + "x-ms-client-request-id" : "80dd6808-90fa-43cd-a8c2-7eed3284ddd5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac072451be471c6377a74f26/javablobstartincrementalcopyac28164036a97f241bfa4?comp=incrementalcopy", + "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" : "378ba78e-4c3b-48cd-a6f1-420d0707299c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "4745baec-e7f9-4543-8c14-ab50fb5d7935", + "ETag" : "\"0x8D73561AC80E0CF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd4fd7-501e-003f-704a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:51 GMT", + "x-ms-client-request-id" : "378ba78e-4c3b-48cd-a6f1-420d0707299c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstartincrementalcopyac&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" : "d6895fb4-0509-4fe5-b997-0a8a1f9a398a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd4fee-501e-003f-054a-675777000000", + "Body" : "jtcstartincrementalcopyacjtcstartincrementalcopyac072451be471c6377a74f26Mon, 09 Sep 2019 20:09:50 GMT\"0x8D73561ABA87084\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:51 GMT", + "x-ms-client-request-id" : "d6895fb4-0509-4fe5-b997-0a8a1f9a398a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac072451be471c6377a74f26?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" : "4273ace1-46af-4e6c-90bf-5de1b90976e1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd500d-501e-003f-204a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:51 GMT", + "x-ms-client-request-id" : "4273ace1-46af-4e6c-90bf-5de1b90976e1" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyac072451be471c6377a74f26", "javablobstartincrementalcopyac170936b1d15307b18c4", "javablobstartincrementalcopyac28164036a97f241bfa4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[3].json new file mode 100644 index 000000000000..bc74adf4c37b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[3].json @@ -0,0 +1,279 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac0801222c7194d794124109?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" : "416064ea-f5c7-4d42-a3a4-3489e7975cc0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561ACDE0DD3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd5098-501e-003f-204a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:52 GMT", + "x-ms-client-request-id" : "416064ea-f5c7-4d42-a3a4-3489e7975cc0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac0801222c7194d794124109/javablobstartincrementalcopyac1574640ed0cab26fa04", + "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" : "7771d7d4-649d-4b20-b3d0-fe87a273aad2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561ACEAB26A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd50a6-501e-003f-2d4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:52 GMT", + "x-ms-client-request-id" : "7771d7d4-649d-4b20-b3d0-fe87a273aad2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac0801222c7194d794124109?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" : "5b646521-3349-4b4d-b3b1-1f0798520570", + "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" : "\"0x8D73561ACF6D88B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd50b4-501e-003f-3a4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:52 GMT", + "x-ms-client-request-id" : "5b646521-3349-4b4d-b3b1-1f0798520570" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac0801222c7194d794124109/javablobstartincrementalcopyac1574640ed0cab26fa04?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" : "3248e909-3661-4bd4-bbca-c2cd2a43ca6e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:52.6987773Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561ACEAB26A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd50be-501e-003f-444a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:52 GMT", + "x-ms-client-request-id" : "3248e909-3661-4bd4-bbca-c2cd2a43ca6e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac0801222c7194d794124109/javablobstartincrementalcopyac256016a65d348c2f304?comp=incrementalcopy", + "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" : "bdcbf1e0-4a48-410f-aad7-18f4562a144a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "66c90c59-5f3c-4bea-8bd8-ec1cbdec1d0a", + "ETag" : "\"0x8D73561AD10B7F5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd50cf-501e-003f-544a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:52 GMT", + "x-ms-client-request-id" : "bdcbf1e0-4a48-410f-aad7-18f4562a144a" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac0801222c7194d794124109/javablobstartincrementalcopyac256016a65d348c2f304", + "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" : "465bece6-dbae-4acc-a6bd-9dd49ccfb742" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-copy-destination-snapshot" : "2019-09-09T20:09:52.8008506Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:52 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:09:52 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd50e6-501e-003f-654a-675777000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "66c90c59-5f3c-4bea-8bd8-ec1cbdec1d0a", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac0801222c7194d794124109/javablobstartincrementalcopyac1574640ed0cab26fa04?snapshot=2019-09-09T20:09:52.6987773Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Mon, 09 Sep 2019 20:09:52 GMT", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:09:52 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73561AD10B7F5\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "465bece6-dbae-4acc-a6bd-9dd49ccfb742" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac0801222c7194d794124109/javablobstartincrementalcopyac1574640ed0cab26fa04?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" : "2d4ba338-c7cf-4aad-8d1f-251238ef9314" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:53.9476739Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561ACEAB26A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd51cc-501e-003f-3f4a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:53 GMT", + "x-ms-client-request-id" : "2d4ba338-c7cf-4aad-8d1f-251238ef9314" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac0801222c7194d794124109/javablobstartincrementalcopyac256016a65d348c2f304", + "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" : "c6b70204-fc60-49d1-b3b1-f14ef191dd34" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-copy-destination-snapshot" : "2019-09-09T20:09:52.8008506Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:52 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:09:52 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd51e5-501e-003f-564a-675777000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "66c90c59-5f3c-4bea-8bd8-ec1cbdec1d0a", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac0801222c7194d794124109/javablobstartincrementalcopyac1574640ed0cab26fa04?snapshot=2019-09-09T20:09:52.6987773Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Mon, 09 Sep 2019 20:09:53 GMT", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:09:52 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73561AD10B7F5\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "c6b70204-fc60-49d1-b3b1-f14ef191dd34" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac0801222c7194d794124109/javablobstartincrementalcopyac256016a65d348c2f304?comp=incrementalcopy", + "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" : "3dde910d-67ae-4cc2-9770-d81219f7439d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "d0b1e567-29e3-4ce9-9950-8eb88e55a858", + "ETag" : "\"0x8D73561ADDE8E0A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd51f7-501e-003f-654a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:53 GMT", + "x-ms-client-request-id" : "3dde910d-67ae-4cc2-9770-d81219f7439d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstartincrementalcopyac&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" : "29ca6d67-0890-4b0b-94dc-c7a8000d5dae" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd520e-501e-003f-7c4a-675777000000", + "Body" : "jtcstartincrementalcopyacjtcstartincrementalcopyac0801222c7194d794124109Mon, 09 Sep 2019 20:09:52 GMT\"0x8D73561ACF6D88B\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:53 GMT", + "x-ms-client-request-id" : "29ca6d67-0890-4b0b-94dc-c7a8000d5dae", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac0801222c7194d794124109?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" : "298be616-5c8c-4539-a832-5a097c7b930e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd5224-501e-003f-114a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:53 GMT", + "x-ms-client-request-id" : "298be616-5c8c-4539-a832-5a097c7b930e" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyac0801222c7194d794124109", "javablobstartincrementalcopyac1574640ed0cab26fa04", "javablobstartincrementalcopyac256016a65d348c2f304" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[4].json new file mode 100644 index 000000000000..2dce6b1f9ed4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyac[4].json @@ -0,0 +1,240 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac01330489a8b1b50ba5459e?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" : "f15bd39a-a284-4fdc-a717-2c17610dfaec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561AE0536E6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd5244-501e-003f-2f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:53 GMT", + "x-ms-client-request-id" : "f15bd39a-a284-4fdc-a717-2c17610dfaec" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac01330489a8b1b50ba5459e/javablobstartincrementalcopyac169347be2fca4a8a4e4", + "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" : "35041f22-4053-4568-967d-03f6173b2d4e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561AE11DC74\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd524e-501e-003f-384a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:54 GMT", + "x-ms-client-request-id" : "35041f22-4053-4568-967d-03f6173b2d4e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac01330489a8b1b50ba5459e?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" : "5132ac03-7566-44d9-87aa-1a27ec164605", + "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" : "\"0x8D73561AE1E5046\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd525b-501e-003f-454a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:54 GMT", + "x-ms-client-request-id" : "5132ac03-7566-44d9-87aa-1a27ec164605" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac01330489a8b1b50ba5459e/javablobstartincrementalcopyac169347be2fca4a8a4e4?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" : "c21ea8ed-b9db-47e1-960a-08b7ea9bb66c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:54.6411705Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561AE11DC74\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd526b-501e-003f-554a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:54 GMT", + "x-ms-client-request-id" : "c21ea8ed-b9db-47e1-960a-08b7ea9bb66c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac01330489a8b1b50ba5459e/javablobstartincrementalcopyac2786350a30c29186b04?comp=incrementalcopy", + "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" : "7232eb64-9550-48b7-af68-e7667c366878" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "a7dab41f-987e-4406-8e01-231d575da10b", + "ETag" : "\"0x8D73561AE391AAB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd527c-501e-003f-644a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:54 GMT", + "x-ms-client-request-id" : "7232eb64-9550-48b7-af68-e7667c366878" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac01330489a8b1b50ba5459e/javablobstartincrementalcopyac2786350a30c29186b04", + "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" : "5efc89cb-c634-430b-ad85-121e8de16468" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-copy-destination-snapshot" : "2019-09-09T20:09:54.7442436Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:54 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:09:54 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd5290-501e-003f-784a-675777000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "a7dab41f-987e-4406-8e01-231d575da10b", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac01330489a8b1b50ba5459e/javablobstartincrementalcopyac169347be2fca4a8a4e4?snapshot=2019-09-09T20:09:54.6411705Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Mon, 09 Sep 2019 20:09:54 GMT", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:09:54 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73561AE391AAB\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "5efc89cb-c634-430b-ad85-121e8de16468" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac01330489a8b1b50ba5459e/javablobstartincrementalcopyac169347be2fca4a8a4e4?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" : "7dc0c7c8-ce00-4ce1-b0cd-1e991930510b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:55.8950654Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561AE11DC74\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd535a-501e-003f-374a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:55 GMT", + "x-ms-client-request-id" : "7dc0c7c8-ce00-4ce1-b0cd-1e991930510b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac01330489a8b1b50ba5459e/javablobstartincrementalcopyac2786350a30c29186b04?comp=incrementalcopy", + "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" : "6bbf7d3e-e80a-4ed7-8a4c-33cf7cf10bd9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "434d617c-18b1-42f9-8f68-2cd2ab69bb09", + "ETag" : "\"0x8D73561AEF8BD29\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd5362-501e-003f-3f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:55 GMT", + "x-ms-client-request-id" : "6bbf7d3e-e80a-4ed7-8a4c-33cf7cf10bd9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstartincrementalcopyac&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" : "030c4a1d-3844-47f4-a766-6b3ac4740360" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd536d-501e-003f-4a4a-675777000000", + "Body" : "jtcstartincrementalcopyacjtcstartincrementalcopyac01330489a8b1b50ba5459eMon, 09 Sep 2019 20:09:54 GMT\"0x8D73561AE1E5046\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:55 GMT", + "x-ms-client-request-id" : "030c4a1d-3844-47f4-a766-6b3ac4740360", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyac01330489a8b1b50ba5459e?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" : "ea0fc023-03a5-4d8d-ba1c-e609a5fbe912" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd5387-501e-003f-614a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:55 GMT", + "x-ms-client-request-id" : "ea0fc023-03a5-4d8d-ba1c-e609a5fbe912" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyac01330489a8b1b50ba5459e", "javablobstartincrementalcopyac169347be2fca4a8a4e4", "javablobstartincrementalcopyac2786350a30c29186b04" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyacfail[0].json new file mode 100644 index 000000000000..6c289b67541e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyacfail[0].json @@ -0,0 +1,200 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail02940538d10d133e7e41?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" : "75722ecc-f207-4a5e-b785-98e36459fa66" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561AF209E0C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd5398-501e-003f-714a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:55 GMT", + "x-ms-client-request-id" : "75722ecc-f207-4a5e-b785-98e36459fa66" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail02940538d10d133e7e41/javablobstartincrementalcopyacfail1935634590b55ee0f", + "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" : "e1ea1b9f-a6a2-45d0-a220-6dc69af5541b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561AF33AE1A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd53b2-501e-003f-0a4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:55 GMT", + "x-ms-client-request-id" : "e1ea1b9f-a6a2-45d0-a220-6dc69af5541b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail02940538d10d133e7e41?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" : "da671824-99c1-4408-a7d2-f08244cad78c", + "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" : "\"0x8D73561AF3FFAE2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd53c4-501e-003f-1c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:56 GMT", + "x-ms-client-request-id" : "da671824-99c1-4408-a7d2-f08244cad78c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail02940538d10d133e7e41/javablobstartincrementalcopyacfail1935634590b55ee0f?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" : "490e50ef-776e-452e-9075-721265c38fa3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:56.5365261Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561AF33AE1A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd53d4-501e-003f-2b4a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:56 GMT", + "x-ms-client-request-id" : "490e50ef-776e-452e-9075-721265c38fa3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail02940538d10d133e7e41/javablobstartincrementalcopyacfail2795573e7513540c9?comp=incrementalcopy", + "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" : "9b255be3-4c86-4723-92d5-ad9158de3891" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "d95c3a4f-8462-4517-ab83-8d79b31bf85d", + "ETag" : "\"0x8D73561AF610802\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd53ea-501e-003f-3e4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:56 GMT", + "x-ms-client-request-id" : "9b255be3-4c86-4723-92d5-ad9158de3891" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail02940538d10d133e7e41/javablobstartincrementalcopyacfail1935634590b55ee0f?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" : "7e815e76-f4bd-4060-a7d0-e286a376f156" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:56.7506794Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561AF33AE1A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd53f7-501e-003f-4b4a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:56 GMT", + "x-ms-client-request-id" : "7e815e76-f4bd-4060-a7d0-e286a376f156" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail02940538d10d133e7e41/javablobstartincrementalcopyacfail2795573e7513540c9?comp=incrementalcopy", + "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" : "7d1cf9d1-2519-4514-bdb3-cb08b28e22b5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd5408-501e-003f-5a4a-675777000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd5408-501e-003f-5a4a-675777000000\nTime:2019-09-09T20:09:56.8388952Z", + "Date" : "Mon, 09 Sep 2019 20:09:56 GMT", + "x-ms-client-request-id" : "7d1cf9d1-2519-4514-bdb3-cb08b28e22b5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstartincrementalcopyacfail&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" : "599f1264-c239-4c0a-b897-7912d11975b2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd5414-501e-003f-654a-675777000000", + "Body" : "jtcstartincrementalcopyacfailjtcstartincrementalcopyacfail02940538d10d133e7e41Mon, 09 Sep 2019 20:09:56 GMT\"0x8D73561AF3FFAE2\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:56 GMT", + "x-ms-client-request-id" : "599f1264-c239-4c0a-b897-7912d11975b2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail02940538d10d133e7e41?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" : "800f3b48-f0cb-4bc4-8738-4ecc46718927" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd5424-501e-003f-744a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:56 GMT", + "x-ms-client-request-id" : "800f3b48-f0cb-4bc4-8738-4ecc46718927" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyacfail02940538d10d133e7e41", "javablobstartincrementalcopyacfail1935634590b55ee0f", "javablobstartincrementalcopyacfail2795573e7513540c9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyacfail[1].json new file mode 100644 index 000000000000..78c208003523 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyacfail[1].json @@ -0,0 +1,200 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail0597415968293a401141?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" : "63b3b41c-bbee-49d0-804d-a4e8bfadb9a6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561AFA21A74\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd5442-501e-003f-0e4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:56 GMT", + "x-ms-client-request-id" : "63b3b41c-bbee-49d0-804d-a4e8bfadb9a6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail0597415968293a401141/javablobstartincrementalcopyacfail1733439aeb518c99a", + "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" : "ce5a83a8-4684-4625-bbfa-3a3fdd5a6734" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561AFAF0F42\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd5452-501e-003f-1c4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:56 GMT", + "x-ms-client-request-id" : "ce5a83a8-4684-4625-bbfa-3a3fdd5a6734" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail0597415968293a401141?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" : "e6aeab81-970e-4e10-b0e7-632e157674b3", + "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" : "\"0x8D73561AFBB5BD4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd5467-501e-003f-314a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:56 GMT", + "x-ms-client-request-id" : "e6aeab81-970e-4e10-b0e7-632e157674b3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail0597415968293a401141/javablobstartincrementalcopyacfail1733439aeb518c99a?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" : "1021b3a5-a828-4144-af4c-1816ddec3e25" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:57.3441057Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561AFAF0F42\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd5472-501e-003f-3b4a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:56 GMT", + "x-ms-client-request-id" : "1021b3a5-a828-4144-af4c-1816ddec3e25" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail0597415968293a401141/javablobstartincrementalcopyacfail252915eea4b411e32?comp=incrementalcopy", + "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" : "5ed9781a-b12b-4349-86d7-eb7f4713f103" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "72f45e70-130a-44d5-9633-70558d8a2402", + "ETag" : "\"0x8D73561AFD56304\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd5480-501e-003f-494a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:57 GMT", + "x-ms-client-request-id" : "5ed9781a-b12b-4349-86d7-eb7f4713f103" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail0597415968293a401141/javablobstartincrementalcopyacfail1733439aeb518c99a?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" : "b86443c6-23ff-483a-8b06-cf069e61c8e5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:57.5132269Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561AFAF0F42\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd5496-501e-003f-5b4a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:57 GMT", + "x-ms-client-request-id" : "b86443c6-23ff-483a-8b06-cf069e61c8e5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail0597415968293a401141/javablobstartincrementalcopyacfail252915eea4b411e32?comp=incrementalcopy", + "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" : "9a173399-89fb-443f-ac06-29de3ec682d7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd54a5-501e-003f-6a4a-675777000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd54a5-501e-003f-6a4a-675777000000\nTime:2019-09-09T20:09:57.6014333Z", + "Date" : "Mon, 09 Sep 2019 20:09:57 GMT", + "x-ms-client-request-id" : "9a173399-89fb-443f-ac06-29de3ec682d7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstartincrementalcopyacfail&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" : "852d7821-e0ce-4103-93d5-c3845a624cfc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd54b5-501e-003f-7a4a-675777000000", + "Body" : "jtcstartincrementalcopyacfailjtcstartincrementalcopyacfail0597415968293a401141Mon, 09 Sep 2019 20:09:57 GMT\"0x8D73561AFBB5BD4\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:57 GMT", + "x-ms-client-request-id" : "852d7821-e0ce-4103-93d5-c3845a624cfc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail0597415968293a401141?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" : "c24a317b-3cac-4d0a-abe7-d7df74a81de0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd54c6-501e-003f-0b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:57 GMT", + "x-ms-client-request-id" : "c24a317b-3cac-4d0a-abe7-d7df74a81de0" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyacfail0597415968293a401141", "javablobstartincrementalcopyacfail1733439aeb518c99a", "javablobstartincrementalcopyacfail252915eea4b411e32" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyacfail[2].json new file mode 100644 index 000000000000..523998d05df3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyacfail[2].json @@ -0,0 +1,200 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail047333d95ce57fd8654c?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" : "fdef1161-2cf9-43ea-b9b1-fec3acbdeb9b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B01786AF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd54f0-501e-003f-2c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:57 GMT", + "x-ms-client-request-id" : "fdef1161-2cf9-43ea-b9b1-fec3acbdeb9b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail047333d95ce57fd8654c/javablobstartincrementalcopyacfail158910bb65276a0dd", + "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" : "88724800-740b-43b7-b6b6-944013c6c130" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B025B4A3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd5506-501e-003f-3b4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:57 GMT", + "x-ms-client-request-id" : "88724800-740b-43b7-b6b6-944013c6c130" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail047333d95ce57fd8654c?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" : "3ca28db5-ca9f-487a-a618-933d6444365a", + "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" : "\"0x8D73561B0324F2F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd551a-501e-003f-4d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:57 GMT", + "x-ms-client-request-id" : "3ca28db5-ca9f-487a-a618-933d6444365a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail047333d95ce57fd8654c/javablobstartincrementalcopyacfail158910bb65276a0dd?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" : "7898c778-80b3-416f-97e4-de0f8090d41a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:58.1256666Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B025B4A3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd552f-501e-003f-5f4a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:57 GMT", + "x-ms-client-request-id" : "7898c778-80b3-416f-97e4-de0f8090d41a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail047333d95ce57fd8654c/javablobstartincrementalcopyacfail213510540bb1bba09?comp=incrementalcopy", + "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" : "380cd375-0b06-42e2-98ad-3e1b666c1f95" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "ee64426c-8406-4c27-9c59-797b326cc9c9", + "ETag" : "\"0x8D73561B04CCBD2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd5548-501e-003f-784a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:57 GMT", + "x-ms-client-request-id" : "380cd375-0b06-42e2-98ad-3e1b666c1f95" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail047333d95ce57fd8654c/javablobstartincrementalcopyacfail158910bb65276a0dd?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" : "5b069226-8c1a-4c95-981f-531a446e96e0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:58.2947905Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B025B4A3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd555b-501e-003f-094a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:57 GMT", + "x-ms-client-request-id" : "5b069226-8c1a-4c95-981f-531a446e96e0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail047333d95ce57fd8654c/javablobstartincrementalcopyacfail213510540bb1bba09?comp=incrementalcopy", + "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" : "631e43cc-b8de-4762-aa18-32a138b13eb7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "TargetConditionNotMet", + "retry-after" : "0", + "Content-Length" : "265", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd556c-501e-003f-194a-675777000000", + "Body" : "TargetConditionNotMetThe target condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd556c-501e-003f-194a-675777000000\nTime:2019-09-09T20:09:58.3740403Z", + "Date" : "Mon, 09 Sep 2019 20:09:57 GMT", + "x-ms-client-request-id" : "631e43cc-b8de-4762-aa18-32a138b13eb7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstartincrementalcopyacfail&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" : "9b65d7dc-db6b-42bb-95fa-c79b9bc40507" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd5580-501e-003f-2d4a-675777000000", + "Body" : "jtcstartincrementalcopyacfailjtcstartincrementalcopyacfail047333d95ce57fd8654cMon, 09 Sep 2019 20:09:58 GMT\"0x8D73561B0324F2F\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:58 GMT", + "x-ms-client-request-id" : "9b65d7dc-db6b-42bb-95fa-c79b9bc40507", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail047333d95ce57fd8654c?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" : "9bf34321-341a-4742-bc09-e71e1348b850" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd5590-501e-003f-3d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:58 GMT", + "x-ms-client-request-id" : "9bf34321-341a-4742-bc09-e71e1348b850" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyacfail047333d95ce57fd8654c", "javablobstartincrementalcopyacfail158910bb65276a0dd", "javablobstartincrementalcopyacfail213510540bb1bba09" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyacfail[3].json new file mode 100644 index 000000000000..eb96ed415986 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyacfail[3].json @@ -0,0 +1,239 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail0868459bc97c0bf73c4d?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" : "8ca8fd46-6ecb-4bc1-a609-e9addea5d121" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B08D93B5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd55a6-501e-003f-534a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:58 GMT", + "x-ms-client-request-id" : "8ca8fd46-6ecb-4bc1-a609-e9addea5d121" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail0868459bc97c0bf73c4d/javablobstartincrementalcopyacfail1121217a5993a9ef6", + "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" : "8d12dce0-92eb-43ea-8f47-31d3f4089abf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B09A84E6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd55b8-501e-003f-644a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:58 GMT", + "x-ms-client-request-id" : "8d12dce0-92eb-43ea-8f47-31d3f4089abf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail0868459bc97c0bf73c4d?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" : "e08881cf-fb57-4a5a-bbc3-8a61eb040d01", + "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" : "\"0x8D73561B0A8CD3E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd55ce-501e-003f-784a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:58 GMT", + "x-ms-client-request-id" : "e08881cf-fb57-4a5a-bbc3-8a61eb040d01" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail0868459bc97c0bf73c4d/javablobstartincrementalcopyacfail1121217a5993a9ef6?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" : "b8107bd8-63c5-4627-9e8d-17ce90e010a6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:58.9042236Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B09A84E6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd55de-501e-003f-084a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:58 GMT", + "x-ms-client-request-id" : "b8107bd8-63c5-4627-9e8d-17ce90e010a6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail0868459bc97c0bf73c4d/javablobstartincrementalcopyacfail232527793148fc53a?comp=incrementalcopy", + "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" : "f0974b85-e7ed-43a3-8edc-53947f4983f5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "0742070a-be27-4a2c-8d6b-9dc81807154d", + "ETag" : "\"0x8D73561B0C39825\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd55f0-501e-003f-1a4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:58 GMT", + "x-ms-client-request-id" : "f0974b85-e7ed-43a3-8edc-53947f4983f5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail0868459bc97c0bf73c4d/javablobstartincrementalcopyacfail1121217a5993a9ef6?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" : "bbda60c7-1d08-4445-8896-f90dc200b885" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:59.0753442Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B09A84E6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd5607-501e-003f-2e4a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:58 GMT", + "x-ms-client-request-id" : "bbda60c7-1d08-4445-8896-f90dc200b885" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail0868459bc97c0bf73c4d/javablobstartincrementalcopyacfail232527793148fc53a", + "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" : "49e32614-c779-4ced-965f-c8859f9c242c" + }, + "Response" : { + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-tag-count" : "0", + "x-ms-copy-destination-snapshot" : "2019-09-09T20:09:59.0062958Z", + "x-ms-lease-state" : "available", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-blob-type" : "PageBlob", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:09:58 GMT", + "x-ms-incremental-copy" : "true", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd561b-501e-003f-424a-675777000000", + "Content-Type" : "application/octet-stream", + "x-ms-version" : "2019-02-02", + "x-ms-copy-id" : "0742070a-be27-4a2c-8d6b-9dc81807154d", + "x-ms-copy-source" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail0868459bc97c0bf73c4d/javablobstartincrementalcopyacfail1121217a5993a9ef6?snapshot=2019-09-09T20:09:58.9042236Z", + "x-ms-blob-sequence-number" : "0", + "x-ms-copy-progress" : "512/512", + "Date" : "Mon, 09 Sep 2019 20:09:58 GMT", + "x-ms-copy-completion-time" : "Mon, 09 Sep 2019 20:09:58 GMT", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D73561B0C39825\"", + "x-ms-copy-status" : "success", + "x-ms-client-request-id" : "49e32614-c779-4ced-965f-c8859f9c242c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail0868459bc97c0bf73c4d/javablobstartincrementalcopyacfail232527793148fc53a?comp=incrementalcopy", + "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" : "a882d2b0-46f0-4b65-afff-ebfa60778d62" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd562f-501e-003f-554a-675777000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd562f-501e-003f-554a-675777000000\nTime:2019-09-09T20:09:59.2427819Z", + "Date" : "Mon, 09 Sep 2019 20:09:58 GMT", + "x-ms-client-request-id" : "a882d2b0-46f0-4b65-afff-ebfa60778d62", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstartincrementalcopyacfail&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" : "71ccfa28-4e78-47b2-ad17-0a1d84f19c0b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd5642-501e-003f-664a-675777000000", + "Body" : "jtcstartincrementalcopyacfailjtcstartincrementalcopyacfail0868459bc97c0bf73c4dMon, 09 Sep 2019 20:09:58 GMT\"0x8D73561B0A8CD3E\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:58 GMT", + "x-ms-client-request-id" : "71ccfa28-4e78-47b2-ad17-0a1d84f19c0b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyacfail0868459bc97c0bf73c4d?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" : "c5794a89-f561-4c6f-9d68-78405743c08a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd5654-501e-003f-784a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:58 GMT", + "x-ms-client-request-id" : "c5794a89-f561-4c6f-9d68-78405743c08a" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyacfail0868459bc97c0bf73c4d", "javablobstartincrementalcopyacfail1121217a5993a9ef6", "javablobstartincrementalcopyacfail232527793148fc53a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyerror.json new file mode 100644 index 000000000000..b5e3df614dcf --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopyerror.json @@ -0,0 +1,109 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyerror0163393dab5efa979e4f?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" : "0a5bdb1a-aa9a-4dbc-a92a-bb408cc6de33" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B1110F52\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd566a-501e-003f-0e4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:59 GMT", + "x-ms-client-request-id" : "0a5bdb1a-aa9a-4dbc-a92a-bb408cc6de33" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyerror0163393dab5efa979e4f/javablobstartincrementalcopyerror1899461e58ad5d3c4a", + "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" : "31b8e85f-06b5-4407-a5bb-6ad2f10fb651" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B11F0F47\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd568f-501e-003f-2e4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:59 GMT", + "x-ms-client-request-id" : "31b8e85f-06b5-4407-a5bb-6ad2f10fb651" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyerror0163393dab5efa979e4f/javablobstartincrementalcopyerror2754146fe4c1dff925?comp=incrementalcopy", + "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" : "b54a2fde-432b-4fbc-8681-359ab57d36e3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidSourceBlobUrl", + "retry-after" : "0", + "Content-Length" : "270", + "StatusCode" : "409", + "x-ms-request-id" : "9ebd56b8-501e-003f-554a-675777000000", + "Body" : "InvalidSourceBlobUrlThe source url for incremental copy request must be valid azure storage blob url.\nRequestId:9ebd56b8-501e-003f-554a-675777000000\nTime:2019-09-09T20:09:59.7061092Z", + "Date" : "Mon, 09 Sep 2019 20:09:59 GMT", + "x-ms-client-request-id" : "b54a2fde-432b-4fbc-8681-359ab57d36e3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstartincrementalcopyerror&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" : "1bba2b01-aa07-4832-8da6-8c6532b0fe22" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd56de-501e-003f-744a-675777000000", + "Body" : "jtcstartincrementalcopyerrorjtcstartincrementalcopyerror0163393dab5efa979e4fMon, 09 Sep 2019 20:09:59 GMT\"0x8D73561B1110F52\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:59 GMT", + "x-ms-client-request-id" : "1bba2b01-aa07-4832-8da6-8c6532b0fe22", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopyerror0163393dab5efa979e4f?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" : "730c989d-57e1-46be-b73e-37cbf2305903" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd56f6-501e-003f-0b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:59 GMT", + "x-ms-client-request-id" : "730c989d-57e1-46be-b73e-37cbf2305903" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopyerror0163393dab5efa979e4f", "javablobstartincrementalcopyerror1899461e58ad5d3c4a", "javablobstartincrementalcopyerror2754146fe4c1dff925" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopymin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopymin.json new file mode 100644 index 000000000000..67f4f03b797a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITeststartincrementalcopymin.json @@ -0,0 +1,155 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopymin064235a41af71ea404415?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" : "5ad684bf-501c-4298-9942-ed2136956fe9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A8FAEFF1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4ac3-501e-003f-414a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:45 GMT", + "x-ms-client-request-id" : "5ad684bf-501c-4298-9942-ed2136956fe9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopymin064235a41af71ea404415/javablobstartincrementalcopymin129740497e0db958a24", + "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" : "a1f32ded-d7a9-4dd8-9d76-55825650d40b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A908552E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4ad7-501e-003f-534a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:45 GMT", + "x-ms-client-request-id" : "a1f32ded-d7a9-4dd8-9d76-55825650d40b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopymin064235a41af71ea404415?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" : "01069330-0fad-4b9f-af23-53d521a99fdf", + "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" : "\"0x8D73561A9145508\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd4ae6-501e-003f-614a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:45 GMT", + "x-ms-client-request-id" : "01069330-0fad-4b9f-af23-53d521a99fdf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopymin064235a41af71ea404415/javablobstartincrementalcopymin129740497e0db958a24?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" : "bddc10c1-31dd-4b87-b438-4ff1a4e3075a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T20:09:46.1871159Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561A908552E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd4afa-501e-003f-734a-675777000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 20:09:45 GMT", + "x-ms-client-request-id" : "bddc10c1-31dd-4b87-b438-4ff1a4e3075a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopymin064235a41af71ea404415/javablobstartincrementalcopymin2451117262e3fdd6474?comp=incrementalcopy", + "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" : "dba40e32-46fe-4d40-8108-acefa0238e4e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-copy-id" : "5ddd22f0-122e-4932-a575-733c7f9d72e8", + "ETag" : "\"0x8D73561A92F9372\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-copy-status" : "pending", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd4b07-501e-003f-7e4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:45 GMT", + "x-ms-client-request-id" : "dba40e32-46fe-4d40-8108-acefa0238e4e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcstartincrementalcopymin&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" : "ec930b58-d072-476c-a1fd-864f4781cc9b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd4b20-501e-003f-144a-675777000000", + "Body" : "jtcstartincrementalcopyminjtcstartincrementalcopymin064235a41af71ea404415Mon, 09 Sep 2019 20:09:46 GMT\"0x8D73561A9145508\"unlockedavailableblob$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:45 GMT", + "x-ms-client-request-id" : "ec930b58-d072-476c-a1fd-864f4781cc9b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcstartincrementalcopymin064235a41af71ea404415?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" : "68bfc51d-8326-472c-ba73-c4b0dfefa388" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd4b34-501e-003f-284a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:46 GMT", + "x-ms-client-request-id" : "68bfc51d-8326-472c-ba73-c4b0dfefa388" + }, + "Exception" : null + } ], + "variables" : [ "jtcstartincrementalcopymin064235a41af71ea404415", "javablobstartincrementalcopymin129740497e0db958a24", "javablobstartincrementalcopymin2451117262e3fdd6474" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpage.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpage.json new file mode 100644 index 000000000000..6c31306e3df5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpage.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpage0pageblobapitestuploadpage7ef38567681d6134?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" : "ec0175d2-d735-41b6-a9fd-caf03aa23fa4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617C068383\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb20b9-301e-0042-704a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:30 GMT", + "x-ms-client-request-id" : "ec0175d2-d735-41b6-a9fd-caf03aa23fa4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpage0pageblobapitestuploadpage7ef38567681d6134/javablobuploadpage1pageblobapitestuploadpage7ef623025adf1", + "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" : "c628e45e-6c03-4ba3-9bb5-642f4c9424bb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617C149C6E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb20c9-301e-0042-7d4a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:30 GMT", + "x-ms-client-request-id" : "c628e45e-6c03-4ba3-9bb5-642f4c9424bb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpage0pageblobapitestuploadpage7ef38567681d6134/javablobuploadpage1pageblobapitestuploadpage7ef623025adf1?comp=page", + "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" : "e9f6e9ee-fc2e-4ab5-820d-aa6b686b3277", + "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" : "R2k1WFLFbMM=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:30 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:30 GMT", + "ETag" : "\"0x8D735617C25B693\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cb20d8-301e-0042-0c4a-67cbbf000000", + "x-ms-client-request-id" : "e9f6e9ee-fc2e-4ab5-820d-aa6b686b3277" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpage&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" : "02056eba-186a-4acf-9a5c-34fcb106a6ae" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb20e5-301e-0042-174a-67cbbf000000", + "Body" : "jtcuploadpagejtcuploadpage0pageblobapitestuploadpage7ef38567681d6134Mon, 09 Sep 2019 20:08:30 GMT\"0x8D735617C068383\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:30 GMT", + "x-ms-client-request-id" : "02056eba-186a-4acf-9a5c-34fcb106a6ae", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpage0pageblobapitestuploadpage7ef38567681d6134?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" : "281eb99b-5446-419e-a0f4-cdcbf08d1120" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb20f2-301e-0042-244a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:30 GMT", + "x-ms-client-request-id" : "281eb99b-5446-419e-a0f4-cdcbf08d1120" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpage0pageblobapitestuploadpage7ef38567681d6134", "javablobuploadpage1pageblobapitestuploadpage7ef623025adf1", "d947cb74-0850-4182-82aa-2deb346beb41" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[0].json new file mode 100644 index 000000000000..b1cb3c606c83 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[0].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacb2513741153f68?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" : "eee49878-fd91-48f9-952a-84568f1d2690" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617D995EA5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd03a2-501e-003f-344a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:32 GMT", + "x-ms-client-request-id" : "eee49878-fd91-48f9-952a-84568f1d2690" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacb2513741153f68/javablobuploadpageac1pageblobapitestuploadpageacb2541438ebb", + "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" : "d8300e5c-1a0b-4dfa-89a3-092169d887cf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617DA74602\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd03b0-501e-003f-414a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:32 GMT", + "x-ms-client-request-id" : "d8300e5c-1a0b-4dfa-89a3-092169d887cf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacb2513741153f68/javablobuploadpageac1pageblobapitestuploadpageacb2541438ebb?comp=page", + "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" : "b4adfa10-f8bb-43fa-965c-673ffa5ed2d8", + "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" : "yEuXVBHiv1k=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:33 GMT", + "ETag" : "\"0x8D735617DB5C794\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd03c3-501e-003f-524a-675777000000", + "x-ms-client-request-id" : "b4adfa10-f8bb-43fa-965c-673ffa5ed2d8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpageac&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" : "d19fbcf5-b575-4bef-8e6d-aff05e2cf6e6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd03d6-501e-003f-634a-675777000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageacb2513741153f68Mon, 09 Sep 2019 20:08:33 GMT\"0x8D735617D995EA5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:33 GMT", + "x-ms-client-request-id" : "d19fbcf5-b575-4bef-8e6d-aff05e2cf6e6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacb2513741153f68?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" : "713702cb-fb9f-4ec5-a226-3e0a1a4e7abb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd03e2-501e-003f-6f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:33 GMT", + "x-ms-client-request-id" : "713702cb-fb9f-4ec5-a226-3e0a1a4e7abb" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageacb2513741153f68", "javablobuploadpageac1pageblobapitestuploadpageacb2541438ebb", "56c3d428-1111-48d7-b29f-790300381f7f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[1].json new file mode 100644 index 000000000000..c5b3b3539896 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[1].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacc0003952de6947?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" : "9726e58b-25d8-4fa8-ab3f-99201d018a8d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617DDDC6FE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd03f7-501e-003f-034a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:33 GMT", + "x-ms-client-request-id" : "9726e58b-25d8-4fa8-ab3f-99201d018a8d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacc0003952de6947/javablobuploadpageac1pageblobapitestuploadpageacc00216446dd", + "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" : "fc87bcb8-23a2-48ab-aa48-a263c418b480" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617DEAC403\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd040b-501e-003f-154a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:33 GMT", + "x-ms-client-request-id" : "fc87bcb8-23a2-48ab-aa48-a263c418b480" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacc0003952de6947/javablobuploadpageac1pageblobapitestuploadpageacc00216446dd?comp=page", + "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" : "04e2d19a-48c5-4629-bd8c-bdb9e4571d90", + "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" : "QMjrO6qOO0g=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:33 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:33 GMT", + "ETag" : "\"0x8D735617DF7979A\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd0420-501e-003f-2a4a-675777000000", + "x-ms-client-request-id" : "04e2d19a-48c5-4629-bd8c-bdb9e4571d90" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpageac&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" : "aaf63c35-a2d3-4bde-b8f3-ab8762e53cf9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd042f-501e-003f-394a-675777000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageacc0003952de6947Mon, 09 Sep 2019 20:08:33 GMT\"0x8D735617DDDC6FE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:33 GMT", + "x-ms-client-request-id" : "aaf63c35-a2d3-4bde-b8f3-ab8762e53cf9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacc0003952de6947?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" : "46760477-fb13-426a-bd8d-410a238eddc1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd043e-501e-003f-454a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:33 GMT", + "x-ms-client-request-id" : "46760477-fb13-426a-bd8d-410a238eddc1" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageacc0003952de6947", "javablobuploadpageac1pageblobapitestuploadpageacc00216446dd", "ca685533-ac27-4871-a4b7-cd3f0e529ca9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[2].json new file mode 100644 index 000000000000..b5925f7b43e9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[2].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageace1e37638ab55ce?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" : "f5db4371-5a7f-4941-aa6a-54065ab1ef20" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617E1F6FBC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0454-501e-003f-594a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:33 GMT", + "x-ms-client-request-id" : "f5db4371-5a7f-4941-aa6a-54065ab1ef20" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageace1e37638ab55ce/javablobuploadpageac1pageblobapitestuploadpageace1e06280672", + "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" : "f3980886-6a93-4e20-a951-2fc85c63f34a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617E2CE238\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0483-501e-003f-044a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:33 GMT", + "x-ms-client-request-id" : "f3980886-6a93-4e20-a951-2fc85c63f34a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageace1e37638ab55ce/javablobuploadpageac1pageblobapitestuploadpageace1e06280672?comp=page", + "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" : "54e1d5ef-87bf-4da3-8969-e5afa719a669", + "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" : "lqeBbeloc9o=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:33 GMT", + "ETag" : "\"0x8D735617E3A7949\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd04a1-501e-003f-1e4a-675777000000", + "x-ms-client-request-id" : "54e1d5ef-87bf-4da3-8969-e5afa719a669" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpageac&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" : "2666de8e-93ac-407e-93a8-346b9b376afd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd04bc-501e-003f-364a-675777000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageace1e37638ab55ceMon, 09 Sep 2019 20:08:34 GMT\"0x8D735617E1F6FBC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:34 GMT", + "x-ms-client-request-id" : "2666de8e-93ac-407e-93a8-346b9b376afd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageace1e37638ab55ce?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" : "d256df98-7a03-4c17-acbd-99bcab160651" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd04e0-501e-003f-564a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:34 GMT", + "x-ms-client-request-id" : "d256df98-7a03-4c17-acbd-99bcab160651" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageace1e37638ab55ce", "javablobuploadpageac1pageblobapitestuploadpageace1e06280672", "433feb8b-ef58-4ac2-8f8b-520216262274" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[3].json new file mode 100644 index 000000000000..da0e2d175455 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[3].json @@ -0,0 +1,144 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacc0f30559270800?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" : "0426a2a1-69a1-483a-922b-500a0a1ccffd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617E61B4D2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd04f6-501e-003f-6c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:34 GMT", + "x-ms-client-request-id" : "0426a2a1-69a1-483a-922b-500a0a1ccffd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacc0f30559270800/javablobuploadpageac1pageblobapitestuploadpageacc0f509947ca", + "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" : "6bd12d48-ff00-429a-b298-ac716f580369" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617E6ED957\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0503-501e-003f-784a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:34 GMT", + "x-ms-client-request-id" : "6bd12d48-ff00-429a-b298-ac716f580369" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacc0f30559270800/javablobuploadpageac1pageblobapitestuploadpageacc0f509947ca", + "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" : "7e4966db-e32e-41e0-9ca7-0265fa1d8b16" + }, + "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", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:34 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:08:34 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735617E6ED957\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:08:34 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd051b-501e-003f-104a-675777000000", + "x-ms-client-request-id" : "7e4966db-e32e-41e0-9ca7-0265fa1d8b16", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacc0f30559270800/javablobuploadpageac1pageblobapitestuploadpageacc0f509947ca?comp=page", + "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" : "336a741a-608b-40f0-8cf0-6b918d74b5d5", + "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" : "cbLAbKa1MsE=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:34 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:34 GMT", + "ETag" : "\"0x8D735617E894404\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd0527-501e-003f-1c4a-675777000000", + "x-ms-client-request-id" : "336a741a-608b-40f0-8cf0-6b918d74b5d5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpageac&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" : "c8d5a935-6d24-4d2a-8670-4164e6082fbd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd054e-501e-003f-404a-675777000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageacc0f30559270800Mon, 09 Sep 2019 20:08:34 GMT\"0x8D735617E61B4D2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:34 GMT", + "x-ms-client-request-id" : "c8d5a935-6d24-4d2a-8670-4164e6082fbd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacc0f30559270800?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" : "6fc5e994-5b51-4100-be2c-ad3f0654a569" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd0573-501e-003f-5d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:34 GMT", + "x-ms-client-request-id" : "6fc5e994-5b51-4100-be2c-ad3f0654a569" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageacc0f30559270800", "javablobuploadpageac1pageblobapitestuploadpageacc0f509947ca", "dc80b7ce-9c90-4c9c-a84f-32ace5f6df49" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[4].json new file mode 100644 index 000000000000..004c5fe53209 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[4].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacbbd70199f33fee?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" : "bbee3c29-6467-4520-8c67-af59cb0e5d5d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617EAFBBD0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0580-501e-003f-694a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:34 GMT", + "x-ms-client-request-id" : "bbee3c29-6467-4520-8c67-af59cb0e5d5d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacbbd70199f33fee/javablobuploadpageac1pageblobapitestuploadpageacbbd5536455f", + "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" : "2de1757b-33ff-4f74-81e3-3d56b4326633" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617EBD2ECB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0595-501e-003f-7c4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:34 GMT", + "x-ms-client-request-id" : "2de1757b-33ff-4f74-81e3-3d56b4326633" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacbbd70199f33fee/javablobuploadpageac1pageblobapitestuploadpageacbbd5536455f?comp=page", + "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" : "99fce69b-576b-4832-aee2-e4b715b89fbb", + "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" : "Isoc17u7rJA=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:34 GMT", + "ETag" : "\"0x8D735617ECA77AE\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd05aa-501e-003f-0f4a-675777000000", + "x-ms-client-request-id" : "99fce69b-576b-4832-aee2-e4b715b89fbb" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpageac&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" : "045e6c38-3ea5-4314-9e78-8bf348f66161" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd05c4-501e-003f-274a-675777000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageacbbd70199f33feeMon, 09 Sep 2019 20:08:34 GMT\"0x8D735617EAFBBD0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:34 GMT", + "x-ms-client-request-id" : "045e6c38-3ea5-4314-9e78-8bf348f66161", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacbbd70199f33fee?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" : "c3c07415-37be-4941-904a-feaef5f24845" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd05d8-501e-003f-3a4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:35 GMT", + "x-ms-client-request-id" : "c3c07415-37be-4941-904a-feaef5f24845" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageacbbd70199f33fee", "javablobuploadpageac1pageblobapitestuploadpageacbbd5536455f", "97963ee3-be44-47ee-bc63-f741d92c4ade" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[5].json new file mode 100644 index 000000000000..322a6fda3e30 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[5].json @@ -0,0 +1,134 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac886715143b674c?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" : "3a948e7d-dd38-4ff6-930f-7add233d7bca" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617EF0A119\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd05f5-501e-003f-534a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:35 GMT", + "x-ms-client-request-id" : "3a948e7d-dd38-4ff6-930f-7add233d7bca" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac886715143b674c/javablobuploadpageac1pageblobapitestuploadpageac886912777e2", + "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" : "5b25bfff-d31f-4e5a-bb20-827e1573b465" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617EFDED36\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd060b-501e-003f-684a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:35 GMT", + "x-ms-client-request-id" : "5b25bfff-d31f-4e5a-bb20-827e1573b465" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac886715143b674c/javablobuploadpageac1pageblobapitestuploadpageac886912777e2?comp=lease", + "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" : "be6dd2ca-134b-48d2-87ce-bd09dc9998fb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617EFDED36\"", + "x-ms-lease-id" : "5d4bffee-0f4d-47dd-afda-1fb58a26f647", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd061f-501e-003f-794a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:35 GMT", + "x-ms-client-request-id" : "be6dd2ca-134b-48d2-87ce-bd09dc9998fb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac886715143b674c/javablobuploadpageac1pageblobapitestuploadpageac886912777e2?comp=page", + "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" : "144a4e3d-0a78-4acf-bcbc-cb101e1fcf28", + "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" : "xtVer04oh34=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:35 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:35 GMT", + "ETag" : "\"0x8D735617F171F25\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd062c-501e-003f-054a-675777000000", + "x-ms-client-request-id" : "144a4e3d-0a78-4acf-bcbc-cb101e1fcf28" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpageac&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" : "ff885343-4f24-4782-86c7-98070974b2c5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd063a-501e-003f-134a-675777000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageac886715143b674cMon, 09 Sep 2019 20:08:35 GMT\"0x8D735617EF0A119\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:35 GMT", + "x-ms-client-request-id" : "ff885343-4f24-4782-86c7-98070974b2c5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageac886715143b674c?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" : "b57b4320-2956-449b-b2eb-8fc38aa439b3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd0649-501e-003f-204a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:35 GMT", + "x-ms-client-request-id" : "b57b4320-2956-449b-b2eb-8fc38aa439b3" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageac886715143b674c", "javablobuploadpageac1pageblobapitestuploadpageac886912777e2", "26235e10-0031-4aab-9ee7-c6ea93fcfe52" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[6].json new file mode 100644 index 000000000000..0e5308f58f09 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[6].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacc07564915c1f1a?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" : "672cf3ef-e473-4ba7-b014-1c28189b0087" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617F3F6B91\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd065d-501e-003f-344a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:35 GMT", + "x-ms-client-request-id" : "672cf3ef-e473-4ba7-b014-1c28189b0087" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacc07564915c1f1a/javablobuploadpageac1pageblobapitestuploadpageacc0755034e14", + "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" : "caa65871-105c-4c43-9ac6-f4c4286d8e28" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617F4CB7EC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd066f-501e-003f-434a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:35 GMT", + "x-ms-client-request-id" : "caa65871-105c-4c43-9ac6-f4c4286d8e28" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacc07564915c1f1a/javablobuploadpageac1pageblobapitestuploadpageacc0755034e14?comp=page", + "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" : "a68cc548-a9d6-4d03-b94b-4a7a410f233e", + "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" : "iKapumz/X5c=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:35 GMT", + "ETag" : "\"0x8D735617F59B2A1\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd067e-501e-003f-514a-675777000000", + "x-ms-client-request-id" : "a68cc548-a9d6-4d03-b94b-4a7a410f233e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpageac&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" : "db180f86-feeb-4f5d-a072-d9246b6c85ce" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd0694-501e-003f-644a-675777000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageacc07564915c1f1aMon, 09 Sep 2019 20:08:35 GMT\"0x8D735617F3F6B91\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:35 GMT", + "x-ms-client-request-id" : "db180f86-feeb-4f5d-a072-d9246b6c85ce", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacc07564915c1f1a?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" : "33be0caf-fcad-43c0-9e85-50f2cd9d03b1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd06b3-501e-003f-804a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:35 GMT", + "x-ms-client-request-id" : "33be0caf-fcad-43c0-9e85-50f2cd9d03b1" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageacc07564915c1f1a", "javablobuploadpageac1pageblobapitestuploadpageacc0755034e14", "b9413581-105c-4c2e-a203-00ad866ced42" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[7].json new file mode 100644 index 000000000000..cdd6f054180c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[7].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacfb9677035fb1af?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" : "5dd33b98-36ee-40c9-847f-e03e764fcae9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617F8225EF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd06cb-501e-003f-174a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:36 GMT", + "x-ms-client-request-id" : "5dd33b98-36ee-40c9-847f-e03e764fcae9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacfb9677035fb1af/javablobuploadpageac1pageblobapitestuploadpageacfb963607eb8", + "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" : "a4e1284a-77f3-493f-8999-670cfa61b5e5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617F8F727C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd06e8-501e-003f-2d4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:36 GMT", + "x-ms-client-request-id" : "a4e1284a-77f3-493f-8999-670cfa61b5e5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacfb9677035fb1af/javablobuploadpageac1pageblobapitestuploadpageacfb963607eb8?comp=page", + "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" : "35cd79bc-13a8-4e07-851b-5c0df747d682", + "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" : "FwlfgF6xGAU=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:36 GMT", + "ETag" : "\"0x8D735617F9D57B2\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd06fc-501e-003f-404a-675777000000", + "x-ms-client-request-id" : "35cd79bc-13a8-4e07-851b-5c0df747d682" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpageac&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" : "e8212ba9-9ee2-4e4f-8d88-378e43441025" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd0712-501e-003f-534a-675777000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageacfb9677035fb1afMon, 09 Sep 2019 20:08:36 GMT\"0x8D735617F8225EF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:36 GMT", + "x-ms-client-request-id" : "e8212ba9-9ee2-4e4f-8d88-378e43441025", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacfb9677035fb1af?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" : "fe8e443f-bbf0-42a2-a18a-8c10b2ff4e55" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd0732-501e-003f-704a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:36 GMT", + "x-ms-client-request-id" : "fe8e443f-bbf0-42a2-a18a-8c10b2ff4e55" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageacfb9677035fb1af", "javablobuploadpageac1pageblobapitestuploadpageacfb963607eb8", "84b35eb4-e926-45bc-af92-04fe9d906e4b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[8].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[8].json new file mode 100644 index 000000000000..cf6e218c656e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageac[8].json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacf3c941532c27d8?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" : "66e8361f-3941-419f-9cd7-0c0b71c65568" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617FC3A78B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd074d-501e-003f-0b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:36 GMT", + "x-ms-client-request-id" : "66e8361f-3941-419f-9cd7-0c0b71c65568" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacf3c941532c27d8/javablobuploadpageac1pageblobapitestuploadpageacf3c943528ff", + "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" : "c0cbfd18-1467-431c-b52d-05b3061045fb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617FD0A60E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0761-501e-003f-1b4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:36 GMT", + "x-ms-client-request-id" : "c0cbfd18-1467-431c-b52d-05b3061045fb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacf3c941532c27d8/javablobuploadpageac1pageblobapitestuploadpageacf3c943528ff?comp=page", + "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" : "bb97e3cb-d8d9-4525-a2bf-34cde9b9ed5d", + "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" : "WiXTiqpoGyA=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:36 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:36 GMT", + "ETag" : "\"0x8D735617FDD045C\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd0770-501e-003f-2a4a-675777000000", + "x-ms-client-request-id" : "bb97e3cb-d8d9-4525-a2bf-34cde9b9ed5d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpageac&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" : "079825fc-3110-4b85-8c6e-40db8ea2c09a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd0783-501e-003f-3c4a-675777000000", + "Body" : "jtcuploadpageacjtcuploadpageac0pageblobapitestuploadpageacf3c941532c27d8Mon, 09 Sep 2019 20:08:36 GMT\"0x8D735617FC3A78B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:36 GMT", + "x-ms-client-request-id" : "079825fc-3110-4b85-8c6e-40db8ea2c09a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageac0pageblobapitestuploadpageacf3c941532c27d8?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" : "779a531c-0c3d-475a-b5bf-41a55771b8bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd07a2-501e-003f-574a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:36 GMT", + "x-ms-client-request-id" : "779a531c-0c3d-475a-b5bf-41a55771b8bf" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageac0pageblobapitestuploadpageacf3c941532c27d8", "javablobuploadpageac1pageblobapitestuploadpageacf3c943528ff", "83405de5-d037-4499-8fa0-3c03493ac65c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[0].json new file mode 100644 index 000000000000..cedb03c3f34e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[0].json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail6fd61320dd?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" : "4862732b-e469-4901-a604-6c9d53a11e2f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618002427C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd07c8-501e-003f-754a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:36 GMT", + "x-ms-client-request-id" : "4862732b-e469-4901-a604-6c9d53a11e2f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail6fd61320dd/javablobuploadpageacfail113367990f08ca55734d8b", + "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" : "9e74e192-df05-4797-b153-419f5a1c83cb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561800F19FB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd07da-501e-003f-044a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:37 GMT", + "x-ms-client-request-id" : "9e74e192-df05-4797-b153-419f5a1c83cb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail6fd61320dd/javablobuploadpageacfail113367990f08ca55734d8b?comp=page", + "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" : "6db548f2-5cd8-4862-95c7-3b82d67f734f", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd07f3-501e-003f-1a4a-675777000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd07f3-501e-003f-1a4a-675777000000\nTime:2019-09-09T20:08:37.3597278Z", + "Date" : "Mon, 09 Sep 2019 20:08:37 GMT", + "x-ms-client-request-id" : "6db548f2-5cd8-4862-95c7-3b82d67f734f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpageacfail&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" : "52fe08e0-0a1c-4c9c-935c-44616c52a588" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd0815-501e-003f-3a4a-675777000000", + "Body" : "jtcuploadpageacfailjtcuploadpageacfail0pageblobapitestuploadpageacfail6fd61320ddMon, 09 Sep 2019 20:08:37 GMT\"0x8D735618002427C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:37 GMT", + "x-ms-client-request-id" : "52fe08e0-0a1c-4c9c-935c-44616c52a588", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail6fd61320dd?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" : "2ec6b1ad-5c6a-4548-b156-7f88d2d42013" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd0831-501e-003f-514a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:37 GMT", + "x-ms-client-request-id" : "2ec6b1ad-5c6a-4548-b156-7f88d2d42013" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageacfail0pageblobapitestuploadpageacfail6fd61320dd", "javablobuploadpageacfail113367990f08ca55734d8b", "bf1e213b-0758-46b0-9f02-279bce092acb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[1].json new file mode 100644 index 000000000000..ef6f7019bff0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[1].json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaile2b94626e8?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" : "9c153f02-d9da-415e-b6ae-a4c570b9c500" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618044124F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0850-501e-003f-6f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:37 GMT", + "x-ms-client-request-id" : "9c153f02-d9da-415e-b6ae-a4c570b9c500" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaile2b94626e8/javablobuploadpageacfail107407ea6ec95b9a304b19", + "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" : "d5eea954-246a-4943-a4e7-5d82219da6f8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618051FBA1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:37 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0868-501e-003f-054a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:37 GMT", + "x-ms-client-request-id" : "d5eea954-246a-4943-a4e7-5d82219da6f8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaile2b94626e8/javablobuploadpageacfail107407ea6ec95b9a304b19?comp=page", + "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" : "1c6eafa2-5ccb-4c2b-9c08-660335fbd353", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd0877-501e-003f-144a-675777000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd0877-501e-003f-144a-675777000000\nTime:2019-09-09T20:08:37.8040402Z", + "Date" : "Mon, 09 Sep 2019 20:08:37 GMT", + "x-ms-client-request-id" : "1c6eafa2-5ccb-4c2b-9c08-660335fbd353", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpageacfail&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" : "3f1c81dd-2508-4412-b587-38b743347a8d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd0888-501e-003f-244a-675777000000", + "Body" : "jtcuploadpageacfailjtcuploadpageacfail0pageblobapitestuploadpageacfaile2b94626e8Mon, 09 Sep 2019 20:08:37 GMT\"0x8D735618044124F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:37 GMT", + "x-ms-client-request-id" : "3f1c81dd-2508-4412-b587-38b743347a8d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfaile2b94626e8?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" : "f5dd2b31-54db-4932-955a-47dd7115a1ab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd08a1-501e-003f-3a4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:37 GMT", + "x-ms-client-request-id" : "f5dd2b31-54db-4932-955a-47dd7115a1ab" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageacfail0pageblobapitestuploadpageacfaile2b94626e8", "javablobuploadpageacfail107407ea6ec95b9a304b19", "78f53b50-930d-4613-be88-8ab46c656eca" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[2].json new file mode 100644 index 000000000000..43b1d11835ea --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[2].json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail2f937472d6?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" : "0a442090-208a-482c-aa47-efa2c3296b1c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618086304B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd08be-501e-003f-544a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:37 GMT", + "x-ms-client-request-id" : "0a442090-208a-482c-aa47-efa2c3296b1c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail2f937472d6/javablobuploadpageacfail120501cfb023815ac54413", + "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" : "19699e92-6961-417a-8d52-68487279fa2f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356180946808\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd08d5-501e-003f-684a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:37 GMT", + "x-ms-client-request-id" : "19699e92-6961-417a-8d52-68487279fa2f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail2f937472d6/javablobuploadpageacfail120501cfb023815ac54413?comp=page", + "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" : "46c8f457-f07f-4e55-ba7b-6f663f087545", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd08fc-501e-003f-0b4a-675777000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd08fc-501e-003f-0b4a-675777000000\nTime:2019-09-09T20:08:38.2423492Z", + "Date" : "Mon, 09 Sep 2019 20:08:37 GMT", + "x-ms-client-request-id" : "46c8f457-f07f-4e55-ba7b-6f663f087545", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpageacfail&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" : "b58d1980-69e2-496c-8bb9-ff304014dd79" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd092f-501e-003f-3b4a-675777000000", + "Body" : "jtcuploadpageacfailjtcuploadpageacfail0pageblobapitestuploadpageacfail2f937472d6Mon, 09 Sep 2019 20:08:38 GMT\"0x8D735618086304B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:38 GMT", + "x-ms-client-request-id" : "b58d1980-69e2-496c-8bb9-ff304014dd79", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail2f937472d6?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" : "63c3d691-1948-4db7-ab95-5ee52d3790a6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd094a-501e-003f-544a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:38 GMT", + "x-ms-client-request-id" : "63c3d691-1948-4db7-ab95-5ee52d3790a6" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageacfail0pageblobapitestuploadpageacfail2f937472d6", "javablobuploadpageacfail120501cfb023815ac54413", "0336c100-e0b6-4b72-a3cd-0879593dc0c4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[3].json new file mode 100644 index 000000000000..b5f790921d16 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[3].json @@ -0,0 +1,142 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail2881639740?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" : "b01586b1-e483-4f3e-b23f-ee66c6de812f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356180C98700\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0979-501e-003f-7a4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:38 GMT", + "x-ms-client-request-id" : "b01586b1-e483-4f3e-b23f-ee66c6de812f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail2881639740/javablobuploadpageacfail109608f54e56500f9a4d82", + "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" : "fecb91e2-3193-4c8d-ad11-a4e83e9dfc68" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356180D6AD52\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd098d-501e-003f-0c4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:38 GMT", + "x-ms-client-request-id" : "fecb91e2-3193-4c8d-ad11-a4e83e9dfc68" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail2881639740/javablobuploadpageacfail109608f54e56500f9a4d82", + "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" : "b85b6cd7-7b11-4a24-873f-6d36de0de1b2" + }, + "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", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:38 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:08:38 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7356180D6AD52\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:08:38 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd09a5-501e-003f-244a-675777000000", + "x-ms-client-request-id" : "b85b6cd7-7b11-4a24-873f-6d36de0de1b2", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail2881639740/javablobuploadpageacfail109608f54e56500f9a4d82?comp=page", + "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" : "c80c3897-2bff-4a74-801b-1c973ad3da53", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "252", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd09b6-501e-003f-354a-675777000000", + "Body" : "ConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd09b6-501e-003f-354a-675777000000\nTime:2019-09-09T20:08:38.7587133Z", + "Date" : "Mon, 09 Sep 2019 20:08:38 GMT", + "x-ms-client-request-id" : "c80c3897-2bff-4a74-801b-1c973ad3da53", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpageacfail&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" : "e3db9fac-c939-436b-92fe-a2c310400264" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd09c7-501e-003f-464a-675777000000", + "Body" : "jtcuploadpageacfailjtcuploadpageacfail0pageblobapitestuploadpageacfail2881639740Mon, 09 Sep 2019 20:08:38 GMT\"0x8D7356180C98700\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:38 GMT", + "x-ms-client-request-id" : "e3db9fac-c939-436b-92fe-a2c310400264", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail2881639740?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" : "eb29d59f-2331-48ea-97fb-44d55c2e13a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd09df-501e-003f-5c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:38 GMT", + "x-ms-client-request-id" : "eb29d59f-2331-48ea-97fb-44d55c2e13a4" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageacfail0pageblobapitestuploadpageacfail2881639740", "javablobuploadpageacfail109608f54e56500f9a4d82", "e5184af0-ee92-4023-be0e-03a19059b000" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[4].json new file mode 100644 index 000000000000..76ad88c7afa4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[4].json @@ -0,0 +1,132 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail972938053b?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" : "9520c5d0-6367-404c-a12a-edb2cdd510bb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356181189FA7\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd09f0-501e-003f-6d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:38 GMT", + "x-ms-client-request-id" : "9520c5d0-6367-404c-a12a-edb2cdd510bb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail972938053b/javablobuploadpageacfail125097e66a1899ba9e4d1e", + "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" : "aec77753-140c-42a0-9619-3d7efeb7ce22" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618126146A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0a1e-501e-003f-194a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:38 GMT", + "x-ms-client-request-id" : "aec77753-140c-42a0-9619-3d7efeb7ce22" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail972938053b/javablobuploadpageacfail125097e66a1899ba9e4d1e?comp=lease", + "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" : "ff518fa2-902c-4b3a-8c8b-63b6aac02804" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618126146A\"", + "x-ms-lease-id" : "ee8d49b9-17e4-45a3-b627-7afbe9fe1eb0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0a35-501e-003f-2d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:38 GMT", + "x-ms-client-request-id" : "ff518fa2-902c-4b3a-8c8b-63b6aac02804" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail972938053b/javablobuploadpageacfail125097e66a1899ba9e4d1e?comp=page", + "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" : "54153a4d-9a64-4e5a-a144-9e60a5eaee78", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseIdMismatchWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "264", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd0a48-501e-003f-3e4a-675777000000", + "Body" : "LeaseIdMismatchWithBlobOperationThe lease ID specified did not match the lease ID for the blob.\nRequestId:9ebd0a48-501e-003f-3e4a-675777000000\nTime:2019-09-09T20:08:39.2700736Z", + "Date" : "Mon, 09 Sep 2019 20:08:38 GMT", + "x-ms-client-request-id" : "54153a4d-9a64-4e5a-a144-9e60a5eaee78", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpageacfail&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" : "44b2c135-94ca-4f53-8862-e6186f4597e7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd0a5b-501e-003f-514a-675777000000", + "Body" : "jtcuploadpageacfailjtcuploadpageacfail0pageblobapitestuploadpageacfail972938053bMon, 09 Sep 2019 20:08:39 GMT\"0x8D7356181189FA7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:39 GMT", + "x-ms-client-request-id" : "44b2c135-94ca-4f53-8862-e6186f4597e7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail972938053b?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" : "40a2c156-2da7-4541-a2b1-dc3d8029e3fc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd0a6c-501e-003f-614a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:39 GMT", + "x-ms-client-request-id" : "40a2c156-2da7-4541-a2b1-dc3d8029e3fc" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageacfail0pageblobapitestuploadpageacfail972938053b", "javablobuploadpageacfail125097e66a1899ba9e4d1e", "e4ed0aaa-16df-48a8-9554-01413a948476" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[5].json new file mode 100644 index 000000000000..52579adf92b0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[5].json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfailb755164596?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" : "834e9750-fb3a-4dea-b80f-3ce3526a45f8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356181663167\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0a89-501e-003f-7c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:39 GMT", + "x-ms-client-request-id" : "834e9750-fb3a-4dea-b80f-3ce3526a45f8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfailb755164596/javablobuploadpageacfail15652992bd6bb0f8af44fd", + "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" : "79db6225-2c65-4cc5-abf6-2b8de21f0037" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618173A65A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0aa1-501e-003f-0e4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:39 GMT", + "x-ms-client-request-id" : "79db6225-2c65-4cc5-abf6-2b8de21f0037" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfailb755164596/javablobuploadpageacfail15652992bd6bb0f8af44fd?comp=page", + "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" : "e8ae7547-92e9-49c9-b5e1-bb174a80e2d3", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidInput", + "retry-after" : "0", + "Content-Length" : "220", + "StatusCode" : "400", + "x-ms-request-id" : "9ebd0abb-501e-003f-284a-675777000000", + "Body" : "InvalidInputOne of the request inputs is not valid.\nRequestId:9ebd0abb-501e-003f-284a-675777000000\nTime:2019-09-09T20:08:39.6983764Z", + "Date" : "Mon, 09 Sep 2019 20:08:39 GMT", + "x-ms-client-request-id" : "e8ae7547-92e9-49c9-b5e1-bb174a80e2d3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpageacfail&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" : "60b1e977-bcc2-4292-9500-f713d669bd96" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd0acb-501e-003f-374a-675777000000", + "Body" : "jtcuploadpageacfailjtcuploadpageacfail0pageblobapitestuploadpageacfailb755164596Mon, 09 Sep 2019 20:08:39 GMT\"0x8D7356181663167\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:39 GMT", + "x-ms-client-request-id" : "60b1e977-bcc2-4292-9500-f713d669bd96", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfailb755164596?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" : "f94b1100-498d-4152-bab9-a6d9ed54e4be" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd0ae1-501e-003f-4a4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:39 GMT", + "x-ms-client-request-id" : "f94b1100-498d-4152-bab9-a6d9ed54e4be" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageacfail0pageblobapitestuploadpageacfailb755164596", "javablobuploadpageacfail15652992bd6bb0f8af44fd", "91661d8a-abf7-40b3-8ee4-06f32f84ef22" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[6].json new file mode 100644 index 000000000000..438ec63a878f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[6].json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfailaf755503cc?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" : "779800b5-58a0-4326-9795-6819149a22fd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356181A6C88A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:39 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0b02-501e-003f-6a4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:39 GMT", + "x-ms-client-request-id" : "779800b5-58a0-4326-9795-6819149a22fd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfailaf755503cc/javablobuploadpageacfail127185ab3ea55da0224009", + "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" : "f7eb5735-5ee1-45c2-862f-ebbaf88aeedd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356181B43D8F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0b10-501e-003f-774a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:39 GMT", + "x-ms-client-request-id" : "f7eb5735-5ee1-45c2-862f-ebbaf88aeedd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfailaf755503cc/javablobuploadpageacfail127185ab3ea55da0224009?comp=page", + "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" : "8cb1374c-3889-4d70-9dec-e71864bfa3dd", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidInput", + "retry-after" : "0", + "Content-Length" : "220", + "StatusCode" : "400", + "x-ms-request-id" : "9ebd0b2b-501e-003f-0f4a-675777000000", + "Body" : "InvalidInputOne of the request inputs is not valid.\nRequestId:9ebd0b2b-501e-003f-0f4a-675777000000\nTime:2019-09-09T20:08:40.1296798Z", + "Date" : "Mon, 09 Sep 2019 20:08:39 GMT", + "x-ms-client-request-id" : "8cb1374c-3889-4d70-9dec-e71864bfa3dd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpageacfail&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" : "4613f785-606c-4dc1-9f67-338b4a95c69b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd0b3e-501e-003f-214a-675777000000", + "Body" : "jtcuploadpageacfailjtcuploadpageacfail0pageblobapitestuploadpageacfailaf755503ccMon, 09 Sep 2019 20:08:39 GMT\"0x8D7356181A6C88A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:39 GMT", + "x-ms-client-request-id" : "4613f785-606c-4dc1-9f67-338b4a95c69b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfailaf755503cc?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" : "7bdb01f7-c96d-41c5-a6d3-3c33b3567976" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd0b4e-501e-003f-314a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:40 GMT", + "x-ms-client-request-id" : "7bdb01f7-c96d-41c5-a6d3-3c33b3567976" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageacfail0pageblobapitestuploadpageacfailaf755503cc", "javablobuploadpageacfail127185ab3ea55da0224009", "2cd0ff06-60a5-4d6d-b9e5-a185cd96676d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[7].json new file mode 100644 index 000000000000..b9ab95e56b39 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageacfail[7].json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail7e282982be?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" : "37b25335-798d-4d32-82c0-30efa15a21c2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356181E9F822\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0b71-501e-003f-514a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:40 GMT", + "x-ms-client-request-id" : "37b25335-798d-4d32-82c0-30efa15a21c2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail7e282982be/javablobuploadpageacfail112799ee7c0fd5a36745b4", + "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" : "202b247d-9ff4-477a-a808-489a295953ee" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356181F71F25\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0b8a-501e-003f-674a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:40 GMT", + "x-ms-client-request-id" : "202b247d-9ff4-477a-a808-489a295953ee" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail7e282982be/javablobuploadpageacfail112799ee7c0fd5a36745b4?comp=page", + "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" : "efd161b4-2763-46cf-968e-2fd61f13750c", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "SequenceNumberConditionNotMet", + "retry-after" : "0", + "Content-Length" : "250", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd0b9e-501e-003f-794a-675777000000", + "Body" : "SequenceNumberConditionNotMetThe sequence number condition specified was not met.\nRequestId:9ebd0b9e-501e-003f-794a-675777000000\nTime:2019-09-09T20:08:40.5629860Z", + "Date" : "Mon, 09 Sep 2019 20:08:40 GMT", + "x-ms-client-request-id" : "efd161b4-2763-46cf-968e-2fd61f13750c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpageacfail&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" : "b21307d7-65be-4317-a86c-f359e7cf8c01" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd0bb6-501e-003f-114a-675777000000", + "Body" : "jtcuploadpageacfailjtcuploadpageacfail0pageblobapitestuploadpageacfail7e282982beMon, 09 Sep 2019 20:08:40 GMT\"0x8D7356181E9F822\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:40 GMT", + "x-ms-client-request-id" : "b21307d7-65be-4317-a86c-f359e7cf8c01", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageacfail0pageblobapitestuploadpageacfail7e282982be?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" : "8ef2cb94-6aca-480c-a90f-a4b82c339da1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd0bc5-501e-003f-204a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:40 GMT", + "x-ms-client-request-id" : "8ef2cb94-6aca-480c-a90f-a4b82c339da1" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageacfail0pageblobapitestuploadpageacfail7e282982be", "javablobuploadpageacfail112799ee7c0fd5a36745b4", "e16d66f0-0435-4317-8891-ab4950c1120c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageerror.json new file mode 100644 index 000000000000..4cb6caf95b00 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageerror.json @@ -0,0 +1,110 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageerror0pageblobapitestuploadpageerroref6209070b1?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" : "6101fbe9-b1b4-497f-9e11-75aa846f32c7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561822C8B61\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0bdc-501e-003f-364a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:40 GMT", + "x-ms-client-request-id" : "6101fbe9-b1b4-497f-9e11-75aa846f32c7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageerror0pageblobapitestuploadpageerroref6209070b1/javablobuploadpageerror1pageblobapitestuploadpageerroref662746", + "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" : "0fbe6e22-6036-4af4-9ebe-73ace0e8c809" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618239D9B6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0be9-501e-003f-424a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:40 GMT", + "x-ms-client-request-id" : "0fbe6e22-6036-4af4-9ebe-73ace0e8c809" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageerror0pageblobapitestuploadpageerroref6209070b1/javablobuploadpageerror2pageblobapitestuploadpageerroref691927?comp=page", + "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" : "3976c7b4-704b-4b00-baa2-8dc4b688a112", + "Content-Type" : "application/octet-stream" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "321", + "StatusCode" : "400", + "x-ms-request-id" : "9ebd0bff-501e-003f-574a-675777000000", + "Body" : "InvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:9ebd0bff-501e-003f-574a-675777000000\nTime:2019-09-09T20:08:41.0042969Zx-ms-lease-idid", + "Date" : "Mon, 09 Sep 2019 20:08:40 GMT", + "x-ms-client-request-id" : "3976c7b4-704b-4b00-baa2-8dc4b688a112", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpageerror&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" : "c1a1b75c-ceec-4792-9853-fb5fb76157cb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd0c0c-501e-003f-644a-675777000000", + "Body" : "jtcuploadpageerrorjtcuploadpageerror0pageblobapitestuploadpageerroref6209070b1Mon, 09 Sep 2019 20:08:40 GMT\"0x8D73561822C8B61\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:40 GMT", + "x-ms-client-request-id" : "c1a1b75c-ceec-4792-9853-fb5fb76157cb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageerror0pageblobapitestuploadpageerroref6209070b1?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" : "0794a3ba-c7db-431e-86f6-03ceaca4cbaa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd0c1a-501e-003f-704a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:40 GMT", + "x-ms-client-request-id" : "0794a3ba-c7db-431e-86f6-03ceaca4cbaa" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageerror0pageblobapitestuploadpageerroref6209070b1", "javablobuploadpageerror1pageblobapitestuploadpageerroref662746", "javablobuploadpageerror2pageblobapitestuploadpageerroref691927", "352d504b-b907-405f-a3b6-ede123c7ec0a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[0].json new file mode 100644 index 000000000000..5249bc05284d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[0].json @@ -0,0 +1,180 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac06336796ba875e7c5e?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" : "3e26cbee-c46d-41fa-90d5-a1e1cb0f5685" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561846EAC22\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0f3b-501e-003f-684a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:44 GMT", + "x-ms-client-request-id" : "3e26cbee-c46d-41fa-90d5-a1e1cb0f5685" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac06336796ba875e7c5e/javablobuploadpagefromurldestinationac127945dfd3e6442", + "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" : "f03e1436-0290-480e-b262-ccc028087cbd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561847BF65D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0f59-501e-003f-7f4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:44 GMT", + "x-ms-client-request-id" : "f03e1436-0290-480e-b262-ccc028087cbd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac06336796ba875e7c5e?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" : "5a94106f-7f29-41ee-865e-534e8d429da4", + "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" : "\"0x8D735618487FE3C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd0f72-501e-003f-174a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:44 GMT", + "x-ms-client-request-id" : "5a94106f-7f29-41ee-865e-534e8d429da4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac06336796ba875e7c5e/javablobuploadpagefromurldestinationac234575953bdbb13", + "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" : "3482e369-2006-4020-a2d5-8e6998e4b2af" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618494B305\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0f7f-501e-003f-244a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:44 GMT", + "x-ms-client-request-id" : "3482e369-2006-4020-a2d5-8e6998e4b2af" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac06336796ba875e7c5e/javablobuploadpagefromurldestinationac234575953bdbb13?comp=page", + "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" : "45798a7c-5614-4f44-b88b-c8897f5ef83c", + "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" : "7iQT7Lk4OP4=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:44 GMT", + "ETag" : "\"0x8D7356184A2712B\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd0f91-501e-003f-364a-675777000000", + "x-ms-client-request-id" : "45798a7c-5614-4f44-b88b-c8897f5ef83c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac06336796ba875e7c5e/javablobuploadpagefromurldestinationac127945dfd3e6442?comp=page", + "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" : "30cb7347-06e0-42de-80c9-3f40ac0461d6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:44 GMT", + "Content-MD5" : "FZa5eF92Fce9g1aU2L9Mdw==", + "ETag" : "\"0x8D7356184B1680B\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd0fac-501e-003f-4b4a-675777000000", + "x-ms-client-request-id" : "30cb7347-06e0-42de-80c9-3f40ac0461d6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationac&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" : "f0f4c132-07fc-445c-a749-a7ac6380ea35" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd0fc8-501e-003f-634a-675777000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac06336796ba875e7c5eMon, 09 Sep 2019 20:08:44 GMT\"0x8D735618487FE3C\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:44 GMT", + "x-ms-client-request-id" : "f0f4c132-07fc-445c-a749-a7ac6380ea35", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac06336796ba875e7c5e?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" : "85d66328-6694-4ca9-87ac-52eb92eb0c1f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd0fdc-501e-003f-774a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:44 GMT", + "x-ms-client-request-id" : "85d66328-6694-4ca9-87ac-52eb92eb0c1f" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac06336796ba875e7c5e", "javablobuploadpagefromurldestinationac127945dfd3e6442", "javablobuploadpagefromurldestinationac234575953bdbb13", "a6aefad9-9659-42f2-aa01-50bd72579c4b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[1].json new file mode 100644 index 000000000000..357fb8ae7144 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[1].json @@ -0,0 +1,180 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0601352b1852b9f7a6?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" : "7ddeeb98-edb2-4431-b359-42bded81d571" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356184D8CBB3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0ff2-501e-003f-0d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:45 GMT", + "x-ms-client-request-id" : "7ddeeb98-edb2-4431-b359-42bded81d571" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0601352b1852b9f7a6/javablobuploadpagefromurldestinationac1351506f73fa246", + "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" : "4e7d9ea6-42ad-40a7-a5af-afbb3fb9fa45" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356184E6164C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1002-501e-003f-1a4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:45 GMT", + "x-ms-client-request-id" : "4e7d9ea6-42ad-40a7-a5af-afbb3fb9fa45" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0601352b1852b9f7a6?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" : "e4094e43-735b-46fa-ab3c-75b858e6be2b", + "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" : "\"0x8D7356184F21E0A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1018-501e-003f-2f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:45 GMT", + "x-ms-client-request-id" : "e4094e43-735b-46fa-ab3c-75b858e6be2b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0601352b1852b9f7a6/javablobuploadpagefromurldestinationac242982a74c3bed8", + "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" : "981aed12-7e22-4c45-9d4d-4e66e9206dbb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356184FED2F8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd102c-501e-003f-424a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:45 GMT", + "x-ms-client-request-id" : "981aed12-7e22-4c45-9d4d-4e66e9206dbb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0601352b1852b9f7a6/javablobuploadpagefromurldestinationac242982a74c3bed8?comp=page", + "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" : "f3b8402f-dd89-4c6d-b289-3c2fc361f35f", + "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" : "Fsc4Orpn3iE=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:45 GMT", + "ETag" : "\"0x8D73561850BF4C2\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd1038-501e-003f-4c4a-675777000000", + "x-ms-client-request-id" : "f3b8402f-dd89-4c6d-b289-3c2fc361f35f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0601352b1852b9f7a6/javablobuploadpagefromurldestinationac1351506f73fa246?comp=page", + "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" : "9333e5c7-f002-4499-a8af-8031eb54f289" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:45 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:45 GMT", + "Content-MD5" : "eyIAHK5cHxgtSQ56Tysz4g==", + "ETag" : "\"0x8D73561851AC496\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd104c-501e-003f-5f4a-675777000000", + "x-ms-client-request-id" : "9333e5c7-f002-4499-a8af-8031eb54f289" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationac&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" : "c907ae6e-a691-4439-90b2-1108fc55c040" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1058-501e-003f-6b4a-675777000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac0601352b1852b9f7a6Mon, 09 Sep 2019 20:08:45 GMT\"0x8D7356184F21E0A\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:45 GMT", + "x-ms-client-request-id" : "c907ae6e-a691-4439-90b2-1108fc55c040", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0601352b1852b9f7a6?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" : "1720a3ef-a0e0-48cb-b569-a6395427b23d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd106c-501e-003f-7d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:45 GMT", + "x-ms-client-request-id" : "1720a3ef-a0e0-48cb-b569-a6395427b23d" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac0601352b1852b9f7a6", "javablobuploadpagefromurldestinationac1351506f73fa246", "javablobuploadpagefromurldestinationac242982a74c3bed8", "b2a05227-cb79-4e62-a0ee-19aef92c70cf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[2].json new file mode 100644 index 000000000000..d6ce6c942c8a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[2].json @@ -0,0 +1,180 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0767814acc8dc6f640?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" : "81686dcc-afcf-4377-abca-a68c3b0a62a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561854079DB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd107d-501e-003f-0b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:45 GMT", + "x-ms-client-request-id" : "81686dcc-afcf-4377-abca-a68c3b0a62a4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0767814acc8dc6f640/javablobuploadpagefromurldestinationac1023680f5e36a99", + "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" : "0aa1bbea-de8a-49ae-8a6b-276359c12088" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561854DC4C8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd109d-501e-003f-244a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:45 GMT", + "x-ms-client-request-id" : "0aa1bbea-de8a-49ae-8a6b-276359c12088" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0767814acc8dc6f640?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" : "ce6f4bae-c690-4635-abc4-b8749a76e520", + "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" : "\"0x8D735618559CC4F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd10af-501e-003f-364a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:45 GMT", + "x-ms-client-request-id" : "ce6f4bae-c690-4635-abc4-b8749a76e520" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0767814acc8dc6f640/javablobuploadpagefromurldestinationac221893651ad4fca", + "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" : "52cab55a-7f1a-42e0-bc24-d1d2da8a094b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356185691A01\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd10c4-501e-003f-4a4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:45 GMT", + "x-ms-client-request-id" : "52cab55a-7f1a-42e0-bc24-d1d2da8a094b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0767814acc8dc6f640/javablobuploadpagefromurldestinationac221893651ad4fca?comp=page", + "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" : "ce715036-f456-4bf6-b9f8-3e25db208b68", + "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" : "3ITHccYISfs=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:46 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:46 GMT", + "ETag" : "\"0x8D73561857614AD\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd10d9-501e-003f-5e4a-675777000000", + "x-ms-client-request-id" : "ce715036-f456-4bf6-b9f8-3e25db208b68" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0767814acc8dc6f640/javablobuploadpagefromurldestinationac1023680f5e36a99?comp=page", + "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" : "403c2603-2711-42b7-98f5-e13a28d8e181" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:46 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:46 GMT", + "Content-MD5" : "q2LWtXTp+B0E+JySMYqtrw==", + "ETag" : "\"0x8D7356185835D8B\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd10ef-501e-003f-734a-675777000000", + "x-ms-client-request-id" : "403c2603-2711-42b7-98f5-e13a28d8e181" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationac&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" : "43ab68ed-29fd-4b79-8719-ad5ffc55aac7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1110-501e-003f-134a-675777000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac0767814acc8dc6f640Mon, 09 Sep 2019 20:08:46 GMT\"0x8D735618559CC4F\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:46 GMT", + "x-ms-client-request-id" : "43ab68ed-29fd-4b79-8719-ad5ffc55aac7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0767814acc8dc6f640?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" : "c0044ff6-51f3-446b-bd86-308e0bcfa5af" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd111e-501e-003f-214a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:46 GMT", + "x-ms-client-request-id" : "c0044ff6-51f3-446b-bd86-308e0bcfa5af" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac0767814acc8dc6f640", "javablobuploadpagefromurldestinationac1023680f5e36a99", "javablobuploadpagefromurldestinationac221893651ad4fca", "5dfd9851-e6c8-414e-833a-abb81bbab6b5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[3].json new file mode 100644 index 000000000000..6d82384ea1b2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[3].json @@ -0,0 +1,212 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac04453926252109cb83?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" : "994fa618-4efc-4aef-af71-c10769a22bab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356185AB0EBC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1134-501e-003f-344a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:46 GMT", + "x-ms-client-request-id" : "994fa618-4efc-4aef-af71-c10769a22bab" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac04453926252109cb83/javablobuploadpagefromurldestinationac19780375f9914a8", + "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" : "638109d8-51fa-454a-b472-f5a36a39d3d6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356185B8A80D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd114c-501e-003f-4b4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:46 GMT", + "x-ms-client-request-id" : "638109d8-51fa-454a-b472-f5a36a39d3d6" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac04453926252109cb83?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" : "a08c501d-d3bf-4779-822a-94c3f843a618", + "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" : "\"0x8D7356185C524D2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd115e-501e-003f-5c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:46 GMT", + "x-ms-client-request-id" : "a08c501d-d3bf-4779-822a-94c3f843a618" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac04453926252109cb83/javablobuploadpagefromurldestinationac255980edfef56a9", + "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" : "8f390954-f5c8-4879-b222-6fe873e2a6bc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356185D22824\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1173-501e-003f-6e4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:46 GMT", + "x-ms-client-request-id" : "8f390954-f5c8-4879-b222-6fe873e2a6bc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac04453926252109cb83/javablobuploadpagefromurldestinationac255980edfef56a9?comp=page", + "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" : "848da35f-2794-41ba-8f30-19a565123157", + "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" : "4qumUhgQoEI=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:46 GMT", + "ETag" : "\"0x8D7356185DEAD8C\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd118c-501e-003f-064a-675777000000", + "x-ms-client-request-id" : "848da35f-2794-41ba-8f30-19a565123157" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac04453926252109cb83/javablobuploadpagefromurldestinationac19780375f9914a8", + "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" : "32d1e0cf-f0ed-40ba-8999-296213de5649" + }, + "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", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:46 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:08:46 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D7356185B8A80D\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:08:46 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd11a7-501e-003f-214a-675777000000", + "x-ms-client-request-id" : "32d1e0cf-f0ed-40ba-8999-296213de5649", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac04453926252109cb83/javablobuploadpagefromurldestinationac19780375f9914a8?comp=page", + "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" : "c9061d66-8659-4631-8834-5005e11bca06" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:46 GMT", + "Content-MD5" : "1sdyOdmz64jkhulGgcs2KQ==", + "ETag" : "\"0x8D7356185FA02B4\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd11b7-501e-003f-314a-675777000000", + "x-ms-client-request-id" : "c9061d66-8659-4631-8834-5005e11bca06" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationac&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" : "5c449b97-bb68-487f-9da1-63f82b4ce30e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd11c8-501e-003f-414a-675777000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac04453926252109cb83Mon, 09 Sep 2019 20:08:46 GMT\"0x8D7356185C524D2\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:46 GMT", + "x-ms-client-request-id" : "5c449b97-bb68-487f-9da1-63f82b4ce30e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac04453926252109cb83?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" : "1475fce7-7ff4-436a-bff0-9dd049134c42" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd11f0-501e-003f-654a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:47 GMT", + "x-ms-client-request-id" : "1475fce7-7ff4-436a-bff0-9dd049134c42" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac04453926252109cb83", "javablobuploadpagefromurldestinationac19780375f9914a8", "javablobuploadpagefromurldestinationac255980edfef56a9", "1d802a2d-73a1-444f-b9b9-ef5c0404c89e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[4].json new file mode 100644 index 000000000000..602ef326623a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[4].json @@ -0,0 +1,180 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0952589e8fa2929b55?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" : "99ccad99-50ef-485d-a608-6cc88280e6c8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356186213E71\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1211-501e-003f-024a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:47 GMT", + "x-ms-client-request-id" : "99ccad99-50ef-485d-a608-6cc88280e6c8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0952589e8fa2929b55/javablobuploadpagefromurldestinationac12134889ce977c9", + "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" : "591d4a09-48c6-4dc5-ab03-0a43cb952b16" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561862E3BA7\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1229-501e-003f-134a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:47 GMT", + "x-ms-client-request-id" : "591d4a09-48c6-4dc5-ab03-0a43cb952b16" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0952589e8fa2929b55?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" : "16c1fe5d-c5b7-4fad-acac-5e9445e04bb8", + "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" : "\"0x8D73561863A6A31\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd123a-501e-003f-244a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:47 GMT", + "x-ms-client-request-id" : "16c1fe5d-c5b7-4fad-acac-5e9445e04bb8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0952589e8fa2929b55/javablobuploadpagefromurldestinationac276044c6ac933ac", + "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" : "5f3bcb8d-0978-4244-8192-7a6bd23d0a5c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561864794B0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:47 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd124e-501e-003f-354a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:47 GMT", + "x-ms-client-request-id" : "5f3bcb8d-0978-4244-8192-7a6bd23d0a5c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0952589e8fa2929b55/javablobuploadpagefromurldestinationac276044c6ac933ac?comp=page", + "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" : "68276ee6-285a-4ed0-9d5a-11c5b7f3b15b", + "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" : "1gkN96yGVtA=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:47 GMT", + "ETag" : "\"0x8D7356186548F60\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd1265-501e-003f-4a4a-675777000000", + "x-ms-client-request-id" : "68276ee6-285a-4ed0-9d5a-11c5b7f3b15b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0952589e8fa2929b55/javablobuploadpagefromurldestinationac12134889ce977c9?comp=page", + "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" : "bde4a9e1-a1d9-4c1b-a121-2f55f64acc96" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:47 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:47 GMT", + "Content-MD5" : "jmdEHhsfbj9N9CjasoZSsw==", + "ETag" : "\"0x8D7356186633812\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd1281-501e-003f-654a-675777000000", + "x-ms-client-request-id" : "bde4a9e1-a1d9-4c1b-a121-2f55f64acc96" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationac&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" : "aa5e6bb1-b2b0-4850-9237-a152538aa0ff" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd129d-501e-003f-804a-675777000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac0952589e8fa2929b55Mon, 09 Sep 2019 20:08:47 GMT\"0x8D73561863A6A31\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:47 GMT", + "x-ms-client-request-id" : "aa5e6bb1-b2b0-4850-9237-a152538aa0ff", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0952589e8fa2929b55?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" : "47b13e59-03b5-408f-982a-2042b5c5e0ae" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd12ac-501e-003f-0d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:47 GMT", + "x-ms-client-request-id" : "47b13e59-03b5-408f-982a-2042b5c5e0ae" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac0952589e8fa2929b55", "javablobuploadpagefromurldestinationac12134889ce977c9", "javablobuploadpagefromurldestinationac276044c6ac933ac", "ae16c786-415f-41b9-ada0-075e95dcf4a9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[5].json new file mode 100644 index 000000000000..fe4922cbffe7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[5].json @@ -0,0 +1,202 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac05754284b1b808b9ea?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" : "cbf98427-a3c4-4d1b-932b-829a0e901acc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561868A9A90\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd12bd-501e-003f-1d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:47 GMT", + "x-ms-client-request-id" : "cbf98427-a3c4-4d1b-932b-829a0e901acc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac05754284b1b808b9ea/javablobuploadpagefromurldestinationac1621625520d6470", + "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" : "32438209-be00-456b-a8fd-f815f2b3bcf1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618697BF39\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd12cf-501e-003f-2e4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:47 GMT", + "x-ms-client-request-id" : "32438209-be00-456b-a8fd-f815f2b3bcf1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac05754284b1b808b9ea?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" : "7d100e70-079c-417a-b8c6-d0be19f5dd1a", + "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" : "\"0x8D7356186A3C6A6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd12e2-501e-003f-414a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:48 GMT", + "x-ms-client-request-id" : "7d100e70-079c-417a-b8c6-d0be19f5dd1a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac05754284b1b808b9ea/javablobuploadpagefromurldestinationac248371311d90662", + "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" : "e64fe5e5-d282-4c41-a5b6-cef1c5ae5bf8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356186B11842\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd12f7-501e-003f-564a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:48 GMT", + "x-ms-client-request-id" : "e64fe5e5-d282-4c41-a5b6-cef1c5ae5bf8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac05754284b1b808b9ea/javablobuploadpagefromurldestinationac248371311d90662?comp=page", + "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" : "331abb13-63a4-41ca-82b1-2e7d8ddc127a", + "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" : "fvbFahx4o68=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:48 GMT", + "ETag" : "\"0x8D7356186BE883A\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd1304-501e-003f-634a-675777000000", + "x-ms-client-request-id" : "331abb13-63a4-41ca-82b1-2e7d8ddc127a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac05754284b1b808b9ea/javablobuploadpagefromurldestinationac1621625520d6470?comp=lease", + "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" : "2fae6484-b24d-4edf-87b1-54646568ab77" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618697BF39\"", + "x-ms-lease-id" : "e0355689-451b-4760-b6c4-24dffdeea953", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1317-501e-003f-744a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:48 GMT", + "x-ms-client-request-id" : "2fae6484-b24d-4edf-87b1-54646568ab77" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac05754284b1b808b9ea/javablobuploadpagefromurldestinationac1621625520d6470?comp=page", + "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" : "a06d1b75-e28a-4146-9654-48224494c248" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:48 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:48 GMT", + "Content-MD5" : "mIRWDNelLabH36ftCeqf0w==", + "ETag" : "\"0x8D7356186DF359C\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd1332-501e-003f-0f4a-675777000000", + "x-ms-client-request-id" : "a06d1b75-e28a-4146-9654-48224494c248" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationac&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" : "cc6f14f8-c4e5-403f-9d61-a5f1a81f3cfe" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd134e-501e-003f-284a-675777000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac05754284b1b808b9eaMon, 09 Sep 2019 20:08:48 GMT\"0x8D7356186A3C6A6\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:48 GMT", + "x-ms-client-request-id" : "cc6f14f8-c4e5-403f-9d61-a5f1a81f3cfe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac05754284b1b808b9ea?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" : "1885b9d7-23df-4dbe-84ec-fe985c6b64e1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd135d-501e-003f-354a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:48 GMT", + "x-ms-client-request-id" : "1885b9d7-23df-4dbe-84ec-fe985c6b64e1" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac05754284b1b808b9ea", "javablobuploadpagefromurldestinationac1621625520d6470", "javablobuploadpagefromurldestinationac248371311d90662", "1fef2d33-3288-4fd9-9796-88c75c3ab72b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[6].json new file mode 100644 index 000000000000..da1bb5b279d0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[6].json @@ -0,0 +1,180 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac00452403c012fd1814?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" : "36918f7a-3472-474e-b265-66b106ab9920" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618706709C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd136f-501e-003f-474a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:48 GMT", + "x-ms-client-request-id" : "36918f7a-3472-474e-b265-66b106ab9920" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac00452403c012fd1814/javablobuploadpagefromurldestinationac104164592689a8a", + "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" : "3907f989-26de-4a7c-a4d6-d46ee2ca1ce0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356187136E95\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1384-501e-003f-5b4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:48 GMT", + "x-ms-client-request-id" : "3907f989-26de-4a7c-a4d6-d46ee2ca1ce0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac00452403c012fd1814?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" : "8891ec05-bcae-49a8-8f6d-4c6f823af366", + "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" : "\"0x8D73561871F75DB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1399-501e-003f-6e4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:48 GMT", + "x-ms-client-request-id" : "8891ec05-bcae-49a8-8f6d-4c6f823af366" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac00452403c012fd1814/javablobuploadpagefromurldestinationac247896c59625311", + "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" : "53183415-30d3-4087-b696-f69d6c5003da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561872C525F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd13ad-501e-003f-7e4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:48 GMT", + "x-ms-client-request-id" : "53183415-30d3-4087-b696-f69d6c5003da" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac00452403c012fd1814/javablobuploadpagefromurldestinationac247896c59625311?comp=page", + "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" : "aac93e08-4f6d-466e-a4ae-2009efd93d07", + "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" : "lXk98jmiN/A=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:49 GMT", + "ETag" : "\"0x8D735618738FEDC\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd13c0-501e-003f-114a-675777000000", + "x-ms-client-request-id" : "aac93e08-4f6d-466e-a4ae-2009efd93d07" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac00452403c012fd1814/javablobuploadpagefromurldestinationac104164592689a8a?comp=page", + "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" : "312f2515-3bc1-4d43-a3c9-60c9bbafd9f6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:49 GMT", + "Content-MD5" : "okBpCPvgXBLoih2itGm+yA==", + "ETag" : "\"0x8D7356187470B36\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd13dd-501e-003f-2c4a-675777000000", + "x-ms-client-request-id" : "312f2515-3bc1-4d43-a3c9-60c9bbafd9f6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationac&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" : "dc8a809f-439c-470b-a13c-03ab4b3fb30d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd13f8-501e-003f-454a-675777000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac00452403c012fd1814Mon, 09 Sep 2019 20:08:49 GMT\"0x8D73561871F75DB\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:49 GMT", + "x-ms-client-request-id" : "dc8a809f-439c-470b-a13c-03ab4b3fb30d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac00452403c012fd1814?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" : "40bbd972-d1dd-4eb3-b658-5eb189004856" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd141b-501e-003f-5f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:49 GMT", + "x-ms-client-request-id" : "40bbd972-d1dd-4eb3-b658-5eb189004856" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac00452403c012fd1814", "javablobuploadpagefromurldestinationac104164592689a8a", "javablobuploadpagefromurldestinationac247896c59625311", "83af7a90-25e2-4a04-bc55-289440eb764c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[7].json new file mode 100644 index 000000000000..c920f935f762 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[7].json @@ -0,0 +1,180 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac009197f8990c630d02?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" : "f0d4f070-d63e-47bf-9f55-284757680e7b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561876DD092\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd143a-501e-003f-7d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:49 GMT", + "x-ms-client-request-id" : "f0d4f070-d63e-47bf-9f55-284757680e7b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac009197f8990c630d02/javablobuploadpagefromurldestinationac1684528e78dcb26", + "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" : "aa8bb6ff-11f6-4908-8cf5-cf61b331cc8f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561877ACEE3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1455-501e-003f-164a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:49 GMT", + "x-ms-client-request-id" : "aa8bb6ff-11f6-4908-8cf5-cf61b331cc8f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac009197f8990c630d02?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" : "c16d1977-b2fb-4c16-9b32-1a4250c88e68", + "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" : "\"0x8D735618786D60D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd146f-501e-003f-2f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:49 GMT", + "x-ms-client-request-id" : "c16d1977-b2fb-4c16-9b32-1a4250c88e68" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac009197f8990c630d02/javablobuploadpagefromurldestinationac292246601db3ee7", + "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" : "78a73caa-a4cc-4b63-89a2-8c248346201e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356187949D33\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1480-501e-003f-3f4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:49 GMT", + "x-ms-client-request-id" : "78a73caa-a4cc-4b63-89a2-8c248346201e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac009197f8990c630d02/javablobuploadpagefromurldestinationac292246601db3ee7?comp=page", + "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" : "c0c690b5-fc86-40ff-b086-0f7d8a5db25c", + "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" : "kWbZoEqUimM=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:49 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:49 GMT", + "ETag" : "\"0x8D7356187A23440\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd1492-501e-003f-514a-675777000000", + "x-ms-client-request-id" : "c0c690b5-fc86-40ff-b086-0f7d8a5db25c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac009197f8990c630d02/javablobuploadpagefromurldestinationac1684528e78dcb26?comp=page", + "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" : "60123707-6171-4ca5-8db7-c27fab8ce5e7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:49 GMT", + "Content-MD5" : "r6Pfw7/rXMJvTRAJHReOoA==", + "ETag" : "\"0x8D7356187B0DCF6\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd14ac-501e-003f-684a-675777000000", + "x-ms-client-request-id" : "60123707-6171-4ca5-8db7-c27fab8ce5e7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationac&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" : "77d1d4f7-4bcd-4259-b4b7-bc62dbbd9dba" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd14c9-501e-003f-804a-675777000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac009197f8990c630d02Mon, 09 Sep 2019 20:08:49 GMT\"0x8D735618786D60D\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:49 GMT", + "x-ms-client-request-id" : "77d1d4f7-4bcd-4259-b4b7-bc62dbbd9dba", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac009197f8990c630d02?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" : "feebd702-4f32-48ff-81d8-0a072aefe1eb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd14e0-501e-003f-144a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:49 GMT", + "x-ms-client-request-id" : "feebd702-4f32-48ff-81d8-0a072aefe1eb" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac009197f8990c630d02", "javablobuploadpagefromurldestinationac1684528e78dcb26", "javablobuploadpagefromurldestinationac292246601db3ee7", "87c856c4-f329-4c49-8d44-a2d6e8add366" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[8].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[8].json new file mode 100644 index 000000000000..22425a42adc0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationac[8].json @@ -0,0 +1,180 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0675908105bc585bee?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" : "cba043b8-0c45-4013-b139-e78463ee2bc1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356187D7A1F9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd14ef-501e-003f-234a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:50 GMT", + "x-ms-client-request-id" : "cba043b8-0c45-4013-b139-e78463ee2bc1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0675908105bc585bee/javablobuploadpagefromurldestinationac191411ec6af2061", + "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" : "a545992e-083c-4de3-8827-fdee06b1622c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356187E4A0A8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1500-501e-003f-334a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:50 GMT", + "x-ms-client-request-id" : "a545992e-083c-4de3-8827-fdee06b1622c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0675908105bc585bee?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" : "6af45cf7-8982-4b55-aa46-2f4c64fbbcd1", + "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" : "\"0x8D7356187F0A796\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd150e-501e-003f-404a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:50 GMT", + "x-ms-client-request-id" : "6af45cf7-8982-4b55-aa46-2f4c64fbbcd1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0675908105bc585bee/javablobuploadpagefromurldestinationac24727980cc469d2", + "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" : "f84596f1-019a-4bb6-b8d5-6f1137e7f033" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356187FD845E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd151a-501e-003f-4b4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:50 GMT", + "x-ms-client-request-id" : "f84596f1-019a-4bb6-b8d5-6f1137e7f033" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0675908105bc585bee/javablobuploadpagefromurldestinationac24727980cc469d2?comp=page", + "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" : "b784768d-7f3a-4b57-ae87-8025edaf31ef", + "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" : "GNHPzESjOGE=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:50 GMT", + "ETag" : "\"0x8D73561880A30DF\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd152f-501e-003f-604a-675777000000", + "x-ms-client-request-id" : "b784768d-7f3a-4b57-ae87-8025edaf31ef" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0675908105bc585bee/javablobuploadpagefromurldestinationac191411ec6af2061?comp=page", + "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" : "4870376a-65d1-4011-be3f-3f0f21eb586f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:50 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:50 GMT", + "Content-MD5" : "Z1Iv3KFQvnAMR+lgGDQGtg==", + "ETag" : "\"0x8D73561881779B8\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd153c-501e-003f-6d4a-675777000000", + "x-ms-client-request-id" : "4870376a-65d1-4011-be3f-3f0f21eb586f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationac&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" : "97a8e0e0-b3b8-4f03-a78d-503eb89ab9c8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1557-501e-003f-084a-675777000000", + "Body" : "jtcuploadpagefromurldestinationacjtcuploadpagefromurldestinationac0675908105bc585beeMon, 09 Sep 2019 20:08:50 GMT\"0x8D7356187F0A796\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:50 GMT", + "x-ms-client-request-id" : "97a8e0e0-b3b8-4f03-a78d-503eb89ab9c8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationac0675908105bc585bee?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" : "835f7019-bed9-49cd-8fe2-bf94962681e3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd158c-501e-003f-354a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:50 GMT", + "x-ms-client-request-id" : "835f7019-bed9-49cd-8fe2-bf94962681e3" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationac0675908105bc585bee", "javablobuploadpagefromurldestinationac191411ec6af2061", "javablobuploadpagefromurldestinationac24727980cc469d2", "3ccdbf9b-0fdb-4083-adef-413e46ed31c5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[0].json new file mode 100644 index 000000000000..24b45bd63bdc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[0].json @@ -0,0 +1,178 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail077078327cda684a?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" : "49aebc46-a781-4d2d-81f1-1ef3b42a772e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561883F01F4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd159c-501e-003f-444a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:50 GMT", + "x-ms-client-request-id" : "49aebc46-a781-4d2d-81f1-1ef3b42a772e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail077078327cda684a/javablobuploadpagefromurldestinationacfail189491c6ee26e", + "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" : "ef27d0fa-6656-4af3-a79e-d9df0a8942a0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561884CC43E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd15b4-501e-003f-594a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:50 GMT", + "x-ms-client-request-id" : "ef27d0fa-6656-4af3-a79e-d9df0a8942a0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail077078327cda684a?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" : "ac013ea4-681e-4a32-90ae-ce79927d6449", + "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" : "\"0x8D735618858CB2D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd15bf-501e-003f-644a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:50 GMT", + "x-ms-client-request-id" : "ac013ea4-681e-4a32-90ae-ce79927d6449" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail077078327cda684a/javablobuploadpagefromurldestinationacfail2729295578289", + "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" : "35033b84-86c1-4940-ba07-0d2d2f72d1e4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618866B994\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd15d0-501e-003f-734a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:50 GMT", + "x-ms-client-request-id" : "35033b84-86c1-4940-ba07-0d2d2f72d1e4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail077078327cda684a/javablobuploadpagefromurldestinationacfail2729295578289?comp=page", + "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" : "c32e4952-f411-484f-8f0c-f88bf409aae8", + "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" : "bsEcnB57z+o=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:51 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:51 GMT", + "ETag" : "\"0x8D7356188738D2A\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd15dd-501e-003f-7e4a-675777000000", + "x-ms-client-request-id" : "c32e4952-f411-484f-8f0c-f88bf409aae8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail077078327cda684a/javablobuploadpagefromurldestinationacfail189491c6ee26e?comp=page", + "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" : "3c279c4c-81f7-4fff-880e-1a5d3450d9bd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "253", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd1600-501e-003f-194a-675777000000", + "Body" : "\nConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd1600-501e-003f-194a-675777000000\nTime:2019-09-09T20:08:51.4448046Z", + "Date" : "Mon, 09 Sep 2019 20:08:51 GMT", + "x-ms-client-request-id" : "3c279c4c-81f7-4fff-880e-1a5d3450d9bd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationacfail&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" : "f8d0b5d8-9534-4e84-9e77-bfd010839b1a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1616-501e-003f-2b4a-675777000000", + "Body" : "jtcuploadpagefromurldestinationacfailjtcuploadpagefromurldestinationacfail077078327cda684aMon, 09 Sep 2019 20:08:51 GMT\"0x8D735618858CB2D\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:51 GMT", + "x-ms-client-request-id" : "f8d0b5d8-9534-4e84-9e77-bfd010839b1a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail077078327cda684a?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" : "3c954b6d-bf42-475c-94af-bb3e01ed1e34" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd1621-501e-003f-354a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:51 GMT", + "x-ms-client-request-id" : "3c954b6d-bf42-475c-94af-bb3e01ed1e34" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationacfail077078327cda684a", "javablobuploadpagefromurldestinationacfail189491c6ee26e", "javablobuploadpagefromurldestinationacfail2729295578289", "093135f4-2546-4b02-b7a3-8ae599ff2399" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[1].json new file mode 100644 index 000000000000..09d4424e8787 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[1].json @@ -0,0 +1,178 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail08119291db5d9288?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" : "0c947bbb-a55b-4f23-9a25-338ea620ac97" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356188A77392\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd163c-501e-003f-4f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:51 GMT", + "x-ms-client-request-id" : "0c947bbb-a55b-4f23-9a25-338ea620ac97" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail08119291db5d9288/javablobuploadpagefromurldestinationacfail176810ff32a4f", + "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" : "02678b37-b188-45df-9c45-7755488ebb27" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356188B5845B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1654-501e-003f-644a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:51 GMT", + "x-ms-client-request-id" : "02678b37-b188-45df-9c45-7755488ebb27" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail08119291db5d9288?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" : "1e7c060e-7303-4ab5-b4e5-0577be7a5e3f", + "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" : "\"0x8D7356188C1D963\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1667-501e-003f-734a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:51 GMT", + "x-ms-client-request-id" : "1e7c060e-7303-4ab5-b4e5-0577be7a5e3f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail08119291db5d9288/javablobuploadpagefromurldestinationacfail2603395fc0bd6", + "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" : "ce728453-22f1-4c52-97dc-db2d0b4abd7a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356188CF046B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1676-501e-003f-024a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:51 GMT", + "x-ms-client-request-id" : "ce728453-22f1-4c52-97dc-db2d0b4abd7a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail08119291db5d9288/javablobuploadpagefromurldestinationacfail2603395fc0bd6?comp=page", + "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" : "b1246115-c322-474d-89e0-73d4095acaf8", + "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" : "8zz8HxBc2AI=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:51 GMT", + "ETag" : "\"0x8D7356188DCC292\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd1687-501e-003f-124a-675777000000", + "x-ms-client-request-id" : "b1246115-c322-474d-89e0-73d4095acaf8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail08119291db5d9288/javablobuploadpagefromurldestinationacfail176810ff32a4f?comp=page", + "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" : "2e95fed3-a888-4e1e-80b7-a232f07f8432" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "253", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd16b0-501e-003f-374a-675777000000", + "Body" : "\nConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd16b0-501e-003f-374a-675777000000\nTime:2019-09-09T20:08:52.1442975Z", + "Date" : "Mon, 09 Sep 2019 20:08:51 GMT", + "x-ms-client-request-id" : "2e95fed3-a888-4e1e-80b7-a232f07f8432", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationacfail&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" : "e506c939-4e93-4529-9b02-051caf22a765" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd16c4-501e-003f-4b4a-675777000000", + "Body" : "jtcuploadpagefromurldestinationacfailjtcuploadpagefromurldestinationacfail08119291db5d9288Mon, 09 Sep 2019 20:08:51 GMT\"0x8D7356188C1D963\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:51 GMT", + "x-ms-client-request-id" : "e506c939-4e93-4529-9b02-051caf22a765", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail08119291db5d9288?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" : "854a8555-8cd0-4549-b5b0-bba6c3e1f077" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd16d5-501e-003f-5c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:52 GMT", + "x-ms-client-request-id" : "854a8555-8cd0-4549-b5b0-bba6c3e1f077" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationacfail08119291db5d9288", "javablobuploadpagefromurldestinationacfail176810ff32a4f", "javablobuploadpagefromurldestinationacfail2603395fc0bd6", "c80dd6a6-adae-462b-a3e9-1c3ffc96b937" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[2].json new file mode 100644 index 000000000000..2c8fdc3fbaed --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[2].json @@ -0,0 +1,178 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail008440a2a8c56483?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" : "d03deec5-e510-4c73-8cf2-333f9004d20a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618910F6C7\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd16e2-501e-003f-684a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:52 GMT", + "x-ms-client-request-id" : "d03deec5-e510-4c73-8cf2-333f9004d20a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail008440a2a8c56483/javablobuploadpagefromurldestinationacfail193729965ac81", + "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" : "fdbcd892-63ab-4b79-8d82-78c3eabc64a8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561891DCF27\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd16f6-501e-003f-7b4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:52 GMT", + "x-ms-client-request-id" : "fdbcd892-63ab-4b79-8d82-78c3eabc64a8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail008440a2a8c56483?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" : "3552f08c-1145-4732-816d-cb12df0bd2a8", + "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" : "\"0x8D735618929AEF8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1704-501e-003f-084a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:52 GMT", + "x-ms-client-request-id" : "3552f08c-1145-4732-816d-cb12df0bd2a8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail008440a2a8c56483/javablobuploadpagefromurldestinationacfail22796892aad9f", + "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" : "8fd82e85-da3a-470d-b98a-b71c037c3295" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561893664B9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1713-501e-003f-174a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:52 GMT", + "x-ms-client-request-id" : "8fd82e85-da3a-470d-b98a-b71c037c3295" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail008440a2a8c56483/javablobuploadpagefromurldestinationacfail22796892aad9f?comp=page", + "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" : "8fb0dbf2-4287-4a2b-b64c-ad8ce689dc8f", + "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" : "Lsu7qSxm1fk=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:52 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:52 GMT", + "ETag" : "\"0x8D735618942C311\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd1724-501e-003f-274a-675777000000", + "x-ms-client-request-id" : "8fb0dbf2-4287-4a2b-b64c-ad8ce689dc8f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail008440a2a8c56483/javablobuploadpagefromurldestinationacfail193729965ac81?comp=page", + "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" : "bc970ce1-479e-4972-996f-a1a8b17de62a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "TargetConditionNotMet", + "retry-after" : "0", + "Content-Length" : "266", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd172f-501e-003f-314a-675777000000", + "Body" : "\nTargetConditionNotMetThe target condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd172f-501e-003f-314a-675777000000\nTime:2019-09-09T20:08:52.8007603Z", + "Date" : "Mon, 09 Sep 2019 20:08:52 GMT", + "x-ms-client-request-id" : "bc970ce1-479e-4972-996f-a1a8b17de62a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationacfail&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" : "b868c0e7-32eb-4905-a572-24eb42ab881c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1744-501e-003f-424a-675777000000", + "Body" : "jtcuploadpagefromurldestinationacfailjtcuploadpagefromurldestinationacfail008440a2a8c56483Mon, 09 Sep 2019 20:08:52 GMT\"0x8D735618929AEF8\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:52 GMT", + "x-ms-client-request-id" : "b868c0e7-32eb-4905-a572-24eb42ab881c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail008440a2a8c56483?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" : "5523a8c0-eb0f-427f-a31d-d6102cabb502" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd1757-501e-003f-524a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:52 GMT", + "x-ms-client-request-id" : "5523a8c0-eb0f-427f-a31d-d6102cabb502" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationacfail008440a2a8c56483", "javablobuploadpagefromurldestinationacfail193729965ac81", "javablobuploadpagefromurldestinationacfail22796892aad9f", "fb59b0ed-d4dc-408d-bcab-85539d15df90" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[3].json new file mode 100644 index 000000000000..e2db78810b97 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[3].json @@ -0,0 +1,210 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail061864399504b23f?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" : "dab75440-b3c1-41f7-9b5b-67802e29854b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618975E550\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd176a-501e-003f-634a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:52 GMT", + "x-ms-client-request-id" : "dab75440-b3c1-41f7-9b5b-67802e29854b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail061864399504b23f/javablobuploadpagefromurldestinationacfail18494440cc1e8", + "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" : "a036ee79-8042-4ad7-8ceb-72c20d166ca4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618983F6BB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1781-501e-003f-754a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:52 GMT", + "x-ms-client-request-id" : "a036ee79-8042-4ad7-8ceb-72c20d166ca4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail061864399504b23f?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" : "75e8f71d-19a5-4b6a-823b-8ce78e5ef1e5", + "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" : "\"0x8D735618990C0EB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1798-501e-003f-0c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:52 GMT", + "x-ms-client-request-id" : "75e8f71d-19a5-4b6a-823b-8ce78e5ef1e5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail061864399504b23f/javablobuploadpagefromurldestinationacfail201238b82a405", + "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" : "9fa6fe73-5a0d-4c4c-8612-562a2253dd6d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561899DC50C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd17a8-501e-003f-1c4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:53 GMT", + "x-ms-client-request-id" : "9fa6fe73-5a0d-4c4c-8612-562a2253dd6d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail061864399504b23f/javablobuploadpagefromurldestinationacfail201238b82a405?comp=page", + "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" : "a7bdf068-ce67-4ce1-b653-e724e8adb54f", + "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" : "NlRu2ZQ/AY4=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:53 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:53 GMT", + "ETag" : "\"0x8D7356189AA718E\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd17b9-501e-003f-2c4a-675777000000", + "x-ms-client-request-id" : "a7bdf068-ce67-4ce1-b653-e724e8adb54f" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail061864399504b23f/javablobuploadpagefromurldestinationacfail18494440cc1e8", + "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" : "02083536-7a89-432e-9afe-933d319f3c04" + }, + "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", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:53 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:08:53 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735618983F6BB\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:08:53 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd17d1-501e-003f-424a-675777000000", + "x-ms-client-request-id" : "02083536-7a89-432e-9afe-933d319f3c04", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail061864399504b23f/javablobuploadpagefromurldestinationacfail18494440cc1e8?comp=page", + "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" : "3d51528d-4d9e-446a-a040-132e48958a37" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ConditionNotMet", + "retry-after" : "0", + "Content-Length" : "253", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd17e4-501e-003f-554a-675777000000", + "Body" : "\nConditionNotMetThe condition specified using HTTP conditional header(s) is not met.\nRequestId:9ebd17e4-501e-003f-554a-675777000000\nTime:2019-09-09T20:08:53.5693022Z", + "Date" : "Mon, 09 Sep 2019 20:08:53 GMT", + "x-ms-client-request-id" : "3d51528d-4d9e-446a-a040-132e48958a37", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationacfail&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" : "5e39ab32-7cde-4d8e-a89e-d6c1e5823a5f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1807-501e-003f-784a-675777000000", + "Body" : "jtcuploadpagefromurldestinationacfailjtcuploadpagefromurldestinationacfail061864399504b23fMon, 09 Sep 2019 20:08:53 GMT\"0x8D735618990C0EB\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:53 GMT", + "x-ms-client-request-id" : "5e39ab32-7cde-4d8e-a89e-d6c1e5823a5f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail061864399504b23f?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" : "34741c08-e586-4fd9-ab28-807bf4c29dcc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd1820-501e-003f-114a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:53 GMT", + "x-ms-client-request-id" : "34741c08-e586-4fd9-ab28-807bf4c29dcc" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationacfail061864399504b23f", "javablobuploadpagefromurldestinationacfail18494440cc1e8", "javablobuploadpagefromurldestinationacfail201238b82a405", "b4c34afa-4161-4f2c-a27b-758616bd0551" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[4].json new file mode 100644 index 000000000000..6b8b9b37cefd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[4].json @@ -0,0 +1,178 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail059206a2633f95ed?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" : "65746e82-f977-4dba-8876-099570eb6586" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356189ECD876\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd183f-501e-003f-2e4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:53 GMT", + "x-ms-client-request-id" : "65746e82-f977-4dba-8876-099570eb6586" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail059206a2633f95ed/javablobuploadpagefromurldestinationacfail176466c2d209a", + "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" : "f3c70683-6147-4040-8078-9446075810f4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356189FAEA4A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd185d-501e-003f-484a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:53 GMT", + "x-ms-client-request-id" : "f3c70683-6147-4040-8078-9446075810f4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail059206a2633f95ed?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" : "4c17c800-8b2c-479c-8874-34855e0c9181", + "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" : "\"0x8D735618A078D35\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1871-501e-003f-5a4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:53 GMT", + "x-ms-client-request-id" : "4c17c800-8b2c-479c-8874-34855e0c9181" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail059206a2633f95ed/javablobuploadpagefromurldestinationacfail259256402eded", + "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" : "f2bb7d0f-3111-4a31-99b3-7373e0033339" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618A1554FC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1899-501e-003f-014a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:53 GMT", + "x-ms-client-request-id" : "f2bb7d0f-3111-4a31-99b3-7373e0033339" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail059206a2633f95ed/javablobuploadpagefromurldestinationacfail259256402eded?comp=page", + "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" : "c2453f06-c49a-4a77-8475-d013156414a8", + "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" : "3y9FMUCNFTk=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:53 GMT", + "ETag" : "\"0x8D735618A224FAC\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd18b0-501e-003f-164a-675777000000", + "x-ms-client-request-id" : "c2453f06-c49a-4a77-8475-d013156414a8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail059206a2633f95ed/javablobuploadpagefromurldestinationacfail176466c2d209a?comp=page", + "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" : "a9925be6-0aa4-44c6-b894-a02702807305" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "LeaseNotPresentWithBlobOperation", + "retry-after" : "0", + "Content-Length" : "242", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd18c6-501e-003f-2a4a-675777000000", + "Body" : "\nLeaseNotPresentWithBlobOperationThere is currently no lease on the blob.\nRequestId:9ebd18c6-501e-003f-2a4a-675777000000\nTime:2019-09-09T20:08:54.2788021Z", + "Date" : "Mon, 09 Sep 2019 20:08:53 GMT", + "x-ms-client-request-id" : "a9925be6-0aa4-44c6-b894-a02702807305", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationacfail&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" : "69f0aa74-d7b2-4717-873b-8b57349ee5eb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd18dc-501e-003f-3f4a-675777000000", + "Body" : "jtcuploadpagefromurldestinationacfailjtcuploadpagefromurldestinationacfail059206a2633f95edMon, 09 Sep 2019 20:08:54 GMT\"0x8D735618A078D35\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:54 GMT", + "x-ms-client-request-id" : "69f0aa74-d7b2-4717-873b-8b57349ee5eb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail059206a2633f95ed?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" : "e80fd75d-4cfd-4e9c-8be4-d84b35aa5129" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd18ed-501e-003f-504a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:54 GMT", + "x-ms-client-request-id" : "e80fd75d-4cfd-4e9c-8be4-d84b35aa5129" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationacfail059206a2633f95ed", "javablobuploadpagefromurldestinationacfail176466c2d209a", "javablobuploadpagefromurldestinationacfail259256402eded", "47620f43-d549-4dd3-8af9-809f22c43564" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[5].json new file mode 100644 index 000000000000..df773ce8215e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[5].json @@ -0,0 +1,178 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail039095ae3ca4b3f6?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" : "038bece3-8241-4857-abdc-030ae9ddda10" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618A5A05E1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd190e-501e-003f-6f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:54 GMT", + "x-ms-client-request-id" : "038bece3-8241-4857-abdc-030ae9ddda10" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail039095ae3ca4b3f6/javablobuploadpagefromurldestinationacfail12610518662d7", + "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" : "8d324f0c-9e08-4196-83b3-d097405a8649" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618A677B9E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1929-501e-003f-094a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:54 GMT", + "x-ms-client-request-id" : "8d324f0c-9e08-4196-83b3-d097405a8649" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail039095ae3ca4b3f6?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" : "76b854cc-343b-4ca8-a6b8-bacb408d0340", + "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" : "\"0x8D735618A73F74E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1956-501e-003f-364a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:54 GMT", + "x-ms-client-request-id" : "76b854cc-343b-4ca8-a6b8-bacb408d0340" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail039095ae3ca4b3f6/javablobuploadpagefromurldestinationacfail222473983fc24", + "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" : "b97962ff-462a-4046-8f11-a3127d979a43" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618A81BF27\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd196b-501e-003f-494a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:54 GMT", + "x-ms-client-request-id" : "b97962ff-462a-4046-8f11-a3127d979a43" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail039095ae3ca4b3f6/javablobuploadpagefromurldestinationacfail222473983fc24?comp=page", + "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" : "abd61efc-6f21-4007-b87d-fc4e72c00e96", + "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" : "jTWeSLiO79Q=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:54 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:54 GMT", + "ETag" : "\"0x8D735618A8EE0EB\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd1982-501e-003f-5d4a-675777000000", + "x-ms-client-request-id" : "abd61efc-6f21-4007-b87d-fc4e72c00e96" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail039095ae3ca4b3f6/javablobuploadpagefromurldestinationacfail12610518662d7?comp=page", + "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" : "0d72a5de-1b0d-4d19-b37f-789d3ca76357" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "335", + "StatusCode" : "400", + "x-ms-request-id" : "9ebd1996-501e-003f-714a-675777000000", + "Body" : "\nInvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:9ebd1996-501e-003f-714a-675777000000\nTime:2019-09-09T20:08:54.9843002Zx-ms-if-sequence-number-lt-1", + "Date" : "Mon, 09 Sep 2019 20:08:54 GMT", + "x-ms-client-request-id" : "0d72a5de-1b0d-4d19-b37f-789d3ca76357", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationacfail&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" : "67de64da-6f7d-4dbb-a6c8-d206c86229b1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd19b3-501e-003f-0d4a-675777000000", + "Body" : "jtcuploadpagefromurldestinationacfailjtcuploadpagefromurldestinationacfail039095ae3ca4b3f6Mon, 09 Sep 2019 20:08:54 GMT\"0x8D735618A73F74E\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:54 GMT", + "x-ms-client-request-id" : "67de64da-6f7d-4dbb-a6c8-d206c86229b1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail039095ae3ca4b3f6?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" : "778992a3-8992-413e-a3cb-9593bb97ec9e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd19cc-501e-003f-244a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:54 GMT", + "x-ms-client-request-id" : "778992a3-8992-413e-a3cb-9593bb97ec9e" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationacfail039095ae3ca4b3f6", "javablobuploadpagefromurldestinationacfail12610518662d7", "javablobuploadpagefromurldestinationacfail222473983fc24", "ac1746f7-2aaa-4550-b53a-64b4cb23ad8f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[6].json new file mode 100644 index 000000000000..1005021ba722 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[6].json @@ -0,0 +1,178 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0459873f192dc436?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" : "694475cc-1b8f-4e65-b74d-62127cb17b1c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618AC4E8FE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd19df-501e-003f-374a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:54 GMT", + "x-ms-client-request-id" : "694475cc-1b8f-4e65-b74d-62127cb17b1c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0459873f192dc436/javablobuploadpagefromurldestinationacfail158474721a38a", + "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" : "6b799500-5bf7-4865-84ab-2f0bcfa47998" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618AD237BC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd19f2-501e-003f-484a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:55 GMT", + "x-ms-client-request-id" : "6b799500-5bf7-4865-84ab-2f0bcfa47998" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0459873f192dc436?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" : "41f9c5f1-015c-4a03-8ad9-742b7ad90dd1", + "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" : "\"0x8D735618ADE8C56\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1a06-501e-003f-5b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:55 GMT", + "x-ms-client-request-id" : "41f9c5f1-015c-4a03-8ad9-742b7ad90dd1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0459873f192dc436/javablobuploadpagefromurldestinationacfail2429119b6b9b5", + "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" : "bd0c580c-4343-45ba-84bb-a63550007850" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618AEB1B7A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1a26-501e-003f-794a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:55 GMT", + "x-ms-client-request-id" : "bd0c580c-4343-45ba-84bb-a63550007850" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0459873f192dc436/javablobuploadpagefromurldestinationacfail2429119b6b9b5?comp=page", + "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" : "b4005442-4498-427a-bd77-cde896763e18", + "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" : "vkDX6nNDrVI=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:55 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:55 GMT", + "ETag" : "\"0x8D735618AF8D9A5\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd1a3e-501e-003f-114a-675777000000", + "x-ms-client-request-id" : "b4005442-4498-427a-bd77-cde896763e18" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0459873f192dc436/javablobuploadpagefromurldestinationacfail158474721a38a?comp=page", + "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" : "d5e1b823-329a-4af7-ba04-26aefdc9f398" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidHeaderValue", + "retry-after" : "0", + "Content-Length" : "335", + "StatusCode" : "400", + "x-ms-request-id" : "9ebd1a53-501e-003f-244a-675777000000", + "Body" : "\nInvalidHeaderValueThe value for one of the HTTP headers is not in the correct format.\nRequestId:9ebd1a53-501e-003f-244a-675777000000\nTime:2019-09-09T20:08:55.6777889Zx-ms-if-sequence-number-le-1", + "Date" : "Mon, 09 Sep 2019 20:08:55 GMT", + "x-ms-client-request-id" : "d5e1b823-329a-4af7-ba04-26aefdc9f398", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationacfail&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" : "7ebb7839-1696-4214-9a1c-4372707ff6ed" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1a67-501e-003f-374a-675777000000", + "Body" : "jtcuploadpagefromurldestinationacfailjtcuploadpagefromurldestinationacfail0459873f192dc436Mon, 09 Sep 2019 20:08:55 GMT\"0x8D735618ADE8C56\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:55 GMT", + "x-ms-client-request-id" : "7ebb7839-1696-4214-9a1c-4372707ff6ed", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0459873f192dc436?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" : "f60e4e2c-3423-46a0-bbd0-071fd59ae095" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd1a7c-501e-003f-494a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:55 GMT", + "x-ms-client-request-id" : "f60e4e2c-3423-46a0-bbd0-071fd59ae095" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationacfail0459873f192dc436", "javablobuploadpagefromurldestinationacfail158474721a38a", "javablobuploadpagefromurldestinationacfail2429119b6b9b5", "408ad69e-db49-4907-879c-955e385f1cf9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[7].json new file mode 100644 index 000000000000..ae3227fef04b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurldestinationacfail[7].json @@ -0,0 +1,178 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0850941046660e8e?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" : "2cb1d15f-c9ea-4531-99f9-ba9cc1d71ddc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618B2F56AF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1a98-501e-003f-5f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:55 GMT", + "x-ms-client-request-id" : "2cb1d15f-c9ea-4531-99f9-ba9cc1d71ddc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0850941046660e8e/javablobuploadpagefromurldestinationacfail1695966821ae9", + "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" : "0636b0d6-9f1f-4410-bb4a-e6b4d6ab6d05" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618B3E2CCC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1aad-501e-003f-734a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:55 GMT", + "x-ms-client-request-id" : "0636b0d6-9f1f-4410-bb4a-e6b4d6ab6d05" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0850941046660e8e?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" : "b8ba1d56-3adc-4c74-826d-ebf863ac742d", + "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" : "\"0x8D735618B4ACF5B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1acc-501e-003f-114a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:55 GMT", + "x-ms-client-request-id" : "b8ba1d56-3adc-4c74-826d-ebf863ac742d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0850941046660e8e/javablobuploadpagefromurldestinationacfail294464e0f54df", + "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" : "e7462c4a-a3a8-42f4-9908-3d4b9bad2b83" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618B57FB0F\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1ae3-501e-003f-284a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:55 GMT", + "x-ms-client-request-id" : "e7462c4a-a3a8-42f4-9908-3d4b9bad2b83" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0850941046660e8e/javablobuploadpagefromurldestinationacfail294464e0f54df?comp=page", + "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" : "37e139dc-003d-4ae1-8c89-4341bd42a392", + "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" : "H73fMbXa48g=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:56 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:55 GMT", + "ETag" : "\"0x8D735618B64F5CD\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd1af7-501e-003f-3c4a-675777000000", + "x-ms-client-request-id" : "37e139dc-003d-4ae1-8c89-4341bd42a392" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0850941046660e8e/javablobuploadpagefromurldestinationacfail1695966821ae9?comp=page", + "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" : "731e216a-86d9-4894-9ad9-f00049fae0f3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "SequenceNumberConditionNotMet", + "retry-after" : "0", + "Content-Length" : "251", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd1b14-501e-003f-564a-675777000000", + "Body" : "\nSequenceNumberConditionNotMetThe sequence number condition specified was not met.\nRequestId:9ebd1b14-501e-003f-564a-675777000000\nTime:2019-09-09T20:08:56.4002983Z", + "Date" : "Mon, 09 Sep 2019 20:08:56 GMT", + "x-ms-client-request-id" : "731e216a-86d9-4894-9ad9-f00049fae0f3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurldestinationacfail&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" : "8f03b29a-f7d9-4f6a-8480-d9c4ecbfa561" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1b2a-501e-003f-6b4a-675777000000", + "Body" : "jtcuploadpagefromurldestinationacfailjtcuploadpagefromurldestinationacfail0850941046660e8eMon, 09 Sep 2019 20:08:56 GMT\"0x8D735618B4ACF5B\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:56 GMT", + "x-ms-client-request-id" : "8f03b29a-f7d9-4f6a-8480-d9c4ecbfa561", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurldestinationacfail0850941046660e8e?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" : "37df17be-23af-4fe5-8548-7bbd60c42bb1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd1b3b-501e-003f-7c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:56 GMT", + "x-ms-client-request-id" : "37df17be-23af-4fe5-8548-7bbd60c42bb1" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurldestinationacfail0850941046660e8e", "javablobuploadpagefromurldestinationacfail1695966821ae9", "javablobuploadpagefromurldestinationacfail294464e0f54df", "8276faf2-34b1-4e84-9ef6-cf6874ba9bb3" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlia.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlia.json new file mode 100644 index 000000000000..97ee80d97b5d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlia.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlia0011047f6a6258979b4b249?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" : "2ed06d52-4f42-42b6-a16f-55487e2f4ffb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618366A89E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0db5-501e-003f-734a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:42 GMT", + "x-ms-client-request-id" : "2ed06d52-4f42-42b6-a16f-55487e2f4ffb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlia0011047f6a6258979b4b249/javablobuploadpagefromurlia147435f83160a8ad124e7", + "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" : "3355badc-3d51-4d7a-8356-8e3d630f0075" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618373F303\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0dcd-501e-003f-0a4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:42 GMT", + "x-ms-client-request-id" : "3355badc-3d51-4d7a-8356-8e3d630f0075" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurlia&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" : "1fafb7e7-ef49-4117-aafe-3f86f4111ec0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd0de3-501e-003f-1f4a-675777000000", + "Body" : "jtcuploadpagefromurliajtcuploadpagefromurlia0011047f6a6258979b4b249Mon, 09 Sep 2019 20:08:42 GMT\"0x8D735618366A89E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:42 GMT", + "x-ms-client-request-id" : "1fafb7e7-ef49-4117-aafe-3f86f4111ec0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlia0011047f6a6258979b4b249?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" : "b8453529-39ab-4dc4-85c9-eaba7e23d4c1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd0dee-501e-003f-2a4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:42 GMT", + "x-ms-client-request-id" : "b8453529-39ab-4dc4-85c9-eaba7e23d4c1" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlia0011047f6a6258979b4b249", "javablobuploadpagefromurlia147435f83160a8ad124e7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlmd5.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlmd5.json new file mode 100644 index 000000000000..452629431223 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlmd5.json @@ -0,0 +1,180 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlmd508741991a4c55ab9d24f4a9?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" : "9520ff15-a341-43d0-adc1-0a956af5a890" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561839A45DA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0e01-501e-003f-3d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:42 GMT", + "x-ms-client-request-id" : "9520ff15-a341-43d0-adc1-0a956af5a890" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlmd508741991a4c55ab9d24f4a9/javablobuploadpagefromurlmd5100139db8c2d08f4b14d", + "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" : "b4125d9e-920a-4292-8035-b4d9bce3b55d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356183A7DDCE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0e10-501e-003f-4b4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:43 GMT", + "x-ms-client-request-id" : "b4125d9e-920a-4292-8035-b4d9bce3b55d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlmd508741991a4c55ab9d24f4a9?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" : "668624ae-ec04-40ba-ac35-a6fe514cd92f", + "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" : "\"0x8D7356183B40CDA\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd0e1b-501e-003f-564a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:43 GMT", + "x-ms-client-request-id" : "668624ae-ec04-40ba-ac35-a6fe514cd92f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlmd508741991a4c55ab9d24f4a9/javablobuploadpagefromurlmd5285124436733f56d924e", + "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" : "148662a9-44fc-4942-81f0-527559f230ee" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356183C1D32B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0e2a-501e-003f-654a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:43 GMT", + "x-ms-client-request-id" : "148662a9-44fc-4942-81f0-527559f230ee" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlmd508741991a4c55ab9d24f4a9/javablobuploadpagefromurlmd5100139db8c2d08f4b14d?comp=page", + "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" : "9b1d3d34-5a45-451b-ac1c-47c0d1e9649f", + "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" : "BVOUmxgId7k=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:43 GMT", + "ETag" : "\"0x8D7356183CF9150\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd0e3c-501e-003f-764a-675777000000", + "x-ms-client-request-id" : "9b1d3d34-5a45-451b-ac1c-47c0d1e9649f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlmd508741991a4c55ab9d24f4a9/javablobuploadpagefromurlmd5285124436733f56d924e?comp=page", + "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" : "16896546-b5cb-4afb-bcf7-e926d90a08db" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:43 GMT", + "Content-MD5" : "F+/cKLAg3aYkm+jhyJM3Xg==", + "ETag" : "\"0x8D7356183DDEBC9\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd0e4f-501e-003f-094a-675777000000", + "x-ms-client-request-id" : "16896546-b5cb-4afb-bcf7-e926d90a08db" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurlmd5&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" : "d7e9eb41-d50b-43e6-b194-53b8e89e6d78" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd0e60-501e-003f-184a-675777000000", + "Body" : "jtcuploadpagefromurlmd5jtcuploadpagefromurlmd508741991a4c55ab9d24f4a9Mon, 09 Sep 2019 20:08:43 GMT\"0x8D7356183B40CDA\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:43 GMT", + "x-ms-client-request-id" : "d7e9eb41-d50b-43e6-b194-53b8e89e6d78", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlmd508741991a4c55ab9d24f4a9?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" : "7f8554cf-b7cd-46d7-a3c0-ce39b136242a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd0e79-501e-003f-2d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:43 GMT", + "x-ms-client-request-id" : "7f8554cf-b7cd-46d7-a3c0-ce39b136242a" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlmd508741991a4c55ab9d24f4a9", "javablobuploadpagefromurlmd5100139db8c2d08f4b14d", "javablobuploadpagefromurlmd5285124436733f56d924e", "842d899d-6a44-441f-b4e8-93d2030e6725" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlmd5fail.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlmd5fail.json new file mode 100644 index 000000000000..82d055bf67c0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlmd5fail.json @@ -0,0 +1,178 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlmd5fail0070888852f664d21c480?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" : "7bb91f6d-7e78-4c76-a9ea-f5097d5588e9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356184048C84\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0e90-501e-003f-444a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:43 GMT", + "x-ms-client-request-id" : "7bb91f6d-7e78-4c76-a9ea-f5097d5588e9" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlmd5fail0070888852f664d21c480/javablobuploadpagefromurlmd5fail15672083702854a61e", + "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" : "cc005d7c-5e11-41e6-bef1-1a58f23b94a5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618411884E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0ea7-501e-003f-5a4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:43 GMT", + "x-ms-client-request-id" : "cc005d7c-5e11-41e6-bef1-1a58f23b94a5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlmd5fail0070888852f664d21c480?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" : "42473ff7-d656-4bf3-8b87-e527d3361c3b", + "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" : "\"0x8D73561841E0590\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd0eb7-501e-003f-6a4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:43 GMT", + "x-ms-client-request-id" : "42473ff7-d656-4bf3-8b87-e527d3361c3b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlmd5fail0070888852f664d21c480/javablobuploadpagefromurlmd5fail2802436e97d52e5628", + "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" : "44dd7925-23c0-4ed3-9b02-8fa3edd0b345" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561842BCBDB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0ec6-501e-003f-764a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:43 GMT", + "x-ms-client-request-id" : "44dd7925-23c0-4ed3-9b02-8fa3edd0b345" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlmd5fail0070888852f664d21c480/javablobuploadpagefromurlmd5fail15672083702854a61e?comp=page", + "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" : "55c64411-4fe7-48b2-afeb-458697fdab64", + "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" : "5d/Z9ol4HHs=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:44 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:43 GMT", + "ETag" : "\"0x8D735618439FF3F\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd0ee1-501e-003f-114a-675777000000", + "x-ms-client-request-id" : "55c64411-4fe7-48b2-afeb-458697fdab64" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlmd5fail0070888852f664d21c480/javablobuploadpagefromurlmd5fail2802436e97d52e5628?comp=page", + "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" : "fdd271fe-96f5-4b67-9027-9effb46cad0f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "Md5Mismatch", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "9ebd0eeb-501e-003f-1b4a-675777000000", + "Body" : "\nMd5MismatchThe MD5 value specified in the request did not match with the MD5 value calculated by the server.\nRequestId:9ebd0eeb-501e-003f-1b4a-675777000000\nTime:2019-09-09T20:08:44.3608109Z", + "Date" : "Mon, 09 Sep 2019 20:08:44 GMT", + "x-ms-client-request-id" : "fdd271fe-96f5-4b67-9027-9effb46cad0f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurlmd5fail&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" : "3d2a644b-753b-4396-955c-6e5c4fc98a90" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd0f03-501e-003f-314a-675777000000", + "Body" : "jtcuploadpagefromurlmd5failjtcuploadpagefromurlmd5fail0070888852f664d21c480Mon, 09 Sep 2019 20:08:44 GMT\"0x8D73561841E0590\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:44 GMT", + "x-ms-client-request-id" : "3d2a644b-753b-4396-955c-6e5c4fc98a90", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlmd5fail0070888852f664d21c480?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" : "2fbab503-8120-458c-8944-b1bad2319672" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd0f17-501e-003f-454a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:44 GMT", + "x-ms-client-request-id" : "2fbab503-8120-458c-8944-b1bad2319672" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlmd5fail0070888852f664d21c480", "javablobuploadpagefromurlmd5fail15672083702854a61e", "javablobuploadpagefromurlmd5fail2802436e97d52e5628", "c4a4b90c-02f8-493f-829c-9553337b6a72" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlmin.json new file mode 100644 index 000000000000..2182c3f773b0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlmin.json @@ -0,0 +1,180 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlmin06513312552b5f5cd742e08?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" : "3d09af83-bf88-4720-b00e-4d31ea7c8725" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561826DE5F6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0c31-501e-003f-054a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:40 GMT", + "x-ms-client-request-id" : "3d09af83-bf88-4720-b00e-4d31ea7c8725" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlmin06513312552b5f5cd742e08/javablobuploadpagefromurlmin1695817dff6e60b79249", + "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" : "18feaafe-8f5c-4f84-9591-37d0199e8f55" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561827B0D64\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0c46-501e-003f-164a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:41 GMT", + "x-ms-client-request-id" : "18feaafe-8f5c-4f84-9591-37d0199e8f55" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlmin06513312552b5f5cd742e08?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" : "442eab93-1467-415b-a9ba-326656a91af2", + "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" : "\"0x8D73561828763D9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd0c5b-501e-003f-284a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:41 GMT", + "x-ms-client-request-id" : "442eab93-1467-415b-a9ba-326656a91af2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlmin06513312552b5f5cd742e08/javablobuploadpagefromurlmin2989568f66e3a9961a4f", + "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" : "93831935-9c32-4205-9974-318b7aab93cf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356182948D82\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0c6d-501e-003f-3a4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:41 GMT", + "x-ms-client-request-id" : "93831935-9c32-4205-9974-318b7aab93cf" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlmin06513312552b5f5cd742e08/javablobuploadpagefromurlmin2989568f66e3a9961a4f?comp=page", + "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" : "ebc67cc6-09d3-44f1-b1ed-a77fe0db55ea", + "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" : "DKoSidDimus=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:41 GMT", + "ETag" : "\"0x8D7356182A24BAD\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd0c7f-501e-003f-4b4a-675777000000", + "x-ms-client-request-id" : "ebc67cc6-09d3-44f1-b1ed-a77fe0db55ea" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlmin06513312552b5f5cd742e08/javablobuploadpagefromurlmin1695817dff6e60b79249?comp=page", + "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" : "d30c088a-322c-44fa-8c84-8a3dbda0a945" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:41 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:41 GMT", + "Content-MD5" : "ovsEMDiUrxqknVr2E8Vz/w==", + "ETag" : "\"0x8D7356182B73713\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd0c96-501e-003f-614a-675777000000", + "x-ms-client-request-id" : "d30c088a-322c-44fa-8c84-8a3dbda0a945" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurlmin&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" : "cb75662f-467a-4cc2-b7ba-07d607a7367a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd0cbb-501e-003f-024a-675777000000", + "Body" : "jtcuploadpagefromurlminjtcuploadpagefromurlmin06513312552b5f5cd742e08Mon, 09 Sep 2019 20:08:41 GMT\"0x8D73561828763D9\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:41 GMT", + "x-ms-client-request-id" : "cb75662f-467a-4cc2-b7ba-07d607a7367a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlmin06513312552b5f5cd742e08?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" : "8341dceb-4391-4bbe-abc9-a930148b0b59" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd0cc4-501e-003f-0b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:41 GMT", + "x-ms-client-request-id" : "8341dceb-4391-4bbe-abc9-a930148b0b59" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlmin06513312552b5f5cd742e08", "javablobuploadpagefromurlmin1695817dff6e60b79249", "javablobuploadpagefromurlmin2989568f66e3a9961a4f", "14459faa-2143-4561-b253-dfc7448b4a54" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlrange.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlrange.json new file mode 100644 index 000000000000..85c8dd8e6e3d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlrange.json @@ -0,0 +1,233 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlrange0613548e30d42541f844a4?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" : "481a1cb2-bedd-4c33-b322-b27e613d6def" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356182DFA807\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0cd9-501e-003f-204a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:41 GMT", + "x-ms-client-request-id" : "481a1cb2-bedd-4c33-b322-b27e613d6def" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlrange0613548e30d42541f844a4/javablobuploadpagefromurlrange153428f7acc68023fe4", + "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" : "92cdaa78-9f0e-45eb-a454-69a838c70536" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356182EDBA66\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0ced-501e-003f-334a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:41 GMT", + "x-ms-client-request-id" : "92cdaa78-9f0e-45eb-a454-69a838c70536" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlrange0613548e30d42541f844a4?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" : "2129d942-db80-4db0-8179-1c7068c18415", + "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" : "\"0x8D7356182FA10A0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd0d09-501e-003f-4f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:41 GMT", + "x-ms-client-request-id" : "2129d942-db80-4db0-8179-1c7068c18415" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlrange0613548e30d42541f844a4/javablobuploadpagefromurlrange207617e3a060cf83804", + "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" : "d61f438a-8929-43d6-b742-d383c87fe831" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618307D6E5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0d1f-501e-003f-654a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:41 GMT", + "x-ms-client-request-id" : "d61f438a-8929-43d6-b742-d383c87fe831" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlrange0613548e30d42541f844a4/javablobuploadpagefromurlrange207617e3a060cf83804?comp=page", + "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" : "2a97794f-58e6-4443-bafd-55faf8fc3790", + "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" : "1I/g2VDfi7U=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:42 GMT", + "ETag" : "\"0x8D7356183156DF6\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd0d30-501e-003f-744a-675777000000", + "x-ms-client-request-id" : "2a97794f-58e6-4443-bafd-55faf8fc3790" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlrange0613548e30d42541f844a4/javablobuploadpagefromurlrange3664549b2945648f4b4", + "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" : "3c0620cb-26a4-4a1b-9014-3679bf76217e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356183228FC0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd0d47-501e-003f-0b4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:42 GMT", + "x-ms-client-request-id" : "3c0620cb-26a4-4a1b-9014-3679bf76217e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlrange0613548e30d42541f844a4/javablobuploadpagefromurlrange3664549b2945648f4b4?comp=page", + "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" : "16874778-cceb-462c-bd11-6dd890853429" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:42 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:42 GMT", + "Content-MD5" : "+eZxdjm2z6365obLet++Wg==", + "ETag" : "\"0x8D7356183309C11\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd0d61-501e-003f-234a-675777000000", + "x-ms-client-request-id" : "16874778-cceb-462c-bd11-6dd890853429" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlrange0613548e30d42541f844a4/javablobuploadpagefromurlrange3664549b2945648f4b4", + "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" : "bdffc022-93f4-4631-92e2-0b34b2e44a1a" + }, + "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", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:42 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:08:42 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "ETag" : "\"0x8D7356183309C11\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:08:42 GMT", + "Content-Length" : "1024", + "x-ms-request-id" : "9ebd0d6f-501e-003f-304a-675777000000", + "Body" : "[-41, 103, 66, -30, 114, -105, -106, 66, -117, -6, 97, -99, -69, 96, 100, 82, 86, -17, -29, -20, 31, -18, 23, 12, -98, 110, 24, 44, 20, 106, 72, -37, 13, 109, -47, 127, 113, -128, 7, 6, -85, -35, 109, -87, -80, 82, 27, 65, 57, 52, 34, 32, -47, -3, 89, -100, 49, 92, -23, 42, 60, -94, 90, 41, 27, 35, 124, 103, 28, 75, 44, 102, 26, 25, -49, 123, -4, 97, 16, -4, -38, 40, -75, -30, -71, 92, 4, 53, 67, 48, 27, 66, -1, 86, 113, -123, -89, -59, 108, -54, -19, 29, 125, -16, 60, -95, -8, 17, -108, 43, -24, -107, 34, -23, -6, -3, 109, -7, -8, -59, 76, 110, -22, 99, -4, 59, 37, -45, -5, -46, 3, 7, 52, -41, -101, -39, -73, 39, -71, 96, 96, -6, 17, 82, -36, -39, -42, 14, -105, -93, -122, -8, 66, 103, -105, 30, 5, 30, 2, -68, -122, 60, -72, -128, -107, -77, 91, 9, -10, -1, 19, -47, -67, 17, 108, 80, 58, 97, -108, -29, 115, -102, -76, -16, 36, -26, -104, 41, -96, 85, 21, 91, 89, 39, -99, 52, -120, 68, -89, -8, -87, 19, -94, -108, -4, -57, 54, -4, 78, 47, 56, -111, 85, 107, 1, 62, 115, -20, -57, -128, -119, 9, -24, -33, -85, 60, -81, 67, -40, -74, -66, 64, 67, -25, 108, -108, -31, 112, 96, -85, -110, 22, -126, -87, 33, 32, -81, 24, -76, 126, -106, -51, 46, 65, -113, 28, 86, -118, 75, -18, 37, 105, -120, 112, 123, -82, 117, 105, 36, 24, 116, -78, 97, 116, 33, 33, -47, -67, -10, -47, -17, -128, -93, 14, 50, -57, -69, -3, 87, -13, 113, -58, 98, -46, -19, -39, -53, 112, 90, -62, -13, 11, -75, -80, 123, 41, -34, 35, -13, 18, -67, 14, 51, -93, 61, 102, -22, -37, -13, 30, 81, 48, -75, 48, 87, -72, 126, -114, -12, 61, -53, -43, 110, 55, 49, -1, -123, 34, -72, 74, 40, -42, -94, -3, 16, 94, -89, -72, -29, -73, 96, 8, 11, 96, -6, -91, 32, -74, -44, -81, 120, 114, -63, 5, 42, 77, -44, -4, -122, 112, 63, 102, -89, 20, -118, 58, 27, -1, 45, 75, 90, -34, -39, 38, -18, 39, 106, -118, -84, 18, 113, -115, 31, 12, -85, -93, -81, -63, -59, 104, 108, -15, -90, 85, -73, -16, -22, 122, 109, -59, 101, -27, -62, 63, 24, 58, -120, 100, 53, -40, 63, -25, 14, -57, 115, 14, -4, -39, -6, -107, -101, 27, -123, -120, 83, 49, 56, -80, -111, 111, 36, 14, 29, 14, 66, 44, 59, -56, 11, 106, 15, 79, -16, -107, -93, -49, 67, -9, -41, 27, -4, -15, 43, 55, 6, -25, -23, 101, 27, 27, -96, -127, -31, -112, -40, -35, 52, 22, 9, 33, -50, -44, 127, 83, 44, -112, -121, -70, 36, 67, -59, 31, 24, -113, 7, 84, -120, -28, 28, 59, -27, 41, -20, 49, 73, -84, -22, -120, -88, 36, -106, -98, -53, -23, 109, 43, 49, 109, -127, 49, -21, 1, -99, 86, -87, -14, -26, 74, -123, 103, -66, -89, 49, 4, 22, -21, -124, -62, 119, 51, -34, -107, 58, 28, 32, -121, -121, -49, -108, 80, -83, -49, 52, 123, 40, 4, 122, 120, -108, -9, -32, -35, -44, 66, 43, 79, -17, 7, -63, -91, -7, -39, -48, -15, 2, 16, -114, -92, 101, 27, -69, -96, 122, -30, -33, -30, 30, -101, 76, 45, 29, -70, 90, 69, -73, -105, 21, -52, 13, -87, -80, 20, 20, 25, -90, 12, 4, 78, -3, 99, -112, -64, 100, 13, 58, -65, -115, 29, 117, -62, 83, 121, 82, -118, 30, -60, 113, 33, -59, 70, -93, -75, 6, 71, -52, 103, 63, -39, 60, 64, -10, -79, -60, 2, 29, -26, -11, 112, 39, -107, 49, 118, -71, -102, -26, 40, 54, -47, -12, -73, 37, -44, -12, 12, -3, -119, 117, -25, -81, 11, -16, 72, 39, 118, 29, -18, -55, -64, -114, 127, 88, 29, 54, 10, 26, -16, -83, 88, 19, -19, -48, 71, -78, 96, 11, 127, -47, -20, -28, 68, -69, -117, -97, 24, -29, 83, 2, 106, 33, 112, 86, -10, 14, -24, -79, 113, 7, 19, -49, 17, 9, -22, -128, 67, -2, -114, 119, -100, 68, -3, -67, 70, 95, -73, 19, -4, -97, -6, -3, 69, 48, 74, -93, -99, -3, -119, 45, 18, -125, -62, -21, 79, -48, -60, -124, 91, 47, -26, 66, -50, 26, -108, -22, -116, 72, 117, 24, -118, 118, 6, -34, 31, -42, -66, 21, -112, 27, 15, 99, -107, -119, -99, -116, 115, 4, 13, -49, -80, 125, 80, 104, 112, -98, -79, -113, -75, 91, 23, -38, -93, -90, 112, -66, -52, 71, 62, -118, -15, 37, 31, 84, -95, -124, -83, 89, 46, -90, -35, 70, -29, -73, -23, 109, -38, 28, 106, 17, -108, 44, 13, 12, 110, 17, -112, -30, -64, -119, 111, -15, -110, 25, 50, 80, 26, -44, -64, -23, -104, -102, 101, 96, 20, -65, 29, -6, 90, 101, -30, -9, 102, -120, 102, 67, -60, -67, -87, 125, -52, -7, -74, -120, -69, -70, -44, -36, -106, 80, -107, 50, 96, 39, 0, 14, 52, 9, 23, 126, 44, 78, 92, -57, 1, -21, 37, 47, -85, 84, 17, -51, 101, -57, 12, 45, 37, 16, -3, -79, -7, -65, -46, -29, -17, 122, -35, -117, -76, 33, 125, 79, 82, 48, 83, 29, -80, 10, 99, -104, 113, -91, -39, 37, -93, 117, 35, -62, 118, -27, 110, 60, -70, 94, -43, 54, 30, 35, 59, -56, 15, 34, -125, -53, 30, 106, -88, -92, 47, 75, 61, 84, -125, 33, 21, -40, -7, 92, -34, -25, 44, 72, 48, 88, 64, 93, 72, -3, 36, -107, 44, 106, 95, 63, 70, 93, -36, -37, -33, -78, 126, 72, -98, -111, 108, 95, -90, 9, -47, 38, 24, 120, -18, 14, 14, 53, -36, 97, -112, -8, -94, -86, -13, -72, -90, 61, 124, -127, -76, 104, 108, -96, 101, 80, -52, 44, 47]", + "x-ms-client-request-id" : "bdffc022-93f4-4631-92e2-0b34b2e44a1a", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurlrange&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" : "fcc14451-062d-4db5-ae19-2db36c98b9c5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd0d82-501e-003f-434a-675777000000", + "Body" : "jtcuploadpagefromurlrangejtcuploadpagefromurlrange0613548e30d42541f844a4Mon, 09 Sep 2019 20:08:42 GMT\"0x8D7356182FA10A0\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:42 GMT", + "x-ms-client-request-id" : "fcc14451-062d-4db5-ae19-2db36c98b9c5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlrange0613548e30d42541f844a4?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" : "a0cd1cb6-6d14-480f-b486-7a477b26fb8f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd0d93-501e-003f-534a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:42 GMT", + "x-ms-client-request-id" : "a0cd1cb6-6d14-480f-b486-7a477b26fb8f" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlrange0613548e30d42541f844a4", "javablobuploadpagefromurlrange153428f7acc68023fe4", "47964d01-1fb7-4a32-ad86-8dfbf4426b10", "javablobuploadpagefromurlrange207617e3a060cf83804", "javablobuploadpagefromurlrange3664549b2945648f4b4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[0].json new file mode 100644 index 000000000000..da9099373148 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[0].json @@ -0,0 +1,180 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac096249be3746b24ece47?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" : "c81c3718-bc88-48e4-890d-dda8d84e29f4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618B9E0AF8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1b51-501e-003f-114a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:56 GMT", + "x-ms-client-request-id" : "c81c3718-bc88-48e4-890d-dda8d84e29f4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac096249be3746b24ece47/javablobuploadpagefromurlsourceac1576684a213aa4a682", + "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" : "f4e36744-3b35-42d2-b11a-18101e068888" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618BAB0C54\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1b6a-501e-003f-274a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:56 GMT", + "x-ms-client-request-id" : "f4e36744-3b35-42d2-b11a-18101e068888" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac096249be3746b24ece47?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" : "d3bca347-5b40-4acc-9622-e107514ef4b4", + "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" : "\"0x8D735618BB7398A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1b82-501e-003f-3e4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:56 GMT", + "x-ms-client-request-id" : "d3bca347-5b40-4acc-9622-e107514ef4b4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac096249be3746b24ece47/javablobuploadpagefromurlsourceac27837453cd82fcd61d", + "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" : "a292d724-5f2a-41db-802d-a3c1ab429ea0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618BC46565\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1b9e-501e-003f-594a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:56 GMT", + "x-ms-client-request-id" : "a292d724-5f2a-41db-802d-a3c1ab429ea0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac096249be3746b24ece47/javablobuploadpagefromurlsourceac27837453cd82fcd61d?comp=page", + "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" : "ea34e910-1bb8-4460-96f9-2040482ea256", + "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" : "sSJBgDAUHm0=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:56 GMT", + "ETag" : "\"0x8D735618BD24A98\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd1bbc-501e-003f-764a-675777000000", + "x-ms-client-request-id" : "ea34e910-1bb8-4460-96f9-2040482ea256" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac096249be3746b24ece47/javablobuploadpagefromurlsourceac1576684a213aa4a682?comp=page", + "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" : "999977da-4057-40c1-a593-6c9f0f3af1e3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:56 GMT", + "Content-MD5" : "cxvbxQ1HvqGo3Zfu4n56oA==", + "ETag" : "\"0x8D735618BE22C0C\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd1c03-501e-003f-3b4a-675777000000", + "x-ms-client-request-id" : "999977da-4057-40c1-a593-6c9f0f3af1e3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurlsourceac&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" : "3b55f881-2b6c-4350-a1c1-1670968882f8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1c2f-501e-003f-674a-675777000000", + "Body" : "jtcuploadpagefromurlsourceacjtcuploadpagefromurlsourceac096249be3746b24ece47Mon, 09 Sep 2019 20:08:56 GMT\"0x8D735618BB7398A\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:56 GMT", + "x-ms-client-request-id" : "3b55f881-2b6c-4350-a1c1-1670968882f8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac096249be3746b24ece47?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" : "be244ff6-553c-4c67-ad6d-61a50f4626c9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd1c47-501e-003f-7e4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:56 GMT", + "x-ms-client-request-id" : "be244ff6-553c-4c67-ad6d-61a50f4626c9" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceac096249be3746b24ece47", "javablobuploadpagefromurlsourceac1576684a213aa4a682", "javablobuploadpagefromurlsourceac27837453cd82fcd61d", "29035396-5806-44d5-9dcd-d2f2d25d7a5f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[1].json new file mode 100644 index 000000000000..d5396c7f73a0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[1].json @@ -0,0 +1,180 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac0789104bb83c17936f4b?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" : "9fe25ac2-4e75-40fe-97df-c403927f6df2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618C0CBF40\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1c70-501e-003f-204a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:57 GMT", + "x-ms-client-request-id" : "9fe25ac2-4e75-40fe-97df-c403927f6df2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac0789104bb83c17936f4b/javablobuploadpagefromurlsourceac16520577315699d208", + "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" : "c469b8a6-a943-4d3f-8a17-65abb1439784" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618C1AF9B4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1c84-501e-003f-334a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:57 GMT", + "x-ms-client-request-id" : "c469b8a6-a943-4d3f-8a17-65abb1439784" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac0789104bb83c17936f4b?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" : "25f7602d-913b-4c23-99c4-4f0b60a69eaa", + "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" : "\"0x8D735618C2726FC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1c99-501e-003f-464a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:57 GMT", + "x-ms-client-request-id" : "25f7602d-913b-4c23-99c4-4f0b60a69eaa" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac0789104bb83c17936f4b/javablobuploadpagefromurlsourceac295712c8179644898f", + "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" : "9370564c-0482-4f5b-9da0-bde940f7b929" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618C34EF0A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1cad-501e-003f-564a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:57 GMT", + "x-ms-client-request-id" : "9370564c-0482-4f5b-9da0-bde940f7b929" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac0789104bb83c17936f4b/javablobuploadpagefromurlsourceac295712c8179644898f?comp=page", + "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" : "5e424ccb-6c6b-4713-81f2-7403a0aed195", + "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" : "8ArhcboUIZk=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:57 GMT", + "ETag" : "\"0x8D735618C4210CA\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd1cc9-501e-003f-714a-675777000000", + "x-ms-client-request-id" : "5e424ccb-6c6b-4713-81f2-7403a0aed195" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac0789104bb83c17936f4b/javablobuploadpagefromurlsourceac16520577315699d208?comp=page", + "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" : "64a5c131-850c-45d0-b1d5-723c6f7ab672" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:57 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:57 GMT", + "Content-MD5" : "e3SnGzMKv1VaAN2vt1AbIQ==", + "ETag" : "\"0x8D735618C602596\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd1ce7-501e-003f-0e4a-675777000000", + "x-ms-client-request-id" : "64a5c131-850c-45d0-b1d5-723c6f7ab672" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurlsourceac&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" : "af6ae0ce-46f9-43fe-8f1f-fece191973b5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1d15-501e-003f-384a-675777000000", + "Body" : "jtcuploadpagefromurlsourceacjtcuploadpagefromurlsourceac0789104bb83c17936f4bMon, 09 Sep 2019 20:08:57 GMT\"0x8D735618C2726FC\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:57 GMT", + "x-ms-client-request-id" : "af6ae0ce-46f9-43fe-8f1f-fece191973b5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac0789104bb83c17936f4b?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" : "03027b06-8652-48af-8e5d-560f952053e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd1d39-501e-003f-5b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:57 GMT", + "x-ms-client-request-id" : "03027b06-8652-48af-8e5d-560f952053e8" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceac0789104bb83c17936f4b", "javablobuploadpagefromurlsourceac16520577315699d208", "javablobuploadpagefromurlsourceac295712c8179644898f", "0b587f58-1188-4983-bbb7-f29d3d9c545a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[2].json new file mode 100644 index 000000000000..65a7801898cc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[2].json @@ -0,0 +1,180 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac0655123179d3ea3cbc41?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" : "4ac255b4-74b6-424a-b87a-08897695eb61" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618C8A434C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1d50-501e-003f-724a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:57 GMT", + "x-ms-client-request-id" : "4ac255b4-74b6-424a-b87a-08897695eb61" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac0655123179d3ea3cbc41/javablobuploadpagefromurlsourceac124241a4ee7a962dcb", + "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" : "f835b8ae-5c13-495e-96fc-398421658867" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618C976C47\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1d5e-501e-003f-7f4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:57 GMT", + "x-ms-client-request-id" : "f835b8ae-5c13-495e-96fc-398421658867" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac0655123179d3ea3cbc41?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" : "d041a7af-c7f8-4156-90ac-3e8b23bb5bbc", + "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" : "\"0x8D735618CA3E7B8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1d6f-501e-003f-0e4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:58 GMT", + "x-ms-client-request-id" : "d041a7af-c7f8-4156-90ac-3e8b23bb5bbc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac0655123179d3ea3cbc41/javablobuploadpagefromurlsourceac286802dc6fb95f1045", + "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" : "c0d60774-3027-4fb4-9d9a-ee030aa4280d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618CB384E8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1d87-501e-003f-234a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:58 GMT", + "x-ms-client-request-id" : "c0d60774-3027-4fb4-9d9a-ee030aa4280d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac0655123179d3ea3cbc41/javablobuploadpagefromurlsourceac286802dc6fb95f1045?comp=page", + "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" : "2f5c149c-9281-4cc7-a9e6-e4b2f32f79cc", + "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" : "9ghdR1PwPuU=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:58 GMT", + "ETag" : "\"0x8D735618CC1430F\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd1da2-501e-003f-3d4a-675777000000", + "x-ms-client-request-id" : "2f5c149c-9281-4cc7-a9e6-e4b2f32f79cc" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac0655123179d3ea3cbc41/javablobuploadpagefromurlsourceac124241a4ee7a962dcb?comp=page", + "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" : "f2aa8c35-02ee-4bb6-8066-b2eb0d5a7e96" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:58 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:58 GMT", + "Content-MD5" : "iqjFGb6ISTJob+TOyDNXsQ==", + "ETag" : "\"0x8D735618CD0610D\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd1db9-501e-003f-534a-675777000000", + "x-ms-client-request-id" : "f2aa8c35-02ee-4bb6-8066-b2eb0d5a7e96" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurlsourceac&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" : "e9e0da14-9d2b-4380-8b61-661f8d61016a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1dd4-501e-003f-6d4a-675777000000", + "Body" : "jtcuploadpagefromurlsourceacjtcuploadpagefromurlsourceac0655123179d3ea3cbc41Mon, 09 Sep 2019 20:08:58 GMT\"0x8D735618CA3E7B8\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:58 GMT", + "x-ms-client-request-id" : "e9e0da14-9d2b-4380-8b61-661f8d61016a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac0655123179d3ea3cbc41?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" : "d458e2f4-59ca-4a92-a98d-d4a74de4957a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd1df3-501e-003f-084a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:58 GMT", + "x-ms-client-request-id" : "d458e2f4-59ca-4a92-a98d-d4a74de4957a" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceac0655123179d3ea3cbc41", "javablobuploadpagefromurlsourceac124241a4ee7a962dcb", "javablobuploadpagefromurlsourceac286802dc6fb95f1045", "cc2c4102-c07d-4320-aceb-11e3bde00c5f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[3].json new file mode 100644 index 000000000000..b823ebf6e71c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[3].json @@ -0,0 +1,212 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac093737dbcced1398dc4c?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" : "a433b0f7-4026-4c56-9b03-d0d03a7fc937" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618CFDDA77\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1e08-501e-003f-1d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:58 GMT", + "x-ms-client-request-id" : "a433b0f7-4026-4c56-9b03-d0d03a7fc937" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac093737dbcced1398dc4c/javablobuploadpagefromurlsourceac130828a6b6ca3f2997", + "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" : "9158b519-1d50-40e4-bc2d-91ee8e7b438e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618D0B2AE9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1e26-501e-003f-364a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:58 GMT", + "x-ms-client-request-id" : "9158b519-1d50-40e4-bc2d-91ee8e7b438e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac093737dbcced1398dc4c?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" : "7608672b-eb3a-4921-8608-45c1128b2dc7", + "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" : "\"0x8D735618D1757F8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1e44-501e-003f-4f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:58 GMT", + "x-ms-client-request-id" : "7608672b-eb3a-4921-8608-45c1128b2dc7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac093737dbcced1398dc4c/javablobuploadpagefromurlsourceac2687119a7126c909ab", + "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" : "52cb2aa1-8727-4017-94a9-f400272015d8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618D240EB2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1e58-501e-003f-624a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:58 GMT", + "x-ms-client-request-id" : "52cb2aa1-8727-4017-94a9-f400272015d8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac093737dbcced1398dc4c/javablobuploadpagefromurlsourceac2687119a7126c909ab?comp=page", + "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" : "09af3337-1c2a-4f9f-8dfd-e1fd71791eaa", + "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" : "BBrsh88PuqU=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:59 GMT", + "ETag" : "\"0x8D735618D34172A\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd1e7a-501e-003f-014a-675777000000", + "x-ms-client-request-id" : "09af3337-1c2a-4f9f-8dfd-e1fd71791eaa" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac093737dbcced1398dc4c/javablobuploadpagefromurlsourceac2687119a7126c909ab", + "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" : "0bb7219f-589c-4c95-87ad-c05854310d2e" + }, + "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", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:59 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:08:59 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735618D34172A\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:08:59 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd1e98-501e-003f-1c4a-675777000000", + "x-ms-client-request-id" : "0bb7219f-589c-4c95-87ad-c05854310d2e", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac093737dbcced1398dc4c/javablobuploadpagefromurlsourceac130828a6b6ca3f2997?comp=page", + "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" : "b6971308-9752-42aa-8f9a-46a0959e0d69" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:59 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:59 GMT", + "Content-MD5" : "+MDMY7/9btjzrWwh4ZTWfQ==", + "ETag" : "\"0x8D735618D4D491D\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd1eb1-501e-003f-354a-675777000000", + "x-ms-client-request-id" : "b6971308-9752-42aa-8f9a-46a0959e0d69" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurlsourceac&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" : "bd6c5e1e-1337-4cdc-b8bd-39d8874e8cfa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1ece-501e-003f-514a-675777000000", + "Body" : "jtcuploadpagefromurlsourceacjtcuploadpagefromurlsourceac093737dbcced1398dc4cMon, 09 Sep 2019 20:08:59 GMT\"0x8D735618D1757F8\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:59 GMT", + "x-ms-client-request-id" : "bd6c5e1e-1337-4cdc-b8bd-39d8874e8cfa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac093737dbcced1398dc4c?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" : "1a08e9ac-4452-40ba-94cc-dc8a83af6a99" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd1ee2-501e-003f-634a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:59 GMT", + "x-ms-client-request-id" : "1a08e9ac-4452-40ba-94cc-dc8a83af6a99" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceac093737dbcced1398dc4c", "javablobuploadpagefromurlsourceac130828a6b6ca3f2997", "javablobuploadpagefromurlsourceac2687119a7126c909ab", "78444bc0-1ddd-4b56-98a2-a26e916ac931" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[4].json new file mode 100644 index 000000000000..4b74daa41d4f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceac[4].json @@ -0,0 +1,180 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac03943449cdfa577dc546?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" : "a739c0a7-a693-49eb-88c0-925287c5c508" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618D778D3B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1efd-501e-003f-7e4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:59 GMT", + "x-ms-client-request-id" : "a739c0a7-a693-49eb-88c0-925287c5c508" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac03943449cdfa577dc546/javablobuploadpagefromurlsourceac142022a36f60fa0eea", + "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" : "81f743e3-7b85-448d-8605-9569e115497a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618D85A18B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1f1a-501e-003f-174a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:59 GMT", + "x-ms-client-request-id" : "81f743e3-7b85-448d-8605-9569e115497a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac03943449cdfa577dc546?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" : "46b5f68f-9354-4205-b9ea-7a2b6a0771d1", + "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" : "\"0x8D735618D91CE60\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1f31-501e-003f-2e4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:59 GMT", + "x-ms-client-request-id" : "46b5f68f-9354-4205-b9ea-7a2b6a0771d1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac03943449cdfa577dc546/javablobuploadpagefromurlsourceac28573364a6afeb46cc", + "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" : "330726a8-5bf4-430b-b538-cd6c57b95ac7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618D9F21A4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1f4b-501e-003f-474a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:59 GMT", + "x-ms-client-request-id" : "330726a8-5bf4-430b-b538-cd6c57b95ac7" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac03943449cdfa577dc546/javablobuploadpagefromurlsourceac28573364a6afeb46cc?comp=page", + "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" : "e65d6dfb-7aa6-4f33-98bf-7fb6db66f238", + "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" : "46Kwsx/qKAo=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:00 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:59 GMT", + "ETag" : "\"0x8D735618DABA715\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd1f61-501e-003f-5b4a-675777000000", + "x-ms-client-request-id" : "e65d6dfb-7aa6-4f33-98bf-7fb6db66f238" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac03943449cdfa577dc546/javablobuploadpagefromurlsourceac142022a36f60fa0eea?comp=page", + "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" : "52aa3eb4-c18f-4939-b466-d64801aa00b7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:00 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:59 GMT", + "Content-MD5" : "L+cIgzY1mt+TkF+ullGUSw==", + "ETag" : "\"0x8D735618DBC24DD\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd1f7c-501e-003f-734a-675777000000", + "x-ms-client-request-id" : "52aa3eb4-c18f-4939-b466-d64801aa00b7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurlsourceac&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" : "2fac84a9-5ac4-452d-b105-3dac02e029eb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1f95-501e-003f-094a-675777000000", + "Body" : "jtcuploadpagefromurlsourceacjtcuploadpagefromurlsourceac03943449cdfa577dc546Mon, 09 Sep 2019 20:08:59 GMT\"0x8D735618D91CE60\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:59 GMT", + "x-ms-client-request-id" : "2fac84a9-5ac4-452d-b105-3dac02e029eb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceac03943449cdfa577dc546?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" : "90480fb1-6930-4b23-954f-87edd3411ab4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd1fb6-501e-003f-294a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:00 GMT", + "x-ms-client-request-id" : "90480fb1-6930-4b23-954f-87edd3411ab4" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceac03943449cdfa577dc546", "javablobuploadpagefromurlsourceac142022a36f60fa0eea", "javablobuploadpagefromurlsourceac28573364a6afeb46cc", "da73c591-ee02-4ee8-8361-34f51d1d0b1e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceacfail[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceacfail[0].json new file mode 100644 index 000000000000..512be7c36f1b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceacfail[0].json @@ -0,0 +1,175 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail058330c8ca79773c9e?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" : "92e8c53c-4b89-44b9-9920-d9d4f0b20a19" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618DE1378E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1fc7-501e-003f-394a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:00 GMT", + "x-ms-client-request-id" : "92e8c53c-4b89-44b9-9920-d9d4f0b20a19" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail058330c8ca79773c9e/javablobuploadpagefromurlsourceacfail147769248daca4b3", + "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" : "5bbb2b68-e0cc-4af7-aafa-2e232deb7265" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618DEF251D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd1fdc-501e-003f-4c4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:00 GMT", + "x-ms-client-request-id" : "5bbb2b68-e0cc-4af7-aafa-2e232deb7265" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail058330c8ca79773c9e?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" : "68fc8c3d-8d26-4569-a41a-ac3b478eb7a3", + "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" : "\"0x8D735618DFC1544\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd1ff5-501e-003f-614a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:00 GMT", + "x-ms-client-request-id" : "68fc8c3d-8d26-4569-a41a-ac3b478eb7a3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail058330c8ca79773c9e/javablobuploadpagefromurlsourceacfail2906378bdda473b2", + "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" : "f698e22e-8a56-4e84-8f8e-578d6e0cb5c1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618E0941A0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2010-501e-003f-7b4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:00 GMT", + "x-ms-client-request-id" : "f698e22e-8a56-4e84-8f8e-578d6e0cb5c1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail058330c8ca79773c9e/javablobuploadpagefromurlsourceacfail2906378bdda473b2?comp=page", + "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" : "0ce34dca-8fea-48b3-99b4-a23450b6ffb0", + "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" : "VEbax2DMV74=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:00 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:00 GMT", + "ETag" : "\"0x8D735618E163C4C\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd2029-501e-003f-134a-675777000000", + "x-ms-client-request-id" : "0ce34dca-8fea-48b3-99b4-a23450b6ffb0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail058330c8ca79773c9e/javablobuploadpagefromurlsourceacfail147769248daca4b3?comp=page", + "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" : "a4c7e990-f950-42dc-ba79-bdf5f19cc66e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "9ebd2040-501e-003f-274a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:00 GMT", + "x-ms-client-request-id" : "a4c7e990-f950-42dc-ba79-bdf5f19cc66e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurlsourceacfail&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" : "6cd71942-f9fe-4c53-9563-ce90d4d7f6fc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd2055-501e-003f-3c4a-675777000000", + "Body" : "jtcuploadpagefromurlsourceacfailjtcuploadpagefromurlsourceacfail058330c8ca79773c9eMon, 09 Sep 2019 20:09:00 GMT\"0x8D735618DFC1544\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:00 GMT", + "x-ms-client-request-id" : "6cd71942-f9fe-4c53-9563-ce90d4d7f6fc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail058330c8ca79773c9e?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" : "99c5e052-d10a-4089-aa08-74b7e2ddf4f2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd206e-501e-003f-534a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:00 GMT", + "x-ms-client-request-id" : "99c5e052-d10a-4089-aa08-74b7e2ddf4f2" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceacfail058330c8ca79773c9e", "javablobuploadpagefromurlsourceacfail147769248daca4b3", "javablobuploadpagefromurlsourceacfail2906378bdda473b2", "9dba9d60-fee8-4504-9f2c-b2f60239914a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceacfail[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceacfail[1].json new file mode 100644 index 000000000000..3c2561a05486 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceacfail[1].json @@ -0,0 +1,178 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail074829888ca11fecad?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" : "2987cb3d-a2e2-4056-afa5-da0ccf0ea447" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618E4ABADB\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2081-501e-003f-664a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:00 GMT", + "x-ms-client-request-id" : "2987cb3d-a2e2-4056-afa5-da0ccf0ea447" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail074829888ca11fecad/javablobuploadpagefromurlsourceacfail118106f5ae69e810", + "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" : "590111c8-3fe1-42be-b820-0ec2fd1b5974" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618E5ACBF4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2099-501e-003f-7c4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:00 GMT", + "x-ms-client-request-id" : "590111c8-3fe1-42be-b820-0ec2fd1b5974" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail074829888ca11fecad?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" : "b7aa41ce-3f46-4e6e-bc38-772e331609cd", + "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" : "\"0x8D735618E676DEC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd20b2-501e-003f-144a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:01 GMT", + "x-ms-client-request-id" : "b7aa41ce-3f46-4e6e-bc38-772e331609cd" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail074829888ca11fecad/javablobuploadpagefromurlsourceacfail278112a1099d6a50", + "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" : "428ac4b6-3c4f-46cf-a34d-0edf7e912129" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618E749A40\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd20cb-501e-003f-2c4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:01 GMT", + "x-ms-client-request-id" : "428ac4b6-3c4f-46cf-a34d-0edf7e912129" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail074829888ca11fecad/javablobuploadpagefromurlsourceacfail278112a1099d6a50?comp=page", + "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" : "256f99d8-d685-4cee-9a01-accfdcbb97fe", + "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" : "he8Ed9TCSIk=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:01 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:01 GMT", + "ETag" : "\"0x8D735618E811FA8\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd20e1-501e-003f-424a-675777000000", + "x-ms-client-request-id" : "256f99d8-d685-4cee-9a01-accfdcbb97fe" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail074829888ca11fecad/javablobuploadpagefromurlsourceacfail118106f5ae69e810?comp=page", + "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" : "f249448d-b39f-4a8a-a12e-aba92d2ead55" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "Content-Length" : "251", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd210b-501e-003f-6a4a-675777000000", + "Body" : "\nCannotVerifyCopySourceCould not verify the copy source within the specified time.\nRequestId:9ebd210b-501e-003f-6a4a-675777000000\nTime:2019-09-09T20:09:01.6169795Z", + "Date" : "Mon, 09 Sep 2019 20:09:01 GMT", + "x-ms-client-request-id" : "f249448d-b39f-4a8a-a12e-aba92d2ead55", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurlsourceacfail&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" : "f0919d2a-e49c-4f99-a733-e5c1545fe0ac" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd2134-501e-003f-0f4a-675777000000", + "Body" : "jtcuploadpagefromurlsourceacfailjtcuploadpagefromurlsourceacfail074829888ca11fecadMon, 09 Sep 2019 20:09:01 GMT\"0x8D735618E676DEC\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:01 GMT", + "x-ms-client-request-id" : "f0919d2a-e49c-4f99-a733-e5c1545fe0ac", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail074829888ca11fecad?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" : "0bfc5ff8-c781-435a-bb99-043666d10162" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd2150-501e-003f-2b4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:01 GMT", + "x-ms-client-request-id" : "0bfc5ff8-c781-435a-bb99-043666d10162" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceacfail074829888ca11fecad", "javablobuploadpagefromurlsourceacfail118106f5ae69e810", "javablobuploadpagefromurlsourceacfail278112a1099d6a50", "799e4b39-8b2e-41ab-8b90-d3ee26385cfd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceacfail[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceacfail[2].json new file mode 100644 index 000000000000..b3a9c3a913e5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceacfail[2].json @@ -0,0 +1,178 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail0098417ec2d961d978?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" : "b7253a39-2fe5-41de-82e2-98faa99142f8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618EBB445D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2163-501e-003f-3d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:01 GMT", + "x-ms-client-request-id" : "b7253a39-2fe5-41de-82e2-98faa99142f8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail0098417ec2d961d978/javablobuploadpagefromurlsourceacfail1758602ed12a5ccf", + "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" : "03304d8f-b9b5-4672-9dc8-a16be38d2bd3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618EC86ED6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd217d-501e-003f-544a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:01 GMT", + "x-ms-client-request-id" : "03304d8f-b9b5-4672-9dc8-a16be38d2bd3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail0098417ec2d961d978?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" : "faaf591b-66fd-4770-97ce-e75304ec65e4", + "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" : "\"0x8D735618ED49B93\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd219a-501e-003f-6d4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:01 GMT", + "x-ms-client-request-id" : "faaf591b-66fd-4770-97ce-e75304ec65e4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail0098417ec2d961d978/javablobuploadpagefromurlsourceacfail2356782fe5f008bf", + "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" : "ac5cf0bc-459e-4377-a1ed-347da3f98610" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618EE2642B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd21ab-501e-003f-7d4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:01 GMT", + "x-ms-client-request-id" : "ac5cf0bc-459e-4377-a1ed-347da3f98610" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail0098417ec2d961d978/javablobuploadpagefromurlsourceacfail2356782fe5f008bf?comp=page", + "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" : "4fae84d3-9baf-4327-962d-e1167511268a", + "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" : "ZKUYWYqzugE=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:01 GMT", + "ETag" : "\"0x8D735618EEF5EDB\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd21c3-501e-003f-144a-675777000000", + "x-ms-client-request-id" : "4fae84d3-9baf-4327-962d-e1167511268a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail0098417ec2d961d978/javablobuploadpagefromurlsourceacfail1758602ed12a5ccf?comp=page", + "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" : "1346f643-b93b-4c0a-96ce-d8a9af329eff" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "Content-Length" : "251", + "StatusCode" : "412", + "x-ms-request-id" : "9ebd21e0-501e-003f-304a-675777000000", + "Body" : "\nCannotVerifyCopySourceCould not verify the copy source within the specified time.\nRequestId:9ebd21e0-501e-003f-304a-675777000000\nTime:2019-09-09T20:09:02.3254825Z", + "Date" : "Mon, 09 Sep 2019 20:09:02 GMT", + "x-ms-client-request-id" : "1346f643-b93b-4c0a-96ce-d8a9af329eff", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurlsourceacfail&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" : "2fe69875-1858-4f05-9c24-d9db69f2c5b4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd21f9-501e-003f-474a-675777000000", + "Body" : "jtcuploadpagefromurlsourceacfailjtcuploadpagefromurlsourceacfail0098417ec2d961d978Mon, 09 Sep 2019 20:09:02 GMT\"0x8D735618ED49B93\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:02 GMT", + "x-ms-client-request-id" : "2fe69875-1858-4f05-9c24-d9db69f2c5b4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail0098417ec2d961d978?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" : "de0d60f8-6f98-46fb-9072-dc27a9a32dc8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd2211-501e-003f-5f4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:02 GMT", + "x-ms-client-request-id" : "de0d60f8-6f98-46fb-9072-dc27a9a32dc8" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceacfail0098417ec2d961d978", "javablobuploadpagefromurlsourceacfail1758602ed12a5ccf", "javablobuploadpagefromurlsourceacfail2356782fe5f008bf", "467c0348-a2bd-4b1a-a124-0145a70f2223" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceacfail[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceacfail[3].json new file mode 100644 index 000000000000..01114ba7df9b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagefromurlsourceacfail[3].json @@ -0,0 +1,207 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail0614707db4cdc05837?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" : "191f1235-aa8e-468f-b284-e219824d7485" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618F24EEB9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd222b-501e-003f-784a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:02 GMT", + "x-ms-client-request-id" : "191f1235-aa8e-468f-b284-e219824d7485" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail0614707db4cdc05837/javablobuploadpagefromurlsourceacfail18323789b59ca781", + "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" : "88efe6b1-93d1-4fa3-9e4e-ade3c691e521" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618F31F24E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd2244-501e-003f-0d4a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:02 GMT", + "x-ms-client-request-id" : "88efe6b1-93d1-4fa3-9e4e-ade3c691e521" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail0614707db4cdc05837?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" : "686e5685-ed98-460c-9462-ca76e8d0477e", + "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" : "\"0x8D735618F3E1EFC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd2257-501e-003f-1c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:02 GMT", + "x-ms-client-request-id" : "686e5685-ed98-460c-9462-ca76e8d0477e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail0614707db4cdc05837/javablobuploadpagefromurlsourceacfail2606196ee6489821", + "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" : "6f21c113-98c7-45fd-b048-bc03b4b94191" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735618F4BE7B4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd226c-501e-003f-314a-675777000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:02 GMT", + "x-ms-client-request-id" : "6f21c113-98c7-45fd-b048-bc03b4b94191" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail0614707db4cdc05837/javablobuploadpagefromurlsourceacfail2606196ee6489821?comp=page", + "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" : "b3a0fb4d-8d8a-4d6a-b65d-cdd36ba8774f", + "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" : "VyeG2ah+QPc=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:02 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:09:02 GMT", + "ETag" : "\"0x8D735618F5A694C\"", + "Content-Length" : "0", + "x-ms-request-id" : "9ebd227e-501e-003f-404a-675777000000", + "x-ms-client-request-id" : "b3a0fb4d-8d8a-4d6a-b65d-cdd36ba8774f" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail0614707db4cdc05837/javablobuploadpagefromurlsourceacfail2606196ee6489821", + "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" : "f1bad38d-b3fa-486c-a145-1304ba0f4db5" + }, + "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", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:02 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 20:09:02 GMT", + "x-ms-blob-type" : "PageBlob", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "ETag" : "\"0x8D735618F5A694C\"", + "x-ms-creation-time" : "Mon, 09 Sep 2019 20:09:02 GMT", + "Content-Length" : "512", + "x-ms-request-id" : "9ebd2290-501e-003f-524a-675777000000", + "x-ms-client-request-id" : "f1bad38d-b3fa-486c-a145-1304ba0f4db5", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail0614707db4cdc05837/javablobuploadpagefromurlsourceacfail18323789b59ca781?comp=page", + "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" : "2841f948-a977-4d74-bf3a-3f82b84b6156" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "CannotVerifyCopySource", + "retry-after" : "0", + "StatusCode" : "304", + "x-ms-request-id" : "9ebd22aa-501e-003f-6a4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:02 GMT", + "x-ms-client-request-id" : "2841f948-a977-4d74-bf3a-3f82b84b6156" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagefromurlsourceacfail&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" : "1619d640-d6c6-49a8-8cf3-7d923401c2b9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd22cc-501e-003f-0b4a-675777000000", + "Body" : "jtcuploadpagefromurlsourceacfailjtcuploadpagefromurlsourceacfail0614707db4cdc05837Mon, 09 Sep 2019 20:09:02 GMT\"0x8D735618F3E1EFC\"unlockedavailablecontainer$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:02 GMT", + "x-ms-client-request-id" : "1619d640-d6c6-49a8-8cf3-7d923401c2b9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagefromurlsourceacfail0614707db4cdc05837?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" : "e79faa77-0d53-4aa9-9948-838edda55304" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd22df-501e-003f-1e4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:02 GMT", + "x-ms-client-request-id" : "e79faa77-0d53-4aa9-9948-838edda55304" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagefromurlsourceacfail0614707db4cdc05837", "javablobuploadpagefromurlsourceacfail18323789b59ca781", "javablobuploadpagefromurlsourceacfail2606196ee6489821", "ad51405d-29f6-4dbc-83ed-0a27871d9b7a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageia[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageia[0].json new file mode 100644 index 000000000000..bba6aa824c7e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageia[0].json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia3b1659676b14e9?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" : "b668fd63-8362-4616-a41f-0c562def6979" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617C9DD5CD\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb2188-301e-0042-2d4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:31 GMT", + "x-ms-client-request-id" : "b668fd63-8362-4616-a41f-0c562def6979" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia3b1659676b14e9/javablobuploadpageia1pageblobapitestuploadpageia3b1051663c6", + "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" : "f5095fdf-5fa5-45fb-b9c4-5709029efd6c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617CABC813\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb21a7-301e-0042-4a4a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:31 GMT", + "x-ms-client-request-id" : "f5095fdf-5fa5-45fb-b9c4-5709029efd6c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpageia&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" : "ff6145f2-9081-4831-9665-df3ce8ae70ac" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb21b9-301e-0042-5c4a-67cbbf000000", + "Body" : "jtcuploadpageiajtcuploadpageia0pageblobapitestuploadpageia3b1659676b14e9Mon, 09 Sep 2019 20:08:31 GMT\"0x8D735617C9DD5CD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:31 GMT", + "x-ms-client-request-id" : "ff6145f2-9081-4831-9665-df3ce8ae70ac", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia3b1659676b14e9?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" : "2ff52421-6c1d-4aa1-ac6d-30f9aee1a453" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb21d4-301e-0042-754a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:31 GMT", + "x-ms-client-request-id" : "2ff52421-6c1d-4aa1-ac6d-30f9aee1a453" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageia0pageblobapitestuploadpageia3b1659676b14e9", "javablobuploadpageia1pageblobapitestuploadpageia3b1051663c6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageia[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageia[1].json new file mode 100644 index 000000000000..2405e4c0258d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageia[1].json @@ -0,0 +1,101 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia5fc23171244fed?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" : "e9bdd39d-57f3-4632-9001-5f7b70d366b0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617CD1C06B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb21f0-301e-0042-0f4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:31 GMT", + "x-ms-client-request-id" : "e9bdd39d-57f3-4632-9001-5f7b70d366b0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia5fc23171244fed/javablobuploadpageia1pageblobapitestuploadpageia5fc57173497", + "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" : "f6b9582a-23f8-436f-a270-7a09003664cb" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617CDF3D9A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb2207-301e-0042-234a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:31 GMT", + "x-ms-client-request-id" : "f6b9582a-23f8-436f-a270-7a09003664cb" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia5fc23171244fed/javablobuploadpageia1pageblobapitestuploadpageia5fc57173497?comp=page", + "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" : "21d14e1c-5091-4aff-b7f2-2eef179756d7", + "Content-Type" : "application/octet-stream" + }, + "Response" : null, + "Exception" : { + "ClassName" : "com.azure.core.exception.UnexpectedLengthException", + "ErrorMessage" : "Request body emitted 511 bytes less than the expected 1024 bytes." + } + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpageia&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" : "0f5d93ca-d441-40ca-adb1-46f88b500487" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9d66b52f-401e-0020-294a-678c67000000", + "Body" : "jtcuploadpageiajtcuploadpageia0pageblobapitestuploadpageia5fc23171244fedMon, 09 Sep 2019 20:08:31 GMT\"0x8D735617CD1C06B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:31 GMT", + "x-ms-client-request-id" : "0f5d93ca-d441-40ca-adb1-46f88b500487", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia5fc23171244fed?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" : "a8b0d2b7-a10b-428c-a6fc-5215bec0c052" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9d66b53d-401e-0020-354a-678c67000000", + "Date" : "Mon, 09 Sep 2019 20:08:31 GMT", + "x-ms-client-request-id" : "a8b0d2b7-a10b-428c-a6fc-5215bec0c052" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageia0pageblobapitestuploadpageia5fc23171244fed", "javablobuploadpageia1pageblobapitestuploadpageia5fc57173497", "cdcae370-c920-4cb3-b630-539d84f24401" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageia[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageia[2].json new file mode 100644 index 000000000000..7477d75c4f61 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpageia[2].json @@ -0,0 +1,101 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia8dc836819dfc53?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" : "dca3e593-6290-404b-bf54-9725befb0c35" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617D3FE99C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9d66b553-401e-0020-4b4a-678c67000000", + "Date" : "Mon, 09 Sep 2019 20:08:31 GMT", + "x-ms-client-request-id" : "dca3e593-6290-404b-bf54-9725befb0c35" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia8dc836819dfc53/javablobuploadpageia1pageblobapitestuploadpageia8dc42242b6f", + "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" : "f4448a2c-666c-4e4c-b8fb-140386615b93" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617D4D55D0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:32 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9d66b566-401e-0020-5c4a-678c67000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:31 GMT", + "x-ms-client-request-id" : "f4448a2c-666c-4e4c-b8fb-140386615b93" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia8dc836819dfc53/javablobuploadpageia1pageblobapitestuploadpageia8dc42242b6f?comp=page", + "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" : "0dbb989f-d18b-49fe-b22c-062f6fe1832a", + "Content-Type" : "application/octet-stream" + }, + "Response" : null, + "Exception" : { + "ClassName" : "com.azure.core.exception.UnexpectedLengthException", + "ErrorMessage" : "Request body emitted 1536 bytes more than the expected 1024 bytes." + } + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpageia&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" : "5f225a99-b386-4bfb-90c1-d4b2f40fe6c6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd036b-501e-003f-034a-675777000000", + "Body" : "jtcuploadpageiajtcuploadpageia0pageblobapitestuploadpageia8dc836819dfc53Mon, 09 Sep 2019 20:08:32 GMT\"0x8D735617D3FE99C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:32 GMT", + "x-ms-client-request-id" : "5f225a99-b386-4bfb-90c1-d4b2f40fe6c6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpageia0pageblobapitestuploadpageia8dc836819dfc53?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" : "4632b524-d08d-43c0-b003-729fab1c0f9d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd038e-501e-003f-204a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:08:32 GMT", + "x-ms-client-request-id" : "4632b524-d08d-43c0-b003-729fab1c0f9d" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpageia0pageblobapitestuploadpageia8dc836819dfc53", "javablobuploadpageia1pageblobapitestuploadpageia8dc42242b6f", "afd7b34e-3838-42cf-98d4-f30fed724864" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagemin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagemin.json new file mode 100644 index 000000000000..79ee660a4bda --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/PageBlobAPITestuploadpagemin.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagemin0pageblobapitestuploadpagemincea27118c5aa3?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" : "4914f707-adcf-4cbf-b593-caaf6aab151e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617C4C99DF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb210d-301e-0042-3e4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:30 GMT", + "x-ms-client-request-id" : "4914f707-adcf-4cbf-b593-caaf6aab151e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagemin0pageblobapitestuploadpagemincea27118c5aa3/javablobuploadpagemin1pageblobapitestuploadpagemincea5198765", + "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" : "8f54a103-5fd3-49c5-acc2-398994690799" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735617C59EF88\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:31 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "c5cb211d-301e-0042-4b4a-67cbbf000000", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:30 GMT", + "x-ms-client-request-id" : "8f54a103-5fd3-49c5-acc2-398994690799" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagemin0pageblobapitestuploadpagemincea27118c5aa3/javablobuploadpagemin1pageblobapitestuploadpagemincea5198765?comp=page", + "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" : "36fbd8c9-e6ec-4943-983e-616229673305", + "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" : "JR9I8VUhfJE=", + "x-ms-blob-sequence-number" : "0", + "Last-Modified" : "Mon, 09 Sep 2019 20:08:31 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 20:08:30 GMT", + "ETag" : "\"0x8D735617C66EA38\"", + "Content-Length" : "0", + "x-ms-request-id" : "c5cb2133-301e-0042-604a-67cbbf000000", + "x-ms-client-request-id" : "36fbd8c9-e6ec-4943-983e-616229673305" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcuploadpagemin&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" : "156b2425-77af-4475-9092-87511fcd5830" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "c5cb2149-301e-0042-734a-67cbbf000000", + "Body" : "jtcuploadpageminjtcuploadpagemin0pageblobapitestuploadpagemincea27118c5aa3Mon, 09 Sep 2019 20:08:30 GMT\"0x8D735617C4C99DF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:08:30 GMT", + "x-ms-client-request-id" : "156b2425-77af-4475-9092-87511fcd5830", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcuploadpagemin0pageblobapitestuploadpagemincea27118c5aa3?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" : "c0081886-10ef-4303-8235-78107433c894" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "c5cb2168-301e-0042-0d4a-67cbbf000000", + "Date" : "Mon, 09 Sep 2019 20:08:30 GMT", + "x-ms-client-request-id" : "c0081886-10ef-4303-8235-78107433c894" + }, + "Exception" : null + } ], + "variables" : [ "jtcuploadpagemin0pageblobapitestuploadpagemincea27118c5aa3", "javablobuploadpagemin1pageblobapitestuploadpagemincea5198765", "7b7987de-ba5b-4bef-9ee8-d52ac2364a8b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ProgressReporterTestreportprogressparallel.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ProgressReporterTestreportprogressparallel.json new file mode 100644 index 000000000000..c959dc501f6a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ProgressReporterTestreportprogressparallel.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreportprogressparallel002154175b2bca03394bbe?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" : "8a3f05f4-6a15-4050-b45d-0fb29ef4df3a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B1EBDF6B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:10:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd57fe-501e-003f-764a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:10:00 GMT", + "x-ms-client-request-id" : "8a3f05f4-6a15-4050-b45d-0fb29ef4df3a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcreportprogressparallel&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" : "3ece3135-422a-4f53-87f1-a0e12c781392" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd5ab3-501e-003f-774a-675777000000", + "Body" : "jtcreportprogressparalleljtcreportprogressparallel002154175b2bca03394bbeMon, 09 Sep 2019 20:10:00 GMT\"0x8D73561B1EBDF6B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:10:03 GMT", + "x-ms-client-request-id" : "3ece3135-422a-4f53-87f1-a0e12c781392", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreportprogressparallel002154175b2bca03394bbe?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" : "b499d287-a009-40ea-b475-1d47a25a6a29" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd5ac1-501e-003f-054a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:10:03 GMT", + "x-ms-client-request-id" : "b499d287-a009-40ea-b475-1d47a25a6a29" + }, + "Exception" : null + } ], + "variables" : [ "jtcreportprogressparallel002154175b2bca03394bbe", "6317f599-f2e6-4a3e-bdfe-49b2428c86c6", "3caa7a92-56d7-48b0-b86e-f56d7867079d", "0ea22b15-b649-467a-8aa7-ce0ec3a53bf0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ProgressReporterTestreportprogresssequential.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ProgressReporterTestreportprogresssequential.json new file mode 100644 index 000000000000..e4abaf6f5fe3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ProgressReporterTestreportprogresssequential.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreportprogresssequential022168f9bd2ebb97be4d6?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" : "cc26e6eb-4528-4511-af3c-9e71fbba1d0e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561B155ECF7\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:09:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "9ebd5710-501e-003f-234a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:59 GMT", + "x-ms-client-request-id" : "cc26e6eb-4528-4511-af3c-9e71fbba1d0e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcreportprogresssequential&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" : "50d3f779-7f7e-422c-8b5f-f383d6e2f601" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "9ebd5745-501e-003f-504a-675777000000", + "Body" : "jtcreportprogresssequentialjtcreportprogresssequential022168f9bd2ebb97be4d6Mon, 09 Sep 2019 20:09:59 GMT\"0x8D73561B155ECF7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:09:59 GMT", + "x-ms-client-request-id" : "50d3f779-7f7e-422c-8b5f-f383d6e2f601", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcreportprogresssequential022168f9bd2ebb97be4d6?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" : "6b0d6eca-33a7-4910-abc9-4b1c5d6c7c17" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "9ebd5751-501e-003f-5c4a-675777000000", + "Date" : "Mon, 09 Sep 2019 20:09:59 GMT", + "x-ms-client-request-id" : "6b0d6eca-33a7-4910-abc9-4b1c5d6c7c17" + }, + "Exception" : null + } ], + "variables" : [ "jtcreportprogresssequential022168f9bd2ebb97be4d6", "cb25fd64-3ed8-4b74-99a9-94009f20b504", "ec2ac89c-23d1-4baa-a3e7-a1f6b9bbf54b", "591405f2-540c-4ee6-848d-4122c79fe48d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ProgressReporterTestreportprogresssequentialnetworktest.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ProgressReporterTestreportprogresssequentialnetworktest.json new file mode 100644 index 000000000000..7f5408e5842a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ProgressReporterTestreportprogresssequentialnetworktest.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "jtcreportprogresssequentialnetworktest010198ddb3c6775", "37afe009-ff95-4d1d-ad50-3b2933b57413", "javablobreportprogresssequentialnetworktest1782885049732" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesexponentialdelay.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesexponentialdelay.json new file mode 100644 index 000000000000..74ff6c981641 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesexponentialdelay.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesexponentialdelay06728803eb930972bd4c8?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" : "6bd865bb-5442-42ed-a004-d7fc7a42caab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356011630949\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:22 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fa824-801e-001f-2d48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:21 GMT", + "x-ms-client-request-id" : "6bd865bb-5442-42ed-a004-d7fc7a42caab" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcretriesexponentialdelay&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" : "c3a8466d-5858-4b47-a1e9-85046cdbbc83" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fb3ad-801e-001f-7748-673bbb000000", + "Body" : "jtcretriesexponentialdelayjtcretriesexponentialdelay06728803eb930972bd4c8Mon, 09 Sep 2019 19:58:22 GMT\"0x8D7356011630949\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:34 GMT", + "x-ms-client-request-id" : "c3a8466d-5858-4b47-a1e9-85046cdbbc83", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesexponentialdelay06728803eb930972bd4c8?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" : "25578ea2-f26a-4c1e-98f1-ee43f00833dd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fb3b4-801e-001f-7d48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:34 GMT", + "x-ms-client-request-id" : "25578ea2-f26a-4c1e-98f1-ee43f00833dd" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesexponentialdelay06728803eb930972bd4c8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesfixeddelay.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesfixeddelay.json new file mode 100644 index 000000000000..18e39ae1d85d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesfixeddelay.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesfixeddelay0retrytestretriesfixeddelaybfe63074ba72?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" : "f6acefbd-2b4c-4fd4-8e59-207c99db9bdc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560194934B2\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fb3c8-801e-001f-1048-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:34 GMT", + "x-ms-client-request-id" : "f6acefbd-2b4c-4fd4-8e59-207c99db9bdc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcretriesfixeddelay&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" : "da8ddfe7-26f2-46bb-a726-c97eeb3b6eca" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fb5d3-801e-001f-7648-673bbb000000", + "Body" : "jtcretriesfixeddelayjtcretriesfixeddelay0retrytestretriesfixeddelaybfe63074ba72Mon, 09 Sep 2019 19:58:35 GMT\"0x8D73560194934B2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:38 GMT", + "x-ms-client-request-id" : "da8ddfe7-26f2-46bb-a726-c97eeb3b6eca", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesfixeddelay0retrytestretriesfixeddelaybfe63074ba72?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" : "04aaec9f-1b74-414c-8eab-4297deb5531b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fb5e2-801e-001f-0548-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:38 GMT", + "x-ms-client-request-id" : "04aaec9f-1b74-414c-8eab-4297deb5531b" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesfixeddelay0retrytestretriesfixeddelaybfe63074ba72" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnetworkerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnetworkerror.json new file mode 100644 index 000000000000..4edafc1a0c34 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnetworkerror.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesnetworkerror0retrytestretriesnetworkerrorb0133469b6?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" : "3584242e-9336-4f75-bb1d-91a4103e6a17" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735600B8FA48C\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077f9cba-801e-001f-5748-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:11 GMT", + "x-ms-client-request-id" : "3584242e-9336-4f75-bb1d-91a4103e6a17" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcretriesnetworkerror&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" : "7beee225-b528-441c-998d-8eec1be53df9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077f9eb7-801e-001f-3148-673bbb000000", + "Body" : "jtcretriesnetworkerrorjtcretriesnetworkerror0retrytestretriesnetworkerrorb0133469b6Mon, 09 Sep 2019 19:58:12 GMT\"0x8D735600B8FA48C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:14 GMT", + "x-ms-client-request-id" : "7beee225-b528-441c-998d-8eec1be53df9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesnetworkerror0retrytestretriesnetworkerrorb0133469b6?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" : "d70ce115-8387-485d-80e8-b294763256f7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077f9ec6-801e-001f-3d48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:14 GMT", + "x-ms-client-request-id" : "d70ce115-8387-485d-80e8-b294763256f7" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesnetworkerror0retrytestretriesnetworkerrorb0133469b6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnonreplyableflux.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnonreplyableflux.json new file mode 100644 index 000000000000..1266b98f4323 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnonreplyableflux.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesnonreplyableflux0794508f17351a4ed346d?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" : "385226f2-71a0-4cba-a1be-021a90003d5a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735601B623E12\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:38 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fb5f7-801e-001f-1848-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:38 GMT", + "x-ms-client-request-id" : "385226f2-71a0-4cba-a1be-021a90003d5a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcretriesnonreplyableflux&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" : "e713c068-40a3-4cfc-aee6-73bd7ee452d3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fb6ba-801e-001f-4748-673bbb000000", + "Body" : "jtcretriesnonreplyablefluxjtcretriesnonreplyableflux0794508f17351a4ed346dMon, 09 Sep 2019 19:58:38 GMT\"0x8D735601B623E12\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:39 GMT", + "x-ms-client-request-id" : "e713c068-40a3-4cfc-aee6-73bd7ee452d3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesnonreplyableflux0794508f17351a4ed346d?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" : "58f73526-7f5c-4302-ac84-de417055536d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fb6cb-801e-001f-5448-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:39 GMT", + "x-ms-client-request-id" : "58f73526-7f5c-4302-ac84-de417055536d" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesnonreplyableflux0794508f17351a4ed346d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnonretryable.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnonretryable.json new file mode 100644 index 000000000000..048d39e45ecc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnonretryable.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesnonretryable0retrytestretriesnonretryableca105856ff?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" : "db8923b8-6ac1-43e2-a288-639be099a843" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735600A7DB42F\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077f9ba2-801e-001f-6048-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:10 GMT", + "x-ms-client-request-id" : "db8923b8-6ac1-43e2-a288-639be099a843" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcretriesnonretryable&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" : "dc22eff3-4d5d-448e-8d72-7cfd1c55ea4a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077f9bb8-801e-001f-7148-673bbb000000", + "Body" : "jtcretriesnonretryablejtcretriesnonretryable0retrytestretriesnonretryableca105856ffMon, 09 Sep 2019 19:58:10 GMT\"0x8D735600A7DB42F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:10 GMT", + "x-ms-client-request-id" : "dc22eff3-4d5d-448e-8d72-7cfd1c55ea4a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesnonretryable0retrytestretriesnonretryableca105856ff?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" : "865f8ee3-26ca-43a8-a38e-2f3dc57eae3a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077f9bca-801e-001f-0248-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:10 GMT", + "x-ms-client-request-id" : "865f8ee3-26ca-43a8-a38e-2f3dc57eae3a" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesnonretryable0retrytestretriesnonretryableca105856ff" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnonretryablesecondary.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnonretryablesecondary.json new file mode 100644 index 000000000000..21d38c4291a9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesnonretryablesecondary.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesnonretryablesecondary033510290c7ded11074?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" : "9c57eecd-4842-44a7-ae7c-0ac0742c87a8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735600AA80027\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077f9bd9-801e-001f-1148-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:10 GMT", + "x-ms-client-request-id" : "9c57eecd-4842-44a7-ae7c-0ac0742c87a8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcretriesnonretryablesecondary&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" : "436a1784-582e-42ec-9add-72b9d04aab5e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077f9c96-801e-001f-3a48-673bbb000000", + "Body" : "jtcretriesnonretryablesecondaryjtcretriesnonretryablesecondary033510290c7ded11074Mon, 09 Sep 2019 19:58:10 GMT\"0x8D735600AA80027\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:11 GMT", + "x-ms-client-request-id" : "436a1784-582e-42ec-9add-72b9d04aab5e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesnonretryablesecondary033510290c7ded11074?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" : "2bf2524a-4669-441e-8fa8-2145c1c34700" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077f9ca9-801e-001f-4748-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:11 GMT", + "x-ms-client-request-id" : "2bf2524a-4669-441e-8fa8-2145c1c34700" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesnonretryablesecondary033510290c7ded11074" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[0].json new file mode 100644 index 000000000000..4368a41de1fc --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesoptionsinvalid014736e4a345081db44fdd?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" : "06ac95cf-6553-4a8c-8ab9-66a357730315" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735601C1E8486\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fb6f0-801e-001f-7448-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:39 GMT", + "x-ms-client-request-id" : "06ac95cf-6553-4a8c-8ab9-66a357730315" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcretriesoptionsinvalid&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" : "24c452f8-f382-474e-8543-206a4f8a6b56" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fb6ff-801e-001f-0248-673bbb000000", + "Body" : "jtcretriesoptionsinvalidjtcretriesoptionsinvalid014736e4a345081db44fddMon, 09 Sep 2019 19:58:40 GMT\"0x8D735601C1E8486\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:39 GMT", + "x-ms-client-request-id" : "24c452f8-f382-474e-8543-206a4f8a6b56", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesoptionsinvalid014736e4a345081db44fdd?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" : "c75b9b78-4712-47b8-b341-7fa206acbac2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fb718-801e-001f-1b48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:39 GMT", + "x-ms-client-request-id" : "c75b9b78-4712-47b8-b341-7fa206acbac2" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesoptionsinvalid014736e4a345081db44fdd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[1].json new file mode 100644 index 000000000000..b66224f63225 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesoptionsinvalid033281ac445586435b4cd9?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" : "c24be365-6ba8-490e-8c8e-b8f54105c9b7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735601C48A985\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fb729-801e-001f-2c48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:39 GMT", + "x-ms-client-request-id" : "c24be365-6ba8-490e-8c8e-b8f54105c9b7" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcretriesoptionsinvalid&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" : "d32344f3-97d1-4a9b-8db1-2a0e9ae80d9c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fb73c-801e-001f-3b48-673bbb000000", + "Body" : "jtcretriesoptionsinvalidjtcretriesoptionsinvalid033281ac445586435b4cd9Mon, 09 Sep 2019 19:58:40 GMT\"0x8D735601C48A985\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:39 GMT", + "x-ms-client-request-id" : "d32344f3-97d1-4a9b-8db1-2a0e9ae80d9c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesoptionsinvalid033281ac445586435b4cd9?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" : "eb30fa18-a9d8-41ca-bd8c-4da4b06e8b9b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fb749-801e-001f-4848-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:40 GMT", + "x-ms-client-request-id" : "eb30fa18-a9d8-41ca-bd8c-4da4b06e8b9b" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesoptionsinvalid033281ac445586435b4cd9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[2].json new file mode 100644 index 000000000000..c515aedb0855 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesoptionsinvalid079979bb8569a470824cac?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" : "9a2c1dba-4ffa-4d87-9028-7713a9c9e204" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735601C70F96D\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fb754-801e-001f-5248-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:40 GMT", + "x-ms-client-request-id" : "9a2c1dba-4ffa-4d87-9028-7713a9c9e204" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcretriesoptionsinvalid&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" : "4c1110d2-2d7e-49c2-8e9d-9df20522417d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fb760-801e-001f-5d48-673bbb000000", + "Body" : "jtcretriesoptionsinvalidjtcretriesoptionsinvalid079979bb8569a470824cacMon, 09 Sep 2019 19:58:40 GMT\"0x8D735601C70F96D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:40 GMT", + "x-ms-client-request-id" : "4c1110d2-2d7e-49c2-8e9d-9df20522417d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesoptionsinvalid079979bb8569a470824cac?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" : "0c414c1d-4f4c-4143-92b9-9bd1d7c13085" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fb764-801e-001f-6148-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:40 GMT", + "x-ms-client-request-id" : "0c414c1d-4f4c-4143-92b9-9bd1d7c13085" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesoptionsinvalid079979bb8569a470824cac" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[3].json new file mode 100644 index 000000000000..76bc35a519db --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[3].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesoptionsinvalid09345148226581ef044fa5?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" : "bb4a6fb4-ba26-4477-a191-05148760c185" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735601C97C273\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:40 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fb76a-801e-001f-6748-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:40 GMT", + "x-ms-client-request-id" : "bb4a6fb4-ba26-4477-a191-05148760c185" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcretriesoptionsinvalid&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" : "5411ca44-28fb-42ff-9feb-86085ca1a95f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fb775-801e-001f-7148-673bbb000000", + "Body" : "jtcretriesoptionsinvalidjtcretriesoptionsinvalid09345148226581ef044fa5Mon, 09 Sep 2019 19:58:40 GMT\"0x8D735601C97C273\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:40 GMT", + "x-ms-client-request-id" : "5411ca44-28fb-42ff-9feb-86085ca1a95f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesoptionsinvalid09345148226581ef044fa5?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" : "d569a911-a6e2-4db1-b776-56a6641a6e98" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fb782-801e-001f-7d48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:40 GMT", + "x-ms-client-request-id" : "d569a911-a6e2-4db1-b776-56a6641a6e98" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesoptionsinvalid09345148226581ef044fa5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[4].json new file mode 100644 index 000000000000..6911f47c087a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[4].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesoptionsinvalid0833164474475eabe04986?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" : "0be308a0-7f35-491d-8813-50332d8fcbfa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735601CBE3D41\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fb791-801e-001f-0b48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:40 GMT", + "x-ms-client-request-id" : "0be308a0-7f35-491d-8813-50332d8fcbfa" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcretriesoptionsinvalid&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" : "c5ab49d3-706f-452a-922d-7f024c410fa8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fb79f-801e-001f-1848-673bbb000000", + "Body" : "jtcretriesoptionsinvalidjtcretriesoptionsinvalid0833164474475eabe04986Mon, 09 Sep 2019 19:58:41 GMT\"0x8D735601CBE3D41\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:40 GMT", + "x-ms-client-request-id" : "c5ab49d3-706f-452a-922d-7f024c410fa8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesoptionsinvalid0833164474475eabe04986?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" : "023a77d6-0766-496d-906d-2c52d0101674" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fb7b7-801e-001f-2b48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:40 GMT", + "x-ms-client-request-id" : "023a77d6-0766-496d-906d-2c52d0101674" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesoptionsinvalid0833164474475eabe04986" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[5].json new file mode 100644 index 000000000000..446659fb8442 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[5].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesoptionsinvalid0212321c0aff7f18534ee7?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" : "76bfcb88-cefe-4912-973f-0cd054c22442" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735601CE5F0CD\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fb7c4-801e-001f-3748-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:40 GMT", + "x-ms-client-request-id" : "76bfcb88-cefe-4912-973f-0cd054c22442" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcretriesoptionsinvalid&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" : "a0a0accc-3e15-42b8-b91c-210aa7fa38e6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fb7ce-801e-001f-3f48-673bbb000000", + "Body" : "jtcretriesoptionsinvalidjtcretriesoptionsinvalid0212321c0aff7f18534ee7Mon, 09 Sep 2019 19:58:41 GMT\"0x8D735601CE5F0CD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:41 GMT", + "x-ms-client-request-id" : "a0a0accc-3e15-42b8-b91c-210aa7fa38e6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesoptionsinvalid0212321c0aff7f18534ee7?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" : "39bc8e7e-b086-4480-9bca-9c2250716e0c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fb7e1-801e-001f-4f48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:41 GMT", + "x-ms-client-request-id" : "39bc8e7e-b086-4480-9bca-9c2250716e0c" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesoptionsinvalid0212321c0aff7f18534ee7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[6].json new file mode 100644 index 000000000000..73e5511eef70 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesoptionsinvalid[6].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesoptionsinvalid09694360e10a6c9f314fcc?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" : "ef593b03-c938-410f-90b7-7ed2e8025ecf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735601D13BFF8\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:41 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fb7f5-801e-001f-6348-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:41 GMT", + "x-ms-client-request-id" : "ef593b03-c938-410f-90b7-7ed2e8025ecf" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcretriesoptionsinvalid&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" : "79b8449c-9d0d-4c7a-88f8-79a5bd4926cb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fb800-801e-001f-6d48-673bbb000000", + "Body" : "jtcretriesoptionsinvalidjtcretriesoptionsinvalid09694360e10a6c9f314fccMon, 09 Sep 2019 19:58:41 GMT\"0x8D735601D13BFF8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:41 GMT", + "x-ms-client-request-id" : "79b8449c-9d0d-4c7a-88f8-79a5bd4926cb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesoptionsinvalid09694360e10a6c9f314fcc?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" : "de680418-72e4-4ebd-8757-688c9b2358d6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fb816-801e-001f-0148-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:41 GMT", + "x-ms-client-request-id" : "de680418-72e4-4ebd-8757-688c9b2358d6" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesoptionsinvalid09694360e10a6c9f314fcc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriestrytimeout.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriestrytimeout.json new file mode 100644 index 000000000000..a944bf6b3e32 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriestrytimeout.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriestrytimeout0retrytestretriestrytimeout6c372260f70d?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" : "7a7e7995-4aca-46d4-a185-f61d9f7e6be9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735600D137E49\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077f9eed-801e-001f-6248-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:14 GMT", + "x-ms-client-request-id" : "7a7e7995-4aca-46d4-a185-f61d9f7e6be9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcretriestrytimeout&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" : "cb25330e-0b2e-4356-ab58-ed10dd925767" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fa791-801e-001f-1d48-673bbb000000", + "Body" : "jtcretriestrytimeoutjtcretriestrytimeout0retrytestretriestrytimeout6c372260f70dMon, 09 Sep 2019 19:58:14 GMT\"0x8D735600D137E49\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:21 GMT", + "x-ms-client-request-id" : "cb25330e-0b2e-4356-ab58-ed10dd925767", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriestrytimeout0retrytestretriestrytimeout6c372260f70d?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" : "7322afe5-dd2f-485b-aff8-5a4684523aaa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fa7ce-801e-001f-5a48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:21 GMT", + "x-ms-client-request-id" : "7322afe5-dd2f-485b-aff8-5a4684523aaa" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriestrytimeout0retrytestretriestrytimeout6c372260f70d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesuntilmaxretries.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesuntilmaxretries.json new file mode 100644 index 000000000000..49b0f83e7dcd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesuntilmaxretries.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesuntilmaxretries063224d77f98b5f0c3450b?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" : "1106b07f-2e91-4e59-9f6d-8558f505e4b1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560064D76A6\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077f9672-801e-001f-1f48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:03 GMT", + "x-ms-client-request-id" : "1106b07f-2e91-4e59-9f6d-8558f505e4b1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcretriesuntilmaxretries&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" : "f0ace21a-36b8-4312-8b67-5944a25b2c5a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077f9b8a-801e-001f-4948-673bbb000000", + "Body" : "jtcretriesuntilmaxretriesjtcretriesuntilmaxretries063224d77f98b5f0c3450bMon, 09 Sep 2019 19:58:03 GMT\"0x8D73560064D76A6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:09 GMT", + "x-ms-client-request-id" : "f0ace21a-36b8-4312-8b67-5944a25b2c5a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesuntilmaxretries063224d77f98b5f0c3450b?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" : "07ede6ca-3d5c-497d-96a7-f373c976905d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077f9b96-801e-001f-5548-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:10 GMT", + "x-ms-client-request-id" : "07ede6ca-3d5c-497d-96a7-f373c976905d" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesuntilmaxretries063224d77f98b5f0c3450b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesuntilsuccess.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesuntilsuccess.json new file mode 100644 index 000000000000..ef878e256506 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/RetryTestretriesuntilsuccess.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesuntilsuccess0retrytestretriesuntilsuccessd2d91485b3?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" : "4ed0e8ce-6176-40fd-829b-5fd659a89e20" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7355FFFEBC179\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:57:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077f8ef1-801e-001f-4c48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:57:52 GMT", + "x-ms-client-request-id" : "4ed0e8ce-6176-40fd-829b-5fd659a89e20" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcretriesuntilsuccess&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" : "fd5cf746-bb2a-4557-8545-bfd2f765cce2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077f9646-801e-001f-7748-673bbb000000", + "Body" : "jtcretriesuntilsuccessjtcretriesuntilsuccess0retrytestretriesuntilsuccessd2d91485b3Mon, 09 Sep 2019 19:57:52 GMT\"0x8D7355FFFEBC179\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:02 GMT", + "x-ms-client-request-id" : "fd5cf746-bb2a-4557-8545-bfd2f765cce2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcretriesuntilsuccess0retrytestretriesuntilsuccessd2d91485b3?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" : "cc7d24fa-45b8-4191-aca5-bc46ab006c21" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077f965e-801e-001f-0d48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:02 GMT", + "x-ms-client-request-id" : "cc7d24fa-45b8-4191-aca5-bc46ab006c21" + }, + "Exception" : null + } ], + "variables" : [ "jtcretriesuntilsuccess0retrytestretriesuntilsuccessd2d91485b3" ] +} \ No newline at end of file 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 new file mode 100644 index 000000000000..cd2a35d5b50b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworkcreatecontainerfails.json @@ -0,0 +1,87 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworkcreatecontainerfails0864650c46ca24?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" + }, + "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", + "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" + }, + "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", + "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" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthorizationPermissionMismatch", + "retry-after" : "0", + "Content-Length" : "279", + "StatusCode" : "403", + "x-ms-request-id" : "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", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.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" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "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", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworkcreatecontainerfails0864650c46ca24?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" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fbc31-801e-001f-3a48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:47 GMT", + "x-ms-client-request-id" : "fc012f87-629b-4d36-88e0-62a1f4ad6ce4" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasnetworkcreatecontainerfails0864650c46ca24", "2019-09-09T19:58:48.051Z", "jtcaccountsasnetworkcreatecontainerfails1415220094cb8e" ] +} \ 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 new file mode 100644 index 000000000000..5067a7cc973e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworkcreatecontainersucceeds.json @@ -0,0 +1,105 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworkcreatecontainersucceeds085024a04341c?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" + }, + "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", + "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" + }, + "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", + "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" + }, + "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", + "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" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.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" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "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", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworkcreatecontainersucceeds085024a04341c?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" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fbc6c-801e-001f-6c48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:48 GMT", + "x-ms-client-request-id" : "e27a57d6-2083-4e31-b155-60e394aca5e4" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworkcreatecontainersucceeds181802151c1ac?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" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fbc7b-801e-001f-7b48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:48 GMT", + "x-ms-client-request-id" : "7cc59a12-4e74-45fe-9814-b91449b702b8" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasnetworkcreatecontainersucceeds085024a04341c", "2019-09-09T19:58:48.400Z", "jtcaccountsasnetworkcreatecontainersucceeds181802151c1ac" ] +} \ 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 new file mode 100644 index 000000000000..0ffc5cabecad --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworktestblobdeletefails.json @@ -0,0 +1,112 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworktestblobdeletefails0523992ab2f48e1?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" + }, + "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", + "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" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworktestblobdeletefails0523992ab2f48e1/javablobaccountsasnetworktestblobdeletefails1483136b9f2e", + "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", + "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", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:58:47 GMT", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "ETag" : "\"0x8D73560209B4254\"", + "Content-Length" : "0", + "x-ms-request-id" : "077fbbd3-801e-001f-6548-673bbb000000", + "x-ms-client-request-id" : "e4263362-dccc-417a-a0e4-4f53ee26316c" + }, + "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", + "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" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthorizationPermissionMismatch", + "retry-after" : "0", + "Content-Length" : "279", + "StatusCode" : "403", + "x-ms-request-id" : "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", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.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" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "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", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworktestblobdeletefails0523992ab2f48e1?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" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fbbf2-801e-001f-0248-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:47 GMT", + "x-ms-client-request-id" : "2a3fbc62-d10d-46b8-ae82-1eb672233ab8" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasnetworktestblobdeletefails0523992ab2f48e1", "javablobaccountsasnetworktestblobdeletefails1483136b9f2e", "2019-09-09T19:58:47.719Z" ] +} \ 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 new file mode 100644 index 000000000000..0d026afe8d26 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasnetworktestblobread.json @@ -0,0 +1,121 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworktestblobread005273c382c5ea5e3e?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" + }, + "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", + "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" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworktestblobread005273c382c5ea5e3e/javablobaccountsasnetworktestblobread1409227176455fc4", + "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", + "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", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:58:46 GMT", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "ETag" : "\"0x8D73560205356AA\"", + "Content-Length" : "0", + "x-ms-request-id" : "077fbb83-801e-001f-1f48-673bbb000000", + "x-ms-client-request-id" : "67df9187-5eb7-4ced-91b3-db67cdd23ada" + }, + "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", + "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" + }, + "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", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:58:46 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", + "Content-Length" : "4", + "x-ms-request-id" : "077fbb96-801e-001f-2e48-673bbb000000", + "Body" : "[116, 101, 115, 116]", + "x-ms-client-request-id" : "baac3248-df60-4582-a68a-245b3df13b68", + "Content-Type" : "application/octet-stream" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.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" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "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", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasnetworktestblobread005273c382c5ea5e3e?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" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fbbbc-801e-001f-5148-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:46 GMT", + "x-ms-client-request-id" : "ba0f3769-961a-424e-b0e0-076369b375b5" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasnetworktestblobread005273c382c5ea5e3e", "javablobaccountsasnetworktestblobread1409227176455fc4", "2019-09-09T19:58:47.285Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[0].json new file mode 100644 index 000000000000..7204eed2e93a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse054315728b57d7d27d49?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" : "b3a222ac-eedd-4e66-b69b-9844ced6788c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602F5F2053\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd265-801e-001f-1149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:11 GMT", + "x-ms-client-request-id" : "b3a222ac-eedd-4e66-b69b-9844ced6788c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&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" : "eb2929a3-626a-469b-ad95-862c91465cd2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd275-801e-001f-2049-673bbb000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse054315728b57d7d27d49Mon, 09 Sep 2019 19:59:12 GMT\"0x8D735602F5F2053\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:11 GMT", + "x-ms-client-request-id" : "eb2929a3-626a-469b-ad95-862c91465cd2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse054315728b57d7d27d49?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" : "fdc7bee7-0bc8-4a22-b0c2-6fc08d74c5c7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd283-801e-001f-2c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:12 GMT", + "x-ms-client-request-id" : "fdc7bee7-0bc8-4a22-b0c2-6fc08d74c5c7" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse054315728b57d7d27d49" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[1].json new file mode 100644 index 000000000000..b83f366a4074 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse052609a9468a94ca5d4f?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" : "cc36173f-d2c8-47f5-8632-145618601760" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602F863787\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd299-801e-001f-4149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:12 GMT", + "x-ms-client-request-id" : "cc36173f-d2c8-47f5-8632-145618601760" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&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" : "e2ff53c6-4440-4936-a138-08de236cda50" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd2b1-801e-001f-5349-673bbb000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse052609a9468a94ca5d4fMon, 09 Sep 2019 19:59:12 GMT\"0x8D735602F863787\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:12 GMT", + "x-ms-client-request-id" : "e2ff53c6-4440-4936-a138-08de236cda50", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse052609a9468a94ca5d4f?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" : "66971899-7e13-4e8c-931b-82a7698bee2a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd2c6-801e-001f-6849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:12 GMT", + "x-ms-client-request-id" : "66971899-7e13-4e8c-931b-82a7698bee2a" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse052609a9468a94ca5d4f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[2].json new file mode 100644 index 000000000000..bf683d1713af --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse082834202edf73e98849?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" : "d8d8be8c-bf04-4e89-890c-b465fc944f65" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602FAD279D\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd2d2-801e-001f-7349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:12 GMT", + "x-ms-client-request-id" : "d8d8be8c-bf04-4e89-890c-b465fc944f65" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&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" : "0a9e8b6d-12e3-4244-8270-ff6ada7098fa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd2e1-801e-001f-7f49-673bbb000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse082834202edf73e98849Mon, 09 Sep 2019 19:59:12 GMT\"0x8D735602FAD279D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:12 GMT", + "x-ms-client-request-id" : "0a9e8b6d-12e3-4244-8270-ff6ada7098fa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse082834202edf73e98849?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" : "edfb4dfa-09cb-481f-800c-052c44a8b737" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd2f1-801e-001f-0e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:12 GMT", + "x-ms-client-request-id" : "edfb4dfa-09cb-481f-800c-052c44a8b737" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse082834202edf73e98849" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[3].json new file mode 100644 index 000000000000..5ccdcdf18357 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[3].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse031790394fe2765ebf4b?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" : "d3b7b195-6fa0-486b-a50a-3f9b81f14c5f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602FD4B40F\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd303-801e-001f-2049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:12 GMT", + "x-ms-client-request-id" : "d3b7b195-6fa0-486b-a50a-3f9b81f14c5f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&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" : "8af665e8-9b9d-4f2e-8c87-675e45f90fb7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd310-801e-001f-2b49-673bbb000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse031790394fe2765ebf4bMon, 09 Sep 2019 19:59:13 GMT\"0x8D735602FD4B40F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:12 GMT", + "x-ms-client-request-id" : "8af665e8-9b9d-4f2e-8c87-675e45f90fb7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse031790394fe2765ebf4b?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" : "5c5a7dd0-4e4e-41d1-aa76-4925b42f051c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd320-801e-001f-3b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:12 GMT", + "x-ms-client-request-id" : "5c5a7dd0-4e4e-41d1-aa76-4925b42f051c" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse031790394fe2765ebf4b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[4].json new file mode 100644 index 000000000000..0b77c20b191f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[4].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse038136379863cb862f4e?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" : "70682857-8eb4-482f-ba68-7a91f5092a2b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602FFA445B\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd32c-801e-001f-4749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:12 GMT", + "x-ms-client-request-id" : "70682857-8eb4-482f-ba68-7a91f5092a2b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&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" : "560923ef-027c-45c0-9907-12b62f6e5f0c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd33f-801e-001f-5849-673bbb000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse038136379863cb862f4eMon, 09 Sep 2019 19:59:13 GMT\"0x8D735602FFA445B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:12 GMT", + "x-ms-client-request-id" : "560923ef-027c-45c0-9907-12b62f6e5f0c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse038136379863cb862f4e?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" : "7a69b247-52d6-4c5d-b6ef-2d86c356f110" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd353-801e-001f-6c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:13 GMT", + "x-ms-client-request-id" : "7a69b247-52d6-4c5d-b6ef-2d86c356f110" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse038136379863cb862f4e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[5].json new file mode 100644 index 000000000000..c32fe9924b5e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[5].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse0958012f74c8c2f4de42?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" : "1a5a48e2-1c89-476e-9d55-ab61e24b8e80" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356030224616\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd35e-801e-001f-7649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:13 GMT", + "x-ms-client-request-id" : "1a5a48e2-1c89-476e-9d55-ab61e24b8e80" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&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" : "f8461193-a457-4801-a267-af40be6bff72" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd371-801e-001f-0749-673bbb000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse0958012f74c8c2f4de42Mon, 09 Sep 2019 19:59:13 GMT\"0x8D7356030224616\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:13 GMT", + "x-ms-client-request-id" : "f8461193-a457-4801-a267-af40be6bff72", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse0958012f74c8c2f4de42?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" : "3d4a6878-e885-4f1b-9849-40bb90bfe693" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd385-801e-001f-1749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:13 GMT", + "x-ms-client-request-id" : "3d4a6878-e885-4f1b-9849-40bb90bfe693" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse0958012f74c8c2f4de42" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[6].json new file mode 100644 index 000000000000..85e4d2ac84e0 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[6].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse074418a82f5feecc364c?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" : "38ca545b-a89f-4501-bab9-36347285a9b0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603048248C\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd394-801e-001f-2549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:13 GMT", + "x-ms-client-request-id" : "38ca545b-a89f-4501-bab9-36347285a9b0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&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" : "4fbc5f1e-4cbf-4e70-a028-eb4b84b9851e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd3a9-801e-001f-3749-673bbb000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse074418a82f5feecc364cMon, 09 Sep 2019 19:59:13 GMT\"0x8D735603048248C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:13 GMT", + "x-ms-client-request-id" : "4fbc5f1e-4cbf-4e70-a028-eb4b84b9851e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse074418a82f5feecc364c?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" : "d27c6a30-ad2a-4bc0-ad98-154a829e4216" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd3b6-801e-001f-4349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:13 GMT", + "x-ms-client-request-id" : "d27c6a30-ad2a-4bc0-ad98-154a829e4216" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse074418a82f5feecc364c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[7].json new file mode 100644 index 000000000000..b575dfdc3e4d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[7].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse0495537c91197ad3f04d?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" : "9ee11d99-4816-4b49-af52-8219ff14dd5d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560306F14AF\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd3c5-801e-001f-5249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:13 GMT", + "x-ms-client-request-id" : "9ee11d99-4816-4b49-af52-8219ff14dd5d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&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" : "07938a44-5a46-45fe-9f6b-21be55b4bb99" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd3d8-801e-001f-6149-673bbb000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse0495537c91197ad3f04dMon, 09 Sep 2019 19:59:14 GMT\"0x8D73560306F14AF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:13 GMT", + "x-ms-client-request-id" : "07938a44-5a46-45fe-9f6b-21be55b4bb99", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse0495537c91197ad3f04d?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" : "6fff0579-578d-4bc5-a769-f25ce87256f0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd3f1-801e-001f-7849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:13 GMT", + "x-ms-client-request-id" : "6fff0579-578d-4bc5-a769-f25ce87256f0" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse0495537c91197ad3f04d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[8].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[8].json new file mode 100644 index 000000000000..92e6731e4f0a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[8].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse0512002283b18f1cd74b?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" : "ce6e47fd-aa2b-45bc-94c1-123fb1f0b7b6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603094F317\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd404-801e-001f-0949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:13 GMT", + "x-ms-client-request-id" : "ce6e47fd-aa2b-45bc-94c1-123fb1f0b7b6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&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" : "d65ca251-903d-4303-8d50-456ebbdcd675" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd410-801e-001f-1449-673bbb000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse0512002283b18f1cd74bMon, 09 Sep 2019 19:59:14 GMT\"0x8D735603094F317\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:13 GMT", + "x-ms-client-request-id" : "d65ca251-903d-4303-8d50-456ebbdcd675", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse0512002283b18f1cd74b?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" : "4c7fa0bb-d8d9-478e-b206-425176937112" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd421-801e-001f-2549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:14 GMT", + "x-ms-client-request-id" : "4c7fa0bb-d8d9-478e-b206-425176937112" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse0512002283b18f1cd74b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[9].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[9].json new file mode 100644 index 000000000000..b5783ea56e30 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparse[9].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse000945ff3d2502a9d84d?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" : "9c4454c4-d7fa-423e-9358-3427e8bfeee3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356030BCCDC6\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd435-801e-001f-3949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:14 GMT", + "x-ms-client-request-id" : "9c4454c4-d7fa-423e-9358-3427e8bfeee3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionsparse&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" : "ca9077ee-a715-4d6f-b2e8-23b97c334fb5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd449-801e-001f-4b49-673bbb000000", + "Body" : "jtcaccountsaspermissionsparsejtcaccountsaspermissionsparse000945ff3d2502a9d84dMon, 09 Sep 2019 19:59:14 GMT\"0x8D7356030BCCDC6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:14 GMT", + "x-ms-client-request-id" : "ca9077ee-a715-4d6f-b2e8-23b97c334fb5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparse000945ff3d2502a9d84d?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" : "f7cdb351-bd29-4d97-bb34-31097bdaeb43" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd45d-801e-001f-5e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:14 GMT", + "x-ms-client-request-id" : "f7cdb351-bd29-4d97-bb34-31097bdaeb43" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparse000945ff3d2502a9d84d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparseia.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparseia.json new file mode 100644 index 000000000000..3c4cc1465248 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionsparseia.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparseia06246339ec7a08b3cc4?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" : "61fd16c7-dc15-408e-8318-f86431baa411" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356030E3E4DB\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd473-801e-001f-7249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:14 GMT", + "x-ms-client-request-id" : "61fd16c7-dc15-408e-8318-f86431baa411" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionsparseia&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" : "05f3e189-17af-4ee1-b5d1-8b6f20a2eed3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd47f-801e-001f-7d49-673bbb000000", + "Body" : "jtcaccountsaspermissionsparseiajtcaccountsaspermissionsparseia06246339ec7a08b3cc4Mon, 09 Sep 2019 19:59:14 GMT\"0x8D7356030E3E4DB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:14 GMT", + "x-ms-client-request-id" : "05f3e189-17af-4ee1-b5d1-8b6f20a2eed3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionsparseia06246339ec7a08b3cc4?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" : "58ac1495-9f4b-4303-b83e-b30be83cd21e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd49b-801e-001f-1649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:14 GMT", + "x-ms-client-request-id" : "58ac1495-9f4b-4303-b83e-b30be83cd21e" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionsparseia06246339ec7a08b3cc4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[0].json new file mode 100644 index 000000000000..0e9b7b78ba50 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring05804163b75627225f?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" : "29095c67-4b36-4284-81cd-d784b2286e39" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602DFF4FED\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd048-801e-001f-2b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:09 GMT", + "x-ms-client-request-id" : "29095c67-4b36-4284-81cd-d784b2286e39" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&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" : "408ea261-37ae-40ef-96b9-325ae357e53d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd05b-801e-001f-3b49-673bbb000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring05804163b75627225fMon, 09 Sep 2019 19:59:10 GMT\"0x8D735602DFF4FED\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:09 GMT", + "x-ms-client-request-id" : "408ea261-37ae-40ef-96b9-325ae357e53d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring05804163b75627225f?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" : "b7b68e25-c239-4ff9-aa68-87d7bf149b2f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd066-801e-001f-4649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:09 GMT", + "x-ms-client-request-id" : "b7b68e25-c239-4ff9-aa68-87d7bf149b2f" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring05804163b75627225f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[1].json new file mode 100644 index 000000000000..aefd37a9cfd6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring0637180fecedfd4895?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" : "32c94ac3-87b1-4ba6-b764-7ea655975802" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602E279FD6\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd077-801e-001f-5249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:09 GMT", + "x-ms-client-request-id" : "32c94ac3-87b1-4ba6-b764-7ea655975802" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&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" : "3d1b7bc6-1ba7-4975-aa76-89b36400f504" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd096-801e-001f-6a49-673bbb000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring0637180fecedfd4895Mon, 09 Sep 2019 19:59:10 GMT\"0x8D735602E279FD6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:09 GMT", + "x-ms-client-request-id" : "3d1b7bc6-1ba7-4975-aa76-89b36400f504", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring0637180fecedfd4895?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" : "d3162842-9516-4c4e-ae9b-ac3eb59a134c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd0a5-801e-001f-7849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:09 GMT", + "x-ms-client-request-id" : "d3162842-9516-4c4e-ae9b-ac3eb59a134c" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring0637180fecedfd4895" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[2].json new file mode 100644 index 000000000000..b359ecbf825d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring050868675d600a4094?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" : "9ac0426f-12cd-46ee-aad8-23d4a3e86977" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602E4F5366\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd0bb-801e-001f-0949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:10 GMT", + "x-ms-client-request-id" : "9ac0426f-12cd-46ee-aad8-23d4a3e86977" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&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" : "53f275a9-514e-4963-8676-b37b9558f3cf" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd0cc-801e-001f-1949-673bbb000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring050868675d600a4094Mon, 09 Sep 2019 19:59:10 GMT\"0x8D735602E4F5366\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:10 GMT", + "x-ms-client-request-id" : "53f275a9-514e-4963-8676-b37b9558f3cf", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring050868675d600a4094?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" : "e71b14d1-27f9-48c7-88d1-2dffa22066ca" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd0d7-801e-001f-2349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:10 GMT", + "x-ms-client-request-id" : "e71b14d1-27f9-48c7-88d1-2dffa22066ca" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring050868675d600a4094" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[3].json new file mode 100644 index 000000000000..95258551a5eb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[3].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring000281bd1b0156e541?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" : "6ece619a-ab2c-45ed-81d3-d0f05bc7e393" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602E7531D5\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:10 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd0e5-801e-001f-3049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:10 GMT", + "x-ms-client-request-id" : "6ece619a-ab2c-45ed-81d3-d0f05bc7e393" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&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" : "f0aed106-13bc-467e-b585-0bb1d2863406" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd0f1-801e-001f-3b49-673bbb000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring000281bd1b0156e541Mon, 09 Sep 2019 19:59:10 GMT\"0x8D735602E7531D5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:10 GMT", + "x-ms-client-request-id" : "f0aed106-13bc-467e-b585-0bb1d2863406", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring000281bd1b0156e541?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" : "777d1291-e2b8-4427-88cd-3ec8ec1f40f7" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd105-801e-001f-4c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:10 GMT", + "x-ms-client-request-id" : "777d1291-e2b8-4427-88cd-3ec8ec1f40f7" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring000281bd1b0156e541" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[4].json new file mode 100644 index 000000000000..02b3e46941e6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[4].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring074944c00cbabd79d0?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" : "cbaa427b-3e41-46a2-803a-f817661064a5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602E9C21DE\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd117-801e-001f-5c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:10 GMT", + "x-ms-client-request-id" : "cbaa427b-3e41-46a2-803a-f817661064a5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&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" : "cdc3eaa0-1cf7-42ab-9b81-6820cf027a94" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd125-801e-001f-6949-673bbb000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring074944c00cbabd79d0Mon, 09 Sep 2019 19:59:11 GMT\"0x8D735602E9C21DE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:10 GMT", + "x-ms-client-request-id" : "cdc3eaa0-1cf7-42ab-9b81-6820cf027a94", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring074944c00cbabd79d0?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" : "355cd6e9-dcd2-4856-901b-fcf8492f8be2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd144-801e-001f-0549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:10 GMT", + "x-ms-client-request-id" : "355cd6e9-dcd2-4856-901b-fcf8492f8be2" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring074944c00cbabd79d0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[5].json new file mode 100644 index 000000000000..340408e4283c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[5].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring003259c1bb8bc62067?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" : "a84de8a3-8ecd-4f80-9a0e-a9f03590508e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602EC3600C\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd175-801e-001f-3449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:10 GMT", + "x-ms-client-request-id" : "a84de8a3-8ecd-4f80-9a0e-a9f03590508e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&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" : "683160ae-8845-47c8-a2c3-0c4d95db1244" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd198-801e-001f-5649-673bbb000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring003259c1bb8bc62067Mon, 09 Sep 2019 19:59:11 GMT\"0x8D735602EC3600C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:10 GMT", + "x-ms-client-request-id" : "683160ae-8845-47c8-a2c3-0c4d95db1244", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring003259c1bb8bc62067?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" : "4b856961-b7e4-496b-b691-1dd79d408de1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd1a9-801e-001f-6549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:10 GMT", + "x-ms-client-request-id" : "4b856961-b7e4-496b-b691-1dd79d408de1" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring003259c1bb8bc62067" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[6].json new file mode 100644 index 000000000000..469a3c7d2d04 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[6].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring040303df83ba9ed2a9?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" : "75018507-1c96-4b64-9aca-5022c75eed7d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602EE9175D\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd1b8-801e-001f-7449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:11 GMT", + "x-ms-client-request-id" : "75018507-1c96-4b64-9aca-5022c75eed7d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&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" : "6c9b3170-5807-435d-a19c-fbb9f2579b3c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd1cc-801e-001f-0549-673bbb000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring040303df83ba9ed2a9Mon, 09 Sep 2019 19:59:11 GMT\"0x8D735602EE9175D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:11 GMT", + "x-ms-client-request-id" : "6c9b3170-5807-435d-a19c-fbb9f2579b3c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring040303df83ba9ed2a9?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" : "f18376d6-93c7-403f-9ab0-8607ad8564de" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd1d8-801e-001f-1149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:11 GMT", + "x-ms-client-request-id" : "f18376d6-93c7-403f-9ab0-8607ad8564de" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring040303df83ba9ed2a9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[7].json new file mode 100644 index 000000000000..caf787ca8a27 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[7].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring038977e975b9821ed6?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" : "0663a973-704a-496f-bf0d-ab28e8a0e0f1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602F116741\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:11 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd1e3-801e-001f-1c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:11 GMT", + "x-ms-client-request-id" : "0663a973-704a-496f-bf0d-ab28e8a0e0f1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&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" : "79bab020-39f1-4180-886d-3c36f2fc4500" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd1f3-801e-001f-2949-673bbb000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring038977e975b9821ed6Mon, 09 Sep 2019 19:59:11 GMT\"0x8D735602F116741\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:11 GMT", + "x-ms-client-request-id" : "79bab020-39f1-4180-886d-3c36f2fc4500", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring038977e975b9821ed6?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" : "1b7b7b7f-5a07-490f-a583-57f621ff1d7d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd200-801e-001f-3549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:11 GMT", + "x-ms-client-request-id" : "1b7b7b7f-5a07-490f-a583-57f621ff1d7d" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring038977e975b9821ed6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[8].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[8].json new file mode 100644 index 000000000000..e8f2b47a224e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsaspermissionstostring[8].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring027430ced8e21d57d9?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" : "365e5c08-9041-440d-ac08-369041b4183c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602F387E70\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd217-801e-001f-4849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:11 GMT", + "x-ms-client-request-id" : "365e5c08-9041-440d-ac08-369041b4183c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsaspermissionstostring&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" : "6b18cdcc-ba14-4a04-86f5-4fa9a71206d6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd240-801e-001f-6e49-673bbb000000", + "Body" : "jtcaccountsaspermissionstostringjtcaccountsaspermissionstostring027430ced8e21d57d9Mon, 09 Sep 2019 19:59:12 GMT\"0x8D735602F387E70\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:11 GMT", + "x-ms-client-request-id" : "6b18cdcc-ba14-4a04-86f5-4fa9a71206d6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsaspermissionstostring027430ced8e21d57d9?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" : "c65fc5ca-ab0f-4a26-952a-3300d6748ab9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd258-801e-001f-0449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:11 GMT", + "x-ms-client-request-id" : "c65fc5ca-ab0f-4a26-952a-3300d6748ab9" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsaspermissionstostring027430ced8e21d57d9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeia.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeia.json new file mode 100644 index 000000000000..e2a7bc687c9d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeia.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypeia0232899765aa82cd9a43b?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" : "21d6ba51-00e0-4fda-bf64-f596f5c1b622" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603240323F\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd66d-801e-001f-3c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:16 GMT", + "x-ms-client-request-id" : "21d6ba51-00e0-4fda-bf64-f596f5c1b622" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsasresourcetypeia&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" : "8ff4ea2a-215a-4f5e-8768-2feeb30a2009" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd67b-801e-001f-4749-673bbb000000", + "Body" : "jtcaccountsasresourcetypeiajtcaccountsasresourcetypeia0232899765aa82cd9a43bMon, 09 Sep 2019 19:59:17 GMT\"0x8D735603240323F\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:16 GMT", + "x-ms-client-request-id" : "8ff4ea2a-215a-4f5e-8768-2feeb30a2009", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypeia0232899765aa82cd9a43b?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" : "23b4cd20-e76b-45b2-882f-6476a7c7d1d9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd68d-801e-001f-5849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:16 GMT", + "x-ms-client-request-id" : "23b4cd20-e76b-45b2-882f-6476a7c7d1d9" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeia0232899765aa82cd9a43b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeparse[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeparse[0].json new file mode 100644 index 000000000000..8916102a75b8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeparse[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypeparse06414372ea32e017f84?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" : "2efd38ec-71ef-42e1-a67d-8be457bed969" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356031A61FDC\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd593-801e-001f-7449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:15 GMT", + "x-ms-client-request-id" : "2efd38ec-71ef-42e1-a67d-8be457bed969" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsasresourcetypeparse&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" : "577a4dad-c7c0-422b-a20c-da68496f6523" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd5b1-801e-001f-1149-673bbb000000", + "Body" : "jtcaccountsasresourcetypeparsejtcaccountsasresourcetypeparse06414372ea32e017f84Mon, 09 Sep 2019 19:59:16 GMT\"0x8D7356031A61FDC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:15 GMT", + "x-ms-client-request-id" : "577a4dad-c7c0-422b-a20c-da68496f6523", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypeparse06414372ea32e017f84?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" : "edb027f5-f98f-48dd-b2b5-3596fd39e613" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd5ce-801e-001f-2749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:15 GMT", + "x-ms-client-request-id" : "edb027f5-f98f-48dd-b2b5-3596fd39e613" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeparse06414372ea32e017f84" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeparse[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeparse[1].json new file mode 100644 index 000000000000..3fd878473e47 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeparse[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypeparse046517520058faef9c4?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" : "de643fe3-947e-4636-8d9a-a2d1265ec326" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356031CC4C89\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd5dc-801e-001f-3549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:15 GMT", + "x-ms-client-request-id" : "de643fe3-947e-4636-8d9a-a2d1265ec326" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsasresourcetypeparse&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" : "05e41ac5-6c2d-4d20-8484-eb9ceec66e75" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd5e8-801e-001f-4049-673bbb000000", + "Body" : "jtcaccountsasresourcetypeparsejtcaccountsasresourcetypeparse046517520058faef9c4Mon, 09 Sep 2019 19:59:16 GMT\"0x8D7356031CC4C89\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:15 GMT", + "x-ms-client-request-id" : "05e41ac5-6c2d-4d20-8484-eb9ceec66e75", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypeparse046517520058faef9c4?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" : "3f81d4de-eb8c-4c5a-a6be-36190da77f43" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd5fc-801e-001f-5349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:16 GMT", + "x-ms-client-request-id" : "3f81d4de-eb8c-4c5a-a6be-36190da77f43" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeparse046517520058faef9c4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeparse[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeparse[2].json new file mode 100644 index 000000000000..4aab63277fea --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeparse[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypeparse0288121c702e0da0174?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" : "580ce621-7f02-44c9-ba0f-ae3aacd52358" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356031F22AF1\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd608-801e-001f-5f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:16 GMT", + "x-ms-client-request-id" : "580ce621-7f02-44c9-ba0f-ae3aacd52358" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsasresourcetypeparse&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" : "a5703594-73d4-4f71-853e-917dfc34816b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd61c-801e-001f-7149-673bbb000000", + "Body" : "jtcaccountsasresourcetypeparsejtcaccountsasresourcetypeparse0288121c702e0da0174Mon, 09 Sep 2019 19:59:16 GMT\"0x8D7356031F22AF1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:16 GMT", + "x-ms-client-request-id" : "a5703594-73d4-4f71-853e-917dfc34816b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypeparse0288121c702e0da0174?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" : "1009e5b9-9280-4dea-bfe0-e7515d6d392d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd629-801e-001f-7e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:16 GMT", + "x-ms-client-request-id" : "1009e5b9-9280-4dea-bfe0-e7515d6d392d" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeparse0288121c702e0da0174" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeparse[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeparse[3].json new file mode 100644 index 000000000000..bc059791c6e8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypeparse[3].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypeparse04373262b42d9558e74?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" : "3a540c1a-e20d-457d-893e-1be3475686db" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356032185795\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:16 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd635-801e-001f-0a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:16 GMT", + "x-ms-client-request-id" : "3a540c1a-e20d-457d-893e-1be3475686db" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsasresourcetypeparse&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" : "5658b303-345a-434d-a145-de0bd74a485d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd646-801e-001f-1a49-673bbb000000", + "Body" : "jtcaccountsasresourcetypeparsejtcaccountsasresourcetypeparse04373262b42d9558e74Mon, 09 Sep 2019 19:59:16 GMT\"0x8D7356032185795\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:16 GMT", + "x-ms-client-request-id" : "5658b303-345a-434d-a145-de0bd74a485d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypeparse04373262b42d9558e74?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" : "e5ac3b9b-89f2-49c4-a928-b181fa4c0804" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd65d-801e-001f-2d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:16 GMT", + "x-ms-client-request-id" : "e5ac3b9b-89f2-49c4-a928-b181fa4c0804" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypeparse04373262b42d9558e74" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypetostring[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypetostring[0].json new file mode 100644 index 000000000000..411189af4525 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypetostring[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypetostring06027359d8466fd310?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" : "7b5d6665-0b71-4337-9efa-41f925a74435" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560310AFC06\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd4b1-801e-001f-2b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:14 GMT", + "x-ms-client-request-id" : "7b5d6665-0b71-4337-9efa-41f925a74435" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsasresourcetypetostring&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" : "f8b24456-3eda-408f-9af2-da08dc4dc143" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd4bd-801e-001f-3649-673bbb000000", + "Body" : "jtcaccountsasresourcetypetostringjtcaccountsasresourcetypetostring06027359d8466fd310Mon, 09 Sep 2019 19:59:15 GMT\"0x8D73560310AFC06\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:14 GMT", + "x-ms-client-request-id" : "f8b24456-3eda-408f-9af2-da08dc4dc143", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypetostring06027359d8466fd310?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" : "38400cd8-0862-4a11-bff2-ac399b41c1ef" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd4cc-801e-001f-4449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:14 GMT", + "x-ms-client-request-id" : "38400cd8-0862-4a11-bff2-ac399b41c1ef" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypetostring06027359d8466fd310" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypetostring[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypetostring[1].json new file mode 100644 index 000000000000..d6ac8bac0548 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypetostring[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypetostring0711861e8684032c25?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" : "16d2bef8-8027-4855-8a31-7a1a119c6bba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603130DA63\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd4d9-801e-001f-5149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:14 GMT", + "x-ms-client-request-id" : "16d2bef8-8027-4855-8a31-7a1a119c6bba" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsasresourcetypetostring&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" : "dd6dce98-99bd-4ce7-8cad-0d4cf232016b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd4e8-801e-001f-5d49-673bbb000000", + "Body" : "jtcaccountsasresourcetypetostringjtcaccountsasresourcetypetostring0711861e8684032c25Mon, 09 Sep 2019 19:59:15 GMT\"0x8D735603130DA63\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:14 GMT", + "x-ms-client-request-id" : "dd6dce98-99bd-4ce7-8cad-0d4cf232016b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypetostring0711861e8684032c25?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" : "91d7a1dd-e179-4603-b6d7-26b9d15f64b3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd505-801e-001f-7749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:15 GMT", + "x-ms-client-request-id" : "91d7a1dd-e179-4603-b6d7-26b9d15f64b3" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypetostring0711861e8684032c25" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypetostring[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypetostring[2].json new file mode 100644 index 000000000000..ee6c05324b35 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypetostring[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypetostring0807747e3eb4e397fe?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" : "e6e75ddb-6be6-44b4-9a51-5a41278fc2ab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603156DFE1\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd518-801e-001f-0849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:15 GMT", + "x-ms-client-request-id" : "e6e75ddb-6be6-44b4-9a51-5a41278fc2ab" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsasresourcetypetostring&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" : "9a60f4ef-5bc8-4cce-93cb-174acd8d2f64" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd528-801e-001f-1649-673bbb000000", + "Body" : "jtcaccountsasresourcetypetostringjtcaccountsasresourcetypetostring0807747e3eb4e397feMon, 09 Sep 2019 19:59:15 GMT\"0x8D735603156DFE1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:15 GMT", + "x-ms-client-request-id" : "9a60f4ef-5bc8-4cce-93cb-174acd8d2f64", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypetostring0807747e3eb4e397fe?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" : "91f2b769-344a-4995-ba4c-2b169aa3c7c9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd53e-801e-001f-2a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:15 GMT", + "x-ms-client-request-id" : "91f2b769-344a-4995-ba4c-2b169aa3c7c9" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypetostring0807747e3eb4e397fe" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypetostring[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypetostring[3].json new file mode 100644 index 000000000000..2c1fcfc5ab22 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsasresourcetypetostring[3].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypetostring078369ba4a23716305?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" : "415e5667-a7f9-4595-bd14-f468b7deaa57" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560317EBA7E\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:15 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd54d-801e-001f-3749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:15 GMT", + "x-ms-client-request-id" : "415e5667-a7f9-4595-bd14-f468b7deaa57" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsasresourcetypetostring&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" : "3426d149-91bc-4965-b29c-4e64c4ca9b8a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd55a-801e-001f-4349-673bbb000000", + "Body" : "jtcaccountsasresourcetypetostringjtcaccountsasresourcetypetostring078369ba4a23716305Mon, 09 Sep 2019 19:59:15 GMT\"0x8D73560317EBA7E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:15 GMT", + "x-ms-client-request-id" : "3426d149-91bc-4965-b29c-4e64c4ca9b8a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsasresourcetypetostring078369ba4a23716305?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" : "5794297f-26e0-4269-a92b-cb5dbb2775ae" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd566-801e-001f-4d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:15 GMT", + "x-ms-client-request-id" : "5794297f-26e0-4269-a92b-cb5dbb2775ae" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsasresourcetypetostring078369ba4a23716305" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturesstringtosign[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturesstringtosign[0].json new file mode 100644 index 000000000000..55d33d91d679 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturesstringtosign[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturesstringtosign0933907ed3f4e9312?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" : "a48e0d45-92f2-48de-b4d3-de0112a263a4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602C9D5C45\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fce84-801e-001f-1549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:07 GMT", + "x-ms-client-request-id" : "a48e0d45-92f2-48de-b4d3-de0112a263a4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsassignaturesstringtosign&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" : "a6d7580f-5b1c-4456-876e-2169e5f02c9b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fce90-801e-001f-1e49-673bbb000000", + "Body" : "jtcaccountsassignaturesstringtosignjtcaccountsassignaturesstringtosign0933907ed3f4e9312Mon, 09 Sep 2019 19:59:07 GMT\"0x8D735602C9D5C45\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:07 GMT", + "x-ms-client-request-id" : "a6d7580f-5b1c-4456-876e-2169e5f02c9b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturesstringtosign0933907ed3f4e9312?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" : "02d5355d-8a8a-412e-beb6-b7d43873966d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fcea0-801e-001f-2e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:07 GMT", + "x-ms-client-request-id" : "02d5355d-8a8a-412e-beb6-b7d43873966d" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturesstringtosign0933907ed3f4e9312" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturesstringtosign[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturesstringtosign[1].json new file mode 100644 index 000000000000..a43c5de2e8f5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturesstringtosign[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturesstringtosign004341cc83758aaa9?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" : "2e774ead-9b3d-48b8-a262-2e6b2a479565" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602CC536D0\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fceb3-801e-001f-4049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:07 GMT", + "x-ms-client-request-id" : "2e774ead-9b3d-48b8-a262-2e6b2a479565" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsassignaturesstringtosign&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" : "2576bb63-917b-4603-9989-0835aa065545" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fcec7-801e-001f-5249-673bbb000000", + "Body" : "jtcaccountsassignaturesstringtosignjtcaccountsassignaturesstringtosign004341cc83758aaa9Mon, 09 Sep 2019 19:59:08 GMT\"0x8D735602CC536D0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:07 GMT", + "x-ms-client-request-id" : "2576bb63-917b-4603-9989-0835aa065545", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturesstringtosign004341cc83758aaa9?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" : "31c5b809-56e2-43fa-95e1-e08cd974c51a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fced7-801e-001f-6049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:07 GMT", + "x-ms-client-request-id" : "31c5b809-56e2-43fa-95e1-e08cd974c51a" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturesstringtosign004341cc83758aaa9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturesstringtosign[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturesstringtosign[2].json new file mode 100644 index 000000000000..9876c5ff33a7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturesstringtosign[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturesstringtosign079788ce2a7221e9a?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" : "2c0a1446-1bc1-4cc3-89c2-29737fc32b3c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602CEC750C\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fcefe-801e-001f-7f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:07 GMT", + "x-ms-client-request-id" : "2c0a1446-1bc1-4cc3-89c2-29737fc32b3c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsassignaturesstringtosign&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" : "ee2c08d9-9c73-4508-904c-7883935eeca8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fcf14-801e-001f-1149-673bbb000000", + "Body" : "jtcaccountsassignaturesstringtosignjtcaccountsassignaturesstringtosign079788ce2a7221e9aMon, 09 Sep 2019 19:59:08 GMT\"0x8D735602CEC750C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:07 GMT", + "x-ms-client-request-id" : "ee2c08d9-9c73-4508-904c-7883935eeca8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturesstringtosign079788ce2a7221e9a?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" : "e22cc238-54bd-4846-82f1-80cfe038b090" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fcf23-801e-001f-2049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:07 GMT", + "x-ms-client-request-id" : "e22cc238-54bd-4846-82f1-80cfe038b090" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturesstringtosign079788ce2a7221e9a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[0].json new file mode 100644 index 000000000000..846736ac4bd7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturevaluesia024473ba362f68346d4?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" : "4a36f2df-3220-45c7-87eb-94122728457b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602D133DFC\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fcf32-801e-001f-2f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:08 GMT", + "x-ms-client-request-id" : "4a36f2df-3220-45c7-87eb-94122728457b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsassignaturevaluesia&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" : "3b04ce8e-7343-4b0a-8f80-c6c00984b55a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fcf40-801e-001f-3c49-673bbb000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia024473ba362f68346d4Mon, 09 Sep 2019 19:59:08 GMT\"0x8D735602D133DFC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:08 GMT", + "x-ms-client-request-id" : "3b04ce8e-7343-4b0a-8f80-c6c00984b55a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturevaluesia024473ba362f68346d4?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" : "f7a78633-3e5a-467b-bff1-400f8ad4738f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fcf4d-801e-001f-4749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:08 GMT", + "x-ms-client-request-id" : "f7a78633-3e5a-467b-bff1-400f8ad4738f" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia024473ba362f68346d4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[1].json new file mode 100644 index 000000000000..1b9c7100f584 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturevaluesia076637e5a02219e3b04?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" : "dac8e051-ee3c-44d5-a398-5fdaa19cb810" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602D3991AB\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:08 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fcf66-801e-001f-5d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:08 GMT", + "x-ms-client-request-id" : "dac8e051-ee3c-44d5-a398-5fdaa19cb810" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsassignaturevaluesia&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" : "7412ab34-03f0-4a0c-a764-e7fe1714dabb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fcf74-801e-001f-6949-673bbb000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia076637e5a02219e3b04Mon, 09 Sep 2019 19:59:08 GMT\"0x8D735602D3991AB\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:08 GMT", + "x-ms-client-request-id" : "7412ab34-03f0-4a0c-a764-e7fe1714dabb", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturevaluesia076637e5a02219e3b04?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" : "0c44af54-64cf-4bd7-85e5-8428cf861e5f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fcf80-801e-001f-7549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:08 GMT", + "x-ms-client-request-id" : "0c44af54-64cf-4bd7-85e5-8428cf861e5f" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia076637e5a02219e3b04" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[2].json new file mode 100644 index 000000000000..dc123307b29b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturevaluesia0624055ee784bea0214?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" : "69c6e91a-02f6-47cc-aa4d-c50492dca11d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602D6208A9\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fcf90-801e-001f-0449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:08 GMT", + "x-ms-client-request-id" : "69c6e91a-02f6-47cc-aa4d-c50492dca11d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsassignaturevaluesia&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" : "9934f5f4-35dd-4e34-b98e-f0dc6a349c07" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fcfa4-801e-001f-1649-673bbb000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia0624055ee784bea0214Mon, 09 Sep 2019 19:59:09 GMT\"0x8D735602D6208A9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:08 GMT", + "x-ms-client-request-id" : "9934f5f4-35dd-4e34-b98e-f0dc6a349c07", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturevaluesia0624055ee784bea0214?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" : "12cde477-60a4-456e-97ea-696b633cc3fa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fcfb2-801e-001f-2149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:08 GMT", + "x-ms-client-request-id" : "12cde477-60a4-456e-97ea-696b633cc3fa" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia0624055ee784bea0214" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[3].json new file mode 100644 index 000000000000..3477ae41e9ef --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[3].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturevaluesia020561c1f59764bd3f4?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" : "5438c917-e916-4c37-a97c-8f343c648aab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602D87C00E\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fcfc2-801e-001f-2f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:08 GMT", + "x-ms-client-request-id" : "5438c917-e916-4c37-a97c-8f343c648aab" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsassignaturevaluesia&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" : "9b7375a3-a360-40ae-abdc-4193e4b42f9c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fcfd1-801e-001f-3b49-673bbb000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia020561c1f59764bd3f4Mon, 09 Sep 2019 19:59:09 GMT\"0x8D735602D87C00E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:08 GMT", + "x-ms-client-request-id" : "9b7375a3-a360-40ae-abdc-4193e4b42f9c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturevaluesia020561c1f59764bd3f4?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" : "616180f7-2ba0-4dc5-813a-fb5f02a11810" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fcfdb-801e-001f-4549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:08 GMT", + "x-ms-client-request-id" : "616180f7-2ba0-4dc5-813a-fb5f02a11810" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia020561c1f59764bd3f4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[4].json new file mode 100644 index 000000000000..1d49a761132b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[4].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturevaluesia086040c4c0ebc2aba74?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" : "8e59c1fc-2117-433f-865b-cd40e1a40c54" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602DB0AC4B\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fcff3-801e-001f-5c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:09 GMT", + "x-ms-client-request-id" : "8e59c1fc-2117-433f-865b-cd40e1a40c54" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsassignaturevaluesia&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" : "65cf1fae-1c6a-41ed-b84e-d2675d78c9cd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd000-801e-001f-6849-673bbb000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia086040c4c0ebc2aba74Mon, 09 Sep 2019 19:59:09 GMT\"0x8D735602DB0AC4B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:09 GMT", + "x-ms-client-request-id" : "65cf1fae-1c6a-41ed-b84e-d2675d78c9cd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturevaluesia086040c4c0ebc2aba74?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" : "cfb5de10-a1a3-4e98-8042-7eec2b020307" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd00b-801e-001f-7349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:09 GMT", + "x-ms-client-request-id" : "cfb5de10-a1a3-4e98-8042-7eec2b020307" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia086040c4c0ebc2aba74" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[5].json new file mode 100644 index 000000000000..39d7ea000227 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestaccountsassignaturevaluesia[5].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturevaluesia00777981fedff5cbdd4?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" : "cff210ff-3d05-4226-9df5-69093b7f88ba" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602DD838BE\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:09 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd017-801e-001f-7e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:09 GMT", + "x-ms-client-request-id" : "cff210ff-3d05-4226-9df5-69093b7f88ba" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcaccountsassignaturevaluesia&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" : "eea2ba97-6020-42ad-927d-d5e23fe6981c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd029-801e-001f-0e49-673bbb000000", + "Body" : "jtcaccountsassignaturevaluesiajtcaccountsassignaturevaluesia00777981fedff5cbdd4Mon, 09 Sep 2019 19:59:09 GMT\"0x8D735602DD838BE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:09 GMT", + "x-ms-client-request-id" : "eea2ba97-6020-42ad-927d-d5e23fe6981c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcaccountsassignaturevaluesia00777981fedff5cbdd4?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" : "7a0ada1c-8904-4b3a-9560-bd559c1aafa3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd035-801e-001f-1a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:09 GMT", + "x-ms-client-request-id" : "7a0ada1c-8904-4b3a-9560-bd559c1aafa3" + }, + "Exception" : null + } ], + "variables" : [ "jtcaccountsassignaturevaluesia00777981fedff5cbdd4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobclientgetsnapshot.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobclientgetsnapshot.json new file mode 100644 index 000000000000..dd358d6ba9ce --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobclientgetsnapshot.json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobclientgetsnapshot0sastestblobclientgetsnapshot0f870120b?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" : "a017e983-6b39-46c4-8a93-49ad8930e86f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735601E072611\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fb8fe-801e-001f-5348-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:42 GMT", + "x-ms-client-request-id" : "a017e983-6b39-46c4-8a93-49ad8930e86f" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobclientgetsnapshot0sastestblobclientgetsnapshot0f870120b/javablobblobclientgetsnapshot148013f072ab86a1514d", + "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" : "b5bbbca5-fe59-4b8a-addd-f6257a005486", + "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:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:58:42 GMT", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "ETag" : "\"0x8D735601E1AD8C3\"", + "Content-Length" : "0", + "x-ms-request-id" : "077fb90c-801e-001f-5f48-673bbb000000", + "x-ms-client-request-id" : "b5bbbca5-fe59-4b8a-addd-f6257a005486" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobclientgetsnapshot0sastestblobclientgetsnapshot0f870120b/javablobblobclientgetsnapshot148013f072ab86a1514d?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" : "e75a65c7-3221-4043-945d-14365df07a0e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T19:58:43.5843999Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735601E1AD8C3\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fb927-801e-001f-7748-673bbb000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 19:58:43 GMT", + "x-ms-client-request-id" : "e75a65c7-3221-4043-945d-14365df07a0e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobclientgetsnapshot&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" : "5bd645c1-5f70-477e-aa4f-accbc5fe292f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fb93b-801e-001f-0948-673bbb000000", + "Body" : "jtcblobclientgetsnapshotjtcblobclientgetsnapshot0sastestblobclientgetsnapshot0f870120bMon, 09 Sep 2019 19:58:43 GMT\"0x8D735601E072611\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:43 GMT", + "x-ms-client-request-id" : "5bd645c1-5f70-477e-aa4f-accbc5fe292f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobclientgetsnapshot0sastestblobclientgetsnapshot0f870120b?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" : "ee24f3f7-0a7e-48fb-9dd0-57acf1753dd0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fb949-801e-001f-1648-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:43 GMT", + "x-ms-client-request-id" : "ee24f3f7-0a7e-48fb-9dd0-57acf1753dd0" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobclientgetsnapshot0sastestblobclientgetsnapshot0f870120b", "javablobblobclientgetsnapshot148013f072ab86a1514d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobclientissnapshot.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobclientissnapshot.json new file mode 100644 index 000000000000..529ce097188f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobclientissnapshot.json @@ -0,0 +1,113 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobclientissnapshot0sastestblobclientissnapshot5ce1823939?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" : "ba835fd5-9954-45b5-869b-08f6b2667ef0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735601E5A1041\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fb955-801e-001f-2248-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:43 GMT", + "x-ms-client-request-id" : "ba835fd5-9954-45b5-869b-08f6b2667ef0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobclientissnapshot0sastestblobclientissnapshot5ce1823939/javablobblobclientissnapshot160653c2c9ec89fa974a", + "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" : "4f816ee8-17b4-4db1-b02e-52960270dca2", + "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:43 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:58:43 GMT", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "ETag" : "\"0x8D735601E67A74A\"", + "Content-Length" : "0", + "x-ms-request-id" : "077fb95d-801e-001f-2948-673bbb000000", + "x-ms-client-request-id" : "4f816ee8-17b4-4db1-b02e-52960270dca2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobclientissnapshot0sastestblobclientissnapshot5ce1823939/javablobblobclientissnapshot160653c2c9ec89fa974a?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" : "07843093-5b76-4867-a891-6f8a9c9bb8cc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T19:58:44.0297198Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735601E67A74A\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fb969-801e-001f-3248-673bbb000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Mon, 09 Sep 2019 19:58:43 GMT", + "x-ms-client-request-id" : "07843093-5b76-4867-a891-6f8a9c9bb8cc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobclientissnapshot&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" : "5d9c9252-bf9f-4293-a025-722391a5c10f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fb97c-801e-001f-4548-673bbb000000", + "Body" : "jtcblobclientissnapshotjtcblobclientissnapshot0sastestblobclientissnapshot5ce1823939Mon, 09 Sep 2019 19:58:43 GMT\"0x8D735601E5A1041\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:43 GMT", + "x-ms-client-request-id" : "5d9c9252-bf9f-4293-a025-722391a5c10f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobclientissnapshot0sastestblobclientissnapshot5ce1823939?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" : "2f7270a0-782c-48e3-9dd6-048d946da5bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fb98c-801e-001f-5348-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:43 GMT", + "x-ms-client-request-id" : "2f7270a0-782c-48e3-9dd6-048d946da5bf" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobclientissnapshot0sastestblobclientissnapshot5ce1823939", "javablobblobclientissnapshot160653c2c9ec89fa974a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrange[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrange[0].json new file mode 100644 index 000000000000..ebe48df7ddee --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrange[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobrange0sastestblobrange9ab11678720502208b864?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" : "53342d76-fc4f-47ef-b7df-7008e0c6fe95" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735601D41B625\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fb829-801e-001f-1348-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:41 GMT", + "x-ms-client-request-id" : "53342d76-fc4f-47ef-b7df-7008e0c6fe95" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobrange&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" : "441aa15e-825c-4857-91f8-29b0771e8668" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fb83c-801e-001f-2348-673bbb000000", + "Body" : "jtcblobrangejtcblobrange0sastestblobrange9ab11678720502208b864Mon, 09 Sep 2019 19:58:42 GMT\"0x8D735601D41B625\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:41 GMT", + "x-ms-client-request-id" : "441aa15e-825c-4857-91f8-29b0771e8668", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobrange0sastestblobrange9ab11678720502208b864?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" : "bd960a55-81ea-4db7-be09-3092674a65db" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fb842-801e-001f-2948-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:41 GMT", + "x-ms-client-request-id" : "bd960a55-81ea-4db7-be09-3092674a65db" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrange0sastestblobrange9ab11678720502208b864" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrange[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrange[1].json new file mode 100644 index 000000000000..631ce922be01 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrange[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobrange0sastestblobrangee8147472e0046efcad6f4?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" : "5b84c28e-81fe-42e7-a4b6-6a869fa4f03a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735601D685800\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fb853-801e-001f-3948-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:41 GMT", + "x-ms-client-request-id" : "5b84c28e-81fe-42e7-a4b6-6a869fa4f03a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobrange&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" : "f590315b-b126-4218-9cc4-113a0c7e0127" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fb85b-801e-001f-3f48-673bbb000000", + "Body" : "jtcblobrangejtcblobrange0sastestblobrangee8147472e0046efcad6f4Mon, 09 Sep 2019 19:58:42 GMT\"0x8D735601D685800\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:41 GMT", + "x-ms-client-request-id" : "f590315b-b126-4218-9cc4-113a0c7e0127", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobrange0sastestblobrangee8147472e0046efcad6f4?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" : "d9255026-9641-427f-b34b-e7c378603def" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fb869-801e-001f-4d48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:41 GMT", + "x-ms-client-request-id" : "d9255026-9641-427f-b34b-e7c378603def" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrange0sastestblobrangee8147472e0046efcad6f4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrange[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrange[2].json new file mode 100644 index 000000000000..9149c20a664e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrange[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobrange0sastestblobrange64a13191df784d4a868a4?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" : "77d89e7a-c1b5-46bf-906b-5e663767b1d2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735601D8FE466\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fb87c-801e-001f-5e48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:42 GMT", + "x-ms-client-request-id" : "77d89e7a-c1b5-46bf-906b-5e663767b1d2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobrange&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" : "8dbb3589-3b4f-4aae-ac70-89de33308c60" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fb894-801e-001f-7448-673bbb000000", + "Body" : "jtcblobrangejtcblobrange0sastestblobrange64a13191df784d4a868a4Mon, 09 Sep 2019 19:58:42 GMT\"0x8D735601D8FE466\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:42 GMT", + "x-ms-client-request-id" : "8dbb3589-3b4f-4aae-ac70-89de33308c60", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobrange0sastestblobrange64a13191df784d4a868a4?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" : "f5693aa4-2220-4ba3-a776-436de606a64d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fb89c-801e-001f-7a48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:42 GMT", + "x-ms-client-request-id" : "f5693aa4-2220-4ba3-a776-436de606a64d" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrange0sastestblobrange64a13191df784d4a868a4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrangeia[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrangeia[0].json new file mode 100644 index 000000000000..f1862896546d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrangeia[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobrangeia0sastestblobrangeia19691913784106070e7?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" : "f6360645-0a52-4ef6-8e2f-eff17b8200f6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735601DB8F7AE\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:42 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fb8ae-801e-001f-0a48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:42 GMT", + "x-ms-client-request-id" : "f6360645-0a52-4ef6-8e2f-eff17b8200f6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobrangeia&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" : "a7023e8d-b51a-4377-a1cd-8c86a49cc2e3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fb8b8-801e-001f-1348-673bbb000000", + "Body" : "jtcblobrangeiajtcblobrangeia0sastestblobrangeia19691913784106070e7Mon, 09 Sep 2019 19:58:42 GMT\"0x8D735601DB8F7AE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:42 GMT", + "x-ms-client-request-id" : "a7023e8d-b51a-4377-a1cd-8c86a49cc2e3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobrangeia0sastestblobrangeia19691913784106070e7?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" : "a744667e-9bad-4c78-a587-e9d51cea7659" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fb8bf-801e-001f-1848-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:42 GMT", + "x-ms-client-request-id" : "a744667e-9bad-4c78-a587-e9d51cea7659" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrangeia0sastestblobrangeia19691913784106070e7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrangeia[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrangeia[1].json new file mode 100644 index 000000000000..89c8d929959d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobrangeia[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobrangeia0sastestblobrangeia4d91668995a9518e3df?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" : "89f72a8d-45a8-4bd7-ac9d-b20d29039128" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735601DDF4B6C\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fb8d5-801e-001f-2e48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:42 GMT", + "x-ms-client-request-id" : "89f72a8d-45a8-4bd7-ac9d-b20d29039128" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobrangeia&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" : "87cf257e-f545-41a5-88e8-818261f7bdf7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fb8e6-801e-001f-3d48-673bbb000000", + "Body" : "jtcblobrangeiajtcblobrangeia0sastestblobrangeia4d91668995a9518e3dfMon, 09 Sep 2019 19:58:43 GMT\"0x8D735601DDF4B6C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:42 GMT", + "x-ms-client-request-id" : "87cf257e-f545-41a5-88e8-818261f7bdf7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobrangeia0sastestblobrangeia4d91668995a9518e3df?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" : "dde49243-3653-4d37-a2fd-2437a0d0438c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fb8f1-801e-001f-4648-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:42 GMT", + "x-ms-client-request-id" : "dde49243-3653-4d37-a2fd-2437a0d0438c" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobrangeia0sastestblobrangeia4d91668995a9518e3df" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[0].json new file mode 100644 index 000000000000..4391b0a0433e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse000782f59ce21a48bd4b0?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" : "4a6b589b-9bf9-4387-8c22-871321468d9d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356026A52A6C\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc34f-801e-001f-3249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:57 GMT", + "x-ms-client-request-id" : "4a6b589b-9bf9-4387-8c22-871321468d9d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&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" : "34c31de9-a9c4-4b70-9a2a-a77ec4bd3534" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc35a-801e-001f-3b49-673bbb000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse000782f59ce21a48bd4b0Mon, 09 Sep 2019 19:58:57 GMT\"0x8D7356026A52A6C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:57 GMT", + "x-ms-client-request-id" : "34c31de9-a9c4-4b70-9a2a-a77ec4bd3534", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse000782f59ce21a48bd4b0?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" : "47e2010d-84be-481d-a39e-6ac6e69d5a75" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc366-801e-001f-4649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:57 GMT", + "x-ms-client-request-id" : "47e2010d-84be-481d-a39e-6ac6e69d5a75" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse000782f59ce21a48bd4b0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[1].json new file mode 100644 index 000000000000..95d3dfccecf3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse044184cc85144578b4445?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" : "4d228b7f-7a53-4a37-8e3f-96c01b783af8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356026CCB6DF\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc376-801e-001f-5649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:57 GMT", + "x-ms-client-request-id" : "4d228b7f-7a53-4a37-8e3f-96c01b783af8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&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" : "1eb9d18a-0858-4c17-a93f-8b57912ae996" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc394-801e-001f-6e49-673bbb000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse044184cc85144578b4445Mon, 09 Sep 2019 19:58:58 GMT\"0x8D7356026CCB6DF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:57 GMT", + "x-ms-client-request-id" : "1eb9d18a-0858-4c17-a93f-8b57912ae996", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse044184cc85144578b4445?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" : "eeb61cda-88eb-438c-a2b9-ead30d6e36b9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc39e-801e-001f-7849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:57 GMT", + "x-ms-client-request-id" : "eeb61cda-88eb-438c-a2b9-ead30d6e36b9" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse044184cc85144578b4445" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[2].json new file mode 100644 index 000000000000..1c042fc2b447 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse00729795b219dc0c3d46e?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" : "30dc6489-1f86-491a-b06b-2ff789da46d2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356026F5CA47\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc3ba-801e-001f-1249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:57 GMT", + "x-ms-client-request-id" : "30dc6489-1f86-491a-b06b-2ff789da46d2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&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" : "4256850e-130a-41af-a9d8-414d64c01b35" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc3cd-801e-001f-2449-673bbb000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse00729795b219dc0c3d46eMon, 09 Sep 2019 19:58:58 GMT\"0x8D7356026F5CA47\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:57 GMT", + "x-ms-client-request-id" : "4256850e-130a-41af-a9d8-414d64c01b35", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse00729795b219dc0c3d46e?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" : "23bb5a4e-789e-407d-9825-268a3ed7b834" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc3de-801e-001f-3549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:57 GMT", + "x-ms-client-request-id" : "23bb5a4e-789e-407d-9825-268a3ed7b834" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse00729795b219dc0c3d46e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[3].json new file mode 100644 index 000000000000..59b70ce81103 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[3].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse013313387dab56b56546f?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" : "fb81a6ab-a508-469f-8a7d-765d6d810fc1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560271DA4E3\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc3ef-801e-001f-4449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:58 GMT", + "x-ms-client-request-id" : "fb81a6ab-a508-469f-8a7d-765d6d810fc1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&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" : "d2355219-931e-4f28-a2d5-861b357a3916" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc401-801e-001f-5049-673bbb000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse013313387dab56b56546fMon, 09 Sep 2019 19:58:58 GMT\"0x8D73560271DA4E3\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:58 GMT", + "x-ms-client-request-id" : "d2355219-931e-4f28-a2d5-861b357a3916", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse013313387dab56b56546f?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" : "89d674b2-f18e-4e0f-8336-e109f313f839" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc40b-801e-001f-5a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:58 GMT", + "x-ms-client-request-id" : "89d674b2-f18e-4e0f-8336-e109f313f839" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse013313387dab56b56546f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[4].json new file mode 100644 index 000000000000..9422ed0b6c12 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[4].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse081094acd53948ee4f474?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" : "78f9e523-2e4c-4ebd-a808-36e6bc68e0b8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602743F898\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:58 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc418-801e-001f-6649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:58 GMT", + "x-ms-client-request-id" : "78f9e523-2e4c-4ebd-a808-36e6bc68e0b8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&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" : "9c36fa6c-6830-4a6b-ba29-15a691ab7de7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc428-801e-001f-7349-673bbb000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse081094acd53948ee4f474Mon, 09 Sep 2019 19:58:58 GMT\"0x8D735602743F898\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:58 GMT", + "x-ms-client-request-id" : "9c36fa6c-6830-4a6b-ba29-15a691ab7de7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse081094acd53948ee4f474?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" : "016aaeb9-1d65-4df4-9ed3-96cc50afb207" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc43c-801e-001f-0749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:58 GMT", + "x-ms-client-request-id" : "016aaeb9-1d65-4df4-9ed3-96cc50afb207" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse081094acd53948ee4f474" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[5].json new file mode 100644 index 000000000000..51b7b21e7b81 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[5].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse039464265340f6ddd14ed?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" : "b1a80aba-a2c5-45fd-8fae-6f16d859d5fd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602769D712\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc447-801e-001f-1249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:58 GMT", + "x-ms-client-request-id" : "b1a80aba-a2c5-45fd-8fae-6f16d859d5fd" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&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" : "9d1c7e39-6c71-4c37-8c0f-8cccf4bc7081" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc475-801e-001f-3d49-673bbb000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse039464265340f6ddd14edMon, 09 Sep 2019 19:58:59 GMT\"0x8D735602769D712\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:58 GMT", + "x-ms-client-request-id" : "9d1c7e39-6c71-4c37-8c0f-8cccf4bc7081", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse039464265340f6ddd14ed?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" : "21ad32a2-9db5-458a-bf5e-00137f17ec63" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc485-801e-001f-4c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:58 GMT", + "x-ms-client-request-id" : "21ad32a2-9db5-458a-bf5e-00137f17ec63" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse039464265340f6ddd14ed" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[6].json new file mode 100644 index 000000000000..823dbca898d4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparse[6].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse0414703b08f765d3634e4?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" : "9d3230f5-604c-4d3f-bdeb-847b4418169d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356027A7D5D7\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc4aa-801e-001f-6d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:58 GMT", + "x-ms-client-request-id" : "9d3230f5-604c-4d3f-bdeb-847b4418169d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionsparse&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" : "a0a7791a-1108-4317-bb3a-40ff1f7da749" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc4be-801e-001f-7a49-673bbb000000", + "Body" : "jtcblobsaspermissionsparsejtcblobsaspermissionsparse0414703b08f765d3634e4Mon, 09 Sep 2019 19:58:59 GMT\"0x8D7356027A7D5D7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:59 GMT", + "x-ms-client-request-id" : "a0a7791a-1108-4317-bb3a-40ff1f7da749", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparse0414703b08f765d3634e4?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" : "9be1b79d-c253-41e3-a492-50a1d2a01847" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc4d0-801e-001f-0a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:59 GMT", + "x-ms-client-request-id" : "9be1b79d-c253-41e3-a492-50a1d2a01847" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparse0414703b08f765d3634e4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparseia.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparseia.json new file mode 100644 index 000000000000..c99b30350b10 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionsparseia.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparseia009136aea055baa0f94c?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" : "34bdd4f3-3346-4652-9cae-2c3c20e9c284" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356027D1FAD2\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc4ec-801e-001f-2449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:59 GMT", + "x-ms-client-request-id" : "34bdd4f3-3346-4652-9cae-2c3c20e9c284" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionsparseia&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" : "827d1eae-fe80-4d68-8cc7-2e0ac89a6d04" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc510-801e-001f-4449-673bbb000000", + "Body" : "jtcblobsaspermissionsparseiajtcblobsaspermissionsparseia009136aea055baa0f94cMon, 09 Sep 2019 19:58:59 GMT\"0x8D7356027D1FAD2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:59 GMT", + "x-ms-client-request-id" : "827d1eae-fe80-4d68-8cc7-2e0ac89a6d04", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionsparseia009136aea055baa0f94c?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" : "b4e33ca1-ec8c-458c-8b5c-3360fc9ac669" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc522-801e-001f-5549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:59 GMT", + "x-ms-client-request-id" : "b4e33ca1-ec8c-458c-8b5c-3360fc9ac669" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionsparseia009136aea055baa0f94c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[0].json new file mode 100644 index 000000000000..b5fea2e540e1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionstostring038694b774684986f04b?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" : "9ad7f027-c09d-4ae8-8445-c9369754887f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356025B7DFEE\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc23a-801e-001f-2c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:55 GMT", + "x-ms-client-request-id" : "9ad7f027-c09d-4ae8-8445-c9369754887f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionstostring&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" : "15c060fa-7422-4e28-a874-c2490687b4fa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc248-801e-001f-3949-673bbb000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring038694b774684986f04bMon, 09 Sep 2019 19:58:56 GMT\"0x8D7356025B7DFEE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:55 GMT", + "x-ms-client-request-id" : "15c060fa-7422-4e28-a874-c2490687b4fa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionstostring038694b774684986f04b?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" : "2b637b4d-1a2c-4979-948e-78812f76357d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc251-801e-001f-4149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:55 GMT", + "x-ms-client-request-id" : "2b637b4d-1a2c-4979-948e-78812f76357d" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring038694b774684986f04b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[1].json new file mode 100644 index 000000000000..a0705617dffb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionstostring019830800d7a9d110646?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" : "ceaa8183-7721-4528-87e2-ccd14b09513d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356025E0A51A\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc25b-801e-001f-4b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:55 GMT", + "x-ms-client-request-id" : "ceaa8183-7721-4528-87e2-ccd14b09513d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionstostring&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" : "ebd4035d-ed9b-4072-825a-72b60599a1a1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc26d-801e-001f-5c49-673bbb000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring019830800d7a9d110646Mon, 09 Sep 2019 19:58:56 GMT\"0x8D7356025E0A51A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:56 GMT", + "x-ms-client-request-id" : "ebd4035d-ed9b-4072-825a-72b60599a1a1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionstostring019830800d7a9d110646?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" : "07624fcb-8b0f-4e62-893e-e33dd0a5ec01" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc27f-801e-001f-6d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:56 GMT", + "x-ms-client-request-id" : "07624fcb-8b0f-4e62-893e-e33dd0a5ec01" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring019830800d7a9d110646" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[2].json new file mode 100644 index 000000000000..e38810f65374 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionstostring032265af3389be32044d?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" : "211f9704-7dd6-4ca3-af30-3cabf2baf93b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602608F507\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc299-801e-001f-0749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:56 GMT", + "x-ms-client-request-id" : "211f9704-7dd6-4ca3-af30-3cabf2baf93b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionstostring&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" : "345105f8-99f7-4d5d-b3b9-b345275cf7bc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc2ae-801e-001f-1949-673bbb000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring032265af3389be32044dMon, 09 Sep 2019 19:58:56 GMT\"0x8D735602608F507\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:56 GMT", + "x-ms-client-request-id" : "345105f8-99f7-4d5d-b3b9-b345275cf7bc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionstostring032265af3389be32044d?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" : "ed2d0026-df0c-48cf-a4b6-7aa5b0e8e846" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc2b6-801e-001f-2149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:56 GMT", + "x-ms-client-request-id" : "ed2d0026-df0c-48cf-a4b6-7aa5b0e8e846" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring032265af3389be32044d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[3].json new file mode 100644 index 000000000000..72de4a7ce348 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[3].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionstostring052427c42920a7ccff44?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" : "6406920b-6b57-49d0-931a-f2b89c2fa04b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356026305A50\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc2c3-801e-001f-2e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:56 GMT", + "x-ms-client-request-id" : "6406920b-6b57-49d0-931a-f2b89c2fa04b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionstostring&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" : "76a01292-08ef-4855-b76f-0ea4ffba256f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc2dd-801e-001f-4549-673bbb000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring052427c42920a7ccff44Mon, 09 Sep 2019 19:58:57 GMT\"0x8D7356026305A50\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:56 GMT", + "x-ms-client-request-id" : "76a01292-08ef-4855-b76f-0ea4ffba256f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionstostring052427c42920a7ccff44?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" : "73d25843-eddc-4761-abc2-a992841382c1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc2ec-801e-001f-5449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:56 GMT", + "x-ms-client-request-id" : "73d25843-eddc-4761-abc2-a992841382c1" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring052427c42920a7ccff44" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[4].json new file mode 100644 index 000000000000..cf5a4f8bfc07 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[4].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionstostring074530ae59b7ffbd7842?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" : "90716678-eef7-4847-9932-7e24c9a10b5f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560265638BE\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc2f7-801e-001f-5f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:56 GMT", + "x-ms-client-request-id" : "90716678-eef7-4847-9932-7e24c9a10b5f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionstostring&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" : "58f796f0-3254-47dd-b740-656854e6fb94" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc305-801e-001f-6b49-673bbb000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring074530ae59b7ffbd7842Mon, 09 Sep 2019 19:58:57 GMT\"0x8D73560265638BE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:56 GMT", + "x-ms-client-request-id" : "58f796f0-3254-47dd-b740-656854e6fb94", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionstostring074530ae59b7ffbd7842?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" : "12a4c76d-7f1b-429e-b4a6-631c23cecb58" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc30a-801e-001f-6f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:56 GMT", + "x-ms-client-request-id" : "12a4c76d-7f1b-429e-b4a6-631c23cecb58" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring074530ae59b7ffbd7842" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[5].json new file mode 100644 index 000000000000..f2129b97ad30 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobsaspermissionstostring[5].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionstostring021835babfe4444aeb44?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" : "0ab0e6ae-069a-4ce1-922a-6336793dcc10" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560267D9E06\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:57 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc319-801e-001f-7e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:56 GMT", + "x-ms-client-request-id" : "0ab0e6ae-069a-4ce1-922a-6336793dcc10" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcblobsaspermissionstostring&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" : "aa18c15c-c889-4615-aa3a-c222c00b7c67" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc32c-801e-001f-1049-673bbb000000", + "Body" : "jtcblobsaspermissionstostringjtcblobsaspermissionstostring021835babfe4444aeb44Mon, 09 Sep 2019 19:58:57 GMT\"0x8D73560267D9E06\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:57 GMT", + "x-ms-client-request-id" : "aa18c15c-c889-4615-aa3a-c222c00b7c67", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobsaspermissionstostring021835babfe4444aeb44?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" : "e2131305-0874-4fcc-8c63-be76ed03f007" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc33e-801e-001f-2149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:57 GMT", + "x-ms-client-request-id" : "e2131305-0874-4fcc-8c63-be76ed03f007" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobsaspermissionstostring021835babfe4444aeb44" ] +} \ 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 new file mode 100644 index 000000000000..926576a060cb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestblobservicesasnetworktestblobsnapshot.json @@ -0,0 +1,241 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot090063b8550fc7?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" + }, + "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", + "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" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot187339c10cc806?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" + }, + "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", + "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" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot187339c10cc806/javablobblobservicesasnetworktestblobsnapshot268555a7e876", + "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", + "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", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:58:45 GMT", + "Content-MD5" : "wh+Wm18D0z1D4E+PE252gg==", + "ETag" : "\"0x8D735601FD0A145\"", + "Content-Length" : "0", + "x-ms-request-id" : "077fbb06-801e-001f-2c48-673bbb000000", + "x-ms-client-request-id" : "120848c5-375d-429a-a26b-c676e4141ee3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot187339c10cc806/javablobblobservicesasnetworktestblobsnapshot268555a7e876?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" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T19:58:46.3934129Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735601FD0A145\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fbb10-801e-001f-3648-673bbb000000", + "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" + }, + "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", + "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" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "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", + "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", + "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" + }, + "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", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:58:46 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\"", + "Content-Disposition" : "disposition", + "x-ms-creation-time" : "Mon, 09 Sep 2019 19:58:46 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "077fbb2e-801e-001f-5148-673bbb000000", + "Body" : "default", + "x-ms-client-request-id" : "12316e2e-d5e6-4ec5-bbe6-dab4db52032f", + "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", + "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" + }, + "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", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:58:46 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\"", + "Content-Disposition" : "disposition", + "Content-Encoding" : "encoding", + "x-ms-creation-time" : "Mon, 09 Sep 2019 19:58:46 GMT", + "Content-Length" : "7", + "x-ms-request-id" : "077fbb41-801e-001f-6148-673bbb000000", + "x-ms-client-request-id" : "214fe5f2-816b-400a-8448-f8a34302d62e", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.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" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "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", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot090063b8550fc7?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" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fbb5a-801e-001f-7a48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:46 GMT", + "x-ms-client-request-id" : "1d22aa90-4adc-45f9-9c10-a0994a34a716" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcblobservicesasnetworktestblobsnapshot187339c10cc806?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" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fbb65-801e-001f-0448-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:46 GMT", + "x-ms-client-request-id" : "af80d26d-15e2-472d-b382-4aec110a45c4" + }, + "Exception" : null + } ], + "variables" : [ "jtcblobservicesasnetworktestblobsnapshot090063b8550fc7", "jtcblobservicesasnetworktestblobsnapshot187339c10cc806", "javablobblobservicesasnetworktestblobsnapshot268555a7e876", "2019-09-09T19:58:46.474Z", "2019-09-09T19:58:46.474Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestbloburlparts.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestbloburlparts.json new file mode 100644 index 000000000000..b40e707bbbec --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestbloburlparts.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbloburlparts0sastestbloburlparts47b201138621135955?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" : "fc4f8c20-8364-4f07-9b95-7f9f97d06418" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735603268D052\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd6b5-801e-001f-7649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:16 GMT", + "x-ms-client-request-id" : "fc4f8c20-8364-4f07-9b95-7f9f97d06418" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcbloburlparts&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" : "b82a0b95-3dab-417a-840e-295290921373" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd6bf-801e-001f-7f49-673bbb000000", + "Body" : "jtcbloburlpartsjtcbloburlparts0sastestbloburlparts47b201138621135955Mon, 09 Sep 2019 19:59:17 GMT\"0x8D735603268D052\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:17 GMT", + "x-ms-client-request-id" : "b82a0b95-3dab-417a-840e-295290921373", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcbloburlparts0sastestbloburlparts47b201138621135955?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" : "c2043da7-9015-437d-a315-916b014ef775" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd6d0-801e-001f-0f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:17 GMT", + "x-ms-client-request-id" : "c2043da7-9015-437d-a315-916b014ef775" + }, + "Exception" : null + } ], + "variables" : [ "jtcbloburlparts0sastestbloburlparts47b201138621135955" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[0].json new file mode 100644 index 000000000000..7abc625b5cd1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse0965846271ca0decf84?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" : "a270147a-8bac-4e95-b478-79668dfb9e40" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560290C8928\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc743-801e-001f-5549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:01 GMT", + "x-ms-client-request-id" : "a270147a-8bac-4e95-b478-79668dfb9e40" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&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" : "d0b0a6e0-fa65-4e21-9ccb-ef51772dd358" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc75b-801e-001f-6c49-673bbb000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse0965846271ca0decf84Mon, 09 Sep 2019 19:59:01 GMT\"0x8D73560290C8928\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:01 GMT", + "x-ms-client-request-id" : "d0b0a6e0-fa65-4e21-9ccb-ef51772dd358", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse0965846271ca0decf84?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" : "79c8dd80-f384-442a-a32c-5196481b7a3c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc77d-801e-001f-0e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:01 GMT", + "x-ms-client-request-id" : "79c8dd80-f384-442a-a32c-5196481b7a3c" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse0965846271ca0decf84" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[1].json new file mode 100644 index 000000000000..8f5ccd3afbd1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse0634622f4e05825c254?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" : "0f9f0aa4-689b-4873-aefe-35002fe47290" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356029335224\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc79b-801e-001f-2a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:01 GMT", + "x-ms-client-request-id" : "0f9f0aa4-689b-4873-aefe-35002fe47290" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&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" : "456fb39c-7339-4515-9627-3d7a0eec0dea" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc7b5-801e-001f-3f49-673bbb000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse0634622f4e05825c254Mon, 09 Sep 2019 19:59:02 GMT\"0x8D7356029335224\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:01 GMT", + "x-ms-client-request-id" : "456fb39c-7339-4515-9627-3d7a0eec0dea", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse0634622f4e05825c254?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" : "69055064-07ed-474a-a76b-23b6df80d483" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc7c5-801e-001f-4d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:01 GMT", + "x-ms-client-request-id" : "69055064-07ed-474a-a76b-23b6df80d483" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse0634622f4e05825c254" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[2].json new file mode 100644 index 000000000000..5ff5f820172a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse046630e4337879ab8a4?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" : "87fd5b52-a7a0-49f0-bfbe-3745e00b35de" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560295957AF\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc7eb-801e-001f-7249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:01 GMT", + "x-ms-client-request-id" : "87fd5b52-a7a0-49f0-bfbe-3745e00b35de" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&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" : "213d2efc-549a-408c-9663-73a66f32f7f9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc809-801e-001f-0f49-673bbb000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse046630e4337879ab8a4Mon, 09 Sep 2019 19:59:02 GMT\"0x8D73560295957AF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:01 GMT", + "x-ms-client-request-id" : "213d2efc-549a-408c-9663-73a66f32f7f9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse046630e4337879ab8a4?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" : "ded664fc-ccfb-4641-b2ee-22e8a1156ba0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc816-801e-001f-1c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:01 GMT", + "x-ms-client-request-id" : "ded664fc-ccfb-4641-b2ee-22e8a1156ba0" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse046630e4337879ab8a4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[3].json new file mode 100644 index 000000000000..d5ff8af98544 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[3].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse03576798c8bae21f644?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" : "2f07738c-a744-44d7-af6b-ce25b76e453e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560298047CE\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc822-801e-001f-2749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:02 GMT", + "x-ms-client-request-id" : "2f07738c-a744-44d7-af6b-ce25b76e453e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&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" : "fffa523a-ec8b-4f96-8e60-64fc347901cd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc834-801e-001f-3649-673bbb000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse03576798c8bae21f644Mon, 09 Sep 2019 19:59:02 GMT\"0x8D73560298047CE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:02 GMT", + "x-ms-client-request-id" : "fffa523a-ec8b-4f96-8e60-64fc347901cd", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse03576798c8bae21f644?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" : "42b68981-d0c6-408d-9b0a-3a3b02ae7bc1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc845-801e-001f-4749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:02 GMT", + "x-ms-client-request-id" : "42b68981-d0c6-408d-9b0a-3a3b02ae7bc1" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse03576798c8bae21f644" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[4].json new file mode 100644 index 000000000000..a2bd0b186159 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[4].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse0581576ae227c8c0f54?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" : "5b1f4ff8-bc65-49ea-bc55-3caf88a764ce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356029A84984\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:02 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc861-801e-001f-6349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:02 GMT", + "x-ms-client-request-id" : "5b1f4ff8-bc65-49ea-bc55-3caf88a764ce" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&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" : "5d21de10-9c5c-4ecb-8a86-0cd191784be9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc880-801e-001f-7e49-673bbb000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse0581576ae227c8c0f54Mon, 09 Sep 2019 19:59:02 GMT\"0x8D7356029A84984\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:02 GMT", + "x-ms-client-request-id" : "5d21de10-9c5c-4ecb-8a86-0cd191784be9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse0581576ae227c8c0f54?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" : "3e0e5954-fe0e-4ce5-bce9-a3bedd81fe6a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc89a-801e-001f-1649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:02 GMT", + "x-ms-client-request-id" : "3e0e5954-fe0e-4ce5-bce9-a3bedd81fe6a" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse0581576ae227c8c0f54" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[5].json new file mode 100644 index 000000000000..8f87410ec288 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[5].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse063676aedf6ea341254?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" : "7ba79024-2abf-4af1-a1d3-0e15586e3cbe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356029D04B3E\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc8ca-801e-001f-4449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:02 GMT", + "x-ms-client-request-id" : "7ba79024-2abf-4af1-a1d3-0e15586e3cbe" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&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" : "74e9317b-46b5-4250-a1a3-33570f091371" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc8e1-801e-001f-5949-673bbb000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse063676aedf6ea341254Mon, 09 Sep 2019 19:59:03 GMT\"0x8D7356029D04B3E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:02 GMT", + "x-ms-client-request-id" : "74e9317b-46b5-4250-a1a3-33570f091371", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse063676aedf6ea341254?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" : "703abdab-ddec-44df-bb08-b3df98161f68" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc8fe-801e-001f-7449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:02 GMT", + "x-ms-client-request-id" : "703abdab-ddec-44df-bb08-b3df98161f68" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse063676aedf6ea341254" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[6].json new file mode 100644 index 000000000000..76c99a643098 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[6].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse02991688bdfb9da7834?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" : "b4b84b80-1915-4423-ac80-c23a680340ac" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356029F73B59\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc917-801e-001f-0a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:02 GMT", + "x-ms-client-request-id" : "b4b84b80-1915-4423-ac80-c23a680340ac" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&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" : "cdde8abe-0365-447a-9e6b-60f32f9cc233" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc930-801e-001f-2249-673bbb000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse02991688bdfb9da7834Mon, 09 Sep 2019 19:59:03 GMT\"0x8D7356029F73B59\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:02 GMT", + "x-ms-client-request-id" : "cdde8abe-0365-447a-9e6b-60f32f9cc233", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse02991688bdfb9da7834?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" : "66fa9826-a961-4953-8387-6467dbf178cc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc94e-801e-001f-3f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:02 GMT", + "x-ms-client-request-id" : "66fa9826-a961-4953-8387-6467dbf178cc" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse02991688bdfb9da7834" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[7].json new file mode 100644 index 000000000000..073aa076645c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparse[7].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse0127492ec836e559894?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" : "b2117c26-edd3-4daa-813e-9f2ec7269511" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602A204EAE\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc977-801e-001f-6649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:03 GMT", + "x-ms-client-request-id" : "b2117c26-edd3-4daa-813e-9f2ec7269511" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionsparse&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" : "98bfdbc6-c6e1-4007-ab16-a981f11a17f8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc98f-801e-001f-7c49-673bbb000000", + "Body" : "jtccontainersaspermissionsparsejtccontainersaspermissionsparse0127492ec836e559894Mon, 09 Sep 2019 19:59:03 GMT\"0x8D735602A204EAE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:03 GMT", + "x-ms-client-request-id" : "98bfdbc6-c6e1-4007-ab16-a981f11a17f8", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparse0127492ec836e559894?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" : "25d535a9-2ce0-4f89-8434-57a266fe75d4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc9b2-801e-001f-1c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:03 GMT", + "x-ms-client-request-id" : "25d535a9-2ce0-4f89-8434-57a266fe75d4" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparse0127492ec836e559894" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparseia.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparseia.json new file mode 100644 index 000000000000..4445e7fdba81 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionsparseia.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparseia0659301b61be72769d?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" : "a332b853-e92f-4993-ae4e-1a5f0fb17918" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602A4717A8\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:03 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc9d7-801e-001f-4049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:03 GMT", + "x-ms-client-request-id" : "a332b853-e92f-4993-ae4e-1a5f0fb17918" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionsparseia&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" : "a855f27d-aaad-4cfc-ae74-670a934dde3e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc9f7-801e-001f-5b49-673bbb000000", + "Body" : "jtccontainersaspermissionsparseiajtccontainersaspermissionsparseia0659301b61be72769dMon, 09 Sep 2019 19:59:03 GMT\"0x8D735602A4717A8\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:03 GMT", + "x-ms-client-request-id" : "a855f27d-aaad-4cfc-ae74-670a934dde3e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionsparseia0659301b61be72769d?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" : "303a5753-e1cc-4480-bd27-f37dc4f65e59" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fca0b-801e-001f-6e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:03 GMT", + "x-ms-client-request-id" : "303a5753-e1cc-4480-bd27-f37dc4f65e59" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionsparseia0659301b61be72769d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[0].json new file mode 100644 index 000000000000..466b190063e7 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring04488219a94d86daf?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" : "fa856ca3-c6ad-4f82-8a04-3e060a3aaf49" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356027F8005A\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:59 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc532-801e-001f-6349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:59 GMT", + "x-ms-client-request-id" : "fa856ca3-c6ad-4f82-8a04-3e060a3aaf49" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&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" : "5a0c0f20-aa2e-4f05-affd-9662134e320a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc53d-801e-001f-6c49-673bbb000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring04488219a94d86dafMon, 09 Sep 2019 19:58:59 GMT\"0x8D7356027F8005A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:59 GMT", + "x-ms-client-request-id" : "5a0c0f20-aa2e-4f05-affd-9662134e320a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring04488219a94d86daf?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" : "61d07736-8e52-4dc7-9e53-8b6cbd08b421" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc54e-801e-001f-7b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:59 GMT", + "x-ms-client-request-id" : "61d07736-8e52-4dc7-9e53-8b6cbd08b421" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring04488219a94d86daf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[1].json new file mode 100644 index 000000000000..c5d062c31dfb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring080012e251ba026d1?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" : "abe0ac64-5ec1-4d0f-9692-1638fdcefe7f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560281E53FA\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc564-801e-001f-1049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:59 GMT", + "x-ms-client-request-id" : "abe0ac64-5ec1-4d0f-9692-1638fdcefe7f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&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" : "675d8691-88be-4e25-a858-a91408dc1eb9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc575-801e-001f-1f49-673bbb000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring080012e251ba026d1Mon, 09 Sep 2019 19:59:00 GMT\"0x8D73560281E53FA\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:59 GMT", + "x-ms-client-request-id" : "675d8691-88be-4e25-a858-a91408dc1eb9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring080012e251ba026d1?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" : "9fdf854e-52c2-40c9-b851-8adef785db17" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc586-801e-001f-3049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:59 GMT", + "x-ms-client-request-id" : "9fdf854e-52c2-40c9-b851-8adef785db17" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring080012e251ba026d1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[2].json new file mode 100644 index 000000000000..ede631e12954 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring0991366be4c919994?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" : "2a026714-c063-4f37-89ea-a6bffa218e90" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356028448091\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc59a-801e-001f-4249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:00 GMT", + "x-ms-client-request-id" : "2a026714-c063-4f37-89ea-a6bffa218e90" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&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" : "93325c75-c043-4c75-acfa-97dd96291a40" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc5af-801e-001f-5649-673bbb000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring0991366be4c919994Mon, 09 Sep 2019 19:59:00 GMT\"0x8D7356028448091\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:00 GMT", + "x-ms-client-request-id" : "93325c75-c043-4c75-acfa-97dd96291a40", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring0991366be4c919994?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" : "78a49a5a-629d-479b-88ba-eee6aedd516e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc5cc-801e-001f-7149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:00 GMT", + "x-ms-client-request-id" : "78a49a5a-629d-479b-88ba-eee6aedd516e" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring0991366be4c919994" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[3].json new file mode 100644 index 000000000000..efd41d25e242 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[3].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring012045bffedb60f6e?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" : "fc50382c-42a0-48df-a491-49df2d0650fe" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356028713E06\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc5f7-801e-001f-1a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:00 GMT", + "x-ms-client-request-id" : "fc50382c-42a0-48df-a491-49df2d0650fe" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&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" : "9c075fdf-a0df-40fd-acda-e45a6ba64cfe" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc606-801e-001f-2849-673bbb000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring012045bffedb60f6eMon, 09 Sep 2019 19:59:00 GMT\"0x8D7356028713E06\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:00 GMT", + "x-ms-client-request-id" : "9c075fdf-a0df-40fd-acda-e45a6ba64cfe", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring012045bffedb60f6e?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" : "23a8dc5b-dd5c-4a0b-a7b3-906612067373" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc626-801e-001f-4849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:00 GMT", + "x-ms-client-request-id" : "23a8dc5b-dd5c-4a0b-a7b3-906612067373" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring012045bffedb60f6e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[4].json new file mode 100644 index 000000000000..9904c990f58a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[4].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring0130252dc8c0a4853?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" : "08b4c99c-b636-41c6-9daa-9862720124ce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602897439A\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc660-801e-001f-7f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:00 GMT", + "x-ms-client-request-id" : "08b4c99c-b636-41c6-9daa-9862720124ce" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&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" : "ed548350-c7cf-4638-9a16-ebd28ec84ab6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc68e-801e-001f-2949-673bbb000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring0130252dc8c0a4853Mon, 09 Sep 2019 19:59:01 GMT\"0x8D735602897439A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:00 GMT", + "x-ms-client-request-id" : "ed548350-c7cf-4638-9a16-ebd28ec84ab6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring0130252dc8c0a4853?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" : "5e9bdb5b-4eaf-4f4d-818e-8bf4a42e98bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc6bb-801e-001f-5449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:00 GMT", + "x-ms-client-request-id" : "5e9bdb5b-4eaf-4f4d-818e-8bf4a42e98bf" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring0130252dc8c0a4853" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[5].json new file mode 100644 index 000000000000..a137a4c16e06 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[5].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring00834296d62113518?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" : "9c929323-db09-4feb-a67a-b8180726504a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356028C02FD7\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc6ed-801e-001f-0349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:00 GMT", + "x-ms-client-request-id" : "9c929323-db09-4feb-a67a-b8180726504a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&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" : "75cd0ab6-65aa-42b2-96d6-f10842e352d6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc700-801e-001f-1449-673bbb000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring00834296d62113518Mon, 09 Sep 2019 19:59:01 GMT\"0x8D7356028C02FD7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:00 GMT", + "x-ms-client-request-id" : "75cd0ab6-65aa-42b2-96d6-f10842e352d6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring00834296d62113518?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" : "083ecced-8c92-4121-ac63-d7b67caa1ad5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc707-801e-001f-1b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:00 GMT", + "x-ms-client-request-id" : "083ecced-8c92-4121-ac63-d7b67caa1ad5" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring00834296d62113518" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[6].json new file mode 100644 index 000000000000..1b524f47bb4a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestcontainersaspermissionstostring[6].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring0376841fb4e0205d9?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" : "4164937b-9ddc-43e1-938b-a9114ffa4aa8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356028E6AAA9\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:01 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc712-801e-001f-2549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:01 GMT", + "x-ms-client-request-id" : "4164937b-9ddc-43e1-938b-a9114ffa4aa8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtccontainersaspermissionstostring&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" : "38e2e66b-5493-4f45-9afe-128e609f14e0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc722-801e-001f-3449-673bbb000000", + "Body" : "jtccontainersaspermissionstostringjtccontainersaspermissionstostring0376841fb4e0205d9Mon, 09 Sep 2019 19:59:01 GMT\"0x8D7356028E6AAA9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:01 GMT", + "x-ms-client-request-id" : "38e2e66b-5493-4f45-9afe-128e609f14e0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtccontainersaspermissionstostring0376841fb4e0205d9?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" : "ee21e916-0808-4c8f-9252-ef0e00e6d28d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc734-801e-001f-4649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:01 GMT", + "x-ms-client-request-id" : "ee21e916-0808-4c8f-9252-ef0e00e6d28d" + }, + "Exception" : null + } ], + "variables" : [ "jtccontainersaspermissionstostring0376841fb4e0205d9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangeparse[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangeparse[0].json new file mode 100644 index 000000000000..8e79c1477c36 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangeparse[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtciprangeparse0sastestiprangeparsee4f16638b97024a8b5?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" : "9d355cbc-5d95-4583-8766-53c3f6f8d10d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602AE54949\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fcb64-801e-001f-2f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:04 GMT", + "x-ms-client-request-id" : "9d355cbc-5d95-4583-8766-53c3f6f8d10d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtciprangeparse&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" : "3cbe4482-68f7-4de3-82d9-b91336d36ac6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fcb7e-801e-001f-4649-673bbb000000", + "Body" : "jtciprangeparsejtciprangeparse0sastestiprangeparsee4f16638b97024a8b5Mon, 09 Sep 2019 19:59:04 GMT\"0x8D735602AE54949\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:04 GMT", + "x-ms-client-request-id" : "3cbe4482-68f7-4de3-82d9-b91336d36ac6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtciprangeparse0sastestiprangeparsee4f16638b97024a8b5?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" : "584cff40-65fe-43bf-8846-f8593e086273" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fcb97-801e-001f-5e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:04 GMT", + "x-ms-client-request-id" : "584cff40-65fe-43bf-8846-f8593e086273" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangeparse0sastestiprangeparsee4f16638b97024a8b5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangeparse[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangeparse[1].json new file mode 100644 index 000000000000..60d10cf33667 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangeparse[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtciprangeparse0sastestiprangeparse4d4583598e47313d42?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" : "ce55fe6c-ae52-4f0c-be5a-affc36c53f1d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602B138DAE\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fcbbb-801e-001f-8049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:04 GMT", + "x-ms-client-request-id" : "ce55fe6c-ae52-4f0c-be5a-affc36c53f1d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtciprangeparse&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" : "ced75962-8163-4860-adf9-b26a0ea8a668" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fcbcf-801e-001f-1049-673bbb000000", + "Body" : "jtciprangeparsejtciprangeparse0sastestiprangeparse4d4583598e47313d42Mon, 09 Sep 2019 19:59:05 GMT\"0x8D735602B138DAE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:04 GMT", + "x-ms-client-request-id" : "ced75962-8163-4860-adf9-b26a0ea8a668", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtciprangeparse0sastestiprangeparse4d4583598e47313d42?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" : "73d62650-8037-4b35-9015-43728bec7828" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fcbe1-801e-001f-2149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:04 GMT", + "x-ms-client-request-id" : "73d62650-8037-4b35-9015-43728bec7828" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangeparse0sastestiprangeparse4d4583598e47313d42" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangeparse[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangeparse[2].json new file mode 100644 index 000000000000..14990f5afc74 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangeparse[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtciprangeparse0sastestiprangeparse4a4704477275f823be?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" : "3670a273-f6ff-4245-9f55-41aae721a03b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602B3B6854\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fcbf8-801e-001f-3249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:04 GMT", + "x-ms-client-request-id" : "3670a273-f6ff-4245-9f55-41aae721a03b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtciprangeparse&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" : "ffa77563-4634-4656-ad53-5d891a3ba45b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fcc13-801e-001f-4b49-673bbb000000", + "Body" : "jtciprangeparsejtciprangeparse0sastestiprangeparse4a4704477275f823beMon, 09 Sep 2019 19:59:05 GMT\"0x8D735602B3B6854\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:05 GMT", + "x-ms-client-request-id" : "ffa77563-4634-4656-ad53-5d891a3ba45b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtciprangeparse0sastestiprangeparse4a4704477275f823be?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" : "025ed4ab-d3a8-4f9e-ac36-c405abe64245" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fcc2b-801e-001f-6349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:05 GMT", + "x-ms-client-request-id" : "025ed4ab-d3a8-4f9e-ac36-c405abe64245" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangeparse0sastestiprangeparse4a4704477275f823be" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangetostring[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangetostring[0].json new file mode 100644 index 000000000000..275631af11d6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangetostring[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtciprangetostring0sastestiprangetostringd6873978c6f2270?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" : "0926046d-20c0-4044-837f-003e70f78891" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602A6CF612\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fca28-801e-001f-0a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:03 GMT", + "x-ms-client-request-id" : "0926046d-20c0-4044-837f-003e70f78891" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtciprangetostring&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" : "fd27741b-3940-48b6-bd21-ccb7be4567d7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fca4a-801e-001f-2b49-673bbb000000", + "Body" : "jtciprangetostringjtciprangetostring0sastestiprangetostringd6873978c6f2270Mon, 09 Sep 2019 19:59:04 GMT\"0x8D735602A6CF612\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:03 GMT", + "x-ms-client-request-id" : "fd27741b-3940-48b6-bd21-ccb7be4567d7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtciprangetostring0sastestiprangetostringd6873978c6f2270?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" : "d93ba99d-1191-4e19-9694-f4ce90252c85" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fca6c-801e-001f-4a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:03 GMT", + "x-ms-client-request-id" : "d93ba99d-1191-4e19-9694-f4ce90252c85" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangetostring0sastestiprangetostringd6873978c6f2270" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangetostring[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangetostring[1].json new file mode 100644 index 000000000000..695bda2959b3 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangetostring[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtciprangetostring0sastestiprangetostring5b4050523417508?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" : "399bda70-fb0a-4c57-a014-7513d93c378c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602A951ED0\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fca8a-801e-001f-6749-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:03 GMT", + "x-ms-client-request-id" : "399bda70-fb0a-4c57-a014-7513d93c378c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtciprangetostring&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" : "8bbabc06-6f0b-4f1d-b1bc-ed9a710553fc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fcabe-801e-001f-1949-673bbb000000", + "Body" : "jtciprangetostringjtciprangetostring0sastestiprangetostring5b4050523417508Mon, 09 Sep 2019 19:59:04 GMT\"0x8D735602A951ED0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:03 GMT", + "x-ms-client-request-id" : "8bbabc06-6f0b-4f1d-b1bc-ed9a710553fc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtciprangetostring0sastestiprangetostring5b4050523417508?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" : "39e76ed1-b082-4d49-98b6-56a1b200d092" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fcad3-801e-001f-2c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:04 GMT", + "x-ms-client-request-id" : "39e76ed1-b082-4d49-98b6-56a1b200d092" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangetostring0sastestiprangetostring5b4050523417508" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangetostring[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangetostring[2].json new file mode 100644 index 000000000000..ee9634014546 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestiprangetostring[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtciprangetostring0sastestiprangetostring35a4956128d1dd8?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" : "3bb28450-c086-4609-ba5e-dbed07032ec4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602ABCD24A\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:04 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fcaee-801e-001f-4549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:04 GMT", + "x-ms-client-request-id" : "3bb28450-c086-4609-ba5e-dbed07032ec4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtciprangetostring&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" : "c57e6336-5d78-448c-a1bd-c93dccb10a12" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fcb19-801e-001f-6d49-673bbb000000", + "Body" : "jtciprangetostringjtciprangetostring0sastestiprangetostring35a4956128d1dd8Mon, 09 Sep 2019 19:59:04 GMT\"0x8D735602ABCD24A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:04 GMT", + "x-ms-client-request-id" : "c57e6336-5d78-448c-a1bd-c93dccb10a12", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtciprangetostring0sastestiprangetostring35a4956128d1dd8?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" : "0d5c249b-9aac-4100-b77a-d381b1967adc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fcb42-801e-001f-1449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:04 GMT", + "x-ms-client-request-id" : "0d5c249b-9aac-4100-b77a-d381b1967adc" + }, + "Exception" : null + } ], + "variables" : [ "jtciprangetostring0sastestiprangetostring35a4956128d1dd8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestrequestproperty.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestrequestproperty.json new file mode 100644 index 000000000000..f80396e8882c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestrequestproperty.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "http://gapradev.blob.core.windows.net/jtcrequestproperty0sastestrequestproperty53614060dd58c9d?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" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72C9B4DE8A233\"", + "Last-Modified" : "Thu, 29 Aug 2019 16:09:43 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "1f7d2539-501e-000b-6984-5e6950000000", + "Date" : "Thu, 29 Aug 2019 16:09:42 GMT", + "x-ms-client-request-id" : "2ed15590-99d8-49ca-9193-703aff9e8e01" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "http://gapradev.blob.core.windows.net/jtcrequestproperty0sastestrequestproperty53614060dd58c9d?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" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "1f7d253c-501e-000b-6a84-5e6950000000", + "Date" : "Thu, 29 Aug 2019 16:09:42 GMT", + "x-ms-client-request-id" : "1df543eb-94d4-48db-8bd1-a47b445c71a5" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://gapradev.blob.core.windows.net?prefix=jtcrequestproperty&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" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "96b448c0-301e-001d-4c84-5e9f87000000", + "Body" : "jtcrequestproperty", + "Date" : "Thu, 29 Aug 2019 16:09:43 GMT", + "x-ms-client-request-id" : "d5224ee5-69ab-4ef2-afc9-00afe308ab2b", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "jtcrequestproperty0sastestrequestproperty53614060dd58c9d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestsasprotocolparse[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestsasprotocolparse[0].json new file mode 100644 index 000000000000..6f5be04d6699 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestsasprotocolparse[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsasprotocolparse0sastestsasprotocolparse161799809c27e4?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" : "e2ad7122-7490-4393-8500-b20339f149dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602B6146CE\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:05 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fcc42-801e-001f-7649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:05 GMT", + "x-ms-client-request-id" : "e2ad7122-7490-4393-8500-b20339f149dc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsasprotocolparse&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" : "b42ebb0e-32dd-4b5e-889d-d5a779f863c9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fcc4e-801e-001f-0149-673bbb000000", + "Body" : "jtcsasprotocolparsejtcsasprotocolparse0sastestsasprotocolparse161799809c27e4Mon, 09 Sep 2019 19:59:05 GMT\"0x8D735602B6146CE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:05 GMT", + "x-ms-client-request-id" : "b42ebb0e-32dd-4b5e-889d-d5a779f863c9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsasprotocolparse0sastestsasprotocolparse161799809c27e4?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" : "708ef851-2a93-4f99-bb89-09e65c91d9ed" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fcc6d-801e-001f-1f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:05 GMT", + "x-ms-client-request-id" : "708ef851-2a93-4f99-bb89-09e65c91d9ed" + }, + "Exception" : null + } ], + "variables" : [ "jtcsasprotocolparse0sastestsasprotocolparse161799809c27e4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestsasprotocolparse[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestsasprotocolparse[1].json new file mode 100644 index 000000000000..f795195d3a65 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestsasprotocolparse[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsasprotocolparse0sastestsasprotocolparse0f137733bdfa19?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" : "2c5665b6-bf7f-425e-a601-ca779c412cb0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602B8EC7C7\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fccb1-801e-001f-5e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:05 GMT", + "x-ms-client-request-id" : "2c5665b6-bf7f-425e-a601-ca779c412cb0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsasprotocolparse&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" : "106c2774-42da-41ef-8311-1f2188536517" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fccec-801e-001f-1549-673bbb000000", + "Body" : "jtcsasprotocolparsejtcsasprotocolparse0sastestsasprotocolparse0f137733bdfa19Mon, 09 Sep 2019 19:59:06 GMT\"0x8D735602B8EC7C7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:05 GMT", + "x-ms-client-request-id" : "106c2774-42da-41ef-8311-1f2188536517", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsasprotocolparse0sastestsasprotocolparse0f137733bdfa19?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" : "e757901e-3d54-411a-bcfd-783014a26afc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fcd0c-801e-001f-3349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:05 GMT", + "x-ms-client-request-id" : "e757901e-3d54-411a-bcfd-783014a26afc" + }, + "Exception" : null + } ], + "variables" : [ "jtcsasprotocolparse0sastestsasprotocolparse0f137733bdfa19" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[0].json new file mode 100644 index 000000000000..ce04f457de03 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign0953625449176f5f5?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" : "68fed8ba-f72c-4d48-b0f6-856c4fe33398" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602148B936\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fbc99-801e-001f-1548-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:48 GMT", + "x-ms-client-request-id" : "68fed8ba-f72c-4d48-b0f6-856c4fe33398" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&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" : "5b36bd6d-6e89-40b5-8b4d-78269195abc1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fbcaf-801e-001f-2948-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign0953625449176f5f5Mon, 09 Sep 2019 19:58:48 GMT\"0x8D735602148B936\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:48 GMT", + "x-ms-client-request-id" : "5b36bd6d-6e89-40b5-8b4d-78269195abc1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign0953625449176f5f5?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" : "d8e42698-7974-4a52-bc97-c70299703b2a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fbcb9-801e-001f-3348-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:48 GMT", + "x-ms-client-request-id" : "d8e42698-7974-4a52-bc97-c70299703b2a" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign0953625449176f5f5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[1].json new file mode 100644 index 000000000000..e98f0fb0ac57 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign014410924ec2718dc?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" : "f8293edf-d823-450e-8d88-94eaf0139e4c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560217268ED\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fbcc8-801e-001f-4248-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:48 GMT", + "x-ms-client-request-id" : "f8293edf-d823-450e-8d88-94eaf0139e4c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&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" : "08a6084b-65ee-4122-b979-0a6b119ca5e7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fbce3-801e-001f-5b48-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign014410924ec2718dcMon, 09 Sep 2019 19:58:49 GMT\"0x8D73560217268ED\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:48 GMT", + "x-ms-client-request-id" : "08a6084b-65ee-4122-b979-0a6b119ca5e7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign014410924ec2718dc?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" : "2b7a2b93-1201-421a-ae4a-550c89f26d30" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fbcea-801e-001f-6148-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:48 GMT", + "x-ms-client-request-id" : "2b7a2b93-1201-421a-ae4a-550c89f26d30" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign014410924ec2718dc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[2].json new file mode 100644 index 000000000000..66190dad8735 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign07370235ea40f45f9?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" : "eccbcb32-2d43-48c3-b478-8c544a765da1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356021A122B5\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fbcfe-801e-001f-7148-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:48 GMT", + "x-ms-client-request-id" : "eccbcb32-2d43-48c3-b478-8c544a765da1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&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" : "6491643c-583d-4afc-9302-1879886df127" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fbd0e-801e-001f-7e48-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign07370235ea40f45f9Mon, 09 Sep 2019 19:58:49 GMT\"0x8D7356021A122B5\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:48 GMT", + "x-ms-client-request-id" : "6491643c-583d-4afc-9302-1879886df127", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign07370235ea40f45f9?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" : "11649a9e-6de9-491d-9fdd-81e4a8a0f5bf" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fbd19-801e-001f-0748-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:49 GMT", + "x-ms-client-request-id" : "11649a9e-6de9-491d-9fdd-81e4a8a0f5bf" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign07370235ea40f45f9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[3].json new file mode 100644 index 000000000000..30edde607d89 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[3].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign0563879fcd0b4012b?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" : "842871ed-423f-4611-9223-831457452b4e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356021C88801\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fbd29-801e-001f-1748-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:49 GMT", + "x-ms-client-request-id" : "842871ed-423f-4611-9223-831457452b4e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&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" : "8e4a3a18-50c2-4bd7-8944-181ceb5224f0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fbd41-801e-001f-2a48-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign0563879fcd0b4012bMon, 09 Sep 2019 19:58:49 GMT\"0x8D7356021C88801\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:49 GMT", + "x-ms-client-request-id" : "8e4a3a18-50c2-4bd7-8944-181ceb5224f0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign0563879fcd0b4012b?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" : "f47d692e-3af3-4e91-98c1-cfec5f59aa78" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fbd58-801e-001f-3f48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:49 GMT", + "x-ms-client-request-id" : "f47d692e-3af3-4e91-98c1-cfec5f59aa78" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign0563879fcd0b4012b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[4].json new file mode 100644 index 000000000000..c8a20946a633 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[4].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign0086643643972844a?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" : "b0eaa8e2-e58c-4d9a-b098-1c7f5df7329b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356021F25ECC\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fbd64-801e-001f-4a48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:49 GMT", + "x-ms-client-request-id" : "b0eaa8e2-e58c-4d9a-b098-1c7f5df7329b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&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" : "bee439b1-c782-4681-bab6-2c6e0d0f26d5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fbd72-801e-001f-5648-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign0086643643972844aMon, 09 Sep 2019 19:58:49 GMT\"0x8D7356021F25ECC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:49 GMT", + "x-ms-client-request-id" : "bee439b1-c782-4681-bab6-2c6e0d0f26d5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign0086643643972844a?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" : "b7b37dbf-46c0-4b9b-8036-80c55b5582ab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fbd7d-801e-001f-5d48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:49 GMT", + "x-ms-client-request-id" : "b7b37dbf-46c0-4b9b-8036-80c55b5582ab" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign0086643643972844a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[5].json new file mode 100644 index 000000000000..bc99ec709d0c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[5].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign089085f6cb8b514ea?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" : "6dce4430-92a4-4baa-9279-ae926052a20f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356022186442\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fbd92-801e-001f-6f48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:49 GMT", + "x-ms-client-request-id" : "6dce4430-92a4-4baa-9279-ae926052a20f" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&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" : "5a4b129f-28ad-46bb-8b51-227c6c8a91f1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fbd9b-801e-001f-7748-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign089085f6cb8b514eaMon, 09 Sep 2019 19:58:50 GMT\"0x8D7356022186442\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:49 GMT", + "x-ms-client-request-id" : "5a4b129f-28ad-46bb-8b51-227c6c8a91f1", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign089085f6cb8b514ea?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" : "18e4f7ab-10c8-48de-a7db-ee3af9218647" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fbda1-801e-001f-7d48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:49 GMT", + "x-ms-client-request-id" : "18e4f7ab-10c8-48de-a7db-ee3af9218647" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign089085f6cb8b514ea" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[6].json new file mode 100644 index 000000000000..87f103406f56 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[6].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign0750973d820efefcc?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" : "f8e2a906-9696-48f0-89da-56a56f81f724" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356022456FEC\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fbdbd-801e-001f-1548-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:49 GMT", + "x-ms-client-request-id" : "f8e2a906-9696-48f0-89da-56a56f81f724" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&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" : "eb085fc3-e506-4401-a74a-d4b6d83f863a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fbdd9-801e-001f-2d48-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign0750973d820efefccMon, 09 Sep 2019 19:58:50 GMT\"0x8D7356022456FEC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:49 GMT", + "x-ms-client-request-id" : "eb085fc3-e506-4401-a74a-d4b6d83f863a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign0750973d820efefcc?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" : "3bc6e34d-9fca-48c0-a92e-68c0d9f01187" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fbe0e-801e-001f-5d48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:50 GMT", + "x-ms-client-request-id" : "3bc6e34d-9fca-48c0-a92e-68c0d9f01187" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign0750973d820efefcc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[7].json new file mode 100644 index 000000000000..796887f83289 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[7].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign021366e32370bfd83?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" : "0c251fcb-87fa-45dc-8ea9-db1fd711709b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602270F4A6\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fbe32-801e-001f-0148-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:50 GMT", + "x-ms-client-request-id" : "0c251fcb-87fa-45dc-8ea9-db1fd711709b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&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" : "94c0ef17-9c96-4963-a8fa-0a409aab5805" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fbe41-801e-001f-0c49-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign021366e32370bfd83Mon, 09 Sep 2019 19:58:50 GMT\"0x8D735602270F4A6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:50 GMT", + "x-ms-client-request-id" : "94c0ef17-9c96-4963-a8fa-0a409aab5805", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign021366e32370bfd83?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" : "dfbc1b7c-8276-4201-b49c-de4ad0f4cd5d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fbe4b-801e-001f-1649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:50 GMT", + "x-ms-client-request-id" : "dfbc1b7c-8276-4201-b49c-de4ad0f4cd5d" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign021366e32370bfd83" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[8].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[8].json new file mode 100644 index 000000000000..efdbbf902a84 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[8].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign028697d878c65b314?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" : "1fcc78a9-6484-4f5f-bb49-3060530b6268" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560229832E9\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fbe5a-801e-001f-2349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:50 GMT", + "x-ms-client-request-id" : "1fcc78a9-6484-4f5f-bb49-3060530b6268" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&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" : "9bc7538d-6c35-445c-b1a5-7ba122357ef2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fbe69-801e-001f-3149-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign028697d878c65b314Mon, 09 Sep 2019 19:58:50 GMT\"0x8D73560229832E9\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:50 GMT", + "x-ms-client-request-id" : "9bc7538d-6c35-445c-b1a5-7ba122357ef2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign028697d878c65b314?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" : "605e0a0e-43e8-41c8-8893-fd69f2c1f311" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fbe7c-801e-001f-4449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:50 GMT", + "x-ms-client-request-id" : "605e0a0e-43e8-41c8-8893-fd69f2c1f311" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign028697d878c65b314" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[9].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[9].json new file mode 100644 index 000000000000..15bede3fc9fd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosign[9].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign009754fb963dbadba?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" : "d05bbab7-d183-4abc-af26-8a30e0829599" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356022BE3874\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fbe86-801e-001f-4e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:50 GMT", + "x-ms-client-request-id" : "d05bbab7-d183-4abc-af26-8a30e0829599" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosign&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" : "4f257d53-fd2c-45a2-88bf-a5986fb3fd8c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fbe92-801e-001f-5949-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignjtcservicesassignaturesstringtosign009754fb963dbadbaMon, 09 Sep 2019 19:58:51 GMT\"0x8D7356022BE3874\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:50 GMT", + "x-ms-client-request-id" : "4f257d53-fd2c-45a2-88bf-a5986fb3fd8c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosign009754fb963dbadba?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" : "45ad439e-740b-4cac-95a7-6bd827712f7b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fbe99-801e-001f-5e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:50 GMT", + "x-ms-client-request-id" : "45ad439e-740b-4cac-95a7-6bd827712f7b" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosign009754fb963dbadba" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[0].json new file mode 100644 index 000000000000..c9782286e7a9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey05011966?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" : "f430ca90-83da-4978-a16b-a55b63527b10" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356022E61315\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fbea8-801e-001f-6c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:50 GMT", + "x-ms-client-request-id" : "f430ca90-83da-4978-a16b-a55b63527b10" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "27b61b80-5a61-4039-9bad-b81183d15373" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fbeca-801e-001f-0b49-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey05011966Mon, 09 Sep 2019 19:58:51 GMT\"0x8D7356022E61315\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:51 GMT", + "x-ms-client-request-id" : "27b61b80-5a61-4039-9bad-b81183d15373", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey05011966?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" : "b045a6bc-c14a-462d-a81a-3f3e611bd259" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fbee3-801e-001f-2349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:51 GMT", + "x-ms-client-request-id" : "b045a6bc-c14a-462d-a81a-3f3e611bd259" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey05011966" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[10].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[10].json new file mode 100644 index 000000000000..fddb88337100 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[10].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey09270441?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" : "44b4bce0-dcfc-4805-97fa-8fbaa7c8ca92" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602478204E\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc0c4-801e-001f-5649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:53 GMT", + "x-ms-client-request-id" : "44b4bce0-dcfc-4805-97fa-8fbaa7c8ca92" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "e61519b9-a9f1-4746-8103-4123bcb278ea" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc0d0-801e-001f-6149-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey09270441Mon, 09 Sep 2019 19:58:54 GMT\"0x8D735602478204E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:53 GMT", + "x-ms-client-request-id" : "e61519b9-a9f1-4746-8103-4123bcb278ea", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey09270441?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" : "19f958b9-4e75-4c4a-a4c7-d9f2e891cf0e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc0db-801e-001f-6b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:53 GMT", + "x-ms-client-request-id" : "19f958b9-4e75-4c4a-a4c7-d9f2e891cf0e" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey09270441" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[11].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[11].json new file mode 100644 index 000000000000..1ac2c5e366c5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[11].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey09215348?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" : "75cd4dd7-7180-40e9-8b17-4d8d0a51a8ef" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560249F85A7\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc0e2-801e-001f-7149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:53 GMT", + "x-ms-client-request-id" : "75cd4dd7-7180-40e9-8b17-4d8d0a51a8ef" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "88472d39-323d-4841-8bc1-5ea96dd9d88c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc0eb-801e-001f-7949-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey09215348Mon, 09 Sep 2019 19:58:54 GMT\"0x8D73560249F85A7\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:53 GMT", + "x-ms-client-request-id" : "88472d39-323d-4841-8bc1-5ea96dd9d88c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey09215348?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" : "128346ea-9f96-422c-ba7c-7be894f38df6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc0f5-801e-001f-0349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:54 GMT", + "x-ms-client-request-id" : "128346ea-9f96-422c-ba7c-7be894f38df6" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey09215348" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[12].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[12].json new file mode 100644 index 000000000000..5924f2ef4dc5 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[12].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey040252d4?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" : "799dacae-b615-4507-ba96-80f52a0ba3a3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356024C5B250\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc108-801e-001f-1449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:54 GMT", + "x-ms-client-request-id" : "799dacae-b615-4507-ba96-80f52a0ba3a3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "75de8ce9-19dd-491b-9cd9-5c30ba57a070" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc11b-801e-001f-2549-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey040252d4Mon, 09 Sep 2019 19:58:54 GMT\"0x8D7356024C5B250\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:54 GMT", + "x-ms-client-request-id" : "75de8ce9-19dd-491b-9cd9-5c30ba57a070", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey040252d4?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" : "7200dccb-bbcc-4d8b-973a-f264a00ed3d0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc12d-801e-001f-3549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:54 GMT", + "x-ms-client-request-id" : "7200dccb-bbcc-4d8b-973a-f264a00ed3d0" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey040252d4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[13].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[13].json new file mode 100644 index 000000000000..9c9d9ac86abd --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[13].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey09680291?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" : "7e50ab2e-f648-4d6d-b85c-2b853816e505" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356024EFB035\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc13b-801e-001f-4349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:54 GMT", + "x-ms-client-request-id" : "7e50ab2e-f648-4d6d-b85c-2b853816e505" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "92a7e034-f52d-4649-89b8-ad6504b06503" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc148-801e-001f-4f49-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey09680291Mon, 09 Sep 2019 19:58:54 GMT\"0x8D7356024EFB035\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:54 GMT", + "x-ms-client-request-id" : "92a7e034-f52d-4649-89b8-ad6504b06503", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey09680291?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" : "ee3e6661-0faf-4794-8910-9d4aa5acb40a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc155-801e-001f-5b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:54 GMT", + "x-ms-client-request-id" : "ee3e6661-0faf-4794-8910-9d4aa5acb40a" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey09680291" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[14].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[14].json new file mode 100644 index 000000000000..dcaea2ecd176 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[14].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0784337b?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" : "b63292fc-0523-46d1-ac42-3eb14334b7b6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356025165221\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc184-801e-001f-0449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:54 GMT", + "x-ms-client-request-id" : "b63292fc-0523-46d1-ac42-3eb14334b7b6" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "2a98cfc7-ae5b-4b6a-b9a7-0193fffb16a2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc18d-801e-001f-0c49-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0784337bMon, 09 Sep 2019 19:58:55 GMT\"0x8D7356025165221\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:54 GMT", + "x-ms-client-request-id" : "2a98cfc7-ae5b-4b6a-b9a7-0193fffb16a2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0784337b?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" : "6e58764b-c1ab-433e-b07a-25cc8a926047" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc196-801e-001f-1449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:54 GMT", + "x-ms-client-request-id" : "6e58764b-c1ab-433e-b07a-25cc8a926047" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0784337b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[1].json new file mode 100644 index 000000000000..4d1a73293046 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey04263110?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" : "67eb0d14-74d5-432b-bb30-876d8a324f51" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560230F4D92\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fbef1-801e-001f-3149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:51 GMT", + "x-ms-client-request-id" : "67eb0d14-74d5-432b-bb30-876d8a324f51" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "f80cb80b-1728-451d-bec8-1db49fe7b576" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fbefe-801e-001f-3d49-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey04263110Mon, 09 Sep 2019 19:58:51 GMT\"0x8D73560230F4D92\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:51 GMT", + "x-ms-client-request-id" : "f80cb80b-1728-451d-bec8-1db49fe7b576", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey04263110?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" : "820c05af-4434-403e-918f-053b66a2eb2a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fbf0c-801e-001f-4a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:51 GMT", + "x-ms-client-request-id" : "820c05af-4434-403e-918f-053b66a2eb2a" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey04263110" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[2].json new file mode 100644 index 000000000000..79537ba9b044 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0051833b?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" : "2df20c5a-2e4a-43ca-b291-9cc86931a36b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602336DA04\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fbf1a-801e-001f-5849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:51 GMT", + "x-ms-client-request-id" : "2df20c5a-2e4a-43ca-b291-9cc86931a36b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "202a0cca-0d75-45cc-bda8-4c8a56711b8b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fbf34-801e-001f-6e49-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0051833bMon, 09 Sep 2019 19:58:52 GMT\"0x8D735602336DA04\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:51 GMT", + "x-ms-client-request-id" : "202a0cca-0d75-45cc-bda8-4c8a56711b8b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0051833b?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" : "16e8f3ba-85d4-4f55-9460-04b418a3adce" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fbf56-801e-001f-0b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:51 GMT", + "x-ms-client-request-id" : "16e8f3ba-85d4-4f55-9460-04b418a3adce" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0051833b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[3].json new file mode 100644 index 000000000000..c601c2e003e9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[3].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey08128520?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" : "3d8bbbf0-ca87-41f5-83f2-0d4a9471e9bd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602365BAD0\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fbf7d-801e-001f-2b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:51 GMT", + "x-ms-client-request-id" : "3d8bbbf0-ca87-41f5-83f2-0d4a9471e9bd" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "32b993a3-d7df-4e37-97f1-12612f621092" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fbf89-801e-001f-3649-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey08128520Mon, 09 Sep 2019 19:58:52 GMT\"0x8D735602365BAD0\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:51 GMT", + "x-ms-client-request-id" : "32b993a3-d7df-4e37-97f1-12612f621092", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey08128520?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" : "01574fc9-b4c9-4a80-824a-654a982138e8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fbf9a-801e-001f-4649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:51 GMT", + "x-ms-client-request-id" : "01574fc9-b4c9-4a80-824a-654a982138e8" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey08128520" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[4].json new file mode 100644 index 000000000000..ac60717b527f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[4].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0505548b?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" : "2227d601-d81a-4a46-bd3c-32df345e96ec" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560238D6E5C\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fbfb4-801e-001f-5c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:52 GMT", + "x-ms-client-request-id" : "2227d601-d81a-4a46-bd3c-32df345e96ec" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "fb44a843-26fa-4ed8-aaf0-cb8aed2e01f5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fbfcd-801e-001f-7349-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0505548bMon, 09 Sep 2019 19:58:52 GMT\"0x8D73560238D6E5C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:52 GMT", + "x-ms-client-request-id" : "fb44a843-26fa-4ed8-aaf0-cb8aed2e01f5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0505548b?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" : "ba28ae46-73c1-424a-ab03-f58aa9b9c60b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fbfe7-801e-001f-0a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:52 GMT", + "x-ms-client-request-id" : "ba28ae46-73c1-424a-ab03-f58aa9b9c60b" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0505548b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[5].json new file mode 100644 index 000000000000..2e13aeb7d5da --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[5].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey03900133?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" : "a805d9a3-0b28-48f0-afc7-e0dd59db0fa9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356023B39B03\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fbff3-801e-001f-1549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:52 GMT", + "x-ms-client-request-id" : "a805d9a3-0b28-48f0-afc7-e0dd59db0fa9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "036ecea4-df46-47c6-b560-1580a34be5b3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fbffe-801e-001f-1f49-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey03900133Mon, 09 Sep 2019 19:58:52 GMT\"0x8D7356023B39B03\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:52 GMT", + "x-ms-client-request-id" : "036ecea4-df46-47c6-b560-1580a34be5b3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey03900133?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" : "536b4067-cc75-403e-acb1-8c68b69f6d8e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc00b-801e-001f-2c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:52 GMT", + "x-ms-client-request-id" : "536b4067-cc75-403e-acb1-8c68b69f6d8e" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey03900133" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[6].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[6].json new file mode 100644 index 000000000000..021e189a2e6c --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[6].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey080393db?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" : "0b54be1d-3073-45f2-8efb-16867493ae5d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356023DC390D\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc01e-801e-001f-3d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:52 GMT", + "x-ms-client-request-id" : "0b54be1d-3073-45f2-8efb-16867493ae5d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "c0159f40-acb5-4ad7-a035-fef1b9208ed9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc02e-801e-001f-4b49-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey080393dbMon, 09 Sep 2019 19:58:53 GMT\"0x8D7356023DC390D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:52 GMT", + "x-ms-client-request-id" : "c0159f40-acb5-4ad7-a035-fef1b9208ed9", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey080393db?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" : "f4717a0b-f6a8-4c16-a78a-fad5c31e2462" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc036-801e-001f-5349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:52 GMT", + "x-ms-client-request-id" : "f4717a0b-f6a8-4c16-a78a-fad5c31e2462" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey080393db" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[7].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[7].json new file mode 100644 index 000000000000..92de6f90db3e --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[7].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0675647c?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" : "79435438-0b04-4a00-a3e2-175da20d6b59" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356024026593\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc040-801e-001f-5b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:52 GMT", + "x-ms-client-request-id" : "79435438-0b04-4a00-a3e2-175da20d6b59" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "064d4a59-e730-46a6-8e68-358ddf9d7b27" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc04b-801e-001f-6549-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey0675647cMon, 09 Sep 2019 19:58:53 GMT\"0x8D7356024026593\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:52 GMT", + "x-ms-client-request-id" : "064d4a59-e730-46a6-8e68-358ddf9d7b27", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey0675647c?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" : "c2119fea-1f26-4387-b362-959cc9f7d0c3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc056-801e-001f-6f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:52 GMT", + "x-ms-client-request-id" : "c2119fea-1f26-4387-b362-959cc9f7d0c3" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey0675647c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[8].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[8].json new file mode 100644 index 000000000000..2b81765179db --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[8].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey012096b6?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" : "7f0df2bf-7b71-4145-9ea2-260ccf298a9c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356024290769\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc062-801e-001f-7b49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:53 GMT", + "x-ms-client-request-id" : "7f0df2bf-7b71-4145-9ea2-260ccf298a9c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "acb2033a-4141-432f-9937-63ef2f0a4cee" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc071-801e-001f-0849-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey012096b6Mon, 09 Sep 2019 19:58:53 GMT\"0x8D7356024290769\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:53 GMT", + "x-ms-client-request-id" : "acb2033a-4141-432f-9937-63ef2f0a4cee", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey012096b6?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" : "5b357c91-bb2e-486a-b2be-b18a8b6eb1d3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc07c-801e-001f-1349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:53 GMT", + "x-ms-client-request-id" : "5b357c91-bb2e-486a-b2be-b18a8b6eb1d3" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey012096b6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[9].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[9].json new file mode 100644 index 000000000000..0a2cd49facfb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturesstringtosignuserdelegationkey[9].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey049840d9?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" : "cff7a223-a8bc-4b33-808a-e54378797b85" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560244FF77A\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc087-801e-001f-1e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:53 GMT", + "x-ms-client-request-id" : "cff7a223-a8bc-4b33-808a-e54378797b85" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturesstringtosignuserdelegationkey&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" : "4a924dd6-10fa-4a04-906f-7bb191c654ad" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc094-801e-001f-2a49-673bbb000000", + "Body" : "jtcservicesassignaturesstringtosignuserdelegationkeyjtcservicesassignaturesstringtosignuserdelegationkey049840d9Mon, 09 Sep 2019 19:58:53 GMT\"0x8D73560244FF77A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:53 GMT", + "x-ms-client-request-id" : "4a924dd6-10fa-4a04-906f-7bb191c654ad", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturesstringtosignuserdelegationkey049840d9?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" : "bbed0ee8-1da1-4a33-b3ad-4eb8972d566f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc0a1-801e-001f-3549-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:53 GMT", + "x-ms-client-request-id" : "bbed0ee8-1da1-4a33-b3ad-4eb8972d566f" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturesstringtosignuserdelegationkey049840d9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[0].json new file mode 100644 index 000000000000..bdb8b4ef8591 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok0690881bb2ca?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" : "75a8a249-a14b-49cc-8677-9d8be57677b9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602BB51B80\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fcd23-801e-001f-4949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:05 GMT", + "x-ms-client-request-id" : "75a8a249-a14b-49cc-8677-9d8be57677b9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturevaluesassertgenerateok&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" : "ae273f86-6fd6-400d-a9ba-f5b8b0dd3a7a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fcd56-801e-001f-7b49-673bbb000000", + "Body" : "jtcservicesassignaturevaluesassertgenerateokjtcservicesassignaturevaluesassertgenerateok0690881bb2caMon, 09 Sep 2019 19:59:06 GMT\"0x8D735602BB51B80\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:05 GMT", + "x-ms-client-request-id" : "ae273f86-6fd6-400d-a9ba-f5b8b0dd3a7a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok0690881bb2ca?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" : "80df37b4-c22c-4366-afa8-e76b23f320cd" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fcd73-801e-001f-1849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:05 GMT", + "x-ms-client-request-id" : "80df37b4-c22c-4366-afa8-e76b23f320cd" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesassertgenerateok0690881bb2ca" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[1].json new file mode 100644 index 000000000000..e5fe4eb851f9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok00046735bb95?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" : "8b2fbb3f-a0b4-42a0-8ad1-887bb11e617b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602BDAD2E1\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fcd83-801e-001f-2849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:05 GMT", + "x-ms-client-request-id" : "8b2fbb3f-a0b4-42a0-8ad1-887bb11e617b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturevaluesassertgenerateok&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" : "216dc296-63aa-4041-9e6a-7a3754d491d3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fcd94-801e-001f-3849-673bbb000000", + "Body" : "jtcservicesassignaturevaluesassertgenerateokjtcservicesassignaturevaluesassertgenerateok00046735bb95Mon, 09 Sep 2019 19:59:06 GMT\"0x8D735602BDAD2E1\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:06 GMT", + "x-ms-client-request-id" : "216dc296-63aa-4041-9e6a-7a3754d491d3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok00046735bb95?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" : "1d8b5e5d-bdb0-4b36-9cef-3705a20b5a8a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fcdaa-801e-001f-4d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:06 GMT", + "x-ms-client-request-id" : "1d8b5e5d-bdb0-4b36-9cef-3705a20b5a8a" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesassertgenerateok00046735bb95" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[2].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[2].json new file mode 100644 index 000000000000..fe3755eda442 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[2].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok0687383c77d2?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" : "5a1b0076-c060-4096-aabb-ce28e8f1f9f0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602C0370FC\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:06 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fcdbf-801e-001f-6249-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:06 GMT", + "x-ms-client-request-id" : "5a1b0076-c060-4096-aabb-ce28e8f1f9f0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturevaluesassertgenerateok&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" : "e8aeabdf-0037-4932-8c52-f6d90cf9b3c3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fcdcc-801e-001f-6e49-673bbb000000", + "Body" : "jtcservicesassignaturevaluesassertgenerateokjtcservicesassignaturevaluesassertgenerateok0687383c77d2Mon, 09 Sep 2019 19:59:06 GMT\"0x8D735602C0370FC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:06 GMT", + "x-ms-client-request-id" : "e8aeabdf-0037-4932-8c52-f6d90cf9b3c3", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok0687383c77d2?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" : "c3034305-146c-4cce-8dfe-c0f1a9be68ae" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fcdda-801e-001f-7c49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:06 GMT", + "x-ms-client-request-id" : "c3034305-146c-4cce-8dfe-c0f1a9be68ae" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesassertgenerateok0687383c77d2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[3].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[3].json new file mode 100644 index 000000000000..86bd8dd7f915 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[3].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok0128973b74a5?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" : "dbbe1a96-149a-45e1-aabd-dd8e42fcd311" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602C29768B\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fcdeb-801e-001f-0d49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:06 GMT", + "x-ms-client-request-id" : "dbbe1a96-149a-45e1-aabd-dd8e42fcd311" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturevaluesassertgenerateok&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" : "fe9cdf95-151a-4c5d-a431-5d93d37d1539" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fce05-801e-001f-2349-673bbb000000", + "Body" : "jtcservicesassignaturevaluesassertgenerateokjtcservicesassignaturevaluesassertgenerateok0128973b74a5Mon, 09 Sep 2019 19:59:07 GMT\"0x8D735602C29768B\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:06 GMT", + "x-ms-client-request-id" : "fe9cdf95-151a-4c5d-a431-5d93d37d1539", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok0128973b74a5?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" : "74df8f3a-dfb6-43be-9a4e-0000055696f6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fce13-801e-001f-3149-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:06 GMT", + "x-ms-client-request-id" : "74df8f3a-dfb6-43be-9a4e-0000055696f6" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesassertgenerateok0128973b74a5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[4].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[4].json new file mode 100644 index 000000000000..4be62a70f618 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[4].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok005556474a88?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" : "1012211c-801d-457e-8875-e0d60c3068fa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602C4FCA45\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fce2b-801e-001f-4649-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:06 GMT", + "x-ms-client-request-id" : "1012211c-801d-457e-8875-e0d60c3068fa" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturevaluesassertgenerateok&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" : "ff0a0411-0dee-47be-8034-b00c9de75d36" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fce39-801e-001f-5249-673bbb000000", + "Body" : "jtcservicesassignaturevaluesassertgenerateokjtcservicesassignaturevaluesassertgenerateok005556474a88Mon, 09 Sep 2019 19:59:07 GMT\"0x8D735602C4FCA45\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:06 GMT", + "x-ms-client-request-id" : "ff0a0411-0dee-47be-8034-b00c9de75d36", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok005556474a88?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" : "e8f22443-c662-4592-be08-2c6932d6744a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fce40-801e-001f-5949-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:06 GMT", + "x-ms-client-request-id" : "e8f22443-c662-4592-be08-2c6932d6744a" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesassertgenerateok005556474a88" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[5].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[5].json new file mode 100644 index 000000000000..9362cdb75aae --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesassertgenerateok[5].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok06266203d670?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" : "1d7d4d64-4079-470a-a23d-2c6a2690b488" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602C75A8BF\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:07 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fce4b-801e-001f-6449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:06 GMT", + "x-ms-client-request-id" : "1d7d4d64-4079-470a-a23d-2c6a2690b488" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturevaluesassertgenerateok&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" : "168f6fff-2b07-45f2-bca0-7091fe55d8a4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fce62-801e-001f-7649-673bbb000000", + "Body" : "jtcservicesassignaturevaluesassertgenerateokjtcservicesassignaturevaluesassertgenerateok06266203d670Mon, 09 Sep 2019 19:59:07 GMT\"0x8D735602C75A8BF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:07 GMT", + "x-ms-client-request-id" : "168f6fff-2b07-45f2-bca0-7091fe55d8a4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesassertgenerateok06266203d670?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" : "77158692-6a4d-4de7-bee7-0ae20f438545" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fce72-801e-001f-0349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:07 GMT", + "x-ms-client-request-id" : "77158692-6a4d-4de7-bee7-0ae20f438545" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesassertgenerateok06266203d670" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluescanonicalizedresource.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluescanonicalizedresource.json new file mode 100644 index 000000000000..708309ebc413 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluescanonicalizedresource.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluescanonicalizedresource094558b2bb?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" : "e2790d26-fdf2-45dc-a9f0-b62e9c9e4bde" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560253D694C\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc1a6-801e-001f-2449-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:54 GMT", + "x-ms-client-request-id" : "e2790d26-fdf2-45dc-a9f0-b62e9c9e4bde" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturevaluescanonicalizedresource&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" : "4c647897-2337-49a2-b876-7d97dbb5104c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc1b8-801e-001f-3349-673bbb000000", + "Body" : "jtcservicesassignaturevaluescanonicalizedresourcejtcservicesassignaturevaluescanonicalizedresource094558b2bbMon, 09 Sep 2019 19:58:55 GMT\"0x8D73560253D694C\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:54 GMT", + "x-ms-client-request-id" : "4c647897-2337-49a2-b876-7d97dbb5104c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluescanonicalizedresource094558b2bb?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" : "9edc7e0b-7c16-4a4d-8291-91efbe15257f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc1c6-801e-001f-4049-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:55 GMT", + "x-ms-client-request-id" : "9edc7e0b-7c16-4a4d-8291-91efbe15257f" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluescanonicalizedresource094558b2bb", "javablobservicesassignaturevaluescanonicalizedresource1682037" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesia[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesia[0].json new file mode 100644 index 000000000000..0f6baa234437 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesia[0].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesia032452868c1ab3e37b4?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" : "5b2ee335-f009-4e7b-bfa7-f9d10ad5a4b4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356025678E54\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc1d9-801e-001f-5349-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:55 GMT", + "x-ms-client-request-id" : "5b2ee335-f009-4e7b-bfa7-f9d10ad5a4b4" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturevaluesia&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" : "32d74379-09cc-443c-af4f-4ca2ab0860a6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc1e6-801e-001f-5f49-673bbb000000", + "Body" : "jtcservicesassignaturevaluesiajtcservicesassignaturevaluesia032452868c1ab3e37b4Mon, 09 Sep 2019 19:58:55 GMT\"0x8D7356025678E54\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:55 GMT", + "x-ms-client-request-id" : "32d74379-09cc-443c-af4f-4ca2ab0860a6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesia032452868c1ab3e37b4?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" : "06de6f24-91cc-44da-b5cc-c1be01701c0b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc1f9-801e-001f-6f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:55 GMT", + "x-ms-client-request-id" : "06de6f24-91cc-44da-b5cc-c1be01701c0b" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesia032452868c1ab3e37b4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesia[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesia[1].json new file mode 100644 index 000000000000..42980736f7a2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesia[1].json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesia009852f59c90bcb0084?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" : "2cb69a50-2b74-4ded-9993-f8233decd397" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735602590054D\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fc209-801e-001f-7f49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:55 GMT", + "x-ms-client-request-id" : "2cb69a50-2b74-4ded-9993-f8233decd397" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcservicesassignaturevaluesia&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" : "eb1dcd5c-31ea-4f00-873e-88dc65b38ef0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fc213-801e-001f-0849-673bbb000000", + "Body" : "jtcservicesassignaturevaluesiajtcservicesassignaturevaluesia009852f59c90bcb0084Mon, 09 Sep 2019 19:58:55 GMT\"0x8D735602590054D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:58:55 GMT", + "x-ms-client-request-id" : "eb1dcd5c-31ea-4f00-873e-88dc65b38ef0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesia009852f59c90bcb0084?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" : "38c119a4-4ac1-4bd8-8c72-6977d5c7a980" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fc228-801e-001f-1a49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:55 GMT", + "x-ms-client-request-id" : "38c119a4-4ac1-4bd8-8c72-6977d5c7a980" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesia009852f59c90bcb0084" ] +} \ 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 new file mode 100644 index 000000000000..e16c1372f9fe --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestblob.json @@ -0,0 +1,160 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblob003141355f82b?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" + }, + "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", + "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" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblob003141355f82b/javablobservicesassignaturevaluesnetworktestblob178524a837", + "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", + "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", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:58:43 GMT", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "ETag" : "\"0x8D735601EADBDE7\"", + "Content-Length" : "0", + "x-ms-request-id" : "077fb9bd-801e-001f-0248-673bbb000000", + "x-ms-client-request-id" : "5d7bce00-b7eb-4cfb-9d7e-4767765e0e1e" + }, + "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", + "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" + }, + "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", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:58:44 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "cache", + "ETag" : "\"0x8D735601EADBDE7\"", + "Content-Disposition" : "disposition", + "x-ms-creation-time" : "Mon, 09 Sep 2019 19:58:44 GMT", + "Content-Length" : "4", + "x-ms-request-id" : "077fb9c8-801e-001f-0d48-673bbb000000", + "Body" : "test", + "x-ms-client-request-id" : "3621e8d1-07ad-4a77-9b32-0688da6a6c7c", + "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", + "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" + }, + "Response" : { + "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", + "retry-after" : "0", + "StatusCode" : "200", + "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", + "Cache-Control" : "cache", + "ETag" : "\"0x8D735601EADBDE7\"", + "Content-Disposition" : "disposition", + "x-ms-client-request-id" : "9954fa47-d98f-4a32-b1c0-0c4e08a86701", + "Content-Language" : "language" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.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" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "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", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblob003141355f82b?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" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fb9f9-801e-001f-3a48-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:44 GMT", + "x-ms-client-request-id" : "5b235243-b5b9-406d-bb86-bcc4a2b12faf" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesnetworktestblob003141355f82b", "javablobservicesassignaturevaluesnetworktestblob178524a837", "2019-09-09T19:58:44.488Z", "2019-09-09T19:58:44.488Z" ] +} \ 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 new file mode 100644 index 000000000000..ea02a54d1020 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestblobsnapshot.json @@ -0,0 +1,181 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot0657374b8?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" + }, + "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", + "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" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot0657374b8/javablobservicesassignaturevaluesnetworktestblobsnapshot127421", + "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", + "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", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Mon, 09 Sep 2019 19:58:44 GMT", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "ETag" : "\"0x8D735601F06C3B1\"", + "Content-Length" : "0", + "x-ms-request-id" : "077fba1f-801e-001f-5c48-673bbb000000", + "x-ms-client-request-id" : "28aa8177-e97e-4821-9098-bca5b45e2d87" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot0657374b8/javablobservicesassignaturevaluesnetworktestblobsnapshot127421?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" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-09-09T19:58:45.0714675Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735601F06C3B1\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:58:44 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fba31-801e-001f-6c48-673bbb000000", + "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" + }, + "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", + "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" + }, + "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", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:58:44 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\"", + "Content-Disposition" : "disposition", + "x-ms-creation-time" : "Mon, 09 Sep 2019 19:58:44 GMT", + "Content-Length" : "4", + "x-ms-request-id" : "077fba3f-801e-001f-7948-673bbb000000", + "Body" : "test", + "x-ms-client-request-id" : "eaa14bd4-a77d-4e57-bb1a-e871185dc046", + "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", + "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" + }, + "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", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Mon, 09 Sep 2019 19:58:44 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\"", + "Content-Disposition" : "disposition", + "Content-Encoding" : "encoding", + "x-ms-creation-time" : "Mon, 09 Sep 2019 19:58:44 GMT", + "Content-Length" : "4", + "x-ms-request-id" : "077fba4a-801e-001f-0148-673bbb000000", + "x-ms-client-request-id" : "23bc32d5-4ea8-4c7f-ae58-dc749bcef191", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.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" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "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", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshot0657374b8?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" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fba5e-801e-001f-1348-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:44 GMT", + "x-ms-client-request-id" : "41ad8387-fd4b-4d4c-a416-7867a9d5e7e8" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesnetworktestblobsnapshot0657374b8", "javablobservicesassignaturevaluesnetworktestblobsnapshot127421", "2019-09-09T19:58:45.176Z", "2019-09-09T19:58:45.176Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestblobsnapshotuserdelegation.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestblobsnapshotuserdelegation.json new file mode 100644 index 000000000000..d96e0c2380df --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestblobsnapshotuserdelegation.json @@ -0,0 +1,212 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshotus008324aa?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" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72C0D55339ED6\"", + "Last-Modified" : "Wed, 28 Aug 2019 23:13:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "70a674e5-001e-0039-3af6-5d6927000000", + "Date" : "Wed, 28 Aug 2019 23:13:26 GMT", + "x-ms-client-request-id" : "2a3456f7-af35-418a-b194-8f921822ec26" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshotus008324aa/78618ca78ff2473b9ab788a20f87870a968e47a82cfa4ba19ef8187d2878cff4", + "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", + "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" : "Wed, 28 Aug 2019 23:13:27 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Wed, 28 Aug 2019 23:13:26 GMT", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "ETag" : "\"0x8D72C0D5542F04F\"", + "Content-Length" : "0", + "x-ms-request-id" : "70a674e8-001e-0039-3cf6-5d6927000000", + "x-ms-client-request-id" : "5d8509a9-cb71-427c-b75a-31d86e3c2e69" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshotus008324aa/78618ca78ff2473b9ab788a20f87870a968e47a82cfa4ba19ef8187d2878cff4?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" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-snapshot" : "2019-08-28T23:13:27.3771774Z", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72C0D5542F04F\"", + "Last-Modified" : "Wed, 28 Aug 2019 23:13:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "70a674ea-001e-0039-3ef6-5d6927000000", + "x-ms-request-server-encrypted" : "false", + "Date" : "Wed, 28 Aug 2019 23:13:26 GMT", + "x-ms-client-request-id" : "0283c5f7-d694-4796-991e-d71a15fb41e1" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://gapradev.blob.core.windows.net?restype=service&comp=userdelegationkey", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "70a674f2-001e-0039-46f6-5d6927000000", + "Body" : "c3304b04-1047-4362-a718-c41b697ab96834a50b52-83c7-4aea-b81c-f6ef34b620f92019-08-27T23:13:27Z2019-08-29T23:13:27Zb2019-02-02UkVEQUNURUQ=", + "Date" : "Wed, 28 Aug 2019 23:13:27 GMT", + "x-ms-client-request-id" : "6bed151e-940d-4778-aab7-16163f80169c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshotus008324aa/78618ca78ff2473b9ab788a20f87870a968e47a82cfa4ba19ef8187d2878cff4?sv=2019-02-02&spr=https%2Chttp&st=2019-08-27T23%3A13%3A27Z&se=2019-08-29T23%3A13%3A27Z&sip=0.0.0.0-255.255.255.255&skoid=c4f48289-bb84-4086-b250-6f94a8f64cee&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2019-08-27T23%3A13%3A27Z&ske=2019-08-29T23%3A13%3A27Z&sks=b&skv=2019-02-02&sr=bs&sp=racwd&sig=REDACTED&rscc=cache&rscd=disposition&rsce=encoding&rscl=language&rsct=type", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "447", + "StatusCode" : "403", + "x-ms-request-id" : "70a674f4-001e-0039-48f6-5d6927000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:70a674f4-001e-0039-48f6-5d6927000000\nTime:2019-08-28T23:13:27.8527976ZThe specified signed resource is not allowed for the this resource level", + "Date" : "Wed, 28 Aug 2019 23:13:27 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshotus008324aa/78618ca78ff2473b9ab788a20f87870a968e47a82cfa4ba19ef8187d2878cff4?snapshot=2019-08-28T23%3a13%3a27.3771774Z&sv=2019-02-02&spr=https%2Chttp&st=2019-08-27T23%3A13%3A27Z&se=2019-08-29T23%3A13%3A27Z&sip=0.0.0.0-255.255.255.255&skoid=c4f48289-bb84-4086-b250-6f94a8f64cee&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2019-08-27T23%3A13%3A27Z&ske=2019-08-29T23%3A13%3A27Z&sks=b&skv=2019-02-02&sr=bs&sp=racwd&sig=REDACTED&rscc=cache&rscd=disposition&rsce=encoding&rscl=language&rsct=type", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Last-Modified" : "Wed, 28 Aug 2019 23:13:27 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Wed, 28 Aug 2019 23:13:27 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-snapshot" : "2019-08-28T23:13:27.3771774Z", + "Cache-Control" : "cache", + "ETag" : "\"0x8D72C0D5542F04F\"", + "Content-Disposition" : "disposition", + "x-ms-creation-time" : "Wed, 28 Aug 2019 23:13:27 GMT", + "Content-Length" : "4", + "x-ms-request-id" : "70a674f8-001e-0039-4af6-5d6927000000", + "Body" : "test", + "x-ms-client-request-id" : "eef79f15-fe00-42c3-b78e-4e576c1273f8", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://gapradev.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshotus008324aa/78618ca78ff2473b9ab788a20f87870a968e47a82cfa4ba19ef8187d2878cff4?snapshot=2019-08-28T23%3a13%3a27.3771774Z&sv=2019-02-02&spr=https%2Chttp&st=2019-08-27T23%3A13%3A27Z&se=2019-08-29T23%3A13%3A27Z&sip=0.0.0.0-255.255.255.255&skoid=c4f48289-bb84-4086-b250-6f94a8f64cee&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2019-08-27T23%3A13%3A27Z&ske=2019-08-29T23%3A13%3A27Z&sks=b&skv=2019-02-02&sr=bs&sp=racwd&sig=REDACTED&rscc=cache&rscd=disposition&rsce=encoding&rscl=language&rsct=type", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Last-Modified" : "Wed, 28 Aug 2019 23:13:27 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Wed, 28 Aug 2019 23:13:27 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-08-28T23:13:27.3771774Z", + "x-ms-access-tier" : "Hot", + "Cache-Control" : "cache", + "ETag" : "\"0x8D72C0D5542F04F\"", + "Content-Disposition" : "disposition", + "Content-Encoding" : "encoding", + "x-ms-creation-time" : "Wed, 28 Aug 2019 23:13:27 GMT", + "Content-Length" : "4", + "x-ms-request-id" : "70a674fa-001e-0039-4cf6-5d6927000000", + "x-ms-client-request-id" : "cb831f15-404e-4c86-8aeb-1a238292083a", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcservicesassignaturevaluesnetworktestblobsnapshotus&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" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "70a674fc-001e-0039-4df6-5d6927000000", + "Body" : "jtcservicesassignaturevaluesnetworktestblobsnapshotusjtcservicesassignaturevaluesnetworktestblobsnapshotus008324aaWed, 28 Aug 2019 23:13:27 GMT\"0x8D72C0D55339ED6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Wed, 28 Aug 2019 23:13:27 GMT", + "x-ms-client-request-id" : "5cd5cc9c-78cb-4c79-87a8-32a48ccc5f55", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobsnapshotus008324aa?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" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "70a674fd-001e-0039-4ef6-5d6927000000", + "Date" : "Wed, 28 Aug 2019 23:13:27 GMT", + "x-ms-client-request-id" : "40b70ad4-bfac-4593-a6b3-708595c8f7ca" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesnetworktestblobsnapshotus008324aa", "78618ca78ff2473b9ab788a20f87870a968e47a82cfa4ba19ef8187d2878cff4", "2019-08-28T23:13:27.436Z", "2019-08-28T23:13:27.436Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestblobuserdelegation.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestblobuserdelegation.json new file mode 100644 index 000000000000..2e572dd618cf --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestblobuserdelegation.json @@ -0,0 +1,173 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobuserdelega067779a7?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" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72C0D53915ECD\"", + "Last-Modified" : "Wed, 28 Aug 2019 23:13:24 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "70a67494-001e-0039-70f6-5d6927000000", + "Date" : "Wed, 28 Aug 2019 23:13:24 GMT", + "x-ms-client-request-id" : "59af2e01-21f6-454c-a7f7-33eb861b2a27" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobuserdelega067779a7/fe1b6c9eb0e14eca87f9c2cfdd8cd88332feb10d14de45dda462cdad721827a4", + "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", + "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" : "Wed, 28 Aug 2019 23:13:24 GMT", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-server-encrypted" : "true", + "Date" : "Wed, 28 Aug 2019 23:13:24 GMT", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "ETag" : "\"0x8D72C0D53A0FF97\"", + "Content-Length" : "0", + "x-ms-request-id" : "70a67498-001e-0039-73f6-5d6927000000", + "x-ms-client-request-id" : "e5d7946d-d053-4b23-8314-71645d69a12d" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://gapradev.blob.core.windows.net?restype=service&comp=userdelegationkey", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "70a674a9-001e-0039-03f6-5d6927000000", + "Body" : "6c221728-da7e-467c-81db-12ed6e15859fd59355f0-44c1-46d7-a3c0-fb9c4269f9a22019-08-28T23:13:25Z2019-08-29T23:13:24Zb2019-02-02UkVEQUNURUQ=", + "Date" : "Wed, 28 Aug 2019 23:13:24 GMT", + "x-ms-client-request-id" : "b0883456-e0c2-4227-9234-2e9ad0349e5b", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobuserdelega067779a7/fe1b6c9eb0e14eca87f9c2cfdd8cd88332feb10d14de45dda462cdad721827a4?sv=2019-02-02&spr=https%2Chttp&st=2019-08-27T23%3A13%3A24Z&se=2019-08-29T23%3A13%3A24Z&sip=0.0.0.0-255.255.255.255&skoid=c4f48289-bb84-4086-b250-6f94a8f64cee&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2019-08-28T23%3A13%3A25Z&ske=2019-08-29T23%3A13%3A24Z&sks=b&skv=2019-02-02&sr=b&sp=racwd&sig=REDACTED&rscc=cache&rscd=disposition&rsce=encoding&rscl=language&rsct=type", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Wed, 28 Aug 2019 23:13:24 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Wed, 28 Aug 2019 23:13:25 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "Cache-Control" : "cache", + "ETag" : "\"0x8D72C0D53A0FF97\"", + "Content-Disposition" : "disposition", + "x-ms-creation-time" : "Wed, 28 Aug 2019 23:13:24 GMT", + "Content-Length" : "4", + "x-ms-request-id" : "70a674af-001e-0039-09f6-5d6927000000", + "Body" : "test", + "x-ms-client-request-id" : "a559a773-1796-4252-9563-97102ac267a7", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "HEAD", + "Uri" : "https://gapradev.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobuserdelega067779a7/fe1b6c9eb0e14eca87f9c2cfdd8cd88332feb10d14de45dda462cdad721827a4?sv=2019-02-02&spr=https%2Chttp&st=2019-08-27T23%3A13%3A24Z&se=2019-08-29T23%3A13%3A24Z&sip=0.0.0.0-255.255.255.255&skoid=c4f48289-bb84-4086-b250-6f94a8f64cee&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2019-08-28T23%3A13%3A25Z&ske=2019-08-29T23%3A13%3A24Z&sks=b&skv=2019-02-02&sr=b&sp=racwd&sig=REDACTED&rscc=cache&rscd=disposition&rsce=encoding&rscl=language&rsct=type", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "x-ms-lease-status" : "unlocked", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-lease-state" : "available", + "Last-Modified" : "Wed, 28 Aug 2019 23:13:24 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Wed, 28 Aug 2019 23:13:25 GMT", + "x-ms-blob-type" : "BlockBlob", + "Content-MD5" : "CY9rzUYh03PK3k6DJie09g==", + "Accept-Ranges" : "bytes", + "x-ms-server-encrypted" : "true", + "x-ms-access-tier-inferred" : "true", + "x-ms-access-tier" : "Hot", + "Cache-Control" : "cache", + "ETag" : "\"0x8D72C0D53A0FF97\"", + "Content-Disposition" : "disposition", + "Content-Encoding" : "encoding", + "x-ms-creation-time" : "Wed, 28 Aug 2019 23:13:24 GMT", + "Content-Length" : "4", + "x-ms-request-id" : "70a674bb-001e-0039-13f6-5d6927000000", + "x-ms-client-request-id" : "2add82b1-6fb0-4f63-8584-cf5ed914756e", + "Content-Language" : "language", + "Content-Type" : "type" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcservicesassignaturevaluesnetworktestblobuserdelega&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" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "70a674bd-001e-0039-15f6-5d6927000000", + "Body" : "jtcservicesassignaturevaluesnetworktestblobuserdelegajtcservicesassignaturevaluesnetworktestblobuserdelega067779a7Wed, 28 Aug 2019 23:13:24 GMT\"0x8D72C0D53915ECD\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Wed, 28 Aug 2019 23:13:25 GMT", + "x-ms-client-request-id" : "815914e0-5c37-4f67-b9f1-4c72bb6a124a", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestblobuserdelega067779a7?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" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "70a674c2-001e-0039-19f6-5d6927000000", + "Date" : "Wed, 28 Aug 2019 23:13:25 GMT", + "x-ms-client-request-id" : "fa9b507a-cf80-4c67-b795-e37be2290166" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesnetworktestblobuserdelega067779a7", "fe1b6c9eb0e14eca87f9c2cfdd8cd88332feb10d14de45dda462cdad721827a4", "2019-08-28T23:13:24.600Z", "2019-08-28T23:13:24.600Z" ] +} \ 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 new file mode 100644 index 000000000000..a265ba393322 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestcontainer.json @@ -0,0 +1,129 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontainer0643470cc9?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" + }, + "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", + "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" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontainer0643470cc9?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", + "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", + "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" + }, + "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", + "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" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "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", + "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", + "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" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "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", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.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" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "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", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontainer0643470cc9?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" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fbada-801e-001f-0448-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:58:45 GMT", + "x-ms-client-request-id" : "3d9a94ad-9ab3-4589-8720-65107a918370" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesnetworktestcontainer0643470cc9", "2019-09-09T19:58:45.639Z", "2019-09-09T19:58:45.775Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestcontaineruserdelegation.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestcontaineruserdelegation.json new file mode 100644 index 000000000000..a9668ba1b562 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTestservicesassignaturevaluesnetworktestcontaineruserdelegation.json @@ -0,0 +1,103 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://gapradev.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontaineruserd03638682?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" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D72C11162BA766\"", + "Last-Modified" : "Wed, 28 Aug 2019 23:40:19 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "71dbf1d9-901e-002b-6df9-5d12f7000000", + "Date" : "Wed, 28 Aug 2019 23:40:19 GMT", + "x-ms-client-request-id" : "16374451-2ba9-4a0b-ac28-95da60a0c375" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://gapradev.blob.core.windows.net?restype=service&comp=userdelegationkey", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8922247f-201e-002e-49f9-5dc02c000000", + "Body" : "5dc520dc-0792-4eb1-82aa-d5575d481f905c8aebab-e79d-4002-874b-564af8c1dfaa2019-08-28T23:40:20Z2019-08-29T23:40:19Zb2019-02-02UkVEQUNURUQ=", + "Date" : "Wed, 28 Aug 2019 23:40:20 GMT", + "x-ms-client-request-id" : "b65ae140-d191-4975-986b-b56c9c788a82", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontaineruserd03638682?include=&restype=container&comp=list&sv=2019-02-02&se=2019-08-29T23%3A40%3A19Z&skoid=c4f48289-bb84-4086-b250-6f94a8f64cee&sktid=72f988bf-86f1-41af-91ab-2d7cd011db47&skt=2019-08-28T23%3A40%3A20Z&ske=2019-08-29T23%3A40%3A19Z&sks=b&skv=2019-02-02&sr=c&sp=racwdl&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_221; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "a4bfcea1-301e-0032-68f9-5d924c000000", + "Body" : "", + "Date" : "Wed, 28 Aug 2019 23:40:21 GMT", + "x-ms-client-request-id" : "e3a8a952-5248-49ec-abea-a6b3827b58e4", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://gapradev.blob.core.windows.net?prefix=jtcservicesassignaturevaluesnetworktestcontaineruserd&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" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "415cd7dd-401e-0028-3bf9-5df393000000", + "Body" : "jtcservicesassignaturevaluesnetworktestcontaineruserdjtcservicesassignaturevaluesnetworktestcontaineruserd03638682Wed, 28 Aug 2019 23:40:19 GMT\"0x8D72C11162BA766\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Wed, 28 Aug 2019 23:40:21 GMT", + "x-ms-client-request-id" : "7ec7c8ba-239d-432d-ae07-2f553b0b041e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://gapradev.blob.core.windows.net/jtcservicesassignaturevaluesnetworktestcontaineruserd03638682?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" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "7f1b4391-701e-0041-43f9-5dcadf000000", + "Date" : "Wed, 28 Aug 2019 23:40:21 GMT", + "x-ms-client-request-id" : "04cdae0b-bf61-471d-99ed-b40e5d558f44" + }, + "Exception" : null + } ], + "variables" : [ "jtcservicesassignaturevaluesnetworktestcontaineruserd03638682", "2019-08-28T23:40:19.566Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTesturlparser.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTesturlparser.json new file mode 100644 index 000000000000..aa843db97170 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/SASTesturlparser.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcurlparser0sastesturlparser9d614839e8e674cb18534?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" : "22906e4f-8860-4771-a13a-aa8cee7bf827" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73560328FC068\"", + "Last-Modified" : "Mon, 09 Sep 2019 19:59:17 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "077fd6e0-801e-001f-1e49-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:17 GMT", + "x-ms-client-request-id" : "22906e4f-8860-4771-a13a-aa8cee7bf827" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcurlparser&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" : "4d85e244-1824-4a19-a1a2-85cbc3160bd6" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "077fd6f2-801e-001f-2f49-673bbb000000", + "Body" : "jtcurlparserjtcurlparser0sastesturlparser9d614839e8e674cb18534Mon, 09 Sep 2019 19:59:17 GMT\"0x8D73560328FC068\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 19:59:17 GMT", + "x-ms-client-request-id" : "4d85e244-1824-4a19-a1a2-85cbc3160bd6", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcurlparser0sastesturlparser9d614839e8e674cb18534?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" : "66a82c59-6abc-422e-8e3b-fb2b0445d71e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "077fd6fb-801e-001f-3849-673bbb000000", + "Date" : "Mon, 09 Sep 2019 19:59:17 GMT", + "x-ms-client-request-id" : "66a82c59-6abc-422e-8e3b-fb2b0445d71e" + }, + "Exception" : null + } ], + "variables" : [ "jtcurlparser0sastesturlparser9d614839e8e674cb18534" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetaccountinfo.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetaccountinfo.json new file mode 100644 index 000000000000..4286270c2103 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetaccountinfo.json @@ -0,0 +1,126 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccountinfo0serviceapitestgetaccountinfo20e058121fb6?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" : "3afe22f7-df54-4fd9-a0dc-61969ade73a2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735620DA25B29\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:12:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0347de0b-301e-0024-4a4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:34 GMT", + "x-ms-client-request-id" : "3afe22f7-df54-4fd9-a0dc-61969ade73a2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "32deffe1-e803-4a92-9abb-6772c1bda481", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347de1d-301e-0024-574a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:34 GMT", + "x-ms-client-request-id" : "32deffe1-e803-4a92-9abb-6772c1bda481" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=account&comp=properties", + "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" : "185ac735-9e36-44fb-b95b-88f2d39853d3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-account-kind" : "StorageV2", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-sku-name" : "Standard_RAGRS", + "StatusCode" : "200", + "x-ms-request-id" : "0347de2c-301e-0024-654a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:34 GMT", + "x-ms-client-request-id" : "185ac735-9e36-44fb-b95b-88f2d39853d3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "6f3d3d14-7ff7-4d23-a102-565b5dc14b39", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347de3b-301e-0024-744a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:34 GMT", + "x-ms-client-request-id" : "6f3d3d14-7ff7-4d23-a102-565b5dc14b39" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetaccountinfo&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" : "42b4bbc1-5f09-4d5d-936a-ccf2a8ce69bc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0347de53-301e-0024-094a-6779e5000000", + "Body" : "jtcgetaccountinfojtcgetaccountinfo0serviceapitestgetaccountinfo20e058121fb6Mon, 09 Sep 2019 20:12:34 GMT\"0x8D735620DA25B29\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:12:34 GMT", + "x-ms-client-request-id" : "42b4bbc1-5f09-4d5d-936a-ccf2a8ce69bc", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccountinfo0serviceapitestgetaccountinfo20e058121fb6?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" : "2f9eb6b0-adaa-4066-bf63-762aadb4b16b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347de64-301e-0024-184a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:34 GMT", + "x-ms-client-request-id" : "2f9eb6b0-adaa-4066-bf63-762aadb4b16b" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfo0serviceapitestgetaccountinfo20e058121fb6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetaccountinfoerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetaccountinfoerror.json new file mode 100644 index 000000000000..1eb35131fcd9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetaccountinfoerror.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccountinfoerror0523107def9cda70c04546a?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" : "e20e46a8-f55e-46db-945b-56d3446df852" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735620E3A7112\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:12:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0347dedb-301e-0024-084a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:35 GMT", + "x-ms-client-request-id" : "e20e46a8-f55e-46db-945b-56d3446df852" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "8fa44a29-faa1-417b-a799-22a1621659a2", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347dee4-301e-0024-104a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:35 GMT", + "x-ms-client-request-id" : "8fa44a29-faa1-417b-a799-22a1621659a2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=account&comp=properties", + "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" : "10e1fd9e-9d85-4e3c-89a5-30ad6a5d03da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "ResourceNotFound", + "retry-after" : "0", + "Content-Length" : "223", + "StatusCode" : "404", + "x-ms-request-id" : "0347deec-301e-0024-184a-6779e5000000", + "Body" : "ResourceNotFoundThe specified resource does not exist.\nRequestId:0347deec-301e-0024-184a-6779e5000000\nTime:2019-09-09T20:12:35.9633893Z", + "Date" : "Mon, 09 Sep 2019 20:12:35 GMT", + "x-ms-client-request-id" : "10e1fd9e-9d85-4e3c-89a5-30ad6a5d03da", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "d69eae33-b305-45af-9c9d-2cc4401aaeee", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347defc-301e-0024-284a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:35 GMT", + "x-ms-client-request-id" : "d69eae33-b305-45af-9c9d-2cc4401aaeee" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetaccountinfoerror&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" : "53019e04-5e5c-4ccc-8f83-3e393ba15629" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0347df12-301e-0024-3c4a-6779e5000000", + "Body" : "jtcgetaccountinfoerrorjtcgetaccountinfoerror0523107def9cda70c04546aMon, 09 Sep 2019 20:12:35 GMT\"0x8D735620E3A7112\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:12:35 GMT", + "x-ms-client-request-id" : "53019e04-5e5c-4ccc-8f83-3e393ba15629", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccountinfoerror0523107def9cda70c04546a?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" : "8f99d4ce-2e81-42a5-9686-7290cf1dbb03" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347df1f-301e-0024-474a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:35 GMT", + "x-ms-client-request-id" : "8f99d4ce-2e81-42a5-9686-7290cf1dbb03" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfoerror0523107def9cda70c04546a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetaccountinfomin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetaccountinfomin.json new file mode 100644 index 000000000000..766de3a495ef --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetaccountinfomin.json @@ -0,0 +1,126 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccountinfomin0serviceapitestgetaccountinfomin11b97893d?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" : "a7cc2b0a-6f4d-4355-b982-c32de9a28016" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735620DEE17F2\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:12:35 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0347de79-301e-0024-294a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:34 GMT", + "x-ms-client-request-id" : "a7cc2b0a-6f4d-4355-b982-c32de9a28016" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "0f9ad4e4-e0ea-4d6c-978b-0d88d3d7946b", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347de8b-301e-0024-394a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:35 GMT", + "x-ms-client-request-id" : "0f9ad4e4-e0ea-4d6c-978b-0d88d3d7946b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=account&comp=properties", + "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" : "616e8ec4-04b9-4602-b5d4-ef9512d8665d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-account-kind" : "StorageV2", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-sku-name" : "Standard_RAGRS", + "StatusCode" : "200", + "x-ms-request-id" : "0347de95-301e-0024-434a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:35 GMT", + "x-ms-client-request-id" : "616e8ec4-04b9-4602-b5d4-ef9512d8665d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "f7a8cb9f-149b-4f65-9e39-34d4e3ad6911", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347dea3-301e-0024-514a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:35 GMT", + "x-ms-client-request-id" : "f7a8cb9f-149b-4f65-9e39-34d4e3ad6911" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetaccountinfomin&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" : "e1a6dae6-2977-40ef-a93d-e7c3303fbe09" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0347deac-301e-0024-5a4a-6779e5000000", + "Body" : "jtcgetaccountinfominjtcgetaccountinfomin0serviceapitestgetaccountinfomin11b97893dMon, 09 Sep 2019 20:12:35 GMT\"0x8D735620DEE17F2\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:12:35 GMT", + "x-ms-client-request-id" : "e1a6dae6-2977-40ef-a93d-e7c3303fbe09", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetaccountinfomin0serviceapitestgetaccountinfomin11b97893d?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" : "453d8c90-3aa4-4ad1-9481-041d01faa8a2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347dec4-301e-0024-724a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:35 GMT", + "x-ms-client-request-id" : "453d8c90-3aa4-4ad1-9481-041d01faa8a2" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetaccountinfomin0serviceapitestgetaccountinfomin11b97893d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetpropserror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetpropserror.json new file mode 100644 index 000000000000..514bf60f48e9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetpropserror.json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropserror0serviceapitestgetpropserror817418027128e?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" : "65032d0a-92c8-4466-9d02-7f396523b365" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735620B2ACDFC\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:12:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0347da73-301e-0024-724a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:30 GMT", + "x-ms-client-request-id" : "65032d0a-92c8-4466-9d02-7f396523b365" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "1d7d07b4-47c0-4ca7-b316-ad61de714e88", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347da82-301e-0024-804a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:30 GMT", + "x-ms-client-request-id" : "1d7d07b4-47c0-4ca7-b316-ad61de714e88" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://error.blob.core.windows.net?restype=service&comp=properties", + "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" : "f698b486-a352-4b32-b877-62baae7eceb8" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "466", + "StatusCode" : "403", + "x-ms-request-id" : "cf6bfe61-d01e-0026-214a-67c2b7000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:cf6bfe61-d01e-0026-214a-67c2b7000000\nTime:2019-09-09T20:12:30.8210321ZCannot find the claimed account when trying to GetProperties for the account jaschrepragrs.", + "Date" : "Mon, 09 Sep 2019 20:12:30 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "5f5a061d-508d-4cf8-8469-6486aab76d41", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347daa3-301e-0024-214a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:30 GMT", + "x-ms-client-request-id" : "5f5a061d-508d-4cf8-8469-6486aab76d41" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpropserror&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" : "423ac46a-47df-48e6-b0e3-d8aecda37a9d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0347daad-301e-0024-2b4a-6779e5000000", + "Body" : "jtcgetpropserrorjtcgetpropserror0serviceapitestgetpropserror817418027128eMon, 09 Sep 2019 20:12:30 GMT\"0x8D735620B2ACDFC\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:12:30 GMT", + "x-ms-client-request-id" : "423ac46a-47df-48e6-b0e3-d8aecda37a9d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropserror0serviceapitestgetpropserror817418027128e?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" : "9ccc7630-851d-4915-8525-876dbcc811c8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347daba-301e-0024-374a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:30 GMT", + "x-ms-client-request-id" : "9ccc7630-851d-4915-8525-876dbcc811c8" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropserror0serviceapitestgetpropserror817418027128e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetpropsmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetpropsmin.json new file mode 100644 index 000000000000..b6e9ff29ffdb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetpropsmin.json @@ -0,0 +1,126 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropsmin0serviceapitestgetpropsmin6121512201fd9ae?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" : "70a19451-3b27-49fe-acad-1fb75631af79" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735620ACFF34D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:12:30 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0347da06-301e-0024-0e4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:29 GMT", + "x-ms-client-request-id" : "70a19451-3b27-49fe-acad-1fb75631af79" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "b88f80ab-3bb3-4ac0-9c8c-a9d99f11ba8c", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347da14-301e-0024-1b4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:29 GMT", + "x-ms-client-request-id" : "b88f80ab-3bb3-4ac0-9c8c-a9d99f11ba8c" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "9e39552b-3a07-45d5-894f-71bc5b7f7c0c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0347da2f-301e-0024-344a-6779e5000000", + "Body" : "1.0falsefalsefalsefalse1.0falsefalse1.0falsefalsefalsefalse2018-03-28", + "Date" : "Mon, 09 Sep 2019 20:12:29 GMT", + "x-ms-client-request-id" : "9e39552b-3a07-45d5-894f-71bc5b7f7c0c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "b05ad698-6ba4-40e1-a5df-a5beca3bacd9", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347da3d-301e-0024-404a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:30 GMT", + "x-ms-client-request-id" : "b05ad698-6ba4-40e1-a5df-a5beca3bacd9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetpropsmin&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" : "fb6ebeed-9ad1-4be4-ae7f-c22bf0ef4ca5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0347da54-301e-0024-564a-6779e5000000", + "Body" : "jtcgetpropsminjtcgetpropsmin0serviceapitestgetpropsmin6121512201fd9aeMon, 09 Sep 2019 20:12:30 GMT\"0x8D735620ACFF34D\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:12:30 GMT", + "x-ms-client-request-id" : "fb6ebeed-9ad1-4be4-ae7f-c22bf0ef4ca5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetpropsmin0serviceapitestgetpropsmin6121512201fd9ae?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" : "7bff0125-4458-42a6-8af4-425f27708a10" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347da61-301e-0024-604a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:30 GMT", + "x-ms-client-request-id" : "7bff0125-4458-42a6-8af4-425f27708a10" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetpropsmin0serviceapitestgetpropsmin6121512201fd9ae" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetstats.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetstats.json new file mode 100644 index 000000000000..e117d229a4f9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetstats.json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetstats0serviceapitestgetstats87a085660ae40dc9aa?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" : "696cb684-3dff-49bc-a7f6-4a7fc3051c9b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735620C9C2D28\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:12:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0347dc85-301e-0024-584a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:32 GMT", + "x-ms-client-request-id" : "696cb684-3dff-49bc-a7f6-4a7fc3051c9b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "4e252199-577e-421e-9601-404c319db0ce", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347dc9a-301e-0024-6c4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:32 GMT", + "x-ms-client-request-id" : "4e252199-577e-421e-9601-404c319db0ce" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs-secondary.blob.core.windows.net?restype=service&comp=stats", + "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" : "cdb062d4-3d68-4e13-a2e9-2ff264492e63" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36460ce5-c01e-003f-1f4a-6771c4000000", + "Body" : "liveMon, 09 Sep 2019 20:09:22 GMT", + "Date" : "Mon, 09 Sep 2019 20:12:32 GMT", + "x-ms-client-request-id" : "cdb062d4-3d68-4e13-a2e9-2ff264492e63", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "1609015c-e80e-4312-8ad1-ccda69ef5fb2", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347dd03-301e-0024-4c4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:33 GMT", + "x-ms-client-request-id" : "1609015c-e80e-4312-8ad1-ccda69ef5fb2" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetstats&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" : "f50d88b5-0212-4717-b193-4f9054b8a11f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0347dd15-301e-0024-5e4a-6779e5000000", + "Body" : "jtcgetstatsjtcgetstats0serviceapitestgetstats87a085660ae40dc9aaMon, 09 Sep 2019 20:12:33 GMT\"0x8D735620C9C2D28\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:12:33 GMT", + "x-ms-client-request-id" : "f50d88b5-0212-4717-b193-4f9054b8a11f", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetstats0serviceapitestgetstats87a085660ae40dc9aa?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" : "d8550335-395d-4efd-b086-b9ee4d955239" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347dd31-301e-0024-784a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:33 GMT", + "x-ms-client-request-id" : "d8550335-395d-4efd-b086-b9ee4d955239" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetstats0serviceapitestgetstats87a085660ae40dc9aa" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetstatserror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetstatserror.json new file mode 100644 index 000000000000..a8b4a999b324 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetstatserror.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetstatserror0serviceapitestgetstatserror26b00094f587c?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" : "98d77715-4550-46d7-8669-7e6c492d3329" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735620D573ABE\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:12:34 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0347ddb4-301e-0024-774a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:33 GMT", + "x-ms-client-request-id" : "98d77715-4550-46d7-8669-7e6c492d3329" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "49757604-444f-4da5-8206-0891fbab4128", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347ddbb-301e-0024-7d4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:34 GMT", + "x-ms-client-request-id" : "49757604-444f-4da5-8206-0891fbab4128" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=stats", + "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" : "dfc1ea71-0aea-4f48-ae06-a13a60464bfa" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "376", + "StatusCode" : "400", + "x-ms-request-id" : "0347ddcd-301e-0024-0f4a-6779e5000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:0347ddcd-301e-0024-0f4a-6779e5000000\nTime:2019-09-09T20:12:34.4733299Zcompstats", + "Date" : "Mon, 09 Sep 2019 20:12:34 GMT", + "x-ms-client-request-id" : "dfc1ea71-0aea-4f48-ae06-a13a60464bfa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "d010e189-ac9e-40d8-acc3-52a061d8028e", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347dddb-301e-0024-1d4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:34 GMT", + "x-ms-client-request-id" : "d010e189-ac9e-40d8-acc3-52a061d8028e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetstatserror&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" : "86b57d13-0ece-4f19-84ab-092c9e60ad45" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0347ddf2-301e-0024-314a-6779e5000000", + "Body" : "jtcgetstatserrorjtcgetstatserror0serviceapitestgetstatserror26b00094f587cMon, 09 Sep 2019 20:12:34 GMT\"0x8D735620D573ABE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:12:34 GMT", + "x-ms-client-request-id" : "86b57d13-0ece-4f19-84ab-092c9e60ad45", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetstatserror0serviceapitestgetstatserror26b00094f587c?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" : "1644c919-a595-4a4b-8a52-b67095149568" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347de00-301e-0024-3f4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:34 GMT", + "x-ms-client-request-id" : "1644c919-a595-4a4b-8a52-b67095149568" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetstatserror0serviceapitestgetstatserror26b00094f587c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetstatsmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetstatsmin.json new file mode 100644 index 000000000000..7aa19a616392 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetstatsmin.json @@ -0,0 +1,128 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetstatsmin0serviceapitestgetstatsmin366388262c0c714?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" : "f0bacc7f-aae7-428c-93a2-73ae99bcd076" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735620D0FC478\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:12:33 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0347dd47-301e-0024-0e4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:33 GMT", + "x-ms-client-request-id" : "f0bacc7f-aae7-428c-93a2-73ae99bcd076" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "41588963-cd50-4414-b712-d4452abf5302", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347dd6e-301e-0024-334a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:33 GMT", + "x-ms-client-request-id" : "41588963-cd50-4414-b712-d4452abf5302" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs-secondary.blob.core.windows.net?restype=service&comp=stats", + "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" : "a010d574-faba-4185-ab71-af02c0a9bb6c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "36460cf4-c01e-003f-2c4a-6771c4000000", + "Body" : "liveMon, 09 Sep 2019 20:09:22 GMT", + "Date" : "Mon, 09 Sep 2019 20:12:33 GMT", + "x-ms-client-request-id" : "a010d574-faba-4185-ab71-af02c0a9bb6c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "0da348d9-73cb-42db-8dda-5dfdd044d43e", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347dd8a-301e-0024-4e4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:33 GMT", + "x-ms-client-request-id" : "0da348d9-73cb-42db-8dda-5dfdd044d43e" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcgetstatsmin&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" : "e645359d-bb9b-4915-b5c1-aebd84053d09" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0347dd9b-301e-0024-5f4a-6779e5000000", + "Body" : "jtcgetstatsminjtcgetstatsmin0serviceapitestgetstatsmin366388262c0c714Mon, 09 Sep 2019 20:12:33 GMT\"0x8D735620D0FC478\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:12:33 GMT", + "x-ms-client-request-id" : "e645359d-bb9b-4915-b5c1-aebd84053d09", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcgetstatsmin0serviceapitestgetstatsmin366388262c0c714?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" : "d4c073f8-dae1-45c8-aa19-c4335c168b81" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347dda9-301e-0024-6c4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:33 GMT", + "x-ms-client-request-id" : "d4c073f8-dae1-45c8-aa19-c4335c168b81" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetstatsmin0serviceapitestgetstatsmin366388262c0c714" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkey.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkey.json new file mode 100644 index 000000000000..13eed15e4a6b --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkey.json @@ -0,0 +1,129 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetuserdelegationkey053263d74cb833472749d4a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "x-ms-client-request-id" : "64ebfbcb-5479-4b4d-a03c-97bc2c920960" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE1F395EB4\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:12:12 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "eecc0c2a-601e-004b-18e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:12 GMT", + "x-ms-client-request-id" : "64ebfbcb-5479-4b4d-a03c-97bc2c920960" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "x-ms-client-request-id" : "3bd440b2-a8ac-4ff5-8598-d8caf617429e", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecc0c42-601e-004b-26e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:12 GMT", + "x-ms-client-request-id" : "3bd440b2-a8ac-4ff5-8598-d8caf617429e" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=userdelegationkey", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "x-ms-client-request-id" : "d00ef0b0-5767-4ce1-8788-8d1a8063c489", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "eecc0d92-601e-004b-38e6-6401ec000000", + "Body" : "f7d36475-c306-4434-80b5-07f34c2da08812f6aaa0-27d8-4e9f-925e-95e98424c2a22019-09-06T19:12:12Z2019-09-07T19:12:12Zb2019-02-02UkVEQUNURUQ=", + "Date" : "Fri, 06 Sep 2019 19:12:13 GMT", + "x-ms-client-request-id" : "d00ef0b0-5767-4ce1-8788-8d1a8063c489", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "x-ms-client-request-id" : "849b2c9a-6788-4745-8ffd-a70a0eec36df", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecc0da3-601e-004b-45e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:13 GMT", + "x-ms-client-request-id" : "849b2c9a-6788-4745-8ffd-a70a0eec36df" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetuserdelegationkey&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "x-ms-client-request-id" : "ab67debd-12eb-4cba-9665-8845460b6103" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "eecc0db8-601e-004b-55e6-6401ec000000", + "Body" : "jtcgetuserdelegationkeyjtcgetuserdelegationkey053263d74cb833472749d4aFri, 06 Sep 2019 19:12:12 GMT\"0x8D732FE1F395EB4\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:12:13 GMT", + "x-ms-client-request-id" : "ab67debd-12eb-4cba-9665-8845460b6103", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetuserdelegationkey053263d74cb833472749d4a?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "x-ms-client-request-id" : "0b758e51-70be-4e23-8479-ea3ccad1dbc0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecc0dc2-601e-004b-5fe6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:13 GMT", + "x-ms-client-request-id" : "0b758e51-70be-4e23-8479-ea3ccad1dbc0" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetuserdelegationkey053263d74cb833472749d4a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkeyerror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkeyerror.json new file mode 100644 index 000000000000..da9c998515be --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkeyerror.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetuserdelegationkeyerror0722368f46cd72160e4d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "x-ms-client-request-id" : "02c47168-e1c0-40a5-9ae0-0ea8c4aa96e4" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE20A68F78\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:12:14 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "eecc0f43-601e-004b-19e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:14 GMT", + "x-ms-client-request-id" : "02c47168-e1c0-40a5-9ae0-0ea8c4aa96e4" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "x-ms-client-request-id" : "7e10ac8a-1366-4bce-83fe-13fd82508fd0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecc0f4e-601e-004b-22e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:14 GMT", + "x-ms-client-request-id" : "7e10ac8a-1366-4bce-83fe-13fd82508fd0" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "x-ms-client-request-id" : "ce878f80-c1e0-47cc-b6bc-1a04a69a83ab", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecc0f57-601e-004b-2ae6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:14 GMT", + "x-ms-client-request-id" : "ce878f80-c1e0-47cc-b6bc-1a04a69a83ab" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetuserdelegationkeyerror&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "x-ms-client-request-id" : "f677acf0-ae4a-4881-a100-44bfb19958f5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "eecc0f5e-601e-004b-30e6-6401ec000000", + "Body" : "jtcgetuserdelegationkeyerrorjtcgetuserdelegationkeyerror0722368f46cd72160e4dFri, 06 Sep 2019 19:12:14 GMT\"0x8D732FE20A68F78\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:12:14 GMT", + "x-ms-client-request-id" : "f677acf0-ae4a-4881-a100-44bfb19958f5", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetuserdelegationkeyerror0722368f46cd72160e4d?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "x-ms-client-request-id" : "d5dc7c9a-2cbd-44f0-bde6-7aa300c21221" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecc0f69-601e-004b-38e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:14 GMT", + "x-ms-client-request-id" : "d5dc7c9a-2cbd-44f0-bde6-7aa300c21221" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetuserdelegationkeyerror0722368f46cd72160e4d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkeyerror[0].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkeyerror[0].json new file mode 100644 index 000000000000..bf1dd1b118f2 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkeyerror[0].json @@ -0,0 +1,97 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetuserdelegationkeyerror0708881dee1597095b42?restype=container", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D720E3498385E1\"", + "Last-Modified" : "Wed, 14 Aug 2019 18:14:45 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8ef12d14-901e-0099-33cc-52bfb4000000", + "Date" : "Wed, 14 Aug 2019 18:14:45 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8ef12d21-901e-0099-3ecc-52bfb4000000", + "Date" : "Wed, 14 Aug 2019 18:14:45 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8ef12d2a-901e-0099-46cc-52bfb4000000", + "Date" : "Wed, 14 Aug 2019 18:14:45 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetuserdelegationkeyerror&comp=list", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8ef12d38-901e-0099-52cc-52bfb4000000", + "Body" : "jtcgetuserdelegationkeyerrorjtcgetuserdelegationkeyerror0708881dee1597095b42Wed, 14 Aug 2019 18:14:45 GMT\"0x8D720E3498385E1\"unlockedavailablefalsefalse", + "Date" : "Wed, 14 Aug 2019 18:14:45 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetuserdelegationkeyerror0708881dee1597095b42?restype=container", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8ef12d4d-901e-0099-66cc-52bfb4000000", + "Date" : "Wed, 14 Aug 2019 18:14:45 GMT" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetuserdelegationkeyerror0708881dee1597095b42" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkeyerror[1].json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkeyerror[1].json new file mode 100644 index 000000000000..2fe304e751c4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkeyerror[1].json @@ -0,0 +1,97 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetuserdelegationkeyerror065100e4ad1d52ef4944?restype=container", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D720E349A25FD8\"", + "Last-Modified" : "Wed, 14 Aug 2019 18:14:46 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "8ef12d61-901e-0099-78cc-52bfb4000000", + "Date" : "Wed, 14 Aug 2019 18:14:45 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8ef12d67-901e-0099-7ccc-52bfb4000000", + "Date" : "Wed, 14 Aug 2019 18:14:45 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8ef12d71-901e-0099-06cc-52bfb4000000", + "Date" : "Wed, 14 Aug 2019 18:14:45 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetuserdelegationkeyerror&comp=list", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "8ef12d7e-901e-0099-10cc-52bfb4000000", + "Body" : "jtcgetuserdelegationkeyerrorjtcgetuserdelegationkeyerror065100e4ad1d52ef4944Wed, 14 Aug 2019 18:14:46 GMT\"0x8D720E349A25FD8\"unlockedavailablefalsefalse", + "Date" : "Wed, 14 Aug 2019 18:14:45 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetuserdelegationkeyerror065100e4ad1d52ef4944?restype=container", + "Headers" : { + "x-ms-version" : "2018-11-09", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0" + }, + "Response" : { + "x-ms-version" : "2018-11-09", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "8ef12d8c-901e-0099-1acc-52bfb4000000", + "Date" : "Wed, 14 Aug 2019 18:14:45 GMT" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetuserdelegationkeyerror065100e4ad1d52ef4944" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkeymin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkeymin.json new file mode 100644 index 000000000000..103cf4dc77a8 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestgetuserdelegationkeymin.json @@ -0,0 +1,129 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetuserdelegationkeymin067457942eb9f07b964f7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "x-ms-client-request-id" : "07051a5e-7cfb-44d7-af45-d145fc9d3a5a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D732FE200BD6EE\"", + "Last-Modified" : "Fri, 06 Sep 2019 19:12:13 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "eecc0dcc-601e-004b-67e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:13 GMT", + "x-ms-client-request-id" : "07051a5e-7cfb-44d7-af45-d145fc9d3a5a" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "x-ms-client-request-id" : "7686f3d2-5a91-4a76-95fe-2ebe77bf99c8", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecc0e02-601e-004b-17e6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:13 GMT", + "x-ms-client-request-id" : "7686f3d2-5a91-4a76-95fe-2ebe77bf99c8" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=userdelegationkey", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "x-ms-client-request-id" : "9af69b13-47b9-4c4f-831d-c1994e5282df", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "eecc0eba-601e-004b-29e6-6401ec000000", + "Body" : "0e1234c6-c484-4174-807c-eaa307fa01180e795152-7ef4-42d7-bb02-63851b0c02172019-09-06T19:12:14Z2019-09-07T19:12:13Zb2019-02-02UkVEQUNURUQ=", + "Date" : "Fri, 06 Sep 2019 19:12:14 GMT", + "x-ms-client-request-id" : "9af69b13-47b9-4c4f-831d-c1994e5282df", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "x-ms-client-request-id" : "18744b29-5148-4d2c-a150-1515049666bc", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecc0ec1-601e-004b-2ee6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:14 GMT", + "x-ms-client-request-id" : "18744b29-5148-4d2c-a150-1515049666bc" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net?prefix=jtcgetuserdelegationkeymin&comp=list", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "x-ms-client-request-id" : "e82be2e3-4124-43a1-aef7-5d58902ddc3d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "eecc0ecd-601e-004b-36e6-6401ec000000", + "Body" : "jtcgetuserdelegationkeyminjtcgetuserdelegationkeymin067457942eb9f07b964f7Fri, 06 Sep 2019 19:12:13 GMT\"0x8D732FE200BD6EE\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Fri, 06 Sep 2019 19:12:14 GMT", + "x-ms-client-request-id" : "e82be2e3-4124-43a1-aef7-5d58902ddc3d", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.blob.core.windows.net/jtcgetuserdelegationkeymin067457942eb9f07b964f7?restype=container", + "Headers" : { + "x-ms-version" : "2019-02-02", + "User-Agent" : "azsdk-java-azure-storage-blob/12.0.0-preview.3 1.8.0_212; Windows 10 10.0", + "x-ms-client-request-id" : "6efd5904-d060-4461-89c6-5bb7d108ff5e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "eecc0ed6-601e-004b-3fe6-6401ec000000", + "Date" : "Fri, 06 Sep 2019 19:12:14 GMT", + "x-ms-client-request-id" : "6efd5904-d060-4461-89c6-5bb7d108ff5e" + }, + "Exception" : null + } ], + "variables" : [ "jtcgetuserdelegationkeymin067457942eb9f07b964f7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestinvalidaccountname.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestinvalidaccountname.json new file mode 100644 index 000000000000..2ed5e4d1bb36 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestinvalidaccountname.json @@ -0,0 +1,209 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcinvalidaccountname0serviceapitestinvalidaccountname27743185?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" : "4945d441-f148-4f53-bf4c-270b6be0f2be" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D735620E85B895\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:12:36 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0347df2d-301e-0024-554a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:35 GMT", + "x-ms-client-request-id" : "4945d441-f148-4f53-bf4c-270b6be0f2be" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "65fbe93b-8a10-4ec8-b4f6-af57ce663bab", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347df44-301e-0024-6b4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:36 GMT", + "x-ms-client-request-id" : "65fbe93b-8a10-4ec8-b4f6-af57ce663bab" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "http://fake.blobfake.core.windows.net?restype=service&comp=properties", + "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" : "aa71c9e6-77e0-4f73-8fa4-c013d5289e4f" + }, + "Response" : null, + "Exception" : { + "ClassName" : "java.net.UnknownHostException", + "ErrorMessage" : "fake.blobfake.core.windows.net" + } + }, { + "Method" : "GET", + "Uri" : "http://fake.blobfake.core.windows.net?restype=service&comp=properties", + "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" : "aa71c9e6-77e0-4f73-8fa4-c013d5289e4f" + }, + "Response" : null, + "Exception" : { + "ClassName" : "java.net.UnknownHostException", + "ErrorMessage" : "fake.blobfake.core.windows.net" + } + }, { + "Method" : "GET", + "Uri" : "http://fake.blobfake.core.windows.net?restype=service&comp=properties", + "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" : "aa71c9e6-77e0-4f73-8fa4-c013d5289e4f" + }, + "Response" : null, + "Exception" : { + "ClassName" : "java.net.UnknownHostException", + "ErrorMessage" : "fake.blobfake.core.windows.net" + } + }, { + "Method" : "GET", + "Uri" : "http://fake.blobfake.core.windows.net?restype=service&comp=properties", + "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" : "aa71c9e6-77e0-4f73-8fa4-c013d5289e4f" + }, + "Response" : null, + "Exception" : { + "ClassName" : "java.net.UnknownHostException", + "ErrorMessage" : "fake.blobfake.core.windows.net" + } + }, { + "Method" : "GET", + "Uri" : "http://fake.blobfake.core.windows.net?restype=service&comp=properties", + "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" : "aa71c9e6-77e0-4f73-8fa4-c013d5289e4f" + }, + "Response" : null, + "Exception" : { + "ClassName" : "java.net.UnknownHostException", + "ErrorMessage" : "fake.blobfake.core.windows.net" + } + }, { + "Method" : "GET", + "Uri" : "http://fake.blobfake.core.windows.net?restype=service&comp=properties", + "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" : "aa71c9e6-77e0-4f73-8fa4-c013d5289e4f" + }, + "Response" : null, + "Exception" : { + "ClassName" : "java.net.UnknownHostException", + "ErrorMessage" : "fake.blobfake.core.windows.net" + } + }, { + "Method" : "GET", + "Uri" : "http://fake.blobfake.core.windows.net?restype=service&comp=properties", + "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" : "aa71c9e6-77e0-4f73-8fa4-c013d5289e4f" + }, + "Response" : null, + "Exception" : { + "ClassName" : "java.net.UnknownHostException", + "ErrorMessage" : "fake.blobfake.core.windows.net" + } + }, { + "Method" : "GET", + "Uri" : "http://fake.blobfake.core.windows.net?restype=service&comp=properties", + "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" : "aa71c9e6-77e0-4f73-8fa4-c013d5289e4f" + }, + "Response" : null, + "Exception" : { + "ClassName" : "java.net.UnknownHostException", + "ErrorMessage" : "fake.blobfake.core.windows.net" + } + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "30e6a150-e493-4a93-8ec2-54097988e580", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "03480d9c-301e-0024-484b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:36 GMT", + "x-ms-client-request-id" : "30e6a150-e493-4a93-8ec2-54097988e580" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcinvalidaccountname&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" : "89339fdb-b1ea-4398-a989-a101b325196e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "03480db2-301e-0024-574b-6779e5000000", + "Body" : "jtcinvalidaccountnamejtcinvalidaccountname0serviceapitestinvalidaccountname27743185Mon, 09 Sep 2019 20:12:36 GMT\"0x8D735620E85B895\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:13:36 GMT", + "x-ms-client-request-id" : "89339fdb-b1ea-4398-a989-a101b325196e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcinvalidaccountname0serviceapitestinvalidaccountname27743185?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" : "c3b71ab9-e526-4c0c-9d3f-fb57aab399dc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "03480dcb-301e-0024-6e4b-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:13:36 GMT", + "x-ms-client-request-id" : "c3b71ab9-e526-4c0c-9d3f-fb57aab399dc" + }, + "Exception" : null + } ], + "variables" : [ "jtcinvalidaccountname0serviceapitestinvalidaccountname27743185" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainers.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainers.json new file mode 100644 index 000000000000..c5dc54e9a627 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainers.json @@ -0,0 +1,126 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainers0serviceapitestlistcontainers42071762e2e6?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" : "8ab11e7b-f922-48d9-a593-a320bc42a236" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F252E067\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:48 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bf4c6-601e-0051-274a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:48 GMT", + "x-ms-client-request-id" : "8ab11e7b-f922-48d9-a593-a320bc42a236" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "5ea01260-23a2-4dbd-b4bc-22e39181f31b", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf4de-601e-0051-3c4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:48 GMT", + "x-ms-client-request-id" : "5ea01260-23a2-4dbd-b4bc-22e39181f31b" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistcontainers&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" : "2fc7d71e-c080-42bb-9a0e-6530c4490b73" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bf510-601e-0051-634a-67fe5e000000", + "Body" : "jtclistcontainersjtclistcontainers0serviceapitestlistcontainers42071762e2e6Mon, 09 Sep 2019 20:11:48 GMT\"0x8D73561F252E067\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:11:48 GMT", + "x-ms-client-request-id" : "2fc7d71e-c080-42bb-9a0e-6530c4490b73", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "05c6d7cc-a021-4c6b-ad7c-483a185e0dbd", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf520-601e-0051-734a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:48 GMT", + "x-ms-client-request-id" : "05c6d7cc-a021-4c6b-ad7c-483a185e0dbd" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistcontainers&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" : "a44d537a-8312-44ff-92a9-af556a2c833e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bf540-601e-0051-134a-67fe5e000000", + "Body" : "jtclistcontainersjtclistcontainers0serviceapitestlistcontainers42071762e2e6Mon, 09 Sep 2019 20:11:48 GMT\"0x8D73561F252E067\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:11:49 GMT", + "x-ms-client-request-id" : "a44d537a-8312-44ff-92a9-af556a2c833e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainers0serviceapitestlistcontainers42071762e2e6?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" : "bfc75751-a939-46d1-a3f0-08024865aea1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf558-601e-0051-2a4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:49 GMT", + "x-ms-client-request-id" : "bfc75751-a939-46d1-a3f0-08024865aea1" + }, + "Exception" : null + } ], + "variables" : [ "jtclistcontainers0serviceapitestlistcontainers42071762e2e6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersdetails.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersdetails.json new file mode 100644 index 000000000000..be8b02caab0a --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersdetails.json @@ -0,0 +1,166 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersdetails071341a77ebff875414c69?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" : "339c4038-05d7-417f-abb0-db549c8b1275" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F4784750\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bf7a4-601e-0051-464a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:52 GMT", + "x-ms-client-request-id" : "339c4038-05d7-417f-abb0-db549c8b1275" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "9547e8a1-25cb-4b4c-852e-49d1a1b33d39", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf7b7-601e-0051-584a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:52 GMT", + "x-ms-client-request-id" : "9547e8a1-25cb-4b4c-852e-49d1a1b33d39" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/aaajtclistcontainersdetails158639d4178e3865754fcc?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" : "de3f16f8-2c47-4b00-a529-19fc425def88" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F491A052\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:52 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bf7ca-601e-0051-6a4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:52 GMT", + "x-ms-client-request-id" : "de3f16f8-2c47-4b00-a529-19fc425def88" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=aaajtc&include=metadata&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" : "59595bb3-7e6f-4a12-997a-f935d2472b63" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bf7d3-601e-0051-714a-67fe5e000000", + "Body" : "aaajtcaaajtclistcontainersdetails158639d4178e3865754fccMon, 09 Sep 2019 20:11:52 GMT\"0x8D73561F491A052\"unlockedavailable$account-encryption-keyfalsefalsefalsebar", + "Date" : "Mon, 09 Sep 2019 20:11:52 GMT", + "x-ms-client-request-id" : "59595bb3-7e6f-4a12-997a-f935d2472b63", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/aaajtclistcontainersdetails158639d4178e3865754fcc?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" : "97e6d0da-4825-431b-b6db-b1d110bd9e88" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf7eb-601e-0051-044a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:52 GMT", + "x-ms-client-request-id" : "97e6d0da-4825-431b-b6db-b1d110bd9e88" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "754552cb-89e7-49ff-9b8a-53a0bf28eef1", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf7f9-601e-0051-124a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:52 GMT", + "x-ms-client-request-id" : "754552cb-89e7-49ff-9b8a-53a0bf28eef1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistcontainersdetails&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" : "d6e7bc5e-d2ae-4d16-a531-ae7afb9d1671" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bf80d-601e-0051-254a-67fe5e000000", + "Body" : "jtclistcontainersdetailsjtclistcontainersdetails071341a77ebff875414c69Mon, 09 Sep 2019 20:11:52 GMT\"0x8D73561F4784750\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:11:52 GMT", + "x-ms-client-request-id" : "d6e7bc5e-d2ae-4d16-a531-ae7afb9d1671", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersdetails071341a77ebff875414c69?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" : "365712ae-7841-4fe5-9de5-6389a74e08b1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf81c-601e-0051-324a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:52 GMT", + "x-ms-client-request-id" : "365712ae-7841-4fe5-9de5-6389a74e08b1" + }, + "Exception" : null + } ], + "variables" : [ "jtclistcontainersdetails071341a77ebff875414c69", "jtclistcontainersdetails158639d4178e3865754fcc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainerserror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainerserror.json new file mode 100644 index 000000000000..4ced17c5ee1f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainerserror.json @@ -0,0 +1,127 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainerserror048741e821fa0f83de476aa?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" : "aafa93ee-f837-467e-a53a-f0f486436fc1" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F5BAC0B6\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:54 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0347bf4a-301e-0024-714a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:54 GMT", + "x-ms-client-request-id" : "aafa93ee-f837-467e-a53a-f0f486436fc1" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "375b77fd-67ee-4088-8f07-df1e54e2161a", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347bf68-301e-0024-064a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:54 GMT", + "x-ms-client-request-id" : "375b77fd-67ee-4088-8f07-df1e54e2161a" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?marker=garbage%20continuation%20token&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" : "6e4cabf1-39a1-4eef-a1cd-f8f7052cae16" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "226", + "StatusCode" : "400", + "x-ms-request-id" : "0347bf86-301e-0024-234a-6779e5000000", + "Body" : "OutOfRangeInputOne of the request inputs is out of range.\nRequestId:0347bf86-301e-0024-234a-6779e5000000\nTime:2019-09-09T20:11:54.8632499Z", + "Date" : "Mon, 09 Sep 2019 20:11:54 GMT", + "x-ms-client-request-id" : "6e4cabf1-39a1-4eef-a1cd-f8f7052cae16", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "d3455105-4f6e-4dfe-9c39-6a6832db3222", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347bf8d-301e-0024-2a4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:54 GMT", + "x-ms-client-request-id" : "d3455105-4f6e-4dfe-9c39-6a6832db3222" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistcontainerserror&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" : "4df096ca-7158-4e14-8a52-d2b7a645345e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0347bf9b-301e-0024-364a-6779e5000000", + "Body" : "jtclistcontainerserrorjtclistcontainerserror048741e821fa0f83de476aaMon, 09 Sep 2019 20:11:54 GMT\"0x8D73561F5BAC0B6\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:11:54 GMT", + "x-ms-client-request-id" : "4df096ca-7158-4e14-8a52-d2b7a645345e", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainerserror048741e821fa0f83de476aa?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" : "d3508ceb-6fb4-472b-8182-cd7df67f72da" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347bf9f-301e-0024-3a4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:54 GMT", + "x-ms-client-request-id" : "d3508ceb-6fb4-472b-8182-cd7df67f72da" + }, + "Exception" : null + } ], + "variables" : [ "jtclistcontainerserror048741e821fa0f83de476aa" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersmarker.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersmarker.json new file mode 100644 index 000000000000..228dc5b07c16 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersmarker.json @@ -0,0 +1,526 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmarker0885014a38e827f24e448fa?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" : "df682f14-7ddb-4579-9e06-c9d9fae9a1a2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F30DC6EF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bf5c7-601e-0051-124a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:49 GMT", + "x-ms-client-request-id" : "df682f14-7ddb-4579-9e06-c9d9fae9a1a2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "54628c6d-3399-481f-b9ce-9e9665579ba3", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf5d8-601e-0051-204a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:49 GMT", + "x-ms-client-request-id" : "54628c6d-3399-481f-b9ce-9e9665579ba3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmarker16017588427dc076f2494ca?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" : "bafa13d7-63d4-45b2-ae2f-8159592f8b0e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F326F8D8\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bf5ee-601e-0051-304a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:49 GMT", + "x-ms-client-request-id" : "bafa13d7-63d4-45b2-ae2f-8159592f8b0e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmarker2228958098c31bb1834d669?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" : "420b1ac3-dd47-4ad6-8859-4c712b3023d5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F333A554\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bf5fe-601e-0051-3f4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:49 GMT", + "x-ms-client-request-id" : "420b1ac3-dd47-4ad6-8859-4c712b3023d5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmarker3727377f6ed314b81442019?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" : "d8af1016-746f-4547-b030-b44f7b6d619d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F34051D5\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bf611-601e-0051-514a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:50 GMT", + "x-ms-client-request-id" : "d8af1016-746f-4547-b030-b44f7b6d619d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmarker402682fb91a3112c8a46419?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" : "394d62ca-aa24-4646-a3ca-85889c709d7d" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F34CFE52\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bf625-601e-0051-624a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:50 GMT", + "x-ms-client-request-id" : "394d62ca-aa24-4646-a3ca-85889c709d7d" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmarker552518adc0df15f5d04c9e8?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" : "b5c73619-ce5f-495c-b3fe-714908d2430c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F359358B\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bf63a-601e-0051-764a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:50 GMT", + "x-ms-client-request-id" : "b5c73619-ce5f-495c-b3fe-714908d2430c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmarker6969571c448535ff704d5ca?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" : "ef635312-238c-47c0-ab75-4e5acf41ca05" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F365BAF3\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bf646-601e-0051-014a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:50 GMT", + "x-ms-client-request-id" : "ef635312-238c-47c0-ab75-4e5acf41ca05" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmarker730823bfd852f706b449dca?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" : "64a3a179-0742-4bcc-b1d7-9ccaf2f38fab" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F371F22C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bf659-601e-0051-134a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:50 GMT", + "x-ms-client-request-id" : "64a3a179-0742-4bcc-b1d7-9ccaf2f38fab" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmarker845151d23f2430073d4fc6b?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" : "c893efa7-2669-49bc-bc8b-e90c1a041f60" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F37E9EA9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:50 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bf67a-601e-0051-334a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:50 GMT", + "x-ms-client-request-id" : "c893efa7-2669-49bc-bc8b-e90c1a041f60" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmarker9175976c03605fa25145388?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" : "308e28a0-0fbb-460d-a5f6-13dee1147436" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F38B4B2A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bf688-601e-0051-404a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:50 GMT", + "x-ms-client-request-id" : "308e28a0-0fbb-460d-a5f6-13dee1147436" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmarker1051226ffa1e990d89e4140?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" : "1aaa9f7c-3e0f-4106-a7da-bf3fc8850e25" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F397D091\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bf699-601e-0051-4d4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:50 GMT", + "x-ms-client-request-id" : "1aaa9f7c-3e0f-4106-a7da-bf3fc8850e25" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?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" : "552064ba-e033-46ab-a7f7-7dca6ffa4e88" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bf6a8-601e-0051-5b4a-67fe5e000000", + "Body" : "$rootThu, 05 Sep 2019 18:04:42 GMT\"0x8D7322B86ADF78A\"unlockedavailable$account-encryption-keyfalsefalsefalse$webMon, 09 Sep 2019 20:04:02 GMT\"0x8D73560DC1BE0D0\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker0885014a38e827f24e448faMon, 09 Sep 2019 20:11:50 GMT\"0x8D73561F30DC6EF\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker1051226ffa1e990d89e4140Mon, 09 Sep 2019 20:11:51 GMT\"0x8D73561F397D091\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker16017588427dc076f2494caMon, 09 Sep 2019 20:11:50 GMT\"0x8D73561F326F8D8\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker2228958098c31bb1834d669Mon, 09 Sep 2019 20:11:50 GMT\"0x8D73561F333A554\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker3727377f6ed314b81442019Mon, 09 Sep 2019 20:11:50 GMT\"0x8D73561F34051D5\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker402682fb91a3112c8a46419Mon, 09 Sep 2019 20:11:50 GMT\"0x8D73561F34CFE52\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker552518adc0df15f5d04c9e8Mon, 09 Sep 2019 20:11:50 GMT\"0x8D73561F359358B\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker6969571c448535ff704d5caMon, 09 Sep 2019 20:11:50 GMT\"0x8D73561F365BAF3\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker730823bfd852f706b449dcaMon, 09 Sep 2019 20:11:50 GMT\"0x8D73561F371F22C\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker845151d23f2430073d4fc6bMon, 09 Sep 2019 20:11:50 GMT\"0x8D73561F37E9EA9\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker9175976c03605fa25145388Mon, 09 Sep 2019 20:11:51 GMT\"0x8D73561F38B4B2A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:11:50 GMT", + "x-ms-client-request-id" : "552064ba-e033-46ab-a7f7-7dca6ffa4e88", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "a9e86a2d-8853-4212-b220-fe3f797f37d3", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf6cb-601e-0051-784a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:50 GMT", + "x-ms-client-request-id" : "a9e86a2d-8853-4212-b220-fe3f797f37d3" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistcontainersmarker&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" : "d7077e22-2272-4613-a2ce-28515e7447ad" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bf6e1-601e-0051-0b4a-67fe5e000000", + "Body" : "jtclistcontainersmarkerjtclistcontainersmarker0885014a38e827f24e448faMon, 09 Sep 2019 20:11:50 GMT\"0x8D73561F30DC6EF\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker1051226ffa1e990d89e4140Mon, 09 Sep 2019 20:11:51 GMT\"0x8D73561F397D091\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker16017588427dc076f2494caMon, 09 Sep 2019 20:11:50 GMT\"0x8D73561F326F8D8\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker2228958098c31bb1834d669Mon, 09 Sep 2019 20:11:50 GMT\"0x8D73561F333A554\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker3727377f6ed314b81442019Mon, 09 Sep 2019 20:11:50 GMT\"0x8D73561F34051D5\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker402682fb91a3112c8a46419Mon, 09 Sep 2019 20:11:50 GMT\"0x8D73561F34CFE52\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker552518adc0df15f5d04c9e8Mon, 09 Sep 2019 20:11:50 GMT\"0x8D73561F359358B\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker6969571c448535ff704d5caMon, 09 Sep 2019 20:11:50 GMT\"0x8D73561F365BAF3\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker730823bfd852f706b449dcaMon, 09 Sep 2019 20:11:50 GMT\"0x8D73561F371F22C\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker845151d23f2430073d4fc6bMon, 09 Sep 2019 20:11:50 GMT\"0x8D73561F37E9EA9\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmarker9175976c03605fa25145388Mon, 09 Sep 2019 20:11:51 GMT\"0x8D73561F38B4B2A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:11:50 GMT", + "x-ms-client-request-id" : "d7077e22-2272-4613-a2ce-28515e7447ad", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmarker0885014a38e827f24e448fa?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" : "972d738e-782d-4387-8e77-accdd2ef2902" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf707-601e-0051-314a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:51 GMT", + "x-ms-client-request-id" : "972d738e-782d-4387-8e77-accdd2ef2902" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmarker1051226ffa1e990d89e4140?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" : "d750c1b9-fead-43ec-ac54-1e95762f0472" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf71c-601e-0051-444a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:51 GMT", + "x-ms-client-request-id" : "d750c1b9-fead-43ec-ac54-1e95762f0472" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmarker16017588427dc076f2494ca?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" : "0af10525-31e5-4501-a85c-7cc0cb630811" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf72b-601e-0051-514a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:51 GMT", + "x-ms-client-request-id" : "0af10525-31e5-4501-a85c-7cc0cb630811" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmarker2228958098c31bb1834d669?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" : "4e3b2014-fa9f-4987-b2f4-53d0b0668efc" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf73d-601e-0051-634a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:51 GMT", + "x-ms-client-request-id" : "4e3b2014-fa9f-4987-b2f4-53d0b0668efc" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmarker3727377f6ed314b81442019?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" : "e668860f-e681-4d50-a731-d758016d167a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf742-601e-0051-684a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:51 GMT", + "x-ms-client-request-id" : "e668860f-e681-4d50-a731-d758016d167a" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmarker402682fb91a3112c8a46419?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" : "d898f05f-8c55-42a8-9e48-99ae1ba036e0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf74f-601e-0051-754a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:51 GMT", + "x-ms-client-request-id" : "d898f05f-8c55-42a8-9e48-99ae1ba036e0" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmarker552518adc0df15f5d04c9e8?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" : "e396a0c2-d409-497b-88a0-920a96f4f420" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf75d-601e-0051-034a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:51 GMT", + "x-ms-client-request-id" : "e396a0c2-d409-497b-88a0-920a96f4f420" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmarker6969571c448535ff704d5ca?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" : "531644e4-e43a-44e3-a742-c8cd0273fec6" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf764-601e-0051-094a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:51 GMT", + "x-ms-client-request-id" : "531644e4-e43a-44e3-a742-c8cd0273fec6" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmarker730823bfd852f706b449dca?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" : "e5807b7e-e9d4-492f-b957-188fc1188e94" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf775-601e-0051-1a4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:51 GMT", + "x-ms-client-request-id" : "e5807b7e-e9d4-492f-b957-188fc1188e94" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmarker845151d23f2430073d4fc6b?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" : "8c4cb237-a023-4104-ad03-3397e8f7eae2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf785-601e-0051-294a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:51 GMT", + "x-ms-client-request-id" : "8c4cb237-a023-4104-ad03-3397e8f7eae2" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmarker9175976c03605fa25145388?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" : "e0636e5f-b3f1-4922-8478-498a39eb5453" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf79a-601e-0051-3d4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:52 GMT", + "x-ms-client-request-id" : "e0636e5f-b3f1-4922-8478-498a39eb5453" + }, + "Exception" : null + } ], + "variables" : [ "jtclistcontainersmarker0885014a38e827f24e448fa", "jtclistcontainersmarker16017588427dc076f2494ca", "jtclistcontainersmarker2228958098c31bb1834d669", "jtclistcontainersmarker3727377f6ed314b81442019", "jtclistcontainersmarker402682fb91a3112c8a46419", "jtclistcontainersmarker552518adc0df15f5d04c9e8", "jtclistcontainersmarker6969571c448535ff704d5ca", "jtclistcontainersmarker730823bfd852f706b449dca", "jtclistcontainersmarker845151d23f2430073d4fc6b", "jtclistcontainersmarker9175976c03605fa25145388", "jtclistcontainersmarker1051226ffa1e990d89e4140" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersmaxresults.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersmaxresults.json new file mode 100644 index 000000000000..2edf6c96fd57 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersmaxresults.json @@ -0,0 +1,368 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmaxresults042073d7ab0ef1f0404bc?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" : "44fef11d-1d2e-4149-9d2e-f3b6863bb795" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F4DD0EEF\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bf82b-601e-0051-3f4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:52 GMT", + "x-ms-client-request-id" : "44fef11d-1d2e-4149-9d2e-f3b6863bb795" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "85612265-6223-496e-8687-6a2167588279", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf847-601e-0051-594a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:52 GMT", + "x-ms-client-request-id" : "85612265-6223-496e-8687-6a2167588279" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmaxresults1695532cb001f70794444?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" : "eb74b969-d381-4a3e-9eba-9509cbf0a700" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F4F619B9\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bf853-601e-0051-654a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:52 GMT", + "x-ms-client-request-id" : "eb74b969-d381-4a3e-9eba-9509cbf0a700" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmaxresults202869ab933c096fa144f?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" : "8e5ee309-5140-4835-b7ac-cdf45cbcc611" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F502780C\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bf86c-601e-0051-764a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:53 GMT", + "x-ms-client-request-id" : "8e5ee309-5140-4835-b7ac-cdf45cbcc611" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmaxresults3079375373bbf4bc1e43e?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" : "76f8ab92-17a9-4b54-ad43-11dcbafacfa3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F50EFD74\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bf882-601e-0051-064a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:53 GMT", + "x-ms-client-request-id" : "76f8ab92-17a9-4b54-ad43-11dcbafacfa3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmaxresults464483e11330e9970d4cd?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" : "56d2436c-45ef-483f-8834-3675bbb9101b" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F51BA9F0\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bf889-601e-0051-0c4a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:53 GMT", + "x-ms-client-request-id" : "56d2436c-45ef-483f-8834-3675bbb9101b" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmaxresults503729c3be69e784224bf?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" : "a96372d3-215b-4c43-9577-4f00d97b84d9" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F5280843\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:53 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bf8a3-601e-0051-244a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:53 GMT", + "x-ms-client-request-id" : "a96372d3-215b-4c43-9577-4f00d97b84d9" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?maxresults=3&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" : "2ad96958-95fa-4a87-82b8-370a54185bb7" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bf8b0-601e-0051-2e4a-67fe5e000000", + "Body" : "3$rootThu, 05 Sep 2019 18:04:42 GMT\"0x8D7322B86ADF78A\"unlockedavailable$account-encryption-keyfalsefalsefalse$webMon, 09 Sep 2019 20:04:02 GMT\"0x8D73560DC1BE0D0\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmaxresults042073d7ab0ef1f0404bcMon, 09 Sep 2019 20:11:53 GMT\"0x8D73561F4DD0EEF\"unlockedavailable$account-encryption-keyfalsefalsefalse/jaschrepragrs/jtclistcontainersmaxresults1695532cb001f70794444", + "Date" : "Mon, 09 Sep 2019 20:11:53 GMT", + "x-ms-client-request-id" : "2ad96958-95fa-4a87-82b8-370a54185bb7", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?marker=/jaschrepragrs/jtclistcontainersmaxresults1695532cb001f70794444&maxresults=3&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" : "6f658bb6-750a-4769-966f-35a80154e2db" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bf8c5-601e-0051-404a-67fe5e000000", + "Body" : "/jaschrepragrs/jtclistcontainersmaxresults1695532cb001f707944443jtclistcontainersmaxresults1695532cb001f70794444Mon, 09 Sep 2019 20:11:53 GMT\"0x8D73561F4F619B9\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmaxresults202869ab933c096fa144fMon, 09 Sep 2019 20:11:53 GMT\"0x8D73561F502780C\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmaxresults3079375373bbf4bc1e43eMon, 09 Sep 2019 20:11:53 GMT\"0x8D73561F50EFD74\"unlockedavailable$account-encryption-keyfalsefalsefalse/jaschrepragrs/jtclistcontainersmaxresults464483e11330e9970d4cd", + "Date" : "Mon, 09 Sep 2019 20:11:53 GMT", + "x-ms-client-request-id" : "6f658bb6-750a-4769-966f-35a80154e2db", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmaxresults1695532cb001f70794444?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" : "4631bdf0-def1-465e-875e-2ae8e41bb769" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347beac-301e-0024-654a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:53 GMT", + "x-ms-client-request-id" : "4631bdf0-def1-465e-875e-2ae8e41bb769" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?marker=/jaschrepragrs/jtclistcontainersmaxresults464483e11330e9970d4cd&maxresults=3&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" : "ba5f0e2d-0940-4d18-a5ad-d81a9bc8f9ea" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bf8dd-601e-0051-554a-67fe5e000000", + "Body" : "/jaschrepragrs/jtclistcontainersmaxresults464483e11330e9970d4cd3jtclistcontainersmaxresults464483e11330e9970d4cdMon, 09 Sep 2019 20:11:53 GMT\"0x8D73561F51BA9F0\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmaxresults503729c3be69e784224bfMon, 09 Sep 2019 20:11:53 GMT\"0x8D73561F5280843\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:11:53 GMT", + "x-ms-client-request-id" : "ba5f0e2d-0940-4d18-a5ad-d81a9bc8f9ea", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmaxresults202869ab933c096fa144f?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" : "bfd99d75-2865-4e80-9cde-211c27274ce0" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347beb8-301e-0024-6f4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:53 GMT", + "x-ms-client-request-id" : "bfd99d75-2865-4e80-9cde-211c27274ce0" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmaxresults3079375373bbf4bc1e43e?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" : "d5bf6b4f-5b40-4994-8271-4585444d0186" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347bec6-301e-0024-7c4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:53 GMT", + "x-ms-client-request-id" : "d5bf6b4f-5b40-4994-8271-4585444d0186" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmaxresults464483e11330e9970d4cd?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" : "384b6b89-32a2-41a5-8971-be97ac01d8c2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347beda-301e-0024-104a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:53 GMT", + "x-ms-client-request-id" : "384b6b89-32a2-41a5-8971-be97ac01d8c2" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmaxresults503729c3be69e784224bf?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" : "31cef81e-81de-4c8c-a8aa-98de8283ced8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347beeb-301e-0024-1f4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:53 GMT", + "x-ms-client-request-id" : "31cef81e-81de-4c8c-a8aa-98de8283ced8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "f25ae097-709b-45c1-9cf2-c4e6da83f569", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347befe-301e-0024-304a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:54 GMT", + "x-ms-client-request-id" : "f25ae097-709b-45c1-9cf2-c4e6da83f569" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistcontainersmaxresults&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" : "12ee3a90-a798-464e-8293-99173c529920" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0347bf2e-301e-0024-584a-6779e5000000", + "Body" : "jtclistcontainersmaxresultsjtclistcontainersmaxresults042073d7ab0ef1f0404bcMon, 09 Sep 2019 20:11:53 GMT\"0x8D73561F4DD0EEF\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:11:54 GMT", + "x-ms-client-request-id" : "12ee3a90-a798-464e-8293-99173c529920", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmaxresults042073d7ab0ef1f0404bc?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" : "e0dbf7ec-889c-4307-9dcf-732138c0e332" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347bf38-301e-0024-614a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:54 GMT", + "x-ms-client-request-id" : "e0dbf7ec-889c-4307-9dcf-732138c0e332" + }, + "Exception" : null + } ], + "variables" : [ "jtclistcontainersmaxresults042073d7ab0ef1f0404bc", "jtclistcontainersmaxresults1695532cb001f70794444", "jtclistcontainersmaxresults202869ab933c096fa144f", "jtclistcontainersmaxresults3079375373bbf4bc1e43e", "jtclistcontainersmaxresults464483e11330e9970d4cd", "jtclistcontainersmaxresults503729c3be69e784224bf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersmin.json new file mode 100644 index 000000000000..7d37aa2bda02 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainersmin.json @@ -0,0 +1,126 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmin0serviceapitestlistcontainersminb3c996753?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" : "393a8dd0-ae40-4f26-8fd8-708a0e97fbc2" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F2C0833E\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "755bf561-601e-0051-324a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:49 GMT", + "x-ms-client-request-id" : "393a8dd0-ae40-4f26-8fd8-708a0e97fbc2" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "01d2bc6f-1fa9-41d1-a68c-fe86e8d7d708", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf575-601e-0051-454a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:49 GMT", + "x-ms-client-request-id" : "01d2bc6f-1fa9-41d1-a68c-fe86e8d7d708" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?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" : "565b10cb-5d9a-4a81-b928-a3014f055e2c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bf58c-601e-0051-5c4a-67fe5e000000", + "Body" : "$rootThu, 05 Sep 2019 18:04:42 GMT\"0x8D7322B86ADF78A\"unlockedavailable$account-encryption-keyfalsefalsefalse$webMon, 09 Sep 2019 20:04:02 GMT\"0x8D73560DC1BE0D0\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainersmin0serviceapitestlistcontainersminb3c996753Mon, 09 Sep 2019 20:11:49 GMT\"0x8D73561F2C0833E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:11:49 GMT", + "x-ms-client-request-id" : "565b10cb-5d9a-4a81-b928-a3014f055e2c", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "807bb161-1b46-4471-bba4-160ae283a7e1", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf599-601e-0051-674a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:49 GMT", + "x-ms-client-request-id" : "807bb161-1b46-4471-bba4-160ae283a7e1" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistcontainersmin&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" : "edd6d8a7-2b9c-4f2d-8066-f5fbdf079d58" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "755bf5a1-601e-0051-6f4a-67fe5e000000", + "Body" : "jtclistcontainersminjtclistcontainersmin0serviceapitestlistcontainersminb3c996753Mon, 09 Sep 2019 20:11:49 GMT\"0x8D73561F2C0833E\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:11:49 GMT", + "x-ms-client-request-id" : "edd6d8a7-2b9c-4f2d-8066-f5fbdf079d58", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainersmin0serviceapitestlistcontainersminb3c996753?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" : "e6f678b3-8c9f-480f-8bee-09bd07758b15" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "755bf5b6-601e-0051-024a-67fe5e000000", + "Date" : "Mon, 09 Sep 2019 20:11:49 GMT", + "x-ms-client-request-id" : "e6f678b3-8c9f-480f-8bee-09bd07758b15" + }, + "Exception" : null + } ], + "variables" : [ "jtclistcontainersmin0serviceapitestlistcontainersminb3c996753" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainerswithtimeoutstillbackedbypagedflux.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainerswithtimeoutstillbackedbypagedflux.json new file mode 100644 index 000000000000..76d231fc3b64 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestlistcontainerswithtimeoutstillbackedbypagedflux.json @@ -0,0 +1,368 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux047085317?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" : "be82d4cc-408f-4295-b8dd-144a9d8e6870" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F607DD4A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0347bfb3-301e-0024-4d4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:54 GMT", + "x-ms-client-request-id" : "be82d4cc-408f-4295-b8dd-144a9d8e6870" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "eba7a895-6c0f-4b4e-bbf5-b37a006c68b8", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347bfc0-301e-0024-564a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:55 GMT", + "x-ms-client-request-id" : "eba7a895-6c0f-4b4e-bbf5-b37a006c68b8" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux165001522?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" : "8b53dbe2-99fa-4895-bda3-04e042dd452e" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F621846A\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0347bfc7-301e-0024-5d4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:55 GMT", + "x-ms-client-request-id" : "8b53dbe2-99fa-4895-bda3-04e042dd452e" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux2457855c1?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" : "84bf73ee-b3cd-4a47-8e8d-c75a63fc344c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F62E09D1\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0347bfde-301e-0024-734a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:55 GMT", + "x-ms-client-request-id" : "84bf73ee-b3cd-4a47-8e8d-c75a63fc344c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux311987917?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" : "47cf0a2a-beb7-4a5a-a479-de5df981b5c3" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F63ADD5D\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0347bfee-301e-0024-024a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:55 GMT", + "x-ms-client-request-id" : "47cf0a2a-beb7-4a5a-a479-de5df981b5c3" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux44730257c?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" : "4c6eadbf-a24e-4513-8417-107ae7881701" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F64789D4\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0347c00e-301e-0024-1d4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:55 GMT", + "x-ms-client-request-id" : "4c6eadbf-a24e-4513-8417-107ae7881701" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux546720605?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" : "a570ca8e-1838-4a29-b2f0-cd248abd1952" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F653C108\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:55 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0347c021-301e-0024-2a4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:55 GMT", + "x-ms-client-request-id" : "a570ca8e-1838-4a29-b2f0-cd248abd1952" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?maxresults=3&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" : "8aa4a086-2bcd-4242-98e7-7816d6ce4116" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0347c02e-301e-0024-364a-6779e5000000", + "Body" : "3$rootThu, 05 Sep 2019 18:04:42 GMT\"0x8D7322B86ADF78A\"unlockedavailable$account-encryption-keyfalsefalsefalse$webMon, 09 Sep 2019 20:04:02 GMT\"0x8D73560DC1BE0D0\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainerswithtimeoutstillbackedbypagedflux047085317Mon, 09 Sep 2019 20:11:55 GMT\"0x8D73561F607DD4A\"unlockedavailable$account-encryption-keyfalsefalsefalse/jaschrepragrs/jtclistcontainerswithtimeoutstillbackedbypagedflux165001522", + "Date" : "Mon, 09 Sep 2019 20:11:55 GMT", + "x-ms-client-request-id" : "8aa4a086-2bcd-4242-98e7-7816d6ce4116", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?marker=/jaschrepragrs/jtclistcontainerswithtimeoutstillbackedbypagedflux165001522&maxresults=3&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" : "5b7974e8-278a-4ac6-8abd-3001b18089a0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0347c037-301e-0024-3f4a-6779e5000000", + "Body" : "/jaschrepragrs/jtclistcontainerswithtimeoutstillbackedbypagedflux1650015223jtclistcontainerswithtimeoutstillbackedbypagedflux165001522Mon, 09 Sep 2019 20:11:55 GMT\"0x8D73561F621846A\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainerswithtimeoutstillbackedbypagedflux2457855c1Mon, 09 Sep 2019 20:11:55 GMT\"0x8D73561F62E09D1\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainerswithtimeoutstillbackedbypagedflux311987917Mon, 09 Sep 2019 20:11:55 GMT\"0x8D73561F63ADD5D\"unlockedavailable$account-encryption-keyfalsefalsefalse/jaschrepragrs/jtclistcontainerswithtimeoutstillbackedbypagedflux44730257c", + "Date" : "Mon, 09 Sep 2019 20:11:55 GMT", + "x-ms-client-request-id" : "5b7974e8-278a-4ac6-8abd-3001b18089a0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?marker=/jaschrepragrs/jtclistcontainerswithtimeoutstillbackedbypagedflux44730257c&maxresults=3&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" : "1e7134dc-caf3-4793-ad88-f3846a4912fa" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0347c04d-301e-0024-534a-6779e5000000", + "Body" : "/jaschrepragrs/jtclistcontainerswithtimeoutstillbackedbypagedflux44730257c3jtclistcontainerswithtimeoutstillbackedbypagedflux44730257cMon, 09 Sep 2019 20:11:55 GMT\"0x8D73561F64789D4\"unlockedavailable$account-encryption-keyfalsefalsefalsejtclistcontainerswithtimeoutstillbackedbypagedflux546720605Mon, 09 Sep 2019 20:11:55 GMT\"0x8D73561F653C108\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:11:55 GMT", + "x-ms-client-request-id" : "1e7134dc-caf3-4793-ad88-f3846a4912fa", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux165001522?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" : "3d8246dc-c6aa-468b-a87e-ceb429e7774f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347c062-301e-0024-684a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:55 GMT", + "x-ms-client-request-id" : "3d8246dc-c6aa-468b-a87e-ceb429e7774f" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux2457855c1?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" : "543e0221-7b4b-4f7e-8b34-cb8e1bb97a71" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347c072-301e-0024-764a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:55 GMT", + "x-ms-client-request-id" : "543e0221-7b4b-4f7e-8b34-cb8e1bb97a71" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux311987917?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" : "8b42a648-0a54-452d-b482-5cc82217ce5a" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347c084-301e-0024-044a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:55 GMT", + "x-ms-client-request-id" : "8b42a648-0a54-452d-b482-5cc82217ce5a" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux44730257c?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" : "bbb4a0ac-7bd5-4920-bb70-c1db405fe9c8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347c09d-301e-0024-194a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:55 GMT", + "x-ms-client-request-id" : "bbb4a0ac-7bd5-4920-bb70-c1db405fe9c8" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux546720605?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" : "ea3f328e-7749-44e2-af8a-b75f6cd28663" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347c0ab-301e-0024-254a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:56 GMT", + "x-ms-client-request-id" : "ea3f328e-7749-44e2-af8a-b75f6cd28663" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "f5462ce1-742d-4130-8f1a-52a37c41404d", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347c0b4-301e-0024-2e4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:56 GMT", + "x-ms-client-request-id" : "f5462ce1-742d-4130-8f1a-52a37c41404d" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtclistcontainerswithtimeoutstillbackedbypagedflux&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" : "e01939de-b6a7-4814-a498-32961b858543" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0347c0c7-301e-0024-414a-6779e5000000", + "Body" : "jtclistcontainerswithtimeoutstillbackedbypagedfluxjtclistcontainerswithtimeoutstillbackedbypagedflux047085317Mon, 09 Sep 2019 20:11:55 GMT\"0x8D73561F607DD4A\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:11:56 GMT", + "x-ms-client-request-id" : "e01939de-b6a7-4814-a498-32961b858543", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtclistcontainerswithtimeoutstillbackedbypagedflux047085317?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" : "89751206-65a8-404d-b426-179edb9c2708" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347c0db-301e-0024-524a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:56 GMT", + "x-ms-client-request-id" : "89751206-65a8-404d-b426-179edb9c2708" + }, + "Exception" : null + } ], + "variables" : [ "jtclistcontainerswithtimeoutstillbackedbypagedflux047085317", "jtclistcontainerswithtimeoutstillbackedbypagedflux165001522", "jtclistcontainerswithtimeoutstillbackedbypagedflux2457855c1", "jtclistcontainerswithtimeoutstillbackedbypagedflux311987917", "jtclistcontainerswithtimeoutstillbackedbypagedflux44730257c", "jtclistcontainerswithtimeoutstillbackedbypagedflux546720605" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestsetgetproperties.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestsetgetproperties.json new file mode 100644 index 000000000000..c5b969101bf4 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestsetgetproperties.json @@ -0,0 +1,148 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetgetproperties0serviceapitestsetgetproperties5af01500d5?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" : "d269fb3b-46ae-40ca-9163-fd2ecf4babb5" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73561F6EDABED\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:11:56 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0347c0e7-301e-0024-5e4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:56 GMT", + "x-ms-client-request-id" : "d269fb3b-46ae-40ca-9163-fd2ecf4babb5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "719b229b-c546-4fbd-ad4b-304993cfa6db", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347c0ff-301e-0024-724a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:56 GMT", + "x-ms-client-request-id" : "719b229b-c546-4fbd-ad4b-304993cfa6db" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "0f234a14-4929-437b-8380-1b771b4e7663", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347c10c-301e-0024-7e4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:11:56 GMT", + "x-ms-client-request-id" : "0f234a14-4929-437b-8380-1b771b4e7663" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "663f05e5-7ca0-40a6-a885-705212c043a2" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Access-Control-Expose-Headers" : "x-ms-client-request-id", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "Access-Control-Allow-Origin" : "*", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0347d7d2-301e-0024-7f4a-6779e5000000", + "Body" : "1.0truefalsefalsetrue51.0truetruetrue51.0truetruetrue5GET,PUT,HEAD*x-ms-versionx-ms-client-request-id10true5truemyIndex.htmlcustom/error/path.html2016-05-31", + "Date" : "Mon, 09 Sep 2019 20:12:26 GMT", + "x-ms-client-request-id" : "663f05e5-7ca0-40a6-a885-705212c043a2", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "cabe2dbd-15b7-4cae-acb8-795c4108f638", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347d7e1-301e-0024-0d4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:26 GMT", + "x-ms-client-request-id" : "cabe2dbd-15b7-4cae-acb8-795c4108f638" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetgetproperties&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" : "e7a84b1a-32ae-4371-a861-d2229a9e87c0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0347d7f8-301e-0024-1d4a-6779e5000000", + "Body" : "jtcsetgetpropertiesjtcsetgetproperties0serviceapitestsetgetproperties5af01500d5Mon, 09 Sep 2019 20:11:56 GMT\"0x8D73561F6EDABED\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:12:26 GMT", + "x-ms-client-request-id" : "e7a84b1a-32ae-4371-a861-d2229a9e87c0", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetgetproperties0serviceapitestsetgetproperties5af01500d5?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" : "915108ed-22eb-48e6-8ee0-b8369f76da11" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347d808-301e-0024-2b4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:26 GMT", + "x-ms-client-request-id" : "915108ed-22eb-48e6-8ee0-b8369f76da11" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetgetproperties0serviceapitestsetgetproperties5af01500d5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestsetpropserror.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestsetpropserror.json new file mode 100644 index 000000000000..07affac7d5b1 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestsetpropserror.json @@ -0,0 +1,126 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetpropserror0serviceapitestsetpropserror56d4817088763?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" : "576e3dbe-905c-49a1-8f8a-67399743ea1c" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D73562097CF715\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:12:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0347d8a2-301e-0024-3c4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:27 GMT", + "x-ms-client-request-id" : "576e3dbe-905c-49a1-8f8a-67399743ea1c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "e07dfac9-a55f-44eb-8b88-874f0feda923", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347d8b0-301e-0024-494a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:27 GMT", + "x-ms-client-request-id" : "e07dfac9-a55f-44eb-8b88-874f0feda923" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://error.blob.core.windows.net?restype=service&comp=properties", + "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" : "9d5b0895-bdc7-4bbf-9dc9-a142d9751179", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "466", + "StatusCode" : "403", + "x-ms-request-id" : "cf6bfc14-d01e-0026-294a-67c2b7000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:cf6bfc14-d01e-0026-294a-67c2b7000000\nTime:2019-09-09T20:12:29.7492749ZCannot find the claimed account when trying to GetProperties for the account jaschrepragrs.", + "Date" : "Mon, 09 Sep 2019 20:12:29 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "8a7bd81f-3d3e-4e34-bb31-8315d055cc65", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347d9d6-301e-0024-604a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:29 GMT", + "x-ms-client-request-id" : "8a7bd81f-3d3e-4e34-bb31-8315d055cc65" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetpropserror&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" : "650e5438-e9d2-45f0-b6eb-458270355582" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0347d9e8-301e-0024-714a-6779e5000000", + "Body" : "jtcsetpropserrorjtcsetpropserror0serviceapitestsetpropserror56d4817088763Mon, 09 Sep 2019 20:12:27 GMT\"0x8D73562097CF715\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:12:29 GMT", + "x-ms-client-request-id" : "650e5438-e9d2-45f0-b6eb-458270355582", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetpropserror0serviceapitestsetpropserror56d4817088763?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" : "dd2caa1d-1826-41e0-a0f0-661e9bd7969f" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347d9ed-301e-0024-764a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:29 GMT", + "x-ms-client-request-id" : "dd2caa1d-1826-41e0-a0f0-661e9bd7969f" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetpropserror0serviceapitestsetpropserror56d4817088763" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestsetpropsmin.json b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestsetpropsmin.json new file mode 100644 index 000000000000..c4ed363bd74f --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/resources/session-records/ServiceAPITestsetpropsmin.json @@ -0,0 +1,125 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetpropsmin0serviceapitestsetpropsmina9891338f7b062d?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" : "519618fb-679e-4d7f-88d7-87166beb6404" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "ETag" : "\"0x8D7356209311333\"", + "Last-Modified" : "Mon, 09 Sep 2019 20:12:27 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "0347d82b-301e-0024-4d4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:27 GMT", + "x-ms-client-request-id" : "519618fb-679e-4d7f-88d7-87166beb6404" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "6eceee04-37c0-498e-9411-fdee9a71cdf5", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347d83c-301e-0024-5d4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:27 GMT", + "x-ms-client-request-id" : "6eceee04-37c0-498e-9411-fdee9a71cdf5" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "0fa38667-eec9-4076-984d-52e42bba812c", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347d84a-301e-0024-6b4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:27 GMT", + "x-ms-client-request-id" : "0fa38667-eec9-4076-984d-52e42bba812c" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?restype=service&comp=properties", + "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" : "9f4ed802-f649-42a2-a126-8c3a16e49ab0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347d85b-301e-0024-7b4a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:27 GMT", + "x-ms-client-request-id" : "9f4ed802-f649-42a2-a126-8c3a16e49ab0" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://jaschrepragrs.blob.core.windows.net?prefix=jtcsetpropsmin&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" : "850cc8ab-3943-49ce-8ab6-9a169bf09e47" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "0347d873-301e-0024-0e4a-6779e5000000", + "Body" : "jtcsetpropsminjtcsetpropsmin0serviceapitestsetpropsmina9891338f7b062dMon, 09 Sep 2019 20:12:27 GMT\"0x8D7356209311333\"unlockedavailable$account-encryption-keyfalsefalsefalse", + "Date" : "Mon, 09 Sep 2019 20:12:27 GMT", + "x-ms-client-request-id" : "850cc8ab-3943-49ce-8ab6-9a169bf09e47", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://jaschrepragrs.blob.core.windows.net/jtcsetpropsmin0serviceapitestsetpropsmina9891338f7b062d?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" : "bdeca97b-ee82-4785-b6bf-c4e39ffd5d32" + }, + "Response" : { + "x-ms-version" : "2019-02-02", + "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "0347d88a-301e-0024-254a-6779e5000000", + "Date" : "Mon, 09 Sep 2019 20:12:27 GMT", + "x-ms-client-request-id" : "bdeca97b-ee82-4785-b6bf-c4e39ffd5d32" + }, + "Exception" : null + } ], + "variables" : [ "jtcsetpropsmin0serviceapitestsetpropsmina9891338f7b062d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-blob/swagger/README.md b/sdk/storage/azure-storage-blob/swagger/README.md new file mode 100644 index 000000000000..5ada8e591d32 --- /dev/null +++ b/sdk/storage/azure-storage-blob/swagger/README.md @@ -0,0 +1,884 @@ +# Azure Blob Storage for Java + +> see https://aka.ms/autorest + +### Setup +```ps +cd C:\work +git clone --recursive https://github.com/Azure/autorest.java/ +cd autorest.java +git checkout v3 +npm install +cd .. +git clone --recursive https://github.com/jianghaolu/autorest.modeler/ +cd autorest.modeler +git checkout headerprefixfix +npm install +``` + +### Generation +```ps +cd +autorest --use=C:/work/autorest.java --use=C:/work/autorest.modeler --version=2.0.4280 +``` + +### Code generation settings +``` yaml +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/storage-dataplane-preview/specification/storage/data-plane/Microsoft.BlobStorage/preview/2019-02-02/blob.json +java: true +output-folder: ../ +namespace: com.azure.storage.blob +enable-xml: true +generate-client-interfaces: false +sync-methods: none +license-header: MICROSOFT_MIT_SMALL +add-context-parameter: true +``` + +### /{containerName}?restype=container +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}?restype=container"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ContainerName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + $.get.parameters.splice(0, 0, { "$ref": path }); + $.delete.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{containerName}?restype=container&comp=metadata +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}?restype=container&comp=metadata"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ContainerName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{containerName}?restype=container&comp=acl +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}?restype=container&comp=acl"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ContainerName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + $.get.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{containerName}?comp=lease&restype=container&acquire +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}?comp=lease&restype=container&acquire"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ContainerName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{containerName}?comp=lease&restype=container&release +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}?comp=lease&restype=container&release"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ContainerName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{containerName}?comp=lease&restype=container&renew +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}?comp=lease&restype=container&renew"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ContainerName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{containerName}?comp=lease&restype=container&break +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}?comp=lease&restype=container&break"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ContainerName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{containerName}?comp=lease&restype=container&change +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}?comp=lease&restype=container&change"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ContainerName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{containerName}?restype=container&comp=list&flat +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}?restype=container&comp=list&flat"] + transform: > + let param = $.get.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ContainerName"); + $.get.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{containerName}?restype=container&comp=list&hierarchy +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}?restype=container&comp=list&hierarchy"] + transform: > + let param = $.get.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ContainerName"); + $.get.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{containerName}?restype=account&comp=properties +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}?restype=account&comp=properties"] + transform: > + let param = $.get.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/ContainerName"); + $.get.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{containerName}/{blob} +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}"] + transform: > + let param = $.get.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.get.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.get.parameters.splice(1, 0, { "$ref": path + "Blob" }); + $.get.description = "The Download operation reads or downloads a blob from the system, including its metadata and properties. You can also call Download to read a snapshot or version."; + $.head.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.head.parameters.splice(1, 0, { "$ref": path + "Blob" }); + $.delete.description = "If the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently removed from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is deleted, it is marked for deletion and becomes inaccessible immediately. However, the blob service retains the blob or snapshot for the number of days specified by the DeleteRetentionPolicy section of [Storage service properties] (Set-Blob-Service-Properties.md). After the specified number of days has passed, the blob's data is permanently removed from the storage account. Note that you continue to be charged for the soft-deleted blob's storage until it is permanently removed. Use the List Blobs API and specify the \"include=deleted\" query parameter to discover which blobs and snapshots have been soft deleted. You can then use the Undelete Blob API to restore a soft-deleted blob. All other operations on a soft-deleted blob or snapshot causes the service to return an HTTP status code of 404 (ResourceNotFound). If the storage account's automatic snapshot feature is enabled, then, when a blob is deleted, an automatic snapshot is created. The blob becomes inaccessible immediately. All other operations on the blob causes the service to return an HTTP status code of 404 (ResourceNotFound). You can access automatic snapshot using snapshot timestamp or version id. You can restore the blob by calling Put or Copy Blob API with automatic snapshot as source. Deleting automatic snapshot requires shared key or special SAS/RBAC permissions."; + $.delete.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.delete.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?PageBlob +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?PageBlob"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?AppendBlob +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?AppendBlob"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=appendblock +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=appendblock"] + transform: > + $.put.consumes = ["application/octet-stream"]; +``` + +### /{containerName}/{blob}?BlockBlob +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?BlockBlob"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=undelete +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=undelete"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=properties&SetHTTPHeaders +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=properties&SetHTTPHeaders"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=metadata +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=metadata"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=lease&acquire +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=lease&acquire"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=lease&release +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=lease&release"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=lease&renew +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=lease&renew"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=lease&change +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=lease&change"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=lease&break +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=lease&break"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=snapshot +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=snapshot"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=copy +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=copy"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + $.put.responses["202"].headers["x-ms-version-id"] = { + "x-ms-client-name": "VersionId", + "type": "string", + "description": "UTC date/time value generated by the service that identifies the version of the blob. This header is returned for requests made against version 2018-11-09 and above." + }; + } +``` + +### /{containerName}/{blob}?comp=copy&sync +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=copy&sync"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + $.put.responses["202"].headers["x-ms-version-id"] = { + "x-ms-client-name": "VersionId", + "type": "string", + "description": "UTC date/time value generated by the service that identifies the version of the blob. This header is returned for requests made against version 2018-11-09 and above." + }; + } +``` + +### /{containerName}/{blob}?comp=copy©id={CopyId} +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=copy©id={CopyId}"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=tier +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=tier"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?restype=account&comp=properties +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?restype=account&comp=properties"] + transform: > + let param = $.get.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.get.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.get.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=block +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=block"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=block&fromURL +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=block&fromURL"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=blocklist +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=blocklist"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + $.get.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.get.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=page&update +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=page&update"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=page&clear +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=page&clear"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=page&clear +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=page&clear"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=page&update&fromUrl +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=page&update&fromUrl"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=pagelist +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=pagelist"] + transform: > + let param = $.get.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.get.description = "The Get Page Ranges operation returns the list of valid page ranges for a page blob, version or snapshot of a page blob"; + $.get.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.get.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=pagelist&diff +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=pagelist&diff"] + transform: > + let param = $.get.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.get.description = "[Update] The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob that were changed between target blob and previous snapshot or version."; + $.get.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.get.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=properties&Resize +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=properties&Resize"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=properties&UpdateSequenceNumber +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=properties&UpdateSequenceNumber"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=incrementalcopy +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=incrementalcopy"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=appendblock +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=appendblock"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{containerName}/{blob}?comp=appendblock&fromUrl +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=appendblock&fromUrl"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### BlobItem +``` yaml +directive: +- from: swagger-document + where: $.definitions.BlobItem + transform: > + if (!$.required.includes("VersionId")) { + $.required.push("VersionId"); + $.properties.Metadata.type = "object"; + $.properties.Metadata.additionalProperties = { "type": "string" }; + delete $.properties.Metadata.$ref; + $.properties.VersionId = { "type": "string" }; + } + $.properties.IsPrefix = { "type": "boolean" }; +``` + +### BlobMetadata +Deleting out Encryption until https://github.com/Azure/azure-sdk-for-java/issues/5000 is determined. +``` yaml +directive: +- from: swagger-document + where: $.definitions.BlobMetadata + transform: > + delete $.properties +``` + +### BlobProperties +``` yaml +directive: +- from: swagger-document + where: $.definitions.BlobProperties + transform: > + $.properties.CustomerProvidedKeySha256 = { "type": "string" } +``` + +### ListBlobsFlatSegmentResponse +``` yaml +directive: +- from: swagger-document + where: $.definitions.ListBlobsFlatSegmentResponse + transform: > + if (!$.required.includes("Prefix")) { + $.required.push("Prefix"); + $.required.push("Marker"); + $.required.push("MaxResults"); + $.required.push("Delimiter"); + $.required.push("NextMarker"); + } +``` + +### ListBlobsHierarchySegmentResponse +``` yaml +directive: +- from: swagger-document + where: $.definitions.ListBlobsHierarchySegmentResponse + transform: > + if (!$.required.includes("Prefix")) { + $.required.push("Prefix"); + $.required.push("Marker"); + $.required.push("MaxResults"); + $.required.push("Delimiter"); + $.required.push("NextMarker"); + } +``` + +### ListContainersSegmentResponse +``` yaml +directive: +- from: swagger-document + where: $.definitions.ListContainersSegmentResponse + transform: > + if (!$.required.includes("Prefix")) { + $.required.push("Prefix"); + $.required.push("MaxResults"); + $.required.push("NextMarker"); + } +``` + +### SignedIdentifier +``` yaml +directive: +- from: swagger-document + where: $.definitions.SignedIdentifier + transform: > + if ($.xml) { + delete $.xml; + } +- from: swagger-document + where: $.definitions.SignedIdentifiers + transform: > + $.items.xml = { "name": "SignedIdentifier" } +``` + +### KeyInfo +``` yaml +directive: +- from: swagger-document + where: $.parameters.KeyInfo + transform: > + if ($["x-ms-parameter-location"]) { + delete $["x-ms-parameter-location"]; + } +``` + +### Make AccessTier Unique +autorest.python complains that the same enum has different values +``` yaml +directive: +- from: swagger-document + where: $.parameters.AccessTierRequired + transform: > + $["x-ms-enum"].name = "AccessTierRequired"; +- from: swagger-document + where: $.parameters.AccessTierOptional + transform: > + $["x-ms-enum"].name = "AccessTierOptional"; +``` + +### Extra parameters +``` yaml +directive: +- from: swagger-document + where: $.parameters + transform: > + if (!$.CacheControl) { + $.CacheControl = { + "name": "Cache-Control", + "x-ms-client-name": "cacheControl", + "in": "header", + "required": false, + "type": "string", + "x-ms-parameter-location": "method", + "description": "Cache control for given resource" + }; + } +``` + +### /{containerName}/{blob}?comp=tags +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{containerName}/{blob}?comp=tags"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("ContainerName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Blob" }); + $.get.parameters.splice(0, 0, { "$ref": path + "ContainerName" }); + $.get.parameters.splice(1, 0, { "$ref": path + "Blob" }); + } +``` + +### /{filesystem}/{path}?resource=directory&Create +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{filesystem}/{path}?resource=directory&Create"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("Filesystem")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "Filesystem" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Path" }); + } +``` + +### /{filesystem}/{path}?DirectoryRename +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{filesystem}/{path}?DirectoryRename"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("Filesystem")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "Filesystem" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Path" }); + } +``` + +### /{filesystem}/{path}?DirectoryDelete +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{filesystem}/{path}?DirectoryDelete"] + transform: > + let param = $.delete.parameters[0]; + if (!param["$ref"].endsWith("Filesystem")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.delete.parameters.splice(0, 0, { "$ref": path + "Filesystem" }); + $.delete.parameters.splice(1, 0, { "$ref": path + "Path" }); + } +``` + +### /{filesystem}/{path}?FileRename +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{filesystem}/{path}?FileRename"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("Filesystem")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/"); + $.put.parameters.splice(0, 0, { "$ref": path + "Filesystem" }); + $.put.parameters.splice(1, 0, { "$ref": path + "Path" }); + } +``` + +### Add the CustomHierarchicalListingDeserializer attribute +``` yaml +directive: +- from: BlobHierarchyListSegment.java + where: $ + transform: > + return $. + replace( + "import com.fasterxml.jackson.annotation.JsonProperty;", + "import com.fasterxml.jackson.annotation.JsonProperty;\nimport com.fasterxml.jackson.databind.annotation.JsonDeserialize;"). + replace( + "public final class BlobHierarchyListSegment {", + "@JsonDeserialize(using = CustomHierarchicalListingDeserializer.class)\npublic final class BlobHierarchyListSegment {"); +``` + diff --git a/sdk/storage/azure-storage-blob/swagger/blob.json b/sdk/storage/azure-storage-blob/swagger/blob.json deleted file mode 100644 index 0bf6a308f327..000000000000 --- a/sdk/storage/azure-storage-blob/swagger/blob.json +++ /dev/null @@ -1,8647 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "Azure Blob Storage", - "version": "2018-11-09", - "x-ms-code-generation-settings": { - "header": "MIT", - "strictSpecAdherence": false - } - }, - "x-ms-parameterized-host": { - "hostTemplate": "{url}", - "useSchemePrefix": false, - "positionInOperation": "first", - "parameters": [ - { - "$ref": "#/parameters/Url" - } - ] - }, - "securityDefinitions": { - "blob_shared_key": { - "type": "apiKey", - "name": "Authorization", - "in": "header" - } - }, - "schemes": [ - "https" - ], - "consumes": [ - "application/xml" - ], - "produces": [ - "application/xml" - ], - "paths": {}, - "x-ms-paths": { - "/?restype=service&comp=properties": { - "put": { - "tags": [ - "service" - ], - "operationId": "Service_SetProperties", - "description": "Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules", - "parameters": [ - { - "$ref": "#/parameters/StorageServiceProperties" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "Success (Accepted)", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "get": { - "tags": [ - "service" - ], - "operationId": "Service_GetProperties", - "description": "gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - } - }, - "schema": { - "$ref": "#/definitions/StorageServiceProperties" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "service" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/?restype=service&comp=stats": { - "get": { - "tags": [ - "service" - ], - "operationId": "Service_GetStatistics", - "description": "Retrieves statistics related to replication for the Blob service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account.", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/StorageServiceStats" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "service" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "stats" - ] - } - ] - }, - "/?comp=list": { - "get": { - "tags": [ - "service" - ], - "operationId": "Service_ListContainersSegment", - "description": "The List Containers Segment operation returns a list of the containers under the specified account", - "parameters": [ - { - "$ref": "#/parameters/Prefix" - }, - { - "$ref": "#/parameters/Marker" - }, - { - "$ref": "#/parameters/MaxResults" - }, - { - "$ref": "#/parameters/ListContainersInclude" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - } - }, - "schema": { - "$ref": "#/definitions/ListContainersSegmentResponse" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "NextMarker" - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "list" - ] - } - ] - }, - "/?restype=service&comp=userdelegationkey": { - "post": { - "tags": [ - "service" - ], - "operationId": "Service_GetUserDelegationKey", - "description": "Retrieves a user delgation key for the Blob service. This is only a valid operation when using bearer token authentication.", - "parameters": [ - { - "$ref": "#/parameters/KeyInfo" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/UserDelegationKey" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "service" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "userdelegationkey" - ] - } - ] - }, - "/?restype=account&comp=properties": { - "get": { - "tags": [ - "service" - ], - "operationId": "Service_GetAccountInfo", - "description": "Returns the sku name and account kind ", - "parameters": [ - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success (OK)", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-sku-name": { - "x-ms-client-name": "SkuName", - "type": "string", - "enum": [ - "Standard_LRS", - "Standard_GRS", - "Standard_RAGRS", - "Standard_ZRS", - "Premium_LRS" - ], - "x-ms-enum": { - "name": "SkuName", - "modelAsString": false - }, - "description": "Identifies the sku name of the account" - }, - "x-ms-account-kind": { - "x-ms-client-name": "AccountKind", - "type": "string", - "enum": [ - "Storage", - "BlobStorage", - "StorageV2" - ], - "x-ms-enum": { - "name": "AccountKind", - "modelAsString": false - }, - "description": "Identifies the account kind" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "account" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/{containerName}?restype=container": { - "put": { - "tags": [ - "container" - ], - "operationId": "Container_Create", - "description": "creates a new container under the specified account. If the container with the same name already exists, the operation fails", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/BlobPublicAccess" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "Success, Container created.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "get": { - "tags": [ - "container" - ], - "operationId": "Container_GetProperties", - "description": "returns all user-defined metadata and system properties for the specified container. The data returned does not include the container's list of blobs", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success", - "headers": { - "x-ms-meta": { - "type": "string", - "x-ms-client-name": "Metadata", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-lease-duration": { - "x-ms-client-name": "LeaseDuration", - "description": "When a blob is leased, specifies whether the lease is of infinite or fixed duration.", - "type": "string", - "enum": [ - "infinite", - "fixed" - ], - "x-ms-enum": { - "name": "LeaseDurationType", - "modelAsString": false - } - }, - "x-ms-lease-state": { - "x-ms-client-name": "LeaseState", - "description": "Lease state of the blob.", - "type": "string", - "enum": [ - "available", - "leased", - "expired", - "breaking", - "broken" - ], - "x-ms-enum": { - "name": "LeaseStateType", - "modelAsString": false - } - }, - "x-ms-lease-status": { - "x-ms-client-name": "LeaseStatus", - "description": "The current lease status of the blob.", - "type": "string", - "enum": [ - "locked", - "unlocked" - ], - "x-ms-enum": { - "name": "LeaseStatusType", - "modelAsString": false - } - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-blob-public-access": { - "x-ms-client-name": "BlobPublicAccess", - "description": "Indicated whether data in the container may be accessed publicly and the level of access", - "type": "string", - "enum": [ - "container", - "blob" - ], - "x-ms-enum": { - "name": "PublicAccessType", - "modelAsString": true - } - }, - "x-ms-has-immutability-policy": { - "x-ms-client-name": "HasImmutabilityPolicy", - "description": "Indicates whether the container has an immutability policy set on it.", - "type": "boolean" - }, - "x-ms-has-legal-hold": { - "x-ms-client-name": "HasLegalHold", - "description": "Indicates whether the container has a legal hold.", - "type": "boolean" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "delete": { - "tags": [ - "container" - ], - "operationId": "Container_Delete", - "description": "operation marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "Accepted", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - } - ] - }, - "/{containerName}?restype=container&comp=metadata": { - "put": { - "tags": [ - "container" - ], - "operationId": "Container_SetMetadata", - "description": "operation sets one or more user-defined name-value pairs for the specified container.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "metadata" - ] - } - ] - }, - "/{containerName}?restype=container&comp=acl": { - "get": { - "tags": [ - "container" - ], - "operationId": "Container_GetAccessPolicy", - "description": "gets the permissions for the specified container. The permissions indicate whether container data may be accessed publicly.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success", - "headers": { - "x-ms-blob-public-access": { - "x-ms-client-name": "BlobPublicAccess", - "description": "Indicated whether data in the container may be accessed publicly and the level of access", - "type": "string", - "enum": [ - "container", - "blob" - ], - "x-ms-enum": { - "name": "PublicAccessType", - "modelAsString": true - } - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/SignedIdentifiers" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "put": { - "tags": [ - "container" - ], - "operationId": "Container_SetAccessPolicy", - "description": "sets the permissions for the specified container. The permissions indicate whether blobs in a container may be accessed publicly.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/ContainerAcl" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/BlobPublicAccess" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "acl" - ] - } - ] - }, - "/{containerName}?comp=lease&restype=container&acquire": { - "put": { - "tags": [ - "container" - ], - "operationId": "Container_AcquireLease", - "description": "[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseDuration" - }, - { - "$ref": "#/parameters/ProposedLeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The Acquire operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-lease-id": { - "x-ms-client-name": "LeaseId", - "type": "string", - "description": "Uniquely identifies a container's lease" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "acquire" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}?comp=lease&restype=container&release": { - "put": { - "tags": [ - "container" - ], - "operationId": "Container_ReleaseLease", - "description": "[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdRequired" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The Release operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "release" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}?comp=lease&restype=container&renew": { - "put": { - "tags": [ - "container" - ], - "operationId": "Container_RenewLease", - "description": "[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdRequired" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The Renew operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-lease-id": { - "x-ms-client-name": "LeaseId", - "type": "string", - "description": "Uniquely identifies a container's lease" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "renew" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}?comp=lease&restype=container&break": { - "put": { - "tags": [ - "container" - ], - "operationId": "Container_BreakLease", - "description": "[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseBreakPeriod" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "The Break operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-lease-time": { - "x-ms-client-name": "LeaseTime", - "type": "integer", - "description": "Approximate time remaining in the lease period, in seconds." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "break" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}?comp=lease&restype=container&change": { - "put": { - "tags": [ - "container" - ], - "operationId": "Container_ChangeLease", - "description": "[Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdRequired" - }, - { - "$ref": "#/parameters/ProposedLeaseIdRequired" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The Change operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-lease-id": { - "x-ms-client-name": "LeaseId", - "type": "string", - "description": "Uniquely identifies a container's lease" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "change" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}?restype=container&comp=list&flat": { - "get": { - "tags": [ - "containers" - ], - "operationId": "Container_ListBlobFlatSegment", - "description": "[Update] The List Blobs operation returns a list of the blobs under the specified container", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Prefix" - }, - { - "$ref": "#/parameters/Marker" - }, - { - "$ref": "#/parameters/MaxResults" - }, - { - "$ref": "#/parameters/ListBlobsInclude" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "Content-Type": { - "type": "string", - "description": "The media type of the body of the response. For List Blobs this is 'application/xml'" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/ListBlobsFlatSegmentResponse" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "NextMarker" - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "list" - ] - } - ] - }, - "/{containerName}?restype=container&comp=list&hierarchy": { - "get": { - "tags": [ - "containers" - ], - "operationId": "Container_ListBlobHierarchySegment", - "description": "[Update] The List Blobs operation returns a list of the blobs under the specified container", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Prefix" - }, - { - "$ref": "#/parameters/Delimiter" - }, - { - "$ref": "#/parameters/Marker" - }, - { - "$ref": "#/parameters/MaxResults" - }, - { - "$ref": "#/parameters/ListBlobsInclude" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "Content-Type": { - "type": "string", - "description": "The media type of the body of the response. For List Blobs this is 'application/xml'" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/ListBlobsHierarchySegmentResponse" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "NextMarker" - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "container" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "list" - ] - } - ] - }, - "/{containerName}?restype=account&comp=properties": { - "get": { - "tags": [ - "container" - ], - "operationId": "Container_GetAccountInfo", - "description": "Returns the sku name and account kind ", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success (OK)", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-sku-name": { - "x-ms-client-name": "SkuName", - "type": "string", - "enum": [ - "Standard_LRS", - "Standard_GRS", - "Standard_RAGRS", - "Standard_ZRS", - "Premium_LRS" - ], - "x-ms-enum": { - "name": "SkuName", - "modelAsString": false - }, - "description": "Identifies the sku name of the account" - }, - "x-ms-account-kind": { - "x-ms-client-name": "AccountKind", - "type": "string", - "enum": [ - "Storage", - "BlobStorage", - "StorageV2" - ], - "x-ms-enum": { - "name": "AccountKind", - "modelAsString": false - }, - "description": "Identifies the account kind" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "account" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/{containerName}/{blob}": { - "get": { - "tags": [ - "blob" - ], - "operationId": "Blob_Download", - "description": "The Download operation reads or downloads a blob from the system, including its metadata and properties. You can also call Download to read a snapshot or verison.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Snapshot" - }, - { - "$ref": "#/parameters/VersionId" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Range" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/GetRangeContentMD5" - }, - { - "$ref": "#/parameters/EncryptionKey" - }, - { - "$ref": "#/parameters/EncryptionKeySha256" - }, - { - "$ref": "#/parameters/EncryptionAlgorithm" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Returns the content of the entire blob.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-meta": { - "type": "string", - "x-ms-client-name": "Metadata", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "Content-Length": { - "type": "integer", - "format": "int64", - "description": "The number of bytes present in the response body." - }, - "Content-Type": { - "type": "string", - "description": "The media type of the body of the response. For Download Blob this is 'application/octet-stream'" - }, - "Content-Range": { - "type": "string", - "description": "Indicates the range of bytes returned in the event that the client requested a subset of the blob by setting the 'Range' request header." - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "Content-Encoding": { - "type": "string", - "description": "This header returns the value that was specified for the Content-Encoding request header" - }, - "Cache-Control": { - "type": "string", - "description": "This header is returned if it was previously specified for the blob." - }, - "Content-Disposition": { - "type": "string", - "description": "This header returns the value that was specified for the 'x-ms-blob-content-disposition' header. The Content-Disposition response header field conveys additional information about how to process the response payload, and also can be used to attach additional metadata. For example, if set to attachment, it indicates that the user-agent should not display the response, but instead show a Save As dialog with a filename other than the blob name specified." - }, - "Content-Language": { - "type": "string", - "description": "This header returns the value that was specified for the Content-Language request header." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for a page blob. This header is not returned for block blobs or append blobs" - }, - "x-ms-blob-type": { - "x-ms-client-name": "BlobType", - "description": "The blob's type.", - "type": "string", - "enum": [ - "BlockBlob", - "PageBlob", - "AppendBlob" - ], - "x-ms-enum": { - "name": "BlobType", - "modelAsString": false - } - }, - "x-ms-copy-completion-time": { - "x-ms-client-name": "CopyCompletionTime", - "type": "string", - "format": "date-time-rfc1123", - "description": "Conclusion time of the last attempted Copy Blob operation where this blob was the destination blob. This value can specify the time of a completed, aborted, or failed copy attempt. This header does not appear if a copy is pending, if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List." - }, - "x-ms-copy-status-description": { - "x-ms-client-name": "CopyStatusDescription", - "type": "string", - "description": "Only appears when x-ms-copy-status is failed or pending. Describes the cause of the last fatal or non-fatal copy operation failure. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List" - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or pass to Abort Copy Blob to abort a pending copy." - }, - "x-ms-copy-progress": { - "x-ms-client-name": "CopyProgress", - "type": "string", - "description": "Contains the number of bytes copied and the total bytes in the source in the last attempted Copy Blob operation where this blob was the destination blob. Can show between 0 and Content-Length bytes copied. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List" - }, - "x-ms-copy-source": { - "x-ms-client-name": "CopySource", - "type": "string", - "description": "URL up to 2 KB in length that specifies the source blob or file used in the last attempted Copy Blob operation where this blob was the destination blob. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List." - }, - "x-ms-copy-status": { - "x-ms-client-name": "CopyStatus", - "description": "State of the copy operation identified by x-ms-copy-id.", - "type": "string", - "enum": [ - "pending", - "success", - "aborted", - "failed" - ], - "x-ms-enum": { - "name": "CopyStatusType", - "modelAsString": false - } - }, - "x-ms-lease-duration": { - "x-ms-client-name": "LeaseDuration", - "description": "When a blob is leased, specifies whether the lease is of infinite or fixed duration.", - "type": "string", - "enum": [ - "infinite", - "fixed" - ], - "x-ms-enum": { - "name": "LeaseDurationType", - "modelAsString": false - } - }, - "x-ms-lease-state": { - "x-ms-client-name": "LeaseState", - "description": "Lease state of the blob.", - "type": "string", - "enum": [ - "available", - "leased", - "expired", - "breaking", - "broken" - ], - "x-ms-enum": { - "name": "LeaseStateType", - "modelAsString": false - } - }, - "x-ms-lease-status": { - "x-ms-client-name": "LeaseStatus", - "description": "The current lease status of the blob.", - "type": "string", - "enum": [ - "locked", - "unlocked" - ], - "x-ms-enum": { - "name": "LeaseStatusType", - "modelAsString": false - } - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Accept-Ranges": { - "type": "string", - "description": "Indicates that the service supports requests for partial blob content." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-blob-committed-block-count": { - "x-ms-client-name": "BlobCommittedBlockCount", - "type": "integer", - "description": "The number of committed blocks present in the blob. This header is returned only for append blobs." - }, - "x-ms-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the blob data and application metadata are completely encrypted using the specified algorithm. Otherwise, the value is set to false (when the blob is unencrypted, or if only parts of the blob/application metadata are encrypted)." - }, - "x-ms-encryption-key-sha256": { - "x-ms-client-name": "EncryptionKeySha256", - "type": "string", - "description": "The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted with a customer-provided key." - }, - "x-ms-blob-content-md5": { - "x-ms-client-name": "BlobContentMD5", - "type": "string", - "format": "byte", - "description": "If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5 header, with the latter calculated from the requested range" - } - }, - "schema": { - "type": "object", - "format": "file" - } - }, - "206": { - "description": "Returns the content of a specified range of the blob.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-meta": { - "type": "string", - "x-ms-client-name": "Metadata", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "Content-Length": { - "type": "integer", - "format": "int64", - "description": "The number of bytes present in the response body." - }, - "Content-Type": { - "type": "string", - "description": "The media type of the body of the response. For Download Blob this is 'application/octet-stream'" - }, - "Content-Range": { - "type": "string", - "description": "Indicates the range of bytes returned in the event that the client requested a subset of the blob by setting the 'Range' request header." - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "Content-Encoding": { - "type": "string", - "description": "This header returns the value that was specified for the Content-Encoding request header" - }, - "Cache-Control": { - "type": "string", - "description": "This header is returned if it was previously specified for the blob." - }, - "Content-Disposition": { - "type": "string", - "description": "This header returns the value that was specified for the 'x-ms-blob-content-disposition' header. The Content-Disposition response header field conveys additional information about how to process the response payload, and also can be used to attach additional metadata. For example, if set to attachment, it indicates that the user-agent should not display the response, but instead show a Save As dialog with a filename other than the blob name specified." - }, - "Content-Language": { - "type": "string", - "description": "This header returns the value that was specified for the Content-Language request header." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for a page blob. This header is not returned for block blobs or append blobs" - }, - "x-ms-blob-type": { - "x-ms-client-name": "BlobType", - "description": "The blob's type.", - "type": "string", - "enum": [ - "BlockBlob", - "PageBlob", - "AppendBlob" - ], - "x-ms-enum": { - "name": "BlobType", - "modelAsString": false - } - }, - "x-ms-copy-completion-time": { - "x-ms-client-name": "CopyCompletionTime", - "type": "string", - "format": "date-time-rfc1123", - "description": "Conclusion time of the last attempted Copy Blob operation where this blob was the destination blob. This value can specify the time of a completed, aborted, or failed copy attempt. This header does not appear if a copy is pending, if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List." - }, - "x-ms-copy-status-description": { - "x-ms-client-name": "CopyStatusDescription", - "type": "string", - "description": "Only appears when x-ms-copy-status is failed or pending. Describes the cause of the last fatal or non-fatal copy operation failure. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List" - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or pass to Abort Copy Blob to abort a pending copy." - }, - "x-ms-copy-progress": { - "x-ms-client-name": "CopyProgress", - "type": "string", - "description": "Contains the number of bytes copied and the total bytes in the source in the last attempted Copy Blob operation where this blob was the destination blob. Can show between 0 and Content-Length bytes copied. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List" - }, - "x-ms-copy-source": { - "x-ms-client-name": "CopySource", - "type": "string", - "description": "URL up to 2 KB in length that specifies the source blob or file used in the last attempted Copy Blob operation where this blob was the destination blob. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List." - }, - "x-ms-copy-status": { - "x-ms-client-name": "CopyStatus", - "description": "State of the copy operation identified by x-ms-copy-id.", - "type": "string", - "enum": [ - "pending", - "success", - "aborted", - "failed" - ], - "x-ms-enum": { - "name": "CopyStatusType", - "modelAsString": false - } - }, - "x-ms-lease-duration": { - "x-ms-client-name": "LeaseDuration", - "description": "When a blob is leased, specifies whether the lease is of infinite or fixed duration.", - "type": "string", - "enum": [ - "infinite", - "fixed" - ], - "x-ms-enum": { - "name": "LeaseDurationType", - "modelAsString": false - } - }, - "x-ms-lease-state": { - "x-ms-client-name": "LeaseState", - "description": "Lease state of the blob.", - "type": "string", - "enum": [ - "available", - "leased", - "expired", - "breaking", - "broken" - ], - "x-ms-enum": { - "name": "LeaseStateType", - "modelAsString": false - } - }, - "x-ms-lease-status": { - "x-ms-client-name": "LeaseStatus", - "description": "The current lease status of the blob.", - "type": "string", - "enum": [ - "locked", - "unlocked" - ], - "x-ms-enum": { - "name": "LeaseStatusType", - "modelAsString": false - } - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Accept-Ranges": { - "type": "string", - "description": "Indicates that the service supports requests for partial blob content." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-blob-committed-block-count": { - "x-ms-client-name": "BlobCommittedBlockCount", - "type": "integer", - "description": "The number of committed blocks present in the blob. This header is returned only for append blobs." - }, - "x-ms-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the blob data and application metadata are completely encrypted using the specified algorithm. Otherwise, the value is set to false (when the blob is unencrypted, or if only parts of the blob/application metadata are encrypted)." - }, - "x-ms-blob-content-md5": { - "x-ms-client-name": "BlobContentMD5", - "type": "string", - "format": "byte", - "description": "If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5 header, with the latter calculated from the requested range" - } - }, - "schema": { - "type": "object", - "format": "file" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "head": { - "tags": [ - "blob" - ], - "operationId": "Blob_GetProperties", - "description": "The Get Properties operation returns all user-defined metadata, standard HTTP properties, and system properties for the blob. It does not return the content of the blob.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Snapshot" - }, - { - "$ref": "#/parameters/VersionId" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/EncryptionKey" - }, - { - "$ref": "#/parameters/EncryptionKeySha256" - }, - { - "$ref": "#/parameters/EncryptionAlgorithm" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Returns the properties of the blob.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the blob was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-creation-time": { - "x-ms-client-name": "CreationTime", - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the blob was created." - }, - "x-ms-meta": { - "type": "string", - "x-ms-client-name": "Metadata", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "x-ms-blob-type": { - "x-ms-client-name": "BlobType", - "description": "The blob's type.", - "type": "string", - "enum": [ - "BlockBlob", - "PageBlob", - "AppendBlob" - ], - "x-ms-enum": { - "name": "BlobType", - "modelAsString": false - } - }, - "x-ms-copy-completion-time": { - "x-ms-client-name": "CopyCompletionTime", - "type": "string", - "format": "date-time-rfc1123", - "description": "Conclusion time of the last attempted Copy Blob operation where this blob was the destination blob. This value can specify the time of a completed, aborted, or failed copy attempt. This header does not appear if a copy is pending, if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List." - }, - "x-ms-copy-status-description": { - "x-ms-client-name": "CopyStatusDescription", - "type": "string", - "description": "Only appears when x-ms-copy-status is failed or pending. Describes the cause of the last fatal or non-fatal copy operation failure. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List" - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or pass to Abort Copy Blob to abort a pending copy." - }, - "x-ms-copy-progress": { - "x-ms-client-name": "CopyProgress", - "type": "string", - "description": "Contains the number of bytes copied and the total bytes in the source in the last attempted Copy Blob operation where this blob was the destination blob. Can show between 0 and Content-Length bytes copied. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List" - }, - "x-ms-copy-source": { - "x-ms-client-name": "CopySource", - "type": "string", - "description": "URL up to 2 KB in length that specifies the source blob or file used in the last attempted Copy Blob operation where this blob was the destination blob. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List." - }, - "x-ms-copy-status": { - "x-ms-client-name": "CopyStatus", - "description": "State of the copy operation identified by x-ms-copy-id.", - "type": "string", - "enum": [ - "pending", - "success", - "aborted", - "failed" - ], - "x-ms-enum": { - "name": "CopyStatusType", - "modelAsString": false - } - }, - "x-ms-incremental-copy": { - "x-ms-client-name": "IsIncrementalCopy", - "type": "boolean", - "description": "Included if the blob is incremental copy blob." - }, - "x-ms-copy-destination-snapshot": { - "x-ms-client-name": "DestinationSnapshot", - "type": "string", - "description": "Included if the blob is incremental copy blob or incremental copy snapshot, if x-ms-copy-status is success. Snapshot time of the last successful incremental copy snapshot for this blob." - }, - "x-ms-lease-duration": { - "x-ms-client-name": "LeaseDuration", - "description": "When a blob is leased, specifies whether the lease is of infinite or fixed duration.", - "type": "string", - "enum": [ - "infinite", - "fixed" - ], - "x-ms-enum": { - "name": "LeaseDurationType", - "modelAsString": false - } - }, - "x-ms-lease-state": { - "x-ms-client-name": "LeaseState", - "description": "Lease state of the blob.", - "type": "string", - "enum": [ - "available", - "leased", - "expired", - "breaking", - "broken" - ], - "x-ms-enum": { - "name": "LeaseStateType", - "modelAsString": false - } - }, - "x-ms-lease-status": { - "x-ms-client-name": "LeaseStatus", - "description": "The current lease status of the blob.", - "type": "string", - "enum": [ - "locked", - "unlocked" - ], - "x-ms-enum": { - "name": "LeaseStatusType", - "modelAsString": false - } - }, - "Content-Length": { - "type": "integer", - "format": "int64", - "description": "The number of bytes present in the response body." - }, - "Content-Type": { - "type": "string", - "description": "The content type specified for the blob. The default content type is 'application/octet-stream'" - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "Content-Encoding": { - "type": "string", - "description": "This header returns the value that was specified for the Content-Encoding request header" - }, - "Content-Disposition": { - "type": "string", - "description": "This header returns the value that was specified for the 'x-ms-blob-content-disposition' header. The Content-Disposition response header field conveys additional information about how to process the response payload, and also can be used to attach additional metadata. For example, if set to attachment, it indicates that the user-agent should not display the response, but instead show a Save As dialog with a filename other than the blob name specified." - }, - "Content-Language": { - "type": "string", - "description": "This header returns the value that was specified for the Content-Language request header." - }, - "Cache-Control": { - "type": "string", - "description": "This header is returned if it was previously specified for the blob." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for a page blob. This header is not returned for block blobs or append blobs" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "Accept-Ranges": { - "type": "string", - "description": "Indicates that the service supports requests for partial blob content." - }, - "x-ms-blob-committed-block-count": { - "x-ms-client-name": "BlobCommittedBlockCount", - "type": "integer", - "description": "The number of committed blocks present in the blob. This header is returned only for append blobs." - }, - "x-ms-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the blob data and application metadata are completely encrypted using the specified algorithm. Otherwise, the value is set to false (when the blob is unencrypted, or if only parts of the blob/application metadata are encrypted)." - }, - "x-ms-encryption-key-sha256": { - "x-ms-client-name": "EncryptionKeySha256", - "type": "string", - "description": "The SHA-256 hash of the encryption key used to encrypt the metadata. This header is only returned when the metadata was encrypted with a customer-provided key." - }, - "x-ms-access-tier": { - "x-ms-client-name": "AccessTier", - "type": "string", - "description": "The tier of page blob on a premium storage account or tier of block blob on blob storage LRS accounts. For a list of allowed premium page blob tiers, see https://docs.microsoft.com/en-us/azure/virtual-machines/windows/premium-storage#features. For blob storage LRS accounts, valid values are Hot/Cool/Archive." - }, - "x-ms-access-tier-inferred": { - "x-ms-client-name": "AccessTierInferred", - "type": "boolean", - "description": "For page blobs on a premium storage account only. If the access tier is not explicitly set on the blob, the tier is inferred based on its content length and this header will be returned with true value." - }, - "x-ms-archive-status": { - "x-ms-client-name": "ArchiveStatus", - "type": "string", - "description": "For blob storage LRS accounts, valid values are rehydrate-pending-to-hot/rehydrate-pending-to-cool. If the blob is being rehydrated and is not complete then this header is returned indicating that rehydrate is pending and also tells the destination tier." - }, - "x-ms-access-tier-change-time": { - "x-ms-client-name": "AccessTierChangeTime", - "type": "string", - "format": "date-time-rfc1123", - "description": "The time the tier was changed on the object. This is only returned if the tier on the block blob was ever set." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "delete": { - "tags": [ - "blob" - ], - "operationId": "Blob_Delete", - "description": "If the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently removed from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is deleted, it is marked for deletion and becomes inaccessible immediately. However, the blob service retains the blob or snapshot for the number of days specified by the DeleteRetentionPolicy section of [Storage service properties] (Set-Blob-Service-Properties.md). After the specified number of days has passed, the blob's data is permanently removed from the storage account. Note that you continue to be charged for the soft-deleted blob's storage until it is permanently removed. Use the List Blobs API and specify the \"include=deleted\" query parameter to discover which blobs and snapshots have been soft deleted. You can then use the Undelete Blob API to restore a soft-deleted blob. All other operations on a soft-deleted blob or snapshot causes the service to return an HTTP status code of 404 (ResourceNotFound). If the storage account's automatic snapshot feature is enabled, then, when a blob is deleted, an automatic snapshot is created. The blob becomes inaccessible immediately. All other operations on the blob causes the service to return an HTTP status code of 404 (ResourceNotFound). You can access automatic snapshot using snapshot timestamp or version id. You can restore the blob by calling Put or Copy Blob API with automatic snapshot as source. Deleting automatic snapshot requires shared key or special SAS/RBAC permissions.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Snapshot" - }, - { - "$ref": "#/parameters/VersionId" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/DeleteSnapshots" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "The delete request was accepted and the blob will be deleted.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - } - }, - "/{containerName}/{blob}?PageBlob": { - "put": { - "tags": [ - "blob" - ], - "operationId": "PageBlob_Create", - "description": "The Create operation creates a new page blob.", - "consumes": [ - "application/octet-stream" - ], - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/BlobContentType" - }, - { - "$ref": "#/parameters/BlobContentEncoding" - }, - { - "$ref": "#/parameters/BlobContentLanguage" - }, - { - "$ref": "#/parameters/BlobContentMD5" - }, - { - "$ref": "#/parameters/BlobCacheControl" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/BlobContentDisposition" - }, - { - "$ref": "#/parameters/EncryptionKey" - }, - { - "$ref": "#/parameters/EncryptionKeySha256" - }, - { - "$ref": "#/parameters/EncryptionAlgorithm" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/BlobContentLengthRequired" - }, - { - "$ref": "#/parameters/BlobSequenceNumber" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The blob was created.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "x-ms-version-id": { - "x-ms-client-name": "VersionId", - "type": "string", - "description": "UTC date/time value generated by the service that identifies a version of the blob. This header is returned for requests made against version 2018-11-09 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - }, - "x-ms-encryption-key-sha256": { - "x-ms-client-name": "EncryptionKeySha256", - "type": "string", - "description": "The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted with a customer-provided key." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "x-ms-blob-type", - "x-ms-client-name": "blobType", - "in": "header", - "required": true, - "x-ms-parameter-location": "method", - "description": "Specifies the type of blob to create: block blob, page blob, or append blob.", - "type": "string", - "enum": [ - "PageBlob" - ], - "x-ms-enum": { - "name": "BlobType", - "modelAsString": false - } - } - ] - }, - "/{containerName}/{blob}?AppendBlob": { - "put": { - "tags": [ - "blob" - ], - "operationId": "AppendBlob_Create", - "description": "The Create Append Blob operation creates a new append blob.", - "consumes": [ - "application/octet-stream" - ], - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/BlobContentType" - }, - { - "$ref": "#/parameters/BlobContentEncoding" - }, - { - "$ref": "#/parameters/BlobContentLanguage" - }, - { - "$ref": "#/parameters/BlobContentMD5" - }, - { - "$ref": "#/parameters/BlobCacheControl" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/BlobContentDisposition" - }, - { - "$ref": "#/parameters/EncryptionKey" - }, - { - "$ref": "#/parameters/EncryptionKeySha256" - }, - { - "$ref": "#/parameters/EncryptionAlgorithm" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The blob was created.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "x-ms-version-id": { - "x-ms-client-name": "VersionId", - "type": "string", - "description": "UTC date/time value generated by the service that identifies a version of the blob. This header is returned for requests made against version 2018-11-09 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - }, - "x-ms-encryption-key-sha256": { - "x-ms-client-name": "EncryptionKeySha256", - "type": "string", - "description": "The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted with a customer-provided key." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "x-ms-blob-type", - "x-ms-client-name": "blobType", - "in": "header", - "required": true, - "x-ms-parameter-location": "method", - "description": "Specifies the type of blob to create: block blob, page blob, or append blob.", - "type": "string", - "enum": [ - "AppendBlob" - ], - "x-ms-enum": { - "name": "BlobType", - "modelAsString": false - } - } - ] - }, - "/{containerName}/{blob}?BlockBlob": { - "put": { - "tags": [ - "blob" - ], - "operationId": "BlockBlob_Upload", - "description": "The Upload Block Blob operation updates the content of an existing block blob. Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not supported with Put Blob; the content of the existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a block blob, use the Put Block List operation.", - "consumes": [ - "application/octet-stream" - ], - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Body" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/BlobContentType" - }, - { - "$ref": "#/parameters/BlobContentEncoding" - }, - { - "$ref": "#/parameters/BlobContentLanguage" - }, - { - "$ref": "#/parameters/BlobContentMD5" - }, - { - "$ref": "#/parameters/BlobCacheControl" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/BlobContentDisposition" - }, - { - "$ref": "#/parameters/EncryptionKey" - }, - { - "$ref": "#/parameters/EncryptionKeySha256" - }, - { - "$ref": "#/parameters/EncryptionAlgorithm" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The blob was updated.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "x-ms-version-id": { - "x-ms-client-name": "VersionId", - "type": "string", - "description": "UTC date/time value generated by the service that identifies a version of the blob. This header is returned for requests made against version 2018-11-09 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - }, - "x-ms-encryption-key-sha256": { - "x-ms-client-name": "EncryptionKeySha256", - "type": "string", - "description": "The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted with a customer-provided key." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "x-ms-blob-type", - "x-ms-client-name": "blobType", - "in": "header", - "required": true, - "x-ms-parameter-location": "method", - "description": "Specifies the type of blob to create: block blob, page blob, or append blob.", - "type": "string", - "enum": [ - "BlockBlob" - ], - "x-ms-enum": { - "name": "BlobType", - "modelAsString": false - } - } - ] - }, - "/{containerName}/{blob}?comp=undelete": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_Undelete", - "description": "Undelete a blob that was previously soft deleted", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The blob was undeleted successfully.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "undelete" - ] - } - ] - }, - "/{containerName}/{blob}?comp=properties&SetHTTPHeaders": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_SetHTTPHeaders", - "description": "The Set HTTP Headers operation sets system properties on the blob", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/BlobCacheControl" - }, - { - "$ref": "#/parameters/BlobContentType" - }, - { - "$ref": "#/parameters/BlobContentMD5" - }, - { - "$ref": "#/parameters/BlobContentEncoding" - }, - { - "$ref": "#/parameters/BlobContentLanguage" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/BlobContentDisposition" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The properties were set successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for a page blob. This header is not returned for block blobs or append blobs" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/{containerName}/{blob}?comp=metadata": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_SetMetadata", - "description": "The Set Blob Metadata operation sets user-defined metadata for the specified blob as one or more name-value pairs", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/EncryptionKey" - }, - { - "$ref": "#/parameters/EncryptionKeySha256" - }, - { - "$ref": "#/parameters/EncryptionAlgorithm" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The metadata was set successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - }, - "x-ms-encryption-key-sha256": { - "x-ms-client-name": "EncryptionKeySha256", - "type": "string", - "description": "The SHA-256 hash of the encryption key used to encrypt the metadata. This header is only returned when the metadata was encrypted with a customer-provided key." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "metadata" - ] - } - ] - }, - "/{containerName}/{blob}?comp=lease&acquire": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_AcquireLease", - "description": "[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseDuration" - }, - { - "$ref": "#/parameters/ProposedLeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The Acquire operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the blob was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-lease-id": { - "x-ms-client-name": "LeaseId", - "type": "string", - "description": "Uniquely identifies a blobs's lease" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "acquire" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}/{blob}?comp=lease&release": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_ReleaseLease", - "description": "[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdRequired" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The Release operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the blob was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "release" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}/{blob}?comp=lease&renew": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_RenewLease", - "description": "[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdRequired" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The Renew operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the blob was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-lease-id": { - "x-ms-client-name": "LeaseId", - "type": "string", - "description": "Uniquely identifies a blobs's lease" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "renew" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}/{blob}?comp=lease&change": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_ChangeLease", - "description": "[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdRequired" - }, - { - "$ref": "#/parameters/ProposedLeaseIdRequired" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The Change operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the blob was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-lease-id": { - "x-ms-client-name": "LeaseId", - "type": "string", - "description": "Uniquely identifies a blobs's lease" - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "change" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}/{blob}?comp=lease&break": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_BreakLease", - "description": "[Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseBreakPeriod" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "The Break operation completed successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the blob was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-lease-time": { - "x-ms-client-name": "LeaseTime", - "type": "integer", - "description": "Approximate time remaining in the lease period, in seconds." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "lease" - ] - }, - { - "name": "x-ms-lease-action", - "x-ms-client-name": "action", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "break" - ], - "x-ms-enum": { - "name": "LeaseAction", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Describes what lease action to take." - } - ] - }, - "/{containerName}/{blob}?comp=snapshot": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_CreateSnapshot", - "description": "The Create Snapshot operation creates a read-only snapshot of a blob", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/EncryptionKey" - }, - { - "$ref": "#/parameters/EncryptionKeySha256" - }, - { - "$ref": "#/parameters/EncryptionAlgorithm" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The snaptshot was taken successfully.", - "headers": { - "x-ms-snapshot": { - "x-ms-client-name": "Snapshot", - "type": "string", - "description": "Uniquely identifies the snapshot and indicates the snapshot version. It may be used in subsequent requests to access the snapshot" - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "x-ms-version-id": { - "x-ms-client-name": "VersionId", - "type": "string", - "description": "UTC date/time value generated by the service that identifies the version of the blob. This header is returned for requests made against version 2018-11-09 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "True if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise. For a snapshot request, this header is set to true when metadata was provided in the request and encrypted with a customer-provided key." - }, - "x-ms-encryption-key-sha256": { - "x-ms-client-name": "EncryptionKeySha256", - "type": "string", - "description": "The SHA-256 hash of the encryption key used to encrypt the source blob. This header is only returned when the blob was encrypted with a customer-provided key." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "snapshot" - ] - } - ] - }, - "/{containerName}/{blob}?comp=copy": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_StartCopyFromURL", - "description": "The Start Copy From URL operation copies a blob or an internet resource to a new blob.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/SourceIfModifiedSince" - }, - { - "$ref": "#/parameters/SourceIfUnmodifiedSince" - }, - { - "$ref": "#/parameters/SourceIfMatch" - }, - { - "$ref": "#/parameters/SourceIfNoneMatch" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/CopySource" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "The copy blob has been accepted with the specified copy status.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "x-ms-version-id": { - "x-ms-client-name": "VersionId", - "type": "string", - "description": "UTC date/time value generated by the service that identifies the version of the blob. This header is returned for requests made against version 2018-11-09 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or pass to Abort Copy Blob to abort a pending copy." - }, - "x-ms-copy-status": { - "x-ms-client-name": "CopyStatus", - "description": "State of the copy operation identified by x-ms-copy-id.", - "type": "string", - "enum": [ - "pending", - "success", - "aborted", - "failed" - ], - "x-ms-enum": { - "name": "CopyStatusType", - "modelAsString": false - } - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [] - }, - "/{containerName}/{blob}?comp=copy&sync": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_CopyFromURL", - "description": "The Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a response until the copy is complete.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/SourceIfModifiedSince" - }, - { - "$ref": "#/parameters/SourceIfUnmodifiedSince" - }, - { - "$ref": "#/parameters/SourceIfMatch" - }, - { - "$ref": "#/parameters/SourceIfNoneMatch" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/CopySource" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "The copy has completed.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "x-ms-version-id": { - "x-ms-client-name": "VersionId", - "type": "string", - "description": "UTC date/time value generated by the service that identifies the version of the blob. This header is returned for requests made against version 2018-11-09 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for this copy operation." - }, - "x-ms-copy-status": { - "x-ms-client-name": "CopyStatus", - "description": "State of the copy operation identified by x-ms-copy-id.", - "type": "string", - "enum": [ - "success" - ], - "x-ms-enum": { - "name": "SyncCopyStatusType", - "modelAsString": false - } - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "x-ms-requires-sync", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "true" - ] - } - ] - }, - "/{containerName}/{blob}?comp=copy©id={CopyId}": { - "put": { - "tags": [ - "blob" - ], - "operationId": "Blob_AbortCopyFromURL", - "description": "The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination blob with zero length and full metadata.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/CopyId" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "204": { - "description": "The delete request was accepted and the blob will be deleted.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "copy" - ] - }, - { - "name": "x-ms-copy-action", - "x-ms-client-name": "copyActionAbortConstant", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "abort" - ], - "x-ms-parameter-location": "method" - } - ] - }, - "/{containerName}/{blob}?comp=tier": { - "put": { - "tags": [ - "blobs" - ], - "operationId": "Blob_SetTier", - "description": "The Set Tier operation sets the tier on a blob. The operation is allowed on a page blob in a premium storage account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/AccessTier" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - } - ], - "responses": { - "200": { - "description": "The new tier will take effect immediately.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and newer." - } - } - }, - "202": { - "description": "The transition to the new tier is pending.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and newer." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "tier" - ] - } - ] - }, - "/{containerName}/{blob}?restype=account&comp=properties": { - "get": { - "tags": [ - "blob" - ], - "operationId": "Blob_GetAccountInfo", - "description": "Returns the sku name and account kind ", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Success (OK)", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-sku-name": { - "x-ms-client-name": "SkuName", - "type": "string", - "enum": [ - "Standard_LRS", - "Standard_GRS", - "Standard_RAGRS", - "Standard_ZRS", - "Premium_LRS" - ], - "x-ms-enum": { - "name": "SkuName", - "modelAsString": false - }, - "description": "Identifies the sku name of the account" - }, - "x-ms-account-kind": { - "x-ms-client-name": "AccountKind", - "type": "string", - "enum": [ - "Storage", - "BlobStorage", - "StorageV2" - ], - "x-ms-enum": { - "name": "AccountKind", - "modelAsString": false - }, - "description": "Identifies the account kind" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "account" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/{containerName}/{blob}?comp=block": { - "put": { - "tags": [ - "blockblob" - ], - "operationId": "BlockBlob_StageBlock", - "description": "The Stage Block operation creates a new block to be committed as part of a blob", - "consumes": [ - "application/octet-stream" - ], - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/BlockId" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/ContentMD5" - }, - { - "$ref": "#/parameters/Body" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/EncryptionKey" - }, - { - "$ref": "#/parameters/EncryptionKeySha256" - }, - { - "$ref": "#/parameters/EncryptionAlgorithm" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The block was created.", - "headers": { - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - }, - "x-ms-encryption-key-sha256": { - "x-ms-client-name": "EncryptionKeySha256", - "type": "string", - "description": "The SHA-256 hash of the encryption key used to encrypt the block. This header is only returned when the block was encrypted with a customer-provided key." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "block" - ] - } - ] - }, - "/{containerName}/{blob}?comp=block&fromURL": { - "put": { - "tags": [ - "blockblob" - ], - "operationId": "BlockBlob_StageBlockFromURL", - "description": "The Stage Block operation creates a new block to be committed as part of a blob where the contents are read from a URL.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/BlockId" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/SourceUrl" - }, - { - "$ref": "#/parameters/SourceRange" - }, - { - "$ref": "#/parameters/SourceContentMD5" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/EncryptionKey" - }, - { - "$ref": "#/parameters/EncryptionKeySha256" - }, - { - "$ref": "#/parameters/EncryptionAlgorithm" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - }, - { - "$ref": "#/parameters/SourceIfModifiedSince" - }, - { - "$ref": "#/parameters/SourceIfUnmodifiedSince" - }, - { - "$ref": "#/parameters/SourceIfMatch" - }, - { - "$ref": "#/parameters/SourceIfNoneMatch" - } - ], - "responses": { - "201": { - "description": "The block was created.", - "headers": { - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - }, - "x-ms-encryption-key-sha256": { - "x-ms-client-name": "EncryptionKeySha256", - "type": "string", - "description": "The SHA-256 hash of the encryption key used to encrypt the block. This header is only returned when the block was encrypted with a customer-provided key." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "block" - ] - } - ] - }, - "/{containerName}/{blob}?comp=blocklist": { - "put": { - "tags": [ - "blockblob" - ], - "operationId": "BlockBlob_CommitBlockList", - "description": "The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob. In order to be written as part of a blob, a block must have been successfully written to the server in a prior Put Block operation. You can call Put Block List to update a blob by uploading only those blocks that have changed, then committing the new and existing blocks together. You can do this by specifying whether to commit a block from the committed block list or from the uncommitted block list, or to commit the most recently uploaded version of the block, whichever list it may belong to.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/BlobCacheControl" - }, - { - "$ref": "#/parameters/BlobContentType" - }, - { - "$ref": "#/parameters/BlobContentEncoding" - }, - { - "$ref": "#/parameters/BlobContentLanguage" - }, - { - "$ref": "#/parameters/BlobContentMD5" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/BlobContentDisposition" - }, - { - "$ref": "#/parameters/EncryptionKey" - }, - { - "$ref": "#/parameters/EncryptionKeySha256" - }, - { - "$ref": "#/parameters/EncryptionAlgorithm" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "name": "blocks", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/BlockLookupList" - } - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The block list was recorded.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "x-ms-version-id": { - "x-ms-client-name": "VersionId", - "type": "string", - "description": "UTC date/time value generated by the service that identifies a version of the blob. This header is returned for requests made against version 2018-11-09 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - }, - "x-ms-encryption-key-sha256": { - "x-ms-client-name": "EncryptionKeySha256", - "type": "string", - "description": "The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted with a customer-provided key." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "get": { - "tags": [ - "blockblob" - ], - "operationId": "BlockBlob_GetBlockList", - "description": "The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Snapshot" - }, - { - "$ref": "#/parameters/VersionId" - }, - { - "$ref": "#/parameters/BlockListType" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The page range was written.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Content-Type": { - "type": "string", - "description": "The media type of the body of the response. For Get Block List this is 'application/xml'" - }, - "x-ms-blob-content-length": { - "x-ms-client-name": "BlobContentLength", - "type": "integer", - "format": "int64", - "description": "The size of the blob in bytes." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/BlockList" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "blocklist" - ] - } - ] - }, - "/{containerName}/{blob}?comp=page&update": { - "put": { - "tags": [ - "pageblob" - ], - "operationId": "PageBlob_UploadPages", - "description": "The Upload Pages operation writes a range of pages to a page blob", - "consumes": [ - "application/octet-stream" - ], - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Body" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/ContentMD5" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Range" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/EncryptionKey" - }, - { - "$ref": "#/parameters/EncryptionKeySha256" - }, - { - "$ref": "#/parameters/EncryptionAlgorithm" - }, - { - "$ref": "#/parameters/IfSequenceNumberLessThanOrEqualTo" - }, - { - "$ref": "#/parameters/IfSequenceNumberLessThan" - }, - { - "$ref": "#/parameters/IfSequenceNumberEqualTo" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The page range was written.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for the page blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - }, - "x-ms-encryption-key-sha256": { - "x-ms-client-name": "EncryptionKeySha256", - "type": "string", - "description": "The SHA-256 hash of the encryption key used to encrypt the pages. This header is only returned when the pages were encrypted with a customer-provided key." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "page" - ] - }, - { - "name": "x-ms-page-write", - "x-ms-client-name": "pageWrite", - "in": "header", - "required": true, - "x-ms-parameter-location": "method", - "description": "Required. You may specify one of the following options:\n - Update: Writes the bytes specified by the request body into the specified range. The Range and Content-Length headers must match to perform the update.\n - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero, and the Range header to a value that indicates the range to clear, up to maximum blob size.", - "type": "string", - "enum": [ - "update" - ], - "x-ms-enum": { - "name": "PageWriteType", - "modelAsString": false - } - } - ] - }, - "/{containerName}/{blob}?comp=page&clear": { - "put": { - "tags": [ - "pageblob" - ], - "operationId": "PageBlob_ClearPages", - "description": "The Clear Pages operation clears a set of pages from a page blob", - "consumes": [ - "application/octet-stream" - ], - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Range" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfSequenceNumberLessThanOrEqualTo" - }, - { - "$ref": "#/parameters/IfSequenceNumberLessThan" - }, - { - "$ref": "#/parameters/IfSequenceNumberEqualTo" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The page range was cleared.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for the page blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "page" - ] - }, - { - "name": "x-ms-page-write", - "x-ms-client-name": "pageWrite", - "in": "header", - "required": true, - "x-ms-parameter-location": "method", - "description": "Required. You may specify one of the following options:\n - Update: Writes the bytes specified by the request body into the specified range. The Range and Content-Length headers must match to perform the update.\n - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero, and the Range header to a value that indicates the range to clear, up to maximum blob size.", - "type": "string", - "enum": [ - "clear" - ], - "x-ms-enum": { - "name": "PageWriteType", - "modelAsString": false - } - } - ] - }, - "/{containerName}/{blob}?comp=page&update&fromUrl": { - "put": { - "tags": [ - "pageblob" - ], - "operationId": "PageBlob_UploadPagesFromURL", - "description": "The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL", - "consumes": [ - "application/octet-stream" - ], - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/SourceUrl" - }, - { - "$ref": "#/parameters/SourceRangeRequiredPutPageFromUrl" - }, - { - "$ref": "#/parameters/SourceContentMD5" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/RangeRequiredPutPageFromUrl" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfSequenceNumberLessThanOrEqualTo" - }, - { - "$ref": "#/parameters/IfSequenceNumberLessThan" - }, - { - "$ref": "#/parameters/IfSequenceNumberEqualTo" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/SourceIfModifiedSince" - }, - { - "$ref": "#/parameters/SourceIfUnmodifiedSince" - }, - { - "$ref": "#/parameters/SourceIfMatch" - }, - { - "$ref": "#/parameters/SourceIfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The page range was written.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for the page blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "page" - ] - }, - { - "name": "x-ms-page-write", - "x-ms-client-name": "pageWrite", - "in": "header", - "required": true, - "x-ms-parameter-location": "method", - "description": "Required. You may specify one of the following options:\n - Update: Writes the bytes specified by the request body into the specified range. The Range and Content-Length headers must match to perform the update.\n - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero, and the Range header to a value that indicates the range to clear, up to maximum blob size.", - "type": "string", - "enum": [ - "update" - ], - "x-ms-enum": { - "name": "PageWriteType", - "modelAsString": false - } - } - ] - }, - "/{containerName}/{blob}?comp=pagelist": { - "get": { - "tags": [ - "pageblob" - ], - "operationId": "PageBlob_GetPageRanges", - "description": "The Get Page Ranges operation returns the list of valid page ranges for a page blob, version or snapshot of a page blob", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Snapshot" - }, - { - "$ref": "#/parameters/VersionId" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Range" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Information on the page blob was found.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "x-ms-blob-content-length": { - "x-ms-client-name": "BlobContentLength", - "type": "integer", - "format": "int64", - "description": "The size of the blob in bytes." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/PageList" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "pagelist" - ] - } - ] - }, - "/{containerName}/{blob}?comp=pagelist&diff": { - "get": { - "tags": [ - "pageblob" - ], - "operationId": "PageBlob_GetPageRangesDiff", - "description": "[Update] The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob that were changed between target blob and previous snapshot or version.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Snapshot" - }, - { - "$ref": "#/parameters/VersionId" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/PrevSnapshot" - }, - { - "$ref": "#/parameters/Range" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Information on the page blob was found.", - "headers": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "x-ms-blob-content-length": { - "x-ms-client-name": "BlobContentLength", - "type": "integer", - "format": "int64", - "description": "The size of the blob in bytes." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/PageList" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "pagelist" - ] - } - ] - }, - "/{containerName}/{blob}?comp=properties&Resize": { - "put": { - "tags": [ - "pageblob" - ], - "operationId": "PageBlob_Resize", - "description": "Resize the Blob", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/BlobContentLengthRequired" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The Blob was resized successfully", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for a page blob. This header is not returned for block blobs or append blobs" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/{containerName}/{blob}?comp=properties&UpdateSequenceNumber": { - "put": { - "tags": [ - "pageblob" - ], - "operationId": "PageBlob_UpdateSequenceNumber", - "description": "Update the sequence number of the blob", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/SequenceNumberAction" - }, - { - "$ref": "#/parameters/BlobSequenceNumber" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "The sequence numbers were updated successfully.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "BlobSequenceNumber", - "type": "integer", - "format": "int64", - "description": "The current sequence number for a page blob. This header is not returned for block blobs or append blobs" - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/{containerName}/{blob}?comp=incrementalcopy": { - "put": { - "tags": [ - "pageblob" - ], - "operationId": "PageBlob_CopyIncremental", - "description": "The Copy Incremental operation copies a snapshot of the source page blob to a destination page blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as usual. This API is supported since REST version 2016-05-31.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/CopySource" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "The blob was copied.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-copy-id": { - "x-ms-client-name": "CopyId", - "type": "string", - "description": "String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or pass to Abort Copy Blob to abort a pending copy." - }, - "x-ms-copy-status": { - "x-ms-client-name": "CopyStatus", - "description": "State of the copy operation identified by x-ms-copy-id.", - "type": "string", - "enum": [ - "pending", - "success", - "aborted", - "failed" - ], - "x-ms-enum": { - "name": "CopyStatusType", - "modelAsString": false - } - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "incrementalcopy" - ] - } - ] - }, - "/{containerName}/{blob}?comp=appendblock": { - "put": { - "tags": [ - "appendblob" - ], - "consumes": [ - "application/octet-stream" - ], - "operationId": "AppendBlob_AppendBlock", - "description": "The Append Block operation commits a new block of data to the end of an existing append blob. The Append Block operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/Body" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/ContentMD5" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/BlobConditionMaxSize" - }, - { - "$ref": "#/parameters/BlobConditionAppendPos" - }, - { - "$ref": "#/parameters/EncryptionKey" - }, - { - "$ref": "#/parameters/EncryptionKeySha256" - }, - { - "$ref": "#/parameters/EncryptionAlgorithm" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The block was created.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-blob-append-offset": { - "x-ms-client-name": "BlobAppendOffset", - "type": "string", - "description": "This response header is returned only for append operations. It returns the offset at which the block was committed, in bytes." - }, - "x-ms-blob-committed-block-count": { - "x-ms-client-name": "BlobCommittedBlockCount", - "type": "integer", - "description": "The number of committed blocks present in the blob. This header is returned only for append blobs." - }, - "x-ms-request-server-encrypted": { - "x-ms-client-name": "IsServerEncrypted", - "type": "boolean", - "description": "The value of this header is set to true if the contents of the request are successfully encrypted using the specified algorithm, and false otherwise." - }, - "x-ms-encryption-key-sha256": { - "x-ms-client-name": "EncryptionKeySha256", - "type": "string", - "description": "The SHA-256 hash of the encryption key used to encrypt the block. This header is only returned when the block was encrypted with a customer-provided key." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "appendblock" - ] - } - ] - }, - "/{containerName}/{blob}?comp=appendblock&fromUrl": { - "put": { - "tags": [ - "appendblob" - ], - "operationId": "AppendBlob_AppendBlockFromUrl", - "description": "The Append Block operation commits a new block of data to the end of an existing append blob where the contents are read from a source url. The Append Block operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later.", - "parameters": [ - { - "$ref": "#/parameters/ContainerName" - }, - { - "$ref": "#/parameters/Blob" - }, - { - "$ref": "#/parameters/SourceUrl" - }, - { - "$ref": "#/parameters/SourceRange" - }, - { - "$ref": "#/parameters/SourceContentMD5" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ContentLength" - }, - { - "$ref": "#/parameters/LeaseIdOptional" - }, - { - "$ref": "#/parameters/BlobConditionMaxSize" - }, - { - "$ref": "#/parameters/BlobConditionAppendPos" - }, - { - "$ref": "#/parameters/IfModifiedSince" - }, - { - "$ref": "#/parameters/IfUnmodifiedSince" - }, - { - "$ref": "#/parameters/IfMatch" - }, - { - "$ref": "#/parameters/IfNoneMatch" - }, - { - "$ref": "#/parameters/SourceIfModifiedSince" - }, - { - "$ref": "#/parameters/SourceIfUnmodifiedSince" - }, - { - "$ref": "#/parameters/SourceIfMatch" - }, - { - "$ref": "#/parameters/SourceIfNoneMatch" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "The block was created.", - "headers": { - "ETag": { - "type": "string", - "format": "etag", - "description": "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 value will be in quotes." - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123", - "description": "Returns the date and time the container was last modified. Any operation that modifies the blob, including an update of the blob's metadata or properties, changes the last-modified time of the blob." - }, - "Content-MD5": { - "type": "string", - "format": "byte", - "description": "If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the client can check for message content integrity." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Blob service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-blob-append-offset": { - "x-ms-client-name": "BlobAppendOffset", - "type": "string", - "description": "This response header is returned only for append operations. It returns the offset at which the block was committed, in bytes." - }, - "x-ms-blob-committed-block-count": { - "x-ms-client-name": "BlobCommittedBlockCount", - "type": "integer", - "description": "The number of committed blocks present in the blob. This header is returned only for append blobs." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "appendblock" - ] - } - ] - } - }, - "definitions": { - "KeyInfo": { - "type": "object", - "required": [ - "Start", - "Expiry" - ], - "description": "Key information", - "properties": { - "Start": { - "description": "The date-time the key is active in ISO 8601 UTC time", - "type": "string" - }, - "Expiry": { - "description": "The date-time the key expires in ISO 8601 UTC time", - "type": "string" - } - } - }, - "UserDelegationKey": { - "type": "object", - "required": [ - "SignedOid", - "SignedTid", - "SignedStart", - "SignedExpiry", - "SignedService", - "SignedVersion", - "Value" - ], - "description": "A user delegation key", - "properties": { - "SignedOid": { - "description": "The Azure Active Directory object ID in GUID format.", - "type": "string" - }, - "SignedTid": { - "description": "The Azure Active Directory tenant ID in GUID format", - "type": "string" - }, - "SignedStart": { - "description": "The date-time the key is active", - "type": "string", - "format": "date-time" - }, - "SignedExpiry": { - "description": "The date-time the key expires", - "type": "string", - "format": "date-time" - }, - "SignedService": { - "description": "Abbreviation of the Azure Storage service that accepts the key", - "type": "string" - }, - "SignedVersion": { - "description": "The service version that created the key", - "type": "string" - }, - "Value": { - "description": "The key as a base64 string", - "type": "string" - } - } - }, - "PublicAccessType": { - "type": "string", - "enum": [ - "container", - "blob" - ], - "x-ms-enum": { - "name": "PublicAccessType", - "modelAsString": true - } - }, - "CopyStatus": { - "type": "string", - "enum": [ - "pending", - "success", - "aborted", - "failed" - ], - "x-ms-enum": { - "name": "CopyStatusType", - "modelAsString": false - } - }, - "LeaseDuration": { - "type": "string", - "enum": [ - "infinite", - "fixed" - ], - "x-ms-enum": { - "name": "LeaseDurationType", - "modelAsString": false - } - }, - "LeaseState": { - "type": "string", - "enum": [ - "available", - "leased", - "expired", - "breaking", - "broken" - ], - "x-ms-enum": { - "name": "LeaseStateType", - "modelAsString": false - } - }, - "LeaseStatus": { - "type": "string", - "enum": [ - "locked", - "unlocked" - ], - "x-ms-enum": { - "name": "LeaseStatusType", - "modelAsString": false - } - }, - "StorageError": { - "type": "object", - "properties": { - "Code": { - "type": "string" - }, - "Message": { - "type": "string" - } - } - }, - "AccessPolicy": { - "type": "object", - "required": [ - "Start", - "Expiry", - "Permission" - ], - "description": "An Access policy", - "properties": { - "Start": { - "description": "the date-time the policy is active", - "type": "string", - "format": "date-time" - }, - "Expiry": { - "description": "the date-time the policy expires", - "type": "string", - "format": "date-time" - }, - "Permission": { - "description": "the permissions for the acl policy", - "type": "string" - } - } - }, - "AccessTier": { - "type": "string", - "enum": [ - "P4", - "P6", - "P10", - "P20", - "P30", - "P40", - "P50", - "Hot", - "Cool", - "Archive" - ], - "x-ms-enum": { - "name": "AccessTier", - "modelAsString": true - } - }, - "ArchiveStatus": { - "type": "string", - "enum": [ - "rehydrate-pending-to-hot", - "rehydrate-pending-to-cool" - ], - "x-ms-enum": { - "name": "ArchiveStatus", - "modelAsString": true - } - }, - "BlobItem": { - "xml": { - "name": "Blob" - }, - "description": "An Azure Storage blob", - "type": "object", - "required": [ - "Name", - "Deleted", - "Snapshot", - "VersionId", - "Properties" - ], - "properties": { - "Name": { - "type": "string" - }, - "Deleted": { - "type": "boolean" - }, - "Snapshot": { - "type": "string" - }, - "VersionId": { - "type": "string" - }, - "Properties": { - "$ref": "#/definitions/BlobProperties" - }, - "Metadata": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "IsPrefix": { - "type": "boolean" - } - } - }, - "BlobProperties": { - "xml": { - "name": "Properties" - }, - "description": "Properties of a blob", - "type": "object", - "required": [ - "Etag", - "Last-Modified" - ], - "properties": { - "Creation-Time": { - "type": "string", - "format": "date-time-rfc1123" - }, - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123" - }, - "Etag": { - "type": "string", - "format": "etag" - }, - "Content-Length": { - "type": "integer", - "format": "int64", - "description": "Size in bytes" - }, - "Content-Type": { - "type": "string" - }, - "Content-Encoding": { - "type": "string" - }, - "Content-Language": { - "type": "string" - }, - "Content-MD5": { - "type": "string", - "format": "byte" - }, - "Content-Disposition": { - "type": "string" - }, - "Cache-Control": { - "type": "string" - }, - "x-ms-blob-sequence-number": { - "x-ms-client-name": "blobSequenceNumber", - "type": "integer", - "format": "int64" - }, - "BlobType": { - "type": "string", - "enum": [ - "BlockBlob", - "PageBlob", - "AppendBlob" - ], - "x-ms-enum": { - "name": "BlobType", - "modelAsString": false - } - }, - "LeaseStatus": { - "$ref": "#/definitions/LeaseStatus" - }, - "LeaseState": { - "$ref": "#/definitions/LeaseState" - }, - "LeaseDuration": { - "$ref": "#/definitions/LeaseDuration" - }, - "CopyId": { - "type": "string" - }, - "CopyStatus": { - "$ref": "#/definitions/CopyStatus" - }, - "CopySource": { - "type": "string" - }, - "CopyProgress": { - "type": "string" - }, - "CopyCompletionTime": { - "type": "string", - "format": "date-time-rfc1123" - }, - "CopyStatusDescription": { - "type": "string" - }, - "ServerEncrypted": { - "type": "boolean" - }, - "IncrementalCopy": { - "type": "boolean" - }, - "DestinationSnapshot": { - "type": "string" - }, - "DeletedTime": { - "type": "string", - "format": "date-time-rfc1123" - }, - "RemainingRetentionDays": { - "type": "integer" - }, - "AccessTier": { - "$ref": "#/definitions/AccessTier" - }, - "AccessTierInferred": { - "type": "boolean" - }, - "ArchiveStatus": { - "$ref": "#/definitions/ArchiveStatus" - }, - "CustomerProvidedKeySha256": { - "type": "string" - }, - "AccessTierChangeTime": { - "type": "string", - "format": "date-time-rfc1123" - } - } - }, - "ListBlobsFlatSegmentResponse": { - "xml": { - "name": "EnumerationResults" - }, - "description": "An enumeration of blobs", - "type": "object", - "required": [ - "ServiceEndpoint", - "ContainerName", - "Prefix", - "Marker", - "MaxResults", - "Delimiter", - "Segment", - "NextMarker" - ], - "properties": { - "ServiceEndpoint": { - "type": "string", - "xml": { - "attribute": true - } - }, - "ContainerName": { - "type": "string", - "xml": { - "attribute": true - } - }, - "Prefix": { - "type": "string" - }, - "Marker": { - "type": "string" - }, - "MaxResults": { - "type": "integer" - }, - "Delimiter": { - "type": "string" - }, - "Segment": { - "$ref": "#/definitions/BlobFlatListSegment" - }, - "NextMarker": { - "type": "string" - } - } - }, - "ListBlobsHierarchySegmentResponse": { - "xml": { - "name": "EnumerationResults" - }, - "description": "An enumeration of blobs", - "type": "object", - "required": [ - "ServiceEndpoint", - "ContainerName", - "Prefix", - "Marker", - "MaxResults", - "Delimiter", - "Segment", - "NextMarker" - ], - "properties": { - "ServiceEndpoint": { - "type": "string", - "xml": { - "attribute": true - } - }, - "ContainerName": { - "type": "string", - "xml": { - "attribute": true - } - }, - "Prefix": { - "type": "string" - }, - "Marker": { - "type": "string" - }, - "MaxResults": { - "type": "integer" - }, - "Delimiter": { - "type": "string" - }, - "Segment": { - "$ref": "#/definitions/BlobHierarchyListSegment" - }, - "NextMarker": { - "type": "string" - } - } - }, - "BlobFlatListSegment": { - "xml": { - "name": "Blobs" - }, - "required": [ - "BlobItems" - ], - "type": "object", - "properties": { - "BlobItems": { - "type": "array", - "items": { - "$ref": "#/definitions/BlobItem" - } - } - } - }, - "BlobHierarchyListSegment": { - "xml": { - "name": "Blobs" - }, - "type": "object", - "required": [ - "BlobItems" - ], - "properties": { - "BlobPrefixes": { - "type": "array", - "items": { - "$ref": "#/definitions/BlobPrefix" - } - }, - "BlobItems": { - "type": "array", - "items": { - "$ref": "#/definitions/BlobItem" - } - } - } - }, - "BlobPrefix": { - "type": "object", - "required": [ - "Name" - ], - "properties": { - "Name": { - "type": "string" - } - } - }, - "Block": { - "type": "object", - "required": [ - "Name", - "Size" - ], - "description": "Represents a single block in a block blob. It describes the block's ID and size.", - "properties": { - "Name": { - "description": "The base64 encoded block ID.", - "type": "string" - }, - "Size": { - "description": "The block size in bytes.", - "type": "integer" - } - } - }, - "BlockList": { - "type": "object", - "properties": { - "CommittedBlocks": { - "xml": { - "wrapped": true - }, - "type": "array", - "items": { - "$ref": "#/definitions/Block" - } - }, - "UncommittedBlocks": { - "xml": { - "wrapped": true - }, - "type": "array", - "items": { - "$ref": "#/definitions/Block" - } - } - } - }, - "BlockLookupList": { - "type": "object", - "properties": { - "Committed": { - "type": "array", - "items": { - "type": "string", - "xml": { - "name": "Committed" - } - } - }, - "Uncommitted": { - "type": "array", - "items": { - "type": "string", - "xml": { - "name": "Uncommitted" - } - } - }, - "Latest": { - "type": "array", - "items": { - "type": "string", - "xml": { - "name": "Latest" - } - } - } - }, - "xml": { - "name": "BlockList" - } - }, - "ContainerItem": { - "xml": { - "name": "Container" - }, - "type": "object", - "required": [ - "Name", - "Properties" - ], - "description": "An Azure Storage container", - "properties": { - "Name": { - "type": "string" - }, - "Properties": { - "$ref": "#/definitions/ContainerProperties" - }, - "Metadata": { - "$ref": "#/definitions/ContainerMetadata" - } - } - }, - "ContainerProperties": { - "type": "object", - "required": [ - "Last-Modified", - "Etag" - ], - "description": "Properties of a container", - "properties": { - "Last-Modified": { - "type": "string", - "format": "date-time-rfc1123" - }, - "Etag": { - "type": "string", - "format": "etag" - }, - "LeaseStatus": { - "$ref": "#/definitions/LeaseStatus" - }, - "LeaseState": { - "$ref": "#/definitions/LeaseState" - }, - "LeaseDuration": { - "$ref": "#/definitions/LeaseDuration" - }, - "PublicAccess": { - "$ref": "#/definitions/PublicAccessType" - }, - "HasImmutabilityPolicy": { - "type": "boolean" - }, - "HasLegalHold": { - "type": "boolean" - } - } - }, - "ListContainersSegmentResponse": { - "xml": { - "name": "EnumerationResults" - }, - "description": "An enumeration of containers", - "type": "object", - "required": [ - "ServiceEndpoint", - "Prefix", - "MaxResults", - "NextMarker", - "ContainerItems" - ], - "properties": { - "ServiceEndpoint": { - "type": "string", - "xml": { - "attribute": true - } - }, - "Prefix": { - "type": "string" - }, - "Marker": { - "type": "string" - }, - "MaxResults": { - "type": "integer" - }, - "ContainerItems": { - "xml": { - "wrapped": true, - "name": "Containers" - }, - "type": "array", - "items": { - "$ref": "#/definitions/ContainerItem" - } - }, - "NextMarker": { - "type": "string" - } - } - }, - "CorsRule": { - "description": "CORS is an HTTP feature that enables a web application running under one domain to access resources in another domain. Web browsers implement a security restriction known as same-origin policy that prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin domain) to call APIs in another domain", - "type": "object", - "required": [ - "AllowedOrigins", - "AllowedMethods", - "AllowedHeaders", - "ExposedHeaders", - "MaxAgeInSeconds" - ], - "properties": { - "AllowedOrigins": { - "description": "The origin domains that are permitted to make a request against the storage service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be an exact case-sensitive match with the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all origin domains to make requests via CORS.", - "type": "string" - }, - "AllowedMethods": { - "description": "The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated)", - "type": "string" - }, - "AllowedHeaders": { - "description": "the request headers that the origin domain may specify on the CORS request.", - "type": "string" - }, - "ExposedHeaders": { - "description": "The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer", - "type": "string" - }, - "MaxAgeInSeconds": { - "description": "The maximum amount time that a browser should cache the preflight OPTIONS request.", - "type": "integer", - "minimum": 0 - } - } - }, - "ErrorCode": { - "description": "Error codes returned by the service", - "type": "string", - "enum": [ - "AccountAlreadyExists", - "AccountBeingCreated", - "AccountIsDisabled", - "AuthenticationFailed", - "AuthorizationFailure", - "ConditionHeadersNotSupported", - "ConditionNotMet", - "EmptyMetadataKey", - "InsufficientAccountPermissions", - "InternalError", - "InvalidAuthenticationInfo", - "InvalidHeaderValue", - "InvalidHttpVerb", - "InvalidInput", - "InvalidMd5", - "InvalidMetadata", - "InvalidQueryParameterValue", - "InvalidRange", - "InvalidResourceName", - "InvalidUri", - "InvalidXmlDocument", - "InvalidXmlNodeValue", - "Md5Mismatch", - "MetadataTooLarge", - "MissingContentLengthHeader", - "MissingRequiredQueryParameter", - "MissingRequiredHeader", - "MissingRequiredXmlNode", - "MultipleConditionHeadersNotSupported", - "OperationTimedOut", - "OutOfRangeInput", - "OutOfRangeQueryParameterValue", - "RequestBodyTooLarge", - "ResourceTypeMismatch", - "RequestUrlFailedToParse", - "ResourceAlreadyExists", - "ResourceNotFound", - "ServerBusy", - "UnsupportedHeader", - "UnsupportedXmlNode", - "UnsupportedQueryParameter", - "UnsupportedHttpVerb", - "AppendPositionConditionNotMet", - "BlobAlreadyExists", - "BlobNotFound", - "BlobOverwritten", - "BlobTierInadequateForContentLength", - "BlockCountExceedsLimit", - "BlockListTooLong", - "CannotChangeToLowerTier", - "CannotVerifyCopySource", - "ContainerAlreadyExists", - "ContainerBeingDeleted", - "ContainerDisabled", - "ContainerNotFound", - "ContentLengthLargerThanTierLimit", - "CopyAcrossAccountsNotSupported", - "CopyIdMismatch", - "FeatureVersionMismatch", - "IncrementalCopyBlobMismatch", - "IncrementalCopyOfEralierVersionSnapshotNotAllowed", - "IncrementalCopySourceMustBeSnapshot", - "InfiniteLeaseDurationRequired", - "InvalidBlobOrBlock", - "InvalidBlobTier", - "InvalidBlobType", - "InvalidBlockId", - "InvalidBlockList", - "InvalidOperation", - "InvalidPageRange", - "InvalidSourceBlobType", - "InvalidSourceBlobUrl", - "InvalidVersionForPageBlobOperation", - "LeaseAlreadyPresent", - "LeaseAlreadyBroken", - "LeaseIdMismatchWithBlobOperation", - "LeaseIdMismatchWithContainerOperation", - "LeaseIdMismatchWithLeaseOperation", - "LeaseIdMissing", - "LeaseIsBreakingAndCannotBeAcquired", - "LeaseIsBreakingAndCannotBeChanged", - "LeaseIsBrokenAndCannotBeRenewed", - "LeaseLost", - "LeaseNotPresentWithBlobOperation", - "LeaseNotPresentWithContainerOperation", - "LeaseNotPresentWithLeaseOperation", - "MaxBlobSizeConditionNotMet", - "NoPendingCopyOperation", - "OperationNotAllowedOnIncrementalCopyBlob", - "PendingCopyOperation", - "PreviousSnapshotCannotBeNewer", - "PreviousSnapshotNotFound", - "PreviousSnapshotOperationNotSupported", - "SequenceNumberConditionNotMet", - "SequenceNumberIncrementTooLarge", - "SnapshotCountExceeded", - "SnaphotOperationRateExceeded", - "SnapshotsPresent", - "SourceConditionNotMet", - "SystemInUse", - "TargetConditionNotMet", - "UnauthorizedBlobOverwrite", - "BlobBeingRehydrated", - "BlobArchived", - "BlobNotArchived" - ], - "x-ms-enum": { - "name": "StorageErrorCode", - "modelAsString": true - } - }, - "GeoReplication": { - "description": "Geo-Replication information for the Secondary Storage Service", - "type": "object", - "required": [ - "Status", - "LastSyncTime" - ], - "properties": { - "Status": { - "description": "The status of the secondary location", - "type": "string", - "enum": [ - "live", - "bootstrap", - "unavailable" - ], - "x-ms-enum": { - "name": "GeoReplicationStatusType", - "modelAsString": true - } - }, - "LastSyncTime": { - "description": "A GMT date/time value, to the second. All primary writes preceding this value are guaranteed to be available for read operations at the secondary. Primary writes after this point in time may or may not be available for reads.", - "type": "string", - "format": "date-time-rfc1123" - } - } - }, - "Logging": { - "description": "Azure Analytics Logging settings.", - "type": "object", - "required": [ - "Version", - "Delete", - "Read", - "Write", - "RetentionPolicy" - ], - "properties": { - "Version": { - "description": "The version of Storage Analytics to configure.", - "type": "string" - }, - "Delete": { - "description": "Indicates whether all delete requests should be logged.", - "type": "boolean" - }, - "Read": { - "description": "Indicates whether all read requests should be logged.", - "type": "boolean" - }, - "Write": { - "description": "Indicates whether all write requests should be logged.", - "type": "boolean" - }, - "RetentionPolicy": { - "$ref": "#/definitions/RetentionPolicy" - } - } - }, - "ContainerMetadata": { - "type": "object", - "xml": { - "name": "Metadata" - }, - "additionalProperties": { - "type": "string" - } - }, - "BlobMetadata": { - "type": "object", - "xml": { - "name": "Metadata" - }, - "properties": { - "Encrypted": { - "type": "string", - "xml": { - "attribute": true - } - } - }, - "additionalProperties": { - "type": "string" - } - }, - "Metrics": { - "description": "a summary of request statistics grouped by API in hour or minute aggregates for blobs", - "required": [ - "Enabled" - ], - "properties": { - "Version": { - "description": "The version of Storage Analytics to configure.", - "type": "string" - }, - "Enabled": { - "description": "Indicates whether metrics are enabled for the Blob service.", - "type": "boolean" - }, - "IncludeAPIs": { - "description": "Indicates whether metrics should generate summary statistics for called API operations.", - "type": "boolean" - }, - "RetentionPolicy": { - "$ref": "#/definitions/RetentionPolicy" - } - } - }, - "PageList": { - "description": "the list of pages", - "type": "object", - "properties": { - "PageRange": { - "type": "array", - "items": { - "$ref": "#/definitions/PageRange" - } - }, - "ClearRange": { - "type": "array", - "items": { - "$ref": "#/definitions/ClearRange" - } - } - } - }, - "PageRange": { - "type": "object", - "required": [ - "Start", - "End" - ], - "properties": { - "Start": { - "type": "integer", - "format": "int64", - "xml": { - "name": "Start" - } - }, - "End": { - "type": "integer", - "format": "int64", - "xml": { - "name": "End" - } - } - }, - "xml": { - "name": "PageRange" - } - }, - "ClearRange": { - "type": "object", - "required": [ - "Start", - "End" - ], - "properties": { - "Start": { - "type": "integer", - "format": "int64", - "xml": { - "name": "Start" - } - }, - "End": { - "type": "integer", - "format": "int64", - "xml": { - "name": "End" - } - } - }, - "xml": { - "name": "ClearRange" - } - }, - "RetentionPolicy": { - "description": "the retention policy which determines how long the associated data should persist", - "type": "object", - "required": [ - "Enabled" - ], - "properties": { - "Enabled": { - "description": "Indicates whether a retention policy is enabled for the storage service", - "type": "boolean" - }, - "Days": { - "description": "Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older than this value will be deleted", - "type": "integer", - "minimum": 1 - } - } - }, - "SignedIdentifier": { - "description": "signed identifier", - "type": "object", - "required": [ - "Id", - "AccessPolicy" - ], - "properties": { - "Id": { - "type": "string", - "description": "a unique id" - }, - "AccessPolicy": { - "$ref": "#/definitions/AccessPolicy" - } - } - }, - "SignedIdentifiers": { - "description": "a collection of signed identifiers", - "type": "array", - "items": { - "$ref": "#/definitions/SignedIdentifier", - "xml": { - "name": "SignedIdentifier" - } - }, - "xml": { - "wrapped": true, - "name": "SignedIdentifiers" - } - }, - "StaticWebsite": { - "description": "The properties that enable an account to host a static website", - "type": "object", - "required": [ - "Enabled" - ], - "properties": { - "Enabled": { - "description": "Indicates whether this account is hosting a static website", - "type": "boolean" - }, - "IndexDocument": { - "description": "The default name of the index page under each directory", - "type": "string" - }, - "ErrorDocument404Path": { - "description": "The absolute path of the custom 404 page", - "type": "string" - } - } - }, - "StorageServiceProperties": { - "description": "Storage Service Properties.", - "type": "object", - "properties": { - "Logging": { - "$ref": "#/definitions/Logging" - }, - "HourMetrics": { - "$ref": "#/definitions/Metrics" - }, - "MinuteMetrics": { - "$ref": "#/definitions/Metrics" - }, - "Cors": { - "description": "The set of CORS rules.", - "type": "array", - "items": { - "$ref": "#/definitions/CorsRule" - }, - "xml": { - "wrapped": true - } - }, - "DefaultServiceVersion": { - "description": "The default version to use for requests to the Blob service if an incoming request's version is not specified. Possible values include version 2008-10-27 and all more recent versions", - "type": "string" - }, - "DeleteRetentionPolicy": { - "$ref": "#/definitions/RetentionPolicy" - }, - "StaticWebsite": { - "$ref": "#/definitions/StaticWebsite" - } - } - }, - "StorageServiceStats": { - "description": "Stats for the storage service.", - "type": "object", - "properties": { - "GeoReplication": { - "$ref": "#/definitions/GeoReplication" - } - } - } - }, - "parameters": { - "Url": { - "name": "url", - "description": "The URL of the service account, container, or blob that is the targe of the desired operation.", - "required": true, - "type": "string", - "in": "path", - "x-ms-skip-url-encoding": true - }, - "ApiVersionParameter": { - "name": "x-ms-version", - "x-ms-client-name": "version", - "in": "header", - "required": true, - "type": "string", - "description": "Specifies the version of the operation to use for this request.", - "enum": [ - "2018-11-09" - ] - }, - "Blob": { - "name": "blob", - "in": "path", - "required": true, - "type": "string", - "pattern": "^[a-zA-Z0-9]+(?:/[a-zA-Z0-9]+)*(?:\\.[a-zA-Z0-9]+){0,1}$", - "minLength": 1, - "maxLength": 1024, - "x-ms-parameter-location": "method", - "description": "The blob name." - }, - "BlobCacheControl": { - "name": "x-ms-blob-cache-control", - "x-ms-client-name": "blobCacheControl", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "blob-HTTP-headers" - }, - "description": "Optional. Sets the blob's cache control. If specified, this property is stored with the blob and returned with a read request." - }, - "BlobConditionAppendPos": { - "name": "x-ms-blob-condition-appendpos", - "x-ms-client-name": "appendPosition", - "in": "header", - "required": false, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "append-position-access-conditions" - }, - "description": "Optional conditional header, used only for the Append Block operation. A number indicating the byte offset to compare. Append Block will succeed only if the append position is equal to this number. If it is not, the request will fail with the AppendPositionConditionNotMet error (HTTP status code 412 - Precondition Failed)." - }, - "BlobConditionMaxSize": { - "name": "x-ms-blob-condition-maxsize", - "x-ms-client-name": "maxSize", - "in": "header", - "required": false, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "append-position-access-conditions" - }, - "description": "Optional conditional header. The max length in bytes permitted for the append blob. If the Append Block operation would cause the blob to exceed that limit or if the blob size is already greater than the value specified in this header, the request will fail with MaxBlobSizeConditionNotMet error (HTTP status code 412 - Precondition Failed)." - }, - "BlobPublicAccess": { - "name": "x-ms-blob-public-access", - "x-ms-client-name": "access", - "in": "header", - "required": false, - "x-ms-parameter-location": "method", - "description": "Specifies whether data in the container may be accessed publicly and the level of access", - "type": "string", - "enum": [ - "container", - "blob" - ], - "x-ms-enum": { - "name": "PublicAccessType", - "modelAsString": true - } - }, - "AccessTier": { - "name": "x-ms-access-tier", - "x-ms-client-name": "tier", - "in": "header", - "required": true, - "type": "string", - "enum": [ - "P4", - "P6", - "P10", - "P20", - "P30", - "P40", - "P50", - "Hot", - "Cool", - "Archive" - ], - "x-ms-enum": { - "name": "AccessTier", - "modelAsString": true - }, - "x-ms-parameter-location": "method", - "description": "Indicates the tier to be set on the blob." - }, - "BlobContentDisposition": { - "name": "x-ms-blob-content-disposition", - "x-ms-client-name": "blobContentDisposition", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "blob-HTTP-headers" - }, - "description": "Optional. Sets the blob's Content-Disposition header." - }, - "BlobContentEncoding": { - "name": "x-ms-blob-content-encoding", - "x-ms-client-name": "blobContentEncoding", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "blob-HTTP-headers" - }, - "description": "Optional. Sets the blob's content encoding. If specified, this property is stored with the blob and returned with a read request." - }, - "BlobContentLanguage": { - "name": "x-ms-blob-content-language", - "x-ms-client-name": "blobContentLanguage", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "blob-HTTP-headers" - }, - "description": "Optional. Set the blob's content language. If specified, this property is stored with the blob and returned with a read request." - }, - "BlobContentLengthOptional": { - "name": "x-ms-blob-content-length", - "x-ms-client-name": "blobContentLength", - "in": "header", - "required": false, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "description": "This header specifies the maximum size for the page blob, up to 1 TB. The page blob size must be aligned to a 512-byte boundary." - }, - "BlobContentLengthRequired": { - "name": "x-ms-blob-content-length", - "x-ms-client-name": "blobContentLength", - "in": "header", - "required": true, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "description": "This header specifies the maximum size for the page blob, up to 1 TB. The page blob size must be aligned to a 512-byte boundary." - }, - "BlobContentMD5": { - "name": "x-ms-blob-content-md5", - "x-ms-client-name": "blobContentMD5", - "in": "header", - "required": false, - "type": "string", - "format": "byte", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "blob-HTTP-headers" - }, - "description": "Optional. An MD5 hash of the blob content. Note that this hash is not validated, as the hashes for the individual blocks were validated when each was uploaded." - }, - "BlobContentType": { - "name": "x-ms-blob-content-type", - "x-ms-client-name": "blobContentType", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "blob-HTTP-headers" - }, - "description": "Optional. Sets the blob's content type. If specified, this property is stored with the blob and returned with a read request." - }, - "BlobSequenceNumber": { - "name": "x-ms-blob-sequence-number", - "x-ms-client-name": "blobSequenceNumber", - "in": "header", - "required": false, - "type": "integer", - "format": "int64", - "default": 0, - "x-ms-parameter-location": "method", - "description": "Set for page blobs only. The sequence number is 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." - }, - "BlockId": { - "name": "blockid", - "x-ms-client-name": "blockId", - "in": "query", - "type": "string", - "required": true, - "x-ms-parameter-location": "method", - "description": "A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter must be the same size for each block." - }, - "BlockListType": { - "name": "blocklisttype", - "x-ms-client-name": "listType", - "in": "query", - "required": true, - "default": "committed", - "x-ms-parameter-location": "method", - "description": "Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both lists together.", - "type": "string", - "enum": [ - "committed", - "uncommitted", - "all" - ], - "x-ms-enum": { - "name": "BlockListType", - "modelAsString": false - } - }, - "Body": { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "format": "file" - }, - "x-ms-parameter-location": "method", - "description": "Initial data" - }, - "CacheControl": { - "name": "Cache-Control", - "x-ms-client-name": "cacheControl", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Cache control for given resource" - }, - "ContainerAcl": { - "name": "containerAcl", - "in": "body", - "schema": { - "$ref": "#/definitions/SignedIdentifiers" - }, - "x-ms-parameter-location": "method", - "description": "the acls for the container" - }, - "CopyId": { - "name": "copyid", - "x-ms-client-name": "copyId", - "in": "query", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "The copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation." - }, - "ClientRequestId": { - "name": "x-ms-client-request-id", - "x-ms-client-name": "requestId", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled." - }, - "ContainerName": { - "name": "containerName", - "in": "path", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "The container name." - }, - "ContentCrc64": { - "name": "x-ms-content-crc64", - "x-ms-client-name": "transactionalContentCrc64", - "in": "header", - "required": false, - "type": "string", - "format": "byte", - "x-ms-parameter-location": "method", - "description": "Specify the transactional crc64 for the body, to be validated by the service." - }, - "ContentLength": { - "name": "Content-Length", - "in": "header", - "required": true, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "description": "The length of the request." - }, - "ContentMD5": { - "name": "Content-MD5", - "x-ms-client-name": "transactionalContentMD5", - "in": "header", - "required": false, - "type": "string", - "format": "byte", - "x-ms-parameter-location": "method", - "description": "Specify the transactional md5 for the body, to be validated by the service." - }, - "CopySource": { - "name": "x-ms-copy-source", - "x-ms-client-name": "copySource", - "in": "header", - "required": true, - "type": "string", - "format": "url", - "x-ms-parameter-location": "method", - "description": "Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or must be authenticated via a shared access signature." - }, - "DeleteSnapshots": { - "name": "x-ms-delete-snapshots", - "x-ms-client-name": "deleteSnapshots", - "description": "Required if the blob has associated snapshots. Specify one of the following two options: include: Delete the base blob and all of its snapshots. only: Delete only the blob's snapshots and not the blob itself", - "x-ms-parameter-location": "method", - "in": "header", - "required": false, - "type": "string", - "enum": [ - "include", - "only" - ], - "x-ms-enum": { - "name": "DeleteSnapshotsOptionType", - "modelAsString": false - } - }, - "Delimiter": { - "name": "delimiter", - "description": "When the request includes this parameter, the operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may be a single character or a string.", - "type": "string", - "x-ms-parameter-location": "method", - "in": "query", - "required": true - }, - "EncryptionKey": { - "name": "x-ms-encryption-key", - "x-ms-client-name": "EncryptionKey", - "type": "string", - "in": "query", - "required": false, - "x-ms-parameter-location": "method", - "description": "Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services." - }, - "EncryptionKeySha256": { - "name": "x-ms-encryption-key-sha256", - "x-ms-client-name": "encryptionKeySha256", - "type": "string", - "in": "query", - "required": false, - "x-ms-parameter-location": "method", - "description": "The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided." - }, - "EncryptionAlgorithm": { - "name": "x-ms-encryption-algorithm", - "x-ms-client-name": "EncryptionAlgorithm", - "type": "string", - "in": "query", - "required": false, - "enum": [ - "AES256" - ], - "x-ms-enum": { - "name": "EncryptionAlgorithmType", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "The algorithm used to produce the encryption key hash. Currently, the only accepted value is \"AES256\". Must be provided if the x-ms-encryption-key header is provided." - }, - "GetRangeContentMD5": { - "name": "x-ms-range-get-content-md5", - "x-ms-client-name": "rangeGetContentMD5", - "in": "header", - "required": false, - "type": "boolean", - "x-ms-parameter-location": "method", - "description": "When set to true and specified together with the Range, the service returns the MD5 hash for the range, as long as the range is less than or equal to 4 MB in size." - }, - "IfMatch": { - "name": "If-Match", - "x-ms-client-name": "ifMatch", - "in": "header", - "required": false, - "type": "string", - "format": "etag", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "modified-access-conditions" - }, - "description": "Specify an ETag value to operate only on blobs with a matching value." - }, - "IfModifiedSince": { - "name": "If-Modified-Since", - "x-ms-client-name": "ifModifiedSince", - "in": "header", - "required": false, - "type": "string", - "format": "date-time-rfc1123", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "modified-access-conditions" - }, - "description": "Specify this header value to operate only on a blob if it has been modified since the specified date/time." - }, - "IfNoneMatch": { - "name": "If-None-Match", - "x-ms-client-name": "ifNoneMatch", - "in": "header", - "required": false, - "type": "string", - "format": "etag", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "modified-access-conditions" - }, - "description": "Specify an ETag value to operate only on blobs without a matching value." - }, - "IfUnmodifiedSince": { - "name": "If-Unmodified-Since", - "x-ms-client-name": "ifUnmodifiedSince", - "in": "header", - "required": false, - "type": "string", - "format": "date-time-rfc1123", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "modified-access-conditions" - }, - "description": "Specify this header value to operate only on a blob if it has not been modified since the specified date/time." - }, - "IfSequenceNumberEqualTo": { - "name": "x-ms-if-sequence-number-eq", - "x-ms-client-name": "ifSequenceNumberEqualTo", - "in": "header", - "required": false, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "sequence-number-access-conditions" - }, - "description": "Specify this header value to operate only on a blob if it has the specified sequence number." - }, - "IfSequenceNumberLessThan": { - "name": "x-ms-if-sequence-number-lt", - "x-ms-client-name": "ifSequenceNumberLessThan", - "in": "header", - "required": false, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "sequence-number-access-conditions" - }, - "description": "Specify this header value to operate only on a blob if it has a sequence number less than the specified." - }, - "IfSequenceNumberLessThanOrEqualTo": { - "name": "x-ms-if-sequence-number-le", - "x-ms-client-name": "ifSequenceNumberLessThanOrEqualTo", - "in": "header", - "required": false, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "sequence-number-access-conditions" - }, - "description": "Specify this header value to operate only on a blob if it has a sequence number less than or equal to the specified." - }, - "KeyInfo": { - "name": "KeyInfo", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/KeyInfo" - } - }, - "ListBlobsInclude": { - "name": "include", - "in": "query", - "required": false, - "type": "array", - "collectionFormat": "csv", - "items": { - "type": "string", - "enum": [ - "copy", - "deleted", - "metadata", - "snapshots", - "uncommittedblobs" - ], - "x-ms-enum": { - "name": "ListBlobsIncludeItem", - "modelAsString": false - } - }, - "x-ms-parameter-location": "method", - "description": "Include this parameter to specify one or more datasets to include in the response." - }, - "ListContainersInclude": { - "name": "include", - "in": "query", - "required": false, - "type": "string", - "enum": [ - "metadata" - ], - "x-ms-enum": { - "name": "ListContainersIncludeType", - "modelAsString": false - }, - "x-ms-parameter-location": "method", - "description": "Include this parameter to specify that the container's metadata be returned as part of the response body." - }, - "LeaseBreakPeriod": { - "name": "x-ms-lease-break-period", - "x-ms-client-name": "breakPeriod", - "in": "header", - "required": false, - "type": "integer", - "x-ms-parameter-location": "method", - "description": "For a break operation, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. This break period is only used if it is shorter than the time remaining on the lease. If longer, the time remaining on the lease is used. A new lease will not be available before the break period has expired, but the lease may be held for longer than the break period. If this header does not appear with a break operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks immediately." - }, - "LeaseDuration": { - "name": "x-ms-lease-duration", - "x-ms-client-name": "duration", - "in": "header", - "required": false, - "type": "integer", - "x-ms-parameter-location": "method", - "description": "Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using renew or change." - }, - "LeaseIdOptional": { - "name": "x-ms-lease-id", - "x-ms-client-name": "leaseId", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "lease-access-conditions" - }, - "description": "If specified, the operation only succeeds if the resource's lease is active and matches this ID." - }, - "LeaseIdRequired": { - "name": "x-ms-lease-id", - "x-ms-client-name": "leaseId", - "in": "header", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Specifies the current lease ID on the resource." - }, - "Marker": { - "name": "marker", - "in": "query", - "required": false, - "type": "string", - "description": "A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the client.", - "x-ms-parameter-location": "method" - }, - "MaxResults": { - "name": "maxresults", - "in": "query", - "required": false, - "type": "integer", - "minimum": 1, - "x-ms-parameter-location": "method", - "description": "Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than the default of 5000." - }, - "Metadata": { - "name": "x-ms-meta", - "x-ms-client-name": "metadata", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information.", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "Prefix": { - "name": "prefix", - "in": "query", - "required": false, - "type": "string", - "description": "Filters the results to return only containers whose name begins with the specified prefix.", - "x-ms-parameter-location": "method" - }, - "PrevSnapshot": { - "name": "prevsnapshot", - "in": "query", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Optional in version 2015-07-08 and newer. The prevsnapshot parameter is a DateTime value that specifies that the response will contain only pages that were changed between target blob and previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. Note that incremental snapshots are currently supported only for blobs created on or after January 1, 2016." - }, - "ProposedLeaseIdOptional": { - "name": "x-ms-proposed-lease-id", - "x-ms-client-name": "proposedLeaseId", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID string formats." - }, - "ProposedLeaseIdRequired": { - "name": "x-ms-proposed-lease-id", - "x-ms-client-name": "proposedLeaseId", - "in": "header", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID string formats." - }, - "Range": { - "name": "x-ms-range", - "x-ms-client-name": "range", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Return only the bytes of the blob in the specified range." - }, - "RangeRequiredPutPageFromUrl": { - "name": "x-ms-range", - "x-ms-client-name": "range", - "in": "header", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "The range of bytes to which the source range would be written. The range should be 512 aligned and range-end is required." - }, - "SequenceNumberAction": { - "name": "x-ms-sequence-number-action", - "x-ms-client-name": "sequenceNumberAction", - "in": "header", - "required": true, - "x-ms-parameter-location": "method", - "description": "Required if the x-ms-blob-sequence-number header is set for the request. This property applies to page blobs only. This property indicates how the service should modify the blob's sequence number", - "type": "string", - "enum": [ - "max", - "update", - "increment" - ], - "x-ms-enum": { - "name": "SequenceNumberActionType", - "modelAsString": false - } - }, - "Snapshot": { - "name": "snapshot", - "in": "query", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see Creating a Snapshot of a Blob." - }, - "SourceContentMD5": { - "name": "x-ms-source-content-md5", - "x-ms-client-name": "sourceContentMD5", - "in": "header", - "required": false, - "type": "string", - "format": "byte", - "x-ms-parameter-location": "method", - "description": "Specify the md5 calculated for the range of bytes that must be read from the copy source." - }, - "SourceRange": { - "name": "x-ms-source-range", - "x-ms-client-name": "sourceRange", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Bytes of source data in the specified range." - }, - "SourceRangeRequiredPutPageFromUrl": { - "name": "x-ms-source-range", - "x-ms-client-name": "sourceRange", - "in": "header", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Bytes of source data in the specified range. The length of this range should match the ContentLength header and x-ms-range/Range destination range header." - }, - "SourceIfMatch": { - "name": "x-ms-source-if-match", - "x-ms-client-name": "sourceIfMatch", - "in": "header", - "required": false, - "type": "string", - "format": "etag", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "source-modified-access-conditions" - }, - "description": "Specify an ETag value to operate only on blobs with a matching value." - }, - "SourceIfModifiedSince": { - "name": "x-ms-source-if-modified-since", - "x-ms-client-name": "sourceIfModifiedSince", - "in": "header", - "required": false, - "type": "string", - "format": "date-time-rfc1123", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "source-modified-access-conditions" - }, - "description": "Specify this header value to operate only on a blob if it has been modified since the specified date/time." - }, - "SourceIfNoneMatch": { - "name": "x-ms-source-if-none-match", - "x-ms-client-name": "sourceIfNoneMatch", - "in": "header", - "required": false, - "type": "string", - "format": "etag", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "source-modified-access-conditions" - }, - "description": "Specify an ETag value to operate only on blobs without a matching value." - }, - "SourceIfUnmodifiedSince": { - "name": "x-ms-source-if-unmodified-since", - "x-ms-client-name": "sourceIfUnmodifiedSince", - "in": "header", - "required": false, - "type": "string", - "format": "date-time-rfc1123", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "source-modified-access-conditions" - }, - "description": "Specify this header value to operate only on a blob if it has not been modified since the specified date/time." - }, - "SourceLeaseId": { - "name": "x-ms-source-lease-id", - "x-ms-client-name": "sourceLeaseId", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "A lease ID for the source path. If specified, the source path must have an active lease and the leaase ID must match." - }, - "SourceUrl": { - "name": "x-ms-copy-source", - "x-ms-client-name": "sourceUrl", - "in": "header", - "required": true, - "type": "string", - "format": "url", - "x-ms-parameter-location": "method", - "description": "Specify a URL to the copy source." - }, - "StorageServiceProperties": { - "name": "StorageServiceProperties", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/StorageServiceProperties" - }, - "x-ms-parameter-location": "method", - "description": "The StorageService properties." - }, - "Timeout": { - "name": "timeout", - "in": "query", - "required": false, - "type": "integer", - "minimum": 0, - "x-ms-parameter-location": "method", - "description": "The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Blob Service Operations." - }, - "VersionId": { - "name": "versionid", - "x-ms-client-name": "versionId", - "in": "query", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "The version ID parameter is an opaque DateTime value that, when present, specifies the blob version to retrieve." - }, - "XMsCacheControl": { - "name": "x-ms-cache-control", - "x-ms-client-name": "cacheControl", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "directory-http-headers" - }, - "description": "Cache control for given resource" - }, - "XMsContentType": { - "name": "x-ms-content-type", - "x-ms-client-name": "contentType", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "directory-http-headers" - }, - "description": "Content type for given resource" - }, - "XMsContentEncoding": { - "name": "x-ms-content-encoding", - "x-ms-client-name": "contentEncoding", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "directory-http-headers" - }, - "description": "Content encoding for given resource" - }, - "XMsContentLanguage": { - "name": "x-ms-content-language", - "x-ms-client-name": "contentLanguage", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "directory-http-headers" - }, - "description": "Content language for given resource" - }, - "XMsContentDisposition": { - "name": "x-ms-content-disposition", - "x-ms-client-name": "contentDisposition", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "x-ms-parameter-grouping": { - "name": "directory-http-headers" - }, - "description": "Content disposition for given resource" - } - } -} diff --git a/sdk/storage/azure-storage-common/pom.xml b/sdk/storage/azure-storage-common/pom.xml index e50ea1d13cd8..378996c8856e 100644 --- a/sdk/storage/azure-storage-common/pom.xml +++ b/sdk/storage/azure-storage-common/pom.xml @@ -5,7 +5,7 @@ com.azure azure-client-sdk-parent - 1.3.0 + 1.4.0 ../../../pom.client.xml @@ -13,9 +13,10 @@ com.azure azure-storage-common - 12.0.0-preview.3 + 12.0.0-preview.4 - azure-storage-common + Microsoft Azure common module for Storage + This module contains common code based for all Microsoft Azure Storage client libraries. https://github.com/Azure/azure-sdk-for-java @@ -31,11 +32,15 @@ HEAD + + com.azure.storage.common + + com.azure azure-core - 1.0.0-preview.3 + 1.0.0-preview.5 org.slf4j @@ -55,13 +60,13 @@ com.azure azure-core-test - 1.0.0-preview.3 + 1.0.0-preview.5 test com.azure azure-identity - 1.0.0-preview.2 + 1.0.0-preview.4 test @@ -80,5 +85,4 @@ test - diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/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-blob/src/main/java/com/azure/storage/blob/AccountSASPermission.java rename to sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSASPermission.java index 4af9f970ff64..d6205eb4c220 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASPermission.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSASPermission.java @@ -1,16 +1,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.storage.blob; +package com.azure.storage.common; import java.util.Locale; /** * 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 order of the permissions is particular and this class guarantees correctness. + * 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 + * order of the permissions is particular and this class guarantees correctness. */ public final class AccountSASPermission { @@ -40,11 +40,10 @@ public AccountSASPermission() { * 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}. - * + * @param permString A {@code String} which represents the {@code SharedAccessAccountPermissions}. * @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. + * @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(); @@ -78,7 +77,8 @@ public static AccountSASPermission parse(String permString) { break; default: throw new IllegalArgumentException( - String.format(Locale.ROOT, SR.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, "Permissions", permString, c)); + String.format(Locale.ROOT, SR.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, + "Permissions", permString, c)); } } return permissions; @@ -87,7 +87,7 @@ public static AccountSASPermission parse(String permString) { /** * @return the read permission status */ - public boolean read() { + public boolean isRead() { return read; } @@ -97,7 +97,7 @@ public boolean read() { * @param read Permission status to set * @return the updated AccountSASPermission object */ - public AccountSASPermission read(boolean read) { + public AccountSASPermission setRead(boolean read) { this.read = read; return this; } @@ -105,7 +105,7 @@ public AccountSASPermission read(boolean read) { /** * @return the add permission status */ - public boolean add() { + public boolean isAdd() { return add; } @@ -115,7 +115,7 @@ public boolean add() { * @param add Permission status to set * @return the updated AccountSASPermission object */ - public AccountSASPermission add(boolean add) { + public AccountSASPermission setAdd(boolean add) { this.add = add; return this; } @@ -123,7 +123,7 @@ public AccountSASPermission add(boolean add) { /** * @return the create permission status */ - public boolean create() { + public boolean isCreate() { return create; } @@ -133,7 +133,7 @@ public boolean create() { * @param create Permission status to set * @return the updated AccountSASPermission object */ - public AccountSASPermission create(boolean create) { + public AccountSASPermission setCreate(boolean create) { this.create = create; return this; } @@ -141,7 +141,7 @@ public AccountSASPermission create(boolean create) { /** * @return the write permission status */ - public boolean write() { + public boolean isWrite() { return write; } @@ -151,7 +151,7 @@ public boolean write() { * @param write Permission status to set * @return the updated AccountSASPermission object */ - public AccountSASPermission write(boolean write) { + public AccountSASPermission setWrite(boolean write) { this.write = write; return this; } @@ -159,7 +159,7 @@ public AccountSASPermission write(boolean write) { /** * @return the delete permission status */ - public boolean delete() { + public boolean isDelete() { return delete; } @@ -169,7 +169,7 @@ public boolean delete() { * @param delete Permission status to set * @return the updated AccountSASPermission object */ - public AccountSASPermission delete(boolean delete) { + public AccountSASPermission setDelete(boolean delete) { this.delete = delete; return this; } @@ -177,7 +177,7 @@ public AccountSASPermission delete(boolean delete) { /** * @return the list permission status */ - public boolean list() { + public boolean isList() { return list; } @@ -188,7 +188,7 @@ public boolean list() { * @param list Permission status to set * @return the updated AccountSASPermission object */ - public AccountSASPermission list(boolean list) { + public AccountSASPermission setList(boolean list) { this.list = list; return this; } @@ -198,7 +198,7 @@ public AccountSASPermission list(boolean list) { * * @return the update permission status */ - public boolean update() { + public boolean isUpdate() { return update; } @@ -208,7 +208,7 @@ public boolean update() { * @param update Permission status to set * @return the updated AccountSASPermission object */ - public AccountSASPermission update(boolean update) { + public AccountSASPermission setUpdate(boolean update) { this.update = update; return this; } @@ -218,7 +218,7 @@ public AccountSASPermission update(boolean update) { * * @return the process messages permission status. */ - public boolean processMessages() { + public boolean getProcessMessages() { return processMessages; } @@ -228,7 +228,7 @@ public boolean processMessages() { * @param processMessages Permission status to set * @return the updated AccountSASPermission object */ - public AccountSASPermission processMessages(boolean processMessages) { + public AccountSASPermission setProcessMessages(boolean processMessages) { this.processMessages = processMessages; 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 new file mode 100644 index 000000000000..735ce5d1e452 --- /dev/null +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSASQueryParameters.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.common; + +import java.time.OffsetDateTime; +import java.util.Map; + +/** + * 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 + * 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 + * to ensure thread safety. + */ +public final class AccountSASQueryParameters extends BaseSASQueryParameters { + + private final String services; + + private final String resourceTypes; + + /** + * Creates a new {@link AccountSASQueryParameters} object. + * + * @param queryParamsMap All query parameters for the request as key-value pairs + * @param removeSASParametersFromMap When {@code true}, the SAS query parameters will be removed from + * queryParamsMap + */ + public AccountSASQueryParameters(Map queryParamsMap, boolean removeSASParametersFromMap) { + super(queryParamsMap, removeSASParametersFromMap); + this.resourceTypes = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_RESOURCES_TYPES, + removeSASParametersFromMap); + this.services = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SERVICES, + removeSASParametersFromMap); + } + + /** + * Creates a new {@link AccountSASQueryParameters} object. These objects are only created internally by + * SASSignatureValues classes. + * + * @param version A {@code String} representing the storage version. + * @param services A {@code String} representing the storage services being accessed (only for Account SAS). + * @param resourceTypes A {@code String} representing the storage resource types being accessed (only for Account + * SAS). + * @param protocol A {@code String} representing the allowed HTTP protocol(s) or {@code null}. + * @param startTime A {@code java.util.Date} representing the start time for this SAS token or {@code null}. + * @param expiryTime A {@code java.util.Date} representing the expiry time for this SAS token. + * @param ipRange A {@link IPRange} representing the range of valid IP addresses for this SAS token or + * {@code null}. + * @param permissions A {@code String} representing the storage permissions or {@code null}. + * @param signature A {@code String} representing the signature for the SAS token. + */ + 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); + this.services = services; + this.resourceTypes = resourceTypes; + } + + /** + * @return The storage services being accessed (only for Account SAS). Please refer to {@link AccountSASService} for + * more details. + */ + public String getServices() { + return services; + } + + /** + * @return The storage resource types being accessed (only for Account SAS). Please refer to {@link + * AccountSASResourceType} for more details. + */ + public String getResourceTypes() { + return resourceTypes; + } + + /** + * Encodes all SAS query parameters into a string that can be appended to a URL. + * + * @return A {@code String} representing all SAS query parameters. + */ + public String encode() { + /* + We should be url-encoding each key and each value, but because we know all the keys and values will encode to + themselves, we cheat except for the signature value. + */ + StringBuilder sb = new StringBuilder(); + + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SERVICE_VERSION, this.version); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SERVICES, this.services); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_RESOURCES_TYPES, this.resourceTypes); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_PROTOCOL, this.protocol); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_START_TIME, formatQueryParameterDate(this.startTime)); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_EXPIRY_TIME, formatQueryParameterDate(this.expiryTime)); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_IP_RANGE, this.ipRange); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_PERMISSIONS, this.permissions); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNATURE, this.signature); + + return sb.toString(); + } +} diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASResourceType.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSASResourceType.java similarity index 76% rename from sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASResourceType.java rename to sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSASResourceType.java index a91abf917501..e8c7df1119ee 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASResourceType.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSASResourceType.java @@ -1,16 +1,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.storage.blob; +package com.azure.storage.common; import java.util.Locale; /** * 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 of the resources is particular and this class guarantees correctness. + * 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 + * of the resources is particular and this class guarantees correctness. */ public final class AccountSASResourceType { @@ -30,9 +30,7 @@ public AccountSASResourceType() { * 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}. - * + * @param resourceTypesString A {@code String} which represents the {@code AccountSASResourceTypes}. * @return A {@code AccountSASResourceType} generated from the given {@code String}. * @throws IllegalArgumentException If {@code resourceTypesString} contains a character other than s, c, or o. */ @@ -53,8 +51,8 @@ public static AccountSASResourceType parse(String resourceTypesString) { break; default: throw new IllegalArgumentException( - String.format(Locale.ROOT, SR.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, - "Resource Types", resourceTypesString, c)); + String.format(Locale.ROOT, SR.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, + "Resource Types", resourceTypesString, c)); } } return resourceType; @@ -63,7 +61,7 @@ public static AccountSASResourceType parse(String resourceTypesString) { /** * @return the access status for service level APIs. */ - public boolean service() { + public boolean isService() { return service; } @@ -73,26 +71,27 @@ public boolean service() { * @param service Access status to set * @return the updated AccountSASResourceType object. */ - public AccountSASResourceType service(boolean service) { + public AccountSASResourceType setService(boolean service) { this.service = service; return this; } /** - * @return the access status for container level APIs, this grants access to Blob Containers, Tables, Queues, - * and File Shares. + * @return the access status for container level APIs, this grants access to Blob Containers, Tables, Queues, and + * File Shares. */ - public boolean container() { + public boolean isContainer() { return container; } /** - * Sets the access status for container level APIs, this grants access to Blob Containers, Tables, Queues, and File Shares. + * Sets the access status for container level APIs, this grants access to Blob Containers, Tables, Queues, and File + * Shares. * * @param container Access status to set * @return the updated AccountSASResourceType object. */ - public AccountSASResourceType container(boolean container) { + public AccountSASResourceType setContainer(boolean container) { this.container = container; return this; } @@ -101,17 +100,18 @@ public AccountSASResourceType container(boolean container) { * @return the access status for object level APIs, this grants access to Blobs, Table Entities, Queue Messages, * Files. */ - public boolean object() { + public boolean getObject() { return object; } /** - * Sets the access status for object level APIs, this grants access to Blobs, Table Entities, Queue Messages, Files. + * Sets the access status for object level APIs, this grants access to Blobs, Table Entities, Queue Messages, + * Files. * * @param object Access status to set * @return the updated AccountSASResourceType object. */ - public AccountSASResourceType object(boolean object) { + public AccountSASResourceType setObject(boolean object) { this.object = object; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASService.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSASService.java similarity index 90% rename from sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASService.java rename to sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSASService.java index 9fbb9137bcbd..57c7351047f5 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASService.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSASService.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.storage.blob; +package com.azure.storage.common; import java.util.Locale; @@ -32,8 +32,7 @@ public AccountSASService() { * 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}. + * @param servicesString A {@code String} which represents the {@code SharedAccessAccountServices}. * * @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. @@ -68,7 +67,7 @@ public static AccountSASService parse(String servicesString) { /** * @return the access status for blob resources. */ - public boolean blob() { + public boolean isBlob() { return blob; } @@ -78,7 +77,7 @@ public boolean blob() { * @param blob Access status to set * @return the updated AccountSASService object. */ - public AccountSASService blob(boolean blob) { + public AccountSASService setBlob(boolean blob) { this.blob = blob; return this; } @@ -86,7 +85,7 @@ public AccountSASService blob(boolean blob) { /** * @return the access status for file resources. */ - public boolean file() { + public boolean isFile() { return file; } @@ -96,7 +95,7 @@ public boolean file() { * @param file Access status to set * @return the updated AccountSASService object. */ - public AccountSASService file(boolean file) { + public AccountSASService setFile(boolean file) { this.file = file; return this; } @@ -104,7 +103,7 @@ public AccountSASService file(boolean file) { /** * @return the access status for queue resources. */ - public boolean queue() { + public boolean isQueue() { return queue; } @@ -114,7 +113,7 @@ public boolean queue() { * @param queue Access status to set * @return the updated AccountSASService object. */ - public AccountSASService queue(boolean queue) { + public AccountSASService setQueue(boolean queue) { this.queue = queue; return this; } @@ -122,7 +121,7 @@ public AccountSASService queue(boolean queue) { /** * @return the access status for table resources. */ - public boolean table() { + public boolean isTable() { return table; } @@ -132,7 +131,7 @@ public boolean table() { * @param table Access status to set * @return the updated AccountSASService object. */ - public AccountSASService table(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 new file mode 100644 index 000000000000..9913d2b130da --- /dev/null +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/AccountSASSignatureValues.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.common; + +import com.azure.storage.common.credentials.SharedKeyCredential; + +import java.time.OffsetDateTime; + +/** + * 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 + * requests. + *

    + * Please see + * here + * for more conceptual information on SAS: + *

    + *

    + * Please see + * here for further + * descriptions of the parameters, including which are required: + * + *

    Please see + * here + * for additional samples.

    + */ +public final class AccountSASSignatureValues { + + private String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION; + + private SASProtocol protocol; + + private OffsetDateTime startTime; + + private OffsetDateTime expiryTime; + + private String permissions; + + private IPRange ipRange; + + private String services; + + private String resourceTypes; + + /** + * Initializes an {@code AccountSASSignatureValues} object with the version number set to the default and all other + * values empty. + */ + 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 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 static String generateAccountSAS(SharedKeyCredential sharedKeyCredential, AccountSASService + accountSASService, AccountSASResourceType accountSASResourceType, AccountSASPermission accountSASPermission, + OffsetDateTime expiryTime, OffsetDateTime startTime, String version, IPRange ipRange, SASProtocol sasProtocol) { + + AccountSASSignatureValues values = new AccountSASSignatureValues(); + + values.setServices(accountSASService == null ? null : accountSASService.toString()); + values.setResourceTypes(accountSASResourceType == null ? null : accountSASResourceType.toString()); + values.setPermissions(accountSASPermission == null ? null : accountSASPermission.toString()); + values.setExpiryTime(expiryTime); + values.setStartTime(startTime); + + if (version != null) { + values.setVersion(version); + } + + values.setIpRange(ipRange); + values.setProtocol(sasProtocol); + + AccountSASQueryParameters sasQueryParameters = values.generateSASQueryParameters(sharedKeyCredential); + + return sasQueryParameters.encode(); + } + + /** + * @return the service version that is targeted, if {@code null} or empty the service version targeted by the + * library will be used. + */ + public String getVersion() { + return version; + } + + /** + * Sets the service version that is targeted. Leave this {@code null} or empty to target the version used by the + * library. + * + * @param version Target version to set + * @return the updated AccountSASSignatureValues object. + */ + public AccountSASSignatureValues setVersion(String version) { + this.version = version; + return this; + } + + /** + * @return the {@link SASProtocol} which determines the HTTP protocol that will be used. + */ + public SASProtocol getProtocol() { + return protocol; + } + + /** + * Sets the {@link SASProtocol} which determines the HTTP protocol that will be used. + * + * @param protocol Protocol to set + * @return the updated AccountSASSignatureValues object. + */ + public AccountSASSignatureValues setProtocol(SASProtocol protocol) { + this.protocol = protocol; + return this; + } + + /** + * @return when the SAS will take effect. + */ + public OffsetDateTime getStartTime() { + return startTime; + } + + /** + * Sets when the SAS will take effect. + * + * @param startTime Start time to set + * @return the updated AccountSASSignatureValues object. + */ + public AccountSASSignatureValues setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * @return the time after which the SAS will no longer work. + */ + public OffsetDateTime getExpiryTime() { + return expiryTime; + } + + /** + * Sets the time after which the SAS will no longer work. + * + * @param expiryTime Expiry time to set + * @return the updated AccountSASSignatureValues object. + */ + 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 + * which permissions are allowed. + */ + public String getPermissions() { + return permissions; + } + + /** + * 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. + */ + public AccountSASSignatureValues setPermissions(String permissions) { + this.permissions = permissions; + return this; + } + + /** + * @return the {@link IPRange} which determines the IP ranges that are allowed to use the SAS. + */ + public IPRange getIpRange() { + return ipRange; + } + + /** + * 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. + */ + 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 + * services are accessible. + */ + public String getServices() { + return services; + } + + /** + * 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. + */ + 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 + * determine the resource types that are accessible. + */ + public String getResourceTypes() { + return resourceTypes; + } + + /** + * 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. + */ + public AccountSASSignatureValues setResourceTypes(String resourceTypes) { + this.resourceTypes = resourceTypes; + return this; + } + + /** + * Generates a {@link AccountSASQueryParameters} object which contains all SAS query parameters needed to make an + * actual REST request. + * + * @param sharedKeyCredentials Credentials for the storage account and corresponding primary or secondary key. + * @return {@link AccountSASQueryParameters} + * @throws RuntimeException If the HMAC-SHA256 signature for {@code sharedKeyCredentials} fails to generate. + */ + public AccountSASQueryParameters generateSASQueryParameters(SharedKeyCredential sharedKeyCredentials) { + Utility.assertNotNull("SharedKeyCredential", sharedKeyCredentials); + Utility.assertNotNull("services", this.services); + Utility.assertNotNull("resourceTypes", this.resourceTypes); + Utility.assertNotNull("expiryTime", this.expiryTime); + Utility.assertNotNull("permissions", this.permissions); + Utility.assertNotNull("version", this.version); + + // Signature is generated on the un-url-encoded values. + String signature = sharedKeyCredentials.computeHmac256(stringToSign(sharedKeyCredentials)); + + return new AccountSASQueryParameters(this.version, this.services, resourceTypes, + this.protocol, this.startTime, this.expiryTime, this.ipRange, this.permissions, signature); + } + + private String stringToSign(final SharedKeyCredential sharedKeyCredentials) { + return String.join("\n", + sharedKeyCredentials.getAccountName(), + AccountSASPermission.parse(this.permissions).toString(), // guarantees ordering + this.services, + resourceTypes, + this.startTime == null ? Constants.EMPTY_STRING + : Utility.ISO_8601_UTC_DATE_FORMATTER.format(this.startTime), + Utility.ISO_8601_UTC_DATE_FORMATTER.format(this.expiryTime), + this.ipRange == null ? Constants.EMPTY_STRING : this.ipRange.toString(), + this.protocol == null ? Constants.EMPTY_STRING : this.protocol.toString(), + this.version, + Constants.EMPTY_STRING // Account SAS requires an additional newline character + ); + } +} diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/BaseClientBuilder.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/BaseClientBuilder.java new file mode 100644 index 000000000000..ed66e70ebe04 --- /dev/null +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/BaseClientBuilder.java @@ -0,0 +1,363 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.common; + +import com.azure.core.credentials.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; +import com.azure.core.implementation.util.ImplUtils; +import com.azure.core.util.configuration.Configuration; +import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.core.util.logging.ClientLogger; +import com.azure.storage.common.credentials.SASTokenCredential; +import com.azure.storage.common.credentials.SharedKeyCredential; +import com.azure.storage.common.policy.RequestRetryOptions; +import com.azure.storage.common.policy.RequestRetryPolicy; +import com.azure.storage.common.policy.ResponseValidationPolicyBuilder; +import com.azure.storage.common.policy.SASTokenCredentialPolicy; +import com.azure.storage.common.policy.SharedKeyCredentialPolicy; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; + +/** + * RESERVED FOR INTERNAL USE. Base class for Storage client builders. Holds common code for managing resources and + * pipeline settings. + */ +public abstract class BaseClientBuilder> { + + private static final String ACCOUNT_NAME = "accountname"; + private static final String ACCOUNT_KEY = "accountkey"; + private static final String ENDPOINT_PROTOCOL = "defaultendpointsprotocol"; + private static final String ENDPOINT_SUFFIX = "endpointsuffix"; + + private final ClientLogger logger = new ClientLogger(BaseClientBuilder.class); + + // for when a user wants to manage the pipeline themselves + private HttpPipeline pipeline; + + // for when a user wants to add policies to our pre-constructed pipeline + private final List additionalPolicies = new ArrayList<>(); + + protected String endpoint; + private SharedKeyCredential sharedKeyCredential; + private TokenCredential tokenCredential; + private SASTokenCredential sasTokenCredential; + private HttpClient httpClient; + private HttpLogDetailLevel logLevel = HttpLogDetailLevel.NONE; + private RequestRetryOptions retryOptions = new RequestRetryOptions(); + private Configuration configuration; + + /** + * Assembles the pipeline based on Storage's standard policies and any custom policies set by the user. + * + * @return The pipeline. + */ + protected HttpPipeline buildPipeline() { + Objects.requireNonNull(this.endpoint); + + // Closest to API goes first, closest to wire goes last. + final List policies = new ArrayList<>(); + + policies.add(getUserAgentPolicy()); + policies.add(new RequestIdPolicy()); + policies.add(new AddDatePolicy()); + + if (sharedKeyCredential != null) { + policies.add(new SharedKeyCredentialPolicy(sharedKeyCredential)); + } else if (tokenCredential != null) { + policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, String.format("%s/.default", endpoint))); + } else if (sasTokenCredential != null) { + policies.add(new SASTokenCredentialPolicy(sasTokenCredential)); + } + + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(new RequestRetryPolicy(retryOptions)); + + policies.addAll(this.additionalPolicies); + + HttpPolicyProviders.addAfterRetryPolicies(policies); + + policies.add(makeValidationPolicy()); + + policies.add(new HttpLoggingPolicy(logLevel)); + + return new HttpPipelineBuilder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .build(); + } + + /** + * Creates a policy that makes assertions on HTTP responses. These assertions are general purpose; method-specific + * validations should be performed in the convenience layer. + * + * @return The validation policy. + */ + private HttpPipelinePolicy makeValidationPolicy() { + ResponseValidationPolicyBuilder builder = new ResponseValidationPolicyBuilder() + .addOptionalEcho(Constants.HeaderConstants.CLIENT_REQUEST_ID); // echo client request id + + applyServiceSpecificValidations(builder); + + return builder.build(); + } + + /** + * Applies validation of general-purpose requests to builder. Method-specific validations should be performed in the + * convenience layer. + * + * @param builder Builder to assemble assertions together. + */ + protected abstract void applyServiceSpecificValidations(ResponseValidationPolicyBuilder builder); + + /** + * Sets the blob service endpoint, additionally parses it for information (SAS token, path information, etc.) + * + * @param endpoint URL of the service + * @return the updated builder + * @throws IllegalArgumentException If {@code endpoint} is {@code null} or is a malformed URL. + */ + public abstract T endpoint(String endpoint); + + /** + * Sets the credential used to authorize requests sent to the service + * + * @param credential authorization credential + * @return the updated builder + * @throws NullPointerException If {@code credential} is {@code null}. + */ + @SuppressWarnings("unchecked") + public final T credential(SharedKeyCredential credential) { + this.sharedKeyCredential = Objects.requireNonNull(credential); + this.tokenCredential = null; + this.sasTokenCredential = null; + + return (T) this; + } + + /** + * Sets the credential used to authorize requests sent to the service + * + * @param credential authorization credential + * @return the updated builder + * @throws NullPointerException If {@code credential} is {@code null}. + */ + @SuppressWarnings("unchecked") + public T credential(TokenCredential credential) { + this.tokenCredential = Objects.requireNonNull(credential); + this.sharedKeyCredential = null; + this.sasTokenCredential = null; + + return (T) this; + } + + /** + * Sets the credential used to authorize requests sent to the service + * + * @param credential authorization credential + * @return the updated builder + * @throws NullPointerException If {@code credential} is {@code null}. + */ + @SuppressWarnings("unchecked") + public final T credential(SASTokenCredential credential) { + this.sasTokenCredential = Objects.requireNonNull(credential); + this.sharedKeyCredential = null; + this.tokenCredential = null; + + return (T) this; + } + + /** + * Clears the credential used to authorize requests sent to the service + * + * @return the updated buildr + */ + @SuppressWarnings("unchecked") + public T setAnonymousCredential() { + this.sharedKeyCredential = null; + this.tokenCredential = null; + this.sasTokenCredential = null; + + return (T) this; + } + + /** + * Whether or not this builder has a credential to use with the pipeline. + * + * @return The boolean value of the expression. + */ + protected final boolean hasCredential() { + return this.sharedKeyCredential != null + || this.tokenCredential != null + || this.sasTokenCredential != null; + } + + /** + * Sets the connection string for the service, parses it for authentication information (account name, account key) + * + * @param connectionString connection string from access keys section + * @return the updated builder + * @throws IllegalArgumentException If {@code connectionString} doesn't contain AccountName or AccountKey. + */ + @SuppressWarnings("unchecked") + public final T connectionString(String connectionString) { + Objects.requireNonNull(connectionString); + + Map connectionKVPs = new HashMap<>(); + for (String s : connectionString.split(";")) { + String[] kvp = s.split("=", 2); + connectionKVPs.put(kvp[0].toLowerCase(Locale.ROOT), kvp[1]); + } + + String accountName = connectionKVPs.get(ACCOUNT_NAME); + String accountKey = connectionKVPs.get(ACCOUNT_KEY); + String endpointProtocol = connectionKVPs.get(ENDPOINT_PROTOCOL); + String endpointSuffix = connectionKVPs.get(ENDPOINT_SUFFIX); + + if (ImplUtils.isNullOrEmpty(accountName) || ImplUtils.isNullOrEmpty(accountKey)) { + throw logger.logExceptionAsError( + new IllegalArgumentException("Connection string must contain 'AccountName' and 'AccountKey'.")); + } + + if (!ImplUtils.isNullOrEmpty(endpointProtocol) && !ImplUtils.isNullOrEmpty(endpointSuffix)) { + String endpoint = String.format("%s://%s.%s.%s", endpointProtocol, accountName, getServiceUrlMidfix(), + endpointSuffix.replaceFirst("^\\.", "")); + endpoint(endpoint); + } + + // Use accountName and accountKey to get the SAS token using the credential class. + credential(new SharedKeyCredential(accountName, accountKey)); + + return (T) this; + } + + /** + * Gets the storage service segment to use for the URL hostname when assembling from a connection string. + * + * @return The midfix. + */ + protected abstract String getServiceUrlMidfix(); + + /** + * Sets the http client used to send service requests. A default will be used if none is provided. + * + * @param httpClient http client to send requests + * @return the updated buildr + */ + @SuppressWarnings("unchecked") + public final T httpClient(HttpClient httpClient) { + this.httpClient = httpClient; // builder implicitly handles default creation if null, so no null check + return (T) this; + } + + /** + * Adds a pipeline policy to apply on each request sent + * + * @param pipelinePolicy a pipeline policy + * @return the updated builder + * @throws NullPointerException If {@code pipelinePolicy} is {@code null} + */ + @SuppressWarnings("unchecked") + public final T addPolicy(HttpPipelinePolicy pipelinePolicy) { + this.additionalPolicies.add(Objects.requireNonNull(pipelinePolicy)); + return (T) this; + } + + /** + * Sets the logging level for service requests + * + * @param logLevel logging level + * @return the updated builder + * @throws NullPointerException If {@code logLevel} is {@code null} + */ + @SuppressWarnings("unchecked") + public final T httpLogDetailLevel(HttpLogDetailLevel logLevel) { + this.logLevel = Objects.requireNonNull(logLevel); + return (T) this; + } + + /** + * Sets the configuration object used to retrieve environment configuration values used to buildClient the client + * with when they are not set in the appendBlobClientBuilder, defaults to Configuration.NONE + * + * @param configuration configuration store + * @return the updated buildr + */ + @SuppressWarnings("unchecked") + public final T configuration(Configuration configuration) { + this.configuration = configuration; + return (T) this; + } + + /** + * Gets the configuration being used to construct the pipeline. + * + * @return The configuration. + */ + protected final Configuration getConfiguration() { + if (this.configuration == null) { + this.configuration = ConfigurationManager.getConfiguration(); + } + + return this.configuration; + } + + /** + * Sets the request retry options for all the requests made through the client. + * + * @param retryOptions the options to configure retry behaviors + * @return the updated builder + * @throws NullPointerException If {@code retryOptions} is {@code null} + */ + @SuppressWarnings("unchecked") + public final T retryOptions(RequestRetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions); + return (T) this; + } + + /** + * Sets the HTTP pipeline to use for the service client. + * + * If {@code pipeline} is set, all other settings are ignored, aside from {@link BaseClientBuilder#endpoint(String) + * endpoint} when building clients. + * + * @param pipeline The HTTP pipeline to use for sending service requests and receiving responses. + * @return The updated builder. + */ + @SuppressWarnings("unchecked") + public final T pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return (T) this; + } + + /** + * Gets the optional custom pipeline to use in constructed clients. + * + * @return The pipeline. Null if the builder should construct one. + */ + protected final HttpPipeline getPipeline() { + return this.pipeline; + } + + /** + * Gets the user agent policy to use for pipelines constructed by this builder. + * + * @return The policy. + */ + protected abstract UserAgentPolicy getUserAgentPolicy(); +} 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 new file mode 100644 index 000000000000..2fc0bc14e546 --- /dev/null +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/BaseSASQueryParameters.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.common; + +import java.time.OffsetDateTime; +import java.util.Map; +import java.util.function.Function; + +/** + * Represents the components that make up an Azure Storage SAS' query parameters. This type is not constructed directly + * by the user; it is only generated by the SASSignatureValues type. Once generated, it can be set on a ClientBuilder + * object to be constructed as part of a URL or it can be encoded into a {@code String} and appended to a URL directly + * (though caution should be taken here in case there are existing query parameters, which might affect the appropriate + * means of appending these query parameters). NOTE: Instances of this class are immutable to ensure thread safety. + */ +public abstract class BaseSASQueryParameters { + + protected String version; + + protected SASProtocol protocol; + + protected OffsetDateTime startTime; + + protected OffsetDateTime expiryTime; + + protected IPRange ipRange; + + protected String permissions; + + protected String signature; + + /** + * Creates a new {@link BaseSASQueryParameters} object. + * + * @param queryParamsMap All query parameters for the request as key-value pairs + * @param removeSASParametersFromMap When {@code true}, the SAS query parameters will be removed from + * queryParamsMap + */ + public BaseSASQueryParameters(Map queryParamsMap, boolean removeSASParametersFromMap) { + this.version = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SERVICE_VERSION, + removeSASParametersFromMap); + this.protocol = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_PROTOCOL, + removeSASParametersFromMap, SASProtocol::parse); + this.startTime = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_START_TIME, + removeSASParametersFromMap, Utility::parseDate); + this.expiryTime = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_EXPIRY_TIME, + removeSASParametersFromMap, Utility::parseDate); + this.ipRange = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_IP_RANGE, + removeSASParametersFromMap, IPRange::parse); + this.permissions = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_PERMISSIONS, + removeSASParametersFromMap); + this.signature = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNATURE, + removeSASParametersFromMap); + } + + /** + * Helper method to get a query parameter + * + * @param parameters A {@code Map} of parameters to values to search. + * @param name The name of parameter to find. + * @param remove Whether or not to remove the parameter from the map. + * @return A String representing the query parameter + */ + protected String getQueryParameter(Map parameters, String name, boolean remove) { + return getQueryParameter(parameters, name, remove, value -> value); + } + + /** + * Helper method to get a query parameter + * + * @param parameters A {@code Map} of parameters to values to search. + * @param name The name of parameter to find. + * @param remove Whether or not to remove the parameter from the map. + * @param converter Function that transforms the value to a String. + * @param The object type. + * @return The object + */ + protected T getQueryParameter(Map parameters, String name, Boolean remove, Function converter) { + String[] parameterValue = parameters.get(name); + if (parameterValue == null) { + return null; + } + + if (remove) { + parameters.remove(name); + } + + return converter.apply(parameterValue[0]); + } + + /** + * Creates a new {@link BaseSASQueryParameters} object. These objects are only created internally by + * SASSignatureValues classes. + * + * @param version A {@code String} representing the storage version. + * @param protocol A {@code String} representing the allowed HTTP protocol(s) or {@code null}. + * @param startTime A {@code java.util.Date} representing the start time for this SAS token or {@code null}. + * @param expiryTime A {@code java.util.Date} representing the expiry time for this SAS token. + * @param ipRange A {@link IPRange} representing the range of valid IP addresses for this SAS token or + * {@code null}. + * @param permissions A {@code String} representing the storage permissions or {@code null}. + * @param signature A {@code String} representing the signature for the SAS token. + */ + public BaseSASQueryParameters(String version, SASProtocol protocol, OffsetDateTime startTime, + OffsetDateTime expiryTime, IPRange ipRange, String permissions, String signature) { + this.version = version; + this.protocol = protocol; + this.startTime = startTime; + this.expiryTime = expiryTime; + this.ipRange = ipRange; + this.permissions = permissions; + this.signature = signature; + } + + /** + * @return The storage version + */ + public String getVersion() { + return version; + } + + /** + * @return The allowed HTTP protocol(s) or {@code null}. Please refer to {@link SASProtocol} for more details. + */ + public SASProtocol getProtocol() { + return protocol; + } + + /** + * @return The start time for this SAS token or {@code null}. + */ + public OffsetDateTime getStartTime() { + return startTime; + } + + /** + * @return The expiry time for this SAS token. + */ + public OffsetDateTime getExpiryTime() { + return expiryTime; + } + + /** + * @return {@link IPRange} + */ + public IPRange getIpRange() { + return ipRange; + } + + /** + * @return Please refer to *SASPermission classes for more details. + */ + public String getPermissions() { + return permissions; + } + + /** + * @return The signature for the SAS token. + */ + public String getSignature() { + return signature; + } + + /** + * Shared helper method to append a SAS query parameter. + * + * @param sb The {@code StringBuilder} to append to. + * @param param The {@code String} parameter to append. + * @param value The value of the parameter to append. + */ + protected void tryAppendQueryParameter(StringBuilder sb, String param, Object value) { + if (value != null) { + if (sb.length() != 0) { + sb.append('&'); + } + sb.append(Utility.urlEncode(param)).append('=').append(Utility.urlEncode(value.toString())); + } + } + + /** + * Formats date time SAS query parameters. + * + * @param dateTime The SAS date time. + * @return A String representing the SAS date time. + */ + protected String formatQueryParameterDate(OffsetDateTime dateTime) { + if (dateTime == null) { + return null; + } else { + return Utility.ISO_8601_UTC_DATE_FORMATTER.format(dateTime); + } + } + + /** + * Encodes all SAS query parameters into a string that can be appended to a URL. + * + * @return A {@code String} representing all SAS query parameters. + */ + public abstract String encode(); +} diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/Constants.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/Constants.java index 3bd8920331ce..853183a0f2b6 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/Constants.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/Constants.java @@ -4,7 +4,7 @@ package com.azure.storage.common; public final class Constants { - private static final int KB = 1024; + public static final int KB = 1024; /** * Constant representing a megabyte (Non-SI version). @@ -68,7 +68,7 @@ public static final class HeaderConstants { /** * The current storage version header value. */ - public static final String TARGET_STORAGE_VERSION = "2018-11-09"; + public static final String TARGET_STORAGE_VERSION = "2019-02-02"; /** * Error code returned from the service. @@ -80,6 +80,16 @@ public static final class HeaderConstants { */ public static final String CONTENT_ENCODING = "Content-Encoding"; + public static final String CLIENT_REQUEST_ID = "x-ms-client-request-id"; + + public static final String ENCRYPTION_KEY = "x-ms-encryption-key"; + + public static final String ENCRYPTION_KEY_SHA256 = "x-ms-encryption-key-sha256"; + + public static final String SERVER_ENCRYPTED = "x-ms-server-encrypted"; + + public static final String REQUEST_SERVER_ENCRYPTED = "x-ms-request-server-encrypted"; + private HeaderConstants() { // Private to prevent construction. } @@ -212,13 +222,29 @@ public static final class UrlConstants { */ public static final String SAS_CONTAINER_CONSTANT = "c"; + /** + * The SAS file constant. + */ + public static final String SAS_FILE_CONSTANT = "f"; + + /** + * The SAS share constant. + */ + public static final String SAS_SHARE_CONSTANT = "s"; + + /** + * The SAS queue constant. + */ + public static final String SAS_QUEUE_CONSTANT = "q"; + private UrlConstants() { // Private to prevent construction. } } static final class MessageConstants { - static final String ARGUMENT_NULL_OR_EMPTY = "The argument must not be null or an empty string. Argument name: %s."; + static final String ARGUMENT_NULL_OR_EMPTY = + "The argument must not be null or an empty string. Argument name: %s."; static final String PARAMETER_NOT_IN_RANGE = "The value of the parameter '%s' should be between %s and %s."; static final String INVALID_DATE_STRING = "Invalid Date String: %s."; static final String NO_PATH_SEGMENTS = "URL %s does not contain path segments."; diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/IPRange.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/IPRange.java index ca92f4ef83a5..5e79fb3eb9b2 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/IPRange.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/IPRange.java @@ -26,9 +26,9 @@ public IPRange() { public static IPRange parse(String rangeStr) { String[] addrs = rangeStr.split("-"); - IPRange range = new IPRange().ipMin(addrs[0]); + IPRange range = new IPRange().setIpMin(addrs[0]); if (addrs.length > 1) { - range.ipMax(addrs[1]); + range.setIpMax(addrs[1]); } return range; @@ -37,7 +37,7 @@ public static IPRange parse(String rangeStr) { /** * @return the minimum IP address of the range */ - public String ipMin() { + public String getIpMin() { return ipMin; } @@ -47,7 +47,7 @@ public String ipMin() { * @param ipMin IP address to set as the minimum * @return the updated IPRange object */ - public IPRange ipMin(String ipMin) { + public IPRange setIpMin(String ipMin) { this.ipMin = ipMin; return this; } @@ -55,7 +55,7 @@ public IPRange ipMin(String ipMin) { /** * @return the maximum IP address of the range */ - public String ipMax() { + public String getIpMax() { return ipMax; } @@ -65,7 +65,7 @@ public String ipMax() { * @param ipMax IP address to set as the maximum * @return the updated IPRange object */ - public IPRange ipMax(String ipMax) { + public IPRange setIpMax(String ipMax) { this.ipMax = ipMax; return this; } 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 index bd7120ebc93e..68c3a6282452 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 @@ -28,8 +28,7 @@ public enum SASProtocol { /** * Parses a {@code String} into a {@code SASProtocl} value if possible. * - * @param str - * The value to try to parse. + * @param str The value to try to parse. * * @return A {@code SASProtocol} value that represents the string if possible. * @throws IllegalArgumentException If {@code str} doesn't equal "https" or "https,http" diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/SR.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/SR.java similarity index 99% rename from sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/SR.java rename to sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/SR.java index 6806fbc87c79..99c5283b8ed6 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/SR.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/SR.java @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.storage.blob; +package com.azure.storage.common; /** * RESERVED FOR INTERNAL USE. Provides a standard set of errors that could be thrown from the client library. */ -final class SR { +public final class SR { // TODO: Do we want to keep any of what's left? public static final String ACCOUNT_NAME_NULL_OR_EMPTY = "The account name is null or empty."; public static final String ACCOUNT_NAME_MISMATCH = "The account name does not match the existing account name on the credentials."; 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 650db18fcbf3..89f29b49e598 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 @@ -3,18 +3,23 @@ package com.azure.storage.common; +import com.azure.core.exception.UnexpectedLengthException; import com.azure.core.http.HttpHeader; import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpPipeline; import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.implementation.http.UrlBuilder; import com.azure.core.implementation.util.ImplUtils; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.common.policy.SharedKeyCredentialPolicy; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; +import java.io.IOException; +import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -22,6 +27,7 @@ import java.net.URL; import java.net.URLDecoder; import java.net.URLEncoder; +import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; @@ -39,6 +45,7 @@ import java.util.function.Function; public final class Utility { + private static final ClientLogger LOGGER = new ClientLogger(Utility.class); private static final String DESERIALIZED_HEADERS = "deserializedHeaders"; private static final String ETAG = "eTag"; @@ -62,13 +69,30 @@ public final class Utility { private static final int MAX_PRECISION_DATESTRING_LENGTH = MAX_PRECISION_PATTERN.replaceAll("'", "").length(); /** - *Parses the query string into a key-value pair map that maintains key, query parameter key, order. + * Parses the query string into a key-value pair map that maintains key, query parameter key, order. The value is + * stored as a string (ex. key=val1,val2,val3 instead of key=[val1, val2, val3]). * * @param queryString Query string to parse * @return a mapping of query string pieces as key-value pairs. */ public static TreeMap parseQueryString(final String queryString) { - TreeMap pieces = new TreeMap<>(String::compareTo); + return parseQueryStringHelper(queryString, Utility::urlDecode); + } + + /** + * Parses the query string into a key-value pair map that maintains key, query parameter key, order. The value is + * stored as a parsed array (ex. key=[val1, val2, val3] instead of key=val1,val2,val3). + * + * @param queryString Query string to parse + * @return a mapping of query string pieces as key-value pairs. + */ + public static TreeMap parseQueryStringSplitValues(final String queryString) { + return parseQueryStringHelper(queryString, (value) -> urlDecode(value).split(",")); + } + + private static TreeMap parseQueryStringHelper(final String queryString, + Function valueParser) { + TreeMap pieces = new TreeMap<>(); if (ImplUtils.isNullOrEmpty(queryString)) { return pieces; @@ -76,8 +100,8 @@ public static TreeMap parseQueryString(final String queryString) for (String kvp : queryString.split("&")) { int equalIndex = kvp.indexOf("="); - String key = urlDecode(kvp.substring(0, equalIndex)).toLowerCase(Locale.ROOT); - String value = urlDecode(kvp.substring(equalIndex + 1)); + String key = urlDecode(kvp.substring(0, equalIndex).toLowerCase(Locale.ROOT)); + T value = valueParser.apply(kvp.substring(equalIndex + 1)); pieces.putIfAbsent(key, value); } @@ -221,6 +245,34 @@ public static T blockWithOptionalTimeout(Mono response, Duration timeout) } } + /** + * Applies a timeout to a publisher if the given timeout is not null. + * + * @param publisher Mono to apply optional timeout to. + * @param timeout Optional timeout. + * @param Return type of the Mono. + * @return Mono with an applied timeout, if any. + */ + public static Mono applyOptionalTimeout(Mono publisher, Duration timeout) { + return timeout == null + ? publisher + : publisher.timeout(timeout); + } + + /** + * Applies a timeout to a publisher if the given timeout is not null. + * + * @param publisher Flux to apply optional timeout to. + * @param timeout Optional timeout. + * @param Return type of the Flux. + * @return Flux with an applied timeout, if any. + */ + public static Flux applyOptionalTimeout(Flux publisher, Duration timeout) { + return timeout == null + ? publisher + : publisher.timeout(timeout); + } + /** * Asserts that a value is not {@code null}. * @@ -230,7 +282,8 @@ public static T blockWithOptionalTimeout(Mono response, Duration timeout) */ public static void assertNotNull(final String param, final Object value) { if (value == null) { - throw new IllegalArgumentException(String.format(Locale.ROOT, Constants.MessageConstants.ARGUMENT_NULL_OR_EMPTY, param)); + throw new IllegalArgumentException(String.format(Locale.ROOT, + Constants.MessageConstants.ARGUMENT_NULL_OR_EMPTY, param)); } } @@ -246,7 +299,8 @@ public static void assertNotNull(final String param, final Object value) { */ public static void assertInBounds(final String param, final long value, final long min, final long max) { if (value < min || value > max) { - throw new IllegalArgumentException(String.format(Locale.ROOT, Constants.MessageConstants.PARAMETER_NOT_IN_RANGE, param, min, max)); + throw new IllegalArgumentException(String.format(Locale.ROOT, + Constants.MessageConstants.PARAMETER_NOT_IN_RANGE, param, min, max)); } } @@ -283,7 +337,8 @@ public static OffsetDateTime parseDate(String dateString) { pattern = Utility.ISO8601_PATTERN_NO_SECONDS; break; default: - throw new IllegalArgumentException(String.format(Locale.ROOT, Constants.MessageConstants.INVALID_DATE_STRING, dateString)); + throw new IllegalArgumentException(String.format(Locale.ROOT, + Constants.MessageConstants.INVALID_DATE_STRING, dateString)); } DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern, Locale.ROOT); @@ -291,8 +346,8 @@ public static OffsetDateTime parseDate(String dateString) { } /** - * Wraps any potential error responses from the service and applies post processing of the response's eTag header - * to standardize the value. + * Wraps any potential error responses from the service and applies post processing of the response's eTag header to + * standardize the value. * * @param response Response from a service call * @param errorWrapper Error wrapping function that is applied to the response @@ -330,14 +385,14 @@ private static Mono scrubETagHeader(Mono unprocessedResponse) { } try { - HttpHeaders rawHeaders = (HttpHeaders) response.getClass().getMethod("headers").invoke(response); + HttpHeaders rawHeaders = (HttpHeaders) response.getClass().getMethod("getHeaders").invoke(response); // if (eTag != null) { rawHeaders.put(ETAG, eTag); } else { HttpHeader eTagHeader = rawHeaders.get(ETAG); - if (eTagHeader != null && eTagHeader.value() != null) { - eTag = eTagHeader.value().replace("\"", ""); + if (eTagHeader != null && eTagHeader.getValue() != null) { + eTag = eTagHeader.getValue().replace("\"", ""); rawHeaders.put(ETAG, eTag); } } @@ -383,13 +438,13 @@ public static String computeHMac256(final String base64Key, final String stringT public static URL appendToURLPath(URL baseURL, String name) { UrlBuilder builder = UrlBuilder.parse(baseURL); - if (builder.path() == null) { - builder.path("/"); - } else if (!builder.path().endsWith("/")) { - builder.path(builder.path() + "/"); + if (builder.getPath() == null) { + builder.setPath("/"); + } else if (!builder.getPath().endsWith("/")) { + builder.setPath(builder.getPath() + "/"); } - builder.path(builder.path() + name); + builder.setPath(builder.getPath() + name); try { return builder.toURL(); @@ -409,11 +464,12 @@ public static URL appendToURLPath(URL baseURL, String name) { public static URL stripLastPathSegment(URL baseURL) { UrlBuilder builder = UrlBuilder.parse(baseURL); - if (builder.path() == null || !builder.path().contains("/")) { - throw new IllegalArgumentException(String.format(Locale.ROOT, Constants.MessageConstants.NO_PATH_SEGMENTS, baseURL)); + if (builder.getPath() == null || !builder.getPath().contains("/")) { + throw new IllegalArgumentException(String.format(Locale.ROOT, + Constants.MessageConstants.NO_PATH_SEGMENTS, baseURL)); } - builder.path(builder.path().substring(0, builder.path().lastIndexOf("/"))); + builder.setPath(builder.getPath().substring(0, builder.getPath().lastIndexOf("/"))); try { return builder.toURL(); } catch (MalformedURLException ex) { @@ -437,4 +493,46 @@ public static SharedKeyCredential getSharedKeyCredential(HttpPipeline httpPipeli } return null; } + + /** + * A utility method for converting the input stream to Flux of ByteBuffer. Will check the equality of entity length + * and the input length. + * + * @param data The input data which needs to convert to ByteBuffer. + * @param length The expected input data length. + * @param blockSize The size of each ByteBuffer. + * @return {@link ByteBuffer} which contains the input data. + * @throws UnexpectedLengthException when input data length mismatch input length. + * @throws RuntimeException When I/O error occurs. + */ + public static Flux convertStreamToByteBuffer(InputStream data, long length, int blockSize) { + final long[] currentTotalLength = new long[1]; + return Flux.range(0, (int) Math.ceil((double) length / (double) blockSize)) + .map(i -> i * blockSize) + .concatMap(pos -> Mono.fromCallable(() -> { + long count = pos + blockSize > length ? length - pos : blockSize; + byte[] cache = new byte[(int) count]; + int lastIndex = data.read(cache); + currentTotalLength[0] += lastIndex; + if (currentTotalLength[0] < count) { + throw LOGGER.logExceptionAsError(new UnexpectedLengthException( + String.format("Request body emitted %d bytes less than the expected %d bytes.", + currentTotalLength[0], length), currentTotalLength[0], length)); + } + return ByteBuffer.wrap(cache); + })) + .doOnComplete(() -> { + try { + if (data.available() > 0) { + Long totalLength = currentTotalLength[0] + data.available(); + throw LOGGER.logExceptionAsError(new UnexpectedLengthException( + String.format("Request body emitted %d bytes more than the expected %d bytes.", + totalLength, length), totalLength, length)); + } + } catch (IOException e) { + throw LOGGER.logExceptionAsError(new RuntimeException("I/O errors occurs. Error deatils: " + + e.getMessage())); + } + }); + } } diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/credentials/SASTokenCredential.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/credentials/SASTokenCredential.java index fbf1bc0af180..d1599152ab87 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/credentials/SASTokenCredential.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/credentials/SASTokenCredential.java @@ -27,7 +27,7 @@ private SASTokenCredential(String sasToken) { /** * @return the SAS token */ - public String sasToken() { + public String getSasToken() { return sasToken; } @@ -42,6 +42,10 @@ public static SASTokenCredential fromSASTokenString(String sasToken) { return null; } + if (sasToken.charAt(0) == '?') { + sasToken = sasToken.substring(1); + } + return new SASTokenCredential(sasToken); } diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java index c71a22064016..59db80ff4671 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java @@ -5,10 +5,10 @@ import com.azure.core.implementation.util.ImplUtils; import com.azure.storage.common.Utility; -import io.netty.handler.codec.http.QueryStringDecoder; import java.net.URL; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -72,7 +72,7 @@ public static SharedKeyCredential fromConnectionString(String connectionString) * * @return The account name. */ - public String accountName() { + public String getAccountName() { return accountName; } @@ -181,15 +181,14 @@ private String getCanonicalizedResource(URL requestURL) { } // The URL object's query field doesn't include the '?'. The QueryStringDecoder expects it. - QueryStringDecoder queryDecoder = new QueryStringDecoder("?" + requestURL.getQuery()); - Map> queryParams = queryDecoder.parameters(); + Map queryParams = Utility.parseQueryStringSplitValues(requestURL.getQuery()); ArrayList queryParamNames = new ArrayList<>(queryParams.keySet()); Collections.sort(queryParamNames); for (String queryParamName : queryParamNames) { - final List queryParamValues = queryParams.get(queryParamName); - Collections.sort(queryParamValues); + String[] queryParamValues = queryParams.get(queryParamName); + Arrays.sort(queryParamValues); String queryParamValuesStr = String.join(",", queryParamValues); canonicalizedResource.append("\n") .append(queryParamName.toLowerCase(Locale.ROOT)) diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/RequestRetryOptions.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/RequestRetryOptions.java index a99897511901..0b8869beb30e 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/RequestRetryOptions.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/RequestRetryOptions.java @@ -3,6 +3,8 @@ package com.azure.storage.common.policy; +import com.azure.core.util.logging.ClientLogger; + import java.util.concurrent.TimeUnit; /** @@ -11,6 +13,9 @@ * functionality. */ public final class RequestRetryOptions { + private static final String BOUNDS_MESSAGE = "The value of the parameter '%s' should be between %s and %s."; + + private final ClientLogger logger = new ClientLogger(RequestRetryOptions.class); private final int maxTries; private final int tryTimeout; @@ -19,8 +24,8 @@ public final class RequestRetryOptions { /** * A {@link RetryPolicyType} telling the pipeline what kind of retry policy to use. */ - private RetryPolicyType retryPolicyType; - private String secondaryHost; + private final RetryPolicyType retryPolicyType; + private final String secondaryHost; /** * Constructor with default retry values: Exponential backoff, maxTries=4, tryTimeout=30, retryDelayInMs=4000, @@ -34,22 +39,22 @@ public RequestRetryOptions() { /** * Configures how the {@link com.azure.core.http.HttpPipeline} should retry requests. * - * @param retryPolicyType A {@link RetryPolicyType} specifying the type of retry pattern to use. A value of {@code - * null} accepts the default. + * @param retryPolicyType A {@link RetryPolicyType} specifying the type of retry pattern to use. A value of + * {@code null} accepts the default. * @param maxTries Specifies the maximum number of attempts an operation will be tried before producing an error. A * value of {@code null} means that you accept our default policy. A value of 1 means 1 try and no retries. - * @param tryTimeout Indicates the maximum time allowed for any single try of an HTTP request. A value of {@code - * null} means that you accept our default. NOTE: When transferring large amounts of data, the default TryTimeout - * will probably not be sufficient. You should override this value based on the bandwidth available to the host - * machine and proximity to the Storage service. A good starting point may be something like (60 seconds per MB of - * anticipated-payload-size). + * @param tryTimeout Indicates the maximum time allowed for any single try of an HTTP request. A value of + * {@code null} means that you accept our default. NOTE: When transferring large amounts of data, the default + * TryTimeout will probably not be sufficient. You should override this value based on the bandwidth available to + * the host machine and proximity to the Storage service. A good starting point may be something like (60 seconds + * per MB of anticipated-payload-size). * @param retryDelayInMs Specifies the amount of delay to use before retrying an operation. A value of {@code null} * means you accept the default value. The delay increases (exponentially or linearly) with each retry up to a * maximum specified by MaxRetryDelay. If you specify {@code null}, then you must also specify {@code null} for * MaxRetryDelay. - * @param maxRetryDelayInMs Specifies the maximum delay allowed before retrying an operation. A value of {@code - * null} means you accept the default value. If you specify {@code null}, then you must also specify {@code null} - * for RetryDelay. + * @param maxRetryDelayInMs Specifies the maximum delay allowed before retrying an operation. A value of + * {@code null} means you accept the default value. If you specify {@code null}, then you must also specify + * {@code null} for RetryDelay. * @param secondaryHost If a secondaryHost is specified, retries will be tried against this host. If secondaryHost * is {@code null} (the default) then operations are not retried against another host. NOTE: Before setting this * field, make sure you understand the issues around reading stale and potentially-inconsistent data at @@ -59,7 +64,7 @@ public RequestRetryOptions() { * non-null or {@code retryPolicyType} isn't {@link RetryPolicyType#EXPONENTIAL} or {@link RetryPolicyType#FIXED}. */ public RequestRetryOptions(RetryPolicyType retryPolicyType, Integer maxTries, Integer tryTimeout, - Long retryDelayInMs, Long maxRetryDelayInMs, String secondaryHost) { + Long retryDelayInMs, Long maxRetryDelayInMs, String secondaryHost) { this.retryPolicyType = retryPolicyType == null ? RetryPolicyType.EXPONENTIAL : retryPolicyType; if (maxTries != null) { assertInBounds("maxRetries", maxTries, 1, Integer.MAX_VALUE); @@ -154,7 +159,7 @@ long calculateDelayInMs(int tryCount) { delay = this.retryDelayInMs; break; default: - throw new IllegalArgumentException("Invalid retry policy type."); + throw logger.logExceptionAsError(new IllegalArgumentException("Invalid retry policy type.")); } return Math.min(delay, this.maxRetryDelayInMs); @@ -171,7 +176,7 @@ private long pow(long number, int exponent) { private static void assertInBounds(final String param, final long value, final long min, final long max) { if (value < min || value > max) { - throw new IllegalArgumentException(String.format("The value of the parameter '%s' should be between %s and %s.", param, min, max)); + throw new IllegalArgumentException(String.format(BOUNDS_MESSAGE, param, min, max)); } } } 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 22b62af89b04..f3f8ecb39b51 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 @@ -11,12 +11,12 @@ import com.azure.core.http.HttpResponse; import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.implementation.http.UrlBuilder; -import io.netty.buffer.ByteBuf; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.io.IOException; import java.net.MalformedURLException; +import java.nio.ByteBuffer; import java.time.Duration; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeoutException; @@ -42,9 +42,10 @@ public RequestRetryPolicy(RequestRetryOptions requestRetryOptions) { @Override public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { boolean considerSecondary = (this.requestRetryOptions.secondaryHost() != null) - && (HttpMethod.GET.equals(context.httpRequest().httpMethod()) || HttpMethod.HEAD.equals(context.httpRequest().httpMethod())); + && (HttpMethod.GET.equals(context.getHttpRequest().getHttpMethod()) + || HttpMethod.HEAD.equals(context.getHttpRequest().getHttpMethod())); - return this.attemptAsync(context, next, context.httpRequest(), considerSecondary, 1, 1); + return this.attemptAsync(context, next, context.getHttpRequest(), considerSecondary, 1, 1); } /** @@ -91,14 +92,16 @@ stream, the buffers that were emitted will have already been consumed (their pos ByteBuffers downstream will only actually consume a duplicate so the original is preserved. This only duplicates the ByteBuffer object, not the underlying data. */ - context.httpRequest(originalRequest.buffer()); - Flux bufferedBody = (context.httpRequest().body() == null) ? null : context.httpRequest().body().map(ByteBuf::duplicate); - context.httpRequest().body(bufferedBody); + context.setHttpRequest(originalRequest.buffer()); + Flux bufferedBody = (context.getHttpRequest().getBody() == null) + ? null + : context.getHttpRequest().getBody().map(ByteBuffer::duplicate); + context.getHttpRequest().setBody(bufferedBody); if (!tryingPrimary) { - UrlBuilder builder = UrlBuilder.parse(context.httpRequest().url()); - builder.host(this.requestRetryOptions.secondaryHost()); + UrlBuilder builder = UrlBuilder.parse(context.getHttpRequest().getUrl()); + builder.setHost(this.requestRetryOptions.secondaryHost()); try { - context.httpRequest().url(builder.toURL()); + context.getHttpRequest().setUrl(builder.toURL()); } catch (MalformedURLException e) { return Mono.error(e); } @@ -114,7 +117,7 @@ stream, the buffers that were emitted will have already been consumed (their pos .flatMap(response -> { boolean newConsiderSecondary = considerSecondary; String action; - int statusCode = response.statusCode(); + int statusCode = response.getStatusCode(); /* If attempt was against the secondary & it returned a StatusNotFound (404), then the @@ -138,7 +141,8 @@ we do not consider the secondary at all (considerSecondary==false)). This will ensure primaryTry is correct when passed to calculate the delay. */ int newPrimaryTry = (!tryingPrimary || !considerSecondary) ? primaryTry + 1 : primaryTry; - return attemptAsync(context, next, originalRequest, newConsiderSecondary, newPrimaryTry, attempt + 1); + return attemptAsync(context, next, originalRequest, newConsiderSecondary, newPrimaryTry, + attempt + 1); } return Mono.just(response); }).onErrorResume(throwable -> { diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/ResponseValidationPolicyBuilder.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/ResponseValidationPolicyBuilder.java new file mode 100644 index 000000000000..b1ba2fc561e8 --- /dev/null +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/ResponseValidationPolicyBuilder.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.common.policy; + +import com.azure.core.http.HttpPipelineCallContext; +import com.azure.core.http.HttpPipelineNextPolicy; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.util.logging.ClientLogger; +import reactor.core.publisher.Mono; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.function.BiConsumer; + +/** + * Builder for a policy to do validation of general response behavior. + */ +public class ResponseValidationPolicyBuilder { + + private final Collection> assertions = new ArrayList<>(); + + /** + * Builds the policy described by this builder. + * + * @return The policy. + */ + public HttpPipelinePolicy build() { + return new ResponseValidationPolicy(assertions); + } + + /** + * Fluently applies an optional validation to this policy where, if the response contains the given header, asserts + * its value is an echo of the value provided in the request. + * + * @param headerName The header to validate. + * @return This policy. + */ + public ResponseValidationPolicyBuilder addOptionalEcho(String headerName) { + assertions.add((httpResponse, logger) -> { + String requestHeaderValue = httpResponse.getRequest().getHeaders().value(headerName); + String responseHeaderValue = httpResponse.getHeaderValue(headerName); + if (responseHeaderValue != null && !responseHeaderValue.equals(requestHeaderValue)) { + throw logger.logExceptionAsError(new RuntimeException(String.format( + "Unexpected header value. Expected response to echo `%s: %s`. Got value `%s`.", + headerName, requestHeaderValue, responseHeaderValue + ))); + } + }); + + return this; + } + + /** + * Immutable policy for asserting validations on general responses. + */ + public class ResponseValidationPolicy implements HttpPipelinePolicy { + + private final ClientLogger logger = new ClientLogger(ResponseValidationPolicy.class); + + private final Iterable> assertions; + + /** + * Creates a policy that executes each provided assertion on responses. + * + * @param assertions The assertions to apply. + */ + ResponseValidationPolicy(Iterable> assertions) { + Collection> assertionsCopy = new ArrayList<>(); + assertions.forEach(assertionsCopy::add); + this.assertions = assertionsCopy; + } + + @Override + public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { + Mono httpResponse = next.process(); + + for (BiConsumer assertion : assertions) { + httpResponse = httpResponse.map(response -> { + assertion.accept(response, logger); + return response; + }); + } + + return httpResponse; + } + } +} diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/SASTokenCredentialPolicy.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/SASTokenCredentialPolicy.java index 4af3edf7f229..fd10f9ffaf93 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/SASTokenCredentialPolicy.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/SASTokenCredentialPolicy.java @@ -8,6 +8,7 @@ import com.azure.core.http.HttpResponse; import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.implementation.util.ImplUtils; +import com.azure.core.util.logging.ClientLogger; import com.azure.storage.common.credentials.SASTokenCredential; import reactor.core.publisher.Mono; @@ -18,6 +19,8 @@ * Policy that adds the SAS token to the request URL's query. */ public final class SASTokenCredentialPolicy implements HttpPipelinePolicy { + private final ClientLogger logger = new ClientLogger(SASTokenCredentialPolicy.class); + private final SASTokenCredential credential; /** @@ -32,13 +35,13 @@ public SASTokenCredentialPolicy(SASTokenCredential credential) { @Override public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { try { - URL requestURL = context.httpRequest().url(); + URL requestURL = context.getHttpRequest().getUrl(); String delimiter = !ImplUtils.isNullOrEmpty(requestURL.getQuery()) ? "&" : "?"; - String newURL = requestURL.toString() + delimiter + credential.sasToken(); - context.httpRequest().url(new URL(newURL)); + String newURL = requestURL.toString() + delimiter + credential.getSasToken(); + context.getHttpRequest().setUrl(new URL(newURL)); } catch (MalformedURLException ex) { - throw new IllegalStateException(ex); + throw logger.logExceptionAsError(new IllegalStateException(ex)); } return next.process(); diff --git a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/SharedKeyCredentialPolicy.java b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/SharedKeyCredentialPolicy.java index e8b54914cb76..d3f2669981d3 100644 --- a/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/SharedKeyCredentialPolicy.java +++ b/sdk/storage/azure-storage-common/src/main/java/com/azure/storage/common/policy/SharedKeyCredentialPolicy.java @@ -34,10 +34,10 @@ public SharedKeyCredential sharedKeyCredential() { @Override public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { - String authorizationValue = credential.generateAuthorizationHeader(context.httpRequest().url(), - context.httpRequest().httpMethod().toString(), - context.httpRequest().headers().toMap()); - context.httpRequest().header("Authorization", authorizationValue); + String authorizationValue = credential.generateAuthorizationHeader(context.getHttpRequest().getUrl(), + context.getHttpRequest().getHttpMethod().toString(), + context.getHttpRequest().getHeaders().toMap()); + context.getHttpRequest().setHeader("Authorization", authorizationValue); return next.process(); } } diff --git a/sdk/storage/azure-storage-file/CHANGELOG.md b/sdk/storage/azure-storage-file/CHANGELOG.md index 155020a406d2..15ac43e779de 100644 --- a/sdk/storage/azure-storage-file/CHANGELOG.md +++ b/sdk/storage/azure-storage-file/CHANGELOG.md @@ -1,14 +1,43 @@ # Release History -## 12.0.0-preview.2 (2019-08-08) +## 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). + +This package's +[documentation](https://github.com/Azure/azure-sdk-for-java/blob/085c8570b411defff26860ef56ea189af07d3d6a/sdk/storage/azure-storage-file/README.md) +and +[samples](https://github.com/Azure/azure-sdk-for-java/tree/085c8570b411defff26860ef56ea189af07d3d6a/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file) +demonstrate the new API. + +- Added tracing telemetry on maximum overload API. +- Added generate SAS token APIs. +- Throw `StorageException` with error code when get error response from service. +- Moved `ReactorNettyClient` into a separate module as default plugin. Customer can configure a custom http client through builder. +- Throw `UnexpectedLengthException` when the upload body length does not match the input length. [GitHub #4193](https://github.com/Azure/azure-sdk-for-java/issues/4193) +- Added validation policy to check the equality of request client id between request and response. +- Added `PageFlux` on async APIs and `PageIterable` on sync APIs. +- Upgraded to use service version 2019-02-02 from 2018-11-09. +- Replaced `ByteBuf` with `ByteBuffer` and removed dependency on `Netty`. +- Added `uploadRangeFromUrl` APIs on sync and async File client. +- Added `timeout` parameter for sync APIs which allows requests throw exception if no response received within the time span. +- Added `azure-storage-common` as a dependency. +- Added the ability for the user to obtain file SMB properties and file permissions from getProperties APIs on File and Directory and download APIs on File. +- Added setProperties APIs on sync and async Directory client. Allows users to set file SMB properties and file permission. + +**Breaking changes: New API design** +- Changed list responses to `PagedFlux` on async APIs and `PagedIterable` on sync APIs. +- Replaced setHttpHeaders with setProperties APIs on sync and async File client. Additionally Allows users to set file SMB properties and file permission. +- Added file smb properties and file permission parameters to create APIs on sync and async File and Directory clients. + +## Version 12.0.0-preview.2 (2019-08-08) Version 12.0.0-preview.2 is a preview of our efforts in creating a client library that is developer-friendly, idiomatic to the Java ecosystem, and as consistent across different languages and platforms as possible. The principles that guide our efforts can be found in the [Azure SDK Design Guidelines for Java](https://azuresdkspecs.z5.web.core.windows.net/JavaSpec.html). For details on the Azure SDK for Java (August 2019 Preview) release, you can refer to the [release announcement](https://aka.ms/azure-sdk-preview2-java). This package's -[documentation](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/storage/azure-storage-file/README.md) +[documentation](https://github.com/Azure/azure-sdk-for-java/blob/azure-storage-file_12.0.0-preview.2/sdk/storage/azure-storage-file/README.md) and -[samples](https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/storage/azure-storage-file/src/samples/java/com/azure/file) +[samples](https://github.com/Azure/azure-sdk-for-java/tree/azure-storage-file_12.0.0-preview.2/sdk/storage/azure-storage-file/src/samples/java/com/azure/storage/file) demonstrate the new API. ### Features included in `azure-storage-file` @@ -18,4 +47,4 @@ demonstrate the new API. - Client instances are scoped to storage file service. - Reactive streams support using [Project Reactor](https://projectreactor.io/). - + diff --git a/sdk/storage/azure-storage-file/README.md b/sdk/storage/azure-storage-file/README.md index 75e91197b6d4..a09aa7ef82b1 100644 --- a/sdk/storage/azure-storage-file/README.md +++ b/sdk/storage/azure-storage-file/README.md @@ -23,10 +23,45 @@ Shares provide a way to organize sets of files and also can be mounted as an SMB com.azure azure-storage-file - 12.0.0-preview.2 + 12.0.0-preview.3 ``` +### 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](#file-services), 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(); +``` + ### Create a Storage Account To create a Storage Account you can use the Azure Portal or [Azure CLI][azure_cli]. @@ -208,7 +243,7 @@ The following sections provide several code snippets covering some of the most c - [Set file httpHeaders](#Set-file-httpheaders) ### Create a share -Create a share in the Storage Account. Throws StorageErrorException If the share fails to be created. +Create a share in the Storage Account. Throws StorageException If the share fails to be created. Taking a FileServiceClient in KeyConcept, [`${fileServiceClient}`](#File-services). ```Java @@ -246,7 +281,8 @@ Taking the directoryClient in KeyConcept, [`${directoryClient}`](#Directory) . ```Java String fileName = "testfile"; -directoryClient.createFile(fileName); +long maxSize = 1024; +directoryClient.createFile(fileName, maxSize); ``` ### List all Shares @@ -306,14 +342,14 @@ Taking the fileClient in KeyConcept, [`${fileClient}`](#File) with string of sou ```Java String sourceURL = "https://myaccount.file.core.windows.net/myshare/myfile"; -Response copyInfoResponse = fileClient.startCopy(sourceURL, null); +FileCopyInfo copyInfo = fileClient.startCopy(sourceURL, null); ``` ### Abort copy a file Taking the fileClient in KeyConcept, [`${fileClient}`](#File) with the copy info response returned above `${copyId}=[copyInfoResponse](#Copy-a-file)`. ```Java -String copyId = copyInfoResponse.value().copyId(); +String copyId = copyInfoResponse.copyId(); fileClient.abortCopy(copyId); ``` @@ -321,7 +357,7 @@ fileClient.abortCopy(copyId); Taking the fileClient in KeyConcept, [`${fileClient}`](#File) with data of "default" . ```Java -ByteBuf data = Unpooled.wrappedBuffer("default".getBytes(StandardCharsets.UTF_8)); +ByteBuffer data = ByteBuffer.wrap("default".getBytes(StandardCharsets.UTF_8)); fileClient.upload(data, data.readableBytes()); ``` @@ -336,7 +372,7 @@ fileClient.uploadFromFile(filePath); Taking the fileClient in KeyConcept, [`${fileClient}`](#File) with the range from 1024 to 2048. ```Java FileRange fileRange = new FileRange(1024, 2047); -fileClient.downloadWithProperties(fileRange, false); +fileClient.downloadWithProperties(fileRange, false, null); ``` ### Download file from storage @@ -357,12 +393,12 @@ fileServiceClient.getProperties(); Taking a FileServiceClient in KeyConcept, [`${fileServiceClient}`](#File-services) . ```Java -FileServiceProperties properties = fileServiceClient.getProperties().value(); +FileServiceProperties properties = fileServiceClient.getProperties(); properties.minuteMetrics().enabled(true); properties.hourMetrics().enabled(true); -VoidResponse response = fileServiceClient.setProperties(properties); +fileServiceClient.setProperties(properties); ``` ### Set a share metadata @@ -396,7 +432,7 @@ shareClient.setAccessPolicy(Collections.singletonList(permission)); Taking the directoryClient in KeyConcept, [`${directoryClient}`](#Directory) ```Java -Iterable handleItems = directoryClient.getHandles(null, true); +Iterable handleItems = directoryClient.listHandles(null, true); ``` ### Force close handles on handle id @@ -420,7 +456,8 @@ Taking the fileClient in KeyConcept, [`${fileClient}`](#File) . ```Java FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain"); -fileClient.setHttpHeaders(httpHeaders); +long newFileSize = 1024; +fileClient.setHttpHeaders(newFileSize, httpHeaders); ``` ## Troubleshooting @@ -479,3 +516,5 @@ If you would like to become an active contributor to this project please follow [samples_directory]: src/samples/java/com/azure/storage/file/DirectorySample.java [samples_file]: src/samples/java/com/azure/storage/file/FileSample.java [samples_async]: src/samples/java/com/azure/storage/file/AsyncSample.java + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/storage/azure-storage-file/README.png) diff --git a/sdk/storage/azure-storage-file/pom.xml b/sdk/storage/azure-storage-file/pom.xml index 91058c7dcdb7..8af8dd9dc457 100644 --- a/sdk/storage/azure-storage-file/pom.xml +++ b/sdk/storage/azure-storage-file/pom.xml @@ -5,7 +5,7 @@ com.azure azure-client-sdk-parent - 1.3.0 + 1.4.0 ../../../pom.client.xml @@ -13,9 +13,10 @@ com.azure azure-storage-file - 12.0.0-preview.3 + 12.0.0-preview.4 - azure-storage-file + Microsoft Azure client library for File Storage + This module contains client library for Microsoft Azure File Storage. https://github.com/Azure/azure-sdk-for-java @@ -31,16 +32,20 @@ HEAD + + com.azure.storage.file + + com.azure azure-core - 1.0.0-preview.4 + 1.0.0-preview.5 com.azure azure-storage-common - 12.0.0-preview.3 + 12.0.0-preview.4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + groovy-eclipse-compiler + -Xlint:unchecked + 1.8 + 1.8 + true + + + + org.codehaus.groovy + groovy-eclipse-compiler + ${groovy-eclipse-compiler.version} + + + org.codehaus.groovy + groovy-eclipse-batch + ${groovy-eclipse-batch.version} + + + + + + diff --git a/sdk/storage/azure-storage-queue/CHANGELOG.md b/sdk/storage/azure-storage-queue/CHANGELOG.md index 7f4b5a255108..979096292c5d 100644 --- a/sdk/storage/azure-storage-queue/CHANGELOG.md +++ b/sdk/storage/azure-storage-queue/CHANGELOG.md @@ -1,14 +1,36 @@ # Release History +## 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-preview2-java). -## 12.0.0-preview.2 (2019-08-08) +This package's +[documentation](https://github.com/Azure/azure-sdk-for-java/blob/085c8570b411defff26860ef56ea189af07d3d6a/sdk/storage/azure-storage-queue/README.md) +and +[samples](https://github.com/Azure/azure-sdk-for-java/tree/085c8570b411defff26860ef56ea189af07d3d6a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue) + +- Added tracing telemetry on maximum overload API. +- Added generate SAS token APIs. +- Throw `StorageException` with error code when get error response from service. +- Renamed `getHandles` to `listHandles`. +- Added `clearRange` API and removed the parameter of `FileRangeWriteType` from `upload` API. +- Moved `ReactorNettyClient` into a separate module as default plugin. Customer can configure a custom http client through builder. +- Throw `UnexpectedLengthException` when the upload body length does not match the input length. [GitHub #4193](https://github.com/Azure/azure-sdk-for-java/issues/4193) +- Added validation policy to check the equality of request client id between request and response. +- Upgraded to use service version 2019-02-02 from 2018-11-09. +- Replaced `ByteBuf` with `ByteBuffer` and removed dependency on `Netty`. +- Added `azure-storage-common` as a dependency. + +**Breaking changes: New API design** +- Changed list responses to `PagedFlux` on async APIs and `PagedIterable` on sync APIs. + +## Version 12.0.0-preview.2 (2019-08-08) Version 12.0.0-preview.2 is a preview of our efforts in creating a client library that is developer-friendly, idiomatic to the Java ecosystem, and as consistent across different languages and platforms as possible. The principles that guide our efforts can be found in the [Azure SDK Design Guidelines for Java](https://azuresdkspecs.z5.web.core.windows.net/JavaSpec.html). For details on the Azure SDK for Java (August 2019 Preview) release, you can refer to the [release announcement](https://aka.ms/azure-sdk-preview2-java). This package's -[documentation](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/storage/azure-storage-queue/README.md) +[documentation](https://github.com/Azure/azure-sdk-for-java/blob/azure-storage-queue_12.0.0-preview.2/sdk/storage/azure-storage-queue/README.md) and -[samples](https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue) +[samples](https://github.com/Azure/azure-sdk-for-java/tree/azure-storage-queue_12.0.0-preview.2/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue) demonstrate the new API. ### Features included in `azure-storage-queue` diff --git a/sdk/storage/azure-storage-queue/README.md b/sdk/storage/azure-storage-queue/README.md index f80a2c884c44..d2371770f543 100644 --- a/sdk/storage/azure-storage-queue/README.md +++ b/sdk/storage/azure-storage-queue/README.md @@ -1,5 +1,5 @@ # Azure Storage Queue client library for Java -Azure Queue storage is a service for storing large numbers of messages that can be accessed from anywhere in the world via authenticated calls using HTTP or HTTPS. +Azure Queue storage is a service for storing large numbers of messages that can be accessed from anywhere in the world via authenticated calls using HTTP or HTTPS. A single queue message can be up to 64 KB in size, and a queue can contain millions of messages, up to the total capacity limit of a storage account. [Source code][source_code] | [API reference documentation][api_documentation] | [Product documentation][storage_docs] | @@ -19,9 +19,43 @@ A single queue message can be up to 64 KB in size, and a queue can contain milli com.azure azure-storage-queue - 12.0.0-preview.2 + 12.0.0-preview.3 ``` +### 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](#build-a-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(); +``` ### Create a Storage Account To create a Storage Account you can use the Azure Portal or [Azure CLI][azure_cli]. @@ -32,13 +66,13 @@ az group create --name storage-resource-group --location westus ### Authenticate the client -In order to interact with the Storage service (Blob, Queue, Message, MessageId, File) you'll need to create an instance of the Service Client class. +In order to interact with the Storage service (Blob, Queue, Message, MessageId, File) you'll need to create an instance of the Service Client class. To make this possible you'll need the Account SAS (shared access signature) string of Storage account. Learn more at [SAS Token][sas_token] #### Get Credentials - **SAS Token** - + a. Use the [Azure CLI][azure_cli] snippet below to get the SAS token from the Storage account. ```Powershell @@ -77,7 +111,6 @@ Go to your storage account -> Access Keys -> Keys 1/ Key 2 -> Connection string ## Key concepts ### URL format Queues are addressable using the following URL format: -https://.queue.core.windows.net/ The following URL addresses a queue in the diagram: https://myaccount.queue.core.windows.net/images-to-download @@ -105,7 +138,7 @@ Every queue within an account must have a unique name. The queue name must be a 1. A queue name must be from 3 through 63 characters long. ### Queue Services -The queue service do operations on the queues in the storage account and manage the queue properties. +The queue service do operations on the queues in the storage account and manage the queue properties. ### Queue Service Client @@ -115,7 +148,7 @@ Once you have the value of the SASToken you can create the queue service client String queueServiceURL = String.format("https://%s.queue.core.windows.net", accountName) QueueServiceClient queueServiceClient = new QueueServiceClientBuilder().endpoint(queueURL).credential(SASToken).build(); -QueueClient newQueueServiceClient = queueServiceClient.createQueue("myqueue"); +QueueClient newQueueClient = queueServiceClient.createQueue("myqueue"); ``` or @@ -137,7 +170,7 @@ queueServiceAsyncClient.createQueue("newAsyncQueue").subscribe( ``` ### Queue -Azure Queue storage is a service for storing large numbers of messages that can be accessed from anywhere in the world via authenticated calls using HTTP or HTTPS. +Azure Queue storage is a service for storing large numbers of messages that can be accessed from anywhere in the world via authenticated calls using HTTP or HTTPS. A single queue message can be up to 64 KB in size, and a queue can contain millions of messages, up to the total capacity limit of a storage account. ### QueueClient @@ -145,8 +178,8 @@ Once you have the value of the SASToken you can create the queue service client ```Java String queueURL = String.format("https://%s.queue.core.windows.net/%s", accountName, queueName); QueueClient queueClient = QueueClient.builder().endpoint(queueURL).credential(SASToken).build(); -// metadata is map of key-value pair, timeout is client side timeout -QueueClient newQueueClient = queueClient.create(metadata, timeout); +// metadata is map of key-value pair +queueClient.createWithResponse(metadata, null); ``` or @@ -154,7 +187,7 @@ or ```Java String queueAsyncURL = String.format("https://%s.queue.core.windows.net/%s%s", accountName, queueAsyncName, sasToken) QueueAsyncClient queueAsyncClient = QueueAsyncClient.builder().endpoint(queueAsyncURL).build(); -queueAsyncClient.create(metadata, timeout).subscribe( +queueAsyncClient.createWithResponse(metadata).subscribe( result -> { // do something when new queue created }, @@ -164,8 +197,7 @@ queueAsyncClient.create(metadata, timeout).subscribe( () -> { // completed, do something }); -``` - +``` ## Examples The following sections provide several code snippets covering some of the most common Configuration Service tasks, including: @@ -205,24 +237,24 @@ QueueServiceClient queueServiceClient = new QueueServiceClientBuilder().endpoint ### Create a queue -Create a queue in the Storage Account using `${SASToken}` as credential. -Throws StorageErrorException If the queue fails to be created. +Create a queue in the Storage Account using `${SASToken}` as credential. +Throws StorageException If the queue fails to be created. ```Java String queueServiceURL = String.format("https://%s.queue.core.windows.net", accountName); QueueServiceClient queueServiceClient = new QueueServiceClientBuilder().endpoint(queueServiceURL).credential(SASToken).buildClient(); -QueueClient newQueueServiceClient = queueServiceClient.createQueue("myqueue"); +QueueClient newQueueClient = queueServiceClient.createQueue("myqueue"); ``` ### Delete a queue -Delete a queue in the Storage Account using `${SASToken}` as credential. -Throws StorageErrorException If the queue fails to be deleted. +Delete a queue in the Storage Account using `${SASToken}` as credential. +Throws StorageException If the queue fails to be deleted. ```Java String queueServiceURL = String.format("https://%s.queue.core.windows.net", accountName); QueueServiceClient queueServiceClient = new QueueServiceClientBuilder().endpoint(queueServiceURL).credential(SASToken).buildClient(); -QueueClient newQueueServiceClient = queueServiceClient.deleteQueue("myqueue"); +queueServiceClient.deleteQueue("myqueue"); ``` ### List queues in account @@ -247,7 +279,7 @@ Use `${SASToken}` as credential. String queueServiceURL = String.format("https://%s.queue.core.windows.net", accountName); QueueServiceClient queueServiceClient = new QueueServiceClientBuilder().endpoint(queueServiceURL).credential(SASToken).buildClient(); -Response properties = queueServiceClient.getProperties(); +StorageServiceProperties properties = queueServiceClient.getProperties(); ``` ### Set properties in queue account @@ -269,8 +301,8 @@ StorageServiceProperties properties = new StorageServiceProperties() { queueServiceClient.setProperties(properties); ``` -### Get queue service statistics -The `Get Queue Service Stats` operation retrieves statistics related to replication for the Queue service. +### Get queue service statistics +The `Get Queue Service Stats` operation retrieves statistics related to replication for the Queue service. Use `${SASToken}` as credential. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account. @@ -278,11 +310,11 @@ It is only available on the secondary location endpoint when read-access geo-red String queueServiceURL = String.format("https://%s.queue.core.windows.net", accountName); QueueServiceClient queueServiceClient = new QueueServiceClientBuilder().endpoint(queueServiceURL).credential(SASToken).buildClient(); -Response queueStats = queueServiceClient.getStatistics(); +StorageServiceStats queueStats = queueServiceClient.getStatistics(); ``` ### Enqueue message into a queue -The operation adds a new message to the back of the message queue. A visibility timeout can also be specified to make the message invisible until the visibility timeout expires. +The operation adds a new message to the back of the message queue. A visibility timeout can also be specified to make the message invisible until the visibility timeout expires. Use `${SASToken}` as credential. A message must be in a format that can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for versions 2011-08-18 and newer, or 8 KB in size for previous versions. @@ -301,7 +333,7 @@ QueueClient queueClient = new QueueClientBuilder().endpoint(queueURL).credential // @param messageId Id of the message // @param popReceipt Unique identifier that must match the message for it to be updated // @param visibilityTimeout How long the message will be invisible in the queue in seconds -queueClient.updateMessage(messageId, "new message", popReceipt, visibilityTimeout); +queueClient.updateMessage("new message", messageId, popReceipt, visibilityTimeout); ``` ### Peek at messages in a queue @@ -341,7 +373,7 @@ Use `${SASToken}` as credential. String queueSURL = String.format("https://%s.queue.core.windows.net", accountName); QueueClient queueClient = new QueueClientBuilder().endpoint(queueURL).credential(SASToken).queueName("myqueue").buildClient(); -Response properties = queueClient.getProperties(); +StorageServiceProperties properties = queueClient.getProperties(); ``` ### Set a queue metadata @@ -411,3 +443,5 @@ If you would like to become an active contributor to this project please follow [samples_message]: src/samples/java/com/azure/storage/queue/MessageSamples.java [samples_queue_exception]: src/samples/java/com/azure/storage/queue/QueueExceptionSamples.java [samples_async]: src/samples/java/com/azure/storage/queue/AsyncSamples.java + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/storage/azure-storage-queue/README.png) diff --git a/sdk/storage/azure-storage-queue/pom.xml b/sdk/storage/azure-storage-queue/pom.xml index 8956e06c351c..6f1fdc984068 100644 --- a/sdk/storage/azure-storage-queue/pom.xml +++ b/sdk/storage/azure-storage-queue/pom.xml @@ -5,7 +5,7 @@ com.azure azure-client-sdk-parent - 1.3.0 + 1.4.0 ../../../pom.client.xml @@ -13,9 +13,10 @@ com.azure azure-storage-queue - 12.0.0-preview.3 + 12.0.0-preview.4 - azure-storage-queue + Microsoft Azure client library for Queue Storage + This module contains client library for Microsoft Azure Queue Storage. https://github.com/Azure/azure-sdk-for-java @@ -31,37 +32,31 @@ HEAD + + com.azure.storage.queue + + com.azure azure-core - 1.0.0-preview.4 + 1.0.0-preview.5 com.azure azure-storage-common - 12.0.0-preview.3 - - - org.slf4j - slf4j-api + 12.0.0-preview.4 - com.azure azure-core-test - 1.0.0-preview.4 + 1.0.0-preview.5 test com.azure - azure-identity - 1.0.0-preview.3 - test - - - junit - junit + azure-core-http-netty + 1.0.0-preview.5 test @@ -69,15 +64,50 @@ slf4j-simple test + - io.projectreactor - reactor-test + org.spockframework + spock-core test - com.microsoft.azure - adal4j + io.projectreactor + reactor-test test + + + + src/main/java + src/test/java + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + groovy-eclipse-compiler + -Xlint:unchecked + 1.8 + 1.8 + true + + + + org.codehaus.groovy + groovy-eclipse-compiler + ${groovy-eclipse-compiler.version} + + + org.codehaus.groovy + groovy-eclipse-batch + ${groovy-eclipse-batch.version} + + + + + diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/BaseQueueClientBuilder.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/BaseQueueClientBuilder.java new file mode 100644 index 000000000000..1d13bd4c7c89 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/BaseQueueClientBuilder.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.queue; + +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.logging.ClientLogger; +import com.azure.storage.common.BaseClientBuilder; +import com.azure.storage.common.policy.ResponseValidationPolicyBuilder; + +abstract class BaseQueueClientBuilder> extends BaseClientBuilder { + + private static final String QUEUE_ENDPOINT_MIDFIX = "queue"; + + private final ClientLogger logger = new ClientLogger(BaseQueueClientBuilder.class); + + @Override + protected final UserAgentPolicy getUserAgentPolicy() { + return new UserAgentPolicy(QueueConfiguration.NAME, QueueConfiguration.VERSION, super.getConfiguration()); + } + + @Override + protected final String getServiceUrlMidfix() { + return QUEUE_ENDPOINT_MIDFIX; + } + + /** + * UNSUPPORTED OPERATION: Azure Storage queue service does not support anonymous access. + * Clears the credential used to authorize requests sent to the service + * + * @return the updated builder + */ + public final T setAnonymousCredential() { + throw logger.logExceptionAsError(new UnsupportedOperationException( + "Azure Storage file service does not support anonymous access.")); + } + + @Override + protected final void applyServiceSpecificValidations(ResponseValidationPolicyBuilder builder) { + // for queue service validations + } +} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/PostProcessor.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/PostProcessor.java new file mode 100644 index 000000000000..57944f64eaf0 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/PostProcessor.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.queue; + +import com.azure.storage.common.Utility; +import com.azure.storage.queue.models.StorageErrorException; +import com.azure.storage.queue.models.StorageException; +import reactor.core.publisher.Mono; + +final class PostProcessor { + static Mono postProcessResponse(Mono response) { + return Utility.postProcessResponse(response, (errorResponse) -> + errorResponse.onErrorResume(StorageErrorException.class, resume -> + resume.getResponse() + .getBodyAsString() + .switchIfEmpty(Mono.just("")) + .flatMap(body -> Mono.error(new StorageException(resume, body))) + )); + } + + private PostProcessor() { + } +} 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 659d128dc243..161ce01b61f3 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 @@ -3,14 +3,20 @@ package com.azure.storage.queue; import com.azure.core.http.HttpPipeline; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.implementation.http.PagedResponseBase; +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.IPRange; +import com.azure.storage.common.SASProtocol; +import com.azure.storage.common.Utility; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.queue.implementation.AzureQueueStorageBuilder; import com.azure.storage.queue.implementation.AzureQueueStorageImpl; import com.azure.storage.queue.models.DequeuedMessage; import com.azure.storage.queue.models.EnqueuedMessage; @@ -22,16 +28,22 @@ import com.azure.storage.queue.models.QueueProperties; import com.azure.storage.queue.models.QueuesGetPropertiesResponse; import com.azure.storage.queue.models.SignedIdentifier; -import com.azure.storage.queue.models.StorageErrorException; +import com.azure.storage.queue.models.StorageException; import com.azure.storage.queue.models.UpdatedMessage; -import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.net.MalformedURLException; import java.net.URL; import java.time.Duration; +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.queue.PostProcessor.postProcessResponse; /** * This class provides a client that contains all the operations for interacting with a queue in Azure Storage Queue. @@ -50,40 +62,21 @@ * @see SASTokenCredential */ public final class QueueAsyncClient { - private static final ClientLogger LOGGER = new ClientLogger(QueueAsyncClient.class); + private final ClientLogger logger = new ClientLogger(QueueAsyncClient.class); private final AzureQueueStorageImpl client; private final String queueName; /** - * Creates a QueueAsyncClient that sends requests to the storage queue service at {@code AzureQueueStorageImpl#getUrl() endpoint}. - * Each service call goes through the {@link HttpPipeline pipeline} in the {@code AzureQueueStorageImpl client}. + * Creates a QueueAsyncClient that sends requests to the storage queue service at {@link #getQueueUrl() endpoint}. + * Each service call goes through the {@link HttpPipeline pipeline}. * * @param client Client that interacts with the service interfaces * @param queueName Name of the queue */ QueueAsyncClient(AzureQueueStorageImpl client, String queueName) { + Objects.requireNonNull(queueName); this.queueName = queueName; - - this.client = new AzureQueueStorageBuilder().pipeline(client.getHttpPipeline()) - .url(client.getUrl()) - .version(client.getVersion()) - .build(); - } - - /** - * Creates a QueueAsyncClient that sends requests to the storage queue service at {@code endpoint}. - * Each service call goes through the {@code httpPipeline}. - * - * @param endpoint URL for the Storage Queue service - * @param httpPipeline HttpPipeline that the HTTP requests and response flow through - * @param queueName Name of the queue - */ - QueueAsyncClient(URL endpoint, HttpPipeline httpPipeline, String queueName) { - this.queueName = queueName; - - this.client = new AzureQueueStorageBuilder().pipeline(httpPipeline) - .url(endpoint.toString()) - .build(); + this.client = client; } /** @@ -94,8 +87,8 @@ public URL getQueueUrl() { try { return new URL(client.getUrl()); } catch (MalformedURLException ex) { - LOGGER.error("Queue URL is malformed"); - throw new RuntimeException("Queue URL is malformed"); + logger.error("Queue URL is malformed"); + throw logger.logExceptionAsError(new RuntimeException("Queue URL is malformed")); } } @@ -111,11 +104,11 @@ public URL getQueueUrl() { *

    For more information, see the * Azure Docs.

    * - * @return A response that only contains headers and response status code - * @throws StorageErrorException If a queue with the same name already exists in the queue service. + * @return An empty response + * @throws StorageException If a queue with the same name already exists in the queue service. */ - public Mono create() { - return create(null); + public Mono create() { + return createWithResponse(null).flatMap(FluxUtil::toMono); } /** @@ -125,17 +118,23 @@ public Mono create() { * *

    Create a queue with metadata "queue:metadataMap"

    * - * {@codesnippet com.azure.storage.queue.queueAsyncClient.create#map} + * {@codesnippet com.azure.storage.queue.queueAsyncClient.createWithResponse#map} * *

    For more information, see the * Azure Docs.

    * * @param metadata Metadata to associate with the queue * @return A response that only contains headers and response status code - * @throws StorageErrorException If a queue with the same name and different metadata already exists in the queue service. + * @throws StorageException If a queue with the same name and different metadata already exists in the queue + * service. */ - public Mono create(Map metadata) { - return client.queues().createWithRestResponseAsync(queueName, null, metadata, null, Context.NONE) + public Mono createWithResponse(Map metadata) { + return withContext(context -> createWithResponse(metadata, context)); + } + + Mono createWithResponse(Map metadata, Context context) { + return postProcessResponse(client.queues() + .createWithRestResponseAsync(queueName, null, metadata, null, context)) .map(VoidResponse::new); } @@ -151,11 +150,34 @@ public Mono create(Map metadata) { *

    For more information, see the * Azure Docs.

    * + * @return An empty response + * @throws StorageException If the queue doesn't exist + */ + public Mono delete() { + return deleteWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Permanently deletes the queue. + * + *

    Code Samples

    + * + *

    Delete a queue

    + * + * {@codesnippet com.azure.storage.queue.queueAsyncClient.deleteWithResponse} + * + *

    For more information, see the + * Azure Docs.

    + * * @return A response that only contains headers and response status code - * @throws StorageErrorException If the queue doesn't exist + * @throws StorageException If the queue doesn't exist */ - public Mono delete() { - return client.queues().deleteWithRestResponseAsync(queueName, Context.NONE) + public Mono deleteWithResponse() { + return withContext(this::deleteWithResponse); + } + + Mono deleteWithResponse(Context context) { + return postProcessResponse(client.queues().deleteWithRestResponseAsync(queueName, context)) .map(VoidResponse::new); } @@ -173,10 +195,34 @@ public Mono delete() { * * @return A response containing a {@link QueueProperties} value which contains the metadata and approximate * messages count of the queue. - * @throws StorageErrorException If the queue doesn't exist + * @throws StorageException If the queue doesn't exist + */ + public Mono getProperties() { + return getPropertiesWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Retrieves metadata and approximate message count of the queue. + * + *

    Code Samples

    + * + *

    Get the properties of the queue

    + * + * {@codesnippet com.azure.storage.queue.queueAsyncClient.getPropertiesWithResponse} + * + *

    For more information, see the + * Azure Docs.

    + * + * @return A response containing a {@link QueueProperties} value which contains the metadata and approximate + * messages count of the queue. + * @throws StorageException If the queue doesn't exist */ - public Mono> getProperties() { - return client.queues().getPropertiesWithRestResponseAsync(queueName, Context.NONE) + public Mono> getPropertiesWithResponse() { + return withContext(this::getPropertiesWithResponse); + } + + Mono> getPropertiesWithResponse(Context context) { + return postProcessResponse(client.queues().getPropertiesWithRestResponseAsync(queueName, context)) .map(this::getQueuePropertiesResponse); } @@ -200,10 +246,41 @@ public Mono> getProperties() { * * @param metadata Metadata to set on the queue * @return A response that only contains headers and response status code - * @throws StorageErrorException If the queue doesn't exist + * @throws StorageException If the queue doesn't exist + */ + public Mono setMetadata(Map metadata) { + return setMetadataWithResponse(metadata).flatMap(FluxUtil::toMono); + } + + /** + * Sets the metadata of the queue. + * + * Passing in a {@code null} value for metadata will clear the metadata associated with the queue. + * + *

    Code Samples

    + * + *

    Set the queue's metadata to "queue:metadataMap"

    + * + * {@codesnippet com.azure.storage.queue.queueAsyncClient.setMetadataWithResponse#map} + * + *

    Clear the queue's metadata

    + * + * {@codesnippet com.azure.storage.queue.queueAsyncClient.clearMetadataWithResponse#map} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param metadata Metadata to set on the queue + * @return A response that only contains headers and response status code + * @throws StorageException If the queue doesn't exist */ - public Mono setMetadata(Map metadata) { - return client.queues().setMetadataWithRestResponseAsync(queueName, null, metadata, null, Context.NONE) + public Mono setMetadataWithResponse(Map metadata) { + return withContext(context -> setMetadataWithResponse(metadata, context)); + } + + Mono setMetadataWithResponse(Map metadata, Context context) { + return postProcessResponse(client.queues() + .setMetadataWithRestResponseAsync(queueName, null, metadata, null, context)) .map(VoidResponse::new); } @@ -220,11 +297,41 @@ public Mono setMetadata(Map metadata) { * Azure Docs.

    * * @return The stored access policies specified on the queue. - * @throws StorageErrorException If the queue doesn't exist + * @throws StorageException If the queue doesn't exist + */ + public PagedFlux getAccessPolicy() { + Function>> retriever = + marker -> postProcessResponse(this.client.queues() + .getAccessPolicyWithRestResponseAsync(queueName, Context.NONE)) + .map(response -> new PagedResponseBase<>(response.getRequest(), + response.getStatusCode(), + response.getHeaders(), + response.getValue(), + null, + response.getDeserializedHeaders())); + + return new PagedFlux<>(() -> retriever.apply(null), retriever); + } + + /** + * Sets stored access policies on the queue. + * + *

    Code Samples

    + * + *

    Set a read only stored access policy

    + * + * {@codesnippet com.azure.storage.queue.QueueAsyncClient.setAccessPolicy#List} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param permissions Access policies to set on the queue + * @return An empty response + * @throws StorageException If the queue doesn't exist, a stored access policy doesn't have all fields filled out, + * or the queue will have more than five policies. */ - public Flux getAccessPolicy() { - return client.queues().getAccessPolicyWithRestResponseAsync(queueName, Context.NONE) - .flatMapMany(response -> Flux.fromIterable(response.value())); + public Mono setAccessPolicy(List permissions) { + return setAccessPolicyWithResponse(permissions).flatMap(FluxUtil::toMono); } /** @@ -234,18 +341,42 @@ public Flux getAccessPolicy() { * *

    Set a read only stored access policy

    * - * {@codesnippet com.azure.storage.queue.queueAsyncClient.setAccessPolicy} + * {@codesnippet com.azure.storage.queue.QueueAsyncClient.setAccessPolicyWithResponse#List} * *

    For more information, see the * Azure Docs.

    * * @param permissions Access policies to set on the queue * @return A response that only contains headers and response status code - * @throws StorageErrorException If the queue doesn't exist, a stored access policy doesn't have all fields filled out, + * @throws StorageException If the queue doesn't exist, a stored access policy doesn't have all fields filled out, * or the queue will have more than five policies. */ - public Mono setAccessPolicy(List permissions) { - return client.queues().setAccessPolicyWithRestResponseAsync(queueName, permissions, null, null, Context.NONE) + public Mono setAccessPolicyWithResponse(List permissions) { + return withContext(context -> setAccessPolicyWithResponse(permissions, context)); + } + + Mono setAccessPolicyWithResponse(List permissions, Context context) { + /* + We truncate to seconds because the service only supports nanoseconds or seconds, but doing an + OffsetDateTime.now will only give back milliseconds (more precise fields are zeroed and not serialized). This + allows for proper serialization with no real detriment to users as sub-second precision on active time for + signed identifiers is not really necessary. + */ + if (permissions != null) { + for (SignedIdentifier permission : permissions) { + if (permission.getAccessPolicy() != null && permission.getAccessPolicy().getStart() != null) { + permission.getAccessPolicy().setStart( + permission.getAccessPolicy().getStart().truncatedTo(ChronoUnit.SECONDS)); + } + if (permission.getAccessPolicy() != null && permission.getAccessPolicy().getExpiry() != null) { + permission.getAccessPolicy().setExpiry( + permission.getAccessPolicy().getExpiry().truncatedTo(ChronoUnit.SECONDS)); + } + } + } + + return postProcessResponse(client.queues() + .setAccessPolicyWithRestResponseAsync(queueName, permissions, null, null, context)) .map(VoidResponse::new); } @@ -261,11 +392,34 @@ public Mono setAccessPolicy(List permissions) { *

    For more information, see the * Azure Docs.

    * + * @return An empty response + * @throws StorageException If the queue doesn't exist + */ + public Mono clearMessages() { + return clearMessagesWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Deletes all messages in the queue. + * + *

    Code Samples

    + * + *

    Clear the messages

    + * + * {@codesnippet com.azure.storage.queue.queueAsyncClient.clearMessagesWithResponse} + * + *

    For more information, see the + * Azure Docs.

    + * * @return A response that only contains headers and response status code - * @throws StorageErrorException If the queue doesn't exist + * @throws StorageException If the queue doesn't exist */ - public Mono clearMessages() { - return client.messages().clearWithRestResponseAsync(queueName, Context.NONE) + public Mono clearMessagesWithResponse() { + return withContext(this::clearMessagesWithResponse); + } + + Mono clearMessagesWithResponse(Context context) { + return postProcessResponse(client.messages().clearWithRestResponseAsync(queueName, context)) .map(VoidResponse::new); } @@ -282,13 +436,13 @@ public Mono clearMessages() { * Azure Docs.

    * * @param messageText Message text - * @return A {@link EnqueuedMessage} value that contains the {@link EnqueuedMessage#messageId() messageId} and - * {@link EnqueuedMessage#popReceipt() popReceipt} that are used to interact with the message and other metadata + * @return A {@link EnqueuedMessage} value that contains the {@link EnqueuedMessage#getMessageId() messageId} and + * {@link EnqueuedMessage#getPopReceipt() popReceipt} that are used to interact with the message and other metadata * about the enqueued message. - * @throws StorageErrorException If the queue doesn't exist + * @throws StorageException If the queue doesn't exist */ - public Mono> enqueueMessage(String messageText) { - return enqueueMessage(messageText, Duration.ofSeconds(0), Duration.ofDays(7)); + public Mono enqueueMessage(String messageText) { + return enqueueMessageWithResponse(messageText, null, null).flatMap(FluxUtil::toMono); } /** @@ -298,34 +452,42 @@ public Mono> enqueueMessage(String messageText) { * *

    Add a message of "Hello, Azure" that has a timeout of 5 seconds

    * - * {@codesnippet com.azure.storage.queue.queueAsyncClient.enqueueMessage#string-duration-duration} + * {@codesnippet com.azure.storage.queue.queueAsyncClient.enqueueMessageWithResponse#string-duration-duration} * *

    Add a message of "Goodbye, Azure" that has a time to live of 5 seconds

    * - * {@codesnippet com.azure.storage.queue.queueAsyncClient.enqueueMessageLiveTime#string-duration-duration} + * {@codesnippet com.azure.storage.queue.QueueAsyncClient.enqueueMessageWithResponse-liveTime#String-Duration-Duration} * *

    For more information, see the * Azure Docs.

    * * @param messageText Message text - * @param visibilityTimeout Optional. The timeout period for how long the message is invisible in the queue in seconds. - * If unset the value will default to 0 and the message will be instantly visible. The timeout must be between 0 + * @param visibilityTimeout Optional. The timeout period for how long the message is invisible in the queue. If + * unset the value will default to 0 and the message will be instantly visible. The timeout must be between 0 * seconds and 7 days. - * @param timeToLive Optional. How long the message will stay alive in the queue in seconds. If unset the value will - * default to 7 days, if -1 is passed the message will not expire. The time to live must be -1 or any positive number. - * @return A {@link EnqueuedMessage} value that contains the {@link EnqueuedMessage#messageId() messageId} and - * {@link EnqueuedMessage#popReceipt() popReceipt} that are used to interact with the message and other metadata + * @param timeToLive Optional. How long the message will stay alive in the queue. If unset the value will default to + * 7 days, if -1 is passed the message will not expire. The time to live must be -1 or any positive number. + * @return A {@link EnqueuedMessage} value that contains the {@link EnqueuedMessage#getMessageId() messageId} and + * {@link EnqueuedMessage#getPopReceipt() popReceipt} that are used to interact with the message and other metadata * about the enqueued message. - * @throws StorageErrorException If the queue doesn't exist or the {@code visibilityTimeout} or {@code timeToLive} - * are outside of the allowed limits. + * @throws StorageException If the queue doesn't exist or the {@code visibilityTimeout} or {@code timeToLive} are + * outside of the allowed limits. */ - public Mono> enqueueMessage(String messageText, Duration visibilityTimeout, Duration timeToLive) { + public Mono> enqueueMessageWithResponse(String messageText, Duration visibilityTimeout, + Duration timeToLive) { + return withContext(context -> enqueueMessageWithResponse(messageText, visibilityTimeout, timeToLive, context)); + } + + Mono> enqueueMessageWithResponse(String messageText, Duration visibilityTimeout, + Duration timeToLive, Context context) { Integer visibilityTimeoutInSeconds = (visibilityTimeout == null) ? null : (int) visibilityTimeout.getSeconds(); Integer timeToLiveInSeconds = (timeToLive == null) ? null : (int) timeToLive.getSeconds(); - QueueMessage message = new QueueMessage().messageText(messageText); + QueueMessage message = new QueueMessage().setMessageText(messageText); - return client.messages().enqueueWithRestResponseAsync(queueName, message, visibilityTimeoutInSeconds, timeToLiveInSeconds, null, null, Context.NONE) - .map(response -> new SimpleResponse<>(response, response.value().get(0))); + return postProcessResponse(client.messages() + .enqueueWithRestResponseAsync(queueName, message, visibilityTimeoutInSeconds, timeToLiveInSeconds, + null, null, context)) + .map(response -> new SimpleResponse<>(response, response.getValue().get(0))); } /** @@ -340,17 +502,18 @@ public Mono> enqueueMessage(String messageText, Durati *

    For more information, see the * Azure Docs.

    * - * @return The first {@link DequeuedMessage} in the queue, it contains - * {@link DequeuedMessage#messageId() messageId} and {@link DequeuedMessage#popReceipt() popReceipt} used to interact - * with the message, additionally it contains other metadata about the message. - * @throws StorageErrorException If the queue doesn't exist + * @return The first {@link DequeuedMessage} in the queue, it contains {@link DequeuedMessage#getMessageId() + * messageId} and {@link DequeuedMessage#getPopReceipt() popReceipt} used to interact with the message, additionally + * it contains other metadata about the message. + * @throws StorageException If the queue doesn't exist */ - public Flux dequeueMessages() { - return dequeueMessages(1, Duration.ofSeconds(30)); + public PagedFlux dequeueMessages() { + return dequeueMessagesWithOptionalTimeout(1, null, null, Context.NONE); } /** - * Retrieves up to the maximum number of messages from the queue and hides them from other operations for 30 seconds. + * Retrieves up to the maximum number of messages from the queue and hides them from other operations for 30 + * seconds. * *

    Code Samples

    * @@ -361,16 +524,16 @@ public Flux dequeueMessages() { *

    For more information, see the * Azure Docs.

    * - * @param maxMessages Optional. Maximum number of messages to get, if there are less messages exist in the queue than requested - * all the messages will be returned. If left empty only 1 message will be retrieved, the allowed range is 1 to 32 - * messages. - * @return Up to {@code maxMessages} {@link DequeuedMessage DequeuedMessages} from the queue. Each DequeuedMessage contains - * {@link DequeuedMessage#messageId() messageId} and {@link DequeuedMessage#popReceipt() popReceipt} used to interact - * with the message and other metadata about the message. - * @throws StorageErrorException If the queue doesn't exist or {@code maxMessages} is outside of the allowed bounds + * @param maxMessages Optional. Maximum number of messages to get, if there are less messages exist in the queue + * than requested all the messages will be returned. If left empty only 1 message will be retrieved, the allowed + * range is 1 to 32 messages. + * @return Up to {@code maxMessages} {@link DequeuedMessage DequeuedMessages} from the queue. Each DequeuedMessage + * contains {@link DequeuedMessage#getMessageId() messageId} and {@link DequeuedMessage#getPopReceipt() popReceipt} + * used to interact with the message and other metadata about the message. + * @throws StorageException If the queue doesn't exist or {@code maxMessages} is outside of the allowed bounds */ - public Flux dequeueMessages(Integer maxMessages) { - return dequeueMessages(maxMessages, Duration.ofSeconds(30)); + public PagedFlux dequeueMessages(Integer maxMessages) { + return dequeueMessagesWithOptionalTimeout(maxMessages, null, null, Context.NONE); } /** @@ -386,21 +549,36 @@ public Flux dequeueMessages(Integer maxMessages) { *

    For more information, see the * Azure Docs.

    * - * @param maxMessages Optional. Maximum number of messages to get, if there are less messages exist in the queue than requested - * all the messages will be returned. If left empty only 1 message will be retrieved, the allowed range is 1 to 32 - * messages. - * @param visibilityTimeout Optional. The timeout period for how long the message is invisible in the queue in seconds. - * If left empty the dequeued messages will be invisible for 30 seconds. The timeout must be between 1 second and 7 days. - * @return Up to {@code maxMessages} {@link DequeuedMessage DequeuedMessages} from the queue. Each DeqeuedMessage contains - * {@link DequeuedMessage#messageId() messageId} and {@link DequeuedMessage#popReceipt() popReceipt} used to interact - * with the message and other metadata about the message. - * @throws StorageErrorException If the queue doesn't exist or {@code maxMessages} or {@code visibilityTimeout} is + * @param maxMessages Optional. Maximum number of messages to get, if there are less messages exist in the queue + * than requested all the messages will be returned. If left empty only 1 message will be retrieved, the allowed + * range is 1 to 32 messages. + * @param visibilityTimeout Optional. The timeout period for how long the message is invisible in the queue. If left + * empty the dequeued messages will be invisible for 30 seconds. The timeout must be between 1 second and 7 days. + * @return Up to {@code maxMessages} {@link DequeuedMessage DequeuedMessages} from the queue. Each DeqeuedMessage + * contains {@link DequeuedMessage#getMessageId() messageId} and {@link DequeuedMessage#getPopReceipt() popReceipt} + * used to interact with the message and other metadata about the message. + * @throws StorageException If the queue doesn't exist or {@code maxMessages} or {@code visibilityTimeout} is * outside of the allowed bounds */ - public Flux dequeueMessages(Integer maxMessages, Duration visibilityTimeout) { + public PagedFlux dequeueMessages(Integer maxMessages, Duration visibilityTimeout) { + return dequeueMessagesWithOptionalTimeout(maxMessages, visibilityTimeout, null, Context.NONE); + } + + PagedFlux dequeueMessagesWithOptionalTimeout(Integer maxMessages, Duration visibilityTimeout, + Duration timeout, Context context) { Integer visibilityTimeoutInSeconds = (visibilityTimeout == null) ? null : (int) visibilityTimeout.getSeconds(); - return client.messages().dequeueWithRestResponseAsync(queueName, maxMessages, visibilityTimeoutInSeconds, null, null, Context.NONE) - .flatMapMany(response -> Flux.fromIterable(response.value())); + Function>> retriever = + marker -> postProcessResponse(Utility.applyOptionalTimeout(this.client.messages() + .dequeueWithRestResponseAsync(queueName, maxMessages, visibilityTimeoutInSeconds, + null, null, context), timeout) + .map(response -> new PagedResponseBase<>(response.getRequest(), + response.getStatusCode(), + response.getHeaders(), + response.getValue(), + null, + response.getDeserializedHeaders()))); + + return new PagedFlux<>(() -> retriever.apply(null), retriever); } /** @@ -420,7 +598,7 @@ public Flux dequeueMessages(Integer maxMessages, Duration visib * * @return A {@link PeekedMessage} that contains metadata about the message. */ - public Flux peekMessages() { + public PagedFlux peekMessages() { return peekMessages(null); } @@ -439,16 +617,57 @@ public Flux peekMessages() { *

    For more information, see the * Azure Docs.

    * - * @param maxMessages Optional. Maximum number of messages to peek, if there are less messages exist in the queue than requested - * all the messages will be peeked. If left empty only 1 message will be peeked, the allowed range is 1 to 32 - * messages. - * @return Up to {@code maxMessages} {@link PeekedMessage PeekedMessages} from the queue. Each PeekedMessage contains - * metadata about the message. - * @throws StorageErrorException If the queue doesn't exist or {@code maxMessages} is outside of the allowed bounds + * @param maxMessages Optional. Maximum number of messages to peek, if there are less messages exist in the queue + * than requested all the messages will be peeked. If left empty only 1 message will be peeked, the allowed range is + * 1 to 32 messages. + * @return Up to {@code maxMessages} {@link PeekedMessage PeekedMessages} from the queue. Each PeekedMessage + * contains metadata about the message. + * @throws StorageException If the queue doesn't exist or {@code maxMessages} is outside of the allowed bounds */ - public Flux peekMessages(Integer maxMessages) { - return client.messages().peekWithRestResponseAsync(queueName, maxMessages, null, null, Context.NONE) - .flatMapMany(response -> Flux.fromIterable(response.value())); + public PagedFlux peekMessages(Integer maxMessages) { + return peekMessagesWithOptionalTimeout(maxMessages, null, Context.NONE); + } + + PagedFlux peekMessagesWithOptionalTimeout(Integer maxMessages, Duration timeout, Context context) { + Function>> retriever = + marker -> postProcessResponse(Utility.applyOptionalTimeout(this.client.messages() + .peekWithRestResponseAsync(queueName, maxMessages, null, null, context), timeout) + .map(response -> new PagedResponseBase<>(response.getRequest(), + response.getStatusCode(), + response.getHeaders(), + response.getValue(), + null, + response.getDeserializedHeaders()))); + + return new PagedFlux<>(() -> retriever.apply(null), retriever); + } + + /** + * Updates the specific message in the queue with a new message and resets the visibility timeout. + * + *

    Code Samples

    + * + *

    Dequeue the first message and update it to "Hello again, Azure" and hide it for 5 seconds

    + * + * {@codesnippet com.azure.storage.queue.QueueAsyncClient.updateMessage#String-String-String-Duration} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param messageText Updated value for the message + * @param messageId Id of the message to update + * @param popReceipt Unique identifier that must match for the message to be updated + * @param visibilityTimeout The timeout period for how long the message is invisible in the queue in seconds. The + * timeout period must be between 1 second and 7 days. + * @return A {@link UpdatedMessage} that contains the new {@link UpdatedMessage#getPopReceipt() popReceipt} to + * interact with the message, additionally contains the updated metadata about the message. + * @throws StorageException If the queue or messageId don't exist, the popReceipt doesn't match on the message, or + * the {@code visibilityTimeout} is outside the allowed bounds + */ + public Mono updateMessage(String messageText, String messageId, String popReceipt, + Duration visibilityTimeout) { + return updateMessageWithResponse(messageText, messageId, popReceipt, visibilityTimeout) + .flatMap(FluxUtil::toMono); } /** @@ -458,7 +677,7 @@ public Flux peekMessages(Integer maxMessages) { * *

    Dequeue the first message and update it to "Hello again, Azure" and hide it for 5 seconds

    * - * {@codesnippet com.azure.storage.queue.queueAsyncClient.updateMessage} + * {@codesnippet com.azure.storage.queue.QueueAsyncClient.updateMessageWithResponse#String-String-String-Duration} * *

    For more information, see the * Azure Docs.

    @@ -468,14 +687,23 @@ public Flux peekMessages(Integer maxMessages) { * @param popReceipt Unique identifier that must match for the message to be updated * @param visibilityTimeout The timeout period for how long the message is invisible in the queue in seconds. The * timeout period must be between 1 second and 7 days. - * @return A {@link UpdatedMessage} that contains the new {@link UpdatedMessage#popReceipt() popReceipt} to interact - * with the message, additionally contains the updated metadata about the message. - * @throws StorageErrorException If the queue or messageId don't exist, the popReceipt doesn't match on the message, - * or the {@code visibilityTimeout} is outside the allowed bounds + * @return A {@link UpdatedMessage} that contains the new {@link UpdatedMessage#getPopReceipt() popReceipt} to + * interact with the message, additionally contains the updated metadata about the message. + * @throws StorageException If the queue or messageId don't exist, the popReceipt doesn't match on the message, or + * the {@code visibilityTimeout} is outside the allowed bounds */ - public Mono> updateMessage(String messageText, String messageId, String popReceipt, Duration visibilityTimeout) { - QueueMessage message = new QueueMessage().messageText(messageText); - return client.messageIds().updateWithRestResponseAsync(queueName, messageId, message, popReceipt, (int) visibilityTimeout.getSeconds(), Context.NONE) + public Mono> updateMessageWithResponse(String messageText, String messageId, + String popReceipt, Duration visibilityTimeout) { + return withContext(context -> + updateMessageWithResponse(messageText, messageId, popReceipt, visibilityTimeout, context)); + } + + Mono> updateMessageWithResponse(String messageText, String messageId, String popReceipt, + Duration visibilityTimeout, Context context) { + QueueMessage message = new QueueMessage().setMessageText(messageText); + return postProcessResponse(client.messageIds() + .updateWithRestResponseAsync(queueName, messageId, message, popReceipt, + (int) visibilityTimeout.getSeconds(), context)) .map(this::getUpdatedMessageResponse); } @@ -486,7 +714,28 @@ public Mono> updateMessage(String messageText, String m * *

    Delete the first message

    * - * {@codesnippet com.azure.storage.queue.queueAsyncClient.deleteMessage} + * {@codesnippet com.azure.storage.queue.QueueAsyncClient.deleteMessage#String-String} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param messageId Id of the message to deleted + * @param popReceipt Unique identifier that must match for the message to be deleted + * @return An empty response + * @throws StorageException If the queue or messageId don't exist or the popReceipt doesn't match on the message + */ + public Mono deleteMessage(String messageId, String popReceipt) { + return deleteMessageWithResponse(messageId, popReceipt).flatMap(FluxUtil::toMono); + } + + /** + * Deletes the specified message in the queue + * + *

    Code Samples

    + * + *

    Delete the first message

    + * + * {@codesnippet com.azure.storage.queue.QueueAsyncClient.deleteMessageWithResponse#String-String} * *

    For more information, see the * Azure Docs.

    @@ -494,21 +743,91 @@ public Mono> updateMessage(String messageText, String m * @param messageId Id of the message to deleted * @param popReceipt Unique identifier that must match for the message to be deleted * @return A response that only contains headers and response status code - * @throws StorageErrorException If the queue or messageId don't exist or the popReceipt doesn't match on the message + * @throws StorageException If the queue or messageId don't exist or the popReceipt doesn't match on the message */ - public Mono deleteMessage(String messageId, String popReceipt) { - return client.messageIds().deleteWithRestResponseAsync(queueName, messageId, popReceipt, Context.NONE) + public Mono deleteMessageWithResponse(String messageId, String popReceipt) { + return withContext(context -> deleteMessageWithResponse(messageId, popReceipt, context)); + } + + Mono deleteMessageWithResponse(String messageId, String popReceipt, Context context) { + return postProcessResponse(client.messageIds() + .deleteWithRestResponseAsync(queueName, messageId, popReceipt, context)) .map(VoidResponse::new); } + /** + * 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 + */ + 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 + */ + 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 + */ + 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(); + } + /* * Maps the HTTP headers returned from the service to the expected response type * @param response Service response * @return Mapped response */ private Response getQueuePropertiesResponse(QueuesGetPropertiesResponse response) { - QueueGetPropertiesHeaders propertiesHeaders = response.deserializedHeaders(); - QueueProperties properties = new QueueProperties(propertiesHeaders.metadata(), propertiesHeaders.approximateMessagesCount()); + QueueGetPropertiesHeaders propertiesHeaders = response.getDeserializedHeaders(); + QueueProperties properties = new QueueProperties(propertiesHeaders.getMetadata(), + propertiesHeaders.getApproximateMessagesCount()); return new SimpleResponse<>(response, properties); } @@ -518,8 +837,8 @@ private Response getQueuePropertiesResponse(QueuesGetProperties * @return Mapped response */ private Response getUpdatedMessageResponse(MessageIdsUpdateResponse response) { - MessageIdUpdateHeaders headers = response.deserializedHeaders(); - UpdatedMessage updatedMessage = new UpdatedMessage(headers.popReceipt(), headers.timeNextVisible()); + MessageIdUpdateHeaders headers = response.getDeserializedHeaders(); + UpdatedMessage updatedMessage = new UpdatedMessage(headers.getPopReceipt(), headers.getTimeNextVisible()); return new SimpleResponse<>(response, updatedMessage); } } 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 3e55da311b15..2334ead34db0 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 @@ -2,8 +2,13 @@ // Licensed under the MIT License. package com.azure.storage.queue; +import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.VoidResponse; +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.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.queue.models.DequeuedMessage; @@ -11,10 +16,13 @@ import com.azure.storage.queue.models.PeekedMessage; import com.azure.storage.queue.models.QueueProperties; import com.azure.storage.queue.models.SignedIdentifier; -import com.azure.storage.queue.models.StorageErrorException; +import com.azure.storage.queue.models.StorageException; import com.azure.storage.queue.models.UpdatedMessage; +import reactor.core.publisher.Mono; + import java.net.URL; import java.time.Duration; +import java.time.OffsetDateTime; import java.util.List; import java.util.Map; @@ -61,16 +69,15 @@ public URL getQueueUrl() { * *

    Create a queue

    * - *{@codesnippet com.azure.storage.queue.queueClient.create} + * {@codesnippet com.azure.storage.queue.queueClient.create} * *

    For more information, see the * Azure Docs.

    * - * @return A response that only contains headers and response status code - * @throws StorageErrorException If a queue with the same name already exists in the queue service. + * @throws StorageException If a queue with the same name already exists in the queue service. */ - public VoidResponse create() { - return create(null); + public void create() { + createWithResponse(null, null, Context.NONE); } /** @@ -80,17 +87,23 @@ public VoidResponse create() { * *

    Create a queue with metadata "queue:metadataMap"

    * - * {@codesnippet com.azure.storage.queue.queueClient.create#map} + * {@codesnippet com.azure.storage.queue.queueClient.createWithResponse#map-duration-context} * *

    For more information, see the * Azure Docs.

    * * @param metadata Metadata to associate with the queue + * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout + * concludes a {@link RuntimeException} will be thrown. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response that only contains headers and response status code - * @throws StorageErrorException If a queue with the same name and different metadata already exists in the queue service. + * @throws StorageException If a queue with the same name and different metadata already exists in the queue + * service. + * @throws RuntimeException if the operation doesn't complete before the timeout concludes. */ - public VoidResponse create(Map metadata) { - return client.create(metadata).block(); + public VoidResponse createWithResponse(Map metadata, Duration timeout, Context context) { + Mono response = client.createWithResponse(metadata, context); + return Utility.blockWithOptionalTimeout(response, timeout); } /** @@ -105,11 +118,34 @@ public VoidResponse create(Map metadata) { *

    For more information, see the * Azure Docs.

    * + * @throws StorageException If the queue doesn't exist + */ + public void delete() { + deleteWithResponse(null, Context.NONE); + } + + /** + * Permanently deletes the queue. + * + *

    Code Samples

    + * + *

    Delete a queue

    + * + * {@codesnippet com.azure.storage.queue.queueClient.deleteWithResponse#duration-context} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout + * concludes a {@link RuntimeException} will be thrown. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response that only contains headers and response status code - * @throws StorageErrorException If the queue doesn't exist + * @throws StorageException If the queue doesn't exist + * @throws RuntimeException if the operation doesn't complete before the timeout concludes. */ - public VoidResponse delete() { - return client.delete().block(); + public VoidResponse deleteWithResponse(Duration timeout, Context context) { + Mono response = client.deleteWithResponse(context); + return Utility.blockWithOptionalTimeout(response, timeout); } /** @@ -126,10 +162,35 @@ public VoidResponse delete() { * * @return A response containing a {@link QueueProperties} value which contains the metadata and approximate * messages count of the queue. - * @throws StorageErrorException If the queue doesn't exist + * @throws StorageException If the queue doesn't exist */ - public Response getProperties() { - return client.getProperties().block(); + public QueueProperties getProperties() { + return getPropertiesWithResponse(null, Context.NONE).getValue(); + } + + /** + * Retrieves metadata and approximate message count of the queue. + * + *

    Code Samples

    + * + *

    Get the properties of the queue

    + * + * {@codesnippet com.azure.storage.queue.queueClient.getPropertiesWithResponse#duration-context} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout + * concludes a {@link RuntimeException} will be thrown. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing a {@link QueueProperties} value which contains the metadata and approximate + * messages count of the queue. + * @throws StorageException If the queue doesn't exist + * @throws RuntimeException if the operation doesn't complete before the timeout concludes. + */ + public Response getPropertiesWithResponse(Duration timeout, Context context) { + Mono> response = client.getPropertiesWithResponse(context); + return Utility.blockWithOptionalTimeout(response, timeout); } /** @@ -151,11 +212,41 @@ public Response getProperties() { * Azure Docs.

    * * @param metadata Metadata to set on the queue + * @throws StorageException If the queue doesn't exist + */ + public void setMetadata(Map metadata) { + setMetadataWithResponse(metadata, null, Context.NONE); + } + + /** + * Sets the metadata of the queue. + * + * Passing in a {@code null} value for metadata will clear the metadata associated with the queue. + * + *

    Code Samples

    + * + *

    Set the queue's metadata to "queue:metadataMap"

    + * + * {@codesnippet com.azure.storage.queue.queueClient.setMetadataWithResponse#map-duration-context} + * + *

    Clear the queue's metadata

    + * + * {@codesnippet com.azure.storage.queue.queueClient.clearMetadataWithResponse#map-duration-context} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param metadata Metadata to set on the queue + * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout + * concludes a {@link RuntimeException} will be thrown. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response that only contains headers and response status code - * @throws StorageErrorException If the queue doesn't exist + * @throws StorageException If the queue doesn't exist + * @throws RuntimeException if the operation doesn't complete before the timeout concludes. */ - public VoidResponse setMetadata(Map metadata) { - return client.setMetadata(metadata).block(); + public VoidResponse setMetadataWithResponse(Map metadata, Duration timeout, Context context) { + Mono response = client.setMetadataWithResponse(metadata, context); + return Utility.blockWithOptionalTimeout(response, timeout); } /** @@ -171,10 +262,10 @@ public VoidResponse setMetadata(Map metadata) { * Azure Docs.

    * * @return The stored access policies specified on the queue. - * @throws StorageErrorException If the queue doesn't exist + * @throws StorageException If the queue doesn't exist */ - public Iterable getAccessPolicy() { - return client.getAccessPolicy().toIterable(); + public PagedIterable getAccessPolicy() { + return new PagedIterable<>(client.getAccessPolicy()); } /** @@ -184,18 +275,44 @@ public Iterable getAccessPolicy() { * *

    Set a read only stored access policy

    * - * {@codesnippet com.azure.storage.queue.queueClient.setAccessPolicy} + * {@codesnippet com.azure.storage.queue.QueueClient.setAccessPolicy#List} * *

    For more information, see the * Azure Docs.

    * * @param permissions Access policies to set on the queue + * @throws StorageException If the queue doesn't exist, a stored access policy doesn't have all fields filled out, + * or the queue will have more than five policies. + */ + public void setAccessPolicy(List permissions) { + setAccessPolicyWithResponse(permissions, null, Context.NONE); + } + + /** + * Sets stored access policies on the queue. + * + *

    Code Samples

    + * + *

    Set a read only stored access policy

    + * + * {@codesnippet com.azure.storage.queue.queueClient.setAccessPolicyWithResponse#List-Duration-Context} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param permissions Access policies to set on the queue + * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout + * concludes a {@link RuntimeException} will be thrown. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response that only contains headers and response status code - * @throws StorageErrorException If the queue doesn't exist, a stored access policy doesn't have all fields filled out, + * @throws StorageException If the queue doesn't exist, a stored access policy doesn't have all fields filled out, * or the queue will have more than five policies. + * @throws RuntimeException if the operation doesn't complete before the timeout concludes. */ - public VoidResponse setAccessPolicy(List permissions) { - return client.setAccessPolicy(permissions).block(); + public VoidResponse setAccessPolicyWithResponse(List permissions, Duration timeout, + Context context) { + Mono response = client.setAccessPolicyWithResponse(permissions, context); + return Utility.blockWithOptionalTimeout(response, timeout); } /** @@ -210,11 +327,34 @@ public VoidResponse setAccessPolicy(List permissions) { *

    For more information, see the * Azure Docs.

    * + * @throws StorageException If the queue doesn't exist + */ + public void clearMessages() { + clearMessagesWithResponse(null, Context.NONE); + } + + /** + * Deletes all messages in the queue. + * + *

    Code Samples

    + * + *

    Clear the messages

    + * + * {@codesnippet com.azure.storage.queue.queueClient.clearMessagesWithResponse#duration-context} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout + * concludes a {@link RuntimeException} will be thrown. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response that only contains headers and response status code - * @throws StorageErrorException If the queue doesn't exist + * @throws StorageException If the queue doesn't exist + * @throws RuntimeException if the operation doesn't complete before the timeout concludes. */ - public VoidResponse clearMessages() { - return client.clearMessages().block(); + public VoidResponse clearMessagesWithResponse(Duration timeout, Context context) { + Mono response = client.clearMessagesWithResponse(context); + return Utility.blockWithOptionalTimeout(response, timeout); } /** @@ -230,13 +370,13 @@ public VoidResponse clearMessages() { * Azure Docs.

    * * @param messageText Message text - * @return A {@link EnqueuedMessage} value that contains the {@link EnqueuedMessage#messageId() messageId} and - * {@link EnqueuedMessage#popReceipt() popReceipt} that are used to interact with the message and other metadata + * @return A {@link EnqueuedMessage} value that contains the {@link EnqueuedMessage#getMessageId() messageId} and + * {@link EnqueuedMessage#getPopReceipt() popReceipt} that are used to interact with the message and other metadata * about the enqueued message. - * @throws StorageErrorException If the queue doesn't exist + * @throws StorageException If the queue doesn't exist */ - public Response enqueueMessage(String messageText) { - return enqueueMessage(messageText, Duration.ofSeconds(0), Duration.ofDays(7)); + public EnqueuedMessage enqueueMessage(String messageText) { + return enqueueMessageWithResponse(messageText, null, null, null, Context.NONE).getValue(); } /** @@ -246,29 +386,36 @@ public Response enqueueMessage(String messageText) { * *

    Add a message of "Hello, Azure" that has a timeout of 5 seconds

    * - * {@codesnippet com.azure.storage.queue.queueClient.enqueueMessage#string-duration-duration} + * {@codesnippet com.azure.storage.queue.QueueClient.enqueueMessageWithResponse#String-Duration-Duration-Duration-Context1} * *

    Add a message of "Goodbye, Azure" that has a time to live of 5 seconds

    * - * {@codesnippet com.azure.storage.queue.queueClient.enqueueMessageLiveTime#string-duration-duration} + * {@codesnippet com.azure.storage.queue.QueueClient.enqueueMessageWithResponse#String-Duration-Duration-Duration-Context2} * *

    For more information, see the * Azure Docs.

    * * @param messageText Message text - * @param visibilityTimeout Optional. The timeout period for how long the message is invisible in the queue in seconds. - * If unset the value will default to 0 and the message will be instantly visible. The timeout must be between 0 + * @param visibilityTimeout Optional. The timeout period for how long the message is invisible in the queue. If + * unset the value will default to 0 and the message will be instantly visible. The timeout must be between 0 * seconds and 7 days. - * @param timeToLive Optional. How long the message will stay alive in the queue in seconds. If unset the value will - * default to 7 days, if -1 is passed the message will not expire. The time to live must be -1 or any positive number. - * @return A {@link EnqueuedMessage} value that contains the {@link EnqueuedMessage#messageId() messageId} and - * {@link EnqueuedMessage#popReceipt() popReceipt} that are used to interact with the message and other metadata - * about the enqueued message. - * @throws StorageErrorException If the queue doesn't exist or the {@code visibilityTimeout} or {@code timeToLive} - * are outside of the allowed limits. + * @param timeToLive Optional. How long the message will stay alive in the queue. If unset the value will default to + * 7 days, if -1 is passed the message will not expire. The time to live must be -1 or any positive number. + * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout + * concludes a {@link RuntimeException} will be thrown. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link EnqueuedMessage} value that contains the {@link + * EnqueuedMessage#getMessageId() messageId} and {@link EnqueuedMessage#getPopReceipt() popReceipt} that are used to + * interact with the message and other metadata about the enqueued message. + * @throws StorageException If the queue doesn't exist or the {@code visibilityTimeout} or {@code timeToLive} are + * outside of the allowed limits. + * @throws RuntimeException if the operation doesn't complete before the timeout concludes. */ - public Response enqueueMessage(String messageText, Duration visibilityTimeout, Duration timeToLive) { - return client.enqueueMessage(messageText, visibilityTimeout, timeToLive).block(); + public Response enqueueMessageWithResponse(String messageText, Duration visibilityTimeout, + Duration timeToLive, Duration timeout, Context context) { + Mono> response = client.enqueueMessageWithResponse(messageText, + visibilityTimeout, timeToLive, context); + return Utility.blockWithOptionalTimeout(response, timeout); } /** @@ -283,17 +430,18 @@ public Response enqueueMessage(String messageText, Duration vis *

    For more information, see the * Azure Docs.

    * - * @return The first {@link DequeuedMessage} in the queue, it contains - * {@link DequeuedMessage#messageId() messageId} and {@link DequeuedMessage#popReceipt() popReceipt} used to interact - * with the message, additionally it contains other metadata about the message. - * @throws StorageErrorException If the queue doesn't exist + * @return The first {@link DequeuedMessage} in the queue, it contains {@link DequeuedMessage#getMessageId() + * messageId} and {@link DequeuedMessage#getPopReceipt() popReceipt} used to interact with the message, additionally + * it contains other metadata about the message. + * @throws StorageException If the queue doesn't exist */ - public Iterable dequeueMessages() { - return dequeueMessages(1, Duration.ofSeconds(30)); + public PagedIterable dequeueMessages() { + return dequeueMessages(1, Duration.ofSeconds(30), null, Context.NONE); } /** - * Retrieves up to the maximum number of messages from the queue and hides them from other operations for 30 seconds. + * Retrieves up to the maximum number of messages from the queue and hides them from other operations for 30 + * seconds. * *

    Code Samples

    * @@ -304,16 +452,16 @@ public Iterable dequeueMessages() { *

    For more information, see the * Azure Docs.

    * - * @param maxMessages Optional. Maximum number of messages to get, if there are less messages exist in the queue than requested - * all the messages will be returned. If left empty only 1 message will be retrieved, the allowed range is 1 to 32 - * messages. - * @return Up to {@code maxMessages} {@link DequeuedMessage DequeuedMessages} from the queue. Each DequeuedMessage contains - * {@link DequeuedMessage#messageId() messageId} and {@link DequeuedMessage#popReceipt() popReceipt} used to interact - * with the message and other metadata about the message. - * @throws StorageErrorException If the queue doesn't exist or {@code maxMessages} is outside of the allowed bounds + * @param maxMessages Optional. Maximum number of messages to get, if there are less messages exist in the queue + * than requested all the messages will be returned. If left empty only 1 message will be retrieved, the allowed + * range is 1 to 32 messages. + * @return Up to {@code maxMessages} {@link DequeuedMessage DequeuedMessages} from the queue. Each DequeuedMessage + * contains {@link DequeuedMessage#getMessageId() messageId} and {@link DequeuedMessage#getPopReceipt() popReceipt} + * used to interact with the message and other metadata about the message. + * @throws StorageException If the queue doesn't exist or {@code maxMessages} is outside of the allowed bounds */ - public Iterable dequeueMessages(Integer maxMessages) { - return dequeueMessages(maxMessages, Duration.ofSeconds(30)); + public PagedIterable dequeueMessages(Integer maxMessages) { + return dequeueMessages(maxMessages, Duration.ofSeconds(30), null, Context.NONE); } /** @@ -324,24 +472,30 @@ public Iterable dequeueMessages(Integer maxMessages) { * *

    Dequeue up to 5 messages and give them a 60 second timeout period

    * - * {@codesnippet com.azure.storage.queue.queueClient.dequeueMessages#integer-duration} + * {@codesnippet com.azure.storage.queue.queueClient.dequeueMessages#integer-duration-duration-context} * *

    For more information, see the * Azure Docs.

    * - * @param maxMessages Optional. Maximum number of messages to get, if there are less messages exist in the queue than requested - * all the messages will be returned. If left empty only 1 message will be retrieved, the allowed range is 1 to 32 - * messages. - * @param visibilityTimeout Optional. The timeout period for how long the message is invisible in the queue in seconds. - * If left empty the dequeued messages will be invisible for 30 seconds. The timeout must be between 1 second and 7 days. - * @return Up to {@code maxMessages} {@link DequeuedMessage DequeuedMessages} from the queue. Each DeqeuedMessage contains - * {@link DequeuedMessage#messageId() messageId} and {@link DequeuedMessage#popReceipt() popReceipt} used to interact - * with the message and other metadata about the message. - * @throws StorageErrorException If the queue doesn't exist or {@code maxMessages} or {@code visibilityTimeout} is + * @param maxMessages Optional. Maximum number of messages to get, if there are less messages exist in the queue + * than requested all the messages will be returned. If left empty only 1 message will be retrieved, the allowed + * range is 1 to 32 messages. + * @param visibilityTimeout Optional. The timeout period for how long the message is invisible in the queue. If left + * empty the dequeued messages will be invisible for 30 seconds. The timeout must be between 1 second and 7 days. + * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout + * concludes a {@link RuntimeException} will be thrown. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return Up to {@code maxMessages} {@link DequeuedMessage DequeuedMessages} from the queue. Each DeqeuedMessage + * contains {@link DequeuedMessage#getMessageId() messageId} and {@link DequeuedMessage#getPopReceipt() popReceipt} + * used to interact with the message and other metadata about the message. + * @throws StorageException If the queue doesn't exist or {@code maxMessages} or {@code visibilityTimeout} is * outside of the allowed bounds + * @throws RuntimeException if the operation doesn't complete before the timeout concludes. */ - public Iterable dequeueMessages(Integer maxMessages, Duration visibilityTimeout) { - return client.dequeueMessages(maxMessages, visibilityTimeout).toIterable(); + public PagedIterable dequeueMessages(Integer maxMessages, Duration visibilityTimeout, + Duration timeout, Context context) { + return new PagedIterable<>( + client.dequeueMessagesWithOptionalTimeout(maxMessages, visibilityTimeout, timeout, context)); } /** @@ -361,8 +515,8 @@ public Iterable dequeueMessages(Integer maxMessages, Duration v * * @return A {@link PeekedMessage} that contains metadata about the message. */ - public Iterable peekMessages() { - return peekMessages(null); + public PagedIterable peekMessages() { + return peekMessages(null, null, Context.NONE); } /** @@ -375,20 +529,24 @@ public Iterable peekMessages() { * *

    Peek up to the first five messages

    * - * {@codesnippet com.azure.storage.queue.queueClient.peekMessages#integer} + * {@codesnippet com.azure.storage.queue.queueClient.peekMessages#integer-duration-context} * *

    For more information, see the * Azure Docs.

    * - * @param maxMessages Optional. Maximum number of messages to peek, if there are less messages exist in the queue than requested - * all the messages will be peeked. If left empty only 1 message will be peeked, the allowed range is 1 to 32 - * messages. - * @return Up to {@code maxMessages} {@link PeekedMessage PeekedMessages} from the queue. Each PeekedMessage contains - * metadata about the message. - * @throws StorageErrorException If the queue doesn't exist or {@code maxMessages} is outside of the allowed bounds + * @param maxMessages Optional. Maximum number of messages to peek, if there are less messages exist in the queue + * than requested all the messages will be peeked. If left empty only 1 message will be peeked, the allowed range is + * 1 to 32 messages. + * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout + * concludes a {@link RuntimeException} will be thrown. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return Up to {@code maxMessages} {@link PeekedMessage PeekedMessages} from the queue. Each PeekedMessage + * contains metadata about the message. + * @throws StorageException If the queue doesn't exist or {@code maxMessages} is outside of the allowed bounds + * @throws RuntimeException if the operation doesn't complete before the timeout concludes. */ - public Iterable peekMessages(Integer maxMessages) { - return client.peekMessages(maxMessages).toIterable(); + public PagedIterable peekMessages(Integer maxMessages, Duration timeout, Context context) { + return new PagedIterable<>(client.peekMessagesWithOptionalTimeout(maxMessages, timeout, context)); } /** @@ -398,7 +556,7 @@ public Iterable peekMessages(Integer maxMessages) { * *

    Dequeue the first message and update it to "Hello again, Azure" and hide it for 5 seconds

    * - * {@codesnippet com.azure.storage.queue.queueClient.updateMessage} + * {@codesnippet com.azure.storage.queue.QueueClient.updateMessage#String-String-String-Duration} * *

    For more information, see the * Azure Docs.

    @@ -408,13 +566,49 @@ public Iterable peekMessages(Integer maxMessages) { * @param popReceipt Unique identifier that must match for the message to be updated * @param visibilityTimeout The timeout period for how long the message is invisible in the queue in seconds. The * timeout period must be between 1 second and 7 days. - * @return A {@link UpdatedMessage} that contains the new {@link UpdatedMessage#popReceipt() popReceipt} to interact - * with the message, additionally contains the updated metadata about the message. - * @throws StorageErrorException If the queue or messageId don't exist, the popReceipt doesn't match on the message, - * or the {@code visibilityTimeout} is outside the allowed bounds + * @return A {@link UpdatedMessage} that contains the new {@link UpdatedMessage#getPopReceipt() popReceipt} to + * interact with the message, additionally contains the updated metadata about the message. + * @throws StorageException If the queue or messageId don't exist, the popReceipt doesn't match on the message, or + * the {@code visibilityTimeout} is outside the allowed bounds */ - public Response updateMessage(String messageText, String messageId, String popReceipt, Duration visibilityTimeout) { - return client.updateMessage(messageText, messageId, popReceipt, visibilityTimeout).block(); + public UpdatedMessage updateMessage(String messageText, String messageId, String popReceipt, + Duration visibilityTimeout) { + return updateMessageWithResponse(messageText, messageId, popReceipt, visibilityTimeout, null, Context.NONE) + .getValue(); + } + + /** + * Updates the specific message in the queue with a new message and resets the visibility timeout. + * + *

    Code Samples

    + * + *

    Dequeue the first message and update it to "Hello again, Azure" and hide it for 5 seconds

    + * + * {@codesnippet com.azure.storage.queue.QueueClient.updateMessageWithResponse#String-String-String-Duration-Duration-Context} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param messageText Updated value for the message + * @param messageId Id of the message to update + * @param popReceipt Unique identifier that must match for the message to be updated + * @param visibilityTimeout The timeout period for how long the message is invisible in the queue in seconds. The + * timeout period must be between 1 second and 7 days. + * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout + * concludes a {@link RuntimeException} will be thrown. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the {@link UpdatedMessage} that contains the new {@link + * UpdatedMessage#getPopReceipt() popReceipt} to interact with the message, additionally contains the updated + * metadata about the message. + * @throws StorageException If the queue or messageId don't exist, the popReceipt doesn't match on the message, or + * the {@code visibilityTimeout} is outside the allowed bounds + * @throws RuntimeException if the operation doesn't complete before the timeout concludes. + */ + public Response updateMessageWithResponse(String messageText, String messageId, String popReceipt, + Duration visibilityTimeout, Duration timeout, Context context) { + Mono> response = client.updateMessageWithResponse(messageText, messageId, + popReceipt, visibilityTimeout, context); + return Utility.blockWithOptionalTimeout(response, timeout); } /** @@ -424,17 +618,89 @@ public Response updateMessage(String messageText, String message * *

    Delete the first message

    * - * {@codesnippet com.azure.storage.queue.queueClient.deleteMessage} + * {@codesnippet com.azure.storage.queue.QueueClient.deleteMessage#String-String} * *

    For more information, see the * Azure Docs.

    * * @param messageId Id of the message to deleted * @param popReceipt Unique identifier that must match for the message to be deleted + * @throws StorageException If the queue or messageId don't exist or the popReceipt doesn't match on the message + */ + public void deleteMessage(String messageId, String popReceipt) { + deleteMessageWithResponse(messageId, popReceipt, null, Context.NONE); + } + + /** + * Deletes the specified message in the queue + * + *

    Code Samples

    + * + *

    Delete the first message

    + * + * {@codesnippet com.azure.storage.queue.QueueClient.deleteMessageWithResponse#String-String-Duration-Context} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param messageId Id of the message to deleted + * @param popReceipt Unique identifier that must match for the message to be deleted + * @param context Additional context that is passed through the Http pipeline during the service call. + * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout + * concludes a {@link RuntimeException} will be thrown. * @return A response that only contains headers and response status code - * @throws StorageErrorException If the queue or messageId don't exist or the popReceipt doesn't match on the message + * @throws StorageException If the queue or messageId don't exist or the popReceipt doesn't match on the message + * @throws RuntimeException if the operation doesn't complete before the timeout concludes. + */ + public VoidResponse deleteMessageWithResponse(String messageId, String popReceipt, Duration timeout, + Context context) { + Mono response = client.deleteMessageWithResponse(messageId, popReceipt, context); + 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 VoidResponse deleteMessage(String messageId, String popReceipt) { - return client.deleteMessage(messageId, popReceipt).block(); + 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); } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClientBuilder.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClientBuilder.java index 944bba023606..df2da7acd3e5 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClientBuilder.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClientBuilder.java @@ -2,47 +2,32 @@ // Licensed under the MIT License. package com.azure.storage.queue; -import com.azure.core.credentials.TokenCredential; -import com.azure.core.http.HttpClient; import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLoggingPolicy; -import com.azure.core.http.policy.HttpPipelinePolicy; -import com.azure.core.http.policy.RequestIdPolicy; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; +import com.azure.core.implementation.annotation.ServiceClientBuilder; import com.azure.core.implementation.util.ImplUtils; -import com.azure.core.util.configuration.Configuration; -import com.azure.core.util.configuration.ConfigurationManager; import com.azure.core.util.logging.ClientLogger; import com.azure.storage.common.Utility; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.common.policy.SASTokenCredentialPolicy; -import com.azure.storage.common.policy.SharedKeyCredentialPolicy; +import com.azure.storage.queue.implementation.AzureQueueStorageBuilder; +import com.azure.storage.queue.implementation.AzureQueueStorageImpl; import java.net.MalformedURLException; import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; import java.util.Map; import java.util.Objects; /** - * This class provides a fluent builder API to help aid the configuration and instantiation of the {@link QueueClient QueueClients} - * and {@link QueueAsyncClient QueueAsyncClients}, calling {@link QueueClientBuilder#buildClient() buildClient} constructs an - * instance of QueueClient and calling {@link QueueClientBuilder#buildAsyncClient() buildAsyncClient} constructs an instance of - * QueueAsyncClient. + * This class provides a fluent builder API to help aid the configuration and instantiation of the {@link QueueClient + * QueueClients} and {@link QueueAsyncClient QueueAsyncClients}, calling {@link QueueClientBuilder#buildClient() + * buildClient} constructs an instance of QueueClient and calling {@link QueueClientBuilder#buildAsyncClient() + * buildAsyncClient} constructs an instance of QueueAsyncClient. * - *

    The client needs the endpoint of the Azure Storage Queue service, name of the queue, and authorization credentials. + *

    The client needs the endpoint of the Azure Storage Queue service, name of the queue, and authorization + * credentials. * {@link QueueClientBuilder#endpoint(String) endpoint} gives the builder the endpoint and may give the builder the - * {@link QueueClientBuilder#queueName(String) queueName} and a {@link SASTokenCredential} that authorizes the client.

    + * {@link QueueClientBuilder#queueName(String) queueName} and a {@link SASTokenCredential} that authorizes the + * client.

    * *

    Instantiating a synchronous Queue Client with SAS token

    * {@codesnippet com.azure.storage.queue.queueClient.instantiation.sastoken} @@ -51,8 +36,8 @@ * {@codesnippet com.azure.storage.queue.queueAsyncClient.instantiation.sastoken} * *

    If the {@code endpoint} doesn't contain the queue name or {@code SASTokenCredential} they may be set using - * {@link QueueClientBuilder#queueName(String) queueName} and {@link QueueClientBuilder#credential(SASTokenCredential) credential} - * together with endpoint..

    + * {@link QueueClientBuilder#queueName(String) queueName} and {@link QueueClientBuilder#credential(SASTokenCredential) + * credential} together with endpoint..

    * *

    Instantiating a synchronous Queue Client with credential

    * {@codesnippet com.azure.storage.queue.queueClient.instantiation.credential} @@ -61,8 +46,8 @@ * {@codesnippet com.azure.storage.queue.queueAsyncClient.instantiation.credential} * *

    Another way to authenticate the client is using a {@link SharedKeyCredential}. To create a SharedKeyCredential - * a connection string from the Storage Queue service must be used. Set the SharedKeyCredential with - * {@link QueueClientBuilder#connectionString(String) connectionString}. If the builder has both a SASTokenCredential and + * a connection string from the Storage Queue service must be used. Set the SharedKeyCredential with {@link + * QueueClientBuilder#connectionString(String) connectionString}. If the builder has both a SASTokenCredential and * SharedKeyCredential the SharedKeyCredential will be preferred when authorizing requests sent to the service.

    * *

    Instantiating a synchronous Queue Client with connection string.

    @@ -76,48 +61,51 @@ * @see SASTokenCredential * @see SharedKeyCredential */ -public final class QueueClientBuilder { - private static final ClientLogger LOGGER = new ClientLogger(QueueClientBuilder.class); - private static final String ACCOUNT_NAME = "accountname"; - private final List policies; - - private URL endpoint; +@ServiceClientBuilder(serviceClients = {QueueClient.class, QueueAsyncClient.class}) +public final class QueueClientBuilder extends BaseQueueClientBuilder { + private final ClientLogger logger = new ClientLogger(QueueClientBuilder.class); private String queueName; - private SASTokenCredential sasTokenCredential; - private SharedKeyCredential sharedKeyCredential; - private TokenCredential bearerTokenCredential; - private HttpClient httpClient; - private HttpPipeline pipeline; - private HttpLogDetailLevel logLevel; - private RetryPolicy retryPolicy; - private Configuration configuration; /** - * Creates a builder instance that is able to configure and construct {@link QueueClient QueueClients} - * and {@link QueueAsyncClient QueueAsyncClients}. + * Creates a builder instance that is able to configure and construct {@link QueueClient QueueClients} and {@link + * QueueAsyncClient QueueAsyncClients}. */ public QueueClientBuilder() { - retryPolicy = new RetryPolicy(); - logLevel = HttpLogDetailLevel.NONE; - policies = new ArrayList<>(); + } + + private AzureQueueStorageImpl constructImpl() { + Objects.requireNonNull(queueName); + + if (!super.hasCredential()) { + throw logger.logExceptionAsError( + new IllegalArgumentException("Credentials are required for authorization")); + } - configuration = ConfigurationManager.getConfiguration(); + HttpPipeline pipeline = super.getPipeline(); + if (pipeline == null) { + pipeline = super.buildPipeline(); + } + + return new AzureQueueStorageBuilder() + .url(super.endpoint) + .pipeline(pipeline) + .build(); } /** - * Creates a {@link QueueClient} based on options set in the builder. Every time {@code buildClient()} is - * called a new instance of {@link QueueClient} is created. + * Creates a {@link QueueClient} based on options set in the builder. Every time {@code buildClient()} is called a + * new instance of {@link QueueClient} is created. * *

    - * If {@link QueueClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline}, - * {@link QueueClientBuilder#endpoint(String) endpoint}, and - * {@link QueueClientBuilder#queueName(String) queueName} are used to create the {@link QueueAsyncClient client}. - * All other builder settings are ignored. + * If {@link QueueClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline}, {@link + * QueueClientBuilder#endpoint(String) endpoint}, and {@link QueueClientBuilder#queueName(String) queueName} are + * used to create the {@link QueueAsyncClient client}. All other builder settings are ignored. *

    * * @return A QueueClient with the options set from the builder. * @throws NullPointerException If {@code endpoint} or {@code queueName} have not been set. - * @throws IllegalStateException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. + * @throws IllegalStateException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been + * set. */ public QueueClient buildClient() { return new QueueClient(buildAsyncClient()); @@ -128,57 +116,18 @@ public QueueClient buildClient() { * called a new instance of {@link QueueAsyncClient} is created. * *

    - * If {@link QueueClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline}, - * {@link QueueClientBuilder#endpoint(String) endpoint}, and - * {@link QueueClientBuilder#queueName(String) queueName} are used to create the {@link QueueAsyncClient client}. - * All other builder settings are ignored. + * If {@link QueueClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline}, {@link + * QueueClientBuilder#endpoint(String) endpoint}, and {@link QueueClientBuilder#queueName(String) queueName} are + * used to create the {@link QueueAsyncClient client}. All other builder settings are ignored. *

    * * @return A QueueAsyncClient with the options set from the builder. * @throws NullPointerException If {@code endpoint} or {@code queueName} have not been set. - * @throws IllegalArgumentException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. + * @throws IllegalArgumentException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been + * set. */ public QueueAsyncClient buildAsyncClient() { - Objects.requireNonNull(endpoint); - Objects.requireNonNull(queueName); - - if (sasTokenCredential == null && sharedKeyCredential == null && bearerTokenCredential == null) { - LOGGER.logExceptionAsError(new IllegalArgumentException("Credentials are required for authorization")); - return null; - } - - if (pipeline != null) { - return new QueueAsyncClient(endpoint, pipeline, queueName); - } - // Closest to API goes first, closest to wire goes last. - final List policies = new ArrayList<>(); - - policies.add(new UserAgentPolicy(QueueConfiguration.NAME, QueueConfiguration.VERSION, configuration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddDatePolicy()); - - if (sharedKeyCredential != null) { - policies.add(new SharedKeyCredentialPolicy(sharedKeyCredential)); - } else if (bearerTokenCredential != null) { - policies.add(new BearerTokenAuthenticationPolicy(bearerTokenCredential, String.format("%s/.default", endpoint))); - } else if (sasTokenCredential != null) { - policies.add(new SASTokenCredentialPolicy(sasTokenCredential)); - } - - HttpPolicyProviders.addBeforeRetryPolicies(policies); - - policies.add(retryPolicy); - - policies.addAll(this.policies); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(logLevel)); - - HttpPipeline pipeline = new HttpPipelineBuilder() - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .build(); - - return new QueueAsyncClient(endpoint, pipeline, queueName); + return new QueueAsyncClient(constructImpl(), queueName); } /** @@ -187,18 +136,21 @@ public QueueAsyncClient buildAsyncClient() { *

    The first path segment, if the endpoint contains path segments, will be assumed to be the name of the queue * that the client will interact with.

    * - *

    Query parameters of the endpoint will be parsed using {@link SASTokenCredential#fromQueryParameters(Map)} in an + *

    Query parameters of the endpoint will be parsed using {@link SASTokenCredential#fromQueryParameters(Map)} in + * an * attempt to generate a {@link SASTokenCredential} to authenticate requests sent to the service.

    * - * @param endpoint The URL of the Azure Storage Queue instance to send service requests to and receive responses from. + * @param endpoint The URL of the Azure Storage Queue instance to send service requests to and receive responses + * from. * @return the updated QueueClientBuilder object * @throws IllegalArgumentException If {@code endpoint} isn't a proper URL */ + @Override public QueueClientBuilder endpoint(String endpoint) { Objects.requireNonNull(endpoint); try { URL fullURL = new URL(endpoint); - this.endpoint = new URL(fullURL.getProtocol() + "://" + fullURL.getHost()); + this.endpoint = fullURL.getProtocol() + "://" + fullURL.getHost(); // Attempt to get the queue name from the URL passed String[] pathSegments = fullURL.getPath().split("/", 2); @@ -207,14 +159,15 @@ public QueueClientBuilder endpoint(String endpoint) { } // Attempt to get the SAS token from the URL passed - this.sasTokenCredential = SASTokenCredential.fromQueryParameters(Utility.parseQueryString(fullURL.getQuery())); - if (this.sasTokenCredential != null) { - this.sharedKeyCredential = null; - this.bearerTokenCredential = null; + SASTokenCredential sasTokenCredential = SASTokenCredential + .fromQueryParameters(Utility.parseQueryString(fullURL.getQuery())); + if (sasTokenCredential != null) { + super.credential(sasTokenCredential); } } catch (MalformedURLException ex) { - LOGGER.logExceptionAsError(new IllegalArgumentException("The Azure Storage Queue endpoint url is malformed. Endpoint: " + endpoint)); - return null; + throw logger.logExceptionAsError( + new IllegalArgumentException("The Azure Storage Queue endpoint url is malformed. Endpoint: " + + endpoint)); } return this; @@ -231,141 +184,4 @@ public QueueClientBuilder queueName(String queueName) { this.queueName = Objects.requireNonNull(queueName); return this; } - - /** - * Sets the {@link SASTokenCredential} used to authenticate requests sent to the Queue. - * - * @param credential SAS token credential generated from the Storage account that authorizes requests - * @return the updated QueueClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null}. - */ - public QueueClientBuilder credential(SASTokenCredential credential) { - this.sasTokenCredential = Objects.requireNonNull(credential); - this.sharedKeyCredential = null; - this.bearerTokenCredential = null; - return this; - } - - /** - * Sets the {@link SharedKeyCredential} used to authenticate requests sent to the Queue. - * - * @param credential Shared key credential can retrieve from the Storage account that authorizes requests - * @return the updated QueueServiceClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null}. - */ - public QueueClientBuilder credential(SharedKeyCredential credential) { - this.sharedKeyCredential = Objects.requireNonNull(credential); - this.sasTokenCredential = null; - this.bearerTokenCredential = null; - return this; - } - - /** - * Sets the {@link TokenCredential} used to authenticate requests sent to the Queue service. - * @param credential authorization credential - * @return the updated QueueServiceClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null} - */ - public QueueClientBuilder credential(TokenCredential credential) { - this.bearerTokenCredential = Objects.requireNonNull(credential); - this.sharedKeyCredential = null; - this.sasTokenCredential = null; - return this; - } - - /** - * Creates a {@link SharedKeyCredential} from the {@code connectionString} used to authenticate requests sent to the - * Queue service. - * - * @param connectionString Connection string from the Access Keys section in the Storage account - * @return the updated QueueClientBuilder object - * @throws NullPointerException If {@code connectionString} is {@code null}. - */ - public QueueClientBuilder connectionString(String connectionString) { - Objects.requireNonNull(connectionString); - this.sharedKeyCredential = SharedKeyCredential.fromConnectionString(connectionString); - getEndPointFromConnectionString(connectionString); - return this; - } - - private void getEndPointFromConnectionString(String connectionString) { - HashMap connectionStringPieces = new HashMap<>(); - for (String connectionStringPiece : connectionString.split(";")) { - String[] kvp = connectionStringPiece.split("=", 2); - connectionStringPieces.put(kvp[0].toLowerCase(Locale.ROOT), kvp[1]); - } - String accountName = connectionStringPieces.get(ACCOUNT_NAME); - try { - this.endpoint = new URL(String.format("https://%s.queue.core.windows.net", accountName)); - } catch (MalformedURLException e) { - LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("There is no valid account for the connection string. " - + "Connection String: %s", connectionString))); - } - } - - /** - * Sets the HTTP client to use for sending and receiving requests to and from the service. - * - * @param httpClient The HTTP client to use for requests. - * @return The updated QueueClientBuilder object. - * @throws NullPointerException If {@code httpClient} is {@code null}. - */ - public QueueClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = Objects.requireNonNull(httpClient); - return this; - } - - /** - * Adds a policy to the set of existing policies that are executed after the {@link RetryPolicy}. - * - * @param pipelinePolicy The retry policy for service requests. - * @return The updated QueueClientBuilder object. - * @throws NullPointerException If {@code pipelinePolicy} is {@code null}. - */ - public QueueClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { - Objects.requireNonNull(pipelinePolicy); - this.policies.add(pipelinePolicy); - return this; - } - - /** - * Sets the logging level for HTTP requests and responses. - * - * @param logLevel The amount of logging output when sending and receiving HTTP requests/responses. - * @return The updated QueueClientBuilder object. - */ - public QueueClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { - this.logLevel = logLevel; - return this; - } - - /** - * Sets the HTTP pipeline to use for the service client. - * - * If {@code pipeline} is set, all other settings are ignored, aside from {@link QueueClientBuilder#endpoint(String) endpoint} - * and {@link QueueClientBuilder#queueName(String) queueName} when building clients. - * - * @param pipeline The HTTP pipeline to use for sending service requests and receiving responses. - * @return The updated QueueClientBuilder object. - * @throws NullPointerException If {@code pipeline} is {@code null}. - */ - public QueueClientBuilder pipeline(HttpPipeline pipeline) { - Objects.requireNonNull(pipeline); - this.pipeline = pipeline; - return this; - } - - /** - * Sets the configuration store that is used during construction of the service client. - * - * The default configuration store is a clone of the {@link ConfigurationManager#getConfiguration() global - * configuration store}, use {@link Configuration#NONE} to bypass using configuration settings during construction. - * - * @param configuration The configuration store used to - * @return The updated QueueClientBuilder object. - */ - public QueueClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueConfiguration.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueConfiguration.java index 2f7e97180b8b..10c69b4cd235 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueConfiguration.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueConfiguration.java @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. + package com.azure.storage.queue; /* @@ -8,5 +9,5 @@ class QueueConfiguration { //TODO: Eventually remove these hardcoded strings with https://github.com/Azure/azure-sdk-for-java/issues/3141 static final String NAME = "azure-storage-queue"; - static final String VERSION = "12.0.0-preview.3"; + static final String VERSION = "12.0.0-preview.4"; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueSASPermission.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueSASPermission.java new file mode 100644 index 000000000000..37eaf6e2d6e2 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueSASPermission.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.queue; + +import com.azure.storage.common.SR; + +import java.util.Locale; + +/** + * This is a helper class to construct a string representing the permissions granted by a ServiceSAS to a queue. 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 a {@link + * QueueServiceSASSignatureValues} 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 QueueSASPermission { + + private boolean read; + + private boolean add; + + private boolean update; + + private boolean process; + + /** + * Initializes a {@code QueueSASPermission} object with all fields set to false. + */ + public QueueSASPermission() { + } + + /** + * Creates a {@code QueueSASPermission} 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 QueueSASPermission}. + * @return A {@code QueueSASPermission} generated from the given {@code String}. + * @throws IllegalArgumentException If {@code permString} contains a character other than r, a, u, or p. + */ + public static QueueSASPermission parse(String permString) { + QueueSASPermission permissions = new QueueSASPermission(); + + for (int i = 0; i < permString.length(); i++) { + char c = permString.charAt(i); + switch (c) { + case 'r': + permissions.read = true; + break; + case 'a': + permissions.add = true; + break; + case 'u': + permissions.update = true; + break; + case 'p': + permissions.process = true; + break; + default: + throw new IllegalArgumentException( + String.format(Locale.ROOT, SR.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, + "Permissions", permString, c)); + } + } + return permissions; + } + + /** + * @return the read permission status. + */ + public boolean getRead() { + return read; + } + + /** + * Sets the read permission status. + * + * @param read Permission status to set + * @return the updated QueueSASPermission object. + */ + public QueueSASPermission setRead(boolean read) { + this.read = read; + return this; + } + + /** + * @return the add permission status. + */ + public boolean getAdd() { + return add; + } + + /** + * Sets the add permission status. + * + * @param add Permission status to set + * @return the updated QueueSASPermission object. + */ + public QueueSASPermission setAdd(boolean add) { + this.add = add; + return this; + } + + /** + * @return the update permission status. + */ + public boolean getUpdate() { + return update; + } + + /** + * Sets the update permission status. + * + * @param update Permission status to set + * @return the updated QueueSASPermission object. + */ + public QueueSASPermission setUpdate(boolean update) { + this.update = update; + return this; + } + + /** + * @return the process permission status. + */ + public boolean getProcess() { + return process; + } + + /** + * Sets the process permission status. + * + * @param process Permission status to set + * @return the updated QueueSASPermission object. + */ + public QueueSASPermission setProcess(boolean process) { + this.process = process; + return this; + } + + /** + * Converts the given permissions to a {@code String}. Using this method will guarantee the permissions are in an + * order accepted by the service. + * + * @return A {@code String} which represents the {@code QueueSASPermission}. + */ + @Override + public String toString() { + // The order of the characters should be as specified here to ensure correctness: + // https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas + + final StringBuilder builder = new StringBuilder(); + + if (this.read) { + builder.append('r'); + } + + if (this.add) { + builder.append('a'); + } + + if (this.update) { + builder.append('u'); + } + + if (this.process) { + builder.append('p'); + } + + return builder.toString(); + } +} 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 5c5a78f2dc0c..408cefb50530 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,38 +2,51 @@ // Licensed under the MIT License. package com.azure.storage.queue; -import com.azure.core.http.HttpPipeline; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.implementation.http.PagedResponseBase; +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.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.queue.implementation.AzureQueueStorageBuilder; import com.azure.storage.queue.implementation.AzureQueueStorageImpl; import com.azure.storage.queue.models.CorsRule; import com.azure.storage.queue.models.ListQueuesIncludeType; -import com.azure.storage.queue.models.ListQueuesSegmentResponse; import com.azure.storage.queue.models.QueueItem; import com.azure.storage.queue.models.QueuesSegmentOptions; -import com.azure.storage.queue.models.ServicesListQueuesSegmentResponse; -import com.azure.storage.queue.models.StorageErrorException; +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.Flux; import reactor.core.publisher.Mono; import java.net.MalformedURLException; import java.net.URL; +import java.time.Duration; +import java.time.OffsetDateTime; 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; /** * This class provides a client that contains all the operations for interacting with a queue account in Azure Storage. - * Operations allowed by the client are creating, listing, and deleting queues, retrieving and updating properties of the account, - * and retrieving statistics of the account. + * Operations allowed by the client are creating, listing, and deleting queues, retrieving and updating properties of + * the account, and retrieving statistics of the account. * *

    Instantiating an Asynchronous Queue Service Client

    * @@ -47,20 +60,16 @@ * @see SASTokenCredential */ public final class QueueServiceAsyncClient { - private static final ClientLogger LOGGER = new ClientLogger(QueueServiceAsyncClient.class); + private final ClientLogger logger = new ClientLogger(QueueServiceAsyncClient.class); private final AzureQueueStorageImpl client; /** - * Creates a QueueServiceAsyncClient that sends requests to the storage account at {@code endpoint}. - * Each service call goes through the {@code httpPipeline}. + * Creates a QueueServiceAsyncClient from the passed {@link AzureQueueStorageImpl implementation client}. * - * @param endpoint URL for the Storage Queue service - * @param httpPipeline HttpPipeline that the HTTP requests and response flow through + * @param azureQueueStorage Client that interacts with the service interfaces. */ - QueueServiceAsyncClient(URL endpoint, HttpPipeline httpPipeline) { - this.client = new AzureQueueStorageBuilder().pipeline(httpPipeline) - .url(endpoint.toString()) - .build(); + QueueServiceAsyncClient(AzureQueueStorageImpl azureQueueStorage) { + this.client = azureQueueStorage; } /** @@ -71,8 +80,8 @@ public URL getQueueServiceUrl() { try { return new URL(client.getUrl()); } catch (MalformedURLException ex) { - LOGGER.error("Queue Service URL is malformed"); - throw new RuntimeException("Storage account URL is malformed"); + logger.error("Queue Service URL is malformed"); + throw logger.logExceptionAsError(new RuntimeException("Storage account URL is malformed")); } } @@ -89,8 +98,8 @@ public QueueAsyncClient getQueueAsyncClient(String queueName) { } /** - * Creates a queue in the storage account with the specified name and returns a QueueAsyncClient to interact - * with it. + * Creates a queue in the storage account with the specified name and returns a QueueAsyncClient to interact with + * it. * *

    Code Samples

    * @@ -99,11 +108,11 @@ public QueueAsyncClient getQueueAsyncClient(String queueName) { * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.createQueue#string} * * @param queueName Name of the queue - * @return A response containing the QueueAsyncClient and the status of creating the queue - * @throws StorageErrorException If a queue with the same name and different metadata already exists + * @return The {@link QueueAsyncClient QueueAsyncClient} + * @throws StorageException If a queue with the same name and different metadata already exists */ - public Mono> createQueue(String queueName) { - return createQueue(queueName, null); + public Mono createQueue(String queueName) { + return createQueueWithResponse(queueName, null).flatMap(FluxUtil::toMono); } /** @@ -114,17 +123,23 @@ public Mono> createQueue(String queueName) { * *

    Create the queue "test" with metadata "queue:metadata"

    * - * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.createQueue#string-map} + * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.createQueueWithResponse#string-map} * * @param queueName Name of the queue * @param metadata Metadata to associate with the queue - * @return A response containing the QueueAsyncClient and the status of creating the queue - * @throws StorageErrorException If a queue with the same name and different metadata already exists + * @return A response containing the {@link QueueAsyncClient QueueAsyncClient} and the status of creating the queue + * @throws StorageException If a queue with the same name and different metadata already exists */ - public Mono> createQueue(String queueName, Map metadata) { + public Mono> createQueueWithResponse(String queueName, Map metadata) { + Objects.requireNonNull(queueName); + return withContext(context -> createQueueWithResponse(queueName, metadata, context)); + } + + Mono> createQueueWithResponse(String queueName, Map metadata, + Context context) { QueueAsyncClient queueAsyncClient = new QueueAsyncClient(client, queueName); - return queueAsyncClient.create(metadata) + return postProcessResponse(queueAsyncClient.createWithResponse(metadata, context)) .map(response -> new SimpleResponse<>(response, queueAsyncClient)); } @@ -138,11 +153,32 @@ public Mono> createQueue(String queueName, Map deleteQueue(String queueName) { + return deleteQueueWithResponse(queueName).flatMap(FluxUtil::toMono); + } + + /** + * Deletes a queue in the storage account + * + *

    Code Samples

    + * + *

    Delete the queue "test"

    + * + * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.deleteQueueWithResponse#string} + * + * @param queueName Name of the queue * @return A response that only contains headers and response status code - * @throws StorageErrorException If the queue doesn't exist + * @throws StorageException If the queue doesn't exist */ - public Mono deleteQueue(String queueName) { - return new QueueAsyncClient(client, queueName).delete(); + public Mono deleteQueueWithResponse(String queueName) { + return withContext(context -> deleteQueueWithResponse(queueName, context)); + } + + Mono deleteQueueWithResponse(String queueName, Context context) { + return new QueueAsyncClient(client, queueName).deleteWithResponse(context); } /** @@ -159,21 +195,21 @@ public Mono deleteQueue(String queueName) { * * @return {@link QueueItem Queues} in the storage account */ - public Flux listQueues() { - return listQueues(null, null); + public PagedFlux listQueues() { + return listQueuesWithOptionalTimeout(null, null, null, Context.NONE); } /** * Lists the queues in the storage account that pass the filter. * - * Pass true to {@link QueuesSegmentOptions#includeMetadata(boolean) includeMetadata} to have metadata returned for - * the queues. + * Pass true to {@link QueuesSegmentOptions#setIncludeMetadata(boolean) includeMetadata} to have metadata returned + * for the queues. * *

    Code Samples

    * *

    List all queues that begin with "azure"

    * - * {@codesnippet com.azure.storage.queue.queueServiceClient.listQueues#queueSergmentOptions} + * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.listQueues#queueSergmentOptions} * *

    For more information, see the * Azure Docs.

    @@ -181,60 +217,67 @@ public Flux listQueues() { * @param options Options for listing queues * @return {@link QueueItem Queues} in the storage account that satisfy the filter requirements */ - public Flux listQueues(QueuesSegmentOptions options) { - return listQueues(null, options); + public PagedFlux listQueues(QueuesSegmentOptions options) { + return listQueuesWithOptionalTimeout(null, options, null, Context.NONE); } /** * Lists the queues in the storage account that pass the filter starting at the specified marker. * - * Pass true to {@link QueuesSegmentOptions#includeMetadata(boolean) includeMetadata} to have metadata returned for - * the queues. + * Pass true to {@link QueuesSegmentOptions#setIncludeMetadata(boolean) includeMetadata} to have metadata returned + * for the queues. * * @param marker Starting point to list the queues * @param options Options for listing queues + * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout + * concludes a {@link RuntimeException} will be thrown. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return {@link QueueItem Queues} in the storage account that satisfy the filter requirements */ - Flux listQueues(String marker, QueuesSegmentOptions options) { - String prefix = null; - Integer maxResults = null; + PagedFlux listQueuesWithOptionalTimeout(String marker, QueuesSegmentOptions options, Duration timeout, + Context context) { + final String prefix = (options != null) ? options.getPrefix() : null; + final Integer maxResults = (options != null) ? options.getMaxResults() : null; final List include = new ArrayList<>(); if (options != null) { - prefix = options.prefix(); - maxResults = options.maxResults(); - if (options.includeMetadata()) { + if (options.isIncludeMetadata()) { include.add(ListQueuesIncludeType.fromString(ListQueuesIncludeType.METADATA.toString())); } } - Mono result = client.services() - .listQueuesSegmentWithRestResponseAsync(prefix, marker, maxResults, include, null, null, Context.NONE); - - return result.flatMapMany(response -> extractAndFetchQueues(response, include, Context.NONE)); - } - - /* - * Helper function used to auto-enumerate through paged responses - */ - private Flux listQueues(ServicesListQueuesSegmentResponse response, List include, Context context) { - ListQueuesSegmentResponse value = response.value(); - Mono result = client.services() - .listQueuesSegmentWithRestResponseAsync(value.prefix(), value.nextMarker(), value.maxResults(), include, null, null, context); + Function>> retriever = + nextMarker -> postProcessResponse(Utility.applyOptionalTimeout(this.client.services() + .listQueuesSegmentWithRestResponseAsync(prefix, nextMarker, maxResults, include, + null, null, context), timeout) + .map(response -> new PagedResponseBase<>(response.getRequest(), + response.getStatusCode(), + response.getHeaders(), + response.getValue().getQueueItems(), + response.getValue().getNextMarker(), + response.getDeserializedHeaders()))); - return result.flatMapMany(r -> extractAndFetchQueues(r, include, context)); + return new PagedFlux<>(() -> retriever.apply(marker), retriever); } - /* - * Helper function used to auto-enumerate though paged responses + /** + * Retrieves the properties of the storage account's Queue service. The properties range from storage analytics and + * metric to CORS (Cross-Origin Resource Sharing). + * + *

    Code Samples

    + * + *

    Retrieve Queue service properties

    + * + * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.getProperties} + * + *

    For more information, see the + * Azure + * Docs.

    + * + * @return Storage account {@link StorageServiceProperties Queue service properties} */ - private Flux extractAndFetchQueues(ServicesListQueuesSegmentResponse response, List include, Context context) { - String nextPageLink = response.value().nextMarker(); - if (nextPageLink == null) { - return Flux.fromIterable(response.value().queueItems()); - } - - return Flux.fromIterable(response.value().queueItems()).concatWith(listQueues(response, include, context)); + public Mono getProperties() { + return getPropertiesWithResponse().flatMap(FluxUtil::toMono); } /** @@ -245,24 +288,30 @@ private Flux extractAndFetchQueues(ServicesListQueuesSegmentResponse * *

    Retrieve Queue service properties

    * - * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.getProperties} + * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.getPropertiesWithResponse} * *

    For more information, see the - * Azure Docs.

    + * Azure + * Docs.

    * - * @return Storage account Queue service properties + * @return A response containing the Storage account {@link StorageServiceProperties Queue service properties} */ - public Mono> getProperties() { - return client.services().getPropertiesWithRestResponseAsync(Context.NONE) - .map(response -> new SimpleResponse<>(response, response.value())); + public Mono> getPropertiesWithResponse() { + return withContext(this::getPropertiesWithResponse); + } + + Mono> getPropertiesWithResponse(Context context) { + return postProcessResponse(client.services().getPropertiesWithRestResponseAsync(context)) + .map(response -> new SimpleResponse<>(response, response.getValue())); } /** * Sets the properties for the storage account's Queue service. The properties range from storage analytics and * metric to CORS (Cross-Origin Resource Sharing). * - * To maintain the CORS in the Queue service pass a {@code null} value for {@link StorageServiceProperties#cors() CORS}. - * To disable all CORS in the Queue service pass an empty list for {@link StorageServiceProperties#cors() CORS}. + * To maintain the CORS in the Queue service pass a {@code null} value for {@link StorageServiceProperties#getCors() + * CORS}. To disable all CORS in the Queue service pass an empty list for {@link StorageServiceProperties#getCors() + * CORS}. * *

    Code Sample

    * @@ -275,24 +324,71 @@ public Mono> getProperties() { * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.setPropertiesEnableMetrics#storageServiceProperties} * *

    For more information, see the - * Azure Docs.

    + * Azure + * Docs.

    + * + * @param properties Storage account Queue service properties + * @return An empty response + * @throws StorageException When one of the following is true + *
      + *
    • A CORS rule is missing one of its fields
    • + *
    • More than five CORS rules will exist for the Queue service
    • + *
    • Size of all CORS rules exceeds 2KB
    • + *
    • + * Length of {@link CorsRule#getAllowedHeaders() allowed headers}, {@link CorsRule#getExposedHeaders() exposed + * headers}, or {@link CorsRule#getAllowedOrigins() allowed origins} exceeds 256 characters. + *
    • + *
    • {@link CorsRule#getAllowedMethods() Allowed methods} isn't DELETE, GET, HEAD, MERGE, POST, OPTIONS, or + * PUT
    • + *
    + */ + public Mono setProperties(StorageServiceProperties properties) { + return setPropertiesWithResponse(properties).flatMap(FluxUtil::toMono); + } + + /** + * Sets the properties for the storage account's Queue service. The properties range from storage analytics and + * metric to CORS (Cross-Origin Resource Sharing). + * + * To maintain the CORS in the Queue service pass a {@code null} value for {@link StorageServiceProperties#getCors() + * CORS}. To disable all CORS in the Queue service pass an empty list for {@link StorageServiceProperties#getCors() + * CORS}. + * + *

    Code Sample

    + * + *

    Clear CORS in the Queue service

    + * + * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.setPropertiesWithResponse#storageServiceProperties} + * + *

    Enable Minute and Hour Metrics

    + * + * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.setPropertiesWithResponseEnableMetrics#storageServiceProperties} + * + *

    For more information, see the + * Azure + * Docs.

    * * @param properties Storage account Queue service properties * @return A response that only contains headers and response status code - * @throws StorageErrorException When one of the following is true + * @throws StorageException When one of the following is true *
      - *
    • A CORS rule is missing one of its fields
    • - *
    • More than five CORS rules will exist for the Queue service
    • - *
    • Size of all CORS rules exceeds 2KB
    • - *
    • - * Length of {@link CorsRule#allowedHeaders() allowed headers}, {@link CorsRule#exposedHeaders() exposed headers}, - * or {@link CorsRule#allowedOrigins() allowed origins} exceeds 256 characters. - *
    • - *
    • {@link CorsRule#allowedMethods() Allowed methods} isn't DELETE, GET, HEAD, MERGE, POST, OPTIONS, or PUT
    • + *
    • A CORS rule is missing one of its fields
    • + *
    • More than five CORS rules will exist for the Queue service
    • + *
    • Size of all CORS rules exceeds 2KB
    • + *
    • + * Length of {@link CorsRule#getAllowedHeaders() allowed headers}, {@link CorsRule#getExposedHeaders() exposed + * headers}, or {@link CorsRule#getAllowedOrigins() allowed origins} exceeds 256 characters. + *
    • + *
    • {@link CorsRule#getAllowedMethods() Allowed methods} isn't DELETE, GET, HEAD, MERGE, POST, OPTIONS, or + * PUT
    • *
    */ - public Mono setProperties(StorageServiceProperties properties) { - return client.services().setPropertiesWithRestResponseAsync(properties, Context.NONE) + public Mono setPropertiesWithResponse(StorageServiceProperties properties) { + return withContext(context -> setPropertiesWithResponse(properties, context)); + } + + Mono setPropertiesWithResponse(StorageServiceProperties properties, Context context) { + return postProcessResponse(client.services().setPropertiesWithRestResponseAsync(properties, context)) .map(VoidResponse::new); } @@ -310,8 +406,77 @@ public Mono setProperties(StorageServiceProperties properties) { * * @return The geo replication information about the Queue service */ - public Mono> getStatistics() { - return client.services().getStatisticsWithRestResponseAsync(Context.NONE) - .map(response -> new SimpleResponse<>(response, response.value())); + public Mono getStatistics() { + return getStatisticsWithResponse().flatMap(FluxUtil::toMono); + } + + /** + * Retrieves the geo replication information about the Queue service. + * + *

    Code Samples

    + * + *

    Retrieve the geo replication information

    + * + * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.getStatisticsWithResponse} + * + *

    For more information, see the + * Azure Docs.

    + * + * @return A response containing the geo replication information about the Queue service + */ + public Mono> getStatisticsWithResponse() { + return withContext(this::getStatisticsWithResponse); + } + + 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 + */ + 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 + */ + 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 78ef5b204281..e8ae8981509b 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 @@ -2,24 +2,36 @@ // Licensed under the MIT License. package com.azure.storage.queue; +import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +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.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; 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.StorageErrorException; +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.net.URL; +import java.time.Duration; +import java.time.OffsetDateTime; import java.util.Map; /** * This class provides a client that contains all the operations for interacting with a queue account in Azure Storage. - * Operations allowed by the client are creating, listing, and deleting queues, retrieving and updating properties of the account, - * and retrieving statistics of the account. + * Operations allowed by the client are creating, listing, and deleting queues, retrieving and updating properties of + * the account, and retrieving statistics of the account. * *

    Instantiating an Synchronous Queue Service Client

    * @@ -74,31 +86,37 @@ public QueueClient getQueueClient(String queueName) { * * @param queueName Name of the queue * @return A response containing the QueueClient and the status of creating the queue - * @throws StorageErrorException If a queue with the same name and different metadata already exists + * @throws StorageException If a queue with the same name and different metadata already exists */ - public Response createQueue(String queueName) { - return createQueue(queueName, null); + public QueueClient createQueue(String queueName) { + return createQueueWithResponse(queueName, null, null, Context.NONE).getValue(); } /** - * Creates a queue in the storage account with the specified name and metadata and returns a QueueClient to - * interact with it. + * Creates a queue in the storage account with the specified name and metadata and returns a QueueClient to interact + * with it. * *

    Code Samples

    * *

    Create the queue "test" with metadata "queue:metadata"

    * - * {@codesnippet com.azure.storage.queue.queueServiceClient.createQueue#string-map} + * {@codesnippet com.azure.storage.queue.queueServiceClient.createQueueWithResponse#string-map-duration-context} * * @param queueName Name of the queue * @param metadata Metadata to associate with the queue + * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout + * concludes a {@link RuntimeException} will be thrown. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing the QueueClient and the status of creating the queue - * @throws StorageErrorException If a queue with the same name and different metadata already exists + * @throws StorageException If a queue with the same name and different metadata already exists + * @throws RuntimeException if the operation doesn't complete before the timeout concludes. */ - public Response createQueue(String queueName, Map metadata) { - Response response = client.createQueue(queueName, metadata).block(); + public Response createQueueWithResponse(String queueName, Map metadata, + Duration timeout, Context context) { - return new SimpleResponse<>(response, new QueueClient(response.value())); + Mono> asyncResponse = client.createQueueWithResponse(queueName, metadata, context); + Response response = Utility.blockWithOptionalTimeout(asyncResponse, timeout); + return new SimpleResponse<>(response, new QueueClient(response.getValue())); } /** @@ -111,11 +129,32 @@ public Response createQueue(String queueName, Map m * {@codesnippet com.azure.storage.queue.queueServiceClient.deleteQueue#string} * * @param queueName Name of the queue + * @throws StorageException If the queue doesn't exist + */ + public void deleteQueue(String queueName) { + deleteQueueWithResponse(queueName, null, Context.NONE); + } + + /** + * Deletes a queue in the storage account + * + *

    Code Samples

    + * + *

    Delete the queue "test"

    + * + * {@codesnippet com.azure.storage.queue.queueServiceClient.deleteQueueWithResponse#string-duration-context} + * + * @param queueName Name of the queue + * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout + * concludes a {@link RuntimeException} will be thrown. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response containing the status of deleting the queue - * @throws StorageErrorException If the queue doesn't exist + * @throws StorageException If the queue doesn't exist + * @throws RuntimeException if the operation doesn't complete before the timeout concludes. */ - public VoidResponse deleteQueue(String queueName) { - return client.deleteQueue(queueName).block(); + public VoidResponse deleteQueueWithResponse(String queueName, Duration timeout, Context context) { + Mono response = client.deleteQueueWithResponse(queueName, context); + return Utility.blockWithOptionalTimeout(response, timeout); } /** @@ -132,44 +171,52 @@ public VoidResponse deleteQueue(String queueName) { * * @return {@link QueueItem Queues} in the storage account */ - public Iterable listQueues() { - return listQueues(null, null); + public PagedIterable listQueues() { + return listQueues(null, null, Context.NONE); } /** * Lists the queues in the storage account that pass the filter. * - * Pass true to {@link QueuesSegmentOptions#includeMetadata(boolean) includeMetadata} to have metadata returned for - * the queues. + * Pass true to {@link QueuesSegmentOptions#setIncludeMetadata(boolean) includeMetadata} to have metadata returned + * for the queues. * *

    Code Samples

    * *

    List all queues that begin with "azure"

    * - * {@codesnippet com.azure.storage.queue.queueServiceClient.listQueues#queueSergmentOptions} + * {@codesnippet com.azure.storage.queue.queueServiceClient.listQueues#queueSergmentOptions-duration-context} * *

    For more information, see the * Azure Docs.

    * * @param options Options for listing queues + * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout + * concludes a {@link RuntimeException} will be thrown. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return {@link QueueItem Queues} in the storage account that satisfy the filter requirements + * @throws RuntimeException if the operation doesn't complete before the timeout concludes. */ - public Iterable listQueues(QueuesSegmentOptions options) { - return listQueues(null, options); + public PagedIterable listQueues(QueuesSegmentOptions options, Duration timeout, Context context) { + return listQueues(null, options, timeout, context); } /** * Lists the queues in the storage account that pass the filter starting at the specified marker. * - * Pass true to {@link QueuesSegmentOptions#includeMetadata(boolean) includeMetadata} to have metadata returned for - * the queues. + * Pass true to {@link QueuesSegmentOptions#setIncludeMetadata(boolean) includeMetadata} to have metadata returned + * for the queues. * * @param marker Starting point to list the queues * @param options Options for listing queues + * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout + * concludes a {@link RuntimeException} will be thrown. * @return {@link QueueItem Queues} in the storage account that satisfy the filter requirements + * @throws RuntimeException if the operation doesn't complete before the timeout concludes. */ - Iterable listQueues(String marker, QueuesSegmentOptions options) { - return client.listQueues(marker, options).toIterable(); + PagedIterable listQueues(String marker, QueuesSegmentOptions options, Duration timeout, + Context context) { + return new PagedIterable<>(client.listQueuesWithOptionalTimeout(marker, options, timeout, context)); } /** @@ -183,20 +230,47 @@ Iterable listQueues(String marker, QueuesSegmentOptions options) { * {@codesnippet com.azure.storage.queue.queueServiceClient.getProperties} * *

    For more information, see the - * Azure Docs.

    + * Azure + * Docs.

    * * @return Storage account Queue service properties */ - public Response getProperties() { - return client.getProperties().block(); + public StorageServiceProperties getProperties() { + return getPropertiesWithResponse(null, Context.NONE).getValue(); + } + + /** + * Retrieves the properties of the storage account's Queue service. The properties range from storage analytics and + * metric to CORS (Cross-Origin Resource Sharing). + * + *

    Code Samples

    + * + *

    Retrieve Queue service properties

    + * + * {@codesnippet com.azure.storage.queue.queueServiceClient.getPropertiesWithResponse#duration-context} + * + *

    For more information, see the + * Azure + * Docs.

    + * + * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout + * concludes a {@link RuntimeException} will be thrown. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the Storage account Queue service properties + * @throws RuntimeException if the operation doesn't complete before the timeout concludes. + */ + public Response getPropertiesWithResponse(Duration timeout, Context context) { + Mono> response = client.getPropertiesWithResponse(context); + return Utility.blockWithOptionalTimeout(response, timeout); } /** * Sets the properties for the storage account's Queue service. The properties range from storage analytics and * metric to CORS (Cross-Origin Resource Sharing). * - * To maintain the CORS in the Queue service pass a {@code null} value for {@link StorageServiceProperties#cors() CORS}. - * To disable all CORS in the Queue service pass an empty list for {@link StorageServiceProperties#cors() CORS}. + * To maintain the CORS in the Queue service pass a {@code null} value for {@link StorageServiceProperties#getCors() + * CORS}. To disable all CORS in the Queue service pass an empty list for {@link StorageServiceProperties#getCors() + * CORS}. * *

    Code Sample

    * @@ -209,24 +283,72 @@ public Response getProperties() { * {@codesnippet com.azure.storage.queue.queueServiceClient.setPropertiesEnableMetrics#storageServiceProperties} * *

    For more information, see the - * Azure Docs.

    + * Azure + * Docs.

    * * @param properties Storage account Queue service properties + * @throws StorageException When one of the following is true + *
      + *
    • A CORS rule is missing one of its fields
    • + *
    • More than five CORS rules will exist for the Queue service
    • + *
    • Size of all CORS rules exceeds 2KB
    • + *
    • + * Length of {@link CorsRule#getAllowedHeaders() allowed headers}, {@link CorsRule#getExposedHeaders() exposed + * headers}, or {@link CorsRule#getAllowedOrigins() allowedOrigins() allowed origins} exceeds 256 characters. + *
    • + *
    • {@link CorsRule#getAllowedMethods() Allowed methods} isn't DELETE, GET, HEAD, MERGE, POST, OPTIONS, or + * PUT
    • + *
    + */ + public void setProperties(StorageServiceProperties properties) { + setPropertiesWithResponse(properties, null, Context.NONE); + } + + /** + * Sets the properties for the storage account's Queue service. The properties range from storage analytics and + * metric to CORS (Cross-Origin Resource Sharing). + * + * To maintain the CORS in the Queue service pass a {@code null} value for {@link StorageServiceProperties#getCors() + * CORS}. To disable all CORS in the Queue service pass an empty list for {@link StorageServiceProperties#getCors() + * CORS}. + * + *

    Code Sample

    + * + *

    Clear CORS in the Queue service

    + * + * {@codesnippet com.azure.storage.queue.queueServiceClient.setPropertiesWithResponse#storageServiceProperties-duration-context} + * + *

    Enable Minute and Hour Metrics

    + * + * {@codesnippet com.azure.storage.queue.queueServiceClient.setPropertiesWithResponseEnableMetrics#storageServiceProperties-duration-context} + * + *

    For more information, see the + * Azure + * Docs.

    + * + * @param properties Storage account Queue service properties + * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout + * concludes a {@link RuntimeException} will be thrown. + * @param context Additional context that is passed through the Http pipeline during the service call. * @return A response that only contains headers and response status code - * @throws StorageErrorException When one of the following is true + * @throws StorageException When one of the following is true *
      - *
    • A CORS rule is missing one of its fields
    • - *
    • More than five CORS rules will exist for the Queue service
    • - *
    • Size of all CORS rules exceeds 2KB
    • - *
    • - * Length of {@link CorsRule#allowedHeaders() allowed headers}, {@link CorsRule#exposedHeaders() exposed headers}, - * or {@link CorsRule#allowedOrigins() allowed origins} exceeds 256 characters. - *
    • - *
    • {@link CorsRule#allowedMethods() Allowed methods} isn't DELETE, GET, HEAD, MERGE, POST, OPTIONS, or PUT
    • + *
    • A CORS rule is missing one of its fields
    • + *
    • More than five CORS rules will exist for the Queue service
    • + *
    • Size of all CORS rules exceeds 2KB
    • + *
    • + * Length of {@link CorsRule#getAllowedHeaders() allowed headers}, {@link CorsRule#getExposedHeaders() exposed + * headers}, or {@link CorsRule#getAllowedOrigins() allowed origins} exceeds 256 characters. + *
    • + *
    • {@link CorsRule#getAllowedMethods() Allowed methods} isn't DELETE, GET, HEAD, MERGE, POST, OPTIONS, or + * PUT
    • *
    + * @throws RuntimeException if the operation doesn't complete before the timeout concludes. */ - public VoidResponse setProperties(StorageServiceProperties properties) { - return client.setProperties(properties).block(); + public VoidResponse setPropertiesWithResponse(StorageServiceProperties properties, Duration timeout, + Context context) { + Mono response = client.setPropertiesWithResponse(properties, context); + return Utility.blockWithOptionalTimeout(response, timeout); } /** @@ -243,7 +365,73 @@ public VoidResponse setProperties(StorageServiceProperties properties) { * * @return The geo replication information about the Queue service */ - public Response getStatistics() { - return client.getStatistics().block(); + public StorageServiceStats getStatistics() { + return getStatisticsWithResponse(null, Context.NONE).getValue(); + } + + /** + * Retrieves the geo replication information about the Queue service. + * + *

    Code Samples

    + * + *

    Retrieve the geo replication information

    + * + * {@codesnippet com.azure.storage.queue.queueServiceClient.getStatisticsWithResponse#duration-context} + * + *

    For more information, see the + * Azure Docs.

    + * + * @param timeout An optional timeout applied to the operation. If a response is not returned before the timeout + * concludes a {@link RuntimeException} will be thrown. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A response containing the geo replication information about the Queue service + * @throws RuntimeException if the operation doesn't complete before the timeout concludes. + */ + public Response getStatisticsWithResponse(Duration timeout, Context context) { + 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/QueueServiceClientBuilder.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClientBuilder.java index a196de2964b3..9f48aee1b3a0 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClientBuilder.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClientBuilder.java @@ -2,45 +2,29 @@ // Licensed under the MIT License. package com.azure.storage.queue; -import com.azure.core.credentials.TokenCredential; -import com.azure.core.http.HttpClient; import com.azure.core.http.HttpPipeline; -import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLoggingPolicy; -import com.azure.core.http.policy.HttpPipelinePolicy; -import com.azure.core.http.policy.RequestIdPolicy; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; -import com.azure.core.util.configuration.Configuration; -import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.core.implementation.annotation.ServiceClientBuilder; import com.azure.core.util.logging.ClientLogger; import com.azure.storage.common.Utility; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.common.policy.SASTokenCredentialPolicy; -import com.azure.storage.common.policy.SharedKeyCredentialPolicy; +import com.azure.storage.queue.implementation.AzureQueueStorageBuilder; +import com.azure.storage.queue.implementation.AzureQueueStorageImpl; + import java.net.MalformedURLException; import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; import java.util.Map; import java.util.Objects; /** - * This class provides a fluent builder API to help aid the configuration and instantiation of the {@link QueueServiceClient queueServiceClients} - * and {@link QueueServiceAsyncClient queueServiceAsyncClients}, calling {@link QueueServiceClientBuilder#buildClient() buildClient} - * constructs an instance of QueueServiceClient and calling {@link QueueServiceClientBuilder#buildAsyncClient() buildAsyncClient} - * constructs an instance of QueueServiceAsyncClient. + * This class provides a fluent builder API to help aid the configuration and instantiation of the {@link + * QueueServiceClient queueServiceClients} and {@link QueueServiceAsyncClient queueServiceAsyncClients}, calling {@link + * QueueServiceClientBuilder#buildClient() buildClient} constructs an instance of QueueServiceClient and calling {@link + * QueueServiceClientBuilder#buildAsyncClient() buildAsyncClient} constructs an instance of QueueServiceAsyncClient. * - *

    The client needs the endpoint of the Azure Storage Queue service, name of the share, and authorization credential. - * {@link QueueServiceClientBuilder#endpoint(String) endpoint} gives the builder the endpoint and may give the builder the - * A {@link SASTokenCredential} that authorizes the client.

    + *

    The client needs the endpoint of the Azure Storage Queue service, name of the share, and authorization + * credential. {@link QueueServiceClientBuilder#endpoint(String) endpoint} gives the builder the endpoint and may give + * the builder the A {@link SASTokenCredential} that authorizes the client.

    * *

    Instantiating a synchronous Queue Service Client with SAS token

    * {@codesnippet com.azure.storage.queue.queueServiceClient.instantiation.sastoken} @@ -58,9 +42,9 @@ * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.instantiation.credential} * *

    Another way to authenticate the client is using a {@link SharedKeyCredential}. To create a SharedKeyCredential - * a connection string from the Storage Queue service must be used. Set the SharedKeyCredential with - * {@link QueueServiceClientBuilder#connectionString(String) connectionString}. If the builder has both a SASTokenCredential and - * SharedKeyCredential the SharedKeyCredential will be preferred when authorizing requests sent to the service.

    + * a connection string from the Storage Queue service must be used. Set the SharedKeyCredential with {@link + * QueueServiceClientBuilder#connectionString(String) connectionString}. If the builder has both a SASTokenCredential + * and SharedKeyCredential the SharedKeyCredential will be preferred when authorizing requests sent to the service.

    * *

    Instantiating a synchronous Queue Service Client with connection string.

    * {@codesnippet com.azure.storage.queue.queueServiceClient.instantiation.connectionstring} @@ -73,86 +57,51 @@ * @see SASTokenCredential * @see SharedKeyCredential */ -public final class QueueServiceClientBuilder { - private static final ClientLogger LOGGER = new ClientLogger(QueueServiceClientBuilder.class); - private static final String ACCOUNT_NAME = "accountname"; - private final List policies; - - private URL endpoint; - private SASTokenCredential sasTokenCredential; - private SharedKeyCredential sharedKeyCredential; - private TokenCredential bearerTokenCredential; - private HttpClient httpClient; - private HttpPipeline pipeline; - private HttpLogDetailLevel logLevel; - private RetryPolicy retryPolicy; - private Configuration configuration; +@ServiceClientBuilder(serviceClients = {QueueServiceClient.class, QueueServiceAsyncClient.class}) +public final class QueueServiceClientBuilder extends BaseQueueClientBuilder { + private final ClientLogger logger = new ClientLogger(QueueServiceClientBuilder.class); /** * Creates a builder instance that is able to configure and construct {@link QueueServiceClient QueueServiceClients} * and {@link QueueServiceAsyncClient QueueServiceAsyncClients}. */ public QueueServiceClientBuilder() { - retryPolicy = new RetryPolicy(); - logLevel = HttpLogDetailLevel.NONE; - policies = new ArrayList<>(); - configuration = ConfigurationManager.getConfiguration(); + } + + private AzureQueueStorageImpl constructImpl() { + if (!super.hasCredential()) { + throw logger.logExceptionAsError( + new IllegalArgumentException("Credentials are required for authorization")); + } + + HttpPipeline pipeline = super.getPipeline(); + if (pipeline == null) { + pipeline = super.buildPipeline(); + } + + return new AzureQueueStorageBuilder() + .url(super.endpoint) + .pipeline(pipeline) + .build(); } /** - * Creates a {@link QueueServiceAsyncClient} based on options set in the builder. Every time {@code buildAsyncClient()} is - * called a new instance of {@link QueueServiceAsyncClient} is created. + * Creates a {@link QueueServiceAsyncClient} based on options set in the builder. Every time + * {@code buildAsyncClient()} is called a new instance of {@link QueueServiceAsyncClient} is created. * *

    - * If {@link QueueServiceClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and - * {@link QueueServiceClientBuilder#endpoint(String) endpoint} are used to create the - * {@link QueueServiceAsyncClient client}. All other builder settings are ignored. + * If {@link QueueServiceClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and {@link + * QueueServiceClientBuilder#endpoint(String) endpoint} are used to create the {@link QueueServiceAsyncClient + * client}. All other builder settings are ignored. *

    * * @return A QueueServiceAsyncClient with the options set from the builder. * @throws NullPointerException If {@code endpoint} or {@code queueName} have not been set. - * @throws IllegalArgumentException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. + * @throws IllegalArgumentException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been + * set. */ public QueueServiceAsyncClient buildAsyncClient() { - Objects.requireNonNull(endpoint); - - if (sasTokenCredential == null && sharedKeyCredential == null && bearerTokenCredential == null) { - LOGGER.logExceptionAsError(new IllegalArgumentException("Credentials are required for authorization")); - return null; - } - - if (pipeline != null) { - return new QueueServiceAsyncClient(endpoint, pipeline); - } - // Closest to API goes first, closest to wire goes last. - final List policies = new ArrayList<>(); - - policies.add(new UserAgentPolicy(QueueConfiguration.NAME, QueueConfiguration.VERSION, configuration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddDatePolicy()); - - if (sharedKeyCredential != null) { - policies.add(new SharedKeyCredentialPolicy(sharedKeyCredential)); - } else if (bearerTokenCredential != null) { - policies.add(new BearerTokenAuthenticationPolicy(bearerTokenCredential, String.format("%s/.default", endpoint))); - } else if (sasTokenCredential != null) { - policies.add(new SASTokenCredentialPolicy(sasTokenCredential)); - } - - HttpPolicyProviders.addBeforeRetryPolicies(policies); - - policies.add(retryPolicy); - - policies.addAll(this.policies); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(logLevel)); - - HttpPipeline pipeline = new HttpPipelineBuilder() - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .build(); - - return new QueueServiceAsyncClient(endpoint, pipeline); + return new QueueServiceAsyncClient(constructImpl()); } /** @@ -160,14 +109,15 @@ public QueueServiceAsyncClient buildAsyncClient() { * called a new instance of {@link QueueServiceClient} is created. * *

    - * If {@link QueueServiceClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and - * {@link QueueServiceClientBuilder#endpoint(String) endpoint} are used to create the - * {@link QueueServiceClient client}. All other builder settings are ignored. + * If {@link QueueServiceClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and {@link + * QueueServiceClientBuilder#endpoint(String) endpoint} are used to create the {@link QueueServiceClient client}. + * All other builder settings are ignored. *

    * * @return A QueueServiceClient with the options set from the builder. * @throws NullPointerException If {@code endpoint} or {@code queueName} have not been set. - * @throws IllegalStateException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. + * @throws IllegalStateException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been + * set. */ public QueueServiceClient buildClient() { return new QueueServiceClient(buildAsyncClient()); @@ -177,165 +127,32 @@ public QueueServiceClient buildClient() { /** * Sets the endpoint for the Azure Storage Queue instance that the client will interact with. * - *

    Query parameters of the endpoint will be parsed using {@link SASTokenCredential#fromQueryParameters(Map)} in an - * attempt to generate a {@link SASTokenCredential} to authenticate requests sent to the service.

    + *

    Query parameters of the endpoint will be parsed using {@link SASTokenCredential#fromQueryParameters(Map)} in + * an attempt to generate a {@link SASTokenCredential} to authenticate requests sent to the service.

    * - * @param endpoint The URL of the Azure Storage Queue instance to send service requests to and receive responses from. + * @param endpoint The URL of the Azure Storage Queue instance to send service requests to and receive responses + * from. * @return the updated QueueServiceClientBuilder object * @throws IllegalArgumentException If {@code endpoint} isn't a proper URL */ + @Override public QueueServiceClientBuilder endpoint(String endpoint) { Objects.requireNonNull(endpoint); try { URL fullURL = new URL(endpoint); - this.endpoint = new URL(fullURL.getProtocol() + "://" + fullURL.getHost()); + super.endpoint = fullURL.getProtocol() + "://" + fullURL.getHost(); // Attempt to get the SAS token from the URL passed - this.sasTokenCredential = SASTokenCredential.fromQueryParameters(Utility.parseQueryString(fullURL.getQuery())); - if (this.sasTokenCredential != null) { - this.sharedKeyCredential = null; - this.bearerTokenCredential = null; + SASTokenCredential sasTokenCredential = SASTokenCredential + .fromQueryParameters(Utility.parseQueryString(fullURL.getQuery())); + if (sasTokenCredential != null) { + super.credential(sasTokenCredential); } } catch (MalformedURLException ex) { - LOGGER.logExceptionAsError(new IllegalArgumentException("The Azure Storage Queue endpoint url is malformed.")); - return null; + throw logger.logExceptionAsError( + new IllegalArgumentException("The Azure Storage Queue endpoint url is malformed.")); } return this; } - - /** - * Sets the {@link SASTokenCredential} used to authenticate requests sent to the Queue service. - * - * @param credential SAS token credential generated from the Storage account that authorizes requests - * @return the updated QueueServiceClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null}. - */ - public QueueServiceClientBuilder credential(SASTokenCredential credential) { - this.sasTokenCredential = Objects.requireNonNull(credential); - this.sharedKeyCredential = null; - this.bearerTokenCredential = null; - return this; - } - - /** - * Sets the {@link SharedKeyCredential} used to authenticate requests sent to the Queue service. - * - * @param credential Shared key credential can retrieve from the Storage account that authorizes requests - * @return the updated QueueServiceClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null}. - */ - public QueueServiceClientBuilder credential(SharedKeyCredential credential) { - this.sharedKeyCredential = Objects.requireNonNull(credential); - this.sasTokenCredential = null; - this.bearerTokenCredential = null; - return this; - } - - /** - * Sets the {@link TokenCredential} used to authenticate requests sent to the Queue service. - * @param credential authorization credential - * @return the updated QueueServiceClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null} - */ - public QueueServiceClientBuilder credential(TokenCredential credential) { - this.bearerTokenCredential = Objects.requireNonNull(credential); - this.sharedKeyCredential = null; - this.sasTokenCredential = null; - return this; - } - - /** - * Creates a {@link SharedKeyCredential} from the {@code connectionString} used to authenticate requests sent to the - * Queue service. - * - * @param connectionString Connection string from the Access Keys section in the Storage account - * @return the updated QueueServiceClientBuilder object - * @throws NullPointerException If {@code connectionString} is {@code null}. - */ - public QueueServiceClientBuilder connectionString(String connectionString) { - this.sharedKeyCredential = SharedKeyCredential.fromConnectionString(connectionString); - getEndPointFromConnectionString(connectionString); - return this; - } - - private void getEndPointFromConnectionString(String connectionString) { - HashMap connectionStringPieces = new HashMap<>(); - for (String connectionStringPiece : connectionString.split(";")) { - String[] kvp = connectionStringPiece.split("=", 2); - connectionStringPieces.put(kvp[0].toLowerCase(Locale.ROOT), kvp[1]); - } - String accountName = connectionStringPieces.get(ACCOUNT_NAME); - try { - this.endpoint = new URL(String.format("https://%s.queue.core.windows.net", accountName)); - } catch (MalformedURLException e) { - LOGGER.logExceptionAsError(new IllegalArgumentException(String.format("There is no valid account for the connection string. " - + "Connection String: %s", connectionString))); - } - } - - /** - * Sets the HTTP client to use for sending and receiving requests to and from the service. - * - * @param httpClient The HTTP client to use for requests. - * @return The updated QueueServiceClientBuilder object. - * @throws NullPointerException If {@code httpClient} is {@code null}. - */ - public QueueServiceClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /** - * Adds a policy to the set of existing policies that are executed after the {@link RetryPolicy}. - * - * @param pipelinePolicy The retry policy for service requests. - * @return The updated QueueServiceClientBuilder object. - * @throws NullPointerException If {@code pipelinePolicy} is {@code null}. - */ - public QueueServiceClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { - this.policies.add(pipelinePolicy); - return this; - } - - /** - * Sets the logging level for HTTP requests and responses. - * - * @param logLevel The amount of logging output when sending and receiving HTTP requests/responses. - * @return The updated QueueServiceClientBuilder object. - */ - public QueueServiceClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { - this.logLevel = logLevel; - return this; - } - - /** - * Sets the HTTP pipeline to use for the service client. - * - * If {@code pipeline} is set, all other settings are ignored, aside from {@link QueueServiceClientBuilder#endpoint(String) endpoint} - * when building clients. - * - * @param pipeline The HTTP pipeline to use for sending service requests and receiving responses. - * @return The updated QueueServiceClientBuilder object. - * @throws NullPointerException If {@code pipeline} is {@code null}. - */ - public QueueServiceClientBuilder pipeline(HttpPipeline pipeline) { - Objects.requireNonNull(pipeline); - this.pipeline = pipeline; - return this; - } - - /** - * Sets the configuration store that is used during construction of the service client. - * - * The default configuration store is a clone of the {@link ConfigurationManager#getConfiguration() global - * configuration store}, use {@link Configuration#NONE} to bypass using configuration settings during construction. - * - * @param configuration The configuration store used to - * @return The updated QueueServiceClientBuilder object. - */ - public QueueServiceClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } } 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 new file mode 100644 index 000000000000..dbb393b3cb11 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceSASQueryParameters.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.queue; + +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 java.time.OffsetDateTime; +import java.util.Map; + +/** + * 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 QueueServiceSASSignatureValues} type. Once generated, it can be set + * on a {@link QueueClientBuilder} object to be constructed as part of a URL or it can be encoded into a {@code String} + * and appended to a URL directly (though caution should be taken here in case there are existing query parameters, + * which might affect the appropriate means of appending these query parameters). NOTE: Instances of this class are + * immutable to ensure thread safety. + */ +public final class QueueServiceSASQueryParameters extends BaseSASQueryParameters { + + private final String identifier; + + /** + * Creates a new {@link QueueServiceSASQueryParameters} object. + * + * @param queryParamsMap All query parameters for the request as key-value pairs + * @param removeSASParametersFromMap When {@code true}, the SAS query parameters will be removed from + * queryParamsMap + */ + public QueueServiceSASQueryParameters(Map queryParamsMap, boolean removeSASParametersFromMap) { + super(queryParamsMap, removeSASParametersFromMap); + + this.identifier = getQueryParameter(queryParamsMap, Constants.UrlConstants.SAS_SIGNED_IDENTIFIER, + removeSASParametersFromMap); + } + + + /** + * Creates a new {@link QueueServiceSASQueryParameters} object. These objects are only created internally by + * SASSignatureValues classes. + * + * @param version A {@code String} representing the storage version. + * @param protocol A {@code String} representing the allowed HTTP protocol(s) or {@code null}. + * @param startTime A {@code java.util.Date} representing the start time for this SAS token or {@code null}. + * @param expiryTime A {@code java.util.Date} representing the expiry time for this SAS token. + * @param ipRange A {@link IPRange} representing the range of valid IP addresses for this SAS token or + * {@code null}. + * @param identifier A {@code String} representing the signed identifier (only for Service SAS) or {@code null}. + * @param permissions A {@code String} representing the storage permissions or {@code null}. + * @param signature A {@code String} representing the signature for the SAS token. + */ + 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); + + this.identifier = identifier; + } + + /** + * @return The signed identifier (only for {@link QueueServiceSASSignatureValues}) or {@code null}. Please see + * here + * for more information. + */ + public String getIdentifier() { + return identifier; + } + + /** + * Encodes all SAS query parameters into a string that can be appended to a URL. + * + * @return A {@code String} representing all SAS query parameters. + */ + public String encode() { + /* + We should be url-encoding each key and each value, but because we know all the keys and values will encode to + themselves, we cheat except for the signature value. + */ + StringBuilder sb = new StringBuilder(); + + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SERVICE_VERSION, this.version); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_PROTOCOL, this.protocol); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_START_TIME, formatQueryParameterDate(this.startTime)); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_EXPIRY_TIME, formatQueryParameterDate(this.expiryTime)); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_IP_RANGE, this.ipRange); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_IDENTIFIER, this.identifier); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNED_PERMISSIONS, this.permissions); + tryAppendQueryParameter(sb, Constants.UrlConstants.SAS_SIGNATURE, this.signature); + + return sb.toString(); + } +} 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 new file mode 100644 index 000000000000..d91005341292 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceSASSignatureValues.java @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.Utility; +import com.azure.storage.common.credentials.SharedKeyCredential; + +import java.time.OffsetDateTime; + +/** + * 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 + * 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. + *

    + * Please see here + * for more conceptual information on SAS. + *

    + * Please see here for + * more details on each value, including which are required. + * + *

    Please see + * here + * for additional samples.

    + */ +final class QueueServiceSASSignatureValues { + + private String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION; + + private SASProtocol protocol; + + private OffsetDateTime startTime; + + private OffsetDateTime expiryTime; + + private String permissions; + + private IPRange ipRange; + + private String canonicalName; + + private String identifier; + + /** + * Creates an object with empty values for all fields. + */ + QueueServiceSASSignatureValues() { + } + + /** + * Creates an object with the specified expiry time and permissions + * + * @param expiryTime Time the SAS becomes valid + * @param permissions Permissions granted by the SAS + */ + QueueServiceSASSignatureValues(OffsetDateTime expiryTime, String permissions) { + this.expiryTime = expiryTime; + this.permissions = permissions; + } + + /** + * Creates an object with the specified identifier + * + * @param identifier Identifier for the SAS + */ + QueueServiceSASSignatureValues(String identifier) { + this.identifier = identifier; + } + + QueueServiceSASSignatureValues(String version, SASProtocol sasProtocol, OffsetDateTime startTime, + OffsetDateTime expiryTime, String permission, IPRange ipRange, String identifier) { + if (version != null) { + this.version = version; + } + this.protocol = sasProtocol; + this.startTime = startTime; + this.expiryTime = expiryTime; + this.permissions = permission; + this.ipRange = ipRange; + this.identifier = identifier; + } + + /** + * @return the version of the service this SAS will target. If not specified, it will default to the version + * targeted by the library. + */ + public String getVersion() { + return version; + } + + /** + * Sets the version of the service this SAS will target. If not specified, it will default to the version targeted + * by the library. + * + * @param version Version to target + * @return the updated QueueServiceSASSignatureValues object + */ + public QueueServiceSASSignatureValues setVersion(String version) { + this.version = version; + return this; + } + + /** + * @return the {@link SASProtocol} which determines the protocols allowed by the SAS. + */ + public SASProtocol getProtocol() { + return protocol; + } + + /** + * 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) { + this.protocol = protocol; + return this; + } + + /** + * @return when the SAS will take effect. + */ + public OffsetDateTime getStartTime() { + return startTime; + } + + /** + * Sets when the SAS will take effect. + * + * @param startTime When the SAS takes effect + * @return the updated QueueServiceSASSignatureValues object + */ + public QueueServiceSASSignatureValues setStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * @return the time after which the SAS will no longer work. + */ + public OffsetDateTime getExpiryTime() { + return expiryTime; + } + + /** + * Sets the time after which the SAS will no longer work. + * + * @param expiryTime When the SAS will no longer work + * @return the updated QueueServiceSASSignatureValues object + */ + public QueueServiceSASSignatureValues setExpiryTime(OffsetDateTime expiryTime) { + this.expiryTime = expiryTime; + return this; + } + + /** + * @return the permissions string allowed by the SAS. Please refer to {@link QueueSASPermission} for help + * determining the permissions allowed. + */ + public String getPermissions() { + return permissions; + } + + /** + * Sets the permissions string allowed by the SAS. Please refer to {@link QueueSASPermission} for help constructing + * the permissions string. + * + * @param permissions Permissions string for the SAS + * @return the updated QueueServiceSASSignatureValues object + */ + public QueueServiceSASSignatureValues setPermissions(String permissions) { + this.permissions = permissions; + return this; + } + + /** + * @return the {@link IPRange} which determines the IP ranges that are allowed to use the SAS. + */ + public IPRange getIpRange() { + return ipRange; + } + + /** + * 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 QueueServiceSASSignatureValues object + */ + public QueueServiceSASSignatureValues setIpRange(IPRange ipRange) { + this.ipRange = ipRange; + return this; + } + + /** + * @return the canonical name of the object the SAS user may access. + */ + public String getCanonicalName() { + return canonicalName; + } + + /** + * Sets the canonical name of the object the SAS user may access. + * + * @param canonicalName Canonical name of the object the SAS grants access + * @return the updated QueueServiceSASSignatureValues object + */ + public QueueServiceSASSignatureValues setCanonicalName(String canonicalName) { + this.canonicalName = canonicalName; + return this; + } + + /** + * Sets the canonical name of the object the SAS user may access. Constructs a canonical name of + * "/queue/{accountName}{queueName}". + * + * @param queueName Name of the queue object + * @param accountName Name of the account that contains the object + * @return the updated QueueServiceSASSignatureValues object + */ + public QueueServiceSASSignatureValues setCanonicalName(String queueName, String accountName) { + this.canonicalName = String.format("/queue/%s/%s", accountName, queueName); + return this; + } + + /** + * @return the name of the access policy on the queue this SAS references if any. Please see + * here + * for more information. + */ + public String getIdentifier() { + return identifier; + } + + /** + * Sets the name of the access policy on the queue this SAS references if any. Please see + * here + * for more information. + * + * @param identifier Name of the access policy + * @return the updated QueueServiceSASSignatureValues object + */ + public QueueServiceSASSignatureValues setIdentifier(String identifier) { + this.identifier = identifier; + return this; + } + + /** + * Uses an account's shared key credential to sign these signature values to produce the proper SAS query + * parameters. + * + * @param sharedKeyCredentials A {@link SharedKeyCredential} object used to sign the SAS values. + * @return {@link QueueServiceSASQueryParameters} + * @throws IllegalStateException If the HMAC-SHA256 algorithm isn't supported, if the key isn't a valid Base64 + * encoded string, or the UTF-8 charset isn't supported. + */ + public QueueServiceSASQueryParameters generateSASQueryParameters(SharedKeyCredential sharedKeyCredentials) { + Utility.assertNotNull("sharedKeyCredentials", sharedKeyCredentials); + assertGenerateOK(); + + // Signature is generated on the un-url-encoded values. + String stringToSign = stringToSign(); + String signature = sharedKeyCredentials.computeHmac256(stringToSign); + + return new QueueServiceSASQueryParameters(this.version, this.protocol, this.startTime, this.expiryTime, + this.ipRange, this.identifier, this.permissions, signature); + } + + /** + * Common assertions for generateSASQueryParameters overloads. + */ + private void assertGenerateOK() { + Utility.assertNotNull("version", this.version); + Utility.assertNotNull("canonicalName", this.canonicalName); + + // If a SignedIdentifier is not being used both expiryDate and permissions must be set. + if (identifier == null) { + Utility.assertNotNull("expiryTime", this.expiryTime); + Utility.assertNotNull("permissions", this.permissions); + } + // Still need to check identifier if expiry time and permissions are not both set + if (expiryTime == null || permissions == null) { + Utility.assertNotNull("identifier", identifier); + } + } + + private String stringToSign() { + return String.join("\n", + this.permissions == null ? "" : this.permissions, + this.startTime == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(this.startTime), + this.expiryTime == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(this.expiryTime), + this.canonicalName == null ? "" : this.canonicalName, + this.identifier == null ? "" : this.identifier, + this.ipRange == null ? "" : this.ipRange.toString(), + this.protocol == null ? "" : protocol.toString(), + this.version == null ? "" : this.version + ); + } +} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/AzureQueueStorageImpl.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/AzureQueueStorageImpl.java index 1ee2de77a19a..be576fe7eac0 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/AzureQueueStorageImpl.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/AzureQueueStorageImpl.java @@ -30,8 +30,9 @@ public String getUrl() { * * @param url the url value. */ - void setUrl(String url) { + AzureQueueStorageImpl setUrl(String url) { this.url = url; + return this; } /** @@ -53,8 +54,9 @@ public String getVersion() { * * @param version the version value. */ - void setVersion(String version) { + AzureQueueStorageImpl setVersion(String version) { this.version = version; + return this; } /** diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/AccessPolicy.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/AccessPolicy.java index 40eec9949e94..9835831b664b 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/AccessPolicy.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/AccessPolicy.java @@ -38,7 +38,7 @@ public final class AccessPolicy { * * @return the start value. */ - public OffsetDateTime start() { + public OffsetDateTime getStart() { return this.start; } @@ -48,7 +48,7 @@ public OffsetDateTime start() { * @param start the start value to set. * @return the AccessPolicy object itself. */ - public AccessPolicy start(OffsetDateTime start) { + public AccessPolicy setStart(OffsetDateTime start) { this.start = start; return this; } @@ -58,7 +58,7 @@ public AccessPolicy start(OffsetDateTime start) { * * @return the expiry value. */ - public OffsetDateTime expiry() { + public OffsetDateTime getExpiry() { return this.expiry; } @@ -68,7 +68,7 @@ public OffsetDateTime expiry() { * @param expiry the expiry value to set. * @return the AccessPolicy object itself. */ - public AccessPolicy expiry(OffsetDateTime expiry) { + public AccessPolicy setExpiry(OffsetDateTime expiry) { this.expiry = expiry; return this; } @@ -78,7 +78,7 @@ public AccessPolicy expiry(OffsetDateTime expiry) { * * @return the permission value. */ - public String permission() { + public String getPermission() { return this.permission; } @@ -88,7 +88,7 @@ public String permission() { * @param permission the permission value to set. * @return the AccessPolicy object itself. */ - public AccessPolicy permission(String permission) { + public AccessPolicy setPermission(String permission) { this.permission = permission; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/CorsRule.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/CorsRule.java index ae40f253efb6..9f5baaa2a5e0 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/CorsRule.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/CorsRule.java @@ -67,7 +67,7 @@ public final class CorsRule { * * @return the allowedOrigins value. */ - public String allowedOrigins() { + public String getAllowedOrigins() { return this.allowedOrigins; } @@ -82,7 +82,7 @@ public String allowedOrigins() { * @param allowedOrigins the allowedOrigins value to set. * @return the CorsRule object itself. */ - public CorsRule allowedOrigins(String allowedOrigins) { + public CorsRule setAllowedOrigins(String allowedOrigins) { this.allowedOrigins = allowedOrigins; return this; } @@ -93,7 +93,7 @@ public CorsRule allowedOrigins(String allowedOrigins) { * * @return the allowedMethods value. */ - public String allowedMethods() { + public String getAllowedMethods() { return this.allowedMethods; } @@ -104,7 +104,7 @@ public String allowedMethods() { * @param allowedMethods the allowedMethods value to set. * @return the CorsRule object itself. */ - public CorsRule allowedMethods(String allowedMethods) { + public CorsRule setAllowedMethods(String allowedMethods) { this.allowedMethods = allowedMethods; return this; } @@ -115,7 +115,7 @@ public CorsRule allowedMethods(String allowedMethods) { * * @return the allowedHeaders value. */ - public String allowedHeaders() { + public String getAllowedHeaders() { return this.allowedHeaders; } @@ -126,7 +126,7 @@ public String allowedHeaders() { * @param allowedHeaders the allowedHeaders value to set. * @return the CorsRule object itself. */ - public CorsRule allowedHeaders(String allowedHeaders) { + public CorsRule setAllowedHeaders(String allowedHeaders) { this.allowedHeaders = allowedHeaders; return this; } @@ -138,7 +138,7 @@ public CorsRule allowedHeaders(String allowedHeaders) { * * @return the exposedHeaders value. */ - public String exposedHeaders() { + public String getExposedHeaders() { return this.exposedHeaders; } @@ -150,7 +150,7 @@ public String exposedHeaders() { * @param exposedHeaders the exposedHeaders value to set. * @return the CorsRule object itself. */ - public CorsRule exposedHeaders(String exposedHeaders) { + public CorsRule setExposedHeaders(String exposedHeaders) { this.exposedHeaders = exposedHeaders; return this; } @@ -161,7 +161,7 @@ public CorsRule exposedHeaders(String exposedHeaders) { * * @return the maxAgeInSeconds value. */ - public int maxAgeInSeconds() { + public int getMaxAgeInSeconds() { return this.maxAgeInSeconds; } @@ -172,7 +172,7 @@ public int maxAgeInSeconds() { * @param maxAgeInSeconds the maxAgeInSeconds value to set. * @return the CorsRule object itself. */ - public CorsRule maxAgeInSeconds(int maxAgeInSeconds) { + public CorsRule setMaxAgeInSeconds(int maxAgeInSeconds) { this.maxAgeInSeconds = maxAgeInSeconds; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/DequeuedMessage.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/DequeuedMessage.java index 81614fc1cba9..f82561d424f1 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/DequeuedMessage.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/DequeuedMessage.java @@ -65,7 +65,7 @@ public final class DequeuedMessage { * * @return the messageId value. */ - public String messageId() { + public String getMessageId() { return this.messageId; } @@ -75,7 +75,7 @@ public String messageId() { * @param messageId the messageId value to set. * @return the DequeuedMessage object itself. */ - public DequeuedMessage messageId(String messageId) { + public DequeuedMessage setMessageId(String messageId) { this.messageId = messageId; return this; } @@ -86,11 +86,11 @@ public DequeuedMessage messageId(String messageId) { * * @return the insertionTime value. */ - public OffsetDateTime insertionTime() { + public OffsetDateTime getInsertionTime() { if (this.insertionTime == null) { return null; } - return this.insertionTime.dateTime(); + return this.insertionTime.getDateTime(); } /** @@ -100,7 +100,7 @@ public OffsetDateTime insertionTime() { * @param insertionTime the insertionTime value to set. * @return the DequeuedMessage object itself. */ - public DequeuedMessage insertionTime(OffsetDateTime insertionTime) { + public DequeuedMessage setInsertionTime(OffsetDateTime insertionTime) { if (insertionTime == null) { this.insertionTime = null; } else { @@ -115,11 +115,11 @@ public DequeuedMessage insertionTime(OffsetDateTime insertionTime) { * * @return the expirationTime value. */ - public OffsetDateTime expirationTime() { + public OffsetDateTime getExpirationTime() { if (this.expirationTime == null) { return null; } - return this.expirationTime.dateTime(); + return this.expirationTime.getDateTime(); } /** @@ -129,7 +129,7 @@ public OffsetDateTime expirationTime() { * @param expirationTime the expirationTime value to set. * @return the DequeuedMessage object itself. */ - public DequeuedMessage expirationTime(OffsetDateTime expirationTime) { + public DequeuedMessage setExpirationTime(OffsetDateTime expirationTime) { if (expirationTime == null) { this.expirationTime = null; } else { @@ -145,7 +145,7 @@ public DequeuedMessage expirationTime(OffsetDateTime expirationTime) { * * @return the popReceipt value. */ - public String popReceipt() { + public String getPopReceipt() { return this.popReceipt; } @@ -157,7 +157,7 @@ public String popReceipt() { * @param popReceipt the popReceipt value to set. * @return the DequeuedMessage object itself. */ - public DequeuedMessage popReceipt(String popReceipt) { + public DequeuedMessage setPopReceipt(String popReceipt) { this.popReceipt = popReceipt; return this; } @@ -168,11 +168,11 @@ public DequeuedMessage popReceipt(String popReceipt) { * * @return the timeNextVisible value. */ - public OffsetDateTime timeNextVisible() { + public OffsetDateTime getTimeNextVisible() { if (this.timeNextVisible == null) { return null; } - return this.timeNextVisible.dateTime(); + return this.timeNextVisible.getDateTime(); } /** @@ -182,7 +182,7 @@ public OffsetDateTime timeNextVisible() { * @param timeNextVisible the timeNextVisible value to set. * @return the DequeuedMessage object itself. */ - public DequeuedMessage timeNextVisible(OffsetDateTime timeNextVisible) { + public DequeuedMessage setTimeNextVisible(OffsetDateTime timeNextVisible) { if (timeNextVisible == null) { this.timeNextVisible = null; } else { @@ -197,7 +197,7 @@ public DequeuedMessage timeNextVisible(OffsetDateTime timeNextVisible) { * * @return the dequeueCount value. */ - public long dequeueCount() { + public long getDequeueCount() { return this.dequeueCount; } @@ -208,7 +208,7 @@ public long dequeueCount() { * @param dequeueCount the dequeueCount value to set. * @return the DequeuedMessage object itself. */ - public DequeuedMessage dequeueCount(long dequeueCount) { + public DequeuedMessage setDequeueCount(long dequeueCount) { this.dequeueCount = dequeueCount; return this; } @@ -218,7 +218,7 @@ public DequeuedMessage dequeueCount(long dequeueCount) { * * @return the messageText value. */ - public String messageText() { + public String getMessageText() { return this.messageText; } @@ -228,7 +228,7 @@ public String messageText() { * @param messageText the messageText value to set. * @return the DequeuedMessage object itself. */ - public DequeuedMessage messageText(String messageText) { + public DequeuedMessage setMessageText(String messageText) { this.messageText = messageText; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/EnqueuedMessage.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/EnqueuedMessage.java index 096bbac70bdb..fb849f15bfba 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/EnqueuedMessage.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/EnqueuedMessage.java @@ -53,7 +53,7 @@ public final class EnqueuedMessage { * * @return the messageId value. */ - public String messageId() { + public String getMessageId() { return this.messageId; } @@ -63,7 +63,7 @@ public String messageId() { * @param messageId the messageId value to set. * @return the EnqueuedMessage object itself. */ - public EnqueuedMessage messageId(String messageId) { + public EnqueuedMessage setMessageId(String messageId) { this.messageId = messageId; return this; } @@ -74,11 +74,11 @@ public EnqueuedMessage messageId(String messageId) { * * @return the insertionTime value. */ - public OffsetDateTime insertionTime() { + public OffsetDateTime getInsertionTime() { if (this.insertionTime == null) { return null; } - return this.insertionTime.dateTime(); + return this.insertionTime.getDateTime(); } /** @@ -88,7 +88,7 @@ public OffsetDateTime insertionTime() { * @param insertionTime the insertionTime value to set. * @return the EnqueuedMessage object itself. */ - public EnqueuedMessage insertionTime(OffsetDateTime insertionTime) { + public EnqueuedMessage setInsertionTime(OffsetDateTime insertionTime) { if (insertionTime == null) { this.insertionTime = null; } else { @@ -103,11 +103,11 @@ public EnqueuedMessage insertionTime(OffsetDateTime insertionTime) { * * @return the expirationTime value. */ - public OffsetDateTime expirationTime() { + public OffsetDateTime getExpirationTime() { if (this.expirationTime == null) { return null; } - return this.expirationTime.dateTime(); + return this.expirationTime.getDateTime(); } /** @@ -117,7 +117,7 @@ public OffsetDateTime expirationTime() { * @param expirationTime the expirationTime value to set. * @return the EnqueuedMessage object itself. */ - public EnqueuedMessage expirationTime(OffsetDateTime expirationTime) { + public EnqueuedMessage setExpirationTime(OffsetDateTime expirationTime) { if (expirationTime == null) { this.expirationTime = null; } else { @@ -133,7 +133,7 @@ public EnqueuedMessage expirationTime(OffsetDateTime expirationTime) { * * @return the popReceipt value. */ - public String popReceipt() { + public String getPopReceipt() { return this.popReceipt; } @@ -145,7 +145,7 @@ public String popReceipt() { * @param popReceipt the popReceipt value to set. * @return the EnqueuedMessage object itself. */ - public EnqueuedMessage popReceipt(String popReceipt) { + public EnqueuedMessage setPopReceipt(String popReceipt) { this.popReceipt = popReceipt; return this; } @@ -156,11 +156,11 @@ public EnqueuedMessage popReceipt(String popReceipt) { * * @return the timeNextVisible value. */ - public OffsetDateTime timeNextVisible() { + public OffsetDateTime getTimeNextVisible() { if (this.timeNextVisible == null) { return null; } - return this.timeNextVisible.dateTime(); + return this.timeNextVisible.getDateTime(); } /** @@ -170,7 +170,7 @@ public OffsetDateTime timeNextVisible() { * @param timeNextVisible the timeNextVisible value to set. * @return the EnqueuedMessage object itself. */ - public EnqueuedMessage timeNextVisible(OffsetDateTime timeNextVisible) { + public EnqueuedMessage setTimeNextVisible(OffsetDateTime timeNextVisible) { if (timeNextVisible == null) { this.timeNextVisible = null; } else { diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/GeoReplication.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/GeoReplication.java index c6975aae93dc..b893d9f6832c 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/GeoReplication.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/GeoReplication.java @@ -38,7 +38,7 @@ public final class GeoReplication { * * @return the status value. */ - public GeoReplicationStatusType status() { + public GeoReplicationStatusType getStatus() { return this.status; } @@ -49,7 +49,7 @@ public GeoReplicationStatusType status() { * @param status the status value to set. * @return the GeoReplication object itself. */ - public GeoReplication status(GeoReplicationStatusType status) { + public GeoReplication setStatus(GeoReplicationStatusType status) { this.status = status; return this; } @@ -62,11 +62,11 @@ public GeoReplication status(GeoReplicationStatusType status) { * * @return the lastSyncTime value. */ - public OffsetDateTime lastSyncTime() { + public OffsetDateTime getLastSyncTime() { if (this.lastSyncTime == null) { return null; } - return this.lastSyncTime.dateTime(); + return this.lastSyncTime.getDateTime(); } /** @@ -78,7 +78,7 @@ public OffsetDateTime lastSyncTime() { * @param lastSyncTime the lastSyncTime value to set. * @return the GeoReplication object itself. */ - public GeoReplication lastSyncTime(OffsetDateTime lastSyncTime) { + public GeoReplication setLastSyncTime(OffsetDateTime lastSyncTime) { if (lastSyncTime == null) { this.lastSyncTime = null; } else { diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ListQueuesSegmentResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ListQueuesSegmentResponse.java index 90d462272f47..3db0c6603b61 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ListQueuesSegmentResponse.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ListQueuesSegmentResponse.java @@ -69,7 +69,7 @@ private QueuesWrapper(@JacksonXmlProperty(localName = "Queue") List i * * @return the serviceEndpoint value. */ - public String serviceEndpoint() { + public String getServiceEndpoint() { return this.serviceEndpoint; } @@ -79,7 +79,7 @@ public String serviceEndpoint() { * @param serviceEndpoint the serviceEndpoint value to set. * @return the ListQueuesSegmentResponse object itself. */ - public ListQueuesSegmentResponse serviceEndpoint(String serviceEndpoint) { + public ListQueuesSegmentResponse setServiceEndpoint(String serviceEndpoint) { this.serviceEndpoint = serviceEndpoint; return this; } @@ -89,7 +89,7 @@ public ListQueuesSegmentResponse serviceEndpoint(String serviceEndpoint) { * * @return the prefix value. */ - public String prefix() { + public String getPrefix() { return this.prefix; } @@ -99,7 +99,7 @@ public String prefix() { * @param prefix the prefix value to set. * @return the ListQueuesSegmentResponse object itself. */ - public ListQueuesSegmentResponse prefix(String prefix) { + public ListQueuesSegmentResponse setPrefix(String prefix) { this.prefix = prefix; return this; } @@ -109,7 +109,7 @@ public ListQueuesSegmentResponse prefix(String prefix) { * * @return the marker value. */ - public String marker() { + public String getMarker() { return this.marker; } @@ -119,7 +119,7 @@ public String marker() { * @param marker the marker value to set. * @return the ListQueuesSegmentResponse object itself. */ - public ListQueuesSegmentResponse marker(String marker) { + public ListQueuesSegmentResponse setMarker(String marker) { this.marker = marker; return this; } @@ -129,7 +129,7 @@ public ListQueuesSegmentResponse marker(String marker) { * * @return the maxResults value. */ - public int maxResults() { + public int getMaxResults() { return this.maxResults; } @@ -139,7 +139,7 @@ public int maxResults() { * @param maxResults the maxResults value to set. * @return the ListQueuesSegmentResponse object itself. */ - public ListQueuesSegmentResponse maxResults(int maxResults) { + public ListQueuesSegmentResponse setMaxResults(int maxResults) { this.maxResults = maxResults; return this; } @@ -149,7 +149,7 @@ public ListQueuesSegmentResponse maxResults(int maxResults) { * * @return the queueItems value. */ - public List queueItems() { + public List getQueueItems() { if (this.queueItems == null) { this.queueItems = new QueuesWrapper(new ArrayList()); } @@ -162,7 +162,7 @@ public List queueItems() { * @param queueItems the queueItems value to set. * @return the ListQueuesSegmentResponse object itself. */ - public ListQueuesSegmentResponse queueItems(List queueItems) { + public ListQueuesSegmentResponse setQueueItems(List queueItems) { this.queueItems = new QueuesWrapper(queueItems); return this; } @@ -172,7 +172,7 @@ public ListQueuesSegmentResponse queueItems(List queueItems) { * * @return the nextMarker value. */ - public String nextMarker() { + public String getNextMarker() { return this.nextMarker; } @@ -182,7 +182,7 @@ public String nextMarker() { * @param nextMarker the nextMarker value to set. * @return the ListQueuesSegmentResponse object itself. */ - public ListQueuesSegmentResponse nextMarker(String nextMarker) { + public ListQueuesSegmentResponse setNextMarker(String nextMarker) { this.nextMarker = nextMarker; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/Logging.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/Logging.java index a08399c0186c..25e3ede1b86b 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/Logging.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/Logging.java @@ -49,7 +49,7 @@ public final class Logging { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -59,7 +59,7 @@ public String version() { * @param version the version value to set. * @return the Logging object itself. */ - public Logging version(String version) { + public Logging setVersion(String version) { this.version = version; return this; } @@ -70,7 +70,7 @@ public Logging version(String version) { * * @return the delete value. */ - public boolean delete() { + public boolean isDelete() { return this.delete; } @@ -81,7 +81,7 @@ public boolean delete() { * @param delete the delete value to set. * @return the Logging object itself. */ - public Logging delete(boolean delete) { + public Logging setDelete(boolean delete) { this.delete = delete; return this; } @@ -92,7 +92,7 @@ public Logging delete(boolean delete) { * * @return the read value. */ - public boolean read() { + public boolean isRead() { return this.read; } @@ -103,7 +103,7 @@ public boolean read() { * @param read the read value to set. * @return the Logging object itself. */ - public Logging read(boolean read) { + public Logging setRead(boolean read) { this.read = read; return this; } @@ -114,7 +114,7 @@ public Logging read(boolean read) { * * @return the write value. */ - public boolean write() { + public boolean isWrite() { return this.write; } @@ -125,7 +125,7 @@ public boolean write() { * @param write the write value to set. * @return the Logging object itself. */ - public Logging write(boolean write) { + public Logging setWrite(boolean write) { this.write = write; return this; } @@ -135,7 +135,7 @@ public Logging write(boolean write) { * * @return the retentionPolicy value. */ - public RetentionPolicy retentionPolicy() { + public RetentionPolicy getRetentionPolicy() { return this.retentionPolicy; } @@ -145,7 +145,7 @@ public RetentionPolicy retentionPolicy() { * @param retentionPolicy the retentionPolicy value to set. * @return the Logging object itself. */ - public Logging retentionPolicy(RetentionPolicy retentionPolicy) { + public Logging setRetentionPolicy(RetentionPolicy retentionPolicy) { this.retentionPolicy = retentionPolicy; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessageIdDeleteHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessageIdDeleteHeaders.java index c51a8961f2bb..60cb6385177f 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessageIdDeleteHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessageIdDeleteHeaders.java @@ -50,7 +50,7 @@ public final class MessageIdDeleteHeaders { * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -61,7 +61,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the MessageIdDeleteHeaders object itself. */ - public MessageIdDeleteHeaders requestId(String requestId) { + public MessageIdDeleteHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -73,7 +73,7 @@ public MessageIdDeleteHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -85,7 +85,7 @@ public String version() { * @param version the version value to set. * @return the MessageIdDeleteHeaders object itself. */ - public MessageIdDeleteHeaders version(String version) { + public MessageIdDeleteHeaders setVersion(String version) { this.version = version; return this; } @@ -96,11 +96,11 @@ public MessageIdDeleteHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -110,7 +110,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the MessageIdDeleteHeaders object itself. */ - public MessageIdDeleteHeaders dateProperty(OffsetDateTime dateProperty) { + public MessageIdDeleteHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -124,7 +124,7 @@ public MessageIdDeleteHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -134,7 +134,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the MessageIdDeleteHeaders object itself. */ - public MessageIdDeleteHeaders errorCode(String errorCode) { + public MessageIdDeleteHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessageIdUpdateHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessageIdUpdateHeaders.java index dba25a728e8e..5b520cd418fc 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessageIdUpdateHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessageIdUpdateHeaders.java @@ -63,7 +63,7 @@ public final class MessageIdUpdateHeaders { * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -74,7 +74,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the MessageIdUpdateHeaders object itself. */ - public MessageIdUpdateHeaders requestId(String requestId) { + public MessageIdUpdateHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -86,7 +86,7 @@ public MessageIdUpdateHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -98,7 +98,7 @@ public String version() { * @param version the version value to set. * @return the MessageIdUpdateHeaders object itself. */ - public MessageIdUpdateHeaders version(String version) { + public MessageIdUpdateHeaders setVersion(String version) { this.version = version; return this; } @@ -109,11 +109,11 @@ public MessageIdUpdateHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -123,7 +123,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the MessageIdUpdateHeaders object itself. */ - public MessageIdUpdateHeaders dateProperty(OffsetDateTime dateProperty) { + public MessageIdUpdateHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -137,7 +137,7 @@ public MessageIdUpdateHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the popReceipt value. */ - public String popReceipt() { + public String getPopReceipt() { return this.popReceipt; } @@ -147,7 +147,7 @@ public String popReceipt() { * @param popReceipt the popReceipt value to set. * @return the MessageIdUpdateHeaders object itself. */ - public MessageIdUpdateHeaders popReceipt(String popReceipt) { + public MessageIdUpdateHeaders setPopReceipt(String popReceipt) { this.popReceipt = popReceipt; return this; } @@ -158,11 +158,11 @@ public MessageIdUpdateHeaders popReceipt(String popReceipt) { * * @return the timeNextVisible value. */ - public OffsetDateTime timeNextVisible() { + public OffsetDateTime getTimeNextVisible() { if (this.timeNextVisible == null) { return null; } - return this.timeNextVisible.dateTime(); + return this.timeNextVisible.getDateTime(); } /** @@ -172,7 +172,7 @@ public OffsetDateTime timeNextVisible() { * @param timeNextVisible the timeNextVisible value to set. * @return the MessageIdUpdateHeaders object itself. */ - public MessageIdUpdateHeaders timeNextVisible(OffsetDateTime timeNextVisible) { + public MessageIdUpdateHeaders setTimeNextVisible(OffsetDateTime timeNextVisible) { if (timeNextVisible == null) { this.timeNextVisible = null; } else { @@ -186,7 +186,7 @@ public MessageIdUpdateHeaders timeNextVisible(OffsetDateTime timeNextVisible) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -196,7 +196,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the MessageIdUpdateHeaders object itself. */ - public MessageIdUpdateHeaders errorCode(String errorCode) { + public MessageIdUpdateHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesClearHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesClearHeaders.java index 6265fda56273..72237a4e5ddc 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesClearHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesClearHeaders.java @@ -50,7 +50,7 @@ public final class MessagesClearHeaders { * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -61,7 +61,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the MessagesClearHeaders object itself. */ - public MessagesClearHeaders requestId(String requestId) { + public MessagesClearHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -73,7 +73,7 @@ public MessagesClearHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -85,7 +85,7 @@ public String version() { * @param version the version value to set. * @return the MessagesClearHeaders object itself. */ - public MessagesClearHeaders version(String version) { + public MessagesClearHeaders setVersion(String version) { this.version = version; return this; } @@ -96,11 +96,11 @@ public MessagesClearHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -110,7 +110,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the MessagesClearHeaders object itself. */ - public MessagesClearHeaders dateProperty(OffsetDateTime dateProperty) { + public MessagesClearHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -124,7 +124,7 @@ public MessagesClearHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -134,7 +134,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the MessagesClearHeaders object itself. */ - public MessagesClearHeaders errorCode(String errorCode) { + public MessagesClearHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesDequeueHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesDequeueHeaders.java index d9e8fd905f03..8b170327c425 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesDequeueHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesDequeueHeaders.java @@ -50,7 +50,7 @@ public final class MessagesDequeueHeaders { * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -61,7 +61,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the MessagesDequeueHeaders object itself. */ - public MessagesDequeueHeaders requestId(String requestId) { + public MessagesDequeueHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -73,7 +73,7 @@ public MessagesDequeueHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -85,7 +85,7 @@ public String version() { * @param version the version value to set. * @return the MessagesDequeueHeaders object itself. */ - public MessagesDequeueHeaders version(String version) { + public MessagesDequeueHeaders setVersion(String version) { this.version = version; return this; } @@ -96,11 +96,11 @@ public MessagesDequeueHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -110,7 +110,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the MessagesDequeueHeaders object itself. */ - public MessagesDequeueHeaders dateProperty(OffsetDateTime dateProperty) { + public MessagesDequeueHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -124,7 +124,7 @@ public MessagesDequeueHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -134,7 +134,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the MessagesDequeueHeaders object itself. */ - public MessagesDequeueHeaders errorCode(String errorCode) { + public MessagesDequeueHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesDequeueResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesDequeueResponse.java index c08c7ccc025c..feb6d78145ba 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesDequeueResponse.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesDequeueResponse.java @@ -30,7 +30,7 @@ public MessagesDequeueResponse(HttpRequest request, int statusCode, HttpHeaders * @return the deserialized response body. */ @Override - public List value() { - return super.value(); + public List getValue() { + return super.getValue(); } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesEnqueueHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesEnqueueHeaders.java index d98604bb3c84..c92d03b1330e 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesEnqueueHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesEnqueueHeaders.java @@ -50,7 +50,7 @@ public final class MessagesEnqueueHeaders { * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -61,7 +61,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the MessagesEnqueueHeaders object itself. */ - public MessagesEnqueueHeaders requestId(String requestId) { + public MessagesEnqueueHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -73,7 +73,7 @@ public MessagesEnqueueHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -85,7 +85,7 @@ public String version() { * @param version the version value to set. * @return the MessagesEnqueueHeaders object itself. */ - public MessagesEnqueueHeaders version(String version) { + public MessagesEnqueueHeaders setVersion(String version) { this.version = version; return this; } @@ -96,11 +96,11 @@ public MessagesEnqueueHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -110,7 +110,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the MessagesEnqueueHeaders object itself. */ - public MessagesEnqueueHeaders dateProperty(OffsetDateTime dateProperty) { + public MessagesEnqueueHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -124,7 +124,7 @@ public MessagesEnqueueHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -134,7 +134,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the MessagesEnqueueHeaders object itself. */ - public MessagesEnqueueHeaders errorCode(String errorCode) { + public MessagesEnqueueHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesEnqueueResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesEnqueueResponse.java index 079778e00676..a00a57391b38 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesEnqueueResponse.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesEnqueueResponse.java @@ -30,7 +30,7 @@ public MessagesEnqueueResponse(HttpRequest request, int statusCode, HttpHeaders * @return the deserialized response body. */ @Override - public List value() { - return super.value(); + public List getValue() { + return super.getValue(); } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesPeekHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesPeekHeaders.java index fc4c65fcd5bd..3c2259bf5910 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesPeekHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesPeekHeaders.java @@ -50,7 +50,7 @@ public final class MessagesPeekHeaders { * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -61,7 +61,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the MessagesPeekHeaders object itself. */ - public MessagesPeekHeaders requestId(String requestId) { + public MessagesPeekHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -73,7 +73,7 @@ public MessagesPeekHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -85,7 +85,7 @@ public String version() { * @param version the version value to set. * @return the MessagesPeekHeaders object itself. */ - public MessagesPeekHeaders version(String version) { + public MessagesPeekHeaders setVersion(String version) { this.version = version; return this; } @@ -96,11 +96,11 @@ public MessagesPeekHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -110,7 +110,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the MessagesPeekHeaders object itself. */ - public MessagesPeekHeaders dateProperty(OffsetDateTime dateProperty) { + public MessagesPeekHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -124,7 +124,7 @@ public MessagesPeekHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -134,7 +134,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the MessagesPeekHeaders object itself. */ - public MessagesPeekHeaders errorCode(String errorCode) { + public MessagesPeekHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesPeekResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesPeekResponse.java index 27ac64613890..cd5a5dac5952 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesPeekResponse.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesPeekResponse.java @@ -30,7 +30,7 @@ public MessagesPeekResponse(HttpRequest request, int statusCode, HttpHeaders raw * @return the deserialized response body. */ @Override - public List value() { - return super.value(); + public List getValue() { + return super.getValue(); } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/Metrics.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/Metrics.java index 03a16a676ba1..324761c23404 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/Metrics.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/Metrics.java @@ -44,7 +44,7 @@ public final class Metrics { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -54,7 +54,7 @@ public String version() { * @param version the version value to set. * @return the Metrics object itself. */ - public Metrics version(String version) { + public Metrics setVersion(String version) { this.version = version; return this; } @@ -65,7 +65,7 @@ public Metrics version(String version) { * * @return the enabled value. */ - public boolean enabled() { + public boolean isEnabled() { return this.enabled; } @@ -76,7 +76,7 @@ public boolean enabled() { * @param enabled the enabled value to set. * @return the Metrics object itself. */ - public Metrics enabled(boolean enabled) { + public Metrics setEnabled(boolean enabled) { this.enabled = enabled; return this; } @@ -87,7 +87,7 @@ public Metrics enabled(boolean enabled) { * * @return the includeAPIs value. */ - public Boolean includeAPIs() { + public Boolean isIncludeAPIs() { return this.includeAPIs; } @@ -98,7 +98,7 @@ public Boolean includeAPIs() { * @param includeAPIs the includeAPIs value to set. * @return the Metrics object itself. */ - public Metrics includeAPIs(Boolean includeAPIs) { + public Metrics setIncludeAPIs(Boolean includeAPIs) { this.includeAPIs = includeAPIs; return this; } @@ -108,7 +108,7 @@ public Metrics includeAPIs(Boolean includeAPIs) { * * @return the retentionPolicy value. */ - public RetentionPolicy retentionPolicy() { + public RetentionPolicy getRetentionPolicy() { return this.retentionPolicy; } @@ -118,7 +118,7 @@ public RetentionPolicy retentionPolicy() { * @param retentionPolicy the retentionPolicy value to set. * @return the Metrics object itself. */ - public Metrics retentionPolicy(RetentionPolicy retentionPolicy) { + public Metrics setRetentionPolicy(RetentionPolicy retentionPolicy) { this.retentionPolicy = retentionPolicy; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/PeekedMessage.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/PeekedMessage.java index c8a3c26ab973..676f03b4a401 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/PeekedMessage.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/PeekedMessage.java @@ -52,7 +52,7 @@ public final class PeekedMessage { * * @return the messageId value. */ - public String messageId() { + public String getMessageId() { return this.messageId; } @@ -62,7 +62,7 @@ public String messageId() { * @param messageId the messageId value to set. * @return the PeekedMessage object itself. */ - public PeekedMessage messageId(String messageId) { + public PeekedMessage setMessageId(String messageId) { this.messageId = messageId; return this; } @@ -73,11 +73,11 @@ public PeekedMessage messageId(String messageId) { * * @return the insertionTime value. */ - public OffsetDateTime insertionTime() { + public OffsetDateTime getInsertionTime() { if (this.insertionTime == null) { return null; } - return this.insertionTime.dateTime(); + return this.insertionTime.getDateTime(); } /** @@ -87,7 +87,7 @@ public OffsetDateTime insertionTime() { * @param insertionTime the insertionTime value to set. * @return the PeekedMessage object itself. */ - public PeekedMessage insertionTime(OffsetDateTime insertionTime) { + public PeekedMessage setInsertionTime(OffsetDateTime insertionTime) { if (insertionTime == null) { this.insertionTime = null; } else { @@ -102,11 +102,11 @@ public PeekedMessage insertionTime(OffsetDateTime insertionTime) { * * @return the expirationTime value. */ - public OffsetDateTime expirationTime() { + public OffsetDateTime getExpirationTime() { if (this.expirationTime == null) { return null; } - return this.expirationTime.dateTime(); + return this.expirationTime.getDateTime(); } /** @@ -116,7 +116,7 @@ public OffsetDateTime expirationTime() { * @param expirationTime the expirationTime value to set. * @return the PeekedMessage object itself. */ - public PeekedMessage expirationTime(OffsetDateTime expirationTime) { + public PeekedMessage setExpirationTime(OffsetDateTime expirationTime) { if (expirationTime == null) { this.expirationTime = null; } else { @@ -131,7 +131,7 @@ public PeekedMessage expirationTime(OffsetDateTime expirationTime) { * * @return the dequeueCount value. */ - public long dequeueCount() { + public long getDequeueCount() { return this.dequeueCount; } @@ -142,7 +142,7 @@ public long dequeueCount() { * @param dequeueCount the dequeueCount value to set. * @return the PeekedMessage object itself. */ - public PeekedMessage dequeueCount(long dequeueCount) { + public PeekedMessage setDequeueCount(long dequeueCount) { this.dequeueCount = dequeueCount; return this; } @@ -152,7 +152,7 @@ public PeekedMessage dequeueCount(long dequeueCount) { * * @return the messageText value. */ - public String messageText() { + public String getMessageText() { return this.messageText; } @@ -162,7 +162,7 @@ public String messageText() { * @param messageText the messageText value to set. * @return the PeekedMessage object itself. */ - public PeekedMessage messageText(String messageText) { + public PeekedMessage setMessageText(String messageText) { this.messageText = messageText; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueCreateHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueCreateHeaders.java index 5feda5191d35..aeb175ec96c9 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueCreateHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueCreateHeaders.java @@ -50,7 +50,7 @@ public final class QueueCreateHeaders { * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -61,7 +61,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the QueueCreateHeaders object itself. */ - public QueueCreateHeaders requestId(String requestId) { + public QueueCreateHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -73,7 +73,7 @@ public QueueCreateHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -85,7 +85,7 @@ public String version() { * @param version the version value to set. * @return the QueueCreateHeaders object itself. */ - public QueueCreateHeaders version(String version) { + public QueueCreateHeaders setVersion(String version) { this.version = version; return this; } @@ -96,11 +96,11 @@ public QueueCreateHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -110,7 +110,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the QueueCreateHeaders object itself. */ - public QueueCreateHeaders dateProperty(OffsetDateTime dateProperty) { + public QueueCreateHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -124,7 +124,7 @@ public QueueCreateHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -134,7 +134,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the QueueCreateHeaders object itself. */ - public QueueCreateHeaders errorCode(String errorCode) { + public QueueCreateHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueDeleteHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueDeleteHeaders.java index 5d1db54847da..031752637883 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueDeleteHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueDeleteHeaders.java @@ -50,7 +50,7 @@ public final class QueueDeleteHeaders { * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -61,7 +61,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the QueueDeleteHeaders object itself. */ - public QueueDeleteHeaders requestId(String requestId) { + public QueueDeleteHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -73,7 +73,7 @@ public QueueDeleteHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -85,7 +85,7 @@ public String version() { * @param version the version value to set. * @return the QueueDeleteHeaders object itself. */ - public QueueDeleteHeaders version(String version) { + public QueueDeleteHeaders setVersion(String version) { this.version = version; return this; } @@ -96,11 +96,11 @@ public QueueDeleteHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -110,7 +110,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the QueueDeleteHeaders object itself. */ - public QueueDeleteHeaders dateProperty(OffsetDateTime dateProperty) { + public QueueDeleteHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -124,7 +124,7 @@ public QueueDeleteHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -134,7 +134,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the QueueDeleteHeaders object itself. */ - public QueueDeleteHeaders errorCode(String errorCode) { + public QueueDeleteHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueGetAccessPolicyHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueGetAccessPolicyHeaders.java index 904ed5a98bca..12b93f09650c 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueGetAccessPolicyHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueGetAccessPolicyHeaders.java @@ -50,7 +50,7 @@ public final class QueueGetAccessPolicyHeaders { * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -61,7 +61,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the QueueGetAccessPolicyHeaders object itself. */ - public QueueGetAccessPolicyHeaders requestId(String requestId) { + public QueueGetAccessPolicyHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -73,7 +73,7 @@ public QueueGetAccessPolicyHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -85,7 +85,7 @@ public String version() { * @param version the version value to set. * @return the QueueGetAccessPolicyHeaders object itself. */ - public QueueGetAccessPolicyHeaders version(String version) { + public QueueGetAccessPolicyHeaders setVersion(String version) { this.version = version; return this; } @@ -96,11 +96,11 @@ public QueueGetAccessPolicyHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -110,7 +110,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the QueueGetAccessPolicyHeaders object itself. */ - public QueueGetAccessPolicyHeaders dateProperty(OffsetDateTime dateProperty) { + public QueueGetAccessPolicyHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -124,7 +124,7 @@ public QueueGetAccessPolicyHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -134,7 +134,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the QueueGetAccessPolicyHeaders object itself. */ - public QueueGetAccessPolicyHeaders errorCode(String errorCode) { + public QueueGetAccessPolicyHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueGetPropertiesHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueGetPropertiesHeaders.java index 15d84b0192e7..223cfe6b410a 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueGetPropertiesHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueGetPropertiesHeaders.java @@ -65,7 +65,7 @@ public final class QueueGetPropertiesHeaders { * * @return the metadata value. */ - public Map metadata() { + public Map getMetadata() { return this.metadata; } @@ -75,7 +75,7 @@ public Map metadata() { * @param metadata the metadata value to set. * @return the QueueGetPropertiesHeaders object itself. */ - public QueueGetPropertiesHeaders metadata(Map metadata) { + public QueueGetPropertiesHeaders setMetadata(Map metadata) { this.metadata = metadata; return this; } @@ -87,7 +87,7 @@ public QueueGetPropertiesHeaders metadata(Map metadata) { * * @return the approximateMessagesCount value. */ - public Integer approximateMessagesCount() { + public Integer getApproximateMessagesCount() { return this.approximateMessagesCount; } @@ -100,7 +100,7 @@ public Integer approximateMessagesCount() { * set. * @return the QueueGetPropertiesHeaders object itself. */ - public QueueGetPropertiesHeaders approximateMessagesCount(Integer approximateMessagesCount) { + public QueueGetPropertiesHeaders setApproximateMessagesCount(Integer approximateMessagesCount) { this.approximateMessagesCount = approximateMessagesCount; return this; } @@ -111,7 +111,7 @@ public QueueGetPropertiesHeaders approximateMessagesCount(Integer approximateMes * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -122,7 +122,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the QueueGetPropertiesHeaders object itself. */ - public QueueGetPropertiesHeaders requestId(String requestId) { + public QueueGetPropertiesHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -134,7 +134,7 @@ public QueueGetPropertiesHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -146,7 +146,7 @@ public String version() { * @param version the version value to set. * @return the QueueGetPropertiesHeaders object itself. */ - public QueueGetPropertiesHeaders version(String version) { + public QueueGetPropertiesHeaders setVersion(String version) { this.version = version; return this; } @@ -157,11 +157,11 @@ public QueueGetPropertiesHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -171,7 +171,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the QueueGetPropertiesHeaders object itself. */ - public QueueGetPropertiesHeaders dateProperty(OffsetDateTime dateProperty) { + public QueueGetPropertiesHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -185,7 +185,7 @@ public QueueGetPropertiesHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -195,7 +195,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the QueueGetPropertiesHeaders object itself. */ - public QueueGetPropertiesHeaders errorCode(String errorCode) { + public QueueGetPropertiesHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueItem.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueItem.java index ea9ca80c5100..0c9f6d4b896a 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueItem.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueItem.java @@ -32,7 +32,7 @@ public final class QueueItem { * * @return the name value. */ - public String name() { + public String getName() { return this.name; } @@ -42,7 +42,7 @@ public String name() { * @param name the name value to set. * @return the QueueItem object itself. */ - public QueueItem name(String name) { + public QueueItem setName(String name) { this.name = name; return this; } @@ -52,7 +52,7 @@ public QueueItem name(String name) { * * @return the metadata value. */ - public Map metadata() { + public Map getMetadata() { return this.metadata; } @@ -62,7 +62,7 @@ public Map metadata() { * @param metadata the metadata value to set. * @return the QueueItem object itself. */ - public QueueItem metadata(Map metadata) { + public QueueItem setMetadata(Map metadata) { this.metadata = metadata; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueMessage.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueMessage.java index edd78cbfd5d3..9f2ef0807b72 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueMessage.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueMessage.java @@ -25,7 +25,7 @@ public final class QueueMessage { * * @return the messageText value. */ - public String messageText() { + public String getMessageText() { return this.messageText; } @@ -35,7 +35,7 @@ public String messageText() { * @param messageText the messageText value to set. * @return the QueueMessage object itself. */ - public QueueMessage messageText(String messageText) { + public QueueMessage setMessageText(String messageText) { this.messageText = messageText; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueProperties.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueProperties.java index bb343ea96bd2..f6d131846bc9 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueProperties.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueProperties.java @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. + package com.azure.storage.queue.models; import java.util.Map; @@ -25,14 +26,14 @@ public QueueProperties(Map metadata, int approximateMessagesCoun /** * @return the user-defined metadata associated with the queue */ - public Map metadata() { + public Map getMetadata() { return this.metadata; } /** * @return the approximate number of messages contained in the queue at the time of properties retrieval */ - public int approximateMessagesCount() { + public int getApproximateMessagesCount() { return approximateMessagesCount; } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueSetAccessPolicyHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueSetAccessPolicyHeaders.java index 672543a78f1b..5e4ddb30443f 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueSetAccessPolicyHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueSetAccessPolicyHeaders.java @@ -50,7 +50,7 @@ public final class QueueSetAccessPolicyHeaders { * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -61,7 +61,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the QueueSetAccessPolicyHeaders object itself. */ - public QueueSetAccessPolicyHeaders requestId(String requestId) { + public QueueSetAccessPolicyHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -73,7 +73,7 @@ public QueueSetAccessPolicyHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -85,7 +85,7 @@ public String version() { * @param version the version value to set. * @return the QueueSetAccessPolicyHeaders object itself. */ - public QueueSetAccessPolicyHeaders version(String version) { + public QueueSetAccessPolicyHeaders setVersion(String version) { this.version = version; return this; } @@ -96,11 +96,11 @@ public QueueSetAccessPolicyHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -110,7 +110,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the QueueSetAccessPolicyHeaders object itself. */ - public QueueSetAccessPolicyHeaders dateProperty(OffsetDateTime dateProperty) { + public QueueSetAccessPolicyHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -124,7 +124,7 @@ public QueueSetAccessPolicyHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -134,7 +134,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the QueueSetAccessPolicyHeaders object itself. */ - public QueueSetAccessPolicyHeaders errorCode(String errorCode) { + public QueueSetAccessPolicyHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueSetMetadataHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueSetMetadataHeaders.java index 4c1997da6277..6020ca38b36f 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueSetMetadataHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueSetMetadataHeaders.java @@ -50,7 +50,7 @@ public final class QueueSetMetadataHeaders { * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -61,7 +61,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the QueueSetMetadataHeaders object itself. */ - public QueueSetMetadataHeaders requestId(String requestId) { + public QueueSetMetadataHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -73,7 +73,7 @@ public QueueSetMetadataHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -85,7 +85,7 @@ public String version() { * @param version the version value to set. * @return the QueueSetMetadataHeaders object itself. */ - public QueueSetMetadataHeaders version(String version) { + public QueueSetMetadataHeaders setVersion(String version) { this.version = version; return this; } @@ -96,11 +96,11 @@ public QueueSetMetadataHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -110,7 +110,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the QueueSetMetadataHeaders object itself. */ - public QueueSetMetadataHeaders dateProperty(OffsetDateTime dateProperty) { + public QueueSetMetadataHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -124,7 +124,7 @@ public QueueSetMetadataHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -134,7 +134,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the QueueSetMetadataHeaders object itself. */ - public QueueSetMetadataHeaders errorCode(String errorCode) { + public QueueSetMetadataHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueuesGetAccessPolicyResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueuesGetAccessPolicyResponse.java index d2fa4cc44c29..46ffbf14ed25 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueuesGetAccessPolicyResponse.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueuesGetAccessPolicyResponse.java @@ -30,7 +30,7 @@ public QueuesGetAccessPolicyResponse(HttpRequest request, int statusCode, HttpHe * @return the deserialized response body. */ @Override - public List value() { - return super.value(); + public List getValue() { + return super.getValue(); } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueuesSegmentOptions.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueuesSegmentOptions.java index d58b2f71b8d0..bf3ff64ba53d 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueuesSegmentOptions.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueuesSegmentOptions.java @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. + package com.azure.storage.queue.models; import com.azure.storage.queue.QueueServiceAsyncClient; @@ -10,16 +11,16 @@ * *
      *
    • - * Providing {@link QueuesSegmentOptions#prefix() prefix} will filter {@link QueueItem queues} that begin + * Providing {@link QueuesSegmentOptions#getPrefix() prefix} will filter {@link QueueItem queues} that begin * with the prefix. *
    • *
    • - * Providing {@link QueuesSegmentOptions#maxResults() maxResults} will limit the number of {@link QueueItem queues} + * Providing {@link QueuesSegmentOptions#getMaxResults() maxResults} will limit the number of {@link QueueItem queues} * returned in a single page. *
    • *
    • - * Setting {@link QueuesSegmentOptions#includeMetadata() includeMetadata} to true will include the metadata of - * each {@link QueueItem queue}, if false {@link QueueItem#metadata() metadata} for each queue will be {@code null}. + * Setting {@link QueuesSegmentOptions#isIncludeMetadata() includeMetadata} to true will include the metadata of + * each {@link QueueItem queue}, if false {@link QueueItem#getMetadata()} metadata} for each queue will be {@code null}. *
    • *
    * @@ -36,7 +37,7 @@ public final class QueuesSegmentOptions { /** * @return the status of including metadata when listing queues */ - public boolean includeMetadata() { + public boolean isIncludeMetadata() { return includeMetadata; } @@ -46,7 +47,7 @@ public boolean includeMetadata() { * @param includeMetadata Flag indicating if metadata should be included in the listing * @return An updated QueuesSegmentOptions object */ - public QueuesSegmentOptions includeMetadata(boolean includeMetadata) { + public QueuesSegmentOptions setIncludeMetadata(boolean includeMetadata) { this.includeMetadata = includeMetadata; return this; } @@ -54,7 +55,7 @@ public QueuesSegmentOptions includeMetadata(boolean includeMetadata) { /** * @return the prefix the queue name must match to be included in the listing */ - public String prefix() { + public String getPrefix() { return prefix; } @@ -64,7 +65,7 @@ public String prefix() { * @param prefix The prefix that queues must start with to pass the filter * @return An updated QueuesSegmentOptions object */ - public QueuesSegmentOptions prefix(String prefix) { + public QueuesSegmentOptions setPrefix(String prefix) { this.prefix = prefix; return this; } @@ -72,7 +73,7 @@ public QueuesSegmentOptions prefix(String prefix) { /** * @return the maximum number of queues to include in a single response */ - public Integer maxResults() { + public Integer getMaxResults() { return maxResults; } @@ -82,7 +83,7 @@ public Integer maxResults() { * @param maxResults Maximum number of results to include in a single response * @return An updated QueuesSegmentOptions object */ - public QueuesSegmentOptions maxResults(Integer maxResults) { + public QueuesSegmentOptions setMaxResults(Integer maxResults) { this.maxResults = maxResults; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/RetentionPolicy.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/RetentionPolicy.java index ada0ae8d0e2c..65f2c83a32f5 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/RetentionPolicy.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/RetentionPolicy.java @@ -33,7 +33,7 @@ public final class RetentionPolicy { * * @return the enabled value. */ - public boolean enabled() { + public boolean isEnabled() { return this.enabled; } @@ -44,7 +44,7 @@ public boolean enabled() { * @param enabled the enabled value to set. * @return the RetentionPolicy object itself. */ - public RetentionPolicy enabled(boolean enabled) { + public RetentionPolicy setEnabled(boolean enabled) { this.enabled = enabled; return this; } @@ -56,7 +56,7 @@ public RetentionPolicy enabled(boolean enabled) { * * @return the days value. */ - public Integer days() { + public Integer getDays() { return this.days; } @@ -68,7 +68,7 @@ public Integer days() { * @param days the days value to set. * @return the RetentionPolicy object itself. */ - public RetentionPolicy days(Integer days) { + public RetentionPolicy setDays(Integer days) { this.days = days; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceGetPropertiesHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceGetPropertiesHeaders.java index 5c099801501f..6de7d985b231 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceGetPropertiesHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceGetPropertiesHeaders.java @@ -41,7 +41,7 @@ public final class ServiceGetPropertiesHeaders { * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -52,7 +52,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the ServiceGetPropertiesHeaders object itself. */ - public ServiceGetPropertiesHeaders requestId(String requestId) { + public ServiceGetPropertiesHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -64,7 +64,7 @@ public ServiceGetPropertiesHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -76,7 +76,7 @@ public String version() { * @param version the version value to set. * @return the ServiceGetPropertiesHeaders object itself. */ - public ServiceGetPropertiesHeaders version(String version) { + public ServiceGetPropertiesHeaders setVersion(String version) { this.version = version; return this; } @@ -86,7 +86,7 @@ public ServiceGetPropertiesHeaders version(String version) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -96,7 +96,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the ServiceGetPropertiesHeaders object itself. */ - public ServiceGetPropertiesHeaders errorCode(String errorCode) { + public ServiceGetPropertiesHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceGetStatisticsHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceGetStatisticsHeaders.java index 2dfaf92bbeaa..38dc7d94a441 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceGetStatisticsHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceGetStatisticsHeaders.java @@ -50,7 +50,7 @@ public final class ServiceGetStatisticsHeaders { * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -61,7 +61,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the ServiceGetStatisticsHeaders object itself. */ - public ServiceGetStatisticsHeaders requestId(String requestId) { + public ServiceGetStatisticsHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -73,7 +73,7 @@ public ServiceGetStatisticsHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -85,7 +85,7 @@ public String version() { * @param version the version value to set. * @return the ServiceGetStatisticsHeaders object itself. */ - public ServiceGetStatisticsHeaders version(String version) { + public ServiceGetStatisticsHeaders setVersion(String version) { this.version = version; return this; } @@ -96,11 +96,11 @@ public ServiceGetStatisticsHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -110,7 +110,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the ServiceGetStatisticsHeaders object itself. */ - public ServiceGetStatisticsHeaders dateProperty(OffsetDateTime dateProperty) { + public ServiceGetStatisticsHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -124,7 +124,7 @@ public ServiceGetStatisticsHeaders dateProperty(OffsetDateTime dateProperty) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -134,7 +134,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the ServiceGetStatisticsHeaders object itself. */ - public ServiceGetStatisticsHeaders errorCode(String errorCode) { + public ServiceGetStatisticsHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceListQueuesSegmentHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceListQueuesSegmentHeaders.java index 8670be5637ce..a8272ff64002 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceListQueuesSegmentHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceListQueuesSegmentHeaders.java @@ -50,7 +50,7 @@ public final class ServiceListQueuesSegmentHeaders { * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -61,7 +61,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the ServiceListQueuesSegmentHeaders object itself. */ - public ServiceListQueuesSegmentHeaders requestId(String requestId) { + public ServiceListQueuesSegmentHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -73,7 +73,7 @@ public ServiceListQueuesSegmentHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -85,7 +85,7 @@ public String version() { * @param version the version value to set. * @return the ServiceListQueuesSegmentHeaders object itself. */ - public ServiceListQueuesSegmentHeaders version(String version) { + public ServiceListQueuesSegmentHeaders setVersion(String version) { this.version = version; return this; } @@ -96,11 +96,11 @@ public ServiceListQueuesSegmentHeaders version(String version) { * * @return the dateProperty value. */ - public OffsetDateTime dateProperty() { + public OffsetDateTime getDateProperty() { if (this.dateProperty == null) { return null; } - return this.dateProperty.dateTime(); + return this.dateProperty.getDateTime(); } /** @@ -110,7 +110,7 @@ public OffsetDateTime dateProperty() { * @param dateProperty the dateProperty value to set. * @return the ServiceListQueuesSegmentHeaders object itself. */ - public ServiceListQueuesSegmentHeaders dateProperty(OffsetDateTime dateProperty) { + public ServiceListQueuesSegmentHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { @@ -124,7 +124,7 @@ public ServiceListQueuesSegmentHeaders dateProperty(OffsetDateTime dateProperty) * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -134,7 +134,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the ServiceListQueuesSegmentHeaders object itself. */ - public ServiceListQueuesSegmentHeaders errorCode(String errorCode) { + public ServiceListQueuesSegmentHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceSetPropertiesHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceSetPropertiesHeaders.java index 6ae6da4ef69b..f3d1e06629aa 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceSetPropertiesHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceSetPropertiesHeaders.java @@ -41,7 +41,7 @@ public final class ServiceSetPropertiesHeaders { * * @return the requestId value. */ - public String requestId() { + public String getRequestId() { return this.requestId; } @@ -52,7 +52,7 @@ public String requestId() { * @param requestId the requestId value to set. * @return the ServiceSetPropertiesHeaders object itself. */ - public ServiceSetPropertiesHeaders requestId(String requestId) { + public ServiceSetPropertiesHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -64,7 +64,7 @@ public ServiceSetPropertiesHeaders requestId(String requestId) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -76,7 +76,7 @@ public String version() { * @param version the version value to set. * @return the ServiceSetPropertiesHeaders object itself. */ - public ServiceSetPropertiesHeaders version(String version) { + public ServiceSetPropertiesHeaders setVersion(String version) { this.version = version; return this; } @@ -86,7 +86,7 @@ public ServiceSetPropertiesHeaders version(String version) { * * @return the errorCode value. */ - public String errorCode() { + public String getErrorCode() { return this.errorCode; } @@ -96,7 +96,7 @@ public String errorCode() { * @param errorCode the errorCode value to set. * @return the ServiceSetPropertiesHeaders object itself. */ - public ServiceSetPropertiesHeaders errorCode(String errorCode) { + public ServiceSetPropertiesHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServicesGetPropertiesResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServicesGetPropertiesResponse.java index 7374eddcc1b6..231f3e8385a0 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServicesGetPropertiesResponse.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServicesGetPropertiesResponse.java @@ -29,7 +29,7 @@ public ServicesGetPropertiesResponse(HttpRequest request, int statusCode, HttpHe * @return the deserialized response body. */ @Override - public StorageServiceProperties value() { - return super.value(); + public StorageServiceProperties getValue() { + return super.getValue(); } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServicesGetStatisticsResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServicesGetStatisticsResponse.java index 5c3538a95fec..c1989ada6d2a 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServicesGetStatisticsResponse.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServicesGetStatisticsResponse.java @@ -29,7 +29,7 @@ public ServicesGetStatisticsResponse(HttpRequest request, int statusCode, HttpHe * @return the deserialized response body. */ @Override - public StorageServiceStats value() { - return super.value(); + public StorageServiceStats getValue() { + return super.getValue(); } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServicesListQueuesSegmentResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServicesListQueuesSegmentResponse.java index e7bbf195f61b..d9d0c79a5e9e 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServicesListQueuesSegmentResponse.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServicesListQueuesSegmentResponse.java @@ -29,7 +29,7 @@ public ServicesListQueuesSegmentResponse(HttpRequest request, int statusCode, Ht * @return the deserialized response body. */ @Override - public ListQueuesSegmentResponse value() { - return super.value(); + public ListQueuesSegmentResponse getValue() { + return super.getValue(); } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/SignedIdentifier.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/SignedIdentifier.java index 56465abb7435..fa40eb1b3b34 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/SignedIdentifier.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/SignedIdentifier.java @@ -31,7 +31,7 @@ public final class SignedIdentifier { * * @return the id value. */ - public String id() { + public String getId() { return this.id; } @@ -41,7 +41,7 @@ public String id() { * @param id the id value to set. * @return the SignedIdentifier object itself. */ - public SignedIdentifier id(String id) { + public SignedIdentifier setId(String id) { this.id = id; return this; } @@ -51,7 +51,7 @@ public SignedIdentifier id(String id) { * * @return the accessPolicy value. */ - public AccessPolicy accessPolicy() { + public AccessPolicy getAccessPolicy() { return this.accessPolicy; } @@ -61,7 +61,7 @@ public AccessPolicy accessPolicy() { * @param accessPolicy the accessPolicy value to set. * @return the SignedIdentifier object itself. */ - public SignedIdentifier accessPolicy(AccessPolicy accessPolicy) { + public SignedIdentifier setAccessPolicy(AccessPolicy accessPolicy) { this.accessPolicy = accessPolicy; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageError.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageError.java index b86ff0fd7e3f..dfe0cea35588 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageError.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageError.java @@ -25,7 +25,7 @@ public final class StorageError { * * @return the message value. */ - public String message() { + public String getMessage() { return this.message; } @@ -35,7 +35,7 @@ public String message() { * @param message the message value to set. * @return the StorageError object itself. */ - public StorageError message(String message) { + public StorageError setMessage(String message) { this.message = message; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageErrorException.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageErrorException.java index 2459f6911169..fa86c3e90f68 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageErrorException.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageErrorException.java @@ -33,7 +33,7 @@ public StorageErrorException(String message, HttpResponse response, StorageError } @Override - public StorageError value() { - return (StorageError) super.value(); + public StorageError getValue() { + return (StorageError) super.getValue(); } } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageException.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageException.java new file mode 100644 index 000000000000..18eb0f3f4186 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageException.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.queue.models; + +import com.azure.core.exception.HttpResponseException; + +/** + * A {@code StorageException} is thrown whenever Azure Storage successfully returns an error code that is not 200-level. + * Users can inspect the status code and error code to determine the cause of the error response. The exception message + * may also contain more detailed information depending on the type of error. The user may also inspect the raw HTTP + * response or call toString to get the full payload of the error response if present. + * Note that even some expected "errors" will be thrown as a {@code StorageException}. For example, some users may + * perform a getProperties request on an entity to determine whether it exists or not. If it does not exists, an + * exception will be thrown even though this may be considered an expected indication of absence in this case. + * + *

    Sample Code

    + *

    For more samples, please see the sample file

    + */ +public final class StorageException extends HttpResponseException { + private static final String ERROR_CODE = "x-ms-error-code"; + + private final StorageErrorCode errorCode; + private final String message; + + /** + * Constructs a {@code StorageException} from the given {@link StorageErrorException}. + * + * @param e The StorageErrorException returned from the service. + * @param responseBody The exception body. + */ + public StorageException(StorageErrorException e, String responseBody) { + super(e.getMessage(), e.getResponse(), e); + this.errorCode = StorageErrorCode.fromString(e.getResponse().getHeaders().value(ERROR_CODE)); + this.message = responseBody; + } + + /** + * @return The error code returned by the service. + */ + public StorageErrorCode getErrorCode() { + return this.errorCode; + } + + /** + * @return The message returned by the service. + */ + public String getServiceMessage() { + return this.message; + } + + /** + * @return The status code on the response. + */ + public int getStatusCode() { + return super.getResponse().getStatusCode(); + } +} diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageServiceProperties.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageServiceProperties.java index 8a607a5a4494..ffd4294e30f5 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageServiceProperties.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageServiceProperties.java @@ -59,7 +59,7 @@ private CorsWrapper(@JacksonXmlProperty(localName = "CorsRule") List i * * @return the logging value. */ - public Logging logging() { + public Logging getLogging() { return this.logging; } @@ -69,7 +69,7 @@ public Logging logging() { * @param logging the logging value to set. * @return the StorageServiceProperties object itself. */ - public StorageServiceProperties logging(Logging logging) { + public StorageServiceProperties setLogging(Logging logging) { this.logging = logging; return this; } @@ -80,7 +80,7 @@ public StorageServiceProperties logging(Logging logging) { * * @return the hourMetrics value. */ - public Metrics hourMetrics() { + public Metrics getHourMetrics() { return this.hourMetrics; } @@ -91,7 +91,7 @@ public Metrics hourMetrics() { * @param hourMetrics the hourMetrics value to set. * @return the StorageServiceProperties object itself. */ - public StorageServiceProperties hourMetrics(Metrics hourMetrics) { + public StorageServiceProperties setHourMetrics(Metrics hourMetrics) { this.hourMetrics = hourMetrics; return this; } @@ -102,7 +102,7 @@ public StorageServiceProperties hourMetrics(Metrics hourMetrics) { * * @return the minuteMetrics value. */ - public Metrics minuteMetrics() { + public Metrics getMinuteMetrics() { return this.minuteMetrics; } @@ -113,7 +113,7 @@ public Metrics minuteMetrics() { * @param minuteMetrics the minuteMetrics value to set. * @return the StorageServiceProperties object itself. */ - public StorageServiceProperties minuteMetrics(Metrics minuteMetrics) { + public StorageServiceProperties setMinuteMetrics(Metrics minuteMetrics) { this.minuteMetrics = minuteMetrics; return this; } @@ -123,7 +123,7 @@ public StorageServiceProperties minuteMetrics(Metrics minuteMetrics) { * * @return the cors value. */ - public List cors() { + public List getCors() { if (this.cors == null) { this.cors = new CorsWrapper(new ArrayList()); } @@ -136,7 +136,7 @@ public List cors() { * @param cors the cors value to set. * @return the StorageServiceProperties object itself. */ - public StorageServiceProperties cors(List cors) { + public StorageServiceProperties setCors(List cors) { this.cors = new CorsWrapper(cors); return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageServiceStats.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageServiceStats.java index 6e45d422538f..26b6d3b680fa 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageServiceStats.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageServiceStats.java @@ -26,7 +26,7 @@ public final class StorageServiceStats { * * @return the geoReplication value. */ - public GeoReplication geoReplication() { + public GeoReplication getGeoReplication() { return this.geoReplication; } @@ -37,7 +37,7 @@ public GeoReplication geoReplication() { * @param geoReplication the geoReplication value to set. * @return the StorageServiceStats object itself. */ - public StorageServiceStats geoReplication(GeoReplication geoReplication) { + public StorageServiceStats setGeoReplication(GeoReplication geoReplication) { this.geoReplication = geoReplication; return this; } diff --git a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/UpdatedMessage.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/UpdatedMessage.java index fa6a4d597015..53e4ac9459bf 100644 --- a/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/UpdatedMessage.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/UpdatedMessage.java @@ -26,14 +26,14 @@ public UpdatedMessage(String popReceipt, OffsetDateTime timeNextVisible) { /** * @return the unique identifier used to verify that the operation is allowed on the message */ - public String popReceipt() { + public String getPopReceipt() { return popReceipt; } /** * @return the next time the message will be visible to other operations in the queue */ - public OffsetDateTime timeNextVisible() { + public OffsetDateTime getTimeNextVisible() { return timeNextVisible; } } diff --git a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/AsyncSamples.java b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/AsyncSamples.java index 39cc17db37ca..1fbb148d661c 100644 --- a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/AsyncSamples.java +++ b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/AsyncSamples.java @@ -29,7 +29,7 @@ public static void main(String[] args) { .then(queueAsyncClient.enqueueMessage("This is message 2")) .subscribe( response -> { - System.out.println("Message successfully equeueed by queueAsyncClient. Message id:" + response.value().messageId()); + System.out.println("Message successfully equeueed by queueAsyncClient. Message id:" + response.getMessageId()); }, err -> { System.out.println("Error thrown when enqueue the message. Error message: " + err.getMessage()); diff --git a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/MessageSamples.java b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/MessageSamples.java index 1372d45b9e80..8f4910f1b9bf 100644 --- a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/MessageSamples.java +++ b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/MessageSamples.java @@ -3,9 +3,7 @@ package com.azure.storage.queue; -import com.azure.core.http.rest.Response; import com.azure.storage.queue.models.DequeuedMessage; - import java.time.Duration; import static com.azure.storage.queue.SampleHelper.generateRandomName; @@ -25,9 +23,7 @@ public static void main(String[] args) throws InterruptedException { QueueServiceClient queueServiceClient = new QueueServiceClientBuilder().endpoint(queueServiceURL).buildClient(); // Create a queue client - Response queueClientResponse = queueServiceClient.createQueue(generateRandomName("enqueue", 16)); - QueueClient queueClient = queueClientResponse.value(); - // Using queue client to enqueue several "Hello World" messages into queue. + QueueClient queueClient = queueServiceClient.createQueue(generateRandomName("enqueue", 16)); for (int i = 0; i < 3; i++) { queueClient.enqueueMessage("Hello World"); } @@ -36,20 +32,20 @@ public static void main(String[] args) throws InterruptedException { // TODO // Get the total count of msg in the queue - int count = queueClient.getProperties().value().approximateMessagesCount(); + int count = queueClient.getProperties().getApproximateMessagesCount(); // Peek all messages in queue. It is supposed to print "Hello World" 3 times. - queueClient.peekMessages(count).forEach( + queueClient.peekMessages(count, null, null).forEach( peekedMessage -> { - System.out.println("Here is the msg: " + peekedMessage.messageText()); + System.out.println("Here is the msg: " + peekedMessage.getMessageText()); } ); // Dequeue all messages in queue and update the message "Hello World" to Hello, world!" - queueClient.dequeueMessages(count, Duration.ZERO).forEach( + queueClient.dequeueMessages(count, Duration.ofSeconds(30), Duration.ofSeconds(50), null).forEach( queueMessage -> { String msgToReplace = String.format("Hello, world!"); - queueClient.updateMessage(queueMessage.messageId(), msgToReplace, queueMessage.popReceipt(), Duration.ZERO); + queueClient.updateMessage(queueMessage.getMessageId(), msgToReplace, queueMessage.getPopReceipt(), Duration.ZERO); } ); @@ -57,7 +53,7 @@ public static void main(String[] args) throws InterruptedException { // Since there is no invisible time for above dequeue, the following if condition should be true. if (queueClient.dequeueMessages().iterator().hasNext()) { DequeuedMessage queueMessage = queueClient.dequeueMessages().iterator().next(); - queueClient.deleteMessage(queueMessage.messageId(), queueMessage.popReceipt()); + queueClient.deleteMessage(queueMessage.getMessageId(), queueMessage.getPopReceipt()); } else { System.out.println("OOps, the messages disappear!"); } 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 new file mode 100644 index 000000000000..f7c24db44e09 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueAsyncJavaDocCodeSamples.java @@ -0,0 +1,512 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.Utility; +import com.azure.storage.common.credentials.SASTokenCredential; +import com.azure.storage.common.credentials.SharedKeyCredential; +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; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +/** + * Contains code snippets when generating javadocs through doclets for {@link QueueAsyncClient}. + */ + +public class QueueAsyncJavaDocCodeSamples { + + private QueueAsyncClient client = createAsyncClientWithSASToken(); + + /** + * Generates code sample for creating a {@link QueueAsyncClient}. + */ + public void buildQueueAsyncClient() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.instantiation + QueueAsyncClient client = new QueueClientBuilder() + .connectionString("connectionstring") + .endpoint("endpoint") + .buildAsyncClient(); + // END: com.azure.storage.queue.queueAsyncClient.instantiation + } + + /** + * Generates code sample for creating a {@link QueueAsyncClient} with {@link SASTokenCredential} + * + * @return An instance of {@link QueueAsyncClient} + */ + public QueueAsyncClient createAsyncClientWithSASToken() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.instantiation.sastoken + QueueAsyncClient queueAsyncClient = new QueueClientBuilder() + .endpoint("https://{accountName}.queue.core.windows.net?{SASToken}") + .buildAsyncClient(); + // END: com.azure.storage.queue.queueAsyncClient.instantiation.sastoken + return queueAsyncClient; + } + + /** + * Generates code sample for creating a {@link QueueAsyncClient} with {@link SASTokenCredential} + * + * @return An instance of {@link QueueAsyncClient} + */ + public QueueAsyncClient createAsyncClientWithCredential() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.instantiation.credential + QueueAsyncClient queueAsyncClient = new QueueClientBuilder() + .endpoint("https://{accountName}.queue.core.windows.net") + .queueName("myqueue") + .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("{SASTokenQueryParams}"))) + .buildAsyncClient(); + // END: com.azure.storage.queue.queueAsyncClient.instantiation.credential + return queueAsyncClient; + } + + /** + * Generates code sample for creating a {@link QueueAsyncClient} with {@code connectionString} which turns into + * {@link SharedKeyCredential} + * + * @return An instance of {@link QueueAsyncClient} + */ + public QueueAsyncClient createAsyncClientWithConnectionString() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.instantiation.connectionstring + String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};" + + "AccountKey={key};EndpointSuffix={core.windows.net}"; + QueueAsyncClient queueAsyncClient = new QueueClientBuilder() + .connectionString(connectionString) + .buildAsyncClient(); + // END: com.azure.storage.queue.queueAsyncClient.instantiation.connectionstring + return queueAsyncClient; + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#create()} + */ + public void createQueueAsync() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.create + client.create().subscribe( + response -> { + }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the queue!") + ); + // END: com.azure.storage.queue.queueAsyncClient.create + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#create()} + */ + public void createQueueAsyncMaxOverload() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.create#map + client.create().subscribe( + response -> { + }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the queue!") + ); + // END: com.azure.storage.queue.queueAsyncClient.create#map + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#createWithResponse(Map)} + */ + public void createWithResponse() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.createWithResponse#map + client.createWithResponse(Collections.singletonMap("queue", "metadataMap")).subscribe( + response -> System.out.println("Complete creating the queue with status code:" + response.getStatusCode()), + error -> System.err.print(error.toString()) + ); + // END: com.azure.storage.queue.queueAsyncClient.createWithResponse#map + } + + + /** + * Generates a code sample for using {@link QueueAsyncClient#enqueueMessage(String)} + */ + public void enqueueMessageAsync() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.enqueueMessage#string + client.enqueueMessage("Hello, Azure").subscribe( + response -> { + }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete enqueuing the message!") + ); + // END: com.azure.storage.queue.queueAsyncClient.enqueueMessage#string + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#enqueueMessageWithResponse(String, Duration, + * Duration)} + */ + public void enqueueMessageAsyncWithTimeoutOverload() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.enqueueMessageWithResponse#string-duration-duration + client.enqueueMessageWithResponse("Hello, Azure", + Duration.ofSeconds(5), null).subscribe( + response -> System.out.printf("Message %s expires at %s", response.getValue().getMessageId(), + response.getValue().getExpirationTime()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete enqueuing the message!") + ); + // END: com.azure.storage.queue.queueAsyncClient.enqueueMessageWithResponse#string-duration-duration + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#enqueueMessageWithResponse(String, Duration, + * Duration)} + */ + public void enqueueMessageAsyncWithLiveTimeOverload() { + // BEGIN: com.azure.storage.queue.QueueAsyncClient.enqueueMessageWithResponse-liveTime#String-Duration-Duration + client.enqueueMessageWithResponse("Goodbye, Azure", + null, Duration.ofSeconds(5)).subscribe( + response -> System.out.printf("Message %s expires at %s", response.getValue().getMessageId(), + response.getValue().getExpirationTime()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete enqueuing the message!") + ); + // END: com.azure.storage.queue.QueueAsyncClient.enqueueMessageWithResponse-liveTime#String-Duration-Duration + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#dequeueMessages()} + */ + public void dequeueMessageAsync() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.dequeueMessages + client.dequeueMessages().subscribe( + dequeuedMessage -> System.out.println("The message got from dequeue operation: " + + dequeuedMessage.getMessageText()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete dequeuing the message!") + ); + // END: com.azure.storage.queue.queueAsyncClient.dequeueMessages + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#dequeueMessages(Integer)} + */ + public void dequeueMessageAsyncWithOverload() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.dequeueMessages#integer + client.dequeueMessages(5).subscribe( + dequeuedMessage -> System.out.println("The message got from dequeue operation: " + + dequeuedMessage.getMessageText()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete dequeuing the message!") + ); + // END: com.azure.storage.queue.queueAsyncClient.dequeueMessages#integer + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#dequeueMessages(Integer, Duration)} + */ + public void dequeueMessageAsyncMaxOverload() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.dequeueMessages#integer-duration + client.dequeueMessages(5, Duration.ofSeconds(60)) + .subscribe( + dequeuedMessage -> System.out.println("The message got from dequeue operation: " + + dequeuedMessage.getMessageText()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete dequeuing the message!") + ); + // END: com.azure.storage.queue.queueAsyncClient.dequeueMessages#integer-duration + } + + + /** + * Generates a code sample for using {@link QueueAsyncClient#peekMessages()} + */ + public void peekMessageAsync() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.peekMessages + client.peekMessages().subscribe( + peekMessages -> System.out.println("The message got from peek operation: " + peekMessages.getMessageText()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete peeking the message!") + ); + // END: com.azure.storage.queue.queueAsyncClient.peekMessages + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#peekMessages(Integer)} + */ + public void peekMessageAsyncMaxOverload() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.peekMessages#integer + client.peekMessages(5).subscribe( + peekMessage -> System.out.printf("Peeked message %s has been dequeued %d times", + peekMessage.getMessageId(), peekMessage.getDequeueCount()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete peeking the message!") + ); + // END: com.azure.storage.queue.queueAsyncClient.peekMessages#integer + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#updateMessage(String, String, String, Duration)} + */ + public void updateMessageAsync() { + // BEGIN: com.azure.storage.queue.QueueAsyncClient.updateMessage#String-String-String-Duration + client.dequeueMessages().subscribe( + dequeuedMessage -> { + client.updateMessage("newText", dequeuedMessage.getMessageId(), + dequeuedMessage.getPopReceipt(), null).subscribe( + response -> { + }, + updateError -> System.err.print(updateError.toString()), + () -> System.out.println("Complete updating the message!") + ); + }, + dequeueError -> System.err.print(dequeueError.toString()), + () -> System.out.println("Complete dequeueing the message!") + ); + // END: com.azure.storage.queue.QueueAsyncClient.updateMessage#String-String-String-Duration + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#updateMessageWithResponse(String, String, String, + * Duration)} + */ + public void updateMessageWithResponse() { + // BEGIN: com.azure.storage.queue.QueueAsyncClient.updateMessageWithResponse#String-String-String-Duration + client.dequeueMessages().subscribe( + dequeuedMessage -> { + client.updateMessageWithResponse("newText", dequeuedMessage.getMessageId(), + dequeuedMessage.getPopReceipt(), null).subscribe( + response -> System.out.println("Complete updating the message with status code:" + + response.getStatusCode()), + updateError -> System.err.print(updateError.toString()), + () -> System.out.println("Complete updating the message!") + ); + }, + dequeueError -> System.err.print(dequeueError.toString()), + () -> System.out.println("Complete dequeueing the message!") + ); + // END: com.azure.storage.queue.QueueAsyncClient.updateMessageWithResponse#String-String-String-Duration + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#deleteMessage(String, String)} + */ + public void deleteMessageAsync() { + // BEGIN: com.azure.storage.queue.QueueAsyncClient.deleteMessage#String-String + client.dequeueMessages().subscribe( + dequeuedMessage -> { + client.deleteMessage(dequeuedMessage.getMessageId(), dequeuedMessage.getPopReceipt()).subscribe( + response -> { + }, + deleteError -> System.err.print(deleteError.toString()), + () -> System.out.println("Complete deleting the message!") + ); + }, + dequeueError -> System.err.print(dequeueError.toString()), + () -> System.out.println("Complete dequeueing the message!") + ); + // END: com.azure.storage.queue.QueueAsyncClient.deleteMessage#String-String + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#deleteMessageWithResponse(String, String)} + */ + public void deleteMessageWithResponse() { + // BEGIN: com.azure.storage.queue.QueueAsyncClient.deleteMessageWithResponse#String-String + client.dequeueMessages().subscribe( + dequeuedMessage -> { + client.deleteMessageWithResponse(dequeuedMessage.getMessageId(), dequeuedMessage.getPopReceipt()) + .subscribe( + response -> System.out.println("Complete deleting the message with status code: " + + response.getStatusCode()), + deleteError -> System.err.print(deleteError.toString()), + () -> System.out.println("Complete deleting the message!") + ); + }, + dequeueError -> System.err.print(dequeueError.toString()), + () -> System.out.println("Complete dequeueing the message!") + ); + // END: com.azure.storage.queue.QueueAsyncClient.deleteMessageWithResponse#String-String + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#delete()} + */ + public void deleteQueueAsync() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.delete + client.delete().doOnSuccess( + response -> System.out.println("Deleting the queue completed.") + ); + // END: com.azure.storage.queue.queueAsyncClient.delete + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#deleteWithResponse()} + */ + public void deleteWithResponse() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.deleteWithResponse + client.deleteWithResponse().subscribe( + response -> System.out.println("Deleting the queue completed with status code: " + response.getStatusCode()) + ); + // END: com.azure.storage.queue.queueAsyncClient.deleteWithResponse + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#getProperties()} + */ + public void getPropertiesAsync() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.getProperties + client.getProperties() + .subscribe(properties -> { + System.out.printf("Metadata: %s, Approximate message count: %d", properties.getMetadata(), + properties.getApproximateMessagesCount()); + }); + // END: com.azure.storage.queue.queueAsyncClient.getProperties + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#getProperties()} + */ + public void getPropertiesWithResponse() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.getPropertiesWithResponse + client.getPropertiesWithResponse() + .subscribe(response -> { + QueueProperties properties = response.getValue(); + System.out.printf("Metadata: %s, Approximate message count: %d", properties.getMetadata(), + properties.getApproximateMessagesCount()); + }); + // END: com.azure.storage.queue.queueAsyncClient.getPropertiesWithResponse + } + + /** + * Generate a code sample for using {@link QueueAsyncClient#setMetadata(Map)} to set metadata. + */ + public void setMetadataAsync() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.setMetadata#map + client.setMetadata(Collections.singletonMap("queue", "metadataMap")) + .subscribe(response -> System.out.println("Setting metadata completed.")); + // END: com.azure.storage.queue.queueAsyncClient.setMetadata#map + } + + /** + * Generate a code sample for using {@link QueueAsyncClient#setMetadataWithResponse(Map)} to set metadata. + */ + public void setMetadataWithResponse() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.setMetadataWithResponse#map + client.setMetadataWithResponse(Collections.singletonMap("queue", "metadataMap")) + .subscribe(response -> System.out.printf("Setting metadata completed with status code %d", + response.getStatusCode())); + // END: com.azure.storage.queue.queueAsyncClient.setMetadataWithResponse#map + } + + /** + * Generate a code sample for using {@link QueueAsyncClient#setMetadata(Map)} to clear metadata. + */ + public void clearMetadataAsync() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.clearMetadata#map + client.setMetadata(null) + .subscribe(response -> System.out.printf("Clearing metadata completed.")); + // END: com.azure.storage.queue.queueAsyncClient.clearMetadata#map + } + + /** + * Generate a code sample for using {@link QueueAsyncClient#setMetadata(Map)} to clear metadata. + */ + public void clearMetadataWithResponse() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.clearMetadataWithResponse#map + client.setMetadataWithResponse(null) + .subscribe(response -> System.out.printf("Clearing metadata completed with status code %d", + response.getStatusCode())); + // END: com.azure.storage.queue.queueAsyncClient.clearMetadataWithResponse#map + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#getAccessPolicy()} + */ + public void getAccessPolicyAsync() { + + // BEGIN: com.azure.storage.queue.queueAsyncClient.getAccessPolicy + client.getAccessPolicy() + .subscribe(result -> System.out.printf("Access policy %s allows these permissions: %s", + result.getId(), result.getAccessPolicy().getPermission())); + // END: com.azure.storage.queue.queueAsyncClient.getAccessPolicy + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#setAccessPolicyWithResponse(List)} + */ + public void setAccessPolicyWithResponse() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.QueueAsyncClient.setAccessPolicyWithResponse#List + AccessPolicy accessPolicy = new AccessPolicy().setPermission("r") + .setStart(OffsetDateTime.now(ZoneOffset.UTC)) + .setExpiry(OffsetDateTime.now(ZoneOffset.UTC).plusDays(10)); + + SignedIdentifier permission = new SignedIdentifier().setId("mypolicy").setAccessPolicy(accessPolicy); + client.setAccessPolicyWithResponse(Collections.singletonList(permission)) + .subscribe(response -> System.out.printf("Setting access policies completed with status code %d", + response.getStatusCode())); + // END: com.azure.storage.queue.QueueAsyncClient.setAccessPolicyWithResponse#List + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#setAccessPolicy(List)} + */ + public void setAccessPolicyAsync() { + QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.queue.QueueAsyncClient.setAccessPolicy#List + AccessPolicy accessPolicy = new AccessPolicy().setPermission("r") + .setStart(OffsetDateTime.now(ZoneOffset.UTC)) + .setExpiry(OffsetDateTime.now(ZoneOffset.UTC).plusDays(10)); + + SignedIdentifier permission = new SignedIdentifier().setId("mypolicy").setAccessPolicy(accessPolicy); + client.setAccessPolicy(Collections.singletonList(permission)) + .subscribe(response -> System.out.println("Setting access policies completed.")); + // END: com.azure.storage.queue.QueueAsyncClient.setAccessPolicy#List + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#clearMessagesWithResponse()} + */ + public void clearMessagesWithResponse() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.clearMessagesWithResponse + client.clearMessagesWithResponse().doOnSuccess( + response -> System.out.println("Clearing messages completed with status code: " + response.getStatusCode()) + ); + // END: com.azure.storage.queue.queueAsyncClient.clearMessagesWithResponse + } + + /** + * Generates a code sample for using {@link QueueAsyncClient#clearMessages()} + */ + public void clearMessagesAsync() { + // BEGIN: com.azure.storage.queue.queueAsyncClient.clearMessages + client.clearMessages().subscribe( + response -> System.out.println("Clearing messages completed.")); + // 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() + .setRead(true) + .setAdd(true) + .setUpdate(true) + .setProcess(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 + } +} diff --git a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueExceptionSamples.java b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueExceptionSamples.java index d0ee4c8f2aed..49a70b1a73fd 100644 --- a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueExceptionSamples.java +++ b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueExceptionSamples.java @@ -4,17 +4,22 @@ package com.azure.storage.queue; import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; import com.azure.storage.queue.models.StorageErrorCode; -import com.azure.storage.queue.models.StorageErrorException; +import com.azure.storage.queue.models.StorageException; + +import java.time.Duration; import static com.azure.storage.queue.SampleHelper.generateRandomName; public class QueueExceptionSamples { + private static final String ACCOUNT_NAME = System.getenv("AZURE_STORAGE_ACCOUNT_NAME"); private static final String SAS_TOKEN = System.getenv("PRIMARY_SAS_TOKEN"); /** * The main method shows how to handle the storage exception. + * * @param args No args needed for the main method. * @throws RuntimeException If queueServiceClient failed to create a queue. */ @@ -26,24 +31,25 @@ public static void main(String[] args) { // Create queue client. Response queueClientResponse; try { - queueClientResponse = queueServiceClient.createQueue(generateRandomName("delete-not-exist", 16)); - System.out.println("Successfully create the queue! Status code: " + String.valueOf(queueClientResponse.statusCode())); - } catch (StorageErrorException e) { - System.out.println(String.format("Error creating a queue. Error message: %s", e.value().message())); + queueClientResponse = queueServiceClient.createQueueWithResponse(generateRandomName("delete-not-exist", + 16), null, Duration.ofSeconds(1), new Context("key1", "value1")); + System.out.println("Successfully create the queue! Status code: " + queueClientResponse.getStatusCode()); + } catch (StorageException e) { + System.out.println(String.format("Error creating a queue. Error message: %s", e.getServiceMessage())); throw new RuntimeException(e); } - QueueClient queueClient = queueClientResponse.value(); + QueueClient queueClient = queueClientResponse.getValue(); queueClient.enqueueMessage("Hello, message 1!"); queueClient.enqueueMessage("Hello, message 2!"); // Delete message with wrong message id. try { - queueClientResponse.value().dequeueMessages().forEach( + queueClientResponse.getValue().dequeueMessages().forEach( msg -> { - queueClient.deleteMessage("wrong id", msg.popReceipt()); + queueClient.deleteMessage("wrong id", msg.getPopReceipt()); } ); - } catch (StorageErrorException e) { + } catch (StorageException e) { if (e.getMessage().contains(StorageErrorCode.MESSAGE_NOT_FOUND.toString())) { System.out.println("This is the error expected to throw"); } else { @@ -55,10 +61,10 @@ public static void main(String[] args) { try { queueClient.dequeueMessages().forEach( msg -> { - queueClient.deleteMessage(msg.messageId(), "Wrong Pop Receipt"); + queueClient.deleteMessage(msg.getMessageId(), "Wrong Pop Receipt"); } ); - } catch (StorageErrorException e) { + } catch (StorageException e) { if (e.getMessage().contains(StorageErrorCode.INVALID_QUERY_PARAMETER_VALUE.toString())) { System.out.println("This is the error expected to throw"); } else { 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 2a140935fbc2..d26c21ef3672 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,6 +4,10 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.VoidResponse; +import com.azure.storage.common.Constants; +import com.azure.storage.common.IPRange; +import com.azure.storage.common.SASProtocol; +import com.azure.core.util.Context; import com.azure.storage.common.Utility; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; @@ -13,7 +17,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; @@ -22,10 +25,15 @@ import java.util.Map; /** - * Contains code snippets when generating javadocs through doclets for {@link QueueClient} and {@link QueueAsyncClient}. + * Contains code snippets when generating javadocs through doclets for {@link QueueClient}. */ public class QueueJavaDocCodeSamples { + + private String key1 = "key1"; + private String value1 = "val1"; + private QueueClient client = createClientWithSASToken(); + /** * Generates code sample for creating a {@link QueueClient}. */ @@ -38,630 +46,426 @@ public void buildQueueClient() { // END: com.azure.storage.queue.queueClient.instantiation } - /** - * Generates code sample for creating a {@link QueueAsyncClient}. - */ - public void buildQueueAsyncClient() { - // BEGIN: com.azure.storage.queue.queueAsyncClient.instantiation - QueueAsyncClient client = new QueueClientBuilder() - .connectionString("connectionstring") - .endpoint("endpoint") - .buildAsyncClient(); - // END: com.azure.storage.queue.queueAsyncClient.instantiation - } - /** * Generates code sample for creating a {@link QueueClient} with {@link QueueClient} + * * @return An instance of {@link QueueClient} */ public QueueClient createClientWithSASToken() { // BEGIN: com.azure.storage.queue.queueClient.instantiation.sastoken - QueueClient queueClient = new QueueClientBuilder() + QueueClient client = new QueueClientBuilder() .endpoint("https://${accountName}.queue.core.windows.net?${SASToken}") .buildClient(); // END: com.azure.storage.queue.queueClient.instantiation.sastoken - return queueClient; - } - - /** - * Generates code sample for creating a {@link QueueAsyncClient} with {@link SASTokenCredential} - * @return An instance of {@link QueueAsyncClient} - */ - public QueueAsyncClient createAsyncClientWithSASToken() { - // BEGIN: com.azure.storage.queue.queueAsyncClient.instantiation.sastoken - QueueAsyncClient queueAsyncClient = new QueueClientBuilder() - .endpoint("https://{accountName}.queue.core.windows.net?{SASToken}") - .buildAsyncClient(); - // END: com.azure.storage.queue.queueAsyncClient.instantiation.sastoken - return queueAsyncClient; + return client; } /** * Generates code sample for creating a {@link QueueClient} with {@link SASTokenCredential} + * * @return An instance of {@link QueueClient} */ public QueueClient createClientWithCredential() { // BEGIN: com.azure.storage.queue.queueClient.instantiation.credential - QueueClient queueClient = new QueueClientBuilder() + QueueClient client = new QueueClientBuilder() .endpoint("https://${accountName}.queue.core.windows.net") .queueName("myqueue") .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("{SASTokenQueryParams}"))) .buildClient(); // END: com.azure.storage.queue.queueClient.instantiation.credential - return queueClient; - } - - /** - * Generates code sample for creating a {@link QueueAsyncClient} with {@link SASTokenCredential} - * @return An instance of {@link QueueAsyncClient} - */ - public QueueAsyncClient createAsyncClientWithCredential() { - // BEGIN: com.azure.storage.queue.queueAsyncClient.instantiation.credential - QueueAsyncClient queueAsyncClient = new QueueClientBuilder() - .endpoint("https://{accountName}.queue.core.windows.net") - .queueName("myqueue") - .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("{SASTokenQueryParams}"))) - .buildAsyncClient(); - // END: com.azure.storage.queue.queueAsyncClient.instantiation.credential - return queueAsyncClient; + return client; } /** - * Generates code sample for creating a {@link QueueClient} with {@code connectionString} which turns into {@link SharedKeyCredential} + * Generates code sample for creating a {@link QueueClient} with {@code connectionString} which turns into {@link + * SharedKeyCredential} + * * @return An instance of {@link QueueClient} */ public QueueClient createClientWithConnectionString() { // BEGIN: com.azure.storage.queue.queueClient.instantiation.connectionstring String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};" - + "AccountKey={key};EndpointSuffix={core.windows.net}"; - QueueClient queueClient = new QueueClientBuilder() + + "AccountKey={key};EndpointSuffix={core.windows.net}"; + QueueClient client = new QueueClientBuilder() .connectionString(connectionString) .buildClient(); // END: com.azure.storage.queue.queueClient.instantiation.connectionstring - return queueClient; - } - - /** - * Generates code sample for creating a {@link QueueAsyncClient} with {@code connectionString} which turns into {@link SharedKeyCredential} - * @return An instance of {@link QueueAsyncClient} - */ - public QueueAsyncClient createAsyncClientWithConnectionString() { - // BEGIN: com.azure.storage.queue.queueAsyncClient.instantiation.connectionstring - String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};" - + "AccountKey={key};EndpointSuffix={core.windows.net}"; - QueueAsyncClient queueAsyncClient = new QueueClientBuilder() - .connectionString(connectionString) - .buildAsyncClient(); - // END: com.azure.storage.queue.queueAsyncClient.instantiation.connectionstring - return queueAsyncClient; + return client; } /** * Generates a code sample for using {@link QueueClient#create()} */ public void createQueue() { - QueueClient queueClient = createClientWithSASToken(); // BEGIN: com.azure.storage.queue.queueClient.create - VoidResponse response = queueClient.create(); - System.out.println("Complete creating queue with status code: " + response.statusCode()); + client.create(); + System.out.println("Complete creating queue."); // END: com.azure.storage.queue.queueClient.create } /** - * Generates a code sample for using {@link QueueAsyncClient#create()} - */ - public void createQueueAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.create - queueAsyncClient.create().subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the queue!") - ); - // END: com.azure.storage.queue.queueAsyncClient.create - } - - /** - * Generates a code sample for using {@link QueueClient#create(Map)} + * Generates a code sample for using {@link QueueClient#createWithResponse(Map, Duration, Context)} */ public void createQueueMaxOverload() { - QueueClient queueClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueClient.create#map - VoidResponse response = queueClient.create(Collections.singletonMap("queue", "metadataMap")); - System.out.println("Complete creating queue with status code: " + response.statusCode()); - // END: com.azure.storage.queue.queueClient.create#map - } - /** - * Generates a code sample for using {@link QueueAsyncClient#create(Map)} - */ - public void createQueueAsyncMaxOverload() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.create#map - queueAsyncClient.create(Collections.singletonMap("queue", "metadataMap")).subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the queue!") - ); - // END: com.azure.storage.queue.queueAsyncClient.create#map + // BEGIN: com.azure.storage.queue.queueClient.createWithResponse#map-duration-context + VoidResponse response = client.createWithResponse(Collections.singletonMap("queue", "metadataMap"), + Duration.ofSeconds(1), new Context(key1, value1)); + System.out.println("Complete creating queue with status code: " + response.getStatusCode()); + // END: com.azure.storage.queue.queueClient.createWithResponse#map-duration-context } /** * Generates a code sample for using {@link QueueClient#enqueueMessage(String)} */ public void enqueueMessage() { - QueueClient queueClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueClient.enqueueMessage#string - Response response = queueClient.enqueueMessage("hello msg"); - System.out.println("Complete enqueuing the message with status code: " + response.statusCode()); + EnqueuedMessage response = client.enqueueMessage("hello msg"); + System.out.println("Complete enqueuing the message with message Id" + response.getMessageId()); // END: com.azure.storage.queue.queueClient.enqueueMessage#string } /** - * Generates a code sample for using {@link QueueAsyncClient#enqueueMessage(String)} - */ - public void enqueueMessageAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.enqueueMessage#string - queueAsyncClient.enqueueMessage("Hello, Azure").subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete enqueuing the message!") - ); - // END: com.azure.storage.queue.queueAsyncClient.enqueueMessage#string - } - - /** - * Generates a code sample for using {@link QueueClient#enqueueMessage(String, Duration, Duration)} + * Generates a code sample for using {@link QueueClient#enqueueMessageWithResponse(String, Duration, Duration, + * Duration, Context)} */ public void enqueueMessageWithTimeoutOverload() { - QueueClient queueClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueClient.enqueueMessage#string-duration-duration - EnqueuedMessage enqueuedMessage = queueClient.enqueueMessage("Hello, Azure", - Duration.ofSeconds(5), null).value(); - System.out.printf("Message %s expires at %s", enqueuedMessage.messageId(), enqueuedMessage.expirationTime()); - // END: com.azure.storage.queue.queueClient.enqueueMessage#string-duration-duration - } - - /** - * Generates a code sample for using {@link QueueAsyncClient#enqueueMessage(String, Duration, Duration)} - */ - public void enqueueMessageAsyncWithTimeoutOverload() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.enqueueMessage#string-duration-duration - queueAsyncClient.enqueueMessage("Hello, Azure", - Duration.ofSeconds(5), null).subscribe( - response -> System.out.printf("Message %s expires at %s", response.value().messageId(), - response.value().expirationTime()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete enqueuing the message!") - ); - // END: com.azure.storage.queue.queueAsyncClient.enqueueMessage#string-duration-duration + + // BEGIN: com.azure.storage.queue.QueueClient.enqueueMessageWithResponse#String-Duration-Duration-Duration-Context1 + EnqueuedMessage enqueuedMessage = client.enqueueMessageWithResponse("Hello, Azure", + Duration.ofSeconds(5), null, Duration.ofSeconds(1), new Context(key1, value1)).getValue(); + System.out.printf("Message %s expires at %s", enqueuedMessage.getMessageId(), enqueuedMessage.getExpirationTime()); + // END: com.azure.storage.queue.QueueClient.enqueueMessageWithResponse#String-Duration-Duration-Duration-Context1 } /** - * Generates a code sample for using {@link QueueClient#enqueueMessage(String, Duration, Duration)} + * Generates a code sample for using {@link QueueClient#enqueueMessageWithResponse(String, Duration, Duration, + * Duration, Context)} */ public void enqueueMessageWithLiveTimeOverload() { - QueueClient queueClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueClient.enqueueMessageLiveTime#string-duration-duration - EnqueuedMessage enqueuedMessage = queueClient.enqueueMessage("Goodbye, Azure", - null, Duration.ofSeconds(5)).value(); - System.out.printf("Message %s expires at %s", enqueuedMessage.messageId(), enqueuedMessage.expirationTime()); - // END: com.azure.storage.queue.queueClient.enqueueMessageLiveTime#string-duration-duration - } - - /** - * Generates a code sample for using {@link QueueAsyncClient#enqueueMessage(String, Duration, Duration)} - */ - public void enqueueMessageAsyncWithLiveTimeOverload() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.enqueueMessageLiveTime#string-duration-duration - queueAsyncClient.enqueueMessage("Goodbye, Azure", - null, Duration.ofSeconds(5)).subscribe( - response -> System.out.printf("Message %s expires at %s", response.value().messageId(), - response.value().expirationTime()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete enqueuing the message!") - ); - // END: com.azure.storage.queue.queueAsyncClient.enqueueMessageLiveTime#string-duration-duration + // BEGIN: com.azure.storage.queue.QueueClient.enqueueMessageWithResponse#String-Duration-Duration-Duration-Context2 + EnqueuedMessage enqueuedMessage = client.enqueueMessageWithResponse("Goodbye, Azure", + null, Duration.ofSeconds(5), Duration.ofSeconds(1), new Context(key1, value1)).getValue(); + System.out.printf("Message %s expires at %s", enqueuedMessage.getMessageId(), enqueuedMessage.getExpirationTime()); + // END: com.azure.storage.queue.QueueClient.enqueueMessageWithResponse#String-Duration-Duration-Duration-Context2 } /** * Generates a code sample for using {@link QueueClient#dequeueMessages()} */ public void dequeueMessage() { - QueueClient queueClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueClient.dequeueMessages - queueClient.dequeueMessages().forEach( + client.dequeueMessages().forEach( dequeuedMessage -> { - System.out.println("Complete dequeuing the message: " + dequeuedMessage.messageText()); + System.out.println("Complete dequeuing the message: " + dequeuedMessage.getMessageId()); } ); // END: com.azure.storage.queue.queueClient.dequeueMessages } - - /** - * Generates a code sample for using {@link QueueAsyncClient#dequeueMessages()} - */ - public void dequeueMessageAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.dequeueMessages - queueAsyncClient.dequeueMessages().subscribe( - dequeuedMessage -> System.out.println("The message got from dequeue operation: " - + dequeuedMessage.messageText()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete dequeuing the message!") - ); - // END: com.azure.storage.queue.queueAsyncClient.dequeueMessages - } - /** * Generates a code sample for using {@link QueueClient#dequeueMessages(Integer)} */ public void dequeueMessageWithOverload() { - QueueClient queueClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueClient.dequeueMessages#integer - for (DequeuedMessage dequeuedMessage : queueClient.dequeueMessages(5)) { + for (DequeuedMessage dequeuedMessage : client.dequeueMessages(5)) { System.out.printf("Dequeued %s and it becomes visible at %s", - dequeuedMessage.messageId(), dequeuedMessage.timeNextVisible()); + dequeuedMessage.getMessageId(), dequeuedMessage.getTimeNextVisible()); } // END: com.azure.storage.queue.queueClient.dequeueMessages#integer } /** - * Generates a code sample for using {@link QueueAsyncClient#dequeueMessages(Integer)} - */ - public void dequeueMessageAsyncWithOverload() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.dequeueMessages#integer - queueAsyncClient.dequeueMessages(5).subscribe( - dequeuedMessage -> System.out.println("The message got from dequeue operation: " - + dequeuedMessage.messageText()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete dequeuing the message!") - ); - // END: com.azure.storage.queue.queueAsyncClient.dequeueMessages#integer - } - - /** - * Generates a code sample for using {@link QueueClient#dequeueMessages(Integer, Duration)} + * Generates a code sample for using {@link QueueClient#dequeueMessages(Integer, Duration, Duration, Context)} */ public void dequeueMessageMaxOverload() { - QueueClient queueClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueClient.dequeueMessages#integer-duration - for (DequeuedMessage dequeuedMessage : queueClient.dequeueMessages(5, Duration.ofSeconds(60))) { + + // BEGIN: com.azure.storage.queue.queueClient.dequeueMessages#integer-duration-duration-context + for (DequeuedMessage dequeuedMessage : client.dequeueMessages(5, Duration.ofSeconds(60), + Duration.ofSeconds(1), new Context(key1, value1))) { System.out.printf("Dequeued %s and it becomes visible at %s", - dequeuedMessage.messageId(), dequeuedMessage.timeNextVisible()); + dequeuedMessage.getMessageId(), dequeuedMessage.getTimeNextVisible()); } - // END: com.azure.storage.queue.queueClient.dequeueMessages#integer-duration - } - - /** - * Generates a code sample for using {@link QueueAsyncClient#dequeueMessages(Integer, Duration)} - */ - public void dequeueMessageAsyncMaxOverload() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.dequeueMessages#integer-duration - queueAsyncClient.dequeueMessages(5, Duration.ofSeconds(60)).subscribe( - dequeuedMessage -> System.out.println("The message got from dequeue operation: " - + dequeuedMessage.messageText()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete dequeuing the message!") - ); - // END: com.azure.storage.queue.queueAsyncClient.dequeueMessages#integer-duration + // END: com.azure.storage.queue.queueClient.dequeueMessages#integer-duration-duration-context } /** * Generates a code sample for using {@link QueueClient#peekMessages()} */ public void peekMessage() { - QueueClient queueClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueClient.peekMessages - queueClient.peekMessages().forEach( + client.peekMessages().forEach( peekedMessage -> { - System.out.println("Complete peeking the message: " + peekedMessage.messageText()); + System.out.println("Complete peeking the message: " + peekedMessage.getMessageText()); } ); // END: com.azure.storage.queue.queueClient.peekMessages } - /** - * Generates a code sample for using {@link QueueAsyncClient#peekMessages()} - */ - public void peekMessageAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.peekMessages - queueAsyncClient.peekMessages().subscribe( - peekMessages -> System.out.println("The message got from peek operation: " + peekMessages.messageText()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete peeking the message!") - ); - // END: com.azure.storage.queue.queueAsyncClient.peekMessages - } - - /** - * Generates a code sample for using {@link QueueClient#peekMessages(Integer)} + * Generates a code sample for using {@link QueueClient#peekMessages(Integer, Duration, Context)} */ public void peekMessageMaxOverload() { - QueueClient queueClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueClient.peekMessages#integer - queueClient.peekMessages(5).forEach( - peekMessage -> System.out.printf("Peeked message %s has been dequeued %d times", - peekMessage.messageId(), peekMessage.dequeueCount()) - ); - // END: com.azure.storage.queue.queueClient.peekMessages#integer - } - - /** - * Generates a code sample for using {@link QueueAsyncClient#peekMessages(Integer)} - */ - public void peekMessageAsyncMaxOverload() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.peekMessages#integer - queueAsyncClient.peekMessages(5).subscribe( + // BEGIN: com.azure.storage.queue.queueClient.peekMessages#integer-duration-context + client.peekMessages(5, Duration.ofSeconds(1), new Context(key1, value1)).forEach( peekMessage -> System.out.printf("Peeked message %s has been dequeued %d times", - peekMessage.messageId(), peekMessage.dequeueCount()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete peeking the message!") + peekMessage.getMessageId(), peekMessage.getDequeueCount()) ); - // END: com.azure.storage.queue.queueAsyncClient.peekMessages#integer + // END: com.azure.storage.queue.queueClient.peekMessages#integer-duration-context } /** * Generates a code sample for using {@link QueueClient#updateMessage(String, String, String, Duration)} */ public void updateMessage() { - QueueClient queueClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueClient.updateMessage - queueClient.dequeueMessages().forEach( + // BEGIN: com.azure.storage.queue.QueueClient.updateMessage#String-String-String-Duration + client.dequeueMessages().forEach( + dequeuedMessage -> { - Response response = queueClient.updateMessage("newText", - dequeuedMessage.messageId(), dequeuedMessage.popReceipt(), null); - System.out.println("Complete updating the message with status code " + response.statusCode()); + UpdatedMessage response = client.updateMessage("newText", + dequeuedMessage.getMessageId(), dequeuedMessage.getPopReceipt(), null); + + System.out.println("Complete updating the message."); } ); - // END: com.azure.storage.queue.queueClient.updateMessage + // END: com.azure.storage.queue.QueueClient.updateMessage#String-String-String-Duration } - /** - * Generates a code sample for using {@link QueueAsyncClient#updateMessage(String, String, String, Duration)} + * Generates a code sample for using {@link QueueClient#updateMessageWithResponse(String, String, String, Duration, + * Duration, Context)} */ - public void updateMessageAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.updateMessage - queueAsyncClient.dequeueMessages().subscribe( + public void updateMessageWithResponse() { + // BEGIN: com.azure.storage.queue.QueueClient.updateMessageWithResponse#String-String-String-Duration-Duration-Context + client.dequeueMessages().forEach( dequeuedMessage -> { - queueAsyncClient.updateMessage("newText", dequeuedMessage.messageId(), - dequeuedMessage.popReceipt(), null).subscribe( - response -> { }, - updateError -> System.err.print(updateError.toString()), - () -> System.out.println("Complete updating the message!") - ); - }, - dequeueError -> System.err.print(dequeueError.toString()), - () -> System.out.println("Complete dequeueing the message!") + Response response = client.updateMessageWithResponse("newText", + dequeuedMessage.getMessageId(), dequeuedMessage.getPopReceipt(), null, + Duration.ofSeconds(1), new Context(key1, value1)); + + System.out.println("Complete updating the message with status code " + response.getStatusCode()); + } ); - // END: com.azure.storage.queue.queueAsyncClient.updateMessage + // END: com.azure.storage.queue.QueueClient.updateMessageWithResponse#String-String-String-Duration-Duration-Context } /** * Generates a code sample for using {@link QueueClient#deleteMessage(String, String)} */ public void deleteMessage() { - QueueClient queueClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueClient.deleteMessage - queueClient.dequeueMessages().forEach( + // BEGIN: com.azure.storage.queue.QueueClient.deleteMessage#String-String + client.dequeueMessages().forEach( dequeuedMessage -> { - VoidResponse response = queueClient.deleteMessage(dequeuedMessage.messageId(), - dequeuedMessage.popReceipt()); - System.out.println("Complete deleting the message with status code " + response.statusCode()); + client.deleteMessage(dequeuedMessage.getMessageId(), dequeuedMessage.getPopReceipt()); + System.out.println("Complete deleting the message."); } ); - // END: com.azure.storage.queue.queueClient.deleteMessage + // END: com.azure.storage.queue.QueueClient.deleteMessage#String-String } - /** - * Generates a code sample for using {@link QueueAsyncClient#deleteMessage(String, String)} + * Generates a code sample for using {@link QueueClient#deleteMessageWithResponse(String, String, Duration, + * Context)} */ - public void deleteMessageAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.deleteMessage - queueAsyncClient.dequeueMessages().subscribe( + public void deleteMessageWithResponse() { + // BEGIN: com.azure.storage.queue.QueueClient.deleteMessageWithResponse#String-String-Duration-Context + client.dequeueMessages().forEach( dequeuedMessage -> { - queueAsyncClient.deleteMessage(dequeuedMessage.messageId(), dequeuedMessage.popReceipt()).subscribe( - response -> { }, - deleteError -> System.err.print(deleteError.toString()), - () -> System.out.println("Complete deleting the message!") - ); - }, - dequeueError -> System.err.print(dequeueError.toString()), - () -> System.out.println("Complete dequeueing the message!") + VoidResponse response = client.deleteMessageWithResponse(dequeuedMessage.getMessageId(), + dequeuedMessage.getPopReceipt(), Duration.ofSeconds(1), new Context(key1, value1)); + System.out.println("Complete deleting the message with status code " + response.getStatusCode()); + } ); - // END: com.azure.storage.queue.queueAsyncClient.deleteMessage + // END: com.azure.storage.queue.QueueClient.deleteMessageWithResponse#String-String-Duration-Context } /** * Generates a code sample for using {@link QueueClient#delete()} */ public void deleteQueue() { - QueueClient queueClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueClient.delete - VoidResponse response = queueClient.delete(); - System.out.println("Complete deleting the queue with status code: " + response.statusCode()); + client.delete(); + System.out.println("Complete deleting the queue."); // END: com.azure.storage.queue.queueClient.delete } - /** - * Generates a code sample for using {@link QueueAsyncClient#delete()} + * Generates a code sample for using {@link QueueClient#deleteWithResponse(Duration, Context)} */ - public void deleteQueueAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.delete - queueAsyncClient.delete().subscribe( - response -> System.out.println("Deleting the queue completed with status code: " + response.statusCode()) - ); - // END: com.azure.storage.queue.queueAsyncClient.delete + public void deleteWithResponse() { + + // BEGIN: com.azure.storage.queue.queueClient.deleteWithResponse#duration-context + VoidResponse response = client.deleteWithResponse(Duration.ofSeconds(1), new Context(key1, value1)); + System.out.println("Complete deleting the queue with status code: " + response.getStatusCode()); + // END: com.azure.storage.queue.queueClient.deleteWithResponse#duration-context } /** * Generates a code sample for using {@link QueueClient#getProperties()} */ public void getProperties() { - QueueClient queueClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueClient.getProperties - QueueProperties properties = queueClient.getProperties().value(); - System.out.printf("Metadata: %s, Approximate message count: %d", properties.metadata(), - properties.approximateMessagesCount()); + QueueProperties properties = client.getProperties(); + System.out.printf("Metadata: %s, Approximate message count: %d", properties.getMetadata(), + properties.getApproximateMessagesCount()); // END: com.azure.storage.queue.queueClient.getProperties } /** - * Generates a code sample for using {@link QueueAsyncClient#getProperties()} + * Generates a code sample for using {@link QueueClient#getPropertiesWithResponse(Duration, Context)} */ - public void getPropertiesAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.getProperties - queueAsyncClient.getProperties() - .subscribe(response -> { - QueueProperties properties = response.value(); - System.out.printf("Metadata: %s, Approximate message count: %d", properties.metadata(), - properties.approximateMessagesCount()); - }); - // END: com.azure.storage.queue.queueAsyncClient.getProperties + public void getPropertiesWithResponse() { + + // BEGIN: com.azure.storage.queue.queueClient.getPropertiesWithResponse#duration-context + QueueProperties properties = client.getPropertiesWithResponse(Duration.ofSeconds(1), + new Context(key1, value1)).getValue(); + System.out.printf("Metadata: %s, Approximate message count: %d", properties.getMetadata(), + properties.getApproximateMessagesCount()); + // END: com.azure.storage.queue.queueClient.getPropertiesWithResponse#duration-context } /** * Generate a code sample for using {@link QueueClient#setMetadata(Map)} to set metadata. */ public void setMetadata() { - QueueClient queueClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueClient.setMetadata#map - VoidResponse response = queueClient.setMetadata(Collections.singletonMap("queue", "metadataMap")); - System.out.printf("Setting metadata completed with status code %d", response.statusCode()); + client.setMetadata(Collections.singletonMap("queue", "metadataMap")); + System.out.printf("Setting metadata completed."); // END: com.azure.storage.queue.queueClient.setMetadata#map } /** - * Generate a code sample for using {@link QueueAsyncClient#setMetadata(Map)} to set metadata. + * Generate a code sample for using {@link QueueClient#setMetadataWithResponse(Map, Duration, Context)} to set + * metadata. */ - public void setMetadataAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.setMetadata#map - queueAsyncClient.setMetadata(Collections.singletonMap("queue", "metadataMap")) - .subscribe(response -> System.out.printf("Setting metadata completed with status code %d", - response.statusCode())); - // END: com.azure.storage.queue.queueAsyncClient.setMetadata#map + public void setMetadataWithResponse() { + + // BEGIN: com.azure.storage.queue.queueClient.setMetadataWithResponse#map-duration-context + client.setMetadataWithResponse(Collections.singletonMap("queue", "metadataMap"), + Duration.ofSeconds(1), new Context(key1, value1)); + System.out.printf("Setting metadata completed."); + // END: com.azure.storage.queue.queueClient.setMetadataWithResponse#map-duration-context } /** * Generate a code sample for using {@link QueueClient#setMetadata(Map)} to clear metadata. */ public void clearMetadata() { - QueueClient queueClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueClient.clearMetadata#map - VoidResponse response = queueClient.setMetadata(null); - System.out.printf("Clearing metadata completed with status code %d", response.statusCode()); + client.setMetadata(null); + System.out.printf("Clearing metadata completed."); // END: com.azure.storage.queue.queueClient.clearMetadata#map } /** - * Generate a code sample for using {@link QueueAsyncClient#setMetadata(Map)} to clear metadata. + * Generate a code sample for using {@link QueueClient#setMetadataWithResponse(Map, Duration, Context)} to clear + * metadata. */ - public void clearMetadataAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.clearMetadata#map - queueAsyncClient.setMetadata(null) - .subscribe(response -> System.out.printf("Clearing metadata completed with status code %d", - response.statusCode())); - // END: com.azure.storage.queue.queueAsyncClient.clearMetadata#map + public void clearMetadataWithResponse() { + + // BEGIN: com.azure.storage.queue.queueClient.clearMetadataWithResponse#map-duration-context + VoidResponse response = client.setMetadataWithResponse(null, Duration.ofSeconds(1), + new Context(key1, value1)); + System.out.printf("Clearing metadata completed with status code %d", response.getStatusCode()); + // END: com.azure.storage.queue.queueClient.clearMetadataWithResponse#map-duration-context } /** * Generates a code sample for using {@link QueueClient#getAccessPolicy()} */ public void getAccessPolicy() { - QueueClient queueClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueClient.getAccessPolicy - for (SignedIdentifier permission : queueClient.getAccessPolicy()) { - System.out.printf("Access policy %s allows these permissions: %s", permission.id(), - permission.accessPolicy().permission()); + for (SignedIdentifier permission : client.getAccessPolicy()) { + System.out.printf("Access policy %s allows these permissions: %s", permission.getId(), + permission.getAccessPolicy().getPermission()); } // END: com.azure.storage.queue.queueClient.getAccessPolicy } - /** - * Generates a code sample for using {@link QueueAsyncClient#getAccessPolicy()} - */ - public void getAccessPolicyAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.getAccessPolicy - queueAsyncClient.getAccessPolicy() - .subscribe(result -> System.out.printf("Access policy %s allows these permissions: %s", - result.id(), result.accessPolicy().permission())); - // END: com.azure.storage.queue.queueAsyncClient.getAccessPolicy - } - /** * Generates a code sample for using {@link QueueClient#setAccessPolicy(List)} */ public void setAccessPolicy() { - QueueClient queueClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueClient.setAccessPolicy - AccessPolicy accessPolicy = new AccessPolicy().permission("r") - .start(OffsetDateTime.now(ZoneOffset.UTC)) - .expiry(OffsetDateTime.now(ZoneOffset.UTC).plusDays(10)); - SignedIdentifier permission = new SignedIdentifier().id("mypolicy").accessPolicy(accessPolicy); - VoidResponse response = queueClient.setAccessPolicy(Collections.singletonList(permission)); - System.out.printf("Setting access policies completed with status code %d", response.statusCode()); - // END: com.azure.storage.queue.queueClient.setAccessPolicy + // BEGIN: com.azure.storage.queue.QueueClient.setAccessPolicy#List + AccessPolicy accessPolicy = new AccessPolicy().setPermission("r") + .setStart(OffsetDateTime.now(ZoneOffset.UTC)) + .setExpiry(OffsetDateTime.now(ZoneOffset.UTC).plusDays(10)); + SignedIdentifier permission = new SignedIdentifier().setId("mypolicy").setAccessPolicy(accessPolicy); + client.setAccessPolicy(Collections.singletonList(permission)); + System.out.printf("Setting access policies completed."); + // END: com.azure.storage.queue.QueueClient.setAccessPolicy#List } /** - * Generates a code sample for using {@link QueueAsyncClient#setAccessPolicy(List)} + * Generates a code sample for using {@link QueueClient#setAccessPolicyWithResponse(List, Duration, Context)} */ - public void setAccessPolicyAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.setAccessPolicy - AccessPolicy accessPolicy = new AccessPolicy().permission("r") - .start(OffsetDateTime.now(ZoneOffset.UTC)) - .expiry(OffsetDateTime.now(ZoneOffset.UTC).plusDays(10)); + public void setAccessPolicyWithResponse() { - SignedIdentifier permission = new SignedIdentifier().id("mypolicy").accessPolicy(accessPolicy); - queueAsyncClient.setAccessPolicy(Collections.singletonList(permission)) - .subscribe(response -> System.out.printf("Setting access policies completed with status code %d", - response.statusCode())); - // END: com.azure.storage.queue.queueAsyncClient.setAccessPolicy + // BEGIN: com.azure.storage.queue.queueClient.setAccessPolicyWithResponse#List-Duration-Context + AccessPolicy accessPolicy = new AccessPolicy().setPermission("r") + .setStart(OffsetDateTime.now(ZoneOffset.UTC)) + .setExpiry(OffsetDateTime.now(ZoneOffset.UTC).plusDays(10)); + SignedIdentifier permission = new SignedIdentifier().setId("mypolicy").setAccessPolicy(accessPolicy); + VoidResponse response = client.setAccessPolicyWithResponse(Collections.singletonList(permission), + Duration.ofSeconds(1), new Context(key1, value1)); + System.out.printf("Setting access policies completed with status code %d", response.getStatusCode()); + // END: com.azure.storage.queue.queueClient.setAccessPolicyWithResponse#List-Duration-Context } /** * Generates a code sample for using {@link QueueClient#clearMessages()} */ public void clearMessages() { - QueueClient queueClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.queue.queueClient.clearMessages - VoidResponse response = queueClient.clearMessages(); - System.out.printf("Clearing messages completed with status code %d", response.statusCode()); + client.clearMessages(); + System.out.printf("Clearing messages completed."); // END: com.azure.storage.queue.queueClient.clearMessages } - /** - * Generates a code sample for using {@link QueueAsyncClient#clearMessages()} + * Generates a code sample for using {@link QueueClient#clearMessagesWithResponse(Duration, Context)} */ - public void clearMessagesAsync() { - QueueAsyncClient queueAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueAsyncClient.clearMessages - queueAsyncClient.clearMessages().subscribe( - response -> System.out.println("Clearing messages completed with status code: " + response.statusCode()) - ); - // END: com.azure.storage.queue.queueAsyncClient.clearMessages + public void clearMessagesWithResponse() { + + // BEGIN: com.azure.storage.queue.queueClient.clearMessagesWithResponse#duration-context + VoidResponse response = client.clearMessagesWithResponse(Duration.ofSeconds(1), new Context(key1, value1)); + System.out.printf("Clearing messages completed with status code %d", response.getStatusCode()); + // 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() + .setRead(true) + .setAdd(true) + .setUpdate(true) + .setProcess(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 + } } 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 new file mode 100644 index 000000000000..a4d64fe465a4 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceAsyncJavaDocCodeSamples.java @@ -0,0 +1,309 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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.Utility; +import com.azure.storage.common.credentials.SASTokenCredential; +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; + +/** + * Contains code snippets when generating javadocs through doclets for {@link QueueServiceClient} and {@link + * QueueServiceAsyncClient}. + */ +public class QueueServiceAsyncJavaDocCodeSamples { + + private QueueServiceAsyncClient client = createAsyncClientWithSASToken(); + + /** + * Generates code sample for creating a {@link QueueServiceAsyncClient}. + */ + public void buildQueueServiceAsyncClient() { + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.instantiation + QueueServiceAsyncClient client = new QueueServiceClientBuilder() + .connectionString("connectionstring") + .endpoint("endpoint") + .buildAsyncClient(); + // END: com.azure.storage.queue.queueServiceAsyncClient.instantiation + } + + /** + * Generates code sample for creating a {@link QueueServiceAsyncClient} with {@link SASTokenCredential} + * + * @return An instance of {@link QueueServiceAsyncClient} + */ + public QueueServiceAsyncClient createAsyncClientWithSASToken() { + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.instantiation.sastoken + QueueServiceAsyncClient client = new QueueServiceClientBuilder() + .endpoint("https://{accountName}.queue.core.windows.net?{SASToken}") + .buildAsyncClient(); + // END: com.azure.storage.queue.queueServiceAsyncClient.instantiation.sastoken + return client; + } + + /** + * Generates code sample for creating a {@link QueueServiceAsyncClient} with {@link SASTokenCredential} + * + * @return An instance of {@link QueueServiceAsyncClient} + */ + public QueueServiceAsyncClient createAsyncClientWithCredential() { + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.instantiation.credential + QueueServiceAsyncClient client = new QueueServiceClientBuilder() + .endpoint("https://{accountName}.queue.core.windows.net") + .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("{SASTokenQueryParams}"))) + .buildAsyncClient(); + // END: com.azure.storage.queue.queueServiceAsyncClient.instantiation.credential + return client; + } + + /** + * Generates code sample for creating a {@link QueueServiceAsyncClient} with {@code connectionString} which turns + * into {@link SharedKeyCredential} + * + * @return An instance of {@link QueueServiceAsyncClient} + */ + public QueueServiceAsyncClient createAsyncClientWithConnectionString() { + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.instantiation.connectionstring + String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};" + + "AccountKey={key};EndpointSuffix={core.windows.net}"; + QueueServiceAsyncClient client = new QueueServiceClientBuilder() + .connectionString(connectionString) + .buildAsyncClient(); + // END: com.azure.storage.queue.queueServiceAsyncClient.instantiation.connectionstring + return client; + } + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#createQueue(String)} + */ + public void createQueueAsync() { + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.createQueue#string + client.createQueue("myqueue").subscribe( + response -> { + }, + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the queue!") + ); + // END: com.azure.storage.queue.queueServiceAsyncClient.createQueue#string + } + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#createQueueWithResponse(String, Map)} + */ + public void createQueueAsyncMaxOverload() { + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.createQueueWithResponse#string-map + client.createQueueWithResponse("myqueue", Collections.singletonMap("queue", "metadata")) + .subscribe( + response -> System.out.printf("Creating the queue with status code %d", response.getStatusCode()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete creating the queue!") + ); + // END: com.azure.storage.queue.queueServiceAsyncClient.createQueueWithResponse#string-map + } + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#listQueues()} + */ + public void listQueuesAsync() { + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.listQueues + client.listQueues().subscribe( + queueItem -> System.out.printf("Queue %s exists in the account", queueItem.getName()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete listing the queues!") + ); + // END: com.azure.storage.queue.queueServiceAsyncClient.listQueues + } + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#listQueues(QueuesSegmentOptions)} + */ + public void listQueuesAsyncWithOverload() { + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.listQueues#queueSergmentOptions + client.listQueues(new QueuesSegmentOptions().setPrefix("azure")).subscribe( + queueItem -> System.out.printf("Queue %s exists in the account and has metadata %s", + queueItem.getName(), queueItem.getMetadata()), + error -> System.err.print(error.toString()), + () -> System.out.println("Complete listing the queues!") + ); + // END: com.azure.storage.queue.queueServiceAsyncClient.listQueues#queueSergmentOptions + } + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#deleteQueue(String)} + */ + public void deleteQueueAsync() { + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.deleteQueue#string + client.deleteQueue("myshare").subscribe( + response -> System.out.println("Deleting the queue completed.") + ); + // END: com.azure.storage.queue.queueServiceAsyncClient.deleteQueue#string + } + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#deleteQueueWithResponse(String)} + */ + public void deleteQueueWithResponse() { + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.deleteQueueWithResponse#string + client.deleteQueueWithResponse("myshare").subscribe( + response -> System.out.println("Deleting the queue completed with status code: " + response.getStatusCode()) + ); + // END: com.azure.storage.queue.queueServiceAsyncClient.deleteQueueWithResponse#string + } + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#getProperties()} + */ + public void getPropertiesAsync() { + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.getProperties + client.getProperties() + .subscribe(properties -> { + System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", + properties.getHourMetrics().isEnabled(), properties.getMinuteMetrics().isEnabled()); + }); + // END: com.azure.storage.queue.queueServiceAsyncClient.getProperties + } + + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#getPropertiesWithResponse()} + */ + public void getPropertiesWithResponse() { + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.getPropertiesWithResponse + client.getPropertiesWithResponse() + .subscribe(response -> { + StorageServiceProperties properties = response.getValue(); + System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", + properties.getHourMetrics().isEnabled(), properties.getMinuteMetrics().isEnabled()); + }); + // END: com.azure.storage.queue.queueServiceAsyncClient.getPropertiesWithResponse + } + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#setProperties(StorageServiceProperties)} + */ + public void setPropertiesAsync() { + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.setProperties#storageServiceProperties + StorageServiceProperties properties = client.getProperties().block(); + client.setProperties(properties) + .doOnSuccess(response -> System.out.printf("Setting Queue service properties completed.")); + // END: com.azure.storage.queue.queueServiceAsyncClient.setProperties#storageServiceProperties + } + + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#setPropertiesWithResponse(StorageServiceProperties)} + */ + public void setPropertiesWithResponse() { + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.setPropertiesWithResponse#storageServiceProperties + StorageServiceProperties properties = client.getProperties().block(); + client.setPropertiesWithResponse(properties) + .subscribe(response -> System.out.printf("Setting Queue service properties completed with status code %d", + response.getStatusCode())); + // END: com.azure.storage.queue.queueServiceAsyncClient.setPropertiesWithResponse#storageServiceProperties + } + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#setProperties(StorageServiceProperties)} with + * metrics enabled. + */ + public void setPropertiesEnableMetrics() { + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.setPropertiesEnableMetrics#storageServiceProperties + StorageServiceProperties properties = client.getProperties().block(); + properties.getMinuteMetrics().setEnabled(true); + properties.getHourMetrics().setEnabled(true); + client.setProperties(properties).subscribe( + response -> System.out.printf("Setting Queue service properties completed.")); + // END: com.azure.storage.queue.queueServiceAsyncClient.setPropertiesEnableMetrics#storageServiceProperties + } + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#setPropertiesWithResponse(StorageServiceProperties)} + * with metrics enabled. + */ + public void setPropertiesAsyncEnableMetrics() { + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.setPropertiesWithResponseEnableMetrics#storageServiceProperties + StorageServiceProperties properties = client.getProperties().block(); + properties.getMinuteMetrics().setEnabled(true); + properties.getHourMetrics().setEnabled(true); + client.setPropertiesWithResponse(properties) + .subscribe(response -> System.out.printf("Setting Queue service properties completed with status code %d", + response.getStatusCode())); + // END: com.azure.storage.queue.queueServiceAsyncClient.setPropertiesWithResponseEnableMetrics#storageServiceProperties + } + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#getStatistics()} + */ + public void getStatisticsAsync() { + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.getStatistics + client.getStatistics() + .subscribe(stats -> { + System.out.printf("Geo replication status: %s, Last synced: %s", + stats.getGeoReplication().getStatus(), stats.getGeoReplication().getLastSyncTime()); + }); + // END: com.azure.storage.queue.queueServiceAsyncClient.getStatistics + } + + /** + * Generates a code sample for using {@link QueueServiceAsyncClient#getStatisticsWithResponse()} + */ + public void getStatisticsWithResponse() { + // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.getStatisticsWithResponse + client.getStatisticsWithResponse() + .subscribe(response -> { + StorageServiceStats stats = response.getValue(); + System.out.printf("Geo replication status: %s, Last synced: %s", + stats.getGeoReplication().getStatus(), stats.getGeoReplication().getLastSyncTime()); + }); + // 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() + .setRead(true) + .setAdd(true) + .setCreate(true) + .setWrite(true) + .setDelete(true) + .setList(true) + .setProcessMessages(true) + .setUpdate(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 52a214439206..68f70813bcb7 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,20 +4,35 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.VoidResponse; +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.Utility; +import com.azure.core.util.Context; import com.azure.storage.common.credentials.SASTokenCredential; 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.time.Duration; import java.util.Collections; import java.util.Map; /** - * Contains code snippets when generating javadocs through doclets for {@link QueueServiceClient} and {@link QueueServiceAsyncClient}. + * Contains code snippets when generating javadocs through doclets for {@link QueueServiceClient} and {@link + * QueueServiceAsyncClient}. */ public class QueueServiceJavaDocCodeSamples { + + private QueueServiceClient client = createClientWithSASToken(); + private String key1 = "key1"; + private String value1 = "val1"; + /** * Generates code sample for creating a {@link QueueServiceClient}. */ @@ -30,338 +45,256 @@ public void buildQueueServiceClient() { // END: com.azure.storage.queue.queueServiceClient.instantiation } - /** - * Generates code sample for creating a {@link QueueServiceAsyncClient}. - */ - public void buildQueueServiceAsyncClient() { - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.instantiation - QueueServiceAsyncClient client = new QueueServiceClientBuilder() - .connectionString("connectionstring") - .endpoint("endpoint") - .buildAsyncClient(); - // END: com.azure.storage.queue.queueServiceAsyncClient.instantiation - } - /** * Generates code sample for creating a {@link QueueServiceClient} with {@link SASTokenCredential} + * * @return An instance of {@link QueueServiceClient} */ public QueueServiceClient createClientWithSASToken() { // BEGIN: com.azure.storage.queue.queueServiceClient.instantiation.sastoken - QueueServiceClient queueServiceClient = new QueueServiceClientBuilder() + QueueServiceClient client = new QueueServiceClientBuilder() .endpoint("https://${accountName}.queue.core.windows.net?${SASToken}") .buildClient(); // END: com.azure.storage.queue.queueServiceClient.instantiation.sastoken - return queueServiceClient; - } - - /** - * Generates code sample for creating a {@link QueueServiceAsyncClient} with {@link SASTokenCredential} - * @return An instance of {@link QueueServiceAsyncClient} - */ - public QueueServiceAsyncClient createAsyncClientWithSASToken() { - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.instantiation.sastoken - QueueServiceAsyncClient queueServiceAsyncClient = new QueueServiceClientBuilder() - .endpoint("https://{accountName}.queue.core.windows.net?{SASToken}") - .buildAsyncClient(); - // END: com.azure.storage.queue.queueServiceAsyncClient.instantiation.sastoken - return queueServiceAsyncClient; + return client; } /** * Generates code sample for creating a {@link QueueServiceClient} with {@link SASTokenCredential} + * * @return An instance of {@link QueueServiceClient} */ public QueueServiceClient createClientWithCredential() { // BEGIN: com.azure.storage.queue.queueServiceClient.instantiation.credential - QueueServiceClient queueServiceClient = new QueueServiceClientBuilder() + QueueServiceClient client = new QueueServiceClientBuilder() .endpoint("https://${accountName}.queue.core.windows.net") .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("{SASTokenQueryParams}"))) .buildClient(); // END: com.azure.storage.queue.queueServiceClient.instantiation.credential - return queueServiceClient; - } - - /** - * Generates code sample for creating a {@link QueueServiceAsyncClient} with {@link SASTokenCredential} - * @return An instance of {@link QueueServiceAsyncClient} - */ - public QueueServiceAsyncClient createAsyncClientWithCredential() { - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.instantiation.credential - QueueServiceAsyncClient queueServiceAsyncClient = new QueueServiceClientBuilder() - .endpoint("https://{accountName}.queue.core.windows.net") - .credential(SASTokenCredential.fromQueryParameters(Utility.parseQueryString("{SASTokenQueryParams}"))) - .buildAsyncClient(); - // END: com.azure.storage.queue.queueServiceAsyncClient.instantiation.credential - return queueServiceAsyncClient; + return client; } /** - * Generates code sample for creating a {@link QueueServiceClient} with {@code connectionString} which turns into {@link SharedKeyCredential} + * Generates code sample for creating a {@link QueueServiceClient} with {@code connectionString} which turns into + * {@link SharedKeyCredential} + * * @return An instance of {@link QueueServiceClient} */ public QueueServiceClient createClientWithConnectionString() { // BEGIN: com.azure.storage.queue.queueServiceClient.instantiation.connectionstring String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};" - + "AccountKey={key};EndpointSuffix={core.windows.net}"; - QueueServiceClient queueServiceClient = new QueueServiceClientBuilder() + + "AccountKey={key};EndpointSuffix={core.windows.net}"; + QueueServiceClient client = new QueueServiceClientBuilder() .connectionString(connectionString) .buildClient(); // END: com.azure.storage.queue.queueServiceClient.instantiation.connectionstring - return queueServiceClient; - } - - /** - * Generates code sample for creating a {@link QueueServiceAsyncClient} with {@code connectionString} which turns into {@link SharedKeyCredential} - * @return An instance of {@link QueueServiceAsyncClient} - */ - public QueueServiceAsyncClient createAsyncClientWithConnectionString() { - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.instantiation.connectionstring - String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};" - + "AccountKey={key};EndpointSuffix={core.windows.net}"; - QueueServiceAsyncClient queueServiceAsyncClient = new QueueServiceClientBuilder() - .connectionString(connectionString) - .buildAsyncClient(); - // END: com.azure.storage.queue.queueServiceAsyncClient.instantiation.connectionstring - return queueServiceAsyncClient; + return client; } /** * Generates a code sample for using {@link QueueServiceClient#createQueue(String)} */ public void createQueue() { - QueueServiceClient queueServiceClient = createClientWithSASToken(); // BEGIN: com.azure.storage.queue.queueServiceClient.createQueue#string - Response response = queueServiceClient.createQueue("myqueue"); - System.out.println("Complete creating queue with status code: " + response.statusCode()); + client.createQueue("myqueue"); + System.out.println("Complete creating queue."); // END: com.azure.storage.queue.queueServiceClient.createQueue#string } /** - * Generates a code sample for using {@link QueueServiceAsyncClient#createQueue(String)} - */ - public void createQueueAsync() { - QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.createQueue#string - queueServiceAsyncClient.createQueue("myqueue").subscribe( - response -> { }, - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the queue!") - ); - // END: com.azure.storage.queue.queueServiceAsyncClient.createQueue#string - } - - /** - * Generates a code sample for using {@link QueueServiceClient#createQueue(String, Map)} + * Generates a code sample for using {@link QueueServiceClient#createQueueWithResponse(String, Map, Duration, + * Context)} */ public void createQueueMaxOverload() { - QueueServiceClient queueServiceClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueServiceClient.createQueue#string-map - Response response = queueServiceClient.createQueue("myqueue", - Collections.singletonMap("queue", "metadata")); - System.out.println("Complete creating queue with status code: " + response.statusCode()); - // END: com.azure.storage.queue.queueServiceClient.createQueue#string-map - } - - /** - * Generates a code sample for using {@link QueueServiceAsyncClient#createQueue(String, Map)} - */ - public void createQueueAsyncMaxOverload() { - QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.createQueue#string-map - queueServiceAsyncClient.createQueue("myqueue", Collections.singletonMap("queue", "metadata")) - .subscribe( - response -> System.out.printf("Creating the queue with status code %d", response.statusCode()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete creating the queue!") - ); - // END: com.azure.storage.queue.queueServiceAsyncClient.createQueue#string-map + // BEGIN: com.azure.storage.queue.queueServiceClient.createQueueWithResponse#string-map-duration-context + Response response = client.createQueueWithResponse("myqueue", + Collections.singletonMap("queue", "metadata"), Duration.ofSeconds(1), new Context(key1, value1)); + System.out.println("Complete creating queue with status code: " + response.getStatusCode()); + // END: com.azure.storage.queue.queueServiceClient.createQueueWithResponse#string-map-duration-context } /** * Generates a code sample for using {@link QueueServiceClient#listQueues()} */ public void listQueues() { - QueueServiceClient queueServiceClient = createClientWithSASToken(); // BEGIN: com.azure.storage.queue.queueServiceClient.listQueues - queueServiceClient.listQueues().forEach( - queueItem -> System.out.printf("Queue %s exists in the account", queueItem.name()) + client.listQueues().forEach( + queueItem -> System.out.printf("Queue %s exists in the account", queueItem.getName()) ); // END: com.azure.storage.queue.queueServiceClient.listQueues } /** - * Generates a code sample for using {@link QueueServiceAsyncClient#listQueues()} - */ - public void listQueuesAsync() { - QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.listQueues - queueServiceAsyncClient.listQueues().subscribe( - queueItem -> System.out.printf("Queue %s exists in the account", queueItem.name()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete listing the queues!") - ); - // END: com.azure.storage.queue.queueServiceAsyncClient.listQueues - } - - /** - * Generates a code sample for using {@link QueueServiceClient#listQueues(QueuesSegmentOptions)} )} + * Generates a code sample for using {@link QueueServiceClient#listQueues(QueuesSegmentOptions, Duration, Context)} + * )} */ public void listQueuesWithOverload() { - QueueServiceClient queueServiceClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueServiceClient.listQueues#queueSergmentOptions - queueServiceClient.listQueues(new QueuesSegmentOptions().prefix("azure")).forEach( - queueItem -> System.out.printf("Queue %s exists in the account and has metadata %s", - queueItem.name(), queueItem.metadata()) - ); - // END: com.azure.storage.queue.queueServiceClient.listQueues#queueSergmentOptions - } - - /** - * Generates a code sample for using {@link QueueServiceAsyncClient#listQueues(QueuesSegmentOptions)} - */ - public void listQueuesAsyncWithOverload() { - QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.listQueues#queueSergmentOptions - queueServiceAsyncClient.listQueues(new QueuesSegmentOptions().prefix("azure")).subscribe( - queueItem -> System.out.printf("Queue %s exists in the account and has metadata %s", - queueItem.name(), queueItem.metadata()), - error -> System.err.print(error.toString()), - () -> System.out.println("Complete listing the queues!") + // BEGIN: com.azure.storage.queue.queueServiceClient.listQueues#queueSergmentOptions-duration-context + client.listQueues(new QueuesSegmentOptions().setPrefix("azure"), Duration.ofSeconds(1), + new Context(key1, value1)).forEach( + queueItem -> System.out.printf("Queue %s exists in the account and has metadata %s", + queueItem.getName(), queueItem.getMetadata()) ); - // END: com.azure.storage.queue.queueServiceAsyncClient.listQueues#queueSergmentOptions + // END: com.azure.storage.queue.queueServiceClient.listQueues#queueSergmentOptions-duration-context } /** * Generates a code sample for using {@link QueueServiceClient#deleteQueue(String)} */ public void deleteQueue() { - QueueServiceClient queueServiceClient = createClientWithSASToken(); // BEGIN: com.azure.storage.queue.queueServiceClient.deleteQueue#string - VoidResponse response = queueServiceClient.deleteQueue("myqueue"); - System.out.println("Complete deleting the queue with status code: " + response.statusCode()); + client.deleteQueue("myqueue"); + System.out.println("Complete deleting the queue."); // END: com.azure.storage.queue.queueServiceClient.deleteQueue#string } /** - * Generates a code sample for using {@link QueueServiceAsyncClient#deleteQueue(String)} + * Generates a code sample for using {@link QueueServiceClient#deleteQueueWithResponse(String, Duration, Context)} */ - public void deleteQueueAsync() { - QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.deleteQueue#string - queueServiceAsyncClient.deleteQueue("myshare").subscribe( - response -> System.out.println("Deleting the queue completed with status code: " + response.statusCode()) - ); - // END: com.azure.storage.queue.queueServiceAsyncClient.deleteQueue#string + public void deleteQueueWithResponse() { + // BEGIN: com.azure.storage.queue.queueServiceClient.deleteQueueWithResponse#string-duration-context + VoidResponse response = client.deleteQueueWithResponse("myqueue", Duration.ofSeconds(1), + new Context(key1, value1)); + System.out.println("Complete deleting the queue with status code: " + response.getStatusCode()); + // END: com.azure.storage.queue.queueServiceClient.deleteQueueWithResponse#string-duration-context } /** * Generates a code sample for using {@link QueueServiceClient#getProperties()} */ public void getProperties() { - QueueServiceClient queueServiceClient = createClientWithSASToken(); // BEGIN: com.azure.storage.queue.queueServiceClient.getProperties - StorageServiceProperties properties = queueServiceClient.getProperties().value(); + StorageServiceProperties properties = client.getProperties(); System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", - properties.hourMetrics().enabled(), properties.minuteMetrics().enabled()); + properties.getHourMetrics().isEnabled(), properties.getMinuteMetrics().isEnabled()); // END: com.azure.storage.queue.queueServiceClient.getProperties } /** - * Generates a code sample for using {@link QueueServiceAsyncClient#getProperties()} + * Generates a code sample for using {@link QueueServiceClient#getPropertiesWithResponse(Duration, Context)} */ - public void getPropertiesAsync() { - QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.getProperties - queueServiceAsyncClient.getProperties() - .subscribe(response -> { - StorageServiceProperties properties = response.value(); - System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", - properties.hourMetrics().enabled(), properties.minuteMetrics().enabled()); - }); - // END: com.azure.storage.queue.queueServiceAsyncClient.getProperties + public void getPropertiesWithResponse() { + // BEGIN: com.azure.storage.queue.queueServiceClient.getPropertiesWithResponse#duration-context + StorageServiceProperties properties = client.getPropertiesWithResponse(Duration.ofSeconds(1), + new Context(key1, value1)).getValue(); + System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", + properties.getHourMetrics().isEnabled(), properties.getMinuteMetrics().isEnabled()); + // END: com.azure.storage.queue.queueServiceClient.getPropertiesWithResponse#duration-context } /** * Generates a code sample for using {@link QueueServiceClient#setProperties(StorageServiceProperties)} */ public void setProperties() { - QueueServiceClient queueServiceClient = createClientWithSASToken(); // BEGIN: com.azure.storage.queue.queueServiceClient.setProperties#storageServiceProperties - StorageServiceProperties properties = queueServiceClient.getProperties().value(); - properties.cors(Collections.emptyList()); + StorageServiceProperties properties = client.getProperties(); + properties.setCors(Collections.emptyList()); - VoidResponse response = queueServiceClient.setProperties(properties); - System.out.printf("Setting Queue service properties completed with status code %d", response.statusCode()); + client.setProperties(properties); + System.out.printf("Setting Queue service properties completed."); // END: com.azure.storage.queue.queueServiceClient.setProperties#storageServiceProperties } /** - * Generates a code sample for using {@link QueueServiceAsyncClient#setProperties(StorageServiceProperties)} + * Generates a code sample for using {@link QueueServiceClient#setPropertiesWithResponse(StorageServiceProperties, + * Duration, Context)} */ - public void setPropertiesAsync() { - QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.setProperties#storageServiceProperties - StorageServiceProperties properties = queueServiceAsyncClient.getProperties().block().value(); - queueServiceAsyncClient.setProperties(properties) - .subscribe(response -> System.out.printf("Setting Queue service properties completed with status code %d", - response.statusCode())); - // END: com.azure.storage.queue.queueServiceAsyncClient.setProperties#storageServiceProperties + public void setPropertiesWithResponse() { + // BEGIN: com.azure.storage.queue.queueServiceClient.setPropertiesWithResponse#storageServiceProperties-duration-context + StorageServiceProperties properties = client.getProperties(); + properties.setCors(Collections.emptyList()); + VoidResponse response = client.setPropertiesWithResponse(properties, Duration.ofSeconds(1), + new Context(key1, value1)); + System.out.printf("Setting Queue service properties completed with status code %d", response.getStatusCode()); + // END: com.azure.storage.queue.queueServiceClient.setPropertiesWithResponse#storageServiceProperties-duration-context } /** - * Generates a code sample for using {@link QueueServiceClient#setProperties(StorageServiceProperties)} with metrics enabled. + * Generates a code sample for using {@link QueueServiceClient#setPropertiesWithResponse(StorageServiceProperties, + * Duration, Context)} with metrics enabled. */ - public void setPropertiesEnableMetrics() { - QueueServiceClient queueServiceClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueServiceClient.setPropertiesEnableMetrics#storageServiceProperties - StorageServiceProperties properties = queueServiceClient.getProperties().value(); - properties.minuteMetrics().enabled(true); - properties.hourMetrics().enabled(true); - VoidResponse response = queueServiceClient.setProperties(properties); - System.out.printf("Setting Queue service properties completed with status code %d", response.statusCode()); - // END: com.azure.storage.queue.queueServiceClient.setPropertiesEnableMetrics#storageServiceProperties + public void setPropertiesWithResponseEnableMetrics() { + // BEGIN: com.azure.storage.queue.queueServiceClient.setPropertiesWithResponseEnableMetrics#storageServiceProperties-duration-context + StorageServiceProperties properties = client.getProperties(); + properties.getMinuteMetrics().setEnabled(true); + properties.getHourMetrics().setEnabled(true); + VoidResponse response = client.setPropertiesWithResponse(properties, Duration.ofSeconds(1), + new Context(key1, value1)); + System.out.printf("Setting Queue service properties completed with status code %d", response.getStatusCode()); + // END: com.azure.storage.queue.queueServiceClient.setPropertiesWithResponseEnableMetrics#storageServiceProperties-duration-context } /** - * Generates a code sample for using {@link QueueServiceAsyncClient#setProperties(StorageServiceProperties)} with metrics enabled. + * Generates a code sample for using {@link QueueServiceClient#setProperties(StorageServiceProperties)} with metrics + * enabled. */ - public void setPropertiesAsyncEnableMetrics() { - QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.setPropertiesEnableMetrics#storageServiceProperties - StorageServiceProperties properties = queueServiceAsyncClient.getProperties().block().value(); - properties.minuteMetrics().enabled(true); - properties.hourMetrics().enabled(true); - queueServiceAsyncClient.setProperties(properties) - .subscribe(response -> System.out.printf("Setting Queue service properties completed with status code %d", - response.statusCode())); - // END: com.azure.storage.queue.queueServiceAsyncClient.setPropertiesEnableMetrics#storageServiceProperties + public void setPropertiesEnableMetrics() { + // BEGIN: com.azure.storage.queue.queueServiceClient.setPropertiesEnableMetrics#storageServiceProperties + StorageServiceProperties properties = client.getProperties(); + properties.getMinuteMetrics().setEnabled(true); + properties.getHourMetrics().setEnabled(true); + client.setProperties(properties); + System.out.printf("Setting Queue service properties completed."); + // END: com.azure.storage.queue.queueServiceClient.setPropertiesEnableMetrics#storageServiceProperties } /** * Generates a code sample for using {@link QueueServiceClient#getStatistics()} */ public void getStatistics() { - QueueServiceClient queueServiceClient = createClientWithSASToken(); // BEGIN: com.azure.storage.queue.queueServiceClient.getStatistics - StorageServiceStats stats = queueServiceClient.getStatistics().value(); + StorageServiceStats stats = client.getStatistics(); System.out.printf("Geo replication status: %s, Last synced: %s", - stats.geoReplication().status(), stats.geoReplication().lastSyncTime()); + stats.getGeoReplication().getStatus(), stats.getGeoReplication().getLastSyncTime()); // END: com.azure.storage.queue.queueServiceClient.getStatistics } /** - * Generates a code sample for using {@link QueueServiceAsyncClient#getStatistics()} + * Generates a code sample for using {@link QueueServiceClient#getStatisticsWithResponse(Duration, Context)} */ - public void getStatisticsAsync() { - QueueServiceAsyncClient queueServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.queue.queueServiceAsyncClient.getStatistics - queueServiceAsyncClient.getStatistics() - .subscribe(response -> { - StorageServiceStats stats = response.value(); - System.out.printf("Geo replication status: %s, Last synced: %s", - stats.geoReplication().status(), stats.geoReplication().lastSyncTime()); - }); - // END: com.azure.storage.queue.queueServiceAsyncClient.getStatistics + public void getStatisticsWithResponse() { + // BEGIN: com.azure.storage.queue.queueServiceClient.getStatisticsWithResponse#duration-context + StorageServiceStats stats = client.getStatisticsWithResponse(Duration.ofSeconds(1), + new Context(key1, value1)).getValue(); + System.out.printf("Geo replication status: %s, Last synced: %s", + 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() + .setRead(true) + .setAdd(true) + .setCreate(true) + .setWrite(true) + .setDelete(true) + .setList(true) + .setProcessMessages(true) + .setUpdate(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/samples/java/com/azure/storage/queue/QueueServiceSamples.java b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceSamples.java index ed1a9875a3d0..c74a121a35f8 100644 --- a/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceSamples.java +++ b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceSamples.java @@ -23,8 +23,8 @@ public static void main(String[] args) { queueServiceClient.createQueue(generateRandomName("create-extra", 16)); queueServiceClient.listQueues().forEach( queueItem -> { - System.out.println("The queue name is: " + queueItem.name()); - queueServiceClient.deleteQueue(queueItem.name()); + System.out.println("The queue name is: " + queueItem.getName()); + queueServiceClient.deleteQueue(queueItem.getName()); } ); } diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueAsyncClientTests.java b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueAsyncClientTests.java deleted file mode 100644 index e2b4b9529d00..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueAsyncClientTests.java +++ /dev/null @@ -1,693 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.queue; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.queue.models.AccessPolicy; -import com.azure.storage.queue.models.DequeuedMessage; -import com.azure.storage.queue.models.SignedIdentifier; -import com.azure.storage.queue.models.StorageErrorException; -import reactor.test.StepVerifier; - -import java.time.Duration; -import java.time.LocalDateTime; -import java.time.OffsetDateTime; -import java.time.ZoneOffset; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -public class QueueAsyncClientTests extends QueueClientTestsBase { - private final ClientLogger logger = new ClientLogger(QueueAsyncClientTests.class); - - private QueueAsyncClient client; - - @Override - protected void beforeTest() { - queueName = getQueueName(); - helper = new TestHelpers(); - - if (interceptorManager.isPlaybackMode()) { - client = helper.setupClient((connectionString, endpoint) -> new QueueClientBuilder() - .connectionString(connectionString) - .queueName(queueName) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildAsyncClient(), true, logger); - } else { - client = helper.setupClient((connectionString, endpoint) -> new QueueClientBuilder() - .connectionString(connectionString) - .queueName(queueName) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .buildAsyncClient(), false, logger); - } - } - - @Override - protected void afterTest() { - try { - client.clearMessages().block(); - client.delete().block(); - } catch (StorageErrorException ex) { - // Queue already delete, that's what we wanted anyways. - } - } - - @Override - public void createWithSharedKey() { - - } - - @Override - public void createWithSASToken() { - // Need to find a way to get SAS tokens from the storage account - } - - @Override - public void createWithMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - StepVerifier.create(client.create(metadata)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.getProperties()) - .assertNext(response -> { - helper.assertResponseStatusCode(response, 200); - assertEquals(0, response.value().approximateMessagesCount()); - assertEquals(metadata, response.value().metadata()); - }) - .verifyComplete(); - } - - @Override - public void createTwiceSameMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - StepVerifier.create(client.create(metadata)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.create(metadata)) - .assertNext(response -> helper.assertResponseStatusCode(response, 204)) - .verifyComplete(); - } - - @Override - public void createTwiceDifferentMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.create(metadata)) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 409)); - } - - @Override - public void deleteExisting() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.enqueueMessage("This queue will be deleted")) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.delete()) - .assertNext(response -> helper.assertResponseStatusCode(response, 204)) - .verifyComplete(); - - helper.sleepInRecordMode(Duration.ofSeconds(30)); - - StepVerifier.create(client.enqueueMessage("This should fail")) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void deleteNonExistent() { - StepVerifier.create(client.delete()) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void getProperties() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - StepVerifier.create(client.create(metadata)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.getProperties()) - .assertNext(response -> { - helper.assertResponseStatusCode(response, 200); - assertEquals(0, response.value().approximateMessagesCount()); - assertEquals(metadata, response.value().metadata()); - }) - .verifyComplete(); - } - - @Override - public void getPropertiesQueueDoesNotExist() { - StepVerifier.create(client.getProperties()) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void setMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.setMetadata(metadata)) - .assertNext(response -> helper.assertResponseStatusCode(response, 204)) - .verifyComplete(); - - StepVerifier.create(client.getProperties()) - .assertNext(response -> { - helper.assertResponseStatusCode(response, 200); - assertEquals(0, response.value().approximateMessagesCount()); - assertEquals(metadata, response.value().metadata()); - }) - .verifyComplete(); - } - - @Override - public void setMetadataQueueDoesNotExist() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - StepVerifier.create(client.setMetadata(metadata)) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void setInvalidMetadata() { - Map badMetadata = Collections.singletonMap("", "bad metadata"); - - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.setMetadata(badMetadata)) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void deleteMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - StepVerifier.create(client.create(metadata)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.getProperties()) - .assertNext(response -> { - helper.assertResponseStatusCode(response, 200); - assertEquals(0, response.value().approximateMessagesCount()); - assertEquals(metadata, response.value().metadata()); - }) - .verifyComplete(); - - StepVerifier.create(client.setMetadata(null)) - .assertNext(response -> helper.assertResponseStatusCode(response, 204)) - .verifyComplete(); - - StepVerifier.create(client.getProperties()) - .assertNext(response -> { - helper.assertResponseStatusCode(response, 200); - assertEquals(Collections.EMPTY_MAP, response.value().metadata()); - }) - .verifyComplete(); - } - - @Override - public void getAccessPolicy() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.getAccessPolicy()) - .expectNextCount(0) - .verifyComplete(); - } - - @Override - public void getAccessPolicyQueueDoesNotExist() { - StepVerifier.create(client.getAccessPolicy()) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void setAccessPolicy() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - AccessPolicy accessPolicy = new AccessPolicy() - .permission("raup") - .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) - .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)); - - SignedIdentifier permission = new SignedIdentifier() - .id("testpermission") - .accessPolicy(accessPolicy); - - StepVerifier.create(client.setAccessPolicy(Collections.singletonList(permission))) - .assertNext(response -> helper.assertResponseStatusCode(response, 204)) - .verifyComplete(); - - StepVerifier.create(client.getAccessPolicy()) - .assertNext(response -> helper.assertPermissionsAreEqual(permission, response)) - .verifyComplete(); - } - - @Override - public void setAccessPolicyQueueDoesNotExist() { - AccessPolicy accessPolicy = new AccessPolicy() - .permission("r") - .start(OffsetDateTime.now()) - .expiry(OffsetDateTime.now()); - - SignedIdentifier permission = new SignedIdentifier() - .id("test-permission") - .accessPolicy(accessPolicy); - - StepVerifier.create(client.setAccessPolicy(Collections.singletonList(permission))) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void setInvalidAccessPolicy() { - AccessPolicy accessPolicy = new AccessPolicy() - .permission("r") - .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) - .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)); - - SignedIdentifier permission = new SignedIdentifier() - .id("theidofthispermissionislongerthanwhatisallowedbytheserviceandshouldfail") - .accessPolicy(accessPolicy); - - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.setAccessPolicy(Collections.singletonList(permission))) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void setTooManyAccessPolicies() { - AccessPolicy accessPolicy = new AccessPolicy() - .permission("r") - .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) - .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)); - - List permissions = new ArrayList<>(); - for (int i = 0; i < 6; i++) { - permissions.add(new SignedIdentifier() - .id("policy" + i) - .accessPolicy(accessPolicy)); - } - - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.setAccessPolicy(permissions)) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void enqueueMessage() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = "test message"; - StepVerifier.create(client.enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.peekMessages()) - .assertNext(peekedMessage -> assertEquals(messageText, peekedMessage.messageText())) - .verifyComplete(); - } - - @Override - public void enqueueEmptyMessage() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = ""; - StepVerifier.create(client.enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.peekMessages()) - .assertNext(peekedMessage -> assertNull(peekedMessage.messageText())) - .verifyComplete(); - } - - @Override - public void enqueueShortTimeToLiveMessage() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = "test message"; - StepVerifier.create(client.enqueueMessage(messageText, Duration.ofSeconds(0), Duration.ofSeconds(2))) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.peekMessages().delaySubscription(Duration.ofSeconds(5))) - .expectNextCount(0) - .verifyComplete(); - } - - @Override - public void enqueueQueueDoesNotExist() { - StepVerifier.create(client.enqueueMessage("this should fail")) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void dequeueMessage() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = "test message"; - StepVerifier.create(client.enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.dequeueMessages()) - .assertNext(dequeuedMessage -> assertEquals(messageText, dequeuedMessage.messageText())) - .verifyComplete(); - } - - @Override - public void dequeueMultipleMessages() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = "test message"; - String messageText2 = "test message 2"; - StepVerifier.create(client.enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.enqueueMessage(messageText2)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.dequeueMessages(2)) - .assertNext(dequeuedMessage -> assertEquals(messageText, dequeuedMessage.messageText())) - .assertNext(dequeuedMessage -> assertEquals(messageText2, dequeuedMessage.messageText())) - .verifyComplete(); - } - - @Override - public void dequeueTooManyMessages() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.dequeueMessages(64)) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void dequeueQueueDoesNotExist() { - StepVerifier.create(client.dequeueMessages()) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void peekMessage() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = "test message"; - StepVerifier.create(client.enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.peekMessages()) - .assertNext(peekedMessage -> assertEquals(messageText, peekedMessage.messageText())) - .verifyComplete(); - } - - @Override - public void peekMultipleMessages() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = "test message"; - String messageText2 = "test message 2"; - StepVerifier.create(client.enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.enqueueMessage(messageText2)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.peekMessages(2)) - .assertNext(peekedMessage -> assertEquals(messageText, peekedMessage.messageText())) - .assertNext(peekedMessage -> assertEquals(messageText2, peekedMessage.messageText())) - .verifyComplete(); - } - - @Override - public void peekTooManyMessages() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.peekMessages(64)) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void peekQueueDoesNotExist() { - StepVerifier.create(client.peekMessages()) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void clearMessages() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.enqueueMessage("test message")) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - StepVerifier.create(client.enqueueMessage("test message")) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - StepVerifier.create(client.enqueueMessage("test message")) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(client.getProperties()) - .assertNext(response -> { - helper.assertResponseStatusCode(response, 200); - assertEquals(3, response.value().approximateMessagesCount()); - }) - .verifyComplete(); - - StepVerifier.create(client.clearMessages()) - .assertNext(response -> helper.assertResponseStatusCode(response, 204)) - .verifyComplete(); - - StepVerifier.create(client.getProperties()) - .assertNext(response -> { - helper.assertResponseStatusCode(response, 200); - assertEquals(0, response.value().approximateMessagesCount()); - }) - .verifyComplete(); - } - - @Override - public void clearMessagesQueueDoesNotExist() { - StepVerifier.create(client.clearMessages()) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void deleteMessage() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = "test message"; - StepVerifier.create(client.enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - DequeuedMessage dequeuedMessage = client.dequeueMessages().blockFirst(); - assertEquals(messageText, dequeuedMessage.messageText()); - StepVerifier.create(client.deleteMessage(dequeuedMessage.messageId(), dequeuedMessage.popReceipt())) - .assertNext(response -> helper.assertResponseStatusCode(response, 204)) - .verifyComplete(); - - StepVerifier.create(client.getProperties()) - .assertNext(response -> { - helper.assertResponseStatusCode(response, 200); - assertEquals(0, response.value().approximateMessagesCount()); - }) - .verifyComplete(); - } - - @Override - public void deleteMessageInvalidMessageId() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = "test message"; - StepVerifier.create(client.enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - DequeuedMessage dequeuedMessage = new DequeuedMessage(); - StepVerifier.create(client.dequeueMessages()) - .assertNext(response -> { - assertEquals(messageText, response.messageText()); - dequeuedMessage.popReceipt(response.popReceipt()).messageId(response.messageId()); - }) - .verifyComplete(); - - StepVerifier.create(client.deleteMessage(dequeuedMessage.messageId() + "random", dequeuedMessage.popReceipt())) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void deleteMessageInvalidPopReceipt() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = "test message"; - StepVerifier.create(client.enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - DequeuedMessage dequeuedMessage = new DequeuedMessage(); - StepVerifier.create(client.dequeueMessages()) - .assertNext(response -> { - assertEquals(messageText, response.messageText()); - dequeuedMessage.popReceipt(response.popReceipt()).messageId(response.messageId()); - }) - .verifyComplete(); - - StepVerifier.create(client.deleteMessage(dequeuedMessage.messageId(), dequeuedMessage.popReceipt() + "random")) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void deleteMessageQueueDoesNotExist() { - StepVerifier.create(client.deleteMessage("invalid", "call")) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void updateMessage() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = "test message"; - StepVerifier.create(client.enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - DequeuedMessage dequeuedMessage = client.dequeueMessages().blockFirst(); - assertEquals(messageText, dequeuedMessage.messageText()); - - String updatedMessageText = "updated test message"; - StepVerifier.create(client.updateMessage(updatedMessageText, dequeuedMessage.messageId(), dequeuedMessage.popReceipt(), Duration.ofSeconds(1))) - .assertNext(response -> helper.assertResponseStatusCode(response, 204)) - .verifyComplete(); - - StepVerifier.create(client.peekMessages().delaySubscription(Duration.ofSeconds(2))) - .assertNext(response -> assertEquals(updatedMessageText, response.messageText())) - .verifyComplete(); - } - - @Override - public void updateMessageInvalidMessageId() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = "test message"; - StepVerifier.create(client.enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - DequeuedMessage dequeuedMessage = client.dequeueMessages().blockFirst(); - assertEquals(messageText, dequeuedMessage.messageText()); - - String updatedMessageText = "updated test message"; - StepVerifier.create(client.updateMessage(updatedMessageText, dequeuedMessage.messageId() + "random", dequeuedMessage.popReceipt(), Duration.ofSeconds(1))) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 404)); - } - - @Override - public void updateMessageInvalidPopReceipt() { - StepVerifier.create(client.create()) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - String messageText = "test message"; - StepVerifier.create(client.enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - DequeuedMessage dequeuedMessage = client.dequeueMessages().blockFirst(); - assertEquals(messageText, dequeuedMessage.messageText()); - - String updatedMessageText = "updated test message"; - StepVerifier.create(client.updateMessage(updatedMessageText, dequeuedMessage.messageId(), dequeuedMessage.popReceipt() + "random", Duration.ofSeconds(1))) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 400)); - } - - @Override - public void updateMessageQueueDoesNotExist() { - StepVerifier.create(client.updateMessage("queue", "doesn't", "exist", Duration.ofSeconds(5))) - .verifyErrorSatisfies(throwable -> helper.assertExceptionStatusCode(throwable, 400)); - } -} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueClientTests.java b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueClientTests.java deleted file mode 100644 index 4e3f782d7ec6..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueClientTests.java +++ /dev/null @@ -1,653 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.queue; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.rest.Response; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.queue.models.AccessPolicy; -import com.azure.storage.queue.models.DequeuedMessage; -import com.azure.storage.queue.models.PeekedMessage; -import com.azure.storage.queue.models.QueueProperties; -import com.azure.storage.queue.models.SignedIdentifier; -import com.azure.storage.queue.models.StorageErrorException; -import com.azure.storage.queue.models.UpdatedMessage; - -import java.time.Duration; -import java.time.LocalDateTime; -import java.time.OffsetDateTime; -import java.time.ZoneOffset; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; - -public class QueueClientTests extends QueueClientTestsBase { - private final ClientLogger logger = new ClientLogger(QueueClientTests.class); - - private QueueClient client; - - @Override - protected void beforeTest() { - queueName = getQueueName(); - helper = new TestHelpers(); - - if (interceptorManager.isPlaybackMode()) { - client = helper.setupClient((connectionString, endpoint) -> new QueueClientBuilder() - .connectionString(connectionString) - .queueName(queueName) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildClient(), true, logger); - } else { - client = helper.setupClient((connectionString, endpoint) -> new QueueClientBuilder() - .connectionString(connectionString) - .queueName(queueName) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .buildClient(), false, logger); - } - } - - @Override - protected void afterTest() { - try { - client.clearMessages(); - client.delete(); - } catch (StorageErrorException ex) { - // Queue already delete, that's what we wanted anyways. - } - } - - @Override - public void createWithSharedKey() { - - } - - @Override - public void createWithSASToken() { - // Need to find a way to get SAS tokens from the storage account - } - - @Override - public void createWithMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - helper.assertResponseStatusCode(client.create(metadata), 201); - - QueueProperties properties = client.getProperties().value(); - assertEquals(metadata, properties.metadata()); - } - - @Override - public void createTwiceSameMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - helper.assertResponseStatusCode(client.create(metadata), 201); - helper.assertResponseStatusCode(client.create(metadata), 204); - } - - @Override - public void createTwiceDifferentMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - helper.assertResponseStatusCode(client.create(), 201); - - try { - client.create(metadata); - fail("Creating a queue twice with different metadata values should throw an exception."); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 409); - } - } - - @Override - public void deleteExisting() { - helper.assertResponseStatusCode(client.create(), 201); - helper.assertResponseStatusCode(client.enqueueMessage("This queue will be deleted"), 201); - helper.assertResponseStatusCode(client.delete(), 204); - - helper.sleepInRecordMode(Duration.ofSeconds(30)); - - try { - client.enqueueMessage("This should fail"); - fail("Attempting to work with a queue that has been deleted should throw an exception."); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void deleteNonExistent() { - try { - client.delete(); - fail("Attempting to delete a queue that doesn't exist should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void getProperties() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - helper.assertResponseStatusCode(client.create(metadata), 201); - - Response response = client.getProperties(); - helper.assertResponseStatusCode(response, 200); - assertEquals(0, response.value().approximateMessagesCount()); - assertEquals(metadata, response.value().metadata()); - } - - @Override - public void getPropertiesQueueDoesNotExist() { - try { - client.getProperties(); - fail("Attempting to get properties of a queue that doesn't exist should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void setMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - helper.assertResponseStatusCode(client.create(), 201); - - helper.assertResponseStatusCode(client.setMetadata(metadata), 204); - - Response response = client.getProperties(); - helper.assertResponseStatusCode(response, 200); - assertEquals(0, response.value().approximateMessagesCount()); - assertEquals(metadata, response.value().metadata()); - } - - @Override - public void setMetadataQueueDoesNotExist() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - try { - client.setMetadata(metadata); - fail("Attempting to set metadata on a queue that doesn't exist should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void setInvalidMetadata() { - Map badMetadata = Collections.singletonMap("", "bad metadata"); - - helper.assertResponseStatusCode(client.create(), 201); - try { - client.setMetadata(badMetadata); - fail("Attempting to set invalid metadata on a queue that doesn't exist should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void deleteMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - helper.assertResponseStatusCode(client.create(metadata), 201); - - Response response = client.getProperties(); - helper.assertResponseStatusCode(response, 200); - assertEquals(0, response.value().approximateMessagesCount()); - assertEquals(metadata, response.value().metadata()); - - helper.assertResponseStatusCode(client.setMetadata(null), 204); - - response = client.getProperties(); - helper.assertResponseStatusCode(response, 200); - assertEquals(0, response.value().approximateMessagesCount()); - assertEquals(Collections.EMPTY_MAP, response.value().metadata()); - } - - @Override - public void getAccessPolicy() { - helper.assertResponseStatusCode(client.create(), 201); - - Iterable accessPolicies = client.getAccessPolicy(); - assertFalse(accessPolicies.iterator().hasNext()); - } - - @Override - public void getAccessPolicyQueueDoesNotExist() { - try { - client.getAccessPolicy().iterator().hasNext(); - fail("Attempting to get access policies on a queue that doesn't exist should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void setAccessPolicy() { - helper.assertResponseStatusCode(client.create(), 201); - - AccessPolicy accessPolicy = new AccessPolicy() - .permission("raup") - .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) - .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)); - - SignedIdentifier permission = new SignedIdentifier() - .id("testpermission") - .accessPolicy(accessPolicy); - - helper.assertResponseStatusCode(client.setAccessPolicy(Collections.singletonList(permission)), 204); - - Iterator accessPolicies = client.getAccessPolicy().iterator(); - helper.assertPermissionsAreEqual(permission, accessPolicies.next()); - assertFalse(accessPolicies.hasNext()); - } - - @Override - public void setAccessPolicyQueueDoesNotExist() { - AccessPolicy accessPolicy = new AccessPolicy() - .permission("r") - .start(OffsetDateTime.now()) - .expiry(OffsetDateTime.now()); - - SignedIdentifier permission = new SignedIdentifier() - .id("test-permission") - .accessPolicy(accessPolicy); - - try { - client.setAccessPolicy(Collections.singletonList(permission)); - fail("Attempting to set access policies on a queue that doesn't exist should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void setInvalidAccessPolicy() { - AccessPolicy accessPolicy = new AccessPolicy() - .permission("r") - .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) - .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)); - - SignedIdentifier permission = new SignedIdentifier() - .id("theidofthispermissionislongerthanwhatisallowedbytheserviceandshouldfail") - .accessPolicy(accessPolicy); - - helper.assertResponseStatusCode(client.create(), 201); - - try { - client.setAccessPolicy(Collections.singletonList(permission)); - fail("Attempting to set invalid access policies on a queue that doesn't exist should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void setTooManyAccessPolicies() { - List permissions = new ArrayList<>(); - - AccessPolicy accessPolicy = new AccessPolicy() - .permission("r") - .start(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) - .expiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)); - - for (int i = 0; i < 6; i++) { - permissions.add(new SignedIdentifier() - .id("policy" + i) - .accessPolicy(accessPolicy)); - } - - helper.assertResponseStatusCode(client.create(), 201); - - try { - client.setAccessPolicy(permissions); - fail("Attempting to set more than five access policies on a queue that doesn't exist should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void enqueueMessage() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = "test message"; - helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); - - Iterator response = client.peekMessages().iterator(); - assertEquals(messageText, response.next().messageText()); - assertFalse(response.hasNext()); - } - - @Override - public void enqueueEmptyMessage() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = ""; - helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); - - Iterator response = client.peekMessages().iterator(); - assertNull(response.next().messageText()); - assertFalse(response.hasNext()); - } - - @Override - public void enqueueShortTimeToLiveMessage() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = "test message"; - helper.assertResponseStatusCode(client.enqueueMessage(messageText, Duration.ofSeconds(0), Duration.ofSeconds(2)), 201); - - helper.sleepInRecordMode(Duration.ofSeconds(5)); - Iterator response = client.peekMessages().iterator(); - assertFalse(response.hasNext()); - } - - @Override - public void enqueueQueueDoesNotExist() { - try { - client.enqueueMessage("This should fail"); - fail("Attempting to enqueue a message on a queue that doesn't exist should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void dequeueMessage() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = "test message"; - helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); - - Iterator response = client.dequeueMessages().iterator(); - assertEquals(messageText, response.next().messageText()); - assertFalse(response.hasNext()); - } - - @Override - public void dequeueMultipleMessages() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = "test message"; - String messageText2 = "test message 2"; - helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); - helper.assertResponseStatusCode(client.enqueueMessage(messageText2), 201); - - Iterator response = client.dequeueMessages(2).iterator(); - assertEquals(messageText, response.next().messageText()); - assertEquals(messageText2, response.next().messageText()); - assertFalse(response.hasNext()); - } - - @Override - public void dequeueTooManyMessages() { - helper.assertResponseStatusCode(client.create(), 201); - - try { - client.dequeueMessages(64).iterator().hasNext(); - fail("Attempting to get more than 32 messages from a queue should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void dequeueQueueDoesNotExist() { - try { - client.dequeueMessages().iterator().hasNext(); - fail("Attempting to get messages from a queue that doesn't exist should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void peekMessage() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = "test message"; - helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); - - Iterator response = client.peekMessages().iterator(); - assertEquals(messageText, response.next().messageText()); - assertFalse(response.hasNext()); - } - - @Override - public void peekMultipleMessages() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = "test message"; - String messageText2 = "test message 2"; - helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); - helper.assertResponseStatusCode(client.enqueueMessage(messageText2), 201); - - Iterator response = client.peekMessages(2).iterator(); - assertEquals(messageText, response.next().messageText()); - assertEquals(messageText2, response.next().messageText()); - assertFalse(response.hasNext()); - } - - @Override - public void peekTooManyMessages() { - helper.assertResponseStatusCode(client.create(), 201); - - try { - client.peekMessages(64).iterator().hasNext(); - fail("Attempting to peek more than 32 messages from a queue should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void peekQueueDoesNotExist() { - try { - client.peekMessages().iterator().hasNext(); - fail("Attempting to peek messages from a queue that doesn't exist should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void clearMessages() { - helper.assertResponseStatusCode(client.create(), 201); - - for (int i = 0; i < 3; i++) { - helper.assertResponseStatusCode(client.enqueueMessage("test message"), 201); - } - - Response response = client.getProperties(); - helper.assertResponseStatusCode(response, 200); - assertEquals(3, response.value().approximateMessagesCount()); - - helper.assertResponseStatusCode(client.clearMessages(), 204); - - response = client.getProperties(); - helper.assertResponseStatusCode(response, 200); - assertEquals(0, response.value().approximateMessagesCount()); - } - - @Override - public void clearMessagesQueueDoesNotExist() { - try { - client.clearMessages(); - fail("Attempting to clear messages of a queue that doesn't exist should throw an exception"); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void deleteMessage() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = "test message"; - helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); - - Iterator response = client.dequeueMessages().iterator(); - DequeuedMessage message = response.next(); - assertFalse(response.hasNext()); - assertEquals(messageText, message.messageText()); - - helper.assertResponseStatusCode(client.deleteMessage(message.messageId(), message.popReceipt()), 204); - - Response propertiesResponse = client.getProperties(); - helper.assertResponseStatusCode(propertiesResponse, 200); - assertEquals(0, propertiesResponse.value().approximateMessagesCount()); - } - - @Override - public void deleteMessageInvalidMessageId() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = "test message"; - helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); - - Iterator response = client.dequeueMessages().iterator(); - DequeuedMessage message = response.next(); - assertFalse(response.hasNext()); - assertEquals(messageText, message.messageText()); - - try { - client.deleteMessage(message.messageId() + "random", message.popReceipt()); - fail("Attempting to delete a message with an invalid ID should throw an exception."); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void deleteMessageInvalidPopReceipt() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = "test message"; - helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); - - Iterator response = client.dequeueMessages().iterator(); - DequeuedMessage message = response.next(); - assertFalse(response.hasNext()); - assertEquals(messageText, message.messageText()); - - try { - client.deleteMessage(message.messageId(), message.popReceipt() + "random"); - fail("Attempting to delete a message with an invalid popReceipt should throw an exception."); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void deleteMessageQueueDoesNotExist() { - try { - client.deleteMessage("invalid", "call"); - fail("Attempting to delete a message from a queue that doesn't exist should throw an exception."); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void updateMessage() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = "test message"; - helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); - - Iterator response = client.dequeueMessages().iterator(); - DequeuedMessage message = response.next(); - assertEquals(messageText, message.messageText()); - assertFalse(response.hasNext()); - - String updatedMessageText = "updated test message"; - Response updatedMessageResponse = client.updateMessage(updatedMessageText, message.messageId(), message.popReceipt(), Duration.ofSeconds(1)); - helper.assertResponseStatusCode(updatedMessageResponse, 204); - - helper.sleepInRecordMode(Duration.ofSeconds(2)); - - Iterator peekedMessageIterator = client.peekMessages().iterator(); - PeekedMessage peekedMessage = peekedMessageIterator.next(); - assertEquals(updatedMessageText, peekedMessage.messageText()); - assertFalse(peekedMessageIterator.hasNext()); - } - - @Override - public void updateMessageInvalidMessageId() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = "test message"; - helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); - - Iterator response = client.dequeueMessages().iterator(); - DequeuedMessage message = response.next(); - assertEquals(messageText, message.messageText()); - assertFalse(response.hasNext()); - - String updatedMessageText = "updated test message"; - try { - client.updateMessage(updatedMessageText, message.messageId() + "random", message.popReceipt(), Duration.ofSeconds(1)); - fail("Attempting to update a message with an invalid ID should throw an exception."); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void updateMessageInvalidPopReceipt() { - helper.assertResponseStatusCode(client.create(), 201); - - String messageText = "test message"; - helper.assertResponseStatusCode(client.enqueueMessage(messageText), 201); - - Iterator response = client.dequeueMessages().iterator(); - DequeuedMessage message = response.next(); - assertEquals(messageText, message.messageText()); - assertFalse(response.hasNext()); - - String updatedMessageText = "updated test message"; - try { - client.updateMessage(updatedMessageText, message.messageId(), message.popReceipt() + "random", Duration.ofSeconds(1)); - fail("Attempting to update a message with an invalid popReceipt should throw an exception."); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 400); - } - } - - @Override - public void updateMessageQueueDoesNotExist() { - try { - client.updateMessage("queue", "doesn't", "exist", Duration.ofSeconds(5)); - fail("Attempting to update a message on a queue that doesn't exist should throw an exception."); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 400); - } - } -} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueClientTestsBase.java b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueClientTestsBase.java deleted file mode 100644 index b83d9a1459bb..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueClientTestsBase.java +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.queue; - -import com.azure.core.test.TestBase; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TestName; - -public abstract class QueueClientTestsBase extends TestBase { - String queueName; - TestHelpers helper; - - @Rule - public TestName testName = new TestName(); - - @Override - public String testName() { - return testName.getMethodName(); - } - - String getQueueName() { - return testResourceNamer.randomName("queue", 16).toLowerCase(); - } - - @Test - public abstract void createWithSharedKey(); - - @Test - public abstract void createWithSASToken(); - - @Test - public abstract void createWithMetadata(); - - @Test - public abstract void createTwiceSameMetadata(); - - @Test - public abstract void createTwiceDifferentMetadata(); - - @Test - public abstract void deleteExisting(); - - @Test - public abstract void deleteNonExistent(); - - @Test - public abstract void getProperties(); - - @Test - public abstract void getPropertiesQueueDoesNotExist(); - - @Test - public abstract void setMetadata(); - - @Test - public abstract void setMetadataQueueDoesNotExist(); - - @Test - public abstract void setInvalidMetadata(); - - @Test - public abstract void deleteMetadata(); - - @Test - public abstract void getAccessPolicy(); - - @Test - public abstract void getAccessPolicyQueueDoesNotExist(); - - @Test - public abstract void setAccessPolicy(); - - @Test - public abstract void setAccessPolicyQueueDoesNotExist(); - - @Test - public abstract void setInvalidAccessPolicy(); - - @Test - public abstract void setTooManyAccessPolicies(); - - @Test - public abstract void enqueueMessage(); - - @Test - public abstract void enqueueEmptyMessage(); - - @Test - public abstract void enqueueShortTimeToLiveMessage(); - - @Test - public abstract void enqueueQueueDoesNotExist(); - - @Test - public abstract void dequeueMessage(); - - @Test - public abstract void dequeueMultipleMessages(); - - @Test - public abstract void dequeueTooManyMessages(); - - @Test - public abstract void dequeueQueueDoesNotExist(); - - @Test - public abstract void peekMessage(); - - @Test - public abstract void peekMultipleMessages(); - - @Test - public abstract void peekTooManyMessages(); - - @Test - public abstract void peekQueueDoesNotExist(); - - @Test - public abstract void clearMessages(); - - @Test - public abstract void clearMessagesQueueDoesNotExist(); - - @Test - public abstract void deleteMessage(); - - @Test - public abstract void deleteMessageInvalidMessageId(); - - @Test - public abstract void deleteMessageInvalidPopReceipt(); - - @Test - public abstract void deleteMessageQueueDoesNotExist(); - - @Test - public abstract void updateMessage(); - - @Test - public abstract void updateMessageInvalidMessageId(); - - @Test - public abstract void updateMessageInvalidPopReceipt(); - - @Test - public abstract void updateMessageQueueDoesNotExist(); -} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceAsyncClientTests.java b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceAsyncClientTests.java deleted file mode 100644 index 1be35f6a8910..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceAsyncClientTests.java +++ /dev/null @@ -1,251 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.queue; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.queue.models.Logging; -import com.azure.storage.queue.models.Metrics; -import com.azure.storage.queue.models.QueueItem; -import com.azure.storage.queue.models.QueuesSegmentOptions; -import com.azure.storage.queue.models.RetentionPolicy; -import com.azure.storage.queue.models.StorageErrorException; -import com.azure.storage.queue.models.StorageServiceProperties; -import reactor.test.StepVerifier; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.Map; - -import static org.junit.Assert.assertEquals; - -public class QueueServiceAsyncClientTests extends QueueServiceClientTestsBase { - private final ClientLogger logger = new ClientLogger(QueueServiceAsyncClientTests.class); - - private QueueServiceAsyncClient serviceClient; - - @Override - protected void beforeTest() { - queueName = getQueueName(); - helper = new TestHelpers(); - - if (interceptorManager.isPlaybackMode()) { - serviceClient = helper.setupClient((connectionString, endpoint) -> new QueueServiceClientBuilder() - .connectionString(connectionString) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildAsyncClient(), true, logger); - } else { - serviceClient = helper.setupClient((connectionString, endpoint) -> new QueueServiceClientBuilder() - .connectionString(connectionString) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .buildAsyncClient(), false, logger); - } - } - - @Override - protected void afterTest() { - serviceClient.listQueues(new QueuesSegmentOptions().prefix(queueName)) - .collectList() - .block() - .forEach(queue -> { - QueueAsyncClient client = serviceClient.getQueueAsyncClient(queue.name()); - try { - client.clearMessages().then(client.delete()).block(); - } catch (StorageErrorException ex) { - // Queue already delete, that's what we wanted anyways. - } - }); - } - - @Override - public void getQueueDoesNotCreateAQueue() { - StepVerifier.create(serviceClient.getQueueAsyncClient(queueName).enqueueMessage("Expecting an exception")); - } - - @Override - public void createQueue() { - StepVerifier.create(serviceClient.createQueue(queueName).block().value().enqueueMessage("Testing service client creating a queue")) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - } - - @Override - public void createQueueWithMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - QueueAsyncClient client = serviceClient.createQueue(queueName, metadata).block().value(); - - StepVerifier.create(client.getProperties()) - .assertNext(response -> { - assertEquals(metadata, response.value().metadata()); - }) - .verifyComplete(); - } - - @Override - public void createQueueTwiceSameMetadata() { - final String messageText = "Testing service client creating the same queue twice does not modify the queue"; - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - StepVerifier.create(serviceClient.createQueue(queueName, metadata).block().value().enqueueMessage(messageText)) - .assertNext(response -> helper.assertResponseStatusCode(response, 201)) - .verifyComplete(); - - StepVerifier.create(serviceClient.createQueue(queueName, metadata).block().value().peekMessages()) - .assertNext(response -> assertEquals(messageText, response.messageText())) - .verifyComplete(); - } - - @Override - public void createQueueTwiceDifferentMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - try { - serviceClient.createQueue(queueName); - serviceClient.createQueue(queueName, metadata); - } catch (Exception exception) { - } - } - - @Override - public void deleteExistingQueue() { - QueueAsyncClient client = serviceClient.createQueue(queueName).block().value(); - serviceClient.deleteQueue(queueName).block(); - - StepVerifier.create(client.enqueueMessage("Expecting an exception")); - } - - @Override - public void deleteNonExistentQueue() { - try { - serviceClient.deleteQueue(queueName); - } catch (Exception exception) { - } - } - - @Override - public void listQueues() { - LinkedList testQueues = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - QueueItem queue = new QueueItem().name(queueName + i); - testQueues.add(queue); - serviceClient.createQueue(queue.name(), queue.metadata()).block(); - } - - StepVerifier.create(serviceClient.listQueues(defaultSegmentOptions())) - .assertNext(result -> helper.assertQueuesAreEqual(testQueues.pop(), result)) - .assertNext(result -> helper.assertQueuesAreEqual(testQueues.pop(), result)) - .assertNext(result -> helper.assertQueuesAreEqual(testQueues.pop(), result)) - .verifyComplete(); - } - - @Override - public void listQueuesIncludeMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - LinkedList testQueues = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - QueueItem queue = new QueueItem().name(queueName + i); - if (i % 2 == 0) { - queue.metadata(metadata); - } - - testQueues.add(queue); - serviceClient.createQueue(queue.name(), queue.metadata()).block(); - } - - StepVerifier.create(serviceClient.listQueues(defaultSegmentOptions().includeMetadata(true))) - .assertNext(result -> helper.assertQueuesAreEqual(testQueues.pop(), result)) - .assertNext(result -> helper.assertQueuesAreEqual(testQueues.pop(), result)) - .assertNext(result -> helper.assertQueuesAreEqual(testQueues.pop(), result)) - .verifyComplete(); - } - - @Override - public void listQueuesWithPrefix() { - LinkedList testQueues = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - QueueItem queue = new QueueItem(); - if (i % 2 == 0) { - queue.name(queueName + "prefix" + i); - testQueues.add(queue); - } else { - queue.name(queueName + i); - } - - serviceClient.createQueue(queue.name(), queue.metadata()).block(); - } - - StepVerifier.create(serviceClient.listQueues(defaultSegmentOptions().prefix(queueName + "prefix"))) - .assertNext(result -> helper.assertQueuesAreEqual(testQueues.pop(), result)) - .assertNext(result -> helper.assertQueuesAreEqual(testQueues.pop(), result)) - .verifyComplete(); - } - - @Override - public void listQueuesWithLimit() { - LinkedList testQueues = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - QueueItem queue = new QueueItem().name(queueName + i); - testQueues.add(queue); - serviceClient.createQueue(queue.name(), queue.metadata()).block(); - } - - StepVerifier.create(serviceClient.listQueues(defaultSegmentOptions().maxResults(2))) - .assertNext(queueItem -> helper.assertQueuesAreEqual(queueItem, testQueues.pop())) - .assertNext(queueItem -> helper.assertQueuesAreEqual(queueItem, testQueues.pop())) - .assertNext(queueItem -> helper.assertQueuesAreEqual(queueItem, testQueues.pop())) - .verifyComplete(); - } - - @Override - public void setProperties() { - StorageServiceProperties originalProperties = serviceClient.getProperties().block().value(); - - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Logging logging = new Logging().version("1.0") - .delete(true) - .write(true) - .retentionPolicy(retentionPolicy); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - StorageServiceProperties updatedProperties = new StorageServiceProperties().logging(logging) - .hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(new ArrayList<>()); - - StepVerifier.create(serviceClient.setProperties(updatedProperties)) - .assertNext(response -> helper.assertResponseStatusCode(response, 202)) - .verifyComplete(); - - StepVerifier.create(serviceClient.getProperties()) - .assertNext(response -> helper.assertQueueServicePropertiesAreEqual(updatedProperties, response.value())) - .verifyComplete(); - - StepVerifier.create(serviceClient.setProperties(originalProperties)) - .assertNext(response -> helper.assertResponseStatusCode(response, 202)) - .verifyComplete(); - - StepVerifier.create(serviceClient.getProperties()) - .assertNext(response -> helper.assertQueueServicePropertiesAreEqual(originalProperties, response.value())) - .verifyComplete(); - } -} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceClientTests.java b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceClientTests.java deleted file mode 100644 index 39e1b9d2beb4..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceClientTests.java +++ /dev/null @@ -1,255 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.queue; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.VoidResponse; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.queue.models.EnqueuedMessage; -import com.azure.storage.queue.models.Logging; -import com.azure.storage.queue.models.Metrics; -import com.azure.storage.queue.models.PeekedMessage; -import com.azure.storage.queue.models.QueueItem; -import com.azure.storage.queue.models.QueueProperties; -import com.azure.storage.queue.models.QueuesSegmentOptions; -import com.azure.storage.queue.models.RetentionPolicy; -import com.azure.storage.queue.models.StorageErrorException; -import com.azure.storage.queue.models.StorageServiceProperties; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.Map; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - -public class QueueServiceClientTests extends QueueServiceClientTestsBase { - private final ClientLogger logger = new ClientLogger(QueueServiceClientTests.class); - - private QueueServiceClient serviceClient; - - @Override - protected void beforeTest() { - queueName = getQueueName(); - helper = new TestHelpers(); - - if (interceptorManager.isPlaybackMode()) { - serviceClient = helper.setupClient((connectionString, endpoint) -> new QueueServiceClientBuilder() - .connectionString(connectionString) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildClient(), true, logger); - } else { - serviceClient = helper.setupClient((connectionString, endpoint) -> new QueueServiceClientBuilder() - .connectionString(connectionString) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .buildClient(), false, logger); - } - } - - @Override - protected void afterTest() { - serviceClient.listQueues(new QueuesSegmentOptions().prefix(queueName)) - .forEach(queueToDelete -> { - try { - QueueClient client = serviceClient.getQueueClient(queueToDelete.name()); - client.clearMessages(); - client.delete(); - } catch (StorageErrorException ex) { - // Queue already delete, that's what we wanted anyways. - } - }); - } - - @Override - public void getQueueDoesNotCreateAQueue() { - try { - serviceClient.getQueueClient(queueName).enqueueMessage("Expecting an exception"); - fail("getQueueClient doesn't create a queue in Azure Storage."); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void createQueue() { - QueueClient client = serviceClient.createQueue(queueName).value(); - Response response = client.enqueueMessage("Testing service client creating a queue"); - helper.assertResponseStatusCode(response, 201); - } - - @Override - public void createQueueWithMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - QueueClient client = serviceClient.createQueue(queueName, metadata).value(); - - Response propertiesResponse = client.getProperties(); - helper.assertResponseStatusCode(propertiesResponse, 200); - assertEquals(metadata, propertiesResponse.value().metadata()); - } - - @Override - public void createQueueTwiceSameMetadata() { - final String messageText = "Testing service client creating the same queue twice does not modify the queue"; - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - EnqueuedMessage enqueuedMessage = serviceClient.createQueue(queueName, metadata).value().enqueueMessage(messageText).value(); - assertNotNull(enqueuedMessage); - - PeekedMessage peekedMessage = serviceClient.createQueue(queueName, metadata).value().peekMessages().iterator().next(); - assertEquals(messageText, peekedMessage.messageText()); - } - - @Override - public void createQueueTwiceDifferentMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - try { - serviceClient.createQueue(queueName); - serviceClient.createQueue(queueName, metadata); - fail("Creating a queue twice with different metadata should throw an exception."); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 409); - } - } - - @Override - public void deleteExistingQueue() { - QueueClient client = serviceClient.createQueue(queueName).value(); - serviceClient.deleteQueue(queueName); - - try { - client.enqueueMessage("Expecting an exception"); - fail("Attempting to enqueue a message on a client that has been delete should throw an exception."); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void deleteNonExistentQueue() { - try { - serviceClient.deleteQueue(queueName); - fail("Attempting to delete a queue that doesn't exist should throw an exception."); - } catch (Exception exception) { - helper.assertExceptionStatusCode(exception, 404); - } - } - - @Override - public void listQueues() { - LinkedList testQueues = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - QueueItem queue = new QueueItem().name(queueName + i); - testQueues.add(queue); - serviceClient.createQueue(queue.name(), queue.metadata()); - } - - for (QueueItem queue : serviceClient.listQueues(defaultSegmentOptions())) { - helper.assertQueuesAreEqual(testQueues.pop(), queue); - } - } - - @Override - public void listQueuesIncludeMetadata() { - Map metadata = new HashMap<>(); - metadata.put("metadata1", "value1"); - metadata.put("metadata2", "value2"); - - LinkedList testQueues = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - QueueItem queue = new QueueItem().name(queueName + i); - if (i % 2 == 0) { - queue.metadata(metadata); - } - - testQueues.add(queue); - serviceClient.createQueue(queue.name(), queue.metadata()); - } - - for (QueueItem queue : serviceClient.listQueues(defaultSegmentOptions().includeMetadata(true))) { - helper.assertQueuesAreEqual(testQueues.pop(), queue); - } - } - - @Override - public void listQueuesWithPrefix() { - LinkedList testQueues = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - QueueItem queue = new QueueItem(); - if (i % 2 == 0) { - queue.name(queueName + "prefix" + i); - testQueues.add(queue); - } else { - queue.name(queueName + i); - } - - serviceClient.createQueue(queue.name(), queue.metadata()); - } - - for (QueueItem queue : serviceClient.listQueues(defaultSegmentOptions().prefix(queueName + "prefix"))) { - helper.assertQueuesAreEqual(testQueues.pop(), queue); - } - } - - @Override - public void listQueuesWithLimit() { - LinkedList testQueues = new LinkedList<>(); - for (int i = 0; i < 3; i++) { - QueueItem queue = new QueueItem().name(queueName + i); - testQueues.add(queue); - serviceClient.createQueue(queue.name(), queue.metadata()); - } - - for (QueueItem queue : serviceClient.listQueues(defaultSegmentOptions().maxResults(2))) { - helper.assertQueuesAreEqual(testQueues.pop(), queue); - } - } - - @Override - public void setProperties() { - StorageServiceProperties originalProperties = serviceClient.getProperties().value(); - - RetentionPolicy retentionPolicy = new RetentionPolicy().enabled(true) - .days(3); - - Logging logging = new Logging().version("1.0") - .delete(true) - .write(true) - .retentionPolicy(retentionPolicy); - - Metrics metrics = new Metrics().enabled(true) - .includeAPIs(false) - .retentionPolicy(retentionPolicy) - .version("1.0"); - - StorageServiceProperties updatedProperties = new StorageServiceProperties().logging(logging) - .hourMetrics(metrics) - .minuteMetrics(metrics) - .cors(new ArrayList<>()); - - VoidResponse setResponse = serviceClient.setProperties(updatedProperties); - helper.assertResponseStatusCode(setResponse, 202); - - Response getResponse = serviceClient.getProperties(); - helper.assertQueueServicePropertiesAreEqual(updatedProperties, getResponse.value()); - - setResponse = serviceClient.setProperties(originalProperties); - helper.assertResponseStatusCode(setResponse, 202); - - getResponse = serviceClient.getProperties(); - helper.assertQueueServicePropertiesAreEqual(originalProperties, getResponse.value()); - } -} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceClientTestsBase.java b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceClientTestsBase.java deleted file mode 100644 index f090814fbfc9..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceClientTestsBase.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.queue; - -import com.azure.core.test.TestBase; -import com.azure.storage.queue.models.QueuesSegmentOptions; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TestName; - -public abstract class QueueServiceClientTestsBase extends TestBase { - String queueName; - TestHelpers helper; - - @Rule - public TestName testName = new TestName(); - - @Override - public String testName() { - return testName.getMethodName(); - } - - String getQueueName() { - return testResourceNamer.randomName("queue", 16).toLowerCase(); - } - - @Test - public abstract void getQueueDoesNotCreateAQueue(); - - @Test - public abstract void createQueue(); - - @Test - public abstract void createQueueWithMetadata(); - - @Test - public abstract void createQueueTwiceSameMetadata(); - - @Test - public abstract void createQueueTwiceDifferentMetadata(); - - @Test - public abstract void deleteExistingQueue(); - - @Test - public abstract void deleteNonExistentQueue(); - - @Test - public abstract void listQueues(); - - @Test - public abstract void listQueuesIncludeMetadata(); - - @Test - public abstract void listQueuesWithPrefix(); - - @Test - public abstract void listQueuesWithLimit(); - - @Test - public abstract void setProperties(); - - QueuesSegmentOptions defaultSegmentOptions() { - return new QueuesSegmentOptions().prefix(queueName); - } -} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/TestHelpers.java b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/TestHelpers.java deleted file mode 100644 index 48639715112f..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/TestHelpers.java +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.queue; - -import com.azure.core.http.rest.Response; -import com.azure.core.implementation.util.ImplUtils; -import com.azure.core.util.configuration.ConfigurationManager; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.queue.models.CorsRule; -import com.azure.storage.queue.models.Logging; -import com.azure.storage.queue.models.Metrics; -import com.azure.storage.queue.models.QueueItem; -import com.azure.storage.queue.models.RetentionPolicy; -import com.azure.storage.queue.models.SignedIdentifier; -import com.azure.storage.queue.models.StorageErrorException; -import com.azure.storage.queue.models.StorageServiceProperties; - -import java.time.Duration; -import java.util.List; -import java.util.function.BiFunction; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -/** - * Contains helper methods for unit tests. - */ -class TestHelpers { - private final String azureStorageConnectionString = "AZURE_STORAGE_CONNECTION_STRING"; - private final String azureStorageQueueEndpoint = "AZURE_STORAGE_QUEUE_ENDPOINT"; - - T setupClient(BiFunction clientBuilder, boolean isPlaybackMode, ClientLogger logger) { - String connectionString = "DefaultEndpointsProtocol=https;AccountName=teststorage;AccountKey=atestaccountkey;EndpointSuffix=core.windows.net"; - String queueEndpoint = "https://teststorage.queue.core.windows.net/"; - - if (!isPlaybackMode) { - connectionString = ConfigurationManager.getConfiguration().get(azureStorageConnectionString); - queueEndpoint = ConfigurationManager.getConfiguration().get(azureStorageQueueEndpoint); - } - - if (ImplUtils.isNullOrEmpty(connectionString) && ImplUtils.isNullOrEmpty(queueEndpoint)) { - logger.warning("{} and {} must be set to build the testing client", azureStorageConnectionString, azureStorageQueueEndpoint); - fail(); - return null; - } - - return clientBuilder.apply(connectionString, queueEndpoint); - } - - void assertQueuesAreEqual(QueueItem expected, QueueItem actual) { - if (expected == null) { - assertNull(actual); - } else { - assertEquals(expected.name(), actual.name()); - - if (expected.metadata() != null && !ImplUtils.isNullOrEmpty(actual.metadata())) { - assertEquals(expected.metadata(), actual.metadata()); - } - } - } - - void assertQueueServicePropertiesAreEqual(StorageServiceProperties expected, StorageServiceProperties actual) { - if (expected == null) { - assertNull(actual); - } else { - assertMetricsAreEqual(expected.hourMetrics(), actual.hourMetrics()); - assertMetricsAreEqual(expected.minuteMetrics(), actual.minuteMetrics()); - assertLoggingAreEqual(expected.logging(), actual.logging()); - assertCorsAreEqual(expected.cors(), actual.cors()); - } - } - - private void assertMetricsAreEqual(Metrics expected, Metrics actual) { - if (expected == null) { - assertNull(actual); - } else { - assertEquals(expected.enabled(), actual.enabled()); - assertEquals(expected.includeAPIs(), actual.includeAPIs()); - assertEquals(expected.version(), actual.version()); - assertRetentionPoliciesAreEqual(expected.retentionPolicy(), actual.retentionPolicy()); - } - } - - private void assertLoggingAreEqual(Logging expected, Logging actual) { - if (expected == null) { - assertNull(actual); - } else { - assertEquals(expected.read(), actual.read()); - assertEquals(expected.write(), actual.write()); - assertEquals(expected.delete(), actual.delete()); - assertEquals(expected.version(), actual.version()); - assertRetentionPoliciesAreEqual(expected.retentionPolicy(), actual.retentionPolicy()); - } - } - - private void assertRetentionPoliciesAreEqual(RetentionPolicy expected, RetentionPolicy actual) { - if (expected == null) { - assertNull(actual); - } else { - assertEquals(expected.days(), actual.days()); - assertEquals(expected.enabled(), actual.enabled()); - } - } - - private void assertCorsAreEqual(List expected, List actual) { - if (expected == null) { - assertTrue(ImplUtils.isNullOrEmpty(actual)); - } else { - assertEquals(expected.size(), actual.size()); - for (int i = 0; i < expected.size(); i++) { - assertCorRulesAreEqual(expected.get(i), actual.get(i)); - } - } - } - - private void assertCorRulesAreEqual(CorsRule expected, CorsRule actual) { - if (expected == null) { - assertNull(actual); - } else { - assertEquals(expected.allowedHeaders(), actual.allowedHeaders()); - assertEquals(expected.allowedMethods(), actual.allowedMethods()); - assertEquals(expected.allowedOrigins(), actual.allowedOrigins()); - assertEquals(expected.exposedHeaders(), actual.exposedHeaders()); - assertEquals(expected.maxAgeInSeconds(), actual.maxAgeInSeconds()); - } - } - - void assertPermissionsAreEqual(SignedIdentifier expected, SignedIdentifier actual) { - assertEquals(expected.id(), actual.id()); - assertEquals(expected.accessPolicy().permission(), actual.accessPolicy().permission()); - assertEquals(expected.accessPolicy().start(), actual.accessPolicy().start()); - assertEquals(expected.accessPolicy().expiry(), actual.accessPolicy().expiry()); - } - - void assertResponseStatusCode(Response response, int expectedStatusCode) { - assertEquals(expectedStatusCode, response.statusCode()); - } - - void assertExceptionStatusCode(Throwable throwable, int expectedStatusCode) { - assertTrue(throwable instanceof StorageErrorException); - StorageErrorException storageErrorException = (StorageErrorException) throwable; - assertEquals(expectedStatusCode, storageErrorException.response().statusCode()); - } - - void sleepInRecordMode(Duration duration) { - String azureTestMode = ConfigurationManager.getConfiguration().get("AZURE_TEST_MODE"); - if ("RECORD".equalsIgnoreCase(azureTestMode)) { - sleep(duration); - } - } - - void sleep(Duration duration) { - try { - Thread.sleep(duration.toMillis()); - } catch (InterruptedException ex) { - // Ignore the error - } - } -} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/APISpec.groovy b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/APISpec.groovy new file mode 100644 index 000000000000..0aa82fa36069 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/APISpec.groovy @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.queue.spock + +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.ConfigurationManager +import com.azure.core.util.logging.ClientLogger +import com.azure.storage.queue.QueueClientBuilder +import com.azure.storage.queue.QueueServiceAsyncClient +import com.azure.storage.queue.QueueServiceClient +import com.azure.storage.queue.QueueServiceClientBuilder +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 + TestResourceNamer testResourceName + + // Clients for API tests + QueueServiceClient primaryQueueServiceClient + QueueServiceAsyncClient primaryQueueServiceAsyncClient + + + // Test name for test method name. + def methodName + def testMode = getTestMode() + def connectionString + + // If debugging is enabled, recordings cannot run as there can only be one proxy at a time. + static boolean enableDebugging = false + + /** + * Setup the QueueServiceClient and QueueClient common used for the API tests. + */ + def setup() { + String testName = refactorName(specificationContext.currentIteration.getName()) + String className = specificationContext.getCurrentSpec().getName() + methodName = className + testName + logger.info("Test Mode: {}, Name: {}", testMode, methodName) + interceptorManager = new InterceptorManager(methodName, testMode) + testResourceName = new TestResourceNamer(methodName, testMode, + interceptorManager.getRecordedData()) + if (getTestMode() == TestMode.RECORD) { + connectionString = ConfigurationManager.getConfiguration().get("AZURE_STORAGE_QUEUE_CONNECTION_STRING") + } else { + connectionString = "DefaultEndpointsProtocol=https;AccountName=teststorage;AccountKey=atestaccountkey;" + + "EndpointSuffix=core.windows.net" + } + } + + /** + * Clean up the test queues and messages for the account. + */ + def cleanup() { + + interceptorManager.close() + if (getTestMode() == TestMode.RECORD) { + QueueServiceClient cleanupQueueServiceClient = new QueueServiceClientBuilder() + .connectionString(connectionString) + .buildClient() + cleanupQueueServiceClient.listQueues(new QueuesSegmentOptions().setPrefix(methodName.toLowerCase()), + Duration.ofSeconds(30), Context.NONE).each { + queueItem -> cleanupQueueServiceClient.deleteQueue(queueItem.getName()) + } + } + } + + /** + * Test mode is initialized whenever test is executed. Helper method which is used to determine what to do under + * certain test mode. + * @return The TestMode: + *
      + *
    • Playback: (default if no test mode setup)
    • + *
    + */ + def getTestMode() { + def azureTestMode = ConfigurationManager.getConfiguration().get(AZURE_TEST_MODE) + + if (azureTestMode != null) { + try { + return TestMode.valueOf(azureTestMode.toUpperCase(Locale.US)) + } catch (IllegalArgumentException e) { + logger.error("Could not parse '{}' into TestEnum. Using 'Playback' mode.", azureTestMode) + return TestMode.PLAYBACK + } + } + + logger.info("Environment variable '{}' has not been set yet. Using 'Playback' mode.", AZURE_TEST_MODE) + return TestMode.PLAYBACK + } + + def queueServiceBuilderHelper(final InterceptorManager interceptorManager) { + if (testMode == TestMode.RECORD) { + return new QueueServiceClientBuilder() + .connectionString(connectionString) + .addPolicy(interceptorManager.getRecordPolicy()) + .httpClient(getHttpClient()) + } else { + return new QueueServiceClientBuilder() + .connectionString(connectionString) + .httpClient(interceptorManager.getPlaybackClient()) + } + } + + def queueBuilderHelper(final InterceptorManager interceptorManager) { + def queueName = testResourceName.randomName("queue", 16) + if (testMode == TestMode.RECORD) { + return new QueueClientBuilder() + .connectionString(connectionString) + .queueName(queueName) + .addPolicy(interceptorManager.getRecordPolicy()) + .httpClient(getHttpClient()) + } else { + return new QueueClientBuilder() + .connectionString(connectionString) + .queueName(queueName) + .httpClient(interceptorManager.getPlaybackClient()) + } + } + + private def refactorName(String text) { + def fullName = text.split(" ").collect { it.capitalize() }.join("") + def matcher = (fullName =~ /(.*)(\[)(.*)(\])/) + + if (!matcher.find()) { + return fullName + } + return matcher[0][1] + matcher[0][3] + } + + OffsetDateTime getUTCNow() { + return testResourceName.now() + } + + 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() + } + } +} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueAPITests.groovy b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueAPITests.groovy new file mode 100644 index 000000000000..b4edab2f2a55 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueAPITests.groovy @@ -0,0 +1,440 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.queue.spock + +import com.azure.core.util.Context +import com.azure.storage.queue.QueueClient +import com.azure.storage.queue.models.AccessPolicy +import com.azure.storage.queue.models.SignedIdentifier +import com.azure.storage.queue.models.StorageErrorCode +import com.azure.storage.queue.models.StorageException +import spock.lang.Unroll + +import java.time.Duration +import java.time.LocalDateTime +import java.time.OffsetDateTime +import java.time.ZoneOffset + +class QueueAPITests extends APISpec { + QueueClient queueClient + + static def testMetadata = Collections.singletonMap("metadata", "value") + static def createMetadata = Collections.singletonMap("metadata1", "value") + + def setup() { + primaryQueueServiceClient = queueServiceBuilderHelper(interceptorManager).buildClient() + queueClient = primaryQueueServiceClient.getQueueClient(testResourceName.randomName(methodName, 60)) + } + + def "Create queue with shared key"() { + expect: + QueueTestHelper.assertResponseStatusCode(queueClient.createWithResponse(null, null, null), 201) + } + + def "Delete exist queue"() { + given: + queueClient.create() + when: + def deleteQueueResponse = queueClient.deleteWithResponse(null, null) + then: + QueueTestHelper.assertResponseStatusCode(deleteQueueResponse, 204) + + } + + def "Delete queue error"() { + when: + queueClient.delete() + then: + def e = thrown(StorageException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + + def "Get properties"() { + given: + queueClient.createWithResponse(testMetadata, null, null) + when: + def getPropertiesResponse = queueClient.getPropertiesWithResponse(null, null) + then: + QueueTestHelper.assertResponseStatusCode(getPropertiesResponse, 200) + getPropertiesResponse.getValue().getApproximateMessagesCount() == 0 + testMetadata.equals(getPropertiesResponse.getValue().getMetadata()) + } + + def "Get properties error"() { + when: + queueClient.getProperties() + then: + def e = thrown(StorageException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + + @Unroll + def "Set and clear metadata"() { + given: + queueClient.createWithResponse(matadataInCreate, null, null) + when: + def getPropertiesResponseBefore = queueClient.getPropertiesWithResponse(null, null) + def setMetadataResponse = queueClient.setMetadataWithResponse(metadataInSet, null, null) + def getPropertiesResponseAfter = queueClient.getPropertiesWithResponse(null, null) + then: + QueueTestHelper.assertResponseStatusCode(getPropertiesResponseBefore, 200) + expectMetadataInCreate.equals(getPropertiesResponseBefore.getValue().getMetadata()) + QueueTestHelper.assertResponseStatusCode(setMetadataResponse, 204) + QueueTestHelper.assertResponseStatusCode(getPropertiesResponseAfter, 200) + expectMetadataInSet.equals(getPropertiesResponseAfter.getValue().getMetadata()) + where: + matadataInCreate | metadataInSet | expectMetadataInCreate | expectMetadataInSet + null | testMetadata | Collections.emptyMap() | testMetadata + createMetadata | testMetadata | createMetadata | testMetadata + createMetadata | null | createMetadata | Collections.emptyMap() + testMetadata | testMetadata | testMetadata | testMetadata + null | null | Collections.emptyMap() | Collections.emptyMap() + } + + def "Set metadata queue error"() { + when: + queueClient.setMetadata(testMetadata) + then: + def e = thrown(StorageException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + + @Unroll + def "Set invalid meta"() { + given: + def invalidMetadata = Collections.singletonMap(invalidKey, "value") + queueClient.create() + when: + queueClient.setMetadata(invalidMetadata) + then: + def e = thrown(StorageException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, statusCode, errMessage) + where: + invalidKey | statusCode | errMessage + "invalidMeta" | 403 | StorageErrorCode.AUTHENTICATION_FAILED + "invalid-meta" | 400 | StorageErrorCode.INVALID_METADATA + "12345" | 400 | StorageErrorCode.INVALID_METADATA + "" | 400 | StorageErrorCode.EMPTY_METADATA_KEY + } + + def "Get access policy"() { + given: + queueClient.create() + when: + def accessPolicies = queueClient.getAccessPolicy() + then: + !accessPolicies.iterator().hasNext() + } + + def "Get access policy error"() { + when: + queueClient.getAccessPolicy().iterator().next() + then: + def e = thrown(StorageException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + + def "Set access policy"() { + given: + queueClient.create() + def accessPolicy = new AccessPolicy() + .setPermission("raup") + .setStart(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) + .setExpiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)) + def permission = new SignedIdentifier() + .setId("testpermission") + .setAccessPolicy(accessPolicy) + when: + def setAccessPolicyResponse = queueClient.setAccessPolicyWithResponse(Collections.singletonList(permission), null, null) + def nextAccessPolicy = queueClient.getAccessPolicy().iterator().next() + then: + QueueTestHelper.assertResponseStatusCode(setAccessPolicyResponse, 204) + QueueTestHelper.assertPermissionsAreEqual(permission, nextAccessPolicy) + } + + def "Set invalid access policy"() { + given: + def accessPolicy = new AccessPolicy() + .setPermission("r") + .setStart(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) + .setExpiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)) + + def permission = new SignedIdentifier() + .setId("theidofthispermissionislongerthanwhatisallowedbytheserviceandshouldfail") + .setAccessPolicy(accessPolicy) + queueClient.create() + when: + queueClient.setAccessPolicy(Collections.singletonList(permission)) + then: + def e = thrown(StorageException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.INVALID_XML_DOCUMENT) + } + + def "Set multiple access policies"() { + given: + def accessPolicy = new AccessPolicy() + .setPermission("r") + .setStart(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) + .setExpiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)) + + def permissions = new ArrayList<>() + for (int i = 0; i < 3; i++) { + permissions.add(new SignedIdentifier() + .setId("policy" + i) + .setAccessPolicy(accessPolicy)) + } + queueClient.create() + when: + def setAccessPolicyResponse = queueClient.setAccessPolicyWithResponse(permissions, null, Context.NONE) + def nextAccessPolicy = queueClient.getAccessPolicy().iterator() + then: + QueueTestHelper.assertResponseStatusCode(setAccessPolicyResponse, 204) + QueueTestHelper.assertPermissionsAreEqual(permissions[0], nextAccessPolicy.next()) + QueueTestHelper.assertPermissionsAreEqual(permissions[1], nextAccessPolicy.next()) + QueueTestHelper.assertPermissionsAreEqual(permissions[2], nextAccessPolicy.next()) + !nextAccessPolicy.hasNext() + } + + def "Set too many access policies"() { + given: + def accessPolicy = new AccessPolicy() + .setPermission("r") + .setStart(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) + .setExpiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)) + + def permissions = new ArrayList<>() + for (int i = 0; i < 6; i++) { + permissions.add(new SignedIdentifier() + .setId("policy" + i) + .setAccessPolicy(accessPolicy)) + } + queueClient.create() + when: + queueClient.setAccessPolicyWithResponse(permissions, null, Context.NONE) + then: + def e = thrown(StorageException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.INVALID_XML_DOCUMENT) + } + + def "Enqueue message"() { + given: + queueClient.create() + def expectMsg = "test message" + when: + def enqueueMsgResponse = queueClient.enqueueMessageWithResponse(expectMsg, null, null, null, null) + def peekMsgIter = queueClient.peekMessages().iterator() + then: + QueueTestHelper.assertResponseStatusCode(enqueueMsgResponse, 201) + expectMsg.equals(peekMsgIter.next().getMessageText()) + !peekMsgIter.hasNext() + } + + def "Enqueue empty message"() { + given: + queueClient.create() + def expectMsg = "" + when: + def enqueueMsgResponse = queueClient.enqueueMessageWithResponse(expectMsg, null, null, null, null) + def peekMsgIter = queueClient.peekMessages().iterator() + then: + QueueTestHelper.assertResponseStatusCode(enqueueMsgResponse, 201) + peekMsgIter.next().getMessageText() == null + !peekMsgIter.hasNext() + } + + def "Enqueue time to live"() { + given: + queueClient.create() + when: + def enqueueMsgResponse = queueClient.enqueueMessageWithResponse("test message", + Duration.ofSeconds(0), Duration.ofSeconds(2), Duration.ofSeconds(5), null) + then: + QueueTestHelper.assertResponseStatusCode(enqueueMsgResponse, 201) + } + + def "Dequeue message"() { + given: + queueClient.create() + def expectMsg = "test message" + queueClient.enqueueMessage(expectMsg) + when: + def dequeueMsgResponse = queueClient.dequeueMessages().iterator().next() + then: + expectMsg.equals(dequeueMsgResponse.getMessageText()) + } + + def "Dequeue multiple messages"() { + given: + queueClient.create() + def expectMsg1 = "test message 1" + def expectMsg2 = "test message 2" + queueClient.enqueueMessage(expectMsg1) + queueClient.enqueueMessage(expectMsg2) + when: + def dequeueMsgIter = queueClient.dequeueMessages(2).iterator() + then: + expectMsg1.equals(dequeueMsgIter.next().getMessageText()) + expectMsg2.equals(dequeueMsgIter.next().getMessageText()) + } + + def "Dequeue too many message"() { + given: + queueClient.create() + when: + queueClient.dequeueMessages(33).iterator().next() + then: + def e = thrown(StorageException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.OUT_OF_RANGE_QUERY_PARAMETER_VALUE) + } + + def "Peek message"() { + given: + queueClient.create() + def expectMsg = "test message" + queueClient.enqueueMessage(expectMsg) + when: + def peekMsgIter = queueClient.peekMessages().iterator().next() + then: + expectMsg.equals(peekMsgIter.getMessageText()) + } + + def "Peek multiple messages"() { + given: + queueClient.create() + def expectMsg1 = "test message 1" + def expectMsg2 = "test message 2" + queueClient.enqueueMessage(expectMsg1) + queueClient.enqueueMessage(expectMsg2) + when: + def peekMsgIter = queueClient.peekMessages(2, Duration.ofSeconds(1), null).iterator() + then: + expectMsg1.equals(peekMsgIter.next().getMessageText()) + expectMsg2.equals(peekMsgIter.next().getMessageText()) + !peekMsgIter.hasNext() + } + + def "Peek too many message"() { + given: + queueClient.create() + when: + queueClient.peekMessages(33, null, null).iterator().next() + then: + def e = thrown(StorageException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.OUT_OF_RANGE_QUERY_PARAMETER_VALUE) + } + + def "Peek messages error"() { + when: + queueClient.peekMessages().iterator().next() + then: + def e = thrown(StorageException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + + def "Clear messages"() { + given: + queueClient.create() + queueClient.enqueueMessage("test message 1") + queueClient.enqueueMessage("test message 2") + queueClient.enqueueMessage("test message 3") + when: + def getPropertiesResponse = queueClient.getPropertiesWithResponse(null, null) + def clearMsgResponse = queueClient.clearMessagesWithResponse(null, null) + def getPropertiesAfterResponse = queueClient.getPropertiesWithResponse(null, null) + then: + QueueTestHelper.assertResponseStatusCode(getPropertiesResponse, 200) + getPropertiesResponse.getValue().getApproximateMessagesCount() == 3 + QueueTestHelper.assertResponseStatusCode(clearMsgResponse, 204) + QueueTestHelper.assertResponseStatusCode(getPropertiesAfterResponse, 200) + getPropertiesAfterResponse.getValue().getApproximateMessagesCount() == 0 + } + + def "Clear messages error"() { + when: + queueClient.clearMessagesWithResponse(null, null) + then: + def e = thrown(StorageException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + + def "Delete message"() { + given: + queueClient.create() + queueClient.enqueueMessage("test message 1") + queueClient.enqueueMessage("test message 2") + queueClient.enqueueMessage("test message 3") + def dequeueMsg = queueClient.dequeueMessages().iterator().next() + when: + def getPropertiesResponse = queueClient.getPropertiesWithResponse(null, null) + def deleteMsgResponse = queueClient.deleteMessageWithResponse(dequeueMsg.getMessageId(), dequeueMsg.getPopReceipt(), + null, null) + def getPropertiesAfterResponse = queueClient.getPropertiesWithResponse(null, null) + then: + QueueTestHelper.assertResponseStatusCode(getPropertiesResponse, 200) + getPropertiesResponse.getValue().getApproximateMessagesCount() == 3 + QueueTestHelper.assertResponseStatusCode(deleteMsgResponse, 204) + QueueTestHelper.assertResponseStatusCode(getPropertiesAfterResponse, 200) + getPropertiesAfterResponse.getValue().getApproximateMessagesCount() == 2 + } + + @Unroll + def "Delete message invalid args"() { + given: + queueClient.create() + def expectMsg = "test message" + queueClient.enqueueMessage(expectMsg) + def dequeueMessageIter = queueClient.dequeueMessages().iterator().next() + when: + def deleteMessageId = messageId ? dequeueMessageIter.getMessageId() : dequeueMessageIter.getMessageId() + "Random" + def deletePopReceipt = popReceipt ? dequeueMessageIter.getPopReceipt() : dequeueMessageIter.getPopReceipt() + "Random" + queueClient.deleteMessage(deleteMessageId, deletePopReceipt) + then: + def e = thrown(StorageException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, statusCode, errMsg) + where: + messageId | popReceipt | statusCode | errMsg + true | false | 400 | StorageErrorCode.INVALID_QUERY_PARAMETER_VALUE + false | true | 404 | StorageErrorCode.MESSAGE_NOT_FOUND + false | false | 400 | StorageErrorCode.INVALID_QUERY_PARAMETER_VALUE + } + + def "Update message"() { + given: + def updateMsg = "Updated test message" + queueClient.create() + queueClient.enqueueMessage("test message before update") + + def dequeueMsg = queueClient.dequeueMessages().iterator().next() + when: + def updateMsgResponse = queueClient.updateMessageWithResponse(updateMsg, + dequeueMsg.getMessageId(), dequeueMsg.getPopReceipt(), Duration.ofSeconds(1), null, null) + QueueTestHelper.sleepInRecord(Duration.ofSeconds(2)) + def peekMsgIter = queueClient.peekMessages().iterator().next() + then: + QueueTestHelper.assertResponseStatusCode(updateMsgResponse, 204) + updateMsg.equals(peekMsgIter.getMessageText()) + } + + @Unroll + def "Update message invalid args"() { + given: + queueClient.create() + def updateMsg = "Updated test message" + queueClient.enqueueMessage("test message before update") + def dequeueMessageIter = queueClient.dequeueMessages().iterator().next() + when: + def updateMessageId = messageId ? dequeueMessageIter.getMessageId() : dequeueMessageIter.getMessageId() + "Random" + def updatePopReceipt = popReceipt ? dequeueMessageIter.getPopReceipt() : dequeueMessageIter.getPopReceipt() + "Random" + queueClient.updateMessage(updateMsg, updateMessageId, updatePopReceipt, Duration.ofSeconds(1)) + then: + def e = thrown(StorageException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, statusCode, errMsg) + where: + messageId | popReceipt | statusCode | errMsg + true | false | 400 | StorageErrorCode.INVALID_QUERY_PARAMETER_VALUE + false | true | 404 | StorageErrorCode.MESSAGE_NOT_FOUND + false | false | 400 | StorageErrorCode.INVALID_QUERY_PARAMETER_VALUE + } + +} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueAysncAPITests.groovy b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueAysncAPITests.groovy new file mode 100644 index 000000000000..411ae2d7f874 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueAysncAPITests.groovy @@ -0,0 +1,512 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.queue.spock + +import com.azure.storage.queue.QueueAsyncClient +import com.azure.storage.queue.models.AccessPolicy +import com.azure.storage.queue.models.SignedIdentifier +import com.azure.storage.queue.models.StorageErrorCode +import reactor.test.StepVerifier +import spock.lang.Ignore +import spock.lang.Unroll + +import java.time.Duration +import java.time.LocalDateTime +import java.time.OffsetDateTime +import java.time.ZoneOffset + +class QueueAysncAPITests extends APISpec { + QueueAsyncClient queueAsyncClient + + static def testMetadata = Collections.singletonMap("metadata", "value") + static def createMetadata = Collections.singletonMap("metadata1", "value") + + def setup() { + primaryQueueServiceAsyncClient = queueServiceBuilderHelper(interceptorManager).buildAsyncClient() + queueAsyncClient = primaryQueueServiceAsyncClient.getQueueAsyncClient(testResourceName.randomName(methodName, 60)) + } + + def "Create queue with shared key"() { + expect: + StepVerifier.create(queueAsyncClient.createWithResponse(null)).assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 201) } + .verifyComplete() + } + + // TODO: Will implement the test after introduce the sas token generator + @Ignore + def "Create queue with sas token"() { + + } + + def "Delete exist queue"() { + given: + queueAsyncClient.createWithResponse(null).block() + when: + def deleteQueueVerifier = StepVerifier.create(queueAsyncClient.deleteWithResponse()) + then: + deleteQueueVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 204) } + .verifyComplete() + } + + def "Delete queue error"() { + when: + def deleteQueueVerifier = StepVerifier.create(queueAsyncClient.deleteWithResponse()) + then: + deleteQueueVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + } + + def "Get properties"() { + given: + queueAsyncClient.createWithResponse(testMetadata).block() + when: + def getPropertiesVerifier = StepVerifier.create(queueAsyncClient.getPropertiesWithResponse()) + then: + getPropertiesVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 200) + assert it.getValue().getApproximateMessagesCount() == 0 + assert testMetadata.equals(it.getValue().getMetadata()) + }.verifyComplete() + } + + def "Get properties error"() { + when: + def getPropertiesVerifier = StepVerifier.create(queueAsyncClient.getProperties()) + then: + getPropertiesVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + } + + @Unroll + def "Set and clear metadata"() { + given: + queueAsyncClient.createWithResponse(matadataInCreate).block() + when: + def getPropertiesVerifierBefore = StepVerifier.create(queueAsyncClient.getPropertiesWithResponse()) + def setMetadataVerifier = StepVerifier.create(queueAsyncClient.setMetadataWithResponse(metadataInSet)) + def getPropertiesVerifierAfter = StepVerifier.create(queueAsyncClient.getPropertiesWithResponse()) + then: + getPropertiesVerifierBefore.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 200) + assert expectMetadataInCreate.equals(it.getValue().getMetadata()) + }.verifyComplete() + setMetadataVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 204) } + .verifyComplete() + getPropertiesVerifierAfter.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 200) + assert expectMetadataInSet.equals(it.getValue().metadata) + }.verifyComplete() + where: + matadataInCreate | metadataInSet | expectMetadataInCreate | expectMetadataInSet + null | testMetadata | Collections.emptyMap() | testMetadata + createMetadata | testMetadata | createMetadata | testMetadata + createMetadata | null | createMetadata | Collections.emptyMap() + testMetadata | testMetadata | testMetadata | testMetadata + null | null | Collections.emptyMap() | Collections.emptyMap() + } + + def "Set metadata queue error"() { + when: + def setMetadataVerifier = StepVerifier.create(queueAsyncClient.setMetadataWithResponse(testMetadata)) + then: + setMetadataVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + } + + @Unroll + def "Set invalid meta"() { + given: + def invalidMetadata = Collections.singletonMap(invalidKey, "value") + queueAsyncClient.create().block() + when: + def setMetadataVerifier = StepVerifier.create(queueAsyncClient.setMetadataWithResponse(invalidMetadata)) + then: + setMetadataVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, statusCode, errMessage) + } + where: + invalidKey | statusCode | errMessage + "invalidMeta" | 403 | StorageErrorCode.AUTHENTICATION_FAILED + "invalid-meta" | 400 | StorageErrorCode.INVALID_METADATA + "12345" | 400 | StorageErrorCode.INVALID_METADATA + "" | 400 | StorageErrorCode.EMPTY_METADATA_KEY + } + + def "Get access policy"() { + given: + queueAsyncClient.create().block() + when: + def getAccessPolicyVerifier = StepVerifier.create(queueAsyncClient.getAccessPolicy()) + then: + getAccessPolicyVerifier.verifyComplete() + } + + def "Get access policy does error"() { + when: + def getAccessPolicyVerifier = StepVerifier.create(queueAsyncClient.getAccessPolicy()) + then: + getAccessPolicyVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + } + + def "Set access policy"() { + given: + queueAsyncClient.create().block() + def accessPolicy = new AccessPolicy() + .setPermission("raup") + .setStart(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) + .setExpiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)) + def permission = new SignedIdentifier() + .setId("testpermission") + .setAccessPolicy(accessPolicy) + when: + def setAccessPolicyVerifier = StepVerifier.create(queueAsyncClient.setAccessPolicyWithResponse(Collections.singletonList(permission))) + def getAccessPolicyVerifier = StepVerifier.create(queueAsyncClient.getAccessPolicy()) + then: + setAccessPolicyVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 204) + }.verifyComplete() + getAccessPolicyVerifier.assertNext { + assert QueueTestHelper.assertPermissionsAreEqual(permission, it) + }.verifyComplete() + } + + def "Set invalid access policy"() { + given: + def accessPolicy = new AccessPolicy() + .setPermission("r") + .setStart(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) + .setExpiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)) + + def permission = new SignedIdentifier() + .setId("theidofthispermissionislongerthanwhatisallowedbytheserviceandshouldfail") + .setAccessPolicy(accessPolicy) + queueAsyncClient.create().block() + when: + def setAccessPolicyVerifier = StepVerifier.create(queueAsyncClient.setAccessPolicyWithResponse(Collections.singletonList(permission))) + then: + setAccessPolicyVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.INVALID_XML_DOCUMENT) + } + } + + def "Set multiple access policies"() { + given: + def accessPolicy = new AccessPolicy() + .setPermission("r") + .setStart(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) + .setExpiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)) + + def permissions = new ArrayList<>() + for (int i = 0; i < 3; i++) { + permissions.add(new SignedIdentifier() + .setId("policy" + i) + .setAccessPolicy(accessPolicy)) + } + queueAsyncClient.create().block() + when: + def setAccessPolicyVerifier = StepVerifier.create(queueAsyncClient.setAccessPolicyWithResponse(permissions)) + def getAccessPolicyVerifier = StepVerifier.create(queueAsyncClient.getAccessPolicy()) + then: + setAccessPolicyVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 204) + }.verifyComplete() + getAccessPolicyVerifier.assertNext { + assert QueueTestHelper.assertPermissionsAreEqual(permissions[0], it) + }.assertNext { + assert QueueTestHelper.assertPermissionsAreEqual(permissions[1], it) + }.assertNext { + assert QueueTestHelper.assertPermissionsAreEqual(permissions[2], it) + }.verifyComplete() + } + + def "Set too many access policies"() { + given: + def accessPolicy = new AccessPolicy() + .setPermission("r") + .setStart(OffsetDateTime.of(LocalDateTime.of(2000, 1, 1, 0, 0), ZoneOffset.UTC)) + .setExpiry(OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 0, 0), ZoneOffset.UTC)) + + def permissions = new ArrayList<>() + for (int i = 0; i < 6; i++) { + permissions.add(new SignedIdentifier() + .setId("policy" + i) + .setAccessPolicy(accessPolicy)) + } + queueAsyncClient.create().block() + when: + def setAccessPolicyVerifier = StepVerifier.create(queueAsyncClient.setAccessPolicyWithResponse(permissions)) + then: + setAccessPolicyVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.INVALID_XML_DOCUMENT) + } + } + + def "Enqueue message"() { + given: + queueAsyncClient.create().block() + def expectMsg = "test message" + when: + def enqueueMsgVerifier = StepVerifier.create(queueAsyncClient.enqueueMessageWithResponse(expectMsg, null, null)) + def peekMsgVerifier = StepVerifier.create(queueAsyncClient.peekMessages()) + then: + enqueueMsgVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + peekMsgVerifier.assertNext { + assert expectMsg.equals(it.getMessageText()) + assert !it.hasNext() + } + } + + def "Enqueue empty message"() { + given: + queueAsyncClient.create().block() + when: + def enqueueMsgVerifier = StepVerifier.create(queueAsyncClient.enqueueMessageWithResponse("", null, null)) + def peekMsgVerifier = StepVerifier.create(queueAsyncClient.peekMessages()) + then: + enqueueMsgVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + peekMsgVerifier.assertNext { + assert it.getMessageText() == null + assert !it.hasNext() + } + } + + def "Enqueue time to live"() { + given: + queueAsyncClient.create().block() + when: + def enqueueMsgVerifier = StepVerifier.create(queueAsyncClient.enqueueMessageWithResponse("test message", + Duration.ofSeconds(0), Duration.ofSeconds(2))) + then: + enqueueMsgVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + def "Dequeue message"() { + given: + queueAsyncClient.create().block() + def expectMsg = "test message" + queueAsyncClient.enqueueMessage(expectMsg).block() + when: + def dequeueMsgVerifier = StepVerifier.create(queueAsyncClient.dequeueMessages()) + then: + dequeueMsgVerifier.assertNext { + assert expectMsg.equals(it.getMessageText()) + }.verifyComplete() + } + + def "Dequeue multiple messages"() { + given: + queueAsyncClient.create().block() + def expectMsg1 = "test message 1" + def expectMsg2 = "test message 2" + queueAsyncClient.enqueueMessage(expectMsg1).block() + queueAsyncClient.enqueueMessage(expectMsg2).block() + when: + def dequeueMsgVerifier = StepVerifier.create(queueAsyncClient.dequeueMessages(2)) + then: + dequeueMsgVerifier.assertNext { + assert expectMsg1.equals(it.getMessageText()) + }.assertNext { + assert expectMsg2.equals(it.getMessageText()) + }.verifyComplete() + } + + def "Dequeue too many message"() { + given: + queueAsyncClient.create().block() + when: + def dequeueMsgVerifier = StepVerifier.create(queueAsyncClient.dequeueMessages(33)) + then: + dequeueMsgVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.OUT_OF_RANGE_QUERY_PARAMETER_VALUE) + } + } + + def "Peek message"() { + given: + queueAsyncClient.create().block() + def expectMsg = "test message" + queueAsyncClient.enqueueMessage(expectMsg).block() + when: + def peekMsgVerifier = StepVerifier.create(queueAsyncClient.peekMessages()) + then: + peekMsgVerifier.assertNext { + assert expectMsg.equals(it.getMessageText()) + }.verifyComplete() + } + + def "Peek multiple messages"() { + given: + queueAsyncClient.create().block() + def expectMsg1 = "test message 1" + def expectMsg2 = "test message 2" + queueAsyncClient.enqueueMessage(expectMsg1).block() + queueAsyncClient.enqueueMessage(expectMsg2).block() + when: + def peekMsgVerifier = StepVerifier.create(queueAsyncClient.peekMessages(2)) + then: + peekMsgVerifier.assertNext { + assert expectMsg1.equals(it.getMessageText()) + }.assertNext { + assert expectMsg2.equals(it.getMessageText()) + }.verifyComplete() + } + + def "Peek too many message"() { + given: + queueAsyncClient.create().block() + when: + def peekMsgVerifier = StepVerifier.create(queueAsyncClient.peekMessages(33)) + then: + peekMsgVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.OUT_OF_RANGE_QUERY_PARAMETER_VALUE) + } + } + + def "Peek messages error"() { + when: + def peekMsgVerifier = StepVerifier.create(queueAsyncClient.peekMessages()) + then: + peekMsgVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + } + + def "Clear messages"() { + given: + queueAsyncClient.create().block() + queueAsyncClient.enqueueMessage("test message 1").block() + queueAsyncClient.enqueueMessage("test message 2").block() + queueAsyncClient.enqueueMessage("test message 3").block() + when: + def getPropertiesVerifier = StepVerifier.create(queueAsyncClient.getPropertiesWithResponse()) + def clearMsgVerifier = StepVerifier.create(queueAsyncClient.clearMessagesWithResponse()) + def getPropertiesAfterVerifier = StepVerifier.create(queueAsyncClient.getPropertiesWithResponse()) + then: + getPropertiesVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 200) + assert it.getValue().getApproximateMessagesCount() == 3 + }.verifyComplete() + clearMsgVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 204) + }.verifyComplete() + getPropertiesAfterVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 200) + assert it.getValue().getApproximateMessagesCount() == 0 + }.verifyComplete() + } + + def "Clear messages error"() { + when: + def clearMsgVerifier = StepVerifier.create(queueAsyncClient.clearMessagesWithResponse()) + then: + clearMsgVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + } + + def "Delete message"() { + given: + queueAsyncClient.create().block() + queueAsyncClient.enqueueMessage("test message 1").block() + queueAsyncClient.enqueueMessage("test message 2").block() + queueAsyncClient.enqueueMessage("test message 3").block() + def dequeueMsg = queueAsyncClient.dequeueMessages().blockFirst() + when: + def getPropertiesVerifier = StepVerifier.create(queueAsyncClient.getPropertiesWithResponse()) + def deleteMsgVerifier = StepVerifier.create(queueAsyncClient.deleteMessageWithResponse(dequeueMsg.getMessageId(), dequeueMsg.getPopReceipt())) + def getPropertiesAfterVerifier = StepVerifier.create(queueAsyncClient.getPropertiesWithResponse()) + then: + getPropertiesVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 200) + assert it.getValue().getApproximateMessagesCount() == 3 + + }.verifyComplete() + deleteMsgVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 204) + }.verifyComplete() + getPropertiesAfterVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 200) + assert it.getValue().getApproximateMessagesCount() == 2 + }.verifyComplete() + } + + @Unroll + def "Delete message invalid args"() { + given: + queueAsyncClient.create().block() + def expectMsg = "test message" + queueAsyncClient.enqueueMessage(expectMsg).block() + def dequeueMessage = queueAsyncClient.dequeueMessages().blockFirst() + when: + def deleteMessageId = messageId ? dequeueMessage.getMessageId() : dequeueMessage.getMessageId() + "Random" + def deletePopReceipt = popReceipt ? dequeueMessage.getPopReceipt() : dequeueMessage.getPopReceipt() + "Random" + def deleteMsgVerifier = StepVerifier.create(queueAsyncClient.deleteMessageWithResponse(deleteMessageId, deletePopReceipt)) + then: + deleteMsgVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, statusCode, errMsg) + } + where: + messageId | popReceipt | statusCode | errMsg + true | false | 400 | StorageErrorCode.INVALID_QUERY_PARAMETER_VALUE + false | true | 404 | StorageErrorCode.MESSAGE_NOT_FOUND + false | false | 400 | StorageErrorCode.INVALID_QUERY_PARAMETER_VALUE + } + + def "Update message"() { + given: + def updateMsg = "Updated test message" + queueAsyncClient.create().block() + queueAsyncClient.enqueueMessage("test message before update").block() + + def dequeueMsg = queueAsyncClient.dequeueMessages().blockFirst() + when: + def updateMsgVerifier = StepVerifier.create(queueAsyncClient.updateMessageWithResponse(updateMsg, + dequeueMsg.getMessageId(), dequeueMsg.getPopReceipt(), Duration.ofSeconds(1))) + def peekMsgVerifier = StepVerifier.create(queueAsyncClient.peekMessages().delaySubscription(Duration.ofSeconds(2))) + then: + updateMsgVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 204) + }.verifyComplete() + peekMsgVerifier.assertNext { + assert updateMsg.equals(it.getMessageText()) + }.verifyComplete() + } + + @Unroll + def "Update message invalid args"() { + given: + queueAsyncClient.create().block() + def updateMsg = "Updated test message" + queueAsyncClient.enqueueMessage("test message before update").block() + def dequeueMessage = queueAsyncClient.dequeueMessages().blockFirst() + when: + def updateMessageId = messageId ? dequeueMessage.getMessageId() : dequeueMessage.getMessageId() + "Random" + def updatePopReceipt = popReceipt ? dequeueMessage.getPopReceipt() : dequeueMessage.getPopReceipt() + "Random" + def updateMsgVerifier = StepVerifier.create(queueAsyncClient.updateMessageWithResponse(updateMsg, updateMessageId, updatePopReceipt, Duration.ofSeconds(1))) + then: + updateMsgVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, statusCode, errMsg) + } + where: + messageId | popReceipt | statusCode | errMsg + true | false | 400 | StorageErrorCode.INVALID_QUERY_PARAMETER_VALUE + false | true | 404 | StorageErrorCode.MESSAGE_NOT_FOUND + false | false | 400 | StorageErrorCode.INVALID_QUERY_PARAMETER_VALUE + } + +} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueSASTests.groovy b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueSASTests.groovy new file mode 100644 index 000000000000..a4a3ed3a5990 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueSASTests.groovy @@ -0,0 +1,274 @@ +package com.azure.storage.queue.spock + +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.credentials.SASTokenCredential +import com.azure.storage.queue.QueueClient +import com.azure.storage.queue.QueueSASPermission +import com.azure.storage.queue.QueueServiceSASSignatureValues +import com.azure.storage.queue.models.AccessPolicy +import com.azure.storage.queue.models.EnqueuedMessage +import com.azure.storage.queue.models.SignedIdentifier +import com.azure.storage.queue.models.StorageException +import org.junit.Test +import spock.lang.Unroll + +import java.time.Duration +import java.time.temporal.ChronoUnit + +class QueueSASTests extends APISpec { + + QueueClient queueClient + + def setup() { + primaryQueueServiceClient = queueServiceBuilderHelper(interceptorManager).buildClient() + queueClient = primaryQueueServiceClient.getQueueClient(testResourceName.randomName(methodName, 60)) + } + + @Unroll + def "QueueSASPermission parse"() { + when: + def perms = QueueSASPermission.parse(permString) + + then: + perms.getRead() == read + perms.getAdd() == add + perms.getUpdate() == update + perms.getProcess() == process + + where: + permString || read | add | update | process + "r" || true | false | false | false + "a" || false | true | false | false + "u" || false | false | true | false + "p" || false | false | false | true + "raup" || true | true | true | true + "apru" || true | true | true | true + "rap" || true | true | false | true + "ur" || true | false | true | false + } + + @Unroll + def "QueueSASPermission toString"() { + setup: + def perms = new QueueSASPermission() + .setRead(read) + .setAdd(add) + .setUpdate(update) + .setProcess(process) + + expect: + perms.toString() == expectedString + + where: + read | add | update | process || expectedString + true | false | false | false || "r" + false | true | false | false || "a" + false | false | true | false || "u" + false | false | false | true || "p" + true | false | true | false || "ru" + true | true | true | true || "raup" + } + + def "QueueSASPermission parse IA"() { + when: + QueueSASPermission.parse("rwaq") + + then: + thrown(IllegalArgumentException) + } + + def "queueServiceSASSignatureValues canonicalizedResource"() { + setup: + def queueName = queueClient.client.queueName + def accountName = "account" + + when: + def serviceSASSignatureValues = new QueueServiceSASSignatureValues().setCanonicalName(queueName, accountName) + + then: + serviceSASSignatureValues.getCanonicalName() == "/queue/" + accountName + "/" + queueName + } + + @Test + def "Test QueueSAS enqueue dequeue with permissions"() { + setup: + queueClient.create() + EnqueuedMessage resp = queueClient.enqueueMessage("test") + + def permissions = new QueueSASPermission() + .setRead(true) + .setAdd(true) + .setProcess(true) + def startTime = getUTCNow().minusDays(1) + def expiryTime = getUTCNow().plusDays(1) + def ipRange = new IPRange() + .setIpMin("0.0.0.0") + .setIpMax("255.255.255.255") + def sasProtocol = SASProtocol.HTTPS_HTTP + + when: + def sasPermissions = queueClient.generateSAS(null, permissions, expiryTime, startTime, null, sasProtocol, ipRange) + + def clientPermissions = queueBuilderHelper(interceptorManager) + .endpoint(queueClient.getQueueUrl().toString()) + .queueName(queueClient.client.queueName) + .credential(SASTokenCredential.fromSASTokenString(sasPermissions)) + .buildClient() + clientPermissions.enqueueMessage("sastest") + def dequeueMsgIterPermissions = clientPermissions.dequeueMessages(2).iterator() + + then: + notThrown(StorageException) + "test" == dequeueMsgIterPermissions.next().getMessageText() + "sastest" == dequeueMsgIterPermissions.next().getMessageText() + + when: + clientPermissions.updateMessage("testing", resp.getMessageId(), resp.getPopReceipt(), Duration.ofHours(1)) + + then: + thrown(StorageException) + } + + @Test + def "Test QueueSAS update delete with permissions"() { + setup: + queueClient.create() + EnqueuedMessage resp = queueClient.enqueueMessage("test") + + def permissions = new QueueSASPermission() + .setRead(true) + .setAdd(true) + .setProcess(true) + .setUpdate(true) + def startTime = getUTCNow().minusDays(1) + def expiryTime = getUTCNow().plusDays(1) + def ipRange = new IPRange() + .setIpMin("0.0.0.0") + .setIpMax("255.255.255.255") + def sasProtocol = SASProtocol.HTTPS_HTTP + + when: + def sasPermissions = queueClient.generateSAS(null, permissions, expiryTime, startTime, null, sasProtocol, ipRange) + + def clientPermissions = queueBuilderHelper(interceptorManager) + .endpoint(queueClient.getQueueUrl().toString()) + .queueName(queueClient.client.queueName) + .credential(SASTokenCredential.fromSASTokenString(sasPermissions)) + .buildClient() + clientPermissions.updateMessage("testing", resp.getMessageId(), resp.getPopReceipt(), Duration.ZERO) + def dequeueMsgIterPermissions = clientPermissions.dequeueMessages(1).iterator() + + then: + notThrown(StorageException) + "testing" == dequeueMsgIterPermissions.next().getMessageText() + + when: + clientPermissions.delete() + + then: + thrown(StorageException) + } + + // NOTE: Serializer for set access policy keeps milliseconds + @Test + def "Test QueueSAS enqueue dequeue with identifier"() { + setup: + queueClient.create() + queueClient.enqueueMessage("test") + + def permissions = new QueueSASPermission() + .setRead(true) + .setAdd(true) + .setUpdate(true) + .setProcess(true) + def expiryTime = getUTCNow().plusDays(1).truncatedTo(ChronoUnit.SECONDS) + def startTime = getUTCNow().minusDays(1).truncatedTo(ChronoUnit.SECONDS) + + SignedIdentifier identifier = new SignedIdentifier() + .setId(testResourceName.randomUuid()) + .setAccessPolicy(new AccessPolicy().setPermission(permissions.toString()) + .setExpiry(expiryTime).setStart(startTime)) + queueClient.setAccessPolicy(Arrays.asList(identifier)) + + when: + def sasIdentifier = queueClient.generateSAS(identifier.getId()) + + def clientBuilder = queueBuilderHelper(interceptorManager) + def clientIdentifier = clientBuilder + .endpoint(queueClient.getQueueUrl().toString()) + .queueName(queueClient.client.queueName) + .credential(SASTokenCredential.fromSASTokenString(sasIdentifier)) + .buildClient() + clientIdentifier.enqueueMessage("sastest") + def dequeueMsgIterIdentifier = clientIdentifier.dequeueMessages(2).iterator() + + then: + notThrown(StorageException) + "test" == dequeueMsgIterIdentifier.next().getMessageText() + "sastest" == dequeueMsgIterIdentifier.next().getMessageText() + } + + @Test + def "Test Account QueueServiceSAS create queue delete queue"() { + def service = new AccountSASService() + .setQueue(true) + def resourceType = new AccountSASResourceType() + .setContainer(true) + .setService(true) + .setObject(true) + def permissions = new AccountSASPermission() + .setRead(true) + .setCreate(true) + .setDelete(true) + def expiryTime = getUTCNow().plusDays(1) + + when: + def sas = primaryQueueServiceClient.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null) + + def scBuilder = queueServiceBuilderHelper(interceptorManager) + scBuilder.endpoint(primaryQueueServiceClient.getQueueServiceUrl().toString()) + .credential(SASTokenCredential.fromSASTokenString(sas)) + def sc = scBuilder.buildClient() + sc.createQueue("queue") + + then: + notThrown(StorageException) + + when: + sc.deleteQueue("queue") + + then: + notThrown(StorageException) + } + + @Test + def "Test Account QueueServiceSAS list queues"() { + def service = new AccountSASService() + .setQueue(true) + def resourceType = new AccountSASResourceType() + .setContainer(true) + .setService(true) + .setObject(true) + def permissions = new AccountSASPermission() + .setList(true) + def expiryTime = getUTCNow().plusDays(1) + + when: + def sas = primaryQueueServiceClient.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null) + + def scBuilder = queueServiceBuilderHelper(interceptorManager) + scBuilder.endpoint(primaryQueueServiceClient.getQueueServiceUrl().toString()) + .credential(SASTokenCredential.fromSASTokenString(sas)) + def sc = scBuilder.buildClient() + + sc.listQueues() + + then: + notThrown(StorageException) + } + +} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueServiceAPITests.groovy b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueServiceAPITests.groovy new file mode 100644 index 000000000000..ad8f2801f6c5 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueServiceAPITests.groovy @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.queue.spock + +import com.azure.storage.queue.QueueClient +import com.azure.storage.queue.models.Logging +import com.azure.storage.queue.models.Metrics +import com.azure.storage.queue.models.QueueItem +import com.azure.storage.queue.models.QueuesSegmentOptions +import com.azure.storage.queue.models.RetentionPolicy +import com.azure.storage.queue.models.StorageErrorCode +import com.azure.storage.queue.models.StorageException +import com.azure.storage.queue.models.StorageServiceProperties +import spock.lang.Unroll + +class QueueServiceAPITests extends APISpec { + + def setup() { + primaryQueueServiceClient = queueServiceBuilderHelper(interceptorManager).buildClient() + } + + def "Get queue client"() { + given: + def queueClient = primaryQueueServiceClient.getQueueClient(testResourceName.randomName(methodName, 60)) + + expect: + queueClient instanceof QueueClient + } + + def "Create queue"() { + when: + def queueClientResponse = primaryQueueServiceClient.createQueueWithResponse(testResourceName.randomName(methodName, 60), null, null, null) + def enqueueMessageResponse = queueClientResponse.getValue().enqueueMessageWithResponse("Testing service client creating a queue", null, null, null,null) + + then: + QueueTestHelper.assertResponseStatusCode(queueClientResponse, 201) + QueueTestHelper.assertResponseStatusCode(enqueueMessageResponse, 201) + } + + @Unroll + def "Create queue with invalid name"() { + when: + primaryQueueServiceClient.createQueue(queueName) + + then: + def e = thrown(StorageException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, statusCode, errMesage) + + where: + queueName | statusCode | errMesage + "a_b" | 400 | StorageErrorCode.INVALID_RESOURCE_NAME + "-ab" | 400 | StorageErrorCode.INVALID_RESOURCE_NAME + "a--b" | 400 | StorageErrorCode.INVALID_RESOURCE_NAME + "Abc" | 400 | StorageErrorCode.INVALID_RESOURCE_NAME + "ab" | 400 | StorageErrorCode.OUT_OF_RANGE_INPUT + "verylong" * 8 | 400 | StorageErrorCode.OUT_OF_RANGE_INPUT + } + + def "Create null"() { + when: + primaryQueueServiceClient.createQueue(null) + + then: + thrown(NullPointerException) + } + + @Unroll + def "Create queue maxOverload"() { + when: + def queueClientResponse = primaryQueueServiceClient.createQueueWithResponse(testResourceName.randomName(methodName, 60), metadata,null, null) + def enqueueMessageResponse = queueClientResponse.getValue().enqueueMessageWithResponse("Testing service client creating a queue", null, null, null, null) + + then: + QueueTestHelper.assertResponseStatusCode(queueClientResponse, 201) + QueueTestHelper.assertResponseStatusCode(enqueueMessageResponse, 201) + + where: + metadata | _ + null | _ + Collections.singletonMap("metadata", "value") | _ + Collections.singletonMap("metadata", "va@lue") | _ + } + + def "Create queue with invalid metadata"() { + given: + def queueName = testResourceName.randomName(methodName, 16) + + when: + primaryQueueServiceClient.createQueueWithResponse(queueName, Collections.singletonMap("metadata!", "value"), null, null) + + then: + def e = thrown(StorageException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 400, StorageErrorCode.INVALID_METADATA) + } + + def "Delete queue"() { + given: + def queueName = testResourceName.randomName(methodName, 60) + + when: + def queueClient = primaryQueueServiceClient.createQueue(queueName) + def deleteQueueResponse = primaryQueueServiceClient.deleteQueueWithResponse(queueName, null, null) + queueClient.enqueueMessage("Expecting exception as queue has been deleted.") + + then: + QueueTestHelper.assertResponseStatusCode(deleteQueueResponse, 204) + def e = thrown(StorageException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + + def "Delete queue error"() { + when: + primaryQueueServiceClient.deleteQueueWithResponse(testResourceName.randomName(methodName, 60), null, null) + + then: + def e = thrown(StorageException) + QueueTestHelper.assertExceptionStatusCodeAndMessage(e, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + + @Unroll + def "List queues"() { + given: + def queueName = testResourceName.randomName(methodName, 60) + LinkedList testQueues = new LinkedList<>() + for (int i = 0; i < 3; i++) { + String version = Integer.toString(i) + QueueItem queue = new QueueItem().setName(queueName + version) + .setMetadata(Collections.singletonMap("metadata" + version, "value" + version)) + testQueues.add(queue) + primaryQueueServiceClient.createQueueWithResponse(queue.getName(), queue.getMetadata(), null, null) + } + + when: + def queueListIter = primaryQueueServiceClient.listQueues(options, null, null) + then: + queueListIter.each { + QueueTestHelper.assertQueuesAreEqual(it, testQueues.pop()) + primaryQueueServiceClient.deleteQueue(it.getName()) + } + testQueues.size() == 0 + + where: + options | _ + new QueuesSegmentOptions().setPrefix("queueserviceapitestslistqueues") | _ + new QueuesSegmentOptions().setPrefix("queueserviceapitestslistqueues").setMaxResults(2) | _ + new QueuesSegmentOptions().setPrefix("queueserviceapitestslistqueues").setIncludeMetadata(true) | _ + } + + def "List empty queues"() { + when: + primaryQueueServiceClient.getQueueClient(testResourceName.randomName(methodName, 60)) + + then: + !primaryQueueServiceClient.listQueues(new QueuesSegmentOptions().setPrefix(methodName), null, null).iterator().hasNext() + } + + def "Get and set properties"() { + given: + def originalProperties = primaryQueueServiceClient.getProperties() + def retentionPolicy = new RetentionPolicy().setEnabled(true) + .setDays(3) + def logging = new Logging().setVersion("1.0") + .setDelete(true) + .setWrite(true) + .setRetentionPolicy(retentionPolicy) + def metrics = new Metrics().setEnabled(true) + .setIncludeAPIs(false) + .setRetentionPolicy(retentionPolicy) + .setVersion("1.0") + def updatedProperties = new StorageServiceProperties().setLogging(logging) + .setHourMetrics(metrics) + .setMinuteMetrics(metrics) + .setCors(new ArrayList<>()) + + when: + def getResponseBefore = primaryQueueServiceClient.getProperties() + def setResponse = primaryQueueServiceClient.setPropertiesWithResponse(updatedProperties, null, null) + def getResponseAfter = primaryQueueServiceClient.getProperties() + + then: + QueueTestHelper.assertQueueServicePropertiesAreEqual(originalProperties, getResponseBefore) + QueueTestHelper.assertResponseStatusCode(setResponse, 202) + QueueTestHelper.assertQueueServicePropertiesAreEqual(updatedProperties, getResponseAfter) + } +} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueServiceAsyncAPITests.groovy b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueServiceAsyncAPITests.groovy new file mode 100644 index 000000000000..31cce5b39733 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueServiceAsyncAPITests.groovy @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.queue.spock + +import com.azure.storage.queue.QueueAsyncClient +import com.azure.storage.queue.models.Logging +import com.azure.storage.queue.models.Metrics +import com.azure.storage.queue.models.QueueItem +import com.azure.storage.queue.models.QueuesSegmentOptions +import com.azure.storage.queue.models.RetentionPolicy +import com.azure.storage.queue.models.StorageErrorCode +import com.azure.storage.queue.models.StorageServiceProperties +import reactor.test.StepVerifier +import spock.lang.Unroll + +class QueueServiceAsyncAPITests extends APISpec { + + def setup() { + primaryQueueServiceAsyncClient = queueServiceBuilderHelper(interceptorManager).buildAsyncClient() + } + + def "Get queue client"() { + given: + def queueAsyncClient = primaryQueueServiceAsyncClient.getQueueAsyncClient(testResourceName.randomName(methodName, 60)) + expect: + queueAsyncClient instanceof QueueAsyncClient + } + + def "Create queue"() { + given: + def queueName = testResourceName.randomName(methodName, 60) + expect: + StepVerifier.create(primaryQueueServiceAsyncClient.createQueueWithResponse(queueName, null)).assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + StepVerifier.create(primaryQueueServiceAsyncClient.getQueueAsyncClient(queueName).enqueueMessageWithResponse("Testing service client creating a queue", null, null)) + .assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + } + + @Unroll + def "Create queue with invalid name"() { + when: + def createQueueVerifier = StepVerifier.create(primaryQueueServiceAsyncClient.createQueue(queueName)) + then: + createQueueVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, statusCode, errMesage) + } + where: + queueName | statusCode | errMesage + "a_b" | 400 | StorageErrorCode.INVALID_RESOURCE_NAME + "-ab" | 400 | StorageErrorCode.INVALID_RESOURCE_NAME + "a--b" | 400 | StorageErrorCode.INVALID_RESOURCE_NAME + "Abc" | 400 | StorageErrorCode.INVALID_RESOURCE_NAME + "ab" | 400 | StorageErrorCode.OUT_OF_RANGE_INPUT + "verylong" * 8 | 400 | StorageErrorCode.OUT_OF_RANGE_INPUT + } + + def "Create null"() { + when: + primaryQueueServiceAsyncClient.createQueue(null) + then: + thrown(NullPointerException) + } + + @Unroll + def "Create queue maxOverload"() { + given: + def queueName = testResourceName.randomName(methodName, 60) + when: + def createQueueVerifier = StepVerifier.create(primaryQueueServiceAsyncClient.createQueueWithResponse(queueName, metadata)) + def enqueueMessageVerifier = StepVerifier.create(primaryQueueServiceAsyncClient.getQueueAsyncClient(queueName) + .enqueueMessageWithResponse("Testing service client creating a queue", null, null)) + then: + createQueueVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + enqueueMessageVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 201) + }.verifyComplete() + + + where: + metadata | _ + null | _ + Collections.singletonMap("metadata", "value") | _ + Collections.singletonMap("metadata", "va@lue") | _ + } + + def "Create queue with invalid metadata"() { + given: + def queueName = testResourceName.randomName(methodName, 60) + when: + def createQueueVerifier = StepVerifier.create(primaryQueueServiceAsyncClient.createQueueWithResponse(queueName, Collections.singletonMap("metadata!", "value"))) + then: + createQueueVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 400, StorageErrorCode.INVALID_METADATA) + } + } + + def "Delete queue"() { + given: + def queueName = testResourceName.randomName(methodName, 60) + primaryQueueServiceAsyncClient.createQueue(queueName).block() + when: + def deleteQueueVerifier = StepVerifier.create(primaryQueueServiceAsyncClient.deleteQueueWithResponse(queueName)) + def enqueueMessageVerifier = StepVerifier.create(primaryQueueServiceAsyncClient.getQueueAsyncClient(queueName) + .enqueueMessageWithResponse("Expecting exception as queue has been deleted.", null, null)) + then: + deleteQueueVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 204) + }.verifyComplete() + enqueueMessageVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + } + + def "Delete queue error"() { + when: + def deleteQueueVerifier = StepVerifier.create(primaryQueueServiceAsyncClient.deleteQueueWithResponse(testResourceName.randomName(methodName, 16))) + then: + deleteQueueVerifier.verifyErrorSatisfies { + assert QueueTestHelper.assertExceptionStatusCodeAndMessage(it, 404, StorageErrorCode.QUEUE_NOT_FOUND) + } + } + + @Unroll + def "List queues"() { + given: + def queueName = testResourceName.randomName(methodName, 60) + LinkedList testQueues = new LinkedList<>() + for (int i = 0; i < 3; i++) { + String version = Integer.toString(i) + QueueItem queue = new QueueItem().setName(queueName + version) + .setMetadata(Collections.singletonMap("metadata" + version, "value" + version)) + testQueues.add(queue) + primaryQueueServiceAsyncClient.createQueueWithResponse(queue.getName(), queue.getMetadata()).block() + } + when: + def queueListVerifier = StepVerifier.create(primaryQueueServiceAsyncClient.listQueues(options)) + then: + queueListVerifier.assertNext { + assert QueueTestHelper.assertQueuesAreEqual(it, testQueues.pop()) + }.assertNext { + assert QueueTestHelper.assertQueuesAreEqual(it, testQueues.pop()) + }.assertNext { + assert QueueTestHelper.assertQueuesAreEqual(it, testQueues.pop()) + }.verifyComplete() + where: + options | _ + new QueuesSegmentOptions().setPrefix("queueserviceasyncapitestslistqueues") | _ + new QueuesSegmentOptions().setPrefix("queueserviceasyncapitestslistqueues").setMaxResults(2) | _ + new QueuesSegmentOptions().setPrefix("queueserviceasyncapitestslistqueues").setIncludeMetadata(true) | _ + } + + def "List empty queues"() { + when: + def listQueueVerifier = StepVerifier.create((primaryQueueServiceAsyncClient.listQueues(new QueuesSegmentOptions()))) + then: + listQueueVerifier.assertNext { + !it.iterator().hasNext() + } + } + + def "Get and set properties"() { + given: + def originalProperties = primaryQueueServiceAsyncClient.getProperties().block() + def retentionPolicy = new RetentionPolicy().setEnabled(true) + .setDays(3) + def logging = new Logging().setVersion("1.0") + .setDelete(true) + .setWrite(true) + .setRetentionPolicy(retentionPolicy) + def metrics = new Metrics().setEnabled(true) + .setIncludeAPIs(false) + .setRetentionPolicy(retentionPolicy) + .setVersion("1.0") + def updatedProperties = new StorageServiceProperties().setLogging(logging) + .setHourMetrics(metrics) + .setMinuteMetrics(metrics) + .setCors(new ArrayList<>()) + when: + def getPropertiesBeforeVerifier = StepVerifier.create(primaryQueueServiceAsyncClient.getProperties()) + def setPropertiesVerifier = StepVerifier.create(primaryQueueServiceAsyncClient.setPropertiesWithResponse(updatedProperties)) + def getPropertiesAfterVerifier = StepVerifier.create(primaryQueueServiceAsyncClient.getProperties()) + then: + getPropertiesBeforeVerifier.assertNext { + assert QueueTestHelper.assertQueueServicePropertiesAreEqual(originalProperties, it) + } + setPropertiesVerifier.assertNext { + assert QueueTestHelper.assertResponseStatusCode(it, 202) + }.verifyComplete() + + getPropertiesAfterVerifier.assertNext { + assert QueueTestHelper.assertQueueServicePropertiesAreEqual(updatedProperties, it) + }.verifyComplete() + } +} diff --git a/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueTestHelper.groovy b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueTestHelper.groovy new file mode 100644 index 000000000000..cac8c177aed2 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/spock/QueueTestHelper.groovy @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.queue.spock + +import com.azure.core.http.rest.Response +import com.azure.core.implementation.util.ImplUtils +import com.azure.core.util.configuration.ConfigurationManager +import com.azure.storage.queue.models.CorsRule +import com.azure.storage.queue.models.Logging +import com.azure.storage.queue.models.Metrics +import com.azure.storage.queue.models.QueueItem +import com.azure.storage.queue.models.RetentionPolicy +import com.azure.storage.queue.models.SignedIdentifier +import com.azure.storage.queue.models.StorageErrorCode +import com.azure.storage.queue.models.StorageException +import com.azure.storage.queue.models.StorageServiceProperties + +import java.time.Duration + +class QueueTestHelper { + static boolean assertResponseStatusCode(Response response, int expectedStatusCode) { + return expectedStatusCode == response.getStatusCode() + } + + static boolean assertExceptionStatusCodeAndMessage(Throwable throwable, int expectedStatusCode, StorageErrorCode errMessage) { + return throwable instanceof StorageException && + ((StorageException) throwable).getStatusCode() == expectedStatusCode && + ((StorageException) throwable).getErrorCode() == errMessage + } + + static boolean assertQueuesAreEqual(QueueItem expected, QueueItem actual) { + if (expected == null) { + return actual == null + } else { + if (!Objects.equals(expected.getName(), actual.getName())) { + return false + } + if (expected.getMetadata() != null && !ImplUtils.isNullOrEmpty(actual.getMetadata())) { + return expected.getMetadata().equals(actual.getMetadata()) + } + return true + } + } + + static boolean assertQueueServicePropertiesAreEqual(StorageServiceProperties expected, StorageServiceProperties actual) { + if (expected == null) { + return actual == null + } else { + return assertMetricsAreEqual(expected.getHourMetrics(), actual.getHourMetrics()) && + assertMetricsAreEqual(expected.getMinuteMetrics(), actual.getMinuteMetrics()) && + assertLoggingAreEqual(expected.getLogging(), actual.getLogging()) && + assertCorsAreEqual(expected.getCors(), actual.getCors()) + } + } + + static boolean assertMetricsAreEqual(Metrics expected, Metrics actual) { + if (expected == null) { + return actual == null + } else { + return Objects.equals(expected.isEnabled(), actual.isEnabled()) && + Objects.equals(expected.isIncludeAPIs(), actual.isIncludeAPIs()) && + Objects.equals(expected.getVersion(), actual.getVersion()) && + assertRetentionPoliciesAreEqual(expected.getRetentionPolicy(), actual.getRetentionPolicy()) + } + } + + static boolean assertLoggingAreEqual(Logging expected, Logging actual) { + if (expected == null) { + return actual == null + } else { + return Objects.equals(expected.isRead(), actual.isRead()) && + Objects.equals(expected.isWrite(), actual.isWrite()) && + Objects.equals(expected.isDelete(), actual.isDelete()) && + Objects.equals(expected.getVersion(), actual.getVersion()) && + assertRetentionPoliciesAreEqual(expected.getRetentionPolicy(), actual.getRetentionPolicy()) + } + } + + static boolean assertRetentionPoliciesAreEqual(RetentionPolicy expected, RetentionPolicy actual) { + if (expected == null) { + return actual == null + } else { + return Objects.equals(expected.getDays(), actual.getDays()) && + Objects.equals(expected.isEnabled(), actual.isEnabled()) + } + } + + static boolean assertCorsAreEqual(List expected, List actual) { + if (expected == null) { + return actual == null + } else { + if (expected.size() != actual.size()) { + return false + } + for (int i = 0; i < expected.size(); i++) { + if (!assertCorRulesAreEqual(expected.get(i), actual.get(i))) { + return false + } + } + return true + } + } + + static boolean assertCorRulesAreEqual(CorsRule expected, CorsRule actual) { + if (expected == null) { + return actual == null + } else { + return Objects.equals(expected.getAllowedHeaders(), actual.getAllowedHeaders()) && + Objects.equals(expected.getAllowedMethods(), actual.getAllowedMethods()) && + Objects.equals(expected.getAllowedOrigins(), actual.getAllowedOrigins()) && + Objects.equals(expected.getMaxAgeInSeconds(), actual.getMaxAgeInSeconds()) + } + } + + static boolean assertPermissionsAreEqual(SignedIdentifier expected, SignedIdentifier actual) { + if (expected == null) { + return actual == null + } + if (expected.getAccessPolicy() == null) { + return actual.getAccessPolicy() == null + } + return Objects.equals(expected.getId(), actual.getId()) && + Objects.equals(expected.getAccessPolicy().getPermission(), actual.getAccessPolicy().getPermission()) && + Objects.equals(expected.getAccessPolicy().getStart(), actual.getAccessPolicy().getStart()) && + Objects.equals(expected.getAccessPolicy().getExpiry(), actual.getAccessPolicy().getExpiry()) + } + + static void sleepInRecord(Duration time) { + String azureTestMode = ConfigurationManager.getConfiguration().get("AZURE_TEST_MODE") + if ("RECORD".equalsIgnoreCase(azureTestMode)) { + sleep(time) + } + } + + private static void sleep(Duration time) { + try { + Thread.sleep(time.toMillis()) + } catch (InterruptedException ex) { + // Ignore the error + } + } +} diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsClearMessages.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsClearMessages.json new file mode 100644 index 000000000000..054b6c8f0e2e --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsClearMessages.json @@ -0,0 +1,143 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsclearmessages374057e6546febd3f4e", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "b03d244b-430f-400e-b5ad-72457a47bb03" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b18147f9-6003-00c8-06c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:44 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsclearmessages374057e6546febd3f4e/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "7ecf25e6-b3f4-4f6f-a637-4995928d390d", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814801-6003-00c8-0cc2-62a141000000", + "Body" : "5292acc3-3f15-411b-8045-2cdfec8c4b68Wed, 04 Sep 2019 01:45:44 GMTWed, 11 Sep 2019 01:45:44 GMTAgAAAAMAAAAAAAAABQ+xd8Ji1QE=Wed, 04 Sep 2019 01:45:44 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:44 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsclearmessages374057e6546febd3f4e/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "b8aa352c-6294-436c-91d5-1a575016668c", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814804-6003-00c8-0fc2-62a141000000", + "Body" : "f03f87cb-e4d5-4168-8de5-85784f334ba7Wed, 04 Sep 2019 01:45:44 GMTWed, 11 Sep 2019 01:45:44 GMTAgAAAAMAAAAAAAAAOfK1d8Ji1QE=Wed, 04 Sep 2019 01:45:44 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:44 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsclearmessages374057e6546febd3f4e/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "f8ba01eb-f3c7-4870-9ccf-b8e4bced03e0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814807-6003-00c8-12c2-62a141000000", + "Body" : "99a7b34e-76d8-4e45-af6b-2453f6250ddaWed, 04 Sep 2019 01:45:44 GMTWed, 11 Sep 2019 01:45:44 GMTAgAAAAMAAAAAAAAAe/y6d8Ji1QE=Wed, 04 Sep 2019 01:45:44 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:44 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsclearmessages374057e6546febd3f4e?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "25a9ed5c-9fb7-48a1-99ab-174a8f536540" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "3", + "StatusCode" : "200", + "x-ms-request-id" : "b181480b-6003-00c8-15c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:44 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsclearmessages374057e6546febd3f4e/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "a283eb7b-c39d-490b-9a96-f2a2a1e8205a" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b181480e-6003-00c8-18c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:44 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsclearmessages374057e6546febd3f4e?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "94b7258e-0f57-44aa-91e3-f9dd52950f25" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814829-6003-00c8-2ec2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:44 GMT" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestsclearmessages374057e6546febd3f4e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsClearMessagesError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsClearMessagesError.json new file mode 100644 index 000000000000..e33972216a39 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsClearMessagesError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsclearmessageserror102302360165c484c/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "8b3cf0fb-07f8-4470-9fb8-3f2b1ea692ef" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "b1814830-6003-00c8-33c2-62a141000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:b1814830-6003-00c8-33c2-62a141000000\nTime:2019-09-04T01:45:45.5947416Z", + "Date" : "Wed, 04 Sep 2019 01:45:45 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestsclearmessageserror102302360165c484c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsCreateQueueWithSharedKey.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsCreateQueueWithSharedKey.json new file mode 100644 index 000000000000..f1d3bf79fa98 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsCreateQueueWithSharedKey.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestscreatequeuewithsharedkey37137fcf92519c", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "0a052190-5b42-4a74-b609-d8ba26cd6685" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b18144e6-6003-00c8-01c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:37 GMT" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestscreatequeuewithsharedkey37137fcf92519c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteExistQueue.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteExistQueue.json new file mode 100644 index 000000000000..835eb4e6912c --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteExistQueue.json @@ -0,0 +1,40 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeleteexistqueue8281978f20c4612244", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "d2d0b9f5-19c1-487e-8e2c-fe30c48b79a0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814594-6003-00c8-0ec2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:37 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeleteexistqueue8281978f20c4612244", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "ab2fa111-7dec-4aa3-9c2b-c96ea89b13ac" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b181459a-6003-00c8-13c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:37 GMT" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestsdeleteexistqueue8281978f20c4612244" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteMessage.json new file mode 100644 index 000000000000..a677c3d84ada --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteMessage.json @@ -0,0 +1,164 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessage50381bf626ac5950b47", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "2a9d03aa-6edb-4fb5-9656-fb9e5279c817" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b181483a-6003-00c8-39c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:45 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessage50381bf626ac5950b47/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "c40cfcc7-85c5-4def-9c71-158850897b4e", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814842-6003-00c8-3fc2-62a141000000", + "Body" : "0146be94-7e7a-45ae-bdb3-402f967eba66Wed, 04 Sep 2019 01:45:45 GMTWed, 11 Sep 2019 01:45:45 GMTAgAAAAMAAAAAAAAAzbY0eMJi1QE=Wed, 04 Sep 2019 01:45:45 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:45 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessage50381bf626ac5950b47/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "37c720cc-9249-4fae-9d9d-45382e7d87ac", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814845-6003-00c8-42c2-62a141000000", + "Body" : "50ce4189-5d2b-4304-8b4f-6bed7a8b8e27Wed, 04 Sep 2019 01:45:45 GMTWed, 11 Sep 2019 01:45:45 GMTAgAAAAMAAAAAAAAAg106eMJi1QE=Wed, 04 Sep 2019 01:45:45 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:45 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessage50381bf626ac5950b47/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "8c96c05e-7c19-4cc5-99df-1cd9874e998e", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b181484a-6003-00c8-45c2-62a141000000", + "Body" : "343e01c9-4c28-461b-8d46-cf9a89d93dcfWed, 04 Sep 2019 01:45:45 GMTWed, 11 Sep 2019 01:45:45 GMTAgAAAAMAAAAAAAAApRk/eMJi1QE=Wed, 04 Sep 2019 01:45:45 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:45 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessage50381bf626ac5950b47/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "09a74d51-79c6-4e23-8058-edddecc15d49" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b181484c-6003-00c8-47c2-62a141000000", + "Body" : "0146be94-7e7a-45ae-bdb3-402f967eba66Wed, 04 Sep 2019 01:45:45 GMTWed, 11 Sep 2019 01:45:45 GMTAgAAAAMAAAAAAAAAGJwnisJi1QE=Wed, 04 Sep 2019 01:46:15 GMT1test message 1", + "Date" : "Wed, 04 Sep 2019 01:45:45 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessage50381bf626ac5950b47?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "eddf9e99-12d6-4a28-86cf-d39501d37fb7" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "3", + "StatusCode" : "200", + "x-ms-request-id" : "b181484e-6003-00c8-49c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:45 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessage50381bf626ac5950b47/messages/0146be94-7e7a-45ae-bdb3-402f967eba66?popreceipt=AgAAAAMAAAAAAAAAGJwnisJi1QE%3d", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "e90bbb6d-e8a7-4288-b105-d6d53a47bfd0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b1814850-6003-00c8-4bc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:45 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessage50381bf626ac5950b47?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "a003893d-1167-4eab-bfa7-4cac4047aeb4" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "2", + "StatusCode" : "200", + "x-ms-request-id" : "b1814853-6003-00c8-4ec2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:45 GMT" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestsdeletemessage50381bf626ac5950b47" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteMessageInvalidArgs0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteMessageInvalidArgs0.json new file mode 100644 index 000000000000..0cde6c4f4d4e --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteMessageInvalidArgs0.json @@ -0,0 +1,85 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessageinvalidargs06608144d5d387", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "27519365-8825-4a7f-a0d8-96aff78730d3" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b181485d-6003-00c8-57c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:45 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessageinvalidargs06608144d5d387/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "9edf9187-2e09-48e5-b061-02f40a8436d0", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814862-6003-00c8-5bc2-62a141000000", + "Body" : "d3741b74-ea39-47e2-9dac-41a49888cf80Wed, 04 Sep 2019 01:45:46 GMTWed, 11 Sep 2019 01:45:46 GMTAgAAAAMAAAAAAAAAPE53eMJi1QE=Wed, 04 Sep 2019 01:45:46 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:45 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessageinvalidargs06608144d5d387/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "be8fe50c-2908-46fa-8755-be39be1bb111" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814868-6003-00c8-60c2-62a141000000", + "Body" : "d3741b74-ea39-47e2-9dac-41a49888cf80Wed, 04 Sep 2019 01:45:46 GMTWed, 11 Sep 2019 01:45:46 GMTAgAAAAMAAAAAAAAAZ9RdisJi1QE=Wed, 04 Sep 2019 01:46:16 GMT1test message", + "Date" : "Wed, 04 Sep 2019 01:45:45 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessageinvalidargs06608144d5d387/messages/d3741b74-ea39-47e2-9dac-41a49888cf80?popreceipt=AgAAAAMAAAAAAAAAZ9RdisJi1QE%3dRandom", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "dfa18f65-b00d-42db-8583-cb45b93eb459" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "444", + "StatusCode" : "400", + "x-ms-request-id" : "b181486a-6003-00c8-62c2-62a141000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:b181486a-6003-00c8-62c2-62a141000000\nTime:2019-09-04T01:45:46.2233278ZpopreceiptAgAAAAMAAAAAAAAAZ9RdisJi1QE=RandomInvalid pop receipt format", + "Date" : "Wed, 04 Sep 2019 01:45:45 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestsdeletemessageinvalidargs06608144d5d387" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteMessageInvalidArgs1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteMessageInvalidArgs1.json new file mode 100644 index 000000000000..0140e68ca7b5 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteMessageInvalidArgs1.json @@ -0,0 +1,85 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessageinvalidargs115378446c04f4", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "0bca302e-24ee-4184-8249-d9f3f5974bfa" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814872-6003-00c8-68c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:45 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessageinvalidargs115378446c04f4/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "0095ce6c-b99c-4d07-baa5-72316718d874", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814875-6003-00c8-6ac2-62a141000000", + "Body" : "7d78b3cb-7d6a-4d8e-bc6a-ff212d851d85Wed, 04 Sep 2019 01:45:46 GMTWed, 11 Sep 2019 01:45:46 GMTAgAAAAMAAAAAAAAAb0+WeMJi1QE=Wed, 04 Sep 2019 01:45:46 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:45 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessageinvalidargs115378446c04f4/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "d8012aae-1df5-44f9-b0e8-c2fc08d26d6e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b181487a-6003-00c8-6ec2-62a141000000", + "Body" : "7d78b3cb-7d6a-4d8e-bc6a-ff212d851d85Wed, 04 Sep 2019 01:45:46 GMTWed, 11 Sep 2019 01:45:46 GMTAgAAAAMAAAAAAAAAo9V8isJi1QE=Wed, 04 Sep 2019 01:46:16 GMT1test message", + "Date" : "Wed, 04 Sep 2019 01:45:45 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessageinvalidargs115378446c04f4/messages/7d78b3cb-7d6a-4d8e-bc6a-ff212d851d85Random?popreceipt=AgAAAAMAAAAAAAAAo9V8isJi1QE%3d", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "e86f0dff-433f-4a0a-9fcf-a06dfd3e6832" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "MessageNotFound", + "retry-after" : "0", + "Content-Length" : "221", + "StatusCode" : "404", + "x-ms-request-id" : "b181487e-6003-00c8-71c2-62a141000000", + "Body" : "MessageNotFoundThe specified message does not exist.\nRequestId:b181487e-6003-00c8-71c2-62a141000000\nTime:2019-09-04T01:45:47.6426529Z", + "Date" : "Wed, 04 Sep 2019 01:45:47 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestsdeletemessageinvalidargs115378446c04f4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteMessageInvalidArgs2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteMessageInvalidArgs2.json new file mode 100644 index 000000000000..964022782af3 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteMessageInvalidArgs2.json @@ -0,0 +1,85 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessageinvalidargs2949322bfc0573", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "2bcf0801-348e-4771-bd52-1fca89708b5b" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b18148d1-6003-00c8-31c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:47 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessageinvalidargs2949322bfc0573/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "8e2955cf-2a80-4314-bb96-e10032d1bc54", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b18148d4-6003-00c8-33c2-62a141000000", + "Body" : "cae6d4d7-dd70-4aeb-9e2b-d3cb71d29693Wed, 04 Sep 2019 01:45:47 GMTWed, 11 Sep 2019 01:45:47 GMTAgAAAAMAAAAAAAAA0OJuecJi1QE=Wed, 04 Sep 2019 01:45:47 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:47 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessageinvalidargs2949322bfc0573/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "f8b6ebcf-115d-4874-b254-6846bd0dc828" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b18148d7-6003-00c8-36c2-62a141000000", + "Body" : "cae6d4d7-dd70-4aeb-9e2b-d3cb71d29693Wed, 04 Sep 2019 01:45:47 GMTWed, 11 Sep 2019 01:45:47 GMTAgAAAAMAAAAAAAAAGhdXi8Ji1QE=Wed, 04 Sep 2019 01:46:17 GMT1test message", + "Date" : "Wed, 04 Sep 2019 01:45:47 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletemessageinvalidargs2949322bfc0573/messages/cae6d4d7-dd70-4aeb-9e2b-d3cb71d29693Random?popreceipt=AgAAAAMAAAAAAAAAGhdXi8Ji1QE%3dRandom", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "c0336e33-59e6-4736-81b0-39ab620c720d" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "444", + "StatusCode" : "400", + "x-ms-request-id" : "b18148df-6003-00c8-3dc2-62a141000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:b18148df-6003-00c8-3dc2-62a141000000\nTime:2019-09-04T01:45:47.8548519ZpopreceiptAgAAAAMAAAAAAAAAGhdXi8Ji1QE=RandomInvalid pop receipt format", + "Date" : "Wed, 04 Sep 2019 01:45:47 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestsdeletemessageinvalidargs2949322bfc0573" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteQueueError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteQueueError.json new file mode 100644 index 000000000000..63d5b76f67d1 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDeleteQueueError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdeletequeueerror023823e91255a73854", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "8f5832cf-0e94-41d2-8e38-f3e8d7fbed94" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "b18145a9-6003-00c8-1fc2-62a141000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:b18145a9-6003-00c8-1fc2-62a141000000\nTime:2019-09-04T01:45:38.4720568Z", + "Date" : "Wed, 04 Sep 2019 01:45:37 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestsdeletequeueerror023823e91255a73854" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDequeueMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDequeueMessage.json new file mode 100644 index 000000000000..383c6fb6be18 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDequeueMessage.json @@ -0,0 +1,64 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdequeuemessage19834561ea1909b234c", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "4d19cf42-365e-4630-a4f9-75f7f82fe395" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814772-6003-00c8-15c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:43 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdequeuemessage19834561ea1909b234c/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "9d7b7175-1848-4dd5-97ba-884a1bd927e9", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b181477a-6003-00c8-1bc2-62a141000000", + "Body" : "580a70b9-03bb-43dd-8f4d-c76781987c0cWed, 04 Sep 2019 01:45:43 GMTWed, 11 Sep 2019 01:45:43 GMTAgAAAAMAAAAAAAAAYvL3dsJi1QE=Wed, 04 Sep 2019 01:45:43 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:43 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdequeuemessage19834561ea1909b234c/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "309a6ec6-5f0a-497a-860f-67160755c835" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b181477f-6003-00c8-20c2-62a141000000", + "Body" : "580a70b9-03bb-43dd-8f4d-c76781987c0cWed, 04 Sep 2019 01:45:43 GMTWed, 11 Sep 2019 01:45:43 GMTAgAAAAMAAAAAAAAAKmPfiMJi1QE=Wed, 04 Sep 2019 01:46:13 GMT1test message", + "Date" : "Wed, 04 Sep 2019 01:45:43 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestsdequeuemessage19834561ea1909b234c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDequeueMultipleMessages.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDequeueMultipleMessages.json new file mode 100644 index 000000000000..8294c9434482 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDequeueMultipleMessages.json @@ -0,0 +1,85 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdequeuemultiplemessages652964483d43fb", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "2bc54c7d-1aa9-4c7b-846e-60fbe251a532" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b181478b-6003-00c8-2ac2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:43 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdequeuemultiplemessages652964483d43fb/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "796c6717-f985-439b-aab4-1488340455c7", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b181478f-6003-00c8-2cc2-62a141000000", + "Body" : "fe977610-0918-42ff-b48f-45552b83bedcWed, 04 Sep 2019 01:45:43 GMTWed, 11 Sep 2019 01:45:43 GMTAgAAAAMAAAAAAAAAyjMUd8Ji1QE=Wed, 04 Sep 2019 01:45:43 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:43 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdequeuemultiplemessages652964483d43fb/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "4a889bea-d692-4773-b8b1-a102698c9144", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814795-6003-00c8-31c2-62a141000000", + "Body" : "00c1f53e-eed3-4f19-9c0f-13d2e0eebe19Wed, 04 Sep 2019 01:45:43 GMTWed, 11 Sep 2019 01:45:43 GMTAgAAAAMAAAAAAAAAMWUZd8Ji1QE=Wed, 04 Sep 2019 01:45:43 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:43 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdequeuemultiplemessages652964483d43fb/messages?numofmessages=2&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "e4fbb0fb-38f0-4526-8cda-5cd49c707c61" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b181479d-6003-00c8-36c2-62a141000000", + "Body" : "fe977610-0918-42ff-b48f-45552b83bedcWed, 04 Sep 2019 01:45:43 GMTWed, 11 Sep 2019 01:45:43 GMTAgAAAAMAAAAAAAAAgBIAicJi1QE=Wed, 04 Sep 2019 01:46:13 GMT1test message 100c1f53e-eed3-4f19-9c0f-13d2e0eebe19Wed, 04 Sep 2019 01:45:43 GMTWed, 11 Sep 2019 01:45:43 GMTAgAAAAMAAAAAAAAAgBIAicJi1QE=Wed, 04 Sep 2019 01:46:13 GMT1test message 2", + "Date" : "Wed, 04 Sep 2019 01:45:43 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestsdequeuemultiplemessages652964483d43fb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDequeueTooManyMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDequeueTooManyMessage.json new file mode 100644 index 000000000000..07db788f7f55 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsDequeueTooManyMessage.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdequeuetoomanymessage00620d5f65aa41f", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "da507a09-af03-4fe0-90d4-bb289d2300e4" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b18147aa-6003-00c8-43c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:43 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsdequeuetoomanymessage00620d5f65aa41f/messages?numofmessages=33&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "168f4850-586c-463c-a235-2a2c02d3cadf" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "456", + "StatusCode" : "400", + "x-ms-request-id" : "b18147af-6003-00c8-47c2-62a141000000", + "Body" : "OutOfRangeQueryParameterValueOne of the query parameters specified in the request URI is outside the permissible range.\nRequestId:b18147af-6003-00c8-47c2-62a141000000\nTime:2019-09-04T01:45:44.0482970Znumofmessages33132", + "Date" : "Wed, 04 Sep 2019 01:45:43 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestsdequeuetoomanymessage00620d5f65aa41f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsEnqueueEmptyMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsEnqueueEmptyMessage.json new file mode 100644 index 000000000000..8815c4c284fe --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsEnqueueEmptyMessage.json @@ -0,0 +1,64 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsenqueueemptymessage974659b1306e686d", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "97b0abe0-d576-4c97-b84c-46821edf1e76" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b181474c-6003-00c8-74c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:42 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsenqueueemptymessage974659b1306e686d/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "a7bc5c2b-217a-4c36-b865-142a2297e82c", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814752-6003-00c8-78c2-62a141000000", + "Body" : "9c3aaa95-63c7-4d21-b960-35fe941d84f7Wed, 04 Sep 2019 01:45:43 GMTWed, 11 Sep 2019 01:45:43 GMTAgAAAAMAAAAAAAAAF3bGdsJi1QE=Wed, 04 Sep 2019 01:45:43 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:42 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsenqueueemptymessage974659b1306e686d/messages?peekonly=true", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "c44d2602-bf35-42ea-9e5e-075ba4b5bb3f" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814755-6003-00c8-7bc2-62a141000000", + "Body" : "9c3aaa95-63c7-4d21-b960-35fe941d84f7Wed, 04 Sep 2019 01:45:43 GMTWed, 11 Sep 2019 01:45:43 GMT0", + "Date" : "Wed, 04 Sep 2019 01:45:42 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestsenqueueemptymessage974659b1306e686d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsEnqueueMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsEnqueueMessage.json new file mode 100644 index 000000000000..81bd6ebc2ecb --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsEnqueueMessage.json @@ -0,0 +1,64 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsenqueuemessage86367ca096500936b4c", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "3c4fe747-d481-4f70-8237-4a156822ef09" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b181473a-6003-00c8-65c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:42 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsenqueuemessage86367ca096500936b4c/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "05d3699e-7bfd-4022-a33e-4c4ab49e0a80", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b181473e-6003-00c8-68c2-62a141000000", + "Body" : "ebf2709f-b8af-4390-95b1-3639b2eced46Wed, 04 Sep 2019 01:45:43 GMTWed, 11 Sep 2019 01:45:43 GMTAgAAAAMAAAAAAAAAOZipdsJi1QE=Wed, 04 Sep 2019 01:45:43 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:42 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsenqueuemessage86367ca096500936b4c/messages?peekonly=true", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "9b26ba64-eb51-4922-ad4c-4c171373c186" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814746-6003-00c8-6ec2-62a141000000", + "Body" : "ebf2709f-b8af-4390-95b1-3639b2eced46Wed, 04 Sep 2019 01:45:43 GMTWed, 11 Sep 2019 01:45:43 GMT0test message", + "Date" : "Wed, 04 Sep 2019 01:45:42 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestsenqueuemessage86367ca096500936b4c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsEnqueueTimeToLive.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsEnqueueTimeToLive.json new file mode 100644 index 000000000000..09032d60abd6 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsEnqueueTimeToLive.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsenqueuetimetolive41539ce63b7b5e101", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "5c967007-cc59-46c6-ac8d-01ba2ede4c12" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814760-6003-00c8-06c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:42 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsenqueuetimetolive41539ce63b7b5e101/messages?visibilitytimeout=0&messagettl=2", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "eb1ce4d5-4de0-4d3e-a573-6cb9f523ff91", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814762-6003-00c8-07c2-62a141000000", + "Body" : "1c45040d-156b-455a-a1f8-bf360667545eWed, 04 Sep 2019 01:45:43 GMTWed, 04 Sep 2019 01:45:45 GMTAgAAAAMAAAAAAAAA6KXhdsJi1QE=Wed, 04 Sep 2019 01:45:43 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:42 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestsenqueuetimetolive41539ce63b7b5e101" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsGetAccessPolicy.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsGetAccessPolicy.json new file mode 100644 index 000000000000..395d19cbe353 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsGetAccessPolicy.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsgetaccesspolicy098995f1cfd7ad7c24", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "5861f2ae-3bd5-4baa-a586-2cb8285dbedc" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814692-6003-00c8-5bc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:40 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsgetaccesspolicy098995f1cfd7ad7c24?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "e290f0e9-225d-4fe2-9913-9d38688fc7a0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814696-6003-00c8-5ec2-62a141000000", + "Body" : "", + "Date" : "Wed, 04 Sep 2019 01:45:40 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestsgetaccesspolicy098995f1cfd7ad7c24" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsGetAccessPolicyError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsGetAccessPolicyError.json new file mode 100644 index 000000000000..dc5f639921f6 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsGetAccessPolicyError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsgetaccesspolicyerror63509e8f653c614e?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "16e4c14a-d5b1-48c1-ab05-42ec5387a160" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "b18146b4-6003-00c8-74c2-62a141000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:b18146b4-6003-00c8-74c2-62a141000000\nTime:2019-09-04T01:45:41.5299303Z", + "Date" : "Wed, 04 Sep 2019 01:45:40 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestsgetaccesspolicyerror63509e8f653c614e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsGetProperties.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsGetProperties.json new file mode 100644 index 000000000000..59a4291016e3 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsGetProperties.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsgetproperties46157c110a039e59f4d", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "9422c9d9-0a87-4d75-a98a-2b5c6d691bfe" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b18145ac-6003-00c8-22c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:38 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsgetproperties46157c110a039e59f4d?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "600239bb-c4d4-4eb8-b653-6c58a8884e23" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "x-ms-meta-metadata" : "value", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b18145b1-6003-00c8-26c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:38 GMT" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestsgetproperties46157c110a039e59f4d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsGetPropertiesError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsGetPropertiesError.json new file mode 100644 index 000000000000..68748446e35a --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsGetPropertiesError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsgetpropertieserror17025608b491e0ef5?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "6649eead-72e9-41ca-bc25-6fbc85af1142" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "b18145bc-6003-00c8-2fc2-62a141000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:b18145bc-6003-00c8-2fc2-62a141000000\nTime:2019-09-04T01:45:38.7793449Z", + "Date" : "Wed, 04 Sep 2019 01:45:38 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestsgetpropertieserror17025608b491e0ef5" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsPeekMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsPeekMessage.json new file mode 100644 index 000000000000..8aebe2a7c66d --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsPeekMessage.json @@ -0,0 +1,64 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestspeekmessagequeueapitestspeekmessageb1f246230b", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "3e24b6a3-b26c-46dc-9c27-e2b71a2e7941" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b18147c2-6003-00c8-58c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:43 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestspeekmessagequeueapitestspeekmessageb1f246230b/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "930ca70c-de56-4b55-8dca-7e4c6d54f6af", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b18147c6-6003-00c8-5bc2-62a141000000", + "Body" : "45d6696c-c196-494f-bb6b-15df6105ec14Wed, 04 Sep 2019 01:45:44 GMTWed, 11 Sep 2019 01:45:44 GMTAgAAAAMAAAAAAAAA7x1Kd8Ji1QE=Wed, 04 Sep 2019 01:45:44 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:43 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestspeekmessagequeueapitestspeekmessageb1f246230b/messages?peekonly=true", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "20908625-6eea-4390-a3d1-6efdd611caf5" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b18147ca-6003-00c8-5ec2-62a141000000", + "Body" : "45d6696c-c196-494f-bb6b-15df6105ec14Wed, 04 Sep 2019 01:45:44 GMTWed, 11 Sep 2019 01:45:44 GMT0test message", + "Date" : "Wed, 04 Sep 2019 01:45:43 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestspeekmessagequeueapitestspeekmessageb1f246230b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsPeekMessagesError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsPeekMessagesError.json new file mode 100644 index 000000000000..d4b5f50fc97b --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsPeekMessagesError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestspeekmessageserror636429dbec5c0a85d/messages?peekonly=true", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "e068a6a7-bcf5-4ae6-8324-811c228d0c8d" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "b18147f2-6003-00c8-80c2-62a141000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:b18147f2-6003-00c8-80c2-62a141000000\nTime:2019-09-04T01:45:44.7079135Z", + "Date" : "Wed, 04 Sep 2019 01:45:44 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestspeekmessageserror636429dbec5c0a85d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsPeekMultipleMessages.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsPeekMultipleMessages.json new file mode 100644 index 000000000000..7ef95f04d8f9 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsPeekMultipleMessages.json @@ -0,0 +1,85 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestspeekmultiplemessages45584d6cf8e3a0f9", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "f60649f9-ebb3-4bc8-9da0-368f55ea7a19" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b18147d5-6003-00c8-67c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:43 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestspeekmultiplemessages45584d6cf8e3a0f9/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "8d41ed53-6dac-4bf0-ade9-c7c258e5315e", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b18147db-6003-00c8-6cc2-62a141000000", + "Body" : "6a7ecccd-78bb-4b53-80dc-3ad76a5f85eeWed, 04 Sep 2019 01:45:44 GMTWed, 11 Sep 2019 01:45:44 GMTAgAAAAMAAAAAAAAA0e1jd8Ji1QE=Wed, 04 Sep 2019 01:45:44 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:43 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestspeekmultiplemessages45584d6cf8e3a0f9/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "eefdb88a-68fe-4758-9035-d1807986ff48", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b18147e2-6003-00c8-72c2-62a141000000", + "Body" : "0a805363-971f-420c-8441-5faa3b7f652bWed, 04 Sep 2019 01:45:44 GMTWed, 11 Sep 2019 01:45:44 GMTAgAAAAMAAAAAAAAAuiVwd8Ji1QE=Wed, 04 Sep 2019 01:45:44 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:43 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestspeekmultiplemessages45584d6cf8e3a0f9/messages?numofmessages=2&peekonly=true", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "81ff6eff-c463-4170-a95d-fe69a5776ecb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b18147e3-6003-00c8-73c2-62a141000000", + "Body" : "6a7ecccd-78bb-4b53-80dc-3ad76a5f85eeWed, 04 Sep 2019 01:45:44 GMTWed, 11 Sep 2019 01:45:44 GMT0test message 10a805363-971f-420c-8441-5faa3b7f652bWed, 04 Sep 2019 01:45:44 GMTWed, 11 Sep 2019 01:45:44 GMT0test message 2", + "Date" : "Wed, 04 Sep 2019 01:45:43 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestspeekmultiplemessages45584d6cf8e3a0f9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsPeekTooManyMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsPeekTooManyMessage.json new file mode 100644 index 000000000000..9074c5d9d4a2 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsPeekTooManyMessage.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestspeektoomanymessage1053731b80bdc8755", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "7e7ac5a2-2972-43b4-8dab-187f2dcea856" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b18147e9-6003-00c8-78c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:43 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestspeektoomanymessage1053731b80bdc8755/messages?numofmessages=33&peekonly=true", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "c978f7b3-8e0a-4182-a17d-0226ccde0ada" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "456", + "StatusCode" : "400", + "x-ms-request-id" : "b18147ec-6003-00c8-7ac2-62a141000000", + "Body" : "OutOfRangeQueryParameterValueOne of the query parameters specified in the request URI is outside the permissible range.\nRequestId:b18147ec-6003-00c8-7ac2-62a141000000\nTime:2019-09-04T01:45:44.6078201Znumofmessages33132", + "Date" : "Wed, 04 Sep 2019 01:45:44 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestspeektoomanymessage1053731b80bdc8755" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAccessPolicy.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAccessPolicy.json new file mode 100644 index 000000000000..0f419a208796 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAccessPolicy.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetaccesspolicy628148179c6bb2f824", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "c01d1ed4-8676-48bd-b23b-47cf0f816193" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b18146c0-6003-00c8-7ec2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:41 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetaccesspolicy628148179c6bb2f824?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "c5eb01af-c1b9-4a35-b875-6a23065eb1ee", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b18146c3-6003-00c8-80c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:41 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetaccesspolicy628148179c6bb2f824?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "fc53a93f-85e5-4b6a-a75f-4acf88f1db54" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b18146f3-6003-00c8-2cc2-62a141000000", + "Body" : "testpermission2000-01-01T00:00:00.0000000Z2020-01-01T00:00:00.0000000Zraup", + "Date" : "Wed, 04 Sep 2019 01:45:41 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestssetaccesspolicy628148179c6bb2f824" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata0.json new file mode 100644 index 000000000000..ab06a2e629d3 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata0.json @@ -0,0 +1,81 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata052699e90a83a2f8e", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "705181a7-842b-4e52-8564-23286cdae339" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b18145c3-6003-00c8-34c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:38 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata052699e90a83a2f8e?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "0a51965f-da6b-4406-862b-84ce9f452f96" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b18145c7-6003-00c8-36c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:38 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata052699e90a83a2f8e?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "70a2e127-c5db-407d-8cd2-0eed3ba98c05" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b18145c9-6003-00c8-38c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:38 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata052699e90a83a2f8e?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "75c66dde-f14e-46e3-8e63-a77ebf9438be" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "x-ms-meta-metadata" : "value", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b18145ef-6003-00c8-57c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:38 GMT" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestssetandclearmetadata052699e90a83a2f8e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata1.json new file mode 100644 index 000000000000..acfeb64d3cd6 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata1.json @@ -0,0 +1,82 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata178537e64c125d9b8", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "bf1ca9cd-bf5f-4cd4-99e7-777f1baf73a2" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b18145fa-6003-00c8-61c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:39 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata178537e64c125d9b8?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "0db890cc-7105-4a84-affd-582e3f11ff48" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "x-ms-meta-metadata1" : "value", + "StatusCode" : "200", + "x-ms-request-id" : "b1814601-6003-00c8-67c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:39 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata178537e64c125d9b8?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "d3d23b98-c25d-44a8-950f-3712349fa737" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b1814607-6003-00c8-6cc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:39 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata178537e64c125d9b8?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "8a7b3667-7f37-448b-9246-860fd3e822f4" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "x-ms-meta-metadata" : "value", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814609-6003-00c8-6ec2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:39 GMT" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestssetandclearmetadata178537e64c125d9b8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata2.json new file mode 100644 index 000000000000..9206d8ee543d --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata2.json @@ -0,0 +1,81 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata28567938911560920", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "8485ccbf-ea27-4505-a9d2-f34d6b6c8f75" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814618-6003-00c8-7bc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:39 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata28567938911560920?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "f1a942a3-85f8-40dc-bbcf-a3eef1b6f05f" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "x-ms-meta-metadata1" : "value", + "StatusCode" : "200", + "x-ms-request-id" : "b181461b-6003-00c8-7dc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:39 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata28567938911560920?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "0b740112-e27d-440e-8fb0-d19bbf7c8013" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b1814620-6003-00c8-01c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:39 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata28567938911560920?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "03cd16ba-b037-4c1d-815b-e1ebe594b877" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814621-6003-00c8-02c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:39 GMT" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestssetandclearmetadata28567938911560920" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata3.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata3.json new file mode 100644 index 000000000000..1c9dd12d5747 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata3.json @@ -0,0 +1,82 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata392826d0baa68916a", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "d2170036-72d2-4fe9-bc1a-cc95fa9db6ab" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b181462d-6003-00c8-0ec2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:39 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata392826d0baa68916a?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "c4b3e016-7a93-4967-b432-13ceba6d7fe4" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "x-ms-meta-metadata" : "value", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814632-6003-00c8-11c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:39 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata392826d0baa68916a?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "1a6dbb9a-1a39-450e-843a-116930287a79" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b1814633-6003-00c8-12c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:39 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata392826d0baa68916a?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "6a6b3976-e09b-417d-a4e0-29e342d272e6" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "x-ms-meta-metadata" : "value", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814638-6003-00c8-15c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:39 GMT" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestssetandclearmetadata392826d0baa68916a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata4.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata4.json new file mode 100644 index 000000000000..6b26f95c0807 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetAndClearMetadata4.json @@ -0,0 +1,80 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata407528f99ac5c65e2", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "a2deccee-a984-4da8-98c0-c92ce2641628" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b181463d-6003-00c8-19c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:39 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata407528f99ac5c65e2?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "249ade7a-9c52-4601-af00-55d3cb7bea7c" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814641-6003-00c8-1cc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:39 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata407528f99ac5c65e2?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "9d9dce74-52e6-4dd4-bbf2-6c60b3a6ab1c" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b1814642-6003-00c8-1dc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:39 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetandclearmetadata407528f99ac5c65e2?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "855e2a21-635a-445a-97c9-39a81e8acea4" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814644-6003-00c8-1fc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:39 GMT" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestssetandclearmetadata407528f99ac5c65e2" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidAccessPolicy.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidAccessPolicy.json new file mode 100644 index 000000000000..5852e6553519 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidAccessPolicy.json @@ -0,0 +1,44 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetinvalidaccesspolicy778733833f2ef21", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "a2b380f2-2168-4453-947a-84d78d12efb5" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b18146fb-6003-00c8-33c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:41 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetinvalidaccesspolicy778733833f2ef21?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "297372df-73a1-479e-b2e6-3016e0ade08a", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlDocument", + "retry-after" : "0", + "Content-Length" : "371", + "StatusCode" : "400", + "x-ms-request-id" : "b18146ff-6003-00c8-36c2-62a141000000", + "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:b18146ff-6003-00c8-36c2-62a141000000\nTime:2019-09-04T01:45:42.6139497Z1304Signed identifier ID cannot be empty or over 64 characters in length", + "Date" : "Wed, 04 Sep 2019 01:45:42 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestssetinvalidaccesspolicy778733833f2ef21" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidMeta0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidMeta0.json new file mode 100644 index 000000000000..35967a6ea9e6 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidMeta0.json @@ -0,0 +1,42 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetinvalidmeta005165f491453932314", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "dfb95284-aac3-466c-845e-c24c54b34521" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814651-6003-00c8-2ac2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:39 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetinvalidmeta005165f491453932314?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "1fac3489-a267-4222-9d8e-ba2c07cf4056" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "787", + "StatusCode" : "403", + "x-ms-request-id" : "b1814656-6003-00c8-2dc2-62a141000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:b1814656-6003-00c8-2dc2-62a141000000\nTime:2019-09-04T01:45:40.5960524ZThe MAC signature found in the HTTP request 'JYaLZjjdjNEXjdVN7b0yupSwTD4Y8zchP7cO+ZHN79M=' is not the same as any computed signature. Server used following string to sign: 'PUT\n\n\n\n\n\nWed, 04 Sep 2019 01:45:38 GMT\n\n\n\n\n\nx-ms-client-request-id:1fac3489-a267-4222-9d8e-ba2c07cf4056\nx-ms-meta-invalidmeta:value\nx-ms-version:2018-03-28\n/azstoragesdkaccount/queueapitestssetinvalidmeta005165f491453932314\ncomp:metadata'.", + "Date" : "Wed, 04 Sep 2019 01:45:40 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestssetinvalidmeta005165f491453932314" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidMeta1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidMeta1.json new file mode 100644 index 000000000000..dfd82c1cc0c4 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidMeta1.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetinvalidmeta171832595e05acc89c4", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "f46069d7-e48b-4271-949f-ccd3ce26f8b5" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b181465a-6003-00c8-31c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:40 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetinvalidmeta171832595e05acc89c4?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "978deb87-d525-49e7-934d-4d59c021d0cd" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidMetadata", + "retry-after" : "0", + "Content-Length" : "260", + "StatusCode" : "400", + "x-ms-request-id" : "b181465e-6003-00c8-34c2-62a141000000", + "Body" : "InvalidMetadataThe metadata specified is invalid. It has characters that are not permitted.\nRequestId:b181465e-6003-00c8-34c2-62a141000000\nTime:2019-09-04T01:45:40.7301785Z", + "Date" : "Wed, 04 Sep 2019 01:45:40 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestssetinvalidmeta171832595e05acc89c4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidMeta2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidMeta2.json new file mode 100644 index 000000000000..9c1c636cb4b4 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidMeta2.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetinvalidmeta203112399e7b2e3f904", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "a67034cf-33dd-41ba-834e-4bea20f88be0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814667-6003-00c8-3cc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:40 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetinvalidmeta203112399e7b2e3f904?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "b38b7280-85cb-42ad-872a-134cae8884cd" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidMetadata", + "retry-after" : "0", + "Content-Length" : "260", + "StatusCode" : "400", + "x-ms-request-id" : "b181466b-6003-00c8-3ec2-62a141000000", + "Body" : "InvalidMetadataThe metadata specified is invalid. It has characters that are not permitted.\nRequestId:b181466b-6003-00c8-3ec2-62a141000000\nTime:2019-09-04T01:45:40.8703102Z", + "Date" : "Wed, 04 Sep 2019 01:45:40 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestssetinvalidmeta203112399e7b2e3f904" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidMeta3.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidMeta3.json new file mode 100644 index 000000000000..fd74f0c21554 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetInvalidMeta3.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetinvalidmeta342327ff9036f707c34", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "9e3c8560-e849-4400-9762-46d03f572a45" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814679-6003-00c8-49c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:40 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetinvalidmeta342327ff9036f707c34?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "3892053c-0c73-4284-966c-451797463b79" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "b181467c-6003-00c8-4bc2-62a141000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:b181467c-6003-00c8-4bc2-62a141000000\nTime:2019-09-04T01:45:41.0204517Zvalue", + "Date" : "Wed, 04 Sep 2019 01:45:40 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestssetinvalidmeta342327ff9036f707c34" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetMetadataQueueError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetMetadataQueueError.json new file mode 100644 index 000000000000..f9b117277afb --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetMetadataQueueError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetmetadataqueueerror03385532b806379?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "ec07da3b-05e2-44b5-99f6-aa012a2e90b2" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "b181464a-6003-00c8-24c2-62a141000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:b181464a-6003-00c8-24c2-62a141000000\nTime:2019-09-04T01:45:40.4959579Z", + "Date" : "Wed, 04 Sep 2019 01:45:39 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestssetmetadataqueueerror03385532b806379" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetMultipleAccessPolicies.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetMultipleAccessPolicies.json new file mode 100644 index 000000000000..76dc6a3bb547 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetMultipleAccessPolicies.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetmultipleaccesspolicies37599ee3ba068", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "a0f6594a-2a4a-4583-9352-85759c656d8f" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b181470a-6003-00c8-3fc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:42 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetmultipleaccesspolicies37599ee3ba068?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "c5b33f2c-09f7-4903-99ee-ab05e9ae075f", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b1814710-6003-00c8-42c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:42 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssetmultipleaccesspolicies37599ee3ba068?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "06dd309f-304a-4c3e-8498-c7ca5952b59b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814717-6003-00c8-48c2-62a141000000", + "Body" : "policy02000-01-01T00:00:00.0000000Z2020-01-01T00:00:00.0000000Zrpolicy12000-01-01T00:00:00.0000000Z2020-01-01T00:00:00.0000000Zrpolicy22000-01-01T00:00:00.0000000Z2020-01-01T00:00:00.0000000Zr", + "Date" : "Wed, 04 Sep 2019 01:45:42 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestssetmultipleaccesspolicies37599ee3ba068" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetTooManyAccessPolicies.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetTooManyAccessPolicies.json new file mode 100644 index 000000000000..112ec5a0e2d7 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsSetTooManyAccessPolicies.json @@ -0,0 +1,44 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssettoomanyaccesspolicies873257023734fd", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "33367482-23f1-4c13-9652-29c5f066ecf1" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814723-6003-00c8-52c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:42 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestssettoomanyaccesspolicies873257023734fd?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "c22f3933-8385-432b-ae80-fdbe9c808566", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlDocument", + "retry-after" : "0", + "Content-Length" : "294", + "StatusCode" : "400", + "x-ms-request-id" : "b181472a-6003-00c8-57c2-62a141000000", + "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:b181472a-6003-00c8-57c2-62a141000000\nTime:2019-09-04T01:45:42.9822954Z00", + "Date" : "Wed, 04 Sep 2019 01:45:42 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestssettoomanyaccesspolicies873257023734fd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsUpdateMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsUpdateMessage.json new file mode 100644 index 000000000000..2932a49e0d6a --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsUpdateMessage.json @@ -0,0 +1,106 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessage42468343e5f46491d4f", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "cfba7c67-a951-4eab-b3d5-e3a95aaebc70" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b18148ec-6003-00c8-48c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:47 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessage42468343e5f46491d4f/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "1a76a0f1-70a8-4ebc-918f-fc98674a51ed", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b18148f1-6003-00c8-4bc2-62a141000000", + "Body" : "be853347-9448-4952-9c2d-849e68a219c0Wed, 04 Sep 2019 01:45:48 GMTWed, 11 Sep 2019 01:45:48 GMTAgAAAAMAAAAAAAAA7cqQecJi1QE=Wed, 04 Sep 2019 01:45:48 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:47 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessage42468343e5f46491d4f/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "08f74a7d-5c2b-4947-8534-64fa8deb10fd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b18148f4-6003-00c8-4ec2-62a141000000", + "Body" : "be853347-9448-4952-9c2d-849e68a219c0Wed, 04 Sep 2019 01:45:48 GMTWed, 11 Sep 2019 01:45:48 GMTAgAAAAMAAAAAAAAANHh3i8Ji1QE=Wed, 04 Sep 2019 01:46:18 GMT1test message before update", + "Date" : "Wed, 04 Sep 2019 01:45:47 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessage42468343e5f46491d4f/messages/be853347-9448-4952-9c2d-849e68a219c0?popreceipt=AgAAAAMAAAAAAAAANHh3i8Ji1QE%3d&visibilitytimeout=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "91444b56-3f0c-4875-bf7a-f6cf9e48ed89", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-time-next-visible" : "Wed, 04 Sep 2019 01:45:49 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b18148f6-6003-00c8-50c2-62a141000000", + "x-ms-popreceipt" : "AwAAAAMAAAAAAAAAnGA0esJi1QEBAAAA", + "Date" : "Wed, 04 Sep 2019 01:45:47 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessage42468343e5f46491d4f/messages?peekonly=true", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "fc36f26f-0750-4b09-abe7-7f987e3d09f1" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b181498f-6003-00c8-49c2-62a141000000", + "Body" : "be853347-9448-4952-9c2d-849e68a219c0Wed, 04 Sep 2019 01:45:48 GMTWed, 11 Sep 2019 01:45:48 GMT1Updated test message", + "Date" : "Wed, 04 Sep 2019 01:45:49 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestsupdatemessage42468343e5f46491d4f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsUpdateMessageInvalidArgs0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsUpdateMessageInvalidArgs0.json new file mode 100644 index 000000000000..b7ce9af2c8b9 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsUpdateMessageInvalidArgs0.json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessageinvalidargs040828c91ab055", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "1deb0582-6d93-4dc1-94f7-cc54c2202b01" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b181499b-6003-00c8-51c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:49 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessageinvalidargs040828c91ab055/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "b3bfc299-f4f8-44f4-a455-f9bf04709c5f", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b181499e-6003-00c8-53c2-62a141000000", + "Body" : "8eeb05af-fdb2-484a-bc94-c83a1da85458Wed, 04 Sep 2019 01:45:50 GMTWed, 11 Sep 2019 01:45:50 GMTAgAAAAMAAAAAAAAAZa3nesJi1QE=Wed, 04 Sep 2019 01:45:50 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:49 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessageinvalidargs040828c91ab055/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "d40c7ce0-44c8-4732-a287-b1bb49a2c70b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b18149a2-6003-00c8-55c2-62a141000000", + "Body" : "8eeb05af-fdb2-484a-bc94-c83a1da85458Wed, 04 Sep 2019 01:45:50 GMTWed, 11 Sep 2019 01:45:50 GMTAgAAAAMAAAAAAAAAjzPOjMJi1QE=Wed, 04 Sep 2019 01:46:20 GMT1test message before update", + "Date" : "Wed, 04 Sep 2019 01:45:49 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessageinvalidargs040828c91ab055/messages/8eeb05af-fdb2-484a-bc94-c83a1da85458?popreceipt=AgAAAAMAAAAAAAAAjzPOjMJi1QE%3dRandom&visibilitytimeout=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "cf0da89d-ec63-425a-89d4-a5ff7ef1fcd8", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "444", + "StatusCode" : "400", + "x-ms-request-id" : "b18149a5-6003-00c8-58c2-62a141000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:b18149a5-6003-00c8-58c2-62a141000000\nTime:2019-09-04T01:45:50.3191503ZpopreceiptAgAAAAMAAAAAAAAAjzPOjMJi1QE=RandomInvalid pop receipt format", + "Date" : "Wed, 04 Sep 2019 01:45:49 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestsupdatemessageinvalidargs040828c91ab055" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsUpdateMessageInvalidArgs1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsUpdateMessageInvalidArgs1.json new file mode 100644 index 000000000000..02187cfaf63f --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsUpdateMessageInvalidArgs1.json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessageinvalidargs12928732951172", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "29c381e8-483b-4a32-afcb-e2e85e4a594b" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b18149b6-6003-00c8-65c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:49 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessageinvalidargs12928732951172/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "347a781f-465d-40e8-8c62-3f6f7f75aad6", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b18149ba-6003-00c8-68c2-62a141000000", + "Body" : "f5ac8cb8-f3f6-43ad-ab58-dc1b65d0a753Wed, 04 Sep 2019 01:45:50 GMTWed, 11 Sep 2019 01:45:50 GMTAgAAAAMAAAAAAAAA/1gKe8Ji1QE=Wed, 04 Sep 2019 01:45:50 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:49 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessageinvalidargs12928732951172/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "8fabab43-0a8e-4dfe-9fe2-9c2840e65497" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b18149bf-6003-00c8-6dc2-62a141000000", + "Body" : "f5ac8cb8-f3f6-43ad-ab58-dc1b65d0a753Wed, 04 Sep 2019 01:45:50 GMTWed, 11 Sep 2019 01:45:50 GMTAgAAAAMAAAAAAAAAJd/wjMJi1QE=Wed, 04 Sep 2019 01:46:20 GMT1test message before update", + "Date" : "Wed, 04 Sep 2019 01:45:49 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessageinvalidargs12928732951172/messages/f5ac8cb8-f3f6-43ad-ab58-dc1b65d0a753Random?popreceipt=AgAAAAMAAAAAAAAAJd/wjMJi1QE%3d&visibilitytimeout=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "7685597e-7627-4b3c-8984-6373d8e007b7", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "MessageNotFound", + "retry-after" : "0", + "Content-Length" : "221", + "StatusCode" : "404", + "x-ms-request-id" : "b18149c8-6003-00c8-74c2-62a141000000", + "Body" : "MessageNotFoundThe specified message does not exist.\nRequestId:b18149c8-6003-00c8-74c2-62a141000000\nTime:2019-09-04T01:45:50.5433596Z", + "Date" : "Wed, 04 Sep 2019 01:45:49 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestsupdatemessageinvalidargs12928732951172" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsUpdateMessageInvalidArgs2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsUpdateMessageInvalidArgs2.json new file mode 100644 index 000000000000..a52f4ba32ed0 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAPITestsUpdateMessageInvalidArgs2.json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessageinvalidargs204339fe34bf16", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "f6f148b7-5d8b-49a7-8749-0f54a2d1d008" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b18149d2-6003-00c8-7ec2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:50 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessageinvalidargs204339fe34bf16/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "ed136ab1-e2d3-4cc0-970b-7a6b71904f10", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b18149d5-6003-00c8-80c2-62a141000000", + "Body" : "e7a6b47d-cd4d-450e-9c61-4b7d907b5055Wed, 04 Sep 2019 01:45:50 GMTWed, 11 Sep 2019 01:45:50 GMTAgAAAAMAAAAAAAAAMlope8Ji1QE=Wed, 04 Sep 2019 01:45:50 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:50 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessageinvalidargs204339fe34bf16/messages?numofmessages=1&visibilitytimeout=30", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "6e65a679-b120-441c-b90a-463e711d117d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b18149d7-6003-00c8-02c2-62a141000000", + "Body" : "e7a6b47d-cd4d-450e-9c61-4b7d907b5055Wed, 04 Sep 2019 01:45:50 GMTWed, 11 Sep 2019 01:45:50 GMTAgAAAAMAAAAAAAAAehUTjcJi1QE=Wed, 04 Sep 2019 01:46:20 GMT1test message before update", + "Date" : "Wed, 04 Sep 2019 01:45:50 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueapitestsupdatemessageinvalidargs204339fe34bf16/messages/e7a6b47d-cd4d-450e-9c61-4b7d907b5055Random?popreceipt=AgAAAAMAAAAAAAAAehUTjcJi1QE%3dRandom&visibilitytimeout=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "e2d03755-aa32-40c4-a53f-e22e9d287f11", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "444", + "StatusCode" : "400", + "x-ms-request-id" : "b18149d8-6003-00c8-03c2-62a141000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:b18149d8-6003-00c8-03c2-62a141000000\nTime:2019-09-04T01:45:50.7665681ZpopreceiptAgAAAAMAAAAAAAAAehUTjcJi1QE=RandomInvalid pop receipt format", + "Date" : "Wed, 04 Sep 2019 01:45:50 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueapitestsupdatemessageinvalidargs204339fe34bf16" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsClearMessages.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsClearMessages.json new file mode 100644 index 000000000000..049b8302b2be --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsClearMessages.json @@ -0,0 +1,143 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsclearmessages99485c4dbfdd024f7", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "6045f58b-e936-40fe-ba8e-ecf2a0194514" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814c39-6003-00c8-6ac2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:56 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsclearmessages99485c4dbfdd024f7/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "0e91359e-000e-487b-b57d-e9de90a8d3de", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814c40-6003-00c8-6fc2-62a141000000", + "Body" : "8b827804-8842-4a26-92b9-dec2977dc38eWed, 04 Sep 2019 01:45:57 GMTWed, 11 Sep 2019 01:45:57 GMTAgAAAAMAAAAAAAAAO2w0f8Ji1QE=Wed, 04 Sep 2019 01:45:57 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:56 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsclearmessages99485c4dbfdd024f7/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "e8505a70-62cf-42ab-a91a-ff8e819e1b48", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814c43-6003-00c8-72c2-62a141000000", + "Body" : "aea4a284-5770-45ab-8216-623c8b3b55a0Wed, 04 Sep 2019 01:45:57 GMTWed, 11 Sep 2019 01:45:57 GMTAgAAAAMAAAAAAAAAa085f8Ji1QE=Wed, 04 Sep 2019 01:45:57 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:56 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsclearmessages99485c4dbfdd024f7/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "21116340-826c-4e34-b5e6-709ff9acd482", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814c47-6003-00c8-75c2-62a141000000", + "Body" : "1ea0d7e7-ea89-4852-ba6b-9ba4fa22ff20Wed, 04 Sep 2019 01:45:57 GMTWed, 11 Sep 2019 01:45:57 GMTAgAAAAMAAAAAAAAAgws+f8Ji1QE=Wed, 04 Sep 2019 01:45:57 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:56 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsclearmessages99485c4dbfdd024f7?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "2fef6b0e-ee17-4dda-bcae-c4f008cdb8e2" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "3", + "StatusCode" : "200", + "x-ms-request-id" : "b1814c4b-6003-00c8-79c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:56 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsclearmessages99485c4dbfdd024f7/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "9a255716-a8a4-410b-8d80-5dd54438b199" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b1814c4d-6003-00c8-7bc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:57 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsclearmessages99485c4dbfdd024f7?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "6b96d069-8d32-45f8-ba21-7e614ca78b02" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814c51-6003-00c8-7ec2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:57 GMT" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestsclearmessages99485c4dbfdd024f7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsClearMessagesError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsClearMessagesError.json new file mode 100644 index 000000000000..e94d7dc651ec --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsClearMessagesError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsclearmessageserror051560d2abd282/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "bec999b1-2114-46db-8896-1183c1744635" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "b1814c59-6003-00c8-06c2-62a141000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:b1814c59-6003-00c8-06c2-62a141000000\nTime:2019-09-04T01:45:57.7360723Z", + "Date" : "Wed, 04 Sep 2019 01:45:57 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestsclearmessageserror051560d2abd282" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsCreateQueueWithSharedKey.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsCreateQueueWithSharedKey.json new file mode 100644 index 000000000000..d8676e88edea --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsCreateQueueWithSharedKey.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestscreatequeuewithsharedkey828452977ba", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "d2bad14d-0d17-458c-97bd-f1f2ef5b978c" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814a7b-6003-00c8-0bc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:51 GMT" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestscreatequeuewithsharedkey828452977ba" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteExistQueue.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteExistQueue.json new file mode 100644 index 000000000000..9e23a597d1f4 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteExistQueue.json @@ -0,0 +1,40 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeleteexistqueue489191c308c357f", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "896ea173-ea0a-415c-a13c-28adadb3f877" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814a84-6003-00c8-12c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:52 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeleteexistqueue489191c308c357f", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "5c500cd7-f92d-417c-a33d-c94647f8bb15" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b1814a88-6003-00c8-15c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:52 GMT" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestsdeleteexistqueue489191c308c357f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteMessage.json new file mode 100644 index 000000000000..9d11bd44b88b --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteMessage.json @@ -0,0 +1,164 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessage41710169361dac596", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "47da3c56-9089-4b32-89c6-f0ffd845b692" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814c5e-6003-00c8-0ac2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:57 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessage41710169361dac596/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "2bbdc27d-f82b-4cd5-a36b-14e3b23fcdd9", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814c61-6003-00c8-0cc2-62a141000000", + "Body" : "9d25d652-c02b-44e7-b932-8f4b93e9e5bbWed, 04 Sep 2019 01:45:57 GMTWed, 11 Sep 2019 01:45:57 GMTAgAAAAMAAAAAAAAAFO9sf8Ji1QE=Wed, 04 Sep 2019 01:45:57 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:57 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessage41710169361dac596/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "e282898e-6fe8-499d-9787-c20679408191", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814c66-6003-00c8-11c2-62a141000000", + "Body" : "b21d485b-fda4-44cd-ba36-e79e92f53b77Wed, 04 Sep 2019 01:45:57 GMTWed, 11 Sep 2019 01:45:57 GMTAgAAAAMAAAAAAAAAo/Vzf8Ji1QE=Wed, 04 Sep 2019 01:45:57 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:57 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessage41710169361dac596/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "f753ca00-2cf1-4ef6-8827-000f8f1cc317", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814c6b-6003-00c8-14c2-62a141000000", + "Body" : "55782d80-4310-4cda-ae03-31de5163b464Wed, 04 Sep 2019 01:45:57 GMTWed, 11 Sep 2019 01:45:57 GMTAgAAAAMAAAAAAAAA09h4f8Ji1QE=Wed, 04 Sep 2019 01:45:57 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:57 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessage41710169361dac596/messages?numofmessages=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "2f5fabcb-53cb-40dd-a228-b8c64ff223d4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814c72-6003-00c8-1ac2-62a141000000", + "Body" : "9d25d652-c02b-44e7-b932-8f4b93e9e5bbWed, 04 Sep 2019 01:45:57 GMTWed, 11 Sep 2019 01:45:57 GMTAgAAAAMAAAAAAAAAbIJhkcJi1QE=Wed, 04 Sep 2019 01:46:27 GMT1test message 1", + "Date" : "Wed, 04 Sep 2019 01:45:57 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessage41710169361dac596?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "e5803ba4-d797-440c-8d46-67953921e42b" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "3", + "StatusCode" : "200", + "x-ms-request-id" : "b1814c73-6003-00c8-1bc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:57 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessage41710169361dac596/messages/9d25d652-c02b-44e7-b932-8f4b93e9e5bb?popreceipt=AgAAAAMAAAAAAAAAbIJhkcJi1QE%3d", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "2284f67a-d84a-45ec-8866-e5c1c32ef030" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b1814c78-6003-00c8-20c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:57 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessage41710169361dac596?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "6c45c371-690f-4bf8-97ba-57e5644c0100" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "2", + "StatusCode" : "200", + "x-ms-request-id" : "b1814c7c-6003-00c8-24c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:57 GMT" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestsdeletemessage41710169361dac596" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteMessageInvalidArgs0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteMessageInvalidArgs0.json new file mode 100644 index 000000000000..3526db44cac9 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteMessageInvalidArgs0.json @@ -0,0 +1,85 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessageinvalidargs03023564b50a", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "63ce004a-8c17-45ac-8b93-9825658d91ab" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814c86-6003-00c8-2dc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:57 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessageinvalidargs03023564b50a/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "dd224647-46c4-4ae8-859c-b274f6989fd1", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814c88-6003-00c8-2ec2-62a141000000", + "Body" : "000202fd-c860-4006-abc2-5e8ce2e53369Wed, 04 Sep 2019 01:45:58 GMTWed, 11 Sep 2019 01:45:58 GMTAgAAAAMAAAAAAAAAfFymf8Ji1QE=Wed, 04 Sep 2019 01:45:58 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:57 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessageinvalidargs03023564b50a/messages?numofmessages=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "11e9a5e0-ea51-4c55-b53e-aa09072f9bb4" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814c8a-6003-00c8-30c2-62a141000000", + "Body" : "000202fd-c860-4006-abc2-5e8ce2e53369Wed, 04 Sep 2019 01:45:58 GMTWed, 11 Sep 2019 01:45:58 GMTAgAAAAMAAAAAAAAAEAaPkcJi1QE=Wed, 04 Sep 2019 01:46:28 GMT1test message", + "Date" : "Wed, 04 Sep 2019 01:45:57 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessageinvalidargs03023564b50a/messages/000202fd-c860-4006-abc2-5e8ce2e53369?popreceipt=AgAAAAMAAAAAAAAAEAaPkcJi1QE%3dRandom", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "1e6e8214-fa7e-47f9-a6d0-424775417adf" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "444", + "StatusCode" : "400", + "x-ms-request-id" : "b1814c8d-6003-00c8-33c2-62a141000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:b1814c8d-6003-00c8-33c2-62a141000000\nTime:2019-09-04T01:45:58.2895891ZpopreceiptAgAAAAMAAAAAAAAAEAaPkcJi1QE=RandomInvalid pop receipt format", + "Date" : "Wed, 04 Sep 2019 01:45:57 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestsdeletemessageinvalidargs03023564b50a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteMessageInvalidArgs1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteMessageInvalidArgs1.json new file mode 100644 index 000000000000..69c1dde68d13 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteMessageInvalidArgs1.json @@ -0,0 +1,85 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessageinvalidargs1241809ccd35", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "7b0fee19-4976-4db9-ae33-50aabfd6d694" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814c96-6003-00c8-3bc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:57 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessageinvalidargs1241809ccd35/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "aa087eb1-fd7a-4f8f-945a-c108880b82f6", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814c9b-6003-00c8-3dc2-62a141000000", + "Body" : "9028b67e-28b5-436b-8571-d162e1bd0d27Wed, 04 Sep 2019 01:45:58 GMTWed, 11 Sep 2019 01:45:58 GMTAgAAAAMAAAAAAAAALi/Jf8Ji1QE=Wed, 04 Sep 2019 01:45:58 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:57 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessageinvalidargs1241809ccd35/messages?numofmessages=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "3d514711-f915-498c-b666-1fa84d164f2d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814c9e-6003-00c8-40c2-62a141000000", + "Body" : "9028b67e-28b5-436b-8571-d162e1bd0d27Wed, 04 Sep 2019 01:45:58 GMTWed, 11 Sep 2019 01:45:58 GMTAgAAAAMAAAAAAAAAkAOwkcJi1QE=Wed, 04 Sep 2019 01:46:28 GMT1test message", + "Date" : "Wed, 04 Sep 2019 01:45:57 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessageinvalidargs1241809ccd35/messages/9028b67e-28b5-436b-8571-d162e1bd0d27Random?popreceipt=AgAAAAMAAAAAAAAAkAOwkcJi1QE%3d", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "bfc6ffe7-22ee-44db-82fd-44d61149e004" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "MessageNotFound", + "retry-after" : "0", + "Content-Length" : "221", + "StatusCode" : "404", + "x-ms-request-id" : "b1814ca2-6003-00c8-42c2-62a141000000", + "Body" : "MessageNotFoundThe specified message does not exist.\nRequestId:b1814ca2-6003-00c8-42c2-62a141000000\nTime:2019-09-04T01:45:58.5047907Z", + "Date" : "Wed, 04 Sep 2019 01:45:57 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestsdeletemessageinvalidargs1241809ccd35" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteMessageInvalidArgs2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteMessageInvalidArgs2.json new file mode 100644 index 000000000000..07bbdb4fad85 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteMessageInvalidArgs2.json @@ -0,0 +1,85 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessageinvalidargs266718f033d9", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "ad52e2e8-3482-4bd6-a1c0-a37bcfe111de" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814cb6-6003-00c8-54c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:58 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessageinvalidargs266718f033d9/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "c37eb0ce-26a4-4638-9488-5e3830771eff", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814cba-6003-00c8-57c2-62a141000000", + "Body" : "42c36243-5f56-4a02-bc8a-634b2a141160Wed, 04 Sep 2019 01:45:58 GMTWed, 11 Sep 2019 01:45:58 GMTAgAAAAMAAAAAAAAAlYzrf8Ji1QE=Wed, 04 Sep 2019 01:45:58 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:58 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessageinvalidargs266718f033d9/messages?numofmessages=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "f1080e52-f3e6-4156-b078-5562461ef509" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814cbd-6003-00c8-59c2-62a141000000", + "Body" : "42c36243-5f56-4a02-bc8a-634b2a141160Wed, 04 Sep 2019 01:45:58 GMTWed, 11 Sep 2019 01:45:58 GMTAgAAAAMAAAAAAAAAyhLSkcJi1QE=Wed, 04 Sep 2019 01:46:28 GMT1test message", + "Date" : "Wed, 04 Sep 2019 01:45:58 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletemessageinvalidargs266718f033d9/messages/42c36243-5f56-4a02-bc8a-634b2a141160Random?popreceipt=AgAAAAMAAAAAAAAAyhLSkcJi1QE%3dRandom", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "e6c38d58-7a40-414f-b8c3-3c060dd681bf" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "444", + "StatusCode" : "400", + "x-ms-request-id" : "b1814cbe-6003-00c8-5ac2-62a141000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:b1814cbe-6003-00c8-5ac2-62a141000000\nTime:2019-09-04T01:45:58.7570251ZpopreceiptAgAAAAMAAAAAAAAAyhLSkcJi1QE=RandomInvalid pop receipt format", + "Date" : "Wed, 04 Sep 2019 01:45:58 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestsdeletemessageinvalidargs266718f033d9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteQueueError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteQueueError.json new file mode 100644 index 000000000000..a06468765ad6 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDeleteQueueError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdeletequeueerror428998d96f9073a", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "e6f54902-11bd-4f8b-b99d-480a4ae9781b" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "b1814a8f-6003-00c8-1ac2-62a141000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:b1814a8f-6003-00c8-1ac2-62a141000000\nTime:2019-09-04T01:45:52.7944607Z", + "Date" : "Wed, 04 Sep 2019 01:45:52 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestsdeletequeueerror428998d96f9073a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDequeueMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDequeueMessage.json new file mode 100644 index 000000000000..f874cf646cf2 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDequeueMessage.json @@ -0,0 +1,64 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdequeuemessage300371f6bfcfe363", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "1e697466-1691-4e5b-a9b9-ea08fccba3ab" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814bc6-6003-00c8-0bc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:55 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdequeuemessage300371f6bfcfe363/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "c180d560-5e85-4e6f-a11a-1cb7c2fcd3c3", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814bca-6003-00c8-0dc2-62a141000000", + "Body" : "a4d50f43-44f0-451d-add3-1e2532323773Wed, 04 Sep 2019 01:45:56 GMTWed, 11 Sep 2019 01:45:56 GMTAgAAAAMAAAAAAAAAiA6JfsJi1QE=Wed, 04 Sep 2019 01:45:56 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:55 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdequeuemessage300371f6bfcfe363/messages?numofmessages=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "388a5886-a7ba-48c2-8bae-ebbb2e113589" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814bcd-6003-00c8-10c2-62a141000000", + "Body" : "a4d50f43-44f0-451d-add3-1e2532323773Wed, 04 Sep 2019 01:45:56 GMTWed, 11 Sep 2019 01:45:56 GMTAgAAAAMAAAAAAAAAtJRvkMJi1QE=Wed, 04 Sep 2019 01:46:26 GMT1test message", + "Date" : "Wed, 04 Sep 2019 01:45:55 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestsdequeuemessage300371f6bfcfe363" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDequeueMultipleMessages.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDequeueMultipleMessages.json new file mode 100644 index 000000000000..ee811cf2dd1b --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDequeueMultipleMessages.json @@ -0,0 +1,85 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdequeuemultiplemessages799115c98522", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "72cc1593-7f4d-481f-a51d-dca204eb6171" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814bd8-6003-00c8-18c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:55 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdequeuemultiplemessages799115c98522/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "391b96f2-ec40-425a-8fce-9e1f541f07a9", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814be0-6003-00c8-1dc2-62a141000000", + "Body" : "4984a73f-2bea-4646-b9a2-ad049e2044dfWed, 04 Sep 2019 01:45:56 GMTWed, 11 Sep 2019 01:45:56 GMTAgAAAAMAAAAAAAAAmiyjfsJi1QE=Wed, 04 Sep 2019 01:45:56 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:55 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdequeuemultiplemessages799115c98522/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "2d7a6031-cd4d-4996-ae1c-3962cd2060ad", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814be1-6003-00c8-1ec2-62a141000000", + "Body" : "78438f68-8189-4ab4-8453-50f8838d0d3bWed, 04 Sep 2019 01:45:56 GMTWed, 11 Sep 2019 01:45:56 GMTAgAAAAMAAAAAAAAAreinfsJi1QE=Wed, 04 Sep 2019 01:45:56 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:55 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdequeuemultiplemessages799115c98522/messages?numofmessages=2", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "0405da1f-f827-47f4-afbe-6eff9ca6eb34" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814be3-6003-00c8-20c2-62a141000000", + "Body" : "4984a73f-2bea-4646-b9a2-ad049e2044dfWed, 04 Sep 2019 01:45:56 GMTWed, 11 Sep 2019 01:45:56 GMTAgAAAAMAAAAAAAAAD72OkMJi1QE=Wed, 04 Sep 2019 01:46:26 GMT1test message 178438f68-8189-4ab4-8453-50f8838d0d3bWed, 04 Sep 2019 01:45:56 GMTWed, 11 Sep 2019 01:45:56 GMTAgAAAAMAAAAAAAAAD72OkMJi1QE=Wed, 04 Sep 2019 01:46:26 GMT1test message 2", + "Date" : "Wed, 04 Sep 2019 01:45:55 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestsdequeuemultiplemessages799115c98522" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDequeueTooManyMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDequeueTooManyMessage.json new file mode 100644 index 000000000000..d32df7fd3a52 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsDequeueTooManyMessage.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdequeuetoomanymessage669907c96d4ca", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "afacb4dc-3dc0-4706-9e45-5e157074d458" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814be8-6003-00c8-25c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:56 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsdequeuetoomanymessage669907c96d4ca/messages?numofmessages=33", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "9c5fe48d-20a1-4e0c-82aa-cc86fdf083d9" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "456", + "StatusCode" : "400", + "x-ms-request-id" : "b1814bee-6003-00c8-29c2-62a141000000", + "Body" : "OutOfRangeQueryParameterValueOne of the query parameters specified in the request URI is outside the permissible range.\nRequestId:b1814bee-6003-00c8-29c2-62a141000000\nTime:2019-09-04T01:45:56.7141197Znumofmessages33132", + "Date" : "Wed, 04 Sep 2019 01:45:56 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestsdequeuetoomanymessage669907c96d4ca" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsEnqueueEmptyMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsEnqueueEmptyMessage.json new file mode 100644 index 000000000000..1a2ea0171c5f --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsEnqueueEmptyMessage.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsenqueueemptymessage3054488f097563", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "90797880-6473-4633-aec9-238476ec2352" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814ba1-6003-00c8-6fc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:55 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsenqueueemptymessage3054488f097563/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "7f8e6ffe-6747-40dd-92da-bb72bb788988", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814ba6-6003-00c8-72c2-62a141000000", + "Body" : "86ce0f60-1de1-4120-b8d9-b95cb1baec48Wed, 04 Sep 2019 01:45:55 GMTWed, 11 Sep 2019 01:45:55 GMTAgAAAAMAAAAAAAAAAqFPfsJi1QE=Wed, 04 Sep 2019 01:45:55 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:55 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestsenqueueemptymessage3054488f097563" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsEnqueueMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsEnqueueMessage.json new file mode 100644 index 000000000000..2d50507fec06 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsEnqueueMessage.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsenqueuemessage52048691f877f919", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "f140b4f4-31b0-4f89-a7b8-157fea76ae55" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814b99-6003-00c8-68c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:55 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsenqueuemessage52048691f877f919/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "bd65c9c5-939a-4451-a34e-e4b1576f6e04", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814b9b-6003-00c8-69c2-62a141000000", + "Body" : "0156a086-1442-4fe3-b319-b8cd292b73c8Wed, 04 Sep 2019 01:45:55 GMTWed, 11 Sep 2019 01:45:55 GMTAgAAAAMAAAAAAAAA1vA5fsJi1QE=Wed, 04 Sep 2019 01:45:55 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:55 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestsenqueuemessage52048691f877f919" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsEnqueueTimeToLive.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsEnqueueTimeToLive.json new file mode 100644 index 000000000000..24aa7ee5e3b8 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsEnqueueTimeToLive.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsenqueuetimetolive98465027476b2c9", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "84760c78-6ee6-497c-8484-7f776ce37edb" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814bb7-6003-00c8-80c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:55 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsenqueuetimetolive98465027476b2c9/messages?visibilitytimeout=0&messagettl=2", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "320a463f-5e53-4ed8-8ffd-b427df13d671", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814bbe-6003-00c8-04c2-62a141000000", + "Body" : "72b4218f-1e7a-4e70-a291-71bc5999de87Wed, 04 Sep 2019 01:45:56 GMTWed, 04 Sep 2019 01:45:58 GMTAgAAAAMAAAAAAAAARTdzfsJi1QE=Wed, 04 Sep 2019 01:45:56 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:55 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestsenqueuetimetolive98465027476b2c9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsGetAccessPolicy.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsGetAccessPolicy.json new file mode 100644 index 000000000000..274c1b708d43 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsGetAccessPolicy.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsgetaccesspolicy0470888f62453632", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "2dc100f8-e2c7-4d31-ac7c-9ddb7bf3916b" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814b4d-6003-00c8-2ec2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:54 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsgetaccesspolicy0470888f62453632?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "0d1f7b8e-83a8-43ec-8753-65e0576f85d9" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814b50-6003-00c8-2fc2-62a141000000", + "Body" : "", + "Date" : "Wed, 04 Sep 2019 01:45:54 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestsgetaccesspolicy0470888f62453632" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsGetAccessPolicyDoesError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsGetAccessPolicyDoesError.json new file mode 100644 index 000000000000..1340980e7cf6 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsGetAccessPolicyDoesError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsgetaccesspolicydoeserror19438568a43?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "a62410fa-642a-4841-829b-60e4ddef3036" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "b1814b5e-6003-00c8-3bc2-62a141000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:b1814b5e-6003-00c8-3bc2-62a141000000\nTime:2019-09-04T01:45:54.9875076Z", + "Date" : "Wed, 04 Sep 2019 01:45:54 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestsgetaccesspolicydoeserror19438568a43" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsGetProperties.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsGetProperties.json new file mode 100644 index 000000000000..c99440ccdc69 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsGetProperties.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsgetproperties245362b126d6182c6", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "2662410c-a1e5-44e4-a99a-3b3a6224c6a1" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814a9a-6003-00c8-22c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:52 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsgetproperties245362b126d6182c6?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "98a62aa5-9f1a-4a42-a61b-3b2ab0d8342b" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "x-ms-meta-metadata" : "value", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814aa1-6003-00c8-26c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:52 GMT" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestsgetproperties245362b126d6182c6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsGetPropertiesError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsGetPropertiesError.json new file mode 100644 index 000000000000..3eaa1e7166a3 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsGetPropertiesError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsgetpropertieserror64442524712ace?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "7913e078-37d7-43d6-bbb6-66e7658845d6" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "b1814aad-6003-00c8-2fc2-62a141000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:b1814aad-6003-00c8-2fc2-62a141000000\nTime:2019-09-04T01:45:53.0917384Z", + "Date" : "Wed, 04 Sep 2019 01:45:52 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestsgetpropertieserror64442524712ace" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsPeekMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsPeekMessage.json new file mode 100644 index 000000000000..3771cd845603 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsPeekMessage.json @@ -0,0 +1,64 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestspeekmessage142406f5807bb3bbe4", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "c8b8be5c-c2b7-47d0-8f24-7a4d316f0f9f" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814bf5-6003-00c8-30c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:56 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestspeekmessage142406f5807bb3bbe4/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "42abc4be-65f1-47f8-861f-70e91934c262", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814bf7-6003-00c8-31c2-62a141000000", + "Body" : "a6a5f54f-1c53-4023-8794-92e69d79889aWed, 04 Sep 2019 01:45:56 GMTWed, 11 Sep 2019 01:45:56 GMTAgAAAAMAAAAAAAAAV2zVfsJi1QE=Wed, 04 Sep 2019 01:45:56 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:56 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestspeekmessage142406f5807bb3bbe4/messages?peekonly=true", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "d3b54e32-0351-4125-95b6-cd82231de576" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814bf9-6003-00c8-33c2-62a141000000", + "Body" : "a6a5f54f-1c53-4023-8794-92e69d79889aWed, 04 Sep 2019 01:45:56 GMTWed, 11 Sep 2019 01:45:56 GMT0test message", + "Date" : "Wed, 04 Sep 2019 01:45:56 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestspeekmessage142406f5807bb3bbe4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsPeekMessagesError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsPeekMessagesError.json new file mode 100644 index 000000000000..6d343fbf37ed --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsPeekMessagesError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestspeekmessageserror4907094a6cdbc05/messages?peekonly=true", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "cc9f7c45-7ed5-4caf-8c64-0c79fdd15e06" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "b1814c33-6003-00c8-66c2-62a141000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:b1814c33-6003-00c8-66c2-62a141000000\nTime:2019-09-04T01:45:57.3607222Z", + "Date" : "Wed, 04 Sep 2019 01:45:56 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestspeekmessageserror4907094a6cdbc05" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsPeekMultipleMessages.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsPeekMultipleMessages.json new file mode 100644 index 000000000000..8450327c5901 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsPeekMultipleMessages.json @@ -0,0 +1,85 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestspeekmultiplemessages45575701ac3e0", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "8b6860d8-3587-42ee-b75d-0c402b8a9753" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814c0a-6003-00c8-42c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:56 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestspeekmultiplemessages45575701ac3e0/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "1e0a0390-d853-41e5-aa33-d9c487205c72", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814c12-6003-00c8-47c2-62a141000000", + "Body" : "810cfcd2-4235-4e62-9787-e52ca1b67d14Wed, 04 Sep 2019 01:45:57 GMTWed, 11 Sep 2019 01:45:57 GMTAgAAAAMAAAAAAAAAp4bxfsJi1QE=Wed, 04 Sep 2019 01:45:57 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:56 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestspeekmultiplemessages45575701ac3e0/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "aa118f29-e781-403b-99bc-207e4adecc26", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814c1c-6003-00c8-51c2-62a141000000", + "Body" : "b2d45076-62dc-4e4f-984d-3798f2155b7aWed, 04 Sep 2019 01:45:57 GMTWed, 11 Sep 2019 01:45:57 GMTAgAAAAMAAAAAAAAA7pD2fsJi1QE=Wed, 04 Sep 2019 01:45:57 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:56 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestspeekmultiplemessages45575701ac3e0/messages?numofmessages=2&peekonly=true", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "7cf42d8a-88eb-4e8d-b0af-da49d04e1d6b" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814c22-6003-00c8-57c2-62a141000000", + "Body" : "810cfcd2-4235-4e62-9787-e52ca1b67d14Wed, 04 Sep 2019 01:45:57 GMTWed, 11 Sep 2019 01:45:57 GMT0test message 1b2d45076-62dc-4e4f-984d-3798f2155b7aWed, 04 Sep 2019 01:45:57 GMTWed, 11 Sep 2019 01:45:57 GMT0test message 2", + "Date" : "Wed, 04 Sep 2019 01:45:56 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestspeekmultiplemessages45575701ac3e0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsPeekTooManyMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsPeekTooManyMessage.json new file mode 100644 index 000000000000..508ca03f0c0e --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsPeekTooManyMessage.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestspeektoomanymessage51569bbe452571", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "4c9ec7a8-751e-4b77-b30a-6d7a4336d2b3" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814c2b-6003-00c8-5fc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:56 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestspeektoomanymessage51569bbe452571/messages?numofmessages=33&peekonly=true", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "950cba4b-8d45-4555-9501-ed0f9cd48044" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "456", + "StatusCode" : "400", + "x-ms-request-id" : "b1814c2f-6003-00c8-62c2-62a141000000", + "Body" : "OutOfRangeQueryParameterValueOne of the query parameters specified in the request URI is outside the permissible range.\nRequestId:b1814c2f-6003-00c8-62c2-62a141000000\nTime:2019-09-04T01:45:57.2626307Znumofmessages33132", + "Date" : "Wed, 04 Sep 2019 01:45:56 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestspeektoomanymessage51569bbe452571" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAccessPolicy.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAccessPolicy.json new file mode 100644 index 000000000000..3d34cde01eb1 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAccessPolicy.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetaccesspolicy085590bcc987dcaf", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "fb88c40c-0432-4148-83d7-efc88b2c8c91" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814b66-6003-00c8-41c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:54 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetaccesspolicy085590bcc987dcaf?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "7f94500a-19d9-4e02-b51a-4097810dbda7", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b1814b6b-6003-00c8-44c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:54 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetaccesspolicy085590bcc987dcaf?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "9d7f8b2b-28b4-4fce-a0fe-4e3f507bc48e" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814b6e-6003-00c8-46c2-62a141000000", + "Body" : "testpermission2000-01-01T00:00:00.0000000Z2020-01-01T00:00:00.0000000Zraup", + "Date" : "Wed, 04 Sep 2019 01:45:54 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestssetaccesspolicy085590bcc987dcaf" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata0.json new file mode 100644 index 000000000000..939b33e12746 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata0.json @@ -0,0 +1,81 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata091316255b093f", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "9011ff55-8080-4f6c-a81e-a14cc527e063" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814ab6-6003-00c8-36c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:52 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata091316255b093f?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "19e8d2ff-9d89-4cd9-a323-c7d24a2514fa" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814abb-6003-00c8-38c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:52 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata091316255b093f?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "d8da4cba-d630-4a1c-8e52-8a2161326b25" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b1814abe-6003-00c8-3bc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:52 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata091316255b093f?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "fe576d2c-12cf-4eb7-8df7-007beb09277a" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "x-ms-meta-metadata" : "value", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814ac1-6003-00c8-3dc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:52 GMT" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestssetandclearmetadata091316255b093f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata1.json new file mode 100644 index 000000000000..f8e922f60288 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata1.json @@ -0,0 +1,82 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata190737869eaf7b", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "2604161c-fd0a-4a70-ab1a-ca7eb2dc8f85" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814ac9-6003-00c8-44c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:52 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata190737869eaf7b?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "089ee371-5093-4175-9c4b-040ddfe6d55f" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "x-ms-meta-metadata1" : "value", + "StatusCode" : "200", + "x-ms-request-id" : "b1814acc-6003-00c8-46c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:52 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata190737869eaf7b?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "fa804d13-c5b9-4fe1-abfe-36d83b5956b2" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b1814ad3-6003-00c8-4ac2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:52 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata190737869eaf7b?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "de4fb5db-d1d0-42cd-9f87-15ab8f96baf0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "x-ms-meta-metadata" : "value", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814ad6-6003-00c8-4cc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:52 GMT" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestssetandclearmetadata190737869eaf7b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata2.json new file mode 100644 index 000000000000..dade85c59dea --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata2.json @@ -0,0 +1,81 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata22823490abd1a8", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "b4a463e2-48c8-4ec8-b57d-aa2f4f4ec302" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814adb-6003-00c8-51c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:53 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata22823490abd1a8?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "b5412bbc-46c8-4977-8bdc-6eb7e0ef2049" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "x-ms-meta-metadata1" : "value", + "StatusCode" : "200", + "x-ms-request-id" : "b1814ade-6003-00c8-52c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:53 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata22823490abd1a8?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "d4554201-caae-4d93-8ef2-f5a5097ce8ab" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b1814ae1-6003-00c8-55c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:53 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata22823490abd1a8?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "8ec504ea-ff4f-4986-b114-27793edf03cd" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814ae3-6003-00c8-57c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:53 GMT" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestssetandclearmetadata22823490abd1a8" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata3.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata3.json new file mode 100644 index 000000000000..aec9ef474321 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata3.json @@ -0,0 +1,82 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata370323f5f4ace6", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "45c2438b-097c-4ae8-a096-927bf9e74a73" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814aea-6003-00c8-5dc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:53 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata370323f5f4ace6?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "35563353-2a33-4444-b982-dfbaa4fb589c" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "x-ms-meta-metadata" : "value", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814aee-6003-00c8-60c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:53 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata370323f5f4ace6?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "90104e02-b74a-4e6a-bd90-433bc4265b7d" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b1814af0-6003-00c8-62c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:53 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata370323f5f4ace6?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "17b2c232-1e90-4ac0-968f-09addbfc847b" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "x-ms-meta-metadata" : "value", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814af9-6003-00c8-68c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:53 GMT" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestssetandclearmetadata370323f5f4ace6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata4.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata4.json new file mode 100644 index 000000000000..a94df1f04d46 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetAndClearMetadata4.json @@ -0,0 +1,80 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata437843fd0e4620", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "b4d7a997-6e19-48b1-8bbe-40621040553c" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814b03-6003-00c8-72c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:53 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata437843fd0e4620?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "eb10a17b-cb1f-4116-8560-04a43f6853ee" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814b05-6003-00c8-73c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:53 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata437843fd0e4620?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "a22f47a8-95fe-4c7a-b241-f7f7fb0379c7" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b1814b07-6003-00c8-75c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:53 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetandclearmetadata437843fd0e4620?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "34e629fb-deb4-4e3c-83c8-d27c1dde59d0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "Content-Length" : "0", + "x-ms-approximate-messages-count" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814b0a-6003-00c8-77c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:53 GMT" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestssetandclearmetadata437843fd0e4620" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidAccessPolicy.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidAccessPolicy.json new file mode 100644 index 000000000000..55ac784d9154 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidAccessPolicy.json @@ -0,0 +1,44 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetinvalidaccesspolicy62411a19b0c9", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "f0062dba-ee3d-4bc4-a8ac-126d37030453" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814b72-6003-00c8-4ac2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:54 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetinvalidaccesspolicy62411a19b0c9?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "ac7f4abd-f335-4461-8f03-9376bdd4e317", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlDocument", + "retry-after" : "0", + "Content-Length" : "371", + "StatusCode" : "400", + "x-ms-request-id" : "b1814b75-6003-00c8-4cc2-62a141000000", + "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:b1814b75-6003-00c8-4cc2-62a141000000\nTime:2019-09-04T01:45:55.2897893Z1304Signed identifier ID cannot be empty or over 64 characters in length", + "Date" : "Wed, 04 Sep 2019 01:45:54 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestssetinvalidaccesspolicy62411a19b0c9" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidMeta0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidMeta0.json new file mode 100644 index 000000000000..fc093946ca5d --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidMeta0.json @@ -0,0 +1,42 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetinvalidmeta0988020102ba170aa", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "78620b68-dad6-40f5-b6c6-b2429fb2190d" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814b19-6003-00c8-03c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:53 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetinvalidmeta0988020102ba170aa?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "a6b036d8-1373-49f8-9172-f6aae32aa90e" + }, + "Response" : { + "Server" : "Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthenticationFailed", + "retry-after" : "0", + "Content-Length" : "790", + "StatusCode" : "403", + "x-ms-request-id" : "b1814b1d-6003-00c8-06c2-62a141000000", + "Body" : "AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.\nRequestId:b1814b1d-6003-00c8-06c2-62a141000000\nTime:2019-09-04T01:45:54.3549168ZThe MAC signature found in the HTTP request 'q7HqcSluPoLojFlHA5CcFq9GSIS1FUdLgphsw8xR8sE=' is not the same as any computed signature. Server used following string to sign: 'PUT\n\n\n\n\n\nWed, 04 Sep 2019 01:45:52 GMT\n\n\n\n\n\nx-ms-client-request-id:a6b036d8-1373-49f8-9172-f6aae32aa90e\nx-ms-meta-invalidmeta:value\nx-ms-version:2018-03-28\n/azstoragesdkaccount/queueaysncapitestssetinvalidmeta0988020102ba170aa\ncomp:metadata'.", + "Date" : "Wed, 04 Sep 2019 01:45:53 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestssetinvalidmeta0988020102ba170aa" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidMeta1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidMeta1.json new file mode 100644 index 000000000000..3eb5064ddf73 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidMeta1.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetinvalidmeta150757a486572bb4d", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "692ee7ba-d11a-4258-a859-40e2583db307" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814b2a-6003-00c8-11c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:53 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetinvalidmeta150757a486572bb4d?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "4fd3c113-db3c-4b40-a57b-6f08e21f887f" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidMetadata", + "retry-after" : "0", + "Content-Length" : "260", + "StatusCode" : "400", + "x-ms-request-id" : "b1814b30-6003-00c8-14c2-62a141000000", + "Body" : "InvalidMetadataThe metadata specified is invalid. It has characters that are not permitted.\nRequestId:b1814b30-6003-00c8-14c2-62a141000000\nTime:2019-09-04T01:45:54.4950499Z", + "Date" : "Wed, 04 Sep 2019 01:45:53 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestssetinvalidmeta150757a486572bb4d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidMeta2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidMeta2.json new file mode 100644 index 000000000000..af13df649916 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidMeta2.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetinvalidmeta238089e39f886db45", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "231435ab-0cc1-4693-9132-b96541fa0951" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814b37-6003-00c8-1bc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:54 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetinvalidmeta238089e39f886db45?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "ba8eb43c-feac-4fd8-966f-a2f259f59390" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidMetadata", + "retry-after" : "0", + "Content-Length" : "260", + "StatusCode" : "400", + "x-ms-request-id" : "b1814b39-6003-00c8-1cc2-62a141000000", + "Body" : "InvalidMetadataThe metadata specified is invalid. It has characters that are not permitted.\nRequestId:b1814b39-6003-00c8-1cc2-62a141000000\nTime:2019-09-04T01:45:54.6281716Z", + "Date" : "Wed, 04 Sep 2019 01:45:54 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestssetinvalidmeta238089e39f886db45" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidMeta3.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidMeta3.json new file mode 100644 index 000000000000..ba8e96a1c41d --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetInvalidMeta3.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetinvalidmeta340756d5090364637", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "d75d0aa6-d5dc-4ff0-8091-84322beb0e44" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814b41-6003-00c8-24c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:54 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetinvalidmeta340756d5090364637?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "3ee895e0-a77b-42b7-ae06-5718965dd119" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "EmptyMetadataKey", + "retry-after" : "0", + "Content-Length" : "278", + "StatusCode" : "400", + "x-ms-request-id" : "b1814b45-6003-00c8-27c2-62a141000000", + "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:b1814b45-6003-00c8-27c2-62a141000000\nTime:2019-09-04T01:45:54.7522883Zvalue", + "Date" : "Wed, 04 Sep 2019 01:45:54 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestssetinvalidmeta340756d5090364637" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetMetadataQueueError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetMetadataQueueError.json new file mode 100644 index 000000000000..fe6b798286b7 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetMetadataQueueError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetmetadataqueueerror3727729037328?comp=metadata", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "9cd511fc-ab3d-4d9a-8ae2-0ac68f88a289" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "b1814b14-6003-00c8-7fc2-62a141000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:b1814b14-6003-00c8-7fc2-62a141000000\nTime:2019-09-04T01:45:54.2588276Z", + "Date" : "Wed, 04 Sep 2019 01:45:53 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestssetmetadataqueueerror3727729037328" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetMultipleAccessPolicies.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetMultipleAccessPolicies.json new file mode 100644 index 000000000000..788d6cd202a4 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetMultipleAccessPolicies.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetmultipleaccesspolicies51269f3668c", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "e8981e0f-32e2-4bb9-9265-bd9918e4c67a" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814b7b-6003-00c8-52c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:54 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetmultipleaccesspolicies51269f3668c?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "606f96ec-0fe2-4355-9ece-595ef7785ee4", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b1814b7d-6003-00c8-53c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:54 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssetmultipleaccesspolicies51269f3668c?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "f0c0dc76-84bb-4515-a522-189bf350465d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814b86-6003-00c8-58c2-62a141000000", + "Body" : "policy02000-01-01T00:00:00.0000000Z2020-01-01T00:00:00.0000000Zrpolicy12000-01-01T00:00:00.0000000Z2020-01-01T00:00:00.0000000Zrpolicy22000-01-01T00:00:00.0000000Z2020-01-01T00:00:00.0000000Zr", + "Date" : "Wed, 04 Sep 2019 01:45:54 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestssetmultipleaccesspolicies51269f3668c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetTooManyAccessPolicies.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetTooManyAccessPolicies.json new file mode 100644 index 000000000000..97994a4d87b0 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsSetTooManyAccessPolicies.json @@ -0,0 +1,44 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssettoomanyaccesspolicies735915a574e", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "d7956dd8-66d1-40d9-b75f-5f0f09764e76" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814b8e-6003-00c8-5fc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:55 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestssettoomanyaccesspolicies735915a574e?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "0aa072fa-6e63-46f4-a5e4-bd6ffb0896ed", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidXmlDocument", + "retry-after" : "0", + "Content-Length" : "294", + "StatusCode" : "400", + "x-ms-request-id" : "b1814b93-6003-00c8-62c2-62a141000000", + "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:b1814b93-6003-00c8-62c2-62a141000000\nTime:2019-09-04T01:45:55.6761503Z00", + "Date" : "Wed, 04 Sep 2019 01:45:55 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestssettoomanyaccesspolicies735915a574e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsUpdateMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsUpdateMessage.json new file mode 100644 index 000000000000..2a793a64494e --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsUpdateMessage.json @@ -0,0 +1,106 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessage73749e68ff70c9913", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "fd385f21-5473-431f-b11d-107b9a5e1844" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814cc4-6003-00c8-60c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:58 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessage73749e68ff70c9913/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "17f4e828-3e47-497e-9d0e-423e533c9e78", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814cc9-6003-00c8-64c2-62a141000000", + "Body" : "aa039808-8e13-4573-b9b3-bc41d59788f6Wed, 04 Sep 2019 01:45:58 GMTWed, 11 Sep 2019 01:45:58 GMTAgAAAAMAAAAAAAAAKr8PgMJi1QE=Wed, 04 Sep 2019 01:45:58 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:58 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessage73749e68ff70c9913/messages?numofmessages=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "6aa16bf0-5ff5-41bc-81a2-550367449b90" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814cdc-6003-00c8-76c2-62a141000000", + "Body" : "aa039808-8e13-4573-b9b3-bc41d59788f6Wed, 04 Sep 2019 01:45:58 GMTWed, 11 Sep 2019 01:45:58 GMTAgAAAAMAAAAAAAAA37sVksJi1QE=Wed, 04 Sep 2019 01:46:29 GMT1test message before update", + "Date" : "Wed, 04 Sep 2019 01:45:58 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessage73749e68ff70c9913/messages/aa039808-8e13-4573-b9b3-bc41d59788f6?popreceipt=AgAAAAMAAAAAAAAA37sVksJi1QE%3d&visibilitytimeout=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "57615e6f-6ca6-4763-a84a-4547c9e27fca", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-time-next-visible" : "Wed, 04 Sep 2019 01:46:00 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b1814cdf-6003-00c8-79c2-62a141000000", + "x-ms-popreceipt" : "AwAAAAMAAAAAAAAA2pzWgMJi1QEBAAAA", + "Date" : "Wed, 04 Sep 2019 01:45:58 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessage73749e68ff70c9913/messages?peekonly=true", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "6b62dd00-4322-4975-834f-7271d0a5fc72" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814d6f-6003-00c8-74c2-62a141000000", + "Body" : "aa039808-8e13-4573-b9b3-bc41d59788f6Wed, 04 Sep 2019 01:45:58 GMTWed, 11 Sep 2019 01:45:58 GMT1Updated test message", + "Date" : "Wed, 04 Sep 2019 01:46:00 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestsupdatemessage73749e68ff70c9913" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsUpdateMessageInvalidArgs0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsUpdateMessageInvalidArgs0.json new file mode 100644 index 000000000000..72fcaf5bb006 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsUpdateMessageInvalidArgs0.json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessageinvalidargs066344b5c556", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "cd895cb0-669d-4501-a744-80388f0f9d6e" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814d85-6003-00c8-06c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:46:00 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessageinvalidargs066344b5c556/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "83109718-1c34-43fa-92d9-f874f594b310", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814d8c-6003-00c8-0cc2-62a141000000", + "Body" : "d0e23911-213a-4c8b-9647-26bbe18e23fcWed, 04 Sep 2019 01:46:01 GMTWed, 11 Sep 2019 01:46:01 GMTAgAAAAMAAAAAAAAAK9iIgcJi1QE=Wed, 04 Sep 2019 01:46:01 GMT", + "Date" : "Wed, 04 Sep 2019 01:46:00 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessageinvalidargs066344b5c556/messages?numofmessages=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "b263fc07-17c2-4243-8852-5a789c405e3c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814d94-6003-00c8-12c2-62a141000000", + "Body" : "d0e23911-213a-4c8b-9647-26bbe18e23fcWed, 04 Sep 2019 01:46:01 GMTWed, 11 Sep 2019 01:46:01 GMTAgAAAAMAAAAAAAAAHqVzk8Ji1QE=Wed, 04 Sep 2019 01:46:31 GMT1test message before update", + "Date" : "Wed, 04 Sep 2019 01:46:00 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessageinvalidargs066344b5c556/messages/d0e23911-213a-4c8b-9647-26bbe18e23fc?popreceipt=AgAAAAMAAAAAAAAAHqVzk8Ji1QE%3dRandom&visibilitytimeout=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "f001a705-63a7-4af6-97d0-1bd6108cdaab", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "444", + "StatusCode" : "400", + "x-ms-request-id" : "b1814d9e-6003-00c8-1cc2-62a141000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:b1814d9e-6003-00c8-1cc2-62a141000000\nTime:2019-09-04T01:46:01.4655529ZpopreceiptAgAAAAMAAAAAAAAAHqVzk8Ji1QE=RandomInvalid pop receipt format", + "Date" : "Wed, 04 Sep 2019 01:46:00 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestsupdatemessageinvalidargs066344b5c556" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsUpdateMessageInvalidArgs1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsUpdateMessageInvalidArgs1.json new file mode 100644 index 000000000000..2aaf386c0a83 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsUpdateMessageInvalidArgs1.json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessageinvalidargs153396d4db31", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "e176418b-cc06-4e85-9c72-b5f1b6ee4edc" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814da9-6003-00c8-27c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:46:00 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessageinvalidargs153396d4db31/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "41df9e7a-6710-4c2f-8d9a-51b1c3a5d318", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814db1-6003-00c8-2dc2-62a141000000", + "Body" : "ccc8eb35-f6f4-41bd-89fc-ea9fca64bd71Wed, 04 Sep 2019 01:46:01 GMTWed, 11 Sep 2019 01:46:01 GMTAgAAAAMAAAAAAAAAyYOrgcJi1QE=Wed, 04 Sep 2019 01:46:01 GMT", + "Date" : "Wed, 04 Sep 2019 01:46:01 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessageinvalidargs153396d4db31/messages?numofmessages=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "818b1c1a-4954-4090-a33d-4b251637e8fd" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814db7-6003-00c8-33c2-62a141000000", + "Body" : "ccc8eb35-f6f4-41bd-89fc-ea9fca64bd71Wed, 04 Sep 2019 01:46:01 GMTWed, 11 Sep 2019 01:46:01 GMTAgAAAAMAAAAAAAAA3eKRk8Ji1QE=Wed, 04 Sep 2019 01:46:31 GMT1test message before update", + "Date" : "Wed, 04 Sep 2019 01:46:01 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessageinvalidargs153396d4db31/messages/ccc8eb35-f6f4-41bd-89fc-ea9fca64bd71Random?popreceipt=AgAAAAMAAAAAAAAA3eKRk8Ji1QE%3d&visibilitytimeout=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "7b571c3b-d1fb-4a94-a238-3455108bd863", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "MessageNotFound", + "retry-after" : "0", + "Content-Length" : "221", + "StatusCode" : "404", + "x-ms-request-id" : "b1814dc0-6003-00c8-39c2-62a141000000", + "Body" : "MessageNotFoundThe specified message does not exist.\nRequestId:b1814dc0-6003-00c8-39c2-62a141000000\nTime:2019-09-04T01:46:01.6637379Z", + "Date" : "Wed, 04 Sep 2019 01:46:01 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestsupdatemessageinvalidargs153396d4db31" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsUpdateMessageInvalidArgs2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsUpdateMessageInvalidArgs2.json new file mode 100644 index 000000000000..95ace2d50d55 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueAysncAPITestsUpdateMessageInvalidArgs2.json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessageinvalidargs219386fb02e6", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "e9fe2534-6058-46ab-86c1-16b4a99a1772" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814dc9-6003-00c8-41c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:46:01 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessageinvalidargs219386fb02e6/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "a28bc310-cc52-457f-9d4f-d82d57c11ba4", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814dcd-6003-00c8-44c2-62a141000000", + "Body" : "b9fc0838-3bd2-468a-a0db-368d8c2bbd47Wed, 04 Sep 2019 01:46:01 GMTWed, 11 Sep 2019 01:46:01 GMTAgAAAAMAAAAAAAAAtg/KgcJi1QE=Wed, 04 Sep 2019 01:46:01 GMT", + "Date" : "Wed, 04 Sep 2019 01:46:01 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessageinvalidargs219386fb02e6/messages?numofmessages=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "ab526c52-9903-41a8-bc01-b47ff60bc216" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814dce-6003-00c8-45c2-62a141000000", + "Body" : "b9fc0838-3bd2-468a-a0db-368d8c2bbd47Wed, 04 Sep 2019 01:46:01 GMTWed, 11 Sep 2019 01:46:01 GMTAgAAAAMAAAAAAAAAwW6wk8Ji1QE=Wed, 04 Sep 2019 01:46:31 GMT1test message before update", + "Date" : "Wed, 04 Sep 2019 01:46:01 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueaysncapitestsupdatemessageinvalidargs219386fb02e6/messages/b9fc0838-3bd2-468a-a0db-368d8c2bbd47Random?popreceipt=AgAAAAMAAAAAAAAAwW6wk8Ji1QE%3dRandom&visibilitytimeout=1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "68129097-150c-4526-a2da-d87d9fa592c4", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidQueryParameterValue", + "retry-after" : "0", + "Content-Length" : "444", + "StatusCode" : "400", + "x-ms-request-id" : "b1814dcf-6003-00c8-46c2-62a141000000", + "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:b1814dcf-6003-00c8-46c2-62a141000000\nTime:2019-09-04T01:46:01.8619229ZpopreceiptAgAAAAMAAAAAAAAAwW6wk8Ji1QE=RandomInvalid pop receipt format", + "Date" : "Wed, 04 Sep 2019 01:46:01 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueaysncapitestsupdatemessageinvalidargs219386fb02e6" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParse0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParse0.json new file mode 100644 index 000000000000..263ed6c4b662 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParse0.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "queuesastestsqueuesaspermissionparse06603943f7c34c7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParse1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParse1.json new file mode 100644 index 000000000000..d1933788dd7f --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParse1.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "queuesastestsqueuesaspermissionparse1187257092966bc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParse2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParse2.json new file mode 100644 index 000000000000..2889166e36e1 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParse2.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "queuesastestsqueuesaspermissionparse2554843ebea507f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParse3.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParse3.json new file mode 100644 index 000000000000..b48544cc5e4c --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParse3.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "queuesastestsqueuesaspermissionparse380769d40194cc0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParse4.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParse4.json new file mode 100644 index 000000000000..9b11cc78184b --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParse4.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "queuesastestsqueuesaspermissionparse4569112b28d8c6e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParse5.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParse5.json new file mode 100644 index 000000000000..9c7587c0aed5 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParse5.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "queuesastestsqueuesaspermissionparse568813ba6ba5fd7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParse6.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParse6.json new file mode 100644 index 000000000000..46f4ecd1fda9 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParse6.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "queuesastestsqueuesaspermissionparse679788e49df93ac" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParse7.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParse7.json new file mode 100644 index 000000000000..60ec23219e61 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParse7.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "queuesastestsqueuesaspermissionparse745481f85d7bff7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParseIA.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParseIA.json new file mode 100644 index 000000000000..474b0b7c5f06 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionParseIA.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "queuesastestsqueuesaspermissionparseia85406cfab7f38" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionToString0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionToString0.json new file mode 100644 index 000000000000..008d4b75488b --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionToString0.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "queuesastestsqueuesaspermissiontostring01907786ea617" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionToString1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionToString1.json new file mode 100644 index 000000000000..955d59948ccb --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionToString1.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "queuesastestsqueuesaspermissiontostring1625657799adc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionToString2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionToString2.json new file mode 100644 index 000000000000..0876ace9b195 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionToString2.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "queuesastestsqueuesaspermissiontostring22471651a3373" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionToString3.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionToString3.json new file mode 100644 index 000000000000..037a03ff3f23 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionToString3.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "queuesastestsqueuesaspermissiontostring35479867a1a7f" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionToString4.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionToString4.json new file mode 100644 index 000000000000..46e70de9030a --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionToString4.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "queuesastestsqueuesaspermissiontostring41463903b5517" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionToString5.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionToString5.json new file mode 100644 index 000000000000..c7507892bdd1 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueSASPermissionToString5.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "queuesastestsqueuesaspermissiontostring5291448adfd6c" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueServiceSASSignatureValuesCanonicalizedResource.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueServiceSASSignatureValuesCanonicalizedResource.json new file mode 100644 index 000000000000..cd2957af3012 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsQueueServiceSASSignatureValuesCanonicalizedResource.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "00b1b5154e9846d78490621c427995a51bf7470efd92460db773beab0e755da1" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsTestAccountQueueServiceSASCreateQueueDeleteQueue.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsTestAccountQueueServiceSASCreateQueueDeleteQueue.json new file mode 100644 index 000000000000..e93b4b93aded --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsTestAccountQueueServiceSASCreateQueueDeleteQueue.json @@ -0,0 +1,40 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue?sv=2019-02-02&ss=q&srt=sco&se=2019-09-05T01%3A45%3A50Z&sp=rdc&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "a156a937-595c-4419-99ab-0062933e7a92" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814a66-6003-00c8-7bc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:51 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue?sv=2019-02-02&ss=q&srt=sco&se=2019-09-05T01%3A45%3A50Z&sp=rdc&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "cbfc311b-49db-4809-9c60-2da5c5b979e1" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b1814a6a-6003-00c8-7ec2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:51 GMT" + }, + "Exception" : null + } ], + "variables" : [ "86b4d8bfe3c4402ebdf8aa235673e4581b96791b017f46ce9f3c6ad613dce9bc", "2019-09-04T01:45:50.428Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsTestAccountQueueServiceSASListQueues.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsTestAccountQueueServiceSASListQueues.json new file mode 100644 index 000000000000..d23b4c3bfa30 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsTestAccountQueueServiceSASListQueues.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "queuesasteststestaccountqueueservicesaslistqueues2528689f", "2019-09-04T01:45:50.537Z" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsTestQueueSASEnqueueDequeueWithIdentifier.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsTestQueueSASEnqueueDequeueWithIdentifier.json new file mode 100644 index 000000000000..7b26400633b1 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsTestQueueSASEnqueueDequeueWithIdentifier.json @@ -0,0 +1,104 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queuesasteststestqueuesasenqueuedequeuewithidentifier72638b", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "c06431e2-2e09-42f8-964e-7655bdf88481" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814a50-6003-00c8-69c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:51 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queuesasteststestqueuesasenqueuedequeuewithidentifier72638b/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "44034516-25f3-49ce-b5d5-290c5fced2f2", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814a53-6003-00c8-6bc2-62a141000000", + "Body" : "5cc3c09d-b85c-488f-84ac-2793bc26eb4cWed, 04 Sep 2019 01:45:52 GMTWed, 11 Sep 2019 01:45:52 GMTAgAAAAMAAAAAAAAAjqkGfMJi1QE=Wed, 04 Sep 2019 01:45:52 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:51 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queuesasteststestqueuesasenqueuedequeuewithidentifier72638b?comp=acl", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "e0e91390-1507-4bb7-96b4-826515b01815", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b1814a55-6003-00c8-6dc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:51 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queuesasteststestqueuesasenqueuedequeuewithidentifier72638b/messages?sv=2019-02-02&si=8cdd2bd5-1c0d-45d4-bfec-2f0842afbc2d&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "76a3f8ed-209d-41a6-9b3a-558068442a0d", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814a57-6003-00c8-6fc2-62a141000000", + "Body" : "82221f4c-bbd9-48ca-925e-ccef8f0e77d5Wed, 04 Sep 2019 01:45:52 GMTWed, 11 Sep 2019 01:45:52 GMTAgAAAAMAAAAAAAAAjmgUfMJi1QE=Wed, 04 Sep 2019 01:45:52 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:51 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queuesasteststestqueuesasenqueuedequeuewithidentifier72638b/messages?numofmessages=2&visibilitytimeout=30&sv=2019-02-02&si=8cdd2bd5-1c0d-45d4-bfec-2f0842afbc2d&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "91624f2d-aee9-410e-a907-a6e2f7208bf0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814a5b-6003-00c8-72c2-62a141000000", + "Body" : "5cc3c09d-b85c-488f-84ac-2793bc26eb4cWed, 04 Sep 2019 01:45:52 GMTWed, 11 Sep 2019 01:45:52 GMTAgAAAAMAAAAAAAAAu+76jcJi1QE=Wed, 04 Sep 2019 01:46:22 GMT1test82221f4c-bbd9-48ca-925e-ccef8f0e77d5Wed, 04 Sep 2019 01:45:52 GMTWed, 11 Sep 2019 01:45:52 GMTAgAAAAMAAAAAAAAAu+76jcJi1QE=Wed, 04 Sep 2019 01:46:22 GMT1sastest", + "Date" : "Wed, 04 Sep 2019 01:45:51 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queuesasteststestqueuesasenqueuedequeuewithidentifier72638b", "2019-09-04T01:45:50.209Z", "2019-09-04T01:45:50.225Z", "8cdd2bd5-1c0d-45d4-bfec-2f0842afbc2d", "queue01730384" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsTestQueueSASEnqueueDequeueWithPermissions.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsTestQueueSASEnqueueDequeueWithPermissions.json new file mode 100644 index 000000000000..554cefabb3f5 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsTestQueueSASEnqueueDequeueWithPermissions.json @@ -0,0 +1,107 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queuesasteststestqueuesasenqueuedequeuewithpermissions94936", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "2e7d86b1-1319-4bdd-aaf8-43df15ba17aa" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814a0c-6003-00c8-32c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:50 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queuesasteststestqueuesasenqueuedequeuewithpermissions94936/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "b166b54f-f1c0-4964-a2f1-abbf0dcc580e", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814a11-6003-00c8-35c2-62a141000000", + "Body" : "048f133e-4fbe-4af5-9f1e-181000ebbc4fWed, 04 Sep 2019 01:45:51 GMTWed, 11 Sep 2019 01:45:51 GMTAgAAAAMAAAAAAAAABryde8Ji1QE=Wed, 04 Sep 2019 01:45:51 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:50 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queuesasteststestqueuesasenqueuedequeuewithpermissions94936/messages?sv=2019-02-02&spr=https%2Chttp&st=2019-09-03T01%3A45%3A49Z&se=2019-09-05T01%3A45%3A49Z&sip=0.0.0.0-255.255.255.255&sp=rap&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "25a8e46f-a138-4ab0-9a38-f7173b7d8891", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814a15-6003-00c8-39c2-62a141000000", + "Body" : "52a220e4-746a-4703-ab30-91bd2b684aa2Wed, 04 Sep 2019 01:45:51 GMTWed, 11 Sep 2019 01:45:51 GMTAgAAAAMAAAAAAAAAiT6se8Ji1QE=Wed, 04 Sep 2019 01:45:51 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:50 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queuesasteststestqueuesasenqueuedequeuewithpermissions94936/messages?numofmessages=2&visibilitytimeout=30&sv=2019-02-02&spr=https%2Chttp&st=2019-09-03T01%3A45%3A49Z&se=2019-09-05T01%3A45%3A49Z&sip=0.0.0.0-255.255.255.255&sp=rap&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "a233b9af-97b0-48ef-9389-c91cdcf4b9bc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814a18-6003-00c8-3cc2-62a141000000", + "Body" : "048f133e-4fbe-4af5-9f1e-181000ebbc4fWed, 04 Sep 2019 01:45:51 GMTWed, 11 Sep 2019 01:45:51 GMTAgAAAAMAAAAAAAAArMSSjcJi1QE=Wed, 04 Sep 2019 01:46:21 GMT1test52a220e4-746a-4703-ab30-91bd2b684aa2Wed, 04 Sep 2019 01:45:51 GMTWed, 11 Sep 2019 01:45:51 GMTAgAAAAMAAAAAAAAArMSSjcJi1QE=Wed, 04 Sep 2019 01:46:21 GMT1sastest", + "Date" : "Wed, 04 Sep 2019 01:45:50 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queuesasteststestqueuesasenqueuedequeuewithpermissions94936/messages/048f133e-4fbe-4af5-9f1e-181000ebbc4f?popreceipt=AgAAAAMAAAAAAAAABryde8Ji1QE%3d&visibilitytimeout=3600&sv=2019-02-02&spr=https%2Chttp&st=2019-09-03T01%3A45%3A49Z&se=2019-09-05T01%3A45%3A49Z&sip=0.0.0.0-255.255.255.255&sp=rap&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "c4eb64ff-afa8-4823-9daa-6b007c8c7d45", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthorizationPermissionMismatch", + "retry-after" : "0", + "Content-Length" : "279", + "StatusCode" : "403", + "x-ms-request-id" : "b1814a1a-6003-00c8-3ec2-62a141000000", + "Body" : "AuthorizationPermissionMismatchThis request is not authorized to perform this operation using this permission.\nRequestId:b1814a1a-6003-00c8-3ec2-62a141000000\nTime:2019-09-04T01:45:51.7454817Z", + "Date" : "Wed, 04 Sep 2019 01:45:51 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queuesasteststestqueuesasenqueuedequeuewithpermissions94936", "2019-09-04T01:45:49.522Z", "2019-09-04T01:45:49.522Z", "queue97448dd4" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsTestQueueSASUpdateDeleteWithPermissions.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsTestQueueSASUpdateDeleteWithPermissions.json new file mode 100644 index 000000000000..27cb9c8ff309 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueSASTestsTestQueueSASUpdateDeleteWithPermissions.json @@ -0,0 +1,106 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queuesasteststestqueuesasupdatedeletewithpermissions265653", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "4c776238-690d-4e37-b72d-22861fbfbb6d" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814a2b-6003-00c8-4bc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:45:51 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queuesasteststestqueuesasupdatedeletewithpermissions265653/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "1694eb7e-0439-4317-a286-14eaaca75fcb", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814a2f-6003-00c8-4ec2-62a141000000", + "Body" : "68bd5d83-0f2a-48a0-b2dd-c9ece6027c3bWed, 04 Sep 2019 01:45:51 GMTWed, 11 Sep 2019 01:45:51 GMTAgAAAAMAAAAAAAAAHrffe8Ji1QE=Wed, 04 Sep 2019 01:45:51 GMT", + "Date" : "Wed, 04 Sep 2019 01:45:51 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queuesasteststestqueuesasupdatedeletewithpermissions265653/messages/68bd5d83-0f2a-48a0-b2dd-c9ece6027c3b?popreceipt=AgAAAAMAAAAAAAAAHrffe8Ji1QE%3d&visibilitytimeout=0&sv=2019-02-02&spr=https%2Chttp&st=2019-09-03T01%3A45%3A49Z&se=2019-09-05T01%3A45%3A49Z&sip=0.0.0.0-255.255.255.255&sp=raup&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "ab315c4e-d5d5-41dd-a410-45e2eebf1912", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-time-next-visible" : "Wed, 04 Sep 2019 01:45:51 GMT", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b1814a33-6003-00c8-52c2-62a141000000", + "x-ms-popreceipt" : "AwAAAAMAAAAAAAAAg+jke8Ji1QEAAAAA", + "Date" : "Wed, 04 Sep 2019 01:45:51 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queuesasteststestqueuesasupdatedeletewithpermissions265653/messages?numofmessages=1&visibilitytimeout=30&sv=2019-02-02&spr=https%2Chttp&st=2019-09-03T01%3A45%3A49Z&se=2019-09-05T01%3A45%3A49Z&sip=0.0.0.0-255.255.255.255&sp=raup&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "06de6221-bab0-422d-b978-f9eaeb1d582d" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814a3b-6003-00c8-57c2-62a141000000", + "Body" : "68bd5d83-0f2a-48a0-b2dd-c9ece6027c3bWed, 04 Sep 2019 01:45:51 GMTWed, 11 Sep 2019 01:45:51 GMTAgAAAAMAAAAAAAAAgSDLjcJi1QE=Wed, 04 Sep 2019 01:46:21 GMT1testing", + "Date" : "Wed, 04 Sep 2019 01:45:51 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queuesasteststestqueuesasupdatedeletewithpermissions265653?sv=2019-02-02&spr=https%2Chttp&st=2019-09-03T01%3A45%3A49Z&se=2019-09-05T01%3A45%3A49Z&sip=0.0.0.0-255.255.255.255&sp=raup&sig=REDACTED", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "d822c726-da45-42d9-b8a1-48e76ddc5394" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "AuthorizationFailure", + "retry-after" : "0", + "Content-Length" : "246", + "StatusCode" : "403", + "x-ms-request-id" : "b1814a44-6003-00c8-5dc2-62a141000000", + "Body" : "AuthorizationFailureThis request is not authorized to perform this operation.\nRequestId:b1814a44-6003-00c8-5dc2-62a141000000\nTime:2019-09-04T01:45:51.9746959Z", + "Date" : "Wed, 04 Sep 2019 01:45:51 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queuesasteststestqueuesasupdatedeletewithpermissions265653", "2019-09-04T01:45:49.959Z", "2019-09-04T01:45:49.959Z", "queue9139827d" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateNull.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateNull.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateNull.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueue.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueue.json new file mode 100644 index 000000000000..aad1d17fcbd1 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueue.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestscreatequeue43039fbfe982ce6bc", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "c5ff0fd7-19b7-4c01-93e4-950840c2e92b" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814dde-6003-00c8-55c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:46:01 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestscreatequeue43039fbfe982ce6bc/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "2a682d58-489f-4cd7-87db-cd5d89629eb3", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814de4-6003-00c8-5ac2-62a141000000", + "Body" : "51601bbd-f527-4c76-97c1-6c148e9570e5Wed, 04 Sep 2019 01:46:02 GMTWed, 11 Sep 2019 01:46:02 GMTAgAAAAMAAAAAAAAAYmnugcJi1QE=Wed, 04 Sep 2019 01:46:02 GMT", + "Date" : "Wed, 04 Sep 2019 01:46:01 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueserviceapitestscreatequeue43039fbfe982ce6bc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueMaxOverload0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueMaxOverload0.json new file mode 100644 index 000000000000..602911195f94 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueMaxOverload0.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestscreatequeuemaxoverload0344619d54ab", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "59c448ac-2680-4446-9761-95be4be541c0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814e1e-6003-00c8-12c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:46:01 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestscreatequeuemaxoverload0344619d54ab/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "4dd09eb3-82bc-41cf-adfb-629493ba2595", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814e21-6003-00c8-14c2-62a141000000", + "Body" : "16e5cd47-00ff-4139-86a6-fabc2dd84bd8Wed, 04 Sep 2019 01:46:02 GMTWed, 11 Sep 2019 01:46:02 GMTAgAAAAMAAAAAAAAAW6o/gsJi1QE=Wed, 04 Sep 2019 01:46:02 GMT", + "Date" : "Wed, 04 Sep 2019 01:46:01 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueserviceapitestscreatequeuemaxoverload0344619d54ab" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueMaxOverload1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueMaxOverload1.json new file mode 100644 index 000000000000..2338d62c144e --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueMaxOverload1.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestscreatequeuemaxoverload190760f8219e", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "63c5ef75-a050-42c9-a70f-dce7360de550" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814e2e-6003-00c8-20c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:46:02 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestscreatequeuemaxoverload190760f8219e/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "81571420-f593-4caa-8728-43dd409de1c7", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814e36-6003-00c8-25c2-62a141000000", + "Body" : "a1778d52-3c00-4d27-aafe-95e5e683b106Wed, 04 Sep 2019 01:46:02 GMTWed, 11 Sep 2019 01:46:02 GMTAgAAAAMAAAAAAAAAw89VgsJi1QE=Wed, 04 Sep 2019 01:46:02 GMT", + "Date" : "Wed, 04 Sep 2019 01:46:02 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueserviceapitestscreatequeuemaxoverload190760f8219e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueMaxOverload2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueMaxOverload2.json new file mode 100644 index 000000000000..c6a1ef8a1589 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueMaxOverload2.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestscreatequeuemaxoverload27544654a18e", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "b2980d76-89d4-44b1-96b8-2b55f33130c5" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814e3c-6003-00c8-2bc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:46:02 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestscreatequeuemaxoverload27544654a18e/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "6ca6bb64-8b45-45ba-9786-20cc98bc9cf5", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814e58-6003-00c8-41c2-62a141000000", + "Body" : "16f4d740-ce57-4b98-b3f8-51fb42461ac8Wed, 04 Sep 2019 01:46:03 GMTWed, 11 Sep 2019 01:46:03 GMTAgAAAAMAAAAAAAAAk+eSgsJi1QE=Wed, 04 Sep 2019 01:46:03 GMT", + "Date" : "Wed, 04 Sep 2019 01:46:02 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueserviceapitestscreatequeuemaxoverload27544654a18e" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidMetadata.json new file mode 100644 index 000000000000..07320499205f --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidMetadata.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/6817ab6ec56647dc", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "c7a9eb9e-addb-4ef7-b49c-0e77cd0fd64f" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidMetadata", + "retry-after" : "0", + "Content-Length" : "260", + "StatusCode" : "400", + "x-ms-request-id" : "b1814e67-6003-00c8-50c2-62a141000000", + "Body" : "InvalidMetadataThe metadata specified is invalid. It has characters that are not permitted.\nRequestId:b1814e67-6003-00c8-50c2-62a141000000\nTime:2019-09-04T01:46:03.2121832Z", + "Date" : "Wed, 04 Sep 2019 01:46:02 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "6817ab6ec56647dc" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName0.json new file mode 100644 index 000000000000..9fede33d24d0 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName0.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/a_b", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "7a7fe35f-3b85-405a-a7cc-679dfaec8105" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidResourceName", + "retry-after" : "0", + "Content-Length" : "243", + "StatusCode" : "400", + "x-ms-request-id" : "b1814df1-6003-00c8-67c2-62a141000000", + "Body" : "InvalidResourceNameThe specifed resource name contains invalid characters.\nRequestId:b1814df1-6003-00c8-67c2-62a141000000\nTime:2019-09-04T01:46:02.1381807Z", + "Date" : "Wed, 04 Sep 2019 01:46:01 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName1.json new file mode 100644 index 000000000000..3bc40772f85a --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName1.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/-ab", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "06b0659a-ecb0-4f46-8a5e-cd59b1ba3bec" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidResourceName", + "retry-after" : "0", + "Content-Length" : "243", + "StatusCode" : "400", + "x-ms-request-id" : "b1814df8-6003-00c8-6ec2-62a141000000", + "Body" : "InvalidResourceNameThe specifed resource name contains invalid characters.\nRequestId:b1814df8-6003-00c8-6ec2-62a141000000\nTime:2019-09-04T01:46:02.1972360Z", + "Date" : "Wed, 04 Sep 2019 01:46:01 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName2.json new file mode 100644 index 000000000000..2b5ad4bfc39b --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName2.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/a--b", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "329ff3f6-c9ac-4f7c-8275-6e68a54250ea" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidResourceName", + "retry-after" : "0", + "Content-Length" : "243", + "StatusCode" : "400", + "x-ms-request-id" : "b1814e01-6003-00c8-77c2-62a141000000", + "Body" : "InvalidResourceNameThe specifed resource name contains invalid characters.\nRequestId:b1814e01-6003-00c8-77c2-62a141000000\nTime:2019-09-04T01:46:02.2552902Z", + "Date" : "Wed, 04 Sep 2019 01:46:01 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName3.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName3.json new file mode 100644 index 000000000000..16a2097003a6 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName3.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/Abc", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "cb32c289-0cc7-41e4-819f-b803aa8763a0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidResourceName", + "retry-after" : "0", + "Content-Length" : "243", + "StatusCode" : "400", + "x-ms-request-id" : "b1814e06-6003-00c8-7cc2-62a141000000", + "Body" : "InvalidResourceNameThe specifed resource name contains invalid characters.\nRequestId:b1814e06-6003-00c8-7cc2-62a141000000\nTime:2019-09-04T01:46:02.3163470Z", + "Date" : "Wed, 04 Sep 2019 01:46:01 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName4.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName4.json new file mode 100644 index 000000000000..5a4c2398b0e0 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName4.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/ab", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "e0f92ab6-8962-4aaa-bd50-450ddaba3e08" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "256", + "StatusCode" : "400", + "x-ms-request-id" : "b1814e0e-6003-00c8-04c2-62a141000000", + "Body" : "OutOfRangeInputThe specified resource name length is not within the permissible limits.\nRequestId:b1814e0e-6003-00c8-04c2-62a141000000\nTime:2019-09-04T01:46:02.3784049Z", + "Date" : "Wed, 04 Sep 2019 01:46:01 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName5.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName5.json new file mode 100644 index 000000000000..9db138bec9d6 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsCreateQueueWithInvalidName5.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/verylongverylongverylongverylongverylongverylongverylongverylong", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "5f47114a-caed-481d-82a6-25a3d46ac421" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "256", + "StatusCode" : "400", + "x-ms-request-id" : "b1814e15-6003-00c8-0ac2-62a141000000", + "Body" : "OutOfRangeInputThe specified resource name length is not within the permissible limits.\nRequestId:b1814e15-6003-00c8-0ac2-62a141000000\nTime:2019-09-04T01:46:02.4394616Z", + "Date" : "Wed, 04 Sep 2019 01:46:01 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsDeleteQueue.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsDeleteQueue.json new file mode 100644 index 000000000000..3207fe35d201 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsDeleteQueue.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestsdeletequeue28840f07f0f0af741", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "fa16969d-ff73-4f45-84d5-cafc4815615d" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814e6e-6003-00c8-55c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:46:02 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestsdeletequeue28840f07f0f0af741", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "f1c9b135-3a02-47e9-a4a5-c38589f40c73" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b1814e73-6003-00c8-59c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:46:02 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestsdeletequeue28840f07f0f0af741/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "766232d8-8955-4d31-afdd-7d1f5f001796", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "b1814e79-6003-00c8-5fc2-62a141000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:b1814e79-6003-00c8-5fc2-62a141000000\nTime:2019-09-04T01:46:03.3413049Z", + "Date" : "Wed, 04 Sep 2019 01:46:02 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueserviceapitestsdeletequeue28840f07f0f0af741" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsDeleteQueueError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsDeleteQueueError.json new file mode 100644 index 000000000000..58e4f305987a --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsDeleteQueueError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestsdeletequeueerror655667e38f34ee", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "82a6f780-856f-42bc-8461-e1181c0d8014" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "b1814e7f-6003-00c8-65c2-62a141000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:b1814e7f-6003-00c8-65c2-62a141000000\nTime:2019-09-04T01:46:03.4133708Z", + "Date" : "Wed, 04 Sep 2019 01:46:02 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueserviceapitestsdeletequeueerror655667e38f34ee" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsGetAndSetProperties.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsGetAndSetProperties.json new file mode 100644 index 000000000000..6b86fd59f2f0 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsGetAndSetProperties.json @@ -0,0 +1,86 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "300aaa5e-9afa-4329-aabb-696806c90856" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "7c536108-2003-0003-56c2-623371000000", + "Body" : "1.0falsetruetruetrue31.0truefalsetrue31.0truefalsetrue3", + "Date" : "Wed, 04 Sep 2019 01:46:04 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "c39e6529-9910-488d-8838-bb35c45dc6d0" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "7c53610f-2003-0003-5dc2-623371000000", + "Body" : "1.0falsetruetruetrue31.0truefalsetrue31.0truefalsetrue3", + "Date" : "Wed, 04 Sep 2019 01:46:04 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "776ba6ae-2130-4d73-92f9-b786eaa5ad4e", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "7c536114-2003-0003-62c2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:06 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "452e72d7-6788-469d-bb14-1823c23b4cd3" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "7c5361ff-2003-0003-2dc2-623371000000", + "Body" : "1.0falsetruetruetrue31.0truefalsetrue31.0truefalsetrue3", + "Date" : "Wed, 04 Sep 2019 01:46:06 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsGetQueueClient.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsGetQueueClient.json new file mode 100644 index 000000000000..f10985b9c770 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsGetQueueClient.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "queueserviceapitestsgetqueueclient4134361885b07bd" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsListEmptyQueues.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsListEmptyQueues.json new file mode 100644 index 000000000000..b8d042561ec0 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsListEmptyQueues.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=QueueServiceAPITestsListEmptyQueues&include=&comp=list", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "a37f5a1c-17f3-4896-9d55-9faf5507d85a" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "7c5360fd-2003-0003-4cc2-623371000000", + "Body" : "QueueServiceAPITestsListEmptyQueues", + "Date" : "Wed, 04 Sep 2019 01:46:04 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueserviceapitestslistemptyqueues34218ff482bae80" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsListQueues0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsListQueues0.json new file mode 100644 index 000000000000..6529ba7c4a0f --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsListQueues0.json @@ -0,0 +1,133 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues081117b52d0cdd856a0", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "1d2250af-df00-4355-b2ee-fb36c3a22f26" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814e87-6003-00c8-6dc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:46:02 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues081117b52d0cdd856a1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "07fe0261-4bf9-4c56-b28b-e92f2714ff76" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814e92-6003-00c8-76c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:46:02 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues081117b52d0cdd856a2", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "504bb851-0a33-4fbd-bee5-6b623478ba62" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814e9c-6003-00c8-7fc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:46:02 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queueserviceapitestslistqueues&include=&comp=list", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "6d365aad-dd77-4bfe-b19e-3b2dc73b7c26" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814ea2-6003-00c8-04c2-62a141000000", + "Body" : "queueserviceapitestslistqueuesqueueserviceapitestslistqueues081117b52d0cdd856a0queueserviceapitestslistqueues081117b52d0cdd856a1queueserviceapitestslistqueues081117b52d0cdd856a2", + "Date" : "Wed, 04 Sep 2019 01:46:02 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues081117b52d0cdd856a0", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "ea5e9f58-4dc2-4d11-8424-eaad7dc9b552" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b1814ea5-6003-00c8-07c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:46:03 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues081117b52d0cdd856a1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "cebb5b47-77b1-4d0a-83f9-de13efd4f3a8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b1814eab-6003-00c8-0dc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:46:03 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues081117b52d0cdd856a2", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "bff33f3b-6f85-49e8-a2c5-6b4b15639bc7" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "b1814ead-6003-00c8-0fc2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:46:03 GMT" + }, + "Exception" : null + } ], + "variables" : [ "queueserviceapitestslistqueues081117b52d0cdd856a" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsListQueues1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsListQueues1.json new file mode 100644 index 000000000000..c650246d42a5 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsListQueues1.json @@ -0,0 +1,154 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues1349634e9531abc5d00", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "3027b9ae-7a3e-4415-8418-3d0dbbaf1648" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814eb1-6003-00c8-13c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:46:03 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues1349634e9531abc5d01", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "faeb823a-e426-45da-981d-76514e52efd5" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814eb4-6003-00c8-15c2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:46:03 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues1349634e9531abc5d02", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "6d1a0efe-dfaf-45f0-b945-9c809e37b63a" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "b1814ebf-6003-00c8-1ec2-62a141000000", + "Date" : "Wed, 04 Sep 2019 01:46:03 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queueserviceapitestslistqueues&maxresults=2&include=&comp=list", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "89abf7f5-240c-4825-81d1-e1f9288df365" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814ec4-6003-00c8-22c2-62a141000000", + "Body" : "queueserviceapitestslistqueues2queueserviceapitestslistqueues1349634e9531abc5d00queueserviceapitestslistqueues1349634e9531abc5d01/azstoragesdkaccount/queueserviceapitestslistqueues1349634e9531abc5d02", + "Date" : "Wed, 04 Sep 2019 01:46:03 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queueserviceapitestslistqueues&marker=/azstoragesdkaccount/queueserviceapitestslistqueues1349634e9531abc5d02&maxresults=2&include=&comp=list", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "bf1eb06f-5fd0-48b4-ae3c-44cf0c1b7feb" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "b1814ec6-6003-00c8-24c2-62a141000000", + "Body" : "queueserviceapitestslistqueues/azstoragesdkaccount/queueserviceapitestslistqueues1349634e9531abc5d022queueserviceapitestslistqueues1349634e9531abc5d02", + "Date" : "Wed, 04 Sep 2019 01:46:03 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues1349634e9531abc5d00", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "4222c98a-129e-4cb0-8328-b873c6d17963" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "7c5360c7-2003-0003-1dc2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:03 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues1349634e9531abc5d01", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "05f46a4e-321e-4d8d-b3e2-f57d5bbb3685" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "7c5360cb-2003-0003-20c2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:03 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues1349634e9531abc5d02", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "45d260b7-a8ae-4fa2-a3bb-7bb81c328611" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "7c5360cd-2003-0003-22c2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:03 GMT" + }, + "Exception" : null + } ], + "variables" : [ "queueserviceapitestslistqueues1349634e9531abc5d0" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsListQueues2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsListQueues2.json new file mode 100644 index 000000000000..bb2650d772f0 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAPITestsListQueues2.json @@ -0,0 +1,133 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues2444460edfa0cab3f70", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "f7b74753-8148-495e-b08e-cd5c39112cc0" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7c5360d5-2003-0003-2ac2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:03 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues2444460edfa0cab3f71", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "d2d68192-2bdd-4268-8d49-3159f0db724f" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7c5360d9-2003-0003-2dc2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:04 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues2444460edfa0cab3f72", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "2f9736dc-ab14-4c25-8d23-b8fe888fcefd" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7c5360e1-2003-0003-33c2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:04 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queueserviceapitestslistqueues&include=metadata&comp=list", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "ec5b3cff-c2dd-4213-9435-c4652361d446" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "7c5360e9-2003-0003-39c2-623371000000", + "Body" : "queueserviceapitestslistqueuesqueueserviceapitestslistqueues2444460edfa0cab3f70value0queueserviceapitestslistqueues2444460edfa0cab3f71value1queueserviceapitestslistqueues2444460edfa0cab3f72value2", + "Date" : "Wed, 04 Sep 2019 01:46:04 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues2444460edfa0cab3f70", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "4c81cdac-d666-4355-a252-27a4c6f2dd3b" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "7c5360ee-2003-0003-3ec2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:04 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues2444460edfa0cab3f71", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "981813a0-a02b-43f1-8d90-be5a29288c11" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "7c5360f2-2003-0003-42c2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:04 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceapitestslistqueues2444460edfa0cab3f72", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "11ed740f-733c-435a-bc88-8ba15d840770" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "7c5360f8-2003-0003-47c2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:04 GMT" + }, + "Exception" : null + } ], + "variables" : [ "queueserviceapitestslistqueues2444460edfa0cab3f7" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateNull.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateNull.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateNull.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueue.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueue.json new file mode 100644 index 000000000000..ac14e363c595 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueue.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestscreatequeue891013fd502fec", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "2793ae89-2528-4cac-8830-ccaa6e3ef61a" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7c53620d-2003-0003-3bc2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:06 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestscreatequeue891013fd502fec/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "f8514910-46d1-4139-acda-7893f8588cdf", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7c536215-2003-0003-41c2-623371000000", + "Body" : "19aac4b5-6d43-4786-a1ec-c46ed86c6d86Wed, 04 Sep 2019 01:46:06 GMTWed, 11 Sep 2019 01:46:06 GMTAgAAAAMAAAAAAAAArhjShMJi1QE=Wed, 04 Sep 2019 01:46:06 GMT", + "Date" : "Wed, 04 Sep 2019 01:46:06 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueserviceasyncapitestscreatequeue891013fd502fec" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueMaxOverload0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueMaxOverload0.json new file mode 100644 index 000000000000..b8c1281ee9d2 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueMaxOverload0.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestscreatequeuemaxoverload006134375", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "1955b280-2186-47ff-ae9d-0f3e8b7f1c8e" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7c536264-2003-0003-06c2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:07 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestscreatequeuemaxoverload006134375/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "26870aae-eb5d-4a1d-90d4-60fa1dae9b90", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7c536269-2003-0003-0ac2-623371000000", + "Body" : "bea3b7f5-9f0b-4ddc-9f49-d1a7f1df9551Wed, 04 Sep 2019 01:46:07 GMTWed, 11 Sep 2019 01:46:07 GMTAgAAAAMAAAAAAAAAIkcthcJi1QE=Wed, 04 Sep 2019 01:46:07 GMT", + "Date" : "Wed, 04 Sep 2019 01:46:07 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueserviceasyncapitestscreatequeuemaxoverload006134375" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueMaxOverload1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueMaxOverload1.json new file mode 100644 index 000000000000..ccfa96aa9507 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueMaxOverload1.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestscreatequeuemaxoverload162375342", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "93c6d75b-d715-4e1b-ab9f-28edd6a56ed6" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7c536275-2003-0003-15c2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:07 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestscreatequeuemaxoverload162375342/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "29629f0d-1454-4abe-b99c-1e1dcacbfa40", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7c53627c-2003-0003-1bc2-623371000000", + "Body" : "84b57c36-dc08-4b9e-8642-189779c9a31eWed, 04 Sep 2019 01:46:07 GMTWed, 11 Sep 2019 01:46:07 GMTAgAAAAMAAAAAAAAAj+VBhcJi1QE=Wed, 04 Sep 2019 01:46:07 GMT", + "Date" : "Wed, 04 Sep 2019 01:46:07 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueserviceasyncapitestscreatequeuemaxoverload162375342" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueMaxOverload2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueMaxOverload2.json new file mode 100644 index 000000000000..81242064ee5d --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueMaxOverload2.json @@ -0,0 +1,43 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestscreatequeuemaxoverload243490521", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "60537ca5-1d1b-479e-815c-6dea8e7fba07" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7c53628c-2003-0003-26c2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:07 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestscreatequeuemaxoverload243490521/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "7cb45978-3516-4640-819b-cf14373ea4e8", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7c536291-2003-0003-29c2-623371000000", + "Body" : "a1b43c4e-b970-494c-adff-a0119114a694Wed, 04 Sep 2019 01:46:07 GMTWed, 11 Sep 2019 01:46:07 GMTAgAAAAMAAAAAAAAAoOdVhcJi1QE=Wed, 04 Sep 2019 01:46:07 GMT", + "Date" : "Wed, 04 Sep 2019 01:46:07 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueserviceasyncapitestscreatequeuemaxoverload243490521" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidMetadata.json new file mode 100644 index 000000000000..1fc7bb3b458a --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidMetadata.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestscreatequeuewithinvalidmetadata27365", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "2ca5978d-14e5-4359-9f14-1eb92f18801d" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidMetadata", + "retry-after" : "0", + "Content-Length" : "260", + "StatusCode" : "400", + "x-ms-request-id" : "7c5362a0-2003-0003-36c2-623371000000", + "Body" : "InvalidMetadataThe metadata specified is invalid. It has characters that are not permitted.\nRequestId:7c5362a0-2003-0003-36c2-623371000000\nTime:2019-09-04T01:46:07.8453926Z", + "Date" : "Wed, 04 Sep 2019 01:46:07 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueserviceasyncapitestscreatequeuewithinvalidmetadata27365" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName0.json new file mode 100644 index 000000000000..3f592872a8cd --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName0.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/a_b", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "a892b8a9-d23c-4a61-87de-f40490cd76a4" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidResourceName", + "retry-after" : "0", + "Content-Length" : "243", + "StatusCode" : "400", + "x-ms-request-id" : "7c53621f-2003-0003-4ac2-623371000000", + "Body" : "InvalidResourceNameThe specifed resource name contains invalid characters.\nRequestId:7c53621f-2003-0003-4ac2-623371000000\nTime:2019-09-04T01:46:06.9935862Z", + "Date" : "Wed, 04 Sep 2019 01:46:06 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName1.json new file mode 100644 index 000000000000..2ace6042c50e --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName1.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/-ab", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "787b9ff8-001b-4fa1-a005-d528273ae8eb" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidResourceName", + "retry-after" : "0", + "Content-Length" : "243", + "StatusCode" : "400", + "x-ms-request-id" : "7c536227-2003-0003-52c2-623371000000", + "Body" : "InvalidResourceNameThe specifed resource name contains invalid characters.\nRequestId:7c536227-2003-0003-52c2-623371000000\nTime:2019-09-04T01:46:07.0536422Z", + "Date" : "Wed, 04 Sep 2019 01:46:06 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName2.json new file mode 100644 index 000000000000..185ab9f82d3b --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName2.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/a--b", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "78e75656-7a42-4a73-b545-b61c4000e9ab" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidResourceName", + "retry-after" : "0", + "Content-Length" : "243", + "StatusCode" : "400", + "x-ms-request-id" : "7c536234-2003-0003-5cc2-623371000000", + "Body" : "InvalidResourceNameThe specifed resource name contains invalid characters.\nRequestId:7c536234-2003-0003-5cc2-623371000000\nTime:2019-09-04T01:46:07.1177028Z", + "Date" : "Wed, 04 Sep 2019 01:46:06 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName3.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName3.json new file mode 100644 index 000000000000..9fd689fe1cb1 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName3.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/Abc", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "f01e7261-aaab-49d8-b4d0-0fb199bfa925" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "InvalidResourceName", + "retry-after" : "0", + "Content-Length" : "243", + "StatusCode" : "400", + "x-ms-request-id" : "7c53624a-2003-0003-6dc2-623371000000", + "Body" : "InvalidResourceNameThe specifed resource name contains invalid characters.\nRequestId:7c53624a-2003-0003-6dc2-623371000000\nTime:2019-09-04T01:46:07.2308101Z", + "Date" : "Wed, 04 Sep 2019 01:46:06 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName4.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName4.json new file mode 100644 index 000000000000..f1997529a01c --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName4.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/ab", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "dc5cf379-4301-4f3f-afd1-778eb645b706" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "256", + "StatusCode" : "400", + "x-ms-request-id" : "7c53624f-2003-0003-72c2-623371000000", + "Body" : "OutOfRangeInputThe specified resource name length is not within the permissible limits.\nRequestId:7c53624f-2003-0003-72c2-623371000000\nTime:2019-09-04T01:46:07.2918677Z", + "Date" : "Wed, 04 Sep 2019 01:46:07 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName5.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName5.json new file mode 100644 index 000000000000..14e15d62f5da --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsCreateQueueWithInvalidName5.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/verylongverylongverylongverylongverylongverylongverylongverylong", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "371b4576-2a95-4780-889f-8ab5e55d9cea" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "OutOfRangeInput", + "retry-after" : "0", + "Content-Length" : "256", + "StatusCode" : "400", + "x-ms-request-id" : "7c536258-2003-0003-7bc2-623371000000", + "Body" : "OutOfRangeInputThe specified resource name length is not within the permissible limits.\nRequestId:7c536258-2003-0003-7bc2-623371000000\nTime:2019-09-04T01:46:07.3499231Z", + "Date" : "Wed, 04 Sep 2019 01:46:07 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsDeleteQueue.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsDeleteQueue.json new file mode 100644 index 000000000000..326ee1463083 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsDeleteQueue.json @@ -0,0 +1,62 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestsdeletequeue528068721350fb", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "bdcaf357-28bf-477c-89ab-7351fe62e055" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7c5362ab-2003-0003-41c2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:07 GMT" + }, + "Exception" : null + }, { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestsdeletequeue528068721350fb", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "c1b7de3e-800f-41ea-9dda-257608adc0f8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "204", + "x-ms-request-id" : "7c5362b1-2003-0003-46c2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:07 GMT" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestsdeletequeue528068721350fb/messages", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "5bdbe215-764d-4d62-8df3-c65f4bbf3e47", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "7c5362b6-2003-0003-4bc2-623371000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:7c5362b6-2003-0003-4bc2-623371000000\nTime:2019-09-04T01:46:07.9855290Z", + "Date" : "Wed, 04 Sep 2019 01:46:07 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueserviceasyncapitestsdeletequeue528068721350fb" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsDeleteQueueError.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsDeleteQueueError.json new file mode 100644 index 000000000000..bba8f9efac6f --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsDeleteQueueError.json @@ -0,0 +1,25 @@ +{ + "networkCallRecords" : [ { + "Method" : "DELETE", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/49ec9d93ca4a490b", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "636df168-fe9f-45a0-8068-e89f63e16be7" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-error-code" : "QueueNotFound", + "retry-after" : "0", + "Content-Length" : "217", + "StatusCode" : "404", + "x-ms-request-id" : "7c5362c2-2003-0003-57c2-623371000000", + "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:7c5362c2-2003-0003-57c2-623371000000\nTime:2019-09-04T01:46:08.0465841Z", + "Date" : "Wed, 04 Sep 2019 01:46:07 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "49ec9d93ca4a490b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsGetAndSetProperties.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsGetAndSetProperties.json new file mode 100644 index 000000000000..7cb0abbd34c3 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsGetAndSetProperties.json @@ -0,0 +1,65 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "32feeee9-16cb-4b7a-908a-46aa34a6d8bc" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "7c536371-2003-0003-67c2-623371000000", + "Body" : "1.0falsetruetruetrue31.0truefalsetrue31.0truefalsetrue3", + "Date" : "Wed, 04 Sep 2019 01:46:09 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "e3703f95-c618-416e-9782-8f0834ef8e2a", + "Content-Type" : "application/xml; charset=utf-8" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "202", + "x-ms-request-id" : "7c536374-2003-0003-6ac2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:09 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "3db19ec4-8572-464a-a704-450f6e73c6db" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "7c536377-2003-0003-6dc2-623371000000", + "Body" : "1.0falsetruetruetrue31.0truefalsetrue31.0truefalsetrue3", + "Date" : "Wed, 04 Sep 2019 01:46:09 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsGetQueueClient.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsGetQueueClient.json new file mode 100644 index 000000000000..d3e029265559 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsGetQueueClient.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ "queueserviceasyncapitestsgetqueueclient224981d503d96" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsListEmptyQueues.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsListEmptyQueues.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsListEmptyQueues.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsListQueues0.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsListQueues0.json new file mode 100644 index 000000000000..f0ace61853a9 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsListQueues0.json @@ -0,0 +1,79 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestslistqueues064068ffe23ab1b0", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "0c63c089-28b1-4924-86b1-07400c29ae72" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7c5362ce-2003-0003-62c2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:07 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestslistqueues064068ffe23ab1b1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "269f602a-583a-490a-93e6-364f1340cb4d" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7c5362d6-2003-0003-69c2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:07 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestslistqueues064068ffe23ab1b2", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "306b82d4-7bd2-4d43-ac67-fa124a159a87" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7c5362dd-2003-0003-6fc2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:07 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queueserviceasyncapitestslistqueues&include=&comp=list", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "707f5174-876d-4fce-bdb8-392dd52c7c80" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "7c5362e2-2003-0003-73c2-623371000000", + "Body" : "queueserviceasyncapitestslistqueuesqueueserviceasyncapitestslistqueues064068ffe23ab1b0queueserviceasyncapitestslistqueues064068ffe23ab1b1queueserviceasyncapitestslistqueues064068ffe23ab1b2", + "Date" : "Wed, 04 Sep 2019 01:46:07 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueserviceasyncapitestslistqueues064068ffe23ab1b" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsListQueues1.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsListQueues1.json new file mode 100644 index 000000000000..bdfa1b194c0b --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsListQueues1.json @@ -0,0 +1,100 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestslistqueues155227d0fced9430", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "a62a1a79-6e94-4043-8395-abd3cd41060a" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7c5362fd-2003-0003-0ac2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:08 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestslistqueues155227d0fced9431", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "9c2eb95d-3790-44d4-89c7-8d38c706d474" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7c536301-2003-0003-0dc2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:08 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestslistqueues155227d0fced9432", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "84a5be9e-e0bd-4988-ba66-6e4f1d0e361c" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7c536306-2003-0003-11c2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:08 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queueserviceasyncapitestslistqueues&maxresults=2&include=&comp=list", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "92fca1b2-2a2a-4952-a333-3755b0917d81" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "7c53630a-2003-0003-14c2-623371000000", + "Body" : "queueserviceasyncapitestslistqueues2queueserviceasyncapitestslistqueues155227d0fced9430queueserviceasyncapitestslistqueues155227d0fced9431/azstoragesdkaccount/queueserviceasyncapitestslistqueues155227d0fced9432", + "Date" : "Wed, 04 Sep 2019 01:46:08 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queueserviceasyncapitestslistqueues&marker=/azstoragesdkaccount/queueserviceasyncapitestslistqueues155227d0fced9432&maxresults=2&include=&comp=list", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "75ab15a1-17d0-4367-aaf8-de51bf48a14c" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "7c53630d-2003-0003-17c2-623371000000", + "Body" : "queueserviceasyncapitestslistqueues/azstoragesdkaccount/queueserviceasyncapitestslistqueues155227d0fced94322queueserviceasyncapitestslistqueues155227d0fced9432", + "Date" : "Wed, 04 Sep 2019 01:46:08 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueserviceasyncapitestslistqueues155227d0fced943" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsListQueues2.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsListQueues2.json new file mode 100644 index 000000000000..8ff184989573 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/QueueServiceAsyncAPITestsListQueues2.json @@ -0,0 +1,79 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestslistqueues2908015a8de5ebe0", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "22ca37dd-3783-4968-8a6b-147ba033fcf6" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7c53634a-2003-0003-49c2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:08 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestslistqueues2908015a8de5ebe1", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "02ebfcfd-bac8-4fa6-93c9-f99a113ccb9c" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7c53634f-2003-0003-4dc2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:08 GMT" + }, + "Exception" : null + }, { + "Method" : "PUT", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queueserviceasyncapitestslistqueues2908015a8de5ebe2", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "588f9efc-a092-433d-b41f-e2b3b9f8bc8f" + }, + "Response" : { + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "retry-after" : "0", + "Content-Length" : "0", + "StatusCode" : "201", + "x-ms-request-id" : "7c536352-2003-0003-4fc2-623371000000", + "Date" : "Wed, 04 Sep 2019 01:46:08 GMT" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queueserviceasyncapitestslistqueues&include=metadata&comp=list", + "Headers" : { + "x-ms-version" : "2018-03-28", + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.3 1.8.0_222; Windows 10 10.0", + "x-ms-client-request-id" : "7c28fd9f-8339-40b0-a22b-8bcbaf6c8f48" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "x-ms-version" : "2018-03-28", + "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "Cache-Control" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "x-ms-request-id" : "7c536358-2003-0003-53c2-623371000000", + "Body" : "queueserviceasyncapitestslistqueuesqueueserviceasyncapitestslistqueues2908015a8de5ebe0value0queueserviceasyncapitestslistqueues2908015a8de5ebe1value1queueserviceasyncapitestslistqueues2908015a8de5ebe2value2", + "Date" : "Wed, 04 Sep 2019 01:46:08 GMT", + "Content-Type" : "application/xml" + }, + "Exception" : null + } ], + "variables" : [ "queueserviceasyncapitestslistqueues2908015a8de5ebe" ] +} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/clearMessages.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/clearMessages.json deleted file mode 100644 index cebb31166bc9..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/clearMessages.json +++ /dev/null @@ -1,161 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue78895e13", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d18f-4003-00b9-5e03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue78895e13/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d1bb-4003-00b9-0603-47d378000000", - "Body" : "1a1dabd1-b690-42c7-a22a-665c69ceffccTue, 30 Jul 2019 18:19:02 GMTTue, 06 Aug 2019 18:19:02 GMTAgAAAAMAAAAAAAAAi1HbQwNH1QE=Tue, 30 Jul 2019 18:19:02 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue78895e13/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d1dd-4003-00b9-2503-47d378000000", - "Body" : "c10ecce0-b3b6-4098-96ae-8aa611501ffbTue, 30 Jul 2019 18:19:02 GMTTue, 06 Aug 2019 18:19:02 GMTAgAAAAMAAAAAAAAAVabiQwNH1QE=Tue, 30 Jul 2019 18:19:02 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue78895e13/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d201-4003-00b9-4603-47d378000000", - "Body" : "962a6b38-e375-4fae-a052-8d25207ff09bTue, 30 Jul 2019 18:19:02 GMTTue, 06 Aug 2019 18:19:02 GMTAgAAAAMAAAAAAAAAv9fnQwNH1QE=Tue, 30 Jul 2019 18:19:02 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue78895e13?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "Content-Length" : "0", - "x-ms-approximate-messages-count" : "3", - "StatusCode" : "200", - "x-ms-request-id" : "8071d225-4003-00b9-6903-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue78895e13/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d23d-4003-00b9-8003-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue78895e13?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "Content-Length" : "0", - "x-ms-approximate-messages-count" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "8071d257-4003-00b9-1703-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue78895e13/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d26d-4003-00b9-2d03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue78895e13", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d283-4003-00b9-4303-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - } ], - "variables" : [ "queue78895e13" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/clearMessagesQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/clearMessagesQueueDoesNotExist.json deleted file mode 100644 index d5ff4fab7281..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/clearMessagesQueueDoesNotExist.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue95540dc6/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "8071dd7c-4003-00b9-4f03-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:8071dd7c-4003-00b9-4f03-47d378000000\nTime:2019-07-30T18:19:06.4682531Z", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue95540dc6/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "8071dd94-4003-00b9-6603-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:8071dd94-4003-00b9-6603-47d378000000\nTime:2019-07-30T18:19:06.4982809Z", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue95540dc6" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueue.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueue.json deleted file mode 100644 index 6ace1ebfcc3d..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueue.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue41192d54", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd818b-e003-0073-5309-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:02 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue41192d54/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd818f-e003-0073-5609-4740b5000000", - "Body" : "0f84abde-fb8c-4049-b6de-4e353f4af767Tue, 30 Jul 2019 19:01:03 GMTTue, 06 Aug 2019 19:01:03 GMTAgAAAAMAAAAAAAAAnQ1cIglH1QE=Tue, 30 Jul 2019 19:01:03 GMT", - "Date" : "Tue, 30 Jul 2019 19:01:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue41192d54&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd8195-e003-0073-5b09-4740b5000000", - "Body" : "queue41192d54queue41192d54", - "Date" : "Tue, 30 Jul 2019 19:01:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue41192d54/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd8199-e003-0073-5f09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:03 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue41192d54", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd81bb-e003-0073-7c09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:03 GMT" - } - } ], - "variables" : [ "queue41192d54" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueTwiceDifferentMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueTwiceDifferentMetadata.json deleted file mode 100644 index 104f97276190..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueTwiceDifferentMetadata.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue88691a05", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd82fd-e003-0073-1609-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue88691a05", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueAlreadyExists", - "retry-after" : "0", - "Content-Length" : "222", - "StatusCode" : "409", - "x-ms-request-id" : "1cdd8301-e003-0073-1909-4740b5000000", - "Body" : "QueueAlreadyExistsThe specified queue already exists.\nRequestId:1cdd8301-e003-0073-1909-4740b5000000\nTime:2019-07-30T19:01:07.1007793Z", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue88691a05&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd830a-e003-0073-2009-4740b5000000", - "Body" : "queue88691a05queue88691a05", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue88691a05/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd830e-e003-0073-2409-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue88691a05", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd8317-e003-0073-2d09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - } ], - "variables" : [ "queue88691a05" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueTwiceSameMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueTwiceSameMetadata.json deleted file mode 100644 index cc245715abd6..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueTwiceSameMetadata.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue74324182", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd82b9-e003-0073-5c09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue74324182/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd82bd-e003-0073-5f09-4740b5000000", - "Body" : "a1a192f0-d5b6-4a03-8365-eafbc589b4b0Tue, 30 Jul 2019 19:01:06 GMTTue, 06 Aug 2019 19:01:06 GMTAgAAAAMAAAAAAAAAW6ZEJAlH1QE=Tue, 30 Jul 2019 19:01:06 GMT", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue74324182", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd82c6-e003-0073-6609-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue74324182/messages?peekonly=true", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd82cc-e003-0073-6c09-4740b5000000", - "Body" : "a1a192f0-d5b6-4a03-8365-eafbc589b4b0Tue, 30 Jul 2019 19:01:06 GMTTue, 06 Aug 2019 19:01:06 GMT0Testing service client creating the same queue twice does not modify the queue", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue74324182&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd82d9-e003-0073-7909-4740b5000000", - "Body" : "queue74324182queue74324182", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue74324182/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd82e0-e003-0073-7f09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue74324182", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd82e9-e003-0073-0709-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - } ], - "variables" : [ "queue74324182" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueWithMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueWithMetadata.json deleted file mode 100644 index a884a0d89d21..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueWithMetadata.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue84974cab", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd81fa-e003-0073-3209-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:04 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue84974cab?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "Content-Length" : "0", - "x-ms-approximate-messages-count" : "0", - "x-ms-meta-metadata1" : "value1", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd824c-e003-0073-7709-4740b5000000", - "x-ms-meta-metadata2" : "value2", - "Date" : "Tue, 30 Jul 2019 19:01:04 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue84974cab&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd8258-e003-0073-0209-4740b5000000", - "Body" : "queue84974cabqueue84974cab", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue84974cab/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd8260-e003-0073-0a09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue84974cab", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd8267-e003-0073-1109-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - } ], - "variables" : [ "queue84974cab" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createTwiceDifferentMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createTwiceDifferentMetadata.json deleted file mode 100644 index 70bd9c8373e7..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createTwiceDifferentMetadata.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60199648", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "807246c6-4003-00b9-5d03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60199648", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueAlreadyExists", - "retry-after" : "0", - "Content-Length" : "222", - "StatusCode" : "409", - "x-ms-request-id" : "807246f2-4003-00b9-0403-47d378000000", - "Body" : "QueueAlreadyExistsThe specified queue already exists.\nRequestId:807246f2-4003-00b9-0403-47d378000000\nTime:2019-07-30T18:19:37.7522623Z", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60199648/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724708-4003-00b9-1a03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60199648", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724714-4003-00b9-2503-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - } ], - "variables" : [ "queue60199648" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createTwiceSameMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createTwiceSameMetadata.json deleted file mode 100644 index 49af0912970a..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createTwiceSameMetadata.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue8880966a", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8072446f-4003-00b9-1303-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:36 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue8880966a", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724495-4003-00b9-3803-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:36 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue8880966a/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "807244ad-4003-00b9-5003-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:36 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue8880966a", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "807244ca-4003-00b9-6d03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - } ], - "variables" : [ "queue8880966a" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithMetadata.json deleted file mode 100644 index de90dd17f28c..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithMetadata.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue23765c5d", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071dcea-4003-00b9-4003-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue23765c5d?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "Content-Length" : "0", - "x-ms-approximate-messages-count" : "0", - "x-ms-meta-metadata1" : "value1", - "StatusCode" : "200", - "x-ms-request-id" : "8071dd11-4003-00b9-6603-47d378000000", - "x-ms-meta-metadata2" : "value2", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue23765c5d/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071dd3b-4003-00b9-0f03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue23765c5d", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071dd54-4003-00b9-2703-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" - } - } ], - "variables" : [ "queue23765c5d" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithSASToken.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithSASToken.json deleted file mode 100644 index 06af19821b53..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithSASToken.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue95805f24/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "8071d154-4003-00b9-2803-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:8071d154-4003-00b9-2803-47d378000000\nTime:2019-07-30T18:19:02.4945662Z", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue95805f24" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithSharedKey.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithSharedKey.json deleted file mode 100644 index f7db9ce0ce35..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithSharedKey.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue07130666/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "807249d1-4003-00b9-4903-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:807249d1-4003-00b9-4903-47d378000000\nTime:2019-07-30T18:19:38.6260705Z", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue07130666" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteExisting.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteExisting.json deleted file mode 100644 index 326bd01d83b8..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteExisting.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue11519005", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071de75-4003-00b9-4103-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue11519005/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071dea3-4003-00b9-6e03-47d378000000", - "Body" : "30cc479a-af92-4451-8a41-8413a8f9c095Tue, 30 Jul 2019 18:19:06 GMTTue, 06 Aug 2019 18:19:06 GMTAgAAAAMAAAAAAAAAFWldRgNH1QE=Tue, 30 Jul 2019 18:19:06 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue11519005", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071debe-4003-00b9-0903-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue11519005/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "80724410-4003-00b9-3903-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:80724410-4003-00b9-3903-47d378000000\nTime:2019-07-30T18:19:36.9024744Z", - "Date" : "Tue, 30 Jul 2019 18:19:36 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue11519005/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "80724439-4003-00b9-6003-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:80724439-4003-00b9-6003-47d378000000\nTime:2019-07-30T18:19:36.9335030Z", - "Date" : "Tue, 30 Jul 2019 18:19:36 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue11519005" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteExistingQueue.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteExistingQueue.json deleted file mode 100644 index d711d370bf2b..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteExistingQueue.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue520260d0", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd8083-e003-0073-6a09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:01 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue520260d0", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd8163-e003-0073-3009-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:02 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue520260d0/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "1cdd8174-e003-0073-4009-4740b5000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:1cdd8174-e003-0073-4009-4740b5000000\nTime:2019-07-30T19:01:03.1630238Z", - "Date" : "Tue, 30 Jul 2019 19:01:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue520260d0&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd817e-e003-0073-4809-4740b5000000", - "Body" : "queue520260d0", - "Date" : "Tue, 30 Jul 2019 19:01:02 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue520260d0" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessage.json deleted file mode 100644 index f3bcf1a4fbf6..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessage.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60865355", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "807248e4-4003-00b9-6403-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60865355/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "80724919-4003-00b9-1703-47d378000000", - "Body" : "70decbfa-af3b-453f-b291-f78c97eb512dTue, 30 Jul 2019 18:19:38 GMTTue, 06 Aug 2019 18:19:38 GMTAgAAAAMAAAAAAAAA9GMvWQNH1QE=Tue, 30 Jul 2019 18:19:38 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60865355/messages?numofmessages=1&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "80724936-4003-00b9-3103-47d378000000", - "Body" : "70decbfa-af3b-453f-b291-f78c97eb512dTue, 30 Jul 2019 18:19:38 GMTTue, 06 Aug 2019 18:19:38 GMTAgAAAAMAAAAAAAAA8psVawNH1QE=Tue, 30 Jul 2019 18:20:08 GMT1test message", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60865355/messages/70decbfa-af3b-453f-b291-f78c97eb512d?popreceipt=AgAAAAMAAAAAAAAA8psVawNH1QE%3d", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724958-4003-00b9-5103-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60865355?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "Content-Length" : "0", - "x-ms-approximate-messages-count" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "80724972-4003-00b9-6a03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60865355/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724985-4003-00b9-7d03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60865355", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8072499e-4003-00b9-1603-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - } ], - "variables" : [ "queue60865355" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessageInvalidMessageId.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessageInvalidMessageId.json deleted file mode 100644 index 02698922bb52..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessageInvalidMessageId.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue5582925f", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071bd76-4003-00b9-5603-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue5582925f/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071bda8-4003-00b9-0603-47d378000000", - "Body" : "6c6a6f5b-e93c-4712-a9e6-9d882ef2725dTue, 30 Jul 2019 18:18:56 GMTTue, 06 Aug 2019 18:18:56 GMTAgAAAAMAAAAAAAAAJ00nQANH1QE=Tue, 30 Jul 2019 18:18:56 GMT", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue5582925f/messages?numofmessages=1&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "8071bdd6-4003-00b9-3403-47d378000000", - "Body" : "6c6a6f5b-e93c-4712-a9e6-9d882ef2725dTue, 30 Jul 2019 18:18:56 GMTTue, 06 Aug 2019 18:18:56 GMTAgAAAAMAAAAAAAAAb4EPUgNH1QE=Tue, 30 Jul 2019 18:19:26 GMT1test message", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue5582925f/messages/6c6a6f5b-e93c-4712-a9e6-9d882ef2725drandom?popreceipt=AgAAAAMAAAAAAAAAb4EPUgNH1QE%3d", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "MessageNotFound", - "retry-after" : "0", - "Content-Length" : "221", - "StatusCode" : "404", - "x-ms-request-id" : "8071be01-4003-00b9-5f03-47d378000000", - "Body" : "MessageNotFoundThe specified message does not exist.\nRequestId:8071be01-4003-00b9-5f03-47d378000000\nTime:2019-07-30T18:18:56.4930009Z", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue5582925f/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071be28-4003-00b9-0603-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue5582925f", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071be47-4003-00b9-2403-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT" - } - } ], - "variables" : [ "queue5582925f" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessageInvalidPopReceipt.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessageInvalidPopReceipt.json deleted file mode 100644 index 875c4a238ffb..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessageInvalidPopReceipt.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue76680d09", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071bc63-4003-00b9-4d03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue76680d09/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071bc9c-4003-00b9-0403-47d378000000", - "Body" : "9a59b835-0fa6-4bcb-8094-61e61a4120c2Tue, 30 Jul 2019 18:18:56 GMTTue, 06 Aug 2019 18:18:56 GMTAgAAAAMAAAAAAAAAGXD/PwNH1QE=Tue, 30 Jul 2019 18:18:56 GMT", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue76680d09/messages?numofmessages=1&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "8071bcc5-4003-00b9-2b03-47d378000000", - "Body" : "9a59b835-0fa6-4bcb-8094-61e61a4120c2Tue, 30 Jul 2019 18:18:56 GMTTue, 06 Aug 2019 18:18:56 GMTAgAAAAMAAAAAAAAAb6TnUQNH1QE=Tue, 30 Jul 2019 18:19:26 GMT1test message", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue76680d09/messages/9a59b835-0fa6-4bcb-8094-61e61a4120c2?popreceipt=AgAAAAMAAAAAAAAAb6TnUQNH1QE%3drandom", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidQueryParameterValue", - "retry-after" : "0", - "Content-Length" : "444", - "StatusCode" : "400", - "x-ms-request-id" : "8071bcf4-4003-00b9-5803-47d378000000", - "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:8071bcf4-4003-00b9-5803-47d378000000\nTime:2019-07-30T18:18:56.2297573ZpopreceiptAgAAAAMAAAAAAAAAb6TnUQNH1QE=randomInvalid pop receipt format", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue76680d09/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071bd1d-4003-00b9-7e03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue76680d09", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071bd3c-4003-00b9-1c03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT" - } - } ], - "variables" : [ "queue76680d09" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessageQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessageQueueDoesNotExist.json deleted file mode 100644 index 287a17ccf8f1..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessageQueueDoesNotExist.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue5543243d/messages/invalid?popreceipt=call", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "80724c3c-4003-00b9-2003-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:80724c3c-4003-00b9-2003-47d378000000\nTime:2019-07-30T18:19:39.3217165Z", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue5543243d/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "80724c62-4003-00b9-4503-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:80724c62-4003-00b9-4503-47d378000000\nTime:2019-07-30T18:19:39.3547455Z", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue5543243d" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMetadata.json deleted file mode 100644 index 705c7722d081..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMetadata.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue743794d9", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "80724d57-4003-00b9-3403-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue743794d9?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "Content-Length" : "0", - "x-ms-approximate-messages-count" : "0", - "x-ms-meta-metadata1" : "value1", - "StatusCode" : "200", - "x-ms-request-id" : "80724d80-4003-00b9-5a03-47d378000000", - "x-ms-meta-metadata2" : "value2", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue743794d9?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724d98-4003-00b9-7203-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue743794d9?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "Content-Length" : "0", - "x-ms-approximate-messages-count" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "80724db1-4003-00b9-0b03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue743794d9/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724dd4-4003-00b9-2d03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue743794d9", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724dec-4003-00b9-4503-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - } ], - "variables" : [ "queue743794d9" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteNonExistent.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteNonExistent.json deleted file mode 100644 index 525cc82bc6b9..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteNonExistent.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue784292a2", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "80724806-4003-00b9-0b03-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:80724806-4003-00b9-0b03-47d378000000\nTime:2019-07-30T18:19:38.1306132Z", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue784292a2/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "80724826-4003-00b9-2a03-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:80724826-4003-00b9-2a03-47d378000000\nTime:2019-07-30T18:19:38.1606401Z", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue784292a2" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteNonExistentQueue.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteNonExistentQueue.json deleted file mode 100644 index 2e67336c2204..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteNonExistentQueue.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue5883546e", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "1cdd8355-e003-0073-6209-4740b5000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:1cdd8355-e003-0073-6209-4740b5000000\nTime:2019-07-30T19:01:07.7774261Z", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue5883546e&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd8359-e003-0073-6609-4740b5000000", - "Body" : "queue5883546e", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue5883546e" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueMessage.json deleted file mode 100644 index 235330aad38c..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueMessage.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue854564d6", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071bb3b-4003-00b9-2f03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:18:55 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue854564d6/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071bb62-4003-00b9-5403-47d378000000", - "Body" : "e019e0ee-2a4a-4a02-ba68-ecd484c51b2cTue, 30 Jul 2019 18:18:55 GMTTue, 06 Aug 2019 18:18:55 GMTAgAAAAMAAAAAAAAAszfJPwNH1QE=Tue, 30 Jul 2019 18:18:55 GMT", - "Date" : "Tue, 30 Jul 2019 18:18:55 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue854564d6/messages?numofmessages=1&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "8071bb7d-4003-00b9-6e03-47d378000000", - "Body" : "e019e0ee-2a4a-4a02-ba68-ecd484c51b2cTue, 30 Jul 2019 18:18:55 GMTTue, 06 Aug 2019 18:18:55 GMTAgAAAAMAAAAAAAAAGAywUQNH1QE=Tue, 30 Jul 2019 18:19:25 GMT1test message", - "Date" : "Tue, 30 Jul 2019 18:18:55 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue854564d6/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071bb94-4003-00b9-0403-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:18:55 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue854564d6", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071bbb2-4003-00b9-2103-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:18:55 GMT" - } - } ], - "variables" : [ "queue854564d6" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueMultipleMessages.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueMultipleMessages.json deleted file mode 100644 index aacfeda6c1d6..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueMultipleMessages.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue41164c5f", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "80724a13-4003-00b9-0803-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue41164c5f/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "80724a33-4003-00b9-2703-47d378000000", - "Body" : "be3d48d4-b018-40ad-85a7-d426fb4d785fTue, 30 Jul 2019 18:19:38 GMTTue, 06 Aug 2019 18:19:38 GMTAgAAAAMAAAAAAAAAA2tgWQNH1QE=Tue, 30 Jul 2019 18:19:38 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue41164c5f/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "80724a57-4003-00b9-4a03-47d378000000", - "Body" : "f39387d0-8ac4-4739-80a3-a1e1f8d118dfTue, 30 Jul 2019 18:19:38 GMTTue, 06 Aug 2019 18:19:38 GMTAgAAAAMAAAAAAAAANU5lWQNH1QE=Tue, 30 Jul 2019 18:19:38 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue41164c5f/messages?numofmessages=2&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "80724a74-4003-00b9-6603-47d378000000", - "Body" : "be3d48d4-b018-40ad-85a7-d426fb4d785fTue, 30 Jul 2019 18:19:38 GMTTue, 06 Aug 2019 18:19:38 GMTAgAAAAMAAAAAAAAAeftLawNH1QE=Tue, 30 Jul 2019 18:20:08 GMT1test messagef39387d0-8ac4-4739-80a3-a1e1f8d118dfTue, 30 Jul 2019 18:19:38 GMTTue, 06 Aug 2019 18:19:38 GMTAgAAAAMAAAAAAAAAeftLawNH1QE=Tue, 30 Jul 2019 18:20:08 GMT1test message 2", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue41164c5f/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724a8f-4003-00b9-7e03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue41164c5f", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724aa5-4003-00b9-1403-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - } ], - "variables" : [ "queue41164c5f" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueQueueDoesNotExist.json deleted file mode 100644 index c92f5ac1b9fb..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueQueueDoesNotExist.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue03640269/messages?numofmessages=1&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "807247b8-4003-00b9-4003-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:807247b8-4003-00b9-4003-47d378000000\nTime:2019-07-30T18:19:38.0495370Z", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue03640269/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "807247d2-4003-00b9-5803-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:807247d2-4003-00b9-5803-47d378000000\nTime:2019-07-30T18:19:38.0825673Z", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue03640269" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueTooManyMessages.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueTooManyMessages.json deleted file mode 100644 index c1216be98ccd..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueTooManyMessages.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue33803725", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071cf82-4003-00b9-6203-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:01 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue33803725/messages?numofmessages=64&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "OutOfRangeQueryParameterValue", - "retry-after" : "0", - "Content-Length" : "456", - "StatusCode" : "400", - "x-ms-request-id" : "8071cfa7-4003-00b9-0503-47d378000000", - "Body" : "OutOfRangeQueryParameterValueOne of the query parameters specified in the request URI is outside the permissible range.\nRequestId:8071cfa7-4003-00b9-0503-47d378000000\nTime:2019-07-30T18:19:01.9911001Znumofmessages64132", - "Date" : "Tue, 30 Jul 2019 18:19:01 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue33803725/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071cfc0-4003-00b9-1d03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:01 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue33803725", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071cfe1-4003-00b9-3d03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - } ], - "variables" : [ "queue33803725" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueEmptyMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueEmptyMessage.json deleted file mode 100644 index 015e74ada642..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueEmptyMessage.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue85000300", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "80724adb-4003-00b9-4903-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue85000300/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "80724b04-4003-00b9-7103-47d378000000", - "Body" : "f1339f74-d98e-4e9c-bfb7-b53cda993323Tue, 30 Jul 2019 18:19:38 GMTTue, 06 Aug 2019 18:19:38 GMTAgAAAAMAAAAAAAAApySGWQNH1QE=Tue, 30 Jul 2019 18:19:38 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue85000300/messages?peekonly=true", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "80724b26-4003-00b9-1303-47d378000000", - "Body" : "f1339f74-d98e-4e9c-bfb7-b53cda993323Tue, 30 Jul 2019 18:19:38 GMTTue, 06 Aug 2019 18:19:38 GMT0", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue85000300/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724b3f-4003-00b9-2c03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue85000300", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724b51-4003-00b9-3e03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - } ], - "variables" : [ "queue85000300" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueMessage.json deleted file mode 100644 index 4be6f36d26c0..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueMessage.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue857326bc", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d362-4003-00b9-1a03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue857326bc/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d37c-4003-00b9-3203-47d378000000", - "Body" : "f39a6db5-cb4a-4f70-be21-c72803c0253eTue, 30 Jul 2019 18:19:03 GMTTue, 06 Aug 2019 18:19:03 GMTAgAAAAMAAAAAAAAAV6QtRANH1QE=Tue, 30 Jul 2019 18:19:03 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue857326bc/messages?peekonly=true", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "8071d393-4003-00b9-4903-47d378000000", - "Body" : "f39a6db5-cb4a-4f70-be21-c72803c0253eTue, 30 Jul 2019 18:19:03 GMTTue, 06 Aug 2019 18:19:03 GMT0test message", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue857326bc/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d3a6-4003-00b9-5c03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue857326bc", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d3b4-4003-00b9-6a03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" - } - } ], - "variables" : [ "queue857326bc" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueQueueDoesNotExist.json deleted file mode 100644 index 9859c91ffdb1..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueQueueDoesNotExist.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue50657bc8/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "8071d2c1-4003-00b9-8003-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:8071d2c1-4003-00b9-8003-47d378000000\nTime:2019-07-30T18:19:02.9379772Z", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue50657bc8/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "8071d2ea-4003-00b9-2703-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:8071d2ea-4003-00b9-2703-47d378000000\nTime:2019-07-30T18:19:02.9770131Z", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue50657bc8" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueShortTimeToLiveMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueShortTimeToLiveMessage.json deleted file mode 100644 index 5c546664731c..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueShortTimeToLiveMessage.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue4952015f", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071be6d-4003-00b9-4a03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue4952015f/messages?visibilitytimeout=0&messagettl=2", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071be9d-4003-00b9-7603-47d378000000", - "Body" : "f2a72af5-11f7-4174-9bca-0c6bbc7a1a4fTue, 30 Jul 2019 18:18:56 GMTTue, 30 Jul 2019 18:18:58 GMTAgAAAAMAAAAAAAAAl7hMQANH1QE=Tue, 30 Jul 2019 18:18:56 GMT", - "Date" : "Tue, 30 Jul 2019 18:18:56 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue4952015f/messages?peekonly=true", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "8071cea8-4003-00b9-0e03-47d378000000", - "Body" : "", - "Date" : "Tue, 30 Jul 2019 18:19:01 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue4952015f/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071cec0-4003-00b9-2603-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:01 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue4952015f", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071cee0-4003-00b9-4603-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:01 GMT" - } - } ], - "variables" : [ "queue4952015f" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/getAccessPolicy.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/getAccessPolicy.json deleted file mode 100644 index f4583b3a1ca6..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/getAccessPolicy.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue9583269e", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d4c3-4003-00b9-7003-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue9583269e?comp=acl", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "8071d4e3-4003-00b9-0e03-47d378000000", - "Body" : "", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue9583269e/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d4fb-4003-00b9-2603-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue9583269e", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d50b-4003-00b9-3503-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" - } - } ], - "variables" : [ "queue9583269e" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/getAccessPolicyQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/getAccessPolicyQueueDoesNotExist.json deleted file mode 100644 index f51ee48724c7..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/getAccessPolicyQueueDoesNotExist.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue066060ee?comp=acl", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "8072468c-4003-00b9-2603-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:8072468c-4003-00b9-2603-47d378000000\nTime:2019-07-30T18:19:37.6481654Z", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue066060ee/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "807246a7-4003-00b9-3f03-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:807246a7-4003-00b9-3f03-47d378000000\nTime:2019-07-30T18:19:37.6781928Z", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue066060ee" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/getProperties.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/getProperties.json deleted file mode 100644 index c603492afe88..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/getProperties.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue98021a59", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d0a9-4003-00b9-7f03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue98021a59?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "Content-Length" : "0", - "x-ms-approximate-messages-count" : "0", - "x-ms-meta-metadata1" : "value1", - "StatusCode" : "200", - "x-ms-request-id" : "8071d0df-4003-00b9-3403-47d378000000", - "x-ms-meta-metadata2" : "value2", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue98021a59/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d0ff-4003-00b9-5303-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue98021a59", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d123-4003-00b9-7703-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - } ], - "variables" : [ "queue98021a59" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/getPropertiesQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/getPropertiesQueueDoesNotExist.json deleted file mode 100644 index c81fadfa36f6..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/getPropertiesQueueDoesNotExist.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue89138457?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "8071cf1e-4003-00b9-0203-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:8071cf1e-4003-00b9-0203-47d378000000\nTime:2019-07-30T18:19:01.8439650Z", - "Date" : "Tue, 30 Jul 2019 18:19:01 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue89138457/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "8071cf3f-4003-00b9-2103-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:8071cf3f-4003-00b9-2103-47d378000000\nTime:2019-07-30T18:19:01.8769939Z", - "Date" : "Tue, 30 Jul 2019 18:19:01 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue89138457" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/getQueueDoesNotCreateAQueue.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/getQueueDoesNotCreateAQueue.json deleted file mode 100644 index 0f91979ead55..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/getQueueDoesNotCreateAQueue.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue881089d3/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "1cdd82f3-e003-0073-0f09-4740b5000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:1cdd82f3-e003-0073-0f09-4740b5000000\nTime:2019-07-30T19:01:06.9836664Z", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue881089d3&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd82f9-e003-0073-1409-4740b5000000", - "Body" : "queue881089d3", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue881089d3" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueues.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueues.json deleted file mode 100644 index 60f43a830052..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueues.json +++ /dev/null @@ -1,186 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue53815dd50", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd8272-e003-0073-1c09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue53815dd51", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd8278-e003-0073-2109-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue53815dd52", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd827e-e003-0073-2609-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue53815dd5&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd8286-e003-0073-2d09-4740b5000000", - "Body" : "queue53815dd5queue53815dd50queue53815dd51queue53815dd52", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue53815dd5&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd828a-e003-0073-3109-4740b5000000", - "Body" : "queue53815dd5queue53815dd50queue53815dd51queue53815dd52", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue53815dd50/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd828e-e003-0073-3409-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue53815dd50", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd8292-e003-0073-3809-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue53815dd51/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd829b-e003-0073-3f09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue53815dd51", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd82a2-e003-0073-4509-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue53815dd52/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd82a8-e003-0073-4b09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue53815dd52", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd82b1-e003-0073-5409-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" - } - } ], - "variables" : [ "queue53815dd5" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueuesIncludeMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueuesIncludeMetadata.json deleted file mode 100644 index a3a8affdfea0..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueuesIncludeMetadata.json +++ /dev/null @@ -1,186 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue3555933b0", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd8362-e003-0073-6e09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:07 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue3555933b1", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd8373-e003-0073-7b09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:07 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue3555933b2", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd8378-e003-0073-7f09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:07 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue3555933b&include=metadata&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd837b-e003-0073-0109-4740b5000000", - "Body" : "queue3555933bqueue3555933b0value1value2queue3555933b1queue3555933b2value1value2", - "Date" : "Tue, 30 Jul 2019 19:01:07 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue3555933b&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd8382-e003-0073-0409-4740b5000000", - "Body" : "queue3555933bqueue3555933b0queue3555933b1queue3555933b2", - "Date" : "Tue, 30 Jul 2019 19:01:07 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue3555933b0/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd838a-e003-0073-0a09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:07 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue3555933b0", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd838d-e003-0073-0d09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:07 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue3555933b1/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd8395-e003-0073-1409-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:07 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue3555933b1", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd839b-e003-0073-1909-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:07 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue3555933b2/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd83a1-e003-0073-1f09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:07 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue3555933b2", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd83a4-e003-0073-2209-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:07 GMT" - } - } ], - "variables" : [ "queue3555933b" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueuesWithLimit.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueuesWithLimit.json deleted file mode 100644 index fc87bcea2c77..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueuesWithLimit.json +++ /dev/null @@ -1,205 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20354e780", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "4ab9e4e1-4003-00df-40f2-4b6122000000", - "Date" : "Tue, 06 Aug 2019 00:59:14 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20354e781", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "4ab9e592-4003-00df-55f2-4b6122000000", - "Date" : "Tue, 06 Aug 2019 00:59:14 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20354e782", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "4ab9e59c-4003-00df-5df2-4b6122000000", - "Date" : "Tue, 06 Aug 2019 00:59:14 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue20354e78&maxresults=2&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "4ab9e5a9-4003-00df-66f2-4b6122000000", - "Body" : "queue20354e782queue20354e780queue20354e781/azstoragesdkaccount/queue20354e782", - "Date" : "Tue, 06 Aug 2019 00:59:14 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue20354e78&marker=/azstoragesdkaccount/queue20354e782&maxresults=2&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "4ab9e5b3-4003-00df-6ff2-4b6122000000", - "Body" : "queue20354e78/azstoragesdkaccount/queue20354e7822queue20354e782", - "Date" : "Tue, 06 Aug 2019 00:59:14 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue20354e78&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "4ab9e5b5-4003-00df-71f2-4b6122000000", - "Body" : "queue20354e78queue20354e780queue20354e781queue20354e782", - "Date" : "Tue, 06 Aug 2019 00:59:14 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20354e780/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "4ab9e5bb-4003-00df-76f2-4b6122000000", - "Date" : "Tue, 06 Aug 2019 00:59:14 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20354e780", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "4ab9e5bd-4003-00df-78f2-4b6122000000", - "Date" : "Tue, 06 Aug 2019 00:59:15 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20354e781/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "4ab9e5d7-4003-00df-0df2-4b6122000000", - "Date" : "Tue, 06 Aug 2019 00:59:15 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20354e781", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "4ab9e5d9-4003-00df-0ff2-4b6122000000", - "Date" : "Tue, 06 Aug 2019 00:59:15 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20354e782/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "4ab9e5df-4003-00df-13f2-4b6122000000", - "Date" : "Tue, 06 Aug 2019 00:59:15 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20354e782", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "4ab9e5e4-4003-00df-17f2-4b6122000000", - "Date" : "Tue, 06 Aug 2019 00:59:15 GMT" - } - } ], - "variables" : [ "queue20354e78" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueuesWithPrefix.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueuesWithPrefix.json deleted file mode 100644 index 25ab0025e774..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueuesWithPrefix.json +++ /dev/null @@ -1,186 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue360442b5prefix0", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd8322-e003-0073-3709-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue360442b51", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd8329-e003-0073-3c09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue360442b5prefix2", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "1cdd8330-e003-0073-4109-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue360442b5prefix&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd8334-e003-0073-4409-4740b5000000", - "Body" : "queue360442b5prefixqueue360442b5prefix0queue360442b5prefix2", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue360442b5&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd8337-e003-0073-4709-4740b5000000", - "Body" : "queue360442b5queue360442b51queue360442b5prefix0queue360442b5prefix2", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue360442b51/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd8339-e003-0073-4909-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue360442b51", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd833c-e003-0073-4c09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue360442b5prefix0/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd833f-e003-0073-4e09-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue360442b5prefix0", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd8343-e003-0073-5209-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue360442b5prefix2/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd8345-e003-0073-5409-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue360442b5prefix2", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "1cdd8349-e003-0073-5709-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" - } - } ], - "variables" : [ "queue360442b5" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekMessage.json deleted file mode 100644 index dd793491431d..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekMessage.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue9289930b", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "80724592-4003-00b9-3103-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue9289930b/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "807245b2-4003-00b9-5003-47d378000000", - "Body" : "4af8da31-fef8-48bb-9c58-e31cb39648bcTue, 30 Jul 2019 18:19:37 GMTTue, 06 Aug 2019 18:19:37 GMTAgAAAAMAAAAAAAAAY9qQWANH1QE=Tue, 30 Jul 2019 18:19:37 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue9289930b/messages?peekonly=true", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "807245d1-4003-00b9-6f03-47d378000000", - "Body" : "4af8da31-fef8-48bb-9c58-e31cb39648bcTue, 30 Jul 2019 18:19:37 GMTTue, 06 Aug 2019 18:19:37 GMT0test message", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue9289930b/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "807245e5-4003-00b9-0303-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue9289930b", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "807245f8-4003-00b9-1603-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - } ], - "variables" : [ "queue9289930b" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekMultipleMessages.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekMultipleMessages.json deleted file mode 100644 index ec67bb0d5044..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekMultipleMessages.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue17331e05", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d3de-4003-00b9-1203-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue17331e05/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d3fe-4003-00b9-3103-47d378000000", - "Body" : "eb154178-fd28-4e7d-9bb4-502bd3aa9472Tue, 30 Jul 2019 18:19:03 GMTTue, 06 Aug 2019 18:19:03 GMTAgAAAAMAAAAAAAAAZNBKRANH1QE=Tue, 30 Jul 2019 18:19:03 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue17331e05/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d435-4003-00b9-6503-47d378000000", - "Body" : "c2697011-4b18-4aae-b894-92e681fe9af3Tue, 30 Jul 2019 18:19:03 GMTTue, 06 Aug 2019 18:19:03 GMTAgAAAAMAAAAAAAAAEZNWRANH1QE=Tue, 30 Jul 2019 18:19:03 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue17331e05/messages?numofmessages=2&peekonly=true", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "8071d45c-4003-00b9-0b03-47d378000000", - "Body" : "eb154178-fd28-4e7d-9bb4-502bd3aa9472Tue, 30 Jul 2019 18:19:03 GMTTue, 06 Aug 2019 18:19:03 GMT0test messagec2697011-4b18-4aae-b894-92e681fe9af3Tue, 30 Jul 2019 18:19:03 GMTTue, 06 Aug 2019 18:19:03 GMT0test message 2", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue17331e05/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d478-4003-00b9-2703-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue17331e05", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d495-4003-00b9-4303-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" - } - } ], - "variables" : [ "queue17331e05" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekQueueDoesNotExist.json deleted file mode 100644 index 5efe773a0a36..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekQueueDoesNotExist.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue163539f6/messages?peekonly=true", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "8071bbf5-4003-00b9-6403-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:8071bbf5-4003-00b9-6403-47d378000000\nTime:2019-07-30T18:18:55.9785249Z", - "Date" : "Tue, 30 Jul 2019 18:18:55 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue163539f6/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "8071bc16-4003-00b9-0303-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:8071bc16-4003-00b9-0303-47d378000000\nTime:2019-07-30T18:18:56.0175608Z", - "Date" : "Tue, 30 Jul 2019 18:18:55 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue163539f6" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekTooManyMessages.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekTooManyMessages.json deleted file mode 100644 index 0e21d3f3e056..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekTooManyMessages.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue007623b2", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "80724850-4003-00b9-5203-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue007623b2/messages?numofmessages=64&peekonly=true", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "OutOfRangeQueryParameterValue", - "retry-after" : "0", - "Content-Length" : "456", - "StatusCode" : "400", - "x-ms-request-id" : "8072486a-4003-00b9-6b03-47d378000000", - "Body" : "OutOfRangeQueryParameterValueOne of the query parameters specified in the request URI is outside the permissible range.\nRequestId:8072486a-4003-00b9-6b03-47d378000000\nTime:2019-07-30T18:19:38.2327064Znumofmessages64132", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue007623b2/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724884-4003-00b9-0503-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue007623b2", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "807248a6-4003-00b9-2603-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" - } - } ], - "variables" : [ "queue007623b2" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setAccessPolicy.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setAccessPolicy.json deleted file mode 100644 index cc3a358651b1..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setAccessPolicy.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue392406b1", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "807244f3-4003-00b9-1603-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue392406b1?comp=acl", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724521-4003-00b9-4103-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue392406b1?comp=acl", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "80724540-4003-00b9-5f03-47d378000000", - "Body" : "testpermission2000-01-01T00:00:00.0000000Z2020-01-01T00:00:00.0000000Zraup", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue392406b1/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724551-4003-00b9-7003-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue392406b1", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724569-4003-00b9-0803-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - } ], - "variables" : [ "queue392406b1" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setAccessPolicyQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setAccessPolicyQueueDoesNotExist.json deleted file mode 100644 index 831f07e70edb..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setAccessPolicyQueueDoesNotExist.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue15204045?comp=acl", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidXmlDocument", - "retry-after" : "0", - "Content-Length" : "294", - "StatusCode" : "400", - "x-ms-request-id" : "80724e15-4003-00b9-6d03-47d378000000", - "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:80724e15-4003-00b9-6d03-47d378000000\nTime:2019-07-30T18:19:39.7961551Z00", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue15204045/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "80724e34-4003-00b9-0b03-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:80724e34-4003-00b9-0b03-47d378000000\nTime:2019-07-30T18:19:39.8241820Z", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue15204045" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setInvalidAccessPolicy.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setInvalidAccessPolicy.json deleted file mode 100644 index c053664720a1..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setInvalidAccessPolicy.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue598515b0", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "80724b93-4003-00b9-7c03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue598515b0?comp=acl", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidXmlDocument", - "retry-after" : "0", - "Content-Length" : "371", - "StatusCode" : "400", - "x-ms-request-id" : "80724bb2-4003-00b9-1a03-47d378000000", - "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:80724bb2-4003-00b9-1a03-47d378000000\nTime:2019-07-30T18:19:39.1915951Z1304Signed identifier ID cannot be empty or over 64 characters in length", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue598515b0/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724bde-4003-00b9-4503-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue598515b0", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724bf9-4003-00b9-6003-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - } ], - "variables" : [ "queue598515b0" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setInvalidMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setInvalidMetadata.json deleted file mode 100644 index 5e4a36f56436..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setInvalidMetadata.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue04921afb", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d01e-4003-00b9-7903-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue04921afb?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "EmptyMetadataKey", - "retry-after" : "0", - "Content-Length" : "285", - "StatusCode" : "400", - "x-ms-request-id" : "8071d048-4003-00b9-2003-47d378000000", - "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:8071d048-4003-00b9-2003-47d378000000\nTime:2019-07-30T18:19:02.1712670Zbad metadata", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue04921afb/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d05e-4003-00b9-3603-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue04921afb", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d078-4003-00b9-5003-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" - } - } ], - "variables" : [ "queue04921afb" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setMetadata.json deleted file mode 100644 index 4f5b33d48612..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setMetadata.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue228395ba", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "80724c9b-4003-00b9-7c03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue228395ba?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724cc8-4003-00b9-2803-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue228395ba?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "Content-Length" : "0", - "x-ms-approximate-messages-count" : "0", - "x-ms-meta-metadata1" : "value1", - "StatusCode" : "200", - "x-ms-request-id" : "80724ce7-4003-00b9-4503-47d378000000", - "x-ms-meta-metadata2" : "value2", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue228395ba/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724d0c-4003-00b9-6903-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue228395ba", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724d24-4003-00b9-0103-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" - } - } ], - "variables" : [ "queue228395ba" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setMetadataQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setMetadataQueueDoesNotExist.json deleted file mode 100644 index 2403d75b3cd8..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setMetadataQueueDoesNotExist.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue1023979b?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "80724760-4003-00b9-7003-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:80724760-4003-00b9-7003-47d378000000\nTime:2019-07-30T18:19:37.9564505Z", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue1023979b/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "8072477f-4003-00b9-0d03-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:8072477f-4003-00b9-0d03-47d378000000\nTime:2019-07-30T18:19:37.9904825Z", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue1023979b" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setProperties.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setProperties.json deleted file mode 100644 index 6788bd49edd8..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setProperties.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd81c0-e003-0073-8009-4740b5000000", - "Body" : "1.0falsefalsefalsefalse1.0truetruetrue71.0falsefalse", - "Date" : "Tue, 30 Jul 2019 19:01:03 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "1cdd81d5-e003-0073-1309-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:03 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd81e5-e003-0073-1d09-4740b5000000", - "Body" : "1.0falsetruetruetrue31.0truefalsetrue31.0truefalsetrue3", - "Date" : "Tue, 30 Jul 2019 19:01:03 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "202", - "x-ms-request-id" : "1cdd81eb-e003-0073-2309-4740b5000000", - "Date" : "Tue, 30 Jul 2019 19:01:03 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd81ed-e003-0073-2509-4740b5000000", - "Body" : "1.0falsefalsefalsefalse1.0truetruetrue71.0falsefalse", - "Date" : "Tue, 30 Jul 2019 19:01:03 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue30084080&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "1cdd81f3-e003-0073-2b09-4740b5000000", - "Body" : "queue30084080", - "Date" : "Tue, 30 Jul 2019 19:01:03 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue30084080" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setTooManyAccessPolicies.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setTooManyAccessPolicies.json deleted file mode 100644 index 52ffab91ef1e..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/setTooManyAccessPolicies.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue02682f2a", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "80724626-4003-00b9-4103-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue02682f2a?comp=acl", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidXmlDocument", - "retry-after" : "0", - "Content-Length" : "294", - "StatusCode" : "400", - "x-ms-request-id" : "80724645-4003-00b9-5f03-47d378000000", - "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:80724645-4003-00b9-5f03-47d378000000\nTime:2019-07-30T18:19:37.5430678Z00", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue02682f2a/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8072465c-4003-00b9-7603-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue02682f2a", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "80724670-4003-00b9-0a03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" - } - } ], - "variables" : [ "queue02682f2a" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessage.json deleted file mode 100644 index a0d2027ab04f..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessage.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20800231", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d53d-4003-00b9-6703-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20800231/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071d56d-4003-00b9-1003-47d378000000", - "Body" : "5e400587-ca00-4a0e-a557-f8c4d2e2c6c7Tue, 30 Jul 2019 18:19:03 GMTTue, 06 Aug 2019 18:19:03 GMTAgAAAAMAAAAAAAAAzOOURANH1QE=Tue, 30 Jul 2019 18:19:03 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20800231/messages?numofmessages=1&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "8071d58c-4003-00b9-2f03-47d378000000", - "Body" : "5e400587-ca00-4a0e-a557-f8c4d2e2c6c7Tue, 30 Jul 2019 18:19:03 GMTTue, 06 Aug 2019 18:19:03 GMTAgAAAAMAAAAAAAAAMD99VgNH1QE=Tue, 30 Jul 2019 18:19:33 GMT1test message", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20800231/messages/5e400587-ca00-4a0e-a557-f8c4d2e2c6c7?popreceipt=AgAAAAMAAAAAAAAAMD99VgNH1QE%3d&visibilitytimeout=1", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-time-next-visible" : "Tue, 30 Jul 2019 18:19:04 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071d5ad-4003-00b9-5003-47d378000000", - "x-ms-popreceipt" : "AwAAAAMAAAAAAAAA+cM6RQNH1QEBAAAA", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20800231/messages?peekonly=true", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "8071dba1-4003-00b9-0a03-47d378000000", - "Body" : "5e400587-ca00-4a0e-a557-f8c4d2e2c6c7Tue, 30 Jul 2019 18:19:03 GMTTue, 06 Aug 2019 18:19:03 GMT1updated test message", - "Date" : "Tue, 30 Jul 2019 18:19:05 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20800231/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071dbb7-4003-00b9-2003-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:05 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue20800231", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071dbd1-4003-00b9-3a03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:05 GMT" - } - } ], - "variables" : [ "queue20800231" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessageInvalidMessageId.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessageInvalidMessageId.json deleted file mode 100644 index 849ea36b90c2..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessageInvalidMessageId.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue70821c12", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071dc01-4003-00b9-6903-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue70821c12/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071dc22-4003-00b9-0703-47d378000000", - "Body" : "2d1bf643-019d-41da-8a3e-635dba5df867Tue, 30 Jul 2019 18:19:06 GMTTue, 06 Aug 2019 18:19:06 GMTAgAAAAMAAAAAAAAAtDTwRQNH1QE=Tue, 30 Jul 2019 18:19:06 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue70821c12/messages?numofmessages=1&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "8071dc41-4003-00b9-2503-47d378000000", - "Body" : "2d1bf643-019d-41da-8a3e-635dba5df867Tue, 30 Jul 2019 18:19:06 GMTTue, 06 Aug 2019 18:19:06 GMTAgAAAAMAAAAAAAAA6kHYVwNH1QE=Tue, 30 Jul 2019 18:19:36 GMT1test message", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue70821c12/messages/2d1bf643-019d-41da-8a3e-635dba5df867random?popreceipt=AgAAAAMAAAAAAAAA6kHYVwNH1QE%3d&visibilitytimeout=1", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "MessageNotFound", - "retry-after" : "0", - "Content-Length" : "221", - "StatusCode" : "404", - "x-ms-request-id" : "8071dc6d-4003-00b9-5003-47d378000000", - "Body" : "MessageNotFoundThe specified message does not exist.\nRequestId:8071dc6d-4003-00b9-5003-47d378000000\nTime:2019-07-30T18:19:06.1889942Z", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue70821c12/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071dc88-4003-00b9-6b03-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue70821c12", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071dca6-4003-00b9-0803-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" - } - } ], - "variables" : [ "queue70821c12" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessageInvalidPopReceipt.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessageInvalidPopReceipt.json deleted file mode 100644 index 960abdc79ba2..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessageInvalidPopReceipt.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue12446d02", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071ddb6-4003-00b9-0603-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue12446d02/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "8071dddf-4003-00b9-2d03-47d378000000", - "Body" : "af0f96cb-a19e-4f9a-b1ba-08e6c27944dbTue, 30 Jul 2019 18:19:06 GMTTue, 06 Aug 2019 18:19:06 GMTAgAAAAMAAAAAAAAAzks4RgNH1QE=Tue, 30 Jul 2019 18:19:06 GMT", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue12446d02/messages?numofmessages=1&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "Cache-Control" : "no-cache", - "retry-after" : "0", - "StatusCode" : "200", - "x-ms-request-id" : "8071ddf9-4003-00b9-4703-47d378000000", - "Body" : "af0f96cb-a19e-4f9a-b1ba-08e6c27944dbTue, 30 Jul 2019 18:19:06 GMTTue, 06 Aug 2019 18:19:06 GMTAgAAAAMAAAAAAAAA5KoeWANH1QE=Tue, 30 Jul 2019 18:19:36 GMT1test message", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue12446d02/messages/af0f96cb-a19e-4f9a-b1ba-08e6c27944db?popreceipt=AgAAAAMAAAAAAAAA5KoeWANH1QE%3drandom&visibilitytimeout=1", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidQueryParameterValue", - "retry-after" : "0", - "Content-Length" : "444", - "StatusCode" : "400", - "x-ms-request-id" : "8071de13-4003-00b9-6103-47d378000000", - "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:8071de13-4003-00b9-6103-47d378000000\nTime:2019-07-30T18:19:06.6474193ZpopreceiptAgAAAAMAAAAAAAAA5KoeWANH1QE=randomInvalid pop receipt format", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue12446d02/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071de2b-4003-00b9-7803-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue12446d02", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "8071de43-4003-00b9-1003-47d378000000", - "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" - } - } ], - "variables" : [ "queue12446d02" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessageQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessageQueueDoesNotExist.json deleted file mode 100644 index b87cef21fed8..000000000000 --- a/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessageQueueDoesNotExist.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue960895d5/messages/doesn't?popreceipt=exist&visibilitytimeout=5", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0", - "Content-Type" : "application/xml; charset=utf-8" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "InvalidQueryParameterValue", - "retry-after" : "0", - "Content-Length" : "415", - "StatusCode" : "400", - "x-ms-request-id" : "8071d32f-4003-00b9-6803-47d378000000", - "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:8071d32f-4003-00b9-6803-47d378000000\nTime:2019-07-30T18:19:03.0460773ZpopreceiptexistInvalid pop receipt format", - "Date" : "Tue, 30 Jul 2019 18:19:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue960895d5/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-error-code" : "QueueNotFound", - "retry-after" : "0", - "Content-Length" : "217", - "StatusCode" : "404", - "x-ms-request-id" : "8071d341-4003-00b9-7a03-47d378000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:8071d341-4003-00b9-7a03-47d378000000\nTime:2019-07-30T18:19:03.0771058Z", - "Date" : "Tue, 30 Jul 2019 18:19:03 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "queue960895d5" ] -} \ No newline at end of file diff --git a/sdk/storage/azure-storage-queue/swagger/README.md b/sdk/storage/azure-storage-queue/swagger/README.md new file mode 100644 index 000000000000..390763ea64a3 --- /dev/null +++ b/sdk/storage/azure-storage-queue/swagger/README.md @@ -0,0 +1,175 @@ +# Azure Queue Storage for Java + +> see https://aka.ms/autorest + +### Setup +```ps +cd C:\work +git clone --recursive https://github.com/Azure/autorest.java/ +cd autorest.java +git checkout v3 +npm install +cd .. +git clone --recursive https://github.com/jianghaolu/autorest.modeler/ +cd autorest.modeler +git checkout headerprefixfix +npm install +``` + +### Generation +```ps +cd +autorest --use=C:/work/autorest.java --use=C:/work/autorest.modeler --version=2.0.4280 +``` + +### Code generation settings +``` yaml +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/storage-dataplane-preview/specification/storage/data-plane/Microsoft.QueueStorage/preview/2018-03-28/queue.json +java: true +output-folder: ../ +namespace: com.azure.storage.queue +enable-xml: true +generate-client-interfaces: false +sync-methods: none +license-header: MICROSOFT_MIT_SMALL +add-context-parameter: true +``` + +### /{queueName} +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{queueName}"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("QueueName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/QueueName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + $.delete.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{queueName}?comp=metadata +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{queueName}?comp=metadata"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("QueueName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/QueueName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + $.get.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{queueName}?comp=acl +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{queueName}?comp=acl"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("QueueName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/QueueName"); + $.put.parameters.splice(0, 0, { "$ref": path }); + $.get.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{queueName}/messages +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{queueName}/messages"] + transform: > + let param = $.get.parameters[0]; + if (!param["$ref"].endsWith("QueueName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/QueueName"); + $.get.parameters.splice(0, 0, { "$ref": path }); + $.delete.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{queueName}/messages?visibilitytimeout={visibilityTimeout}&messagettl={messageTimeToLive} +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{queueName}/messages?visibilitytimeout={visibilityTimeout}&messagettl={messageTimeToLive}"] + transform: > + let param = $.post.parameters[0]; + if (!param["$ref"].endsWith("QueueName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/QueueName"); + $.post.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{queueName}/messages?peekonly=true +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{queueName}/messages?peekonly=true"] + transform: > + let param = $.get.parameters[0]; + if (!param["$ref"].endsWith("QueueName")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/QueueName"); + $.get.parameters.splice(0, 0, { "$ref": path }); + } +``` + +### /{queueName}/messages/{messageid}?popreceipt={popReceipt}&visibilitytimeout={visibilityTimeout} +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{queueName}/messages/{messageid}?popreceipt={popReceipt}&visibilitytimeout={visibilityTimeout}"] + transform: > + let param = $.put.parameters[0]; + if (!param["$ref"].endsWith("QueueName")) { + const queueNamePath = param["$ref"].replace(/[#].*$/, "#/parameters/QueueName"); + const messageIdPath = param["$ref"].replace(/[#].*$/, "#/parameters/MessageId"); + $.put.parameters.splice(0, 0, { "$ref": queueNamePath }); + $.put.parameters.splice(1, 0, { "$ref": messageIdPath }); + } +``` + +### /{queueName}/messages/{messageid}?popreceipt={popReceipt} +``` yaml +directive: +- from: swagger-document + where: $["x-ms-paths"]["/{queueName}/messages/{messageid}?popreceipt={popReceipt}"] + transform: > + let param = $.delete.parameters[0]; + if (!param["$ref"].endsWith("QueueName")) { + const queueNamePath = param["$ref"].replace(/[#].*$/, "#/parameters/QueueName"); + const messageIdPath = param["$ref"].replace(/[#].*$/, "#/parameters/MessageId"); + $.delete.parameters.splice(0, 0, { "$ref": queueNamePath }); + $.delete.parameters.splice(1, 0, { "$ref": messageIdPath }); + } +``` + +### Rename MessageItems +``` yaml +directive: +- from: swagger-document + where: $.definitions + transform: > + if (!$.DequeuedMessage) { + $.DequeuedMessage = $.DequeuedMessageItem; + delete $.DequeuedMessageItem; + $.DequeuedMessagesList.items.$ref = $.DequeuedMessagesList.items.$ref.replace("DequeuedMessageItem", "DequeuedMessage"); + } + if (!$.PeekedMessage) { + $.PeekedMessage = $.PeekedMessageItem; + delete $.PeekedMessageItem; + $.PeekedMessagesList.items.$ref = $.PeekedMessagesList.items.$ref.replace("PeekedMessageItem", "PeekedMessage"); + } +``` + +### MessageId +``` yaml +directive: +- from: swagger-document + where: $.parameters.MessageId + transform: > + $.description = "The message ID name."; +``` diff --git a/sdk/storage/azure-storage-queue/swagger/queue.json b/sdk/storage/azure-storage-queue/swagger/queue.json deleted file mode 100644 index 977d767b9f84..000000000000 --- a/sdk/storage/azure-storage-queue/swagger/queue.json +++ /dev/null @@ -1,1898 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "Azure Queue Storage", - "version": "2018-03-28", - "x-ms-code-generation-settings": { - "header": "MIT", - "strictSpecAdherence": false - } - }, - "x-ms-parameterized-host": { - "hostTemplate": "{url}", - "useSchemePrefix": false, - "positionInOperation": "first", - "parameters": [ - { - "$ref": "#/parameters/Url" - } - ] - }, - "securityDefinitions": { - "queue_shared_key": { - "type": "apiKey", - "name": "Authorization", - "in": "header" - } - }, - "schemes": [ - "https" - ], - "consumes": [ - "application/xml" - ], - "produces": [ - "application/xml" - ], - "paths": {}, - "x-ms-paths": { - "/?restype=service&comp=properties": { - "put": { - "tags": [ - "service" - ], - "operationId": "Service_SetProperties", - "description": "Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules", - "parameters": [ - { - "$ref": "#/parameters/StorageServiceProperties" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "202": { - "description": "Success (Accepted)", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "get": { - "tags": [ - "service" - ], - "operationId": "Service_GetProperties", - "description": "gets the properties of a storage account's Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - } - }, - "schema": { - "$ref": "#/definitions/StorageServiceProperties" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "service" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "properties" - ] - } - ] - }, - "/?restype=service&comp=stats": { - "get": { - "tags": [ - "service" - ], - "operationId": "Service_GetStatistics", - "description": "Retrieves statistics related to replication for the Queue service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account.", - "parameters": [ - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/StorageServiceStats" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "restype", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "service" - ] - }, - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "stats" - ] - } - ] - }, - "/?comp=list": { - "get": { - "tags": [ - "service" - ], - "operationId": "Service_ListQueuesSegment", - "description": "The List Queues Segment operation returns a list of the queues under the specified account", - "parameters": [ - { - "$ref": "#/parameters/Prefix" - }, - { - "$ref": "#/parameters/Marker" - }, - { - "$ref": "#/parameters/MaxResults" - }, - { - "$ref": "#/parameters/ListQueuesInclude" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/ListQueuesSegmentResponse" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "NextMarker" - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "list" - ] - } - ] - }, - "/{queueName}": { - "put": { - "tags": [ - "service" - ], - "operationId": "Queue_Create", - "description": "creates a new queue under the given account.", - "parameters": [ - { - "$ref": "#/parameters/QueueName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "Success, queue created.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "204": { - "description": "Success, queue created.", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "delete": { - "tags": [ - "queue" - ], - "operationId": "Queue_Delete", - "description": "operation permanently deletes the specified queue", - "parameters": [ - { - "$ref": "#/parameters/QueueName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "204": { - "description": "No Content", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [] - }, - "/{queueName}?comp=metadata": { - "get": { - "tags": [ - "queue" - ], - "operationId": "Queue_GetProperties", - "description": "Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the queue as name-values pairs.", - "parameters": [ - { - "$ref": "#/parameters/QueueName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success.", - "headers": { - "x-ms-meta": { - "type": "string", - "x-ms-client-name": "Metadata", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "x-ms-approximate-messages-count": { - "type": "integer", - "x-ms-client-name": "ApproximateMessagesCount", - "description": "The approximate number of messages in the queue. This number is not lower than the actual number of messages in the queue, but could be higher." - }, - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "put": { - "tags": [ - "queue" - ], - "operationId": "Queue_SetMetadata", - "description": "sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs.", - "parameters": [ - { - "$ref": "#/parameters/QueueName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/Metadata" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "204": { - "description": "No Content", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "metadata" - ] - } - ] - }, - "/{queueName}?comp=acl": { - "get": { - "tags": [ - "queue" - ], - "operationId": "Queue_GetAccessPolicy", - "description": "returns details about any stored access policies specified on the queue that may be used with Shared Access Signatures.", - "parameters": [ - { - "$ref": "#/parameters/QueueName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "Success", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/SignedIdentifiers" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "put": { - "tags": [ - "queue" - ], - "operationId": "Queue_SetAccessPolicy", - "description": "sets stored access policies for the queue that may be used with Shared Access Signatures", - "parameters": [ - { - "$ref": "#/parameters/QueueName" - }, - { - "$ref": "#/parameters/QueueAcl" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "204": { - "description": "No Content", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "comp", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "acl" - ] - } - ] - }, - "/{queueName}/messages": { - "get": { - "tags": [ - "message" - ], - "operationId": "Messages_Dequeue", - "description": "The Dequeue operation retrieves one or more messages from the front of the queue.", - "parameters": [ - { - "$ref": "#/parameters/QueueName" - }, - { - "$ref": "#/parameters/NumOfMessages" - }, - { - "$ref": "#/parameters/VisibilityTimeout" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "OK", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/DequeuedMessagesList" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "delete": { - "tags": [ - "message" - ], - "operationId": "Messages_Clear", - "description": "The Clear operation deletes all messages from the specified queue.", - "parameters": [ - { - "$ref": "#/parameters/QueueName" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "204": { - "description": "No Content", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [] - }, - "/{queueName}/messages?visibilitytimeout={visibilityTimeout}&messagettl={messageTimeToLive}": { - "post": { - "tags": [ - "message" - ], - "operationId": "Messages_Enqueue", - "description": "The Enqueue operation adds a new message to the back of the message queue. A visibility timeout can also be specified to make the message invisible until the visibility timeout expires. A message must be in a format that can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for versions 2011-08-18 and newer, or 8 KB in size for previous versions.", - "parameters": [ - { - "$ref": "#/parameters/QueueName" - }, - { - "$ref": "#/parameters/QueueMessage" - }, - { - "$ref": "#/parameters/VisibilityTimeout" - }, - { - "$ref": "#/parameters/MessageTTL" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "201": { - "description": "Created", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/EnqueuedMessageList" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [] - }, - "/{queueName}/messages?peekonly=true": { - "get": { - "tags": [ - "message" - ], - "operationId": "Messages_Peek", - "description": "The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility of the message.", - "parameters": [ - { - "$ref": "#/parameters/QueueName" - }, - { - "$ref": "#/parameters/NumOfMessages" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "200": { - "description": "OK", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - }, - "schema": { - "$ref": "#/definitions/PeekedMessagesList" - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [ - { - "name": "peekonly", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "true" - ] - } - ] - }, - "/{queueName}/messages/{messageid}?popreceipt={popReceipt}&visibilitytimeout={visibilityTimeout}": { - "put": { - "tags": [ - "messageId" - ], - "operationId": "MessageId_Update", - "description": "The Update operation was introduced with version 2011-08-18 of the Queue service API. The Update Message operation updates the visibility timeout of a message. You can also use this operation to update the contents of a message. A message must be in a format that can be included in an XML request with UTF-8 encoding, and the encoded message can be up to 64KB in size.", - "parameters": [ - { - "$ref": "#/parameters/QueueName" - }, - { - "$ref": "#/parameters/MessageId" - }, - { - "$ref": "#/parameters/QueueMessage" - }, - { - "$ref": "#/parameters/PopReceipt" - }, - { - "$ref": "#/parameters/VisibilityTimeoutRequired" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "204": { - "description": "No Content", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - }, - "x-ms-popreceipt": { - "x-ms-client-name": "PopReceipt", - "type": "string", - "description": "The pop receipt of the queue message." - }, - "x-ms-time-next-visible": { - "x-ms-client-name": "TimeNextVisible", - "type": "string", - "format": "date-time-rfc1123", - "description": "A UTC date/time value that represents when the message will be visible on the queue." - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [] - }, - "/{queueName}/messages/{messageid}?popreceipt={popReceipt}": { - "delete": { - "tags": [ - "messageId" - ], - "operationId": "MessageId_Delete", - "description": "The Delete operation deletes the specified message.", - "parameters": [ - { - "$ref": "#/parameters/QueueName" - }, - { - "$ref": "#/parameters/MessageId" - }, - { - "$ref": "#/parameters/PopReceipt" - }, - { - "$ref": "#/parameters/Timeout" - }, - { - "$ref": "#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/ClientRequestId" - } - ], - "responses": { - "204": { - "description": "No Content", - "headers": { - "x-ms-request-id": { - "x-ms-client-name": "RequestId", - "type": "string", - "description": "This header uniquely identifies the request that was made and can be used for troubleshooting the request." - }, - "x-ms-version": { - "x-ms-client-name": "Version", - "type": "string", - "description": "Indicates the version of the Queue service used to execute the request. This header is returned for requests made against version 2009-09-19 and above." - }, - "Date": { - "type": "string", - "format": "date-time-rfc1123", - "description": "UTC date/time value generated by the service that indicates the time at which the response was initiated" - } - } - }, - "default": { - "description": "Failure", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - }, - "schema": { - "$ref": "#/definitions/StorageError" - } - } - } - }, - "parameters": [] - } - }, - "definitions": { - "AccessPolicy": { - "type": "object", - "required": [ - "Start", - "Expiry", - "Permission" - ], - "description": "An Access policy", - "properties": { - "Start": { - "description": "the date-time the policy is active", - "type": "string", - "format": "date-time" - }, - "Expiry": { - "description": "the date-time the policy expires", - "type": "string", - "format": "date-time" - }, - "Permission": { - "description": "the permissions for the acl policy", - "type": "string" - } - } - }, - "ListQueuesSegmentResponse": { - "xml": { - "name": "EnumerationResults" - }, - "description": "The object returned when calling List Queues on a Queue Service.", - "type": "object", - "required": [ - "ServiceEndpoint", - "Prefix", - "MaxResults", - "NextMarker" - ], - "properties": { - "ServiceEndpoint": { - "type": "string", - "xml": { - "attribute": true - } - }, - "Prefix": { - "type": "string" - }, - "Marker": { - "type": "string" - }, - "MaxResults": { - "type": "integer" - }, - "QueueItems": { - "xml": { - "wrapped": true, - "name": "Queues" - }, - "type": "array", - "items": { - "$ref": "#/definitions/QueueItem" - } - }, - "NextMarker": { - "type": "string" - } - } - }, - "CorsRule": { - "description": "CORS is an HTTP feature that enables a web application running under one domain to access resources in another domain. Web browsers implement a security restriction known as same-origin policy that prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin domain) to call APIs in another domain", - "type": "object", - "required": [ - "AllowedOrigins", - "AllowedMethods", - "AllowedHeaders", - "ExposedHeaders", - "MaxAgeInSeconds" - ], - "properties": { - "AllowedOrigins": { - "description": "The origin domains that are permitted to make a request against the storage service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be an exact case-sensitive match with the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all origin domains to make requests via CORS.", - "type": "string" - }, - "AllowedMethods": { - "description": "The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated)", - "type": "string" - }, - "AllowedHeaders": { - "description": "the request headers that the origin domain may specify on the CORS request.", - "type": "string" - }, - "ExposedHeaders": { - "description": "The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer", - "type": "string" - }, - "MaxAgeInSeconds": { - "description": "The maximum amount time that a browser should cache the preflight OPTIONS request.", - "type": "integer", - "minimum": 0 - } - } - }, - "ErrorCode": { - "description": "Error codes returned by the service", - "type": "string", - "enum": [ - "AccountAlreadyExists", - "AccountBeingCreated", - "AccountIsDisabled", - "AuthenticationFailed", - "AuthorizationFailure", - "ConditionHeadersNotSupported", - "ConditionNotMet", - "EmptyMetadataKey", - "InsufficientAccountPermissions", - "InternalError", - "InvalidAuthenticationInfo", - "InvalidHeaderValue", - "InvalidHttpVerb", - "InvalidInput", - "InvalidMd5", - "InvalidMetadata", - "InvalidQueryParameterValue", - "InvalidRange", - "InvalidResourceName", - "InvalidUri", - "InvalidXmlDocument", - "InvalidXmlNodeValue", - "Md5Mismatch", - "MetadataTooLarge", - "MissingContentLengthHeader", - "MissingRequiredQueryParameter", - "MissingRequiredHeader", - "MissingRequiredXmlNode", - "MultipleConditionHeadersNotSupported", - "OperationTimedOut", - "OutOfRangeInput", - "OutOfRangeQueryParameterValue", - "RequestBodyTooLarge", - "ResourceTypeMismatch", - "RequestUrlFailedToParse", - "ResourceAlreadyExists", - "ResourceNotFound", - "ServerBusy", - "UnsupportedHeader", - "UnsupportedXmlNode", - "UnsupportedQueryParameter", - "UnsupportedHttpVerb", - "InvalidMarker", - "MessageNotFound", - "MessageTooLarge", - "PopReceiptMismatch", - "QueueAlreadyExists", - "QueueBeingDeleted", - "QueueDisabled", - "QueueNotEmpty", - "QueueNotFound" - ], - "x-ms-enum": { - "name": "StorageErrorCode", - "modelAsString": true - } - }, - "GeoReplication": { - "type": "object", - "required": [ - "Status", - "LastSyncTime" - ], - "properties": { - "Status": { - "description": "The status of the secondary location", - "type": "string", - "enum": [ - "live", - "bootstrap", - "unavailable" - ], - "x-ms-enum": { - "name": "GeoReplicationStatusType", - "modelAsString": true - } - }, - "LastSyncTime": { - "description": "A GMT date/time value, to the second. All primary writes preceding this value are guaranteed to be available for read operations at the secondary. Primary writes after this point in time may or may not be available for reads.", - "type": "string", - "format": "date-time-rfc1123" - } - } - }, - "Logging": { - "description": "Azure Analytics Logging settings.", - "type": "object", - "required": [ - "Version", - "Delete", - "Read", - "Write", - "RetentionPolicy" - ], - "properties": { - "Version": { - "description": "The version of Storage Analytics to configure.", - "type": "string" - }, - "Delete": { - "description": "Indicates whether all delete requests should be logged.", - "type": "boolean" - }, - "Read": { - "description": "Indicates whether all read requests should be logged.", - "type": "boolean" - }, - "Write": { - "description": "Indicates whether all write requests should be logged.", - "type": "boolean" - }, - "RetentionPolicy": { - "$ref": "#/definitions/RetentionPolicy" - } - } - }, - "Metadata": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "StorageError": { - "type": "object", - "properties": { - "Message": { - "type": "string" - } - } - }, - "Metrics": { - "description": "", - "required": [ - "Enabled" - ], - "properties": { - "Version": { - "description": "The version of Storage Analytics to configure.", - "type": "string" - }, - "Enabled": { - "description": "Indicates whether metrics are enabled for the Queue service.", - "type": "boolean" - }, - "IncludeAPIs": { - "description": "Indicates whether metrics should generate summary statistics for called API operations.", - "type": "boolean" - }, - "RetentionPolicy": { - "$ref": "#/definitions/RetentionPolicy" - } - } - }, - "QueueItem": { - "description": "An Azure Storage Queue.", - "type": "object", - "required": [ - "Name" - ], - "properties": { - "Name": { - "type": "string", - "description": "The name of the Queue." - }, - "Metadata": { - "$ref": "#/definitions/Metadata" - } - }, - "xml": { - "name": "Queue" - } - }, - "QueueMessage": { - "description": "A Message object which can be stored in a Queue", - "type": "object", - "required": [ - "MessageText" - ], - "properties": { - "MessageText": { - "type": "string", - "description": "The content of the message" - } - } - }, - "DequeuedMessage": { - "description": "The object returned in the QueueMessageList array when calling Get Messages on a Queue.", - "type": "object", - "required": [ - "MessageId", - "InsertionTime", - "ExpirationTime", - "PopReceipt", - "TimeNextVisible", - "DequeueCount", - "MessageText" - ], - "properties": { - "MessageId": { - "type": "string", - "description": "The Id of the Message." - }, - "InsertionTime": { - "type": "string", - "format": "date-time-rfc1123", - "description": "The time the Message was inserted into the Queue." - }, - "ExpirationTime": { - "type": "string", - "format": "date-time-rfc1123", - "description": "The time that the Message will expire and be automatically deleted." - }, - "PopReceipt": { - "type": "string", - "description": "This value is required to delete the Message. If deletion fails using this popreceipt then the message has been dequeued by another client." - }, - "TimeNextVisible": { - "type": "string", - "format": "date-time-rfc1123", - "description": "The time that the message will again become visible in the Queue." - }, - "DequeueCount": { - "type": "integer", - "format": "int64", - "description": "The number of times the message has been dequeued." - }, - "MessageText": { - "type": "string", - "description": "The content of the Message." - } - }, - "xml": { - "wrapped": true, - "name": "QueueMessage" - } - }, - "PeekedMessage": { - "description": "The object returned in the QueueMessageList array when calling Peek Messages on a Queue", - "type": "object", - "required": [ - "MessageId", - "InsertionTime", - "ExpirationTime", - "DequeueCount", - "MessageText" - ], - "properties": { - "MessageId": { - "type": "string", - "description": "The Id of the Message." - }, - "InsertionTime": { - "type": "string", - "format": "date-time-rfc1123", - "description": "The time the Message was inserted into the Queue." - }, - "ExpirationTime": { - "type": "string", - "format": "date-time-rfc1123", - "description": "The time that the Message will expire and be automatically deleted." - }, - "DequeueCount": { - "type": "integer", - "format": "int64", - "description": "The number of times the message has been dequeued." - }, - "MessageText": { - "type": "string", - "description": "The content of the Message." - } - }, - "xml": { - "wrapped": true, - "name": "QueueMessage" - } - }, - "EnqueuedMessage": { - "description": "The object returned in the QueueMessageList array when calling Put Message on a Queue", - "type": "object", - "required": [ - "MessageId", - "InsertionTime", - "ExpirationTime", - "PopReceipt", - "TimeNextVisible" - ], - "properties": { - "MessageId": { - "type": "string", - "description": "The Id of the Message." - }, - "InsertionTime": { - "type": "string", - "format": "date-time-rfc1123", - "description": "The time the Message was inserted into the Queue." - }, - "ExpirationTime": { - "type": "string", - "format": "date-time-rfc1123", - "description": "The time that the Message will expire and be automatically deleted." - }, - "PopReceipt": { - "type": "string", - "description": "This value is required to delete the Message. If deletion fails using this popreceipt then the message has been dequeued by another client." - }, - "TimeNextVisible": { - "type": "string", - "format": "date-time-rfc1123", - "description": "The time that the message will again become visible in the Queue." - } - }, - "xml": { - "wrapped": true, - "name": "QueueMessage" - } - }, - "DequeuedMessagesList": { - "description": "The object returned when calling Get Messages on a Queue", - "type": "array", - "items": { - "$ref": "#/definitions/DequeuedMessage", - "xml": { - "name": "QueueMessage" - } - }, - "xml": { - "wrapped": true, - "name": "QueueMessagesList" - } - }, - "PeekedMessagesList": { - "description": "The object returned when calling Peek Messages on a Queue", - "type": "array", - "items": { - "$ref": "#/definitions/PeekedMessage", - "xml": { - "name": "QueueMessage" - } - }, - "xml": { - "wrapped": true, - "name": "QueueMessagesList" - } - }, - "EnqueuedMessageList": { - "description": "The object returned when calling Put Message on a Queue", - "type": "array", - "items": { - "$ref": "#/definitions/EnqueuedMessage", - "xml": { - "name": "QueueMessage" - } - }, - "xml": { - "wrapped": true, - "name": "QueueMessagesList" - } - }, - "RetentionPolicy": { - "description": "the retention policy", - "type": "object", - "required": [ - "Enabled" - ], - "properties": { - "Enabled": { - "description": "Indicates whether a retention policy is enabled for the storage service", - "type": "boolean" - }, - "Days": { - "description": "Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older than this value will be deleted", - "type": "integer", - "minimum": 1 - } - } - }, - "SignedIdentifier": { - "description": "signed identifier", - "type": "object", - "required": [ - "Id", - "AccessPolicy" - ], - "properties": { - "Id": { - "type": "string", - "description": "a unique id" - }, - "AccessPolicy": { - "description": "The access policy", - "$ref": "#/definitions/AccessPolicy" - } - } - }, - "SignedIdentifiers": { - "description": "a collection of signed identifiers", - "type": "array", - "items": { - "$ref": "#/definitions/SignedIdentifier", - "xml": { - "name": "SignedIdentifier" - } - }, - "xml": { - "wrapped": true, - "name": "SignedIdentifiers" - } - }, - "StorageServiceProperties": { - "description": "Storage Service Properties.", - "type": "object", - "properties": { - "Logging": { - "description": "Azure Analytics Logging settings", - "$ref": "#/definitions/Logging" - }, - "HourMetrics": { - "description": "A summary of request statistics grouped by API in hourly aggregates for queues", - "$ref": "#/definitions/Metrics" - }, - "MinuteMetrics": { - "description": "a summary of request statistics grouped by API in minute aggregates for queues", - "$ref": "#/definitions/Metrics" - }, - "Cors": { - "description": "The set of CORS rules.", - "type": "array", - "items": { - "$ref": "#/definitions/CorsRule", - "xml": { - "name": "CorsRule" - } - }, - "xml": { - "wrapped": true - } - } - } - }, - "StorageServiceStats": { - "description": "Stats for the storage service.", - "type": "object", - "properties": { - "GeoReplication": { - "description": "Geo-Replication information for the Secondary Storage Service", - "$ref": "#/definitions/GeoReplication" - } - } - } - }, - "parameters": { - "Url": { - "name": "url", - "description": "The URL of the service account, queue or message that is the targe of the desired operation.", - "required": true, - "type": "string", - "in": "path", - "x-ms-skip-url-encoding": true - }, - "ApiVersionParameter": { - "name": "x-ms-version", - "x-ms-client-name": "version", - "in": "header", - "required": true, - "type": "string", - "description": "Specifies the version of the operation to use for this request.", - "enum": [ - "2018-03-28" - ] - }, - "Body": { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "format": "file" - }, - "x-ms-parameter-location": "method", - "description": "Initial data" - }, - "QueueAcl": { - "name": "queueAcl", - "in": "body", - "schema": { - "$ref": "#/definitions/SignedIdentifiers" - }, - "x-ms-parameter-location": "method", - "description": "the acls for the queue" - }, - "ClientRequestId": { - "name": "x-ms-client-request-id", - "x-ms-client-name": "requestId", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled." - }, - "ContentLength": { - "name": "Content-Length", - "in": "header", - "required": true, - "type": "integer", - "format": "int64", - "x-ms-parameter-location": "method", - "description": "The length of the request." - }, - "ListQueuesInclude": { - "name": "include", - "in": "query", - "required": false, - "type": "array", - "collectionFormat": "csv", - "items": { - "type": "string", - "enum": [ - "metadata" - ], - "x-ms-enum": { - "name": "ListQueuesIncludeType", - "modelAsString": false - } - }, - "x-ms-parameter-location": "method", - "description": "Include this parameter to specify that the queues's metadata be returned as part of the response body." - }, - "Marker": { - "name": "marker", - "in": "query", - "required": false, - "type": "string", - "description": "A string value that identifies the portion of the list of queues to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all queues remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the client.", - "x-ms-parameter-location": "method" - }, - "MaxResults": { - "name": "maxresults", - "in": "query", - "required": false, - "type": "integer", - "minimum": 1, - "x-ms-parameter-location": "method", - "description": "Specifies the maximum number of queues to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than the default of 5000." - }, - "MessageId": { - "name": "messageid", - "in": "path", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "The message ID name." - }, - "MessageTTL": { - "name": "messagettl", - "x-ms-client-name": "MessageTimeToLive", - "in": "query", - "required": false, - "type": "integer", - "minimum": -1, - "x-ms-parameter-location": "method", - "description": "Optional. Specifies the time-to-live interval for the message, in seconds. Prior to version 2017-07-29, the maximum time-to-live allowed is 7 days. For version 2017-07-29 or later, the maximum time-to-live can be any positive number, as well as -1 indicating that the message does not expire. If this parameter is omitted, the default time-to-live is 7 days." - }, - "Metadata": { - "name": "x-ms-meta", - "x-ms-client-name": "metadata", - "in": "header", - "required": false, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Optional. Include this parameter to specify that the queue's metadata be returned as part of the response body. Note that metadata requested with this parameter must be stored in accordance with the naming restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata names must adhere to the naming conventions for C# identifiers.", - "x-ms-header-collection-prefix": "x-ms-meta-" - }, - "NumOfMessages": { - "name": "numofmessages", - "x-ms-client-name": "numberOfMessages", - "in": "query", - "required": false, - "type": "integer", - "minimum": 1, - "x-ms-parameter-location": "method", - "description": "Optional. A nonzero integer value that specifies the number of messages to retrieve from the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single message is retrieved from the queue with this operation." - }, - "PopReceipt": { - "name": "popreceipt", - "x-ms-client-name": "popReceipt", - "in": "query", - "required": true, - "x-ms-parameter-location": "method", - "description": "Required. Specifies the valid pop receipt value returned from an earlier call to the Get Messages or Update Message operation.", - "type": "string" - }, - "Prefix": { - "name": "prefix", - "in": "query", - "required": false, - "type": "string", - "description": "Filters the results to return only queues whose name begins with the specified prefix.", - "x-ms-parameter-location": "method" - }, - "QueueMessage": { - "name": "QueueMessage", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/QueueMessage" - }, - "x-ms-parameter-location": "method", - "description": "A Message object which can be stored in a Queue" - }, - "QueueName": { - "name": "queueName", - "in": "path", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "The queue name." - }, - "StorageServiceProperties": { - "name": "StorageServiceProperties", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/StorageServiceProperties" - }, - "x-ms-parameter-location": "method", - "description": "The StorageService properties." - }, - "Timeout": { - "name": "timeout", - "in": "query", - "required": false, - "type": "integer", - "minimum": 0, - "x-ms-parameter-location": "method", - "description": "The The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for Queue Service Operations." - }, - "VisibilityTimeout": { - "name": "visibilitytimeout", - "in": "query", - "required": false, - "type": "integer", - "minimum": 0, - "maximum": 604800, - "x-ms-parameter-location": "method", - "description": "Optional. Specifies the new visibility timeout value, in seconds, relative to server time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility timeout of a message can be set to a value later than the expiry time." - }, - "VisibilityTimeoutRequired": { - "name": "visibilitytimeout", - "in": "query", - "required": true, - "type": "integer", - "minimum": 0, - "maximum": 604800, - "x-ms-parameter-location": "method", - "description": "Optional. Specifies the new visibility timeout value, in seconds, relative to server time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility timeout of a message can be set to a value later than the expiry time." - } - } -} \ No newline at end of file diff --git a/sdk/storage/ci.yml b/sdk/storage/ci.yml index 4279cde3364c..40c02c4a8975 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -36,9 +36,19 @@ stages: Artifacts: - name: azure-storage-common safeName: azurestoragecommon + stagingProfileId: 88192f04117501 - name: azure-storage-blob safeName: azurestorageblob + stagingProfileId: 88192f04117501 + - name: azure-storage-blob-cryptography + safeName: azurestorageblobcryptography + stagingProfileId: 88192f04117501 - name: azure-storage-file safeName: azurestoragefile + stagingProfileId: 88192f04117501 - name: azure-storage-queue safeName: azurestoragequeue + stagingProfileId: 88192f04117501 + - name: azure-storage-queue-cryptography + safeName: azurestoragequeuecryptography + stagingProfileId: 88192f04117501 diff --git a/sdk/storage/microsoft-azure-storage-blob/README.md b/sdk/storage/microsoft-azure-storage-blob/README.md index 0e3e9f986828..c62b4a02cb4b 100644 --- a/sdk/storage/microsoft-azure-storage-blob/README.md +++ b/sdk/storage/microsoft-azure-storage-blob/README.md @@ -186,3 +186,5 @@ When sending pull requests, please send non-breaking PRs to the dev branch and b * [Azure Storage Service](http://azure.microsoft.com/en-us/documentation/services/storage/) * [Azure Storage Team Blog](http://blogs.msdn.com/b/windowsazurestorage/) * [Javadoc](http://azure.github.io/azure-storage-java/) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/storage/microsoft-azure-storage-blob/README.png) \ No newline at end of file diff --git a/sdk/storage/microsoft-azure-storage-blob/pom.xml b/sdk/storage/microsoft-azure-storage-blob/pom.xml index b852348c1a7e..e6da30b6d061 100644 --- a/sdk/storage/microsoft-azure-storage-blob/pom.xml +++ b/sdk/storage/microsoft-azure-storage-blob/pom.xml @@ -9,7 +9,7 @@ com.azure azure-data-sdk-parent - 1.1.0 + 1.2.0 ../../../pom.data.xml diff --git a/sdk/storage/pom.service.xml b/sdk/storage/pom.service.xml index 6f995e563f24..20933185a462 100644 --- a/sdk/storage/pom.service.xml +++ b/sdk/storage/pom.service.xml @@ -12,10 +12,13 @@ ../core/azure-core ../core/azure-core-test + ../core/azure-core-http-netty ../identity/azure-identity azure-storage-common azure-storage-blob + azure-storage-blob-cryptography azure-storage-file azure-storage-queue + azure-storage-queue-cryptography diff --git a/sdk/storage/tests.yml b/sdk/storage/tests.yml index 846f46380ee6..64b94afb6d6b 100644 --- a/sdk/storage/tests.yml +++ b/sdk/storage/tests.yml @@ -6,7 +6,9 @@ jobs: ServiceDirectory: storage EnvVars: AZURE_TEST_MODE: RECORD - MICROSOFT_AD_TENANT_ID: $(microsoft-active-directory-tenant-id) + AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id) + AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id) + AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret) PRIMARY_STORAGE_ACCOUNT_NAME: $(java-storage-test-primary-account-name) PRIMARY_STORAGE_ACCOUNT_KEY: $(java-storage-test-primary-account-key) SECONDARY_STORAGE_ACCOUNT_NAME: $(java-storage-test-secondary-account-name) @@ -14,4 +16,9 @@ jobs: BLOB_STORAGE_ACCOUNT_NAME: $(java-storage-test-blob-account-name) BLOB_STORAGE_ACCOUNT_KEY: $(java-storage-test-blob-account-key) PREMIUM_STORAGE_ACCOUNT_NAME: $(java-storage-test-premium-account-name) - PREMIUM_STORAGE_ACCOUNT_KEY: $(java-storage-test-premium-account-key) \ No newline at end of file + PREMIUM_STORAGE_ACCOUNT_KEY: $(java-storage-test-premium-account-key) + AZURE_STORAGE_ACCESS_KEY: $(java-storage-test-access-key) + AZURE_STORAGE_FILE_ENDPOINT: $(java-storage-test-file-endpoint) + AZURE_STORAGE_FILE_CONNECTION_STRING: $(java-storage-test-file-connection-string) + AZURE_STORAGE_QUEUE_ENDPOINT: $(java-storage-test-queue-endpoint) + AZURE_STORAGE_QUEUE_CONNECTION_STRING: $(java-storage-test-queue-connection-string) diff --git a/sdk/template/azure-sdk-template/pom.xml b/sdk/template/azure-sdk-template/pom.xml index 3c5ff41f6fc2..71d6904126d7 100644 --- a/sdk/template/azure-sdk-template/pom.xml +++ b/sdk/template/azure-sdk-template/pom.xml @@ -1,17 +1,16 @@ - + 4.0.0 com.azure azure-client-sdk-parent - 1.1.0 + 1.4.0 ../../../pom.client.xml azure-sdk-template - 1.0.2-SNAPSHOT - jar + 1.0.2 Microsoft Azure SDK for Template This package contains Microsoft Azure SDK for Template. @@ -23,9 +22,16 @@
    - https://github.com/Azure/azure-sdk-for-java + + https://github.com/Azure/azure-sdk-for-java + + + com.azure + azure-core + 1.0.0-preview.5 + junit junit diff --git a/sdk/template/ci.yml b/sdk/template/ci.yml index e854b76faf06..6490793c6b4f 100644 --- a/sdk/template/ci.yml +++ b/sdk/template/ci.yml @@ -35,4 +35,5 @@ stages: ServiceDirectory: template Artifacts: - name: azure-sdk-template - safeName: azuresdktemplate \ No newline at end of file + safeName: azuresdktemplate + stagingProfileId: 88192f04117501 \ No newline at end of file diff --git a/sdk/template/pom.service.xml b/sdk/template/pom.service.xml index f8b2c05a9ef6..de45733461e2 100644 --- a/sdk/template/pom.service.xml +++ b/sdk/template/pom.service.xml @@ -9,6 +9,7 @@ pom 1.0.0 + ../core/azure-core azure-sdk-template diff --git a/sdk/tracing/README.md b/sdk/tracing/README.md index 2dcebf573318..9676eba059f7 100644 --- a/sdk/tracing/README.md +++ b/sdk/tracing/README.md @@ -17,3 +17,5 @@ This project welcomes contributions and suggestions. Most contributions require When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments. + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/tracing/README.png) \ No newline at end of file diff --git a/sdk/tracing/ci.yml b/sdk/tracing/ci.yml index 02de6fb1c6ef..bfa200bea0af 100644 --- a/sdk/tracing/ci.yml +++ b/sdk/tracing/ci.yml @@ -35,4 +35,5 @@ stages: ServiceDirectory: tracing Artifacts: - name: tracing-opentelemetry - safeName: tracingopentelemetry \ No newline at end of file + safeName: tracingopentelemetry + stagingProfileId: 88192f04117501 \ No newline at end of file diff --git a/sdk/tracing/tracing-opentelemetry/README.md b/sdk/tracing/tracing-opentelemetry/README.md index 63e6bf28991f..32f1ffca0789 100644 --- a/sdk/tracing/tracing-opentelemetry/README.md +++ b/sdk/tracing/tracing-opentelemetry/README.md @@ -11,3 +11,5 @@ ## Next steps ## Contributing + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java/sdk/tracing/tracing-opentelemetry/README.png) \ No newline at end of file diff --git a/sdk/tracing/tracing-opentelemetry/pom.xml b/sdk/tracing/tracing-opentelemetry/pom.xml index 220311356e4a..9b67ad80a0cc 100644 --- a/sdk/tracing/tracing-opentelemetry/pom.xml +++ b/sdk/tracing/tracing-opentelemetry/pom.xml @@ -6,13 +6,13 @@ com.azure azure-client-sdk-parent - 1.3.0 + 1.4.0 ../../../pom.client.xml com.azure tracing-opentelemetry - 1.0.0-preview.2 + 1.0.0-preview.3 Microsoft Azure OpenTelemetry tracing plugin This package contains the OpenTelemetry tracing plugin for Azure client libraries. @@ -35,7 +35,7 @@ com.azure azure-core - 1.0.0-preview.4 + 1.0.0-preview.5 io.opencensus diff --git a/sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/OpenTelemetryHttpPolicy.java b/sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/OpenTelemetryHttpPolicy.java index 2cee6d4d66a0..783fdb1d0a6e 100644 --- a/sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/OpenTelemetryHttpPolicy.java +++ b/sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/OpenTelemetryHttpPolicy.java @@ -11,6 +11,7 @@ import com.azure.core.http.policy.HttpPipelinePolicy; import com.azure.core.implementation.http.policy.spi.AfterRetryPolicyProvider; import com.azure.core.implementation.util.ImplUtils; +import com.azure.tracing.opentelemetry.implementation.HttpTraceUtil; import io.opencensus.trace.AttributeValue; import io.opencensus.trace.Span; import io.opencensus.trace.Span.Kind; @@ -40,7 +41,8 @@ public HttpPipelinePolicy create() { // Singleton OpenTelemetry tracer capable of starting and exporting spans. private static final Tracer TRACER = Tracing.getTracer(); - private static final String OPENTELEMETRY_SPAN_KEY = com.azure.core.implementation.tracing.Tracer.OPENTELEMETRY_SPAN_KEY; + private static final String OPENTELEMETRY_SPAN_KEY = + com.azure.core.implementation.tracing.Tracer.OPENTELEMETRY_SPAN_KEY; // standard attributes with http call information private static final String HTTP_USER_AGENT = "http.user_agent"; @@ -49,16 +51,17 @@ public HttpPipelinePolicy create() { private static final String HTTP_STATUS_CODE = "http.status_code"; private static final String REQUEST_ID = "x-ms-request-id"; - // This helper class implements W3C distributed tracing protocol and injects SpanContext into the outgoing http request + // This helper class implements W3C distributed tracing protocol and injects SpanContext into the outgoing http + // request private final TextFormat traceContextFormat = Tracing.getPropagationComponent().getTraceContextFormat(); @Override public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { Span parentSpan = (Span) context.getData(OPENTELEMETRY_SPAN_KEY).orElse(TRACER.getCurrentSpan()); - HttpRequest request = context.httpRequest(); + HttpRequest request = context.getHttpRequest(); // Build new child span representing this outgoing request. - SpanBuilder spanBuilder = TRACER.spanBuilderWithExplicitParent(request.url().getPath(), parentSpan); + SpanBuilder spanBuilder = TRACER.spanBuilderWithExplicitParent(request.getUrl().getPath(), parentSpan); // A span's kind can be SERVER (incoming request) or CLIENT (outgoing request); useful for Gantt chart spanBuilder.setSpanKind(Kind.CLIENT); @@ -84,9 +87,9 @@ public Mono process(HttpPipelineCallContext context, HttpPipelineN } private static void addSpanRequestAttributes(Span span, HttpRequest request) { - putAttributeIfNotEmptyOrNull(span, HTTP_USER_AGENT, request.headers().value("User-Agent")); - putAttributeIfNotEmptyOrNull(span, HTTP_METHOD, request.httpMethod().toString()); - putAttributeIfNotEmptyOrNull(span, HTTP_URL, request.url().toString()); + putAttributeIfNotEmptyOrNull(span, HTTP_USER_AGENT, request.getHeaders().value("User-Agent")); + putAttributeIfNotEmptyOrNull(span, HTTP_METHOD, request.getHttpMethod().toString()); + putAttributeIfNotEmptyOrNull(span, HTTP_URL, request.getUrl().toString()); } private static void putAttributeIfNotEmptyOrNull(Span span, String key, String value) { @@ -124,7 +127,7 @@ private static void handleResponse(Signal signal) { error = signal.getThrowable(); if (error instanceof HttpResponseException) { HttpResponseException exception = (HttpResponseException) error; - httpResponse = exception.response(); + httpResponse = exception.getResponse(); } } @@ -142,8 +145,8 @@ private static void spanEnd(Span span, HttpResponse response, Throwable error) { int statusCode = 0; String requestId = null; if (response != null) { - statusCode = response.statusCode(); - requestId = response.headerValue(REQUEST_ID); + statusCode = response.getStatusCode(); + requestId = response.getHeaderValue(REQUEST_ID); } putAttributeIfNotEmptyOrNull(span, REQUEST_ID, requestId); @@ -159,7 +162,7 @@ private static void spanEnd(Span span, HttpResponse response, Throwable error) { private final TextFormat.Setter contextSetter = new TextFormat.Setter() { @Override public void put(HttpRequest request, String key, String value) { - request.header(key, value); + request.setHeader(key, value); } }; } diff --git a/sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/OpenTelemetryTracer.java b/sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/OpenTelemetryTracer.java index 5d6058a6ecde..76361566e134 100644 --- a/sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/OpenTelemetryTracer.java +++ b/sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/OpenTelemetryTracer.java @@ -3,26 +3,38 @@ package com.azure.tracing.opentelemetry; -import com.azure.core.util.logging.ClientLogger; +import com.azure.core.implementation.tracing.ProcessKind; import com.azure.core.implementation.util.ImplUtils; import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.tracing.opentelemetry.implementation.AmqpPropagationFormatUtil; +import com.azure.tracing.opentelemetry.implementation.AmqpTraceUtil; +import com.azure.tracing.opentelemetry.implementation.HttpTraceUtil; import io.opencensus.trace.AttributeValue; +import io.opencensus.trace.Link; import io.opencensus.trace.Span; import io.opencensus.trace.Span.Options; import io.opencensus.trace.SpanBuilder; +import io.opencensus.trace.SpanContext; import io.opencensus.trace.Tracer; import io.opencensus.trace.Tracing; +import java.util.Locale; import java.util.Optional; +import static io.opencensus.trace.Link.Type.PARENT_LINKED_SPAN; + /** * OpenTelemetry span */ public class OpenTelemetryTracer implements com.azure.core.implementation.tracing.Tracer { // Singleton OpenTelemetry tracer capable of starting and exporting spans. private static final Tracer TRACER = Tracing.getTracer(); - private static final String OPENTELEMETRY_SPAN_KEY = com.azure.core.implementation.tracing.Tracer.OPENTELEMETRY_SPAN_KEY; - private static final String OPENTELEMETRY_SPAN_NAME_KEY = com.azure.core.implementation.tracing.Tracer.OPENTELEMETRY_SPAN_NAME_KEY; + + // standard attributes with AMQP call information + private static final String COMPONENT = "component"; + private static final String MESSAGE_BUS_DESTINATION = "message_bus.destination"; + private static final String PEER_ENDPOINT = "peer.address"; private final ClientLogger logger = new ClientLogger(OpenTelemetryTracer.class); @@ -38,19 +50,43 @@ public Context start(String methodName, Context context) { } @Override - public void end(int responseCode, Throwable throwable, Context context) { - Optional spanOptional = context.getData(OPENTELEMETRY_SPAN_KEY); - if (spanOptional.isPresent()) { - Span span = (Span) spanOptional.get(); + public Context start(String spanName, Context context, ProcessKind processKind) { + Span span; + SpanBuilder spanBuilder; + switch (processKind) { + case SEND: + spanBuilder = startSpanWithExplicitParent(spanName, context); + span = spanBuilder.setSpanKind(Span.Kind.CLIENT).startSpan(); + if (span.getOptions().contains(Span.Options.RECORD_EVENTS)) { + // If span is sampled in, add additional TRACING attributes + addSpanRequestAttributes(span, context, spanName); + } + return context.addData(OPENTELEMETRY_SPAN_KEY, span); + case RECEIVE: + spanBuilder = startSpanWithExplicitParent(spanName, context); + span = spanBuilder.startSpan(); + // Add diagnostic Id to Context + context = setContextData(span); + return context.addData(OPENTELEMETRY_SPAN_KEY, span); + case PROCESS: + return startScopedSpan(spanName, context); + default: + return Context.NONE; + } + } - if (span.getOptions().contains(Options.RECORD_EVENTS)) { - span.setStatus(HttpTraceUtil.parseResponseStatus(responseCode, throwable)); - } + @Override + public void end(int responseCode, Throwable throwable, Context context) { + final Span span = getSpan(context); + if (span == null) { + return; + } - span.end(); - } else { - logger.warning("Failed to find span to end it."); + if (span.getOptions().contains(Options.RECORD_EVENTS)) { + span.setStatus(HttpTraceUtil.parseResponseStatus(responseCode, throwable)); } + + span.end(); } @Override @@ -60,9 +96,8 @@ public void setAttribute(String key, String value, Context context) { return; } - Optional spanOptional = context.getData(OPENTELEMETRY_SPAN_KEY); - if (spanOptional.isPresent()) { - Span span = (Span) spanOptional.get(); + final Span span = getSpan(context); + if (span != null) { span.putAttribute(key, AttributeValue.stringAttributeValue(value)); } else { logger.warning("Failed to find span to add attribute."); @@ -73,4 +108,133 @@ public void setAttribute(String key, String value, Context context) { public Context setSpanName(String spanName, Context context) { return context.addData(OPENTELEMETRY_SPAN_NAME_KEY, spanName); } + + @Override + public void end(String statusMessage, Throwable throwable, Context context) { + final Span span = getSpan(context); + if (span == null) { + logger.warning("Failed to find span to end it."); + return; + } + + if (span.getOptions().contains(Options.RECORD_EVENTS)) { + span.setStatus(AmqpTraceUtil.parseStatusMessage(statusMessage, throwable)); + } + + span.end(); + } + + @Override + public void addLink(Context eventContext) { + final Span span = getSpan(eventContext); + if (span == null) { + logger.warning("Failed to find span to link it."); + return; + } + + final Optional spanContextOptional = eventContext.getData(SPAN_CONTEXT); + if (!spanContextOptional.isPresent()) { + logger.warning("Failed to find Span context to link it."); + return; + } else if (!(spanContextOptional.get() instanceof SpanContext)) { + logger.warning("Context in event is not of type SpanContext. Actual: {}", + spanContextOptional.get().getClass()); + return; + } + + final SpanContext spanContext = (SpanContext) spanContextOptional.get(); + + // TODO: Needs to be updated with Open Telemetry support to addLink using Span Context before span is started + // and no link type is needed. + span.addLink(Link.fromSpanContext(spanContext, PARENT_LINKED_SPAN)); + } + + @Override + public Context extractContext(String diagnosticId, Context context) { + return AmqpPropagationFormatUtil.extractContext(diagnosticId, context); + } + + private Context startScopedSpan(String spanName, Context context) { + Span span; + Optional optionalSpanContext = context.getData(SPAN_CONTEXT); + if (optionalSpanContext.isPresent() && optionalSpanContext.get() instanceof SpanContext) { + span = startSpanWithRemoteParent(spanName, (SpanContext) optionalSpanContext.get()); + } else { + SpanBuilder spanBuilder = startSpanWithExplicitParent(spanName, context); + span = spanBuilder.setSpanKind(Span.Kind.SERVER).startSpan(); + } + return context.addData(OPENTELEMETRY_SPAN_KEY, span).addData("scope", TRACER.withSpan(span)); + } + + private SpanBuilder startSpanWithExplicitParent(String spanName, Context context) { + Optional optionalSpanKey = context.getData(OPENTELEMETRY_SPAN_KEY); + Optional optionalSpanNameKey = context.getData(OPENTELEMETRY_SPAN_NAME_KEY); + Span parentSpan = null; + String spanNameKey = null; + + if (optionalSpanKey.get() instanceof Span && optionalSpanNameKey.get() instanceof String) { + parentSpan = (Span) context.getData(OPENTELEMETRY_SPAN_KEY).orElse(TRACER.getCurrentSpan()); + spanNameKey = (String) context.getData(OPENTELEMETRY_SPAN_NAME_KEY).orElse(spanName); + } else { + logger.warning(String.format(Locale.US, + "Parent span type is not of type Span, but type: %s. Failed to add span links.", + optionalSpanKey.get() != null ? optionalSpanKey.get().getClass() : "null")); + } + + SpanBuilder spanBuilder = TRACER.spanBuilderWithExplicitParent(spanNameKey, parentSpan); + return spanBuilder; + } + + private Span startSpanWithRemoteParent(String spanName, SpanContext spanContext) { + SpanBuilder spanBuilder = TRACER.spanBuilderWithRemoteParent(spanName, spanContext); + spanBuilder.setSpanKind(Span.Kind.SERVER); + return spanBuilder.startSpan(); + + } + + private Context setContextData(Span span) { + final String traceparent = AmqpPropagationFormatUtil.getDiagnosticId(span.getContext()); + Context parentContext = new Context(DIAGNOSTIC_ID_KEY, traceparent).addData(SPAN_CONTEXT, span.getContext()); + return parentContext; + } + + private static void addSpanRequestAttributes(Span span, Context context, String spanName) { + if (context.getData(ENTITY_PATH).isPresent() && context.getData(HOST_NAME).isPresent()) { + span.putAttribute(COMPONENT, AttributeValue.stringAttributeValue(parseComponentValue(spanName))); + span.putAttribute( + MESSAGE_BUS_DESTINATION, + AttributeValue.stringAttributeValue(context.getData(ENTITY_PATH).get().toString())); + span.putAttribute( + PEER_ENDPOINT, + AttributeValue.stringAttributeValue(context.getData(HOST_NAME).get().toString())); + } + } + + private static String parseComponentValue(String spanName) { + return spanName.substring(spanName.indexOf(".") + 1, spanName.lastIndexOf(".")); + } + + /** + * Extracts a {@link Span} from the given {@code context}. + * + * @param context The context containing the span. + * @return The {@link Span} contained in the context, and {@code null} if it does not. + */ + private Span getSpan(Context context) { + final Optional spanOptional = context.getData(OPENTELEMETRY_SPAN_KEY); + if (!spanOptional.isPresent()) { + logger.warning("Failed to find span in the context."); + return null; + } + + final Object value = spanOptional.get(); + if (!(value instanceof Span)) { + logger.warning("Could not extract span. Data in {} is not of type Span. Actual class: {}", + OPENTELEMETRY_SPAN_KEY, + value.getClass()); + return null; + } + + return (Span) value; + } } diff --git a/sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/implementation/AmqpPropagationFormatUtil.java b/sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/implementation/AmqpPropagationFormatUtil.java new file mode 100644 index 000000000000..4061139ea0aa --- /dev/null +++ b/sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/implementation/AmqpPropagationFormatUtil.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.tracing.opentelemetry.implementation; + +import com.azure.core.util.Context; +import io.opencensus.trace.SpanContext; +import io.opencensus.trace.SpanId; +import io.opencensus.trace.TraceId; +import io.opencensus.trace.TraceOptions; +import io.opencensus.trace.Tracestate; + +import static com.azure.core.implementation.tracing.Tracer.SPAN_CONTEXT; + +public class AmqpPropagationFormatUtil { + + private AmqpPropagationFormatUtil() { } + + /** + * This method is called to extract the Span Context information from the received event's diagnostic Id. + * + * @param diagnosticId The dignostic Id providing an unique identifier for individual traces and requests + * @return {@link Context} which contains the trace context propagation data + */ + public static Context extractContext(String diagnosticId, Context context) { + return context.addData(SPAN_CONTEXT, fromDiagnosticId(diagnosticId)); + } + + /** + * The traceparent HTTP header field identifies the incoming request in a tracing system with four fields: + * version, trace-id, parent-id, trace-flags. + * + * Please refer to the Traceparent Header + * for more information on the conversion of these fields to Span Context format. + * + * @param spanContext is a specification defines an agreed-upon format for the exchange of trace context propagation + * data + * @retrun The dignostic Id providing an unique identifier for individual traces and requests, + * allowing trace data of multiple providers to be linked together. + */ + public static String getDiagnosticId(SpanContext spanContext) { + char[] chars = new char[55]; + chars[0] = '0'; + chars[1] = '0'; + chars[2] = '-'; + spanContext.getTraceId().copyLowerBase16To(chars, 3); + chars[35] = '-'; + spanContext.getSpanId().copyLowerBase16To(chars, 36); + chars[52] = '-'; + spanContext.getTraceOptions().copyLowerBase16To(chars, 53); + return new String(chars); + } + + /** + * The traceparent HTTP header field identifies the incoming request in a tracing system with four fields: + * version, trace-id, parent-id, trace-flags. + * + * Please refer to the Traceparent Header + * for more information on the conversion of these fields to Span Context format. + * + * @param diagnosticId provides a unique identifier for individual traces and requests, + * @return SpanContext is a specification defines an agreed-upon format for the exchange of trace context + * propagation data + */ + private static SpanContext fromDiagnosticId(String diagnosticId) { + if (diagnosticId == null || diagnosticId.length() < 55 || !diagnosticId.startsWith("00")) { + return SpanContext.create( + TraceId.INVALID, + SpanId.INVALID, + TraceOptions.DEFAULT, + Tracestate.builder().build()); + } + return SpanContext.create( + TraceId.fromLowerBase16(diagnosticId, 3), + SpanId.fromLowerBase16(diagnosticId, 36), + TraceOptions.fromLowerBase16(diagnosticId, 53), + Tracestate.builder().build()); + } +} diff --git a/sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/implementation/AmqpTraceUtil.java b/sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/implementation/AmqpTraceUtil.java new file mode 100644 index 000000000000..48cc2c2810d1 --- /dev/null +++ b/sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/implementation/AmqpTraceUtil.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.tracing.opentelemetry.implementation; + +import io.opencensus.trace.Status; + +public final class AmqpTraceUtil { + + private AmqpTraceUtil() { } + + /** + * Parses an OpenTelemetry Status from AMQP Error Condition. + * + * @param statusMessage AMQP description for this error condition. + * @param error the error occurred during response transmission (optional). + * @return the corresponding OpenTelemetry {@link Status}. + */ + public static Status parseStatusMessage(String statusMessage, Throwable error) { + if (error != null) { + final String message = error.getMessage(); + + return message != null + ? Status.UNKNOWN.withDescription(message) + : Status.UNKNOWN.withDescription(error.getClass().getSimpleName()); + + } else if (statusMessage.equalsIgnoreCase("success")) { + // No error. + return Status.OK; + } else { + // return status with custom error condition message + return Status.UNKNOWN.withDescription(statusMessage); + } + } +} + diff --git a/sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/HttpTraceUtil.java b/sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/implementation/HttpTraceUtil.java similarity index 98% rename from sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/HttpTraceUtil.java rename to sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/implementation/HttpTraceUtil.java index 1901b6dbb31c..6f9bd5049c66 100644 --- a/sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/HttpTraceUtil.java +++ b/sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/implementation/HttpTraceUtil.java @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.tracing.opentelemetry; +package com.azure.tracing.opentelemetry.implementation; import io.opencensus.trace.Status; -final class HttpTraceUtil { +public final class HttpTraceUtil { private static final Status STATUS_100 = Status.UNKNOWN.withDescription("Continue"); private static final Status STATUS_101 = Status.UNKNOWN.withDescription("Switching Protocols"); private static final Status STATUS_402 = Status.UNKNOWN.withDescription("Payment Required"); diff --git a/storagecache/resource-manager/v2019_08_01/pom.xml b/storagecache/resource-manager/v2019_08_01/pom.xml new file mode 100644 index 000000000000..d93b53b6098b --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.storagecache.v2019_08_01 + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-storagecache + 1.0.0-beta + jar + Microsoft Azure SDK for StorageCache Management + This package contains Microsoft StorageCache Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + 1.6.5 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
    * Copyright (c) Microsoft Corporation. All rights reserved. +
    * Licensed under the MIT License. See License.txt in the project root for +
    * license information. +
    */ + ]]> +
    +
    +
    +
    +
    +
    diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/ApiOperation.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/ApiOperation.java new file mode 100644 index 000000000000..2048bbe538e8 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/ApiOperation.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.storagecache.v2019_08_01.implementation.StorageCacheManager; +import com.microsoft.azure.management.storagecache.v2019_08_01.implementation.ApiOperationInner; + +/** + * Type representing ApiOperation. + */ +public interface ApiOperation extends HasInner, HasManager { + /** + * @return the display value. + */ + ApiOperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/ApiOperationDisplay.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/ApiOperationDisplay.java new file mode 100644 index 000000000000..060abdf7466e --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/ApiOperationDisplay.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class ApiOperationDisplay { + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Service provider: Microsoft.StorageCache. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Resource on which the operation is performed: cache, etc. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set operation type: Read, write, delete, etc. + * + * @param operation the operation value to set + * @return the ApiOperationDisplay object itself. + */ + public ApiOperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get service provider: Microsoft.StorageCache. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set service provider: Microsoft.StorageCache. + * + * @param provider the provider value to set + * @return the ApiOperationDisplay object itself. + */ + public ApiOperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get resource on which the operation is performed: cache, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource on which the operation is performed: cache, etc. + * + * @param resource the resource value to set + * @return the ApiOperationDisplay object itself. + */ + public ApiOperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/Cache.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/Cache.java new file mode 100644 index 000000000000..cc771188f876 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/Cache.java @@ -0,0 +1,224 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.storagecache.v2019_08_01.implementation.StorageCacheManager; +import java.util.List; +import com.microsoft.azure.management.storagecache.v2019_08_01.implementation.CacheInner; + +/** + * Type representing Cache. + */ +public interface Cache extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the cacheSizeGB value. + */ + Integer cacheSizeGB(); + + /** + * @return the health value. + */ + CacheHealth health(); + + /** + * @return the mountAddresses value. + */ + List mountAddresses(); + + /** + * @return the provisioningState value. + */ + ProvisioningStateType provisioningState(); + + /** + * @return the sku value. + */ + CacheSku sku(); + + /** + * @return the subnet value. + */ + String subnet(); + + /** + * @return the upgradeStatus value. + */ + CacheUpgradeStatus upgradeStatus(); + + /** + * The entirety of the Cache definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of Cache definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Cache definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the Cache definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the cache definition allowing to specify CacheSizeGB. + */ + interface WithCacheSizeGB { + /** + * Specifies cacheSizeGB. + * @param cacheSizeGB The size of this cache's cache, in GB + * @return the next definition stage + */ + WithCreate withCacheSizeGB(Integer cacheSizeGB); + } + + /** + * The stage of the cache definition allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState ARM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Creating', 'Deleting', 'Updating' + * @return the next definition stage + */ + WithCreate withProvisioningState(ProvisioningStateType provisioningState); + } + + /** + * The stage of the cache definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku Sku for the cache + * @return the next definition stage + */ + WithCreate withSku(CacheSku sku); + } + + /** + * The stage of the cache definition allowing to specify Subnet. + */ + interface WithSubnet { + /** + * Specifies subnet. + * @param subnet Subnet used for the cache + * @return the next definition stage + */ + WithCreate withSubnet(String subnet); + } + + /** + * The stage of the cache definition allowing to specify UpgradeStatus. + */ + interface WithUpgradeStatus { + /** + * Specifies upgradeStatus. + * @param upgradeStatus Upgrade status of the cache + * @return the next definition stage + */ + WithCreate withUpgradeStatus(CacheUpgradeStatus upgradeStatus); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithCacheSizeGB, DefinitionStages.WithProvisioningState, DefinitionStages.WithSku, DefinitionStages.WithSubnet, DefinitionStages.WithUpgradeStatus { + } + } + /** + * The template for a Cache update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithCacheSizeGB, UpdateStages.WithProvisioningState, UpdateStages.WithSku, UpdateStages.WithSubnet, UpdateStages.WithUpgradeStatus { + } + + /** + * Grouping of Cache update stages. + */ + interface UpdateStages { + /** + * The stage of the cache update allowing to specify CacheSizeGB. + */ + interface WithCacheSizeGB { + /** + * Specifies cacheSizeGB. + * @param cacheSizeGB The size of this cache's cache, in GB + * @return the next update stage + */ + Update withCacheSizeGB(Integer cacheSizeGB); + } + + /** + * The stage of the cache update allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState ARM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Creating', 'Deleting', 'Updating' + * @return the next update stage + */ + Update withProvisioningState(ProvisioningStateType provisioningState); + } + + /** + * The stage of the cache update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku Sku for the cache + * @return the next update stage + */ + Update withSku(CacheSku sku); + } + + /** + * The stage of the cache update allowing to specify Subnet. + */ + interface WithSubnet { + /** + * Specifies subnet. + * @param subnet Subnet used for the cache + * @return the next update stage + */ + Update withSubnet(String subnet); + } + + /** + * The stage of the cache update allowing to specify UpgradeStatus. + */ + interface WithUpgradeStatus { + /** + * Specifies upgradeStatus. + * @param upgradeStatus Upgrade status of the cache + * @return the next update stage + */ + Update withUpgradeStatus(CacheUpgradeStatus upgradeStatus); + } + + } +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/CacheHealth.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/CacheHealth.java new file mode 100644 index 000000000000..edb8ef725485 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/CacheHealth.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An indication of cache health. Gives more information about health than + * just that related to provisioning. + */ +public class CacheHealth { + /** + * List of cache health states. Possible values include: 'Unknown', + * 'Healthy', 'Degraded', 'Down', 'Transitioning', 'Stopping', 'Stopped', + * 'Upgrading', 'Flushing'. + */ + @JsonProperty(value = "state") + private HealthStateType state; + + /** + * Describes explanation of state. + */ + @JsonProperty(value = "statusDescription") + private String statusDescription; + + /** + * Get list of cache health states. Possible values include: 'Unknown', 'Healthy', 'Degraded', 'Down', 'Transitioning', 'Stopping', 'Stopped', 'Upgrading', 'Flushing'. + * + * @return the state value + */ + public HealthStateType state() { + return this.state; + } + + /** + * Set list of cache health states. Possible values include: 'Unknown', 'Healthy', 'Degraded', 'Down', 'Transitioning', 'Stopping', 'Stopped', 'Upgrading', 'Flushing'. + * + * @param state the state value to set + * @return the CacheHealth object itself. + */ + public CacheHealth withState(HealthStateType state) { + this.state = state; + return this; + } + + /** + * Get describes explanation of state. + * + * @return the statusDescription value + */ + public String statusDescription() { + return this.statusDescription; + } + + /** + * Set describes explanation of state. + * + * @param statusDescription the statusDescription value to set + * @return the CacheHealth object itself. + */ + public CacheHealth withStatusDescription(String statusDescription) { + this.statusDescription = statusDescription; + return this; + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/CacheSku.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/CacheSku.java new file mode 100644 index 000000000000..09309993beea --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/CacheSku.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Sku for the cache. + */ +public class CacheSku { + /** + * Sku name for this cache. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get sku name for this cache. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set sku name for this cache. + * + * @param name the name value to set + * @return the CacheSku object itself. + */ + public CacheSku withName(String name) { + this.name = name; + return this; + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/CacheUpgradeStatus.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/CacheUpgradeStatus.java new file mode 100644 index 000000000000..a3349f7d8e09 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/CacheUpgradeStatus.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties describing the software upgrade state of the cache. + */ +public class CacheUpgradeStatus { + /** + * Version string of the firmware currently installed on this cache. + */ + @JsonProperty(value = "currentFirmwareVersion", access = JsonProperty.Access.WRITE_ONLY) + private String currentFirmwareVersion; + + /** + * True if there is a firmware update ready to install on this cache. The + * firmware will automatically be installed after firmwareUpdateDeadline if + * not triggered earlier via the upgrade operation. Possible values + * include: 'available', 'unavailable'. + */ + @JsonProperty(value = "firmwareUpdateStatus", access = JsonProperty.Access.WRITE_ONLY) + private FirmwareStatusType firmwareUpdateStatus; + + /** + * Time at which the pending firmware update will automatically be + * installed on the cache. + */ + @JsonProperty(value = "firmwareUpdateDeadline", access = JsonProperty.Access.WRITE_ONLY) + private DateTime firmwareUpdateDeadline; + + /** + * Time of the last successful firmware update. + */ + @JsonProperty(value = "lastFirmwareUpdate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastFirmwareUpdate; + + /** + * When firmwareUpdateAvailable is true, this field holds the version + * string for the update. + */ + @JsonProperty(value = "pendingFirmwareVersion", access = JsonProperty.Access.WRITE_ONLY) + private String pendingFirmwareVersion; + + /** + * Get version string of the firmware currently installed on this cache. + * + * @return the currentFirmwareVersion value + */ + public String currentFirmwareVersion() { + return this.currentFirmwareVersion; + } + + /** + * Get true if there is a firmware update ready to install on this cache. The firmware will automatically be installed after firmwareUpdateDeadline if not triggered earlier via the upgrade operation. Possible values include: 'available', 'unavailable'. + * + * @return the firmwareUpdateStatus value + */ + public FirmwareStatusType firmwareUpdateStatus() { + return this.firmwareUpdateStatus; + } + + /** + * Get time at which the pending firmware update will automatically be installed on the cache. + * + * @return the firmwareUpdateDeadline value + */ + public DateTime firmwareUpdateDeadline() { + return this.firmwareUpdateDeadline; + } + + /** + * Get time of the last successful firmware update. + * + * @return the lastFirmwareUpdate value + */ + public DateTime lastFirmwareUpdate() { + return this.lastFirmwareUpdate; + } + + /** + * Get when firmwareUpdateAvailable is true, this field holds the version string for the update. + * + * @return the pendingFirmwareVersion value + */ + public String pendingFirmwareVersion() { + return this.pendingFirmwareVersion; + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/Caches.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/Caches.java new file mode 100644 index 000000000000..9c418e7edc0d --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/Caches.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.storagecache.v2019_08_01.implementation.CachesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Caches. + */ +public interface Caches extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Tells a cache to write all dirty data to the StorageTarget(s). During the flush, clients will see errors returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable flushAsync(String resourceGroupName, String cacheName); + + /** + * Tells a Stopped state cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable startAsync(String resourceGroupName, String cacheName); + + /** + * Tells an Active cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable stopAsync(String resourceGroupName, String cacheName); + + /** + * Tells a cache to upgrade its firmware. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable upgradeFirmwareAsync(String resourceGroupName, String cacheName); + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/ClfsTarget.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/ClfsTarget.java new file mode 100644 index 000000000000..e6ba08393b2a --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/ClfsTarget.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Storage container for use as a CLFS StorageTarget. + */ +public class ClfsTarget { + /** + * URL of storage container. + */ + @JsonProperty(value = "target") + private String target; + + /** + * Get uRL of storage container. + * + * @return the target value + */ + public String target() { + return this.target; + } + + /** + * Set uRL of storage container. + * + * @param target the target value to set + * @return the ClfsTarget object itself. + */ + public ClfsTarget withTarget(String target) { + this.target = target; + return this; + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/CloudError.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/CloudError.java new file mode 100644 index 000000000000..5cea55dd3cd0 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/CloudError.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An error response. + */ +public class CloudError { + /** + * The body of the error. + */ + @JsonProperty(value = "error") + private CloudErrorBody error; + + /** + * Get the body of the error. + * + * @return the error value + */ + public CloudErrorBody error() { + return this.error; + } + + /** + * Set the body of the error. + * + * @param error the error value to set + * @return the CloudError object itself. + */ + public CloudError withError(CloudErrorBody error) { + this.error = error; + return this; + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/CloudErrorBody.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/CloudErrorBody.java new file mode 100644 index 000000000000..a8342cb95af7 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/CloudErrorBody.java @@ -0,0 +1,125 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An error response. + */ +public class CloudErrorBody { + /** + * An identifier for the error. Codes are invariant and are intended to be + * consumed programmatically. + */ + @JsonProperty(value = "code") + private String code; + + /** + * A list of additional details about the error. + */ + @JsonProperty(value = "details") + private List details; + + /** + * A message describing the error, intended to be suitable for display in a + * user interface. + */ + @JsonProperty(value = "message") + private String message; + + /** + * The target of the particular error. For example, the name of the + * property in error. + */ + @JsonProperty(value = "target") + private String target; + + /** + * Get an identifier for the error. Codes are invariant and are intended to be consumed programmatically. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set an identifier for the error. Codes are invariant and are intended to be consumed programmatically. + * + * @param code the code value to set + * @return the CloudErrorBody object itself. + */ + public CloudErrorBody withCode(String code) { + this.code = code; + return this; + } + + /** + * Get a list of additional details about the error. + * + * @return the details value + */ + public List details() { + return this.details; + } + + /** + * Set a list of additional details about the error. + * + * @param details the details value to set + * @return the CloudErrorBody object itself. + */ + public CloudErrorBody withDetails(List details) { + this.details = details; + return this; + } + + /** + * Get a message describing the error, intended to be suitable for display in a user interface. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set a message describing the error, intended to be suitable for display in a user interface. + * + * @param message the message value to set + * @return the CloudErrorBody object itself. + */ + public CloudErrorBody withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the target of the particular error. For example, the name of the property in error. + * + * @return the target value + */ + public String target() { + return this.target; + } + + /** + * Set the target of the particular error. For example, the name of the property in error. + * + * @param target the target value to set + * @return the CloudErrorBody object itself. + */ + public CloudErrorBody withTarget(String target) { + this.target = target; + return this; + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/FirmwareStatusType.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/FirmwareStatusType.java new file mode 100644 index 000000000000..6d9d5666fa76 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/FirmwareStatusType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for FirmwareStatusType. + */ +public final class FirmwareStatusType extends ExpandableStringEnum { + /** Static value available for FirmwareStatusType. */ + public static final FirmwareStatusType AVAILABLE = fromString("available"); + + /** Static value unavailable for FirmwareStatusType. */ + public static final FirmwareStatusType UNAVAILABLE = fromString("unavailable"); + + /** + * Creates or finds a FirmwareStatusType from its string representation. + * @param name a name to look for + * @return the corresponding FirmwareStatusType + */ + @JsonCreator + public static FirmwareStatusType fromString(String name) { + return fromString(name, FirmwareStatusType.class); + } + + /** + * @return known FirmwareStatusType values + */ + public static Collection values() { + return values(FirmwareStatusType.class); + } +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/HealthStateType.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/HealthStateType.java new file mode 100644 index 000000000000..b232e52a7548 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/HealthStateType.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for HealthStateType. + */ +public final class HealthStateType extends ExpandableStringEnum { + /** Static value Unknown for HealthStateType. */ + public static final HealthStateType UNKNOWN = fromString("Unknown"); + + /** Static value Healthy for HealthStateType. */ + public static final HealthStateType HEALTHY = fromString("Healthy"); + + /** Static value Degraded for HealthStateType. */ + public static final HealthStateType DEGRADED = fromString("Degraded"); + + /** Static value Down for HealthStateType. */ + public static final HealthStateType DOWN = fromString("Down"); + + /** Static value Transitioning for HealthStateType. */ + public static final HealthStateType TRANSITIONING = fromString("Transitioning"); + + /** Static value Stopping for HealthStateType. */ + public static final HealthStateType STOPPING = fromString("Stopping"); + + /** Static value Stopped for HealthStateType. */ + public static final HealthStateType STOPPED = fromString("Stopped"); + + /** Static value Upgrading for HealthStateType. */ + public static final HealthStateType UPGRADING = fromString("Upgrading"); + + /** Static value Flushing for HealthStateType. */ + public static final HealthStateType FLUSHING = fromString("Flushing"); + + /** + * Creates or finds a HealthStateType from its string representation. + * @param name a name to look for + * @return the corresponding HealthStateType + */ + @JsonCreator + public static HealthStateType fromString(String name) { + return fromString(name, HealthStateType.class); + } + + /** + * @return known HealthStateType values + */ + public static Collection values() { + return values(HealthStateType.class); + } +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/NamespaceJunction.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/NamespaceJunction.java new file mode 100644 index 000000000000..1ab67e74236c --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/NamespaceJunction.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A namespace junction. + */ +public class NamespaceJunction { + /** + * Namespace path on a cache for a storage target. + */ + @JsonProperty(value = "namespacePath") + private String namespacePath; + + /** + * Path in storage target to which namespacePath points. + */ + @JsonProperty(value = "targetPath") + private String targetPath; + + /** + * NFS export where targetPath exists. + */ + @JsonProperty(value = "nfsExport") + private String nfsExport; + + /** + * Get namespace path on a cache for a storage target. + * + * @return the namespacePath value + */ + public String namespacePath() { + return this.namespacePath; + } + + /** + * Set namespace path on a cache for a storage target. + * + * @param namespacePath the namespacePath value to set + * @return the NamespaceJunction object itself. + */ + public NamespaceJunction withNamespacePath(String namespacePath) { + this.namespacePath = namespacePath; + return this; + } + + /** + * Get path in storage target to which namespacePath points. + * + * @return the targetPath value + */ + public String targetPath() { + return this.targetPath; + } + + /** + * Set path in storage target to which namespacePath points. + * + * @param targetPath the targetPath value to set + * @return the NamespaceJunction object itself. + */ + public NamespaceJunction withTargetPath(String targetPath) { + this.targetPath = targetPath; + return this; + } + + /** + * Get nFS export where targetPath exists. + * + * @return the nfsExport value + */ + public String nfsExport() { + return this.nfsExport; + } + + /** + * Set nFS export where targetPath exists. + * + * @param nfsExport the nfsExport value to set + * @return the NamespaceJunction object itself. + */ + public NamespaceJunction withNfsExport(String nfsExport) { + this.nfsExport = nfsExport; + return this; + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/Nfs3Target.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/Nfs3Target.java new file mode 100644 index 000000000000..c4402d70897f --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/Nfs3Target.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An NFS mount point for use as a StorageTarget. + */ +public class Nfs3Target { + /** + * IP or name of an NFS Storage Target host, ie: 10.0.44.44. + */ + @JsonProperty(value = "target") + private String target; + + /** + * Identifies the primary usage model to be used for this storage target. + * GET choices from .../usageModels. + */ + @JsonProperty(value = "usageModel") + private String usageModel; + + /** + * Get iP or name of an NFS Storage Target host, ie: 10.0.44.44. + * + * @return the target value + */ + public String target() { + return this.target; + } + + /** + * Set iP or name of an NFS Storage Target host, ie: 10.0.44.44. + * + * @param target the target value to set + * @return the Nfs3Target object itself. + */ + public Nfs3Target withTarget(String target) { + this.target = target; + return this; + } + + /** + * Get identifies the primary usage model to be used for this storage target. GET choices from .../usageModels. + * + * @return the usageModel value + */ + public String usageModel() { + return this.usageModel; + } + + /** + * Set identifies the primary usage model to be used for this storage target. GET choices from .../usageModels. + * + * @param usageModel the usageModel value to set + * @return the Nfs3Target object itself. + */ + public Nfs3Target withUsageModel(String usageModel) { + this.usageModel = usageModel; + return this; + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/Operations.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/Operations.java new file mode 100644 index 000000000000..1d66158d7f0e --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import rx.Observable; +import com.microsoft.azure.management.storagecache.v2019_08_01.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available RP operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/ProvisioningStateType.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/ProvisioningStateType.java new file mode 100644 index 000000000000..f6eef1af4190 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/ProvisioningStateType.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ProvisioningStateType. + */ +public final class ProvisioningStateType extends ExpandableStringEnum { + /** Static value Succeeded for ProvisioningStateType. */ + public static final ProvisioningStateType SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningStateType. */ + public static final ProvisioningStateType FAILED = fromString("Failed"); + + /** Static value Cancelled for ProvisioningStateType. */ + public static final ProvisioningStateType CANCELLED = fromString("Cancelled"); + + /** Static value Creating for ProvisioningStateType. */ + public static final ProvisioningStateType CREATING = fromString("Creating"); + + /** Static value Deleting for ProvisioningStateType. */ + public static final ProvisioningStateType DELETING = fromString("Deleting"); + + /** Static value Updating for ProvisioningStateType. */ + public static final ProvisioningStateType UPDATING = fromString("Updating"); + + /** + * Creates or finds a ProvisioningStateType from its string representation. + * @param name a name to look for + * @return the corresponding ProvisioningStateType + */ + @JsonCreator + public static ProvisioningStateType fromString(String name) { + return fromString(name, ProvisioningStateType.class); + } + + /** + * @return known ProvisioningStateType values + */ + public static Collection values() { + return values(ProvisioningStateType.class); + } +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/ReasonCode.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/ReasonCode.java new file mode 100644 index 000000000000..d5dfb48715de --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/ReasonCode.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ReasonCode. + */ +public final class ReasonCode extends ExpandableStringEnum { + /** Static value QuotaId for ReasonCode. */ + public static final ReasonCode QUOTA_ID = fromString("QuotaId"); + + /** Static value NotAvailableForSubscription for ReasonCode. */ + public static final ReasonCode NOT_AVAILABLE_FOR_SUBSCRIPTION = fromString("NotAvailableForSubscription"); + + /** + * Creates or finds a ReasonCode from its string representation. + * @param name a name to look for + * @return the corresponding ReasonCode + */ + @JsonCreator + public static ReasonCode fromString(String name) { + return fromString(name, ReasonCode.class); + } + + /** + * @return known ReasonCode values + */ + public static Collection values() { + return values(ReasonCode.class); + } +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/ResourceSku.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/ResourceSku.java new file mode 100644 index 000000000000..9ae7a6b940dd --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/ResourceSku.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.storagecache.v2019_08_01.implementation.ResourceSkuInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.storagecache.v2019_08_01.implementation.StorageCacheManager; +import java.util.List; + +/** + * Type representing ResourceSku. + */ +public interface ResourceSku extends HasInner, HasManager { + /** + * @return the capabilities value. + */ + List capabilities(); + + /** + * @return the locationInfo value. + */ + List locationInfo(); + + /** + * @return the locations value. + */ + List locations(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resourceType value. + */ + String resourceType(); + + /** + * @return the restrictions value. + */ + List restrictions(); + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/ResourceSkuCapabilities.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/ResourceSkuCapabilities.java new file mode 100644 index 000000000000..238610664b03 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/ResourceSkuCapabilities.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A resource SKU capability. + */ +public class ResourceSkuCapabilities { + /** + * Name of a capability, such as ops/sec. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Quantity, if the capability is measured by quantity. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get name of a capability, such as ops/sec. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of a capability, such as ops/sec. + * + * @param name the name value to set + * @return the ResourceSkuCapabilities object itself. + */ + public ResourceSkuCapabilities withName(String name) { + this.name = name; + return this; + } + + /** + * Get quantity, if the capability is measured by quantity. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set quantity, if the capability is measured by quantity. + * + * @param value the value value to set + * @return the ResourceSkuCapabilities object itself. + */ + public ResourceSkuCapabilities withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/ResourceSkuLocationInfo.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/ResourceSkuLocationInfo.java new file mode 100644 index 000000000000..ee5f7fc2ea92 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/ResourceSkuLocationInfo.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Resource SKU location information. + */ +public class ResourceSkuLocationInfo { + /** + * Location where this Sku is available. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Zones if any. + */ + @JsonProperty(value = "zones") + private List zones; + + /** + * Get location where this Sku is available. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set location where this Sku is available. + * + * @param location the location value to set + * @return the ResourceSkuLocationInfo object itself. + */ + public ResourceSkuLocationInfo withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get zones if any. + * + * @return the zones value + */ + public List zones() { + return this.zones; + } + + /** + * Set zones if any. + * + * @param zones the zones value to set + * @return the ResourceSkuLocationInfo object itself. + */ + public ResourceSkuLocationInfo withZones(List zones) { + this.zones = zones; + return this; + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/Restriction.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/Restriction.java new file mode 100644 index 000000000000..08a46d4bcd9e --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/Restriction.java @@ -0,0 +1,80 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The restriction because of which SKU cannot be used. + */ +public class Restriction { + /** + * The type of restrictions. As of now only possible value for this is + * location. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * The value of restrictions. If the restriction type is set to location. + * This would be different locations where the SKU is restricted. + */ + @JsonProperty(value = "values", access = JsonProperty.Access.WRITE_ONLY) + private List values; + + /** + * The reason for the restriction. As of now this can be "QuotaId" or + * "NotAvailableForSubscription". Quota Id is set when the SKU has + * requiredQuotas parameter as the subscription does not belong to that + * quota. The "NotAvailableForSubscription" is related to capacity at DC. + * Possible values include: 'QuotaId', 'NotAvailableForSubscription'. + */ + @JsonProperty(value = "reasonCode") + private ReasonCode reasonCode; + + /** + * Get the type of restrictions. As of now only possible value for this is location. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. + * + * @return the values value + */ + public List values() { + return this.values; + } + + /** + * Get the reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to capacity at DC. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. + * + * @return the reasonCode value + */ + public ReasonCode reasonCode() { + return this.reasonCode; + } + + /** + * Set the reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". Quota Id is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. The "NotAvailableForSubscription" is related to capacity at DC. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. + * + * @param reasonCode the reasonCode value to set + * @return the Restriction object itself. + */ + public Restriction withReasonCode(ReasonCode reasonCode) { + this.reasonCode = reasonCode; + return this; + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/Skus.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/Skus.java new file mode 100644 index 000000000000..3ce706d8ef48 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/Skus.java @@ -0,0 +1,19 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.storagecache.v2019_08_01.implementation.SkusInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Skus. + */ +public interface Skus extends SupportsListing, HasInner { +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/StorageTarget.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/StorageTarget.java new file mode 100644 index 000000000000..386131ca3149 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/StorageTarget.java @@ -0,0 +1,263 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.storagecache.v2019_08_01.implementation.StorageTargetInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.storagecache.v2019_08_01.implementation.StorageCacheManager; +import java.util.List; + +/** + * Type representing StorageTarget. + */ +public interface StorageTarget extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the clfs value. + */ + ClfsTarget clfs(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the junctions value. + */ + List junctions(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the nfs3 value. + */ + Nfs3Target nfs3(); + + /** + * @return the provisioningState value. + */ + ProvisioningStateType provisioningState(); + + /** + * @return the targetType value. + */ + StorageTargetType targetType(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the unknown value. + */ + UnknownTarget unknown(); + + /** + * The entirety of the StorageTarget definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCach, DefinitionStages.WithCreate { + } + + /** + * Grouping of StorageTarget definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a StorageTarget definition. + */ + interface Blank extends WithCach { + } + + /** + * The stage of the storagetarget definition allowing to specify Cach. + */ + interface WithCach { + /** + * Specifies resourceGroupName, cacheName. + * @param resourceGroupName Target resource group + * @param cacheName Name of cache + * @return the next definition stage + */ + WithCreate withExistingCach(String resourceGroupName, String cacheName); + } + + /** + * The stage of the storagetarget definition allowing to specify Clfs. + */ + interface WithClfs { + /** + * Specifies clfs. + * @param clfs Properties when clfs target + * @return the next definition stage + */ + WithCreate withClfs(ClfsTarget clfs); + } + + /** + * The stage of the storagetarget definition allowing to specify Junctions. + */ + interface WithJunctions { + /** + * Specifies junctions. + * @param junctions List of cache namespace to target namespace associations + * @return the next definition stage + */ + WithCreate withJunctions(List junctions); + } + + /** + * The stage of the storagetarget definition allowing to specify Nfs3. + */ + interface WithNfs3 { + /** + * Specifies nfs3. + * @param nfs3 Properties when nfs3 target + * @return the next definition stage + */ + WithCreate withNfs3(Nfs3Target nfs3); + } + + /** + * The stage of the storagetarget definition allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState ARM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Creating', 'Deleting', 'Updating' + * @return the next definition stage + */ + WithCreate withProvisioningState(ProvisioningStateType provisioningState); + } + + /** + * The stage of the storagetarget definition allowing to specify TargetType. + */ + interface WithTargetType { + /** + * Specifies targetType. + * @param targetType Type for storage target. Possible values include: 'nfs3', 'clfs', 'unknown' + * @return the next definition stage + */ + WithCreate withTargetType(StorageTargetType targetType); + } + + /** + * The stage of the storagetarget definition allowing to specify Unknown. + */ + interface WithUnknown { + /** + * Specifies unknown. + * @param unknown Properties when unknown target + * @return the next definition stage + */ + WithCreate withUnknown(UnknownTarget unknown); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithClfs, DefinitionStages.WithJunctions, DefinitionStages.WithNfs3, DefinitionStages.WithProvisioningState, DefinitionStages.WithTargetType, DefinitionStages.WithUnknown { + } + } + /** + * The template for a StorageTarget update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithClfs, UpdateStages.WithJunctions, UpdateStages.WithNfs3, UpdateStages.WithProvisioningState, UpdateStages.WithTargetType, UpdateStages.WithUnknown { + } + + /** + * Grouping of StorageTarget update stages. + */ + interface UpdateStages { + /** + * The stage of the storagetarget update allowing to specify Clfs. + */ + interface WithClfs { + /** + * Specifies clfs. + * @param clfs Properties when clfs target + * @return the next update stage + */ + Update withClfs(ClfsTarget clfs); + } + + /** + * The stage of the storagetarget update allowing to specify Junctions. + */ + interface WithJunctions { + /** + * Specifies junctions. + * @param junctions List of cache namespace to target namespace associations + * @return the next update stage + */ + Update withJunctions(List junctions); + } + + /** + * The stage of the storagetarget update allowing to specify Nfs3. + */ + interface WithNfs3 { + /** + * Specifies nfs3. + * @param nfs3 Properties when nfs3 target + * @return the next update stage + */ + Update withNfs3(Nfs3Target nfs3); + } + + /** + * The stage of the storagetarget update allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState ARM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Creating', 'Deleting', 'Updating' + * @return the next update stage + */ + Update withProvisioningState(ProvisioningStateType provisioningState); + } + + /** + * The stage of the storagetarget update allowing to specify TargetType. + */ + interface WithTargetType { + /** + * Specifies targetType. + * @param targetType Type for storage target. Possible values include: 'nfs3', 'clfs', 'unknown' + * @return the next update stage + */ + Update withTargetType(StorageTargetType targetType); + } + + /** + * The stage of the storagetarget update allowing to specify Unknown. + */ + interface WithUnknown { + /** + * Specifies unknown. + * @param unknown Properties when unknown target + * @return the next update stage + */ + Update withUnknown(UnknownTarget unknown); + } + + } +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/StorageTargetType.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/StorageTargetType.java new file mode 100644 index 000000000000..f375c6af1f0c --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/StorageTargetType.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for StorageTargetType. + */ +public final class StorageTargetType extends ExpandableStringEnum { + /** Static value nfs3 for StorageTargetType. */ + public static final StorageTargetType NFS3 = fromString("nfs3"); + + /** Static value clfs for StorageTargetType. */ + public static final StorageTargetType CLFS = fromString("clfs"); + + /** Static value unknown for StorageTargetType. */ + public static final StorageTargetType UNKNOWN = fromString("unknown"); + + /** + * Creates or finds a StorageTargetType from its string representation. + * @param name a name to look for + * @return the corresponding StorageTargetType + */ + @JsonCreator + public static StorageTargetType fromString(String name) { + return fromString(name, StorageTargetType.class); + } + + /** + * @return known StorageTargetType values + */ + public static Collection values() { + return values(StorageTargetType.class); + } +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/StorageTargets.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/StorageTargets.java new file mode 100644 index 000000000000..aa8ca0c3a764 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/StorageTargets.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.storagecache.v2019_08_01.implementation.StorageTargetsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing StorageTargets. + */ +public interface StorageTargets extends SupportsCreating, HasInner { + /** + * Returns a storage target from a cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String cacheName, String storageTargetName); + + /** + * Returns the StorageTargets for this cache in the subscription and resource group. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByCacheAsync(final String resourceGroupName, final String cacheName); + + /** + * Removes a storage target from a cache. This operation is allowed at any time, but if the cache is down or unhealthy, the actual removal of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String cacheName, String storageTargetName); + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/UnknownTarget.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/UnknownTarget.java new file mode 100644 index 000000000000..7e3ad3b0b36d --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/UnknownTarget.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Storage container for use as a Unknown StorageTarget. + */ +public class UnknownTarget { + /** + * Dictionary of string->string pairs containing information about the + * StorageTarget. + */ + @JsonProperty(value = "unknownMap") + private Map unknownMap; + + /** + * Get dictionary of string->string pairs containing information about the StorageTarget. + * + * @return the unknownMap value + */ + public Map unknownMap() { + return this.unknownMap; + } + + /** + * Set dictionary of string->string pairs containing information about the StorageTarget. + * + * @param unknownMap the unknownMap value to set + * @return the UnknownTarget object itself. + */ + public UnknownTarget withUnknownMap(Map unknownMap) { + this.unknownMap = unknownMap; + return this; + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/UsageModel.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/UsageModel.java new file mode 100644 index 000000000000..7b13ecbc0076 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/UsageModel.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.storagecache.v2019_08_01.implementation.UsageModelInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.storagecache.v2019_08_01.implementation.StorageCacheManager; + +/** + * Type representing UsageModel. + */ +public interface UsageModel extends HasInner, HasManager { + /** + * @return the display value. + */ + UsageModelDisplay display(); + + /** + * @return the modelName value. + */ + String modelName(); + + /** + * @return the targetType value. + */ + String targetType(); + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/UsageModelDisplay.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/UsageModelDisplay.java new file mode 100644 index 000000000000..f582b61ef5b6 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/UsageModelDisplay.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Localized information describing this usage model. + */ +public class UsageModelDisplay { + /** + * String to display for this usage model. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get string to display for this usage model. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set string to display for this usage model. + * + * @param description the description value to set + * @return the UsageModelDisplay object itself. + */ + public UsageModelDisplay withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/UsageModels.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/UsageModels.java new file mode 100644 index 000000000000..95b99317b021 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/UsageModels.java @@ -0,0 +1,19 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01; + +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.storagecache.v2019_08_01.implementation.UsageModelsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing UsageModels. + */ +public interface UsageModels extends SupportsListing, HasInner { +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/ApiOperationImpl.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/ApiOperationImpl.java new file mode 100644 index 000000000000..44fc4ca586bc --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/ApiOperationImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; + +import com.microsoft.azure.management.storagecache.v2019_08_01.ApiOperation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.storagecache.v2019_08_01.ApiOperationDisplay; + +class ApiOperationImpl extends WrapperImpl implements ApiOperation { + private final StorageCacheManager manager; + ApiOperationImpl(ApiOperationInner inner, StorageCacheManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public StorageCacheManager manager() { + return this.manager; + } + + @Override + public ApiOperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/ApiOperationInner.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/ApiOperationInner.java new file mode 100644 index 000000000000..1cbddf4eb318 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/ApiOperationInner.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; + +import com.microsoft.azure.management.storagecache.v2019_08_01.ApiOperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * REST API operation description: see + * https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/openapi-authoring-automated-guidelines.md#r3023-operationsapiimplementation. + */ +public class ApiOperationInner { + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private ApiOperationDisplay display; + + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public ApiOperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the ApiOperationInner object itself. + */ + public ApiOperationInner withDisplay(ApiOperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the ApiOperationInner object itself. + */ + public ApiOperationInner withName(String name) { + this.name = name; + return this; + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/CacheImpl.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/CacheImpl.java new file mode 100644 index 000000000000..5f91a4df5f0b --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/CacheImpl.java @@ -0,0 +1,116 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.storagecache.v2019_08_01.Cache; +import rx.Observable; +import com.microsoft.azure.management.storagecache.v2019_08_01.CacheHealth; +import java.util.List; +import com.microsoft.azure.management.storagecache.v2019_08_01.ProvisioningStateType; +import com.microsoft.azure.management.storagecache.v2019_08_01.CacheUpgradeStatus; +import com.microsoft.azure.management.storagecache.v2019_08_01.CacheSku; + +class CacheImpl extends GroupableResourceCoreImpl implements Cache, Cache.Definition, Cache.Update { + CacheImpl(String name, CacheInner inner, StorageCacheManager manager) { + super(name, inner, manager); + } + + @Override + public Observable createResourceAsync() { + CachesInner client = this.manager().inner().caches(); + return client.createAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + CachesInner client = this.manager().inner().caches(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + CachesInner client = this.manager().inner().caches(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public Integer cacheSizeGB() { + return this.inner().cacheSizeGB(); + } + + @Override + public CacheHealth health() { + return this.inner().health(); + } + + @Override + public List mountAddresses() { + return this.inner().mountAddresses(); + } + + @Override + public ProvisioningStateType provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public CacheSku sku() { + return this.inner().sku(); + } + + @Override + public String subnet() { + return this.inner().subnet(); + } + + @Override + public CacheUpgradeStatus upgradeStatus() { + return this.inner().upgradeStatus(); + } + + @Override + public CacheImpl withCacheSizeGB(Integer cacheSizeGB) { + this.inner().withCacheSizeGB(cacheSizeGB); + return this; + } + + @Override + public CacheImpl withProvisioningState(ProvisioningStateType provisioningState) { + this.inner().withProvisioningState(provisioningState); + return this; + } + + @Override + public CacheImpl withSku(CacheSku sku) { + this.inner().withSku(sku); + return this; + } + + @Override + public CacheImpl withSubnet(String subnet) { + this.inner().withSubnet(subnet); + return this; + } + + @Override + public CacheImpl withUpgradeStatus(CacheUpgradeStatus upgradeStatus) { + this.inner().withUpgradeStatus(upgradeStatus); + return this; + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/CacheInner.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/CacheInner.java new file mode 100644 index 000000000000..81d2a36de88d --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/CacheInner.java @@ -0,0 +1,189 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; + +import com.microsoft.azure.management.storagecache.v2019_08_01.CacheHealth; +import java.util.List; +import com.microsoft.azure.management.storagecache.v2019_08_01.ProvisioningStateType; +import com.microsoft.azure.management.storagecache.v2019_08_01.CacheUpgradeStatus; +import com.microsoft.azure.management.storagecache.v2019_08_01.CacheSku; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * A cache instance. Follows Azure Resource Manager standards: + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md. + */ +@JsonFlatten +public class CacheInner extends Resource { + /** + * The size of this cache's cache, in GB. + */ + @JsonProperty(value = "properties.cacheSizeGB") + private Integer cacheSizeGB; + + /** + * Health of the cache. + */ + @JsonProperty(value = "properties.health", access = JsonProperty.Access.WRITE_ONLY) + private CacheHealth health; + + /** + * Array of IP addresses that can be used by clients mounting this Cache. + */ + @JsonProperty(value = "properties.mountAddresses", access = JsonProperty.Access.WRITE_ONLY) + private List mountAddresses; + + /** + * ARM provisioning state, see + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. + * Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Creating', + * 'Deleting', 'Updating'. + */ + @JsonProperty(value = "properties.provisioningState") + private ProvisioningStateType provisioningState; + + /** + * Subnet used for the cache. + */ + @JsonProperty(value = "properties.subnet") + private String subnet; + + /** + * Upgrade status of the cache. + */ + @JsonProperty(value = "properties.upgradeStatus") + private CacheUpgradeStatus upgradeStatus; + + /** + * Sku for the cache. + */ + @JsonProperty(value = "sku") + private CacheSku sku; + + /** + * Get the size of this cache's cache, in GB. + * + * @return the cacheSizeGB value + */ + public Integer cacheSizeGB() { + return this.cacheSizeGB; + } + + /** + * Set the size of this cache's cache, in GB. + * + * @param cacheSizeGB the cacheSizeGB value to set + * @return the CacheInner object itself. + */ + public CacheInner withCacheSizeGB(Integer cacheSizeGB) { + this.cacheSizeGB = cacheSizeGB; + return this; + } + + /** + * Get health of the cache. + * + * @return the health value + */ + public CacheHealth health() { + return this.health; + } + + /** + * Get array of IP addresses that can be used by clients mounting this Cache. + * + * @return the mountAddresses value + */ + public List mountAddresses() { + return this.mountAddresses; + } + + /** + * Get aRM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Creating', 'Deleting', 'Updating'. + * + * @return the provisioningState value + */ + public ProvisioningStateType provisioningState() { + return this.provisioningState; + } + + /** + * Set aRM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Creating', 'Deleting', 'Updating'. + * + * @param provisioningState the provisioningState value to set + * @return the CacheInner object itself. + */ + public CacheInner withProvisioningState(ProvisioningStateType provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get subnet used for the cache. + * + * @return the subnet value + */ + public String subnet() { + return this.subnet; + } + + /** + * Set subnet used for the cache. + * + * @param subnet the subnet value to set + * @return the CacheInner object itself. + */ + public CacheInner withSubnet(String subnet) { + this.subnet = subnet; + return this; + } + + /** + * Get upgrade status of the cache. + * + * @return the upgradeStatus value + */ + public CacheUpgradeStatus upgradeStatus() { + return this.upgradeStatus; + } + + /** + * Set upgrade status of the cache. + * + * @param upgradeStatus the upgradeStatus value to set + * @return the CacheInner object itself. + */ + public CacheInner withUpgradeStatus(CacheUpgradeStatus upgradeStatus) { + this.upgradeStatus = upgradeStatus; + return this; + } + + /** + * Get sku for the cache. + * + * @return the sku value + */ + public CacheSku sku() { + return this.sku; + } + + /** + * Set sku for the cache. + * + * @param sku the sku value to set + * @return the CacheInner object itself. + */ + public CacheInner withSku(CacheSku sku) { + this.sku = sku; + return this; + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/CachesImpl.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/CachesImpl.java new file mode 100644 index 000000000000..1ade4a6cae30 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/CachesImpl.java @@ -0,0 +1,162 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * def + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.storagecache.v2019_08_01.Caches; +import com.microsoft.azure.management.storagecache.v2019_08_01.Cache; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; + +class CachesImpl extends GroupableResourcesCoreImpl implements Caches { + protected CachesImpl(StorageCacheManager manager) { + super(manager.inner().caches(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + CachesInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + CachesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + CachesInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + CachesInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Cache call(CacheInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + CachesInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + CachesInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Cache call(CacheInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public CacheImpl define(String name) { + return wrapModel(name); + } + + @Override + public Observable flushAsync(String resourceGroupName, String cacheName) { + CachesInner client = this.inner(); + return client.flushAsync(resourceGroupName, cacheName) + ;} + + @Override + public Observable startAsync(String resourceGroupName, String cacheName) { + CachesInner client = this.inner(); + return client.startAsync(resourceGroupName, cacheName) + ;} + + @Override + public Observable stopAsync(String resourceGroupName, String cacheName) { + CachesInner client = this.inner(); + return client.stopAsync(resourceGroupName, cacheName) + ;} + + @Override + public Observable upgradeFirmwareAsync(String resourceGroupName, String cacheName) { + CachesInner client = this.inner(); + return client.upgradeFirmwareAsync(resourceGroupName, cacheName) + ;} + + @Override + protected CacheImpl wrapModel(CacheInner inner) { + return new CacheImpl(inner.name(), inner, manager()); + } + + @Override + protected CacheImpl wrapModel(String name) { + return new CacheImpl(name, new CacheInner(), this.manager()); + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/CachesInner.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/CachesInner.java new file mode 100644 index 000000000000..8a3bfb89ee33 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/CachesInner.java @@ -0,0 +1,1940 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Caches. + */ +public class CachesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private CachesService service; + /** The service client containing this operation class. */ + private StorageCacheMgmtClientImpl client; + + /** + * Initializes an instance of CachesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CachesInner(Retrofit retrofit, StorageCacheMgmtClientImpl client) { + this.service = retrofit.create(CachesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Caches to be + * used by Retrofit to perform actually REST calls. + */ + interface CachesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.Caches list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/caches") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.Caches listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.Caches delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("cacheName") String cacheName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.Caches beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("cacheName") String cacheName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.Caches getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("cacheName") String cacheName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.Caches create" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}") + Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("cacheName") String cacheName, @Query("api-version") String apiVersion, @Body CacheInner cache, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.Caches beginCreate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}") + Observable> beginCreate(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("cacheName") String cacheName, @Query("api-version") String apiVersion, @Body CacheInner cache, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.Caches update" }) + @PATCH("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("cacheName") String cacheName, @Query("api-version") String apiVersion, @Body CacheInner cache, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.Caches flush" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush") + Observable> flush(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("cacheName") String cacheName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.Caches beginFlush" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush") + Observable> beginFlush(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("cacheName") String cacheName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.Caches start" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start") + Observable> start(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("cacheName") String cacheName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.Caches beginStart" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start") + Observable> beginStart(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("cacheName") String cacheName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.Caches stop" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop") + Observable> stop(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("cacheName") String cacheName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.Caches beginStop" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop") + Observable> beginStop(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("cacheName") String cacheName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.Caches upgradeFirmware" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade") + Observable> upgradeFirmware(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("cacheName") String cacheName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.Caches beginUpgradeFirmware" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade") + Observable> beginUpgradeFirmware(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("cacheName") String cacheName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.Caches listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.Caches listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Returns all Caches the user has access to under a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<CacheInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Returns all Caches the user has access to under a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Returns all Caches the user has access to under a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CacheInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns all Caches the user has access to under a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CacheInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Returns all Caches the user has access to under a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CacheInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns all Caches the user has access to under a resource group and subscription. + * + * @param resourceGroupName Target resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<CacheInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Returns all Caches the user has access to under a resource group and subscription. + * + * @param resourceGroupName Target resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Returns all Caches the user has access to under a resource group and subscription. + * + * @param resourceGroupName Target resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CacheInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns all Caches the user has access to under a resource group and subscription. + * + * @param resourceGroupName Target resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CacheInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Returns all Caches the user has access to under a resource group and subscription. + * + ServiceResponse> * @param resourceGroupName Target resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CacheInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Schedules a Cache for deletion. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Object object if successful. + */ + public Object delete(String resourceGroupName, String cacheName) { + return deleteWithServiceResponseAsync(resourceGroupName, cacheName).toBlocking().last().body(); + } + + /** + * Schedules a Cache for deletion. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String cacheName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, cacheName), serviceCallback); + } + + /** + * Schedules a Cache for deletion. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String cacheName) { + return deleteWithServiceResponseAsync(resourceGroupName, cacheName).map(new Func1, Object>() { + @Override + public Object call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Schedules a Cache for deletion. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String cacheName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, cacheName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Schedules a Cache for deletion. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Object object if successful. + */ + public Object beginDelete(String resourceGroupName, String cacheName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, cacheName).toBlocking().single().body(); + } + + /** + * Schedules a Cache for deletion. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String cacheName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, cacheName), serviceCallback); + } + + /** + * Schedules a Cache for deletion. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Object object + */ + public Observable beginDeleteAsync(String resourceGroupName, String cacheName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, cacheName).map(new Func1, Object>() { + @Override + public Object call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Schedules a Cache for deletion. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Object object + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String cacheName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, cacheName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CacheInner object if successful. + */ + public CacheInner getByResourceGroup(String resourceGroupName, String cacheName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, cacheName).toBlocking().single().body(); + } + + /** + * Returns a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String cacheName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, cacheName), serviceCallback); + } + + /** + * Returns a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CacheInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String cacheName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, cacheName).map(new Func1, CacheInner>() { + @Override + public CacheInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns a Cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CacheInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String cacheName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(resourceGroupName, cacheName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Create/update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CacheInner object if successful. + */ + public CacheInner create(String resourceGroupName, String cacheName) { + return createWithServiceResponseAsync(resourceGroupName, cacheName).toBlocking().last().body(); + } + + /** + * Create/update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String resourceGroupName, String cacheName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, cacheName), serviceCallback); + } + + /** + * Create/update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String cacheName) { + return createWithServiceResponseAsync(resourceGroupName, cacheName).map(new Func1, CacheInner>() { + @Override + public CacheInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create/update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String cacheName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final CacheInner cache = null; + Observable> observable = service.create(resourceGroupName, this.client.subscriptionId(), cacheName, this.client.apiVersion(), cache, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Create/update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param cache Object containing the user selectable properties of the new cache. If read-only properties are included, they must match the existing values of those properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CacheInner object if successful. + */ + public CacheInner create(String resourceGroupName, String cacheName, CacheInner cache) { + return createWithServiceResponseAsync(resourceGroupName, cacheName, cache).toBlocking().last().body(); + } + + /** + * Create/update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param cache Object containing the user selectable properties of the new cache. If read-only properties are included, they must match the existing values of those properties. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String resourceGroupName, String cacheName, CacheInner cache, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, cacheName, cache), serviceCallback); + } + + /** + * Create/update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param cache Object containing the user selectable properties of the new cache. If read-only properties are included, they must match the existing values of those properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String cacheName, CacheInner cache) { + return createWithServiceResponseAsync(resourceGroupName, cacheName, cache).map(new Func1, CacheInner>() { + @Override + public CacheInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create/update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param cache Object containing the user selectable properties of the new cache. If read-only properties are included, they must match the existing values of those properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String cacheName, CacheInner cache) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(cache); + Observable> observable = service.create(resourceGroupName, this.client.subscriptionId(), cacheName, this.client.apiVersion(), cache, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create/update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CacheInner object if successful. + */ + public CacheInner beginCreate(String resourceGroupName, String cacheName) { + return beginCreateWithServiceResponseAsync(resourceGroupName, cacheName).toBlocking().single().body(); + } + + /** + * Create/update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateAsync(String resourceGroupName, String cacheName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, cacheName), serviceCallback); + } + + /** + * Create/update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CacheInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String cacheName) { + return beginCreateWithServiceResponseAsync(resourceGroupName, cacheName).map(new Func1, CacheInner>() { + @Override + public CacheInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create/update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CacheInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String cacheName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final CacheInner cache = null; + return service.beginCreate(resourceGroupName, this.client.subscriptionId(), cacheName, this.client.apiVersion(), cache, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Create/update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param cache Object containing the user selectable properties of the new cache. If read-only properties are included, they must match the existing values of those properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CacheInner object if successful. + */ + public CacheInner beginCreate(String resourceGroupName, String cacheName, CacheInner cache) { + return beginCreateWithServiceResponseAsync(resourceGroupName, cacheName, cache).toBlocking().single().body(); + } + + /** + * Create/update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param cache Object containing the user selectable properties of the new cache. If read-only properties are included, they must match the existing values of those properties. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateAsync(String resourceGroupName, String cacheName, CacheInner cache, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, cacheName, cache), serviceCallback); + } + + /** + * Create/update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param cache Object containing the user selectable properties of the new cache. If read-only properties are included, they must match the existing values of those properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CacheInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String cacheName, CacheInner cache) { + return beginCreateWithServiceResponseAsync(resourceGroupName, cacheName, cache).map(new Func1, CacheInner>() { + @Override + public CacheInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create/update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param cache Object containing the user selectable properties of the new cache. If read-only properties are included, they must match the existing values of those properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CacheInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String cacheName, CacheInner cache) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(cache); + return service.beginCreate(resourceGroupName, this.client.subscriptionId(), cacheName, this.client.apiVersion(), cache, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CacheInner object if successful. + */ + public CacheInner update(String resourceGroupName, String cacheName) { + return updateWithServiceResponseAsync(resourceGroupName, cacheName).toBlocking().single().body(); + } + + /** + * Update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String cacheName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, cacheName), serviceCallback); + } + + /** + * Update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CacheInner object + */ + public Observable updateAsync(String resourceGroupName, String cacheName) { + return updateWithServiceResponseAsync(resourceGroupName, cacheName).map(new Func1, CacheInner>() { + @Override + public CacheInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CacheInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String cacheName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final CacheInner cache = null; + return service.update(resourceGroupName, this.client.subscriptionId(), cacheName, this.client.apiVersion(), cache, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param cache Object containing the user selectable properties of the new cache. If read-only properties are included, they must match the existing values of those properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CacheInner object if successful. + */ + public CacheInner update(String resourceGroupName, String cacheName, CacheInner cache) { + return updateWithServiceResponseAsync(resourceGroupName, cacheName, cache).toBlocking().single().body(); + } + + /** + * Update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param cache Object containing the user selectable properties of the new cache. If read-only properties are included, they must match the existing values of those properties. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String cacheName, CacheInner cache, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, cacheName, cache), serviceCallback); + } + + /** + * Update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param cache Object containing the user selectable properties of the new cache. If read-only properties are included, they must match the existing values of those properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CacheInner object + */ + public Observable updateAsync(String resourceGroupName, String cacheName, CacheInner cache) { + return updateWithServiceResponseAsync(resourceGroupName, cacheName, cache).map(new Func1, CacheInner>() { + @Override + public CacheInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a Cache instance. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param cache Object containing the user selectable properties of the new cache. If read-only properties are included, they must match the existing values of those properties. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CacheInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String cacheName, CacheInner cache) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(cache); + return service.update(resourceGroupName, this.client.subscriptionId(), cacheName, this.client.apiVersion(), cache, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Tells a cache to write all dirty data to the StorageTarget(s). During the flush, clients will see errors returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Object object if successful. + */ + public Object flush(String resourceGroupName, String cacheName) { + return flushWithServiceResponseAsync(resourceGroupName, cacheName).toBlocking().last().body(); + } + + /** + * Tells a cache to write all dirty data to the StorageTarget(s). During the flush, clients will see errors returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture flushAsync(String resourceGroupName, String cacheName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(flushWithServiceResponseAsync(resourceGroupName, cacheName), serviceCallback); + } + + /** + * Tells a cache to write all dirty data to the StorageTarget(s). During the flush, clients will see errors returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable flushAsync(String resourceGroupName, String cacheName) { + return flushWithServiceResponseAsync(resourceGroupName, cacheName).map(new Func1, Object>() { + @Override + public Object call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Tells a cache to write all dirty data to the StorageTarget(s). During the flush, clients will see errors returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> flushWithServiceResponseAsync(String resourceGroupName, String cacheName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.flush(resourceGroupName, this.client.subscriptionId(), cacheName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Tells a cache to write all dirty data to the StorageTarget(s). During the flush, clients will see errors returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Object object if successful. + */ + public Object beginFlush(String resourceGroupName, String cacheName) { + return beginFlushWithServiceResponseAsync(resourceGroupName, cacheName).toBlocking().single().body(); + } + + /** + * Tells a cache to write all dirty data to the StorageTarget(s). During the flush, clients will see errors returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginFlushAsync(String resourceGroupName, String cacheName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginFlushWithServiceResponseAsync(resourceGroupName, cacheName), serviceCallback); + } + + /** + * Tells a cache to write all dirty data to the StorageTarget(s). During the flush, clients will see errors returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Object object + */ + public Observable beginFlushAsync(String resourceGroupName, String cacheName) { + return beginFlushWithServiceResponseAsync(resourceGroupName, cacheName).map(new Func1, Object>() { + @Override + public Object call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Tells a cache to write all dirty data to the StorageTarget(s). During the flush, clients will see errors returned until the flush is complete. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Object object + */ + public Observable> beginFlushWithServiceResponseAsync(String resourceGroupName, String cacheName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginFlush(resourceGroupName, this.client.subscriptionId(), cacheName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginFlushDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginFlushDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Tells a Stopped state cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Object object if successful. + */ + public Object start(String resourceGroupName, String cacheName) { + return startWithServiceResponseAsync(resourceGroupName, cacheName).toBlocking().last().body(); + } + + /** + * Tells a Stopped state cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture startAsync(String resourceGroupName, String cacheName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(startWithServiceResponseAsync(resourceGroupName, cacheName), serviceCallback); + } + + /** + * Tells a Stopped state cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable startAsync(String resourceGroupName, String cacheName) { + return startWithServiceResponseAsync(resourceGroupName, cacheName).map(new Func1, Object>() { + @Override + public Object call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Tells a Stopped state cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> startWithServiceResponseAsync(String resourceGroupName, String cacheName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.start(resourceGroupName, this.client.subscriptionId(), cacheName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Tells a Stopped state cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Object object if successful. + */ + public Object beginStart(String resourceGroupName, String cacheName) { + return beginStartWithServiceResponseAsync(resourceGroupName, cacheName).toBlocking().single().body(); + } + + /** + * Tells a Stopped state cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginStartAsync(String resourceGroupName, String cacheName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginStartWithServiceResponseAsync(resourceGroupName, cacheName), serviceCallback); + } + + /** + * Tells a Stopped state cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Object object + */ + public Observable beginStartAsync(String resourceGroupName, String cacheName) { + return beginStartWithServiceResponseAsync(resourceGroupName, cacheName).map(new Func1, Object>() { + @Override + public Object call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Tells a Stopped state cache to transition to Active state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Object object + */ + public Observable> beginStartWithServiceResponseAsync(String resourceGroupName, String cacheName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginStart(resourceGroupName, this.client.subscriptionId(), cacheName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginStartDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginStartDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Tells an Active cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Object object if successful. + */ + public Object stop(String resourceGroupName, String cacheName) { + return stopWithServiceResponseAsync(resourceGroupName, cacheName).toBlocking().last().body(); + } + + /** + * Tells an Active cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture stopAsync(String resourceGroupName, String cacheName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(stopWithServiceResponseAsync(resourceGroupName, cacheName), serviceCallback); + } + + /** + * Tells an Active cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable stopAsync(String resourceGroupName, String cacheName) { + return stopWithServiceResponseAsync(resourceGroupName, cacheName).map(new Func1, Object>() { + @Override + public Object call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Tells an Active cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> stopWithServiceResponseAsync(String resourceGroupName, String cacheName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.stop(resourceGroupName, this.client.subscriptionId(), cacheName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Tells an Active cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Object object if successful. + */ + public Object beginStop(String resourceGroupName, String cacheName) { + return beginStopWithServiceResponseAsync(resourceGroupName, cacheName).toBlocking().single().body(); + } + + /** + * Tells an Active cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginStopAsync(String resourceGroupName, String cacheName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginStopWithServiceResponseAsync(resourceGroupName, cacheName), serviceCallback); + } + + /** + * Tells an Active cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Object object + */ + public Observable beginStopAsync(String resourceGroupName, String cacheName) { + return beginStopWithServiceResponseAsync(resourceGroupName, cacheName).map(new Func1, Object>() { + @Override + public Object call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Tells an Active cache to transition to Stopped state. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Object object + */ + public Observable> beginStopWithServiceResponseAsync(String resourceGroupName, String cacheName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginStop(resourceGroupName, this.client.subscriptionId(), cacheName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginStopDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginStopDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Tells a cache to upgrade its firmware. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Object object if successful. + */ + public Object upgradeFirmware(String resourceGroupName, String cacheName) { + return upgradeFirmwareWithServiceResponseAsync(resourceGroupName, cacheName).toBlocking().last().body(); + } + + /** + * Tells a cache to upgrade its firmware. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture upgradeFirmwareAsync(String resourceGroupName, String cacheName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(upgradeFirmwareWithServiceResponseAsync(resourceGroupName, cacheName), serviceCallback); + } + + /** + * Tells a cache to upgrade its firmware. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable upgradeFirmwareAsync(String resourceGroupName, String cacheName) { + return upgradeFirmwareWithServiceResponseAsync(resourceGroupName, cacheName).map(new Func1, Object>() { + @Override + public Object call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Tells a cache to upgrade its firmware. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> upgradeFirmwareWithServiceResponseAsync(String resourceGroupName, String cacheName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.upgradeFirmware(resourceGroupName, this.client.subscriptionId(), cacheName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Tells a cache to upgrade its firmware. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Object object if successful. + */ + public Object beginUpgradeFirmware(String resourceGroupName, String cacheName) { + return beginUpgradeFirmwareWithServiceResponseAsync(resourceGroupName, cacheName).toBlocking().single().body(); + } + + /** + * Tells a cache to upgrade its firmware. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpgradeFirmwareAsync(String resourceGroupName, String cacheName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpgradeFirmwareWithServiceResponseAsync(resourceGroupName, cacheName), serviceCallback); + } + + /** + * Tells a cache to upgrade its firmware. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Object object + */ + public Observable beginUpgradeFirmwareAsync(String resourceGroupName, String cacheName) { + return beginUpgradeFirmwareWithServiceResponseAsync(resourceGroupName, cacheName).map(new Func1, Object>() { + @Override + public Object call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Tells a cache to upgrade its firmware. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Object object + */ + public Observable> beginUpgradeFirmwareWithServiceResponseAsync(String resourceGroupName, String cacheName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginUpgradeFirmware(resourceGroupName, this.client.subscriptionId(), cacheName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpgradeFirmwareDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpgradeFirmwareDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns all Caches the user has access to under a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<CacheInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Returns all Caches the user has access to under a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Returns all Caches the user has access to under a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CacheInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns all Caches the user has access to under a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CacheInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Returns all Caches the user has access to under a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CacheInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns all Caches the user has access to under a resource group and subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<CacheInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Returns all Caches the user has access to under a resource group and subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Returns all Caches the user has access to under a resource group and subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CacheInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns all Caches the user has access to under a resource group and subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CacheInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Returns all Caches the user has access to under a resource group and subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CacheInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/IdParsingUtils.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..4209dac146e3 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/OperationsImpl.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/OperationsImpl.java new file mode 100644 index 000000000000..f6d94a694980 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.storagecache.v2019_08_01.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.storagecache.v2019_08_01.ApiOperation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final StorageCacheManager manager; + + OperationsImpl(StorageCacheManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public StorageCacheManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ApiOperation call(ApiOperationInner inner) { + return new ApiOperationImpl(inner, manager()); + } + }); + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/OperationsInner.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/OperationsInner.java new file mode 100644 index 000000000000..5615cee9845a --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private StorageCacheMgmtClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, StorageCacheMgmtClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.Operations list" }) + @GET("providers/Microsoft.StorageCache/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available RP operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ApiOperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available RP operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available RP operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiOperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available RP operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiOperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available RP operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApiOperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all of the available RP operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ApiOperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available RP operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available RP operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiOperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available RP operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApiOperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available RP operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApiOperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/PageImpl.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/PageImpl.java new file mode 100644 index 000000000000..b1c946325212 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/ResourceSkuImpl.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/ResourceSkuImpl.java new file mode 100644 index 000000000000..3494fa38c011 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/ResourceSkuImpl.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; + +import com.microsoft.azure.management.storagecache.v2019_08_01.ResourceSku; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.storagecache.v2019_08_01.ResourceSkuCapabilities; +import com.microsoft.azure.management.storagecache.v2019_08_01.ResourceSkuLocationInfo; +import com.microsoft.azure.management.storagecache.v2019_08_01.Restriction; + +class ResourceSkuImpl extends WrapperImpl implements ResourceSku { + private final StorageCacheManager manager; + + ResourceSkuImpl(ResourceSkuInner inner, StorageCacheManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public StorageCacheManager manager() { + return this.manager; + } + + + + @Override + public List capabilities() { + return this.inner().capabilities(); + } + + @Override + public List locationInfo() { + return this.inner().locationInfo(); + } + + @Override + public List locations() { + return this.inner().locations(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String resourceType() { + return this.inner().resourceType(); + } + + @Override + public List restrictions() { + return this.inner().restrictions(); + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/ResourceSkuInner.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/ResourceSkuInner.java new file mode 100644 index 000000000000..348e0a7f30d0 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/ResourceSkuInner.java @@ -0,0 +1,158 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.storagecache.v2019_08_01.ResourceSkuCapabilities; +import com.microsoft.azure.management.storagecache.v2019_08_01.ResourceSkuLocationInfo; +import com.microsoft.azure.management.storagecache.v2019_08_01.Restriction; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A resource SKU. + */ +public class ResourceSkuInner { + /** + * The type of resource the sku applies to. + */ + @JsonProperty(value = "resourceType", access = JsonProperty.Access.WRITE_ONLY) + private String resourceType; + + /** + * A list of capabilities of this SKU, such as throughput or ops/sec. + */ + @JsonProperty(value = "capabilities") + private List capabilities; + + /** + * The set of locations that the SKU is available. This will be supported + * and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, + * etc.). + */ + @JsonProperty(value = "locations", access = JsonProperty.Access.WRITE_ONLY) + private List locations; + + /** + * The set of locations that the SKU is available. + */ + @JsonProperty(value = "locationInfo") + private List locationInfo; + + /** + * The name of this sku. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The restrictions because of which SKU cannot be used. This is empty if + * there are no restrictions. + */ + @JsonProperty(value = "restrictions") + private List restrictions; + + /** + * Get the type of resource the sku applies to. + * + * @return the resourceType value + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Get a list of capabilities of this SKU, such as throughput or ops/sec. + * + * @return the capabilities value + */ + public List capabilities() { + return this.capabilities; + } + + /** + * Set a list of capabilities of this SKU, such as throughput or ops/sec. + * + * @param capabilities the capabilities value to set + * @return the ResourceSkuInner object itself. + */ + public ResourceSkuInner withCapabilities(List capabilities) { + this.capabilities = capabilities; + return this; + } + + /** + * Get the set of locations that the SKU is available. This will be supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). + * + * @return the locations value + */ + public List locations() { + return this.locations; + } + + /** + * Get the set of locations that the SKU is available. + * + * @return the locationInfo value + */ + public List locationInfo() { + return this.locationInfo; + } + + /** + * Set the set of locations that the SKU is available. + * + * @param locationInfo the locationInfo value to set + * @return the ResourceSkuInner object itself. + */ + public ResourceSkuInner withLocationInfo(List locationInfo) { + this.locationInfo = locationInfo; + return this; + } + + /** + * Get the name of this sku. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of this sku. + * + * @param name the name value to set + * @return the ResourceSkuInner object itself. + */ + public ResourceSkuInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. + * + * @return the restrictions value + */ + public List restrictions() { + return this.restrictions; + } + + /** + * Set the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. + * + * @param restrictions the restrictions value to set + * @return the ResourceSkuInner object itself. + */ + public ResourceSkuInner withRestrictions(List restrictions) { + this.restrictions = restrictions; + return this; + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/SkusImpl.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/SkusImpl.java new file mode 100644 index 000000000000..210975f838ce --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/SkusImpl.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * jkl + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.storagecache.v2019_08_01.Skus; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.arm.utils.PagedListConverter; +import com.microsoft.azure.management.storagecache.v2019_08_01.ResourceSku; + +class SkusImpl extends WrapperImpl implements Skus { + private PagedListConverter converter; + private final StorageCacheManager manager; + + SkusImpl(StorageCacheManager manager) { + super(manager.inner().skus()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(ResourceSkuInner inner) { + return Observable.just((ResourceSku) wrapModel(inner)); + } + }; + } + + public StorageCacheManager manager() { + return this.manager; + } + + private ResourceSkuImpl wrapModel(ResourceSkuInner inner) { + return new ResourceSkuImpl(inner, manager()); + } + + @Override + public PagedList list() { + SkusInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + SkusInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ResourceSku call(ResourceSkuInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/SkusInner.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/SkusInner.java new file mode 100644 index 000000000000..896d7168175e --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/SkusInner.java @@ -0,0 +1,287 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Skus. + */ +public class SkusInner { + /** The Retrofit service to perform REST calls. */ + private SkusService service; + /** The service client containing this operation class. */ + private StorageCacheMgmtClientImpl client; + + /** + * Initializes an instance of SkusInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SkusInner(Retrofit retrofit, StorageCacheMgmtClientImpl client) { + this.service = retrofit.create(SkusService.class); + this.client = client; + } + + /** + * The interface defining all the services for Skus to be + * used by Retrofit to perform actually REST calls. + */ + interface SkusService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.Skus list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/skus") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.Skus listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get the list of StorageCache.Cache SKUs available to this subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ResourceSkuInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get the list of StorageCache.Cache SKUs available to this subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get the list of StorageCache.Cache SKUs available to this subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceSkuInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get the list of StorageCache.Cache SKUs available to this subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceSkuInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get the list of StorageCache.Cache SKUs available to this subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ResourceSkuInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Get the list of StorageCache.Cache SKUs available to this subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ResourceSkuInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get the list of StorageCache.Cache SKUs available to this subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get the list of StorageCache.Cache SKUs available to this subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceSkuInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get the list of StorageCache.Cache SKUs available to this subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceSkuInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get the list of StorageCache.Cache SKUs available to this subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ResourceSkuInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/StorageCacheManager.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/StorageCacheManager.java new file mode 100644 index 000000000000..afaa688b0cf6 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/StorageCacheManager.java @@ -0,0 +1,147 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.storagecache.v2019_08_01.Operations; +import com.microsoft.azure.management.storagecache.v2019_08_01.Skus; +import com.microsoft.azure.management.storagecache.v2019_08_01.UsageModels; +import com.microsoft.azure.management.storagecache.v2019_08_01.Caches; +import com.microsoft.azure.management.storagecache.v2019_08_01.StorageTargets; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure StorageCache resource management. + */ +public final class StorageCacheManager extends ManagerCore { + private Operations operations; + private Skus skus; + private UsageModels usageModels; + private Caches caches; + private StorageTargets storageTargets; + /** + * Get a Configurable instance that can be used to create StorageCacheManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new StorageCacheManager.ConfigurableImpl(); + } + /** + * Creates an instance of StorageCacheManager that exposes StorageCache resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the StorageCacheManager + */ + public static StorageCacheManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new StorageCacheManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of StorageCacheManager that exposes StorageCache resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the StorageCacheManager + */ + public static StorageCacheManager authenticate(RestClient restClient, String subscriptionId) { + return new StorageCacheManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of StorageCacheManager that exposes StorageCache management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing StorageCache management API entry points that work across subscriptions + */ + StorageCacheManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage Skus. + */ + public Skus skus() { + if (this.skus == null) { + this.skus = new SkusImpl(this); + } + return this.skus; + } + + /** + * @return Entry point to manage UsageModels. + */ + public UsageModels usageModels() { + if (this.usageModels == null) { + this.usageModels = new UsageModelsImpl(this); + } + return this.usageModels; + } + + /** + * @return Entry point to manage Caches. + */ + public Caches caches() { + if (this.caches == null) { + this.caches = new CachesImpl(this); + } + return this.caches; + } + + /** + * @return Entry point to manage StorageTargets. + */ + public StorageTargets storageTargets() { + if (this.storageTargets == null) { + this.storageTargets = new StorageTargetsImpl(this); + } + return this.storageTargets; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public StorageCacheManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return StorageCacheManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private StorageCacheManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new StorageCacheMgmtClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/StorageCacheMgmtClientImpl.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/StorageCacheMgmtClientImpl.java new file mode 100644 index 000000000000..9ffcfe75b828 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/StorageCacheMgmtClientImpl.java @@ -0,0 +1,252 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the StorageCacheMgmtClientImpl class. + */ +public class StorageCacheMgmtClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. */ + private String subscriptionId; + + /** + * Gets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public StorageCacheMgmtClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** Client Api Version. */ + private String apiVersion; + + /** + * Gets Client Api Version. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public StorageCacheMgmtClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public StorageCacheMgmtClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public StorageCacheMgmtClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The SkusInner object to access its operations. + */ + private SkusInner skus; + + /** + * Gets the SkusInner object to access its operations. + * @return the SkusInner object. + */ + public SkusInner skus() { + return this.skus; + } + + /** + * The UsageModelsInner object to access its operations. + */ + private UsageModelsInner usageModels; + + /** + * Gets the UsageModelsInner object to access its operations. + * @return the UsageModelsInner object. + */ + public UsageModelsInner usageModels() { + return this.usageModels; + } + + /** + * The CachesInner object to access its operations. + */ + private CachesInner caches; + + /** + * Gets the CachesInner object to access its operations. + * @return the CachesInner object. + */ + public CachesInner caches() { + return this.caches; + } + + /** + * The StorageTargetsInner object to access its operations. + */ + private StorageTargetsInner storageTargets; + + /** + * Gets the StorageTargetsInner object to access its operations. + * @return the StorageTargetsInner object. + */ + public StorageTargetsInner storageTargets() { + return this.storageTargets; + } + + /** + * Initializes an instance of StorageCacheMgmtClient client. + * + * @param credentials the management credentials for Azure + */ + public StorageCacheMgmtClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of StorageCacheMgmtClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public StorageCacheMgmtClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of StorageCacheMgmtClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public StorageCacheMgmtClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2019-08-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.operations = new OperationsInner(restClient().retrofit(), this); + this.skus = new SkusInner(restClient().retrofit(), this); + this.usageModels = new UsageModelsInner(restClient().retrofit(), this); + this.caches = new CachesInner(restClient().retrofit(), this); + this.storageTargets = new StorageTargetsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "StorageCacheMgmtClient", "2019-08-01-preview"); + } +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/StorageTargetImpl.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/StorageTargetImpl.java new file mode 100644 index 000000000000..776c6c906497 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/StorageTargetImpl.java @@ -0,0 +1,167 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; + +import com.microsoft.azure.management.storagecache.v2019_08_01.StorageTarget; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.storagecache.v2019_08_01.NamespaceJunction; +import com.microsoft.azure.management.storagecache.v2019_08_01.StorageTargetType; +import com.microsoft.azure.management.storagecache.v2019_08_01.ProvisioningStateType; +import com.microsoft.azure.management.storagecache.v2019_08_01.Nfs3Target; +import com.microsoft.azure.management.storagecache.v2019_08_01.ClfsTarget; +import com.microsoft.azure.management.storagecache.v2019_08_01.UnknownTarget; + +class StorageTargetImpl extends CreatableUpdatableImpl implements StorageTarget, StorageTarget.Definition, StorageTarget.Update { + private final StorageCacheManager manager; + private String resourceGroupName; + private String cacheName; + private String storageTargetName; + + StorageTargetImpl(String name, StorageCacheManager manager) { + super(name, new StorageTargetInner()); + this.manager = manager; + // Set resource name + this.storageTargetName = name; + // + } + + StorageTargetImpl(StorageTargetInner inner, StorageCacheManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.storageTargetName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourcegroups"); + this.cacheName = IdParsingUtils.getValueFromIdByName(inner.id(), "caches"); + this.storageTargetName = IdParsingUtils.getValueFromIdByName(inner.id(), "storageTargets"); + // + } + + @Override + public StorageCacheManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + StorageTargetsInner client = this.manager().inner().storageTargets(); + return client.createAsync(this.resourceGroupName, this.cacheName, this.storageTargetName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + StorageTargetsInner client = this.manager().inner().storageTargets(); + return client.updateAsync(this.resourceGroupName, this.cacheName, this.storageTargetName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + StorageTargetsInner client = this.manager().inner().storageTargets(); + return client.getAsync(this.resourceGroupName, this.cacheName, this.storageTargetName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public ClfsTarget clfs() { + return this.inner().clfs(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public List junctions() { + return this.inner().junctions(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Nfs3Target nfs3() { + return this.inner().nfs3(); + } + + @Override + public ProvisioningStateType provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public StorageTargetType targetType() { + return this.inner().targetType(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public UnknownTarget unknown() { + return this.inner().unknown(); + } + + @Override + public StorageTargetImpl withExistingCach(String resourceGroupName, String cacheName) { + this.resourceGroupName = resourceGroupName; + this.cacheName = cacheName; + return this; + } + + @Override + public StorageTargetImpl withClfs(ClfsTarget clfs) { + this.inner().withClfs(clfs); + return this; + } + + @Override + public StorageTargetImpl withJunctions(List junctions) { + this.inner().withJunctions(junctions); + return this; + } + + @Override + public StorageTargetImpl withNfs3(Nfs3Target nfs3) { + this.inner().withNfs3(nfs3); + return this; + } + + @Override + public StorageTargetImpl withProvisioningState(ProvisioningStateType provisioningState) { + this.inner().withProvisioningState(provisioningState); + return this; + } + + @Override + public StorageTargetImpl withTargetType(StorageTargetType targetType) { + this.inner().withTargetType(targetType); + return this; + } + + @Override + public StorageTargetImpl withUnknown(UnknownTarget unknown) { + this.inner().withUnknown(unknown); + return this; + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/StorageTargetInner.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/StorageTargetInner.java new file mode 100644 index 000000000000..9ec65723be01 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/StorageTargetInner.java @@ -0,0 +1,187 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.storagecache.v2019_08_01.NamespaceJunction; +import com.microsoft.azure.management.storagecache.v2019_08_01.StorageTargetType; +import com.microsoft.azure.management.storagecache.v2019_08_01.ProvisioningStateType; +import com.microsoft.azure.management.storagecache.v2019_08_01.Nfs3Target; +import com.microsoft.azure.management.storagecache.v2019_08_01.ClfsTarget; +import com.microsoft.azure.management.storagecache.v2019_08_01.UnknownTarget; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A storage system being cached by a Cache. + */ +@JsonFlatten +public class StorageTargetInner extends ProxyResource { + /** + * List of cache namespace to target namespace associations. + */ + @JsonProperty(value = "properties.junctions") + private List junctions; + + /** + * Type for storage target. Possible values include: 'nfs3', 'clfs', + * 'unknown'. + */ + @JsonProperty(value = "properties.targetType") + private StorageTargetType targetType; + + /** + * ARM provisioning state, see + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. + * Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Creating', + * 'Deleting', 'Updating'. + */ + @JsonProperty(value = "properties.provisioningState") + private ProvisioningStateType provisioningState; + + /** + * Properties when nfs3 target. + */ + @JsonProperty(value = "properties.nfs3") + private Nfs3Target nfs3; + + /** + * Properties when clfs target. + */ + @JsonProperty(value = "properties.clfs") + private ClfsTarget clfs; + + /** + * Properties when unknown target. + */ + @JsonProperty(value = "properties.unknown") + private UnknownTarget unknown; + + /** + * Get list of cache namespace to target namespace associations. + * + * @return the junctions value + */ + public List junctions() { + return this.junctions; + } + + /** + * Set list of cache namespace to target namespace associations. + * + * @param junctions the junctions value to set + * @return the StorageTargetInner object itself. + */ + public StorageTargetInner withJunctions(List junctions) { + this.junctions = junctions; + return this; + } + + /** + * Get type for storage target. Possible values include: 'nfs3', 'clfs', 'unknown'. + * + * @return the targetType value + */ + public StorageTargetType targetType() { + return this.targetType; + } + + /** + * Set type for storage target. Possible values include: 'nfs3', 'clfs', 'unknown'. + * + * @param targetType the targetType value to set + * @return the StorageTargetInner object itself. + */ + public StorageTargetInner withTargetType(StorageTargetType targetType) { + this.targetType = targetType; + return this; + } + + /** + * Get aRM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Creating', 'Deleting', 'Updating'. + * + * @return the provisioningState value + */ + public ProvisioningStateType provisioningState() { + return this.provisioningState; + } + + /** + * Set aRM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Creating', 'Deleting', 'Updating'. + * + * @param provisioningState the provisioningState value to set + * @return the StorageTargetInner object itself. + */ + public StorageTargetInner withProvisioningState(ProvisioningStateType provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get properties when nfs3 target. + * + * @return the nfs3 value + */ + public Nfs3Target nfs3() { + return this.nfs3; + } + + /** + * Set properties when nfs3 target. + * + * @param nfs3 the nfs3 value to set + * @return the StorageTargetInner object itself. + */ + public StorageTargetInner withNfs3(Nfs3Target nfs3) { + this.nfs3 = nfs3; + return this; + } + + /** + * Get properties when clfs target. + * + * @return the clfs value + */ + public ClfsTarget clfs() { + return this.clfs; + } + + /** + * Set properties when clfs target. + * + * @param clfs the clfs value to set + * @return the StorageTargetInner object itself. + */ + public StorageTargetInner withClfs(ClfsTarget clfs) { + this.clfs = clfs; + return this; + } + + /** + * Get properties when unknown target. + * + * @return the unknown value + */ + public UnknownTarget unknown() { + return this.unknown; + } + + /** + * Set properties when unknown target. + * + * @param unknown the unknown value to set + * @return the StorageTargetInner object itself. + */ + public StorageTargetInner withUnknown(UnknownTarget unknown) { + this.unknown = unknown; + return this; + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/StorageTargetsImpl.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/StorageTargetsImpl.java new file mode 100644 index 000000000000..65a8417f140c --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/StorageTargetsImpl.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.storagecache.v2019_08_01.StorageTargets; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.storagecache.v2019_08_01.StorageTarget; + +class StorageTargetsImpl extends WrapperImpl implements StorageTargets { + private final StorageCacheManager manager; + + StorageTargetsImpl(StorageCacheManager manager) { + super(manager.inner().storageTargets()); + this.manager = manager; + } + + public StorageCacheManager manager() { + return this.manager; + } + + @Override + public StorageTargetImpl define(String name) { + return wrapModel(name); + } + + private StorageTargetImpl wrapModel(StorageTargetInner inner) { + return new StorageTargetImpl(inner, manager()); + } + + private StorageTargetImpl wrapModel(String name) { + return new StorageTargetImpl(name, this.manager()); + } + + @Override + public Observable listByCacheAsync(final String resourceGroupName, final String cacheName) { + StorageTargetsInner client = this.inner(); + return client.listByCacheAsync(resourceGroupName, cacheName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public StorageTarget call(StorageTargetInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String cacheName, String storageTargetName) { + StorageTargetsInner client = this.inner(); + return client.getAsync(resourceGroupName, cacheName, storageTargetName) + .flatMap(new Func1>() { + @Override + public Observable call(StorageTargetInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((StorageTarget)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String cacheName, String storageTargetName) { + StorageTargetsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, cacheName, storageTargetName).toCompletable(); + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/StorageTargetsInner.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/StorageTargetsInner.java new file mode 100644 index 000000000000..3d3c769e5d63 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/StorageTargetsInner.java @@ -0,0 +1,1125 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in StorageTargets. + */ +public class StorageTargetsInner { + /** The Retrofit service to perform REST calls. */ + private StorageTargetsService service; + /** The service client containing this operation class. */ + private StorageCacheMgmtClientImpl client; + + /** + * Initializes an instance of StorageTargetsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public StorageTargetsInner(Retrofit retrofit, StorageCacheMgmtClientImpl client) { + this.service = retrofit.create(StorageTargetsService.class); + this.client = client; + } + + /** + * The interface defining all the services for StorageTargets to be + * used by Retrofit to perform actually REST calls. + */ + interface StorageTargetsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.StorageTargets listByCache" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets") + Observable> listByCache(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("cacheName") String cacheName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.StorageTargets delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("cacheName") String cacheName, @Path("storageTargetName") String storageTargetName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.StorageTargets beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("cacheName") String cacheName, @Path("storageTargetName") String storageTargetName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.StorageTargets get" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("cacheName") String cacheName, @Path("storageTargetName") String storageTargetName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.StorageTargets create" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}") + Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("cacheName") String cacheName, @Path("storageTargetName") String storageTargetName, @Query("api-version") String apiVersion, @Body StorageTargetInner storagetarget, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.StorageTargets beginCreate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}") + Observable> beginCreate(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("cacheName") String cacheName, @Path("storageTargetName") String storageTargetName, @Query("api-version") String apiVersion, @Body StorageTargetInner storagetarget, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.StorageTargets update" }) + @PATCH("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("cacheName") String cacheName, @Path("storageTargetName") String storageTargetName, @Query("api-version") String apiVersion, @Body StorageTargetInner storagetarget, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.StorageTargets listByCacheNext" }) + @GET + Observable> listByCacheNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Returns the StorageTargets for this cache in the subscription and resource group. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<StorageTargetInner> object if successful. + */ + public PagedList listByCache(final String resourceGroupName, final String cacheName) { + ServiceResponse> response = listByCacheSinglePageAsync(resourceGroupName, cacheName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCacheNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Returns the StorageTargets for this cache in the subscription and resource group. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByCacheAsync(final String resourceGroupName, final String cacheName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCacheSinglePageAsync(resourceGroupName, cacheName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCacheNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Returns the StorageTargets for this cache in the subscription and resource group. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<StorageTargetInner> object + */ + public Observable> listByCacheAsync(final String resourceGroupName, final String cacheName) { + return listByCacheWithServiceResponseAsync(resourceGroupName, cacheName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns the StorageTargets for this cache in the subscription and resource group. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<StorageTargetInner> object + */ + public Observable>> listByCacheWithServiceResponseAsync(final String resourceGroupName, final String cacheName) { + return listByCacheSinglePageAsync(resourceGroupName, cacheName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByCacheNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Returns the StorageTargets for this cache in the subscription and resource group. + * + ServiceResponse> * @param resourceGroupName Target resource group. + ServiceResponse> * @param cacheName Name of cache. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<StorageTargetInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCacheSinglePageAsync(final String resourceGroupName, final String cacheName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByCache(resourceGroupName, this.client.subscriptionId(), cacheName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByCacheDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByCacheDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Removes a storage target from a cache. This operation is allowed at any time, but if the cache is down or unhealthy, the actual removal of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Object object if successful. + */ + public Object delete(String resourceGroupName, String cacheName, String storageTargetName) { + return deleteWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName).toBlocking().last().body(); + } + + /** + * Removes a storage target from a cache. This operation is allowed at any time, but if the cache is down or unhealthy, the actual removal of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String cacheName, String storageTargetName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName), serviceCallback); + } + + /** + * Removes a storage target from a cache. This operation is allowed at any time, but if the cache is down or unhealthy, the actual removal of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String cacheName, String storageTargetName) { + return deleteWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName).map(new Func1, Object>() { + @Override + public Object call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Removes a storage target from a cache. This operation is allowed at any time, but if the cache is down or unhealthy, the actual removal of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String cacheName, String storageTargetName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (storageTargetName == null) { + throw new IllegalArgumentException("Parameter storageTargetName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, this.client.subscriptionId(), cacheName, storageTargetName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Removes a storage target from a cache. This operation is allowed at any time, but if the cache is down or unhealthy, the actual removal of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the Object object if successful. + */ + public Object beginDelete(String resourceGroupName, String cacheName, String storageTargetName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName).toBlocking().single().body(); + } + + /** + * Removes a storage target from a cache. This operation is allowed at any time, but if the cache is down or unhealthy, the actual removal of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String cacheName, String storageTargetName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName), serviceCallback); + } + + /** + * Removes a storage target from a cache. This operation is allowed at any time, but if the cache is down or unhealthy, the actual removal of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Object object + */ + public Observable beginDeleteAsync(String resourceGroupName, String cacheName, String storageTargetName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName).map(new Func1, Object>() { + @Override + public Object call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Removes a storage target from a cache. This operation is allowed at any time, but if the cache is down or unhealthy, the actual removal of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Object object + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String cacheName, String storageTargetName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (storageTargetName == null) { + throw new IllegalArgumentException("Parameter storageTargetName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, this.client.subscriptionId(), cacheName, storageTargetName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns a storage target from a cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the StorageTargetInner object if successful. + */ + public StorageTargetInner get(String resourceGroupName, String cacheName, String storageTargetName) { + return getWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName).toBlocking().single().body(); + } + + /** + * Returns a storage target from a cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String cacheName, String storageTargetName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName), serviceCallback); + } + + /** + * Returns a storage target from a cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the StorageTargetInner object + */ + public Observable getAsync(String resourceGroupName, String cacheName, String storageTargetName) { + return getWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName).map(new Func1, StorageTargetInner>() { + @Override + public StorageTargetInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Returns a storage target from a cache. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the StorageTargetInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String cacheName, String storageTargetName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (storageTargetName == null) { + throw new IllegalArgumentException("Parameter storageTargetName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, this.client.subscriptionId(), cacheName, storageTargetName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Create/update a storage target. This operation is allowed at any time, but if the cache is down or unhealthy, the actual creation/modification of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the StorageTargetInner object if successful. + */ + public StorageTargetInner create(String resourceGroupName, String cacheName, String storageTargetName) { + return createWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName).toBlocking().last().body(); + } + + /** + * Create/update a storage target. This operation is allowed at any time, but if the cache is down or unhealthy, the actual creation/modification of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String resourceGroupName, String cacheName, String storageTargetName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName), serviceCallback); + } + + /** + * Create/update a storage target. This operation is allowed at any time, but if the cache is down or unhealthy, the actual creation/modification of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String cacheName, String storageTargetName) { + return createWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName).map(new Func1, StorageTargetInner>() { + @Override + public StorageTargetInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create/update a storage target. This operation is allowed at any time, but if the cache is down or unhealthy, the actual creation/modification of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String cacheName, String storageTargetName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (storageTargetName == null) { + throw new IllegalArgumentException("Parameter storageTargetName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final StorageTargetInner storagetarget = null; + Observable> observable = service.create(resourceGroupName, this.client.subscriptionId(), cacheName, storageTargetName, this.client.apiVersion(), storagetarget, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Create/update a storage target. This operation is allowed at any time, but if the cache is down or unhealthy, the actual creation/modification of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @param storagetarget Object containing the definition of a storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the StorageTargetInner object if successful. + */ + public StorageTargetInner create(String resourceGroupName, String cacheName, String storageTargetName, StorageTargetInner storagetarget) { + return createWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName, storagetarget).toBlocking().last().body(); + } + + /** + * Create/update a storage target. This operation is allowed at any time, but if the cache is down or unhealthy, the actual creation/modification of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @param storagetarget Object containing the definition of a storage target. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String resourceGroupName, String cacheName, String storageTargetName, StorageTargetInner storagetarget, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName, storagetarget), serviceCallback); + } + + /** + * Create/update a storage target. This operation is allowed at any time, but if the cache is down or unhealthy, the actual creation/modification of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @param storagetarget Object containing the definition of a storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String cacheName, String storageTargetName, StorageTargetInner storagetarget) { + return createWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName, storagetarget).map(new Func1, StorageTargetInner>() { + @Override + public StorageTargetInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create/update a storage target. This operation is allowed at any time, but if the cache is down or unhealthy, the actual creation/modification of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @param storagetarget Object containing the definition of a storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String cacheName, String storageTargetName, StorageTargetInner storagetarget) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (storageTargetName == null) { + throw new IllegalArgumentException("Parameter storageTargetName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(storagetarget); + Observable> observable = service.create(resourceGroupName, this.client.subscriptionId(), cacheName, storageTargetName, this.client.apiVersion(), storagetarget, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create/update a storage target. This operation is allowed at any time, but if the cache is down or unhealthy, the actual creation/modification of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the StorageTargetInner object if successful. + */ + public StorageTargetInner beginCreate(String resourceGroupName, String cacheName, String storageTargetName) { + return beginCreateWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName).toBlocking().single().body(); + } + + /** + * Create/update a storage target. This operation is allowed at any time, but if the cache is down or unhealthy, the actual creation/modification of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateAsync(String resourceGroupName, String cacheName, String storageTargetName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName), serviceCallback); + } + + /** + * Create/update a storage target. This operation is allowed at any time, but if the cache is down or unhealthy, the actual creation/modification of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the StorageTargetInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String cacheName, String storageTargetName) { + return beginCreateWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName).map(new Func1, StorageTargetInner>() { + @Override + public StorageTargetInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create/update a storage target. This operation is allowed at any time, but if the cache is down or unhealthy, the actual creation/modification of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the StorageTargetInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String cacheName, String storageTargetName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (storageTargetName == null) { + throw new IllegalArgumentException("Parameter storageTargetName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final StorageTargetInner storagetarget = null; + return service.beginCreate(resourceGroupName, this.client.subscriptionId(), cacheName, storageTargetName, this.client.apiVersion(), storagetarget, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Create/update a storage target. This operation is allowed at any time, but if the cache is down or unhealthy, the actual creation/modification of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @param storagetarget Object containing the definition of a storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the StorageTargetInner object if successful. + */ + public StorageTargetInner beginCreate(String resourceGroupName, String cacheName, String storageTargetName, StorageTargetInner storagetarget) { + return beginCreateWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName, storagetarget).toBlocking().single().body(); + } + + /** + * Create/update a storage target. This operation is allowed at any time, but if the cache is down or unhealthy, the actual creation/modification of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @param storagetarget Object containing the definition of a storage target. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateAsync(String resourceGroupName, String cacheName, String storageTargetName, StorageTargetInner storagetarget, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName, storagetarget), serviceCallback); + } + + /** + * Create/update a storage target. This operation is allowed at any time, but if the cache is down or unhealthy, the actual creation/modification of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @param storagetarget Object containing the definition of a storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the StorageTargetInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String cacheName, String storageTargetName, StorageTargetInner storagetarget) { + return beginCreateWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName, storagetarget).map(new Func1, StorageTargetInner>() { + @Override + public StorageTargetInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create/update a storage target. This operation is allowed at any time, but if the cache is down or unhealthy, the actual creation/modification of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @param storagetarget Object containing the definition of a storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the StorageTargetInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String cacheName, String storageTargetName, StorageTargetInner storagetarget) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (storageTargetName == null) { + throw new IllegalArgumentException("Parameter storageTargetName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(storagetarget); + return service.beginCreate(resourceGroupName, this.client.subscriptionId(), cacheName, storageTargetName, this.client.apiVersion(), storagetarget, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Update a storage target. This operation is allowed at any time, but if the cache is down or unhealthy, the actual creation/modification of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the StorageTargetInner object if successful. + */ + public StorageTargetInner update(String resourceGroupName, String cacheName, String storageTargetName) { + return updateWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName).toBlocking().single().body(); + } + + /** + * Update a storage target. This operation is allowed at any time, but if the cache is down or unhealthy, the actual creation/modification of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String cacheName, String storageTargetName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName), serviceCallback); + } + + /** + * Update a storage target. This operation is allowed at any time, but if the cache is down or unhealthy, the actual creation/modification of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the StorageTargetInner object + */ + public Observable updateAsync(String resourceGroupName, String cacheName, String storageTargetName) { + return updateWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName).map(new Func1, StorageTargetInner>() { + @Override + public StorageTargetInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a storage target. This operation is allowed at any time, but if the cache is down or unhealthy, the actual creation/modification of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the StorageTargetInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String cacheName, String storageTargetName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (storageTargetName == null) { + throw new IllegalArgumentException("Parameter storageTargetName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final StorageTargetInner storagetarget = null; + return service.update(resourceGroupName, this.client.subscriptionId(), cacheName, storageTargetName, this.client.apiVersion(), storagetarget, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Update a storage target. This operation is allowed at any time, but if the cache is down or unhealthy, the actual creation/modification of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @param storagetarget Object containing the definition of a storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the StorageTargetInner object if successful. + */ + public StorageTargetInner update(String resourceGroupName, String cacheName, String storageTargetName, StorageTargetInner storagetarget) { + return updateWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName, storagetarget).toBlocking().single().body(); + } + + /** + * Update a storage target. This operation is allowed at any time, but if the cache is down or unhealthy, the actual creation/modification of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @param storagetarget Object containing the definition of a storage target. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String cacheName, String storageTargetName, StorageTargetInner storagetarget, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName, storagetarget), serviceCallback); + } + + /** + * Update a storage target. This operation is allowed at any time, but if the cache is down or unhealthy, the actual creation/modification of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @param storagetarget Object containing the definition of a storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the StorageTargetInner object + */ + public Observable updateAsync(String resourceGroupName, String cacheName, String storageTargetName, StorageTargetInner storagetarget) { + return updateWithServiceResponseAsync(resourceGroupName, cacheName, storageTargetName, storagetarget).map(new Func1, StorageTargetInner>() { + @Override + public StorageTargetInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a storage target. This operation is allowed at any time, but if the cache is down or unhealthy, the actual creation/modification of the storage target may be delayed until the cache is healthy again. + * + * @param resourceGroupName Target resource group. + * @param cacheName Name of cache. + * @param storageTargetName Name of storage target. + * @param storagetarget Object containing the definition of a storage target. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the StorageTargetInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String cacheName, String storageTargetName, StorageTargetInner storagetarget) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (cacheName == null) { + throw new IllegalArgumentException("Parameter cacheName is required and cannot be null."); + } + if (storageTargetName == null) { + throw new IllegalArgumentException("Parameter storageTargetName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(storagetarget); + return service.update(resourceGroupName, this.client.subscriptionId(), cacheName, storageTargetName, this.client.apiVersion(), storagetarget, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Returns the StorageTargets for this cache in the subscription and resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<StorageTargetInner> object if successful. + */ + public PagedList listByCacheNext(final String nextPageLink) { + ServiceResponse> response = listByCacheNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCacheNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Returns the StorageTargets for this cache in the subscription and resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByCacheNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCacheNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCacheNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Returns the StorageTargets for this cache in the subscription and resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<StorageTargetInner> object + */ + public Observable> listByCacheNextAsync(final String nextPageLink) { + return listByCacheNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Returns the StorageTargets for this cache in the subscription and resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<StorageTargetInner> object + */ + public Observable>> listByCacheNextWithServiceResponseAsync(final String nextPageLink) { + return listByCacheNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByCacheNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Returns the StorageTargets for this cache in the subscription and resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<StorageTargetInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCacheNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByCacheNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByCacheNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByCacheNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/UsageModelImpl.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/UsageModelImpl.java new file mode 100644 index 000000000000..6c5cf9c5fca7 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/UsageModelImpl.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; + +import com.microsoft.azure.management.storagecache.v2019_08_01.UsageModel; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.storagecache.v2019_08_01.UsageModelDisplay; + +class UsageModelImpl extends WrapperImpl implements UsageModel { + private final StorageCacheManager manager; + + UsageModelImpl(UsageModelInner inner, StorageCacheManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public StorageCacheManager manager() { + return this.manager; + } + + + + @Override + public UsageModelDisplay display() { + return this.inner().display(); + } + + @Override + public String modelName() { + return this.inner().modelName(); + } + + @Override + public String targetType() { + return this.inner().targetType(); + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/UsageModelInner.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/UsageModelInner.java new file mode 100644 index 000000000000..427660f508ea --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/UsageModelInner.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; + +import com.microsoft.azure.management.storagecache.v2019_08_01.UsageModelDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A usage model. + */ +public class UsageModelInner { + /** + * Localized information describing this usage model. + */ + @JsonProperty(value = "display") + private UsageModelDisplay display; + + /** + * Non localized keyword naming this usage model. + */ + @JsonProperty(value = "modelName") + private String modelName; + + /** + * The type of Storage Target to which this model is applicable (only nfs + * for now). + */ + @JsonProperty(value = "targetType") + private String targetType; + + /** + * Get localized information describing this usage model. + * + * @return the display value + */ + public UsageModelDisplay display() { + return this.display; + } + + /** + * Set localized information describing this usage model. + * + * @param display the display value to set + * @return the UsageModelInner object itself. + */ + public UsageModelInner withDisplay(UsageModelDisplay display) { + this.display = display; + return this; + } + + /** + * Get non localized keyword naming this usage model. + * + * @return the modelName value + */ + public String modelName() { + return this.modelName; + } + + /** + * Set non localized keyword naming this usage model. + * + * @param modelName the modelName value to set + * @return the UsageModelInner object itself. + */ + public UsageModelInner withModelName(String modelName) { + this.modelName = modelName; + return this; + } + + /** + * Get the type of Storage Target to which this model is applicable (only nfs for now). + * + * @return the targetType value + */ + public String targetType() { + return this.targetType; + } + + /** + * Set the type of Storage Target to which this model is applicable (only nfs for now). + * + * @param targetType the targetType value to set + * @return the UsageModelInner object itself. + */ + public UsageModelInner withTargetType(String targetType) { + this.targetType = targetType; + return this; + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/UsageModelsImpl.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/UsageModelsImpl.java new file mode 100644 index 000000000000..0fc1599672fb --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/UsageModelsImpl.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * jkl + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.storagecache.v2019_08_01.UsageModels; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.arm.utils.PagedListConverter; +import com.microsoft.azure.management.storagecache.v2019_08_01.UsageModel; + +class UsageModelsImpl extends WrapperImpl implements UsageModels { + private PagedListConverter converter; + private final StorageCacheManager manager; + + UsageModelsImpl(StorageCacheManager manager) { + super(manager.inner().usageModels()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(UsageModelInner inner) { + return Observable.just((UsageModel) wrapModel(inner)); + } + }; + } + + public StorageCacheManager manager() { + return this.manager; + } + + private UsageModelImpl wrapModel(UsageModelInner inner) { + return new UsageModelImpl(inner, manager()); + } + + @Override + public PagedList list() { + UsageModelsInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + UsageModelsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public UsageModel call(UsageModelInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/UsageModelsInner.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/UsageModelsInner.java new file mode 100644 index 000000000000..d9229c28734a --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/UsageModelsInner.java @@ -0,0 +1,287 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in UsageModels. + */ +public class UsageModelsInner { + /** The Retrofit service to perform REST calls. */ + private UsageModelsService service; + /** The service client containing this operation class. */ + private StorageCacheMgmtClientImpl client; + + /** + * Initializes an instance of UsageModelsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public UsageModelsInner(Retrofit retrofit, StorageCacheMgmtClientImpl client) { + this.service = retrofit.create(UsageModelsService.class); + this.client = client; + } + + /** + * The interface defining all the services for UsageModels to be + * used by Retrofit to perform actually REST calls. + */ + interface UsageModelsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.UsageModels list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/usageModels") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storagecache.v2019_08_01.UsageModels listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get the list of cache Usage Models available to this subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<UsageModelInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get the list of cache Usage Models available to this subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get the list of cache Usage Models available to this subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageModelInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get the list of cache Usage Models available to this subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageModelInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get the list of cache Usage Models available to this subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageModelInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Get the list of cache Usage Models available to this subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<UsageModelInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get the list of cache Usage Models available to this subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get the list of cache Usage Models available to this subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageModelInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get the list of cache Usage Models available to this subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageModelInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get the list of cache Usage Models available to this subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageModelInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/package-info.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/package-info.java new file mode 100644 index 000000000000..6233f716452e --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for StorageCacheMgmtClient. + * A Storage Cache provides scalable caching service for NAS clients, serving data from either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage caches. + */ +package com.microsoft.azure.management.storagecache.v2019_08_01.implementation; diff --git a/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/package-info.java b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/package-info.java new file mode 100644 index 000000000000..1494caf85fd6 --- /dev/null +++ b/storagecache/resource-manager/v2019_08_01/src/main/java/com/microsoft/azure/management/storagecache/v2019_08_01/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for StorageCacheMgmtClient. + * A Storage Cache provides scalable caching service for NAS clients, serving data from either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage caches. + */ +package com.microsoft.azure.management.storagecache.v2019_08_01;